From: Andrea Bianco Date: Sat, 28 Aug 2021 08:22:03 +0000 (+0200) Subject: Built motion from commit 120d16f0.|2.5.34 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22angular-material.layout.css/%22?a=commitdiff_plain;h=07829cac096ecc1d880017cf875030dd8a92ee8a;p=motion2.git Built motion from commit 120d16f0.|2.5.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e983650..264b85f 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-08-27T19:43:10.000Z", + "time": "2021-08-28T08:13:14.590Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 8fbde1e..e545d27 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-27T19:43:10.000Z", + "time": "2021-08-28T08:13:14.590Z", "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 7fa5463..1ea8577 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 _0xa900=['jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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','getDataValue','action','contactManager','motionbar'];(function(_0x250451,_0x4b4eb5){var _0x446180=function(_0x28124b){while(--_0x28124b){_0x250451['push'](_0x250451['shift']());}};_0x446180(++_0x4b4eb5);}(_0xa900,0x1da));var _0x0a90=function(_0x4e43d4,_0xd760d0){_0x4e43d4=_0x4e43d4-0x0;var _0x4db61c=_0xa900[_0x4e43d4];return _0x4db61c;};'use strict';var Sequelize=require(_0x0a90('0x0'));module[_0x0a90('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2019ef){return this[_0x0a90('0x2')](_0x0a90('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x0a90('0x4'),'integration',_0x0a90('0x5'),_0x0a90('0x6'),'urlForward',_0x0a90('0x7'),_0x0a90('0x8'),_0x0a90('0x9')]],'msg':_0x0a90('0xa')}},'comment':_0x0a90('0xa')},'data1':{'type':Sequelize[_0x0a90('0xb')](0x1000),'comment':_0x0a90('0xc')},'data2':{'type':Sequelize[_0x0a90('0xb')](0x1000),'comment':_0x0a90('0xd')},'data3':{'type':Sequelize[_0x0a90('0xb')](0x1000),'comment':_0x0a90('0xe')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x0a90('0xb')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x0a90('0xf')]}}; \ No newline at end of file +var _0x1645=['integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script'];(function(_0x502c77,_0x2863a0){var _0x2f0447=function(_0x4152bd){while(--_0x4152bd){_0x502c77['push'](_0x502c77['shift']());}};_0x2f0447(++_0x2863a0);}(_0x1645,0x113));var _0x5164=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1645[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5164('0x0'));module[_0x5164('0x1')]={'name':{'type':Sequelize[_0x5164('0x2')],'get':function(_0x48f275){return this['getDataValue'](_0x5164('0x3'));}},'action':{'type':Sequelize[_0x5164('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x5164('0x5'),_0x5164('0x6'),_0x5164('0x7'),_0x5164('0x8'),_0x5164('0x9'),_0x5164('0xa'),_0x5164('0xb'),_0x5164('0xc')]],'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[_0x5164('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x5164('0x4')](0x1000),'comment':_0x5164('0xd')},'data3':{'type':Sequelize[_0x5164('0x4')](0x1000),'comment':_0x5164('0xe')},'data4':{'type':Sequelize[_0x5164('0x4')](0x1000)},'data5':{'type':Sequelize[_0x5164('0x4')](0x1000)},'data6':{'type':Sequelize[_0x5164('0x4')]},'data7':{'type':Sequelize[_0x5164('0xf')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 03cd1d2..a818c46 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 _0x9401=['offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','body','Action','find','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json'];(function(_0x47b777,_0x564bc4){var _0x7dd031=function(_0x111593){while(--_0x111593){_0x47b777['push'](_0x47b777['shift']());}};_0x7dd031(++_0x564bc4);}(_0x9401,0x96));var _0x1940=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x9401[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0x1940('0x0'));var rimraf=require(_0x1940('0x1'));var zipdir=require(_0x1940('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1940('0x3'));var moment=require('moment');var BPromise=require(_0x1940('0x4'));var Mustache=require(_0x1940('0x5'));var util=require('util');var path=require(_0x1940('0x6'));var sox=require('sox');var csv=require(_0x1940('0x7'));var ejs=require(_0x1940('0x8'));var fs=require('fs');var fs_extra=require(_0x1940('0x9'));var _=require('lodash');var squel=require(_0x1940('0xa'));var crypto=require(_0x1940('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1940('0xc'));var toCsv=require(_0x1940('0x7'));var querystring=require(_0x1940('0xd'));var Papa=require('papaparse');var Redis=require(_0x1940('0xe'));var authService=require(_0x1940('0xf'));var qs=require(_0x1940('0x10'));var as=require(_0x1940('0x11'));var hardwareService=require(_0x1940('0x12'));var logger=require('../../config/logger')(_0x1940('0x13'));var utils=require(_0x1940('0x14'));var config=require(_0x1940('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1940('0x16'))['db'];function respondWithStatusCode(_0x3fb357,_0x524e27){_0x524e27=_0x524e27||0xcc;return function(_0x4730cc){if(_0x4730cc){return _0x3fb357['sendStatus'](_0x524e27);}return _0x3fb357[_0x1940('0x17')](_0x524e27)[_0x1940('0x18')]();};}function respondWithResult(_0x185381,_0xa1d08d){_0xa1d08d=_0xa1d08d||0xc8;return function(_0x146821){if(_0x146821){return _0x185381[_0x1940('0x17')](_0xa1d08d)[_0x1940('0x19')](_0x146821);}};}function respondWithFilteredResult(_0x4be089,_0x392e6f){return function(_0x2efbf8){if(_0x2efbf8){var _0x1c15de=typeof _0x392e6f[_0x1940('0x1a')]===_0x1940('0x1b')&&typeof _0x392e6f['limit']===_0x1940('0x1b');var _0x55de84=_0x2efbf8['count'];var _0x5b701a=_0x1c15de?0x0:_0x392e6f[_0x1940('0x1a')];var _0x467a48=_0x1c15de?_0x2efbf8[_0x1940('0x1c')]:_0x392e6f[_0x1940('0x1a')]+_0x392e6f[_0x1940('0x1d')];var _0x3630df;if(_0x467a48>=_0x55de84){_0x467a48=_0x55de84;_0x3630df=0xc8;}else{_0x3630df=0xce;}_0x4be089[_0x1940('0x17')](_0x3630df);return _0x4be089['set'](_0x1940('0x1e'),_0x5b701a+'-'+_0x467a48+'/'+_0x55de84)[_0x1940('0x19')](_0x2efbf8);}return null;};}function patchUpdates(_0x2159f1){return function(_0x2aa99a){try{jsonpatch[_0x1940('0x1f')](_0x2aa99a,_0x2159f1,!![]);}catch(_0x4aa942){return BPromise[_0x1940('0x20')](_0x4aa942);}return _0x2aa99a['save']();};}function saveUpdates(_0x1f531f,_0x18b972){return function(_0x5e3ee8){if(_0x5e3ee8){return _0x5e3ee8[_0x1940('0x21')](_0x1f531f)[_0x1940('0x22')](function(_0x6b6eb3){return _0x6b6eb3;});}return null;};}function removeEntity(_0x4a041e,_0x317c09){return function(_0x472462){if(_0x472462){return _0x472462[_0x1940('0x23')]()[_0x1940('0x22')](function(){_0x4a041e[_0x1940('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54876f,_0xc8aa3e){return function(_0x3c1f97){if(!_0x3c1f97){_0x54876f[_0x1940('0x24')](0x194);}return _0x3c1f97;};}function handleError(_0x3c813a,_0x2be89a){_0x2be89a=_0x2be89a||0x1f4;return function(_0x24a283){logger['error'](_0x24a283[_0x1940('0x25')]);if(_0x24a283[_0x1940('0x26')]){delete _0x24a283[_0x1940('0x26')];}_0x3c813a[_0x1940('0x17')](_0x2be89a)[_0x1940('0x27')](_0x24a283);};}exports['update']=function(_0x19b699,_0x5c5d4a){if(_0x19b699[_0x1940('0x28')]['id']){delete _0x19b699['body']['id'];}return db[_0x1940('0x29')][_0x1940('0x2a')]({'where':{'id':_0x19b699['params']['id']}})['then'](handleEntityNotFound(_0x5c5d4a,null))[_0x1940('0x22')](saveUpdates(_0x19b699[_0x1940('0x28')],null))[_0x1940('0x22')](respondWithResult(_0x5c5d4a,null))[_0x1940('0x2b')](handleError(_0x5c5d4a,null));};exports[_0x1940('0x23')]=function(_0x2ca273,_0xcb8d68){return db[_0x1940('0x29')][_0x1940('0x2a')]({'where':{'id':_0x2ca273['params']['id']}})[_0x1940('0x22')](handleEntityNotFound(_0xcb8d68,null))[_0x1940('0x22')](removeEntity(_0xcb8d68,null))[_0x1940('0x2b')](handleError(_0xcb8d68,null));}; \ No newline at end of file +var _0x360c=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','update','Action','find','params','body','catch','eml-format','rimraf','fast-json-patch','request-promise','util','sox'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x360c,0x1e9));var _0xc360=function(_0x49ef27,_0x1e89e3){_0x49ef27=_0x49ef27-0x0;var _0x151c39=_0x360c[_0x49ef27];return _0x151c39;};'use strict';var emlformat=require(_0xc360('0x0'));var rimraf=require(_0xc360('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc360('0x2'));var rp=require(_0xc360('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc360('0x4'));var path=require('path');var sox=require(_0xc360('0x5'));var csv=require(_0xc360('0x6'));var ejs=require(_0xc360('0x7'));var fs=require('fs');var fs_extra=require(_0xc360('0x8'));var _=require(_0xc360('0x9'));var squel=require(_0xc360('0xa'));var crypto=require('crypto');var jsforce=require(_0xc360('0xb'));var deskjs=require(_0xc360('0xc'));var toCsv=require(_0xc360('0x6'));var querystring=require(_0xc360('0xd'));var Papa=require(_0xc360('0xe'));var Redis=require(_0xc360('0xf'));var authService=require(_0xc360('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc360('0x11'));var hardwareService=require(_0xc360('0x12'));var logger=require('../../config/logger')(_0xc360('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc360('0x14'))['db'];function respondWithStatusCode(_0x5dc823,_0x388b98){_0x388b98=_0x388b98||0xcc;return function(_0x134efb){if(_0x134efb){return _0x5dc823[_0xc360('0x15')](_0x388b98);}return _0x5dc823['status'](_0x388b98)[_0xc360('0x16')]();};}function respondWithResult(_0x5267a4,_0x7b4592){_0x7b4592=_0x7b4592||0xc8;return function(_0x13c552){if(_0x13c552){return _0x5267a4[_0xc360('0x17')](_0x7b4592)['json'](_0x13c552);}};}function respondWithFilteredResult(_0x272219,_0x3a60bb){return function(_0x33b539){if(_0x33b539){var _0x691bdd=typeof _0x3a60bb[_0xc360('0x18')]===_0xc360('0x19')&&typeof _0x3a60bb[_0xc360('0x1a')]==='undefined';var _0x92965b=_0x33b539[_0xc360('0x1b')];var _0x43637c=_0x691bdd?0x0:_0x3a60bb[_0xc360('0x18')];var _0xcf277=_0x691bdd?_0x33b539[_0xc360('0x1b')]:_0x3a60bb[_0xc360('0x18')]+_0x3a60bb[_0xc360('0x1a')];var _0x3bddc1;if(_0xcf277>=_0x92965b){_0xcf277=_0x92965b;_0x3bddc1=0xc8;}else{_0x3bddc1=0xce;}_0x272219['status'](_0x3bddc1);return _0x272219[_0xc360('0x1c')](_0xc360('0x1d'),_0x43637c+'-'+_0xcf277+'/'+_0x92965b)[_0xc360('0x1e')](_0x33b539);}return null;};}function patchUpdates(_0x1a34ba){return function(_0x2d4f3b){try{jsonpatch[_0xc360('0x1f')](_0x2d4f3b,_0x1a34ba,!![]);}catch(_0x2c1641){return BPromise[_0xc360('0x20')](_0x2c1641);}return _0x2d4f3b[_0xc360('0x21')]();};}function saveUpdates(_0x5f177d,_0x3956a2){return function(_0x2a57b8){if(_0x2a57b8){return _0x2a57b8['update'](_0x5f177d)[_0xc360('0x22')](function(_0x349fc2){return _0x349fc2;});}return null;};}function removeEntity(_0x291c16,_0x17284f){return function(_0x122bcc){if(_0x122bcc){return _0x122bcc[_0xc360('0x23')]()[_0xc360('0x22')](function(){_0x291c16['status'](0xcc)[_0xc360('0x16')]();});}};}function handleEntityNotFound(_0x33e569,_0x25294d){return function(_0x582652){if(!_0x582652){_0x33e569[_0xc360('0x15')](0x194);}return _0x582652;};}function handleError(_0x4f3c38,_0x225083){_0x225083=_0x225083||0x1f4;return function(_0x1b34b9){logger[_0xc360('0x24')](_0x1b34b9['stack']);if(_0x1b34b9['name']){delete _0x1b34b9[_0xc360('0x25')];}_0x4f3c38['status'](_0x225083)[_0xc360('0x26')](_0x1b34b9);};}exports[_0xc360('0x27')]=function(_0x2cb151,_0x381d66){if(_0x2cb151['body']['id']){delete _0x2cb151['body']['id'];}return db[_0xc360('0x28')][_0xc360('0x29')]({'where':{'id':_0x2cb151[_0xc360('0x2a')]['id']}})[_0xc360('0x22')](handleEntityNotFound(_0x381d66,null))[_0xc360('0x22')](saveUpdates(_0x2cb151[_0xc360('0x2b')],null))[_0xc360('0x22')](respondWithResult(_0x381d66,null))[_0xc360('0x2c')](handleError(_0x381d66,null));};exports[_0xc360('0x23')]=function(_0x33bc52,_0x3bb87d){return db[_0xc360('0x28')][_0xc360('0x29')]({'where':{'id':_0x33bc52[_0xc360('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3bb87d,null))[_0xc360('0x22')](removeEntity(_0x3bb87d,null))[_0xc360('0x2c')](handleError(_0x3bb87d,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 17cea86..4151017 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 _0xbc72=['Action','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./action.attributes','exports','define'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0xbc72,0x85));var _0x2bc7=function(_0x36919d,_0x6ba456){_0x36919d=_0x36919d-0x0;var _0x456bdc=_0xbc72[_0x36919d];return _0x456bdc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2bc7('0x0'))(_0x2bc7('0x1'));var moment=require(_0x2bc7('0x2'));var BPromise=require(_0x2bc7('0x3'));var rp=require(_0x2bc7('0x4'));var fs=require('fs');var path=require(_0x2bc7('0x5'));var rimraf=require('rimraf');var config=require(_0x2bc7('0x6'));var attributes=require(_0x2bc7('0x7'));module[_0x2bc7('0x8')]=function(_0x32beeb,_0x23571a){return _0x32beeb[_0x2bc7('0x9')](_0x2bc7('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba91=['tools_actions','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action'];(function(_0x3fd0d4,_0x4bb3d1){var _0x9e1776=function(_0x477ea8){while(--_0x477ea8){_0x3fd0d4['push'](_0x3fd0d4['shift']());}};_0x9e1776(++_0x4bb3d1);}(_0xba91,0xaa));var _0x1ba9=function(_0x4f0fbc,_0x10512b){_0x4f0fbc=_0x4f0fbc-0x0;var _0x51fecb=_0xba91[_0x4f0fbc];return _0x51fecb;};'use strict';var _=require('lodash');var util=require(_0x1ba9('0x0'));var logger=require(_0x1ba9('0x1'))(_0x1ba9('0x2'));var moment=require(_0x1ba9('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ba9('0x4'));var fs=require('fs');var path=require(_0x1ba9('0x5'));var rimraf=require(_0x1ba9('0x6'));var config=require(_0x1ba9('0x7'));var attributes=require(_0x1ba9('0x8'));module[_0x1ba9('0x9')]=function(_0x3c95fd,_0x228ca7){return _0x3c95fd[_0x1ba9('0xa')](_0x1ba9('0xb'),attributes,{'tableName':_0x1ba9('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 0a6ce1b..7c0130a 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x581bd4,_0x5e47e8){var _0x3b336d=function(_0x511888){while(--_0x511888){_0x581bd4['push'](_0x581bd4['shift']());}};_0x3b336d(++_0x5e47e8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x18b0dd,_0x203bd2){var _0x2c802f=function(_0x1d5c70){while(--_0x1d5c70){_0x18b0dd['push'](_0x18b0dd['shift']());}};_0x2c802f(++_0x203bd2);}(_0x8ef6,0xf2));var _0x68ef=function(_0x41df60,_0x80bb3f){_0x41df60=_0x41df60-0x0;var _0x3c10c2=_0x8ef6[_0x41df60];return _0x3c10c2;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 18f03be..0a45748 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 _0x245a=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','isAuthenticated','delete','/:id','destroy','exports','util','path'];(function(_0x679197,_0x480b6d){var _0x5320eb=function(_0x5b8860){while(--_0x5b8860){_0x679197['push'](_0x679197['shift']());}};_0x5320eb(++_0x480b6d);}(_0x245a,0x1ec));var _0xa245=function(_0x1a55f1,_0x2fe833){_0x1a55f1=_0x1a55f1-0x0;var _0x484f00=_0x245a[_0x1a55f1];return _0x484f00;};'use strict';var multer=require('multer');var util=require(_0xa245('0x0'));var path=require(_0xa245('0x1'));var timeout=require(_0xa245('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa245('0x3'));var auth=require(_0xa245('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa245('0x5'));var controller=require(_0xa245('0x6'));router[_0xa245('0x7')]('/:id',auth[_0xa245('0x8')](),controller['update']);router[_0xa245('0x9')](_0xa245('0xa'),auth[_0xa245('0x8')](),controller[_0xa245('0xb')]);module[_0xa245('0xc')]=router; \ No newline at end of file +var _0xf731=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete'];(function(_0x4f130f,_0x305446){var _0x39f00d=function(_0x59b0f6){while(--_0x59b0f6){_0x4f130f['push'](_0x4f130f['shift']());}};_0x39f00d(++_0x305446);}(_0xf731,0xfe));var _0x1f73=function(_0x50cd30,_0x5c80e4){_0x50cd30=_0x50cd30-0x0;var _0x429652=_0xf731[_0x50cd30];return _0x429652;};'use strict';var multer=require(_0x1f73('0x0'));var util=require(_0x1f73('0x1'));var path=require('path');var timeout=require(_0x1f73('0x2'));var express=require('express');var router=express[_0x1f73('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f73('0x4'));var interaction=require(_0x1f73('0x5'));var config=require(_0x1f73('0x6'));var controller=require(_0x1f73('0x7'));router['put'](_0x1f73('0x8'),auth[_0x1f73('0x9')](),controller[_0x1f73('0xa')]);router[_0x1f73('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1f73('0xc')]);module[_0x1f73('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 f9f558a..e923f54 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x2675,0x75));var _0x5267=function(_0x43e478,_0x32313c){_0x43e478=_0x43e478-0x0;var _0x40f5a3=_0x2675[_0x43e478];return _0x40f5a3;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x397f04,_0x2d9ef5){var _0x249786=function(_0xcb369e){while(--_0xcb369e){_0x397f04['push'](_0x397f04['shift']());}};_0x249786(++_0x2d9ef5);}(_0x5fab,0x177));var _0xb5fa=function(_0x2fcadf,_0x401da6){_0x2fcadf=_0x2fcadf-0x0;var _0x2a2c05=_0x5fab[_0x2fcadf];return _0x2a2c05;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a54d930..1bc3f71 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 _0x59c7=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','count','limit','set','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','metric','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','sequelize','toString','QueryTypes','SELECT','right_join','IS\x20NULL','getFields','AnalyticMetric','MetricId','function','web','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','output','../../files/reports','savename','COUNT(*)','run','runReport','IS\x20NOT\x20NULL','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv'];(function(_0x43c7de,_0x58e306){var _0x3547f4=function(_0x1fa95a){while(--_0x1fa95a){_0x43c7de['push'](_0x43c7de['shift']());}};_0x3547f4(++_0x58e306);}(_0x59c7,0x1e7));var _0x759c=function(_0x3bee94,_0x382283){_0x3bee94=_0x3bee94-0x0;var _0x2d6147=_0x59c7[_0x3bee94];return _0x2d6147;};'use strict';var emlformat=require(_0x759c('0x0'));var rimraf=require(_0x759c('0x1'));var zipdir=require(_0x759c('0x2'));var jsonpatch=require(_0x759c('0x3'));var rp=require(_0x759c('0x4'));var moment=require(_0x759c('0x5'));var BPromise=require(_0x759c('0x6'));var Mustache=require(_0x759c('0x7'));var util=require('util');var path=require(_0x759c('0x8'));var sox=require(_0x759c('0x9'));var csv=require('to-csv');var ejs=require(_0x759c('0xa'));var fs=require('fs');var fs_extra=require(_0x759c('0xb'));var _=require(_0x759c('0xc'));var squel=require(_0x759c('0xd'));var crypto=require(_0x759c('0xe'));var jsforce=require(_0x759c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x759c('0x10'));var querystring=require(_0x759c('0x11'));var Papa=require('papaparse');var Redis=require(_0x759c('0x12'));var authService=require(_0x759c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x759c('0x14'));var hardwareService=require(_0x759c('0x15'));var logger=require(_0x759c('0x16'))(_0x759c('0x17'));var utils=require(_0x759c('0x18'));var config=require(_0x759c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x759c('0x1a'))['db'];var dbH=require(_0x759c('0x1a'))[_0x759c('0x1b')];function respondWithStatusCode(_0x3ec721,_0x13bb72){_0x13bb72=_0x13bb72||0xcc;return function(_0x1026d3){if(_0x1026d3){return _0x3ec721[_0x759c('0x1c')](_0x13bb72);}return _0x3ec721['status'](_0x13bb72)[_0x759c('0x1d')]();};}function respondWithResult(_0x5a39c1,_0x2c366c){_0x2c366c=_0x2c366c||0xc8;return function(_0x4ed5da){if(_0x4ed5da){return _0x5a39c1[_0x759c('0x1e')](_0x2c366c)[_0x759c('0x1f')](_0x4ed5da);}};}function respondWithFilteredResult(_0x55b54f,_0x37a40b){return function(_0x96d53d){if(_0x96d53d){var _0x141251=typeof _0x37a40b[_0x759c('0x20')]===_0x759c('0x21')&&typeof _0x37a40b['limit']===_0x759c('0x21');var _0x3a4f26=_0x96d53d[_0x759c('0x22')];var _0x140d22=_0x141251?0x0:_0x37a40b[_0x759c('0x20')];var _0x40b6d7=_0x141251?_0x96d53d['count']:_0x37a40b['offset']+_0x37a40b[_0x759c('0x23')];var _0x52615e;if(_0x40b6d7>=_0x3a4f26){_0x40b6d7=_0x3a4f26;_0x52615e=0xc8;}else{_0x52615e=0xce;}_0x55b54f['status'](_0x52615e);return _0x55b54f[_0x759c('0x24')]('Content-Range',_0x140d22+'-'+_0x40b6d7+'/'+_0x3a4f26)[_0x759c('0x1f')](_0x96d53d);}return null;};}function patchUpdates(_0x59b994){return function(_0x53c3b2){try{jsonpatch['apply'](_0x53c3b2,_0x59b994,!![]);}catch(_0x46b969){return BPromise['reject'](_0x46b969);}return _0x53c3b2[_0x759c('0x25')]();};}function saveUpdates(_0x58ef00,_0x5897b3){return function(_0x5b0d13){if(_0x5b0d13){return _0x5b0d13[_0x759c('0x26')](_0x58ef00)[_0x759c('0x27')](function(_0x1ce779){return _0x1ce779;});}return null;};}function removeEntity(_0x397788,_0x12039){return function(_0x229a09){if(_0x229a09){return _0x229a09[_0x759c('0x28')]()[_0x759c('0x27')](function(){var _0x2f3d9d=_0x229a09[_0x759c('0x29')]({'plain':!![]});var _0x18fac5='CustomReports';return db[_0x759c('0x2a')][_0x759c('0x28')]({'where':{'type':_0x18fac5,'resourceId':_0x2f3d9d['id']}})[_0x759c('0x27')](function(){return _0x229a09;});})[_0x759c('0x27')](function(){_0x397788[_0x759c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x434fbc,_0x506209){return function(_0x11bab5){if(!_0x11bab5){_0x434fbc[_0x759c('0x1c')](0x194);}return _0x11bab5;};}function handleError(_0xfc2262,_0x5418a1){_0x5418a1=_0x5418a1||0x1f4;return function(_0x19b22e){logger[_0x759c('0x2b')](_0x19b22e[_0x759c('0x2c')]);if(_0x19b22e[_0x759c('0x2d')]){delete _0x19b22e[_0x759c('0x2d')];}_0xfc2262[_0x759c('0x1e')](_0x5418a1)[_0x759c('0x2e')](_0x19b22e);};}exports[_0x759c('0x2f')]=function(_0x532e32,_0x1ae9df){var _0x4aa9b9={},_0x803cdb={},_0x54a881={'count':0x0,'rows':[]};var _0x50411c=_[_0x759c('0x30')](db['AnalyticCustomReport'][_0x759c('0x31')],function(_0x443360){return{'name':_0x443360['fieldName'],'type':_0x443360[_0x759c('0x32')][_0x759c('0x33')]};});_0x803cdb['model']=_[_0x759c('0x30')](_0x50411c,_0x759c('0x2d'));_0x803cdb['query']=_[_0x759c('0x34')](_0x532e32[_0x759c('0x35')]);_0x803cdb[_0x759c('0x36')]=_[_0x759c('0x37')](_0x803cdb['model'],_0x803cdb['query']);_0x4aa9b9[_0x759c('0x38')]=_[_0x759c('0x37')](_0x803cdb[_0x759c('0x39')],qs[_0x759c('0x3a')](_0x532e32[_0x759c('0x35')][_0x759c('0x3a')]));_0x4aa9b9[_0x759c('0x38')]=_0x4aa9b9[_0x759c('0x38')][_0x759c('0x3b')]?_0x4aa9b9['attributes']:_0x803cdb[_0x759c('0x39')];if(!_0x532e32['query'][_0x759c('0x3c')](_0x759c('0x3d'))){_0x4aa9b9[_0x759c('0x23')]=qs[_0x759c('0x23')](_0x532e32[_0x759c('0x35')][_0x759c('0x23')]);_0x4aa9b9[_0x759c('0x20')]=qs[_0x759c('0x20')](_0x532e32[_0x759c('0x35')][_0x759c('0x20')]);}_0x4aa9b9[_0x759c('0x3e')]=qs[_0x759c('0x3f')](_0x532e32['query'][_0x759c('0x3f')]);_0x4aa9b9[_0x759c('0x40')]=qs[_0x759c('0x36')](_[_0x759c('0x41')](_0x532e32[_0x759c('0x35')],_0x803cdb[_0x759c('0x36')]),_0x50411c);if(_0x532e32['query']['filter']){_0x4aa9b9['where']=_['merge'](_0x4aa9b9['where'],{'$or':_[_0x759c('0x30')](_0x50411c,function(_0x389bef){if(_0x389bef[_0x759c('0x32')]!==_0x759c('0x42')){var _0x5643e9={};_0x5643e9[_0x389bef[_0x759c('0x2d')]]={'$like':'%'+_0x532e32[_0x759c('0x35')][_0x759c('0x43')]+'%'};return _0x5643e9;}})});}_0x4aa9b9=_[_0x759c('0x44')]({},_0x4aa9b9,_0x532e32[_0x759c('0x45')]);var _0x1c49f2={'where':_0x4aa9b9[_0x759c('0x40')]};return db[_0x759c('0x46')][_0x759c('0x22')](_0x1c49f2)[_0x759c('0x27')](function(_0x3f0a2b){_0x54a881[_0x759c('0x22')]=_0x3f0a2b;if(_0x532e32[_0x759c('0x35')][_0x759c('0x47')]){_0x4aa9b9[_0x759c('0x48')]=[{'all':!![]}];}return db[_0x759c('0x46')][_0x759c('0x49')](_0x4aa9b9);})[_0x759c('0x27')](function(_0x15fb4e){_0x54a881[_0x759c('0x4a')]=_0x15fb4e;return _0x54a881;})[_0x759c('0x27')](respondWithFilteredResult(_0x1ae9df,_0x4aa9b9))[_0x759c('0x4b')](handleError(_0x1ae9df,null));};exports[_0x759c('0x4c')]=function(_0x350987,_0x5ddf75){var _0x2de9d8={'raw':![],'where':{'id':_0x350987['params']['id']}},_0x37509e={};_0x37509e[_0x759c('0x39')]=_[_0x759c('0x34')](db[_0x759c('0x46')]['rawAttributes']);_0x37509e['query']=_[_0x759c('0x34')](_0x350987[_0x759c('0x35')]);_0x37509e['filters']=_[_0x759c('0x37')](_0x37509e[_0x759c('0x39')],_0x37509e[_0x759c('0x35')]);_0x2de9d8[_0x759c('0x38')]=_['intersection'](_0x37509e['model'],qs[_0x759c('0x3a')](_0x350987[_0x759c('0x35')]['fields']));_0x2de9d8[_0x759c('0x38')]=_0x2de9d8[_0x759c('0x38')][_0x759c('0x3b')]?_0x2de9d8[_0x759c('0x38')]:_0x37509e[_0x759c('0x39')];if(_0x350987[_0x759c('0x35')][_0x759c('0x47')]){_0x2de9d8[_0x759c('0x48')]=[{'all':!![]}];}_0x2de9d8=_[_0x759c('0x44')]({},_0x2de9d8,_0x350987['options']);return db[_0x759c('0x46')][_0x759c('0x4d')](_0x2de9d8)[_0x759c('0x27')](handleEntityNotFound(_0x5ddf75,null))[_0x759c('0x27')](respondWithResult(_0x5ddf75,null))[_0x759c('0x4b')](handleError(_0x5ddf75,null));};exports[_0x759c('0x4e')]=function(_0x2644a6,_0x5ce538){return db[_0x759c('0x46')][_0x759c('0x4e')](_0x2644a6[_0x759c('0x4f')],{})[_0x759c('0x27')](function(_0x1ec9ce){var _0x46062b=_0x2644a6[_0x759c('0x50')][_0x759c('0x29')]({'plain':!![]});if(!_0x46062b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46062b['role']===_0x759c('0x50')){var _0x5397ba=_0x1ec9ce['get']({'plain':!![]});var _0xbd1565=_0x759c('0x51');return db[_0x759c('0x52')][_0x759c('0x4d')]({'where':{'name':_0xbd1565,'userProfileId':_0x46062b[_0x759c('0x53')]},'raw':!![]})[_0x759c('0x27')](function(_0x1a5789){if(_0x1a5789&&_0x1a5789[_0x759c('0x54')]===0x0){return db[_0x759c('0x2a')][_0x759c('0x4e')]({'name':_0x5397ba[_0x759c('0x2d')],'resourceId':_0x5397ba['id'],'type':'CustomReports','sectionId':_0x1a5789['id']},{})[_0x759c('0x27')](function(){return _0x1ec9ce;});}else{return _0x1ec9ce;}})['catch'](function(_0x50fdf0){logger[_0x759c('0x2b')](_0x759c('0x55'),_0x50fdf0);throw _0x50fdf0;});}return _0x1ec9ce;})[_0x759c('0x27')](respondWithResult(_0x5ce538,0xc9))[_0x759c('0x4b')](handleError(_0x5ce538,null));};exports[_0x759c('0x26')]=function(_0x3db736,_0x3e4538){if(_0x3db736[_0x759c('0x4f')]['id']){delete _0x3db736['body']['id'];}return db[_0x759c('0x46')]['find']({'where':{'id':_0x3db736['params']['id']}})['then'](handleEntityNotFound(_0x3e4538,null))[_0x759c('0x27')](saveUpdates(_0x3db736[_0x759c('0x4f')],null))[_0x759c('0x27')](respondWithResult(_0x3e4538,null))['catch'](handleError(_0x3e4538,null));};exports[_0x759c('0x28')]=function(_0x509c6d,_0xd86ad7){return db[_0x759c('0x46')][_0x759c('0x4d')]({'where':{'id':_0x509c6d[_0x759c('0x56')]['id']}})['then'](handleEntityNotFound(_0xd86ad7,null))[_0x759c('0x27')](removeEntity(_0xd86ad7,null))['catch'](handleError(_0xd86ad7,null));};exports[_0x759c('0x57')]=function(_0x1327ea,_0x1bd0c1){var _0x4ff3ab=0xa;var _0x43a09d=[_0x759c('0x58'),_0x759c('0x59'),'right_join',_0x759c('0x5a')];var _0x40b017={'SUM':_0x759c('0x5b'),'COUNT':_0x759c('0x5c'),'COUNT DISTINCT':_0x759c('0x5d'),'MAX':_0x759c('0x5e'),'MIN':_0x759c('0x5f'),'AVG':_0x759c('0x60'),'GROUP_CONCAT':_0x759c('0x61'),'GROUP_CONCAT ASC':_0x759c('0x62'),'GROUP_CONCAT DESC':_0x759c('0x63')};var _0x43f8f5={'SEC_TO_TIME':_0x759c('0x64'),'DATE':_0x759c('0x65'),'HOUR':_0x759c('0x66'),'ROUND':_0x759c('0x67'),'UNIX_TIMESTAMP':_0x759c('0x68')};var _0x20f38b=function(_0x243bc2){return!_[_0x759c('0x69')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x759c('0x6a'),_0x759c('0x6b')],_0x243bc2);};var _0x589743=function(_0x3c146d){if(!_0x3c146d||!_0x3c146d[_0x759c('0x6c')][_0x759c('0x3b')]){return'';}for(var _0x437a6a='(',_0x5dc423=0x0;_0x5dc423<_0x3c146d['rules'][_0x759c('0x3b')];_0x5dc423+=0x1){_0x5dc423>0x0&&(_0x437a6a+='\x20'+_0x3c146d[_0x759c('0x6d')]+'\x20');_0x437a6a+=_0x3c146d['rules'][_0x5dc423][_0x759c('0x6e')]?_0x589743(_0x3c146d[_0x759c('0x6c')][_0x5dc423][_0x759c('0x6e')]):_0x3c146d[_0x759c('0x6c')][_0x5dc423][_0x759c('0x6f')]+'\x20'+_0x3c146d[_0x759c('0x6c')][_0x5dc423][_0x759c('0x70')]+(_0x20f38b(_0x3c146d[_0x759c('0x6c')][_0x5dc423][_0x759c('0x70')])?'\x20'+_0x3c146d[_0x759c('0x6c')][_0x5dc423][_0x759c('0x71')]:'');}return _0x437a6a+')';};var _0xb8b592={'where':{'id':_0x1327ea[_0x759c('0x56')]['id']}},_0x45ac6f,_0x395c17,_0x42531c,_0x2f44e3,_0x37d364;_0xb8b592=_[_0x759c('0x44')]({},_0xb8b592,_0x1327ea[_0x759c('0x45')]);return db[_0x759c('0x46')][_0x759c('0x4d')](_0xb8b592)[_0x759c('0x27')](function(_0x2225f1){if(_0x2225f1){_0x45ac6f=_0x2225f1;return _0x2225f1['getFields']();}return null;})[_0x759c('0x27')](function(_0x91890b){if(_0x91890b){if(!_0x91890b['length']){throw new db[(_0x759c('0x72'))][(_0x759c('0x73'))](_0x759c('0x74'),0x193);}_0x395c17=_0x91890b;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x759c('0x27')](function(_0x59283a){if(_0x59283a){_0x42531c=_[_0x759c('0x75')](_0x59283a,'id');var _0x338c74;var _0x238feb=squel[_0x759c('0x76')]();_0x238feb[_0x759c('0x77')](_0x45ac6f[_0x759c('0x78')]);for(var _0x14d844=0x0;_0x14d844<_0x395c17['length'];_0x14d844+=0x1){_0x338c74=_0x395c17[_0x14d844]['MetricId']?_0x42531c[_0x395c17[_0x14d844]['MetricId']][_0x759c('0x79')]:_0x395c17[_0x14d844][_0x759c('0x6f')];_0x338c74=_0x395c17[_0x14d844]['function']?_['replace'](_0x40b017[_0x395c17[_0x14d844]['function']],'%s',_0x338c74):_0x338c74;_0x338c74=_0x395c17[_0x14d844][_0x759c('0x7a')]?_[_0x759c('0x7b')](_0x43f8f5[_0x395c17[_0x14d844][_0x759c('0x7a')]],'%s',_0x338c74):_0x338c74;if(_0x395c17[_0x14d844][_0x759c('0x7c')]){_0x238feb['group'](_0x338c74);}_0x395c17[_0x14d844][_0x759c('0x7d')]&&_0x238feb[_0x759c('0x3e')](_0x338c74,_0x395c17[_0x14d844][_0x759c('0x7d')]===_0x759c('0x7e')?![]:!![]);_0x238feb['field'](_0x338c74,_0x395c17[_0x14d844][_0x759c('0x7f')]||_0x338c74);}if(_0x45ac6f[_0x759c('0x80')]){_0x45ac6f[_0x759c('0x80')]=JSON[_0x759c('0x81')](_0x45ac6f[_0x759c('0x80')]);for(var _0x31701a=0x0;_0x31701a<_0x45ac6f[_0x759c('0x80')]['length'];_0x31701a+=0x1){if(_0x45ac6f[_0x759c('0x80')][_0x31701a]['type']&&_[_0x759c('0x69')](_0x43a09d,_0x45ac6f['joins'][_0x31701a]['type'])&&_0x45ac6f[_0x759c('0x80')][_0x31701a][_0x759c('0x82')]&&_0x45ac6f[_0x759c('0x80')][_0x31701a]['foreignTable']&&_0x45ac6f[_0x759c('0x80')][_0x31701a]['foreignKey']){_0x238feb[_0x45ac6f[_0x759c('0x80')][_0x31701a][_0x759c('0x32')]](_0x45ac6f['joins'][_0x31701a][_0x759c('0x83')],null,util[_0x759c('0x7a')](_0x759c('0x84'),_0x45ac6f[_0x759c('0x78')],_0x45ac6f[_0x759c('0x80')][_0x31701a][_0x759c('0x82')],_0x45ac6f[_0x759c('0x80')][_0x31701a][_0x759c('0x83')],_0x45ac6f[_0x759c('0x80')][_0x31701a][_0x759c('0x85')]));}}}if(_0x45ac6f[_0x759c('0x86')]){_0x45ac6f['conditions']=JSON[_0x759c('0x81')](_0x45ac6f[_0x759c('0x86')]);_0x238feb[_0x759c('0x40')](_0x589743(_0x45ac6f['conditions'][_0x759c('0x6e')]));}_0x37d364=_0x238feb[_0x759c('0x87')]();_0x238feb[_0x759c('0x23')](_0x4ff3ab);_0x238feb[_0x759c('0x20')](0x0);logger['debug']('Limited\x20Query:',_0x238feb['toString']());return dbH[_0x759c('0x88')][_0x759c('0x35')](_0x238feb[_0x759c('0x89')](),{'type':dbH['sequelize'][_0x759c('0x8a')][_0x759c('0x8b')]});}})[_0x759c('0x27')](respondWithResult(_0x1bd0c1,null))['catch'](handleError(_0x1bd0c1,null));};function runReport(_0x163a22,_0x3b4cf2,_0x34c32e){var _0x10887c=_0x3b4cf2[_0x759c('0x2d')];var _0x43799a=0xa;var _0x3e7b05=[_0x759c('0x58'),_0x759c('0x59'),_0x759c('0x8c'),'cross_join'];var _0x5a7897={'SUM':_0x759c('0x5b'),'COUNT':_0x759c('0x5c'),'COUNT DISTINCT':_0x759c('0x5d'),'MAX':_0x759c('0x5e'),'MIN':_0x759c('0x5f'),'AVG':_0x759c('0x60'),'GROUP_CONCAT':_0x759c('0x61'),'GROUP_CONCAT ASC':_0x759c('0x62'),'GROUP_CONCAT DESC':_0x759c('0x63')};var _0x55334e={'SEC_TO_TIME':_0x759c('0x64'),'DATE':_0x759c('0x65'),'HOUR':_0x759c('0x66'),'ROUND':_0x759c('0x67'),'UNIX_TIMESTAMP':_0x759c('0x68')};var _0x4ab9fb=function(_0x4cdab8){return!_[_0x759c('0x69')]([_0x759c('0x8d'),'IS\x20NOT\x20NULL',_0x759c('0x6a'),'IS\x20NOT\x20EMPTY'],_0x4cdab8);};var _0x1dcab8=function(_0x11aca9){if(!_0x11aca9||!_0x11aca9[_0x759c('0x6c')][_0x759c('0x3b')]){return'';}for(var _0x2923af='(',_0x57077f=0x0;_0x57077f<_0x11aca9[_0x759c('0x6c')][_0x759c('0x3b')];_0x57077f+=0x1){_0x57077f>0x0&&(_0x2923af+='\x20'+_0x11aca9[_0x759c('0x6d')]+'\x20');_0x2923af+=_0x11aca9[_0x759c('0x6c')][_0x57077f][_0x759c('0x6e')]?_0x1dcab8(_0x11aca9[_0x759c('0x6c')][_0x57077f][_0x759c('0x6e')]):_0x11aca9['rules'][_0x57077f]['field']+'\x20'+_0x11aca9[_0x759c('0x6c')][_0x57077f][_0x759c('0x70')]+(_0x4ab9fb(_0x11aca9[_0x759c('0x6c')][_0x57077f][_0x759c('0x70')])?'\x20'+_0x11aca9['rules'][_0x57077f][_0x759c('0x71')]:'');}return _0x2923af+')';};var _0x24e00a={'where':{'id':_0x163a22['id']}},_0x7c99ad,_0x141e69,_0x32f87e,_0xd5df2a,_0xe17829;_0x24e00a=_['merge']({},_0x24e00a,_0x34c32e);return db[_0x759c('0x46')]['find'](_0x24e00a)[_0x759c('0x27')](function(_0x5adf2d){if(_0x5adf2d){_0x7c99ad=_0x5adf2d;return _0x5adf2d[_0x759c('0x8e')]();}return null;})[_0x759c('0x27')](function(_0x32b775){if(_0x32b775){if(!_0x32b775[_0x759c('0x3b')]){throw new db[(_0x759c('0x72'))][(_0x759c('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x141e69=_0x32b775;return db[_0x759c('0x8f')][_0x759c('0x49')]({'raw':!![]});}return null;})[_0x759c('0x27')](function(_0x50f922){if(_0x50f922){_0x32f87e=_['keyBy'](_0x50f922,'id');var _0xe905db;var _0x4d309f=squel[_0x759c('0x76')]();_0x4d309f[_0x759c('0x77')](_0x7c99ad[_0x759c('0x78')]);for(var _0x3833d2=0x0;_0x3833d2<_0x141e69[_0x759c('0x3b')];_0x3833d2+=0x1){_0xe905db=_0x141e69[_0x3833d2][_0x759c('0x90')]?_0x32f87e[_0x141e69[_0x3833d2][_0x759c('0x90')]][_0x759c('0x79')]:_0x141e69[_0x3833d2][_0x759c('0x6f')];_0xe905db=_0x141e69[_0x3833d2][_0x759c('0x91')]?_[_0x759c('0x7b')](_0x5a7897[_0x141e69[_0x3833d2][_0x759c('0x91')]],'%s',_0xe905db):_0xe905db;_0xe905db=_0x141e69[_0x3833d2][_0x759c('0x7a')]?_[_0x759c('0x7b')](_0x55334e[_0x141e69[_0x3833d2][_0x759c('0x7a')]],'%s',_0xe905db):_0xe905db;if(_0x141e69[_0x3833d2]['groupBy']){_0x4d309f[_0x759c('0x6e')](_0xe905db);}_0x141e69[_0x3833d2][_0x759c('0x7d')]&&_0x4d309f[_0x759c('0x3e')](_0xe905db,_0x141e69[_0x3833d2][_0x759c('0x7d')]==='DESC'?![]:!![]);_0x4d309f['field'](_0xe905db,_0x141e69[_0x3833d2][_0x759c('0x7f')]||_0xe905db);}if(_0x7c99ad[_0x759c('0x80')]){_0x7c99ad[_0x759c('0x80')]=JSON[_0x759c('0x81')](_0x7c99ad[_0x759c('0x80')]);for(var _0x4780a9=0x0;_0x4780a9<_0x7c99ad[_0x759c('0x80')][_0x759c('0x3b')];_0x4780a9+=0x1){if(_0x7c99ad[_0x759c('0x80')][_0x4780a9][_0x759c('0x32')]&&_[_0x759c('0x69')](_0x3e7b05,_0x7c99ad[_0x759c('0x80')][_0x4780a9][_0x759c('0x32')])&&_0x7c99ad[_0x759c('0x80')][_0x4780a9]['parentKey']&&_0x7c99ad[_0x759c('0x80')][_0x4780a9]['foreignTable']&&_0x7c99ad['joins'][_0x4780a9]['foreignKey']){_0x4d309f[_0x7c99ad[_0x759c('0x80')][_0x4780a9][_0x759c('0x32')]](_0x7c99ad[_0x759c('0x80')][_0x4780a9][_0x759c('0x83')],null,util['format'](_0x759c('0x84'),_0x7c99ad[_0x759c('0x78')],_0x7c99ad[_0x759c('0x80')][_0x4780a9]['parentKey'],_0x7c99ad[_0x759c('0x80')][_0x4780a9]['foreignTable'],_0x7c99ad[_0x759c('0x80')][_0x4780a9][_0x759c('0x85')]));}}}if(_0x7c99ad[_0x759c('0x86')]){_0x7c99ad[_0x759c('0x86')]=JSON[_0x759c('0x81')](_0x7c99ad['conditions']);_0x4d309f['where'](_0x1dcab8(_0x7c99ad[_0x759c('0x86')][_0x759c('0x6e')]));}_0xe17829=_0x4d309f[_0x759c('0x87')]();_0x4d309f[_0x759c('0x23')](_0x43799a);_0x4d309f[_0x759c('0x20')](0x0);return;}})[_0x759c('0x27')](function(){if(_0x3b4cf2['output']===_0x759c('0x92')){return null;}var _0x15018e=_[_0x759c('0x44')](_0x3b4cf2,{'name':_0x3b4cf2['fullPath']||_0x3b4cf2[_0x759c('0x2d')]||_0x7c99ad[_0x759c('0x2d')],'basename':_0x10887c,'savename':util['format'](_0x759c('0x93'),_0x3b4cf2[_0x759c('0x2d')]||_0x7c99ad[_0x759c('0x2d')],require(_0x759c('0x94'))[_0x759c('0x95')](0x4),_0x3b4cf2['output']||_0x759c('0x96')),'reportId':_0x7c99ad['id'],'reportType':'custom'});return db[_0x759c('0x97')][_0x759c('0x4e')](_0x15018e,{'raw':!![]});})[_0x759c('0x27')](function(_0x1fcb2c){if(_0x7c99ad[_0x759c('0x78')]===_0x759c('0x98')){_0xe17829[_0x759c('0x40')](_0x7c99ad[_0x759c('0x78')]+_0x759c('0x99'),_0x3b4cf2['startDate'],_0x3b4cf2['endDate']);}else{_0xe17829['where'](_0x7c99ad['table']+_0x759c('0x9a'),_0x3b4cf2[_0x759c('0x9b')],_0x3b4cf2['endDate']);}if(_0x1fcb2c){logger[_0x759c('0x9c')](_0x759c('0x9d'),_0xe17829[_0x759c('0x89')]());require(_0x759c('0x9e'))[_0x759c('0x9f')](path['join'](__dirname,'../../components/export/',_0x1fcb2c[_0x759c('0xa0')]),[_0x1fcb2c['id'],_0xe17829[_0x759c('0x89')](),path[_0x759c('0x58')](__dirname,_0x759c('0xa1'),_0x1fcb2c[_0x759c('0xa2')]),_0x10887c]);return _0x1fcb2c;}else{var _0x4d74e3=squel[_0x759c('0x76')]();_0x4d74e3['from']('('+_0xe17829[_0x759c('0x89')]()+')','countTable');_0x4d74e3[_0x759c('0x6f')](_0x759c('0xa3'),'count');_0xe17829[_0x759c('0x23')](_0x3b4cf2['limit']||_0x43799a);_0xe17829[_0x759c('0x20')](_0x3b4cf2[_0x759c('0x20')]||0x0);return dbH[_0x759c('0x88')][_0x759c('0x35')](_0x4d74e3[_0x759c('0x89')](),{'type':dbH[_0x759c('0x88')][_0x759c('0x8a')][_0x759c('0x8b')]})[_0x759c('0x27')](function(_0x41d239){if(!_0x41d239[_0x759c('0x3b')]){_0xd5df2a=0x0;}else{_0xd5df2a=_0x41d239[0x0][_0x759c('0x22')]||0x0;}return dbH[_0x759c('0x88')][_0x759c('0x35')](_0xe17829[_0x759c('0x89')](),{'type':dbH[_0x759c('0x88')][_0x759c('0x8a')][_0x759c('0x8b')]});})[_0x759c('0x27')](function(_0x2a30e4){return{'rows':_0x2a30e4||[],'count':_0xd5df2a};});}});}exports[_0x759c('0xa4')]=function(_0x1db6d3,_0x4d3acb){return runReport(_0x1db6d3[_0x759c('0x56')],_0x1db6d3[_0x759c('0x35')],_0x1db6d3[_0x759c('0x45')])['then'](respondWithResult(_0x4d3acb,null))[_0x759c('0x4b')](handleError(_0x4d3acb,null));};exports[_0x759c('0xa5')]=runReport;exports[_0x759c('0x35')]=function(_0x5abc77,_0x324802){var _0x57bf3b=0xa;var _0x47626f=[_0x759c('0x58'),_0x759c('0x59'),_0x759c('0x8c'),'cross_join'];var _0x28b3ed={'SUM':_0x759c('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x759c('0x5d'),'MAX':'MAX(%s)','MIN':_0x759c('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x489160={'SEC_TO_TIME':_0x759c('0x64'),'DATE':'DATE(%s)','HOUR':_0x759c('0x66'),'ROUND':_0x759c('0x67'),'UNIX_TIMESTAMP':_0x759c('0x68')};var _0x324cdf=function(_0x593d75){return!_[_0x759c('0x69')]([_0x759c('0x8d'),_0x759c('0xa6'),_0x759c('0x6a'),_0x759c('0x6b')],_0x593d75);};var _0x543a3b=function(_0x3d4d1a){if(!_0x3d4d1a||!_0x3d4d1a[_0x759c('0x6c')][_0x759c('0x3b')]){return'';}for(var _0x23369f='(',_0xd6b782=0x0;_0xd6b782<_0x3d4d1a[_0x759c('0x6c')][_0x759c('0x3b')];_0xd6b782+=0x1){_0xd6b782>0x0&&(_0x23369f+='\x20'+_0x3d4d1a['operator']+'\x20');_0x23369f+=_0x3d4d1a[_0x759c('0x6c')][_0xd6b782]['group']?_0x543a3b(_0x3d4d1a[_0x759c('0x6c')][_0xd6b782][_0x759c('0x6e')]):_0x3d4d1a['rules'][_0xd6b782][_0x759c('0x6f')]+'\x20'+_0x3d4d1a[_0x759c('0x6c')][_0xd6b782][_0x759c('0x70')]+(_0x324cdf(_0x3d4d1a['rules'][_0xd6b782]['condition'])?'\x20'+_0x3d4d1a[_0x759c('0x6c')][_0xd6b782][_0x759c('0x71')]:'');}return _0x23369f+')';};var _0x56b61a={'where':{'id':_0x5abc77['params']['id']}},_0x58fa7e,_0x30ef14,_0x20b9ed,_0x41e5cb,_0x1c2bdb;_0x56b61a=_[_0x759c('0x44')]({},_0x56b61a,_0x5abc77[_0x759c('0x45')]);return db[_0x759c('0x46')]['find'](_0x56b61a)['then'](function(_0x29cbd4){if(_0x29cbd4){_0x58fa7e=_0x29cbd4;return _0x29cbd4[_0x759c('0x8e')]();}return null;})[_0x759c('0x27')](function(_0x3a6088){if(_0x3a6088){if(!_0x3a6088[_0x759c('0x3b')]){throw new db[(_0x759c('0x72'))][(_0x759c('0x73'))](_0x759c('0x74'),0x193);}_0x30ef14=_0x3a6088;return db[_0x759c('0x8f')]['findAll']({'raw':!![]});}return null;})[_0x759c('0x27')](function(_0x302c10){if(_0x302c10){_0x20b9ed=_[_0x759c('0x75')](_0x302c10,'id');var _0x42bc9c;var _0x3a4926=squel[_0x759c('0x76')]();_0x3a4926[_0x759c('0x77')](_0x58fa7e['table']);for(var _0x134d41=0x0;_0x134d41<_0x30ef14[_0x759c('0x3b')];_0x134d41+=0x1){_0x42bc9c=_0x30ef14[_0x134d41]['MetricId']?_0x20b9ed[_0x30ef14[_0x134d41]['MetricId']]['metric']:_0x30ef14[_0x134d41]['field'];_0x42bc9c=_0x30ef14[_0x134d41]['function']?_[_0x759c('0x7b')](_0x28b3ed[_0x30ef14[_0x134d41]['function']],'%s',_0x42bc9c):_0x42bc9c;_0x42bc9c=_0x30ef14[_0x134d41]['format']?_[_0x759c('0x7b')](_0x489160[_0x30ef14[_0x134d41][_0x759c('0x7a')]],'%s',_0x42bc9c):_0x42bc9c;if(_0x30ef14[_0x134d41][_0x759c('0x7c')]){_0x3a4926[_0x759c('0x6e')](_0x42bc9c);}_0x30ef14[_0x134d41]['orderBy']&&_0x3a4926['order'](_0x42bc9c,_0x30ef14[_0x134d41][_0x759c('0x7d')]===_0x759c('0x7e')?![]:!![]);_0x3a4926[_0x759c('0x6f')](_0x42bc9c,_0x30ef14[_0x134d41]['alias']||_0x42bc9c);}if(_0x58fa7e[_0x759c('0x80')]){_0x58fa7e['joins']=JSON[_0x759c('0x81')](_0x58fa7e[_0x759c('0x80')]);for(var _0xe36968=0x0;_0xe36968<_0x58fa7e[_0x759c('0x80')][_0x759c('0x3b')];_0xe36968+=0x1){if(_0x58fa7e[_0x759c('0x80')][_0xe36968][_0x759c('0x32')]&&_[_0x759c('0x69')](_0x47626f,_0x58fa7e['joins'][_0xe36968][_0x759c('0x32')])&&_0x58fa7e[_0x759c('0x80')][_0xe36968]['parentKey']&&_0x58fa7e[_0x759c('0x80')][_0xe36968][_0x759c('0x83')]&&_0x58fa7e[_0x759c('0x80')][_0xe36968][_0x759c('0x85')]){_0x3a4926[_0x58fa7e[_0x759c('0x80')][_0xe36968][_0x759c('0x32')]](_0x58fa7e[_0x759c('0x80')][_0xe36968][_0x759c('0x83')],null,util[_0x759c('0x7a')](_0x759c('0x84'),_0x58fa7e[_0x759c('0x78')],_0x58fa7e[_0x759c('0x80')][_0xe36968][_0x759c('0x82')],_0x58fa7e['joins'][_0xe36968][_0x759c('0x83')],_0x58fa7e[_0x759c('0x80')][_0xe36968][_0x759c('0x85')]));}}}if(_0x58fa7e[_0x759c('0x86')]){_0x58fa7e['conditions']=JSON['parse'](_0x58fa7e['conditions']);_0x3a4926['where'](_0x543a3b(_0x58fa7e[_0x759c('0x86')][_0x759c('0x6e')]));}_0x1c2bdb=_0x3a4926[_0x759c('0x87')]();_0x3a4926['limit'](_0x57bf3b);_0x3a4926[_0x759c('0x20')](0x0);logger[_0x759c('0xa7')]('Limited\x20Query:',_0x3a4926[_0x759c('0x89')]());return dbH[_0x759c('0x88')]['query'](_0x3a4926[_0x759c('0x89')](),{'type':dbH[_0x759c('0x88')]['QueryTypes'][_0x759c('0x8b')]});}})[_0x759c('0x27')](function(){return{'sql':_0x1c2bdb[_0x759c('0x89')]()};})[_0x759c('0x27')](respondWithResult(_0x324802,null))[_0x759c('0x4b')](handleError(_0x324802,null));}; \ No newline at end of file +var _0x6e43=['select','MetricId','metric','function','replace','format','orderBy','order','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','MIN(%s)','IS\x20NULL','from','groupBy','table','clone','output','web','randomstring','generate','csv','custom','cdr','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','runReport','right_join','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','DESC','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','then','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','UserProfileResource','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','keyBy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e43,0x172));var _0x36e4=function(_0x561e2c,_0x33a6cd){_0x561e2c=_0x561e2c-0x0;var _0x34972e=_0x6e43[_0x561e2c];return _0x34972e;};'use strict';var emlformat=require(_0x36e4('0x0'));var rimraf=require(_0x36e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x36e4('0x2'));var moment=require(_0x36e4('0x3'));var BPromise=require(_0x36e4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x36e4('0x5'));var sox=require(_0x36e4('0x6'));var csv=require(_0x36e4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36e4('0x8'));var squel=require(_0x36e4('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x36e4('0xa'));var toCsv=require(_0x36e4('0x7'));var querystring=require(_0x36e4('0xb'));var Papa=require(_0x36e4('0xc'));var Redis=require(_0x36e4('0xd'));var authService=require(_0x36e4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x36e4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x36e4('0x10'));var utils=require(_0x36e4('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x36e4('0x12'))['dbH'];function respondWithStatusCode(_0x548a24,_0x1006cc){_0x1006cc=_0x1006cc||0xcc;return function(_0xd8693e){if(_0xd8693e){return _0x548a24[_0x36e4('0x13')](_0x1006cc);}return _0x548a24['status'](_0x1006cc)[_0x36e4('0x14')]();};}function respondWithResult(_0xd00873,_0x29674a){_0x29674a=_0x29674a||0xc8;return function(_0x3e7d20){if(_0x3e7d20){return _0xd00873[_0x36e4('0x15')](_0x29674a)[_0x36e4('0x16')](_0x3e7d20);}};}function respondWithFilteredResult(_0x4d79ab,_0x33fc9b){return function(_0x55b6c5){if(_0x55b6c5){var _0x1f0b86=typeof _0x33fc9b[_0x36e4('0x17')]===_0x36e4('0x18')&&typeof _0x33fc9b[_0x36e4('0x19')]===_0x36e4('0x18');var _0x5e925d=_0x55b6c5[_0x36e4('0x1a')];var _0x2225b7=_0x1f0b86?0x0:_0x33fc9b[_0x36e4('0x17')];var _0x1c95a5=_0x1f0b86?_0x55b6c5['count']:_0x33fc9b[_0x36e4('0x17')]+_0x33fc9b[_0x36e4('0x19')];var _0x33a68c;if(_0x1c95a5>=_0x5e925d){_0x1c95a5=_0x5e925d;_0x33a68c=0xc8;}else{_0x33a68c=0xce;}_0x4d79ab[_0x36e4('0x15')](_0x33a68c);return _0x4d79ab[_0x36e4('0x1b')](_0x36e4('0x1c'),_0x2225b7+'-'+_0x1c95a5+'/'+_0x5e925d)[_0x36e4('0x16')](_0x55b6c5);}return null;};}function patchUpdates(_0x5da534){return function(_0x523cef){try{jsonpatch[_0x36e4('0x1d')](_0x523cef,_0x5da534,!![]);}catch(_0x599eb8){return BPromise[_0x36e4('0x1e')](_0x599eb8);}return _0x523cef[_0x36e4('0x1f')]();};}function saveUpdates(_0x1d2900,_0x5e1694){return function(_0x538e2e){if(_0x538e2e){return _0x538e2e['update'](_0x1d2900)['then'](function(_0x37f838){return _0x37f838;});}return null;};}function removeEntity(_0x1db326,_0x1be3ef){return function(_0x310968){if(_0x310968){return _0x310968[_0x36e4('0x20')]()['then'](function(){var _0x1b99b5=_0x310968[_0x36e4('0x21')]({'plain':!![]});var _0x43ece9='CustomReports';return db['UserProfileResource'][_0x36e4('0x20')]({'where':{'type':_0x43ece9,'resourceId':_0x1b99b5['id']}})[_0x36e4('0x22')](function(){return _0x310968;});})['then'](function(){_0x1db326[_0x36e4('0x15')](0xcc)[_0x36e4('0x14')]();});}};}function handleEntityNotFound(_0x111be6,_0x26ebdb){return function(_0x5df1e7){if(!_0x5df1e7){_0x111be6[_0x36e4('0x13')](0x194);}return _0x5df1e7;};}function handleError(_0x1c7636,_0x2e2917){_0x2e2917=_0x2e2917||0x1f4;return function(_0x1f0821){logger['error'](_0x1f0821['stack']);if(_0x1f0821[_0x36e4('0x23')]){delete _0x1f0821[_0x36e4('0x23')];}_0x1c7636[_0x36e4('0x15')](_0x2e2917)[_0x36e4('0x24')](_0x1f0821);};}exports[_0x36e4('0x25')]=function(_0x4a3442,_0x33b4d1){var _0x244c73={},_0x1f88ab={},_0x241c14={'count':0x0,'rows':[]};var _0x3da4f6=_[_0x36e4('0x26')](db[_0x36e4('0x27')][_0x36e4('0x28')],function(_0x523539){return{'name':_0x523539[_0x36e4('0x29')],'type':_0x523539[_0x36e4('0x2a')][_0x36e4('0x2b')]};});_0x1f88ab[_0x36e4('0x2c')]=_[_0x36e4('0x26')](_0x3da4f6,_0x36e4('0x23'));_0x1f88ab['query']=_[_0x36e4('0x2d')](_0x4a3442[_0x36e4('0x2e')]);_0x1f88ab[_0x36e4('0x2f')]=_['intersection'](_0x1f88ab['model'],_0x1f88ab[_0x36e4('0x2e')]);_0x244c73[_0x36e4('0x30')]=_[_0x36e4('0x31')](_0x1f88ab[_0x36e4('0x2c')],qs['fields'](_0x4a3442[_0x36e4('0x2e')][_0x36e4('0x32')]));_0x244c73[_0x36e4('0x30')]=_0x244c73['attributes'][_0x36e4('0x33')]?_0x244c73[_0x36e4('0x30')]:_0x1f88ab[_0x36e4('0x2c')];if(!_0x4a3442['query'][_0x36e4('0x34')](_0x36e4('0x35'))){_0x244c73[_0x36e4('0x19')]=qs[_0x36e4('0x19')](_0x4a3442[_0x36e4('0x2e')][_0x36e4('0x19')]);_0x244c73[_0x36e4('0x17')]=qs[_0x36e4('0x17')](_0x4a3442['query'][_0x36e4('0x17')]);}_0x244c73['order']=qs[_0x36e4('0x36')](_0x4a3442[_0x36e4('0x2e')]['sort']);_0x244c73[_0x36e4('0x37')]=qs['filters'](_[_0x36e4('0x38')](_0x4a3442[_0x36e4('0x2e')],_0x1f88ab[_0x36e4('0x2f')]),_0x3da4f6);if(_0x4a3442['query'][_0x36e4('0x39')]){_0x244c73[_0x36e4('0x37')]=_[_0x36e4('0x3a')](_0x244c73[_0x36e4('0x37')],{'$or':_[_0x36e4('0x26')](_0x3da4f6,function(_0x36fd78){if(_0x36fd78[_0x36e4('0x2a')]!==_0x36e4('0x3b')){var _0x235111={};_0x235111[_0x36fd78[_0x36e4('0x23')]]={'$like':'%'+_0x4a3442[_0x36e4('0x2e')][_0x36e4('0x39')]+'%'};return _0x235111;}})});}_0x244c73=_[_0x36e4('0x3a')]({},_0x244c73,_0x4a3442[_0x36e4('0x3c')]);var _0x174357={'where':_0x244c73['where']};return db[_0x36e4('0x27')]['count'](_0x174357)[_0x36e4('0x22')](function(_0x22c2e3){_0x241c14[_0x36e4('0x1a')]=_0x22c2e3;if(_0x4a3442[_0x36e4('0x2e')][_0x36e4('0x3d')]){_0x244c73['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x36e4('0x3e')](_0x244c73);})[_0x36e4('0x22')](function(_0x5a71f2){_0x241c14[_0x36e4('0x3f')]=_0x5a71f2;return _0x241c14;})[_0x36e4('0x22')](respondWithFilteredResult(_0x33b4d1,_0x244c73))[_0x36e4('0x40')](handleError(_0x33b4d1,null));};exports['show']=function(_0x132f5d,_0x1f3b0f){var _0x9b3a73={'raw':![],'where':{'id':_0x132f5d[_0x36e4('0x41')]['id']}},_0x4c28c5={};_0x4c28c5[_0x36e4('0x2c')]=_[_0x36e4('0x2d')](db[_0x36e4('0x27')][_0x36e4('0x28')]);_0x4c28c5[_0x36e4('0x2e')]=_[_0x36e4('0x2d')](_0x132f5d['query']);_0x4c28c5[_0x36e4('0x2f')]=_[_0x36e4('0x31')](_0x4c28c5[_0x36e4('0x2c')],_0x4c28c5[_0x36e4('0x2e')]);_0x9b3a73[_0x36e4('0x30')]=_['intersection'](_0x4c28c5[_0x36e4('0x2c')],qs['fields'](_0x132f5d[_0x36e4('0x2e')][_0x36e4('0x32')]));_0x9b3a73['attributes']=_0x9b3a73[_0x36e4('0x30')][_0x36e4('0x33')]?_0x9b3a73[_0x36e4('0x30')]:_0x4c28c5[_0x36e4('0x2c')];if(_0x132f5d[_0x36e4('0x2e')][_0x36e4('0x3d')]){_0x9b3a73[_0x36e4('0x42')]=[{'all':!![]}];}_0x9b3a73=_[_0x36e4('0x3a')]({},_0x9b3a73,_0x132f5d[_0x36e4('0x3c')]);return db[_0x36e4('0x27')][_0x36e4('0x43')](_0x9b3a73)['then'](handleEntityNotFound(_0x1f3b0f,null))[_0x36e4('0x22')](respondWithResult(_0x1f3b0f,null))[_0x36e4('0x40')](handleError(_0x1f3b0f,null));};exports[_0x36e4('0x44')]=function(_0x2b0ecd,_0x5a3751){return db['AnalyticCustomReport']['create'](_0x2b0ecd[_0x36e4('0x45')],{})[_0x36e4('0x22')](function(_0x329ef0){var _0x492743=_0x2b0ecd[_0x36e4('0x46')][_0x36e4('0x21')]({'plain':!![]});if(!_0x492743)throw new Error(_0x36e4('0x47'));if(_0x492743['role']===_0x36e4('0x46')){var _0xd7a85=_0x329ef0[_0x36e4('0x21')]({'plain':!![]});var _0x351bf0=_0x36e4('0x48');return db[_0x36e4('0x49')][_0x36e4('0x43')]({'where':{'name':_0x351bf0,'userProfileId':_0x492743['userProfileId']},'raw':!![]})[_0x36e4('0x22')](function(_0x189a68){if(_0x189a68&&_0x189a68[_0x36e4('0x4a')]===0x0){return db[_0x36e4('0x4b')][_0x36e4('0x44')]({'name':_0xd7a85[_0x36e4('0x23')],'resourceId':_0xd7a85['id'],'type':_0x36e4('0x4c'),'sectionId':_0x189a68['id']},{})[_0x36e4('0x22')](function(){return _0x329ef0;});}else{return _0x329ef0;}})[_0x36e4('0x40')](function(_0x2c8f18){logger[_0x36e4('0x4d')](_0x36e4('0x4e'),_0x2c8f18);throw _0x2c8f18;});}return _0x329ef0;})[_0x36e4('0x22')](respondWithResult(_0x5a3751,0xc9))[_0x36e4('0x40')](handleError(_0x5a3751,null));};exports[_0x36e4('0x4f')]=function(_0x40068a,_0x43fc97){if(_0x40068a[_0x36e4('0x45')]['id']){delete _0x40068a[_0x36e4('0x45')]['id'];}return db[_0x36e4('0x27')][_0x36e4('0x43')]({'where':{'id':_0x40068a[_0x36e4('0x41')]['id']}})[_0x36e4('0x22')](handleEntityNotFound(_0x43fc97,null))['then'](saveUpdates(_0x40068a[_0x36e4('0x45')],null))[_0x36e4('0x22')](respondWithResult(_0x43fc97,null))[_0x36e4('0x40')](handleError(_0x43fc97,null));};exports['destroy']=function(_0x5eb433,_0x615fde){return db[_0x36e4('0x27')][_0x36e4('0x43')]({'where':{'id':_0x5eb433[_0x36e4('0x41')]['id']}})[_0x36e4('0x22')](handleEntityNotFound(_0x615fde,null))[_0x36e4('0x22')](removeEntity(_0x615fde,null))[_0x36e4('0x40')](handleError(_0x615fde,null));};exports[_0x36e4('0x50')]=function(_0x553e89,_0x220c78){var _0x39dd47=0xa;var _0x279e19=[_0x36e4('0x51'),_0x36e4('0x52'),'right_join',_0x36e4('0x53')];var _0x4f582b={'SUM':_0x36e4('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x36e4('0x55'),'MAX':_0x36e4('0x56'),'MIN':'MIN(%s)','AVG':_0x36e4('0x57'),'GROUP_CONCAT':_0x36e4('0x58'),'GROUP_CONCAT ASC':_0x36e4('0x59'),'GROUP_CONCAT DESC':_0x36e4('0x5a')};var _0x1b2594={'SEC_TO_TIME':_0x36e4('0x5b'),'DATE':_0x36e4('0x5c'),'HOUR':_0x36e4('0x5d'),'ROUND':_0x36e4('0x5e'),'UNIX_TIMESTAMP':_0x36e4('0x5f')};var _0x145e1c=function(_0x1b6859){return!_[_0x36e4('0x60')](['IS\x20NULL',_0x36e4('0x61'),_0x36e4('0x62'),_0x36e4('0x63')],_0x1b6859);};var _0x1fd3a2=function(_0x232ad3){if(!_0x232ad3||!_0x232ad3['rules']['length']){return'';}for(var _0x289861='(',_0xb1035a=0x0;_0xb1035a<_0x232ad3[_0x36e4('0x64')][_0x36e4('0x33')];_0xb1035a+=0x1){_0xb1035a>0x0&&(_0x289861+='\x20'+_0x232ad3[_0x36e4('0x65')]+'\x20');_0x289861+=_0x232ad3[_0x36e4('0x64')][_0xb1035a][_0x36e4('0x66')]?_0x1fd3a2(_0x232ad3['rules'][_0xb1035a][_0x36e4('0x66')]):_0x232ad3[_0x36e4('0x64')][_0xb1035a][_0x36e4('0x67')]+'\x20'+_0x232ad3[_0x36e4('0x64')][_0xb1035a][_0x36e4('0x68')]+(_0x145e1c(_0x232ad3['rules'][_0xb1035a][_0x36e4('0x68')])?'\x20'+_0x232ad3['rules'][_0xb1035a][_0x36e4('0x69')]:'');}return _0x289861+')';};var _0x417284={'where':{'id':_0x553e89['params']['id']}},_0x39eb65,_0x46288d,_0x42ec6a,_0x725602,_0x2145ad;_0x417284=_[_0x36e4('0x3a')]({},_0x417284,_0x553e89[_0x36e4('0x3c')]);return db[_0x36e4('0x27')][_0x36e4('0x43')](_0x417284)[_0x36e4('0x22')](function(_0x4330db){if(_0x4330db){_0x39eb65=_0x4330db;return _0x4330db[_0x36e4('0x6a')]();}return null;})[_0x36e4('0x22')](function(_0x159f39){if(_0x159f39){if(!_0x159f39[_0x36e4('0x33')]){throw new db[(_0x36e4('0x6b'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x46288d=_0x159f39;return db[_0x36e4('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x36e4('0x22')](function(_0x2d359a){if(_0x2d359a){_0x42ec6a=_[_0x36e4('0x6d')](_0x2d359a,'id');var _0x313ee8;var _0x51d02d=squel[_0x36e4('0x6e')]();_0x51d02d['from'](_0x39eb65['table']);for(var _0x2088a3=0x0;_0x2088a3<_0x46288d[_0x36e4('0x33')];_0x2088a3+=0x1){_0x313ee8=_0x46288d[_0x2088a3][_0x36e4('0x6f')]?_0x42ec6a[_0x46288d[_0x2088a3][_0x36e4('0x6f')]][_0x36e4('0x70')]:_0x46288d[_0x2088a3][_0x36e4('0x67')];_0x313ee8=_0x46288d[_0x2088a3][_0x36e4('0x71')]?_[_0x36e4('0x72')](_0x4f582b[_0x46288d[_0x2088a3][_0x36e4('0x71')]],'%s',_0x313ee8):_0x313ee8;_0x313ee8=_0x46288d[_0x2088a3][_0x36e4('0x73')]?_[_0x36e4('0x72')](_0x1b2594[_0x46288d[_0x2088a3][_0x36e4('0x73')]],'%s',_0x313ee8):_0x313ee8;if(_0x46288d[_0x2088a3]['groupBy']){_0x51d02d[_0x36e4('0x66')](_0x313ee8);}_0x46288d[_0x2088a3][_0x36e4('0x74')]&&_0x51d02d[_0x36e4('0x75')](_0x313ee8,_0x46288d[_0x2088a3][_0x36e4('0x74')]==='DESC'?![]:!![]);_0x51d02d[_0x36e4('0x67')](_0x313ee8,_0x46288d[_0x2088a3][_0x36e4('0x76')]||_0x313ee8);}if(_0x39eb65[_0x36e4('0x77')]){_0x39eb65['joins']=JSON['parse'](_0x39eb65['joins']);for(var _0x59102d=0x0;_0x59102d<_0x39eb65[_0x36e4('0x77')]['length'];_0x59102d+=0x1){if(_0x39eb65['joins'][_0x59102d]['type']&&_['includes'](_0x279e19,_0x39eb65['joins'][_0x59102d][_0x36e4('0x2a')])&&_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x78')]&&_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x79')]&&_0x39eb65['joins'][_0x59102d][_0x36e4('0x7a')]){_0x51d02d[_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x2a')]](_0x39eb65[_0x36e4('0x77')][_0x59102d]['foreignTable'],null,util[_0x36e4('0x73')](_0x36e4('0x7b'),_0x39eb65['table'],_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x78')],_0x39eb65['joins'][_0x59102d][_0x36e4('0x79')],_0x39eb65[_0x36e4('0x77')][_0x59102d][_0x36e4('0x7a')]));}}}if(_0x39eb65['conditions']){_0x39eb65[_0x36e4('0x7c')]=JSON[_0x36e4('0x7d')](_0x39eb65[_0x36e4('0x7c')]);_0x51d02d[_0x36e4('0x37')](_0x1fd3a2(_0x39eb65[_0x36e4('0x7c')][_0x36e4('0x66')]));}_0x2145ad=_0x51d02d['clone']();_0x51d02d[_0x36e4('0x19')](_0x39dd47);_0x51d02d[_0x36e4('0x17')](0x0);logger[_0x36e4('0x7e')](_0x36e4('0x7f'),_0x51d02d['toString']());return dbH[_0x36e4('0x80')][_0x36e4('0x2e')](_0x51d02d[_0x36e4('0x81')](),{'type':dbH[_0x36e4('0x80')][_0x36e4('0x82')][_0x36e4('0x83')]});}})[_0x36e4('0x22')](respondWithResult(_0x220c78,null))[_0x36e4('0x40')](handleError(_0x220c78,null));};function runReport(_0x4a10c0,_0x15ed88,_0x32966d){var _0x518387=_0x15ed88[_0x36e4('0x23')];var _0x5f4cda=0xa;var _0x3ad654=[_0x36e4('0x51'),'left_join','right_join',_0x36e4('0x53')];var _0xb50ee7={'SUM':_0x36e4('0x54'),'COUNT':_0x36e4('0x84'),'COUNT DISTINCT':_0x36e4('0x55'),'MAX':_0x36e4('0x56'),'MIN':_0x36e4('0x85'),'AVG':_0x36e4('0x57'),'GROUP_CONCAT':_0x36e4('0x58'),'GROUP_CONCAT ASC':_0x36e4('0x59'),'GROUP_CONCAT DESC':_0x36e4('0x5a')};var _0x39abff={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x36e4('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x36e4('0x5e'),'UNIX_TIMESTAMP':_0x36e4('0x5f')};var _0x161fbe=function(_0x5cbb85){return!_[_0x36e4('0x60')]([_0x36e4('0x86'),_0x36e4('0x61'),_0x36e4('0x62'),'IS\x20NOT\x20EMPTY'],_0x5cbb85);};var _0x229870=function(_0x483145){if(!_0x483145||!_0x483145[_0x36e4('0x64')][_0x36e4('0x33')]){return'';}for(var _0x48e41c='(',_0x44b24c=0x0;_0x44b24c<_0x483145['rules'][_0x36e4('0x33')];_0x44b24c+=0x1){_0x44b24c>0x0&&(_0x48e41c+='\x20'+_0x483145[_0x36e4('0x65')]+'\x20');_0x48e41c+=_0x483145['rules'][_0x44b24c][_0x36e4('0x66')]?_0x229870(_0x483145[_0x36e4('0x64')][_0x44b24c][_0x36e4('0x66')]):_0x483145[_0x36e4('0x64')][_0x44b24c]['field']+'\x20'+_0x483145[_0x36e4('0x64')][_0x44b24c]['condition']+(_0x161fbe(_0x483145[_0x36e4('0x64')][_0x44b24c][_0x36e4('0x68')])?'\x20'+_0x483145[_0x36e4('0x64')][_0x44b24c][_0x36e4('0x69')]:'');}return _0x48e41c+')';};var _0x3766fd={'where':{'id':_0x4a10c0['id']}},_0x4feb61,_0x189c55,_0x1f3f26,_0x47d84d,_0x5c0933;_0x3766fd=_[_0x36e4('0x3a')]({},_0x3766fd,_0x32966d);return db[_0x36e4('0x27')][_0x36e4('0x43')](_0x3766fd)[_0x36e4('0x22')](function(_0xfb41ae){if(_0xfb41ae){_0x4feb61=_0xfb41ae;return _0xfb41ae[_0x36e4('0x6a')]();}return null;})['then'](function(_0x25f9d2){if(_0x25f9d2){if(!_0x25f9d2[_0x36e4('0x33')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x189c55=_0x25f9d2;return db['AnalyticMetric'][_0x36e4('0x3e')]({'raw':!![]});}return null;})[_0x36e4('0x22')](function(_0x43eb2a){if(_0x43eb2a){_0x1f3f26=_['keyBy'](_0x43eb2a,'id');var _0x735d91;var _0xffc49e=squel[_0x36e4('0x6e')]();_0xffc49e[_0x36e4('0x87')](_0x4feb61['table']);for(var _0x438972=0x0;_0x438972<_0x189c55['length'];_0x438972+=0x1){_0x735d91=_0x189c55[_0x438972][_0x36e4('0x6f')]?_0x1f3f26[_0x189c55[_0x438972]['MetricId']]['metric']:_0x189c55[_0x438972]['field'];_0x735d91=_0x189c55[_0x438972][_0x36e4('0x71')]?_[_0x36e4('0x72')](_0xb50ee7[_0x189c55[_0x438972][_0x36e4('0x71')]],'%s',_0x735d91):_0x735d91;_0x735d91=_0x189c55[_0x438972][_0x36e4('0x73')]?_['replace'](_0x39abff[_0x189c55[_0x438972][_0x36e4('0x73')]],'%s',_0x735d91):_0x735d91;if(_0x189c55[_0x438972][_0x36e4('0x88')]){_0xffc49e[_0x36e4('0x66')](_0x735d91);}_0x189c55[_0x438972][_0x36e4('0x74')]&&_0xffc49e[_0x36e4('0x75')](_0x735d91,_0x189c55[_0x438972][_0x36e4('0x74')]==='DESC'?![]:!![]);_0xffc49e[_0x36e4('0x67')](_0x735d91,_0x189c55[_0x438972][_0x36e4('0x76')]||_0x735d91);}if(_0x4feb61[_0x36e4('0x77')]){_0x4feb61[_0x36e4('0x77')]=JSON[_0x36e4('0x7d')](_0x4feb61[_0x36e4('0x77')]);for(var _0x5e71d6=0x0;_0x5e71d6<_0x4feb61[_0x36e4('0x77')][_0x36e4('0x33')];_0x5e71d6+=0x1){if(_0x4feb61[_0x36e4('0x77')][_0x5e71d6]['type']&&_[_0x36e4('0x60')](_0x3ad654,_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x2a')])&&_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x78')]&&_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x79')]&&_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x7a')]){_0xffc49e[_0x4feb61[_0x36e4('0x77')][_0x5e71d6]['type']](_0x4feb61['joins'][_0x5e71d6][_0x36e4('0x79')],null,util[_0x36e4('0x73')](_0x36e4('0x7b'),_0x4feb61[_0x36e4('0x89')],_0x4feb61[_0x36e4('0x77')][_0x5e71d6][_0x36e4('0x78')],_0x4feb61[_0x36e4('0x77')][_0x5e71d6]['foreignTable'],_0x4feb61['joins'][_0x5e71d6][_0x36e4('0x7a')]));}}}if(_0x4feb61[_0x36e4('0x7c')]){_0x4feb61[_0x36e4('0x7c')]=JSON['parse'](_0x4feb61[_0x36e4('0x7c')]);_0xffc49e['where'](_0x229870(_0x4feb61[_0x36e4('0x7c')][_0x36e4('0x66')]));}_0x5c0933=_0xffc49e[_0x36e4('0x8a')]();_0xffc49e[_0x36e4('0x19')](_0x5f4cda);_0xffc49e[_0x36e4('0x17')](0x0);return;}})[_0x36e4('0x22')](function(){if(_0x15ed88[_0x36e4('0x8b')]===_0x36e4('0x8c')){return null;}var _0x5198c8=_[_0x36e4('0x3a')](_0x15ed88,{'name':_0x15ed88['fullPath']||_0x15ed88[_0x36e4('0x23')]||_0x4feb61[_0x36e4('0x23')],'basename':_0x518387,'savename':util[_0x36e4('0x73')]('%s-%s.%s',_0x15ed88[_0x36e4('0x23')]||_0x4feb61[_0x36e4('0x23')],require(_0x36e4('0x8d'))[_0x36e4('0x8e')](0x4),_0x15ed88[_0x36e4('0x8b')]||_0x36e4('0x8f')),'reportId':_0x4feb61['id'],'reportType':_0x36e4('0x90')});return db['AnalyticExtractedReport'][_0x36e4('0x44')](_0x5198c8,{'raw':!![]});})[_0x36e4('0x22')](function(_0x17b1bc){if(_0x4feb61[_0x36e4('0x89')]===_0x36e4('0x91')){_0x5c0933[_0x36e4('0x37')](_0x4feb61[_0x36e4('0x89')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x15ed88['startDate'],_0x15ed88['endDate']);}else{_0x5c0933[_0x36e4('0x37')](_0x4feb61[_0x36e4('0x89')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x15ed88['startDate'],_0x15ed88[_0x36e4('0x92')]);}if(_0x17b1bc){logger[_0x36e4('0x93')](_0x36e4('0x94'),_0x5c0933[_0x36e4('0x81')]());require(_0x36e4('0x95'))[_0x36e4('0x96')](path[_0x36e4('0x51')](__dirname,_0x36e4('0x97'),_0x17b1bc[_0x36e4('0x8b')]),[_0x17b1bc['id'],_0x5c0933[_0x36e4('0x81')](),path[_0x36e4('0x51')](__dirname,_0x36e4('0x98'),_0x17b1bc['savename']),_0x518387]);return _0x17b1bc;}else{var _0x30ca4d=squel[_0x36e4('0x6e')]();_0x30ca4d[_0x36e4('0x87')]('('+_0x5c0933[_0x36e4('0x81')]()+')',_0x36e4('0x99'));_0x30ca4d[_0x36e4('0x67')](_0x36e4('0x9a'),'count');_0x5c0933['limit'](_0x15ed88[_0x36e4('0x19')]||_0x5f4cda);_0x5c0933['offset'](_0x15ed88[_0x36e4('0x17')]||0x0);return dbH[_0x36e4('0x80')][_0x36e4('0x2e')](_0x30ca4d[_0x36e4('0x81')](),{'type':dbH[_0x36e4('0x80')]['QueryTypes'][_0x36e4('0x83')]})[_0x36e4('0x22')](function(_0x2cb82b){if(!_0x2cb82b['length']){_0x47d84d=0x0;}else{_0x47d84d=_0x2cb82b[0x0][_0x36e4('0x1a')]||0x0;}return dbH[_0x36e4('0x80')][_0x36e4('0x2e')](_0x5c0933[_0x36e4('0x81')](),{'type':dbH[_0x36e4('0x80')][_0x36e4('0x82')][_0x36e4('0x83')]});})[_0x36e4('0x22')](function(_0x575212){return{'rows':_0x575212||[],'count':_0x47d84d};});}});}exports['run']=function(_0x34b8ce,_0x5ce12b){return runReport(_0x34b8ce[_0x36e4('0x41')],_0x34b8ce[_0x36e4('0x2e')],_0x34b8ce[_0x36e4('0x3c')])['then'](respondWithResult(_0x5ce12b,null))['catch'](handleError(_0x5ce12b,null));};exports[_0x36e4('0x9b')]=runReport;exports[_0x36e4('0x2e')]=function(_0x1f29d9,_0x1a8a7a){var _0x29925a=0xa;var _0x1c7320=[_0x36e4('0x51'),_0x36e4('0x52'),_0x36e4('0x9c'),_0x36e4('0x53')];var _0x1fa9ac={'SUM':_0x36e4('0x54'),'COUNT':_0x36e4('0x84'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x36e4('0x56'),'MIN':_0x36e4('0x85'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x36e4('0x58'),'GROUP_CONCAT ASC':_0x36e4('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x20887c={'SEC_TO_TIME':_0x36e4('0x5b'),'DATE':_0x36e4('0x5c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x36e4('0x5f')};var _0x4daa62=function(_0x2251b7){return!_[_0x36e4('0x60')]([_0x36e4('0x86'),_0x36e4('0x61'),_0x36e4('0x62'),_0x36e4('0x63')],_0x2251b7);};var _0x17bf4b=function(_0x1c91c2){if(!_0x1c91c2||!_0x1c91c2[_0x36e4('0x64')][_0x36e4('0x33')]){return'';}for(var _0x7e74fc='(',_0x1c8df1=0x0;_0x1c8df1<_0x1c91c2[_0x36e4('0x64')][_0x36e4('0x33')];_0x1c8df1+=0x1){_0x1c8df1>0x0&&(_0x7e74fc+='\x20'+_0x1c91c2['operator']+'\x20');_0x7e74fc+=_0x1c91c2[_0x36e4('0x64')][_0x1c8df1][_0x36e4('0x66')]?_0x17bf4b(_0x1c91c2[_0x36e4('0x64')][_0x1c8df1][_0x36e4('0x66')]):_0x1c91c2['rules'][_0x1c8df1][_0x36e4('0x67')]+'\x20'+_0x1c91c2[_0x36e4('0x64')][_0x1c8df1][_0x36e4('0x68')]+(_0x4daa62(_0x1c91c2[_0x36e4('0x64')][_0x1c8df1]['condition'])?'\x20'+_0x1c91c2['rules'][_0x1c8df1]['value']:'');}return _0x7e74fc+')';};var _0x38be45={'where':{'id':_0x1f29d9['params']['id']}},_0x1a08ad,_0xe794fe,_0x469c35,_0x15c99f,_0x5e7451;_0x38be45=_[_0x36e4('0x3a')]({},_0x38be45,_0x1f29d9[_0x36e4('0x3c')]);return db[_0x36e4('0x27')]['find'](_0x38be45)['then'](function(_0x1e4861){if(_0x1e4861){_0x1a08ad=_0x1e4861;return _0x1e4861['getFields']();}return null;})[_0x36e4('0x22')](function(_0x5b1727){if(_0x5b1727){if(!_0x5b1727[_0x36e4('0x33')]){throw new db[(_0x36e4('0x6b'))][(_0x36e4('0x9d'))](_0x36e4('0x9e'),0x193);}_0xe794fe=_0x5b1727;return db[_0x36e4('0x6c')][_0x36e4('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x1a3f34){if(_0x1a3f34){_0x469c35=_[_0x36e4('0x6d')](_0x1a3f34,'id');var _0x588242;var _0x56a881=squel[_0x36e4('0x6e')]();_0x56a881[_0x36e4('0x87')](_0x1a08ad[_0x36e4('0x89')]);for(var _0x3ee5f2=0x0;_0x3ee5f2<_0xe794fe['length'];_0x3ee5f2+=0x1){_0x588242=_0xe794fe[_0x3ee5f2]['MetricId']?_0x469c35[_0xe794fe[_0x3ee5f2]['MetricId']]['metric']:_0xe794fe[_0x3ee5f2][_0x36e4('0x67')];_0x588242=_0xe794fe[_0x3ee5f2]['function']?_[_0x36e4('0x72')](_0x1fa9ac[_0xe794fe[_0x3ee5f2][_0x36e4('0x71')]],'%s',_0x588242):_0x588242;_0x588242=_0xe794fe[_0x3ee5f2][_0x36e4('0x73')]?_[_0x36e4('0x72')](_0x20887c[_0xe794fe[_0x3ee5f2]['format']],'%s',_0x588242):_0x588242;if(_0xe794fe[_0x3ee5f2]['groupBy']){_0x56a881[_0x36e4('0x66')](_0x588242);}_0xe794fe[_0x3ee5f2][_0x36e4('0x74')]&&_0x56a881[_0x36e4('0x75')](_0x588242,_0xe794fe[_0x3ee5f2][_0x36e4('0x74')]===_0x36e4('0x9f')?![]:!![]);_0x56a881[_0x36e4('0x67')](_0x588242,_0xe794fe[_0x3ee5f2][_0x36e4('0x76')]||_0x588242);}if(_0x1a08ad[_0x36e4('0x77')]){_0x1a08ad[_0x36e4('0x77')]=JSON['parse'](_0x1a08ad[_0x36e4('0x77')]);for(var _0x1a6d05=0x0;_0x1a6d05<_0x1a08ad[_0x36e4('0x77')][_0x36e4('0x33')];_0x1a6d05+=0x1){if(_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x2a')]&&_['includes'](_0x1c7320,_0x1a08ad[_0x36e4('0x77')][_0x1a6d05]['type'])&&_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x78')]&&_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x79')]&&_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x7a')]){_0x56a881[_0x1a08ad['joins'][_0x1a6d05]['type']](_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x79')],null,util['format'](_0x36e4('0x7b'),_0x1a08ad['table'],_0x1a08ad[_0x36e4('0x77')][_0x1a6d05][_0x36e4('0x78')],_0x1a08ad['joins'][_0x1a6d05][_0x36e4('0x79')],_0x1a08ad[_0x36e4('0x77')][_0x1a6d05]['foreignKey']));}}}if(_0x1a08ad['conditions']){_0x1a08ad[_0x36e4('0x7c')]=JSON['parse'](_0x1a08ad[_0x36e4('0x7c')]);_0x56a881[_0x36e4('0x37')](_0x17bf4b(_0x1a08ad['conditions'][_0x36e4('0x66')]));}_0x5e7451=_0x56a881[_0x36e4('0x8a')]();_0x56a881[_0x36e4('0x19')](_0x29925a);_0x56a881[_0x36e4('0x17')](0x0);logger[_0x36e4('0x7e')](_0x36e4('0x7f'),_0x56a881[_0x36e4('0x81')]());return dbH[_0x36e4('0x80')][_0x36e4('0x2e')](_0x56a881[_0x36e4('0x81')](),{'type':dbH[_0x36e4('0x80')][_0x36e4('0x82')][_0x36e4('0x83')]});}})[_0x36e4('0x22')](function(){return{'sql':_0x5e7451[_0x36e4('0x81')]()};})[_0x36e4('0x22')](respondWithResult(_0x1a8a7a,null))[_0x36e4('0x40')](handleError(_0x1a8a7a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2cad115..d05b6dd 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 _0xe73a=['path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe73a,0xaf));var _0xae73=function(_0x298510,_0x21b06b){_0x298510=_0x298510-0x0;var _0x51f279=_0xe73a[_0x298510];return _0x51f279;};'use strict';var _=require(_0xae73('0x0'));var util=require(_0xae73('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xae73('0x2'));var BPromise=require(_0xae73('0x3'));var rp=require(_0xae73('0x4'));var fs=require('fs');var path=require(_0xae73('0x5'));var rimraf=require(_0xae73('0x6'));var config=require(_0xae73('0x7'));var attributes=require(_0xae73('0x8'));module['exports']=function(_0x3d000d,_0x20ec1c){return _0x3d000d[_0xae73('0x9')](_0xae73('0xa'),attributes,{'tableName':_0xae73('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3284=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0x29f4aa,_0x16db81){var _0x4d12ab=function(_0x346435){while(--_0x346435){_0x29f4aa['push'](_0x29f4aa['shift']());}};_0x4d12ab(++_0x16db81);}(_0x3284,0x87));var _0x4328=function(_0x4cb3ef,_0x4bcb7d){_0x4cb3ef=_0x4cb3ef-0x0;var _0x27702b=_0x3284[_0x4cb3ef];return _0x27702b;};'use strict';var _=require(_0x4328('0x0'));var util=require(_0x4328('0x1'));var logger=require(_0x4328('0x2'))(_0x4328('0x3'));var moment=require(_0x4328('0x4'));var BPromise=require(_0x4328('0x5'));var rp=require(_0x4328('0x6'));var fs=require('fs');var path=require(_0x4328('0x7'));var rimraf=require(_0x4328('0x8'));var config=require(_0x4328('0x9'));var attributes=require(_0x4328('0xa'));module['exports']=function(_0x59307e,_0x595a21){return _0x59307e[_0x4328('0xb')](_0x4328('0xc'),attributes,{'tableName':_0x4328('0xd'),'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 e1d0a0f..b683d95 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 _0x6aa9=['jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x28964d,_0x4c22f6){var _0x1f43b1=function(_0x11093a){while(--_0x11093a){_0x28964d['push'](_0x28964d['shift']());}};_0x1f43b1(++_0x4c22f6);}(_0x6aa9,0x1da));var _0x96aa=function(_0x541c63,_0x3d6ee8){_0x541c63=_0x541c63-0x0;var _0x5ad259=_0x6aa9[_0x541c63];return _0x5ad259;};'use strict';var _=require(_0x96aa('0x0'));var util=require(_0x96aa('0x1'));var moment=require(_0x96aa('0x2'));var BPromise=require(_0x96aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96aa('0x4'));var db=require(_0x96aa('0x5'))['db'];var utils=require(_0x96aa('0x6'));var logger=require(_0x96aa('0x7'))('rpc');var config=require(_0x96aa('0x8'));var jayson=require(_0x96aa('0x9'));var client=jayson['client'][_0x96aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x308c0d,_0x364069,_0x53fc30){return new BPromise(function(_0x10a3a6,_0xc9f276){return client[_0x96aa('0xb')](_0x308c0d,_0x53fc30)[_0x96aa('0xc')](function(_0x101259){logger[_0x96aa('0xd')](_0x96aa('0xe'),_0x364069,_0x96aa('0xf'));logger[_0x96aa('0x10')](_0x96aa('0x11'),_0x364069,_0x96aa('0xf'),JSON[_0x96aa('0x12')](_0x101259));if(_0x101259['error']){if(_0x101259['error'][_0x96aa('0x13')]===0x1f4){logger[_0x96aa('0x14')](_0x96aa('0xe'),_0x364069,_0x101259[_0x96aa('0x14')][_0x96aa('0x15')]);return _0xc9f276(_0x101259[_0x96aa('0x14')][_0x96aa('0x15')]);}logger['error'](_0x96aa('0xe'),_0x364069,_0x101259['error'][_0x96aa('0x15')]);return _0x10a3a6(_0x101259[_0x96aa('0x14')][_0x96aa('0x15')]);}else{logger[_0x96aa('0xd')](_0x96aa('0xe'),_0x364069,_0x96aa('0xf'));_0x10a3a6(_0x101259['result'][_0x96aa('0x15')]);}})[_0x96aa('0x16')](function(_0x507138){logger[_0x96aa('0x14')](_0x96aa('0xe'),_0x364069,_0x507138);_0xc9f276(_0x507138);});});} \ No newline at end of file +var _0x8117=['moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x3be02d,_0x160a99){var _0x3a6e0c=function(_0x59dd27){while(--_0x59dd27){_0x3be02d['push'](_0x3be02d['shift']());}};_0x3a6e0c(++_0x160a99);}(_0x8117,0xda));var _0x7811=function(_0xf1b51e,_0x389d79){_0xf1b51e=_0xf1b51e-0x0;var _0x3f836d=_0x8117[_0xf1b51e];return _0x3f836d;};'use strict';var _=require(_0x7811('0x0'));var util=require(_0x7811('0x1'));var moment=require(_0x7811('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7811('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7811('0x4'))(_0x7811('0x5'));var config=require(_0x7811('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7811('0x7')][_0x7811('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x104b94,_0x3673d8,_0x57fded){return new BPromise(function(_0x59fc4c,_0x373706){return client['request'](_0x104b94,_0x57fded)[_0x7811('0x9')](function(_0x2aff0f){logger[_0x7811('0xa')](_0x7811('0xb'),_0x3673d8,_0x7811('0xc'));logger[_0x7811('0xd')](_0x7811('0xe'),_0x3673d8,'request\x20sent',JSON[_0x7811('0xf')](_0x2aff0f));if(_0x2aff0f[_0x7811('0x10')]){if(_0x2aff0f[_0x7811('0x10')][_0x7811('0x11')]===0x1f4){logger[_0x7811('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3673d8,_0x2aff0f[_0x7811('0x10')]['message']);return _0x373706(_0x2aff0f['error'][_0x7811('0x12')]);}logger[_0x7811('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3673d8,_0x2aff0f['error'][_0x7811('0x12')]);return _0x59fc4c(_0x2aff0f[_0x7811('0x10')][_0x7811('0x12')]);}else{logger[_0x7811('0xa')](_0x7811('0xb'),_0x3673d8,'request\x20sent');_0x59fc4c(_0x2aff0f[_0x7811('0x13')][_0x7811('0x12')]);}})['catch'](function(_0x2f0c4a){logger[_0x7811('0x10')](_0x7811('0xb'),_0x3673d8,_0x2f0c4a);_0x373706(_0x2f0c4a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 852a426..f9d4a4e 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 _0xc90c=['isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get'];(function(_0x93aa24,_0x2363ba){var _0x5252ad=function(_0x382c59){while(--_0x382c59){_0x93aa24['push'](_0x93aa24['shift']());}};_0x5252ad(++_0x2363ba);}(_0xc90c,0x19e));var _0xcc90=function(_0xe7a527,_0x255b07){_0xe7a527=_0xe7a527-0x0;var _0x2bbf90=_0xc90c[_0xe7a527];return _0x2bbf90;};'use strict';var multer=require(_0xcc90('0x0'));var util=require(_0xcc90('0x1'));var path=require(_0xcc90('0x2'));var timeout=require(_0xcc90('0x3'));var express=require(_0xcc90('0x4'));var router=express[_0xcc90('0x5')]();var fs_extra=require(_0xcc90('0x6'));var auth=require(_0xcc90('0x7'));var interaction=require(_0xcc90('0x8'));var config=require('../../config/environment');var controller=require(_0xcc90('0x9'));router[_0xcc90('0xa')]('/',auth[_0xcc90('0xb')](),controller[_0xcc90('0xc')]);router[_0xcc90('0xa')](_0xcc90('0xd'),auth[_0xcc90('0xb')](),controller[_0xcc90('0xe')]);router[_0xcc90('0xa')](_0xcc90('0xf'),auth['isAuthenticated'](),controller[_0xcc90('0x10')]);router[_0xcc90('0xa')](_0xcc90('0x11'),auth['isAuthenticated'](),controller[_0xcc90('0x12')]);router[_0xcc90('0xa')](_0xcc90('0x13'),auth[_0xcc90('0xb')](),controller['query']);router[_0xcc90('0x14')]('/',auth[_0xcc90('0xb')](),controller[_0xcc90('0x15')]);router[_0xcc90('0x16')](_0xcc90('0xd'),auth[_0xcc90('0xb')](),controller['update']);router[_0xcc90('0x17')](_0xcc90('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xcc90('0x18')]=router; \ No newline at end of file +var _0xac1b=['isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0x22d4ca,_0x3bc7af){var _0x35e2cb=function(_0x19d423){while(--_0x19d423){_0x22d4ca['push'](_0x22d4ca['shift']());}};_0x35e2cb(++_0x3bc7af);}(_0xac1b,0x146));var _0xbac1=function(_0x3042d1,_0x213e3e){_0x3042d1=_0x3042d1-0x0;var _0x3e22c5=_0xac1b[_0x3042d1];return _0x3e22c5;};'use strict';var multer=require(_0xbac1('0x0'));var util=require(_0xbac1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbac1('0x2'));var router=express[_0xbac1('0x3')]();var fs_extra=require(_0xbac1('0x4'));var auth=require(_0xbac1('0x5'));var interaction=require(_0xbac1('0x6'));var config=require(_0xbac1('0x7'));var controller=require(_0xbac1('0x8'));router[_0xbac1('0x9')]('/',auth[_0xbac1('0xa')](),controller[_0xbac1('0xb')]);router[_0xbac1('0x9')](_0xbac1('0xc'),auth[_0xbac1('0xa')](),controller[_0xbac1('0xd')]);router['get'](_0xbac1('0xe'),auth[_0xbac1('0xa')](),controller[_0xbac1('0xf')]);router[_0xbac1('0x9')](_0xbac1('0x10'),auth[_0xbac1('0xa')](),controller['run']);router['get'](_0xbac1('0x11'),auth[_0xbac1('0xa')](),controller[_0xbac1('0x12')]);router['post']('/',auth[_0xbac1('0xa')](),controller['create']);router[_0xbac1('0x13')](_0xbac1('0xc'),auth[_0xbac1('0xa')](),controller[_0xbac1('0x14')]);router[_0xbac1('0x15')]('/:id',auth[_0xbac1('0xa')](),controller[_0xbac1('0x16')]);module[_0xbac1('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c314a64..820783a 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 _0x7fbe=['STRING','TEXT'];(function(_0x521df7,_0x277fd6){var _0x4b57b5=function(_0x345f75){while(--_0x345f75){_0x521df7['push'](_0x521df7['shift']());}};_0x4b57b5(++_0x277fd6);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7fbe[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x102ac6,_0x54c4b5){var _0x155da=function(_0x26178a){while(--_0x26178a){_0x102ac6['push'](_0x102ac6['shift']());}};_0x155da(++_0x54c4b5);}(_0xabce,0x103));var _0xeabc=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xabce[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 566dd2d..6411be5 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 _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2ef3,0xba));var _0x32ef=function(_0x8e4fad,_0x48538c){_0x8e4fad=_0x8e4fad-0x0;var _0x100698=_0x2ef3[_0x8e4fad];return _0x100698;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x148b06,_0x375597){var _0x222dbf=function(_0x5e8b5d){while(--_0x5e8b5d){_0x148b06['push'](_0x148b06['shift']());}};_0x222dbf(++_0x375597);}(_0x7a54,0x106));var _0x47a5=function(_0x3d4afc,_0x389f9d){_0x3d4afc=_0x3d4afc-0x0;var _0x572d77=_0x7a54[_0x3d4afc];return _0x572d77;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ccc0c0d..fa5b079 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 _0x6f4b=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports'];(function(_0xe93a3b,_0x5f5644){var _0x46bb8b=function(_0x1ccd62){while(--_0x1ccd62){_0xe93a3b['push'](_0xe93a3b['shift']());}};_0x46bb8b(++_0x5f5644);}(_0x6f4b,0x1e2));var _0xb6f4=function(_0x30ec3d,_0x33efa3){_0x30ec3d=_0x30ec3d-0x0;var _0x1320f3=_0x6f4b[_0x30ec3d];return _0x1320f3;};'use strict';var _=require(_0xb6f4('0x0'));var util=require(_0xb6f4('0x1'));var logger=require(_0xb6f4('0x2'))(_0xb6f4('0x3'));var moment=require('moment');var BPromise=require(_0xb6f4('0x4'));var rp=require(_0xb6f4('0x5'));var fs=require('fs');var path=require(_0xb6f4('0x6'));var rimraf=require(_0xb6f4('0x7'));var config=require('../../config/environment');var attributes=require(_0xb6f4('0x8'));module[_0xb6f4('0x9')]=function(_0x540160,_0x4a24e4){return _0x540160['define'](_0xb6f4('0xa'),attributes,{'tableName':_0xb6f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6f9=['bluebird','request-promise','path','rimraf','../../config/environment','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment'];(function(_0x3d94fc,_0x5e08e5){var _0x20d02c=function(_0x5225e3){while(--_0x5225e3){_0x3d94fc['push'](_0x3d94fc['shift']());}};_0x20d02c(++_0x5e08e5);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0xd6f9[_0x43b584];return _0x48f27b;};'use strict';var _=require(_0x9d6f('0x0'));var util=require(_0x9d6f('0x1'));var logger=require(_0x9d6f('0x2'))('api');var moment=require(_0x9d6f('0x3'));var BPromise=require(_0x9d6f('0x4'));var rp=require(_0x9d6f('0x5'));var fs=require('fs');var path=require(_0x9d6f('0x6'));var rimraf=require(_0x9d6f('0x7'));var config=require(_0x9d6f('0x8'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x4dc4c1,_0x2b253a){return _0x4dc4c1['define'](_0x9d6f('0x9'),attributes,{'tableName':_0x9d6f('0xa'),'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 8844813..9f48104 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 _0x9ab8=['request','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x4374a4,_0x4bd128){var _0x1a8e01=function(_0x2a669e){while(--_0x2a669e){_0x4374a4['push'](_0x4374a4['shift']());}};_0x1a8e01(++_0x4bd128);}(_0x9ab8,0x1ee));var _0x89ab=function(_0xa6adc1,_0xc88cc0){_0xa6adc1=_0xa6adc1-0x0;var _0x23b2fc=_0x9ab8[_0xa6adc1];return _0x23b2fc;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require(_0x89ab('0x3'));var rs=require(_0x89ab('0x4'));var fs=require('fs');var Redis=require(_0x89ab('0x5'));var db=require(_0x89ab('0x6'))['db'];var utils=require(_0x89ab('0x7'));var logger=require(_0x89ab('0x8'))('rpc');var config=require(_0x89ab('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x89ab('0xa')][_0x89ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11b2e7,_0x346d39,_0x1f325c){return new BPromise(function(_0x3a1e5e,_0x5c655d){return client[_0x89ab('0xc')](_0x11b2e7,_0x1f325c)['then'](function(_0x5e07c5){logger[_0x89ab('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x346d39,_0x89ab('0xe'));logger[_0x89ab('0xf')](_0x89ab('0x10'),_0x346d39,_0x89ab('0xe'),JSON['stringify'](_0x5e07c5));if(_0x5e07c5['error']){if(_0x5e07c5['error']['code']===0x1f4){logger['error'](_0x89ab('0x11'),_0x346d39,_0x5e07c5[_0x89ab('0x12')][_0x89ab('0x13')]);return _0x5c655d(_0x5e07c5[_0x89ab('0x12')]['message']);}logger[_0x89ab('0x12')](_0x89ab('0x11'),_0x346d39,_0x5e07c5[_0x89ab('0x12')][_0x89ab('0x13')]);return _0x3a1e5e(_0x5e07c5[_0x89ab('0x12')][_0x89ab('0x13')]);}else{logger[_0x89ab('0xd')](_0x89ab('0x11'),_0x346d39,_0x89ab('0xe'));_0x3a1e5e(_0x5e07c5[_0x89ab('0x14')][_0x89ab('0x13')]);}})[_0x89ab('0x15')](function(_0x557fe2){logger[_0x89ab('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x346d39,_0x557fe2);_0x5c655d(_0x557fe2);});});} \ No newline at end of file +var _0xddef=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xddef,0x1ac));var _0xfdde=function(_0x362ab7,_0x5d18e8){_0x362ab7=_0x362ab7-0x0;var _0x2532d1=_0xddef[_0x362ab7];return _0x2532d1;};'use strict';var _=require('lodash');var util=require(_0xfdde('0x0'));var moment=require('moment');var BPromise=require(_0xfdde('0x1'));var rs=require(_0xfdde('0x2'));var fs=require('fs');var Redis=require(_0xfdde('0x3'));var db=require(_0xfdde('0x4'))['db'];var utils=require(_0xfdde('0x5'));var logger=require(_0xfdde('0x6'))(_0xfdde('0x7'));var config=require(_0xfdde('0x8'));var jayson=require(_0xfdde('0x9'));var client=jayson[_0xfdde('0xa')][_0xfdde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17002c,_0x40831a,_0x26c0b2){return new BPromise(function(_0x180cd5,_0x360614){return client[_0xfdde('0xc')](_0x17002c,_0x26c0b2)[_0xfdde('0xd')](function(_0x562365){logger[_0xfdde('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x40831a,_0xfdde('0xf'));logger['debug'](_0xfdde('0x10'),_0x40831a,_0xfdde('0xf'),JSON[_0xfdde('0x11')](_0x562365));if(_0x562365[_0xfdde('0x12')]){if(_0x562365[_0xfdde('0x12')][_0xfdde('0x13')]===0x1f4){logger[_0xfdde('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x40831a,_0x562365['error']['message']);return _0x360614(_0x562365[_0xfdde('0x12')][_0xfdde('0x14')]);}logger['error'](_0xfdde('0x15'),_0x40831a,_0x562365['error']['message']);return _0x180cd5(_0x562365[_0xfdde('0x12')][_0xfdde('0x14')]);}else{logger[_0xfdde('0xe')](_0xfdde('0x15'),_0x40831a,_0xfdde('0xf'));_0x180cd5(_0x562365[_0xfdde('0x16')]['message']);}})[_0xfdde('0x17')](function(_0x3251d2){logger[_0xfdde('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x40831a,_0x3251d2);_0x360614(_0x3251d2);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f08d8fb..a4e8fb7 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 _0x0e1a=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','exports','util'];(function(_0x34e2ef,_0x55866f){var _0x3b40e5=function(_0x4283f9){while(--_0x4283f9){_0x34e2ef['push'](_0x34e2ef['shift']());}};_0x3b40e5(++_0x55866f);}(_0x0e1a,0xef));var _0xa0e1=function(_0x216969,_0x105d2d){_0x216969=_0x216969-0x0;var _0x8e2e7f=_0x0e1a[_0x216969];return _0x8e2e7f;};'use strict';var multer=require('multer');var util=require(_0xa0e1('0x0'));var path=require(_0xa0e1('0x1'));var timeout=require(_0xa0e1('0x2'));var express=require(_0xa0e1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa0e1('0x4'));var interaction=require(_0xa0e1('0x5'));var config=require('../../config/environment');var controller=require(_0xa0e1('0x6'));router['get']('/',auth[_0xa0e1('0x7')](),controller[_0xa0e1('0x8')]);router[_0xa0e1('0x9')](_0xa0e1('0xa'),auth['isAuthenticated'](),controller[_0xa0e1('0xb')]);router['get'](_0xa0e1('0xc'),auth['isAuthenticated'](),controller[_0xa0e1('0xd')]);router['get'](_0xa0e1('0xe'),auth['isAuthenticated'](),controller[_0xa0e1('0xf')]);router['get'](_0xa0e1('0x10'),auth['isAuthenticated'](),controller[_0xa0e1('0x11')]);router[_0xa0e1('0x12')]('/',auth[_0xa0e1('0x7')](),controller[_0xa0e1('0x13')]);router[_0xa0e1('0x14')]('/:id',auth[_0xa0e1('0x7')](),controller[_0xa0e1('0x15')]);router[_0xa0e1('0x16')](_0xa0e1('0xa'),auth[_0xa0e1('0x7')](),controller['destroy']);module[_0xa0e1('0x17')]=router; \ No newline at end of file +var _0x88a1=['get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x88a1,0x1c7));var _0x188a=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x88a1[_0xf5d71c];return _0x5af672;};'use strict';var multer=require(_0x188a('0x0'));var util=require('util');var path=require(_0x188a('0x1'));var timeout=require('connect-timeout');var express=require(_0x188a('0x2'));var router=express[_0x188a('0x3')]();var fs_extra=require(_0x188a('0x4'));var auth=require(_0x188a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x188a('0x6'));router[_0x188a('0x7')]('/',auth[_0x188a('0x8')](),controller['index']);router[_0x188a('0x7')](_0x188a('0x9'),auth['isAuthenticated'](),controller[_0x188a('0xa')]);router['get'](_0x188a('0xb'),auth[_0x188a('0x8')](),controller[_0x188a('0xc')]);router[_0x188a('0x7')](_0x188a('0xd'),auth[_0x188a('0x8')](),controller[_0x188a('0xe')]);router['get'](_0x188a('0xf'),auth[_0x188a('0x8')](),controller[_0x188a('0x10')]);router[_0x188a('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x188a('0x12')](_0x188a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x188a('0x13')](_0x188a('0x9'),auth[_0x188a('0x8')](),controller[_0x188a('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index b3759d0..c3e4901 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 _0x9f88=['STRING','sequelize','moment','exports','ENUM','csv','pdf','xlsx','DATE','scheduled','manual','UNSIGNED'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x9f88,0x175));var _0x89f8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9f88[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x89f8('0x0'));var moment=require(_0x89f8('0x1'));module[_0x89f8('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x89f8('0x3')](_0x89f8('0x4'),_0x89f8('0x5'),_0x89f8('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x89f8('0x7')]},'endDate':{'type':Sequelize[_0x89f8('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x89f8('0x3')]('manual',_0x89f8('0x8')),'allowNull':![],'defaultValue':_0x89f8('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x89f8('0xa')]},'reportType':{'type':Sequelize[_0x89f8('0xb')]}}; \ No newline at end of file +var _0x078e=['manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x078e,0x93));var _0xe078=function(_0x1b9073,_0x2f3795){_0x1b9073=_0x1b9073-0x0;var _0x585eeb=_0x078e[_0x1b9073];return _0x585eeb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe078('0x0'));module[_0xe078('0x1')]={'name':{'type':Sequelize[_0xe078('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xe078('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xe078('0x3')]('csv',_0xe078('0x4'),_0xe078('0x5')),'allowNull':![],'defaultValue':_0xe078('0x6')},'savename':{'type':Sequelize[_0xe078('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe078('0x7')]},'endDate':{'type':Sequelize[_0xe078('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xe078('0x8')},'type':{'type':Sequelize[_0xe078('0x3')](_0xe078('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xe078('0x9')},'reportId':{'type':Sequelize[_0xe078('0xa')](0xb)[_0xe078('0xb')]},'reportType':{'type':Sequelize[_0xe078('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e09da55..5280586 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 _0x0175=['then','destroy','UserProfileResource','error','stack','name','AnalyticExtractedReport','rawAttributes','type','key','map','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','join','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update'];(function(_0xd144fb,_0x590c64){var _0x21a8e6=function(_0xb4e1fa){while(--_0xb4e1fa){_0xd144fb['push'](_0xd144fb['shift']());}};_0x21a8e6(++_0x590c64);}(_0x0175,0xf3));var _0x5017=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x0175[_0x349148];return _0x2f2b0f;};'use strict';var emlformat=require(_0x5017('0x0'));var rimraf=require(_0x5017('0x1'));var zipdir=require(_0x5017('0x2'));var jsonpatch=require(_0x5017('0x3'));var rp=require(_0x5017('0x4'));var moment=require(_0x5017('0x5'));var BPromise=require(_0x5017('0x6'));var Mustache=require(_0x5017('0x7'));var util=require('util');var path=require(_0x5017('0x8'));var sox=require(_0x5017('0x9'));var csv=require(_0x5017('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5017('0xb'));var crypto=require(_0x5017('0xc'));var jsforce=require(_0x5017('0xd'));var deskjs=require(_0x5017('0xe'));var toCsv=require(_0x5017('0xa'));var querystring=require(_0x5017('0xf'));var Papa=require('papaparse');var Redis=require(_0x5017('0x10'));var authService=require(_0x5017('0x11'));var qs=require(_0x5017('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5017('0x13'));var logger=require(_0x5017('0x14'))(_0x5017('0x15'));var utils=require(_0x5017('0x16'));var config=require(_0x5017('0x17'));var licenseUtil=require(_0x5017('0x18'));var db=require(_0x5017('0x19'))['db'];function respondWithStatusCode(_0x2002fd,_0x13a99b){_0x13a99b=_0x13a99b||0xcc;return function(_0x167f6f){if(_0x167f6f){return _0x2002fd[_0x5017('0x1a')](_0x13a99b);}return _0x2002fd[_0x5017('0x1b')](_0x13a99b)[_0x5017('0x1c')]();};}function respondWithResult(_0x5ac425,_0x15a4b9){_0x15a4b9=_0x15a4b9||0xc8;return function(_0x237356){if(_0x237356){return _0x5ac425[_0x5017('0x1b')](_0x15a4b9)[_0x5017('0x1d')](_0x237356);}};}function respondWithFilteredResult(_0x56dc07,_0x23df78){return function(_0x27fb3a){if(_0x27fb3a){var _0x55e5aa=typeof _0x23df78['offset']===_0x5017('0x1e')&&typeof _0x23df78[_0x5017('0x1f')]===_0x5017('0x1e');var _0x3451a2=_0x27fb3a[_0x5017('0x20')];var _0x4959e2=_0x55e5aa?0x0:_0x23df78['offset'];var _0x332abc=_0x55e5aa?_0x27fb3a['count']:_0x23df78[_0x5017('0x21')]+_0x23df78['limit'];var _0x19048c;if(_0x332abc>=_0x3451a2){_0x332abc=_0x3451a2;_0x19048c=0xc8;}else{_0x19048c=0xce;}_0x56dc07[_0x5017('0x1b')](_0x19048c);return _0x56dc07[_0x5017('0x22')](_0x5017('0x23'),_0x4959e2+'-'+_0x332abc+'/'+_0x3451a2)[_0x5017('0x1d')](_0x27fb3a);}return null;};}function patchUpdates(_0x3c9584){return function(_0x484e20){try{jsonpatch['apply'](_0x484e20,_0x3c9584,!![]);}catch(_0xc59539){return BPromise[_0x5017('0x24')](_0xc59539);}return _0x484e20[_0x5017('0x25')]();};}function saveUpdates(_0x310360,_0x235e16){return function(_0x2ad045){if(_0x2ad045){return _0x2ad045[_0x5017('0x26')](_0x310360)[_0x5017('0x27')](function(_0x5030fb){return _0x5030fb;});}return null;};}function removeEntity(_0x2724cb,_0x120924){return function(_0x3f9a9e){if(_0x3f9a9e){return _0x3f9a9e[_0x5017('0x28')]()[_0x5017('0x27')](function(){var _0x539c3e=_0x3f9a9e['get']({'plain':!![]});var _0x33e531='ExtractedReports';return db[_0x5017('0x29')][_0x5017('0x28')]({'where':{'type':_0x33e531,'resourceId':_0x539c3e['id']}})[_0x5017('0x27')](function(){return _0x3f9a9e;});})['then'](function(){_0x2724cb[_0x5017('0x1b')](0xcc)[_0x5017('0x1c')]();});}};}function handleEntityNotFound(_0x383532,_0x59f433){return function(_0x25ade4){if(!_0x25ade4){_0x383532['sendStatus'](0x194);}return _0x25ade4;};}function handleError(_0x362dc6,_0x2dcf75){_0x2dcf75=_0x2dcf75||0x1f4;return function(_0x22fed9){logger[_0x5017('0x2a')](_0x22fed9[_0x5017('0x2b')]);if(_0x22fed9[_0x5017('0x2c')]){delete _0x22fed9[_0x5017('0x2c')];}_0x362dc6[_0x5017('0x1b')](_0x2dcf75)['send'](_0x22fed9);};}exports['index']=function(_0x31004b,_0x5ebd30){var _0x214d64={},_0x16a078={},_0x2bb0f9={'count':0x0,'rows':[]};var _0x592e00=_['map'](db[_0x5017('0x2d')][_0x5017('0x2e')],function(_0x4ab659){return{'name':_0x4ab659['fieldName'],'type':_0x4ab659[_0x5017('0x2f')][_0x5017('0x30')]};});_0x16a078['model']=_[_0x5017('0x31')](_0x592e00,'name');_0x16a078['query']=_[_0x5017('0x32')](_0x31004b['query']);_0x16a078[_0x5017('0x33')]=_[_0x5017('0x34')](_0x16a078[_0x5017('0x35')],_0x16a078[_0x5017('0x36')]);_0x214d64['attributes']=_[_0x5017('0x34')](_0x16a078[_0x5017('0x35')],qs[_0x5017('0x37')](_0x31004b[_0x5017('0x36')][_0x5017('0x37')]));_0x214d64[_0x5017('0x38')]=_0x214d64[_0x5017('0x38')][_0x5017('0x39')]?_0x214d64[_0x5017('0x38')]:_0x16a078[_0x5017('0x35')];if(!_0x31004b[_0x5017('0x36')][_0x5017('0x3a')]('nolimit')){_0x214d64[_0x5017('0x1f')]=qs[_0x5017('0x1f')](_0x31004b[_0x5017('0x36')][_0x5017('0x1f')]);_0x214d64['offset']=qs[_0x5017('0x21')](_0x31004b[_0x5017('0x36')]['offset']);}_0x214d64[_0x5017('0x3b')]=qs[_0x5017('0x3c')](_0x31004b['query'][_0x5017('0x3c')]);_0x214d64['where']=qs[_0x5017('0x33')](_['pick'](_0x31004b['query'],_0x16a078[_0x5017('0x33')]),_0x592e00);if(_0x31004b[_0x5017('0x36')][_0x5017('0x3d')]){_0x214d64[_0x5017('0x3e')]=_['merge'](_0x214d64[_0x5017('0x3e')],{'$or':_[_0x5017('0x31')](_0x592e00,function(_0x14b4fc){if(_0x14b4fc[_0x5017('0x2f')]!==_0x5017('0x3f')){var _0xfe324={};_0xfe324[_0x14b4fc['name']]={'$like':'%'+_0x31004b['query'][_0x5017('0x3d')]+'%'};return _0xfe324;}})});}_0x214d64=_[_0x5017('0x40')]({},_0x214d64,_0x31004b[_0x5017('0x41')]);var _0x5be44a={'where':_0x214d64[_0x5017('0x3e')]};return db[_0x5017('0x2d')][_0x5017('0x20')](_0x5be44a)[_0x5017('0x27')](function(_0x48617f){_0x2bb0f9[_0x5017('0x20')]=_0x48617f;if(_0x31004b[_0x5017('0x36')]['includeAll']){_0x214d64[_0x5017('0x42')]=[{'all':!![]}];}return db[_0x5017('0x2d')][_0x5017('0x43')](_0x214d64);})[_0x5017('0x27')](function(_0x1e690c){_0x2bb0f9[_0x5017('0x44')]=_0x1e690c;return _0x2bb0f9;})[_0x5017('0x27')](respondWithFilteredResult(_0x5ebd30,_0x214d64))[_0x5017('0x45')](handleError(_0x5ebd30,null));};exports[_0x5017('0x46')]=function(_0x418fb9,_0x417d41){var _0x55dafe={'raw':!![],'where':{'id':_0x418fb9[_0x5017('0x47')]['id']}},_0x291911={};_0x291911['model']=_[_0x5017('0x32')](db['AnalyticExtractedReport'][_0x5017('0x2e')]);_0x291911[_0x5017('0x36')]=_['keys'](_0x418fb9[_0x5017('0x36')]);_0x291911['filters']=_[_0x5017('0x34')](_0x291911['model'],_0x291911[_0x5017('0x36')]);_0x55dafe[_0x5017('0x38')]=_[_0x5017('0x34')](_0x291911[_0x5017('0x35')],qs['fields'](_0x418fb9[_0x5017('0x36')][_0x5017('0x37')]));_0x55dafe['attributes']=_0x55dafe[_0x5017('0x38')][_0x5017('0x39')]?_0x55dafe[_0x5017('0x38')]:_0x291911[_0x5017('0x35')];if(_0x418fb9[_0x5017('0x36')][_0x5017('0x48')]){_0x55dafe['include']=[{'all':!![]}];}_0x55dafe=_[_0x5017('0x40')]({},_0x55dafe,_0x418fb9['options']);return db[_0x5017('0x2d')]['find'](_0x55dafe)[_0x5017('0x27')](handleEntityNotFound(_0x417d41,null))['then'](respondWithResult(_0x417d41,null))[_0x5017('0x45')](handleError(_0x417d41,null));};exports[_0x5017('0x49')]=function(_0x330a96,_0x4cbd7f){return db['AnalyticExtractedReport'][_0x5017('0x49')](_0x330a96[_0x5017('0x4a')],{})['then'](function(_0x2cf67b){var _0x479377=_0x330a96[_0x5017('0x4b')][_0x5017('0x4c')]({'plain':!![]});if(!_0x479377)throw new Error(_0x5017('0x4d'));if(_0x479377['role']===_0x5017('0x4b')){var _0x40b2be=_0x2cf67b['get']({'plain':!![]});var _0x1d2a60=_0x5017('0x4e');return db[_0x5017('0x4f')][_0x5017('0x50')]({'where':{'name':_0x1d2a60,'userProfileId':_0x479377[_0x5017('0x51')]},'raw':!![]})[_0x5017('0x27')](function(_0x1599f1){if(_0x1599f1&&_0x1599f1[_0x5017('0x52')]===0x0){return db['UserProfileResource'][_0x5017('0x49')]({'name':_0x40b2be[_0x5017('0x2c')],'resourceId':_0x40b2be['id'],'type':_0x1599f1[_0x5017('0x2c')],'sectionId':_0x1599f1['id']},{})[_0x5017('0x27')](function(){return _0x2cf67b;});}else{return _0x2cf67b;}})[_0x5017('0x45')](function(_0x231d5f){logger['error'](_0x5017('0x53'),_0x231d5f);throw _0x231d5f;});}return _0x2cf67b;})[_0x5017('0x27')](respondWithResult(_0x4cbd7f,0xc9))[_0x5017('0x45')](handleError(_0x4cbd7f,null));};exports['update']=function(_0x1d468d,_0x79a4fc){if(_0x1d468d[_0x5017('0x4a')]['id']){delete _0x1d468d[_0x5017('0x4a')]['id'];}return db[_0x5017('0x2d')][_0x5017('0x50')]({'where':{'id':_0x1d468d[_0x5017('0x47')]['id']}})['then'](handleEntityNotFound(_0x79a4fc,null))['then'](saveUpdates(_0x1d468d[_0x5017('0x4a')],null))[_0x5017('0x27')](respondWithResult(_0x79a4fc,null))[_0x5017('0x45')](handleError(_0x79a4fc,null));};exports[_0x5017('0x28')]=function(_0x727380,_0x3a78e6){return db[_0x5017('0x2d')][_0x5017('0x50')]({'where':{'id':_0x727380[_0x5017('0x47')]['id']}})[_0x5017('0x27')](handleEntityNotFound(_0x3a78e6,null))[_0x5017('0x27')](removeEntity(_0x3a78e6,null))[_0x5017('0x45')](handleError(_0x3a78e6,null));};exports[_0x5017('0x54')]=function(_0x18b07a,_0x24f18e,_0x1c5a1d){return db[_0x5017('0x2d')][_0x5017('0x50')]({'where':{'id':_0x18b07a[_0x5017('0x47')]['id']},'attributes':['name','basename',_0x5017('0x55'),_0x5017('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x24f18e,null))['then'](function(_0x50c2f2){if(_0x50c2f2){if(!fs['existsSync'](path[_0x5017('0x57')](config['root'],'server/files/reports',_0x50c2f2[_0x5017('0x55')]))){throw new db['Sequelize'][(_0x5017('0x58'))](_0x5017('0x59'));}if(_0x18b07a[_0x5017('0x36')]['exists']){return _0x24f18e['sendStatus'](0xc8);}return _0x24f18e[_0x5017('0x54')](path[_0x5017('0x57')](config['root'],_0x5017('0x5a'),_0x50c2f2[_0x5017('0x55')]),util[_0x5017('0x5b')](_0x5017('0x5c'),_0x50c2f2['basename']||_0x50c2f2['name'],_0x50c2f2[_0x5017('0x56')][_0x5017('0x5d')]()));}})[_0x5017('0x45')](handleError(_0x24f18e,null));}; \ No newline at end of file +var _0xe69e=['show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','download','basename','savename','output','existsSync','join','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x105c51,_0x412d34){var _0x1f727d=function(_0x536704){while(--_0x536704){_0x105c51['push'](_0x105c51['shift']());}};_0x1f727d(++_0x412d34);}(_0xe69e,0x139));var _0xee69=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xe69e[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require(_0xee69('0x0'));var rimraf=require(_0xee69('0x1'));var zipdir=require(_0xee69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee69('0x3'));var moment=require(_0xee69('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee69('0x5'));var path=require(_0xee69('0x6'));var sox=require(_0xee69('0x7'));var csv=require(_0xee69('0x8'));var ejs=require(_0xee69('0x9'));var fs=require('fs');var fs_extra=require(_0xee69('0xa'));var _=require(_0xee69('0xb'));var squel=require('squel');var crypto=require(_0xee69('0xc'));var jsforce=require(_0xee69('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xee69('0x8'));var querystring=require('querystring');var Papa=require(_0xee69('0xe'));var Redis=require('ioredis');var authService=require(_0xee69('0xf'));var qs=require(_0xee69('0x10'));var as=require(_0xee69('0x11'));var hardwareService=require(_0xee69('0x12'));var logger=require('../../config/logger')(_0xee69('0x13'));var utils=require(_0xee69('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xee69('0x15'));var db=require(_0xee69('0x16'))['db'];function respondWithStatusCode(_0x441d6e,_0x300b1e){_0x300b1e=_0x300b1e||0xcc;return function(_0x40bb5a){if(_0x40bb5a){return _0x441d6e[_0xee69('0x17')](_0x300b1e);}return _0x441d6e[_0xee69('0x18')](_0x300b1e)[_0xee69('0x19')]();};}function respondWithResult(_0x5772a8,_0x4ba33a){_0x4ba33a=_0x4ba33a||0xc8;return function(_0x38d668){if(_0x38d668){return _0x5772a8['status'](_0x4ba33a)[_0xee69('0x1a')](_0x38d668);}};}function respondWithFilteredResult(_0x4314fc,_0x19eef4){return function(_0xdcfa07){if(_0xdcfa07){var _0x251e73=typeof _0x19eef4[_0xee69('0x1b')]===_0xee69('0x1c')&&typeof _0x19eef4[_0xee69('0x1d')]===_0xee69('0x1c');var _0x28bb57=_0xdcfa07[_0xee69('0x1e')];var _0x36cc93=_0x251e73?0x0:_0x19eef4[_0xee69('0x1b')];var _0x5bc6f6=_0x251e73?_0xdcfa07[_0xee69('0x1e')]:_0x19eef4[_0xee69('0x1b')]+_0x19eef4[_0xee69('0x1d')];var _0x4fa61a;if(_0x5bc6f6>=_0x28bb57){_0x5bc6f6=_0x28bb57;_0x4fa61a=0xc8;}else{_0x4fa61a=0xce;}_0x4314fc[_0xee69('0x18')](_0x4fa61a);return _0x4314fc[_0xee69('0x1f')](_0xee69('0x20'),_0x36cc93+'-'+_0x5bc6f6+'/'+_0x28bb57)[_0xee69('0x1a')](_0xdcfa07);}return null;};}function patchUpdates(_0x4e0009){return function(_0x15a2a1){try{jsonpatch[_0xee69('0x21')](_0x15a2a1,_0x4e0009,!![]);}catch(_0x2fdfa5){return BPromise[_0xee69('0x22')](_0x2fdfa5);}return _0x15a2a1[_0xee69('0x23')]();};}function saveUpdates(_0x542f55,_0x533f16){return function(_0x318c47){if(_0x318c47){return _0x318c47['update'](_0x542f55)[_0xee69('0x24')](function(_0x182b55){return _0x182b55;});}return null;};}function removeEntity(_0x1f6543,_0x42a85b){return function(_0x7669a2){if(_0x7669a2){return _0x7669a2[_0xee69('0x25')]()['then'](function(){var _0x19e61=_0x7669a2[_0xee69('0x26')]({'plain':!![]});var _0x632d52=_0xee69('0x27');return db[_0xee69('0x28')][_0xee69('0x25')]({'where':{'type':_0x632d52,'resourceId':_0x19e61['id']}})['then'](function(){return _0x7669a2;});})[_0xee69('0x24')](function(){_0x1f6543[_0xee69('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe473,_0x5516cc){return function(_0x3ad69a){if(!_0x3ad69a){_0x1fe473['sendStatus'](0x194);}return _0x3ad69a;};}function handleError(_0x652988,_0x1d5c0c){_0x1d5c0c=_0x1d5c0c||0x1f4;return function(_0x11014d){logger['error'](_0x11014d[_0xee69('0x29')]);if(_0x11014d[_0xee69('0x2a')]){delete _0x11014d[_0xee69('0x2a')];}_0x652988[_0xee69('0x18')](_0x1d5c0c)[_0xee69('0x2b')](_0x11014d);};}exports[_0xee69('0x2c')]=function(_0x44a007,_0x36c62d){var _0x37f8fd={},_0x5d2f30={},_0x217068={'count':0x0,'rows':[]};var _0x3a5e97=_[_0xee69('0x2d')](db[_0xee69('0x2e')][_0xee69('0x2f')],function(_0x5efd21){return{'name':_0x5efd21['fieldName'],'type':_0x5efd21[_0xee69('0x30')][_0xee69('0x31')]};});_0x5d2f30[_0xee69('0x32')]=_[_0xee69('0x2d')](_0x3a5e97,_0xee69('0x2a'));_0x5d2f30[_0xee69('0x33')]=_['keys'](_0x44a007[_0xee69('0x33')]);_0x5d2f30['filters']=_[_0xee69('0x34')](_0x5d2f30[_0xee69('0x32')],_0x5d2f30[_0xee69('0x33')]);_0x37f8fd[_0xee69('0x35')]=_[_0xee69('0x34')](_0x5d2f30[_0xee69('0x32')],qs['fields'](_0x44a007[_0xee69('0x33')][_0xee69('0x36')]));_0x37f8fd['attributes']=_0x37f8fd[_0xee69('0x35')][_0xee69('0x37')]?_0x37f8fd[_0xee69('0x35')]:_0x5d2f30[_0xee69('0x32')];if(!_0x44a007[_0xee69('0x33')][_0xee69('0x38')](_0xee69('0x39'))){_0x37f8fd[_0xee69('0x1d')]=qs[_0xee69('0x1d')](_0x44a007[_0xee69('0x33')][_0xee69('0x1d')]);_0x37f8fd[_0xee69('0x1b')]=qs[_0xee69('0x1b')](_0x44a007[_0xee69('0x33')]['offset']);}_0x37f8fd[_0xee69('0x3a')]=qs[_0xee69('0x3b')](_0x44a007['query']['sort']);_0x37f8fd[_0xee69('0x3c')]=qs[_0xee69('0x3d')](_[_0xee69('0x3e')](_0x44a007[_0xee69('0x33')],_0x5d2f30[_0xee69('0x3d')]),_0x3a5e97);if(_0x44a007[_0xee69('0x33')][_0xee69('0x3f')]){_0x37f8fd['where']=_[_0xee69('0x40')](_0x37f8fd[_0xee69('0x3c')],{'$or':_['map'](_0x3a5e97,function(_0x491bc1){if(_0x491bc1['type']!==_0xee69('0x41')){var _0x1e94d3={};_0x1e94d3[_0x491bc1['name']]={'$like':'%'+_0x44a007[_0xee69('0x33')][_0xee69('0x3f')]+'%'};return _0x1e94d3;}})});}_0x37f8fd=_[_0xee69('0x40')]({},_0x37f8fd,_0x44a007[_0xee69('0x42')]);var _0x4b13ad={'where':_0x37f8fd['where']};return db[_0xee69('0x2e')][_0xee69('0x1e')](_0x4b13ad)[_0xee69('0x24')](function(_0x393d69){_0x217068[_0xee69('0x1e')]=_0x393d69;if(_0x44a007[_0xee69('0x33')][_0xee69('0x43')]){_0x37f8fd['include']=[{'all':!![]}];}return db[_0xee69('0x2e')][_0xee69('0x44')](_0x37f8fd);})[_0xee69('0x24')](function(_0xefdc8f){_0x217068[_0xee69('0x45')]=_0xefdc8f;return _0x217068;})['then'](respondWithFilteredResult(_0x36c62d,_0x37f8fd))[_0xee69('0x46')](handleError(_0x36c62d,null));};exports[_0xee69('0x47')]=function(_0x53c442,_0x15313c){var _0x101edb={'raw':!![],'where':{'id':_0x53c442['params']['id']}},_0x26ec7b={};_0x26ec7b['model']=_[_0xee69('0x48')](db['AnalyticExtractedReport']['rawAttributes']);_0x26ec7b[_0xee69('0x33')]=_['keys'](_0x53c442[_0xee69('0x33')]);_0x26ec7b[_0xee69('0x3d')]=_[_0xee69('0x34')](_0x26ec7b['model'],_0x26ec7b[_0xee69('0x33')]);_0x101edb[_0xee69('0x35')]=_['intersection'](_0x26ec7b[_0xee69('0x32')],qs[_0xee69('0x36')](_0x53c442['query'][_0xee69('0x36')]));_0x101edb['attributes']=_0x101edb[_0xee69('0x35')][_0xee69('0x37')]?_0x101edb[_0xee69('0x35')]:_0x26ec7b[_0xee69('0x32')];if(_0x53c442[_0xee69('0x33')][_0xee69('0x43')]){_0x101edb['include']=[{'all':!![]}];}_0x101edb=_[_0xee69('0x40')]({},_0x101edb,_0x53c442[_0xee69('0x42')]);return db[_0xee69('0x2e')][_0xee69('0x49')](_0x101edb)[_0xee69('0x24')](handleEntityNotFound(_0x15313c,null))[_0xee69('0x24')](respondWithResult(_0x15313c,null))['catch'](handleError(_0x15313c,null));};exports[_0xee69('0x4a')]=function(_0x15cb1d,_0x50b6f7){return db[_0xee69('0x2e')][_0xee69('0x4a')](_0x15cb1d['body'],{})[_0xee69('0x24')](function(_0x3955a9){var _0x3c4ccf=_0x15cb1d[_0xee69('0x4b')][_0xee69('0x26')]({'plain':!![]});if(!_0x3c4ccf)throw new Error(_0xee69('0x4c'));if(_0x3c4ccf[_0xee69('0x4d')]==='user'){var _0x18c90d=_0x3955a9['get']({'plain':!![]});var _0x3e4bc0=_0xee69('0x27');return db[_0xee69('0x4e')][_0xee69('0x49')]({'where':{'name':_0x3e4bc0,'userProfileId':_0x3c4ccf[_0xee69('0x4f')]},'raw':!![]})[_0xee69('0x24')](function(_0x19d30c){if(_0x19d30c&&_0x19d30c['autoAssociation']===0x0){return db[_0xee69('0x28')][_0xee69('0x4a')]({'name':_0x18c90d[_0xee69('0x2a')],'resourceId':_0x18c90d['id'],'type':_0x19d30c['name'],'sectionId':_0x19d30c['id']},{})[_0xee69('0x24')](function(){return _0x3955a9;});}else{return _0x3955a9;}})[_0xee69('0x46')](function(_0x123286){logger[_0xee69('0x50')](_0xee69('0x51'),_0x123286);throw _0x123286;});}return _0x3955a9;})[_0xee69('0x24')](respondWithResult(_0x50b6f7,0xc9))[_0xee69('0x46')](handleError(_0x50b6f7,null));};exports[_0xee69('0x52')]=function(_0x17eebf,_0x44237e){if(_0x17eebf['body']['id']){delete _0x17eebf[_0xee69('0x53')]['id'];}return db['AnalyticExtractedReport'][_0xee69('0x49')]({'where':{'id':_0x17eebf['params']['id']}})['then'](handleEntityNotFound(_0x44237e,null))['then'](saveUpdates(_0x17eebf['body'],null))[_0xee69('0x24')](respondWithResult(_0x44237e,null))[_0xee69('0x46')](handleError(_0x44237e,null));};exports[_0xee69('0x25')]=function(_0x587626,_0x254b3e){return db['AnalyticExtractedReport'][_0xee69('0x49')]({'where':{'id':_0x587626[_0xee69('0x54')]['id']}})['then'](handleEntityNotFound(_0x254b3e,null))['then'](removeEntity(_0x254b3e,null))[_0xee69('0x46')](handleError(_0x254b3e,null));};exports[_0xee69('0x55')]=function(_0x344800,_0x1dbdf1,_0x9882c7){return db[_0xee69('0x2e')]['find']({'where':{'id':_0x344800[_0xee69('0x54')]['id']},'attributes':[_0xee69('0x2a'),_0xee69('0x56'),_0xee69('0x57'),_0xee69('0x58')],'raw':!![]})[_0xee69('0x24')](handleEntityNotFound(_0x1dbdf1,null))[_0xee69('0x24')](function(_0x1d6956){if(_0x1d6956){if(!fs[_0xee69('0x59')](path[_0xee69('0x5a')](config['root'],_0xee69('0x5b'),_0x1d6956['savename']))){throw new db['Sequelize']['ValidationError'](_0xee69('0x5c'));}if(_0x344800[_0xee69('0x33')][_0xee69('0x5d')]){return _0x1dbdf1[_0xee69('0x17')](0xc8);}return _0x1dbdf1['download'](path[_0xee69('0x5a')](config['root'],'server/files/reports',_0x1d6956[_0xee69('0x57')]),util['format'](_0xee69('0x5e'),_0x1d6956[_0xee69('0x56')]||_0x1d6956[_0xee69('0x2a')],_0x1d6956[_0xee69('0x58')][_0xee69('0x5f')]()));}})[_0xee69('0x46')](handleError(_0x1dbdf1,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 43235af..994e2bb 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 _0xb973=['api','bluebird','request-promise','path','rimraf','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb973,0x151));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b97('0x0'));var util=require(_0x3b97('0x1'));var logger=require(_0x3b97('0x2'))(_0x3b97('0x3'));var moment=require('moment');var BPromise=require(_0x3b97('0x4'));var rp=require(_0x3b97('0x5'));var fs=require('fs');var path=require(_0x3b97('0x6'));var rimraf=require(_0x3b97('0x7'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x248c67,_0x1e760f){return _0x248c67['define'](_0x3b97('0x8'),attributes,{'tableName':_0x3b97('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a0=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes'];(function(_0x2d454f,_0x175085){var _0x37aaba=function(_0x2efe84){while(--_0x2efe84){_0x2d454f['push'](_0x2d454f['shift']());}};_0x37aaba(++_0x175085);}(_0xc2a0,0x154));var _0x0c2a=function(_0x9ffba8,_0x3f44ff){_0x9ffba8=_0x9ffba8-0x0;var _0x498ea9=_0xc2a0[_0x9ffba8];return _0x498ea9;};'use strict';var _=require(_0x0c2a('0x0'));var util=require(_0x0c2a('0x1'));var logger=require(_0x0c2a('0x2'))(_0x0c2a('0x3'));var moment=require(_0x0c2a('0x4'));var BPromise=require(_0x0c2a('0x5'));var rp=require(_0x0c2a('0x6'));var fs=require('fs');var path=require(_0x0c2a('0x7'));var rimraf=require(_0x0c2a('0x8'));var config=require('../../config/environment');var attributes=require(_0x0c2a('0x9'));module[_0x0c2a('0xa')]=function(_0x59fc6f,_0x4d0534){return _0x59fc6f[_0x0c2a('0xb')](_0x0c2a('0xc'),attributes,{'tableName':_0x0c2a('0xd'),'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 64f6581..c4517c0 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 _0x64e5=['AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b873d,_0x365388){var _0xa625b7=function(_0x2c7a5f){while(--_0x2c7a5f){_0x4b873d['push'](_0x4b873d['shift']());}};_0xa625b7(++_0x365388);}(_0x64e5,0x146));var _0x564e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x64e5[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x564e('0x0'));var util=require(_0x564e('0x1'));var moment=require(_0x564e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x564e('0x3'))['db'];var utils=require(_0x564e('0x4'));var logger=require('../../config/logger')(_0x564e('0x5'));var config=require(_0x564e('0x6'));var jayson=require(_0x564e('0x7'));var client=jayson[_0x564e('0x8')][_0x564e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a7a20,_0x5bb9af,_0xd8ebd9){return new BPromise(function(_0x236b25,_0x5aa6af){return client[_0x564e('0xa')](_0x5a7a20,_0xd8ebd9)[_0x564e('0xb')](function(_0x512e20){logger[_0x564e('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5bb9af,_0x564e('0xd'));logger[_0x564e('0xe')](_0x564e('0xf'),_0x5bb9af,_0x564e('0xd'),JSON[_0x564e('0x10')](_0x512e20));if(_0x512e20['error']){if(_0x512e20[_0x564e('0x11')][_0x564e('0x12')]===0x1f4){logger[_0x564e('0x11')](_0x564e('0x13'),_0x5bb9af,_0x512e20[_0x564e('0x11')][_0x564e('0x14')]);return _0x5aa6af(_0x512e20[_0x564e('0x11')][_0x564e('0x14')]);}logger[_0x564e('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5bb9af,_0x512e20[_0x564e('0x11')][_0x564e('0x14')]);return _0x236b25(_0x512e20[_0x564e('0x11')][_0x564e('0x14')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5bb9af,'request\x20sent');_0x236b25(_0x512e20[_0x564e('0x15')][_0x564e('0x14')]);}})[_0x564e('0x16')](function(_0x42b1c9){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5bb9af,_0x42b1c9);_0x5aa6af(_0x42b1c9);});});} \ No newline at end of file +var _0xb067=['code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x34ff1f,_0x2363b2){var _0x26f1fe=function(_0x451812){while(--_0x451812){_0x34ff1f['push'](_0x34ff1f['shift']());}};_0x26f1fe(++_0x2363b2);}(_0xb067,0x13d));var _0x7b06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb067[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7b06('0x0'));var util=require('util');var moment=require(_0x7b06('0x1'));var BPromise=require(_0x7b06('0x2'));var rs=require(_0x7b06('0x3'));var fs=require('fs');var Redis=require(_0x7b06('0x4'));var db=require(_0x7b06('0x5'))['db'];var utils=require(_0x7b06('0x6'));var logger=require(_0x7b06('0x7'))(_0x7b06('0x8'));var config=require(_0x7b06('0x9'));var jayson=require(_0x7b06('0xa'));var client=jayson[_0x7b06('0xb')][_0x7b06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52f91e,_0x28fcac,_0x2122c6){return new BPromise(function(_0xb1b161,_0x274003){return client[_0x7b06('0xd')](_0x52f91e,_0x2122c6)[_0x7b06('0xe')](function(_0x4e84a4){logger[_0x7b06('0xf')](_0x7b06('0x10'),_0x28fcac,'request\x20sent');logger[_0x7b06('0x11')](_0x7b06('0x12'),_0x28fcac,'request\x20sent',JSON[_0x7b06('0x13')](_0x4e84a4));if(_0x4e84a4[_0x7b06('0x14')]){if(_0x4e84a4[_0x7b06('0x14')][_0x7b06('0x15')]===0x1f4){logger[_0x7b06('0x14')](_0x7b06('0x10'),_0x28fcac,_0x4e84a4[_0x7b06('0x14')]['message']);return _0x274003(_0x4e84a4[_0x7b06('0x14')][_0x7b06('0x16')]);}logger[_0x7b06('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x28fcac,_0x4e84a4[_0x7b06('0x14')][_0x7b06('0x16')]);return _0xb1b161(_0x4e84a4[_0x7b06('0x14')][_0x7b06('0x16')]);}else{logger[_0x7b06('0xf')](_0x7b06('0x10'),_0x28fcac,_0x7b06('0x17'));_0xb1b161(_0x4e84a4[_0x7b06('0x18')][_0x7b06('0x16')]);}})[_0x7b06('0x19')](function(_0x246a58){logger[_0x7b06('0x14')](_0x7b06('0x10'),_0x28fcac,_0x246a58);_0x274003(_0x246a58);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 8af69d7..a97f2d3 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 _0x3d71=['get','isAuthenticated','index','/:id','show','post','create','put','update','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x57f345,_0x316929){var _0x255e43=function(_0x619f61){while(--_0x619f61){_0x57f345['push'](_0x57f345['shift']());}};_0x255e43(++_0x316929);}(_0x3d71,0x109));var _0x13d7=function(_0x65abe6,_0x45e5a2){_0x65abe6=_0x65abe6-0x0;var _0x497257=_0x3d71[_0x65abe6];return _0x497257;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x13d7('0x0'));var express=require(_0x13d7('0x1'));var router=express[_0x13d7('0x2')]();var fs_extra=require(_0x13d7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x13d7('0x4'));var config=require(_0x13d7('0x5'));var controller=require(_0x13d7('0x6'));router[_0x13d7('0x7')]('/',auth[_0x13d7('0x8')](),controller[_0x13d7('0x9')]);router[_0x13d7('0x7')](_0x13d7('0xa'),auth[_0x13d7('0x8')](),controller[_0x13d7('0xb')]);router['get']('/:id/download',auth[_0x13d7('0x8')](),controller['download']);router[_0x13d7('0xc')]('/',auth[_0x13d7('0x8')](),controller[_0x13d7('0xd')]);router[_0x13d7('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x13d7('0xf')]);router['delete'](_0x13d7('0xa'),auth[_0x13d7('0x8')](),controller['destroy']);module[_0x13d7('0x10')]=router; \ No newline at end of file +var _0x950e=['Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','isAuthenticated','/:id/download','post','create','/:id','update','destroy','exports','util','path','connect-timeout'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x950e,0x12f));var _0xe950=function(_0x49d931,_0x121258){_0x49d931=_0x49d931-0x0;var _0x491a2a=_0x950e[_0x49d931];return _0x491a2a;};'use strict';var multer=require('multer');var util=require(_0xe950('0x0'));var path=require(_0xe950('0x1'));var timeout=require(_0xe950('0x2'));var express=require('express');var router=express[_0xe950('0x3')]();var fs_extra=require(_0xe950('0x4'));var auth=require(_0xe950('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe950('0x6'));var controller=require(_0xe950('0x7'));router[_0xe950('0x8')]('/',auth['isAuthenticated'](),controller[_0xe950('0x9')]);router[_0xe950('0x8')]('/:id',auth[_0xe950('0xa')](),controller['show']);router[_0xe950('0x8')](_0xe950('0xb'),auth[_0xe950('0xa')](),controller['download']);router[_0xe950('0xc')]('/',auth['isAuthenticated'](),controller[_0xe950('0xd')]);router['put'](_0xe950('0xe'),auth[_0xe950('0xa')](),controller[_0xe950('0xf')]);router['delete'](_0xe950('0xe'),auth[_0xe950('0xa')](),controller[_0xe950('0x10')]);module[_0xe950('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 e36000b..e832162 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 _0x9d5a=['exports','TEXT','STRING','sequelize'];(function(_0x147a63,_0x537f6){var _0x265f26=function(_0x5d02df){while(--_0x5d02df){_0x147a63['push'](_0x147a63['shift']());}};_0x265f26(++_0x537f6);}(_0x9d5a,0x17b));var _0xa9d5=function(_0xccdde3,_0x4786bb){_0xccdde3=_0xccdde3-0x0;var _0x3e3a29=_0x9d5a[_0xccdde3];return _0x3e3a29;};'use strict';var Sequelize=require(_0xa9d5('0x0'));module[_0xa9d5('0x1')]={'field':{'type':Sequelize[_0xa9d5('0x2')]},'alias':{'type':Sequelize[_0xa9d5('0x3')]},'function':{'type':Sequelize[_0xa9d5('0x3')]},'format':{'type':Sequelize[_0xa9d5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa9d5('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x39fe=['STRING','BOOLEAN','exports','TEXT'];(function(_0x46cb5d,_0x21c4cd){var _0x23feaf=function(_0x218eba){while(--_0x218eba){_0x46cb5d['push'](_0x46cb5d['shift']());}};_0x23feaf(++_0x21c4cd);}(_0x39fe,0x1ea));var _0xe39f=function(_0x2a3367,_0x25913a){_0x2a3367=_0x2a3367-0x0;var _0x230264=_0x39fe[_0x2a3367];return _0x230264;};'use strict';var Sequelize=require('sequelize');module[_0xe39f('0x0')]={'field':{'type':Sequelize[_0xe39f('0x1')]},'alias':{'type':Sequelize[_0xe39f('0x2')]},'function':{'type':Sequelize[_0xe39f('0x2')]},'format':{'type':Sequelize[_0xe39f('0x2')]},'groupBy':{'type':Sequelize[_0xe39f('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xe39f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 5ebe5e9..f3805e8 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 _0x58fc=['where','filters','pick','filter','merge','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','bulkCreate','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','attributes','intersection','fields','query','length','hasOwnProperty','sort'];(function(_0x4e4935,_0x12ef52){var _0x454e3e=function(_0x55f0b4){while(--_0x55f0b4){_0x4e4935['push'](_0x4e4935['shift']());}};_0x454e3e(++_0x12ef52);}(_0x58fc,0x1ad));var _0xc58f=function(_0x156513,_0xbcfa53){_0x156513=_0x156513-0x0;var _0x5cad29=_0x58fc[_0x156513];return _0x5cad29;};'use strict';var emlformat=require(_0xc58f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc58f('0x1'));var jsonpatch=require(_0xc58f('0x2'));var rp=require(_0xc58f('0x3'));var moment=require(_0xc58f('0x4'));var BPromise=require(_0xc58f('0x5'));var Mustache=require(_0xc58f('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc58f('0x7'));var csv=require(_0xc58f('0x8'));var ejs=require(_0xc58f('0x9'));var fs=require('fs');var fs_extra=require(_0xc58f('0xa'));var _=require('lodash');var squel=require(_0xc58f('0xb'));var crypto=require('crypto');var jsforce=require(_0xc58f('0xc'));var deskjs=require(_0xc58f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc58f('0xe'));var Papa=require(_0xc58f('0xf'));var Redis=require(_0xc58f('0x10'));var authService=require(_0xc58f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc58f('0x12'))(_0xc58f('0x13'));var utils=require(_0xc58f('0x14'));var config=require(_0xc58f('0x15'));var licenseUtil=require(_0xc58f('0x16'));var db=require(_0xc58f('0x17'))['db'];function respondWithStatusCode(_0x42b7f5,_0x4d810e){_0x4d810e=_0x4d810e||0xcc;return function(_0x51e01e){if(_0x51e01e){return _0x42b7f5[_0xc58f('0x18')](_0x4d810e);}return _0x42b7f5[_0xc58f('0x19')](_0x4d810e)[_0xc58f('0x1a')]();};}function respondWithResult(_0x4ff012,_0x5b07ca){_0x5b07ca=_0x5b07ca||0xc8;return function(_0x10e76c){if(_0x10e76c){return _0x4ff012[_0xc58f('0x19')](_0x5b07ca)[_0xc58f('0x1b')](_0x10e76c);}};}function respondWithFilteredResult(_0x4e62ea,_0x57873c){return function(_0x17e268){if(_0x17e268){var _0x36918f=typeof _0x57873c[_0xc58f('0x1c')]===_0xc58f('0x1d')&&typeof _0x57873c['limit']===_0xc58f('0x1d');var _0x48fbcc=_0x17e268['count'];var _0x3a4e55=_0x36918f?0x0:_0x57873c[_0xc58f('0x1c')];var _0x1e6619=_0x36918f?_0x17e268[_0xc58f('0x1e')]:_0x57873c[_0xc58f('0x1c')]+_0x57873c[_0xc58f('0x1f')];var _0xc0966c;if(_0x1e6619>=_0x48fbcc){_0x1e6619=_0x48fbcc;_0xc0966c=0xc8;}else{_0xc0966c=0xce;}_0x4e62ea[_0xc58f('0x19')](_0xc0966c);return _0x4e62ea[_0xc58f('0x20')]('Content-Range',_0x3a4e55+'-'+_0x1e6619+'/'+_0x48fbcc)[_0xc58f('0x1b')](_0x17e268);}return null;};}function patchUpdates(_0x3c2a37){return function(_0x11c8d2){try{jsonpatch[_0xc58f('0x21')](_0x11c8d2,_0x3c2a37,!![]);}catch(_0x37fd1f){return BPromise[_0xc58f('0x22')](_0x37fd1f);}return _0x11c8d2[_0xc58f('0x23')]();};}function saveUpdates(_0x48b078,_0x5a4a7b){return function(_0xe5a7c5){if(_0xe5a7c5){return _0xe5a7c5[_0xc58f('0x24')](_0x48b078)[_0xc58f('0x25')](function(_0x283edb){return _0x283edb;});}return null;};}function removeEntity(_0x4f6665,_0xcc970f){return function(_0xcd3a85){if(_0xcd3a85){return _0xcd3a85[_0xc58f('0x26')]()['then'](function(){_0x4f6665['status'](0xcc)[_0xc58f('0x1a')]();});}};}function handleEntityNotFound(_0x28d524,_0x3ef576){return function(_0x4858ac){if(!_0x4858ac){_0x28d524[_0xc58f('0x18')](0x194);}return _0x4858ac;};}function handleError(_0x354b00,_0x593621){_0x593621=_0x593621||0x1f4;return function(_0x2183eb){logger[_0xc58f('0x27')](_0x2183eb[_0xc58f('0x28')]);if(_0x2183eb[_0xc58f('0x29')]){delete _0x2183eb[_0xc58f('0x29')];}_0x354b00['status'](_0x593621)[_0xc58f('0x2a')](_0x2183eb);};}exports[_0xc58f('0x2b')]=function(_0x339c59,_0x4cc04a){var _0x255b43={},_0x153019={},_0x38ba85={'count':0x0,'rows':[]};var _0x578705=_[_0xc58f('0x2c')](db['AnalyticFieldReport'][_0xc58f('0x2d')],function(_0xee130e){return{'name':_0xee130e['fieldName'],'type':_0xee130e[_0xc58f('0x2e')][_0xc58f('0x2f')]};});_0x153019[_0xc58f('0x30')]=_[_0xc58f('0x2c')](_0x578705,_0xc58f('0x29'));_0x153019['query']=_[_0xc58f('0x31')](_0x339c59['query']);_0x153019['filters']=_['intersection'](_0x153019[_0xc58f('0x30')],_0x153019['query']);_0x255b43[_0xc58f('0x32')]=_[_0xc58f('0x33')](_0x153019[_0xc58f('0x30')],qs[_0xc58f('0x34')](_0x339c59[_0xc58f('0x35')][_0xc58f('0x34')]));_0x255b43[_0xc58f('0x32')]=_0x255b43[_0xc58f('0x32')][_0xc58f('0x36')]?_0x255b43[_0xc58f('0x32')]:_0x153019[_0xc58f('0x30')];if(!_0x339c59[_0xc58f('0x35')][_0xc58f('0x37')]('nolimit')){_0x255b43[_0xc58f('0x1f')]=qs[_0xc58f('0x1f')](_0x339c59[_0xc58f('0x35')][_0xc58f('0x1f')]);_0x255b43[_0xc58f('0x1c')]=qs[_0xc58f('0x1c')](_0x339c59[_0xc58f('0x35')][_0xc58f('0x1c')]);}_0x255b43['order']=qs[_0xc58f('0x38')](_0x339c59[_0xc58f('0x35')]['sort']);_0x255b43[_0xc58f('0x39')]=qs[_0xc58f('0x3a')](_[_0xc58f('0x3b')](_0x339c59[_0xc58f('0x35')],_0x153019[_0xc58f('0x3a')]),_0x578705);if(_0x339c59[_0xc58f('0x35')][_0xc58f('0x3c')]){_0x255b43[_0xc58f('0x39')]=_[_0xc58f('0x3d')](_0x255b43['where'],{'$or':_['map'](_0x578705,function(_0x40f682){if(_0x40f682[_0xc58f('0x2e')]!=='VIRTUAL'){var _0x43c69e={};_0x43c69e[_0x40f682[_0xc58f('0x29')]]={'$like':'%'+_0x339c59['query'][_0xc58f('0x3c')]+'%'};return _0x43c69e;}})});}_0x255b43=_[_0xc58f('0x3d')]({},_0x255b43,_0x339c59['options']);var _0x4a0783={'where':_0x255b43[_0xc58f('0x39')]};return db[_0xc58f('0x3e')][_0xc58f('0x1e')](_0x4a0783)[_0xc58f('0x25')](function(_0x1c530c){_0x38ba85['count']=_0x1c530c;if(_0x339c59[_0xc58f('0x35')][_0xc58f('0x3f')]){_0x255b43[_0xc58f('0x40')]=[{'all':!![]}];}return db[_0xc58f('0x3e')][_0xc58f('0x41')](_0x255b43);})[_0xc58f('0x25')](function(_0x5921f6){_0x38ba85[_0xc58f('0x42')]=_0x5921f6;return _0x38ba85;})[_0xc58f('0x25')](respondWithFilteredResult(_0x4cc04a,_0x255b43))[_0xc58f('0x43')](handleError(_0x4cc04a,null));};exports[_0xc58f('0x44')]=function(_0x5ef491,_0x16555a){var _0x1506eb={'raw':![],'where':{'id':_0x5ef491[_0xc58f('0x45')]['id']}},_0x4c594c={};_0x4c594c[_0xc58f('0x30')]=_[_0xc58f('0x31')](db[_0xc58f('0x3e')][_0xc58f('0x2d')]);_0x4c594c[_0xc58f('0x35')]=_['keys'](_0x5ef491[_0xc58f('0x35')]);_0x4c594c[_0xc58f('0x3a')]=_['intersection'](_0x4c594c[_0xc58f('0x30')],_0x4c594c[_0xc58f('0x35')]);_0x1506eb[_0xc58f('0x32')]=_[_0xc58f('0x33')](_0x4c594c[_0xc58f('0x30')],qs[_0xc58f('0x34')](_0x5ef491[_0xc58f('0x35')][_0xc58f('0x34')]));_0x1506eb['attributes']=_0x1506eb[_0xc58f('0x32')][_0xc58f('0x36')]?_0x1506eb[_0xc58f('0x32')]:_0x4c594c[_0xc58f('0x30')];if(_0x5ef491['query'][_0xc58f('0x3f')]){_0x1506eb['include']=[{'all':!![]}];}_0x1506eb=_['merge']({},_0x1506eb,_0x5ef491[_0xc58f('0x46')]);return db['AnalyticFieldReport'][_0xc58f('0x47')](_0x1506eb)[_0xc58f('0x25')](handleEntityNotFound(_0x16555a,null))[_0xc58f('0x25')](respondWithResult(_0x16555a,null))['catch'](handleError(_0x16555a,null));};exports[_0xc58f('0x48')]=function(_0x5139a0,_0x2e718a){return db[_0xc58f('0x3e')][_0xc58f('0x48')](_0x5139a0[_0xc58f('0x49')],{})[_0xc58f('0x25')](respondWithResult(_0x2e718a,0xc9))['catch'](handleError(_0x2e718a,null));};exports[_0xc58f('0x4a')]=function(_0xbc85f4,_0x3870b2){return db[_0xc58f('0x3e')][_0xc58f('0x4a')](_0xbc85f4[_0xc58f('0x49')],{'raw':![],'individualHooks':!![]})[_0xc58f('0x25')](respondWithResult(_0x3870b2,0xc9))['catch'](handleError(_0x3870b2,null));};exports['update']=function(_0xb8c989,_0x1b95cf){if(_0xb8c989[_0xc58f('0x49')]['id']){delete _0xb8c989[_0xc58f('0x49')]['id'];}return db[_0xc58f('0x3e')][_0xc58f('0x47')]({'where':{'id':_0xb8c989[_0xc58f('0x45')]['id']}})[_0xc58f('0x25')](handleEntityNotFound(_0x1b95cf,null))[_0xc58f('0x25')](saveUpdates(_0xb8c989['body'],null))[_0xc58f('0x25')](respondWithResult(_0x1b95cf,null))[_0xc58f('0x43')](handleError(_0x1b95cf,null));};exports['destroy']=function(_0x1fac1e,_0x1bb6e9){return db[_0xc58f('0x3e')]['find']({'where':{'id':_0x1fac1e[_0xc58f('0x45')]['id']}})[_0xc58f('0x25')](handleEntityNotFound(_0x1bb6e9,null))['then'](removeEntity(_0x1bb6e9,null))[_0xc58f('0x43')](handleError(_0x1bb6e9,null));};exports[_0xc58f('0x4b')]=function(_0x3d1972,_0x4f4d37){return db['AnalyticFieldReport'][_0xc58f('0x26')]({'where':{'id':_0x3d1972[_0xc58f('0x35')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xc58f('0x25')](respondWithResult(_0x4f4d37,0xcc))['catch'](handleError(_0x4f4d37,null));};exports['addFields']=function(_0x5ca820,_0x254ab9,_0x4aba59){return db[_0xc58f('0x4c')][_0xc58f('0x4d')]({'where':{'id':_0x5ca820[_0xc58f('0x45')]['id']}})[_0xc58f('0x25')](handleEntityNotFound(_0x254ab9,null))[_0xc58f('0x25')](function(_0x12b8e5){if(_0x12b8e5){return db[_0xc58f('0x4e')][_0xc58f('0x4f')](function(_0x364a42){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x5ca820[_0xc58f('0x45')]['id']},'transaction':_0x364a42})[_0xc58f('0x25')](function(_0x847de6){var _0x3ec670=_[_0xc58f('0x2c')](_0x5ca820[_0xc58f('0x49')],function(_0x4fd545){delete _0x4fd545['id'];_0x4fd545[_0xc58f('0x50')]=_0x5ca820['params']['id'];return _0x4fd545;});return db['AnalyticFieldReport'][_0xc58f('0x4a')](_0x3ec670,{'transaction':_0x364a42});});})[_0xc58f('0x25')](function(){return db[_0xc58f('0x3e')]['findAll']({'where':{'CustomReportId':_0x5ca820[_0xc58f('0x45')]['id']}});});}})[_0xc58f('0x25')](respondWithResult(_0x254ab9,null))[_0xc58f('0x43')](handleError(_0x254ab9,null));}; \ No newline at end of file +var _0x5a12=['mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','create','body','bulkCreate','find','params','ids','AnalyticCustomReport','findOne','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xe6f0ec,_0x263b0f){var _0x1beb99=function(_0x5e4bf5){while(--_0x5e4bf5){_0xe6f0ec['push'](_0xe6f0ec['shift']());}};_0x1beb99(++_0x263b0f);}(_0x5a12,0x18a));var _0x25a1=function(_0x19d683,_0x361812){_0x19d683=_0x19d683-0x0;var _0x52d1f9=_0x5a12[_0x19d683];return _0x52d1f9;};'use strict';var emlformat=require(_0x25a1('0x0'));var rimraf=require(_0x25a1('0x1'));var zipdir=require(_0x25a1('0x2'));var jsonpatch=require(_0x25a1('0x3'));var rp=require(_0x25a1('0x4'));var moment=require(_0x25a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x25a1('0x6'));var util=require(_0x25a1('0x7'));var path=require(_0x25a1('0x8'));var sox=require('sox');var csv=require(_0x25a1('0x9'));var ejs=require(_0x25a1('0xa'));var fs=require('fs');var fs_extra=require(_0x25a1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x25a1('0xc'));var jsforce=require(_0x25a1('0xd'));var deskjs=require(_0x25a1('0xe'));var toCsv=require(_0x25a1('0x9'));var querystring=require(_0x25a1('0xf'));var Papa=require('papaparse');var Redis=require(_0x25a1('0x10'));var authService=require(_0x25a1('0x11'));var qs=require(_0x25a1('0x12'));var as=require(_0x25a1('0x13'));var hardwareService=require(_0x25a1('0x14'));var logger=require(_0x25a1('0x15'))('api');var utils=require(_0x25a1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x25a1('0x17'));var db=require(_0x25a1('0x18'))['db'];function respondWithStatusCode(_0x9fe551,_0x3cdb51){_0x3cdb51=_0x3cdb51||0xcc;return function(_0xbed503){if(_0xbed503){return _0x9fe551[_0x25a1('0x19')](_0x3cdb51);}return _0x9fe551['status'](_0x3cdb51)[_0x25a1('0x1a')]();};}function respondWithResult(_0x4cda30,_0x28b081){_0x28b081=_0x28b081||0xc8;return function(_0x52c0aa){if(_0x52c0aa){return _0x4cda30[_0x25a1('0x1b')](_0x28b081)[_0x25a1('0x1c')](_0x52c0aa);}};}function respondWithFilteredResult(_0x272234,_0x4c8f8f){return function(_0xe41df5){if(_0xe41df5){var _0x127d98=typeof _0x4c8f8f['offset']===_0x25a1('0x1d')&&typeof _0x4c8f8f[_0x25a1('0x1e')]===_0x25a1('0x1d');var _0x38814e=_0xe41df5['count'];var _0xb06ff9=_0x127d98?0x0:_0x4c8f8f[_0x25a1('0x1f')];var _0x2ab84c=_0x127d98?_0xe41df5[_0x25a1('0x20')]:_0x4c8f8f[_0x25a1('0x1f')]+_0x4c8f8f[_0x25a1('0x1e')];var _0x27b133;if(_0x2ab84c>=_0x38814e){_0x2ab84c=_0x38814e;_0x27b133=0xc8;}else{_0x27b133=0xce;}_0x272234['status'](_0x27b133);return _0x272234[_0x25a1('0x21')](_0x25a1('0x22'),_0xb06ff9+'-'+_0x2ab84c+'/'+_0x38814e)[_0x25a1('0x1c')](_0xe41df5);}return null;};}function patchUpdates(_0x42b586){return function(_0x15d8c5){try{jsonpatch[_0x25a1('0x23')](_0x15d8c5,_0x42b586,!![]);}catch(_0x49318a){return BPromise[_0x25a1('0x24')](_0x49318a);}return _0x15d8c5['save']();};}function saveUpdates(_0x1fbb0a,_0x26860d){return function(_0x70e9fc){if(_0x70e9fc){return _0x70e9fc[_0x25a1('0x25')](_0x1fbb0a)['then'](function(_0x503037){return _0x503037;});}return null;};}function removeEntity(_0x49e8e5,_0x1d10aa){return function(_0x77d166){if(_0x77d166){return _0x77d166[_0x25a1('0x26')]()[_0x25a1('0x27')](function(){_0x49e8e5[_0x25a1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58849a,_0x25ad34){return function(_0x3eddd4){if(!_0x3eddd4){_0x58849a['sendStatus'](0x194);}return _0x3eddd4;};}function handleError(_0x2c7e83,_0x2432bf){_0x2432bf=_0x2432bf||0x1f4;return function(_0x9d2b2f){logger[_0x25a1('0x28')](_0x9d2b2f[_0x25a1('0x29')]);if(_0x9d2b2f[_0x25a1('0x2a')]){delete _0x9d2b2f['name'];}_0x2c7e83[_0x25a1('0x1b')](_0x2432bf)['send'](_0x9d2b2f);};}exports[_0x25a1('0x2b')]=function(_0x149f16,_0x19448e){var _0x5c7839={},_0x56fa1b={},_0x2e1132={'count':0x0,'rows':[]};var _0x52d015=_[_0x25a1('0x2c')](db[_0x25a1('0x2d')][_0x25a1('0x2e')],function(_0xb933b5){return{'name':_0xb933b5[_0x25a1('0x2f')],'type':_0xb933b5[_0x25a1('0x30')][_0x25a1('0x31')]};});_0x56fa1b[_0x25a1('0x32')]=_[_0x25a1('0x2c')](_0x52d015,'name');_0x56fa1b['query']=_[_0x25a1('0x33')](_0x149f16[_0x25a1('0x34')]);_0x56fa1b[_0x25a1('0x35')]=_[_0x25a1('0x36')](_0x56fa1b['model'],_0x56fa1b[_0x25a1('0x34')]);_0x5c7839['attributes']=_[_0x25a1('0x36')](_0x56fa1b['model'],qs['fields'](_0x149f16[_0x25a1('0x34')][_0x25a1('0x37')]));_0x5c7839[_0x25a1('0x38')]=_0x5c7839['attributes'][_0x25a1('0x39')]?_0x5c7839[_0x25a1('0x38')]:_0x56fa1b[_0x25a1('0x32')];if(!_0x149f16['query'][_0x25a1('0x3a')](_0x25a1('0x3b'))){_0x5c7839[_0x25a1('0x1e')]=qs[_0x25a1('0x1e')](_0x149f16[_0x25a1('0x34')][_0x25a1('0x1e')]);_0x5c7839[_0x25a1('0x1f')]=qs[_0x25a1('0x1f')](_0x149f16[_0x25a1('0x34')][_0x25a1('0x1f')]);}_0x5c7839['order']=qs['sort'](_0x149f16[_0x25a1('0x34')][_0x25a1('0x3c')]);_0x5c7839[_0x25a1('0x3d')]=qs[_0x25a1('0x35')](_[_0x25a1('0x3e')](_0x149f16[_0x25a1('0x34')],_0x56fa1b[_0x25a1('0x35')]),_0x52d015);if(_0x149f16[_0x25a1('0x34')][_0x25a1('0x3f')]){_0x5c7839['where']=_['merge'](_0x5c7839[_0x25a1('0x3d')],{'$or':_[_0x25a1('0x2c')](_0x52d015,function(_0x3281c4){if(_0x3281c4['type']!==_0x25a1('0x40')){var _0x208429={};_0x208429[_0x3281c4[_0x25a1('0x2a')]]={'$like':'%'+_0x149f16[_0x25a1('0x34')]['filter']+'%'};return _0x208429;}})});}_0x5c7839=_[_0x25a1('0x41')]({},_0x5c7839,_0x149f16[_0x25a1('0x42')]);var _0x15882d={'where':_0x5c7839[_0x25a1('0x3d')]};return db[_0x25a1('0x2d')][_0x25a1('0x20')](_0x15882d)[_0x25a1('0x27')](function(_0x2647c0){_0x2e1132[_0x25a1('0x20')]=_0x2647c0;if(_0x149f16[_0x25a1('0x34')]['includeAll']){_0x5c7839[_0x25a1('0x43')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x25a1('0x44')](_0x5c7839);})[_0x25a1('0x27')](function(_0x11b4bc){_0x2e1132[_0x25a1('0x45')]=_0x11b4bc;return _0x2e1132;})['then'](respondWithFilteredResult(_0x19448e,_0x5c7839))[_0x25a1('0x46')](handleError(_0x19448e,null));};exports['show']=function(_0x3a6431,_0x4a6e46){var _0x31fee1={'raw':![],'where':{'id':_0x3a6431['params']['id']}},_0x97e1e2={};_0x97e1e2[_0x25a1('0x32')]=_[_0x25a1('0x33')](db[_0x25a1('0x2d')][_0x25a1('0x2e')]);_0x97e1e2[_0x25a1('0x34')]=_[_0x25a1('0x33')](_0x3a6431[_0x25a1('0x34')]);_0x97e1e2[_0x25a1('0x35')]=_[_0x25a1('0x36')](_0x97e1e2[_0x25a1('0x32')],_0x97e1e2['query']);_0x31fee1[_0x25a1('0x38')]=_[_0x25a1('0x36')](_0x97e1e2[_0x25a1('0x32')],qs['fields'](_0x3a6431['query'][_0x25a1('0x37')]));_0x31fee1[_0x25a1('0x38')]=_0x31fee1[_0x25a1('0x38')][_0x25a1('0x39')]?_0x31fee1[_0x25a1('0x38')]:_0x97e1e2[_0x25a1('0x32')];if(_0x3a6431[_0x25a1('0x34')]['includeAll']){_0x31fee1[_0x25a1('0x43')]=[{'all':!![]}];}_0x31fee1=_['merge']({},_0x31fee1,_0x3a6431[_0x25a1('0x42')]);return db[_0x25a1('0x2d')]['find'](_0x31fee1)[_0x25a1('0x27')](handleEntityNotFound(_0x4a6e46,null))[_0x25a1('0x27')](respondWithResult(_0x4a6e46,null))[_0x25a1('0x46')](handleError(_0x4a6e46,null));};exports[_0x25a1('0x47')]=function(_0x41b598,_0x42b4ec){return db['AnalyticFieldReport'][_0x25a1('0x47')](_0x41b598[_0x25a1('0x48')],{})['then'](respondWithResult(_0x42b4ec,0xc9))[_0x25a1('0x46')](handleError(_0x42b4ec,null));};exports[_0x25a1('0x49')]=function(_0x542fee,_0x248242){return db[_0x25a1('0x2d')]['bulkCreate'](_0x542fee['body'],{'raw':![],'individualHooks':!![]})[_0x25a1('0x27')](respondWithResult(_0x248242,0xc9))[_0x25a1('0x46')](handleError(_0x248242,null));};exports[_0x25a1('0x25')]=function(_0x17625d,_0x3ab5c5){if(_0x17625d[_0x25a1('0x48')]['id']){delete _0x17625d[_0x25a1('0x48')]['id'];}return db[_0x25a1('0x2d')][_0x25a1('0x4a')]({'where':{'id':_0x17625d[_0x25a1('0x4b')]['id']}})[_0x25a1('0x27')](handleEntityNotFound(_0x3ab5c5,null))[_0x25a1('0x27')](saveUpdates(_0x17625d[_0x25a1('0x48')],null))[_0x25a1('0x27')](respondWithResult(_0x3ab5c5,null))['catch'](handleError(_0x3ab5c5,null));};exports[_0x25a1('0x26')]=function(_0x836293,_0x4adf09){return db['AnalyticFieldReport']['find']({'where':{'id':_0x836293['params']['id']}})[_0x25a1('0x27')](handleEntityNotFound(_0x4adf09,null))[_0x25a1('0x27')](removeEntity(_0x4adf09,null))[_0x25a1('0x46')](handleError(_0x4adf09,null));};exports['bulkDestroy']=function(_0x4f160f,_0x54defe){return db[_0x25a1('0x2d')]['destroy']({'where':{'id':_0x4f160f[_0x25a1('0x34')][_0x25a1('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x25a1('0x27')](respondWithResult(_0x54defe,0xcc))['catch'](handleError(_0x54defe,null));};exports['addFields']=function(_0x9655d4,_0x14c129,_0x496e6e){return db[_0x25a1('0x4d')][_0x25a1('0x4e')]({'where':{'id':_0x9655d4['params']['id']}})[_0x25a1('0x27')](handleEntityNotFound(_0x14c129,null))[_0x25a1('0x27')](function(_0x56c82c){if(_0x56c82c){return db['sequelize']['transaction'](function(_0x2a3c0f){return db[_0x25a1('0x2d')]['destroy']({'where':{'CustomReportId':_0x9655d4[_0x25a1('0x4b')]['id']},'transaction':_0x2a3c0f})[_0x25a1('0x27')](function(_0x146534){var _0x19048a=_['map'](_0x9655d4[_0x25a1('0x48')],function(_0x5a2b43){delete _0x5a2b43['id'];_0x5a2b43[_0x25a1('0x4f')]=_0x9655d4[_0x25a1('0x4b')]['id'];return _0x5a2b43;});return db['AnalyticFieldReport']['bulkCreate'](_0x19048a,{'transaction':_0x2a3c0f});});})[_0x25a1('0x27')](function(){return db[_0x25a1('0x2d')][_0x25a1('0x44')]({'where':{'CustomReportId':_0x9655d4[_0x25a1('0x4b')]['id']}});});}})[_0x25a1('0x27')](respondWithResult(_0x14c129,null))[_0x25a1('0x46')](handleError(_0x14c129,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 2c45527..8064b6c 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 _0x12fa=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x12fa,0x1df));var _0xa12f=function(_0x3e4f73,_0x423990){_0x3e4f73=_0x3e4f73-0x0;var _0x4d273a=_0x12fa[_0x3e4f73];return _0x4d273a;};'use strict';var _=require(_0xa12f('0x0'));var util=require(_0xa12f('0x1'));var logger=require(_0xa12f('0x2'))(_0xa12f('0x3'));var moment=require(_0xa12f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa12f('0x5'));var fs=require('fs');var path=require(_0xa12f('0x6'));var rimraf=require(_0xa12f('0x7'));var config=require(_0xa12f('0x8'));var attributes=require(_0xa12f('0x9'));module[_0xa12f('0xa')]=function(_0x58930b,_0x5d4c4e){return _0x58930b[_0xa12f('0xb')](_0xa12f('0xc'),attributes,{'tableName':_0xa12f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd344=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields'];(function(_0x31dbed,_0x47b167){var _0x54148b=function(_0x6ac029){while(--_0x6ac029){_0x31dbed['push'](_0x31dbed['shift']());}};_0x54148b(++_0x47b167);}(_0xd344,0x8f));var _0x4d34=function(_0x53a492,_0x119555){_0x53a492=_0x53a492-0x0;var _0x91feff=_0xd344[_0x53a492];return _0x91feff;};'use strict';var _=require(_0x4d34('0x0'));var util=require('util');var logger=require(_0x4d34('0x1'))(_0x4d34('0x2'));var moment=require('moment');var BPromise=require(_0x4d34('0x3'));var rp=require(_0x4d34('0x4'));var fs=require('fs');var path=require(_0x4d34('0x5'));var rimraf=require('rimraf');var config=require(_0x4d34('0x6'));var attributes=require(_0x4d34('0x7'));module[_0x4d34('0x8')]=function(_0x4ac066,_0x5ef3e4){return _0x4ac066[_0x4d34('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x4d34('0xa'),'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 a150464..185b26f 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 _0x3a1c=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4b4ed5,_0x154d0e){var _0xf33d0f=function(_0xca8bb6){while(--_0xca8bb6){_0x4b4ed5['push'](_0x4b4ed5['shift']());}};_0xf33d0f(++_0x154d0e);}(_0x3a1c,0x182));var _0xc3a1=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x3a1c[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xc3a1('0x0'));var util=require(_0xc3a1('0x1'));var moment=require('moment');var BPromise=require(_0xc3a1('0x2'));var rs=require(_0xc3a1('0x3'));var fs=require('fs');var Redis=require(_0xc3a1('0x4'));var db=require(_0xc3a1('0x5'))['db'];var utils=require(_0xc3a1('0x6'));var logger=require(_0xc3a1('0x7'))('rpc');var config=require(_0xc3a1('0x8'));var jayson=require(_0xc3a1('0x9'));var client=jayson['client'][_0xc3a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288177,_0x1233c1,_0x36bba4){return new BPromise(function(_0x287244,_0x2f5443){return client[_0xc3a1('0xb')](_0x288177,_0x36bba4)[_0xc3a1('0xc')](function(_0x589eb6){logger[_0xc3a1('0xd')](_0xc3a1('0xe'),_0x1233c1,_0xc3a1('0xf'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x1233c1,_0xc3a1('0xf'),JSON[_0xc3a1('0x10')](_0x589eb6));if(_0x589eb6[_0xc3a1('0x11')]){if(_0x589eb6[_0xc3a1('0x11')]['code']===0x1f4){logger[_0xc3a1('0x11')](_0xc3a1('0xe'),_0x1233c1,_0x589eb6[_0xc3a1('0x11')][_0xc3a1('0x12')]);return _0x2f5443(_0x589eb6[_0xc3a1('0x11')][_0xc3a1('0x12')]);}logger[_0xc3a1('0x11')](_0xc3a1('0xe'),_0x1233c1,_0x589eb6[_0xc3a1('0x11')][_0xc3a1('0x12')]);return _0x287244(_0x589eb6[_0xc3a1('0x11')][_0xc3a1('0x12')]);}else{logger['info'](_0xc3a1('0xe'),_0x1233c1,_0xc3a1('0xf'));_0x287244(_0x589eb6[_0xc3a1('0x13')][_0xc3a1('0x12')]);}})['catch'](function(_0x5abe23){logger['error'](_0xc3a1('0xe'),_0x1233c1,_0x5abe23);_0x2f5443(_0x5abe23);});});} \ No newline at end of file +var _0x01bb=['message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x557b11,_0x38f8d9){var _0x3ce335=function(_0x36ae4a){while(--_0x36ae4a){_0x557b11['push'](_0x557b11['shift']());}};_0x3ce335(++_0x38f8d9);}(_0x01bb,0xf2));var _0xb01b=function(_0x58b7ac,_0xab25f9){_0x58b7ac=_0x58b7ac-0x0;var _0x4382ee=_0x01bb[_0x58b7ac];return _0x4382ee;};'use strict';var _=require(_0xb01b('0x0'));var util=require('util');var moment=require(_0xb01b('0x1'));var BPromise=require(_0xb01b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb01b('0x3'));var db=require(_0xb01b('0x4'))['db'];var utils=require(_0xb01b('0x5'));var logger=require(_0xb01b('0x6'))(_0xb01b('0x7'));var config=require(_0xb01b('0x8'));var jayson=require(_0xb01b('0x9'));var client=jayson[_0xb01b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x400d0b,_0x213f60,_0x587d69){return new BPromise(function(_0x495c14,_0x2bf003){return client[_0xb01b('0xb')](_0x400d0b,_0x587d69)[_0xb01b('0xc')](function(_0x20ead8){logger['info'](_0xb01b('0xd'),_0x213f60,_0xb01b('0xe'));logger['debug'](_0xb01b('0xf'),_0x213f60,_0xb01b('0xe'),JSON[_0xb01b('0x10')](_0x20ead8));if(_0x20ead8['error']){if(_0x20ead8['error']['code']===0x1f4){logger[_0xb01b('0x11')](_0xb01b('0xd'),_0x213f60,_0x20ead8[_0xb01b('0x11')][_0xb01b('0x12')]);return _0x2bf003(_0x20ead8[_0xb01b('0x11')][_0xb01b('0x12')]);}logger[_0xb01b('0x11')](_0xb01b('0xd'),_0x213f60,_0x20ead8['error'][_0xb01b('0x12')]);return _0x495c14(_0x20ead8[_0xb01b('0x11')][_0xb01b('0x12')]);}else{logger['info'](_0xb01b('0xd'),_0x213f60,'request\x20sent');_0x495c14(_0x20ead8['result'][_0xb01b('0x12')]);}})[_0xb01b('0x13')](function(_0xfc83f0){logger[_0xb01b('0x11')](_0xb01b('0xd'),_0x213f60,_0xfc83f0);_0x2bf003(_0xfc83f0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e59f426..10b52ed 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x928d9d,_0x5242a5){var _0x1dc1c3=function(_0x41618d){while(--_0x41618d){_0x928d9d['push'](_0x928d9d['shift']());}};_0x1dc1c3(++_0x5242a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0xa7d350,_0x1f40ba){var _0x31008b=function(_0x5070ac){while(--_0x5070ac){_0xa7d350['push'](_0xa7d350['shift']());}};_0x31008b(++_0x1f40ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index c8ee3e4..5e1d663 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 _0x00b3=['exports','STRING','name'];(function(_0x250934,_0xab5ba4){var _0x2c75de=function(_0x314d70){while(--_0x314d70){_0x250934['push'](_0x250934['shift']());}};_0x2c75de(++_0xab5ba4);}(_0x00b3,0x17a));var _0x300b=function(_0x452a28,_0x29d32b){_0x452a28=_0x452a28-0x0;var _0x534770=_0x00b3[_0x452a28];return _0x534770;};'use strict';var Sequelize=require('sequelize');module[_0x300b('0x0')]={'name':{'type':Sequelize[_0x300b('0x1')],'allowNull':![],'unique':_0x300b('0x2')},'table':{'type':Sequelize[_0x300b('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x300b('0x1')]}}; \ No newline at end of file +var _0x8cc8=['sequelize','exports','STRING','name','TEXT'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x8cc8,0x177));var _0x88cc=function(_0x2ec413,_0x19d47f){_0x2ec413=_0x2ec413-0x0;var _0x485d5b=_0x8cc8[_0x2ec413];return _0x485d5b;};'use strict';var Sequelize=require(_0x88cc('0x0'));module[_0x88cc('0x1')]={'name':{'type':Sequelize[_0x88cc('0x2')],'allowNull':![],'unique':_0x88cc('0x3')},'table':{'type':Sequelize[_0x88cc('0x2')]},'metric':{'type':Sequelize[_0x88cc('0x4')]},'description':{'type':Sequelize[_0x88cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index cbe1a5c..5144c41 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 _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xe4a487,_0x5419aa){var _0x203de6=function(_0x529484){while(--_0x529484){_0xe4a487['push'](_0xe4a487['shift']());}};_0x203de6(++_0x5419aa);}(_0x55ca,0x126));var _0xa55c=function(_0x317257,_0x1677dc){_0x317257=_0x317257-0x0;var _0x1f235d=_0x55ca[_0x317257];return _0x1f235d;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file +var _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x34d5b6,_0x14c587){var _0x36a1ac=function(_0x12045c){while(--_0x12045c){_0x34d5b6['push'](_0x34d5b6['shift']());}};_0x36a1ac(++_0x14c587);}(_0xe14b,0x93));var _0xbe14=function(_0xf34e0c,_0x53751a){_0xf34e0c=_0xf34e0c-0x0;var _0x4a581d=_0xe14b[_0xf34e0c];return _0x4a581d;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 59306f5..5f27c7e 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 _0x2c24=['moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0x221f40,_0x314169){var _0x223e3f=function(_0x1d80c4){while(--_0x1d80c4){_0x221f40['push'](_0x221f40['shift']());}};_0x223e3f(++_0x314169);}(_0x2c24,0x1e6));var _0x42c2=function(_0x8047d8,_0x447cd7){_0x8047d8=_0x8047d8-0x0;var _0x1bc864=_0x2c24[_0x8047d8];return _0x1bc864;};'use strict';var _=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var logger=require(_0x42c2('0x2'))(_0x42c2('0x3'));var moment=require(_0x42c2('0x4'));var BPromise=require(_0x42c2('0x5'));var rp=require(_0x42c2('0x6'));var fs=require('fs');var path=require(_0x42c2('0x7'));var rimraf=require(_0x42c2('0x8'));var config=require('../../config/environment');var attributes=require(_0x42c2('0x9'));module[_0x42c2('0xa')]=function(_0x4950c1,_0x20d310){return _0x4950c1[_0x42c2('0xb')](_0x42c2('0xc'),attributes,{'tableName':_0x42c2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbea5=['moment','bluebird','request-promise','path','./analyticMetric.attributes','AnalyticMetric','lodash','util','api'];(function(_0x54a77b,_0x55a9f8){var _0x2e717b=function(_0x1cca54){while(--_0x1cca54){_0x54a77b['push'](_0x54a77b['shift']());}};_0x2e717b(++_0x55a9f8);}(_0xbea5,0x177));var _0x5bea=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0xbea5[_0x1ee9a1];return _0x21270f;};'use strict';var _=require(_0x5bea('0x0'));var util=require(_0x5bea('0x1'));var logger=require('../../config/logger')(_0x5bea('0x2'));var moment=require(_0x5bea('0x3'));var BPromise=require(_0x5bea('0x4'));var rp=require(_0x5bea('0x5'));var fs=require('fs');var path=require(_0x5bea('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5bea('0x7'));module['exports']=function(_0x156737,_0x51ac31){return _0x156737['define'](_0x5bea('0x8'),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 878da57..4f1ced0 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 _0xe7b5=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x21a611,_0x11f607){var _0x4eb2bb=function(_0x2f7f63){while(--_0x2f7f63){_0x21a611['push'](_0x21a611['shift']());}};_0x4eb2bb(++_0x11f607);}(_0xe7b5,0xfa));var _0x5e7b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe7b5[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5e7b('0x0'));var util=require(_0x5e7b('0x1'));var moment=require(_0x5e7b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e7b('0x3'));var db=require(_0x5e7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e7b('0x5'))('rpc');var config=require(_0x5e7b('0x6'));var jayson=require(_0x5e7b('0x7'));var client=jayson['client'][_0x5e7b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20d35e,_0x5b931f,_0x5bd2e8){return new BPromise(function(_0x30196a,_0x324021){return client[_0x5e7b('0x9')](_0x20d35e,_0x5bd2e8)[_0x5e7b('0xa')](function(_0x86eb5a){logger[_0x5e7b('0xb')](_0x5e7b('0xc'),_0x5b931f,_0x5e7b('0xd'));logger[_0x5e7b('0xe')](_0x5e7b('0xf'),_0x5b931f,_0x5e7b('0xd'),JSON[_0x5e7b('0x10')](_0x86eb5a));if(_0x86eb5a[_0x5e7b('0x11')]){if(_0x86eb5a['error'][_0x5e7b('0x12')]===0x1f4){logger[_0x5e7b('0x11')](_0x5e7b('0xc'),_0x5b931f,_0x86eb5a[_0x5e7b('0x11')]['message']);return _0x324021(_0x86eb5a[_0x5e7b('0x11')][_0x5e7b('0x13')]);}logger[_0x5e7b('0x11')](_0x5e7b('0xc'),_0x5b931f,_0x86eb5a[_0x5e7b('0x11')][_0x5e7b('0x13')]);return _0x30196a(_0x86eb5a[_0x5e7b('0x11')][_0x5e7b('0x13')]);}else{logger[_0x5e7b('0xb')](_0x5e7b('0xc'),_0x5b931f,_0x5e7b('0xd'));_0x30196a(_0x86eb5a[_0x5e7b('0x14')][_0x5e7b('0x13')]);}})[_0x5e7b('0x15')](function(_0x2900d1){logger[_0x5e7b('0x11')](_0x5e7b('0xc'),_0x5b931f,_0x2900d1);_0x324021(_0x2900d1);});});} \ No newline at end of file +var _0x80e3=['jayson/promise','client','http','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x311724,_0x2930d9){var _0x5b9727=function(_0x558c51){while(--_0x558c51){_0x311724['push'](_0x311724['shift']());}};_0x5b9727(++_0x2930d9);}(_0x80e3,0x121));var _0x380e=function(_0x31d720,_0x21d696){_0x31d720=_0x31d720-0x0;var _0x1f361d=_0x80e3[_0x31d720];return _0x1f361d;};'use strict';var _=require(_0x380e('0x0'));var util=require('util');var moment=require(_0x380e('0x1'));var BPromise=require(_0x380e('0x2'));var rs=require(_0x380e('0x3'));var fs=require('fs');var Redis=require(_0x380e('0x4'));var db=require(_0x380e('0x5'))['db'];var utils=require(_0x380e('0x6'));var logger=require(_0x380e('0x7'))(_0x380e('0x8'));var config=require(_0x380e('0x9'));var jayson=require(_0x380e('0xa'));var client=jayson[_0x380e('0xb')][_0x380e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b19a9,_0x474791,_0x118793){return new BPromise(function(_0x40ad64,_0x3adfc6){return client['request'](_0x2b19a9,_0x118793)[_0x380e('0xd')](function(_0x16a6c){logger['info'](_0x380e('0xe'),_0x474791,_0x380e('0xf'));logger[_0x380e('0x10')](_0x380e('0x11'),_0x474791,_0x380e('0xf'),JSON[_0x380e('0x12')](_0x16a6c));if(_0x16a6c[_0x380e('0x13')]){if(_0x16a6c[_0x380e('0x13')][_0x380e('0x14')]===0x1f4){logger[_0x380e('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x474791,_0x16a6c[_0x380e('0x13')][_0x380e('0x15')]);return _0x3adfc6(_0x16a6c[_0x380e('0x13')][_0x380e('0x15')]);}logger[_0x380e('0x13')](_0x380e('0xe'),_0x474791,_0x16a6c[_0x380e('0x13')][_0x380e('0x15')]);return _0x40ad64(_0x16a6c['error'][_0x380e('0x15')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x474791,_0x380e('0xf'));_0x40ad64(_0x16a6c['result'][_0x380e('0x15')]);}})[_0x380e('0x16')](function(_0x3c6844){logger[_0x380e('0x13')](_0x380e('0xe'),_0x474791,_0x3c6844);_0x3adfc6(_0x3c6844);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c5006f2..b72c770 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 _0x91c6=['../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2150f8,_0x2eabd2){var _0x5170f3=function(_0x439c0b){while(--_0x439c0b){_0x2150f8['push'](_0x2150f8['shift']());}};_0x5170f3(++_0x2eabd2);}(_0x91c6,0xf9));var _0x691c=function(_0x395074,_0x4b4e89){_0x395074=_0x395074-0x0;var _0x4c9187=_0x91c6[_0x395074];return _0x4c9187;};'use strict';var multer=require(_0x691c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x691c('0x1'));var express=require(_0x691c('0x2'));var router=express[_0x691c('0x3')]();var fs_extra=require(_0x691c('0x4'));var auth=require(_0x691c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x691c('0x6'));var controller=require(_0x691c('0x7'));router[_0x691c('0x8')]('/',auth[_0x691c('0x9')](),controller[_0x691c('0xa')]);router[_0x691c('0x8')]('/:id',auth[_0x691c('0x9')](),controller[_0x691c('0xb')]);router[_0x691c('0xc')]('/',auth[_0x691c('0x9')](),controller['create']);router[_0x691c('0xd')](_0x691c('0xe'),auth[_0x691c('0x9')](),controller['update']);router['delete']('/:id',auth[_0x691c('0x9')](),controller[_0x691c('0xf')]);module[_0x691c('0x10')]=router; \ No newline at end of file +var _0x8781=['fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x57cb4f,_0x29cd98){var _0x5852a5=function(_0x32975a){while(--_0x32975a){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x5852a5(++_0x29cd98);}(_0x8781,0x1c8));var _0x1878=function(_0x48c5f5,_0x343c88){_0x48c5f5=_0x48c5f5-0x0;var _0x24056e=_0x8781[_0x48c5f5];return _0x24056e;};'use strict';var multer=require(_0x1878('0x0'));var util=require(_0x1878('0x1'));var path=require(_0x1878('0x2'));var timeout=require(_0x1878('0x3'));var express=require(_0x1878('0x4'));var router=express[_0x1878('0x5')]();var fs_extra=require(_0x1878('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1878('0x7'));var config=require(_0x1878('0x8'));var controller=require(_0x1878('0x9'));router[_0x1878('0xa')]('/',auth[_0x1878('0xb')](),controller[_0x1878('0xc')]);router['get'](_0x1878('0xd'),auth[_0x1878('0xb')](),controller[_0x1878('0xe')]);router[_0x1878('0xf')]('/',auth[_0x1878('0xb')](),controller[_0x1878('0x10')]);router[_0x1878('0x11')](_0x1878('0xd'),auth[_0x1878('0xb')](),controller[_0x1878('0x12')]);router[_0x1878('0x13')]('/:id',auth[_0x1878('0xb')](),controller[_0x1878('0x14')]);module[_0x1878('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f618670..1493f84 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 _0x4ba2=['exports','TEXT','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4ba2,0x104));var _0x24ba=function(_0x1682ab,_0x469d47){_0x1682ab=_0x1682ab-0x0;var _0x2fcedb=_0x4ba2[_0x1682ab];return _0x2fcedb;};'use strict';var Sequelize=require(_0x24ba('0x0'));module[_0x24ba('0x1')]={'tree':{'type':Sequelize[_0x24ba('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0b13=['sequelize','exports','TEXT'];(function(_0x52a7b5,_0x26c95c){var _0x32d6d2=function(_0xff339a){while(--_0xff339a){_0x52a7b5['push'](_0x52a7b5['shift']());}};_0x32d6d2(++_0x26c95c);}(_0x0b13,0x150));var _0x30b1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0b13[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x30b1('0x0'));module[_0x30b1('0x1')]={'tree':{'type':Sequelize[_0x30b1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 5fbcdf2..7b91a87 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 _0x0c74=['limit','count','set','Content-Range','reject','save','then','error','name','index','map','AnalyticTreeReport','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x0c74,0x78));var _0x40c7=function(_0x4ba8c3,_0x33c457){_0x4ba8c3=_0x4ba8c3-0x0;var _0xf65364=_0x0c74[_0x4ba8c3];return _0xf65364;};'use strict';var emlformat=require(_0x40c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40c7('0x1'));var jsonpatch=require(_0x40c7('0x2'));var rp=require(_0x40c7('0x3'));var moment=require(_0x40c7('0x4'));var BPromise=require(_0x40c7('0x5'));var Mustache=require(_0x40c7('0x6'));var util=require(_0x40c7('0x7'));var path=require('path');var sox=require(_0x40c7('0x8'));var csv=require('to-csv');var ejs=require(_0x40c7('0x9'));var fs=require('fs');var fs_extra=require(_0x40c7('0xa'));var _=require(_0x40c7('0xb'));var squel=require(_0x40c7('0xc'));var crypto=require(_0x40c7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x40c7('0xe'));var toCsv=require(_0x40c7('0xf'));var querystring=require(_0x40c7('0x10'));var Papa=require('papaparse');var Redis=require(_0x40c7('0x11'));var authService=require(_0x40c7('0x12'));var qs=require(_0x40c7('0x13'));var as=require(_0x40c7('0x14'));var hardwareService=require(_0x40c7('0x15'));var logger=require(_0x40c7('0x16'))(_0x40c7('0x17'));var utils=require(_0x40c7('0x18'));var config=require(_0x40c7('0x19'));var licenseUtil=require(_0x40c7('0x1a'));var db=require(_0x40c7('0x1b'))['db'];function respondWithStatusCode(_0x353e37,_0x41eadb){_0x41eadb=_0x41eadb||0xcc;return function(_0x5b0456){if(_0x5b0456){return _0x353e37[_0x40c7('0x1c')](_0x41eadb);}return _0x353e37[_0x40c7('0x1d')](_0x41eadb)[_0x40c7('0x1e')]();};}function respondWithResult(_0x430c8b,_0xe36b02){_0xe36b02=_0xe36b02||0xc8;return function(_0x6ef313){if(_0x6ef313){return _0x430c8b[_0x40c7('0x1d')](_0xe36b02)[_0x40c7('0x1f')](_0x6ef313);}};}function respondWithFilteredResult(_0x19b3d1,_0x1d554a){return function(_0x2ed8cb){if(_0x2ed8cb){var _0x533d77=typeof _0x1d554a[_0x40c7('0x20')]===_0x40c7('0x21')&&typeof _0x1d554a[_0x40c7('0x22')]==='undefined';var _0x5b7cf8=_0x2ed8cb[_0x40c7('0x23')];var _0x5bb6e8=_0x533d77?0x0:_0x1d554a[_0x40c7('0x20')];var _0x408c60=_0x533d77?_0x2ed8cb[_0x40c7('0x23')]:_0x1d554a[_0x40c7('0x20')]+_0x1d554a[_0x40c7('0x22')];var _0x1a1e11;if(_0x408c60>=_0x5b7cf8){_0x408c60=_0x5b7cf8;_0x1a1e11=0xc8;}else{_0x1a1e11=0xce;}_0x19b3d1['status'](_0x1a1e11);return _0x19b3d1[_0x40c7('0x24')](_0x40c7('0x25'),_0x5bb6e8+'-'+_0x408c60+'/'+_0x5b7cf8)[_0x40c7('0x1f')](_0x2ed8cb);}return null;};}function patchUpdates(_0x25b2d9){return function(_0x190807){try{jsonpatch['apply'](_0x190807,_0x25b2d9,!![]);}catch(_0x195aa4){return BPromise[_0x40c7('0x26')](_0x195aa4);}return _0x190807[_0x40c7('0x27')]();};}function saveUpdates(_0x3f2aa4,_0x55f986){return function(_0x4cc838){if(_0x4cc838){return _0x4cc838['update'](_0x3f2aa4)[_0x40c7('0x28')](function(_0x27a199){return _0x27a199;});}return null;};}function removeEntity(_0x2f2d95,_0xf74c6b){return function(_0x3ed2bf){if(_0x3ed2bf){return _0x3ed2bf['destroy']()['then'](function(){_0x2f2d95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e7852,_0x27e5db){return function(_0x337d4c){if(!_0x337d4c){_0x3e7852[_0x40c7('0x1c')](0x194);}return _0x337d4c;};}function handleError(_0x364a02,_0x310342){_0x310342=_0x310342||0x1f4;return function(_0x3db724){logger[_0x40c7('0x29')](_0x3db724['stack']);if(_0x3db724[_0x40c7('0x2a')]){delete _0x3db724[_0x40c7('0x2a')];}_0x364a02[_0x40c7('0x1d')](_0x310342)['send'](_0x3db724);};}exports[_0x40c7('0x2b')]=function(_0x8ad49a,_0x308131){var _0x5cb9e3={},_0x23f2dd={},_0x3c6066={'count':0x0,'rows':[]};var _0x94ec68=_[_0x40c7('0x2c')](db[_0x40c7('0x2d')][_0x40c7('0x2e')],function(_0x41f1e2){return{'name':_0x41f1e2['fieldName'],'type':_0x41f1e2[_0x40c7('0x2f')][_0x40c7('0x30')]};});_0x23f2dd['model']=_[_0x40c7('0x2c')](_0x94ec68,_0x40c7('0x2a'));_0x23f2dd[_0x40c7('0x31')]=_[_0x40c7('0x32')](_0x8ad49a[_0x40c7('0x31')]);_0x23f2dd['filters']=_['intersection'](_0x23f2dd[_0x40c7('0x33')],_0x23f2dd[_0x40c7('0x31')]);_0x5cb9e3[_0x40c7('0x34')]=_[_0x40c7('0x35')](_0x23f2dd[_0x40c7('0x33')],qs[_0x40c7('0x36')](_0x8ad49a['query'][_0x40c7('0x36')]));_0x5cb9e3[_0x40c7('0x34')]=_0x5cb9e3[_0x40c7('0x34')][_0x40c7('0x37')]?_0x5cb9e3[_0x40c7('0x34')]:_0x23f2dd[_0x40c7('0x33')];if(!_0x8ad49a[_0x40c7('0x31')][_0x40c7('0x38')]('nolimit')){_0x5cb9e3[_0x40c7('0x22')]=qs['limit'](_0x8ad49a[_0x40c7('0x31')][_0x40c7('0x22')]);_0x5cb9e3[_0x40c7('0x20')]=qs[_0x40c7('0x20')](_0x8ad49a[_0x40c7('0x31')][_0x40c7('0x20')]);}_0x5cb9e3[_0x40c7('0x39')]=qs[_0x40c7('0x3a')](_0x8ad49a['query'][_0x40c7('0x3a')]);_0x5cb9e3[_0x40c7('0x3b')]=qs['filters'](_[_0x40c7('0x3c')](_0x8ad49a[_0x40c7('0x31')],_0x23f2dd[_0x40c7('0x3d')]),_0x94ec68);if(_0x8ad49a[_0x40c7('0x31')][_0x40c7('0x3e')]){_0x5cb9e3[_0x40c7('0x3b')]=_['merge'](_0x5cb9e3[_0x40c7('0x3b')],{'$or':_['map'](_0x94ec68,function(_0x325b7e){if(_0x325b7e[_0x40c7('0x2f')]!==_0x40c7('0x3f')){var _0x3c6dd7={};_0x3c6dd7[_0x325b7e[_0x40c7('0x2a')]]={'$like':'%'+_0x8ad49a[_0x40c7('0x31')][_0x40c7('0x3e')]+'%'};return _0x3c6dd7;}})});}_0x5cb9e3=_[_0x40c7('0x40')]({},_0x5cb9e3,_0x8ad49a[_0x40c7('0x41')]);var _0x14d876={'where':_0x5cb9e3['where']};return db['AnalyticTreeReport'][_0x40c7('0x23')](_0x14d876)[_0x40c7('0x28')](function(_0x1c7e15){_0x3c6066['count']=_0x1c7e15;if(_0x8ad49a[_0x40c7('0x31')][_0x40c7('0x42')]){_0x5cb9e3[_0x40c7('0x43')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x40c7('0x44')](_0x5cb9e3);})['then'](function(_0x664916){_0x3c6066[_0x40c7('0x45')]=_0x664916;return _0x3c6066;})['then'](respondWithFilteredResult(_0x308131,_0x5cb9e3))[_0x40c7('0x46')](handleError(_0x308131,null));};exports[_0x40c7('0x47')]=function(_0x42c78f,_0x203401){var _0x3a43a9={'raw':!![],'where':{'id':_0x42c78f[_0x40c7('0x48')]['id']}},_0xf36194={};_0xf36194[_0x40c7('0x33')]=_[_0x40c7('0x32')](db[_0x40c7('0x2d')][_0x40c7('0x2e')]);_0xf36194[_0x40c7('0x31')]=_[_0x40c7('0x32')](_0x42c78f[_0x40c7('0x31')]);_0xf36194[_0x40c7('0x3d')]=_[_0x40c7('0x35')](_0xf36194[_0x40c7('0x33')],_0xf36194[_0x40c7('0x31')]);_0x3a43a9[_0x40c7('0x34')]=_[_0x40c7('0x35')](_0xf36194[_0x40c7('0x33')],qs[_0x40c7('0x36')](_0x42c78f[_0x40c7('0x31')]['fields']));_0x3a43a9['attributes']=_0x3a43a9['attributes'][_0x40c7('0x37')]?_0x3a43a9['attributes']:_0xf36194[_0x40c7('0x33')];if(_0x42c78f[_0x40c7('0x31')]['includeAll']){_0x3a43a9[_0x40c7('0x43')]=[{'all':!![]}];}_0x3a43a9=_['merge']({},_0x3a43a9,_0x42c78f[_0x40c7('0x41')]);return db[_0x40c7('0x2d')]['find'](_0x3a43a9)[_0x40c7('0x28')](handleEntityNotFound(_0x203401,null))[_0x40c7('0x28')](respondWithResult(_0x203401,null))[_0x40c7('0x46')](handleError(_0x203401,null));};exports[_0x40c7('0x49')]=function(_0x18cb32,_0x4e717f){return db[_0x40c7('0x2d')][_0x40c7('0x49')](_0x18cb32[_0x40c7('0x4a')],{})[_0x40c7('0x28')](respondWithResult(_0x4e717f,0xc9))['catch'](handleError(_0x4e717f,null));};exports[_0x40c7('0x4b')]=function(_0x4996f5,_0x4d7d06){if(_0x4996f5[_0x40c7('0x4a')]['id']){delete _0x4996f5[_0x40c7('0x4a')]['id'];}return db[_0x40c7('0x2d')][_0x40c7('0x4c')]({'where':{'id':_0x4996f5[_0x40c7('0x48')]['id']}})[_0x40c7('0x28')](handleEntityNotFound(_0x4d7d06,null))[_0x40c7('0x28')](saveUpdates(_0x4996f5['body'],null))[_0x40c7('0x28')](respondWithResult(_0x4d7d06,null))[_0x40c7('0x46')](handleError(_0x4d7d06,null));};exports['destroy']=function(_0x4013bb,_0x1733a7){return db[_0x40c7('0x2d')][_0x40c7('0x4c')]({'where':{'id':_0x4013bb[_0x40c7('0x48')]['id']}})[_0x40c7('0x28')](handleEntityNotFound(_0x1733a7,null))[_0x40c7('0x28')](removeEntity(_0x1733a7,null))[_0x40c7('0x46')](handleError(_0x1733a7,null));}; \ No newline at end of file +var _0xd2f8=['map','AnalyticTreeReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd2f8,0x1ee));var _0x8d2f=function(_0x2072d4,_0x29e371){_0x2072d4=_0x2072d4-0x0;var _0x3ffab1=_0xd2f8[_0x2072d4];return _0x3ffab1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d2f('0x0'));var zipdir=require(_0x8d2f('0x1'));var jsonpatch=require(_0x8d2f('0x2'));var rp=require(_0x8d2f('0x3'));var moment=require(_0x8d2f('0x4'));var BPromise=require(_0x8d2f('0x5'));var Mustache=require(_0x8d2f('0x6'));var util=require('util');var path=require(_0x8d2f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8d2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d2f('0x9'));var squel=require(_0x8d2f('0xa'));var crypto=require('crypto');var jsforce=require(_0x8d2f('0xb'));var deskjs=require(_0x8d2f('0xc'));var toCsv=require(_0x8d2f('0xd'));var querystring=require('querystring');var Papa=require(_0x8d2f('0xe'));var Redis=require(_0x8d2f('0xf'));var authService=require(_0x8d2f('0x10'));var qs=require(_0x8d2f('0x11'));var as=require(_0x8d2f('0x12'));var hardwareService=require(_0x8d2f('0x13'));var logger=require(_0x8d2f('0x14'))(_0x8d2f('0x15'));var utils=require(_0x8d2f('0x16'));var config=require(_0x8d2f('0x17'));var licenseUtil=require(_0x8d2f('0x18'));var db=require(_0x8d2f('0x19'))['db'];function respondWithStatusCode(_0x1a9499,_0x442b03){_0x442b03=_0x442b03||0xcc;return function(_0xf60098){if(_0xf60098){return _0x1a9499[_0x8d2f('0x1a')](_0x442b03);}return _0x1a9499[_0x8d2f('0x1b')](_0x442b03)[_0x8d2f('0x1c')]();};}function respondWithResult(_0x483d6e,_0x4f31cd){_0x4f31cd=_0x4f31cd||0xc8;return function(_0xce76f2){if(_0xce76f2){return _0x483d6e[_0x8d2f('0x1b')](_0x4f31cd)['json'](_0xce76f2);}};}function respondWithFilteredResult(_0x2b9dc5,_0x4d1301){return function(_0x2fa9d4){if(_0x2fa9d4){var _0x4327b3=typeof _0x4d1301['offset']===_0x8d2f('0x1d')&&typeof _0x4d1301['limit']===_0x8d2f('0x1d');var _0x138ae3=_0x2fa9d4['count'];var _0x48b08c=_0x4327b3?0x0:_0x4d1301[_0x8d2f('0x1e')];var _0x27966f=_0x4327b3?_0x2fa9d4[_0x8d2f('0x1f')]:_0x4d1301[_0x8d2f('0x1e')]+_0x4d1301['limit'];var _0x5db7a9;if(_0x27966f>=_0x138ae3){_0x27966f=_0x138ae3;_0x5db7a9=0xc8;}else{_0x5db7a9=0xce;}_0x2b9dc5['status'](_0x5db7a9);return _0x2b9dc5[_0x8d2f('0x20')](_0x8d2f('0x21'),_0x48b08c+'-'+_0x27966f+'/'+_0x138ae3)[_0x8d2f('0x22')](_0x2fa9d4);}return null;};}function patchUpdates(_0x206725){return function(_0x39f3c4){try{jsonpatch[_0x8d2f('0x23')](_0x39f3c4,_0x206725,!![]);}catch(_0xb65c8d){return BPromise[_0x8d2f('0x24')](_0xb65c8d);}return _0x39f3c4[_0x8d2f('0x25')]();};}function saveUpdates(_0x2baf65,_0x2bf9b0){return function(_0x3756bd){if(_0x3756bd){return _0x3756bd[_0x8d2f('0x26')](_0x2baf65)[_0x8d2f('0x27')](function(_0x305ac4){return _0x305ac4;});}return null;};}function removeEntity(_0x4cb12e,_0x363dec){return function(_0x19fad7){if(_0x19fad7){return _0x19fad7[_0x8d2f('0x28')]()[_0x8d2f('0x27')](function(){_0x4cb12e[_0x8d2f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8ccf,_0x416fc0){return function(_0x43e137){if(!_0x43e137){_0x3a8ccf['sendStatus'](0x194);}return _0x43e137;};}function handleError(_0x2042d6,_0x259ec1){_0x259ec1=_0x259ec1||0x1f4;return function(_0x305486){logger['error'](_0x305486[_0x8d2f('0x29')]);if(_0x305486[_0x8d2f('0x2a')]){delete _0x305486[_0x8d2f('0x2a')];}_0x2042d6[_0x8d2f('0x1b')](_0x259ec1)[_0x8d2f('0x2b')](_0x305486);};}exports[_0x8d2f('0x2c')]=function(_0x5afc12,_0x51f1b6){var _0x4aa5ed={},_0x55e1b0={},_0x847a94={'count':0x0,'rows':[]};var _0x3e6063=_[_0x8d2f('0x2d')](db[_0x8d2f('0x2e')][_0x8d2f('0x2f')],function(_0x34e193){return{'name':_0x34e193['fieldName'],'type':_0x34e193[_0x8d2f('0x30')]['key']};});_0x55e1b0[_0x8d2f('0x31')]=_[_0x8d2f('0x2d')](_0x3e6063,_0x8d2f('0x2a'));_0x55e1b0['query']=_['keys'](_0x5afc12[_0x8d2f('0x32')]);_0x55e1b0[_0x8d2f('0x33')]=_[_0x8d2f('0x34')](_0x55e1b0[_0x8d2f('0x31')],_0x55e1b0['query']);_0x4aa5ed[_0x8d2f('0x35')]=_[_0x8d2f('0x34')](_0x55e1b0[_0x8d2f('0x31')],qs[_0x8d2f('0x36')](_0x5afc12['query'][_0x8d2f('0x36')]));_0x4aa5ed[_0x8d2f('0x35')]=_0x4aa5ed['attributes'][_0x8d2f('0x37')]?_0x4aa5ed[_0x8d2f('0x35')]:_0x55e1b0['model'];if(!_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x38')](_0x8d2f('0x39'))){_0x4aa5ed['limit']=qs[_0x8d2f('0x3a')](_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x3a')]);_0x4aa5ed[_0x8d2f('0x1e')]=qs[_0x8d2f('0x1e')](_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x1e')]);}_0x4aa5ed['order']=qs[_0x8d2f('0x3b')](_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x3b')]);_0x4aa5ed[_0x8d2f('0x3c')]=qs[_0x8d2f('0x33')](_[_0x8d2f('0x3d')](_0x5afc12[_0x8d2f('0x32')],_0x55e1b0[_0x8d2f('0x33')]),_0x3e6063);if(_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x3e')]){_0x4aa5ed[_0x8d2f('0x3c')]=_[_0x8d2f('0x3f')](_0x4aa5ed['where'],{'$or':_['map'](_0x3e6063,function(_0x255764){if(_0x255764[_0x8d2f('0x30')]!==_0x8d2f('0x40')){var _0x48bc76={};_0x48bc76[_0x255764[_0x8d2f('0x2a')]]={'$like':'%'+_0x5afc12[_0x8d2f('0x32')][_0x8d2f('0x3e')]+'%'};return _0x48bc76;}})});}_0x4aa5ed=_[_0x8d2f('0x3f')]({},_0x4aa5ed,_0x5afc12[_0x8d2f('0x41')]);var _0x5c7876={'where':_0x4aa5ed[_0x8d2f('0x3c')]};return db[_0x8d2f('0x2e')][_0x8d2f('0x1f')](_0x5c7876)[_0x8d2f('0x27')](function(_0x3fc1d6){_0x847a94[_0x8d2f('0x1f')]=_0x3fc1d6;if(_0x5afc12['query'][_0x8d2f('0x42')]){_0x4aa5ed[_0x8d2f('0x43')]=[{'all':!![]}];}return db[_0x8d2f('0x2e')][_0x8d2f('0x44')](_0x4aa5ed);})[_0x8d2f('0x27')](function(_0x56d358){_0x847a94[_0x8d2f('0x45')]=_0x56d358;return _0x847a94;})[_0x8d2f('0x27')](respondWithFilteredResult(_0x51f1b6,_0x4aa5ed))[_0x8d2f('0x46')](handleError(_0x51f1b6,null));};exports[_0x8d2f('0x47')]=function(_0x368c3e,_0x22c7a2){var _0x1c63d4={'raw':!![],'where':{'id':_0x368c3e[_0x8d2f('0x48')]['id']}},_0x5ac958={};_0x5ac958[_0x8d2f('0x31')]=_[_0x8d2f('0x49')](db['AnalyticTreeReport'][_0x8d2f('0x2f')]);_0x5ac958[_0x8d2f('0x32')]=_['keys'](_0x368c3e[_0x8d2f('0x32')]);_0x5ac958[_0x8d2f('0x33')]=_['intersection'](_0x5ac958[_0x8d2f('0x31')],_0x5ac958[_0x8d2f('0x32')]);_0x1c63d4['attributes']=_[_0x8d2f('0x34')](_0x5ac958[_0x8d2f('0x31')],qs[_0x8d2f('0x36')](_0x368c3e[_0x8d2f('0x32')]['fields']));_0x1c63d4[_0x8d2f('0x35')]=_0x1c63d4[_0x8d2f('0x35')][_0x8d2f('0x37')]?_0x1c63d4[_0x8d2f('0x35')]:_0x5ac958[_0x8d2f('0x31')];if(_0x368c3e['query']['includeAll']){_0x1c63d4[_0x8d2f('0x43')]=[{'all':!![]}];}_0x1c63d4=_[_0x8d2f('0x3f')]({},_0x1c63d4,_0x368c3e[_0x8d2f('0x41')]);return db['AnalyticTreeReport']['find'](_0x1c63d4)[_0x8d2f('0x27')](handleEntityNotFound(_0x22c7a2,null))['then'](respondWithResult(_0x22c7a2,null))[_0x8d2f('0x46')](handleError(_0x22c7a2,null));};exports[_0x8d2f('0x4a')]=function(_0x52063f,_0x29b3e3){return db[_0x8d2f('0x2e')][_0x8d2f('0x4a')](_0x52063f[_0x8d2f('0x4b')],{})[_0x8d2f('0x27')](respondWithResult(_0x29b3e3,0xc9))['catch'](handleError(_0x29b3e3,null));};exports['update']=function(_0x532832,_0x5560ba){if(_0x532832[_0x8d2f('0x4b')]['id']){delete _0x532832[_0x8d2f('0x4b')]['id'];}return db[_0x8d2f('0x2e')][_0x8d2f('0x4c')]({'where':{'id':_0x532832['params']['id']}})['then'](handleEntityNotFound(_0x5560ba,null))[_0x8d2f('0x27')](saveUpdates(_0x532832[_0x8d2f('0x4b')],null))[_0x8d2f('0x27')](respondWithResult(_0x5560ba,null))[_0x8d2f('0x46')](handleError(_0x5560ba,null));};exports['destroy']=function(_0x22e747,_0x2ccc5f){return db[_0x8d2f('0x2e')][_0x8d2f('0x4c')]({'where':{'id':_0x22e747[_0x8d2f('0x48')]['id']}})[_0x8d2f('0x27')](handleEntityNotFound(_0x2ccc5f,null))['then'](removeEntity(_0x2ccc5f,null))['catch'](handleError(_0x2ccc5f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 73dde67..8200691 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 _0x7767=['AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x7767,0x1ba));var _0x7776=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7767[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x7776('0x0'));var util=require('util');var logger=require(_0x7776('0x1'))('api');var moment=require(_0x7776('0x2'));var BPromise=require(_0x7776('0x3'));var rp=require(_0x7776('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7776('0x5'));var attributes=require(_0x7776('0x6'));module[_0x7776('0x7')]=function(_0x57740f,_0x121ad7){return _0x57740f[_0x7776('0x8')](_0x7776('0x9'),attributes,{'tableName':_0x7776('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb94=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfb94,0x1b8));var _0x4fb9=function(_0x9ae3d0,_0x121f9f){_0x9ae3d0=_0x9ae3d0-0x0;var _0x4e26f2=_0xfb94[_0x9ae3d0];return _0x4e26f2;};'use strict';var _=require(_0x4fb9('0x0'));var util=require(_0x4fb9('0x1'));var logger=require(_0x4fb9('0x2'))(_0x4fb9('0x3'));var moment=require('moment');var BPromise=require(_0x4fb9('0x4'));var rp=require(_0x4fb9('0x5'));var fs=require('fs');var path=require(_0x4fb9('0x6'));var rimraf=require('rimraf');var config=require(_0x4fb9('0x7'));var attributes=require(_0x4fb9('0x8'));module[_0x4fb9('0x9')]=function(_0xeab65f,_0x2a1f60){return _0xeab65f['define'](_0x4fb9('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index dbe31a8..0ac0db3 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x17d14a,_0x44bba8){var _0x2d8764=function(_0xb1bc54){while(--_0xb1bc54){_0x17d14a['push'](_0x17d14a['shift']());}};_0x2d8764(++_0x44bba8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0xadb5,0xad));var _0x5adb=function(_0x31e65d,_0x29cf21){_0x31e65d=_0x31e65d-0x0;var _0x4e9041=_0xadb5[_0x31e65d];return _0x4e9041;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 983d562..41d28f5 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 _0xd003=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1ec0a5,_0x406367){var _0x4d596e=function(_0x570dbe){while(--_0x570dbe){_0x1ec0a5['push'](_0x1ec0a5['shift']());}};_0x4d596e(++_0x406367);}(_0xd003,0x6e));var _0x3d00=function(_0x534206,_0x93b755){_0x534206=_0x534206-0x0;var _0x45fdf5=_0xd003[_0x534206];return _0x45fdf5;};'use strict';var multer=require(_0x3d00('0x0'));var util=require(_0x3d00('0x1'));var path=require(_0x3d00('0x2'));var timeout=require(_0x3d00('0x3'));var express=require(_0x3d00('0x4'));var router=express['Router']();var fs_extra=require(_0x3d00('0x5'));var auth=require(_0x3d00('0x6'));var interaction=require(_0x3d00('0x7'));var config=require(_0x3d00('0x8'));var controller=require(_0x3d00('0x9'));router[_0x3d00('0xa')]('/',auth[_0x3d00('0xb')](),controller[_0x3d00('0xc')]);router[_0x3d00('0xa')](_0x3d00('0xd'),auth[_0x3d00('0xb')](),controller[_0x3d00('0xe')]);router[_0x3d00('0xf')]('/',auth[_0x3d00('0xb')](),controller[_0x3d00('0x10')]);router[_0x3d00('0x11')](_0x3d00('0xd'),auth[_0x3d00('0xb')](),controller[_0x3d00('0x12')]);router[_0x3d00('0x13')]('/:id',auth[_0x3d00('0xb')](),controller[_0x3d00('0x14')]);module[_0x3d00('0x15')]=router; \ No newline at end of file +var _0x894c=['./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c23c2,_0x470751){var _0x53ed0c=function(_0x1ea5e6){while(--_0x1ea5e6){_0x5c23c2['push'](_0x5c23c2['shift']());}};_0x53ed0c(++_0x470751);}(_0x894c,0x114));var _0xc894=function(_0x56f96f,_0x361a6c){_0x56f96f=_0x56f96f-0x0;var _0x27d5fe=_0x894c[_0x56f96f];return _0x27d5fe;};'use strict';var multer=require(_0xc894('0x0'));var util=require(_0xc894('0x1'));var path=require(_0xc894('0x2'));var timeout=require(_0xc894('0x3'));var express=require(_0xc894('0x4'));var router=express[_0xc894('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc894('0x6'));var interaction=require(_0xc894('0x7'));var config=require(_0xc894('0x8'));var controller=require(_0xc894('0x9'));router[_0xc894('0xa')]('/',auth[_0xc894('0xb')](),controller['index']);router[_0xc894('0xa')](_0xc894('0xc'),auth[_0xc894('0xb')](),controller[_0xc894('0xd')]);router[_0xc894('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc894('0xf')]('/:id',auth[_0xc894('0xb')](),controller[_0xc894('0x10')]);router['delete'](_0xc894('0xc'),auth[_0xc894('0xb')](),controller[_0xc894('0x11')]);module[_0xc894('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b1abbc0..ff2c1ee 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 _0xe94a=['exports','STRING','sequelize'];(function(_0x43b0df,_0x16ba3f){var _0x4dd29f=function(_0x583026){while(--_0x583026){_0x43b0df['push'](_0x43b0df['shift']());}};_0x4dd29f(++_0x16ba3f);}(_0xe94a,0x1c7));var _0xae94=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xe94a[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0xae94('0x0'));module[_0xae94('0x1')]={'name':{'type':Sequelize[_0xae94('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xae94('0x2')]}}; \ No newline at end of file +var _0x3299=['exports','STRING'];(function(_0x44f411,_0x50ec93){var _0xa827d3=function(_0x425861){while(--_0x425861){_0x44f411['push'](_0x44f411['shift']());}};_0xa827d3(++_0x50ec93);}(_0x3299,0x1bc));var _0x9329=function(_0x23f581,_0x25a955){_0x23f581=_0x23f581-0x0;var _0x50e39a=_0x3299[_0x23f581];return _0x50e39a;};'use strict';var Sequelize=require('sequelize');module[_0x9329('0x0')]={'name':{'type':Sequelize[_0x9329('0x1')]},'basename':{'type':Sequelize[_0x9329('0x1')]},'type':{'type':Sequelize[_0x9329('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 0de96af..2e72082 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 _0x0e87=['order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','params','length','find','clone','include','get','createdAt','updatedAt','body','omit','create','catch','update','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','reject','then','destroy','end','error','name','send','map','Attachment','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit'];(function(_0x26dcd8,_0x461d6b){var _0x1654e9=function(_0x29ab7b){while(--_0x29ab7b){_0x26dcd8['push'](_0x26dcd8['shift']());}};_0x1654e9(++_0x461d6b);}(_0x0e87,0x122));var _0x70e8=function(_0x5b9331,_0xa1e31f){_0x5b9331=_0x5b9331-0x0;var _0x328c2f=_0x0e87[_0x5b9331];return _0x328c2f;};'use strict';var emlformat=require(_0x70e8('0x0'));var rimraf=require(_0x70e8('0x1'));var zipdir=require(_0x70e8('0x2'));var jsonpatch=require(_0x70e8('0x3'));var rp=require(_0x70e8('0x4'));var moment=require(_0x70e8('0x5'));var BPromise=require(_0x70e8('0x6'));var Mustache=require(_0x70e8('0x7'));var util=require('util');var path=require(_0x70e8('0x8'));var sox=require('sox');var csv=require(_0x70e8('0x9'));var ejs=require(_0x70e8('0xa'));var fs=require('fs');var fs_extra=require(_0x70e8('0xb'));var _=require(_0x70e8('0xc'));var squel=require(_0x70e8('0xd'));var crypto=require(_0x70e8('0xe'));var jsforce=require(_0x70e8('0xf'));var deskjs=require(_0x70e8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x70e8('0x11'));var Papa=require(_0x70e8('0x12'));var Redis=require(_0x70e8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x70e8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x70e8('0x15'))(_0x70e8('0x16'));var utils=require(_0x70e8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x70e8('0x18'));var db=require(_0x70e8('0x19'))['db'];function respondWithStatusCode(_0x4fcede,_0x3b50eb){_0x3b50eb=_0x3b50eb||0xcc;return function(_0x23fe2c){if(_0x23fe2c){return _0x4fcede[_0x70e8('0x1a')](_0x3b50eb);}return _0x4fcede['status'](_0x3b50eb)['end']();};}function respondWithResult(_0x3991f3,_0x3d732b){_0x3d732b=_0x3d732b||0xc8;return function(_0x4d9bd7){if(_0x4d9bd7){return _0x3991f3[_0x70e8('0x1b')](_0x3d732b)[_0x70e8('0x1c')](_0x4d9bd7);}};}function respondWithFilteredResult(_0x2fe81f,_0x106f49){return function(_0x6731df){if(_0x6731df){var _0x465f35=typeof _0x106f49[_0x70e8('0x1d')]===_0x70e8('0x1e')&&typeof _0x106f49['limit']===_0x70e8('0x1e');var _0x2763a6=_0x6731df['count'];var _0x46df83=_0x465f35?0x0:_0x106f49[_0x70e8('0x1d')];var _0x3e57f6=_0x465f35?_0x6731df[_0x70e8('0x1f')]:_0x106f49[_0x70e8('0x1d')]+_0x106f49['limit'];var _0x165600;if(_0x3e57f6>=_0x2763a6){_0x3e57f6=_0x2763a6;_0x165600=0xc8;}else{_0x165600=0xce;}_0x2fe81f[_0x70e8('0x1b')](_0x165600);return _0x2fe81f[_0x70e8('0x20')]('Content-Range',_0x46df83+'-'+_0x3e57f6+'/'+_0x2763a6)[_0x70e8('0x1c')](_0x6731df);}return null;};}function patchUpdates(_0x339871){return function(_0x3ffa1d){try{jsonpatch[_0x70e8('0x21')](_0x3ffa1d,_0x339871,!![]);}catch(_0x4ad4fb){return BPromise[_0x70e8('0x22')](_0x4ad4fb);}return _0x3ffa1d['save']();};}function saveUpdates(_0x2877d9,_0x195a5a){return function(_0x2f6ae9){if(_0x2f6ae9){return _0x2f6ae9['update'](_0x2877d9)[_0x70e8('0x23')](function(_0x23c2cd){return _0x23c2cd;});}return null;};}function removeEntity(_0xb03f48,_0x43daa0){return function(_0x3ec8a6){if(_0x3ec8a6){return _0x3ec8a6[_0x70e8('0x24')]()['then'](function(){_0xb03f48['status'](0xcc)[_0x70e8('0x25')]();});}};}function handleEntityNotFound(_0x5bfac4,_0x15e36e){return function(_0x17949e){if(!_0x17949e){_0x5bfac4[_0x70e8('0x1a')](0x194);}return _0x17949e;};}function handleError(_0x5179cb,_0xdde3d7){_0xdde3d7=_0xdde3d7||0x1f4;return function(_0x3e721f){logger[_0x70e8('0x26')](_0x3e721f['stack']);if(_0x3e721f[_0x70e8('0x27')]){delete _0x3e721f['name'];}_0x5179cb['status'](_0xdde3d7)[_0x70e8('0x28')](_0x3e721f);};}exports['index']=function(_0x4c346b,_0x48802e){var _0x164333={},_0x46068e={},_0x23b437={'count':0x0,'rows':[]};var _0x4b9c37=_[_0x70e8('0x29')](db[_0x70e8('0x2a')][_0x70e8('0x2b')],function(_0x294bbc){return{'name':_0x294bbc['fieldName'],'type':_0x294bbc[_0x70e8('0x2c')]['key']};});_0x46068e[_0x70e8('0x2d')]=_[_0x70e8('0x29')](_0x4b9c37,_0x70e8('0x27'));_0x46068e[_0x70e8('0x2e')]=_[_0x70e8('0x2f')](_0x4c346b[_0x70e8('0x2e')]);_0x46068e[_0x70e8('0x30')]=_['intersection'](_0x46068e[_0x70e8('0x2d')],_0x46068e[_0x70e8('0x2e')]);_0x164333['attributes']=_[_0x70e8('0x31')](_0x46068e['model'],qs[_0x70e8('0x32')](_0x4c346b[_0x70e8('0x2e')][_0x70e8('0x32')]));_0x164333[_0x70e8('0x33')]=_0x164333[_0x70e8('0x33')]['length']?_0x164333[_0x70e8('0x33')]:_0x46068e['model'];if(!_0x4c346b[_0x70e8('0x2e')][_0x70e8('0x34')]('nolimit')){_0x164333[_0x70e8('0x35')]=qs[_0x70e8('0x35')](_0x4c346b[_0x70e8('0x2e')]['limit']);_0x164333[_0x70e8('0x1d')]=qs[_0x70e8('0x1d')](_0x4c346b['query'][_0x70e8('0x1d')]);}_0x164333[_0x70e8('0x36')]=qs[_0x70e8('0x37')](_0x4c346b[_0x70e8('0x2e')]['sort']);_0x164333[_0x70e8('0x38')]=qs[_0x70e8('0x30')](_['pick'](_0x4c346b[_0x70e8('0x2e')],_0x46068e['filters']),_0x4b9c37);if(_0x4c346b[_0x70e8('0x2e')][_0x70e8('0x39')]){_0x164333[_0x70e8('0x38')]=_[_0x70e8('0x3a')](_0x164333['where'],{'$or':_[_0x70e8('0x29')](_0x4b9c37,function(_0x2e367d){if(_0x2e367d['type']!==_0x70e8('0x3b')){var _0x598cb7={};_0x598cb7[_0x2e367d[_0x70e8('0x27')]]={'$like':'%'+_0x4c346b['query']['filter']+'%'};return _0x598cb7;}})});}_0x164333=_['merge']({},_0x164333,_0x4c346b[_0x70e8('0x3c')]);var _0x21b3dd={'where':_0x164333[_0x70e8('0x38')]};return db[_0x70e8('0x2a')][_0x70e8('0x1f')](_0x21b3dd)[_0x70e8('0x23')](function(_0x2fbfcf){_0x23b437[_0x70e8('0x1f')]=_0x2fbfcf;if(_0x4c346b[_0x70e8('0x2e')][_0x70e8('0x3d')]){_0x164333['include']=[{'all':!![]}];}return db[_0x70e8('0x2a')][_0x70e8('0x3e')](_0x164333);})['then'](function(_0xd85789){_0x23b437['rows']=_0xd85789;return _0x23b437;})['then'](respondWithFilteredResult(_0x48802e,_0x164333))['catch'](handleError(_0x48802e,null));};exports['show']=function(_0x596b31,_0x4dd3c9){var _0x5ec8d1={'raw':!![],'where':{'id':_0x596b31[_0x70e8('0x3f')]['id']}},_0x2bb0d8={};_0x2bb0d8[_0x70e8('0x2d')]=_[_0x70e8('0x2f')](db[_0x70e8('0x2a')][_0x70e8('0x2b')]);_0x2bb0d8['query']=_[_0x70e8('0x2f')](_0x596b31[_0x70e8('0x2e')]);_0x2bb0d8[_0x70e8('0x30')]=_[_0x70e8('0x31')](_0x2bb0d8[_0x70e8('0x2d')],_0x2bb0d8['query']);_0x5ec8d1[_0x70e8('0x33')]=_[_0x70e8('0x31')](_0x2bb0d8[_0x70e8('0x2d')],qs[_0x70e8('0x32')](_0x596b31['query'][_0x70e8('0x32')]));_0x5ec8d1['attributes']=_0x5ec8d1[_0x70e8('0x33')][_0x70e8('0x40')]?_0x5ec8d1[_0x70e8('0x33')]:_0x2bb0d8['model'];if(_0x596b31[_0x70e8('0x2e')][_0x70e8('0x3d')]){_0x5ec8d1['include']=[{'all':!![]}];}_0x5ec8d1=_[_0x70e8('0x3a')]({},_0x5ec8d1,_0x596b31[_0x70e8('0x3c')]);return db['Attachment'][_0x70e8('0x41')](_0x5ec8d1)[_0x70e8('0x23')](handleEntityNotFound(_0x4dd3c9,null))[_0x70e8('0x23')](respondWithResult(_0x4dd3c9,null))['catch'](handleError(_0x4dd3c9,null));};exports[_0x70e8('0x42')]=function(_0x407b87,_0x59e8e4){var _0x219991={'where':{'id':_0x407b87[_0x70e8('0x3f')]['id']}},_0x2db218={};_0x2db218[_0x70e8('0x2d')]=_[_0x70e8('0x2f')](db[_0x70e8('0x2a')]['rawAttributes']);_0x219991[_0x70e8('0x33')]=_[_0x70e8('0x31')](_0x2db218[_0x70e8('0x2d')],qs[_0x70e8('0x32')](_0x407b87[_0x70e8('0x2e')][_0x70e8('0x32')]));_0x219991[_0x70e8('0x33')]=_0x219991[_0x70e8('0x33')]['length']?_0x219991[_0x70e8('0x33')]:_0x2db218[_0x70e8('0x2d')];if(_0x407b87[_0x70e8('0x2e')][_0x70e8('0x3d')]){_0x219991[_0x70e8('0x43')]=[{'all':!![]}];}_0x219991=_[_0x70e8('0x3a')]({},_0x219991,_0x407b87[_0x70e8('0x3c')]);return db[_0x70e8('0x2a')][_0x70e8('0x41')](_0x219991)[_0x70e8('0x23')](handleEntityNotFound(_0x59e8e4,null))[_0x70e8('0x23')](function(_0x572277){if(_0x572277){var _0x529d07=_0x572277[_0x70e8('0x44')]({'plain':!![]});_0x529d07=qs['omit'](_0x529d07,['id',_0x70e8('0x45'),_0x70e8('0x46')]);_0x407b87[_0x70e8('0x47')]=_[_0x70e8('0x48')](_0x407b87[_0x70e8('0x47')],['id',_0x70e8('0x45'),_0x70e8('0x46')]);return db[_0x70e8('0x2a')][_0x70e8('0x49')](_[_0x70e8('0x3a')](_0x529d07,_0x407b87[_0x70e8('0x47')]),{'include':_0x407b87[_0x70e8('0x2e')][_0x70e8('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x59e8e4,0xc9))[_0x70e8('0x4a')](handleError(_0x59e8e4,null));};exports[_0x70e8('0x4b')]=function(_0x2a4068,_0x560e0a){if(_0x2a4068['body']['id']){delete _0x2a4068['body']['id'];}return db[_0x70e8('0x2a')][_0x70e8('0x41')]({'where':{'id':_0x2a4068[_0x70e8('0x3f')]['id']}})[_0x70e8('0x23')](handleEntityNotFound(_0x560e0a,null))['then'](saveUpdates(_0x2a4068[_0x70e8('0x47')],null))[_0x70e8('0x23')](respondWithResult(_0x560e0a,null))[_0x70e8('0x4a')](handleError(_0x560e0a,null));};exports[_0x70e8('0x24')]=function(_0x15f130,_0xeacd29){return db[_0x70e8('0x2a')][_0x70e8('0x41')]({'where':{'id':_0x15f130[_0x70e8('0x3f')]['id']}})['then'](handleEntityNotFound(_0xeacd29,null))[_0x70e8('0x23')](removeEntity(_0xeacd29,null))[_0x70e8('0x4a')](handleError(_0xeacd29,null));};exports[_0x70e8('0x49')]=function(_0x14f827,_0x3143af,_0x53023f){_0x14f827['body'][_0x70e8('0x27')]=_0x14f827['file'][_0x70e8('0x4c')];_0x14f827['body'][_0x70e8('0x4d')]=_0x14f827[_0x70e8('0x4e')][_0x70e8('0x4f')];_0x14f827[_0x70e8('0x47')][_0x70e8('0x2c')]=_0x14f827['file'][_0x70e8('0x50')];return db[_0x70e8('0x2a')][_0x70e8('0x49')](_0x14f827[_0x70e8('0x47')])[_0x70e8('0x23')](respondWithResult(_0x3143af,0xc9))[_0x70e8('0x4a')](handleError(_0x3143af,null));};exports[_0x70e8('0x51')]=function(_0x5e54d3,_0x40e316,_0x55e8a7){return db[_0x70e8('0x2a')][_0x70e8('0x52')]({'where':{'id':_0x5e54d3[_0x70e8('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x40e316,null))[_0x70e8('0x23')](function(_0x356f60){if(_0x356f60){var _0xa737f4=_0x356f60[_0x70e8('0x53')]!==null;var _0x1275bc=path[_0x70e8('0x54')](config['root'],'server/files/attachments/');if(_0xa737f4){_0x1275bc=path[_0x70e8('0x54')](_0x1275bc,_0x70e8('0x55'));}var _0x5552ea=path[_0x70e8('0x54')](_0x1275bc,_0x356f60[_0x70e8('0x4d')]);return _0x40e316['download'](_0x5552ea);}})['catch'](handleError(_0x40e316,null));}; \ No newline at end of file +var _0xe19a=['then','destroy','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','limit','sort','where','map','options','Attachment','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','omit','createdAt','updatedAt','body','create','merge','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update'];(function(_0x3eb6d8,_0x5dbf7b){var _0x5e3ff2=function(_0x254a23){while(--_0x254a23){_0x3eb6d8['push'](_0x3eb6d8['shift']());}};_0x5e3ff2(++_0x5dbf7b);}(_0xe19a,0x1e5));var _0xae19=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0xe19a[_0x8ae98b];return _0xc30bd4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae19('0x0'));var zipdir=require(_0xae19('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae19('0x2'));var moment=require(_0xae19('0x3'));var BPromise=require(_0xae19('0x4'));var Mustache=require(_0xae19('0x5'));var util=require(_0xae19('0x6'));var path=require(_0xae19('0x7'));var sox=require(_0xae19('0x8'));var csv=require('to-csv');var ejs=require(_0xae19('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae19('0xa'));var squel=require(_0xae19('0xb'));var crypto=require(_0xae19('0xc'));var jsforce=require(_0xae19('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xae19('0xe'));var querystring=require(_0xae19('0xf'));var Papa=require('papaparse');var Redis=require(_0xae19('0x10'));var authService=require(_0xae19('0x11'));var qs=require(_0xae19('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae19('0x13'));var logger=require('../../config/logger')(_0xae19('0x14'));var utils=require(_0xae19('0x15'));var config=require(_0xae19('0x16'));var licenseUtil=require(_0xae19('0x17'));var db=require(_0xae19('0x18'))['db'];function respondWithStatusCode(_0x186518,_0x402774){_0x402774=_0x402774||0xcc;return function(_0x3a3fbe){if(_0x3a3fbe){return _0x186518[_0xae19('0x19')](_0x402774);}return _0x186518[_0xae19('0x1a')](_0x402774)[_0xae19('0x1b')]();};}function respondWithResult(_0x416171,_0x6f28a0){_0x6f28a0=_0x6f28a0||0xc8;return function(_0x18e0d9){if(_0x18e0d9){return _0x416171[_0xae19('0x1a')](_0x6f28a0)[_0xae19('0x1c')](_0x18e0d9);}};}function respondWithFilteredResult(_0xeeb3c9,_0xac8434){return function(_0x3d0e69){if(_0x3d0e69){var _0x5290c0=typeof _0xac8434[_0xae19('0x1d')]===_0xae19('0x1e')&&typeof _0xac8434['limit']===_0xae19('0x1e');var _0x3a78ba=_0x3d0e69['count'];var _0x529bc6=_0x5290c0?0x0:_0xac8434[_0xae19('0x1d')];var _0x7f045e=_0x5290c0?_0x3d0e69[_0xae19('0x1f')]:_0xac8434[_0xae19('0x1d')]+_0xac8434['limit'];var _0x4bdf74;if(_0x7f045e>=_0x3a78ba){_0x7f045e=_0x3a78ba;_0x4bdf74=0xc8;}else{_0x4bdf74=0xce;}_0xeeb3c9[_0xae19('0x1a')](_0x4bdf74);return _0xeeb3c9[_0xae19('0x20')](_0xae19('0x21'),_0x529bc6+'-'+_0x7f045e+'/'+_0x3a78ba)['json'](_0x3d0e69);}return null;};}function patchUpdates(_0x4679d5){return function(_0x59bb1a){try{jsonpatch[_0xae19('0x22')](_0x59bb1a,_0x4679d5,!![]);}catch(_0x203b93){return BPromise['reject'](_0x203b93);}return _0x59bb1a[_0xae19('0x23')]();};}function saveUpdates(_0x5656cc,_0x231853){return function(_0x22ca99){if(_0x22ca99){return _0x22ca99[_0xae19('0x24')](_0x5656cc)[_0xae19('0x25')](function(_0x4aa06c){return _0x4aa06c;});}return null;};}function removeEntity(_0x489097,_0x4c1aa9){return function(_0x40309b){if(_0x40309b){return _0x40309b[_0xae19('0x26')]()[_0xae19('0x25')](function(){_0x489097[_0xae19('0x1a')](0xcc)[_0xae19('0x1b')]();});}};}function handleEntityNotFound(_0x5b7d60,_0x2ee0e6){return function(_0x1f4a27){if(!_0x1f4a27){_0x5b7d60['sendStatus'](0x194);}return _0x1f4a27;};}function handleError(_0x4a60e4,_0x37e042){_0x37e042=_0x37e042||0x1f4;return function(_0x1803b0){logger['error'](_0x1803b0['stack']);if(_0x1803b0[_0xae19('0x27')]){delete _0x1803b0[_0xae19('0x27')];}_0x4a60e4['status'](_0x37e042)[_0xae19('0x28')](_0x1803b0);};}exports[_0xae19('0x29')]=function(_0x39a1a9,_0x3fecb6){var _0x5b3228={},_0x123306={},_0xb38c75={'count':0x0,'rows':[]};var _0x220b48=_['map'](db['Attachment'][_0xae19('0x2a')],function(_0x4e695){return{'name':_0x4e695[_0xae19('0x2b')],'type':_0x4e695[_0xae19('0x2c')]['key']};});_0x123306[_0xae19('0x2d')]=_['map'](_0x220b48,'name');_0x123306[_0xae19('0x2e')]=_[_0xae19('0x2f')](_0x39a1a9['query']);_0x123306[_0xae19('0x30')]=_[_0xae19('0x31')](_0x123306[_0xae19('0x2d')],_0x123306[_0xae19('0x2e')]);_0x5b3228[_0xae19('0x32')]=_[_0xae19('0x31')](_0x123306[_0xae19('0x2d')],qs['fields'](_0x39a1a9['query']['fields']));_0x5b3228['attributes']=_0x5b3228[_0xae19('0x32')]['length']?_0x5b3228[_0xae19('0x32')]:_0x123306[_0xae19('0x2d')];if(!_0x39a1a9['query'][_0xae19('0x33')]('nolimit')){_0x5b3228[_0xae19('0x34')]=qs['limit'](_0x39a1a9[_0xae19('0x2e')][_0xae19('0x34')]);_0x5b3228[_0xae19('0x1d')]=qs[_0xae19('0x1d')](_0x39a1a9[_0xae19('0x2e')][_0xae19('0x1d')]);}_0x5b3228['order']=qs[_0xae19('0x35')](_0x39a1a9[_0xae19('0x2e')][_0xae19('0x35')]);_0x5b3228[_0xae19('0x36')]=qs[_0xae19('0x30')](_['pick'](_0x39a1a9[_0xae19('0x2e')],_0x123306[_0xae19('0x30')]),_0x220b48);if(_0x39a1a9[_0xae19('0x2e')]['filter']){_0x5b3228[_0xae19('0x36')]=_['merge'](_0x5b3228[_0xae19('0x36')],{'$or':_[_0xae19('0x37')](_0x220b48,function(_0x190f85){if(_0x190f85[_0xae19('0x2c')]!=='VIRTUAL'){var _0x24864b={};_0x24864b[_0x190f85[_0xae19('0x27')]]={'$like':'%'+_0x39a1a9['query']['filter']+'%'};return _0x24864b;}})});}_0x5b3228=_['merge']({},_0x5b3228,_0x39a1a9[_0xae19('0x38')]);var _0x21e6c2={'where':_0x5b3228[_0xae19('0x36')]};return db[_0xae19('0x39')][_0xae19('0x1f')](_0x21e6c2)[_0xae19('0x25')](function(_0x22e883){_0xb38c75[_0xae19('0x1f')]=_0x22e883;if(_0x39a1a9[_0xae19('0x2e')][_0xae19('0x3a')]){_0x5b3228[_0xae19('0x3b')]=[{'all':!![]}];}return db[_0xae19('0x39')][_0xae19('0x3c')](_0x5b3228);})[_0xae19('0x25')](function(_0x187ebf){_0xb38c75[_0xae19('0x3d')]=_0x187ebf;return _0xb38c75;})[_0xae19('0x25')](respondWithFilteredResult(_0x3fecb6,_0x5b3228))[_0xae19('0x3e')](handleError(_0x3fecb6,null));};exports[_0xae19('0x3f')]=function(_0x3b5086,_0x4bd3d0){var _0x33940c={'raw':!![],'where':{'id':_0x3b5086[_0xae19('0x40')]['id']}},_0x516613={};_0x516613['model']=_[_0xae19('0x2f')](db[_0xae19('0x39')][_0xae19('0x2a')]);_0x516613[_0xae19('0x2e')]=_['keys'](_0x3b5086[_0xae19('0x2e')]);_0x516613['filters']=_[_0xae19('0x31')](_0x516613[_0xae19('0x2d')],_0x516613[_0xae19('0x2e')]);_0x33940c[_0xae19('0x32')]=_[_0xae19('0x31')](_0x516613[_0xae19('0x2d')],qs[_0xae19('0x41')](_0x3b5086[_0xae19('0x2e')][_0xae19('0x41')]));_0x33940c['attributes']=_0x33940c[_0xae19('0x32')][_0xae19('0x42')]?_0x33940c['attributes']:_0x516613['model'];if(_0x3b5086['query'][_0xae19('0x3a')]){_0x33940c['include']=[{'all':!![]}];}_0x33940c=_['merge']({},_0x33940c,_0x3b5086[_0xae19('0x38')]);return db[_0xae19('0x39')][_0xae19('0x43')](_0x33940c)['then'](handleEntityNotFound(_0x4bd3d0,null))['then'](respondWithResult(_0x4bd3d0,null))[_0xae19('0x3e')](handleError(_0x4bd3d0,null));};exports[_0xae19('0x44')]=function(_0x2a0331,_0x2bc6c7){var _0x55560d={'where':{'id':_0x2a0331['params']['id']}},_0x13e13e={};_0x13e13e[_0xae19('0x2d')]=_[_0xae19('0x2f')](db['Attachment'][_0xae19('0x2a')]);_0x55560d[_0xae19('0x32')]=_[_0xae19('0x31')](_0x13e13e['model'],qs[_0xae19('0x41')](_0x2a0331[_0xae19('0x2e')][_0xae19('0x41')]));_0x55560d['attributes']=_0x55560d[_0xae19('0x32')][_0xae19('0x42')]?_0x55560d[_0xae19('0x32')]:_0x13e13e[_0xae19('0x2d')];if(_0x2a0331[_0xae19('0x2e')]['includeAll']){_0x55560d['include']=[{'all':!![]}];}_0x55560d=_['merge']({},_0x55560d,_0x2a0331['options']);return db[_0xae19('0x39')][_0xae19('0x43')](_0x55560d)['then'](handleEntityNotFound(_0x2bc6c7,null))[_0xae19('0x25')](function(_0x571230){if(_0x571230){var _0x2a7e74=_0x571230['get']({'plain':!![]});_0x2a7e74=qs[_0xae19('0x45')](_0x2a7e74,['id',_0xae19('0x46'),_0xae19('0x47')]);_0x2a0331[_0xae19('0x48')]=_[_0xae19('0x45')](_0x2a0331[_0xae19('0x48')],['id',_0xae19('0x46'),_0xae19('0x47')]);return db[_0xae19('0x39')][_0xae19('0x49')](_[_0xae19('0x4a')](_0x2a7e74,_0x2a0331['body']),{'include':_0x2a0331[_0xae19('0x2e')][_0xae19('0x3a')]?[{'all':!![]}]:undefined});}})[_0xae19('0x25')](respondWithResult(_0x2bc6c7,0xc9))[_0xae19('0x3e')](handleError(_0x2bc6c7,null));};exports[_0xae19('0x24')]=function(_0x5147c9,_0x1628c3){if(_0x5147c9[_0xae19('0x48')]['id']){delete _0x5147c9['body']['id'];}return db[_0xae19('0x39')]['find']({'where':{'id':_0x5147c9['params']['id']}})[_0xae19('0x25')](handleEntityNotFound(_0x1628c3,null))[_0xae19('0x25')](saveUpdates(_0x5147c9['body'],null))[_0xae19('0x25')](respondWithResult(_0x1628c3,null))[_0xae19('0x3e')](handleError(_0x1628c3,null));};exports['destroy']=function(_0x2a8c30,_0x584ce6){return db[_0xae19('0x39')]['find']({'where':{'id':_0x2a8c30[_0xae19('0x40')]['id']}})[_0xae19('0x25')](handleEntityNotFound(_0x584ce6,null))['then'](removeEntity(_0x584ce6,null))[_0xae19('0x3e')](handleError(_0x584ce6,null));};exports[_0xae19('0x49')]=function(_0x564c5e,_0x366dd6,_0x1ba9bf){_0x564c5e[_0xae19('0x48')]['name']=_0x564c5e[_0xae19('0x4b')][_0xae19('0x4c')];_0x564c5e[_0xae19('0x48')][_0xae19('0x4d')]=_0x564c5e[_0xae19('0x4b')][_0xae19('0x4e')];_0x564c5e['body'][_0xae19('0x2c')]=_0x564c5e[_0xae19('0x4b')][_0xae19('0x4f')];return db[_0xae19('0x39')]['create'](_0x564c5e[_0xae19('0x48')])[_0xae19('0x25')](respondWithResult(_0x366dd6,0xc9))[_0xae19('0x3e')](handleError(_0x366dd6,null));};exports[_0xae19('0x50')]=function(_0x289c9d,_0x1be02f,_0x23889a){return db[_0xae19('0x39')][_0xae19('0x51')]({'where':{'id':_0x289c9d[_0xae19('0x40')]['id']},'raw':!![]})[_0xae19('0x25')](handleEntityNotFound(_0x1be02f,null))[_0xae19('0x25')](function(_0x23a2bf){if(_0x23a2bf){var _0x10bff2=_0x23a2bf[_0xae19('0x52')]!==null;var _0xff037=path['join'](config[_0xae19('0x53')],_0xae19('0x54'));if(_0x10bff2){_0xff037=path[_0xae19('0x55')](_0xff037,_0xae19('0x56'));}var _0x47e058=path[_0xae19('0x55')](_0xff037,_0x23a2bf[_0xae19('0x4d')]);return _0x1be02f[_0xae19('0x50')](_0x47e058);}})['catch'](handleError(_0x1be02f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d7ebc22..77573b5 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 _0xc6db=['attachments','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','Attachment'];(function(_0x5ba230,_0x56d93c){var _0x1b7ad5=function(_0x5bd6c4){while(--_0x5bd6c4){_0x5ba230['push'](_0x5ba230['shift']());}};_0x1b7ad5(++_0x56d93c);}(_0xc6db,0x199));var _0xbc6d=function(_0x16d9bc,_0x5cc19d){_0x16d9bc=_0x16d9bc-0x0;var _0x4fe04a=_0xc6db[_0x16d9bc];return _0x4fe04a;};'use strict';var _=require('lodash');var util=require(_0xbc6d('0x0'));var logger=require('../../config/logger')(_0xbc6d('0x1'));var moment=require(_0xbc6d('0x2'));var BPromise=require(_0xbc6d('0x3'));var rp=require(_0xbc6d('0x4'));var fs=require('fs');var path=require(_0xbc6d('0x5'));var rimraf=require(_0xbc6d('0x6'));var config=require(_0xbc6d('0x7'));var attributes=require(_0xbc6d('0x8'));module['exports']=function(_0x24f64b,_0x5e8ad3){return _0x24f64b[_0xbc6d('0x9')](_0xbc6d('0xa'),attributes,{'tableName':_0xbc6d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0c4=['lodash','util','bluebird','path','rimraf','./attachment.attributes','exports','define','attachments'];(function(_0x3b722d,_0x37df87){var _0xc4e19f=function(_0x2a904f){while(--_0x2a904f){_0x3b722d['push'](_0x3b722d['shift']());}};_0xc4e19f(++_0x37df87);}(_0xf0c4,0x19e));var _0x4f0c=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0xf0c4[_0x1cc961];return _0x471d86;};'use strict';var _=require(_0x4f0c('0x0'));var util=require(_0x4f0c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4f0c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f0c('0x3'));var rimraf=require(_0x4f0c('0x4'));var config=require('../../config/environment');var attributes=require(_0x4f0c('0x5'));module[_0x4f0c('0x6')]=function(_0x487d21,_0x57520b){return _0x487d21[_0x4f0c('0x7')]('Attachment',attributes,{'tableName':_0x4f0c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index df1ae7d..fc0870b 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 _0x22fb=['message','error','result','catch','Attachment','create','options','raw','CreateAttachment','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x22fb,0x192));var _0xb22f=function(_0x2fb3ed,_0x583105){_0x2fb3ed=_0x2fb3ed-0x0;var _0x244b92=_0x22fb[_0x2fb3ed];return _0x244b92;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('Attachment,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});}exports['CreateAttachment']=function(_0x252742){var _0x35caec=this;return new Promise(function(_0x2aaec4,_0x1f515d){return db[_0xb22f('0x16')][_0xb22f('0x17')](_0x252742['body'],{'raw':_0x252742[_0xb22f('0x18')]?_0x252742['options'][_0xb22f('0x19')]===undefined?!![]:![]:!![]})[_0xb22f('0xb')](function(_0x316f11){logger[_0xb22f('0xc')](_0xb22f('0x1a'),_0x252742);logger['debug']('CreateAttachment',_0x252742,JSON[_0xb22f('0x1b')](_0x316f11));_0x2aaec4(_0x316f11);})[_0xb22f('0x15')](function(_0xf34e0d){logger[_0xb22f('0x13')](_0xb22f('0x1a'),_0xf34e0d[_0xb22f('0x12')],_0x252742);_0x1f515d(_0x35caec[_0xb22f('0x13')](0x1f4,_0xf34e0d[_0xb22f('0x12')]));});});}; \ No newline at end of file +var _0x94dc=['raw','CreateAttachment','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options'];(function(_0x4e9e0d,_0xd86384){var _0x514622=function(_0xe6b57b){while(--_0xe6b57b){_0x4e9e0d['push'](_0x4e9e0d['shift']());}};_0x514622(++_0xd86384);}(_0x94dc,0xb1));var _0xc94d=function(_0x1dd6f0,_0x59e8cf){_0x1dd6f0=_0x1dd6f0-0x0;var _0x21e871=_0x94dc[_0x1dd6f0];return _0x21e871;};'use strict';var _=require(_0xc94d('0x0'));var util=require('util');var moment=require(_0xc94d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc94d('0x2'));var fs=require('fs');var Redis=require(_0xc94d('0x3'));var db=require(_0xc94d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc94d('0x5'))(_0xc94d('0x6'));var config=require(_0xc94d('0x7'));var jayson=require(_0xc94d('0x8'));var client=jayson[_0xc94d('0x9')][_0xc94d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb7275c,_0x5776ab,_0x2f9757){return new BPromise(function(_0xbe5904,_0x15265c){return client[_0xc94d('0xb')](_0xb7275c,_0x2f9757)[_0xc94d('0xc')](function(_0x579245){logger[_0xc94d('0xd')](_0xc94d('0xe'),_0x5776ab,_0xc94d('0xf'));logger[_0xc94d('0x10')](_0xc94d('0x11'),_0x5776ab,_0xc94d('0xf'),JSON['stringify'](_0x579245));if(_0x579245[_0xc94d('0x12')]){if(_0x579245[_0xc94d('0x12')][_0xc94d('0x13')]===0x1f4){logger[_0xc94d('0x12')]('Attachment,\x20%s,\x20%s',_0x5776ab,_0x579245['error']['message']);return _0x15265c(_0x579245[_0xc94d('0x12')][_0xc94d('0x14')]);}logger[_0xc94d('0x12')](_0xc94d('0xe'),_0x5776ab,_0x579245[_0xc94d('0x12')][_0xc94d('0x14')]);return _0xbe5904(_0x579245[_0xc94d('0x12')][_0xc94d('0x14')]);}else{logger[_0xc94d('0xd')](_0xc94d('0xe'),_0x5776ab,_0xc94d('0xf'));_0xbe5904(_0x579245[_0xc94d('0x15')][_0xc94d('0x14')]);}})[_0xc94d('0x16')](function(_0x19508d){logger['error']('Attachment,\x20%s,\x20%s',_0x5776ab,_0x19508d);_0x15265c(_0x19508d);});});}exports['CreateAttachment']=function(_0x48b879){var _0x345259=this;return new Promise(function(_0x4784a2,_0x4f7287){return db['Attachment'][_0xc94d('0x17')](_0x48b879[_0xc94d('0x18')],{'raw':_0x48b879['options']?_0x48b879[_0xc94d('0x19')][_0xc94d('0x1a')]===undefined?!![]:![]:!![]})[_0xc94d('0xc')](function(_0xb5c1fd){logger[_0xc94d('0xd')](_0xc94d('0x1b'),_0x48b879);logger[_0xc94d('0x10')](_0xc94d('0x1b'),_0x48b879,JSON[_0xc94d('0x1c')](_0xb5c1fd));_0x4784a2(_0xb5c1fd);})[_0xc94d('0x16')](function(_0x5f2820){logger[_0xc94d('0x12')](_0xc94d('0x1b'),_0x5f2820[_0xc94d('0x14')],_0x48b879);_0x4f7287(_0x345259[_0xc94d('0x12')](0x1f4,_0x5f2820[_0xc94d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index d123535..5360310 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x67882f,_0x4902fb){var _0x3bf12b=function(_0x295240){while(--_0x295240){_0x67882f['push'](_0x67882f['shift']());}};_0x3bf12b(++_0x4902fb);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c1ddc,_0x587040){_0x5c1ddc=_0x5c1ddc-0x0;var _0x542a11=_0xb10b[_0x5c1ddc];return _0x542a11;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x636402,_0x2bb3ac){var _0x584106=function(_0x14a69c){while(--_0x14a69c){_0x636402['push'](_0x636402['shift']());}};_0x584106(++_0x2bb3ac);}(_0x5f2f,0x73));var _0xf5f2=function(_0x53a258,_0x5b1010){_0x53a258=_0x53a258-0x0;var _0x1d0d59=_0x5f2f[_0x53a258];return _0x1d0d59;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 12f8e18..9af9fdf 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 _0x8a3d=['add','getLicense','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','Setting','blockDuration','then','User','find','map','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x8a3d,0xac));var _0xd8a3=function(_0x527bed,_0xbb1398){_0x527bed=_0x527bed-0x0;var _0x2ff571=_0x8a3d[_0x527bed];return _0x2ff571;};'use strict';var _=require('lodash');var passport=require(_0xd8a3('0x0'));var GoogleStrategy=require(_0xd8a3('0x1'))[_0xd8a3('0x2')];var moment=require(_0xd8a3('0x3'));var db=require(_0xd8a3('0x4'))['db'];var config=require(_0xd8a3('0x5'));var signToken=require(_0xd8a3('0x6'))[_0xd8a3('0x7')];var utils=require(_0xd8a3('0x8'));exports['login']=passport['authenticate'](_0xd8a3('0x9'),{'failureRedirect':_0xd8a3('0xa'),'scope':[_0xd8a3('0xb'),_0xd8a3('0xc')],'session':![]});exports[_0xd8a3('0xd')]=passport[_0xd8a3('0xe')](_0xd8a3('0x9'),{'failureRedirect':'/login','session':![]});passport[_0xd8a3('0xf')](new GoogleStrategy({'clientID':config['google']?config['google'][_0xd8a3('0x10')]:'id','clientSecret':config[_0xd8a3('0x9')]?config[_0xd8a3('0x9')][_0xd8a3('0x11')]:'secret','callbackURL':config['google']?config[_0xd8a3('0x9')]['callbackURL']:''},function(_0x16136b,_0x46892e,_0x354e1d,_0x3ae283){var _0x2c7a6d,_0x51c0e3;return db[_0xd8a3('0x12')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd8a3('0x13')],'raw':!![]})[_0xd8a3('0x14')](function(_0x564f74){_0x2c7a6d=_0x564f74;return db[_0xd8a3('0x15')][_0xd8a3('0x16')]({'where':{'email':_[_0xd8a3('0x17')](_0x354e1d[_0xd8a3('0x18')],'value'),'role':{'$or':[_0xd8a3('0x19'),_0xd8a3('0x1a'),_0xd8a3('0x1b')]}}});})[_0xd8a3('0x14')](function(_0x150965){_0x51c0e3=_0x150965;if(_0x51c0e3){if(_0x51c0e3[_0xd8a3('0x1c')]){return _0x3ae283(_0xd8a3('0x1d'));}else if(_0x2c7a6d[_0xd8a3('0x13')]>0x0){if(_0x51c0e3[_0xd8a3('0x1e')]){if(moment(_0x51c0e3[_0xd8a3('0x1f')])[_0xd8a3('0x20')](_0x2c7a6d[_0xd8a3('0x13')],'minutes')>moment()){return _0x3ae283(_0xd8a3('0x1d'));}else{return utils['clearBlockUser'](_0x51c0e3,0x0,![],null)[_0xd8a3('0x14')](function(){return utils[_0xd8a3('0x21')](_0x51c0e3);})[_0xd8a3('0x14')](function(){return _0x3ae283(null,_0x51c0e3);});}}else{return utils[_0xd8a3('0x21')](_0x51c0e3)['then'](function(){return _0x3ae283(null,_0x51c0e3);});}}else{return utils[_0xd8a3('0x21')](_0x51c0e3)[_0xd8a3('0x14')](function(){return _0x3ae283(null,_0x51c0e3);});}}return _0x3ae283(_0xd8a3('0x1d'));})['catch'](function(_0x3b37d3){_0x3ae283(_0x3b37d3);});})); \ No newline at end of file +var _0x4570=['disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','callback','use','clientSecret','secret','callbackURL','blockDuration','then','User','find','map','emails','value','admin','agent'];(function(_0x34cae9,_0x361b8a){var _0x3d05f0=function(_0x3f16e9){while(--_0x3f16e9){_0x34cae9['push'](_0x34cae9['shift']());}};_0x3d05f0(++_0x361b8a);}(_0x4570,0x1b8));var _0x0457=function(_0x318f95,_0x568d3d){_0x318f95=_0x318f95-0x0;var _0xc79b90=_0x4570[_0x318f95];return _0xc79b90;};'use strict';var _=require(_0x0457('0x0'));var passport=require(_0x0457('0x1'));var GoogleStrategy=require(_0x0457('0x2'))['Strategy'];var moment=require(_0x0457('0x3'));var db=require(_0x0457('0x4'))['db'];var config=require(_0x0457('0x5'));var signToken=require(_0x0457('0x6'))[_0x0457('0x7')];var utils=require(_0x0457('0x8'));exports[_0x0457('0x9')]=passport[_0x0457('0xa')](_0x0457('0xb'),{'failureRedirect':_0x0457('0xc'),'scope':[_0x0457('0xd'),'email'],'session':![]});exports[_0x0457('0xe')]=passport[_0x0457('0xa')]('google',{'failureRedirect':_0x0457('0xc'),'session':![]});passport[_0x0457('0xf')](new GoogleStrategy({'clientID':config[_0x0457('0xb')]?config[_0x0457('0xb')]['clientID']:'id','clientSecret':config[_0x0457('0xb')]?config[_0x0457('0xb')][_0x0457('0x10')]:_0x0457('0x11'),'callbackURL':config[_0x0457('0xb')]?config[_0x0457('0xb')][_0x0457('0x12')]:''},function(_0x47b8da,_0x214eec,_0x2fd67e,_0x5c7278){var _0x515215,_0x5359cc;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0457('0x13')],'raw':!![]})[_0x0457('0x14')](function(_0x51e770){_0x515215=_0x51e770;return db[_0x0457('0x15')][_0x0457('0x16')]({'where':{'email':_[_0x0457('0x17')](_0x2fd67e[_0x0457('0x18')],_0x0457('0x19')),'role':{'$or':[_0x0457('0x1a'),'user',_0x0457('0x1b')]}}});})[_0x0457('0x14')](function(_0x1dec1b){_0x5359cc=_0x1dec1b;if(_0x5359cc){if(_0x5359cc[_0x0457('0x1c')]){return _0x5c7278(_0x0457('0x1d'));}else if(_0x515215['blockDuration']>0x0){if(_0x5359cc[_0x0457('0x1e')]){if(moment(_0x5359cc[_0x0457('0x1f')])['add'](_0x515215[_0x0457('0x13')],_0x0457('0x20'))>moment()){return _0x5c7278(_0x0457('0x1d'));}else{return utils[_0x0457('0x21')](_0x5359cc,0x0,![],null)[_0x0457('0x14')](function(){return utils[_0x0457('0x22')](_0x5359cc);})[_0x0457('0x14')](function(){return _0x5c7278(null,_0x5359cc);});}}else{return utils[_0x0457('0x22')](_0x5359cc)[_0x0457('0x14')](function(){return _0x5c7278(null,_0x5359cc);});}}else{return utils[_0x0457('0x22')](_0x5359cc)[_0x0457('0x14')](function(){return _0x5c7278(null,_0x5359cc);});}}return _0x5c7278(_0x0457('0x1d'));})[_0x0457('0x23')](function(_0x23b64b){_0x5c7278(_0x23b64b);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 4c80e10..7bac039 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 _0x4858=['express','passport','Router','../../components/auth/service','get','login','/callback','callback','isMiddleware','exports'];(function(_0x301e20,_0x2b70b5){var _0xfb758b=function(_0x579106){while(--_0x579106){_0x301e20['push'](_0x301e20['shift']());}};_0xfb758b(++_0x2b70b5);}(_0x4858,0x12c));var _0x8485=function(_0x1cc3f0,_0x3fe635){_0x1cc3f0=_0x1cc3f0-0x0;var _0x50fbe6=_0x4858[_0x1cc3f0];return _0x50fbe6;};'use strict';var express=require(_0x8485('0x0'));var passport=require(_0x8485('0x1'));var router=express[_0x8485('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x8485('0x3'));router[_0x8485('0x4')]('/',controller[_0x8485('0x5')]);router[_0x8485('0x4')](_0x8485('0x6'),controller[_0x8485('0x7')],authService[_0x8485('0x8')],userController[_0x8485('0x5')],authService['setTokenCookie']);module[_0x8485('0x9')]=router; \ No newline at end of file +var _0xaf50=['passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x1bfab8,_0x3cfaec){var _0x423f85=function(_0x2108c2){while(--_0x2108c2){_0x1bfab8['push'](_0x1bfab8['shift']());}};_0x423f85(++_0x3cfaec);}(_0xaf50,0x186));var _0x0af5=function(_0x2a86b1,_0x101e45){_0x2a86b1=_0x2a86b1-0x0;var _0x207fe8=_0xaf50[_0x2a86b1];return _0x207fe8;};'use strict';var express=require('express');var passport=require(_0x0af5('0x0'));var router=express['Router']();var controller=require(_0x0af5('0x1'));var userController=require(_0x0af5('0x2'));var authService=require(_0x0af5('0x3'));router[_0x0af5('0x4')]('/',controller[_0x0af5('0x5')]);router[_0x0af5('0x4')](_0x0af5('0x6'),controller[_0x0af5('0x7')],authService[_0x0af5('0x8')],userController['login'],authService[_0x0af5('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index ea783b9..32192d0 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 _0x2289=['minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','send','Reset\x20Email\x20sent!','reset','params','token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','clearBlockUser','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x10254d,_0x150e59){var _0x2a00e3=function(_0x3093f6){while(--_0x3093f6){_0x10254d['push'](_0x10254d['shift']());}};_0x2a00e3(++_0x150e59);}(_0x2289,0xc6));var _0x9228=function(_0x2b79f4,_0x50d267){_0x2b79f4=_0x2b79f4-0x0;var _0x111a9c=_0x2289[_0x2b79f4];return _0x111a9c;};'use strict';var util=require(_0x9228('0x0'));var passport=require(_0x9228('0x1'));var LocalStrategy=require(_0x9228('0x2'))['Strategy'];var jayson=require(_0x9228('0x3'));var _=require(_0x9228('0x4'));var rs=require(_0x9228('0x5'));var moment=require('moment');var db=require(_0x9228('0x6'))['db'];var authService=require(_0x9228('0x7'));var utils=require(_0x9228('0x8'));var client=jayson[_0x9228('0x9')][_0x9228('0xa')]({'port':0x232b});function localAuthenticate(_0x22c518,_0x4c6591,_0x2c8859,_0x4ccf04){var _0x1497a5,_0x39aec2;return db[_0x9228('0xb')][_0x9228('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9228('0xd')],'raw':!![]})['then'](function(_0x34ce70){_0x1497a5=_0x34ce70;return _0x22c518[_0x9228('0xc')]({'attributes':['id',_0x9228('0xe'),_0x9228('0xf'),_0x9228('0x10'),_0x9228('0x11'),_0x9228('0x12'),_0x9228('0x13'),_0x9228('0x14'),_0x9228('0x15')],'where':{'name':_0x4c6591,'role':{'$or':[_0x9228('0x16'),_0x9228('0x17'),_0x9228('0x18')]}}});})[_0x9228('0x19')](function(_0x99f523){if(!_0x99f523||_0x99f523&&_0x99f523['name']!==_0x4c6591){throw new Error(_0x9228('0x1a'));}else{_0x39aec2=_0x99f523;return _0x39aec2;}})[_0x9228('0x19')](function(){_0x39aec2['authenticate'](_0x2c8859,function(_0x920bad,_0x2efcaf){var _0x18e348=_0x39aec2['loginAttempts']+0x1;if(_0x920bad){return _0x4ccf04(_0x920bad);}else if(!_0x2efcaf){if(_0x39aec2[_0x9228('0x12')]){return _0x4ccf04(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1497a5[_0x9228('0x1b')]>0x0){if(_0x39aec2[_0x9228('0x13')]){if(_0x1497a5[_0x9228('0xd')]>0x0){if(moment(_0x39aec2[_0x9228('0x14')])[_0x9228('0x1c')](_0x1497a5[_0x9228('0xd')],'minutes')>moment()){return _0x4ccf04(null,![],{'message':_0x9228('0x1a')});}else{return utils[_0x9228('0x1d')](_0x39aec2,_0x18e348,![],null)[_0x9228('0x19')](function(){return _0x4ccf04(null,![],{'message':_0x9228('0x1a')});});}}else{return _0x4ccf04(null,![],{'message':_0x9228('0x1a')});}}else{if(_0x18e348>=_0x1497a5[_0x9228('0x1b')]){return utils[_0x9228('0x1d')](_0x39aec2,0x0,!![],moment())[_0x9228('0x19')](function(){return _0x4ccf04(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x9228('0x1d')](_0x39aec2,_0x18e348,![],null)[_0x9228('0x19')](function(){return _0x4ccf04(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x4ccf04(null,![],{'message':_0x9228('0x1a')});}}else{if(_0x39aec2['disabled']){return _0x4ccf04(null,![],{'message':_0x9228('0x1a')});}else if(_0x1497a5[_0x9228('0x1b')]>0x0){if(_0x39aec2[_0x9228('0x13')]){if(_0x1497a5[_0x9228('0xd')]>0x0){if(moment(_0x39aec2[_0x9228('0x14')])[_0x9228('0x1c')](_0x1497a5[_0x9228('0xd')],'minutes')>moment()){return _0x4ccf04(null,![],{'message':_0x9228('0x1a')});}else{return utils['clearBlockUser'](_0x39aec2,0x0,![],null)[_0x9228('0x19')](function(){return utils[_0x9228('0x1e')](_0x39aec2);})[_0x9228('0x19')](function(){return _0x4ccf04(null,_0x39aec2);});}}else{return _0x4ccf04(null,![],{'message':_0x9228('0x1a')});}}else{return utils['clearBlockUser'](_0x39aec2,0x0,![],null)[_0x9228('0x19')](function(){return utils[_0x9228('0x1e')](_0x39aec2);})['then'](function(){return _0x4ccf04(null,_0x39aec2);})[_0x9228('0x1f')](function(_0x57bb35){return _0x4ccf04(null,![],_0x57bb35);});}}else{if(_0x39aec2['blocked']){return _0x4ccf04(null,![],{'message':_0x9228('0x1a')});}else{return utils['getLicense'](_0x39aec2)['then'](function(){return _0x4ccf04(null,_0x39aec2);});}}}});})[_0x9228('0x1f')](function(_0x5d21aa){return _0x4ccf04(null,![],_0x5d21aa);});}function sendServiceMail(_0x4fe67b){return db['MailAccount'][_0x9228('0x20')]({'where':{'service':!![]},'attributes':['id',_0x9228('0xe'),_0x9228('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x9228('0x22')}]})[_0x9228('0x19')](function(_0x484a38){if(!_0x484a38){throw new Error(_0x9228('0x23'));}var _0x20aecc={'tls':{'rejectUnauthorized':![]}};if(_0x484a38[_0x9228('0x22')]['service']){_0x20aecc[_0x9228('0x24')]=_0x484a38[_0x9228('0x22')][_0x9228('0x24')];}else{_0x20aecc[_0x9228('0x25')]=_0x484a38[_0x9228('0x22')][_0x9228('0x25')];_0x20aecc[_0x9228('0x26')]=_0x484a38[_0x9228('0x22')]['port'];_0x20aecc[_0x9228('0x27')]=_0x484a38[_0x9228('0x22')][_0x9228('0x27')];}if(_0x484a38['Smtp']['authentication']){_0x20aecc['auth']={'user':_0x484a38[_0x9228('0x22')][_0x9228('0x17')],'pass':_0x484a38[_0x9228('0x22')][_0x9228('0x28')]};}var _0x4050bc={'account':_0x20aecc,'message':_[_0x9228('0x29')]({'from':util[_0x9228('0x2a')](_0x9228('0x2b'),_0x484a38['name'],_0x484a38[_0x9228('0x21')]||_0x484a38[_0x9228('0x22')][_0x9228('0x17')])},_0x4fe67b)};return client[_0x9228('0x2c')](_0x9228('0x2d'),_0x4050bc);})[_0x9228('0x19')](function(_0xffc4ca){if(_0xffc4ca['error']){throw new Error(util['format'](_0x9228('0x2e'),_0xffc4ca[_0x9228('0x2f')][_0x9228('0x30')]||JSON[_0x9228('0x31')](_0xffc4ca[_0x9228('0x2f')])));}return!![];});}function handleError(_0x58e786,_0xd81775,_0x4fa2f3){return _0x58e786[_0x9228('0x32')](_0xd81775||0x1f4)['send']({'message':_0x4fa2f3?_0x4fa2f3[_0x9228('0x30')]||_0x4fa2f3:''});}exports[_0x9228('0x33')]=function(_0x367646,_0x28368d,_0x30c27d){passport[_0x9228('0x34')](_0x9228('0x35'),function(_0xbbe1ab,_0x3467a2,_0xab223a){var _0xd25fb1=_0xbbe1ab||_0xab223a;if(_0xd25fb1){return handleError(_0x28368d,0x191,_0xd25fb1);}if(!_0x3467a2){return handleError(_0x28368d,0x194,{'message':_0x9228('0x36')});}else{var _0x668af4={'payload':{'id':_0x3467a2['id'],'role':_0x3467a2[_0x9228('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x9228('0x37')](_0x668af4)[_0x9228('0x19')](function(_0x5d194e){_0x28368d[_0x9228('0x38')]({'id':_0x3467a2['id'],'token':_0x5d194e,'statusCall':'','isAlreadyLogged':_0x3467a2[_0x9228('0x39')]});});}})(_0x367646,_0x28368d,_0x30c27d);};exports[_0x9228('0x3a')]=function(_0x31d16e,_0xd5ad24,_0x649f33){if(!_0x31d16e[_0x9228('0x3b')]['email']){return handleError(_0xd5ad24,0x1f4,{'message':_0x9228('0x3c')});}var _0x2e1557=rs[_0x9228('0x3d')]();_0x31d16e[_0x9228('0x3b')][_0x9228('0x21')]=_0x31d16e[_0x9228('0x3b')][_0x9228('0x21')][_0x9228('0x3e')]()[_0x9228('0x3f')]();var _0x3c5792;return db[_0x9228('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x9228('0x1b'),_0x9228('0xd')],'raw':!![]})[_0x9228('0x19')](function(_0x5133e2){_0x3c5792=_0x5133e2;return db[_0x9228('0x40')][_0x9228('0x20')]({'where':{'email':_0x31d16e[_0x9228('0x3b')][_0x9228('0x21')]}});})['then'](function(_0xed9a0b){if(!_0xed9a0b){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xed9a0b[_0x9228('0x12')]){throw new Error(_0x9228('0x41'));}if(_0xed9a0b[_0x9228('0x13')]){if(moment(_0xed9a0b['blockedAt'])[_0x9228('0x1c')](_0x3c5792[_0x9228('0xd')],_0x9228('0x42'))>moment()){throw new Error(_0x9228('0x43'));}else{_0xed9a0b['blocked']=![];_0xed9a0b['blockedAt']=null;}}_0xed9a0b[_0x9228('0x44')]=_0x2e1557;_0xed9a0b[_0x9228('0x45')]=Date['now']()+0x36ee80;return _0xed9a0b['save']();})[_0x9228('0x19')](function(){return sendServiceMail({'to':_0x31d16e[_0x9228('0x3b')]['email'],'subject':_0x9228('0x46'),'text':_0x9228('0x47')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x9228('0x48')+_0x31d16e[_0x9228('0x49')][_0x9228('0x25')]+'/reset/'+_0x2e1557+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x9228('0x19')](function(){_0xd5ad24['status'](0xc8)[_0x9228('0x4a')]({'message':_0x9228('0x4b')});})['catch'](function(_0x1b22a8){return handleError(_0xd5ad24,0x1f4,_0x1b22a8);});};exports[_0x9228('0x4c')]=function(_0x2b7c58,_0xdada7a,_0x15334a){return db[_0x9228('0x40')][_0x9228('0x20')]({'where':{'resetPasswordToken':_0x2b7c58[_0x9228('0x4d')][_0x9228('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x9228('0x4f')]()}}})[_0x9228('0x19')](function(_0x100802){if(!_0x100802){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x9228('0xb')]['findOne']({'attributes':['id',_0x9228('0x50'),_0x9228('0x51'),_0x9228('0x52')]})[_0x9228('0x19')](function(_0x5240a9){if(_0x5240a9[_0x9228('0x50')])authService['validatePasswordPattern'](_0x2b7c58[_0x9228('0x3b')][_0x9228('0xf')]);if(!_0x5240a9['enforcePasswordHistory']||!_0x100802[_0x9228('0x53')])return _0x100802;authService[_0x9228('0x54')](_0x2b7c58[_0x9228('0x3b')][_0x9228('0xf')],_0x100802[_0x9228('0x53')],_0x5240a9['passwordHistoryLimit']);return _0x100802;})[_0x9228('0x19')](function(){_0x100802[_0x9228('0xf')]=_0x2b7c58['body'][_0x9228('0xf')];_0x100802['resetPasswordToken']=null;_0x100802['resetPasswordExpires']=null;return _0x100802[_0x9228('0x55')]();});})['then'](function(){_0xdada7a['status'](0xc8)[_0x9228('0x4a')]({'message':_0x9228('0x56')});})[_0x9228('0x1f')](function(_0x426e11){return handleError(_0xdada7a,0x1f4,_0x426e11);});};passport[_0x9228('0x57')](new LocalStrategy({'usernameField':'name','passwordField':_0x9228('0xf')},function(_0x59029d,_0xaad680,_0x113e5e){return localAuthenticate(db[_0x9228('0x40')],_0x59029d,_0xaad680,_0x113e5e);})); \ No newline at end of file +var _0x3299=['now','save','xCally\x20Motion\x20Password\x20Reset','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','disabled','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','clearBlockUser','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','authentication','user','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','authenticate','local','role','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x3299,0x1bc));var _0x9329=function(_0x424a08,_0x56197c){_0x424a08=_0x424a08-0x0;var _0x23914c=_0x3299[_0x424a08];return _0x23914c;};'use strict';var util=require('util');var passport=require(_0x9329('0x0'));var LocalStrategy=require(_0x9329('0x1'))[_0x9329('0x2')];var jayson=require(_0x9329('0x3'));var _=require(_0x9329('0x4'));var rs=require(_0x9329('0x5'));var moment=require(_0x9329('0x6'));var db=require(_0x9329('0x7'))['db'];var authService=require(_0x9329('0x8'));var utils=require(_0x9329('0x9'));var client=jayson[_0x9329('0xa')][_0x9329('0xb')]({'port':0x232b});function localAuthenticate(_0x2238fc,_0x14bc45,_0x1fa6c4,_0x218cf3){var _0x182d15,_0x531cf1;return db[_0x9329('0xc')][_0x9329('0xd')]({'where':{'id':0x1},'attributes':[_0x9329('0xe'),_0x9329('0xf')],'raw':!![]})[_0x9329('0x10')](function(_0x53d176){_0x182d15=_0x53d176;return _0x2238fc[_0x9329('0xd')]({'attributes':['id',_0x9329('0x11'),'password','salt','role',_0x9329('0x12'),_0x9329('0x13'),_0x9329('0x14'),_0x9329('0x15')],'where':{'name':_0x14bc45,'role':{'$or':[_0x9329('0x16'),'user',_0x9329('0x17')]}}});})[_0x9329('0x10')](function(_0x10658d){if(!_0x10658d||_0x10658d&&_0x10658d['name']!==_0x14bc45){throw new Error(_0x9329('0x18'));}else{_0x531cf1=_0x10658d;return _0x531cf1;}})[_0x9329('0x10')](function(){_0x531cf1['authenticate'](_0x1fa6c4,function(_0x342e47,_0x1b2b98){var _0x4adc7e=_0x531cf1[_0x9329('0x15')]+0x1;if(_0x342e47){return _0x218cf3(_0x342e47);}else if(!_0x1b2b98){if(_0x531cf1[_0x9329('0x12')]){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else if(_0x182d15[_0x9329('0xe')]>0x0){if(_0x531cf1['blocked']){if(_0x182d15[_0x9329('0xf')]>0x0){if(moment(_0x531cf1['blockedAt'])[_0x9329('0x19')](_0x182d15[_0x9329('0xf')],'minutes')>moment()){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else{return utils[_0x9329('0x1a')](_0x531cf1,_0x4adc7e,![],null)['then'](function(){return _0x218cf3(null,![],{'message':_0x9329('0x18')});});}}else{return _0x218cf3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4adc7e>=_0x182d15[_0x9329('0xe')]){return utils['clearBlockUser'](_0x531cf1,0x0,!![],moment())[_0x9329('0x10')](function(){return _0x218cf3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x9329('0x1a')](_0x531cf1,_0x4adc7e,![],null)[_0x9329('0x10')](function(){return _0x218cf3(null,![],{'message':_0x9329('0x18')});});}}}else{return _0x218cf3(null,![],{'message':_0x9329('0x18')});}}else{if(_0x531cf1[_0x9329('0x12')]){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else if(_0x182d15['allowedLoginAttempts']>0x0){if(_0x531cf1[_0x9329('0x13')]){if(_0x182d15[_0x9329('0xf')]>0x0){if(moment(_0x531cf1[_0x9329('0x14')])[_0x9329('0x19')](_0x182d15[_0x9329('0xf')],'minutes')>moment()){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else{return utils[_0x9329('0x1a')](_0x531cf1,0x0,![],null)['then'](function(){return utils[_0x9329('0x1b')](_0x531cf1);})[_0x9329('0x10')](function(){return _0x218cf3(null,_0x531cf1);});}}else{return _0x218cf3(null,![],{'message':_0x9329('0x18')});}}else{return utils[_0x9329('0x1a')](_0x531cf1,0x0,![],null)['then'](function(){return utils['getLicense'](_0x531cf1);})[_0x9329('0x10')](function(){return _0x218cf3(null,_0x531cf1);})[_0x9329('0x1c')](function(_0x4419fc){return _0x218cf3(null,![],_0x4419fc);});}}else{if(_0x531cf1['blocked']){return _0x218cf3(null,![],{'message':_0x9329('0x18')});}else{return utils['getLicense'](_0x531cf1)[_0x9329('0x10')](function(){return _0x218cf3(null,_0x531cf1);});}}}});})[_0x9329('0x1c')](function(_0x40a0ce){return _0x218cf3(null,![],_0x40a0ce);});}function sendServiceMail(_0x573209){return db['MailAccount'][_0x9329('0x1d')]({'where':{'service':!![]},'attributes':['id','name',_0x9329('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x9329('0x1f')}]})['then'](function(_0x46fb80){if(!_0x46fb80){throw new Error(_0x9329('0x20'));}var _0x5cd7db={'tls':{'rejectUnauthorized':![]}};if(_0x46fb80[_0x9329('0x1f')][_0x9329('0x21')]){_0x5cd7db['service']=_0x46fb80[_0x9329('0x1f')][_0x9329('0x21')];}else{_0x5cd7db[_0x9329('0x22')]=_0x46fb80[_0x9329('0x1f')]['host'];_0x5cd7db['port']=_0x46fb80['Smtp'][_0x9329('0x23')];_0x5cd7db['secure']=_0x46fb80[_0x9329('0x1f')]['secure'];}if(_0x46fb80[_0x9329('0x1f')][_0x9329('0x24')]){_0x5cd7db['auth']={'user':_0x46fb80[_0x9329('0x1f')][_0x9329('0x25')],'pass':_0x46fb80[_0x9329('0x1f')][_0x9329('0x26')]};}var _0x5da06a={'account':_0x5cd7db,'message':_[_0x9329('0x27')]({'from':util[_0x9329('0x28')](_0x9329('0x29'),_0x46fb80[_0x9329('0x11')],_0x46fb80[_0x9329('0x1e')]||_0x46fb80[_0x9329('0x1f')]['user'])},_0x573209)};return client[_0x9329('0x2a')](_0x9329('0x2b'),_0x5da06a);})[_0x9329('0x10')](function(_0x3ae0a5){if(_0x3ae0a5[_0x9329('0x2c')]){throw new Error(util[_0x9329('0x28')](_0x9329('0x2d'),_0x3ae0a5[_0x9329('0x2c')]['message']||JSON[_0x9329('0x2e')](_0x3ae0a5['error'])));}return!![];});}function handleError(_0x11dc44,_0x22086e,_0x37475b){return _0x11dc44[_0x9329('0x2f')](_0x22086e||0x1f4)[_0x9329('0x30')]({'message':_0x37475b?_0x37475b[_0x9329('0x31')]||_0x37475b:''});}exports['login']=function(_0x5e8cb3,_0xec9ed4,_0x14afc8){passport[_0x9329('0x32')](_0x9329('0x33'),function(_0x45ed79,_0x329f95,_0x3a9e91){var _0x428287=_0x45ed79||_0x3a9e91;if(_0x428287){return handleError(_0xec9ed4,0x191,_0x428287);}if(!_0x329f95){return handleError(_0xec9ed4,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x397941={'payload':{'id':_0x329f95['id'],'role':_0x329f95[_0x9329('0x34')]},'options':{'expiresIn':0x15180}};return authService[_0x9329('0x35')](_0x397941)[_0x9329('0x10')](function(_0x5e459c){_0xec9ed4[_0x9329('0x36')]({'id':_0x329f95['id'],'token':_0x5e459c,'statusCall':'','isAlreadyLogged':_0x329f95['online']});});}})(_0x5e8cb3,_0xec9ed4,_0x14afc8);};exports[_0x9329('0x37')]=function(_0x52bdeb,_0x1a6009,_0x5d6e72){if(!_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')]){return handleError(_0x1a6009,0x1f4,{'message':_0x9329('0x39')});}var _0x222e33=rs['generate']();_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')]=_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')][_0x9329('0x3a')]()[_0x9329('0x3b')]();var _0x44aa65;return db['Setting'][_0x9329('0xd')]({'where':{'id':0x1},'attributes':[_0x9329('0xe'),_0x9329('0xf')],'raw':!![]})[_0x9329('0x10')](function(_0x5de63){_0x44aa65=_0x5de63;return db['User'][_0x9329('0x1d')]({'where':{'email':_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')]}});})[_0x9329('0x10')](function(_0x44303c){if(!_0x44303c){throw new Error(_0x9329('0x3c'));}if(_0x44303c[_0x9329('0x12')]){throw new Error(_0x9329('0x3d'));}if(_0x44303c['blocked']){if(moment(_0x44303c['blockedAt'])[_0x9329('0x19')](_0x44aa65['blockDuration'],_0x9329('0x3e'))>moment()){throw new Error(_0x9329('0x3f'));}else{_0x44303c[_0x9329('0x13')]=![];_0x44303c[_0x9329('0x14')]=null;}}_0x44303c[_0x9329('0x40')]=_0x222e33;_0x44303c[_0x9329('0x41')]=Date[_0x9329('0x42')]()+0x36ee80;return _0x44303c[_0x9329('0x43')]();})[_0x9329('0x10')](function(){return sendServiceMail({'to':_0x52bdeb[_0x9329('0x38')][_0x9329('0x1e')],'subject':_0x9329('0x44'),'text':'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'+_0x9329('0x45')+_0x52bdeb['headers'][_0x9329('0x22')]+_0x9329('0x46')+_0x222e33+'\x0a\x0a'+_0x9329('0x47')});})[_0x9329('0x10')](function(){_0x1a6009[_0x9329('0x2f')](0xc8)[_0x9329('0x30')]({'message':'Reset\x20Email\x20sent!'});})[_0x9329('0x1c')](function(_0x281d9b){return handleError(_0x1a6009,0x1f4,_0x281d9b);});};exports[_0x9329('0x48')]=function(_0x5a4adb,_0x45237e,_0x30f04a){return db[_0x9329('0x49')]['find']({'where':{'resetPasswordToken':_0x5a4adb[_0x9329('0x4a')][_0x9329('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x9329('0x42')]()}}})[_0x9329('0x10')](function(_0xc8de8){if(!_0xc8de8){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x9329('0xc')][_0x9329('0xd')]({'attributes':['id',_0x9329('0x4c'),_0x9329('0x4d'),_0x9329('0x4e')]})[_0x9329('0x10')](function(_0x312e4b){if(_0x312e4b[_0x9329('0x4c')])authService[_0x9329('0x4f')](_0x5a4adb['body'][_0x9329('0x50')]);if(!_0x312e4b[_0x9329('0x4d')]||!_0xc8de8[_0x9329('0x51')])return _0xc8de8;authService[_0x9329('0x52')](_0x5a4adb[_0x9329('0x38')][_0x9329('0x50')],_0xc8de8[_0x9329('0x51')],_0x312e4b['passwordHistoryLimit']);return _0xc8de8;})[_0x9329('0x10')](function(){_0xc8de8[_0x9329('0x50')]=_0x5a4adb[_0x9329('0x38')][_0x9329('0x50')];_0xc8de8[_0x9329('0x40')]=null;_0xc8de8[_0x9329('0x41')]=null;return _0xc8de8[_0x9329('0x43')]();});})[_0x9329('0x10')](function(){_0x45237e[_0x9329('0x2f')](0xc8)[_0x9329('0x30')]({'message':_0x9329('0x53')});})[_0x9329('0x1c')](function(_0x416baf){return handleError(_0x45237e,0x1f4,_0x416baf);});};passport[_0x9329('0x54')](new LocalStrategy({'usernameField':_0x9329('0x11'),'passwordField':_0x9329('0x50')},function(_0x4ac39c,_0x4ec675,_0x3d0c07){return localAuthenticate(db[_0x9329('0x49')],_0x4ac39c,_0x4ec675,_0x3d0c07);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a83be8a..3116327 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 _0x5d82=['login','forgot','/reset/:token','exports','express','Router','./authLocal.controller','post'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x5d82,0x1bc));var _0x25d8=function(_0x4363f8,_0x3dec7a){_0x4363f8=_0x4363f8-0x0;var _0x3c5151=_0x5d82[_0x4363f8];return _0x3c5151;};'use strict';var express=require(_0x25d8('0x0'));var router=express[_0x25d8('0x1')]();var controller=require(_0x25d8('0x2'));router[_0x25d8('0x3')]('/',controller[_0x25d8('0x4')]);router[_0x25d8('0x3')]('/forgot',controller[_0x25d8('0x5')]);router[_0x25d8('0x3')](_0x25d8('0x6'),controller['reset']);module[_0x25d8('0x7')]=router; \ No newline at end of file +var _0x7b7f=['post','exports','express','./authLocal.controller','login'];(function(_0x4a9331,_0x361ba8){var _0x484b3c=function(_0x1ceed6){while(--_0x1ceed6){_0x4a9331['push'](_0x4a9331['shift']());}};_0x484b3c(++_0x361ba8);}(_0x7b7f,0x174));var _0xf7b7=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x7b7f[_0x555b2f];return _0x81c0a6;};'use strict';var express=require(_0xf7b7('0x0'));var router=express['Router']();var controller=require(_0xf7b7('0x1'));router['post']('/',controller[_0xf7b7('0x2')]);router[_0xf7b7('0x3')]('/forgot',controller['forgot']);router[_0xf7b7('0x3')]('/reset/:token',controller['reset']);module[_0xf7b7('0x4')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 1f9e0b0..99c59d0 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 _0x4fc1=['sequelize','exports','STRING'];(function(_0x5cce17,_0xba5d47){var _0x189c0e=function(_0x5ca4cd){while(--_0x5ca4cd){_0x5cce17['push'](_0x5cce17['shift']());}};_0x189c0e(++_0xba5d47);}(_0x4fc1,0x99));var _0x14fc=function(_0x31e1b4,_0x1aba11){_0x31e1b4=_0x31e1b4-0x0;var _0x291b36=_0x4fc1[_0x31e1b4];return _0x291b36;};'use strict';var Sequelize=require(_0x14fc('0x0'));module[_0x14fc('0x1')]={'name':{'type':Sequelize[_0x14fc('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x14fc('0x2')]},'description':{'type':Sequelize[_0x14fc('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xed08=['INTEGER','sequelize','exports','STRING'];(function(_0x24e7b0,_0x23104f){var _0x1b09a1=function(_0xf17972){while(--_0xf17972){_0x24e7b0['push'](_0x24e7b0['shift']());}};_0x1b09a1(++_0x23104f);}(_0xed08,0xe1));var _0x8ed0=function(_0x11785a,_0x45a03e){_0x11785a=_0x11785a-0x0;var _0x2dec59=_0xed08[_0x11785a];return _0x2dec59;};'use strict';var Sequelize=require(_0x8ed0('0x0'));module[_0x8ed0('0x1')]={'name':{'type':Sequelize[_0x8ed0('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x8ed0('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8ed0('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index e434d23..c613370 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 _0x911e=['omit','getConditions','findOne','order','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','error','name','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Automation','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','addConditions','Condition','ids'];(function(_0x80dd86,_0x3829d6){var _0x357ba5=function(_0x5ed311){while(--_0x5ed311){_0x80dd86['push'](_0x80dd86['shift']());}};_0x357ba5(++_0x3829d6);}(_0x911e,0x1a1));var _0xe911=function(_0x1ad5d9,_0x525670){_0x1ad5d9=_0x1ad5d9-0x0;var _0x5ded9a=_0x911e[_0x1ad5d9];return _0x5ded9a;};'use strict';var emlformat=require(_0xe911('0x0'));var rimraf=require(_0xe911('0x1'));var zipdir=require(_0xe911('0x2'));var jsonpatch=require(_0xe911('0x3'));var rp=require(_0xe911('0x4'));var moment=require('moment');var BPromise=require(_0xe911('0x5'));var Mustache=require('mustache');var util=require(_0xe911('0x6'));var path=require(_0xe911('0x7'));var sox=require('sox');var csv=require(_0xe911('0x8'));var ejs=require(_0xe911('0x9'));var fs=require('fs');var fs_extra=require(_0xe911('0xa'));var _=require(_0xe911('0xb'));var squel=require(_0xe911('0xc'));var crypto=require(_0xe911('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe911('0x8'));var querystring=require(_0xe911('0xe'));var Papa=require(_0xe911('0xf'));var Redis=require(_0xe911('0x10'));var authService=require(_0xe911('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe911('0x12'));var hardwareService=require(_0xe911('0x13'));var logger=require(_0xe911('0x14'))(_0xe911('0x15'));var utils=require(_0xe911('0x16'));var config=require(_0xe911('0x17'));var licenseUtil=require(_0xe911('0x18'));var db=require(_0xe911('0x19'))['db'];function respondWithStatusCode(_0x2a0747,_0x30d02d){_0x30d02d=_0x30d02d||0xcc;return function(_0xa66857){if(_0xa66857){return _0x2a0747[_0xe911('0x1a')](_0x30d02d);}return _0x2a0747['status'](_0x30d02d)['end']();};}function respondWithResult(_0x59121f,_0x21f20c){_0x21f20c=_0x21f20c||0xc8;return function(_0x126fb1){if(_0x126fb1){return _0x59121f[_0xe911('0x1b')](_0x21f20c)[_0xe911('0x1c')](_0x126fb1);}};}function respondWithFilteredResult(_0x5d8720,_0x54f583){return function(_0x17ecd5){if(_0x17ecd5){var _0x14ada6=typeof _0x54f583[_0xe911('0x1d')]===_0xe911('0x1e')&&typeof _0x54f583[_0xe911('0x1f')]===_0xe911('0x1e');var _0x34de03=_0x17ecd5[_0xe911('0x20')];var _0x5cd972=_0x14ada6?0x0:_0x54f583[_0xe911('0x1d')];var _0x198cf8=_0x14ada6?_0x17ecd5[_0xe911('0x20')]:_0x54f583[_0xe911('0x1d')]+_0x54f583['limit'];var _0x2bcdb4;if(_0x198cf8>=_0x34de03){_0x198cf8=_0x34de03;_0x2bcdb4=0xc8;}else{_0x2bcdb4=0xce;}_0x5d8720['status'](_0x2bcdb4);return _0x5d8720['set'](_0xe911('0x21'),_0x5cd972+'-'+_0x198cf8+'/'+_0x34de03)[_0xe911('0x1c')](_0x17ecd5);}return null;};}function patchUpdates(_0x5d66ad){return function(_0x2daf50){try{jsonpatch['apply'](_0x2daf50,_0x5d66ad,!![]);}catch(_0x37c4db){return BPromise['reject'](_0x37c4db);}return _0x2daf50['save']();};}function saveUpdates(_0xe78946,_0x14cc2){return function(_0x917939){if(_0x917939){return _0x917939[_0xe911('0x22')](_0xe78946)['then'](function(_0xdf20b5){return _0xdf20b5;});}return null;};}function removeEntity(_0x499f74,_0x4a6ed5){return function(_0x546466){if(_0x546466){return _0x546466[_0xe911('0x23')]()[_0xe911('0x24')](function(){_0x499f74[_0xe911('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f954a,_0x5a9ef2){return function(_0x4238aa){if(!_0x4238aa){_0x1f954a[_0xe911('0x1a')](0x194);}return _0x4238aa;};}function handleError(_0x363b9e,_0x222298){_0x222298=_0x222298||0x1f4;return function(_0x207d3f){logger[_0xe911('0x25')](_0x207d3f['stack']);if(_0x207d3f[_0xe911('0x26')]){delete _0x207d3f[_0xe911('0x26')];}_0x363b9e[_0xe911('0x1b')](_0x222298)['send'](_0x207d3f);};}exports[_0xe911('0x27')]=function(_0x441623,_0x204237){var _0x43fc67={},_0x2f3e2f={},_0x575320={'count':0x0,'rows':[]};var _0x415f23=_[_0xe911('0x28')](db['Automation']['rawAttributes'],function(_0x3e088b){return{'name':_0x3e088b[_0xe911('0x29')],'type':_0x3e088b[_0xe911('0x2a')][_0xe911('0x2b')]};});_0x2f3e2f['model']=_[_0xe911('0x28')](_0x415f23,_0xe911('0x26'));_0x2f3e2f[_0xe911('0x2c')]=_[_0xe911('0x2d')](_0x441623[_0xe911('0x2c')]);_0x2f3e2f[_0xe911('0x2e')]=_[_0xe911('0x2f')](_0x2f3e2f[_0xe911('0x30')],_0x2f3e2f[_0xe911('0x2c')]);_0x43fc67[_0xe911('0x31')]=_[_0xe911('0x2f')](_0x2f3e2f[_0xe911('0x30')],qs['fields'](_0x441623[_0xe911('0x2c')][_0xe911('0x32')]));_0x43fc67[_0xe911('0x31')]=_0x43fc67['attributes']['length']?_0x43fc67['attributes']:_0x2f3e2f[_0xe911('0x30')];if(!_0x441623[_0xe911('0x2c')][_0xe911('0x33')](_0xe911('0x34'))){_0x43fc67[_0xe911('0x1f')]=qs['limit'](_0x441623[_0xe911('0x2c')][_0xe911('0x1f')]);_0x43fc67[_0xe911('0x1d')]=qs[_0xe911('0x1d')](_0x441623[_0xe911('0x2c')][_0xe911('0x1d')]);}_0x43fc67['order']=qs[_0xe911('0x35')](_0x441623[_0xe911('0x2c')]['sort']);_0x43fc67[_0xe911('0x36')]=qs['filters'](_[_0xe911('0x37')](_0x441623[_0xe911('0x2c')],_0x2f3e2f[_0xe911('0x2e')]),_0x415f23);if(_0x441623[_0xe911('0x2c')][_0xe911('0x38')]){_0x43fc67['where']=_['merge'](_0x43fc67[_0xe911('0x36')],{'$or':_[_0xe911('0x28')](_0x415f23,function(_0x142d54){if(_0x142d54[_0xe911('0x2a')]!=='VIRTUAL'){var _0x21a167={};_0x21a167[_0x142d54['name']]={'$like':'%'+_0x441623[_0xe911('0x2c')][_0xe911('0x38')]+'%'};return _0x21a167;}})});}_0x43fc67=_[_0xe911('0x39')]({},_0x43fc67,_0x441623[_0xe911('0x3a')]);var _0x243ad8={'where':_0x43fc67[_0xe911('0x36')]};return db[_0xe911('0x3b')][_0xe911('0x20')](_0x243ad8)[_0xe911('0x24')](function(_0x18ce84){_0x575320[_0xe911('0x20')]=_0x18ce84;if(_0x441623['query'][_0xe911('0x3c')]){_0x43fc67[_0xe911('0x3d')]=[{'all':!![]}];}return db[_0xe911('0x3b')][_0xe911('0x3e')](_0x43fc67);})[_0xe911('0x24')](function(_0x1cb056){_0x575320[_0xe911('0x3f')]=_0x1cb056;return _0x575320;})[_0xe911('0x24')](respondWithFilteredResult(_0x204237,_0x43fc67))[_0xe911('0x40')](handleError(_0x204237,null));};exports[_0xe911('0x41')]=function(_0x2713a8,_0x2d3068){var _0x3b5640={'raw':![],'where':{'id':_0x2713a8[_0xe911('0x42')]['id']}},_0x1b45bd={};_0x1b45bd[_0xe911('0x30')]=_[_0xe911('0x2d')](db[_0xe911('0x3b')][_0xe911('0x43')]);_0x1b45bd[_0xe911('0x2c')]=_['keys'](_0x2713a8[_0xe911('0x2c')]);_0x1b45bd[_0xe911('0x2e')]=_[_0xe911('0x2f')](_0x1b45bd[_0xe911('0x30')],_0x1b45bd['query']);_0x3b5640[_0xe911('0x31')]=_['intersection'](_0x1b45bd[_0xe911('0x30')],qs[_0xe911('0x32')](_0x2713a8[_0xe911('0x2c')][_0xe911('0x32')]));_0x3b5640[_0xe911('0x31')]=_0x3b5640[_0xe911('0x31')][_0xe911('0x44')]?_0x3b5640[_0xe911('0x31')]:_0x1b45bd[_0xe911('0x30')];if(_0x2713a8[_0xe911('0x2c')]['includeAll']){_0x3b5640[_0xe911('0x3d')]=[{'all':!![]}];}_0x3b5640=_[_0xe911('0x39')]({},_0x3b5640,_0x2713a8[_0xe911('0x3a')]);return db[_0xe911('0x3b')]['find'](_0x3b5640)['then'](handleEntityNotFound(_0x2d3068,null))[_0xe911('0x24')](respondWithResult(_0x2d3068,null))[_0xe911('0x40')](handleError(_0x2d3068,null));};exports[_0xe911('0x45')]=function(_0x10ee9b,_0x2211e8){return db[_0xe911('0x3b')][_0xe911('0x45')](_0x10ee9b[_0xe911('0x46')],{})[_0xe911('0x24')](respondWithResult(_0x2211e8,0xc9))[_0xe911('0x40')](handleError(_0x2211e8,null));};exports[_0xe911('0x22')]=function(_0x1f6f3e,_0x8e3f8e){if(_0x1f6f3e['body']['id']){delete _0x1f6f3e[_0xe911('0x46')]['id'];}return db['Automation'][_0xe911('0x47')]({'where':{'id':_0x1f6f3e['params']['id']}})['then'](handleEntityNotFound(_0x8e3f8e,null))[_0xe911('0x24')](saveUpdates(_0x1f6f3e[_0xe911('0x46')],null))[_0xe911('0x24')](respondWithResult(_0x8e3f8e,null))[_0xe911('0x40')](handleError(_0x8e3f8e,null));};exports['destroy']=function(_0x48b3d9,_0xaca135){return db[_0xe911('0x3b')][_0xe911('0x47')]({'where':{'id':_0x48b3d9['params']['id']}})[_0xe911('0x24')](handleEntityNotFound(_0xaca135,null))[_0xe911('0x24')](removeEntity(_0xaca135,null))[_0xe911('0x40')](handleError(_0xaca135,null));};exports[_0xe911('0x48')]=function(_0x271fd8,_0x490b38,_0x3238e4){return db[_0xe911('0x49')][_0xe911('0x47')]({'where':{'id':_0x271fd8[_0xe911('0x42')]['id']}})[_0xe911('0x24')](handleEntityNotFound(_0x490b38,null))[_0xe911('0x24')](function(_0x5ee23a){if(_0x5ee23a){return _0x5ee23a[_0xe911('0x48')](_0x271fd8['body'][_0xe911('0x4a')],_[_0xe911('0x4b')](_0x271fd8[_0xe911('0x46')],[_0xe911('0x4a'),'id'])||{});}})[_0xe911('0x24')](respondWithResult(_0x490b38,null))['catch'](handleError(_0x490b38,null));};exports[_0xe911('0x4c')]=function(_0x178d47,_0x1fa5bc,_0x10c432){var _0x256396={};var _0x547f48={};var _0x89e88f;var _0x53ac11;return db['Automation'][_0xe911('0x4d')]({'where':{'id':_0x178d47[_0xe911('0x42')]['id']}})['then'](handleEntityNotFound(_0x1fa5bc,null))['then'](function(_0x51783d){if(_0x51783d){_0x89e88f=_0x51783d;_0x547f48[_0xe911('0x30')]=_[_0xe911('0x2d')](db[_0xe911('0x49')][_0xe911('0x43')]);_0x547f48[_0xe911('0x2c')]=_[_0xe911('0x2d')](_0x178d47[_0xe911('0x2c')]);_0x547f48[_0xe911('0x2e')]=_[_0xe911('0x2f')](_0x547f48['model'],_0x547f48[_0xe911('0x2c')]);_0x256396[_0xe911('0x31')]=_[_0xe911('0x2f')](_0x547f48['model'],qs[_0xe911('0x32')](_0x178d47[_0xe911('0x2c')]['fields']));_0x256396['attributes']=_0x256396[_0xe911('0x31')]['length']?_0x256396[_0xe911('0x31')]:_0x547f48['model'];_0x256396[_0xe911('0x4e')]=qs['sort'](_0x178d47[_0xe911('0x2c')][_0xe911('0x35')]);_0x256396[_0xe911('0x36')]=qs[_0xe911('0x2e')](_[_0xe911('0x37')](_0x178d47[_0xe911('0x2c')],_0x547f48[_0xe911('0x2e')]));if(_0x178d47[_0xe911('0x2c')]['filter']){_0x256396['where']=_['merge'](_0x256396[_0xe911('0x36')],{'$or':_[_0xe911('0x28')](_0x256396[_0xe911('0x31')],function(_0x5c1dd4){var _0x28b86d={};_0x28b86d[_0x5c1dd4]={'$like':'%'+_0x178d47[_0xe911('0x2c')][_0xe911('0x38')]+'%'};return _0x28b86d;})});}_0x256396=_['merge']({},_0x256396,_0x178d47[_0xe911('0x3a')]);return _0x89e88f['getConditions'](_0x256396);}})['then'](function(_0x4e50ca){if(_0x4e50ca){_0x53ac11=_0x4e50ca[_0xe911('0x44')];if(!_0x178d47[_0xe911('0x2c')][_0xe911('0x33')](_0xe911('0x34'))){_0x256396[_0xe911('0x1f')]=qs['limit'](_0x178d47[_0xe911('0x2c')][_0xe911('0x1f')]);_0x256396[_0xe911('0x1d')]=qs[_0xe911('0x1d')](_0x178d47['query'][_0xe911('0x1d')]);}return _0x89e88f[_0xe911('0x4c')](_0x256396);}})['then'](function(_0xa0bfa1){if(_0xa0bfa1){return _0xa0bfa1?{'count':_0x53ac11,'rows':_0xa0bfa1}:null;}})[_0xe911('0x24')](respondWithResult(_0x1fa5bc,null))[_0xe911('0x40')](handleError(_0x1fa5bc,null));};exports[_0xe911('0x4f')]=function(_0x56ddca,_0x41e847,_0x2cc25b){return db[_0xe911('0x50')][_0xe911('0x47')]({'where':{'id':_0x56ddca[_0xe911('0x42')]['id']}})['then'](handleEntityNotFound(_0x41e847,null))[_0xe911('0x24')](function(_0x30facf){if(_0x30facf){return _0x30facf[_0xe911('0x4f')](_0x56ddca['body'][_0xe911('0x4a')],_[_0xe911('0x4b')](_0x56ddca['body'],[_0xe911('0x4a'),'id'])||{});}})[_0xe911('0x24')](respondWithResult(_0x41e847,null))[_0xe911('0x40')](handleError(_0x41e847,null));};exports[_0xe911('0x51')]=function(_0x2836ed,_0x44a91a,_0x43c9e2){var _0x5a4c31={};var _0x566c3c={};var _0x10588e;var _0x351fe6;return db['Automation'][_0xe911('0x4d')]({'where':{'id':_0x2836ed['params']['id']}})[_0xe911('0x24')](handleEntityNotFound(_0x44a91a,null))[_0xe911('0x24')](function(_0x57e6a7){if(_0x57e6a7){_0x10588e=_0x57e6a7;_0x566c3c['model']=_[_0xe911('0x2d')](db['Action']['rawAttributes']);_0x566c3c[_0xe911('0x2c')]=_[_0xe911('0x2d')](_0x2836ed[_0xe911('0x2c')]);_0x566c3c[_0xe911('0x2e')]=_[_0xe911('0x2f')](_0x566c3c['model'],_0x566c3c[_0xe911('0x2c')]);_0x5a4c31[_0xe911('0x31')]=_[_0xe911('0x2f')](_0x566c3c[_0xe911('0x30')],qs[_0xe911('0x32')](_0x2836ed[_0xe911('0x2c')][_0xe911('0x32')]));_0x5a4c31[_0xe911('0x31')]=_0x5a4c31[_0xe911('0x31')][_0xe911('0x44')]?_0x5a4c31[_0xe911('0x31')]:_0x566c3c['model'];_0x5a4c31['order']=qs[_0xe911('0x35')](_0x2836ed[_0xe911('0x2c')][_0xe911('0x35')]);_0x5a4c31[_0xe911('0x36')]=qs[_0xe911('0x2e')](_['pick'](_0x2836ed[_0xe911('0x2c')],_0x566c3c['filters']));if(_0x2836ed[_0xe911('0x2c')][_0xe911('0x38')]){_0x5a4c31[_0xe911('0x36')]=_[_0xe911('0x39')](_0x5a4c31[_0xe911('0x36')],{'$or':_[_0xe911('0x28')](_0x5a4c31[_0xe911('0x31')],function(_0x4a7957){var _0x5e5956={};_0x5e5956[_0x4a7957]={'$like':'%'+_0x2836ed[_0xe911('0x2c')][_0xe911('0x38')]+'%'};return _0x5e5956;})});}_0x5a4c31=_[_0xe911('0x39')]({},_0x5a4c31,_0x2836ed['options']);return _0x10588e[_0xe911('0x51')](_0x5a4c31);}})['then'](function(_0xde1168){if(_0xde1168){_0x351fe6=_0xde1168[_0xe911('0x44')];if(!_0x2836ed[_0xe911('0x2c')][_0xe911('0x33')](_0xe911('0x34'))){_0x5a4c31[_0xe911('0x1f')]=qs['limit'](_0x2836ed['query'][_0xe911('0x1f')]);_0x5a4c31[_0xe911('0x1d')]=qs[_0xe911('0x1d')](_0x2836ed['query'][_0xe911('0x1d')]);}return _0x10588e[_0xe911('0x51')](_0x5a4c31);}})[_0xe911('0x24')](function(_0x38623a){if(_0x38623a){return _0x38623a?{'count':_0x351fe6,'rows':_0x38623a}:null;}})[_0xe911('0x24')](respondWithResult(_0x44a91a,null))[_0xe911('0x40')](handleError(_0x44a91a,null));}; \ No newline at end of file +var _0x0643=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','Automation','includeAll','include','rows','catch','show','params','create','body','addConditions','find','ids','omit','Condition','hasOwnProperty','getConditions','addActions','Action','getActions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0643,0x19b));var _0x3064=function(_0x488ebf,_0x4ba59a){_0x488ebf=_0x488ebf-0x0;var _0x1d3276=_0x0643[_0x488ebf];return _0x1d3276;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3064('0x0'));var zipdir=require(_0x3064('0x1'));var jsonpatch=require(_0x3064('0x2'));var rp=require(_0x3064('0x3'));var moment=require(_0x3064('0x4'));var BPromise=require(_0x3064('0x5'));var Mustache=require(_0x3064('0x6'));var util=require(_0x3064('0x7'));var path=require(_0x3064('0x8'));var sox=require('sox');var csv=require(_0x3064('0x9'));var ejs=require(_0x3064('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3064('0xb'));var squel=require(_0x3064('0xc'));var crypto=require(_0x3064('0xd'));var jsforce=require(_0x3064('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3064('0x9'));var querystring=require(_0x3064('0xf'));var Papa=require('papaparse');var Redis=require(_0x3064('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3064('0x11'));var as=require(_0x3064('0x12'));var hardwareService=require(_0x3064('0x13'));var logger=require(_0x3064('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3064('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3064('0x16'))['db'];function respondWithStatusCode(_0x18a295,_0x328590){_0x328590=_0x328590||0xcc;return function(_0x37e3e6){if(_0x37e3e6){return _0x18a295[_0x3064('0x17')](_0x328590);}return _0x18a295[_0x3064('0x18')](_0x328590)[_0x3064('0x19')]();};}function respondWithResult(_0x49fa13,_0x56ea60){_0x56ea60=_0x56ea60||0xc8;return function(_0x1e423f){if(_0x1e423f){return _0x49fa13[_0x3064('0x18')](_0x56ea60)[_0x3064('0x1a')](_0x1e423f);}};}function respondWithFilteredResult(_0x50f262,_0x240560){return function(_0x3ac421){if(_0x3ac421){var _0x3c0c28=typeof _0x240560[_0x3064('0x1b')]===_0x3064('0x1c')&&typeof _0x240560[_0x3064('0x1d')]===_0x3064('0x1c');var _0x35a88a=_0x3ac421[_0x3064('0x1e')];var _0x181958=_0x3c0c28?0x0:_0x240560['offset'];var _0x19a1b8=_0x3c0c28?_0x3ac421['count']:_0x240560[_0x3064('0x1b')]+_0x240560[_0x3064('0x1d')];var _0x57cfc7;if(_0x19a1b8>=_0x35a88a){_0x19a1b8=_0x35a88a;_0x57cfc7=0xc8;}else{_0x57cfc7=0xce;}_0x50f262[_0x3064('0x18')](_0x57cfc7);return _0x50f262[_0x3064('0x1f')](_0x3064('0x20'),_0x181958+'-'+_0x19a1b8+'/'+_0x35a88a)['json'](_0x3ac421);}return null;};}function patchUpdates(_0x324c02){return function(_0x286c55){try{jsonpatch['apply'](_0x286c55,_0x324c02,!![]);}catch(_0x1978cf){return BPromise[_0x3064('0x21')](_0x1978cf);}return _0x286c55[_0x3064('0x22')]();};}function saveUpdates(_0x5a1acb,_0x28f68d){return function(_0x444ede){if(_0x444ede){return _0x444ede[_0x3064('0x23')](_0x5a1acb)[_0x3064('0x24')](function(_0xa27d94){return _0xa27d94;});}return null;};}function removeEntity(_0x46c587,_0x51324b){return function(_0x1849ad){if(_0x1849ad){return _0x1849ad[_0x3064('0x25')]()['then'](function(){_0x46c587['status'](0xcc)[_0x3064('0x19')]();});}};}function handleEntityNotFound(_0x36f1eb,_0x18e31a){return function(_0x507f3a){if(!_0x507f3a){_0x36f1eb[_0x3064('0x17')](0x194);}return _0x507f3a;};}function handleError(_0x4afe82,_0x4d8ab0){_0x4d8ab0=_0x4d8ab0||0x1f4;return function(_0x2048a4){logger[_0x3064('0x26')](_0x2048a4['stack']);if(_0x2048a4[_0x3064('0x27')]){delete _0x2048a4[_0x3064('0x27')];}_0x4afe82[_0x3064('0x18')](_0x4d8ab0)[_0x3064('0x28')](_0x2048a4);};}exports[_0x3064('0x29')]=function(_0x3cd7df,_0x6660f4){var _0x1c53b3={},_0x296cea={},_0x5bbd12={'count':0x0,'rows':[]};var _0x5e5a46=_[_0x3064('0x2a')](db['Automation'][_0x3064('0x2b')],function(_0x4e7253){return{'name':_0x4e7253[_0x3064('0x2c')],'type':_0x4e7253[_0x3064('0x2d')][_0x3064('0x2e')]};});_0x296cea['model']=_['map'](_0x5e5a46,_0x3064('0x27'));_0x296cea['query']=_[_0x3064('0x2f')](_0x3cd7df[_0x3064('0x30')]);_0x296cea[_0x3064('0x31')]=_[_0x3064('0x32')](_0x296cea[_0x3064('0x33')],_0x296cea[_0x3064('0x30')]);_0x1c53b3[_0x3064('0x34')]=_[_0x3064('0x32')](_0x296cea['model'],qs[_0x3064('0x35')](_0x3cd7df['query'][_0x3064('0x35')]));_0x1c53b3[_0x3064('0x34')]=_0x1c53b3[_0x3064('0x34')][_0x3064('0x36')]?_0x1c53b3[_0x3064('0x34')]:_0x296cea[_0x3064('0x33')];if(!_0x3cd7df[_0x3064('0x30')]['hasOwnProperty'](_0x3064('0x37'))){_0x1c53b3[_0x3064('0x1d')]=qs[_0x3064('0x1d')](_0x3cd7df[_0x3064('0x30')][_0x3064('0x1d')]);_0x1c53b3['offset']=qs[_0x3064('0x1b')](_0x3cd7df['query']['offset']);}_0x1c53b3[_0x3064('0x38')]=qs[_0x3064('0x39')](_0x3cd7df['query'][_0x3064('0x39')]);_0x1c53b3['where']=qs[_0x3064('0x31')](_[_0x3064('0x3a')](_0x3cd7df[_0x3064('0x30')],_0x296cea[_0x3064('0x31')]),_0x5e5a46);if(_0x3cd7df[_0x3064('0x30')]['filter']){_0x1c53b3[_0x3064('0x3b')]=_[_0x3064('0x3c')](_0x1c53b3[_0x3064('0x3b')],{'$or':_[_0x3064('0x2a')](_0x5e5a46,function(_0x4cfc95){if(_0x4cfc95[_0x3064('0x2d')]!==_0x3064('0x3d')){var _0x44ce00={};_0x44ce00[_0x4cfc95['name']]={'$like':'%'+_0x3cd7df[_0x3064('0x30')][_0x3064('0x3e')]+'%'};return _0x44ce00;}})});}_0x1c53b3=_['merge']({},_0x1c53b3,_0x3cd7df[_0x3064('0x3f')]);var _0x492e12={'where':_0x1c53b3[_0x3064('0x3b')]};return db[_0x3064('0x40')][_0x3064('0x1e')](_0x492e12)[_0x3064('0x24')](function(_0x35aeb6){_0x5bbd12['count']=_0x35aeb6;if(_0x3cd7df[_0x3064('0x30')][_0x3064('0x41')]){_0x1c53b3[_0x3064('0x42')]=[{'all':!![]}];}return db[_0x3064('0x40')]['findAll'](_0x1c53b3);})[_0x3064('0x24')](function(_0x45035e){_0x5bbd12[_0x3064('0x43')]=_0x45035e;return _0x5bbd12;})['then'](respondWithFilteredResult(_0x6660f4,_0x1c53b3))[_0x3064('0x44')](handleError(_0x6660f4,null));};exports[_0x3064('0x45')]=function(_0x48767b,_0x2bd9be){var _0x40161e={'raw':![],'where':{'id':_0x48767b[_0x3064('0x46')]['id']}},_0x5e1c3f={};_0x5e1c3f[_0x3064('0x33')]=_[_0x3064('0x2f')](db[_0x3064('0x40')][_0x3064('0x2b')]);_0x5e1c3f[_0x3064('0x30')]=_[_0x3064('0x2f')](_0x48767b[_0x3064('0x30')]);_0x5e1c3f[_0x3064('0x31')]=_[_0x3064('0x32')](_0x5e1c3f[_0x3064('0x33')],_0x5e1c3f['query']);_0x40161e['attributes']=_[_0x3064('0x32')](_0x5e1c3f['model'],qs[_0x3064('0x35')](_0x48767b[_0x3064('0x30')][_0x3064('0x35')]));_0x40161e[_0x3064('0x34')]=_0x40161e['attributes'][_0x3064('0x36')]?_0x40161e[_0x3064('0x34')]:_0x5e1c3f[_0x3064('0x33')];if(_0x48767b[_0x3064('0x30')][_0x3064('0x41')]){_0x40161e['include']=[{'all':!![]}];}_0x40161e=_['merge']({},_0x40161e,_0x48767b[_0x3064('0x3f')]);return db[_0x3064('0x40')]['find'](_0x40161e)[_0x3064('0x24')](handleEntityNotFound(_0x2bd9be,null))[_0x3064('0x24')](respondWithResult(_0x2bd9be,null))['catch'](handleError(_0x2bd9be,null));};exports[_0x3064('0x47')]=function(_0x549a48,_0x4698dd){return db[_0x3064('0x40')][_0x3064('0x47')](_0x549a48[_0x3064('0x48')],{})[_0x3064('0x24')](respondWithResult(_0x4698dd,0xc9))['catch'](handleError(_0x4698dd,null));};exports['update']=function(_0x3d238f,_0x79529d){if(_0x3d238f[_0x3064('0x48')]['id']){delete _0x3d238f[_0x3064('0x48')]['id'];}return db[_0x3064('0x40')]['find']({'where':{'id':_0x3d238f[_0x3064('0x46')]['id']}})['then'](handleEntityNotFound(_0x79529d,null))[_0x3064('0x24')](saveUpdates(_0x3d238f[_0x3064('0x48')],null))[_0x3064('0x24')](respondWithResult(_0x79529d,null))[_0x3064('0x44')](handleError(_0x79529d,null));};exports['destroy']=function(_0x3b4278,_0x493c23){return db[_0x3064('0x40')]['find']({'where':{'id':_0x3b4278[_0x3064('0x46')]['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x493c23,null))[_0x3064('0x24')](removeEntity(_0x493c23,null))[_0x3064('0x44')](handleError(_0x493c23,null));};exports[_0x3064('0x49')]=function(_0x121a49,_0x1f39ef,_0x26af7d){return db['Condition'][_0x3064('0x4a')]({'where':{'id':_0x121a49[_0x3064('0x46')]['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x1f39ef,null))[_0x3064('0x24')](function(_0x10f28d){if(_0x10f28d){return _0x10f28d[_0x3064('0x49')](_0x121a49['body'][_0x3064('0x4b')],_[_0x3064('0x4c')](_0x121a49[_0x3064('0x48')],[_0x3064('0x4b'),'id'])||{});}})[_0x3064('0x24')](respondWithResult(_0x1f39ef,null))[_0x3064('0x44')](handleError(_0x1f39ef,null));};exports['getConditions']=function(_0xe697c1,_0x474fb3,_0xeab094){var _0x117bd6={};var _0x1406a0={};var _0x8a893a;var _0x5d3eee;return db[_0x3064('0x40')]['findOne']({'where':{'id':_0xe697c1[_0x3064('0x46')]['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x474fb3,null))[_0x3064('0x24')](function(_0x26a6a0){if(_0x26a6a0){_0x8a893a=_0x26a6a0;_0x1406a0['model']=_[_0x3064('0x2f')](db[_0x3064('0x4d')][_0x3064('0x2b')]);_0x1406a0[_0x3064('0x30')]=_[_0x3064('0x2f')](_0xe697c1['query']);_0x1406a0[_0x3064('0x31')]=_['intersection'](_0x1406a0[_0x3064('0x33')],_0x1406a0[_0x3064('0x30')]);_0x117bd6['attributes']=_[_0x3064('0x32')](_0x1406a0[_0x3064('0x33')],qs['fields'](_0xe697c1[_0x3064('0x30')]['fields']));_0x117bd6[_0x3064('0x34')]=_0x117bd6['attributes']['length']?_0x117bd6['attributes']:_0x1406a0['model'];_0x117bd6[_0x3064('0x38')]=qs[_0x3064('0x39')](_0xe697c1[_0x3064('0x30')][_0x3064('0x39')]);_0x117bd6[_0x3064('0x3b')]=qs[_0x3064('0x31')](_[_0x3064('0x3a')](_0xe697c1[_0x3064('0x30')],_0x1406a0[_0x3064('0x31')]));if(_0xe697c1['query'][_0x3064('0x3e')]){_0x117bd6[_0x3064('0x3b')]=_['merge'](_0x117bd6[_0x3064('0x3b')],{'$or':_[_0x3064('0x2a')](_0x117bd6['attributes'],function(_0x162133){var _0x16701e={};_0x16701e[_0x162133]={'$like':'%'+_0xe697c1[_0x3064('0x30')][_0x3064('0x3e')]+'%'};return _0x16701e;})});}_0x117bd6=_[_0x3064('0x3c')]({},_0x117bd6,_0xe697c1['options']);return _0x8a893a['getConditions'](_0x117bd6);}})['then'](function(_0x4d5083){if(_0x4d5083){_0x5d3eee=_0x4d5083['length'];if(!_0xe697c1['query'][_0x3064('0x4e')](_0x3064('0x37'))){_0x117bd6[_0x3064('0x1d')]=qs[_0x3064('0x1d')](_0xe697c1[_0x3064('0x30')]['limit']);_0x117bd6[_0x3064('0x1b')]=qs[_0x3064('0x1b')](_0xe697c1[_0x3064('0x30')][_0x3064('0x1b')]);}return _0x8a893a[_0x3064('0x4f')](_0x117bd6);}})[_0x3064('0x24')](function(_0x4f6737){if(_0x4f6737){return _0x4f6737?{'count':_0x5d3eee,'rows':_0x4f6737}:null;}})[_0x3064('0x24')](respondWithResult(_0x474fb3,null))[_0x3064('0x44')](handleError(_0x474fb3,null));};exports[_0x3064('0x50')]=function(_0x529e59,_0x4147ae,_0x5f0b66){return db[_0x3064('0x51')][_0x3064('0x4a')]({'where':{'id':_0x529e59['params']['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x4147ae,null))[_0x3064('0x24')](function(_0x27e40a){if(_0x27e40a){return _0x27e40a[_0x3064('0x50')](_0x529e59[_0x3064('0x48')][_0x3064('0x4b')],_[_0x3064('0x4c')](_0x529e59[_0x3064('0x48')],[_0x3064('0x4b'),'id'])||{});}})[_0x3064('0x24')](respondWithResult(_0x4147ae,null))[_0x3064('0x44')](handleError(_0x4147ae,null));};exports[_0x3064('0x52')]=function(_0x24eab9,_0x36721c,_0x261b5a){var _0x2e5253={};var _0x1c6df4={};var _0x58c3af;var _0x1b16c0;return db[_0x3064('0x40')][_0x3064('0x53')]({'where':{'id':_0x24eab9[_0x3064('0x46')]['id']}})[_0x3064('0x24')](handleEntityNotFound(_0x36721c,null))[_0x3064('0x24')](function(_0x3b9729){if(_0x3b9729){_0x58c3af=_0x3b9729;_0x1c6df4[_0x3064('0x33')]=_[_0x3064('0x2f')](db[_0x3064('0x51')]['rawAttributes']);_0x1c6df4[_0x3064('0x30')]=_[_0x3064('0x2f')](_0x24eab9[_0x3064('0x30')]);_0x1c6df4[_0x3064('0x31')]=_[_0x3064('0x32')](_0x1c6df4[_0x3064('0x33')],_0x1c6df4['query']);_0x2e5253[_0x3064('0x34')]=_[_0x3064('0x32')](_0x1c6df4[_0x3064('0x33')],qs['fields'](_0x24eab9['query'][_0x3064('0x35')]));_0x2e5253[_0x3064('0x34')]=_0x2e5253[_0x3064('0x34')]['length']?_0x2e5253[_0x3064('0x34')]:_0x1c6df4[_0x3064('0x33')];_0x2e5253[_0x3064('0x38')]=qs[_0x3064('0x39')](_0x24eab9['query'][_0x3064('0x39')]);_0x2e5253[_0x3064('0x3b')]=qs[_0x3064('0x31')](_['pick'](_0x24eab9[_0x3064('0x30')],_0x1c6df4['filters']));if(_0x24eab9[_0x3064('0x30')][_0x3064('0x3e')]){_0x2e5253['where']=_['merge'](_0x2e5253[_0x3064('0x3b')],{'$or':_['map'](_0x2e5253[_0x3064('0x34')],function(_0x5d75aa){var _0x9c89a={};_0x9c89a[_0x5d75aa]={'$like':'%'+_0x24eab9['query']['filter']+'%'};return _0x9c89a;})});}_0x2e5253=_[_0x3064('0x3c')]({},_0x2e5253,_0x24eab9[_0x3064('0x3f')]);return _0x58c3af[_0x3064('0x52')](_0x2e5253);}})['then'](function(_0x4441c){if(_0x4441c){_0x1b16c0=_0x4441c['length'];if(!_0x24eab9['query'][_0x3064('0x4e')](_0x3064('0x37'))){_0x2e5253[_0x3064('0x1d')]=qs[_0x3064('0x1d')](_0x24eab9[_0x3064('0x30')]['limit']);_0x2e5253[_0x3064('0x1b')]=qs[_0x3064('0x1b')](_0x24eab9['query']['offset']);}return _0x58c3af[_0x3064('0x52')](_0x2e5253);}})[_0x3064('0x24')](function(_0x41a02d){if(_0x41a02d){return _0x41a02d?{'count':_0x1b16c0,'rows':_0x41a02d}:null;}})[_0x3064('0x24')](respondWithResult(_0x36721c,null))[_0x3064('0x44')](handleError(_0x36721c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index cba1d5e..1bd5ad3 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 _0x9f18=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9f18,0x193));var _0x89f1=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0x9f18[_0x2af053];return _0x4b4001;};'use strict';var _=require(_0x89f1('0x0'));var util=require(_0x89f1('0x1'));var logger=require(_0x89f1('0x2'))(_0x89f1('0x3'));var moment=require(_0x89f1('0x4'));var BPromise=require(_0x89f1('0x5'));var rp=require(_0x89f1('0x6'));var fs=require('fs');var path=require(_0x89f1('0x7'));var rimraf=require(_0x89f1('0x8'));var config=require(_0x89f1('0x9'));var attributes=require(_0x89f1('0xa'));module[_0x89f1('0xb')]=function(_0x275601,_0x1b29d1){return _0x275601['define'](_0x89f1('0xc'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x161d=['bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','Automation','tools_automations','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x161d,0xf8));var _0xd161=function(_0x79c523,_0x472ff9){_0x79c523=_0x79c523-0x0;var _0x42a0b5=_0x161d[_0x79c523];return _0x42a0b5;};'use strict';var _=require('lodash');var util=require(_0xd161('0x0'));var logger=require('../../config/logger')(_0xd161('0x1'));var moment=require('moment');var BPromise=require(_0xd161('0x2'));var rp=require(_0xd161('0x3'));var fs=require('fs');var path=require(_0xd161('0x4'));var rimraf=require('rimraf');var config=require(_0xd161('0x5'));var attributes=require(_0xd161('0x6'));module[_0xd161('0x7')]=function(_0x1790ac,_0x1bf38b){return _0x1790ac['define'](_0xd161('0x8'),attributes,{'tableName':_0xd161('0x9'),'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 c3ae2e3..b7a976b 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 _0x0c19=['message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x395fc2,_0x26eda7){var _0x48e0c6=function(_0x6f9629){while(--_0x6f9629){_0x395fc2['push'](_0x395fc2['shift']());}};_0x48e0c6(++_0x26eda7);}(_0x0c19,0xf5));var _0x90c1=function(_0x78529b,_0xa31d76){_0x78529b=_0x78529b-0x0;var _0x19f1c6=_0x0c19[_0x78529b];return _0x19f1c6;};'use strict';var _=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var moment=require(_0x90c1('0x2'));var BPromise=require(_0x90c1('0x3'));var rs=require(_0x90c1('0x4'));var fs=require('fs');var Redis=require(_0x90c1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x90c1('0x6'));var logger=require(_0x90c1('0x7'))(_0x90c1('0x8'));var config=require('../../config/environment');var jayson=require(_0x90c1('0x9'));var client=jayson[_0x90c1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440f7a,_0x954ac4,_0x37d247){return new BPromise(function(_0x2ed328,_0x351d07){return client[_0x90c1('0xb')](_0x440f7a,_0x37d247)[_0x90c1('0xc')](function(_0x4895b5){logger[_0x90c1('0xd')](_0x90c1('0xe'),_0x954ac4,'request\x20sent');logger[_0x90c1('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x954ac4,'request\x20sent',JSON[_0x90c1('0x10')](_0x4895b5));if(_0x4895b5['error']){if(_0x4895b5[_0x90c1('0x11')][_0x90c1('0x12')]===0x1f4){logger[_0x90c1('0x11')](_0x90c1('0xe'),_0x954ac4,_0x4895b5['error']['message']);return _0x351d07(_0x4895b5[_0x90c1('0x11')][_0x90c1('0x13')]);}logger[_0x90c1('0x11')](_0x90c1('0xe'),_0x954ac4,_0x4895b5['error'][_0x90c1('0x13')]);return _0x2ed328(_0x4895b5[_0x90c1('0x11')][_0x90c1('0x13')]);}else{logger[_0x90c1('0xd')](_0x90c1('0xe'),_0x954ac4,_0x90c1('0x14'));_0x2ed328(_0x4895b5['result'][_0x90c1('0x13')]);}})[_0x90c1('0x15')](function(_0x45a64c){logger[_0x90c1('0x11')](_0x90c1('0xe'),_0x954ac4,_0x45a64c);_0x351d07(_0x45a64c);});});} \ No newline at end of file +var _0xfd58=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','Automation,\x20%s,\x20%s','message'];(function(_0x414cb9,_0x46f345){var _0x4e8abc=function(_0x8d8f13){while(--_0x8d8f13){_0x414cb9['push'](_0x414cb9['shift']());}};_0x4e8abc(++_0x46f345);}(_0xfd58,0xb3));var _0x8fd5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd58[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8fd5('0x0'));var util=require(_0x8fd5('0x1'));var moment=require('moment');var BPromise=require(_0x8fd5('0x2'));var rs=require(_0x8fd5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd5('0x4'))['db'];var utils=require(_0x8fd5('0x5'));var logger=require(_0x8fd5('0x6'))(_0x8fd5('0x7'));var config=require('../../config/environment');var jayson=require(_0x8fd5('0x8'));var client=jayson[_0x8fd5('0x9')][_0x8fd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e10e4,_0x16ac3f,_0x32bad9){return new BPromise(function(_0x273344,_0x1042a1){return client[_0x8fd5('0xb')](_0x4e10e4,_0x32bad9)['then'](function(_0x462ac4){logger['info']('Automation,\x20%s,\x20%s',_0x16ac3f,_0x8fd5('0xc'));logger[_0x8fd5('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x16ac3f,_0x8fd5('0xc'),JSON[_0x8fd5('0xe')](_0x462ac4));if(_0x462ac4['error']){if(_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x10')]===0x1f4){logger['error'](_0x8fd5('0x11'),_0x16ac3f,_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);return _0x1042a1(_0x462ac4[_0x8fd5('0xf')]['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x16ac3f,_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);return _0x273344(_0x462ac4[_0x8fd5('0xf')][_0x8fd5('0x12')]);}else{logger[_0x8fd5('0x13')](_0x8fd5('0x11'),_0x16ac3f,_0x8fd5('0xc'));_0x273344(_0x462ac4[_0x8fd5('0x14')][_0x8fd5('0x12')]);}})[_0x8fd5('0x15')](function(_0x53b2dd){logger[_0x8fd5('0xf')](_0x8fd5('0x11'),_0x16ac3f,_0x53b2dd);_0x1042a1(_0x53b2dd);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 14b51f3..cc41b4d 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 _0xc1c3=['get','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addActions','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','/:id','show'];(function(_0x475aa9,_0x439aab){var _0x360bbc=function(_0x331a22){while(--_0x331a22){_0x475aa9['push'](_0x475aa9['shift']());}};_0x360bbc(++_0x439aab);}(_0xc1c3,0x1b5));var _0x3c1c=function(_0x17dcc7,_0x1db929){_0x17dcc7=_0x17dcc7-0x0;var _0x2b660a=_0xc1c3[_0x17dcc7];return _0x2b660a;};'use strict';var multer=require(_0x3c1c('0x0'));var util=require(_0x3c1c('0x1'));var path=require(_0x3c1c('0x2'));var timeout=require(_0x3c1c('0x3'));var express=require(_0x3c1c('0x4'));var router=express[_0x3c1c('0x5')]();var fs_extra=require(_0x3c1c('0x6'));var auth=require(_0x3c1c('0x7'));var interaction=require(_0x3c1c('0x8'));var config=require('../../config/environment');var controller=require(_0x3c1c('0x9'));router['get']('/',auth[_0x3c1c('0xa')](),controller['index']);router['get'](_0x3c1c('0xb'),auth['isAuthenticated'](),controller[_0x3c1c('0xc')]);router[_0x3c1c('0xd')](_0x3c1c('0xe'),auth[_0x3c1c('0xa')](),controller[_0x3c1c('0xf')]);router[_0x3c1c('0xd')](_0x3c1c('0x10'),auth[_0x3c1c('0xa')](),controller[_0x3c1c('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3c1c('0x12')]);router[_0x3c1c('0x13')](_0x3c1c('0xe'),auth[_0x3c1c('0xa')](),controller['addConditions']);router['post'](_0x3c1c('0x10'),auth['isAuthenticated'](),controller[_0x3c1c('0x14')]);router[_0x3c1c('0x15')](_0x3c1c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3c1c('0x16')]('/:id',auth[_0x3c1c('0xa')](),controller[_0x3c1c('0x17')]);module[_0x3c1c('0x18')]=router; \ No newline at end of file +var _0xf097=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put','/:id'];(function(_0x423d89,_0x440a2d){var _0x417221=function(_0x2eda1a){while(--_0x2eda1a){_0x423d89['push'](_0x423d89['shift']());}};_0x417221(++_0x440a2d);}(_0xf097,0x1b2));var _0x7f09=function(_0x2c7b9b,_0x418263){_0x2c7b9b=_0x2c7b9b-0x0;var _0x169383=_0xf097[_0x2c7b9b];return _0x169383;};'use strict';var multer=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var path=require(_0x7f09('0x2'));var timeout=require(_0x7f09('0x3'));var express=require(_0x7f09('0x4'));var router=express[_0x7f09('0x5')]();var fs_extra=require(_0x7f09('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f09('0x7'));router[_0x7f09('0x8')]('/',auth[_0x7f09('0x9')](),controller[_0x7f09('0xa')]);router[_0x7f09('0x8')]('/:id',auth[_0x7f09('0x9')](),controller[_0x7f09('0xb')]);router['get'](_0x7f09('0xc'),auth[_0x7f09('0x9')](),controller[_0x7f09('0xd')]);router[_0x7f09('0x8')]('/:id/actions',auth[_0x7f09('0x9')](),controller[_0x7f09('0xe')]);router[_0x7f09('0xf')]('/',auth[_0x7f09('0x9')](),controller[_0x7f09('0x10')]);router[_0x7f09('0xf')](_0x7f09('0xc'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x11')]);router[_0x7f09('0xf')](_0x7f09('0x12'),auth[_0x7f09('0x9')](),controller[_0x7f09('0x13')]);router[_0x7f09('0x14')](_0x7f09('0x15'),auth['isAuthenticated'](),controller[_0x7f09('0x16')]);router['delete'](_0x7f09('0x15'),auth['isAuthenticated'](),controller[_0x7f09('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 6bff3b8..5078126 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 _0xa244=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','ENUM','ivr','STRING','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x3e3559,_0x4d494f){var _0x4e4f09=function(_0x285fc5){while(--_0x285fc5){_0x3e3559['push'](_0x3e3559['shift']());}};_0x4e4f09(++_0x4d494f);}(_0xa244,0xd2));var _0x4a24=function(_0x35ba0a,_0x57eaeb){_0x35ba0a=_0x35ba0a-0x0;var _0x4bddb0=_0xa244[_0x35ba0a];return _0x4bddb0;};'use strict';var Sequelize=require(_0x4a24('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4a24('0x1')](_0x4a24('0x2')),'allowNull':![],'defaultValue':_0x4a24('0x2')},'description':{'type':Sequelize[_0x4a24('0x3')]},'active':{'type':Sequelize[_0x4a24('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x4a24('0x5')](0x4)[_0x4a24('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x4a24('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4a24('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0x4a24('0x5')](0x3)[_0x4a24('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a24('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4a24('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a24('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4a24('0x5')](0x5)[_0x4a24('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a24('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x4a24('0x5')](0x3)[_0x4a24('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x4a24('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a24('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4a24('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4a24('0x5')](0x5)[_0x4a24('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4a24('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4a24('0xb')},'dialTimezone':{'type':Sequelize[_0x4a24('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4a24('0x3')],'defaultValue':_0x4a24('0xc')},'dialCheckDuplicateType':{'type':Sequelize[_0x4a24('0x1')](_0x4a24('0xd'),'never',_0x4a24('0xe')),'defaultValue':_0x4a24('0xd')},'dialAMDActive':{'type':Sequelize[_0x4a24('0x4')],'defaultValue':0x0,'comment':_0x4a24('0xf')},'dialAMDInitialSilence':{'type':Sequelize[_0x4a24('0x5')](0x9)[_0x4a24('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4a24('0x10')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x4a24('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4a24('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4a24('0x5')](0x9)[_0x4a24('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4a24('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4a24('0x5')](0x9)[_0x4a24('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x4a24('0x5')](0x9)[_0x4a24('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4a24('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4a24('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4a24('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4a24('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4a24('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4a24('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4a24('0x5')](0x9)[_0x4a24('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4a24('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4a24('0x1')](_0x4a24('0x17'),_0x4a24('0x18')),'defaultValue':_0x4a24('0x17')},'dialPrefix':{'type':Sequelize[_0x4a24('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4a24('0x5')](0x3)[_0x4a24('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4a24('0x19')},'dialCutDigit':{'type':Sequelize[_0x4a24('0x5')](0x3)[_0x4a24('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4a24('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a24('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4a24('0x5')](0x5)[_0x4a24('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a24('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x4a24('0x5')](0x3)[_0x4a24('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a24('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x4a24('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a24('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4a24('0x5')](0x3)[_0x4a24('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a24('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4a24('0x5')](0x5)[_0x4a24('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x4a24('0x5')](0x3)[_0x4a24('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a24('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4a24('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4a24('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4a24('0x5')](0x3)[_0x4a24('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4a24('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4a24('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 +var _0x6c98=['#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x5492ce,_0x129ad1){var _0x3082ca=function(_0x1b1d74){while(--_0x1b1d74){_0x5492ce['push'](_0x5492ce['shift']());}};_0x3082ca(++_0x129ad1);}(_0x6c98,0x7c));var _0x86c9=function(_0x271ebd,_0x25dc7b){_0x271ebd=_0x271ebd-0x0;var _0x1d11f5=_0x6c98[_0x271ebd];return _0x1d11f5;};'use strict';var Sequelize=require(_0x86c9('0x0'));module[_0x86c9('0x1')]={'name':{'type':Sequelize[_0x86c9('0x2')],'unique':_0x86c9('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x86c9('0x4')](_0x86c9('0x5')),'allowNull':![],'defaultValue':_0x86c9('0x5')},'description':{'type':Sequelize[_0x86c9('0x2')]},'active':{'type':Sequelize[_0x86c9('0x6')],'defaultValue':0x0,'comment':_0x86c9('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x86c9('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x86c9('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x86c9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x86c9('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x86c9('0xa')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0xb')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x86c9('0xa')](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x86c9('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x86c9('0x10')},'dialTimezone':{'type':Sequelize[_0x86c9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x86c9('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x86c9('0x4')](_0x86c9('0x11'),_0x86c9('0x12'),_0x86c9('0x13')),'defaultValue':_0x86c9('0x11')},'dialAMDActive':{'type':Sequelize[_0x86c9('0x6')],'defaultValue':0x0,'comment':_0x86c9('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x86c9('0xa')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x86c9('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x86c9('0xa')](0x9)[_0x86c9('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x86c9('0xa')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x86c9('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x86c9('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x86c9('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x86c9('0xa')](0x9)[_0x86c9('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x86c9('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x86c9('0xa')](0x9)[_0x86c9('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x86c9('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x86c9('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x86c9('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x86c9('0xa')](0x9)[_0x86c9('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x86c9('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x86c9('0x4')]('DESC','ASC'),'defaultValue':_0x86c9('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x86c9('0xa')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x86c9('0x1e')},'dialCutDigit':{'type':Sequelize[_0x86c9('0xa')](0x3)[_0x86c9('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x86c9('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x86c9('0xa')](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x86c9('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x86c9('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)[_0x86c9('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x86c9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x86c9('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x86c9('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2fd50f7..5af0a2f 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 _0x6c56=['phone','NOW()','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','CmListId','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','cm_contacts','removeBlackLists','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','destroy','get','IvrCampaigns','then','sendStatus','name','send','index','map','Campaign','fieldName','type','model','keys','query','filters','attributes','fields','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','length','createdAt','omit','updatedAt','userProfileId','update','getHoppers','findOne','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field'];(function(_0xadd855,_0x313dd0){var _0x16a09f=function(_0x29693f){while(--_0x29693f){_0xadd855['push'](_0xadd855['shift']());}};_0x16a09f(++_0x313dd0);}(_0x6c56,0x123));var _0x66c5=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x6c56[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x66c5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x66c5('0x1'));var rp=require(_0x66c5('0x2'));var moment=require(_0x66c5('0x3'));var BPromise=require(_0x66c5('0x4'));var Mustache=require(_0x66c5('0x5'));var util=require(_0x66c5('0x6'));var path=require(_0x66c5('0x7'));var sox=require('sox');var csv=require(_0x66c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66c5('0x9'));var _=require(_0x66c5('0xa'));var squel=require(_0x66c5('0xb'));var crypto=require(_0x66c5('0xc'));var jsforce=require(_0x66c5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x66c5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x66c5('0xf'));var qs=require(_0x66c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c5('0x11'));var logger=require(_0x66c5('0x12'))(_0x66c5('0x13'));var utils=require(_0x66c5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x66c5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c4f62,_0x3f3018){_0x3f3018=_0x3f3018||0xcc;return function(_0x1726ff){if(_0x1726ff){return _0x1c4f62['sendStatus'](_0x3f3018);}return _0x1c4f62[_0x66c5('0x16')](_0x3f3018)[_0x66c5('0x17')]();};}function respondWithResult(_0x169e4e,_0x252e86){_0x252e86=_0x252e86||0xc8;return function(_0x3ccd1d){if(_0x3ccd1d){return _0x169e4e[_0x66c5('0x16')](_0x252e86)['json'](_0x3ccd1d);}};}function respondWithFilteredResult(_0x58ce04,_0x3f7ed9){return function(_0x237650){if(_0x237650){var _0x474229=typeof _0x3f7ed9['offset']===_0x66c5('0x18')&&typeof _0x3f7ed9[_0x66c5('0x19')]==='undefined';var _0x128738=_0x237650[_0x66c5('0x1a')];var _0x24b1cb=_0x474229?0x0:_0x3f7ed9['offset'];var _0x5b82da=_0x474229?_0x237650['count']:_0x3f7ed9[_0x66c5('0x1b')]+_0x3f7ed9[_0x66c5('0x19')];var _0x36c129;if(_0x5b82da>=_0x128738){_0x5b82da=_0x128738;_0x36c129=0xc8;}else{_0x36c129=0xce;}_0x58ce04[_0x66c5('0x16')](_0x36c129);return _0x58ce04[_0x66c5('0x1c')](_0x66c5('0x1d'),_0x24b1cb+'-'+_0x5b82da+'/'+_0x128738)[_0x66c5('0x1e')](_0x237650);}return null;};}function patchUpdates(_0x1c2a48){return function(_0x1d2327){try{jsonpatch[_0x66c5('0x1f')](_0x1d2327,_0x1c2a48,!![]);}catch(_0x47f990){return BPromise[_0x66c5('0x20')](_0x47f990);}return _0x1d2327['save']();};}function saveUpdates(_0x437a26,_0x546f3d){return function(_0xdc0f1e){if(_0xdc0f1e){return _0xdc0f1e['update'](_0x437a26)['then'](function(_0x1419db){return _0x1419db;});}return null;};}function removeEntity(_0x43efe7,_0x18c59d){return function(_0x2eced6){if(_0x2eced6){return _0x2eced6[_0x66c5('0x21')]()['then'](function(){var _0x4b2d3f=_0x2eced6[_0x66c5('0x22')]({'plain':!![]});var _0x308c06=_0x66c5('0x23');return db['UserProfileResource'][_0x66c5('0x21')]({'where':{'type':_0x308c06,'resourceId':_0x4b2d3f['id']}})[_0x66c5('0x24')](function(){return _0x2eced6;});})[_0x66c5('0x24')](function(){_0x43efe7[_0x66c5('0x16')](0xcc)[_0x66c5('0x17')]();});}};}function handleEntityNotFound(_0xdfdf42,_0x49eba1){return function(_0x163edc){if(!_0x163edc){_0xdfdf42[_0x66c5('0x25')](0x194);}return _0x163edc;};}function handleError(_0x364a22,_0x5ce685){_0x5ce685=_0x5ce685||0x1f4;return function(_0x28da4e){logger['error'](_0x28da4e['stack']);if(_0x28da4e[_0x66c5('0x26')]){delete _0x28da4e[_0x66c5('0x26')];}_0x364a22[_0x66c5('0x16')](_0x5ce685)[_0x66c5('0x27')](_0x28da4e);};}exports[_0x66c5('0x28')]=function(_0x1d0bdf,_0x20434a){var _0x2626a6={},_0x2f7215={},_0x29e406={'count':0x0,'rows':[]};var _0x57f9ef=_[_0x66c5('0x29')](db[_0x66c5('0x2a')]['rawAttributes'],function(_0x4b6c29){return{'name':_0x4b6c29[_0x66c5('0x2b')],'type':_0x4b6c29[_0x66c5('0x2c')]['key']};});_0x2f7215[_0x66c5('0x2d')]=_[_0x66c5('0x29')](_0x57f9ef,_0x66c5('0x26'));_0x2f7215['query']=_[_0x66c5('0x2e')](_0x1d0bdf[_0x66c5('0x2f')]);_0x2f7215[_0x66c5('0x30')]=_['intersection'](_0x2f7215[_0x66c5('0x2d')],_0x2f7215['query']);_0x2626a6[_0x66c5('0x31')]=_['intersection'](_0x2f7215[_0x66c5('0x2d')],qs[_0x66c5('0x32')](_0x1d0bdf[_0x66c5('0x2f')][_0x66c5('0x32')]));_0x2626a6[_0x66c5('0x31')]=_0x2626a6[_0x66c5('0x31')]['length']?_0x2626a6[_0x66c5('0x31')]:_0x2f7215[_0x66c5('0x2d')];if(!_0x1d0bdf['query']['hasOwnProperty'](_0x66c5('0x33'))){_0x2626a6[_0x66c5('0x19')]=qs[_0x66c5('0x19')](_0x1d0bdf[_0x66c5('0x2f')][_0x66c5('0x19')]);_0x2626a6[_0x66c5('0x1b')]=qs[_0x66c5('0x1b')](_0x1d0bdf[_0x66c5('0x2f')][_0x66c5('0x1b')]);}_0x2626a6[_0x66c5('0x34')]=qs['sort'](_0x1d0bdf[_0x66c5('0x2f')][_0x66c5('0x35')]);_0x2626a6['where']=qs[_0x66c5('0x30')](_[_0x66c5('0x36')](_0x1d0bdf[_0x66c5('0x2f')],_0x2f7215[_0x66c5('0x30')]),_0x57f9ef);if(_0x1d0bdf[_0x66c5('0x2f')][_0x66c5('0x37')]){_0x2626a6['where']=_[_0x66c5('0x38')](_0x2626a6[_0x66c5('0x39')],{'$or':_[_0x66c5('0x29')](_0x57f9ef,function(_0x323713){if(_0x323713[_0x66c5('0x2c')]!==_0x66c5('0x3a')){var _0x396bd6={};_0x396bd6[_0x323713[_0x66c5('0x26')]]={'$like':'%'+_0x1d0bdf[_0x66c5('0x2f')]['filter']+'%'};return _0x396bd6;}})});}_0x2626a6=_[_0x66c5('0x38')]({},_0x2626a6,_0x1d0bdf[_0x66c5('0x3b')]);var _0x2f44ad={'where':_0x2626a6[_0x66c5('0x39')]};return db[_0x66c5('0x2a')][_0x66c5('0x1a')](_0x2f44ad)[_0x66c5('0x24')](function(_0x1a37d7){_0x29e406[_0x66c5('0x1a')]=_0x1a37d7;if(_0x1d0bdf[_0x66c5('0x2f')][_0x66c5('0x3c')]){_0x2626a6[_0x66c5('0x3d')]=[{'all':!![]}];}return db[_0x66c5('0x2a')][_0x66c5('0x3e')](_0x2626a6);})['then'](function(_0x47d32a){_0x29e406[_0x66c5('0x3f')]=_0x47d32a;return _0x29e406;})[_0x66c5('0x24')](respondWithFilteredResult(_0x20434a,_0x2626a6))[_0x66c5('0x40')](handleError(_0x20434a,null));};exports['show']=function(_0x565b11,_0x42157b){var _0x3c6419={'raw':![],'where':{'id':_0x565b11[_0x66c5('0x41')]['id']}},_0x52662c={};_0x52662c[_0x66c5('0x2d')]=_['keys'](db['Campaign']['rawAttributes']);_0x52662c[_0x66c5('0x2f')]=_[_0x66c5('0x2e')](_0x565b11['query']);_0x52662c[_0x66c5('0x30')]=_[_0x66c5('0x42')](_0x52662c[_0x66c5('0x2d')],_0x52662c[_0x66c5('0x2f')]);_0x3c6419[_0x66c5('0x31')]=_[_0x66c5('0x42')](_0x52662c[_0x66c5('0x2d')],qs[_0x66c5('0x32')](_0x565b11[_0x66c5('0x2f')][_0x66c5('0x32')]));_0x3c6419[_0x66c5('0x31')]=_0x3c6419[_0x66c5('0x31')]['length']?_0x3c6419[_0x66c5('0x31')]:_0x52662c[_0x66c5('0x2d')];if(_0x565b11[_0x66c5('0x2f')]['includeAll']){_0x3c6419[_0x66c5('0x3d')]=[{'all':!![]}];}_0x3c6419=_[_0x66c5('0x38')]({},_0x3c6419,_0x565b11[_0x66c5('0x3b')]);return db[_0x66c5('0x2a')][_0x66c5('0x43')](_0x3c6419)['then'](handleEntityNotFound(_0x42157b,null))[_0x66c5('0x24')](respondWithResult(_0x42157b,null))[_0x66c5('0x40')](handleError(_0x42157b,null));};exports['create']=function(_0x1cdc8a,_0x30dfa5){return db[_0x66c5('0x2a')]['create'](_0x1cdc8a[_0x66c5('0x44')],{})[_0x66c5('0x24')](function(_0xb846ba){var _0x1b5144=_0x1cdc8a[_0x66c5('0x45')][_0x66c5('0x22')]({'plain':!![]});if(!_0x1b5144)throw new Error(_0x66c5('0x46'));if(_0x1b5144['role']==='user'){var _0x3c498c=_0xb846ba['get']({'plain':!![]});var _0x91f174=_0x66c5('0x23');return db[_0x66c5('0x47')]['find']({'where':{'name':_0x91f174,'userProfileId':_0x1b5144['userProfileId']},'raw':!![]})[_0x66c5('0x24')](function(_0x1d19bf){if(_0x1d19bf&&_0x1d19bf[_0x66c5('0x48')]===0x0){return db['UserProfileResource'][_0x66c5('0x49')]({'name':_0x3c498c[_0x66c5('0x26')],'resourceId':_0x3c498c['id'],'type':_0x1d19bf['name'],'sectionId':_0x1d19bf['id']},{})[_0x66c5('0x24')](function(){return _0xb846ba;});}else{return _0xb846ba;}})[_0x66c5('0x40')](function(_0x9a26fc){logger[_0x66c5('0x4a')](_0x66c5('0x4b'),_0x9a26fc);throw _0x9a26fc;});}return _0xb846ba;})[_0x66c5('0x24')](respondWithResult(_0x30dfa5,0xc9))[_0x66c5('0x40')](handleError(_0x30dfa5,null));};exports[_0x66c5('0x4c')]=function(_0x28cf10,_0x5861a9){var _0x4c86ff={'where':{'id':_0x28cf10[_0x66c5('0x41')]['id']}},_0x2a07d2={};_0x2a07d2[_0x66c5('0x2d')]=_[_0x66c5('0x2e')](db[_0x66c5('0x2a')][_0x66c5('0x4d')]);_0x4c86ff['attributes']=_[_0x66c5('0x42')](_0x2a07d2[_0x66c5('0x2d')],qs[_0x66c5('0x32')](_0x28cf10[_0x66c5('0x2f')]['fields']));_0x4c86ff[_0x66c5('0x31')]=_0x4c86ff[_0x66c5('0x31')][_0x66c5('0x4e')]?_0x4c86ff[_0x66c5('0x31')]:_0x2a07d2[_0x66c5('0x2d')];if(_0x28cf10[_0x66c5('0x2f')][_0x66c5('0x3c')]){_0x4c86ff[_0x66c5('0x3d')]=[{'all':!![]}];}_0x4c86ff=_[_0x66c5('0x38')]({},_0x4c86ff,_0x28cf10[_0x66c5('0x3b')]);return db['Campaign'][_0x66c5('0x43')](_0x4c86ff)[_0x66c5('0x24')](handleEntityNotFound(_0x5861a9,null))[_0x66c5('0x24')](function(_0x2a666d){if(_0x2a666d){var _0x3ad0c6=_0x2a666d['get']({'plain':!![]});_0x3ad0c6=qs['omit'](_0x3ad0c6,['id',_0x66c5('0x4f'),'updatedAt']);_0x28cf10[_0x66c5('0x44')]=_[_0x66c5('0x50')](_0x28cf10[_0x66c5('0x44')],['id','createdAt',_0x66c5('0x51')]);return db['Campaign'][_0x66c5('0x49')](_[_0x66c5('0x38')](_0x3ad0c6,_0x28cf10['body']),{'include':_0x28cf10[_0x66c5('0x2f')]['includeAll']?[{'all':!![]}]:undefined})[_0x66c5('0x24')](function(_0x269e61){var _0x2ae852=_0x28cf10[_0x66c5('0x45')][_0x66c5('0x22')]({'plain':!![]});if(!_0x2ae852)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ae852['role']===_0x66c5('0x45')){var _0x2f7c73=_0x269e61['get']({'plain':!![]});var _0x7afd4e=_0x66c5('0x23');return db[_0x66c5('0x47')][_0x66c5('0x43')]({'where':{'name':_0x7afd4e,'userProfileId':_0x2ae852[_0x66c5('0x52')]},'raw':!![]})[_0x66c5('0x24')](function(_0x4a3b3e){if(_0x4a3b3e&&_0x4a3b3e[_0x66c5('0x48')]===0x0){return db['UserProfileResource'][_0x66c5('0x49')]({'name':_0x2f7c73[_0x66c5('0x26')],'resourceId':_0x2f7c73['id'],'type':_0x4a3b3e[_0x66c5('0x26')],'sectionId':_0x4a3b3e['id']},{})[_0x66c5('0x24')](function(){return _0x269e61;});}else{return _0x269e61;}})[_0x66c5('0x40')](function(_0xf56fef){logger[_0x66c5('0x4a')](_0x66c5('0x4b'),_0xf56fef);throw _0xf56fef;});}return _0x269e61;});}})[_0x66c5('0x24')](respondWithResult(_0x5861a9,0xc9))[_0x66c5('0x40')](handleError(_0x5861a9,null));};exports[_0x66c5('0x53')]=function(_0x44f6b4,_0x1756f0){if(_0x44f6b4['body']['id']){delete _0x44f6b4[_0x66c5('0x44')]['id'];}return db['Campaign']['find']({'where':{'id':_0x44f6b4['params']['id']}})[_0x66c5('0x24')](handleEntityNotFound(_0x1756f0,null))[_0x66c5('0x24')](saveUpdates(_0x44f6b4['body'],null))[_0x66c5('0x24')](respondWithResult(_0x1756f0,null))[_0x66c5('0x40')](handleError(_0x1756f0,null));};exports[_0x66c5('0x21')]=function(_0x29ec53,_0x316521){return db[_0x66c5('0x2a')][_0x66c5('0x43')]({'where':{'id':_0x29ec53[_0x66c5('0x41')]['id']}})[_0x66c5('0x24')](handleEntityNotFound(_0x316521,null))['then'](removeEntity(_0x316521,null))[_0x66c5('0x40')](handleError(_0x316521,null));};exports[_0x66c5('0x54')]=function(_0x2177cf,_0xfeb82d,_0x24d727){var _0x2f806f={'raw':!![],'where':{}};var _0x82d0fe={};var _0x28bc80={'count':0x0,'rows':[]};return db[_0x66c5('0x2a')][_0x66c5('0x55')]({'where':{'id':_0x2177cf[_0x66c5('0x41')]['id']}})[_0x66c5('0x24')](handleEntityNotFound(_0xfeb82d,null))[_0x66c5('0x24')](function(_0x1e074c){if(_0x1e074c){_0x82d0fe[_0x66c5('0x2d')]=_[_0x66c5('0x2e')](db['CmHopper'][_0x66c5('0x4d')]);_0x82d0fe[_0x66c5('0x2f')]=_[_0x66c5('0x2e')](_0x2177cf[_0x66c5('0x2f')]);_0x82d0fe['filters']=_['intersection'](_0x82d0fe[_0x66c5('0x2d')],_0x82d0fe[_0x66c5('0x2f')]);_0x2f806f[_0x66c5('0x31')]=_['intersection'](_0x82d0fe[_0x66c5('0x2d')],qs[_0x66c5('0x32')](_0x2177cf[_0x66c5('0x2f')][_0x66c5('0x32')]));_0x2f806f[_0x66c5('0x31')]=_0x2f806f[_0x66c5('0x31')][_0x66c5('0x4e')]?_0x2f806f[_0x66c5('0x31')]:_0x82d0fe[_0x66c5('0x2d')];if(!_0x2177cf[_0x66c5('0x2f')][_0x66c5('0x56')](_0x66c5('0x33'))){_0x2f806f[_0x66c5('0x19')]=qs[_0x66c5('0x19')](_0x2177cf[_0x66c5('0x2f')][_0x66c5('0x19')]);_0x2f806f['offset']=qs[_0x66c5('0x1b')](_0x2177cf[_0x66c5('0x2f')][_0x66c5('0x1b')]);}_0x2f806f['order']=qs[_0x66c5('0x35')](_0x2177cf[_0x66c5('0x2f')]['sort']);_0x2f806f[_0x66c5('0x39')]=qs[_0x66c5('0x30')](_[_0x66c5('0x36')](_0x2177cf[_0x66c5('0x2f')],_0x82d0fe[_0x66c5('0x30')]));_0x2f806f[_0x66c5('0x39')][_0x66c5('0x57')]=_0x1e074c['id'];if(_0x2177cf[_0x66c5('0x2f')]['filter']){_0x2f806f[_0x66c5('0x39')]=_['merge'](_0x2f806f[_0x66c5('0x39')],{'$or':_['map'](_0x2f806f[_0x66c5('0x31')],function(_0x51661e){var _0x559bed={};_0x559bed[_0x51661e]={'$like':'%'+_0x2177cf['query']['filter']+'%'};return _0x559bed;})});}_0x2f806f=_[_0x66c5('0x38')]({},_0x2f806f,_0x2177cf[_0x66c5('0x3b')]);return db['CmHopper'][_0x66c5('0x1a')]({'where':_0x2f806f[_0x66c5('0x39')]})[_0x66c5('0x24')](function(_0x305b5a){_0x28bc80[_0x66c5('0x1a')]=_0x305b5a;if(_0x2177cf[_0x66c5('0x2f')][_0x66c5('0x3c')]){_0x2f806f['include']=[{'all':!![]}];}return db['CmHopper'][_0x66c5('0x3e')](_0x2f806f);})[_0x66c5('0x24')](function(_0x2fb72c){_0x28bc80['rows']=_0x2fb72c;return _0x28bc80;});}})[_0x66c5('0x24')](respondWithFilteredResult(_0xfeb82d,_0x2f806f))['catch'](handleError(_0xfeb82d,null));};exports[_0x66c5('0x58')]=function(_0x30505c,_0x15bd4f,_0x38a816){var _0x3eebb3={'raw':!![],'where':{}};var _0x427bcb={};var _0x53192d={'count':0x0,'rows':[]};return db[_0x66c5('0x2a')]['findOne']({'where':{'id':_0x30505c[_0x66c5('0x41')]['id']}})['then'](handleEntityNotFound(_0x15bd4f,null))[_0x66c5('0x24')](function(_0x417b82){if(_0x417b82){_0x427bcb[_0x66c5('0x2d')]=_[_0x66c5('0x2e')](db[_0x66c5('0x59')][_0x66c5('0x4d')]);_0x427bcb[_0x66c5('0x2f')]=_['keys'](_0x30505c[_0x66c5('0x2f')]);_0x427bcb[_0x66c5('0x30')]=_['intersection'](_0x427bcb['model'],_0x427bcb[_0x66c5('0x2f')]);_0x3eebb3[_0x66c5('0x31')]=_[_0x66c5('0x42')](_0x427bcb['model'],qs[_0x66c5('0x32')](_0x30505c['query']['fields']));_0x3eebb3[_0x66c5('0x31')]=_0x3eebb3[_0x66c5('0x31')][_0x66c5('0x4e')]?_0x3eebb3[_0x66c5('0x31')]:_0x427bcb[_0x66c5('0x2d')];if(!_0x30505c[_0x66c5('0x2f')][_0x66c5('0x56')](_0x66c5('0x33'))){_0x3eebb3['limit']=qs[_0x66c5('0x19')](_0x30505c['query']['limit']);_0x3eebb3[_0x66c5('0x1b')]=qs['offset'](_0x30505c['query'][_0x66c5('0x1b')]);}_0x3eebb3['order']=qs[_0x66c5('0x35')](_0x30505c[_0x66c5('0x2f')][_0x66c5('0x35')]);_0x3eebb3[_0x66c5('0x39')]=qs[_0x66c5('0x30')](_['pick'](_0x30505c['query'],_0x427bcb[_0x66c5('0x30')]));_0x3eebb3[_0x66c5('0x39')][_0x66c5('0x57')]=_0x417b82['id'];if(_0x30505c[_0x66c5('0x2f')]['filter']){_0x3eebb3['where']=_['merge'](_0x3eebb3[_0x66c5('0x39')],{'$or':_['map'](_0x3eebb3[_0x66c5('0x31')],function(_0x7acf08){var _0x554e2c={};_0x554e2c[_0x7acf08]={'$like':'%'+_0x30505c[_0x66c5('0x2f')][_0x66c5('0x37')]+'%'};return _0x554e2c;})});}_0x3eebb3=_['merge']({},_0x3eebb3,_0x30505c[_0x66c5('0x3b')]);return db[_0x66c5('0x59')][_0x66c5('0x1a')]({'where':_0x3eebb3[_0x66c5('0x39')]})[_0x66c5('0x24')](function(_0x2889a2){_0x53192d[_0x66c5('0x1a')]=_0x2889a2;if(_0x30505c['query'][_0x66c5('0x3c')]){_0x3eebb3['include']=[{'all':!![]}];}return db[_0x66c5('0x59')]['findAll'](_0x3eebb3);})['then'](function(_0x5e04ec){_0x53192d['rows']=_0x5e04ec;return _0x53192d;});}})[_0x66c5('0x24')](respondWithFilteredResult(_0x15bd4f,_0x3eebb3))[_0x66c5('0x40')](handleError(_0x15bd4f,null));};exports[_0x66c5('0x5a')]=function(_0x457030,_0x52a51c,_0x3170c0){var _0x817c1={'raw':!![],'where':{}};var _0x4420ed={};var _0x14f43e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x457030[_0x66c5('0x41')]['id']}})['then'](handleEntityNotFound(_0x52a51c,null))[_0x66c5('0x24')](function(_0x3a1dee){if(_0x3a1dee){_0x4420ed[_0x66c5('0x2d')]=_[_0x66c5('0x2e')](db[_0x66c5('0x5b')]['rawAttributes']);_0x4420ed[_0x66c5('0x2f')]=_[_0x66c5('0x2e')](_0x457030[_0x66c5('0x2f')]);_0x4420ed[_0x66c5('0x30')]=_[_0x66c5('0x42')](_0x4420ed['model'],_0x4420ed[_0x66c5('0x2f')]);_0x817c1[_0x66c5('0x31')]=_[_0x66c5('0x42')](_0x4420ed[_0x66c5('0x2d')],qs[_0x66c5('0x32')](_0x457030[_0x66c5('0x2f')]['fields']));_0x817c1[_0x66c5('0x31')]=_0x817c1['attributes'][_0x66c5('0x4e')]?_0x817c1[_0x66c5('0x31')]:_0x4420ed[_0x66c5('0x2d')];if(!_0x457030[_0x66c5('0x2f')][_0x66c5('0x56')](_0x66c5('0x33'))){_0x817c1['limit']=qs['limit'](_0x457030[_0x66c5('0x2f')][_0x66c5('0x19')]);_0x817c1[_0x66c5('0x1b')]=qs[_0x66c5('0x1b')](_0x457030['query']['offset']);}_0x817c1['order']=qs[_0x66c5('0x35')](_0x457030[_0x66c5('0x2f')][_0x66c5('0x35')]);_0x817c1[_0x66c5('0x39')]=qs[_0x66c5('0x30')](_[_0x66c5('0x36')](_0x457030[_0x66c5('0x2f')],_0x4420ed['filters']));_0x817c1[_0x66c5('0x39')][_0x66c5('0x57')]=_0x3a1dee['id'];if(_0x457030[_0x66c5('0x2f')][_0x66c5('0x37')]){_0x817c1[_0x66c5('0x39')]=_[_0x66c5('0x38')](_0x817c1[_0x66c5('0x39')],{'$or':_[_0x66c5('0x29')](_0x817c1[_0x66c5('0x31')],function(_0x33accb){var _0x592a4d={};_0x592a4d[_0x33accb]={'$like':'%'+_0x457030[_0x66c5('0x2f')][_0x66c5('0x37')]+'%'};return _0x592a4d;})});}_0x817c1=_[_0x66c5('0x38')]({},_0x817c1,_0x457030[_0x66c5('0x3b')]);return db['CmHopperFinal'][_0x66c5('0x1a')]({'where':_0x817c1[_0x66c5('0x39')]})[_0x66c5('0x24')](function(_0x2007f5){_0x14f43e[_0x66c5('0x1a')]=_0x2007f5;if(_0x457030[_0x66c5('0x2f')]['includeAll']){_0x817c1[_0x66c5('0x3d')]=[{'all':!![]}];}return db[_0x66c5('0x5b')][_0x66c5('0x3e')](_0x817c1);})[_0x66c5('0x24')](function(_0x4bdf6f){_0x14f43e[_0x66c5('0x3f')]=_0x4bdf6f;return _0x14f43e;});}})['then'](respondWithFilteredResult(_0x52a51c,_0x817c1))[_0x66c5('0x40')](handleError(_0x52a51c,null));};exports[_0x66c5('0x5c')]=function(_0x8f1181,_0x378b08,_0x15b1a4){var _0x5d84f4={'raw':!![],'where':{}};var _0x70626d={};var _0x57ad37={'count':0x0,'rows':[]};return db[_0x66c5('0x2a')][_0x66c5('0x55')]({'where':{'id':_0x8f1181[_0x66c5('0x41')]['id']}})['then'](handleEntityNotFound(_0x378b08,null))[_0x66c5('0x24')](function(_0x48f4de){if(_0x48f4de){_0x70626d[_0x66c5('0x2d')]=_[_0x66c5('0x2e')](db[_0x66c5('0x5d')][_0x66c5('0x4d')]);_0x70626d['query']=_['keys'](_0x8f1181[_0x66c5('0x2f')]);_0x70626d['filters']=_[_0x66c5('0x42')](_0x70626d[_0x66c5('0x2d')],_0x70626d[_0x66c5('0x2f')]);_0x5d84f4[_0x66c5('0x31')]=_[_0x66c5('0x42')](_0x70626d[_0x66c5('0x2d')],qs[_0x66c5('0x32')](_0x8f1181[_0x66c5('0x2f')][_0x66c5('0x32')]));_0x5d84f4[_0x66c5('0x31')]=_0x5d84f4[_0x66c5('0x31')][_0x66c5('0x4e')]?_0x5d84f4['attributes']:_0x70626d[_0x66c5('0x2d')];if(!_0x8f1181['query'][_0x66c5('0x56')](_0x66c5('0x33'))){_0x5d84f4[_0x66c5('0x19')]=qs['limit'](_0x8f1181[_0x66c5('0x2f')]['limit']);_0x5d84f4[_0x66c5('0x1b')]=qs[_0x66c5('0x1b')](_0x8f1181[_0x66c5('0x2f')][_0x66c5('0x1b')]);}_0x5d84f4[_0x66c5('0x34')]=qs[_0x66c5('0x35')](_0x8f1181['query'][_0x66c5('0x35')]);_0x5d84f4[_0x66c5('0x39')]=qs[_0x66c5('0x30')](_[_0x66c5('0x36')](_0x8f1181['query'],_0x70626d['filters']));_0x5d84f4['where'][_0x66c5('0x57')]=_0x48f4de['id'];if(_0x8f1181[_0x66c5('0x2f')][_0x66c5('0x37')]){_0x5d84f4[_0x66c5('0x39')]=_[_0x66c5('0x38')](_0x5d84f4[_0x66c5('0x39')],{'$or':_[_0x66c5('0x29')](_0x5d84f4['attributes'],function(_0x3952af){var _0x2b6d0f={};_0x2b6d0f[_0x3952af]={'$like':'%'+_0x8f1181[_0x66c5('0x2f')][_0x66c5('0x37')]+'%'};return _0x2b6d0f;})});}_0x5d84f4=_['merge']({},_0x5d84f4,_0x8f1181[_0x66c5('0x3b')]);return db['CmHopperBlack'][_0x66c5('0x1a')]({'where':_0x5d84f4['where']})[_0x66c5('0x24')](function(_0x5e2175){_0x57ad37[_0x66c5('0x1a')]=_0x5e2175;if(_0x8f1181['query'][_0x66c5('0x3c')]){_0x5d84f4[_0x66c5('0x3d')]=[{'all':!![]}];}return db[_0x66c5('0x5d')][_0x66c5('0x3e')](_0x5d84f4);})[_0x66c5('0x24')](function(_0x381720){_0x57ad37['rows']=_0x381720;return _0x57ad37;});}})[_0x66c5('0x24')](respondWithFilteredResult(_0x378b08,_0x5d84f4))['catch'](handleError(_0x378b08,null));};exports[_0x66c5('0x5e')]=function(_0x25b91a,_0x1bdfd5,_0x1b93f5){var _0x5508ee={};var _0x4e7fb8={};var _0x48fae5;var _0x19d906;return db[_0x66c5('0x2a')][_0x66c5('0x55')]({'where':{'id':_0x25b91a['params']['id']}})[_0x66c5('0x24')](handleEntityNotFound(_0x1bdfd5,null))[_0x66c5('0x24')](function(_0x449e7a){if(_0x449e7a){_0x48fae5=_0x449e7a;_0x4e7fb8[_0x66c5('0x2d')]=_[_0x66c5('0x2e')](db[_0x66c5('0x5f')][_0x66c5('0x4d')]);_0x4e7fb8[_0x66c5('0x2f')]=_[_0x66c5('0x2e')](_0x25b91a[_0x66c5('0x2f')]);_0x4e7fb8[_0x66c5('0x30')]=_[_0x66c5('0x42')](_0x4e7fb8[_0x66c5('0x2d')],_0x4e7fb8[_0x66c5('0x2f')]);_0x5508ee[_0x66c5('0x31')]=_['intersection'](_0x4e7fb8[_0x66c5('0x2d')],qs[_0x66c5('0x32')](_0x25b91a['query']['fields']));_0x5508ee[_0x66c5('0x31')]=_0x5508ee[_0x66c5('0x31')][_0x66c5('0x4e')]?_0x5508ee['attributes']:_0x4e7fb8['model'];_0x5508ee[_0x66c5('0x34')]=qs['sort'](_0x25b91a[_0x66c5('0x2f')][_0x66c5('0x35')]);_0x5508ee[_0x66c5('0x39')]=qs['filters'](_['pick'](_0x25b91a['query'],_0x4e7fb8[_0x66c5('0x30')]));if(_0x25b91a[_0x66c5('0x2f')][_0x66c5('0x37')]){_0x5508ee[_0x66c5('0x39')]=_[_0x66c5('0x38')](_0x5508ee[_0x66c5('0x39')],{'$or':_[_0x66c5('0x29')](_0x5508ee[_0x66c5('0x31')],function(_0x302f00){var _0x1b19d8={};_0x1b19d8[_0x302f00]={'$like':'%'+_0x25b91a['query']['filter']+'%'};return _0x1b19d8;})});}_0x5508ee=_['merge']({},_0x5508ee,_0x25b91a[_0x66c5('0x3b')]);return _0x48fae5[_0x66c5('0x5e')](_0x5508ee);}})[_0x66c5('0x24')](function(_0x2a96ce){if(_0x2a96ce){_0x19d906=_0x2a96ce[_0x66c5('0x4e')];if(!_0x25b91a['query'][_0x66c5('0x56')](_0x66c5('0x33'))){_0x5508ee[_0x66c5('0x19')]=qs['limit'](_0x25b91a[_0x66c5('0x2f')][_0x66c5('0x19')]);_0x5508ee[_0x66c5('0x1b')]=qs[_0x66c5('0x1b')](_0x25b91a[_0x66c5('0x2f')][_0x66c5('0x1b')]);}return _0x48fae5['getLists'](_0x5508ee);}})[_0x66c5('0x24')](function(_0x1c9343){if(_0x1c9343){return _0x1c9343?{'count':_0x19d906,'rows':_0x1c9343}:null;}})[_0x66c5('0x24')](respondWithResult(_0x1bdfd5,null))[_0x66c5('0x40')](handleError(_0x1bdfd5,null));};exports[_0x66c5('0x60')]=function(_0x2fde38,_0x49e685,_0x457eda){var _0x3b1896,_0x3537b5;return db['Campaign']['find']({'where':{'id':_0x2fde38[_0x66c5('0x41')]['id']}})[_0x66c5('0x24')](handleEntityNotFound(_0x49e685,null))[_0x66c5('0x24')](function(_0x4593dc){if(_0x4593dc){_0x3537b5=_0x4593dc;return _0x4593dc[_0x66c5('0x60')](_0x2fde38[_0x66c5('0x44')]['ids'],_[_0x66c5('0x50')](_0x2fde38['body'],[_0x66c5('0x61'),'id'])||{});}return null;})[_0x66c5('0x62')](function(_0x40a221){var _0x5120cb;_0x3b1896=_0x40a221||[];var _0x1e4e30=[];if(_0x40a221){for(var _0x471651=0x0;_0x471651<_0x40a221[_0x66c5('0x4e')];_0x471651+=0x1){var _0x2ddb83=_0x40a221[_0x471651]['get']({'plain':!![]});_0x3537b5[_0x66c5('0x63')]=_0x2fde38['body'][_0x66c5('0x63')]?_0x2fde38[_0x66c5('0x44')][_0x66c5('0x63')]:_0x3537b5['dialCheckDuplicateType'];switch(_0x3537b5[_0x66c5('0x63')]){case _0x66c5('0x64'):_0x5120cb=squel['insert']()['into'](_0x66c5('0x65'))[_0x66c5('0x66')](['phone',_0x66c5('0x67'),_0x66c5('0x68'),_0x66c5('0x69'),_0x66c5('0x57'),'createdAt',_0x66c5('0x51')],squel[_0x66c5('0x6a')]()[_0x66c5('0x6b')](_0x66c5('0x6c'),_0x66c5('0x6c'))['field'](_0x66c5('0x6d'),'scheduledAt')[_0x66c5('0x6b')]('id',_0x66c5('0x68'))[_0x66c5('0x6b')](_0x2ddb83['CmListId'][_0x66c5('0x6e')](),_0x66c5('0x69'))[_0x66c5('0x6b')](_0x2fde38[_0x66c5('0x41')]['id'][_0x66c5('0x6e')](),_0x66c5('0x57'))[_0x66c5('0x6b')]('NOW()','createdAt')['field'](_0x66c5('0x6d'),_0x66c5('0x51'))[_0x66c5('0x6f')]('cm_contacts')[_0x66c5('0x39')](_0x66c5('0x70'))[_0x66c5('0x39')](_0x66c5('0x71'),_0x2ddb83['CmListId'][_0x66c5('0x6e')]())['where'](_0x66c5('0x72'))['where'](_0x66c5('0x73'),squel['select']()[_0x66c5('0x6b')](_0x66c5('0x74'))[_0x66c5('0x6f')](_0x66c5('0x75'))['where'](_0x66c5('0x76'),_0x2fde38[_0x66c5('0x41')]['id'][_0x66c5('0x6e')]()))['where'](_0x66c5('0x73'),squel[_0x66c5('0x6a')]()[_0x66c5('0x6b')](_0x66c5('0x77'))[_0x66c5('0x6f')](_0x66c5('0x65'))[_0x66c5('0x39')]('CampaignId\x20=\x20?',_0x2fde38[_0x66c5('0x41')]['id'][_0x66c5('0x6e')]())))['toString']();break;case _0x66c5('0x78'):_0x5120cb=squel[_0x66c5('0x79')]()[_0x66c5('0x7a')](_0x66c5('0x65'))[_0x66c5('0x66')]([_0x66c5('0x6c'),_0x66c5('0x67'),_0x66c5('0x68'),'ListId',_0x66c5('0x57'),_0x66c5('0x4f'),_0x66c5('0x51')],squel[_0x66c5('0x6a')]()[_0x66c5('0x6b')](_0x66c5('0x6c'),_0x66c5('0x6c'))[_0x66c5('0x6b')](_0x66c5('0x6d'),_0x66c5('0x67'))[_0x66c5('0x6b')]('id',_0x66c5('0x68'))[_0x66c5('0x6b')](_0x2ddb83['CmListId'][_0x66c5('0x6e')](),_0x66c5('0x69'))['field'](_0x2fde38['params']['id'][_0x66c5('0x6e')](),_0x66c5('0x57'))[_0x66c5('0x6b')](_0x66c5('0x6d'),_0x66c5('0x4f'))['field'](_0x66c5('0x6d'),_0x66c5('0x51'))[_0x66c5('0x6f')]('cm_contacts')['where'](_0x66c5('0x70'))[_0x66c5('0x39')]('ListId\x20=\x20?',_0x2ddb83['CmListId'][_0x66c5('0x6e')]())[_0x66c5('0x39')](_0x66c5('0x72'))[_0x66c5('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x66c5('0x6a')]()[_0x66c5('0x6b')]('COALESCE(phone,\x27\x27)')[_0x66c5('0x6f')](_0x66c5('0x65'))[_0x66c5('0x39')](_0x66c5('0x76'),_0x2fde38['params']['id'][_0x66c5('0x6e')]())))[_0x66c5('0x6e')]();break;default:_0x5120cb=squel[_0x66c5('0x79')]()[_0x66c5('0x7a')]('cm_hopper')[_0x66c5('0x66')]([_0x66c5('0x6c'),'scheduledAt','ContactId',_0x66c5('0x69'),'CampaignId','createdAt',_0x66c5('0x51')],squel['select']()[_0x66c5('0x6b')](_0x66c5('0x6c'),_0x66c5('0x6c'))[_0x66c5('0x6b')](_0x66c5('0x6d'),'scheduledAt')[_0x66c5('0x6b')]('id',_0x66c5('0x68'))[_0x66c5('0x6b')](_0x2ddb83[_0x66c5('0x7b')][_0x66c5('0x6e')](),_0x66c5('0x69'))[_0x66c5('0x6b')](_0x2fde38[_0x66c5('0x41')]['id']['toString'](),_0x66c5('0x57'))['field'](_0x66c5('0x6d'),'createdAt')['field'](_0x66c5('0x6d'),'updatedAt')[_0x66c5('0x6f')]('cm_contacts')['where'](_0x66c5('0x70'))['where']('ListId\x20=\x20?',_0x2ddb83[_0x66c5('0x7b')][_0x66c5('0x6e')]())['where'](_0x66c5('0x72')))[_0x66c5('0x6e')]();}_0x1e4e30[_0x66c5('0x7c')](db[_0x66c5('0x7d')][_0x66c5('0x2f')](_0x5120cb));}return BPromise[_0x66c5('0x7e')](_0x1e4e30);}})[_0x66c5('0x24')](function(){return _0x3b1896;})[_0x66c5('0x24')](respondWithResult(_0x49e685,null))[_0x66c5('0x40')](handleError(_0x49e685,null));};exports[_0x66c5('0x7f')]=function(_0x1503be,_0x443bc8,_0x25fc31){return db[_0x66c5('0x2a')][_0x66c5('0x43')]({'where':{'id':_0x1503be[_0x66c5('0x41')]['id']}})[_0x66c5('0x24')](handleEntityNotFound(_0x443bc8,null))[_0x66c5('0x24')](function(_0x466d05){if(_0x466d05){return _0x466d05[_0x66c5('0x7f')](_0x1503be[_0x66c5('0x2f')]['ids']);}})['then'](function(_0x4fdbee){if(_0x4fdbee){return db['CmHopper'][_0x66c5('0x21')]({'where':{'ListId':_0x1503be[_0x66c5('0x2f')][_0x66c5('0x61')],'CampaignId':_0x1503be['params']['id']}})[_0x66c5('0x24')](function(){return _0x4fdbee;});}})[_0x66c5('0x24')](respondWithStatusCode(_0x443bc8,null))[_0x66c5('0x40')](handleError(_0x443bc8,null));};exports[_0x66c5('0x80')]=function(_0x279cfd,_0x39f5b3,_0x494c43){var _0x2d5aed={};var _0x2b6803={};var _0x3d183f;var _0x3cf386;return db[_0x66c5('0x2a')][_0x66c5('0x55')]({'where':{'id':_0x279cfd[_0x66c5('0x41')]['id']}})[_0x66c5('0x24')](handleEntityNotFound(_0x39f5b3,null))[_0x66c5('0x24')](function(_0x1b0e9a){if(_0x1b0e9a){_0x3d183f=_0x1b0e9a;_0x2b6803[_0x66c5('0x2d')]=_[_0x66c5('0x2e')](db[_0x66c5('0x5f')][_0x66c5('0x4d')]);_0x2b6803[_0x66c5('0x2f')]=_[_0x66c5('0x2e')](_0x279cfd[_0x66c5('0x2f')]);_0x2b6803[_0x66c5('0x30')]=_[_0x66c5('0x42')](_0x2b6803[_0x66c5('0x2d')],_0x2b6803[_0x66c5('0x2f')]);_0x2d5aed[_0x66c5('0x31')]=_['intersection'](_0x2b6803[_0x66c5('0x2d')],qs[_0x66c5('0x32')](_0x279cfd[_0x66c5('0x2f')][_0x66c5('0x32')]));_0x2d5aed[_0x66c5('0x31')]=_0x2d5aed[_0x66c5('0x31')][_0x66c5('0x4e')]?_0x2d5aed[_0x66c5('0x31')]:_0x2b6803[_0x66c5('0x2d')];_0x2d5aed[_0x66c5('0x34')]=qs[_0x66c5('0x35')](_0x279cfd[_0x66c5('0x2f')][_0x66c5('0x35')]);_0x2d5aed['where']=qs[_0x66c5('0x30')](_[_0x66c5('0x36')](_0x279cfd[_0x66c5('0x2f')],_0x2b6803[_0x66c5('0x30')]));if(_0x279cfd[_0x66c5('0x2f')][_0x66c5('0x37')]){_0x2d5aed[_0x66c5('0x39')]=_[_0x66c5('0x38')](_0x2d5aed[_0x66c5('0x39')],{'$or':_['map'](_0x2d5aed[_0x66c5('0x31')],function(_0x1471da){var _0x26ea12={};_0x26ea12[_0x1471da]={'$like':'%'+_0x279cfd[_0x66c5('0x2f')][_0x66c5('0x37')]+'%'};return _0x26ea12;})});}_0x2d5aed=_[_0x66c5('0x38')]({},_0x2d5aed,_0x279cfd['options']);return _0x3d183f[_0x66c5('0x80')](_0x2d5aed);}})[_0x66c5('0x24')](function(_0xc8f1a6){if(_0xc8f1a6){_0x3cf386=_0xc8f1a6[_0x66c5('0x4e')];if(!_0x279cfd[_0x66c5('0x2f')][_0x66c5('0x56')](_0x66c5('0x33'))){_0x2d5aed[_0x66c5('0x19')]=qs[_0x66c5('0x19')](_0x279cfd[_0x66c5('0x2f')]['limit']);_0x2d5aed['offset']=qs[_0x66c5('0x1b')](_0x279cfd[_0x66c5('0x2f')]['offset']);}return _0x3d183f[_0x66c5('0x80')](_0x2d5aed);}})[_0x66c5('0x24')](function(_0x3af068){if(_0x3af068){return _0x3af068?{'count':_0x3cf386,'rows':_0x3af068}:null;}})['then'](respondWithResult(_0x39f5b3,null))['catch'](handleError(_0x39f5b3,null));};exports['addBlackLists']=function(_0x196faa,_0x4c13ab,_0xddf505){var _0x11c950,_0x4184d5;return db['Campaign']['find']({'where':{'id':_0x196faa[_0x66c5('0x41')]['id']}})[_0x66c5('0x24')](handleEntityNotFound(_0x4c13ab,null))[_0x66c5('0x24')](function(_0x32b4f1){if(_0x32b4f1){_0x4184d5=_0x32b4f1;return _0x32b4f1[_0x66c5('0x81')](_0x196faa[_0x66c5('0x44')][_0x66c5('0x61')],_[_0x66c5('0x50')](_0x196faa[_0x66c5('0x44')],[_0x66c5('0x61'),'id'])||{});}return null;})[_0x66c5('0x62')](function(_0x125080){var _0x38616f;_0x11c950=_0x125080||[];var _0x41354d=[];if(_0x125080){for(var _0x1f5937=0x0;_0x1f5937<_0x125080['length'];_0x1f5937+=0x1){var _0x5bb8b8=_0x125080[_0x1f5937][_0x66c5('0x22')]({'plain':!![]});_0x38616f=squel[_0x66c5('0x79')]()[_0x66c5('0x7a')](_0x66c5('0x82'))[_0x66c5('0x66')]([_0x66c5('0x6c'),_0x66c5('0x68'),_0x66c5('0x69'),'CampaignId','createdAt',_0x66c5('0x51')],squel[_0x66c5('0x6a')]()[_0x66c5('0x6b')](_0x66c5('0x6c'),_0x66c5('0x6c'))['field']('id',_0x66c5('0x68'))[_0x66c5('0x6b')](_0x5bb8b8[_0x66c5('0x7b')][_0x66c5('0x6e')](),'ListId')[_0x66c5('0x6b')](_0x196faa[_0x66c5('0x41')]['id'][_0x66c5('0x6e')](),_0x66c5('0x57'))[_0x66c5('0x6b')]('NOW()',_0x66c5('0x4f'))[_0x66c5('0x6b')](_0x66c5('0x6d'),_0x66c5('0x51'))[_0x66c5('0x6f')](_0x66c5('0x83'))[_0x66c5('0x39')]('deletedAt\x20IS\x20NULL')[_0x66c5('0x39')](_0x66c5('0x71'),_0x5bb8b8[_0x66c5('0x7b')]['toString']())[_0x66c5('0x39')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x41354d[_0x66c5('0x7c')](db[_0x66c5('0x7d')][_0x66c5('0x2f')](_0x38616f));}return BPromise[_0x66c5('0x7e')](_0x41354d);}})[_0x66c5('0x24')](function(){return _0x11c950;})[_0x66c5('0x24')](respondWithResult(_0x4c13ab,null))[_0x66c5('0x40')](handleError(_0x4c13ab,null));};exports[_0x66c5('0x84')]=function(_0x5eefd1,_0x4f7705,_0x4dc7c8){return db[_0x66c5('0x2a')][_0x66c5('0x43')]({'where':{'id':_0x5eefd1[_0x66c5('0x41')]['id']}})['then'](handleEntityNotFound(_0x4f7705,null))[_0x66c5('0x24')](function(_0x38e47c){if(_0x38e47c){return _0x38e47c['removeBlackLists'](_0x5eefd1['query'][_0x66c5('0x61')]);}})[_0x66c5('0x24')](function(_0x509d06){if(_0x509d06){return db[_0x66c5('0x5d')]['destroy']({'where':{'ListId':_0x5eefd1[_0x66c5('0x2f')][_0x66c5('0x61')],'CampaignId':_0x5eefd1['params']['id']}})[_0x66c5('0x24')](function(){return _0x509d06;});}})[_0x66c5('0x24')](respondWithStatusCode(_0x4f7705,null))[_0x66c5('0x40')](handleError(_0x4f7705,null));}; \ No newline at end of file +var _0x314b=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','order','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ListId','field','ContactId','CmListId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','push','removeBlackLists','eml-format','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','json','offset','undefined','limit','count','status','set','Content-Range','save','update','then','destroy','get','IvrCampaigns','end','sendStatus','error','name','send','index','map','Campaign','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','options','includeAll','include','rows','show','params','rawAttributes','fields','merge','find','create'];(function(_0xaa5d96,_0x2854eb){var _0x33e21e=function(_0x3bc2b9){while(--_0x3bc2b9){_0xaa5d96['push'](_0xaa5d96['shift']());}};_0x33e21e(++_0x2854eb);}(_0x314b,0x154));var _0xb314=function(_0x4c8232,_0x4e0dea){_0x4c8232=_0x4c8232-0x0;var _0x3cc8e5=_0x314b[_0x4c8232];return _0x3cc8e5;};'use strict';var emlformat=require(_0xb314('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb314('0x1'));var jsonpatch=require(_0xb314('0x2'));var rp=require(_0xb314('0x3'));var moment=require(_0xb314('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb314('0x5'));var util=require(_0xb314('0x6'));var path=require(_0xb314('0x7'));var sox=require(_0xb314('0x8'));var csv=require(_0xb314('0x9'));var ejs=require(_0xb314('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb314('0xb'));var squel=require(_0xb314('0xc'));var crypto=require(_0xb314('0xd'));var jsforce=require(_0xb314('0xe'));var deskjs=require(_0xb314('0xf'));var toCsv=require(_0xb314('0x9'));var querystring=require(_0xb314('0x10'));var Papa=require(_0xb314('0x11'));var Redis=require(_0xb314('0x12'));var authService=require(_0xb314('0x13'));var qs=require(_0xb314('0x14'));var as=require(_0xb314('0x15'));var hardwareService=require(_0xb314('0x16'));var logger=require(_0xb314('0x17'))(_0xb314('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb314('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48e4d5,_0xf17697){_0xf17697=_0xf17697||0xcc;return function(_0x264d4d){if(_0x264d4d){return _0x48e4d5['sendStatus'](_0xf17697);}return _0x48e4d5['status'](_0xf17697)['end']();};}function respondWithResult(_0x314e6c,_0x18bc13){_0x18bc13=_0x18bc13||0xc8;return function(_0x56e3c8){if(_0x56e3c8){return _0x314e6c['status'](_0x18bc13)[_0xb314('0x1a')](_0x56e3c8);}};}function respondWithFilteredResult(_0x89cc00,_0x49a69d){return function(_0x3c4e7a){if(_0x3c4e7a){var _0x47bc93=typeof _0x49a69d[_0xb314('0x1b')]===_0xb314('0x1c')&&typeof _0x49a69d[_0xb314('0x1d')]==='undefined';var _0x3961b3=_0x3c4e7a[_0xb314('0x1e')];var _0x3bbb9f=_0x47bc93?0x0:_0x49a69d[_0xb314('0x1b')];var _0x30e6b7=_0x47bc93?_0x3c4e7a['count']:_0x49a69d[_0xb314('0x1b')]+_0x49a69d['limit'];var _0xf3a125;if(_0x30e6b7>=_0x3961b3){_0x30e6b7=_0x3961b3;_0xf3a125=0xc8;}else{_0xf3a125=0xce;}_0x89cc00[_0xb314('0x1f')](_0xf3a125);return _0x89cc00[_0xb314('0x20')](_0xb314('0x21'),_0x3bbb9f+'-'+_0x30e6b7+'/'+_0x3961b3)[_0xb314('0x1a')](_0x3c4e7a);}return null;};}function patchUpdates(_0x27f614){return function(_0x273383){try{jsonpatch['apply'](_0x273383,_0x27f614,!![]);}catch(_0x40c941){return BPromise['reject'](_0x40c941);}return _0x273383[_0xb314('0x22')]();};}function saveUpdates(_0x54b463,_0x3eea7d){return function(_0x3e76fe){if(_0x3e76fe){return _0x3e76fe[_0xb314('0x23')](_0x54b463)[_0xb314('0x24')](function(_0x4f62c0){return _0x4f62c0;});}return null;};}function removeEntity(_0x412a1b,_0x5a6a96){return function(_0x2c3aa3){if(_0x2c3aa3){return _0x2c3aa3[_0xb314('0x25')]()['then'](function(){var _0x397bd5=_0x2c3aa3[_0xb314('0x26')]({'plain':!![]});var _0x4d51c6=_0xb314('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x4d51c6,'resourceId':_0x397bd5['id']}})['then'](function(){return _0x2c3aa3;});})[_0xb314('0x24')](function(){_0x412a1b['status'](0xcc)[_0xb314('0x28')]();});}};}function handleEntityNotFound(_0x1d678f,_0x67916f){return function(_0x597786){if(!_0x597786){_0x1d678f[_0xb314('0x29')](0x194);}return _0x597786;};}function handleError(_0x42af57,_0x3dec11){_0x3dec11=_0x3dec11||0x1f4;return function(_0x3f9582){logger[_0xb314('0x2a')](_0x3f9582['stack']);if(_0x3f9582['name']){delete _0x3f9582[_0xb314('0x2b')];}_0x42af57[_0xb314('0x1f')](_0x3dec11)[_0xb314('0x2c')](_0x3f9582);};}exports[_0xb314('0x2d')]=function(_0x344c4f,_0x2d688b){var _0x12a79e={},_0x5cfb5b={},_0x299d0e={'count':0x0,'rows':[]};var _0x122867=_[_0xb314('0x2e')](db[_0xb314('0x2f')]['rawAttributes'],function(_0x25e875){return{'name':_0x25e875[_0xb314('0x30')],'type':_0x25e875[_0xb314('0x31')][_0xb314('0x32')]};});_0x5cfb5b[_0xb314('0x33')]=_['map'](_0x122867,'name');_0x5cfb5b['query']=_[_0xb314('0x34')](_0x344c4f[_0xb314('0x35')]);_0x5cfb5b[_0xb314('0x36')]=_[_0xb314('0x37')](_0x5cfb5b[_0xb314('0x33')],_0x5cfb5b[_0xb314('0x35')]);_0x12a79e['attributes']=_[_0xb314('0x37')](_0x5cfb5b[_0xb314('0x33')],qs['fields'](_0x344c4f[_0xb314('0x35')]['fields']));_0x12a79e[_0xb314('0x38')]=_0x12a79e[_0xb314('0x38')][_0xb314('0x39')]?_0x12a79e[_0xb314('0x38')]:_0x5cfb5b[_0xb314('0x33')];if(!_0x344c4f[_0xb314('0x35')]['hasOwnProperty'](_0xb314('0x3a'))){_0x12a79e['limit']=qs[_0xb314('0x1d')](_0x344c4f[_0xb314('0x35')][_0xb314('0x1d')]);_0x12a79e[_0xb314('0x1b')]=qs['offset'](_0x344c4f[_0xb314('0x35')]['offset']);}_0x12a79e['order']=qs[_0xb314('0x3b')](_0x344c4f[_0xb314('0x35')][_0xb314('0x3b')]);_0x12a79e[_0xb314('0x3c')]=qs[_0xb314('0x36')](_[_0xb314('0x3d')](_0x344c4f[_0xb314('0x35')],_0x5cfb5b[_0xb314('0x36')]),_0x122867);if(_0x344c4f[_0xb314('0x35')][_0xb314('0x3e')]){_0x12a79e['where']=_['merge'](_0x12a79e[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x122867,function(_0x57249a){if(_0x57249a[_0xb314('0x31')]!=='VIRTUAL'){var _0x163c2c={};_0x163c2c[_0x57249a['name']]={'$like':'%'+_0x344c4f[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x163c2c;}})});}_0x12a79e=_['merge']({},_0x12a79e,_0x344c4f[_0xb314('0x3f')]);var _0x1dd52e={'where':_0x12a79e[_0xb314('0x3c')]};return db['Campaign']['count'](_0x1dd52e)[_0xb314('0x24')](function(_0x14f368){_0x299d0e[_0xb314('0x1e')]=_0x14f368;if(_0x344c4f['query'][_0xb314('0x40')]){_0x12a79e[_0xb314('0x41')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x12a79e);})[_0xb314('0x24')](function(_0x3f1504){_0x299d0e[_0xb314('0x42')]=_0x3f1504;return _0x299d0e;})[_0xb314('0x24')](respondWithFilteredResult(_0x2d688b,_0x12a79e))['catch'](handleError(_0x2d688b,null));};exports[_0xb314('0x43')]=function(_0x208ed3,_0x1a3922){var _0x501d26={'raw':![],'where':{'id':_0x208ed3[_0xb314('0x44')]['id']}},_0x2fe237={};_0x2fe237['model']=_['keys'](db['Campaign'][_0xb314('0x45')]);_0x2fe237[_0xb314('0x35')]=_[_0xb314('0x34')](_0x208ed3[_0xb314('0x35')]);_0x2fe237[_0xb314('0x36')]=_[_0xb314('0x37')](_0x2fe237[_0xb314('0x33')],_0x2fe237[_0xb314('0x35')]);_0x501d26[_0xb314('0x38')]=_[_0xb314('0x37')](_0x2fe237[_0xb314('0x33')],qs[_0xb314('0x46')](_0x208ed3[_0xb314('0x35')][_0xb314('0x46')]));_0x501d26[_0xb314('0x38')]=_0x501d26[_0xb314('0x38')]['length']?_0x501d26[_0xb314('0x38')]:_0x2fe237[_0xb314('0x33')];if(_0x208ed3[_0xb314('0x35')][_0xb314('0x40')]){_0x501d26['include']=[{'all':!![]}];}_0x501d26=_[_0xb314('0x47')]({},_0x501d26,_0x208ed3[_0xb314('0x3f')]);return db[_0xb314('0x2f')][_0xb314('0x48')](_0x501d26)[_0xb314('0x24')](handleEntityNotFound(_0x1a3922,null))['then'](respondWithResult(_0x1a3922,null))['catch'](handleError(_0x1a3922,null));};exports[_0xb314('0x49')]=function(_0xfddbe3,_0x64e230){return db[_0xb314('0x2f')]['create'](_0xfddbe3[_0xb314('0x4a')],{})[_0xb314('0x24')](function(_0x485346){var _0x59e917=_0xfddbe3['user'][_0xb314('0x26')]({'plain':!![]});if(!_0x59e917)throw new Error(_0xb314('0x4b'));if(_0x59e917['role']==='user'){var _0x380da2=_0x485346[_0xb314('0x26')]({'plain':!![]});var _0x1dc758='IvrCampaigns';return db[_0xb314('0x4c')][_0xb314('0x48')]({'where':{'name':_0x1dc758,'userProfileId':_0x59e917[_0xb314('0x4d')]},'raw':!![]})[_0xb314('0x24')](function(_0x129987){if(_0x129987&&_0x129987['autoAssociation']===0x0){return db[_0xb314('0x4e')]['create']({'name':_0x380da2[_0xb314('0x2b')],'resourceId':_0x380da2['id'],'type':_0x129987[_0xb314('0x2b')],'sectionId':_0x129987['id']},{})[_0xb314('0x24')](function(){return _0x485346;});}else{return _0x485346;}})[_0xb314('0x4f')](function(_0x226abb){logger['error'](_0xb314('0x50'),_0x226abb);throw _0x226abb;});}return _0x485346;})[_0xb314('0x24')](respondWithResult(_0x64e230,0xc9))['catch'](handleError(_0x64e230,null));};exports[_0xb314('0x51')]=function(_0x4ecdae,_0x3d6e47){var _0x4f3da9={'where':{'id':_0x4ecdae[_0xb314('0x44')]['id']}},_0x182bb0={};_0x182bb0['model']=_['keys'](db[_0xb314('0x2f')][_0xb314('0x45')]);_0x4f3da9[_0xb314('0x38')]=_[_0xb314('0x37')](_0x182bb0[_0xb314('0x33')],qs['fields'](_0x4ecdae[_0xb314('0x35')]['fields']));_0x4f3da9['attributes']=_0x4f3da9[_0xb314('0x38')]['length']?_0x4f3da9['attributes']:_0x182bb0['model'];if(_0x4ecdae[_0xb314('0x35')][_0xb314('0x40')]){_0x4f3da9[_0xb314('0x41')]=[{'all':!![]}];}_0x4f3da9=_[_0xb314('0x47')]({},_0x4f3da9,_0x4ecdae[_0xb314('0x3f')]);return db[_0xb314('0x2f')]['find'](_0x4f3da9)[_0xb314('0x24')](handleEntityNotFound(_0x3d6e47,null))[_0xb314('0x24')](function(_0x40d736){if(_0x40d736){var _0x5b406d=_0x40d736[_0xb314('0x26')]({'plain':!![]});_0x5b406d=qs['omit'](_0x5b406d,['id',_0xb314('0x52'),'updatedAt']);_0x4ecdae[_0xb314('0x4a')]=_[_0xb314('0x53')](_0x4ecdae[_0xb314('0x4a')],['id',_0xb314('0x52'),_0xb314('0x54')]);return db[_0xb314('0x2f')]['create'](_[_0xb314('0x47')](_0x5b406d,_0x4ecdae[_0xb314('0x4a')]),{'include':_0x4ecdae[_0xb314('0x35')][_0xb314('0x40')]?[{'all':!![]}]:undefined})[_0xb314('0x24')](function(_0x346030){var _0x1a272b=_0x4ecdae['user']['get']({'plain':!![]});if(!_0x1a272b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a272b['role']==='user'){var _0x2d04cb=_0x346030['get']({'plain':!![]});var _0x14aa47='IvrCampaigns';return db['UserProfileSection'][_0xb314('0x48')]({'where':{'name':_0x14aa47,'userProfileId':_0x1a272b['userProfileId']},'raw':!![]})[_0xb314('0x24')](function(_0x367765){if(_0x367765&&_0x367765[_0xb314('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d04cb[_0xb314('0x2b')],'resourceId':_0x2d04cb['id'],'type':_0x367765[_0xb314('0x2b')],'sectionId':_0x367765['id']},{})[_0xb314('0x24')](function(){return _0x346030;});}else{return _0x346030;}})['catch'](function(_0x2c69f6){logger['error'](_0xb314('0x50'),_0x2c69f6);throw _0x2c69f6;});}return _0x346030;});}})[_0xb314('0x24')](respondWithResult(_0x3d6e47,0xc9))[_0xb314('0x4f')](handleError(_0x3d6e47,null));};exports[_0xb314('0x23')]=function(_0x19683c,_0x262f43){if(_0x19683c['body']['id']){delete _0x19683c[_0xb314('0x4a')]['id'];}return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x19683c[_0xb314('0x44')]['id']}})['then'](handleEntityNotFound(_0x262f43,null))[_0xb314('0x24')](saveUpdates(_0x19683c[_0xb314('0x4a')],null))[_0xb314('0x24')](respondWithResult(_0x262f43,null))[_0xb314('0x4f')](handleError(_0x262f43,null));};exports[_0xb314('0x25')]=function(_0x30d854,_0x2dfc64){return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x30d854[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x2dfc64,null))[_0xb314('0x24')](removeEntity(_0x2dfc64,null))[_0xb314('0x4f')](handleError(_0x2dfc64,null));};exports[_0xb314('0x56')]=function(_0x7e11aa,_0x2ef60b,_0x2396a4){var _0x27b3ea={'raw':!![],'where':{}};var _0x49f8ae={};var _0x503d58={'count':0x0,'rows':[]};return db[_0xb314('0x2f')][_0xb314('0x57')]({'where':{'id':_0x7e11aa[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x2ef60b,null))['then'](function(_0x1c3d48){if(_0x1c3d48){_0x49f8ae[_0xb314('0x33')]=_[_0xb314('0x34')](db[_0xb314('0x58')]['rawAttributes']);_0x49f8ae[_0xb314('0x35')]=_[_0xb314('0x34')](_0x7e11aa['query']);_0x49f8ae[_0xb314('0x36')]=_[_0xb314('0x37')](_0x49f8ae['model'],_0x49f8ae[_0xb314('0x35')]);_0x27b3ea[_0xb314('0x38')]=_[_0xb314('0x37')](_0x49f8ae['model'],qs[_0xb314('0x46')](_0x7e11aa[_0xb314('0x35')][_0xb314('0x46')]));_0x27b3ea[_0xb314('0x38')]=_0x27b3ea['attributes'][_0xb314('0x39')]?_0x27b3ea['attributes']:_0x49f8ae['model'];if(!_0x7e11aa['query'][_0xb314('0x59')](_0xb314('0x3a'))){_0x27b3ea[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0x7e11aa[_0xb314('0x35')][_0xb314('0x1d')]);_0x27b3ea['offset']=qs[_0xb314('0x1b')](_0x7e11aa[_0xb314('0x35')]['offset']);}_0x27b3ea['order']=qs[_0xb314('0x3b')](_0x7e11aa[_0xb314('0x35')][_0xb314('0x3b')]);_0x27b3ea[_0xb314('0x3c')]=qs[_0xb314('0x36')](_['pick'](_0x7e11aa[_0xb314('0x35')],_0x49f8ae[_0xb314('0x36')]));_0x27b3ea[_0xb314('0x3c')][_0xb314('0x5a')]=_0x1c3d48['id'];if(_0x7e11aa[_0xb314('0x35')][_0xb314('0x3e')]){_0x27b3ea[_0xb314('0x3c')]=_['merge'](_0x27b3ea[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x27b3ea[_0xb314('0x38')],function(_0x4e2901){var _0x1d73ad={};_0x1d73ad[_0x4e2901]={'$like':'%'+_0x7e11aa[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x1d73ad;})});}_0x27b3ea=_['merge']({},_0x27b3ea,_0x7e11aa[_0xb314('0x3f')]);return db[_0xb314('0x58')][_0xb314('0x1e')]({'where':_0x27b3ea[_0xb314('0x3c')]})[_0xb314('0x24')](function(_0x44e104){_0x503d58['count']=_0x44e104;if(_0x7e11aa[_0xb314('0x35')]['includeAll']){_0x27b3ea[_0xb314('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0xb314('0x5b')](_0x27b3ea);})['then'](function(_0x3c7802){_0x503d58[_0xb314('0x42')]=_0x3c7802;return _0x503d58;});}})[_0xb314('0x24')](respondWithFilteredResult(_0x2ef60b,_0x27b3ea))[_0xb314('0x4f')](handleError(_0x2ef60b,null));};exports[_0xb314('0x5c')]=function(_0x4e8edd,_0x106426,_0x5550e6){var _0x5baecc={'raw':!![],'where':{}};var _0x1b165b={};var _0x3962e8={'count':0x0,'rows':[]};return db['Campaign'][_0xb314('0x57')]({'where':{'id':_0x4e8edd[_0xb314('0x44')]['id']}})['then'](handleEntityNotFound(_0x106426,null))[_0xb314('0x24')](function(_0x5785a0){if(_0x5785a0){_0x1b165b[_0xb314('0x33')]=_[_0xb314('0x34')](db[_0xb314('0x5d')][_0xb314('0x45')]);_0x1b165b[_0xb314('0x35')]=_['keys'](_0x4e8edd[_0xb314('0x35')]);_0x1b165b[_0xb314('0x36')]=_['intersection'](_0x1b165b[_0xb314('0x33')],_0x1b165b[_0xb314('0x35')]);_0x5baecc[_0xb314('0x38')]=_['intersection'](_0x1b165b[_0xb314('0x33')],qs[_0xb314('0x46')](_0x4e8edd[_0xb314('0x35')][_0xb314('0x46')]));_0x5baecc['attributes']=_0x5baecc[_0xb314('0x38')][_0xb314('0x39')]?_0x5baecc['attributes']:_0x1b165b[_0xb314('0x33')];if(!_0x4e8edd[_0xb314('0x35')][_0xb314('0x59')](_0xb314('0x3a'))){_0x5baecc[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0x4e8edd['query'][_0xb314('0x1d')]);_0x5baecc[_0xb314('0x1b')]=qs['offset'](_0x4e8edd['query'][_0xb314('0x1b')]);}_0x5baecc['order']=qs[_0xb314('0x3b')](_0x4e8edd[_0xb314('0x35')]['sort']);_0x5baecc[_0xb314('0x3c')]=qs['filters'](_[_0xb314('0x3d')](_0x4e8edd[_0xb314('0x35')],_0x1b165b['filters']));_0x5baecc[_0xb314('0x3c')]['CampaignId']=_0x5785a0['id'];if(_0x4e8edd[_0xb314('0x35')][_0xb314('0x3e')]){_0x5baecc['where']=_[_0xb314('0x47')](_0x5baecc[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x5baecc[_0xb314('0x38')],function(_0x540ea3){var _0x4b139e={};_0x4b139e[_0x540ea3]={'$like':'%'+_0x4e8edd[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x4b139e;})});}_0x5baecc=_['merge']({},_0x5baecc,_0x4e8edd[_0xb314('0x3f')]);return db[_0xb314('0x5d')]['count']({'where':_0x5baecc[_0xb314('0x3c')]})['then'](function(_0x508402){_0x3962e8[_0xb314('0x1e')]=_0x508402;if(_0x4e8edd[_0xb314('0x35')][_0xb314('0x40')]){_0x5baecc['include']=[{'all':!![]}];}return db[_0xb314('0x5d')][_0xb314('0x5b')](_0x5baecc);})['then'](function(_0x4c7ffa){_0x3962e8[_0xb314('0x42')]=_0x4c7ffa;return _0x3962e8;});}})[_0xb314('0x24')](respondWithFilteredResult(_0x106426,_0x5baecc))['catch'](handleError(_0x106426,null));};exports[_0xb314('0x5e')]=function(_0xa49c3,_0x36bdfc,_0x36aef7){var _0x560de0={'raw':!![],'where':{}};var _0xaf6c5f={};var _0x44476d={'count':0x0,'rows':[]};return db['Campaign'][_0xb314('0x57')]({'where':{'id':_0xa49c3[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x36bdfc,null))['then'](function(_0x240ff9){if(_0x240ff9){_0xaf6c5f[_0xb314('0x33')]=_[_0xb314('0x34')](db['CmHopperFinal']['rawAttributes']);_0xaf6c5f[_0xb314('0x35')]=_[_0xb314('0x34')](_0xa49c3[_0xb314('0x35')]);_0xaf6c5f['filters']=_[_0xb314('0x37')](_0xaf6c5f[_0xb314('0x33')],_0xaf6c5f[_0xb314('0x35')]);_0x560de0[_0xb314('0x38')]=_[_0xb314('0x37')](_0xaf6c5f[_0xb314('0x33')],qs['fields'](_0xa49c3[_0xb314('0x35')][_0xb314('0x46')]));_0x560de0[_0xb314('0x38')]=_0x560de0[_0xb314('0x38')]['length']?_0x560de0[_0xb314('0x38')]:_0xaf6c5f[_0xb314('0x33')];if(!_0xa49c3[_0xb314('0x35')]['hasOwnProperty'](_0xb314('0x3a'))){_0x560de0[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0xa49c3[_0xb314('0x35')]['limit']);_0x560de0[_0xb314('0x1b')]=qs[_0xb314('0x1b')](_0xa49c3['query']['offset']);}_0x560de0['order']=qs[_0xb314('0x3b')](_0xa49c3[_0xb314('0x35')][_0xb314('0x3b')]);_0x560de0[_0xb314('0x3c')]=qs[_0xb314('0x36')](_[_0xb314('0x3d')](_0xa49c3[_0xb314('0x35')],_0xaf6c5f[_0xb314('0x36')]));_0x560de0[_0xb314('0x3c')][_0xb314('0x5a')]=_0x240ff9['id'];if(_0xa49c3[_0xb314('0x35')][_0xb314('0x3e')]){_0x560de0[_0xb314('0x3c')]=_[_0xb314('0x47')](_0x560de0[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x560de0[_0xb314('0x38')],function(_0x15b775){var _0x3e7712={};_0x3e7712[_0x15b775]={'$like':'%'+_0xa49c3[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x3e7712;})});}_0x560de0=_[_0xb314('0x47')]({},_0x560de0,_0xa49c3[_0xb314('0x3f')]);return db[_0xb314('0x5f')][_0xb314('0x1e')]({'where':_0x560de0[_0xb314('0x3c')]})[_0xb314('0x24')](function(_0x121a67){_0x44476d[_0xb314('0x1e')]=_0x121a67;if(_0xa49c3['query']['includeAll']){_0x560de0['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xb314('0x5b')](_0x560de0);})[_0xb314('0x24')](function(_0x15e33a){_0x44476d['rows']=_0x15e33a;return _0x44476d;});}})[_0xb314('0x24')](respondWithFilteredResult(_0x36bdfc,_0x560de0))[_0xb314('0x4f')](handleError(_0x36bdfc,null));};exports[_0xb314('0x60')]=function(_0x19c764,_0x257f85,_0x2ed3cc){var _0x2e9158={'raw':!![],'where':{}};var _0x4d09e1={};var _0x19f8a7={'count':0x0,'rows':[]};return db[_0xb314('0x2f')][_0xb314('0x57')]({'where':{'id':_0x19c764['params']['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x257f85,null))[_0xb314('0x24')](function(_0x2d0e8b){if(_0x2d0e8b){_0x4d09e1[_0xb314('0x33')]=_[_0xb314('0x34')](db[_0xb314('0x61')][_0xb314('0x45')]);_0x4d09e1[_0xb314('0x35')]=_['keys'](_0x19c764[_0xb314('0x35')]);_0x4d09e1[_0xb314('0x36')]=_[_0xb314('0x37')](_0x4d09e1[_0xb314('0x33')],_0x4d09e1['query']);_0x2e9158['attributes']=_[_0xb314('0x37')](_0x4d09e1['model'],qs['fields'](_0x19c764[_0xb314('0x35')]['fields']));_0x2e9158['attributes']=_0x2e9158[_0xb314('0x38')][_0xb314('0x39')]?_0x2e9158[_0xb314('0x38')]:_0x4d09e1[_0xb314('0x33')];if(!_0x19c764['query'][_0xb314('0x59')](_0xb314('0x3a'))){_0x2e9158['limit']=qs[_0xb314('0x1d')](_0x19c764[_0xb314('0x35')][_0xb314('0x1d')]);_0x2e9158['offset']=qs[_0xb314('0x1b')](_0x19c764[_0xb314('0x35')][_0xb314('0x1b')]);}_0x2e9158[_0xb314('0x62')]=qs[_0xb314('0x3b')](_0x19c764[_0xb314('0x35')]['sort']);_0x2e9158[_0xb314('0x3c')]=qs[_0xb314('0x36')](_[_0xb314('0x3d')](_0x19c764[_0xb314('0x35')],_0x4d09e1[_0xb314('0x36')]));_0x2e9158[_0xb314('0x3c')][_0xb314('0x5a')]=_0x2d0e8b['id'];if(_0x19c764[_0xb314('0x35')][_0xb314('0x3e')]){_0x2e9158[_0xb314('0x3c')]=_['merge'](_0x2e9158[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x2e9158[_0xb314('0x38')],function(_0x3266ac){var _0x3b97b5={};_0x3b97b5[_0x3266ac]={'$like':'%'+_0x19c764[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x3b97b5;})});}_0x2e9158=_[_0xb314('0x47')]({},_0x2e9158,_0x19c764[_0xb314('0x3f')]);return db[_0xb314('0x61')][_0xb314('0x1e')]({'where':_0x2e9158[_0xb314('0x3c')]})['then'](function(_0x1e092e){_0x19f8a7['count']=_0x1e092e;if(_0x19c764[_0xb314('0x35')][_0xb314('0x40')]){_0x2e9158['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2e9158);})[_0xb314('0x24')](function(_0x16f132){_0x19f8a7[_0xb314('0x42')]=_0x16f132;return _0x19f8a7;});}})[_0xb314('0x24')](respondWithFilteredResult(_0x257f85,_0x2e9158))[_0xb314('0x4f')](handleError(_0x257f85,null));};exports[_0xb314('0x63')]=function(_0x28a22f,_0x2b7873,_0x51f30d){var _0x5d5bcf={};var _0x54587e={};var _0x26e045;var _0x24df63;return db[_0xb314('0x2f')][_0xb314('0x57')]({'where':{'id':_0x28a22f['params']['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x2b7873,null))['then'](function(_0x378122){if(_0x378122){_0x26e045=_0x378122;_0x54587e['model']=_[_0xb314('0x34')](db['CmList'][_0xb314('0x45')]);_0x54587e['query']=_[_0xb314('0x34')](_0x28a22f[_0xb314('0x35')]);_0x54587e[_0xb314('0x36')]=_[_0xb314('0x37')](_0x54587e['model'],_0x54587e['query']);_0x5d5bcf['attributes']=_[_0xb314('0x37')](_0x54587e[_0xb314('0x33')],qs[_0xb314('0x46')](_0x28a22f[_0xb314('0x35')][_0xb314('0x46')]));_0x5d5bcf[_0xb314('0x38')]=_0x5d5bcf[_0xb314('0x38')]['length']?_0x5d5bcf[_0xb314('0x38')]:_0x54587e[_0xb314('0x33')];_0x5d5bcf[_0xb314('0x62')]=qs[_0xb314('0x3b')](_0x28a22f[_0xb314('0x35')]['sort']);_0x5d5bcf[_0xb314('0x3c')]=qs['filters'](_[_0xb314('0x3d')](_0x28a22f[_0xb314('0x35')],_0x54587e[_0xb314('0x36')]));if(_0x28a22f[_0xb314('0x35')]['filter']){_0x5d5bcf[_0xb314('0x3c')]=_[_0xb314('0x47')](_0x5d5bcf[_0xb314('0x3c')],{'$or':_[_0xb314('0x2e')](_0x5d5bcf['attributes'],function(_0x3e884a){var _0x1fece0={};_0x1fece0[_0x3e884a]={'$like':'%'+_0x28a22f[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x1fece0;})});}_0x5d5bcf=_[_0xb314('0x47')]({},_0x5d5bcf,_0x28a22f[_0xb314('0x3f')]);return _0x26e045[_0xb314('0x63')](_0x5d5bcf);}})['then'](function(_0x1fe946){if(_0x1fe946){_0x24df63=_0x1fe946[_0xb314('0x39')];if(!_0x28a22f[_0xb314('0x35')]['hasOwnProperty'](_0xb314('0x3a'))){_0x5d5bcf[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0x28a22f[_0xb314('0x35')][_0xb314('0x1d')]);_0x5d5bcf[_0xb314('0x1b')]=qs[_0xb314('0x1b')](_0x28a22f[_0xb314('0x35')][_0xb314('0x1b')]);}return _0x26e045[_0xb314('0x63')](_0x5d5bcf);}})[_0xb314('0x24')](function(_0x265d9d){if(_0x265d9d){return _0x265d9d?{'count':_0x24df63,'rows':_0x265d9d}:null;}})[_0xb314('0x24')](respondWithResult(_0x2b7873,null))[_0xb314('0x4f')](handleError(_0x2b7873,null));};exports[_0xb314('0x64')]=function(_0x52a964,_0x5ddeb,_0x30fa8f){var _0x291a2a,_0x45bed4;return db['Campaign'][_0xb314('0x48')]({'where':{'id':_0x52a964['params']['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x5ddeb,null))[_0xb314('0x24')](function(_0x5a93be){if(_0x5a93be){_0x45bed4=_0x5a93be;return _0x5a93be[_0xb314('0x64')](_0x52a964[_0xb314('0x4a')]['ids'],_[_0xb314('0x53')](_0x52a964[_0xb314('0x4a')],[_0xb314('0x65'),'id'])||{});}return null;})[_0xb314('0x66')](function(_0x3383){var _0x297b3a;_0x291a2a=_0x3383||[];var _0x21a832=[];if(_0x3383){for(var _0x2fd297=0x0;_0x2fd297<_0x3383[_0xb314('0x39')];_0x2fd297+=0x1){var _0x767d7=_0x3383[_0x2fd297][_0xb314('0x26')]({'plain':!![]});_0x45bed4[_0xb314('0x67')]=_0x52a964[_0xb314('0x4a')][_0xb314('0x67')]?_0x52a964['body'][_0xb314('0x67')]:_0x45bed4[_0xb314('0x67')];switch(_0x45bed4[_0xb314('0x67')]){case _0xb314('0x68'):_0x297b3a=squel[_0xb314('0x69')]()[_0xb314('0x6a')]('cm_hopper')['fromQuery']([_0xb314('0x6b'),_0xb314('0x6c'),'ContactId',_0xb314('0x6d'),'CampaignId',_0xb314('0x52'),'updatedAt'],squel['select']()[_0xb314('0x6e')](_0xb314('0x6b'),_0xb314('0x6b'))[_0xb314('0x6e')]('NOW()','scheduledAt')[_0xb314('0x6e')]('id',_0xb314('0x6f'))[_0xb314('0x6e')](_0x767d7[_0xb314('0x70')][_0xb314('0x71')](),_0xb314('0x6d'))[_0xb314('0x6e')](_0x52a964[_0xb314('0x44')]['id']['toString'](),_0xb314('0x5a'))[_0xb314('0x6e')](_0xb314('0x72'),_0xb314('0x52'))['field'](_0xb314('0x72'),_0xb314('0x54'))[_0xb314('0x73')]('cm_contacts')['where'](_0xb314('0x74'))['where'](_0xb314('0x75'),_0x767d7[_0xb314('0x70')][_0xb314('0x71')]())[_0xb314('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xb314('0x3c')](_0xb314('0x76'),squel[_0xb314('0x77')]()['field'](_0xb314('0x78'))[_0xb314('0x73')](_0xb314('0x79'))[_0xb314('0x3c')]('CampaignId\x20=\x20?',_0x52a964[_0xb314('0x44')]['id'][_0xb314('0x71')]()))['where'](_0xb314('0x76'),squel['select']()['field'](_0xb314('0x7a'))[_0xb314('0x73')](_0xb314('0x7b'))[_0xb314('0x3c')](_0xb314('0x7c'),_0x52a964['params']['id']['toString']())))['toString']();break;case _0xb314('0x7d'):_0x297b3a=squel[_0xb314('0x69')]()[_0xb314('0x6a')](_0xb314('0x7b'))[_0xb314('0x7e')]([_0xb314('0x6b'),_0xb314('0x6c'),_0xb314('0x6f'),_0xb314('0x6d'),_0xb314('0x5a'),_0xb314('0x52'),'updatedAt'],squel['select']()['field']('phone','phone')[_0xb314('0x6e')](_0xb314('0x72'),_0xb314('0x6c'))[_0xb314('0x6e')]('id',_0xb314('0x6f'))[_0xb314('0x6e')](_0x767d7[_0xb314('0x70')][_0xb314('0x71')](),_0xb314('0x6d'))[_0xb314('0x6e')](_0x52a964[_0xb314('0x44')]['id'][_0xb314('0x71')](),_0xb314('0x5a'))[_0xb314('0x6e')]('NOW()',_0xb314('0x52'))[_0xb314('0x6e')](_0xb314('0x72'),_0xb314('0x54'))['from'](_0xb314('0x7f'))['where'](_0xb314('0x74'))[_0xb314('0x3c')](_0xb314('0x75'),_0x767d7[_0xb314('0x70')][_0xb314('0x71')]())[_0xb314('0x3c')](_0xb314('0x80'))[_0xb314('0x3c')](_0xb314('0x76'),squel[_0xb314('0x77')]()[_0xb314('0x6e')](_0xb314('0x7a'))[_0xb314('0x73')]('cm_hopper')[_0xb314('0x3c')](_0xb314('0x7c'),_0x52a964[_0xb314('0x44')]['id'][_0xb314('0x71')]())))[_0xb314('0x71')]();break;default:_0x297b3a=squel[_0xb314('0x69')]()['into'](_0xb314('0x7b'))['fromQuery'](['phone',_0xb314('0x6c'),_0xb314('0x6f'),_0xb314('0x6d'),_0xb314('0x5a'),'createdAt',_0xb314('0x54')],squel[_0xb314('0x77')]()['field'](_0xb314('0x6b'),_0xb314('0x6b'))['field'](_0xb314('0x72'),'scheduledAt')[_0xb314('0x6e')]('id',_0xb314('0x6f'))['field'](_0x767d7['CmListId']['toString'](),'ListId')[_0xb314('0x6e')](_0x52a964[_0xb314('0x44')]['id'][_0xb314('0x71')](),'CampaignId')[_0xb314('0x6e')]('NOW()',_0xb314('0x52'))[_0xb314('0x6e')]('NOW()',_0xb314('0x54'))[_0xb314('0x73')](_0xb314('0x7f'))[_0xb314('0x3c')]('deletedAt\x20IS\x20NULL')[_0xb314('0x3c')](_0xb314('0x75'),_0x767d7[_0xb314('0x70')][_0xb314('0x71')]())[_0xb314('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xb314('0x71')]();}_0x21a832['push'](db[_0xb314('0x81')][_0xb314('0x35')](_0x297b3a));}return BPromise[_0xb314('0x82')](_0x21a832);}})[_0xb314('0x24')](function(){return _0x291a2a;})['then'](respondWithResult(_0x5ddeb,null))[_0xb314('0x4f')](handleError(_0x5ddeb,null));};exports['removeLists']=function(_0x469604,_0x495288,_0x5ecb98){return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x469604[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x495288,null))['then'](function(_0x90af6b){if(_0x90af6b){return _0x90af6b[_0xb314('0x83')](_0x469604[_0xb314('0x35')][_0xb314('0x65')]);}})[_0xb314('0x24')](function(_0x4c091d){if(_0x4c091d){return db['CmHopper'][_0xb314('0x25')]({'where':{'ListId':_0x469604['query'][_0xb314('0x65')],'CampaignId':_0x469604[_0xb314('0x44')]['id']}})['then'](function(){return _0x4c091d;});}})['then'](respondWithStatusCode(_0x495288,null))['catch'](handleError(_0x495288,null));};exports[_0xb314('0x84')]=function(_0xd07fd4,_0x2f19f3,_0x469fd6){var _0x9563bb={};var _0x45be54={};var _0x5c171f;var _0x3ee97e;return db[_0xb314('0x2f')][_0xb314('0x57')]({'where':{'id':_0xd07fd4[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x2f19f3,null))[_0xb314('0x24')](function(_0xfd47ad){if(_0xfd47ad){_0x5c171f=_0xfd47ad;_0x45be54[_0xb314('0x33')]=_[_0xb314('0x34')](db[_0xb314('0x85')][_0xb314('0x45')]);_0x45be54[_0xb314('0x35')]=_[_0xb314('0x34')](_0xd07fd4[_0xb314('0x35')]);_0x45be54[_0xb314('0x36')]=_[_0xb314('0x37')](_0x45be54[_0xb314('0x33')],_0x45be54[_0xb314('0x35')]);_0x9563bb[_0xb314('0x38')]=_[_0xb314('0x37')](_0x45be54[_0xb314('0x33')],qs[_0xb314('0x46')](_0xd07fd4[_0xb314('0x35')][_0xb314('0x46')]));_0x9563bb[_0xb314('0x38')]=_0x9563bb[_0xb314('0x38')][_0xb314('0x39')]?_0x9563bb[_0xb314('0x38')]:_0x45be54[_0xb314('0x33')];_0x9563bb['order']=qs[_0xb314('0x3b')](_0xd07fd4[_0xb314('0x35')][_0xb314('0x3b')]);_0x9563bb[_0xb314('0x3c')]=qs['filters'](_[_0xb314('0x3d')](_0xd07fd4[_0xb314('0x35')],_0x45be54[_0xb314('0x36')]));if(_0xd07fd4[_0xb314('0x35')][_0xb314('0x3e')]){_0x9563bb[_0xb314('0x3c')]=_[_0xb314('0x47')](_0x9563bb['where'],{'$or':_[_0xb314('0x2e')](_0x9563bb['attributes'],function(_0x1b24d7){var _0x4be784={};_0x4be784[_0x1b24d7]={'$like':'%'+_0xd07fd4[_0xb314('0x35')][_0xb314('0x3e')]+'%'};return _0x4be784;})});}_0x9563bb=_['merge']({},_0x9563bb,_0xd07fd4['options']);return _0x5c171f['getBlackLists'](_0x9563bb);}})['then'](function(_0x24e298){if(_0x24e298){_0x3ee97e=_0x24e298['length'];if(!_0xd07fd4[_0xb314('0x35')][_0xb314('0x59')](_0xb314('0x3a'))){_0x9563bb[_0xb314('0x1d')]=qs[_0xb314('0x1d')](_0xd07fd4[_0xb314('0x35')]['limit']);_0x9563bb['offset']=qs[_0xb314('0x1b')](_0xd07fd4['query'][_0xb314('0x1b')]);}return _0x5c171f['getBlackLists'](_0x9563bb);}})['then'](function(_0x248226){if(_0x248226){return _0x248226?{'count':_0x3ee97e,'rows':_0x248226}:null;}})[_0xb314('0x24')](respondWithResult(_0x2f19f3,null))['catch'](handleError(_0x2f19f3,null));};exports[_0xb314('0x86')]=function(_0x44c85e,_0xf476ce,_0x5f4646){var _0x158b42,_0x3cd32e;return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x44c85e[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0xf476ce,null))[_0xb314('0x24')](function(_0x2e2fca){if(_0x2e2fca){_0x3cd32e=_0x2e2fca;return _0x2e2fca[_0xb314('0x86')](_0x44c85e[_0xb314('0x4a')][_0xb314('0x65')],_[_0xb314('0x53')](_0x44c85e[_0xb314('0x4a')],['ids','id'])||{});}return null;})[_0xb314('0x66')](function(_0x1b9e61){var _0x520d84;_0x158b42=_0x1b9e61||[];var _0x341c96=[];if(_0x1b9e61){for(var _0x5da7a3=0x0;_0x5da7a3<_0x1b9e61[_0xb314('0x39')];_0x5da7a3+=0x1){var _0x3e021a=_0x1b9e61[_0x5da7a3][_0xb314('0x26')]({'plain':!![]});_0x520d84=squel[_0xb314('0x69')]()[_0xb314('0x6a')](_0xb314('0x87'))[_0xb314('0x7e')]([_0xb314('0x6b'),_0xb314('0x6f'),'ListId',_0xb314('0x5a'),'createdAt',_0xb314('0x54')],squel['select']()[_0xb314('0x6e')]('phone',_0xb314('0x6b'))[_0xb314('0x6e')]('id','ContactId')[_0xb314('0x6e')](_0x3e021a[_0xb314('0x70')][_0xb314('0x71')](),_0xb314('0x6d'))['field'](_0x44c85e[_0xb314('0x44')]['id'][_0xb314('0x71')](),_0xb314('0x5a'))[_0xb314('0x6e')]('NOW()','createdAt')[_0xb314('0x6e')](_0xb314('0x72'),'updatedAt')[_0xb314('0x73')]('cm_contacts')['where'](_0xb314('0x74'))[_0xb314('0x3c')](_0xb314('0x75'),_0x3e021a['CmListId'][_0xb314('0x71')]())['where'](_0xb314('0x80')))[_0xb314('0x71')]();_0x341c96[_0xb314('0x88')](db['sequelize']['query'](_0x520d84));}return BPromise[_0xb314('0x82')](_0x341c96);}})[_0xb314('0x24')](function(){return _0x158b42;})[_0xb314('0x24')](respondWithResult(_0xf476ce,null))[_0xb314('0x4f')](handleError(_0xf476ce,null));};exports[_0xb314('0x89')]=function(_0x5d4421,_0x411e5e,_0x24f186){return db[_0xb314('0x2f')][_0xb314('0x48')]({'where':{'id':_0x5d4421[_0xb314('0x44')]['id']}})[_0xb314('0x24')](handleEntityNotFound(_0x411e5e,null))[_0xb314('0x24')](function(_0x20ca3b){if(_0x20ca3b){return _0x20ca3b['removeBlackLists'](_0x5d4421[_0xb314('0x35')]['ids']);}})[_0xb314('0x24')](function(_0x817002){if(_0x817002){return db[_0xb314('0x61')]['destroy']({'where':{'ListId':_0x5d4421['query'][_0xb314('0x65')],'CampaignId':_0x5d4421[_0xb314('0x44')]['id']}})[_0xb314('0x24')](function(){return _0x817002;});}})[_0xb314('0x24')](respondWithStatusCode(_0x411e5e,null))['catch'](handleError(_0x411e5e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 0584438..feb1cf2 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1e2de4,_0x22d700){var _0x4a5929=function(_0x5acb56){while(--_0x5acb56){_0x1e2de4['push'](_0x1e2de4['shift']());}};_0x4a5929(++_0x22d700);}(_0x7a54,0x106));var _0x47a5=function(_0x30868b,_0x4069fb){_0x30868b=_0x30868b-0x0;var _0x248359=_0x7a54[_0x30868b];return _0x248359;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x7a54,0x106));var _0x47a5=function(_0x45a4cf,_0x447b68){_0x45a4cf=_0x45a4cf-0x0;var _0x17c90a=_0x7a54[_0x45a4cf];return _0x17c90a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 7fc6751..1ae9b4e 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 _0x7aaf=['GetCampaign','Campaign','findAll','raw','options','where','include','map','model','attributes','then','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x44fc51,_0x345c9a){_0x44fc51=_0x44fc51-0x0;var _0x13054b=_0x7aaf[_0x44fc51];return _0x13054b;};'use strict';var _=require(_0xf7aa('0x0'));var util=require('util');var moment=require(_0xf7aa('0x1'));var BPromise=require(_0xf7aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7aa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf7aa('0x4'))('rpc');var config=require(_0xf7aa('0x5'));var jayson=require(_0xf7aa('0x6'));var client=jayson[_0xf7aa('0x7')][_0xf7aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47f259,_0x46d632,_0x5d0495){return new BPromise(function(_0x598c54,_0x16c0c7){return client[_0xf7aa('0x9')](_0x47f259,_0x5d0495)['then'](function(_0x581dd0){logger['info'](_0xf7aa('0xa'),_0x46d632,_0xf7aa('0xb'));logger[_0xf7aa('0xc')]('Campaign,\x20%s,\x20%s,\x20%s',_0x46d632,_0xf7aa('0xb'),JSON['stringify'](_0x581dd0));if(_0x581dd0['error']){if(_0x581dd0[_0xf7aa('0xd')][_0xf7aa('0xe')]===0x1f4){logger[_0xf7aa('0xd')](_0xf7aa('0xa'),_0x46d632,_0x581dd0[_0xf7aa('0xd')][_0xf7aa('0xf')]);return _0x16c0c7(_0x581dd0[_0xf7aa('0xd')][_0xf7aa('0xf')]);}logger[_0xf7aa('0xd')](_0xf7aa('0xa'),_0x46d632,_0x581dd0['error'][_0xf7aa('0xf')]);return _0x598c54(_0x581dd0[_0xf7aa('0xd')][_0xf7aa('0xf')]);}else{logger[_0xf7aa('0x10')]('Campaign,\x20%s,\x20%s',_0x46d632,'request\x20sent');_0x598c54(_0x581dd0[_0xf7aa('0x11')]['message']);}})[_0xf7aa('0x12')](function(_0x15d263){logger[_0xf7aa('0xd')](_0xf7aa('0xa'),_0x46d632,_0x15d263);_0x16c0c7(_0x15d263);});});}exports[_0xf7aa('0x13')]=function(_0x2678bd){var _0x305d6e=this;return new Promise(function(_0x338918,_0x421b89){return db[_0xf7aa('0x14')][_0xf7aa('0x15')]({'raw':_0x2678bd['options']?_0x2678bd['options'][_0xf7aa('0x16')]===undefined?!![]:![]:!![],'where':_0x2678bd['options']?_0x2678bd[_0xf7aa('0x17')][_0xf7aa('0x18')]||null:null,'attributes':_0x2678bd[_0xf7aa('0x17')]?_0x2678bd['options']['attributes']||null:null,'limit':_0x2678bd[_0xf7aa('0x17')]?_0x2678bd[_0xf7aa('0x17')]['limit']||null:null,'include':_0x2678bd[_0xf7aa('0x17')]?_0x2678bd['options'][_0xf7aa('0x19')]?_[_0xf7aa('0x1a')](_0x2678bd[_0xf7aa('0x17')][_0xf7aa('0x19')],function(_0x44a73e){return{'model':db[_0x44a73e[_0xf7aa('0x1b')]],'as':_0x44a73e['as'],'attributes':_0x44a73e[_0xf7aa('0x1c')],'include':_0x44a73e[_0xf7aa('0x19')]?_['map'](_0x44a73e[_0xf7aa('0x19')],function(_0x4cc942){return{'model':db[_0x4cc942[_0xf7aa('0x1b')]],'as':_0x4cc942['as'],'attributes':_0x4cc942[_0xf7aa('0x1c')],'include':_0x4cc942[_0xf7aa('0x19')]?_[_0xf7aa('0x1a')](_0x4cc942['include'],function(_0x1a69dc){return{'model':db[_0x1a69dc[_0xf7aa('0x1b')]],'as':_0x1a69dc['as'],'attributes':_0x1a69dc[_0xf7aa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf7aa('0x1d')](function(_0x57d200){logger[_0xf7aa('0x10')](_0xf7aa('0x13'),_0x2678bd);logger['debug']('GetCampaign',_0x2678bd,JSON['stringify'](_0x57d200));_0x338918(_0x57d200);})[_0xf7aa('0x12')](function(_0x200d3a){logger[_0xf7aa('0xd')](_0xf7aa('0x13'),_0x200d3a[_0xf7aa('0xf')],_0x2678bd);_0x421b89(_0x305d6e['error'](0x1f4,_0x200d3a[_0xf7aa('0xf')]));});});}; \ No newline at end of file +var _0xb32d=['result','options','where','limit','include','model','attributes','GetCampaign','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xb32d,0x1da));var _0xdb32=function(_0x3d4e74,_0x21b4e5){_0x3d4e74=_0x3d4e74-0x0;var _0x57613d=_0xb32d[_0x3d4e74];return _0x57613d;};'use strict';var _=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var moment=require(_0xdb32('0x2'));var BPromise=require(_0xdb32('0x3'));var rs=require(_0xdb32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb32('0x5'));var logger=require(_0xdb32('0x6'))('rpc');var config=require(_0xdb32('0x7'));var jayson=require(_0xdb32('0x8'));var client=jayson[_0xdb32('0x9')][_0xdb32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f4af0,_0x386309,_0x5bb076){return new BPromise(function(_0x3b0995,_0x2686db){return client[_0xdb32('0xb')](_0x6f4af0,_0x5bb076)[_0xdb32('0xc')](function(_0x30e03d){logger[_0xdb32('0xd')](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));logger[_0xdb32('0x10')](_0xdb32('0x11'),_0x386309,_0xdb32('0xf'),JSON[_0xdb32('0x12')](_0x30e03d));if(_0x30e03d[_0xdb32('0x13')]){if(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x14')]===0x1f4){logger[_0xdb32('0x13')](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x2686db(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}logger['error'](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x3b0995(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}else{logger['info'](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));_0x3b0995(_0x30e03d[_0xdb32('0x16')]['message']);}})['catch'](function(_0x59a5f8){logger['error'](_0xdb32('0xe'),_0x386309,_0x59a5f8);_0x2686db(_0x59a5f8);});});}exports['GetCampaign']=function(_0x1fd22b){var _0xfab49a=this;return new Promise(function(_0x1ba5f4,_0x301cc3){return db['Campaign']['findAll']({'raw':_0x1fd22b['options']?_0x1fd22b[_0xdb32('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b[_0xdb32('0x17')][_0xdb32('0x18')]||null:null,'attributes':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b[_0xdb32('0x17')]['attributes']||null:null,'limit':_0x1fd22b[_0xdb32('0x17')]?_0x1fd22b[_0xdb32('0x17')][_0xdb32('0x19')]||null:null,'include':_0x1fd22b['options']?_0x1fd22b['options'][_0xdb32('0x1a')]?_['map'](_0x1fd22b['options'][_0xdb32('0x1a')],function(_0x14b5fd){return{'model':db[_0x14b5fd[_0xdb32('0x1b')]],'as':_0x14b5fd['as'],'attributes':_0x14b5fd[_0xdb32('0x1c')],'include':_0x14b5fd['include']?_['map'](_0x14b5fd[_0xdb32('0x1a')],function(_0x2168d9){return{'model':db[_0x2168d9[_0xdb32('0x1b')]],'as':_0x2168d9['as'],'attributes':_0x2168d9['attributes'],'include':_0x2168d9[_0xdb32('0x1a')]?_['map'](_0x2168d9[_0xdb32('0x1a')],function(_0x17f627){return{'model':db[_0x17f627[_0xdb32('0x1b')]],'as':_0x17f627['as'],'attributes':_0x17f627[_0xdb32('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdb32('0xc')](function(_0x5d29da){logger['info'](_0xdb32('0x1d'),_0x1fd22b);logger['debug'](_0xdb32('0x1d'),_0x1fd22b,JSON[_0xdb32('0x12')](_0x5d29da));_0x1ba5f4(_0x5d29da);})[_0xdb32('0x1e')](function(_0x5a6109){logger['error'](_0xdb32('0x1d'),_0x5a6109[_0xdb32('0x15')],_0x1fd22b);_0x301cc3(_0xfab49a[_0xdb32('0x13')](0x1f4,_0x5a6109['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 3601b5a..6837d41 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 _0x87cb=['removeLists','removeBlackLists','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','/:id/lists','addLists','addBlackLists','update','delete','destroy'];(function(_0x3afbdf,_0x9e463b){var _0x5b6861=function(_0x31d287){while(--_0x31d287){_0x3afbdf['push'](_0x3afbdf['shift']());}};_0x5b6861(++_0x9e463b);}(_0x87cb,0xdc));var _0xb87c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x87cb[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var path=require(_0xb87c('0x2'));var timeout=require('connect-timeout');var express=require(_0xb87c('0x3'));var router=express[_0xb87c('0x4')]();var fs_extra=require(_0xb87c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb87c('0x6'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xb87c('0x7')]('/',auth[_0xb87c('0x8')](),controller['index']);router[_0xb87c('0x7')](_0xb87c('0x9'),auth[_0xb87c('0x8')](),controller['show']);router['get'](_0xb87c('0xa'),auth[_0xb87c('0x8')](),controller['getHoppers']);router[_0xb87c('0x7')](_0xb87c('0xb'),auth[_0xb87c('0x8')](),controller[_0xb87c('0xc')]);router[_0xb87c('0x7')](_0xb87c('0xd'),auth['isAuthenticated'](),controller[_0xb87c('0xe')]);router['get']('/:id/hopper_black',auth[_0xb87c('0x8')](),controller[_0xb87c('0xf')]);router[_0xb87c('0x7')]('/:id/lists',auth[_0xb87c('0x8')](),controller[_0xb87c('0x10')]);router[_0xb87c('0x7')](_0xb87c('0x11'),auth[_0xb87c('0x8')](),controller[_0xb87c('0x12')]);router['post']('/',auth[_0xb87c('0x8')](),controller[_0xb87c('0x13')]);router[_0xb87c('0x14')](_0xb87c('0x15'),auth[_0xb87c('0x8')](),controller['clone']);router[_0xb87c('0x14')](_0xb87c('0x16'),auth[_0xb87c('0x8')](),controller[_0xb87c('0x17')]);router[_0xb87c('0x14')](_0xb87c('0x11'),auth[_0xb87c('0x8')](),controller[_0xb87c('0x18')]);router['put'](_0xb87c('0x9'),auth['isAuthenticated'](),controller[_0xb87c('0x19')]);router[_0xb87c('0x1a')](_0xb87c('0x9'),auth[_0xb87c('0x8')](),controller[_0xb87c('0x1b')]);router[_0xb87c('0x1a')]('/:id/lists',auth[_0xb87c('0x8')](),controller[_0xb87c('0x1c')]);router['delete'](_0xb87c('0x11'),auth[_0xb87c('0x8')](),controller[_0xb87c('0x1d')]);module[_0xb87c('0x1e')]=router; \ No newline at end of file +var _0x55da=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','/:id/clone','clone','post','addLists','addBlackLists','delete','destroy','removeLists','/:id/blacklists','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e0a5e,_0x1108ec){var _0x3def35=function(_0x137a03){while(--_0x137a03){_0x4e0a5e['push'](_0x4e0a5e['shift']());}};_0x3def35(++_0x1108ec);}(_0x55da,0x16f));var _0xa55d=function(_0x102654,_0x71d14){_0x102654=_0x102654-0x0;var _0xeb449=_0x55da[_0x102654];return _0xeb449;};'use strict';var multer=require('multer');var util=require(_0xa55d('0x0'));var path=require(_0xa55d('0x1'));var timeout=require(_0xa55d('0x2'));var express=require(_0xa55d('0x3'));var router=express[_0xa55d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa55d('0x5'));var interaction=require(_0xa55d('0x6'));var config=require(_0xa55d('0x7'));var controller=require('./campaign.controller');router[_0xa55d('0x8')]('/',auth[_0xa55d('0x9')](),controller[_0xa55d('0xa')]);router[_0xa55d('0x8')](_0xa55d('0xb'),auth[_0xa55d('0x9')](),controller[_0xa55d('0xc')]);router[_0xa55d('0x8')](_0xa55d('0xd'),auth['isAuthenticated'](),controller[_0xa55d('0xe')]);router[_0xa55d('0x8')](_0xa55d('0xf'),auth[_0xa55d('0x9')](),controller['getHopperHistories']);router[_0xa55d('0x8')](_0xa55d('0x10'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x11')]);router[_0xa55d('0x8')](_0xa55d('0x12'),auth['isAuthenticated'](),controller[_0xa55d('0x13')]);router[_0xa55d('0x8')](_0xa55d('0x14'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x15')]);router[_0xa55d('0x8')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xa55d('0x16')]);router['post']('/',auth[_0xa55d('0x9')](),controller[_0xa55d('0x17')]);router['post'](_0xa55d('0x18'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x19')]);router[_0xa55d('0x1a')]('/:id/lists',auth[_0xa55d('0x9')](),controller[_0xa55d('0x1b')]);router['post']('/:id/blacklists',auth[_0xa55d('0x9')](),controller[_0xa55d('0x1c')]);router['put'](_0xa55d('0xb'),auth[_0xa55d('0x9')](),controller['update']);router[_0xa55d('0x1d')](_0xa55d('0xb'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x1e')]);router[_0xa55d('0x1d')](_0xa55d('0x14'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x1f')]);router[_0xa55d('0x1d')](_0xa55d('0x20'),auth[_0xa55d('0x9')](),controller[_0xa55d('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 27a5676..58d493a 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 _0xee4e=['STRING','TEXT','VIRTUAL','getDataValue','exports'];(function(_0x577237,_0x36c3b5){var _0x5411a4=function(_0x228cbb){while(--_0x228cbb){_0x577237['push'](_0x577237['shift']());}};_0x5411a4(++_0x36c3b5);}(_0xee4e,0x7c));var _0xeee4=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xee4e[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require('sequelize');module[_0xeee4('0x0')]={'key':{'type':Sequelize[_0xeee4('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xeee4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeee4('0x1')]},'name':{'type':Sequelize[_0xeee4('0x3')],'get':function(){return this[_0xeee4('0x4')]('key');}}}; \ No newline at end of file +var _0x1273=['STRING','VIRTUAL','getDataValue','exports'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x1273,0x7b));var _0x3127=function(_0xd2c8f3,_0x3cfb97){_0xd2c8f3=_0xd2c8f3-0x0;var _0x34efcf=_0x1273[_0xd2c8f3];return _0x34efcf;};'use strict';var Sequelize=require('sequelize');module[_0x3127('0x0')]={'key':{'type':Sequelize[_0x3127('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x3127('0x1')]},'name':{'type':Sequelize[_0x3127('0x2')],'get':function(){return this[_0x3127('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 80ac829..bd9b059 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 _0x486b=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','index','fieldName','model','query','filters','intersection','attributes','fields','length','sort','merge','where','filter','includeAll','findAll','rows','catch','show','params','keys','CannedAnswer','include','options','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3a924c,_0x2c3452){var _0x196e0e=function(_0x5e0331){while(--_0x5e0331){_0x3a924c['push'](_0x3a924c['shift']());}};_0x196e0e(++_0x2c3452);}(_0x486b,0x1e6));var _0xb486=function(_0x5a586b,_0x552412){_0x5a586b=_0x5a586b-0x0;var _0x1278e5=_0x486b[_0x5a586b];return _0x1278e5;};'use strict';var emlformat=require(_0xb486('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb486('0x1'));var rp=require('request-promise');var moment=require(_0xb486('0x2'));var BPromise=require(_0xb486('0x3'));var Mustache=require(_0xb486('0x4'));var util=require(_0xb486('0x5'));var path=require(_0xb486('0x6'));var sox=require(_0xb486('0x7'));var csv=require(_0xb486('0x8'));var ejs=require(_0xb486('0x9'));var fs=require('fs');var fs_extra=require(_0xb486('0xa'));var _=require(_0xb486('0xb'));var squel=require(_0xb486('0xc'));var crypto=require(_0xb486('0xd'));var jsforce=require(_0xb486('0xe'));var deskjs=require(_0xb486('0xf'));var toCsv=require(_0xb486('0x8'));var querystring=require(_0xb486('0x10'));var Papa=require('papaparse');var Redis=require(_0xb486('0x11'));var authService=require(_0xb486('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb486('0x13'));var logger=require(_0xb486('0x14'))(_0xb486('0x15'));var utils=require(_0xb486('0x16'));var config=require(_0xb486('0x17'));var licenseUtil=require(_0xb486('0x18'));var db=require(_0xb486('0x19'))['db'];function respondWithStatusCode(_0x23e898,_0x3269fd){_0x3269fd=_0x3269fd||0xcc;return function(_0x38b5ec){if(_0x38b5ec){return _0x23e898['sendStatus'](_0x3269fd);}return _0x23e898['status'](_0x3269fd)[_0xb486('0x1a')]();};}function respondWithResult(_0x25c6d3,_0x1a2276){_0x1a2276=_0x1a2276||0xc8;return function(_0x3d60a0){if(_0x3d60a0){return _0x25c6d3['status'](_0x1a2276)[_0xb486('0x1b')](_0x3d60a0);}};}function respondWithFilteredResult(_0x290b5e,_0x1edc74){return function(_0x30b5a6){if(_0x30b5a6){var _0x4d995d=typeof _0x1edc74['offset']===_0xb486('0x1c')&&typeof _0x1edc74[_0xb486('0x1d')]===_0xb486('0x1c');var _0x1f8fe1=_0x30b5a6[_0xb486('0x1e')];var _0x1d5d38=_0x4d995d?0x0:_0x1edc74[_0xb486('0x1f')];var _0x83f00a=_0x4d995d?_0x30b5a6[_0xb486('0x1e')]:_0x1edc74[_0xb486('0x1f')]+_0x1edc74[_0xb486('0x1d')];var _0x28bc6a;if(_0x83f00a>=_0x1f8fe1){_0x83f00a=_0x1f8fe1;_0x28bc6a=0xc8;}else{_0x28bc6a=0xce;}_0x290b5e[_0xb486('0x20')](_0x28bc6a);return _0x290b5e['set'](_0xb486('0x21'),_0x1d5d38+'-'+_0x83f00a+'/'+_0x1f8fe1)['json'](_0x30b5a6);}return null;};}function patchUpdates(_0x54f41e){return function(_0x5f07bd){try{jsonpatch[_0xb486('0x22')](_0x5f07bd,_0x54f41e,!![]);}catch(_0x2135dc){return BPromise[_0xb486('0x23')](_0x2135dc);}return _0x5f07bd[_0xb486('0x24')]();};}function saveUpdates(_0xd99d74,_0x4b001c){return function(_0x3e104e){if(_0x3e104e){return _0x3e104e[_0xb486('0x25')](_0xd99d74)[_0xb486('0x26')](function(_0x20dabf){return _0x20dabf;});}return null;};}function removeEntity(_0xcf4a68,_0x49f4b2){return function(_0x3e5c9e){if(_0x3e5c9e){return _0x3e5c9e[_0xb486('0x27')]()[_0xb486('0x26')](function(){var _0x277ffe=_0x3e5c9e[_0xb486('0x28')]({'plain':!![]});var _0xd785ec=_0xb486('0x29');return db[_0xb486('0x2a')][_0xb486('0x27')]({'where':{'type':_0xd785ec,'resourceId':_0x277ffe['id']}})[_0xb486('0x26')](function(){return _0x3e5c9e;});})[_0xb486('0x26')](function(){_0xcf4a68[_0xb486('0x20')](0xcc)[_0xb486('0x1a')]();});}};}function handleEntityNotFound(_0x39f340,_0x5cdbb9){return function(_0x1b4c01){if(!_0x1b4c01){_0x39f340['sendStatus'](0x194);}return _0x1b4c01;};}function handleError(_0x126536,_0xc40f0b){_0xc40f0b=_0xc40f0b||0x1f4;return function(_0x47ef56){logger['error'](_0x47ef56[_0xb486('0x2b')]);if(_0x47ef56[_0xb486('0x2c')]){delete _0x47ef56[_0xb486('0x2c')];}_0x126536['status'](_0xc40f0b)['send'](_0x47ef56);};}exports[_0xb486('0x2d')]=function(_0x48105d,_0x47e0d0){var _0x292bd0={},_0x27dba1={},_0x219f6b={'count':0x0,'rows':[]};var _0x4c0219=_['map'](db['CannedAnswer']['rawAttributes'],function(_0x52b4bf){return{'name':_0x52b4bf[_0xb486('0x2e')],'type':_0x52b4bf['type']['key']};});_0x27dba1[_0xb486('0x2f')]=_['map'](_0x4c0219,_0xb486('0x2c'));_0x27dba1[_0xb486('0x30')]=_['keys'](_0x48105d[_0xb486('0x30')]);_0x27dba1[_0xb486('0x31')]=_[_0xb486('0x32')](_0x27dba1[_0xb486('0x2f')],_0x27dba1[_0xb486('0x30')]);_0x292bd0[_0xb486('0x33')]=_[_0xb486('0x32')](_0x27dba1[_0xb486('0x2f')],qs['fields'](_0x48105d[_0xb486('0x30')][_0xb486('0x34')]));_0x292bd0[_0xb486('0x33')]=_0x292bd0['attributes'][_0xb486('0x35')]?_0x292bd0[_0xb486('0x33')]:_0x27dba1[_0xb486('0x2f')];if(!_0x48105d['query']['hasOwnProperty']('nolimit')){_0x292bd0[_0xb486('0x1d')]=qs[_0xb486('0x1d')](_0x48105d['query'][_0xb486('0x1d')]);_0x292bd0['offset']=qs[_0xb486('0x1f')](_0x48105d['query']['offset']);}_0x292bd0['order']=qs[_0xb486('0x36')](_0x48105d['query']['sort']);_0x292bd0['where']=qs[_0xb486('0x31')](_['pick'](_0x48105d['query'],_0x27dba1['filters']),_0x4c0219);if(_0x48105d[_0xb486('0x30')]['filter']){_0x292bd0['where']=_[_0xb486('0x37')](_0x292bd0[_0xb486('0x38')],{'$or':[{'key':{'$like':'%'+_0x48105d[_0xb486('0x30')][_0xb486('0x39')]+'%'}},{'value':{'$like':'%'+_0x48105d[_0xb486('0x30')][_0xb486('0x39')]+'%'}}]});}_0x292bd0=_[_0xb486('0x37')]({},_0x292bd0,_0x48105d['options']);var _0x35e99e={'where':_0x292bd0[_0xb486('0x38')]};return db['CannedAnswer'][_0xb486('0x1e')](_0x35e99e)[_0xb486('0x26')](function(_0x46ad1b){_0x219f6b[_0xb486('0x1e')]=_0x46ad1b;if(_0x48105d[_0xb486('0x30')][_0xb486('0x3a')]){_0x292bd0['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xb486('0x3b')](_0x292bd0);})[_0xb486('0x26')](function(_0x28ba81){_0x219f6b[_0xb486('0x3c')]=_0x28ba81;return _0x219f6b;})[_0xb486('0x26')](respondWithFilteredResult(_0x47e0d0,_0x292bd0))[_0xb486('0x3d')](handleError(_0x47e0d0,null));};exports[_0xb486('0x3e')]=function(_0x3d041d,_0x4509dc){var _0x2cc978={'raw':!![],'where':{'id':_0x3d041d[_0xb486('0x3f')]['id']}},_0x9082c4={};_0x9082c4[_0xb486('0x2f')]=_[_0xb486('0x40')](db[_0xb486('0x41')]['rawAttributes']);_0x9082c4['query']=_[_0xb486('0x40')](_0x3d041d[_0xb486('0x30')]);_0x9082c4['filters']=_[_0xb486('0x32')](_0x9082c4[_0xb486('0x2f')],_0x9082c4[_0xb486('0x30')]);_0x2cc978['attributes']=_[_0xb486('0x32')](_0x9082c4['model'],qs[_0xb486('0x34')](_0x3d041d[_0xb486('0x30')][_0xb486('0x34')]));_0x2cc978[_0xb486('0x33')]=_0x2cc978[_0xb486('0x33')][_0xb486('0x35')]?_0x2cc978[_0xb486('0x33')]:_0x9082c4[_0xb486('0x2f')];if(_0x3d041d[_0xb486('0x30')][_0xb486('0x3a')]){_0x2cc978[_0xb486('0x42')]=[{'all':!![]}];}_0x2cc978=_['merge']({},_0x2cc978,_0x3d041d[_0xb486('0x43')]);return db[_0xb486('0x41')][_0xb486('0x44')](_0x2cc978)['then'](handleEntityNotFound(_0x4509dc,null))[_0xb486('0x26')](respondWithResult(_0x4509dc,null))[_0xb486('0x3d')](handleError(_0x4509dc,null));};exports['update']=function(_0x3e0b30,_0x536b40){if(_0x3e0b30[_0xb486('0x45')]['id']){delete _0x3e0b30['body']['id'];}return db['CannedAnswer'][_0xb486('0x44')]({'where':{'id':_0x3e0b30[_0xb486('0x3f')]['id']}})[_0xb486('0x26')](handleEntityNotFound(_0x536b40,null))[_0xb486('0x26')](saveUpdates(_0x3e0b30[_0xb486('0x45')],null))[_0xb486('0x26')](respondWithResult(_0x536b40,null))[_0xb486('0x3d')](handleError(_0x536b40,null));};exports['destroy']=function(_0x54dbbf,_0x4490b5){return db['CannedAnswer'][_0xb486('0x44')]({'where':{'id':_0x54dbbf[_0xb486('0x3f')]['id']}})[_0xb486('0x26')](handleEntityNotFound(_0x4490b5,null))['then'](removeEntity(_0x4490b5,null))[_0xb486('0x3d')](handleError(_0x4490b5,null));};exports[_0xb486('0x46')]=function(_0xec2fc8,_0x3bca19){var _0x26032d={'key':_0xec2fc8[_0xb486('0x45')][_0xb486('0x47')]};if(_0xec2fc8[_0xb486('0x45')][_0xb486('0x48')]){_0x26032d[_0xb486('0x48')]=_0xec2fc8['body'][_0xb486('0x48')];}else if(_0xec2fc8[_0xb486('0x45')][_0xb486('0x49')]){_0x26032d['SmsAccountId']=_0xec2fc8[_0xb486('0x45')]['SmsAccountId'];}else if(_0xec2fc8[_0xb486('0x45')]['OpenchannelAccountId']){_0x26032d[_0xb486('0x4a')]=_0xec2fc8['body'][_0xb486('0x4a')];}else if(_0xec2fc8['body']['ChatWebsiteId']){_0x26032d[_0xb486('0x4b')]=_0xec2fc8[_0xb486('0x45')][_0xb486('0x4b')];}return db[_0xb486('0x41')][_0xb486('0x44')]({'where':_0x26032d})[_0xb486('0x26')](function(_0x362888){if(_0x362888){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xb486('0x41')]['create'](_0xec2fc8['body']);})[_0xb486('0x26')](function(_0x1a497e){var _0x43a0fd=_0xec2fc8[_0xb486('0x4c')][_0xb486('0x28')]({'plain':!![]});if(!_0x43a0fd)throw new Error(_0xb486('0x4d'));if(_0x43a0fd['role']===_0xb486('0x4c')){var _0x462067=_0x1a497e[_0xb486('0x28')]({'plain':!![]});return db[_0xb486('0x4e')][_0xb486('0x44')]({'where':{'name':_0xb486('0x29'),'userProfileId':_0x43a0fd[_0xb486('0x4f')]},'raw':!![]})[_0xb486('0x26')](function(_0xef69bd){if(_0xef69bd&&_0xef69bd[_0xb486('0x50')]===0x0){return db[_0xb486('0x2a')]['create']({'name':_0x462067[_0xb486('0x2c')],'resourceId':_0x462067['id'],'type':_0xef69bd[_0xb486('0x2c')],'sectionId':_0xef69bd['id']},{})[_0xb486('0x26')](function(){return _0x1a497e;});}else{return _0x1a497e;}})[_0xb486('0x3d')](function(_0x3fd56b){logger[_0xb486('0x51')](_0xb486('0x52'),_0x3fd56b);throw _0x3fd56b;});}return _0x1a497e;})[_0xb486('0x26')](respondWithResult(_0x3bca19,0xc9))[_0xb486('0x3d')](handleError(_0x3bca19,null));}; \ No newline at end of file +var _0x8fb4=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x8fb4,0x7f));var _0x48fb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8fb4[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x48fb('0x0'));var rimraf=require(_0x48fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48fb('0x2'));var rp=require(_0x48fb('0x3'));var moment=require(_0x48fb('0x4'));var BPromise=require(_0x48fb('0x5'));var Mustache=require(_0x48fb('0x6'));var util=require(_0x48fb('0x7'));var path=require(_0x48fb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48fb('0x9'));var _=require(_0x48fb('0xa'));var squel=require(_0x48fb('0xb'));var crypto=require(_0x48fb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x48fb('0xd'));var toCsv=require(_0x48fb('0xe'));var querystring=require(_0x48fb('0xf'));var Papa=require(_0x48fb('0x10'));var Redis=require(_0x48fb('0x11'));var authService=require(_0x48fb('0x12'));var qs=require(_0x48fb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x48fb('0x14'));var utils=require('../../config/utils');var config=require(_0x48fb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x48fb('0x16'))['db'];function respondWithStatusCode(_0x597202,_0x175774){_0x175774=_0x175774||0xcc;return function(_0x48f5b3){if(_0x48f5b3){return _0x597202[_0x48fb('0x17')](_0x175774);}return _0x597202[_0x48fb('0x18')](_0x175774)[_0x48fb('0x19')]();};}function respondWithResult(_0x6a3533,_0x21f6ab){_0x21f6ab=_0x21f6ab||0xc8;return function(_0x7f9a6b){if(_0x7f9a6b){return _0x6a3533[_0x48fb('0x18')](_0x21f6ab)[_0x48fb('0x1a')](_0x7f9a6b);}};}function respondWithFilteredResult(_0x47eb86,_0x511237){return function(_0x2c419a){if(_0x2c419a){var _0x14c09a=typeof _0x511237[_0x48fb('0x1b')]===_0x48fb('0x1c')&&typeof _0x511237['limit']===_0x48fb('0x1c');var _0x2ca758=_0x2c419a[_0x48fb('0x1d')];var _0x52c607=_0x14c09a?0x0:_0x511237['offset'];var _0x1d126b=_0x14c09a?_0x2c419a['count']:_0x511237['offset']+_0x511237[_0x48fb('0x1e')];var _0x6ad8dd;if(_0x1d126b>=_0x2ca758){_0x1d126b=_0x2ca758;_0x6ad8dd=0xc8;}else{_0x6ad8dd=0xce;}_0x47eb86[_0x48fb('0x18')](_0x6ad8dd);return _0x47eb86[_0x48fb('0x1f')](_0x48fb('0x20'),_0x52c607+'-'+_0x1d126b+'/'+_0x2ca758)[_0x48fb('0x1a')](_0x2c419a);}return null;};}function patchUpdates(_0x4358f2){return function(_0x4c7aa6){try{jsonpatch[_0x48fb('0x21')](_0x4c7aa6,_0x4358f2,!![]);}catch(_0x96a55d){return BPromise[_0x48fb('0x22')](_0x96a55d);}return _0x4c7aa6[_0x48fb('0x23')]();};}function saveUpdates(_0x4397e6,_0x504068){return function(_0x31b61e){if(_0x31b61e){return _0x31b61e[_0x48fb('0x24')](_0x4397e6)[_0x48fb('0x25')](function(_0x269c3f){return _0x269c3f;});}return null;};}function removeEntity(_0x24b5f0,_0x2facb1){return function(_0x242f9f){if(_0x242f9f){return _0x242f9f[_0x48fb('0x26')]()[_0x48fb('0x25')](function(){var _0x137f7d=_0x242f9f[_0x48fb('0x27')]({'plain':!![]});var _0xab101c=_0x48fb('0x28');return db[_0x48fb('0x29')]['destroy']({'where':{'type':_0xab101c,'resourceId':_0x137f7d['id']}})[_0x48fb('0x25')](function(){return _0x242f9f;});})[_0x48fb('0x25')](function(){_0x24b5f0[_0x48fb('0x18')](0xcc)[_0x48fb('0x19')]();});}};}function handleEntityNotFound(_0x95ab88,_0x248bfe){return function(_0x3854d7){if(!_0x3854d7){_0x95ab88[_0x48fb('0x17')](0x194);}return _0x3854d7;};}function handleError(_0x5eef32,_0x357ab9){_0x357ab9=_0x357ab9||0x1f4;return function(_0x48f3db){logger[_0x48fb('0x2a')](_0x48f3db[_0x48fb('0x2b')]);if(_0x48f3db[_0x48fb('0x2c')]){delete _0x48f3db[_0x48fb('0x2c')];}_0x5eef32[_0x48fb('0x18')](_0x357ab9)[_0x48fb('0x2d')](_0x48f3db);};}exports[_0x48fb('0x2e')]=function(_0x46f78f,_0x4037f0){var _0x3e907a={},_0x366a1c={},_0x3f1ee8={'count':0x0,'rows':[]};var _0x56f217=_[_0x48fb('0x2f')](db[_0x48fb('0x30')][_0x48fb('0x31')],function(_0x584999){return{'name':_0x584999[_0x48fb('0x32')],'type':_0x584999[_0x48fb('0x33')][_0x48fb('0x34')]};});_0x366a1c[_0x48fb('0x35')]=_[_0x48fb('0x2f')](_0x56f217,_0x48fb('0x2c'));_0x366a1c[_0x48fb('0x36')]=_[_0x48fb('0x37')](_0x46f78f[_0x48fb('0x36')]);_0x366a1c[_0x48fb('0x38')]=_[_0x48fb('0x39')](_0x366a1c[_0x48fb('0x35')],_0x366a1c[_0x48fb('0x36')]);_0x3e907a['attributes']=_['intersection'](_0x366a1c[_0x48fb('0x35')],qs['fields'](_0x46f78f['query'][_0x48fb('0x3a')]));_0x3e907a[_0x48fb('0x3b')]=_0x3e907a[_0x48fb('0x3b')][_0x48fb('0x3c')]?_0x3e907a[_0x48fb('0x3b')]:_0x366a1c['model'];if(!_0x46f78f[_0x48fb('0x36')][_0x48fb('0x3d')](_0x48fb('0x3e'))){_0x3e907a[_0x48fb('0x1e')]=qs['limit'](_0x46f78f['query']['limit']);_0x3e907a[_0x48fb('0x1b')]=qs[_0x48fb('0x1b')](_0x46f78f[_0x48fb('0x36')][_0x48fb('0x1b')]);}_0x3e907a[_0x48fb('0x3f')]=qs[_0x48fb('0x40')](_0x46f78f[_0x48fb('0x36')][_0x48fb('0x40')]);_0x3e907a[_0x48fb('0x41')]=qs[_0x48fb('0x38')](_[_0x48fb('0x42')](_0x46f78f[_0x48fb('0x36')],_0x366a1c[_0x48fb('0x38')]),_0x56f217);if(_0x46f78f[_0x48fb('0x36')]['filter']){_0x3e907a[_0x48fb('0x41')]=_['merge'](_0x3e907a[_0x48fb('0x41')],{'$or':[{'key':{'$like':'%'+_0x46f78f[_0x48fb('0x36')][_0x48fb('0x43')]+'%'}},{'value':{'$like':'%'+_0x46f78f[_0x48fb('0x36')][_0x48fb('0x43')]+'%'}}]});}_0x3e907a=_[_0x48fb('0x44')]({},_0x3e907a,_0x46f78f['options']);var _0x3e591f={'where':_0x3e907a[_0x48fb('0x41')]};return db[_0x48fb('0x30')][_0x48fb('0x1d')](_0x3e591f)[_0x48fb('0x25')](function(_0x3ffe59){_0x3f1ee8[_0x48fb('0x1d')]=_0x3ffe59;if(_0x46f78f[_0x48fb('0x36')][_0x48fb('0x45')]){_0x3e907a['include']=[{'all':!![]}];}return db[_0x48fb('0x30')][_0x48fb('0x46')](_0x3e907a);})[_0x48fb('0x25')](function(_0x245c10){_0x3f1ee8[_0x48fb('0x47')]=_0x245c10;return _0x3f1ee8;})[_0x48fb('0x25')](respondWithFilteredResult(_0x4037f0,_0x3e907a))[_0x48fb('0x48')](handleError(_0x4037f0,null));};exports[_0x48fb('0x49')]=function(_0x251fb2,_0xbbbe0a){var _0x59c86e={'raw':!![],'where':{'id':_0x251fb2[_0x48fb('0x4a')]['id']}},_0x3a4213={};_0x3a4213[_0x48fb('0x35')]=_[_0x48fb('0x37')](db['CannedAnswer'][_0x48fb('0x31')]);_0x3a4213[_0x48fb('0x36')]=_[_0x48fb('0x37')](_0x251fb2['query']);_0x3a4213[_0x48fb('0x38')]=_[_0x48fb('0x39')](_0x3a4213[_0x48fb('0x35')],_0x3a4213['query']);_0x59c86e['attributes']=_['intersection'](_0x3a4213['model'],qs[_0x48fb('0x3a')](_0x251fb2['query'][_0x48fb('0x3a')]));_0x59c86e[_0x48fb('0x3b')]=_0x59c86e['attributes'][_0x48fb('0x3c')]?_0x59c86e['attributes']:_0x3a4213['model'];if(_0x251fb2['query']['includeAll']){_0x59c86e['include']=[{'all':!![]}];}_0x59c86e=_[_0x48fb('0x44')]({},_0x59c86e,_0x251fb2[_0x48fb('0x4b')]);return db[_0x48fb('0x30')][_0x48fb('0x4c')](_0x59c86e)[_0x48fb('0x25')](handleEntityNotFound(_0xbbbe0a,null))[_0x48fb('0x25')](respondWithResult(_0xbbbe0a,null))['catch'](handleError(_0xbbbe0a,null));};exports[_0x48fb('0x24')]=function(_0x48b435,_0x3c67c4){if(_0x48b435[_0x48fb('0x4d')]['id']){delete _0x48b435[_0x48fb('0x4d')]['id'];}return db[_0x48fb('0x30')][_0x48fb('0x4c')]({'where':{'id':_0x48b435['params']['id']}})[_0x48fb('0x25')](handleEntityNotFound(_0x3c67c4,null))[_0x48fb('0x25')](saveUpdates(_0x48b435[_0x48fb('0x4d')],null))[_0x48fb('0x25')](respondWithResult(_0x3c67c4,null))[_0x48fb('0x48')](handleError(_0x3c67c4,null));};exports['destroy']=function(_0x7477ef,_0x4a67c8){return db['CannedAnswer'][_0x48fb('0x4c')]({'where':{'id':_0x7477ef[_0x48fb('0x4a')]['id']}})[_0x48fb('0x25')](handleEntityNotFound(_0x4a67c8,null))[_0x48fb('0x25')](removeEntity(_0x4a67c8,null))[_0x48fb('0x48')](handleError(_0x4a67c8,null));};exports['create']=function(_0x559f20,_0x510dd2){var _0x1678dc={'key':_0x559f20[_0x48fb('0x4d')][_0x48fb('0x34')]};if(_0x559f20[_0x48fb('0x4d')][_0x48fb('0x4e')]){_0x1678dc[_0x48fb('0x4e')]=_0x559f20[_0x48fb('0x4d')][_0x48fb('0x4e')];}else if(_0x559f20[_0x48fb('0x4d')][_0x48fb('0x4f')]){_0x1678dc['SmsAccountId']=_0x559f20['body'][_0x48fb('0x4f')];}else if(_0x559f20['body'][_0x48fb('0x50')]){_0x1678dc['OpenchannelAccountId']=_0x559f20['body'][_0x48fb('0x50')];}else if(_0x559f20[_0x48fb('0x4d')][_0x48fb('0x51')]){_0x1678dc['ChatWebsiteId']=_0x559f20['body'][_0x48fb('0x51')];}return db['CannedAnswer'][_0x48fb('0x4c')]({'where':_0x1678dc})[_0x48fb('0x25')](function(_0x4e8c58){if(_0x4e8c58){throw new db['Sequelize'][(_0x48fb('0x52'))](_0x48fb('0x53'));}return db[_0x48fb('0x30')][_0x48fb('0x54')](_0x559f20[_0x48fb('0x4d')]);})['then'](function(_0x2c4a3a){var _0x3b3d94=_0x559f20[_0x48fb('0x55')][_0x48fb('0x27')]({'plain':!![]});if(!_0x3b3d94)throw new Error(_0x48fb('0x56'));if(_0x3b3d94[_0x48fb('0x57')]===_0x48fb('0x55')){var _0x4edfdb=_0x2c4a3a['get']({'plain':!![]});return db[_0x48fb('0x58')][_0x48fb('0x4c')]({'where':{'name':_0x48fb('0x28'),'userProfileId':_0x3b3d94[_0x48fb('0x59')]},'raw':!![]})[_0x48fb('0x25')](function(_0x5db2b4){if(_0x5db2b4&&_0x5db2b4['autoAssociation']===0x0){return db[_0x48fb('0x29')][_0x48fb('0x54')]({'name':_0x4edfdb[_0x48fb('0x2c')],'resourceId':_0x4edfdb['id'],'type':_0x5db2b4['name'],'sectionId':_0x5db2b4['id']},{})['then'](function(){return _0x2c4a3a;});}else{return _0x2c4a3a;}})[_0x48fb('0x48')](function(_0xa5530){logger[_0x48fb('0x2a')](_0x48fb('0x5a'),_0xa5530);throw _0xa5530;});}return _0x2c4a3a;})[_0x48fb('0x25')](respondWithResult(_0x510dd2,0xc9))[_0x48fb('0x48')](handleError(_0x510dd2,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a180c27..93885b7 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 _0xab44=['./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab44,0x1aa));var _0x4ab4=function(_0x14d113,_0x51d7f9){_0x14d113=_0x14d113-0x0;var _0xa88e5b=_0xab44[_0x14d113];return _0xa88e5b;};'use strict';var _=require(_0x4ab4('0x0'));var util=require(_0x4ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4ab4('0x2'));var BPromise=require(_0x4ab4('0x3'));var rp=require(_0x4ab4('0x4'));var fs=require('fs');var path=require(_0x4ab4('0x5'));var rimraf=require(_0x4ab4('0x6'));var config=require(_0x4ab4('0x7'));var attributes=require(_0x4ab4('0x8'));module['exports']=function(_0x4a8540,_0x4aea34){return _0x4a8540[_0x4ab4('0x9')](_0x4ab4('0xa'),attributes,{'tableName':_0x4ab4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ab4('0xc'),'collate':_0x4ab4('0xd')});}; \ No newline at end of file +var _0x5eff=['./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0x5eff,0xc8));var _0xf5ef=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x5eff[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xf5ef('0x0'));var util=require(_0xf5ef('0x1'));var logger=require(_0xf5ef('0x2'))(_0xf5ef('0x3'));var moment=require(_0xf5ef('0x4'));var BPromise=require(_0xf5ef('0x5'));var rp=require(_0xf5ef('0x6'));var fs=require('fs');var path=require(_0xf5ef('0x7'));var rimraf=require(_0xf5ef('0x8'));var config=require(_0xf5ef('0x9'));var attributes=require(_0xf5ef('0xa'));module[_0xf5ef('0xb')]=function(_0x4c887e,_0x5ce02d){return _0x4c887e[_0xf5ef('0xc')]('CannedAnswer',attributes,{'tableName':_0xf5ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf5ef('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 6a88ea8..91af1b7 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x34a5ff,_0x727b24){var _0x1280a7=function(_0x2da357){while(--_0x2da357){_0x34a5ff['push'](_0x34a5ff['shift']());}};_0x1280a7(++_0x727b24);}(_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','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d4904,_0x20f026){var _0x53b6ee=function(_0x586f6b){while(--_0x586f6b){_0x5d4904['push'](_0x5d4904['shift']());}};_0x53b6ee(++_0x20f026);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 2201514..9390c03 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 _0xec43=['../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3b2f10,_0x34dc5f){var _0x563d79=function(_0x5ab05a){while(--_0x5ab05a){_0x3b2f10['push'](_0x3b2f10['shift']());}};_0x563d79(++_0x34dc5f);}(_0xec43,0xa4));var _0x3ec4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xec43[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x3ec4('0x0'));var path=require(_0x3ec4('0x1'));var timeout=require(_0x3ec4('0x2'));var express=require(_0x3ec4('0x3'));var router=express[_0x3ec4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3ec4('0x5'));var interaction=require(_0x3ec4('0x6'));var config=require(_0x3ec4('0x7'));var controller=require('./cannedAnswer.controller');router[_0x3ec4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3ec4('0x8')]('/:id',auth[_0x3ec4('0x9')](),controller[_0x3ec4('0xa')]);router[_0x3ec4('0xb')]('/',auth[_0x3ec4('0x9')](),controller[_0x3ec4('0xc')]);router[_0x3ec4('0xd')](_0x3ec4('0xe'),auth[_0x3ec4('0x9')](),controller[_0x3ec4('0xf')]);router[_0x3ec4('0x10')](_0x3ec4('0xe'),auth[_0x3ec4('0x9')](),controller[_0x3ec4('0x11')]);module[_0x3ec4('0x12')]=router; \ No newline at end of file +var _0xc149=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x371e61,_0x46d926){var _0x1af1dd=function(_0x4516cd){while(--_0x4516cd){_0x371e61['push'](_0x371e61['shift']());}};_0x1af1dd(++_0x46d926);}(_0xc149,0x190));var _0x9c14=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc149[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x9c14('0x0'));var util=require('util');var path=require(_0x9c14('0x1'));var timeout=require(_0x9c14('0x2'));var express=require(_0x9c14('0x3'));var router=express[_0x9c14('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c14('0x5'));var interaction=require(_0x9c14('0x6'));var config=require(_0x9c14('0x7'));var controller=require(_0x9c14('0x8'));router[_0x9c14('0x9')]('/',auth[_0x9c14('0xa')](),controller['index']);router[_0x9c14('0x9')](_0x9c14('0xb'),auth[_0x9c14('0xa')](),controller[_0x9c14('0xc')]);router[_0x9c14('0xd')]('/',auth[_0x9c14('0xa')](),controller[_0x9c14('0xe')]);router[_0x9c14('0xf')](_0x9c14('0xb'),auth['isAuthenticated'](),controller[_0x9c14('0x10')]);router['delete'](_0x9c14('0xb'),auth[_0x9c14('0xa')](),controller[_0x9c14('0x11')]);module[_0x9c14('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4062686..c53f9e0 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 _0x239c=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x1cb931,_0x41493d){var _0x1ef86b=function(_0x4ad410){while(--_0x4ad410){_0x1cb931['push'](_0x1cb931['shift']());}};_0x1ef86b(++_0x41493d);}(_0x239c,0x7b));var _0xc239=function(_0x1dda1c,_0x3c41d5){_0x1dda1c=_0x1dda1c-0x0;var _0x58e9a2=_0x239c[_0x1dda1c];return _0x58e9a2;};'use strict';var Sequelize=require(_0xc239('0x0'));module[_0xc239('0x1')]={'calldate':{'type':Sequelize[_0xc239('0x2')],'allowNull':![],'defaultValue':_0xc239('0x3')},'clid':{'type':Sequelize[_0xc239('0x4')]},'src':{'type':Sequelize[_0xc239('0x4')]},'dst':{'type':Sequelize[_0xc239('0x4')]},'dcontext':{'type':Sequelize[_0xc239('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xc239('0x4')]},'lastdata':{'type':Sequelize[_0xc239('0x4')]},'duration':{'type':Sequelize[_0xc239('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc239('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc239('0x4')]},'linkedid':{'type':Sequelize[_0xc239('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xc239('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xc239('0x4')]}}; \ No newline at end of file +var _0x1978=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x1978,0x174));var _0x8197=function(_0x1a4176,_0x21a635){_0x1a4176=_0x1a4176-0x0;var _0x3df9c0=_0x1978[_0x1a4176];return _0x3df9c0;};'use strict';var Sequelize=require('sequelize');module[_0x8197('0x0')]={'calldate':{'type':Sequelize[_0x8197('0x1')],'allowNull':![],'defaultValue':_0x8197('0x2')},'clid':{'type':Sequelize[_0x8197('0x3')]},'src':{'type':Sequelize[_0x8197('0x3')]},'dst':{'type':Sequelize[_0x8197('0x3')]},'dcontext':{'type':Sequelize[_0x8197('0x3')]},'channel':{'type':Sequelize[_0x8197('0x3')]},'dstchannel':{'type':Sequelize[_0x8197('0x3')]},'lastapp':{'type':Sequelize[_0x8197('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x8197('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8197('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8197('0x3')]},'amaflags':{'type':Sequelize[_0x8197('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8197('0x3')]},'userfield':{'type':Sequelize[_0x8197('0x3')]},'uniqueid':{'type':Sequelize[_0x8197('0x3')]},'linkedid':{'type':Sequelize[_0x8197('0x3')]},'sequence':{'type':Sequelize[_0x8197('0x3')]},'peeraccount':{'type':Sequelize[_0x8197('0x3')]},'type':{'type':Sequelize[_0x8197('0x3')]},'tag':{'type':Sequelize[_0x8197('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 18d6839..266c28f 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 _0xf2ca=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','Cdr','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x48fa0c,_0x413e5c){var _0x5b1ac3=function(_0x179823){while(--_0x179823){_0x48fa0c['push'](_0x48fa0c['shift']());}};_0x5b1ac3(++_0x413e5c);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0xf2ca[_0x189c9e];return _0x3f38ca;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];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=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x3c1ae6,_0xe929b5){return function(_0xff396f){if(!_0xff396f){_0x3c1ae6[_0xaf2c('0x18')](0x194);}return _0xff396f;};}function handleError(_0x4a8dd8,_0x29f8b0){_0x29f8b0=_0x29f8b0||0x1f4;return function(_0x2051be){logger[_0xaf2c('0x24')](_0x2051be[_0xaf2c('0x25')]);if(_0x2051be['name']){delete _0x2051be[_0xaf2c('0x26')];}_0x4a8dd8['status'](_0x29f8b0)[_0xaf2c('0x27')](_0x2051be);};}exports[_0xaf2c('0x28')]=function(_0x15466b,_0x5d685a){var _0x2747bb={},_0x2ea490={},_0x3baee2={'count':0x0,'rows':[]};var _0x4a96d2=_[_0xaf2c('0x29')](db[_0xaf2c('0x2a')][_0xaf2c('0x2b')],function(_0x19364e){return{'name':_0x19364e['fieldName'],'type':_0x19364e[_0xaf2c('0x2c')][_0xaf2c('0x2d')]};});_0x2ea490[_0xaf2c('0x2e')]=_['map'](_0x4a96d2,'name');_0x2ea490[_0xaf2c('0x2f')]=_['keys'](_0x15466b[_0xaf2c('0x2f')]);_0x2ea490['filters']=_[_0xaf2c('0x30')](_0x2ea490[_0xaf2c('0x2e')],_0x2ea490['query']);_0x2747bb[_0xaf2c('0x31')]=_[_0xaf2c('0x30')](_0x2ea490['model'],qs[_0xaf2c('0x32')](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x2747bb[_0xaf2c('0x31')]=_0x2747bb[_0xaf2c('0x31')][_0xaf2c('0x33')]?_0x2747bb['attributes']:_0x2ea490[_0xaf2c('0x2e')];if(!_0x15466b['query'][_0xaf2c('0x34')]('nolimit')){_0x2747bb[_0xaf2c('0x1e')]=qs['limit'](_0x15466b[_0xaf2c('0x2f')]['limit']);_0x2747bb[_0xaf2c('0x1c')]=qs['offset'](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x1c')]);}_0x2747bb[_0xaf2c('0x35')]=qs[_0xaf2c('0x36')](_0x15466b[_0xaf2c('0x2f')]['sort']);_0x2747bb['where']=qs[_0xaf2c('0x37')](_[_0xaf2c('0x38')](_0x15466b[_0xaf2c('0x2f')],_0x2ea490[_0xaf2c('0x37')]),_0x4a96d2);if(_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x39')]){_0x2747bb['where']=_[_0xaf2c('0x3a')](_0x2747bb[_0xaf2c('0x3b')],{'$or':_['map'](_0x4a96d2,function(_0x36081a){if(_0x36081a[_0xaf2c('0x2c')]!==_0xaf2c('0x3c')){var _0x71c597={};_0x71c597[_0x36081a[_0xaf2c('0x26')]]={'$like':'%'+_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x39')]+'%'};return _0x71c597;}})});}_0x2747bb=_[_0xaf2c('0x3a')]({},_0x2747bb,_0x15466b[_0xaf2c('0x3d')]);var _0x106eb9={'where':_0x2747bb[_0xaf2c('0x3b')]};return db[_0xaf2c('0x2a')][_0xaf2c('0x3e')](_0x106eb9)['then'](function(_0x54a953){_0x3baee2['count']=_0x54a953;if(_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x3f')]){_0x2747bb[_0xaf2c('0x40')]=[{'all':!![]}];}return db[_0xaf2c('0x2a')][_0xaf2c('0x41')](_0x2747bb);})[_0xaf2c('0x23')](function(_0x51c441){_0x3baee2[_0xaf2c('0x42')]=_0x51c441;return _0x3baee2;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x5d685a,_0x2747bb))[_0xaf2c('0x43')](handleError(_0x5d685a,null));};exports['show']=function(_0x493266,_0x4ac61a){var _0x4f8440={'raw':!![],'where':{'id':_0x493266[_0xaf2c('0x44')]['id']}},_0x181787={};_0x181787[_0xaf2c('0x2e')]=_[_0xaf2c('0x45')](db['Cdr'][_0xaf2c('0x2b')]);_0x181787['query']=_[_0xaf2c('0x45')](_0x493266[_0xaf2c('0x2f')]);_0x181787['filters']=_[_0xaf2c('0x30')](_0x181787['model'],_0x181787[_0xaf2c('0x2f')]);_0x4f8440[_0xaf2c('0x31')]=_[_0xaf2c('0x30')](_0x181787[_0xaf2c('0x2e')],qs[_0xaf2c('0x32')](_0x493266[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x4f8440[_0xaf2c('0x31')]=_0x4f8440[_0xaf2c('0x31')]['length']?_0x4f8440['attributes']:_0x181787[_0xaf2c('0x2e')];if(_0x493266['query']['includeAll']){_0x4f8440['include']=[{'all':!![]}];}_0x4f8440=_[_0xaf2c('0x3a')]({},_0x4f8440,_0x493266[_0xaf2c('0x3d')]);return db[_0xaf2c('0x2a')][_0xaf2c('0x46')](_0x4f8440)['then'](handleEntityNotFound(_0x4ac61a,null))[_0xaf2c('0x23')](respondWithResult(_0x4ac61a,null))['catch'](handleError(_0x4ac61a,null));};exports[_0xaf2c('0x47')]=function(_0x5ae138,_0x166c26){return db[_0xaf2c('0x2a')][_0xaf2c('0x47')](_0x5ae138[_0xaf2c('0x48')],{})[_0xaf2c('0x23')](respondWithResult(_0x166c26,0xc9))['catch'](handleError(_0x166c26,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){if(_0x26afee['body']['id']){delete _0x26afee[_0xaf2c('0x48')]['id'];}return db['Cdr'][_0xaf2c('0x46')]({'where':{'id':_0x26afee[_0xaf2c('0x44')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x4b3ca4,null))[_0xaf2c('0x23')](saveUpdates(_0x26afee[_0xaf2c('0x48')],null))[_0xaf2c('0x23')](respondWithResult(_0x4b3ca4,null))[_0xaf2c('0x43')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x4a')]=function(_0x31ccfe,_0x1e72b0){return db[_0xaf2c('0x2a')]['find']({'where':{'id':_0x31ccfe[_0xaf2c('0x44')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x1e72b0,null))['then'](removeEntity(_0x1e72b0,null))['catch'](handleError(_0x1e72b0,null));};exports['describe']=function(_0x7ddca0,_0x1f6907){return db['Cdr'][_0xaf2c('0x4b')]()[_0xaf2c('0x23')](respondWithResult(_0x1f6907,null))[_0xaf2c('0x43')](handleError(_0x1f6907,null));}; \ No newline at end of file +var _0x1dcc=['then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','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','undefined','limit','offset','set','Content-Range','reject','save','update'];(function(_0x24cd43,_0x5e3408){var _0x3bc3ac=function(_0x528fc1){while(--_0x528fc1){_0x24cd43['push'](_0x24cd43['shift']());}};_0x3bc3ac(++_0x5e3408);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x24ed1c,_0x6993c3){_0x24ed1c=_0x24ed1c-0x0;var _0x1516a9=_0x1dcc[_0x24ed1c];return _0x1516a9;};'use strict';var emlformat=require(_0xc1dc('0x0'));var rimraf=require(_0xc1dc('0x1'));var zipdir=require(_0xc1dc('0x2'));var jsonpatch=require(_0xc1dc('0x3'));var rp=require('request-promise');var moment=require(_0xc1dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1dc('0x5'));var util=require(_0xc1dc('0x6'));var path=require(_0xc1dc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc1dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc1dc('0x9'));var _=require(_0xc1dc('0xa'));var squel=require('squel');var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1dc('0xd'));var querystring=require('querystring');var Papa=require(_0xc1dc('0xe'));var Redis=require('ioredis');var authService=require(_0xc1dc('0xf'));var qs=require(_0xc1dc('0x10'));var as=require(_0xc1dc('0x11'));var hardwareService=require(_0xc1dc('0x12'));var logger=require(_0xc1dc('0x13'))(_0xc1dc('0x14'));var utils=require(_0xc1dc('0x15'));var config=require(_0xc1dc('0x16'));var licenseUtil=require(_0xc1dc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226ba3,_0x2c5f41){_0x2c5f41=_0x2c5f41||0xcc;return function(_0xb7e667){if(_0xb7e667){return _0x226ba3['sendStatus'](_0x2c5f41);}return _0x226ba3[_0xc1dc('0x18')](_0x2c5f41)[_0xc1dc('0x19')]();};}function respondWithResult(_0x299520,_0xd51b1e){_0xd51b1e=_0xd51b1e||0xc8;return function(_0x145708){if(_0x145708){return _0x299520[_0xc1dc('0x18')](_0xd51b1e)[_0xc1dc('0x1a')](_0x145708);}};}function respondWithFilteredResult(_0x21aed1,_0x265929){return function(_0x37b23a){if(_0x37b23a){var _0x1cbbfe=typeof _0x265929['offset']===_0xc1dc('0x1b')&&typeof _0x265929[_0xc1dc('0x1c')]===_0xc1dc('0x1b');var _0x3d3315=_0x37b23a['count'];var _0x332400=_0x1cbbfe?0x0:_0x265929[_0xc1dc('0x1d')];var _0x499a42=_0x1cbbfe?_0x37b23a['count']:_0x265929[_0xc1dc('0x1d')]+_0x265929[_0xc1dc('0x1c')];var _0x197941;if(_0x499a42>=_0x3d3315){_0x499a42=_0x3d3315;_0x197941=0xc8;}else{_0x197941=0xce;}_0x21aed1[_0xc1dc('0x18')](_0x197941);return _0x21aed1[_0xc1dc('0x1e')](_0xc1dc('0x1f'),_0x332400+'-'+_0x499a42+'/'+_0x3d3315)[_0xc1dc('0x1a')](_0x37b23a);}return null;};}function patchUpdates(_0xd5a2e){return function(_0x5762e5){try{jsonpatch['apply'](_0x5762e5,_0xd5a2e,!![]);}catch(_0x4efe0d){return BPromise[_0xc1dc('0x20')](_0x4efe0d);}return _0x5762e5[_0xc1dc('0x21')]();};}function saveUpdates(_0x47af1e,_0x367965){return function(_0x19325f){if(_0x19325f){return _0x19325f[_0xc1dc('0x22')](_0x47af1e)[_0xc1dc('0x23')](function(_0x22b80d){return _0x22b80d;});}return null;};}function removeEntity(_0x2944a2,_0x353bf3){return function(_0x18ba56){if(_0x18ba56){return _0x18ba56[_0xc1dc('0x24')]()[_0xc1dc('0x23')](function(){_0x2944a2['status'](0xcc)[_0xc1dc('0x19')]();});}};}function handleEntityNotFound(_0xfeb0b1,_0x17ce2b){return function(_0x52b0b9){if(!_0x52b0b9){_0xfeb0b1['sendStatus'](0x194);}return _0x52b0b9;};}function handleError(_0x296523,_0x109e88){_0x109e88=_0x109e88||0x1f4;return function(_0xfd3f88){logger[_0xc1dc('0x25')](_0xfd3f88[_0xc1dc('0x26')]);if(_0xfd3f88[_0xc1dc('0x27')]){delete _0xfd3f88[_0xc1dc('0x27')];}_0x296523[_0xc1dc('0x18')](_0x109e88)[_0xc1dc('0x28')](_0xfd3f88);};}exports['index']=function(_0x2d5a57,_0x25b7bf){var _0xd77537={},_0x27e54d={},_0x52b0ff={'count':0x0,'rows':[]};var _0x4750a9=_[_0xc1dc('0x29')](db[_0xc1dc('0x2a')][_0xc1dc('0x2b')],function(_0x1182a4){return{'name':_0x1182a4[_0xc1dc('0x2c')],'type':_0x1182a4['type'][_0xc1dc('0x2d')]};});_0x27e54d[_0xc1dc('0x2e')]=_[_0xc1dc('0x29')](_0x4750a9,_0xc1dc('0x27'));_0x27e54d[_0xc1dc('0x2f')]=_[_0xc1dc('0x30')](_0x2d5a57[_0xc1dc('0x2f')]);_0x27e54d[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x27e54d['model'],_0x27e54d['query']);_0xd77537[_0xc1dc('0x33')]=_[_0xc1dc('0x32')](_0x27e54d[_0xc1dc('0x2e')],qs[_0xc1dc('0x34')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x34')]));_0xd77537['attributes']=_0xd77537[_0xc1dc('0x33')][_0xc1dc('0x35')]?_0xd77537['attributes']:_0x27e54d[_0xc1dc('0x2e')];if(!_0x2d5a57[_0xc1dc('0x2f')]['hasOwnProperty'](_0xc1dc('0x36'))){_0xd77537[_0xc1dc('0x1c')]=qs[_0xc1dc('0x1c')](_0x2d5a57['query'][_0xc1dc('0x1c')]);_0xd77537[_0xc1dc('0x1d')]=qs[_0xc1dc('0x1d')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x1d')]);}_0xd77537[_0xc1dc('0x37')]=qs[_0xc1dc('0x38')](_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x38')]);_0xd77537['where']=qs[_0xc1dc('0x31')](_[_0xc1dc('0x39')](_0x2d5a57[_0xc1dc('0x2f')],_0x27e54d['filters']),_0x4750a9);if(_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x3a')]){_0xd77537[_0xc1dc('0x3b')]=_[_0xc1dc('0x3c')](_0xd77537[_0xc1dc('0x3b')],{'$or':_[_0xc1dc('0x29')](_0x4750a9,function(_0x2e8d34){if(_0x2e8d34[_0xc1dc('0x3d')]!=='VIRTUAL'){var _0x16356d={};_0x16356d[_0x2e8d34[_0xc1dc('0x27')]]={'$like':'%'+_0x2d5a57[_0xc1dc('0x2f')][_0xc1dc('0x3a')]+'%'};return _0x16356d;}})});}_0xd77537=_[_0xc1dc('0x3c')]({},_0xd77537,_0x2d5a57[_0xc1dc('0x3e')]);var _0x503ec8={'where':_0xd77537[_0xc1dc('0x3b')]};return db[_0xc1dc('0x2a')][_0xc1dc('0x3f')](_0x503ec8)[_0xc1dc('0x23')](function(_0x1bcf3d){_0x52b0ff['count']=_0x1bcf3d;if(_0x2d5a57['query'][_0xc1dc('0x40')]){_0xd77537[_0xc1dc('0x41')]=[{'all':!![]}];}return db[_0xc1dc('0x2a')][_0xc1dc('0x42')](_0xd77537);})[_0xc1dc('0x23')](function(_0x2b4190){_0x52b0ff[_0xc1dc('0x43')]=_0x2b4190;return _0x52b0ff;})['then'](respondWithFilteredResult(_0x25b7bf,_0xd77537))[_0xc1dc('0x44')](handleError(_0x25b7bf,null));};exports[_0xc1dc('0x45')]=function(_0xe5c170,_0x4f99ea){var _0x402d3a={'raw':!![],'where':{'id':_0xe5c170[_0xc1dc('0x46')]['id']}},_0x2f52f7={};_0x2f52f7[_0xc1dc('0x2e')]=_['keys'](db['Cdr'][_0xc1dc('0x2b')]);_0x2f52f7[_0xc1dc('0x2f')]=_['keys'](_0xe5c170[_0xc1dc('0x2f')]);_0x2f52f7[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](_0x2f52f7[_0xc1dc('0x2e')],_0x2f52f7[_0xc1dc('0x2f')]);_0x402d3a[_0xc1dc('0x33')]=_[_0xc1dc('0x32')](_0x2f52f7['model'],qs['fields'](_0xe5c170[_0xc1dc('0x2f')]['fields']));_0x402d3a[_0xc1dc('0x33')]=_0x402d3a[_0xc1dc('0x33')][_0xc1dc('0x35')]?_0x402d3a[_0xc1dc('0x33')]:_0x2f52f7[_0xc1dc('0x2e')];if(_0xe5c170[_0xc1dc('0x2f')][_0xc1dc('0x40')]){_0x402d3a[_0xc1dc('0x41')]=[{'all':!![]}];}_0x402d3a=_['merge']({},_0x402d3a,_0xe5c170[_0xc1dc('0x3e')]);return db[_0xc1dc('0x2a')][_0xc1dc('0x47')](_0x402d3a)[_0xc1dc('0x23')](handleEntityNotFound(_0x4f99ea,null))[_0xc1dc('0x23')](respondWithResult(_0x4f99ea,null))[_0xc1dc('0x44')](handleError(_0x4f99ea,null));};exports[_0xc1dc('0x48')]=function(_0x9a48b7,_0x2ca7f1){return db[_0xc1dc('0x2a')]['create'](_0x9a48b7['body'],{})['then'](respondWithResult(_0x2ca7f1,0xc9))[_0xc1dc('0x44')](handleError(_0x2ca7f1,null));};exports[_0xc1dc('0x22')]=function(_0x57b792,_0x129e23){if(_0x57b792[_0xc1dc('0x49')]['id']){delete _0x57b792['body']['id'];}return db[_0xc1dc('0x2a')]['find']({'where':{'id':_0x57b792[_0xc1dc('0x46')]['id']}})[_0xc1dc('0x23')](handleEntityNotFound(_0x129e23,null))[_0xc1dc('0x23')](saveUpdates(_0x57b792[_0xc1dc('0x49')],null))[_0xc1dc('0x23')](respondWithResult(_0x129e23,null))[_0xc1dc('0x44')](handleError(_0x129e23,null));};exports[_0xc1dc('0x24')]=function(_0x34667b,_0x4d4240){return db[_0xc1dc('0x2a')][_0xc1dc('0x47')]({'where':{'id':_0x34667b[_0xc1dc('0x46')]['id']}})[_0xc1dc('0x23')](handleEntityNotFound(_0x4d4240,null))['then'](removeEntity(_0x4d4240,null))[_0xc1dc('0x44')](handleError(_0x4d4240,null));};exports[_0xc1dc('0x4a')]=function(_0x3e3e6c,_0x1755cb){return db[_0xc1dc('0x2a')][_0xc1dc('0x4a')]()[_0xc1dc('0x23')](respondWithResult(_0x1755cb,null))[_0xc1dc('0x44')](handleError(_0x1755cb,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b7d480d..3902e3e 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x23dcc6,_0x4135c9){var _0x3b7ddd=function(_0x18ad24){while(--_0x18ad24){_0x23dcc6['push'](_0x23dcc6['shift']());}};_0x3b7ddd(++_0x4135c9);}(_0x7a54,0x106));var _0x47a5=function(_0xdf1873,_0x1362e){_0xdf1873=_0xdf1873-0x0;var _0x1df3b3=_0x7a54[_0xdf1873];return _0x1df3b3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x410f90,_0x1645a7){var _0x28f315=function(_0x1910e5){while(--_0x1910e5){_0x410f90['push'](_0x410f90['shift']());}};_0x28f315(++_0x1645a7);}(_0x7a54,0x106));var _0x47a5=function(_0x4a9f10,_0x33ab41){_0x4a9f10=_0x4a9f10-0x0;var _0x509f78=_0x7a54[_0x4a9f10];return _0x509f78;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index a16efc3..69abc9a 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 _0x0c08=['stringify','code','error','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x3f3c08,_0x2fd37b){var _0x2d79f2=function(_0x32c1f3){while(--_0x32c1f3){_0x3f3c08['push'](_0x3f3c08['shift']());}};_0x2d79f2(++_0x2fd37b);}(_0x0c08,0x177));var _0x80c0=function(_0x5b3c61,_0x3eb2aa){_0x5b3c61=_0x5b3c61-0x0;var _0x153389=_0x0c08[_0x5b3c61];return _0x153389;};'use strict';var _=require(_0x80c0('0x0'));var util=require(_0x80c0('0x1'));var moment=require(_0x80c0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x80c0('0x4'));var logger=require(_0x80c0('0x5'))(_0x80c0('0x6'));var config=require(_0x80c0('0x7'));var jayson=require(_0x80c0('0x8'));var client=jayson[_0x80c0('0x9')][_0x80c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528402,_0x67557d,_0x3ad6e5){return new BPromise(function(_0x394ee4,_0x32e55b){return client['request'](_0x528402,_0x3ad6e5)[_0x80c0('0xb')](function(_0x4a2b8e){logger[_0x80c0('0xc')]('Cdr,\x20%s,\x20%s',_0x67557d,_0x80c0('0xd'));logger[_0x80c0('0xe')](_0x80c0('0xf'),_0x67557d,_0x80c0('0xd'),JSON[_0x80c0('0x10')](_0x4a2b8e));if(_0x4a2b8e['error']){if(_0x4a2b8e['error'][_0x80c0('0x11')]===0x1f4){logger[_0x80c0('0x12')](_0x80c0('0x13'),_0x67557d,_0x4a2b8e[_0x80c0('0x12')][_0x80c0('0x14')]);return _0x32e55b(_0x4a2b8e[_0x80c0('0x12')][_0x80c0('0x14')]);}logger[_0x80c0('0x12')]('Cdr,\x20%s,\x20%s',_0x67557d,_0x4a2b8e[_0x80c0('0x12')]['message']);return _0x394ee4(_0x4a2b8e['error'][_0x80c0('0x14')]);}else{logger[_0x80c0('0xc')](_0x80c0('0x13'),_0x67557d,_0x80c0('0xd'));_0x394ee4(_0x4a2b8e[_0x80c0('0x15')][_0x80c0('0x14')]);}})[_0x80c0('0x16')](function(_0x1e6dc3){logger['error'](_0x80c0('0x13'),_0x67557d,_0x1e6dc3);_0x32e55b(_0x1e6dc3);});});} \ No newline at end of file +var _0x4266=['stringify','error','code','Cdr,\x20%s,\x20%s','message','info','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x16bd94,_0x3792be){var _0x47fac4=function(_0x9ee632){while(--_0x9ee632){_0x16bd94['push'](_0x16bd94['shift']());}};_0x47fac4(++_0x3792be);}(_0x4266,0x1eb));var _0x6426=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x4266[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x6426('0x0'));var moment=require(_0x6426('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6426('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6426('0x3'));var logger=require(_0x6426('0x4'))(_0x6426('0x5'));var config=require(_0x6426('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6426('0x7')][_0x6426('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14f63c,_0x3e32d3,_0x3d946a){return new BPromise(function(_0x41283a,_0x392aa6){return client[_0x6426('0x9')](_0x14f63c,_0x3d946a)['then'](function(_0x3391a5){logger['info']('Cdr,\x20%s,\x20%s',_0x3e32d3,'request\x20sent');logger[_0x6426('0xa')](_0x6426('0xb'),_0x3e32d3,_0x6426('0xc'),JSON[_0x6426('0xd')](_0x3391a5));if(_0x3391a5[_0x6426('0xe')]){if(_0x3391a5[_0x6426('0xe')][_0x6426('0xf')]===0x1f4){logger[_0x6426('0xe')](_0x6426('0x10'),_0x3e32d3,_0x3391a5['error']['message']);return _0x392aa6(_0x3391a5['error'][_0x6426('0x11')]);}logger[_0x6426('0xe')](_0x6426('0x10'),_0x3e32d3,_0x3391a5[_0x6426('0xe')][_0x6426('0x11')]);return _0x41283a(_0x3391a5[_0x6426('0xe')][_0x6426('0x11')]);}else{logger[_0x6426('0x12')](_0x6426('0x10'),_0x3e32d3,_0x6426('0xc'));_0x41283a(_0x3391a5[_0x6426('0x13')][_0x6426('0x11')]);}})[_0x6426('0x14')](function(_0x32ae77){logger[_0x6426('0xe')](_0x6426('0x10'),_0x3e32d3,_0x32ae77);_0x392aa6(_0x32ae77);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a17fc78..0a60680 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0xe7a4b5,_0x200412){var _0xe5bb55=function(_0x3ab258){while(--_0x3ab258){_0xe7a4b5['push'](_0xe7a4b5['shift']());}};_0xe5bb55(++_0x200412);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5e1248,_0x42b862){var _0x1b4201=function(_0x534a23){while(--_0x534a23){_0x5e1248['push'](_0x5e1248['shift']());}};_0x1b4201(++_0x42b862);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 2b9c45b..b945458 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 _0x996e=['noop','sequelize','exports','INTEGER','STRING'];(function(_0x334679,_0x47a768){var _0x449534=function(_0xd84a86){while(--_0xd84a86){_0x334679['push'](_0x334679['shift']());}};_0x449534(++_0x47a768);}(_0x996e,0x1e6));var _0xe996=function(_0x2ba97d,_0x42a43a){_0x2ba97d=_0x2ba97d-0x0;var _0xc7cb4=_0x996e[_0x2ba97d];return _0xc7cb4;};'use strict';var Sequelize=require(_0xe996('0x0'));module[_0xe996('0x1')]={'priority':{'type':Sequelize[_0xe996('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe996('0x3')],'allowNull':![],'defaultValue':_0xe996('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe996('0x3')]},'interval':{'type':Sequelize[_0xe996('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x72e3=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x72e3,0x1a8));var _0x372e=function(_0x16aca8,_0x566c87){_0x16aca8=_0x16aca8-0x0;var _0x26c9f9=_0x72e3[_0x16aca8];return _0x26c9f9;};'use strict';var Sequelize=require(_0x372e('0x0'));module[_0x372e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x372e('0x2')],'allowNull':![],'defaultValue':_0x372e('0x3')},'appdata':{'type':Sequelize[_0x372e('0x4')]()},'description':{'type':Sequelize[_0x372e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x372e('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2ab804b..1bdeefb 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 _0x720c=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','offset','count','limit','set','apply','reject','save','update','destroy','then','error','name','send','show','keys','ChatApplication','query','filters','model','attributes','intersection','fields','merge','options','find','catch','body','params','eml-format','zip-dir'];(function(_0x2be3cc,_0x4da743){var _0x4455ab=function(_0x4e5435){while(--_0x4e5435){_0x2be3cc['push'](_0x2be3cc['shift']());}};_0x4455ab(++_0x4da743);}(_0x720c,0x154));var _0xc720=function(_0x3bfef9,_0x4b573b){_0x3bfef9=_0x3bfef9-0x0;var _0x1eb878=_0x720c[_0x3bfef9];return _0x1eb878;};'use strict';var emlformat=require(_0xc720('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc720('0x1'));var jsonpatch=require(_0xc720('0x2'));var rp=require(_0xc720('0x3'));var moment=require(_0xc720('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc720('0x5'));var util=require(_0xc720('0x6'));var path=require(_0xc720('0x7'));var sox=require(_0xc720('0x8'));var csv=require(_0xc720('0x9'));var ejs=require(_0xc720('0xa'));var fs=require('fs');var fs_extra=require(_0xc720('0xb'));var _=require('lodash');var squel=require(_0xc720('0xc'));var crypto=require(_0xc720('0xd'));var jsforce=require(_0xc720('0xe'));var deskjs=require(_0xc720('0xf'));var toCsv=require(_0xc720('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc720('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc720('0x11'));var as=require(_0xc720('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc720('0x13'))(_0xc720('0x14'));var utils=require(_0xc720('0x15'));var config=require(_0xc720('0x16'));var licenseUtil=require(_0xc720('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18b088,_0x40f2f6){_0x40f2f6=_0x40f2f6||0xcc;return function(_0x24b8c1){if(_0x24b8c1){return _0x18b088[_0xc720('0x18')](_0x40f2f6);}return _0x18b088['status'](_0x40f2f6)[_0xc720('0x19')]();};}function respondWithResult(_0x267bf5,_0x3df0eb){_0x3df0eb=_0x3df0eb||0xc8;return function(_0x487d64){if(_0x487d64){return _0x267bf5[_0xc720('0x1a')](_0x3df0eb)[_0xc720('0x1b')](_0x487d64);}};}function respondWithFilteredResult(_0x37f24d,_0x2f7eaf){return function(_0xebcb34){if(_0xebcb34){var _0x4f351a=typeof _0x2f7eaf['offset']===_0xc720('0x1c')&&typeof _0x2f7eaf['limit']===_0xc720('0x1c');var _0x26014e=_0xebcb34['count'];var _0x34de4c=_0x4f351a?0x0:_0x2f7eaf[_0xc720('0x1d')];var _0x195cf3=_0x4f351a?_0xebcb34[_0xc720('0x1e')]:_0x2f7eaf[_0xc720('0x1d')]+_0x2f7eaf[_0xc720('0x1f')];var _0xf92a2f;if(_0x195cf3>=_0x26014e){_0x195cf3=_0x26014e;_0xf92a2f=0xc8;}else{_0xf92a2f=0xce;}_0x37f24d[_0xc720('0x1a')](_0xf92a2f);return _0x37f24d[_0xc720('0x20')]('Content-Range',_0x34de4c+'-'+_0x195cf3+'/'+_0x26014e)['json'](_0xebcb34);}return null;};}function patchUpdates(_0x52cdf7){return function(_0x387bac){try{jsonpatch[_0xc720('0x21')](_0x387bac,_0x52cdf7,!![]);}catch(_0x1e8a00){return BPromise[_0xc720('0x22')](_0x1e8a00);}return _0x387bac[_0xc720('0x23')]();};}function saveUpdates(_0x4f0312,_0x358cfe){return function(_0x56d824){if(_0x56d824){return _0x56d824[_0xc720('0x24')](_0x4f0312)['then'](function(_0x38ac8a){return _0x38ac8a;});}return null;};}function removeEntity(_0x211aa0,_0x5ee6e7){return function(_0xfc7d7b){if(_0xfc7d7b){return _0xfc7d7b[_0xc720('0x25')]()[_0xc720('0x26')](function(){_0x211aa0[_0xc720('0x1a')](0xcc)[_0xc720('0x19')]();});}};}function handleEntityNotFound(_0x141cb5,_0x240a71){return function(_0x5a8b03){if(!_0x5a8b03){_0x141cb5[_0xc720('0x18')](0x194);}return _0x5a8b03;};}function handleError(_0x9a4e51,_0x522428){_0x522428=_0x522428||0x1f4;return function(_0x474a7e){logger[_0xc720('0x27')](_0x474a7e['stack']);if(_0x474a7e[_0xc720('0x28')]){delete _0x474a7e['name'];}_0x9a4e51[_0xc720('0x1a')](_0x522428)[_0xc720('0x29')](_0x474a7e);};}exports[_0xc720('0x2a')]=function(_0x84d71e,_0x429859){var _0x4760a0={'raw':!![],'where':{'id':_0x84d71e['params']['id']}},_0x31e2e7={};_0x31e2e7['model']=_[_0xc720('0x2b')](db[_0xc720('0x2c')]['rawAttributes']);_0x31e2e7[_0xc720('0x2d')]=_['keys'](_0x84d71e[_0xc720('0x2d')]);_0x31e2e7[_0xc720('0x2e')]=_['intersection'](_0x31e2e7[_0xc720('0x2f')],_0x31e2e7[_0xc720('0x2d')]);_0x4760a0[_0xc720('0x30')]=_[_0xc720('0x31')](_0x31e2e7[_0xc720('0x2f')],qs[_0xc720('0x32')](_0x84d71e[_0xc720('0x2d')][_0xc720('0x32')]));_0x4760a0[_0xc720('0x30')]=_0x4760a0[_0xc720('0x30')]['length']?_0x4760a0[_0xc720('0x30')]:_0x31e2e7['model'];if(_0x84d71e[_0xc720('0x2d')]['includeAll']){_0x4760a0['include']=[{'all':!![]}];}_0x4760a0=_[_0xc720('0x33')]({},_0x4760a0,_0x84d71e[_0xc720('0x34')]);return db[_0xc720('0x2c')][_0xc720('0x35')](_0x4760a0)['then'](handleEntityNotFound(_0x429859,null))[_0xc720('0x26')](respondWithResult(_0x429859,null))[_0xc720('0x36')](handleError(_0x429859,null));};exports['update']=function(_0x88d791,_0x46c1aa){if(_0x88d791[_0xc720('0x37')]['id']){delete _0x88d791[_0xc720('0x37')]['id'];}return db['ChatApplication'][_0xc720('0x35')]({'where':{'id':_0x88d791[_0xc720('0x38')]['id']}})['then'](handleEntityNotFound(_0x46c1aa,null))['then'](saveUpdates(_0x88d791[_0xc720('0x37')],null))[_0xc720('0x26')](respondWithResult(_0x46c1aa,null))['catch'](handleError(_0x46c1aa,null));};exports[_0xc720('0x25')]=function(_0x5c4dff,_0x455f9e){return db[_0xc720('0x2c')][_0xc720('0x35')]({'where':{'id':_0x5c4dff[_0xc720('0x38')]['id']}})[_0xc720('0x26')](handleEntityNotFound(_0x455f9e,null))['then'](removeEntity(_0x455f9e,null))[_0xc720('0x36')](handleError(_0x455f9e,null));}; \ No newline at end of file +var _0x3402=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','include','merge','options','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4bff25,_0x32011f){var _0x1505ac=function(_0x59cc79){while(--_0x59cc79){_0x4bff25['push'](_0x4bff25['shift']());}};_0x1505ac(++_0x32011f);}(_0x3402,0x1f0));var _0x2340=function(_0x14ad45,_0x484efa){_0x14ad45=_0x14ad45-0x0;var _0x436809=_0x3402[_0x14ad45];return _0x436809;};'use strict';var emlformat=require(_0x2340('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2340('0x1'));var jsonpatch=require(_0x2340('0x2'));var rp=require(_0x2340('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2340('0x4'));var util=require(_0x2340('0x5'));var path=require(_0x2340('0x6'));var sox=require(_0x2340('0x7'));var csv=require(_0x2340('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2340('0x9'));var squel=require(_0x2340('0xa'));var crypto=require(_0x2340('0xb'));var jsforce=require(_0x2340('0xc'));var deskjs=require(_0x2340('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2340('0xe'));var Papa=require(_0x2340('0xf'));var Redis=require(_0x2340('0x10'));var authService=require(_0x2340('0x11'));var qs=require(_0x2340('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2340('0x13'));var logger=require(_0x2340('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2340('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2340('0x16'))['db'];function respondWithStatusCode(_0x5cc478,_0x35baa8){_0x35baa8=_0x35baa8||0xcc;return function(_0x42c154){if(_0x42c154){return _0x5cc478[_0x2340('0x17')](_0x35baa8);}return _0x5cc478[_0x2340('0x18')](_0x35baa8)[_0x2340('0x19')]();};}function respondWithResult(_0x7e51a5,_0xcab834){_0xcab834=_0xcab834||0xc8;return function(_0x491814){if(_0x491814){return _0x7e51a5[_0x2340('0x18')](_0xcab834)[_0x2340('0x1a')](_0x491814);}};}function respondWithFilteredResult(_0x3642e0,_0x5aff27){return function(_0x173678){if(_0x173678){var _0x119a05=typeof _0x5aff27[_0x2340('0x1b')]===_0x2340('0x1c')&&typeof _0x5aff27['limit']===_0x2340('0x1c');var _0x3ce1fa=_0x173678[_0x2340('0x1d')];var _0x9723dd=_0x119a05?0x0:_0x5aff27[_0x2340('0x1b')];var _0x51524b=_0x119a05?_0x173678['count']:_0x5aff27[_0x2340('0x1b')]+_0x5aff27[_0x2340('0x1e')];var _0x434a59;if(_0x51524b>=_0x3ce1fa){_0x51524b=_0x3ce1fa;_0x434a59=0xc8;}else{_0x434a59=0xce;}_0x3642e0['status'](_0x434a59);return _0x3642e0['set'](_0x2340('0x1f'),_0x9723dd+'-'+_0x51524b+'/'+_0x3ce1fa)[_0x2340('0x1a')](_0x173678);}return null;};}function patchUpdates(_0x1b3822){return function(_0xb2b57a){try{jsonpatch['apply'](_0xb2b57a,_0x1b3822,!![]);}catch(_0x567de5){return BPromise[_0x2340('0x20')](_0x567de5);}return _0xb2b57a['save']();};}function saveUpdates(_0x3f9f54,_0x44622a){return function(_0x28a812){if(_0x28a812){return _0x28a812[_0x2340('0x21')](_0x3f9f54)[_0x2340('0x22')](function(_0x32e08b){return _0x32e08b;});}return null;};}function removeEntity(_0x8f1d89,_0x130944){return function(_0x49c77e){if(_0x49c77e){return _0x49c77e['destroy']()[_0x2340('0x22')](function(){_0x8f1d89[_0x2340('0x18')](0xcc)[_0x2340('0x19')]();});}};}function handleEntityNotFound(_0x44680e,_0x320c1b){return function(_0x27e903){if(!_0x27e903){_0x44680e[_0x2340('0x17')](0x194);}return _0x27e903;};}function handleError(_0x5b61a7,_0x3fe07f){_0x3fe07f=_0x3fe07f||0x1f4;return function(_0x46d5cb){logger[_0x2340('0x23')](_0x46d5cb[_0x2340('0x24')]);if(_0x46d5cb[_0x2340('0x25')]){delete _0x46d5cb[_0x2340('0x25')];}_0x5b61a7[_0x2340('0x18')](_0x3fe07f)[_0x2340('0x26')](_0x46d5cb);};}exports[_0x2340('0x27')]=function(_0x229a00,_0x360d59){var _0x5e697b={'raw':!![],'where':{'id':_0x229a00[_0x2340('0x28')]['id']}},_0x336ffe={};_0x336ffe['model']=_[_0x2340('0x29')](db[_0x2340('0x2a')][_0x2340('0x2b')]);_0x336ffe[_0x2340('0x2c')]=_[_0x2340('0x29')](_0x229a00['query']);_0x336ffe[_0x2340('0x2d')]=_[_0x2340('0x2e')](_0x336ffe[_0x2340('0x2f')],_0x336ffe[_0x2340('0x2c')]);_0x5e697b[_0x2340('0x30')]=_['intersection'](_0x336ffe[_0x2340('0x2f')],qs[_0x2340('0x31')](_0x229a00[_0x2340('0x2c')]['fields']));_0x5e697b[_0x2340('0x30')]=_0x5e697b[_0x2340('0x30')]['length']?_0x5e697b[_0x2340('0x30')]:_0x336ffe[_0x2340('0x2f')];if(_0x229a00['query'][_0x2340('0x32')]){_0x5e697b[_0x2340('0x33')]=[{'all':!![]}];}_0x5e697b=_[_0x2340('0x34')]({},_0x5e697b,_0x229a00[_0x2340('0x35')]);return db[_0x2340('0x2a')][_0x2340('0x36')](_0x5e697b)['then'](handleEntityNotFound(_0x360d59,null))[_0x2340('0x22')](respondWithResult(_0x360d59,null))[_0x2340('0x37')](handleError(_0x360d59,null));};exports[_0x2340('0x21')]=function(_0x48b7dc,_0x1c8ea9){if(_0x48b7dc[_0x2340('0x38')]['id']){delete _0x48b7dc[_0x2340('0x38')]['id'];}return db[_0x2340('0x2a')][_0x2340('0x36')]({'where':{'id':_0x48b7dc[_0x2340('0x28')]['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x1c8ea9,null))[_0x2340('0x22')](saveUpdates(_0x48b7dc[_0x2340('0x38')],null))[_0x2340('0x22')](respondWithResult(_0x1c8ea9,null))[_0x2340('0x37')](handleError(_0x1c8ea9,null));};exports['destroy']=function(_0x14da4a,_0x5b4f71){return db['ChatApplication'][_0x2340('0x36')]({'where':{'id':_0x14da4a['params']['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x5b4f71,null))[_0x2340('0x22')](removeEntity(_0x5b4f71,null))['catch'](handleError(_0x5b4f71,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index fea8321..4205143 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 _0x208b=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x342dd5,_0x53cec0){var _0x4504b8=function(_0x3a3233){while(--_0x3a3233){_0x342dd5['push'](_0x342dd5['shift']());}};_0x4504b8(++_0x53cec0);}(_0x208b,0x114));var _0xb208=function(_0x49884e,_0x340f0b){_0x49884e=_0x49884e-0x0;var _0x168939=_0x208b[_0x49884e];return _0x168939;};'use strict';var _=require(_0xb208('0x0'));var util=require(_0xb208('0x1'));var logger=require(_0xb208('0x2'))(_0xb208('0x3'));var moment=require('moment');var BPromise=require(_0xb208('0x4'));var rp=require(_0xb208('0x5'));var fs=require('fs');var path=require(_0xb208('0x6'));var rimraf=require(_0xb208('0x7'));var config=require(_0xb208('0x8'));var attributes=require(_0xb208('0x9'));module[_0xb208('0xa')]=function(_0x2213c4,_0x46411a){return _0x2213c4[_0xb208('0xb')](_0xb208('0xc'),attributes,{'tableName':_0xb208('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb208('0xe'),'collate':_0xb208('0xf')});}; \ No newline at end of file +var _0x6ccc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1d82c5,_0x465e70){var _0x3c9e20=function(_0x34172b){while(--_0x34172b){_0x1d82c5['push'](_0x1d82c5['shift']());}};_0x3c9e20(++_0x465e70);}(_0x6ccc,0x14d));var _0xc6cc=function(_0xb08b54,_0x149ec4){_0xb08b54=_0xb08b54-0x0;var _0x353ed9=_0x6ccc[_0xb08b54];return _0x353ed9;};'use strict';var _=require(_0xc6cc('0x0'));var util=require(_0xc6cc('0x1'));var logger=require(_0xc6cc('0x2'))(_0xc6cc('0x3'));var moment=require(_0xc6cc('0x4'));var BPromise=require(_0xc6cc('0x5'));var rp=require(_0xc6cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6cc('0x7'));var config=require(_0xc6cc('0x8'));var attributes=require('./chatApplication.attributes');module[_0xc6cc('0x9')]=function(_0x506e2f,_0x5f2a10){return _0x506e2f['define'](_0xc6cc('0xa'),attributes,{'tableName':_0xc6cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc6cc('0xc'),'collate':_0xc6cc('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f02b968..3d57f4e 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 _0xdea8=['client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise'];(function(_0xb5fb77,_0x2ec122){var _0x3f4101=function(_0x25b782){while(--_0x25b782){_0xb5fb77['push'](_0xb5fb77['shift']());}};_0x3f4101(++_0x2ec122);}(_0xdea8,0x173));var _0x8dea=function(_0x14e720,_0x3465e5){_0x14e720=_0x14e720-0x0;var _0x2d8240=_0xdea8[_0x14e720];return _0x2d8240;};'use strict';var _=require(_0x8dea('0x0'));var util=require(_0x8dea('0x1'));var moment=require(_0x8dea('0x2'));var BPromise=require('bluebird');var rs=require(_0x8dea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8dea('0x4'));var logger=require(_0x8dea('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8dea('0x6'));var client=jayson[_0x8dea('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x475fe3,_0xd7c429,_0x2075e3){return new BPromise(function(_0x53f4f2,_0x3c2c3){return client[_0x8dea('0x8')](_0x475fe3,_0x2075e3)[_0x8dea('0x9')](function(_0xb76ef9){logger[_0x8dea('0xa')](_0x8dea('0xb'),_0xd7c429,_0x8dea('0xc'));logger[_0x8dea('0xd')](_0x8dea('0xe'),_0xd7c429,_0x8dea('0xc'),JSON[_0x8dea('0xf')](_0xb76ef9));if(_0xb76ef9[_0x8dea('0x10')]){if(_0xb76ef9[_0x8dea('0x10')][_0x8dea('0x11')]===0x1f4){logger[_0x8dea('0x10')](_0x8dea('0xb'),_0xd7c429,_0xb76ef9[_0x8dea('0x10')][_0x8dea('0x12')]);return _0x3c2c3(_0xb76ef9[_0x8dea('0x10')]['message']);}logger[_0x8dea('0x10')](_0x8dea('0xb'),_0xd7c429,_0xb76ef9['error'][_0x8dea('0x12')]);return _0x53f4f2(_0xb76ef9[_0x8dea('0x10')][_0x8dea('0x12')]);}else{logger[_0x8dea('0xa')](_0x8dea('0xb'),_0xd7c429,_0x8dea('0xc'));_0x53f4f2(_0xb76ef9[_0x8dea('0x13')][_0x8dea('0x12')]);}})[_0x8dea('0x14')](function(_0x31d9e4){logger[_0x8dea('0x10')]('ChatApplication,\x20%s,\x20%s',_0xd7c429,_0x31d9e4);_0x3c2c3(_0x31d9e4);});});} \ No newline at end of file +var _0xc692=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0xc692,0x1d2));var _0x2c69=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xc692[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require(_0x2c69('0x0'));var moment=require(_0x2c69('0x1'));var BPromise=require(_0x2c69('0x2'));var rs=require(_0x2c69('0x3'));var fs=require('fs');var Redis=require(_0x2c69('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c69('0x5'));var logger=require(_0x2c69('0x6'))(_0x2c69('0x7'));var config=require(_0x2c69('0x8'));var jayson=require(_0x2c69('0x9'));var client=jayson[_0x2c69('0xa')][_0x2c69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x440cb6,_0x18636c,_0x25d2f7){return new BPromise(function(_0x99d779,_0x52885c){return client[_0x2c69('0xc')](_0x440cb6,_0x25d2f7)[_0x2c69('0xd')](function(_0x3bba2a){logger['info'](_0x2c69('0xe'),_0x18636c,_0x2c69('0xf'));logger[_0x2c69('0x10')](_0x2c69('0x11'),_0x18636c,_0x2c69('0xf'),JSON['stringify'](_0x3bba2a));if(_0x3bba2a[_0x2c69('0x12')]){if(_0x3bba2a[_0x2c69('0x12')][_0x2c69('0x13')]===0x1f4){logger[_0x2c69('0x12')](_0x2c69('0xe'),_0x18636c,_0x3bba2a[_0x2c69('0x12')][_0x2c69('0x14')]);return _0x52885c(_0x3bba2a[_0x2c69('0x12')][_0x2c69('0x14')]);}logger[_0x2c69('0x12')]('ChatApplication,\x20%s,\x20%s',_0x18636c,_0x3bba2a['error'][_0x2c69('0x14')]);return _0x99d779(_0x3bba2a[_0x2c69('0x12')][_0x2c69('0x14')]);}else{logger[_0x2c69('0x15')](_0x2c69('0xe'),_0x18636c,'request\x20sent');_0x99d779(_0x3bba2a[_0x2c69('0x16')][_0x2c69('0x14')]);}})[_0x2c69('0x17')](function(_0x1a222d){logger[_0x2c69('0x12')](_0x2c69('0xe'),_0x18636c,_0x1a222d);_0x52885c(_0x1a222d);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a94a670..5a6c950 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 _0xa72d=['delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','show','put','/:id','isAuthenticated','update'];(function(_0x589f94,_0x1ab4f5){var _0x2cac50=function(_0x190ca1){while(--_0x190ca1){_0x589f94['push'](_0x589f94['shift']());}};_0x2cac50(++_0x1ab4f5);}(_0xa72d,0x120));var _0xda72=function(_0x362d71,_0x393a1f){_0x362d71=_0x362d71-0x0;var _0x12e411=_0xa72d[_0x362d71];return _0x12e411;};'use strict';var multer=require('multer');var util=require(_0xda72('0x0'));var path=require('path');var timeout=require(_0xda72('0x1'));var express=require(_0xda72('0x2'));var router=express['Router']();var fs_extra=require(_0xda72('0x3'));var auth=require(_0xda72('0x4'));var interaction=require(_0xda72('0x5'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xda72('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xda72('0x7')]);router[_0xda72('0x8')](_0xda72('0x9'),auth[_0xda72('0xa')](),controller[_0xda72('0xb')]);router[_0xda72('0xc')]('/:id',auth[_0xda72('0xa')](),controller[_0xda72('0xd')]);module[_0xda72('0xe')]=router; \ No newline at end of file +var _0x68d6=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x3adde6,_0x308e76){var _0x3c8a4f=function(_0xac4b1d){while(--_0xac4b1d){_0x3adde6['push'](_0x3adde6['shift']());}};_0x3c8a4f(++_0x308e76);}(_0x68d6,0xb8));var _0x668d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x68d6[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0x668d('0x0'));var path=require(_0x668d('0x1'));var timeout=require('connect-timeout');var express=require(_0x668d('0x2'));var router=express['Router']();var fs_extra=require(_0x668d('0x3'));var auth=require(_0x668d('0x4'));var interaction=require(_0x668d('0x5'));var config=require(_0x668d('0x6'));var controller=require(_0x668d('0x7'));router['get'](_0x668d('0x8'),auth[_0x668d('0x9')](),controller[_0x668d('0xa')]);router[_0x668d('0xb')](_0x668d('0x8'),auth['isAuthenticated'](),controller[_0x668d('0xc')]);router[_0x668d('0xd')]('/:id',auth[_0x668d('0x9')](),controller[_0x668d('0xe')]);module[_0x668d('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 47ebdea..4fee33e 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 _0x7d42=['exports','STRING','sequelize'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x7d42,0xb0));var _0x27d4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7d42[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x27d4('0x0'));module[_0x27d4('0x1')]={'name':{'type':Sequelize[_0x27d4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x27d4('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x46e1=['BOOLEAN','sequelize','exports','STRING'];(function(_0x13eaae,_0x11ec0a){var _0x4493db=function(_0xf9d8b1){while(--_0xf9d8b1){_0x13eaae['push'](_0x13eaae['shift']());}};_0x4493db(++_0x11ec0a);}(_0x46e1,0x155));var _0x146e=function(_0x4e664,_0x3cd9c8){_0x4e664=_0x4e664-0x0;var _0x2e7dd3=_0x46e1[_0x4e664];return _0x2e7dd3;};'use strict';var Sequelize=require(_0x146e('0x0'));module[_0x146e('0x1')]={'name':{'type':Sequelize[_0x146e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x146e('0x2')]},'write':{'type':Sequelize[_0x146e('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 574b88b..b324662 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 _0xb6df=['addMessage','ChatGroupId','getMessages','findOne','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','status','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','find','ids','omit','getMembers','filter','removeMembers'];(function(_0x410fb7,_0x21d9a5){var _0x4e0ad1=function(_0x4ba33a){while(--_0x4ba33a){_0x410fb7['push'](_0x410fb7['shift']());}};_0x4e0ad1(++_0x21d9a5);}(_0xb6df,0x11b));var _0xfb6d=function(_0x104d31,_0x30ba26){_0x104d31=_0x104d31-0x0;var _0x579be7=_0xb6df[_0x104d31];return _0x579be7;};'use strict';var emlformat=require(_0xfb6d('0x0'));var rimraf=require(_0xfb6d('0x1'));var zipdir=require(_0xfb6d('0x2'));var jsonpatch=require(_0xfb6d('0x3'));var rp=require(_0xfb6d('0x4'));var moment=require(_0xfb6d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb6d('0x6'));var util=require('util');var path=require(_0xfb6d('0x7'));var sox=require(_0xfb6d('0x8'));var csv=require(_0xfb6d('0x9'));var ejs=require(_0xfb6d('0xa'));var fs=require('fs');var fs_extra=require(_0xfb6d('0xb'));var _=require('lodash');var squel=require(_0xfb6d('0xc'));var crypto=require(_0xfb6d('0xd'));var jsforce=require(_0xfb6d('0xe'));var deskjs=require(_0xfb6d('0xf'));var toCsv=require(_0xfb6d('0x9'));var querystring=require(_0xfb6d('0x10'));var Papa=require('papaparse');var Redis=require(_0xfb6d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfb6d('0x12'));var as=require(_0xfb6d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfb6d('0x14'));var db=require(_0xfb6d('0x15'))['db'];config[_0xfb6d('0x16')]=_[_0xfb6d('0x17')](config[_0xfb6d('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb6d('0x18'))(new Redis(config[_0xfb6d('0x16')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x34e8ab,_0x29771f){_0x29771f=_0x29771f||0xcc;return function(_0x547de4){if(_0x547de4){return _0x34e8ab[_0xfb6d('0x19')](_0x29771f);}return _0x34e8ab['status'](_0x29771f)[_0xfb6d('0x1a')]();};}function respondWithResult(_0x42f737,_0x51fe15){_0x51fe15=_0x51fe15||0xc8;return function(_0x95b605){if(_0x95b605){return _0x42f737['status'](_0x51fe15)[_0xfb6d('0x1b')](_0x95b605);}};}function respondWithFilteredResult(_0x53db41,_0x5e2abd){return function(_0x522a9c){if(_0x522a9c){var _0x31d626=typeof _0x5e2abd['offset']==='undefined'&&typeof _0x5e2abd[_0xfb6d('0x1c')]===_0xfb6d('0x1d');var _0x2a869e=_0x522a9c[_0xfb6d('0x1e')];var _0xcadff2=_0x31d626?0x0:_0x5e2abd[_0xfb6d('0x1f')];var _0x5ae70b=_0x31d626?_0x522a9c[_0xfb6d('0x1e')]:_0x5e2abd[_0xfb6d('0x1f')]+_0x5e2abd[_0xfb6d('0x1c')];var _0x1c36c0;if(_0x5ae70b>=_0x2a869e){_0x5ae70b=_0x2a869e;_0x1c36c0=0xc8;}else{_0x1c36c0=0xce;}_0x53db41['status'](_0x1c36c0);return _0x53db41['set'](_0xfb6d('0x20'),_0xcadff2+'-'+_0x5ae70b+'/'+_0x2a869e)[_0xfb6d('0x1b')](_0x522a9c);}return null;};}function patchUpdates(_0x30541c){return function(_0x31d7c2){try{jsonpatch[_0xfb6d('0x21')](_0x31d7c2,_0x30541c,!![]);}catch(_0x1bc71d){return BPromise[_0xfb6d('0x22')](_0x1bc71d);}return _0x31d7c2[_0xfb6d('0x23')]();};}function saveUpdates(_0x3938fb,_0x5c8c84){return function(_0x1fc79d){if(_0x1fc79d){return _0x1fc79d['update'](_0x3938fb)[_0xfb6d('0x24')](function(_0x112cac){return _0x112cac;});}return null;};}function removeEntity(_0x56303c,_0x20ee3d){return function(_0x12c8b6){if(_0x12c8b6){return _0x12c8b6[_0xfb6d('0x25')]()[_0xfb6d('0x24')](function(){_0x56303c[_0xfb6d('0x26')](0xcc)[_0xfb6d('0x1a')]();});}};}function handleEntityNotFound(_0x4c14df,_0x2eff1a){return function(_0x13020f){if(!_0x13020f){_0x4c14df['sendStatus'](0x194);}return _0x13020f;};}function handleError(_0x230751,_0x315ca2){_0x315ca2=_0x315ca2||0x1f4;return function(_0x3b6b19){logger[_0xfb6d('0x27')](_0x3b6b19[_0xfb6d('0x28')]);if(_0x3b6b19[_0xfb6d('0x29')]){delete _0x3b6b19[_0xfb6d('0x29')];}_0x230751[_0xfb6d('0x26')](_0x315ca2)[_0xfb6d('0x2a')](_0x3b6b19);};}exports[_0xfb6d('0x2b')]=function(_0x269d7f,_0x2980fe){var _0x16d652={},_0x3e632d={},_0x35c191={'count':0x0,'rows':[]};var _0x476588=_[_0xfb6d('0x2c')](db[_0xfb6d('0x2d')][_0xfb6d('0x2e')],function(_0x55853d){return{'name':_0x55853d[_0xfb6d('0x2f')],'type':_0x55853d[_0xfb6d('0x30')]['key']};});_0x3e632d[_0xfb6d('0x31')]=_[_0xfb6d('0x2c')](_0x476588,_0xfb6d('0x29'));_0x3e632d['query']=_[_0xfb6d('0x32')](_0x269d7f[_0xfb6d('0x33')]);_0x3e632d[_0xfb6d('0x34')]=_[_0xfb6d('0x35')](_0x3e632d[_0xfb6d('0x31')],_0x3e632d[_0xfb6d('0x33')]);_0x16d652[_0xfb6d('0x36')]=_[_0xfb6d('0x35')](_0x3e632d['model'],qs[_0xfb6d('0x37')](_0x269d7f['query']['fields']));_0x16d652[_0xfb6d('0x36')]=_0x16d652[_0xfb6d('0x36')][_0xfb6d('0x38')]?_0x16d652[_0xfb6d('0x36')]:_0x3e632d[_0xfb6d('0x31')];if(!_0x269d7f['query'][_0xfb6d('0x39')](_0xfb6d('0x3a'))){_0x16d652['limit']=qs[_0xfb6d('0x1c')](_0x269d7f[_0xfb6d('0x33')][_0xfb6d('0x1c')]);_0x16d652[_0xfb6d('0x1f')]=qs['offset'](_0x269d7f[_0xfb6d('0x33')][_0xfb6d('0x1f')]);}_0x16d652[_0xfb6d('0x3b')]=qs[_0xfb6d('0x3c')](_0x269d7f[_0xfb6d('0x33')]['sort']);_0x16d652['where']=qs['filters'](_[_0xfb6d('0x3d')](_0x269d7f['query'],_0x3e632d[_0xfb6d('0x34')]),_0x476588);if(_0x269d7f[_0xfb6d('0x33')]['filter']){_0x16d652[_0xfb6d('0x3e')]=_[_0xfb6d('0x3f')](_0x16d652[_0xfb6d('0x3e')],{'$or':_[_0xfb6d('0x2c')](_0x476588,function(_0x1c11b8){if(_0x1c11b8[_0xfb6d('0x30')]!==_0xfb6d('0x40')){var _0x4201dd={};_0x4201dd[_0x1c11b8[_0xfb6d('0x29')]]={'$like':'%'+_0x269d7f[_0xfb6d('0x33')]['filter']+'%'};return _0x4201dd;}})});}_0x16d652=_['merge']({},_0x16d652,_0x269d7f[_0xfb6d('0x41')]);var _0x4fc604={'where':_0x16d652[_0xfb6d('0x3e')]};return db[_0xfb6d('0x2d')][_0xfb6d('0x1e')](_0x4fc604)[_0xfb6d('0x24')](function(_0x1ab49d){_0x35c191['count']=_0x1ab49d;if(_0x269d7f[_0xfb6d('0x33')]['includeAll']){_0x16d652[_0xfb6d('0x42')]=[{'all':!![]}];}return db['ChatGroup'][_0xfb6d('0x43')](_0x16d652);})['then'](function(_0x569f69){_0x35c191[_0xfb6d('0x44')]=_0x569f69;return _0x35c191;})[_0xfb6d('0x24')](respondWithFilteredResult(_0x2980fe,_0x16d652))[_0xfb6d('0x45')](handleError(_0x2980fe,null));};exports['show']=function(_0x55d6ff,_0x4512a3){var _0x308092={'raw':!![],'where':{'id':_0x55d6ff[_0xfb6d('0x46')]['id']}},_0x5d9491={};_0x5d9491[_0xfb6d('0x31')]=_['keys'](db[_0xfb6d('0x2d')][_0xfb6d('0x2e')]);_0x5d9491[_0xfb6d('0x33')]=_['keys'](_0x55d6ff[_0xfb6d('0x33')]);_0x5d9491['filters']=_['intersection'](_0x5d9491[_0xfb6d('0x31')],_0x5d9491[_0xfb6d('0x33')]);_0x308092[_0xfb6d('0x36')]=_[_0xfb6d('0x35')](_0x5d9491[_0xfb6d('0x31')],qs[_0xfb6d('0x37')](_0x55d6ff[_0xfb6d('0x33')][_0xfb6d('0x37')]));_0x308092['attributes']=_0x308092[_0xfb6d('0x36')][_0xfb6d('0x38')]?_0x308092[_0xfb6d('0x36')]:_0x5d9491['model'];if(_0x55d6ff[_0xfb6d('0x33')][_0xfb6d('0x47')]){_0x308092[_0xfb6d('0x42')]=[{'all':!![]}];}_0x308092=_[_0xfb6d('0x3f')]({},_0x308092,_0x55d6ff[_0xfb6d('0x41')]);return db['ChatGroup']['find'](_0x308092)['then'](handleEntityNotFound(_0x4512a3,null))[_0xfb6d('0x24')](respondWithResult(_0x4512a3,null))[_0xfb6d('0x45')](handleError(_0x4512a3,null));};exports[_0xfb6d('0x48')]=function(_0x3f559a,_0x5532b3){return db[_0xfb6d('0x2d')][_0xfb6d('0x48')](_0x3f559a[_0xfb6d('0x49')],{})[_0xfb6d('0x24')](respondWithResult(_0x5532b3,0xc9))[_0xfb6d('0x45')](handleError(_0x5532b3,null));};exports['update']=function(_0x2ba7db,_0x345880){if(_0x2ba7db[_0xfb6d('0x49')]['id']){delete _0x2ba7db[_0xfb6d('0x49')]['id'];}return db[_0xfb6d('0x2d')]['find']({'where':{'id':_0x2ba7db[_0xfb6d('0x46')]['id']}})['then'](handleEntityNotFound(_0x345880,null))[_0xfb6d('0x24')](saveUpdates(_0x2ba7db[_0xfb6d('0x49')],null))[_0xfb6d('0x24')](respondWithResult(_0x345880,null))[_0xfb6d('0x45')](handleError(_0x345880,null));};exports[_0xfb6d('0x25')]=function(_0x1a5070,_0x4112f4){return db['ChatGroup']['find']({'where':{'id':_0x1a5070[_0xfb6d('0x46')]['id']}})[_0xfb6d('0x24')](handleEntityNotFound(_0x4112f4,null))[_0xfb6d('0x24')](removeEntity(_0x4112f4,null))[_0xfb6d('0x45')](handleError(_0x4112f4,null));};exports[_0xfb6d('0x4a')]=function(_0x380496,_0x20e883){return db[_0xfb6d('0x2d')][_0xfb6d('0x4a')]()[_0xfb6d('0x24')](respondWithResult(_0x20e883,null))[_0xfb6d('0x45')](handleError(_0x20e883,null));};exports['getUnread']=function(_0x500697,_0x5aae6d,_0x5eb664){return db[_0xfb6d('0x4b')][_0xfb6d('0x1e')]({'where':{'ChatGroupId':_0x500697[_0xfb6d('0x46')]['id'],'ToId':_0x500697[_0xfb6d('0x4c')]['id'],'read':![]}})['then'](function(_0x1ad8cc){return{'id':_[_0xfb6d('0x4d')](_0x500697[_0xfb6d('0x46')]['id']),'count':_0x1ad8cc};})[_0xfb6d('0x24')](respondWithResult(_0x5aae6d,null))[_0xfb6d('0x45')](handleError(_0x5aae6d,null));};exports[_0xfb6d('0x4e')]=function(_0x542f2a,_0x47e2e1,_0x373e94){return db[_0xfb6d('0x2d')][_0xfb6d('0x4f')]({'where':{'id':_0x542f2a[_0xfb6d('0x46')]['id']}})[_0xfb6d('0x24')](handleEntityNotFound(_0x47e2e1,null))[_0xfb6d('0x24')](function(_0x30559f){if(_0x30559f){return _0x30559f[_0xfb6d('0x4e')](_0x542f2a[_0xfb6d('0x49')][_0xfb6d('0x50')],_[_0xfb6d('0x51')](_0x542f2a[_0xfb6d('0x49')],['ids','id'])||{});}})[_0xfb6d('0x24')](respondWithResult(_0x47e2e1,null))['catch'](handleError(_0x47e2e1,null));};exports[_0xfb6d('0x52')]=function(_0xb2ffba,_0x18ce85,_0x1554c5){var _0x35d2ec={};var _0x3cc6bb={};var _0x59a24b;var _0x143982;return db[_0xfb6d('0x2d')]['findOne']({'where':{'id':_0xb2ffba[_0xfb6d('0x46')]['id']}})['then'](handleEntityNotFound(_0x18ce85,null))[_0xfb6d('0x24')](function(_0x1513be){if(_0x1513be){_0x59a24b=_0x1513be;_0x3cc6bb[_0xfb6d('0x31')]=_[_0xfb6d('0x32')](db['User'][_0xfb6d('0x2e')]);_0x3cc6bb[_0xfb6d('0x33')]=_[_0xfb6d('0x32')](_0xb2ffba[_0xfb6d('0x33')]);_0x3cc6bb[_0xfb6d('0x34')]=_['intersection'](_0x3cc6bb[_0xfb6d('0x31')],_0x3cc6bb[_0xfb6d('0x33')]);_0x35d2ec['attributes']=_[_0xfb6d('0x35')](_0x3cc6bb['model'],qs[_0xfb6d('0x37')](_0xb2ffba[_0xfb6d('0x33')]['fields']));_0x35d2ec[_0xfb6d('0x36')]=_0x35d2ec[_0xfb6d('0x36')][_0xfb6d('0x38')]?_0x35d2ec[_0xfb6d('0x36')]:_0x3cc6bb['model'];_0x35d2ec[_0xfb6d('0x3b')]=qs[_0xfb6d('0x3c')](_0xb2ffba[_0xfb6d('0x33')][_0xfb6d('0x3c')]);_0x35d2ec['where']=qs[_0xfb6d('0x34')](_[_0xfb6d('0x3d')](_0xb2ffba[_0xfb6d('0x33')],_0x3cc6bb[_0xfb6d('0x34')]));if(_0xb2ffba[_0xfb6d('0x33')][_0xfb6d('0x53')]){_0x35d2ec[_0xfb6d('0x3e')]=_[_0xfb6d('0x3f')](_0x35d2ec[_0xfb6d('0x3e')],{'$or':_[_0xfb6d('0x2c')](_0x35d2ec[_0xfb6d('0x36')],function(_0x262198){var _0x3fea6b={};_0x3fea6b[_0x262198]={'$like':'%'+_0xb2ffba[_0xfb6d('0x33')][_0xfb6d('0x53')]+'%'};return _0x3fea6b;})});}_0x35d2ec=_[_0xfb6d('0x3f')]({},_0x35d2ec,_0xb2ffba[_0xfb6d('0x41')]);return _0x59a24b[_0xfb6d('0x52')](_0x35d2ec);}})[_0xfb6d('0x24')](function(_0x2baa19){if(_0x2baa19){_0x143982=_0x2baa19['length'];if(!_0xb2ffba['query'][_0xfb6d('0x39')](_0xfb6d('0x3a'))){_0x35d2ec[_0xfb6d('0x1c')]=qs['limit'](_0xb2ffba[_0xfb6d('0x33')]['limit']);_0x35d2ec[_0xfb6d('0x1f')]=qs[_0xfb6d('0x1f')](_0xb2ffba[_0xfb6d('0x33')]['offset']);}return _0x59a24b['getMembers'](_0x35d2ec);}})[_0xfb6d('0x24')](function(_0x5cbefc){if(_0x5cbefc){return _0x5cbefc?{'count':_0x143982,'rows':_0x5cbefc}:null;}})['then'](respondWithResult(_0x18ce85,null))[_0xfb6d('0x45')](handleError(_0x18ce85,null));};exports[_0xfb6d('0x54')]=function(_0x586dca,_0xae69be,_0xa59944){return db[_0xfb6d('0x2d')][_0xfb6d('0x4f')]({'where':{'id':_0x586dca[_0xfb6d('0x46')]['id']}})[_0xfb6d('0x24')](handleEntityNotFound(_0xae69be,null))['then'](function(_0x40e16f){if(_0x40e16f){return _0x40e16f[_0xfb6d('0x54')](_0x586dca[_0xfb6d('0x33')][_0xfb6d('0x50')]);}})[_0xfb6d('0x24')](respondWithStatusCode(_0xae69be,null))[_0xfb6d('0x45')](handleError(_0xae69be,null));};exports[_0xfb6d('0x55')]=function(_0x59384d,_0x2cac12,_0x1336e5){if(_0x59384d['body']['id']){delete _0x59384d[_0xfb6d('0x49')]['id'];}return db[_0xfb6d('0x2d')][_0xfb6d('0x4f')]({'where':{'id':_0x59384d[_0xfb6d('0x46')]['id']}})[_0xfb6d('0x24')](handleEntityNotFound(_0x2cac12,null))[_0xfb6d('0x24')](function(_0xd665e4){if(_0xd665e4){_0x59384d[_0xfb6d('0x49')][_0xfb6d('0x56')]=_0xd665e4['id'];return db['ChatInternalMessage'][_0xfb6d('0x48')](_0x59384d[_0xfb6d('0x49')]);}})[_0xfb6d('0x24')](respondWithResult(_0x2cac12,null))[_0xfb6d('0x45')](handleError(_0x2cac12,null));};exports[_0xfb6d('0x57')]=function(_0x50d2bc,_0x47f351,_0x159640){var _0xdb519e={};var _0xeefbba={};var _0xdfa44f;var _0x2e3fd3;return db[_0xfb6d('0x2d')][_0xfb6d('0x58')]({'where':{'id':_0x50d2bc[_0xfb6d('0x46')]['id']}})[_0xfb6d('0x24')](handleEntityNotFound(_0x47f351,null))[_0xfb6d('0x24')](function(_0x1e82b3){if(_0x1e82b3){_0xdfa44f=_0x1e82b3;_0xeefbba[_0xfb6d('0x31')]=_[_0xfb6d('0x32')](db['ChatInternalMessage']['rawAttributes']);_0xeefbba['query']=_[_0xfb6d('0x32')](_0x50d2bc[_0xfb6d('0x33')]);_0xeefbba['filters']=_['intersection'](_0xeefbba['model'],_0xeefbba[_0xfb6d('0x33')]);_0xdb519e[_0xfb6d('0x36')]=_[_0xfb6d('0x35')](_0xeefbba[_0xfb6d('0x31')],qs['fields'](_0x50d2bc[_0xfb6d('0x33')][_0xfb6d('0x37')]));_0xdb519e[_0xfb6d('0x36')]=_0xdb519e[_0xfb6d('0x36')][_0xfb6d('0x38')]?_0xdb519e[_0xfb6d('0x36')]:_0xeefbba[_0xfb6d('0x31')];_0xdb519e[_0xfb6d('0x3b')]=qs['sort'](_0x50d2bc[_0xfb6d('0x33')][_0xfb6d('0x3c')]);_0xdb519e['where']=qs[_0xfb6d('0x34')](_[_0xfb6d('0x3d')](_0x50d2bc[_0xfb6d('0x33')],_0xeefbba[_0xfb6d('0x34')]));if(_0x50d2bc[_0xfb6d('0x33')][_0xfb6d('0x53')]){_0xdb519e[_0xfb6d('0x3e')]=_['merge'](_0xdb519e[_0xfb6d('0x3e')],{'$or':_['map'](_0xdb519e[_0xfb6d('0x36')],function(_0x1205ca){var _0xdb1946={};_0xdb1946[_0x1205ca]={'$like':'%'+_0x50d2bc[_0xfb6d('0x33')][_0xfb6d('0x53')]+'%'};return _0xdb1946;})});}if(_0x50d2bc[_0xfb6d('0x33')][_0xfb6d('0x59')]){var _0xf90f10=_0x50d2bc['query']['$gte'][_0xfb6d('0x5a')](',');var _0x544be3={};_0x544be3[_0xf90f10[0x0]]={'$gte':moment(_0xf90f10[0x1])['format'](_0xfb6d('0x5b'))};_0xdb519e[_0xfb6d('0x3e')]=_[_0xfb6d('0x3f')](_0xdb519e[_0xfb6d('0x3e')],_0x544be3);}_0xdb519e=_['merge']({},_0xdb519e,_0x50d2bc['options']);return _0xdfa44f['getMessages'](_0xdb519e);}})['then'](function(_0x43db9f){if(_0x43db9f){_0x2e3fd3=_0x43db9f[_0xfb6d('0x38')];if(!_0x50d2bc['query'][_0xfb6d('0x39')](_0xfb6d('0x3a'))){_0xdb519e[_0xfb6d('0x1c')]=qs['limit'](_0x50d2bc[_0xfb6d('0x33')]['limit']);_0xdb519e[_0xfb6d('0x1f')]=qs['offset'](_0x50d2bc['query']['offset']);}return _0xdfa44f[_0xfb6d('0x57')](_0xdb519e);}})[_0xfb6d('0x24')](function(_0x3c1f90){if(_0x3c1f90){return _0x3c1f90?{'count':_0x2e3fd3,'rows':_0x3c1f90}:null;}})[_0xfb6d('0x24')](respondWithResult(_0x47f351,null))['catch'](handleError(_0x47f351,null));}; \ No newline at end of file +var _0xb486=['../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','ChatGroup','rawAttributes','fieldName','type','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','find','create','body','describe','getUnread','ChatInternalMessage','addMembers','omit','getMembers','findOne','User','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util'];(function(_0x5df9ae,_0xd5d635){var _0x377c9a=function(_0x1fa5bc){while(--_0x1fa5bc){_0x5df9ae['push'](_0x5df9ae['shift']());}};_0x377c9a(++_0xd5d635);}(_0xb486,0x1b8));var _0x6b48=function(_0x2f04d1,_0x34cc49){_0x2f04d1=_0x2f04d1-0x0;var _0x1d58e5=_0xb486[_0x2f04d1];return _0x1d58e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b48('0x0'));var zipdir=require(_0x6b48('0x1'));var jsonpatch=require(_0x6b48('0x2'));var rp=require(_0x6b48('0x3'));var moment=require('moment');var BPromise=require(_0x6b48('0x4'));var Mustache=require(_0x6b48('0x5'));var util=require(_0x6b48('0x6'));var path=require(_0x6b48('0x7'));var sox=require(_0x6b48('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b48('0x9'));var _=require(_0x6b48('0xa'));var squel=require(_0x6b48('0xb'));var crypto=require('crypto');var jsforce=require(_0x6b48('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b48('0xd'));var Papa=require(_0x6b48('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6b48('0xf'));var as=require(_0x6b48('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b48('0x11'))(_0x6b48('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6b48('0x13'));var db=require(_0x6b48('0x14'))['db'];config[_0x6b48('0x15')]=_[_0x6b48('0x16')](config[_0x6b48('0x15')],{'host':_0x6b48('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b48('0x18'))[_0x6b48('0x19')](socket);function respondWithStatusCode(_0x6d4995,_0x565a7c){_0x565a7c=_0x565a7c||0xcc;return function(_0x188ba0){if(_0x188ba0){return _0x6d4995[_0x6b48('0x1a')](_0x565a7c);}return _0x6d4995[_0x6b48('0x1b')](_0x565a7c)[_0x6b48('0x1c')]();};}function respondWithResult(_0x44e9fb,_0x3422ba){_0x3422ba=_0x3422ba||0xc8;return function(_0x4485bd){if(_0x4485bd){return _0x44e9fb[_0x6b48('0x1b')](_0x3422ba)[_0x6b48('0x1d')](_0x4485bd);}};}function respondWithFilteredResult(_0x1e58b7,_0x596a08){return function(_0x427035){if(_0x427035){var _0x3fb005=typeof _0x596a08['offset']===_0x6b48('0x1e')&&typeof _0x596a08[_0x6b48('0x1f')]===_0x6b48('0x1e');var _0x2c2a51=_0x427035[_0x6b48('0x20')];var _0x21331a=_0x3fb005?0x0:_0x596a08['offset'];var _0x334966=_0x3fb005?_0x427035[_0x6b48('0x20')]:_0x596a08[_0x6b48('0x21')]+_0x596a08[_0x6b48('0x1f')];var _0x36c991;if(_0x334966>=_0x2c2a51){_0x334966=_0x2c2a51;_0x36c991=0xc8;}else{_0x36c991=0xce;}_0x1e58b7[_0x6b48('0x1b')](_0x36c991);return _0x1e58b7[_0x6b48('0x22')](_0x6b48('0x23'),_0x21331a+'-'+_0x334966+'/'+_0x2c2a51)['json'](_0x427035);}return null;};}function patchUpdates(_0x4979e0){return function(_0x5a7d0f){try{jsonpatch[_0x6b48('0x24')](_0x5a7d0f,_0x4979e0,!![]);}catch(_0x276ce4){return BPromise['reject'](_0x276ce4);}return _0x5a7d0f[_0x6b48('0x25')]();};}function saveUpdates(_0x33d67b,_0x32c29d){return function(_0x50d575){if(_0x50d575){return _0x50d575[_0x6b48('0x26')](_0x33d67b)[_0x6b48('0x27')](function(_0x2dcf92){return _0x2dcf92;});}return null;};}function removeEntity(_0x165ab4,_0x3a7496){return function(_0x77829a){if(_0x77829a){return _0x77829a[_0x6b48('0x28')]()[_0x6b48('0x27')](function(){_0x165ab4[_0x6b48('0x1b')](0xcc)[_0x6b48('0x1c')]();});}};}function handleEntityNotFound(_0x2cc718,_0x452527){return function(_0x570f24){if(!_0x570f24){_0x2cc718['sendStatus'](0x194);}return _0x570f24;};}function handleError(_0x407c55,_0x169bc2){_0x169bc2=_0x169bc2||0x1f4;return function(_0x1aabf1){logger['error'](_0x1aabf1[_0x6b48('0x29')]);if(_0x1aabf1[_0x6b48('0x2a')]){delete _0x1aabf1['name'];}_0x407c55[_0x6b48('0x1b')](_0x169bc2)[_0x6b48('0x2b')](_0x1aabf1);};}exports['index']=function(_0x5d94a0,_0x18ca90){var _0x2d9807={},_0x510f58={},_0x153f77={'count':0x0,'rows':[]};var _0xbcbc4a=_['map'](db[_0x6b48('0x2c')][_0x6b48('0x2d')],function(_0x147231){return{'name':_0x147231[_0x6b48('0x2e')],'type':_0x147231[_0x6b48('0x2f')][_0x6b48('0x30')]};});_0x510f58['model']=_[_0x6b48('0x31')](_0xbcbc4a,_0x6b48('0x2a'));_0x510f58['query']=_['keys'](_0x5d94a0[_0x6b48('0x32')]);_0x510f58['filters']=_[_0x6b48('0x33')](_0x510f58['model'],_0x510f58[_0x6b48('0x32')]);_0x2d9807[_0x6b48('0x34')]=_['intersection'](_0x510f58[_0x6b48('0x35')],qs['fields'](_0x5d94a0[_0x6b48('0x32')][_0x6b48('0x36')]));_0x2d9807[_0x6b48('0x34')]=_0x2d9807[_0x6b48('0x34')][_0x6b48('0x37')]?_0x2d9807[_0x6b48('0x34')]:_0x510f58[_0x6b48('0x35')];if(!_0x5d94a0[_0x6b48('0x32')][_0x6b48('0x38')](_0x6b48('0x39'))){_0x2d9807[_0x6b48('0x1f')]=qs[_0x6b48('0x1f')](_0x5d94a0[_0x6b48('0x32')][_0x6b48('0x1f')]);_0x2d9807[_0x6b48('0x21')]=qs[_0x6b48('0x21')](_0x5d94a0['query'][_0x6b48('0x21')]);}_0x2d9807[_0x6b48('0x3a')]=qs['sort'](_0x5d94a0['query'][_0x6b48('0x3b')]);_0x2d9807[_0x6b48('0x3c')]=qs[_0x6b48('0x3d')](_[_0x6b48('0x3e')](_0x5d94a0['query'],_0x510f58[_0x6b48('0x3d')]),_0xbcbc4a);if(_0x5d94a0[_0x6b48('0x32')]['filter']){_0x2d9807['where']=_[_0x6b48('0x3f')](_0x2d9807['where'],{'$or':_[_0x6b48('0x31')](_0xbcbc4a,function(_0x1cf487){if(_0x1cf487[_0x6b48('0x2f')]!==_0x6b48('0x40')){var _0x24cab6={};_0x24cab6[_0x1cf487[_0x6b48('0x2a')]]={'$like':'%'+_0x5d94a0[_0x6b48('0x32')][_0x6b48('0x41')]+'%'};return _0x24cab6;}})});}_0x2d9807=_['merge']({},_0x2d9807,_0x5d94a0[_0x6b48('0x42')]);var _0x413fa1={'where':_0x2d9807['where']};return db[_0x6b48('0x2c')][_0x6b48('0x20')](_0x413fa1)[_0x6b48('0x27')](function(_0xc05658){_0x153f77[_0x6b48('0x20')]=_0xc05658;if(_0x5d94a0['query'][_0x6b48('0x43')]){_0x2d9807['include']=[{'all':!![]}];}return db['ChatGroup'][_0x6b48('0x44')](_0x2d9807);})[_0x6b48('0x27')](function(_0x9426f5){_0x153f77['rows']=_0x9426f5;return _0x153f77;})[_0x6b48('0x27')](respondWithFilteredResult(_0x18ca90,_0x2d9807))[_0x6b48('0x45')](handleError(_0x18ca90,null));};exports[_0x6b48('0x46')]=function(_0x52e142,_0xb1e228){var _0x3e92f3={'raw':!![],'where':{'id':_0x52e142[_0x6b48('0x47')]['id']}},_0x3f09fe={};_0x3f09fe[_0x6b48('0x35')]=_[_0x6b48('0x48')](db[_0x6b48('0x2c')][_0x6b48('0x2d')]);_0x3f09fe['query']=_[_0x6b48('0x48')](_0x52e142[_0x6b48('0x32')]);_0x3f09fe['filters']=_[_0x6b48('0x33')](_0x3f09fe[_0x6b48('0x35')],_0x3f09fe[_0x6b48('0x32')]);_0x3e92f3[_0x6b48('0x34')]=_['intersection'](_0x3f09fe['model'],qs[_0x6b48('0x36')](_0x52e142[_0x6b48('0x32')][_0x6b48('0x36')]));_0x3e92f3[_0x6b48('0x34')]=_0x3e92f3[_0x6b48('0x34')][_0x6b48('0x37')]?_0x3e92f3[_0x6b48('0x34')]:_0x3f09fe[_0x6b48('0x35')];if(_0x52e142[_0x6b48('0x32')]['includeAll']){_0x3e92f3['include']=[{'all':!![]}];}_0x3e92f3=_['merge']({},_0x3e92f3,_0x52e142[_0x6b48('0x42')]);return db[_0x6b48('0x2c')][_0x6b48('0x49')](_0x3e92f3)[_0x6b48('0x27')](handleEntityNotFound(_0xb1e228,null))[_0x6b48('0x27')](respondWithResult(_0xb1e228,null))[_0x6b48('0x45')](handleError(_0xb1e228,null));};exports[_0x6b48('0x4a')]=function(_0x52b179,_0x5ea905){return db['ChatGroup'][_0x6b48('0x4a')](_0x52b179[_0x6b48('0x4b')],{})['then'](respondWithResult(_0x5ea905,0xc9))[_0x6b48('0x45')](handleError(_0x5ea905,null));};exports[_0x6b48('0x26')]=function(_0x34702f,_0x367f8c){if(_0x34702f['body']['id']){delete _0x34702f['body']['id'];}return db[_0x6b48('0x2c')][_0x6b48('0x49')]({'where':{'id':_0x34702f[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x367f8c,null))[_0x6b48('0x27')](saveUpdates(_0x34702f['body'],null))['then'](respondWithResult(_0x367f8c,null))[_0x6b48('0x45')](handleError(_0x367f8c,null));};exports[_0x6b48('0x28')]=function(_0x15c004,_0x5871f3){return db['ChatGroup'][_0x6b48('0x49')]({'where':{'id':_0x15c004[_0x6b48('0x47')]['id']}})['then'](handleEntityNotFound(_0x5871f3,null))['then'](removeEntity(_0x5871f3,null))[_0x6b48('0x45')](handleError(_0x5871f3,null));};exports[_0x6b48('0x4c')]=function(_0x360e6b,_0x545cf4){return db['ChatGroup'][_0x6b48('0x4c')]()['then'](respondWithResult(_0x545cf4,null))[_0x6b48('0x45')](handleError(_0x545cf4,null));};exports[_0x6b48('0x4d')]=function(_0x146814,_0x3aaaec,_0x57d7bd){return db[_0x6b48('0x4e')][_0x6b48('0x20')]({'where':{'ChatGroupId':_0x146814['params']['id'],'ToId':_0x146814['user']['id'],'read':![]}})[_0x6b48('0x27')](function(_0x50fd85){return{'id':_['toInteger'](_0x146814['params']['id']),'count':_0x50fd85};})[_0x6b48('0x27')](respondWithResult(_0x3aaaec,null))[_0x6b48('0x45')](handleError(_0x3aaaec,null));};exports['addMembers']=function(_0x2a6f50,_0x59bfe6,_0x51e0ff){return db['ChatGroup'][_0x6b48('0x49')]({'where':{'id':_0x2a6f50[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x59bfe6,null))[_0x6b48('0x27')](function(_0x24ceeb){if(_0x24ceeb){return _0x24ceeb[_0x6b48('0x4f')](_0x2a6f50[_0x6b48('0x4b')]['ids'],_[_0x6b48('0x50')](_0x2a6f50[_0x6b48('0x4b')],['ids','id'])||{});}})[_0x6b48('0x27')](respondWithResult(_0x59bfe6,null))[_0x6b48('0x45')](handleError(_0x59bfe6,null));};exports[_0x6b48('0x51')]=function(_0x3fd5fc,_0x34d1f5,_0x2fa46d){var _0x445ef6={};var _0xec1e8e={};var _0x337f60;var _0xe7563c;return db[_0x6b48('0x2c')][_0x6b48('0x52')]({'where':{'id':_0x3fd5fc[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x34d1f5,null))[_0x6b48('0x27')](function(_0x346c54){if(_0x346c54){_0x337f60=_0x346c54;_0xec1e8e[_0x6b48('0x35')]=_[_0x6b48('0x48')](db[_0x6b48('0x53')][_0x6b48('0x2d')]);_0xec1e8e[_0x6b48('0x32')]=_[_0x6b48('0x48')](_0x3fd5fc[_0x6b48('0x32')]);_0xec1e8e[_0x6b48('0x3d')]=_[_0x6b48('0x33')](_0xec1e8e[_0x6b48('0x35')],_0xec1e8e[_0x6b48('0x32')]);_0x445ef6[_0x6b48('0x34')]=_['intersection'](_0xec1e8e[_0x6b48('0x35')],qs[_0x6b48('0x36')](_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x36')]));_0x445ef6[_0x6b48('0x34')]=_0x445ef6[_0x6b48('0x34')][_0x6b48('0x37')]?_0x445ef6[_0x6b48('0x34')]:_0xec1e8e[_0x6b48('0x35')];_0x445ef6['order']=qs[_0x6b48('0x3b')](_0x3fd5fc[_0x6b48('0x32')]['sort']);_0x445ef6[_0x6b48('0x3c')]=qs[_0x6b48('0x3d')](_[_0x6b48('0x3e')](_0x3fd5fc['query'],_0xec1e8e[_0x6b48('0x3d')]));if(_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x41')]){_0x445ef6[_0x6b48('0x3c')]=_[_0x6b48('0x3f')](_0x445ef6[_0x6b48('0x3c')],{'$or':_[_0x6b48('0x31')](_0x445ef6[_0x6b48('0x34')],function(_0x1473c6){var _0x38d260={};_0x38d260[_0x1473c6]={'$like':'%'+_0x3fd5fc['query'][_0x6b48('0x41')]+'%'};return _0x38d260;})});}_0x445ef6=_[_0x6b48('0x3f')]({},_0x445ef6,_0x3fd5fc[_0x6b48('0x42')]);return _0x337f60[_0x6b48('0x51')](_0x445ef6);}})['then'](function(_0x2b0a48){if(_0x2b0a48){_0xe7563c=_0x2b0a48[_0x6b48('0x37')];if(!_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x38')]('nolimit')){_0x445ef6[_0x6b48('0x1f')]=qs['limit'](_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x1f')]);_0x445ef6['offset']=qs[_0x6b48('0x21')](_0x3fd5fc[_0x6b48('0x32')][_0x6b48('0x21')]);}return _0x337f60[_0x6b48('0x51')](_0x445ef6);}})['then'](function(_0x157c67){if(_0x157c67){return _0x157c67?{'count':_0xe7563c,'rows':_0x157c67}:null;}})['then'](respondWithResult(_0x34d1f5,null))[_0x6b48('0x45')](handleError(_0x34d1f5,null));};exports['removeMembers']=function(_0x3a1f95,_0x370e58,_0x348ad9){return db[_0x6b48('0x2c')][_0x6b48('0x49')]({'where':{'id':_0x3a1f95[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x370e58,null))['then'](function(_0x42c8ad){if(_0x42c8ad){return _0x42c8ad[_0x6b48('0x54')](_0x3a1f95[_0x6b48('0x32')][_0x6b48('0x55')]);}})[_0x6b48('0x27')](respondWithStatusCode(_0x370e58,null))[_0x6b48('0x45')](handleError(_0x370e58,null));};exports[_0x6b48('0x56')]=function(_0x2a21e5,_0x5b1865,_0x43e937){if(_0x2a21e5[_0x6b48('0x4b')]['id']){delete _0x2a21e5[_0x6b48('0x4b')]['id'];}return db[_0x6b48('0x2c')][_0x6b48('0x49')]({'where':{'id':_0x2a21e5[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x5b1865,null))[_0x6b48('0x27')](function(_0x222239){if(_0x222239){_0x2a21e5[_0x6b48('0x4b')][_0x6b48('0x57')]=_0x222239['id'];return db[_0x6b48('0x4e')]['create'](_0x2a21e5['body']);}})[_0x6b48('0x27')](respondWithResult(_0x5b1865,null))[_0x6b48('0x45')](handleError(_0x5b1865,null));};exports[_0x6b48('0x58')]=function(_0x1a4d0e,_0x52a7ac,_0x1f664e){var _0x5b807e={};var _0x174bcf={};var _0x4f5b58;var _0x45823d;return db[_0x6b48('0x2c')][_0x6b48('0x52')]({'where':{'id':_0x1a4d0e[_0x6b48('0x47')]['id']}})[_0x6b48('0x27')](handleEntityNotFound(_0x52a7ac,null))[_0x6b48('0x27')](function(_0x3eb295){if(_0x3eb295){_0x4f5b58=_0x3eb295;_0x174bcf['model']=_[_0x6b48('0x48')](db[_0x6b48('0x4e')][_0x6b48('0x2d')]);_0x174bcf[_0x6b48('0x32')]=_['keys'](_0x1a4d0e[_0x6b48('0x32')]);_0x174bcf[_0x6b48('0x3d')]=_[_0x6b48('0x33')](_0x174bcf[_0x6b48('0x35')],_0x174bcf[_0x6b48('0x32')]);_0x5b807e[_0x6b48('0x34')]=_[_0x6b48('0x33')](_0x174bcf[_0x6b48('0x35')],qs[_0x6b48('0x36')](_0x1a4d0e[_0x6b48('0x32')][_0x6b48('0x36')]));_0x5b807e[_0x6b48('0x34')]=_0x5b807e[_0x6b48('0x34')][_0x6b48('0x37')]?_0x5b807e[_0x6b48('0x34')]:_0x174bcf[_0x6b48('0x35')];_0x5b807e[_0x6b48('0x3a')]=qs[_0x6b48('0x3b')](_0x1a4d0e['query'][_0x6b48('0x3b')]);_0x5b807e['where']=qs['filters'](_[_0x6b48('0x3e')](_0x1a4d0e[_0x6b48('0x32')],_0x174bcf['filters']));if(_0x1a4d0e[_0x6b48('0x32')]['filter']){_0x5b807e['where']=_[_0x6b48('0x3f')](_0x5b807e['where'],{'$or':_['map'](_0x5b807e[_0x6b48('0x34')],function(_0x1bf60e){var _0xb01c3e={};_0xb01c3e[_0x1bf60e]={'$like':'%'+_0x1a4d0e[_0x6b48('0x32')]['filter']+'%'};return _0xb01c3e;})});}if(_0x1a4d0e[_0x6b48('0x32')][_0x6b48('0x59')]){var _0xf32d16=_0x1a4d0e['query'][_0x6b48('0x59')][_0x6b48('0x5a')](',');var _0x30bd37={};_0x30bd37[_0xf32d16[0x0]]={'$gte':moment(_0xf32d16[0x1])['format'](_0x6b48('0x5b'))};_0x5b807e[_0x6b48('0x3c')]=_[_0x6b48('0x3f')](_0x5b807e['where'],_0x30bd37);}_0x5b807e=_[_0x6b48('0x3f')]({},_0x5b807e,_0x1a4d0e[_0x6b48('0x42')]);return _0x4f5b58[_0x6b48('0x58')](_0x5b807e);}})[_0x6b48('0x27')](function(_0x5d1cc3){if(_0x5d1cc3){_0x45823d=_0x5d1cc3[_0x6b48('0x37')];if(!_0x1a4d0e[_0x6b48('0x32')][_0x6b48('0x38')]('nolimit')){_0x5b807e[_0x6b48('0x1f')]=qs[_0x6b48('0x1f')](_0x1a4d0e[_0x6b48('0x32')]['limit']);_0x5b807e[_0x6b48('0x21')]=qs[_0x6b48('0x21')](_0x1a4d0e[_0x6b48('0x32')]['offset']);}return _0x4f5b58[_0x6b48('0x58')](_0x5b807e);}})[_0x6b48('0x27')](function(_0x464a37){if(_0x464a37){return _0x464a37?{'count':_0x45823d,'rows':_0x464a37}:null;}})[_0x6b48('0x27')](respondWithResult(_0x52a7ac,null))[_0x6b48('0x45')](handleError(_0x52a7ac,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 86820a5..6f653d2 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 _0xa638=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xc6cdb6,_0x122c74){var _0x2ba737=function(_0xaddcf2){while(--_0xaddcf2){_0xc6cdb6['push'](_0xc6cdb6['shift']());}};_0x2ba737(++_0x122c74);}(_0xa638,0x7a));var _0x8a63=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa638[_0x51020b];return _0x371e47;};'use strict';var EventEmitter=require(_0x8a63('0x0'));var ChatGroup=require(_0x8a63('0x1'))['db'][_0x8a63('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8a63('0x3')](0x0);var events={'afterCreate':_0x8a63('0x4'),'afterUpdate':_0x8a63('0x5'),'afterDestroy':_0x8a63('0x6')};function emitEvent(_0x4086f6){return function(_0x12557f,_0x2175b2,_0x5d936f){ChatGroupEvents[_0x8a63('0x7')](_0x4086f6+':'+_0x12557f['id'],_0x12557f);ChatGroupEvents[_0x8a63('0x7')](_0x4086f6,_0x12557f);_0x5d936f(null);};}for(var e in events){if(events[_0x8a63('0x8')](e)){var event=events[e];ChatGroup[_0x8a63('0x9')](e,emitEvent(event));}}module[_0x8a63('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x7cd3=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x7cd3,0x181));var _0x37cd=function(_0x40a8bd,_0x580bfd){_0x40a8bd=_0x40a8bd-0x0;var _0x91a68a=_0x7cd3[_0x40a8bd];return _0x91a68a;};'use strict';var EventEmitter=require(_0x37cd('0x0'));var ChatGroup=require(_0x37cd('0x1'))['db'][_0x37cd('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x37cd('0x3')](0x0);var events={'afterCreate':_0x37cd('0x4'),'afterUpdate':_0x37cd('0x5'),'afterDestroy':_0x37cd('0x6')};function emitEvent(_0x130fa1){return function(_0x495b3d,_0x22dcb0,_0x6d77b2){ChatGroupEvents[_0x37cd('0x7')](_0x130fa1+':'+_0x495b3d['id'],_0x495b3d);ChatGroupEvents[_0x37cd('0x7')](_0x130fa1,_0x495b3d);_0x6d77b2(null);};}for(var e in events){if(events[_0x37cd('0x8')](e)){var event=events[e];ChatGroup[_0x37cd('0x9')](e,emitEvent(event));}}module[_0x37cd('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7eed575..e542a6d 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 _0x473c=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3cec45,_0x37d817){var _0x51d691=function(_0x2c671f){while(--_0x2c671f){_0x3cec45['push'](_0x3cec45['shift']());}};_0x51d691(++_0x37d817);}(_0x473c,0x156));var _0xc473=function(_0x20986c,_0x9b7784){_0x20986c=_0x20986c-0x0;var _0x26a290=_0x473c[_0x20986c];return _0x26a290;};'use strict';var _=require(_0xc473('0x0'));var util=require('util');var logger=require(_0xc473('0x1'))(_0xc473('0x2'));var moment=require(_0xc473('0x3'));var BPromise=require(_0xc473('0x4'));var rp=require(_0xc473('0x5'));var fs=require('fs');var path=require(_0xc473('0x6'));var rimraf=require(_0xc473('0x7'));var config=require(_0xc473('0x8'));var attributes=require(_0xc473('0x9'));module[_0xc473('0xa')]=function(_0x192fe8,_0x3676ae){return _0x192fe8['define']('ChatGroup',attributes,{'tableName':_0xc473('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e3d=['define','chat_groups','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x28a883,_0x34a99b){var _0x3afd5c=function(_0x28f0ba){while(--_0x28f0ba){_0x28a883['push'](_0x28a883['shift']());}};_0x3afd5c(++_0x34a99b);}(_0x8e3d,0x1f1));var _0xd8e3=function(_0x3fe2c6,_0xe0af43){_0x3fe2c6=_0x3fe2c6-0x0;var _0x3740ec=_0x8e3d[_0x3fe2c6];return _0x3740ec;};'use strict';var _=require(_0xd8e3('0x0'));var util=require(_0xd8e3('0x1'));var logger=require(_0xd8e3('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd8e3('0x3'));var fs=require('fs');var path=require(_0xd8e3('0x4'));var rimraf=require(_0xd8e3('0x5'));var config=require(_0xd8e3('0x6'));var attributes=require(_0xd8e3('0x7'));module[_0xd8e3('0x8')]=function(_0x4026c3,_0x5d7f56){return _0x4026c3[_0xd8e3('0x9')]('ChatGroup',attributes,{'tableName':_0xd8e3('0xa'),'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 6b09a3c..6da046d 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 _0xf5dc=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','moment'];(function(_0x1be57b,_0x51c1bb){var _0x4a4360=function(_0x228eff){while(--_0x228eff){_0x1be57b['push'](_0x1be57b['shift']());}};_0x4a4360(++_0x51c1bb);}(_0xf5dc,0x117));var _0xcf5d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf5dc[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcf5d('0x0'));var BPromise=require(_0xcf5d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf5d('0x2'));var db=require(_0xcf5d('0x3'))['db'];var utils=require(_0xcf5d('0x4'));var logger=require(_0xcf5d('0x5'))(_0xcf5d('0x6'));var config=require(_0xcf5d('0x7'));var jayson=require(_0xcf5d('0x8'));var client=jayson[_0xcf5d('0x9')][_0xcf5d('0xa')]({'port':0x232a});config[_0xcf5d('0xb')]=_[_0xcf5d('0xc')](config[_0xcf5d('0xb')],{'host':_0xcf5d('0xd'),'port':0x18eb});var socket=require(_0xcf5d('0xe'))(new Redis(config['redis']));require(_0xcf5d('0xf'))['register'](socket);function respondWithRpcPromise(_0x264517,_0x32f5d9,_0x4a3bf0){return new BPromise(function(_0x47d2cd,_0x2a4862){return client[_0xcf5d('0x10')](_0x264517,_0x4a3bf0)[_0xcf5d('0x11')](function(_0x532144){logger[_0xcf5d('0x12')](_0xcf5d('0x13'),_0x32f5d9,_0xcf5d('0x14'));logger[_0xcf5d('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x32f5d9,'request\x20sent',JSON[_0xcf5d('0x16')](_0x532144));if(_0x532144['error']){if(_0x532144['error'][_0xcf5d('0x17')]===0x1f4){logger[_0xcf5d('0x18')]('ChatGroup,\x20%s,\x20%s',_0x32f5d9,_0x532144[_0xcf5d('0x18')]['message']);return _0x2a4862(_0x532144['error'][_0xcf5d('0x19')]);}logger[_0xcf5d('0x18')]('ChatGroup,\x20%s,\x20%s',_0x32f5d9,_0x532144[_0xcf5d('0x18')][_0xcf5d('0x19')]);return _0x47d2cd(_0x532144['error'][_0xcf5d('0x19')]);}else{logger[_0xcf5d('0x12')]('ChatGroup,\x20%s,\x20%s',_0x32f5d9,_0xcf5d('0x14'));_0x47d2cd(_0x532144[_0xcf5d('0x1a')][_0xcf5d('0x19')]);}})[_0xcf5d('0x1b')](function(_0x6e5bfa){logger[_0xcf5d('0x18')](_0xcf5d('0x13'),_0x32f5d9,_0x6e5bfa);_0x2a4862(_0x6e5bfa);});});} \ No newline at end of file +var _0x5075=['request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','register'];(function(_0x3771f7,_0xe7929b){var _0x58b25e=function(_0x13dfd7){while(--_0x13dfd7){_0x3771f7['push'](_0x3771f7['shift']());}};_0x58b25e(++_0xe7929b);}(_0x5075,0x73));var _0x5507=function(_0x484bf4,_0x2b975c){_0x484bf4=_0x484bf4-0x0;var _0x31c683=_0x5075[_0x484bf4];return _0x31c683;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var moment=require(_0x5507('0x2'));var BPromise=require(_0x5507('0x3'));var rs=require(_0x5507('0x4'));var fs=require('fs');var Redis=require(_0x5507('0x5'));var db=require(_0x5507('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5507('0x7'))(_0x5507('0x8'));var config=require(_0x5507('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5507('0xa')]({'port':0x232a});config[_0x5507('0xb')]=_['defaults'](config[_0x5507('0xb')],{'host':_0x5507('0xc'),'port':0x18eb});var socket=require(_0x5507('0xd'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x5507('0xe')](socket);function respondWithRpcPromise(_0x441bdc,_0xbbb0fc,_0x36c9eb){return new BPromise(function(_0x50d6f5,_0x29be85){return client[_0x5507('0xf')](_0x441bdc,_0x36c9eb)['then'](function(_0x18601c){logger[_0x5507('0x10')]('ChatGroup,\x20%s,\x20%s',_0xbbb0fc,_0x5507('0x11'));logger[_0x5507('0x12')](_0x5507('0x13'),_0xbbb0fc,_0x5507('0x11'),JSON[_0x5507('0x14')](_0x18601c));if(_0x18601c[_0x5507('0x15')]){if(_0x18601c['error'][_0x5507('0x16')]===0x1f4){logger[_0x5507('0x15')](_0x5507('0x17'),_0xbbb0fc,_0x18601c[_0x5507('0x15')]['message']);return _0x29be85(_0x18601c[_0x5507('0x15')][_0x5507('0x18')]);}logger[_0x5507('0x15')](_0x5507('0x17'),_0xbbb0fc,_0x18601c[_0x5507('0x15')][_0x5507('0x18')]);return _0x50d6f5(_0x18601c[_0x5507('0x15')][_0x5507('0x18')]);}else{logger[_0x5507('0x10')](_0x5507('0x17'),_0xbbb0fc,_0x5507('0x11'));_0x50d6f5(_0x18601c[_0x5507('0x19')][_0x5507('0x18')]);}})['catch'](function(_0x14dab0){logger[_0x5507('0x15')](_0x5507('0x17'),_0xbbb0fc,_0x14dab0);_0x29be85(_0x14dab0);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 42c9a47..33a956a 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 _0x83b7=['chatGroup:','./chatGroup.events','update','emit','removeListener','register'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x83b7,0x7f));var _0x783b=function(_0x3145e2,_0x1287c3){_0x3145e2=_0x3145e2-0x0;var _0x3e7853=_0x83b7[_0x3145e2];return _0x3e7853;};'use strict';var ChatGroupEvents=require(_0x783b('0x0'));var events=['save','remove',_0x783b('0x1')];function createListener(_0x3e1956,_0x16f1e8){return function(_0x2c61df){_0x16f1e8[_0x783b('0x2')](_0x3e1956,_0x2c61df);};}function removeListener(_0x2e5c3b,_0xddc9df){return function(){ChatGroupEvents[_0x783b('0x3')](_0x2e5c3b,_0xddc9df);};}exports[_0x783b('0x4')]=function(_0x1c37d8){for(var _0x1b6265=0x0,_0x22997f=events['length'];_0x1b6265<_0x22997f;_0x1b6265++){var _0x567788=events[_0x1b6265];var _0x2f07fb=createListener(_0x783b('0x5')+_0x567788,_0x1c37d8);ChatGroupEvents['on'](_0x567788,_0x2f07fb);}}; \ No newline at end of file +var _0xa6e6=['removeListener','register','length','chatGroup:','save','remove'];(function(_0x1e0791,_0x5d0255){var _0x57e691=function(_0x4c9bdf){while(--_0x4c9bdf){_0x1e0791['push'](_0x1e0791['shift']());}};_0x57e691(++_0x5d0255);}(_0xa6e6,0x178));var _0x6a6e=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xa6e6[_0x1e172a];return _0x96338b;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x6a6e('0x0'),_0x6a6e('0x1'),'update'];function createListener(_0x173fce,_0x52725f){return function(_0x5ec51b){_0x52725f['emit'](_0x173fce,_0x5ec51b);};}function removeListener(_0xbb98bb,_0x27c1ad){return function(){ChatGroupEvents[_0x6a6e('0x2')](_0xbb98bb,_0x27c1ad);};}exports[_0x6a6e('0x3')]=function(_0x34de50){for(var _0x179f83=0x0,_0x5b6690=events[_0x6a6e('0x4')];_0x179f83<_0x5b6690;_0x179f83++){var _0x113106=events[_0x179f83];var _0x34bed1=createListener(_0x6a6e('0x5')+_0x113106,_0x34de50);ChatGroupEvents['on'](_0x113106,_0x34bed1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3db11c3..5e25a30 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 _0x2c29=['multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getUnread','/:id/members','getMembers','getMessages','post','create','/:id/messages','addMessage','put','update','delete','removeMembers','exports'];(function(_0x8f5d6b,_0x3e211c){var _0xcfacc6=function(_0x5a8c44){while(--_0x5a8c44){_0x8f5d6b['push'](_0x8f5d6b['shift']());}};_0xcfacc6(++_0x3e211c);}(_0x2c29,0xb6));var _0x92c2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2c29[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x92c2('0x0'));var util=require(_0x92c2('0x1'));var path=require(_0x92c2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x92c2('0x3'));var auth=require(_0x92c2('0x4'));var interaction=require(_0x92c2('0x5'));var config=require(_0x92c2('0x6'));var controller=require('./chatGroup.controller');router[_0x92c2('0x7')]('/',auth[_0x92c2('0x8')](),controller[_0x92c2('0x9')]);router[_0x92c2('0x7')](_0x92c2('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x92c2('0x7')](_0x92c2('0xb'),auth[_0x92c2('0x8')](),controller[_0x92c2('0xc')]);router[_0x92c2('0x7')]('/:id/unread',auth[_0x92c2('0x8')](),controller[_0x92c2('0xd')]);router[_0x92c2('0x7')](_0x92c2('0xe'),auth[_0x92c2('0x8')](),controller[_0x92c2('0xf')]);router[_0x92c2('0x7')]('/:id/messages',auth[_0x92c2('0x8')](),controller[_0x92c2('0x10')]);router[_0x92c2('0x11')]('/',auth[_0x92c2('0x8')](),controller[_0x92c2('0x12')]);router[_0x92c2('0x11')](_0x92c2('0xe'),auth[_0x92c2('0x8')](),controller['addMembers']);router[_0x92c2('0x11')](_0x92c2('0x13'),auth[_0x92c2('0x8')](),controller[_0x92c2('0x14')]);router[_0x92c2('0x15')](_0x92c2('0xb'),auth[_0x92c2('0x8')](),controller[_0x92c2('0x16')]);router[_0x92c2('0x17')](_0x92c2('0xb'),auth[_0x92c2('0x8')](),controller['destroy']);router[_0x92c2('0x17')](_0x92c2('0xe'),auth[_0x92c2('0x8')](),controller[_0x92c2('0x18')]);module[_0x92c2('0x19')]=router; \ No newline at end of file +var _0xb81a=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','destroy','delete','removeMembers'];(function(_0x1894b3,_0x3442a3){var _0x55c05d=function(_0x308eea){while(--_0x308eea){_0x1894b3['push'](_0x1894b3['shift']());}};_0x55c05d(++_0x3442a3);}(_0xb81a,0x140));var _0xab81=function(_0xb4db3c,_0x158e33){_0xb4db3c=_0xb4db3c-0x0;var _0x500d97=_0xb81a[_0xb4db3c];return _0x500d97;};'use strict';var multer=require(_0xab81('0x0'));var util=require(_0xab81('0x1'));var path=require(_0xab81('0x2'));var timeout=require(_0xab81('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xab81('0x4'));var auth=require(_0xab81('0x5'));var interaction=require(_0xab81('0x6'));var config=require(_0xab81('0x7'));var controller=require('./chatGroup.controller');router[_0xab81('0x8')]('/',auth[_0xab81('0x9')](),controller[_0xab81('0xa')]);router[_0xab81('0x8')](_0xab81('0xb'),auth[_0xab81('0x9')](),controller[_0xab81('0xc')]);router[_0xab81('0x8')](_0xab81('0xd'),auth[_0xab81('0x9')](),controller[_0xab81('0xe')]);router[_0xab81('0x8')](_0xab81('0xf'),auth[_0xab81('0x9')](),controller[_0xab81('0x10')]);router['get'](_0xab81('0x11'),auth[_0xab81('0x9')](),controller[_0xab81('0x12')]);router[_0xab81('0x8')](_0xab81('0x13'),auth[_0xab81('0x9')](),controller[_0xab81('0x14')]);router[_0xab81('0x15')]('/',auth[_0xab81('0x9')](),controller['create']);router[_0xab81('0x15')](_0xab81('0x11'),auth['isAuthenticated'](),controller[_0xab81('0x16')]);router[_0xab81('0x15')](_0xab81('0x13'),auth[_0xab81('0x9')](),controller[_0xab81('0x17')]);router['put'](_0xab81('0xd'),auth[_0xab81('0x9')](),controller[_0xab81('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xab81('0x19')]);router[_0xab81('0x1a')]('/:id/members',auth['isAuthenticated'](),controller[_0xab81('0x1b')]);module[_0xab81('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 88ebb17..3aec8c2 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 _0x26f9=['DATE','long','ENUM','BOOLEAN','sequelize','exports','INTEGER','thumb','star','TEXT','STRING'];(function(_0x8ea67b,_0x4959b0){var _0x141278=function(_0x4b4f06){while(--_0x4b4f06){_0x8ea67b['push'](_0x8ea67b['shift']());}};_0x141278(++_0x4959b0);}(_0x26f9,0x16f));var _0x926f=function(_0x245307,_0x12cbb9){_0x245307=_0x245307-0x0;var _0x4cf712=_0x26f9[_0x245307];return _0x4cf712;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x926f('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x926f('0x3')),'defaultValue':_0x926f('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x926f('0x5')]},'mailTranscript':{'type':Sequelize[_0x926f('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x926f('0x7')]},'disposition':{'type':Sequelize[_0x926f('0x6')]},'secondDisposition':{'type':Sequelize[_0x926f('0x6')]},'thirdDisposition':{'type':Sequelize[_0x926f('0x6')]},'note':{'type':Sequelize[_0x926f('0x6')]},'browserName':{'type':Sequelize[_0x926f('0x6')]},'browserVersion':{'type':Sequelize[_0x926f('0x6')]},'osName':{'type':Sequelize[_0x926f('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x926f('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x926f('0x6')]},'referer':{'type':Sequelize[_0x926f('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x926f('0x5')](_0x926f('0x8'))},'read1stAt':{'type':Sequelize[_0x926f('0x7')]},'lastMsgAt':{'type':Sequelize[_0x926f('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x926f('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x926f('0x6')]},'customerPort':{'type':Sequelize[_0x926f('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x926f('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x926f('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x93e6=['INTEGER','star','TEXT','DATE','STRING','out','sequelize'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x93e6,0x11e));var _0x693e=function(_0x3b375e,_0x565734){_0x3b375e=_0x3b375e-0x0;var _0x55419f=_0x93e6[_0x3b375e];return _0x55419f;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x693e('0x1')]},'ratingType':{'type':Sequelize['ENUM'](_0x693e('0x2'),'thumb'),'defaultValue':_0x693e('0x2')},'ratingMessage':{'type':Sequelize[_0x693e('0x3')]},'pathTranscript':{'type':Sequelize[_0x693e('0x3')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x693e('0x4')]},'disposition':{'type':Sequelize[_0x693e('0x5')]},'secondDisposition':{'type':Sequelize[_0x693e('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x693e('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x693e('0x5')]},'deviceModel':{'type':Sequelize[_0x693e('0x5')]},'deviceVendor':{'type':Sequelize[_0x693e('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x693e('0x3')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x693e('0x3')]('long')},'read1stAt':{'type':Sequelize[_0x693e('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x693e('0x6')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x693e('0x5')]},'customerPort':{'type':Sequelize[_0x693e('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x693e('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 26222eb..9290133 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 _0xbaf0=['../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','rawAttributes','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','POST','isNull','vidaooNote','follow','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','originalname','basename','filename','mimetype','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','pathTranscript','ChatMessage','Messages','User','%s%d','agentAlias','System','customer','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','findAll','getMyMessages','includeAgent','addTags','setTags','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','attachments','firstName','lastName','Attachment','Owner','get','mkdirSync','Chat','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1f9afa,_0xb51acb){var _0x3081d9=function(_0x575265){while(--_0x575265){_0x1f9afa['push'](_0x1f9afa['shift']());}};_0x3081d9(++_0xb51acb);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var pdf=require(_0x0baf('0x16'));var hardwareService=require(_0x0baf('0x17'));var logger=require(_0x0baf('0x18'))(_0x0baf('0x19'));var utils=require(_0x0baf('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0baf('0x1b'))['db'];config[_0x0baf('0x1c')]=_[_0x0baf('0x1d')](config[_0x0baf('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0x1e'))(new Redis(config['redis']));require(_0x0baf('0x1f'))[_0x0baf('0x20')](socket);var jayson=require(_0x0baf('0x21'));var client=jayson[_0x0baf('0x22')][_0x0baf('0x23')]({'port':0x232b});var client9004=jayson[_0x0baf('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4cd79d,_0x2312c7,_0x38395b,_0x283408){return new BPromise(function(_0x3d83a3,_0x2cf7da){var _0x288a98=_0x283408||client;return _0x288a98['request'](_0x4cd79d,_0x38395b)[_0x0baf('0x24')](function(_0xfbecec){logger[_0x0baf('0x25')](_0x0baf('0x26'),_0x2312c7,_0x0baf('0x27'));logger[_0x0baf('0x28')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2312c7,'request\x20sent',JSON[_0x0baf('0x29')](_0xfbecec));if(_0xfbecec[_0x0baf('0x2a')]){if(_0xfbecec[_0x0baf('0x2a')][_0x0baf('0x2b')]===0x1f4){logger[_0x0baf('0x2a')](_0x0baf('0x26'),_0x2312c7,_0xfbecec[_0x0baf('0x2a')][_0x0baf('0x2c')]);return _0x2cf7da(_0xfbecec[_0x0baf('0x2a')][_0x0baf('0x2c')]);}logger['error'](_0x0baf('0x26'),_0x2312c7,_0xfbecec['error'][_0x0baf('0x2c')]);return _0x3d83a3(_0xfbecec['error']['message']);}else{logger[_0x0baf('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x2312c7,'request\x20sent');_0x3d83a3(_0xfbecec[_0x0baf('0x2d')][_0x0baf('0x2c')]);}})[_0x0baf('0x2e')](function(_0x19d9fd){logger[_0x0baf('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x2312c7,_0x19d9fd);_0x2cf7da(_0x19d9fd);});});}function respondWithStatusCode(_0x448617,_0x4681c5){_0x4681c5=_0x4681c5||0xcc;return function(_0x1ca35a){if(_0x1ca35a){return _0x448617[_0x0baf('0x2f')](_0x4681c5);}return _0x448617[_0x0baf('0x30')](_0x4681c5)[_0x0baf('0x31')]();};}function respondWithResult(_0x453525,_0x549fd0){_0x549fd0=_0x549fd0||0xc8;return function(_0x1590b4){if(_0x1590b4){return _0x453525[_0x0baf('0x30')](_0x549fd0)[_0x0baf('0x32')](_0x1590b4);}};}function respondWithFilteredResult(_0x265915,_0x55c715){return function(_0x29dbdf){if(_0x29dbdf){var _0x34a58a=typeof _0x55c715['offset']===_0x0baf('0x33')&&typeof _0x55c715[_0x0baf('0x34')]===_0x0baf('0x33');var _0xb4dbb1=_0x29dbdf[_0x0baf('0x35')];var _0x366924=_0x34a58a?0x0:_0x55c715[_0x0baf('0x36')];var _0x57476f=_0x34a58a?_0x29dbdf[_0x0baf('0x35')]:_0x55c715[_0x0baf('0x36')]+_0x55c715[_0x0baf('0x34')];var _0x3ed995;if(_0x57476f>=_0xb4dbb1){_0x57476f=_0xb4dbb1;_0x3ed995=0xc8;}else{_0x3ed995=0xce;}_0x265915[_0x0baf('0x30')](_0x3ed995);return _0x265915[_0x0baf('0x37')](_0x0baf('0x38'),_0x366924+'-'+_0x57476f+'/'+_0xb4dbb1)[_0x0baf('0x32')](_0x29dbdf);}return null;};}function patchUpdates(_0x59431b){return function(_0x3ded64){try{jsonpatch[_0x0baf('0x39')](_0x3ded64,_0x59431b,!![]);}catch(_0x165d14){return BPromise[_0x0baf('0x3a')](_0x165d14);}return _0x3ded64[_0x0baf('0x3b')]();};}function saveUpdates(_0x57a6bb,_0x2fd426){return function(_0x53ae1d){if(_0x53ae1d){return _0x53ae1d[_0x0baf('0x3c')](_0x57a6bb)[_0x0baf('0x24')](function(_0x35e534){return _0x35e534;});}return null;};}function removeEntity(_0x3d65f2,_0x5300a5){return function(_0x1a2b03){if(_0x1a2b03){return _0x1a2b03[_0x0baf('0x3d')]()['then'](function(){_0x3d65f2[_0x0baf('0x30')](0xcc)[_0x0baf('0x31')]();});}};}function handleEntityNotFound(_0x62a2ed,_0xbaa9a7){return function(_0x1f60bd){if(!_0x1f60bd){_0x62a2ed[_0x0baf('0x2f')](0x194);}return _0x1f60bd;};}function handleError(_0xe03d82,_0x675461){_0x675461=_0x675461||0x1f4;return function(_0x4aa6ed){logger[_0x0baf('0x2a')](_0x4aa6ed[_0x0baf('0x3e')]);if(_0x4aa6ed['name']){delete _0x4aa6ed[_0x0baf('0x3f')];}_0xe03d82['status'](_0x675461)['send'](_0x4aa6ed);};}function getMustacheRender(_0x11bc49,_0x81af83){return Mustache['render'](_0x11bc49,_['merge'](_0x81af83[_0x0baf('0x40')],{'contact':_0x81af83[_0x0baf('0x41')],'message':_0x81af83[_0x0baf('0x2c')],'agent':_0x81af83[_0x0baf('0x42')],'interaction':_0x81af83[_0x0baf('0x43')],'account':_0x81af83[_0x0baf('0x44')]}))||'';}function getInteractionUsers(_0x290464,_0x37c038){return new BPromise(function(_0x631f74,_0x36c6d2){try{if(_0x37c038[_0x290464['id']]){_0x290464[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x37c038[_0x290464['id']],function(_0x354cb1){return{'id':_0x354cb1['id'],'fullname':_0x354cb1[_0x0baf('0x47')]};});}}catch(_0x53d6b7){_0x36c6d2(_0x53d6b7);}_0x631f74(_0x290464);});}function getInteractionTags(_0x3573ce,_0x1435d5){return new BPromise(function(_0x4f1de9,_0x38006a){try{if(_0x3573ce[_0x0baf('0x48')]){_0x3573ce[_0x0baf('0x49')]=[];_0x3573ce[_0x0baf('0x48')][_0x0baf('0x4a')](',')[_0x0baf('0x4b')](function(_0x57b581){_0x3573ce[_0x0baf('0x49')][_0x0baf('0x4c')](_0x1435d5[_0x57b581]);});}delete _0x3573ce['TagIds'];}catch(_0x35d442){_0x38006a(_0x35d442);}_0x4f1de9(_0x3573ce);});}function updateChatInteraction(_0x412e6f,_0x45c6aa,_0x57903e){return new BPromise(function(_0x504031,_0x193fd3){return getInteractionUsers(_0x412e6f,_0x57903e)[_0x0baf('0x24')](function(_0x301412){return getInteractionTags(_0x301412,_0x45c6aa);})[_0x0baf('0x24')](function(_0x2b6d54){_0x504031(_0x2b6d54);})[_0x0baf('0x2e')](function(_0x33da34){_0x193fd3(_0x33da34);});});}exports[_0x0baf('0x4d')]=function(_0xce1bf0,_0x355033){var _0x56270e={},_0x2a2a7c={},_0x2bc755={'count':0x0,'rows':[]};var _0x1daf1d=_[_0x0baf('0x46')](db[_0x0baf('0x4e')]['rawAttributes'],function(_0x1e7364){return{'name':_0x1e7364[_0x0baf('0x4f')],'type':_0x1e7364[_0x0baf('0x50')][_0x0baf('0x51')]};});_0x2a2a7c[_0x0baf('0x52')]=_['map'](_0x1daf1d,_0x0baf('0x3f'));_0x2a2a7c[_0x0baf('0x53')]=_[_0x0baf('0x54')](_0xce1bf0[_0x0baf('0x53')]);_0x2a2a7c[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0x2a2a7c[_0x0baf('0x52')],_0x2a2a7c['query']);_0x56270e[_0x0baf('0x57')]=_[_0x0baf('0x56')](_0x2a2a7c[_0x0baf('0x52')],qs['fields'](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x58')]));_0x56270e[_0x0baf('0x57')]=_0x56270e[_0x0baf('0x57')][_0x0baf('0x59')]?_0x56270e[_0x0baf('0x57')]:_0x2a2a7c[_0x0baf('0x52')];if(!_0xce1bf0['query'][_0x0baf('0x5a')](_0x0baf('0x5b'))){_0x56270e[_0x0baf('0x34')]=qs[_0x0baf('0x34')](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x34')]);_0x56270e[_0x0baf('0x36')]=qs[_0x0baf('0x36')](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x36')]);}_0x56270e[_0x0baf('0x5c')]=qs['sort'](_0xce1bf0['query'][_0x0baf('0x5d')]);_0x56270e[_0x0baf('0x5e')]=qs[_0x0baf('0x55')](_[_0x0baf('0x5f')](_0xce1bf0[_0x0baf('0x53')],_0x2a2a7c[_0x0baf('0x55')]),_0x1daf1d);var _0x3403d5=[];var _0x4b492c=squel[_0x0baf('0x60')]()[_0x0baf('0x61')]('id')[_0x0baf('0x61')](_0x0baf('0x3f'))[_0x0baf('0x61')](_0x0baf('0x62'))['from'](_0x0baf('0x63'));var _0x5f123c=squel[_0x0baf('0x60')]()['field'](_0x0baf('0x64'))['field'](_0x0baf('0x65'))['field'](_0x0baf('0x66'))[_0x0baf('0x67')](_0x0baf('0x68'),'ui')[_0x0baf('0x69')](_0x0baf('0x6a'),'u','u.id\x20=\x20ui.UserId');var _0x21f179=squel[_0x0baf('0x60')]()[_0x0baf('0x67')](_0x0baf('0x6b'),'i')[_0x0baf('0x69')](_0x0baf('0x6c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0baf('0x69')](_0x0baf('0x6a'),'o',_0x0baf('0x6d'))[_0x0baf('0x69')](_0x0baf('0x6e'),'a',_0x0baf('0x6f'))[_0x0baf('0x69')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x0baf('0x69')](_0x0baf('0x70'),'it',_0x0baf('0x71'))[_0x0baf('0x69')](_0x0baf('0x63'),'t',_0x0baf('0x72'));var _0xaa4293=squel[_0x0baf('0x73')]();var _0x3d9a32=[];var _0x585969=squel[_0x0baf('0x73')]();var _0x268be8;if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x74')]){_0x268be8=as[_0x0baf('0x75')](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x74')]);var _0x51d75f=_0x268be8[_0x0baf('0x76')];for(var _0x27f580=0x0;_0x27f580<_0x268be8[_0x0baf('0x77')][_0x0baf('0x59')];_0x27f580++){var _0x1c7d88=_0x268be8[_0x0baf('0x77')][_0x27f580];var _0x14e6d0='i';var _0x12543e=_['find'](_0x1daf1d,[_0x0baf('0x3f'),_0x1c7d88['field']]);if(!_0x12543e){switch(_0x1c7d88[_0x0baf('0x61')]){case'unreadMessages':if(_0x1c7d88['value']==0x1){_0x21f179[_0x0baf('0x78')]('`'+_0x1c7d88['field']+_0x0baf('0x79'));}else{_0x21f179[_0x0baf('0x78')]('`'+_0x1c7d88['field']+_0x0baf('0x7a'));}break;case _0x0baf('0x7b'):if(_0x1c7d88[_0x0baf('0x7c')]==='$substring'){if(_0x1c7d88['value'][_0x0baf('0x4a')]('\x20')[_0x0baf('0x59')]>0x1){_0xaa4293[_0x51d75f](_0x0baf('0x7d'),qs[_0x0baf('0x7e')](_0x1c7d88[_0x0baf('0x7f')]),null);}else{var _0x588b88='%'+_0x1c7d88[_0x0baf('0x7f')]+'%';_0xaa4293[_0x51d75f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x588b88,_0x588b88,_0x588b88);}}else{_0x12543e=_['find'](_0x1daf1d,['name',_0x0baf('0x80')]);_0x1c7d88['field']='ContactId';_0xf45ec3=as[_0x0baf('0x81')](_0x14e6d0,_0x12543e[_0x0baf('0x50')],_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')]['end']);}break;case _0x0baf('0x84'):var _0x1a0a67=_0x1c7d88[_0x0baf('0x7f')][_0x0baf('0x4a')](',')[_0x0baf('0x46')](function(_0x1273f4){return Number(_0x1273f4);});_0x1a0a67['forEach'](function(_0x42e8ad){_0x585969['or'](_0x0baf('0x85'),'%,'+_0x42e8ad+',%');});_0x3d9a32=_[_0x0baf('0x86')](_0x3d9a32,_0x1a0a67);break;case'User':if(_0x1c7d88[_0x0baf('0x7c')]===_0x0baf('0x87')){_0xaa4293[_0x51d75f](_0x0baf('0x88'),'%'+_0x1c7d88[_0x0baf('0x7f')]+'%',null);}else{_0x12543e=_[_0x0baf('0x89')](_0x1daf1d,[_0x0baf('0x3f'),_0x0baf('0x8a')]);_0x1c7d88['field']='UserId';_0xf45ec3=as['buildExpression'](_0x14e6d0,_0x12543e[_0x0baf('0x50')],_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x31')]);}break;case'body':_0xf45ec3=as['buildExpression']('me',null,_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3['value'][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')]['end']);break;}}else{var _0xf45ec3=as[_0x0baf('0x81')](_0x14e6d0,_0x12543e[_0x0baf('0x50')],_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x31')]);}}}else{var _0xfcc697=_(_0xce1bf0['query'])['keys']()['map'](function(_0x493784){return _['some'](_0x1daf1d,[_0x0baf('0x3f'),_0x493784])?_0x493784:undefined;})[_0x0baf('0x8b')]()[_0x0baf('0x7f')]();if(!_[_0x0baf('0x8c')](_0xfcc697)){_0xfcc697['forEach'](function(_0x1be7f2){if(_0x1be7f2===_0x0baf('0x8d')){_0x21f179['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x0baf('0x8e')](_0xce1bf0[_0x0baf('0x53')][_0x1be7f2]));}else if(_0x1be7f2===_0x0baf('0x8f')){var _0x442e5f=JSON[_0x0baf('0x90')](_0xce1bf0[_0x0baf('0x53')][_0x1be7f2])[_0x0baf('0x91')];var _0x399f40=JSON['parse'](_0xce1bf0[_0x0baf('0x53')][_0x1be7f2])[_0x0baf('0x92')];_0x21f179['where'](_0x0baf('0x93'),_0x442e5f,_0x399f40);}else{if(_0xce1bf0[_0x0baf('0x53')][_0x1be7f2]==='null'){_0x21f179[_0x0baf('0x5e')]('i.'+_0x1be7f2+_0x0baf('0x94'));}else{_0x21f179[_0x0baf('0x5e')]('i.'+_0x1be7f2+_0x0baf('0x95'),_0xce1bf0[_0x0baf('0x53')][_0x1be7f2]);}}});}if(_0xce1bf0['query']['read']){if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x96')]==0x1){_0x21f179['having'](_0x0baf('0x97'));}else{_0x21f179[_0x0baf('0x78')](_0x0baf('0x98'));}}if(_0xce1bf0['query'][_0x0baf('0x99')]){_0x3d9a32=_[_0x0baf('0x9a')](_0xce1bf0[_0x0baf('0x53')]['tag'])?_0xce1bf0[_0x0baf('0x53')]['tag']:new Array(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x99')]);_0x3d9a32[_0x0baf('0x4b')](function(_0x2f009f){_0x585969['or'](_0x0baf('0x85'),'%,'+_0x2f009f+',%');});}if(_0xce1bf0['query'][_0x0baf('0x9b')]){var _0x57f33c=_0xce1bf0['query'][_0x0baf('0x9b')][_0x0baf('0x9c')]('\x5c','\x5c\x5c')[_0x0baf('0x9c')](/'/g,'\x27\x27');if(qs[_0x0baf('0x9d')](_0x57f33c)){_0xaa4293['or'](_0x0baf('0x9e'),_0x57f33c+'%');}else{_0xaa4293['or'](_0x0baf('0x9f'),qs[_0x0baf('0x7e')](_0x57f33c))['or'](_0x0baf('0xa0'),_0x57f33c+'%');}}}_0x21f179[_0x0baf('0x5e')](_0xaa4293);_0x21f179[_0x0baf('0xa1')](_0x0baf('0xa2'));var _0x2c2f09={'type':db['Sequelize']['QueryTypes'][_0x0baf('0xa3')],'raw':!![]};var _0x322a09=_0x21f179[_0x0baf('0xa4')]();_0x322a09['field']('i.id');_0x322a09[_0x0baf('0x61')](_0x0baf('0xa5'),_0x0baf('0xa6'));if(_0x56270e[_0x0baf('0x5c')]){_0x56270e[_0x0baf('0x5c')][_0x0baf('0x4b')](function(_0x191d35){var _0xa2d315=_0x191d35[0x0]===_0x0baf('0xa7')?_0x191d35[0x0]:'i.'+_0x191d35[0x0];_0x21f179['order'](_0xa2d315,_0x191d35[0x1]===_0x0baf('0xa8')?![]:!![]);});}if(!_[_0x0baf('0x8c')](_0x3d9a32)){_0x21f179[_0x0baf('0x78')](_0x585969);_0x322a09[_0x0baf('0x5e')]('t.id\x20IN\x20?',_0x3d9a32);}BPromise['resolve']()['then'](function(){if(!_0x268be8){if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x8d')])return;_0x322a09['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x21f179[_0x0baf('0x5e')](_0x0baf('0xa9'));return;}if(_0xce1bf0['user'][_0x0baf('0xaa')]!==_0x0baf('0x42'))return;return _0xce1bf0[_0x0baf('0xab')][_0x0baf('0xac')]({'attributes':['id'],'raw':!![]})[_0x0baf('0x24')](function(_0x25081e){if(_[_0x0baf('0x8c')](_0x25081e)){_0x322a09[_0x0baf('0x5e')](_0x0baf('0xad'));_0x21f179[_0x0baf('0x5e')](_0x0baf('0xad'));}else{_0x322a09[_0x0baf('0x5e')]('i.ChatWebsiteId\x20IN\x20?',_[_0x0baf('0x46')](_0x25081e,'id'));_0x21f179[_0x0baf('0x5e')](_0x0baf('0xae'),_[_0x0baf('0x46')](_0x25081e,'id'));}});})[_0x0baf('0x24')](function(){if(_0xce1bf0[_0x0baf('0xab')]['role']===_0x0baf('0x42')&&!_0x268be8&&!_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x8d')])return[];return db[_0x0baf('0xaf')][_0x0baf('0x53')](_0x322a09['toString'](),_0x2c2f09);})[_0x0baf('0x24')](function(_0x30eac8){_0x2bc755[_0x0baf('0x35')]=_0x30eac8[_0x0baf('0x59')];if(_0x2bc755[_0x0baf('0x35')]===0x0)return[];return db['sequelize']['query'](_0x4b492c[_0x0baf('0xb0')](),_0x2c2f09)['then'](function(_0x477cd5){_0x3403d5=_['keyBy'](_0x477cd5,'id');_0x2c2f09=_[_0x0baf('0xb1')](_0x2c2f09,{'model':db[_0x0baf('0x4e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x58')]){_0x56270e['attributes'][_0x0baf('0x4b')](function(_0x106ffa){_0x21f179[_0x0baf('0x61')]('i.'+_0x106ffa);});}else{_0x21f179['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x21f179['field'](_0x0baf('0xb2'),_0x0baf('0xb3'));_0x21f179[_0x0baf('0x61')](_0x0baf('0xb4'),'Account.mandatoryDisposition');_0x21f179[_0x0baf('0x61')](_0x0baf('0xb5'),_0x0baf('0xa7'));_0x21f179['field'](_0x0baf('0xb6'));_0x21f179[_0x0baf('0x61')]('c.firstName',_0x0baf('0xb7'));_0x21f179['field'](_0x0baf('0xb8'),_0x0baf('0xb9'));_0x21f179[_0x0baf('0x61')](_0x0baf('0xba'),'Contact.email');_0x21f179['field'](_0x0baf('0xbb'),'Contact.phone');_0x21f179[_0x0baf('0x61')](_0x0baf('0xbc'),_0x0baf('0xbd'));_0x21f179[_0x0baf('0x61')](_0x0baf('0xbe'),'Contact.fax');_0x21f179[_0x0baf('0x61')]('o.fullname',_0x0baf('0xbf'));_0x21f179['field'](_0x0baf('0xc0'),'Owner.internal');_0x21f179[_0x0baf('0x61')](_0x0baf('0xc1'),_0x0baf('0x48'));}if(_0x56270e['limit'])_0x21f179['limit'](_0x56270e[_0x0baf('0x34')]);if(_0x56270e[_0x0baf('0x36')])_0x21f179[_0x0baf('0x36')](_0x56270e[_0x0baf('0x36')]);return db[_0x0baf('0xaf')][_0x0baf('0x53')](_0x21f179['toString'](),_0x2c2f09);})[_0x0baf('0x24')](function(_0x5ee37f){if(_0x5ee37f[_0x0baf('0x59')]>0x0)_0x5f123c['where'](_0x0baf('0xc2'),_[_0x0baf('0x46')](_0x5ee37f,'id'));return db[_0x0baf('0xaf')]['query'](_0x5f123c[_0x0baf('0xb0')](),_0x2c2f09)[_0x0baf('0x24')](function(_0x4879b4){var _0x544498=_[_0x0baf('0xc3')](_0x4879b4,_0x0baf('0xc4'));var _0x20dd04=[];_0x5ee37f[_0x0baf('0x4b')](function(_0x4823a3){_0x20dd04['push'](updateChatInteraction(_0x4823a3,_0x3403d5,_0x544498));});return BPromise[_0x0baf('0xc5')](_0x20dd04);});});})[_0x0baf('0x24')](function(_0x116d52){_0x2bc755[_0x0baf('0xc6')]=_0x116d52;return _0x2bc755;})[_0x0baf('0x24')](respondWithFilteredResult(_0x355033,_0x56270e))[_0x0baf('0x2e')](handleError(_0x355033,null));};exports[_0x0baf('0xc7')]=function(_0xe0b67c,_0x205de6){var _0x2369f0={'raw':![],'where':{'id':_0xe0b67c[_0x0baf('0xc8')]['id']}},_0x58f95c={};_0x58f95c['model']=_[_0x0baf('0x54')](db[_0x0baf('0x4e')][_0x0baf('0xc9')]);_0x58f95c[_0x0baf('0x53')]=_['keys'](_0xe0b67c[_0x0baf('0x53')]);_0x58f95c[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0x58f95c[_0x0baf('0x52')],_0x58f95c[_0x0baf('0x53')]);_0x2369f0[_0x0baf('0x57')]=_[_0x0baf('0x56')](_0x58f95c[_0x0baf('0x52')],qs[_0x0baf('0x58')](_0xe0b67c['query'][_0x0baf('0x58')]));_0x2369f0[_0x0baf('0x57')]=_0x2369f0['attributes'][_0x0baf('0x59')]?_0x2369f0[_0x0baf('0x57')]:_0x58f95c[_0x0baf('0x52')];if(_0xe0b67c[_0x0baf('0x53')][_0x0baf('0xca')]){_0x2369f0[_0x0baf('0xcb')]=[{'all':!![]}];}_0x2369f0=_[_0x0baf('0xb1')]({},_0x2369f0,_0xe0b67c[_0x0baf('0xcc')]);return db[_0x0baf('0x4e')]['find'](_0x2369f0)[_0x0baf('0x24')](handleEntityNotFound(_0x205de6,null))[_0x0baf('0x24')](respondWithResult(_0x205de6,null))[_0x0baf('0x2e')](handleError(_0x205de6,null));};exports[_0x0baf('0xcd')]=function(_0x4328d5,_0x270d69){return db['ChatInteraction'][_0x0baf('0xcd')](_0x4328d5[_0x0baf('0x40')],{})[_0x0baf('0x24')](respondWithResult(_0x270d69,0xc9))['catch'](handleError(_0x270d69,null));};exports['update']=function(_0x5adbd9,_0x1adb84){if(_0x5adbd9[_0x0baf('0x40')]['id']){delete _0x5adbd9['body']['id'];}return db[_0x0baf('0x4e')]['find']({'where':{'id':_0x5adbd9[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x1adb84,null))[_0x0baf('0x24')](saveUpdates(_0x5adbd9[_0x0baf('0x40')],null))['then'](respondWithResult(_0x1adb84,null))[_0x0baf('0x2e')](handleError(_0x1adb84,null));};exports[_0x0baf('0x3d')]=function(_0x25d25e,_0x4494de){return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x25d25e[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x4494de,null))[_0x0baf('0x24')](removeEntity(_0x4494de,null))[_0x0baf('0x2e')](handleError(_0x4494de,null));};exports[_0x0baf('0xce')]=function(_0x2e1629,_0x275cc4){return db[_0x0baf('0x4e')][_0x0baf('0xce')]()[_0x0baf('0x24')](respondWithResult(_0x275cc4,null))[_0x0baf('0x2e')](handleError(_0x275cc4,null));};exports[_0x0baf('0xcf')]=function(_0x308b3f,_0xae8bc2){var _0x1390cd=_0x308b3f[_0x0baf('0xc8')]['id'];var _0x59dd6c;var _0x57b64b;var _0x1cd215;return db[_0x0baf('0x4e')][_0x0baf('0xd0')]({'where':{'id':_0x1390cd}})[_0x0baf('0x24')](function(_0x52e98a){_0x59dd6c=_0x52e98a;return db[_0x0baf('0xd1')][_0x0baf('0xd0')]({'where':{'id':_0x52e98a[_0x0baf('0x8d')]},'attributes':['id',_0x0baf('0xd2'),_0x0baf('0xd3'),_0x0baf('0xd4'),'vidaooNote',_0x0baf('0xd5')],'raw':!![]});})[_0x0baf('0x24')](function(_0x347c39){if(_0x347c39&&_0x347c39['vidaooApiKey']&&_0x347c39[_0x0baf('0xd3')]){_0x57b64b=_0x347c39;var _0x106c6e={'interaction':{'id':_0x1390cd},'agent':{'id':_0x308b3f[_0x0baf('0xab')]['id'],'name':_0x308b3f['user']['name'],'fullname':_0x308b3f['user'][_0x0baf('0x47')],'email':_0x308b3f['user'][_0x0baf('0xd6')]},'contact':_0x308b3f[_0x0baf('0x40')]['contact'],'account':_0x308b3f[_0x0baf('0x40')]['account']};var _0x5737b0={'rejectUnauthorized':![],'method':_0x0baf('0xd7'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x347c39[_0x0baf('0xd2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x308b3f['user']['email']],'buttons':null,'topic':_0x57b64b['vidaooTopic'],'note':_[_0x0baf('0xd8')](_0x57b64b[_0x0baf('0xd9')])?null:getMustacheRender(_0x57b64b[_0x0baf('0xd9')],_0x106c6e),'metadata':null},'redirect':_0x0baf('0xda'),'json':!![]};try{if(!_[_0x0baf('0xd8')](_0x57b64b[_0x0baf('0xd5')])){var _0x20582a=getMustacheRender(_0x57b64b['vidaooMetadata'],_0x106c6e);var _0x36cd08=JSON[_0x0baf('0x90')](_0x20582a);_0x5737b0[_0x0baf('0x40')]['metadata']=_0x36cd08;}}catch(_0x24672f){throw new db[(_0x0baf('0xdb'))][(_0x0baf('0xdc'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5737b0);}else{throw new db[(_0x0baf('0xdb'))]['ValidationError'](_0x0baf('0xdd'));}})[_0x0baf('0x24')](function(_0x57846e){_0x1cd215=_0x57846e;if(_0x1cd215['id']){var _0xd4ed40={'body':_0x1cd215[_0x0baf('0xde')],'ChatWebsiteId':_0x57b64b['id'],'ChatInteractionId':_0x59dd6c['id'],'direction':_0x0baf('0xdf'),'UserId':_0x308b3f[_0x0baf('0xab')]['id']};return db['ChatMessage'][_0x0baf('0xcd')](_0xd4ed40,{});}else{throw new db[(_0x0baf('0xdb'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x0baf('0x24')](function(){return _0x59dd6c[_0x0baf('0xe0')]({'vidaooSessionId':_0x1cd215['id']});})[_0x0baf('0x24')](respondWithResult(_0xae8bc2,null))[_0x0baf('0x2e')](handleError(_0xae8bc2,null));};exports['customUpdate']=function(_0x5571d4,_0x16579f){if(_0x5571d4[_0x0baf('0x40')]['id']){delete _0x5571d4[_0x0baf('0x40')]['id'];}return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x5571d4['params']['id']},'include':[{'model':db[_0x0baf('0xe1')],'as':_0x0baf('0x7b')}]})['then'](handleEntityNotFound(_0x16579f,null))[_0x0baf('0x24')](saveUpdates(_0x5571d4[_0x0baf('0x40')],null))['then'](respondWithResult(_0x16579f,null))[_0x0baf('0x2e')](handleError(_0x16579f,null));};exports[_0x0baf('0xe2')]=function(_0x19457c,_0x1f0b00,_0x2484d4){if(_0x19457c[_0x0baf('0x40')]['id']){delete _0x19457c[_0x0baf('0x40')]['id'];}return db[_0x0baf('0x4e')]['find']({'where':{'id':_0x19457c[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](function(_0x226edd){if(!_0x226edd){logger[_0x0baf('0x2a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x0baf('0xe2'),0x194,_0x0baf('0xe3'));_0x1f0b00['sendStatus'](0x194);}else{if(_0x226edd[_0x0baf('0x8a')]){throw new db[(_0x0baf('0xdb'))][(_0x0baf('0xdc'))](_0x0baf('0xe4'));}}return _0x226edd;})['then'](function(_0x3ca1a6){if(_0x3ca1a6){return _0x3ca1a6[_0x0baf('0x3c')]({'closed':_0x19457c[_0x0baf('0x40')][_0x0baf('0xe5')],'disposition':_0x19457c[_0x0baf('0x40')]['disposition']})[_0x0baf('0x24')](function(_0xc5ec1a){return _0xc5ec1a;});}})[_0x0baf('0x24')](function(_0x5d33b4){return respondWithRpcPromise(_0x0baf('0xe6'),_0x0baf('0xe2'),_0x19457c[_0x0baf('0x40')],client9004);})[_0x0baf('0x24')](respondWithResult(_0x1f0b00,null))[_0x0baf('0x2e')](handleError(_0x1f0b00,null));};exports['attachmentUpload']=function(_0x553084,_0x19898e,_0x315ada){_0x553084[_0x0baf('0x40')]['name']=_0x553084[_0x0baf('0xe7')][_0x0baf('0xe8')];_0x553084[_0x0baf('0x40')][_0x0baf('0xe9')]=_0x553084[_0x0baf('0xe7')][_0x0baf('0xea')];_0x553084[_0x0baf('0x40')][_0x0baf('0x50')]=_0x553084[_0x0baf('0xe7')][_0x0baf('0xeb')];return db['Attachment'][_0x0baf('0xcd')](_0x553084[_0x0baf('0x40')])[_0x0baf('0x24')](respondWithResult(_0x19898e,0xc9))[_0x0baf('0x2e')](handleError(_0x19898e,null));};exports['attachmentDownload']=function(_0x413d0d,_0x3d7667,_0x386928){return db['ChatInteraction'][_0x0baf('0xd0')]({'where':{'id':_0x413d0d[_0x0baf('0xc8')]['id']},'raw':!![]})[_0x0baf('0x24')](handleEntityNotFound(_0x3d7667,null))[_0x0baf('0x24')](function(_0x1e4bf1){if(_0x1e4bf1){if(_0x1e4bf1['closed']){return _0x3d7667[_0x0baf('0x30')](0x193)[_0x0baf('0x32')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x0baf('0xd0')]({'where':{'id':_0x413d0d[_0x0baf('0x53')][_0x0baf('0xec')]},'raw':!![]})[_0x0baf('0x24')](handleEntityNotFound(_0x3d7667,null));}})[_0x0baf('0x24')](function(_0xb22125){if(_0xb22125){var _0x37c83a=_0xb22125['ChatOfflineMessageId']!==null;var _0x5deb7b=path[_0x0baf('0xed')](config[_0x0baf('0xee')],_0x0baf('0xef'));if(_0x37c83a){_0x5deb7b=path['join'](_0x5deb7b,_0x0baf('0xf0'));}var _0x3a6bf8=path['join'](_0x5deb7b,_0xb22125[_0x0baf('0xe9')]);return _0x3d7667[_0x0baf('0xf1')](_0x3a6bf8);}})['catch'](handleError(_0x3d7667,null));};exports[_0x0baf('0xf2')]=function(_0x9d6974,_0x939365){var _0x4d6ac4=null;var _0x1d86c9=null;var _0x95fe84=null;var _0x2a7138=null;if(_0x9d6974[_0x0baf('0x40')]['id']){delete _0x9d6974[_0x0baf('0x40')]['id'];}if(_0x9d6974[_0x0baf('0x40')][_0x0baf('0xf3')]){_0x2a7138=path['join'](config[_0x0baf('0xee')],'server/files/chat/upload/',util[_0x0baf('0xf4')](_0x0baf('0xf5'),Date['now']()));_0x9d6974['body'][_0x0baf('0xf6')]=_0x2a7138;}return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x9d6974['params']['id']},'include':[{'model':db[_0x0baf('0xf7')],'as':_0x0baf('0xf8'),'include':[{'model':db[_0x0baf('0xf9')],'as':_0x0baf('0xf9')}]}]})[_0x0baf('0x24')](handleEntityNotFound(_0x939365,null))[_0x0baf('0x24')](saveUpdates(_0x9d6974[_0x0baf('0x40')],null))[_0x0baf('0x24')](function(_0x5f3691){if(_0x5f3691){_0x4d6ac4=_0x5f3691;return db['ChatWebsite'][_0x0baf('0x89')]({'where':{'id':_0x4d6ac4[_0x0baf('0x8d')]}});}})['then'](function(_0x210047){if(_0x210047){_0x95fe84=_0x210047;return db[_0x0baf('0xe1')][_0x0baf('0x89')]({'where':{'id':_0x4d6ac4[_0x0baf('0x80')]}});}})[_0x0baf('0x24')](function(_0x8806f9){if(_0x8806f9){_0x1d86c9=_0x8806f9;if(_0x2a7138){var _0x1cb69a=null;for(var _0x4bc31f=0x1;_0x4bc31f<_0x4d6ac4[_0x0baf('0xf8')]['length'];++_0x4bc31f){_0x1cb69a=_0x4d6ac4[_0x0baf('0xf8')][_0x4bc31f];var _0x32abf2=_0x1cb69a['UserId']?util['format'](_0x0baf('0xfa'),_0x95fe84[_0x0baf('0xfb')],_0x1cb69a[_0x0baf('0x8a')]):_0x0baf('0xfc');var _0x4759d5=_0x9d6974[_0x0baf('0x40')][_0x0baf('0xfd')]||util['format']('%s%d','Visitor',_0x1cb69a[_0x0baf('0x80')]);switch(_0x95fe84['agentIdentifier']){case _0x0baf('0xfe'):_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?util['format']('%s%d',_0x95fe84[_0x0baf('0xfb')],_0x1cb69a[_0x0baf('0x8a')]):_0x0baf('0xfc');break;case _0x0baf('0xff'):_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?_0x1cb69a['User'][_0x0baf('0x100')]||_0x1cb69a[_0x0baf('0xf9')][_0x0baf('0x47')]:_0x0baf('0xfc');break;case _0x0baf('0x101'):_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?_0x1cb69a['User'][_0x0baf('0x47')]:_0x0baf('0xfc');break;default:_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?util['format'](_0x0baf('0xfa'),_0x95fe84[_0x0baf('0xfb')],_0x1cb69a['UserId']):_0x0baf('0xfc');}var _0xe93008=util[_0x0baf('0xf4')](_0x0baf('0x102'),moment(_0x1cb69a['createdAt'])['format'](_0x0baf('0x103')),_0x1cb69a[_0x0baf('0x104')]==='in'?_0x4759d5:_0x32abf2,_0x1cb69a['body']);if(!_0x1cb69a[_0x0baf('0x105')]){fs[_0x0baf('0x106')](_0x2a7138,_0xe93008);}}return db[_0x0baf('0x107')][_0x0baf('0xd0')]({'where':{'service':!![]},'include':[{'model':db[_0x0baf('0x108')],'as':'Smtp','raw':!![]}]});}}})[_0x0baf('0x24')](function(_0x1fe362){if(_0x1fe362&&_0x1fe362[_0x0baf('0x109')]&&_0x9d6974[_0x0baf('0x40')]){var _0x51287e={'tls':{'rejectUnauthorized':![]}};if(_0x1fe362[_0x0baf('0x109')]['service']){_0x51287e[_0x0baf('0x10a')]=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10a')];}else{_0x51287e['host']=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10b')];_0x51287e[_0x0baf('0x10c')]=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10c')];_0x51287e[_0x0baf('0x10d')]=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10d')];}if(_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10e')]){_0x51287e[_0x0baf('0x10f')]={'user':_0x1fe362[_0x0baf('0x109')]['user'],'pass':_0x1fe362['Smtp'][_0x0baf('0x110')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x51287e,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1fe362[_0x0baf('0x3f')],_0x1fe362[_0x0baf('0xd6')]||_0x1fe362['Smtp']['user']),'to':_0x9d6974['body']['mailTranscript'],'subject':_0x0baf('0x111'),'text':util['format'](_0x0baf('0x112'),_0x9d6974[_0x0baf('0x40')][_0x0baf('0xf3')]),'attachments':[{'path':_0x2a7138}]}})[_0x0baf('0x24')](function(){return _0x4d6ac4;})[_0x0baf('0x2e')](function(_0x292469){console[_0x0baf('0x2a')](_0x292469);});}else{return _0x4d6ac4;}})[_0x0baf('0x24')](respondWithStatusCode(_0x939365,0xc8))['catch'](handleError(_0x939365,null));};exports['addMessage']=function(_0x2d7ec3,_0x2a4d79,_0x5ebcad){return db[_0x0baf('0xf7')]['find']({'where':{'id':_0x2d7ec3[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x2a4d79,null))['then'](function(_0x4621ba){if(_0x4621ba){return _0x4621ba[_0x0baf('0x113')](_0x2d7ec3[_0x0baf('0x40')][_0x0baf('0x114')],_[_0x0baf('0x115')](_0x2d7ec3[_0x0baf('0x40')],[_0x0baf('0x114'),'id'])||{});}})[_0x0baf('0x24')](respondWithResult(_0x2a4d79,null))[_0x0baf('0x2e')](handleError(_0x2a4d79,null));};exports[_0x0baf('0x116')]=function(_0x425869,_0x4059e1,_0x2c94ff){var _0x738da0={'raw':![],'where':{}};var _0x268a1c={};var _0x34cb32={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x0baf('0xd0')]({'where':{'id':_0x425869[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x4059e1,null))[_0x0baf('0x24')](function(_0x39526b){if(_0x39526b){_0x268a1c['model']=_[_0x0baf('0x54')](db['ChatMessage'][_0x0baf('0xc9')]);_0x268a1c['query']=_[_0x0baf('0x54')](_0x425869['query']);_0x268a1c[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0x268a1c[_0x0baf('0x52')],_0x268a1c[_0x0baf('0x53')]);_0x738da0['attributes']=_[_0x0baf('0x56')](_0x268a1c[_0x0baf('0x52')],qs[_0x0baf('0x58')](_0x425869[_0x0baf('0x53')]['fields']));_0x738da0['attributes']=_0x738da0[_0x0baf('0x57')][_0x0baf('0x59')]?_0x738da0[_0x0baf('0x57')]:_0x268a1c[_0x0baf('0x52')];if(!_0x425869['query'][_0x0baf('0x5a')](_0x0baf('0x5b'))){_0x738da0[_0x0baf('0x34')]=qs['limit'](_0x425869['query'][_0x0baf('0x34')]);_0x738da0['offset']=qs[_0x0baf('0x36')](_0x425869['query'][_0x0baf('0x36')]);}_0x738da0[_0x0baf('0x5c')]=qs[_0x0baf('0x5d')](_0x425869['query'][_0x0baf('0x5d')]);_0x738da0[_0x0baf('0x5e')]=qs['filters'](_['pick'](_0x425869[_0x0baf('0x53')],_0x268a1c['filters']));_0x738da0[_0x0baf('0x5e')][_0x0baf('0xc4')]=_0x39526b['id'];if(_0x425869['query']['filter']){_0x738da0[_0x0baf('0x5e')]=_[_0x0baf('0xb1')](_0x738da0['where'],{'$or':_[_0x0baf('0x46')](_0x738da0['attributes'],function(_0x309220){var _0x376eb3={};_0x376eb3[_0x309220]={'$like':'%'+_0x425869['query'][_0x0baf('0x9b')]+'%'};return _0x376eb3;})});}if(_0x425869[_0x0baf('0x53')][_0x0baf('0x91')]){var _0x2ef76b=_0x425869[_0x0baf('0x53')]['$gte'][_0x0baf('0x4a')](',');var _0x4ca9ea={};_0x4ca9ea[_0x2ef76b[0x0]]={'$gte':moment(_0x2ef76b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x738da0[_0x0baf('0x5e')]=_[_0x0baf('0xb1')](_0x738da0['where'],_0x4ca9ea);}_0x738da0=_[_0x0baf('0xb1')]({},_0x738da0,_0x425869[_0x0baf('0xcc')]);return db['ChatMessage'][_0x0baf('0x35')]({'where':_0x738da0[_0x0baf('0x5e')]})[_0x0baf('0x24')](function(_0x3d6ece){_0x34cb32[_0x0baf('0x35')]=_0x3d6ece;if(_0x425869[_0x0baf('0x53')][_0x0baf('0xca')]){_0x738da0[_0x0baf('0xcb')]=[{'all':!![]}];}return db[_0x0baf('0xf7')][_0x0baf('0x117')](_0x738da0);})['then'](function(_0x19727f){_0x34cb32[_0x0baf('0xc6')]=_0x19727f;return _0x34cb32;});}})[_0x0baf('0x24')](respondWithFilteredResult(_0x4059e1,_0x738da0))[_0x0baf('0x2e')](handleError(_0x4059e1,null));};exports[_0x0baf('0x118')]=function(_0x57b26e,_0x3a0a2f,_0x5b676d){var _0x298155={'where':{}},_0xff9b69={},_0x5398c6={'count':0x0,'rows':[]};return db[_0x0baf('0x4e')][_0x0baf('0xd0')]({'where':{'id':_0x57b26e[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](handleEntityNotFound(_0x3a0a2f,null))['then'](function(_0x2edcf9){if(_0x2edcf9){_0xff9b69[_0x0baf('0x52')]=_[_0x0baf('0x54')](db[_0x0baf('0xf7')][_0x0baf('0xc9')]);_0xff9b69[_0x0baf('0x53')]=_[_0x0baf('0x54')](_0x57b26e[_0x0baf('0x53')]);_0xff9b69[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0xff9b69[_0x0baf('0x52')],_0xff9b69[_0x0baf('0x53')]);_0x298155[_0x0baf('0x57')]=_[_0x0baf('0x56')](_0xff9b69[_0x0baf('0x52')],qs[_0x0baf('0x58')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x58')]));_0x298155['attributes']=_0x298155[_0x0baf('0x57')][_0x0baf('0x59')]?_0x298155[_0x0baf('0x57')]:_0xff9b69[_0x0baf('0x52')];if(!_0x57b26e[_0x0baf('0x53')][_0x0baf('0x5a')](_0x0baf('0x5b'))){_0x298155['limit']=qs[_0x0baf('0x34')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x34')]);_0x298155[_0x0baf('0x36')]=qs[_0x0baf('0x36')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x36')]);}_0x298155['order']=qs[_0x0baf('0x5d')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x5d')]);_0x298155[_0x0baf('0x5e')]=qs[_0x0baf('0x55')](_[_0x0baf('0x5f')](_0x57b26e['query'],_0xff9b69[_0x0baf('0x55')]));_0x298155[_0x0baf('0x5e')][_0x0baf('0xc4')]=_0x2edcf9['id'];if(_0x57b26e[_0x0baf('0x53')][_0x0baf('0x9b')]){_0x298155['where']=_['merge'](_0x298155[_0x0baf('0x5e')],{'$or':_[_0x0baf('0x46')](_0x298155[_0x0baf('0x57')],function(_0x2d43ac){var _0x34126b={};_0x34126b[_0x2d43ac]={'$like':'%'+_0x57b26e[_0x0baf('0x53')][_0x0baf('0x9b')]+'%'};return _0x34126b;})});}_0x298155[_0x0baf('0x5e')][_0x0baf('0x105')]=![];if(_0x57b26e[_0x0baf('0x53')]['id']){_0x298155[_0x0baf('0x5e')]['id']={'$gt':_0x57b26e[_0x0baf('0x53')]['id']};}_0x298155=_[_0x0baf('0xb1')]({},_0x298155,_0x57b26e[_0x0baf('0xcc')]);return db[_0x0baf('0xf7')][_0x0baf('0x35')]({'where':_0x298155[_0x0baf('0x5e')]})[_0x0baf('0x24')](function(_0x18d219){_0x5398c6[_0x0baf('0x35')]=_0x18d219;_0x298155[_0x0baf('0xcb')]=[];if(_0x57b26e[_0x0baf('0x53')][_0x0baf('0x119')]){_0x298155[_0x0baf('0xcb')][_0x0baf('0x4c')]({'model':db[_0x0baf('0xf9')],'as':_0x0baf('0xf9'),'attributes':['id','fullname',_0x0baf('0x100')]});}if(_0x57b26e[_0x0baf('0x53')][_0x0baf('0xca')]){_0x298155[_0x0baf('0xcb')]=[{'all':!![]}];}return db[_0x0baf('0xf7')]['findAll'](_0x298155);})[_0x0baf('0x24')](function(_0x344fef){_0x5398c6[_0x0baf('0xc6')]=_0x344fef;return _0x5398c6;});}})[_0x0baf('0x24')](respondWithFilteredResult(_0x3a0a2f,_0x298155))[_0x0baf('0x2e')](handleError(_0x3a0a2f,null));};exports[_0x0baf('0x11a')]=function(_0x3358f5,_0x237a20,_0x26dd4c){return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x3358f5[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](handleEntityNotFound(_0x237a20,null))[_0x0baf('0x24')](function(_0x2867b7){if(_0x2867b7){return _0x2867b7[_0x0baf('0x11b')](_0x3358f5[_0x0baf('0x40')][_0x0baf('0x114')],_['omit'](_0x3358f5[_0x0baf('0x40')],['ids','id'])||{})['spread'](function(){return db[_0x0baf('0x84')][_0x0baf('0x117')]({'attributes':['id',_0x0baf('0x3f'),'color'],'where':{'id':_0x3358f5[_0x0baf('0x40')][_0x0baf('0x114')]}});})[_0x0baf('0x24')](function(_0x24bc8f){socket[_0x0baf('0x11c')](_0x0baf('0x11d'),{'id':Number(_0x3358f5['params']['id']),'tags':_0x24bc8f||[]});return{'id':Number(_0x3358f5[_0x0baf('0xc8')]['id']),'tags':_0x24bc8f||[]};});}})[_0x0baf('0x24')](respondWithResult(_0x237a20,null))[_0x0baf('0x2e')](handleError(_0x237a20,null));};exports[_0x0baf('0x11e')]=function(_0x262063,_0x216897,_0x4c2bae){return db[_0x0baf('0x4e')]['find']({'where':{'id':_0x262063[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](handleEntityNotFound(_0x216897,null))['then'](function(_0x56da3e){if(_0x56da3e){return _0x56da3e[_0x0baf('0x11e')](_0x262063[_0x0baf('0x53')][_0x0baf('0x114')]);}})['then'](respondWithStatusCode(_0x216897,null))[_0x0baf('0x2e')](handleError(_0x216897,null));};exports[_0x0baf('0xf1')]=function(_0x51d2aa,_0x26d73d){var _0x20cc18=moment()[_0x0baf('0x11f')]()[_0x0baf('0xb0')]();var _0x3fa8eb=path[_0x0baf('0xed')](config[_0x0baf('0xee')],'server','files',_0x0baf('0x120'));var _0x1bd67f=path[_0x0baf('0xed')](config[_0x0baf('0xee')],_0x0baf('0x121'),_0x0baf('0x122'),_0x0baf('0x123'));var _0x4316c5=path[_0x0baf('0xed')](_0x3fa8eb,_0x20cc18);var _0x1d5b73=util['format']('transcript-%d-%s.zip',_0x51d2aa[_0x0baf('0xc8')]['id'],_0x20cc18);var _0x2a84f8=path[_0x0baf('0xed')](_0x3fa8eb,_0x1d5b73);var _0x552504=[];_0x552504['push']({'model':db[_0x0baf('0xf9')],'as':_0x0baf('0xf9'),'attributes':['id',_0x0baf('0x47')],'raw':!![]});_0x552504[_0x0baf('0x4c')]({'model':db['CmContact'],'as':_0x0baf('0x7b'),'attributes':['id',_0x0baf('0x124'),_0x0baf('0x125')],'raw':!![]});if(_0x51d2aa[_0x0baf('0x53')][_0x0baf('0x123')]){_0x552504[_0x0baf('0x4c')]({'model':db[_0x0baf('0x126')],'as':_0x0baf('0x126'),'raw':!![]});}var _0x5bbd33=[{'model':db[_0x0baf('0xf7')],'as':_0x0baf('0xf8'),'attributes':['id',_0x0baf('0x40'),_0x0baf('0x8f'),_0x0baf('0x104'),_0x0baf('0x105'),'read'],'include':_0x552504}];_0x5bbd33[_0x0baf('0x4c')]({'model':db[_0x0baf('0xd1')],'as':'Account','attributes':['id','name']});_0x5bbd33[_0x0baf('0x4c')]({'model':db['User'],'as':_0x0baf('0x127'),'attributes':['id',_0x0baf('0x47')]});return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x51d2aa['params']['id']},'include':_0x5bbd33})[_0x0baf('0x24')](handleEntityNotFound(_0x26d73d,null))[_0x0baf('0x24')](function(_0x32c2a8){if(_0x32c2a8){var _0x58fea2=_0x32c2a8[_0x0baf('0x128')]({'plain':!![]});fs[_0x0baf('0x129')](_0x4316c5);var _0x5f5d45={'channel':_0x0baf('0x12a'),'account':_0x58fea2['Account'][_0x0baf('0x3f')],'agent':_0x58fea2[_0x0baf('0x127')]?_0x58fea2[_0x0baf('0x127')][_0x0baf('0x47')]:'N.A.','createdAt':moment(_0x58fea2[_0x0baf('0x8f')])[_0x0baf('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0baf('0xb0')](),'closedAt':_0x58fea2[_0x0baf('0xe5')]?moment(_0x58fea2['closedAt'])[_0x0baf('0xf4')](_0x0baf('0x12b'))['toString']():'','disposition':_0x58fea2[_0x0baf('0x12c')],'chatInfo':{'browser':_0x58fea2[_0x0baf('0x12d')],'os':_0x58fea2[_0x0baf('0x12e')],'referer':_0x58fea2[_0x0baf('0x12f')],'customerIp':_0x58fea2[_0x0baf('0x130')],'customerPort':_0x58fea2[_0x0baf('0x131')]?_0x58fea2['customerPort']:_0x0baf('0x132')},'messages':_(_0x58fea2[_0x0baf('0xf8')])[_0x0baf('0x133')]()[_0x0baf('0x9b')]({'secret':![]})[_0x0baf('0x46')](function(_0x1ca912){if(_0x1ca912[_0x0baf('0x126')]){var _0x70e2e=path[_0x0baf('0xed')](_0x1bd67f,_0x1ca912[_0x0baf('0x126')][_0x0baf('0xe9')]);if(fs[_0x0baf('0x134')](_0x70e2e)){fs[_0x0baf('0x135')](_0x70e2e)[_0x0baf('0x136')](fs[_0x0baf('0x137')](path[_0x0baf('0xed')](_0x4316c5,_0x1ca912[_0x0baf('0x126')][_0x0baf('0xe9')])));}}return{'date':moment(_0x1ca912[_0x0baf('0x8f')])[_0x0baf('0xf4')](_0x0baf('0x12b'))[_0x0baf('0xb0')](),'sender':_0x1ca912['direction']===_0x0baf('0xdf')?_0x1ca912[_0x0baf('0xf9')]?_0x1ca912['User']['fullname']:'System':_0x1ca912[_0x0baf('0x7b')]['firstName']+(_0x1ca912['Contact']['lastName']?'\x20'+_0x1ca912[_0x0baf('0x7b')][_0x0baf('0x125')]:''),'body':_0x1ca912[_0x0baf('0x126')]?_0x1ca912['Attachment'][_0x0baf('0xe9')]:_0x1ca912['body'],'direction':_0x1ca912['direction']===_0x0baf('0xdf')?'A':'C','secret':_0x1ca912[_0x0baf('0x105')],'read':_0x1ca912[_0x0baf('0x96')],'attachment':_0x1ca912['Attachment']};})['value']()};return ejs[_0x0baf('0x138')](path[_0x0baf('0xed')](config[_0x0baf('0xee')],_0x0baf('0x121'),_0x0baf('0x139'),_0x0baf('0x13a')),{'interaction':_0x5f5d45})['then'](function(_0x4c1f01){var _0x217cd8=path[_0x0baf('0xed')](_0x4316c5,'transcript-'+_0x58fea2['id']+'-'+_0x20cc18+_0x0baf('0x13b'));var _0x223d32={'path':_0x217cd8,'channel':_0x0baf('0x12a'),'interactionId':_0x58fea2['id']};return pdf[_0x0baf('0x13c')](_0x4c1f01,_0x223d32);})['then'](function(){return new BPromise(function(_0xcca408,_0x557ec9){zipdir(_0x4316c5,{'saveTo':_0x2a84f8},function(_0x479231,_0x320409){if(_0x479231)return _0x557ec9(_0x479231);return _0xcca408(_0x320409);});})['then'](function(){return new BPromise(function(_0x4a0f32,_0xc6fc4d){rimraf(_0x4316c5,function(_0x46b904){if(_0x46b904)_0xc6fc4d(_0x46b904);return _0x4a0f32();});});})['then'](function(){return _0x26d73d[_0x0baf('0xf1')](_0x2a84f8,_0x1d5b73,function(_0x2dea20){if(_0x2dea20){console[_0x0baf('0x13d')](_0x0baf('0x13e'),_0x2dea20);}else{fs[_0x0baf('0x13f')](_0x2a84f8);}});});});}else{return _0x26d73d[_0x0baf('0x2f')](0xc8);}})['catch'](handleError(_0x26d73d,null));}; \ No newline at end of file +var _0x0abf=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','user_has_chat_interactions','users','chat_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','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','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','format','transcript-%s.txt','now','User','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','end','stack','name','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','fieldName','type','key','model'];(function(_0x537f79,_0x139d0d){var _0x56c812=function(_0x4ae9ef){while(--_0x4ae9ef){_0x537f79['push'](_0x537f79['shift']());}};_0x56c812(++_0x139d0d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0abf[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf0ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x12'))(_0xf0ab('0x13'));var utils=require(_0xf0ab('0x14'));var config=require(_0xf0ab('0x15'));var licenseUtil=require(_0xf0ab('0x16'));var db=require(_0xf0ab('0x17'))['db'];config[_0xf0ab('0x18')]=_['defaults'](config[_0xf0ab('0x18')],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x18')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232b});var client9004=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x221bac,_0x200cf5,_0x2f4618,_0x230f40){return new BPromise(function(_0x54b0ce,_0x457465){var _0x9e3b47=_0x230f40||client;return _0x9e3b47[_0xf0ab('0x20')](_0x221bac,_0x2f4618)[_0xf0ab('0x21')](function(_0x776619){logger[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x200cf5,_0xf0ab('0x24'));logger[_0xf0ab('0x25')](_0xf0ab('0x26'),_0x200cf5,_0xf0ab('0x24'),JSON[_0xf0ab('0x27')](_0x776619));if(_0x776619[_0xf0ab('0x28')]){if(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x29')]===0x1f4){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x457465(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}logger[_0xf0ab('0x28')](_0xf0ab('0x23'),_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x54b0ce(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}else{logger[_0xf0ab('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,'request\x20sent');_0x54b0ce(_0x776619['result'][_0xf0ab('0x2a')]);}})['catch'](function(_0x3eca32){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x3eca32);_0x457465(_0x3eca32);});});}function respondWithStatusCode(_0x163078,_0x22671e){_0x22671e=_0x22671e||0xcc;return function(_0x10bf5f){if(_0x10bf5f){return _0x163078[_0xf0ab('0x2b')](_0x22671e);}return _0x163078[_0xf0ab('0x2c')](_0x22671e)['end']();};}function respondWithResult(_0x2d0da7,_0x574ce7){_0x574ce7=_0x574ce7||0xc8;return function(_0x55d799){if(_0x55d799){return _0x2d0da7[_0xf0ab('0x2c')](_0x574ce7)[_0xf0ab('0x2d')](_0x55d799);}};}function respondWithFilteredResult(_0x1b223d,_0x445160){return function(_0x43476c){if(_0x43476c){var _0x174052=typeof _0x445160[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x445160[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x21e8ac=_0x43476c[_0xf0ab('0x31')];var _0x58cbe1=_0x174052?0x0:_0x445160[_0xf0ab('0x2e')];var _0x35973a=_0x174052?_0x43476c['count']:_0x445160['offset']+_0x445160[_0xf0ab('0x30')];var _0x1dc84e;if(_0x35973a>=_0x21e8ac){_0x35973a=_0x21e8ac;_0x1dc84e=0xc8;}else{_0x1dc84e=0xce;}_0x1b223d[_0xf0ab('0x2c')](_0x1dc84e);return _0x1b223d['set']('Content-Range',_0x58cbe1+'-'+_0x35973a+'/'+_0x21e8ac)[_0xf0ab('0x2d')](_0x43476c);}return null;};}function patchUpdates(_0x58fa03){return function(_0x1cfd52){try{jsonpatch['apply'](_0x1cfd52,_0x58fa03,!![]);}catch(_0x3f66fa){return BPromise[_0xf0ab('0x32')](_0x3f66fa);}return _0x1cfd52['save']();};}function saveUpdates(_0x56e728,_0x469f42){return function(_0x27c6f9){if(_0x27c6f9){return _0x27c6f9[_0xf0ab('0x33')](_0x56e728)[_0xf0ab('0x21')](function(_0x2519c7){return _0x2519c7;});}return null;};}function removeEntity(_0x36195d,_0x17f3b3){return function(_0xf8f0f4){if(_0xf8f0f4){return _0xf8f0f4[_0xf0ab('0x34')]()[_0xf0ab('0x21')](function(){_0x36195d[_0xf0ab('0x2c')](0xcc)[_0xf0ab('0x35')]();});}};}function handleEntityNotFound(_0x22dcfe,_0x437fdb){return function(_0x5d8443){if(!_0x5d8443){_0x22dcfe[_0xf0ab('0x2b')](0x194);}return _0x5d8443;};}function handleError(_0x45c449,_0xc575ed){_0xc575ed=_0xc575ed||0x1f4;return function(_0x5c9192){logger[_0xf0ab('0x28')](_0x5c9192[_0xf0ab('0x36')]);if(_0x5c9192[_0xf0ab('0x37')]){delete _0x5c9192['name'];}_0x45c449[_0xf0ab('0x2c')](_0xc575ed)['send'](_0x5c9192);};}function getMustacheRender(_0xda3971,_0x492d7c){return Mustache[_0xf0ab('0x38')](_0xda3971,_[_0xf0ab('0x39')](_0x492d7c[_0xf0ab('0x3a')],{'contact':_0x492d7c[_0xf0ab('0x3b')],'message':_0x492d7c[_0xf0ab('0x2a')],'agent':_0x492d7c[_0xf0ab('0x3c')],'interaction':_0x492d7c['interaction'],'account':_0x492d7c[_0xf0ab('0x3d')]}))||'';}function getInteractionUsers(_0x683d08,_0x5a6df5){return new BPromise(function(_0x207fbb,_0xce89bc){try{if(_0x5a6df5[_0x683d08['id']]){_0x683d08[_0xf0ab('0x3e')]=_[_0xf0ab('0x3f')](_0x5a6df5[_0x683d08['id']],function(_0x31fa72){return{'id':_0x31fa72['id'],'fullname':_0x31fa72[_0xf0ab('0x40')]};});}}catch(_0x28c20c){_0xce89bc(_0x28c20c);}_0x207fbb(_0x683d08);});}function getInteractionTags(_0x528d4b,_0x406a1d){return new BPromise(function(_0x4f6e93,_0x7c4629){try{if(_0x528d4b['TagIds']){_0x528d4b[_0xf0ab('0x41')]=[];_0x528d4b[_0xf0ab('0x42')][_0xf0ab('0x43')](',')[_0xf0ab('0x44')](function(_0x2b7ed5){_0x528d4b['Tags'][_0xf0ab('0x45')](_0x406a1d[_0x2b7ed5]);});}delete _0x528d4b[_0xf0ab('0x42')];}catch(_0x28e7a4){_0x7c4629(_0x28e7a4);}_0x4f6e93(_0x528d4b);});}function updateChatInteraction(_0x197955,_0x191caf,_0x17a73){return new BPromise(function(_0x45849c,_0x413f5c){return getInteractionUsers(_0x197955,_0x17a73)[_0xf0ab('0x21')](function(_0x3b214a){return getInteractionTags(_0x3b214a,_0x191caf);})[_0xf0ab('0x21')](function(_0x32ec93){_0x45849c(_0x32ec93);})[_0xf0ab('0x46')](function(_0x5e6b6b){_0x413f5c(_0x5e6b6b);});});}exports['index']=function(_0x2fc677,_0x4e6c41){var _0x1fc766={},_0x2d50c0={},_0x4bbdf6={'count':0x0,'rows':[]};var _0x8c2d2c=_[_0xf0ab('0x3f')](db['ChatInteraction'][_0xf0ab('0x47')],function(_0x29cc6a){return{'name':_0x29cc6a[_0xf0ab('0x48')],'type':_0x29cc6a[_0xf0ab('0x49')][_0xf0ab('0x4a')]};});_0x2d50c0[_0xf0ab('0x4b')]=_[_0xf0ab('0x3f')](_0x8c2d2c,_0xf0ab('0x37'));_0x2d50c0[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x2fc677[_0xf0ab('0x4c')]);_0x2d50c0[_0xf0ab('0x4e')]=_[_0xf0ab('0x4f')](_0x2d50c0[_0xf0ab('0x4b')],_0x2d50c0['query']);_0x1fc766['attributes']=_[_0xf0ab('0x4f')](_0x2d50c0['model'],qs['fields'](_0x2fc677['query'][_0xf0ab('0x50')]));_0x1fc766[_0xf0ab('0x51')]=_0x1fc766[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x1fc766[_0xf0ab('0x51')]:_0x2d50c0[_0xf0ab('0x4b')];if(!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x1fc766[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x2fc677[_0xf0ab('0x4c')]['limit']);_0x1fc766[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x1fc766[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x1fc766['where']=qs['filters'](_['pick'](_0x2fc677[_0xf0ab('0x4c')],_0x2d50c0[_0xf0ab('0x4e')]),_0x8c2d2c);var _0x577c85=[];var _0xa1a416=squel[_0xf0ab('0x57')]()['field']('id')[_0xf0ab('0x58')](_0xf0ab('0x37'))[_0xf0ab('0x58')](_0xf0ab('0x59'))[_0xf0ab('0x5a')](_0xf0ab('0x5b'));var _0x26508b=squel['select']()[_0xf0ab('0x58')]('u.id')[_0xf0ab('0x58')]('u.fullname')[_0xf0ab('0x58')]('ui.ChatInteractionId')['from'](_0xf0ab('0x5c'),'ui')['left_join'](_0xf0ab('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x2eff07=squel['select']()[_0xf0ab('0x5a')](_0xf0ab('0x5e'),'i')[_0xf0ab('0x5f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf0ab('0x5d'),'o',_0xf0ab('0x60'))['left_join']('chat_websites','a',_0xf0ab('0x61'))[_0xf0ab('0x5f')](_0xf0ab('0x62'),'me',_0xf0ab('0x63'))[_0xf0ab('0x5f')](_0xf0ab('0x64'),'it',_0xf0ab('0x65'))[_0xf0ab('0x5f')](_0xf0ab('0x5b'),'t',_0xf0ab('0x66'));var _0x1e6a4e=squel['expr']();var _0x41ed17=[];var _0x5b24e3=squel[_0xf0ab('0x67')]();var _0x61d3db;if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]){_0x61d3db=as[_0xf0ab('0x69')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]);var _0x1f11aa=_0x61d3db[_0xf0ab('0x6a')];for(var _0x180ee6=0x0;_0x180ee6<_0x61d3db['conditions'][_0xf0ab('0x52')];_0x180ee6++){var _0x2266f3=_0x61d3db[_0xf0ab('0x6b')][_0x180ee6];var _0x1d4a72='i';var _0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0x2266f3[_0xf0ab('0x58')]]);if(!_0x2232eb){switch(_0x2266f3[_0xf0ab('0x58')]){case'unreadMessages':if(_0x2266f3['value']==0x1){_0x2eff07[_0xf0ab('0x6d')]('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6e'));}else{_0x2eff07['having']('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6f'));}break;case _0xf0ab('0x70'):if(_0x2266f3['operator']===_0xf0ab('0x71')){if(_0x2266f3[_0xf0ab('0x72')][_0xf0ab('0x43')]('\x20')[_0xf0ab('0x52')]>0x1){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x73'),qs['getFullTextValue'](_0x2266f3[_0xf0ab('0x72')]),null);}else{var _0x70b02d='%'+_0x2266f3[_0xf0ab('0x72')]+'%';_0x1e6a4e[_0x1f11aa](_0xf0ab('0x74'),_0x70b02d,_0x70b02d,_0x70b02d);}}else{_0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x75')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x75');_0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')]['start'],_0x5154f5['value'][_0xf0ab('0x35')]);}break;case _0xf0ab('0x78'):var _0x325ad6=_0x2266f3['value'][_0xf0ab('0x43')](',')['map'](function(_0x1a32dc){return Number(_0x1a32dc);});_0x325ad6[_0xf0ab('0x44')](function(_0x1787e2){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1787e2+',%');});_0x41ed17=_[_0xf0ab('0x79')](_0x41ed17,_0x325ad6);break;case'User':if(_0x2266f3['operator']===_0xf0ab('0x71')){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x7a'),'%'+_0x2266f3[_0xf0ab('0x72')]+'%',null);}else{_0x2232eb=_['find'](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x7b')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x7b');_0x5154f5=as['buildExpression'](_0x1d4a72,_0x2232eb['type'],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5['text'],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}break;case _0xf0ab('0x3a'):_0x5154f5=as[_0xf0ab('0x76')]('me',null,_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);break;}}else{var _0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}}}else{var _0x42f067=_(_0x2fc677['query'])[_0xf0ab('0x4d')]()[_0xf0ab('0x3f')](function(_0x4c8e95){return _['some'](_0x8c2d2c,['name',_0x4c8e95])?_0x4c8e95:undefined;})[_0xf0ab('0x7d')]()[_0xf0ab('0x72')]();if(!_[_0xf0ab('0x7e')](_0x42f067)){_0x42f067[_0xf0ab('0x44')](function(_0x15aa78){if(_0x15aa78===_0xf0ab('0x7f')){_0x2eff07['where'](_0xf0ab('0x80'),[]['concat'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]));}else if(_0x15aa78==='createdAt'){var _0x2978a9=JSON['parse'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])['$gte'];var _0x58ca28=JSON[_0xf0ab('0x81')](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])[_0xf0ab('0x82')];_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x84'),_0x2978a9,_0x58ca28);}else{if(_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]===_0xf0ab('0x85')){_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x86'));}else{_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x87'),_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]);}}});}if(_0x2fc677[_0xf0ab('0x4c')]['read']){if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x88')]==0x1){_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x89'));}else{_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x8a'));}}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]){_0x41ed17=_[_0xf0ab('0x8c')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')])?_0x2fc677[_0xf0ab('0x4c')]['tag']:new Array(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]);_0x41ed17[_0xf0ab('0x44')](function(_0x2196a7){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2196a7+',%');});}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]){var _0x4463cc=_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xf0ab('0x8e')](/'/g,'\x27\x27');if(qs[_0xf0ab('0x8f')](_0x4463cc)){_0x1e6a4e['or']('i.id\x20LIKE\x20?',_0x4463cc+'%');}else{_0x1e6a4e['or'](_0xf0ab('0x90'),qs['getFullTextValue'](_0x4463cc))['or'](_0xf0ab('0x91'),_0x4463cc+'%');}}}_0x2eff07[_0xf0ab('0x83')](_0x1e6a4e);_0x2eff07['group'](_0xf0ab('0x92'));var _0x148a72={'type':db['Sequelize']['QueryTypes'][_0xf0ab('0x93')],'raw':!![]};var _0x58140c=_0x2eff07[_0xf0ab('0x94')]();_0x58140c[_0xf0ab('0x58')]('i.id');_0x58140c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf0ab('0x95'));if(_0x1fc766[_0xf0ab('0x55')]){_0x1fc766[_0xf0ab('0x55')][_0xf0ab('0x44')](function(_0x49c89f){var _0x272f9c=_0x49c89f[0x0]===_0xf0ab('0x96')?_0x49c89f[0x0]:'i.'+_0x49c89f[0x0];_0x2eff07[_0xf0ab('0x55')](_0x272f9c,_0x49c89f[0x1]===_0xf0ab('0x97')?![]:!![]);});}if(!_[_0xf0ab('0x7e')](_0x41ed17)){_0x2eff07['having'](_0x5b24e3);_0x58140c['where'](_0xf0ab('0x98'),_0x41ed17);}BPromise[_0xf0ab('0x99')]()['then'](function(){if(!_0x61d3db){if(_0x2fc677['query'][_0xf0ab('0x7f')])return;_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x9a'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9a'));return;}if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]!==_0xf0ab('0x3c'))return;return _0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x21')](function(_0x52eca9){if(_['isEmpty'](_0x52eca9)){_0x58140c[_0xf0ab('0x83')]('i.ChatWebsiteId\x20IS\x20NULL');_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9e'));}else{_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x80'),_['map'](_0x52eca9,'id'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x80'),_[_0xf0ab('0x3f')](_0x52eca9,'id'));}});})[_0xf0ab('0x21')](function(){if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]===_0xf0ab('0x3c')&&!_0x61d3db&&!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x7f')])return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x58140c[_0xf0ab('0xa0')](),_0x148a72);})[_0xf0ab('0x21')](function(_0x4211a1){_0x4bbdf6['count']=_0x4211a1[_0xf0ab('0x52')];if(_0x4bbdf6[_0xf0ab('0x31')]===0x0)return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0xa1a416[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x611cf7){_0x577c85=_['keyBy'](_0x611cf7,'id');_0x148a72=_['merge'](_0x148a72,{'model':db[_0xf0ab('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x50')]){_0x1fc766['attributes'][_0xf0ab('0x44')](function(_0x405b34){_0x2eff07[_0xf0ab('0x58')]('i.'+_0x405b34);});}else{_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa2'),'unreadMessages');_0x2eff07['field'](_0xf0ab('0xa3'),'Account.key');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa4'),'Account.mandatoryDisposition');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa5'),_0xf0ab('0x96'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa6'));_0x2eff07['field'](_0xf0ab('0xa7'),_0xf0ab('0xa8'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa9'),_0xf0ab('0xaa'));_0x2eff07['field'](_0xf0ab('0xab'),_0xf0ab('0xac'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xad'),_0xf0ab('0xae'));_0x2eff07['field'](_0xf0ab('0xaf'),_0xf0ab('0xb0'));_0x2eff07[_0xf0ab('0x58')]('c.fax',_0xf0ab('0xb1'));_0x2eff07['field'](_0xf0ab('0xb2'),_0xf0ab('0xb3'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xb4'),'Owner.internal');_0x2eff07[_0xf0ab('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc766[_0xf0ab('0x30')])_0x2eff07['limit'](_0x1fc766['limit']);if(_0x1fc766[_0xf0ab('0x2e')])_0x2eff07[_0xf0ab('0x2e')](_0x1fc766['offset']);return db['sequelize']['query'](_0x2eff07['toString'](),_0x148a72);})[_0xf0ab('0x21')](function(_0x12d9b6){if(_0x12d9b6[_0xf0ab('0x52')]>0x0)_0x26508b[_0xf0ab('0x83')](_0xf0ab('0xb5'),_['map'](_0x12d9b6,'id'));return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x26508b[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x84eab9){var _0x27cd98=_[_0xf0ab('0xb6')](_0x84eab9,'ChatInteractionId');var _0x16dca7=[];_0x12d9b6[_0xf0ab('0x44')](function(_0x39633a){_0x16dca7[_0xf0ab('0x45')](updateChatInteraction(_0x39633a,_0x577c85,_0x27cd98));});return BPromise[_0xf0ab('0xb7')](_0x16dca7);});});})[_0xf0ab('0x21')](function(_0x527a4b){_0x4bbdf6[_0xf0ab('0xb8')]=_0x527a4b;return _0x4bbdf6;})[_0xf0ab('0x21')](respondWithFilteredResult(_0x4e6c41,_0x1fc766))[_0xf0ab('0x46')](handleError(_0x4e6c41,null));};exports[_0xf0ab('0xb9')]=function(_0x4ca7a3,_0x426419){var _0x395bf6={'raw':![],'where':{'id':_0x4ca7a3['params']['id']}},_0x5b7744={};_0x5b7744[_0xf0ab('0x4b')]=_[_0xf0ab('0x4d')](db[_0xf0ab('0xa1')][_0xf0ab('0x47')]);_0x5b7744[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4ca7a3[_0xf0ab('0x4c')]);_0x5b7744[_0xf0ab('0x4e')]=_['intersection'](_0x5b7744[_0xf0ab('0x4b')],_0x5b7744['query']);_0x395bf6['attributes']=_[_0xf0ab('0x4f')](_0x5b7744[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x395bf6[_0xf0ab('0x51')]=_0x395bf6[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x395bf6['attributes']:_0x5b7744[_0xf0ab('0x4b')];if(_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x395bf6[_0xf0ab('0xbb')]=[{'all':!![]}];}_0x395bf6=_[_0xf0ab('0x39')]({},_0x395bf6,_0x4ca7a3[_0xf0ab('0xbc')]);return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')](_0x395bf6)[_0xf0ab('0x21')](handleEntityNotFound(_0x426419,null))[_0xf0ab('0x21')](respondWithResult(_0x426419,null))['catch'](handleError(_0x426419,null));};exports['create']=function(_0x58946c,_0x2f339d){return db['ChatInteraction']['create'](_0x58946c[_0xf0ab('0x3a')],{})[_0xf0ab('0x21')](respondWithResult(_0x2f339d,0xc9))[_0xf0ab('0x46')](handleError(_0x2f339d,null));};exports[_0xf0ab('0x33')]=function(_0xdf495,_0x55a296){if(_0xdf495[_0xf0ab('0x3a')]['id']){delete _0xdf495[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0xdf495[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x55a296,null))[_0xf0ab('0x21')](saveUpdates(_0xdf495[_0xf0ab('0x3a')],null))['then'](respondWithResult(_0x55a296,null))[_0xf0ab('0x46')](handleError(_0x55a296,null));};exports['destroy']=function(_0x3c1a2c,_0x17a3b6){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3c1a2c[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x17a3b6,null))[_0xf0ab('0x21')](removeEntity(_0x17a3b6,null))[_0xf0ab('0x46')](handleError(_0x17a3b6,null));};exports[_0xf0ab('0xbe')]=function(_0x1f2efa,_0x1d12fb){return db[_0xf0ab('0xa1')]['describe']()[_0xf0ab('0x21')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x46')](handleError(_0x1d12fb,null));};exports['createVidaooSession']=function(_0x35486d,_0x3f5ade){var _0x135a10=_0x35486d[_0xf0ab('0xbd')]['id'];var _0x48fc7e;var _0x5f55d2;var _0x7c7c3b;return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x135a10}})[_0xf0ab('0x21')](function(_0x2beaaa){_0x48fc7e=_0x2beaaa;return db[_0xf0ab('0xbf')][_0xf0ab('0xc0')]({'where':{'id':_0x2beaaa[_0xf0ab('0x7f')]},'attributes':['id',_0xf0ab('0xc1'),'vidaooEscalation',_0xf0ab('0xc2'),'vidaooNote',_0xf0ab('0xc3')],'raw':!![]});})[_0xf0ab('0x21')](function(_0x354e18){if(_0x354e18&&_0x354e18['vidaooApiKey']&&_0x354e18[_0xf0ab('0xc4')]){_0x5f55d2=_0x354e18;var _0x2068d6={'interaction':{'id':_0x135a10},'agent':{'id':_0x35486d[_0xf0ab('0x9b')]['id'],'name':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x37')],'fullname':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x40')],'email':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]},'contact':_0x35486d['body']['contact'],'account':_0x35486d[_0xf0ab('0x3a')][_0xf0ab('0x3d')]};var _0x35b480={'rejectUnauthorized':![],'method':_0xf0ab('0xc6'),'url':_0xf0ab('0xc7'),'headers':{'X-APIKEY':_0x354e18[_0xf0ab('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]],'buttons':null,'topic':_0x5f55d2[_0xf0ab('0xc2')],'note':_[_0xf0ab('0xc8')](_0x5f55d2['vidaooNote'])?null:getMustacheRender(_0x5f55d2[_0xf0ab('0xc9')],_0x2068d6),'metadata':null},'redirect':_0xf0ab('0xca'),'json':!![]};try{if(!_[_0xf0ab('0xc8')](_0x5f55d2[_0xf0ab('0xc3')])){var _0x41e2d8=getMustacheRender(_0x5f55d2[_0xf0ab('0xc3')],_0x2068d6);var _0x57f44d=JSON[_0xf0ab('0x81')](_0x41e2d8);_0x35b480[_0xf0ab('0x3a')][_0xf0ab('0xcb')]=_0x57f44d;}}catch(_0x533b37){throw new db[(_0xf0ab('0xcc'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35b480);}else{throw new db[(_0xf0ab('0xcc'))][(_0xf0ab('0xcd'))](_0xf0ab('0xce'));}})['then'](function(_0x1697ca){_0x7c7c3b=_0x1697ca;if(_0x7c7c3b['id']){var _0x15da8a={'body':_0x7c7c3b[_0xf0ab('0xcf')],'ChatWebsiteId':_0x5f55d2['id'],'ChatInteractionId':_0x48fc7e['id'],'direction':'out','UserId':_0x35486d[_0xf0ab('0x9b')]['id']};return db[_0xf0ab('0xd0')][_0xf0ab('0xd1')](_0x15da8a,{});}else{throw new db['Sequelize'][(_0xf0ab('0xcd'))](_0xf0ab('0xd2'));}})[_0xf0ab('0x21')](function(){return _0x48fc7e[_0xf0ab('0xd3')]({'vidaooSessionId':_0x7c7c3b['id']});})[_0xf0ab('0x21')](respondWithResult(_0x3f5ade,null))[_0xf0ab('0x46')](handleError(_0x3f5ade,null));};exports[_0xf0ab('0xd4')]=function(_0x115e3d,_0x2d0f9c){if(_0x115e3d[_0xf0ab('0x3a')]['id']){delete _0x115e3d[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x115e3d[_0xf0ab('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x2d0f9c,null))[_0xf0ab('0x21')](saveUpdates(_0x115e3d['body'],null))[_0xf0ab('0x21')](respondWithResult(_0x2d0f9c,null))['catch'](handleError(_0x2d0f9c,null));};exports[_0xf0ab('0xd5')]=function(_0x1e9768,_0x4398a3,_0x4195d9){if(_0x1e9768[_0xf0ab('0x3a')]['id']){delete _0x1e9768[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x1e9768[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](function(_0x5f10a5){if(!_0x5f10a5){logger[_0xf0ab('0x28')](_0xf0ab('0xd6'),_0xf0ab('0xd5'),0x194,_0xf0ab('0xd7'));_0x4398a3[_0xf0ab('0x2b')](0x194);}else{if(_0x5f10a5[_0xf0ab('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xf0ab('0xd8'));}}return _0x5f10a5;})[_0xf0ab('0x21')](function(_0x564124){if(_0x564124){return _0x564124[_0xf0ab('0x33')]({'closed':_0x1e9768[_0xf0ab('0x3a')][_0xf0ab('0xd9')],'disposition':_0x1e9768['body'][_0xf0ab('0xda')]})[_0xf0ab('0x21')](function(_0x2d9046){return _0x2d9046;});}})[_0xf0ab('0x21')](function(_0x4e5f1e){return respondWithRpcPromise(_0xf0ab('0xdb'),_0xf0ab('0xd5'),_0x1e9768[_0xf0ab('0x3a')],client9004);})['then'](respondWithResult(_0x4398a3,null))['catch'](handleError(_0x4398a3,null));};exports['attachmentUpload']=function(_0x581cb1,_0x22251d,_0x2b5993){_0x581cb1[_0xf0ab('0x3a')]['name']=_0x581cb1[_0xf0ab('0xdc')]['originalname'];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0xdd')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xde')];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0x49')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xdf')];return db[_0xf0ab('0xe0')][_0xf0ab('0xd1')](_0x581cb1[_0xf0ab('0x3a')])[_0xf0ab('0x21')](respondWithResult(_0x22251d,0xc9))[_0xf0ab('0x46')](handleError(_0x22251d,null));};exports[_0xf0ab('0xe1')]=function(_0x4d09bf,_0x415b9d,_0x11ed58){return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x4d09bf[_0xf0ab('0xbd')]['id']},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null))[_0xf0ab('0x21')](function(_0x278e32){if(_0x278e32){if(_0x278e32['closed']){return _0x415b9d[_0xf0ab('0x2c')](0x193)[_0xf0ab('0x2d')]({'status':0x193,'message':_0xf0ab('0xe2')});}return db[_0xf0ab('0xe0')][_0xf0ab('0xc0')]({'where':{'id':_0x4d09bf[_0xf0ab('0x4c')][_0xf0ab('0xe3')]},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null));}})['then'](function(_0xadae03){if(_0xadae03){var _0x550b00=_0xadae03[_0xf0ab('0xe4')]!==null;var _0x2bfb6a=path[_0xf0ab('0xe5')](config['root'],_0xf0ab('0xe6'));if(_0x550b00){_0x2bfb6a=path[_0xf0ab('0xe5')](_0x2bfb6a,'offline-chat/');}var _0x5d62e4=path['join'](_0x2bfb6a,_0xadae03['basename']);return _0x415b9d[_0xf0ab('0xe7')](_0x5d62e4);}})['catch'](handleError(_0x415b9d,null));};exports['close']=function(_0x3b8bbe,_0x7e24c4){var _0x2d0ea3=null;var _0x4a18ad=null;var _0x57aaae=null;var _0x2ab0be=null;if(_0x3b8bbe[_0xf0ab('0x3a')]['id']){delete _0x3b8bbe['body']['id'];}if(_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')]){_0x2ab0be=path['join'](config['root'],'server/files/chat/upload/',util[_0xf0ab('0xe9')](_0xf0ab('0xea'),Date[_0xf0ab('0xeb')]()));_0x3b8bbe[_0xf0ab('0x3a')]['pathTranscript']=_0x2ab0be;}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x3b8bbe['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xf0ab('0xec')],'as':'User'}]}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x7e24c4,null))[_0xf0ab('0x21')](saveUpdates(_0x3b8bbe[_0xf0ab('0x3a')],null))[_0xf0ab('0x21')](function(_0x116c84){if(_0x116c84){_0x2d0ea3=_0x116c84;return db[_0xf0ab('0xbf')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3[_0xf0ab('0x7f')]}});}})[_0xf0ab('0x21')](function(_0x1d6e15){if(_0x1d6e15){_0x57aaae=_0x1d6e15;return db[_0xf0ab('0xed')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3['ContactId']}});}})[_0xf0ab('0x21')](function(_0x29427c){if(_0x29427c){_0x4a18ad=_0x29427c;if(_0x2ab0be){var _0x29d4a1=null;for(var _0x50e996=0x1;_0x50e996<_0x2d0ea3['Messages'][_0xf0ab('0x52')];++_0x50e996){_0x29d4a1=_0x2d0ea3[_0xf0ab('0xee')][_0x50e996];var _0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');var _0xc1537e=_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xf2')]||util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0xf0ab('0xf3'),_0x29d4a1[_0xf0ab('0x75')]);switch(_0x57aaae[_0xf0ab('0xf4')]){case _0xf0ab('0xf5'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae['agentAlias'],_0x29d4a1[_0xf0ab('0x7b')]):'System';break;case _0xf0ab('0xf6'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0xf7')]||_0x29d4a1['User'][_0xf0ab('0x40')]:'System';break;case'agent_fullname':_0x8e04bb=_0x29d4a1['UserId']?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0x40')]:_0xf0ab('0xf1');break;default:_0x8e04bb=_0x29d4a1['UserId']?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');}var _0x2c39f0=util[_0xf0ab('0xe9')](_0xf0ab('0xf8'),moment(_0x29d4a1[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0xfa')),_0x29d4a1[_0xf0ab('0xfb')]==='in'?_0xc1537e:_0x8e04bb,_0x29d4a1['body']);if(!_0x29d4a1[_0xf0ab('0xfc')]){fs[_0xf0ab('0xfd')](_0x2ab0be,_0x2c39f0);}}return db[_0xf0ab('0xfe')][_0xf0ab('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf0ab('0xff'),'raw':!![]}]});}}})['then'](function(_0x21eb2b){if(_0x21eb2b&&_0x21eb2b['Smtp']&&_0x3b8bbe[_0xf0ab('0x3a')]){var _0x262659={'tls':{'rejectUnauthorized':![]}};if(_0x21eb2b['Smtp'][_0xf0ab('0x100')]){_0x262659[_0xf0ab('0x100')]=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x100')];}else{_0x262659[_0xf0ab('0x101')]=_0x21eb2b['Smtp'][_0xf0ab('0x101')];_0x262659[_0xf0ab('0x102')]=_0x21eb2b[_0xf0ab('0xff')]['port'];_0x262659['secure']=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x103')];}if(_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x104')]){_0x262659['auth']={'user':_0x21eb2b['Smtp'][_0xf0ab('0x9b')],'pass':_0x21eb2b[_0xf0ab('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf0ab('0x105'),{'account':_0x262659,'message':{'from':util['format'](_0xf0ab('0x106'),_0x21eb2b['name'],_0x21eb2b[_0xf0ab('0xc5')]||_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x9b')]),'to':_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')],'subject':_0xf0ab('0x107'),'text':util[_0xf0ab('0xe9')](_0xf0ab('0x108'),_0x3b8bbe['body'][_0xf0ab('0xe8')]),'attachments':[{'path':_0x2ab0be}]}})[_0xf0ab('0x21')](function(){return _0x2d0ea3;})[_0xf0ab('0x46')](function(_0x15f041){console[_0xf0ab('0x28')](_0x15f041);});}else{return _0x2d0ea3;}})['then'](respondWithStatusCode(_0x7e24c4,0xc8))[_0xf0ab('0x46')](handleError(_0x7e24c4,null));};exports[_0xf0ab('0x109')]=function(_0x5eda4b,_0x57a8ab,_0x3cee1d){return db[_0xf0ab('0xd0')][_0xf0ab('0x6c')]({'where':{'id':_0x5eda4b[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x57a8ab,null))[_0xf0ab('0x21')](function(_0x4dff6e){if(_0x4dff6e){return _0x4dff6e[_0xf0ab('0x109')](_0x5eda4b[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_[_0xf0ab('0x10b')](_0x5eda4b[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x57a8ab,null))[_0xf0ab('0x46')](handleError(_0x57a8ab,null));};exports['getMessages']=function(_0x283bf5,_0x1afcea,_0x22a9f8){var _0x33dbfc={'raw':![],'where':{}};var _0x487318={};var _0x546e13={'count':0x0,'rows':[]};return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x283bf5[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x1afcea,null))[_0xf0ab('0x21')](function(_0xa3b903){if(_0xa3b903){_0x487318['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x487318[_0xf0ab('0x4c')]=_['keys'](_0x283bf5[_0xf0ab('0x4c')]);_0x487318[_0xf0ab('0x4e')]=_['intersection'](_0x487318[_0xf0ab('0x4b')],_0x487318[_0xf0ab('0x4c')]);_0x33dbfc[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x487318[_0xf0ab('0x4b')],qs['fields'](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x33dbfc[_0xf0ab('0x51')]=_0x33dbfc['attributes'][_0xf0ab('0x52')]?_0x33dbfc[_0xf0ab('0x51')]:_0x487318[_0xf0ab('0x4b')];if(!_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x33dbfc[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x33dbfc['offset']=qs['offset'](_0x283bf5[_0xf0ab('0x4c')]['offset']);}_0x33dbfc['order']=qs[_0xf0ab('0x56')](_0x283bf5[_0xf0ab('0x4c')]['sort']);_0x33dbfc[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x283bf5['query'],_0x487318[_0xf0ab('0x4e')]));_0x33dbfc['where'][_0xf0ab('0x10d')]=_0xa3b903['id'];if(_0x283bf5['query'][_0xf0ab('0x8d')]){_0x33dbfc[_0xf0ab('0x83')]=_[_0xf0ab('0x39')](_0x33dbfc['where'],{'$or':_[_0xf0ab('0x3f')](_0x33dbfc[_0xf0ab('0x51')],function(_0x2ddc1d){var _0x3cef14={};_0x3cef14[_0x2ddc1d]={'$like':'%'+_0x283bf5['query'][_0xf0ab('0x8d')]+'%'};return _0x3cef14;})});}if(_0x283bf5[_0xf0ab('0x4c')]['$gte']){var _0x38ea18=_0x283bf5[_0xf0ab('0x4c')]['$gte']['split'](',');var _0x7ee6b3={};_0x7ee6b3[_0x38ea18[0x0]]={'$gte':moment(_0x38ea18[0x1])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))};_0x33dbfc['where']=_[_0xf0ab('0x39')](_0x33dbfc['where'],_0x7ee6b3);}_0x33dbfc=_[_0xf0ab('0x39')]({},_0x33dbfc,_0x283bf5['options']);return db[_0xf0ab('0xd0')]['count']({'where':_0x33dbfc['where']})['then'](function(_0x1d1451){_0x546e13['count']=_0x1d1451;if(_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x33dbfc[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x33dbfc);})['then'](function(_0x16a1d2){_0x546e13[_0xf0ab('0xb8')]=_0x16a1d2;return _0x546e13;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x1afcea,_0x33dbfc))[_0xf0ab('0x46')](handleError(_0x1afcea,null));};exports[_0xf0ab('0x110')]=function(_0x4b91de,_0x3a602f,_0x47788a){var _0x3592f1={'where':{}},_0x577f13={},_0x2f99c2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf0ab('0xc0')]({'where':{'id':_0x4b91de[_0xf0ab('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a602f,null))['then'](function(_0x43c6b8){if(_0x43c6b8){_0x577f13['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x577f13[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4b91de[_0xf0ab('0x4c')]);_0x577f13['filters']=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],_0x577f13[_0xf0ab('0x4c')]);_0x3592f1[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4b91de['query'][_0xf0ab('0x50')]));_0x3592f1[_0xf0ab('0x51')]=_0x3592f1['attributes'][_0xf0ab('0x52')]?_0x3592f1['attributes']:_0x577f13[_0xf0ab('0x4b')];if(!_0x4b91de['query']['hasOwnProperty']('nolimit')){_0x3592f1[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x3592f1[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x3592f1[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x3592f1[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x4b91de[_0xf0ab('0x4c')],_0x577f13[_0xf0ab('0x4e')]));_0x3592f1['where'][_0xf0ab('0x10d')]=_0x43c6b8['id'];if(_0x4b91de['query'][_0xf0ab('0x8d')]){_0x3592f1['where']=_[_0xf0ab('0x39')](_0x3592f1[_0xf0ab('0x83')],{'$or':_[_0xf0ab('0x3f')](_0x3592f1['attributes'],function(_0x58f64c){var _0x5dc7d4={};_0x5dc7d4[_0x58f64c]={'$like':'%'+_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x8d')]+'%'};return _0x5dc7d4;})});}_0x3592f1['where'][_0xf0ab('0xfc')]=![];if(_0x4b91de[_0xf0ab('0x4c')]['id']){_0x3592f1[_0xf0ab('0x83')]['id']={'$gt':_0x4b91de[_0xf0ab('0x4c')]['id']};}_0x3592f1=_['merge']({},_0x3592f1,_0x4b91de['options']);return db[_0xf0ab('0xd0')][_0xf0ab('0x31')]({'where':_0x3592f1[_0xf0ab('0x83')]})[_0xf0ab('0x21')](function(_0x2ab983){_0x2f99c2['count']=_0x2ab983;_0x3592f1[_0xf0ab('0xbb')]=[];if(_0x4b91de['query'][_0xf0ab('0x111')]){_0x3592f1[_0xf0ab('0xbb')][_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id',_0xf0ab('0x40'),_0xf0ab('0xf7')]});}if(_0x4b91de[_0xf0ab('0x4c')]['includeAll']){_0x3592f1[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x3592f1);})[_0xf0ab('0x21')](function(_0x3d70c0){_0x2f99c2[_0xf0ab('0xb8')]=_0x3d70c0;return _0x2f99c2;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x3a602f,_0x3592f1))[_0xf0ab('0x46')](handleError(_0x3a602f,null));};exports['addTags']=function(_0x4d10af,_0x5cf4bd,_0x368523){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x4d10af['params']['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x5cf4bd,null))[_0xf0ab('0x21')](function(_0x46a38a){if(_0x46a38a){return _0x46a38a[_0xf0ab('0x112')](_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_['omit'](_0x4d10af[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{})[_0xf0ab('0x113')](function(){return db['Tag'][_0xf0ab('0x10f')]({'attributes':['id',_0xf0ab('0x37'),_0xf0ab('0x59')],'where':{'id':_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')]}});})[_0xf0ab('0x21')](function(_0x1df97b){socket[_0xf0ab('0x114')](_0xf0ab('0x115'),{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]});return{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]};});}})[_0xf0ab('0x21')](respondWithResult(_0x5cf4bd,null))['catch'](handleError(_0x5cf4bd,null));};exports[_0xf0ab('0x116')]=function(_0x3ca465,_0x4e379d,_0x122e66){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3ca465[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x4e379d,null))[_0xf0ab('0x21')](function(_0x5c56e0){if(_0x5c56e0){return _0x5c56e0[_0xf0ab('0x116')](_0x3ca465[_0xf0ab('0x4c')][_0xf0ab('0x10a')]);}})['then'](respondWithStatusCode(_0x4e379d,null))[_0xf0ab('0x46')](handleError(_0x4e379d,null));};exports[_0xf0ab('0xe7')]=function(_0x2baa40,_0x4ff52d){var _0x2a2fea=moment()[_0xf0ab('0x117')]()[_0xf0ab('0xa0')]();var _0x4eccbd=path['join'](config['root'],_0xf0ab('0x118'),_0xf0ab('0x119'),_0xf0ab('0x11a'));var _0x5b6475=path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],'server',_0xf0ab('0x119'),_0xf0ab('0x11c'));var _0x595bda=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2a2fea);var _0x2bd3e3=util['format']('transcript-%d-%s.zip',_0x2baa40[_0xf0ab('0xbd')]['id'],_0x2a2fea);var _0x25242e=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2bd3e3);var _0x3d8794=[];_0x3d8794[_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id','fullname'],'raw':!![]});_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xed')],'as':_0xf0ab('0x70'),'attributes':['id','firstName',_0xf0ab('0x11d')],'raw':!![]});if(_0x2baa40[_0xf0ab('0x4c')][_0xf0ab('0x11c')]){_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xe0')],'as':'Attachment','raw':!![]});}var _0x243763=[{'model':db[_0xf0ab('0xd0')],'as':_0xf0ab('0xee'),'attributes':['id',_0xf0ab('0x3a'),'createdAt',_0xf0ab('0xfb'),_0xf0ab('0xfc'),_0xf0ab('0x88')],'include':_0x3d8794}];_0x243763['push']({'model':db[_0xf0ab('0xbf')],'as':_0xf0ab('0x11e'),'attributes':['id',_0xf0ab('0x37')]});_0x243763['push']({'model':db[_0xf0ab('0xec')],'as':_0xf0ab('0x11f'),'attributes':['id',_0xf0ab('0x40')]});return db[_0xf0ab('0xa1')]['find']({'where':{'id':_0x2baa40[_0xf0ab('0xbd')]['id']},'include':_0x243763})[_0xf0ab('0x21')](handleEntityNotFound(_0x4ff52d,null))[_0xf0ab('0x21')](function(_0x2c2e20){if(_0x2c2e20){var _0x57bd77=_0x2c2e20[_0xf0ab('0x120')]({'plain':!![]});fs[_0xf0ab('0x121')](_0x595bda);var _0x169b02={'channel':_0xf0ab('0x122'),'account':_0x57bd77[_0xf0ab('0x11e')]['name'],'agent':_0x57bd77[_0xf0ab('0x11f')]?_0x57bd77['Owner'][_0xf0ab('0x40')]:_0xf0ab('0x123'),'createdAt':moment(_0x57bd77[_0xf0ab('0xf9')])['format'](_0xf0ab('0x10e'))['toString'](),'closedAt':_0x57bd77['closed']?moment(_0x57bd77['closedAt'])[_0xf0ab('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x57bd77[_0xf0ab('0xda')],'chatInfo':{'browser':_0x57bd77[_0xf0ab('0x124')],'os':_0x57bd77[_0xf0ab('0x125')],'referer':_0x57bd77[_0xf0ab('0x126')],'customerIp':_0x57bd77[_0xf0ab('0x127')],'customerPort':_0x57bd77['customerPort']?_0x57bd77[_0xf0ab('0x128')]:_0xf0ab('0x123')},'messages':_(_0x57bd77['Messages'])[_0xf0ab('0x129')]()[_0xf0ab('0x8d')]({'secret':![]})[_0xf0ab('0x3f')](function(_0x2aa512){if(_0x2aa512['Attachment']){var _0x26009e=path[_0xf0ab('0xe5')](_0x5b6475,_0x2aa512['Attachment'][_0xf0ab('0xdd')]);if(fs[_0xf0ab('0x12a')](_0x26009e)){fs['createReadStream'](_0x26009e)[_0xf0ab('0x12b')](fs[_0xf0ab('0x12c')](path['join'](_0x595bda,_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')])));}}return{'date':moment(_0x2aa512[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))['toString'](),'sender':_0x2aa512[_0xf0ab('0xfb')]==='out'?_0x2aa512[_0xf0ab('0xec')]?_0x2aa512['User'][_0xf0ab('0x40')]:_0xf0ab('0xf1'):_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x12d')]+(_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x11d')]?'\x20'+_0x2aa512[_0xf0ab('0x70')]['lastName']:''),'body':_0x2aa512[_0xf0ab('0xe0')]?_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')]:_0x2aa512[_0xf0ab('0x3a')],'direction':_0x2aa512[_0xf0ab('0xfb')]==='out'?'A':'C','secret':_0x2aa512[_0xf0ab('0xfc')],'read':_0x2aa512[_0xf0ab('0x88')],'attachment':_0x2aa512[_0xf0ab('0xe0')]};})[_0xf0ab('0x72')]()};return ejs['renderFile'](path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],_0xf0ab('0x118'),_0xf0ab('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x169b02})['then'](function(_0x3ad886){var _0x3df4a2=path['join'](_0x595bda,'transcript-'+_0x57bd77['id']+'-'+_0x2a2fea+_0xf0ab('0x12f'));var _0x378d44={'path':_0x3df4a2,'channel':_0xf0ab('0x122'),'interactionId':_0x57bd77['id']};return pdf[_0xf0ab('0x130')](_0x3ad886,_0x378d44);})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x1e4acb,_0x25a1eb){zipdir(_0x595bda,{'saveTo':_0x25242e},function(_0x406090,_0x414d09){if(_0x406090)return _0x25a1eb(_0x406090);return _0x1e4acb(_0x414d09);});})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x235528,_0x581c80){rimraf(_0x595bda,function(_0x14332a){if(_0x14332a)_0x581c80(_0x14332a);return _0x235528();});});})[_0xf0ab('0x21')](function(){return _0x4ff52d[_0xf0ab('0xe7')](_0x25242e,_0x2bd3e3,function(_0x4f9211){if(_0x4f9211){console[_0xf0ab('0x131')](_0xf0ab('0x132'),_0x4f9211);}else{fs[_0xf0ab('0x133')](_0x25242e);}});});});}else{return _0x4ff52d['sendStatus'](0xc8);}})[_0xf0ab('0x46')](handleError(_0x4ff52d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9d0d4f0..d14cab6 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 _0xc15f=['ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x50efaa,_0x538e9f){var _0x3f7845=function(_0x53605e){while(--_0x53605e){_0x50efaa['push'](_0x50efaa['shift']());}};_0x3f7845(++_0x538e9f);}(_0xc15f,0x84));var _0xfc15=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0xc15f[_0x152fe3];return _0xc5bb39;};'use strict';var EventEmitter=require(_0xfc15('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xfc15('0x1')];var ChatMessage=require(_0xfc15('0x2'))['db'][_0xfc15('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xfc15('0x4')](0x0);var events={'afterCreate':_0xfc15('0x5'),'afterUpdate':'update','afterDestroy':_0xfc15('0x6')};function emitEvent(_0x2aa00e){return function(_0x4c79ed,_0x38b27f,_0x3dfb84){_0x4c79ed['getUsers']({'attributes':['id'],'raw':!![]})[_0xfc15('0x7')](function(_0x82468d){_0x4c79ed[_0xfc15('0x8')](_0xfc15('0x9'),_0x82468d[_0xfc15('0xa')](function(_0x21cf4a){return{'id':_0x21cf4a['id']};}));return ChatMessage[_0xfc15('0xb')]({'where':{'ChatInteractionId':_0x4c79ed['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfc15('0x7')](function(_0x4c2572){_0x4c79ed[_0xfc15('0x8')](_0xfc15('0xc'),_0x4c2572[_0xfc15('0xd')]);ChatInteractionEvents[_0xfc15('0xe')](_0x2aa00e+':'+_0x4c79ed['id'],_0x4c79ed);ChatInteractionEvents['emit'](_0x2aa00e,_0x4c79ed);_0x3dfb84(null);})[_0xfc15('0xf')](_0x3dfb84(null));};}for(var e in events){if(events[_0xfc15('0x10')](e)){var event=events[e];ChatInteraction[_0xfc15('0x11')](e,emitEvent(event));}}module[_0xfc15('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0xe47b=['setMaxListeners','save','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','exports','events','ChatInteraction','../../mysqldb','ChatMessage'];(function(_0x1376e1,_0x2b7901){var _0x4c9efe=function(_0x2c7f61){while(--_0x2c7f61){_0x1376e1['push'](_0x1376e1['shift']());}};_0x4c9efe(++_0x2b7901);}(_0xe47b,0x12c));var _0xbe47=function(_0x4d4d64,_0x1984e8){_0x4d4d64=_0x4d4d64-0x0;var _0x25cbd8=_0xe47b[_0x4d4d64];return _0x25cbd8;};'use strict';var EventEmitter=require(_0xbe47('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xbe47('0x1')];var ChatMessage=require(_0xbe47('0x2'))['db'][_0xbe47('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xbe47('0x4')](0x0);var events={'afterCreate':_0xbe47('0x5'),'afterUpdate':'update','afterDestroy':_0xbe47('0x6')};function emitEvent(_0xb58b0a){return function(_0x885c1,_0x280cb3,_0x9d8f61){_0x885c1[_0xbe47('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x37f405){_0x885c1[_0xbe47('0x8')](_0xbe47('0x9'),_0x37f405['map'](function(_0x58c841){return{'id':_0x58c841['id']};}));return ChatMessage[_0xbe47('0xa')]({'where':{'ChatInteractionId':_0x885c1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbe47('0xb')](function(_0x28f971){_0x885c1['setDataValue'](_0xbe47('0xc'),_0x28f971[_0xbe47('0xd')]);ChatInteractionEvents['emit'](_0xb58b0a+':'+_0x885c1['id'],_0x885c1);ChatInteractionEvents[_0xbe47('0xe')](_0xb58b0a,_0x885c1);_0x9d8f61(null);})['catch'](_0x9d8f61(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xbe47('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ca08c50..94853ea 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 _0x44d5=['closedAt','format','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x49e946,_0x33cda8){var _0x207604=function(_0x5c0525){while(--_0x5c0525){_0x49e946['push'](_0x49e946['shift']());}};_0x207604(++_0x33cda8);}(_0x44d5,0xdb));var _0x544d=function(_0x62f1a2,_0x7d84cb){_0x62f1a2=_0x62f1a2-0x0;var _0x137fb0=_0x44d5[_0x62f1a2];return _0x137fb0;};'use strict';var _=require(_0x544d('0x0'));var util=require('util');var logger=require(_0x544d('0x1'))('api');var moment=require(_0x544d('0x2'));var BPromise=require(_0x544d('0x3'));var rp=require(_0x544d('0x4'));var fs=require('fs');var path=require(_0x544d('0x5'));var rimraf=require(_0x544d('0x6'));var config=require(_0x544d('0x7'));var attributes=require(_0x544d('0x8'));module[_0x544d('0x9')]=function(_0x3651d9,_0x232649){return _0x3651d9[_0x544d('0xa')](_0x544d('0xb'),attributes,{'tableName':_0x544d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x305730,_0x137c1d,_0x2089bd){if(_0x305730[_0x544d('0xd')](_0x544d('0xe'))){_0x305730[_0x544d('0xf')]=moment()[_0x544d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2089bd(null,_0x305730);}},'charset':'utf8mb4','collate':_0x544d('0x11')});}; \ No newline at end of file +var _0xdc5d=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0xdc5d,0x16e));var _0xddc5=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0xdc5d[_0x4f0e62];return _0x117ab8;};'use strict';var _=require('lodash');var util=require(_0xddc5('0x0'));var logger=require(_0xddc5('0x1'))(_0xddc5('0x2'));var moment=require(_0xddc5('0x3'));var BPromise=require('bluebird');var rp=require(_0xddc5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xddc5('0x5'));var config=require(_0xddc5('0x6'));var attributes=require(_0xddc5('0x7'));module[_0xddc5('0x8')]=function(_0x37ecf7,_0x37d174){return _0x37ecf7[_0xddc5('0x9')](_0xddc5('0xa'),attributes,{'tableName':_0xddc5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc72038,_0x482938,_0x5a2644){if(_0xc72038[_0xddc5('0xc')](_0xddc5('0xd'))){_0xc72038[_0xddc5('0xe')]=moment()[_0xddc5('0xf')](_0xddc5('0x10'));}_0x5a2644(null,_0xc72038);}},'charset':_0xddc5('0x11'),'collate':_0xddc5('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 96ee067..67a379e 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 _0x843b=['AddTagsToChatInteraction','find','addTags','body','ids','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','stringify','catch'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x843b,0x18c));var _0xb843=function(_0x22ae48,_0x5a0968){_0x22ae48=_0x22ae48-0x0;var _0x215af8=_0x843b[_0x22ae48];return _0x215af8;};'use strict';var _=require('lodash');var util=require(_0xb843('0x0'));var moment=require('moment');var BPromise=require(_0xb843('0x1'));var rs=require(_0xb843('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb843('0x3'))['db'];var utils=require(_0xb843('0x4'));var logger=require(_0xb843('0x5'))(_0xb843('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb843('0x7')][_0xb843('0x8')]({'port':0x232a});config[_0xb843('0x9')]=_[_0xb843('0xa')](config[_0xb843('0x9')],{'host':_0xb843('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb843('0xc'))[_0xb843('0xd')](socket);function respondWithRpcPromise(_0x23f06b,_0x3429c6,_0x4325ad){return new BPromise(function(_0x4e45b1,_0x8f0b41){return client['request'](_0x23f06b,_0x4325ad)[_0xb843('0xe')](function(_0x4a6ca4){logger[_0xb843('0xf')](_0xb843('0x10'),_0x3429c6,_0xb843('0x11'));logger[_0xb843('0x12')](_0xb843('0x13'),_0x3429c6,_0xb843('0x11'),JSON['stringify'](_0x4a6ca4));if(_0x4a6ca4[_0xb843('0x14')]){if(_0x4a6ca4[_0xb843('0x14')]['code']===0x1f4){logger['error'](_0xb843('0x10'),_0x3429c6,_0x4a6ca4['error'][_0xb843('0x15')]);return _0x8f0b41(_0x4a6ca4['error']['message']);}logger[_0xb843('0x14')](_0xb843('0x10'),_0x3429c6,_0x4a6ca4[_0xb843('0x14')][_0xb843('0x15')]);return _0x4e45b1(_0x4a6ca4[_0xb843('0x14')][_0xb843('0x15')]);}else{logger[_0xb843('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x3429c6,_0xb843('0x11'));_0x4e45b1(_0x4a6ca4[_0xb843('0x16')]['message']);}})['catch'](function(_0x37dff5){logger[_0xb843('0x14')](_0xb843('0x10'),_0x3429c6,_0x37dff5);_0x8f0b41(_0x37dff5);});});}exports[_0xb843('0x17')]=function(_0x409b70){var _0xfc9957=this;return new Promise(function(_0x2022b7,_0x423ee6){return db[_0xb843('0x18')][_0xb843('0x19')](_0x409b70['body'],{'raw':_0x409b70[_0xb843('0x1a')]?_0x409b70[_0xb843('0x1a')][_0xb843('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x409b70[_0xb843('0x1a')]?_0x409b70[_0xb843('0x1a')][_0xb843('0x1c')]||null:null,'attributes':_0x409b70[_0xb843('0x1a')]?_0x409b70[_0xb843('0x1a')][_0xb843('0x1d')]||null:null,'limit':_0x409b70[_0xb843('0x1a')]?_0x409b70[_0xb843('0x1a')][_0xb843('0x1e')]||null:null})[_0xb843('0xe')](function(_0x154168){logger[_0xb843('0xf')](_0xb843('0x17'),_0x409b70);logger['debug'](_0xb843('0x17'),_0x409b70,JSON[_0xb843('0x1f')](_0x154168));_0x2022b7(_0x154168);})[_0xb843('0x20')](function(_0xe65a40){logger[_0xb843('0x14')](_0xb843('0x17'),_0xe65a40['message'],_0x409b70);_0x423ee6(_0xfc9957['error'](0x1f4,_0xe65a40['message']));});});};exports[_0xb843('0x21')]=function(_0x4cad07){return new Promise(function(_0x226d3a,_0x3db3cd){return db[_0xb843('0x18')][_0xb843('0x22')]({'where':_0x4cad07['options']?_0x4cad07['options']['where']||null:null})['then'](function(_0x30826d){if(_0x30826d){return _0x30826d[_0xb843('0x23')](_0x4cad07[_0xb843('0x24')]['ids'],_['omit'](_0x4cad07[_0xb843('0x24')],[_0xb843('0x25'),'id'])||{});}})['spread'](function(_0x40ebd8){logger[_0xb843('0xf')](_0xb843('0x26'),_0x4cad07);logger['debug'](_0xb843('0x26'),_0x4cad07,JSON['stringify'](_0x40ebd8));_0x226d3a(_0x40ebd8);})[_0xb843('0x20')](function(_0x144f1f){logger['error'](_0xb843('0x26'),_0x144f1f[_0xb843('0x15')],_0x4cad07);_0x3db3cd(_this[_0xb843('0x14')](0x1f4,_0x144f1f[_0xb843('0x15')]));});});}; \ No newline at end of file +var _0x184b=['message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc70154,_0x18ca26){var _0x487c81=function(_0x467414){while(--_0x467414){_0xc70154['push'](_0xc70154['shift']());}};_0x487c81(++_0x18ca26);}(_0x184b,0x147));var _0xb184=function(_0x3c7310,_0x151024){_0x3c7310=_0x3c7310-0x0;var _0x577187=_0x184b[_0x3c7310];return _0x577187;};'use strict';var _=require(_0xb184('0x0'));var util=require(_0xb184('0x1'));var moment=require(_0xb184('0x2'));var BPromise=require(_0xb184('0x3'));var rs=require(_0xb184('0x4'));var fs=require('fs');var Redis=require(_0xb184('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb184('0x6'));var config=require('../../config/environment');var jayson=require(_0xb184('0x7'));var client=jayson[_0xb184('0x8')][_0xb184('0x9')]({'port':0x232a});config[_0xb184('0xa')]=_[_0xb184('0xb')](config[_0xb184('0xa')],{'host':_0xb184('0xc'),'port':0x18eb});var socket=require(_0xb184('0xd'))(new Redis(config[_0xb184('0xa')]));require(_0xb184('0xe'))[_0xb184('0xf')](socket);function respondWithRpcPromise(_0x28cc96,_0x33dc31,_0x298a74){return new BPromise(function(_0x24e9a1,_0x2b692e){return client[_0xb184('0x10')](_0x28cc96,_0x298a74)[_0xb184('0x11')](function(_0x43f806){logger[_0xb184('0x12')](_0xb184('0x13'),_0x33dc31,_0xb184('0x14'));logger['debug'](_0xb184('0x15'),_0x33dc31,'request\x20sent',JSON[_0xb184('0x16')](_0x43f806));if(_0x43f806[_0xb184('0x17')]){if(_0x43f806[_0xb184('0x17')][_0xb184('0x18')]===0x1f4){logger[_0xb184('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x33dc31,_0x43f806[_0xb184('0x17')][_0xb184('0x19')]);return _0x2b692e(_0x43f806[_0xb184('0x17')]['message']);}logger[_0xb184('0x17')](_0xb184('0x13'),_0x33dc31,_0x43f806['error'][_0xb184('0x19')]);return _0x24e9a1(_0x43f806['error']['message']);}else{logger[_0xb184('0x12')](_0xb184('0x13'),_0x33dc31,_0xb184('0x14'));_0x24e9a1(_0x43f806[_0xb184('0x1a')][_0xb184('0x19')]);}})['catch'](function(_0x59799b){logger[_0xb184('0x17')](_0xb184('0x13'),_0x33dc31,_0x59799b);_0x2b692e(_0x59799b);});});}exports[_0xb184('0x1b')]=function(_0x17a87b){var _0x37b2a8=this;return new Promise(function(_0x161c8a,_0x25a475){return db[_0xb184('0x1c')][_0xb184('0x1d')](_0x17a87b[_0xb184('0x1e')],{'raw':_0x17a87b[_0xb184('0x1f')]?_0x17a87b[_0xb184('0x1f')][_0xb184('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17a87b[_0xb184('0x1f')]?_0x17a87b['options'][_0xb184('0x21')]||null:null,'attributes':_0x17a87b[_0xb184('0x1f')]?_0x17a87b[_0xb184('0x1f')][_0xb184('0x22')]||null:null,'limit':_0x17a87b[_0xb184('0x1f')]?_0x17a87b[_0xb184('0x1f')][_0xb184('0x23')]||null:null})['then'](function(_0x18c8ab){logger[_0xb184('0x12')](_0xb184('0x1b'),_0x17a87b);logger['debug'](_0xb184('0x1b'),_0x17a87b,JSON[_0xb184('0x16')](_0x18c8ab));_0x161c8a(_0x18c8ab);})[_0xb184('0x24')](function(_0x2ac8ba){logger[_0xb184('0x17')](_0xb184('0x1b'),_0x2ac8ba[_0xb184('0x19')],_0x17a87b);_0x25a475(_0x37b2a8['error'](0x1f4,_0x2ac8ba[_0xb184('0x19')]));});});};exports[_0xb184('0x25')]=function(_0x12b7d7){return new Promise(function(_0x364891,_0x593b0b){return db[_0xb184('0x1c')][_0xb184('0x26')]({'where':_0x12b7d7[_0xb184('0x1f')]?_0x12b7d7['options'][_0xb184('0x21')]||null:null})['then'](function(_0x56cc7a){if(_0x56cc7a){return _0x56cc7a['addTags'](_0x12b7d7[_0xb184('0x1e')][_0xb184('0x27')],_[_0xb184('0x28')](_0x12b7d7[_0xb184('0x1e')],[_0xb184('0x27'),'id'])||{});}})[_0xb184('0x29')](function(_0x3cb08){logger[_0xb184('0x12')]('AddTags',_0x12b7d7);logger[_0xb184('0x2a')](_0xb184('0x2b'),_0x12b7d7,JSON['stringify'](_0x3cb08));_0x364891(_0x3cb08);})[_0xb184('0x24')](function(_0x95292d){logger[_0xb184('0x17')](_0xb184('0x2b'),_0x95292d[_0xb184('0x19')],_0x12b7d7);_0x593b0b(_this[_0xb184('0x17')](0x1f4,_0x95292d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 09a857a..ec59dc2 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 _0x2636=['./chatInteraction.events','save','emit','removeListener','register','length','chatInteraction:'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2636,0x1c0));var _0x6263=function(_0x4f7e4c,_0x14756a){_0x4f7e4c=_0x4f7e4c-0x0;var _0x356a6a=_0x2636[_0x4f7e4c];return _0x356a6a;};'use strict';var ChatInteractionEvents=require(_0x6263('0x0'));var events=[_0x6263('0x1'),'remove','update'];function createListener(_0x49c945,_0x88fd00){return function(_0x3c036c){_0x88fd00[_0x6263('0x2')](_0x49c945,_0x3c036c);};}function removeListener(_0x4f2180,_0x356757){return function(){ChatInteractionEvents[_0x6263('0x3')](_0x4f2180,_0x356757);};}exports[_0x6263('0x4')]=function(_0xa9eeae){for(var _0x9858e=0x0,_0x3a5ae5=events[_0x6263('0x5')];_0x9858e<_0x3a5ae5;_0x9858e++){var _0x221517=events[_0x9858e];var _0x45ef53=createListener(_0x6263('0x6')+_0x221517,_0xa9eeae);ChatInteractionEvents['on'](_0x221517,_0x45ef53);}}; \ No newline at end of file +var _0x0a24=['./chatInteraction.events','save','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x3733eb,_0x2d9450){var _0x4c80e3=function(_0x365bce){while(--_0x365bce){_0x3733eb['push'](_0x3733eb['shift']());}};_0x4c80e3(++_0x2d9450);}(_0x0a24,0xd0));var _0x40a2=function(_0x4b1eda,_0x1ca265){_0x4b1eda=_0x4b1eda-0x0;var _0x520e6b=_0x0a24[_0x4b1eda];return _0x520e6b;};'use strict';var ChatInteractionEvents=require(_0x40a2('0x0'));var events=[_0x40a2('0x1'),'remove',_0x40a2('0x2')];function createListener(_0x557f8b,_0x3665fb){return function(_0x1e56c7){_0x3665fb[_0x40a2('0x3')](_0x557f8b,_0x1e56c7);};}function removeListener(_0x513c2a,_0x465069){return function(){ChatInteractionEvents[_0x40a2('0x4')](_0x513c2a,_0x465069);};}exports[_0x40a2('0x5')]=function(_0x1abd02){for(var _0x535cca=0x0,_0x518597=events[_0x40a2('0x6')];_0x535cca<_0x518597;_0x535cca++){var _0x136c67=events[_0x535cca];var _0x5e62ef=createListener(_0x40a2('0x7')+_0x136c67,_0x1abd02);ChatInteractionEvents['on'](_0x136c67,_0x5e62ef);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0115287..ef9e36d 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 _0x113c=['tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','/:id/custom_update','customUpdate','put','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','post','create','createVidaooSession','root','server/files/attachments/','format','now','originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x113c,0x149));var _0xc113=function(_0x5279cf,_0x32f60d){_0x5279cf=_0x5279cf-0x0;var _0x5de6b1=_0x113c[_0x5279cf];return _0x5de6b1;};'use strict';var multer=require(_0xc113('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc113('0x1'));var express=require(_0xc113('0x2'));var router=express[_0xc113('0x3')]();var fs_extra=require(_0xc113('0x4'));var auth=require(_0xc113('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc113('0x6'));var controller=require(_0xc113('0x7'));router['get']('/',auth[_0xc113('0x8')](),controller[_0xc113('0x9')]);router['get'](_0xc113('0xa'),auth[_0xc113('0x8')](),controller[_0xc113('0xb')]);router[_0xc113('0xc')](_0xc113('0xd'),auth[_0xc113('0xe')](),controller[_0xc113('0xf')]);router[_0xc113('0xc')](_0xc113('0x10'),auth[_0xc113('0xe')](),controller[_0xc113('0x11')]);router[_0xc113('0xc')]('/:id/messages',auth[_0xc113('0x8')](),controller['getMessages']);router[_0xc113('0xc')](_0xc113('0x12'),auth[_0xc113('0xe')](),controller[_0xc113('0x13')]);router[_0xc113('0xc')](_0xc113('0x14'),auth[_0xc113('0x8')](),controller['download']);router[_0xc113('0x15')]('/',auth[_0xc113('0x8')](),controller[_0xc113('0x16')]);router[_0xc113('0x15')]('/:id/vidaoo',auth[_0xc113('0x8')](),controller[_0xc113('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1923c5,_0x301b46,_0x1a7921){_0x1a7921(null,path['join'](config[_0xc113('0x18')],_0xc113('0x19')));},'filename':function(_0x354930,_0x1e5ba5,_0x212695){_0x212695(null,util[_0xc113('0x1a')]('%s-%s',Date[_0xc113('0x1b')](),_0x1e5ba5[_0xc113('0x1c')][_0xc113('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xc113('0x1e')](_0xc113('0x1f')),controller[_0xc113('0x20')]);router[_0xc113('0x15')]('/:id/messages',auth[_0xc113('0xe')](),controller[_0xc113('0x21')]);router[_0xc113('0x15')](_0xc113('0x22'),auth['isAuthenticated'](),interaction[_0xc113('0x23')](_0xc113('0x24'),_0xc113('0x25')),controller[_0xc113('0x26')]);router['put'](_0xc113('0xd'),auth[_0xc113('0x8')](),interaction[_0xc113('0x23')](_0xc113('0x24'),_0xc113('0x27')),controller[_0xc113('0x28')]);router['put'](_0xc113('0x29'),controller[_0xc113('0x2a')]);router[_0xc113('0x2b')](_0xc113('0x2c'),auth[_0xc113('0xe')](),controller[_0xc113('0x2d')]);router[_0xc113('0x2b')](_0xc113('0x2e'),controller[_0xc113('0x2f')]);router[_0xc113('0x30')]('/:id',auth[_0xc113('0x8')](),interaction[_0xc113('0x23')]('chat',_0xc113('0x31')),controller[_0xc113('0x32')]);router[_0xc113('0x30')](_0xc113('0x22'),auth['isAuthenticated'](),controller['removeTags']);module[_0xc113('0x33')]=router; \ No newline at end of file +var _0x6f1e=['index','get','/describe','isAuthenticated','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','diskStorage','join','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/close','chatinteraction:destroy','destroy','delete','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x6f1e,0x190));var _0xe6f1=function(_0x2549b9,_0x5a5e71){_0x2549b9=_0x2549b9-0x0;var _0x36bd12=_0x6f1e[_0x2549b9];return _0x36bd12;};'use strict';var multer=require('multer');var util=require(_0xe6f1('0x0'));var path=require(_0xe6f1('0x1'));var timeout=require('connect-timeout');var express=require(_0xe6f1('0x2'));var router=express[_0xe6f1('0x3')]();var fs_extra=require(_0xe6f1('0x4'));var auth=require(_0xe6f1('0x5'));var interaction=require(_0xe6f1('0x6'));var config=require('../../config/environment');var controller=require(_0xe6f1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe6f1('0x8')]);router[_0xe6f1('0x9')](_0xe6f1('0xa'),auth[_0xe6f1('0xb')](),controller[_0xe6f1('0xc')]);router['get'](_0xe6f1('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xe6f1('0xe')]);router[_0xe6f1('0x9')]('/:id/attachment_download',auth[_0xe6f1('0xf')](),controller[_0xe6f1('0x10')]);router[_0xe6f1('0x9')](_0xe6f1('0x11'),auth[_0xe6f1('0xb')](),controller[_0xe6f1('0x12')]);router[_0xe6f1('0x9')](_0xe6f1('0x13'),auth[_0xe6f1('0xf')](),controller[_0xe6f1('0x14')]);router[_0xe6f1('0x9')](_0xe6f1('0x15'),auth[_0xe6f1('0xb')](),controller[_0xe6f1('0x16')]);router['post']('/',auth[_0xe6f1('0xb')](),controller[_0xe6f1('0x17')]);router[_0xe6f1('0x18')](_0xe6f1('0x19'),auth[_0xe6f1('0xb')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xe6f1('0x1a')]({'destination':function(_0x110ee6,_0x44a2e5,_0x3c8d7f){_0x3c8d7f(null,path[_0xe6f1('0x1b')](config['root'],_0xe6f1('0x1c')));},'filename':function(_0x35d503,_0x4492d8,_0x209c2c){_0x209c2c(null,util[_0xe6f1('0x1d')](_0xe6f1('0x1e'),Date[_0xe6f1('0x1f')](),_0x4492d8['originalname'][_0xe6f1('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe6f1('0x18')](_0xe6f1('0x21'),upload[_0xe6f1('0x22')](_0xe6f1('0x23')),controller['attachmentUpload']);router['post'](_0xe6f1('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xe6f1('0x24')]);router['post'](_0xe6f1('0x25'),auth[_0xe6f1('0xb')](),interaction[_0xe6f1('0x26')](_0xe6f1('0x27'),_0xe6f1('0x28')),controller['addTags']);router[_0xe6f1('0x29')]('/:id',auth[_0xe6f1('0xb')](),interaction[_0xe6f1('0x26')](_0xe6f1('0x27'),_0xe6f1('0x2a')),controller['update']);router['put'](_0xe6f1('0x2b'),controller[_0xe6f1('0x2c')]);router['put']('/:id/abandon',auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0xe6f1('0x29')](_0xe6f1('0x2d'),controller['close']);router['delete']('/:id',auth[_0xe6f1('0xb')](),interaction[_0xe6f1('0x26')](_0xe6f1('0x27'),_0xe6f1('0x2e')),controller[_0xe6f1('0x2f')]);router[_0xe6f1('0x30')](_0xe6f1('0x25'),auth[_0xe6f1('0xb')](),controller[_0xe6f1('0x31')]);module[_0xe6f1('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 0cdbcd0..bfa0890 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 _0x4ddf=['sequelize','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x10d951,_0x332957){var _0x1d78c4=function(_0x4e58bf){while(--_0x4e58bf){_0x10d951['push'](_0x10d951['shift']());}};_0x1d78c4(++_0x332957);}(_0x4ddf,0x19a));var _0xf4dd=function(_0x52ec89,_0x701c6d){_0x52ec89=_0x52ec89-0x0;var _0x368298=_0x4ddf[_0x52ec89];return _0x368298;};'use strict';var Sequelize=require(_0xf4dd('0x0'));module['exports']={'body':{'type':Sequelize[_0xf4dd('0x1')](_0xf4dd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf4dd('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf4dd('0x4')]}}; \ No newline at end of file +var _0x88e4=['medium','INTEGER','sequelize','TEXT'];(function(_0x233bd7,_0x1abbe6){var _0xd1cda1=function(_0x54885e){while(--_0x54885e){_0x233bd7['push'](_0x233bd7['shift']());}};_0xd1cda1(++_0x1abbe6);}(_0x88e4,0x6e));var _0x488e=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x88e4[_0x3d4ef1];return _0x409423;};'use strict';var Sequelize=require(_0x488e('0x0'));module['exports']={'body':{'type':Sequelize[_0x488e('0x1')](_0x488e('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x488e('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e88160a..b9bca13 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 _0x4658=['update','then','destroy','stack','name','map','ChatInternalMessage','rawAttributes','fieldName','key','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','body','params','messages','lastMessage','format','getUsers','User','agent','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','user','UserProfileSection','Agents','UserProfileResource','isEmpty','resourceId','push','filter','createdAt','FromId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4658,0xa9));var _0x8465=function(_0x7d5684,_0x44acfc){_0x7d5684=_0x7d5684-0x0;var _0x41490f=_0x4658[_0x7d5684];return _0x41490f;};'use strict';var emlformat=require(_0x8465('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8465('0x1'));var jsonpatch=require(_0x8465('0x2'));var rp=require(_0x8465('0x3'));var moment=require(_0x8465('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8465('0x5'));var util=require(_0x8465('0x6'));var path=require('path');var sox=require(_0x8465('0x7'));var csv=require(_0x8465('0x8'));var ejs=require(_0x8465('0x9'));var fs=require('fs');var fs_extra=require(_0x8465('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8465('0xb'));var jsforce=require(_0x8465('0xc'));var deskjs=require(_0x8465('0xd'));var toCsv=require(_0x8465('0x8'));var querystring=require(_0x8465('0xe'));var Papa=require(_0x8465('0xf'));var Redis=require('ioredis');var authService=require(_0x8465('0x10'));var qs=require(_0x8465('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8465('0x12'));var logger=require(_0x8465('0x13'))(_0x8465('0x14'));var utils=require(_0x8465('0x15'));var config=require(_0x8465('0x16'));var licenseUtil=require(_0x8465('0x17'));var db=require('../../mysqldb')['db'];config[_0x8465('0x18')]=_[_0x8465('0x19')](config[_0x8465('0x18')],{'host':_0x8465('0x1a'),'port':0x18eb});var socket=require(_0x8465('0x1b'))(new Redis(config[_0x8465('0x18')]));require('./chatInternalMessage.socket')[_0x8465('0x1c')](socket);function respondWithStatusCode(_0x26b953,_0x183dba){_0x183dba=_0x183dba||0xcc;return function(_0x2e5d92){if(_0x2e5d92){return _0x26b953[_0x8465('0x1d')](_0x183dba);}return _0x26b953['status'](_0x183dba)[_0x8465('0x1e')]();};}function respondWithResult(_0x2d02a7,_0x19237b){_0x19237b=_0x19237b||0xc8;return function(_0x45ebf1){if(_0x45ebf1){return _0x2d02a7[_0x8465('0x1f')](_0x19237b)[_0x8465('0x20')](_0x45ebf1);}};}function respondWithFilteredResult(_0x49f6cc,_0x52af04){return function(_0x401904){if(_0x401904){var _0x51de2a=typeof _0x52af04['offset']===_0x8465('0x21')&&typeof _0x52af04[_0x8465('0x22')]===_0x8465('0x21');var _0x248f8d=_0x401904[_0x8465('0x23')];var _0x58eaec=_0x51de2a?0x0:_0x52af04[_0x8465('0x24')];var _0x26e593=_0x51de2a?_0x401904[_0x8465('0x23')]:_0x52af04[_0x8465('0x24')]+_0x52af04[_0x8465('0x22')];var _0x31474c;if(_0x26e593>=_0x248f8d){_0x26e593=_0x248f8d;_0x31474c=0xc8;}else{_0x31474c=0xce;}_0x49f6cc[_0x8465('0x1f')](_0x31474c);return _0x49f6cc[_0x8465('0x25')](_0x8465('0x26'),_0x58eaec+'-'+_0x26e593+'/'+_0x248f8d)[_0x8465('0x20')](_0x401904);}return null;};}function patchUpdates(_0x191bf3){return function(_0x8df865){try{jsonpatch[_0x8465('0x27')](_0x8df865,_0x191bf3,!![]);}catch(_0x177764){return BPromise[_0x8465('0x28')](_0x177764);}return _0x8df865['save']();};}function saveUpdates(_0x2c4bab,_0x4e5a6e){return function(_0x58da8e){if(_0x58da8e){return _0x58da8e[_0x8465('0x29')](_0x2c4bab)[_0x8465('0x2a')](function(_0x4425e6){return _0x4425e6;});}return null;};}function removeEntity(_0x23d866,_0x18453e){return function(_0x45ca7a){if(_0x45ca7a){return _0x45ca7a[_0x8465('0x2b')]()[_0x8465('0x2a')](function(){_0x23d866[_0x8465('0x1f')](0xcc)[_0x8465('0x1e')]();});}};}function handleEntityNotFound(_0x4a6b66,_0x383836){return function(_0x2298ed){if(!_0x2298ed){_0x4a6b66[_0x8465('0x1d')](0x194);}return _0x2298ed;};}function handleError(_0x40f441,_0x350b0c){_0x350b0c=_0x350b0c||0x1f4;return function(_0x50bf3f){logger['error'](_0x50bf3f[_0x8465('0x2c')]);if(_0x50bf3f[_0x8465('0x2d')]){delete _0x50bf3f['name'];}_0x40f441[_0x8465('0x1f')](_0x350b0c)['send'](_0x50bf3f);};}exports['index']=function(_0xa51059,_0x1d842d){var _0x5d3b95={},_0x153188={},_0x5459df={'count':0x0,'rows':[]};var _0x44321b=_[_0x8465('0x2e')](db[_0x8465('0x2f')][_0x8465('0x30')],function(_0x2ce1b7){return{'name':_0x2ce1b7[_0x8465('0x31')],'type':_0x2ce1b7['type'][_0x8465('0x32')]};});_0x153188['model']=_['map'](_0x44321b,_0x8465('0x2d'));_0x153188[_0x8465('0x33')]=_['keys'](_0xa51059['query']);_0x153188[_0x8465('0x34')]=_['intersection'](_0x153188['model'],_0x153188['query']);_0x5d3b95[_0x8465('0x35')]=_[_0x8465('0x36')](_0x153188['model'],qs[_0x8465('0x37')](_0xa51059['query'][_0x8465('0x37')]));_0x5d3b95[_0x8465('0x35')]=_0x5d3b95[_0x8465('0x35')][_0x8465('0x38')]?_0x5d3b95[_0x8465('0x35')]:_0x153188[_0x8465('0x39')];if(!_0xa51059['query'][_0x8465('0x3a')](_0x8465('0x3b'))){_0x5d3b95[_0x8465('0x22')]=qs[_0x8465('0x22')](_0xa51059[_0x8465('0x33')][_0x8465('0x22')]);_0x5d3b95[_0x8465('0x24')]=qs['offset'](_0xa51059[_0x8465('0x33')][_0x8465('0x24')]);}_0x5d3b95[_0x8465('0x3c')]=qs[_0x8465('0x3d')](_0xa51059[_0x8465('0x33')]['sort']);_0x5d3b95['where']=qs['filters'](_['pick'](_0xa51059[_0x8465('0x33')],_0x153188['filters']),_0x44321b);if(_0xa51059[_0x8465('0x33')]['filter']){_0x5d3b95[_0x8465('0x3e')]=_[_0x8465('0x3f')](_0x5d3b95['where'],{'$or':_[_0x8465('0x2e')](_0x44321b,function(_0x894dc3){if(_0x894dc3[_0x8465('0x40')]!==_0x8465('0x41')){var _0x4bcf7a={};_0x4bcf7a[_0x894dc3[_0x8465('0x2d')]]={'$like':'%'+_0xa51059[_0x8465('0x33')]['filter']+'%'};return _0x4bcf7a;}})});}_0x5d3b95=_['merge']({},_0x5d3b95,_0xa51059[_0x8465('0x42')]);var _0x45b385={'where':_0x5d3b95[_0x8465('0x3e')]};return db[_0x8465('0x2f')][_0x8465('0x23')](_0x45b385)['then'](function(_0x511465){_0x5459df[_0x8465('0x23')]=_0x511465;if(_0xa51059[_0x8465('0x33')][_0x8465('0x43')]){_0x5d3b95[_0x8465('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x8465('0x45')](_0x5d3b95);})[_0x8465('0x2a')](function(_0x309812){_0x5459df[_0x8465('0x46')]=_0x309812;return _0x5459df;})[_0x8465('0x2a')](respondWithFilteredResult(_0x1d842d,_0x5d3b95))[_0x8465('0x47')](handleError(_0x1d842d,null));};exports[_0x8465('0x48')]=function(_0x7ba7fd,_0xa6d293){var _0x3706af={'raw':!![],'where':{'id':_0x7ba7fd['params']['id']}},_0x1cc36e={};_0x1cc36e[_0x8465('0x39')]=_[_0x8465('0x49')](db[_0x8465('0x2f')][_0x8465('0x30')]);_0x1cc36e[_0x8465('0x33')]=_['keys'](_0x7ba7fd['query']);_0x1cc36e[_0x8465('0x34')]=_['intersection'](_0x1cc36e[_0x8465('0x39')],_0x1cc36e[_0x8465('0x33')]);_0x3706af[_0x8465('0x35')]=_[_0x8465('0x36')](_0x1cc36e['model'],qs['fields'](_0x7ba7fd['query']['fields']));_0x3706af[_0x8465('0x35')]=_0x3706af[_0x8465('0x35')][_0x8465('0x38')]?_0x3706af[_0x8465('0x35')]:_0x1cc36e[_0x8465('0x39')];if(_0x7ba7fd[_0x8465('0x33')][_0x8465('0x43')]){_0x3706af[_0x8465('0x44')]=[{'all':!![]}];}_0x3706af=_['merge']({},_0x3706af,_0x7ba7fd[_0x8465('0x42')]);return db[_0x8465('0x2f')][_0x8465('0x4a')](_0x3706af)[_0x8465('0x2a')](handleEntityNotFound(_0xa6d293,null))[_0x8465('0x2a')](respondWithResult(_0xa6d293,null))[_0x8465('0x47')](handleError(_0xa6d293,null));};exports['create']=function(_0xde2c98,_0x3d470e){return db[_0x8465('0x2f')]['create'](_0xde2c98[_0x8465('0x4b')],{})['then'](respondWithResult(_0x3d470e,0xc9))['catch'](handleError(_0x3d470e,null));};exports[_0x8465('0x29')]=function(_0x5dc31d,_0x369844){if(_0x5dc31d['body']['id']){delete _0x5dc31d[_0x8465('0x4b')]['id'];}return db['ChatInternalMessage'][_0x8465('0x4a')]({'where':{'id':_0x5dc31d[_0x8465('0x4c')]['id']}})[_0x8465('0x2a')](handleEntityNotFound(_0x369844,null))['then'](saveUpdates(_0x5dc31d['body'],null))[_0x8465('0x2a')](respondWithResult(_0x369844,null))[_0x8465('0x47')](handleError(_0x369844,null));};exports['destroy']=function(_0x4f9f9a,_0x4fcc22){return db[_0x8465('0x2f')][_0x8465('0x4a')]({'where':{'id':_0x4f9f9a[_0x8465('0x4c')]['id']}})[_0x8465('0x2a')](handleEntityNotFound(_0x4fcc22,null))['then'](removeEntity(_0x4fcc22,null))[_0x8465('0x47')](handleError(_0x4fcc22,null));};exports['describe']=function(_0x4938e6,_0x515839){return db[_0x8465('0x2f')]['describe']()[_0x8465('0x2a')](respondWithResult(_0x515839,null))[_0x8465('0x47')](handleError(_0x515839,null));};function wrapUser(_0x2f8fc7){return function(_0x339525){var _0x3a1997=_0x2f8fc7['get']({'plain':!![]});_0x3a1997[_0x8465('0x4d')]=[];if(_0x339525){_0x3a1997['lastMessageAt']=_0x339525['createdAt'];_0x3a1997[_0x8465('0x4e')]=_0x339525;}else{_0x3a1997['lastMessageAt']=moment(0x0)[_0x8465('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a1997[_0x8465('0x4e')]={};}return _0x3a1997;};}exports[_0x8465('0x50')]=function(_0xee1863,_0x39aeb3,_0x1d4c0c){var _0x54cf17=[];return db[_0x8465('0x51')]['findAll']({'where':{'role':[_0x8465('0x52'),'admin','user']},'attributes':['id',_0x8465('0x53'),_0x8465('0x2d'),_0x8465('0x54'),_0x8465('0x55'),_0x8465('0x56'),_0x8465('0x57'),'lastLoginAt',_0x8465('0x58'),_0x8465('0x59')],'order':qs[_0x8465('0x3d')](_0x8465('0x5a')),'include':[{'model':db[_0x8465('0x5b')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x8465('0x2a')](function(_0x3d18ab){if(_0x3d18ab){var _0x49ba1d=_0xee1863[_0x8465('0x5c')]['get']({'plain':!![]});if(!_0x49ba1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49ba1d[_0x8465('0x54')]===_0x8465('0x5c')){return db[_0x8465('0x5d')][_0x8465('0x4a')]({'where':{'name':_0x8465('0x5e'),'userProfileId':_0x49ba1d['userProfileId']},'raw':!![]})[_0x8465('0x2a')](function(_0x1511b3){if(_0x1511b3){if(_0x1511b3['autoAssociation']===0x0){return db[_0x8465('0x5f')][_0x8465('0x45')]({'where':{'sectionId':_0x1511b3['id']},'raw':!![]})[_0x8465('0x2a')](function(_0x11391d){var _0x283fee=[];if(_[_0x8465('0x60')](_0x11391d)){_0x283fee=_['filter'](_0x3d18ab,function(_0x2a76d8){if(_0x2a76d8[_0x8465('0x54')]!==_0x8465('0x52')){return _0x2a76d8;}});return _0x283fee;}else{for(var _0x1e69d2=0x0;_0x1e69d2<_0x3d18ab[_0x8465('0x38')];_0x1e69d2++){var _0x5ebdd1=_0x3d18ab[_0x1e69d2];if(_0x5ebdd1['role']==='agent'){var _0x588046=_[_0x8465('0x4a')](_0x11391d,function(_0x23f476){return _0x23f476[_0x8465('0x61')]===_0x5ebdd1['id'];});if(_0x588046)_0x283fee['push'](_0x5ebdd1);}else{_0x283fee[_0x8465('0x62')](_0x5ebdd1);}}return _0x283fee;}});}else{return _0x3d18ab;}}else{var _0x338fda=_[_0x8465('0x63')](_0x3d18ab,function(_0x3060c3){if(_0x3060c3[_0x8465('0x54')]!==_0x8465('0x52')){return _0x3060c3;}});return _0x338fda;}});}else{return _0x3d18ab;}}})['then'](function(_0xd5f47b){var _0x24cd53=[];if(_0xd5f47b){_0x54cf17=_0xd5f47b;for(var _0x3af894=0x0;_0x3af894<_0xd5f47b[_0x8465('0x38')];_0x3af894+=0x1){_0x54cf17[_0x3af894][_0x8465('0x4d')]=[];_0x24cd53['push'](db[_0x8465('0x2f')]['find']({'where':{'FromId':[_0xee1863['user']['id'],_0xd5f47b[_0x3af894]['id']],'ToId':[_0xee1863[_0x8465('0x5c')]['id'],_0xd5f47b[_0x3af894]['id']],'ChatGroupId':null},'attributes':['id',_0x8465('0x64'),_0x8465('0x65'),'ToId',_0x8465('0x66'),_0x8465('0x4b')],'order':qs[_0x8465('0x3d')](_0x8465('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8465('0x2a')](wrapUser(_0xd5f47b[_0x3af894])));}return BPromise[_0x8465('0x68')](_0x24cd53);}return[];})[_0x8465('0x2a')](function(_0x2b6ce7){return{'rows':_0x2b6ce7,'count':_0x2b6ce7[_0x8465('0x38')]};})['then'](respondWithResult(_0x39aeb3,null))[_0x8465('0x47')](handleError(_0x39aeb3,null));}; \ No newline at end of file +var _0x2744=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','intersection','find','body','destroy','describe','get','messages','lastMessageAt','getUsers','User','admin','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','isEmpty','agent','push','createdAt','FromId','ToId','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','type','map','keys','filters','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x69560,_0x237e9f){var _0x481461=function(_0x6125f4){while(--_0x6125f4){_0x69560['push'](_0x69560['shift']());}};_0x481461(++_0x237e9f);}(_0x2744,0x170));var _0x4274=function(_0x37125c,_0x3f2dc2){_0x37125c=_0x37125c-0x0;var _0x249a4c=_0x2744[_0x37125c];return _0x249a4c;};'use strict';var emlformat=require(_0x4274('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4274('0x1'));var jsonpatch=require(_0x4274('0x2'));var rp=require(_0x4274('0x3'));var moment=require(_0x4274('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4274('0x5'));var util=require(_0x4274('0x6'));var path=require(_0x4274('0x7'));var sox=require(_0x4274('0x8'));var csv=require('to-csv');var ejs=require(_0x4274('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4274('0xa'));var squel=require(_0x4274('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4274('0xc'));var toCsv=require(_0x4274('0xd'));var querystring=require(_0x4274('0xe'));var Papa=require(_0x4274('0xf'));var Redis=require(_0x4274('0x10'));var authService=require(_0x4274('0x11'));var qs=require(_0x4274('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4274('0x13'));var logger=require('../../config/logger')(_0x4274('0x14'));var utils=require(_0x4274('0x15'));var config=require(_0x4274('0x16'));var licenseUtil=require(_0x4274('0x17'));var db=require(_0x4274('0x18'))['db'];config[_0x4274('0x19')]=_[_0x4274('0x1a')](config[_0x4274('0x19')],{'host':_0x4274('0x1b'),'port':0x18eb});var socket=require(_0x4274('0x1c'))(new Redis(config['redis']));require(_0x4274('0x1d'))[_0x4274('0x1e')](socket);function respondWithStatusCode(_0x2a7fb9,_0x499c2a){_0x499c2a=_0x499c2a||0xcc;return function(_0x56efb7){if(_0x56efb7){return _0x2a7fb9['sendStatus'](_0x499c2a);}return _0x2a7fb9[_0x4274('0x1f')](_0x499c2a)[_0x4274('0x20')]();};}function respondWithResult(_0x60e3e9,_0x11fb0b){_0x11fb0b=_0x11fb0b||0xc8;return function(_0x5b4ae0){if(_0x5b4ae0){return _0x60e3e9[_0x4274('0x1f')](_0x11fb0b)[_0x4274('0x21')](_0x5b4ae0);}};}function respondWithFilteredResult(_0x5a383b,_0x3906fd){return function(_0x57f4f9){if(_0x57f4f9){var _0x488f21=typeof _0x3906fd[_0x4274('0x22')]===_0x4274('0x23')&&typeof _0x3906fd['limit']==='undefined';var _0xb6d5db=_0x57f4f9[_0x4274('0x24')];var _0x209a5f=_0x488f21?0x0:_0x3906fd['offset'];var _0x7b597c=_0x488f21?_0x57f4f9[_0x4274('0x24')]:_0x3906fd[_0x4274('0x22')]+_0x3906fd[_0x4274('0x25')];var _0x1f5b2;if(_0x7b597c>=_0xb6d5db){_0x7b597c=_0xb6d5db;_0x1f5b2=0xc8;}else{_0x1f5b2=0xce;}_0x5a383b[_0x4274('0x1f')](_0x1f5b2);return _0x5a383b[_0x4274('0x26')](_0x4274('0x27'),_0x209a5f+'-'+_0x7b597c+'/'+_0xb6d5db)['json'](_0x57f4f9);}return null;};}function patchUpdates(_0x3e98ab){return function(_0x36082a){try{jsonpatch[_0x4274('0x28')](_0x36082a,_0x3e98ab,!![]);}catch(_0x1abe20){return BPromise['reject'](_0x1abe20);}return _0x36082a['save']();};}function saveUpdates(_0x1fb972,_0x5b4665){return function(_0x46d29a){if(_0x46d29a){return _0x46d29a[_0x4274('0x29')](_0x1fb972)['then'](function(_0x3a05d5){return _0x3a05d5;});}return null;};}function removeEntity(_0x464d6d,_0x23e7d2){return function(_0x1d2037){if(_0x1d2037){return _0x1d2037['destroy']()[_0x4274('0x2a')](function(){_0x464d6d[_0x4274('0x1f')](0xcc)[_0x4274('0x20')]();});}};}function handleEntityNotFound(_0x2496d4,_0x891db0){return function(_0x365a67){if(!_0x365a67){_0x2496d4[_0x4274('0x2b')](0x194);}return _0x365a67;};}function handleError(_0x537c8d,_0x2913ee){_0x2913ee=_0x2913ee||0x1f4;return function(_0xda3fb7){logger[_0x4274('0x2c')](_0xda3fb7[_0x4274('0x2d')]);if(_0xda3fb7[_0x4274('0x2e')]){delete _0xda3fb7['name'];}_0x537c8d['status'](_0x2913ee)[_0x4274('0x2f')](_0xda3fb7);};}exports['index']=function(_0x42bf20,_0x4bb1a4){var _0x3c3368={},_0xdf75de={},_0x590091={'count':0x0,'rows':[]};var _0x73f394=_['map'](db[_0x4274('0x30')][_0x4274('0x31')],function(_0x3a598a){return{'name':_0x3a598a[_0x4274('0x32')],'type':_0x3a598a[_0x4274('0x33')]['key']};});_0xdf75de['model']=_[_0x4274('0x34')](_0x73f394,'name');_0xdf75de['query']=_[_0x4274('0x35')](_0x42bf20['query']);_0xdf75de[_0x4274('0x36')]=_['intersection'](_0xdf75de[_0x4274('0x37')],_0xdf75de[_0x4274('0x38')]);_0x3c3368[_0x4274('0x39')]=_['intersection'](_0xdf75de[_0x4274('0x37')],qs[_0x4274('0x3a')](_0x42bf20[_0x4274('0x38')][_0x4274('0x3a')]));_0x3c3368[_0x4274('0x39')]=_0x3c3368['attributes'][_0x4274('0x3b')]?_0x3c3368[_0x4274('0x39')]:_0xdf75de[_0x4274('0x37')];if(!_0x42bf20['query'][_0x4274('0x3c')](_0x4274('0x3d'))){_0x3c3368[_0x4274('0x25')]=qs[_0x4274('0x25')](_0x42bf20['query']['limit']);_0x3c3368[_0x4274('0x22')]=qs['offset'](_0x42bf20[_0x4274('0x38')]['offset']);}_0x3c3368['order']=qs[_0x4274('0x3e')](_0x42bf20[_0x4274('0x38')]['sort']);_0x3c3368[_0x4274('0x3f')]=qs[_0x4274('0x36')](_[_0x4274('0x40')](_0x42bf20['query'],_0xdf75de[_0x4274('0x36')]),_0x73f394);if(_0x42bf20[_0x4274('0x38')]['filter']){_0x3c3368[_0x4274('0x3f')]=_[_0x4274('0x41')](_0x3c3368[_0x4274('0x3f')],{'$or':_[_0x4274('0x34')](_0x73f394,function(_0xeaeba2){if(_0xeaeba2['type']!==_0x4274('0x42')){var _0x32dc8a={};_0x32dc8a[_0xeaeba2[_0x4274('0x2e')]]={'$like':'%'+_0x42bf20[_0x4274('0x38')][_0x4274('0x43')]+'%'};return _0x32dc8a;}})});}_0x3c3368=_[_0x4274('0x41')]({},_0x3c3368,_0x42bf20[_0x4274('0x44')]);var _0x3fa4df={'where':_0x3c3368[_0x4274('0x3f')]};return db['ChatInternalMessage'][_0x4274('0x24')](_0x3fa4df)[_0x4274('0x2a')](function(_0x810b1f){_0x590091[_0x4274('0x24')]=_0x810b1f;if(_0x42bf20['query'][_0x4274('0x45')]){_0x3c3368[_0x4274('0x46')]=[{'all':!![]}];}return db[_0x4274('0x30')][_0x4274('0x47')](_0x3c3368);})[_0x4274('0x2a')](function(_0x8a3301){_0x590091[_0x4274('0x48')]=_0x8a3301;return _0x590091;})[_0x4274('0x2a')](respondWithFilteredResult(_0x4bb1a4,_0x3c3368))[_0x4274('0x49')](handleError(_0x4bb1a4,null));};exports['show']=function(_0x390ebf,_0x5543b1){var _0x2167a1={'raw':!![],'where':{'id':_0x390ebf[_0x4274('0x4a')]['id']}},_0x3c6a99={};_0x3c6a99['model']=_[_0x4274('0x35')](db[_0x4274('0x30')][_0x4274('0x31')]);_0x3c6a99[_0x4274('0x38')]=_[_0x4274('0x35')](_0x390ebf['query']);_0x3c6a99[_0x4274('0x36')]=_['intersection'](_0x3c6a99['model'],_0x3c6a99[_0x4274('0x38')]);_0x2167a1[_0x4274('0x39')]=_[_0x4274('0x4b')](_0x3c6a99[_0x4274('0x37')],qs['fields'](_0x390ebf[_0x4274('0x38')][_0x4274('0x3a')]));_0x2167a1[_0x4274('0x39')]=_0x2167a1[_0x4274('0x39')][_0x4274('0x3b')]?_0x2167a1[_0x4274('0x39')]:_0x3c6a99[_0x4274('0x37')];if(_0x390ebf[_0x4274('0x38')][_0x4274('0x45')]){_0x2167a1[_0x4274('0x46')]=[{'all':!![]}];}_0x2167a1=_[_0x4274('0x41')]({},_0x2167a1,_0x390ebf[_0x4274('0x44')]);return db[_0x4274('0x30')][_0x4274('0x4c')](_0x2167a1)['then'](handleEntityNotFound(_0x5543b1,null))[_0x4274('0x2a')](respondWithResult(_0x5543b1,null))['catch'](handleError(_0x5543b1,null));};exports['create']=function(_0x203382,_0x1b40b3){return db[_0x4274('0x30')]['create'](_0x203382[_0x4274('0x4d')],{})[_0x4274('0x2a')](respondWithResult(_0x1b40b3,0xc9))[_0x4274('0x49')](handleError(_0x1b40b3,null));};exports['update']=function(_0x36861e,_0x5f5bea){if(_0x36861e['body']['id']){delete _0x36861e['body']['id'];}return db[_0x4274('0x30')][_0x4274('0x4c')]({'where':{'id':_0x36861e[_0x4274('0x4a')]['id']}})[_0x4274('0x2a')](handleEntityNotFound(_0x5f5bea,null))[_0x4274('0x2a')](saveUpdates(_0x36861e['body'],null))['then'](respondWithResult(_0x5f5bea,null))['catch'](handleError(_0x5f5bea,null));};exports[_0x4274('0x4e')]=function(_0x10bb23,_0x150a76){return db[_0x4274('0x30')][_0x4274('0x4c')]({'where':{'id':_0x10bb23[_0x4274('0x4a')]['id']}})[_0x4274('0x2a')](handleEntityNotFound(_0x150a76,null))['then'](removeEntity(_0x150a76,null))[_0x4274('0x49')](handleError(_0x150a76,null));};exports[_0x4274('0x4f')]=function(_0x1c0f20,_0x37ea82){return db[_0x4274('0x30')][_0x4274('0x4f')]()['then'](respondWithResult(_0x37ea82,null))[_0x4274('0x49')](handleError(_0x37ea82,null));};function wrapUser(_0x50a982){return function(_0x333613){var _0x35e9bf=_0x50a982[_0x4274('0x50')]({'plain':!![]});_0x35e9bf[_0x4274('0x51')]=[];if(_0x333613){_0x35e9bf['lastMessageAt']=_0x333613['createdAt'];_0x35e9bf['lastMessage']=_0x333613;}else{_0x35e9bf[_0x4274('0x52')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x35e9bf['lastMessage']={};}return _0x35e9bf;};}exports[_0x4274('0x53')]=function(_0x3d739e,_0x5c5fc9,_0x3753d9){var _0x5311e7=[];return db[_0x4274('0x54')]['findAll']({'where':{'role':['agent',_0x4274('0x55'),'user']},'attributes':['id',_0x4274('0x56'),_0x4274('0x2e'),_0x4274('0x57'),'userpic',_0x4274('0x58'),_0x4274('0x59'),_0x4274('0x5a'),_0x4274('0x5b'),_0x4274('0x5c')],'order':qs[_0x4274('0x3e')](_0x4274('0x5d')),'include':[{'model':db[_0x4274('0x5e')],'as':'VoiceQueues','attributes':['id','name',_0x4274('0x33')],'through':{'attributes':[]}}]})['then'](function(_0xd7032f){if(_0xd7032f){var _0x11dd60=_0x3d739e[_0x4274('0x5f')][_0x4274('0x50')]({'plain':!![]});if(!_0x11dd60)throw new Error(_0x4274('0x60'));if(_0x11dd60[_0x4274('0x57')]===_0x4274('0x5f')){return db[_0x4274('0x61')][_0x4274('0x4c')]({'where':{'name':'Agents','userProfileId':_0x11dd60[_0x4274('0x62')]},'raw':!![]})['then'](function(_0x547206){if(_0x547206){if(_0x547206[_0x4274('0x63')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x547206['id']},'raw':!![]})[_0x4274('0x2a')](function(_0x34a137){var _0x255c47=[];if(_[_0x4274('0x64')](_0x34a137)){_0x255c47=_[_0x4274('0x43')](_0xd7032f,function(_0x3e267e){if(_0x3e267e[_0x4274('0x57')]!==_0x4274('0x65')){return _0x3e267e;}});return _0x255c47;}else{for(var _0x362377=0x0;_0x362377<_0xd7032f[_0x4274('0x3b')];_0x362377++){var _0x11b456=_0xd7032f[_0x362377];if(_0x11b456[_0x4274('0x57')]==='agent'){var _0x14209e=_[_0x4274('0x4c')](_0x34a137,function(_0x1952f8){return _0x1952f8['resourceId']===_0x11b456['id'];});if(_0x14209e)_0x255c47[_0x4274('0x66')](_0x11b456);}else{_0x255c47[_0x4274('0x66')](_0x11b456);}}return _0x255c47;}});}else{return _0xd7032f;}}else{var _0x72c4c8=_['filter'](_0xd7032f,function(_0x96e7b5){if(_0x96e7b5['role']!=='agent'){return _0x96e7b5;}});return _0x72c4c8;}});}else{return _0xd7032f;}}})[_0x4274('0x2a')](function(_0x1cdeca){var _0x3a76c8=[];if(_0x1cdeca){_0x5311e7=_0x1cdeca;for(var _0x17bcb9=0x0;_0x17bcb9<_0x1cdeca[_0x4274('0x3b')];_0x17bcb9+=0x1){_0x5311e7[_0x17bcb9][_0x4274('0x51')]=[];_0x3a76c8[_0x4274('0x66')](db[_0x4274('0x30')][_0x4274('0x4c')]({'where':{'FromId':[_0x3d739e['user']['id'],_0x1cdeca[_0x17bcb9]['id']],'ToId':[_0x3d739e[_0x4274('0x5f')]['id'],_0x1cdeca[_0x17bcb9]['id']],'ChatGroupId':null},'attributes':['id',_0x4274('0x67'),_0x4274('0x68'),_0x4274('0x69'),'read',_0x4274('0x4d')],'order':qs['sort'](_0x4274('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4274('0x2a')](wrapUser(_0x1cdeca[_0x17bcb9])));}return BPromise[_0x4274('0x6b')](_0x3a76c8);}return[];})['then'](function(_0x58001b){return{'rows':_0x58001b,'count':_0x58001b[_0x4274('0x3b')]};})[_0x4274('0x2a')](respondWithResult(_0x5c5fc9,null))[_0x4274('0x49')](handleError(_0x5c5fc9,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9364ec5..129ee31 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 _0xe8bc=['hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe8bc,0xd5));var _0xce8b=function(_0x55376d,_0x527a4a){_0x55376d=_0x55376d-0x0;var _0x3a3771=_0xe8bc[_0x55376d];return _0x3a3771;};'use strict';var EventEmitter=require(_0xce8b('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xce8b('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xce8b('0x2')](0x0);var events={'afterCreate':_0xce8b('0x3'),'afterUpdate':_0xce8b('0x4'),'afterDestroy':_0xce8b('0x5')};function emitEvent(_0x141c1d){return function(_0x4b2e71,_0x5176f6,_0x54fdd9){ChatInternalMessageEvents[_0xce8b('0x6')](_0x141c1d+':'+_0x4b2e71['id'],_0x4b2e71);ChatInternalMessageEvents[_0xce8b('0x6')](_0x141c1d,_0x4b2e71);_0x54fdd9(null);};}for(var e in events){if(events[_0xce8b('0x7')](e)){var event=events[e];ChatInternalMessage[_0xce8b('0x8')](e,emitEvent(event));}}module[_0xce8b('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xc1a2=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xc1a2,0x148));var _0x2c1a=function(_0x3f4fcb,_0x1f826e){_0x3f4fcb=_0x3f4fcb-0x0;var _0x230db5=_0xc1a2[_0x3f4fcb];return _0x230db5;};'use strict';var EventEmitter=require(_0x2c1a('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2c1a('0x1')](0x0);var events={'afterCreate':_0x2c1a('0x2'),'afterUpdate':_0x2c1a('0x3'),'afterDestroy':_0x2c1a('0x4')};function emitEvent(_0x469ca6){return function(_0x18f1fa,_0x478d42,_0xd80381){ChatInternalMessageEvents[_0x2c1a('0x5')](_0x469ca6+':'+_0x18f1fa['id'],_0x18f1fa);ChatInternalMessageEvents[_0x2c1a('0x5')](_0x469ca6,_0x18f1fa);_0xd80381(null);};}for(var e in events){if(events[_0x2c1a('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x2c1a('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index d2d78eb..a21d4aa 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 _0x7ea0=['utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','ChatInternalMessage','chat_internal_messages'];(function(_0x549d9b,_0x314f30){var _0x46522b=function(_0x46ce73){while(--_0x46ce73){_0x549d9b['push'](_0x549d9b['shift']());}};_0x46522b(++_0x314f30);}(_0x7ea0,0x11f));var _0x07ea=function(_0x3cf8f5,_0x3291b8){_0x3cf8f5=_0x3cf8f5-0x0;var _0x1e9851=_0x7ea0[_0x3cf8f5];return _0x1e9851;};'use strict';var _=require(_0x07ea('0x0'));var util=require(_0x07ea('0x1'));var logger=require(_0x07ea('0x2'))(_0x07ea('0x3'));var moment=require('moment');var BPromise=require(_0x07ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07ea('0x5'));var rimraf=require(_0x07ea('0x6'));var config=require(_0x07ea('0x7'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x2ecd8b,_0x3d46ee){return _0x2ecd8b['define'](_0x07ea('0x8'),attributes,{'tableName':_0x07ea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x07ea('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x309a=['util','../../config/logger','api','moment','bluebird','path','./chatInternalMessage.attributes','define','ChatInternalMessage','utf8mb4_unicode_ci','lodash'];(function(_0x141665,_0x793f1a){var _0x40f97b=function(_0x4e3ed3){while(--_0x4e3ed3){_0x141665['push'](_0x141665['shift']());}};_0x40f97b(++_0x793f1a);}(_0x309a,0x1c2));var _0xa309=function(_0x471e8e,_0x2faf44){_0x471e8e=_0x471e8e-0x0;var _0x4eef08=_0x309a[_0x471e8e];return _0x4eef08;};'use strict';var _=require(_0xa309('0x0'));var util=require(_0xa309('0x1'));var logger=require(_0xa309('0x2'))(_0xa309('0x3'));var moment=require(_0xa309('0x4'));var BPromise=require(_0xa309('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa309('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa309('0x7'));module['exports']=function(_0x31912f,_0x5f24f6){return _0x31912f[_0xa309('0x8')](_0xa309('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa309('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 958d268..e67dee2 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 _0x5aaa=['./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x1b7729,_0x4a0cbf){var _0x35ec83=function(_0x11d7e6){while(--_0x11d7e6){_0x1b7729['push'](_0x1b7729['shift']());}};_0x35ec83(++_0x4a0cbf);}(_0x5aaa,0xff));var _0xa5aa=function(_0x6dd453,_0x59ba84){_0x6dd453=_0x6dd453-0x0;var _0x1b97d3=_0x5aaa[_0x6dd453];return _0x1b97d3;};'use strict';var _=require(_0xa5aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5aa('0x1'))['db'];var utils=require(_0xa5aa('0x2'));var logger=require(_0xa5aa('0x3'))('rpc');var config=require(_0xa5aa('0x4'));var jayson=require(_0xa5aa('0x5'));var client=jayson['client'][_0xa5aa('0x6')]({'port':0x232a});config[_0xa5aa('0x7')]=_[_0xa5aa('0x8')](config[_0xa5aa('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5aa('0x7')]));require(_0xa5aa('0x9'))[_0xa5aa('0xa')](socket);function respondWithRpcPromise(_0x5bb8cd,_0x51b854,_0x5769ca){return new BPromise(function(_0x119692,_0x5e23f2){return client[_0xa5aa('0xb')](_0x5bb8cd,_0x5769ca)[_0xa5aa('0xc')](function(_0x2b4b12){logger[_0xa5aa('0xd')](_0xa5aa('0xe'),_0x51b854,'request\x20sent');logger[_0xa5aa('0xf')](_0xa5aa('0x10'),_0x51b854,_0xa5aa('0x11'),JSON[_0xa5aa('0x12')](_0x2b4b12));if(_0x2b4b12['error']){if(_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x14')]===0x1f4){logger[_0xa5aa('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x51b854,_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x15')]);return _0x5e23f2(_0x2b4b12[_0xa5aa('0x13')][_0xa5aa('0x15')]);}logger[_0xa5aa('0x13')](_0xa5aa('0xe'),_0x51b854,_0x2b4b12[_0xa5aa('0x13')]['message']);return _0x119692(_0x2b4b12[_0xa5aa('0x13')]['message']);}else{logger['info'](_0xa5aa('0xe'),_0x51b854,_0xa5aa('0x11'));_0x119692(_0x2b4b12[_0xa5aa('0x16')][_0xa5aa('0x15')]);}})[_0xa5aa('0x17')](function(_0x3977f2){logger[_0xa5aa('0x13')](_0xa5aa('0xe'),_0x51b854,_0x3977f2);_0x5e23f2(_0x3977f2);});});} \ No newline at end of file +var _0xcbe5=['localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x49ebfd,_0x1f9990){var _0x5ca53e=function(_0x3c3467){while(--_0x3c3467){_0x49ebfd['push'](_0x49ebfd['shift']());}};_0x5ca53e(++_0x1f9990);}(_0xcbe5,0xee));var _0x5cbe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcbe5[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5cbe('0x0'));var util=require(_0x5cbe('0x1'));var moment=require(_0x5cbe('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cbe('0x3'));var fs=require('fs');var Redis=require(_0x5cbe('0x4'));var db=require(_0x5cbe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cbe('0x6'))(_0x5cbe('0x7'));var config=require(_0x5cbe('0x8'));var jayson=require(_0x5cbe('0x9'));var client=jayson[_0x5cbe('0xa')][_0x5cbe('0xb')]({'port':0x232a});config[_0x5cbe('0xc')]=_[_0x5cbe('0xd')](config[_0x5cbe('0xc')],{'host':_0x5cbe('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5cbe('0xf'))[_0x5cbe('0x10')](socket);function respondWithRpcPromise(_0x56778b,_0x7546b2,_0x1f86ce){return new BPromise(function(_0x498637,_0x2a14c9){return client[_0x5cbe('0x11')](_0x56778b,_0x1f86ce)[_0x5cbe('0x12')](function(_0x4155e3){logger[_0x5cbe('0x13')](_0x5cbe('0x14'),_0x7546b2,'request\x20sent');logger[_0x5cbe('0x15')](_0x5cbe('0x16'),_0x7546b2,'request\x20sent',JSON[_0x5cbe('0x17')](_0x4155e3));if(_0x4155e3[_0x5cbe('0x18')]){if(_0x4155e3[_0x5cbe('0x18')]['code']===0x1f4){logger[_0x5cbe('0x18')](_0x5cbe('0x14'),_0x7546b2,_0x4155e3[_0x5cbe('0x18')][_0x5cbe('0x19')]);return _0x2a14c9(_0x4155e3[_0x5cbe('0x18')][_0x5cbe('0x19')]);}logger[_0x5cbe('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x7546b2,_0x4155e3[_0x5cbe('0x18')][_0x5cbe('0x19')]);return _0x498637(_0x4155e3[_0x5cbe('0x18')][_0x5cbe('0x19')]);}else{logger[_0x5cbe('0x13')](_0x5cbe('0x14'),_0x7546b2,_0x5cbe('0x1a'));_0x498637(_0x4155e3['result'][_0x5cbe('0x19')]);}})[_0x5cbe('0x1b')](function(_0x1290c0){logger[_0x5cbe('0x18')](_0x5cbe('0x14'),_0x7546b2,_0x1290c0);_0x2a14c9(_0x1290c0);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 2ff3b6a..f7b00a9 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 _0x274b=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x274b,0xbb));var _0xb274=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x274b[_0x1ac595];return _0x455fff;};'use strict';var ChatInternalMessageEvents=require(_0xb274('0x0'));var events=[_0xb274('0x1'),_0xb274('0x2'),_0xb274('0x3')];function createListener(_0x20c8d1,_0x1c40d0){return function(_0x3285e1){_0x1c40d0[_0xb274('0x4')](_0x20c8d1,_0x3285e1);};}function removeListener(_0x5234d5,_0x3df250){return function(){ChatInternalMessageEvents[_0xb274('0x5')](_0x5234d5,_0x3df250);};}exports[_0xb274('0x6')]=function(_0x12c1f9){for(var _0x424e89=0x0,_0x2c28e2=events[_0xb274('0x7')];_0x424e89<_0x2c28e2;_0x424e89++){var _0x39a055=events[_0x424e89];var _0x29b566=createListener(_0xb274('0x8')+_0x39a055,_0x12c1f9);ChatInternalMessageEvents['on'](_0x39a055,_0x29b566);}}; \ No newline at end of file +var _0x4b6f=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b6f,0xb0));var _0xf4b6=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4b6f[_0x3ff085];return _0x2b68c3;};'use strict';var ChatInternalMessageEvents=require(_0xf4b6('0x0'));var events=[_0xf4b6('0x1'),_0xf4b6('0x2'),_0xf4b6('0x3')];function createListener(_0x1bb09f,_0x169d93){return function(_0x16baed){_0x169d93['emit'](_0x1bb09f,_0x16baed);};}function removeListener(_0x39292e,_0xaf1d8){return function(){ChatInternalMessageEvents[_0xf4b6('0x4')](_0x39292e,_0xaf1d8);};}exports[_0xf4b6('0x5')]=function(_0x40c4ce){for(var _0xfdcd1e=0x0,_0x30390a=events['length'];_0xfdcd1e<_0x30390a;_0xfdcd1e++){var _0x41e30f=events[_0xfdcd1e];var _0xa8d630=createListener(_0xf4b6('0x6')+_0x41e30f,_0x40c4ce);ChatInternalMessageEvents['on'](_0x41e30f,_0xa8d630);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 3f7a053..2dec95c 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 _0x9eeb=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','getUsers','/:id','show'];(function(_0x18c15d,_0x150381){var _0x644686=function(_0x15c62f){while(--_0x15c62f){_0x18c15d['push'](_0x18c15d['shift']());}};_0x644686(++_0x150381);}(_0x9eeb,0x1d9));var _0xb9ee=function(_0x29c151,_0x2d8e1f){_0x29c151=_0x29c151-0x0;var _0x2bc00d=_0x9eeb[_0x29c151];return _0x2bc00d;};'use strict';var multer=require(_0xb9ee('0x0'));var util=require(_0xb9ee('0x1'));var path=require(_0xb9ee('0x2'));var timeout=require(_0xb9ee('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb9ee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb9ee('0x5'));var config=require('../../config/environment');var controller=require(_0xb9ee('0x6'));router[_0xb9ee('0x7')]('/',auth[_0xb9ee('0x8')](),controller[_0xb9ee('0x9')]);router[_0xb9ee('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb9ee('0x7')]('/users',auth['isAuthenticated'](),controller[_0xb9ee('0xa')]);router[_0xb9ee('0x7')](_0xb9ee('0xb'),auth[_0xb9ee('0x8')](),controller[_0xb9ee('0xc')]);router['post']('/',auth[_0xb9ee('0x8')](),controller['create']);router[_0xb9ee('0xd')](_0xb9ee('0xb'),controller[_0xb9ee('0xe')]);router[_0xb9ee('0xf')](_0xb9ee('0xb'),auth[_0xb9ee('0x8')](),controller[_0xb9ee('0x10')]);module[_0xb9ee('0x11')]=router; \ No newline at end of file +var _0x19a1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers','show','create','put','/:id','destroy'];(function(_0x191c4c,_0x3b7c2b){var _0x2fd037=function(_0x26026a){while(--_0x26026a){_0x191c4c['push'](_0x191c4c['shift']());}};_0x2fd037(++_0x3b7c2b);}(_0x19a1,0x11d));var _0x119a=function(_0x16a496,_0x2380e2){_0x16a496=_0x16a496-0x0;var _0x5d2c35=_0x19a1[_0x16a496];return _0x5d2c35;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x119a('0x0'));var timeout=require(_0x119a('0x1'));var express=require(_0x119a('0x2'));var router=express[_0x119a('0x3')]();var fs_extra=require(_0x119a('0x4'));var auth=require(_0x119a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x119a('0x6'));var controller=require(_0x119a('0x7'));router[_0x119a('0x8')]('/',auth[_0x119a('0x9')](),controller[_0x119a('0xa')]);router[_0x119a('0x8')](_0x119a('0xb'),auth[_0x119a('0x9')](),controller[_0x119a('0xc')]);router[_0x119a('0x8')]('/users',auth[_0x119a('0x9')](),controller[_0x119a('0xd')]);router[_0x119a('0x8')]('/:id',auth[_0x119a('0x9')](),controller[_0x119a('0xe')]);router['post']('/',auth[_0x119a('0x9')](),controller[_0x119a('0xf')]);router[_0x119a('0x10')]('/:id',controller['update']);router['delete'](_0x119a('0x11'),auth[_0x119a('0x9')](),controller[_0x119a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 8224684..aff7cf5 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 _0x531a=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0xe35bf8,_0x11700a){var _0x32cdcb=function(_0x382284){while(--_0x382284){_0xe35bf8['push'](_0xe35bf8['shift']());}};_0x32cdcb(++_0x11700a);}(_0x531a,0x100));var _0xa531=function(_0x19c315,_0x2b2e84){_0x19c315=_0x19c315-0x0;var _0x3dc378=_0x531a[_0x19c315];return _0x3dc378;};'use strict';var Sequelize=require(_0xa531('0x0'));module[_0xa531('0x1')]={'body':{'type':Sequelize[_0xa531('0x2')](_0xa531('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa531('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa531('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa531('0x5')]('in',_0xa531('0x6')),'defaultValue':_0xa531('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa531('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa531('0x2')]}}; \ No newline at end of file +var _0x71f4=['ENUM','out','STRING','TEXT','medium','BOOLEAN'];(function(_0x5e03f7,_0x5dc1d9){var _0xdf3b64=function(_0x43742f){while(--_0x43742f){_0x5e03f7['push'](_0x5e03f7['shift']());}};_0xdf3b64(++_0x5dc1d9);}(_0x71f4,0xf9));var _0x471f=function(_0x2569e9,_0x283072){_0x2569e9=_0x2569e9-0x0;var _0x1a19d6=_0x71f4[_0x2569e9];return _0x1a19d6;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x471f('0x0')](_0x471f('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x471f('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x471f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x471f('0x3')]('in','out'),'defaultValue':_0x471f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x471f('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index aa9c92d..78326a0 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 _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x1a4091,_0x263127){var _0x9b768=function(_0x340786){while(--_0x340786){_0x1a4091['push'](_0x1a4091['shift']());}};_0x9b768(++_0x263127);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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 client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x1c52ab,_0x640d11){var _0x2bb28d=function(_0x5ec210){while(--_0x5ec210){_0x1c52ab['push'](_0x1c52ab['shift']());}};_0x2bb28d(++_0x640d11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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 client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 64c3d8e..69e1335 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 _0x696f=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x696f,0x17c));var _0xf696=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x696f[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xf696('0x0'));var ChatMessage=require(_0xf696('0x1'))['db'][_0xf696('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf696('0x3')](0x0);var events={'afterCreate':_0xf696('0x4'),'afterUpdate':_0xf696('0x5'),'afterDestroy':_0xf696('0x6')};function emitEvent(_0x284d49){return function(_0x198b77,_0x29cc98,_0x438fb5){ChatMessageEvents[_0xf696('0x7')](_0x284d49+':'+_0x198b77['id'],_0x198b77);ChatMessageEvents[_0xf696('0x7')](_0x284d49,_0x198b77);_0x438fb5(null);};}for(var e in events){if(events[_0xf696('0x8')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xf696('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x4fe8=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x1a7e2e,_0x304892){var _0x194472=function(_0x26fd24){while(--_0x26fd24){_0x1a7e2e['push'](_0x1a7e2e['shift']());}};_0x194472(++_0x304892);}(_0x4fe8,0x14f));var _0x84fe=function(_0x11c573,_0x1507b5){_0x11c573=_0x11c573-0x0;var _0x320ace=_0x4fe8[_0x11c573];return _0x320ace;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x84fe('0x0'))['db'][_0x84fe('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x84fe('0x2')](0x0);var events={'afterCreate':_0x84fe('0x3'),'afterUpdate':_0x84fe('0x4'),'afterDestroy':_0x84fe('0x5')};function emitEvent(_0x3da56f){return function(_0x2411e8,_0x39f486,_0x32c225){ChatMessageEvents[_0x84fe('0x6')](_0x3da56f+':'+_0x2411e8['id'],_0x2411e8);ChatMessageEvents[_0x84fe('0x6')](_0x3da56f,_0x2411e8);_0x32c225(null);};}for(var e in events){if(events[_0x84fe('0x7')](e)){var event=events[e];ChatMessage[_0x84fe('0x8')](e,emitEvent(event));}}module[_0x84fe('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 b6d59eb..33c8bfc 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 _0xb0fd=['rimraf','./chatMessage.attributes','ChatMessage','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x247b94,_0x57ed01){var _0x50029f=function(_0x51013d){while(--_0x51013d){_0x247b94['push'](_0x247b94['shift']());}};_0x50029f(++_0x57ed01);}(_0xb0fd,0xdb));var _0xdb0f=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xb0fd[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0xdb0f('0x0'));var util=require(_0xdb0f('0x1'));var logger=require(_0xdb0f('0x2'))(_0xdb0f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb0f('0x4'));var fs=require('fs');var path=require(_0xdb0f('0x5'));var rimraf=require(_0xdb0f('0x6'));var config=require('../../config/environment');var attributes=require(_0xdb0f('0x7'));module['exports']=function(_0x5ba98f,_0x26fb06){return _0x5ba98f['define'](_0xdb0f('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xdb0f('0x9')],'type':_0xdb0f('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x454809,_0xdf95e2,_0x2f5ba5){var _0x194ef2=_0x5ba98f[_0xdb0f('0xb')];var _0x2d4fac=_0x454809[_0xdb0f('0xc')]({'plain':!![]});if(_0x2d4fac['direction'][_0xdb0f('0xd')]()==='in'||_0x2d4fac[_0xdb0f('0xe')][_0xdb0f('0xd')]()===_0xdb0f('0xf')&&!_0x2d4fac[_0xdb0f('0x10')]&&!_['isNil'](_0x2d4fac['UserId'])){_0x194ef2[_0xdb0f('0x11')][_0xdb0f('0x12')]({'where':{'id':_0x2d4fac['ChatInteractionId']}})[_0xdb0f('0x13')](function(_0x571ae9){if(_0x571ae9){_0x571ae9[_0xdb0f('0x14')]({'lastMsgAt':_0x2d4fac[_0xdb0f('0x15')],'lastMsgDirection':_0x2d4fac[_0xdb0f('0xe')][_0xdb0f('0xd')]()});}})[_0xdb0f('0x16')](function(_0x1acd79){console[_0xdb0f('0x17')](_0x1acd79);});}_0x2f5ba5();}},'charset':'utf8mb4','collate':_0xdb0f('0x18')});}; \ No newline at end of file +var _0x945f=['rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','createdAt','error','utf8mb4','lodash','api','moment','path'];(function(_0x55d8aa,_0x3403c5){var _0x3ad990=function(_0xf19585){while(--_0xf19585){_0x55d8aa['push'](_0x55d8aa['shift']());}};_0x3ad990(++_0x3403c5);}(_0x945f,0x6f));var _0xf945=function(_0x55e7f9,_0x239568){_0x55e7f9=_0x55e7f9-0x0;var _0x48143c=_0x945f[_0x55e7f9];return _0x48143c;};'use strict';var _=require(_0xf945('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf945('0x1'));var moment=require(_0xf945('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf945('0x3'));var rimraf=require(_0xf945('0x4'));var config=require('../../config/environment');var attributes=require(_0xf945('0x5'));module[_0xf945('0x6')]=function(_0x4bcb2d,_0x254708){return _0x4bcb2d[_0xf945('0x7')](_0xf945('0x8'),attributes,{'tableName':_0xf945('0x9'),'paranoid':![],'indexes':[{'name':_0xf945('0xa'),'fields':[_0xf945('0xb')],'type':_0xf945('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1264aa,_0x46145a,_0x10c800){var _0xf1be1f=_0x4bcb2d['models'];var _0x3de729=_0x1264aa[_0xf945('0xd')]({'plain':!![]});if(_0x3de729[_0xf945('0xe')]['toLowerCase']()==='in'||_0x3de729[_0xf945('0xe')][_0xf945('0xf')]()===_0xf945('0x10')&&!_0x3de729[_0xf945('0x11')]&&!_['isNil'](_0x3de729[_0xf945('0x12')])){_0xf1be1f[_0xf945('0x13')]['findOne']({'where':{'id':_0x3de729['ChatInteractionId']}})['then'](function(_0x2e045d){if(_0x2e045d){_0x2e045d['update']({'lastMsgAt':_0x3de729[_0xf945('0x14')],'lastMsgDirection':_0x3de729['direction'][_0xf945('0xf')]()});}})['catch'](function(_0x20bf00){console[_0xf945('0x15')](_0x20bf00);});}_0x10c800();}},'charset':_0xf945('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d7f0a4a..446607d 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 _0x9ad2=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','create','options','raw','CreateChatMessage'];(function(_0x27e308,_0x1df761){var _0x51c431=function(_0x344e53){while(--_0x344e53){_0x27e308['push'](_0x27e308['shift']());}};_0x51c431(++_0x1df761);}(_0x9ad2,0xe0));var _0x29ad=function(_0x58e703,_0xc53f7c){_0x58e703=_0x58e703-0x0;var _0x303bd0=_0x9ad2[_0x58e703];return _0x303bd0;};'use strict';var _=require(_0x29ad('0x0'));var util=require(_0x29ad('0x1'));var moment=require(_0x29ad('0x2'));var BPromise=require(_0x29ad('0x3'));var rs=require(_0x29ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29ad('0x5'))['db'];var utils=require(_0x29ad('0x6'));var logger=require(_0x29ad('0x7'))(_0x29ad('0x8'));var config=require(_0x29ad('0x9'));var jayson=require(_0x29ad('0xa'));var client=jayson[_0x29ad('0xb')][_0x29ad('0xc')]({'port':0x232a});config[_0x29ad('0xd')]=_['defaults'](config[_0x29ad('0xd')],{'host':_0x29ad('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29ad('0xd')]));require('./chatMessage.socket')[_0x29ad('0xf')](socket);function respondWithRpcPromise(_0x599be8,_0x524cf1,_0x4e4f89){return new BPromise(function(_0x569090,_0x34d73d){return client['request'](_0x599be8,_0x4e4f89)[_0x29ad('0x10')](function(_0x5446b9){logger[_0x29ad('0x11')]('ChatMessage,\x20%s,\x20%s',_0x524cf1,_0x29ad('0x12'));logger[_0x29ad('0x13')](_0x29ad('0x14'),_0x524cf1,'request\x20sent',JSON[_0x29ad('0x15')](_0x5446b9));if(_0x5446b9[_0x29ad('0x16')]){if(_0x5446b9[_0x29ad('0x16')][_0x29ad('0x17')]===0x1f4){logger[_0x29ad('0x16')](_0x29ad('0x18'),_0x524cf1,_0x5446b9[_0x29ad('0x16')][_0x29ad('0x19')]);return _0x34d73d(_0x5446b9[_0x29ad('0x16')][_0x29ad('0x19')]);}logger[_0x29ad('0x16')](_0x29ad('0x18'),_0x524cf1,_0x5446b9[_0x29ad('0x16')][_0x29ad('0x19')]);return _0x569090(_0x5446b9['error'][_0x29ad('0x19')]);}else{logger[_0x29ad('0x11')](_0x29ad('0x18'),_0x524cf1,_0x29ad('0x12'));_0x569090(_0x5446b9[_0x29ad('0x1a')][_0x29ad('0x19')]);}})[_0x29ad('0x1b')](function(_0x27393a){logger['error'](_0x29ad('0x18'),_0x524cf1,_0x27393a);_0x34d73d(_0x27393a);});});}exports['CreateChatMessage']=function(_0x5700e2){var _0x318eae=this;return new Promise(function(_0x2c4538,_0x26bc73){return db['ChatMessage'][_0x29ad('0x1c')](_0x5700e2['body'],{'raw':_0x5700e2[_0x29ad('0x1d')]?_0x5700e2[_0x29ad('0x1d')][_0x29ad('0x1e')]===undefined?!![]:![]:!![]})[_0x29ad('0x10')](function(_0x4a1d20){logger[_0x29ad('0x11')]('CreateChatMessage',_0x5700e2);logger[_0x29ad('0x13')]('CreateChatMessage',_0x5700e2,JSON[_0x29ad('0x15')](_0x4a1d20));_0x2c4538(_0x4a1d20);})[_0x29ad('0x1b')](function(_0x12e216){logger[_0x29ad('0x16')](_0x29ad('0x1f'),_0x12e216[_0x29ad('0x19')],_0x5700e2);_0x26bc73(_0x318eae[_0x29ad('0x16')](0x1f4,_0x12e216['message']));});});}; \ No newline at end of file +var _0x8feb=['request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateChatMessage','ChatMessage','create','body','options','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','request','then','ChatMessage,\x20%s,\x20%s'];(function(_0x43b22b,_0xea722c){var _0xd4e124=function(_0x271814){while(--_0x271814){_0x43b22b['push'](_0x43b22b['shift']());}};_0xd4e124(++_0xea722c);}(_0x8feb,0xa9));var _0xb8fe=function(_0x4b2b43,_0x2fb809){_0x4b2b43=_0x4b2b43-0x0;var _0x4602cc=_0x8feb[_0x4b2b43];return _0x4602cc;};'use strict';var _=require(_0xb8fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8fe('0x1'));var rs=require(_0xb8fe('0x2'));var fs=require('fs');var Redis=require(_0xb8fe('0x3'));var db=require(_0xb8fe('0x4'))['db'];var utils=require(_0xb8fe('0x5'));var logger=require(_0xb8fe('0x6'))(_0xb8fe('0x7'));var config=require('../../config/environment');var jayson=require(_0xb8fe('0x8'));var client=jayson[_0xb8fe('0x9')][_0xb8fe('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb8fe('0xb')],{'host':_0xb8fe('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')[_0xb8fe('0xd')](socket);function respondWithRpcPromise(_0x1142cf,_0x566d80,_0x2c08f4){return new BPromise(function(_0x5df424,_0x4b9260){return client[_0xb8fe('0xe')](_0x1142cf,_0x2c08f4)[_0xb8fe('0xf')](function(_0x4fcf0a){logger['info'](_0xb8fe('0x10'),_0x566d80,_0xb8fe('0x11'));logger[_0xb8fe('0x12')](_0xb8fe('0x13'),_0x566d80,_0xb8fe('0x11'),JSON[_0xb8fe('0x14')](_0x4fcf0a));if(_0x4fcf0a[_0xb8fe('0x15')]){if(_0x4fcf0a[_0xb8fe('0x15')]['code']===0x1f4){logger['error'](_0xb8fe('0x10'),_0x566d80,_0x4fcf0a['error']['message']);return _0x4b9260(_0x4fcf0a[_0xb8fe('0x15')]['message']);}logger[_0xb8fe('0x15')](_0xb8fe('0x10'),_0x566d80,_0x4fcf0a[_0xb8fe('0x15')][_0xb8fe('0x16')]);return _0x5df424(_0x4fcf0a[_0xb8fe('0x15')][_0xb8fe('0x16')]);}else{logger[_0xb8fe('0x17')](_0xb8fe('0x10'),_0x566d80,'request\x20sent');_0x5df424(_0x4fcf0a[_0xb8fe('0x18')]['message']);}})['catch'](function(_0x42fbc5){logger[_0xb8fe('0x15')](_0xb8fe('0x10'),_0x566d80,_0x42fbc5);_0x4b9260(_0x42fbc5);});});}exports[_0xb8fe('0x19')]=function(_0x220360){var _0x252355=this;return new Promise(function(_0x329601,_0x208db1){return db[_0xb8fe('0x1a')][_0xb8fe('0x1b')](_0x220360[_0xb8fe('0x1c')],{'raw':_0x220360[_0xb8fe('0x1d')]?_0x220360[_0xb8fe('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xb8fe('0xf')](function(_0x580bdc){logger[_0xb8fe('0x17')]('CreateChatMessage',_0x220360);logger[_0xb8fe('0x12')](_0xb8fe('0x19'),_0x220360,JSON['stringify'](_0x580bdc));_0x329601(_0x580bdc);})[_0xb8fe('0x1e')](function(_0x258057){logger[_0xb8fe('0x15')](_0xb8fe('0x19'),_0x258057[_0xb8fe('0x16')],_0x220360);_0x208db1(_0x252355['error'](0x1f4,_0x258057[_0xb8fe('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d2b158b..fc58913 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 _0x3edc=['remove','update','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x57d0dc,_0x387f3e){_0x57d0dc=_0x57d0dc-0x0;var _0x177765=_0x3edc[_0x57d0dc];return _0x177765;};'use strict';var ChatMessageEvents=require(_0xc3ed('0x0'));var events=[_0xc3ed('0x1'),_0xc3ed('0x2'),_0xc3ed('0x3')];function createListener(_0xae2b4f,_0x47a242){return function(_0x2a8714){_0x47a242['emit'](_0xae2b4f,_0x2a8714);};}function removeListener(_0x3519ab,_0x19d8dc){return function(){ChatMessageEvents[_0xc3ed('0x4')](_0x3519ab,_0x19d8dc);};}exports[_0xc3ed('0x5')]=function(_0x3f8468){for(var _0x50b95c=0x0,_0x1b28d4=events[_0xc3ed('0x6')];_0x50b95c<_0x1b28d4;_0x50b95c++){var _0x14d194=events[_0x50b95c];var _0x2f28ce=createListener(_0xc3ed('0x7')+_0x14d194,_0x3f8468);ChatMessageEvents['on'](_0x14d194,_0x2f28ce);}}; \ No newline at end of file +var _0x78d3=['removeListener','register','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x2d7a93,_0x248393){var _0x326d7b=function(_0x5128a4){while(--_0x5128a4){_0x2d7a93['push'](_0x2d7a93['shift']());}};_0x326d7b(++_0x248393);}(_0x78d3,0x73));var _0x378d=function(_0x405cf1,_0x3a34cf){_0x405cf1=_0x405cf1-0x0;var _0x34184c=_0x78d3[_0x405cf1];return _0x34184c;};'use strict';var ChatMessageEvents=require(_0x378d('0x0'));var events=[_0x378d('0x1'),_0x378d('0x2'),_0x378d('0x3')];function createListener(_0x40323e,_0x1d87b8){return function(_0x367f93){_0x1d87b8[_0x378d('0x4')](_0x40323e,_0x367f93);};}function removeListener(_0x52f934,_0x32a62f){return function(){ChatMessageEvents[_0x378d('0x5')](_0x52f934,_0x32a62f);};}exports[_0x378d('0x6')]=function(_0xc18c0b){for(var _0x59117c=0x0,_0x47a99f=events['length'];_0x59117c<_0x47a99f;_0x59117c++){var _0x1c880e=events[_0x59117c];var _0x4b3ef5=createListener(_0x378d('0x7')+_0x1c880e,_0xc18c0b);ChatMessageEvents['on'](_0x1c880e,_0x4b3ef5);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index dd71312..bbc676b 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 _0x0099=['isAuthenticated','index','get','describe','chatmessage:create','create','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x0099,0xa5));var _0x9009=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x0099[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require(_0x9009('0x0'));var util=require('util');var path=require(_0x9009('0x1'));var timeout=require(_0x9009('0x2'));var express=require(_0x9009('0x3'));var router=express[_0x9009('0x4')]();var fs_extra=require(_0x9009('0x5'));var auth=require(_0x9009('0x6'));var interaction=require(_0x9009('0x7'));var config=require(_0x9009('0x8'));var controller=require(_0x9009('0x9'));router['get']('/',auth[_0x9009('0xa')](),controller[_0x9009('0xb')]);router[_0x9009('0xc')]('/describe',auth[_0x9009('0xa')](),controller[_0x9009('0xd')]);router[_0x9009('0xc')]('/:id',auth[_0x9009('0xa')](),controller['show']);router['post']('/',auth[_0x9009('0xa')](),interaction['tracked']('chat',_0x9009('0xe')),controller[_0x9009('0xf')]);router[_0x9009('0x10')](_0x9009('0x11'),controller[_0x9009('0x12')]);router[_0x9009('0x10')]('/:id/accept',auth[_0x9009('0xa')](),controller[_0x9009('0x13')]);router[_0x9009('0x10')](_0x9009('0x14'),auth[_0x9009('0xa')](),controller[_0x9009('0x15')]);router[_0x9009('0x16')]('/:id',auth[_0x9009('0xa')](),controller[_0x9009('0x17')]);module[_0x9009('0x18')]=router; \ No newline at end of file +var _0x9eb6=['post','chat','create','put','/:id','update','accept','/:id/reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show'];(function(_0x52c528,_0x46698f){var _0x5ba344=function(_0x4104ef){while(--_0x4104ef){_0x52c528['push'](_0x52c528['shift']());}};_0x5ba344(++_0x46698f);}(_0x9eb6,0x17a));var _0x69eb=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x9eb6[_0x4c6d6f];return _0x2d4478;};'use strict';var multer=require(_0x69eb('0x0'));var util=require(_0x69eb('0x1'));var path=require(_0x69eb('0x2'));var timeout=require('connect-timeout');var express=require(_0x69eb('0x3'));var router=express[_0x69eb('0x4')]();var fs_extra=require(_0x69eb('0x5'));var auth=require(_0x69eb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x69eb('0x7')]('/',auth[_0x69eb('0x8')](),controller[_0x69eb('0x9')]);router[_0x69eb('0x7')](_0x69eb('0xa'),auth['isAuthenticated'](),controller[_0x69eb('0xb')]);router[_0x69eb('0x7')]('/:id',auth[_0x69eb('0x8')](),controller[_0x69eb('0xc')]);router[_0x69eb('0xd')]('/',auth[_0x69eb('0x8')](),interaction['tracked'](_0x69eb('0xe'),'chatmessage:create'),controller[_0x69eb('0xf')]);router[_0x69eb('0x10')](_0x69eb('0x11'),controller[_0x69eb('0x12')]);router[_0x69eb('0x10')]('/:id/accept',auth[_0x69eb('0x8')](),controller[_0x69eb('0x13')]);router['put'](_0x69eb('0x14'),auth[_0x69eb('0x8')](),controller['reject']);router[_0x69eb('0x15')](_0x69eb('0x11'),auth[_0x69eb('0x8')](),controller[_0x69eb('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 23c15a5..60ff73f 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 _0xe2af=['medium','sequelize','TEXT'];(function(_0x35ff05,_0x42c284){var _0x5e52e7=function(_0xc4ec21){while(--_0xc4ec21){_0x35ff05['push'](_0x35ff05['shift']());}};_0x5e52e7(++_0x42c284);}(_0xe2af,0x178));var _0xfe2a=function(_0x166712,_0x36662c){_0x166712=_0x166712-0x0;var _0x299e74=_0xe2af[_0x166712];return _0x299e74;};'use strict';var Sequelize=require(_0xfe2a('0x0'));module['exports']={'body':{'type':Sequelize[_0xfe2a('0x1')](_0xfe2a('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xb497=['medium','sequelize'];(function(_0x341f55,_0x50862f){var _0x4057f3=function(_0x180545){while(--_0x180545){_0x341f55['push'](_0x341f55['shift']());}};_0x4057f3(++_0x50862f);}(_0xb497,0x9f));var _0x7b49=function(_0x245cf0,_0x4a36cf){_0x245cf0=_0x245cf0-0x0;var _0x4046ff=_0xb497[_0x245cf0];return _0x4046ff;};'use strict';var Sequelize=require(_0x7b49('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x7b49('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 9f608f3..ae3331c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4180c1,_0xc47b2){var _0x2e2ce6=function(_0x2a922f){while(--_0x2a922f){_0x4180c1['push'](_0x4180c1['shift']());}};_0x2e2ce6(++_0xc47b2);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x33e1e4,_0x2a13d7){var _0x3b5eb3=function(_0x494df2){while(--_0x494df2){_0x33e1e4['push'](_0x33e1e4['shift']());}};_0x3b5eb3(++_0x2a13d7);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 65e9eea..d2bd96d 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 _0xa354=['ChatOfflineMessage','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define'];(function(_0x258257,_0x32042d){var _0xafb58a=function(_0x506b5a){while(--_0x506b5a){_0x258257['push'](_0x258257['shift']());}};_0xafb58a(++_0x32042d);}(_0xa354,0x10a));var _0x4a35=function(_0x4a5d89,_0x5f13c1){_0x4a5d89=_0x4a5d89-0x0;var _0x30abad=_0xa354[_0x4a5d89];return _0x30abad;};'use strict';var _=require(_0x4a35('0x0'));var util=require('util');var logger=require(_0x4a35('0x1'))(_0x4a35('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4a35('0x3'));var fs=require('fs');var path=require(_0x4a35('0x4'));var rimraf=require(_0x4a35('0x5'));var config=require(_0x4a35('0x6'));var attributes=require(_0x4a35('0x7'));module[_0x4a35('0x8')]=function(_0x2c39bd,_0x1a6904){return _0x2c39bd[_0x4a35('0x9')](_0x4a35('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4a35('0xb')});}; \ No newline at end of file +var _0xff3e=['./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3f0fc2,_0x58cd80){var _0x2bd742=function(_0x4d18ed){while(--_0x4d18ed){_0x3f0fc2['push'](_0x3f0fc2['shift']());}};_0x2bd742(++_0x58cd80);}(_0xff3e,0xf5));var _0xeff3=function(_0x376d19,_0xeaa649){_0x376d19=_0x376d19-0x0;var _0x1a2624=_0xff3e[_0x376d19];return _0x1a2624;};'use strict';var _=require('lodash');var util=require(_0xeff3('0x0'));var logger=require(_0xeff3('0x1'))('api');var moment=require(_0xeff3('0x2'));var BPromise=require(_0xeff3('0x3'));var rp=require(_0xeff3('0x4'));var fs=require('fs');var path=require(_0xeff3('0x5'));var rimraf=require('rimraf');var config=require(_0xeff3('0x6'));var attributes=require(_0xeff3('0x7'));module[_0xeff3('0x8')]=function(_0x40560d,_0x4691d7){return _0x40560d[_0xeff3('0x9')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeff3('0xa'),'collate':_0xeff3('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index bc1f828..8747822 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 _0xa72f=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x27202d,_0x2f43bf){var _0xed613=function(_0x2697fe){while(--_0x2697fe){_0x27202d['push'](_0x27202d['shift']());}};_0xed613(++_0x2f43bf);}(_0xa72f,0x170));var _0xfa72=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0xa72f[_0x1ac6ec];return _0x48a489;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa72('0x0'));var BPromise=require(_0xfa72('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa72('0x2'));var db=require(_0xfa72('0x3'))['db'];var utils=require(_0xfa72('0x4'));var logger=require('../../config/logger')(_0xfa72('0x5'));var config=require(_0xfa72('0x6'));var jayson=require(_0xfa72('0x7'));var client=jayson[_0xfa72('0x8')][_0xfa72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13427b,_0x5e457b,_0x3c692e){return new BPromise(function(_0x24ab42,_0x3fd34f){return client[_0xfa72('0xa')](_0x13427b,_0x3c692e)[_0xfa72('0xb')](function(_0x4e0f2f){logger[_0xfa72('0xc')](_0xfa72('0xd'),_0x5e457b,_0xfa72('0xe'));logger[_0xfa72('0xf')](_0xfa72('0x10'),_0x5e457b,_0xfa72('0xe'),JSON[_0xfa72('0x11')](_0x4e0f2f));if(_0x4e0f2f[_0xfa72('0x12')]){if(_0x4e0f2f[_0xfa72('0x12')][_0xfa72('0x13')]===0x1f4){logger[_0xfa72('0x12')](_0xfa72('0xd'),_0x5e457b,_0x4e0f2f[_0xfa72('0x12')][_0xfa72('0x14')]);return _0x3fd34f(_0x4e0f2f[_0xfa72('0x12')]['message']);}logger[_0xfa72('0x12')](_0xfa72('0xd'),_0x5e457b,_0x4e0f2f[_0xfa72('0x12')][_0xfa72('0x14')]);return _0x24ab42(_0x4e0f2f[_0xfa72('0x12')][_0xfa72('0x14')]);}else{logger[_0xfa72('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5e457b,'request\x20sent');_0x24ab42(_0x4e0f2f[_0xfa72('0x15')][_0xfa72('0x14')]);}})[_0xfa72('0x16')](function(_0x494b33){logger[_0xfa72('0x12')](_0xfa72('0xd'),_0x5e457b,_0x494b33);_0x3fd34f(_0x494b33);});});} \ No newline at end of file +var _0x1bfb=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1bfb,0x190));var _0xb1bf=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x1bfb[_0x10d34b];return _0x92b0bf;};'use strict';var _=require(_0xb1bf('0x0'));var util=require(_0xb1bf('0x1'));var moment=require(_0xb1bf('0x2'));var BPromise=require(_0xb1bf('0x3'));var rs=require(_0xb1bf('0x4'));var fs=require('fs');var Redis=require(_0xb1bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1bf('0x6'));var logger=require(_0xb1bf('0x7'))(_0xb1bf('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1bf('0x9'));var client=jayson['client'][_0xb1bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x377b04,_0x2df49a,_0x46eae){return new BPromise(function(_0x4b5195,_0x1af548){return client['request'](_0x377b04,_0x46eae)[_0xb1bf('0xb')](function(_0x723470){logger[_0xb1bf('0xc')](_0xb1bf('0xd'),_0x2df49a,_0xb1bf('0xe'));logger[_0xb1bf('0xf')](_0xb1bf('0x10'),_0x2df49a,_0xb1bf('0xe'),JSON[_0xb1bf('0x11')](_0x723470));if(_0x723470[_0xb1bf('0x12')]){if(_0x723470[_0xb1bf('0x12')][_0xb1bf('0x13')]===0x1f4){logger[_0xb1bf('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2df49a,_0x723470[_0xb1bf('0x12')]['message']);return _0x1af548(_0x723470['error'][_0xb1bf('0x14')]);}logger[_0xb1bf('0x12')](_0xb1bf('0xd'),_0x2df49a,_0x723470['error'][_0xb1bf('0x14')]);return _0x4b5195(_0x723470[_0xb1bf('0x12')][_0xb1bf('0x14')]);}else{logger[_0xb1bf('0xc')](_0xb1bf('0xd'),_0x2df49a,'request\x20sent');_0x4b5195(_0x723470[_0xb1bf('0x15')][_0xb1bf('0x14')]);}})['catch'](function(_0x3ff36f){logger[_0xb1bf('0x12')](_0xb1bf('0xd'),_0x2df49a,_0x3ff36f);_0x1af548(_0x3ff36f);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ec94413..7ea8b50 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 _0xca09=['create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatOfflineMessage.controller','get','/describe','isAuthenticated','describe'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0xca09,0x1cf));var _0x9ca0=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xca09[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x9ca0('0x0'));var path=require(_0x9ca0('0x1'));var timeout=require(_0x9ca0('0x2'));var express=require(_0x9ca0('0x3'));var router=express[_0x9ca0('0x4')]();var fs_extra=require(_0x9ca0('0x5'));var auth=require(_0x9ca0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9ca0('0x7'));router[_0x9ca0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9ca0('0x8')](_0x9ca0('0x9'),auth[_0x9ca0('0xa')](),controller[_0x9ca0('0xb')]);router[_0x9ca0('0x8')]('/:id',auth[_0x9ca0('0xa')](),controller['show']);router['post']('/',auth[_0x9ca0('0xa')](),controller[_0x9ca0('0xc')]);router[_0x9ca0('0xd')](_0x9ca0('0xe'),auth['isAuthenticated'](),controller[_0x9ca0('0xf')]);router[_0x9ca0('0x10')]('/:id',auth[_0x9ca0('0xa')](),controller[_0x9ca0('0x11')]);module[_0x9ca0('0x12')]=router; \ No newline at end of file +var _0x54d2=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','describe','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x54d2,0xe3));var _0x254d=function(_0x367905,_0x325a4d){_0x367905=_0x367905-0x0;var _0xa2a385=_0x54d2[_0x367905];return _0xa2a385;};'use strict';var multer=require(_0x254d('0x0'));var util=require(_0x254d('0x1'));var path=require(_0x254d('0x2'));var timeout=require(_0x254d('0x3'));var express=require(_0x254d('0x4'));var router=express['Router']();var fs_extra=require(_0x254d('0x5'));var auth=require(_0x254d('0x6'));var interaction=require(_0x254d('0x7'));var config=require(_0x254d('0x8'));var controller=require(_0x254d('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x254d('0xa')](_0x254d('0xb'),auth['isAuthenticated'](),controller[_0x254d('0xc')]);router[_0x254d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x254d('0xd')]);router[_0x254d('0xe')]('/',auth[_0x254d('0xf')](),controller[_0x254d('0x10')]);router[_0x254d('0x11')](_0x254d('0x12'),auth[_0x254d('0xf')](),controller[_0x254d('0x13')]);router[_0x254d('0x14')](_0x254d('0x12'),auth['isAuthenticated'](),controller[_0x254d('0x15')]);module[_0x254d('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 65c4cb5..ea8b8cd 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 _0x9c8e=['INTEGER','sequelize','exports','STRING','ENUM','timeout','mouseOver'];(function(_0x1387ae,_0x457bd0){var _0x52de06=function(_0x4e51c3){while(--_0x4e51c3){_0x1387ae['push'](_0x1387ae['shift']());}};_0x52de06(++_0x457bd0);}(_0x9c8e,0x151));var _0xe9c8=function(_0x3e3055,_0x48770d){_0x3e3055=_0x3e3055-0x0;var _0x332843=_0x9c8e[_0x3e3055];return _0x332843;};'use strict';var Sequelize=require(_0xe9c8('0x0'));module[_0xe9c8('0x1')]={'name':{'type':Sequelize[_0xe9c8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe9c8('0x3')]('mouseOver',_0xe9c8('0x4')),'defaultValue':_0xe9c8('0x5')},'selector':{'type':Sequelize[_0xe9c8('0x2')]},'timeout':{'type':Sequelize[_0xe9c8('0x6')]}}; \ No newline at end of file +var _0x6101=['STRING','ENUM','mouseOver','INTEGER','exports'];(function(_0x31c7fc,_0x11de6a){var _0x3c568e=function(_0xb9c0ed){while(--_0xb9c0ed){_0x31c7fc['push'](_0x31c7fc['shift']());}};_0x3c568e(++_0x11de6a);}(_0x6101,0x7c));var _0x1610=function(_0x27ecb2,_0x55c9b5){_0x27ecb2=_0x27ecb2-0x0;var _0x347f58=_0x6101[_0x27ecb2];return _0x347f58;};'use strict';var Sequelize=require('sequelize');module[_0x1610('0x0')]={'name':{'type':Sequelize[_0x1610('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1610('0x2')](_0x1610('0x3'),'timeout'),'defaultValue':_0x1610('0x3')},'selector':{'type':Sequelize[_0x1610('0x1')]},'timeout':{'type':Sequelize[_0x1610('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 37c6454..220aa91 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 _0xe5d5=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','find','catch','create','body','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x15e793,_0x1f64a6){var _0x9b8f78=function(_0x2f0c49){while(--_0x2f0c49){_0x15e793['push'](_0x15e793['shift']());}};_0x9b8f78(++_0x1f64a6);}(_0xe5d5,0x156));var _0x5e5d=function(_0x39bfaf,_0x44b531){_0x39bfaf=_0x39bfaf-0x0;var _0x4d4447=_0xe5d5[_0x39bfaf];return _0x4d4447;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5e5d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e5d('0x1'));var moment=require('moment');var BPromise=require(_0x5e5d('0x2'));var Mustache=require('mustache');var util=require(_0x5e5d('0x3'));var path=require(_0x5e5d('0x4'));var sox=require(_0x5e5d('0x5'));var csv=require(_0x5e5d('0x6'));var ejs=require(_0x5e5d('0x7'));var fs=require('fs');var fs_extra=require(_0x5e5d('0x8'));var _=require(_0x5e5d('0x9'));var squel=require(_0x5e5d('0xa'));var crypto=require(_0x5e5d('0xb'));var jsforce=require(_0x5e5d('0xc'));var deskjs=require(_0x5e5d('0xd'));var toCsv=require(_0x5e5d('0x6'));var querystring=require(_0x5e5d('0xe'));var Papa=require(_0x5e5d('0xf'));var Redis=require('ioredis');var authService=require(_0x5e5d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e5d('0x11'));var hardwareService=require(_0x5e5d('0x12'));var logger=require('../../config/logger')(_0x5e5d('0x13'));var utils=require(_0x5e5d('0x14'));var config=require(_0x5e5d('0x15'));var licenseUtil=require(_0x5e5d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff045,_0x442aed){_0x442aed=_0x442aed||0xcc;return function(_0x1e9be5){if(_0x1e9be5){return _0x4ff045['sendStatus'](_0x442aed);}return _0x4ff045[_0x5e5d('0x17')](_0x442aed)[_0x5e5d('0x18')]();};}function respondWithResult(_0x5a4474,_0x42f1f8){_0x42f1f8=_0x42f1f8||0xc8;return function(_0x3402cf){if(_0x3402cf){return _0x5a4474['status'](_0x42f1f8)['json'](_0x3402cf);}};}function respondWithFilteredResult(_0x5bf617,_0x1a3e5c){return function(_0x3dfb7e){if(_0x3dfb7e){var _0x79e8c1=typeof _0x1a3e5c[_0x5e5d('0x19')]==='undefined'&&typeof _0x1a3e5c[_0x5e5d('0x1a')]===_0x5e5d('0x1b');var _0x39964a=_0x3dfb7e[_0x5e5d('0x1c')];var _0x46b129=_0x79e8c1?0x0:_0x1a3e5c[_0x5e5d('0x19')];var _0x3b655b=_0x79e8c1?_0x3dfb7e[_0x5e5d('0x1c')]:_0x1a3e5c['offset']+_0x1a3e5c[_0x5e5d('0x1a')];var _0x1ceea7;if(_0x3b655b>=_0x39964a){_0x3b655b=_0x39964a;_0x1ceea7=0xc8;}else{_0x1ceea7=0xce;}_0x5bf617[_0x5e5d('0x17')](_0x1ceea7);return _0x5bf617[_0x5e5d('0x1d')](_0x5e5d('0x1e'),_0x46b129+'-'+_0x3b655b+'/'+_0x39964a)[_0x5e5d('0x1f')](_0x3dfb7e);}return null;};}function patchUpdates(_0x517b89){return function(_0x186fa6){try{jsonpatch['apply'](_0x186fa6,_0x517b89,!![]);}catch(_0x968d4b){return BPromise[_0x5e5d('0x20')](_0x968d4b);}return _0x186fa6[_0x5e5d('0x21')]();};}function saveUpdates(_0x4c9973,_0xbacdcb){return function(_0x488a49){if(_0x488a49){return _0x488a49[_0x5e5d('0x22')](_0x4c9973)[_0x5e5d('0x23')](function(_0x3e8a1d){return _0x3e8a1d;});}return null;};}function removeEntity(_0x49a558,_0x49d2e5){return function(_0x271af4){if(_0x271af4){return _0x271af4[_0x5e5d('0x24')]()['then'](function(){_0x49a558['status'](0xcc)[_0x5e5d('0x18')]();});}};}function handleEntityNotFound(_0x4063d5,_0xd466f7){return function(_0x479a1a){if(!_0x479a1a){_0x4063d5[_0x5e5d('0x25')](0x194);}return _0x479a1a;};}function handleError(_0x4de26a,_0x477d54){_0x477d54=_0x477d54||0x1f4;return function(_0x4ed6e5){logger[_0x5e5d('0x26')](_0x4ed6e5[_0x5e5d('0x27')]);if(_0x4ed6e5[_0x5e5d('0x28')]){delete _0x4ed6e5[_0x5e5d('0x28')];}_0x4de26a[_0x5e5d('0x17')](_0x477d54)[_0x5e5d('0x29')](_0x4ed6e5);};}exports[_0x5e5d('0x2a')]=function(_0x56b166,_0x3e407f){var _0x29a123={'raw':!![],'where':{'id':_0x56b166[_0x5e5d('0x2b')]['id']}},_0x3442c1={};_0x3442c1[_0x5e5d('0x2c')]=_[_0x5e5d('0x2d')](db[_0x5e5d('0x2e')][_0x5e5d('0x2f')]);_0x3442c1[_0x5e5d('0x30')]=_['keys'](_0x56b166[_0x5e5d('0x30')]);_0x3442c1['filters']=_['intersection'](_0x3442c1[_0x5e5d('0x2c')],_0x3442c1[_0x5e5d('0x30')]);_0x29a123[_0x5e5d('0x31')]=_[_0x5e5d('0x32')](_0x3442c1[_0x5e5d('0x2c')],qs['fields'](_0x56b166[_0x5e5d('0x30')][_0x5e5d('0x33')]));_0x29a123[_0x5e5d('0x31')]=_0x29a123[_0x5e5d('0x31')][_0x5e5d('0x34')]?_0x29a123[_0x5e5d('0x31')]:_0x3442c1[_0x5e5d('0x2c')];if(_0x56b166['query'][_0x5e5d('0x35')]){_0x29a123[_0x5e5d('0x36')]=[{'all':!![]}];}_0x29a123=_['merge']({},_0x29a123,_0x56b166['options']);return db[_0x5e5d('0x2e')][_0x5e5d('0x37')](_0x29a123)[_0x5e5d('0x23')](handleEntityNotFound(_0x3e407f,null))[_0x5e5d('0x23')](respondWithResult(_0x3e407f,null))[_0x5e5d('0x38')](handleError(_0x3e407f,null));};exports[_0x5e5d('0x39')]=function(_0x5a5696,_0x2d5411){return db['ChatProactiveAction'][_0x5e5d('0x39')](_0x5a5696[_0x5e5d('0x3a')],{})[_0x5e5d('0x23')](respondWithResult(_0x2d5411,0xc9))[_0x5e5d('0x38')](handleError(_0x2d5411,null));};exports[_0x5e5d('0x22')]=function(_0x5ba035,_0x1301ef){if(_0x5ba035[_0x5e5d('0x3a')]['id']){delete _0x5ba035['body']['id'];}return db[_0x5e5d('0x2e')]['find']({'where':{'id':_0x5ba035[_0x5e5d('0x2b')]['id']}})[_0x5e5d('0x23')](handleEntityNotFound(_0x1301ef,null))[_0x5e5d('0x23')](saveUpdates(_0x5ba035[_0x5e5d('0x3a')],null))[_0x5e5d('0x23')](respondWithResult(_0x1301ef,null))[_0x5e5d('0x38')](handleError(_0x1301ef,null));};exports[_0x5e5d('0x24')]=function(_0x13a7f2,_0xa51e05){return db[_0x5e5d('0x2e')][_0x5e5d('0x37')]({'where':{'id':_0x13a7f2[_0x5e5d('0x2b')]['id']}})['then'](handleEntityNotFound(_0xa51e05,null))[_0x5e5d('0x23')](removeEntity(_0xa51e05,null))[_0x5e5d('0x38')](handleError(_0xa51e05,null));}; \ No newline at end of file +var _0x0c02=['sendStatus','name','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','options','catch','create','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x126321,_0x263992){var _0x3febf7=function(_0x92cb00){while(--_0x92cb00){_0x126321['push'](_0x126321['shift']());}};_0x3febf7(++_0x263992);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20c0('0x0'));var zipdir=require(_0x20c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20c0('0x2'));var moment=require(_0x20c0('0x3'));var BPromise=require(_0x20c0('0x4'));var Mustache=require(_0x20c0('0x5'));var util=require(_0x20c0('0x6'));var path=require(_0x20c0('0x7'));var sox=require(_0x20c0('0x8'));var csv=require(_0x20c0('0x9'));var ejs=require(_0x20c0('0xa'));var fs=require('fs');var fs_extra=require(_0x20c0('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x20c0('0xc'));var toCsv=require(_0x20c0('0x9'));var querystring=require(_0x20c0('0xd'));var Papa=require(_0x20c0('0xe'));var Redis=require(_0x20c0('0xf'));var authService=require(_0x20c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x20c0('0x11'));var config=require(_0x20c0('0x12'));var licenseUtil=require(_0x20c0('0x13'));var db=require(_0x20c0('0x14'))['db'];function respondWithStatusCode(_0x4ed79e,_0x56fa09){_0x56fa09=_0x56fa09||0xcc;return function(_0x55854e){if(_0x55854e){return _0x4ed79e['sendStatus'](_0x56fa09);}return _0x4ed79e[_0x20c0('0x15')](_0x56fa09)[_0x20c0('0x16')]();};}function respondWithResult(_0x42161f,_0x3b2bba){_0x3b2bba=_0x3b2bba||0xc8;return function(_0x37f4e0){if(_0x37f4e0){return _0x42161f[_0x20c0('0x15')](_0x3b2bba)[_0x20c0('0x17')](_0x37f4e0);}};}function respondWithFilteredResult(_0x105839,_0x280aff){return function(_0x5a5e25){if(_0x5a5e25){var _0xd80b64=typeof _0x280aff[_0x20c0('0x18')]===_0x20c0('0x19')&&typeof _0x280aff[_0x20c0('0x1a')]===_0x20c0('0x19');var _0xeff5b9=_0x5a5e25['count'];var _0x55de3b=_0xd80b64?0x0:_0x280aff['offset'];var _0x10a921=_0xd80b64?_0x5a5e25[_0x20c0('0x1b')]:_0x280aff[_0x20c0('0x18')]+_0x280aff[_0x20c0('0x1a')];var _0x5b3725;if(_0x10a921>=_0xeff5b9){_0x10a921=_0xeff5b9;_0x5b3725=0xc8;}else{_0x5b3725=0xce;}_0x105839[_0x20c0('0x15')](_0x5b3725);return _0x105839[_0x20c0('0x1c')](_0x20c0('0x1d'),_0x55de3b+'-'+_0x10a921+'/'+_0xeff5b9)['json'](_0x5a5e25);}return null;};}function patchUpdates(_0x54bd1e){return function(_0x343db7){try{jsonpatch[_0x20c0('0x1e')](_0x343db7,_0x54bd1e,!![]);}catch(_0x1407d3){return BPromise[_0x20c0('0x1f')](_0x1407d3);}return _0x343db7[_0x20c0('0x20')]();};}function saveUpdates(_0x53d8e8,_0x2213f5){return function(_0x28959a){if(_0x28959a){return _0x28959a[_0x20c0('0x21')](_0x53d8e8)[_0x20c0('0x22')](function(_0x52b8b8){return _0x52b8b8;});}return null;};}function removeEntity(_0xfea1eb,_0x3e545c){return function(_0x2447e6){if(_0x2447e6){return _0x2447e6[_0x20c0('0x23')]()[_0x20c0('0x22')](function(){_0xfea1eb[_0x20c0('0x15')](0xcc)[_0x20c0('0x16')]();});}};}function handleEntityNotFound(_0x55b129,_0x45c08c){return function(_0x595d94){if(!_0x595d94){_0x55b129[_0x20c0('0x24')](0x194);}return _0x595d94;};}function handleError(_0x31565b,_0x11da5a){_0x11da5a=_0x11da5a||0x1f4;return function(_0x14dac3){logger['error'](_0x14dac3['stack']);if(_0x14dac3[_0x20c0('0x25')]){delete _0x14dac3[_0x20c0('0x25')];}_0x31565b[_0x20c0('0x15')](_0x11da5a)['send'](_0x14dac3);};}exports[_0x20c0('0x26')]=function(_0x25592b,_0x1bcfaf){var _0x41c743={'raw':!![],'where':{'id':_0x25592b['params']['id']}},_0x4baaed={};_0x4baaed[_0x20c0('0x27')]=_[_0x20c0('0x28')](db[_0x20c0('0x29')][_0x20c0('0x2a')]);_0x4baaed[_0x20c0('0x2b')]=_[_0x20c0('0x28')](_0x25592b[_0x20c0('0x2b')]);_0x4baaed[_0x20c0('0x2c')]=_[_0x20c0('0x2d')](_0x4baaed[_0x20c0('0x27')],_0x4baaed[_0x20c0('0x2b')]);_0x41c743[_0x20c0('0x2e')]=_[_0x20c0('0x2d')](_0x4baaed[_0x20c0('0x27')],qs['fields'](_0x25592b[_0x20c0('0x2b')][_0x20c0('0x2f')]));_0x41c743[_0x20c0('0x2e')]=_0x41c743[_0x20c0('0x2e')]['length']?_0x41c743[_0x20c0('0x2e')]:_0x4baaed[_0x20c0('0x27')];if(_0x25592b[_0x20c0('0x2b')][_0x20c0('0x30')]){_0x41c743[_0x20c0('0x31')]=[{'all':!![]}];}_0x41c743=_['merge']({},_0x41c743,_0x25592b[_0x20c0('0x32')]);return db['ChatProactiveAction']['find'](_0x41c743)[_0x20c0('0x22')](handleEntityNotFound(_0x1bcfaf,null))[_0x20c0('0x22')](respondWithResult(_0x1bcfaf,null))[_0x20c0('0x33')](handleError(_0x1bcfaf,null));};exports[_0x20c0('0x34')]=function(_0x1a4aeb,_0x39fd84){return db[_0x20c0('0x29')]['create'](_0x1a4aeb['body'],{})['then'](respondWithResult(_0x39fd84,0xc9))[_0x20c0('0x33')](handleError(_0x39fd84,null));};exports[_0x20c0('0x21')]=function(_0x545b39,_0x346a04){if(_0x545b39[_0x20c0('0x35')]['id']){delete _0x545b39['body']['id'];}return db['ChatProactiveAction'][_0x20c0('0x36')]({'where':{'id':_0x545b39[_0x20c0('0x37')]['id']}})['then'](handleEntityNotFound(_0x346a04,null))[_0x20c0('0x22')](saveUpdates(_0x545b39['body'],null))[_0x20c0('0x22')](respondWithResult(_0x346a04,null))[_0x20c0('0x33')](handleError(_0x346a04,null));};exports[_0x20c0('0x23')]=function(_0x291e66,_0x5997f5){return db[_0x20c0('0x29')][_0x20c0('0x36')]({'where':{'id':_0x291e66[_0x20c0('0x37')]['id']}})[_0x20c0('0x22')](handleEntityNotFound(_0x5997f5,null))[_0x20c0('0x22')](removeEntity(_0x5997f5,null))[_0x20c0('0x33')](handleError(_0x5997f5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 419f93c..f1e48f8 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 _0x89d9=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x89d9,0x11c));var _0x989d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x89d9[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x989d('0x0'));var util=require(_0x989d('0x1'));var logger=require('../../config/logger')(_0x989d('0x2'));var moment=require(_0x989d('0x3'));var BPromise=require(_0x989d('0x4'));var rp=require(_0x989d('0x5'));var fs=require('fs');var path=require(_0x989d('0x6'));var rimraf=require(_0x989d('0x7'));var config=require(_0x989d('0x8'));var attributes=require(_0x989d('0x9'));module[_0x989d('0xa')]=function(_0x50ce57,_0x163c7e){return _0x50ce57[_0x989d('0xb')](_0x989d('0xc'),attributes,{'tableName':_0x989d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7216=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','ChatProactiveAction'];(function(_0x40cd61,_0x36162c){var _0x120ce8=function(_0x59c7cc){while(--_0x59c7cc){_0x40cd61['push'](_0x40cd61['shift']());}};_0x120ce8(++_0x36162c);}(_0x7216,0x11e));var _0x6721=function(_0x47e7c1,_0x290f15){_0x47e7c1=_0x47e7c1-0x0;var _0x4244f7=_0x7216[_0x47e7c1];return _0x4244f7;};'use strict';var _=require(_0x6721('0x0'));var util=require(_0x6721('0x1'));var logger=require(_0x6721('0x2'))(_0x6721('0x3'));var moment=require(_0x6721('0x4'));var BPromise=require('bluebird');var rp=require(_0x6721('0x5'));var fs=require('fs');var path=require(_0x6721('0x6'));var rimraf=require(_0x6721('0x7'));var config=require(_0x6721('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x6721('0x9')]=function(_0x2f595d,_0x120202){return _0x2f595d['define'](_0x6721('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 7681438..1439b9e 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 _0xd40f=['../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0xd40f,0x160));var _0xfd40=function(_0x19a7cb,_0x1384f7){_0x19a7cb=_0x19a7cb-0x0;var _0x455ed2=_0xd40f[_0x19a7cb];return _0x455ed2;};'use strict';var _=require(_0xfd40('0x0'));var util=require(_0xfd40('0x1'));var moment=require(_0xfd40('0x2'));var BPromise=require(_0xfd40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd40('0x4'))['db'];var utils=require(_0xfd40('0x5'));var logger=require(_0xfd40('0x6'))(_0xfd40('0x7'));var config=require(_0xfd40('0x8'));var jayson=require(_0xfd40('0x9'));var client=jayson[_0xfd40('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28311a,_0x3c5083,_0x579d27){return new BPromise(function(_0x3c0e46,_0x595db5){return client[_0xfd40('0xb')](_0x28311a,_0x579d27)[_0xfd40('0xc')](function(_0x439266){logger[_0xfd40('0xd')](_0xfd40('0xe'),_0x3c5083,'request\x20sent');logger[_0xfd40('0xf')](_0xfd40('0x10'),_0x3c5083,_0xfd40('0x11'),JSON['stringify'](_0x439266));if(_0x439266['error']){if(_0x439266[_0xfd40('0x12')]['code']===0x1f4){logger['error'](_0xfd40('0xe'),_0x3c5083,_0x439266['error']['message']);return _0x595db5(_0x439266['error']['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3c5083,_0x439266[_0xfd40('0x12')][_0xfd40('0x13')]);return _0x3c0e46(_0x439266[_0xfd40('0x12')][_0xfd40('0x13')]);}else{logger[_0xfd40('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x3c5083,_0xfd40('0x11'));_0x3c0e46(_0x439266['result']['message']);}})['catch'](function(_0x35b34c){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3c5083,_0x35b34c);_0x595db5(_0x35b34c);});});} \ No newline at end of file +var _0x6a3b=['debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x4e310c,_0x161a51){var _0x247cf7=function(_0x2e9ad7){while(--_0x2e9ad7){_0x4e310c['push'](_0x4e310c['shift']());}};_0x247cf7(++_0x161a51);}(_0x6a3b,0x1a9));var _0xb6a3=function(_0x49eec3,_0x4c0bdb){_0x49eec3=_0x49eec3-0x0;var _0x44b4c0=_0x6a3b[_0x49eec3];return _0x44b4c0;};'use strict';var _=require(_0xb6a3('0x0'));var util=require(_0xb6a3('0x1'));var moment=require(_0xb6a3('0x2'));var BPromise=require('bluebird');var rs=require(_0xb6a3('0x3'));var fs=require('fs');var Redis=require(_0xb6a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6a3('0x5'));var logger=require(_0xb6a3('0x6'))(_0xb6a3('0x7'));var config=require(_0xb6a3('0x8'));var jayson=require(_0xb6a3('0x9'));var client=jayson[_0xb6a3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11f76d,_0x3e96bf,_0x5128e6){return new BPromise(function(_0x24c372,_0x3f07ba){return client['request'](_0x11f76d,_0x5128e6)[_0xb6a3('0xb')](function(_0x2729cd){logger[_0xb6a3('0xc')](_0xb6a3('0xd'),_0x3e96bf,_0xb6a3('0xe'));logger[_0xb6a3('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3e96bf,_0xb6a3('0xe'),JSON[_0xb6a3('0x10')](_0x2729cd));if(_0x2729cd[_0xb6a3('0x11')]){if(_0x2729cd[_0xb6a3('0x11')][_0xb6a3('0x12')]===0x1f4){logger[_0xb6a3('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x3e96bf,_0x2729cd['error'][_0xb6a3('0x13')]);return _0x3f07ba(_0x2729cd[_0xb6a3('0x11')][_0xb6a3('0x13')]);}logger[_0xb6a3('0x11')](_0xb6a3('0xd'),_0x3e96bf,_0x2729cd[_0xb6a3('0x11')][_0xb6a3('0x13')]);return _0x24c372(_0x2729cd[_0xb6a3('0x11')][_0xb6a3('0x13')]);}else{logger[_0xb6a3('0xc')](_0xb6a3('0xd'),_0x3e96bf,_0xb6a3('0xe'));_0x24c372(_0x2729cd[_0xb6a3('0x14')][_0xb6a3('0x13')]);}})[_0xb6a3('0x15')](function(_0x520059){logger['error'](_0xb6a3('0xd'),_0x3e96bf,_0x520059);_0x3f07ba(_0x520059);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b168219..0163069 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 _0x9c5a=['/:id','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','update'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2f4ef1,_0x431599){_0x2f4ef1=_0x2f4ef1-0x0;var _0x5884e0=_0x9c5a[_0x2f4ef1];return _0x5884e0;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./chatProactiveAction.controller');router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0x9')](),controller[_0xa9c5('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa9c5('0xb')]);router[_0xa9c5('0xc')]('/:id',auth[_0xa9c5('0x9')](),controller[_0xa9c5('0xd')]);router['delete'](_0xa9c5('0xe'),auth[_0xa9c5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xabce,0x103));var _0xeabc=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xabce[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('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 81113aa..29d51aa 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 _0x4c3a=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0xaa8c9b,_0xa61f58){var _0x559880=function(_0x196f1c){while(--_0x196f1c){_0xaa8c9b['push'](_0xaa8c9b['shift']());}};_0x559880(++_0xa61f58);}(_0x4c3a,0x1df));var _0xa4c3=function(_0x4bd8e1,_0x5e9388){_0x4bd8e1=_0x4bd8e1-0x0;var _0x286282=_0x4c3a[_0x4bd8e1];return _0x286282;};'use strict';var Sequelize=require('sequelize');module[_0xa4c3('0x0')]={'name':{'type':Sequelize[_0xa4c3('0x1')],'unique':_0xa4c3('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa4c3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa4c3('0x4')](_0xa4c3('0x5'),_0xa4c3('0x6'),_0xa4c3('0x7'))}}; \ No newline at end of file +var _0x8281=['exports','name','STRING','ENUM','rrmemory','beepall','sequelize'];(function(_0x23dd0c,_0x83f73c){var _0x576742=function(_0x1cc94a){while(--_0x1cc94a){_0x23dd0c['push'](_0x23dd0c['shift']());}};_0x576742(++_0x83f73c);}(_0x8281,0x8b));var _0x1828=function(_0x4f381d,_0x2d8287){_0x4f381d=_0x4f381d-0x0;var _0x3ac952=_0x8281[_0x4f381d];return _0x3ac952;};'use strict';var Sequelize=require(_0x1828('0x0'));module[_0x1828('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1828('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1828('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1828('0x4')](_0x1828('0x5'),_0x1828('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c699167..6707357 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 _0xbef7=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','jayson/promise','client','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','send','map','ChatQueue','fieldName','type','key','name','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','rows','show','params','rawAttributes','intersection','length','include','merge','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserChatQueue','findAndCountAll','UserId','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','User','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userChatQueue:save','removeTeams','findAll','Agents','select','field','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce'];(function(_0x3ff938,_0x46bc9c){var _0x2f9791=function(_0x12a2f6){while(--_0x12a2f6){_0x3ff938['push'](_0x3ff938['shift']());}};_0x2f9791(++_0x46bc9c);}(_0xbef7,0x1cb));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7bef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7bef('0x1'));var jsonpatch=require(_0x7bef('0x2'));var rp=require(_0x7bef('0x3'));var moment=require(_0x7bef('0x4'));var BPromise=require(_0x7bef('0x5'));var Mustache=require(_0x7bef('0x6'));var util=require(_0x7bef('0x7'));var path=require(_0x7bef('0x8'));var sox=require(_0x7bef('0x9'));var csv=require(_0x7bef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bef('0xb'));var _=require('lodash');var squel=require(_0x7bef('0xc'));var crypto=require(_0x7bef('0xd'));var jsforce=require(_0x7bef('0xe'));var deskjs=require(_0x7bef('0xf'));var toCsv=require(_0x7bef('0xa'));var querystring=require('querystring');var Papa=require(_0x7bef('0x10'));var Redis=require(_0x7bef('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7bef('0x12'));var as=require(_0x7bef('0x13'));var hardwareService=require(_0x7bef('0x14'));var logger=require(_0x7bef('0x15'))(_0x7bef('0x16'));var utils=require(_0x7bef('0x17'));var config=require(_0x7bef('0x18'));var licenseUtil=require(_0x7bef('0x19'));var db=require(_0x7bef('0x1a'))['db'];config['redis']=_[_0x7bef('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7bef('0x1c'))(new Redis(config[_0x7bef('0x1d')]));require('./chatQueue.socket')[_0x7bef('0x1e')](socket);var jayson=require(_0x7bef('0x1f'));var client=jayson[_0x7bef('0x20')][_0x7bef('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x46449a,_0x548081,_0x508647,_0x5eff43){return new BPromise(function(_0x10b384,_0x256fbc){var _0x3f9d7e=_0x5eff43||client;return _0x3f9d7e['request'](_0x46449a,_0x508647)['then'](function(_0x93f1f1){logger[_0x7bef('0x22')](_0x7bef('0x23'),_0x548081,_0x7bef('0x24'));logger[_0x7bef('0x25')](_0x7bef('0x26'),_0x548081,_0x7bef('0x24'),JSON['stringify'](_0x93f1f1));if(_0x93f1f1[_0x7bef('0x27')]){if(_0x93f1f1[_0x7bef('0x27')]['code']===0x1f4){logger['error'](_0x7bef('0x23'),_0x548081,_0x93f1f1[_0x7bef('0x27')][_0x7bef('0x28')]);return _0x256fbc(_0x93f1f1[_0x7bef('0x27')]['message']);}logger[_0x7bef('0x27')](_0x7bef('0x23'),_0x548081,_0x93f1f1['error'][_0x7bef('0x28')]);return _0x10b384(_0x93f1f1['error'][_0x7bef('0x28')]);}else{logger[_0x7bef('0x22')](_0x7bef('0x23'),_0x548081,_0x7bef('0x24'));_0x10b384(_0x93f1f1[_0x7bef('0x29')][_0x7bef('0x28')]);}})['catch'](function(_0x54609c){logger['error'](_0x7bef('0x23'),_0x548081,_0x54609c);_0x256fbc(_0x54609c);});});}function respondWithStatusCode(_0x5134fa,_0x289191){_0x289191=_0x289191||0xcc;return function(_0x42246a){if(_0x42246a){return _0x5134fa[_0x7bef('0x2a')](_0x289191);}return _0x5134fa[_0x7bef('0x2b')](_0x289191)[_0x7bef('0x2c')]();};}function respondWithResult(_0x12754c,_0x582a61){_0x582a61=_0x582a61||0xc8;return function(_0x4e13bc){if(_0x4e13bc){return _0x12754c[_0x7bef('0x2b')](_0x582a61)[_0x7bef('0x2d')](_0x4e13bc);}};}function respondWithFilteredResult(_0x1b90b4,_0x18c9f9){return function(_0x37e415){if(_0x37e415){var _0x1d3721=typeof _0x18c9f9[_0x7bef('0x2e')]===_0x7bef('0x2f')&&typeof _0x18c9f9['limit']==='undefined';var _0x2ab075=_0x37e415['count'];var _0x2c4845=_0x1d3721?0x0:_0x18c9f9['offset'];var _0x13b61d=_0x1d3721?_0x37e415[_0x7bef('0x30')]:_0x18c9f9[_0x7bef('0x2e')]+_0x18c9f9[_0x7bef('0x31')];var _0xe34450;if(_0x13b61d>=_0x2ab075){_0x13b61d=_0x2ab075;_0xe34450=0xc8;}else{_0xe34450=0xce;}_0x1b90b4['status'](_0xe34450);return _0x1b90b4[_0x7bef('0x32')](_0x7bef('0x33'),_0x2c4845+'-'+_0x13b61d+'/'+_0x2ab075)['json'](_0x37e415);}return null;};}function patchUpdates(_0x4920b6){return function(_0x1a0c94){try{jsonpatch[_0x7bef('0x34')](_0x1a0c94,_0x4920b6,!![]);}catch(_0x365744){return BPromise[_0x7bef('0x35')](_0x365744);}return _0x1a0c94[_0x7bef('0x36')]();};}function saveUpdates(_0x8dcb56,_0xc7916){return function(_0x594547){if(_0x594547){return _0x594547[_0x7bef('0x37')](_0x8dcb56)[_0x7bef('0x38')](function(_0x23a0be){return _0x23a0be;});}return null;};}function removeEntity(_0x5f150f,_0x53bf75){return function(_0x2dc6b9){if(_0x2dc6b9){return _0x2dc6b9[_0x7bef('0x39')]()[_0x7bef('0x38')](function(){var _0x4326d5=_0x2dc6b9[_0x7bef('0x3a')]({'plain':!![]});var _0x2157a0=_0x7bef('0x3b');return db[_0x7bef('0x3c')]['destroy']({'where':{'type':_0x2157a0,'resourceId':_0x4326d5['id']}})[_0x7bef('0x38')](function(){return _0x2dc6b9;});})[_0x7bef('0x38')](function(){_0x5f150f[_0x7bef('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2a994,_0x295904){return function(_0x59715a){if(!_0x59715a){_0xd2a994[_0x7bef('0x2a')](0x194);}return _0x59715a;};}function handleError(_0x362594,_0x5799fc){_0x5799fc=_0x5799fc||0x1f4;return function(_0x534c3c){logger[_0x7bef('0x27')](_0x534c3c['stack']);if(_0x534c3c['name']){delete _0x534c3c['name'];}_0x362594[_0x7bef('0x2b')](_0x5799fc)[_0x7bef('0x3d')](_0x534c3c);};}exports['index']=function(_0x57ebe7,_0x8e5cd8){var _0x29e09c={},_0x353cb8={},_0xfdadc0={'count':0x0,'rows':[]};var _0x24157c=_[_0x7bef('0x3e')](db[_0x7bef('0x3f')]['rawAttributes'],function(_0x1b86f1){return{'name':_0x1b86f1[_0x7bef('0x40')],'type':_0x1b86f1[_0x7bef('0x41')][_0x7bef('0x42')]};});_0x353cb8['model']=_[_0x7bef('0x3e')](_0x24157c,_0x7bef('0x43'));_0x353cb8[_0x7bef('0x44')]=_[_0x7bef('0x45')](_0x57ebe7[_0x7bef('0x44')]);_0x353cb8[_0x7bef('0x46')]=_['intersection'](_0x353cb8[_0x7bef('0x47')],_0x353cb8[_0x7bef('0x44')]);_0x29e09c[_0x7bef('0x48')]=_['intersection'](_0x353cb8[_0x7bef('0x47')],qs[_0x7bef('0x49')](_0x57ebe7[_0x7bef('0x44')][_0x7bef('0x49')]));_0x29e09c[_0x7bef('0x48')]=_0x29e09c[_0x7bef('0x48')]['length']?_0x29e09c[_0x7bef('0x48')]:_0x353cb8['model'];if(!_0x57ebe7['query'][_0x7bef('0x4a')](_0x7bef('0x4b'))){_0x29e09c[_0x7bef('0x31')]=qs[_0x7bef('0x31')](_0x57ebe7[_0x7bef('0x44')][_0x7bef('0x31')]);_0x29e09c['offset']=qs[_0x7bef('0x2e')](_0x57ebe7[_0x7bef('0x44')][_0x7bef('0x2e')]);}_0x29e09c[_0x7bef('0x4c')]=qs[_0x7bef('0x4d')](_0x57ebe7['query']['sort']);_0x29e09c[_0x7bef('0x4e')]=qs[_0x7bef('0x46')](_['pick'](_0x57ebe7['query'],_0x353cb8[_0x7bef('0x46')]),_0x24157c);if(_0x57ebe7[_0x7bef('0x44')][_0x7bef('0x4f')]){_0x29e09c[_0x7bef('0x4e')]=_['merge'](_0x29e09c[_0x7bef('0x4e')],{'$or':_[_0x7bef('0x3e')](_0x24157c,function(_0x1b9813){if(_0x1b9813['type']!=='VIRTUAL'){var _0x7c6380={};_0x7c6380[_0x1b9813[_0x7bef('0x43')]]={'$like':'%'+_0x57ebe7[_0x7bef('0x44')]['filter']+'%'};return _0x7c6380;}})});}_0x29e09c=_['merge']({},_0x29e09c,_0x57ebe7[_0x7bef('0x50')]);var _0x12a4f2={'where':_0x29e09c[_0x7bef('0x4e')]};return db[_0x7bef('0x3f')][_0x7bef('0x30')](_0x12a4f2)[_0x7bef('0x38')](function(_0x564cb8){_0xfdadc0[_0x7bef('0x30')]=_0x564cb8;if(_0x57ebe7[_0x7bef('0x44')][_0x7bef('0x51')]){_0x29e09c['include']=[{'all':!![]}];}return db[_0x7bef('0x3f')]['findAll'](_0x29e09c);})[_0x7bef('0x38')](function(_0x39f998){_0xfdadc0[_0x7bef('0x52')]=_0x39f998;return _0xfdadc0;})[_0x7bef('0x38')](respondWithFilteredResult(_0x8e5cd8,_0x29e09c))['catch'](handleError(_0x8e5cd8,null));};exports[_0x7bef('0x53')]=function(_0x1e8ecf,_0x30a86d){var _0x37637a={'raw':!![],'where':{'id':_0x1e8ecf[_0x7bef('0x54')]['id']}},_0x418c05={};_0x418c05[_0x7bef('0x47')]=_[_0x7bef('0x45')](db[_0x7bef('0x3f')][_0x7bef('0x55')]);_0x418c05['query']=_['keys'](_0x1e8ecf[_0x7bef('0x44')]);_0x418c05[_0x7bef('0x46')]=_[_0x7bef('0x56')](_0x418c05[_0x7bef('0x47')],_0x418c05['query']);_0x37637a[_0x7bef('0x48')]=_[_0x7bef('0x56')](_0x418c05[_0x7bef('0x47')],qs[_0x7bef('0x49')](_0x1e8ecf['query']['fields']));_0x37637a[_0x7bef('0x48')]=_0x37637a[_0x7bef('0x48')][_0x7bef('0x57')]?_0x37637a[_0x7bef('0x48')]:_0x418c05[_0x7bef('0x47')];if(_0x1e8ecf[_0x7bef('0x44')]['includeAll']){_0x37637a[_0x7bef('0x58')]=[{'all':!![]}];}_0x37637a=_[_0x7bef('0x59')]({},_0x37637a,_0x1e8ecf['options']);return db['ChatQueue'][_0x7bef('0x5a')](_0x37637a)[_0x7bef('0x38')](handleEntityNotFound(_0x30a86d,null))[_0x7bef('0x38')](respondWithResult(_0x30a86d,null))[_0x7bef('0x5b')](handleError(_0x30a86d,null));};exports[_0x7bef('0x5c')]=function(_0xfbea89,_0x4e295f){return db['ChatQueue'][_0x7bef('0x5c')](_0xfbea89['body'],{})[_0x7bef('0x38')](function(_0x5d18e0){var _0x27fb9f=_0xfbea89[_0x7bef('0x5d')][_0x7bef('0x3a')]({'plain':!![]});if(!_0x27fb9f)throw new Error(_0x7bef('0x5e'));if(_0x27fb9f[_0x7bef('0x5f')]===_0x7bef('0x5d')){var _0x259a8f=_0x5d18e0['get']({'plain':!![]});var _0x39ab4a=_0x7bef('0x3b');return db[_0x7bef('0x60')][_0x7bef('0x5a')]({'where':{'name':_0x39ab4a,'userProfileId':_0x27fb9f[_0x7bef('0x61')]},'raw':!![]})['then'](function(_0x204062){if(_0x204062&&_0x204062[_0x7bef('0x62')]===0x0){return db['UserProfileResource'][_0x7bef('0x5c')]({'name':_0x259a8f[_0x7bef('0x43')],'resourceId':_0x259a8f['id'],'type':_0x204062[_0x7bef('0x43')],'sectionId':_0x204062['id']},{})[_0x7bef('0x38')](function(){return _0x5d18e0;});}else{return _0x5d18e0;}})[_0x7bef('0x5b')](function(_0x33f755){logger[_0x7bef('0x27')](_0x7bef('0x63'),_0x33f755);throw _0x33f755;});}return _0x5d18e0;})[_0x7bef('0x38')](respondWithResult(_0x4e295f,0xc9))[_0x7bef('0x5b')](handleError(_0x4e295f,null));};exports['update']=function(_0x201ca7,_0x1131d2){if(_0x201ca7[_0x7bef('0x64')]['id']){delete _0x201ca7[_0x7bef('0x64')]['id'];}return db[_0x7bef('0x3f')]['find']({'where':{'id':_0x201ca7[_0x7bef('0x54')]['id']}})['then'](handleEntityNotFound(_0x1131d2,null))[_0x7bef('0x38')](saveUpdates(_0x201ca7[_0x7bef('0x64')],null))['then'](respondWithResult(_0x1131d2,null))['catch'](handleError(_0x1131d2,null));};exports['destroy']=function(_0x526259,_0x5883c1){return db[_0x7bef('0x3f')][_0x7bef('0x5a')]({'where':{'id':_0x526259[_0x7bef('0x54')]['id']}})['then'](handleEntityNotFound(_0x5883c1,null))[_0x7bef('0x38')](removeEntity(_0x5883c1,null))[_0x7bef('0x5b')](handleError(_0x5883c1,null));};exports['describe']=function(_0x176248,_0xada0ef){return db[_0x7bef('0x3f')][_0x7bef('0x65')]()[_0x7bef('0x38')](respondWithResult(_0xada0ef,null))[_0x7bef('0x5b')](handleError(_0xada0ef,null));};exports['getMembers']=function(_0xaf4b33,_0x36327a,_0x4c7230){var _0x26eca3={'raw':!![],'where':{}},_0x81ca9={},_0x37f68a;return db['ChatQueue'][_0x7bef('0x66')]({'where':{'id':_0xaf4b33['params']['id']}})[_0x7bef('0x38')](handleEntityNotFound(_0x36327a,null))[_0x7bef('0x38')](function(_0x120c6e){if(_0x120c6e){_0x37f68a=_0x120c6e['get']({'plain':!![]});_0x81ca9[_0x7bef('0x47')]=_[_0x7bef('0x45')](db[_0x7bef('0x67')][_0x7bef('0x55')]);_0x81ca9[_0x7bef('0x44')]=_['keys'](_0xaf4b33[_0x7bef('0x44')]);_0x81ca9['filters']=_[_0x7bef('0x56')](_0x81ca9[_0x7bef('0x47')],_0x81ca9['query']);_0x26eca3[_0x7bef('0x48')]=_[_0x7bef('0x56')](_0x81ca9[_0x7bef('0x47')],qs[_0x7bef('0x49')](_0xaf4b33[_0x7bef('0x44')]['fields']));_0x26eca3[_0x7bef('0x48')]=_0x26eca3[_0x7bef('0x48')][_0x7bef('0x57')]?_0x26eca3[_0x7bef('0x48')]:_0x81ca9[_0x7bef('0x47')];if(!_0xaf4b33[_0x7bef('0x44')]['hasOwnProperty'](_0x7bef('0x4b'))){_0x26eca3[_0x7bef('0x31')]=qs[_0x7bef('0x31')](_0xaf4b33[_0x7bef('0x44')][_0x7bef('0x31')]);_0x26eca3[_0x7bef('0x2e')]=qs[_0x7bef('0x2e')](_0xaf4b33[_0x7bef('0x44')][_0x7bef('0x2e')]);}_0x26eca3[_0x7bef('0x4c')]=qs[_0x7bef('0x4d')](_0xaf4b33[_0x7bef('0x44')][_0x7bef('0x4d')]);_0x26eca3[_0x7bef('0x4e')]=qs[_0x7bef('0x46')](_['pick'](_0xaf4b33['query'],_0x81ca9[_0x7bef('0x46')]));_0x26eca3['where']['ChatQueueId']=_0x120c6e['id'];if(_0xaf4b33['query'][_0x7bef('0x4f')]){_0x26eca3['where']=_[_0x7bef('0x59')](_0x26eca3[_0x7bef('0x4e')],{'$or':_['map'](_0x26eca3[_0x7bef('0x48')],function(_0x337df1){var _0x304bfe={};_0x304bfe[_0x337df1]={'$like':'%'+_0xaf4b33['query'][_0x7bef('0x4f')]+'%'};return _0x304bfe;})});}_0x26eca3=_[_0x7bef('0x59')]({},_0x26eca3,_0xaf4b33[_0x7bef('0x50')]);return db[_0x7bef('0x67')]['findAll'](_0x26eca3);}})[_0x7bef('0x38')](function(_0x7ffd1e){if(_0x7ffd1e){return db['User'][_0x7bef('0x68')]({'where':{'id':_[_0x7bef('0x3e')](_0x7ffd1e,_0x7bef('0x69')),'role':'agent'},'attributes':['id',_0x7bef('0x43'),_0x7bef('0x6a'),_0x7bef('0x6b'),_0x7bef('0x6c')]});}})[_0x7bef('0x38')](function(_0x286759){if(_0x286759){return{'count':_0x286759['count'],'rows':_['map'](_0x286759['rows'],function(_0x2e3a21){return{'membername':_0x2e3a21[_0x7bef('0x43')],'UserId':_0x2e3a21['id'],'queue_name':_0x37f68a[_0x7bef('0x43')],'ChatQueueId':_0x37f68a['id'],'interface':util['format'](_0x7bef('0x6d'),_0x7bef('0x6e'),_0x2e3a21[_0x7bef('0x43')]),'penalty':0x0,'paused':_0x2e3a21[_0x7bef('0x6a')],'createdAt':_0x2e3a21[_0x7bef('0x6c')],'updatedAt':_0x2e3a21[_0x7bef('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x36327a,_0x26eca3))[_0x7bef('0x5b')](handleError(_0x36327a,null));};exports[_0x7bef('0x6f')]=function(_0x2481e0,_0x11550c,_0x4ff80d){var _0x142725={};var _0x14b158={};var _0x4933c7;var _0x1816b2;return db[_0x7bef('0x3f')][_0x7bef('0x66')]({'where':{'id':_0x2481e0[_0x7bef('0x54')]['id']}})['then'](handleEntityNotFound(_0x11550c,null))[_0x7bef('0x38')](function(_0x57a13e){if(_0x57a13e){_0x4933c7=_0x57a13e;_0x14b158[_0x7bef('0x47')]=_['keys'](db[_0x7bef('0x70')][_0x7bef('0x55')]);_0x14b158[_0x7bef('0x44')]=_[_0x7bef('0x45')](_0x2481e0[_0x7bef('0x44')]);_0x14b158[_0x7bef('0x46')]=_[_0x7bef('0x56')](_0x14b158[_0x7bef('0x47')],_0x14b158[_0x7bef('0x44')]);_0x142725[_0x7bef('0x48')]=_[_0x7bef('0x56')](_0x14b158['model'],qs[_0x7bef('0x49')](_0x2481e0[_0x7bef('0x44')][_0x7bef('0x49')]));_0x142725[_0x7bef('0x48')]=_0x142725['attributes']['length']?_0x142725[_0x7bef('0x48')]:_0x14b158[_0x7bef('0x47')];_0x142725[_0x7bef('0x4c')]=qs[_0x7bef('0x4d')](_0x2481e0[_0x7bef('0x44')]['sort']);_0x142725[_0x7bef('0x4e')]=qs[_0x7bef('0x46')](_[_0x7bef('0x71')](_0x2481e0[_0x7bef('0x44')],_0x14b158[_0x7bef('0x46')]));if(_0x2481e0['query'][_0x7bef('0x4f')]){_0x142725[_0x7bef('0x4e')]=_['merge'](_0x142725[_0x7bef('0x4e')],{'$or':_[_0x7bef('0x3e')](_0x142725[_0x7bef('0x48')],function(_0x4ac6ae){var _0x19ec3d={};_0x19ec3d[_0x4ac6ae]={'$like':'%'+_0x2481e0[_0x7bef('0x44')][_0x7bef('0x4f')]+'%'};return _0x19ec3d;})});}_0x142725=_[_0x7bef('0x59')]({},_0x142725,_0x2481e0['options']);return _0x4933c7[_0x7bef('0x6f')](_0x142725);}})[_0x7bef('0x38')](function(_0x4ca72d){if(_0x4ca72d){_0x1816b2=_0x4ca72d[_0x7bef('0x57')];if(!_0x2481e0[_0x7bef('0x44')][_0x7bef('0x4a')]('nolimit')){_0x142725[_0x7bef('0x31')]=qs[_0x7bef('0x31')](_0x2481e0[_0x7bef('0x44')][_0x7bef('0x31')]);_0x142725[_0x7bef('0x2e')]=qs[_0x7bef('0x2e')](_0x2481e0[_0x7bef('0x44')]['offset']);}return _0x4933c7['getTeams'](_0x142725);}})['then'](function(_0x594827){if(_0x594827){return _0x594827?{'count':_0x1816b2,'rows':_0x594827}:null;}})[_0x7bef('0x38')](respondWithResult(_0x11550c,null))['catch'](handleError(_0x11550c,null));};exports[_0x7bef('0x72')]=function(_0x68f27b,_0x997107,_0x2688a3){var _0x5ebbf9=_0x68f27b['body'][_0x7bef('0x73')];return db[_0x7bef('0x70')]['findAll']({'where':{'id':_0x5ebbf9},'attributes':['id'],'include':[{'model':db[_0x7bef('0x74')],'as':'Agents','attributes':['id',_0x7bef('0x43'),_0x7bef('0x75'),_0x7bef('0x76'),_0x7bef('0x77')],'raw':!![]}]})[_0x7bef('0x38')](function(_0x97addf){if(_0x97addf){var _0x16f0ce=_[_0x7bef('0x78')](_0x97addf,function(_0x3cd951){var _0x5aa0b9=_0x3cd951[_0x7bef('0x3a')]({'plain':!![]});return _0x5aa0b9['Agents'];});return db['ChatQueue'][_0x7bef('0x5a')]({'where':{'id':_0x68f27b['params']['id']}})[_0x7bef('0x38')](function(_0x3616c7){return db[_0x7bef('0x79')]['transaction'](function(_0xabfdad){return _0x3616c7[_0x7bef('0x72')](_0x5ebbf9,{'transaction':_0xabfdad})[_0x7bef('0x38')](function(){return BPromise[_0x7bef('0x7a')](_0x16f0ce,function(_0xad9d0b){return db['UserChatQueue'][_0x7bef('0x7b')]({'where':{'UserId':_0xad9d0b['id'],'ChatQueueId':_0x68f27b[_0x7bef('0x54')]['id']},'transaction':_0xabfdad});});})[_0x7bef('0x38')](function(){_0x16f0ce[_0x7bef('0x7c')](function(_0x574368){socket['emit'](_0x7bef('0x7d'),{'UserId':_0x574368['id'],'ChatQueueId':_0x3616c7['id']});});});});});}})[_0x7bef('0x38')](respondWithStatusCode(_0x997107,null))[_0x7bef('0x5b')](handleError(_0x997107,null));};exports[_0x7bef('0x7e')]=function(_0x196fab,_0x5c4e31,_0xf5efcb){return db[_0x7bef('0x70')][_0x7bef('0x7f')]({'where':{'id':_0x196fab[_0x7bef('0x44')][_0x7bef('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7bef('0x80'),'attributes':['id'],'raw':!![]}]})[_0x7bef('0x38')](handleEntityNotFound(_0x5c4e31,null))[_0x7bef('0x38')](function(_0x4584e8){var _0x49a9ae=_[_0x7bef('0x3e')](_0x4584e8,'id');var _0x74eadb=[];var _0x369fb0=[];var _0x338c71=squel[_0x7bef('0x81')]();_0x338c71[_0x7bef('0x82')]('tq.TeamId')[_0x7bef('0x83')](_0x7bef('0x84'),'tq')[_0x7bef('0x85')](_0x7bef('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7bef('0x87'),_0x196fab['params']['id']);for(var _0x255550=0x0;_0x255550<_0x4584e8['length'];_0x255550+=0x1){let _0x73070e=_0x4584e8[_0x255550];for(var _0x4181ec=0x0;_0x4181ec<_0x73070e[_0x7bef('0x80')]['length'];_0x4181ec+=0x1){let _0x2c79e9=_0x73070e['Agents'][_0x4181ec];var _0x4e98a6=_0x338c71[_0x7bef('0x88')]();_0x4e98a6[_0x7bef('0x4e')](_0x7bef('0x89'),_0x2c79e9['id']);_0x369fb0[_0x7bef('0x8a')](db[_0x7bef('0x79')]['query'](_0x4e98a6['toString'](),{'type':db[_0x7bef('0x79')][_0x7bef('0x8b')][_0x7bef('0x8c')]})[_0x7bef('0x38')](function(_0x579af1){if(_0x579af1[_0x7bef('0x57')]===0x1){return _0x2c79e9['id'];}else{var _0x521d71=_[_0x7bef('0x8d')](_['map'](_0x579af1,_0x7bef('0x8e')),function(_0x4a46ec){return _[_0x7bef('0x8f')](_0x49a9ae,_0x4a46ec);});if(_0x521d71){return _0x2c79e9['id'];}}}));}}return BPromise[_0x7bef('0x90')](_0x369fb0)[_0x7bef('0x38')](function(_0x62da58){_0x74eadb=_(_0x74eadb)[_0x7bef('0x91')](_0x62da58)[_0x7bef('0x92')]()[_0x7bef('0x93')]();return db[_0x7bef('0x3f')][_0x7bef('0x5a')]({'where':{'id':_0x196fab['params']['id']}})['then'](function(_0x5da978){return db['sequelize'][_0x7bef('0x94')](function(_0x3e1da5){return _0x5da978['removeTeams'](_0x196fab['query'][_0x7bef('0x73')],{'transaction':_0x3e1da5})[_0x7bef('0x38')](function(){if(!_[_0x7bef('0x95')](_0x74eadb)){return _0x5da978[_0x7bef('0x96')](_0x74eadb,{'transaction':_0x3e1da5});}})[_0x7bef('0x38')](function(){_0x74eadb[_0x7bef('0x7c')](function(_0x2a2fce){socket[_0x7bef('0x97')](_0x7bef('0x98'),{'UserId':_0x2a2fce,'ChatQueueId':_0x5da978['id']});});});});});});})[_0x7bef('0x38')](respondWithStatusCode(_0x5c4e31,null))[_0x7bef('0x5b')](handleError(_0x5c4e31,null));};exports[_0x7bef('0x99')]=function(_0xffee14,_0x5d3944,_0x3816e4){return db[_0x7bef('0x3f')][_0x7bef('0x5a')]({'where':{'id':_0xffee14[_0x7bef('0x54')]['id']}})[_0x7bef('0x38')](handleEntityNotFound(_0x5d3944,null))[_0x7bef('0x38')](function(_0x1595ad){if(_0x1595ad){return _0x1595ad[_0x7bef('0x99')](_0xffee14[_0x7bef('0x64')][_0x7bef('0x73')],_[_0x7bef('0x9a')](_0xffee14[_0x7bef('0x64')],[_0x7bef('0x73'),'id'])||{})[_0x7bef('0x9b')](function(_0x1e0999){for(var _0x59e79e=0x0;_0x59e79e<_0xffee14[_0x7bef('0x64')][_0x7bef('0x73')][_0x7bef('0x57')];_0x59e79e+=0x1){socket[_0x7bef('0x97')](_0x7bef('0x7d'),{'UserId':Number(_0xffee14[_0x7bef('0x64')][_0x7bef('0x73')][_0x59e79e]),'ChatQueueId':Number(_0xffee14[_0x7bef('0x54')]['id'])});}return _0x1e0999;});}})[_0x7bef('0x38')](respondWithResult(_0x5d3944,null))[_0x7bef('0x5b')](handleError(_0x5d3944,null));};exports[_0x7bef('0x96')]=function(_0x2a479d,_0x4bb847,_0x2a314d){return db[_0x7bef('0x3f')][_0x7bef('0x5a')]({'where':{'id':_0x2a479d[_0x7bef('0x54')]['id']}})[_0x7bef('0x38')](handleEntityNotFound(_0x4bb847,null))[_0x7bef('0x38')](function(_0x48dc9e){if(_0x48dc9e){return _0x48dc9e[_0x7bef('0x96')](_0x2a479d[_0x7bef('0x44')][_0x7bef('0x73')])['then'](function(){if(_[_0x7bef('0x9c')](_0x2a479d[_0x7bef('0x44')][_0x7bef('0x73')])){for(var _0x3cdbf3=0x0;_0x3cdbf3<_0x2a479d[_0x7bef('0x44')]['ids'][_0x7bef('0x57')];_0x3cdbf3+=0x1){socket[_0x7bef('0x97')](_0x7bef('0x98'),{'UserId':Number(_0x2a479d[_0x7bef('0x44')][_0x7bef('0x73')][_0x3cdbf3]),'ChatQueueId':Number(_0x2a479d['params']['id'])});}}else{socket['emit'](_0x7bef('0x98'),{'UserId':Number(_0x2a479d[_0x7bef('0x44')]['ids']),'ChatQueueId':Number(_0x2a479d['params']['id'])});}});}})[_0x7bef('0x38')](respondWithStatusCode(_0x4bb847,null))[_0x7bef('0x5b')](handleError(_0x4bb847,null));};exports[_0x7bef('0x9d')]=function(_0x1e27cd,_0x4fa6b0,_0x69f072){var _0x2bc411={};var _0x1cc317={};var _0x3c66b2;var _0x29d641;return db['ChatQueue']['findOne']({'where':{'id':_0x1e27cd[_0x7bef('0x54')]['id']}})[_0x7bef('0x38')](handleEntityNotFound(_0x4fa6b0,null))[_0x7bef('0x38')](function(_0x16c028){if(_0x16c028){_0x3c66b2=_0x16c028;_0x1cc317[_0x7bef('0x47')]=_[_0x7bef('0x45')](db[_0x7bef('0x74')][_0x7bef('0x55')]);_0x1cc317[_0x7bef('0x44')]=_['keys'](_0x1e27cd['query']);_0x1cc317['filters']=_['intersection'](_0x1cc317['model'],_0x1cc317['query']);_0x2bc411['attributes']=_[_0x7bef('0x56')](_0x1cc317[_0x7bef('0x47')],qs[_0x7bef('0x49')](_0x1e27cd[_0x7bef('0x44')]['fields']));_0x2bc411['attributes']=_0x2bc411[_0x7bef('0x48')][_0x7bef('0x57')]?_0x2bc411[_0x7bef('0x48')]:_0x1cc317[_0x7bef('0x47')];_0x2bc411[_0x7bef('0x4c')]=qs[_0x7bef('0x4d')](_0x1e27cd['query'][_0x7bef('0x4d')]);_0x2bc411[_0x7bef('0x4e')]=qs[_0x7bef('0x46')](_['pick'](_0x1e27cd[_0x7bef('0x44')],_0x1cc317[_0x7bef('0x46')]));if(_0x1e27cd[_0x7bef('0x44')][_0x7bef('0x4f')]){_0x2bc411[_0x7bef('0x4e')]=_['merge'](_0x2bc411['where'],{'$or':_[_0x7bef('0x3e')](_0x2bc411[_0x7bef('0x48')],function(_0x41ddb1){var _0x56f8e8={};_0x56f8e8[_0x41ddb1]={'$like':'%'+_0x1e27cd[_0x7bef('0x44')][_0x7bef('0x4f')]+'%'};return _0x56f8e8;})});}_0x2bc411=_[_0x7bef('0x59')]({},_0x2bc411,_0x1e27cd[_0x7bef('0x50')]);return _0x3c66b2[_0x7bef('0x9d')](_0x2bc411);}})[_0x7bef('0x38')](function(_0x2fad01){if(_0x2fad01){_0x29d641=_0x2fad01[_0x7bef('0x57')];if(!_0x1e27cd[_0x7bef('0x44')][_0x7bef('0x4a')](_0x7bef('0x4b'))){_0x2bc411[_0x7bef('0x31')]=qs[_0x7bef('0x31')](_0x1e27cd[_0x7bef('0x44')][_0x7bef('0x31')]);_0x2bc411[_0x7bef('0x2e')]=qs['offset'](_0x1e27cd[_0x7bef('0x44')][_0x7bef('0x2e')]);}return _0x3c66b2['getAgents'](_0x2bc411);}})[_0x7bef('0x38')](function(_0x187f69){if(_0x187f69){return _0x187f69?{'count':_0x29d641,'rows':_0x187f69}:null;}})[_0x7bef('0x38')](respondWithResult(_0x4fa6b0,null))['catch'](handleError(_0x4fa6b0,null));}; \ No newline at end of file +var _0xcbb0=['where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','ChatQueues','UserProfileSection','autoAssociation','describe','getMembers','findOne','length','order','pick','ChatQueueId','UserId','agent','chatPause','createdAt','%s/%s','SIP','Team','getTeams','addTeams','User','Agents','online','voicePause','sequelize','transaction','each','UserChatQueue','findOrCreate','forEach','emit','userChatQueue:save','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','UserProfileResource','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort'];(function(_0xb4e0c3,_0x3782ca){var _0x3c7a14=function(_0xedf1f5){while(--_0xedf1f5){_0xb4e0c3['push'](_0xb4e0c3['shift']());}};_0x3c7a14(++_0x3782ca);}(_0xcbb0,0xdf));var _0x0cbb=function(_0x1fb5fb,_0x15ed17){_0x1fb5fb=_0x1fb5fb-0x0;var _0x2c36ef=_0xcbb0[_0x1fb5fb];return _0x2c36ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0cbb('0x0'));var jsonpatch=require(_0x0cbb('0x1'));var rp=require('request-promise');var moment=require(_0x0cbb('0x2'));var BPromise=require(_0x0cbb('0x3'));var Mustache=require(_0x0cbb('0x4'));var util=require('util');var path=require(_0x0cbb('0x5'));var sox=require(_0x0cbb('0x6'));var csv=require(_0x0cbb('0x7'));var ejs=require(_0x0cbb('0x8'));var fs=require('fs');var fs_extra=require(_0x0cbb('0x9'));var _=require(_0x0cbb('0xa'));var squel=require(_0x0cbb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0cbb('0xc'));var toCsv=require(_0x0cbb('0x7'));var querystring=require('querystring');var Papa=require(_0x0cbb('0xd'));var Redis=require(_0x0cbb('0xe'));var authService=require(_0x0cbb('0xf'));var qs=require(_0x0cbb('0x10'));var as=require(_0x0cbb('0x11'));var hardwareService=require(_0x0cbb('0x12'));var logger=require('../../config/logger')(_0x0cbb('0x13'));var utils=require(_0x0cbb('0x14'));var config=require(_0x0cbb('0x15'));var licenseUtil=require(_0x0cbb('0x16'));var db=require(_0x0cbb('0x17'))['db'];config['redis']=_[_0x0cbb('0x18')](config[_0x0cbb('0x19')],{'host':_0x0cbb('0x1a'),'port':0x18eb});var socket=require(_0x0cbb('0x1b'))(new Redis(config[_0x0cbb('0x19')]));require(_0x0cbb('0x1c'))[_0x0cbb('0x1d')](socket);var jayson=require(_0x0cbb('0x1e'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b43c1,_0x2ecb9e,_0x5ed7e6,_0x3f2da4){return new BPromise(function(_0x3855d9,_0x14176a){var _0x57ebe6=_0x3f2da4||client;return _0x57ebe6[_0x0cbb('0x1f')](_0x4b43c1,_0x5ed7e6)[_0x0cbb('0x20')](function(_0x5ede69){logger[_0x0cbb('0x21')]('ChatQueue,\x20%s,\x20%s',_0x2ecb9e,_0x0cbb('0x22'));logger[_0x0cbb('0x23')](_0x0cbb('0x24'),_0x2ecb9e,_0x0cbb('0x22'),JSON[_0x0cbb('0x25')](_0x5ede69));if(_0x5ede69[_0x0cbb('0x26')]){if(_0x5ede69['error'][_0x0cbb('0x27')]===0x1f4){logger[_0x0cbb('0x26')](_0x0cbb('0x28'),_0x2ecb9e,_0x5ede69[_0x0cbb('0x26')][_0x0cbb('0x29')]);return _0x14176a(_0x5ede69['error'][_0x0cbb('0x29')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x2ecb9e,_0x5ede69[_0x0cbb('0x26')][_0x0cbb('0x29')]);return _0x3855d9(_0x5ede69[_0x0cbb('0x26')][_0x0cbb('0x29')]);}else{logger['info'](_0x0cbb('0x28'),_0x2ecb9e,_0x0cbb('0x22'));_0x3855d9(_0x5ede69[_0x0cbb('0x2a')][_0x0cbb('0x29')]);}})[_0x0cbb('0x2b')](function(_0x38baaa){logger[_0x0cbb('0x26')](_0x0cbb('0x28'),_0x2ecb9e,_0x38baaa);_0x14176a(_0x38baaa);});});}function respondWithStatusCode(_0x191562,_0x57cc6d){_0x57cc6d=_0x57cc6d||0xcc;return function(_0x20b163){if(_0x20b163){return _0x191562[_0x0cbb('0x2c')](_0x57cc6d);}return _0x191562['status'](_0x57cc6d)[_0x0cbb('0x2d')]();};}function respondWithResult(_0x5cda57,_0x3539f4){_0x3539f4=_0x3539f4||0xc8;return function(_0x56f9df){if(_0x56f9df){return _0x5cda57[_0x0cbb('0x2e')](_0x3539f4)[_0x0cbb('0x2f')](_0x56f9df);}};}function respondWithFilteredResult(_0xefdaa5,_0x330827){return function(_0xcbf747){if(_0xcbf747){var _0xd32b35=typeof _0x330827[_0x0cbb('0x30')]==='undefined'&&typeof _0x330827[_0x0cbb('0x31')]==='undefined';var _0x3cc60b=_0xcbf747[_0x0cbb('0x32')];var _0xf6603b=_0xd32b35?0x0:_0x330827[_0x0cbb('0x30')];var _0x34ad41=_0xd32b35?_0xcbf747['count']:_0x330827[_0x0cbb('0x30')]+_0x330827['limit'];var _0x4b28d9;if(_0x34ad41>=_0x3cc60b){_0x34ad41=_0x3cc60b;_0x4b28d9=0xc8;}else{_0x4b28d9=0xce;}_0xefdaa5[_0x0cbb('0x2e')](_0x4b28d9);return _0xefdaa5[_0x0cbb('0x33')](_0x0cbb('0x34'),_0xf6603b+'-'+_0x34ad41+'/'+_0x3cc60b)[_0x0cbb('0x2f')](_0xcbf747);}return null;};}function patchUpdates(_0x285a89){return function(_0xdc11d2){try{jsonpatch[_0x0cbb('0x35')](_0xdc11d2,_0x285a89,!![]);}catch(_0x56491f){return BPromise['reject'](_0x56491f);}return _0xdc11d2[_0x0cbb('0x36')]();};}function saveUpdates(_0x5cbd3f,_0x38dbd6){return function(_0x306a17){if(_0x306a17){return _0x306a17[_0x0cbb('0x37')](_0x5cbd3f)[_0x0cbb('0x20')](function(_0x306338){return _0x306338;});}return null;};}function removeEntity(_0x430d09,_0x62be05){return function(_0x2bacbe){if(_0x2bacbe){return _0x2bacbe[_0x0cbb('0x38')]()[_0x0cbb('0x20')](function(){var _0xf9d8b8=_0x2bacbe['get']({'plain':!![]});var _0x2788bb='ChatQueues';return db[_0x0cbb('0x39')][_0x0cbb('0x38')]({'where':{'type':_0x2788bb,'resourceId':_0xf9d8b8['id']}})[_0x0cbb('0x20')](function(){return _0x2bacbe;});})[_0x0cbb('0x20')](function(){_0x430d09[_0x0cbb('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13c786,_0x1187cd){return function(_0x44b2ba){if(!_0x44b2ba){_0x13c786[_0x0cbb('0x2c')](0x194);}return _0x44b2ba;};}function handleError(_0x102530,_0x55aefc){_0x55aefc=_0x55aefc||0x1f4;return function(_0x436e78){logger[_0x0cbb('0x26')](_0x436e78[_0x0cbb('0x3a')]);if(_0x436e78[_0x0cbb('0x3b')]){delete _0x436e78[_0x0cbb('0x3b')];}_0x102530[_0x0cbb('0x2e')](_0x55aefc)['send'](_0x436e78);};}exports[_0x0cbb('0x3c')]=function(_0x56c719,_0x186914){var _0x46e16b={},_0x1da443={},_0x152226={'count':0x0,'rows':[]};var _0x228947=_[_0x0cbb('0x3d')](db[_0x0cbb('0x3e')][_0x0cbb('0x3f')],function(_0x48c684){return{'name':_0x48c684[_0x0cbb('0x40')],'type':_0x48c684[_0x0cbb('0x41')][_0x0cbb('0x42')]};});_0x1da443[_0x0cbb('0x43')]=_[_0x0cbb('0x3d')](_0x228947,'name');_0x1da443['query']=_[_0x0cbb('0x44')](_0x56c719[_0x0cbb('0x45')]);_0x1da443[_0x0cbb('0x46')]=_[_0x0cbb('0x47')](_0x1da443[_0x0cbb('0x43')],_0x1da443[_0x0cbb('0x45')]);_0x46e16b['attributes']=_[_0x0cbb('0x47')](_0x1da443['model'],qs[_0x0cbb('0x48')](_0x56c719[_0x0cbb('0x45')]['fields']));_0x46e16b[_0x0cbb('0x49')]=_0x46e16b[_0x0cbb('0x49')]['length']?_0x46e16b[_0x0cbb('0x49')]:_0x1da443['model'];if(!_0x56c719[_0x0cbb('0x45')][_0x0cbb('0x4a')](_0x0cbb('0x4b'))){_0x46e16b['limit']=qs[_0x0cbb('0x31')](_0x56c719[_0x0cbb('0x45')]['limit']);_0x46e16b[_0x0cbb('0x30')]=qs[_0x0cbb('0x30')](_0x56c719[_0x0cbb('0x45')]['offset']);}_0x46e16b['order']=qs[_0x0cbb('0x4c')](_0x56c719[_0x0cbb('0x45')][_0x0cbb('0x4c')]);_0x46e16b[_0x0cbb('0x4d')]=qs[_0x0cbb('0x46')](_['pick'](_0x56c719['query'],_0x1da443['filters']),_0x228947);if(_0x56c719[_0x0cbb('0x45')][_0x0cbb('0x4e')]){_0x46e16b[_0x0cbb('0x4d')]=_[_0x0cbb('0x4f')](_0x46e16b['where'],{'$or':_[_0x0cbb('0x3d')](_0x228947,function(_0x2f6084){if(_0x2f6084['type']!=='VIRTUAL'){var _0x335ff2={};_0x335ff2[_0x2f6084[_0x0cbb('0x3b')]]={'$like':'%'+_0x56c719['query'][_0x0cbb('0x4e')]+'%'};return _0x335ff2;}})});}_0x46e16b=_['merge']({},_0x46e16b,_0x56c719[_0x0cbb('0x50')]);var _0x258887={'where':_0x46e16b['where']};return db[_0x0cbb('0x3e')][_0x0cbb('0x32')](_0x258887)[_0x0cbb('0x20')](function(_0x53fede){_0x152226['count']=_0x53fede;if(_0x56c719[_0x0cbb('0x45')][_0x0cbb('0x51')]){_0x46e16b[_0x0cbb('0x52')]=[{'all':!![]}];}return db['ChatQueue'][_0x0cbb('0x53')](_0x46e16b);})[_0x0cbb('0x20')](function(_0x5e63f9){_0x152226[_0x0cbb('0x54')]=_0x5e63f9;return _0x152226;})[_0x0cbb('0x20')](respondWithFilteredResult(_0x186914,_0x46e16b))[_0x0cbb('0x2b')](handleError(_0x186914,null));};exports[_0x0cbb('0x55')]=function(_0x74d2eb,_0x4e9cd6){var _0x48f28a={'raw':!![],'where':{'id':_0x74d2eb[_0x0cbb('0x56')]['id']}},_0x46f5bb={};_0x46f5bb[_0x0cbb('0x43')]=_[_0x0cbb('0x44')](db[_0x0cbb('0x3e')][_0x0cbb('0x3f')]);_0x46f5bb['query']=_[_0x0cbb('0x44')](_0x74d2eb[_0x0cbb('0x45')]);_0x46f5bb[_0x0cbb('0x46')]=_[_0x0cbb('0x47')](_0x46f5bb[_0x0cbb('0x43')],_0x46f5bb[_0x0cbb('0x45')]);_0x48f28a['attributes']=_['intersection'](_0x46f5bb['model'],qs[_0x0cbb('0x48')](_0x74d2eb[_0x0cbb('0x45')][_0x0cbb('0x48')]));_0x48f28a[_0x0cbb('0x49')]=_0x48f28a[_0x0cbb('0x49')]['length']?_0x48f28a[_0x0cbb('0x49')]:_0x46f5bb[_0x0cbb('0x43')];if(_0x74d2eb[_0x0cbb('0x45')][_0x0cbb('0x51')]){_0x48f28a['include']=[{'all':!![]}];}_0x48f28a=_[_0x0cbb('0x4f')]({},_0x48f28a,_0x74d2eb[_0x0cbb('0x50')]);return db['ChatQueue'][_0x0cbb('0x57')](_0x48f28a)['then'](handleEntityNotFound(_0x4e9cd6,null))[_0x0cbb('0x20')](respondWithResult(_0x4e9cd6,null))[_0x0cbb('0x2b')](handleError(_0x4e9cd6,null));};exports[_0x0cbb('0x58')]=function(_0x54a701,_0x5a4a42){return db[_0x0cbb('0x3e')][_0x0cbb('0x58')](_0x54a701[_0x0cbb('0x59')],{})['then'](function(_0x675d63){var _0xf17185=_0x54a701['user']['get']({'plain':!![]});if(!_0xf17185)throw new Error(_0x0cbb('0x5a'));if(_0xf17185[_0x0cbb('0x5b')]===_0x0cbb('0x5c')){var _0x473280=_0x675d63[_0x0cbb('0x5d')]({'plain':!![]});var _0x2dc3ac=_0x0cbb('0x5e');return db[_0x0cbb('0x5f')][_0x0cbb('0x57')]({'where':{'name':_0x2dc3ac,'userProfileId':_0xf17185['userProfileId']},'raw':!![]})[_0x0cbb('0x20')](function(_0x4908e9){if(_0x4908e9&&_0x4908e9[_0x0cbb('0x60')]===0x0){return db[_0x0cbb('0x39')][_0x0cbb('0x58')]({'name':_0x473280['name'],'resourceId':_0x473280['id'],'type':_0x4908e9[_0x0cbb('0x3b')],'sectionId':_0x4908e9['id']},{})[_0x0cbb('0x20')](function(){return _0x675d63;});}else{return _0x675d63;}})[_0x0cbb('0x2b')](function(_0x10a8ed){logger[_0x0cbb('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10a8ed);throw _0x10a8ed;});}return _0x675d63;})['then'](respondWithResult(_0x5a4a42,0xc9))[_0x0cbb('0x2b')](handleError(_0x5a4a42,null));};exports[_0x0cbb('0x37')]=function(_0x4c594c,_0x2364b8){if(_0x4c594c[_0x0cbb('0x59')]['id']){delete _0x4c594c[_0x0cbb('0x59')]['id'];}return db[_0x0cbb('0x3e')][_0x0cbb('0x57')]({'where':{'id':_0x4c594c[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x2364b8,null))[_0x0cbb('0x20')](saveUpdates(_0x4c594c['body'],null))[_0x0cbb('0x20')](respondWithResult(_0x2364b8,null))['catch'](handleError(_0x2364b8,null));};exports['destroy']=function(_0x1d0392,_0x329eb2){return db[_0x0cbb('0x3e')]['find']({'where':{'id':_0x1d0392[_0x0cbb('0x56')]['id']}})['then'](handleEntityNotFound(_0x329eb2,null))[_0x0cbb('0x20')](removeEntity(_0x329eb2,null))['catch'](handleError(_0x329eb2,null));};exports[_0x0cbb('0x61')]=function(_0xd0df88,_0x1ae52f){return db[_0x0cbb('0x3e')][_0x0cbb('0x61')]()['then'](respondWithResult(_0x1ae52f,null))[_0x0cbb('0x2b')](handleError(_0x1ae52f,null));};exports[_0x0cbb('0x62')]=function(_0x574231,_0x59c664,_0x42829f){var _0x1f0eb0={'raw':!![],'where':{}},_0x1d29c8={},_0x39cda7;return db[_0x0cbb('0x3e')][_0x0cbb('0x63')]({'where':{'id':_0x574231[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x59c664,null))[_0x0cbb('0x20')](function(_0x3ac6a3){if(_0x3ac6a3){_0x39cda7=_0x3ac6a3[_0x0cbb('0x5d')]({'plain':!![]});_0x1d29c8[_0x0cbb('0x43')]=_['keys'](db['UserChatQueue'][_0x0cbb('0x3f')]);_0x1d29c8['query']=_[_0x0cbb('0x44')](_0x574231[_0x0cbb('0x45')]);_0x1d29c8[_0x0cbb('0x46')]=_[_0x0cbb('0x47')](_0x1d29c8[_0x0cbb('0x43')],_0x1d29c8[_0x0cbb('0x45')]);_0x1f0eb0[_0x0cbb('0x49')]=_[_0x0cbb('0x47')](_0x1d29c8['model'],qs[_0x0cbb('0x48')](_0x574231[_0x0cbb('0x45')][_0x0cbb('0x48')]));_0x1f0eb0[_0x0cbb('0x49')]=_0x1f0eb0[_0x0cbb('0x49')][_0x0cbb('0x64')]?_0x1f0eb0[_0x0cbb('0x49')]:_0x1d29c8[_0x0cbb('0x43')];if(!_0x574231[_0x0cbb('0x45')]['hasOwnProperty']('nolimit')){_0x1f0eb0[_0x0cbb('0x31')]=qs[_0x0cbb('0x31')](_0x574231[_0x0cbb('0x45')][_0x0cbb('0x31')]);_0x1f0eb0['offset']=qs[_0x0cbb('0x30')](_0x574231[_0x0cbb('0x45')][_0x0cbb('0x30')]);}_0x1f0eb0[_0x0cbb('0x65')]=qs[_0x0cbb('0x4c')](_0x574231[_0x0cbb('0x45')][_0x0cbb('0x4c')]);_0x1f0eb0['where']=qs[_0x0cbb('0x46')](_[_0x0cbb('0x66')](_0x574231[_0x0cbb('0x45')],_0x1d29c8[_0x0cbb('0x46')]));_0x1f0eb0[_0x0cbb('0x4d')][_0x0cbb('0x67')]=_0x3ac6a3['id'];if(_0x574231['query']['filter']){_0x1f0eb0['where']=_[_0x0cbb('0x4f')](_0x1f0eb0['where'],{'$or':_[_0x0cbb('0x3d')](_0x1f0eb0[_0x0cbb('0x49')],function(_0x4ddefc){var _0x4ba73b={};_0x4ba73b[_0x4ddefc]={'$like':'%'+_0x574231[_0x0cbb('0x45')][_0x0cbb('0x4e')]+'%'};return _0x4ba73b;})});}_0x1f0eb0=_[_0x0cbb('0x4f')]({},_0x1f0eb0,_0x574231[_0x0cbb('0x50')]);return db['UserChatQueue'][_0x0cbb('0x53')](_0x1f0eb0);}})[_0x0cbb('0x20')](function(_0x177497){if(_0x177497){return db['User']['findAndCountAll']({'where':{'id':_[_0x0cbb('0x3d')](_0x177497,_0x0cbb('0x68')),'role':_0x0cbb('0x69')},'attributes':['id',_0x0cbb('0x3b'),_0x0cbb('0x6a'),'updatedAt',_0x0cbb('0x6b')]});}})[_0x0cbb('0x20')](function(_0x38ac50){if(_0x38ac50){return{'count':_0x38ac50[_0x0cbb('0x32')],'rows':_['map'](_0x38ac50[_0x0cbb('0x54')],function(_0x2d09d2){return{'membername':_0x2d09d2['name'],'UserId':_0x2d09d2['id'],'queue_name':_0x39cda7[_0x0cbb('0x3b')],'ChatQueueId':_0x39cda7['id'],'interface':util['format'](_0x0cbb('0x6c'),_0x0cbb('0x6d'),_0x2d09d2[_0x0cbb('0x3b')]),'penalty':0x0,'paused':_0x2d09d2[_0x0cbb('0x6a')],'createdAt':_0x2d09d2[_0x0cbb('0x6b')],'updatedAt':_0x2d09d2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0cbb('0x20')](respondWithFilteredResult(_0x59c664,_0x1f0eb0))[_0x0cbb('0x2b')](handleError(_0x59c664,null));};exports['getTeams']=function(_0x1f3b47,_0x325f96,_0x4f0c47){var _0x4fb1c6={};var _0x1e1d41={};var _0x159e8c;var _0x4409cc;return db['ChatQueue'][_0x0cbb('0x63')]({'where':{'id':_0x1f3b47[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x325f96,null))[_0x0cbb('0x20')](function(_0x5b5f19){if(_0x5b5f19){_0x159e8c=_0x5b5f19;_0x1e1d41[_0x0cbb('0x43')]=_[_0x0cbb('0x44')](db[_0x0cbb('0x6e')][_0x0cbb('0x3f')]);_0x1e1d41[_0x0cbb('0x45')]=_[_0x0cbb('0x44')](_0x1f3b47[_0x0cbb('0x45')]);_0x1e1d41[_0x0cbb('0x46')]=_[_0x0cbb('0x47')](_0x1e1d41[_0x0cbb('0x43')],_0x1e1d41[_0x0cbb('0x45')]);_0x4fb1c6['attributes']=_[_0x0cbb('0x47')](_0x1e1d41[_0x0cbb('0x43')],qs[_0x0cbb('0x48')](_0x1f3b47[_0x0cbb('0x45')][_0x0cbb('0x48')]));_0x4fb1c6['attributes']=_0x4fb1c6['attributes'][_0x0cbb('0x64')]?_0x4fb1c6['attributes']:_0x1e1d41[_0x0cbb('0x43')];_0x4fb1c6[_0x0cbb('0x65')]=qs[_0x0cbb('0x4c')](_0x1f3b47[_0x0cbb('0x45')][_0x0cbb('0x4c')]);_0x4fb1c6[_0x0cbb('0x4d')]=qs[_0x0cbb('0x46')](_[_0x0cbb('0x66')](_0x1f3b47[_0x0cbb('0x45')],_0x1e1d41[_0x0cbb('0x46')]));if(_0x1f3b47['query'][_0x0cbb('0x4e')]){_0x4fb1c6[_0x0cbb('0x4d')]=_[_0x0cbb('0x4f')](_0x4fb1c6['where'],{'$or':_[_0x0cbb('0x3d')](_0x4fb1c6['attributes'],function(_0x52a542){var _0xd33b3a={};_0xd33b3a[_0x52a542]={'$like':'%'+_0x1f3b47[_0x0cbb('0x45')]['filter']+'%'};return _0xd33b3a;})});}_0x4fb1c6=_[_0x0cbb('0x4f')]({},_0x4fb1c6,_0x1f3b47[_0x0cbb('0x50')]);return _0x159e8c[_0x0cbb('0x6f')](_0x4fb1c6);}})['then'](function(_0xc69a92){if(_0xc69a92){_0x4409cc=_0xc69a92[_0x0cbb('0x64')];if(!_0x1f3b47[_0x0cbb('0x45')][_0x0cbb('0x4a')](_0x0cbb('0x4b'))){_0x4fb1c6[_0x0cbb('0x31')]=qs['limit'](_0x1f3b47['query'][_0x0cbb('0x31')]);_0x4fb1c6[_0x0cbb('0x30')]=qs[_0x0cbb('0x30')](_0x1f3b47[_0x0cbb('0x45')]['offset']);}return _0x159e8c[_0x0cbb('0x6f')](_0x4fb1c6);}})[_0x0cbb('0x20')](function(_0x3b32f4){if(_0x3b32f4){return _0x3b32f4?{'count':_0x4409cc,'rows':_0x3b32f4}:null;}})[_0x0cbb('0x20')](respondWithResult(_0x325f96,null))[_0x0cbb('0x2b')](handleError(_0x325f96,null));};exports[_0x0cbb('0x70')]=function(_0x25f906,_0x49caee,_0x3f2947){var _0x237910=_0x25f906[_0x0cbb('0x59')]['ids'];return db[_0x0cbb('0x6e')][_0x0cbb('0x53')]({'where':{'id':_0x237910},'attributes':['id'],'include':[{'model':db[_0x0cbb('0x71')],'as':_0x0cbb('0x72'),'attributes':['id','name',_0x0cbb('0x73'),_0x0cbb('0x74'),'interface'],'raw':!![]}]})['then'](function(_0xd11977){if(_0xd11977){var _0x2bfe6b=_['flatMap'](_0xd11977,function(_0xea3961){var _0x14e673=_0xea3961[_0x0cbb('0x5d')]({'plain':!![]});return _0x14e673[_0x0cbb('0x72')];});return db[_0x0cbb('0x3e')]['find']({'where':{'id':_0x25f906['params']['id']}})['then'](function(_0x34b15f){return db[_0x0cbb('0x75')][_0x0cbb('0x76')](function(_0x15c178){return _0x34b15f[_0x0cbb('0x70')](_0x237910,{'transaction':_0x15c178})[_0x0cbb('0x20')](function(){return BPromise[_0x0cbb('0x77')](_0x2bfe6b,function(_0x754d5f){return db[_0x0cbb('0x78')][_0x0cbb('0x79')]({'where':{'UserId':_0x754d5f['id'],'ChatQueueId':_0x25f906[_0x0cbb('0x56')]['id']},'transaction':_0x15c178});});})[_0x0cbb('0x20')](function(){_0x2bfe6b[_0x0cbb('0x7a')](function(_0x3ee93a){socket[_0x0cbb('0x7b')](_0x0cbb('0x7c'),{'UserId':_0x3ee93a['id'],'ChatQueueId':_0x34b15f['id']});});});});});}})['then'](respondWithStatusCode(_0x49caee,null))[_0x0cbb('0x2b')](handleError(_0x49caee,null));};exports['removeTeams']=function(_0x1cf87a,_0x570485,_0x3fc93a){return db[_0x0cbb('0x6e')][_0x0cbb('0x53')]({'where':{'id':_0x1cf87a['query'][_0x0cbb('0x7d')]},'attributes':['id'],'include':[{'model':db[_0x0cbb('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0cbb('0x20')](handleEntityNotFound(_0x570485,null))[_0x0cbb('0x20')](function(_0x578dc5){var _0x16091b=_[_0x0cbb('0x3d')](_0x578dc5,'id');var _0x2f2d91=[];var _0x12e093=[];var _0x10244a=squel[_0x0cbb('0x7e')]();_0x10244a[_0x0cbb('0x7f')]('tq.TeamId')[_0x0cbb('0x80')]('team_has_chat_queues','tq')[_0x0cbb('0x81')](_0x0cbb('0x82'),'ut',_0x0cbb('0x83'))[_0x0cbb('0x4d')]('ChatQueueId\x20=\x20?',_0x1cf87a[_0x0cbb('0x56')]['id']);for(var _0x1de2a1=0x0;_0x1de2a1<_0x578dc5[_0x0cbb('0x64')];_0x1de2a1+=0x1){let _0x285835=_0x578dc5[_0x1de2a1];for(var _0x192883=0x0;_0x192883<_0x285835['Agents'][_0x0cbb('0x64')];_0x192883+=0x1){let _0x1031e1=_0x285835[_0x0cbb('0x72')][_0x192883];var _0x3fc151=_0x10244a[_0x0cbb('0x84')]();_0x3fc151[_0x0cbb('0x4d')]('ut.UserId\x20=\x20?',_0x1031e1['id']);_0x12e093[_0x0cbb('0x85')](db['sequelize'][_0x0cbb('0x45')](_0x3fc151[_0x0cbb('0x86')](),{'type':db[_0x0cbb('0x75')][_0x0cbb('0x87')]['SELECT']})[_0x0cbb('0x20')](function(_0x5bf402){if(_0x5bf402['length']===0x1){return _0x1031e1['id'];}else{var _0x4363b4=_[_0x0cbb('0x88')](_[_0x0cbb('0x3d')](_0x5bf402,_0x0cbb('0x89')),function(_0xb07cb0){return _['includes'](_0x16091b,_0xb07cb0);});if(_0x4363b4){return _0x1031e1['id'];}}}));}}return BPromise[_0x0cbb('0x8a')](_0x12e093)[_0x0cbb('0x20')](function(_0x430cdc){_0x2f2d91=_(_0x2f2d91)[_0x0cbb('0x8b')](_0x430cdc)[_0x0cbb('0x8c')]()[_0x0cbb('0x8d')]();return db[_0x0cbb('0x3e')][_0x0cbb('0x57')]({'where':{'id':_0x1cf87a[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](function(_0x454c98){return db['sequelize']['transaction'](function(_0x5c7933){return _0x454c98[_0x0cbb('0x8e')](_0x1cf87a[_0x0cbb('0x45')]['ids'],{'transaction':_0x5c7933})[_0x0cbb('0x20')](function(){if(!_[_0x0cbb('0x8f')](_0x2f2d91)){return _0x454c98[_0x0cbb('0x90')](_0x2f2d91,{'transaction':_0x5c7933});}})['then'](function(){_0x2f2d91['forEach'](function(_0x4015c8){socket[_0x0cbb('0x7b')](_0x0cbb('0x91'),{'UserId':_0x4015c8,'ChatQueueId':_0x454c98['id']});});});});});});})[_0x0cbb('0x20')](respondWithStatusCode(_0x570485,null))[_0x0cbb('0x2b')](handleError(_0x570485,null));};exports['addAgents']=function(_0x90c12c,_0x5363a7,_0x133d26){return db['ChatQueue'][_0x0cbb('0x57')]({'where':{'id':_0x90c12c['params']['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x5363a7,null))[_0x0cbb('0x20')](function(_0x44f004){if(_0x44f004){return _0x44f004[_0x0cbb('0x92')](_0x90c12c[_0x0cbb('0x59')]['ids'],_[_0x0cbb('0x93')](_0x90c12c[_0x0cbb('0x59')],[_0x0cbb('0x7d'),'id'])||{})[_0x0cbb('0x94')](function(_0x385e46){for(var _0x193d48=0x0;_0x193d48<_0x90c12c['body'][_0x0cbb('0x7d')][_0x0cbb('0x64')];_0x193d48+=0x1){socket[_0x0cbb('0x7b')]('userChatQueue:save',{'UserId':Number(_0x90c12c['body'][_0x0cbb('0x7d')][_0x193d48]),'ChatQueueId':Number(_0x90c12c[_0x0cbb('0x56')]['id'])});}return _0x385e46;});}})[_0x0cbb('0x20')](respondWithResult(_0x5363a7,null))[_0x0cbb('0x2b')](handleError(_0x5363a7,null));};exports[_0x0cbb('0x90')]=function(_0xc116ea,_0x509fd4,_0x2145f7){return db['ChatQueue'][_0x0cbb('0x57')]({'where':{'id':_0xc116ea['params']['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x509fd4,null))[_0x0cbb('0x20')](function(_0x1e86cb){if(_0x1e86cb){return _0x1e86cb[_0x0cbb('0x90')](_0xc116ea[_0x0cbb('0x45')]['ids'])[_0x0cbb('0x20')](function(){if(_['isArray'](_0xc116ea[_0x0cbb('0x45')][_0x0cbb('0x7d')])){for(var _0x50d917=0x0;_0x50d917<_0xc116ea[_0x0cbb('0x45')][_0x0cbb('0x7d')][_0x0cbb('0x64')];_0x50d917+=0x1){socket[_0x0cbb('0x7b')]('userChatQueue:remove',{'UserId':Number(_0xc116ea['query'][_0x0cbb('0x7d')][_0x50d917]),'ChatQueueId':Number(_0xc116ea['params']['id'])});}}else{socket['emit'](_0x0cbb('0x91'),{'UserId':Number(_0xc116ea[_0x0cbb('0x45')][_0x0cbb('0x7d')]),'ChatQueueId':Number(_0xc116ea[_0x0cbb('0x56')]['id'])});}});}})[_0x0cbb('0x20')](respondWithStatusCode(_0x509fd4,null))[_0x0cbb('0x2b')](handleError(_0x509fd4,null));};exports[_0x0cbb('0x95')]=function(_0x287346,_0x53609c,_0x45660b){var _0x4b8f02={};var _0x1b4c02={};var _0x4649eb;var _0x259a95;return db['ChatQueue'][_0x0cbb('0x63')]({'where':{'id':_0x287346[_0x0cbb('0x56')]['id']}})[_0x0cbb('0x20')](handleEntityNotFound(_0x53609c,null))[_0x0cbb('0x20')](function(_0x2a1633){if(_0x2a1633){_0x4649eb=_0x2a1633;_0x1b4c02['model']=_[_0x0cbb('0x44')](db[_0x0cbb('0x71')][_0x0cbb('0x3f')]);_0x1b4c02[_0x0cbb('0x45')]=_['keys'](_0x287346['query']);_0x1b4c02['filters']=_[_0x0cbb('0x47')](_0x1b4c02[_0x0cbb('0x43')],_0x1b4c02['query']);_0x4b8f02[_0x0cbb('0x49')]=_[_0x0cbb('0x47')](_0x1b4c02[_0x0cbb('0x43')],qs[_0x0cbb('0x48')](_0x287346['query'][_0x0cbb('0x48')]));_0x4b8f02[_0x0cbb('0x49')]=_0x4b8f02['attributes'][_0x0cbb('0x64')]?_0x4b8f02[_0x0cbb('0x49')]:_0x1b4c02[_0x0cbb('0x43')];_0x4b8f02[_0x0cbb('0x65')]=qs[_0x0cbb('0x4c')](_0x287346[_0x0cbb('0x45')][_0x0cbb('0x4c')]);_0x4b8f02[_0x0cbb('0x4d')]=qs[_0x0cbb('0x46')](_[_0x0cbb('0x66')](_0x287346['query'],_0x1b4c02[_0x0cbb('0x46')]));if(_0x287346[_0x0cbb('0x45')][_0x0cbb('0x4e')]){_0x4b8f02[_0x0cbb('0x4d')]=_['merge'](_0x4b8f02[_0x0cbb('0x4d')],{'$or':_[_0x0cbb('0x3d')](_0x4b8f02['attributes'],function(_0x456b91){var _0x5e8441={};_0x5e8441[_0x456b91]={'$like':'%'+_0x287346[_0x0cbb('0x45')][_0x0cbb('0x4e')]+'%'};return _0x5e8441;})});}_0x4b8f02=_[_0x0cbb('0x4f')]({},_0x4b8f02,_0x287346[_0x0cbb('0x50')]);return _0x4649eb[_0x0cbb('0x95')](_0x4b8f02);}})[_0x0cbb('0x20')](function(_0x2b719a){if(_0x2b719a){_0x259a95=_0x2b719a[_0x0cbb('0x64')];if(!_0x287346[_0x0cbb('0x45')][_0x0cbb('0x4a')](_0x0cbb('0x4b'))){_0x4b8f02['limit']=qs['limit'](_0x287346[_0x0cbb('0x45')][_0x0cbb('0x31')]);_0x4b8f02[_0x0cbb('0x30')]=qs[_0x0cbb('0x30')](_0x287346[_0x0cbb('0x45')][_0x0cbb('0x30')]);}return _0x4649eb[_0x0cbb('0x95')](_0x4b8f02);}})[_0x0cbb('0x20')](function(_0x28ae0e){if(_0x28ae0e){return _0x28ae0e?{'count':_0x259a95,'rows':_0x28ae0e}:null;}})[_0x0cbb('0x20')](respondWithResult(_0x53609c,null))[_0x0cbb('0x2b')](handleError(_0x53609c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 3ffca90..3ab74ba 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 _0x4e60=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x4e60,0x150));var _0x04e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4e60[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x04e6('0x0'));var ChatQueue=require(_0x04e6('0x1'))['db'][_0x04e6('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x04e6('0x3')](0x0);var events={'afterCreate':_0x04e6('0x4'),'afterUpdate':_0x04e6('0x5'),'afterDestroy':_0x04e6('0x6')};function emitEvent(_0x4ad0f4){return function(_0x20f1d6,_0x5a5b1e,_0x3680b1){ChatQueueEvents['emit'](_0x4ad0f4+':'+_0x20f1d6['id'],_0x20f1d6);ChatQueueEvents['emit'](_0x4ad0f4,_0x20f1d6);_0x3680b1(null);};}for(var e in events){if(events[_0x04e6('0x7')](e)){var event=events[e];ChatQueue[_0x04e6('0x8')](e,emitEvent(event));}}module[_0x04e6('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0xaf76=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5eac87,_0x152105){var _0x3de3e1=function(_0x488e5d){while(--_0x488e5d){_0x5eac87['push'](_0x5eac87['shift']());}};_0x3de3e1(++_0x152105);}(_0xaf76,0x1b6));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6af7('0x0'));var ChatQueue=require(_0x6af7('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6af7('0x2')](0x0);var events={'afterCreate':_0x6af7('0x3'),'afterUpdate':_0x6af7('0x4'),'afterDestroy':_0x6af7('0x5')};function emitEvent(_0x57d1e3){return function(_0x560e59,_0x4a9726,_0x53c745){ChatQueueEvents[_0x6af7('0x6')](_0x57d1e3+':'+_0x560e59['id'],_0x560e59);ChatQueueEvents['emit'](_0x57d1e3,_0x560e59);_0x53c745(null);};}for(var e in events){if(events[_0x6af7('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x6af7('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 59d8690..f0e2d81 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 _0xa494=['path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa494,0xd9));var _0x4a49=function(_0x2aaf7c,_0x107cd3){_0x2aaf7c=_0x2aaf7c-0x0;var _0x45c6a0=_0xa494[_0x2aaf7c];return _0x45c6a0;};'use strict';var _=require(_0x4a49('0x0'));var util=require(_0x4a49('0x1'));var logger=require(_0x4a49('0x2'))(_0x4a49('0x3'));var moment=require(_0x4a49('0x4'));var BPromise=require(_0x4a49('0x5'));var rp=require(_0x4a49('0x6'));var fs=require('fs');var path=require(_0x4a49('0x7'));var rimraf=require('rimraf');var config=require(_0x4a49('0x8'));var attributes=require(_0x4a49('0x9'));module[_0x4a49('0xa')]=function(_0x6b47b0,_0x352597){return _0x6b47b0[_0x4a49('0xb')](_0x4a49('0xc'),attributes,{'tableName':_0x4a49('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dde=['./chatQueue.attributes','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4ba785,_0xad6b18){var _0x158750=function(_0x5dff8b){while(--_0x5dff8b){_0x4ba785['push'](_0x4ba785['shift']());}};_0x158750(++_0xad6b18);}(_0x4dde,0x6f));var _0xe4dd=function(_0x135800,_0x2f6fdc){_0x135800=_0x135800-0x0;var _0x3ae888=_0x4dde[_0x135800];return _0x3ae888;};'use strict';var _=require(_0xe4dd('0x0'));var util=require(_0xe4dd('0x1'));var logger=require(_0xe4dd('0x2'))(_0xe4dd('0x3'));var moment=require(_0xe4dd('0x4'));var BPromise=require(_0xe4dd('0x5'));var rp=require(_0xe4dd('0x6'));var fs=require('fs');var path=require(_0xe4dd('0x7'));var rimraf=require('rimraf');var config=require(_0xe4dd('0x8'));var attributes=require(_0xe4dd('0x9'));module['exports']=function(_0x2eb251,_0x2b571b){return _0x2eb251['define'](_0xe4dd('0xa'),attributes,{'tableName':_0xe4dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index fa3006d..7ad845a 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 _0xa109=['client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','model','stringify','ShowChatQueue','find','map','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ee5e7,_0x2bc939){var _0x251aa3=function(_0x4890bf){while(--_0x4890bf){_0x4ee5e7['push'](_0x4ee5e7['shift']());}};_0x251aa3(++_0x2bc939);}(_0xa109,0xf2));var _0x9a10=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa109[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x9a10('0x0'));var util=require('util');var moment=require(_0x9a10('0x1'));var BPromise=require(_0x9a10('0x2'));var rs=require(_0x9a10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a10('0x4'))['db'];var utils=require(_0x9a10('0x5'));var logger=require(_0x9a10('0x6'))(_0x9a10('0x7'));var config=require(_0x9a10('0x8'));var jayson=require(_0x9a10('0x9'));var client=jayson[_0x9a10('0xa')][_0x9a10('0xb')]({'port':0x232a});config[_0x9a10('0xc')]=_[_0x9a10('0xd')](config['redis'],{'host':_0x9a10('0xe'),'port':0x18eb});var socket=require(_0x9a10('0xf'))(new Redis(config[_0x9a10('0xc')]));require(_0x9a10('0x10'))[_0x9a10('0x11')](socket);function respondWithRpcPromise(_0x1ecce0,_0xb286bb,_0x41d90a){return new BPromise(function(_0x338ac6,_0x4b3898){return client[_0x9a10('0x12')](_0x1ecce0,_0x41d90a)[_0x9a10('0x13')](function(_0x1cdcb1){logger[_0x9a10('0x14')](_0x9a10('0x15'),_0xb286bb,'request\x20sent');logger[_0x9a10('0x16')](_0x9a10('0x17'),_0xb286bb,'request\x20sent',JSON['stringify'](_0x1cdcb1));if(_0x1cdcb1['error']){if(_0x1cdcb1[_0x9a10('0x18')][_0x9a10('0x19')]===0x1f4){logger[_0x9a10('0x18')](_0x9a10('0x15'),_0xb286bb,_0x1cdcb1['error'][_0x9a10('0x1a')]);return _0x4b3898(_0x1cdcb1[_0x9a10('0x18')][_0x9a10('0x1a')]);}logger[_0x9a10('0x18')](_0x9a10('0x15'),_0xb286bb,_0x1cdcb1[_0x9a10('0x18')][_0x9a10('0x1a')]);return _0x338ac6(_0x1cdcb1['error'][_0x9a10('0x1a')]);}else{logger[_0x9a10('0x14')]('ChatQueue,\x20%s,\x20%s',_0xb286bb,_0x9a10('0x1b'));_0x338ac6(_0x1cdcb1['result'][_0x9a10('0x1a')]);}})[_0x9a10('0x1c')](function(_0x5cd7e3){logger[_0x9a10('0x18')](_0x9a10('0x15'),_0xb286bb,_0x5cd7e3);_0x4b3898(_0x5cd7e3);});});}exports[_0x9a10('0x1d')]=function(_0x142cfa){var _0xca5f46=this;return new Promise(function(_0x207c86,_0x2aaab1){return db[_0x9a10('0x1e')][_0x9a10('0x1f')]({'raw':_0x142cfa[_0x9a10('0x20')]?_0x142cfa['options'][_0x9a10('0x21')]===undefined?!![]:![]:!![],'where':_0x142cfa[_0x9a10('0x20')]?_0x142cfa[_0x9a10('0x20')][_0x9a10('0x22')]||null:null,'attributes':_0x142cfa[_0x9a10('0x20')]?_0x142cfa[_0x9a10('0x20')][_0x9a10('0x23')]||null:null,'limit':_0x142cfa[_0x9a10('0x20')]?_0x142cfa['options']['limit']||null:null,'include':_0x142cfa[_0x9a10('0x20')]?_0x142cfa[_0x9a10('0x20')][_0x9a10('0x24')]?_['map'](_0x142cfa[_0x9a10('0x20')][_0x9a10('0x24')],function(_0x43364e){return{'model':db[_0x43364e[_0x9a10('0x25')]],'as':_0x43364e['as'],'attributes':_0x43364e[_0x9a10('0x23')],'include':_0x43364e[_0x9a10('0x24')]?_['map'](_0x43364e[_0x9a10('0x24')],function(_0x39b73c){return{'model':db[_0x39b73c[_0x9a10('0x25')]],'as':_0x39b73c['as'],'attributes':_0x39b73c[_0x9a10('0x23')],'include':_0x39b73c[_0x9a10('0x24')]?_['map'](_0x39b73c['include'],function(_0x39789d){return{'model':db[_0x39789d[_0x9a10('0x25')]],'as':_0x39789d['as'],'attributes':_0x39789d[_0x9a10('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9a10('0x13')](function(_0x169d12){logger[_0x9a10('0x14')](_0x9a10('0x1d'),_0x142cfa);logger[_0x9a10('0x16')](_0x9a10('0x1d'),_0x142cfa,JSON[_0x9a10('0x26')](_0x169d12));_0x207c86(_0x169d12);})[_0x9a10('0x1c')](function(_0x1753a4){logger[_0x9a10('0x18')](_0x9a10('0x1d'),_0x1753a4[_0x9a10('0x1a')],_0x142cfa);_0x2aaab1(_0xca5f46[_0x9a10('0x18')](0x1f4,_0x1753a4[_0x9a10('0x1a')]));});});};exports[_0x9a10('0x27')]=function(_0x2ee70a){var _0x26b0fe=this;return new Promise(function(_0x32d9fe,_0x90f7ec){return db[_0x9a10('0x1e')][_0x9a10('0x28')]({'raw':_0x2ee70a[_0x9a10('0x20')]?_0x2ee70a[_0x9a10('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2ee70a['options']?_0x2ee70a[_0x9a10('0x20')][_0x9a10('0x22')]||null:null,'attributes':_0x2ee70a[_0x9a10('0x20')]?_0x2ee70a[_0x9a10('0x20')][_0x9a10('0x23')]||null:null,'include':_0x2ee70a['options']?_0x2ee70a[_0x9a10('0x20')][_0x9a10('0x24')]?_[_0x9a10('0x29')](_0x2ee70a[_0x9a10('0x20')][_0x9a10('0x24')],function(_0x24ae5a){return{'model':db[_0x24ae5a[_0x9a10('0x25')]],'as':_0x24ae5a['as'],'attributes':_0x24ae5a['attributes'],'include':_0x24ae5a[_0x9a10('0x24')]?_[_0x9a10('0x29')](_0x24ae5a['include'],function(_0x11feef){return{'model':db[_0x11feef['model']],'as':_0x11feef['as'],'attributes':_0x11feef['attributes'],'include':_0x11feef[_0x9a10('0x24')]?_[_0x9a10('0x29')](_0x11feef[_0x9a10('0x24')],function(_0xf05138){return{'model':db[_0xf05138[_0x9a10('0x25')]],'as':_0xf05138['as'],'attributes':_0xf05138['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a10('0x13')](function(_0x47a963){logger[_0x9a10('0x14')]('ShowChatQueue',_0x2ee70a);logger[_0x9a10('0x16')](_0x9a10('0x27'),_0x2ee70a,JSON['stringify'](_0x47a963));_0x32d9fe(_0x47a963);})[_0x9a10('0x1c')](function(_0x2c75b2){logger[_0x9a10('0x18')](_0x9a10('0x27'),_0x2c75b2['message'],_0x2ee70a);_0x90f7ec(_0x26b0fe[_0x9a10('0x18')](0x1f4,_0x2c75b2[_0x9a10('0x1a')]));});});}; \ No newline at end of file +var _0x56a4=['where','map','include','model','attributes','then','catch','find','raw','ShowChatQueue','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetChatQueue','options'];(function(_0x11c6b8,_0x5b2d7b){var _0x38b38f=function(_0x641ad0){while(--_0x641ad0){_0x11c6b8['push'](_0x11c6b8['shift']());}};_0x38b38f(++_0x5b2d7b);}(_0x56a4,0x73));var _0x456a=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0x56a4[_0x599d7f];return _0x3346d3;};'use strict';var _=require('lodash');var util=require(_0x456a('0x0'));var moment=require(_0x456a('0x1'));var BPromise=require(_0x456a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x456a('0x3'))['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson[_0x456a('0x9')][_0x456a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x456a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x456a('0xb')]));require('./chatQueue.socket')[_0x456a('0xc')](socket);function respondWithRpcPromise(_0x86bcda,_0x177988,_0x2e5f10){return new BPromise(function(_0x12f945,_0x56f14c){return client[_0x456a('0xd')](_0x86bcda,_0x2e5f10)['then'](function(_0x59f11c){logger[_0x456a('0xe')](_0x456a('0xf'),_0x177988,_0x456a('0x10'));logger[_0x456a('0x11')](_0x456a('0x12'),_0x177988,_0x456a('0x10'),JSON[_0x456a('0x13')](_0x59f11c));if(_0x59f11c['error']){if(_0x59f11c[_0x456a('0x14')]['code']===0x1f4){logger[_0x456a('0x14')]('ChatQueue,\x20%s,\x20%s',_0x177988,_0x59f11c[_0x456a('0x14')]['message']);return _0x56f14c(_0x59f11c[_0x456a('0x14')]['message']);}logger[_0x456a('0x14')]('ChatQueue,\x20%s,\x20%s',_0x177988,_0x59f11c[_0x456a('0x14')][_0x456a('0x15')]);return _0x12f945(_0x59f11c[_0x456a('0x14')][_0x456a('0x15')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x177988,_0x456a('0x10'));_0x12f945(_0x59f11c[_0x456a('0x16')][_0x456a('0x15')]);}})['catch'](function(_0x5aaf40){logger[_0x456a('0x14')](_0x456a('0xf'),_0x177988,_0x5aaf40);_0x56f14c(_0x5aaf40);});});}exports[_0x456a('0x17')]=function(_0x5aff8b){var _0x202877=this;return new Promise(function(_0x2db147,_0x1378ae){return db['ChatQueue']['findAll']({'raw':_0x5aff8b['options']?_0x5aff8b[_0x456a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5aff8b[_0x456a('0x18')]?_0x5aff8b['options'][_0x456a('0x19')]||null:null,'attributes':_0x5aff8b[_0x456a('0x18')]?_0x5aff8b[_0x456a('0x18')]['attributes']||null:null,'limit':_0x5aff8b['options']?_0x5aff8b[_0x456a('0x18')]['limit']||null:null,'include':_0x5aff8b[_0x456a('0x18')]?_0x5aff8b[_0x456a('0x18')]['include']?_[_0x456a('0x1a')](_0x5aff8b[_0x456a('0x18')][_0x456a('0x1b')],function(_0x3f8967){return{'model':db[_0x3f8967[_0x456a('0x1c')]],'as':_0x3f8967['as'],'attributes':_0x3f8967[_0x456a('0x1d')],'include':_0x3f8967['include']?_[_0x456a('0x1a')](_0x3f8967['include'],function(_0x2f7e93){return{'model':db[_0x2f7e93[_0x456a('0x1c')]],'as':_0x2f7e93['as'],'attributes':_0x2f7e93['attributes'],'include':_0x2f7e93[_0x456a('0x1b')]?_['map'](_0x2f7e93[_0x456a('0x1b')],function(_0x3097fb){return{'model':db[_0x3097fb[_0x456a('0x1c')]],'as':_0x3097fb['as'],'attributes':_0x3097fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x456a('0x1e')](function(_0x25287a){logger[_0x456a('0xe')](_0x456a('0x17'),_0x5aff8b);logger[_0x456a('0x11')](_0x456a('0x17'),_0x5aff8b,JSON[_0x456a('0x13')](_0x25287a));_0x2db147(_0x25287a);})[_0x456a('0x1f')](function(_0x1b9af6){logger[_0x456a('0x14')]('GetChatQueue',_0x1b9af6[_0x456a('0x15')],_0x5aff8b);_0x1378ae(_0x202877[_0x456a('0x14')](0x1f4,_0x1b9af6[_0x456a('0x15')]));});});};exports['ShowChatQueue']=function(_0x1ef547){var _0x6d6e3c=this;return new Promise(function(_0x40445d,_0x21f232){return db['ChatQueue'][_0x456a('0x20')]({'raw':_0x1ef547[_0x456a('0x18')]?_0x1ef547[_0x456a('0x18')][_0x456a('0x21')]===undefined?!![]:![]:!![],'where':_0x1ef547['options']?_0x1ef547[_0x456a('0x18')]['where']||null:null,'attributes':_0x1ef547[_0x456a('0x18')]?_0x1ef547[_0x456a('0x18')][_0x456a('0x1d')]||null:null,'include':_0x1ef547['options']?_0x1ef547['options'][_0x456a('0x1b')]?_[_0x456a('0x1a')](_0x1ef547['options']['include'],function(_0x3c308b){return{'model':db[_0x3c308b['model']],'as':_0x3c308b['as'],'attributes':_0x3c308b[_0x456a('0x1d')],'include':_0x3c308b['include']?_[_0x456a('0x1a')](_0x3c308b[_0x456a('0x1b')],function(_0x1b234d){return{'model':db[_0x1b234d[_0x456a('0x1c')]],'as':_0x1b234d['as'],'attributes':_0x1b234d[_0x456a('0x1d')],'include':_0x1b234d[_0x456a('0x1b')]?_[_0x456a('0x1a')](_0x1b234d[_0x456a('0x1b')],function(_0x307440){return{'model':db[_0x307440['model']],'as':_0x307440['as'],'attributes':_0x307440['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5886ed){logger['info'](_0x456a('0x22'),_0x1ef547);logger[_0x456a('0x11')](_0x456a('0x22'),_0x1ef547,JSON[_0x456a('0x13')](_0x5886ed));_0x40445d(_0x5886ed);})[_0x456a('0x1f')](function(_0x2a8527){logger[_0x456a('0x14')](_0x456a('0x22'),_0x2a8527['message'],_0x1ef547);_0x21f232(_0x6d6e3c[_0x456a('0x14')](0x1f4,_0x2a8527[_0x456a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 3e3330d..cc415b9 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 _0x425d=['./chatQueue.events','remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x425d,0x1e0));var _0xd425=function(_0x552c9e,_0x221cf5){_0x552c9e=_0x552c9e-0x0;var _0x4c8401=_0x425d[_0x552c9e];return _0x4c8401;};'use strict';var ChatQueueEvents=require(_0xd425('0x0'));var events=['save',_0xd425('0x1'),_0xd425('0x2')];function createListener(_0x314a2b,_0x97e370){return function(_0x183caa){_0x97e370[_0xd425('0x3')](_0x314a2b,_0x183caa);};}function removeListener(_0x47043f,_0x596be7){return function(){ChatQueueEvents[_0xd425('0x4')](_0x47043f,_0x596be7);};}exports[_0xd425('0x5')]=function(_0xc4e080){for(var _0x36866e=0x0,_0x1d97d9=events[_0xd425('0x6')];_0x36866e<_0x1d97d9;_0x36866e++){var _0x50b061=events[_0x36866e];var _0xb6ba8e=createListener(_0xd425('0x7')+_0x50b061,_0xc4e080);ChatQueueEvents['on'](_0x50b061,_0xb6ba8e);}}; \ No newline at end of file +var _0xc368=['removeListener','register','length','chatQueue:','save','update','emit'];(function(_0x1d14a4,_0x3d0375){var _0x5cae92=function(_0x332f16){while(--_0x332f16){_0x1d14a4['push'](_0x1d14a4['shift']());}};_0x5cae92(++_0x3d0375);}(_0xc368,0x7b));var _0x8c36=function(_0x5717e6,_0x2428d5){_0x5717e6=_0x5717e6-0x0;var _0x19aeb2=_0xc368[_0x5717e6];return _0x19aeb2;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8c36('0x0'),'remove',_0x8c36('0x1')];function createListener(_0x17fa33,_0x20e697){return function(_0x2640c5){_0x20e697[_0x8c36('0x2')](_0x17fa33,_0x2640c5);};}function removeListener(_0x5d3b27,_0x3e9034){return function(){ChatQueueEvents[_0x8c36('0x3')](_0x5d3b27,_0x3e9034);};}exports[_0x8c36('0x4')]=function(_0x1d3660){for(var _0x5ebfc1=0x0,_0x554022=events[_0x8c36('0x5')];_0x5ebfc1<_0x554022;_0x5ebfc1++){var _0x384867=events[_0x5ebfc1];var _0x3e76be=createListener(_0x8c36('0x6')+_0x384867,_0x1d3660);ChatQueueEvents['on'](_0x384867,_0x3e76be);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index d1e80aa..0e02e88 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3d0bf7,_0x3477aa){var _0x2393f5=function(_0x10e499){while(--_0x10e499){_0x3d0bf7['push'](_0x3d0bf7['shift']());}};_0x2393f5(++_0x3477aa);}(_0x008c,0x188));var _0xc008=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x008c[_0xea343d];return _0x2c6e9c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x11f6a1,_0x4b3ec7){var _0x3df8a2=function(_0xdd0d48){while(--_0xdd0d48){_0x11f6a1['push'](_0x11f6a1['shift']());}};_0x3df8a2(++_0x4b3ec7);}(_0x55ca,0x126));var _0xa55c=function(_0x52e9e3,_0xe465a7){_0x52e9e3=_0x52e9e3-0x0;var _0x960a8d=_0x55ca[_0x52e9e3];return _0x960a8d;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index cd82b3e..7494f32 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 _0x3ae7=['sequelize','exports','STRING','DATE','moment'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x3ae7,0x1e4));var _0x73ae=function(_0x1e102b,_0x5d25b0){_0x1e102b=_0x1e102b-0x0;var _0x20f90a=_0x3ae7[_0x1e102b];return _0x20f90a;};'use strict';var moment=require(_0x73ae('0x0'));var Sequelize=require(_0x73ae('0x1'));module[_0x73ae('0x2')]={'uniqueid':{'type':Sequelize[_0x73ae('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x73ae('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x73ae('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x73ae('0x3')]}}; \ No newline at end of file +var _0x2c79=['STRING','DATE','moment','sequelize'];(function(_0x2e5a67,_0x37dadb){var _0x1f37b9=function(_0x47a076){while(--_0x47a076){_0x2e5a67['push'](_0x2e5a67['shift']());}};_0x1f37b9(++_0x37dadb);}(_0x2c79,0x102));var _0x92c7=function(_0x5bfef4,_0x57e1aa){_0x5bfef4=_0x5bfef4-0x0;var _0x363045=_0x2c79[_0x5bfef4];return _0x363045;};'use strict';var moment=require(_0x92c7('0x0'));var Sequelize=require(_0x92c7('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x92c7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x92c7('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x92c7('0x3')]},'acceptAt':{'type':Sequelize[_0x92c7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x92c7('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 160d919..275f311 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 _0xda81=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','stack','name','send','index','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','map','VIRTUAL','filter','includeAll','include','ChatQueueReport','findAll','rows','show','params','rawAttributes','options','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xda81,0x1c3));var _0x1da8=function(_0x34a6f4,_0x543abd){_0x34a6f4=_0x34a6f4-0x0;var _0x1b09fe=_0xda81[_0x34a6f4];return _0x1b09fe;};'use strict';var emlformat=require(_0x1da8('0x0'));var rimraf=require(_0x1da8('0x1'));var zipdir=require(_0x1da8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1da8('0x3'));var moment=require(_0x1da8('0x4'));var BPromise=require(_0x1da8('0x5'));var Mustache=require(_0x1da8('0x6'));var util=require('util');var path=require(_0x1da8('0x7'));var sox=require(_0x1da8('0x8'));var csv=require('to-csv');var ejs=require(_0x1da8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1da8('0xa'));var squel=require(_0x1da8('0xb'));var crypto=require(_0x1da8('0xc'));var jsforce=require(_0x1da8('0xd'));var deskjs=require(_0x1da8('0xe'));var toCsv=require(_0x1da8('0xf'));var querystring=require(_0x1da8('0x10'));var Papa=require(_0x1da8('0x11'));var Redis=require(_0x1da8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1da8('0x13'));var as=require(_0x1da8('0x14'));var hardwareService=require(_0x1da8('0x15'));var logger=require(_0x1da8('0x16'))(_0x1da8('0x17'));var utils=require('../../config/utils');var config=require(_0x1da8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1da8('0x19'))['db'];function respondWithStatusCode(_0x4127c8,_0x2717e6){_0x2717e6=_0x2717e6||0xcc;return function(_0x444ea6){if(_0x444ea6){return _0x4127c8[_0x1da8('0x1a')](_0x2717e6);}return _0x4127c8['status'](_0x2717e6)[_0x1da8('0x1b')]();};}function respondWithResult(_0x491a3f,_0x335935){_0x335935=_0x335935||0xc8;return function(_0x283169){if(_0x283169){return _0x491a3f[_0x1da8('0x1c')](_0x335935)[_0x1da8('0x1d')](_0x283169);}};}function respondWithFilteredResult(_0x23b7e7,_0x1e25ff){return function(_0x5f40c0){if(_0x5f40c0){var _0x155829=typeof _0x1e25ff[_0x1da8('0x1e')]===_0x1da8('0x1f')&&typeof _0x1e25ff[_0x1da8('0x20')]===_0x1da8('0x1f');var _0x422721=_0x5f40c0[_0x1da8('0x21')];var _0x1258e3=_0x155829?0x0:_0x1e25ff[_0x1da8('0x1e')];var _0x4ccb6e=_0x155829?_0x5f40c0[_0x1da8('0x21')]:_0x1e25ff[_0x1da8('0x1e')]+_0x1e25ff[_0x1da8('0x20')];var _0x2b84fa;if(_0x4ccb6e>=_0x422721){_0x4ccb6e=_0x422721;_0x2b84fa=0xc8;}else{_0x2b84fa=0xce;}_0x23b7e7[_0x1da8('0x1c')](_0x2b84fa);return _0x23b7e7[_0x1da8('0x22')]('Content-Range',_0x1258e3+'-'+_0x4ccb6e+'/'+_0x422721)[_0x1da8('0x1d')](_0x5f40c0);}return null;};}function patchUpdates(_0x36f234){return function(_0x3afeb3){try{jsonpatch[_0x1da8('0x23')](_0x3afeb3,_0x36f234,!![]);}catch(_0x9f2255){return BPromise[_0x1da8('0x24')](_0x9f2255);}return _0x3afeb3['save']();};}function saveUpdates(_0x283ff8,_0x503adb){return function(_0x3650e8){if(_0x3650e8){return _0x3650e8[_0x1da8('0x25')](_0x283ff8)[_0x1da8('0x26')](function(_0x370d2a){return _0x370d2a;});}return null;};}function removeEntity(_0x2a9002,_0x2ea607){return function(_0x2839e2){if(_0x2839e2){return _0x2839e2['destroy']()['then'](function(){_0x2a9002[_0x1da8('0x1c')](0xcc)[_0x1da8('0x1b')]();});}};}function handleEntityNotFound(_0x4e281e,_0x242e69){return function(_0x1509a9){if(!_0x1509a9){_0x4e281e[_0x1da8('0x1a')](0x194);}return _0x1509a9;};}function handleError(_0x138aad,_0x1e2d3e){_0x1e2d3e=_0x1e2d3e||0x1f4;return function(_0x46af20){logger['error'](_0x46af20[_0x1da8('0x27')]);if(_0x46af20[_0x1da8('0x28')]){delete _0x46af20[_0x1da8('0x28')];}_0x138aad[_0x1da8('0x1c')](_0x1e2d3e)[_0x1da8('0x29')](_0x46af20);};}exports[_0x1da8('0x2a')]=function(_0x272a98,_0x31d32d){var _0x442043={},_0x21f3fe={},_0x58e3c6={'count':0x0,'rows':[]};var _0x157977=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x54d3fd){return{'name':_0x54d3fd[_0x1da8('0x2b')],'type':_0x54d3fd[_0x1da8('0x2c')]['key']};});_0x21f3fe[_0x1da8('0x2d')]=_['map'](_0x157977,_0x1da8('0x28'));_0x21f3fe[_0x1da8('0x2e')]=_[_0x1da8('0x2f')](_0x272a98['query']);_0x21f3fe[_0x1da8('0x30')]=_[_0x1da8('0x31')](_0x21f3fe[_0x1da8('0x2d')],_0x21f3fe[_0x1da8('0x2e')]);_0x442043['attributes']=_[_0x1da8('0x31')](_0x21f3fe[_0x1da8('0x2d')],qs[_0x1da8('0x32')](_0x272a98[_0x1da8('0x2e')][_0x1da8('0x32')]));_0x442043[_0x1da8('0x33')]=_0x442043['attributes'][_0x1da8('0x34')]?_0x442043[_0x1da8('0x33')]:_0x21f3fe[_0x1da8('0x2d')];if(!_0x272a98['query'][_0x1da8('0x35')](_0x1da8('0x36'))){_0x442043[_0x1da8('0x20')]=qs[_0x1da8('0x20')](_0x272a98[_0x1da8('0x2e')]['limit']);_0x442043[_0x1da8('0x1e')]=qs[_0x1da8('0x1e')](_0x272a98[_0x1da8('0x2e')]['offset']);}_0x442043['order']=qs[_0x1da8('0x37')](_0x272a98['query']['sort']);_0x442043['where']=qs[_0x1da8('0x30')](_[_0x1da8('0x38')](_0x272a98[_0x1da8('0x2e')],_0x21f3fe['filters']),_0x157977);if(_0x272a98[_0x1da8('0x2e')]['filter']){_0x442043[_0x1da8('0x39')]=_[_0x1da8('0x3a')](_0x442043[_0x1da8('0x39')],{'$or':_[_0x1da8('0x3b')](_0x157977,function(_0x2a6b70){if(_0x2a6b70[_0x1da8('0x2c')]!==_0x1da8('0x3c')){var _0x268ec9={};_0x268ec9[_0x2a6b70[_0x1da8('0x28')]]={'$like':'%'+_0x272a98[_0x1da8('0x2e')][_0x1da8('0x3d')]+'%'};return _0x268ec9;}})});}_0x442043=_[_0x1da8('0x3a')]({},_0x442043,_0x272a98['options']);var _0x3df5cb={'where':_0x442043[_0x1da8('0x39')]};return db['ChatQueueReport'][_0x1da8('0x21')](_0x3df5cb)[_0x1da8('0x26')](function(_0x3794ff){_0x58e3c6['count']=_0x3794ff;if(_0x272a98[_0x1da8('0x2e')][_0x1da8('0x3e')]){_0x442043[_0x1da8('0x3f')]=[{'all':!![]}];}return db[_0x1da8('0x40')][_0x1da8('0x41')](_0x442043);})['then'](function(_0x3655c0){_0x58e3c6[_0x1da8('0x42')]=_0x3655c0;return _0x58e3c6;})[_0x1da8('0x26')](respondWithFilteredResult(_0x31d32d,_0x442043))['catch'](handleError(_0x31d32d,null));};exports[_0x1da8('0x43')]=function(_0x5dd58e,_0x37d431){var _0x3cd2d5={'raw':!![],'where':{'id':_0x5dd58e[_0x1da8('0x44')]['id']}},_0x1f9871={};_0x1f9871[_0x1da8('0x2d')]=_[_0x1da8('0x2f')](db[_0x1da8('0x40')][_0x1da8('0x45')]);_0x1f9871[_0x1da8('0x2e')]=_[_0x1da8('0x2f')](_0x5dd58e['query']);_0x1f9871[_0x1da8('0x30')]=_[_0x1da8('0x31')](_0x1f9871[_0x1da8('0x2d')],_0x1f9871[_0x1da8('0x2e')]);_0x3cd2d5[_0x1da8('0x33')]=_['intersection'](_0x1f9871[_0x1da8('0x2d')],qs[_0x1da8('0x32')](_0x5dd58e[_0x1da8('0x2e')][_0x1da8('0x32')]));_0x3cd2d5[_0x1da8('0x33')]=_0x3cd2d5[_0x1da8('0x33')][_0x1da8('0x34')]?_0x3cd2d5[_0x1da8('0x33')]:_0x1f9871[_0x1da8('0x2d')];if(_0x5dd58e[_0x1da8('0x2e')][_0x1da8('0x3e')]){_0x3cd2d5[_0x1da8('0x3f')]=[{'all':!![]}];}_0x3cd2d5=_[_0x1da8('0x3a')]({},_0x3cd2d5,_0x5dd58e[_0x1da8('0x46')]);return db['ChatQueueReport']['find'](_0x3cd2d5)[_0x1da8('0x26')](handleEntityNotFound(_0x37d431,null))[_0x1da8('0x26')](respondWithResult(_0x37d431,null))[_0x1da8('0x47')](handleError(_0x37d431,null));};exports[_0x1da8('0x48')]=function(_0x25777f,_0x1ed191){return db['ChatQueueReport'][_0x1da8('0x48')](_0x25777f['body'],{})[_0x1da8('0x26')](respondWithResult(_0x1ed191,0xc9))[_0x1da8('0x47')](handleError(_0x1ed191,null));};exports[_0x1da8('0x25')]=function(_0x5d16cb,_0x319531){if(_0x5d16cb[_0x1da8('0x49')]['id']){delete _0x5d16cb[_0x1da8('0x49')]['id'];}return db[_0x1da8('0x40')][_0x1da8('0x4a')]({'where':{'id':_0x5d16cb[_0x1da8('0x44')]['id']}})['then'](handleEntityNotFound(_0x319531,null))[_0x1da8('0x26')](saveUpdates(_0x5d16cb['body'],null))[_0x1da8('0x26')](respondWithResult(_0x319531,null))['catch'](handleError(_0x319531,null));};exports[_0x1da8('0x4b')]=function(_0x5860c8,_0xec5023){return db[_0x1da8('0x40')][_0x1da8('0x4a')]({'where':{'id':_0x5860c8['params']['id']}})[_0x1da8('0x26')](handleEntityNotFound(_0xec5023,null))[_0x1da8('0x26')](removeEntity(_0xec5023,null))[_0x1da8('0x47')](handleError(_0xec5023,null));};exports['describe']=function(_0x55c7fa,_0x33b198){return db[_0x1da8('0x40')][_0x1da8('0x4c')]()[_0x1da8('0x26')](respondWithResult(_0x33b198,null))[_0x1da8('0x47')](handleError(_0x33b198,null));}; \ No newline at end of file +var _0xfc91=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','include','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','model','query','keys','filters'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfc91,0xb5));var _0x1fc9=function(_0x3e7703,_0x4ead9a){_0x3e7703=_0x3e7703-0x0;var _0xf8c99a=_0xfc91[_0x3e7703];return _0xf8c99a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fc9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fc9('0x1'));var rp=require(_0x1fc9('0x2'));var moment=require(_0x1fc9('0x3'));var BPromise=require(_0x1fc9('0x4'));var Mustache=require(_0x1fc9('0x5'));var util=require(_0x1fc9('0x6'));var path=require(_0x1fc9('0x7'));var sox=require(_0x1fc9('0x8'));var csv=require(_0x1fc9('0x9'));var ejs=require(_0x1fc9('0xa'));var fs=require('fs');var fs_extra=require(_0x1fc9('0xb'));var _=require(_0x1fc9('0xc'));var squel=require('squel');var crypto=require(_0x1fc9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1fc9('0x9'));var querystring=require(_0x1fc9('0xe'));var Papa=require(_0x1fc9('0xf'));var Redis=require(_0x1fc9('0x10'));var authService=require(_0x1fc9('0x11'));var qs=require(_0x1fc9('0x12'));var as=require(_0x1fc9('0x13'));var hardwareService=require(_0x1fc9('0x14'));var logger=require(_0x1fc9('0x15'))(_0x1fc9('0x16'));var utils=require(_0x1fc9('0x17'));var config=require(_0x1fc9('0x18'));var licenseUtil=require(_0x1fc9('0x19'));var db=require(_0x1fc9('0x1a'))['db'];function respondWithStatusCode(_0x2ef956,_0x37629a){_0x37629a=_0x37629a||0xcc;return function(_0x32d8ab){if(_0x32d8ab){return _0x2ef956['sendStatus'](_0x37629a);}return _0x2ef956[_0x1fc9('0x1b')](_0x37629a)[_0x1fc9('0x1c')]();};}function respondWithResult(_0x47f51b,_0x47670a){_0x47670a=_0x47670a||0xc8;return function(_0x39fe61){if(_0x39fe61){return _0x47f51b[_0x1fc9('0x1b')](_0x47670a)[_0x1fc9('0x1d')](_0x39fe61);}};}function respondWithFilteredResult(_0x3e0c75,_0x373e71){return function(_0x5e4787){if(_0x5e4787){var _0x4e46b7=typeof _0x373e71[_0x1fc9('0x1e')]==='undefined'&&typeof _0x373e71[_0x1fc9('0x1f')]==='undefined';var _0x533635=_0x5e4787[_0x1fc9('0x20')];var _0x1d05ab=_0x4e46b7?0x0:_0x373e71[_0x1fc9('0x1e')];var _0x40efef=_0x4e46b7?_0x5e4787[_0x1fc9('0x20')]:_0x373e71[_0x1fc9('0x1e')]+_0x373e71[_0x1fc9('0x1f')];var _0x1392fa;if(_0x40efef>=_0x533635){_0x40efef=_0x533635;_0x1392fa=0xc8;}else{_0x1392fa=0xce;}_0x3e0c75[_0x1fc9('0x1b')](_0x1392fa);return _0x3e0c75[_0x1fc9('0x21')](_0x1fc9('0x22'),_0x1d05ab+'-'+_0x40efef+'/'+_0x533635)[_0x1fc9('0x1d')](_0x5e4787);}return null;};}function patchUpdates(_0x1ddde2){return function(_0x19d9bd){try{jsonpatch['apply'](_0x19d9bd,_0x1ddde2,!![]);}catch(_0x56a867){return BPromise[_0x1fc9('0x23')](_0x56a867);}return _0x19d9bd[_0x1fc9('0x24')]();};}function saveUpdates(_0x36123d,_0x56a342){return function(_0x524e1a){if(_0x524e1a){return _0x524e1a[_0x1fc9('0x25')](_0x36123d)['then'](function(_0x528aa5){return _0x528aa5;});}return null;};}function removeEntity(_0x5a73fd,_0x14c02c){return function(_0x58f4ec){if(_0x58f4ec){return _0x58f4ec[_0x1fc9('0x26')]()[_0x1fc9('0x27')](function(){_0x5a73fd['status'](0xcc)[_0x1fc9('0x1c')]();});}};}function handleEntityNotFound(_0x4f1598,_0x59c293){return function(_0x24cb50){if(!_0x24cb50){_0x4f1598[_0x1fc9('0x28')](0x194);}return _0x24cb50;};}function handleError(_0x2ae7e2,_0x29bf4){_0x29bf4=_0x29bf4||0x1f4;return function(_0x1dfbbc){logger['error'](_0x1dfbbc[_0x1fc9('0x29')]);if(_0x1dfbbc[_0x1fc9('0x2a')]){delete _0x1dfbbc['name'];}_0x2ae7e2[_0x1fc9('0x1b')](_0x29bf4)[_0x1fc9('0x2b')](_0x1dfbbc);};}exports[_0x1fc9('0x2c')]=function(_0x538d5f,_0x19a8e1){var _0x2aa669={},_0x19e270={},_0x31ba25={'count':0x0,'rows':[]};var _0x16f3a4=_[_0x1fc9('0x2d')](db[_0x1fc9('0x2e')][_0x1fc9('0x2f')],function(_0x5dfb6b){return{'name':_0x5dfb6b[_0x1fc9('0x30')],'type':_0x5dfb6b['type']['key']};});_0x19e270[_0x1fc9('0x31')]=_[_0x1fc9('0x2d')](_0x16f3a4,_0x1fc9('0x2a'));_0x19e270[_0x1fc9('0x32')]=_[_0x1fc9('0x33')](_0x538d5f[_0x1fc9('0x32')]);_0x19e270[_0x1fc9('0x34')]=_['intersection'](_0x19e270['model'],_0x19e270[_0x1fc9('0x32')]);_0x2aa669[_0x1fc9('0x35')]=_['intersection'](_0x19e270['model'],qs[_0x1fc9('0x36')](_0x538d5f['query'][_0x1fc9('0x36')]));_0x2aa669[_0x1fc9('0x35')]=_0x2aa669[_0x1fc9('0x35')][_0x1fc9('0x37')]?_0x2aa669[_0x1fc9('0x35')]:_0x19e270[_0x1fc9('0x31')];if(!_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x38')](_0x1fc9('0x39'))){_0x2aa669[_0x1fc9('0x1f')]=qs[_0x1fc9('0x1f')](_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x1f')]);_0x2aa669[_0x1fc9('0x1e')]=qs[_0x1fc9('0x1e')](_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x1e')]);}_0x2aa669[_0x1fc9('0x3a')]=qs['sort'](_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x3b')]);_0x2aa669[_0x1fc9('0x3c')]=qs[_0x1fc9('0x34')](_[_0x1fc9('0x3d')](_0x538d5f['query'],_0x19e270[_0x1fc9('0x34')]),_0x16f3a4);if(_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x3e')]){_0x2aa669[_0x1fc9('0x3c')]=_[_0x1fc9('0x3f')](_0x2aa669[_0x1fc9('0x3c')],{'$or':_[_0x1fc9('0x2d')](_0x16f3a4,function(_0x5886be){if(_0x5886be[_0x1fc9('0x40')]!==_0x1fc9('0x41')){var _0x43d7b9={};_0x43d7b9[_0x5886be['name']]={'$like':'%'+_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x3e')]+'%'};return _0x43d7b9;}})});}_0x2aa669=_[_0x1fc9('0x3f')]({},_0x2aa669,_0x538d5f[_0x1fc9('0x42')]);var _0x2fa2b0={'where':_0x2aa669[_0x1fc9('0x3c')]};return db[_0x1fc9('0x2e')][_0x1fc9('0x20')](_0x2fa2b0)[_0x1fc9('0x27')](function(_0x5623fb){_0x31ba25[_0x1fc9('0x20')]=_0x5623fb;if(_0x538d5f[_0x1fc9('0x32')][_0x1fc9('0x43')]){_0x2aa669['include']=[{'all':!![]}];}return db[_0x1fc9('0x2e')]['findAll'](_0x2aa669);})[_0x1fc9('0x27')](function(_0x4ee54b){_0x31ba25[_0x1fc9('0x44')]=_0x4ee54b;return _0x31ba25;})[_0x1fc9('0x27')](respondWithFilteredResult(_0x19a8e1,_0x2aa669))[_0x1fc9('0x45')](handleError(_0x19a8e1,null));};exports[_0x1fc9('0x46')]=function(_0x12e808,_0x153e62){var _0x366a91={'raw':!![],'where':{'id':_0x12e808[_0x1fc9('0x47')]['id']}},_0x54799d={};_0x54799d[_0x1fc9('0x31')]=_[_0x1fc9('0x33')](db[_0x1fc9('0x2e')][_0x1fc9('0x2f')]);_0x54799d[_0x1fc9('0x32')]=_[_0x1fc9('0x33')](_0x12e808[_0x1fc9('0x32')]);_0x54799d[_0x1fc9('0x34')]=_[_0x1fc9('0x48')](_0x54799d[_0x1fc9('0x31')],_0x54799d[_0x1fc9('0x32')]);_0x366a91[_0x1fc9('0x35')]=_[_0x1fc9('0x48')](_0x54799d[_0x1fc9('0x31')],qs[_0x1fc9('0x36')](_0x12e808[_0x1fc9('0x32')][_0x1fc9('0x36')]));_0x366a91[_0x1fc9('0x35')]=_0x366a91[_0x1fc9('0x35')][_0x1fc9('0x37')]?_0x366a91[_0x1fc9('0x35')]:_0x54799d[_0x1fc9('0x31')];if(_0x12e808[_0x1fc9('0x32')][_0x1fc9('0x43')]){_0x366a91[_0x1fc9('0x49')]=[{'all':!![]}];}_0x366a91=_['merge']({},_0x366a91,_0x12e808['options']);return db[_0x1fc9('0x2e')][_0x1fc9('0x4a')](_0x366a91)[_0x1fc9('0x27')](handleEntityNotFound(_0x153e62,null))[_0x1fc9('0x27')](respondWithResult(_0x153e62,null))[_0x1fc9('0x45')](handleError(_0x153e62,null));};exports[_0x1fc9('0x4b')]=function(_0x16835d,_0x3eeac5){return db[_0x1fc9('0x2e')][_0x1fc9('0x4b')](_0x16835d['body'],{})[_0x1fc9('0x27')](respondWithResult(_0x3eeac5,0xc9))['catch'](handleError(_0x3eeac5,null));};exports[_0x1fc9('0x25')]=function(_0x3cb02a,_0x14a8f0){if(_0x3cb02a[_0x1fc9('0x4c')]['id']){delete _0x3cb02a[_0x1fc9('0x4c')]['id'];}return db[_0x1fc9('0x2e')][_0x1fc9('0x4a')]({'where':{'id':_0x3cb02a[_0x1fc9('0x47')]['id']}})['then'](handleEntityNotFound(_0x14a8f0,null))[_0x1fc9('0x27')](saveUpdates(_0x3cb02a['body'],null))[_0x1fc9('0x27')](respondWithResult(_0x14a8f0,null))['catch'](handleError(_0x14a8f0,null));};exports[_0x1fc9('0x26')]=function(_0x106ce2,_0x22fe09){return db['ChatQueueReport'][_0x1fc9('0x4a')]({'where':{'id':_0x106ce2['params']['id']}})[_0x1fc9('0x27')](handleEntityNotFound(_0x22fe09,null))['then'](removeEntity(_0x22fe09,null))[_0x1fc9('0x45')](handleError(_0x22fe09,null));};exports[_0x1fc9('0x4d')]=function(_0x218a09,_0x4e65af){return db['ChatQueueReport'][_0x1fc9('0x4d')]()[_0x1fc9('0x27')](respondWithResult(_0x4e65af,null))[_0x1fc9('0x45')](handleError(_0x4e65af,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index cd313dd..d3d4d90 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x352fbf,_0x5d417d){var _0x45784a=function(_0x22a0ff){while(--_0x22a0ff){_0x352fbf['push'](_0x352fbf['shift']());}};_0x45784a(++_0x5d417d);}(_0xb10b,0x12a));var _0xbb10=function(_0x51d99b,_0x40f96f){_0x51d99b=_0x51d99b-0x0;var _0x359a78=_0xb10b[_0x51d99b];return _0x359a78;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 2e44638..e3ab7d2 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 _0x8d74=['message','info','result','catch','CreateChatQueueReport','body','options','raw','UpdateChatQueueReport','ChatQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x200e32,_0x244e0f){var _0x527ad6=function(_0x3c1206){while(--_0x3c1206){_0x200e32['push'](_0x200e32['shift']());}};_0x527ad6(++_0x244e0f);}(_0x8d74,0x16c));var _0x48d7=function(_0x4e96e0,_0x360b3d){_0x4e96e0=_0x4e96e0-0x0;var _0x59b920=_0x8d74[_0x4e96e0];return _0x59b920;};'use strict';var _=require(_0x48d7('0x0'));var util=require(_0x48d7('0x1'));var moment=require(_0x48d7('0x2'));var BPromise=require(_0x48d7('0x3'));var rs=require(_0x48d7('0x4'));var fs=require('fs');var Redis=require(_0x48d7('0x5'));var db=require(_0x48d7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x48d7('0x7'))('rpc');var config=require(_0x48d7('0x8'));var jayson=require(_0x48d7('0x9'));var client=jayson[_0x48d7('0xa')][_0x48d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ceee6,_0x465fbd,_0x1b6776){return new BPromise(function(_0xfe1b01,_0x55e6c5){return client[_0x48d7('0xc')](_0x4ceee6,_0x1b6776)[_0x48d7('0xd')](function(_0x87138a){logger['info'](_0x48d7('0xe'),_0x465fbd,_0x48d7('0xf'));logger[_0x48d7('0x10')](_0x48d7('0x11'),_0x465fbd,_0x48d7('0xf'),JSON[_0x48d7('0x12')](_0x87138a));if(_0x87138a['error']){if(_0x87138a[_0x48d7('0x13')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x465fbd,_0x87138a[_0x48d7('0x13')][_0x48d7('0x14')]);return _0x55e6c5(_0x87138a[_0x48d7('0x13')][_0x48d7('0x14')]);}logger[_0x48d7('0x13')](_0x48d7('0xe'),_0x465fbd,_0x87138a[_0x48d7('0x13')][_0x48d7('0x14')]);return _0xfe1b01(_0x87138a['error'][_0x48d7('0x14')]);}else{logger[_0x48d7('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x465fbd,_0x48d7('0xf'));_0xfe1b01(_0x87138a[_0x48d7('0x16')][_0x48d7('0x14')]);}})[_0x48d7('0x17')](function(_0x4045db){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x465fbd,_0x4045db);_0x55e6c5(_0x4045db);});});}exports[_0x48d7('0x18')]=function(_0x238ebe){var _0x546c9c=this;return new Promise(function(_0x1479f8,_0x7ee17c){return db['ChatQueueReport']['create'](_0x238ebe[_0x48d7('0x19')],{'raw':_0x238ebe[_0x48d7('0x1a')]?_0x238ebe[_0x48d7('0x1a')][_0x48d7('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x457fc6){logger[_0x48d7('0x15')]('CreateChatQueueReport',_0x238ebe);logger[_0x48d7('0x10')]('CreateChatQueueReport',_0x238ebe,JSON['stringify'](_0x457fc6));_0x1479f8(_0x457fc6);})['catch'](function(_0x2cf5b6){logger[_0x48d7('0x13')](_0x48d7('0x18'),_0x2cf5b6[_0x48d7('0x14')],_0x238ebe);_0x7ee17c(_0x546c9c['error'](0x1f4,_0x2cf5b6['message']));});});};exports[_0x48d7('0x1c')]=function(_0x332b41){var _0x3c8481=this;return new Promise(function(_0x139888,_0x38e342){return db[_0x48d7('0x1d')][_0x48d7('0x1e')](_0x332b41[_0x48d7('0x19')],{'raw':_0x332b41[_0x48d7('0x1a')]?_0x332b41['options'][_0x48d7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x332b41['options']?_0x332b41['options']['where']||null:null,'attributes':_0x332b41[_0x48d7('0x1a')]?_0x332b41[_0x48d7('0x1a')]['attributes']||null:null,'limit':_0x332b41[_0x48d7('0x1a')]?_0x332b41[_0x48d7('0x1a')][_0x48d7('0x1f')]||null:null})['then'](function(_0x2e3793){logger[_0x48d7('0x15')](_0x48d7('0x1c'),_0x332b41);logger['debug'](_0x48d7('0x1c'),_0x332b41,JSON[_0x48d7('0x12')](_0x2e3793));_0x139888(_0x2e3793);})[_0x48d7('0x17')](function(_0x199938){logger[_0x48d7('0x13')]('UpdateChatQueueReport',_0x199938[_0x48d7('0x14')],_0x332b41);_0x38e342(_0x3c8481['error'](0x1f4,_0x199938[_0x48d7('0x14')]));});});}; \ No newline at end of file +var _0x3ef0=['create','options','raw','then','CreateChatQueueReport','stringify','UpdateChatQueueReport','body','where','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatQueueReport'];(function(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_0x3ef0,0x141));var _0x03ef=function(_0x2a64b2,_0x4d447a){_0x2a64b2=_0x2a64b2-0x0;var _0x2db167=_0x3ef0[_0x2a64b2];return _0x2db167;};'use strict';var _=require(_0x03ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x03ef('0x1'));var fs=require('fs');var Redis=require(_0x03ef('0x2'));var db=require(_0x03ef('0x3'))['db'];var utils=require(_0x03ef('0x4'));var logger=require(_0x03ef('0x5'))(_0x03ef('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x03ef('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe25a18,_0x5bcb91,_0x2fdb92){return new BPromise(function(_0x59ea1e,_0x1c328f){return client[_0x03ef('0x8')](_0xe25a18,_0x2fdb92)['then'](function(_0x579304){logger[_0x03ef('0x9')](_0x03ef('0xa'),_0x5bcb91,_0x03ef('0xb'));logger[_0x03ef('0xc')](_0x03ef('0xd'),_0x5bcb91,_0x03ef('0xb'),JSON['stringify'](_0x579304));if(_0x579304[_0x03ef('0xe')]){if(_0x579304['error'][_0x03ef('0xf')]===0x1f4){logger[_0x03ef('0xe')](_0x03ef('0xa'),_0x5bcb91,_0x579304[_0x03ef('0xe')][_0x03ef('0x10')]);return _0x1c328f(_0x579304[_0x03ef('0xe')][_0x03ef('0x10')]);}logger[_0x03ef('0xe')](_0x03ef('0xa'),_0x5bcb91,_0x579304['error'][_0x03ef('0x10')]);return _0x59ea1e(_0x579304[_0x03ef('0xe')][_0x03ef('0x10')]);}else{logger[_0x03ef('0x9')](_0x03ef('0xa'),_0x5bcb91,_0x03ef('0xb'));_0x59ea1e(_0x579304[_0x03ef('0x11')][_0x03ef('0x10')]);}})[_0x03ef('0x12')](function(_0x311bb1){logger[_0x03ef('0xe')](_0x03ef('0xa'),_0x5bcb91,_0x311bb1);_0x1c328f(_0x311bb1);});});}exports['CreateChatQueueReport']=function(_0x120317){var _0x51fd1b=this;return new Promise(function(_0x4d4d70,_0x4cb597){return db[_0x03ef('0x13')][_0x03ef('0x14')](_0x120317['body'],{'raw':_0x120317['options']?_0x120317[_0x03ef('0x15')][_0x03ef('0x16')]===undefined?!![]:![]:!![]})[_0x03ef('0x17')](function(_0x2efdf7){logger[_0x03ef('0x9')](_0x03ef('0x18'),_0x120317);logger[_0x03ef('0xc')](_0x03ef('0x18'),_0x120317,JSON[_0x03ef('0x19')](_0x2efdf7));_0x4d4d70(_0x2efdf7);})[_0x03ef('0x12')](function(_0x121768){logger[_0x03ef('0xe')](_0x03ef('0x18'),_0x121768[_0x03ef('0x10')],_0x120317);_0x4cb597(_0x51fd1b[_0x03ef('0xe')](0x1f4,_0x121768[_0x03ef('0x10')]));});});};exports[_0x03ef('0x1a')]=function(_0x5796c8){var _0x5e85c6=this;return new Promise(function(_0x1f72c4,_0xb5d2f){return db[_0x03ef('0x13')]['update'](_0x5796c8[_0x03ef('0x1b')],{'raw':_0x5796c8['options']?_0x5796c8[_0x03ef('0x15')][_0x03ef('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5796c8['options']?_0x5796c8[_0x03ef('0x15')][_0x03ef('0x1c')]||null:null,'attributes':_0x5796c8['options']?_0x5796c8[_0x03ef('0x15')][_0x03ef('0x1d')]||null:null,'limit':_0x5796c8[_0x03ef('0x15')]?_0x5796c8[_0x03ef('0x15')][_0x03ef('0x1e')]||null:null})[_0x03ef('0x17')](function(_0x559b5b){logger['info'](_0x03ef('0x1a'),_0x5796c8);logger[_0x03ef('0xc')](_0x03ef('0x1a'),_0x5796c8,JSON[_0x03ef('0x19')](_0x559b5b));_0x1f72c4(_0x559b5b);})['catch'](function(_0xe77790){logger['error'](_0x03ef('0x1a'),_0xe77790[_0x03ef('0x10')],_0x5796c8);_0xb5d2f(_0x5e85c6[_0x03ef('0xe')](0x1f4,_0xe77790['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 7caad4a..0f889e1 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 _0x5ece=['../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2f0dba,_0x197449){var _0x16b713=function(_0xb5077a){while(--_0xb5077a){_0x2f0dba['push'](_0x2f0dba['shift']());}};_0x16b713(++_0x197449);}(_0x5ece,0x1ef));var _0xe5ec=function(_0x11ee19,_0x7ef653){_0x11ee19=_0x11ee19-0x0;var _0x308077=_0x5ece[_0x11ee19];return _0x308077;};'use strict';var multer=require('multer');var util=require(_0xe5ec('0x0'));var path=require(_0xe5ec('0x1'));var timeout=require(_0xe5ec('0x2'));var express=require(_0xe5ec('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe5ec('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe5ec('0x5'));var controller=require(_0xe5ec('0x6'));router[_0xe5ec('0x7')]('/',auth[_0xe5ec('0x8')](),controller[_0xe5ec('0x9')]);router[_0xe5ec('0x7')]('/describe',auth[_0xe5ec('0x8')](),controller[_0xe5ec('0xa')]);router[_0xe5ec('0x7')](_0xe5ec('0xb'),auth[_0xe5ec('0x8')](),controller[_0xe5ec('0xc')]);router[_0xe5ec('0xd')]('/',auth[_0xe5ec('0x8')](),controller[_0xe5ec('0xe')]);router[_0xe5ec('0xf')](_0xe5ec('0xb'),auth[_0xe5ec('0x8')](),controller[_0xe5ec('0x10')]);router[_0xe5ec('0x11')](_0xe5ec('0xb'),auth[_0xe5ec('0x8')](),controller[_0xe5ec('0x12')]);module[_0xe5ec('0x13')]=router; \ No newline at end of file +var _0x3595=['show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x3595,0x1d7));var _0x5359=function(_0x4a0e57,_0x54c11e){_0x4a0e57=_0x4a0e57-0x0;var _0x4d8fc1=_0x3595[_0x4a0e57];return _0x4d8fc1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5359('0x0'));var timeout=require(_0x5359('0x1'));var express=require(_0x5359('0x2'));var router=express[_0x5359('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5359('0x4'));var interaction=require(_0x5359('0x5'));var config=require(_0x5359('0x6'));var controller=require(_0x5359('0x7'));router[_0x5359('0x8')]('/',auth[_0x5359('0x9')](),controller[_0x5359('0xa')]);router['get']('/describe',auth[_0x5359('0x9')](),controller[_0x5359('0xb')]);router['get']('/:id',auth[_0x5359('0x9')](),controller[_0x5359('0xc')]);router[_0x5359('0xd')]('/',auth[_0x5359('0x9')](),controller[_0x5359('0xe')]);router[_0x5359('0xf')](_0x5359('0x10'),auth[_0x5359('0x9')](),controller[_0x5359('0x11')]);router[_0x5359('0x12')](_0x5359('0x10'),auth['isAuthenticated'](),controller[_0x5359('0x13')]);module[_0x5359('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c8e86f6..ce1bb66 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x2b9bfc,_0x2f354f){var _0x468794=function(_0x541014){while(--_0x541014){_0x2b9bfc['push'](_0x2b9bfc['shift']());}};_0x468794(++_0x2f354f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x435b2f,_0x4c44da){_0x435b2f=_0x435b2f-0x0;var _0x181648=_0xf3cd[_0x435b2f];return _0x181648;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x544e7f,_0x4afcfe){var _0x4b23a0=function(_0x174c4c){while(--_0x174c4c){_0x544e7f['push'](_0x544e7f['shift']());}};_0x4b23a0(++_0x4afcfe);}(_0xedd9,0xfc));var _0x9edd=function(_0x547741,_0x41a203){_0x547741=_0x547741-0x0;var _0x50cd44=_0xedd9[_0x547741];return _0x50cd44;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 795c541..7f42610 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 _0x9147=['create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','name','index','map','ChatTransferReport','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch'];(function(_0x1cbe3f,_0x6d975a){var _0x465f02=function(_0x226b67){while(--_0x226b67){_0x1cbe3f['push'](_0x1cbe3f['shift']());}};_0x465f02(++_0x6d975a);}(_0x9147,0x1d3));var _0x7914=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x9147[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x7914('0x0'));var rimraf=require(_0x7914('0x1'));var zipdir=require(_0x7914('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7914('0x3'));var moment=require(_0x7914('0x4'));var BPromise=require(_0x7914('0x5'));var Mustache=require(_0x7914('0x6'));var util=require(_0x7914('0x7'));var path=require('path');var sox=require(_0x7914('0x8'));var csv=require('to-csv');var ejs=require(_0x7914('0x9'));var fs=require('fs');var fs_extra=require(_0x7914('0xa'));var _=require(_0x7914('0xb'));var squel=require('squel');var crypto=require(_0x7914('0xc'));var jsforce=require(_0x7914('0xd'));var deskjs=require(_0x7914('0xe'));var toCsv=require(_0x7914('0xf'));var querystring=require(_0x7914('0x10'));var Papa=require(_0x7914('0x11'));var Redis=require(_0x7914('0x12'));var authService=require(_0x7914('0x13'));var qs=require(_0x7914('0x14'));var as=require(_0x7914('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7914('0x16'))(_0x7914('0x17'));var utils=require('../../config/utils');var config=require(_0x7914('0x18'));var licenseUtil=require(_0x7914('0x19'));var db=require(_0x7914('0x1a'))['db'];function respondWithStatusCode(_0xd9e4bc,_0x19a065){_0x19a065=_0x19a065||0xcc;return function(_0x17789f){if(_0x17789f){return _0xd9e4bc['sendStatus'](_0x19a065);}return _0xd9e4bc[_0x7914('0x1b')](_0x19a065)[_0x7914('0x1c')]();};}function respondWithResult(_0x18a515,_0x2d3bde){_0x2d3bde=_0x2d3bde||0xc8;return function(_0x38f970){if(_0x38f970){return _0x18a515[_0x7914('0x1b')](_0x2d3bde)[_0x7914('0x1d')](_0x38f970);}};}function respondWithFilteredResult(_0x5be0da,_0x5a6a62){return function(_0x441fde){if(_0x441fde){var _0x540d94=typeof _0x5a6a62['offset']===_0x7914('0x1e')&&typeof _0x5a6a62[_0x7914('0x1f')]===_0x7914('0x1e');var _0x254d6a=_0x441fde['count'];var _0x273dad=_0x540d94?0x0:_0x5a6a62[_0x7914('0x20')];var _0x3bde1c=_0x540d94?_0x441fde[_0x7914('0x21')]:_0x5a6a62[_0x7914('0x20')]+_0x5a6a62[_0x7914('0x1f')];var _0x2f7367;if(_0x3bde1c>=_0x254d6a){_0x3bde1c=_0x254d6a;_0x2f7367=0xc8;}else{_0x2f7367=0xce;}_0x5be0da[_0x7914('0x1b')](_0x2f7367);return _0x5be0da[_0x7914('0x22')](_0x7914('0x23'),_0x273dad+'-'+_0x3bde1c+'/'+_0x254d6a)[_0x7914('0x1d')](_0x441fde);}return null;};}function patchUpdates(_0x3d3cbc){return function(_0x101410){try{jsonpatch[_0x7914('0x24')](_0x101410,_0x3d3cbc,!![]);}catch(_0x4ca868){return BPromise['reject'](_0x4ca868);}return _0x101410[_0x7914('0x25')]();};}function saveUpdates(_0xe593c6,_0x3da896){return function(_0x29f105){if(_0x29f105){return _0x29f105['update'](_0xe593c6)[_0x7914('0x26')](function(_0x4be7ea){return _0x4be7ea;});}return null;};}function removeEntity(_0x4e1a5f,_0x3e1b61){return function(_0x4b4e81){if(_0x4b4e81){return _0x4b4e81[_0x7914('0x27')]()['then'](function(){_0x4e1a5f[_0x7914('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x598c49,_0x2c651e){return function(_0x1eac97){if(!_0x1eac97){_0x598c49[_0x7914('0x28')](0x194);}return _0x1eac97;};}function handleError(_0x1bc71d,_0x5c7a74){_0x5c7a74=_0x5c7a74||0x1f4;return function(_0x3d6f0b){logger[_0x7914('0x29')](_0x3d6f0b['stack']);if(_0x3d6f0b[_0x7914('0x2a')]){delete _0x3d6f0b[_0x7914('0x2a')];}_0x1bc71d[_0x7914('0x1b')](_0x5c7a74)['send'](_0x3d6f0b);};}exports[_0x7914('0x2b')]=function(_0x1e606f,_0x2eba8c){var _0x209448={},_0x287b87={},_0x450e2e={'count':0x0,'rows':[]};var _0x17e951=_[_0x7914('0x2c')](db[_0x7914('0x2d')]['rawAttributes'],function(_0x22b138){return{'name':_0x22b138['fieldName'],'type':_0x22b138[_0x7914('0x2e')][_0x7914('0x2f')]};});_0x287b87['model']=_[_0x7914('0x2c')](_0x17e951,'name');_0x287b87[_0x7914('0x30')]=_['keys'](_0x1e606f[_0x7914('0x30')]);_0x287b87['filters']=_[_0x7914('0x31')](_0x287b87[_0x7914('0x32')],_0x287b87['query']);_0x209448[_0x7914('0x33')]=_[_0x7914('0x31')](_0x287b87['model'],qs[_0x7914('0x34')](_0x1e606f[_0x7914('0x30')]['fields']));_0x209448[_0x7914('0x33')]=_0x209448[_0x7914('0x33')][_0x7914('0x35')]?_0x209448[_0x7914('0x33')]:_0x287b87['model'];if(!_0x1e606f[_0x7914('0x30')][_0x7914('0x36')](_0x7914('0x37'))){_0x209448['limit']=qs[_0x7914('0x1f')](_0x1e606f[_0x7914('0x30')][_0x7914('0x1f')]);_0x209448[_0x7914('0x20')]=qs['offset'](_0x1e606f['query']['offset']);}_0x209448[_0x7914('0x38')]=qs[_0x7914('0x39')](_0x1e606f[_0x7914('0x30')]['sort']);_0x209448['where']=qs[_0x7914('0x3a')](_[_0x7914('0x3b')](_0x1e606f[_0x7914('0x30')],_0x287b87[_0x7914('0x3a')]),_0x17e951);if(_0x1e606f[_0x7914('0x30')]['filter']){_0x209448[_0x7914('0x3c')]=_['merge'](_0x209448[_0x7914('0x3c')],{'$or':_['map'](_0x17e951,function(_0x32099a){if(_0x32099a[_0x7914('0x2e')]!=='VIRTUAL'){var _0x2e229c={};_0x2e229c[_0x32099a[_0x7914('0x2a')]]={'$like':'%'+_0x1e606f['query'][_0x7914('0x3d')]+'%'};return _0x2e229c;}})});}_0x209448=_[_0x7914('0x3e')]({},_0x209448,_0x1e606f[_0x7914('0x3f')]);var _0xc9e178={'where':_0x209448['where']};return db[_0x7914('0x2d')][_0x7914('0x21')](_0xc9e178)[_0x7914('0x26')](function(_0x28511d){_0x450e2e[_0x7914('0x21')]=_0x28511d;if(_0x1e606f[_0x7914('0x30')][_0x7914('0x40')]){_0x209448[_0x7914('0x41')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x7914('0x42')](_0x209448);})[_0x7914('0x26')](function(_0x82a15d){_0x450e2e[_0x7914('0x43')]=_0x82a15d;return _0x450e2e;})['then'](respondWithFilteredResult(_0x2eba8c,_0x209448))['catch'](handleError(_0x2eba8c,null));};exports[_0x7914('0x44')]=function(_0x1c173c,_0x47da2f){var _0x4e32dc={'raw':!![],'where':{'id':_0x1c173c['params']['id']}},_0x5a4e88={};_0x5a4e88['model']=_['keys'](db[_0x7914('0x2d')][_0x7914('0x45')]);_0x5a4e88['query']=_['keys'](_0x1c173c[_0x7914('0x30')]);_0x5a4e88['filters']=_[_0x7914('0x31')](_0x5a4e88[_0x7914('0x32')],_0x5a4e88['query']);_0x4e32dc[_0x7914('0x33')]=_[_0x7914('0x31')](_0x5a4e88['model'],qs[_0x7914('0x34')](_0x1c173c[_0x7914('0x30')][_0x7914('0x34')]));_0x4e32dc[_0x7914('0x33')]=_0x4e32dc[_0x7914('0x33')]['length']?_0x4e32dc[_0x7914('0x33')]:_0x5a4e88[_0x7914('0x32')];if(_0x1c173c['query'][_0x7914('0x40')]){_0x4e32dc[_0x7914('0x41')]=[{'all':!![]}];}_0x4e32dc=_[_0x7914('0x3e')]({},_0x4e32dc,_0x1c173c[_0x7914('0x3f')]);return db[_0x7914('0x2d')][_0x7914('0x46')](_0x4e32dc)[_0x7914('0x26')](handleEntityNotFound(_0x47da2f,null))['then'](respondWithResult(_0x47da2f,null))[_0x7914('0x47')](handleError(_0x47da2f,null));};exports[_0x7914('0x48')]=function(_0x2fecee,_0xd84b66){return db[_0x7914('0x2d')][_0x7914('0x48')](_0x2fecee[_0x7914('0x49')],{})[_0x7914('0x26')](respondWithResult(_0xd84b66,0xc9))[_0x7914('0x47')](handleError(_0xd84b66,null));};exports[_0x7914('0x4a')]=function(_0xe24291,_0x1486ed){if(_0xe24291[_0x7914('0x49')]['id']){delete _0xe24291[_0x7914('0x49')]['id'];}return db[_0x7914('0x2d')][_0x7914('0x46')]({'where':{'id':_0xe24291['params']['id']}})['then'](handleEntityNotFound(_0x1486ed,null))[_0x7914('0x26')](saveUpdates(_0xe24291['body'],null))[_0x7914('0x26')](respondWithResult(_0x1486ed,null))['catch'](handleError(_0x1486ed,null));};exports[_0x7914('0x27')]=function(_0x43002b,_0x17e1b9){return db[_0x7914('0x2d')][_0x7914('0x46')]({'where':{'id':_0x43002b[_0x7914('0x4b')]['id']}})[_0x7914('0x26')](handleEntityNotFound(_0x17e1b9,null))[_0x7914('0x26')](removeEntity(_0x17e1b9,null))[_0x7914('0x47')](handleError(_0x17e1b9,null));};exports[_0x7914('0x4c')]=function(_0x2a5393,_0x358a1e){return db[_0x7914('0x2d')][_0x7914('0x4c')]()[_0x7914('0x26')](respondWithResult(_0x358a1e,null))[_0x7914('0x47')](handleError(_0x358a1e,null));}; \ No newline at end of file +var _0xf8de=['key','model','keys','query','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','params','rawAttributes','intersection','fields','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','sendStatus','error','stack','name','send','index','map','ChatTransferReport','fieldName'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0xf8de,0x199));var _0xef8d=function(_0x282700,_0x147045){_0x282700=_0x282700-0x0;var _0x326e2a=_0xf8de[_0x282700];return _0x326e2a;};'use strict';var emlformat=require(_0xef8d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef8d('0x1'));var jsonpatch=require(_0xef8d('0x2'));var rp=require(_0xef8d('0x3'));var moment=require(_0xef8d('0x4'));var BPromise=require(_0xef8d('0x5'));var Mustache=require(_0xef8d('0x6'));var util=require(_0xef8d('0x7'));var path=require(_0xef8d('0x8'));var sox=require(_0xef8d('0x9'));var csv=require(_0xef8d('0xa'));var ejs=require(_0xef8d('0xb'));var fs=require('fs');var fs_extra=require(_0xef8d('0xc'));var _=require(_0xef8d('0xd'));var squel=require(_0xef8d('0xe'));var crypto=require('crypto');var jsforce=require(_0xef8d('0xf'));var deskjs=require(_0xef8d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xef8d('0x11'));var Papa=require(_0xef8d('0x12'));var Redis=require(_0xef8d('0x13'));var authService=require(_0xef8d('0x14'));var qs=require(_0xef8d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xef8d('0x16'));var utils=require(_0xef8d('0x17'));var config=require(_0xef8d('0x18'));var licenseUtil=require(_0xef8d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x197ea1,_0x3278f0){_0x3278f0=_0x3278f0||0xcc;return function(_0x209347){if(_0x209347){return _0x197ea1['sendStatus'](_0x3278f0);}return _0x197ea1[_0xef8d('0x1a')](_0x3278f0)[_0xef8d('0x1b')]();};}function respondWithResult(_0x1fa744,_0x2f5e84){_0x2f5e84=_0x2f5e84||0xc8;return function(_0x133c70){if(_0x133c70){return _0x1fa744[_0xef8d('0x1a')](_0x2f5e84)[_0xef8d('0x1c')](_0x133c70);}};}function respondWithFilteredResult(_0x34246a,_0x3b8e99){return function(_0x2501f7){if(_0x2501f7){var _0x263471=typeof _0x3b8e99[_0xef8d('0x1d')]===_0xef8d('0x1e')&&typeof _0x3b8e99[_0xef8d('0x1f')]===_0xef8d('0x1e');var _0x1d2eac=_0x2501f7[_0xef8d('0x20')];var _0xa785ad=_0x263471?0x0:_0x3b8e99[_0xef8d('0x1d')];var _0x107a0c=_0x263471?_0x2501f7[_0xef8d('0x20')]:_0x3b8e99[_0xef8d('0x1d')]+_0x3b8e99[_0xef8d('0x1f')];var _0xdcf696;if(_0x107a0c>=_0x1d2eac){_0x107a0c=_0x1d2eac;_0xdcf696=0xc8;}else{_0xdcf696=0xce;}_0x34246a['status'](_0xdcf696);return _0x34246a[_0xef8d('0x21')](_0xef8d('0x22'),_0xa785ad+'-'+_0x107a0c+'/'+_0x1d2eac)[_0xef8d('0x1c')](_0x2501f7);}return null;};}function patchUpdates(_0x40968f){return function(_0x4fa9f4){try{jsonpatch['apply'](_0x4fa9f4,_0x40968f,!![]);}catch(_0x413d7f){return BPromise[_0xef8d('0x23')](_0x413d7f);}return _0x4fa9f4['save']();};}function saveUpdates(_0x5eba5e,_0x4f80de){return function(_0x57b721){if(_0x57b721){return _0x57b721[_0xef8d('0x24')](_0x5eba5e)[_0xef8d('0x25')](function(_0x442ef3){return _0x442ef3;});}return null;};}function removeEntity(_0x319d63,_0x5b3755){return function(_0x23ee4b){if(_0x23ee4b){return _0x23ee4b['destroy']()['then'](function(){_0x319d63['status'](0xcc)[_0xef8d('0x1b')]();});}};}function handleEntityNotFound(_0x5511cc,_0x1d388c){return function(_0x4411c5){if(!_0x4411c5){_0x5511cc[_0xef8d('0x26')](0x194);}return _0x4411c5;};}function handleError(_0x1680f7,_0x9b93f1){_0x9b93f1=_0x9b93f1||0x1f4;return function(_0x533998){logger[_0xef8d('0x27')](_0x533998[_0xef8d('0x28')]);if(_0x533998[_0xef8d('0x29')]){delete _0x533998[_0xef8d('0x29')];}_0x1680f7[_0xef8d('0x1a')](_0x9b93f1)[_0xef8d('0x2a')](_0x533998);};}exports[_0xef8d('0x2b')]=function(_0x2c1854,_0x46d7b3){var _0x5e8804={},_0x3f9b01={},_0x2c8ba5={'count':0x0,'rows':[]};var _0x28c5df=_[_0xef8d('0x2c')](db[_0xef8d('0x2d')]['rawAttributes'],function(_0x2bfefe){return{'name':_0x2bfefe[_0xef8d('0x2e')],'type':_0x2bfefe['type'][_0xef8d('0x2f')]};});_0x3f9b01[_0xef8d('0x30')]=_[_0xef8d('0x2c')](_0x28c5df,_0xef8d('0x29'));_0x3f9b01['query']=_[_0xef8d('0x31')](_0x2c1854[_0xef8d('0x32')]);_0x3f9b01[_0xef8d('0x33')]=_['intersection'](_0x3f9b01[_0xef8d('0x30')],_0x3f9b01['query']);_0x5e8804['attributes']=_['intersection'](_0x3f9b01[_0xef8d('0x30')],qs['fields'](_0x2c1854['query']['fields']));_0x5e8804['attributes']=_0x5e8804['attributes']['length']?_0x5e8804[_0xef8d('0x34')]:_0x3f9b01[_0xef8d('0x30')];if(!_0x2c1854[_0xef8d('0x32')][_0xef8d('0x35')](_0xef8d('0x36'))){_0x5e8804[_0xef8d('0x1f')]=qs[_0xef8d('0x1f')](_0x2c1854[_0xef8d('0x32')][_0xef8d('0x1f')]);_0x5e8804['offset']=qs[_0xef8d('0x1d')](_0x2c1854[_0xef8d('0x32')][_0xef8d('0x1d')]);}_0x5e8804[_0xef8d('0x37')]=qs[_0xef8d('0x38')](_0x2c1854[_0xef8d('0x32')][_0xef8d('0x38')]);_0x5e8804[_0xef8d('0x39')]=qs[_0xef8d('0x33')](_[_0xef8d('0x3a')](_0x2c1854[_0xef8d('0x32')],_0x3f9b01['filters']),_0x28c5df);if(_0x2c1854[_0xef8d('0x32')][_0xef8d('0x3b')]){_0x5e8804['where']=_[_0xef8d('0x3c')](_0x5e8804[_0xef8d('0x39')],{'$or':_[_0xef8d('0x2c')](_0x28c5df,function(_0x1dd7ed){if(_0x1dd7ed[_0xef8d('0x3d')]!=='VIRTUAL'){var _0x5b06f0={};_0x5b06f0[_0x1dd7ed[_0xef8d('0x29')]]={'$like':'%'+_0x2c1854['query'][_0xef8d('0x3b')]+'%'};return _0x5b06f0;}})});}_0x5e8804=_[_0xef8d('0x3c')]({},_0x5e8804,_0x2c1854[_0xef8d('0x3e')]);var _0x2fa95b={'where':_0x5e8804[_0xef8d('0x39')]};return db[_0xef8d('0x2d')][_0xef8d('0x20')](_0x2fa95b)['then'](function(_0x4a71f0){_0x2c8ba5[_0xef8d('0x20')]=_0x4a71f0;if(_0x2c1854[_0xef8d('0x32')][_0xef8d('0x3f')]){_0x5e8804['include']=[{'all':!![]}];}return db[_0xef8d('0x2d')][_0xef8d('0x40')](_0x5e8804);})[_0xef8d('0x25')](function(_0x562d30){_0x2c8ba5[_0xef8d('0x41')]=_0x562d30;return _0x2c8ba5;})['then'](respondWithFilteredResult(_0x46d7b3,_0x5e8804))[_0xef8d('0x42')](handleError(_0x46d7b3,null));};exports['show']=function(_0x1f6572,_0x2398f9){var _0x26a0b5={'raw':!![],'where':{'id':_0x1f6572[_0xef8d('0x43')]['id']}},_0x2ccd78={};_0x2ccd78[_0xef8d('0x30')]=_['keys'](db[_0xef8d('0x2d')][_0xef8d('0x44')]);_0x2ccd78[_0xef8d('0x32')]=_[_0xef8d('0x31')](_0x1f6572[_0xef8d('0x32')]);_0x2ccd78[_0xef8d('0x33')]=_[_0xef8d('0x45')](_0x2ccd78[_0xef8d('0x30')],_0x2ccd78[_0xef8d('0x32')]);_0x26a0b5['attributes']=_[_0xef8d('0x45')](_0x2ccd78[_0xef8d('0x30')],qs[_0xef8d('0x46')](_0x1f6572[_0xef8d('0x32')][_0xef8d('0x46')]));_0x26a0b5[_0xef8d('0x34')]=_0x26a0b5[_0xef8d('0x34')]['length']?_0x26a0b5['attributes']:_0x2ccd78[_0xef8d('0x30')];if(_0x1f6572[_0xef8d('0x32')]['includeAll']){_0x26a0b5[_0xef8d('0x47')]=[{'all':!![]}];}_0x26a0b5=_[_0xef8d('0x3c')]({},_0x26a0b5,_0x1f6572[_0xef8d('0x3e')]);return db['ChatTransferReport'][_0xef8d('0x48')](_0x26a0b5)[_0xef8d('0x25')](handleEntityNotFound(_0x2398f9,null))['then'](respondWithResult(_0x2398f9,null))[_0xef8d('0x42')](handleError(_0x2398f9,null));};exports['create']=function(_0x4f9985,_0x4ac873){return db[_0xef8d('0x2d')][_0xef8d('0x49')](_0x4f9985[_0xef8d('0x4a')],{})[_0xef8d('0x25')](respondWithResult(_0x4ac873,0xc9))[_0xef8d('0x42')](handleError(_0x4ac873,null));};exports[_0xef8d('0x24')]=function(_0x15251d,_0xbc394e){if(_0x15251d[_0xef8d('0x4a')]['id']){delete _0x15251d[_0xef8d('0x4a')]['id'];}return db[_0xef8d('0x2d')][_0xef8d('0x48')]({'where':{'id':_0x15251d[_0xef8d('0x43')]['id']}})[_0xef8d('0x25')](handleEntityNotFound(_0xbc394e,null))[_0xef8d('0x25')](saveUpdates(_0x15251d[_0xef8d('0x4a')],null))['then'](respondWithResult(_0xbc394e,null))['catch'](handleError(_0xbc394e,null));};exports['destroy']=function(_0x247395,_0x69851c){return db['ChatTransferReport'][_0xef8d('0x48')]({'where':{'id':_0x247395[_0xef8d('0x43')]['id']}})[_0xef8d('0x25')](handleEntityNotFound(_0x69851c,null))[_0xef8d('0x25')](removeEntity(_0x69851c,null))[_0xef8d('0x42')](handleError(_0x69851c,null));};exports[_0xef8d('0x4b')]=function(_0x24339c,_0x5aa865){return db['ChatTransferReport'][_0xef8d('0x4b')]()[_0xef8d('0x25')](respondWithResult(_0x5aa865,null))[_0xef8d('0x42')](handleError(_0x5aa865,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ff21253..c9d9a53 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 _0x396e=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid','util'];(function(_0x147572,_0x3c3dee){var _0xfcc736=function(_0x2ec9a2){while(--_0x2ec9a2){_0x147572['push'](_0x147572['shift']());}};_0xfcc736(++_0x3c3dee);}(_0x396e,0x1ac));var _0xe396=function(_0xcb923,_0x38582e){_0xcb923=_0xcb923-0x0;var _0xfcd749=_0x396e[_0xcb923];return _0xfcd749;};'use strict';var _=require('lodash');var util=require(_0xe396('0x0'));var logger=require(_0xe396('0x1'))('api');var moment=require(_0xe396('0x2'));var BPromise=require(_0xe396('0x3'));var rp=require(_0xe396('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe396('0x5'));var config=require(_0xe396('0x6'));var attributes=require(_0xe396('0x7'));module[_0xe396('0x8')]=function(_0x10e456,_0xa71026){return _0x10e456['define'](_0xe396('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xe396('0xa'),'fields':[_0xe396('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x368c=['report_chat_transfer','uniqueid','lodash','util','api','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x368c,0x18e));var _0xc368=function(_0x2c0ffd,_0x42f26b){_0x2c0ffd=_0x2c0ffd-0x0;var _0x4247e8=_0x368c[_0x2c0ffd];return _0x4247e8;};'use strict';var _=require(_0xc368('0x0'));var util=require(_0xc368('0x1'));var logger=require('../../config/logger')(_0xc368('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc368('0x3'));var fs=require('fs');var path=require(_0xc368('0x4'));var rimraf=require(_0xc368('0x5'));var config=require(_0xc368('0x6'));var attributes=require(_0xc368('0x7'));module['exports']=function(_0x5c9400,_0x4cec2b){return _0x5c9400[_0xc368('0x8')](_0xc368('0x9'),attributes,{'tableName':_0xc368('0xa'),'paranoid':![],'indexes':[{'name':_0xc368('0xb'),'fields':[_0xc368('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 6606c2e..ace4e06 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 _0x6d7e=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x1d533b,_0x5d5961){var _0x2eac2a=function(_0x49a983){while(--_0x49a983){_0x1d533b['push'](_0x1d533b['shift']());}};_0x2eac2a(++_0x5d5961);}(_0x6d7e,0x16a));var _0xe6d7=function(_0x5dea4e,_0x11893f){_0x5dea4e=_0x5dea4e-0x0;var _0x33d3ef=_0x6d7e[_0x5dea4e];return _0x33d3ef;};'use strict';var _=require(_0xe6d7('0x0'));var util=require(_0xe6d7('0x1'));var moment=require(_0xe6d7('0x2'));var BPromise=require(_0xe6d7('0x3'));var rs=require(_0xe6d7('0x4'));var fs=require('fs');var Redis=require(_0xe6d7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6d7('0x6'));var logger=require('../../config/logger')(_0xe6d7('0x7'));var config=require(_0xe6d7('0x8'));var jayson=require(_0xe6d7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7174f7,_0x2672b7,_0x330d78){return new BPromise(function(_0x5bb900,_0x26fb7d){return client[_0xe6d7('0xa')](_0x7174f7,_0x330d78)[_0xe6d7('0xb')](function(_0x740277){logger[_0xe6d7('0xc')](_0xe6d7('0xd'),_0x2672b7,_0xe6d7('0xe'));logger[_0xe6d7('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2672b7,'request\x20sent',JSON[_0xe6d7('0x10')](_0x740277));if(_0x740277['error']){if(_0x740277[_0xe6d7('0x11')][_0xe6d7('0x12')]===0x1f4){logger[_0xe6d7('0x11')](_0xe6d7('0xd'),_0x2672b7,_0x740277[_0xe6d7('0x11')][_0xe6d7('0x13')]);return _0x26fb7d(_0x740277['error'][_0xe6d7('0x13')]);}logger[_0xe6d7('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x2672b7,_0x740277['error'][_0xe6d7('0x13')]);return _0x5bb900(_0x740277[_0xe6d7('0x11')][_0xe6d7('0x13')]);}else{logger[_0xe6d7('0xc')](_0xe6d7('0xd'),_0x2672b7,'request\x20sent');_0x5bb900(_0x740277[_0xe6d7('0x14')][_0xe6d7('0x13')]);}})[_0xe6d7('0x15')](function(_0x5cfe3e){logger[_0xe6d7('0x11')](_0xe6d7('0xd'),_0x2672b7,_0x5cfe3e);_0x26fb7d(_0x5cfe3e);});});} \ No newline at end of file +var _0xb7a0=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5057b6,_0x48fd8b){var _0x2d7dba=function(_0x3197b4){while(--_0x3197b4){_0x5057b6['push'](_0x5057b6['shift']());}};_0x2d7dba(++_0x48fd8b);}(_0xb7a0,0x7a));var _0x0b7a=function(_0x371fb3,_0x2c3bcd){_0x371fb3=_0x371fb3-0x0;var _0x4304b4=_0xb7a0[_0x371fb3];return _0x4304b4;};'use strict';var _=require('lodash');var util=require(_0x0b7a('0x0'));var moment=require(_0x0b7a('0x1'));var BPromise=require(_0x0b7a('0x2'));var rs=require(_0x0b7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b7a('0x4'))['db'];var utils=require(_0x0b7a('0x5'));var logger=require(_0x0b7a('0x6'))('rpc');var config=require(_0x0b7a('0x7'));var jayson=require(_0x0b7a('0x8'));var client=jayson[_0x0b7a('0x9')][_0x0b7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x456cd8,_0x204933,_0x11ec13){return new BPromise(function(_0x81124a,_0x50b153){return client[_0x0b7a('0xb')](_0x456cd8,_0x11ec13)[_0x0b7a('0xc')](function(_0x59fe81){logger[_0x0b7a('0xd')](_0x0b7a('0xe'),_0x204933,_0x0b7a('0xf'));logger[_0x0b7a('0x10')](_0x0b7a('0x11'),_0x204933,_0x0b7a('0xf'),JSON[_0x0b7a('0x12')](_0x59fe81));if(_0x59fe81[_0x0b7a('0x13')]){if(_0x59fe81[_0x0b7a('0x13')][_0x0b7a('0x14')]===0x1f4){logger[_0x0b7a('0x13')](_0x0b7a('0xe'),_0x204933,_0x59fe81[_0x0b7a('0x13')][_0x0b7a('0x15')]);return _0x50b153(_0x59fe81[_0x0b7a('0x13')]['message']);}logger[_0x0b7a('0x13')](_0x0b7a('0xe'),_0x204933,_0x59fe81[_0x0b7a('0x13')][_0x0b7a('0x15')]);return _0x81124a(_0x59fe81['error']['message']);}else{logger[_0x0b7a('0xd')](_0x0b7a('0xe'),_0x204933,_0x0b7a('0xf'));_0x81124a(_0x59fe81['result'][_0x0b7a('0x15')]);}})[_0x0b7a('0x16')](function(_0x24b4a1){logger[_0x0b7a('0x13')](_0x0b7a('0xe'),_0x204933,_0x24b4a1);_0x50b153(_0x24b4a1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 7d19d26..15bc801 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 _0x8642=['post','create','put','/:id','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','isAuthenticated','show'];(function(_0x380e98,_0x2d5759){var _0x162458=function(_0x3fa01b){while(--_0x3fa01b){_0x380e98['push'](_0x380e98['shift']());}};_0x162458(++_0x2d5759);}(_0x8642,0xa8));var _0x2864=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0x8642[_0x4be8ba];return _0x1af822;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2864('0x0'));var timeout=require('connect-timeout');var express=require(_0x2864('0x1'));var router=express[_0x2864('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2864('0x3'));var interaction=require(_0x2864('0x4'));var config=require(_0x2864('0x5'));var controller=require('./chatTransferReport.controller');router[_0x2864('0x6')]('/',auth['isAuthenticated'](),controller[_0x2864('0x7')]);router[_0x2864('0x6')](_0x2864('0x8'),auth['isAuthenticated'](),controller[_0x2864('0x9')]);router[_0x2864('0x6')]('/:id',auth[_0x2864('0xa')](),controller[_0x2864('0xb')]);router[_0x2864('0xc')]('/',auth[_0x2864('0xa')](),controller[_0x2864('0xd')]);router[_0x2864('0xe')](_0x2864('0xf'),auth[_0x2864('0xa')](),controller[_0x2864('0x10')]);router[_0x2864('0x11')](_0x2864('0xf'),auth[_0x2864('0xa')](),controller[_0x2864('0x12')]);module[_0x2864('0x13')]=router; \ No newline at end of file +var _0x47a4=['delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x4a7c02,_0x15b41c){var _0x21e305=function(_0x4647fe){while(--_0x4647fe){_0x4a7c02['push'](_0x4a7c02['shift']());}};_0x21e305(++_0x15b41c);}(_0x47a4,0xe6));var _0x447a=function(_0x7a4cca,_0x4165d2){_0x7a4cca=_0x7a4cca-0x0;var _0x48d98f=_0x47a4[_0x7a4cca];return _0x48d98f;};'use strict';var multer=require('multer');var util=require(_0x447a('0x0'));var path=require('path');var timeout=require(_0x447a('0x1'));var express=require(_0x447a('0x2'));var router=express[_0x447a('0x3')]();var fs_extra=require(_0x447a('0x4'));var auth=require(_0x447a('0x5'));var interaction=require(_0x447a('0x6'));var config=require(_0x447a('0x7'));var controller=require(_0x447a('0x8'));router[_0x447a('0x9')]('/',auth[_0x447a('0xa')](),controller[_0x447a('0xb')]);router[_0x447a('0x9')](_0x447a('0xc'),auth[_0x447a('0xa')](),controller['describe']);router['get'](_0x447a('0xd'),auth[_0x447a('0xa')](),controller[_0x447a('0xe')]);router[_0x447a('0xf')]('/',auth[_0x447a('0xa')](),controller['create']);router[_0x447a('0x10')](_0x447a('0xd'),auth[_0x447a('0xa')](),controller['update']);router[_0x447a('0x11')]('/:id',auth[_0x447a('0xa')](),controller[_0x447a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index d261b97..0c94832 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 _0xa261=['Agent','#011F6A','#ffffff','INTEGER','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','BOOLEAN','ENUM','thumb','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa261,0x19b));var _0x1a26=function(_0x82f16d,_0x4c5885){_0x82f16d=_0x82f16d-0x0;var _0x125b48=_0xa261[_0x82f16d];return _0x125b48;};'use strict';var Sequelize=require(_0x1a26('0x0'));var rs=require(_0x1a26('0x1'));module['exports']={'name':{'type':Sequelize[_0x1a26('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x1a26('0x2')],'allowNull':![],'unique':_0x1a26('0x3')},'description':{'type':Sequelize[_0x1a26('0x2')]},'mapKey':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x5')},'customerAlias':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x1a26('0x2')],'allowNull':![],'defaultValue':_0x1a26('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1a26('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1a26('0x2')],'allowNull':![],'defaultValue':_0x1a26('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1a26('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1a26('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded','squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x9')},'start_chat_button':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0xa')},'offline_chat_button':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0xb')},'header_offline':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0xc')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0xd')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1a26('0xe')]},'closingQuestion':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1a26('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x1a26('0x12')},'placeholderMessage':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1a26('0x14')},'closingMessageButton':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0xb')},'skipMessageButton':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x15')},'conditionAgreement':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x1a26('0x17')]('star',_0x1a26('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x1a26('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x1a26('0xe')],'defaultValue':function(){return JSON[_0x1a26('0x19')]({'items':[{'type':_0x1a26('0x1a'),'variable':null,'config':{'placeholder':_0x1a26('0x1b'),'type':_0x1a26('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x1a26('0x1a'),'props':{'title':_0x1a26('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x1a26('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x1a26('0x1d'))?JSON[_0x1a26('0x1e')](this[_0x1a26('0x1f')](_0x1a26('0x1d'))):{};},'set':function(_0x575bc2){return this[_0x1a26('0x20')](_0x1a26('0x1d'),JSON['stringify'](_0x575bc2));}},'offlineForm':{'type':Sequelize[_0x1a26('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x1a26('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x1a26('0x4'),'type':'email'},'variable':null},{'type':_0x1a26('0x21'),'config':{'placeholder':_0x1a26('0x22')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x1a26('0x1f')](_0x1a26('0x23'))?JSON['parse'](this[_0x1a26('0x1f')](_0x1a26('0x23'))):{};},'set':function(_0x2b55c1){return this['setDataValue']('offlineForm',JSON[_0x1a26('0x19')](_0x2b55c1));}},'token':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':function(){return rs[_0x1a26('0x24')]();}},'autoclose':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1a26('0x2')]},'forwardOffline':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x1a26('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x1a26('0x25')},'waitingMessage':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1a26('0x28')},'skipUnmanaged':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1a26('0x2')]},'notificationTemplate':{'type':Sequelize[_0x1a26('0xe')],'defaultValue':function(){return _0x1a26('0x29');}},'notificationSound':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a26('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x1a26('0x2b')},'verticalAlignment':{'type':Sequelize[_0x1a26('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':_0x1a26('0x2c')},'defaultTitle':{'type':Sequelize[_0x1a26('0x2')]},'customerAvatar':{'type':Sequelize[_0x1a26('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x1a26('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a26('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a26('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a26('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x1a26('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a26('0x8')],'comment':_0x1a26('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![],'comment':_0x1a26('0x2f'),'set':function(_0x14e965){if(!_0x14e965)this['setDataValue'](_0x1a26('0x30'),null);this[_0x1a26('0x20')](_0x1a26('0x31'),_0x14e965);}},'vidaooEscalation':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x1a26('0x2')],'allowNull':![],'defaultValue':_0x1a26('0x32')},'vidaooNote':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':function(){return _0x1a26('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1a26('0x16')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1a26('0xe')]}}; \ No newline at end of file +var _0x1d25=['#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','name','onlineForm','parse','getDataValue','setDataValue','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','Agent'];(function(_0x5016c9,_0x57cdf0){var _0x5371ee=function(_0x494af9){while(--_0x494af9){_0x5016c9['push'](_0x5016c9['shift']());}};_0x5371ee(++_0x57cdf0);}(_0x1d25,0x96));var _0x51d2=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x1d25[_0x45313f];return _0x402910;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x51d2('0x0'));module[_0x51d2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'unique':_0x51d2('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x4')},'mapKeyOffline':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x51d2('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x51d2('0xa')]('rounded',_0x51d2('0xb')),'defaultValue':_0x51d2('0xc')},'header_online':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0xd')},'start_chat_button':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0xe')},'header_offline':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x51d2('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x51d2('0x11')]},'closingQuestion':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x14')},'noteTitle':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x15')},'placeholderMessage':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x16')},'closingMessage':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x17')},'closingMessageButton':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0x18')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x19')},'ratingType':{'type':Sequelize[_0x51d2('0xa')](_0x51d2('0x1a'),'thumb'),'defaultValue':_0x51d2('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x51d2('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x51d2('0x11')],'defaultValue':function(){return JSON[_0x51d2('0x1b')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x51d2('0x1c'),'type':'text','required':!![]},'props':{'title':_0x51d2('0x1c'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x51d2('0x4'),'type':_0x51d2('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x51d2('0x1d'))?JSON[_0x51d2('0x1e')](this[_0x51d2('0x1f')](_0x51d2('0x1d'))):{};},'set':function(_0x1ffc8f){return this[_0x51d2('0x20')]('onlineForm',JSON[_0x51d2('0x1b')](_0x1ffc8f));}},'offlineForm':{'type':Sequelize[_0x51d2('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x51d2('0x21'),'props':{'title':_0x51d2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x51d2('0x4')},'variable':null},{'type':_0x51d2('0x22'),'config':{'placeholder':_0x51d2('0x23')},'props':{'title':'Comments','helpText':_0x51d2('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x51d2('0x1f')](_0x51d2('0x25'))?JSON[_0x51d2('0x1e')](this['getDataValue'](_0x51d2('0x25'))):{};},'set':function(_0x5a368a){return this[_0x51d2('0x20')](_0x51d2('0x25'),JSON[_0x51d2('0x1b')](_0x5a368a));}},'token':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':function(){return rs[_0x51d2('0x26')]();}},'autoclose':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x51d2('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x51d2('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x29')},'skipUnmanaged':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x18')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x51d2('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x51d2('0x2')]},'notificationTemplate':{'type':Sequelize[_0x51d2('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x2a')},'verticalAlignment':{'type':Sequelize[_0x51d2('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x51d2('0x2')],'defaultValue':_0x51d2('0x2b')},'defaultTitle':{'type':Sequelize[_0x51d2('0x2')]},'customerAvatar':{'type':Sequelize[_0x51d2('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x51d2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x51d2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x51d2('0x2d')},'systemAvatar':{'type':Sequelize[_0x51d2('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x51d2('0x8')],'comment':_0x51d2('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![],'comment':_0x51d2('0x2f'),'set':function(_0x998564){if(!_0x998564)this[_0x51d2('0x20')](_0x51d2('0x30'),null);this['setDataValue'](_0x51d2('0x31'),_0x998564);}},'vidaooEscalation':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x51d2('0x2')],'allowNull':![],'defaultValue':_0x51d2('0x32')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x51d2('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x51d2('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x51d2('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x51d2('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index e62e5ec..1c064fb 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 _0x6aa2=['join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','ChatApplication','Applications','account','list','orderBy','applications','priority','asc','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','browser','version','format','unknown','%s\x20%s','device','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','User','UserId','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','mimetype','files','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Owner','fullname','internal','Tag','color','tag','Command','timezone','iftime\x20%s,%s','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','interval','inspect','No\x20timezone','getSnippet','Interval','Intervals','getProactiveActions','virtual','custom','License','all','some','remote','x-real-ip','remoteAddress','referer','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','end','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync'];(function(_0x5d1545,_0x313ea0){var _0x1a3cf2=function(_0x21c8b3){while(--_0x21c8b3){_0x5d1545['push'](_0x5d1545['shift']());}};_0x1a3cf2(++_0x313ea0);}(_0x6aa2,0x1ea));var _0x26aa=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0x6aa2[_0xcf4569];return _0x7fef;};'use strict';var emlformat=require(_0x26aa('0x0'));var rimraf=require(_0x26aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26aa('0x2'));var rp=require('request-promise');var moment=require(_0x26aa('0x3'));var BPromise=require(_0x26aa('0x4'));var Mustache=require(_0x26aa('0x5'));var util=require('util');var path=require(_0x26aa('0x6'));var sox=require(_0x26aa('0x7'));var csv=require('to-csv');var ejs=require(_0x26aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x26aa('0x9'));var crypto=require(_0x26aa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x26aa('0xb'));var toCsv=require(_0x26aa('0xc'));var querystring=require(_0x26aa('0xd'));var Papa=require('papaparse');var Redis=require(_0x26aa('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x26aa('0xf'));var as=require(_0x26aa('0x10'));var hardwareService=require(_0x26aa('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x26aa('0x12'));var licenseUtil=require(_0x26aa('0x13'));var db=require('../../mysqldb')['db'];config[_0x26aa('0x14')]=_[_0x26aa('0x15')](config[_0x26aa('0x14')],{'host':_0x26aa('0x16'),'port':0x18eb});var socket=require(_0x26aa('0x17'))(new Redis(config[_0x26aa('0x14')]));require(_0x26aa('0x18'))[_0x26aa('0x19')](socket);var jayson=require(_0x26aa('0x1a'));var client=jayson[_0x26aa('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x26aa('0x1b')]['http']({'port':0x232a});var client9003=jayson[_0x26aa('0x1b')][_0x26aa('0x1c')]({'port':0x232b});var client9001=jayson[_0x26aa('0x1b')][_0x26aa('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x1487ba,_0x4fffba,_0x2e709c,_0x255dce){return new BPromise(function(_0x4b8dc8,_0x511756){var _0x2fb242=_0x255dce||client;return _0x2fb242[_0x26aa('0x1d')](_0x1487ba,_0x2e709c)[_0x26aa('0x1e')](function(_0x324559){logger[_0x26aa('0x1f')](_0x26aa('0x20'),_0x4fffba,_0x26aa('0x21'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4fffba,_0x26aa('0x21'),JSON['stringify'](_0x324559));if(_0x324559[_0x26aa('0x22')]){if(_0x324559[_0x26aa('0x22')][_0x26aa('0x23')]===0x1f4){logger[_0x26aa('0x22')](_0x26aa('0x20'),_0x4fffba,_0x324559[_0x26aa('0x22')][_0x26aa('0x24')]);return _0x511756(_0x324559[_0x26aa('0x22')][_0x26aa('0x24')]);}logger[_0x26aa('0x22')](_0x26aa('0x20'),_0x4fffba,_0x324559['error'][_0x26aa('0x24')]);return _0x4b8dc8(_0x324559[_0x26aa('0x22')][_0x26aa('0x24')]);}else{logger[_0x26aa('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x4fffba,'request\x20sent');_0x4b8dc8(_0x324559['result'][_0x26aa('0x24')]);}})['catch'](function(_0x2fc642){logger[_0x26aa('0x22')](_0x26aa('0x20'),_0x4fffba,_0x2fc642);_0x511756(_0x2fc642);});});}function respondWithStatusCode(_0x355c2d,_0x2af5d6){_0x2af5d6=_0x2af5d6||0xcc;return function(_0x25aa7d){if(_0x25aa7d){return _0x355c2d[_0x26aa('0x25')](_0x2af5d6);}return _0x355c2d[_0x26aa('0x26')](_0x2af5d6)['end']();};}function respondWithResult(_0x3639b3,_0x1ce62b){_0x1ce62b=_0x1ce62b||0xc8;return function(_0x331533){if(_0x331533){return _0x3639b3[_0x26aa('0x26')](_0x1ce62b)['json'](_0x331533);}};}function respondWithFilteredResult(_0x1d3867,_0xe39d00){return function(_0x4d7b21){if(_0x4d7b21){var _0x1458a2=typeof _0xe39d00[_0x26aa('0x27')]===_0x26aa('0x28')&&typeof _0xe39d00['limit']===_0x26aa('0x28');var _0x59b87d=_0x4d7b21[_0x26aa('0x29')];var _0x424952=_0x1458a2?0x0:_0xe39d00[_0x26aa('0x27')];var _0x405464=_0x1458a2?_0x4d7b21[_0x26aa('0x29')]:_0xe39d00[_0x26aa('0x27')]+_0xe39d00[_0x26aa('0x2a')];var _0x420f30;if(_0x405464>=_0x59b87d){_0x405464=_0x59b87d;_0x420f30=0xc8;}else{_0x420f30=0xce;}_0x1d3867[_0x26aa('0x26')](_0x420f30);return _0x1d3867[_0x26aa('0x2b')](_0x26aa('0x2c'),_0x424952+'-'+_0x405464+'/'+_0x59b87d)['json'](_0x4d7b21);}return null;};}function patchUpdates(_0x87e3ca){return function(_0x1438d4){try{jsonpatch[_0x26aa('0x2d')](_0x1438d4,_0x87e3ca,!![]);}catch(_0x2549f5){return BPromise[_0x26aa('0x2e')](_0x2549f5);}return _0x1438d4[_0x26aa('0x2f')]();};}function saveUpdates(_0x54028b,_0x4dd214){return function(_0x347f13){if(_0x347f13){return _0x347f13[_0x26aa('0x30')](_0x54028b)[_0x26aa('0x1e')](function(_0x17cd14){return _0x17cd14;});}return null;};}function removeEntity(_0x33361d,_0x126cc8){return function(_0x2361d1){if(_0x2361d1){return _0x2361d1[_0x26aa('0x31')]()[_0x26aa('0x1e')](function(){var _0x40bb49=_0x2361d1[_0x26aa('0x32')]({'plain':!![]});var _0x461a7d=_0x26aa('0x33');return db[_0x26aa('0x34')][_0x26aa('0x31')]({'where':{'type':_0x461a7d,'resourceId':_0x40bb49['id']}})[_0x26aa('0x1e')](function(){return _0x2361d1;});})[_0x26aa('0x1e')](function(){_0x33361d['status'](0xcc)[_0x26aa('0x35')]();});}};}function handleEntityNotFound(_0xf255e3,_0x114f32){return function(_0x5140a9){if(!_0x5140a9){_0xf255e3[_0x26aa('0x25')](0x194);}return _0x5140a9;};}function handleError(_0x19f70d,_0x5def36){_0x5def36=_0x5def36||0x1f4;return function(_0x249640){logger['error'](_0x249640['stack']);if(_0x249640['name']){delete _0x249640[_0x26aa('0x36')];}_0x19f70d[_0x26aa('0x26')](_0x5def36)['send'](_0x249640);};}exports[_0x26aa('0x37')]=function(_0x367b49,_0x9d177){var _0x3d9e1e={'include':[{'model':db[_0x26aa('0x38')],'as':_0x26aa('0x39')}]},_0x4466ba={},_0xd206c1={'count':0x0,'rows':[]};var _0x1fd0ed=_[_0x26aa('0x3a')](db[_0x26aa('0x3b')][_0x26aa('0x3c')],function(_0x361104){return{'name':_0x361104['fieldName'],'type':_0x361104[_0x26aa('0x3d')][_0x26aa('0x3e')]};});_0x4466ba[_0x26aa('0x3f')]=_[_0x26aa('0x3a')](_0x1fd0ed,_0x26aa('0x36'));_0x4466ba['query']=_[_0x26aa('0x40')](_0x367b49[_0x26aa('0x41')]);_0x4466ba[_0x26aa('0x42')]=_[_0x26aa('0x43')](_0x4466ba[_0x26aa('0x3f')],_0x4466ba[_0x26aa('0x41')]);_0x3d9e1e[_0x26aa('0x44')]=_[_0x26aa('0x43')](_0x4466ba[_0x26aa('0x3f')],qs[_0x26aa('0x45')](_0x367b49['query'][_0x26aa('0x45')]));_0x3d9e1e['attributes']=_0x3d9e1e['attributes'][_0x26aa('0x46')]?_0x3d9e1e[_0x26aa('0x44')]:_0x4466ba['model'];if(!_0x367b49[_0x26aa('0x41')][_0x26aa('0x47')](_0x26aa('0x48'))){_0x3d9e1e[_0x26aa('0x2a')]=qs[_0x26aa('0x2a')](_0x367b49[_0x26aa('0x41')][_0x26aa('0x2a')]);_0x3d9e1e[_0x26aa('0x27')]=qs[_0x26aa('0x27')](_0x367b49[_0x26aa('0x41')]['offset']);}_0x3d9e1e[_0x26aa('0x49')]=qs[_0x26aa('0x4a')](_0x367b49[_0x26aa('0x41')][_0x26aa('0x4a')]);_0x3d9e1e[_0x26aa('0x4b')]=qs['filters'](_[_0x26aa('0x4c')](_0x367b49[_0x26aa('0x41')],_0x4466ba[_0x26aa('0x42')]),_0x1fd0ed);if(_0x367b49[_0x26aa('0x41')]['filter']){_0x3d9e1e[_0x26aa('0x4b')]=_[_0x26aa('0x4d')](_0x3d9e1e['where'],{'$or':_[_0x26aa('0x3a')](_0x1fd0ed,function(_0x445566){if(_0x445566[_0x26aa('0x3d')]!=='VIRTUAL'){var _0x438c2b={};_0x438c2b[_0x445566['name']]={'$like':'%'+_0x367b49[_0x26aa('0x41')][_0x26aa('0x4e')]+'%'};return _0x438c2b;}})});}_0x3d9e1e=_[_0x26aa('0x4d')]({},_0x3d9e1e,_0x367b49[_0x26aa('0x4f')]);var _0x18677f={'where':_0x3d9e1e[_0x26aa('0x4b')]};return db[_0x26aa('0x3b')][_0x26aa('0x29')](_0x18677f)[_0x26aa('0x1e')](function(_0x340542){_0xd206c1[_0x26aa('0x29')]=_0x340542;if(_0x367b49[_0x26aa('0x41')][_0x26aa('0x50')]){_0x3d9e1e[_0x26aa('0x51')]=[{'all':!![]}];}return db[_0x26aa('0x3b')][_0x26aa('0x52')](_0x3d9e1e);})['then'](function(_0x131a41){_0xd206c1[_0x26aa('0x53')]=_0x131a41;return _0xd206c1;})[_0x26aa('0x1e')](respondWithFilteredResult(_0x9d177,_0x3d9e1e))[_0x26aa('0x54')](handleError(_0x9d177,null));};exports[_0x26aa('0x55')]=function(_0x403515,_0x28bf99){var _0x2cf975={'raw':![],'where':{'id':_0x403515[_0x26aa('0x56')]['id']},'include':[{'model':db[_0x26aa('0x38')],'as':_0x26aa('0x39')}]},_0x2be6ba={};_0x2be6ba[_0x26aa('0x3f')]=_[_0x26aa('0x40')](db[_0x26aa('0x3b')][_0x26aa('0x3c')]);_0x2be6ba[_0x26aa('0x41')]=_[_0x26aa('0x40')](_0x403515[_0x26aa('0x41')]);_0x2be6ba['filters']=_['intersection'](_0x2be6ba['model'],_0x2be6ba[_0x26aa('0x41')]);_0x2cf975[_0x26aa('0x44')]=_[_0x26aa('0x43')](_0x2be6ba[_0x26aa('0x3f')],qs[_0x26aa('0x45')](_0x403515['query'][_0x26aa('0x45')]));_0x2cf975[_0x26aa('0x44')]=_0x2cf975[_0x26aa('0x44')]['length']?_0x2cf975[_0x26aa('0x44')]:_0x2be6ba[_0x26aa('0x3f')];if(_0x403515[_0x26aa('0x41')][_0x26aa('0x50')]){_0x2cf975[_0x26aa('0x51')]=[{'all':!![]}];}_0x2cf975=_[_0x26aa('0x4d')]({},_0x2cf975,_0x403515[_0x26aa('0x4f')]);return db[_0x26aa('0x3b')][_0x26aa('0x57')](_0x2cf975)[_0x26aa('0x1e')](handleEntityNotFound(_0x28bf99,null))[_0x26aa('0x1e')](respondWithResult(_0x28bf99,null))[_0x26aa('0x54')](handleError(_0x28bf99,null));};exports[_0x26aa('0x58')]=function(_0x105c97,_0x150657){return db[_0x26aa('0x3b')][_0x26aa('0x58')](_0x105c97[_0x26aa('0x59')],{})[_0x26aa('0x1e')](function(_0x41cd7c){var _0x5d6cd6=_0x105c97['user'][_0x26aa('0x32')]({'plain':!![]});if(!_0x5d6cd6)throw new Error(_0x26aa('0x5a'));if(_0x5d6cd6[_0x26aa('0x5b')]===_0x26aa('0x5c')){var _0x2f5c0b=_0x41cd7c[_0x26aa('0x32')]({'plain':!![]});var _0x205cc5='ChatWebsites';return db[_0x26aa('0x5d')][_0x26aa('0x57')]({'where':{'name':_0x205cc5,'userProfileId':_0x5d6cd6[_0x26aa('0x5e')]},'raw':!![]})[_0x26aa('0x1e')](function(_0x35e9f0){if(_0x35e9f0&&_0x35e9f0[_0x26aa('0x5f')]===0x0){return db['UserProfileResource'][_0x26aa('0x58')]({'name':_0x2f5c0b[_0x26aa('0x36')],'resourceId':_0x2f5c0b['id'],'type':_0x35e9f0['name'],'sectionId':_0x35e9f0['id']},{})[_0x26aa('0x1e')](function(){return _0x41cd7c;});}else{return _0x41cd7c;}})[_0x26aa('0x54')](function(_0x5c6a72){logger['error'](_0x26aa('0x60'),_0x5c6a72);throw _0x5c6a72;});}return _0x41cd7c;})[_0x26aa('0x1e')](respondWithResult(_0x150657,0xc9))['catch'](handleError(_0x150657,null));};exports[_0x26aa('0x30')]=function(_0x5da15f,_0x4e3c8d){if(_0x5da15f['body']['id']){delete _0x5da15f[_0x26aa('0x59')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x5da15f[_0x26aa('0x56')]['id']},'include':[{'model':db[_0x26aa('0x38')],'as':'mandatoryDispositionPause'}]})[_0x26aa('0x1e')](handleEntityNotFound(_0x4e3c8d,null))[_0x26aa('0x1e')](saveUpdates(_0x5da15f[_0x26aa('0x59')],null))[_0x26aa('0x1e')](respondWithResult(_0x4e3c8d,null))[_0x26aa('0x54')](handleError(_0x4e3c8d,null));};exports['destroy']=function(_0x52bfe3,_0x5475e7){return db['ChatWebsite'][_0x26aa('0x57')]({'where':{'id':_0x52bfe3['params']['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x5475e7,null))[_0x26aa('0x1e')](removeEntity(_0x5475e7,null))['catch'](handleError(_0x5475e7,null));};exports['describe']=function(_0x26f7cc,_0x265409){return db[_0x26aa('0x3b')][_0x26aa('0x61')]()[_0x26aa('0x1e')](respondWithResult(_0x265409,null))[_0x26aa('0x54')](handleError(_0x265409,null));};exports[_0x26aa('0x62')]=function(_0xbf6341,_0x3521a1,_0x18c525){if(_0xbf6341[_0x26aa('0x59')]['id']){delete _0xbf6341[_0x26aa('0x59')]['id'];}return db[_0x26aa('0x3b')][_0x26aa('0x57')]({'where':{'id':_0xbf6341['params']['id']}})['then'](handleEntityNotFound(_0x3521a1,null))[_0x26aa('0x1e')](function(_0x364299){if(_0x364299){_0xbf6341[_0x26aa('0x59')][_0x26aa('0x63')]=_0x364299['id'];return db[_0x26aa('0x64')][_0x26aa('0x58')](_0xbf6341[_0x26aa('0x59')]);}})['then'](respondWithResult(_0x3521a1,null))['catch'](handleError(_0x3521a1,null));};exports[_0x26aa('0x65')]=function(_0x501dcc,_0x5eb13e,_0x57d878){var _0x5d5308={'raw':![],'where':{}};var _0x4c91eb={};var _0x38e8aa={'count':0x0,'rows':[]};return db[_0x26aa('0x3b')][_0x26aa('0x66')]({'where':{'id':_0x501dcc[_0x26aa('0x56')]['id']}})['then'](handleEntityNotFound(_0x5eb13e,null))[_0x26aa('0x1e')](function(_0xadf611){if(_0xadf611){_0x4c91eb['model']=_['keys'](db[_0x26aa('0x64')]['rawAttributes']);_0x4c91eb[_0x26aa('0x41')]=_['keys'](_0x501dcc[_0x26aa('0x41')]);_0x4c91eb[_0x26aa('0x42')]=_[_0x26aa('0x43')](_0x4c91eb[_0x26aa('0x3f')],_0x4c91eb[_0x26aa('0x41')]);_0x5d5308[_0x26aa('0x44')]=_['intersection'](_0x4c91eb[_0x26aa('0x3f')],qs[_0x26aa('0x45')](_0x501dcc[_0x26aa('0x41')]['fields']));_0x5d5308[_0x26aa('0x44')]=_0x5d5308['attributes'][_0x26aa('0x46')]?_0x5d5308[_0x26aa('0x44')]:_0x4c91eb[_0x26aa('0x3f')];if(!_0x501dcc[_0x26aa('0x41')][_0x26aa('0x47')](_0x26aa('0x48'))){_0x5d5308['limit']=qs[_0x26aa('0x2a')](_0x501dcc[_0x26aa('0x41')][_0x26aa('0x2a')]);_0x5d5308[_0x26aa('0x27')]=qs[_0x26aa('0x27')](_0x501dcc[_0x26aa('0x41')][_0x26aa('0x27')]);}_0x5d5308[_0x26aa('0x49')]=qs[_0x26aa('0x4a')](_0x501dcc[_0x26aa('0x41')][_0x26aa('0x4a')]);_0x5d5308[_0x26aa('0x4b')]=qs[_0x26aa('0x42')](_[_0x26aa('0x4c')](_0x501dcc[_0x26aa('0x41')],_0x4c91eb[_0x26aa('0x42')]));_0x5d5308[_0x26aa('0x4b')][_0x26aa('0x63')]=_0xadf611['id'];if(_0x501dcc['query'][_0x26aa('0x4e')]){_0x5d5308['where']=_['merge'](_0x5d5308[_0x26aa('0x4b')],{'$or':_[_0x26aa('0x3a')](_0x5d5308[_0x26aa('0x44')],function(_0x4f5b18){var _0x1b1be1={};_0x1b1be1[_0x4f5b18]={'$like':'%'+_0x501dcc['query'][_0x26aa('0x4e')]+'%'};return _0x1b1be1;})});}_0x5d5308=_[_0x26aa('0x4d')]({},_0x5d5308,_0x501dcc[_0x26aa('0x4f')]);return db[_0x26aa('0x64')]['count']({'where':_0x5d5308[_0x26aa('0x4b')]})[_0x26aa('0x1e')](function(_0x320a26){_0x38e8aa[_0x26aa('0x29')]=_0x320a26;if(_0x501dcc[_0x26aa('0x41')][_0x26aa('0x50')]){_0x5d5308[_0x26aa('0x51')]=[{'all':!![]}];}return db[_0x26aa('0x64')]['findAll'](_0x5d5308);})['then'](function(_0x10891d){_0x38e8aa['rows']=_0x10891d;return _0x38e8aa;});}})[_0x26aa('0x1e')](respondWithFilteredResult(_0x5eb13e,_0x5d5308))[_0x26aa('0x54')](handleError(_0x5eb13e,null));};exports['removeDispositions']=function(_0x351358,_0x488104,_0x50cdd4){return db[_0x26aa('0x3b')][_0x26aa('0x57')]({'where':{'id':_0x351358[_0x26aa('0x56')]['id']}})['then'](handleEntityNotFound(_0x488104,null))[_0x26aa('0x1e')](function(_0x1fc6cb){if(_0x1fc6cb){return _0x1fc6cb[_0x26aa('0x67')](_0x351358['query'][_0x26aa('0x68')]);}})['then'](respondWithStatusCode(_0x488104,null))['catch'](handleError(_0x488104,null));};exports[_0x26aa('0x69')]=function(_0x372089,_0x446d5f,_0x18db83){if(_0x372089[_0x26aa('0x59')]['id']){delete _0x372089[_0x26aa('0x59')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x372089[_0x26aa('0x56')]['id']}})['then'](handleEntityNotFound(_0x446d5f,null))['then'](function(_0x37bdf3){if(_0x37bdf3){_0x372089[_0x26aa('0x59')][_0x26aa('0x63')]=_0x37bdf3['id'];return db[_0x26aa('0x6a')][_0x26aa('0x58')](_0x372089[_0x26aa('0x59')]);}})['then'](respondWithResult(_0x446d5f,null))[_0x26aa('0x54')](handleError(_0x446d5f,null));};exports[_0x26aa('0x6b')]=function(_0x2bb981,_0x434333,_0x428038){var _0x13f15f={'raw':![],'where':{}};var _0x5078c5={};var _0x3bdc68={'count':0x0,'rows':[]};return db[_0x26aa('0x3b')]['findOne']({'where':{'id':_0x2bb981[_0x26aa('0x56')]['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x434333,null))[_0x26aa('0x1e')](function(_0x807c16){if(_0x807c16){_0x5078c5[_0x26aa('0x3f')]=_[_0x26aa('0x40')](db[_0x26aa('0x6a')][_0x26aa('0x3c')]);_0x5078c5[_0x26aa('0x41')]=_[_0x26aa('0x40')](_0x2bb981[_0x26aa('0x41')]);_0x5078c5[_0x26aa('0x42')]=_['intersection'](_0x5078c5['model'],_0x5078c5['query']);_0x13f15f[_0x26aa('0x44')]=_[_0x26aa('0x43')](_0x5078c5['model'],qs[_0x26aa('0x45')](_0x2bb981['query'][_0x26aa('0x45')]));_0x13f15f[_0x26aa('0x44')]=_0x13f15f['attributes'][_0x26aa('0x46')]?_0x13f15f[_0x26aa('0x44')]:_0x5078c5[_0x26aa('0x3f')];if(!_0x2bb981[_0x26aa('0x41')][_0x26aa('0x47')](_0x26aa('0x48'))){_0x13f15f[_0x26aa('0x2a')]=qs[_0x26aa('0x2a')](_0x2bb981['query'][_0x26aa('0x2a')]);_0x13f15f[_0x26aa('0x27')]=qs[_0x26aa('0x27')](_0x2bb981[_0x26aa('0x41')][_0x26aa('0x27')]);}_0x13f15f[_0x26aa('0x49')]=qs[_0x26aa('0x4a')](_0x2bb981['query'][_0x26aa('0x4a')]);_0x13f15f[_0x26aa('0x4b')]=qs[_0x26aa('0x42')](_['pick'](_0x2bb981[_0x26aa('0x41')],_0x5078c5[_0x26aa('0x42')]));_0x13f15f[_0x26aa('0x4b')]['ChatWebsiteId']=_0x807c16['id'];if(_0x2bb981[_0x26aa('0x41')][_0x26aa('0x4e')]){_0x13f15f['where']=_[_0x26aa('0x4d')](_0x13f15f[_0x26aa('0x4b')],{'$or':_[_0x26aa('0x3a')](_0x13f15f['attributes'],function(_0x12b3f6){var _0x25b11d={};_0x25b11d[_0x12b3f6]={'$like':'%'+_0x2bb981[_0x26aa('0x41')][_0x26aa('0x4e')]+'%'};return _0x25b11d;})});}_0x13f15f=_[_0x26aa('0x4d')]({},_0x13f15f,_0x2bb981[_0x26aa('0x4f')]);return db[_0x26aa('0x6a')]['count']({'where':_0x13f15f['where']})[_0x26aa('0x1e')](function(_0x87c308){_0x3bdc68[_0x26aa('0x29')]=_0x87c308;if(_0x2bb981[_0x26aa('0x41')][_0x26aa('0x50')]){_0x13f15f[_0x26aa('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x26aa('0x52')](_0x13f15f);})[_0x26aa('0x1e')](function(_0x302f50){_0x3bdc68['rows']=_0x302f50;return _0x3bdc68;});}})[_0x26aa('0x1e')](respondWithFilteredResult(_0x434333,_0x13f15f))[_0x26aa('0x54')](handleError(_0x434333,null));};exports['removeAnswers']=function(_0x477869,_0x309a89,_0x4b3899){return db[_0x26aa('0x3b')]['find']({'where':{'id':_0x477869['params']['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x309a89,null))['then'](function(_0x344219){if(_0x344219){return _0x344219['removeAnswers'](_0x477869[_0x26aa('0x41')][_0x26aa('0x68')]);}})[_0x26aa('0x1e')](respondWithStatusCode(_0x309a89,null))[_0x26aa('0x54')](handleError(_0x309a89,null));};exports[_0x26aa('0x6c')]=function(_0x1e7192,_0x30cc8e,_0x3850e3){_0x1e7192[_0x26aa('0x59')][_0x26aa('0x6d')]=_0x1e7192[_0x26aa('0x6e')][_0x26aa('0x6f')];return db['ChatWebsite'][_0x26aa('0x57')]({'where':{'id':_0x1e7192[_0x26aa('0x56')]['id']}})['then'](handleEntityNotFound(_0x30cc8e,null))[_0x26aa('0x1e')](saveUpdates(_0x1e7192[_0x26aa('0x59')],null))[_0x26aa('0x1e')](respondWithResult(_0x30cc8e,null))[_0x26aa('0x54')](handleError(_0x30cc8e,null));};exports[_0x26aa('0x70')]=function(_0x4a0626,_0x5aa7dd,_0x2b4584){_0x4a0626[_0x26aa('0x59')]['agentAvatar']=_0x4a0626[_0x26aa('0x6e')][_0x26aa('0x6f')];return db['ChatWebsite'][_0x26aa('0x57')]({'where':{'id':_0x4a0626['params']['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x5aa7dd,null))[_0x26aa('0x1e')](saveUpdates(_0x4a0626[_0x26aa('0x59')],null))[_0x26aa('0x1e')](respondWithResult(_0x5aa7dd,null))['catch'](handleError(_0x5aa7dd,null));};exports[_0x26aa('0x71')]=function(_0x5effa1,_0x540a32,_0x5cc741){_0x5effa1[_0x26aa('0x59')][_0x26aa('0x72')]=_0x5effa1[_0x26aa('0x6e')][_0x26aa('0x6f')];return db[_0x26aa('0x3b')][_0x26aa('0x57')]({'where':{'id':_0x5effa1[_0x26aa('0x56')]['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x540a32,null))[_0x26aa('0x1e')](saveUpdates(_0x5effa1[_0x26aa('0x59')],null))['then'](respondWithResult(_0x540a32,null))[_0x26aa('0x54')](handleError(_0x540a32,null));};exports[_0x26aa('0x73')]=function(_0x4d5172,_0x5dedfd,_0x30f1f2){_0x4d5172['body'][_0x26aa('0x74')]=_0x4d5172[_0x26aa('0x6e')][_0x26aa('0x6f')];return db[_0x26aa('0x3b')]['find']({'where':{'id':_0x4d5172['params']['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x5dedfd,null))[_0x26aa('0x1e')](saveUpdates(_0x4d5172[_0x26aa('0x59')],null))[_0x26aa('0x1e')](respondWithResult(_0x5dedfd,null))[_0x26aa('0x54')](handleError(_0x5dedfd,null));};exports['getLogo']=function(_0x50b3fb,_0x197b6a,_0x15aa48){var _0x124eb1=path['join'](config[_0x26aa('0x75')],_0x26aa('0x76'));var _0x733db2={'where':{'id':_0x50b3fb[_0x26aa('0x56')]['id']},'attributes':['id',_0x26aa('0x6d')],'raw':!![]};var _0x27b93d=![];return require(_0x26aa('0x13'))[_0x26aa('0x77')]()[_0x26aa('0x1e')](function(_0x1595ba){if(_0x1595ba){_0x27b93d=_0x1595ba['custom'];}})['then'](function(){return db[_0x26aa('0x3b')][_0x26aa('0x57')](_0x733db2);})['then'](handleEntityNotFound(_0x197b6a,null))[_0x26aa('0x1e')](function(_0x46abc2){if(_0x46abc2){if(!_[_0x26aa('0x78')](_0x46abc2[_0x26aa('0x6d')])){if(fs[_0x26aa('0x79')](path[_0x26aa('0x7a')](config[_0x26aa('0x75')],_0x26aa('0x7b'),_0x46abc2[_0x26aa('0x6d')]))&&_0x27b93d){_0x124eb1=path[_0x26aa('0x7a')](config[_0x26aa('0x75')],_0x26aa('0x7b'),_0x46abc2[_0x26aa('0x6d')]);}}return _0x197b6a[_0x26aa('0x7c')](_0x124eb1);}})[_0x26aa('0x54')](handleError(_0x197b6a,null));};exports[_0x26aa('0x7d')]=function(_0xeedd18,_0x615c1d,_0x176733){var _0x17c9ca=path[_0x26aa('0x7a')](config[_0x26aa('0x75')],_0x26aa('0x7e'));var _0x9c758c={'where':{'id':_0xeedd18[_0x26aa('0x56')]['id']},'attributes':['id',_0x26aa('0x7f')],'raw':!![]};return db['ChatWebsite'][_0x26aa('0x57')](_0x9c758c)[_0x26aa('0x1e')](handleEntityNotFound(_0x615c1d,null))[_0x26aa('0x1e')](function(_0x473ee0){if(_0x473ee0){if(!_[_0x26aa('0x78')](_0x473ee0[_0x26aa('0x7f')])){if(fs[_0x26aa('0x79')](path[_0x26aa('0x7a')](config[_0x26aa('0x75')],_0x26aa('0x80'),_0x473ee0['agentAvatar']))){_0x17c9ca=path[_0x26aa('0x7a')](config[_0x26aa('0x75')],_0x26aa('0x80'),_0x473ee0['agentAvatar']);}}return _0x615c1d[_0x26aa('0x7c')](_0x17c9ca);}})['catch'](handleError(_0x615c1d,null));};exports['getCustomerAvatar']=function(_0x1a17ab,_0x561981,_0xd03a6a){var _0x2c2acc=path['join'](config[_0x26aa('0x75')],_0x26aa('0x81'));var _0x3c914f={'where':{'id':_0x1a17ab[_0x26aa('0x56')]['id']},'attributes':['id','customerAvatar',_0x26aa('0x82')],'raw':!![]};return db[_0x26aa('0x3b')]['find'](_0x3c914f)[_0x26aa('0x1e')](handleEntityNotFound(_0x561981,null))[_0x26aa('0x1e')](function(_0x4d972f){if(_0x4d972f){if(!_['isNil'](_0x4d972f[_0x26aa('0x72')])){if(fs[_0x26aa('0x79')](path['join'](config[_0x26aa('0x75')],'server/files/images/avatars/',_0x4d972f[_0x26aa('0x72')]))&&_0x4d972f[_0x26aa('0x82')]){_0x2c2acc=path[_0x26aa('0x7a')](config[_0x26aa('0x75')],'server/files/images/avatars/',_0x4d972f[_0x26aa('0x72')]);}}return _0x561981[_0x26aa('0x7c')](_0x2c2acc);}})[_0x26aa('0x54')](handleError(_0x561981,null));};exports[_0x26aa('0x83')]=function(_0x184b68,_0x312c51,_0x11d377){var _0x4326f0=path['join'](config['root'],_0x26aa('0x84'));var _0x44877f={'where':{'id':_0x184b68[_0x26aa('0x56')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x26aa('0x3b')][_0x26aa('0x57')](_0x44877f)[_0x26aa('0x1e')](handleEntityNotFound(_0x312c51,null))['then'](function(_0x154906){if(_0x154906){if(!_['isNil'](_0x154906[_0x26aa('0x74')])){if(fs[_0x26aa('0x79')](path[_0x26aa('0x7a')](config[_0x26aa('0x75')],'server/files/images/avatars/',_0x154906[_0x26aa('0x74')]))){_0x4326f0=path['join'](config[_0x26aa('0x75')],'server/files/images/avatars/',_0x154906['systemAvatar']);}}return _0x312c51[_0x26aa('0x7c')](_0x4326f0);}})[_0x26aa('0x54')](handleError(_0x312c51,null));};exports[_0x26aa('0x85')]=function(_0x3aa8ac,_0x291202,_0x71108d){var _0x30b917=require(_0x26aa('0x86'));var _0x23f1c2=new _0x30b917();var _0xa5ac18=_0x23f1c2[_0x26aa('0x87')](_0x3aa8ac[_0x26aa('0x88')][_0x26aa('0x89')])[_0x26aa('0x8a')]();var _0x59e35e={'body':_0x3aa8ac[_0x26aa('0x59')],'channel':'chat'};var _0xebc3ac=[];var _0x295b5a=[];var _0x2b054a={};var _0x4bcc17=![];return db[_0x26aa('0x8b')][_0x26aa('0x61')]()[_0x26aa('0x1e')](function(_0x37eea9){if(!_0x37eea9){throw new db[(_0x26aa('0x8c'))][(_0x26aa('0x8d'))](_0x26aa('0x8e'));}_0xebc3ac=_[_0x26aa('0x8f')](_[_0x26aa('0x40')](_0x37eea9),[_0x26aa('0x90'),_0x26aa('0x91')]);_0x295b5a=_[_0x26aa('0x8f')](_[_0x26aa('0x40')](_0x37eea9),[_0x26aa('0x90'),'updatedAt',_0x26aa('0x92'),_0x26aa('0x93')]);if(_0x3aa8ac[_0x26aa('0x59')]['id']){delete _0x3aa8ac[_0x26aa('0x59')]['id'];}if(_[_0x26aa('0x78')](_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0x94')])){throw new db['Sequelize'][(_0x26aa('0x8d'))](_0x26aa('0x95'));}if(_[_0x26aa('0x78')](_0x3aa8ac[_0x26aa('0x59')]['body'])||_0x3aa8ac[_0x26aa('0x59')]['body']===''){throw new db[(_0x26aa('0x8c'))][(_0x26aa('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0x96')])){throw new db[(_0x26aa('0x8c'))][(_0x26aa('0x8d'))](_0x26aa('0x97')+_0x295b5a);}if(!_[_0x26aa('0x98')](_0x295b5a,_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0x96')])){throw new db[(_0x26aa('0x8c'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x295b5a);}_0x2b054a[_0x3aa8ac['body'][_0x26aa('0x96')]]=_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0x94')];})[_0x26aa('0x1e')](function(){return db[_0x26aa('0x3b')][_0x26aa('0x57')]({'where':{'id':_0x3aa8ac[_0x26aa('0x56')]['id']},'include':[{'model':db[_0x26aa('0x99')],'as':_0x26aa('0x9a'),'include':[{'model':db[_0x26aa('0x8b')],'as':'Contacts','where':_0x2b054a,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x26aa('0x9b')],'as':_0x26aa('0x9c')}]});})[_0x26aa('0x1e')](handleEntityNotFound(_0x291202,null))[_0x26aa('0x1e')](function(_0x2cf6c6){if(_0x2cf6c6&&_0x2cf6c6[_0x26aa('0x9a')]){_0x59e35e[_0x26aa('0x9d')]=_0x2cf6c6;_0x59e35e['applications']=_0x2cf6c6[_0x26aa('0x9c')];_0x59e35e[_0x26aa('0x9e')]=_0x2cf6c6[_0x26aa('0x9a')];_0x59e35e['applications']=_[_0x26aa('0x9f')](_0x59e35e[_0x26aa('0xa0')],[_0x26aa('0xa1')],[_0x26aa('0xa2')]);if(_0x59e35e['account']['Applications']){delete _0x59e35e[_0x26aa('0x9d')]['Applications'];}if(_0x59e35e[_0x26aa('0x9d')][_0x26aa('0x9a')]&&_0x59e35e['account'][_0x26aa('0x9a')][_0x26aa('0xa3')][_0x26aa('0x46')]){return _0x59e35e[_0x26aa('0x9d')][_0x26aa('0x9a')]['Contacts'][0x0];}var _0x1963b7=_[_0x26aa('0x15')](_0x3aa8ac[_0x26aa('0x59')],{'firstName':_0x3aa8ac['body'][_0x26aa('0x94')],'ListId':_0x2cf6c6[_0x26aa('0x93')]});_0x1963b7[_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0x96')]]=_0x3aa8ac[_0x26aa('0x59')]['from'];return db[_0x26aa('0x8b')]['create'](_0x1963b7,{'fields':_0xebc3ac,'raw':!![]});}})['then'](handleEntityNotFound(_0x291202,null))['then'](function(_0x295489){_0x59e35e[_0x26aa('0xa4')]=_0x295489;var _0x381351=_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0xa5')];if(_0x3aa8ac[_0x26aa('0x88')][_0x26aa('0xa6')]){_0x381351=_0x3aa8ac[_0x26aa('0x88')][_0x26aa('0xa6')];}else if(_0x3aa8ac['headers']['x-forwarded-for']){_0x381351=_['first'](_0x3aa8ac[_0x26aa('0x88')][_0x26aa('0xa7')][_0x26aa('0xa8')](','));}if(_0x295489){var _0x3f1303={'ContactId':_0x295489['id'],'ChatWebsiteId':_0x3aa8ac[_0x26aa('0x56')]['id'],'from':(_0x295489[_0x26aa('0xa9')]||'')+'\x20'+(_0x295489['lastName']||''),'customerIp':_0x381351,'customerPort':_0x3aa8ac['headers']['x-real-port']?_0x3aa8ac[_0x26aa('0x88')][_0x26aa('0xaa')]:null,'referer':_0x3aa8ac['body']['referer'],'browserName':_0xa5ac18[_0x26aa('0xab')][_0x26aa('0x36')]&&_0xa5ac18[_0x26aa('0xab')][_0x26aa('0xac')]?util[_0x26aa('0xad')]('%s\x20%s',_0xa5ac18[_0x26aa('0xab')][_0x26aa('0x36')],_0xa5ac18[_0x26aa('0xab')][_0x26aa('0xac')]):_0x26aa('0xae'),'browserVersion':_0xa5ac18[_0x26aa('0xab')][_0x26aa('0xac')]||_0x26aa('0xae'),'osName':util['format'](_0x26aa('0xaf'),_0xa5ac18['os']['name'],_0xa5ac18['os'][_0x26aa('0xac')]),'osVersion':_0xa5ac18['os'][_0x26aa('0xac')],'deviceModel':_0xa5ac18[_0x26aa('0xb0')][_0x26aa('0x3f')]&&_0xa5ac18[_0x26aa('0xb0')][_0x26aa('0xb1')]?util[_0x26aa('0xad')]('%s\x20%s\x20%s',_0xa5ac18[_0x26aa('0xb0')]['model'],_0xa5ac18[_0x26aa('0xb0')][_0x26aa('0xb1')],_0xa5ac18[_0x26aa('0xb0')][_0x26aa('0x3d')]):null,'deviceVendor':_0xa5ac18[_0x26aa('0xb0')]['vendor'],'deviceType':_0xa5ac18[_0x26aa('0xb0')][_0x26aa('0x3d')],'formData':JSON[_0x26aa('0xb2')](_0x3aa8ac[_0x26aa('0x59')])};var _0x4aad94={'ChatWebsiteId':_0x3aa8ac[_0x26aa('0x56')]['id'],'closed':![]};if(_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0xb3')]){_0x4aad94['threadId']=_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0xb3')];return db[_0x26aa('0xb4')][_0x26aa('0x57')]({'where':_0x4aad94})[_0x26aa('0x1e')](function(_0x1fa1bc){if(_0x1fa1bc){return[_0x1fa1bc,![]];}_0x3f1303[_0x26aa('0xb3')]=_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0xb3')];_0x3f1303[_0x26aa('0xb5')]=_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0xb5')];return db[_0x26aa('0xb4')][_0x26aa('0x58')](_0x3f1303)[_0x26aa('0x1e')](function(_0x376e99){return[_0x376e99,!![]];});});}_0x4aad94[_0x26aa('0xb6')]=_0x295489['id'];if(_0x3aa8ac['body'][_0x26aa('0xb7')]&&_0x3aa8ac[_0x26aa('0x59')]['interaction']['id']){_0x4aad94['id']=_0x3aa8ac['body'][_0x26aa('0xb7')]['id'];return db[_0x26aa('0xb4')][_0x26aa('0x57')]({'where':_0x4aad94})[_0x26aa('0x1e')](function(_0x56b3fe){if(_0x56b3fe){return[_0x56b3fe,![]];}return db['ChatInteraction'][_0x26aa('0x58')](_0x3f1303)[_0x26aa('0x1e')](function(_0x4e7f0d){return[_0x4e7f0d,!![]];});});}return db[_0x26aa('0xb4')][_0x26aa('0x58')](_0x3f1303)[_0x26aa('0x1e')](function(_0x206e2a){return[_0x206e2a,!![]];});}})[_0x26aa('0xb8')](function(_0x66a733,_0x807825){if(_0x66a733){_0x4bcc17=_0x807825;if(!_0x807825){var _0x4cd9a5={'from':(_0x59e35e['contact']['firstName']||'')+'\x20'+(_0x59e35e['contact'][_0x26aa('0xb9')]||'')};if(_0x3aa8ac[_0x26aa('0x59')]['threadId']&&_0x3aa8ac['body']['messageId']&&_0x3aa8ac['body'][_0x26aa('0xb3')]!=_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0xba')]){_0x4cd9a5['threadId']=_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0xba')];}return _0x66a733['update'](_0x4cd9a5);}else{return _0x66a733;}}})[_0x26aa('0x1e')](function(_0x320f24){_0x59e35e['interaction']=_0x320f24[_0x26aa('0x32')]({'plain':!![]});_0x59e35e[_0x26aa('0xb7')][_0x26aa('0xbb')]=_0x4bcc17;if(_0x59e35e[_0x26aa('0xb7')][_0x26aa('0xbb')]){if(_0x59e35e[_0x26aa('0x9d')][_0x26aa('0xbc')]){_0x59e35e[_0x26aa('0xa0')][_0x26aa('0xbd')]({'id':0x0,'priority':_0x59e35e[_0x26aa('0xa0')][_0x26aa('0x46')]+0x1,'app':_0x26aa('0xbe'),'appdata':'unmanaged','interval':_0x26aa('0xbf')});}}return db[_0x26aa('0xc0')]['create']({'body':_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0x59')],'ChatWebsiteId':_0x3aa8ac[_0x26aa('0x56')]['id'],'ChatInteractionId':_0x320f24['id'],'direction':'in','ContactId':_0x59e35e[_0x26aa('0xa4')]['id'],'AttachmentId':_0x3aa8ac[_0x26aa('0x59')][_0x26aa('0xc1')]});})[_0x26aa('0x1e')](function(_0x4206a6){_0x59e35e[_0x26aa('0x24')]=_0x4206a6;if(_0x59e35e[_0x26aa('0xb7')]['UserId']){return db[_0x26aa('0xc2')][_0x26aa('0x57')]({'attributes':['id',_0x26aa('0x36')],'where':{'id':_0x59e35e['interaction'][_0x26aa('0xc3')]}})['then'](function(_0xc791d1){if(_0xc791d1){_0x59e35e['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xc791d1[_0x26aa('0x36')]+','+(_0x59e35e[_0x26aa('0x9d')][_0x26aa('0xc4')]||0xa),'interval':_0x26aa('0xbf')});_0x59e35e['forcedOwnership']=!![];}return respondWithRpcPromise(_0x26aa('0xc5'),_0x26aa('0xc6'),_0x59e35e);});}return respondWithRpcPromise(_0x26aa('0xc5'),_0x26aa('0xc6'),_0x59e35e);})[_0x26aa('0x1e')](function(_0x208bb2){respondWithRpcPromise(_0x26aa('0xc7'),_0x26aa('0xc7'),{'event':_0x26aa('0x85'),'message':_0x208bb2},client9002);return _0x208bb2;})['then'](respondWithResult(_0x291202,null))[_0x26aa('0x54')](handleError(_0x291202,null));};exports[_0x26aa('0xc8')]=function(_0x232afa,_0x3c6dab,_0x13bab8){var _0x584f9a,_0x3d8338,_0x4838cb;var _0x532751=[];var _0x748c66=[];var _0x2350ff={};var _0x706ee0=_0x232afa['files']||[];var _0x1d83cc=[];var _0x4c6684;return db[_0x26aa('0x8b')][_0x26aa('0x61')]()[_0x26aa('0x1e')](function(_0x5dfd0f){if(!_0x5dfd0f){throw new db[(_0x26aa('0x8c'))][(_0x26aa('0x8d'))]('no\x20available\x20attributes');}_0x748c66=_[_0x26aa('0x8f')](_[_0x26aa('0x40')](_0x5dfd0f),[_0x26aa('0x90'),_0x26aa('0x91')]);_0x532751=_[_0x26aa('0x8f')](_[_0x26aa('0x40')](_0x5dfd0f),[_0x26aa('0x90'),_0x26aa('0x91'),_0x26aa('0x92'),_0x26aa('0x93')]);if(_0x232afa[_0x26aa('0x59')]['id']){delete _0x232afa[_0x26aa('0x59')]['id'];}if(_[_0x26aa('0x78')](_0x232afa[_0x26aa('0x59')][_0x26aa('0x94')])){throw _0x3c6dab['status'](0x1f4)['send'](new db[(_0x26aa('0x8c'))][(_0x26aa('0x8d'))](_0x26aa('0x95')));}if(_[_0x26aa('0x78')](_0x232afa[_0x26aa('0x59')][_0x26aa('0x59')])||_0x232afa['body'][_0x26aa('0x59')]===''){throw _0x3c6dab[_0x26aa('0x26')](0x1f4)[_0x26aa('0xc9')](new db[(_0x26aa('0x8c'))]['ValidationError'](_0x26aa('0xca')));}if(_[_0x26aa('0x78')](_0x232afa[_0x26aa('0x59')][_0x26aa('0xcb')])){throw _0x3c6dab[_0x26aa('0x26')](0x1f4)[_0x26aa('0xc9')](new db[(_0x26aa('0x8c'))][(_0x26aa('0x8d'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x532751));}if(!_['includes'](_0x532751,_0x232afa[_0x26aa('0x59')][_0x26aa('0xcb')])){throw _0x3c6dab[_0x26aa('0x26')](0x1f4)[_0x26aa('0xc9')](new db[(_0x26aa('0x8c'))][(_0x26aa('0x8d'))](_0x26aa('0xcc')+_0x532751));}_0x2350ff[_0x232afa['body'][_0x26aa('0xcb')]]=_0x232afa['body']['from'];})['then'](function(){return db[_0x26aa('0x3b')]['find']({'where':{'id':_0x232afa[_0x26aa('0x56')]['id']},'include':[{'model':db[_0x26aa('0x99')],'as':_0x26aa('0x9a')},{'model':db[_0x26aa('0xcd')],'as':'MailAccount'}]});})[_0x26aa('0x1e')](handleEntityNotFound(_0x3c6dab,null))[_0x26aa('0x1e')](function(_0x482c33){if(_0x482c33&&_0x482c33['List']){_0x3d8338=_0x482c33;var _0x4a6393=_[_0x26aa('0x15')](_0x232afa[_0x26aa('0x59')],{'firstName':_0x232afa[_0x26aa('0x59')][_0x26aa('0x94')],'phone':_0x232afa[_0x26aa('0x59')][_0x26aa('0x94')],'ListId':_0x482c33[_0x26aa('0x93')]});_0x4a6393[_0x232afa[_0x26aa('0x59')][_0x26aa('0xcb')]]=_0x232afa[_0x26aa('0x59')]['from'];return db[_0x26aa('0x8b')]['findOrCreate']({'where':_0x2350ff,'defaults':_0x4a6393});}})[_0x26aa('0xb8')](function(_0x22ada5){if(_0x22ada5){_0x4838cb=_0x22ada5;var _0x38e14c=fs[_0x26aa('0xce')](path[_0x26aa('0x7a')](config[_0x26aa('0x75')],_0x26aa('0xcf')),_0x26aa('0xd0'));var _0x58c81b=ejs[_0x26aa('0xd1')](_0x38e14c,{'body':_[_0x26aa('0xd2')](_0x232afa[_0x26aa('0x59')][_0x26aa('0x59')]),'bodyTitle':_0x3d8338[_0x26aa('0xd3')]});return db['ChatOfflineMessage']['create']({'body':_0x58c81b,'ContactId':_0x22ada5['id'],'ChatWebsiteId':_0x3d8338['id']});}})['then'](function(_0x1dda55){_0x4c6684=_0x1dda55;if(_0x706ee0['length']){var _0x5bc78f=_0x706ee0[_0x26aa('0x3a')](function(_0x5de11b){return{'name':_0x5de11b[_0x26aa('0xd4')],'basename':_0x5de11b['filename'],'type':_0x5de11b[_0x26aa('0xd5')],'ChatOfflineMessageId':_0x1dda55['id']};});_0x1d83cc=_0x5bc78f[_0x26aa('0x3a')](_0x42ea90=>{var _0x43aa6f={'filename':_0x42ea90['name'],'path':path['join'](config['root'],'server',_0x26aa('0xd6'),'attachments',_0x26aa('0xd7'),_0x42ea90[_0x26aa('0xd8')])};return _0x43aa6f;});if(!_0x3d8338[_0x26aa('0xd9')]){return db[_0x26aa('0xda')][_0x26aa('0xdb')](function(_0x537963){return db[_0x26aa('0xdc')][_0x26aa('0xdd')](_0x5bc78f,{'transaction':_0x537963});});}}})[_0x26aa('0x1e')](function(){if(_0x4c6684){_0x584f9a=_0x4c6684;return db[_0x26aa('0xcd')][_0x26aa('0x66')]({'where':{'active':!![]},'include':[{'model':db[_0x26aa('0xde')],'as':_0x26aa('0xdf'),'raw':!![]}]});}})[_0x26aa('0x1e')](function(_0xe92623){if(_0xe92623&&_0xe92623['Smtp']&&_0x3d8338[_0x26aa('0xe0')]&&_0x3d8338[_0x26aa('0xe1')]){var _0x171bf7={'tls':{'rejectUnauthorized':![]}};if(_0xe92623[_0x26aa('0xdf')][_0x26aa('0xe2')]){_0x171bf7[_0x26aa('0xe2')]=_0xe92623[_0x26aa('0xdf')][_0x26aa('0xe2')];}else{_0x171bf7['host']=_0xe92623[_0x26aa('0xdf')][_0x26aa('0xe3')];_0x171bf7[_0x26aa('0xe4')]=_0xe92623[_0x26aa('0xdf')][_0x26aa('0xe4')];_0x171bf7['secure']=_0xe92623[_0x26aa('0xdf')][_0x26aa('0xe5')];}if(_0xe92623[_0x26aa('0xdf')][_0x26aa('0xe6')]){_0x171bf7['auth']={'user':_0xe92623[_0x26aa('0xdf')][_0x26aa('0x5c')],'pass':_0xe92623[_0x26aa('0xdf')]['pass']};}return respondWithRpcPromise('SendMail',_0x26aa('0xe7'),{'account':_0x171bf7,'message':{'from':util[_0x26aa('0xad')](_0x26aa('0xe8'),_0xe92623['name'],_0xe92623['email']||_0xe92623[_0x26aa('0xdf')][_0x26aa('0x5c')]),'to':_0x3d8338[_0x26aa('0xe1')],'subject':_0x3d8338[_0x26aa('0xe9')],'html':_0x584f9a[_0x26aa('0x59')],'attachments':_0x1d83cc}},client9003)[_0x26aa('0x1e')](function(){return _0x584f9a;})[_0x26aa('0x54')](function(_0x2b3eb0){console[_0x26aa('0x22')](_0x2b3eb0);});}})['then'](function(){if(_0x3d8338&&_0x3d8338[_0x26aa('0xd9')]&&_0x3d8338[_0x26aa('0xea')]){var _0x1d7002=[];if(_0x706ee0[_0x26aa('0x46')]){_0x1d7002=_0x706ee0[_0x26aa('0x3a')](function(_0x5ccf43){return{'name':_0x5ccf43['originalname'],'basename':_0x5ccf43[_0x26aa('0x6f')],'type':_0x5ccf43[_0x26aa('0xd5')],'ChatOfflineMessageId':_0x4c6684['id']};});}var _0x298a08;if(!_[_0x26aa('0x78')](_0x3d8338[_0x26aa('0xeb')])){var _0x209eb4=_[_0x26aa('0x3a')](_0x232afa['body'],function(_0x215852){return _0x215852;});var _0x2fa966=_[_0x26aa('0xec')](_0x209eb4)[0x0];var _0x9f8f6a=_[_0x26aa('0xed')](_0x2fa966,function(_0x2f8129){return _0x2f8129;});_0x298a08=_0x9f8f6a[0x1][_0x3d8338['subjectOffline']];}var _0x4c40f0={'from':_0x4838cb[_0x26aa('0xee')],'firstName':_0x4838cb[_0x26aa('0xa9')],'lastName':_0x4838cb[_0x26aa('0xb9')],'mapKey':_0x26aa('0xee'),'message':{'from':_0x4838cb[_0x26aa('0xee')],'to':_0x3d8338[_0x26aa('0xcd')][_0x26aa('0xee')],'cc':'','subject':_[_0x26aa('0x78')](_0x298a08)?_0x3d8338[_0x26aa('0xe9')]:_0x298a08,'messageId':'','sentAt':new Date(),'attach':_0x1d7002[_0x26aa('0x46')],'attachments':_0x1d7002,'originChannel':_0x26aa('0xef'),'ChatWebsiteId':_0x3d8338['id'],'ChatOfflineMessageId':_0x584f9a['id'],'originTo':_0x3d8338['MailAccount'][_0x26aa('0xee')]},'body':_0x584f9a[_0x26aa('0x59')]};var _0x40c7ef={'account':{'id':_0x3d8338[_0x26aa('0xea')]},'body':_0x4c40f0,'log':_0x26aa('0xf0')};return respondWithRpcPromise(_0x26aa('0xf0'),_0x26aa('0xf1'),_0x40c7ef,client9001)['then'](function(){return _0x584f9a;})[_0x26aa('0x54')](function(_0x277550){console[_0x26aa('0x22')](_0x277550);});}return;})[_0x26aa('0x1e')](function(){if(_0x584f9a){return _0x584f9a;}})[_0x26aa('0x1e')](respondWithResult(_0x3c6dab,null))[_0x26aa('0x54')](function(_0x30535a){console[_0x26aa('0x22')]('catch',_0x30535a);for(var _0x515d30 of _0x706ee0){var _0x1c5ffd=path['join'](config[_0x26aa('0x75')],'server',_0x26aa('0xd6'),_0x26aa('0xf2'),_0x26aa('0xd7'),_0x515d30[_0x26aa('0x6f')]);fs_extra[_0x26aa('0xf3')](_0x1c5ffd)[_0x26aa('0x54')](function(_0x191367){console['error'](_0x26aa('0xf4'),_0x1c5ffd,_0x191367);});}});};exports[_0x26aa('0xf5')]=function(_0x40d8e3,_0x589bc5,_0x38c408){return db['ChatInteraction'][_0x26aa('0x57')]({'where':{'id':_0x40d8e3[_0x26aa('0x56')]['id']}})['then'](handleEntityNotFound(_0x589bc5,null))['then'](function(_0x141648){if(_0x141648){return _0x141648[_0x26aa('0xf5')](_0x40d8e3[_0x26aa('0x59')]['ids'],_[_0x26aa('0xf6')](_0x40d8e3[_0x26aa('0x59')],[_0x26aa('0x68'),'id'])||{});}})[_0x26aa('0x1e')](respondWithResult(_0x589bc5,null))['catch'](handleError(_0x589bc5,null));};exports['getInteractions']=function(_0x2092bc,_0x1335d9,_0x2a9b80){var _0x142f52={'raw':![],'where':{}};var _0x171d32={};var _0x4b3dc1={'count':0x0,'rows':[]};return db[_0x26aa('0x3b')][_0x26aa('0x66')]({'where':{'id':_0x2092bc['params']['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x1335d9,null))[_0x26aa('0x1e')](function(_0x59659a){if(_0x59659a){_0x171d32['model']=_[_0x26aa('0x40')](db[_0x26aa('0xb4')][_0x26aa('0x3c')]);_0x171d32[_0x26aa('0x41')]=_[_0x26aa('0x40')](_0x2092bc['query']);_0x171d32[_0x26aa('0x42')]=_[_0x26aa('0x43')](_0x171d32[_0x26aa('0x3f')],_0x171d32['query']);_0x142f52[_0x26aa('0x44')]=_[_0x26aa('0x43')](_0x171d32[_0x26aa('0x3f')],qs[_0x26aa('0x45')](_0x2092bc[_0x26aa('0x41')][_0x26aa('0x45')]));_0x142f52[_0x26aa('0x44')]=_0x142f52[_0x26aa('0x44')]['length']?_0x142f52[_0x26aa('0x44')]:_0x171d32['model'];if(!_0x2092bc[_0x26aa('0x41')][_0x26aa('0x47')](_0x26aa('0x48'))){_0x142f52[_0x26aa('0x2a')]=qs[_0x26aa('0x2a')](_0x2092bc[_0x26aa('0x41')][_0x26aa('0x2a')]);_0x142f52[_0x26aa('0x27')]=qs['offset'](_0x2092bc[_0x26aa('0x41')][_0x26aa('0x27')]);}_0x142f52[_0x26aa('0x49')]=qs[_0x26aa('0x4a')](_0x2092bc[_0x26aa('0x41')][_0x26aa('0x4a')]);_0x142f52[_0x26aa('0x4b')]=qs[_0x26aa('0x42')](_[_0x26aa('0x4c')](_0x2092bc[_0x26aa('0x41')],_0x171d32[_0x26aa('0x42')]));_0x142f52[_0x26aa('0x4b')]['ChatWebsiteId']=_0x59659a['id'];if(_0x2092bc['query'][_0x26aa('0x4e')]){_0x142f52['where']=_[_0x26aa('0x4d')](_0x142f52[_0x26aa('0x4b')],{'$or':_[_0x26aa('0x3a')](_0x142f52[_0x26aa('0x44')],function(_0x200a59){var _0x3d4e62={};_0x3d4e62[_0x200a59]={'$like':'%'+_0x2092bc['query'][_0x26aa('0x4e')]+'%'};return _0x3d4e62;})});}_0x142f52=_[_0x26aa('0x4d')]({},_0x142f52,_0x2092bc[_0x26aa('0x4f')]);return db[_0x26aa('0xb4')]['count']({'where':_0x142f52[_0x26aa('0x4b')]})[_0x26aa('0x1e')](function(_0x54ca49){_0x4b3dc1['count']=_0x54ca49;if(_0x2092bc['query'][_0x26aa('0x50')]){_0x142f52[_0x26aa('0x51')]=[{'model':db[_0x26aa('0x8b')],'as':'Contact','required':![]},{'model':db[_0x26aa('0xc2')],'as':_0x26aa('0xf7'),'attributes':[_0x26aa('0x36'),_0x26aa('0xf8'),_0x26aa('0xf9')],'required':![]},{'model':db[_0x26aa('0xfa')],'as':'Tags','attributes':['id',_0x26aa('0x36'),_0x26aa('0xfb')],'where':_0x2092bc[_0x26aa('0x41')][_0x26aa('0xfc')]?{'id':_0x2092bc[_0x26aa('0x41')][_0x26aa('0xfc')]}:undefined,'required':_0x2092bc[_0x26aa('0x41')][_0x26aa('0xfc')]?!![]:![]}];}return db[_0x26aa('0xb4')]['findAll'](_0x142f52);})[_0x26aa('0x1e')](function(_0x40ae26){_0x4b3dc1[_0x26aa('0x53')]=_0x40ae26;return _0x4b3dc1;});}})[_0x26aa('0x1e')](respondWithFilteredResult(_0x1335d9,_0x142f52))['catch'](handleError(_0x1335d9,null));};function iftimePromise(_0x22590e,_0x42110a){return respondWithRpcPromise(_0x26aa('0xfd'),'getSnippet',{'command':_0x42110a[_0x26aa('0xfe')]?util[_0x26aa('0xad')](_0x26aa('0xff'),_0x22590e['interval'],_0x42110a[_0x26aa('0xfe')]):util[_0x26aa('0xad')](_0x26aa('0x100'),_0x22590e['interval'])},client9002)['then'](function(_0x46919e){var _0xcd2c40=_0x46919e&&_0x46919e[_0x26aa('0x101')](_0x26aa('0x102'))>=0x0?!![]:![];logger[_0x26aa('0x1f')](_0x26aa('0x103'),_0x42110a['id'],_0x22590e['id'],_0x22590e['interval'],_0xcd2c40?_0x26aa('0x104'):'OFFLINE',_0x42110a[_0x26aa('0xfe')]?_0x42110a[_0x26aa('0xfe')]:'No\x20timezone');return _0xcd2c40;})[_0x26aa('0x54')](function(_0x1b4b18){logger['error'](_0x26aa('0x103'),_0x42110a['id'],_0x22590e['id'],_0x22590e[_0x26aa('0x105')],util[_0x26aa('0x106')](_0x1b4b18,{'showHidden':![],'depth':null}),_0x42110a[_0x26aa('0xfe')]?_0x42110a[_0x26aa('0xfe')]:_0x26aa('0x107'));return![];});}exports[_0x26aa('0x108')]=function(_0x1fcfda,_0x4c2b1c,_0x22c2b0){var _0x174e5d=0x0;var _0x438ff6=0x0;var _0x57b68d=![];var _0x2a8eaf;var _0x561db3;return db['ChatWebsite'][_0x26aa('0x57')]({'where':{'id':_0x1fcfda[_0x26aa('0x56')]['id']},'include':[{'model':db[_0x26aa('0x109')],'as':_0x26aa('0x109'),'include':[{'model':db[_0x26aa('0x109')],'as':_0x26aa('0x10a'),'attributes':['id',_0x26aa('0x105')],'raw':!![]}]}]})[_0x26aa('0x1e')](handleEntityNotFound(_0x4c2b1c,null))[_0x26aa('0x1e')](function(_0x5386d9){if(_0x5386d9){_0x2a8eaf=_0x5386d9;return _0x5386d9[_0x26aa('0x10b')]({'raw':!![]});}})['then'](function(_0x106989){if(_0x2a8eaf){if(_0x106989){_0x561db3=_0x106989;}}return require('../../config/license/util')[_0x26aa('0x77')]();})[_0x26aa('0x1e')](function(_0x42889b){if(_0x42889b){_0x438ff6=_0x42889b[_0x26aa('0x10c')];_0x57b68d=_0x42889b[_0x26aa('0x10d')];}})[_0x26aa('0x1e')](function(){return db[_0x26aa('0xb4')]['count']({'where':{'closed':![]}});})[_0x26aa('0x1e')](function(_0x108404){_0x174e5d=_0x108404;if(_0x438ff6&&_0x108404>_0x438ff6){return db[_0x26aa('0x10e')]['findOne']({'where':{'id':0x1}})['then'](function(_0x512675){if(_0x512675){_0x512675['increment']('chatLicenseExceeded');}});}})[_0x26aa('0x1e')](function(){if(_0x2a8eaf[_0x26aa('0x109')]&&_0x2a8eaf[_0x26aa('0x109')][_0x26aa('0x10a')]){var _0x1dcc3e=[];for(var _0x30b5f7=0x0;_0x30b5f7<_0x2a8eaf[_0x26aa('0x109')][_0x26aa('0x10a')]['length'];_0x30b5f7++){var _0x4c837b=_0x2a8eaf[_0x26aa('0x109')][_0x26aa('0x10a')][_0x30b5f7][_0x26aa('0x32')]({'plain':!![]});_0x1dcc3e['push'](iftimePromise(_0x4c837b,_0x2a8eaf));}return BPromise[_0x26aa('0x10f')](_0x1dcc3e)[_0x26aa('0x1e')](function(_0x3d3099){return _[_0x26aa('0x110')](_0x3d3099);});}else{return!![];}})[_0x26aa('0x1e')](function(_0x51b0b1){var _0x25a212=fs[_0x26aa('0xce')](path['join'](config[_0x26aa('0x75')],'server/files/chat/iframe.ejs'),_0x26aa('0xd0'));var _0x192175={'remote':_0x2a8eaf[_0x26aa('0x111')],'query':querystring[_0x26aa('0xb2')](_[_0x26aa('0x4d')](_0x2a8eaf[_0x26aa('0x32')]({'plain':!![]}),{'customerIp':_0x1fcfda[_0x26aa('0x88')][_0x26aa('0xa7')]||_0x1fcfda[_0x26aa('0x88')][_0x26aa('0x112')]||_0x1fcfda['connection'][_0x26aa('0x113')]||_0x1fcfda['ip'],'referer':_0x1fcfda[_0x26aa('0x88')][_0x26aa('0x114')],'openedInteractions':_0x174e5d,'maxInteractions':_0x438ff6,'virtual':_0x57b68d[_0x26aa('0x10c')],'online':_0x51b0b1,'custom':_0x57b68d}))[_0x26aa('0x115')](/'/g,'\x5c\x27')};_0x4c2b1c[_0x26aa('0xc9')](ejs[_0x26aa('0xd1')](Mustache[_0x26aa('0xd1')](_0x25a212,_0x192175),{'proactiveActions':_0x561db3,'alignment':_0x2a8eaf[_0x26aa('0x116')],'verticalAlignment':_0x2a8eaf[_0x26aa('0x117')],'div_color':_0x2a8eaf[_0x26aa('0xfb')],'text_color':_0x2a8eaf[_0x26aa('0x118')],'button_color':_0x2a8eaf[_0x26aa('0x119')],'background_color':_0x2a8eaf[_0x26aa('0x11a')]}));})[_0x26aa('0x54')](handleError(_0x4c2b1c,null));};exports[_0x26aa('0x11b')]=function(_0x46fea9,_0x43ccd9,_0x33f590){return db[_0x26aa('0x3b')][_0x26aa('0x66')]({'where':{'id':_0x46fea9[_0x26aa('0x56')]['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x43ccd9,null))[_0x26aa('0x1e')](function(_0x387a96){if(_0x387a96){return db['sequelize'][_0x26aa('0xdb')](function(_0x586a8d){return db['ChatApplication'][_0x26aa('0x31')]({'where':{'ChatWebsiteId':_0x46fea9[_0x26aa('0x56')]['id']},'transaction':_0x586a8d})[_0x26aa('0x1e')](function(_0x221596){var _0x1d6150=_[_0x26aa('0x3a')](_0x46fea9['body'],function(_0x1f31e5){_0x1f31e5['ChatWebsiteId']=_0x46fea9[_0x26aa('0x56')]['id'];return _0x1f31e5;});return db[_0x26aa('0x9b')][_0x26aa('0xdd')](_0x1d6150,{'transaction':_0x586a8d});});})[_0x26aa('0x1e')](function(){return db[_0x26aa('0x9b')][_0x26aa('0x11c')]({'where':{'ChatWebsiteId':_0x46fea9[_0x26aa('0x56')]['id']},'order':_0x26aa('0xa1')});});}})['then'](respondWithResult(_0x43ccd9,null))['catch'](handleError(_0x43ccd9,null));};exports[_0x26aa('0x11d')]=function(_0x108039,_0x59247f,_0x34e356){var _0x43346a={};var _0x1a6129={};var _0x49ace7;var _0xbd9b71;return db['ChatWebsite']['findOne']({'where':{'id':_0x108039[_0x26aa('0x56')]['id']}})['then'](handleEntityNotFound(_0x59247f,null))[_0x26aa('0x1e')](function(_0x1df6ee){if(_0x1df6ee){_0x49ace7=_0x1df6ee;_0x1a6129['model']=_[_0x26aa('0x40')](db[_0x26aa('0x9b')][_0x26aa('0x3c')]);_0x1a6129[_0x26aa('0x41')]=_['keys'](_0x108039['query']);_0x1a6129[_0x26aa('0x42')]=_[_0x26aa('0x43')](_0x1a6129['model'],_0x1a6129[_0x26aa('0x41')]);_0x43346a[_0x26aa('0x44')]=_[_0x26aa('0x43')](_0x1a6129[_0x26aa('0x3f')],qs[_0x26aa('0x45')](_0x108039[_0x26aa('0x41')][_0x26aa('0x45')]));_0x43346a[_0x26aa('0x44')]=_0x43346a['attributes'][_0x26aa('0x46')]?_0x43346a[_0x26aa('0x44')]:_0x1a6129['model'];_0x43346a[_0x26aa('0x49')]=qs[_0x26aa('0x4a')](_0x108039[_0x26aa('0x41')][_0x26aa('0x4a')]);_0x43346a[_0x26aa('0x4b')]=qs[_0x26aa('0x42')](_[_0x26aa('0x4c')](_0x108039[_0x26aa('0x41')],_0x1a6129[_0x26aa('0x42')]));if(_0x108039[_0x26aa('0x41')][_0x26aa('0x4e')]){_0x43346a[_0x26aa('0x4b')]=_[_0x26aa('0x4d')](_0x43346a['where'],{'$or':_['map'](_0x43346a[_0x26aa('0x44')],function(_0x2c16ae){var _0x3bf4bf={};_0x3bf4bf[_0x2c16ae]={'$like':'%'+_0x108039['query']['filter']+'%'};return _0x3bf4bf;})});}_0x43346a=_[_0x26aa('0x4d')]({},_0x43346a,_0x108039['options']);return _0x49ace7['getApplications'](_0x43346a);}})[_0x26aa('0x1e')](function(_0x572ea5){if(_0x572ea5){_0xbd9b71=_0x572ea5[_0x26aa('0x46')];if(!_0x108039[_0x26aa('0x41')]['hasOwnProperty'](_0x26aa('0x48'))){_0x43346a[_0x26aa('0x2a')]=qs[_0x26aa('0x2a')](_0x108039[_0x26aa('0x41')]['limit']);_0x43346a[_0x26aa('0x27')]=qs['offset'](_0x108039[_0x26aa('0x41')][_0x26aa('0x27')]);}return _0x49ace7[_0x26aa('0x11d')](_0x43346a);}})[_0x26aa('0x1e')](function(_0x3a63f4){if(_0x3a63f4){return _0x3a63f4?{'count':_0xbd9b71,'rows':_0x3a63f4}:null;}})[_0x26aa('0x1e')](respondWithResult(_0x59247f,null))[_0x26aa('0x54')](handleError(_0x59247f,null));};exports[_0x26aa('0x11e')]=function(_0x4fb44d,_0x333552,_0xcab22c){return db[_0x26aa('0x11f')][_0x26aa('0x57')]({'where':{'id':_0x4fb44d[_0x26aa('0x56')]['id']}})['then'](handleEntityNotFound(_0x333552,null))[_0x26aa('0x1e')](function(_0x2e03e5){if(_0x2e03e5){return _0x2e03e5[_0x26aa('0x11e')](_0x4fb44d[_0x26aa('0x59')][_0x26aa('0x68')],_['omit'](_0x4fb44d[_0x26aa('0x59')],[_0x26aa('0x68'),'id'])||{});}})[_0x26aa('0x1e')](respondWithResult(_0x333552,null))['catch'](handleError(_0x333552,null));};exports['getProactiveActions']=function(_0x46bec1,_0x344624,_0x51c51c){var _0x28049f={};var _0x5814d1={};var _0x52f05c;var _0x296e3f;return db[_0x26aa('0x3b')][_0x26aa('0x66')]({'where':{'id':_0x46bec1['params']['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x344624,null))[_0x26aa('0x1e')](function(_0x22d02c){if(_0x22d02c){_0x52f05c=_0x22d02c;_0x5814d1['model']=_['keys'](db[_0x26aa('0x120')][_0x26aa('0x3c')]);_0x5814d1[_0x26aa('0x41')]=_['keys'](_0x46bec1[_0x26aa('0x41')]);_0x5814d1[_0x26aa('0x42')]=_[_0x26aa('0x43')](_0x5814d1[_0x26aa('0x3f')],_0x5814d1['query']);_0x28049f[_0x26aa('0x44')]=_[_0x26aa('0x43')](_0x5814d1[_0x26aa('0x3f')],qs[_0x26aa('0x45')](_0x46bec1[_0x26aa('0x41')]['fields']));_0x28049f[_0x26aa('0x44')]=_0x28049f[_0x26aa('0x44')][_0x26aa('0x46')]?_0x28049f[_0x26aa('0x44')]:_0x5814d1['model'];_0x28049f[_0x26aa('0x49')]=qs[_0x26aa('0x4a')](_0x46bec1[_0x26aa('0x41')][_0x26aa('0x4a')]);_0x28049f[_0x26aa('0x4b')]=qs[_0x26aa('0x42')](_[_0x26aa('0x4c')](_0x46bec1['query'],_0x5814d1['filters']));if(_0x46bec1[_0x26aa('0x41')][_0x26aa('0x4e')]){_0x28049f[_0x26aa('0x4b')]=_[_0x26aa('0x4d')](_0x28049f['where'],{'$or':_['map'](_0x28049f[_0x26aa('0x44')],function(_0x218d66){var _0x1a175e={};_0x1a175e[_0x218d66]={'$like':'%'+_0x46bec1[_0x26aa('0x41')][_0x26aa('0x4e')]+'%'};return _0x1a175e;})});}_0x28049f=_[_0x26aa('0x4d')]({},_0x28049f,_0x46bec1['options']);return _0x52f05c[_0x26aa('0x10b')](_0x28049f);}})[_0x26aa('0x1e')](function(_0x583293){if(_0x583293){_0x296e3f=_0x583293[_0x26aa('0x46')];if(!_0x46bec1['query']['hasOwnProperty']('nolimit')){_0x28049f[_0x26aa('0x2a')]=qs[_0x26aa('0x2a')](_0x46bec1[_0x26aa('0x41')][_0x26aa('0x2a')]);_0x28049f[_0x26aa('0x27')]=qs[_0x26aa('0x27')](_0x46bec1[_0x26aa('0x41')][_0x26aa('0x27')]);}return _0x52f05c[_0x26aa('0x10b')](_0x28049f);}})[_0x26aa('0x1e')](function(_0x5de2ec){if(_0x5de2ec){return _0x5de2ec?{'count':_0x296e3f,'rows':_0x5de2ec}:null;}})[_0x26aa('0x1e')](respondWithResult(_0x344624,null))[_0x26aa('0x54')](handleError(_0x344624,null));};exports[_0x26aa('0x121')]=function(_0x80ca9d,_0x1b2032,_0x564423){var _0x5f324d=_0x80ca9d['query']['online']===_0x26aa('0x122')?_0x26aa('0x123'):_0x26aa('0x124');return db[_0x26aa('0x3b')][_0x26aa('0x57')]({'attributes':['id',_0x5f324d],'where':{'id':_0x80ca9d['params']['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x1b2032,null))[_0x26aa('0x1e')](function(_0x2d829a){if(_0x2d829a){var _0x396f4a=_0x2d829a[_0x5f324d];var _0x3ff154=_0x396f4a&&_0x396f4a[_0x26aa('0x125')]?_0x396f4a['items']:[];_0x1b2032[_0x26aa('0xc9')]({'fromKey':_[_0x26aa('0x78')](_0x396f4a['fromKey'])?undefined:_0x396f4a[_0x26aa('0x126')],'count':_0x3ff154[_0x26aa('0x46')],'rows':_0x3ff154});}})[_0x26aa('0x54')](handleError(_0x1b2032,null));};exports[_0x26aa('0x127')]=function(_0x4b7803,_0xdd9cd3,_0x385ade){var _0x4de082={'raw':![],'where':{}};var _0x3f9495={};var _0x1de829={'count':0x0,'rows':[]};return db[_0x26aa('0x3b')]['findOne']({'where':{'id':_0x4b7803[_0x26aa('0x56')]['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0xdd9cd3,null))['then'](function(_0x36fd8f){if(_0x36fd8f){_0x3f9495[_0x26aa('0x3f')]=_[_0x26aa('0x40')](db['ChatOfflineMessage'][_0x26aa('0x3c')]);_0x3f9495[_0x26aa('0x41')]=_[_0x26aa('0x40')](_0x4b7803[_0x26aa('0x41')]);_0x3f9495[_0x26aa('0x42')]=_[_0x26aa('0x43')](_0x3f9495[_0x26aa('0x3f')],_0x3f9495[_0x26aa('0x41')]);_0x4de082['attributes']=_['intersection'](_0x3f9495[_0x26aa('0x3f')],qs['fields'](_0x4b7803[_0x26aa('0x41')][_0x26aa('0x45')]));_0x4de082['attributes']=_0x4de082[_0x26aa('0x44')][_0x26aa('0x46')]?_0x4de082[_0x26aa('0x44')]:_0x3f9495[_0x26aa('0x3f')];if(!_0x4b7803[_0x26aa('0x41')][_0x26aa('0x47')](_0x26aa('0x48'))){_0x4de082[_0x26aa('0x2a')]=qs['limit'](_0x4b7803[_0x26aa('0x41')]['limit']);_0x4de082['offset']=qs[_0x26aa('0x27')](_0x4b7803[_0x26aa('0x41')][_0x26aa('0x27')]);}_0x4de082[_0x26aa('0x49')]=qs[_0x26aa('0x4a')](_0x4b7803['query'][_0x26aa('0x4a')]);_0x4de082[_0x26aa('0x4b')]=qs[_0x26aa('0x42')](_['pick'](_0x4b7803[_0x26aa('0x41')],_0x3f9495[_0x26aa('0x42')]));_0x4de082['where']['ChatWebsiteId']=_0x36fd8f['id'];if(_0x4b7803[_0x26aa('0x41')][_0x26aa('0x4e')]){_0x4de082[_0x26aa('0x4b')]=_[_0x26aa('0x4d')](_0x4de082[_0x26aa('0x4b')],{'$or':_['map'](_0x4de082[_0x26aa('0x44')],function(_0x239cce){var _0x41ee93={};_0x41ee93[_0x239cce]={'$like':'%'+_0x4b7803['query'][_0x26aa('0x4e')]+'%'};return _0x41ee93;})});}_0x4de082=_[_0x26aa('0x4d')]({},_0x4de082,_0x4b7803['options']);return db[_0x26aa('0x128')][_0x26aa('0x29')]({'where':_0x4de082['where']})['then'](function(_0x49a103){_0x1de829[_0x26aa('0x29')]=_0x49a103;if(_0x4b7803[_0x26aa('0x41')]['includeAll']){_0x4de082['include']=[{'all':!![]}];}else{_0x4de082[_0x26aa('0x51')]=[{'model':db[_0x26aa('0x8b')],'as':_0x26aa('0x129'),'required':![]},{'model':db[_0x26aa('0xdc')],'as':_0x26aa('0x12a'),'required':![]}];}return db[_0x26aa('0x128')][_0x26aa('0x52')](_0x4de082);})[_0x26aa('0x1e')](function(_0x55af55){_0x1de829[_0x26aa('0x53')]=_0x55af55;return _0x1de829;});}})[_0x26aa('0x1e')](respondWithFilteredResult(_0xdd9cd3,_0x4de082))['catch'](handleError(_0xdd9cd3,null));};exports[_0x26aa('0x12b')]=function(_0x1c7c91,_0x4c8799,_0x1c6e94){return db['ChatWebsite'][_0x26aa('0x57')]({'where':{'id':_0x1c7c91[_0x26aa('0x56')]['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x4c8799,null))[_0x26aa('0x1e')](function(_0x3d4ffb){if(_0x3d4ffb){return _0x3d4ffb[_0x26aa('0x12b')](_0x1c7c91['body'][_0x26aa('0x68')],_[_0x26aa('0xf6')](_0x1c7c91[_0x26aa('0x59')],[_0x26aa('0x68'),'id'])||{})[_0x26aa('0xb8')](function(_0x256b47){for(var _0x383d7a=0x0;_0x383d7a<_0x1c7c91[_0x26aa('0x59')]['ids'][_0x26aa('0x46')];_0x383d7a+=0x1){socket[_0x26aa('0x12c')](_0x26aa('0x12d'),{'UserId':Number(_0x1c7c91[_0x26aa('0x59')]['ids'][_0x383d7a]),'ChatWebsiteId':Number(_0x1c7c91[_0x26aa('0x56')]['id'])});}return _0x256b47;});}})[_0x26aa('0x1e')](respondWithResult(_0x4c8799,null))[_0x26aa('0x54')](handleError(_0x4c8799,null));};exports[_0x26aa('0x12e')]=function(_0x599fc6,_0x4437fa,_0x1b0a01){return db[_0x26aa('0x3b')]['find']({'where':{'id':_0x599fc6[_0x26aa('0x56')]['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x4437fa,null))[_0x26aa('0x1e')](function(_0x21bd6e){if(_0x21bd6e){return _0x21bd6e[_0x26aa('0x12e')](_0x599fc6[_0x26aa('0x41')]['ids'])[_0x26aa('0x1e')](function(){if(_[_0x26aa('0x12f')](_0x599fc6[_0x26aa('0x41')][_0x26aa('0x68')])){for(var _0x53973c=0x0;_0x53973c<_0x599fc6[_0x26aa('0x41')]['ids'][_0x26aa('0x46')];_0x53973c+=0x1){socket[_0x26aa('0x12c')](_0x26aa('0x130'),{'UserId':Number(_0x599fc6[_0x26aa('0x41')]['ids'][_0x53973c]),'ChatWebsiteId':Number(_0x599fc6['params']['id'])});}}else{socket[_0x26aa('0x12c')](_0x26aa('0x130'),{'UserId':Number(_0x599fc6[_0x26aa('0x41')][_0x26aa('0x68')]),'ChatWebsiteId':Number(_0x599fc6[_0x26aa('0x56')]['id'])});}});}})[_0x26aa('0x1e')](respondWithStatusCode(_0x4437fa,null))[_0x26aa('0x54')](handleError(_0x4437fa,null));};exports['getAgents']=function(_0xa5ea99,_0x59e11a,_0x22e2b9){var _0x5928e4={};var _0x24b321={};var _0x1ae5b8;var _0x2ef4fd;return db['ChatWebsite'][_0x26aa('0x66')]({'where':{'id':_0xa5ea99['params']['id']}})[_0x26aa('0x1e')](handleEntityNotFound(_0x59e11a,null))[_0x26aa('0x1e')](function(_0x1d898e){if(_0x1d898e){_0x1ae5b8=_0x1d898e;_0x24b321[_0x26aa('0x3f')]=_[_0x26aa('0x40')](db[_0x26aa('0xc2')]['rawAttributes']);_0x24b321[_0x26aa('0x41')]=_[_0x26aa('0x40')](_0xa5ea99['query']);_0x24b321['filters']=_['intersection'](_0x24b321[_0x26aa('0x3f')],_0x24b321['query']);_0x5928e4[_0x26aa('0x44')]=_[_0x26aa('0x43')](_0x24b321[_0x26aa('0x3f')],qs[_0x26aa('0x45')](_0xa5ea99[_0x26aa('0x41')][_0x26aa('0x45')]));_0x5928e4[_0x26aa('0x44')]=_0x5928e4[_0x26aa('0x44')][_0x26aa('0x46')]?_0x5928e4[_0x26aa('0x44')]:_0x24b321[_0x26aa('0x3f')];_0x5928e4[_0x26aa('0x49')]=qs[_0x26aa('0x4a')](_0xa5ea99['query'][_0x26aa('0x4a')]);_0x5928e4[_0x26aa('0x4b')]=qs[_0x26aa('0x42')](_[_0x26aa('0x4c')](_0xa5ea99[_0x26aa('0x41')],_0x24b321[_0x26aa('0x42')]));if(_0xa5ea99[_0x26aa('0x41')][_0x26aa('0x4e')]){_0x5928e4[_0x26aa('0x4b')]=_[_0x26aa('0x4d')](_0x5928e4[_0x26aa('0x4b')],{'$or':_['map'](_0x5928e4['attributes'],function(_0x487a98){var _0x4b862c={};_0x4b862c[_0x487a98]={'$like':'%'+_0xa5ea99[_0x26aa('0x41')]['filter']+'%'};return _0x4b862c;})});}_0x5928e4=_[_0x26aa('0x4d')]({},_0x5928e4,_0xa5ea99[_0x26aa('0x4f')]);return _0x1ae5b8[_0x26aa('0x131')](_0x5928e4);}})['then'](function(_0x22af7e){if(_0x22af7e){_0x2ef4fd=_0x22af7e[_0x26aa('0x46')];if(!_0xa5ea99[_0x26aa('0x41')][_0x26aa('0x47')](_0x26aa('0x48'))){_0x5928e4[_0x26aa('0x2a')]=qs[_0x26aa('0x2a')](_0xa5ea99[_0x26aa('0x41')][_0x26aa('0x2a')]);_0x5928e4['offset']=qs[_0x26aa('0x27')](_0xa5ea99[_0x26aa('0x41')][_0x26aa('0x27')]);}return _0x1ae5b8[_0x26aa('0x131')](_0x5928e4);}})[_0x26aa('0x1e')](function(_0x33784c){if(_0x33784c){return _0x33784c?{'count':_0x2ef4fd,'rows':_0x33784c}:null;}})['then'](respondWithResult(_0x59e11a,null))[_0x26aa('0x54')](handleError(_0x59e11a,null));}; \ No newline at end of file +var _0x5608=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','ChatWebsites','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','custom','isNil','join','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','existsSync','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','user-agent','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','CmList','Contacts','DESC','List','account','Applications','list','applications','orderBy','priority','contact','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','externalUrl','ChatInteraction','interaction','spread','messageId','get','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','../../config/license/util','getLicense','virtual','License','increment','all','server/files/chat/iframe.ejs','remote','x-real-ip','remoteAddress','replace','alignment','textColor','color_button','addApplications','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5608,0x124));var _0x8560=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x5608[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x8560('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8560('0x1'));var jsonpatch=require(_0x8560('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8560('0x3'));var Mustache=require('mustache');var util=require(_0x8560('0x4'));var path=require(_0x8560('0x5'));var sox=require(_0x8560('0x6'));var csv=require('to-csv');var ejs=require(_0x8560('0x7'));var fs=require('fs');var fs_extra=require(_0x8560('0x8'));var _=require(_0x8560('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8560('0xa'));var deskjs=require(_0x8560('0xb'));var toCsv=require(_0x8560('0xc'));var querystring=require(_0x8560('0xd'));var Papa=require(_0x8560('0xe'));var Redis=require(_0x8560('0xf'));var authService=require(_0x8560('0x10'));var qs=require(_0x8560('0x11'));var as=require(_0x8560('0x12'));var hardwareService=require(_0x8560('0x13'));var logger=require(_0x8560('0x14'))(_0x8560('0x15'));var utils=require(_0x8560('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8560('0x17'))['db'];config[_0x8560('0x18')]=_[_0x8560('0x19')](config[_0x8560('0x18')],{'host':_0x8560('0x1a'),'port':0x18eb});var socket=require(_0x8560('0x1b'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x8560('0x1c')](socket);var jayson=require(_0x8560('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x8560('0x1e')]['http']({'port':0x232a});var client9003=jayson[_0x8560('0x1e')][_0x8560('0x1f')]({'port':0x232b});var client9001=jayson[_0x8560('0x1e')]['http']({'port':0x2329});function respondWithRpcPromise(_0x1bed53,_0x560a0f,_0x7ebb1f,_0x161c0a){return new BPromise(function(_0x3c41dc,_0x247681){var _0x3cbc23=_0x161c0a||client;return _0x3cbc23['request'](_0x1bed53,_0x7ebb1f)[_0x8560('0x20')](function(_0x1f266b){logger['info'](_0x8560('0x21'),_0x560a0f,_0x8560('0x22'));logger[_0x8560('0x23')](_0x8560('0x24'),_0x560a0f,_0x8560('0x22'),JSON['stringify'](_0x1f266b));if(_0x1f266b['error']){if(_0x1f266b[_0x8560('0x25')]['code']===0x1f4){logger[_0x8560('0x25')](_0x8560('0x21'),_0x560a0f,_0x1f266b[_0x8560('0x25')]['message']);return _0x247681(_0x1f266b[_0x8560('0x25')]['message']);}logger[_0x8560('0x25')](_0x8560('0x21'),_0x560a0f,_0x1f266b[_0x8560('0x25')][_0x8560('0x26')]);return _0x3c41dc(_0x1f266b[_0x8560('0x25')][_0x8560('0x26')]);}else{logger[_0x8560('0x27')](_0x8560('0x21'),_0x560a0f,_0x8560('0x22'));_0x3c41dc(_0x1f266b[_0x8560('0x28')][_0x8560('0x26')]);}})[_0x8560('0x29')](function(_0x5d1854){logger[_0x8560('0x25')](_0x8560('0x21'),_0x560a0f,_0x5d1854);_0x247681(_0x5d1854);});});}function respondWithStatusCode(_0x2a4db9,_0x34cedd){_0x34cedd=_0x34cedd||0xcc;return function(_0x517bfa){if(_0x517bfa){return _0x2a4db9[_0x8560('0x2a')](_0x34cedd);}return _0x2a4db9[_0x8560('0x2b')](_0x34cedd)[_0x8560('0x2c')]();};}function respondWithResult(_0x2c0be9,_0x12bbce){_0x12bbce=_0x12bbce||0xc8;return function(_0x471693){if(_0x471693){return _0x2c0be9[_0x8560('0x2b')](_0x12bbce)['json'](_0x471693);}};}function respondWithFilteredResult(_0x1fa668,_0xfc0595){return function(_0x4c835d){if(_0x4c835d){var _0x58179e=typeof _0xfc0595[_0x8560('0x2d')]===_0x8560('0x2e')&&typeof _0xfc0595[_0x8560('0x2f')]==='undefined';var _0x4c5b2e=_0x4c835d['count'];var _0x414d45=_0x58179e?0x0:_0xfc0595[_0x8560('0x2d')];var _0x9ce5c6=_0x58179e?_0x4c835d[_0x8560('0x30')]:_0xfc0595[_0x8560('0x2d')]+_0xfc0595[_0x8560('0x2f')];var _0x404a5b;if(_0x9ce5c6>=_0x4c5b2e){_0x9ce5c6=_0x4c5b2e;_0x404a5b=0xc8;}else{_0x404a5b=0xce;}_0x1fa668[_0x8560('0x2b')](_0x404a5b);return _0x1fa668['set'](_0x8560('0x31'),_0x414d45+'-'+_0x9ce5c6+'/'+_0x4c5b2e)[_0x8560('0x32')](_0x4c835d);}return null;};}function patchUpdates(_0xdd9a7d){return function(_0x5d04eb){try{jsonpatch[_0x8560('0x33')](_0x5d04eb,_0xdd9a7d,!![]);}catch(_0x17b541){return BPromise[_0x8560('0x34')](_0x17b541);}return _0x5d04eb['save']();};}function saveUpdates(_0x1d1e06,_0x50acfe){return function(_0x34cc7c){if(_0x34cc7c){return _0x34cc7c[_0x8560('0x35')](_0x1d1e06)['then'](function(_0x137491){return _0x137491;});}return null;};}function removeEntity(_0x51e2c6,_0x244adb){return function(_0x3f8a46){if(_0x3f8a46){return _0x3f8a46[_0x8560('0x36')]()[_0x8560('0x20')](function(){var _0x2aa5df=_0x3f8a46['get']({'plain':!![]});var _0x35e193=_0x8560('0x37');return db['UserProfileResource'][_0x8560('0x36')]({'where':{'type':_0x35e193,'resourceId':_0x2aa5df['id']}})[_0x8560('0x20')](function(){return _0x3f8a46;});})[_0x8560('0x20')](function(){_0x51e2c6[_0x8560('0x2b')](0xcc)[_0x8560('0x2c')]();});}};}function handleEntityNotFound(_0x5d7282,_0x113ebc){return function(_0x54b6e4){if(!_0x54b6e4){_0x5d7282[_0x8560('0x2a')](0x194);}return _0x54b6e4;};}function handleError(_0x3d030a,_0xc50569){_0xc50569=_0xc50569||0x1f4;return function(_0x25d667){logger[_0x8560('0x25')](_0x25d667[_0x8560('0x38')]);if(_0x25d667[_0x8560('0x39')]){delete _0x25d667[_0x8560('0x39')];}_0x3d030a[_0x8560('0x2b')](_0xc50569)['send'](_0x25d667);};}exports[_0x8560('0x3a')]=function(_0x4cd815,_0x1fa76e){var _0x162c35={'include':[{'model':db[_0x8560('0x3b')],'as':_0x8560('0x3c')}]},_0x3e54d6={},_0x3243d5={'count':0x0,'rows':[]};var _0x5e8cdd=_[_0x8560('0x3d')](db[_0x8560('0x3e')][_0x8560('0x3f')],function(_0x40774f){return{'name':_0x40774f[_0x8560('0x40')],'type':_0x40774f[_0x8560('0x41')][_0x8560('0x42')]};});_0x3e54d6[_0x8560('0x43')]=_[_0x8560('0x3d')](_0x5e8cdd,'name');_0x3e54d6['query']=_[_0x8560('0x44')](_0x4cd815[_0x8560('0x45')]);_0x3e54d6['filters']=_[_0x8560('0x46')](_0x3e54d6['model'],_0x3e54d6[_0x8560('0x45')]);_0x162c35[_0x8560('0x47')]=_[_0x8560('0x46')](_0x3e54d6[_0x8560('0x43')],qs[_0x8560('0x48')](_0x4cd815['query'][_0x8560('0x48')]));_0x162c35[_0x8560('0x47')]=_0x162c35['attributes'][_0x8560('0x49')]?_0x162c35[_0x8560('0x47')]:_0x3e54d6['model'];if(!_0x4cd815['query'][_0x8560('0x4a')]('nolimit')){_0x162c35[_0x8560('0x2f')]=qs['limit'](_0x4cd815['query'][_0x8560('0x2f')]);_0x162c35[_0x8560('0x2d')]=qs['offset'](_0x4cd815[_0x8560('0x45')][_0x8560('0x2d')]);}_0x162c35[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0x4cd815[_0x8560('0x45')][_0x8560('0x4c')]);_0x162c35[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_['pick'](_0x4cd815['query'],_0x3e54d6[_0x8560('0x4e')]),_0x5e8cdd);if(_0x4cd815[_0x8560('0x45')][_0x8560('0x4f')]){_0x162c35[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x162c35['where'],{'$or':_[_0x8560('0x3d')](_0x5e8cdd,function(_0x1cd54a){if(_0x1cd54a[_0x8560('0x41')]!==_0x8560('0x51')){var _0x2ec25d={};_0x2ec25d[_0x1cd54a['name']]={'$like':'%'+_0x4cd815[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x2ec25d;}})});}_0x162c35=_[_0x8560('0x50')]({},_0x162c35,_0x4cd815[_0x8560('0x52')]);var _0xa7fbad={'where':_0x162c35[_0x8560('0x4d')]};return db[_0x8560('0x3e')][_0x8560('0x30')](_0xa7fbad)[_0x8560('0x20')](function(_0x18f1f8){_0x3243d5[_0x8560('0x30')]=_0x18f1f8;if(_0x4cd815[_0x8560('0x45')][_0x8560('0x53')]){_0x162c35[_0x8560('0x54')]=[{'all':!![]}];}return db['ChatWebsite'][_0x8560('0x55')](_0x162c35);})[_0x8560('0x20')](function(_0x23676b){_0x3243d5[_0x8560('0x56')]=_0x23676b;return _0x3243d5;})[_0x8560('0x20')](respondWithFilteredResult(_0x1fa76e,_0x162c35))[_0x8560('0x29')](handleError(_0x1fa76e,null));};exports['show']=function(_0x5acbf6,_0x1a0d3f){var _0x4a44c7={'raw':![],'where':{'id':_0x5acbf6['params']['id']},'include':[{'model':db[_0x8560('0x3b')],'as':'mandatoryDispositionPause'}]},_0xbc2c44={};_0xbc2c44[_0x8560('0x43')]=_[_0x8560('0x44')](db[_0x8560('0x3e')]['rawAttributes']);_0xbc2c44[_0x8560('0x45')]=_[_0x8560('0x44')](_0x5acbf6['query']);_0xbc2c44[_0x8560('0x4e')]=_[_0x8560('0x46')](_0xbc2c44[_0x8560('0x43')],_0xbc2c44[_0x8560('0x45')]);_0x4a44c7[_0x8560('0x47')]=_[_0x8560('0x46')](_0xbc2c44[_0x8560('0x43')],qs['fields'](_0x5acbf6['query']['fields']));_0x4a44c7['attributes']=_0x4a44c7['attributes']['length']?_0x4a44c7[_0x8560('0x47')]:_0xbc2c44['model'];if(_0x5acbf6[_0x8560('0x45')][_0x8560('0x53')]){_0x4a44c7[_0x8560('0x54')]=[{'all':!![]}];}_0x4a44c7=_[_0x8560('0x50')]({},_0x4a44c7,_0x5acbf6['options']);return db[_0x8560('0x3e')][_0x8560('0x57')](_0x4a44c7)[_0x8560('0x20')](handleEntityNotFound(_0x1a0d3f,null))[_0x8560('0x20')](respondWithResult(_0x1a0d3f,null))['catch'](handleError(_0x1a0d3f,null));};exports[_0x8560('0x58')]=function(_0x3ec0b4,_0x4a6487){return db[_0x8560('0x3e')]['create'](_0x3ec0b4[_0x8560('0x59')],{})[_0x8560('0x20')](function(_0x23f64e){var _0x34bf8d=_0x3ec0b4['user']['get']({'plain':!![]});if(!_0x34bf8d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34bf8d['role']===_0x8560('0x5a')){var _0x18e18e=_0x23f64e['get']({'plain':!![]});var _0x346f8f=_0x8560('0x37');return db[_0x8560('0x5b')][_0x8560('0x57')]({'where':{'name':_0x346f8f,'userProfileId':_0x34bf8d[_0x8560('0x5c')]},'raw':!![]})[_0x8560('0x20')](function(_0x5af334){if(_0x5af334&&_0x5af334['autoAssociation']===0x0){return db[_0x8560('0x5d')][_0x8560('0x58')]({'name':_0x18e18e['name'],'resourceId':_0x18e18e['id'],'type':_0x5af334[_0x8560('0x39')],'sectionId':_0x5af334['id']},{})[_0x8560('0x20')](function(){return _0x23f64e;});}else{return _0x23f64e;}})[_0x8560('0x29')](function(_0x34b49e){logger[_0x8560('0x25')](_0x8560('0x5e'),_0x34b49e);throw _0x34b49e;});}return _0x23f64e;})[_0x8560('0x20')](respondWithResult(_0x4a6487,0xc9))[_0x8560('0x29')](handleError(_0x4a6487,null));};exports[_0x8560('0x35')]=function(_0x4b336d,_0x1c3459){if(_0x4b336d[_0x8560('0x59')]['id']){delete _0x4b336d[_0x8560('0x59')]['id'];}return db[_0x8560('0x3e')]['find']({'where':{'id':_0x4b336d['params']['id']},'include':[{'model':db[_0x8560('0x3b')],'as':_0x8560('0x3c')}]})[_0x8560('0x20')](handleEntityNotFound(_0x1c3459,null))[_0x8560('0x20')](saveUpdates(_0x4b336d[_0x8560('0x59')],null))['then'](respondWithResult(_0x1c3459,null))[_0x8560('0x29')](handleError(_0x1c3459,null));};exports[_0x8560('0x36')]=function(_0x4cfd22,_0x970ea6){return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x4cfd22[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x970ea6,null))[_0x8560('0x20')](removeEntity(_0x970ea6,null))[_0x8560('0x29')](handleError(_0x970ea6,null));};exports[_0x8560('0x60')]=function(_0xecc63e,_0x4ce1a9){return db[_0x8560('0x3e')]['describe']()['then'](respondWithResult(_0x4ce1a9,null))[_0x8560('0x29')](handleError(_0x4ce1a9,null));};exports[_0x8560('0x61')]=function(_0x104830,_0x10dd0e,_0x576d46){if(_0x104830[_0x8560('0x59')]['id']){delete _0x104830[_0x8560('0x59')]['id'];}return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x104830['params']['id']}})['then'](handleEntityNotFound(_0x10dd0e,null))[_0x8560('0x20')](function(_0x55b44d){if(_0x55b44d){_0x104830[_0x8560('0x59')][_0x8560('0x62')]=_0x55b44d['id'];return db[_0x8560('0x63')]['create'](_0x104830['body']);}})[_0x8560('0x20')](respondWithResult(_0x10dd0e,null))[_0x8560('0x29')](handleError(_0x10dd0e,null));};exports[_0x8560('0x64')]=function(_0xb4e407,_0x41c588,_0x48f457){var _0x33932f={'raw':![],'where':{}};var _0x4cca93={};var _0x576071={'count':0x0,'rows':[]};return db[_0x8560('0x3e')]['findOne']({'where':{'id':_0xb4e407['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x41c588,null))[_0x8560('0x20')](function(_0x5c69c8){if(_0x5c69c8){_0x4cca93['model']=_[_0x8560('0x44')](db[_0x8560('0x63')]['rawAttributes']);_0x4cca93[_0x8560('0x45')]=_[_0x8560('0x44')](_0xb4e407['query']);_0x4cca93[_0x8560('0x4e')]=_['intersection'](_0x4cca93[_0x8560('0x43')],_0x4cca93[_0x8560('0x45')]);_0x33932f[_0x8560('0x47')]=_[_0x8560('0x46')](_0x4cca93['model'],qs['fields'](_0xb4e407[_0x8560('0x45')]['fields']));_0x33932f[_0x8560('0x47')]=_0x33932f[_0x8560('0x47')][_0x8560('0x49')]?_0x33932f['attributes']:_0x4cca93[_0x8560('0x43')];if(!_0xb4e407[_0x8560('0x45')][_0x8560('0x4a')](_0x8560('0x65'))){_0x33932f[_0x8560('0x2f')]=qs[_0x8560('0x2f')](_0xb4e407['query'][_0x8560('0x2f')]);_0x33932f[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0xb4e407[_0x8560('0x45')][_0x8560('0x2d')]);}_0x33932f[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0xb4e407[_0x8560('0x45')][_0x8560('0x4c')]);_0x33932f['where']=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0xb4e407[_0x8560('0x45')],_0x4cca93[_0x8560('0x4e')]));_0x33932f[_0x8560('0x4d')]['ChatWebsiteId']=_0x5c69c8['id'];if(_0xb4e407['query'][_0x8560('0x4f')]){_0x33932f[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x33932f[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x33932f['attributes'],function(_0x408b93){var _0x48cab6={};_0x48cab6[_0x408b93]={'$like':'%'+_0xb4e407[_0x8560('0x45')]['filter']+'%'};return _0x48cab6;})});}_0x33932f=_[_0x8560('0x50')]({},_0x33932f,_0xb4e407[_0x8560('0x52')]);return db[_0x8560('0x63')]['count']({'where':_0x33932f[_0x8560('0x4d')]})['then'](function(_0x17127d){_0x576071[_0x8560('0x30')]=_0x17127d;if(_0xb4e407[_0x8560('0x45')][_0x8560('0x53')]){_0x33932f[_0x8560('0x54')]=[{'all':!![]}];}return db[_0x8560('0x63')][_0x8560('0x55')](_0x33932f);})[_0x8560('0x20')](function(_0x35b928){_0x576071[_0x8560('0x56')]=_0x35b928;return _0x576071;});}})[_0x8560('0x20')](respondWithFilteredResult(_0x41c588,_0x33932f))[_0x8560('0x29')](handleError(_0x41c588,null));};exports['removeDispositions']=function(_0x403559,_0x125d73,_0xf9b82d){return db[_0x8560('0x3e')]['find']({'where':{'id':_0x403559[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x125d73,null))['then'](function(_0x14d345){if(_0x14d345){return _0x14d345[_0x8560('0x67')](_0x403559['query'][_0x8560('0x68')]);}})['then'](respondWithStatusCode(_0x125d73,null))[_0x8560('0x29')](handleError(_0x125d73,null));};exports[_0x8560('0x69')]=function(_0x3a815c,_0x3d56b3,_0x1eb93c){if(_0x3a815c[_0x8560('0x59')]['id']){delete _0x3a815c[_0x8560('0x59')]['id'];}return db[_0x8560('0x3e')]['find']({'where':{'id':_0x3a815c['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x3d56b3,null))['then'](function(_0x5004c0){if(_0x5004c0){_0x3a815c[_0x8560('0x59')]['ChatWebsiteId']=_0x5004c0['id'];return db[_0x8560('0x6a')][_0x8560('0x58')](_0x3a815c[_0x8560('0x59')]);}})[_0x8560('0x20')](respondWithResult(_0x3d56b3,null))['catch'](handleError(_0x3d56b3,null));};exports[_0x8560('0x6b')]=function(_0x553895,_0x24483b,_0x21c688){var _0x301483={'raw':![],'where':{}};var _0x4ceac5={};var _0xae720c={'count':0x0,'rows':[]};return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0x553895[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x24483b,null))['then'](function(_0x4d2de0){if(_0x4d2de0){_0x4ceac5[_0x8560('0x43')]=_[_0x8560('0x44')](db['CannedAnswer']['rawAttributes']);_0x4ceac5['query']=_['keys'](_0x553895[_0x8560('0x45')]);_0x4ceac5[_0x8560('0x4e')]=_[_0x8560('0x46')](_0x4ceac5[_0x8560('0x43')],_0x4ceac5[_0x8560('0x45')]);_0x301483[_0x8560('0x47')]=_[_0x8560('0x46')](_0x4ceac5[_0x8560('0x43')],qs[_0x8560('0x48')](_0x553895['query'][_0x8560('0x48')]));_0x301483[_0x8560('0x47')]=_0x301483[_0x8560('0x47')][_0x8560('0x49')]?_0x301483[_0x8560('0x47')]:_0x4ceac5['model'];if(!_0x553895['query']['hasOwnProperty'](_0x8560('0x65'))){_0x301483['limit']=qs[_0x8560('0x2f')](_0x553895[_0x8560('0x45')]['limit']);_0x301483['offset']=qs['offset'](_0x553895[_0x8560('0x45')][_0x8560('0x2d')]);}_0x301483[_0x8560('0x4b')]=qs['sort'](_0x553895['query'][_0x8560('0x4c')]);_0x301483[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0x553895[_0x8560('0x45')],_0x4ceac5[_0x8560('0x4e')]));_0x301483[_0x8560('0x4d')][_0x8560('0x62')]=_0x4d2de0['id'];if(_0x553895[_0x8560('0x45')][_0x8560('0x4f')]){_0x301483[_0x8560('0x4d')]=_['merge'](_0x301483[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x301483[_0x8560('0x47')],function(_0x2c69d6){var _0x540db8={};_0x540db8[_0x2c69d6]={'$like':'%'+_0x553895[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x540db8;})});}_0x301483=_[_0x8560('0x50')]({},_0x301483,_0x553895[_0x8560('0x52')]);return db[_0x8560('0x6a')][_0x8560('0x30')]({'where':_0x301483[_0x8560('0x4d')]})[_0x8560('0x20')](function(_0x23bf6c){_0xae720c[_0x8560('0x30')]=_0x23bf6c;if(_0x553895[_0x8560('0x45')][_0x8560('0x53')]){_0x301483['include']=[{'all':!![]}];}return db[_0x8560('0x6a')][_0x8560('0x55')](_0x301483);})[_0x8560('0x20')](function(_0x5c7923){_0xae720c[_0x8560('0x56')]=_0x5c7923;return _0xae720c;});}})[_0x8560('0x20')](respondWithFilteredResult(_0x24483b,_0x301483))[_0x8560('0x29')](handleError(_0x24483b,null));};exports[_0x8560('0x6d')]=function(_0x25d55a,_0x2ac0a5,_0x5b6fd3){return db[_0x8560('0x3e')]['find']({'where':{'id':_0x25d55a[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x2ac0a5,null))[_0x8560('0x20')](function(_0x3761b3){if(_0x3761b3){return _0x3761b3[_0x8560('0x6d')](_0x25d55a[_0x8560('0x45')][_0x8560('0x68')]);}})[_0x8560('0x20')](respondWithStatusCode(_0x2ac0a5,null))[_0x8560('0x29')](handleError(_0x2ac0a5,null));};exports[_0x8560('0x6e')]=function(_0x453f86,_0x245b3a,_0x3b3978){_0x453f86[_0x8560('0x59')][_0x8560('0x6f')]=_0x453f86['file'][_0x8560('0x70')];return db['ChatWebsite'][_0x8560('0x57')]({'where':{'id':_0x453f86[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x245b3a,null))['then'](saveUpdates(_0x453f86['body'],null))[_0x8560('0x20')](respondWithResult(_0x245b3a,null))[_0x8560('0x29')](handleError(_0x245b3a,null));};exports['addAvatar']=function(_0xffc128,_0x3fbcb3,_0x4ec786){_0xffc128[_0x8560('0x59')][_0x8560('0x71')]=_0xffc128[_0x8560('0x72')][_0x8560('0x70')];return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0xffc128['params']['id']}})['then'](handleEntityNotFound(_0x3fbcb3,null))[_0x8560('0x20')](saveUpdates(_0xffc128[_0x8560('0x59')],null))['then'](respondWithResult(_0x3fbcb3,null))[_0x8560('0x29')](handleError(_0x3fbcb3,null));};exports[_0x8560('0x73')]=function(_0x17aa95,_0x5bbb9c,_0x3ae735){_0x17aa95['body'][_0x8560('0x74')]=_0x17aa95['file'][_0x8560('0x70')];return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x17aa95['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x5bbb9c,null))[_0x8560('0x20')](saveUpdates(_0x17aa95[_0x8560('0x59')],null))[_0x8560('0x20')](respondWithResult(_0x5bbb9c,null))[_0x8560('0x29')](handleError(_0x5bbb9c,null));};exports[_0x8560('0x75')]=function(_0xabdb72,_0x5ef74a,_0x263afa){_0xabdb72[_0x8560('0x59')][_0x8560('0x76')]=_0xabdb72[_0x8560('0x72')][_0x8560('0x70')];return db[_0x8560('0x3e')]['find']({'where':{'id':_0xabdb72[_0x8560('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5ef74a,null))[_0x8560('0x20')](saveUpdates(_0xabdb72[_0x8560('0x59')],null))[_0x8560('0x20')](respondWithResult(_0x5ef74a,null))['catch'](handleError(_0x5ef74a,null));};exports[_0x8560('0x77')]=function(_0x3e2654,_0x34a622,_0x5965ec){var _0x481743=path['join'](config[_0x8560('0x78')],_0x8560('0x79'));var _0xf95084={'where':{'id':_0x3e2654[_0x8560('0x5f')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x56a0b0=![];return require('../../config/license/util')['getLicense']()['then'](function(_0xae8d61){if(_0xae8d61){_0x56a0b0=_0xae8d61[_0x8560('0x7a')];}})[_0x8560('0x20')](function(){return db['ChatWebsite'][_0x8560('0x57')](_0xf95084);})[_0x8560('0x20')](handleEntityNotFound(_0x34a622,null))[_0x8560('0x20')](function(_0x55cc6f){if(_0x55cc6f){if(!_[_0x8560('0x7b')](_0x55cc6f[_0x8560('0x6f')])){if(fs['existsSync'](path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x7d'),_0x55cc6f[_0x8560('0x6f')]))&&_0x56a0b0){_0x481743=path[_0x8560('0x7c')](config['root'],_0x8560('0x7d'),_0x55cc6f[_0x8560('0x6f')]);}}return _0x34a622['download'](_0x481743);}})[_0x8560('0x29')](handleError(_0x34a622,null));};exports[_0x8560('0x7e')]=function(_0x18a781,_0x25c479,_0x53a0a6){var _0x1b328c=path[_0x8560('0x7c')](config['root'],_0x8560('0x7f'));var _0xf9f989={'where':{'id':_0x18a781[_0x8560('0x5f')]['id']},'attributes':['id',_0x8560('0x71')],'raw':!![]};return db[_0x8560('0x3e')][_0x8560('0x57')](_0xf9f989)[_0x8560('0x20')](handleEntityNotFound(_0x25c479,null))['then'](function(_0x312583){if(_0x312583){if(!_[_0x8560('0x7b')](_0x312583[_0x8560('0x71')])){if(fs['existsSync'](path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x80'),_0x312583[_0x8560('0x71')]))){_0x1b328c=path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x80'),_0x312583[_0x8560('0x71')]);}}return _0x25c479['download'](_0x1b328c);}})[_0x8560('0x29')](handleError(_0x25c479,null));};exports[_0x8560('0x81')]=function(_0xad4743,_0x552ff6,_0xb96a8d){var _0x39ca48=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x51fc5c={'where':{'id':_0xad4743[_0x8560('0x5f')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x8560('0x3e')]['find'](_0x51fc5c)[_0x8560('0x20')](handleEntityNotFound(_0x552ff6,null))[_0x8560('0x20')](function(_0x528a78){if(_0x528a78){if(!_['isNil'](_0x528a78[_0x8560('0x74')])){if(fs[_0x8560('0x82')](path[_0x8560('0x7c')](config['root'],'server/files/images/avatars/',_0x528a78[_0x8560('0x74')]))&&_0x528a78['showCustomerAvatar']){_0x39ca48=path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x80'),_0x528a78[_0x8560('0x74')]);}}return _0x552ff6[_0x8560('0x83')](_0x39ca48);}})['catch'](handleError(_0x552ff6,null));};exports[_0x8560('0x84')]=function(_0x574a03,_0x10276f,_0x2082df){var _0x4756d4=path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x85'));var _0x1c34dc={'where':{'id':_0x574a03[_0x8560('0x5f')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x8560('0x3e')]['find'](_0x1c34dc)[_0x8560('0x20')](handleEntityNotFound(_0x10276f,null))[_0x8560('0x20')](function(_0x16bffc){if(_0x16bffc){if(!_[_0x8560('0x7b')](_0x16bffc[_0x8560('0x76')])){if(fs[_0x8560('0x82')](path['join'](config[_0x8560('0x78')],'server/files/images/avatars/',_0x16bffc[_0x8560('0x76')]))){_0x4756d4=path[_0x8560('0x7c')](config[_0x8560('0x78')],'server/files/images/avatars/',_0x16bffc[_0x8560('0x76')]);}}return _0x10276f[_0x8560('0x83')](_0x4756d4);}})[_0x8560('0x29')](handleError(_0x10276f,null));};exports['notify']=function(_0x2cdc45,_0x340050,_0xe8073e){var _0x22b70d=require(_0x8560('0x86'));var _0x3dc593=new _0x22b70d();var _0x38f7e9=_0x3dc593['setUA'](_0x2cdc45['headers'][_0x8560('0x87')])['getResult']();var _0x49a573={'body':_0x2cdc45['body'],'channel':_0x8560('0x88')};var _0x2cbd6d=[];var _0x2d5279=[];var _0x2460df={};var _0x466eef=![];return db[_0x8560('0x89')][_0x8560('0x60')]()['then'](function(_0x3da66d){if(!_0x3da66d){throw new db[(_0x8560('0x8a'))]['ValidationError'](_0x8560('0x8b'));}_0x2cbd6d=_[_0x8560('0x8c')](_[_0x8560('0x44')](_0x3da66d),['createdAt',_0x8560('0x8d')]);_0x2d5279=_[_0x8560('0x8c')](_[_0x8560('0x44')](_0x3da66d),[_0x8560('0x8e'),_0x8560('0x8d'),_0x8560('0x8f'),_0x8560('0x90')]);if(_0x2cdc45[_0x8560('0x59')]['id']){delete _0x2cdc45[_0x8560('0x59')]['id'];}if(_[_0x8560('0x7b')](_0x2cdc45[_0x8560('0x59')]['from'])){throw new db[(_0x8560('0x8a'))][(_0x8560('0x91'))]('from\x20is\x20mandatory');}if(_[_0x8560('0x7b')](_0x2cdc45[_0x8560('0x59')][_0x8560('0x59')])||_0x2cdc45[_0x8560('0x59')][_0x8560('0x59')]===''){throw new db[(_0x8560('0x8a'))][(_0x8560('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8560('0x7b')](_0x2cdc45[_0x8560('0x59')]['mapKey'])){throw new db[(_0x8560('0x8a'))][(_0x8560('0x91'))](_0x8560('0x92')+_0x2d5279);}if(!_['includes'](_0x2d5279,_0x2cdc45[_0x8560('0x59')]['mapKey'])){throw new db[(_0x8560('0x8a'))][(_0x8560('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d5279);}_0x2460df[_0x2cdc45[_0x8560('0x59')][_0x8560('0x93')]]=_0x2cdc45[_0x8560('0x59')][_0x8560('0x94')];})[_0x8560('0x20')](function(){return db[_0x8560('0x3e')]['find']({'where':{'id':_0x2cdc45[_0x8560('0x5f')]['id']},'include':[{'model':db[_0x8560('0x95')],'as':'List','include':[{'model':db[_0x8560('0x89')],'as':_0x8560('0x96'),'where':_0x2460df,'limit':0x1,'order':[['updatedAt',_0x8560('0x97')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x8560('0x20')](handleEntityNotFound(_0x340050,null))[_0x8560('0x20')](function(_0x9ce799){if(_0x9ce799&&_0x9ce799[_0x8560('0x98')]){_0x49a573[_0x8560('0x99')]=_0x9ce799;_0x49a573['applications']=_0x9ce799[_0x8560('0x9a')];_0x49a573[_0x8560('0x9b')]=_0x9ce799['List'];_0x49a573[_0x8560('0x9c')]=_[_0x8560('0x9d')](_0x49a573[_0x8560('0x9c')],[_0x8560('0x9e')],['asc']);if(_0x49a573[_0x8560('0x99')][_0x8560('0x9a')]){delete _0x49a573[_0x8560('0x99')][_0x8560('0x9a')];}if(_0x49a573[_0x8560('0x99')][_0x8560('0x98')]&&_0x49a573[_0x8560('0x99')]['List'][_0x8560('0x96')][_0x8560('0x49')]){return _0x49a573['account'][_0x8560('0x98')][_0x8560('0x96')][0x0];}var _0x2fa213=_[_0x8560('0x19')](_0x2cdc45[_0x8560('0x59')],{'firstName':_0x2cdc45[_0x8560('0x59')][_0x8560('0x94')],'ListId':_0x9ce799[_0x8560('0x90')]});_0x2fa213[_0x2cdc45[_0x8560('0x59')][_0x8560('0x93')]]=_0x2cdc45['body'][_0x8560('0x94')];return db[_0x8560('0x89')]['create'](_0x2fa213,{'fields':_0x2cbd6d,'raw':!![]});}})['then'](handleEntityNotFound(_0x340050,null))[_0x8560('0x20')](function(_0x2f1212){_0x49a573[_0x8560('0x9f')]=_0x2f1212;var _0x5c6458=_0x2cdc45[_0x8560('0x59')]['customerIp'];if(_0x2cdc45[_0x8560('0xa0')]['cf-connecting-ip']){_0x5c6458=_0x2cdc45['headers'][_0x8560('0xa1')];}else if(_0x2cdc45['headers'][_0x8560('0xa2')]){_0x5c6458=_[_0x8560('0xa3')](_0x2cdc45[_0x8560('0xa0')]['x-forwarded-for'][_0x8560('0xa4')](','));}if(_0x2f1212){var _0xb90bdc={'ContactId':_0x2f1212['id'],'ChatWebsiteId':_0x2cdc45[_0x8560('0x5f')]['id'],'from':(_0x2f1212[_0x8560('0xa5')]||'')+'\x20'+(_0x2f1212[_0x8560('0xa6')]||''),'customerIp':_0x5c6458,'customerPort':_0x2cdc45['headers'][_0x8560('0xa7')]?_0x2cdc45[_0x8560('0xa0')][_0x8560('0xa7')]:null,'referer':_0x2cdc45['body'][_0x8560('0xa8')],'browserName':_0x38f7e9['browser']['name']&&_0x38f7e9[_0x8560('0xa9')][_0x8560('0xaa')]?util[_0x8560('0xab')](_0x8560('0xac'),_0x38f7e9[_0x8560('0xa9')]['name'],_0x38f7e9[_0x8560('0xa9')][_0x8560('0xaa')]):_0x8560('0xad'),'browserVersion':_0x38f7e9[_0x8560('0xa9')][_0x8560('0xaa')]||_0x8560('0xad'),'osName':util[_0x8560('0xab')](_0x8560('0xac'),_0x38f7e9['os'][_0x8560('0x39')],_0x38f7e9['os'][_0x8560('0xaa')]),'osVersion':_0x38f7e9['os'][_0x8560('0xaa')],'deviceModel':_0x38f7e9[_0x8560('0xae')][_0x8560('0x43')]&&_0x38f7e9['device'][_0x8560('0xaf')]?util['format'](_0x8560('0xb0'),_0x38f7e9[_0x8560('0xae')][_0x8560('0x43')],_0x38f7e9['device'][_0x8560('0xaf')],_0x38f7e9[_0x8560('0xae')][_0x8560('0x41')]):null,'deviceVendor':_0x38f7e9[_0x8560('0xae')][_0x8560('0xaf')],'deviceType':_0x38f7e9[_0x8560('0xae')][_0x8560('0x41')],'formData':JSON[_0x8560('0xb1')](_0x2cdc45[_0x8560('0x59')])};var _0x34449b={'ChatWebsiteId':_0x2cdc45['params']['id'],'closed':![]};if(_0x2cdc45['body'][_0x8560('0xb2')]){_0x34449b[_0x8560('0xb2')]=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb2')];return db['ChatInteraction'][_0x8560('0x57')]({'where':_0x34449b})[_0x8560('0x20')](function(_0x1ed389){if(_0x1ed389){return[_0x1ed389,![]];}_0xb90bdc['threadId']=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb2')];_0xb90bdc[_0x8560('0xb3')]=_0x2cdc45[_0x8560('0x59')]['externalUrl'];return db[_0x8560('0xb4')][_0x8560('0x58')](_0xb90bdc)['then'](function(_0x40bf33){return[_0x40bf33,!![]];});});}_0x34449b['ContactId']=_0x2f1212['id'];if(_0x2cdc45[_0x8560('0x59')]['interaction']&&_0x2cdc45[_0x8560('0x59')][_0x8560('0xb5')]['id']){_0x34449b['id']=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb5')]['id'];return db[_0x8560('0xb4')][_0x8560('0x57')]({'where':_0x34449b})[_0x8560('0x20')](function(_0x564fd5){if(_0x564fd5){return[_0x564fd5,![]];}return db[_0x8560('0xb4')]['create'](_0xb90bdc)['then'](function(_0x38d822){return[_0x38d822,!![]];});});}return db[_0x8560('0xb4')][_0x8560('0x58')](_0xb90bdc)[_0x8560('0x20')](function(_0x3e3766){return[_0x3e3766,!![]];});}})[_0x8560('0xb6')](function(_0x2a7840,_0x4f0fd5){if(_0x2a7840){_0x466eef=_0x4f0fd5;if(!_0x4f0fd5){var _0xda054c={'from':(_0x49a573['contact'][_0x8560('0xa5')]||'')+'\x20'+(_0x49a573[_0x8560('0x9f')][_0x8560('0xa6')]||'')};if(_0x2cdc45[_0x8560('0x59')][_0x8560('0xb2')]&&_0x2cdc45['body']['messageId']&&_0x2cdc45[_0x8560('0x59')][_0x8560('0xb2')]!=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb7')]){_0xda054c['threadId']=_0x2cdc45[_0x8560('0x59')][_0x8560('0xb7')];}return _0x2a7840[_0x8560('0x35')](_0xda054c);}else{return _0x2a7840;}}})['then'](function(_0x10cd9b){_0x49a573[_0x8560('0xb5')]=_0x10cd9b[_0x8560('0xb8')]({'plain':!![]});_0x49a573[_0x8560('0xb5')][_0x8560('0xb9')]=_0x466eef;if(_0x49a573['interaction'][_0x8560('0xb9')]){if(_0x49a573[_0x8560('0x99')][_0x8560('0xba')]){_0x49a573[_0x8560('0x9c')][_0x8560('0xbb')]({'id':0x0,'priority':_0x49a573[_0x8560('0x9c')][_0x8560('0x49')]+0x1,'app':'close','appdata':_0x8560('0xbc'),'interval':_0x8560('0xbd')});}}return db[_0x8560('0xbe')][_0x8560('0x58')]({'body':_0x2cdc45[_0x8560('0x59')][_0x8560('0x59')],'ChatWebsiteId':_0x2cdc45['params']['id'],'ChatInteractionId':_0x10cd9b['id'],'direction':'in','ContactId':_0x49a573[_0x8560('0x9f')]['id'],'AttachmentId':_0x2cdc45[_0x8560('0x59')][_0x8560('0xbf')]});})[_0x8560('0x20')](function(_0x532a91){_0x49a573['message']=_0x532a91;if(_0x49a573[_0x8560('0xb5')][_0x8560('0xc0')]){return db[_0x8560('0xc1')][_0x8560('0x57')]({'attributes':['id',_0x8560('0x39')],'where':{'id':_0x49a573[_0x8560('0xb5')][_0x8560('0xc0')]}})[_0x8560('0x20')](function(_0x4d06d1){if(_0x4d06d1){_0x49a573[_0x8560('0x9c')][_0x8560('0xc2')]({'id':0x0,'priority':0x0,'app':_0x8560('0xc3'),'appdata':_0x4d06d1[_0x8560('0x39')]+','+(_0x49a573['account'][_0x8560('0xc4')]||0xa),'interval':_0x8560('0xbd')});_0x49a573[_0x8560('0xc5')]=!![];}return respondWithRpcPromise(_0x8560('0xc6'),_0x8560('0xc7'),_0x49a573);});}return respondWithRpcPromise(_0x8560('0xc6'),_0x8560('0xc7'),_0x49a573);})[_0x8560('0x20')](function(_0x417ba2){respondWithRpcPromise(_0x8560('0xc8'),_0x8560('0xc8'),{'event':'notify','message':_0x417ba2},client9002);return _0x417ba2;})[_0x8560('0x20')](respondWithResult(_0x340050,null))[_0x8560('0x29')](handleError(_0x340050,null));};exports[_0x8560('0xc9')]=function(_0x127574,_0x4646f3,_0x30b54d){var _0x99b86b,_0x15ab28,_0x3cda30;var _0x5e72f6=[];var _0x46a36a=[];var _0x5ae119={};var _0x5efda9=_0x127574[_0x8560('0xca')]||[];var _0x35e8f8=[];var _0x434877;return db[_0x8560('0x89')][_0x8560('0x60')]()['then'](function(_0xc2462d){if(!_0xc2462d){throw new db['Sequelize'][(_0x8560('0x91'))](_0x8560('0x8b'));}_0x46a36a=_[_0x8560('0x8c')](_['keys'](_0xc2462d),[_0x8560('0x8e'),'updatedAt']);_0x5e72f6=_['difference'](_[_0x8560('0x44')](_0xc2462d),[_0x8560('0x8e'),'updatedAt',_0x8560('0x8f'),'ListId']);if(_0x127574[_0x8560('0x59')]['id']){delete _0x127574[_0x8560('0x59')]['id'];}if(_[_0x8560('0x7b')](_0x127574[_0x8560('0x59')][_0x8560('0x94')])){throw _0x4646f3[_0x8560('0x2b')](0x1f4)[_0x8560('0xcb')](new db[(_0x8560('0x8a'))][(_0x8560('0x91'))](_0x8560('0xcc')));}if(_[_0x8560('0x7b')](_0x127574[_0x8560('0x59')][_0x8560('0x59')])||_0x127574[_0x8560('0x59')]['body']===''){throw _0x4646f3['status'](0x1f4)[_0x8560('0xcb')](new db[(_0x8560('0x8a'))][(_0x8560('0x91'))](_0x8560('0xcd')));}if(_[_0x8560('0x7b')](_0x127574[_0x8560('0x59')][_0x8560('0xce')])){throw _0x4646f3['status'](0x1f4)[_0x8560('0xcb')](new db[(_0x8560('0x8a'))][(_0x8560('0x91'))](_0x8560('0xcf')+_0x5e72f6));}if(!_[_0x8560('0xd0')](_0x5e72f6,_0x127574[_0x8560('0x59')][_0x8560('0xce')])){throw _0x4646f3['status'](0x1f4)[_0x8560('0xcb')](new db[(_0x8560('0x8a'))][(_0x8560('0x91'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e72f6));}_0x5ae119[_0x127574['body']['mapKeyOffline']]=_0x127574[_0x8560('0x59')][_0x8560('0x94')];})[_0x8560('0x20')](function(){return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x127574[_0x8560('0x5f')]['id']},'include':[{'model':db[_0x8560('0x95')],'as':_0x8560('0x98')},{'model':db[_0x8560('0xd1')],'as':_0x8560('0xd1')}]});})[_0x8560('0x20')](handleEntityNotFound(_0x4646f3,null))[_0x8560('0x20')](function(_0x4103e7){if(_0x4103e7&&_0x4103e7['List']){_0x15ab28=_0x4103e7;var _0x4ed7e4=_[_0x8560('0x19')](_0x127574[_0x8560('0x59')],{'firstName':_0x127574['body']['from'],'phone':_0x127574[_0x8560('0x59')]['from'],'ListId':_0x4103e7['ListId']});_0x4ed7e4[_0x127574[_0x8560('0x59')][_0x8560('0xce')]]=_0x127574['body'][_0x8560('0x94')];return db['CmContact']['findOrCreate']({'where':_0x5ae119,'defaults':_0x4ed7e4});}})[_0x8560('0xb6')](function(_0x4e0562){if(_0x4e0562){_0x3cda30=_0x4e0562;var _0x4f4936=fs[_0x8560('0xd2')](path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0xd3')),_0x8560('0xd4'));var _0x51fbce=ejs[_0x8560('0xd5')](_0x4f4936,{'body':_[_0x8560('0xd6')](_0x127574['body'][_0x8560('0x59')]),'bodyTitle':_0x15ab28[_0x8560('0xd7')]});return db[_0x8560('0xd8')]['create']({'body':_0x51fbce,'ContactId':_0x4e0562['id'],'ChatWebsiteId':_0x15ab28['id']});}})[_0x8560('0x20')](function(_0x1a73d7){_0x434877=_0x1a73d7;if(_0x5efda9[_0x8560('0x49')]){var _0x52261b=_0x5efda9[_0x8560('0x3d')](function(_0x524f70){return{'name':_0x524f70[_0x8560('0xd9')],'basename':_0x524f70[_0x8560('0x70')],'type':_0x524f70[_0x8560('0xda')],'ChatOfflineMessageId':_0x1a73d7['id']};});_0x35e8f8=_0x52261b[_0x8560('0x3d')](_0x3ea7d6=>{var _0xd801a={'filename':_0x3ea7d6['name'],'path':path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0xdb'),_0x8560('0xca'),_0x8560('0xdc'),_0x8560('0xdd'),_0x3ea7d6['basename'])};return _0xd801a;});if(!_0x15ab28[_0x8560('0xde')]){return db[_0x8560('0xdf')][_0x8560('0xe0')](function(_0x19059d){return db['Attachment']['bulkCreate'](_0x52261b,{'transaction':_0x19059d});});}}})[_0x8560('0x20')](function(){if(_0x434877){_0x99b86b=_0x434877;return db['MailAccount'][_0x8560('0x6c')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0x8560('0xe1'),'raw':!![]}]});}})['then'](function(_0x5df022){if(_0x5df022&&_0x5df022[_0x8560('0xe1')]&&_0x15ab28[_0x8560('0xe2')]&&_0x15ab28[_0x8560('0xe3')]){var _0x849c41={'tls':{'rejectUnauthorized':![]}};if(_0x5df022[_0x8560('0xe1')][_0x8560('0xe4')]){_0x849c41[_0x8560('0xe4')]=_0x5df022[_0x8560('0xe1')][_0x8560('0xe4')];}else{_0x849c41[_0x8560('0xe5')]=_0x5df022['Smtp'][_0x8560('0xe5')];_0x849c41[_0x8560('0xe6')]=_0x5df022['Smtp'][_0x8560('0xe6')];_0x849c41[_0x8560('0xe7')]=_0x5df022[_0x8560('0xe1')][_0x8560('0xe7')];}if(_0x5df022[_0x8560('0xe1')][_0x8560('0xe8')]){_0x849c41[_0x8560('0xe9')]={'user':_0x5df022['Smtp'][_0x8560('0x5a')],'pass':_0x5df022[_0x8560('0xe1')][_0x8560('0xea')]};}return respondWithRpcPromise(_0x8560('0xeb'),_0x8560('0xec'),{'account':_0x849c41,'message':{'from':util[_0x8560('0xab')](_0x8560('0xed'),_0x5df022[_0x8560('0x39')],_0x5df022[_0x8560('0xee')]||_0x5df022[_0x8560('0xe1')][_0x8560('0x5a')]),'to':_0x15ab28[_0x8560('0xe3')],'subject':_0x15ab28['offlineMessageSubject'],'html':_0x99b86b[_0x8560('0x59')],'attachments':_0x35e8f8}},client9003)['then'](function(){return _0x99b86b;})['catch'](function(_0x3c093a){console[_0x8560('0x25')](_0x3c093a);});}})[_0x8560('0x20')](function(){if(_0x15ab28&&_0x15ab28[_0x8560('0xde')]&&_0x15ab28[_0x8560('0xef')]){var _0x492023=[];if(_0x5efda9[_0x8560('0x49')]){_0x492023=_0x5efda9[_0x8560('0x3d')](function(_0x12c8a0){return{'name':_0x12c8a0[_0x8560('0xd9')],'basename':_0x12c8a0['filename'],'type':_0x12c8a0[_0x8560('0xda')],'ChatOfflineMessageId':_0x434877['id']};});}var _0xf2cea3;if(!_[_0x8560('0x7b')](_0x15ab28[_0x8560('0xf0')])){var _0x33501b=_[_0x8560('0x3d')](_0x127574[_0x8560('0x59')],function(_0x4c1c73){return _0x4c1c73;});var _0x2147e8=_['toPairsIn'](_0x33501b)[0x0];var _0x2603f8=_[_0x8560('0xf1')](_0x2147e8,function(_0x3f63cd){return _0x3f63cd;});_0xf2cea3=_0x2603f8[0x1][_0x15ab28[_0x8560('0xf0')]];}var _0x1652fd={'from':_0x3cda30[_0x8560('0xee')],'firstName':_0x3cda30['firstName'],'lastName':_0x3cda30[_0x8560('0xa6')],'mapKey':_0x8560('0xee'),'message':{'from':_0x3cda30[_0x8560('0xee')],'to':_0x15ab28[_0x8560('0xd1')][_0x8560('0xee')],'cc':'','subject':_[_0x8560('0x7b')](_0xf2cea3)?_0x15ab28[_0x8560('0xf2')]:_0xf2cea3,'messageId':'','sentAt':new Date(),'attach':_0x492023[_0x8560('0x49')],'attachments':_0x492023,'originChannel':'Chat','ChatWebsiteId':_0x15ab28['id'],'ChatOfflineMessageId':_0x99b86b['id'],'originTo':_0x15ab28['MailAccount'][_0x8560('0xee')]},'body':_0x99b86b[_0x8560('0x59')]};var _0x29e5d2={'account':{'id':_0x15ab28[_0x8560('0xef')]},'body':_0x1652fd,'log':_0x8560('0xf3')};return respondWithRpcPromise(_0x8560('0xf3'),_0x8560('0xf4'),_0x29e5d2,client9001)[_0x8560('0x20')](function(){return _0x99b86b;})['catch'](function(_0x4cc1e2){console['error'](_0x4cc1e2);});}return;})[_0x8560('0x20')](function(){if(_0x99b86b){return _0x99b86b;}})[_0x8560('0x20')](respondWithResult(_0x4646f3,null))['catch'](function(_0x59a3c9){console[_0x8560('0x25')](_0x8560('0x29'),_0x59a3c9);for(var _0x394b17 of _0x5efda9){var _0x141d9a=path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0xdb'),'files',_0x8560('0xdc'),_0x8560('0xdd'),_0x394b17[_0x8560('0x70')]);fs_extra['remove'](_0x141d9a)[_0x8560('0x29')](function(_0x2df487){console[_0x8560('0x25')](_0x8560('0xf5'),_0x141d9a,_0x2df487);});}});};exports[_0x8560('0xf6')]=function(_0x2cbdce,_0x1a6c51,_0x4e5d12){return db[_0x8560('0xb4')][_0x8560('0x57')]({'where':{'id':_0x2cbdce['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x1a6c51,null))[_0x8560('0x20')](function(_0x3d93fc){if(_0x3d93fc){return _0x3d93fc[_0x8560('0xf6')](_0x2cbdce[_0x8560('0x59')][_0x8560('0x68')],_['omit'](_0x2cbdce[_0x8560('0x59')],[_0x8560('0x68'),'id'])||{});}})['then'](respondWithResult(_0x1a6c51,null))['catch'](handleError(_0x1a6c51,null));};exports[_0x8560('0xf7')]=function(_0x427fe3,_0x41ac6b,_0x477d27){var _0x383038={'raw':![],'where':{}};var _0x32fcfa={};var _0x58cfc9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8560('0x6c')]({'where':{'id':_0x427fe3[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x41ac6b,null))[_0x8560('0x20')](function(_0xe15eb){if(_0xe15eb){_0x32fcfa['model']=_[_0x8560('0x44')](db[_0x8560('0xb4')][_0x8560('0x3f')]);_0x32fcfa[_0x8560('0x45')]=_[_0x8560('0x44')](_0x427fe3[_0x8560('0x45')]);_0x32fcfa[_0x8560('0x4e')]=_[_0x8560('0x46')](_0x32fcfa[_0x8560('0x43')],_0x32fcfa['query']);_0x383038[_0x8560('0x47')]=_['intersection'](_0x32fcfa[_0x8560('0x43')],qs[_0x8560('0x48')](_0x427fe3[_0x8560('0x45')]['fields']));_0x383038['attributes']=_0x383038[_0x8560('0x47')][_0x8560('0x49')]?_0x383038[_0x8560('0x47')]:_0x32fcfa[_0x8560('0x43')];if(!_0x427fe3[_0x8560('0x45')][_0x8560('0x4a')](_0x8560('0x65'))){_0x383038[_0x8560('0x2f')]=qs['limit'](_0x427fe3['query']['limit']);_0x383038[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0x427fe3[_0x8560('0x45')][_0x8560('0x2d')]);}_0x383038['order']=qs[_0x8560('0x4c')](_0x427fe3[_0x8560('0x45')][_0x8560('0x4c')]);_0x383038['where']=qs['filters'](_[_0x8560('0x66')](_0x427fe3[_0x8560('0x45')],_0x32fcfa['filters']));_0x383038[_0x8560('0x4d')][_0x8560('0x62')]=_0xe15eb['id'];if(_0x427fe3[_0x8560('0x45')][_0x8560('0x4f')]){_0x383038[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x383038[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x383038[_0x8560('0x47')],function(_0x5b3645){var _0x2ab474={};_0x2ab474[_0x5b3645]={'$like':'%'+_0x427fe3[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x2ab474;})});}_0x383038=_[_0x8560('0x50')]({},_0x383038,_0x427fe3['options']);return db[_0x8560('0xb4')]['count']({'where':_0x383038[_0x8560('0x4d')]})[_0x8560('0x20')](function(_0x593511){_0x58cfc9[_0x8560('0x30')]=_0x593511;if(_0x427fe3[_0x8560('0x45')][_0x8560('0x53')]){_0x383038[_0x8560('0x54')]=[{'model':db[_0x8560('0x89')],'as':_0x8560('0xf8'),'required':![]},{'model':db[_0x8560('0xc1')],'as':_0x8560('0xf9'),'attributes':['name',_0x8560('0xfa'),_0x8560('0xfb')],'required':![]},{'model':db[_0x8560('0xfc')],'as':_0x8560('0xfd'),'attributes':['id',_0x8560('0x39'),_0x8560('0xfe')],'where':_0x427fe3[_0x8560('0x45')]['tag']?{'id':_0x427fe3['query'][_0x8560('0xff')]}:undefined,'required':_0x427fe3['query']['tag']?!![]:![]}];}return db[_0x8560('0xb4')][_0x8560('0x55')](_0x383038);})['then'](function(_0x3852ac){_0x58cfc9[_0x8560('0x56')]=_0x3852ac;return _0x58cfc9;});}})[_0x8560('0x20')](respondWithFilteredResult(_0x41ac6b,_0x383038))['catch'](handleError(_0x41ac6b,null));};function iftimePromise(_0x5967f2,_0x583860){return respondWithRpcPromise(_0x8560('0x100'),_0x8560('0x101'),{'command':_0x583860['timezone']?util[_0x8560('0xab')](_0x8560('0x102'),_0x5967f2[_0x8560('0x103')],_0x583860[_0x8560('0x104')]):util[_0x8560('0xab')]('iftime\x20%s',_0x5967f2[_0x8560('0x103')])},client9002)['then'](function(_0x4f118f){var _0x1ea28f=_0x4f118f&&_0x4f118f[_0x8560('0x105')](_0x8560('0x106'))>=0x0?!![]:![];logger[_0x8560('0x27')](_0x8560('0x107'),_0x583860['id'],_0x5967f2['id'],_0x5967f2[_0x8560('0x103')],_0x1ea28f?_0x8560('0x108'):_0x8560('0x109'),_0x583860[_0x8560('0x104')]?_0x583860[_0x8560('0x104')]:_0x8560('0x10a'));return _0x1ea28f;})[_0x8560('0x29')](function(_0x1a2a3f){logger[_0x8560('0x25')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x583860['id'],_0x5967f2['id'],_0x5967f2['interval'],util[_0x8560('0x10b')](_0x1a2a3f,{'showHidden':![],'depth':null}),_0x583860[_0x8560('0x104')]?_0x583860['timezone']:_0x8560('0x10a'));return![];});}exports[_0x8560('0x101')]=function(_0x4d907e,_0x3bed23,_0x1dd971){var _0x1bed67=0x0;var _0x1cbe3e=0x0;var _0x137d49=![];var _0x234ce7;var _0x33256c;return db[_0x8560('0x3e')]['find']({'where':{'id':_0x4d907e['params']['id']},'include':[{'model':db[_0x8560('0x10c')],'as':'Interval','include':[{'model':db[_0x8560('0x10c')],'as':_0x8560('0x10d'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x8560('0x20')](handleEntityNotFound(_0x3bed23,null))[_0x8560('0x20')](function(_0xb3191b){if(_0xb3191b){_0x234ce7=_0xb3191b;return _0xb3191b['getProactiveActions']({'raw':!![]});}})['then'](function(_0x1f0981){if(_0x234ce7){if(_0x1f0981){_0x33256c=_0x1f0981;}}return require(_0x8560('0x10e'))[_0x8560('0x10f')]();})['then'](function(_0x1e2f13){if(_0x1e2f13){_0x1cbe3e=_0x1e2f13[_0x8560('0x110')];_0x137d49=_0x1e2f13[_0x8560('0x7a')];}})[_0x8560('0x20')](function(){return db[_0x8560('0xb4')][_0x8560('0x30')]({'where':{'closed':![]}});})[_0x8560('0x20')](function(_0x38a17a){_0x1bed67=_0x38a17a;if(_0x1cbe3e&&_0x38a17a>_0x1cbe3e){return db[_0x8560('0x111')][_0x8560('0x6c')]({'where':{'id':0x1}})[_0x8560('0x20')](function(_0x3a6f48){if(_0x3a6f48){_0x3a6f48[_0x8560('0x112')]('chatLicenseExceeded');}});}})[_0x8560('0x20')](function(){if(_0x234ce7[_0x8560('0x10c')]&&_0x234ce7[_0x8560('0x10c')][_0x8560('0x10d')]){var _0x142eef=[];for(var _0x2d9802=0x0;_0x2d9802<_0x234ce7[_0x8560('0x10c')]['Intervals']['length'];_0x2d9802++){var _0xe7570=_0x234ce7[_0x8560('0x10c')][_0x8560('0x10d')][_0x2d9802]['get']({'plain':!![]});_0x142eef['push'](iftimePromise(_0xe7570,_0x234ce7));}return BPromise[_0x8560('0x113')](_0x142eef)[_0x8560('0x20')](function(_0x52f878){return _['some'](_0x52f878);});}else{return!![];}})[_0x8560('0x20')](function(_0x3a5231){var _0x519335=fs['readFileSync'](path[_0x8560('0x7c')](config[_0x8560('0x78')],_0x8560('0x114')),_0x8560('0xd4'));var _0x31fe79={'remote':_0x234ce7[_0x8560('0x115')],'query':querystring[_0x8560('0xb1')](_[_0x8560('0x50')](_0x234ce7[_0x8560('0xb8')]({'plain':!![]}),{'customerIp':_0x4d907e[_0x8560('0xa0')][_0x8560('0xa2')]||_0x4d907e[_0x8560('0xa0')][_0x8560('0x116')]||_0x4d907e['connection'][_0x8560('0x117')]||_0x4d907e['ip'],'referer':_0x4d907e[_0x8560('0xa0')]['referer'],'openedInteractions':_0x1bed67,'maxInteractions':_0x1cbe3e,'virtual':_0x137d49[_0x8560('0x110')],'online':_0x3a5231,'custom':_0x137d49}))[_0x8560('0x118')](/'/g,'\x5c\x27')};_0x3bed23[_0x8560('0xcb')](ejs['render'](Mustache['render'](_0x519335,_0x31fe79),{'proactiveActions':_0x33256c,'alignment':_0x234ce7[_0x8560('0x119')],'verticalAlignment':_0x234ce7['verticalAlignment'],'div_color':_0x234ce7[_0x8560('0xfe')],'text_color':_0x234ce7[_0x8560('0x11a')],'button_color':_0x234ce7[_0x8560('0x11b')],'background_color':_0x234ce7['backgroundColor']}));})[_0x8560('0x29')](handleError(_0x3bed23,null));};exports[_0x8560('0x11c')]=function(_0x535e20,_0x4c0a7e,_0x5a6058){return db['ChatWebsite'][_0x8560('0x6c')]({'where':{'id':_0x535e20[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x4c0a7e,null))[_0x8560('0x20')](function(_0x2b5ef1){if(_0x2b5ef1){return db[_0x8560('0xdf')][_0x8560('0xe0')](function(_0x332684){return db[_0x8560('0x11d')]['destroy']({'where':{'ChatWebsiteId':_0x535e20['params']['id']},'transaction':_0x332684})['then'](function(_0x5ec5c0){var _0x5dc3fd=_[_0x8560('0x3d')](_0x535e20[_0x8560('0x59')],function(_0x2aa156){_0x2aa156['ChatWebsiteId']=_0x535e20[_0x8560('0x5f')]['id'];return _0x2aa156;});return db[_0x8560('0x11d')][_0x8560('0x11e')](_0x5dc3fd,{'transaction':_0x332684});});})['then'](function(){return db[_0x8560('0x11d')][_0x8560('0x11f')]({'where':{'ChatWebsiteId':_0x535e20['params']['id']},'order':_0x8560('0x9e')});});}})[_0x8560('0x20')](respondWithResult(_0x4c0a7e,null))['catch'](handleError(_0x4c0a7e,null));};exports[_0x8560('0x120')]=function(_0x230379,_0x2fcef4,_0x108c3b){var _0x97b65d={};var _0x3aa14c={};var _0x3a73ed;var _0x167902;return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0x230379[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x2fcef4,null))[_0x8560('0x20')](function(_0x3023fe){if(_0x3023fe){_0x3a73ed=_0x3023fe;_0x3aa14c[_0x8560('0x43')]=_[_0x8560('0x44')](db[_0x8560('0x11d')][_0x8560('0x3f')]);_0x3aa14c[_0x8560('0x45')]=_[_0x8560('0x44')](_0x230379['query']);_0x3aa14c[_0x8560('0x4e')]=_['intersection'](_0x3aa14c[_0x8560('0x43')],_0x3aa14c[_0x8560('0x45')]);_0x97b65d[_0x8560('0x47')]=_['intersection'](_0x3aa14c[_0x8560('0x43')],qs[_0x8560('0x48')](_0x230379[_0x8560('0x45')]['fields']));_0x97b65d[_0x8560('0x47')]=_0x97b65d['attributes'][_0x8560('0x49')]?_0x97b65d[_0x8560('0x47')]:_0x3aa14c['model'];_0x97b65d[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0x230379[_0x8560('0x45')][_0x8560('0x4c')]);_0x97b65d[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0x230379[_0x8560('0x45')],_0x3aa14c[_0x8560('0x4e')]));if(_0x230379[_0x8560('0x45')][_0x8560('0x4f')]){_0x97b65d[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x97b65d[_0x8560('0x4d')],{'$or':_['map'](_0x97b65d['attributes'],function(_0x3b1409){var _0x3261cd={};_0x3261cd[_0x3b1409]={'$like':'%'+_0x230379[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x3261cd;})});}_0x97b65d=_[_0x8560('0x50')]({},_0x97b65d,_0x230379[_0x8560('0x52')]);return _0x3a73ed[_0x8560('0x120')](_0x97b65d);}})[_0x8560('0x20')](function(_0x4dc65a){if(_0x4dc65a){_0x167902=_0x4dc65a[_0x8560('0x49')];if(!_0x230379[_0x8560('0x45')][_0x8560('0x4a')](_0x8560('0x65'))){_0x97b65d[_0x8560('0x2f')]=qs[_0x8560('0x2f')](_0x230379[_0x8560('0x45')][_0x8560('0x2f')]);_0x97b65d[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0x230379[_0x8560('0x45')][_0x8560('0x2d')]);}return _0x3a73ed[_0x8560('0x120')](_0x97b65d);}})[_0x8560('0x20')](function(_0x1f0529){if(_0x1f0529){return _0x1f0529?{'count':_0x167902,'rows':_0x1f0529}:null;}})[_0x8560('0x20')](respondWithResult(_0x2fcef4,null))[_0x8560('0x29')](handleError(_0x2fcef4,null));};exports[_0x8560('0x121')]=function(_0x40b156,_0x17070f,_0xb2b69e){return db[_0x8560('0x122')][_0x8560('0x57')]({'where':{'id':_0x40b156['params']['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x17070f,null))[_0x8560('0x20')](function(_0x567233){if(_0x567233){return _0x567233[_0x8560('0x121')](_0x40b156[_0x8560('0x59')][_0x8560('0x68')],_[_0x8560('0x123')](_0x40b156[_0x8560('0x59')],[_0x8560('0x68'),'id'])||{});}})[_0x8560('0x20')](respondWithResult(_0x17070f,null))[_0x8560('0x29')](handleError(_0x17070f,null));};exports[_0x8560('0x124')]=function(_0x1f4bb8,_0x101c76,_0x3279d4){var _0x3730b2={};var _0x113507={};var _0x1d8c77;var _0x545dcd;return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0x1f4bb8[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x101c76,null))[_0x8560('0x20')](function(_0x1c3f13){if(_0x1c3f13){_0x1d8c77=_0x1c3f13;_0x113507['model']=_[_0x8560('0x44')](db[_0x8560('0x125')][_0x8560('0x3f')]);_0x113507['query']=_[_0x8560('0x44')](_0x1f4bb8[_0x8560('0x45')]);_0x113507[_0x8560('0x4e')]=_[_0x8560('0x46')](_0x113507['model'],_0x113507['query']);_0x3730b2[_0x8560('0x47')]=_['intersection'](_0x113507[_0x8560('0x43')],qs['fields'](_0x1f4bb8[_0x8560('0x45')][_0x8560('0x48')]));_0x3730b2[_0x8560('0x47')]=_0x3730b2[_0x8560('0x47')][_0x8560('0x49')]?_0x3730b2['attributes']:_0x113507[_0x8560('0x43')];_0x3730b2[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0x1f4bb8[_0x8560('0x45')]['sort']);_0x3730b2[_0x8560('0x4d')]=qs['filters'](_['pick'](_0x1f4bb8['query'],_0x113507[_0x8560('0x4e')]));if(_0x1f4bb8['query'][_0x8560('0x4f')]){_0x3730b2[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x3730b2['where'],{'$or':_['map'](_0x3730b2[_0x8560('0x47')],function(_0x29c203){var _0x545b08={};_0x545b08[_0x29c203]={'$like':'%'+_0x1f4bb8[_0x8560('0x45')][_0x8560('0x4f')]+'%'};return _0x545b08;})});}_0x3730b2=_['merge']({},_0x3730b2,_0x1f4bb8[_0x8560('0x52')]);return _0x1d8c77[_0x8560('0x124')](_0x3730b2);}})[_0x8560('0x20')](function(_0x5dba){if(_0x5dba){_0x545dcd=_0x5dba[_0x8560('0x49')];if(!_0x1f4bb8[_0x8560('0x45')]['hasOwnProperty'](_0x8560('0x65'))){_0x3730b2[_0x8560('0x2f')]=qs[_0x8560('0x2f')](_0x1f4bb8[_0x8560('0x45')][_0x8560('0x2f')]);_0x3730b2[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0x1f4bb8[_0x8560('0x45')][_0x8560('0x2d')]);}return _0x1d8c77['getProactiveActions'](_0x3730b2);}})[_0x8560('0x20')](function(_0x658dc7){if(_0x658dc7){return _0x658dc7?{'count':_0x545dcd,'rows':_0x658dc7}:null;}})['then'](respondWithResult(_0x101c76,null))[_0x8560('0x29')](handleError(_0x101c76,null));};exports[_0x8560('0x126')]=function(_0x58d354,_0x5dc2a0,_0x3425d1){var _0x2ae939=_0x58d354[_0x8560('0x45')][_0x8560('0x127')]===_0x8560('0x128')?_0x8560('0x129'):_0x8560('0x12a');return db[_0x8560('0x3e')]['find']({'attributes':['id',_0x2ae939],'where':{'id':_0x58d354[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x5dc2a0,null))[_0x8560('0x20')](function(_0x34e963){if(_0x34e963){var _0x557b24=_0x34e963[_0x2ae939];var _0x3da65c=_0x557b24&&_0x557b24[_0x8560('0x12b')]?_0x557b24[_0x8560('0x12b')]:[];_0x5dc2a0['send']({'fromKey':_['isNil'](_0x557b24[_0x8560('0x12c')])?undefined:_0x557b24['fromKey'],'count':_0x3da65c[_0x8560('0x49')],'rows':_0x3da65c});}})[_0x8560('0x29')](handleError(_0x5dc2a0,null));};exports['getOfflineMessages']=function(_0x4843b9,_0x2980a6,_0x65ff36){var _0x11c5a3={'raw':![],'where':{}};var _0x25710c={};var _0x1becc7={'count':0x0,'rows':[]};return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0x4843b9[_0x8560('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2980a6,null))[_0x8560('0x20')](function(_0x2d33fb){if(_0x2d33fb){_0x25710c['model']=_[_0x8560('0x44')](db['ChatOfflineMessage'][_0x8560('0x3f')]);_0x25710c[_0x8560('0x45')]=_[_0x8560('0x44')](_0x4843b9['query']);_0x25710c[_0x8560('0x4e')]=_[_0x8560('0x46')](_0x25710c['model'],_0x25710c[_0x8560('0x45')]);_0x11c5a3[_0x8560('0x47')]=_[_0x8560('0x46')](_0x25710c[_0x8560('0x43')],qs[_0x8560('0x48')](_0x4843b9[_0x8560('0x45')][_0x8560('0x48')]));_0x11c5a3[_0x8560('0x47')]=_0x11c5a3[_0x8560('0x47')][_0x8560('0x49')]?_0x11c5a3['attributes']:_0x25710c['model'];if(!_0x4843b9['query'][_0x8560('0x4a')]('nolimit')){_0x11c5a3[_0x8560('0x2f')]=qs['limit'](_0x4843b9['query'][_0x8560('0x2f')]);_0x11c5a3[_0x8560('0x2d')]=qs['offset'](_0x4843b9[_0x8560('0x45')][_0x8560('0x2d')]);}_0x11c5a3['order']=qs[_0x8560('0x4c')](_0x4843b9[_0x8560('0x45')]['sort']);_0x11c5a3[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0x4843b9[_0x8560('0x45')],_0x25710c['filters']));_0x11c5a3[_0x8560('0x4d')][_0x8560('0x62')]=_0x2d33fb['id'];if(_0x4843b9[_0x8560('0x45')]['filter']){_0x11c5a3[_0x8560('0x4d')]=_[_0x8560('0x50')](_0x11c5a3[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x11c5a3[_0x8560('0x47')],function(_0x24d192){var _0x312c6e={};_0x312c6e[_0x24d192]={'$like':'%'+_0x4843b9['query']['filter']+'%'};return _0x312c6e;})});}_0x11c5a3=_['merge']({},_0x11c5a3,_0x4843b9['options']);return db[_0x8560('0xd8')][_0x8560('0x30')]({'where':_0x11c5a3[_0x8560('0x4d')]})['then'](function(_0x560f02){_0x1becc7['count']=_0x560f02;if(_0x4843b9[_0x8560('0x45')][_0x8560('0x53')]){_0x11c5a3[_0x8560('0x54')]=[{'all':!![]}];}else{_0x11c5a3['include']=[{'model':db[_0x8560('0x89')],'as':'Contact','required':![]},{'model':db[_0x8560('0x12d')],'as':_0x8560('0x12e'),'required':![]}];}return db[_0x8560('0xd8')]['findAll'](_0x11c5a3);})[_0x8560('0x20')](function(_0x37f23f){_0x1becc7[_0x8560('0x56')]=_0x37f23f;return _0x1becc7;});}})['then'](respondWithFilteredResult(_0x2980a6,_0x11c5a3))['catch'](handleError(_0x2980a6,null));};exports['addAgents']=function(_0x1e869f,_0x3e6642,_0x214fcd){return db[_0x8560('0x3e')][_0x8560('0x57')]({'where':{'id':_0x1e869f[_0x8560('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3e6642,null))[_0x8560('0x20')](function(_0x4c4a29){if(_0x4c4a29){return _0x4c4a29[_0x8560('0x12f')](_0x1e869f[_0x8560('0x59')][_0x8560('0x68')],_['omit'](_0x1e869f[_0x8560('0x59')],[_0x8560('0x68'),'id'])||{})[_0x8560('0xb6')](function(_0x52b696){for(var _0x484a65=0x0;_0x484a65<_0x1e869f[_0x8560('0x59')]['ids'][_0x8560('0x49')];_0x484a65+=0x1){socket[_0x8560('0x130')](_0x8560('0x131'),{'UserId':Number(_0x1e869f[_0x8560('0x59')][_0x8560('0x68')][_0x484a65]),'ChatWebsiteId':Number(_0x1e869f[_0x8560('0x5f')]['id'])});}return _0x52b696;});}})[_0x8560('0x20')](respondWithResult(_0x3e6642,null))[_0x8560('0x29')](handleError(_0x3e6642,null));};exports[_0x8560('0x132')]=function(_0x4efe94,_0x2f309e,_0x493e2b){return db[_0x8560('0x3e')]['find']({'where':{'id':_0x4efe94[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x2f309e,null))['then'](function(_0x2369e8){if(_0x2369e8){return _0x2369e8['removeAgents'](_0x4efe94[_0x8560('0x45')]['ids'])['then'](function(){if(_[_0x8560('0x133')](_0x4efe94['query'][_0x8560('0x68')])){for(var _0x7d7c9d=0x0;_0x7d7c9d<_0x4efe94[_0x8560('0x45')][_0x8560('0x68')]['length'];_0x7d7c9d+=0x1){socket[_0x8560('0x130')](_0x8560('0x134'),{'UserId':Number(_0x4efe94[_0x8560('0x45')][_0x8560('0x68')][_0x7d7c9d]),'ChatWebsiteId':Number(_0x4efe94[_0x8560('0x5f')]['id'])});}}else{socket[_0x8560('0x130')](_0x8560('0x134'),{'UserId':Number(_0x4efe94[_0x8560('0x45')][_0x8560('0x68')]),'ChatWebsiteId':Number(_0x4efe94['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2f309e,null))[_0x8560('0x29')](handleError(_0x2f309e,null));};exports[_0x8560('0x135')]=function(_0xc17d88,_0x2e3d03,_0x4e330e){var _0x29e457={};var _0x5760b3={};var _0x23f1e8;var _0x31c4ff;return db[_0x8560('0x3e')][_0x8560('0x6c')]({'where':{'id':_0xc17d88[_0x8560('0x5f')]['id']}})[_0x8560('0x20')](handleEntityNotFound(_0x2e3d03,null))[_0x8560('0x20')](function(_0x46e8c9){if(_0x46e8c9){_0x23f1e8=_0x46e8c9;_0x5760b3['model']=_['keys'](db[_0x8560('0xc1')][_0x8560('0x3f')]);_0x5760b3[_0x8560('0x45')]=_['keys'](_0xc17d88[_0x8560('0x45')]);_0x5760b3[_0x8560('0x4e')]=_['intersection'](_0x5760b3['model'],_0x5760b3['query']);_0x29e457['attributes']=_[_0x8560('0x46')](_0x5760b3[_0x8560('0x43')],qs['fields'](_0xc17d88[_0x8560('0x45')]['fields']));_0x29e457[_0x8560('0x47')]=_0x29e457[_0x8560('0x47')][_0x8560('0x49')]?_0x29e457['attributes']:_0x5760b3[_0x8560('0x43')];_0x29e457[_0x8560('0x4b')]=qs[_0x8560('0x4c')](_0xc17d88[_0x8560('0x45')][_0x8560('0x4c')]);_0x29e457[_0x8560('0x4d')]=qs[_0x8560('0x4e')](_[_0x8560('0x66')](_0xc17d88[_0x8560('0x45')],_0x5760b3[_0x8560('0x4e')]));if(_0xc17d88[_0x8560('0x45')]['filter']){_0x29e457['where']=_[_0x8560('0x50')](_0x29e457[_0x8560('0x4d')],{'$or':_[_0x8560('0x3d')](_0x29e457[_0x8560('0x47')],function(_0x398672){var _0x46e759={};_0x46e759[_0x398672]={'$like':'%'+_0xc17d88['query'][_0x8560('0x4f')]+'%'};return _0x46e759;})});}_0x29e457=_[_0x8560('0x50')]({},_0x29e457,_0xc17d88[_0x8560('0x52')]);return _0x23f1e8[_0x8560('0x135')](_0x29e457);}})[_0x8560('0x20')](function(_0x4ce9ad){if(_0x4ce9ad){_0x31c4ff=_0x4ce9ad[_0x8560('0x49')];if(!_0xc17d88[_0x8560('0x45')][_0x8560('0x4a')]('nolimit')){_0x29e457[_0x8560('0x2f')]=qs['limit'](_0xc17d88[_0x8560('0x45')][_0x8560('0x2f')]);_0x29e457[_0x8560('0x2d')]=qs[_0x8560('0x2d')](_0xc17d88[_0x8560('0x45')][_0x8560('0x2d')]);}return _0x23f1e8[_0x8560('0x135')](_0x29e457);}})[_0x8560('0x20')](function(_0x52c095){if(_0x52c095){return _0x52c095?{'count':_0x31c4ff,'rows':_0x52c095}:null;}})['then'](respondWithResult(_0x2e3d03,null))[_0x8560('0x29')](handleError(_0x2e3d03,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a2ede1b..8318e3d 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 _0x3b75=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x3b75,0x144));var _0x53b7=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0x3b75[_0x263f4c];return _0x3a78d3;};'use strict';var EventEmitter=require(_0x53b7('0x0'));var ChatWebsite=require(_0x53b7('0x1'))['db'][_0x53b7('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x53b7('0x3')](0x0);var events={'afterCreate':_0x53b7('0x4'),'afterUpdate':_0x53b7('0x5'),'afterDestroy':_0x53b7('0x6')};function emitEvent(_0x145e6c){return function(_0x5a0a4a,_0x5c678a,_0xe75348){ChatWebsiteEvents[_0x53b7('0x7')](_0x145e6c+':'+_0x5a0a4a['id'],_0x5a0a4a);ChatWebsiteEvents[_0x53b7('0x7')](_0x145e6c,_0x5a0a4a);_0xe75348(null);};}for(var e in events){if(events[_0x53b7('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x3379=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5c2311,_0x24ae77){var _0x2f0ab2=function(_0x4769aa){while(--_0x4769aa){_0x5c2311['push'](_0x5c2311['shift']());}};_0x2f0ab2(++_0x24ae77);}(_0x3379,0x115));var _0x9337=function(_0x4c8543,_0x393cd4){_0x4c8543=_0x4c8543-0x0;var _0x580d91=_0x3379[_0x4c8543];return _0x580d91;};'use strict';var EventEmitter=require(_0x9337('0x0'));var ChatWebsite=require(_0x9337('0x1'))['db'][_0x9337('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9337('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9337('0x4'),'afterDestroy':_0x9337('0x5')};function emitEvent(_0x144317){return function(_0x30dcfe,_0x49ce9a,_0x45eb99){ChatWebsiteEvents[_0x9337('0x6')](_0x144317+':'+_0x30dcfe['id'],_0x30dcfe);ChatWebsiteEvents[_0x9337('0x6')](_0x144317,_0x30dcfe);_0x45eb99(null);};}for(var e in events){if(events[_0x9337('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9337('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 08e732b..abccb60 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 _0x97c8=['../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','lodash','util','api','moment','request-promise','path'];(function(_0x368590,_0x48ad74){var _0x5ceb60=function(_0x322b8e){while(--_0x322b8e){_0x368590['push'](_0x368590['shift']());}};_0x5ceb60(++_0x48ad74);}(_0x97c8,0x1a8));var _0x897c=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x97c8[_0x1a9e78];return _0x113e06;};'use strict';var _=require(_0x897c('0x0'));var util=require(_0x897c('0x1'));var logger=require('../../config/logger')(_0x897c('0x2'));var moment=require(_0x897c('0x3'));var BPromise=require('bluebird');var rp=require(_0x897c('0x4'));var fs=require('fs');var path=require(_0x897c('0x5'));var rimraf=require('rimraf');var config=require(_0x897c('0x6'));var attributes=require(_0x897c('0x7'));module[_0x897c('0x8')]=function(_0x170ccf,_0x491fc1){return _0x170ccf['define'](_0x897c('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf68c=['define','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x403168,_0x5e3ee8){var _0x1f0a82=function(_0x2da0d2){while(--_0x2da0d2){_0x403168['push'](_0x403168['shift']());}};_0x1f0a82(++_0x5e3ee8);}(_0xf68c,0x140));var _0xcf68=function(_0x4fc79e,_0x22c7de){_0x4fc79e=_0x4fc79e-0x0;var _0x9c12f8=_0xf68c[_0x4fc79e];return _0x9c12f8;};'use strict';var _=require(_0xcf68('0x0'));var util=require(_0xcf68('0x1'));var logger=require(_0xcf68('0x2'))(_0xcf68('0x3'));var moment=require('moment');var BPromise=require(_0xcf68('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf68('0x5'));var rimraf=require(_0xcf68('0x6'));var config=require(_0xcf68('0x7'));var attributes=require(_0xcf68('0x8'));module[_0xcf68('0x9')]=function(_0x3c799c,_0x1de0f3){return _0x3c799c[_0xcf68('0xa')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index b0c223e..abb071f 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 _0xf467=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then'];(function(_0x1c23ec,_0x51e9f7){var _0xf3f14=function(_0x5c22d3){while(--_0x5c22d3){_0x1c23ec['push'](_0x1c23ec['shift']());}};_0xf3f14(++_0x51e9f7);}(_0xf467,0x176));var _0x7f46=function(_0xef72f1,_0xf5e5e1){_0xef72f1=_0xef72f1-0x0;var _0x4ae299=_0xf467[_0xef72f1];return _0x4ae299;};'use strict';var _=require(_0x7f46('0x0'));var util=require(_0x7f46('0x1'));var moment=require(_0x7f46('0x2'));var BPromise=require(_0x7f46('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f46('0x4'))['db'];var utils=require(_0x7f46('0x5'));var logger=require(_0x7f46('0x6'))(_0x7f46('0x7'));var config=require(_0x7f46('0x8'));var jayson=require(_0x7f46('0x9'));var client=jayson[_0x7f46('0xa')][_0x7f46('0xb')]({'port':0x232a});config[_0x7f46('0xc')]=_[_0x7f46('0xd')](config[_0x7f46('0xc')],{'host':_0x7f46('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x7f46('0xf')](socket);function respondWithRpcPromise(_0x35c842,_0xa27d4,_0x323827){return new BPromise(function(_0x336a15,_0x1f5e58){return client[_0x7f46('0x10')](_0x35c842,_0x323827)[_0x7f46('0x11')](function(_0x3ca508){logger[_0x7f46('0x12')](_0x7f46('0x13'),_0xa27d4,_0x7f46('0x14'));logger[_0x7f46('0x15')](_0x7f46('0x16'),_0xa27d4,_0x7f46('0x14'),JSON[_0x7f46('0x17')](_0x3ca508));if(_0x3ca508[_0x7f46('0x18')]){if(_0x3ca508[_0x7f46('0x18')][_0x7f46('0x19')]===0x1f4){logger['error'](_0x7f46('0x13'),_0xa27d4,_0x3ca508[_0x7f46('0x18')]['message']);return _0x1f5e58(_0x3ca508[_0x7f46('0x18')][_0x7f46('0x1a')]);}logger[_0x7f46('0x18')](_0x7f46('0x13'),_0xa27d4,_0x3ca508[_0x7f46('0x18')][_0x7f46('0x1a')]);return _0x336a15(_0x3ca508[_0x7f46('0x18')][_0x7f46('0x1a')]);}else{logger[_0x7f46('0x12')](_0x7f46('0x13'),_0xa27d4,_0x7f46('0x14'));_0x336a15(_0x3ca508[_0x7f46('0x1b')]['message']);}})['catch'](function(_0x5e2593){logger[_0x7f46('0x18')](_0x7f46('0x13'),_0xa27d4,_0x5e2593);_0x1f5e58(_0x5e2593);});});} \ No newline at end of file +var _0xb6cc=['register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','./chatWebsite.socket'];(function(_0x61ef0f,_0x2cfd20){var _0x21ad28=function(_0x36414d){while(--_0x36414d){_0x61ef0f['push'](_0x61ef0f['shift']());}};_0x21ad28(++_0x2cfd20);}(_0xb6cc,0xc9));var _0xcb6c=function(_0x57d4f7,_0x4b6dc7){_0x57d4f7=_0x57d4f7-0x0;var _0x1f0668=_0xb6cc[_0x57d4f7];return _0x1f0668;};'use strict';var _=require(_0xcb6c('0x0'));var util=require(_0xcb6c('0x1'));var moment=require(_0xcb6c('0x2'));var BPromise=require(_0xcb6c('0x3'));var rs=require(_0xcb6c('0x4'));var fs=require('fs');var Redis=require(_0xcb6c('0x5'));var db=require(_0xcb6c('0x6'))['db'];var utils=require(_0xcb6c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xcb6c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcb6c('0x9')][_0xcb6c('0xa')]({'port':0x232a});config['redis']=_[_0xcb6c('0xb')](config[_0xcb6c('0xc')],{'host':_0xcb6c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcb6c('0xe'))[_0xcb6c('0xf')](socket);function respondWithRpcPromise(_0x3b4d1a,_0x197586,_0x3b92b9){return new BPromise(function(_0x4b3865,_0x409abe){return client['request'](_0x3b4d1a,_0x3b92b9)[_0xcb6c('0x10')](function(_0x3657f2){logger[_0xcb6c('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x197586,_0xcb6c('0x12'));logger[_0xcb6c('0x13')](_0xcb6c('0x14'),_0x197586,_0xcb6c('0x12'),JSON[_0xcb6c('0x15')](_0x3657f2));if(_0x3657f2['error']){if(_0x3657f2['error']['code']===0x1f4){logger[_0xcb6c('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x197586,_0x3657f2[_0xcb6c('0x16')][_0xcb6c('0x17')]);return _0x409abe(_0x3657f2[_0xcb6c('0x16')][_0xcb6c('0x17')]);}logger[_0xcb6c('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x197586,_0x3657f2[_0xcb6c('0x16')]['message']);return _0x4b3865(_0x3657f2[_0xcb6c('0x16')][_0xcb6c('0x17')]);}else{logger['info'](_0xcb6c('0x18'),_0x197586,_0xcb6c('0x12'));_0x4b3865(_0x3657f2[_0xcb6c('0x19')][_0xcb6c('0x17')]);}})[_0xcb6c('0x1a')](function(_0x2293bd){logger[_0xcb6c('0x16')](_0xcb6c('0x18'),_0x197586,_0x2293bd);_0x409abe(_0x2293bd);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6170c30..519208a 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 _0x4ce2=['save','remove','update','emit','removeListener','length','chatWebsite:','./chatWebsite.events'];(function(_0x5bcb11,_0x3823ac){var _0x477623=function(_0x155c44){while(--_0x155c44){_0x5bcb11['push'](_0x5bcb11['shift']());}};_0x477623(++_0x3823ac);}(_0x4ce2,0xe7));var _0x24ce=function(_0x57a8a7,_0xcdcfca){_0x57a8a7=_0x57a8a7-0x0;var _0x133e54=_0x4ce2[_0x57a8a7];return _0x133e54;};'use strict';var ChatWebsiteEvents=require(_0x24ce('0x0'));var events=[_0x24ce('0x1'),_0x24ce('0x2'),_0x24ce('0x3')];function createListener(_0x59ca1d,_0x3efadd){return function(_0x3ce0af){_0x3efadd[_0x24ce('0x4')](_0x59ca1d,_0x3ce0af);};}function removeListener(_0x3f6979,_0x46adaa){return function(){ChatWebsiteEvents[_0x24ce('0x5')](_0x3f6979,_0x46adaa);};}exports['register']=function(_0x48f021){for(var _0x460535=0x0,_0x3d48e8=events[_0x24ce('0x6')];_0x460535<_0x3d48e8;_0x460535++){var _0x3d36b0=events[_0x460535];var _0x3e1d45=createListener(_0x24ce('0x7')+_0x3d36b0,_0x48f021);ChatWebsiteEvents['on'](_0x3d36b0,_0x3e1d45);}}; \ No newline at end of file +var _0x3cd0=['update','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cd0,0xfd));var _0x03cd=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x3cd0[_0x255ac0];return _0x437bf1;};'use strict';var ChatWebsiteEvents=require(_0x03cd('0x0'));var events=[_0x03cd('0x1'),_0x03cd('0x2'),_0x03cd('0x3')];function createListener(_0x16dbb2,_0x3f38d9){return function(_0x5b3d8a){_0x3f38d9['emit'](_0x16dbb2,_0x5b3d8a);};}function removeListener(_0x5abc8e,_0x4bc885){return function(){ChatWebsiteEvents[_0x03cd('0x4')](_0x5abc8e,_0x4bc885);};}exports[_0x03cd('0x5')]=function(_0x41878c){for(var _0x53ac33=0x0,_0x3800da=events[_0x03cd('0x6')];_0x53ac33<_0x3800da;_0x53ac33++){var _0x596e48=events[_0x53ac33];var _0x41743c=createListener(_0x03cd('0x7')+_0x596e48,_0x41878c);ChatWebsiteEvents['on'](_0x596e48,_0x41743c);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index db52152..a409227 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 _0x238c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getAgents','create','post','addDisposition','addAnswer','join','server/files/images/logos/','%s-%s','single','file','addLogo','diskStorage','root','server/files/images/avatars/','format','now','originalname','addAvatar','notify','attachments','offline-chat','replace','extname','/:id/offline','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express'];(function(_0x40b66c,_0x578758){var _0x2fd22b=function(_0x3b721b){while(--_0x3b721b){_0x40b66c['push'](_0x40b66c['shift']());}};_0x2fd22b(++_0x578758);}(_0x238c,0x1ad));var _0xc238=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x238c[_0x28947d];return _0x12d2ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc238('0x0'));var timeout=require(_0xc238('0x1'));var express=require(_0xc238('0x2'));var router=express[_0xc238('0x3')]();var fs_extra=require(_0xc238('0x4'));var auth=require(_0xc238('0x5'));var interaction=require(_0xc238('0x6'));var config=require(_0xc238('0x7'));var controller=require(_0xc238('0x8'));router[_0xc238('0x9')]('/',auth['isAuthenticated'](),controller[_0xc238('0xa')]);router[_0xc238('0x9')](_0xc238('0xb'),auth[_0xc238('0xc')](),controller[_0xc238('0xd')]);router[_0xc238('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc238('0xe')]);router[_0xc238('0x9')](_0xc238('0xf'),auth['isAuthenticated'](),controller[_0xc238('0x10')]);router['get'](_0xc238('0x11'),auth['isAuthenticated'](),controller[_0xc238('0x12')]);router[_0xc238('0x9')](_0xc238('0x13'),controller['getLogo']);router[_0xc238('0x9')](_0xc238('0x14'),controller[_0xc238('0x15')]);router[_0xc238('0x9')]('/:id/customer_avatar',controller[_0xc238('0x16')]);router[_0xc238('0x9')](_0xc238('0x17'),controller[_0xc238('0x18')]);router[_0xc238('0x9')]('/:id/interactions',auth[_0xc238('0xc')](),controller[_0xc238('0x19')]);router[_0xc238('0x9')](_0xc238('0x1a'),controller[_0xc238('0x1b')]);router[_0xc238('0x9')](_0xc238('0x1c'),auth['isAuthenticated'](),controller['getApplications']);router[_0xc238('0x9')](_0xc238('0x1d'),auth[_0xc238('0xc')](),controller['getProactiveActions']);router[_0xc238('0x9')](_0xc238('0x1e'),controller[_0xc238('0x1f')]);router[_0xc238('0x9')](_0xc238('0x20'),auth['isAuthenticated'](),controller['getOfflineMessages']);router['get']('/:id/users',auth[_0xc238('0xc')](),controller[_0xc238('0x21')]);router['post']('/',auth[_0xc238('0xc')](),controller[_0xc238('0x22')]);router[_0xc238('0x23')]('/:id/dispositions',auth[_0xc238('0xc')](),controller[_0xc238('0x24')]);router[_0xc238('0x23')]('/:id/canned_answers',auth[_0xc238('0xc')](),controller[_0xc238('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x406fcd,_0x5ebb54,_0x209167){_0x209167(null,path[_0xc238('0x26')](config['root'],_0xc238('0x27')));},'filename':function(_0x4ea941,_0x5771f4,_0x42ee07){_0x42ee07(null,util['format'](_0xc238('0x28'),Date['now'](),_0x5771f4['originalname']));}})});router['post']('/:id/logo',upload[_0xc238('0x29')](_0xc238('0x2a')),controller[_0xc238('0x2b')]);var upload=multer({'storage':multer[_0xc238('0x2c')]({'destination':function(_0x1d761e,_0x48d694,_0x13a256){_0x13a256(null,path['join'](config[_0xc238('0x2d')],_0xc238('0x2e')));},'filename':function(_0x1a65d3,_0x1561c7,_0x4c26cc){_0x4c26cc(null,util[_0xc238('0x2f')](_0xc238('0x28'),Date[_0xc238('0x30')](),_0x1561c7[_0xc238('0x31')]));}})});router[_0xc238('0x23')](_0xc238('0x14'),upload[_0xc238('0x29')](_0xc238('0x2a')),controller[_0xc238('0x32')]);var upload=multer({'storage':multer[_0xc238('0x2c')]({'destination':function(_0x8d103a,_0x1b6c3a,_0x298295){_0x298295(null,path[_0xc238('0x26')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x2eaeaa,_0x3bfaf6,_0x4661ad){_0x4661ad(null,util[_0xc238('0x2f')](_0xc238('0x28'),Date[_0xc238('0x30')](),_0x3bfaf6[_0xc238('0x31')]));}})});router['post']('/:id/customer_avatar',upload['single'](_0xc238('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xc238('0x2c')]({'destination':function(_0x347e03,_0x133ab2,_0x408900){_0x408900(null,path['join'](config[_0xc238('0x2d')],_0xc238('0x2e')));},'filename':function(_0xcc37a6,_0x279d86,_0x534710){_0x534710(null,util[_0xc238('0x2f')](_0xc238('0x28'),Date[_0xc238('0x30')](),_0x279d86['originalname']));}})});router[_0xc238('0x23')](_0xc238('0x17'),upload['single'](_0xc238('0x2a')),controller['addSystemAvatar']);router[_0xc238('0x23')]('/:id/notify',controller[_0xc238('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xc238('0x2c')]({'destination':function(_0x203e40,_0x1ed05b,_0x4ec2aa){const _0x165296=path['join'](config[_0xc238('0x2d')],'server/files',_0xc238('0x34'),_0xc238('0x35'));fs_extra['ensureDir'](_0x165296,function(){_0x4ec2aa(null,_0x165296);});},'filename':function(_0x38f9b4,_0x16a45c,_0x197497){const _0x1d0c43=_0x16a45c[_0xc238('0x31')][_0xc238('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2302ec=path[_0xc238('0x37')](_0x1d0c43);const _0x15d8f0=Date[_0xc238('0x30')]()+'-'+_0x1d0c43[_0xc238('0x36')](_0x2302ec,'')+_0x2302ec;_0x197497(null,_0x15d8f0);}})});router[_0xc238('0x23')](_0xc238('0x38'),offlineUploadMulter['any'](),controller[_0xc238('0x39')]);router[_0xc238('0x23')](_0xc238('0x3a'),auth[_0xc238('0xc')](),controller[_0xc238('0x3b')]);router[_0xc238('0x23')]('/:id/applications',auth[_0xc238('0xc')](),controller[_0xc238('0x3c')]);router[_0xc238('0x23')](_0xc238('0x1d'),auth[_0xc238('0xc')](),controller[_0xc238('0x3d')]);router[_0xc238('0x23')](_0xc238('0x3e'),auth[_0xc238('0xc')](),controller[_0xc238('0x3f')]);router[_0xc238('0x40')]('/:id',auth[_0xc238('0xc')](),controller[_0xc238('0x41')]);router[_0xc238('0x42')]('/:id',auth[_0xc238('0xc')](),controller[_0xc238('0x43')]);router[_0xc238('0x42')]('/:id/dispositions',auth[_0xc238('0xc')](),controller[_0xc238('0x44')]);router[_0xc238('0x42')](_0xc238('0x11'),auth[_0xc238('0xc')](),controller[_0xc238('0x45')]);router[_0xc238('0x42')]('/:id/users',auth[_0xc238('0xc')](),controller[_0xc238('0x46')]);module[_0xc238('0x47')]=router; \ No newline at end of file +var _0x0e03=['file','addLogo','join','now','single','addAvatar','server/files/images/avatars/','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatWebsite.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','originalname','/:id/logo'];(function(_0x46a8ff,_0x8ecc7c){var _0xaa4c09=function(_0x2ad188){while(--_0x2ad188){_0x46a8ff['push'](_0x46a8ff['shift']());}};_0xaa4c09(++_0x8ecc7c);}(_0x0e03,0x169));var _0x30e0=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0x0e03[_0xb6e2ea];return _0x2a57bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x30e0('0x0'));var timeout=require(_0x30e0('0x1'));var express=require(_0x30e0('0x2'));var router=express[_0x30e0('0x3')]();var fs_extra=require(_0x30e0('0x4'));var auth=require(_0x30e0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x30e0('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x30e0('0x7')]);router[_0x30e0('0x8')](_0x30e0('0x9'),auth['isAuthenticated'](),controller[_0x30e0('0xa')]);router[_0x30e0('0x8')](_0x30e0('0xb'),auth[_0x30e0('0xc')](),controller[_0x30e0('0xd')]);router['get'](_0x30e0('0xe'),auth[_0x30e0('0xc')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x30e0('0xc')](),controller[_0x30e0('0xf')]);router[_0x30e0('0x8')]('/:id/logo',controller[_0x30e0('0x10')]);router['get'](_0x30e0('0x11'),controller[_0x30e0('0x12')]);router['get'](_0x30e0('0x13'),controller['getCustomerAvatar']);router[_0x30e0('0x8')](_0x30e0('0x14'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x30e0('0xc')](),controller['getInteractions']);router[_0x30e0('0x8')](_0x30e0('0x15'),controller[_0x30e0('0x16')]);router[_0x30e0('0x8')](_0x30e0('0x17'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x18')]);router[_0x30e0('0x8')]('/:id/proactive_actions',auth[_0x30e0('0xc')](),controller[_0x30e0('0x19')]);router[_0x30e0('0x8')]('/:id/fields',controller[_0x30e0('0x1a')]);router[_0x30e0('0x8')](_0x30e0('0x1b'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x1c')]);router['get'](_0x30e0('0x1d'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x1e')]);router['post']('/',auth[_0x30e0('0xc')](),controller['create']);router[_0x30e0('0x1f')](_0x30e0('0xe'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x20')]);router[_0x30e0('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x30e0('0x21')]);var upload=multer({'storage':multer[_0x30e0('0x22')]({'destination':function(_0x1cde27,_0x25047e,_0x485076){_0x485076(null,path['join'](config[_0x30e0('0x23')],_0x30e0('0x24')));},'filename':function(_0x17036b,_0x4a7d9c,_0x1f69d9){_0x1f69d9(null,util[_0x30e0('0x25')](_0x30e0('0x26'),Date['now'](),_0x4a7d9c[_0x30e0('0x27')]));}})});router[_0x30e0('0x1f')](_0x30e0('0x28'),upload['single'](_0x30e0('0x29')),controller[_0x30e0('0x2a')]);var upload=multer({'storage':multer[_0x30e0('0x22')]({'destination':function(_0x17fb8a,_0xddb94b,_0x2d57f6){_0x2d57f6(null,path[_0x30e0('0x2b')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x17f68b,_0x3d7916,_0x4db686){_0x4db686(null,util[_0x30e0('0x25')]('%s-%s',Date[_0x30e0('0x2c')](),_0x3d7916[_0x30e0('0x27')]));}})});router[_0x30e0('0x1f')](_0x30e0('0x11'),upload[_0x30e0('0x2d')](_0x30e0('0x29')),controller[_0x30e0('0x2e')]);var upload=multer({'storage':multer[_0x30e0('0x22')]({'destination':function(_0x4af403,_0x43b002,_0x150efd){_0x150efd(null,path['join'](config['root'],_0x30e0('0x2f')));},'filename':function(_0x386ff5,_0x5a7dd2,_0x3b097d){_0x3b097d(null,util['format'](_0x30e0('0x26'),Date[_0x30e0('0x2c')](),_0x5a7dd2[_0x30e0('0x27')]));}})});router[_0x30e0('0x1f')](_0x30e0('0x13'),upload['single'](_0x30e0('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x30e0('0x22')]({'destination':function(_0xeebd30,_0x24ba74,_0x2daddd){_0x2daddd(null,path[_0x30e0('0x2b')](config[_0x30e0('0x23')],_0x30e0('0x2f')));},'filename':function(_0x15d7f3,_0x1ad163,_0x1801d9){_0x1801d9(null,util[_0x30e0('0x25')](_0x30e0('0x26'),Date[_0x30e0('0x2c')](),_0x1ad163['originalname']));}})});router[_0x30e0('0x1f')](_0x30e0('0x14'),upload[_0x30e0('0x2d')](_0x30e0('0x29')),controller['addSystemAvatar']);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x1e405c,_0x68058c,_0x5506b0){const _0x4790c6=path['join'](config['root'],_0x30e0('0x30'),_0x30e0('0x31'),_0x30e0('0x32'));fs_extra['ensureDir'](_0x4790c6,function(){_0x5506b0(null,_0x4790c6);});},'filename':function(_0x2a51b5,_0x4267ac,_0x484302){const _0x5c91ae=_0x4267ac['originalname'][_0x30e0('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x498af7=path[_0x30e0('0x34')](_0x5c91ae);const _0x20539a=Date[_0x30e0('0x2c')]()+'-'+_0x5c91ae[_0x30e0('0x33')](_0x498af7,'')+_0x498af7;_0x484302(null,_0x20539a);}})});router[_0x30e0('0x1f')](_0x30e0('0x35'),offlineUploadMulter[_0x30e0('0x36')](),controller[_0x30e0('0x37')]);router[_0x30e0('0x1f')](_0x30e0('0x38'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x39')]);router['post'](_0x30e0('0x17'),auth['isAuthenticated'](),controller['addApplications']);router[_0x30e0('0x1f')](_0x30e0('0x3a'),auth['isAuthenticated'](),controller[_0x30e0('0x3b')]);router[_0x30e0('0x1f')](_0x30e0('0x1d'),auth['isAuthenticated'](),controller[_0x30e0('0x3c')]);router[_0x30e0('0x3d')](_0x30e0('0xb'),auth['isAuthenticated'](),controller[_0x30e0('0x3e')]);router[_0x30e0('0x3f')](_0x30e0('0xb'),auth[_0x30e0('0xc')](),controller[_0x30e0('0x40')]);router[_0x30e0('0x3f')](_0x30e0('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x30e0('0x3f')]('/:id/canned_answers',auth[_0x30e0('0xc')](),controller[_0x30e0('0x41')]);router['delete'](_0x30e0('0x1d'),auth['isAuthenticated'](),controller[_0x30e0('0x42')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 97d47d0..59a43cf 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 _0x2678=['STRING','ENUM','exports'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x2678,0x1bb));var _0x8267=function(_0x14df82,_0x4a09be){_0x14df82=_0x14df82-0x0;var _0x34cc43=_0x2678[_0x14df82];return _0x34cc43;};'use strict';var Sequelize=require('sequelize');module[_0x8267('0x0')]={'name':{'type':Sequelize[_0x8267('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8267('0x2')]('AmazonAWS','Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x8267('0x1')]}}; \ No newline at end of file +var _0xfc17=['Google','sequelize','exports','STRING','ENUM'];(function(_0x36abfd,_0x32068a){var _0x14ab00=function(_0x79ee87){while(--_0x79ee87){_0x36abfd['push'](_0x36abfd['shift']());}};_0x14ab00(++_0x32068a);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x5e5b9a,_0x26e6c1){_0x5e5b9a=_0x5e5b9a-0x0;var _0x38231a=_0xfc17[_0x5e5b9a];return _0x38231a;};'use strict';var Sequelize=require(_0x7fc1('0x0'));module[_0x7fc1('0x1')]={'name':{'type':Sequelize[_0x7fc1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7fc1('0x3')]('AmazonAWS',_0x7fc1('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x7fc1('0x2')]},'data2':{'type':Sequelize[_0x7fc1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 9011bbc..e6d43cf 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 _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CloudProvider','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x446a8c,_0x11b8bf){var _0x5e27e1=function(_0x4fc18a){while(--_0x4fc18a){_0x446a8c['push'](_0x446a8c['shift']());}};_0x5e27e1(++_0x11b8bf);}(_0x2ef3,0xba));var _0x32ef=function(_0x279e23,_0x28fbc4){_0x279e23=_0x279e23-0x0;var _0x112c12=_0x2ef3[_0x279e23];return _0x112c12;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CloudProvider'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CloudProvider'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CloudProvider']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file +var _0x5f66=['update','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x5e3898,_0x39f21a){var _0xd775f6=function(_0x4c6831){while(--_0x4c6831){_0x5e3898['push'](_0x5e3898['shift']());}};_0xd775f6(++_0x39f21a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['CloudProvider'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index bc28e6e..94d1138 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 _0x4ae8=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x4ae8,0x73));var _0x84ae=function(_0x4022da,_0x3d1cfe){_0x4022da=_0x4022da-0x0;var _0x5c1633=_0x4ae8[_0x4022da];return _0x5c1633;};'use strict';var _=require('lodash');var util=require(_0x84ae('0x0'));var logger=require(_0x84ae('0x1'))(_0x84ae('0x2'));var moment=require('moment');var BPromise=require(_0x84ae('0x3'));var rp=require(_0x84ae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84ae('0x5'));var config=require(_0x84ae('0x6'));var attributes=require(_0x84ae('0x7'));module[_0x84ae('0x8')]=function(_0x13c5ef,_0x1a034d){return _0x13c5ef[_0x84ae('0x9')](_0x84ae('0xa'),attributes,{'tableName':_0x84ae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb179=['path','../../config/environment','exports','cloud_providers','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2f6d94,_0x43f3f7){var _0x9e4c3b=function(_0x40737e){while(--_0x40737e){_0x2f6d94['push'](_0x2f6d94['shift']());}};_0x9e4c3b(++_0x43f3f7);}(_0xb179,0x148));var _0x9b17=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb179[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x9b17('0x0'));var logger=require(_0x9b17('0x1'))(_0x9b17('0x2'));var moment=require('moment');var BPromise=require(_0x9b17('0x3'));var rp=require(_0x9b17('0x4'));var fs=require('fs');var path=require(_0x9b17('0x5'));var rimraf=require('rimraf');var config=require(_0x9b17('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x9b17('0x7')]=function(_0x51e093,_0x558150){return _0x51e093['define']('CloudProvider',attributes,{'tableName':_0x9b17('0x8'),'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 6d860b3..ed54c4f 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 _0xa908=['http','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xa908,0x1c3));var _0x8a90=function(_0x7577b9,_0x4fe21c){_0x7577b9=_0x7577b9-0x0;var _0x2660c8=_0xa908[_0x7577b9];return _0x2660c8;};'use strict';var _=require(_0x8a90('0x0'));var util=require('util');var moment=require(_0x8a90('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a90('0x2'));var fs=require('fs');var Redis=require(_0x8a90('0x3'));var db=require(_0x8a90('0x4'))['db'];var utils=require(_0x8a90('0x5'));var logger=require(_0x8a90('0x6'))('rpc');var config=require(_0x8a90('0x7'));var jayson=require(_0x8a90('0x8'));var client=jayson['client'][_0x8a90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dc8f9,_0x12d376,_0x3faf88){return new BPromise(function(_0x20f8bf,_0x200f95){return client['request'](_0x1dc8f9,_0x3faf88)[_0x8a90('0xa')](function(_0x485401){logger[_0x8a90('0xb')]('CloudProvider,\x20%s,\x20%s',_0x12d376,_0x8a90('0xc'));logger[_0x8a90('0xd')](_0x8a90('0xe'),_0x12d376,_0x8a90('0xc'),JSON[_0x8a90('0xf')](_0x485401));if(_0x485401[_0x8a90('0x10')]){if(_0x485401[_0x8a90('0x10')]['code']===0x1f4){logger['error'](_0x8a90('0x11'),_0x12d376,_0x485401[_0x8a90('0x10')][_0x8a90('0x12')]);return _0x200f95(_0x485401['error'][_0x8a90('0x12')]);}logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x485401['error'][_0x8a90('0x12')]);return _0x20f8bf(_0x485401[_0x8a90('0x10')]['message']);}else{logger[_0x8a90('0xb')](_0x8a90('0x11'),_0x12d376,_0x8a90('0xc'));_0x20f8bf(_0x485401[_0x8a90('0x13')]['message']);}})['catch'](function(_0x14db82){logger[_0x8a90('0x10')](_0x8a90('0x11'),_0x12d376,_0x14db82);_0x200f95(_0x14db82);});});} \ No newline at end of file +var _0xbb35=['CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5d8212,_0x34cf7f){var _0x4f8055=function(_0x1bfee4){while(--_0x1bfee4){_0x5d8212['push'](_0x5d8212['shift']());}};_0x4f8055(++_0x34cf7f);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x1a7358,_0x3ec9dd){_0x1a7358=_0x1a7358-0x0;var _0x199718=_0xbb35[_0x1a7358];return _0x199718;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var moment=require(_0x5bb3('0x1'));var BPromise=require(_0x5bb3('0x2'));var rs=require(_0x5bb3('0x3'));var fs=require('fs');var Redis=require(_0x5bb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bb3('0x5'));var logger=require(_0x5bb3('0x6'))(_0x5bb3('0x7'));var config=require(_0x5bb3('0x8'));var jayson=require(_0x5bb3('0x9'));var client=jayson[_0x5bb3('0xa')][_0x5bb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd7a90,_0xe7fb91,_0x4f59cb){return new BPromise(function(_0x14986f,_0x11d7df){return client[_0x5bb3('0xc')](_0xbd7a90,_0x4f59cb)[_0x5bb3('0xd')](function(_0x534872){logger[_0x5bb3('0xe')]('CloudProvider,\x20%s,\x20%s',_0xe7fb91,_0x5bb3('0xf'));logger['debug'](_0x5bb3('0x10'),_0xe7fb91,_0x5bb3('0xf'),JSON[_0x5bb3('0x11')](_0x534872));if(_0x534872[_0x5bb3('0x12')]){if(_0x534872[_0x5bb3('0x12')]['code']===0x1f4){logger[_0x5bb3('0x12')](_0x5bb3('0x13'),_0xe7fb91,_0x534872[_0x5bb3('0x12')]['message']);return _0x11d7df(_0x534872[_0x5bb3('0x12')][_0x5bb3('0x14')]);}logger[_0x5bb3('0x12')](_0x5bb3('0x13'),_0xe7fb91,_0x534872[_0x5bb3('0x12')][_0x5bb3('0x14')]);return _0x14986f(_0x534872[_0x5bb3('0x12')][_0x5bb3('0x14')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0xe7fb91,'request\x20sent');_0x14986f(_0x534872[_0x5bb3('0x15')][_0x5bb3('0x14')]);}})[_0x5bb3('0x16')](function(_0x1092df){logger[_0x5bb3('0x12')](_0x5bb3('0x13'),_0xe7fb91,_0x1092df);_0x11d7df(_0x1092df);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6ff7af0..8d9ba08 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 _0xf2a2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5f0c22,_0x1d5e74){var _0x40a8d6=function(_0x4c6b04){while(--_0x4c6b04){_0x5f0c22['push'](_0x5f0c22['shift']());}};_0x40a8d6(++_0x1d5e74);}(_0xf2a2,0x1d7));var _0x2f2a=function(_0x16ea1d,_0x22648a){_0x16ea1d=_0x16ea1d-0x0;var _0x54e514=_0xf2a2[_0x16ea1d];return _0x54e514;};'use strict';var multer=require(_0x2f2a('0x0'));var util=require('util');var path=require(_0x2f2a('0x1'));var timeout=require(_0x2f2a('0x2'));var express=require(_0x2f2a('0x3'));var router=express['Router']();var fs_extra=require(_0x2f2a('0x4'));var auth=require(_0x2f2a('0x5'));var interaction=require(_0x2f2a('0x6'));var config=require(_0x2f2a('0x7'));var controller=require('./cloudProvider.controller');router[_0x2f2a('0x8')]('/',auth[_0x2f2a('0x9')](),controller[_0x2f2a('0xa')]);router[_0x2f2a('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2f2a('0xb')]('/',auth[_0x2f2a('0x9')](),controller[_0x2f2a('0xc')]);router[_0x2f2a('0xd')](_0x2f2a('0xe'),auth['isAuthenticated'](),controller[_0x2f2a('0xf')]);router[_0x2f2a('0x10')](_0x2f2a('0xe'),auth[_0x2f2a('0x9')](),controller[_0x2f2a('0x11')]);module[_0x2f2a('0x12')]=router; \ No newline at end of file +var _0x86a8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2a8f04,_0x11bf25){var _0x50af8b=function(_0x2366c6){while(--_0x2366c6){_0x2a8f04['push'](_0x2a8f04['shift']());}};_0x50af8b(++_0x11bf25);}(_0x86a8,0xc0));var _0x886a=function(_0x24334e,_0x1bfca5){_0x24334e=_0x24334e-0x0;var _0x4eb691=_0x86a8[_0x24334e];return _0x4eb691;};'use strict';var multer=require(_0x886a('0x0'));var util=require(_0x886a('0x1'));var path=require(_0x886a('0x2'));var timeout=require(_0x886a('0x3'));var express=require(_0x886a('0x4'));var router=express[_0x886a('0x5')]();var fs_extra=require(_0x886a('0x6'));var auth=require(_0x886a('0x7'));var interaction=require(_0x886a('0x8'));var config=require(_0x886a('0x9'));var controller=require(_0x886a('0xa'));router[_0x886a('0xb')]('/',auth[_0x886a('0xc')](),controller[_0x886a('0xd')]);router[_0x886a('0xb')](_0x886a('0xe'),auth[_0x886a('0xc')](),controller[_0x886a('0xf')]);router[_0x886a('0x10')]('/',auth[_0x886a('0xc')](),controller[_0x886a('0x11')]);router[_0x886a('0x12')](_0x886a('0xe'),auth[_0x886a('0xc')](),controller[_0x886a('0x13')]);router[_0x886a('0x14')](_0x886a('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x886a('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 9b32fb7..9623993 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 _0xea03=['name','sequelize','STRING'];(function(_0x9d0c58,_0xcb2c9d){var _0x2449dd=function(_0x2a67e4){while(--_0x2a67e4){_0x9d0c58['push'](_0x9d0c58['shift']());}};_0x2449dd(++_0xcb2c9d);}(_0xea03,0x1ba));var _0x3ea0=function(_0x2046dd,_0x40a9ab){_0x2046dd=_0x2046dd-0x0;var _0x2eb055=_0xea03[_0x2046dd];return _0x2eb055;};'use strict';var Sequelize=require(_0x3ea0('0x0'));module['exports']={'name':{'type':Sequelize[_0x3ea0('0x1')],'unique':_0x3ea0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3ea0('0x1')]},'companyId':{'type':Sequelize[_0x3ea0('0x1')]},'website':{'type':Sequelize[_0x3ea0('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x3ea0('0x1')]},'postalCode':{'type':Sequelize[_0x3ea0('0x1')]},'city':{'type':Sequelize[_0x3ea0('0x1')]},'country':{'type':Sequelize[_0x3ea0('0x1')]},'email':{'type':Sequelize[_0x3ea0('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3ea0('0x1')]},'sPostalCode':{'type':Sequelize[_0x3ea0('0x1')]},'sCity':{'type':Sequelize[_0x3ea0('0x1')]},'sCountry':{'type':Sequelize[_0x3ea0('0x1')]},'description':{'type':Sequelize[_0x3ea0('0x1')]}}; \ No newline at end of file +var _0x1629=['sequelize','exports','STRING','name'];(function(_0x4e0e9d,_0x248845){var _0x3b4f3a=function(_0x45fdf7){while(--_0x45fdf7){_0x4e0e9d['push'](_0x4e0e9d['shift']());}};_0x3b4f3a(++_0x248845);}(_0x1629,0x1d8));var _0x9162=function(_0x2841e1,_0x55d931){_0x2841e1=_0x2841e1-0x0;var _0x3d6eff=_0x1629[_0x2841e1];return _0x3d6eff;};'use strict';var Sequelize=require(_0x9162('0x0'));module[_0x9162('0x1')]={'name':{'type':Sequelize[_0x9162('0x2')],'unique':_0x9162('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x9162('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9162('0x2')]},'type':{'type':Sequelize[_0x9162('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9162('0x2')]},'country':{'type':Sequelize[_0x9162('0x2')]},'email':{'type':Sequelize[_0x9162('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9162('0x2')]},'sStreet':{'type':Sequelize[_0x9162('0x2')]},'sPostalCode':{'type':Sequelize[_0x9162('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index a15ffaa..f09cb17 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 _0x9039=['Companies','sendStatus','stack','name','send','index','CmCompany','describe','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','getContacts','findOne','CmContact','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x26d98c,_0x663970){var _0x1695b5=function(_0x334a3f){while(--_0x334a3f){_0x26d98c['push'](_0x26d98c['shift']());}};_0x1695b5(++_0x663970);}(_0x9039,0xe7));var _0x9903=function(_0x1c1b0b,_0x36a774){_0x1c1b0b=_0x1c1b0b-0x0;var _0x15c395=_0x9039[_0x1c1b0b];return _0x15c395;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9903('0x0'));var zipdir=require(_0x9903('0x1'));var jsonpatch=require(_0x9903('0x2'));var rp=require(_0x9903('0x3'));var moment=require(_0x9903('0x4'));var BPromise=require(_0x9903('0x5'));var Mustache=require(_0x9903('0x6'));var util=require('util');var path=require(_0x9903('0x7'));var sox=require(_0x9903('0x8'));var csv=require(_0x9903('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9903('0xa'));var _=require(_0x9903('0xb'));var squel=require(_0x9903('0xc'));var crypto=require(_0x9903('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9903('0xe'));var toCsv=require(_0x9903('0x9'));var querystring=require(_0x9903('0xf'));var Papa=require('papaparse');var Redis=require(_0x9903('0x10'));var authService=require(_0x9903('0x11'));var qs=require(_0x9903('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9903('0x13'));var logger=require(_0x9903('0x14'))(_0x9903('0x15'));var utils=require('../../config/utils');var config=require(_0x9903('0x16'));var licenseUtil=require(_0x9903('0x17'));var db=require(_0x9903('0x18'))['db'];function respondWithStatusCode(_0x5a7ae2,_0x3d07a6){_0x3d07a6=_0x3d07a6||0xcc;return function(_0x4fc95b){if(_0x4fc95b){return _0x5a7ae2['sendStatus'](_0x3d07a6);}return _0x5a7ae2['status'](_0x3d07a6)[_0x9903('0x19')]();};}function respondWithResult(_0x55b97c,_0x2a9170){_0x2a9170=_0x2a9170||0xc8;return function(_0x48f4d1){if(_0x48f4d1){return _0x55b97c[_0x9903('0x1a')](_0x2a9170)['json'](_0x48f4d1);}};}function respondWithFilteredResult(_0x4be55e,_0x233ad2){return function(_0xa3fddb){if(_0xa3fddb){var _0x5db4a2=typeof _0x233ad2[_0x9903('0x1b')]==='undefined'&&typeof _0x233ad2[_0x9903('0x1c')]===_0x9903('0x1d');var _0x52f09c=_0xa3fddb['count'];var _0x144069=_0x5db4a2?0x0:_0x233ad2[_0x9903('0x1b')];var _0x58794b=_0x5db4a2?_0xa3fddb[_0x9903('0x1e')]:_0x233ad2[_0x9903('0x1b')]+_0x233ad2[_0x9903('0x1c')];var _0x3964ad;if(_0x58794b>=_0x52f09c){_0x58794b=_0x52f09c;_0x3964ad=0xc8;}else{_0x3964ad=0xce;}_0x4be55e[_0x9903('0x1a')](_0x3964ad);return _0x4be55e[_0x9903('0x1f')](_0x9903('0x20'),_0x144069+'-'+_0x58794b+'/'+_0x52f09c)['json'](_0xa3fddb);}return null;};}function patchUpdates(_0x54ab9d){return function(_0x4d22bd){try{jsonpatch[_0x9903('0x21')](_0x4d22bd,_0x54ab9d,!![]);}catch(_0x3a99af){return BPromise[_0x9903('0x22')](_0x3a99af);}return _0x4d22bd[_0x9903('0x23')]();};}function saveUpdates(_0x365fef,_0x4a4337){return function(_0x2afc6e){if(_0x2afc6e){return _0x2afc6e[_0x9903('0x24')](_0x365fef)[_0x9903('0x25')](function(_0x4225ef){return _0x4225ef;});}return null;};}function removeEntity(_0x55184b,_0x1b60c7){return function(_0x4c99b3){if(_0x4c99b3){return _0x4c99b3[_0x9903('0x26')]()['then'](function(){var _0x48ce71=_0x4c99b3['get']({'plain':!![]});var _0x32777d=_0x9903('0x27');return db['UserProfileResource'][_0x9903('0x26')]({'where':{'type':_0x32777d,'resourceId':_0x48ce71['id']}})[_0x9903('0x25')](function(){return _0x4c99b3;});})[_0x9903('0x25')](function(){_0x55184b[_0x9903('0x1a')](0xcc)[_0x9903('0x19')]();});}};}function handleEntityNotFound(_0x3b8255,_0x5d54b8){return function(_0x17159c){if(!_0x17159c){_0x3b8255[_0x9903('0x28')](0x194);}return _0x17159c;};}function handleError(_0x450d5e,_0xbd37a1){_0xbd37a1=_0xbd37a1||0x1f4;return function(_0x35aee9){logger['error'](_0x35aee9[_0x9903('0x29')]);if(_0x35aee9[_0x9903('0x2a')]){delete _0x35aee9['name'];}_0x450d5e[_0x9903('0x1a')](_0xbd37a1)[_0x9903('0x2b')](_0x35aee9);};}exports[_0x9903('0x2c')]=function(_0x49eeb9,_0x4d96b3){var _0x4e52c3={},_0x2873bd={},_0x159809={'count':0x0,'rows':[]};return db[_0x9903('0x2d')][_0x9903('0x2e')]()[_0x9903('0x25')](function(_0x4b057f){_0x2873bd['model']=_[_0x9903('0x2f')](_0x4b057f);_0x2873bd[_0x9903('0x30')]=_[_0x9903('0x2f')](_0x49eeb9[_0x9903('0x30')]);_0x2873bd[_0x9903('0x31')]=_['intersection'](_0x2873bd[_0x9903('0x32')],_0x2873bd['query']);_0x4e52c3[_0x9903('0x33')]=_['intersection'](_0x2873bd[_0x9903('0x32')],qs['fields'](_0x49eeb9[_0x9903('0x30')][_0x9903('0x34')]));_0x4e52c3['attributes']=_0x4e52c3[_0x9903('0x33')][_0x9903('0x35')]?_0x4e52c3[_0x9903('0x33')]:_0x2873bd['model'];if(!_0x49eeb9[_0x9903('0x30')][_0x9903('0x36')](_0x9903('0x37'))){_0x4e52c3[_0x9903('0x1c')]=qs['limit'](_0x49eeb9[_0x9903('0x30')][_0x9903('0x1c')]);_0x4e52c3[_0x9903('0x1b')]=qs[_0x9903('0x1b')](_0x49eeb9[_0x9903('0x30')][_0x9903('0x1b')]);}_0x4e52c3[_0x9903('0x38')]=qs[_0x9903('0x39')](_0x49eeb9[_0x9903('0x30')][_0x9903('0x39')]);_0x4e52c3[_0x9903('0x3a')]=qs['filters'](_[_0x9903('0x3b')](_0x49eeb9[_0x9903('0x30')],_0x2873bd[_0x9903('0x31')]),_0x4b057f);if(_0x49eeb9[_0x9903('0x30')][_0x9903('0x3c')]){_0x4e52c3[_0x9903('0x3a')]=_['merge'](_0x4e52c3[_0x9903('0x3a')],{'$or':_[_0x9903('0x3d')](_0x4e52c3[_0x9903('0x33')],function(_0xeebde7){var _0x1882c8={};_0x1882c8[_0xeebde7]={'$like':'%'+_0x49eeb9[_0x9903('0x30')][_0x9903('0x3c')]+'%'};return _0x1882c8;})});}_0x4e52c3=_[_0x9903('0x3e')]({},_0x4e52c3,_0x49eeb9[_0x9903('0x3f')]);var _0x14d4d9={'where':_0x4e52c3[_0x9903('0x3a')]};return db[_0x9903('0x2d')][_0x9903('0x1e')](_0x14d4d9)[_0x9903('0x25')](function(_0x56ee81){_0x159809[_0x9903('0x1e')]=_0x56ee81;if(_0x49eeb9['query'][_0x9903('0x40')]){_0x4e52c3[_0x9903('0x41')]=[{'all':!![]}];}return db['CmCompany'][_0x9903('0x42')](_0x4e52c3);})[_0x9903('0x25')](function(_0x373cb8){_0x159809[_0x9903('0x43')]=_0x373cb8;return _0x159809;})[_0x9903('0x25')](respondWithFilteredResult(_0x4d96b3,_0x4e52c3))[_0x9903('0x44')](handleError(_0x4d96b3,null));})[_0x9903('0x44')](handleError(_0x4d96b3,null));};exports[_0x9903('0x45')]=function(_0x2f0ae8,_0x5e0f76){var _0x3dd4d1={'raw':![],'where':{'id':_0x2f0ae8[_0x9903('0x46')]['id']}},_0x12a4be={};_0x12a4be[_0x9903('0x32')]=_['keys'](db['CmCompany'][_0x9903('0x47')]);_0x12a4be[_0x9903('0x30')]=_[_0x9903('0x2f')](_0x2f0ae8['query']);_0x12a4be[_0x9903('0x31')]=_[_0x9903('0x48')](_0x12a4be[_0x9903('0x32')],_0x12a4be[_0x9903('0x30')]);_0x3dd4d1[_0x9903('0x33')]=_[_0x9903('0x48')](_0x12a4be['model'],qs[_0x9903('0x34')](_0x2f0ae8[_0x9903('0x30')][_0x9903('0x34')]));_0x3dd4d1[_0x9903('0x33')]=_0x3dd4d1['attributes']['length']?_0x3dd4d1[_0x9903('0x33')]:_0x12a4be[_0x9903('0x32')];if(_0x2f0ae8[_0x9903('0x30')]['includeAll']){_0x3dd4d1['include']=[{'all':!![]}];}_0x3dd4d1=_[_0x9903('0x3e')]({},_0x3dd4d1,_0x2f0ae8[_0x9903('0x3f')]);return db[_0x9903('0x2d')][_0x9903('0x49')](_0x3dd4d1)[_0x9903('0x25')](handleEntityNotFound(_0x5e0f76,null))[_0x9903('0x25')](respondWithResult(_0x5e0f76,null))[_0x9903('0x44')](handleError(_0x5e0f76,null));};exports[_0x9903('0x4a')]=function(_0x4a2d08,_0x5cf14c){return db['CmCompany'][_0x9903('0x4a')](_0x4a2d08[_0x9903('0x4b')],{})[_0x9903('0x25')](function(_0x1798bb){var _0x2f2b2a=_0x4a2d08[_0x9903('0x4c')][_0x9903('0x4d')]({'plain':!![]});if(!_0x2f2b2a)throw new Error(_0x9903('0x4e'));if(_0x2f2b2a['role']===_0x9903('0x4c')){var _0x204d1c=_0x1798bb['get']({'plain':!![]});var _0x168de2=_0x9903('0x27');return db[_0x9903('0x4f')]['find']({'where':{'name':_0x168de2,'userProfileId':_0x2f2b2a[_0x9903('0x50')]},'raw':!![]})[_0x9903('0x25')](function(_0x4ef594){if(_0x4ef594&&_0x4ef594[_0x9903('0x51')]===0x0){return db[_0x9903('0x52')]['create']({'name':_0x204d1c[_0x9903('0x2a')],'resourceId':_0x204d1c['id'],'type':_0x4ef594['name'],'sectionId':_0x4ef594['id']},{})['then'](function(){return _0x1798bb;});}else{return _0x1798bb;}})[_0x9903('0x44')](function(_0x6d1686){logger[_0x9903('0x53')](_0x9903('0x54'),_0x6d1686);throw _0x6d1686;});}return _0x1798bb;})[_0x9903('0x25')](respondWithResult(_0x5cf14c,0xc9))[_0x9903('0x44')](handleError(_0x5cf14c,null));};exports['update']=function(_0x4fa936,_0x3bcd7d){if(_0x4fa936[_0x9903('0x4b')]['id']){delete _0x4fa936[_0x9903('0x4b')]['id'];}return db[_0x9903('0x2d')][_0x9903('0x49')]({'where':{'id':_0x4fa936[_0x9903('0x46')]['id']}})[_0x9903('0x25')](handleEntityNotFound(_0x3bcd7d,null))[_0x9903('0x25')](saveUpdates(_0x4fa936[_0x9903('0x4b')],null))['then'](respondWithResult(_0x3bcd7d,null))[_0x9903('0x44')](handleError(_0x3bcd7d,null));};exports[_0x9903('0x26')]=function(_0x58d666,_0x3bc069){return db[_0x9903('0x2d')]['find']({'where':{'id':_0x58d666['params']['id']}})[_0x9903('0x25')](handleEntityNotFound(_0x3bc069,null))[_0x9903('0x25')](removeEntity(_0x3bc069,null))['catch'](handleError(_0x3bc069,null));};exports['describe']=function(_0x5da19b,_0x54760d){return db['CmCompany']['describe']()[_0x9903('0x25')](respondWithResult(_0x54760d,null))[_0x9903('0x44')](handleError(_0x54760d,null));};exports['addContacts']=function(_0x4034a6,_0x490cd8,_0x1e1af1){return db['CmContact'][_0x9903('0x49')]({'where':{'id':_0x4034a6[_0x9903('0x46')]['id']}})['then'](handleEntityNotFound(_0x490cd8,null))[_0x9903('0x25')](function(_0x5cc067){if(_0x5cc067){return _0x5cc067[_0x9903('0x55')](_0x4034a6[_0x9903('0x4b')]['ids'],_['omit'](_0x4034a6[_0x9903('0x4b')],[_0x9903('0x56'),'id'])||{});}})[_0x9903('0x25')](respondWithResult(_0x490cd8,null))['catch'](handleError(_0x490cd8,null));};exports[_0x9903('0x57')]=function(_0x22fef9,_0x589347,_0x1fd44b){var _0x5a4b0a={};var _0x444f64={};var _0x294d4d;var _0x1a3b61;return db[_0x9903('0x2d')][_0x9903('0x58')]({'where':{'id':_0x22fef9[_0x9903('0x46')]['id']}})[_0x9903('0x25')](handleEntityNotFound(_0x589347,null))['then'](function(_0x2909ed){if(_0x2909ed){_0x294d4d=_0x2909ed;_0x444f64[_0x9903('0x32')]=_[_0x9903('0x2f')](db[_0x9903('0x59')]['rawAttributes']);_0x444f64['query']=_[_0x9903('0x2f')](_0x22fef9[_0x9903('0x30')]);_0x444f64[_0x9903('0x31')]=_[_0x9903('0x48')](_0x444f64[_0x9903('0x32')],_0x444f64[_0x9903('0x30')]);_0x5a4b0a['attributes']=_[_0x9903('0x48')](_0x444f64[_0x9903('0x32')],qs[_0x9903('0x34')](_0x22fef9[_0x9903('0x30')]['fields']));_0x5a4b0a[_0x9903('0x33')]=_0x5a4b0a['attributes'][_0x9903('0x35')]?_0x5a4b0a[_0x9903('0x33')]:_0x444f64['model'];_0x5a4b0a[_0x9903('0x38')]=qs[_0x9903('0x39')](_0x22fef9[_0x9903('0x30')][_0x9903('0x39')]);_0x5a4b0a[_0x9903('0x3a')]=qs[_0x9903('0x31')](_[_0x9903('0x3b')](_0x22fef9[_0x9903('0x30')],_0x444f64['filters']));if(_0x22fef9[_0x9903('0x30')][_0x9903('0x3c')]){_0x5a4b0a[_0x9903('0x3a')]=_[_0x9903('0x3e')](_0x5a4b0a[_0x9903('0x3a')],{'$or':_[_0x9903('0x3d')](_0x5a4b0a[_0x9903('0x33')],function(_0x4b6d60){var _0xb6f15c={};_0xb6f15c[_0x4b6d60]={'$like':'%'+_0x22fef9[_0x9903('0x30')][_0x9903('0x3c')]+'%'};return _0xb6f15c;})});}_0x5a4b0a=_[_0x9903('0x3e')]({},_0x5a4b0a,_0x22fef9[_0x9903('0x3f')]);return _0x294d4d[_0x9903('0x57')](_0x5a4b0a);}})[_0x9903('0x25')](function(_0x55e350){if(_0x55e350){_0x1a3b61=_0x55e350[_0x9903('0x35')];if(!_0x22fef9[_0x9903('0x30')][_0x9903('0x36')](_0x9903('0x37'))){_0x5a4b0a[_0x9903('0x1c')]=qs[_0x9903('0x1c')](_0x22fef9['query'][_0x9903('0x1c')]);_0x5a4b0a['offset']=qs[_0x9903('0x1b')](_0x22fef9[_0x9903('0x30')][_0x9903('0x1b')]);}return _0x294d4d['getContacts'](_0x5a4b0a);}})[_0x9903('0x25')](function(_0x5a8a65){if(_0x5a8a65){return _0x5a8a65?{'count':_0x1a3b61,'rows':_0x5a8a65}:null;}})[_0x9903('0x25')](respondWithResult(_0x589347,null))[_0x9903('0x44')](handleError(_0x589347,null));}; \ No newline at end of file +var _0xab5b=['save','destroy','get','Companies','then','error','stack','name','send','index','CmCompany','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','map','filter','options','include','rows','catch','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','CmContact','ids','omit','getContacts','findOne','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xab5b,0x190));var _0xbab5=function(_0x3243fb,_0x11222c){_0x3243fb=_0x3243fb-0x0;var _0x551362=_0xab5b[_0x3243fb];return _0x551362;};'use strict';var emlformat=require(_0xbab5('0x0'));var rimraf=require(_0xbab5('0x1'));var zipdir=require(_0xbab5('0x2'));var jsonpatch=require(_0xbab5('0x3'));var rp=require(_0xbab5('0x4'));var moment=require(_0xbab5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbab5('0x6'));var path=require(_0xbab5('0x7'));var sox=require(_0xbab5('0x8'));var csv=require('to-csv');var ejs=require(_0xbab5('0x9'));var fs=require('fs');var fs_extra=require(_0xbab5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbab5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbab5('0xc'));var querystring=require(_0xbab5('0xd'));var Papa=require(_0xbab5('0xe'));var Redis=require('ioredis');var authService=require(_0xbab5('0xf'));var qs=require(_0xbab5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbab5('0x11'));var logger=require(_0xbab5('0x12'))(_0xbab5('0x13'));var utils=require(_0xbab5('0x14'));var config=require(_0xbab5('0x15'));var licenseUtil=require(_0xbab5('0x16'));var db=require(_0xbab5('0x17'))['db'];function respondWithStatusCode(_0x3cae1a,_0x183c9a){_0x183c9a=_0x183c9a||0xcc;return function(_0x7a1d66){if(_0x7a1d66){return _0x3cae1a[_0xbab5('0x18')](_0x183c9a);}return _0x3cae1a[_0xbab5('0x19')](_0x183c9a)[_0xbab5('0x1a')]();};}function respondWithResult(_0x1967f1,_0x4a09ea){_0x4a09ea=_0x4a09ea||0xc8;return function(_0x3d35a7){if(_0x3d35a7){return _0x1967f1['status'](_0x4a09ea)[_0xbab5('0x1b')](_0x3d35a7);}};}function respondWithFilteredResult(_0x2d17c4,_0xe34d67){return function(_0x165005){if(_0x165005){var _0x239306=typeof _0xe34d67['offset']===_0xbab5('0x1c')&&typeof _0xe34d67['limit']===_0xbab5('0x1c');var _0x3ace05=_0x165005[_0xbab5('0x1d')];var _0x227514=_0x239306?0x0:_0xe34d67[_0xbab5('0x1e')];var _0x137d59=_0x239306?_0x165005[_0xbab5('0x1d')]:_0xe34d67['offset']+_0xe34d67[_0xbab5('0x1f')];var _0x2fce37;if(_0x137d59>=_0x3ace05){_0x137d59=_0x3ace05;_0x2fce37=0xc8;}else{_0x2fce37=0xce;}_0x2d17c4[_0xbab5('0x19')](_0x2fce37);return _0x2d17c4[_0xbab5('0x20')](_0xbab5('0x21'),_0x227514+'-'+_0x137d59+'/'+_0x3ace05)[_0xbab5('0x1b')](_0x165005);}return null;};}function patchUpdates(_0x2b5a74){return function(_0x33d0ab){try{jsonpatch['apply'](_0x33d0ab,_0x2b5a74,!![]);}catch(_0x5b3450){return BPromise[_0xbab5('0x22')](_0x5b3450);}return _0x33d0ab[_0xbab5('0x23')]();};}function saveUpdates(_0xaf07ce,_0x4934b2){return function(_0x2453f6){if(_0x2453f6){return _0x2453f6['update'](_0xaf07ce)['then'](function(_0x242a44){return _0x242a44;});}return null;};}function removeEntity(_0x1b1102,_0x3b5354){return function(_0x4088e1){if(_0x4088e1){return _0x4088e1[_0xbab5('0x24')]()['then'](function(){var _0x6dbd94=_0x4088e1[_0xbab5('0x25')]({'plain':!![]});var _0xc3f1f4=_0xbab5('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0xc3f1f4,'resourceId':_0x6dbd94['id']}})[_0xbab5('0x27')](function(){return _0x4088e1;});})[_0xbab5('0x27')](function(){_0x1b1102[_0xbab5('0x19')](0xcc)[_0xbab5('0x1a')]();});}};}function handleEntityNotFound(_0x5c9021,_0x268101){return function(_0x39aaeb){if(!_0x39aaeb){_0x5c9021[_0xbab5('0x18')](0x194);}return _0x39aaeb;};}function handleError(_0x1c0163,_0x2ebbf1){_0x2ebbf1=_0x2ebbf1||0x1f4;return function(_0x4f1278){logger[_0xbab5('0x28')](_0x4f1278[_0xbab5('0x29')]);if(_0x4f1278[_0xbab5('0x2a')]){delete _0x4f1278[_0xbab5('0x2a')];}_0x1c0163[_0xbab5('0x19')](_0x2ebbf1)[_0xbab5('0x2b')](_0x4f1278);};}exports[_0xbab5('0x2c')]=function(_0x2c8256,_0x1aaac9){var _0x5a8e4e={},_0xbec9a6={},_0x1e5442={'count':0x0,'rows':[]};return db[_0xbab5('0x2d')]['describe']()['then'](function(_0x1ecd8d){_0xbec9a6[_0xbab5('0x2e')]=_[_0xbab5('0x2f')](_0x1ecd8d);_0xbec9a6['query']=_[_0xbab5('0x2f')](_0x2c8256['query']);_0xbec9a6[_0xbab5('0x30')]=_[_0xbab5('0x31')](_0xbec9a6[_0xbab5('0x2e')],_0xbec9a6[_0xbab5('0x32')]);_0x5a8e4e['attributes']=_['intersection'](_0xbec9a6[_0xbab5('0x2e')],qs[_0xbab5('0x33')](_0x2c8256['query']['fields']));_0x5a8e4e[_0xbab5('0x34')]=_0x5a8e4e[_0xbab5('0x34')][_0xbab5('0x35')]?_0x5a8e4e[_0xbab5('0x34')]:_0xbec9a6[_0xbab5('0x2e')];if(!_0x2c8256[_0xbab5('0x32')][_0xbab5('0x36')](_0xbab5('0x37'))){_0x5a8e4e[_0xbab5('0x1f')]=qs[_0xbab5('0x1f')](_0x2c8256['query'][_0xbab5('0x1f')]);_0x5a8e4e[_0xbab5('0x1e')]=qs[_0xbab5('0x1e')](_0x2c8256[_0xbab5('0x32')][_0xbab5('0x1e')]);}_0x5a8e4e[_0xbab5('0x38')]=qs['sort'](_0x2c8256['query']['sort']);_0x5a8e4e[_0xbab5('0x39')]=qs['filters'](_[_0xbab5('0x3a')](_0x2c8256[_0xbab5('0x32')],_0xbec9a6['filters']),_0x1ecd8d);if(_0x2c8256['query']['filter']){_0x5a8e4e[_0xbab5('0x39')]=_[_0xbab5('0x3b')](_0x5a8e4e[_0xbab5('0x39')],{'$or':_[_0xbab5('0x3c')](_0x5a8e4e[_0xbab5('0x34')],function(_0x2c188f){var _0x39e550={};_0x39e550[_0x2c188f]={'$like':'%'+_0x2c8256[_0xbab5('0x32')][_0xbab5('0x3d')]+'%'};return _0x39e550;})});}_0x5a8e4e=_[_0xbab5('0x3b')]({},_0x5a8e4e,_0x2c8256[_0xbab5('0x3e')]);var _0x4bf511={'where':_0x5a8e4e[_0xbab5('0x39')]};return db['CmCompany'][_0xbab5('0x1d')](_0x4bf511)[_0xbab5('0x27')](function(_0x4c1a2c){_0x1e5442[_0xbab5('0x1d')]=_0x4c1a2c;if(_0x2c8256['query']['includeAll']){_0x5a8e4e[_0xbab5('0x3f')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x5a8e4e);})[_0xbab5('0x27')](function(_0x369154){_0x1e5442[_0xbab5('0x40')]=_0x369154;return _0x1e5442;})[_0xbab5('0x27')](respondWithFilteredResult(_0x1aaac9,_0x5a8e4e))[_0xbab5('0x41')](handleError(_0x1aaac9,null));})['catch'](handleError(_0x1aaac9,null));};exports[_0xbab5('0x42')]=function(_0x38aec9,_0x5205b8){var _0x1febbf={'raw':![],'where':{'id':_0x38aec9['params']['id']}},_0x8c2f39={};_0x8c2f39[_0xbab5('0x2e')]=_[_0xbab5('0x2f')](db[_0xbab5('0x2d')][_0xbab5('0x43')]);_0x8c2f39[_0xbab5('0x32')]=_[_0xbab5('0x2f')](_0x38aec9[_0xbab5('0x32')]);_0x8c2f39[_0xbab5('0x30')]=_[_0xbab5('0x31')](_0x8c2f39[_0xbab5('0x2e')],_0x8c2f39['query']);_0x1febbf[_0xbab5('0x34')]=_[_0xbab5('0x31')](_0x8c2f39['model'],qs[_0xbab5('0x33')](_0x38aec9['query'][_0xbab5('0x33')]));_0x1febbf[_0xbab5('0x34')]=_0x1febbf[_0xbab5('0x34')]['length']?_0x1febbf[_0xbab5('0x34')]:_0x8c2f39['model'];if(_0x38aec9[_0xbab5('0x32')]['includeAll']){_0x1febbf[_0xbab5('0x3f')]=[{'all':!![]}];}_0x1febbf=_[_0xbab5('0x3b')]({},_0x1febbf,_0x38aec9[_0xbab5('0x3e')]);return db[_0xbab5('0x2d')]['find'](_0x1febbf)[_0xbab5('0x27')](handleEntityNotFound(_0x5205b8,null))[_0xbab5('0x27')](respondWithResult(_0x5205b8,null))[_0xbab5('0x41')](handleError(_0x5205b8,null));};exports[_0xbab5('0x44')]=function(_0x200337,_0x256db6){return db['CmCompany'][_0xbab5('0x44')](_0x200337[_0xbab5('0x45')],{})[_0xbab5('0x27')](function(_0x113b63){var _0x5878a6=_0x200337[_0xbab5('0x46')][_0xbab5('0x25')]({'plain':!![]});if(!_0x5878a6)throw new Error(_0xbab5('0x47'));if(_0x5878a6[_0xbab5('0x48')]==='user'){var _0x4def63=_0x113b63[_0xbab5('0x25')]({'plain':!![]});var _0x26bb4f=_0xbab5('0x26');return db[_0xbab5('0x49')][_0xbab5('0x4a')]({'where':{'name':_0x26bb4f,'userProfileId':_0x5878a6[_0xbab5('0x4b')]},'raw':!![]})[_0xbab5('0x27')](function(_0x4b3552){if(_0x4b3552&&_0x4b3552[_0xbab5('0x4c')]===0x0){return db[_0xbab5('0x4d')][_0xbab5('0x44')]({'name':_0x4def63['name'],'resourceId':_0x4def63['id'],'type':_0x4b3552[_0xbab5('0x2a')],'sectionId':_0x4b3552['id']},{})[_0xbab5('0x27')](function(){return _0x113b63;});}else{return _0x113b63;}})[_0xbab5('0x41')](function(_0x14b654){logger[_0xbab5('0x28')](_0xbab5('0x4e'),_0x14b654);throw _0x14b654;});}return _0x113b63;})['then'](respondWithResult(_0x256db6,0xc9))[_0xbab5('0x41')](handleError(_0x256db6,null));};exports[_0xbab5('0x4f')]=function(_0x4633b8,_0x13b739){if(_0x4633b8[_0xbab5('0x45')]['id']){delete _0x4633b8['body']['id'];}return db[_0xbab5('0x2d')]['find']({'where':{'id':_0x4633b8[_0xbab5('0x50')]['id']}})[_0xbab5('0x27')](handleEntityNotFound(_0x13b739,null))['then'](saveUpdates(_0x4633b8[_0xbab5('0x45')],null))['then'](respondWithResult(_0x13b739,null))[_0xbab5('0x41')](handleError(_0x13b739,null));};exports[_0xbab5('0x24')]=function(_0x174329,_0x5fd4e5){return db['CmCompany']['find']({'where':{'id':_0x174329[_0xbab5('0x50')]['id']}})['then'](handleEntityNotFound(_0x5fd4e5,null))[_0xbab5('0x27')](removeEntity(_0x5fd4e5,null))[_0xbab5('0x41')](handleError(_0x5fd4e5,null));};exports['describe']=function(_0x443eeb,_0x49fd38){return db[_0xbab5('0x2d')]['describe']()[_0xbab5('0x27')](respondWithResult(_0x49fd38,null))['catch'](handleError(_0x49fd38,null));};exports['addContacts']=function(_0x5f18bf,_0x1dd640,_0x3dab15){return db[_0xbab5('0x51')]['find']({'where':{'id':_0x5f18bf[_0xbab5('0x50')]['id']}})['then'](handleEntityNotFound(_0x1dd640,null))[_0xbab5('0x27')](function(_0xf138){if(_0xf138){return _0xf138['addContacts'](_0x5f18bf[_0xbab5('0x45')][_0xbab5('0x52')],_[_0xbab5('0x53')](_0x5f18bf[_0xbab5('0x45')],[_0xbab5('0x52'),'id'])||{});}})[_0xbab5('0x27')](respondWithResult(_0x1dd640,null))[_0xbab5('0x41')](handleError(_0x1dd640,null));};exports[_0xbab5('0x54')]=function(_0x4a2184,_0xa47a32,_0x346273){var _0x258496={};var _0x1b3944={};var _0x111211;var _0x345273;return db[_0xbab5('0x2d')][_0xbab5('0x55')]({'where':{'id':_0x4a2184['params']['id']}})['then'](handleEntityNotFound(_0xa47a32,null))[_0xbab5('0x27')](function(_0x515611){if(_0x515611){_0x111211=_0x515611;_0x1b3944[_0xbab5('0x2e')]=_[_0xbab5('0x2f')](db[_0xbab5('0x51')]['rawAttributes']);_0x1b3944[_0xbab5('0x32')]=_['keys'](_0x4a2184['query']);_0x1b3944[_0xbab5('0x30')]=_[_0xbab5('0x31')](_0x1b3944[_0xbab5('0x2e')],_0x1b3944[_0xbab5('0x32')]);_0x258496['attributes']=_['intersection'](_0x1b3944[_0xbab5('0x2e')],qs[_0xbab5('0x33')](_0x4a2184[_0xbab5('0x32')]['fields']));_0x258496[_0xbab5('0x34')]=_0x258496['attributes'][_0xbab5('0x35')]?_0x258496[_0xbab5('0x34')]:_0x1b3944[_0xbab5('0x2e')];_0x258496[_0xbab5('0x38')]=qs[_0xbab5('0x56')](_0x4a2184['query'][_0xbab5('0x56')]);_0x258496[_0xbab5('0x39')]=qs[_0xbab5('0x30')](_['pick'](_0x4a2184[_0xbab5('0x32')],_0x1b3944['filters']));if(_0x4a2184['query'][_0xbab5('0x3d')]){_0x258496[_0xbab5('0x39')]=_[_0xbab5('0x3b')](_0x258496[_0xbab5('0x39')],{'$or':_['map'](_0x258496['attributes'],function(_0x5511df){var _0x4e0343={};_0x4e0343[_0x5511df]={'$like':'%'+_0x4a2184[_0xbab5('0x32')][_0xbab5('0x3d')]+'%'};return _0x4e0343;})});}_0x258496=_[_0xbab5('0x3b')]({},_0x258496,_0x4a2184[_0xbab5('0x3e')]);return _0x111211[_0xbab5('0x54')](_0x258496);}})[_0xbab5('0x27')](function(_0x2bef76){if(_0x2bef76){_0x345273=_0x2bef76[_0xbab5('0x35')];if(!_0x4a2184['query']['hasOwnProperty'](_0xbab5('0x37'))){_0x258496[_0xbab5('0x1f')]=qs[_0xbab5('0x1f')](_0x4a2184[_0xbab5('0x32')][_0xbab5('0x1f')]);_0x258496[_0xbab5('0x1e')]=qs[_0xbab5('0x1e')](_0x4a2184[_0xbab5('0x32')][_0xbab5('0x1e')]);}return _0x111211[_0xbab5('0x54')](_0x258496);}})[_0xbab5('0x27')](function(_0x46c5bd){if(_0x46c5bd){return _0x46c5bd?{'count':_0x345273,'rows':_0x46c5bd}:null;}})[_0xbab5('0x27')](respondWithResult(_0xa47a32,null))[_0xbab5('0x41')](handleError(_0xa47a32,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b99648e..7700463 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 _0x8281=['../../config/environment','./cmCompany.attributes','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x391a63,_0x4e86f0){var _0x2c9fb0=function(_0xa40508){while(--_0xa40508){_0x391a63['push'](_0x391a63['shift']());}};_0x2c9fb0(++_0x4e86f0);}(_0x8281,0xfd));var _0x1828=function(_0x2c6422,_0xc3895b){_0x2c6422=_0x2c6422-0x0;var _0x39f844=_0x8281[_0x2c6422];return _0x39f844;};'use strict';var _=require(_0x1828('0x0'));var util=require(_0x1828('0x1'));var logger=require(_0x1828('0x2'))(_0x1828('0x3'));var moment=require(_0x1828('0x4'));var BPromise=require(_0x1828('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1828('0x6'));var config=require(_0x1828('0x7'));var attributes=require(_0x1828('0x8'));module['exports']=function(_0x253388,_0x474032){return _0x253388['define']('CmCompany',attributes,{'tableName':_0x1828('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1cd=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x3c22fe,_0x1b4c55){var _0x53df50=function(_0x105ea7){while(--_0x105ea7){_0x3c22fe['push'](_0x3c22fe['shift']());}};_0x53df50(++_0x1b4c55);}(_0xe1cd,0x9b));var _0xde1c=function(_0x43c963,_0x28b4b1){_0x43c963=_0x43c963-0x0;var _0x1e06b5=_0xe1cd[_0x43c963];return _0x1e06b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xde1c('0x0'))(_0xde1c('0x1'));var moment=require(_0xde1c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xde1c('0x3'));var config=require(_0xde1c('0x4'));var attributes=require(_0xde1c('0x5'));module[_0xde1c('0x6')]=function(_0x2e689d,_0x1f03a6){return _0x2e689d[_0xde1c('0x7')](_0xde1c('0x8'),attributes,{'tableName':_0xde1c('0x9'),'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 a0c3283..41b1cf3 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 _0x1f8b=['request\x20sent','debug','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x478e0b,_0x5f169d){var _0x37747e=function(_0x48ac10){while(--_0x48ac10){_0x478e0b['push'](_0x478e0b['shift']());}};_0x37747e(++_0x5f169d);}(_0x1f8b,0x90));var _0xb1f8=function(_0x1e8552,_0x4aec94){_0x1e8552=_0x1e8552-0x0;var _0x164630=_0x1f8b[_0x1e8552];return _0x164630;};'use strict';var _=require(_0xb1f8('0x0'));var util=require('util');var moment=require(_0xb1f8('0x1'));var BPromise=require(_0xb1f8('0x2'));var rs=require(_0xb1f8('0x3'));var fs=require('fs');var Redis=require(_0xb1f8('0x4'));var db=require(_0xb1f8('0x5'))['db'];var utils=require(_0xb1f8('0x6'));var logger=require(_0xb1f8('0x7'))(_0xb1f8('0x8'));var config=require(_0xb1f8('0x9'));var jayson=require(_0xb1f8('0xa'));var client=jayson[_0xb1f8('0xb')][_0xb1f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x358d48,_0x44a285,_0x49bbe5){return new BPromise(function(_0x4e235f,_0x5a57d4){return client[_0xb1f8('0xd')](_0x358d48,_0x49bbe5)[_0xb1f8('0xe')](function(_0x513762){logger[_0xb1f8('0xf')](_0xb1f8('0x10'),_0x44a285,_0xb1f8('0x11'));logger[_0xb1f8('0x12')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x44a285,_0xb1f8('0x11'),JSON[_0xb1f8('0x13')](_0x513762));if(_0x513762[_0xb1f8('0x14')]){if(_0x513762[_0xb1f8('0x14')]['code']===0x1f4){logger[_0xb1f8('0x14')](_0xb1f8('0x10'),_0x44a285,_0x513762[_0xb1f8('0x14')][_0xb1f8('0x15')]);return _0x5a57d4(_0x513762[_0xb1f8('0x14')][_0xb1f8('0x15')]);}logger['error'](_0xb1f8('0x10'),_0x44a285,_0x513762[_0xb1f8('0x14')]['message']);return _0x4e235f(_0x513762[_0xb1f8('0x14')]['message']);}else{logger[_0xb1f8('0xf')](_0xb1f8('0x10'),_0x44a285,'request\x20sent');_0x4e235f(_0x513762[_0xb1f8('0x16')][_0xb1f8('0x15')]);}})['catch'](function(_0x2cccff){logger['error'](_0xb1f8('0x10'),_0x44a285,_0x2cccff);_0x5a57d4(_0x2cccff);});});} \ No newline at end of file +var _0x1e42=['code','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error'];(function(_0x19ebdc,_0x11b44b){var _0x2436e6=function(_0xa03308){while(--_0xa03308){_0x19ebdc['push'](_0x19ebdc['shift']());}};_0x2436e6(++_0x11b44b);}(_0x1e42,0x66));var _0x21e4=function(_0x44512b,_0x199f03){_0x44512b=_0x44512b-0x0;var _0x30e108=_0x1e42[_0x44512b];return _0x30e108;};'use strict';var _=require(_0x21e4('0x0'));var util=require(_0x21e4('0x1'));var moment=require(_0x21e4('0x2'));var BPromise=require(_0x21e4('0x3'));var rs=require(_0x21e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21e4('0x5'))['db'];var utils=require(_0x21e4('0x6'));var logger=require(_0x21e4('0x7'))(_0x21e4('0x8'));var config=require(_0x21e4('0x9'));var jayson=require(_0x21e4('0xa'));var client=jayson['client'][_0x21e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd0e891,_0x4b8293,_0x4e3457){return new BPromise(function(_0x196392,_0x3f743){return client[_0x21e4('0xc')](_0xd0e891,_0x4e3457)[_0x21e4('0xd')](function(_0x54334c){logger['info']('CmCompany,\x20%s,\x20%s',_0x4b8293,_0x21e4('0xe'));logger[_0x21e4('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x4b8293,_0x21e4('0xe'),JSON[_0x21e4('0x10')](_0x54334c));if(_0x54334c[_0x21e4('0x11')]){if(_0x54334c[_0x21e4('0x11')][_0x21e4('0x12')]===0x1f4){logger[_0x21e4('0x11')](_0x21e4('0x13'),_0x4b8293,_0x54334c[_0x21e4('0x11')][_0x21e4('0x14')]);return _0x3f743(_0x54334c[_0x21e4('0x11')][_0x21e4('0x14')]);}logger['error'](_0x21e4('0x13'),_0x4b8293,_0x54334c['error'][_0x21e4('0x14')]);return _0x196392(_0x54334c[_0x21e4('0x11')][_0x21e4('0x14')]);}else{logger[_0x21e4('0x15')](_0x21e4('0x13'),_0x4b8293,_0x21e4('0xe'));_0x196392(_0x54334c[_0x21e4('0x16')][_0x21e4('0x14')]);}})[_0x21e4('0x17')](function(_0x2360b7){logger[_0x21e4('0x11')]('CmCompany,\x20%s,\x20%s',_0x4b8293,_0x2360b7);_0x3f743(_0x2360b7);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 559e099..8a5d1c9 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 _0x53d9=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x352b0f,_0x55ebee){var _0x143fb8=function(_0x2c869e){while(--_0x2c869e){_0x352b0f['push'](_0x352b0f['shift']());}};_0x143fb8(++_0x55ebee);}(_0x53d9,0xf7));var _0x953d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x953d('0x0'));var util=require(_0x953d('0x1'));var path=require(_0x953d('0x2'));var timeout=require(_0x953d('0x3'));var express=require(_0x953d('0x4'));var router=express['Router']();var fs_extra=require(_0x953d('0x5'));var auth=require(_0x953d('0x6'));var interaction=require(_0x953d('0x7'));var config=require(_0x953d('0x8'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x953d('0x9')]);router[_0x953d('0xa')](_0x953d('0xb'),auth[_0x953d('0xc')](),controller[_0x953d('0xd')]);router[_0x953d('0xa')](_0x953d('0xe'),auth[_0x953d('0xc')](),controller[_0x953d('0xf')]);router[_0x953d('0xa')](_0x953d('0x10'),auth[_0x953d('0xc')](),controller[_0x953d('0x11')]);router[_0x953d('0x12')]('/',auth[_0x953d('0xc')](),controller[_0x953d('0x13')]);router[_0x953d('0x12')](_0x953d('0x10'),auth[_0x953d('0xc')](),controller[_0x953d('0x14')]);router[_0x953d('0x15')](_0x953d('0xe'),auth[_0x953d('0xc')](),controller['update']);router['delete'](_0x953d('0xe'),auth[_0x953d('0xc')](),controller[_0x953d('0x16')]);module['exports']=router; \ No newline at end of file +var _0xc6b9=['isAuthenticated','show','/:id/contacts','post','create','addContacts','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','index','/describe','describe'];(function(_0xcf225,_0x3c74d9){var _0x1b8af5=function(_0x29883e){while(--_0x29883e){_0xcf225['push'](_0xcf225['shift']());}};_0x1b8af5(++_0x3c74d9);}(_0xc6b9,0x1bb));var _0x9c6b=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xc6b9[_0x3b5049];return _0x12454e;};'use strict';var multer=require(_0x9c6b('0x0'));var util=require(_0x9c6b('0x1'));var path=require(_0x9c6b('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c6b('0x3'));var router=express[_0x9c6b('0x4')]();var fs_extra=require(_0x9c6b('0x5'));var auth=require(_0x9c6b('0x6'));var interaction=require(_0x9c6b('0x7'));var config=require('../../config/environment');var controller=require(_0x9c6b('0x8'));router[_0x9c6b('0x9')]('/',auth['isAuthenticated'](),controller[_0x9c6b('0xa')]);router[_0x9c6b('0x9')](_0x9c6b('0xb'),auth['isAuthenticated'](),controller[_0x9c6b('0xc')]);router[_0x9c6b('0x9')]('/:id',auth[_0x9c6b('0xd')](),controller[_0x9c6b('0xe')]);router['get'](_0x9c6b('0xf'),auth[_0x9c6b('0xd')](),controller['getContacts']);router[_0x9c6b('0x10')]('/',auth['isAuthenticated'](),controller[_0x9c6b('0x11')]);router[_0x9c6b('0x10')](_0x9c6b('0xf'),auth[_0x9c6b('0xd')](),controller[_0x9c6b('0x12')]);router['put'](_0x9c6b('0x13'),auth[_0x9c6b('0xd')](),controller[_0x9c6b('0x14')]);router[_0x9c6b('0x15')](_0x9c6b('0x13'),auth['isAuthenticated'](),controller[_0x9c6b('0x16')]);module[_0x9c6b('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 5a82acd..c48e697 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 _0xb001=['DATE','NOW','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0xb001,0x144));var _0x1b00=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb001[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x1b00('0x0'));var Sequelize=require(_0x1b00('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x1b00('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1b00('0x2')]},'street':{'type':Sequelize[_0x1b00('0x2')]},'postalCode':{'type':Sequelize[_0x1b00('0x2')]},'city':{'type':Sequelize[_0x1b00('0x2')]},'country':{'type':Sequelize[_0x1b00('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1b00('0x3')]},'phone':{'type':Sequelize[_0x1b00('0x2')]},'mobile':{'type':Sequelize[_0x1b00('0x2')]},'fax':{'type':Sequelize[_0x1b00('0x2')]},'email':{'type':Sequelize[_0x1b00('0x2')]},'url':{'type':Sequelize[_0x1b00('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x1b00('0x2')]},'twitter':{'type':Sequelize[_0x1b00('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x1b00('0x2')]},'viber':{'type':Sequelize[_0x1b00('0x2')]},'line':{'type':Sequelize[_0x1b00('0x2')]},'wechat':{'type':Sequelize[_0x1b00('0x2')]},'telegram':{'type':Sequelize[_0x1b00('0x2')]},'UserId':{'type':Sequelize[_0x1b00('0x4')]},'priority':{'type':Sequelize[_0x1b00('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1b00('0x5')],'defaultValue':Sequelize[_0x1b00('0x6')]}}; \ No newline at end of file +var _0x171d=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x134e0c,_0x1e5d9c){var _0x4997e3=function(_0x3b8c60){while(--_0x3b8c60){_0x134e0c['push'](_0x134e0c['shift']());}};_0x4997e3(++_0x1e5d9c);}(_0x171d,0x9b));var _0xd171=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x171d[_0x500c0];return _0xdd146f;};'use strict';var _=require(_0xd171('0x0'));var Sequelize=require(_0xd171('0x1'));module[_0xd171('0x2')]={'firstName':{'type':Sequelize[_0xd171('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd171('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xd171('0x3')]},'city':{'type':Sequelize[_0xd171('0x3')]},'country':{'type':Sequelize[_0xd171('0x3')]},'dateOfBirth':{'type':Sequelize[_0xd171('0x3')]},'description':{'type':Sequelize[_0xd171('0x4')]},'phone':{'type':Sequelize[_0xd171('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xd171('0x3')]},'facebook':{'type':Sequelize[_0xd171('0x3')]},'fb_data':{'type':Sequelize[_0xd171('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xd171('0x3')]},'viber':{'type':Sequelize[_0xd171('0x3')]},'line':{'type':Sequelize[_0xd171('0x3')]},'wechat':{'type':Sequelize[_0xd171('0x3')]},'telegram':{'type':Sequelize[_0xd171('0x3')]},'UserId':{'type':Sequelize[_0xd171('0x5')]},'priority':{'type':Sequelize[_0xd171('0x5')](0x2)[_0xd171('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xd171('0x7')],'defaultValue':Sequelize[_0xd171('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 6029391..05c9306 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 _0x64ec=['disposition','secondDisposition','thirdDisposition','key','browserName','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','mail','subject','substatus','externalUrl','Interaction','findAndCountAll','Owner','flatten','sortBy','slice','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','CmContact','describe','keys','CmCustomField','findOne','trimStart','cf_','all','length','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','uc.UserId\x20=\x20?','fieldType','datetime','DATE','buildExpression','type','text','start','isNil','Contact','push','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','t.id\x20IN\x20?','user','some','User','c.ListId\x20IS\x20NULL','sequelize','toString','merge','c.lastName','c.phone','c.mobile','c.fax','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','startsWith','columnName','displayName','findAll','custom','values','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ChatQueueReport','FaxQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','each','duplicates','$or','findOrCreate','show','color','$and','omit','format','cf_%d','pickBy','table','id\x20=\x20?','phone','getTags','rawAttributes','setTags','ContactId','options','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','fork','CompanyId','socket_timestamp','pid','createReadStream','path','parse','meta','import','agent','binding','No\x20phone\x20column\x20specified','firstName','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','sms','openchannel','fax','whatsapp','voice','-createdAt','includes','toLowerCase','Invalid\x20channel','channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','destination','callerid','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','alias','DESC','VoiceCallReport','fullname','startCase','chat','Account','closedAt'];(function(_0x11512a,_0x201516){var _0x510ecc=function(_0x1be3a1){while(--_0x1be3a1){_0x11512a['push'](_0x11512a['shift']());}};_0x510ecc(++_0x201516);}(_0x64ec,0x139));var _0xc64e=function(_0x2d730b,_0x1e0d95){_0x2d730b=_0x2d730b-0x0;var _0x44a0ae=_0x64ec[_0x2d730b];return _0x44a0ae;};'use strict';var emlformat=require(_0xc64e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc64e('0x1'));var jsonpatch=require(_0xc64e('0x2'));var rp=require(_0xc64e('0x3'));var moment=require('moment');var BPromise=require(_0xc64e('0x4'));var Mustache=require(_0xc64e('0x5'));var util=require(_0xc64e('0x6'));var path=require('path');var sox=require(_0xc64e('0x7'));var csv=require(_0xc64e('0x8'));var ejs=require(_0xc64e('0x9'));var fs=require('fs');var fs_extra=require(_0xc64e('0xa'));var _=require(_0xc64e('0xb'));var squel=require('squel');var crypto=require(_0xc64e('0xc'));var jsforce=require(_0xc64e('0xd'));var deskjs=require(_0xc64e('0xe'));var toCsv=require(_0xc64e('0x8'));var querystring=require(_0xc64e('0xf'));var Papa=require(_0xc64e('0x10'));var Redis=require(_0xc64e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc64e('0x12'));var as=require(_0xc64e('0x13'));var hardwareService=require(_0xc64e('0x14'));var logger=require(_0xc64e('0x15'))(_0xc64e('0x16'));var utils=require('../../config/utils');var config=require(_0xc64e('0x17'));var licenseUtil=require(_0xc64e('0x18'));var db=require('../../mysqldb')['db'];config[_0xc64e('0x19')]=_[_0xc64e('0x1a')](config[_0xc64e('0x19')],{'host':_0xc64e('0x1b'),'port':0x18eb});var socket=require(_0xc64e('0x1c'))(new Redis(config['redis']));require(_0xc64e('0x1d'))[_0xc64e('0x1e')](socket);function respondWithStatusCode(_0x13a345,_0x828e66){_0x828e66=_0x828e66||0xcc;return function(_0x1e8ab1){if(_0x1e8ab1){return _0x13a345[_0xc64e('0x1f')](_0x828e66);}return _0x13a345[_0xc64e('0x20')](_0x828e66)[_0xc64e('0x21')]();};}function respondWithResult(_0x1fa8d2,_0x5a42bc){_0x5a42bc=_0x5a42bc||0xc8;return function(_0x10c886){if(_0x10c886){return _0x1fa8d2[_0xc64e('0x20')](_0x5a42bc)[_0xc64e('0x22')](_0x10c886);}};}function respondWithFilteredResult(_0x5a61c6,_0x4c921b){return function(_0x404c2a){if(_0x404c2a){var _0x4bc7a0=typeof _0x4c921b[_0xc64e('0x23')]===_0xc64e('0x24')&&typeof _0x4c921b[_0xc64e('0x25')]===_0xc64e('0x24');var _0x1490c1=_0x404c2a[_0xc64e('0x26')];var _0x2dbae7=_0x4bc7a0?0x0:_0x4c921b['offset'];var _0x222f8f=_0x4bc7a0?_0x404c2a[_0xc64e('0x26')]:_0x4c921b[_0xc64e('0x23')]+_0x4c921b['limit'];var _0x36eaee;if(_0x222f8f>=_0x1490c1){_0x222f8f=_0x1490c1;_0x36eaee=0xc8;}else{_0x36eaee=0xce;}_0x5a61c6[_0xc64e('0x20')](_0x36eaee);return _0x5a61c6[_0xc64e('0x27')](_0xc64e('0x28'),_0x2dbae7+'-'+_0x222f8f+'/'+_0x1490c1)['json'](_0x404c2a);}return null;};}function patchUpdates(_0x5b5e2d){return function(_0x2b501b){try{jsonpatch[_0xc64e('0x29')](_0x2b501b,_0x5b5e2d,!![]);}catch(_0xfa65e3){return BPromise[_0xc64e('0x2a')](_0xfa65e3);}return _0x2b501b[_0xc64e('0x2b')]();};}function saveUpdates(_0xa302ed,_0x1eb4a3){return function(_0x16b8c9){if(_0x16b8c9){return _0x16b8c9[_0xc64e('0x2c')](_0xa302ed)[_0xc64e('0x2d')](function(_0x1ec4b7){return _0x1ec4b7;});}return null;};}function removeEntity(_0x232a86,_0x29cd75){return function(_0x356fdd){if(_0x356fdd){return _0x356fdd[_0xc64e('0x2e')]()[_0xc64e('0x2d')](function(){_0x232a86['status'](0xcc)[_0xc64e('0x21')]();});}};}function handleEntityNotFound(_0x53a679,_0x1ab67b){return function(_0xba68e8){if(!_0xba68e8){_0x53a679['sendStatus'](0x194);}return _0xba68e8;};}function handleError(_0x28e1c3,_0x38b003){_0x38b003=_0x38b003||0x1f4;return function(_0x4aa0ad){logger[_0xc64e('0x2f')](_0x4aa0ad['stack']);if(_0x4aa0ad[_0xc64e('0x30')]){delete _0x4aa0ad[_0xc64e('0x30')];}_0x28e1c3[_0xc64e('0x20')](_0x38b003)['send'](_0x4aa0ad);};}exports[_0xc64e('0x31')]=function(_0x510167,_0x5a4c9e){var _0x483b1f={},_0x2db687={},_0x4c7a99={'count':0x0,'rows':[]};return db[_0xc64e('0x32')][_0xc64e('0x33')]()[_0xc64e('0x2d')](function(_0x478af2){var _0xd68375=[];for(var _0xa68df4=0x0;_0xa68df40x1){_0x1f87d2['or'](_0xc64e('0x72'),qs['getFullTextValue'](_0x50843c),null);}else{if(qs[_0xc64e('0x73')](_0x50843c)){_0x1f87d2['or'](_0xc64e('0x74'),_0x50843c+'%');_0x1f87d2['or']('c.phone\x20LIKE\x20?',_0x50843c+'%');_0x1f87d2['or']('c.mobile\x20LIKE\x20?',_0x50843c+'%');_0x1f87d2['or']('c.fax\x20LIKE\x20?',_0x50843c+'%');}else if(qs[_0xc64e('0x75')](_0x50843c)){_0x1f87d2['or'](_0xc64e('0x76'),_0x50843c+'%');}else{_0x1f87d2['or'](_0xc64e('0x77'),'%'+_0x50843c+'%');_0x1f87d2['or'](_0xc64e('0x78'),'%'+_0x50843c+'%');_0x1f87d2['or']('c.email\x20LIKE\x20?','%'+_0x50843c+'%');}}}}_0x2e1885['where'](_0x1f87d2);_0x2e1885[_0xc64e('0x79')](_0xc64e('0x7a'));var _0x58635b={'type':db['Sequelize'][_0xc64e('0x7b')][_0xc64e('0x7c')],'raw':!![]};var _0x4c6172=_0x2e1885['clone']()[_0xc64e('0x48')]('c.id');if(_0x483b1f['order']){_0x483b1f[_0xc64e('0x43')][_0xc64e('0x5d')](function(_0x47af10){_0x2e1885['order']('c.'+_0x47af10[0x0],_0x47af10[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc64e('0x6b')](_0x597253)){_0x2e1885['having'](_0x3645ca);_0x4c6172[_0xc64e('0x45')](_0xc64e('0x7d'),_0x597253);}BPromise['resolve']()[_0xc64e('0x2d')](function(){if(!_0x32d8b5)return;if(_0x510167[_0xc64e('0x7e')]['role']!=='agent')return;if(!_[_0xc64e('0x7f')](_0x32d8b5[_0xc64e('0x57')],[_0xc64e('0x48'),_0xc64e('0x80')])){return _0x510167[_0xc64e('0x7e')]['getLists']({'attributes':['id'],'raw':!![]})[_0xc64e('0x2d')](function(_0x22d2fe){if(_['isEmpty'](_0x22d2fe)){_0x4c6172[_0xc64e('0x45')](_0xc64e('0x81'));_0x2e1885[_0xc64e('0x45')](_0xc64e('0x81'));}else{_0x4c6172['where'](_0xc64e('0x6d'),_[_0xc64e('0x5c')](_0x22d2fe,'id'));_0x2e1885['where'](_0xc64e('0x6d'),_['map'](_0x22d2fe,'id'));}});}})[_0xc64e('0x2d')](function(){if(_0x510167[_0xc64e('0x7e')]['role']==='agent'&&!_0x32d8b5&&!_0x510167[_0xc64e('0x3c')][_0xc64e('0x6c')])return[];return db[_0xc64e('0x82')][_0xc64e('0x3c')](_0x4c6172[_0xc64e('0x83')](),_0x58635b);})[_0xc64e('0x2d')](function(_0x315139){_0x4c7a99['count']=_0x315139[_0xc64e('0x3a')];if(_0x4c7a99[_0xc64e('0x26')]===0x0)return[];return db[_0xc64e('0x82')][_0xc64e('0x3c')](_0x4f8986[_0xc64e('0x83')](),_0x58635b)[_0xc64e('0x2d')](function(_0x34cd31){_0x576644=_['keyBy'](_0x34cd31,'id');_0x58635b=_[_0xc64e('0x84')](_0x58635b,{'model':db[_0xc64e('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x510167[_0xc64e('0x3c')][_0xc64e('0x40')]){_0x483b1f[_0xc64e('0x3f')][_0xc64e('0x5d')](function(_0x3b708e){_0x2e1885[_0xc64e('0x48')]('c.'+_0x3b708e);});}else{_0x2e1885[_0xc64e('0x48')]('c.id');_0x2e1885[_0xc64e('0x48')]('c.firstName');_0x2e1885[_0xc64e('0x48')](_0xc64e('0x85'));_0x2e1885['field'](_0xc64e('0x86'));_0x2e1885[_0xc64e('0x48')](_0xc64e('0x87'));_0x2e1885[_0xc64e('0x48')](_0xc64e('0x88'));_0x2e1885[_0xc64e('0x48')]('c.email');_0x2e1885['field']('c.ListId');_0x2e1885['field'](_0xc64e('0x89'));_0x2e1885[_0xc64e('0x48')](_0xc64e('0x8a'));_0x2e1885[_0xc64e('0x48')](_0xc64e('0x8b'));_0x2e1885[_0xc64e('0x48')](_0xc64e('0x8c'),_0xc64e('0x8d'));}if(_0x483b1f[_0xc64e('0x25')])_0x2e1885['limit'](_0x483b1f[_0xc64e('0x25')]);if(_0x483b1f['offset'])_0x2e1885[_0xc64e('0x23')](_0x483b1f[_0xc64e('0x23')]);return db[_0xc64e('0x82')]['query'](_0x2e1885[_0xc64e('0x83')](),_0x58635b);});})[_0xc64e('0x2d')](function(_0x5b093e){_0x5b093e[_0xc64e('0x5d')](function(_0x31afe8){if(_0x31afe8[_0xc64e('0x8d')]){_0x31afe8[_0xc64e('0x8e')]=[];_0x31afe8['TagIds']['split'](',')[_0xc64e('0x5d')](function(_0x5e77f9){_0x31afe8['Tags'][_0xc64e('0x6a')](_0x576644[_0x5e77f9]);});}delete _0x31afe8[_0xc64e('0x8d')];});_0x4c7a99[_0xc64e('0x8f')]=_0x5b093e;return _0x4c7a99;})[_0xc64e('0x2d')](respondWithFilteredResult(_0x5a4c9e,_0x483b1f));})[_0xc64e('0x90')](handleError(_0x5a4c9e,null));};exports[_0xc64e('0x2e')]=function(_0x366778,_0x20ce6f){return db[_0xc64e('0x32')][_0xc64e('0x58')]({'where':{'id':_0x366778[_0xc64e('0x91')]['id']}})[_0xc64e('0x2d')](handleEntityNotFound(_0x20ce6f,null))[_0xc64e('0x2d')](removeEntity(_0x20ce6f,null))['catch'](handleError(_0x20ce6f,null));};exports[_0xc64e('0x33')]=function(_0x141b36,_0x580364){return db['CmContact'][_0xc64e('0x33')]()[_0xc64e('0x2d')](function(_0x5c193a){delete _0x5c193a[_0xc64e('0x92')];for(var _0x219429=0x0;_0x219429=_0x499e4d){_0x4d7163=_0x499e4d;_0x1546f2=0xc8;}else{_0x1546f2=0xce;}_0x3feada[_0xc62f('0x20')](_0x1546f2);return _0x3feada[_0xc62f('0x27')](_0xc62f('0x28'),_0x2e1a8a+'-'+_0x4d7163+'/'+_0x499e4d)[_0xc62f('0x22')](_0x47af10);}return null;};}function patchUpdates(_0x2dc43a){return function(_0x20178a){try{jsonpatch[_0xc62f('0x29')](_0x20178a,_0x2dc43a,!![]);}catch(_0x57248a){return BPromise[_0xc62f('0x2a')](_0x57248a);}return _0x20178a[_0xc62f('0x2b')]();};}function saveUpdates(_0x21ddea,_0xbaf8fa){return function(_0x3b7721){if(_0x3b7721){return _0x3b7721['update'](_0x21ddea)[_0xc62f('0x2c')](function(_0x55fd33){return _0x55fd33;});}return null;};}function removeEntity(_0x2dc1b9,_0x1d359c){return function(_0x1310f3){if(_0x1310f3){return _0x1310f3['destroy']()['then'](function(){_0x2dc1b9[_0xc62f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e04e2,_0x10043a){return function(_0x388b8e){if(!_0x388b8e){_0x1e04e2[_0xc62f('0x1f')](0x194);}return _0x388b8e;};}function handleError(_0x3d439a,_0x27144d){_0x27144d=_0x27144d||0x1f4;return function(_0x1af45f){logger[_0xc62f('0x2d')](_0x1af45f[_0xc62f('0x2e')]);if(_0x1af45f['name']){delete _0x1af45f[_0xc62f('0x2f')];}_0x3d439a[_0xc62f('0x20')](_0x27144d)[_0xc62f('0x30')](_0x1af45f);};}exports[_0xc62f('0x31')]=function(_0x40af6b,_0x364f4d){var _0x1ea2a1={},_0x488158={},_0x11dfa7={'count':0x0,'rows':[]};return db[_0xc62f('0x32')]['describe']()['then'](function(_0x3effec){var _0x3fee6a=[];for(var _0x3557a6=0x0;_0x3557a60x1){_0x12f776['or'](_0xc62f('0x6e'),qs[_0xc62f('0x6f')](_0x335930),null);}else{if(qs[_0xc62f('0x70')](_0x335930)){_0x12f776['or'](_0xc62f('0x71'),_0x335930+'%');_0x12f776['or'](_0xc62f('0x72'),_0x335930+'%');_0x12f776['or'](_0xc62f('0x73'),_0x335930+'%');_0x12f776['or'](_0xc62f('0x74'),_0x335930+'%');}else if(qs[_0xc62f('0x75')](_0x335930)){_0x12f776['or'](_0xc62f('0x76'),_0x335930+'%');}else{_0x12f776['or'](_0xc62f('0x77'),'%'+_0x335930+'%');_0x12f776['or']('c.lastName\x20LIKE\x20?','%'+_0x335930+'%');_0x12f776['or'](_0xc62f('0x76'),'%'+_0x335930+'%');}}}}_0x52dc97[_0xc62f('0x50')](_0x12f776);_0x52dc97[_0xc62f('0x78')]('c.id');var _0x10a23c={'type':db[_0xc62f('0x79')][_0xc62f('0x7a')]['SELECT'],'raw':!![]};var _0x10e406=_0x52dc97[_0xc62f('0x7b')]()[_0xc62f('0x48')](_0xc62f('0x7c'));if(_0x1ea2a1[_0xc62f('0x44')]){_0x1ea2a1[_0xc62f('0x44')]['forEach'](function(_0x40f617){_0x52dc97[_0xc62f('0x44')]('c.'+_0x40f617[0x0],_0x40f617[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc62f('0x66')](_0x3c2eed)){_0x52dc97['having'](_0x3576b3);_0x10e406['where'](_0xc62f('0x7d'),_0x3c2eed);}BPromise[_0xc62f('0x7e')]()['then'](function(){if(!_0x4b87de)return;if(_0x40af6b[_0xc62f('0x7f')]['role']!=='agent')return;if(!_['some'](_0x4b87de[_0xc62f('0x80')],['field',_0xc62f('0x81')])){return _0x40af6b[_0xc62f('0x7f')][_0xc62f('0x82')]({'attributes':['id'],'raw':!![]})[_0xc62f('0x2c')](function(_0x19c9e8){if(_[_0xc62f('0x66')](_0x19c9e8)){_0x10e406[_0xc62f('0x50')](_0xc62f('0x83'));_0x52dc97['where'](_0xc62f('0x83'));}else{_0x10e406[_0xc62f('0x50')]('c.ListId\x20IN\x20?',_['map'](_0x19c9e8,'id'));_0x52dc97[_0xc62f('0x50')]('c.ListId\x20IN\x20?',_['map'](_0x19c9e8,'id'));}});}})[_0xc62f('0x2c')](function(){if(_0x40af6b[_0xc62f('0x7f')][_0xc62f('0x84')]===_0xc62f('0x85')&&!_0x4b87de&&!_0x40af6b['query'][_0xc62f('0x86')])return[];return db[_0xc62f('0x87')][_0xc62f('0x3d')](_0x10e406[_0xc62f('0x88')](),_0x10a23c);})[_0xc62f('0x2c')](function(_0x34212d){_0x11dfa7['count']=_0x34212d[_0xc62f('0x33')];if(_0x11dfa7[_0xc62f('0x26')]===0x0)return[];return db[_0xc62f('0x87')][_0xc62f('0x3d')](_0x1c786d['toString'](),_0x10a23c)[_0xc62f('0x2c')](function(_0xca3add){_0x4f5de3=_[_0xc62f('0x89')](_0xca3add,'id');_0x10a23c=_[_0xc62f('0x8a')](_0x10a23c,{'model':db[_0xc62f('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40af6b[_0xc62f('0x3d')][_0xc62f('0x41')]){_0x1ea2a1[_0xc62f('0x40')][_0xc62f('0x59')](function(_0x3523fd){_0x52dc97['field']('c.'+_0x3523fd);});}else{_0x52dc97[_0xc62f('0x48')](_0xc62f('0x7c'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8b'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8c'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8d'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8e'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x8f'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x90'));_0x52dc97['field'](_0xc62f('0x91'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x92'));_0x52dc97[_0xc62f('0x48')](_0xc62f('0x93'));_0x52dc97[_0xc62f('0x48')]('c.CompanyId');_0x52dc97[_0xc62f('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc62f('0x94'));}if(_0x1ea2a1['limit'])_0x52dc97[_0xc62f('0x24')](_0x1ea2a1[_0xc62f('0x24')]);if(_0x1ea2a1[_0xc62f('0x23')])_0x52dc97[_0xc62f('0x23')](_0x1ea2a1[_0xc62f('0x23')]);return db['sequelize'][_0xc62f('0x3d')](_0x52dc97[_0xc62f('0x88')](),_0x10a23c);});})[_0xc62f('0x2c')](function(_0x5a83e5){_0x5a83e5[_0xc62f('0x59')](function(_0x28f14d){if(_0x28f14d[_0xc62f('0x94')]){_0x28f14d[_0xc62f('0x95')]=[];_0x28f14d[_0xc62f('0x94')][_0xc62f('0x58')](',')[_0xc62f('0x59')](function(_0x4e3894){_0x28f14d[_0xc62f('0x95')]['push'](_0x4f5de3[_0x4e3894]);});}delete _0x28f14d['TagIds'];});_0x11dfa7[_0xc62f('0x96')]=_0x5a83e5;return _0x11dfa7;})[_0xc62f('0x2c')](respondWithFilteredResult(_0x364f4d,_0x1ea2a1));})[_0xc62f('0x97')](handleError(_0x364f4d,null));};exports[_0xc62f('0x98')]=function(_0x255db7,_0x4ef4aa){return db[_0xc62f('0x32')][_0xc62f('0x55')]({'where':{'id':_0x255db7[_0xc62f('0x99')]['id']}})[_0xc62f('0x2c')](handleEntityNotFound(_0x4ef4aa,null))[_0xc62f('0x2c')](removeEntity(_0x4ef4aa,null))[_0xc62f('0x97')](handleError(_0x4ef4aa,null));};exports[_0xc62f('0x9a')]=function(_0x318b96,_0x447caf){return db[_0xc62f('0x32')]['describe']()[_0xc62f('0x2c')](function(_0x34b541){delete _0x34b541[_0xc62f('0x9b')];for(var _0x46576e=0x0;_0x46576e{}\s\\|]/g,'-');_0x3267b0(null,util[_0x9219('0x21')]('%s-%s%s',path['basename'](_0x1b2614[_0x9219('0x1f')],path[_0x9219('0x22')](_0x1b2614[_0x9219('0x1f')])),Date[_0x9219('0x23')](),path[_0x9219('0x22')](_0x1b2614[_0x9219('0x1f')])));}})});router[_0x9219('0x18')]('/csv',upload[_0x9219('0x24')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x508a86,_0x510a8c,_0x1b8520){_0x1b8520(null,path[_0x9219('0x25')](config[_0x9219('0x1e')],_0x9219('0x26')));},'filename':function(_0x3b2e5b,_0x5386fa,_0x48c91a){_0x5386fa[_0x9219('0x1f')]=_0x5386fa[_0x9219('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x48c91a(null,util[_0x9219('0x21')](_0x9219('0x27'),path['basename'](_0x5386fa[_0x9219('0x1f')],path[_0x9219('0x22')](_0x5386fa[_0x9219('0x1f')])),Date['now'](),path[_0x9219('0x22')](_0x5386fa[_0x9219('0x1f')])));}})});router[_0x9219('0x18')](_0x9219('0x28'),upload[_0x9219('0x24')](_0x9219('0x29')),controller[_0x9219('0x2a')]);router[_0x9219('0x18')](_0x9219('0x2b'),auth[_0x9219('0x8')](),controller[_0x9219('0x2c')]);router[_0x9219('0x2d')]('/:id',auth[_0x9219('0x8')](),controller[_0x9219('0x2e')]);router[_0x9219('0x2f')](_0x9219('0xd'),auth[_0x9219('0x8')](),controller[_0x9219('0x30')]);module[_0x9219('0x31')]=router; \ No newline at end of file +var _0xe5f2=['../../components/auth/service','../../config/environment','./cmContact.controller','get','/describe','isAuthenticated','describe','/:id','show','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','merge','post','/create_many','/:id/tags','diskStorage','server/files/tmp','originalname','replace','%s-%s%s','basename','extname','now','/csv','single','file','join','root','/upload','upload','/upload/:id','import','put','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x38cf70,_0x1c4cc4){var _0x3bb2e5=function(_0x5a3ab9){while(--_0x5a3ab9){_0x38cf70['push'](_0x38cf70['shift']());}};_0x3bb2e5(++_0x1c4cc4);}(_0xe5f2,0xb9));var _0x2e5f=function(_0x4f328c,_0x1636e8){_0x4f328c=_0x4f328c-0x0;var _0x486839=_0xe5f2[_0x4f328c];return _0x486839;};'use strict';var multer=require(_0x2e5f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2e5f('0x1'));var express=require('express');var router=express[_0x2e5f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2e5f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2e5f('0x4'));var controller=require(_0x2e5f('0x5'));router[_0x2e5f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2e5f('0x7'),auth[_0x2e5f('0x8')](),controller[_0x2e5f('0x9')]);router['get'](_0x2e5f('0xa'),auth[_0x2e5f('0x8')](),controller[_0x2e5f('0xb')]);router[_0x2e5f('0x6')]('/:id/tags',auth[_0x2e5f('0x8')](),controller[_0x2e5f('0xc')]);router[_0x2e5f('0x6')](_0x2e5f('0xd'),auth[_0x2e5f('0x8')](),controller['getHoppers']);router[_0x2e5f('0x6')](_0x2e5f('0xe'),auth[_0x2e5f('0x8')](),controller[_0x2e5f('0xf')]);router[_0x2e5f('0x6')](_0x2e5f('0x10'),auth['isAuthenticated'](),controller[_0x2e5f('0x11')]);router[_0x2e5f('0x6')]('/:id/jscripty_sessions',auth[_0x2e5f('0x8')](),controller[_0x2e5f('0x12')]);router['get'](_0x2e5f('0x13'),auth[_0x2e5f('0x8')](),controller[_0x2e5f('0x14')]);router['post']('/merge',auth[_0x2e5f('0x8')](),controller[_0x2e5f('0x15')]);router['post']('/',auth[_0x2e5f('0x8')](),controller['create']);router[_0x2e5f('0x16')](_0x2e5f('0x17'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x2e5f('0x16')](_0x2e5f('0x18'),auth[_0x2e5f('0x8')](),controller['setTags']);var upload=multer({'storage':multer[_0x2e5f('0x19')]({'destination':function(_0x2c7ae5,_0xe1e9a2,_0x2b285f){_0x2b285f(null,path['join'](config['root'],_0x2e5f('0x1a')));},'filename':function(_0x53f1a4,_0xf72d73,_0x2d9194){_0xf72d73[_0x2e5f('0x1b')]=_0xf72d73[_0x2e5f('0x1b')][_0x2e5f('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d9194(null,util['format'](_0x2e5f('0x1d'),path[_0x2e5f('0x1e')](_0xf72d73[_0x2e5f('0x1b')],path[_0x2e5f('0x1f')](_0xf72d73[_0x2e5f('0x1b')])),Date[_0x2e5f('0x20')](),path[_0x2e5f('0x1f')](_0xf72d73[_0x2e5f('0x1b')])));}})});router[_0x2e5f('0x16')](_0x2e5f('0x21'),upload[_0x2e5f('0x22')](_0x2e5f('0x23')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x2e5f('0x19')]({'destination':function(_0x57125f,_0x556126,_0x93fe78){_0x93fe78(null,path[_0x2e5f('0x24')](config[_0x2e5f('0x25')],_0x2e5f('0x1a')));},'filename':function(_0x53931a,_0x500f72,_0x23ed11){_0x500f72['originalname']=_0x500f72[_0x2e5f('0x1b')][_0x2e5f('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23ed11(null,util['format'](_0x2e5f('0x1d'),path[_0x2e5f('0x1e')](_0x500f72[_0x2e5f('0x1b')],path[_0x2e5f('0x1f')](_0x500f72[_0x2e5f('0x1b')])),Date[_0x2e5f('0x20')](),path['extname'](_0x500f72['originalname'])));}})});router['post'](_0x2e5f('0x26'),upload['single']('file'),controller[_0x2e5f('0x27')]);router['post'](_0x2e5f('0x28'),auth['isAuthenticated'](),controller[_0x2e5f('0x29')]);router[_0x2e5f('0x2a')]('/:id',auth[_0x2e5f('0x8')](),controller[_0x2e5f('0x2b')]);router[_0x2e5f('0x2c')](_0x2e5f('0xa'),auth[_0x2e5f('0x8')](),controller[_0x2e5f('0x2d')]);module[_0x2e5f('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 b2cd2a0..4e0a609 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 _0xde2e=['ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','type','parse','values','isArray','stringify','BOOLEAN'];(function(_0x5162e9,_0x55c047){var _0xea59da=function(_0x5e71ed){while(--_0x5e71ed){_0x5162e9['push'](_0x5162e9['shift']());}};_0xea59da(++_0x55c047);}(_0xde2e,0xac));var _0xede2=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0xde2e[_0x57486e];return _0x5f110b;};'use strict';var Sequelize=require(_0xede2('0x0'));var _=require('lodash');module[_0xede2('0x1')]={'name':{'type':Sequelize[_0xede2('0x2')],'get':function(_0x31f3df){return this[_0xede2('0x3')]('alias');}},'alias':{'type':Sequelize[_0xede2('0x4')],'allowNull':![],'set':function(_0x1ba23d){this[_0xede2('0x5')](_0xede2('0x6'),_0x1ba23d?_0x1ba23d:this[_0xede2('0x3')](_0xede2('0x7')));}},'type':{'type':Sequelize[_0xede2('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xede2('0x8')]('long'),'get':function(){if(this[_0xede2('0x3')](_0xede2('0x9'))==='select'){return JSON[_0xede2('0xa')](this[_0xede2('0x3')](_0xede2('0xb')));}else{return this[_0xede2('0x3')]('values');}},'set':function(_0x4e6d13){if(Array[_0xede2('0xc')](_0x4e6d13)){this['setDataValue'](_0xede2('0xb'),JSON[_0xede2('0xd')](_0x4e6d13));}else{this['setDataValue'](_0xede2('0xb'),_0x4e6d13);}}},'required':{'type':Sequelize[_0xede2('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xede2('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xede2('0xf')](_0xede2('0x10'))}}; \ No newline at end of file +var _0x1c21=['ENUM','voice','lodash','VIRTUAL','STRING','getDataValue','name','TEXT','type','select','parse','values','setDataValue','stringify','BOOLEAN'];(function(_0x320486,_0x5a32bc){var _0xce8126=function(_0xe8bda8){while(--_0xe8bda8){_0x320486['push'](_0x320486['shift']());}};_0xce8126(++_0x5a32bc);}(_0x1c21,0x1c4));var _0x11c2=function(_0x10b56f,_0x322bb2){_0x10b56f=_0x10b56f-0x0;var _0x263442=_0x1c21[_0x10b56f];return _0x263442;};'use strict';var Sequelize=require('sequelize');var _=require(_0x11c2('0x0'));module['exports']={'name':{'type':Sequelize[_0x11c2('0x1')],'get':function(_0x41532a){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x11c2('0x2')],'allowNull':![],'set':function(_0x54be4a){this['setDataValue']('alias',_0x54be4a?_0x54be4a:this[_0x11c2('0x3')](_0x11c2('0x4')));}},'type':{'type':Sequelize[_0x11c2('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0x11c2('0x5')]('long'),'get':function(){if(this['getDataValue'](_0x11c2('0x6'))===_0x11c2('0x7')){return JSON[_0x11c2('0x8')](this['getDataValue']('values'));}else{return this[_0x11c2('0x3')](_0x11c2('0x9'));}},'set':function(_0x5d70cb){if(Array['isArray'](_0x5d70cb)){this[_0x11c2('0xa')](_0x11c2('0x9'),JSON[_0x11c2('0xb')](_0x5d70cb));}else{this[_0x11c2('0xa')]('values',_0x5d70cb);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x11c2('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x11c2('0xd')](_0x11c2('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 2f33d2d..7584ad8 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 _0x37e6=['Content-Range','json','apply','update','then','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','options','CmCustomField','includeAll','include','findAll','params','find','catch','body','destroy','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','limit','count','offset'];(function(_0xee4dfe,_0x24ded5){var _0x2a9ad5=function(_0x3c878a){while(--_0x3c878a){_0xee4dfe['push'](_0xee4dfe['shift']());}};_0x2a9ad5(++_0x24ded5);}(_0x37e6,0x8c));var _0x637e=function(_0x33d051,_0x3467d4){_0x33d051=_0x33d051-0x0;var _0x1c8ae2=_0x37e6[_0x33d051];return _0x1c8ae2;};'use strict';var emlformat=require(_0x637e('0x0'));var rimraf=require(_0x637e('0x1'));var zipdir=require(_0x637e('0x2'));var jsonpatch=require(_0x637e('0x3'));var rp=require(_0x637e('0x4'));var moment=require('moment');var BPromise=require(_0x637e('0x5'));var Mustache=require(_0x637e('0x6'));var util=require(_0x637e('0x7'));var path=require('path');var sox=require(_0x637e('0x8'));var csv=require(_0x637e('0x9'));var ejs=require(_0x637e('0xa'));var fs=require('fs');var fs_extra=require(_0x637e('0xb'));var _=require(_0x637e('0xc'));var squel=require('squel');var crypto=require(_0x637e('0xd'));var jsforce=require(_0x637e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x637e('0x9'));var querystring=require(_0x637e('0xf'));var Papa=require(_0x637e('0x10'));var Redis=require(_0x637e('0x11'));var authService=require(_0x637e('0x12'));var qs=require(_0x637e('0x13'));var as=require(_0x637e('0x14'));var hardwareService=require(_0x637e('0x15'));var logger=require(_0x637e('0x16'))(_0x637e('0x17'));var utils=require(_0x637e('0x18'));var config=require(_0x637e('0x19'));var licenseUtil=require(_0x637e('0x1a'));var db=require(_0x637e('0x1b'))['db'];function respondWithStatusCode(_0x4e4d10,_0x5b6acc){_0x5b6acc=_0x5b6acc||0xcc;return function(_0x3af4d3){if(_0x3af4d3){return _0x4e4d10[_0x637e('0x1c')](_0x5b6acc);}return _0x4e4d10[_0x637e('0x1d')](_0x5b6acc)[_0x637e('0x1e')]();};}function respondWithResult(_0x2face1,_0x4c7c94){_0x4c7c94=_0x4c7c94||0xc8;return function(_0x40f456){if(_0x40f456){return _0x2face1[_0x637e('0x1d')](_0x4c7c94)['json'](_0x40f456);}};}function respondWithFilteredResult(_0x380c23,_0xaa8ef){return function(_0x268715){if(_0x268715){var _0x55861c=typeof _0xaa8ef['offset']==='undefined'&&typeof _0xaa8ef[_0x637e('0x1f')]==='undefined';var _0x521b00=_0x268715['count'];var _0x3474a8=_0x55861c?0x0:_0xaa8ef['offset'];var _0x406181=_0x55861c?_0x268715[_0x637e('0x20')]:_0xaa8ef[_0x637e('0x21')]+_0xaa8ef['limit'];var _0x22c60d;if(_0x406181>=_0x521b00){_0x406181=_0x521b00;_0x22c60d=0xc8;}else{_0x22c60d=0xce;}_0x380c23['status'](_0x22c60d);return _0x380c23['set'](_0x637e('0x22'),_0x3474a8+'-'+_0x406181+'/'+_0x521b00)[_0x637e('0x23')](_0x268715);}return null;};}function patchUpdates(_0x28e71d){return function(_0x3c9eea){try{jsonpatch[_0x637e('0x24')](_0x3c9eea,_0x28e71d,!![]);}catch(_0x276a02){return BPromise['reject'](_0x276a02);}return _0x3c9eea['save']();};}function saveUpdates(_0x4cfb23,_0x29f443){return function(_0x42f08f){if(_0x42f08f){return _0x42f08f[_0x637e('0x25')](_0x4cfb23)[_0x637e('0x26')](function(_0x1da1e5){return _0x1da1e5;});}return null;};}function removeEntity(_0x1536e1,_0x4349a0){return function(_0xffdaf){if(_0xffdaf){return _0xffdaf['destroy']()['then'](function(){_0x1536e1['status'](0xcc)[_0x637e('0x1e')]();});}};}function handleEntityNotFound(_0x3d7fbc,_0x24b9be){return function(_0x926a35){if(!_0x926a35){_0x3d7fbc['sendStatus'](0x194);}return _0x926a35;};}function handleError(_0x12e997,_0x3e5579){_0x3e5579=_0x3e5579||0x1f4;return function(_0x33ddb1){logger['error'](_0x33ddb1[_0x637e('0x27')]);if(_0x33ddb1[_0x637e('0x28')]){delete _0x33ddb1[_0x637e('0x28')];}_0x12e997[_0x637e('0x1d')](_0x3e5579)[_0x637e('0x29')](_0x33ddb1);};}exports[_0x637e('0x2a')]=function(_0x50f71e,_0x419ea7){var _0x367c42={},_0x5eafdc={},_0x1e14ad={'count':0x0,'rows':[]};var _0x5449c9=_[_0x637e('0x2b')](db['CmCustomField'][_0x637e('0x2c')],function(_0x3cccec){return{'name':_0x3cccec['fieldName'],'type':_0x3cccec[_0x637e('0x2d')][_0x637e('0x2e')]};});_0x5eafdc[_0x637e('0x2f')]=_[_0x637e('0x30')](_[_0x637e('0x2b')](_0x5449c9,_0x637e('0x28')),[_0x637e('0x28')]);_0x5eafdc[_0x637e('0x31')]=_[_0x637e('0x32')](_0x50f71e[_0x637e('0x31')]);_0x5eafdc[_0x637e('0x33')]=_[_0x637e('0x34')](_0x5eafdc[_0x637e('0x2f')],_0x5eafdc[_0x637e('0x31')]);_0x367c42[_0x637e('0x35')]=_['intersection'](_0x5eafdc[_0x637e('0x2f')],qs['fields'](_0x50f71e[_0x637e('0x31')][_0x637e('0x36')]));_0x367c42['attributes']=_0x367c42[_0x637e('0x35')]['length']?_0x367c42[_0x637e('0x35')]:_0x5eafdc['model'];if(!_0x50f71e[_0x637e('0x31')]['hasOwnProperty'](_0x637e('0x37'))){_0x367c42[_0x637e('0x1f')]=qs[_0x637e('0x1f')](_0x50f71e[_0x637e('0x31')][_0x637e('0x1f')]);_0x367c42[_0x637e('0x21')]=qs[_0x637e('0x21')](_0x50f71e[_0x637e('0x31')][_0x637e('0x21')]);}_0x367c42[_0x637e('0x38')]=qs['sort'](_0x50f71e['query'][_0x637e('0x39')]);_0x367c42['where']=qs['filters'](_[_0x637e('0x3a')](_0x50f71e[_0x637e('0x31')],_0x5eafdc[_0x637e('0x33')]),_0x5449c9);if(_0x50f71e[_0x637e('0x31')]['filter']){_0x367c42[_0x637e('0x3b')]=_[_0x637e('0x3c')](_0x367c42['where'],{'$or':_[_0x637e('0x2b')](_0x5449c9,function(_0x586efc){if(_0x586efc['type']!==_0x637e('0x3d')){var _0x1c845c={};_0x1c845c[_0x586efc[_0x637e('0x28')]]={'$like':'%'+_0x50f71e[_0x637e('0x31')]['filter']+'%'};return _0x1c845c;}})});}_0x367c42=_['merge']({},_0x367c42,_0x50f71e[_0x637e('0x3e')]);var _0x1a1660={'where':_0x367c42['where']};return db[_0x637e('0x3f')]['count'](_0x1a1660)['then'](function(_0x2d97fa){_0x1e14ad[_0x637e('0x20')]=_0x2d97fa;if(_0x50f71e[_0x637e('0x31')][_0x637e('0x40')]){_0x367c42[_0x637e('0x41')]=[{'all':!![]}];}return db['CmCustomField'][_0x637e('0x42')](_0x367c42);})[_0x637e('0x26')](function(_0x50f064){_0x1e14ad['rows']=_0x50f064;return _0x1e14ad;})[_0x637e('0x26')](respondWithFilteredResult(_0x419ea7,_0x367c42))['catch'](handleError(_0x419ea7,null));};exports['show']=function(_0xd56d74,_0x325d6d){var _0x1aee86={'raw':!![],'where':{'id':_0xd56d74[_0x637e('0x43')]['id']}},_0x166817={};_0x166817[_0x637e('0x2f')]=_[_0x637e('0x32')](db[_0x637e('0x3f')][_0x637e('0x2c')]);_0x166817[_0x637e('0x31')]=_[_0x637e('0x32')](_0xd56d74[_0x637e('0x31')]);_0x166817[_0x637e('0x33')]=_[_0x637e('0x34')](_0x166817[_0x637e('0x2f')],_0x166817[_0x637e('0x31')]);_0x1aee86[_0x637e('0x35')]=_[_0x637e('0x34')](_0x166817[_0x637e('0x2f')],qs[_0x637e('0x36')](_0xd56d74[_0x637e('0x31')][_0x637e('0x36')]));_0x1aee86[_0x637e('0x35')]=_0x1aee86[_0x637e('0x35')]['length']?_0x1aee86[_0x637e('0x35')]:_0x166817['model'];if(_0xd56d74[_0x637e('0x31')][_0x637e('0x40')]){_0x1aee86[_0x637e('0x41')]=[{'all':!![]}];}_0x1aee86=_[_0x637e('0x3c')]({},_0x1aee86,_0xd56d74[_0x637e('0x3e')]);return db[_0x637e('0x3f')][_0x637e('0x44')](_0x1aee86)['then'](handleEntityNotFound(_0x325d6d,null))[_0x637e('0x26')](respondWithResult(_0x325d6d,null))[_0x637e('0x45')](handleError(_0x325d6d,null));};exports['update']=function(_0x36961f,_0x109c9e){if(_0x36961f[_0x637e('0x46')]['id']){delete _0x36961f['body']['id'];}return db[_0x637e('0x3f')][_0x637e('0x44')]({'where':{'id':_0x36961f[_0x637e('0x43')]['id']}})['then'](handleEntityNotFound(_0x109c9e,null))[_0x637e('0x26')](saveUpdates(_0x36961f['body'],null))['then'](respondWithResult(_0x109c9e,null))['catch'](handleError(_0x109c9e,null));};exports[_0x637e('0x47')]=function(_0x1b543a,_0x1be8a1){return db[_0x637e('0x3f')][_0x637e('0x44')]({'where':{'id':_0x1b543a[_0x637e('0x43')]['id']}})[_0x637e('0x26')](handleEntityNotFound(_0x1be8a1,null))[_0x637e('0x26')](removeEntity(_0x1be8a1,null))[_0x637e('0x45')](handleError(_0x1be8a1,null));};exports[_0x637e('0x48')]=function(_0x50ab12,_0x46c40d){var _0x389f33;return db['sequelize'][_0x637e('0x49')](function(_0xafcb34){return db[_0x637e('0x3f')][_0x637e('0x48')](_0x50ab12['body'],{'transaction':_0xafcb34})[_0x637e('0x26')](function(_0x2d8620){_0x389f33=_0x2d8620;var _0x37e73d={'type':db[_0x637e('0x4a')][_0x637e('0x4b')],'transaction':_0xafcb34};switch(_0x50ab12[_0x637e('0x46')]['type']){case _0x637e('0x4c'):_0x37e73d[_0x637e('0x2d')]=db['Sequelize'][_0x637e('0x4b')];break;case _0x637e('0x4d'):_0x37e73d[_0x637e('0x2d')]=db[_0x637e('0x4a')][_0x637e('0x4e')];break;case _0x637e('0x4f'):_0x37e73d[_0x637e('0x2d')]=db[_0x637e('0x4a')][_0x637e('0x50')];_0x37e73d[_0x637e('0x51')]=![];break;default:}return db[_0x637e('0x52')][_0x637e('0x53')][_0x637e('0x54')](_0x637e('0x55'),util['format'](_0x637e('0x56'),_0x389f33['id']),_0x37e73d);})['then'](function(){return _0x389f33;});})[_0x637e('0x26')](respondWithResult(_0x46c40d,0xc9))[_0x637e('0x45')](handleError(_0x46c40d,null));}; \ No newline at end of file +var _0xea3f=['stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','end'];(function(_0x44f280,_0x4a1dad){var _0x4ee19d=function(_0xc02f51){while(--_0xc02f51){_0x44f280['push'](_0x44f280['shift']());}};_0x4ee19d(++_0x4a1dad);}(_0xea3f,0x199));var _0xfea3=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0xea3f[_0x56d1ed];return _0x1b282b;};'use strict';var emlformat=require(_0xfea3('0x0'));var rimraf=require(_0xfea3('0x1'));var zipdir=require(_0xfea3('0x2'));var jsonpatch=require(_0xfea3('0x3'));var rp=require(_0xfea3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfea3('0x5'));var util=require(_0xfea3('0x6'));var path=require(_0xfea3('0x7'));var sox=require(_0xfea3('0x8'));var csv=require(_0xfea3('0x9'));var ejs=require(_0xfea3('0xa'));var fs=require('fs');var fs_extra=require(_0xfea3('0xb'));var _=require(_0xfea3('0xc'));var squel=require(_0xfea3('0xd'));var crypto=require(_0xfea3('0xe'));var jsforce=require(_0xfea3('0xf'));var deskjs=require(_0xfea3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfea3('0x11'));var Papa=require(_0xfea3('0x12'));var Redis=require(_0xfea3('0x13'));var authService=require(_0xfea3('0x14'));var qs=require(_0xfea3('0x15'));var as=require(_0xfea3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfea3('0x17'))('api');var utils=require(_0xfea3('0x18'));var config=require(_0xfea3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xfea3('0x1a'))['db'];function respondWithStatusCode(_0x2bfcb3,_0x56a6c5){_0x56a6c5=_0x56a6c5||0xcc;return function(_0x5edb51){if(_0x5edb51){return _0x2bfcb3[_0xfea3('0x1b')](_0x56a6c5);}return _0x2bfcb3['status'](_0x56a6c5)['end']();};}function respondWithResult(_0x4b7c87,_0xb38dfd){_0xb38dfd=_0xb38dfd||0xc8;return function(_0x16d5d9){if(_0x16d5d9){return _0x4b7c87[_0xfea3('0x1c')](_0xb38dfd)[_0xfea3('0x1d')](_0x16d5d9);}};}function respondWithFilteredResult(_0x3fcf0d,_0x3e7d41){return function(_0x571f87){if(_0x571f87){var _0xf3b5de=typeof _0x3e7d41[_0xfea3('0x1e')]==='undefined'&&typeof _0x3e7d41[_0xfea3('0x1f')]==='undefined';var _0x4b86a5=_0x571f87[_0xfea3('0x20')];var _0x438998=_0xf3b5de?0x0:_0x3e7d41[_0xfea3('0x1e')];var _0x5030b0=_0xf3b5de?_0x571f87['count']:_0x3e7d41[_0xfea3('0x1e')]+_0x3e7d41[_0xfea3('0x1f')];var _0x549b98;if(_0x5030b0>=_0x4b86a5){_0x5030b0=_0x4b86a5;_0x549b98=0xc8;}else{_0x549b98=0xce;}_0x3fcf0d[_0xfea3('0x1c')](_0x549b98);return _0x3fcf0d[_0xfea3('0x21')](_0xfea3('0x22'),_0x438998+'-'+_0x5030b0+'/'+_0x4b86a5)[_0xfea3('0x1d')](_0x571f87);}return null;};}function patchUpdates(_0x5e9b2f){return function(_0x4998fc){try{jsonpatch[_0xfea3('0x23')](_0x4998fc,_0x5e9b2f,!![]);}catch(_0x286d41){return BPromise['reject'](_0x286d41);}return _0x4998fc[_0xfea3('0x24')]();};}function saveUpdates(_0xc7f7d9,_0x5b2e66){return function(_0x3fc4ea){if(_0x3fc4ea){return _0x3fc4ea[_0xfea3('0x25')](_0xc7f7d9)[_0xfea3('0x26')](function(_0x8a3688){return _0x8a3688;});}return null;};}function removeEntity(_0x8e2b06,_0x110490){return function(_0x3358ef){if(_0x3358ef){return _0x3358ef[_0xfea3('0x27')]()[_0xfea3('0x26')](function(){_0x8e2b06[_0xfea3('0x1c')](0xcc)[_0xfea3('0x28')]();});}};}function handleEntityNotFound(_0x3a57cc,_0x5be5aa){return function(_0x51d336){if(!_0x51d336){_0x3a57cc[_0xfea3('0x1b')](0x194);}return _0x51d336;};}function handleError(_0x3c5db1,_0x2a171d){_0x2a171d=_0x2a171d||0x1f4;return function(_0x4b5c49){logger['error'](_0x4b5c49[_0xfea3('0x29')]);if(_0x4b5c49[_0xfea3('0x2a')]){delete _0x4b5c49[_0xfea3('0x2a')];}_0x3c5db1['status'](_0x2a171d)[_0xfea3('0x2b')](_0x4b5c49);};}exports[_0xfea3('0x2c')]=function(_0x32aada,_0x425b73){var _0x1a79eb={},_0x470197={},_0x521719={'count':0x0,'rows':[]};var _0x2afd63=_[_0xfea3('0x2d')](db[_0xfea3('0x2e')][_0xfea3('0x2f')],function(_0xaea857){return{'name':_0xaea857['fieldName'],'type':_0xaea857[_0xfea3('0x30')][_0xfea3('0x31')]};});_0x470197[_0xfea3('0x32')]=_[_0xfea3('0x33')](_[_0xfea3('0x2d')](_0x2afd63,_0xfea3('0x2a')),[_0xfea3('0x2a')]);_0x470197['query']=_[_0xfea3('0x34')](_0x32aada[_0xfea3('0x35')]);_0x470197[_0xfea3('0x36')]=_['intersection'](_0x470197[_0xfea3('0x32')],_0x470197[_0xfea3('0x35')]);_0x1a79eb[_0xfea3('0x37')]=_[_0xfea3('0x38')](_0x470197[_0xfea3('0x32')],qs[_0xfea3('0x39')](_0x32aada[_0xfea3('0x35')]['fields']));_0x1a79eb[_0xfea3('0x37')]=_0x1a79eb[_0xfea3('0x37')]['length']?_0x1a79eb[_0xfea3('0x37')]:_0x470197[_0xfea3('0x32')];if(!_0x32aada['query'][_0xfea3('0x3a')](_0xfea3('0x3b'))){_0x1a79eb[_0xfea3('0x1f')]=qs['limit'](_0x32aada[_0xfea3('0x35')][_0xfea3('0x1f')]);_0x1a79eb['offset']=qs[_0xfea3('0x1e')](_0x32aada[_0xfea3('0x35')][_0xfea3('0x1e')]);}_0x1a79eb[_0xfea3('0x3c')]=qs[_0xfea3('0x3d')](_0x32aada[_0xfea3('0x35')][_0xfea3('0x3d')]);_0x1a79eb['where']=qs[_0xfea3('0x36')](_[_0xfea3('0x3e')](_0x32aada['query'],_0x470197[_0xfea3('0x36')]),_0x2afd63);if(_0x32aada[_0xfea3('0x35')][_0xfea3('0x3f')]){_0x1a79eb[_0xfea3('0x40')]=_['merge'](_0x1a79eb[_0xfea3('0x40')],{'$or':_[_0xfea3('0x2d')](_0x2afd63,function(_0x558e97){if(_0x558e97[_0xfea3('0x30')]!==_0xfea3('0x41')){var _0x403f4b={};_0x403f4b[_0x558e97['name']]={'$like':'%'+_0x32aada['query'][_0xfea3('0x3f')]+'%'};return _0x403f4b;}})});}_0x1a79eb=_[_0xfea3('0x42')]({},_0x1a79eb,_0x32aada[_0xfea3('0x43')]);var _0x35f1a8={'where':_0x1a79eb['where']};return db[_0xfea3('0x2e')][_0xfea3('0x20')](_0x35f1a8)[_0xfea3('0x26')](function(_0x38583f){_0x521719[_0xfea3('0x20')]=_0x38583f;if(_0x32aada['query'][_0xfea3('0x44')]){_0x1a79eb[_0xfea3('0x45')]=[{'all':!![]}];}return db[_0xfea3('0x2e')][_0xfea3('0x46')](_0x1a79eb);})[_0xfea3('0x26')](function(_0x36b650){_0x521719[_0xfea3('0x47')]=_0x36b650;return _0x521719;})['then'](respondWithFilteredResult(_0x425b73,_0x1a79eb))[_0xfea3('0x48')](handleError(_0x425b73,null));};exports[_0xfea3('0x49')]=function(_0x683c22,_0x574b8a){var _0x512728={'raw':!![],'where':{'id':_0x683c22[_0xfea3('0x4a')]['id']}},_0x486fdb={};_0x486fdb['model']=_['keys'](db[_0xfea3('0x2e')]['rawAttributes']);_0x486fdb[_0xfea3('0x35')]=_[_0xfea3('0x34')](_0x683c22[_0xfea3('0x35')]);_0x486fdb[_0xfea3('0x36')]=_[_0xfea3('0x38')](_0x486fdb['model'],_0x486fdb[_0xfea3('0x35')]);_0x512728[_0xfea3('0x37')]=_[_0xfea3('0x38')](_0x486fdb[_0xfea3('0x32')],qs[_0xfea3('0x39')](_0x683c22[_0xfea3('0x35')][_0xfea3('0x39')]));_0x512728['attributes']=_0x512728[_0xfea3('0x37')][_0xfea3('0x4b')]?_0x512728['attributes']:_0x486fdb[_0xfea3('0x32')];if(_0x683c22[_0xfea3('0x35')]['includeAll']){_0x512728[_0xfea3('0x45')]=[{'all':!![]}];}_0x512728=_[_0xfea3('0x42')]({},_0x512728,_0x683c22['options']);return db[_0xfea3('0x2e')][_0xfea3('0x4c')](_0x512728)[_0xfea3('0x26')](handleEntityNotFound(_0x574b8a,null))[_0xfea3('0x26')](respondWithResult(_0x574b8a,null))[_0xfea3('0x48')](handleError(_0x574b8a,null));};exports[_0xfea3('0x25')]=function(_0x4a19a0,_0x46dc20){if(_0x4a19a0[_0xfea3('0x4d')]['id']){delete _0x4a19a0[_0xfea3('0x4d')]['id'];}return db[_0xfea3('0x2e')]['find']({'where':{'id':_0x4a19a0[_0xfea3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46dc20,null))[_0xfea3('0x26')](saveUpdates(_0x4a19a0[_0xfea3('0x4d')],null))['then'](respondWithResult(_0x46dc20,null))[_0xfea3('0x48')](handleError(_0x46dc20,null));};exports[_0xfea3('0x27')]=function(_0x1aad80,_0x1af352){return db[_0xfea3('0x2e')][_0xfea3('0x4c')]({'where':{'id':_0x1aad80['params']['id']}})['then'](handleEntityNotFound(_0x1af352,null))[_0xfea3('0x26')](removeEntity(_0x1af352,null))[_0xfea3('0x48')](handleError(_0x1af352,null));};exports['create']=function(_0x514e68,_0x3c6e50){var _0x379dc5;return db[_0xfea3('0x4e')][_0xfea3('0x4f')](function(_0x2c065b){return db[_0xfea3('0x2e')]['create'](_0x514e68[_0xfea3('0x4d')],{'transaction':_0x2c065b})[_0xfea3('0x26')](function(_0x1ab83f){_0x379dc5=_0x1ab83f;var _0xd33e07={'type':db[_0xfea3('0x50')]['TEXT'],'transaction':_0x2c065b};switch(_0x514e68['body']['type']){case'text':_0xd33e07[_0xfea3('0x30')]=db[_0xfea3('0x50')][_0xfea3('0x51')];break;case _0xfea3('0x52'):_0xd33e07[_0xfea3('0x30')]=db[_0xfea3('0x50')][_0xfea3('0x53')];break;case'switch':_0xd33e07[_0xfea3('0x30')]=db[_0xfea3('0x50')][_0xfea3('0x54')];_0xd33e07['defaultValue']=![];break;default:}return db[_0xfea3('0x4e')][_0xfea3('0x55')][_0xfea3('0x56')](_0xfea3('0x57'),util[_0xfea3('0x58')](_0xfea3('0x59'),_0x379dc5['id']),_0xd33e07);})[_0xfea3('0x26')](function(){return _0x379dc5;});})[_0xfea3('0x26')](respondWithResult(_0x3c6e50,0xc9))[_0xfea3('0x48')](handleError(_0x3c6e50,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index cc92919..71532aa 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 _0x4097=['./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','api','moment','path'];(function(_0x3b3773,_0x42d165){var _0x1a593e=function(_0x209141){while(--_0x209141){_0x3b3773['push'](_0x3b3773['shift']());}};_0x1a593e(++_0x42d165);}(_0x4097,0x16c));var _0x7409=function(_0x20c27,_0x2c839e){_0x20c27=_0x20c27-0x0;var _0x5b83fb=_0x4097[_0x20c27];return _0x5b83fb;};'use strict';var _=require(_0x7409('0x0'));var util=require(_0x7409('0x1'));var logger=require('../../config/logger')(_0x7409('0x2'));var moment=require(_0x7409('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7409('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7409('0x5'));module[_0x7409('0x6')]=function(_0xa63b89,_0xacfd7d){return _0xa63b89[_0x7409('0x7')]('CmCustomField',attributes,{'tableName':_0x7409('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x375b=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x1021cf,_0x5245b4){var _0x4fab21=function(_0x5b2ba6){while(--_0x5b2ba6){_0x1021cf['push'](_0x1021cf['shift']());}};_0x4fab21(++_0x5245b4);}(_0x375b,0x17a));var _0xb375=function(_0x383efa,_0x501eca){_0x383efa=_0x383efa-0x0;var _0x1e742b=_0x375b[_0x383efa];return _0x1e742b;};'use strict';var _=require(_0xb375('0x0'));var util=require(_0xb375('0x1'));var logger=require(_0xb375('0x2'))(_0xb375('0x3'));var moment=require(_0xb375('0x4'));var BPromise=require(_0xb375('0x5'));var rp=require(_0xb375('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb375('0x7'));var attributes=require(_0xb375('0x8'));module[_0xb375('0x9')]=function(_0x2e1ddf,_0x3acd8f){return _0x2e1ddf[_0xb375('0xa')](_0xb375('0xb'),attributes,{'tableName':_0xb375('0xc'),'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 7a3053b..23cdf70 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 _0xeeb4=['../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3e2073,_0x5c2cd3){var _0x402430=function(_0x22eaab){while(--_0x22eaab){_0x3e2073['push'](_0x3e2073['shift']());}};_0x402430(++_0x5c2cd3);}(_0xeeb4,0x1f1));var _0x4eeb=function(_0xe58522,_0x58638c){_0xe58522=_0xe58522-0x0;var _0x3c229b=_0xeeb4[_0xe58522];return _0x3c229b;};'use strict';var _=require(_0x4eeb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4eeb('0x1'));var rs=require(_0x4eeb('0x2'));var fs=require('fs');var Redis=require(_0x4eeb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4eeb('0x4'));var logger=require(_0x4eeb('0x5'))(_0x4eeb('0x6'));var config=require(_0x4eeb('0x7'));var jayson=require(_0x4eeb('0x8'));var client=jayson[_0x4eeb('0x9')][_0x4eeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5be0fe,_0x326f94,_0x365b58){return new BPromise(function(_0x37ee5,_0x41a7a4){return client[_0x4eeb('0xb')](_0x5be0fe,_0x365b58)[_0x4eeb('0xc')](function(_0x18ea05){logger[_0x4eeb('0xd')](_0x4eeb('0xe'),_0x326f94,_0x4eeb('0xf'));logger[_0x4eeb('0x10')](_0x4eeb('0x11'),_0x326f94,_0x4eeb('0xf'),JSON[_0x4eeb('0x12')](_0x18ea05));if(_0x18ea05['error']){if(_0x18ea05[_0x4eeb('0x13')][_0x4eeb('0x14')]===0x1f4){logger[_0x4eeb('0x13')](_0x4eeb('0xe'),_0x326f94,_0x18ea05['error'][_0x4eeb('0x15')]);return _0x41a7a4(_0x18ea05[_0x4eeb('0x13')][_0x4eeb('0x15')]);}logger[_0x4eeb('0x13')]('CmCustomField,\x20%s,\x20%s',_0x326f94,_0x18ea05['error'][_0x4eeb('0x15')]);return _0x37ee5(_0x18ea05[_0x4eeb('0x13')][_0x4eeb('0x15')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x326f94,_0x4eeb('0xf'));_0x37ee5(_0x18ea05[_0x4eeb('0x16')][_0x4eeb('0x15')]);}})[_0x4eeb('0x17')](function(_0x2159fb){logger[_0x4eeb('0x13')](_0x4eeb('0xe'),_0x326f94,_0x2159fb);_0x41a7a4(_0x2159fb);});});} \ No newline at end of file +var _0xde08=['client','http','request','info','request\x20sent','debug','stringify','error','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3546eb,_0x440f3f){var _0xe660bf=function(_0x282566){while(--_0x282566){_0x3546eb['push'](_0x3546eb['shift']());}};_0xe660bf(++_0x440f3f);}(_0xde08,0x132));var _0x8de0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde08[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8de0('0x0'));var util=require(_0x8de0('0x1'));var moment=require(_0x8de0('0x2'));var BPromise=require('bluebird');var rs=require(_0x8de0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8de0('0x4'))['db'];var utils=require(_0x8de0('0x5'));var logger=require(_0x8de0('0x6'))(_0x8de0('0x7'));var config=require(_0x8de0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8de0('0x9')][_0x8de0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fcd6f,_0x5459eb,_0x3b3c73){return new BPromise(function(_0x2ad4c0,_0x468fb8){return client[_0x8de0('0xb')](_0x2fcd6f,_0x3b3c73)['then'](function(_0x33b5d4){logger[_0x8de0('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5459eb,_0x8de0('0xd'));logger[_0x8de0('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5459eb,_0x8de0('0xd'),JSON[_0x8de0('0xf')](_0x33b5d4));if(_0x33b5d4[_0x8de0('0x10')]){if(_0x33b5d4[_0x8de0('0x10')]['code']===0x1f4){logger[_0x8de0('0x10')](_0x8de0('0x11'),_0x5459eb,_0x33b5d4[_0x8de0('0x10')]['message']);return _0x468fb8(_0x33b5d4[_0x8de0('0x10')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x5459eb,_0x33b5d4[_0x8de0('0x10')][_0x8de0('0x12')]);return _0x2ad4c0(_0x33b5d4[_0x8de0('0x10')]['message']);}else{logger['info'](_0x8de0('0x11'),_0x5459eb,_0x8de0('0xd'));_0x2ad4c0(_0x33b5d4[_0x8de0('0x13')]['message']);}})[_0x8de0('0x14')](function(_0x186e35){logger['error'](_0x8de0('0x11'),_0x5459eb,_0x186e35);_0x468fb8(_0x186e35);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 9e09b09..65a4345 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 _0x35e2=['../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f665d,_0x5704e7){var _0x2f3044=function(_0x4c6e79){while(--_0x4c6e79){_0x3f665d['push'](_0x3f665d['shift']());}};_0x2f3044(++_0x5704e7);}(_0x35e2,0x1ed));var _0x235e=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x35e2[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0x235e('0x0'));var util=require('util');var path=require(_0x235e('0x1'));var timeout=require(_0x235e('0x2'));var express=require(_0x235e('0x3'));var router=express['Router']();var fs_extra=require(_0x235e('0x4'));var auth=require(_0x235e('0x5'));var interaction=require(_0x235e('0x6'));var config=require(_0x235e('0x7'));var controller=require(_0x235e('0x8'));router[_0x235e('0x9')]('/',auth[_0x235e('0xa')](),controller[_0x235e('0xb')]);router[_0x235e('0x9')](_0x235e('0xc'),auth[_0x235e('0xa')](),controller[_0x235e('0xd')]);router[_0x235e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x235e('0xf')](_0x235e('0xc'),auth['isAuthenticated'](),controller[_0x235e('0x10')]);router[_0x235e('0x11')](_0x235e('0xc'),auth[_0x235e('0xa')](),controller[_0x235e('0x12')]);module[_0x235e('0x13')]=router; \ No newline at end of file +var _0xd9a8=['update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','post','create'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x19584e,_0x528482){_0x19584e=_0x19584e-0x0;var _0x5725b0=_0xd9a8[_0x19584e];return _0x5725b0;};'use strict';var multer=require(_0x8d9a('0x0'));var util=require(_0x8d9a('0x1'));var path=require(_0x8d9a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d9a('0x3'));var router=express[_0x8d9a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8d9a('0x5'));var config=require(_0x8d9a('0x6'));var controller=require(_0x8d9a('0x7'));router[_0x8d9a('0x8')]('/',auth[_0x8d9a('0x9')](),controller['index']);router[_0x8d9a('0x8')](_0x8d9a('0xa'),auth[_0x8d9a('0x9')](),controller['show']);router[_0x8d9a('0xb')]('/',auth[_0x8d9a('0x9')](),controller[_0x8d9a('0xc')]);router['put'](_0x8d9a('0xa'),auth[_0x8d9a('0x9')](),controller[_0x8d9a('0xd')]);router['delete'](_0x8d9a('0xa'),auth['isAuthenticated'](),controller[_0x8d9a('0xe')]);module[_0x8d9a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0a798ff..889dcbd 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 _0xa0e7=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue','moment','sequelize','exports','BOOLEAN'];(function(_0x23c651,_0x143982){var _0xbe7bdb=function(_0x1979e2){while(--_0x1979e2){_0x23c651['push'](_0x23c651['shift']());}};_0xbe7bdb(++_0x143982);}(_0xa0e7,0x12e));var _0x7a0e=function(_0x2d4455,_0x58fab8){_0x2d4455=_0x2d4455-0x0;var _0x13ce3b=_0xa0e7[_0x2d4455];return _0x13ce3b;};'use strict';var moment=require(_0x7a0e('0x0'));var Sequelize=require(_0x7a0e('0x1'));module[_0x7a0e('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x7a0e('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7a0e('0x4')],'defaultValue':moment()['format'](_0x7a0e('0x5'))},'countbusyretry':{'type':Sequelize[_0x7a0e('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7a0e('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7a0e('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7a0e('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7a0e('0x4')]},'priority':{'type':Sequelize[_0x7a0e('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7a0e('0x6')],'unique':_0x7a0e('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7a0e('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x7a0e('0x6')],'unique':_0x7a0e('0x8')},'CampaignId':{'type':Sequelize[_0x7a0e('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x7a0e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7a0e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7a0e('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7a0e('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ae0=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x7ae0,0x10c));var _0x07ae=function(_0x502764,_0x1b5205){_0x502764=_0x502764-0x0;var _0xdf680e=_0x7ae0[_0x502764];return _0xdf680e;};'use strict';var moment=require(_0x07ae('0x0'));var Sequelize=require(_0x07ae('0x1'));module[_0x07ae('0x2')]={'phone':{'type':Sequelize[_0x07ae('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x07ae('0x4')],'defaultValue':moment()[_0x07ae('0x5')](_0x07ae('0x6'))},'countbusyretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x07ae('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x07ae('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x07ae('0x4')]},'priority':{'type':Sequelize[_0x07ae('0x7')](0x2)[_0x07ae('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x07ae('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x07ae('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x07ae('0xa')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x07ae('0x7')],'unique':_0x07ae('0xa')},'CampaignId':{'type':Sequelize[_0x07ae('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x07ae('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x07ae('0x7')],'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 7b5d7ef..e0a1ca0 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 _0x568a=['fieldName','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getPreview','getVoiceQueues','dialOrderByScheduledAt','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','UPDATE','CmCompany','Company','CmList','List','dialActive','getOpenContacts','outbound','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopper','rawAttributes'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x568a,0x67));var _0xa568=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x568a[_0xf71120];return _0xbe2fd3;};'use strict';var emlformat=require(_0xa568('0x0'));var rimraf=require(_0xa568('0x1'));var zipdir=require(_0xa568('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa568('0x3'));var moment=require(_0xa568('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa568('0x5'));var path=require(_0xa568('0x6'));var sox=require(_0xa568('0x7'));var csv=require(_0xa568('0x8'));var ejs=require(_0xa568('0x9'));var fs=require('fs');var fs_extra=require(_0xa568('0xa'));var _=require('lodash');var squel=require(_0xa568('0xb'));var crypto=require(_0xa568('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa568('0xd'));var toCsv=require(_0xa568('0x8'));var querystring=require(_0xa568('0xe'));var Papa=require(_0xa568('0xf'));var Redis=require(_0xa568('0x10'));var authService=require(_0xa568('0x11'));var qs=require(_0xa568('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa568('0x13'));var logger=require(_0xa568('0x14'))(_0xa568('0x15'));var utils=require(_0xa568('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa568('0x17'));var db=require(_0xa568('0x18'))['db'];function respondWithStatusCode(_0x2be1e9,_0x2561ce){_0x2561ce=_0x2561ce||0xcc;return function(_0x35e99b){if(_0x35e99b){return _0x2be1e9[_0xa568('0x19')](_0x2561ce);}return _0x2be1e9[_0xa568('0x1a')](_0x2561ce)['end']();};}function respondWithResult(_0xf514dc,_0x21fbd1){_0x21fbd1=_0x21fbd1||0xc8;return function(_0x13013f){if(_0x13013f){return _0xf514dc[_0xa568('0x1a')](_0x21fbd1)[_0xa568('0x1b')](_0x13013f);}};}function respondWithFilteredResult(_0x4e68d6,_0x2eaec3){return function(_0x484e4f){if(_0x484e4f){var _0x12135e=typeof _0x2eaec3[_0xa568('0x1c')]==='undefined'&&typeof _0x2eaec3[_0xa568('0x1d')]==='undefined';var _0x42ba2e=_0x484e4f[_0xa568('0x1e')];var _0x3ae56b=_0x12135e?0x0:_0x2eaec3[_0xa568('0x1c')];var _0x43c011=_0x12135e?_0x484e4f['count']:_0x2eaec3[_0xa568('0x1c')]+_0x2eaec3[_0xa568('0x1d')];var _0x546944;if(_0x43c011>=_0x42ba2e){_0x43c011=_0x42ba2e;_0x546944=0xc8;}else{_0x546944=0xce;}_0x4e68d6['status'](_0x546944);return _0x4e68d6['set']('Content-Range',_0x3ae56b+'-'+_0x43c011+'/'+_0x42ba2e)['json'](_0x484e4f);}return null;};}function patchUpdates(_0x582809){return function(_0x195872){try{jsonpatch[_0xa568('0x1f')](_0x195872,_0x582809,!![]);}catch(_0x4d8a13){return BPromise[_0xa568('0x20')](_0x4d8a13);}return _0x195872[_0xa568('0x21')]();};}function saveUpdates(_0x392f44,_0x5bd032){return function(_0x2fbc13){if(_0x2fbc13){return _0x2fbc13[_0xa568('0x22')](_0x392f44)[_0xa568('0x23')](function(_0x508cd9){return _0x508cd9;});}return null;};}function removeEntity(_0x5ad658,_0x3ba13a){return function(_0x2c2e8b){if(_0x2c2e8b){return _0x2c2e8b[_0xa568('0x24')]()[_0xa568('0x23')](function(){_0x5ad658[_0xa568('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x424f4d,_0x11df62){return function(_0x22ca53){if(!_0x22ca53){_0x424f4d[_0xa568('0x19')](0x194);}return _0x22ca53;};}function handleError(_0x3ac128,_0x332697){_0x332697=_0x332697||0x1f4;return function(_0x343d1f){logger[_0xa568('0x25')](_0x343d1f[_0xa568('0x26')]);if(_0x343d1f[_0xa568('0x27')]){delete _0x343d1f['name'];}_0x3ac128[_0xa568('0x1a')](_0x332697)['send'](_0x343d1f);};}exports[_0xa568('0x28')]=function(_0x45700c,_0x202afb){var _0xe4809f={},_0x366a26={},_0x290e71={'count':0x0,'rows':[]};var _0x10ce62=_[_0xa568('0x29')](db[_0xa568('0x2a')][_0xa568('0x2b')],function(_0x3d0293){return{'name':_0x3d0293[_0xa568('0x2c')],'type':_0x3d0293['type']['key']};});_0x366a26[_0xa568('0x2d')]=_['map'](_0x10ce62,_0xa568('0x27'));_0x366a26[_0xa568('0x2e')]=_[_0xa568('0x2f')](_0x45700c[_0xa568('0x2e')]);_0x366a26[_0xa568('0x30')]=_[_0xa568('0x31')](_0x366a26[_0xa568('0x2d')],_0x366a26[_0xa568('0x2e')]);_0x366a26['filters']=_[_0xa568('0x32')](_0x366a26[_0xa568('0x30')],[_0xa568('0x33'),_0xa568('0x34'),_0xa568('0x35'),_0xa568('0x36'),_0xa568('0x37'),_0xa568('0x38'),_0xa568('0x39'),_0xa568('0x3a'),_0xa568('0x3b'),_0xa568('0x3c'),_0xa568('0x3d'),_0xa568('0x3e'),_0xa568('0x3f'),_0xa568('0x40'),_0xa568('0x41'),_0xa568('0x42'),_0xa568('0x43'),_0xa568('0x40'),_0xa568('0x44'),_0xa568('0x45'),_0xa568('0x46'),'$any']);_0xe4809f['attributes']=_[_0xa568('0x31')](_0x366a26[_0xa568('0x2d')],qs['fields'](_0x45700c['query'][_0xa568('0x47')]));_0xe4809f[_0xa568('0x48')]=_0xe4809f[_0xa568('0x48')][_0xa568('0x49')]?_0xe4809f[_0xa568('0x48')]:_0x366a26[_0xa568('0x2d')];if(!_0x45700c[_0xa568('0x2e')]['hasOwnProperty'](_0xa568('0x4a'))){_0xe4809f[_0xa568('0x1d')]=qs[_0xa568('0x1d')](_0x45700c['query'][_0xa568('0x1d')]);_0xe4809f[_0xa568('0x1c')]=qs[_0xa568('0x1c')](_0x45700c[_0xa568('0x2e')][_0xa568('0x1c')]);}_0xe4809f[_0xa568('0x4b')]=qs['sort'](_0x45700c[_0xa568('0x2e')][_0xa568('0x4c')]);_0xe4809f[_0xa568('0x4d')]=qs[_0xa568('0x30')](_[_0xa568('0x4e')](_0x45700c[_0xa568('0x2e')],_0x366a26[_0xa568('0x30')]),_0x10ce62);if(_0x45700c[_0xa568('0x2e')][_0xa568('0x4f')]){_0xe4809f[_0xa568('0x4d')]=_[_0xa568('0x50')](_0xe4809f['where'],{'$or':_[_0xa568('0x29')](_0x10ce62,function(_0x126f96){if(_0x126f96['type']!=='VIRTUAL'){var _0x3a2f8e={};_0x3a2f8e[_0x126f96[_0xa568('0x27')]]={'$like':'%'+_0x45700c[_0xa568('0x2e')][_0xa568('0x4f')]+'%'};return _0x3a2f8e;}})});}_0xe4809f=_[_0xa568('0x50')]({},_0xe4809f,_0x45700c[_0xa568('0x51')]);var _0x2c5c23={'where':_0xe4809f[_0xa568('0x4d')]};return db[_0xa568('0x2a')]['count'](_0x2c5c23)[_0xa568('0x23')](function(_0x4451cb){_0x290e71[_0xa568('0x1e')]=_0x4451cb;if(_0x45700c[_0xa568('0x2e')][_0xa568('0x52')]){_0xe4809f[_0xa568('0x53')]=[{'all':!![]}];}return db[_0xa568('0x2a')][_0xa568('0x54')](_0xe4809f);})['then'](function(_0x2d90a6){_0x290e71['rows']=_0x2d90a6;return _0x290e71;})[_0xa568('0x23')](respondWithFilteredResult(_0x202afb,_0xe4809f))[_0xa568('0x55')](handleError(_0x202afb,null));};exports['show']=function(_0x38f3c0,_0x5a9227){var _0x5a16e0={'raw':!![],'where':{'id':_0x38f3c0[_0xa568('0x56')]['id']}},_0x39f494={};_0x39f494['model']=_[_0xa568('0x2f')](db[_0xa568('0x2a')][_0xa568('0x2b')]);_0x39f494[_0xa568('0x2e')]=_[_0xa568('0x2f')](_0x38f3c0[_0xa568('0x2e')]);_0x39f494[_0xa568('0x30')]=_[_0xa568('0x31')](_0x39f494[_0xa568('0x2d')],_0x39f494[_0xa568('0x2e')]);_0x5a16e0[_0xa568('0x48')]=_[_0xa568('0x31')](_0x39f494[_0xa568('0x2d')],qs[_0xa568('0x47')](_0x38f3c0[_0xa568('0x2e')][_0xa568('0x47')]));_0x5a16e0[_0xa568('0x48')]=_0x5a16e0[_0xa568('0x48')][_0xa568('0x49')]?_0x5a16e0[_0xa568('0x48')]:_0x39f494[_0xa568('0x2d')];if(_0x38f3c0['query']['includeAll']){_0x5a16e0[_0xa568('0x53')]=[{'all':!![]}];}_0x5a16e0=_['merge']({},_0x5a16e0,_0x38f3c0[_0xa568('0x51')]);return db[_0xa568('0x2a')][_0xa568('0x57')](_0x5a16e0)['then'](handleEntityNotFound(_0x5a9227,null))[_0xa568('0x23')](respondWithResult(_0x5a9227,null))['catch'](handleError(_0x5a9227,null));};exports[_0xa568('0x58')]=function(_0x527c79,_0x1db65e){return db['CmHopper'][_0xa568('0x58')](_0x527c79[_0xa568('0x59')],{})[_0xa568('0x23')](respondWithResult(_0x1db65e,0xc9))[_0xa568('0x55')](handleError(_0x1db65e,null));};exports[_0xa568('0x22')]=function(_0x5a30e4,_0x552d59){if(_0x5a30e4['body']['id']){delete _0x5a30e4[_0xa568('0x59')]['id'];}return db['CmHopper'][_0xa568('0x57')]({'where':{'id':_0x5a30e4[_0xa568('0x56')]['id']}})[_0xa568('0x23')](handleEntityNotFound(_0x552d59,null))['then'](saveUpdates(_0x5a30e4[_0xa568('0x59')],null))[_0xa568('0x23')](respondWithResult(_0x552d59,null))[_0xa568('0x55')](handleError(_0x552d59,null));};exports[_0xa568('0x5a')]=function(_0x4b0c6a,_0x5df950){return db[_0xa568('0x2a')][_0xa568('0x5a')]()['then'](respondWithResult(_0x5df950,null))[_0xa568('0x55')](handleError(_0x5df950,null));};exports['destroy']=function(_0x46d4f9,_0x332617){var _0xee9bb3;return db[_0xa568('0x2a')][_0xa568('0x57')]({'where':{'id':_0x46d4f9[_0xa568('0x56')]['id']}})['then'](handleEntityNotFound(_0x332617,null))['then'](function(_0x1f3e89){if(_0x1f3e89){return _0x1f3e89[_0xa568('0x24')]()[_0xa568('0x23')](function(_0x1bcff1){return _0x1bcff1;});}})[_0xa568('0x23')](function(_0x2238f6){_0xee9bb3=_0x2238f6;if(_0x2238f6){if(_0x2238f6[_0xa568('0x5b')]||_0x2238f6['CampaignId']){return db[_0x2238f6[_0xa568('0x5b')]?_0xa568('0x5c'):_0xa568('0x5d')][_0xa568('0x57')]({'where':{'id':_0x2238f6[_0xa568('0x5b')]?_0x2238f6['VoiceQueueId']:_0x2238f6[_0xa568('0x5e')]},'attributes':['id','name'],'raw':!![]});}}})[_0xa568('0x23')](function(_0xa61c64){var _0x4797c8={};if(_0xa61c64){_[_0xa568('0x50')](_0x4797c8,_[_0xa568('0x5f')](_0xee9bb3['dataValues'],[_0xa568('0x60'),_0xa568('0x61'),'id']));_0x4797c8[_0xa568('0x62')]=0x15;_0x4797c8['statedesc']=_0xa568('0x63');_0x4797c8[_0xa568('0x64')]=_0xa61c64[_0xa568('0x27')];_0x4797c8[_0xa568('0x65')]=_0x46d4f9[_0xa568('0x66')][_0xa568('0x27')];_0x4797c8[_0xa568('0x67')]=_0x46d4f9[_0xa568('0x66')]['id'];_0x4797c8[_0xa568('0x63')]=!![];_0x4797c8['deletedat']=moment()[_0xa568('0x68')](_0xa568('0x69'));_0x4797c8[_0xa568('0x6a')]=_0xee9bb3[_0xa568('0x6b')];_0x4797c8[_0xa568('0x6c')]=_0xee9bb3[_0xa568('0x5b')]?'queue':_0xa568('0x6d');return db[_0xa568('0x6e')][_0xa568('0x57')]({'where':{'id':_0x4797c8[_0xa568('0x6f')]},'attributes':[_0xa568('0x70'),_0xa568('0x71')]})['then'](function(_0x291234){if(!_[_0xa568('0x72')](_0x332617)&&!_[_0xa568('0x72')](_0x291234[_0xa568('0x70')])){_0x4797c8['calleridname']=_0x291234[_0xa568('0x70')];if(!_['isNil'](_0x291234[_0xa568('0x71')])){_0x4797c8[_0xa568('0x73')]+='\x20'+_0x291234[_0xa568('0x71')];}}})[_0xa568('0x74')](function(){return db[_0xa568('0x75')][_0xa568('0x58')](_0x4797c8);});}})[_0xa568('0x23')](function(){return _0x332617['status'](0xcc)[_0xa568('0x76')]();})[_0xa568('0x55')](handleError(_0x332617,null));};exports[_0xa568('0x77')]=function(_0x1104c9,_0x242407,_0x13718c){var _0x3d0dab=[];return db[_0xa568('0x6e')]['describe']()[_0xa568('0x23')](function(_0x1f0242){_0x3d0dab=_['keys'](_0x1f0242);return _0x1104c9[_0xa568('0x66')][_0xa568('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa568('0x79')],'raw':!![]});})[_0xa568('0x23')](function(_0x4e0f9b){if(_0x4e0f9b&&_0x4e0f9b[_0xa568('0x49')]){return db['sequelize'][_0xa568('0x7a')](function(_0x43aca9){var _0x2751eb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa568('0x69'))},'VoiceQueueId':{'$in':_[_0xa568('0x29')](_0x4e0f9b,'id')},'$or':[{'UserId':null},{'UserId':_0x1104c9[_0xa568('0x66')]['id']}]};var _0x203b7c=[];if(_0x1104c9[_0xa568('0x59')][_0xa568('0x7b')]&&_0x1104c9[_0xa568('0x59')]['direction']===_0xa568('0x7c')){if(!_[_0xa568('0x7d')](_0x1104c9[_0xa568('0x59')][_0xa568('0x7e')])){_0x2751eb['id']={'$in':_0x1104c9['body'][_0xa568('0x7e')]};}_0x203b7c=[[_0xa568('0x7f'),_0xa568('0x80')],[_0xa568('0x81'),_0x4e0f9b[0x0][_0xa568('0x79')]==='ASC'?_0xa568('0x82'):_0xa568('0x80')],db['sequelize'][_0xa568('0x83')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xa568('0x82')]];}else{if(!_[_0xa568('0x7d')](_0x1104c9['body'][_0xa568('0x7e')])){_0x2751eb['id']={'$notIn':_0x1104c9[_0xa568('0x59')][_0xa568('0x7e')]};}_0x203b7c=[[_0xa568('0x7f'),_0xa568('0x82')],[_0xa568('0x81'),_0x4e0f9b[0x0][_0xa568('0x79')]],db[_0xa568('0x84')][_0xa568('0x83')](_0xa568('0x85')),['id','ASC']];}return db['CmHopper'][_0xa568('0x86')]({'attributes':['id','scheduledat'],'where':_0x2751eb,'order':_0x203b7c,'transaction':_0x43aca9,'lock':_0x43aca9['LOCK'][_0xa568('0x87')],'include':[{'model':db[_0xa568('0x6e')],'as':'Contact','attributes':_0x3d0dab,'include':[{'model':db[_0xa568('0x88')],'as':_0xa568('0x89'),'attributes':['id',_0xa568('0x27')]}]},{'model':db[_0xa568('0x8a')],'as':_0xa568('0x8b'),'attributes':['id',_0xa568('0x27')]},{'model':db[_0xa568('0x5c')],'as':'Queue','attributes':['id',_0xa568('0x27'),_0xa568('0x8c')]}]})[_0xa568('0x23')](function(_0x29531c){if(_0x29531c){return _0x29531c[_0xa568('0x22')]({'UserId':_0x1104c9[_0xa568('0x66')]['id']},{'transaction':_0x43aca9});}});});}})[_0xa568('0x23')](handleEntityNotFound(_0x242407,null))[_0xa568('0x23')](respondWithResult(_0x242407,null))['catch'](handleError(_0x242407,null));};exports[_0xa568('0x8d')]=function(_0x264e89,_0x4f6037,_0x31bc03){return _0x264e89[_0xa568('0x66')][_0xa568('0x78')]({'where':{'type':_0xa568('0x8e'),'dialActive':!![],'dialMethod':_0xa568('0x8f')},'attributes':['id'],'raw':!![]})[_0xa568('0x23')](function(_0x4b4348){if(_0x4b4348&&_0x4b4348[_0xa568('0x49')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa568('0x68')](_0xa568('0x69'))},'VoiceQueueId':{'$in':_[_0xa568('0x29')](_0x4b4348,'id')},'$or':[{'UserId':null},{'UserId':_0x264e89[_0xa568('0x66')]['id']}]}});}return 0x0;})[_0xa568('0x23')](function(_0x4c6d22){if(!_[_0xa568('0x72')](_0x4c6d22)&&_[_0xa568('0x90')](_0x4c6d22)){return _0x4f6037[_0xa568('0x1a')](0xc8)['json']({'contacts':_0x4c6d22});}else{logger[_0xa568('0x25')](_0xa568('0x91'),_0xa568('0x8d'),0x194,_0xa568('0x92'));_0x4f6037[_0xa568('0x19')](0x194);}})[_0xa568('0x55')](handleError(_0x4f6037,null));}; \ No newline at end of file +var _0x93b7=['findAll','rows','keys','length','find','catch','create','body','params','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','prev','isEmpty','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','map','CmHopper','fieldName','type','key','query','intersection','model','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x40a14a,_0x5d0526){var _0x3e5182=function(_0x58f560){while(--_0x58f560){_0x40a14a['push'](_0x40a14a['shift']());}};_0x3e5182(++_0x5d0526);}(_0x93b7,0x163));var _0x793b=function(_0x3c327d,_0x1c6652){_0x3c327d=_0x3c327d-0x0;var _0x15bdbe=_0x93b7[_0x3c327d];return _0x15bdbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x793b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x793b('0x1'));var rp=require(_0x793b('0x2'));var moment=require(_0x793b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x793b('0x4'));var util=require(_0x793b('0x5'));var path=require('path');var sox=require(_0x793b('0x6'));var csv=require(_0x793b('0x7'));var ejs=require(_0x793b('0x8'));var fs=require('fs');var fs_extra=require(_0x793b('0x9'));var _=require(_0x793b('0xa'));var squel=require(_0x793b('0xb'));var crypto=require('crypto');var jsforce=require(_0x793b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x793b('0xd'));var Papa=require('papaparse');var Redis=require(_0x793b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x793b('0xf'));var as=require(_0x793b('0x10'));var hardwareService=require(_0x793b('0x11'));var logger=require(_0x793b('0x12'))(_0x793b('0x13'));var utils=require('../../config/utils');var config=require(_0x793b('0x14'));var licenseUtil=require(_0x793b('0x15'));var db=require(_0x793b('0x16'))['db'];function respondWithStatusCode(_0x3d1ff0,_0x4ae443){_0x4ae443=_0x4ae443||0xcc;return function(_0x19da2c){if(_0x19da2c){return _0x3d1ff0[_0x793b('0x17')](_0x4ae443);}return _0x3d1ff0['status'](_0x4ae443)['end']();};}function respondWithResult(_0x53cfa4,_0x2a9545){_0x2a9545=_0x2a9545||0xc8;return function(_0x4ce27a){if(_0x4ce27a){return _0x53cfa4[_0x793b('0x18')](_0x2a9545)['json'](_0x4ce27a);}};}function respondWithFilteredResult(_0x1fc40e,_0x662d46){return function(_0x5b34b3){if(_0x5b34b3){var _0x59ae95=typeof _0x662d46[_0x793b('0x19')]===_0x793b('0x1a')&&typeof _0x662d46['limit']===_0x793b('0x1a');var _0x54ee75=_0x5b34b3['count'];var _0x1fade0=_0x59ae95?0x0:_0x662d46['offset'];var _0x4a4cc9=_0x59ae95?_0x5b34b3[_0x793b('0x1b')]:_0x662d46[_0x793b('0x19')]+_0x662d46['limit'];var _0x393ad6;if(_0x4a4cc9>=_0x54ee75){_0x4a4cc9=_0x54ee75;_0x393ad6=0xc8;}else{_0x393ad6=0xce;}_0x1fc40e['status'](_0x393ad6);return _0x1fc40e['set'](_0x793b('0x1c'),_0x1fade0+'-'+_0x4a4cc9+'/'+_0x54ee75)[_0x793b('0x1d')](_0x5b34b3);}return null;};}function patchUpdates(_0x2cac18){return function(_0x5a43da){try{jsonpatch['apply'](_0x5a43da,_0x2cac18,!![]);}catch(_0x2c01da){return BPromise[_0x793b('0x1e')](_0x2c01da);}return _0x5a43da[_0x793b('0x1f')]();};}function saveUpdates(_0x14478b,_0x3bd197){return function(_0x299c42){if(_0x299c42){return _0x299c42[_0x793b('0x20')](_0x14478b)[_0x793b('0x21')](function(_0x3e0beb){return _0x3e0beb;});}return null;};}function removeEntity(_0x4cad0e,_0xba8067){return function(_0x299bce){if(_0x299bce){return _0x299bce[_0x793b('0x22')]()['then'](function(){_0x4cad0e[_0x793b('0x18')](0xcc)[_0x793b('0x23')]();});}};}function handleEntityNotFound(_0x6854c3,_0x4dcd7d){return function(_0x36c1e1){if(!_0x36c1e1){_0x6854c3['sendStatus'](0x194);}return _0x36c1e1;};}function handleError(_0x1038e6,_0xc6d4a2){_0xc6d4a2=_0xc6d4a2||0x1f4;return function(_0x480705){logger[_0x793b('0x24')](_0x480705[_0x793b('0x25')]);if(_0x480705[_0x793b('0x26')]){delete _0x480705[_0x793b('0x26')];}_0x1038e6[_0x793b('0x18')](_0xc6d4a2)['send'](_0x480705);};}exports['index']=function(_0x509f1c,_0x55763a){var _0x165890={},_0x54948f={},_0x467c68={'count':0x0,'rows':[]};var _0x303b7f=_[_0x793b('0x27')](db[_0x793b('0x28')]['rawAttributes'],function(_0x18b45b){return{'name':_0x18b45b[_0x793b('0x29')],'type':_0x18b45b[_0x793b('0x2a')][_0x793b('0x2b')]};});_0x54948f['model']=_['map'](_0x303b7f,_0x793b('0x26'));_0x54948f[_0x793b('0x2c')]=_['keys'](_0x509f1c[_0x793b('0x2c')]);_0x54948f['filters']=_[_0x793b('0x2d')](_0x54948f[_0x793b('0x2e')],_0x54948f[_0x793b('0x2c')]);_0x54948f['filters']=_['concat'](_0x54948f[_0x793b('0x2f')],[_0x793b('0x30'),_0x793b('0x31'),_0x793b('0x32'),_0x793b('0x33'),_0x793b('0x34'),_0x793b('0x35'),_0x793b('0x36'),_0x793b('0x37'),_0x793b('0x38'),_0x793b('0x39'),'$notBetween',_0x793b('0x3a'),_0x793b('0x3b'),_0x793b('0x3c'),_0x793b('0x3d'),_0x793b('0x3e'),_0x793b('0x3f'),_0x793b('0x3c'),_0x793b('0x40'),_0x793b('0x41'),'$contained',_0x793b('0x42')]);_0x165890[_0x793b('0x43')]=_[_0x793b('0x2d')](_0x54948f[_0x793b('0x2e')],qs[_0x793b('0x44')](_0x509f1c['query'][_0x793b('0x44')]));_0x165890[_0x793b('0x43')]=_0x165890[_0x793b('0x43')]['length']?_0x165890[_0x793b('0x43')]:_0x54948f[_0x793b('0x2e')];if(!_0x509f1c['query'][_0x793b('0x45')](_0x793b('0x46'))){_0x165890[_0x793b('0x47')]=qs[_0x793b('0x47')](_0x509f1c[_0x793b('0x2c')]['limit']);_0x165890[_0x793b('0x19')]=qs[_0x793b('0x19')](_0x509f1c[_0x793b('0x2c')][_0x793b('0x19')]);}_0x165890['order']=qs[_0x793b('0x48')](_0x509f1c['query'][_0x793b('0x48')]);_0x165890[_0x793b('0x49')]=qs[_0x793b('0x2f')](_['pick'](_0x509f1c[_0x793b('0x2c')],_0x54948f['filters']),_0x303b7f);if(_0x509f1c['query'][_0x793b('0x4a')]){_0x165890['where']=_[_0x793b('0x4b')](_0x165890[_0x793b('0x49')],{'$or':_['map'](_0x303b7f,function(_0x594f7c){if(_0x594f7c['type']!==_0x793b('0x4c')){var _0x5e5004={};_0x5e5004[_0x594f7c[_0x793b('0x26')]]={'$like':'%'+_0x509f1c['query']['filter']+'%'};return _0x5e5004;}})});}_0x165890=_[_0x793b('0x4b')]({},_0x165890,_0x509f1c[_0x793b('0x4d')]);var _0x264353={'where':_0x165890[_0x793b('0x49')]};return db[_0x793b('0x28')][_0x793b('0x1b')](_0x264353)[_0x793b('0x21')](function(_0x230aeb){_0x467c68[_0x793b('0x1b')]=_0x230aeb;if(_0x509f1c[_0x793b('0x2c')][_0x793b('0x4e')]){_0x165890[_0x793b('0x4f')]=[{'all':!![]}];}return db[_0x793b('0x28')][_0x793b('0x50')](_0x165890);})[_0x793b('0x21')](function(_0x31c248){_0x467c68[_0x793b('0x51')]=_0x31c248;return _0x467c68;})[_0x793b('0x21')](respondWithFilteredResult(_0x55763a,_0x165890))['catch'](handleError(_0x55763a,null));};exports['show']=function(_0x1df349,_0x5d7695){var _0x49d093={'raw':!![],'where':{'id':_0x1df349['params']['id']}},_0x1f0d1d={};_0x1f0d1d[_0x793b('0x2e')]=_[_0x793b('0x52')](db[_0x793b('0x28')]['rawAttributes']);_0x1f0d1d[_0x793b('0x2c')]=_[_0x793b('0x52')](_0x1df349[_0x793b('0x2c')]);_0x1f0d1d[_0x793b('0x2f')]=_[_0x793b('0x2d')](_0x1f0d1d[_0x793b('0x2e')],_0x1f0d1d[_0x793b('0x2c')]);_0x49d093[_0x793b('0x43')]=_[_0x793b('0x2d')](_0x1f0d1d['model'],qs[_0x793b('0x44')](_0x1df349[_0x793b('0x2c')][_0x793b('0x44')]));_0x49d093[_0x793b('0x43')]=_0x49d093[_0x793b('0x43')][_0x793b('0x53')]?_0x49d093[_0x793b('0x43')]:_0x1f0d1d[_0x793b('0x2e')];if(_0x1df349[_0x793b('0x2c')]['includeAll']){_0x49d093[_0x793b('0x4f')]=[{'all':!![]}];}_0x49d093=_[_0x793b('0x4b')]({},_0x49d093,_0x1df349[_0x793b('0x4d')]);return db[_0x793b('0x28')][_0x793b('0x54')](_0x49d093)[_0x793b('0x21')](handleEntityNotFound(_0x5d7695,null))[_0x793b('0x21')](respondWithResult(_0x5d7695,null))[_0x793b('0x55')](handleError(_0x5d7695,null));};exports[_0x793b('0x56')]=function(_0x40711b,_0xa27ab7){return db[_0x793b('0x28')][_0x793b('0x56')](_0x40711b[_0x793b('0x57')],{})[_0x793b('0x21')](respondWithResult(_0xa27ab7,0xc9))[_0x793b('0x55')](handleError(_0xa27ab7,null));};exports['update']=function(_0x4afc88,_0x577fa6){if(_0x4afc88[_0x793b('0x57')]['id']){delete _0x4afc88[_0x793b('0x57')]['id'];}return db[_0x793b('0x28')]['find']({'where':{'id':_0x4afc88[_0x793b('0x58')]['id']}})[_0x793b('0x21')](handleEntityNotFound(_0x577fa6,null))[_0x793b('0x21')](saveUpdates(_0x4afc88['body'],null))[_0x793b('0x21')](respondWithResult(_0x577fa6,null))[_0x793b('0x55')](handleError(_0x577fa6,null));};exports[_0x793b('0x59')]=function(_0x1452f6,_0x510d7c){return db['CmHopper'][_0x793b('0x59')]()[_0x793b('0x21')](respondWithResult(_0x510d7c,null))['catch'](handleError(_0x510d7c,null));};exports[_0x793b('0x22')]=function(_0x14a9e7,_0x37b8c0){var _0xed51bf;return db[_0x793b('0x28')][_0x793b('0x54')]({'where':{'id':_0x14a9e7[_0x793b('0x58')]['id']}})['then'](handleEntityNotFound(_0x37b8c0,null))[_0x793b('0x21')](function(_0x486aaa){if(_0x486aaa){return _0x486aaa[_0x793b('0x22')]()[_0x793b('0x21')](function(_0x85d7fe){return _0x85d7fe;});}})[_0x793b('0x21')](function(_0x2443a5){_0xed51bf=_0x2443a5;if(_0x2443a5){if(_0x2443a5[_0x793b('0x5a')]||_0x2443a5['CampaignId']){return db[_0x2443a5[_0x793b('0x5a')]?_0x793b('0x5b'):_0x793b('0x5c')]['find']({'where':{'id':_0x2443a5[_0x793b('0x5a')]?_0x2443a5[_0x793b('0x5a')]:_0x2443a5[_0x793b('0x5d')]},'attributes':['id',_0x793b('0x26')],'raw':!![]});}}})['then'](function(_0x33e07d){var _0x25ad6b={};if(_0x33e07d){_['merge'](_0x25ad6b,_[_0x793b('0x5e')](_0xed51bf[_0x793b('0x5f')],['createdAt','updatedAt','id']));_0x25ad6b[_0x793b('0x60')]=0x15;_0x25ad6b['statedesc']=_0x793b('0x61');_0x25ad6b[_0x793b('0x62')]=_0x33e07d[_0x793b('0x26')];_0x25ad6b[_0x793b('0x63')]=_0x14a9e7[_0x793b('0x64')]['name'];_0x25ad6b[_0x793b('0x65')]=_0x14a9e7[_0x793b('0x64')]['id'];_0x25ad6b[_0x793b('0x61')]=!![];_0x25ad6b[_0x793b('0x66')]=moment()[_0x793b('0x67')](_0x793b('0x68'));_0x25ad6b[_0x793b('0x69')]=_0xed51bf[_0x793b('0x6a')];_0x25ad6b['campaigntype']=_0xed51bf[_0x793b('0x5a')]?_0x793b('0x6b'):_0x793b('0x6c');return db[_0x793b('0x6d')][_0x793b('0x54')]({'where':{'id':_0x25ad6b[_0x793b('0x6e')]},'attributes':[_0x793b('0x6f'),_0x793b('0x70')]})[_0x793b('0x21')](function(_0x410e6b){if(!_[_0x793b('0x71')](_0x37b8c0)&&!_['isNil'](_0x410e6b[_0x793b('0x6f')])){_0x25ad6b[_0x793b('0x72')]=_0x410e6b[_0x793b('0x6f')];if(!_[_0x793b('0x71')](_0x410e6b[_0x793b('0x70')])){_0x25ad6b[_0x793b('0x72')]+='\x20'+_0x410e6b[_0x793b('0x70')];}}})[_0x793b('0x73')](function(){return db[_0x793b('0x74')][_0x793b('0x56')](_0x25ad6b);});}})[_0x793b('0x21')](function(){return _0x37b8c0['status'](0xcc)[_0x793b('0x23')]();})[_0x793b('0x55')](handleError(_0x37b8c0,null));};exports['getPreview']=function(_0x4e8e31,_0x248c11,_0x50d721){var _0x986c5=[];return db[_0x793b('0x6d')][_0x793b('0x59')]()['then'](function(_0x37888d){_0x986c5=_[_0x793b('0x52')](_0x37888d);return _0x4e8e31[_0x793b('0x64')][_0x793b('0x75')]({'where':{'type':_0x793b('0x76'),'dialActive':!![],'dialMethod':_0x793b('0x77')},'attributes':['id',_0x793b('0x78')],'raw':!![]});})['then'](function(_0x3c9b05){if(_0x3c9b05&&_0x3c9b05[_0x793b('0x53')]){return db[_0x793b('0x79')][_0x793b('0x7a')](function(_0xec877a){var _0x7f3fe4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x793b('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x793b('0x27')](_0x3c9b05,'id')},'$or':[{'UserId':null},{'UserId':_0x4e8e31[_0x793b('0x64')]['id']}]};var _0x309093=[];if(_0x4e8e31['body']['direction']&&_0x4e8e31['body']['direction']===_0x793b('0x7b')){if(!_[_0x793b('0x7c')](_0x4e8e31[_0x793b('0x57')][_0x793b('0x7d')])){_0x7f3fe4['id']={'$in':_0x4e8e31['body'][_0x793b('0x7d')]};}_0x309093=[[_0x793b('0x7e'),_0x793b('0x7f')],['scheduledAt',_0x3c9b05[0x0]['dialOrderByScheduledAt']===_0x793b('0x7f')?'DESC':_0x793b('0x7f')],db[_0x793b('0x79')]['literal'](_0x793b('0x80')),['id',_0x793b('0x81')]];}else{if(!_[_0x793b('0x7c')](_0x4e8e31[_0x793b('0x57')][_0x793b('0x7d')])){_0x7f3fe4['id']={'$notIn':_0x4e8e31[_0x793b('0x57')][_0x793b('0x7d')]};}_0x309093=[[_0x793b('0x7e'),_0x793b('0x81')],['scheduledAt',_0x3c9b05[0x0][_0x793b('0x78')]],db['sequelize'][_0x793b('0x82')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x793b('0x7f')]];}return db['CmHopper'][_0x793b('0x83')]({'attributes':['id',_0x793b('0x84')],'where':_0x7f3fe4,'order':_0x309093,'transaction':_0xec877a,'lock':_0xec877a[_0x793b('0x85')][_0x793b('0x86')],'include':[{'model':db['CmContact'],'as':_0x793b('0x87'),'attributes':_0x986c5,'include':[{'model':db[_0x793b('0x88')],'as':_0x793b('0x89'),'attributes':['id',_0x793b('0x26')]}]},{'model':db[_0x793b('0x8a')],'as':_0x793b('0x8b'),'attributes':['id',_0x793b('0x26')]},{'model':db[_0x793b('0x5b')],'as':_0x793b('0x8c'),'attributes':['id','name',_0x793b('0x8d')]}]})[_0x793b('0x21')](function(_0x48e589){if(_0x48e589){return _0x48e589[_0x793b('0x20')]({'UserId':_0x4e8e31['user']['id']},{'transaction':_0xec877a});}});});}})[_0x793b('0x21')](handleEntityNotFound(_0x248c11,null))['then'](respondWithResult(_0x248c11,null))['catch'](handleError(_0x248c11,null));};exports[_0x793b('0x8e')]=function(_0x7b7e17,_0xd6788,_0x2c2a21){return _0x7b7e17['user'][_0x793b('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x793b('0x77')},'attributes':['id'],'raw':!![]})[_0x793b('0x21')](function(_0x6696d6){if(_0x6696d6&&_0x6696d6['length']){return db['CmHopper'][_0x793b('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x793b('0x67')](_0x793b('0x68'))},'VoiceQueueId':{'$in':_[_0x793b('0x27')](_0x6696d6,'id')},'$or':[{'UserId':null},{'UserId':_0x7b7e17[_0x793b('0x64')]['id']}]}});}return 0x0;})[_0x793b('0x21')](function(_0x273338){if(!_[_0x793b('0x71')](_0x273338)&&_[_0x793b('0x8f')](_0x273338)){return _0xd6788[_0x793b('0x18')](0xc8)[_0x793b('0x1d')]({'contacts':_0x273338});}else{logger[_0x793b('0x24')](_0x793b('0x90'),_0x793b('0x8e'),0x194,'entity\x20not\x20found');_0xd6788[_0x793b('0x17')](0x194);}})['catch'](handleError(_0xd6788,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8a14271..73db090 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 _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api'];(function(_0x2c094f,_0xe5a1b0){var _0x2f7176=function(_0x28e5f5){while(--_0x28e5f5){_0x2c094f['push'](_0x2c094f['shift']());}};_0x2f7176(++_0xe5a1b0);}(_0x187d,0x93));var _0xd187=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x187d[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xc')]},{'name':_0xd187('0xd'),'fields':['phone']},{'name':_0xd187('0xe'),'fields':[_0xd187('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['path','rimraf','./cmHopper.attributes','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52c6ec,_0x4d0a18){var _0x1172ca=function(_0x1de6b8){while(--_0x1de6b8){_0x52c6ec['push'](_0x52c6ec['shift']());}};_0x1172ca(++_0x4d0a18);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0xfdbd[_0x3f59b1];return _0x11d2e8;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xdfdb('0xa'),'fields':[_0xdfdb('0xa')]},{'name':'phone','fields':[_0xdfdb('0xb')]},{'name':_0xdfdb('0xc'),'fields':[_0xdfdb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8421d82..1300f0e 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 _0xfe5b=['LOCK','Contact','keys','User','Agent','name','voicePause','length','UserId','push','update','includes','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','describe','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','http','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetCmHopper','options','raw','where','attributes','limit','include','map','model','then','catch','ShowCmHopper','CmHopper','find','CreateCmHopper','create','UpdateCmHopper','body','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','findAll'];(function(_0xc9275e,_0x4cc1ba){var _0x5162d4=function(_0x52ef80){while(--_0x52ef80){_0xc9275e['push'](_0xc9275e['shift']());}};_0x5162d4(++_0x4cc1ba);}(_0xfe5b,0x19f));var _0xbfe5=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xfe5b[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xbfe5('0x0'));var util=require('util');var moment=require(_0xbfe5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfe5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfe5('0x3'));var logger=require(_0xbfe5('0x4'))(_0xbfe5('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbfe5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x8c25d3,_0x1a2f4f,_0x48eaed){return new BPromise(function(_0x30b11a,_0x3ea859){return client['request'](_0x8c25d3,_0x48eaed)['then'](function(_0x2bb893){logger['info'](_0xbfe5('0x7'),_0x1a2f4f,_0xbfe5('0x8'));logger[_0xbfe5('0x9')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x1a2f4f,_0xbfe5('0x8'),JSON[_0xbfe5('0xa')](_0x2bb893));if(_0x2bb893[_0xbfe5('0xb')]){if(_0x2bb893[_0xbfe5('0xb')][_0xbfe5('0xc')]===0x1f4){logger[_0xbfe5('0xb')]('CmHopper,\x20%s,\x20%s',_0x1a2f4f,_0x2bb893[_0xbfe5('0xb')][_0xbfe5('0xd')]);return _0x3ea859(_0x2bb893['error'][_0xbfe5('0xd')]);}logger[_0xbfe5('0xb')]('CmHopper,\x20%s,\x20%s',_0x1a2f4f,_0x2bb893['error']['message']);return _0x30b11a(_0x2bb893[_0xbfe5('0xb')][_0xbfe5('0xd')]);}else{logger[_0xbfe5('0xe')]('CmHopper,\x20%s,\x20%s',_0x1a2f4f,'request\x20sent');_0x30b11a(_0x2bb893[_0xbfe5('0xf')][_0xbfe5('0xd')]);}})['catch'](function(_0x4c2e44){logger[_0xbfe5('0xb')](_0xbfe5('0x7'),_0x1a2f4f,_0x4c2e44);_0x3ea859(_0x4c2e44);});});}exports[_0xbfe5('0x10')]=function(_0x592b16){var _0x19160d=this;return new Promise(function(_0x35b013,_0x59be48){return db['CmHopper']['findAll']({'raw':_0x592b16[_0xbfe5('0x11')]?_0x592b16[_0xbfe5('0x11')][_0xbfe5('0x12')]===undefined?!![]:![]:!![],'where':_0x592b16[_0xbfe5('0x11')]?_0x592b16[_0xbfe5('0x11')][_0xbfe5('0x13')]||null:null,'attributes':_0x592b16[_0xbfe5('0x11')]?_0x592b16[_0xbfe5('0x11')][_0xbfe5('0x14')]||null:null,'limit':_0x592b16['options']?_0x592b16['options'][_0xbfe5('0x15')]||null:null,'include':_0x592b16['options']?_0x592b16[_0xbfe5('0x11')][_0xbfe5('0x16')]?_[_0xbfe5('0x17')](_0x592b16[_0xbfe5('0x11')][_0xbfe5('0x16')],function(_0x25dc8b){return{'model':db[_0x25dc8b[_0xbfe5('0x18')]],'as':_0x25dc8b['as'],'attributes':_0x25dc8b['attributes'],'include':_0x25dc8b[_0xbfe5('0x16')]?_[_0xbfe5('0x17')](_0x25dc8b[_0xbfe5('0x16')],function(_0x2e78ec){return{'model':db[_0x2e78ec[_0xbfe5('0x18')]],'as':_0x2e78ec['as'],'attributes':_0x2e78ec[_0xbfe5('0x14')],'include':_0x2e78ec[_0xbfe5('0x16')]?_[_0xbfe5('0x17')](_0x2e78ec[_0xbfe5('0x16')],function(_0x1c705c){return{'model':db[_0x1c705c[_0xbfe5('0x18')]],'as':_0x1c705c['as'],'attributes':_0x1c705c[_0xbfe5('0x14')]};}):[]};}):[]};}):[]:[]})[_0xbfe5('0x19')](function(_0x4c2818){logger[_0xbfe5('0xe')]('GetCmHopper',_0x592b16);logger[_0xbfe5('0x9')](_0xbfe5('0x10'),_0x592b16,JSON['stringify'](_0x4c2818));_0x35b013(_0x4c2818);})[_0xbfe5('0x1a')](function(_0x4ed298){logger[_0xbfe5('0xb')](_0xbfe5('0x10'),_0x4ed298['message'],_0x592b16);_0x59be48(_0x19160d[_0xbfe5('0xb')](0x1f4,_0x4ed298[_0xbfe5('0xd')]));});});};exports[_0xbfe5('0x1b')]=function(_0x565f4b){var _0xd41068=this;return new Promise(function(_0x25f059,_0x4e4d89){return db[_0xbfe5('0x1c')][_0xbfe5('0x1d')]({'raw':_0x565f4b[_0xbfe5('0x11')]?_0x565f4b[_0xbfe5('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x565f4b[_0xbfe5('0x11')]?_0x565f4b[_0xbfe5('0x11')][_0xbfe5('0x13')]||null:null,'attributes':_0x565f4b[_0xbfe5('0x11')]?_0x565f4b['options'][_0xbfe5('0x14')]||null:null,'include':_0x565f4b[_0xbfe5('0x11')]?_0x565f4b[_0xbfe5('0x11')]['include']?_[_0xbfe5('0x17')](_0x565f4b[_0xbfe5('0x11')]['include'],function(_0x207d2a){return{'model':db[_0x207d2a[_0xbfe5('0x18')]],'as':_0x207d2a['as'],'attributes':_0x207d2a[_0xbfe5('0x14')],'include':_0x207d2a[_0xbfe5('0x16')]?_[_0xbfe5('0x17')](_0x207d2a[_0xbfe5('0x16')],function(_0x17010a){return{'model':db[_0x17010a[_0xbfe5('0x18')]],'as':_0x17010a['as'],'attributes':_0x17010a[_0xbfe5('0x14')],'include':_0x17010a[_0xbfe5('0x16')]?_[_0xbfe5('0x17')](_0x17010a[_0xbfe5('0x16')],function(_0x4574a0){return{'model':db[_0x4574a0[_0xbfe5('0x18')]],'as':_0x4574a0['as'],'attributes':_0x4574a0[_0xbfe5('0x14')]};}):[]};}):[]};}):[]:[]})[_0xbfe5('0x19')](function(_0x2b24bf){logger[_0xbfe5('0xe')](_0xbfe5('0x1b'),_0x565f4b);logger['debug'](_0xbfe5('0x1b'),_0x565f4b,JSON[_0xbfe5('0xa')](_0x2b24bf));_0x25f059(_0x2b24bf);})[_0xbfe5('0x1a')](function(_0x3e1350){logger[_0xbfe5('0xb')](_0xbfe5('0x1b'),_0x3e1350[_0xbfe5('0xd')],_0x565f4b);_0x4e4d89(_0xd41068[_0xbfe5('0xb')](0x1f4,_0x3e1350[_0xbfe5('0xd')]));});});};exports[_0xbfe5('0x1e')]=function(_0x5b7ce2){var _0x5e7de3=this;return new Promise(function(_0x448258,_0x59db29){return db[_0xbfe5('0x1c')][_0xbfe5('0x1f')](_0x5b7ce2['body'],{'raw':_0x5b7ce2[_0xbfe5('0x11')]?_0x5b7ce2[_0xbfe5('0x11')]['raw']===undefined?!![]:![]:!![]})[_0xbfe5('0x19')](function(_0xee4faa){logger[_0xbfe5('0xe')](_0xbfe5('0x1e'),_0x5b7ce2);logger[_0xbfe5('0x9')]('CreateCmHopper',_0x5b7ce2,JSON['stringify'](_0xee4faa));_0x448258(_0xee4faa);})['catch'](function(_0x26104e){logger['error']('CreateCmHopper',_0x26104e[_0xbfe5('0xd')],_0x5b7ce2);_0x59db29(_0x5e7de3[_0xbfe5('0xb')](0x1f4,_0x26104e[_0xbfe5('0xd')]));});});};exports[_0xbfe5('0x20')]=function(_0x465af0){var _0x46d91d=this;return new Promise(function(_0x1d00b5,_0x3ada81){return db['CmHopper']['update'](_0x465af0[_0xbfe5('0x21')],{'raw':_0x465af0[_0xbfe5('0x11')]?_0x465af0['options'][_0xbfe5('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x465af0['options']?_0x465af0['options'][_0xbfe5('0x13')]||null:null,'attributes':_0x465af0['options']?_0x465af0[_0xbfe5('0x11')]['attributes']||null:null,'limit':_0x465af0[_0xbfe5('0x11')]?_0x465af0['options'][_0xbfe5('0x15')]||null:null})[_0xbfe5('0x19')](function(_0x4b983b){logger[_0xbfe5('0xe')](_0xbfe5('0x20'),_0x465af0);logger[_0xbfe5('0x9')](_0xbfe5('0x20'),_0x465af0,JSON[_0xbfe5('0xa')](_0x4b983b));_0x1d00b5(_0x4b983b);})[_0xbfe5('0x1a')](function(_0x588c36){logger['error'](_0xbfe5('0x20'),_0x588c36[_0xbfe5('0xd')],_0x465af0);_0x3ada81(_0x46d91d[_0xbfe5('0xb')](0x1f4,_0x588c36[_0xbfe5('0xd')]));});});};exports[_0xbfe5('0x22')]=function(_0x297d4c){var _0x2f36e9=this;return new Promise(function(_0x11fc8e,_0x527a1e){return db[_0xbfe5('0x1c')]['destroy']({'where':_0x297d4c[_0xbfe5('0x11')]?_0x297d4c[_0xbfe5('0x11')][_0xbfe5('0x13')]||null:null})[_0xbfe5('0x19')](function(_0x5666ef){logger[_0xbfe5('0xe')]('DestroyCmHopper',_0x297d4c);logger['debug']('DestroyCmHopper',_0x297d4c,JSON[_0xbfe5('0xa')](_0x5666ef));_0x11fc8e(_0x5666ef);})[_0xbfe5('0x1a')](function(_0x264ef6){logger[_0xbfe5('0xb')](_0xbfe5('0x22'),_0x264ef6[_0xbfe5('0xd')],_0x297d4c);_0x527a1e(_0x2f36e9[_0xbfe5('0xb')](0x1f4,_0x264ef6[_0xbfe5('0xd')]));});});};exports[_0xbfe5('0x23')]=function(_0x4d30ff){var _0x3f6eb8=this;return new Promise(function(_0xf839c2,_0x4716c0){return db[_0xbfe5('0x24')]['describe']()['then'](function(_0x269363){return db[_0xbfe5('0x25')][_0xbfe5('0x26')](function(_0x51023a){return db[_0xbfe5('0x1c')][_0xbfe5('0x27')]({'where':_0x4d30ff[_0xbfe5('0x11')]?_0x4d30ff[_0xbfe5('0x11')][_0xbfe5('0x13')]||null:null,'attributes':_0x4d30ff[_0xbfe5('0x11')]?_0x4d30ff[_0xbfe5('0x11')][_0xbfe5('0x14')]||null:null,'limit':_0x4d30ff['options']?_0x4d30ff[_0xbfe5('0x11')][_0xbfe5('0x15')]||null:null,'order':_0x4d30ff[_0xbfe5('0x11')]?_0x4d30ff['options']['order']||null:null,'transaction':_0x51023a,'lock':_0x51023a[_0xbfe5('0x28')]['UPDATE'],'include':[{'model':db[_0xbfe5('0x24')],'as':_0xbfe5('0x29'),'attributes':_[_0xbfe5('0x2a')](_0x269363)},{'model':db[_0xbfe5('0x2b')],'as':_0xbfe5('0x2c'),'attributes':['id',_0xbfe5('0x2d'),_0xbfe5('0x2e')]}]})['then'](function(_0x293d3c){var _0x1eadec=[];var _0x158a45=[];for(var _0x29e190=0x0;_0x29e190<_0x293d3c[_0xbfe5('0x2f')];_0x29e190+=0x1){var _0x44eabd=_0x293d3c[_0x29e190][_0xbfe5('0x30')];if(_0x44eabd===null){_0x1eadec[_0xbfe5('0x31')](_0x293d3c[_0x29e190][_0xbfe5('0x32')](_0x4d30ff[_0xbfe5('0x21')],{'transaction':_0x51023a}));}else if(!_0x158a45[_0xbfe5('0x33')](_0x44eabd)){_0x158a45[_0xbfe5('0x31')](_0x44eabd);_0x1eadec[_0xbfe5('0x31')](_0x293d3c[_0x29e190][_0xbfe5('0x32')](_0x4d30ff[_0xbfe5('0x21')],{'transaction':_0x51023a}));}}return BPromise[_0xbfe5('0x34')](_0x1eadec);});})['then'](function(_0xaad0e1){logger[_0xbfe5('0xe')](_0xbfe5('0x23'),_0x4d30ff);logger['debug']('GetContactDialer',_0x4d30ff,JSON[_0xbfe5('0xa')](_0xaad0e1));_0xf839c2(_0xaad0e1);})[_0xbfe5('0x1a')](function(_0x152ee2){logger['error'](_0xbfe5('0x23'),_0x152ee2[_0xbfe5('0xd')],_0x4d30ff);_0x4716c0(_0x3f6eb8[_0xbfe5('0xb')](0x1f4,_0x152ee2[_0xbfe5('0xd')]));});});});};exports['MoveContactManagedDialer']=function(_0x56ace4){var _0x38fe4c=this;return new Promise(function(_0x6a62ab,_0x4a6995){return db[_0xbfe5('0x25')][_0xbfe5('0x26')](function(_0x3e528f){return db['CmHopperFinal'][_0xbfe5('0x1f')](_0x56ace4[_0xbfe5('0x21')],{'raw':_0x56ace4[_0xbfe5('0x11')]?_0x56ace4['options'][_0xbfe5('0x12')]===undefined?!![]:![]:!![],'transaction':_0x3e528f})[_0xbfe5('0x19')](function(){return db[_0xbfe5('0x1c')]['destroy']({'where':_0x56ace4[_0xbfe5('0x11')]?_0x56ace4[_0xbfe5('0x11')][_0xbfe5('0x13')]||null:null,'transaction':_0x3e528f});});})[_0xbfe5('0x19')](function(_0x6e985a){logger[_0xbfe5('0xe')](_0xbfe5('0x35'),_0x56ace4);logger['debug'](_0xbfe5('0x35'),_0x56ace4,JSON[_0xbfe5('0xa')](_0x6e985a));_0x6a62ab(_0x6e985a);})[_0xbfe5('0x1a')](function(_0x92e726){logger['error'](_0xbfe5('0x35'),_0x92e726[_0xbfe5('0xd')],_0x56ace4);_0x4a6995(_0x38fe4c[_0xbfe5('0xb')](0x1f4,_0x92e726[_0xbfe5('0xd')]));});});};exports[_0xbfe5('0x36')]=function(_0x580539){var _0x5a8d45=this;return new Promise(function(_0x3ad554,_0x103702){return db[_0xbfe5('0x1c')][_0xbfe5('0x27')]({'raw':_0x580539[_0xbfe5('0x11')]?_0x580539[_0xbfe5('0x11')][_0xbfe5('0x12')]===undefined?!![]:![]:!![],'where':_0x580539[_0xbfe5('0x11')]?_0x580539[_0xbfe5('0x11')][_0xbfe5('0x13')]||null:null,'attributes':[[db[_0xbfe5('0x25')]['fn'](_0xbfe5('0x37'),db['sequelize']['fn']('IF',db['sequelize'][_0xbfe5('0x38')](_0xbfe5('0x39')+util[_0xbfe5('0x3a')](_0xbfe5('0x3b'),moment()[_0xbfe5('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbfe5('0x3c')))),_0xbfe5('0x3d')]]})[_0xbfe5('0x19')](function(_0x42e867){logger['info'](_0xbfe5('0x36'),_0x580539);logger[_0xbfe5('0x9')](_0xbfe5('0x36'),_0x580539,JSON['stringify'](_0x42e867));_0x3ad554(_0x42e867);})[_0xbfe5('0x1a')](function(_0x114340){logger[_0xbfe5('0xb')](_0xbfe5('0x36'),_0x114340[_0xbfe5('0xd')],_0x580539);_0x103702(_0x5a8d45[_0xbfe5('0xb')](0x1f4,_0x114340[_0xbfe5('0xd')]));});});};exports[_0xbfe5('0x3e')]=function(_0x4373d7){var _0x278626=this;return new Promise(function(_0x50803e,_0x290690){return db[_0xbfe5('0x24')]['describe']()['then'](function(_0x263cb0){return db[_0xbfe5('0x25')][_0xbfe5('0x26')](function(_0x3194b6){return db['CmHopper'][_0xbfe5('0x27')]({'where':_0x4373d7[_0xbfe5('0x11')]?_0x4373d7['options'][_0xbfe5('0x13')]||null:null,'attributes':_0x4373d7[_0xbfe5('0x11')]?_0x4373d7[_0xbfe5('0x11')]['attributes']||null:null,'limit':0x1,'order':_0x4373d7[_0xbfe5('0x11')]?_0x4373d7[_0xbfe5('0x11')]['order']||null:null,'group':db['CmHopper'][_0xbfe5('0x30')],'transaction':_0x3194b6,'lock':_0x3194b6[_0xbfe5('0x28')]['UPDATE'],'include':_0x4373d7[_0xbfe5('0x11')]?_0x4373d7['options']['include']?_[_0xbfe5('0x17')](_0x4373d7[_0xbfe5('0x11')][_0xbfe5('0x16')],function(_0x48b36e){return{'model':db[_0x48b36e[_0xbfe5('0x18')]],'as':_0x48b36e['as'],'attributes':_0x48b36e[_0xbfe5('0x14')],'include':_0x48b36e[_0xbfe5('0x16')]?_[_0xbfe5('0x17')](_0x48b36e['include'],function(_0x200c7b){return{'model':db[_0x200c7b['model']],'as':_0x200c7b['as'],'attributes':_0x200c7b['attributes'],'include':_0x200c7b[_0xbfe5('0x16')]?_[_0xbfe5('0x17')](_0x200c7b['include'],function(_0x739940){return{'model':db[_0x739940[_0xbfe5('0x18')]],'as':_0x739940['as'],'attributes':_0x739940[_0xbfe5('0x14')]};}):[]};}):[]};}):[]:[]})[_0xbfe5('0x19')](function(_0x3fd76a){var _0x21d737=[];for(var _0x4e4bab=0x0;_0x4e4bab<_0x3fd76a[_0xbfe5('0x2f')];_0x4e4bab+=0x1){_0x21d737[_0xbfe5('0x31')](_0x3fd76a[_0x4e4bab]['update'](_0x4373d7[_0xbfe5('0x21')],{'transaction':_0x3194b6}));}return BPromise[_0xbfe5('0x34')](_0x21d737);});})[_0xbfe5('0x19')](function(_0x482fec){logger[_0xbfe5('0xe')](_0xbfe5('0x3e'),_0x4373d7);logger[_0xbfe5('0x9')](_0xbfe5('0x3e'),_0x4373d7,JSON[_0xbfe5('0xa')](_0x482fec));_0x50803e(_0x482fec);})[_0xbfe5('0x1a')](function(_0x327397){logger['error']('GetContactRecallMe',_0x327397[_0xbfe5('0xd')],_0x4373d7);_0x290690(_0x278626[_0xbfe5('0xb')](0x1f4,_0x327397[_0xbfe5('0xd')]));});});});};exports[_0xbfe5('0x3f')]=function(_0x31a80b){var _0x2b438d=this;return new Promise(function(_0x1851af,_0x1805dc){db[_0xbfe5('0x24')][_0xbfe5('0x40')]()[_0xbfe5('0x19')](function(_0x465330){return db['CmHopper'][_0xbfe5('0x27')]({'raw':_0x31a80b['options']?_0x31a80b[_0xbfe5('0x11')][_0xbfe5('0x12')]===undefined?!![]:![]:!![],'where':_0x31a80b[_0xbfe5('0x11')]?_0x31a80b[_0xbfe5('0x11')][_0xbfe5('0x13')]||null:null,'attributes':_0x31a80b[_0xbfe5('0x11')]?_0x31a80b['options']['attributes']||null:null,'limit':_0x31a80b[_0xbfe5('0x11')]?_0x31a80b[_0xbfe5('0x11')][_0xbfe5('0x15')]||null:null,'include':_0x31a80b[_0xbfe5('0x11')]?_0x31a80b[_0xbfe5('0x11')][_0xbfe5('0x16')]?_[_0xbfe5('0x17')](_0x31a80b['options']['include'],function(_0x1ed420){return{'model':db[_0x1ed420['model']],'as':_0x1ed420['as'],'attributes':_0x1ed420['as']==='Contact'?_['keys'](_0x465330):_0x1ed420[_0xbfe5('0x14')],'include':_0x1ed420[_0xbfe5('0x16')]?_['map'](_0x1ed420[_0xbfe5('0x16')],function(_0x30c9f6){return{'model':db[_0x30c9f6[_0xbfe5('0x18')]],'as':_0x30c9f6['as'],'attributes':_0x30c9f6['attributes'],'include':_0x30c9f6[_0xbfe5('0x16')]?_[_0xbfe5('0x17')](_0x30c9f6['include'],function(_0x1b86db){return{'model':db[_0x1b86db[_0xbfe5('0x18')]],'as':_0x1b86db['as'],'attributes':_0x1b86db['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fe7be){logger['info'](_0xbfe5('0x10'),_0x31a80b);logger[_0xbfe5('0x9')](_0xbfe5('0x10'),_0x31a80b,JSON[_0xbfe5('0xa')](_0x1fe7be));_0x1851af(_0x1fe7be);})['catch'](function(_0x59d859){logger[_0xbfe5('0xb')]('GetCmHopper',_0x59d859[_0xbfe5('0xd')],_0x31a80b);_0x1805dc(_0x2b438d['error'](0x1f4,_0x59d859[_0xbfe5('0xd')]));});});});}; \ No newline at end of file +var _0x3239=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','model','attributes','map','ShowCmHopper','find','CreateCmHopper','create','body','debug','update','UpdateCmHopper','DestroyCmHopper','describe','sequelize','transaction','order','LOCK','CmContact','Contact','keys','Agent','name','voicePause','UserId','includes','push','GetContactDialer','MoveContactManagedDialer','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','length','GetCmHopperPreview','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3239,0x167));var _0x9323=function(_0x499e35,_0x14e270){_0x499e35=_0x499e35-0x0;var _0x35ec0a=_0x3239[_0x499e35];return _0x35ec0a;};'use strict';var _=require(_0x9323('0x0'));var util=require(_0x9323('0x1'));var moment=require(_0x9323('0x2'));var BPromise=require(_0x9323('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9323('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9323('0x5'));var logger=require(_0x9323('0x6'))(_0x9323('0x7'));var config=require(_0x9323('0x8'));var jayson=require(_0x9323('0x9'));var client=jayson[_0x9323('0xa')][_0x9323('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x210427,_0x5a9f3a,_0xad956e){return new BPromise(function(_0x336172,_0x3a3e0a){return client['request'](_0x210427,_0xad956e)[_0x9323('0xc')](function(_0x445a93){logger[_0x9323('0xd')](_0x9323('0xe'),_0x5a9f3a,_0x9323('0xf'));logger['debug'](_0x9323('0x10'),_0x5a9f3a,_0x9323('0xf'),JSON[_0x9323('0x11')](_0x445a93));if(_0x445a93[_0x9323('0x12')]){if(_0x445a93[_0x9323('0x12')][_0x9323('0x13')]===0x1f4){logger['error'](_0x9323('0xe'),_0x5a9f3a,_0x445a93[_0x9323('0x12')][_0x9323('0x14')]);return _0x3a3e0a(_0x445a93[_0x9323('0x12')][_0x9323('0x14')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x5a9f3a,_0x445a93[_0x9323('0x12')]['message']);return _0x336172(_0x445a93[_0x9323('0x12')]['message']);}else{logger[_0x9323('0xd')](_0x9323('0xe'),_0x5a9f3a,_0x9323('0xf'));_0x336172(_0x445a93[_0x9323('0x15')][_0x9323('0x14')]);}})[_0x9323('0x16')](function(_0x1fab81){logger['error'](_0x9323('0xe'),_0x5a9f3a,_0x1fab81);_0x3a3e0a(_0x1fab81);});});}exports[_0x9323('0x17')]=function(_0x24d704){var _0x1170d5=this;return new Promise(function(_0x4033ef,_0x3d545a){return db[_0x9323('0x18')][_0x9323('0x19')]({'raw':_0x24d704['options']?_0x24d704[_0x9323('0x1a')][_0x9323('0x1b')]===undefined?!![]:![]:!![],'where':_0x24d704[_0x9323('0x1a')]?_0x24d704[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0x24d704[_0x9323('0x1a')]?_0x24d704[_0x9323('0x1a')]['attributes']||null:null,'limit':_0x24d704[_0x9323('0x1a')]?_0x24d704[_0x9323('0x1a')][_0x9323('0x1d')]||null:null,'include':_0x24d704[_0x9323('0x1a')]?_0x24d704['options'][_0x9323('0x1e')]?_['map'](_0x24d704['options'][_0x9323('0x1e')],function(_0x33e725){return{'model':db[_0x33e725[_0x9323('0x1f')]],'as':_0x33e725['as'],'attributes':_0x33e725[_0x9323('0x20')],'include':_0x33e725[_0x9323('0x1e')]?_['map'](_0x33e725[_0x9323('0x1e')],function(_0x449e3f){return{'model':db[_0x449e3f['model']],'as':_0x449e3f['as'],'attributes':_0x449e3f['attributes'],'include':_0x449e3f['include']?_[_0x9323('0x21')](_0x449e3f[_0x9323('0x1e')],function(_0x22d1db){return{'model':db[_0x22d1db[_0x9323('0x1f')]],'as':_0x22d1db['as'],'attributes':_0x22d1db[_0x9323('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9323('0xc')](function(_0x24a9e4){logger[_0x9323('0xd')](_0x9323('0x17'),_0x24d704);logger['debug'](_0x9323('0x17'),_0x24d704,JSON[_0x9323('0x11')](_0x24a9e4));_0x4033ef(_0x24a9e4);})[_0x9323('0x16')](function(_0x3a9401){logger[_0x9323('0x12')](_0x9323('0x17'),_0x3a9401['message'],_0x24d704);_0x3d545a(_0x1170d5['error'](0x1f4,_0x3a9401[_0x9323('0x14')]));});});};exports[_0x9323('0x22')]=function(_0x59c20c){var _0x371980=this;return new Promise(function(_0x30814f,_0xe599ae){return db['CmHopper'][_0x9323('0x23')]({'raw':_0x59c20c['options']?_0x59c20c[_0x9323('0x1a')][_0x9323('0x1b')]===undefined?!![]:![]:!![],'where':_0x59c20c[_0x9323('0x1a')]?_0x59c20c[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0x59c20c['options']?_0x59c20c[_0x9323('0x1a')]['attributes']||null:null,'include':_0x59c20c[_0x9323('0x1a')]?_0x59c20c[_0x9323('0x1a')][_0x9323('0x1e')]?_['map'](_0x59c20c['options']['include'],function(_0x14b55f){return{'model':db[_0x14b55f[_0x9323('0x1f')]],'as':_0x14b55f['as'],'attributes':_0x14b55f['attributes'],'include':_0x14b55f[_0x9323('0x1e')]?_['map'](_0x14b55f[_0x9323('0x1e')],function(_0x467700){return{'model':db[_0x467700[_0x9323('0x1f')]],'as':_0x467700['as'],'attributes':_0x467700[_0x9323('0x20')],'include':_0x467700['include']?_[_0x9323('0x21')](_0x467700[_0x9323('0x1e')],function(_0x1ae7c0){return{'model':db[_0x1ae7c0[_0x9323('0x1f')]],'as':_0x1ae7c0['as'],'attributes':_0x1ae7c0[_0x9323('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9323('0xc')](function(_0x500ff3){logger[_0x9323('0xd')](_0x9323('0x22'),_0x59c20c);logger['debug'](_0x9323('0x22'),_0x59c20c,JSON[_0x9323('0x11')](_0x500ff3));_0x30814f(_0x500ff3);})[_0x9323('0x16')](function(_0x3e741e){logger[_0x9323('0x12')](_0x9323('0x22'),_0x3e741e[_0x9323('0x14')],_0x59c20c);_0xe599ae(_0x371980[_0x9323('0x12')](0x1f4,_0x3e741e[_0x9323('0x14')]));});});};exports[_0x9323('0x24')]=function(_0x153961){var _0x20d087=this;return new Promise(function(_0x5708b4,_0x8c9c92){return db[_0x9323('0x18')][_0x9323('0x25')](_0x153961[_0x9323('0x26')],{'raw':_0x153961['options']?_0x153961['options'][_0x9323('0x1b')]===undefined?!![]:![]:!![]})[_0x9323('0xc')](function(_0x25f155){logger[_0x9323('0xd')](_0x9323('0x24'),_0x153961);logger[_0x9323('0x27')](_0x9323('0x24'),_0x153961,JSON[_0x9323('0x11')](_0x25f155));_0x5708b4(_0x25f155);})[_0x9323('0x16')](function(_0x458231){logger[_0x9323('0x12')](_0x9323('0x24'),_0x458231['message'],_0x153961);_0x8c9c92(_0x20d087[_0x9323('0x12')](0x1f4,_0x458231['message']));});});};exports['UpdateCmHopper']=function(_0x45f016){var _0x388e7c=this;return new Promise(function(_0x3d08b3,_0x2132bb){return db['CmHopper'][_0x9323('0x28')](_0x45f016['body'],{'raw':_0x45f016['options']?_0x45f016['options'][_0x9323('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f016[_0x9323('0x1a')]?_0x45f016[_0x9323('0x1a')]['where']||null:null,'attributes':_0x45f016[_0x9323('0x1a')]?_0x45f016['options'][_0x9323('0x20')]||null:null,'limit':_0x45f016[_0x9323('0x1a')]?_0x45f016[_0x9323('0x1a')][_0x9323('0x1d')]||null:null})[_0x9323('0xc')](function(_0x4f66d2){logger[_0x9323('0xd')](_0x9323('0x29'),_0x45f016);logger['debug'](_0x9323('0x29'),_0x45f016,JSON[_0x9323('0x11')](_0x4f66d2));_0x3d08b3(_0x4f66d2);})[_0x9323('0x16')](function(_0x3bf006){logger[_0x9323('0x12')]('UpdateCmHopper',_0x3bf006[_0x9323('0x14')],_0x45f016);_0x2132bb(_0x388e7c[_0x9323('0x12')](0x1f4,_0x3bf006[_0x9323('0x14')]));});});};exports['DestroyCmHopper']=function(_0x28030a){var _0x28c9a2=this;return new Promise(function(_0x2707f8,_0x51bab3){return db[_0x9323('0x18')]['destroy']({'where':_0x28030a[_0x9323('0x1a')]?_0x28030a[_0x9323('0x1a')]['where']||null:null})[_0x9323('0xc')](function(_0x5ea872){logger[_0x9323('0xd')](_0x9323('0x2a'),_0x28030a);logger['debug']('DestroyCmHopper',_0x28030a,JSON[_0x9323('0x11')](_0x5ea872));_0x2707f8(_0x5ea872);})[_0x9323('0x16')](function(_0x5588b6){logger['error'](_0x9323('0x2a'),_0x5588b6[_0x9323('0x14')],_0x28030a);_0x51bab3(_0x28c9a2[_0x9323('0x12')](0x1f4,_0x5588b6['message']));});});};exports['GetContactDialer']=function(_0xa25d94){var _0x437758=this;return new Promise(function(_0x991cc3,_0xe806b6){return db['CmContact'][_0x9323('0x2b')]()['then'](function(_0x5b75e9){return db[_0x9323('0x2c')][_0x9323('0x2d')](function(_0x3a5e63){return db[_0x9323('0x18')][_0x9323('0x19')]({'where':_0xa25d94[_0x9323('0x1a')]?_0xa25d94[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0xa25d94[_0x9323('0x1a')]?_0xa25d94[_0x9323('0x1a')][_0x9323('0x20')]||null:null,'limit':_0xa25d94[_0x9323('0x1a')]?_0xa25d94[_0x9323('0x1a')][_0x9323('0x1d')]||null:null,'order':_0xa25d94[_0x9323('0x1a')]?_0xa25d94['options'][_0x9323('0x2e')]||null:null,'transaction':_0x3a5e63,'lock':_0x3a5e63[_0x9323('0x2f')]['UPDATE'],'include':[{'model':db[_0x9323('0x30')],'as':_0x9323('0x31'),'attributes':_[_0x9323('0x32')](_0x5b75e9)},{'model':db['User'],'as':_0x9323('0x33'),'attributes':['id',_0x9323('0x34'),_0x9323('0x35')]}]})['then'](function(_0x43f897){var _0x109479=[];var _0x36404c=[];for(var _0x1ac0fb=0x0;_0x1ac0fb<_0x43f897['length'];_0x1ac0fb+=0x1){var _0x33900b=_0x43f897[_0x1ac0fb][_0x9323('0x36')];if(_0x33900b===null){_0x109479['push'](_0x43f897[_0x1ac0fb]['update'](_0xa25d94[_0x9323('0x26')],{'transaction':_0x3a5e63}));}else if(!_0x36404c[_0x9323('0x37')](_0x33900b)){_0x36404c[_0x9323('0x38')](_0x33900b);_0x109479['push'](_0x43f897[_0x1ac0fb][_0x9323('0x28')](_0xa25d94[_0x9323('0x26')],{'transaction':_0x3a5e63}));}}return BPromise['all'](_0x109479);});})[_0x9323('0xc')](function(_0x3cdf2f){logger[_0x9323('0xd')]('GetContactDialer',_0xa25d94);logger[_0x9323('0x27')](_0x9323('0x39'),_0xa25d94,JSON[_0x9323('0x11')](_0x3cdf2f));_0x991cc3(_0x3cdf2f);})['catch'](function(_0x50e340){logger[_0x9323('0x12')]('GetContactDialer',_0x50e340['message'],_0xa25d94);_0xe806b6(_0x437758[_0x9323('0x12')](0x1f4,_0x50e340[_0x9323('0x14')]));});});});};exports[_0x9323('0x3a')]=function(_0x5c1a5d){var _0x2edd2f=this;return new Promise(function(_0x15ea11,_0x2596b0){return db[_0x9323('0x2c')][_0x9323('0x2d')](function(_0x404dfe){return db['CmHopperFinal'][_0x9323('0x25')](_0x5c1a5d[_0x9323('0x26')],{'raw':_0x5c1a5d[_0x9323('0x1a')]?_0x5c1a5d[_0x9323('0x1a')]['raw']===undefined?!![]:![]:!![],'transaction':_0x404dfe})[_0x9323('0xc')](function(){return db[_0x9323('0x18')][_0x9323('0x3b')]({'where':_0x5c1a5d['options']?_0x5c1a5d[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'transaction':_0x404dfe});});})[_0x9323('0xc')](function(_0x2ffd40){logger[_0x9323('0xd')](_0x9323('0x3a'),_0x5c1a5d);logger[_0x9323('0x27')]('MoveContactManagedDialer',_0x5c1a5d,JSON[_0x9323('0x11')](_0x2ffd40));_0x15ea11(_0x2ffd40);})['catch'](function(_0x4aadc4){logger[_0x9323('0x12')](_0x9323('0x3a'),_0x4aadc4[_0x9323('0x14')],_0x5c1a5d);_0x2596b0(_0x2edd2f[_0x9323('0x12')](0x1f4,_0x4aadc4[_0x9323('0x14')]));});});};exports[_0x9323('0x3c')]=function(_0x54c6b9){var _0x20b584=this;return new Promise(function(_0x573013,_0x62fa74){return db[_0x9323('0x18')][_0x9323('0x19')]({'raw':_0x54c6b9['options']?_0x54c6b9[_0x9323('0x1a')][_0x9323('0x1b')]===undefined?!![]:![]:!![],'where':_0x54c6b9[_0x9323('0x1a')]?_0x54c6b9[_0x9323('0x1a')]['where']||null:null,'attributes':[[db[_0x9323('0x2c')]['fn'](_0x9323('0x3d'),db['sequelize']['fn']('IF',db[_0x9323('0x2c')][_0x9323('0x3e')](_0x9323('0x3f')+util[_0x9323('0x40')](_0x9323('0x41'),moment()[_0x9323('0x40')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x9323('0x42')))),_0x9323('0x43')]]})['then'](function(_0x35e399){logger['info'](_0x9323('0x3c'),_0x54c6b9);logger[_0x9323('0x27')](_0x9323('0x3c'),_0x54c6b9,JSON[_0x9323('0x11')](_0x35e399));_0x573013(_0x35e399);})[_0x9323('0x16')](function(_0x34c5a6){logger[_0x9323('0x12')]('CountReScheduled',_0x34c5a6[_0x9323('0x14')],_0x54c6b9);_0x62fa74(_0x20b584[_0x9323('0x12')](0x1f4,_0x34c5a6[_0x9323('0x14')]));});});};exports[_0x9323('0x44')]=function(_0x58f071){var _0x4c5b21=this;return new Promise(function(_0x4785f7,_0x18119f){return db[_0x9323('0x30')]['describe']()[_0x9323('0xc')](function(_0x154a49){return db[_0x9323('0x2c')][_0x9323('0x2d')](function(_0x422ea2){return db[_0x9323('0x18')][_0x9323('0x19')]({'where':_0x58f071[_0x9323('0x1a')]?_0x58f071[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0x58f071[_0x9323('0x1a')]?_0x58f071['options'][_0x9323('0x20')]||null:null,'limit':0x1,'order':_0x58f071[_0x9323('0x1a')]?_0x58f071[_0x9323('0x1a')][_0x9323('0x2e')]||null:null,'group':db[_0x9323('0x18')]['UserId'],'transaction':_0x422ea2,'lock':_0x422ea2['LOCK'][_0x9323('0x45')],'include':_0x58f071[_0x9323('0x1a')]?_0x58f071[_0x9323('0x1a')][_0x9323('0x1e')]?_[_0x9323('0x21')](_0x58f071['options'][_0x9323('0x1e')],function(_0x4a7bd2){return{'model':db[_0x4a7bd2['model']],'as':_0x4a7bd2['as'],'attributes':_0x4a7bd2[_0x9323('0x20')],'include':_0x4a7bd2[_0x9323('0x1e')]?_['map'](_0x4a7bd2[_0x9323('0x1e')],function(_0x2302aa){return{'model':db[_0x2302aa[_0x9323('0x1f')]],'as':_0x2302aa['as'],'attributes':_0x2302aa['attributes'],'include':_0x2302aa[_0x9323('0x1e')]?_[_0x9323('0x21')](_0x2302aa['include'],function(_0x19ec51){return{'model':db[_0x19ec51[_0x9323('0x1f')]],'as':_0x19ec51['as'],'attributes':_0x19ec51['attributes']};}):[]};}):[]};}):[]:[]})[_0x9323('0xc')](function(_0xb1f002){var _0x15b459=[];for(var _0x28b8fe=0x0;_0x28b8fe<_0xb1f002[_0x9323('0x46')];_0x28b8fe+=0x1){_0x15b459[_0x9323('0x38')](_0xb1f002[_0x28b8fe][_0x9323('0x28')](_0x58f071['body'],{'transaction':_0x422ea2}));}return BPromise['all'](_0x15b459);});})[_0x9323('0xc')](function(_0x32a103){logger[_0x9323('0xd')]('GetContactRecallMe',_0x58f071);logger[_0x9323('0x27')](_0x9323('0x44'),_0x58f071,JSON[_0x9323('0x11')](_0x32a103));_0x4785f7(_0x32a103);})[_0x9323('0x16')](function(_0xc3dd23){logger[_0x9323('0x12')](_0x9323('0x44'),_0xc3dd23[_0x9323('0x14')],_0x58f071);_0x18119f(_0x4c5b21['error'](0x1f4,_0xc3dd23[_0x9323('0x14')]));});});});};exports[_0x9323('0x47')]=function(_0x200e14){var _0x1e7729=this;return new Promise(function(_0x5aeb9e,_0x46e8fe){db[_0x9323('0x30')][_0x9323('0x2b')]()[_0x9323('0xc')](function(_0x100d13){return db['CmHopper'][_0x9323('0x19')]({'raw':_0x200e14[_0x9323('0x1a')]?_0x200e14['options'][_0x9323('0x1b')]===undefined?!![]:![]:!![],'where':_0x200e14[_0x9323('0x1a')]?_0x200e14[_0x9323('0x1a')][_0x9323('0x1c')]||null:null,'attributes':_0x200e14[_0x9323('0x1a')]?_0x200e14[_0x9323('0x1a')]['attributes']||null:null,'limit':_0x200e14['options']?_0x200e14[_0x9323('0x1a')]['limit']||null:null,'include':_0x200e14['options']?_0x200e14['options']['include']?_['map'](_0x200e14[_0x9323('0x1a')][_0x9323('0x1e')],function(_0x4944f9){return{'model':db[_0x4944f9[_0x9323('0x1f')]],'as':_0x4944f9['as'],'attributes':_0x4944f9['as']==='Contact'?_[_0x9323('0x32')](_0x100d13):_0x4944f9['attributes'],'include':_0x4944f9[_0x9323('0x1e')]?_[_0x9323('0x21')](_0x4944f9[_0x9323('0x1e')],function(_0x169ef5){return{'model':db[_0x169ef5[_0x9323('0x1f')]],'as':_0x169ef5['as'],'attributes':_0x169ef5[_0x9323('0x20')],'include':_0x169ef5['include']?_[_0x9323('0x21')](_0x169ef5[_0x9323('0x1e')],function(_0x54f1b5){return{'model':db[_0x54f1b5[_0x9323('0x1f')]],'as':_0x54f1b5['as'],'attributes':_0x54f1b5[_0x9323('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9323('0xc')](function(_0x1fc53f){logger[_0x9323('0xd')](_0x9323('0x17'),_0x200e14);logger[_0x9323('0x27')](_0x9323('0x17'),_0x200e14,JSON[_0x9323('0x11')](_0x1fc53f));_0x5aeb9e(_0x1fc53f);})['catch'](function(_0x50012a){logger[_0x9323('0x12')]('GetCmHopper',_0x50012a[_0x9323('0x14')],_0x200e14);_0x46e8fe(_0x1e7729[_0x9323('0x12')](0x1f4,_0x50012a[_0x9323('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 92d915f..5e529aa 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 _0x4e96=['/preview','getPreview','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','isAuthenticated','/opencontacts','getOpenContacts','/:id','create'];(function(_0x3946ff,_0x4beb00){var _0x4a9ccc=function(_0x2137f3){while(--_0x2137f3){_0x3946ff['push'](_0x3946ff['shift']());}};_0x4a9ccc(++_0x4beb00);}(_0x4e96,0x1bd));var _0x64e9=function(_0x5f0bbb,_0x4dad88){_0x5f0bbb=_0x5f0bbb-0x0;var _0x10fc52=_0x4e96[_0x5f0bbb];return _0x10fc52;};'use strict';var multer=require(_0x64e9('0x0'));var util=require(_0x64e9('0x1'));var path=require(_0x64e9('0x2'));var timeout=require(_0x64e9('0x3'));var express=require(_0x64e9('0x4'));var router=express[_0x64e9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x64e9('0x6'));var interaction=require(_0x64e9('0x7'));var config=require(_0x64e9('0x8'));var controller=require(_0x64e9('0x9'));router[_0x64e9('0xa')]('/',auth['isAuthenticated'](),controller[_0x64e9('0xb')]);router['get']('/describe',auth[_0x64e9('0xc')](),controller['describe']);router[_0x64e9('0xa')](_0x64e9('0xd'),auth[_0x64e9('0xc')](),controller[_0x64e9('0xe')]);router[_0x64e9('0xa')](_0x64e9('0xf'),auth[_0x64e9('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x64e9('0x10')]);router['post'](_0x64e9('0x11'),auth['isAuthenticated'](),controller[_0x64e9('0x12')]);router['put'](_0x64e9('0xf'),auth[_0x64e9('0xc')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x64e9('0x13')]);module[_0x64e9('0x14')]=router; \ No newline at end of file +var _0x18bc=['getOpenContacts','/:id','show','post','create','getPreview','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','describe'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x18bc,0x73));var _0xc18b=function(_0x5a47de,_0x57a87c){_0x5a47de=_0x5a47de-0x0;var _0x400ee6=_0x18bc[_0x5a47de];return _0x400ee6;};'use strict';var multer=require(_0xc18b('0x0'));var util=require(_0xc18b('0x1'));var path=require(_0xc18b('0x2'));var timeout=require(_0xc18b('0x3'));var express=require('express');var router=express[_0xc18b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc18b('0x5'));var config=require('../../config/environment');var controller=require(_0xc18b('0x6'));router[_0xc18b('0x7')]('/',auth[_0xc18b('0x8')](),controller[_0xc18b('0x9')]);router[_0xc18b('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xc18b('0xa')]);router[_0xc18b('0x7')]('/opencontacts',auth[_0xc18b('0x8')](),controller[_0xc18b('0xb')]);router[_0xc18b('0x7')](_0xc18b('0xc'),auth[_0xc18b('0x8')](),controller[_0xc18b('0xd')]);router[_0xc18b('0xe')]('/',auth[_0xc18b('0x8')](),controller[_0xc18b('0xf')]);router[_0xc18b('0xe')]('/preview',auth[_0xc18b('0x8')](),controller[_0xc18b('0x10')]);router[_0xc18b('0x11')](_0xc18b('0xc'),auth[_0xc18b('0x8')](),controller[_0xc18b('0x12')]);router['delete'](_0xc18b('0xc'),auth[_0xc18b('0x8')](),controller[_0xc18b('0x13')]);module[_0xc18b('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 4974bfd..09d1eb3 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 _0xf31b=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x4c77eb,_0x1d3625){var _0x4e9867=function(_0x55de2f){while(--_0x55de2f){_0x4c77eb['push'](_0x4c77eb['shift']());}};_0x4e9867(++_0x1d3625);}(_0xf31b,0x1a0));var _0xbf31=function(_0x50ebe3,_0x53fa41){_0x50ebe3=_0x50ebe3-0x0;var _0x5e7234=_0xf31b[_0x50ebe3];return _0x5e7234;};'use strict';var moment=require(_0xbf31('0x0'));var Sequelize=require(_0xbf31('0x1'));module[_0xbf31('0x2')]={'phone':{'type':Sequelize[_0xbf31('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xbf31('0x4')],'unique':_0xbf31('0x5')},'ListId':{'type':Sequelize[_0xbf31('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xbf31('0x4')],'unique':_0xbf31('0x5')}}; \ No newline at end of file +var _0x29e8=['contactListQueue','INTEGER','moment','sequelize','exports','STRING'];(function(_0x4caa97,_0x1dc557){var _0xc2dccc=function(_0x361dfd){while(--_0x361dfd){_0x4caa97['push'](_0x4caa97['shift']());}};_0xc2dccc(++_0x1dc557);}(_0x29e8,0x116));var _0x829e=function(_0x17276d,_0x4babf7){_0x17276d=_0x17276d-0x0;var _0x890f74=_0x29e8[_0x17276d];return _0x890f74;};'use strict';var moment=require(_0x829e('0x0'));var Sequelize=require(_0x829e('0x1'));module[_0x829e('0x2')]={'phone':{'type':Sequelize[_0x829e('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x829e('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x829e('0x4')},'VoiceQueueId':{'type':Sequelize[_0x829e('0x5')],'unique':_0x829e('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 4161d24..f9d8c52 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 _0xdc7b=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','then','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xdc7b,0x153));var _0xbdc7=function(_0x52c8f5,_0x101519){_0x52c8f5=_0x52c8f5-0x0;var _0x286824=_0xdc7b[_0x52c8f5];return _0x286824;};'use strict';var emlformat=require(_0xbdc7('0x0'));var rimraf=require(_0xbdc7('0x1'));var zipdir=require(_0xbdc7('0x2'));var jsonpatch=require(_0xbdc7('0x3'));var rp=require(_0xbdc7('0x4'));var moment=require(_0xbdc7('0x5'));var BPromise=require(_0xbdc7('0x6'));var Mustache=require('mustache');var util=require(_0xbdc7('0x7'));var path=require(_0xbdc7('0x8'));var sox=require(_0xbdc7('0x9'));var csv=require('to-csv');var ejs=require(_0xbdc7('0xa'));var fs=require('fs');var fs_extra=require(_0xbdc7('0xb'));var _=require(_0xbdc7('0xc'));var squel=require(_0xbdc7('0xd'));var crypto=require(_0xbdc7('0xe'));var jsforce=require(_0xbdc7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbdc7('0x10'));var querystring=require(_0xbdc7('0x11'));var Papa=require(_0xbdc7('0x12'));var Redis=require(_0xbdc7('0x13'));var authService=require(_0xbdc7('0x14'));var qs=require(_0xbdc7('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdc7('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xbdc7('0x17'));var config=require(_0xbdc7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdc7('0x19'))['db'];function respondWithStatusCode(_0x564745,_0x35c48b){_0x35c48b=_0x35c48b||0xcc;return function(_0x375900){if(_0x375900){return _0x564745[_0xbdc7('0x1a')](_0x35c48b);}return _0x564745[_0xbdc7('0x1b')](_0x35c48b)[_0xbdc7('0x1c')]();};}function respondWithResult(_0x18daec,_0x589967){_0x589967=_0x589967||0xc8;return function(_0x3045f3){if(_0x3045f3){return _0x18daec[_0xbdc7('0x1b')](_0x589967)[_0xbdc7('0x1d')](_0x3045f3);}};}function respondWithFilteredResult(_0x267145,_0x440282){return function(_0x35630a){if(_0x35630a){var _0x286a38=typeof _0x440282['offset']===_0xbdc7('0x1e')&&typeof _0x440282[_0xbdc7('0x1f')]===_0xbdc7('0x1e');var _0x4a1e1c=_0x35630a[_0xbdc7('0x20')];var _0x5677f9=_0x286a38?0x0:_0x440282[_0xbdc7('0x21')];var _0x5aa1bd=_0x286a38?_0x35630a['count']:_0x440282[_0xbdc7('0x21')]+_0x440282[_0xbdc7('0x1f')];var _0x55cfcc;if(_0x5aa1bd>=_0x4a1e1c){_0x5aa1bd=_0x4a1e1c;_0x55cfcc=0xc8;}else{_0x55cfcc=0xce;}_0x267145[_0xbdc7('0x1b')](_0x55cfcc);return _0x267145[_0xbdc7('0x22')]('Content-Range',_0x5677f9+'-'+_0x5aa1bd+'/'+_0x4a1e1c)['json'](_0x35630a);}return null;};}function patchUpdates(_0x56b9cc){return function(_0x554d54){try{jsonpatch['apply'](_0x554d54,_0x56b9cc,!![]);}catch(_0x322d28){return BPromise[_0xbdc7('0x23')](_0x322d28);}return _0x554d54[_0xbdc7('0x24')]();};}function saveUpdates(_0x4af89e,_0x5d6d2e){return function(_0x46640f){if(_0x46640f){return _0x46640f['update'](_0x4af89e)[_0xbdc7('0x25')](function(_0xa8d731){return _0xa8d731;});}return null;};}function removeEntity(_0x49d8e8,_0x224c4e){return function(_0x38d068){if(_0x38d068){return _0x38d068[_0xbdc7('0x26')]()[_0xbdc7('0x25')](function(){_0x49d8e8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44f825,_0x23f7af){return function(_0x13edaa){if(!_0x13edaa){_0x44f825[_0xbdc7('0x1a')](0x194);}return _0x13edaa;};}function handleError(_0x3105a1,_0x19d3cf){_0x19d3cf=_0x19d3cf||0x1f4;return function(_0x31046b){logger['error'](_0x31046b[_0xbdc7('0x27')]);if(_0x31046b[_0xbdc7('0x28')]){delete _0x31046b['name'];}_0x3105a1[_0xbdc7('0x1b')](_0x19d3cf)[_0xbdc7('0x29')](_0x31046b);};}exports[_0xbdc7('0x2a')]=function(_0x2435fc,_0xad09d8){var _0x313b3d={},_0x4704ed={},_0x33e745={'count':0x0,'rows':[]};var _0x279bda=_[_0xbdc7('0x2b')](db[_0xbdc7('0x2c')][_0xbdc7('0x2d')],function(_0x52e8b2){return{'name':_0x52e8b2['fieldName'],'type':_0x52e8b2['type'][_0xbdc7('0x2e')]};});_0x4704ed[_0xbdc7('0x2f')]=_[_0xbdc7('0x2b')](_0x279bda,'name');_0x4704ed[_0xbdc7('0x30')]=_['keys'](_0x2435fc[_0xbdc7('0x30')]);_0x4704ed[_0xbdc7('0x31')]=_[_0xbdc7('0x32')](_0x4704ed['model'],_0x4704ed[_0xbdc7('0x30')]);_0x313b3d[_0xbdc7('0x33')]=_[_0xbdc7('0x32')](_0x4704ed[_0xbdc7('0x2f')],qs['fields'](_0x2435fc[_0xbdc7('0x30')][_0xbdc7('0x34')]));_0x313b3d[_0xbdc7('0x33')]=_0x313b3d[_0xbdc7('0x33')][_0xbdc7('0x35')]?_0x313b3d[_0xbdc7('0x33')]:_0x4704ed[_0xbdc7('0x2f')];if(!_0x2435fc[_0xbdc7('0x30')][_0xbdc7('0x36')](_0xbdc7('0x37'))){_0x313b3d[_0xbdc7('0x1f')]=qs[_0xbdc7('0x1f')](_0x2435fc[_0xbdc7('0x30')]['limit']);_0x313b3d['offset']=qs[_0xbdc7('0x21')](_0x2435fc[_0xbdc7('0x30')]['offset']);}_0x313b3d[_0xbdc7('0x38')]=qs[_0xbdc7('0x39')](_0x2435fc['query'][_0xbdc7('0x39')]);_0x313b3d[_0xbdc7('0x3a')]=qs[_0xbdc7('0x31')](_[_0xbdc7('0x3b')](_0x2435fc[_0xbdc7('0x30')],_0x4704ed['filters']),_0x279bda);if(_0x2435fc[_0xbdc7('0x30')][_0xbdc7('0x3c')]){_0x313b3d[_0xbdc7('0x3a')]=_[_0xbdc7('0x3d')](_0x313b3d[_0xbdc7('0x3a')],{'$or':_[_0xbdc7('0x2b')](_0x279bda,function(_0x5346ed){if(_0x5346ed[_0xbdc7('0x3e')]!==_0xbdc7('0x3f')){var _0x4a8d82={};_0x4a8d82[_0x5346ed[_0xbdc7('0x28')]]={'$like':'%'+_0x2435fc[_0xbdc7('0x30')][_0xbdc7('0x3c')]+'%'};return _0x4a8d82;}})});}_0x313b3d=_[_0xbdc7('0x3d')]({},_0x313b3d,_0x2435fc[_0xbdc7('0x40')]);var _0x5f1e39={'where':_0x313b3d[_0xbdc7('0x3a')]};return db[_0xbdc7('0x2c')][_0xbdc7('0x20')](_0x5f1e39)[_0xbdc7('0x25')](function(_0x5a427b){_0x33e745[_0xbdc7('0x20')]=_0x5a427b;if(_0x2435fc[_0xbdc7('0x30')][_0xbdc7('0x41')]){_0x313b3d[_0xbdc7('0x42')]=[{'all':!![]}];}return db[_0xbdc7('0x2c')][_0xbdc7('0x43')](_0x313b3d);})[_0xbdc7('0x25')](function(_0x3b401a){_0x33e745[_0xbdc7('0x44')]=_0x3b401a;return _0x33e745;})[_0xbdc7('0x25')](respondWithFilteredResult(_0xad09d8,_0x313b3d))[_0xbdc7('0x45')](handleError(_0xad09d8,null));};exports[_0xbdc7('0x46')]=function(_0x10616e,_0x4d424e){var _0xc0c8b9={'raw':!![],'where':{'id':_0x10616e[_0xbdc7('0x47')]['id']}},_0xfc6a6f={};_0xfc6a6f['model']=_[_0xbdc7('0x48')](db[_0xbdc7('0x2c')][_0xbdc7('0x2d')]);_0xfc6a6f['query']=_[_0xbdc7('0x48')](_0x10616e[_0xbdc7('0x30')]);_0xfc6a6f['filters']=_['intersection'](_0xfc6a6f[_0xbdc7('0x2f')],_0xfc6a6f['query']);_0xc0c8b9[_0xbdc7('0x33')]=_[_0xbdc7('0x32')](_0xfc6a6f[_0xbdc7('0x2f')],qs[_0xbdc7('0x34')](_0x10616e[_0xbdc7('0x30')]['fields']));_0xc0c8b9[_0xbdc7('0x33')]=_0xc0c8b9[_0xbdc7('0x33')][_0xbdc7('0x35')]?_0xc0c8b9[_0xbdc7('0x33')]:_0xfc6a6f[_0xbdc7('0x2f')];if(_0x10616e['query']['includeAll']){_0xc0c8b9[_0xbdc7('0x42')]=[{'all':!![]}];}_0xc0c8b9=_[_0xbdc7('0x3d')]({},_0xc0c8b9,_0x10616e['options']);return db['CmHopperBlack'][_0xbdc7('0x49')](_0xc0c8b9)[_0xbdc7('0x25')](handleEntityNotFound(_0x4d424e,null))[_0xbdc7('0x25')](respondWithResult(_0x4d424e,null))[_0xbdc7('0x45')](handleError(_0x4d424e,null));};exports[_0xbdc7('0x4a')]=function(_0x53234d,_0x169ae7){if(_0x53234d[_0xbdc7('0x4b')]['id']){delete _0x53234d[_0xbdc7('0x4b')]['id'];}return db[_0xbdc7('0x2c')]['find']({'where':{'id':_0x53234d['params']['id']}})['then'](handleEntityNotFound(_0x169ae7,null))[_0xbdc7('0x25')](saveUpdates(_0x53234d[_0xbdc7('0x4b')],null))[_0xbdc7('0x25')](respondWithResult(_0x169ae7,null))[_0xbdc7('0x45')](handleError(_0x169ae7,null));};exports[_0xbdc7('0x26')]=function(_0x2573f3,_0x4694f5){return db[_0xbdc7('0x2c')][_0xbdc7('0x49')]({'where':{'id':_0x2573f3[_0xbdc7('0x47')]['id']}})[_0xbdc7('0x25')](handleEntityNotFound(_0x4694f5,null))[_0xbdc7('0x25')](removeEntity(_0x4694f5,null))[_0xbdc7('0x45')](handleError(_0x4694f5,null));};exports[_0xbdc7('0x4c')]=function(_0xa4c9f8,_0x18ebda){return db[_0xbdc7('0x2c')]['describe']()[_0xbdc7('0x25')](respondWithResult(_0x18ebda,null))['catch'](handleError(_0x18ebda,null));}; \ No newline at end of file +var _0xbad5=['hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','CmHopperBlack','rows','catch','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0x21a221,_0x7a9f65){var _0x4d3dd8=function(_0x2b0ca5){while(--_0x2b0ca5){_0x21a221['push'](_0x21a221['shift']());}};_0x4d3dd8(++_0x7a9f65);}(_0xbad5,0x1bc));var _0x5bad=function(_0x386376,_0x210813){_0x386376=_0x386376-0x0;var _0x35f757=_0xbad5[_0x386376];return _0x35f757;};'use strict';var emlformat=require(_0x5bad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bad('0x1'));var jsonpatch=require(_0x5bad('0x2'));var rp=require(_0x5bad('0x3'));var moment=require(_0x5bad('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bad('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bad('0x6'));var _=require(_0x5bad('0x7'));var squel=require(_0x5bad('0x8'));var crypto=require(_0x5bad('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5bad('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5bad('0xb'));var Papa=require(_0x5bad('0xc'));var Redis=require(_0x5bad('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bad('0xe'));var logger=require(_0x5bad('0xf'))(_0x5bad('0x10'));var utils=require(_0x5bad('0x11'));var config=require(_0x5bad('0x12'));var licenseUtil=require(_0x5bad('0x13'));var db=require(_0x5bad('0x14'))['db'];function respondWithStatusCode(_0x552f24,_0x4e253b){_0x4e253b=_0x4e253b||0xcc;return function(_0x158467){if(_0x158467){return _0x552f24[_0x5bad('0x15')](_0x4e253b);}return _0x552f24[_0x5bad('0x16')](_0x4e253b)[_0x5bad('0x17')]();};}function respondWithResult(_0x16aa5f,_0x824432){_0x824432=_0x824432||0xc8;return function(_0x341d9e){if(_0x341d9e){return _0x16aa5f[_0x5bad('0x16')](_0x824432)[_0x5bad('0x18')](_0x341d9e);}};}function respondWithFilteredResult(_0x5a9cc2,_0x12bb8e){return function(_0x5f12a9){if(_0x5f12a9){var _0x153ba6=typeof _0x12bb8e[_0x5bad('0x19')]===_0x5bad('0x1a')&&typeof _0x12bb8e[_0x5bad('0x1b')]==='undefined';var _0x63e464=_0x5f12a9[_0x5bad('0x1c')];var _0x596a3d=_0x153ba6?0x0:_0x12bb8e['offset'];var _0xf004ef=_0x153ba6?_0x5f12a9[_0x5bad('0x1c')]:_0x12bb8e[_0x5bad('0x19')]+_0x12bb8e['limit'];var _0xd58d3c;if(_0xf004ef>=_0x63e464){_0xf004ef=_0x63e464;_0xd58d3c=0xc8;}else{_0xd58d3c=0xce;}_0x5a9cc2[_0x5bad('0x16')](_0xd58d3c);return _0x5a9cc2[_0x5bad('0x1d')](_0x5bad('0x1e'),_0x596a3d+'-'+_0xf004ef+'/'+_0x63e464)[_0x5bad('0x18')](_0x5f12a9);}return null;};}function patchUpdates(_0x4ada85){return function(_0x43b71f){try{jsonpatch['apply'](_0x43b71f,_0x4ada85,!![]);}catch(_0xbc9072){return BPromise[_0x5bad('0x1f')](_0xbc9072);}return _0x43b71f[_0x5bad('0x20')]();};}function saveUpdates(_0x5920ca,_0x798582){return function(_0x25184e){if(_0x25184e){return _0x25184e[_0x5bad('0x21')](_0x5920ca)[_0x5bad('0x22')](function(_0x499edb){return _0x499edb;});}return null;};}function removeEntity(_0x4d1f6f,_0x22b437){return function(_0x56f582){if(_0x56f582){return _0x56f582[_0x5bad('0x23')]()[_0x5bad('0x22')](function(){_0x4d1f6f['status'](0xcc)[_0x5bad('0x17')]();});}};}function handleEntityNotFound(_0x168787,_0x1f70d1){return function(_0x16dc8a){if(!_0x16dc8a){_0x168787[_0x5bad('0x15')](0x194);}return _0x16dc8a;};}function handleError(_0x1cd7e7,_0x247eca){_0x247eca=_0x247eca||0x1f4;return function(_0x576d4f){logger[_0x5bad('0x24')](_0x576d4f['stack']);if(_0x576d4f[_0x5bad('0x25')]){delete _0x576d4f[_0x5bad('0x25')];}_0x1cd7e7['status'](_0x247eca)[_0x5bad('0x26')](_0x576d4f);};}exports[_0x5bad('0x27')]=function(_0x20e5db,_0x8aad4a){var _0x3f5786={},_0x5ac58b={},_0x37aa59={'count':0x0,'rows':[]};var _0x481caf=_[_0x5bad('0x28')](db['CmHopperBlack'][_0x5bad('0x29')],function(_0x2d40db){return{'name':_0x2d40db[_0x5bad('0x2a')],'type':_0x2d40db[_0x5bad('0x2b')][_0x5bad('0x2c')]};});_0x5ac58b[_0x5bad('0x2d')]=_['map'](_0x481caf,_0x5bad('0x25'));_0x5ac58b[_0x5bad('0x2e')]=_[_0x5bad('0x2f')](_0x20e5db[_0x5bad('0x2e')]);_0x5ac58b[_0x5bad('0x30')]=_['intersection'](_0x5ac58b[_0x5bad('0x2d')],_0x5ac58b[_0x5bad('0x2e')]);_0x3f5786[_0x5bad('0x31')]=_[_0x5bad('0x32')](_0x5ac58b[_0x5bad('0x2d')],qs[_0x5bad('0x33')](_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x33')]));_0x3f5786[_0x5bad('0x31')]=_0x3f5786[_0x5bad('0x31')][_0x5bad('0x34')]?_0x3f5786[_0x5bad('0x31')]:_0x5ac58b['model'];if(!_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x35')]('nolimit')){_0x3f5786[_0x5bad('0x1b')]=qs['limit'](_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x1b')]);_0x3f5786[_0x5bad('0x19')]=qs['offset'](_0x20e5db[_0x5bad('0x2e')]['offset']);}_0x3f5786[_0x5bad('0x36')]=qs['sort'](_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x37')]);_0x3f5786[_0x5bad('0x38')]=qs[_0x5bad('0x30')](_[_0x5bad('0x39')](_0x20e5db[_0x5bad('0x2e')],_0x5ac58b[_0x5bad('0x30')]),_0x481caf);if(_0x20e5db[_0x5bad('0x2e')]['filter']){_0x3f5786[_0x5bad('0x38')]=_[_0x5bad('0x3a')](_0x3f5786[_0x5bad('0x38')],{'$or':_[_0x5bad('0x28')](_0x481caf,function(_0x413ba3){if(_0x413ba3[_0x5bad('0x2b')]!==_0x5bad('0x3b')){var _0x1d0b84={};_0x1d0b84[_0x413ba3['name']]={'$like':'%'+_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x3c')]+'%'};return _0x1d0b84;}})});}_0x3f5786=_['merge']({},_0x3f5786,_0x20e5db[_0x5bad('0x3d')]);var _0x387ed1={'where':_0x3f5786[_0x5bad('0x38')]};return db['CmHopperBlack'][_0x5bad('0x1c')](_0x387ed1)[_0x5bad('0x22')](function(_0x5492e1){_0x37aa59['count']=_0x5492e1;if(_0x20e5db[_0x5bad('0x2e')][_0x5bad('0x3e')]){_0x3f5786[_0x5bad('0x3f')]=[{'all':!![]}];}return db[_0x5bad('0x40')]['findAll'](_0x3f5786);})[_0x5bad('0x22')](function(_0x7868d){_0x37aa59[_0x5bad('0x41')]=_0x7868d;return _0x37aa59;})[_0x5bad('0x22')](respondWithFilteredResult(_0x8aad4a,_0x3f5786))[_0x5bad('0x42')](handleError(_0x8aad4a,null));};exports['show']=function(_0x1f737f,_0x397fca){var _0x5b39af={'raw':!![],'where':{'id':_0x1f737f['params']['id']}},_0x1d231c={};_0x1d231c[_0x5bad('0x2d')]=_[_0x5bad('0x2f')](db[_0x5bad('0x40')][_0x5bad('0x29')]);_0x1d231c[_0x5bad('0x2e')]=_[_0x5bad('0x2f')](_0x1f737f[_0x5bad('0x2e')]);_0x1d231c[_0x5bad('0x30')]=_['intersection'](_0x1d231c['model'],_0x1d231c[_0x5bad('0x2e')]);_0x5b39af[_0x5bad('0x31')]=_[_0x5bad('0x32')](_0x1d231c['model'],qs[_0x5bad('0x33')](_0x1f737f['query']['fields']));_0x5b39af['attributes']=_0x5b39af[_0x5bad('0x31')][_0x5bad('0x34')]?_0x5b39af[_0x5bad('0x31')]:_0x1d231c[_0x5bad('0x2d')];if(_0x1f737f['query']['includeAll']){_0x5b39af[_0x5bad('0x3f')]=[{'all':!![]}];}_0x5b39af=_[_0x5bad('0x3a')]({},_0x5b39af,_0x1f737f['options']);return db[_0x5bad('0x40')][_0x5bad('0x43')](_0x5b39af)[_0x5bad('0x22')](handleEntityNotFound(_0x397fca,null))[_0x5bad('0x22')](respondWithResult(_0x397fca,null))[_0x5bad('0x42')](handleError(_0x397fca,null));};exports[_0x5bad('0x21')]=function(_0x380366,_0x93df25){if(_0x380366[_0x5bad('0x44')]['id']){delete _0x380366[_0x5bad('0x44')]['id'];}return db[_0x5bad('0x40')]['find']({'where':{'id':_0x380366[_0x5bad('0x45')]['id']}})[_0x5bad('0x22')](handleEntityNotFound(_0x93df25,null))[_0x5bad('0x22')](saveUpdates(_0x380366[_0x5bad('0x44')],null))['then'](respondWithResult(_0x93df25,null))[_0x5bad('0x42')](handleError(_0x93df25,null));};exports[_0x5bad('0x23')]=function(_0x21bc35,_0x3bd8f0){return db['CmHopperBlack'][_0x5bad('0x43')]({'where':{'id':_0x21bc35[_0x5bad('0x45')]['id']}})[_0x5bad('0x22')](handleEntityNotFound(_0x3bd8f0,null))[_0x5bad('0x22')](removeEntity(_0x3bd8f0,null))[_0x5bad('0x42')](handleError(_0x3bd8f0,null));};exports[_0x5bad('0x46')]=function(_0x562620,_0x5d9dfb){return db[_0x5bad('0x40')][_0x5bad('0x46')]()[_0x5bad('0x22')](respondWithResult(_0x5d9dfb,null))[_0x5bad('0x42')](handleError(_0x5d9dfb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 7763f99..02f1ffe 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 _0x1808=['exports','define','cm_hopper_black','lodash','util','moment','bluebird','../../config/environment','./cmHopperBlack.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1808,0x150));var _0x8180=function(_0x130b30,_0x3d45b6){_0x130b30=_0x130b30-0x0;var _0x1b9f34=_0x1808[_0x130b30];return _0x1b9f34;};'use strict';var _=require(_0x8180('0x0'));var util=require(_0x8180('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8180('0x2'));var BPromise=require(_0x8180('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8180('0x4'));var attributes=require(_0x8180('0x5'));module[_0x8180('0x6')]=function(_0x1dc289,_0x4d4d57){return _0x1dc289[_0x8180('0x7')]('CmHopperBlack',attributes,{'tableName':_0x8180('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca81=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird','path','./cmHopperBlack.attributes'];(function(_0x3d5e72,_0x3ab167){var _0x2230e4=function(_0x4ede86){while(--_0x4ede86){_0x3d5e72['push'](_0x3d5e72['shift']());}};_0x2230e4(++_0x3ab167);}(_0xca81,0x12d));var _0x1ca8=function(_0x16ba74,_0x2ebcfa){_0x16ba74=_0x16ba74-0x0;var _0x4333a6=_0xca81[_0x16ba74];return _0x4333a6;};'use strict';var _=require(_0x1ca8('0x0'));var util=require(_0x1ca8('0x1'));var logger=require(_0x1ca8('0x2'))('api');var moment=require(_0x1ca8('0x3'));var BPromise=require(_0x1ca8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ca8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ca8('0x6'));module[_0x1ca8('0x7')]=function(_0x25e586,_0x2612f9){return _0x25e586[_0x1ca8('0x8')](_0x1ca8('0x9'),attributes,{'tableName':_0x1ca8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 17206f8..31a682e 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 _0xf987=['error','code','message','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','debug','DestroyCmHopperBlack','destroy','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x23b746,_0x26147b){var _0x20e630=function(_0x4958f3){while(--_0x4958f3){_0x23b746['push'](_0x23b746['shift']());}};_0x20e630(++_0x26147b);}(_0xf987,0x82));var _0x7f98=function(_0x549846,_0x280161){_0x549846=_0x549846-0x0;var _0x381a18=_0xf987[_0x549846];return _0x381a18;};'use strict';var _=require(_0x7f98('0x0'));var util=require(_0x7f98('0x1'));var moment=require('moment');var BPromise=require(_0x7f98('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f98('0x3'))(_0x7f98('0x4'));var config=require(_0x7f98('0x5'));var jayson=require(_0x7f98('0x6'));var client=jayson[_0x7f98('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a02b2,_0x4668b5,_0x19d10c){return new BPromise(function(_0x4a1afc,_0x51f3ec){return client[_0x7f98('0x8')](_0x2a02b2,_0x19d10c)[_0x7f98('0x9')](function(_0x3c5bac){logger[_0x7f98('0xa')](_0x7f98('0xb'),_0x4668b5,'request\x20sent');logger['debug'](_0x7f98('0xc'),_0x4668b5,'request\x20sent',JSON[_0x7f98('0xd')](_0x3c5bac));if(_0x3c5bac[_0x7f98('0xe')]){if(_0x3c5bac['error'][_0x7f98('0xf')]===0x1f4){logger['error'](_0x7f98('0xb'),_0x4668b5,_0x3c5bac[_0x7f98('0xe')][_0x7f98('0x10')]);return _0x51f3ec(_0x3c5bac[_0x7f98('0xe')][_0x7f98('0x10')]);}logger[_0x7f98('0xe')](_0x7f98('0xb'),_0x4668b5,_0x3c5bac[_0x7f98('0xe')][_0x7f98('0x10')]);return _0x4a1afc(_0x3c5bac['error']['message']);}else{logger[_0x7f98('0xa')](_0x7f98('0xb'),_0x4668b5,_0x7f98('0x11'));_0x4a1afc(_0x3c5bac[_0x7f98('0x12')][_0x7f98('0x10')]);}})[_0x7f98('0x13')](function(_0x5b4018){logger[_0x7f98('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x4668b5,_0x5b4018);_0x51f3ec(_0x5b4018);});});}exports[_0x7f98('0x14')]=function(_0x875e41){var _0x2ee5ad=this;return new Promise(function(_0x24d2b0,_0x122819){return db[_0x7f98('0x15')][_0x7f98('0x16')]({'raw':_0x875e41[_0x7f98('0x17')]?_0x875e41[_0x7f98('0x17')][_0x7f98('0x18')]===undefined?!![]:![]:!![],'where':_0x875e41[_0x7f98('0x17')]?_0x875e41['options'][_0x7f98('0x19')]||null:null,'attributes':_0x875e41['options']?_0x875e41[_0x7f98('0x17')][_0x7f98('0x1a')]||null:null,'limit':_0x875e41[_0x7f98('0x17')]?_0x875e41[_0x7f98('0x17')][_0x7f98('0x1b')]||null:null,'include':_0x875e41[_0x7f98('0x17')]?_0x875e41[_0x7f98('0x17')][_0x7f98('0x1c')]?_[_0x7f98('0x1d')](_0x875e41['options'][_0x7f98('0x1c')],function(_0x5f3aa3){return{'model':db[_0x5f3aa3[_0x7f98('0x1e')]],'as':_0x5f3aa3['as'],'attributes':_0x5f3aa3['attributes'],'include':_0x5f3aa3[_0x7f98('0x1c')]?_['map'](_0x5f3aa3[_0x7f98('0x1c')],function(_0x151ee1){return{'model':db[_0x151ee1['model']],'as':_0x151ee1['as'],'attributes':_0x151ee1[_0x7f98('0x1a')],'include':_0x151ee1[_0x7f98('0x1c')]?_[_0x7f98('0x1d')](_0x151ee1[_0x7f98('0x1c')],function(_0x5d77b7){return{'model':db[_0x5d77b7[_0x7f98('0x1e')]],'as':_0x5d77b7['as'],'attributes':_0x5d77b7['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f98('0x9')](function(_0x29466e){logger[_0x7f98('0xa')]('GetCmHopperBlack',_0x875e41);logger['debug'](_0x7f98('0x14'),_0x875e41,JSON[_0x7f98('0xd')](_0x29466e));_0x24d2b0(_0x29466e);})[_0x7f98('0x13')](function(_0x3ef2b8){logger[_0x7f98('0xe')]('GetCmHopperBlack',_0x3ef2b8['message'],_0x875e41);_0x122819(_0x2ee5ad['error'](0x1f4,_0x3ef2b8[_0x7f98('0x10')]));});});};exports[_0x7f98('0x1f')]=function(_0x610de){var _0x4863a9=this;return new Promise(function(_0x148ae3,_0x1c94f4){return db[_0x7f98('0x15')]['update'](_0x610de[_0x7f98('0x20')],{'raw':_0x610de[_0x7f98('0x17')]?_0x610de[_0x7f98('0x17')][_0x7f98('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x610de[_0x7f98('0x17')]?_0x610de[_0x7f98('0x17')][_0x7f98('0x19')]||null:null,'attributes':_0x610de[_0x7f98('0x17')]?_0x610de[_0x7f98('0x17')][_0x7f98('0x1a')]||null:null,'limit':_0x610de[_0x7f98('0x17')]?_0x610de[_0x7f98('0x17')][_0x7f98('0x1b')]||null:null})['then'](function(_0x53c6dd){logger['info'](_0x7f98('0x1f'),_0x610de);logger[_0x7f98('0x21')](_0x7f98('0x1f'),_0x610de,JSON['stringify'](_0x53c6dd));_0x148ae3(_0x53c6dd);})['catch'](function(_0x2c24b4){logger[_0x7f98('0xe')](_0x7f98('0x1f'),_0x2c24b4[_0x7f98('0x10')],_0x610de);_0x1c94f4(_0x4863a9[_0x7f98('0xe')](0x1f4,_0x2c24b4[_0x7f98('0x10')]));});});};exports[_0x7f98('0x22')]=function(_0xa9f5ff){var _0x1e92ac=this;return new Promise(function(_0x54b10e,_0x494f35){return db[_0x7f98('0x15')][_0x7f98('0x23')]({'where':_0xa9f5ff[_0x7f98('0x17')]?_0xa9f5ff[_0x7f98('0x17')]['where']||null:null})[_0x7f98('0x9')](function(_0x1b1c95){logger['info'](_0x7f98('0x22'),_0xa9f5ff);logger['debug']('DestroyCmHopperBlack',_0xa9f5ff,JSON[_0x7f98('0xd')](_0x1b1c95));_0x54b10e(_0x1b1c95);})['catch'](function(_0x35f0e1){logger['error']('DestroyCmHopperBlack',_0x35f0e1[_0x7f98('0x10')],_0xa9f5ff);_0x494f35(_0x1e92ac['error'](0x1f4,_0x35f0e1[_0x7f98('0x10')]));});});}; \ No newline at end of file +var _0x31ca=['http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','findAll','options','raw','attributes','limit','include','map','model','GetCmHopperBlack','debug','UpdateCmHopperBlack','CmHopperBlack','body','where','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x31ca,0x85));var _0xa31c=function(_0x214fab,_0x52a54e){_0x214fab=_0x214fab-0x0;var _0x825ae7=_0x31ca[_0x214fab];return _0x825ae7;};'use strict';var _=require(_0xa31c('0x0'));var util=require(_0xa31c('0x1'));var moment=require(_0xa31c('0x2'));var BPromise=require(_0xa31c('0x3'));var rs=require(_0xa31c('0x4'));var fs=require('fs');var Redis=require(_0xa31c('0x5'));var db=require(_0xa31c('0x6'))['db'];var utils=require(_0xa31c('0x7'));var logger=require(_0xa31c('0x8'))('rpc');var config=require(_0xa31c('0x9'));var jayson=require(_0xa31c('0xa'));var client=jayson['client'][_0xa31c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29cd9a,_0x4573f8,_0x37a40b){return new BPromise(function(_0x3c22fd,_0x22d71d){return client[_0xa31c('0xc')](_0x29cd9a,_0x37a40b)[_0xa31c('0xd')](function(_0x4965ab){logger['info'](_0xa31c('0xe'),_0x4573f8,_0xa31c('0xf'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x4573f8,_0xa31c('0xf'),JSON[_0xa31c('0x10')](_0x4965ab));if(_0x4965ab[_0xa31c('0x11')]){if(_0x4965ab[_0xa31c('0x11')]['code']===0x1f4){logger[_0xa31c('0x11')](_0xa31c('0xe'),_0x4573f8,_0x4965ab[_0xa31c('0x11')]['message']);return _0x22d71d(_0x4965ab[_0xa31c('0x11')][_0xa31c('0x12')]);}logger[_0xa31c('0x11')](_0xa31c('0xe'),_0x4573f8,_0x4965ab['error'][_0xa31c('0x12')]);return _0x3c22fd(_0x4965ab[_0xa31c('0x11')][_0xa31c('0x12')]);}else{logger[_0xa31c('0x13')](_0xa31c('0xe'),_0x4573f8,_0xa31c('0xf'));_0x3c22fd(_0x4965ab['result']['message']);}})[_0xa31c('0x14')](function(_0x4aac7e){logger[_0xa31c('0x11')](_0xa31c('0xe'),_0x4573f8,_0x4aac7e);_0x22d71d(_0x4aac7e);});});}exports['GetCmHopperBlack']=function(_0x135684){var _0x58bb2f=this;return new Promise(function(_0x17a492,_0x5838b9){return db['CmHopperBlack'][_0xa31c('0x15')]({'raw':_0x135684[_0xa31c('0x16')]?_0x135684[_0xa31c('0x16')][_0xa31c('0x17')]===undefined?!![]:![]:!![],'where':_0x135684[_0xa31c('0x16')]?_0x135684[_0xa31c('0x16')]['where']||null:null,'attributes':_0x135684['options']?_0x135684[_0xa31c('0x16')][_0xa31c('0x18')]||null:null,'limit':_0x135684['options']?_0x135684[_0xa31c('0x16')][_0xa31c('0x19')]||null:null,'include':_0x135684[_0xa31c('0x16')]?_0x135684[_0xa31c('0x16')][_0xa31c('0x1a')]?_[_0xa31c('0x1b')](_0x135684[_0xa31c('0x16')][_0xa31c('0x1a')],function(_0x3d61c8){return{'model':db[_0x3d61c8[_0xa31c('0x1c')]],'as':_0x3d61c8['as'],'attributes':_0x3d61c8['attributes'],'include':_0x3d61c8[_0xa31c('0x1a')]?_[_0xa31c('0x1b')](_0x3d61c8[_0xa31c('0x1a')],function(_0x1e9743){return{'model':db[_0x1e9743[_0xa31c('0x1c')]],'as':_0x1e9743['as'],'attributes':_0x1e9743['attributes'],'include':_0x1e9743[_0xa31c('0x1a')]?_[_0xa31c('0x1b')](_0x1e9743[_0xa31c('0x1a')],function(_0x294534){return{'model':db[_0x294534[_0xa31c('0x1c')]],'as':_0x294534['as'],'attributes':_0x294534[_0xa31c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2be97f){logger[_0xa31c('0x13')](_0xa31c('0x1d'),_0x135684);logger[_0xa31c('0x1e')]('GetCmHopperBlack',_0x135684,JSON[_0xa31c('0x10')](_0x2be97f));_0x17a492(_0x2be97f);})['catch'](function(_0x1fce4b){logger['error'](_0xa31c('0x1d'),_0x1fce4b[_0xa31c('0x12')],_0x135684);_0x5838b9(_0x58bb2f[_0xa31c('0x11')](0x1f4,_0x1fce4b[_0xa31c('0x12')]));});});};exports[_0xa31c('0x1f')]=function(_0x8e20d6){var _0x27f04e=this;return new Promise(function(_0x1a7161,_0x12dd7e){return db[_0xa31c('0x20')]['update'](_0x8e20d6[_0xa31c('0x21')],{'raw':_0x8e20d6[_0xa31c('0x16')]?_0x8e20d6[_0xa31c('0x16')][_0xa31c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8e20d6['options']?_0x8e20d6[_0xa31c('0x16')][_0xa31c('0x22')]||null:null,'attributes':_0x8e20d6[_0xa31c('0x16')]?_0x8e20d6[_0xa31c('0x16')][_0xa31c('0x18')]||null:null,'limit':_0x8e20d6[_0xa31c('0x16')]?_0x8e20d6[_0xa31c('0x16')][_0xa31c('0x19')]||null:null})['then'](function(_0x28d60a){logger[_0xa31c('0x13')](_0xa31c('0x1f'),_0x8e20d6);logger[_0xa31c('0x1e')](_0xa31c('0x1f'),_0x8e20d6,JSON[_0xa31c('0x10')](_0x28d60a));_0x1a7161(_0x28d60a);})['catch'](function(_0x2c5e92){logger[_0xa31c('0x11')](_0xa31c('0x1f'),_0x2c5e92[_0xa31c('0x12')],_0x8e20d6);_0x12dd7e(_0x27f04e[_0xa31c('0x11')](0x1f4,_0x2c5e92['message']));});});};exports[_0xa31c('0x23')]=function(_0x1db7ea){var _0x2bdd53=this;return new Promise(function(_0x464f7f,_0x4e93ed){return db[_0xa31c('0x20')]['destroy']({'where':_0x1db7ea[_0xa31c('0x16')]?_0x1db7ea[_0xa31c('0x16')][_0xa31c('0x22')]||null:null})[_0xa31c('0xd')](function(_0x58b0b0){logger[_0xa31c('0x13')](_0xa31c('0x23'),_0x1db7ea);logger['debug'](_0xa31c('0x23'),_0x1db7ea,JSON['stringify'](_0x58b0b0));_0x464f7f(_0x58b0b0);})[_0xa31c('0x14')](function(_0x60a4e3){logger[_0xa31c('0x11')]('DestroyCmHopperBlack',_0x60a4e3['message'],_0x1db7ea);_0x4e93ed(_0x2bdd53[_0xa31c('0x11')](0x1f4,_0x60a4e3[_0xa31c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 05d23d3..2add445 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 _0xc7a3=['delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x4c1f48,_0xa9a87a){_0x4c1f48=_0x4c1f48-0x0;var _0x39e7a6=_0xc7a3[_0x4c1f48];return _0x39e7a6;};'use strict';var multer=require('multer');var util=require(_0x3c7a('0x0'));var path=require(_0x3c7a('0x1'));var timeout=require(_0x3c7a('0x2'));var express=require(_0x3c7a('0x3'));var router=express[_0x3c7a('0x4')]();var fs_extra=require(_0x3c7a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3c7a('0x6'));var config=require(_0x3c7a('0x7'));var controller=require('./cmHopperBlack.controller');router[_0x3c7a('0x8')]('/',auth[_0x3c7a('0x9')](),controller[_0x3c7a('0xa')]);router['get'](_0x3c7a('0xb'),auth['isAuthenticated'](),controller[_0x3c7a('0xc')]);router['get'](_0x3c7a('0xd'),auth[_0x3c7a('0x9')](),controller[_0x3c7a('0xe')]);router['put'](_0x3c7a('0xd'),auth[_0x3c7a('0x9')](),controller['update']);router[_0x3c7a('0xf')]('/:id',auth[_0x3c7a('0x9')](),controller['destroy']);module[_0x3c7a('0x10')]=router; \ No newline at end of file +var _0x7b84=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x7b84,0x17c));var _0x47b8=function(_0x402204,_0x2a26b6){_0x402204=_0x402204-0x0;var _0x24148f=_0x7b84[_0x402204];return _0x24148f;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0x11')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x13')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);module[_0x47b8('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 15911c7..9d3d926 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 _0xef56=['sequelize','moment','exports','INTEGER','STRING','DATE','endtime','diff','seconds','setDataValue','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef56,0x113));var _0x6ef5=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xef56[_0x18cd5b];return _0x5eaa52;};'use strict';var Sequelize=require(_0x6ef5('0x0'));var moment=require(_0x6ef5('0x1'));module[_0x6ef5('0x2')]={'state':{'type':Sequelize[_0x6ef5('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6ef5('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x6ef5('0x4')]},'originatecalleridname':{'type':Sequelize[_0x6ef5('0x4')]},'calleridnum':{'type':Sequelize[_0x6ef5('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6ef5('0x5')]},'responsetime':{'type':Sequelize[_0x6ef5('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6ef5('0x5')]},'endtime':{'type':Sequelize[_0x6ef5('0x5')]},'ringtime':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6ef5('0x4')]},'campaign':{'type':Sequelize[_0x6ef5('0x4')]},'campaigntype':{'type':Sequelize[_0x6ef5('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6ef5('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6ef5('0x4')]},'dispositionat':{'type':Sequelize[_0x6ef5('0x5')],'set':function(_0x1d901e){var _0x326e83=this['getDataValue'](_0x6ef5('0x6'));if(_0x326e83&&_0x1d901e){this['setDataValue']('followuptime',moment(_0x1d901e)[_0x6ef5('0x7')](moment(_0x326e83),_0x6ef5('0x8')));}return this[_0x6ef5('0x9')]('dispositionat',_0x1d901e);}},'amd':{'type':Sequelize[_0x6ef5('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6ef5('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6ef5('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6ef5('0x5')]},'callback':{'type':Sequelize[_0x6ef5('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6ef5('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6ef5('0x5')]},'deleted':{'type':Sequelize[_0x6ef5('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6ef5('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6ef5('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6ef5('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0178=['STRING','DATE','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','moment','exports','INTEGER'];(function(_0x4b6555,_0x16ed9f){var _0x4b37dc=function(_0x2eb2b7){while(--_0x2eb2b7){_0x4b6555['push'](_0x4b6555['shift']());}};_0x4b37dc(++_0x16ed9f);}(_0x0178,0x194));var _0x8017=function(_0x4af636,_0x58b09f){_0x4af636=_0x4af636-0x0;var _0x55ca9a=_0x0178[_0x4af636];return _0x55ca9a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8017('0x0'));module[_0x8017('0x1')]={'state':{'type':Sequelize[_0x8017('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8017('0x3')]},'scheduledat':{'type':Sequelize[_0x8017('0x4')]},'countbusyretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8017('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8017('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8017('0x3')]},'calleridnum':{'type':Sequelize[_0x8017('0x3')]},'calleridname':{'type':Sequelize[_0x8017('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8017('0x4')]},'answertime':{'type':Sequelize[_0x8017('0x4')]},'droptime':{'type':Sequelize[_0x8017('0x4')]},'endtime':{'type':Sequelize[_0x8017('0x4')]},'ringtime':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8017('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8017('0x3')]},'disposition':{'type':Sequelize[_0x8017('0x3')]},'secondDisposition':{'type':Sequelize[_0x8017('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8017('0x3')]},'dispositionat':{'type':Sequelize[_0x8017('0x4')],'set':function(_0x2fd864){var _0x3ea3fc=this['getDataValue'](_0x8017('0x5'));if(_0x3ea3fc&&_0x2fd864){this[_0x8017('0x6')](_0x8017('0x7'),moment(_0x2fd864)[_0x8017('0x8')](moment(_0x3ea3fc),'seconds'));}return this['setDataValue'](_0x8017('0x9'),_0x2fd864);}},'amd':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8017('0x4')]},'callback':{'type':Sequelize[_0x8017('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8017('0x4')]},'deleted':{'type':Sequelize[_0x8017('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8017('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8017('0x2')],'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 6f30d51..51c5758 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 _0x0295=['ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','CmHopperFinal','includeAll','rows','catch','show','params','intersection','include','find','describe','body','uniqueid','findAll','sequelize','literal','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','createdAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2f10b4,_0x39ebcc){var _0x296873=function(_0x300d69){while(--_0x300d69){_0x2f10b4['push'](_0x2f10b4['shift']());}};_0x296873(++_0x39ebcc);}(_0x0295,0x1f0));var _0x5029=function(_0x4c82af,_0x5ca362){_0x4c82af=_0x4c82af-0x0;var _0x260354=_0x0295[_0x4c82af];return _0x260354;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['CmHopperFinal'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['CmHopperFinal'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')]()[_0x5029('0x20')](respondWithResult(_0x2bb7fc,null))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x449ef5,_0x18f1f5){if(_0x449ef5[_0x5029('0x45')][_0x5029('0x46')]){delete _0x449ef5[_0x5029('0x45')][_0x5029('0x46')];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'uniqueid':_0x449ef5[_0x5029('0x40')]['id']}})['then'](handleEntityNotFound(_0x18f1f5,null))[_0x5029('0x20')](saveUpdates(_0x449ef5['body'],null))[_0x5029('0x20')](respondWithResult(_0x18f1f5,null))[_0x5029('0x3e')](handleError(_0x18f1f5,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x5343c6,_0x319bff,_0x5e739d){return db['CmHopperFinal'][_0x5029('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x5343c6[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x5029('0x4a')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4c')))),_0x5029('0x4d')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x4e')))),'busyContacts'],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x50')))),_0x5029('0x51')],[db['sequelize']['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x53')))),_0x5029('0x54')]]})['then'](handleEntityNotFound(_0x319bff,null))[_0x5029('0x20')](respondWithResult(_0x319bff,null))[_0x5029('0x3e')](handleError(_0x319bff,null));};exports[_0x5029('0x55')]=function(_0x2aebb3,_0x3a82f7,_0x26f56f){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x2aebb3[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x56')))),_0x5029('0x4a')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0x5029('0x4d')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4e')))),_0x5029('0x57')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x58')))),_0x5029('0x59')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5029('0x51')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x5a')))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')](_0x5029('0x53')))),'answeringMachine']]})[_0x5029('0x20')](handleEntityNotFound(_0x3a82f7,null))[_0x5029('0x20')](respondWithResult(_0x3a82f7,null))[_0x5029('0x3e')](handleError(_0x3a82f7,null));};exports[_0x5029('0x5b')]=function(_0x9b1c13,_0x1bd1c6,_0x5bd84e){return db['VoiceQueue'][_0x5029('0x43')]({'where':{'id':_0x9b1c13['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bd1c6,null))[_0x5029('0x20')](function(_0x58db57){var _0x181956;if(_0x58db57){_0x181956=squel['insert']()['into'](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),_0x5029('0x5f'),'ContactId',_0x5029('0x60'),_0x5029('0x61'),'createdAt',_0x5029('0x62')],squel[_0x5029('0x63')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field']('ANY_VALUE(VoiceQueueId)',_0x5029('0x61'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x69'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))['from'](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x6b'),_0x9b1c13['params']['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x6d'),_0x9b1c13['body'][_0x5029('0x6e')][_0x5029('0x6c')]())[_0x5029('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel['select']()[_0x5029('0x64')](_0x5029('0x5e'))[_0x5029('0x70')](_0x5029('0x5c'))[_0x5029('0x38')]('VoiceQueueId\x20=\x20?',_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()['field'](_0x5029('0x71'))[_0x5029('0x70')](_0x5029('0x6a'))['where'](_0x5029('0x6b'),_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))['toString']();return db[_0x5029('0x48')][_0x5029('0x2c')](_0x181956);}return[];})[_0x5029('0x20')](respondWithResult(_0x1bd1c6,null))[_0x5029('0x3e')](handleError(_0x1bd1c6,null));};exports[_0x5029('0x74')]=function(_0x4c40d1,_0x209c83,_0x443070){return db[_0x5029('0x75')]['find']({'where':{'id':_0x4c40d1[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x209c83,null))['then'](function(_0x5c8bd4){var _0x524825;if(_0x5c8bd4){_0x524825=squel[_0x5029('0x76')]()[_0x5029('0x77')](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),'scheduledAt',_0x5029('0x67'),_0x5029('0x60'),_0x5029('0x78'),'createdAt','updatedAt'],squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x79'),_0x5029('0x5e'))['field'](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field'](_0x5029('0x7a'),'CampaignId')['field'](_0x5029('0x65'),'createdAt')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))[_0x5029('0x70')](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1[_0x5029('0x40')]['id']['toString']())['where'](_0x5029('0x6d'),_0x4c40d1['body']['state'][_0x5029('0x6c')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x5e'))['from'](_0x5029('0x5c'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1['params']['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')]('calleridnum')['from'](_0x5029('0x6a'))[_0x5029('0x38')]('CampaignId\x20=\x20?',_0x4c40d1[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))[_0x5029('0x6c')]();return db[_0x5029('0x48')]['query'](_0x524825);}return[];})['then'](respondWithResult(_0x209c83,null))[_0x5029('0x3e')](handleError(_0x209c83,null));};exports['checkContactHopper']=function(_0x20a259,_0x5e5f88,_0x36fdce){return db[_0x5029('0x7c')][_0x5029('0x7d')]({'where':{'VoiceQueueId':_0x20a259['body'][_0x5029('0x61')],'CampaignId':_0x20a259[_0x5029('0x45')][_0x5029('0x78')],'ContactId':_0x20a259['body'][_0x5029('0x67')]}})[_0x5029('0x20')](handleEntityNotFound(_0x5e5f88,null))[_0x5029('0x20')](function(_0x4421bd){if(_0x4421bd){return _0x4421bd;}return null;})[_0x5029('0x20')](respondWithResult(_0x5e5f88,null))[_0x5029('0x3e')](handleError(_0x5e5f88,null));}; \ No newline at end of file +var _0xe3da=['COUNT','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','congestionContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','ContactId','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','createdAt','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0xd4ae3f,_0x410d0f){var _0x52e69b=function(_0x454872){while(--_0x454872){_0xd4ae3f['push'](_0xd4ae3f['shift']());}};_0x52e69b(++_0x410d0f);}(_0xe3da,0x1cd));var _0xae3d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe3da[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':!![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['describe']()['then'](respondWithResult(_0x4ed0f9,null))['catch'](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0xc8f551,_0x39f213){if(_0xc8f551[_0xae3d('0x4f')]['uniqueid']){delete _0xc8f551['body'][_0xae3d('0x50')];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'uniqueid':_0xc8f551[_0xae3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39f213,null))[_0xae3d('0x28')](saveUpdates(_0xc8f551[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x39f213,null))[_0xae3d('0x48')](handleError(_0x39f213,null));};exports[_0xae3d('0x51')]=function(_0x38ccf1,_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x38ccf1[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),'noSuchContacts'],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),_0xae3d('0x56')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5a')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db['sequelize']['literal'](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5d')))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x61')))),'answeringMachine']]})[_0xae3d('0x28')](handleEntityNotFound(_0x3e30ea,null))[_0xae3d('0x28')](respondWithResult(_0x3e30ea,null))[_0xae3d('0x48')](handleError(_0x3e30ea,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3a39ed,_0x31b362,_0x253ee4){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'CampaignId':_0x3a39ed[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),_0xae3d('0x62')],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),'noAnswerContacts'],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5a')))),_0xae3d('0x63')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x61')))),_0xae3d('0x64')]]})['then'](handleEntityNotFound(_0x31b362,null))[_0xae3d('0x28')](respondWithResult(_0x31b362,null))['catch'](handleError(_0x31b362,null));};exports[_0xae3d('0x65')]=function(_0x115e99,_0x26c409,_0x4709ea){return db[_0xae3d('0x66')]['find']({'where':{'id':_0x115e99[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x26c409,null))[_0xae3d('0x28')](function(_0x5f1e9c){var _0x546991;if(_0x5f1e9c){_0x546991=squel[_0xae3d('0x67')]()[_0xae3d('0x68')]('cm_hopper')['fromQuery']([_0xae3d('0x69'),'scheduledAt',_0xae3d('0x6a'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('ANY_VALUE(calleridnum)','phone')[_0xae3d('0x6c')](_0xae3d('0x6d'),_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),_0xae3d('0x6a'))[_0xae3d('0x6c')]('ANY_VALUE(ListId)',_0xae3d('0x70'))[_0xae3d('0x6c')](_0xae3d('0x71'),_0xae3d('0x72'))[_0xae3d('0x6c')](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')](_0xae3d('0x6d'),'updatedAt')['from'](_0xae3d('0x73'))[_0xae3d('0x3d')]('VoiceQueueId\x20=\x20?',_0x115e99[_0xae3d('0x4a')]['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x115e99[_0xae3d('0x4f')][_0xae3d('0x75')]['toString']())['where'](_0xae3d('0x76'))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')](_0xae3d('0x69'))['from'](_0xae3d('0x78'))[_0xae3d('0x3d')](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')]('calleridnum')[_0xae3d('0x7a')]('cm_hopper_final')['where'](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x7b')))[_0xae3d('0x7c')]('ContactId'))[_0xae3d('0x74')]();return db[_0xae3d('0x52')][_0xae3d('0x34')](_0x546991);}return[];})[_0xae3d('0x28')](respondWithResult(_0x26c409,null))[_0xae3d('0x48')](handleError(_0x26c409,null));};exports[_0xae3d('0x7d')]=function(_0x1c5f67,_0xa083d0,_0x26e422){return db[_0xae3d('0x7e')][_0xae3d('0x4d')]({'where':{'id':_0x1c5f67[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0xa083d0,null))[_0xae3d('0x28')](function(_0xf281f5){var _0x3261e5;if(_0xf281f5){_0x3261e5=squel[_0xae3d('0x67')]()['into'](_0xae3d('0x78'))[_0xae3d('0x7f')]([_0xae3d('0x69'),_0xae3d('0x6e'),_0xae3d('0x6a'),'ListId',_0xae3d('0x80'),_0xae3d('0x81'),_0xae3d('0x82')],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')](_0xae3d('0x83'),_0xae3d('0x69'))[_0xae3d('0x6c')]('NOW()',_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),'ContactId')[_0xae3d('0x6c')](_0xae3d('0x84'),_0xae3d('0x70'))['field'](_0xae3d('0x85'),_0xae3d('0x80'))['field'](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')]('NOW()',_0xae3d('0x82'))[_0xae3d('0x7a')](_0xae3d('0x73'))[_0xae3d('0x3d')](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x1c5f67['body'][_0xae3d('0x75')][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x76'))['where'](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('phone')['from'](_0xae3d('0x78'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()['field'](_0xae3d('0x87'))[_0xae3d('0x7a')](_0xae3d('0x73'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x204'))['group'](_0xae3d('0x6a')))['toString']();return db['sequelize'][_0xae3d('0x34')](_0x3261e5);}return[];})['then'](respondWithResult(_0xa083d0,null))[_0xae3d('0x48')](handleError(_0xa083d0,null));};exports['checkContactHopper']=function(_0x31f606,_0x47aa7a,_0x27c0ff){return db['CmHopper'][_0xae3d('0x88')]({'where':{'VoiceQueueId':_0x31f606['body'][_0xae3d('0x72')],'CampaignId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x80')],'ContactId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x6a')]}})[_0xae3d('0x28')](handleEntityNotFound(_0x47aa7a,null))[_0xae3d('0x28')](function(_0x95c4ce){if(_0x95c4ce){return _0x95c4ce;}return null;})[_0xae3d('0x28')](respondWithResult(_0x47aa7a,null))['catch'](handleError(_0x47aa7a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index bee794b..187363f 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 _0x0950=['define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0x0950,0xd6));var _0x0095=function(_0x42a5e4,_0x2ccfb6){_0x42a5e4=_0x42a5e4-0x0;var _0xd56657=_0x0950[_0x42a5e4];return _0xd56657;};'use strict';var _=require(_0x0095('0x0'));var util=require(_0x0095('0x1'));var logger=require(_0x0095('0x2'))(_0x0095('0x3'));var moment=require(_0x0095('0x4'));var BPromise=require(_0x0095('0x5'));var rp=require(_0x0095('0x6'));var fs=require('fs');var path=require(_0x0095('0x7'));var rimraf=require(_0x0095('0x8'));var config=require(_0x0095('0x9'));var attributes=require(_0x0095('0xa'));module['exports']=function(_0x256fd4,_0x5e5228){return _0x256fd4[_0x0095('0xb')]('CmHopperFinal',attributes,{'tableName':_0x0095('0xc'),'paranoid':![],'indexes':[{'name':_0x0095('0xd'),'fields':[_0x0095('0xd')]},{'name':_0x0095('0xe'),'fields':[_0x0095('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x37ee=['api','moment','path','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger'];(function(_0x26aa38,_0x34d077){var _0xd1c8e=function(_0x5876c4){while(--_0x5876c4){_0x26aa38['push'](_0x26aa38['shift']());}};_0xd1c8e(++_0x34d077);}(_0x37ee,0xe8));var _0xe37e=function(_0xbc8ec2,_0x42daa3){_0xbc8ec2=_0xbc8ec2-0x0;var _0x5ab51f=_0x37ee[_0xbc8ec2];return _0x5ab51f;};'use strict';var _=require(_0xe37e('0x0'));var util=require('util');var logger=require(_0xe37e('0x1'))(_0xe37e('0x2'));var moment=require(_0xe37e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe37e('0x4'));var rimraf=require(_0xe37e('0x5'));var config=require('../../config/environment');var attributes=require(_0xe37e('0x6'));module[_0xe37e('0x7')]=function(_0x3ace7d,_0x36db45){return _0x3ace7d[_0xe37e('0x8')](_0xe37e('0x9'),attributes,{'tableName':_0xe37e('0xa'),'paranoid':![],'indexes':[{'name':_0xe37e('0xb'),'fields':['calleridnum']},{'name':_0xe37e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3c432c9..474c029 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2b298e,_0x50c369){var _0x11e79b=function(_0x1647c8){while(--_0x1647c8){_0x2b298e['push'](_0x2b298e['shift']());}};_0x11e79b(++_0x50c369);}(_0x7a54,0x106));var _0x47a5=function(_0x211f9c,_0x3fc848){_0x211f9c=_0x211f9c-0x0;var _0x13b1bf=_0x7a54[_0x211f9c];return _0x13b1bf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x38460c,_0x205284){var _0x168643=function(_0x402a47){while(--_0x402a47){_0x38460c['push'](_0x38460c['shift']());}};_0x168643(++_0x205284);}(_0x7a54,0x106));var _0x47a5=function(_0x1ff6bc,_0x5230ce){_0x1ff6bc=_0x1ff6bc-0x0;var _0x2039e6=_0x7a54[_0x1ff6bc];return _0x2039e6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c64d086..e57603e 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 _0xac67=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','/describe','get','/:id','show','/voice/queue/countAttributes/:id'];(function(_0x18841e,_0x64e61f){var _0x49db81=function(_0x814ab8){while(--_0x814ab8){_0x18841e['push'](_0x18841e['shift']());}};_0x49db81(++_0x64e61f);}(_0xac67,0x1d7));var _0x7ac6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xac67[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x7ac6('0x0'));var util=require(_0x7ac6('0x1'));var path=require(_0x7ac6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7ac6('0x3')]();var fs_extra=require(_0x7ac6('0x4'));var auth=require(_0x7ac6('0x5'));var interaction=require(_0x7ac6('0x6'));var config=require(_0x7ac6('0x7'));var controller=require(_0x7ac6('0x8'));router['get']('/',auth[_0x7ac6('0x9')](),controller['index']);router['get'](_0x7ac6('0xa'),auth[_0x7ac6('0x9')](),controller['describe']);router[_0x7ac6('0xb')](_0x7ac6('0xc'),auth[_0x7ac6('0x9')](),controller[_0x7ac6('0xd')]);router[_0x7ac6('0xb')](_0x7ac6('0xe'),auth[_0x7ac6('0x9')](),controller[_0x7ac6('0xf')]);router[_0x7ac6('0xb')](_0x7ac6('0x10'),auth[_0x7ac6('0x9')](),controller[_0x7ac6('0x11')]);router[_0x7ac6('0x12')]('/voice/queue/moveContacts/:id',auth[_0x7ac6('0x9')](),controller[_0x7ac6('0x13')]);router[_0x7ac6('0x12')](_0x7ac6('0x14'),auth['isAuthenticated'](),controller[_0x7ac6('0x15')]);router['post'](_0x7ac6('0x16'),auth[_0x7ac6('0x9')](),controller[_0x7ac6('0x17')]);router[_0x7ac6('0x18')](_0x7ac6('0xc'),auth[_0x7ac6('0x9')](),controller[_0x7ac6('0x19')]);module[_0x7ac6('0x1a')]=router; \ No newline at end of file +var _0xcb1a=['/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2f1a38,_0x33169a){var _0x440afc=function(_0x3e3ceb){while(--_0x3e3ceb){_0x2f1a38['push'](_0x2f1a38['shift']());}};_0x440afc(++_0x33169a);}(_0xcb1a,0xb6));var _0xacb1=function(_0x55701b,_0xf27776){_0x55701b=_0x55701b-0x0;var _0x56c18b=_0xcb1a[_0x55701b];return _0x56c18b;};'use strict';var multer=require(_0xacb1('0x0'));var util=require(_0xacb1('0x1'));var path=require(_0xacb1('0x2'));var timeout=require(_0xacb1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xacb1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacb1('0x5'));var config=require(_0xacb1('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xacb1('0x7')]('/',auth[_0xacb1('0x8')](),controller[_0xacb1('0x9')]);router[_0xacb1('0x7')](_0xacb1('0xa'),auth[_0xacb1('0x8')](),controller['describe']);router[_0xacb1('0x7')](_0xacb1('0xb'),auth[_0xacb1('0x8')](),controller[_0xacb1('0xc')]);router[_0xacb1('0x7')](_0xacb1('0xd'),auth[_0xacb1('0x8')](),controller[_0xacb1('0xe')]);router[_0xacb1('0x7')](_0xacb1('0xf'),auth[_0xacb1('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xacb1('0x10')](_0xacb1('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xacb1('0x10')](_0xacb1('0x12'),auth[_0xacb1('0x8')](),controller[_0xacb1('0x13')]);router[_0xacb1('0x10')](_0xacb1('0x14'),auth['isAuthenticated'](),controller[_0xacb1('0x15')]);router['put'](_0xacb1('0xb'),auth[_0xacb1('0x8')](),controller[_0xacb1('0x16')]);module[_0xacb1('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 2e10754..71bfe79 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 _0x5e89=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0x5e89,0x1dd));var _0x95e8=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x5e89[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x95e8('0x0'));module['exports']={'state':{'type':Sequelize[_0x95e8('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x95e8('0x2')]},'scheduledat':{'type':Sequelize[_0x95e8('0x3')]},'countbusyretry':{'type':Sequelize[_0x95e8('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x95e8('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x95e8('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x95e8('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x95e8('0x2')]},'calleridname':{'type':Sequelize[_0x95e8('0x2')]},'starttime':{'type':Sequelize[_0x95e8('0x3')]},'responsetime':{'type':Sequelize[_0x95e8('0x3')]},'answertime':{'type':Sequelize[_0x95e8('0x3')]},'droptime':{'type':Sequelize[_0x95e8('0x3')]},'endtime':{'type':Sequelize[_0x95e8('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x95e8('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x95e8('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x95e8('0x2')]},'campaign':{'type':Sequelize[_0x95e8('0x2')]},'campaigntype':{'type':Sequelize[_0x95e8('0x2')]},'membername':{'type':Sequelize[_0x95e8('0x2')]},'reason':{'type':Sequelize[_0x95e8('0x2')]},'amd':{'type':Sequelize[_0x95e8('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x95e8('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x95e8('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x95e8('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x95e8('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x95e8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4210=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x4210,0xdc));var _0x0421=function(_0x4e3d77,_0x3f65c7){_0x4e3d77=_0x4e3d77-0x0;var _0x26322f=_0x4210[_0x4e3d77];return _0x26322f;};'use strict';var Sequelize=require(_0x0421('0x0'));module['exports']={'state':{'type':Sequelize[_0x0421('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0421('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0421('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0421('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0421('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x0421('0x3')]},'droptime':{'type':Sequelize[_0x0421('0x3')]},'endtime':{'type':Sequelize[_0x0421('0x3')]},'ringtime':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0421('0x2')]},'membername':{'type':Sequelize[_0x0421('0x2')]},'reason':{'type':Sequelize[_0x0421('0x2')]},'amd':{'type':Sequelize[_0x0421('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0421('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0421('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0421('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0421('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0421('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0421('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0421('0x1')],'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 d5e9581..12dfa85 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 _0x8149=['includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','describe','uniqueid','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','then','destroy','stack','name','index','CmHopperHistory','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x8149,0x9d));var _0x9814=function(_0x2ba8fc,_0x166587){_0x2ba8fc=_0x2ba8fc-0x0;var _0x19bc2d=_0x8149[_0x2ba8fc];return _0x19bc2d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9814('0x0'));var jsonpatch=require(_0x9814('0x1'));var rp=require('request-promise');var moment=require(_0x9814('0x2'));var BPromise=require(_0x9814('0x3'));var Mustache=require(_0x9814('0x4'));var util=require(_0x9814('0x5'));var path=require(_0x9814('0x6'));var sox=require(_0x9814('0x7'));var csv=require('to-csv');var ejs=require(_0x9814('0x8'));var fs=require('fs');var fs_extra=require(_0x9814('0x9'));var _=require('lodash');var squel=require(_0x9814('0xa'));var crypto=require(_0x9814('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9814('0xc'));var toCsv=require(_0x9814('0xd'));var querystring=require('querystring');var Papa=require(_0x9814('0xe'));var Redis=require('ioredis');var authService=require(_0x9814('0xf'));var qs=require(_0x9814('0x10'));var as=require(_0x9814('0x11'));var hardwareService=require(_0x9814('0x12'));var logger=require(_0x9814('0x13'))(_0x9814('0x14'));var utils=require('../../config/utils');var config=require(_0x9814('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9814('0x16'))['db'];function respondWithStatusCode(_0x1bc281,_0x3b101a){_0x3b101a=_0x3b101a||0xcc;return function(_0x1c06d8){if(_0x1c06d8){return _0x1bc281[_0x9814('0x17')](_0x3b101a);}return _0x1bc281[_0x9814('0x18')](_0x3b101a)[_0x9814('0x19')]();};}function respondWithResult(_0xfa4bf8,_0x117ec7){_0x117ec7=_0x117ec7||0xc8;return function(_0x3b6efe){if(_0x3b6efe){return _0xfa4bf8[_0x9814('0x18')](_0x117ec7)[_0x9814('0x1a')](_0x3b6efe);}};}function respondWithFilteredResult(_0x335157,_0x4ea1eb){return function(_0x5b527a){if(_0x5b527a){var _0x4ea264=typeof _0x4ea1eb[_0x9814('0x1b')]==='undefined'&&typeof _0x4ea1eb['limit']===_0x9814('0x1c');var _0x50a112=_0x5b527a[_0x9814('0x1d')];var _0x158b2d=_0x4ea264?0x0:_0x4ea1eb[_0x9814('0x1b')];var _0x5b49e2=_0x4ea264?_0x5b527a[_0x9814('0x1d')]:_0x4ea1eb[_0x9814('0x1b')]+_0x4ea1eb[_0x9814('0x1e')];var _0x135115;if(_0x5b49e2>=_0x50a112){_0x5b49e2=_0x50a112;_0x135115=0xc8;}else{_0x135115=0xce;}_0x335157[_0x9814('0x18')](_0x135115);return _0x335157['set']('Content-Range',_0x158b2d+'-'+_0x5b49e2+'/'+_0x50a112)['json'](_0x5b527a);}return null;};}function patchUpdates(_0x1ce9d8){return function(_0x380cde){try{jsonpatch[_0x9814('0x1f')](_0x380cde,_0x1ce9d8,!![]);}catch(_0x547298){return BPromise['reject'](_0x547298);}return _0x380cde['save']();};}function saveUpdates(_0x549f93,_0x5e6c54){return function(_0x5afcec){if(_0x5afcec){return _0x5afcec['update'](_0x549f93)[_0x9814('0x20')](function(_0x44139d){return _0x44139d;});}return null;};}function removeEntity(_0x36d489,_0x3d963f){return function(_0x3a9bd6){if(_0x3a9bd6){return _0x3a9bd6[_0x9814('0x21')]()[_0x9814('0x20')](function(){_0x36d489[_0x9814('0x18')](0xcc)[_0x9814('0x19')]();});}};}function handleEntityNotFound(_0x4dbdb1,_0x473e3e){return function(_0x16b717){if(!_0x16b717){_0x4dbdb1[_0x9814('0x17')](0x194);}return _0x16b717;};}function handleError(_0x18ceeb,_0x535854){_0x535854=_0x535854||0x1f4;return function(_0x2db5cc){logger['error'](_0x2db5cc[_0x9814('0x22')]);if(_0x2db5cc[_0x9814('0x23')]){delete _0x2db5cc[_0x9814('0x23')];}_0x18ceeb[_0x9814('0x18')](_0x535854)['send'](_0x2db5cc);};}exports[_0x9814('0x24')]=function(_0x22bb29,_0x5cb05c){var _0xba367f={},_0x406cca={},_0x4a7a4b={'count':0x0,'rows':[]};var _0x98b790=_['map'](db[_0x9814('0x25')]['rawAttributes'],function(_0x2f24e8){return{'name':_0x2f24e8[_0x9814('0x26')],'type':_0x2f24e8[_0x9814('0x27')][_0x9814('0x28')]};});_0x406cca[_0x9814('0x29')]=_['map'](_0x98b790,_0x9814('0x23'));_0x406cca['query']=_['keys'](_0x22bb29['query']);_0x406cca[_0x9814('0x2a')]=_[_0x9814('0x2b')](_0x406cca[_0x9814('0x29')],_0x406cca[_0x9814('0x2c')]);_0xba367f[_0x9814('0x2d')]=_[_0x9814('0x2b')](_0x406cca[_0x9814('0x29')],qs['fields'](_0x22bb29['query'][_0x9814('0x2e')]));_0xba367f[_0x9814('0x2d')]=_0xba367f[_0x9814('0x2d')][_0x9814('0x2f')]?_0xba367f[_0x9814('0x2d')]:_0x406cca['model'];if(!_0x22bb29[_0x9814('0x2c')][_0x9814('0x30')](_0x9814('0x31'))){_0xba367f[_0x9814('0x1e')]=qs[_0x9814('0x1e')](_0x22bb29[_0x9814('0x2c')]['limit']);_0xba367f[_0x9814('0x1b')]=qs[_0x9814('0x1b')](_0x22bb29[_0x9814('0x2c')][_0x9814('0x1b')]);}_0xba367f[_0x9814('0x32')]=qs[_0x9814('0x33')](_0x22bb29[_0x9814('0x2c')][_0x9814('0x33')]);_0xba367f['where']=qs['filters'](_[_0x9814('0x34')](_0x22bb29[_0x9814('0x2c')],_0x406cca[_0x9814('0x2a')]),_0x98b790);if(_0x22bb29[_0x9814('0x2c')][_0x9814('0x35')]){_0xba367f[_0x9814('0x36')]=_[_0x9814('0x37')](_0xba367f[_0x9814('0x36')],{'$or':_[_0x9814('0x38')](_0x98b790,function(_0x36299d){if(_0x36299d[_0x9814('0x27')]!==_0x9814('0x39')){var _0xe0ad04={};_0xe0ad04[_0x36299d[_0x9814('0x23')]]={'$like':'%'+_0x22bb29[_0x9814('0x2c')][_0x9814('0x35')]+'%'};return _0xe0ad04;}})});}_0xba367f=_[_0x9814('0x37')]({},_0xba367f,_0x22bb29[_0x9814('0x3a')]);var _0x3edb4b={'where':_0xba367f['where']};return db[_0x9814('0x25')][_0x9814('0x1d')](_0x3edb4b)[_0x9814('0x20')](function(_0x45f592){_0x4a7a4b[_0x9814('0x1d')]=_0x45f592;if(_0x22bb29[_0x9814('0x2c')][_0x9814('0x3b')]){_0xba367f[_0x9814('0x3c')]=[{'all':!![]}];}return db[_0x9814('0x25')][_0x9814('0x3d')](_0xba367f);})['then'](function(_0x13b663){_0x4a7a4b[_0x9814('0x3e')]=_0x13b663;return _0x4a7a4b;})[_0x9814('0x20')](respondWithFilteredResult(_0x5cb05c,_0xba367f))['catch'](handleError(_0x5cb05c,null));};exports[_0x9814('0x3f')]=function(_0x20b273,_0x803654){var _0xb6cc28={'raw':!![],'where':{'id':_0x20b273['params']['id']}},_0xd1c0c9={};_0xd1c0c9[_0x9814('0x29')]=_['keys'](db[_0x9814('0x25')][_0x9814('0x40')]);_0xd1c0c9[_0x9814('0x2c')]=_['keys'](_0x20b273[_0x9814('0x2c')]);_0xd1c0c9[_0x9814('0x2a')]=_[_0x9814('0x2b')](_0xd1c0c9[_0x9814('0x29')],_0xd1c0c9[_0x9814('0x2c')]);_0xb6cc28['attributes']=_['intersection'](_0xd1c0c9[_0x9814('0x29')],qs['fields'](_0x20b273[_0x9814('0x2c')]['fields']));_0xb6cc28[_0x9814('0x2d')]=_0xb6cc28[_0x9814('0x2d')][_0x9814('0x2f')]?_0xb6cc28[_0x9814('0x2d')]:_0xd1c0c9[_0x9814('0x29')];if(_0x20b273[_0x9814('0x2c')][_0x9814('0x3b')]){_0xb6cc28[_0x9814('0x3c')]=[{'all':!![]}];}_0xb6cc28=_[_0x9814('0x37')]({},_0xb6cc28,_0x20b273[_0x9814('0x3a')]);return db[_0x9814('0x25')][_0x9814('0x41')](_0xb6cc28)['then'](handleEntityNotFound(_0x803654,null))['then'](respondWithResult(_0x803654,null))[_0x9814('0x42')](handleError(_0x803654,null));};exports['create']=function(_0x31c152,_0xf95efa){return db['CmHopperHistory'][_0x9814('0x43')](_0x31c152[_0x9814('0x44')],{})[_0x9814('0x20')](respondWithResult(_0xf95efa,0xc9))[_0x9814('0x42')](handleError(_0xf95efa,null));};exports['describe']=function(_0x4f38a0,_0x595aa7){return db[_0x9814('0x25')][_0x9814('0x45')]()[_0x9814('0x20')](respondWithResult(_0x595aa7,null))[_0x9814('0x42')](handleError(_0x595aa7,null));};exports['update']=function(_0x6e1693,_0x59f181){if(_0x6e1693[_0x9814('0x44')][_0x9814('0x46')]){delete _0x6e1693[_0x9814('0x44')]['uniqueid'];}return db[_0x9814('0x25')][_0x9814('0x41')]({'where':{'uniqueid':_0x6e1693[_0x9814('0x47')]['id']}})['then'](handleEntityNotFound(_0x59f181,null))[_0x9814('0x20')](saveUpdates(_0x6e1693[_0x9814('0x44')],null))['then'](respondWithResult(_0x59f181,null))['catch'](handleError(_0x59f181,null));}; \ No newline at end of file +var _0xb3bd=['index','map','CmHopperHistory','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','show','find','catch','create','describe','body','uniqueid','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','end','error','name','send'];(function(_0x4afa24,_0x5a3713){var _0x3fcdf1=function(_0x19720a){while(--_0x19720a){_0x4afa24['push'](_0x4afa24['shift']());}};_0x3fcdf1(++_0x5a3713);}(_0xb3bd,0x1cd));var _0xdb3b=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xb3bd[_0x421cf8];return _0x145c48;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdb3b('0x0'));var jsonpatch=require(_0xdb3b('0x1'));var rp=require(_0xdb3b('0x2'));var moment=require(_0xdb3b('0x3'));var BPromise=require(_0xdb3b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb3b('0x5'));var sox=require(_0xdb3b('0x6'));var csv=require(_0xdb3b('0x7'));var ejs=require(_0xdb3b('0x8'));var fs=require('fs');var fs_extra=require(_0xdb3b('0x9'));var _=require(_0xdb3b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdb3b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdb3b('0x7'));var querystring=require(_0xdb3b('0xc'));var Papa=require(_0xdb3b('0xd'));var Redis=require(_0xdb3b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdb3b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb3b('0x10'));var logger=require(_0xdb3b('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xdb3b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb3b('0x13'))['db'];function respondWithStatusCode(_0x1413a7,_0x50895a){_0x50895a=_0x50895a||0xcc;return function(_0x26ff43){if(_0x26ff43){return _0x1413a7[_0xdb3b('0x14')](_0x50895a);}return _0x1413a7[_0xdb3b('0x15')](_0x50895a)['end']();};}function respondWithResult(_0x2fdb42,_0x235c87){_0x235c87=_0x235c87||0xc8;return function(_0x444440){if(_0x444440){return _0x2fdb42[_0xdb3b('0x15')](_0x235c87)[_0xdb3b('0x16')](_0x444440);}};}function respondWithFilteredResult(_0x5d38d9,_0x28eee3){return function(_0x2619d0){if(_0x2619d0){var _0x506e80=typeof _0x28eee3[_0xdb3b('0x17')]===_0xdb3b('0x18')&&typeof _0x28eee3[_0xdb3b('0x19')]===_0xdb3b('0x18');var _0x41cc60=_0x2619d0['count'];var _0x31ab99=_0x506e80?0x0:_0x28eee3[_0xdb3b('0x17')];var _0x15d4ef=_0x506e80?_0x2619d0['count']:_0x28eee3[_0xdb3b('0x17')]+_0x28eee3['limit'];var _0x2bfa50;if(_0x15d4ef>=_0x41cc60){_0x15d4ef=_0x41cc60;_0x2bfa50=0xc8;}else{_0x2bfa50=0xce;}_0x5d38d9['status'](_0x2bfa50);return _0x5d38d9[_0xdb3b('0x1a')]('Content-Range',_0x31ab99+'-'+_0x15d4ef+'/'+_0x41cc60)[_0xdb3b('0x16')](_0x2619d0);}return null;};}function patchUpdates(_0x12634e){return function(_0x3b3387){try{jsonpatch[_0xdb3b('0x1b')](_0x3b3387,_0x12634e,!![]);}catch(_0x51749f){return BPromise[_0xdb3b('0x1c')](_0x51749f);}return _0x3b3387[_0xdb3b('0x1d')]();};}function saveUpdates(_0x33a048,_0x1a10eb){return function(_0x4dcbda){if(_0x4dcbda){return _0x4dcbda[_0xdb3b('0x1e')](_0x33a048)[_0xdb3b('0x1f')](function(_0xc91747){return _0xc91747;});}return null;};}function removeEntity(_0x5635af,_0x3aafbe){return function(_0xd4b222){if(_0xd4b222){return _0xd4b222['destroy']()['then'](function(){_0x5635af[_0xdb3b('0x15')](0xcc)[_0xdb3b('0x20')]();});}};}function handleEntityNotFound(_0x532c42,_0x5382f0){return function(_0x2a3c9f){if(!_0x2a3c9f){_0x532c42[_0xdb3b('0x14')](0x194);}return _0x2a3c9f;};}function handleError(_0x44f36b,_0x3248b1){_0x3248b1=_0x3248b1||0x1f4;return function(_0x397a05){logger[_0xdb3b('0x21')](_0x397a05['stack']);if(_0x397a05['name']){delete _0x397a05[_0xdb3b('0x22')];}_0x44f36b[_0xdb3b('0x15')](_0x3248b1)[_0xdb3b('0x23')](_0x397a05);};}exports[_0xdb3b('0x24')]=function(_0x21ff73,_0x36b7c1){var _0x502944={},_0x36938b={},_0x5cea5d={'count':0x0,'rows':[]};var _0x1ee826=_[_0xdb3b('0x25')](db[_0xdb3b('0x26')]['rawAttributes'],function(_0x4b7f3e){return{'name':_0x4b7f3e[_0xdb3b('0x27')],'type':_0x4b7f3e[_0xdb3b('0x28')][_0xdb3b('0x29')]};});_0x36938b[_0xdb3b('0x2a')]=_[_0xdb3b('0x25')](_0x1ee826,_0xdb3b('0x22'));_0x36938b[_0xdb3b('0x2b')]=_[_0xdb3b('0x2c')](_0x21ff73['query']);_0x36938b[_0xdb3b('0x2d')]=_[_0xdb3b('0x2e')](_0x36938b[_0xdb3b('0x2a')],_0x36938b[_0xdb3b('0x2b')]);_0x502944['attributes']=_[_0xdb3b('0x2e')](_0x36938b['model'],qs['fields'](_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x2f')]));_0x502944['attributes']=_0x502944[_0xdb3b('0x30')][_0xdb3b('0x31')]?_0x502944[_0xdb3b('0x30')]:_0x36938b[_0xdb3b('0x2a')];if(!_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x32')](_0xdb3b('0x33'))){_0x502944[_0xdb3b('0x19')]=qs['limit'](_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x19')]);_0x502944[_0xdb3b('0x17')]=qs['offset'](_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x17')]);}_0x502944[_0xdb3b('0x34')]=qs['sort'](_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x35')]);_0x502944[_0xdb3b('0x36')]=qs[_0xdb3b('0x2d')](_[_0xdb3b('0x37')](_0x21ff73['query'],_0x36938b[_0xdb3b('0x2d')]),_0x1ee826);if(_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x38')]){_0x502944[_0xdb3b('0x36')]=_['merge'](_0x502944[_0xdb3b('0x36')],{'$or':_[_0xdb3b('0x25')](_0x1ee826,function(_0x222d6e){if(_0x222d6e[_0xdb3b('0x28')]!==_0xdb3b('0x39')){var _0x5ba5ca={};_0x5ba5ca[_0x222d6e[_0xdb3b('0x22')]]={'$like':'%'+_0x21ff73[_0xdb3b('0x2b')][_0xdb3b('0x38')]+'%'};return _0x5ba5ca;}})});}_0x502944=_[_0xdb3b('0x3a')]({},_0x502944,_0x21ff73[_0xdb3b('0x3b')]);var _0xbb4f4a={'where':_0x502944[_0xdb3b('0x36')]};return db[_0xdb3b('0x26')]['count'](_0xbb4f4a)[_0xdb3b('0x1f')](function(_0x157aff){_0x5cea5d[_0xdb3b('0x3c')]=_0x157aff;if(_0x21ff73['query'][_0xdb3b('0x3d')]){_0x502944[_0xdb3b('0x3e')]=[{'all':!![]}];}return db[_0xdb3b('0x26')][_0xdb3b('0x3f')](_0x502944);})[_0xdb3b('0x1f')](function(_0x47fd2b){_0x5cea5d['rows']=_0x47fd2b;return _0x5cea5d;})['then'](respondWithFilteredResult(_0x36b7c1,_0x502944))['catch'](handleError(_0x36b7c1,null));};exports[_0xdb3b('0x40')]=function(_0x141775,_0x214afe){var _0x209ca1={'raw':!![],'where':{'id':_0x141775['params']['id']}},_0x3518b8={};_0x3518b8[_0xdb3b('0x2a')]=_[_0xdb3b('0x2c')](db[_0xdb3b('0x26')]['rawAttributes']);_0x3518b8['query']=_['keys'](_0x141775[_0xdb3b('0x2b')]);_0x3518b8[_0xdb3b('0x2d')]=_[_0xdb3b('0x2e')](_0x3518b8[_0xdb3b('0x2a')],_0x3518b8['query']);_0x209ca1[_0xdb3b('0x30')]=_['intersection'](_0x3518b8['model'],qs[_0xdb3b('0x2f')](_0x141775[_0xdb3b('0x2b')][_0xdb3b('0x2f')]));_0x209ca1[_0xdb3b('0x30')]=_0x209ca1['attributes'][_0xdb3b('0x31')]?_0x209ca1[_0xdb3b('0x30')]:_0x3518b8[_0xdb3b('0x2a')];if(_0x141775[_0xdb3b('0x2b')][_0xdb3b('0x3d')]){_0x209ca1[_0xdb3b('0x3e')]=[{'all':!![]}];}_0x209ca1=_['merge']({},_0x209ca1,_0x141775[_0xdb3b('0x3b')]);return db[_0xdb3b('0x26')][_0xdb3b('0x41')](_0x209ca1)['then'](handleEntityNotFound(_0x214afe,null))['then'](respondWithResult(_0x214afe,null))[_0xdb3b('0x42')](handleError(_0x214afe,null));};exports[_0xdb3b('0x43')]=function(_0x50b45c,_0x52c048){return db['CmHopperHistory'][_0xdb3b('0x43')](_0x50b45c['body'],{})[_0xdb3b('0x1f')](respondWithResult(_0x52c048,0xc9))[_0xdb3b('0x42')](handleError(_0x52c048,null));};exports['describe']=function(_0x500d3b,_0x49659b){return db[_0xdb3b('0x26')][_0xdb3b('0x44')]()[_0xdb3b('0x1f')](respondWithResult(_0x49659b,null))[_0xdb3b('0x42')](handleError(_0x49659b,null));};exports[_0xdb3b('0x1e')]=function(_0x2c2a5d,_0x448617){if(_0x2c2a5d[_0xdb3b('0x45')][_0xdb3b('0x46')]){delete _0x2c2a5d[_0xdb3b('0x45')][_0xdb3b('0x46')];}return db[_0xdb3b('0x26')][_0xdb3b('0x41')]({'where':{'uniqueid':_0x2c2a5d['params']['id']}})[_0xdb3b('0x1f')](handleEntityNotFound(_0x448617,null))[_0xdb3b('0x1f')](saveUpdates(_0x2c2a5d[_0xdb3b('0x45')],null))[_0xdb3b('0x1f')](respondWithResult(_0x448617,null))[_0xdb3b('0x42')](handleError(_0x448617,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 4db3dc4..9d8935d 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 _0xb515=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb515,0x1b8));var _0x5b51=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xb515[_0x367a3d];return _0x460539;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var logger=require(_0x5b51('0x1'))(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var rp=require(_0x5b51('0x5'));var fs=require('fs');var path=require(_0x5b51('0x6'));var rimraf=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0x5b51('0x9')]=function(_0xf9e3ac,_0x3ef482){return _0xf9e3ac[_0x5b51('0xa')](_0x5b51('0xb'),attributes,{'tableName':_0x5b51('0xc'),'paranoid':![],'indexes':[{'name':_0x5b51('0xd'),'fields':[_0x5b51('0xd')]},{'name':_0x5b51('0xe'),'fields':[_0x5b51('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x15ef=['moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','util','../../config/logger'];(function(_0x186e0a,_0x1b9756){var _0x22c3a1=function(_0x47b6b1){while(--_0x47b6b1){_0x186e0a['push'](_0x186e0a['shift']());}};_0x22c3a1(++_0x1b9756);}(_0x15ef,0x80));var _0xf15e=function(_0x584c85,_0x5c9c9a){_0x584c85=_0x584c85-0x0;var _0x603397=_0x15ef[_0x584c85];return _0x603397;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var logger=require(_0xf15e('0x1'))('api');var moment=require(_0xf15e('0x2'));var BPromise=require(_0xf15e('0x3'));var rp=require(_0xf15e('0x4'));var fs=require('fs');var path=require(_0xf15e('0x5'));var rimraf=require(_0xf15e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf15e('0x7'));module[_0xf15e('0x8')]=function(_0x5e96b4,_0x5ba863){return _0x5e96b4[_0xf15e('0x9')](_0xf15e('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xf15e('0xb'),'fields':['endtime']},{'name':_0xf15e('0xc'),'fields':[_0xf15e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index dfc7e12..09fbbd3 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 _0x4f6f=['info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','debug','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4f6f,0x157));var _0xf4f6=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x4f6f[_0x350182];return _0x4a0892;};'use strict';var _=require(_0xf4f6('0x0'));var util=require(_0xf4f6('0x1'));var moment=require(_0xf4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4f6('0x4'))['db'];var utils=require(_0xf4f6('0x5'));var logger=require('../../config/logger')(_0xf4f6('0x6'));var config=require(_0xf4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf4f6('0x8')][_0xf4f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dc7b9,_0x4fa106,_0x106455){return new BPromise(function(_0x592fa6,_0x483c82){return client[_0xf4f6('0xa')](_0x2dc7b9,_0x106455)[_0xf4f6('0xb')](function(_0x34bc5d){logger[_0xf4f6('0xc')](_0xf4f6('0xd'),_0x4fa106,_0xf4f6('0xe'));logger['debug'](_0xf4f6('0xf'),_0x4fa106,_0xf4f6('0xe'),JSON[_0xf4f6('0x10')](_0x34bc5d));if(_0x34bc5d[_0xf4f6('0x11')]){if(_0x34bc5d[_0xf4f6('0x11')][_0xf4f6('0x12')]===0x1f4){logger['error'](_0xf4f6('0xd'),_0x4fa106,_0x34bc5d[_0xf4f6('0x11')]['message']);return _0x483c82(_0x34bc5d['error'][_0xf4f6('0x13')]);}logger[_0xf4f6('0x11')](_0xf4f6('0xd'),_0x4fa106,_0x34bc5d['error'][_0xf4f6('0x13')]);return _0x592fa6(_0x34bc5d[_0xf4f6('0x11')][_0xf4f6('0x13')]);}else{logger['info'](_0xf4f6('0xd'),_0x4fa106,'request\x20sent');_0x592fa6(_0x34bc5d[_0xf4f6('0x14')][_0xf4f6('0x13')]);}})[_0xf4f6('0x15')](function(_0x522af3){logger[_0xf4f6('0x11')](_0xf4f6('0xd'),_0x4fa106,_0x522af3);_0x483c82(_0x522af3);});});}exports[_0xf4f6('0x16')]=function(_0x4e1d2a){var _0x3d5019=this;return new Promise(function(_0x4cb047,_0x109095){return db[_0xf4f6('0x17')][_0xf4f6('0x18')](_0x4e1d2a['body'],{'raw':_0x4e1d2a[_0xf4f6('0x19')]?_0x4e1d2a[_0xf4f6('0x19')][_0xf4f6('0x1a')]===undefined?!![]:![]:!![]})[_0xf4f6('0xb')](function(_0x112918){logger[_0xf4f6('0xc')](_0xf4f6('0x16'),_0x4e1d2a);logger[_0xf4f6('0x1b')](_0xf4f6('0x16'),_0x4e1d2a,JSON[_0xf4f6('0x10')](_0x112918));_0x4cb047(_0x112918);})[_0xf4f6('0x15')](function(_0x4d8497){logger[_0xf4f6('0x11')](_0xf4f6('0x16'),_0x4d8497[_0xf4f6('0x13')],_0x4e1d2a);_0x109095(_0x3d5019['error'](0x1f4,_0x4d8497[_0xf4f6('0x13')]));});});};exports[_0xf4f6('0x1c')]=function(_0x5bbc9d){var _0x39f21f=this;return new Promise(function(_0xa11674,_0x2a1842){return db['CmHopperHistory'][_0xf4f6('0x1d')]({'raw':_0x5bbc9d[_0xf4f6('0x19')]?_0x5bbc9d[_0xf4f6('0x19')][_0xf4f6('0x1a')]===undefined?!![]:![]:!![],'where':_0x5bbc9d['options']?_0x5bbc9d[_0xf4f6('0x19')][_0xf4f6('0x1e')]||null:null,'attributes':[[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')][_0xf4f6('0x21')]('id')),_0xf4f6('0x22')],[db[_0xf4f6('0x1f')]['fn']('COUNT',db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xf4f6('0x24')],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')](_0xf4f6('0x25')))),_0xf4f6('0x26')],[db[_0xf4f6('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')](_0xf4f6('0x27')))),_0xf4f6('0x28')],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x29'),db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xf4f6('0x2a')],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x29'),db['sequelize']['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')](_0xf4f6('0x2b')))),_0xf4f6('0x2c')]]})[_0xf4f6('0xb')](function(_0x5eae74){logger[_0xf4f6('0xc')](_0xf4f6('0x1c'),_0x5bbc9d);logger['debug'](_0xf4f6('0x1c'),_0x5bbc9d,JSON[_0xf4f6('0x10')](_0x5eae74));_0xa11674(_0x5eae74);})[_0xf4f6('0x15')](function(_0x2a3b8c){logger['error'](_0xf4f6('0x1c'),_0x2a3b8c['message'],_0x5bbc9d);_0x2a1842(_0x39f21f[_0xf4f6('0x11')](0x1f4,_0x2a3b8c[_0xf4f6('0x13')]));});});};exports[_0xf4f6('0x2d')]=function(_0x4a9287){var _0xfc6bf2=this;return new Promise(function(_0x3c2ebd,_0x46f9b9){return db[_0xf4f6('0x17')]['findAll']({'raw':_0x4a9287[_0xf4f6('0x19')]?_0x4a9287[_0xf4f6('0x19')][_0xf4f6('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a9287['options']?_0x4a9287[_0xf4f6('0x19')]['where']||null:null,'attributes':[[_0xf4f6('0x2e'),_0xf4f6('0x2f')],[db[_0xf4f6('0x1f')]['fn']('COUNT',db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xf4f6('0x30')],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')](_0xf4f6('0x31')))),_0xf4f6('0x32')],[db['sequelize']['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')]['literal'](_0xf4f6('0x33')))),_0xf4f6('0x34')],[db[_0xf4f6('0x1f')]['fn']('COUNT',db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')]['literal'](_0xf4f6('0x35')))),'outboundBusyCallsDay'],[db[_0xf4f6('0x1f')]['fn']('COUNT',db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')](_0xf4f6('0x36')))),_0xf4f6('0x37')],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')](_0xf4f6('0x38')))),_0xf4f6('0x39')],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xf4f6('0x3a')))),_0xf4f6('0x3b')],[db['sequelize']['fn'](_0xf4f6('0x20'),db['sequelize']['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')](_0xf4f6('0x3c')))),_0xf4f6('0x3d')],[db[_0xf4f6('0x1f')]['fn']('COUNT',db[_0xf4f6('0x1f')]['fn']('IF',db['sequelize'][_0xf4f6('0x23')](_0xf4f6('0x3e')))),'outboundBlacklistCallsDay'],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')]['literal'](_0xf4f6('0x3f')))),'outboundOriginateFailureCallsDay'],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xf4f6('0x40')))),_0xf4f6('0x41')],[db['sequelize']['fn'](_0xf4f6('0x20'),db['sequelize']['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')](_0xf4f6('0x42')))),_0xf4f6('0x43')],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')]('`state`\x20=\x2020,\x201,\x20null'))),_0xf4f6('0x41')],[db[_0xf4f6('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})[_0xf4f6('0xb')](function(_0x25badb){logger['info']('GetVoiceQueueHopperHistory',_0x4a9287);logger[_0xf4f6('0x1b')](_0xf4f6('0x2d'),_0x4a9287,JSON[_0xf4f6('0x10')](_0x25badb));_0x3c2ebd(_0x25badb);})['catch'](function(_0x59b89d){logger[_0xf4f6('0x11')](_0xf4f6('0x2d'),_0x59b89d[_0xf4f6('0x13')],_0x4a9287);_0x46f9b9(_0xfc6bf2[_0xf4f6('0x11')](0x1f4,_0x59b89d[_0xf4f6('0x13')]));});});};exports[_0xf4f6('0x44')]=function(_0x35556e){var _0x444d38=this;return new Promise(function(_0x3bbc72,_0x63344b){return db['CmHopperHistory']['findAll']({'raw':_0x35556e[_0xf4f6('0x19')]?_0x35556e[_0xf4f6('0x19')][_0xf4f6('0x1a')]===undefined?!![]:![]:!![],'where':_0x35556e[_0xf4f6('0x19')]?_0x35556e[_0xf4f6('0x19')]['where']||null:null,'attributes':[[_0xf4f6('0x2e'),'name'],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')][_0xf4f6('0x21')]('id')),_0xf4f6('0x45')],[db[_0xf4f6('0x1f')]['fn'](_0xf4f6('0x20'),db[_0xf4f6('0x1f')]['fn']('IF',db[_0xf4f6('0x1f')][_0xf4f6('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xf4f6('0x46')]],'group':[_0xf4f6('0x2e')]})[_0xf4f6('0xb')](function(_0x47f03d){logger[_0xf4f6('0xc')](_0xf4f6('0x44'),_0x35556e);logger[_0xf4f6('0x1b')](_0xf4f6('0x44'),_0x35556e,JSON['stringify'](_0x47f03d));_0x3bbc72(_0x47f03d);})[_0xf4f6('0x15')](function(_0x3005a5){logger['error'](_0xf4f6('0x44'),_0x3005a5['message'],_0x35556e);_0x63344b(_0x444d38[_0xf4f6('0x11')](0x1f4,_0x3005a5[_0xf4f6('0x13')]));});});}; \ No newline at end of file +var _0x1306=['`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','findAll','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x1306,0x17a));var _0x6130=function(_0x53025d,_0x38935c){_0x53025d=_0x53025d-0x0;var _0x4bfbd2=_0x1306[_0x53025d];return _0x4bfbd2;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var moment=require(_0x6130('0x2'));var BPromise=require(_0x6130('0x3'));var rs=require(_0x6130('0x4'));var fs=require('fs');var Redis=require(_0x6130('0x5'));var db=require(_0x6130('0x6'))['db'];var utils=require(_0x6130('0x7'));var logger=require(_0x6130('0x8'))(_0x6130('0x9'));var config=require(_0x6130('0xa'));var jayson=require(_0x6130('0xb'));var client=jayson[_0x6130('0xc')][_0x6130('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db089,_0x25469a,_0x354501){return new BPromise(function(_0x288b1d,_0x13163f){return client[_0x6130('0xe')](_0x1db089,_0x354501)[_0x6130('0xf')](function(_0x33b116){logger[_0x6130('0x10')](_0x6130('0x11'),_0x25469a,_0x6130('0x12'));logger[_0x6130('0x13')](_0x6130('0x14'),_0x25469a,_0x6130('0x12'),JSON[_0x6130('0x15')](_0x33b116));if(_0x33b116['error']){if(_0x33b116[_0x6130('0x16')]['code']===0x1f4){logger[_0x6130('0x16')](_0x6130('0x11'),_0x25469a,_0x33b116['error'][_0x6130('0x17')]);return _0x13163f(_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);}logger[_0x6130('0x16')](_0x6130('0x11'),_0x25469a,_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);return _0x288b1d(_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);}else{logger[_0x6130('0x10')](_0x6130('0x11'),_0x25469a,_0x6130('0x12'));_0x288b1d(_0x33b116[_0x6130('0x18')][_0x6130('0x17')]);}})[_0x6130('0x19')](function(_0x46c2e3){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x25469a,_0x46c2e3);_0x13163f(_0x46c2e3);});});}exports[_0x6130('0x1a')]=function(_0x49803e){var _0x1cd785=this;return new Promise(function(_0xb6575d,_0x42d630){return db[_0x6130('0x1b')][_0x6130('0x1c')](_0x49803e['body'],{'raw':_0x49803e[_0x6130('0x1d')]?_0x49803e['options'][_0x6130('0x1e')]===undefined?!![]:![]:!![]})[_0x6130('0xf')](function(_0x18bb78){logger[_0x6130('0x10')](_0x6130('0x1a'),_0x49803e);logger['debug']('CreateCmHopperHistory',_0x49803e,JSON[_0x6130('0x15')](_0x18bb78));_0xb6575d(_0x18bb78);})['catch'](function(_0x30b4f2){logger[_0x6130('0x16')]('CreateCmHopperHistory',_0x30b4f2['message'],_0x49803e);_0x42d630(_0x1cd785['error'](0x1f4,_0x30b4f2[_0x6130('0x17')]));});});};exports['AvgHandleTime']=function(_0x371b84){var _0x574f80=this;return new Promise(function(_0x4ce080,_0x4be8ff){return db['CmHopperHistory']['findAll']({'raw':_0x371b84[_0x6130('0x1d')]?_0x371b84[_0x6130('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x371b84[_0x6130('0x1d')]?_0x371b84['options'][_0x6130('0x1f')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x6130('0x20')][_0x6130('0x21')]('id')),_0x6130('0x22')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x25')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),_0x6130('0x27')],[db[_0x6130('0x20')]['fn'](_0x6130('0x28'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x29')))),_0x6130('0x2a')],[db[_0x6130('0x20')]['fn'](_0x6130('0x28'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x6130('0x2b')]]})['then'](function(_0x5102df){logger['info'](_0x6130('0x2c'),_0x371b84);logger[_0x6130('0x13')](_0x6130('0x2c'),_0x371b84,JSON[_0x6130('0x15')](_0x5102df));_0x4ce080(_0x5102df);})[_0x6130('0x19')](function(_0x3dd737){logger[_0x6130('0x16')](_0x6130('0x2c'),_0x3dd737['message'],_0x371b84);_0x4be8ff(_0x574f80[_0x6130('0x16')](0x1f4,_0x3dd737[_0x6130('0x17')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x46a0e9){var _0x45be47=this;return new Promise(function(_0x61778d,_0x5874cd){return db[_0x6130('0x1b')][_0x6130('0x2d')]({'raw':_0x46a0e9['options']?_0x46a0e9['options'][_0x6130('0x1e')]===undefined?!![]:![]:!![],'where':_0x46a0e9[_0x6130('0x1d')]?_0x46a0e9[_0x6130('0x1d')]['where']||null:null,'attributes':[['campaign',_0x6130('0x2e')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x30')))),_0x6130('0x31')],[db['sequelize']['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x25')))),_0x6130('0x32')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x33')))),'outboundBusyCallsDay'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db['sequelize']['literal'](_0x6130('0x34')))),_0x6130('0x35')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db['sequelize'][_0x6130('0x24')](_0x6130('0x36')))),'outboundDropCallsDayTimeout'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x37')))),_0x6130('0x38')],[db[_0x6130('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6130('0x20')]['literal'](_0x6130('0x39')))),_0x6130('0x3a')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x3b')))),_0x6130('0x3c')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x3d')))),_0x6130('0x3e')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x3f')))),'outboundRejectCallsDay'],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x40')))),_0x6130('0x41')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x42')))),_0x6130('0x43')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db['sequelize']['fn']('IF',db[_0x6130('0x20')][_0x6130('0x24')](_0x6130('0x44')))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0x529977){logger[_0x6130('0x10')](_0x6130('0x45'),_0x46a0e9);logger[_0x6130('0x13')]('GetVoiceQueueHopperHistory',_0x46a0e9,JSON['stringify'](_0x529977));_0x61778d(_0x529977);})['catch'](function(_0x5c8e26){logger[_0x6130('0x16')](_0x6130('0x45'),_0x5c8e26[_0x6130('0x17')],_0x46a0e9);_0x5874cd(_0x45be47[_0x6130('0x16')](0x1f4,_0x5c8e26[_0x6130('0x17')]));});});};exports['GetCampaignHopperHistory']=function(_0x2bc69c){var _0x305d99=this;return new Promise(function(_0x49e3cf,_0x418c88){return db[_0x6130('0x1b')][_0x6130('0x2d')]({'raw':_0x2bc69c[_0x6130('0x1d')]?_0x2bc69c[_0x6130('0x1d')][_0x6130('0x1e')]===undefined?!![]:![]:!![],'where':_0x2bc69c[_0x6130('0x1d')]?_0x2bc69c[_0x6130('0x1d')]['where']||null:null,'attributes':[[_0x6130('0x46'),_0x6130('0x2e')],[db[_0x6130('0x20')]['fn']('COUNT',db['sequelize'][_0x6130('0x21')]('id')),_0x6130('0x47')],[db[_0x6130('0x20')]['fn'](_0x6130('0x23'),db[_0x6130('0x20')]['fn']('IF',db['sequelize'][_0x6130('0x24')](_0x6130('0x25')))),_0x6130('0x48')]],'group':[_0x6130('0x46')]})[_0x6130('0xf')](function(_0x2af363){logger['info']('GetCampaignHopperHistory',_0x2bc69c);logger[_0x6130('0x13')](_0x6130('0x49'),_0x2bc69c,JSON['stringify'](_0x2af363));_0x49e3cf(_0x2af363);})[_0x6130('0x19')](function(_0x22d585){logger[_0x6130('0x16')](_0x6130('0x49'),_0x22d585['message'],_0x2bc69c);_0x418c88(_0x305d99[_0x6130('0x16')](0x1f4,_0x22d585[_0x6130('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index b63d558..7bc4e65 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 _0x0c7f=['./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xb015df,_0x1daab3){var _0x235f8c=function(_0x5c66c5){while(--_0x5c66c5){_0xb015df['push'](_0xb015df['shift']());}};_0x235f8c(++_0x1daab3);}(_0x0c7f,0x1e0));var _0xf0c7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0c7f[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xf0c7('0x0'));var util=require(_0xf0c7('0x1'));var path=require(_0xf0c7('0x2'));var timeout=require(_0xf0c7('0x3'));var express=require('express');var router=express[_0xf0c7('0x4')]();var fs_extra=require(_0xf0c7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf0c7('0x6'));router[_0xf0c7('0x7')]('/',auth[_0xf0c7('0x8')](),controller[_0xf0c7('0x9')]);router[_0xf0c7('0x7')](_0xf0c7('0xa'),auth['isAuthenticated'](),controller[_0xf0c7('0xb')]);router[_0xf0c7('0x7')](_0xf0c7('0xc'),auth[_0xf0c7('0x8')](),controller[_0xf0c7('0xd')]);router[_0xf0c7('0xe')]('/',auth[_0xf0c7('0x8')](),controller[_0xf0c7('0xf')]);router[_0xf0c7('0x10')]('/:id',auth[_0xf0c7('0x8')](),controller[_0xf0c7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5b7e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','post','create','update','exports','multer','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b7e,0x96));var _0xe5b7=function(_0x323fff,_0x38f93e){_0x323fff=_0x323fff-0x0;var _0x326de5=_0x5b7e[_0x323fff];return _0x326de5;};'use strict';var multer=require(_0xe5b7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe5b7('0x1'));var express=require(_0xe5b7('0x2'));var router=express[_0xe5b7('0x3')]();var fs_extra=require(_0xe5b7('0x4'));var auth=require(_0xe5b7('0x5'));var interaction=require(_0xe5b7('0x6'));var config=require(_0xe5b7('0x7'));var controller=require(_0xe5b7('0x8'));router[_0xe5b7('0x9')]('/',auth[_0xe5b7('0xa')](),controller[_0xe5b7('0xb')]);router[_0xe5b7('0x9')]('/describe',auth[_0xe5b7('0xa')](),controller[_0xe5b7('0xc')]);router[_0xe5b7('0x9')]('/:id',auth[_0xe5b7('0xa')](),controller['show']);router[_0xe5b7('0xd')]('/',auth[_0xe5b7('0xa')](),controller[_0xe5b7('0xe')]);router['put']('/:id',auth[_0xe5b7('0xa')](),controller[_0xe5b7('0xf')]);module[_0xe5b7('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 776b54f..6f3c1fd 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 _0xac0a=['STRING','name'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0xac0a,0x11e));var _0xaac0=function(_0x392ca7,_0x414fda){_0x392ca7=_0x392ca7-0x0;var _0x437b50=_0xac0a[_0x392ca7];return _0x437b50;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaac0('0x0')],'unique':_0xaac0('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xaac0('0x0')]}}; \ No newline at end of file +var _0x5075=['exports','STRING','name','sequelize'];(function(_0x9b56de,_0x5a93d4){var _0x1df08e=function(_0x290b5d){while(--_0x290b5d){_0x9b56de['push'](_0x9b56de['shift']());}};_0x1df08e(++_0x5a93d4);}(_0x5075,0x73));var _0x5507=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x5075[_0x1ebce2];return _0x4a330c;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'unique':_0x5507('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5507('0x2')]},'dialPrefix':{'type':Sequelize[_0x5507('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b4973a6..a455ca9 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 _0x3576=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','getDispositions','order','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','pick','raw','getContacts','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','text/csv','addCustomField','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','Lists','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId'];(function(_0x581b8b,_0x8b7124){var _0x5ecf77=function(_0x33cecb){while(--_0x33cecb){_0x581b8b['push'](_0x581b8b['shift']());}};_0x5ecf77(++_0x8b7124);}(_0x3576,0x15d));var _0x6357=function(_0x4edf37,_0x2fa3cc){_0x4edf37=_0x4edf37-0x0;var _0x13884c=_0x3576[_0x4edf37];return _0x13884c;};'use strict';var emlformat=require(_0x6357('0x0'));var rimraf=require(_0x6357('0x1'));var zipdir=require(_0x6357('0x2'));var jsonpatch=require(_0x6357('0x3'));var rp=require(_0x6357('0x4'));var moment=require(_0x6357('0x5'));var BPromise=require(_0x6357('0x6'));var Mustache=require('mustache');var util=require(_0x6357('0x7'));var path=require(_0x6357('0x8'));var sox=require(_0x6357('0x9'));var csv=require(_0x6357('0xa'));var ejs=require(_0x6357('0xb'));var fs=require('fs');var fs_extra=require(_0x6357('0xc'));var _=require('lodash');var squel=require(_0x6357('0xd'));var crypto=require(_0x6357('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6357('0xa'));var querystring=require(_0x6357('0xf'));var Papa=require(_0x6357('0x10'));var Redis=require('ioredis');var authService=require(_0x6357('0x11'));var qs=require(_0x6357('0x12'));var as=require(_0x6357('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6357('0x14'))(_0x6357('0x15'));var utils=require(_0x6357('0x16'));var config=require(_0x6357('0x17'));var licenseUtil=require(_0x6357('0x18'));var db=require(_0x6357('0x19'))['db'];config['redis']=_['defaults'](config[_0x6357('0x1a')],{'host':_0x6357('0x1b'),'port':0x18eb});var socket=require(_0x6357('0x1c'))(new Redis(config[_0x6357('0x1a')]));require(_0x6357('0x1d'))[_0x6357('0x1e')](socket);function respondWithStatusCode(_0x1e1102,_0x56dcec){_0x56dcec=_0x56dcec||0xcc;return function(_0x3f3f66){if(_0x3f3f66){return _0x1e1102[_0x6357('0x1f')](_0x56dcec);}return _0x1e1102[_0x6357('0x20')](_0x56dcec)[_0x6357('0x21')]();};}function respondWithResult(_0x7dfe52,_0x25f265){_0x25f265=_0x25f265||0xc8;return function(_0x50b611){if(_0x50b611){return _0x7dfe52[_0x6357('0x20')](_0x25f265)['json'](_0x50b611);}};}function respondWithFilteredResult(_0x177553,_0x4161bc){return function(_0x3ee2e3){if(_0x3ee2e3){var _0x28b3b3=typeof _0x4161bc[_0x6357('0x22')]==='undefined'&&typeof _0x4161bc[_0x6357('0x23')]===_0x6357('0x24');var _0xf6fa1e=_0x3ee2e3[_0x6357('0x25')];var _0x225bf2=_0x28b3b3?0x0:_0x4161bc['offset'];var _0xd1c219=_0x28b3b3?_0x3ee2e3[_0x6357('0x25')]:_0x4161bc[_0x6357('0x22')]+_0x4161bc[_0x6357('0x23')];var _0x43244b;if(_0xd1c219>=_0xf6fa1e){_0xd1c219=_0xf6fa1e;_0x43244b=0xc8;}else{_0x43244b=0xce;}_0x177553['status'](_0x43244b);return _0x177553[_0x6357('0x26')](_0x6357('0x27'),_0x225bf2+'-'+_0xd1c219+'/'+_0xf6fa1e)[_0x6357('0x28')](_0x3ee2e3);}return null;};}function patchUpdates(_0x3b1444){return function(_0x941c13){try{jsonpatch[_0x6357('0x29')](_0x941c13,_0x3b1444,!![]);}catch(_0x1b7ac8){return BPromise[_0x6357('0x2a')](_0x1b7ac8);}return _0x941c13[_0x6357('0x2b')]();};}function saveUpdates(_0x29ecde,_0x1bc24c){return function(_0x3af1){if(_0x3af1){return _0x3af1['update'](_0x29ecde)[_0x6357('0x2c')](function(_0x25bb36){return _0x25bb36;});}return null;};}function removeEntity(_0x2f2fd9,_0x3f2df3){return function(_0x308586){if(_0x308586){return _0x308586[_0x6357('0x2d')]()[_0x6357('0x2c')](function(){var _0x45c093=_0x308586['get']({'plain':!![]});var _0x422153=_0x6357('0x2e');return db['UserProfileResource'][_0x6357('0x2d')]({'where':{'type':_0x422153,'resourceId':_0x45c093['id']}})[_0x6357('0x2c')](function(){return _0x308586;});})[_0x6357('0x2c')](function(){_0x2f2fd9[_0x6357('0x20')](0xcc)[_0x6357('0x21')]();});}};}function handleEntityNotFound(_0xc415bf,_0x12e017){return function(_0x1159e7){if(!_0x1159e7){_0xc415bf[_0x6357('0x1f')](0x194);}return _0x1159e7;};}function handleError(_0x3dbdf8,_0x5c82ab){_0x5c82ab=_0x5c82ab||0x1f4;return function(_0x4e894b){logger[_0x6357('0x2f')](_0x4e894b[_0x6357('0x30')]);if(_0x4e894b[_0x6357('0x31')]){delete _0x4e894b[_0x6357('0x31')];}_0x3dbdf8[_0x6357('0x20')](_0x5c82ab)[_0x6357('0x32')](_0x4e894b);};}exports[_0x6357('0x33')]=function(_0x2d13e4,_0x9b0ffb){var _0x3f8385={},_0x35b3b7={},_0x372aab={'count':0x0,'rows':[]};var _0x44c929=_[_0x6357('0x34')](db[_0x6357('0x35')][_0x6357('0x36')],function(_0x322547){return{'name':_0x322547[_0x6357('0x37')],'type':_0x322547[_0x6357('0x38')][_0x6357('0x39')]};});_0x35b3b7[_0x6357('0x3a')]=_['map'](_0x44c929,_0x6357('0x31'));_0x35b3b7['query']=_[_0x6357('0x3b')](_0x2d13e4['query']);_0x35b3b7['filters']=_[_0x6357('0x3c')](_0x35b3b7[_0x6357('0x3a')],_0x35b3b7[_0x6357('0x3d')]);_0x3f8385['attributes']=_['intersection'](_0x35b3b7[_0x6357('0x3a')],qs['fields'](_0x2d13e4[_0x6357('0x3d')][_0x6357('0x3e')]));_0x3f8385[_0x6357('0x3f')]=_0x3f8385[_0x6357('0x3f')][_0x6357('0x40')]?_0x3f8385['attributes']:_0x35b3b7[_0x6357('0x3a')];if(!_0x2d13e4[_0x6357('0x3d')][_0x6357('0x41')](_0x6357('0x42'))){_0x3f8385[_0x6357('0x23')]=qs[_0x6357('0x23')](_0x2d13e4[_0x6357('0x3d')][_0x6357('0x23')]);_0x3f8385[_0x6357('0x22')]=qs[_0x6357('0x22')](_0x2d13e4[_0x6357('0x3d')][_0x6357('0x22')]);}_0x3f8385['order']=qs['sort'](_0x2d13e4[_0x6357('0x3d')][_0x6357('0x43')]);_0x3f8385[_0x6357('0x44')]=qs[_0x6357('0x45')](_['pick'](_0x2d13e4[_0x6357('0x3d')],_0x35b3b7[_0x6357('0x45')]),_0x44c929);if(_0x2d13e4[_0x6357('0x3d')][_0x6357('0x46')]){_0x3f8385[_0x6357('0x44')]=_[_0x6357('0x47')](_0x3f8385[_0x6357('0x44')],{'$or':_[_0x6357('0x34')](_0x44c929,function(_0xede200){if(_0xede200['type']!=='VIRTUAL'){var _0x22e061={};_0x22e061[_0xede200[_0x6357('0x31')]]={'$like':'%'+_0x2d13e4[_0x6357('0x3d')][_0x6357('0x46')]+'%'};return _0x22e061;}})});}_0x3f8385=_[_0x6357('0x47')]({},_0x3f8385,_0x2d13e4[_0x6357('0x48')]);var _0x555eba={'where':_0x3f8385[_0x6357('0x44')]};return db[_0x6357('0x35')][_0x6357('0x25')](_0x555eba)[_0x6357('0x2c')](function(_0x207f2b){_0x372aab[_0x6357('0x25')]=_0x207f2b;if(_0x2d13e4[_0x6357('0x3d')][_0x6357('0x49')]){_0x3f8385[_0x6357('0x4a')]=[{'all':!![]}];}return db[_0x6357('0x35')]['findAll'](_0x3f8385);})[_0x6357('0x2c')](function(_0x87027e){_0x372aab[_0x6357('0x4b')]=_0x87027e;return _0x372aab;})[_0x6357('0x2c')](respondWithFilteredResult(_0x9b0ffb,_0x3f8385))[_0x6357('0x4c')](handleError(_0x9b0ffb,null));};exports[_0x6357('0x4d')]=function(_0xf3bdb5,_0x1e9f60){var _0x4e50d4={'raw':![],'where':{'id':_0xf3bdb5[_0x6357('0x4e')]['id']}},_0x5e635a={};_0x5e635a['model']=_[_0x6357('0x3b')](db[_0x6357('0x35')][_0x6357('0x36')]);_0x5e635a[_0x6357('0x3d')]=_[_0x6357('0x3b')](_0xf3bdb5['query']);_0x5e635a['filters']=_[_0x6357('0x3c')](_0x5e635a[_0x6357('0x3a')],_0x5e635a[_0x6357('0x3d')]);_0x4e50d4[_0x6357('0x3f')]=_['intersection'](_0x5e635a[_0x6357('0x3a')],qs[_0x6357('0x3e')](_0xf3bdb5[_0x6357('0x3d')][_0x6357('0x3e')]));_0x4e50d4[_0x6357('0x3f')]=_0x4e50d4['attributes'][_0x6357('0x40')]?_0x4e50d4[_0x6357('0x3f')]:_0x5e635a['model'];if(_0xf3bdb5[_0x6357('0x3d')][_0x6357('0x49')]){_0x4e50d4['include']=[{'all':!![]}];}_0x4e50d4=_[_0x6357('0x47')]({},_0x4e50d4,_0xf3bdb5[_0x6357('0x48')]);return db[_0x6357('0x35')]['find'](_0x4e50d4)[_0x6357('0x2c')](handleEntityNotFound(_0x1e9f60,null))['then'](respondWithResult(_0x1e9f60,null))[_0x6357('0x4c')](handleError(_0x1e9f60,null));};exports[_0x6357('0x4f')]=function(_0x310a50,_0x61eb5a){return db['CmList'][_0x6357('0x4f')](_0x310a50['body'],{})[_0x6357('0x2c')](function(_0x5e0194){var _0x2a1d61=_0x310a50[_0x6357('0x50')]['get']({'plain':!![]});if(!_0x2a1d61)throw new Error(_0x6357('0x51'));if(_0x2a1d61['role']===_0x6357('0x50')){var _0x2dc216=_0x5e0194[_0x6357('0x52')]({'plain':!![]});var _0x28b404=_0x6357('0x2e');return db[_0x6357('0x53')][_0x6357('0x54')]({'where':{'name':_0x28b404,'userProfileId':_0x2a1d61[_0x6357('0x55')]},'raw':!![]})[_0x6357('0x2c')](function(_0x2b79bd){if(_0x2b79bd&&_0x2b79bd[_0x6357('0x56')]===0x0){return db[_0x6357('0x57')]['create']({'name':_0x2dc216['name'],'resourceId':_0x2dc216['id'],'type':_0x2b79bd[_0x6357('0x31')],'sectionId':_0x2b79bd['id']},{})[_0x6357('0x2c')](function(){return _0x5e0194;});}else{return _0x5e0194;}})[_0x6357('0x4c')](function(_0x9a3829){logger['error'](_0x6357('0x58'),_0x9a3829);throw _0x9a3829;});}return _0x5e0194;})[_0x6357('0x2c')](respondWithResult(_0x61eb5a,0xc9))[_0x6357('0x4c')](handleError(_0x61eb5a,null));};exports['update']=function(_0x4f0f75,_0x4566f9){if(_0x4f0f75[_0x6357('0x59')]['id']){delete _0x4f0f75[_0x6357('0x59')]['id'];}return db[_0x6357('0x35')][_0x6357('0x54')]({'where':{'id':_0x4f0f75[_0x6357('0x4e')]['id']}})[_0x6357('0x2c')](handleEntityNotFound(_0x4566f9,null))[_0x6357('0x2c')](saveUpdates(_0x4f0f75['body'],null))[_0x6357('0x2c')](respondWithResult(_0x4566f9,null))[_0x6357('0x4c')](handleError(_0x4566f9,null));};exports[_0x6357('0x2d')]=function(_0x187991,_0x196eea){return db[_0x6357('0x35')][_0x6357('0x54')]({'where':{'id':_0x187991[_0x6357('0x4e')]['id']}})[_0x6357('0x2c')](handleEntityNotFound(_0x196eea,null))['then'](removeEntity(_0x196eea,null))[_0x6357('0x4c')](handleError(_0x196eea,null));};exports['describe']=function(_0xda506a,_0x416c01){return db[_0x6357('0x35')][_0x6357('0x5a')]()['then'](respondWithResult(_0x416c01,null))[_0x6357('0x4c')](handleError(_0x416c01,null));};exports[_0x6357('0x5b')]=function(_0x1be8a5,_0x421211,_0x427de4){if(_0x1be8a5[_0x6357('0x59')]['id']){delete _0x1be8a5[_0x6357('0x59')]['id'];}return db[_0x6357('0x35')]['find']({'where':{'id':_0x1be8a5[_0x6357('0x4e')]['id']}})['then'](handleEntityNotFound(_0x421211,null))[_0x6357('0x2c')](function(_0x351f3c){if(_0x351f3c){_0x1be8a5['body'][_0x6357('0x5c')]=_0x351f3c['id'];return db[_0x6357('0x5d')][_0x6357('0x4f')](_0x1be8a5['body']);}})['then'](respondWithResult(_0x421211,null))[_0x6357('0x4c')](handleError(_0x421211,null));};exports[_0x6357('0x5e')]=function(_0x47a0ff,_0x594e0f,_0x4af783){var _0x21206c={'raw':![],'where':{}};var _0x5d3216={};var _0x395756={'count':0x0,'rows':[]};return db[_0x6357('0x35')]['findOne']({'where':{'id':_0x47a0ff[_0x6357('0x4e')]['id']}})[_0x6357('0x2c')](handleEntityNotFound(_0x594e0f,null))['then'](function(_0x456f69){if(_0x456f69){_0x5d3216[_0x6357('0x3a')]=_[_0x6357('0x3b')](db['Disposition'][_0x6357('0x36')]);_0x5d3216[_0x6357('0x3d')]=_[_0x6357('0x3b')](_0x47a0ff[_0x6357('0x3d')]);_0x5d3216[_0x6357('0x45')]=_['intersection'](_0x5d3216[_0x6357('0x3a')],_0x5d3216[_0x6357('0x3d')]);_0x21206c[_0x6357('0x3f')]=_['intersection'](_0x5d3216[_0x6357('0x3a')],qs[_0x6357('0x3e')](_0x47a0ff[_0x6357('0x3d')][_0x6357('0x3e')]));_0x21206c[_0x6357('0x3f')]=_0x21206c['attributes'][_0x6357('0x40')]?_0x21206c[_0x6357('0x3f')]:_0x5d3216[_0x6357('0x3a')];if(!_0x47a0ff[_0x6357('0x3d')]['hasOwnProperty'](_0x6357('0x42'))){_0x21206c[_0x6357('0x23')]=qs[_0x6357('0x23')](_0x47a0ff[_0x6357('0x3d')]['limit']);_0x21206c[_0x6357('0x22')]=qs[_0x6357('0x22')](_0x47a0ff[_0x6357('0x3d')][_0x6357('0x22')]);}_0x21206c[_0x6357('0x5f')]=qs[_0x6357('0x43')](_0x47a0ff[_0x6357('0x3d')][_0x6357('0x43')]);_0x21206c[_0x6357('0x44')]=qs['filters'](_['pick'](_0x47a0ff[_0x6357('0x3d')],_0x5d3216[_0x6357('0x45')]));_0x21206c['where'][_0x6357('0x5c')]=_0x456f69['id'];if(_0x47a0ff[_0x6357('0x3d')][_0x6357('0x46')]){_0x21206c[_0x6357('0x44')]=_[_0x6357('0x47')](_0x21206c[_0x6357('0x44')],{'$or':_[_0x6357('0x34')](_0x21206c[_0x6357('0x3f')],function(_0x1c3c62){var _0x3f9f7f={};_0x3f9f7f[_0x1c3c62]={'$like':'%'+_0x47a0ff[_0x6357('0x3d')]['filter']+'%'};return _0x3f9f7f;})});}_0x21206c=_[_0x6357('0x47')]({},_0x21206c,_0x47a0ff[_0x6357('0x48')]);return db[_0x6357('0x5d')][_0x6357('0x25')]({'where':_0x21206c[_0x6357('0x44')]})['then'](function(_0x4572a1){_0x395756['count']=_0x4572a1;if(_0x47a0ff[_0x6357('0x3d')]['includeAll']){_0x21206c['include']=[{'all':!![]}];}return db[_0x6357('0x5d')]['findAll'](_0x21206c);})[_0x6357('0x2c')](function(_0x10729a){_0x395756[_0x6357('0x4b')]=_0x10729a;return _0x395756;});}})[_0x6357('0x2c')](respondWithFilteredResult(_0x594e0f,_0x21206c))[_0x6357('0x4c')](handleError(_0x594e0f,null));};exports[_0x6357('0x60')]=function(_0x5c45c7,_0x150019,_0x46f3ed){return db['CmList'][_0x6357('0x54')]({'where':{'id':_0x5c45c7['params']['id']}})[_0x6357('0x2c')](handleEntityNotFound(_0x150019,null))[_0x6357('0x2c')](function(_0x1e7f7b){if(_0x1e7f7b){return _0x1e7f7b['removeDispositions'](_0x5c45c7['query'][_0x6357('0x61')]);}})[_0x6357('0x2c')](respondWithStatusCode(_0x150019,null))[_0x6357('0x4c')](handleError(_0x150019,null));};exports[_0x6357('0x62')]=function(_0x19b563,_0x1e0515,_0x1a35a4){return db[_0x6357('0x35')][_0x6357('0x54')]({'where':{'id':_0x19b563[_0x6357('0x4e')]['id']}})[_0x6357('0x2c')](handleEntityNotFound(_0x1e0515,null))[_0x6357('0x2c')](function(_0x3ef5af){if(_0x3ef5af){var _0x45b4ab=[];var _0x29d493={'success':[],'errors':[]};return db[_0x6357('0x63')][_0x6357('0x5a')]()[_0x6357('0x2c')](function(_0x3b396c){if(_0x19b563[_0x6357('0x59')][_0x6357('0x64')]&&_['isArray'](_0x19b563['body'][_0x6357('0x64')])){if(_0x19b563['body']['tags']['length']){_0x19b563['body'][_0x6357('0x64')]=_0x19b563[_0x6357('0x59')][_0x6357('0x64')]['join'](';')+';';}else{_0x19b563['body'][_0x6357('0x64')]=null;}}else{_0x19b563['body'][_0x6357('0x64')]=null;}if(_0x19b563[_0x6357('0x59')]&&_[_0x6357('0x65')](_0x19b563['body'])){for(var _0x911c8a=0x0;_0x911c8a<_0x19b563['body'][_0x6357('0x40')];_0x911c8a+=0x1){_0x19b563[_0x6357('0x59')][_0x911c8a][_0x6357('0x5c')]=_0x19b563[_0x6357('0x4e')]['id'];_0x45b4ab[_0x6357('0x66')](_0x19b563[_0x6357('0x59')][_0x911c8a]);}return BPromise[_0x6357('0x67')](_0x45b4ab,function(_0x47d4b0){return db['CmContact'][_0x6357('0x4f')](_[_0x6357('0x68')](_0x47d4b0,[_0x6357('0x61'),'id'])||{},{'fields':_[_0x6357('0x3b')](_0x3b396c),'raw':!![]})[_0x6357('0x2c')](function(_0x5eefb2){_0x29d493['success'][_0x6357('0x66')](_0x5eefb2[_0x6357('0x69')]);})[_0x6357('0x4c')](function(_0x5eda6c){_0x29d493[_0x6357('0x6a')][_0x6357('0x66')]({'data':_0x47d4b0,'error':_0x5eda6c['message']});});})[_0x6357('0x2c')](function(_0x50b457){return _0x29d493;})[_0x6357('0x4c')](function(_0x482ae7){return _0x482ae7;});}else{_0x1e0515[_0x6357('0x20')](0x190)[_0x6357('0x28')]({'message':_0x6357('0x6b')});}});}})[_0x6357('0x2c')](respondWithResult(_0x1e0515,null))[_0x6357('0x4c')](handleError(_0x1e0515,null));};exports['getContacts']=function(_0x15e07a,_0x5c6f2a,_0x176ca9){var _0x1d3b46;return db[_0x6357('0x35')][_0x6357('0x54')]({'where':{'id':_0x15e07a[_0x6357('0x4e')]['id']},'include':[{'model':db[_0x6357('0x6c')],'as':_0x6357('0x6d')}]})['then'](handleEntityNotFound(_0x5c6f2a,null))['then'](function(_0x48e9d2){if(_0x48e9d2){_0x1d3b46=_0x48e9d2;return db[_0x6357('0x63')][_0x6357('0x36')];}})['then'](function(_0x4319cb){if(_0x4319cb){var _0x24725a={};var _0x1304f5={};_0x1304f5[_0x6357('0x3a')]=_[_0x6357('0x6e')](_['keys'](_0x4319cb),_[_0x6357('0x34')](_0x1d3b46[_0x6357('0x6d')],function(_0x314609){return util[_0x6357('0x6f')](_0x6357('0x70'),_0x314609['id']);}));_0x1304f5['query']=_[_0x6357('0x3b')](_0x15e07a[_0x6357('0x3d')]);_0x1304f5['filters']=_[_0x6357('0x3c')](_0x1304f5['model'],_0x1304f5[_0x6357('0x3d')]);_0x24725a['attributes']=_[_0x6357('0x3c')](_0x1304f5[_0x6357('0x3a')],qs[_0x6357('0x3e')](_0x15e07a[_0x6357('0x3d')][_0x6357('0x3e')]));_0x24725a[_0x6357('0x3f')]=_0x24725a['attributes'][_0x6357('0x40')]?_0x24725a[_0x6357('0x3f')]:_0x1304f5[_0x6357('0x3a')];if(!_0x15e07a[_0x6357('0x3d')]['hasOwnProperty'](_0x6357('0x42'))){_0x24725a[_0x6357('0x23')]=qs[_0x6357('0x23')](_0x15e07a[_0x6357('0x3d')][_0x6357('0x23')]);_0x24725a[_0x6357('0x22')]=qs[_0x6357('0x22')](_0x15e07a[_0x6357('0x3d')][_0x6357('0x22')]);}_0x24725a['order']=qs[_0x6357('0x43')](_0x15e07a['query']['sort']);_0x24725a[_0x6357('0x44')]=qs['filters'](_[_0x6357('0x71')](_0x15e07a[_0x6357('0x3d')],_0x1304f5['filters']));_0x24725a[_0x6357('0x72')]=!![];if(_0x15e07a['query']['filter']){_0x24725a[_0x6357('0x44')]=_[_0x6357('0x47')](_0x24725a[_0x6357('0x44')],{'$or':_[_0x6357('0x34')](_0x24725a['attributes'],function(_0x13f141){var _0x59ed48={};_0x59ed48[_0x13f141]={'$like':'%'+_0x15e07a['query'][_0x6357('0x46')]+'%'};return _0x59ed48;})});}_0x24725a=_['merge']({},_0x24725a,_0x15e07a[_0x6357('0x48')]);return _0x1d3b46[_0x6357('0x73')](_0x24725a);}})['then'](respondWithResult(_0x5c6f2a,null))[_0x6357('0x4c')](handleError(_0x5c6f2a,null));};exports['getContactsCsv']=function(_0x6684c3,_0x3cd079,_0x210cab){var _0x42bc32;return db[_0x6357('0x35')][_0x6357('0x54')]({'where':{'id':_0x6684c3[_0x6357('0x4e')]['id']},'include':[{'model':db[_0x6357('0x6c')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x3cd079,null))[_0x6357('0x2c')](function(_0x3b416f){if(_0x3b416f){_0x42bc32=_0x3b416f;return db[_0x6357('0x63')][_0x6357('0x36')];}})[_0x6357('0x2c')](function(_0x16b6c4){if(_0x16b6c4){var _0x8c5f3f={};var _0x2eec00={};_0x2eec00[_0x6357('0x3a')]=_[_0x6357('0x6e')](_[_0x6357('0x3b')](_0x16b6c4),_[_0x6357('0x34')](_0x42bc32['CustomFields'],function(_0x103758){return util[_0x6357('0x6f')](_0x6357('0x70'),_0x103758['id']);}));_0x2eec00[_0x6357('0x3d')]=_[_0x6357('0x3b')](_0x6684c3[_0x6357('0x3d')]);_0x2eec00['filters']=_[_0x6357('0x3c')](_0x2eec00[_0x6357('0x3a')],_0x2eec00['query']);_0x8c5f3f['attributes']=_[_0x6357('0x3c')](_0x2eec00['model'],qs[_0x6357('0x3e')](_0x6684c3['query'][_0x6357('0x3e')]));_0x8c5f3f[_0x6357('0x3f')]=_0x8c5f3f[_0x6357('0x3f')][_0x6357('0x40')]?_0x8c5f3f['attributes']:_0x2eec00[_0x6357('0x3a')];if(!_0x6684c3['query'][_0x6357('0x41')]('nolimit')){_0x8c5f3f[_0x6357('0x23')]=qs[_0x6357('0x23')](_0x6684c3['query'][_0x6357('0x23')]);_0x8c5f3f['offset']=qs['offset'](_0x6684c3[_0x6357('0x3d')][_0x6357('0x22')]);}_0x8c5f3f[_0x6357('0x5f')]=qs['sort'](_0x6684c3[_0x6357('0x3d')][_0x6357('0x43')]);_0x8c5f3f['where']=qs[_0x6357('0x45')](_[_0x6357('0x71')](_0x6684c3[_0x6357('0x3d')],_0x2eec00['filters']));_0x8c5f3f[_0x6357('0x72')]=!![];if(_0x6684c3['query'][_0x6357('0x46')]){_0x8c5f3f['where']=_[_0x6357('0x47')](_0x8c5f3f[_0x6357('0x44')],{'$or':_['map'](_0x8c5f3f[_0x6357('0x3f')],function(_0x2a14da){var _0x276b26={};_0x276b26[_0x2a14da]={'$like':'%'+_0x6684c3[_0x6357('0x3d')][_0x6357('0x46')]+'%'};return _0x276b26;})});}_0x8c5f3f=_[_0x6357('0x47')]({},_0x8c5f3f,_0x6684c3[_0x6357('0x48')]);return _0x42bc32[_0x6357('0x73')](_0x8c5f3f);}})[_0x6357('0x2c')](function(_0x1a1337){if(!_[_0x6357('0x74')](_0x1a1337)){var _0x2ade1c=toCsv(_0x1a1337);var _0xe79b9a=Date[_0x6357('0x75')]();fs[_0x6357('0x76')](util[_0x6357('0x6f')](_0x6357('0x77'),_0x42bc32['id'],_0xe79b9a),_0x2ade1c);_0x3cd079[_0x6357('0x78')]('Content-disposition','attachment;\x20filename='+util[_0x6357('0x6f')](_0x6357('0x79'),_0x42bc32['id'],_0xe79b9a));_0x3cd079[_0x6357('0x78')]('Content-type',_0x6357('0x7a'));return _0x3cd079['download'](util[_0x6357('0x6f')]('/tmp/list_%d_%s.csv',_0x42bc32['id'],_0xe79b9a));}else{return _0x3cd079[_0x6357('0x1f')](0xcc);}})[_0x6357('0x4c')](handleError(_0x3cd079,null));};exports[_0x6357('0x7b')]=function(_0x1a7c23,_0x26f00e,_0x5b7722){var _0x50a0e8;delete _0x1a7c23[_0x6357('0x59')]['id'];return db[_0x6357('0x35')][_0x6357('0x7c')]({'where':{'id':_0x1a7c23[_0x6357('0x4e')]['id']}})[_0x6357('0x2c')](handleEntityNotFound(_0x26f00e,null))[_0x6357('0x2c')](function(_0x2d118a){if(_0x2d118a){return db[_0x6357('0x7d')]['transaction'](function(_0x4483ac){return db[_0x6357('0x6c')][_0x6357('0x4f')](_0x1a7c23[_0x6357('0x59')],{'transaction':_0x4483ac})[_0x6357('0x2c')](function(_0xb9d8ca){_0x50a0e8=_0xb9d8ca;return _0x2d118a[_0x6357('0x7e')](_0xb9d8ca,{'transaction':_0x4483ac});})[_0x6357('0x2c')](function(){var _0x3410f2={'type':db[_0x6357('0x7f')][_0x6357('0x80')],'transaction':_0x4483ac};switch(_0x1a7c23[_0x6357('0x59')]['type']){case _0x6357('0x81'):_0x3410f2['type']=db[_0x6357('0x7f')][_0x6357('0x80')];break;case'number':_0x3410f2[_0x6357('0x38')]=db[_0x6357('0x7f')][_0x6357('0x82')];break;case _0x6357('0x83'):_0x3410f2[_0x6357('0x38')]=db[_0x6357('0x7f')][_0x6357('0x84')];_0x3410f2[_0x6357('0x85')]=![];break;default:}return db[_0x6357('0x7d')][_0x6357('0x86')][_0x6357('0x87')](_0x6357('0x88'),util[_0x6357('0x6f')](_0x6357('0x89'),_0x50a0e8['id']),_0x3410f2);})[_0x6357('0x2c')](function(){return _0x50a0e8;});});}})['then'](respondWithResult(_0x26f00e,null))[_0x6357('0x4c')](handleError(_0x26f00e,null));};exports['getCustomFields']=function(_0x3bc722,_0x10e877,_0x19d0ab){var _0x2e34a1={};var _0x448f7e={};var _0x535b4a;var _0x298e6f;return db[_0x6357('0x35')][_0x6357('0x7c')]({'where':{'id':_0x3bc722['params']['id']}})['then'](handleEntityNotFound(_0x10e877,null))[_0x6357('0x2c')](function(_0x9a5b21){if(_0x9a5b21){_0x535b4a=_0x9a5b21;_0x448f7e[_0x6357('0x3a')]=_[_0x6357('0x3b')](db[_0x6357('0x6c')]['rawAttributes']);_0x448f7e[_0x6357('0x3d')]=_['keys'](_0x3bc722[_0x6357('0x3d')]);_0x448f7e[_0x6357('0x45')]=_[_0x6357('0x3c')](_0x448f7e['model'],_0x448f7e[_0x6357('0x3d')]);_0x2e34a1['attributes']=_['intersection'](_0x448f7e[_0x6357('0x3a')],qs[_0x6357('0x3e')](_0x3bc722[_0x6357('0x3d')][_0x6357('0x3e')]));_0x2e34a1[_0x6357('0x3f')]=_0x2e34a1[_0x6357('0x3f')]['length']?_0x2e34a1[_0x6357('0x3f')]:_0x448f7e['model'];_0x2e34a1[_0x6357('0x5f')]=qs['sort'](_0x3bc722['query'][_0x6357('0x43')]);_0x2e34a1['where']=qs['filters'](_[_0x6357('0x71')](_0x3bc722['query'],_0x448f7e['filters']));_0x2e34a1[_0x6357('0x44')]=_[_0x6357('0x47')](_0x2e34a1[_0x6357('0x44')],{'$or':[{'ListId':_0x9a5b21['id']},{'ListId':null}]});if(_0x3bc722['query'][_0x6357('0x46')]){_0x2e34a1[_0x6357('0x44')]=_[_0x6357('0x47')](_0x2e34a1[_0x6357('0x44')],{'$or':_[_0x6357('0x34')](_0x2e34a1[_0x6357('0x3f')],function(_0x176290){var _0xeef6f={};_0xeef6f[_0x176290]={'$like':'%'+_0x3bc722[_0x6357('0x3d')][_0x6357('0x46')]+'%'};return _0xeef6f;})});}_0x2e34a1=_[_0x6357('0x47')]({},_0x2e34a1,_0x3bc722[_0x6357('0x48')]);return db[_0x6357('0x6c')][_0x6357('0x8a')](_0x2e34a1);}})[_0x6357('0x2c')](respondWithResult(_0x10e877,null))['catch'](handleError(_0x10e877,null));};exports[_0x6357('0x8b')]=function(_0x4ce777,_0x10215c,_0x59d67b){return db[_0x6357('0x35')][_0x6357('0x54')]({'where':{'id':_0x4ce777['params']['id']}})[_0x6357('0x2c')](handleEntityNotFound(_0x10215c,null))[_0x6357('0x2c')](function(_0x151c49){if(_0x151c49){return _0x151c49['addAgents'](_0x4ce777[_0x6357('0x59')][_0x6357('0x61')],_[_0x6357('0x68')](_0x4ce777[_0x6357('0x59')],[_0x6357('0x61'),'id'])||{})['spread'](function(_0x472eeb){for(var _0x1d40c2=0x0;_0x1d40c2<_0x4ce777['body'][_0x6357('0x61')]['length'];_0x1d40c2+=0x1){socket[_0x6357('0x8c')]('userCmList:save',{'UserId':Number(_0x4ce777[_0x6357('0x59')]['ids'][_0x1d40c2]),'CmListId':Number(_0x4ce777[_0x6357('0x4e')]['id'])});}return _0x472eeb;});}})[_0x6357('0x2c')](respondWithResult(_0x10215c,null))[_0x6357('0x4c')](handleError(_0x10215c,null));};exports[_0x6357('0x8d')]=function(_0x22b59e,_0x5edfe2,_0x433a71){return db[_0x6357('0x35')]['find']({'where':{'id':_0x22b59e[_0x6357('0x4e')]['id']}})[_0x6357('0x2c')](handleEntityNotFound(_0x5edfe2,null))[_0x6357('0x2c')](function(_0x2d7562){if(_0x2d7562){return _0x2d7562[_0x6357('0x8d')](_0x22b59e[_0x6357('0x3d')]['ids'])[_0x6357('0x2c')](function(){if(_[_0x6357('0x65')](_0x22b59e[_0x6357('0x3d')]['ids'])){for(var _0x21d01a=0x0;_0x21d01a<_0x22b59e[_0x6357('0x3d')]['ids'][_0x6357('0x40')];_0x21d01a+=0x1){socket[_0x6357('0x8c')](_0x6357('0x8e'),{'UserId':Number(_0x22b59e[_0x6357('0x3d')]['ids'][_0x21d01a]),'CmListId':Number(_0x22b59e[_0x6357('0x4e')]['id'])});}}else{socket[_0x6357('0x8c')]('userCmList:remove',{'UserId':Number(_0x22b59e[_0x6357('0x3d')]['ids']),'CmListId':Number(_0x22b59e[_0x6357('0x4e')]['id'])});}});}})[_0x6357('0x2c')](respondWithStatusCode(_0x5edfe2,null))['catch'](handleError(_0x5edfe2,null));};exports[_0x6357('0x8f')]=function(_0x3ddfc4,_0x23e873,_0x52775f){var _0x4a2b7a={};var _0x51b3ea={};var _0x5ec51c;var _0x5a7b8b;return db['CmList'][_0x6357('0x7c')]({'where':{'id':_0x3ddfc4[_0x6357('0x4e')]['id']}})['then'](handleEntityNotFound(_0x23e873,null))[_0x6357('0x2c')](function(_0x27ca40){if(_0x27ca40){_0x5ec51c=_0x27ca40;_0x51b3ea[_0x6357('0x3a')]=_[_0x6357('0x3b')](db[_0x6357('0x90')][_0x6357('0x36')]);_0x51b3ea['query']=_[_0x6357('0x3b')](_0x3ddfc4[_0x6357('0x3d')]);_0x51b3ea[_0x6357('0x45')]=_[_0x6357('0x3c')](_0x51b3ea['model'],_0x51b3ea[_0x6357('0x3d')]);_0x4a2b7a['attributes']=_[_0x6357('0x3c')](_0x51b3ea[_0x6357('0x3a')],qs[_0x6357('0x3e')](_0x3ddfc4['query']['fields']));_0x4a2b7a[_0x6357('0x3f')]=_0x4a2b7a[_0x6357('0x3f')][_0x6357('0x40')]?_0x4a2b7a[_0x6357('0x3f')]:_0x51b3ea[_0x6357('0x3a')];_0x4a2b7a[_0x6357('0x5f')]=qs[_0x6357('0x43')](_0x3ddfc4[_0x6357('0x3d')]['sort']);_0x4a2b7a['where']=qs[_0x6357('0x45')](_[_0x6357('0x71')](_0x3ddfc4[_0x6357('0x3d')],_0x51b3ea['filters']));if(_0x3ddfc4[_0x6357('0x3d')]['filter']){_0x4a2b7a[_0x6357('0x44')]=_['merge'](_0x4a2b7a[_0x6357('0x44')],{'$or':_[_0x6357('0x34')](_0x4a2b7a['attributes'],function(_0x550aa7){var _0xf24ae={};_0xf24ae[_0x550aa7]={'$like':'%'+_0x3ddfc4[_0x6357('0x3d')][_0x6357('0x46')]+'%'};return _0xf24ae;})});}_0x4a2b7a=_[_0x6357('0x47')]({},_0x4a2b7a,_0x3ddfc4[_0x6357('0x48')]);return _0x5ec51c[_0x6357('0x8f')](_0x4a2b7a);}})['then'](function(_0x3c118c){if(_0x3c118c){_0x5a7b8b=_0x3c118c['length'];if(!_0x3ddfc4[_0x6357('0x3d')][_0x6357('0x41')](_0x6357('0x42'))){_0x4a2b7a[_0x6357('0x23')]=qs[_0x6357('0x23')](_0x3ddfc4[_0x6357('0x3d')][_0x6357('0x23')]);_0x4a2b7a[_0x6357('0x22')]=qs[_0x6357('0x22')](_0x3ddfc4[_0x6357('0x3d')][_0x6357('0x22')]);}return _0x5ec51c[_0x6357('0x8f')](_0x4a2b7a);}})['then'](function(_0x3b68d1){if(_0x3b68d1){return _0x3b68d1?{'count':_0x5a7b8b,'rows':_0x3b68d1}:null;}})[_0x6357('0x2c')](respondWithResult(_0x23e873,null))[_0x6357('0x4c')](handleError(_0x23e873,null));}; \ No newline at end of file +var _0x4385=['removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','CmCustomField','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','save','then','destroy','Lists','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','findOne','keys','fields','findAll'];(function(_0x1df6c0,_0x132faa){var _0x3c0ccb=function(_0x439cdc){while(--_0x439cdc){_0x1df6c0['push'](_0x1df6c0['shift']());}};_0x3c0ccb(++_0x132faa);}(_0x4385,0x168));var _0x5438=function(_0xe4e1cd,_0x3ab00c){_0xe4e1cd=_0xe4e1cd-0x0;var _0x2ab3d0=_0x4385[_0xe4e1cd];return _0x2ab3d0;};'use strict';var emlformat=require(_0x5438('0x0'));var rimraf=require(_0x5438('0x1'));var zipdir=require(_0x5438('0x2'));var jsonpatch=require(_0x5438('0x3'));var rp=require('request-promise');var moment=require(_0x5438('0x4'));var BPromise=require(_0x5438('0x5'));var Mustache=require(_0x5438('0x6'));var util=require(_0x5438('0x7'));var path=require(_0x5438('0x8'));var sox=require(_0x5438('0x9'));var csv=require(_0x5438('0xa'));var ejs=require(_0x5438('0xb'));var fs=require('fs');var fs_extra=require(_0x5438('0xc'));var _=require(_0x5438('0xd'));var squel=require(_0x5438('0xe'));var crypto=require(_0x5438('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5438('0x10'));var toCsv=require(_0x5438('0xa'));var querystring=require(_0x5438('0x11'));var Papa=require(_0x5438('0x12'));var Redis=require('ioredis');var authService=require(_0x5438('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5438('0x14'));var hardwareService=require(_0x5438('0x15'));var logger=require(_0x5438('0x16'))('api');var utils=require(_0x5438('0x17'));var config=require(_0x5438('0x18'));var licenseUtil=require(_0x5438('0x19'));var db=require(_0x5438('0x1a'))['db'];config[_0x5438('0x1b')]=_[_0x5438('0x1c')](config[_0x5438('0x1b')],{'host':_0x5438('0x1d'),'port':0x18eb});var socket=require(_0x5438('0x1e'))(new Redis(config[_0x5438('0x1b')]));require(_0x5438('0x1f'))[_0x5438('0x20')](socket);function respondWithStatusCode(_0x535b94,_0x3010a3){_0x3010a3=_0x3010a3||0xcc;return function(_0x52ee74){if(_0x52ee74){return _0x535b94[_0x5438('0x21')](_0x3010a3);}return _0x535b94[_0x5438('0x22')](_0x3010a3)['end']();};}function respondWithResult(_0x55919d,_0x1483d5){_0x1483d5=_0x1483d5||0xc8;return function(_0x54db4d){if(_0x54db4d){return _0x55919d[_0x5438('0x22')](_0x1483d5)['json'](_0x54db4d);}};}function respondWithFilteredResult(_0x16c9ed,_0x4647a8){return function(_0x491ce0){if(_0x491ce0){var _0x1c73b4=typeof _0x4647a8[_0x5438('0x23')]===_0x5438('0x24')&&typeof _0x4647a8[_0x5438('0x25')]===_0x5438('0x24');var _0x391e8f=_0x491ce0[_0x5438('0x26')];var _0x4bb5f4=_0x1c73b4?0x0:_0x4647a8[_0x5438('0x23')];var _0xe6845c=_0x1c73b4?_0x491ce0[_0x5438('0x26')]:_0x4647a8[_0x5438('0x23')]+_0x4647a8[_0x5438('0x25')];var _0x4f13fa;if(_0xe6845c>=_0x391e8f){_0xe6845c=_0x391e8f;_0x4f13fa=0xc8;}else{_0x4f13fa=0xce;}_0x16c9ed[_0x5438('0x22')](_0x4f13fa);return _0x16c9ed[_0x5438('0x27')]('Content-Range',_0x4bb5f4+'-'+_0xe6845c+'/'+_0x391e8f)[_0x5438('0x28')](_0x491ce0);}return null;};}function patchUpdates(_0x2bf7dd){return function(_0x43bcd5){try{jsonpatch['apply'](_0x43bcd5,_0x2bf7dd,!![]);}catch(_0xbbf322){return BPromise['reject'](_0xbbf322);}return _0x43bcd5[_0x5438('0x29')]();};}function saveUpdates(_0x3a93fc,_0xe8a3dd){return function(_0x3d3372){if(_0x3d3372){return _0x3d3372['update'](_0x3a93fc)[_0x5438('0x2a')](function(_0x2a4a82){return _0x2a4a82;});}return null;};}function removeEntity(_0x90706d,_0x2b58be){return function(_0x20062d){if(_0x20062d){return _0x20062d[_0x5438('0x2b')]()[_0x5438('0x2a')](function(){var _0x51fb84=_0x20062d['get']({'plain':!![]});var _0x225c19=_0x5438('0x2c');return db[_0x5438('0x2d')]['destroy']({'where':{'type':_0x225c19,'resourceId':_0x51fb84['id']}})[_0x5438('0x2a')](function(){return _0x20062d;});})[_0x5438('0x2a')](function(){_0x90706d[_0x5438('0x22')](0xcc)[_0x5438('0x2e')]();});}};}function handleEntityNotFound(_0xea2744,_0x1837fd){return function(_0x3b4881){if(!_0x3b4881){_0xea2744['sendStatus'](0x194);}return _0x3b4881;};}function handleError(_0x37953e,_0x2a67e9){_0x2a67e9=_0x2a67e9||0x1f4;return function(_0x43a3a1){logger[_0x5438('0x2f')](_0x43a3a1[_0x5438('0x30')]);if(_0x43a3a1[_0x5438('0x31')]){delete _0x43a3a1[_0x5438('0x31')];}_0x37953e['status'](_0x2a67e9)[_0x5438('0x32')](_0x43a3a1);};}exports[_0x5438('0x33')]=function(_0x4b88ad,_0x24e729){var _0x106c7b={},_0x54c638={},_0x34c2e3={'count':0x0,'rows':[]};var _0x2c3a84=_[_0x5438('0x34')](db[_0x5438('0x35')][_0x5438('0x36')],function(_0x39d456){return{'name':_0x39d456[_0x5438('0x37')],'type':_0x39d456[_0x5438('0x38')][_0x5438('0x39')]};});_0x54c638[_0x5438('0x3a')]=_['map'](_0x2c3a84,_0x5438('0x31'));_0x54c638[_0x5438('0x3b')]=_['keys'](_0x4b88ad[_0x5438('0x3b')]);_0x54c638['filters']=_[_0x5438('0x3c')](_0x54c638[_0x5438('0x3a')],_0x54c638[_0x5438('0x3b')]);_0x106c7b[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x54c638[_0x5438('0x3a')],qs['fields'](_0x4b88ad[_0x5438('0x3b')]['fields']));_0x106c7b[_0x5438('0x3d')]=_0x106c7b[_0x5438('0x3d')][_0x5438('0x3e')]?_0x106c7b[_0x5438('0x3d')]:_0x54c638['model'];if(!_0x4b88ad[_0x5438('0x3b')]['hasOwnProperty'](_0x5438('0x3f'))){_0x106c7b[_0x5438('0x25')]=qs[_0x5438('0x25')](_0x4b88ad[_0x5438('0x3b')][_0x5438('0x25')]);_0x106c7b[_0x5438('0x23')]=qs['offset'](_0x4b88ad['query'][_0x5438('0x23')]);}_0x106c7b[_0x5438('0x40')]=qs['sort'](_0x4b88ad[_0x5438('0x3b')][_0x5438('0x41')]);_0x106c7b['where']=qs[_0x5438('0x42')](_[_0x5438('0x43')](_0x4b88ad[_0x5438('0x3b')],_0x54c638['filters']),_0x2c3a84);if(_0x4b88ad[_0x5438('0x3b')][_0x5438('0x44')]){_0x106c7b[_0x5438('0x45')]=_[_0x5438('0x46')](_0x106c7b[_0x5438('0x45')],{'$or':_[_0x5438('0x34')](_0x2c3a84,function(_0xd4e522){if(_0xd4e522[_0x5438('0x38')]!==_0x5438('0x47')){var _0x3d426b={};_0x3d426b[_0xd4e522[_0x5438('0x31')]]={'$like':'%'+_0x4b88ad[_0x5438('0x3b')][_0x5438('0x44')]+'%'};return _0x3d426b;}})});}_0x106c7b=_[_0x5438('0x46')]({},_0x106c7b,_0x4b88ad[_0x5438('0x48')]);var _0x2b3ef7={'where':_0x106c7b['where']};return db['CmList'][_0x5438('0x26')](_0x2b3ef7)[_0x5438('0x2a')](function(_0x57b745){_0x34c2e3['count']=_0x57b745;if(_0x4b88ad[_0x5438('0x3b')][_0x5438('0x49')]){_0x106c7b['include']=[{'all':!![]}];}return db[_0x5438('0x35')]['findAll'](_0x106c7b);})[_0x5438('0x2a')](function(_0x79d300){_0x34c2e3[_0x5438('0x4a')]=_0x79d300;return _0x34c2e3;})[_0x5438('0x2a')](respondWithFilteredResult(_0x24e729,_0x106c7b))[_0x5438('0x4b')](handleError(_0x24e729,null));};exports['show']=function(_0x2ba931,_0xb1f71c){var _0x3f1380={'raw':![],'where':{'id':_0x2ba931[_0x5438('0x4c')]['id']}},_0x522b91={};_0x522b91[_0x5438('0x3a')]=_['keys'](db[_0x5438('0x35')][_0x5438('0x36')]);_0x522b91[_0x5438('0x3b')]=_['keys'](_0x2ba931[_0x5438('0x3b')]);_0x522b91[_0x5438('0x42')]=_[_0x5438('0x3c')](_0x522b91['model'],_0x522b91[_0x5438('0x3b')]);_0x3f1380[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x522b91[_0x5438('0x3a')],qs['fields'](_0x2ba931['query']['fields']));_0x3f1380[_0x5438('0x3d')]=_0x3f1380['attributes'][_0x5438('0x3e')]?_0x3f1380[_0x5438('0x3d')]:_0x522b91[_0x5438('0x3a')];if(_0x2ba931[_0x5438('0x3b')]['includeAll']){_0x3f1380[_0x5438('0x4d')]=[{'all':!![]}];}_0x3f1380=_[_0x5438('0x46')]({},_0x3f1380,_0x2ba931[_0x5438('0x48')]);return db[_0x5438('0x35')][_0x5438('0x4e')](_0x3f1380)[_0x5438('0x2a')](handleEntityNotFound(_0xb1f71c,null))[_0x5438('0x2a')](respondWithResult(_0xb1f71c,null))['catch'](handleError(_0xb1f71c,null));};exports[_0x5438('0x4f')]=function(_0x3a5833,_0x162b35){return db['CmList']['create'](_0x3a5833['body'],{})[_0x5438('0x2a')](function(_0x7617bf){var _0x3f538c=_0x3a5833['user'][_0x5438('0x50')]({'plain':!![]});if(!_0x3f538c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f538c[_0x5438('0x51')]===_0x5438('0x52')){var _0x3d2f12=_0x7617bf[_0x5438('0x50')]({'plain':!![]});var _0x29459b='Lists';return db[_0x5438('0x53')]['find']({'where':{'name':_0x29459b,'userProfileId':_0x3f538c['userProfileId']},'raw':!![]})[_0x5438('0x2a')](function(_0x4ce551){if(_0x4ce551&&_0x4ce551[_0x5438('0x54')]===0x0){return db[_0x5438('0x2d')][_0x5438('0x4f')]({'name':_0x3d2f12[_0x5438('0x31')],'resourceId':_0x3d2f12['id'],'type':_0x4ce551[_0x5438('0x31')],'sectionId':_0x4ce551['id']},{})[_0x5438('0x2a')](function(){return _0x7617bf;});}else{return _0x7617bf;}})[_0x5438('0x4b')](function(_0xc28427){logger[_0x5438('0x2f')](_0x5438('0x55'),_0xc28427);throw _0xc28427;});}return _0x7617bf;})[_0x5438('0x2a')](respondWithResult(_0x162b35,0xc9))['catch'](handleError(_0x162b35,null));};exports[_0x5438('0x56')]=function(_0x1cbcc4,_0x359a99){if(_0x1cbcc4[_0x5438('0x57')]['id']){delete _0x1cbcc4[_0x5438('0x57')]['id'];}return db['CmList'][_0x5438('0x4e')]({'where':{'id':_0x1cbcc4['params']['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x359a99,null))[_0x5438('0x2a')](saveUpdates(_0x1cbcc4[_0x5438('0x57')],null))[_0x5438('0x2a')](respondWithResult(_0x359a99,null))[_0x5438('0x4b')](handleError(_0x359a99,null));};exports[_0x5438('0x2b')]=function(_0x207050,_0x1b6c12){return db[_0x5438('0x35')]['find']({'where':{'id':_0x207050[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x1b6c12,null))[_0x5438('0x2a')](removeEntity(_0x1b6c12,null))[_0x5438('0x4b')](handleError(_0x1b6c12,null));};exports[_0x5438('0x58')]=function(_0x128b56,_0x375f10){return db[_0x5438('0x35')][_0x5438('0x58')]()[_0x5438('0x2a')](respondWithResult(_0x375f10,null))[_0x5438('0x4b')](handleError(_0x375f10,null));};exports[_0x5438('0x59')]=function(_0x278508,_0x15792d,_0x3e6c57){if(_0x278508[_0x5438('0x57')]['id']){delete _0x278508[_0x5438('0x57')]['id'];}return db[_0x5438('0x35')]['find']({'where':{'id':_0x278508[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x15792d,null))[_0x5438('0x2a')](function(_0x3a2d36){if(_0x3a2d36){_0x278508[_0x5438('0x57')][_0x5438('0x5a')]=_0x3a2d36['id'];return db[_0x5438('0x5b')][_0x5438('0x4f')](_0x278508[_0x5438('0x57')]);}})[_0x5438('0x2a')](respondWithResult(_0x15792d,null))[_0x5438('0x4b')](handleError(_0x15792d,null));};exports['getDispositions']=function(_0x2c5e4b,_0x22fb35,_0x1c4023){var _0x5ef0f3={'raw':![],'where':{}};var _0x253b56={};var _0x1e802f={'count':0x0,'rows':[]};return db[_0x5438('0x35')][_0x5438('0x5c')]({'where':{'id':_0x2c5e4b[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x22fb35,null))[_0x5438('0x2a')](function(_0x1afab7){if(_0x1afab7){_0x253b56[_0x5438('0x3a')]=_[_0x5438('0x5d')](db[_0x5438('0x5b')][_0x5438('0x36')]);_0x253b56[_0x5438('0x3b')]=_[_0x5438('0x5d')](_0x2c5e4b[_0x5438('0x3b')]);_0x253b56[_0x5438('0x42')]=_['intersection'](_0x253b56[_0x5438('0x3a')],_0x253b56['query']);_0x5ef0f3['attributes']=_[_0x5438('0x3c')](_0x253b56[_0x5438('0x3a')],qs[_0x5438('0x5e')](_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x5e')]));_0x5ef0f3[_0x5438('0x3d')]=_0x5ef0f3[_0x5438('0x3d')][_0x5438('0x3e')]?_0x5ef0f3['attributes']:_0x253b56['model'];if(!_0x2c5e4b[_0x5438('0x3b')]['hasOwnProperty']('nolimit')){_0x5ef0f3[_0x5438('0x25')]=qs['limit'](_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x25')]);_0x5ef0f3[_0x5438('0x23')]=qs[_0x5438('0x23')](_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x23')]);}_0x5ef0f3[_0x5438('0x40')]=qs[_0x5438('0x41')](_0x2c5e4b['query']['sort']);_0x5ef0f3[_0x5438('0x45')]=qs['filters'](_[_0x5438('0x43')](_0x2c5e4b['query'],_0x253b56[_0x5438('0x42')]));_0x5ef0f3[_0x5438('0x45')][_0x5438('0x5a')]=_0x1afab7['id'];if(_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x44')]){_0x5ef0f3[_0x5438('0x45')]=_[_0x5438('0x46')](_0x5ef0f3[_0x5438('0x45')],{'$or':_['map'](_0x5ef0f3[_0x5438('0x3d')],function(_0x51eb02){var _0xac6122={};_0xac6122[_0x51eb02]={'$like':'%'+_0x2c5e4b[_0x5438('0x3b')][_0x5438('0x44')]+'%'};return _0xac6122;})});}_0x5ef0f3=_[_0x5438('0x46')]({},_0x5ef0f3,_0x2c5e4b[_0x5438('0x48')]);return db[_0x5438('0x5b')][_0x5438('0x26')]({'where':_0x5ef0f3[_0x5438('0x45')]})[_0x5438('0x2a')](function(_0x5a47b4){_0x1e802f['count']=_0x5a47b4;if(_0x2c5e4b['query'][_0x5438('0x49')]){_0x5ef0f3[_0x5438('0x4d')]=[{'all':!![]}];}return db[_0x5438('0x5b')][_0x5438('0x5f')](_0x5ef0f3);})[_0x5438('0x2a')](function(_0x6abe33){_0x1e802f[_0x5438('0x4a')]=_0x6abe33;return _0x1e802f;});}})[_0x5438('0x2a')](respondWithFilteredResult(_0x22fb35,_0x5ef0f3))['catch'](handleError(_0x22fb35,null));};exports[_0x5438('0x60')]=function(_0x3678d4,_0x2d72ea,_0x1a8e10){return db[_0x5438('0x35')][_0x5438('0x4e')]({'where':{'id':_0x3678d4[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x2d72ea,null))[_0x5438('0x2a')](function(_0x4689d6){if(_0x4689d6){return _0x4689d6['removeDispositions'](_0x3678d4['query'][_0x5438('0x61')]);}})[_0x5438('0x2a')](respondWithStatusCode(_0x2d72ea,null))[_0x5438('0x4b')](handleError(_0x2d72ea,null));};exports[_0x5438('0x62')]=function(_0x5435ba,_0x3b62fb,_0x4b07a9){return db[_0x5438('0x35')]['find']({'where':{'id':_0x5435ba[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x3b62fb,null))[_0x5438('0x2a')](function(_0x134be1){if(_0x134be1){var _0x54b084=[];var _0x2872a9={'success':[],'errors':[]};return db[_0x5438('0x63')][_0x5438('0x58')]()[_0x5438('0x2a')](function(_0x196743){if(_0x5435ba[_0x5438('0x57')][_0x5438('0x64')]&&_[_0x5438('0x65')](_0x5435ba['body'][_0x5438('0x64')])){if(_0x5435ba[_0x5438('0x57')][_0x5438('0x64')][_0x5438('0x3e')]){_0x5435ba['body'][_0x5438('0x64')]=_0x5435ba[_0x5438('0x57')][_0x5438('0x64')][_0x5438('0x66')](';')+';';}else{_0x5435ba[_0x5438('0x57')][_0x5438('0x64')]=null;}}else{_0x5435ba[_0x5438('0x57')]['tags']=null;}if(_0x5435ba[_0x5438('0x57')]&&_[_0x5438('0x65')](_0x5435ba['body'])){for(var _0x90d9b7=0x0;_0x90d9b7<_0x5435ba[_0x5438('0x57')][_0x5438('0x3e')];_0x90d9b7+=0x1){_0x5435ba['body'][_0x90d9b7][_0x5438('0x5a')]=_0x5435ba[_0x5438('0x4c')]['id'];_0x54b084[_0x5438('0x67')](_0x5435ba[_0x5438('0x57')][_0x90d9b7]);}return BPromise[_0x5438('0x68')](_0x54b084,function(_0xd8364c){return db[_0x5438('0x63')][_0x5438('0x4f')](_[_0x5438('0x69')](_0xd8364c,['ids','id'])||{},{'fields':_[_0x5438('0x5d')](_0x196743),'raw':!![]})[_0x5438('0x2a')](function(_0x4835a1){_0x2872a9[_0x5438('0x6a')][_0x5438('0x67')](_0x4835a1[_0x5438('0x6b')]);})[_0x5438('0x4b')](function(_0x20fb80){_0x2872a9['errors']['push']({'data':_0xd8364c,'error':_0x20fb80[_0x5438('0x6c')]});});})[_0x5438('0x2a')](function(_0x57dcc7){return _0x2872a9;})['catch'](function(_0x1c63da){return _0x1c63da;});}else{_0x3b62fb['status'](0x190)[_0x5438('0x28')]({'message':_0x5438('0x6d')});}});}})[_0x5438('0x2a')](respondWithResult(_0x3b62fb,null))[_0x5438('0x4b')](handleError(_0x3b62fb,null));};exports[_0x5438('0x6e')]=function(_0xa524a,_0x6cb120,_0xd56f5c){var _0x42bfec;return db[_0x5438('0x35')][_0x5438('0x4e')]({'where':{'id':_0xa524a[_0x5438('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x5438('0x6f')}]})[_0x5438('0x2a')](handleEntityNotFound(_0x6cb120,null))[_0x5438('0x2a')](function(_0x1dfdc0){if(_0x1dfdc0){_0x42bfec=_0x1dfdc0;return db['CmContact'][_0x5438('0x36')];}})[_0x5438('0x2a')](function(_0x36bb98){if(_0x36bb98){var _0x1c9f10={};var _0x1e5a13={};_0x1e5a13[_0x5438('0x3a')]=_[_0x5438('0x70')](_[_0x5438('0x5d')](_0x36bb98),_[_0x5438('0x34')](_0x42bfec[_0x5438('0x6f')],function(_0x4a27f5){return util[_0x5438('0x71')](_0x5438('0x72'),_0x4a27f5['id']);}));_0x1e5a13[_0x5438('0x3b')]=_[_0x5438('0x5d')](_0xa524a[_0x5438('0x3b')]);_0x1e5a13['filters']=_[_0x5438('0x3c')](_0x1e5a13['model'],_0x1e5a13[_0x5438('0x3b')]);_0x1c9f10[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x1e5a13['model'],qs['fields'](_0xa524a[_0x5438('0x3b')]['fields']));_0x1c9f10[_0x5438('0x3d')]=_0x1c9f10[_0x5438('0x3d')]['length']?_0x1c9f10[_0x5438('0x3d')]:_0x1e5a13[_0x5438('0x3a')];if(!_0xa524a[_0x5438('0x3b')][_0x5438('0x73')](_0x5438('0x3f'))){_0x1c9f10[_0x5438('0x25')]=qs[_0x5438('0x25')](_0xa524a[_0x5438('0x3b')][_0x5438('0x25')]);_0x1c9f10[_0x5438('0x23')]=qs[_0x5438('0x23')](_0xa524a[_0x5438('0x3b')][_0x5438('0x23')]);}_0x1c9f10[_0x5438('0x40')]=qs[_0x5438('0x41')](_0xa524a[_0x5438('0x3b')][_0x5438('0x41')]);_0x1c9f10['where']=qs[_0x5438('0x42')](_['pick'](_0xa524a[_0x5438('0x3b')],_0x1e5a13['filters']));_0x1c9f10[_0x5438('0x74')]=!![];if(_0xa524a[_0x5438('0x3b')][_0x5438('0x44')]){_0x1c9f10['where']=_[_0x5438('0x46')](_0x1c9f10[_0x5438('0x45')],{'$or':_[_0x5438('0x34')](_0x1c9f10[_0x5438('0x3d')],function(_0x482fc1){var _0x5287fc={};_0x5287fc[_0x482fc1]={'$like':'%'+_0xa524a[_0x5438('0x3b')][_0x5438('0x44')]+'%'};return _0x5287fc;})});}_0x1c9f10=_['merge']({},_0x1c9f10,_0xa524a['options']);return _0x42bfec['getContacts'](_0x1c9f10);}})[_0x5438('0x2a')](respondWithResult(_0x6cb120,null))[_0x5438('0x4b')](handleError(_0x6cb120,null));};exports['getContactsCsv']=function(_0xf95706,_0x44fac4,_0x22fe2f){var _0x2ea512;return db[_0x5438('0x35')][_0x5438('0x4e')]({'where':{'id':_0xf95706['params']['id']},'include':[{'model':db[_0x5438('0x75')],'as':_0x5438('0x6f')}]})[_0x5438('0x2a')](handleEntityNotFound(_0x44fac4,null))[_0x5438('0x2a')](function(_0x23be9a){if(_0x23be9a){_0x2ea512=_0x23be9a;return db[_0x5438('0x63')][_0x5438('0x36')];}})[_0x5438('0x2a')](function(_0x129785){if(_0x129785){var _0x58c546={};var _0x1405e7={};_0x1405e7[_0x5438('0x3a')]=_[_0x5438('0x70')](_[_0x5438('0x5d')](_0x129785),_[_0x5438('0x34')](_0x2ea512['CustomFields'],function(_0x48a668){return util['format'](_0x5438('0x72'),_0x48a668['id']);}));_0x1405e7['query']=_[_0x5438('0x5d')](_0xf95706['query']);_0x1405e7['filters']=_[_0x5438('0x3c')](_0x1405e7[_0x5438('0x3a')],_0x1405e7[_0x5438('0x3b')]);_0x58c546[_0x5438('0x3d')]=_['intersection'](_0x1405e7[_0x5438('0x3a')],qs['fields'](_0xf95706[_0x5438('0x3b')][_0x5438('0x5e')]));_0x58c546[_0x5438('0x3d')]=_0x58c546['attributes']['length']?_0x58c546['attributes']:_0x1405e7['model'];if(!_0xf95706[_0x5438('0x3b')][_0x5438('0x73')](_0x5438('0x3f'))){_0x58c546[_0x5438('0x25')]=qs['limit'](_0xf95706[_0x5438('0x3b')][_0x5438('0x25')]);_0x58c546[_0x5438('0x23')]=qs['offset'](_0xf95706[_0x5438('0x3b')]['offset']);}_0x58c546[_0x5438('0x40')]=qs['sort'](_0xf95706['query'][_0x5438('0x41')]);_0x58c546[_0x5438('0x45')]=qs[_0x5438('0x42')](_[_0x5438('0x43')](_0xf95706[_0x5438('0x3b')],_0x1405e7[_0x5438('0x42')]));_0x58c546['raw']=!![];if(_0xf95706[_0x5438('0x3b')]['filter']){_0x58c546[_0x5438('0x45')]=_['merge'](_0x58c546['where'],{'$or':_[_0x5438('0x34')](_0x58c546[_0x5438('0x3d')],function(_0x36d30a){var _0x5840b2={};_0x5840b2[_0x36d30a]={'$like':'%'+_0xf95706[_0x5438('0x3b')][_0x5438('0x44')]+'%'};return _0x5840b2;})});}_0x58c546=_[_0x5438('0x46')]({},_0x58c546,_0xf95706[_0x5438('0x48')]);return _0x2ea512[_0x5438('0x6e')](_0x58c546);}})[_0x5438('0x2a')](function(_0x49ef1a){if(!_[_0x5438('0x76')](_0x49ef1a)){var _0x4ad0bd=toCsv(_0x49ef1a);var _0x5992e5=Date['now']();fs[_0x5438('0x77')](util[_0x5438('0x71')](_0x5438('0x78'),_0x2ea512['id'],_0x5992e5),_0x4ad0bd);_0x44fac4[_0x5438('0x79')](_0x5438('0x7a'),_0x5438('0x7b')+util['format'](_0x5438('0x7c'),_0x2ea512['id'],_0x5992e5));_0x44fac4[_0x5438('0x79')](_0x5438('0x7d'),_0x5438('0x7e'));return _0x44fac4[_0x5438('0x7f')](util[_0x5438('0x71')](_0x5438('0x78'),_0x2ea512['id'],_0x5992e5));}else{return _0x44fac4[_0x5438('0x21')](0xcc);}})[_0x5438('0x4b')](handleError(_0x44fac4,null));};exports[_0x5438('0x80')]=function(_0x56f59d,_0x404fb4,_0x49a1ad){var _0x3a361a;delete _0x56f59d[_0x5438('0x57')]['id'];return db[_0x5438('0x35')][_0x5438('0x5c')]({'where':{'id':_0x56f59d[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x404fb4,null))[_0x5438('0x2a')](function(_0x5cb019){if(_0x5cb019){return db[_0x5438('0x81')][_0x5438('0x82')](function(_0x4ac7d4){return db[_0x5438('0x75')][_0x5438('0x4f')](_0x56f59d[_0x5438('0x57')],{'transaction':_0x4ac7d4})[_0x5438('0x2a')](function(_0x2894cc){_0x3a361a=_0x2894cc;return _0x5cb019[_0x5438('0x83')](_0x2894cc,{'transaction':_0x4ac7d4});})[_0x5438('0x2a')](function(){var _0x4a3f90={'type':db[_0x5438('0x84')][_0x5438('0x85')],'transaction':_0x4ac7d4};switch(_0x56f59d[_0x5438('0x57')][_0x5438('0x38')]){case _0x5438('0x86'):_0x4a3f90['type']=db[_0x5438('0x84')]['TEXT'];break;case _0x5438('0x87'):_0x4a3f90['type']=db[_0x5438('0x84')]['INTEGER'];break;case _0x5438('0x88'):_0x4a3f90['type']=db[_0x5438('0x84')][_0x5438('0x89')];_0x4a3f90[_0x5438('0x8a')]=![];break;default:}return db[_0x5438('0x81')][_0x5438('0x8b')]['addColumn'](_0x5438('0x8c'),util['format'](_0x5438('0x8d'),_0x3a361a['id']),_0x4a3f90);})['then'](function(){return _0x3a361a;});});}})['then'](respondWithResult(_0x404fb4,null))[_0x5438('0x4b')](handleError(_0x404fb4,null));};exports[_0x5438('0x8e')]=function(_0x1768c8,_0xd53ec2,_0x2ee69a){var _0x3bad7b={};var _0x35e032={};var _0x3c032e;var _0x214fc2;return db[_0x5438('0x35')][_0x5438('0x5c')]({'where':{'id':_0x1768c8[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0xd53ec2,null))[_0x5438('0x2a')](function(_0x147e49){if(_0x147e49){_0x3c032e=_0x147e49;_0x35e032[_0x5438('0x3a')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x35e032[_0x5438('0x3b')]=_['keys'](_0x1768c8['query']);_0x35e032[_0x5438('0x42')]=_[_0x5438('0x3c')](_0x35e032[_0x5438('0x3a')],_0x35e032['query']);_0x3bad7b[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x35e032[_0x5438('0x3a')],qs[_0x5438('0x5e')](_0x1768c8['query']['fields']));_0x3bad7b[_0x5438('0x3d')]=_0x3bad7b[_0x5438('0x3d')][_0x5438('0x3e')]?_0x3bad7b[_0x5438('0x3d')]:_0x35e032[_0x5438('0x3a')];_0x3bad7b['order']=qs[_0x5438('0x41')](_0x1768c8[_0x5438('0x3b')]['sort']);_0x3bad7b[_0x5438('0x45')]=qs[_0x5438('0x42')](_[_0x5438('0x43')](_0x1768c8[_0x5438('0x3b')],_0x35e032[_0x5438('0x42')]));_0x3bad7b[_0x5438('0x45')]=_[_0x5438('0x46')](_0x3bad7b[_0x5438('0x45')],{'$or':[{'ListId':_0x147e49['id']},{'ListId':null}]});if(_0x1768c8[_0x5438('0x3b')][_0x5438('0x44')]){_0x3bad7b[_0x5438('0x45')]=_[_0x5438('0x46')](_0x3bad7b[_0x5438('0x45')],{'$or':_[_0x5438('0x34')](_0x3bad7b['attributes'],function(_0x5b18cb){var _0x3893b1={};_0x3893b1[_0x5b18cb]={'$like':'%'+_0x1768c8[_0x5438('0x3b')]['filter']+'%'};return _0x3893b1;})});}_0x3bad7b=_[_0x5438('0x46')]({},_0x3bad7b,_0x1768c8[_0x5438('0x48')]);return db['CmCustomField'][_0x5438('0x8f')](_0x3bad7b);}})[_0x5438('0x2a')](respondWithResult(_0xd53ec2,null))[_0x5438('0x4b')](handleError(_0xd53ec2,null));};exports[_0x5438('0x90')]=function(_0x3a6d2f,_0x53d136,_0x312c27){return db[_0x5438('0x35')][_0x5438('0x4e')]({'where':{'id':_0x3a6d2f[_0x5438('0x4c')]['id']}})['then'](handleEntityNotFound(_0x53d136,null))[_0x5438('0x2a')](function(_0x4047dc){if(_0x4047dc){return _0x4047dc[_0x5438('0x90')](_0x3a6d2f['body']['ids'],_[_0x5438('0x69')](_0x3a6d2f[_0x5438('0x57')],[_0x5438('0x61'),'id'])||{})[_0x5438('0x91')](function(_0xe3298f){for(var _0x5b10b8=0x0;_0x5b10b8<_0x3a6d2f[_0x5438('0x57')]['ids'][_0x5438('0x3e')];_0x5b10b8+=0x1){socket['emit'](_0x5438('0x92'),{'UserId':Number(_0x3a6d2f[_0x5438('0x57')][_0x5438('0x61')][_0x5b10b8]),'CmListId':Number(_0x3a6d2f['params']['id'])});}return _0xe3298f;});}})['then'](respondWithResult(_0x53d136,null))[_0x5438('0x4b')](handleError(_0x53d136,null));};exports[_0x5438('0x93')]=function(_0x52c4c2,_0x12d02e,_0x486205){return db[_0x5438('0x35')]['find']({'where':{'id':_0x52c4c2[_0x5438('0x4c')]['id']}})[_0x5438('0x2a')](handleEntityNotFound(_0x12d02e,null))[_0x5438('0x2a')](function(_0x5e1ebe){if(_0x5e1ebe){return _0x5e1ebe[_0x5438('0x93')](_0x52c4c2[_0x5438('0x3b')]['ids'])['then'](function(){if(_[_0x5438('0x65')](_0x52c4c2[_0x5438('0x3b')]['ids'])){for(var _0x2f3568=0x0;_0x2f3568<_0x52c4c2[_0x5438('0x3b')]['ids']['length'];_0x2f3568+=0x1){socket[_0x5438('0x94')](_0x5438('0x95'),{'UserId':Number(_0x52c4c2[_0x5438('0x3b')][_0x5438('0x61')][_0x2f3568]),'CmListId':Number(_0x52c4c2[_0x5438('0x4c')]['id'])});}}else{socket[_0x5438('0x94')](_0x5438('0x95'),{'UserId':Number(_0x52c4c2[_0x5438('0x3b')][_0x5438('0x61')]),'CmListId':Number(_0x52c4c2[_0x5438('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x12d02e,null))[_0x5438('0x4b')](handleError(_0x12d02e,null));};exports[_0x5438('0x96')]=function(_0x3526a2,_0x5e35a9,_0x580ec7){var _0x31e1ee={};var _0x5177a3={};var _0x295504;var _0x556aa8;return db[_0x5438('0x35')][_0x5438('0x5c')]({'where':{'id':_0x3526a2['params']['id']}})['then'](handleEntityNotFound(_0x5e35a9,null))['then'](function(_0x388b47){if(_0x388b47){_0x295504=_0x388b47;_0x5177a3[_0x5438('0x3a')]=_[_0x5438('0x5d')](db[_0x5438('0x97')]['rawAttributes']);_0x5177a3['query']=_['keys'](_0x3526a2[_0x5438('0x3b')]);_0x5177a3['filters']=_[_0x5438('0x3c')](_0x5177a3[_0x5438('0x3a')],_0x5177a3[_0x5438('0x3b')]);_0x31e1ee[_0x5438('0x3d')]=_[_0x5438('0x3c')](_0x5177a3['model'],qs[_0x5438('0x5e')](_0x3526a2[_0x5438('0x3b')]['fields']));_0x31e1ee[_0x5438('0x3d')]=_0x31e1ee[_0x5438('0x3d')][_0x5438('0x3e')]?_0x31e1ee['attributes']:_0x5177a3['model'];_0x31e1ee[_0x5438('0x40')]=qs[_0x5438('0x41')](_0x3526a2[_0x5438('0x3b')][_0x5438('0x41')]);_0x31e1ee[_0x5438('0x45')]=qs[_0x5438('0x42')](_[_0x5438('0x43')](_0x3526a2[_0x5438('0x3b')],_0x5177a3[_0x5438('0x42')]));if(_0x3526a2[_0x5438('0x3b')][_0x5438('0x44')]){_0x31e1ee[_0x5438('0x45')]=_['merge'](_0x31e1ee[_0x5438('0x45')],{'$or':_[_0x5438('0x34')](_0x31e1ee[_0x5438('0x3d')],function(_0x3fb233){var _0x309a6c={};_0x309a6c[_0x3fb233]={'$like':'%'+_0x3526a2['query'][_0x5438('0x44')]+'%'};return _0x309a6c;})});}_0x31e1ee=_['merge']({},_0x31e1ee,_0x3526a2['options']);return _0x295504[_0x5438('0x96')](_0x31e1ee);}})['then'](function(_0x2246b1){if(_0x2246b1){_0x556aa8=_0x2246b1[_0x5438('0x3e')];if(!_0x3526a2['query'][_0x5438('0x73')]('nolimit')){_0x31e1ee[_0x5438('0x25')]=qs[_0x5438('0x25')](_0x3526a2['query'][_0x5438('0x25')]);_0x31e1ee[_0x5438('0x23')]=qs['offset'](_0x3526a2[_0x5438('0x3b')][_0x5438('0x23')]);}return _0x295504[_0x5438('0x96')](_0x31e1ee);}})[_0x5438('0x2a')](function(_0x3e2147){if(_0x3e2147){return _0x3e2147?{'count':_0x556aa8,'rows':_0x3e2147}:null;}})[_0x5438('0x2a')](respondWithResult(_0x5e35a9,null))['catch'](handleError(_0x5e35a9,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 702801c..b1f806f 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x7217,0x19e));var _0x7721=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x7217[_0x481bf7];return _0x461787;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x4e961c,_0x3a88c5){_0x4e961c=_0x4e961c-0x0;var _0xe1b347=_0xe14b[_0x4e961c];return _0xe1b347;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7b1dbc6..f847b3b 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 _0xd64b=['define','CmList','cm_lists','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x55abcb,_0x1c8ce0){var _0x10b891=function(_0x2d58cd){while(--_0x2d58cd){_0x55abcb['push'](_0x55abcb['shift']());}};_0x10b891(++_0x1c8ce0);}(_0xd64b,0xc1));var _0xbd64=function(_0x35031a,_0x1c8c62){_0x35031a=_0x35031a-0x0;var _0x44ec8f=_0xd64b[_0x35031a];return _0x44ec8f;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash'];(function(_0x574f3b,_0x31f052){var _0x1a1b1f=function(_0x5b83c5){while(--_0x5b83c5){_0x574f3b['push'](_0x574f3b['shift']());}};_0x1a1b1f(++_0x31f052);}(_0xaa88,0x137));var _0x8aa8=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0xaa88[_0x37e886];return _0x57c5cd;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 292a9be..b73dd36 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 _0x50cc=['then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request'];(function(_0xe9ed53,_0x5771d8){var _0x5ea0ab=function(_0x261517){while(--_0x261517){_0xe9ed53['push'](_0xe9ed53['shift']());}};_0x5ea0ab(++_0x5771d8);}(_0x50cc,0x119));var _0xc50c=function(_0x6c1987,_0x3cc6fa){_0x6c1987=_0x6c1987-0x0;var _0x23d87d=_0x50cc[_0x6c1987];return _0x23d87d;};'use strict';var _=require(_0xc50c('0x0'));var util=require(_0xc50c('0x1'));var moment=require('moment');var BPromise=require(_0xc50c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc50c('0x3'));var db=require(_0xc50c('0x4'))['db'];var utils=require(_0xc50c('0x5'));var logger=require(_0xc50c('0x6'))(_0xc50c('0x7'));var config=require(_0xc50c('0x8'));var jayson=require(_0xc50c('0x9'));var client=jayson[_0xc50c('0xa')][_0xc50c('0xb')]({'port':0x232a});config['redis']=_[_0xc50c('0xc')](config[_0xc50c('0xd')],{'host':_0xc50c('0xe'),'port':0x18eb});var socket=require(_0xc50c('0xf'))(new Redis(config[_0xc50c('0xd')]));require(_0xc50c('0x10'))[_0xc50c('0x11')](socket);function respondWithRpcPromise(_0xf7f36a,_0x11d43d,_0xfa76c2){return new BPromise(function(_0x41845d,_0x397860){return client[_0xc50c('0x12')](_0xf7f36a,_0xfa76c2)[_0xc50c('0x13')](function(_0x12b649){logger['info'](_0xc50c('0x14'),_0x11d43d,_0xc50c('0x15'));logger[_0xc50c('0x16')](_0xc50c('0x17'),_0x11d43d,'request\x20sent',JSON['stringify'](_0x12b649));if(_0x12b649[_0xc50c('0x18')]){if(_0x12b649[_0xc50c('0x18')][_0xc50c('0x19')]===0x1f4){logger[_0xc50c('0x18')](_0xc50c('0x14'),_0x11d43d,_0x12b649[_0xc50c('0x18')][_0xc50c('0x1a')]);return _0x397860(_0x12b649[_0xc50c('0x18')][_0xc50c('0x1a')]);}logger[_0xc50c('0x18')](_0xc50c('0x14'),_0x11d43d,_0x12b649['error'][_0xc50c('0x1a')]);return _0x41845d(_0x12b649[_0xc50c('0x18')]['message']);}else{logger[_0xc50c('0x1b')](_0xc50c('0x14'),_0x11d43d,'request\x20sent');_0x41845d(_0x12b649[_0xc50c('0x1c')][_0xc50c('0x1a')]);}})[_0xc50c('0x1d')](function(_0x31f23c){logger[_0xc50c('0x18')]('CmList,\x20%s,\x20%s',_0x11d43d,_0x31f23c);_0x397860(_0x31f23c);});});} \ No newline at end of file +var _0x5b4a=['client','http','defaults','redis','localhost','./cmList.socket','register','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x5a056e,_0x382a98){var _0x5e1dab=function(_0x1059a4){while(--_0x1059a4){_0x5a056e['push'](_0x5a056e['shift']());}};_0x5e1dab(++_0x382a98);}(_0x5b4a,0x10f));var _0xa5b4=function(_0x104666,_0x5482d4){_0x104666=_0x104666-0x0;var _0x5d305a=_0x5b4a[_0x104666];return _0x5d305a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa5b4('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5b4('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa5b4('0x2'));var config=require(_0xa5b4('0x3'));var jayson=require(_0xa5b4('0x4'));var client=jayson[_0xa5b4('0x5')][_0xa5b4('0x6')]({'port':0x232a});config['redis']=_[_0xa5b4('0x7')](config[_0xa5b4('0x8')],{'host':_0xa5b4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5b4('0x8')]));require(_0xa5b4('0xa'))[_0xa5b4('0xb')](socket);function respondWithRpcPromise(_0x568fea,_0x377aa6,_0x529511){return new BPromise(function(_0x37f45a,_0xaee1de){return client['request'](_0x568fea,_0x529511)[_0xa5b4('0xc')](function(_0x10bfb4){logger['info'](_0xa5b4('0xd'),_0x377aa6,'request\x20sent');logger[_0xa5b4('0xe')](_0xa5b4('0xf'),_0x377aa6,_0xa5b4('0x10'),JSON[_0xa5b4('0x11')](_0x10bfb4));if(_0x10bfb4[_0xa5b4('0x12')]){if(_0x10bfb4[_0xa5b4('0x12')][_0xa5b4('0x13')]===0x1f4){logger[_0xa5b4('0x12')]('CmList,\x20%s,\x20%s',_0x377aa6,_0x10bfb4['error'][_0xa5b4('0x14')]);return _0xaee1de(_0x10bfb4[_0xa5b4('0x12')][_0xa5b4('0x14')]);}logger['error'](_0xa5b4('0xd'),_0x377aa6,_0x10bfb4[_0xa5b4('0x12')][_0xa5b4('0x14')]);return _0x37f45a(_0x10bfb4[_0xa5b4('0x12')]['message']);}else{logger[_0xa5b4('0x15')](_0xa5b4('0xd'),_0x377aa6,_0xa5b4('0x10'));_0x37f45a(_0x10bfb4['result'][_0xa5b4('0x14')]);}})[_0xa5b4('0x16')](function(_0x15f45a){logger[_0xa5b4('0x12')]('CmList,\x20%s,\x20%s',_0x377aa6,_0x15f45a);_0xaee1de(_0x15f45a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index e0465b6..93c29f0 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 _0xcf9c=['length','cmList:','./cmList.events','save','emit','removeListener','register'];(function(_0x29665a,_0x41d320){var _0x2218d0=function(_0x1dcb29){while(--_0x1dcb29){_0x29665a['push'](_0x29665a['shift']());}};_0x2218d0(++_0x41d320);}(_0xcf9c,0x1de));var _0xccf9=function(_0x3bf9b7,_0x2d9b97){_0x3bf9b7=_0x3bf9b7-0x0;var _0x566013=_0xcf9c[_0x3bf9b7];return _0x566013;};'use strict';var CmListEvents=require(_0xccf9('0x0'));var events=[_0xccf9('0x1'),'remove','update'];function createListener(_0x22c265,_0x1611fb){return function(_0x56614d){_0x1611fb[_0xccf9('0x2')](_0x22c265,_0x56614d);};}function removeListener(_0x518836,_0x2daf34){return function(){CmListEvents[_0xccf9('0x3')](_0x518836,_0x2daf34);};}exports[_0xccf9('0x4')]=function(_0x4248bc){for(var _0x325f8d=0x0,_0x5ca005=events[_0xccf9('0x5')];_0x325f8d<_0x5ca005;_0x325f8d++){var _0x37a395=events[_0x325f8d];var _0x2b7be4=createListener(_0xccf9('0x6')+_0x37a395,_0x4248bc);CmListEvents['on'](_0x37a395,_0x2b7be4);}}; \ No newline at end of file +var _0x7191=['remove','removeListener','length','cmList:','save'];(function(_0x371b25,_0x224870){var _0x5588e8=function(_0x4e10b1){while(--_0x4e10b1){_0x371b25['push'](_0x371b25['shift']());}};_0x5588e8(++_0x224870);}(_0x7191,0x77));var _0x1719=function(_0xa7efcc,_0x5600bf){_0xa7efcc=_0xa7efcc-0x0;var _0x2e6497=_0x7191[_0xa7efcc];return _0x2e6497;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x1719('0x0'),_0x1719('0x1'),'update'];function createListener(_0x40c941,_0x5b6926){return function(_0x44aceb){_0x5b6926['emit'](_0x40c941,_0x44aceb);};}function removeListener(_0x57461,_0x5ee7a0){return function(){CmListEvents[_0x1719('0x2')](_0x57461,_0x5ee7a0);};}exports['register']=function(_0x2dbe4a){for(var _0x4ee20c=0x0,_0x3a2520=events[_0x1719('0x3')];_0x4ee20c<_0x3a2520;_0x4ee20c++){var _0x32e5be=events[_0x4ee20c];var _0x14f39d=createListener(_0x1719('0x4')+_0x32e5be,_0x2dbe4a);CmListEvents['on'](_0x32e5be,_0x14f39d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 71332c3..a7cff39 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 _0x4f2c=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','addContacts','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f2c,0xa1));var _0xc4f2=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x4f2c[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0xc4f2('0x0'));var util=require(_0xc4f2('0x1'));var path=require(_0xc4f2('0x2'));var timeout=require(_0xc4f2('0x3'));var express=require(_0xc4f2('0x4'));var router=express['Router']();var fs_extra=require(_0xc4f2('0x5'));var auth=require(_0xc4f2('0x6'));var interaction=require(_0xc4f2('0x7'));var config=require('../../config/environment');var controller=require(_0xc4f2('0x8'));router[_0xc4f2('0x9')]('/',auth[_0xc4f2('0xa')](),controller['index']);router['get'](_0xc4f2('0xb'),auth['isAuthenticated'](),controller[_0xc4f2('0xc')]);router[_0xc4f2('0x9')]('/:id',auth[_0xc4f2('0xa')](),controller[_0xc4f2('0xd')]);router['get'](_0xc4f2('0xe'),auth[_0xc4f2('0xa')](),controller['getDispositions']);router['get'](_0xc4f2('0xf'),auth[_0xc4f2('0xa')](),controller[_0xc4f2('0x10')]);router[_0xc4f2('0x9')](_0xc4f2('0x11'),auth[_0xc4f2('0xa')](),controller['getContactsCsv']);router[_0xc4f2('0x9')](_0xc4f2('0x12'),auth[_0xc4f2('0xa')](),controller[_0xc4f2('0x13')]);router[_0xc4f2('0x9')](_0xc4f2('0x14'),auth[_0xc4f2('0xa')](),controller['getAgents']);router[_0xc4f2('0x15')]('/',auth['isAuthenticated'](),controller[_0xc4f2('0x16')]);router['post'](_0xc4f2('0xe'),auth['isAuthenticated'](),controller[_0xc4f2('0x17')]);router['post'](_0xc4f2('0xf'),auth[_0xc4f2('0xa')](),controller[_0xc4f2('0x18')]);router[_0xc4f2('0x15')](_0xc4f2('0x12'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xc4f2('0x15')](_0xc4f2('0x14'),auth[_0xc4f2('0xa')](),controller[_0xc4f2('0x19')]);router[_0xc4f2('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xc4f2('0x1b')]);router[_0xc4f2('0x1c')](_0xc4f2('0x1d'),auth[_0xc4f2('0xa')](),controller[_0xc4f2('0x1e')]);router['delete'](_0xc4f2('0xe'),auth[_0xc4f2('0xa')](),controller[_0xc4f2('0x1f')]);router[_0xc4f2('0x1c')](_0xc4f2('0x14'),auth[_0xc4f2('0xa')](),controller[_0xc4f2('0x20')]);module['exports']=router; \ No newline at end of file +var _0xeca1=['addCustomField','/:id/users','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create','addDisposition','addContacts'];(function(_0x1b9cfb,_0x2c5a2b){var _0x38a552=function(_0x4b6bdc){while(--_0x4b6bdc){_0x1b9cfb['push'](_0x1b9cfb['shift']());}};_0x38a552(++_0x2c5a2b);}(_0xeca1,0xf9));var _0x1eca=function(_0x2dc961,_0x41c35e){_0x2dc961=_0x2dc961-0x0;var _0x3a194b=_0xeca1[_0x2dc961];return _0x3a194b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1eca('0x0'));var timeout=require(_0x1eca('0x1'));var express=require('express');var router=express[_0x1eca('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1eca('0x3'));var interaction=require(_0x1eca('0x4'));var config=require(_0x1eca('0x5'));var controller=require('./cmList.controller');router['get']('/',auth[_0x1eca('0x6')](),controller[_0x1eca('0x7')]);router[_0x1eca('0x8')](_0x1eca('0x9'),auth[_0x1eca('0x6')](),controller[_0x1eca('0xa')]);router[_0x1eca('0x8')]('/:id',auth[_0x1eca('0x6')](),controller[_0x1eca('0xb')]);router[_0x1eca('0x8')](_0x1eca('0xc'),auth[_0x1eca('0x6')](),controller[_0x1eca('0xd')]);router[_0x1eca('0x8')](_0x1eca('0xe'),auth[_0x1eca('0x6')](),controller['getContacts']);router['get'](_0x1eca('0xf'),auth['isAuthenticated'](),controller[_0x1eca('0x10')]);router[_0x1eca('0x8')](_0x1eca('0x11'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x12')]);router[_0x1eca('0x8')]('/:id/users',auth[_0x1eca('0x6')](),controller['getAgents']);router[_0x1eca('0x13')]('/',auth[_0x1eca('0x6')](),controller[_0x1eca('0x14')]);router['post'](_0x1eca('0xc'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x15')]);router[_0x1eca('0x13')](_0x1eca('0xe'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x16')]);router[_0x1eca('0x13')](_0x1eca('0x11'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x17')]);router[_0x1eca('0x13')](_0x1eca('0x18'),auth['isAuthenticated'](),controller[_0x1eca('0x19')]);router[_0x1eca('0x1a')](_0x1eca('0x1b'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x1c')]);router[_0x1eca('0x1d')](_0x1eca('0x1b'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x1e')]);router[_0x1eca('0x1d')](_0x1eca('0xc'),auth[_0x1eca('0x6')](),controller[_0x1eca('0x1f')]);router[_0x1eca('0x1d')](_0x1eca('0x18'),auth['isAuthenticated'](),controller[_0x1eca('0x20')]);module[_0x1eca('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6066ffa..5c25b09 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 _0xcec8=['field','STRING','sequelize','exports'];(function(_0x14d85c,_0xea3632){var _0x40702a=function(_0x4b730a){while(--_0x4b730a){_0x14d85c['push'](_0x14d85c['shift']());}};_0x40702a(++_0xea3632);}(_0xcec8,0x1de));var _0x8cec=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0xcec8[_0x409deb];return _0x15a4f7;};'use strict';var Sequelize=require(_0x8cec('0x0'));module[_0x8cec('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3d29ca){return this['getDataValue'](_0x8cec('0x2'));}},'field':{'type':Sequelize[_0x8cec('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x8cec('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x8cec('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x6ca0=['STRING','getDataValue','field'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6ca0,0x118));var _0x06ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ca0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x12ae6c){return this[_0x06ca('0x0')](_0x06ca('0x1'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x06ca('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x06ca('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 327515d..0ad12e8 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3f495c,_0x3786c8){var _0x25665=function(_0x4530e5){while(--_0x4530e5){_0x3f495c['push'](_0x3f495c['shift']());}};_0x25665(++_0x3786c8);}(_0x7a54,0x106));var _0x47a5=function(_0x61cdd3,_0x5dbe86){_0x61cdd3=_0x61cdd3-0x0;var _0x10a7cd=_0x7a54[_0x61cdd3];return _0x10a7cd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4b1340,_0x17159a){var _0x5c5ddf=function(_0x557bca){while(--_0x557bca){_0x4b1340['push'](_0x4b1340['shift']());}};_0x5c5ddf(++_0x17159a);}(_0x7a54,0x106));var _0x47a5=function(_0x414cbe,_0x5d1bcb){_0x414cbe=_0x414cbe-0x0;var _0x9fe6b1=_0x7a54[_0x414cbe];return _0x9fe6b1;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 7120b42..3ca8293 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 _0xa3ab=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash'];(function(_0x26c93b,_0x48c003){var _0x3775b4=function(_0x20e185){while(--_0x20e185){_0x26c93b['push'](_0x26c93b['shift']());}};_0x3775b4(++_0x48c003);}(_0xa3ab,0x178));var _0xba3a=function(_0x2e2cad,_0xa44a67){_0x2e2cad=_0x2e2cad-0x0;var _0xae39c3=_0xa3ab[_0x2e2cad];return _0xae39c3;};'use strict';var _=require(_0xba3a('0x0'));var util=require('util');var logger=require(_0xba3a('0x1'))(_0xba3a('0x2'));var moment=require(_0xba3a('0x3'));var BPromise=require(_0xba3a('0x4'));var rp=require(_0xba3a('0x5'));var fs=require('fs');var path=require(_0xba3a('0x6'));var rimraf=require(_0xba3a('0x7'));var config=require(_0xba3a('0x8'));var attributes=require(_0xba3a('0x9'));module[_0xba3a('0xa')]=function(_0x5dfa1b,_0x489028){return _0x5dfa1b[_0xba3a('0xb')]('Condition',attributes,{'tableName':_0xba3a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfde9=['rimraf','../../config/environment','./condition.attributes','define','Condition','tools_conditions','api','moment','bluebird','request-promise'];(function(_0x5333ba,_0x22e1bb){var _0x20f9dc=function(_0x1956af){while(--_0x1956af){_0x5333ba['push'](_0x5333ba['shift']());}};_0x20f9dc(++_0x22e1bb);}(_0xfde9,0x6a));var _0x9fde=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xfde9[_0x4a9beb];return _0x2d4c58;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9fde('0x0'));var moment=require(_0x9fde('0x1'));var BPromise=require(_0x9fde('0x2'));var rp=require(_0x9fde('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fde('0x4'));var config=require(_0x9fde('0x5'));var attributes=require(_0x9fde('0x6'));module['exports']=function(_0x155500,_0x224122){return _0x155500[_0x9fde('0x7')](_0x9fde('0x8'),attributes,{'tableName':_0x9fde('0x9'),'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 fea9ee3..535b053 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 _0x2041=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','Condition,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis'];(function(_0x4a6f4f,_0x3ebb46){var _0x3c851c=function(_0x392862){while(--_0x392862){_0x4a6f4f['push'](_0x4a6f4f['shift']());}};_0x3c851c(++_0x3ebb46);}(_0x2041,0x178));var _0x1204=function(_0x54fd0d,_0xb73883){_0x54fd0d=_0x54fd0d-0x0;var _0xb4049=_0x2041[_0x54fd0d];return _0xb4049;};'use strict';var _=require('lodash');var util=require(_0x1204('0x0'));var moment=require(_0x1204('0x1'));var BPromise=require(_0x1204('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1204('0x3'));var db=require(_0x1204('0x4'))['db'];var utils=require(_0x1204('0x5'));var logger=require(_0x1204('0x6'))('rpc');var config=require(_0x1204('0x7'));var jayson=require(_0x1204('0x8'));var client=jayson[_0x1204('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2becfd,_0x492597,_0x247749){return new BPromise(function(_0xab61e9,_0x4c7e6b){return client[_0x1204('0xa')](_0x2becfd,_0x247749)[_0x1204('0xb')](function(_0x4efb07){logger[_0x1204('0xc')]('Condition,\x20%s,\x20%s',_0x492597,_0x1204('0xd'));logger['debug'](_0x1204('0xe'),_0x492597,'request\x20sent',JSON[_0x1204('0xf')](_0x4efb07));if(_0x4efb07[_0x1204('0x10')]){if(_0x4efb07[_0x1204('0x10')]['code']===0x1f4){logger[_0x1204('0x10')]('Condition,\x20%s,\x20%s',_0x492597,_0x4efb07[_0x1204('0x10')]['message']);return _0x4c7e6b(_0x4efb07[_0x1204('0x10')]['message']);}logger[_0x1204('0x10')](_0x1204('0x11'),_0x492597,_0x4efb07[_0x1204('0x10')][_0x1204('0x12')]);return _0xab61e9(_0x4efb07[_0x1204('0x10')]['message']);}else{logger[_0x1204('0xc')](_0x1204('0x11'),_0x492597,_0x1204('0xd'));_0xab61e9(_0x4efb07['result'][_0x1204('0x12')]);}})[_0x1204('0x13')](function(_0x127647){logger[_0x1204('0x10')]('Condition,\x20%s,\x20%s',_0x492597,_0x127647);_0x4c7e6b(_0x127647);});});} \ No newline at end of file +var _0x94e0=['rpc','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x94e0,0x1b1));var _0x094e=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x94e0[_0x582f72];return _0x4cd5fe;};'use strict';var _=require(_0x094e('0x0'));var util=require(_0x094e('0x1'));var moment=require(_0x094e('0x2'));var BPromise=require(_0x094e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x094e('0x4'));var db=require(_0x094e('0x5'))['db'];var utils=require(_0x094e('0x6'));var logger=require('../../config/logger')(_0x094e('0x7'));var config=require(_0x094e('0x8'));var jayson=require(_0x094e('0x9'));var client=jayson[_0x094e('0xa')][_0x094e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f2c4d,_0x333070,_0x5d0c7b){return new BPromise(function(_0x408bb3,_0x50eabb){return client[_0x094e('0xc')](_0x4f2c4d,_0x5d0c7b)['then'](function(_0x1e38ae){logger[_0x094e('0xd')](_0x094e('0xe'),_0x333070,_0x094e('0xf'));logger[_0x094e('0x10')](_0x094e('0x11'),_0x333070,'request\x20sent',JSON[_0x094e('0x12')](_0x1e38ae));if(_0x1e38ae[_0x094e('0x13')]){if(_0x1e38ae[_0x094e('0x13')]['code']===0x1f4){logger['error'](_0x094e('0xe'),_0x333070,_0x1e38ae[_0x094e('0x13')][_0x094e('0x14')]);return _0x50eabb(_0x1e38ae[_0x094e('0x13')][_0x094e('0x14')]);}logger[_0x094e('0x13')](_0x094e('0xe'),_0x333070,_0x1e38ae[_0x094e('0x13')][_0x094e('0x14')]);return _0x408bb3(_0x1e38ae[_0x094e('0x13')][_0x094e('0x14')]);}else{logger[_0x094e('0xd')](_0x094e('0xe'),_0x333070,_0x094e('0xf'));_0x408bb3(_0x1e38ae['result']['message']);}})[_0x094e('0x15')](function(_0x5d7718){logger[_0x094e('0x13')](_0x094e('0xe'),_0x333070,_0x5d7718);_0x50eabb(_0x5d7718);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c261023..729a289 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 _0xd3fb=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','/:id','update','isAuthenticated','destroy','multer'];(function(_0x235f3d,_0x35daa3){var _0x4d244d=function(_0x11af6b){while(--_0x11af6b){_0x235f3d['push'](_0x235f3d['shift']());}};_0x4d244d(++_0x35daa3);}(_0xd3fb,0x117));var _0xbd3f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd3fb[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xbd3f('0x0'));var util=require(_0xbd3f('0x1'));var path=require(_0xbd3f('0x2'));var timeout=require(_0xbd3f('0x3'));var express=require(_0xbd3f('0x4'));var router=express[_0xbd3f('0x5')]();var fs_extra=require(_0xbd3f('0x6'));var auth=require(_0xbd3f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbd3f('0x8'));var controller=require(_0xbd3f('0x9'));router['put'](_0xbd3f('0xa'),auth['isAuthenticated'](),controller[_0xbd3f('0xb')]);router['delete'](_0xbd3f('0xa'),auth[_0xbd3f('0xc')](),controller[_0xbd3f('0xd')]);module['exports']=router; \ No newline at end of file +var _0x07c5=['/:id','isAuthenticated','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put'];(function(_0x35850c,_0x21a2c4){var _0x1d9249=function(_0x245e05){while(--_0x245e05){_0x35850c['push'](_0x35850c['shift']());}};_0x1d9249(++_0x21a2c4);}(_0x07c5,0x154));var _0x507c=function(_0x280bec,_0x3af2cd){_0x280bec=_0x280bec-0x0;var _0x2db8e6=_0x07c5[_0x280bec];return _0x2db8e6;};'use strict';var multer=require('multer');var util=require(_0x507c('0x0'));var path=require('path');var timeout=require(_0x507c('0x1'));var express=require(_0x507c('0x2'));var router=express['Router']();var fs_extra=require(_0x507c('0x3'));var auth=require(_0x507c('0x4'));var interaction=require(_0x507c('0x5'));var config=require('../../config/environment');var controller=require(_0x507c('0x6'));router[_0x507c('0x7')](_0x507c('0x8'),auth[_0x507c('0x9')](),controller['update']);router[_0x507c('0xa')](_0x507c('0x8'),auth[_0x507c('0x9')](),controller['destroy']);module[_0x507c('0xb')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a08d89f..a77e9f8 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 _0x2032=['name','exports','STRING'];(function(_0x1c2dde,_0x524a4d){var _0x59b6a1=function(_0x5a8821){while(--_0x5a8821){_0x1c2dde['push'](_0x1c2dde['shift']());}};_0x59b6a1(++_0x524a4d);}(_0x2032,0xd9));var _0x2203=function(_0x1572bb,_0x42d35e){_0x1572bb=_0x1572bb-0x0;var _0x6f5186=_0x2032[_0x1572bb];return _0x6f5186;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x4c3739,_0x20c75f){var _0xec073b=function(_0x2b3a3d){while(--_0x2b3a3d){_0x4c3739['push'](_0x4c3739['shift']());}};_0xec073b(++_0x20c75f);}(_0x757a,0xde));var _0xa757=function(_0x831915,_0x1b4c5f){_0x831915=_0x831915-0x0;var _0x16cb05=_0x757a[_0x831915];return _0x16cb05;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4558dc6..7dafde6 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 _0x02cb=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','sendStatus','error','name','index','map','Dashboard','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash'];(function(_0x345344,_0x451196){var _0x4a5881=function(_0x377fff){while(--_0x377fff){_0x345344['push'](_0x345344['shift']());}};_0x4a5881(++_0x451196);}(_0x02cb,0x163));var _0xb02c=function(_0x2124b1,_0x297e75){_0x2124b1=_0x2124b1-0x0;var _0x48ebf4=_0x02cb[_0x2124b1];return _0x48ebf4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb02c('0x0'));var zipdir=require(_0xb02c('0x1'));var jsonpatch=require(_0xb02c('0x2'));var rp=require('request-promise');var moment=require(_0xb02c('0x3'));var BPromise=require(_0xb02c('0x4'));var Mustache=require(_0xb02c('0x5'));var util=require(_0xb02c('0x6'));var path=require('path');var sox=require(_0xb02c('0x7'));var csv=require(_0xb02c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb02c('0x9'));var _=require(_0xb02c('0xa'));var squel=require(_0xb02c('0xb'));var crypto=require(_0xb02c('0xc'));var jsforce=require(_0xb02c('0xd'));var deskjs=require(_0xb02c('0xe'));var toCsv=require(_0xb02c('0x8'));var querystring=require(_0xb02c('0xf'));var Papa=require('papaparse');var Redis=require(_0xb02c('0x10'));var authService=require(_0xb02c('0x11'));var qs=require(_0xb02c('0x12'));var as=require(_0xb02c('0x13'));var hardwareService=require(_0xb02c('0x14'));var logger=require(_0xb02c('0x15'))('api');var utils=require(_0xb02c('0x16'));var config=require(_0xb02c('0x17'));var licenseUtil=require(_0xb02c('0x18'));var db=require(_0xb02c('0x19'))['db'];config[_0xb02c('0x1a')]=_['defaults'](config['redis'],{'host':_0xb02c('0x1b'),'port':0x18eb});var socket=require(_0xb02c('0x1c'))(new Redis(config['redis']));require(_0xb02c('0x1d'))[_0xb02c('0x1e')](socket);function respondWithStatusCode(_0x28afd7,_0x13310a){_0x13310a=_0x13310a||0xcc;return function(_0x271c00){if(_0x271c00){return _0x28afd7['sendStatus'](_0x13310a);}return _0x28afd7['status'](_0x13310a)[_0xb02c('0x1f')]();};}function respondWithResult(_0x53c4a7,_0x4d78e5){_0x4d78e5=_0x4d78e5||0xc8;return function(_0x2772e8){if(_0x2772e8){return _0x53c4a7['status'](_0x4d78e5)['json'](_0x2772e8);}};}function respondWithFilteredResult(_0x5e708e,_0x5d6b0b){return function(_0x427b67){if(_0x427b67){var _0x3c0026=typeof _0x5d6b0b[_0xb02c('0x20')]===_0xb02c('0x21')&&typeof _0x5d6b0b[_0xb02c('0x22')]===_0xb02c('0x21');var _0x49870b=_0x427b67['count'];var _0x19eb5b=_0x3c0026?0x0:_0x5d6b0b['offset'];var _0x4486db=_0x3c0026?_0x427b67[_0xb02c('0x23')]:_0x5d6b0b['offset']+_0x5d6b0b[_0xb02c('0x22')];var _0x535ee1;if(_0x4486db>=_0x49870b){_0x4486db=_0x49870b;_0x535ee1=0xc8;}else{_0x535ee1=0xce;}_0x5e708e[_0xb02c('0x24')](_0x535ee1);return _0x5e708e[_0xb02c('0x25')](_0xb02c('0x26'),_0x19eb5b+'-'+_0x4486db+'/'+_0x49870b)['json'](_0x427b67);}return null;};}function patchUpdates(_0x1c1af8){return function(_0x369ffb){try{jsonpatch[_0xb02c('0x27')](_0x369ffb,_0x1c1af8,!![]);}catch(_0x413f4d){return BPromise[_0xb02c('0x28')](_0x413f4d);}return _0x369ffb[_0xb02c('0x29')]();};}function saveUpdates(_0x1b56e4,_0x3994e1){return function(_0x295cac){if(_0x295cac){return _0x295cac[_0xb02c('0x2a')](_0x1b56e4)[_0xb02c('0x2b')](function(_0x3b1c3d){return _0x3b1c3d;});}return null;};}function removeEntity(_0x5a5b2e,_0x19dbcc){return function(_0x1f64c7){if(_0x1f64c7){return _0x1f64c7['destroy']()['then'](function(){var _0x17c8a0=_0x1f64c7[_0xb02c('0x2c')]({'plain':!![]});var _0x1b333f=_0xb02c('0x2d');return db[_0xb02c('0x2e')][_0xb02c('0x2f')]({'where':{'type':_0x1b333f,'resourceId':_0x17c8a0['id']}})[_0xb02c('0x2b')](function(){return _0x1f64c7;});})[_0xb02c('0x2b')](function(){_0x5a5b2e['status'](0xcc)[_0xb02c('0x1f')]();});}};}function handleEntityNotFound(_0x470b32,_0x34d069){return function(_0x21fcba){if(!_0x21fcba){_0x470b32[_0xb02c('0x30')](0x194);}return _0x21fcba;};}function handleError(_0x2fc84e,_0x579394){_0x579394=_0x579394||0x1f4;return function(_0x45ff79){logger[_0xb02c('0x31')](_0x45ff79['stack']);if(_0x45ff79['name']){delete _0x45ff79[_0xb02c('0x32')];}_0x2fc84e[_0xb02c('0x24')](_0x579394)['send'](_0x45ff79);};}exports[_0xb02c('0x33')]=function(_0x2c9116,_0x204a85){var _0x2508de={},_0x3dd058={},_0x863c6c={'count':0x0,'rows':[]};var _0x5438f2=_[_0xb02c('0x34')](db[_0xb02c('0x35')][_0xb02c('0x36')],function(_0x4e58fd){return{'name':_0x4e58fd['fieldName'],'type':_0x4e58fd[_0xb02c('0x37')][_0xb02c('0x38')]};});_0x3dd058[_0xb02c('0x39')]=_['map'](_0x5438f2,_0xb02c('0x32'));_0x3dd058[_0xb02c('0x3a')]=_[_0xb02c('0x3b')](_0x2c9116[_0xb02c('0x3a')]);_0x3dd058['filters']=_[_0xb02c('0x3c')](_0x3dd058[_0xb02c('0x39')],_0x3dd058[_0xb02c('0x3a')]);_0x2508de[_0xb02c('0x3d')]=_[_0xb02c('0x3c')](_0x3dd058['model'],qs['fields'](_0x2c9116[_0xb02c('0x3a')][_0xb02c('0x3e')]));_0x2508de['attributes']=_0x2508de['attributes'][_0xb02c('0x3f')]?_0x2508de[_0xb02c('0x3d')]:_0x3dd058['model'];if(!_0x2c9116[_0xb02c('0x3a')][_0xb02c('0x40')]('nolimit')){_0x2508de[_0xb02c('0x22')]=qs[_0xb02c('0x22')](_0x2c9116[_0xb02c('0x3a')][_0xb02c('0x22')]);_0x2508de['offset']=qs[_0xb02c('0x20')](_0x2c9116[_0xb02c('0x3a')][_0xb02c('0x20')]);}_0x2508de[_0xb02c('0x41')]=qs[_0xb02c('0x42')](_0x2c9116[_0xb02c('0x3a')]['sort']);_0x2508de[_0xb02c('0x43')]=qs[_0xb02c('0x44')](_[_0xb02c('0x45')](_0x2c9116[_0xb02c('0x3a')],_0x3dd058[_0xb02c('0x44')]),_0x5438f2);if(_0x2c9116[_0xb02c('0x3a')][_0xb02c('0x46')]){_0x2508de[_0xb02c('0x43')]=_[_0xb02c('0x47')](_0x2508de[_0xb02c('0x43')],{'$or':_['map'](_0x5438f2,function(_0x48a5dc){if(_0x48a5dc[_0xb02c('0x37')]!=='VIRTUAL'){var _0x135baf={};_0x135baf[_0x48a5dc[_0xb02c('0x32')]]={'$like':'%'+_0x2c9116['query'][_0xb02c('0x46')]+'%'};return _0x135baf;}})});}_0x2508de=_[_0xb02c('0x47')]({},_0x2508de,_0x2c9116[_0xb02c('0x48')]);var _0x38d30e={'where':_0x2508de[_0xb02c('0x43')]};return db['Dashboard'][_0xb02c('0x23')](_0x38d30e)[_0xb02c('0x2b')](function(_0x46db38){_0x863c6c[_0xb02c('0x23')]=_0x46db38;if(_0x2c9116[_0xb02c('0x3a')][_0xb02c('0x49')]){_0x2508de[_0xb02c('0x4a')]=[{'all':!![]}];}return db[_0xb02c('0x35')]['findAll'](_0x2508de);})[_0xb02c('0x2b')](function(_0x5a0881){_0x863c6c['rows']=_0x5a0881;return _0x863c6c;})[_0xb02c('0x2b')](respondWithFilteredResult(_0x204a85,_0x2508de))[_0xb02c('0x4b')](handleError(_0x204a85,null));};exports[_0xb02c('0x4c')]=function(_0x46534d,_0x4f22f5){var _0x555c57={'raw':![],'where':{'id':_0x46534d['params']['id']}},_0x447849={};_0x447849['model']=_[_0xb02c('0x3b')](db[_0xb02c('0x35')][_0xb02c('0x36')]);_0x447849[_0xb02c('0x3a')]=_[_0xb02c('0x3b')](_0x46534d[_0xb02c('0x3a')]);_0x447849[_0xb02c('0x44')]=_[_0xb02c('0x3c')](_0x447849['model'],_0x447849['query']);_0x555c57[_0xb02c('0x3d')]=_[_0xb02c('0x3c')](_0x447849[_0xb02c('0x39')],qs['fields'](_0x46534d['query'][_0xb02c('0x3e')]));_0x555c57[_0xb02c('0x3d')]=_0x555c57[_0xb02c('0x3d')][_0xb02c('0x3f')]?_0x555c57[_0xb02c('0x3d')]:_0x447849[_0xb02c('0x39')];if(_0x46534d[_0xb02c('0x3a')][_0xb02c('0x49')]){_0x555c57[_0xb02c('0x4a')]=[{'all':!![]}];}_0x555c57=_[_0xb02c('0x47')]({},_0x555c57,_0x46534d['options']);return db[_0xb02c('0x35')][_0xb02c('0x4d')](_0x555c57)[_0xb02c('0x2b')](handleEntityNotFound(_0x4f22f5,null))['then'](respondWithResult(_0x4f22f5,null))[_0xb02c('0x4b')](handleError(_0x4f22f5,null));};exports[_0xb02c('0x4e')]=function(_0x36bb42,_0x4e33d1){return db[_0xb02c('0x35')][_0xb02c('0x4e')](_0x36bb42[_0xb02c('0x4f')],{})[_0xb02c('0x2b')](function(_0x34a2db){var _0x1589be=_0x36bb42[_0xb02c('0x50')][_0xb02c('0x2c')]({'plain':!![]});if(!_0x1589be)throw new Error(_0xb02c('0x51'));if(_0x1589be[_0xb02c('0x52')]===_0xb02c('0x50')){var _0x5e4238=_0x34a2db['get']({'plain':!![]});var _0x4f3b2d=_0xb02c('0x2d');return db['UserProfileSection'][_0xb02c('0x4d')]({'where':{'name':_0x4f3b2d,'userProfileId':_0x1589be[_0xb02c('0x53')]},'raw':!![]})[_0xb02c('0x2b')](function(_0x2bdb66){if(_0x2bdb66&&_0x2bdb66[_0xb02c('0x54')]===0x0){return db[_0xb02c('0x2e')][_0xb02c('0x4e')]({'name':_0x5e4238['name'],'resourceId':_0x5e4238['id'],'type':_0x2bdb66[_0xb02c('0x32')],'sectionId':_0x2bdb66['id']},{})[_0xb02c('0x2b')](function(){return _0x34a2db;});}else{return _0x34a2db;}})[_0xb02c('0x4b')](function(_0x1f2c07){logger['error'](_0xb02c('0x55'),_0x1f2c07);throw _0x1f2c07;});}return _0x34a2db;})[_0xb02c('0x2b')](respondWithResult(_0x4e33d1,0xc9))['catch'](handleError(_0x4e33d1,null));};exports[_0xb02c('0x56')]=function(_0x37b653,_0x5856f0){var _0x3fb164={'where':{'id':_0x37b653[_0xb02c('0x57')]['id']}},_0x5edf32={};_0x5edf32[_0xb02c('0x39')]=_[_0xb02c('0x3b')](db[_0xb02c('0x35')]['rawAttributes']);_0x3fb164['attributes']=_['intersection'](_0x5edf32[_0xb02c('0x39')],qs[_0xb02c('0x3e')](_0x37b653[_0xb02c('0x3a')]['fields']));_0x3fb164[_0xb02c('0x3d')]=_0x3fb164[_0xb02c('0x3d')]['length']?_0x3fb164['attributes']:_0x5edf32[_0xb02c('0x39')];if(_0x37b653[_0xb02c('0x3a')][_0xb02c('0x49')]){_0x3fb164[_0xb02c('0x4a')]=[{'all':!![]}];}_0x3fb164=_[_0xb02c('0x47')]({},_0x3fb164,_0x37b653[_0xb02c('0x48')]);return db[_0xb02c('0x35')][_0xb02c('0x4d')](_0x3fb164)[_0xb02c('0x2b')](handleEntityNotFound(_0x5856f0,null))[_0xb02c('0x2b')](function(_0x33f172){if(_0x33f172){var _0x53ab9e=_0x33f172[_0xb02c('0x2c')]({'plain':!![]});_0x53ab9e=qs[_0xb02c('0x58')](_0x53ab9e,['id',_0xb02c('0x59'),'updatedAt']);_0x37b653[_0xb02c('0x4f')]=_[_0xb02c('0x58')](_0x37b653['body'],['id',_0xb02c('0x59'),'updatedAt']);return db[_0xb02c('0x35')][_0xb02c('0x4e')](_[_0xb02c('0x47')](_0x53ab9e,_0x37b653[_0xb02c('0x4f')]),{'include':_0x37b653[_0xb02c('0x3a')][_0xb02c('0x49')]?[{'all':!![]}]:undefined})[_0xb02c('0x2b')](function(_0x2067c3){var _0x4289a1=_0x37b653[_0xb02c('0x50')][_0xb02c('0x2c')]({'plain':!![]});if(!_0x4289a1)throw new Error(_0xb02c('0x51'));if(_0x4289a1[_0xb02c('0x52')]===_0xb02c('0x50')){var _0x3f77ca=_0x2067c3[_0xb02c('0x2c')]({'plain':!![]});var _0x58cb43=_0xb02c('0x2d');return db['UserProfileSection'][_0xb02c('0x4d')]({'where':{'name':_0x58cb43,'userProfileId':_0x4289a1[_0xb02c('0x53')]},'raw':!![]})[_0xb02c('0x2b')](function(_0x1eeb3c){if(_0x1eeb3c&&_0x1eeb3c['autoAssociation']===0x0){return db[_0xb02c('0x2e')][_0xb02c('0x4e')]({'name':_0x3f77ca['name'],'resourceId':_0x3f77ca['id'],'type':_0x1eeb3c[_0xb02c('0x32')],'sectionId':_0x1eeb3c['id']},{})[_0xb02c('0x2b')](function(){return _0x2067c3;});}else{return _0x2067c3;}})[_0xb02c('0x4b')](function(_0x20ac07){logger['error'](_0xb02c('0x55'),_0x20ac07);throw _0x20ac07;});}return _0x2067c3;});}})[_0xb02c('0x2b')](respondWithResult(_0x5856f0,0xc9))['catch'](handleError(_0x5856f0,null));};exports[_0xb02c('0x2a')]=function(_0x46c04f,_0x2a7790){if(_0x46c04f[_0xb02c('0x4f')]['id']){delete _0x46c04f[_0xb02c('0x4f')]['id'];}return db[_0xb02c('0x35')][_0xb02c('0x4d')]({'where':{'id':_0x46c04f[_0xb02c('0x57')]['id']}})[_0xb02c('0x2b')](handleEntityNotFound(_0x2a7790,null))[_0xb02c('0x2b')](saveUpdates(_0x46c04f[_0xb02c('0x4f')],null))[_0xb02c('0x2b')](respondWithResult(_0x2a7790,null))[_0xb02c('0x4b')](handleError(_0x2a7790,null));};exports[_0xb02c('0x2f')]=function(_0x17565f,_0x249590){return db[_0xb02c('0x35')][_0xb02c('0x4d')]({'where':{'id':_0x17565f['params']['id']}})[_0xb02c('0x2b')](handleEntityNotFound(_0x249590,null))['then'](removeEntity(_0x249590,null))[_0xb02c('0x4b')](handleError(_0x249590,null));};function widgetAttributes(_0x38c660){try{switch(_0x38c660[_0xb02c('0x37')]){case _0xb02c('0x5a'):return[{'name':_0xb02c('0x5b'),'value':_0x38c660[_0xb02c('0x5b')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x0]?_0x38c660['attrs'][0x0][_0xb02c('0x5d')]:undefined)||_0xb02c('0x5e')}];case _0xb02c('0x5f'):return[{'name':_0xb02c('0x60'),'value':_0x38c660[_0xb02c('0x60')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660['attrs'][0x0]?_0x38c660[_0xb02c('0x5c')][0x0][_0xb02c('0x5d')]:undefined)||''}];case _0xb02c('0x61'):return[{'name':_0xb02c('0x62'),'value':_0x38c660[_0xb02c('0x62')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x0]?_0x38c660[_0xb02c('0x5c')][0x0][_0xb02c('0x5d')]:undefined)||_0xb02c('0x63')},{'name':_0xb02c('0x64'),'value':_0x38c660['attrTimezone']||(_0x38c660['attrs']&&_0x38c660[_0xb02c('0x5c')][0x1]?_0x38c660[_0xb02c('0x5c')][0x1][_0xb02c('0x5d')]:undefined)||_0xb02c('0x65')},{'name':_0xb02c('0x66'),'value':_0x38c660[_0xb02c('0x66')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x2]?_0x38c660['attrs'][0x2][_0xb02c('0x5d')]:undefined)||0xc}];case'counter':return[{'name':_0xb02c('0x67'),'value':_0x38c660[_0xb02c('0x67')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x0]?_0x38c660[_0xb02c('0x5c')][0x0][_0xb02c('0x5d')]:undefined)||_0xb02c('0x68')},{'name':_0xb02c('0x69'),'value':_0x38c660[_0xb02c('0x69')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x1]?_0x38c660[_0xb02c('0x5c')][0x1][_0xb02c('0x5d')]:undefined)||[]},{'name':_0xb02c('0x66'),'value':_0x38c660[_0xb02c('0x66')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660['attrs'][0x2]?_0x38c660['attrs'][0x2]['value']:undefined)||0x14}];case _0xb02c('0x6a'):case _0xb02c('0x6b'):return[{'name':'attrSerie1','value':_0x38c660[_0xb02c('0x6c')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x0]?_0x38c660[_0xb02c('0x5c')][0x0][_0xb02c('0x5d')]:undefined)||'total'},{'name':'attrSerie2','value':_0x38c660[_0xb02c('0x6d')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x1]?_0x38c660[_0xb02c('0x5c')][0x1][_0xb02c('0x5d')]:undefined)||null},{'name':_0xb02c('0x6e'),'value':_0x38c660[_0xb02c('0x6e')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660['attrs'][0x2]?_0x38c660[_0xb02c('0x5c')][0x2][_0xb02c('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x38c660[_0xb02c('0x69')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x3]?_0x38c660['attrs'][0x3][_0xb02c('0x5d')]:undefined)||[]}];case'web-report':return[{'name':_0xb02c('0x6f'),'type':_0x38c660[_0xb02c('0x70')]||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x0]?_0x38c660[_0xb02c('0x5c')][0x0]['type']:undefined)||null,'value':_0x38c660['attrReport']||(_0x38c660['attrs']&&_0x38c660[_0xb02c('0x5c')][0x0]?_0x38c660[_0xb02c('0x5c')][0x0]['value']:undefined)||null},{'name':_0xb02c('0x71'),'value':_0x38c660['attrRefresh']||(_0x38c660[_0xb02c('0x5c')]&&_0x38c660[_0xb02c('0x5c')][0x1]?_0x38c660[_0xb02c('0x5c')][0x1][_0xb02c('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0xd31359){logger[_0xb02c('0x31')](_0xb02c('0x72'),JSON[_0xb02c('0x73')](_0xd31359));return[];}}exports[_0xb02c('0x74')]=function(_0x5540e8,_0x384f76,_0x34c307){if(_0x5540e8[_0xb02c('0x4f')]['id']){delete _0x5540e8[_0xb02c('0x4f')]['id'];}return db[_0xb02c('0x35')][_0xb02c('0x4d')]({'where':{'id':_0x5540e8['params']['id']}})['then'](handleEntityNotFound(_0x384f76,null))['then'](function(_0x1211de){if(_0x1211de){_0x5540e8[_0xb02c('0x4f')][_0xb02c('0x75')]=_0x1211de['id'];_0x5540e8['body'][_0xb02c('0x5c')]=widgetAttributes(_0x5540e8[_0xb02c('0x4f')]);return db[_0xb02c('0x76')][_0xb02c('0x4e')](_0x5540e8[_0xb02c('0x4f')]);}})[_0xb02c('0x2b')](respondWithResult(_0x384f76,null))[_0xb02c('0x4b')](handleError(_0x384f76,null));};exports[_0xb02c('0x77')]=function(_0x46872c,_0x270452,_0x3ff604){var _0x97ab04={};var _0x363fca={};var _0x1a8c2e;var _0x47d976;return db[_0xb02c('0x35')][_0xb02c('0x78')]({'where':{'id':_0x46872c['params']['id']}})[_0xb02c('0x2b')](handleEntityNotFound(_0x270452,null))[_0xb02c('0x2b')](function(_0xc86de){if(_0xc86de){_0x1a8c2e=_0xc86de;_0x363fca[_0xb02c('0x39')]=_[_0xb02c('0x3b')](db[_0xb02c('0x76')][_0xb02c('0x36')]);_0x363fca[_0xb02c('0x3a')]=_[_0xb02c('0x3b')](_0x46872c[_0xb02c('0x3a')]);_0x363fca[_0xb02c('0x44')]=_['intersection'](_0x363fca[_0xb02c('0x39')],_0x363fca['query']);_0x97ab04[_0xb02c('0x3d')]=_[_0xb02c('0x3c')](_0x363fca['model'],qs[_0xb02c('0x3e')](_0x46872c['query']['fields']));_0x97ab04[_0xb02c('0x3d')]=_0x97ab04[_0xb02c('0x3d')][_0xb02c('0x3f')]?_0x97ab04['attributes']:_0x363fca[_0xb02c('0x39')];_0x97ab04[_0xb02c('0x41')]=qs['sort'](_0x46872c[_0xb02c('0x3a')][_0xb02c('0x42')]);_0x97ab04[_0xb02c('0x43')]=qs['filters'](_[_0xb02c('0x45')](_0x46872c[_0xb02c('0x3a')],_0x363fca[_0xb02c('0x44')]));if(_0x46872c[_0xb02c('0x3a')]['filter']){_0x97ab04[_0xb02c('0x43')]=_[_0xb02c('0x47')](_0x97ab04[_0xb02c('0x43')],{'$or':_['map'](_0x97ab04[_0xb02c('0x3d')],function(_0xc52c53){var _0x1bcb93={};_0x1bcb93[_0xc52c53]={'$like':'%'+_0x46872c[_0xb02c('0x3a')]['filter']+'%'};return _0x1bcb93;})});}_0x97ab04=_['merge']({},_0x97ab04,_0x46872c[_0xb02c('0x48')]);return _0x1a8c2e['getItems'](_0x97ab04);}})[_0xb02c('0x2b')](function(_0xd61341){if(_0xd61341){_0x47d976=_0xd61341[_0xb02c('0x3f')];if(!_0x46872c[_0xb02c('0x3a')]['hasOwnProperty'](_0xb02c('0x79'))){_0x97ab04[_0xb02c('0x22')]=qs[_0xb02c('0x22')](_0x46872c[_0xb02c('0x3a')][_0xb02c('0x22')]);_0x97ab04[_0xb02c('0x20')]=qs[_0xb02c('0x20')](_0x46872c[_0xb02c('0x3a')][_0xb02c('0x20')]);}return _0x1a8c2e['getItems'](_0x97ab04);}})[_0xb02c('0x2b')](function(_0x2eda87){if(_0x2eda87){return _0x2eda87?{'count':_0x47d976,'rows':_0x2eda87}:null;}})[_0xb02c('0x2b')](respondWithResult(_0x270452,null))[_0xb02c('0x4b')](handleError(_0x270452,null));}; \ No newline at end of file +var _0x34c7=['web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','order','getItems','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','limit','undefined','count','offset','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','end','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','type','options','include','findAll','catch','show','params','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','includeAll','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrMetric','attrVoiceQueues','attrFontSize','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3'];(function(_0x5324a0,_0x44cdc2){var _0x413e16=function(_0x19840b){while(--_0x19840b){_0x5324a0['push'](_0x5324a0['shift']());}};_0x413e16(++_0x44cdc2);}(_0x34c7,0xf8));var _0x734c=function(_0x33651d,_0x93a579){_0x33651d=_0x33651d-0x0;var _0x355d78=_0x34c7[_0x33651d];return _0x355d78;};'use strict';var emlformat=require(_0x734c('0x0'));var rimraf=require(_0x734c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x734c('0x2'));var rp=require('request-promise');var moment=require(_0x734c('0x3'));var BPromise=require(_0x734c('0x4'));var Mustache=require('mustache');var util=require(_0x734c('0x5'));var path=require('path');var sox=require(_0x734c('0x6'));var csv=require(_0x734c('0x7'));var ejs=require(_0x734c('0x8'));var fs=require('fs');var fs_extra=require(_0x734c('0x9'));var _=require('lodash');var squel=require(_0x734c('0xa'));var crypto=require(_0x734c('0xb'));var jsforce=require(_0x734c('0xc'));var deskjs=require(_0x734c('0xd'));var toCsv=require(_0x734c('0x7'));var querystring=require(_0x734c('0xe'));var Papa=require(_0x734c('0xf'));var Redis=require(_0x734c('0x10'));var authService=require(_0x734c('0x11'));var qs=require(_0x734c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x734c('0x13'));var logger=require(_0x734c('0x14'))('api');var utils=require(_0x734c('0x15'));var config=require(_0x734c('0x16'));var licenseUtil=require(_0x734c('0x17'));var db=require(_0x734c('0x18'))['db'];config['redis']=_[_0x734c('0x19')](config[_0x734c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x734c('0x1b'))(new Redis(config[_0x734c('0x1a')]));require(_0x734c('0x1c'))[_0x734c('0x1d')](socket);function respondWithStatusCode(_0x37eb69,_0x2f9d04){_0x2f9d04=_0x2f9d04||0xcc;return function(_0x594267){if(_0x594267){return _0x37eb69[_0x734c('0x1e')](_0x2f9d04);}return _0x37eb69[_0x734c('0x1f')](_0x2f9d04)['end']();};}function respondWithResult(_0x271428,_0x4ba727){_0x4ba727=_0x4ba727||0xc8;return function(_0x16da0a){if(_0x16da0a){return _0x271428[_0x734c('0x1f')](_0x4ba727)[_0x734c('0x20')](_0x16da0a);}};}function respondWithFilteredResult(_0x329d71,_0x2bbf9f){return function(_0x13551d){if(_0x13551d){var _0x158c56=typeof _0x2bbf9f['offset']==='undefined'&&typeof _0x2bbf9f[_0x734c('0x21')]===_0x734c('0x22');var _0x2e06d2=_0x13551d[_0x734c('0x23')];var _0x608e26=_0x158c56?0x0:_0x2bbf9f['offset'];var _0x510ae1=_0x158c56?_0x13551d['count']:_0x2bbf9f[_0x734c('0x24')]+_0x2bbf9f['limit'];var _0x537f11;if(_0x510ae1>=_0x2e06d2){_0x510ae1=_0x2e06d2;_0x537f11=0xc8;}else{_0x537f11=0xce;}_0x329d71['status'](_0x537f11);return _0x329d71['set']('Content-Range',_0x608e26+'-'+_0x510ae1+'/'+_0x2e06d2)[_0x734c('0x20')](_0x13551d);}return null;};}function patchUpdates(_0x35db4e){return function(_0x30e6cb){try{jsonpatch['apply'](_0x30e6cb,_0x35db4e,!![]);}catch(_0x465e9c){return BPromise[_0x734c('0x25')](_0x465e9c);}return _0x30e6cb['save']();};}function saveUpdates(_0x44c4d5,_0x14855e){return function(_0x389f54){if(_0x389f54){return _0x389f54[_0x734c('0x26')](_0x44c4d5)[_0x734c('0x27')](function(_0x535acd){return _0x535acd;});}return null;};}function removeEntity(_0x1df8b2,_0x3a9450){return function(_0x203833){if(_0x203833){return _0x203833[_0x734c('0x28')]()[_0x734c('0x27')](function(){var _0x56c83f=_0x203833[_0x734c('0x29')]({'plain':!![]});var _0x9c9e08=_0x734c('0x2a');return db[_0x734c('0x2b')]['destroy']({'where':{'type':_0x9c9e08,'resourceId':_0x56c83f['id']}})[_0x734c('0x27')](function(){return _0x203833;});})[_0x734c('0x27')](function(){_0x1df8b2[_0x734c('0x1f')](0xcc)[_0x734c('0x2c')]();});}};}function handleEntityNotFound(_0x461978,_0x44ca8b){return function(_0x467b1a){if(!_0x467b1a){_0x461978[_0x734c('0x1e')](0x194);}return _0x467b1a;};}function handleError(_0x47c50b,_0x241ee0){_0x241ee0=_0x241ee0||0x1f4;return function(_0x16b08d){logger['error'](_0x16b08d[_0x734c('0x2d')]);if(_0x16b08d['name']){delete _0x16b08d[_0x734c('0x2e')];}_0x47c50b[_0x734c('0x1f')](_0x241ee0)[_0x734c('0x2f')](_0x16b08d);};}exports[_0x734c('0x30')]=function(_0x9a2530,_0x39bcac){var _0x5dc62f={},_0x3a264c={},_0x385308={'count':0x0,'rows':[]};var _0x518c05=_[_0x734c('0x31')](db[_0x734c('0x32')][_0x734c('0x33')],function(_0x20dda4){return{'name':_0x20dda4[_0x734c('0x34')],'type':_0x20dda4['type'][_0x734c('0x35')]};});_0x3a264c[_0x734c('0x36')]=_[_0x734c('0x31')](_0x518c05,'name');_0x3a264c[_0x734c('0x37')]=_[_0x734c('0x38')](_0x9a2530[_0x734c('0x37')]);_0x3a264c['filters']=_['intersection'](_0x3a264c[_0x734c('0x36')],_0x3a264c[_0x734c('0x37')]);_0x5dc62f['attributes']=_[_0x734c('0x39')](_0x3a264c[_0x734c('0x36')],qs[_0x734c('0x3a')](_0x9a2530['query'][_0x734c('0x3a')]));_0x5dc62f[_0x734c('0x3b')]=_0x5dc62f['attributes']['length']?_0x5dc62f[_0x734c('0x3b')]:_0x3a264c[_0x734c('0x36')];if(!_0x9a2530[_0x734c('0x37')][_0x734c('0x3c')]('nolimit')){_0x5dc62f[_0x734c('0x21')]=qs['limit'](_0x9a2530[_0x734c('0x37')]['limit']);_0x5dc62f[_0x734c('0x24')]=qs[_0x734c('0x24')](_0x9a2530['query'][_0x734c('0x24')]);}_0x5dc62f['order']=qs['sort'](_0x9a2530[_0x734c('0x37')][_0x734c('0x3d')]);_0x5dc62f[_0x734c('0x3e')]=qs[_0x734c('0x3f')](_[_0x734c('0x40')](_0x9a2530[_0x734c('0x37')],_0x3a264c[_0x734c('0x3f')]),_0x518c05);if(_0x9a2530[_0x734c('0x37')][_0x734c('0x41')]){_0x5dc62f['where']=_['merge'](_0x5dc62f['where'],{'$or':_[_0x734c('0x31')](_0x518c05,function(_0x46d1f4){if(_0x46d1f4[_0x734c('0x42')]!=='VIRTUAL'){var _0x1bc6a6={};_0x1bc6a6[_0x46d1f4[_0x734c('0x2e')]]={'$like':'%'+_0x9a2530['query'][_0x734c('0x41')]+'%'};return _0x1bc6a6;}})});}_0x5dc62f=_['merge']({},_0x5dc62f,_0x9a2530[_0x734c('0x43')]);var _0x3521cb={'where':_0x5dc62f['where']};return db[_0x734c('0x32')]['count'](_0x3521cb)['then'](function(_0x33432f){_0x385308['count']=_0x33432f;if(_0x9a2530[_0x734c('0x37')]['includeAll']){_0x5dc62f[_0x734c('0x44')]=[{'all':!![]}];}return db[_0x734c('0x32')][_0x734c('0x45')](_0x5dc62f);})['then'](function(_0x1add8e){_0x385308['rows']=_0x1add8e;return _0x385308;})[_0x734c('0x27')](respondWithFilteredResult(_0x39bcac,_0x5dc62f))[_0x734c('0x46')](handleError(_0x39bcac,null));};exports[_0x734c('0x47')]=function(_0x4696eb,_0x2465c3){var _0x290d27={'raw':![],'where':{'id':_0x4696eb[_0x734c('0x48')]['id']}},_0xf95702={};_0xf95702[_0x734c('0x36')]=_[_0x734c('0x38')](db['Dashboard'][_0x734c('0x33')]);_0xf95702[_0x734c('0x37')]=_[_0x734c('0x38')](_0x4696eb[_0x734c('0x37')]);_0xf95702['filters']=_[_0x734c('0x39')](_0xf95702[_0x734c('0x36')],_0xf95702[_0x734c('0x37')]);_0x290d27['attributes']=_[_0x734c('0x39')](_0xf95702['model'],qs['fields'](_0x4696eb['query'][_0x734c('0x3a')]));_0x290d27['attributes']=_0x290d27['attributes'][_0x734c('0x49')]?_0x290d27[_0x734c('0x3b')]:_0xf95702[_0x734c('0x36')];if(_0x4696eb[_0x734c('0x37')]['includeAll']){_0x290d27['include']=[{'all':!![]}];}_0x290d27=_[_0x734c('0x4a')]({},_0x290d27,_0x4696eb[_0x734c('0x43')]);return db[_0x734c('0x32')][_0x734c('0x4b')](_0x290d27)['then'](handleEntityNotFound(_0x2465c3,null))[_0x734c('0x27')](respondWithResult(_0x2465c3,null))['catch'](handleError(_0x2465c3,null));};exports[_0x734c('0x4c')]=function(_0x22bc13,_0x237d3e){return db['Dashboard'][_0x734c('0x4c')](_0x22bc13[_0x734c('0x4d')],{})['then'](function(_0x1d0e7e){var _0x3ca1bf=_0x22bc13[_0x734c('0x4e')][_0x734c('0x29')]({'plain':!![]});if(!_0x3ca1bf)throw new Error(_0x734c('0x4f'));if(_0x3ca1bf[_0x734c('0x50')]==='user'){var _0x190746=_0x1d0e7e['get']({'plain':!![]});var _0x589309='CustomDashboards';return db[_0x734c('0x51')][_0x734c('0x4b')]({'where':{'name':_0x589309,'userProfileId':_0x3ca1bf[_0x734c('0x52')]},'raw':!![]})[_0x734c('0x27')](function(_0xdb8ca2){if(_0xdb8ca2&&_0xdb8ca2[_0x734c('0x53')]===0x0){return db[_0x734c('0x2b')][_0x734c('0x4c')]({'name':_0x190746[_0x734c('0x2e')],'resourceId':_0x190746['id'],'type':_0xdb8ca2[_0x734c('0x2e')],'sectionId':_0xdb8ca2['id']},{})[_0x734c('0x27')](function(){return _0x1d0e7e;});}else{return _0x1d0e7e;}})[_0x734c('0x46')](function(_0xc07ee8){logger[_0x734c('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc07ee8);throw _0xc07ee8;});}return _0x1d0e7e;})['then'](respondWithResult(_0x237d3e,0xc9))[_0x734c('0x46')](handleError(_0x237d3e,null));};exports[_0x734c('0x55')]=function(_0x16cdb6,_0x252511){var _0x2eb00f={'where':{'id':_0x16cdb6[_0x734c('0x48')]['id']}},_0x351c37={};_0x351c37[_0x734c('0x36')]=_[_0x734c('0x38')](db['Dashboard'][_0x734c('0x33')]);_0x2eb00f[_0x734c('0x3b')]=_['intersection'](_0x351c37[_0x734c('0x36')],qs[_0x734c('0x3a')](_0x16cdb6[_0x734c('0x37')]['fields']));_0x2eb00f[_0x734c('0x3b')]=_0x2eb00f[_0x734c('0x3b')]['length']?_0x2eb00f['attributes']:_0x351c37[_0x734c('0x36')];if(_0x16cdb6[_0x734c('0x37')][_0x734c('0x56')]){_0x2eb00f['include']=[{'all':!![]}];}_0x2eb00f=_[_0x734c('0x4a')]({},_0x2eb00f,_0x16cdb6[_0x734c('0x43')]);return db[_0x734c('0x32')][_0x734c('0x4b')](_0x2eb00f)[_0x734c('0x27')](handleEntityNotFound(_0x252511,null))[_0x734c('0x27')](function(_0x1e6286){if(_0x1e6286){var _0x3a637a=_0x1e6286['get']({'plain':!![]});_0x3a637a=qs['omit'](_0x3a637a,['id','createdAt',_0x734c('0x57')]);_0x16cdb6[_0x734c('0x4d')]=_['omit'](_0x16cdb6['body'],['id',_0x734c('0x58'),_0x734c('0x57')]);return db[_0x734c('0x32')][_0x734c('0x4c')](_[_0x734c('0x4a')](_0x3a637a,_0x16cdb6[_0x734c('0x4d')]),{'include':_0x16cdb6['query'][_0x734c('0x56')]?[{'all':!![]}]:undefined})[_0x734c('0x27')](function(_0xc53ac8){var _0x5c7a8d=_0x16cdb6[_0x734c('0x4e')][_0x734c('0x29')]({'plain':!![]});if(!_0x5c7a8d)throw new Error(_0x734c('0x4f'));if(_0x5c7a8d['role']===_0x734c('0x4e')){var _0x54dc52=_0xc53ac8['get']({'plain':!![]});var _0x1bd466=_0x734c('0x2a');return db['UserProfileSection'][_0x734c('0x4b')]({'where':{'name':_0x1bd466,'userProfileId':_0x5c7a8d[_0x734c('0x52')]},'raw':!![]})[_0x734c('0x27')](function(_0x264a18){if(_0x264a18&&_0x264a18[_0x734c('0x53')]===0x0){return db[_0x734c('0x2b')][_0x734c('0x4c')]({'name':_0x54dc52[_0x734c('0x2e')],'resourceId':_0x54dc52['id'],'type':_0x264a18[_0x734c('0x2e')],'sectionId':_0x264a18['id']},{})[_0x734c('0x27')](function(){return _0xc53ac8;});}else{return _0xc53ac8;}})[_0x734c('0x46')](function(_0x24069f){logger['error'](_0x734c('0x59'),_0x24069f);throw _0x24069f;});}return _0xc53ac8;});}})['then'](respondWithResult(_0x252511,0xc9))[_0x734c('0x46')](handleError(_0x252511,null));};exports[_0x734c('0x26')]=function(_0x476078,_0x82bb81){if(_0x476078[_0x734c('0x4d')]['id']){delete _0x476078[_0x734c('0x4d')]['id'];}return db['Dashboard'][_0x734c('0x4b')]({'where':{'id':_0x476078['params']['id']}})['then'](handleEntityNotFound(_0x82bb81,null))[_0x734c('0x27')](saveUpdates(_0x476078[_0x734c('0x4d')],null))['then'](respondWithResult(_0x82bb81,null))[_0x734c('0x46')](handleError(_0x82bb81,null));};exports['destroy']=function(_0x142ece,_0x161b03){return db[_0x734c('0x32')]['find']({'where':{'id':_0x142ece['params']['id']}})[_0x734c('0x27')](handleEntityNotFound(_0x161b03,null))[_0x734c('0x27')](removeEntity(_0x161b03,null))[_0x734c('0x46')](handleError(_0x161b03,null));};function widgetAttributes(_0x47bc60){try{switch(_0x47bc60['type']){case _0x734c('0x5a'):return[{'name':_0x734c('0x5b'),'value':_0x47bc60['attrUrl']||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||'https://'}];case _0x734c('0x5e'):return[{'name':_0x734c('0x5f'),'value':_0x47bc60[_0x734c('0x5f')]||(_0x47bc60['attrs']&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||''}];case _0x734c('0x60'):return[{'name':'attrHourFormat','value':_0x47bc60[_0x734c('0x61')]||(_0x47bc60['attrs']&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x734c('0x62'),'value':_0x47bc60[_0x734c('0x62')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x1]?_0x47bc60[_0x734c('0x5c')][0x1][_0x734c('0x5d')]:undefined)||_0x734c('0x63')},{'name':'attrFontSize','value':_0x47bc60['attrFontSize']||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x2]?_0x47bc60[_0x734c('0x5c')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x734c('0x64'),'value':_0x47bc60[_0x734c('0x64')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0]['value']:undefined)||'total'},{'name':_0x734c('0x65'),'value':_0x47bc60[_0x734c('0x65')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x1]?_0x47bc60[_0x734c('0x5c')][0x1][_0x734c('0x5d')]:undefined)||[]},{'name':_0x734c('0x66'),'value':_0x47bc60[_0x734c('0x66')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x2]?_0x47bc60[_0x734c('0x5c')][0x2][_0x734c('0x5d')]:undefined)||0x14}];case _0x734c('0x67'):case _0x734c('0x68'):return[{'name':'attrSerie1','value':_0x47bc60[_0x734c('0x69')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||_0x734c('0x6a')},{'name':_0x734c('0x6b'),'value':_0x47bc60['attrSerie2']||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60['attrs'][0x1]?_0x47bc60[_0x734c('0x5c')][0x1][_0x734c('0x5d')]:undefined)||null},{'name':_0x734c('0x6c'),'value':_0x47bc60[_0x734c('0x6c')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60['attrs'][0x2]?_0x47bc60['attrs'][0x2]['value']:undefined)||null},{'name':_0x734c('0x65'),'value':_0x47bc60['attrVoiceQueues']||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60[_0x734c('0x5c')][0x3]?_0x47bc60[_0x734c('0x5c')][0x3][_0x734c('0x5d')]:undefined)||[]}];case _0x734c('0x6d'):return[{'name':'attrReport','type':_0x47bc60[_0x734c('0x6e')]||(_0x47bc60['attrs']&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60['attrs'][0x0][_0x734c('0x42')]:undefined)||null,'value':_0x47bc60['attrReport']||(_0x47bc60['attrs']&&_0x47bc60[_0x734c('0x5c')][0x0]?_0x47bc60[_0x734c('0x5c')][0x0][_0x734c('0x5d')]:undefined)||null},{'name':_0x734c('0x6f'),'value':_0x47bc60[_0x734c('0x6f')]||(_0x47bc60[_0x734c('0x5c')]&&_0x47bc60['attrs'][0x1]?_0x47bc60[_0x734c('0x5c')][0x1][_0x734c('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x2403a2){logger[_0x734c('0x54')](_0x734c('0x70'),JSON[_0x734c('0x71')](_0x2403a2));return[];}}exports[_0x734c('0x72')]=function(_0x26732c,_0xd6ff5c,_0xb14696){if(_0x26732c[_0x734c('0x4d')]['id']){delete _0x26732c[_0x734c('0x4d')]['id'];}return db[_0x734c('0x32')]['find']({'where':{'id':_0x26732c[_0x734c('0x48')]['id']}})[_0x734c('0x27')](handleEntityNotFound(_0xd6ff5c,null))[_0x734c('0x27')](function(_0xf0d77e){if(_0xf0d77e){_0x26732c[_0x734c('0x4d')][_0x734c('0x73')]=_0xf0d77e['id'];_0x26732c[_0x734c('0x4d')][_0x734c('0x5c')]=widgetAttributes(_0x26732c[_0x734c('0x4d')]);return db['DashboardItem'][_0x734c('0x4c')](_0x26732c[_0x734c('0x4d')]);}})[_0x734c('0x27')](respondWithResult(_0xd6ff5c,null))['catch'](handleError(_0xd6ff5c,null));};exports['getItems']=function(_0x3ce13d,_0x2aee52,_0x1012a0){var _0xdd4243={};var _0x3c0538={};var _0x3867ce;var _0x71e4d7;return db[_0x734c('0x32')]['findOne']({'where':{'id':_0x3ce13d[_0x734c('0x48')]['id']}})[_0x734c('0x27')](handleEntityNotFound(_0x2aee52,null))[_0x734c('0x27')](function(_0x11ee1a){if(_0x11ee1a){_0x3867ce=_0x11ee1a;_0x3c0538[_0x734c('0x36')]=_['keys'](db[_0x734c('0x74')][_0x734c('0x33')]);_0x3c0538[_0x734c('0x37')]=_[_0x734c('0x38')](_0x3ce13d[_0x734c('0x37')]);_0x3c0538[_0x734c('0x3f')]=_['intersection'](_0x3c0538[_0x734c('0x36')],_0x3c0538[_0x734c('0x37')]);_0xdd4243['attributes']=_[_0x734c('0x39')](_0x3c0538[_0x734c('0x36')],qs[_0x734c('0x3a')](_0x3ce13d[_0x734c('0x37')][_0x734c('0x3a')]));_0xdd4243[_0x734c('0x3b')]=_0xdd4243[_0x734c('0x3b')][_0x734c('0x49')]?_0xdd4243['attributes']:_0x3c0538[_0x734c('0x36')];_0xdd4243[_0x734c('0x75')]=qs[_0x734c('0x3d')](_0x3ce13d[_0x734c('0x37')][_0x734c('0x3d')]);_0xdd4243['where']=qs[_0x734c('0x3f')](_[_0x734c('0x40')](_0x3ce13d[_0x734c('0x37')],_0x3c0538['filters']));if(_0x3ce13d[_0x734c('0x37')][_0x734c('0x41')]){_0xdd4243[_0x734c('0x3e')]=_[_0x734c('0x4a')](_0xdd4243[_0x734c('0x3e')],{'$or':_[_0x734c('0x31')](_0xdd4243[_0x734c('0x3b')],function(_0x505cee){var _0x105a15={};_0x105a15[_0x505cee]={'$like':'%'+_0x3ce13d[_0x734c('0x37')][_0x734c('0x41')]+'%'};return _0x105a15;})});}_0xdd4243=_[_0x734c('0x4a')]({},_0xdd4243,_0x3ce13d['options']);return _0x3867ce['getItems'](_0xdd4243);}})[_0x734c('0x27')](function(_0x52e4f4){if(_0x52e4f4){_0x71e4d7=_0x52e4f4[_0x734c('0x49')];if(!_0x3ce13d[_0x734c('0x37')][_0x734c('0x3c')]('nolimit')){_0xdd4243[_0x734c('0x21')]=qs[_0x734c('0x21')](_0x3ce13d[_0x734c('0x37')]['limit']);_0xdd4243['offset']=qs[_0x734c('0x24')](_0x3ce13d['query'][_0x734c('0x24')]);}return _0x3867ce[_0x734c('0x76')](_0xdd4243);}})[_0x734c('0x27')](function(_0xb5a7d0){if(_0xb5a7d0){return _0xb5a7d0?{'count':_0x71e4d7,'rows':_0xb5a7d0}:null;}})['then'](respondWithResult(_0x2aee52,null))[_0x734c('0x46')](handleError(_0x2aee52,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 672e173..b381412 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 _0xbe2c=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x456386,_0xe17628){var _0x4ae676=function(_0x3f0211){while(--_0x3f0211){_0x456386['push'](_0x456386['shift']());}};_0x4ae676(++_0xe17628);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x25c748,_0x763105){_0x25c748=_0x25c748-0x0;var _0x31ba19=_0xbe2c[_0x25c748];return _0x31ba19;};'use strict';var EventEmitter=require(_0xcbe2('0x0'));var Dashboard=require(_0xcbe2('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xcbe2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcbe2('0x3'),'afterDestroy':_0xcbe2('0x4')};function emitEvent(_0x107914){return function(_0x42c28d,_0x3f9f67,_0x59afb2){DashboardEvents[_0xcbe2('0x5')](_0x107914+':'+_0x42c28d['id'],_0x42c28d);DashboardEvents[_0xcbe2('0x5')](_0x107914,_0x42c28d);_0x59afb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xcbe2('0x6')](e,emitEvent(event));}}module[_0xcbe2('0x7')]=DashboardEvents; \ No newline at end of file +var _0xb2ad=['hasOwnProperty','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2c61a2,_0x40fe37){var _0x28bf7c=function(_0x4afffe){while(--_0x4afffe){_0x2c61a2['push'](_0x2c61a2['shift']());}};_0x28bf7c(++_0x40fe37);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x40c0dd,_0x4da13a){_0x40c0dd=_0x40c0dd-0x0;var _0x568042=_0xb2ad[_0x40c0dd];return _0x568042;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xdb2a('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xdb2a('0x1')](0x0);var events={'afterCreate':_0xdb2a('0x2'),'afterUpdate':_0xdb2a('0x3'),'afterDestroy':_0xdb2a('0x4')};function emitEvent(_0xf8768){return function(_0x505753,_0x244b13,_0x23ada5){DashboardEvents[_0xdb2a('0x5')](_0xf8768+':'+_0x505753['id'],_0x505753);DashboardEvents[_0xdb2a('0x5')](_0xf8768,_0x505753);_0x23ada5(null);};}for(var e in events){if(events[_0xdb2a('0x6')](e)){var event=events[e];Dashboard['hook'](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 fd45399..7b4cf70 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 _0xae95=['request-promise','rimraf','./dashboard.attributes','exports','Dashboard','dashboards','util','../../config/logger','api'];(function(_0x278a9b,_0x2059f3){var _0x2980ee=function(_0x47f108){while(--_0x47f108){_0x278a9b['push'](_0x278a9b['shift']());}};_0x2980ee(++_0x2059f3);}(_0xae95,0xcc));var _0x5ae9=function(_0x132abb,_0x498de7){_0x132abb=_0x132abb-0x0;var _0x3e63a9=_0xae95[_0x132abb];return _0x3e63a9;};'use strict';var _=require('lodash');var util=require(_0x5ae9('0x0'));var logger=require(_0x5ae9('0x1'))(_0x5ae9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ae9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ae9('0x4'));var config=require('../../config/environment');var attributes=require(_0x5ae9('0x5'));module[_0x5ae9('0x6')]=function(_0x438ee1,_0x2662d0){return _0x438ee1['define'](_0x5ae9('0x7'),attributes,{'tableName':_0x5ae9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae55=['moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','api'];(function(_0x3a9cf2,_0x224ec3){var _0x1d161e=function(_0x7ad80e){while(--_0x7ad80e){_0x3a9cf2['push'](_0x3a9cf2['shift']());}};_0x1d161e(++_0x224ec3);}(_0xae55,0xbf));var _0x5ae5=function(_0x395a03,_0x5be88a){_0x395a03=_0x395a03-0x0;var _0x526a4a=_0xae55[_0x395a03];return _0x526a4a;};'use strict';var _=require(_0x5ae5('0x0'));var util=require(_0x5ae5('0x1'));var logger=require(_0x5ae5('0x2'))(_0x5ae5('0x3'));var moment=require(_0x5ae5('0x4'));var BPromise=require(_0x5ae5('0x5'));var rp=require(_0x5ae5('0x6'));var fs=require('fs');var path=require(_0x5ae5('0x7'));var rimraf=require('rimraf');var config=require(_0x5ae5('0x8'));var attributes=require(_0x5ae5('0x9'));module[_0x5ae5('0xa')]=function(_0x1ab4f9,_0x2623bc){return _0x1ab4f9[_0x5ae5('0xb')](_0x5ae5('0xc'),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 9931f80..06ef590 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 _0x5607=['client','redis','defaults','localhost','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','Dashboard,\x20%s,\x20%s','message','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3b5f73,_0x230071){var _0x4b4c38=function(_0x46a226){while(--_0x46a226){_0x3b5f73['push'](_0x3b5f73['shift']());}};_0x4b4c38(++_0x230071);}(_0x5607,0x8f));var _0x7560=function(_0x70d7dc,_0x4b5a40){_0x70d7dc=_0x70d7dc-0x0;var _0x16c8ce=_0x5607[_0x70d7dc];return _0x16c8ce;};'use strict';var _=require('lodash');var util=require(_0x7560('0x0'));var moment=require(_0x7560('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7560('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7560('0x3'));var logger=require(_0x7560('0x4'))(_0x7560('0x5'));var config=require('../../config/environment');var jayson=require(_0x7560('0x6'));var client=jayson[_0x7560('0x7')]['http']({'port':0x232a});config[_0x7560('0x8')]=_[_0x7560('0x9')](config['redis'],{'host':_0x7560('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7560('0x8')]));require(_0x7560('0xb'))[_0x7560('0xc')](socket);function respondWithRpcPromise(_0x2d6672,_0x4ca747,_0xc51f0c){return new BPromise(function(_0x3c023b,_0x580526){return client[_0x7560('0xd')](_0x2d6672,_0xc51f0c)[_0x7560('0xe')](function(_0x3c8a2c){logger[_0x7560('0xf')]('Dashboard,\x20%s,\x20%s',_0x4ca747,_0x7560('0x10'));logger[_0x7560('0x11')](_0x7560('0x12'),_0x4ca747,_0x7560('0x10'),JSON[_0x7560('0x13')](_0x3c8a2c));if(_0x3c8a2c['error']){if(_0x3c8a2c[_0x7560('0x14')]['code']===0x1f4){logger['error'](_0x7560('0x15'),_0x4ca747,_0x3c8a2c[_0x7560('0x14')][_0x7560('0x16')]);return _0x580526(_0x3c8a2c[_0x7560('0x14')]['message']);}logger[_0x7560('0x14')]('Dashboard,\x20%s,\x20%s',_0x4ca747,_0x3c8a2c['error'][_0x7560('0x16')]);return _0x3c023b(_0x3c8a2c[_0x7560('0x14')][_0x7560('0x16')]);}else{logger[_0x7560('0xf')](_0x7560('0x15'),_0x4ca747,_0x7560('0x10'));_0x3c023b(_0x3c8a2c[_0x7560('0x17')][_0x7560('0x16')]);}})[_0x7560('0x18')](function(_0x590167){logger['error'](_0x7560('0x15'),_0x4ca747,_0x590167);_0x580526(_0x590167);});});} \ No newline at end of file +var _0xfb33=['request\x20sent','stringify','code','error','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info'];(function(_0x30351f,_0x3f8bd1){var _0xae0f84=function(_0xf7224){while(--_0xf7224){_0x30351f['push'](_0x30351f['shift']());}};_0xae0f84(++_0x3f8bd1);}(_0xfb33,0x19d));var _0x3fb3=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0xfb33[_0x101802];return _0x5d61ce;};'use strict';var _=require(_0x3fb3('0x0'));var util=require(_0x3fb3('0x1'));var moment=require(_0x3fb3('0x2'));var BPromise=require(_0x3fb3('0x3'));var rs=require(_0x3fb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fb3('0x5'))['db'];var utils=require(_0x3fb3('0x6'));var logger=require(_0x3fb3('0x7'))(_0x3fb3('0x8'));var config=require(_0x3fb3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3fb3('0xa')]({'port':0x232a});config[_0x3fb3('0xb')]=_['defaults'](config[_0x3fb3('0xb')],{'host':_0x3fb3('0xc'),'port':0x18eb});var socket=require(_0x3fb3('0xd'))(new Redis(config['redis']));require(_0x3fb3('0xe'))[_0x3fb3('0xf')](socket);function respondWithRpcPromise(_0x4519dc,_0x521211,_0xadc788){return new BPromise(function(_0x39d5d4,_0x22409f){return client[_0x3fb3('0x10')](_0x4519dc,_0xadc788)[_0x3fb3('0x11')](function(_0x795ee3){logger[_0x3fb3('0x12')]('Dashboard,\x20%s,\x20%s',_0x521211,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x521211,_0x3fb3('0x13'),JSON[_0x3fb3('0x14')](_0x795ee3));if(_0x795ee3['error']){if(_0x795ee3['error'][_0x3fb3('0x15')]===0x1f4){logger[_0x3fb3('0x16')](_0x3fb3('0x17'),_0x521211,_0x795ee3[_0x3fb3('0x16')][_0x3fb3('0x18')]);return _0x22409f(_0x795ee3[_0x3fb3('0x16')][_0x3fb3('0x18')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x521211,_0x795ee3[_0x3fb3('0x16')]['message']);return _0x39d5d4(_0x795ee3['error']['message']);}else{logger['info'](_0x3fb3('0x17'),_0x521211,_0x3fb3('0x13'));_0x39d5d4(_0x795ee3[_0x3fb3('0x19')]['message']);}})[_0x3fb3('0x1a')](function(_0x1ecbb5){logger['error'](_0x3fb3('0x17'),_0x521211,_0x1ecbb5);_0x22409f(_0x1ecbb5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 855cc3e..c661873 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 _0x7b74=['update','emit','removeListener','register','save','remove'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7b74,0x160));var _0x47b7=function(_0x2a79a6,_0x48825f){_0x2a79a6=_0x2a79a6-0x0;var _0x4e1882=_0x7b74[_0x2a79a6];return _0x4e1882;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x47b7('0x0'),_0x47b7('0x1'),_0x47b7('0x2')];function createListener(_0x410474,_0x3c839b){return function(_0x1d1c97){_0x3c839b[_0x47b7('0x3')](_0x410474,_0x1d1c97);};}function removeListener(_0x5d197e,_0x1c03dc){return function(){DashboardEvents[_0x47b7('0x4')](_0x5d197e,_0x1c03dc);};}exports[_0x47b7('0x5')]=function(_0x19d8de){for(var _0x11c444=0x0,_0x44cec1=events['length'];_0x11c444<_0x44cec1;_0x11c444++){var _0x421d1b=events[_0x11c444];var _0x485064=createListener('dashboard:'+_0x421d1b,_0x19d8de);DashboardEvents['on'](_0x421d1b,_0x485064);}}; \ No newline at end of file +var _0x88b9=['emit','removeListener','register','save','remove','update'];(function(_0x407538,_0x3867c3){var _0x106535=function(_0x529bd0){while(--_0x529bd0){_0x407538['push'](_0x407538['shift']());}};_0x106535(++_0x3867c3);}(_0x88b9,0x9f));var _0x988b=function(_0x34a320,_0x1a1b2b){_0x34a320=_0x34a320-0x0;var _0x5c71eb=_0x88b9[_0x34a320];return _0x5c71eb;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x988b('0x0'),_0x988b('0x1'),_0x988b('0x2')];function createListener(_0x4536d8,_0x183394){return function(_0x59741c){_0x183394[_0x988b('0x3')](_0x4536d8,_0x59741c);};}function removeListener(_0x11a1fb,_0x5dc9fd){return function(){DashboardEvents[_0x988b('0x4')](_0x11a1fb,_0x5dc9fd);};}exports[_0x988b('0x5')]=function(_0x5164c8){for(var _0x12e551=0x0,_0x27bd51=events['length'];_0x12e551<_0x27bd51;_0x12e551++){var _0x148055=events[_0x12e551];var _0x596265=createListener('dashboard:'+_0x148055,_0x5164c8);DashboardEvents['on'](_0x148055,_0x596265);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 977bc1d..446a2c6 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 _0x8dbb=['multer','path','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','clone','addItem','put','delete','destroy','exports'];(function(_0x5ad6c5,_0x3a4448){var _0xd71934=function(_0x36f931){while(--_0x36f931){_0x5ad6c5['push'](_0x5ad6c5['shift']());}};_0xd71934(++_0x3a4448);}(_0x8dbb,0x1a2));var _0xb8db=function(_0x3a8473,_0x4bd870){_0x3a8473=_0x3a8473-0x0;var _0x36314a=_0x8dbb[_0x3a8473];return _0x36314a;};'use strict';var multer=require(_0xb8db('0x0'));var util=require('util');var path=require(_0xb8db('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb8db('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb8db('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb8db('0x4'));var controller=require(_0xb8db('0x5'));router[_0xb8db('0x6')]('/',auth[_0xb8db('0x7')](),controller[_0xb8db('0x8')]);router[_0xb8db('0x6')](_0xb8db('0x9'),auth[_0xb8db('0x7')](),controller[_0xb8db('0xa')]);router[_0xb8db('0x6')](_0xb8db('0xb'),auth[_0xb8db('0x7')](),controller[_0xb8db('0xc')]);router['post']('/',auth[_0xb8db('0x7')](),controller[_0xb8db('0xd')]);router[_0xb8db('0xe')](_0xb8db('0xf'),auth['isAuthenticated'](),controller[_0xb8db('0x10')]);router[_0xb8db('0xe')](_0xb8db('0xb'),auth[_0xb8db('0x7')](),controller[_0xb8db('0x11')]);router[_0xb8db('0x12')](_0xb8db('0x9'),auth[_0xb8db('0x7')](),controller['update']);router[_0xb8db('0x13')](_0xb8db('0x9'),auth['isAuthenticated'](),controller[_0xb8db('0x14')]);module[_0xb8db('0x15')]=router; \ No newline at end of file +var _0xe736=['get','/:id','show','getItems','/:id/clone','clone','post','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','index'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0xe736,0x14c));var _0x6e73=function(_0x4a8bad,_0x4aabdb){_0x4a8bad=_0x4a8bad-0x0;var _0x5e8ee7=_0xe736[_0x4a8bad];return _0x5e8ee7;};'use strict';var multer=require(_0x6e73('0x0'));var util=require(_0x6e73('0x1'));var path=require(_0x6e73('0x2'));var timeout=require(_0x6e73('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6e73('0x4'));var auth=require(_0x6e73('0x5'));var interaction=require(_0x6e73('0x6'));var config=require('../../config/environment');var controller=require(_0x6e73('0x7'));router['get']('/',auth[_0x6e73('0x8')](),controller[_0x6e73('0x9')]);router[_0x6e73('0xa')](_0x6e73('0xb'),auth[_0x6e73('0x8')](),controller[_0x6e73('0xc')]);router[_0x6e73('0xa')]('/:id/items',auth[_0x6e73('0x8')](),controller[_0x6e73('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6e73('0xe'),auth[_0x6e73('0x8')](),controller[_0x6e73('0xf')]);router[_0x6e73('0x10')]('/:id/items',auth[_0x6e73('0x8')](),controller['addItem']);router['put'](_0x6e73('0xb'),auth[_0x6e73('0x8')](),controller[_0x6e73('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6e73('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 050298b..f9b2cd6 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 _0xc6ac=['#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x5e8bea,_0x177be8){var _0x16a022=function(_0x21debb){while(--_0x21debb){_0x5e8bea['push'](_0x5e8bea['shift']());}};_0x16a022(++_0x177be8);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3cbda3,_0x14329f){_0x3cbda3=_0x3cbda3-0x0;var _0xa6e68d=_0xc6ac[_0x3cbda3];return _0xa6e68d;};'use strict';var Sequelize=require(_0xcc6a('0x0'));var squel=require(_0xcc6a('0x1'));var _=require(_0xcc6a('0x2'));module[_0xcc6a('0x3')]={'title':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xcc6a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xcc6a('0x5')](_0xcc6a('0x6')),'get':function(){try{return JSON[_0xcc6a('0x7')](this[_0xcc6a('0x8')](_0xcc6a('0x9')));}catch(_0x188b05){return[];}},'set':function(_0x12330e){try{this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')](_0x12330e));}catch(_0x11b919){this[_0xcc6a('0xa')]('attrs',JSON[_0xcc6a('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xcc6a('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xcc6a('0xc')]},'col':{'type':Sequelize[_0xcc6a('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc6a('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xcc6a('0x4')],'allowNull':![],'defaultValue':_0xcc6a('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xcc6a('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0xb4c7=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x402209,_0x3a9a92){_0x402209=_0x402209-0x0;var _0x2323ea=_0xb4c7[_0x402209];return _0x2323ea;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var squel=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));module[_0x7b4c('0x3')]={'title':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7b4c('0x5')](_0x7b4c('0x6')),'get':function(){try{return JSON[_0x7b4c('0x7')](this[_0x7b4c('0x8')](_0x7b4c('0x9')));}catch(_0x5adec9){return[];}},'set':function(_0x1b0f57){try{this[_0x7b4c('0xa')](_0x7b4c('0x9'),JSON['stringify'](_0x1b0f57));}catch(_0x2d7b7e){this[_0x7b4c('0xa')]('attrs',JSON[_0x7b4c('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7b4c('0xc')]},'col':{'type':Sequelize[_0x7b4c('0xc')]},'background':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7b4c('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'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 840f8d7..54b9d62 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 _0xbe61=['attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','attributes','fields','length','includeAll','merge','options','catch','find','type','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbe61,0x1dc));var _0x1be6=function(_0x131996,_0x19b54b){_0x131996=_0x131996-0x0;var _0x5d2ecc=_0xbe61[_0x131996];return _0x5d2ecc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1be6('0x0'));var zipdir=require(_0x1be6('0x1'));var jsonpatch=require(_0x1be6('0x2'));var rp=require(_0x1be6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1be6('0x4'));var util=require('util');var path=require(_0x1be6('0x5'));var sox=require('sox');var csv=require(_0x1be6('0x6'));var ejs=require(_0x1be6('0x7'));var fs=require('fs');var fs_extra=require(_0x1be6('0x8'));var _=require(_0x1be6('0x9'));var squel=require(_0x1be6('0xa'));var crypto=require('crypto');var jsforce=require(_0x1be6('0xb'));var deskjs=require(_0x1be6('0xc'));var toCsv=require(_0x1be6('0x6'));var querystring=require(_0x1be6('0xd'));var Papa=require(_0x1be6('0xe'));var Redis=require('ioredis');var authService=require(_0x1be6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1be6('0x10'));var hardwareService=require(_0x1be6('0x11'));var logger=require('../../config/logger')(_0x1be6('0x12'));var utils=require(_0x1be6('0x13'));var config=require(_0x1be6('0x14'));var licenseUtil=require(_0x1be6('0x15'));var db=require(_0x1be6('0x16'))['db'];config[_0x1be6('0x17')]=_['defaults'](config[_0x1be6('0x17')],{'host':_0x1be6('0x18'),'port':0x18eb});var socket=require(_0x1be6('0x19'))(new Redis(config[_0x1be6('0x17')]));require(_0x1be6('0x1a'))[_0x1be6('0x1b')](socket);function respondWithStatusCode(_0x8b2f65,_0x120f99){_0x120f99=_0x120f99||0xcc;return function(_0x50fd4b){if(_0x50fd4b){return _0x8b2f65[_0x1be6('0x1c')](_0x120f99);}return _0x8b2f65[_0x1be6('0x1d')](_0x120f99)[_0x1be6('0x1e')]();};}function respondWithResult(_0x20d936,_0x556390){_0x556390=_0x556390||0xc8;return function(_0x5921df){if(_0x5921df){return _0x20d936['status'](_0x556390)[_0x1be6('0x1f')](_0x5921df);}};}function respondWithFilteredResult(_0x4d4668,_0x41a031){return function(_0x57bcf7){if(_0x57bcf7){var _0x11e318=typeof _0x41a031[_0x1be6('0x20')]==='undefined'&&typeof _0x41a031[_0x1be6('0x21')]===_0x1be6('0x22');var _0x540a8d=_0x57bcf7['count'];var _0x54afdc=_0x11e318?0x0:_0x41a031[_0x1be6('0x20')];var _0x456058=_0x11e318?_0x57bcf7[_0x1be6('0x23')]:_0x41a031[_0x1be6('0x20')]+_0x41a031['limit'];var _0x44a003;if(_0x456058>=_0x540a8d){_0x456058=_0x540a8d;_0x44a003=0xc8;}else{_0x44a003=0xce;}_0x4d4668['status'](_0x44a003);return _0x4d4668[_0x1be6('0x24')](_0x1be6('0x25'),_0x54afdc+'-'+_0x456058+'/'+_0x540a8d)[_0x1be6('0x1f')](_0x57bcf7);}return null;};}function patchUpdates(_0xaae13c){return function(_0x23d321){try{jsonpatch['apply'](_0x23d321,_0xaae13c,!![]);}catch(_0x1e3aea){return BPromise[_0x1be6('0x26')](_0x1e3aea);}return _0x23d321[_0x1be6('0x27')]();};}function saveUpdates(_0x104a17,_0x31dad0){return function(_0x16ee7a){if(_0x16ee7a){return _0x16ee7a['update'](_0x104a17)[_0x1be6('0x28')](function(_0x326b24){return _0x326b24;});}return null;};}function removeEntity(_0xbd8f90,_0xa34f4f){return function(_0x17a71c){if(_0x17a71c){return _0x17a71c['destroy']()[_0x1be6('0x28')](function(){_0xbd8f90[_0x1be6('0x1d')](0xcc)[_0x1be6('0x1e')]();});}};}function handleEntityNotFound(_0x52e94e,_0x198e6e){return function(_0x158d44){if(!_0x158d44){_0x52e94e['sendStatus'](0x194);}return _0x158d44;};}function handleError(_0x447632,_0xf407d3){_0xf407d3=_0xf407d3||0x1f4;return function(_0x369087){logger[_0x1be6('0x29')](_0x369087[_0x1be6('0x2a')]);if(_0x369087[_0x1be6('0x2b')]){delete _0x369087[_0x1be6('0x2b')];}_0x447632[_0x1be6('0x1d')](_0xf407d3)[_0x1be6('0x2c')](_0x369087);};}exports[_0x1be6('0x2d')]=function(_0x206d0b,_0x1e5044){var _0x110c87={'raw':![],'where':{'id':_0x206d0b['params']['id']}},_0x867df2={};_0x867df2[_0x1be6('0x2e')]=_[_0x1be6('0x2f')](db[_0x1be6('0x30')][_0x1be6('0x31')]);_0x867df2[_0x1be6('0x32')]=_[_0x1be6('0x2f')](_0x206d0b[_0x1be6('0x32')]);_0x867df2['filters']=_['intersection'](_0x867df2[_0x1be6('0x2e')],_0x867df2[_0x1be6('0x32')]);_0x110c87[_0x1be6('0x33')]=_['intersection'](_0x867df2[_0x1be6('0x2e')],qs[_0x1be6('0x34')](_0x206d0b['query'][_0x1be6('0x34')]));_0x110c87[_0x1be6('0x33')]=_0x110c87[_0x1be6('0x33')][_0x1be6('0x35')]?_0x110c87[_0x1be6('0x33')]:_0x867df2['model'];if(_0x206d0b[_0x1be6('0x32')][_0x1be6('0x36')]){_0x110c87['include']=[{'all':!![]}];}_0x110c87=_[_0x1be6('0x37')]({},_0x110c87,_0x206d0b[_0x1be6('0x38')]);return db['DashboardItem']['find'](_0x110c87)[_0x1be6('0x28')](handleEntityNotFound(_0x1e5044,null))['then'](respondWithResult(_0x1e5044,null))[_0x1be6('0x39')](handleError(_0x1e5044,null));};exports['destroy']=function(_0x9af86d,_0x893ea5){return db[_0x1be6('0x30')][_0x1be6('0x3a')]({'where':{'id':_0x9af86d['params']['id']}})[_0x1be6('0x28')](handleEntityNotFound(_0x893ea5,null))[_0x1be6('0x28')](removeEntity(_0x893ea5,null))[_0x1be6('0x39')](handleError(_0x893ea5,null));};function widgetAttributes(_0x4ff339){try{switch(_0x4ff339[_0x1be6('0x3b')]){case _0x1be6('0x3c'):return[{'name':_0x1be6('0x3d'),'value':_0x4ff339[_0x1be6('0x3d')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339['attrs'][0x0]?_0x4ff339[_0x1be6('0x3e')][0x0]['value']:undefined)||_0x1be6('0x3f')}];case _0x1be6('0x40'):return[{'name':_0x1be6('0x41'),'value':_0x4ff339['attrPath']||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x0]?_0x4ff339[_0x1be6('0x3e')][0x0]['value']:undefined)||''}];case _0x1be6('0x42'):return[{'name':_0x1be6('0x43'),'value':_0x4ff339[_0x1be6('0x43')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x0]?_0x4ff339['attrs'][0x0][_0x1be6('0x44')]:undefined)||_0x1be6('0x45')},{'name':'attrTimezone','value':_0x4ff339[_0x1be6('0x46')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339['attrs'][0x1]?_0x4ff339[_0x1be6('0x3e')][0x1][_0x1be6('0x44')]:undefined)||_0x1be6('0x47')},{'name':'attrFontSize','value':_0x4ff339[_0x1be6('0x48')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x2]?_0x4ff339[_0x1be6('0x3e')][0x2][_0x1be6('0x44')]:undefined)||0xc}];case _0x1be6('0x49'):return[{'name':_0x1be6('0x4a'),'value':_0x4ff339[_0x1be6('0x4a')]||(_0x4ff339['attrs']&&_0x4ff339[_0x1be6('0x3e')][0x0]?_0x4ff339['attrs'][0x0][_0x1be6('0x44')]:undefined)||_0x1be6('0x4b')},{'name':'attrVoiceQueues','value':_0x4ff339[_0x1be6('0x4c')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x1]?_0x4ff339[_0x1be6('0x3e')][0x1][_0x1be6('0x44')]:undefined)||[]},{'name':_0x1be6('0x48'),'value':_0x4ff339['attrFontSize']||(_0x4ff339['attrs']&&_0x4ff339[_0x1be6('0x3e')][0x2]?_0x4ff339[_0x1be6('0x3e')][0x2][_0x1be6('0x44')]:undefined)||0x14}];case _0x1be6('0x4d'):case _0x1be6('0x4e'):return[{'name':'attrSerie1','value':_0x4ff339[_0x1be6('0x4f')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x0]?_0x4ff339[_0x1be6('0x3e')][0x0][_0x1be6('0x44')]:undefined)||_0x1be6('0x4b')},{'name':_0x1be6('0x50'),'value':_0x4ff339[_0x1be6('0x50')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x1]?_0x4ff339[_0x1be6('0x3e')][0x1][_0x1be6('0x44')]:undefined)||null},{'name':_0x1be6('0x51'),'value':_0x4ff339[_0x1be6('0x51')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x2]?_0x4ff339['attrs'][0x2][_0x1be6('0x44')]:undefined)||null},{'name':_0x1be6('0x4c'),'value':_0x4ff339[_0x1be6('0x4c')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x3]?_0x4ff339[_0x1be6('0x3e')][0x3][_0x1be6('0x44')]:undefined)||[]}];case _0x1be6('0x52'):return[{'name':_0x1be6('0x53'),'type':_0x4ff339[_0x1be6('0x54')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x0]?_0x4ff339[_0x1be6('0x3e')][0x0]['type']:undefined)||null,'value':_0x4ff339[_0x1be6('0x53')]||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339['attrs'][0x0]?_0x4ff339[_0x1be6('0x3e')][0x0]['value']:undefined)||null},{'name':_0x1be6('0x55'),'value':_0x4ff339['attrRefresh']||(_0x4ff339[_0x1be6('0x3e')]&&_0x4ff339[_0x1be6('0x3e')][0x1]?_0x4ff339[_0x1be6('0x3e')][0x1][_0x1be6('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x51bc6e){logger[_0x1be6('0x29')]('widgetAttributes:\x20%s',JSON[_0x1be6('0x56')](_0x51bc6e));return[];}}exports[_0x1be6('0x57')]=function(_0x11c5d3,_0x3b4d2){if(_0x11c5d3[_0x1be6('0x58')]){_0x11c5d3[_0x1be6('0x58')][_0x1be6('0x3e')]=widgetAttributes(_0x11c5d3['body']);}return db[_0x1be6('0x30')][_0x1be6('0x57')](_0x11c5d3['body'],{})[_0x1be6('0x28')](respondWithResult(_0x3b4d2,0xc9))[_0x1be6('0x39')](handleError(_0x3b4d2,null));};exports[_0x1be6('0x59')]=function(_0x3d5e5c,_0x1a09ca){if(_0x3d5e5c[_0x1be6('0x58')]['id']){delete _0x3d5e5c[_0x1be6('0x58')]['id'];}_0x3d5e5c['body'][_0x1be6('0x3e')]=widgetAttributes(_0x3d5e5c[_0x1be6('0x58')]);return db[_0x1be6('0x30')][_0x1be6('0x3a')]({'where':{'id':_0x3d5e5c[_0x1be6('0x5a')]['id']}})[_0x1be6('0x28')](handleEntityNotFound(_0x1a09ca,null))['then'](saveUpdates(_0x3d5e5c[_0x1be6('0x58')],null))[_0x1be6('0x28')](respondWithResult(_0x1a09ca,null))[_0x1be6('0x39')](handleError(_0x1a09ca,null));}; \ No newline at end of file +var _0xeb15=['attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','update','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','DashboardItem','find','catch','type','attrUrl'];(function(_0x5030df,_0x2a765b){var _0x138323=function(_0x2d5dc9){while(--_0x2d5dc9){_0x5030df['push'](_0x5030df['shift']());}};_0x138323(++_0x2a765b);}(_0xeb15,0x6f));var _0x5eb1=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0xeb15[_0x4f5108];return _0x2d56ca;};'use strict';var emlformat=require(_0x5eb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5eb1('0x1'));var jsonpatch=require(_0x5eb1('0x2'));var rp=require('request-promise');var moment=require(_0x5eb1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5eb1('0x4'));var path=require(_0x5eb1('0x5'));var sox=require(_0x5eb1('0x6'));var csv=require(_0x5eb1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5eb1('0x8'));var _=require(_0x5eb1('0x9'));var squel=require(_0x5eb1('0xa'));var crypto=require(_0x5eb1('0xb'));var jsforce=require(_0x5eb1('0xc'));var deskjs=require(_0x5eb1('0xd'));var toCsv=require(_0x5eb1('0x7'));var querystring=require(_0x5eb1('0xe'));var Papa=require(_0x5eb1('0xf'));var Redis=require(_0x5eb1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5eb1('0x11'));var as=require(_0x5eb1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5eb1('0x13'))(_0x5eb1('0x14'));var utils=require(_0x5eb1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5eb1('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5eb1('0x17')](config[_0x5eb1('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5eb1('0x18')]));require(_0x5eb1('0x19'))[_0x5eb1('0x1a')](socket);function respondWithStatusCode(_0x56203e,_0x1b4aca){_0x1b4aca=_0x1b4aca||0xcc;return function(_0x1a57a6){if(_0x1a57a6){return _0x56203e['sendStatus'](_0x1b4aca);}return _0x56203e[_0x5eb1('0x1b')](_0x1b4aca)[_0x5eb1('0x1c')]();};}function respondWithResult(_0x398145,_0x433b30){_0x433b30=_0x433b30||0xc8;return function(_0x38cdc){if(_0x38cdc){return _0x398145[_0x5eb1('0x1b')](_0x433b30)[_0x5eb1('0x1d')](_0x38cdc);}};}function respondWithFilteredResult(_0x3287f7,_0x3c58be){return function(_0xfd9b7a){if(_0xfd9b7a){var _0x5245f2=typeof _0x3c58be[_0x5eb1('0x1e')]===_0x5eb1('0x1f')&&typeof _0x3c58be[_0x5eb1('0x20')]==='undefined';var _0xd26deb=_0xfd9b7a[_0x5eb1('0x21')];var _0x23fdf7=_0x5245f2?0x0:_0x3c58be[_0x5eb1('0x1e')];var _0x3f06a5=_0x5245f2?_0xfd9b7a[_0x5eb1('0x21')]:_0x3c58be['offset']+_0x3c58be['limit'];var _0x1b0a4b;if(_0x3f06a5>=_0xd26deb){_0x3f06a5=_0xd26deb;_0x1b0a4b=0xc8;}else{_0x1b0a4b=0xce;}_0x3287f7[_0x5eb1('0x1b')](_0x1b0a4b);return _0x3287f7[_0x5eb1('0x22')]('Content-Range',_0x23fdf7+'-'+_0x3f06a5+'/'+_0xd26deb)[_0x5eb1('0x1d')](_0xfd9b7a);}return null;};}function patchUpdates(_0x7b33df){return function(_0x25169b){try{jsonpatch['apply'](_0x25169b,_0x7b33df,!![]);}catch(_0x56d409){return BPromise[_0x5eb1('0x23')](_0x56d409);}return _0x25169b[_0x5eb1('0x24')]();};}function saveUpdates(_0x390df0,_0x5e83d6){return function(_0x586260){if(_0x586260){return _0x586260['update'](_0x390df0)[_0x5eb1('0x25')](function(_0x4d2e0a){return _0x4d2e0a;});}return null;};}function removeEntity(_0x4a3e44,_0x18f40b){return function(_0x560668){if(_0x560668){return _0x560668[_0x5eb1('0x26')]()['then'](function(){_0x4a3e44[_0x5eb1('0x1b')](0xcc)[_0x5eb1('0x1c')]();});}};}function handleEntityNotFound(_0x1a8296,_0x15281c){return function(_0x7951a1){if(!_0x7951a1){_0x1a8296['sendStatus'](0x194);}return _0x7951a1;};}function handleError(_0x5e15d2,_0x3cc248){_0x3cc248=_0x3cc248||0x1f4;return function(_0x3b9b43){logger['error'](_0x3b9b43[_0x5eb1('0x27')]);if(_0x3b9b43[_0x5eb1('0x28')]){delete _0x3b9b43['name'];}_0x5e15d2[_0x5eb1('0x1b')](_0x3cc248)[_0x5eb1('0x29')](_0x3b9b43);};}exports[_0x5eb1('0x2a')]=function(_0xfe7563,_0x1fb2ac){var _0x466bb2={'raw':![],'where':{'id':_0xfe7563[_0x5eb1('0x2b')]['id']}},_0x1d3710={};_0x1d3710[_0x5eb1('0x2c')]=_[_0x5eb1('0x2d')](db['DashboardItem'][_0x5eb1('0x2e')]);_0x1d3710[_0x5eb1('0x2f')]=_[_0x5eb1('0x2d')](_0xfe7563['query']);_0x1d3710['filters']=_[_0x5eb1('0x30')](_0x1d3710[_0x5eb1('0x2c')],_0x1d3710['query']);_0x466bb2[_0x5eb1('0x31')]=_[_0x5eb1('0x30')](_0x1d3710['model'],qs['fields'](_0xfe7563[_0x5eb1('0x2f')][_0x5eb1('0x32')]));_0x466bb2[_0x5eb1('0x31')]=_0x466bb2[_0x5eb1('0x31')][_0x5eb1('0x33')]?_0x466bb2[_0x5eb1('0x31')]:_0x1d3710['model'];if(_0xfe7563[_0x5eb1('0x2f')][_0x5eb1('0x34')]){_0x466bb2[_0x5eb1('0x35')]=[{'all':!![]}];}_0x466bb2=_['merge']({},_0x466bb2,_0xfe7563['options']);return db[_0x5eb1('0x36')][_0x5eb1('0x37')](_0x466bb2)[_0x5eb1('0x25')](handleEntityNotFound(_0x1fb2ac,null))[_0x5eb1('0x25')](respondWithResult(_0x1fb2ac,null))[_0x5eb1('0x38')](handleError(_0x1fb2ac,null));};exports['destroy']=function(_0x5859df,_0x49c8e3){return db[_0x5eb1('0x36')]['find']({'where':{'id':_0x5859df['params']['id']}})[_0x5eb1('0x25')](handleEntityNotFound(_0x49c8e3,null))[_0x5eb1('0x25')](removeEntity(_0x49c8e3,null))[_0x5eb1('0x38')](handleError(_0x49c8e3,null));};function widgetAttributes(_0x3a6ebc){try{switch(_0x3a6ebc[_0x5eb1('0x39')]){case'iframe':return[{'name':_0x5eb1('0x3a'),'value':_0x3a6ebc[_0x5eb1('0x3a')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc['attrs'][0x0][_0x5eb1('0x3c')]:undefined)||'https://'}];case _0x5eb1('0x3d'):return[{'name':_0x5eb1('0x3e'),'value':_0x3a6ebc['attrPath']||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc['attrs'][0x0][_0x5eb1('0x3c')]:undefined)||''}];case _0x5eb1('0x3f'):return[{'name':'attrHourFormat','value':_0x3a6ebc[_0x5eb1('0x40')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc['attrs'][0x0]?_0x3a6ebc['attrs'][0x0][_0x5eb1('0x3c')]:undefined)||_0x5eb1('0x41')},{'name':_0x5eb1('0x42'),'value':_0x3a6ebc[_0x5eb1('0x42')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x1]?_0x3a6ebc[_0x5eb1('0x3b')][0x1][_0x5eb1('0x3c')]:undefined)||_0x5eb1('0x43')},{'name':_0x5eb1('0x44'),'value':_0x3a6ebc[_0x5eb1('0x44')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x2]?_0x3a6ebc[_0x5eb1('0x3b')][0x2]['value']:undefined)||0xc}];case _0x5eb1('0x45'):return[{'name':_0x5eb1('0x46'),'value':_0x3a6ebc[_0x5eb1('0x46')]||(_0x3a6ebc['attrs']&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc[_0x5eb1('0x3b')][0x0][_0x5eb1('0x3c')]:undefined)||_0x5eb1('0x47')},{'name':_0x5eb1('0x48'),'value':_0x3a6ebc['attrVoiceQueues']||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x1]?_0x3a6ebc[_0x5eb1('0x3b')][0x1][_0x5eb1('0x3c')]:undefined)||[]},{'name':_0x5eb1('0x44'),'value':_0x3a6ebc['attrFontSize']||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc['attrs'][0x2]?_0x3a6ebc[_0x5eb1('0x3b')][0x2]['value']:undefined)||0x14}];case _0x5eb1('0x49'):case _0x5eb1('0x4a'):return[{'name':_0x5eb1('0x4b'),'value':_0x3a6ebc[_0x5eb1('0x4b')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc[_0x5eb1('0x3b')][0x0]['value']:undefined)||_0x5eb1('0x47')},{'name':'attrSerie2','value':_0x3a6ebc[_0x5eb1('0x4c')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x1]?_0x3a6ebc[_0x5eb1('0x3b')][0x1][_0x5eb1('0x3c')]:undefined)||null},{'name':_0x5eb1('0x4d'),'value':_0x3a6ebc[_0x5eb1('0x4d')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc['attrs'][0x2]?_0x3a6ebc[_0x5eb1('0x3b')][0x2][_0x5eb1('0x3c')]:undefined)||null},{'name':_0x5eb1('0x48'),'value':_0x3a6ebc[_0x5eb1('0x48')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x3]?_0x3a6ebc[_0x5eb1('0x3b')][0x3][_0x5eb1('0x3c')]:undefined)||[]}];case _0x5eb1('0x4e'):return[{'name':_0x5eb1('0x4f'),'type':_0x3a6ebc['reportType']||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x0]?_0x3a6ebc[_0x5eb1('0x3b')][0x0]['type']:undefined)||null,'value':_0x3a6ebc[_0x5eb1('0x4f')]||(_0x3a6ebc['attrs']&&_0x3a6ebc['attrs'][0x0]?_0x3a6ebc[_0x5eb1('0x3b')][0x0][_0x5eb1('0x3c')]:undefined)||null},{'name':_0x5eb1('0x50'),'value':_0x3a6ebc[_0x5eb1('0x50')]||(_0x3a6ebc[_0x5eb1('0x3b')]&&_0x3a6ebc[_0x5eb1('0x3b')][0x1]?_0x3a6ebc[_0x5eb1('0x3b')][0x1][_0x5eb1('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x424a5e){logger['error'](_0x5eb1('0x51'),JSON['stringify'](_0x424a5e));return[];}}exports[_0x5eb1('0x52')]=function(_0x51eab9,_0x1a5f4b){if(_0x51eab9[_0x5eb1('0x53')]){_0x51eab9[_0x5eb1('0x53')][_0x5eb1('0x3b')]=widgetAttributes(_0x51eab9[_0x5eb1('0x53')]);}return db[_0x5eb1('0x36')][_0x5eb1('0x52')](_0x51eab9[_0x5eb1('0x53')],{})[_0x5eb1('0x25')](respondWithResult(_0x1a5f4b,0xc9))[_0x5eb1('0x38')](handleError(_0x1a5f4b,null));};exports[_0x5eb1('0x54')]=function(_0x236476,_0x47c36b){if(_0x236476[_0x5eb1('0x53')]['id']){delete _0x236476['body']['id'];}_0x236476[_0x5eb1('0x53')][_0x5eb1('0x3b')]=widgetAttributes(_0x236476[_0x5eb1('0x53')]);return db[_0x5eb1('0x36')][_0x5eb1('0x37')]({'where':{'id':_0x236476[_0x5eb1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x47c36b,null))['then'](saveUpdates(_0x236476['body'],null))[_0x5eb1('0x25')](respondWithResult(_0x47c36b,null))[_0x5eb1('0x38')](handleError(_0x47c36b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 75745c2..20f51e3 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 _0x42f4=['hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x4954e0,_0xb50c6d){var _0x2f40d0=function(_0x2ed654){while(--_0x2ed654){_0x4954e0['push'](_0x4954e0['shift']());}};_0x2f40d0(++_0xb50c6d);}(_0x42f4,0x19d));var _0x442f=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x42f4[_0x9df3d8];return _0x366da1;};'use strict';var EventEmitter=require(_0x442f('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x442f('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x442f('0x2')](0x0);var events={'afterCreate':_0x442f('0x3'),'afterUpdate':_0x442f('0x4'),'afterDestroy':_0x442f('0x5')};function emitEvent(_0x51b3cb){return function(_0x5bc5d2,_0x55da11,_0x3c940f){DashboardItemEvents[_0x442f('0x6')](_0x51b3cb+':'+_0x5bc5d2['id'],_0x5bc5d2);DashboardItemEvents['emit'](_0x51b3cb,_0x5bc5d2);_0x3c940f(null);};}for(var e in events){if(events[_0x442f('0x7')](e)){var event=events[e];DashboardItem[_0x442f('0x8')](e,emitEvent(event));}}module[_0x442f('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x08b7=['DashboardItem','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x08b7,0xce));var _0x708b=function(_0x3a4489,_0x5e04a6){_0x3a4489=_0x3a4489-0x0;var _0x5c6b51=_0x08b7[_0x3a4489];return _0x5c6b51;};'use strict';var EventEmitter=require(_0x708b('0x0'));var DashboardItem=require(_0x708b('0x1'))['db'][_0x708b('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x708b('0x3'),'afterUpdate':'update','afterDestroy':_0x708b('0x4')};function emitEvent(_0x563db7){return function(_0x533931,_0xebeb7d,_0x5cca13){DashboardItemEvents[_0x708b('0x5')](_0x563db7+':'+_0x533931['id'],_0x533931);DashboardItemEvents[_0x708b('0x5')](_0x563db7,_0x533931);_0x5cca13(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x708b('0x6')](e,emitEvent(event));}}module[_0x708b('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 3c64586..fc0e6b9 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 _0xd9e9=['../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0xcce84a,_0x148a0a){var _0x273e9d=function(_0x318266){while(--_0x318266){_0xcce84a['push'](_0xcce84a['shift']());}};_0x273e9d(++_0x148a0a);}(_0xd9e9,0xba));var _0x9d9e=function(_0x2472b8,_0x4e3b16){_0x2472b8=_0x2472b8-0x0;var _0x4f2aa6=_0xd9e9[_0x2472b8];return _0x4f2aa6;};'use strict';var _=require(_0x9d9e('0x0'));var util=require(_0x9d9e('0x1'));var logger=require(_0x9d9e('0x2'))(_0x9d9e('0x3'));var moment=require(_0x9d9e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9d9e('0x5'));var config=require(_0x9d9e('0x6'));var attributes=require(_0x9d9e('0x7'));module[_0x9d9e('0x8')]=function(_0x5b9161,_0x22db94){return _0x5b9161[_0x9d9e('0x9')](_0x9d9e('0xa'),attributes,{'tableName':_0x9d9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf18=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','DashboardItem'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xbf18,0xfa));var _0x8bf1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbf18[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8bf1('0x0'))(_0x8bf1('0x1'));var moment=require(_0x8bf1('0x2'));var BPromise=require(_0x8bf1('0x3'));var rp=require(_0x8bf1('0x4'));var fs=require('fs');var path=require(_0x8bf1('0x5'));var rimraf=require(_0x8bf1('0x6'));var config=require(_0x8bf1('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x39a737,_0x420f67){return _0x39a737[_0x8bf1('0x8')](_0x8bf1('0x9'),attributes,{'tableName':'dashboard_items','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 15782ba..fd288a5 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 _0x010b=['socket.io-emitter','./dashboardItem.socket','register','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','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x010b,0x7b));var _0xb010=function(_0x299b38,_0x3992f4){_0x299b38=_0x299b38-0x0;var _0xb98348=_0x010b[_0x299b38];return _0xb98348;};'use strict';var _=require(_0xb010('0x0'));var util=require(_0xb010('0x1'));var moment=require(_0xb010('0x2'));var BPromise=require('bluebird');var rs=require(_0xb010('0x3'));var fs=require('fs');var Redis=require(_0xb010('0x4'));var db=require(_0xb010('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb010('0x6'));var config=require(_0xb010('0x7'));var jayson=require(_0xb010('0x8'));var client=jayson[_0xb010('0x9')][_0xb010('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb010('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb010('0xc'))(new Redis(config[_0xb010('0xb')]));require(_0xb010('0xd'))[_0xb010('0xe')](socket);function respondWithRpcPromise(_0x4bcf45,_0x400467,_0xad80a5){return new BPromise(function(_0x34651a,_0x14a5b6){return client[_0xb010('0xf')](_0x4bcf45,_0xad80a5)[_0xb010('0x10')](function(_0x1971ff){logger[_0xb010('0x11')](_0xb010('0x12'),_0x400467,_0xb010('0x13'));logger[_0xb010('0x14')](_0xb010('0x15'),_0x400467,_0xb010('0x13'),JSON[_0xb010('0x16')](_0x1971ff));if(_0x1971ff[_0xb010('0x17')]){if(_0x1971ff[_0xb010('0x17')]['code']===0x1f4){logger[_0xb010('0x17')](_0xb010('0x12'),_0x400467,_0x1971ff[_0xb010('0x17')]['message']);return _0x14a5b6(_0x1971ff[_0xb010('0x17')][_0xb010('0x18')]);}logger[_0xb010('0x17')](_0xb010('0x12'),_0x400467,_0x1971ff[_0xb010('0x17')][_0xb010('0x18')]);return _0x34651a(_0x1971ff['error']['message']);}else{logger[_0xb010('0x11')](_0xb010('0x12'),_0x400467,_0xb010('0x13'));_0x34651a(_0x1971ff[_0xb010('0x19')]['message']);}})[_0xb010('0x1a')](function(_0x5b36f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x400467,_0x5b36f4);_0x14a5b6(_0x5b36f4);});});} \ No newline at end of file +var _0x0cc9=['error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','socket.io-emitter','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x41985f,_0xf75926){var _0x27d655=function(_0x33bad1){while(--_0x33bad1){_0x41985f['push'](_0x41985f['shift']());}};_0x27d655(++_0xf75926);}(_0x0cc9,0x115));var _0x90cc=function(_0x4b2494,_0x494d41){_0x4b2494=_0x4b2494-0x0;var _0x2c1436=_0x0cc9[_0x4b2494];return _0x2c1436;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90cc('0x0'));var BPromise=require('bluebird');var rs=require(_0x90cc('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90cc('0x2'))['db'];var utils=require(_0x90cc('0x3'));var logger=require(_0x90cc('0x4'))(_0x90cc('0x5'));var config=require(_0x90cc('0x6'));var jayson=require(_0x90cc('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x90cc('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x90cc('0x9'))(new Redis(config['redis']));require(_0x90cc('0xa'))[_0x90cc('0xb')](socket);function respondWithRpcPromise(_0x326eb7,_0x5e229f,_0x3abc5d){return new BPromise(function(_0x4be64c,_0x22f45c){return client['request'](_0x326eb7,_0x3abc5d)['then'](function(_0x2c2c2c){logger[_0x90cc('0xc')](_0x90cc('0xd'),_0x5e229f,_0x90cc('0xe'));logger['debug'](_0x90cc('0xf'),_0x5e229f,_0x90cc('0xe'),JSON[_0x90cc('0x10')](_0x2c2c2c));if(_0x2c2c2c[_0x90cc('0x11')]){if(_0x2c2c2c['error']['code']===0x1f4){logger[_0x90cc('0x11')]('DashboardItem,\x20%s,\x20%s',_0x5e229f,_0x2c2c2c[_0x90cc('0x11')][_0x90cc('0x12')]);return _0x22f45c(_0x2c2c2c[_0x90cc('0x11')]['message']);}logger[_0x90cc('0x11')](_0x90cc('0xd'),_0x5e229f,_0x2c2c2c[_0x90cc('0x11')][_0x90cc('0x12')]);return _0x4be64c(_0x2c2c2c[_0x90cc('0x11')]['message']);}else{logger[_0x90cc('0xc')](_0x90cc('0xd'),_0x5e229f,_0x90cc('0xe'));_0x4be64c(_0x2c2c2c[_0x90cc('0x13')][_0x90cc('0x12')]);}})[_0x90cc('0x14')](function(_0x1be246){logger[_0x90cc('0x11')]('DashboardItem,\x20%s,\x20%s',_0x5e229f,_0x1be246);_0x22f45c(_0x1be246);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b5b54de..b0a5bac 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 _0x23c1=['save','remove','update','emit','removeListener','register','dashboardItem:','./dashboardItem.events'];(function(_0x5464ab,_0x329d11){var _0x15432c=function(_0x451994){while(--_0x451994){_0x5464ab['push'](_0x5464ab['shift']());}};_0x15432c(++_0x329d11);}(_0x23c1,0x137));var _0x123c=function(_0x3f917b,_0x3689f9){_0x3f917b=_0x3f917b-0x0;var _0x30d079=_0x23c1[_0x3f917b];return _0x30d079;};'use strict';var DashboardItemEvents=require(_0x123c('0x0'));var events=[_0x123c('0x1'),_0x123c('0x2'),_0x123c('0x3')];function createListener(_0x1ef7c1,_0x57d647){return function(_0x26b5ef){_0x57d647[_0x123c('0x4')](_0x1ef7c1,_0x26b5ef);};}function removeListener(_0x54151e,_0x763a43){return function(){DashboardItemEvents[_0x123c('0x5')](_0x54151e,_0x763a43);};}exports[_0x123c('0x6')]=function(_0x2038f2){for(var _0x602733=0x0,_0x51f96c=events['length'];_0x602733<_0x51f96c;_0x602733++){var _0x3d5776=events[_0x602733];var _0x1e0adc=createListener(_0x123c('0x7')+_0x3d5776,_0x2038f2);DashboardItemEvents['on'](_0x3d5776,_0x1e0adc);}}; \ No newline at end of file +var _0xb14b=['length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register'];(function(_0x825179,_0xc9870d){var _0x87f77d=function(_0x186eb6){while(--_0x186eb6){_0x825179['push'](_0x825179['shift']());}};_0x87f77d(++_0xc9870d);}(_0xb14b,0x16a));var _0xbb14=function(_0x5d2d3b,_0x173170){_0x5d2d3b=_0x5d2d3b-0x0;var _0x11afcd=_0xb14b[_0x5d2d3b];return _0x11afcd;};'use strict';var DashboardItemEvents=require(_0xbb14('0x0'));var events=['save',_0xbb14('0x1'),_0xbb14('0x2')];function createListener(_0x9c8096,_0x27d910){return function(_0x235911){_0x27d910[_0xbb14('0x3')](_0x9c8096,_0x235911);};}function removeListener(_0x5d1327,_0x387aa2){return function(){DashboardItemEvents[_0xbb14('0x4')](_0x5d1327,_0x387aa2);};}exports[_0xbb14('0x5')]=function(_0x1ccaf8){for(var _0x551d46=0x0,_0x406fa2=events[_0xbb14('0x6')];_0x551d46<_0x406fa2;_0x551d46++){var _0x48e725=events[_0x551d46];var _0x3d43ee=createListener(_0xbb14('0x7')+_0x48e725,_0x1ccaf8);DashboardItemEvents['on'](_0x48e725,_0x3d43ee);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 050bfd5..ca0883e 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 _0x98a1=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','post','put','update','delete'];(function(_0x4cb044,_0xed596c){var _0x3ad92e=function(_0x303bd4){while(--_0x303bd4){_0x4cb044['push'](_0x4cb044['shift']());}};_0x3ad92e(++_0xed596c);}(_0x98a1,0x1a4));var _0x198a=function(_0x11fe3a,_0x4b8055){_0x11fe3a=_0x11fe3a-0x0;var _0x332897=_0x98a1[_0x11fe3a];return _0x332897;};'use strict';var multer=require(_0x198a('0x0'));var util=require(_0x198a('0x1'));var path=require(_0x198a('0x2'));var timeout=require(_0x198a('0x3'));var express=require(_0x198a('0x4'));var router=express[_0x198a('0x5')]();var fs_extra=require(_0x198a('0x6'));var auth=require(_0x198a('0x7'));var interaction=require(_0x198a('0x8'));var config=require(_0x198a('0x9'));var controller=require(_0x198a('0xa'));router[_0x198a('0xb')]('/:id',auth[_0x198a('0xc')](),controller['show']);router[_0x198a('0xd')]('/',auth[_0x198a('0xc')](),controller['create']);router[_0x198a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x198a('0xf')]);router[_0x198a('0x10')]('/:id',auth[_0x198a('0xc')](),controller[_0x198a('0x11')]);module[_0x198a('0x12')]=router; \ No newline at end of file +var _0x17d2=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','/:id','show','post','create','isAuthenticated','update','delete','destroy','exports'];(function(_0x6dbba,_0x587edf){var _0x46bb01=function(_0x516bfb){while(--_0x516bfb){_0x6dbba['push'](_0x6dbba['shift']());}};_0x46bb01(++_0x587edf);}(_0x17d2,0x66));var _0x217d=function(_0x17b6b4,_0x42ab53){_0x17b6b4=_0x17b6b4-0x0;var _0xcd5aa3=_0x17d2[_0x17b6b4];return _0xcd5aa3;};'use strict';var multer=require(_0x217d('0x0'));var util=require(_0x217d('0x1'));var path=require('path');var timeout=require(_0x217d('0x2'));var express=require(_0x217d('0x3'));var router=express[_0x217d('0x4')]();var fs_extra=require(_0x217d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x217d('0x6'));var config=require('../../config/environment');var controller=require(_0x217d('0x7'));router['get'](_0x217d('0x8'),auth['isAuthenticated'](),controller[_0x217d('0x9')]);router[_0x217d('0xa')]('/',auth['isAuthenticated'](),controller[_0x217d('0xb')]);router['put'](_0x217d('0x8'),auth[_0x217d('0xc')](),controller[_0x217d('0xd')]);router[_0x217d('0xe')](_0x217d('0x8'),auth[_0x217d('0xc')](),controller[_0x217d('0xf')]);module[_0x217d('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 4975421..3a2ff01 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 _0x804b=['STRING','first','sequelize'];(function(_0x2c5ce4,_0x1b4766){var _0x4060a3=function(_0x3d4b86){while(--_0x3d4b86){_0x2c5ce4['push'](_0x2c5ce4['shift']());}};_0x4060a3(++_0x1b4766);}(_0x804b,0x1d6));var _0xb804=function(_0x506be1,_0x401b1e){_0x506be1=_0x506be1-0x0;var _0x4dc38f=_0x804b[_0x506be1];return _0x4dc38f;};'use strict';var Sequelize=require(_0xb804('0x0'));module['exports']={'name':{'type':Sequelize[_0xb804('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xb804('0x2'),'second','third'),'allowNull':![],'defaultValue':_0xb804('0x2')},'description':{'type':Sequelize[_0xb804('0x1')]}}; \ No newline at end of file +var _0x89ea=['third','STRING','first','second'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x89ea,0xd1));var _0xa89e=function(_0x127187,_0x4f7f5c){_0x127187=_0x127187-0x0;var _0xcb9e8e=_0x89ea[_0x127187];return _0xcb9e8e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa89e('0x0')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xa89e('0x1'),_0xa89e('0x2'),_0xa89e('0x3')),'allowNull':![],'defaultValue':_0xa89e('0x1')},'description':{'type':Sequelize[_0xa89e('0x0')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 73f20f4..198ade2 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 _0x0d9e=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','name','Disposition','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','model','fields','create'];(function(_0x1340f7,_0x37636a){var _0x29431f=function(_0x559976){while(--_0x559976){_0x1340f7['push'](_0x1340f7['shift']());}};_0x29431f(++_0x37636a);}(_0x0d9e,0x18e));var _0xe0d9=function(_0x1baab9,_0x155f0b){_0x1baab9=_0x1baab9-0x0;var _0x424bb4=_0x0d9e[_0x1baab9];return _0x424bb4;};'use strict';var emlformat=require(_0xe0d9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe0d9('0x1'));var rp=require('request-promise');var moment=require(_0xe0d9('0x2'));var BPromise=require(_0xe0d9('0x3'));var Mustache=require(_0xe0d9('0x4'));var util=require(_0xe0d9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe0d9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0d9('0x7'));var _=require(_0xe0d9('0x8'));var squel=require(_0xe0d9('0x9'));var crypto=require('crypto');var jsforce=require(_0xe0d9('0xa'));var deskjs=require(_0xe0d9('0xb'));var toCsv=require(_0xe0d9('0x6'));var querystring=require(_0xe0d9('0xc'));var Papa=require(_0xe0d9('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe0d9('0xe'));var as=require(_0xe0d9('0xf'));var hardwareService=require(_0xe0d9('0x10'));var logger=require('../../config/logger')(_0xe0d9('0x11'));var utils=require('../../config/utils');var config=require(_0xe0d9('0x12'));var licenseUtil=require(_0xe0d9('0x13'));var db=require(_0xe0d9('0x14'))['db'];function respondWithStatusCode(_0x3f4ee4,_0x74f1e5){_0x74f1e5=_0x74f1e5||0xcc;return function(_0x3888c9){if(_0x3888c9){return _0x3f4ee4[_0xe0d9('0x15')](_0x74f1e5);}return _0x3f4ee4[_0xe0d9('0x16')](_0x74f1e5)[_0xe0d9('0x17')]();};}function respondWithResult(_0x21042d,_0x4a8233){_0x4a8233=_0x4a8233||0xc8;return function(_0x254ff6){if(_0x254ff6){return _0x21042d[_0xe0d9('0x16')](_0x4a8233)[_0xe0d9('0x18')](_0x254ff6);}};}function respondWithFilteredResult(_0xc6671,_0x20c3fa){return function(_0x12dcd9){if(_0x12dcd9){var _0x4200b3=typeof _0x20c3fa[_0xe0d9('0x19')]==='undefined'&&typeof _0x20c3fa[_0xe0d9('0x1a')]===_0xe0d9('0x1b');var _0x18899e=_0x12dcd9[_0xe0d9('0x1c')];var _0x1963e3=_0x4200b3?0x0:_0x20c3fa[_0xe0d9('0x19')];var _0x5e1b1a=_0x4200b3?_0x12dcd9[_0xe0d9('0x1c')]:_0x20c3fa['offset']+_0x20c3fa[_0xe0d9('0x1a')];var _0x5e4dd2;if(_0x5e1b1a>=_0x18899e){_0x5e1b1a=_0x18899e;_0x5e4dd2=0xc8;}else{_0x5e4dd2=0xce;}_0xc6671[_0xe0d9('0x16')](_0x5e4dd2);return _0xc6671[_0xe0d9('0x1d')](_0xe0d9('0x1e'),_0x1963e3+'-'+_0x5e1b1a+'/'+_0x18899e)[_0xe0d9('0x18')](_0x12dcd9);}return null;};}function patchUpdates(_0x1de545){return function(_0x1c85da){try{jsonpatch['apply'](_0x1c85da,_0x1de545,!![]);}catch(_0x49ce6c){return BPromise[_0xe0d9('0x1f')](_0x49ce6c);}return _0x1c85da[_0xe0d9('0x20')]();};}function saveUpdates(_0x25a21b,_0x3684d6){return function(_0x54069c){if(_0x54069c){return _0x54069c[_0xe0d9('0x21')](_0x25a21b)['then'](function(_0x45c893){return _0x45c893;});}return null;};}function removeEntity(_0x57ac41,_0x431a5e){return function(_0x466161){if(_0x466161){return _0x466161[_0xe0d9('0x22')]()[_0xe0d9('0x23')](function(){var _0x3b8fd7=_0x466161[_0xe0d9('0x24')]({'plain':!![]});var _0x56d241=_0xe0d9('0x25');return db[_0xe0d9('0x26')][_0xe0d9('0x22')]({'where':{'type':_0x56d241,'resourceId':_0x3b8fd7['id']}})[_0xe0d9('0x23')](function(){return _0x466161;});})[_0xe0d9('0x23')](function(){_0x57ac41[_0xe0d9('0x16')](0xcc)[_0xe0d9('0x17')]();});}};}function handleEntityNotFound(_0x5ebcb2,_0x3ab499){return function(_0x365fec){if(!_0x365fec){_0x5ebcb2['sendStatus'](0x194);}return _0x365fec;};}function handleError(_0x49d4f7,_0x4d4711){_0x4d4711=_0x4d4711||0x1f4;return function(_0x22fd8c){logger[_0xe0d9('0x27')](_0x22fd8c['stack']);if(_0x22fd8c[_0xe0d9('0x28')]){delete _0x22fd8c['name'];}_0x49d4f7['status'](_0x4d4711)['send'](_0x22fd8c);};}exports['index']=function(_0x45ab0c,_0x4c9fea){var _0x184f3a={},_0x2b88aa={},_0x2573be={'count':0x0,'rows':[]};var _0x4caa88=_['map'](db[_0xe0d9('0x29')][_0xe0d9('0x2a')],function(_0x519bc8){return{'name':_0x519bc8[_0xe0d9('0x2b')],'type':_0x519bc8[_0xe0d9('0x2c')][_0xe0d9('0x2d')]};});_0x2b88aa['model']=_[_0xe0d9('0x2e')](_0x4caa88,_0xe0d9('0x28'));_0x2b88aa[_0xe0d9('0x2f')]=_[_0xe0d9('0x30')](_0x45ab0c[_0xe0d9('0x2f')]);_0x2b88aa[_0xe0d9('0x31')]=_[_0xe0d9('0x32')](_0x2b88aa['model'],_0x2b88aa[_0xe0d9('0x2f')]);_0x184f3a[_0xe0d9('0x33')]=_[_0xe0d9('0x32')](_0x2b88aa['model'],qs['fields'](_0x45ab0c['query']['fields']));_0x184f3a[_0xe0d9('0x33')]=_0x184f3a[_0xe0d9('0x33')]['length']?_0x184f3a[_0xe0d9('0x33')]:_0x2b88aa['model'];if(!_0x45ab0c[_0xe0d9('0x2f')][_0xe0d9('0x34')](_0xe0d9('0x35'))){_0x184f3a['limit']=qs[_0xe0d9('0x1a')](_0x45ab0c[_0xe0d9('0x2f')][_0xe0d9('0x1a')]);_0x184f3a[_0xe0d9('0x19')]=qs[_0xe0d9('0x19')](_0x45ab0c[_0xe0d9('0x2f')]['offset']);}_0x184f3a[_0xe0d9('0x36')]=qs['sort'](_0x45ab0c[_0xe0d9('0x2f')][_0xe0d9('0x37')]);_0x184f3a[_0xe0d9('0x38')]=qs[_0xe0d9('0x31')](_[_0xe0d9('0x39')](_0x45ab0c['query'],_0x2b88aa[_0xe0d9('0x31')]),_0x4caa88);if(_0x45ab0c[_0xe0d9('0x2f')][_0xe0d9('0x3a')]){_0x184f3a[_0xe0d9('0x38')]=_['merge'](_0x184f3a[_0xe0d9('0x38')],{'$or':_['map'](_0x4caa88,function(_0x219f3f){if(_0x219f3f[_0xe0d9('0x2c')]!=='VIRTUAL'){var _0xdf71fd={};_0xdf71fd[_0x219f3f[_0xe0d9('0x28')]]={'$like':'%'+_0x45ab0c['query'][_0xe0d9('0x3a')]+'%'};return _0xdf71fd;}})});}_0x184f3a=_[_0xe0d9('0x3b')]({},_0x184f3a,_0x45ab0c[_0xe0d9('0x3c')]);var _0x23dd3d={'where':_0x184f3a[_0xe0d9('0x38')]};return db[_0xe0d9('0x29')][_0xe0d9('0x1c')](_0x23dd3d)[_0xe0d9('0x23')](function(_0x299660){_0x2573be['count']=_0x299660;if(_0x45ab0c[_0xe0d9('0x2f')][_0xe0d9('0x3d')]){_0x184f3a[_0xe0d9('0x3e')]=[{'all':!![]}];}return db[_0xe0d9('0x29')][_0xe0d9('0x3f')](_0x184f3a);})[_0xe0d9('0x23')](function(_0xe3c57c){_0x2573be[_0xe0d9('0x40')]=_0xe3c57c;return _0x2573be;})['then'](respondWithFilteredResult(_0x4c9fea,_0x184f3a))[_0xe0d9('0x41')](handleError(_0x4c9fea,null));};exports[_0xe0d9('0x42')]=function(_0x5dff95,_0x19a7cc){var _0xadc5f4={'raw':!![],'where':{'id':_0x5dff95['params']['id']}},_0x12a12e={};_0x12a12e[_0xe0d9('0x43')]=_['keys'](db[_0xe0d9('0x29')]['rawAttributes']);_0x12a12e[_0xe0d9('0x2f')]=_[_0xe0d9('0x30')](_0x5dff95['query']);_0x12a12e[_0xe0d9('0x31')]=_['intersection'](_0x12a12e[_0xe0d9('0x43')],_0x12a12e[_0xe0d9('0x2f')]);_0xadc5f4[_0xe0d9('0x33')]=_[_0xe0d9('0x32')](_0x12a12e[_0xe0d9('0x43')],qs['fields'](_0x5dff95['query'][_0xe0d9('0x44')]));_0xadc5f4[_0xe0d9('0x33')]=_0xadc5f4[_0xe0d9('0x33')]['length']?_0xadc5f4[_0xe0d9('0x33')]:_0x12a12e[_0xe0d9('0x43')];if(_0x5dff95['query'][_0xe0d9('0x3d')]){_0xadc5f4[_0xe0d9('0x3e')]=[{'all':!![]}];}_0xadc5f4=_[_0xe0d9('0x3b')]({},_0xadc5f4,_0x5dff95[_0xe0d9('0x3c')]);return db[_0xe0d9('0x29')]['find'](_0xadc5f4)[_0xe0d9('0x23')](handleEntityNotFound(_0x19a7cc,null))[_0xe0d9('0x23')](respondWithResult(_0x19a7cc,null))[_0xe0d9('0x41')](handleError(_0x19a7cc,null));};exports[_0xe0d9('0x45')]=function(_0x4af787,_0x3bced6){return db['Disposition'][_0xe0d9('0x45')](_0x4af787['body'],{})['then'](function(_0x2b14c9){var _0x32e7ec=_0x4af787[_0xe0d9('0x46')]['get']({'plain':!![]});if(!_0x32e7ec)throw new Error(_0xe0d9('0x47'));if(_0x32e7ec['role']==='user'){var _0x2a0117=_0x2b14c9['get']({'plain':!![]});var _0x4707ae=_0xe0d9('0x25');return db[_0xe0d9('0x48')][_0xe0d9('0x49')]({'where':{'name':_0x4707ae,'userProfileId':_0x32e7ec[_0xe0d9('0x4a')]},'raw':!![]})[_0xe0d9('0x23')](function(_0x39ec3f){if(_0x39ec3f&&_0x39ec3f['autoAssociation']===0x0){return db[_0xe0d9('0x26')][_0xe0d9('0x45')]({'name':_0x2a0117[_0xe0d9('0x28')],'resourceId':_0x2a0117['id'],'type':_0x39ec3f[_0xe0d9('0x28')],'sectionId':_0x39ec3f['id']},{})[_0xe0d9('0x23')](function(){return _0x2b14c9;});}else{return _0x2b14c9;}})[_0xe0d9('0x41')](function(_0x25b8d4){logger[_0xe0d9('0x27')](_0xe0d9('0x4b'),_0x25b8d4);throw _0x25b8d4;});}return _0x2b14c9;})['then'](respondWithResult(_0x3bced6,0xc9))[_0xe0d9('0x41')](handleError(_0x3bced6,null));};exports[_0xe0d9('0x21')]=function(_0x16d627,_0x222f6e){if(_0x16d627['body']['id']){delete _0x16d627[_0xe0d9('0x4c')]['id'];}return db['Disposition'][_0xe0d9('0x49')]({'where':{'id':_0x16d627['params']['id']}})[_0xe0d9('0x23')](handleEntityNotFound(_0x222f6e,null))['then'](saveUpdates(_0x16d627[_0xe0d9('0x4c')],null))[_0xe0d9('0x23')](respondWithResult(_0x222f6e,null))[_0xe0d9('0x41')](handleError(_0x222f6e,null));};exports[_0xe0d9('0x22')]=function(_0x56ba4f,_0x4f731d){return db[_0xe0d9('0x29')][_0xe0d9('0x49')]({'where':{'id':_0x56ba4f[_0xe0d9('0x4d')]['id']}})[_0xe0d9('0x23')](handleEntityNotFound(_0x4f731d,null))[_0xe0d9('0x23')](removeEntity(_0x4f731d,null))[_0xe0d9('0x41')](handleError(_0x4f731d,null));}; \ No newline at end of file +var _0x563e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','end','error','name','send','index','map','Disposition','rawAttributes','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','user','role','Dispositions','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse'];(function(_0x5c69e9,_0x31ed88){var _0x5135ee=function(_0x27084f){while(--_0x27084f){_0x5c69e9['push'](_0x5c69e9['shift']());}};_0x5135ee(++_0x31ed88);}(_0x563e,0x1cb));var _0xe563=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x563e[_0x1fc122];return _0xa2cb13;};'use strict';var emlformat=require(_0xe563('0x0'));var rimraf=require(_0xe563('0x1'));var zipdir=require(_0xe563('0x2'));var jsonpatch=require(_0xe563('0x3'));var rp=require('request-promise');var moment=require(_0xe563('0x4'));var BPromise=require(_0xe563('0x5'));var Mustache=require(_0xe563('0x6'));var util=require('util');var path=require(_0xe563('0x7'));var sox=require(_0xe563('0x8'));var csv=require(_0xe563('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe563('0xa'));var _=require(_0xe563('0xb'));var squel=require('squel');var crypto=require(_0xe563('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe563('0x9'));var querystring=require(_0xe563('0xd'));var Papa=require(_0xe563('0xe'));var Redis=require('ioredis');var authService=require(_0xe563('0xf'));var qs=require(_0xe563('0x10'));var as=require(_0xe563('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe563('0x12'))(_0xe563('0x13'));var utils=require('../../config/utils');var config=require(_0xe563('0x14'));var licenseUtil=require(_0xe563('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7bac66,_0x1e12cd){_0x1e12cd=_0x1e12cd||0xcc;return function(_0x3c4405){if(_0x3c4405){return _0x7bac66[_0xe563('0x16')](_0x1e12cd);}return _0x7bac66[_0xe563('0x17')](_0x1e12cd)['end']();};}function respondWithResult(_0x19dc27,_0x2fe460){_0x2fe460=_0x2fe460||0xc8;return function(_0x18fcb1){if(_0x18fcb1){return _0x19dc27[_0xe563('0x17')](_0x2fe460)[_0xe563('0x18')](_0x18fcb1);}};}function respondWithFilteredResult(_0x11de16,_0x127535){return function(_0x5e46f9){if(_0x5e46f9){var _0x23d8f4=typeof _0x127535[_0xe563('0x19')]===_0xe563('0x1a')&&typeof _0x127535[_0xe563('0x1b')]===_0xe563('0x1a');var _0x592006=_0x5e46f9[_0xe563('0x1c')];var _0x46907a=_0x23d8f4?0x0:_0x127535[_0xe563('0x19')];var _0x259617=_0x23d8f4?_0x5e46f9[_0xe563('0x1c')]:_0x127535[_0xe563('0x19')]+_0x127535[_0xe563('0x1b')];var _0x1e414e;if(_0x259617>=_0x592006){_0x259617=_0x592006;_0x1e414e=0xc8;}else{_0x1e414e=0xce;}_0x11de16[_0xe563('0x17')](_0x1e414e);return _0x11de16[_0xe563('0x1d')](_0xe563('0x1e'),_0x46907a+'-'+_0x259617+'/'+_0x592006)[_0xe563('0x18')](_0x5e46f9);}return null;};}function patchUpdates(_0x348e33){return function(_0x29ac77){try{jsonpatch['apply'](_0x29ac77,_0x348e33,!![]);}catch(_0x55df73){return BPromise['reject'](_0x55df73);}return _0x29ac77[_0xe563('0x1f')]();};}function saveUpdates(_0x42320c,_0x3ec92d){return function(_0x1c8e78){if(_0x1c8e78){return _0x1c8e78[_0xe563('0x20')](_0x42320c)[_0xe563('0x21')](function(_0x3989c6){return _0x3989c6;});}return null;};}function removeEntity(_0x32f92b,_0x1fbd02){return function(_0x5b2440){if(_0x5b2440){return _0x5b2440[_0xe563('0x22')]()[_0xe563('0x21')](function(){var _0x489346=_0x5b2440[_0xe563('0x23')]({'plain':!![]});var _0x1ec6a6='Dispositions';return db['UserProfileResource'][_0xe563('0x22')]({'where':{'type':_0x1ec6a6,'resourceId':_0x489346['id']}})[_0xe563('0x21')](function(){return _0x5b2440;});})['then'](function(){_0x32f92b['status'](0xcc)[_0xe563('0x24')]();});}};}function handleEntityNotFound(_0x8d1001,_0x99688e){return function(_0x539ee9){if(!_0x539ee9){_0x8d1001['sendStatus'](0x194);}return _0x539ee9;};}function handleError(_0x2d1291,_0x1df770){_0x1df770=_0x1df770||0x1f4;return function(_0x500f22){logger[_0xe563('0x25')](_0x500f22['stack']);if(_0x500f22['name']){delete _0x500f22[_0xe563('0x26')];}_0x2d1291[_0xe563('0x17')](_0x1df770)[_0xe563('0x27')](_0x500f22);};}exports[_0xe563('0x28')]=function(_0x33a9eb,_0x2b3afe){var _0x34d661={},_0x3c37a6={},_0x158b60={'count':0x0,'rows':[]};var _0x3bbdb3=_[_0xe563('0x29')](db[_0xe563('0x2a')][_0xe563('0x2b')],function(_0xb2e70){return{'name':_0xb2e70['fieldName'],'type':_0xb2e70[_0xe563('0x2c')][_0xe563('0x2d')]};});_0x3c37a6['model']=_[_0xe563('0x29')](_0x3bbdb3,_0xe563('0x26'));_0x3c37a6['query']=_[_0xe563('0x2e')](_0x33a9eb[_0xe563('0x2f')]);_0x3c37a6['filters']=_[_0xe563('0x30')](_0x3c37a6['model'],_0x3c37a6[_0xe563('0x2f')]);_0x34d661[_0xe563('0x31')]=_[_0xe563('0x30')](_0x3c37a6[_0xe563('0x32')],qs['fields'](_0x33a9eb[_0xe563('0x2f')][_0xe563('0x33')]));_0x34d661[_0xe563('0x31')]=_0x34d661['attributes'][_0xe563('0x34')]?_0x34d661[_0xe563('0x31')]:_0x3c37a6['model'];if(!_0x33a9eb[_0xe563('0x2f')][_0xe563('0x35')](_0xe563('0x36'))){_0x34d661[_0xe563('0x1b')]=qs[_0xe563('0x1b')](_0x33a9eb[_0xe563('0x2f')][_0xe563('0x1b')]);_0x34d661[_0xe563('0x19')]=qs[_0xe563('0x19')](_0x33a9eb[_0xe563('0x2f')][_0xe563('0x19')]);}_0x34d661[_0xe563('0x37')]=qs[_0xe563('0x38')](_0x33a9eb['query'][_0xe563('0x38')]);_0x34d661[_0xe563('0x39')]=qs[_0xe563('0x3a')](_[_0xe563('0x3b')](_0x33a9eb[_0xe563('0x2f')],_0x3c37a6[_0xe563('0x3a')]),_0x3bbdb3);if(_0x33a9eb[_0xe563('0x2f')][_0xe563('0x3c')]){_0x34d661[_0xe563('0x39')]=_[_0xe563('0x3d')](_0x34d661[_0xe563('0x39')],{'$or':_[_0xe563('0x29')](_0x3bbdb3,function(_0x30d1b8){if(_0x30d1b8['type']!==_0xe563('0x3e')){var _0x459213={};_0x459213[_0x30d1b8['name']]={'$like':'%'+_0x33a9eb['query'][_0xe563('0x3c')]+'%'};return _0x459213;}})});}_0x34d661=_['merge']({},_0x34d661,_0x33a9eb[_0xe563('0x3f')]);var _0x17a541={'where':_0x34d661['where']};return db[_0xe563('0x2a')][_0xe563('0x1c')](_0x17a541)[_0xe563('0x21')](function(_0x2c4e3d){_0x158b60[_0xe563('0x1c')]=_0x2c4e3d;if(_0x33a9eb[_0xe563('0x2f')][_0xe563('0x40')]){_0x34d661[_0xe563('0x41')]=[{'all':!![]}];}return db[_0xe563('0x2a')][_0xe563('0x42')](_0x34d661);})[_0xe563('0x21')](function(_0x34f660){_0x158b60['rows']=_0x34f660;return _0x158b60;})[_0xe563('0x21')](respondWithFilteredResult(_0x2b3afe,_0x34d661))['catch'](handleError(_0x2b3afe,null));};exports[_0xe563('0x43')]=function(_0x36d621,_0xb1b114){var _0x113edb={'raw':!![],'where':{'id':_0x36d621[_0xe563('0x44')]['id']}},_0x198cca={};_0x198cca[_0xe563('0x32')]=_[_0xe563('0x2e')](db[_0xe563('0x2a')][_0xe563('0x2b')]);_0x198cca[_0xe563('0x2f')]=_[_0xe563('0x2e')](_0x36d621[_0xe563('0x2f')]);_0x198cca[_0xe563('0x3a')]=_[_0xe563('0x30')](_0x198cca[_0xe563('0x32')],_0x198cca[_0xe563('0x2f')]);_0x113edb[_0xe563('0x31')]=_[_0xe563('0x30')](_0x198cca[_0xe563('0x32')],qs[_0xe563('0x33')](_0x36d621['query']['fields']));_0x113edb[_0xe563('0x31')]=_0x113edb[_0xe563('0x31')][_0xe563('0x34')]?_0x113edb['attributes']:_0x198cca[_0xe563('0x32')];if(_0x36d621[_0xe563('0x2f')][_0xe563('0x40')]){_0x113edb[_0xe563('0x41')]=[{'all':!![]}];}_0x113edb=_[_0xe563('0x3d')]({},_0x113edb,_0x36d621[_0xe563('0x3f')]);return db[_0xe563('0x2a')]['find'](_0x113edb)['then'](handleEntityNotFound(_0xb1b114,null))[_0xe563('0x21')](respondWithResult(_0xb1b114,null))[_0xe563('0x45')](handleError(_0xb1b114,null));};exports[_0xe563('0x46')]=function(_0x361dd8,_0x44e380){return db[_0xe563('0x2a')][_0xe563('0x46')](_0x361dd8[_0xe563('0x47')],{})[_0xe563('0x21')](function(_0x5b4e5d){var _0x8c570f=_0x361dd8[_0xe563('0x48')][_0xe563('0x23')]({'plain':!![]});if(!_0x8c570f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8c570f[_0xe563('0x49')]==='user'){var _0xd4536d=_0x5b4e5d[_0xe563('0x23')]({'plain':!![]});var _0x11c497=_0xe563('0x4a');return db['UserProfileSection'][_0xe563('0x4b')]({'where':{'name':_0x11c497,'userProfileId':_0x8c570f[_0xe563('0x4c')]},'raw':!![]})[_0xe563('0x21')](function(_0xaced62){if(_0xaced62&&_0xaced62[_0xe563('0x4d')]===0x0){return db['UserProfileResource'][_0xe563('0x46')]({'name':_0xd4536d['name'],'resourceId':_0xd4536d['id'],'type':_0xaced62[_0xe563('0x26')],'sectionId':_0xaced62['id']},{})[_0xe563('0x21')](function(){return _0x5b4e5d;});}else{return _0x5b4e5d;}})['catch'](function(_0x517ae5){logger['error'](_0xe563('0x4e'),_0x517ae5);throw _0x517ae5;});}return _0x5b4e5d;})['then'](respondWithResult(_0x44e380,0xc9))[_0xe563('0x45')](handleError(_0x44e380,null));};exports[_0xe563('0x20')]=function(_0x6453f8,_0x2d0c19){if(_0x6453f8[_0xe563('0x47')]['id']){delete _0x6453f8[_0xe563('0x47')]['id'];}return db[_0xe563('0x2a')]['find']({'where':{'id':_0x6453f8[_0xe563('0x44')]['id']}})[_0xe563('0x21')](handleEntityNotFound(_0x2d0c19,null))[_0xe563('0x21')](saveUpdates(_0x6453f8[_0xe563('0x47')],null))[_0xe563('0x21')](respondWithResult(_0x2d0c19,null))[_0xe563('0x45')](handleError(_0x2d0c19,null));};exports[_0xe563('0x22')]=function(_0x2bff52,_0x361c9f){return db[_0xe563('0x2a')]['find']({'where':{'id':_0x2bff52[_0xe563('0x44')]['id']}})[_0xe563('0x21')](handleEntityNotFound(_0x361c9f,null))[_0xe563('0x21')](removeEntity(_0x361c9f,null))[_0xe563('0x45')](handleError(_0x361c9f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c0e4f09..b6d89b5 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 _0xd437=['Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','api','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x4c68d8,_0x57971c){var _0x4cf407=function(_0x1ae28){while(--_0x1ae28){_0x4c68d8['push'](_0x4c68d8['shift']());}};_0x4cf407(++_0x57971c);}(_0xd437,0xff));var _0x7d43=function(_0x2b9d5c,_0x173518){_0x2b9d5c=_0x2b9d5c-0x0;var _0x37bb93=_0xd437[_0x2b9d5c];return _0x37bb93;};'use strict';var _=require(_0x7d43('0x0'));var util=require(_0x7d43('0x1'));var logger=require('../../config/logger')(_0x7d43('0x2'));var moment=require('moment');var BPromise=require(_0x7d43('0x3'));var rp=require(_0x7d43('0x4'));var fs=require('fs');var path=require(_0x7d43('0x5'));var rimraf=require(_0x7d43('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x7d43('0x7')]=function(_0x111f6d,_0x1f954d){return _0x111f6d[_0x7d43('0x8')](_0x7d43('0x9'),attributes,{'tableName':_0x7d43('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7d43('0xb'),'fields':[_0x7d43('0xc'),'ListId']},{'unique':!![],'name':_0x7d43('0xd'),'fields':['name',_0x7d43('0xe')]},{'unique':!![],'name':_0x7d43('0xf'),'fields':[_0x7d43('0xc'),_0x7d43('0x10')]},{'unique':!![],'name':_0x7d43('0x11'),'fields':[_0x7d43('0xc'),_0x7d43('0x12')]},{'unique':!![],'name':_0x7d43('0x13'),'fields':[_0x7d43('0xc'),_0x7d43('0x14')]},{'unique':!![],'name':_0x7d43('0x15'),'fields':['name',_0x7d43('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x7d43('0xc'),_0x7d43('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6772=['name','ListId','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_dispositions','name_voice'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x6772,0xdb));var _0x2677=function(_0xbcdd9a,_0x29c233){_0xbcdd9a=_0xbcdd9a-0x0;var _0x4f9ca6=_0x6772[_0xbcdd9a];return _0x4f9ca6;};'use strict';var _=require(_0x2677('0x0'));var util=require(_0x2677('0x1'));var logger=require(_0x2677('0x2'))(_0x2677('0x3'));var moment=require(_0x2677('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2677('0x5'));var rimraf=require(_0x2677('0x6'));var config=require(_0x2677('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x565c37,_0x34be33){return _0x565c37[_0x2677('0x8')]('Disposition',attributes,{'tableName':_0x2677('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2677('0xa'),'fields':[_0x2677('0xb'),_0x2677('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0x2677('0xb'),_0x2677('0xd')]},{'unique':!![],'name':_0x2677('0xe'),'fields':[_0x2677('0xb'),_0x2677('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x2677('0xb'),_0x2677('0x10')]},{'unique':!![],'name':_0x2677('0x11'),'fields':[_0x2677('0xb'),_0x2677('0x12')]},{'unique':!![],'name':_0x2677('0x13'),'fields':[_0x2677('0xb'),_0x2677('0x14')]},{'unique':!![],'name':_0x2677('0x15'),'fields':[_0x2677('0xb'),_0x2677('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 92895b0..285cc5f 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x447377,_0x46085a){var _0x4ff659=function(_0x57edea){while(--_0x57edea){_0x447377['push'](_0x447377['shift']());}};_0x4ff659(++_0x46085a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1844e1,_0x4bcbfa){var _0x592a98=function(_0x8e6989){while(--_0x8e6989){_0x1844e1['push'](_0x1844e1['shift']());}};_0x592a98(++_0x4bcbfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 5470b2e..2a55a32 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 _0x28a0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1b8b5c,_0x342ea2){var _0x56be4f=function(_0x3c3619){while(--_0x3c3619){_0x1b8b5c['push'](_0x1b8b5c['shift']());}};_0x56be4f(++_0x342ea2);}(_0x28a0,0x1f0));var _0x028a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x28a0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x028a('0x0'));var util=require(_0x028a('0x1'));var path=require(_0x028a('0x2'));var timeout=require(_0x028a('0x3'));var express=require(_0x028a('0x4'));var router=express[_0x028a('0x5')]();var fs_extra=require(_0x028a('0x6'));var auth=require(_0x028a('0x7'));var interaction=require(_0x028a('0x8'));var config=require('../../config/environment');var controller=require(_0x028a('0x9'));router['get']('/',auth[_0x028a('0xa')](),controller['index']);router[_0x028a('0xb')](_0x028a('0xc'),auth[_0x028a('0xa')](),controller[_0x028a('0xd')]);router[_0x028a('0xe')]('/',auth[_0x028a('0xa')](),controller[_0x028a('0xf')]);router[_0x028a('0x10')]('/:id',auth[_0x028a('0xa')](),controller[_0x028a('0x11')]);router['delete'](_0x028a('0xc'),auth[_0x028a('0xa')](),controller[_0x028a('0x12')]);module[_0x028a('0x13')]=router; \ No newline at end of file +var _0xddcc=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xa2f6cc,_0x25ea74){var _0x25154c=function(_0x29984b){while(--_0x29984b){_0xa2f6cc['push'](_0xa2f6cc['shift']());}};_0x25154c(++_0x25ea74);}(_0xddcc,0x111));var _0xcddc=function(_0x324deb,_0x2c16ad){_0x324deb=_0x324deb-0x0;var _0x1688a8=_0xddcc[_0x324deb];return _0x1688a8;};'use strict';var multer=require(_0xcddc('0x0'));var util=require(_0xcddc('0x1'));var path=require(_0xcddc('0x2'));var timeout=require('connect-timeout');var express=require(_0xcddc('0x3'));var router=express[_0xcddc('0x4')]();var fs_extra=require(_0xcddc('0x5'));var auth=require(_0xcddc('0x6'));var interaction=require(_0xcddc('0x7'));var config=require(_0xcddc('0x8'));var controller=require(_0xcddc('0x9'));router[_0xcddc('0xa')]('/',auth[_0xcddc('0xb')](),controller[_0xcddc('0xc')]);router[_0xcddc('0xa')](_0xcddc('0xd'),auth[_0xcddc('0xb')](),controller['show']);router[_0xcddc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcddc('0xf')](_0xcddc('0xd'),auth[_0xcddc('0xb')](),controller[_0xcddc('0x10')]);router[_0xcddc('0x11')](_0xcddc('0xd'),auth['isAuthenticated'](),controller[_0xcddc('0x12')]);module[_0xcddc('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 73e2274..cd6f067 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 _0x030d=['12000','14400','2400','v17,v27,v29','IAX','DADHI','SIP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600'];(function(_0x419bc7,_0xeccf40){var _0x5ec58a=function(_0x306b4f){while(--_0x306b4f){_0x419bc7['push'](_0x419bc7['shift']());}};_0x5ec58a(++_0xeccf40);}(_0x030d,0xc6));var _0xd030=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x030d[_0x494d1f];return _0x457b6e;};'use strict';var Sequelize=require('sequelize');module[_0xd030('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd030('0x1')]},'ecm':{'type':Sequelize[_0xd030('0x2')](_0xd030('0x3'),'no'),'defaultValue':_0xd030('0x3')},'headerinfo':{'type':Sequelize[_0xd030('0x1')],'defaultValue':_0xd030('0x4')},'localstationid':{'type':Sequelize[_0xd030('0x1')],'unique':_0xd030('0x5')},'minrate':{'type':Sequelize[_0xd030('0x2')]('2400',_0xd030('0x6'),_0xd030('0x7'),_0xd030('0x8'),_0xd030('0x9'),_0xd030('0xa')),'defaultValue':_0xd030('0x6')},'maxrate':{'type':Sequelize[_0xd030('0x2')](_0xd030('0xb'),_0xd030('0x6'),_0xd030('0x7'),_0xd030('0x8'),_0xd030('0x9'),_0xd030('0xa')),'defaultValue':_0xd030('0xa')},'modem':{'type':Sequelize[_0xd030('0x1')],'defaultValue':_0xd030('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd030('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd030('0x2')]('SIP',_0xd030('0xd'),_0xd030('0xe'),'KHOMP'),'defaultValue':_0xd030('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd030('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd030('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd030('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd030('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd030('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd030('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd030('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd030('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0xd030('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x51c1da){if(!_0x51c1da)this['setDataValue'](_0xd030('0x14'),null);this[_0xd030('0x15')](_0xd030('0x16'),_0x51c1da);}}}; \ No newline at end of file +var _0x7f00=['9600','14400','4800','12000','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','7200'];(function(_0x2d604b,_0x4f1748){var _0x504857=function(_0x3c4990){while(--_0x3c4990){_0x2d604b['push'](_0x2d604b['shift']());}};_0x504857(++_0x4f1748);}(_0x7f00,0xa8));var _0x07f0=function(_0x21383b,_0x5158af){_0x21383b=_0x21383b-0x0;var _0x1e55ed=_0x7f00[_0x21383b];return _0x1e55ed;};'use strict';var Sequelize=require(_0x07f0('0x0'));module[_0x07f0('0x1')]={'name':{'type':Sequelize[_0x07f0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x07f0('0x2')]},'ecm':{'type':Sequelize[_0x07f0('0x3')](_0x07f0('0x4'),'no'),'defaultValue':_0x07f0('0x4')},'headerinfo':{'type':Sequelize[_0x07f0('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x07f0('0x5')},'minrate':{'type':Sequelize[_0x07f0('0x3')](_0x07f0('0x6'),'4800',_0x07f0('0x7'),_0x07f0('0x8'),'12000',_0x07f0('0x9')),'defaultValue':_0x07f0('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0x07f0('0x6'),'4800','7200','9600',_0x07f0('0xb'),'14400'),'defaultValue':_0x07f0('0x9')},'modem':{'type':Sequelize[_0x07f0('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x07f0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x07f0('0xc'),_0x07f0('0xd'),_0x07f0('0xe'),_0x07f0('0xf')),'defaultValue':_0x07f0('0xc')},'key':{'type':Sequelize[_0x07f0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x07f0('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x07f0('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x07f0('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x07f0('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07f0('0x12')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x07f0('0x11')],'defaultValue':![],'comment':_0x07f0('0x13'),'set':function(_0x16aa43){if(!_0x16aa43)this[_0x07f0('0x14')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x07f0('0x15'),_0x16aa43);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5dd6e84..cce1e2a 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 _0x7197=['findOne','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','priority','push','CDR(type)=inbound-fax','Set','ecm','faxdetect','maxrate','minrate','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','VoiceExtension','bulkCreate','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','rawAttributes','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x7197,0x106));var _0x7719=function(_0x15c316,_0x18ec14){_0x15c316=_0x15c316-0x0;var _0x7a0447=_0x7197[_0x15c316];return _0x7a0447;};'use strict';var emlformat=require(_0x7719('0x0'));var rimraf=require(_0x7719('0x1'));var zipdir=require(_0x7719('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7719('0x3'));var moment=require(_0x7719('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7719('0x5'));var util=require(_0x7719('0x6'));var path=require(_0x7719('0x7'));var sox=require(_0x7719('0x8'));var csv=require('to-csv');var ejs=require(_0x7719('0x9'));var fs=require('fs');var fs_extra=require(_0x7719('0xa'));var _=require(_0x7719('0xb'));var squel=require(_0x7719('0xc'));var crypto=require(_0x7719('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7719('0xe'));var toCsv=require(_0x7719('0xf'));var querystring=require(_0x7719('0x10'));var Papa=require(_0x7719('0x11'));var Redis=require('ioredis');var authService=require(_0x7719('0x12'));var qs=require(_0x7719('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7719('0x14'));var logger=require(_0x7719('0x15'))(_0x7719('0x16'));var utils=require(_0x7719('0x17'));var config=require(_0x7719('0x18'));var licenseUtil=require(_0x7719('0x19'));var db=require(_0x7719('0x1a'))['db'];config[_0x7719('0x1b')]=_['defaults'](config['redis'],{'host':_0x7719('0x1c'),'port':0x18eb});var socket=require(_0x7719('0x1d'))(new Redis(config[_0x7719('0x1b')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x7719('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x7719('0x1f')][_0x7719('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x495dfe,_0x4cecce,_0x3413d1,_0x157a30){return new BPromise(function(_0x1b55f7,_0x156de4){var _0xa48602=_0x157a30||client;return _0xa48602[_0x7719('0x21')](_0x495dfe,_0x3413d1)[_0x7719('0x22')](function(_0x42337e){logger['info'](_0x7719('0x23'),_0x4cecce,'request\x20sent');logger[_0x7719('0x24')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4cecce,_0x7719('0x25'),JSON['stringify'](_0x42337e));if(_0x42337e[_0x7719('0x26')]){if(_0x42337e[_0x7719('0x26')][_0x7719('0x27')]===0x1f4){logger[_0x7719('0x26')](_0x7719('0x23'),_0x4cecce,_0x42337e[_0x7719('0x26')][_0x7719('0x28')]);return _0x156de4(_0x42337e[_0x7719('0x26')][_0x7719('0x28')]);}logger[_0x7719('0x26')]('FaxAccount,\x20%s,\x20%s',_0x4cecce,_0x42337e[_0x7719('0x26')][_0x7719('0x28')]);return _0x1b55f7(_0x42337e[_0x7719('0x26')][_0x7719('0x28')]);}else{logger[_0x7719('0x29')](_0x7719('0x23'),_0x4cecce,_0x7719('0x25'));_0x1b55f7(_0x42337e['result'][_0x7719('0x28')]);}})[_0x7719('0x2a')](function(_0x45b6e5){logger[_0x7719('0x26')](_0x7719('0x23'),_0x4cecce,_0x45b6e5);_0x156de4(_0x45b6e5);});});}function respondWithStatusCode(_0x66b4af,_0x3d14c0){_0x3d14c0=_0x3d14c0||0xcc;return function(_0x9dd296){if(_0x9dd296){return _0x66b4af[_0x7719('0x2b')](_0x3d14c0);}return _0x66b4af[_0x7719('0x2c')](_0x3d14c0)[_0x7719('0x2d')]();};}function respondWithResult(_0x2b4444,_0xcf338d){_0xcf338d=_0xcf338d||0xc8;return function(_0x58b7ea){if(_0x58b7ea){return _0x2b4444['status'](_0xcf338d)[_0x7719('0x2e')](_0x58b7ea);}};}function respondWithFilteredResult(_0x42f6e3,_0x1aecfe){return function(_0x3ee2a1){if(_0x3ee2a1){var _0x357604=typeof _0x1aecfe[_0x7719('0x2f')]===_0x7719('0x30')&&typeof _0x1aecfe['limit']===_0x7719('0x30');var _0x2e125b=_0x3ee2a1['count'];var _0x576a12=_0x357604?0x0:_0x1aecfe['offset'];var _0x2a93fa=_0x357604?_0x3ee2a1[_0x7719('0x31')]:_0x1aecfe[_0x7719('0x2f')]+_0x1aecfe[_0x7719('0x32')];var _0x939c43;if(_0x2a93fa>=_0x2e125b){_0x2a93fa=_0x2e125b;_0x939c43=0xc8;}else{_0x939c43=0xce;}_0x42f6e3[_0x7719('0x2c')](_0x939c43);return _0x42f6e3[_0x7719('0x33')]('Content-Range',_0x576a12+'-'+_0x2a93fa+'/'+_0x2e125b)[_0x7719('0x2e')](_0x3ee2a1);}return null;};}function patchUpdates(_0x4b95a5){return function(_0x2a8a3b){try{jsonpatch[_0x7719('0x34')](_0x2a8a3b,_0x4b95a5,!![]);}catch(_0x91211f){return BPromise[_0x7719('0x35')](_0x91211f);}return _0x2a8a3b['save']();};}function saveUpdates(_0x4c38c4,_0x1a321c){return function(_0x3befc9){if(_0x3befc9){return _0x3befc9[_0x7719('0x36')](_0x4c38c4)[_0x7719('0x22')](function(_0x1a87e6){return _0x1a87e6;});}return null;};}function removeEntity(_0x3a0a95,_0x49ae04){return function(_0x16ceba){if(_0x16ceba){return _0x16ceba[_0x7719('0x37')]()[_0x7719('0x22')](function(){var _0x423938=_0x16ceba[_0x7719('0x38')]({'plain':!![]});var _0xe5b44b=_0x7719('0x39');return db[_0x7719('0x3a')][_0x7719('0x37')]({'where':{'type':_0xe5b44b,'resourceId':_0x423938['id']}})[_0x7719('0x22')](function(){return _0x16ceba;});})[_0x7719('0x22')](function(){_0x3a0a95[_0x7719('0x2c')](0xcc)[_0x7719('0x2d')]();});}};}function handleEntityNotFound(_0x2b24c7,_0x236b57){return function(_0x5388c1){if(!_0x5388c1){_0x2b24c7[_0x7719('0x2b')](0x194);}return _0x5388c1;};}function handleError(_0x441d41,_0x48497a){_0x48497a=_0x48497a||0x1f4;return function(_0x4f5fbf){logger['error'](_0x4f5fbf[_0x7719('0x3b')]);if(_0x4f5fbf[_0x7719('0x3c')]){delete _0x4f5fbf[_0x7719('0x3c')];}_0x441d41[_0x7719('0x2c')](_0x48497a)[_0x7719('0x3d')](_0x4f5fbf);};}exports[_0x7719('0x3e')]=function(_0x3a2ba8,_0x3aea39){var _0x287f5f={'include':[{'model':db[_0x7719('0x3f')],'as':_0x7719('0x40')}]},_0x6be7cd={},_0x397a04={'count':0x0,'rows':[]};var _0x50f908=_[_0x7719('0x41')](db[_0x7719('0x42')]['rawAttributes'],function(_0x1e0d1c){return{'name':_0x1e0d1c[_0x7719('0x43')],'type':_0x1e0d1c['type'][_0x7719('0x44')]};});_0x6be7cd[_0x7719('0x45')]=_['map'](_0x50f908,_0x7719('0x3c'));_0x6be7cd[_0x7719('0x46')]=_[_0x7719('0x47')](_0x3a2ba8[_0x7719('0x46')]);_0x6be7cd[_0x7719('0x48')]=_[_0x7719('0x49')](_0x6be7cd['model'],_0x6be7cd['query']);_0x287f5f[_0x7719('0x4a')]=_['intersection'](_0x6be7cd[_0x7719('0x45')],qs[_0x7719('0x4b')](_0x3a2ba8['query'][_0x7719('0x4b')]));_0x287f5f[_0x7719('0x4a')]=_0x287f5f[_0x7719('0x4a')][_0x7719('0x4c')]?_0x287f5f['attributes']:_0x6be7cd[_0x7719('0x45')];if(!_0x3a2ba8[_0x7719('0x46')][_0x7719('0x4d')](_0x7719('0x4e'))){_0x287f5f[_0x7719('0x32')]=qs[_0x7719('0x32')](_0x3a2ba8[_0x7719('0x46')][_0x7719('0x32')]);_0x287f5f['offset']=qs[_0x7719('0x2f')](_0x3a2ba8[_0x7719('0x46')][_0x7719('0x2f')]);}_0x287f5f['order']=qs['sort'](_0x3a2ba8[_0x7719('0x46')][_0x7719('0x4f')]);_0x287f5f[_0x7719('0x50')]=qs[_0x7719('0x48')](_[_0x7719('0x51')](_0x3a2ba8[_0x7719('0x46')],_0x6be7cd[_0x7719('0x48')]),_0x50f908);if(_0x3a2ba8[_0x7719('0x46')]['filter']){_0x287f5f[_0x7719('0x50')]=_[_0x7719('0x52')](_0x287f5f['where'],{'$or':_['map'](_0x50f908,function(_0x9aa7b0){if(_0x9aa7b0[_0x7719('0x53')]!==_0x7719('0x54')){var _0x53c199={};_0x53c199[_0x9aa7b0['name']]={'$like':'%'+_0x3a2ba8[_0x7719('0x46')][_0x7719('0x55')]+'%'};return _0x53c199;}})});}_0x287f5f=_[_0x7719('0x52')]({},_0x287f5f,_0x3a2ba8[_0x7719('0x56')]);var _0x182c3a={'where':_0x287f5f[_0x7719('0x50')]};return db[_0x7719('0x42')]['count'](_0x182c3a)[_0x7719('0x22')](function(_0x1c3902){_0x397a04[_0x7719('0x31')]=_0x1c3902;if(_0x3a2ba8[_0x7719('0x46')][_0x7719('0x57')]){_0x287f5f[_0x7719('0x58')]=[{'all':!![]}];}return db[_0x7719('0x42')][_0x7719('0x59')](_0x287f5f);})[_0x7719('0x22')](function(_0x304870){_0x397a04[_0x7719('0x5a')]=_0x304870;return _0x397a04;})[_0x7719('0x22')](respondWithFilteredResult(_0x3aea39,_0x287f5f))[_0x7719('0x2a')](handleError(_0x3aea39,null));};exports[_0x7719('0x5b')]=function(_0x556e69,_0x50317c){var _0x2c0ba2={'raw':![],'where':{'id':_0x556e69[_0x7719('0x5c')]['id']},'include':[{'model':db[_0x7719('0x3f')],'as':_0x7719('0x40')}]},_0x484dc6={};_0x484dc6[_0x7719('0x45')]=_[_0x7719('0x47')](db[_0x7719('0x42')]['rawAttributes']);_0x484dc6[_0x7719('0x46')]=_[_0x7719('0x47')](_0x556e69[_0x7719('0x46')]);_0x484dc6[_0x7719('0x48')]=_['intersection'](_0x484dc6['model'],_0x484dc6[_0x7719('0x46')]);_0x2c0ba2['attributes']=_[_0x7719('0x49')](_0x484dc6[_0x7719('0x45')],qs[_0x7719('0x4b')](_0x556e69[_0x7719('0x46')]['fields']));_0x2c0ba2['attributes']=_0x2c0ba2[_0x7719('0x4a')][_0x7719('0x4c')]?_0x2c0ba2[_0x7719('0x4a')]:_0x484dc6[_0x7719('0x45')];if(_0x556e69['query'][_0x7719('0x57')]){_0x2c0ba2[_0x7719('0x58')]=[{'all':!![]}];}_0x2c0ba2=_['merge']({},_0x2c0ba2,_0x556e69['options']);return db[_0x7719('0x42')][_0x7719('0x5d')](_0x2c0ba2)[_0x7719('0x22')](handleEntityNotFound(_0x50317c,null))[_0x7719('0x22')](respondWithResult(_0x50317c,null))['catch'](handleError(_0x50317c,null));};exports['create']=function(_0x528cb7,_0x505f1b){return db['FaxAccount'][_0x7719('0x5e')](_0x528cb7[_0x7719('0x5f')],{})[_0x7719('0x22')](function(_0x1f890d){var _0x21fce2=_0x528cb7[_0x7719('0x60')][_0x7719('0x38')]({'plain':!![]});if(!_0x21fce2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21fce2['role']===_0x7719('0x60')){var _0x3c8969=_0x1f890d['get']({'plain':!![]});var _0x2ffcd3='FaxAccounts';return db['UserProfileSection'][_0x7719('0x5d')]({'where':{'name':_0x2ffcd3,'userProfileId':_0x21fce2[_0x7719('0x61')]},'raw':!![]})['then'](function(_0x5afaf4){if(_0x5afaf4&&_0x5afaf4[_0x7719('0x62')]===0x0){return db[_0x7719('0x3a')][_0x7719('0x5e')]({'name':_0x3c8969[_0x7719('0x3c')],'resourceId':_0x3c8969['id'],'type':_0x5afaf4[_0x7719('0x3c')],'sectionId':_0x5afaf4['id']},{})[_0x7719('0x22')](function(){return _0x1f890d;});}else{return _0x1f890d;}})[_0x7719('0x2a')](function(_0x1998b4){logger['error'](_0x7719('0x63'),_0x1998b4);throw _0x1998b4;});}return _0x1f890d;})['then'](respondWithResult(_0x505f1b,0xc9))['catch'](handleError(_0x505f1b,null));};exports[_0x7719('0x36')]=function(_0x6d71f7,_0x59f9ce){if(_0x6d71f7[_0x7719('0x5f')]['id']){delete _0x6d71f7[_0x7719('0x5f')]['id'];}return db['FaxAccount'][_0x7719('0x5d')]({'where':{'id':_0x6d71f7[_0x7719('0x5c')]['id']},'include':[{'model':db[_0x7719('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x7719('0x22')](handleEntityNotFound(_0x59f9ce,null))[_0x7719('0x22')](saveUpdates(_0x6d71f7[_0x7719('0x5f')],null))[_0x7719('0x22')](respondWithResult(_0x59f9ce,null))[_0x7719('0x2a')](handleError(_0x59f9ce,null));};exports[_0x7719('0x37')]=function(_0xc24c58,_0x528a94){return db['FaxAccount'][_0x7719('0x5d')]({'where':{'id':_0xc24c58[_0x7719('0x5c')]['id']}})['then'](handleEntityNotFound(_0x528a94,null))['then'](removeEntity(_0x528a94,null))[_0x7719('0x2a')](handleError(_0x528a94,null));};exports[_0x7719('0x64')]=function(_0x59d010,_0x4ba039){return db[_0x7719('0x42')]['describe']()[_0x7719('0x22')](respondWithResult(_0x4ba039,null))[_0x7719('0x2a')](handleError(_0x4ba039,null));};exports['addDisposition']=function(_0x5df077,_0x3114c4,_0x113236){if(_0x5df077['body']['id']){delete _0x5df077[_0x7719('0x5f')]['id'];}return db[_0x7719('0x42')]['find']({'where':{'id':_0x5df077[_0x7719('0x5c')]['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x3114c4,null))['then'](function(_0x29e85f){if(_0x29e85f){_0x5df077[_0x7719('0x5f')][_0x7719('0x65')]=_0x29e85f['id'];return db[_0x7719('0x66')][_0x7719('0x5e')](_0x5df077[_0x7719('0x5f')]);}})[_0x7719('0x22')](respondWithResult(_0x3114c4,null))[_0x7719('0x2a')](handleError(_0x3114c4,null));};exports[_0x7719('0x67')]=function(_0x1cc7eb,_0x4d1125,_0x14546a){var _0x46b892={'raw':![],'where':{}};var _0x3c50cd={};var _0x4bbd63={'count':0x0,'rows':[]};return db[_0x7719('0x42')]['findOne']({'where':{'id':_0x1cc7eb[_0x7719('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4d1125,null))[_0x7719('0x22')](function(_0x159b91){if(_0x159b91){_0x3c50cd[_0x7719('0x45')]=_[_0x7719('0x47')](db[_0x7719('0x66')][_0x7719('0x68')]);_0x3c50cd[_0x7719('0x46')]=_[_0x7719('0x47')](_0x1cc7eb['query']);_0x3c50cd[_0x7719('0x48')]=_[_0x7719('0x49')](_0x3c50cd['model'],_0x3c50cd[_0x7719('0x46')]);_0x46b892[_0x7719('0x4a')]=_[_0x7719('0x49')](_0x3c50cd[_0x7719('0x45')],qs['fields'](_0x1cc7eb[_0x7719('0x46')][_0x7719('0x4b')]));_0x46b892[_0x7719('0x4a')]=_0x46b892[_0x7719('0x4a')][_0x7719('0x4c')]?_0x46b892['attributes']:_0x3c50cd[_0x7719('0x45')];if(!_0x1cc7eb['query'][_0x7719('0x4d')](_0x7719('0x4e'))){_0x46b892['limit']=qs[_0x7719('0x32')](_0x1cc7eb[_0x7719('0x46')][_0x7719('0x32')]);_0x46b892[_0x7719('0x2f')]=qs['offset'](_0x1cc7eb['query'][_0x7719('0x2f')]);}_0x46b892[_0x7719('0x69')]=qs[_0x7719('0x4f')](_0x1cc7eb[_0x7719('0x46')][_0x7719('0x4f')]);_0x46b892[_0x7719('0x50')]=qs[_0x7719('0x48')](_[_0x7719('0x51')](_0x1cc7eb[_0x7719('0x46')],_0x3c50cd['filters']));_0x46b892['where'][_0x7719('0x65')]=_0x159b91['id'];if(_0x1cc7eb[_0x7719('0x46')]['filter']){_0x46b892[_0x7719('0x50')]=_[_0x7719('0x52')](_0x46b892[_0x7719('0x50')],{'$or':_[_0x7719('0x41')](_0x46b892[_0x7719('0x4a')],function(_0x21f775){var _0x586619={};_0x586619[_0x21f775]={'$like':'%'+_0x1cc7eb[_0x7719('0x46')][_0x7719('0x55')]+'%'};return _0x586619;})});}_0x46b892=_[_0x7719('0x52')]({},_0x46b892,_0x1cc7eb[_0x7719('0x56')]);return db[_0x7719('0x66')]['count']({'where':_0x46b892[_0x7719('0x50')]})[_0x7719('0x22')](function(_0x5550e7){_0x4bbd63[_0x7719('0x31')]=_0x5550e7;if(_0x1cc7eb[_0x7719('0x46')]['includeAll']){_0x46b892[_0x7719('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x46b892);})['then'](function(_0x115045){_0x4bbd63[_0x7719('0x5a')]=_0x115045;return _0x4bbd63;});}})[_0x7719('0x22')](respondWithFilteredResult(_0x4d1125,_0x46b892))[_0x7719('0x2a')](handleError(_0x4d1125,null));};exports[_0x7719('0x6a')]=function(_0x2bd81e,_0x5890f8,_0x4288ce){return db[_0x7719('0x42')][_0x7719('0x5d')]({'where':{'id':_0x2bd81e[_0x7719('0x5c')]['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x5890f8,null))['then'](function(_0x3fe67c){if(_0x3fe67c){return _0x3fe67c[_0x7719('0x6a')](_0x2bd81e[_0x7719('0x46')][_0x7719('0x6b')]);}})[_0x7719('0x22')](respondWithStatusCode(_0x5890f8,null))[_0x7719('0x2a')](handleError(_0x5890f8,null));};exports[_0x7719('0x6c')]=function(_0x20a3ec,_0x3b8108,_0x2bed11){if(_0x20a3ec['body']['id']){delete _0x20a3ec[_0x7719('0x5f')]['id'];}return db[_0x7719('0x42')][_0x7719('0x5d')]({'where':{'id':_0x20a3ec[_0x7719('0x5c')]['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x3b8108,null))['then'](function(_0x1d5dcc){if(_0x1d5dcc){_0x20a3ec[_0x7719('0x5f')]['FaxAccountId']=_0x1d5dcc['id'];return db[_0x7719('0x6d')][_0x7719('0x5e')](_0x20a3ec[_0x7719('0x5f')]);}})['then'](respondWithResult(_0x3b8108,null))['catch'](handleError(_0x3b8108,null));};exports[_0x7719('0x6e')]=function(_0x2cde1a,_0x2d5182,_0x111b5a){var _0x123baa={'raw':![],'where':{}};var _0x3dc8c1={};var _0x5b54ec={'count':0x0,'rows':[]};return db[_0x7719('0x42')]['findOne']({'where':{'id':_0x2cde1a['params']['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x2d5182,null))[_0x7719('0x22')](function(_0x17de2b){if(_0x17de2b){_0x3dc8c1[_0x7719('0x45')]=_['keys'](db['CannedAnswer'][_0x7719('0x68')]);_0x3dc8c1[_0x7719('0x46')]=_[_0x7719('0x47')](_0x2cde1a[_0x7719('0x46')]);_0x3dc8c1['filters']=_[_0x7719('0x49')](_0x3dc8c1[_0x7719('0x45')],_0x3dc8c1[_0x7719('0x46')]);_0x123baa['attributes']=_[_0x7719('0x49')](_0x3dc8c1[_0x7719('0x45')],qs[_0x7719('0x4b')](_0x2cde1a[_0x7719('0x46')][_0x7719('0x4b')]));_0x123baa[_0x7719('0x4a')]=_0x123baa[_0x7719('0x4a')][_0x7719('0x4c')]?_0x123baa[_0x7719('0x4a')]:_0x3dc8c1[_0x7719('0x45')];if(!_0x2cde1a[_0x7719('0x46')][_0x7719('0x4d')](_0x7719('0x4e'))){_0x123baa[_0x7719('0x32')]=qs[_0x7719('0x32')](_0x2cde1a[_0x7719('0x46')][_0x7719('0x32')]);_0x123baa['offset']=qs[_0x7719('0x2f')](_0x2cde1a[_0x7719('0x46')][_0x7719('0x2f')]);}_0x123baa[_0x7719('0x69')]=qs[_0x7719('0x4f')](_0x2cde1a[_0x7719('0x46')][_0x7719('0x4f')]);_0x123baa[_0x7719('0x50')]=qs['filters'](_['pick'](_0x2cde1a[_0x7719('0x46')],_0x3dc8c1['filters']));_0x123baa[_0x7719('0x50')][_0x7719('0x65')]=_0x17de2b['id'];if(_0x2cde1a['query']['filter']){_0x123baa['where']=_[_0x7719('0x52')](_0x123baa['where'],{'$or':_[_0x7719('0x41')](_0x123baa[_0x7719('0x4a')],function(_0x530740){var _0xaf9c1f={};_0xaf9c1f[_0x530740]={'$like':'%'+_0x2cde1a[_0x7719('0x46')]['filter']+'%'};return _0xaf9c1f;})});}_0x123baa=_[_0x7719('0x52')]({},_0x123baa,_0x2cde1a['options']);return db[_0x7719('0x6d')][_0x7719('0x31')]({'where':_0x123baa[_0x7719('0x50')]})[_0x7719('0x22')](function(_0xfb2b9){_0x5b54ec[_0x7719('0x31')]=_0xfb2b9;if(_0x2cde1a['query']['includeAll']){_0x123baa[_0x7719('0x58')]=[{'all':!![]}];}return db[_0x7719('0x6d')][_0x7719('0x59')](_0x123baa);})['then'](function(_0x5e017f){_0x5b54ec['rows']=_0x5e017f;return _0x5b54ec;});}})[_0x7719('0x22')](respondWithFilteredResult(_0x2d5182,_0x123baa))['catch'](handleError(_0x2d5182,null));};exports[_0x7719('0x6f')]=function(_0x1d169e,_0x18f0d4,_0x4dff8d){return db[_0x7719('0x42')]['find']({'where':{'id':_0x1d169e[_0x7719('0x5c')]['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x18f0d4,null))['then'](function(_0x81a099){if(_0x81a099){return _0x81a099['removeAnswers'](_0x1d169e['query']['ids']);}})['then'](respondWithStatusCode(_0x18f0d4,null))['catch'](handleError(_0x18f0d4,null));};exports[_0x7719('0x70')]=function(_0x332385,_0x206b65,_0x5c13f6){return db['FaxInteraction'][_0x7719('0x5d')]({'where':{'id':_0x332385['params']['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x206b65,null))['then'](function(_0x2e7b2a){if(_0x2e7b2a){return _0x2e7b2a[_0x7719('0x70')](_0x332385[_0x7719('0x5f')][_0x7719('0x6b')],_[_0x7719('0x71')](_0x332385[_0x7719('0x5f')],[_0x7719('0x6b'),'id'])||{});}})[_0x7719('0x22')](respondWithResult(_0x206b65,null))[_0x7719('0x2a')](handleError(_0x206b65,null));};exports[_0x7719('0x72')]=function(_0x2b80cc,_0x58be7d,_0x33709e){var _0x12b515={'raw':![],'where':{}};var _0x418eca={};var _0x36653e={'count':0x0,'rows':[]};return db[_0x7719('0x42')]['findOne']({'where':{'id':_0x2b80cc[_0x7719('0x5c')]['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x58be7d,null))[_0x7719('0x22')](function(_0x5ca71e){if(_0x5ca71e){_0x418eca['model']=_[_0x7719('0x47')](db['FaxInteraction'][_0x7719('0x68')]);_0x418eca[_0x7719('0x46')]=_['keys'](_0x2b80cc[_0x7719('0x46')]);_0x418eca[_0x7719('0x48')]=_[_0x7719('0x49')](_0x418eca[_0x7719('0x45')],_0x418eca[_0x7719('0x46')]);_0x12b515['attributes']=_[_0x7719('0x49')](_0x418eca[_0x7719('0x45')],qs[_0x7719('0x4b')](_0x2b80cc['query'][_0x7719('0x4b')]));_0x12b515[_0x7719('0x4a')]=_0x12b515[_0x7719('0x4a')][_0x7719('0x4c')]?_0x12b515[_0x7719('0x4a')]:_0x418eca[_0x7719('0x45')];if(!_0x2b80cc[_0x7719('0x46')][_0x7719('0x4d')]('nolimit')){_0x12b515[_0x7719('0x32')]=qs[_0x7719('0x32')](_0x2b80cc[_0x7719('0x46')][_0x7719('0x32')]);_0x12b515[_0x7719('0x2f')]=qs[_0x7719('0x2f')](_0x2b80cc['query'][_0x7719('0x2f')]);}_0x12b515['order']=qs[_0x7719('0x4f')](_0x2b80cc['query'][_0x7719('0x4f')]);_0x12b515[_0x7719('0x50')]=qs[_0x7719('0x48')](_[_0x7719('0x51')](_0x2b80cc[_0x7719('0x46')],_0x418eca['filters']));_0x12b515['where'][_0x7719('0x65')]=_0x5ca71e['id'];if(_0x2b80cc[_0x7719('0x46')][_0x7719('0x55')]){_0x12b515[_0x7719('0x50')]=_[_0x7719('0x52')](_0x12b515[_0x7719('0x50')],{'$or':_[_0x7719('0x41')](_0x12b515[_0x7719('0x4a')],function(_0x2fedc2){var _0xda467d={};_0xda467d[_0x2fedc2]={'$like':'%'+_0x2b80cc[_0x7719('0x46')][_0x7719('0x55')]+'%'};return _0xda467d;})});}_0x12b515=_[_0x7719('0x52')]({},_0x12b515,_0x2b80cc[_0x7719('0x56')]);return db[_0x7719('0x73')][_0x7719('0x31')]({'where':_0x12b515[_0x7719('0x50')]})['then'](function(_0x4dad78){_0x36653e[_0x7719('0x31')]=_0x4dad78;if(_0x2b80cc[_0x7719('0x46')][_0x7719('0x57')]){_0x12b515[_0x7719('0x58')]=[{'model':db['CmContact'],'as':_0x7719('0x74'),'required':![]},{'model':db['User'],'as':_0x7719('0x75'),'attributes':[_0x7719('0x3c'),'fullname',_0x7719('0x76')],'required':![]},{'model':db[_0x7719('0x77')],'as':_0x7719('0x78'),'attributes':['id','name',_0x7719('0x79')],'where':_0x2b80cc[_0x7719('0x46')]['tag']?{'id':_0x2b80cc['query'][_0x7719('0x7a')]}:undefined,'required':_0x2b80cc[_0x7719('0x46')]['tag']?!![]:![]}];}return db[_0x7719('0x73')][_0x7719('0x59')](_0x12b515);})[_0x7719('0x22')](function(_0xc10178){_0x36653e[_0x7719('0x5a')]=_0xc10178;return _0x36653e;});}})[_0x7719('0x22')](respondWithFilteredResult(_0x58be7d,_0x12b515))[_0x7719('0x2a')](handleError(_0x58be7d,null));};exports[_0x7719('0x7b')]=function(_0x208bd6,_0x3335b2,_0x466d9d){return db[_0x7719('0x42')]['findOne']({'where':{'id':_0x208bd6[_0x7719('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3335b2,null))[_0x7719('0x22')](function(_0x42e128){if(_0x42e128){return db[_0x7719('0x7c')][_0x7719('0x7d')](function(_0x18383e){return db[_0x7719('0x7e')]['destroy']({'where':{'FaxAccountId':_0x208bd6[_0x7719('0x5c')]['id']},'transaction':_0x18383e})[_0x7719('0x22')](function(_0x53bc8b){var _0x524949=_[_0x7719('0x41')](_0x208bd6[_0x7719('0x5f')],function(_0x3b6b23){_0x3b6b23['FaxAccountId']=_0x208bd6[_0x7719('0x5c')]['id'];return _0x3b6b23;});return db['FaxApplication']['bulkCreate'](_0x524949,{'transaction':_0x18383e});});})[_0x7719('0x22')](function(){return db[_0x7719('0x7e')][_0x7719('0x7f')]({'where':{'FaxAccountId':_0x208bd6[_0x7719('0x5c')]['id']},'order':'priority'});});}})[_0x7719('0x22')](respondWithResult(_0x3335b2,null))[_0x7719('0x2a')](handleError(_0x3335b2,null));};exports['getApplications']=function(_0x24ee04,_0x2a1951,_0xebd1de){var _0x1e81cc={};var _0xf0e4cf={};var _0x20557d;var _0xbe029f;return db[_0x7719('0x42')][_0x7719('0x80')]({'where':{'id':_0x24ee04[_0x7719('0x5c')]['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x2a1951,null))[_0x7719('0x22')](function(_0x160943){if(_0x160943){_0x20557d=_0x160943;_0xf0e4cf['model']=_['keys'](db['FaxApplication'][_0x7719('0x68')]);_0xf0e4cf[_0x7719('0x46')]=_[_0x7719('0x47')](_0x24ee04[_0x7719('0x46')]);_0xf0e4cf[_0x7719('0x48')]=_['intersection'](_0xf0e4cf[_0x7719('0x45')],_0xf0e4cf['query']);_0x1e81cc[_0x7719('0x4a')]=_['intersection'](_0xf0e4cf['model'],qs['fields'](_0x24ee04[_0x7719('0x46')][_0x7719('0x4b')]));_0x1e81cc['attributes']=_0x1e81cc['attributes'][_0x7719('0x4c')]?_0x1e81cc[_0x7719('0x4a')]:_0xf0e4cf['model'];_0x1e81cc['order']=qs['sort'](_0x24ee04['query'][_0x7719('0x4f')]);_0x1e81cc[_0x7719('0x50')]=qs[_0x7719('0x48')](_[_0x7719('0x51')](_0x24ee04[_0x7719('0x46')],_0xf0e4cf[_0x7719('0x48')]));if(_0x24ee04[_0x7719('0x46')][_0x7719('0x55')]){_0x1e81cc[_0x7719('0x50')]=_['merge'](_0x1e81cc[_0x7719('0x50')],{'$or':_[_0x7719('0x41')](_0x1e81cc[_0x7719('0x4a')],function(_0x2c9c4c){var _0x17a0f5={};_0x17a0f5[_0x2c9c4c]={'$like':'%'+_0x24ee04['query'][_0x7719('0x55')]+'%'};return _0x17a0f5;})});}_0x1e81cc=_[_0x7719('0x52')]({},_0x1e81cc,_0x24ee04[_0x7719('0x56')]);return _0x20557d[_0x7719('0x81')](_0x1e81cc);}})[_0x7719('0x22')](function(_0x192cd4){if(_0x192cd4){_0xbe029f=_0x192cd4[_0x7719('0x4c')];if(!_0x24ee04['query'][_0x7719('0x4d')](_0x7719('0x4e'))){_0x1e81cc['limit']=qs[_0x7719('0x32')](_0x24ee04['query']['limit']);_0x1e81cc[_0x7719('0x2f')]=qs[_0x7719('0x2f')](_0x24ee04['query'][_0x7719('0x2f')]);}return _0x20557d['getApplications'](_0x1e81cc);}})['then'](function(_0x597174){if(_0x597174){return _0x597174?{'count':_0xbe029f,'rows':_0x597174}:null;}})[_0x7719('0x22')](respondWithResult(_0x2a1951,null))[_0x7719('0x2a')](handleError(_0x2a1951,null));};function Extension(_0x1483b9,_0xfafeb7,_0x1470fe,_0x3fd6be){this[_0x7719('0x82')]='from-voip-provider';this[_0x7719('0x83')]=_0x1483b9[_0x7719('0x84')];this[_0x7719('0x85')]=_0x3fd6be;this['type']=_0x7719('0x86');this[_0x7719('0x87')]=_0x7719('0x88');this['FaxAccountId']=_0x1483b9['id'];this[_0x7719('0x89')]=_0xfafeb7;this['appdata']=_0x1470fe;}function createExtensionsReciveFax(_0x34c136){var _0x2b1844=0x1;var _0x3006b2=[];_0x3006b2[_0x7719('0x8a')](new Extension(_0x34c136,_0x2b1844,'','Answer'));_0x2b1844+=0x1;_0x3006b2['push'](new Extension(_0x34c136,_0x2b1844,_0x7719('0x8b'),_0x7719('0x8c')));_0x2b1844+=0x1;for(var _0x521342 in _0x34c136){if(_0x34c136[_0x7719('0x4d')](_0x521342)&&(_0x521342===_0x7719('0x8d')||_0x521342===_0x7719('0x84')||_0x521342==='gateway'||_0x521342===_0x7719('0x8e')||_0x521342==='headerinfo'||_0x521342===_0x7719('0x8f')||_0x521342===_0x7719('0x90')||_0x521342==='modem'||_0x521342===_0x7719('0x91'))){_0x3006b2[_0x7719('0x8a')](new Extension(_0x34c136,_0x2b1844,_0x7719('0x92')+_0x521342+')='+_0x34c136[_0x521342],_0x7719('0x8c')));_0x2b1844+=0x1;}}_0x3006b2[_0x7719('0x8a')](new Extension(_0x34c136,_0x2b1844,'6',_0x7719('0x93')));_0x2b1844+=0x1;_0x3006b2[_0x7719('0x8a')](new Extension(_0x34c136,_0x2b1844,_0x7719('0x94'),_0x7719('0x95')));_0x2b1844=0x0;return _0x3006b2;}exports['addAccountApplications']=function(_0x1f7a09,_0x1531fb,_0x2026e9){var _0x270769;return db[_0x7719('0x7c')]['transaction'](function(_0x1531eb){return db[_0x7719('0x42')]['create'](_0x1f7a09[_0x7719('0x5f')],{'transaction':_0x1531eb})[_0x7719('0x22')](function(_0x573ebb){_0x270769=_0x573ebb[_0x7719('0x38')]({'plain':!![]});return db[_0x7719('0x96')][_0x7719('0x97')](createExtensionsReciveFax(_0x270769),{'transaction':_0x1531eb});});})[_0x7719('0x22')](function(){return _0x270769;})[_0x7719('0x22')](respondWithResult(_0x1531fb,null))[_0x7719('0x2a')](handleError(_0x1531fb,null));};exports[_0x7719('0x98')]=function(_0x40b5c9,_0x40ee9a,_0x5991a2){var _0x5057bf;return db[_0x7719('0x7c')][_0x7719('0x7d')](function(_0x48d658){return db[_0x7719('0x42')][_0x7719('0x36')](_0x40b5c9[_0x7719('0x5f')],{'where':{'id':_0x40b5c9[_0x7719('0x5f')]['id']},'transaction':_0x48d658})['then'](function(_0x66cd39){return db[_0x7719('0x96')][_0x7719('0x37')]({'where':{'FaxAccountId':_0x40b5c9[_0x7719('0x5f')]['id']},'transaction':_0x48d658})[_0x7719('0x22')](function(_0x428bf6){return db[_0x7719('0x96')][_0x7719('0x97')](createExtensionsReciveFax(_[_0x7719('0x71')](_0x40b5c9[_0x7719('0x5f')],[_0x7719('0x99'),_0x7719('0x44'),'createdAt',_0x7719('0x9a'),_0x7719('0x9b'),_0x7719('0x9c')])),{'transaction':_0x48d658});});});})[_0x7719('0x22')](function(){return db[_0x7719('0x42')][_0x7719('0x9d')](_0x40b5c9[_0x7719('0x5f')]['id']);})[_0x7719('0x22')](respondWithResult(_0x40ee9a,null))[_0x7719('0x2a')](handleError(_0x40ee9a,null));};exports['getMessages']=function(_0x18799f,_0x315931,_0x12ba01){var _0x3e2754={'raw':!![],'where':{}};var _0x4ea29d={};var _0x520e1d={'count':0x0,'rows':[]};return db[_0x7719('0x42')][_0x7719('0x80')]({'where':{'id':_0x18799f['params']['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x315931,null))[_0x7719('0x22')](function(_0x34d83b){if(_0x34d83b){_0x4ea29d['model']=_[_0x7719('0x47')](db[_0x7719('0x9e')][_0x7719('0x68')]);_0x4ea29d['query']=_['keys'](_0x18799f[_0x7719('0x46')]);_0x4ea29d[_0x7719('0x48')]=_[_0x7719('0x49')](_0x4ea29d[_0x7719('0x45')],_0x4ea29d[_0x7719('0x46')]);_0x3e2754[_0x7719('0x4a')]=_['intersection'](_0x4ea29d[_0x7719('0x45')],qs[_0x7719('0x4b')](_0x18799f['query'][_0x7719('0x4b')]));_0x3e2754['attributes']=_0x3e2754[_0x7719('0x4a')]['length']?_0x3e2754[_0x7719('0x4a')]:_0x4ea29d[_0x7719('0x45')];if(!_0x18799f[_0x7719('0x46')][_0x7719('0x4d')](_0x7719('0x4e'))){_0x3e2754[_0x7719('0x32')]=qs[_0x7719('0x32')](_0x18799f[_0x7719('0x46')][_0x7719('0x32')]);_0x3e2754[_0x7719('0x2f')]=qs['offset'](_0x18799f[_0x7719('0x46')]['offset']);}_0x3e2754['order']=qs[_0x7719('0x4f')](_0x18799f[_0x7719('0x46')][_0x7719('0x4f')]);_0x3e2754[_0x7719('0x50')]=qs[_0x7719('0x48')](_[_0x7719('0x51')](_0x18799f['query'],_0x4ea29d[_0x7719('0x48')]));_0x3e2754[_0x7719('0x50')][_0x7719('0x65')]=_0x34d83b['id'];if(_0x18799f[_0x7719('0x46')][_0x7719('0x55')]){_0x3e2754[_0x7719('0x50')]=_['merge'](_0x3e2754[_0x7719('0x50')],{'$or':_['map'](_0x3e2754[_0x7719('0x4a')],function(_0x118446){var _0x239fc5={};_0x239fc5[_0x118446]={'$like':'%'+_0x18799f['query']['filter']+'%'};return _0x239fc5;})});}if(_0x18799f[_0x7719('0x46')][_0x7719('0x9f')]){var _0x53d25c=_0x18799f[_0x7719('0x46')][_0x7719('0x9f')][_0x7719('0xa0')](',');var _0x360eee={};_0x360eee[_0x53d25c[0x0]]={'$gte':moment(_0x53d25c[0x1])[_0x7719('0xa1')](_0x7719('0xa2'))};_0x3e2754[_0x7719('0x50')]=_[_0x7719('0x52')](_0x3e2754[_0x7719('0x50')],_0x360eee);}_0x3e2754=_['merge']({},_0x3e2754,_0x18799f[_0x7719('0x56')]);return db['FaxMessage'][_0x7719('0x31')]({'where':_0x3e2754[_0x7719('0x50')]})[_0x7719('0x22')](function(_0xaf96c2){_0x520e1d[_0x7719('0x31')]=_0xaf96c2;if(_0x18799f[_0x7719('0x46')][_0x7719('0x57')]){_0x3e2754[_0x7719('0x58')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3e2754);})['then'](function(_0x3b8f84){_0x520e1d[_0x7719('0x5a')]=_0x3b8f84;return _0x520e1d;});}})['then'](respondWithFilteredResult(_0x315931,_0x3e2754))[_0x7719('0x2a')](handleError(_0x315931,null));};exports[_0x7719('0x3d')]=function(_0x4197c2,_0x359b71,_0x2e53be){var _0x535aff,_0x1be5c6={},_0xfe8b10;if(_0x4197c2[_0x7719('0x5f')]['to']){_0xfe8b10=_0x4197c2[_0x7719('0x5f')]['to'][0x0];}return db[_0x7719('0x42')][_0x7719('0x5d')]({'where':{'id':_0x4197c2[_0x7719('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x7719('0xa3'),'include':[{'model':db[_0x7719('0xa4')],'as':'Contacts','where':{'fax':_0xfe8b10},'limit':0x1,'order':[[_0x7719('0x9a'),_0x7719('0xa5')]]}]}]})[_0x7719('0x22')](handleEntityNotFound(_0x359b71,null))[_0x7719('0x22')](function(_0x407f2b){_0x535aff=_0x407f2b;if(_0x4197c2[_0x7719('0x5f')]['attachments']&&_0x4197c2[_0x7719('0x5f')][_0x7719('0xa6')][_0x7719('0x4c')]){for(var _0x457219=0x0;_0x457219<_0x4197c2[_0x7719('0x5f')][_0x7719('0xa6')]['length'];_0x457219+=0x1){_0x4197c2[_0x7719('0x5f')][_0x7719('0xa6')][_0x457219]={'filename':_0x4197c2[_0x7719('0x5f')][_0x7719('0xa6')][_0x457219][_0x7719('0x3c')],'id':_0x4197c2['body'][_0x7719('0xa6')][_0x457219]['id'],'path':path[_0x7719('0xa7')](config['root'],_0x7719('0xa8'),_0x4197c2['body'][_0x7719('0xa6')][_0x457219][_0x7719('0xa9')])};}}return respondWithRpcPromise(_0x7719('0xaa'),_0x7719('0xaa'),{'FaxAccountId':_[_0x7719('0xab')](_0x4197c2[_0x7719('0x5c')]['id'])?undefined:_0x4197c2[_0x7719('0x5c')]['id'],'path':_['isNil'](_0x4197c2[_0x7719('0x5f')][_0x7719('0xa6')][0x0][_0x7719('0x7')])?undefined:_0x4197c2['body'][_0x7719('0xa6')][0x0]['path'],'fax':_[_0x7719('0xab')](_0x4197c2['body']['to'][0x0])?undefined:_0x4197c2[_0x7719('0x5f')]['to'][0x0]},client9002);})[_0x7719('0x22')](function(){if(_0x535aff){if(_[_0x7719('0xab')](_0x4197c2[_0x7719('0x5f')][_0x7719('0xac')])){_0x4197c2[_0x7719('0x5f')][_0x7719('0xac')]=util[_0x7719('0xa1')](_0x7719('0xad'),_0x535aff[_0x7719('0x3c')],_0x535aff[_0x7719('0xae')]);}if(_0x535aff[_0x7719('0xa3')]){if(_0x535aff[_0x7719('0xa3')]['Contacts'][_0x7719('0x4c')]){return _0x535aff[_0x7719('0xa3')][_0x7719('0xaf')][0x0];}else{return db[_0x7719('0xa4')]['create'](_[_0x7719('0xb0')](_0x4197c2[_0x7719('0x5f')],{'firstName':_0x4197c2[_0x7719('0x5f')]['to'][0x0],'phone':_0x4197c2['body']['to'][0x0],'fax':_0x4197c2['body']['to'][0x0],'ListId':_0x535aff[_0x7719('0x9c')]}));}}else{throw new Error(_0x7719('0xb1'));}}else{throw new Error(_0x7719('0xb2'));}})[_0x7719('0x22')](function(_0x47c087){if(_0x47c087){return db['FaxInteraction'][_0x7719('0x5d')]({'where':{'ContactId':_0x47c087['id'],'closed':![],'FaxAccountId':_0x535aff['id']}})['then'](function(_0x1aaaee){if(_0x1aaaee){return[_0x1aaaee,![]];}return db[_0x7719('0x73')][_0x7719('0x5e')]({'UserId':_0x4197c2[_0x7719('0x60')]['id'],'ContactId':_0x47c087['id'],'FaxAccountId':_0x535aff['id'],'fax':_0x4197c2[_0x7719('0x5f')]['to'][0x0],'firstMsgDirection':_0x7719('0xb3'),'Messages':[_[_0x7719('0x52')](_0x4197c2['body'],{'read':![],'body':_0x4197c2['body'][_0x7719('0xa6')][0x0][_0x7719('0xb4')],'FaxAccountId':_0x535aff['id'],'UserId':_0x4197c2[_0x7719('0x60')]['id'],'ContactId':_0x47c087['id'],'AttachmentId':_0x4197c2[_0x7719('0x5f')][_0x7719('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x7719('0x9e')],'as':_0x7719('0xb5')}]})[_0x7719('0x22')](function(_0x35ad3e){return[_0x35ad3e,!![]];});});}else{throw new Error(_0x7719('0xb6'));}})[_0x7719('0xb7')](function(_0x2c71df,_0x3a7849){if(_0x3a7849){return _0x2c71df;}return db['FaxMessage'][_0x7719('0x5e')]({'direction':_0x7719('0xb3'),'read':![],'body':_0x4197c2['body'][_0x7719('0xa6')][0x0][_0x7719('0xb4')],'FaxAccountId':_0x535aff['id'],'FaxInteractionId':_0x2c71df['id'],'UserId':_0x4197c2['user']['id'],'ContactId':_0x2c71df['ContactId'],'AttachmentId':_0x4197c2[_0x7719('0x5f')]['attachments'][0x0]['id']})[_0x7719('0x22')](function(_0x571b58){_0x2c71df[_0x7719('0xb8')][_0x7719('0xb5')]=[];_0x2c71df[_0x7719('0xb8')][_0x7719('0xb5')][_0x7719('0x8a')](_0x571b58[_0x7719('0xb8')]);return _0x2c71df;});})[_0x7719('0x22')](function(_0x49637d){respondWithRpcPromise('SendFax',_0x7719('0xb9'),{'FaxAccountId':_['isNil'](_0x4197c2[_0x7719('0x5c')]['id'])?undefined:_0x4197c2[_0x7719('0x5c')]['id'],'path':_[_0x7719('0xab')](_0x4197c2['body'][_0x7719('0xa6')][0x0]['path'])?undefined:_0x4197c2['body']['attachments'][0x0][_0x7719('0x7')],'fax':_[_0x7719('0xab')](_0x4197c2[_0x7719('0x5f')]['to'][0x0])?undefined:_0x4197c2[_0x7719('0x5f')]['to'][0x0],'AttachmentId':_0x4197c2[_0x7719('0x5f')][_0x7719('0xa6')][0x0]['id']},client9002)[_0x7719('0x22')](function(_0x2d48d9){logger[_0x7719('0x29')](_0x7719('0xba'),_0x2d48d9);})[_0x7719('0x2a')](function(_0x1f25aa){logger[_0x7719('0x29')](_0x7719('0xba'),_0x1f25aa);});return _0x49637d;})[_0x7719('0x22')](respondWithResult(_0x359b71,null))[_0x7719('0x2a')](handleError(_0x359b71,null));};exports[_0x7719('0xbb')]=function(_0x125f59,_0x44a212,_0x4b8c5f){return db[_0x7719('0x42')][_0x7719('0x5d')]({'where':{'id':_0x125f59[_0x7719('0x5c')]['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x44a212,null))[_0x7719('0x22')](function(_0x2170f3){if(_0x2170f3){return _0x2170f3[_0x7719('0xbb')](_0x125f59['body'][_0x7719('0x6b')],_[_0x7719('0x71')](_0x125f59[_0x7719('0x5f')],['ids','id'])||{})[_0x7719('0xb7')](function(_0xac96e3){for(var _0xb3cbc1=0x0;_0xb3cbc1<_0x125f59[_0x7719('0x5f')][_0x7719('0x6b')][_0x7719('0x4c')];_0xb3cbc1+=0x1){socket['emit'](_0x7719('0xbc'),{'UserId':Number(_0x125f59[_0x7719('0x5f')][_0x7719('0x6b')][_0xb3cbc1]),'FaxAccountId':Number(_0x125f59[_0x7719('0x5c')]['id'])});}return _0xac96e3;});}})[_0x7719('0x22')](respondWithResult(_0x44a212,null))[_0x7719('0x2a')](handleError(_0x44a212,null));};exports[_0x7719('0xbd')]=function(_0x2670ed,_0x2cbbfd,_0x3449d8){return db[_0x7719('0x42')]['find']({'where':{'id':_0x2670ed[_0x7719('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2cbbfd,null))[_0x7719('0x22')](function(_0x38b983){if(_0x38b983){return _0x38b983[_0x7719('0xbd')](_0x2670ed[_0x7719('0x46')][_0x7719('0x6b')])[_0x7719('0x22')](function(){if(_[_0x7719('0xbe')](_0x2670ed[_0x7719('0x46')]['ids'])){for(var _0x5bcf11=0x0;_0x5bcf11<_0x2670ed[_0x7719('0x46')]['ids'][_0x7719('0x4c')];_0x5bcf11+=0x1){socket[_0x7719('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x2670ed[_0x7719('0x46')]['ids'][_0x5bcf11]),'FaxAccountId':Number(_0x2670ed[_0x7719('0x5c')]['id'])});}}else{socket[_0x7719('0xbf')](_0x7719('0xc0'),{'UserId':Number(_0x2670ed[_0x7719('0x46')][_0x7719('0x6b')]),'FaxAccountId':Number(_0x2670ed['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2cbbfd,null))[_0x7719('0x2a')](handleError(_0x2cbbfd,null));};exports['getAgents']=function(_0x4a1975,_0x3ee7cd,_0x153dfd){var _0x4af9d3={};var _0x167bbb={};var _0x1c802f;var _0x2b8bc5;return db['FaxAccount'][_0x7719('0x80')]({'where':{'id':_0x4a1975['params']['id']}})[_0x7719('0x22')](handleEntityNotFound(_0x3ee7cd,null))['then'](function(_0x4923c3){if(_0x4923c3){_0x1c802f=_0x4923c3;_0x167bbb['model']=_[_0x7719('0x47')](db[_0x7719('0xc1')]['rawAttributes']);_0x167bbb[_0x7719('0x46')]=_[_0x7719('0x47')](_0x4a1975[_0x7719('0x46')]);_0x167bbb['filters']=_[_0x7719('0x49')](_0x167bbb['model'],_0x167bbb['query']);_0x4af9d3[_0x7719('0x4a')]=_[_0x7719('0x49')](_0x167bbb[_0x7719('0x45')],qs[_0x7719('0x4b')](_0x4a1975[_0x7719('0x46')][_0x7719('0x4b')]));_0x4af9d3['attributes']=_0x4af9d3[_0x7719('0x4a')][_0x7719('0x4c')]?_0x4af9d3[_0x7719('0x4a')]:_0x167bbb['model'];_0x4af9d3[_0x7719('0x69')]=qs[_0x7719('0x4f')](_0x4a1975[_0x7719('0x46')][_0x7719('0x4f')]);_0x4af9d3[_0x7719('0x50')]=qs[_0x7719('0x48')](_[_0x7719('0x51')](_0x4a1975[_0x7719('0x46')],_0x167bbb[_0x7719('0x48')]));if(_0x4a1975[_0x7719('0x46')][_0x7719('0x55')]){_0x4af9d3[_0x7719('0x50')]=_[_0x7719('0x52')](_0x4af9d3[_0x7719('0x50')],{'$or':_[_0x7719('0x41')](_0x4af9d3['attributes'],function(_0x1e7640){var _0x4d35ec={};_0x4d35ec[_0x1e7640]={'$like':'%'+_0x4a1975['query']['filter']+'%'};return _0x4d35ec;})});}_0x4af9d3=_[_0x7719('0x52')]({},_0x4af9d3,_0x4a1975[_0x7719('0x56')]);return _0x1c802f[_0x7719('0xc2')](_0x4af9d3);}})['then'](function(_0x21db10){if(_0x21db10){_0x2b8bc5=_0x21db10[_0x7719('0x4c')];if(!_0x4a1975[_0x7719('0x46')][_0x7719('0x4d')](_0x7719('0x4e'))){_0x4af9d3[_0x7719('0x32')]=qs[_0x7719('0x32')](_0x4a1975['query'][_0x7719('0x32')]);_0x4af9d3[_0x7719('0x2f')]=qs['offset'](_0x4a1975[_0x7719('0x46')]['offset']);}return _0x1c802f['getAgents'](_0x4af9d3);}})[_0x7719('0x22')](function(_0x3aabca){if(_0x3aabca){return _0x3aabca?{'count':_0x2b8bc5,'rows':_0x3aabca}:null;}})[_0x7719('0x22')](respondWithResult(_0x3ee7cd,null))[_0x7719('0x2a')](handleError(_0x3ee7cd,null));}; \ No newline at end of file +var _0xe278=['removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','Owner','internal','Tag','color','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','sequelize','update','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','count','limit','Content-Range','reject','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','Pause','model','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','filter','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer'];(function(_0x2c0d34,_0x5abdc3){var _0x2d67a3=function(_0x3bb8fe){while(--_0x3bb8fe){_0x2c0d34['push'](_0x2c0d34['shift']());}};_0x2d67a3(++_0x5abdc3);}(_0xe278,0x11e));var _0x8e27=function(_0x4fac91,_0x58f2dd){_0x4fac91=_0x4fac91-0x0;var _0x207fc8=_0xe278[_0x4fac91];return _0x207fc8;};'use strict';var emlformat=require(_0x8e27('0x0'));var rimraf=require(_0x8e27('0x1'));var zipdir=require(_0x8e27('0x2'));var jsonpatch=require(_0x8e27('0x3'));var rp=require(_0x8e27('0x4'));var moment=require(_0x8e27('0x5'));var BPromise=require(_0x8e27('0x6'));var Mustache=require(_0x8e27('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8e27('0x8'));var csv=require(_0x8e27('0x9'));var ejs=require(_0x8e27('0xa'));var fs=require('fs');var fs_extra=require(_0x8e27('0xb'));var _=require(_0x8e27('0xc'));var squel=require('squel');var crypto=require(_0x8e27('0xd'));var jsforce=require(_0x8e27('0xe'));var deskjs=require(_0x8e27('0xf'));var toCsv=require(_0x8e27('0x9'));var querystring=require(_0x8e27('0x10'));var Papa=require('papaparse');var Redis=require(_0x8e27('0x11'));var authService=require(_0x8e27('0x12'));var qs=require(_0x8e27('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e27('0x14'))(_0x8e27('0x15'));var utils=require(_0x8e27('0x16'));var config=require(_0x8e27('0x17'));var licenseUtil=require(_0x8e27('0x18'));var db=require(_0x8e27('0x19'))['db'];config['redis']=_[_0x8e27('0x1a')](config[_0x8e27('0x1b')],{'host':_0x8e27('0x1c'),'port':0x18eb});var socket=require(_0x8e27('0x1d'))(new Redis(config['redis']));require(_0x8e27('0x1e'))[_0x8e27('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8e27('0x20')][_0x8e27('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x8e27('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x25584c,_0xadc91f,_0x1b93a1,_0x45013c){return new BPromise(function(_0x232a9a,_0x1b1df0){var _0x58914a=_0x45013c||client;return _0x58914a[_0x8e27('0x22')](_0x25584c,_0x1b93a1)[_0x8e27('0x23')](function(_0x3db0ab){logger[_0x8e27('0x24')](_0x8e27('0x25'),_0xadc91f,'request\x20sent');logger[_0x8e27('0x26')](_0x8e27('0x27'),_0xadc91f,'request\x20sent',JSON['stringify'](_0x3db0ab));if(_0x3db0ab['error']){if(_0x3db0ab[_0x8e27('0x28')][_0x8e27('0x29')]===0x1f4){logger[_0x8e27('0x28')](_0x8e27('0x25'),_0xadc91f,_0x3db0ab[_0x8e27('0x28')]['message']);return _0x1b1df0(_0x3db0ab['error'][_0x8e27('0x2a')]);}logger[_0x8e27('0x28')]('FaxAccount,\x20%s,\x20%s',_0xadc91f,_0x3db0ab[_0x8e27('0x28')][_0x8e27('0x2a')]);return _0x232a9a(_0x3db0ab[_0x8e27('0x28')][_0x8e27('0x2a')]);}else{logger['info'](_0x8e27('0x25'),_0xadc91f,_0x8e27('0x2b'));_0x232a9a(_0x3db0ab[_0x8e27('0x2c')]['message']);}})[_0x8e27('0x2d')](function(_0x2d289f){logger['error'](_0x8e27('0x25'),_0xadc91f,_0x2d289f);_0x1b1df0(_0x2d289f);});});}function respondWithStatusCode(_0x258b15,_0x160b6a){_0x160b6a=_0x160b6a||0xcc;return function(_0x267a4e){if(_0x267a4e){return _0x258b15[_0x8e27('0x2e')](_0x160b6a);}return _0x258b15[_0x8e27('0x2f')](_0x160b6a)[_0x8e27('0x30')]();};}function respondWithResult(_0x5b4846,_0x293266){_0x293266=_0x293266||0xc8;return function(_0x12a8d8){if(_0x12a8d8){return _0x5b4846[_0x8e27('0x2f')](_0x293266)[_0x8e27('0x31')](_0x12a8d8);}};}function respondWithFilteredResult(_0x524a71,_0x118082){return function(_0x139b06){if(_0x139b06){var _0x5310ae=typeof _0x118082[_0x8e27('0x32')]==='undefined'&&typeof _0x118082['limit']==='undefined';var _0x14f6d9=_0x139b06[_0x8e27('0x33')];var _0x27b0c7=_0x5310ae?0x0:_0x118082['offset'];var _0x5581ab=_0x5310ae?_0x139b06[_0x8e27('0x33')]:_0x118082[_0x8e27('0x32')]+_0x118082[_0x8e27('0x34')];var _0x3ba577;if(_0x5581ab>=_0x14f6d9){_0x5581ab=_0x14f6d9;_0x3ba577=0xc8;}else{_0x3ba577=0xce;}_0x524a71[_0x8e27('0x2f')](_0x3ba577);return _0x524a71['set'](_0x8e27('0x35'),_0x27b0c7+'-'+_0x5581ab+'/'+_0x14f6d9)['json'](_0x139b06);}return null;};}function patchUpdates(_0x4088f5){return function(_0x5454eb){try{jsonpatch['apply'](_0x5454eb,_0x4088f5,!![]);}catch(_0x2a1ee7){return BPromise[_0x8e27('0x36')](_0x2a1ee7);}return _0x5454eb['save']();};}function saveUpdates(_0x118fd3,_0x576e8c){return function(_0x1bdf55){if(_0x1bdf55){return _0x1bdf55['update'](_0x118fd3)[_0x8e27('0x23')](function(_0x1580d5){return _0x1580d5;});}return null;};}function removeEntity(_0x369c84,_0x1abc44){return function(_0x3be64e){if(_0x3be64e){return _0x3be64e['destroy']()[_0x8e27('0x23')](function(){var _0xc48fcd=_0x3be64e['get']({'plain':!![]});var _0x137a1c='FaxAccounts';return db[_0x8e27('0x37')][_0x8e27('0x38')]({'where':{'type':_0x137a1c,'resourceId':_0xc48fcd['id']}})['then'](function(){return _0x3be64e;});})[_0x8e27('0x23')](function(){_0x369c84['status'](0xcc)[_0x8e27('0x30')]();});}};}function handleEntityNotFound(_0x333a20,_0x372090){return function(_0x106865){if(!_0x106865){_0x333a20[_0x8e27('0x2e')](0x194);}return _0x106865;};}function handleError(_0x237005,_0x30ec20){_0x30ec20=_0x30ec20||0x1f4;return function(_0x391e6a){logger[_0x8e27('0x28')](_0x391e6a[_0x8e27('0x39')]);if(_0x391e6a['name']){delete _0x391e6a[_0x8e27('0x3a')];}_0x237005[_0x8e27('0x2f')](_0x30ec20)[_0x8e27('0x3b')](_0x391e6a);};}exports[_0x8e27('0x3c')]=function(_0x19aaae,_0x4f97b8){var _0x3876bf={'include':[{'model':db['Pause'],'as':_0x8e27('0x3d')}]},_0x1c38a3={},_0x583774={'count':0x0,'rows':[]};var _0x28496c=_[_0x8e27('0x3e')](db[_0x8e27('0x3f')][_0x8e27('0x40')],function(_0xd182a8){return{'name':_0xd182a8[_0x8e27('0x41')],'type':_0xd182a8[_0x8e27('0x42')][_0x8e27('0x43')]};});_0x1c38a3['model']=_[_0x8e27('0x3e')](_0x28496c,'name');_0x1c38a3[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x19aaae[_0x8e27('0x44')]);_0x1c38a3[_0x8e27('0x46')]=_[_0x8e27('0x47')](_0x1c38a3['model'],_0x1c38a3[_0x8e27('0x44')]);_0x3876bf[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x1c38a3['model'],qs[_0x8e27('0x49')](_0x19aaae[_0x8e27('0x44')]['fields']));_0x3876bf[_0x8e27('0x48')]=_0x3876bf['attributes'][_0x8e27('0x4a')]?_0x3876bf['attributes']:_0x1c38a3['model'];if(!_0x19aaae[_0x8e27('0x44')][_0x8e27('0x4b')](_0x8e27('0x4c'))){_0x3876bf['limit']=qs[_0x8e27('0x34')](_0x19aaae[_0x8e27('0x44')]['limit']);_0x3876bf[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x19aaae[_0x8e27('0x44')][_0x8e27('0x32')]);}_0x3876bf[_0x8e27('0x4d')]=qs[_0x8e27('0x4e')](_0x19aaae[_0x8e27('0x44')][_0x8e27('0x4e')]);_0x3876bf[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x19aaae[_0x8e27('0x44')],_0x1c38a3['filters']),_0x28496c);if(_0x19aaae[_0x8e27('0x44')]['filter']){_0x3876bf[_0x8e27('0x4f')]=_[_0x8e27('0x51')](_0x3876bf[_0x8e27('0x4f')],{'$or':_['map'](_0x28496c,function(_0x4fe36c){if(_0x4fe36c[_0x8e27('0x42')]!==_0x8e27('0x52')){var _0x2ee5de={};_0x2ee5de[_0x4fe36c[_0x8e27('0x3a')]]={'$like':'%'+_0x19aaae[_0x8e27('0x44')]['filter']+'%'};return _0x2ee5de;}})});}_0x3876bf=_['merge']({},_0x3876bf,_0x19aaae[_0x8e27('0x53')]);var _0x3e1dc2={'where':_0x3876bf[_0x8e27('0x4f')]};return db[_0x8e27('0x3f')][_0x8e27('0x33')](_0x3e1dc2)[_0x8e27('0x23')](function(_0x2eacbd){_0x583774[_0x8e27('0x33')]=_0x2eacbd;if(_0x19aaae[_0x8e27('0x44')][_0x8e27('0x54')]){_0x3876bf[_0x8e27('0x55')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x3876bf);})[_0x8e27('0x23')](function(_0x61a80b){_0x583774[_0x8e27('0x56')]=_0x61a80b;return _0x583774;})[_0x8e27('0x23')](respondWithFilteredResult(_0x4f97b8,_0x3876bf))[_0x8e27('0x2d')](handleError(_0x4f97b8,null));};exports[_0x8e27('0x57')]=function(_0x2c4042,_0x103c66){var _0x965fa4={'raw':![],'where':{'id':_0x2c4042[_0x8e27('0x58')]['id']},'include':[{'model':db[_0x8e27('0x59')],'as':_0x8e27('0x3d')}]},_0x43bb2d={};_0x43bb2d[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db[_0x8e27('0x3f')]['rawAttributes']);_0x43bb2d[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x2c4042[_0x8e27('0x44')]);_0x43bb2d['filters']=_[_0x8e27('0x47')](_0x43bb2d['model'],_0x43bb2d['query']);_0x965fa4[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x43bb2d[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x2c4042['query']['fields']));_0x965fa4[_0x8e27('0x48')]=_0x965fa4[_0x8e27('0x48')]['length']?_0x965fa4[_0x8e27('0x48')]:_0x43bb2d[_0x8e27('0x5a')];if(_0x2c4042[_0x8e27('0x44')][_0x8e27('0x54')]){_0x965fa4['include']=[{'all':!![]}];}_0x965fa4=_['merge']({},_0x965fa4,_0x2c4042[_0x8e27('0x53')]);return db[_0x8e27('0x3f')][_0x8e27('0x5b')](_0x965fa4)[_0x8e27('0x23')](handleEntityNotFound(_0x103c66,null))[_0x8e27('0x23')](respondWithResult(_0x103c66,null))[_0x8e27('0x2d')](handleError(_0x103c66,null));};exports[_0x8e27('0x5c')]=function(_0x108af2,_0x433ee6){return db[_0x8e27('0x3f')]['create'](_0x108af2[_0x8e27('0x5d')],{})['then'](function(_0x479949){var _0x359071=_0x108af2[_0x8e27('0x5e')][_0x8e27('0x5f')]({'plain':!![]});if(!_0x359071)throw new Error(_0x8e27('0x60'));if(_0x359071[_0x8e27('0x61')]===_0x8e27('0x5e')){var _0x42a6d1=_0x479949[_0x8e27('0x5f')]({'plain':!![]});var _0xed097a='FaxAccounts';return db[_0x8e27('0x62')][_0x8e27('0x5b')]({'where':{'name':_0xed097a,'userProfileId':_0x359071[_0x8e27('0x63')]},'raw':!![]})[_0x8e27('0x23')](function(_0x24c2c6){if(_0x24c2c6&&_0x24c2c6[_0x8e27('0x64')]===0x0){return db[_0x8e27('0x37')][_0x8e27('0x5c')]({'name':_0x42a6d1[_0x8e27('0x3a')],'resourceId':_0x42a6d1['id'],'type':_0x24c2c6[_0x8e27('0x3a')],'sectionId':_0x24c2c6['id']},{})[_0x8e27('0x23')](function(){return _0x479949;});}else{return _0x479949;}})[_0x8e27('0x2d')](function(_0x1f8132){logger[_0x8e27('0x28')](_0x8e27('0x65'),_0x1f8132);throw _0x1f8132;});}return _0x479949;})[_0x8e27('0x23')](respondWithResult(_0x433ee6,0xc9))[_0x8e27('0x2d')](handleError(_0x433ee6,null));};exports['update']=function(_0x3d0cdd,_0x1fd36e){if(_0x3d0cdd[_0x8e27('0x5d')]['id']){delete _0x3d0cdd[_0x8e27('0x5d')]['id'];}return db['FaxAccount'][_0x8e27('0x5b')]({'where':{'id':_0x3d0cdd['params']['id']},'include':[{'model':db['Pause'],'as':_0x8e27('0x3d')}]})[_0x8e27('0x23')](handleEntityNotFound(_0x1fd36e,null))[_0x8e27('0x23')](saveUpdates(_0x3d0cdd[_0x8e27('0x5d')],null))['then'](respondWithResult(_0x1fd36e,null))[_0x8e27('0x2d')](handleError(_0x1fd36e,null));};exports[_0x8e27('0x38')]=function(_0x7e9920,_0x122d8d){return db['FaxAccount'][_0x8e27('0x5b')]({'where':{'id':_0x7e9920['params']['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x122d8d,null))[_0x8e27('0x23')](removeEntity(_0x122d8d,null))[_0x8e27('0x2d')](handleError(_0x122d8d,null));};exports[_0x8e27('0x66')]=function(_0x39c10f,_0x1f47f0){return db[_0x8e27('0x3f')][_0x8e27('0x66')]()[_0x8e27('0x23')](respondWithResult(_0x1f47f0,null))[_0x8e27('0x2d')](handleError(_0x1f47f0,null));};exports[_0x8e27('0x67')]=function(_0x2fe17d,_0x500889,_0x5b8982){if(_0x2fe17d['body']['id']){delete _0x2fe17d[_0x8e27('0x5d')]['id'];}return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0x2fe17d[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x500889,null))[_0x8e27('0x23')](function(_0x4ab49c){if(_0x4ab49c){_0x2fe17d[_0x8e27('0x5d')][_0x8e27('0x68')]=_0x4ab49c['id'];return db[_0x8e27('0x69')][_0x8e27('0x5c')](_0x2fe17d[_0x8e27('0x5d')]);}})['then'](respondWithResult(_0x500889,null))[_0x8e27('0x2d')](handleError(_0x500889,null));};exports['getDispositions']=function(_0x427679,_0x4fc63f,_0x32ba6c){var _0x1c3247={'raw':![],'where':{}};var _0x3904a2={};var _0x1f9d1e={'count':0x0,'rows':[]};return db[_0x8e27('0x3f')][_0x8e27('0x6a')]({'where':{'id':_0x427679[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x4fc63f,null))['then'](function(_0x44c144){if(_0x44c144){_0x3904a2[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db[_0x8e27('0x69')][_0x8e27('0x40')]);_0x3904a2[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x427679[_0x8e27('0x44')]);_0x3904a2['filters']=_[_0x8e27('0x47')](_0x3904a2[_0x8e27('0x5a')],_0x3904a2['query']);_0x1c3247[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x3904a2[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x427679['query'][_0x8e27('0x49')]));_0x1c3247[_0x8e27('0x48')]=_0x1c3247[_0x8e27('0x48')][_0x8e27('0x4a')]?_0x1c3247[_0x8e27('0x48')]:_0x3904a2[_0x8e27('0x5a')];if(!_0x427679[_0x8e27('0x44')][_0x8e27('0x4b')](_0x8e27('0x4c'))){_0x1c3247['limit']=qs['limit'](_0x427679['query'][_0x8e27('0x34')]);_0x1c3247[_0x8e27('0x32')]=qs['offset'](_0x427679[_0x8e27('0x44')]['offset']);}_0x1c3247['order']=qs['sort'](_0x427679[_0x8e27('0x44')][_0x8e27('0x4e')]);_0x1c3247[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x427679[_0x8e27('0x44')],_0x3904a2[_0x8e27('0x46')]));_0x1c3247[_0x8e27('0x4f')]['FaxAccountId']=_0x44c144['id'];if(_0x427679[_0x8e27('0x44')]['filter']){_0x1c3247[_0x8e27('0x4f')]=_[_0x8e27('0x51')](_0x1c3247[_0x8e27('0x4f')],{'$or':_['map'](_0x1c3247['attributes'],function(_0x1df5f6){var _0x3261d7={};_0x3261d7[_0x1df5f6]={'$like':'%'+_0x427679[_0x8e27('0x44')][_0x8e27('0x6b')]+'%'};return _0x3261d7;})});}_0x1c3247=_[_0x8e27('0x51')]({},_0x1c3247,_0x427679['options']);return db[_0x8e27('0x69')][_0x8e27('0x33')]({'where':_0x1c3247['where']})[_0x8e27('0x23')](function(_0x1816b7){_0x1f9d1e[_0x8e27('0x33')]=_0x1816b7;if(_0x427679[_0x8e27('0x44')][_0x8e27('0x54')]){_0x1c3247[_0x8e27('0x55')]=[{'all':!![]}];}return db[_0x8e27('0x69')][_0x8e27('0x6c')](_0x1c3247);})['then'](function(_0x2c6fdf){_0x1f9d1e[_0x8e27('0x56')]=_0x2c6fdf;return _0x1f9d1e;});}})['then'](respondWithFilteredResult(_0x4fc63f,_0x1c3247))[_0x8e27('0x2d')](handleError(_0x4fc63f,null));};exports[_0x8e27('0x6d')]=function(_0x580efe,_0x285448,_0x4ec6b4){return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0x580efe[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x285448,null))['then'](function(_0x25df19){if(_0x25df19){return _0x25df19[_0x8e27('0x6d')](_0x580efe[_0x8e27('0x44')][_0x8e27('0x6e')]);}})['then'](respondWithStatusCode(_0x285448,null))[_0x8e27('0x2d')](handleError(_0x285448,null));};exports[_0x8e27('0x6f')]=function(_0x36c537,_0x1e81c7,_0x92d925){if(_0x36c537['body']['id']){delete _0x36c537['body']['id'];}return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0x36c537[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e81c7,null))['then'](function(_0x211ef9){if(_0x211ef9){_0x36c537[_0x8e27('0x5d')][_0x8e27('0x68')]=_0x211ef9['id'];return db['CannedAnswer'][_0x8e27('0x5c')](_0x36c537['body']);}})[_0x8e27('0x23')](respondWithResult(_0x1e81c7,null))['catch'](handleError(_0x1e81c7,null));};exports[_0x8e27('0x70')]=function(_0x54c7d7,_0x1c9249,_0x34e8ec){var _0x2a41f4={'raw':![],'where':{}};var _0x466dd2={};var _0x1ae13e={'count':0x0,'rows':[]};return db[_0x8e27('0x3f')][_0x8e27('0x6a')]({'where':{'id':_0x54c7d7['params']['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x1c9249,null))['then'](function(_0x52bfd9){if(_0x52bfd9){_0x466dd2['model']=_['keys'](db[_0x8e27('0x71')][_0x8e27('0x40')]);_0x466dd2[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x54c7d7['query']);_0x466dd2[_0x8e27('0x46')]=_['intersection'](_0x466dd2[_0x8e27('0x5a')],_0x466dd2[_0x8e27('0x44')]);_0x2a41f4[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x466dd2['model'],qs['fields'](_0x54c7d7[_0x8e27('0x44')]['fields']));_0x2a41f4[_0x8e27('0x48')]=_0x2a41f4[_0x8e27('0x48')][_0x8e27('0x4a')]?_0x2a41f4['attributes']:_0x466dd2[_0x8e27('0x5a')];if(!_0x54c7d7[_0x8e27('0x44')]['hasOwnProperty'](_0x8e27('0x4c'))){_0x2a41f4['limit']=qs[_0x8e27('0x34')](_0x54c7d7[_0x8e27('0x44')][_0x8e27('0x34')]);_0x2a41f4[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x54c7d7[_0x8e27('0x44')][_0x8e27('0x32')]);}_0x2a41f4[_0x8e27('0x4d')]=qs[_0x8e27('0x4e')](_0x54c7d7[_0x8e27('0x44')]['sort']);_0x2a41f4[_0x8e27('0x4f')]=qs['filters'](_[_0x8e27('0x50')](_0x54c7d7['query'],_0x466dd2[_0x8e27('0x46')]));_0x2a41f4['where'][_0x8e27('0x68')]=_0x52bfd9['id'];if(_0x54c7d7[_0x8e27('0x44')][_0x8e27('0x6b')]){_0x2a41f4['where']=_[_0x8e27('0x51')](_0x2a41f4[_0x8e27('0x4f')],{'$or':_[_0x8e27('0x3e')](_0x2a41f4['attributes'],function(_0x51154b){var _0x21eb6f={};_0x21eb6f[_0x51154b]={'$like':'%'+_0x54c7d7[_0x8e27('0x44')]['filter']+'%'};return _0x21eb6f;})});}_0x2a41f4=_['merge']({},_0x2a41f4,_0x54c7d7[_0x8e27('0x53')]);return db[_0x8e27('0x71')][_0x8e27('0x33')]({'where':_0x2a41f4[_0x8e27('0x4f')]})[_0x8e27('0x23')](function(_0x47e38e){_0x1ae13e[_0x8e27('0x33')]=_0x47e38e;if(_0x54c7d7[_0x8e27('0x44')]['includeAll']){_0x2a41f4[_0x8e27('0x55')]=[{'all':!![]}];}return db[_0x8e27('0x71')]['findAll'](_0x2a41f4);})[_0x8e27('0x23')](function(_0xb0e52f){_0x1ae13e[_0x8e27('0x56')]=_0xb0e52f;return _0x1ae13e;});}})[_0x8e27('0x23')](respondWithFilteredResult(_0x1c9249,_0x2a41f4))['catch'](handleError(_0x1c9249,null));};exports[_0x8e27('0x72')]=function(_0xb70bb7,_0x1734a5,_0x324b59){return db[_0x8e27('0x3f')]['find']({'where':{'id':_0xb70bb7[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x1734a5,null))[_0x8e27('0x23')](function(_0x59f204){if(_0x59f204){return _0x59f204[_0x8e27('0x72')](_0xb70bb7[_0x8e27('0x44')][_0x8e27('0x6e')]);}})[_0x8e27('0x23')](respondWithStatusCode(_0x1734a5,null))[_0x8e27('0x2d')](handleError(_0x1734a5,null));};exports[_0x8e27('0x73')]=function(_0xb9b4f,_0x4f5d0d,_0x301757){return db[_0x8e27('0x74')][_0x8e27('0x5b')]({'where':{'id':_0xb9b4f[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x4f5d0d,null))[_0x8e27('0x23')](function(_0x5f3bd1){if(_0x5f3bd1){return _0x5f3bd1[_0x8e27('0x73')](_0xb9b4f[_0x8e27('0x5d')]['ids'],_[_0x8e27('0x75')](_0xb9b4f[_0x8e27('0x5d')],['ids','id'])||{});}})[_0x8e27('0x23')](respondWithResult(_0x4f5d0d,null))[_0x8e27('0x2d')](handleError(_0x4f5d0d,null));};exports[_0x8e27('0x76')]=function(_0x300589,_0x4c5ad8,_0x11e751){var _0x470a55={'raw':![],'where':{}};var _0x5a05df={};var _0x10b73d={'count':0x0,'rows':[]};return db[_0x8e27('0x3f')]['findOne']({'where':{'id':_0x300589['params']['id']}})['then'](handleEntityNotFound(_0x4c5ad8,null))[_0x8e27('0x23')](function(_0x4139d6){if(_0x4139d6){_0x5a05df[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db[_0x8e27('0x74')]['rawAttributes']);_0x5a05df['query']=_[_0x8e27('0x45')](_0x300589['query']);_0x5a05df[_0x8e27('0x46')]=_[_0x8e27('0x47')](_0x5a05df[_0x8e27('0x5a')],_0x5a05df[_0x8e27('0x44')]);_0x470a55[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x5a05df[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x300589[_0x8e27('0x44')]['fields']));_0x470a55['attributes']=_0x470a55[_0x8e27('0x48')][_0x8e27('0x4a')]?_0x470a55[_0x8e27('0x48')]:_0x5a05df[_0x8e27('0x5a')];if(!_0x300589[_0x8e27('0x44')]['hasOwnProperty']('nolimit')){_0x470a55[_0x8e27('0x34')]=qs['limit'](_0x300589[_0x8e27('0x44')][_0x8e27('0x34')]);_0x470a55['offset']=qs['offset'](_0x300589[_0x8e27('0x44')][_0x8e27('0x32')]);}_0x470a55[_0x8e27('0x4d')]=qs[_0x8e27('0x4e')](_0x300589['query'][_0x8e27('0x4e')]);_0x470a55[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x300589['query'],_0x5a05df[_0x8e27('0x46')]));_0x470a55['where']['FaxAccountId']=_0x4139d6['id'];if(_0x300589[_0x8e27('0x44')]['filter']){_0x470a55['where']=_['merge'](_0x470a55['where'],{'$or':_['map'](_0x470a55[_0x8e27('0x48')],function(_0x52d236){var _0x2fc4f0={};_0x2fc4f0[_0x52d236]={'$like':'%'+_0x300589[_0x8e27('0x44')][_0x8e27('0x6b')]+'%'};return _0x2fc4f0;})});}_0x470a55=_[_0x8e27('0x51')]({},_0x470a55,_0x300589['options']);return db[_0x8e27('0x74')][_0x8e27('0x33')]({'where':_0x470a55['where']})['then'](function(_0x5e1f43){_0x10b73d['count']=_0x5e1f43;if(_0x300589['query']['includeAll']){_0x470a55[_0x8e27('0x55')]=[{'model':db['CmContact'],'as':_0x8e27('0x77'),'required':![]},{'model':db['User'],'as':_0x8e27('0x78'),'attributes':[_0x8e27('0x3a'),'fullname',_0x8e27('0x79')],'required':![]},{'model':db[_0x8e27('0x7a')],'as':'Tags','attributes':['id',_0x8e27('0x3a'),_0x8e27('0x7b')],'where':_0x300589[_0x8e27('0x44')]['tag']?{'id':_0x300589[_0x8e27('0x44')][_0x8e27('0x7c')]}:undefined,'required':_0x300589[_0x8e27('0x44')][_0x8e27('0x7c')]?!![]:![]}];}return db[_0x8e27('0x74')][_0x8e27('0x6c')](_0x470a55);})['then'](function(_0x2b10ce){_0x10b73d[_0x8e27('0x56')]=_0x2b10ce;return _0x10b73d;});}})['then'](respondWithFilteredResult(_0x4c5ad8,_0x470a55))['catch'](handleError(_0x4c5ad8,null));};exports[_0x8e27('0x7d')]=function(_0x39f086,_0x34fbec,_0x1ddf7d){return db[_0x8e27('0x3f')][_0x8e27('0x6a')]({'where':{'id':_0x39f086['params']['id']}})['then'](handleEntityNotFound(_0x34fbec,null))[_0x8e27('0x23')](function(_0x23b8c5){if(_0x23b8c5){return db['sequelize'][_0x8e27('0x7e')](function(_0x8dcf98){return db[_0x8e27('0x7f')][_0x8e27('0x38')]({'where':{'FaxAccountId':_0x39f086[_0x8e27('0x58')]['id']},'transaction':_0x8dcf98})[_0x8e27('0x23')](function(_0x49a475){var _0x167207=_[_0x8e27('0x3e')](_0x39f086[_0x8e27('0x5d')],function(_0x432619){_0x432619[_0x8e27('0x68')]=_0x39f086[_0x8e27('0x58')]['id'];return _0x432619;});return db[_0x8e27('0x7f')][_0x8e27('0x80')](_0x167207,{'transaction':_0x8dcf98});});})['then'](function(){return db['FaxApplication'][_0x8e27('0x81')]({'where':{'FaxAccountId':_0x39f086[_0x8e27('0x58')]['id']},'order':_0x8e27('0x82')});});}})[_0x8e27('0x23')](respondWithResult(_0x34fbec,null))[_0x8e27('0x2d')](handleError(_0x34fbec,null));};exports[_0x8e27('0x83')]=function(_0x70f6f7,_0xb8b913,_0x6bb608){var _0x5292c8={};var _0x2caddb={};var _0x59d138;var _0x5a1df3;return db[_0x8e27('0x3f')]['findOne']({'where':{'id':_0x70f6f7[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0xb8b913,null))[_0x8e27('0x23')](function(_0x2b2edd){if(_0x2b2edd){_0x59d138=_0x2b2edd;_0x2caddb[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db['FaxApplication'][_0x8e27('0x40')]);_0x2caddb['query']=_[_0x8e27('0x45')](_0x70f6f7['query']);_0x2caddb['filters']=_[_0x8e27('0x47')](_0x2caddb[_0x8e27('0x5a')],_0x2caddb[_0x8e27('0x44')]);_0x5292c8['attributes']=_[_0x8e27('0x47')](_0x2caddb[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x70f6f7['query'][_0x8e27('0x49')]));_0x5292c8[_0x8e27('0x48')]=_0x5292c8['attributes']['length']?_0x5292c8['attributes']:_0x2caddb[_0x8e27('0x5a')];_0x5292c8['order']=qs[_0x8e27('0x4e')](_0x70f6f7[_0x8e27('0x44')][_0x8e27('0x4e')]);_0x5292c8[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_['pick'](_0x70f6f7[_0x8e27('0x44')],_0x2caddb[_0x8e27('0x46')]));if(_0x70f6f7[_0x8e27('0x44')][_0x8e27('0x6b')]){_0x5292c8[_0x8e27('0x4f')]=_[_0x8e27('0x51')](_0x5292c8['where'],{'$or':_[_0x8e27('0x3e')](_0x5292c8[_0x8e27('0x48')],function(_0x1c6cb8){var _0x3a9dfa={};_0x3a9dfa[_0x1c6cb8]={'$like':'%'+_0x70f6f7[_0x8e27('0x44')][_0x8e27('0x6b')]+'%'};return _0x3a9dfa;})});}_0x5292c8=_[_0x8e27('0x51')]({},_0x5292c8,_0x70f6f7['options']);return _0x59d138['getApplications'](_0x5292c8);}})[_0x8e27('0x23')](function(_0x1b22fe){if(_0x1b22fe){_0x5a1df3=_0x1b22fe['length'];if(!_0x70f6f7['query'][_0x8e27('0x4b')](_0x8e27('0x4c'))){_0x5292c8['limit']=qs[_0x8e27('0x34')](_0x70f6f7['query'][_0x8e27('0x34')]);_0x5292c8[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x70f6f7[_0x8e27('0x44')][_0x8e27('0x32')]);}return _0x59d138[_0x8e27('0x83')](_0x5292c8);}})[_0x8e27('0x23')](function(_0x574af2){if(_0x574af2){return _0x574af2?{'count':_0x5a1df3,'rows':_0x574af2}:null;}})[_0x8e27('0x23')](respondWithResult(_0xb8b913,null))['catch'](handleError(_0xb8b913,null));};function Extension(_0xcef8ab,_0xb36d2f,_0x1b7c16,_0x4baf7a){this[_0x8e27('0x84')]=_0x8e27('0x85');this[_0x8e27('0x86')]=_0xcef8ab[_0x8e27('0x87')];this[_0x8e27('0x88')]=_0x4baf7a;this[_0x8e27('0x42')]=_0x8e27('0x89');this['description']=_0x8e27('0x8a');this[_0x8e27('0x68')]=_0xcef8ab['id'];this[_0x8e27('0x82')]=_0xb36d2f;this[_0x8e27('0x8b')]=_0x1b7c16;}function createExtensionsReciveFax(_0x52afe5){var _0x31b614=0x1;var _0x342a35=[];_0x342a35['push'](new Extension(_0x52afe5,_0x31b614,'','Answer'));_0x31b614+=0x1;_0x342a35[_0x8e27('0x8c')](new Extension(_0x52afe5,_0x31b614,_0x8e27('0x8d'),_0x8e27('0x8e')));_0x31b614+=0x1;for(var _0x5a175c in _0x52afe5){if(_0x52afe5['hasOwnProperty'](_0x5a175c)&&(_0x5a175c===_0x8e27('0x8f')||_0x5a175c===_0x8e27('0x87')||_0x5a175c===_0x8e27('0x90')||_0x5a175c==='faxdetect'||_0x5a175c===_0x8e27('0x91')||_0x5a175c===_0x8e27('0x92')||_0x5a175c==='minrate'||_0x5a175c===_0x8e27('0x93')||_0x5a175c===_0x8e27('0x94'))){_0x342a35['push'](new Extension(_0x52afe5,_0x31b614,_0x8e27('0x95')+_0x5a175c+')='+_0x52afe5[_0x5a175c],'Set'));_0x31b614+=0x1;}}_0x342a35[_0x8e27('0x8c')](new Extension(_0x52afe5,_0x31b614,'6',_0x8e27('0x96')));_0x31b614+=0x1;_0x342a35[_0x8e27('0x8c')](new Extension(_0x52afe5,_0x31b614,_0x8e27('0x97'),_0x8e27('0x98')));_0x31b614=0x0;return _0x342a35;}exports[_0x8e27('0x99')]=function(_0x51ae2b,_0x22f2b5,_0x41317b){var _0x32a349;return db['sequelize']['transaction'](function(_0x2e2736){return db[_0x8e27('0x3f')]['create'](_0x51ae2b['body'],{'transaction':_0x2e2736})[_0x8e27('0x23')](function(_0x42a20d){_0x32a349=_0x42a20d[_0x8e27('0x5f')]({'plain':!![]});return db[_0x8e27('0x9a')][_0x8e27('0x80')](createExtensionsReciveFax(_0x32a349),{'transaction':_0x2e2736});});})[_0x8e27('0x23')](function(){return _0x32a349;})['then'](respondWithResult(_0x22f2b5,null))[_0x8e27('0x2d')](handleError(_0x22f2b5,null));};exports['updateAccountApplications']=function(_0x501af5,_0x5401de,_0x29d4b6){var _0x45bc11;return db[_0x8e27('0x9b')]['transaction'](function(_0x553d3b){return db['FaxAccount'][_0x8e27('0x9c')](_0x501af5[_0x8e27('0x5d')],{'where':{'id':_0x501af5[_0x8e27('0x5d')]['id']},'transaction':_0x553d3b})[_0x8e27('0x23')](function(_0xa307bd){return db['VoiceExtension'][_0x8e27('0x38')]({'where':{'FaxAccountId':_0x501af5['body']['id']},'transaction':_0x553d3b})['then'](function(_0x59b7a4){return db[_0x8e27('0x9a')][_0x8e27('0x80')](createExtensionsReciveFax(_[_0x8e27('0x75')](_0x501af5[_0x8e27('0x5d')],['tech',_0x8e27('0x43'),_0x8e27('0x9d'),_0x8e27('0x9e'),_0x8e27('0x9f'),'ListId'])),{'transaction':_0x553d3b});});});})[_0x8e27('0x23')](function(){return db[_0x8e27('0x3f')][_0x8e27('0xa0')](_0x501af5['body']['id']);})[_0x8e27('0x23')](respondWithResult(_0x5401de,null))[_0x8e27('0x2d')](handleError(_0x5401de,null));};exports[_0x8e27('0xa1')]=function(_0x49c735,_0x42dced,_0x262685){var _0xaadf98={'raw':!![],'where':{}};var _0x5ea6eb={};var _0x4e25db={'count':0x0,'rows':[]};return db[_0x8e27('0x3f')]['findOne']({'where':{'id':_0x49c735[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x42dced,null))[_0x8e27('0x23')](function(_0x507995){if(_0x507995){_0x5ea6eb['model']=_[_0x8e27('0x45')](db['FaxMessage'][_0x8e27('0x40')]);_0x5ea6eb[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x49c735[_0x8e27('0x44')]);_0x5ea6eb[_0x8e27('0x46')]=_[_0x8e27('0x47')](_0x5ea6eb[_0x8e27('0x5a')],_0x5ea6eb[_0x8e27('0x44')]);_0xaadf98[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x5ea6eb['model'],qs[_0x8e27('0x49')](_0x49c735['query'][_0x8e27('0x49')]));_0xaadf98[_0x8e27('0x48')]=_0xaadf98[_0x8e27('0x48')][_0x8e27('0x4a')]?_0xaadf98['attributes']:_0x5ea6eb[_0x8e27('0x5a')];if(!_0x49c735[_0x8e27('0x44')][_0x8e27('0x4b')]('nolimit')){_0xaadf98[_0x8e27('0x34')]=qs[_0x8e27('0x34')](_0x49c735[_0x8e27('0x44')]['limit']);_0xaadf98[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x49c735[_0x8e27('0x44')][_0x8e27('0x32')]);}_0xaadf98[_0x8e27('0x4d')]=qs['sort'](_0x49c735['query'][_0x8e27('0x4e')]);_0xaadf98[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x49c735[_0x8e27('0x44')],_0x5ea6eb[_0x8e27('0x46')]));_0xaadf98[_0x8e27('0x4f')][_0x8e27('0x68')]=_0x507995['id'];if(_0x49c735['query']['filter']){_0xaadf98['where']=_['merge'](_0xaadf98[_0x8e27('0x4f')],{'$or':_[_0x8e27('0x3e')](_0xaadf98[_0x8e27('0x48')],function(_0x42914c){var _0x4c7faf={};_0x4c7faf[_0x42914c]={'$like':'%'+_0x49c735['query']['filter']+'%'};return _0x4c7faf;})});}if(_0x49c735['query'][_0x8e27('0xa2')]){var _0x994f60=_0x49c735[_0x8e27('0x44')][_0x8e27('0xa2')][_0x8e27('0xa3')](',');var _0x5e9a8c={};_0x5e9a8c[_0x994f60[0x0]]={'$gte':moment(_0x994f60[0x1])[_0x8e27('0xa4')](_0x8e27('0xa5'))};_0xaadf98[_0x8e27('0x4f')]=_['merge'](_0xaadf98[_0x8e27('0x4f')],_0x5e9a8c);}_0xaadf98=_['merge']({},_0xaadf98,_0x49c735[_0x8e27('0x53')]);return db[_0x8e27('0xa6')]['count']({'where':_0xaadf98[_0x8e27('0x4f')]})[_0x8e27('0x23')](function(_0x5bf918){_0x4e25db[_0x8e27('0x33')]=_0x5bf918;if(_0x49c735[_0x8e27('0x44')]['includeAll']){_0xaadf98[_0x8e27('0x55')]=[{'all':!![]}];}return db[_0x8e27('0xa6')][_0x8e27('0x6c')](_0xaadf98);})['then'](function(_0x235780){_0x4e25db[_0x8e27('0x56')]=_0x235780;return _0x4e25db;});}})[_0x8e27('0x23')](respondWithFilteredResult(_0x42dced,_0xaadf98))[_0x8e27('0x2d')](handleError(_0x42dced,null));};exports[_0x8e27('0x3b')]=function(_0xe94745,_0x8ff4b1,_0x36e101){var _0x3e7036,_0x2b92d8={},_0x2c9434;if(_0xe94745['body']['to']){_0x2c9434=_0xe94745['body']['to'][0x0];}return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0xe94745[_0x8e27('0x58')]['id']},'include':[{'model':db[_0x8e27('0xa7')],'as':_0x8e27('0xa8'),'include':[{'model':db[_0x8e27('0xa9')],'as':_0x8e27('0xaa'),'where':{'fax':_0x2c9434},'limit':0x1,'order':[[_0x8e27('0x9e'),_0x8e27('0xab')]]}]}]})[_0x8e27('0x23')](handleEntityNotFound(_0x8ff4b1,null))[_0x8e27('0x23')](function(_0xbd2ef6){_0x3e7036=_0xbd2ef6;if(_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')]&&_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x8e27('0x4a')]){for(var _0x18d5c4=0x0;_0x18d5c4<_0xe94745['body'][_0x8e27('0xac')][_0x8e27('0x4a')];_0x18d5c4+=0x1){_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x18d5c4]={'filename':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x18d5c4][_0x8e27('0x3a')],'id':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x18d5c4]['id'],'path':path['join'](config[_0x8e27('0xad')],_0x8e27('0xae'),_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][_0x18d5c4][_0x8e27('0xaf')])};}}return respondWithRpcPromise(_0x8e27('0xb0'),_0x8e27('0xb0'),{'FaxAccountId':_[_0x8e27('0xb1')](_0xe94745[_0x8e27('0x58')]['id'])?undefined:_0xe94745['params']['id'],'path':_['isNil'](_0xe94745[_0x8e27('0x5d')]['attachments'][0x0][_0x8e27('0xb2')])?undefined:_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0]['path'],'fax':_[_0x8e27('0xb1')](_0xe94745[_0x8e27('0x5d')]['to'][0x0])?undefined:_0xe94745['body']['to'][0x0]},client9002);})[_0x8e27('0x23')](function(){if(_0x3e7036){if(_[_0x8e27('0xb1')](_0xe94745['body'][_0x8e27('0xb3')])){_0xe94745[_0x8e27('0x5d')][_0x8e27('0xb3')]=util[_0x8e27('0xa4')](_0x8e27('0xb4'),_0x3e7036['name'],_0x3e7036[_0x8e27('0xb5')]);}if(_0x3e7036['List']){if(_0x3e7036[_0x8e27('0xa8')][_0x8e27('0xaa')][_0x8e27('0x4a')]){return _0x3e7036['List'][_0x8e27('0xaa')][0x0];}else{return db[_0x8e27('0xa9')][_0x8e27('0x5c')](_[_0x8e27('0x1a')](_0xe94745[_0x8e27('0x5d')],{'firstName':_0xe94745['body']['to'][0x0],'phone':_0xe94745[_0x8e27('0x5d')]['to'][0x0],'fax':_0xe94745[_0x8e27('0x5d')]['to'][0x0],'ListId':_0x3e7036['ListId']}));}}else{throw new Error(_0x8e27('0xb6'));}}else{throw new Error(_0x8e27('0xb7'));}})[_0x8e27('0x23')](function(_0x123866){if(_0x123866){return db[_0x8e27('0x74')][_0x8e27('0x5b')]({'where':{'ContactId':_0x123866['id'],'closed':![],'FaxAccountId':_0x3e7036['id']}})['then'](function(_0x938034){if(_0x938034){return[_0x938034,![]];}return db['FaxInteraction'][_0x8e27('0x5c')]({'UserId':_0xe94745[_0x8e27('0x5e')]['id'],'ContactId':_0x123866['id'],'FaxAccountId':_0x3e7036['id'],'fax':_0xe94745[_0x8e27('0x5d')]['to'][0x0],'firstMsgDirection':_0x8e27('0xb8'),'Messages':[_['merge'](_0xe94745[_0x8e27('0x5d')],{'read':![],'body':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0][_0x8e27('0xb9')],'FaxAccountId':_0x3e7036['id'],'UserId':_0xe94745[_0x8e27('0x5e')]['id'],'ContactId':_0x123866['id'],'AttachmentId':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x8e27('0xba')}]})['then'](function(_0x36b74d){return[_0x36b74d,!![]];});});}else{throw new Error(_0x8e27('0xbb'));}})[_0x8e27('0xbc')](function(_0x1b4702,_0xea7e7f){if(_0xea7e7f){return _0x1b4702;}return db['FaxMessage'][_0x8e27('0x5c')]({'direction':_0x8e27('0xb8'),'read':![],'body':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0]['filename'],'FaxAccountId':_0x3e7036['id'],'FaxInteractionId':_0x1b4702['id'],'UserId':_0xe94745[_0x8e27('0x5e')]['id'],'ContactId':_0x1b4702[_0x8e27('0xbd')],'AttachmentId':_0xe94745['body'][_0x8e27('0xac')][0x0]['id']})[_0x8e27('0x23')](function(_0x213d87){_0x1b4702['dataValues']['Messages']=[];_0x1b4702[_0x8e27('0xbe')][_0x8e27('0xba')][_0x8e27('0x8c')](_0x213d87['dataValues']);return _0x1b4702;});})['then'](function(_0x4fd7c4){respondWithRpcPromise(_0x8e27('0xbf'),_0x8e27('0xbf'),{'FaxAccountId':_[_0x8e27('0xb1')](_0xe94745[_0x8e27('0x58')]['id'])?undefined:_0xe94745[_0x8e27('0x58')]['id'],'path':_[_0x8e27('0xb1')](_0xe94745[_0x8e27('0x5d')]['attachments'][0x0]['path'])?undefined:_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0][_0x8e27('0xb2')],'fax':_['isNil'](_0xe94745[_0x8e27('0x5d')]['to'][0x0])?undefined:_0xe94745[_0x8e27('0x5d')]['to'][0x0],'AttachmentId':_0xe94745[_0x8e27('0x5d')][_0x8e27('0xac')][0x0]['id']},client9002)['then'](function(_0x145b67){logger[_0x8e27('0x24')](_0x8e27('0xc0'),_0x145b67);})[_0x8e27('0x2d')](function(_0x1c5e2b){logger['info']('SendFaxRpc,\x20%s',_0x1c5e2b);});return _0x4fd7c4;})['then'](respondWithResult(_0x8ff4b1,null))['catch'](handleError(_0x8ff4b1,null));};exports[_0x8e27('0xc1')]=function(_0x127909,_0x18fa19,_0x429798){return db['FaxAccount'][_0x8e27('0x5b')]({'where':{'id':_0x127909[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x18fa19,null))[_0x8e27('0x23')](function(_0x562ae8){if(_0x562ae8){return _0x562ae8[_0x8e27('0xc1')](_0x127909[_0x8e27('0x5d')][_0x8e27('0x6e')],_['omit'](_0x127909[_0x8e27('0x5d')],[_0x8e27('0x6e'),'id'])||{})[_0x8e27('0xbc')](function(_0x48e8f8){for(var _0x1d9699=0x0;_0x1d9699<_0x127909[_0x8e27('0x5d')][_0x8e27('0x6e')][_0x8e27('0x4a')];_0x1d9699+=0x1){socket['emit'](_0x8e27('0xc2'),{'UserId':Number(_0x127909[_0x8e27('0x5d')][_0x8e27('0x6e')][_0x1d9699]),'FaxAccountId':Number(_0x127909[_0x8e27('0x58')]['id'])});}return _0x48e8f8;});}})[_0x8e27('0x23')](respondWithResult(_0x18fa19,null))[_0x8e27('0x2d')](handleError(_0x18fa19,null));};exports[_0x8e27('0xc3')]=function(_0x50e20e,_0x3521d6,_0x13fbd7){return db[_0x8e27('0x3f')][_0x8e27('0x5b')]({'where':{'id':_0x50e20e[_0x8e27('0x58')]['id']}})['then'](handleEntityNotFound(_0x3521d6,null))[_0x8e27('0x23')](function(_0x516d84){if(_0x516d84){return _0x516d84[_0x8e27('0xc3')](_0x50e20e['query'][_0x8e27('0x6e')])[_0x8e27('0x23')](function(){if(_[_0x8e27('0xc4')](_0x50e20e['query'][_0x8e27('0x6e')])){for(var _0x1c4bb8=0x0;_0x1c4bb8<_0x50e20e[_0x8e27('0x44')][_0x8e27('0x6e')]['length'];_0x1c4bb8+=0x1){socket[_0x8e27('0xc5')]('userFaxAccount:remove',{'UserId':Number(_0x50e20e[_0x8e27('0x44')][_0x8e27('0x6e')][_0x1c4bb8]),'FaxAccountId':Number(_0x50e20e['params']['id'])});}}else{socket[_0x8e27('0xc5')](_0x8e27('0xc6'),{'UserId':Number(_0x50e20e[_0x8e27('0x44')]['ids']),'FaxAccountId':Number(_0x50e20e['params']['id'])});}});}})[_0x8e27('0x23')](respondWithStatusCode(_0x3521d6,null))[_0x8e27('0x2d')](handleError(_0x3521d6,null));};exports['getAgents']=function(_0x3bd1ad,_0x45908c,_0x2134bc){var _0x43b557={};var _0x55ed77={};var _0x18ff5b;var _0x5b1749;return db[_0x8e27('0x3f')][_0x8e27('0x6a')]({'where':{'id':_0x3bd1ad[_0x8e27('0x58')]['id']}})[_0x8e27('0x23')](handleEntityNotFound(_0x45908c,null))[_0x8e27('0x23')](function(_0x212bbf){if(_0x212bbf){_0x18ff5b=_0x212bbf;_0x55ed77[_0x8e27('0x5a')]=_[_0x8e27('0x45')](db['User'][_0x8e27('0x40')]);_0x55ed77[_0x8e27('0x44')]=_[_0x8e27('0x45')](_0x3bd1ad[_0x8e27('0x44')]);_0x55ed77[_0x8e27('0x46')]=_[_0x8e27('0x47')](_0x55ed77['model'],_0x55ed77[_0x8e27('0x44')]);_0x43b557[_0x8e27('0x48')]=_[_0x8e27('0x47')](_0x55ed77[_0x8e27('0x5a')],qs[_0x8e27('0x49')](_0x3bd1ad['query'][_0x8e27('0x49')]));_0x43b557[_0x8e27('0x48')]=_0x43b557['attributes'][_0x8e27('0x4a')]?_0x43b557[_0x8e27('0x48')]:_0x55ed77[_0x8e27('0x5a')];_0x43b557[_0x8e27('0x4d')]=qs[_0x8e27('0x4e')](_0x3bd1ad[_0x8e27('0x44')][_0x8e27('0x4e')]);_0x43b557[_0x8e27('0x4f')]=qs[_0x8e27('0x46')](_[_0x8e27('0x50')](_0x3bd1ad[_0x8e27('0x44')],_0x55ed77['filters']));if(_0x3bd1ad['query'][_0x8e27('0x6b')]){_0x43b557[_0x8e27('0x4f')]=_['merge'](_0x43b557[_0x8e27('0x4f')],{'$or':_[_0x8e27('0x3e')](_0x43b557[_0x8e27('0x48')],function(_0x3b1775){var _0x4c121b={};_0x4c121b[_0x3b1775]={'$like':'%'+_0x3bd1ad[_0x8e27('0x44')]['filter']+'%'};return _0x4c121b;})});}_0x43b557=_[_0x8e27('0x51')]({},_0x43b557,_0x3bd1ad[_0x8e27('0x53')]);return _0x18ff5b[_0x8e27('0xc7')](_0x43b557);}})[_0x8e27('0x23')](function(_0x24ab97){if(_0x24ab97){_0x5b1749=_0x24ab97[_0x8e27('0x4a')];if(!_0x3bd1ad[_0x8e27('0x44')]['hasOwnProperty'](_0x8e27('0x4c'))){_0x43b557[_0x8e27('0x34')]=qs['limit'](_0x3bd1ad['query'][_0x8e27('0x34')]);_0x43b557[_0x8e27('0x32')]=qs[_0x8e27('0x32')](_0x3bd1ad[_0x8e27('0x44')][_0x8e27('0x32')]);}return _0x18ff5b[_0x8e27('0xc7')](_0x43b557);}})[_0x8e27('0x23')](function(_0x397d1f){if(_0x397d1f){return _0x397d1f?{'count':_0x5b1749,'rows':_0x397d1f}:null;}})['then'](respondWithResult(_0x45908c,null))[_0x8e27('0x2d')](handleError(_0x45908c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 456960b..58a5188 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 _0xaf2e=['events','FaxAccount','save','update','emit','hook','exports'];(function(_0xab8b1f,_0x16923f){var _0x4ac79e=function(_0x288ceb){while(--_0x288ceb){_0xab8b1f['push'](_0xab8b1f['shift']());}};_0x4ac79e(++_0x16923f);}(_0xaf2e,0x157));var _0xeaf2=function(_0x56e8b8,_0x24c372){_0x56e8b8=_0x56e8b8-0x0;var _0x27a276=_0xaf2e[_0x56e8b8];return _0x27a276;};'use strict';var EventEmitter=require(_0xeaf2('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xeaf2('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeaf2('0x2'),'afterUpdate':_0xeaf2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x507dd8){return function(_0x2efe5a,_0x13a999,_0x3fc782){FaxAccountEvents[_0xeaf2('0x4')](_0x507dd8+':'+_0x2efe5a['id'],_0x2efe5a);FaxAccountEvents[_0xeaf2('0x4')](_0x507dd8,_0x2efe5a);_0x3fc782(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xeaf2('0x5')](e,emitEvent(event));}}module[_0xeaf2('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0x2b07=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x307ed8,_0x2486b1){var _0x14bafc=function(_0x2ff17b){while(--_0x2ff17b){_0x307ed8['push'](_0x307ed8['shift']());}};_0x14bafc(++_0x2486b1);}(_0x2b07,0x7c));var _0x72b0=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0x2b07[_0x3522c8];return _0x22f498;};'use strict';var EventEmitter=require(_0x72b0('0x0'));var FaxAccount=require(_0x72b0('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x72b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x72b0('0x3'),'afterDestroy':_0x72b0('0x4')};function emitEvent(_0x1cbdbf){return function(_0x1bbbc2,_0x3f185f,_0x119fa7){FaxAccountEvents[_0x72b0('0x5')](_0x1cbdbf+':'+_0x1bbbc2['id'],_0x1bbbc2);FaxAccountEvents[_0x72b0('0x5')](_0x1cbdbf,_0x1bbbc2);_0x119fa7(null);};}for(var e in events){if(events[_0x72b0('0x6')](e)){var event=events[e];FaxAccount[_0x72b0('0x7')](e,emitEvent(event));}}module[_0x72b0('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 8d686d4..3d4e121 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 _0x66d9=['fax_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount'];(function(_0x130a21,_0x4c04a4){var _0x403c50=function(_0x1fef5c){while(--_0x1fef5c){_0x130a21['push'](_0x130a21['shift']());}};_0x403c50(++_0x4c04a4);}(_0x66d9,0x1a1));var _0x966d=function(_0x50f266,_0x573122){_0x50f266=_0x50f266-0x0;var _0x162fb9=_0x66d9[_0x50f266];return _0x162fb9;};'use strict';var _=require('lodash');var util=require(_0x966d('0x0'));var logger=require(_0x966d('0x1'))(_0x966d('0x2'));var moment=require(_0x966d('0x3'));var BPromise=require(_0x966d('0x4'));var rp=require(_0x966d('0x5'));var fs=require('fs');var path=require(_0x966d('0x6'));var rimraf=require(_0x966d('0x7'));var config=require(_0x966d('0x8'));var attributes=require(_0x966d('0x9'));module['exports']=function(_0x4e9f3a,_0x253858){return _0x4e9f3a[_0x966d('0xa')](_0x966d('0xb'),attributes,{'tableName':_0x966d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd75b=['moment','request-promise','rimraf','./faxAccount.attributes','FaxAccount','fax_accounts','lodash','util'];(function(_0x45390a,_0x5baac6){var _0x7a1401=function(_0x34be49){while(--_0x34be49){_0x45390a['push'](_0x45390a['shift']());}};_0x7a1401(++_0x5baac6);}(_0xd75b,0xf6));var _0xbd75=function(_0x4cc1fd,_0x1ef451){_0x4cc1fd=_0x4cc1fd-0x0;var _0x546e30=_0xd75b[_0x4cc1fd];return _0x546e30;};'use strict';var _=require(_0xbd75('0x0'));var util=require(_0xbd75('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbd75('0x2'));var BPromise=require('bluebird');var rp=require(_0xbd75('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd75('0x4'));var config=require('../../config/environment');var attributes=require(_0xbd75('0x5'));module['exports']=function(_0x2889a5,_0x589165){return _0x2889a5['define'](_0xbd75('0x6'),attributes,{'tableName':_0xbd75('0x7'),'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 175a267..574743a 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 _0xd22b=['Contact\x20not\x20found','autoclose','applications','push','length','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','model','map','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','FaxApplication','Applications','get','list','orderBy','priority','account','defaults','contact','fax','find','FaxInteraction','create'];(function(_0x21d532,_0x4552a4){var _0x37bda1=function(_0x134a6f){while(--_0x134a6f){_0x21d532['push'](_0x21d532['shift']());}};_0x37bda1(++_0x4552a4);}(_0xd22b,0x1da));var _0xbd22=function(_0x2465d4,_0x45335e){_0x2465d4=_0x2465d4-0x0;var _0x178d11=_0xd22b[_0x2465d4];return _0x178d11;};'use strict';var _=require('lodash');var util=require(_0xbd22('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbd22('0x1'));var fs=require('fs');var Redis=require(_0xbd22('0x2'));var db=require(_0xbd22('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd22('0x4'))(_0xbd22('0x5'));var config=require(_0xbd22('0x6'));var jayson=require(_0xbd22('0x7'));var client=jayson[_0xbd22('0x8')]['http']({'port':0x232c});config[_0xbd22('0x9')]=_['defaults'](config['redis'],{'host':_0xbd22('0xa'),'port':0x18eb});var socket=require(_0xbd22('0xb'))(new Redis(config[_0xbd22('0x9')]));require(_0xbd22('0xc'))[_0xbd22('0xd')](socket);function respondWithRpcPromise(_0x3c9829,_0x5b10a5,_0x53ce66){return new BPromise(function(_0x5a0a84,_0x3a1176){return client[_0xbd22('0xe')](_0x3c9829,_0x53ce66)[_0xbd22('0xf')](function(_0x33adeb){logger[_0xbd22('0x10')](_0xbd22('0x11'),_0x5b10a5,_0xbd22('0x12'));logger[_0xbd22('0x13')](_0xbd22('0x14'),_0x5b10a5,'request\x20sent',JSON[_0xbd22('0x15')](_0x33adeb));if(_0x33adeb[_0xbd22('0x16')]){if(_0x33adeb['error']['code']===0x1f4){logger[_0xbd22('0x16')](_0xbd22('0x11'),_0x5b10a5,_0x33adeb[_0xbd22('0x16')][_0xbd22('0x17')]);return _0x3a1176(_0x33adeb['error']['message']);}logger[_0xbd22('0x16')](_0xbd22('0x11'),_0x5b10a5,_0x33adeb[_0xbd22('0x16')][_0xbd22('0x17')]);return _0x5a0a84(_0x33adeb[_0xbd22('0x16')][_0xbd22('0x17')]);}else{logger[_0xbd22('0x10')](_0xbd22('0x11'),_0x5b10a5,_0xbd22('0x12'));_0x5a0a84(_0x33adeb[_0xbd22('0x18')][_0xbd22('0x17')]);}})[_0xbd22('0x19')](function(_0x788de4){logger[_0xbd22('0x16')](_0xbd22('0x11'),_0x5b10a5,_0x788de4);_0x3a1176(_0x788de4);});});}exports[_0xbd22('0x1a')]=function(_0x513233){var _0x4950b5=this;return new Promise(function(_0x19821a,_0x3e0468){return db[_0xbd22('0x1b')][_0xbd22('0x1c')]({'raw':_0x513233[_0xbd22('0x1d')]?_0x513233['options']['raw']===undefined?!![]:![]:!![],'where':_0x513233[_0xbd22('0x1d')]?_0x513233['options'][_0xbd22('0x1e')]||null:null,'attributes':_0x513233['options']?_0x513233[_0xbd22('0x1d')][_0xbd22('0x1f')]||null:null,'limit':_0x513233['options']?_0x513233[_0xbd22('0x1d')][_0xbd22('0x20')]||null:null,'include':_0x513233[_0xbd22('0x1d')]?_0x513233['options']['include']?_['map'](_0x513233[_0xbd22('0x1d')][_0xbd22('0x21')],function(_0x2ba8fe){return{'model':db[_0x2ba8fe[_0xbd22('0x22')]],'as':_0x2ba8fe['as'],'attributes':_0x2ba8fe['attributes'],'include':_0x2ba8fe['include']?_[_0xbd22('0x23')](_0x2ba8fe['include'],function(_0x2fde98){return{'model':db[_0x2fde98['model']],'as':_0x2fde98['as'],'attributes':_0x2fde98[_0xbd22('0x1f')],'include':_0x2fde98[_0xbd22('0x21')]?_[_0xbd22('0x23')](_0x2fde98[_0xbd22('0x21')],function(_0x19f492){return{'model':db[_0x19f492[_0xbd22('0x22')]],'as':_0x19f492['as'],'attributes':_0x19f492['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd22('0xf')](function(_0x459423){logger[_0xbd22('0x10')](_0xbd22('0x1a'),_0x513233);logger['debug'](_0xbd22('0x1a'),_0x513233,JSON[_0xbd22('0x15')](_0x459423));_0x19821a(_0x459423);})[_0xbd22('0x19')](function(_0x5ddfe7){logger[_0xbd22('0x16')]('GetFaxAccount',_0x5ddfe7[_0xbd22('0x17')],_0x513233);_0x3e0468(_0x4950b5[_0xbd22('0x16')](0x1f4,_0x5ddfe7[_0xbd22('0x17')]));});});};exports[_0xbd22('0x24')]=function(_0x1c4900,_0x42f4bb,_0x32331d){var _0x208485=this;return new Promise(function(_0x3f4470,_0x4f8f10){var _0x55b688={'body':_0x1c4900[_0xbd22('0x25')],'channel':'fax'};var _0x12f012=[];var _0xfa8c90=[];var _0x3f3545={};return db[_0xbd22('0x26')][_0xbd22('0x27')]()['then'](function(_0x25d81d){if(!_0x25d81d){throw new db[(_0xbd22('0x28'))][(_0xbd22('0x29'))]('no\x20available\x20attributes');}_0x12f012=_[_0xbd22('0x2a')](_[_0xbd22('0x2b')](_0x25d81d),[_0xbd22('0x2c'),_0xbd22('0x2d')]);_0xfa8c90=_[_0xbd22('0x2a')](_[_0xbd22('0x2b')](_0x25d81d),['createdAt',_0xbd22('0x2d'),_0xbd22('0x2e'),_0xbd22('0x2f')]);if(_0x1c4900[_0xbd22('0x25')]['id']){delete _0x1c4900['body']['id'];}if(_[_0xbd22('0x30')](_0x1c4900[_0xbd22('0x25')][_0xbd22('0x31')])){throw new db[(_0xbd22('0x28'))][(_0xbd22('0x29'))](_0xbd22('0x32'));}if(_[_0xbd22('0x30')](_0x1c4900['body'][_0xbd22('0x25')])||_0x1c4900['body']['body']===''){throw new db['Sequelize'][(_0xbd22('0x29'))](_0xbd22('0x33'));}if(_['isNil'](_0x1c4900[_0xbd22('0x25')][_0xbd22('0x34')])){throw new db['Sequelize'][(_0xbd22('0x29'))](_0xbd22('0x35')+_0xfa8c90);}if(!_[_0xbd22('0x36')](_0xfa8c90,_0x1c4900[_0xbd22('0x25')][_0xbd22('0x34')])){throw new db[(_0xbd22('0x28'))][(_0xbd22('0x29'))](_0xbd22('0x37')+_0xfa8c90);}_0x3f3545[_0x1c4900[_0xbd22('0x25')][_0xbd22('0x34')]]=_0x1c4900[_0xbd22('0x25')]['from'];})[_0xbd22('0xf')](function(){return db[_0xbd22('0x1b')]['find']({'where':{'id':_0x1c4900['account']['id']},'include':[{'model':db[_0xbd22('0x38')],'as':_0xbd22('0x39'),'include':[{'model':db[_0xbd22('0x26')],'as':_0xbd22('0x3a'),'where':_0x3f3545,'limit':0x1,'order':[[_0xbd22('0x2d'),'DESC']]}]},{'model':db[_0xbd22('0x3b')],'as':_0xbd22('0x3c')}]});})[_0xbd22('0xf')](function(_0x2bba13){if(_0x2bba13&&_0x2bba13[_0xbd22('0x39')]){var _0x3ddc7f=_0x2bba13[_0xbd22('0x3d')]({'plain':!![]});_0x55b688['account']=_0x3ddc7f;_0x55b688['applications']=_0x3ddc7f['Applications'];_0x55b688[_0xbd22('0x3e')]=_0x3ddc7f[_0xbd22('0x39')];_0x55b688['applications']=_[_0xbd22('0x3f')](_0x55b688['applications'],[_0xbd22('0x40')],['asc']);if(_0x55b688[_0xbd22('0x41')]['Applications']){delete _0x55b688['account']['Applications'];}if(_0x55b688[_0xbd22('0x41')][_0xbd22('0x39')]&&_0x55b688[_0xbd22('0x41')][_0xbd22('0x39')][_0xbd22('0x3a')]['length']){return _0x55b688['account'][_0xbd22('0x39')][_0xbd22('0x3a')][0x0];}var _0x54cc8d=_[_0xbd22('0x42')](_0x1c4900[_0xbd22('0x25')],{'firstName':_0x1c4900['body'][_0xbd22('0x31')],'ListId':_0x3ddc7f['ListId']});_0x54cc8d[_0x1c4900['body'][_0xbd22('0x34')]]=_0x1c4900[_0xbd22('0x25')][_0xbd22('0x31')];return db[_0xbd22('0x26')]['create'](_0x54cc8d,{'fields':_0x12f012,'raw':!![]});}})[_0xbd22('0xf')](function(_0x34038b){_0x55b688[_0xbd22('0x43')]=_0x34038b;if(_0x34038b){var _0x3e317a={'ContactId':_0x34038b['id'],'FaxAccountId':_0x1c4900[_0xbd22('0x41')]['id'],'fax':_0x34038b[_0xbd22('0x44')]};return db['FaxInteraction'][_0xbd22('0x45')]({'where':{'ContactId':_0x34038b['id'],'closed':![],'FaxAccountId':_0x1c4900[_0xbd22('0x41')]['id']}})['then'](function(_0x51635d){if(_0x51635d){return[_0x51635d,![]];}return db[_0xbd22('0x46')][_0xbd22('0x47')](_0x3e317a)['then'](function(_0x45ef66){return[_0x45ef66,!![]];});});}else{throw new Error(_0xbd22('0x48'));}})['spread'](function(_0x7514fb,_0x3f8d66){var _0x355b24=_0x7514fb[_0xbd22('0x3d')]({'plain':!![]});if(_0x3f8d66){if(_0x55b688['account'][_0xbd22('0x49')]){_0x55b688[_0xbd22('0x4a')][_0xbd22('0x4b')]({'id':0x0,'priority':_0x55b688['applications'][_0xbd22('0x4c')]+0x1,'app':_0xbd22('0x4d'),'appdata':_0xbd22('0x4e'),'interval':'*,*,*,*'});}_0x355b24['created']=!![];}else{_0x355b24[_0xbd22('0x4f')]=![];}_0x55b688[_0xbd22('0x50')]=_0x355b24;return db[_0xbd22('0x51')][_0xbd22('0x47')]({'body':_0x1c4900[_0xbd22('0x25')]['body'],'FaxAccountId':_0x1c4900['account']['id'],'FaxInteractionId':_0x7514fb['id'],'direction':'in','ContactId':_0x7514fb[_0xbd22('0x52')],'AttachmentId':_0x1c4900[_0xbd22('0x25')][_0xbd22('0x53')]});})[_0xbd22('0xf')](function(_0x5c64c8){_0x55b688[_0xbd22('0x17')]=_0x5c64c8;if(_0x55b688[_0xbd22('0x50')]['UserId']){return db['User'][_0xbd22('0x45')]({'attributes':['id',_0xbd22('0x54')],'where':{'id':_0x55b688[_0xbd22('0x50')][_0xbd22('0x55')]}})[_0xbd22('0xf')](function(_0x534b6a){if(_0x534b6a){_0x55b688['applications'][_0xbd22('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x534b6a[_0xbd22('0x54')]+','+(_0x55b688[_0xbd22('0x41')][_0xbd22('0x57')]||0xa),'interval':_0xbd22('0x58')});}return respondWithRpcPromise(_0xbd22('0x59'),_0xbd22('0x5a'),_0x55b688);});}return respondWithRpcPromise(_0xbd22('0x59'),_0xbd22('0x5a'),_0x55b688);})['then'](function(_0x658575){_0x3f4470(_0x658575);})[_0xbd22('0x19')](function(_0x159d17){_0x4f8f10(_0x208485[_0xbd22('0x16')](0x1f4,_0x159d17['message']));});});}; \ No newline at end of file +var _0xa77a=['from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','raw','options','include','map','model','attributes','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','keys','CompanyId','ListId','from','ValidationError'];(function(_0x3a053f,_0x50b708){var _0x1b22d9=function(_0x517bce){while(--_0x517bce){_0x3a053f['push'](_0x3a053f['shift']());}};_0x1b22d9(++_0x50b708);}(_0xa77a,0x133));var _0xaa77=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xa77a[_0x141e03];return _0x2074e3;};'use strict';var _=require(_0xaa77('0x0'));var util=require(_0xaa77('0x1'));var moment=require(_0xaa77('0x2'));var BPromise=require(_0xaa77('0x3'));var rs=require(_0xaa77('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa77('0x5'))['db'];var utils=require(_0xaa77('0x6'));var logger=require(_0xaa77('0x7'))(_0xaa77('0x8'));var config=require(_0xaa77('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa77('0xa')][_0xaa77('0xb')]({'port':0x232c});config['redis']=_[_0xaa77('0xc')](config[_0xaa77('0xd')],{'host':_0xaa77('0xe'),'port':0x18eb});var socket=require(_0xaa77('0xf'))(new Redis(config[_0xaa77('0xd')]));require(_0xaa77('0x10'))['register'](socket);function respondWithRpcPromise(_0xd4a619,_0x11af7c,_0x425b8e){return new BPromise(function(_0x4b6cc9,_0x398600){return client[_0xaa77('0x11')](_0xd4a619,_0x425b8e)[_0xaa77('0x12')](function(_0x38bfea){logger[_0xaa77('0x13')](_0xaa77('0x14'),_0x11af7c,_0xaa77('0x15'));logger[_0xaa77('0x16')](_0xaa77('0x17'),_0x11af7c,'request\x20sent',JSON[_0xaa77('0x18')](_0x38bfea));if(_0x38bfea[_0xaa77('0x19')]){if(_0x38bfea['error'][_0xaa77('0x1a')]===0x1f4){logger[_0xaa77('0x19')](_0xaa77('0x14'),_0x11af7c,_0x38bfea[_0xaa77('0x19')][_0xaa77('0x1b')]);return _0x398600(_0x38bfea[_0xaa77('0x19')]['message']);}logger[_0xaa77('0x19')]('FaxAccount,\x20%s,\x20%s',_0x11af7c,_0x38bfea[_0xaa77('0x19')][_0xaa77('0x1b')]);return _0x4b6cc9(_0x38bfea[_0xaa77('0x19')][_0xaa77('0x1b')]);}else{logger[_0xaa77('0x13')]('FaxAccount,\x20%s,\x20%s',_0x11af7c,'request\x20sent');_0x4b6cc9(_0x38bfea[_0xaa77('0x1c')][_0xaa77('0x1b')]);}})['catch'](function(_0x413ca9){logger[_0xaa77('0x19')](_0xaa77('0x14'),_0x11af7c,_0x413ca9);_0x398600(_0x413ca9);});});}exports[_0xaa77('0x1d')]=function(_0x28c8d3){var _0x56f13c=this;return new Promise(function(_0x533935,_0x12bfa8){return db[_0xaa77('0x1e')]['findAll']({'raw':_0x28c8d3['options']?_0x28c8d3['options'][_0xaa77('0x1f')]===undefined?!![]:![]:!![],'where':_0x28c8d3[_0xaa77('0x20')]?_0x28c8d3[_0xaa77('0x20')]['where']||null:null,'attributes':_0x28c8d3[_0xaa77('0x20')]?_0x28c8d3[_0xaa77('0x20')]['attributes']||null:null,'limit':_0x28c8d3['options']?_0x28c8d3[_0xaa77('0x20')]['limit']||null:null,'include':_0x28c8d3['options']?_0x28c8d3[_0xaa77('0x20')][_0xaa77('0x21')]?_[_0xaa77('0x22')](_0x28c8d3['options'][_0xaa77('0x21')],function(_0x3ffdb3){return{'model':db[_0x3ffdb3[_0xaa77('0x23')]],'as':_0x3ffdb3['as'],'attributes':_0x3ffdb3[_0xaa77('0x24')],'include':_0x3ffdb3[_0xaa77('0x21')]?_[_0xaa77('0x22')](_0x3ffdb3[_0xaa77('0x21')],function(_0x4b1e57){return{'model':db[_0x4b1e57['model']],'as':_0x4b1e57['as'],'attributes':_0x4b1e57['attributes'],'include':_0x4b1e57[_0xaa77('0x21')]?_['map'](_0x4b1e57[_0xaa77('0x21')],function(_0x56559d){return{'model':db[_0x56559d['model']],'as':_0x56559d['as'],'attributes':_0x56559d[_0xaa77('0x24')]};}):[]};}):[]};}):[]:[]})[_0xaa77('0x12')](function(_0x13a8d5){logger[_0xaa77('0x13')](_0xaa77('0x1d'),_0x28c8d3);logger['debug']('GetFaxAccount',_0x28c8d3,JSON[_0xaa77('0x18')](_0x13a8d5));_0x533935(_0x13a8d5);})[_0xaa77('0x25')](function(_0x29056c){logger[_0xaa77('0x19')](_0xaa77('0x1d'),_0x29056c[_0xaa77('0x1b')],_0x28c8d3);_0x12bfa8(_0x56f13c[_0xaa77('0x19')](0x1f4,_0x29056c[_0xaa77('0x1b')]));});});};exports[_0xaa77('0x26')]=function(_0x21e981,_0x194cbe,_0x1e0570){var _0x277685=this;return new Promise(function(_0x4833fe,_0x68dfb8){var _0x344d9d={'body':_0x21e981[_0xaa77('0x27')],'channel':_0xaa77('0x28')};var _0x4dfb9c=[];var _0x103844=[];var _0x2a0707={};return db[_0xaa77('0x29')][_0xaa77('0x2a')]()['then'](function(_0x59edef){if(!_0x59edef){throw new db[(_0xaa77('0x2b'))]['ValidationError'](_0xaa77('0x2c'));}_0x4dfb9c=_['difference'](_['keys'](_0x59edef),[_0xaa77('0x2d'),_0xaa77('0x2e')]);_0x103844=_[_0xaa77('0x2f')](_[_0xaa77('0x30')](_0x59edef),[_0xaa77('0x2d'),_0xaa77('0x2e'),_0xaa77('0x31'),_0xaa77('0x32')]);if(_0x21e981['body']['id']){delete _0x21e981[_0xaa77('0x27')]['id'];}if(_['isNil'](_0x21e981[_0xaa77('0x27')][_0xaa77('0x33')])){throw new db[(_0xaa77('0x2b'))][(_0xaa77('0x34'))](_0xaa77('0x35'));}if(_[_0xaa77('0x36')](_0x21e981[_0xaa77('0x27')][_0xaa77('0x27')])||_0x21e981['body'][_0xaa77('0x27')]===''){throw new db[(_0xaa77('0x2b'))][(_0xaa77('0x34'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaa77('0x36')](_0x21e981[_0xaa77('0x27')][_0xaa77('0x37')])){throw new db[(_0xaa77('0x2b'))][(_0xaa77('0x34'))](_0xaa77('0x38')+_0x103844);}if(!_['includes'](_0x103844,_0x21e981['body'][_0xaa77('0x37')])){throw new db[(_0xaa77('0x2b'))]['ValidationError'](_0xaa77('0x39')+_0x103844);}_0x2a0707[_0x21e981[_0xaa77('0x27')][_0xaa77('0x37')]]=_0x21e981['body'][_0xaa77('0x33')];})[_0xaa77('0x12')](function(){return db[_0xaa77('0x1e')][_0xaa77('0x3a')]({'where':{'id':_0x21e981[_0xaa77('0x3b')]['id']},'include':[{'model':db[_0xaa77('0x3c')],'as':_0xaa77('0x3d'),'include':[{'model':db[_0xaa77('0x29')],'as':_0xaa77('0x3e'),'where':_0x2a0707,'limit':0x1,'order':[[_0xaa77('0x2e'),_0xaa77('0x3f')]]}]},{'model':db[_0xaa77('0x40')],'as':_0xaa77('0x41')}]});})[_0xaa77('0x12')](function(_0x29bd0f){if(_0x29bd0f&&_0x29bd0f['List']){var _0x3bda06=_0x29bd0f['get']({'plain':!![]});_0x344d9d[_0xaa77('0x3b')]=_0x3bda06;_0x344d9d[_0xaa77('0x42')]=_0x3bda06[_0xaa77('0x41')];_0x344d9d['list']=_0x3bda06[_0xaa77('0x3d')];_0x344d9d[_0xaa77('0x42')]=_[_0xaa77('0x43')](_0x344d9d[_0xaa77('0x42')],[_0xaa77('0x44')],[_0xaa77('0x45')]);if(_0x344d9d[_0xaa77('0x3b')][_0xaa77('0x41')]){delete _0x344d9d[_0xaa77('0x3b')][_0xaa77('0x41')];}if(_0x344d9d[_0xaa77('0x3b')][_0xaa77('0x3d')]&&_0x344d9d['account'][_0xaa77('0x3d')][_0xaa77('0x3e')][_0xaa77('0x46')]){return _0x344d9d[_0xaa77('0x3b')][_0xaa77('0x3d')][_0xaa77('0x3e')][0x0];}var _0x5e915a=_[_0xaa77('0xc')](_0x21e981[_0xaa77('0x27')],{'firstName':_0x21e981[_0xaa77('0x27')][_0xaa77('0x33')],'ListId':_0x3bda06[_0xaa77('0x32')]});_0x5e915a[_0x21e981['body'][_0xaa77('0x37')]]=_0x21e981['body'][_0xaa77('0x33')];return db[_0xaa77('0x29')][_0xaa77('0x47')](_0x5e915a,{'fields':_0x4dfb9c,'raw':!![]});}})[_0xaa77('0x12')](function(_0x2a36d3){_0x344d9d[_0xaa77('0x48')]=_0x2a36d3;if(_0x2a36d3){var _0x42b0f4={'ContactId':_0x2a36d3['id'],'FaxAccountId':_0x21e981[_0xaa77('0x3b')]['id'],'fax':_0x2a36d3[_0xaa77('0x28')]};return db[_0xaa77('0x49')][_0xaa77('0x3a')]({'where':{'ContactId':_0x2a36d3['id'],'closed':![],'FaxAccountId':_0x21e981[_0xaa77('0x3b')]['id']}})[_0xaa77('0x12')](function(_0x320898){if(_0x320898){return[_0x320898,![]];}return db[_0xaa77('0x49')][_0xaa77('0x47')](_0x42b0f4)[_0xaa77('0x12')](function(_0xa99186){return[_0xa99186,!![]];});});}else{throw new Error(_0xaa77('0x4a'));}})[_0xaa77('0x4b')](function(_0x41b0f1,_0x396d16){var _0x22e752=_0x41b0f1['get']({'plain':!![]});if(_0x396d16){if(_0x344d9d['account']['autoclose']){_0x344d9d['applications'][_0xaa77('0x4c')]({'id':0x0,'priority':_0x344d9d[_0xaa77('0x42')][_0xaa77('0x46')]+0x1,'app':_0xaa77('0x4d'),'appdata':_0xaa77('0x4e'),'interval':_0xaa77('0x4f')});}_0x22e752[_0xaa77('0x50')]=!![];}else{_0x22e752[_0xaa77('0x50')]=![];}_0x344d9d[_0xaa77('0x51')]=_0x22e752;return db[_0xaa77('0x52')]['create']({'body':_0x21e981['body'][_0xaa77('0x27')],'FaxAccountId':_0x21e981[_0xaa77('0x3b')]['id'],'FaxInteractionId':_0x41b0f1['id'],'direction':'in','ContactId':_0x41b0f1['ContactId'],'AttachmentId':_0x21e981[_0xaa77('0x27')][_0xaa77('0x53')]});})[_0xaa77('0x12')](function(_0x37f154){_0x344d9d[_0xaa77('0x1b')]=_0x37f154;if(_0x344d9d['interaction'][_0xaa77('0x54')]){return db[_0xaa77('0x55')][_0xaa77('0x3a')]({'attributes':['id',_0xaa77('0x56')],'where':{'id':_0x344d9d[_0xaa77('0x51')][_0xaa77('0x54')]}})[_0xaa77('0x12')](function(_0x8e43c8){if(_0x8e43c8){_0x344d9d[_0xaa77('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x8e43c8[_0xaa77('0x56')]+','+(_0x344d9d['account'][_0xaa77('0x57')]||0xa),'interval':_0xaa77('0x4f')});}return respondWithRpcPromise(_0xaa77('0x58'),_0xaa77('0x59'),_0x344d9d);});}return respondWithRpcPromise(_0xaa77('0x58'),'startRouting',_0x344d9d);})[_0xaa77('0x12')](function(_0x543e94){_0x4833fe(_0x543e94);})[_0xaa77('0x25')](function(_0x26f52e){_0x68dfb8(_0x277685[_0xaa77('0x19')](0x1f4,_0x26f52e[_0xaa77('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index c37d5fa..35ed5d5 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 _0x3229=['removeListener','register','length','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x51ade8,_0x279101){var _0x5e37ef=function(_0x5b874d){while(--_0x5b874d){_0x51ade8['push'](_0x51ade8['shift']());}};_0x5e37ef(++_0x279101);}(_0x3229,0x124));var _0x9322=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x3229[_0x710815];return _0x5b3b89;};'use strict';var FaxAccountEvents=require(_0x9322('0x0'));var events=[_0x9322('0x1'),_0x9322('0x2'),_0x9322('0x3')];function createListener(_0x24484e,_0x417d0b){return function(_0x44fd37){_0x417d0b[_0x9322('0x4')](_0x24484e,_0x44fd37);};}function removeListener(_0x194d1c,_0x22ecdc){return function(){FaxAccountEvents[_0x9322('0x5')](_0x194d1c,_0x22ecdc);};}exports[_0x9322('0x6')]=function(_0x3fd6ea){for(var _0x1480b6=0x0,_0x18aa1e=events[_0x9322('0x7')];_0x1480b6<_0x18aa1e;_0x1480b6++){var _0x18b9a2=events[_0x1480b6];var _0x469cb6=createListener(_0x9322('0x8')+_0x18b9a2,_0x3fd6ea);FaxAccountEvents['on'](_0x18b9a2,_0x469cb6);}}; \ No newline at end of file +var _0x783d=['update','emit','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x33de79,_0x51888f){var _0x1932fa=function(_0x3824c3){while(--_0x3824c3){_0x33de79['push'](_0x33de79['shift']());}};_0x1932fa(++_0x51888f);}(_0x783d,0x7b));var _0xd783=function(_0xe29aa9,_0x410bd2){_0xe29aa9=_0xe29aa9-0x0;var _0x1ab4dc=_0x783d[_0xe29aa9];return _0x1ab4dc;};'use strict';var FaxAccountEvents=require(_0xd783('0x0'));var events=[_0xd783('0x1'),_0xd783('0x2'),_0xd783('0x3')];function createListener(_0x90debd,_0x5e2f){return function(_0x5c8280){_0x5e2f[_0xd783('0x4')](_0x90debd,_0x5c8280);};}function removeListener(_0x103ece,_0x5597a3){return function(){FaxAccountEvents['removeListener'](_0x103ece,_0x5597a3);};}exports['register']=function(_0x5047bd){for(var _0x2abcc5=0x0,_0x7d56b8=events[_0xd783('0x5')];_0x2abcc5<_0x7d56b8;_0x2abcc5++){var _0x316f40=events[_0x2abcc5];var _0xbf3b47=createListener(_0xd783('0x6')+_0x316f40,_0x5047bd);FaxAccountEvents['on'](_0x316f40,_0xbf3b47);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 04f2018..f78383d 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x2c249a,_0x4a6096){var _0x3edb89=function(_0x46f832){while(--_0x46f832){_0x2c249a['push'](_0x2c249a['shift']());}};_0x3edb89(++_0x4a6096);}(_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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x29fbb7,_0x9a8ad){var _0x3153fe=function(_0x4fab0c){while(--_0x4fab0c){_0x29fbb7['push'](_0x29fbb7['shift']());}};_0x3153fe(++_0x9a8ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 71fc926..30ab9ef 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 _0xd0db=['INTEGER','STRING','TEXT','exports'];(function(_0xce3d93,_0x504f1c){var _0x16bcf8=function(_0xff82f3){while(--_0xff82f3){_0xce3d93['push'](_0xce3d93['shift']());}};_0x16bcf8(++_0x504f1c);}(_0xd0db,0x9f));var _0xbd0d=function(_0x298f09,_0x5da8e7){_0x298f09=_0x298f09-0x0;var _0x3965f6=_0xd0db[_0x298f09];return _0x3965f6;};'use strict';var Sequelize=require('sequelize');module[_0xbd0d('0x0')]={'priority':{'type':Sequelize[_0xbd0d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbd0d('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbd0d('0x3')]()},'description':{'type':Sequelize[_0xbd0d('0x2')]},'interval':{'type':Sequelize[_0xbd0d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x67b7=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x5e4bb7,_0x28d5d7){var _0x26730e=function(_0x92a498){while(--_0x92a498){_0x5e4bb7['push'](_0x5e4bb7['shift']());}};_0x26730e(++_0x28d5d7);}(_0x67b7,0x93));var _0x767b=function(_0xd63b18,_0x49e978){_0xd63b18=_0xd63b18-0x0;var _0x2c64f5=_0x67b7[_0xd63b18];return _0x2c64f5;};'use strict';var Sequelize=require(_0x767b('0x0'));module[_0x767b('0x1')]={'priority':{'type':Sequelize[_0x767b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x767b('0x3')],'allowNull':![],'defaultValue':_0x767b('0x4')},'appdata':{'type':Sequelize[_0x767b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x767b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 44fd76b..977f8af 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 _0x885e=['sort','where','pick','merge','VIRTUAL','filter','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','sendStatus','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x52667d,_0x59a6cc){var _0x42093d=function(_0x50801a){while(--_0x50801a){_0x52667d['push'](_0x52667d['shift']());}};_0x42093d(++_0x59a6cc);}(_0x885e,0x190));var _0xe885=function(_0x5c1ac9,_0x9a2516){_0x5c1ac9=_0x5c1ac9-0x0;var _0x45ceb7=_0x885e[_0x5c1ac9];return _0x45ceb7;};'use strict';var emlformat=require(_0xe885('0x0'));var rimraf=require(_0xe885('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe885('0x2'));var rp=require(_0xe885('0x3'));var moment=require(_0xe885('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe885('0x5'));var util=require(_0xe885('0x6'));var path=require(_0xe885('0x7'));var sox=require('sox');var csv=require(_0xe885('0x8'));var ejs=require(_0xe885('0x9'));var fs=require('fs');var fs_extra=require(_0xe885('0xa'));var _=require(_0xe885('0xb'));var squel=require(_0xe885('0xc'));var crypto=require(_0xe885('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe885('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe885('0xf'));var Papa=require(_0xe885('0x10'));var Redis=require(_0xe885('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe885('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe885('0x13'));var logger=require(_0xe885('0x14'))(_0xe885('0x15'));var utils=require(_0xe885('0x16'));var config=require(_0xe885('0x17'));var licenseUtil=require(_0xe885('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ef35e,_0x353c31){_0x353c31=_0x353c31||0xcc;return function(_0x4a13c0){if(_0x4a13c0){return _0x5ef35e['sendStatus'](_0x353c31);}return _0x5ef35e[_0xe885('0x19')](_0x353c31)[_0xe885('0x1a')]();};}function respondWithResult(_0x2d255b,_0x4c99d3){_0x4c99d3=_0x4c99d3||0xc8;return function(_0x5d35fe){if(_0x5d35fe){return _0x2d255b['status'](_0x4c99d3)['json'](_0x5d35fe);}};}function respondWithFilteredResult(_0x5a0fff,_0xbd2bf9){return function(_0x5c58d4){if(_0x5c58d4){var _0x31e99a=typeof _0xbd2bf9[_0xe885('0x1b')]===_0xe885('0x1c')&&typeof _0xbd2bf9[_0xe885('0x1d')]===_0xe885('0x1c');var _0x40efcd=_0x5c58d4[_0xe885('0x1e')];var _0x154c66=_0x31e99a?0x0:_0xbd2bf9[_0xe885('0x1b')];var _0x4cfccc=_0x31e99a?_0x5c58d4[_0xe885('0x1e')]:_0xbd2bf9[_0xe885('0x1b')]+_0xbd2bf9[_0xe885('0x1d')];var _0x55d785;if(_0x4cfccc>=_0x40efcd){_0x4cfccc=_0x40efcd;_0x55d785=0xc8;}else{_0x55d785=0xce;}_0x5a0fff['status'](_0x55d785);return _0x5a0fff[_0xe885('0x1f')]('Content-Range',_0x154c66+'-'+_0x4cfccc+'/'+_0x40efcd)[_0xe885('0x20')](_0x5c58d4);}return null;};}function patchUpdates(_0x5d9136){return function(_0x163008){try{jsonpatch[_0xe885('0x21')](_0x163008,_0x5d9136,!![]);}catch(_0x2789cf){return BPromise[_0xe885('0x22')](_0x2789cf);}return _0x163008[_0xe885('0x23')]();};}function saveUpdates(_0x3d45e4,_0x415904){return function(_0x15a054){if(_0x15a054){return _0x15a054['update'](_0x3d45e4)[_0xe885('0x24')](function(_0x2ca9b6){return _0x2ca9b6;});}return null;};}function removeEntity(_0x44d1a0,_0xd044e8){return function(_0xc4cae1){if(_0xc4cae1){return _0xc4cae1[_0xe885('0x25')]()[_0xe885('0x24')](function(){_0x44d1a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31ef55,_0x21d597){return function(_0x1698fc){if(!_0x1698fc){_0x31ef55[_0xe885('0x26')](0x194);}return _0x1698fc;};}function handleError(_0x586cff,_0x3d985f){_0x3d985f=_0x3d985f||0x1f4;return function(_0xe6731a){logger['error'](_0xe6731a[_0xe885('0x27')]);if(_0xe6731a['name']){delete _0xe6731a['name'];}_0x586cff['status'](_0x3d985f)['send'](_0xe6731a);};}exports[_0xe885('0x28')]=function(_0x56b8da,_0x3129d7){var _0x220ca4={},_0x3d816b={},_0x49e3ce={'count':0x0,'rows':[]};var _0xfeb9d6=_[_0xe885('0x29')](db['FaxApplication'][_0xe885('0x2a')],function(_0x232ca9){return{'name':_0x232ca9[_0xe885('0x2b')],'type':_0x232ca9[_0xe885('0x2c')][_0xe885('0x2d')]};});_0x3d816b[_0xe885('0x2e')]=_[_0xe885('0x29')](_0xfeb9d6,_0xe885('0x2f'));_0x3d816b[_0xe885('0x30')]=_[_0xe885('0x31')](_0x56b8da[_0xe885('0x30')]);_0x3d816b[_0xe885('0x32')]=_[_0xe885('0x33')](_0x3d816b[_0xe885('0x2e')],_0x3d816b[_0xe885('0x30')]);_0x220ca4[_0xe885('0x34')]=_['intersection'](_0x3d816b[_0xe885('0x2e')],qs[_0xe885('0x35')](_0x56b8da[_0xe885('0x30')][_0xe885('0x35')]));_0x220ca4[_0xe885('0x34')]=_0x220ca4[_0xe885('0x34')]['length']?_0x220ca4[_0xe885('0x34')]:_0x3d816b[_0xe885('0x2e')];if(!_0x56b8da[_0xe885('0x30')][_0xe885('0x36')](_0xe885('0x37'))){_0x220ca4[_0xe885('0x1d')]=qs['limit'](_0x56b8da[_0xe885('0x30')][_0xe885('0x1d')]);_0x220ca4['offset']=qs['offset'](_0x56b8da['query'][_0xe885('0x1b')]);}_0x220ca4['order']=qs[_0xe885('0x38')](_0x56b8da[_0xe885('0x30')]['sort']);_0x220ca4[_0xe885('0x39')]=qs['filters'](_[_0xe885('0x3a')](_0x56b8da[_0xe885('0x30')],_0x3d816b[_0xe885('0x32')]),_0xfeb9d6);if(_0x56b8da[_0xe885('0x30')]['filter']){_0x220ca4[_0xe885('0x39')]=_[_0xe885('0x3b')](_0x220ca4[_0xe885('0x39')],{'$or':_[_0xe885('0x29')](_0xfeb9d6,function(_0x3097fe){if(_0x3097fe[_0xe885('0x2c')]!==_0xe885('0x3c')){var _0x154d58={};_0x154d58[_0x3097fe[_0xe885('0x2f')]]={'$like':'%'+_0x56b8da[_0xe885('0x30')][_0xe885('0x3d')]+'%'};return _0x154d58;}})});}_0x220ca4=_[_0xe885('0x3b')]({},_0x220ca4,_0x56b8da[_0xe885('0x3e')]);var _0x4dc6d8={'where':_0x220ca4[_0xe885('0x39')]};return db[_0xe885('0x3f')][_0xe885('0x1e')](_0x4dc6d8)['then'](function(_0x3d73fa){_0x49e3ce[_0xe885('0x1e')]=_0x3d73fa;if(_0x56b8da[_0xe885('0x30')][_0xe885('0x40')]){_0x220ca4[_0xe885('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0xe885('0x42')](_0x220ca4);})['then'](function(_0x239f9d){_0x49e3ce[_0xe885('0x43')]=_0x239f9d;return _0x49e3ce;})[_0xe885('0x24')](respondWithFilteredResult(_0x3129d7,_0x220ca4))[_0xe885('0x44')](handleError(_0x3129d7,null));};exports[_0xe885('0x45')]=function(_0x2b49f0,_0x267ee9){var _0x2b8c65={'raw':!![],'where':{'id':_0x2b49f0[_0xe885('0x46')]['id']}},_0x54ee57={};_0x54ee57[_0xe885('0x2e')]=_['keys'](db['FaxApplication'][_0xe885('0x2a')]);_0x54ee57[_0xe885('0x30')]=_['keys'](_0x2b49f0[_0xe885('0x30')]);_0x54ee57[_0xe885('0x32')]=_[_0xe885('0x33')](_0x54ee57[_0xe885('0x2e')],_0x54ee57[_0xe885('0x30')]);_0x2b8c65['attributes']=_[_0xe885('0x33')](_0x54ee57[_0xe885('0x2e')],qs[_0xe885('0x35')](_0x2b49f0[_0xe885('0x30')][_0xe885('0x35')]));_0x2b8c65[_0xe885('0x34')]=_0x2b8c65[_0xe885('0x34')][_0xe885('0x47')]?_0x2b8c65[_0xe885('0x34')]:_0x54ee57[_0xe885('0x2e')];if(_0x2b49f0[_0xe885('0x30')][_0xe885('0x40')]){_0x2b8c65[_0xe885('0x41')]=[{'all':!![]}];}_0x2b8c65=_[_0xe885('0x3b')]({},_0x2b8c65,_0x2b49f0[_0xe885('0x3e')]);return db[_0xe885('0x3f')][_0xe885('0x48')](_0x2b8c65)[_0xe885('0x24')](handleEntityNotFound(_0x267ee9,null))[_0xe885('0x24')](respondWithResult(_0x267ee9,null))[_0xe885('0x44')](handleError(_0x267ee9,null));};exports[_0xe885('0x49')]=function(_0x5a7068,_0x52964e){return db[_0xe885('0x3f')][_0xe885('0x49')](_0x5a7068[_0xe885('0x4a')],{})[_0xe885('0x24')](respondWithResult(_0x52964e,0xc9))[_0xe885('0x44')](handleError(_0x52964e,null));};exports[_0xe885('0x4b')]=function(_0x2916d1,_0x5941a9){if(_0x2916d1[_0xe885('0x4a')]['id']){delete _0x2916d1[_0xe885('0x4a')]['id'];}return db[_0xe885('0x3f')][_0xe885('0x48')]({'where':{'id':_0x2916d1[_0xe885('0x46')]['id']}})[_0xe885('0x24')](handleEntityNotFound(_0x5941a9,null))[_0xe885('0x24')](saveUpdates(_0x2916d1[_0xe885('0x4a')],null))[_0xe885('0x24')](respondWithResult(_0x5941a9,null))['catch'](handleError(_0x5941a9,null));};exports['destroy']=function(_0x18e2c0,_0x3e5644){return db[_0xe885('0x3f')]['find']({'where':{'id':_0x18e2c0[_0xe885('0x46')]['id']}})[_0xe885('0x24')](handleEntityNotFound(_0x3e5644,null))[_0xe885('0x24')](removeEntity(_0x3e5644,null))['catch'](handleError(_0x3e5644,null));}; \ No newline at end of file +var _0x50b5=['update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','merge','filter','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','offset','limit','count','set','apply','reject','save'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x50b5,0x142));var _0x550b=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x50b5[_0x4ae625];return _0x31accf;};'use strict';var emlformat=require(_0x550b('0x0'));var rimraf=require(_0x550b('0x1'));var zipdir=require(_0x550b('0x2'));var jsonpatch=require(_0x550b('0x3'));var rp=require(_0x550b('0x4'));var moment=require(_0x550b('0x5'));var BPromise=require(_0x550b('0x6'));var Mustache=require(_0x550b('0x7'));var util=require(_0x550b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x550b('0x9'));var ejs=require(_0x550b('0xa'));var fs=require('fs');var fs_extra=require(_0x550b('0xb'));var _=require(_0x550b('0xc'));var squel=require(_0x550b('0xd'));var crypto=require('crypto');var jsforce=require(_0x550b('0xe'));var deskjs=require(_0x550b('0xf'));var toCsv=require(_0x550b('0x9'));var querystring=require(_0x550b('0x10'));var Papa=require('papaparse');var Redis=require(_0x550b('0x11'));var authService=require(_0x550b('0x12'));var qs=require(_0x550b('0x13'));var as=require(_0x550b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x550b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x550b('0x16'))['db'];function respondWithStatusCode(_0x31030c,_0x22e632){_0x22e632=_0x22e632||0xcc;return function(_0xfdfdba){if(_0xfdfdba){return _0x31030c[_0x550b('0x17')](_0x22e632);}return _0x31030c[_0x550b('0x18')](_0x22e632)[_0x550b('0x19')]();};}function respondWithResult(_0x797ca0,_0x5522b6){_0x5522b6=_0x5522b6||0xc8;return function(_0x2d6518){if(_0x2d6518){return _0x797ca0[_0x550b('0x18')](_0x5522b6)['json'](_0x2d6518);}};}function respondWithFilteredResult(_0x1e8996,_0x3fadb5){return function(_0x32d461){if(_0x32d461){var _0x468400=typeof _0x3fadb5[_0x550b('0x1a')]==='undefined'&&typeof _0x3fadb5[_0x550b('0x1b')]==='undefined';var _0x136ffb=_0x32d461[_0x550b('0x1c')];var _0x40abd5=_0x468400?0x0:_0x3fadb5[_0x550b('0x1a')];var _0xd4f55b=_0x468400?_0x32d461[_0x550b('0x1c')]:_0x3fadb5[_0x550b('0x1a')]+_0x3fadb5[_0x550b('0x1b')];var _0xbc344;if(_0xd4f55b>=_0x136ffb){_0xd4f55b=_0x136ffb;_0xbc344=0xc8;}else{_0xbc344=0xce;}_0x1e8996['status'](_0xbc344);return _0x1e8996[_0x550b('0x1d')]('Content-Range',_0x40abd5+'-'+_0xd4f55b+'/'+_0x136ffb)['json'](_0x32d461);}return null;};}function patchUpdates(_0x4350b5){return function(_0x30987a){try{jsonpatch[_0x550b('0x1e')](_0x30987a,_0x4350b5,!![]);}catch(_0x2716d6){return BPromise[_0x550b('0x1f')](_0x2716d6);}return _0x30987a[_0x550b('0x20')]();};}function saveUpdates(_0x219a46,_0x2cde1a){return function(_0x1992a2){if(_0x1992a2){return _0x1992a2[_0x550b('0x21')](_0x219a46)[_0x550b('0x22')](function(_0x33f94e){return _0x33f94e;});}return null;};}function removeEntity(_0x5146c3,_0x4df758){return function(_0x46a799){if(_0x46a799){return _0x46a799['destroy']()[_0x550b('0x22')](function(){_0x5146c3[_0x550b('0x18')](0xcc)[_0x550b('0x19')]();});}};}function handleEntityNotFound(_0x111e0c,_0x5a076f){return function(_0x4331dc){if(!_0x4331dc){_0x111e0c['sendStatus'](0x194);}return _0x4331dc;};}function handleError(_0x28dcb4,_0x47bb35){_0x47bb35=_0x47bb35||0x1f4;return function(_0x39dd63){logger[_0x550b('0x23')](_0x39dd63[_0x550b('0x24')]);if(_0x39dd63[_0x550b('0x25')]){delete _0x39dd63[_0x550b('0x25')];}_0x28dcb4[_0x550b('0x18')](_0x47bb35)[_0x550b('0x26')](_0x39dd63);};}exports[_0x550b('0x27')]=function(_0x35dd57,_0x2048d4){var _0x5580b2={},_0x347897={},_0x4aba12={'count':0x0,'rows':[]};var _0x22935e=_[_0x550b('0x28')](db['FaxApplication'][_0x550b('0x29')],function(_0x43d4c6){return{'name':_0x43d4c6[_0x550b('0x2a')],'type':_0x43d4c6[_0x550b('0x2b')][_0x550b('0x2c')]};});_0x347897[_0x550b('0x2d')]=_[_0x550b('0x28')](_0x22935e,_0x550b('0x25'));_0x347897['query']=_[_0x550b('0x2e')](_0x35dd57[_0x550b('0x2f')]);_0x347897['filters']=_['intersection'](_0x347897[_0x550b('0x2d')],_0x347897[_0x550b('0x2f')]);_0x5580b2[_0x550b('0x30')]=_[_0x550b('0x31')](_0x347897[_0x550b('0x2d')],qs[_0x550b('0x32')](_0x35dd57['query']['fields']));_0x5580b2[_0x550b('0x30')]=_0x5580b2[_0x550b('0x30')][_0x550b('0x33')]?_0x5580b2[_0x550b('0x30')]:_0x347897[_0x550b('0x2d')];if(!_0x35dd57[_0x550b('0x2f')]['hasOwnProperty']('nolimit')){_0x5580b2[_0x550b('0x1b')]=qs['limit'](_0x35dd57[_0x550b('0x2f')][_0x550b('0x1b')]);_0x5580b2[_0x550b('0x1a')]=qs[_0x550b('0x1a')](_0x35dd57[_0x550b('0x2f')][_0x550b('0x1a')]);}_0x5580b2[_0x550b('0x34')]=qs['sort'](_0x35dd57[_0x550b('0x2f')][_0x550b('0x35')]);_0x5580b2[_0x550b('0x36')]=qs[_0x550b('0x37')](_[_0x550b('0x38')](_0x35dd57[_0x550b('0x2f')],_0x347897[_0x550b('0x37')]),_0x22935e);if(_0x35dd57[_0x550b('0x2f')]['filter']){_0x5580b2[_0x550b('0x36')]=_[_0x550b('0x39')](_0x5580b2[_0x550b('0x36')],{'$or':_['map'](_0x22935e,function(_0x15da4e){if(_0x15da4e[_0x550b('0x2b')]!=='VIRTUAL'){var _0x54d718={};_0x54d718[_0x15da4e[_0x550b('0x25')]]={'$like':'%'+_0x35dd57[_0x550b('0x2f')][_0x550b('0x3a')]+'%'};return _0x54d718;}})});}_0x5580b2=_[_0x550b('0x39')]({},_0x5580b2,_0x35dd57[_0x550b('0x3b')]);var _0x5d496e={'where':_0x5580b2['where']};return db[_0x550b('0x3c')][_0x550b('0x1c')](_0x5d496e)[_0x550b('0x22')](function(_0x441be4){_0x4aba12[_0x550b('0x1c')]=_0x441be4;if(_0x35dd57[_0x550b('0x2f')][_0x550b('0x3d')]){_0x5580b2[_0x550b('0x3e')]=[{'all':!![]}];}return db['FaxApplication'][_0x550b('0x3f')](_0x5580b2);})[_0x550b('0x22')](function(_0x2b0217){_0x4aba12[_0x550b('0x40')]=_0x2b0217;return _0x4aba12;})[_0x550b('0x22')](respondWithFilteredResult(_0x2048d4,_0x5580b2))[_0x550b('0x41')](handleError(_0x2048d4,null));};exports[_0x550b('0x42')]=function(_0x26d166,_0x55f5dc){var _0x15940b={'raw':!![],'where':{'id':_0x26d166[_0x550b('0x43')]['id']}},_0x1b0bc2={};_0x1b0bc2[_0x550b('0x2d')]=_[_0x550b('0x2e')](db[_0x550b('0x3c')][_0x550b('0x29')]);_0x1b0bc2[_0x550b('0x2f')]=_[_0x550b('0x2e')](_0x26d166['query']);_0x1b0bc2[_0x550b('0x37')]=_[_0x550b('0x31')](_0x1b0bc2[_0x550b('0x2d')],_0x1b0bc2['query']);_0x15940b[_0x550b('0x30')]=_['intersection'](_0x1b0bc2[_0x550b('0x2d')],qs['fields'](_0x26d166[_0x550b('0x2f')]['fields']));_0x15940b['attributes']=_0x15940b[_0x550b('0x30')][_0x550b('0x33')]?_0x15940b[_0x550b('0x30')]:_0x1b0bc2[_0x550b('0x2d')];if(_0x26d166[_0x550b('0x2f')][_0x550b('0x3d')]){_0x15940b[_0x550b('0x3e')]=[{'all':!![]}];}_0x15940b=_['merge']({},_0x15940b,_0x26d166[_0x550b('0x3b')]);return db[_0x550b('0x3c')]['find'](_0x15940b)[_0x550b('0x22')](handleEntityNotFound(_0x55f5dc,null))['then'](respondWithResult(_0x55f5dc,null))[_0x550b('0x41')](handleError(_0x55f5dc,null));};exports[_0x550b('0x44')]=function(_0x48577a,_0x1d389b){return db[_0x550b('0x3c')][_0x550b('0x44')](_0x48577a['body'],{})[_0x550b('0x22')](respondWithResult(_0x1d389b,0xc9))[_0x550b('0x41')](handleError(_0x1d389b,null));};exports[_0x550b('0x21')]=function(_0x3f3ea0,_0xbc071b){if(_0x3f3ea0['body']['id']){delete _0x3f3ea0[_0x550b('0x45')]['id'];}return db[_0x550b('0x3c')]['find']({'where':{'id':_0x3f3ea0[_0x550b('0x43')]['id']}})['then'](handleEntityNotFound(_0xbc071b,null))['then'](saveUpdates(_0x3f3ea0[_0x550b('0x45')],null))[_0x550b('0x22')](respondWithResult(_0xbc071b,null))[_0x550b('0x41')](handleError(_0xbc071b,null));};exports['destroy']=function(_0x43b16a,_0x328f9b){return db[_0x550b('0x3c')][_0x550b('0x46')]({'where':{'id':_0x43b16a[_0x550b('0x43')]['id']}})[_0x550b('0x22')](handleEntityNotFound(_0x328f9b,null))[_0x550b('0x22')](removeEntity(_0x328f9b,null))[_0x550b('0x41')](handleError(_0x328f9b,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ba891c6..42c4a52 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 _0xd911=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x45d953,_0xc720fa){var _0x178996=function(_0xa060bf){while(--_0xa060bf){_0x45d953['push'](_0x45d953['shift']());}};_0x178996(++_0xc720fa);}(_0xd911,0x117));var _0x1d91=function(_0x3dd8dd,_0x369f8e){_0x3dd8dd=_0x3dd8dd-0x0;var _0x33e300=_0xd911[_0x3dd8dd];return _0x33e300;};'use strict';var _=require(_0x1d91('0x0'));var util=require(_0x1d91('0x1'));var logger=require(_0x1d91('0x2'))(_0x1d91('0x3'));var moment=require('moment');var BPromise=require(_0x1d91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d91('0x5'));var rimraf=require(_0x1d91('0x6'));var config=require(_0x1d91('0x7'));var attributes=require(_0x1d91('0x8'));module[_0x1d91('0x9')]=function(_0xbb34dc,_0x14d87d){return _0xbb34dc[_0x1d91('0xa')](_0x1d91('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1d91('0xc'),'collate':_0x1d91('0xd')});}; \ No newline at end of file +var _0x4534=['../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x4534,0x92));var _0x4453=function(_0xde15c5,_0x273bcf){_0xde15c5=_0xde15c5-0x0;var _0x2a7b0c=_0x4534[_0xde15c5];return _0x2a7b0c;};'use strict';var _=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var logger=require(_0x4453('0x2'))(_0x4453('0x3'));var moment=require('moment');var BPromise=require(_0x4453('0x4'));var rp=require(_0x4453('0x5'));var fs=require('fs');var path=require(_0x4453('0x6'));var rimraf=require(_0x4453('0x7'));var config=require(_0x4453('0x8'));var attributes=require(_0x4453('0x9'));module[_0x4453('0xa')]=function(_0x2313dc,_0xdfd41a){return _0x2313dc[_0x4453('0xb')]('FaxApplication',attributes,{'tableName':_0x4453('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4453('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 6a54b12..04433d4 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 _0x4751=['result','catch','UpdateFaxApplication','update','options','raw','where','attributes','limit','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x38b9eb,_0x298f2f){var _0x1426da=function(_0xbad634){while(--_0xbad634){_0x38b9eb['push'](_0x38b9eb['shift']());}};_0x1426da(++_0x298f2f);}(_0x4751,0x85));var _0x1475=function(_0x34c8ec,_0x98a785){_0x34c8ec=_0x34c8ec-0x0;var _0x6a128=_0x4751[_0x34c8ec];return _0x6a128;};'use strict';var _=require(_0x1475('0x0'));var util=require('util');var moment=require(_0x1475('0x1'));var BPromise=require(_0x1475('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1475('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1475('0x4'));var logger=require(_0x1475('0x5'))(_0x1475('0x6'));var config=require(_0x1475('0x7'));var jayson=require(_0x1475('0x8'));var client=jayson[_0x1475('0x9')][_0x1475('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23025e,_0x3bc1cf,_0x4f604e){return new BPromise(function(_0x7fd232,_0x25a413){return client[_0x1475('0xb')](_0x23025e,_0x4f604e)[_0x1475('0xc')](function(_0x308c61){logger[_0x1475('0xd')](_0x1475('0xe'),_0x3bc1cf,_0x1475('0xf'));logger[_0x1475('0x10')](_0x1475('0x11'),_0x3bc1cf,_0x1475('0xf'),JSON[_0x1475('0x12')](_0x308c61));if(_0x308c61['error']){if(_0x308c61[_0x1475('0x13')][_0x1475('0x14')]===0x1f4){logger[_0x1475('0x13')](_0x1475('0xe'),_0x3bc1cf,_0x308c61['error'][_0x1475('0x15')]);return _0x25a413(_0x308c61[_0x1475('0x13')][_0x1475('0x15')]);}logger[_0x1475('0x13')](_0x1475('0xe'),_0x3bc1cf,_0x308c61[_0x1475('0x13')][_0x1475('0x15')]);return _0x7fd232(_0x308c61[_0x1475('0x13')][_0x1475('0x15')]);}else{logger[_0x1475('0xd')](_0x1475('0xe'),_0x3bc1cf,_0x1475('0xf'));_0x7fd232(_0x308c61[_0x1475('0x16')]['message']);}})[_0x1475('0x17')](function(_0x391c89){logger[_0x1475('0x13')]('FaxApplication,\x20%s,\x20%s',_0x3bc1cf,_0x391c89);_0x25a413(_0x391c89);});});}exports[_0x1475('0x18')]=function(_0x2cf1ac){var _0x351908=this;return new Promise(function(_0x57253f,_0x4e6d23){return db['FaxApplication'][_0x1475('0x19')](_0x2cf1ac['body'],{'raw':_0x2cf1ac[_0x1475('0x1a')]?_0x2cf1ac[_0x1475('0x1a')][_0x1475('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cf1ac[_0x1475('0x1a')]?_0x2cf1ac[_0x1475('0x1a')][_0x1475('0x1c')]||null:null,'attributes':_0x2cf1ac['options']?_0x2cf1ac[_0x1475('0x1a')][_0x1475('0x1d')]||null:null,'limit':_0x2cf1ac['options']?_0x2cf1ac[_0x1475('0x1a')][_0x1475('0x1e')]||null:null})[_0x1475('0xc')](function(_0x5346da){logger[_0x1475('0xd')](_0x1475('0x18'),_0x2cf1ac);logger[_0x1475('0x10')](_0x1475('0x18'),_0x2cf1ac,JSON[_0x1475('0x12')](_0x5346da));_0x57253f(_0x5346da);})[_0x1475('0x17')](function(_0x35a0dc){logger[_0x1475('0x13')]('UpdateFaxApplication',_0x35a0dc[_0x1475('0x15')],_0x2cf1ac);_0x4e6d23(_0x351908[_0x1475('0x13')](0x1f4,_0x35a0dc['message']));});});}; \ No newline at end of file +var _0x2d44=['raw','attributes','limit','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','UpdateFaxApplication','update','body','options'];(function(_0x255987,_0x27c0dd){var _0x42fb16=function(_0x355254){while(--_0x355254){_0x255987['push'](_0x255987['shift']());}};_0x42fb16(++_0x27c0dd);}(_0x2d44,0x1c4));var _0x42d4=function(_0x287c5,_0x2d0942){_0x287c5=_0x287c5-0x0;var _0x422a7b=_0x2d44[_0x287c5];return _0x422a7b;};'use strict';var _=require(_0x42d4('0x0'));var util=require(_0x42d4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x42d4('0x2'));var fs=require('fs');var Redis=require(_0x42d4('0x3'));var db=require(_0x42d4('0x4'))['db'];var utils=require(_0x42d4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x42d4('0x6'));var jayson=require(_0x42d4('0x7'));var client=jayson[_0x42d4('0x8')][_0x42d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27c491,_0x46c666,_0x4cdc07){return new BPromise(function(_0x10ef05,_0x2fd7f9){return client[_0x42d4('0xa')](_0x27c491,_0x4cdc07)[_0x42d4('0xb')](function(_0x5ad318){logger[_0x42d4('0xc')](_0x42d4('0xd'),_0x46c666,_0x42d4('0xe'));logger[_0x42d4('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x46c666,_0x42d4('0xe'),JSON[_0x42d4('0x10')](_0x5ad318));if(_0x5ad318['error']){if(_0x5ad318[_0x42d4('0x11')]['code']===0x1f4){logger[_0x42d4('0x11')](_0x42d4('0xd'),_0x46c666,_0x5ad318['error']['message']);return _0x2fd7f9(_0x5ad318[_0x42d4('0x11')]['message']);}logger['error'](_0x42d4('0xd'),_0x46c666,_0x5ad318['error'][_0x42d4('0x12')]);return _0x10ef05(_0x5ad318['error']['message']);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x46c666,_0x42d4('0xe'));_0x10ef05(_0x5ad318[_0x42d4('0x13')][_0x42d4('0x12')]);}})['catch'](function(_0x44d255){logger[_0x42d4('0x11')](_0x42d4('0xd'),_0x46c666,_0x44d255);_0x2fd7f9(_0x44d255);});});}exports[_0x42d4('0x14')]=function(_0x3ad0d7){var _0x2ed30f=this;return new Promise(function(_0x2259ac,_0x15eba0){return db['FaxApplication'][_0x42d4('0x15')](_0x3ad0d7[_0x42d4('0x16')],{'raw':_0x3ad0d7[_0x42d4('0x17')]?_0x3ad0d7[_0x42d4('0x17')][_0x42d4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad0d7[_0x42d4('0x17')]?_0x3ad0d7[_0x42d4('0x17')]['where']||null:null,'attributes':_0x3ad0d7[_0x42d4('0x17')]?_0x3ad0d7[_0x42d4('0x17')][_0x42d4('0x19')]||null:null,'limit':_0x3ad0d7['options']?_0x3ad0d7[_0x42d4('0x17')][_0x42d4('0x1a')]||null:null})[_0x42d4('0xb')](function(_0x5a8790){logger['info'](_0x42d4('0x14'),_0x3ad0d7);logger[_0x42d4('0xf')](_0x42d4('0x14'),_0x3ad0d7,JSON[_0x42d4('0x10')](_0x5a8790));_0x2259ac(_0x5a8790);})[_0x42d4('0x1b')](function(_0x161f90){logger[_0x42d4('0x11')](_0x42d4('0x14'),_0x161f90[_0x42d4('0x12')],_0x3ad0d7);_0x15eba0(_0x2ed30f[_0x42d4('0x11')](0x1f4,_0x161f90[_0x42d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 2f6f754..7425a8b 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 _0xf7b4=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2a7fa8,_0x413c0e){_0x2a7fa8=_0x2a7fa8-0x0;var _0xf7e306=_0xf7b4[_0x2a7fa8];return _0xf7e306;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x8')](),controller['create']);router[_0x4f7b('0xd')](_0x4f7b('0xa'),auth['isAuthenticated'](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3423=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','path','connect-timeout','express','Router'];(function(_0x3a486c,_0x429ebc){var _0x24abe6=function(_0x2ceb00){while(--_0x2ceb00){_0x3a486c['push'](_0x3a486c['shift']());}};_0x24abe6(++_0x429ebc);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0xe')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xf')]);router['put']('/:id',auth[_0x3342('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3342('0x10')]);module[_0x3342('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1095e2c..d33a466 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 _0xcf4d=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x259a8f,_0x702d0d){var _0x40ed19=function(_0x921815){while(--_0x921815){_0x259a8f['push'](_0x259a8f['shift']());}};_0x40ed19(++_0x702d0d);}(_0xcf4d,0xdf));var _0xdcf4=function(_0x39dd58,_0x520b5d){_0x39dd58=_0x39dd58-0x0;var _0x146cb2=_0xcf4d[_0x39dd58];return _0x146cb2;};'use strict';var Sequelize=require(_0xdcf4('0x0'));module[_0xdcf4('0x1')]={'closed':{'type':Sequelize[_0xdcf4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xdcf4('0x3')]},'note':{'type':Sequelize[_0xdcf4('0x3')]},'read1stAt':{'type':Sequelize[_0xdcf4('0x4')]},'fax':{'type':Sequelize[_0xdcf4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdcf4('0x5')]('in',_0xdcf4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xdcf4('0x5')]('in',_0xdcf4('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xc14b=['STRING','DATE','ENUM','out','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc14b,0x12b));var _0xbc14=function(_0x5ef7b8,_0x15cc07){_0x5ef7b8=_0x5ef7b8-0x0;var _0x2c7148=_0xc14b[_0x5ef7b8];return _0x2c7148;};'use strict';var Sequelize=require('sequelize');module[_0xbc14('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbc14('0x1')]},'secondDisposition':{'type':Sequelize[_0xbc14('0x1')]},'thirdDisposition':{'type':Sequelize[_0xbc14('0x1')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbc14('0x2')]},'fax':{'type':Sequelize[_0xbc14('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xbc14('0x3')]('in',_0xbc14('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbc14('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbc14('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 e701c16..463d786 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 _0x3054=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','Users','map','TagIds','Tags','forEach','push','catch','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','conditions','length','find','unreadMessages','value','having','`\x20=\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','start','some','compact','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','clone','contactName','DESC','t.id\x20IN\x20?','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','FaxInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','FaxInteractionId','merge','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x422a5f,_0x2d6362){var _0x245bee=function(_0x2dc25f){while(--_0x2dc25f){_0x422a5f['push'](_0x422a5f['shift']());}};_0x245bee(++_0x2d6362);}(_0x3054,0x1aa));var _0x4305=function(_0x16075d,_0xa64b2a){_0x16075d=_0x16075d-0x0;var _0x16af78=_0x3054[_0x16075d];return _0x16af78;};'use strict';var emlformat=require(_0x4305('0x0'));var rimraf=require(_0x4305('0x1'));var zipdir=require(_0x4305('0x2'));var jsonpatch=require(_0x4305('0x3'));var rp=require(_0x4305('0x4'));var moment=require(_0x4305('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4305('0x6'));var util=require(_0x4305('0x7'));var path=require('path');var sox=require(_0x4305('0x8'));var csv=require(_0x4305('0x9'));var ejs=require(_0x4305('0xa'));var fs=require('fs');var fs_extra=require(_0x4305('0xb'));var _=require('lodash');var squel=require(_0x4305('0xc'));var crypto=require(_0x4305('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4305('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4305('0xf'));var Redis=require(_0x4305('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4305('0x11'));var as=require(_0x4305('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4305('0x13'))(_0x4305('0x14'));var utils=require(_0x4305('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4305('0x16'));var db=require(_0x4305('0x17'))['db'];config[_0x4305('0x18')]=_[_0x4305('0x19')](config[_0x4305('0x18')],{'host':_0x4305('0x1a'),'port':0x18eb});var socket=require(_0x4305('0x1b'))(new Redis(config['redis']));require(_0x4305('0x1c'))[_0x4305('0x1d')](socket);function respondWithStatusCode(_0xb9146b,_0x587bd4){_0x587bd4=_0x587bd4||0xcc;return function(_0x299ef8){if(_0x299ef8){return _0xb9146b[_0x4305('0x1e')](_0x587bd4);}return _0xb9146b[_0x4305('0x1f')](_0x587bd4)[_0x4305('0x20')]();};}function respondWithResult(_0x2f2b08,_0x32e02b){_0x32e02b=_0x32e02b||0xc8;return function(_0x4d8375){if(_0x4d8375){return _0x2f2b08[_0x4305('0x1f')](_0x32e02b)['json'](_0x4d8375);}};}function respondWithFilteredResult(_0x4eb833,_0x167b7a){return function(_0x26bb21){if(_0x26bb21){var _0xed792f=typeof _0x167b7a['offset']==='undefined'&&typeof _0x167b7a[_0x4305('0x21')]===_0x4305('0x22');var _0x198d44=_0x26bb21['count'];var _0x38cd2e=_0xed792f?0x0:_0x167b7a[_0x4305('0x23')];var _0x57f648=_0xed792f?_0x26bb21[_0x4305('0x24')]:_0x167b7a[_0x4305('0x23')]+_0x167b7a[_0x4305('0x21')];var _0x1d5580;if(_0x57f648>=_0x198d44){_0x57f648=_0x198d44;_0x1d5580=0xc8;}else{_0x1d5580=0xce;}_0x4eb833[_0x4305('0x1f')](_0x1d5580);return _0x4eb833[_0x4305('0x25')](_0x4305('0x26'),_0x38cd2e+'-'+_0x57f648+'/'+_0x198d44)[_0x4305('0x27')](_0x26bb21);}return null;};}function patchUpdates(_0x2a58cb){return function(_0x55e753){try{jsonpatch[_0x4305('0x28')](_0x55e753,_0x2a58cb,!![]);}catch(_0x445abc){return BPromise[_0x4305('0x29')](_0x445abc);}return _0x55e753[_0x4305('0x2a')]();};}function saveUpdates(_0x1f81cd,_0x5ae60d){return function(_0x1eb9b1){if(_0x1eb9b1){return _0x1eb9b1[_0x4305('0x2b')](_0x1f81cd)[_0x4305('0x2c')](function(_0x4c6740){return _0x4c6740;});}return null;};}function removeEntity(_0x41ec28,_0xf4632){return function(_0x15f208){if(_0x15f208){return _0x15f208[_0x4305('0x2d')]()[_0x4305('0x2c')](function(){_0x41ec28[_0x4305('0x1f')](0xcc)[_0x4305('0x20')]();});}};}function handleEntityNotFound(_0x246ebc,_0x41eb8d){return function(_0x4d6c0d){if(!_0x4d6c0d){_0x246ebc[_0x4305('0x1e')](0x194);}return _0x4d6c0d;};}function handleError(_0x1227ad,_0x378d50){_0x378d50=_0x378d50||0x1f4;return function(_0x130ba4){logger[_0x4305('0x2e')](_0x130ba4['stack']);if(_0x130ba4[_0x4305('0x2f')]){delete _0x130ba4[_0x4305('0x2f')];}_0x1227ad['status'](_0x378d50)['send'](_0x130ba4);};}function getInteractionUsers(_0x34ada9,_0x3c4bcb){return new BPromise(function(_0x106d1e,_0x3cb020){try{if(_0x3c4bcb[_0x34ada9['id']]){_0x34ada9[_0x4305('0x30')]=_[_0x4305('0x31')](_0x3c4bcb[_0x34ada9['id']],function(_0xde8349){return{'id':_0xde8349['id'],'fullname':_0xde8349['fullname']};});}}catch(_0x3a55e4){_0x3cb020(_0x3a55e4);}_0x106d1e(_0x34ada9);});}function getInteractionTags(_0x4862e2,_0x37d6db){return new BPromise(function(_0x5626b1,_0x3125ff){try{if(_0x4862e2[_0x4305('0x32')]){_0x4862e2[_0x4305('0x33')]=[];_0x4862e2[_0x4305('0x32')]['split'](',')[_0x4305('0x34')](function(_0x57bc64){_0x4862e2[_0x4305('0x33')][_0x4305('0x35')](_0x37d6db[_0x57bc64]);});}delete _0x4862e2[_0x4305('0x32')];}catch(_0x517245){_0x3125ff(_0x517245);}_0x5626b1(_0x4862e2);});}function updateFaxInteraction(_0x236c20,_0x243389,_0x314a84){return new BPromise(function(_0x5340bc,_0x21edee){return getInteractionUsers(_0x236c20,_0x314a84)[_0x4305('0x2c')](function(_0x5dd543){return getInteractionTags(_0x5dd543,_0x243389);})[_0x4305('0x2c')](function(_0x43b843){_0x5340bc(_0x43b843);})[_0x4305('0x36')](function(_0x13472b){_0x21edee(_0x13472b);});});}exports[_0x4305('0x37')]=function(_0x58ba6f,_0x1201fa){var _0x32f75b={},_0x370a17={},_0xaacec7={'count':0x0,'rows':[]};var _0x5874a5=_['map'](db['FaxInteraction'][_0x4305('0x38')],function(_0x30b802){return{'name':_0x30b802[_0x4305('0x39')],'type':_0x30b802[_0x4305('0x3a')]['key']};});_0x370a17[_0x4305('0x3b')]=_[_0x4305('0x31')](_0x5874a5,_0x4305('0x2f'));_0x370a17[_0x4305('0x3c')]=_[_0x4305('0x3d')](_0x58ba6f[_0x4305('0x3c')]);_0x370a17[_0x4305('0x3e')]=_[_0x4305('0x3f')](_0x370a17[_0x4305('0x3b')],_0x370a17[_0x4305('0x3c')]);_0x32f75b[_0x4305('0x40')]=_['intersection'](_0x370a17[_0x4305('0x3b')],qs[_0x4305('0x41')](_0x58ba6f[_0x4305('0x3c')][_0x4305('0x41')]));_0x32f75b[_0x4305('0x40')]=_0x32f75b['attributes']['length']?_0x32f75b[_0x4305('0x40')]:_0x370a17[_0x4305('0x3b')];if(!_0x58ba6f[_0x4305('0x3c')][_0x4305('0x42')](_0x4305('0x43'))){_0x32f75b[_0x4305('0x21')]=qs['limit'](_0x58ba6f['query'][_0x4305('0x21')]);_0x32f75b['offset']=qs['offset'](_0x58ba6f[_0x4305('0x3c')]['offset']);}_0x32f75b[_0x4305('0x44')]=qs[_0x4305('0x45')](_0x58ba6f[_0x4305('0x3c')][_0x4305('0x45')]);_0x32f75b[_0x4305('0x46')]=qs[_0x4305('0x3e')](_[_0x4305('0x47')](_0x58ba6f['query'],_0x370a17['filters']),_0x5874a5);var _0x9d2095=[];var _0x52d437=squel[_0x4305('0x48')]()[_0x4305('0x49')]('id')[_0x4305('0x49')](_0x4305('0x2f'))[_0x4305('0x49')](_0x4305('0x4a'))['from'](_0x4305('0x4b'));var _0x26dea0=squel[_0x4305('0x48')]()[_0x4305('0x49')](_0x4305('0x4c'))[_0x4305('0x49')](_0x4305('0x4d'))[_0x4305('0x49')](_0x4305('0x4e'))[_0x4305('0x4f')]('user_has_fax_interactions','ui')[_0x4305('0x50')](_0x4305('0x51'),'u',_0x4305('0x52'));var _0x2d73ab=squel[_0x4305('0x48')]()[_0x4305('0x4f')](_0x4305('0x53'),'i')['left_join'](_0x4305('0x54'),'c',_0x4305('0x55'))[_0x4305('0x50')](_0x4305('0x51'),'o','o.id\x20=\x20i.UserId')[_0x4305('0x50')](_0x4305('0x56'),'a',_0x4305('0x57'))[_0x4305('0x50')](_0x4305('0x58'),'me',_0x4305('0x59'))[_0x4305('0x50')]('fax_interaction_has_tags','it',_0x4305('0x5a'))[_0x4305('0x50')](_0x4305('0x4b'),'t',_0x4305('0x5b'));var _0x173aae=squel[_0x4305('0x5c')]();var _0x3ef75f=[];var _0x1b87cb=squel['expr']();var _0x45d5cb;if(_0x58ba6f[_0x4305('0x3c')]['search']){_0x45d5cb=as['parseSearch'](_0x58ba6f[_0x4305('0x3c')]['search']);var _0x5bf994=_0x45d5cb['sqlOperator'];for(var _0x34efb2=0x0;_0x34efb2<_0x45d5cb[_0x4305('0x5d')][_0x4305('0x5e')];_0x34efb2++){var _0x3872eb=_0x45d5cb['conditions'][_0x34efb2];var _0xb8a95d='i';var _0x4dcc0b=_[_0x4305('0x5f')](_0x5874a5,[_0x4305('0x2f'),_0x3872eb[_0x4305('0x49')]]);if(!_0x4dcc0b){switch(_0x3872eb[_0x4305('0x49')]){case _0x4305('0x60'):if(_0x3872eb[_0x4305('0x61')]==0x1){_0x2d73ab[_0x4305('0x62')]('`'+_0x3872eb['field']+_0x4305('0x63'));}else{_0x2d73ab['having']('`'+_0x3872eb[_0x4305('0x49')]+'`\x20>\x200');}break;case'Contact':if(_0x3872eb[_0x4305('0x64')]===_0x4305('0x65')){if(_0x3872eb[_0x4305('0x61')][_0x4305('0x66')]('\x20')['length']>0x1){_0x173aae[_0x5bf994](_0x4305('0x67'),qs[_0x4305('0x68')](_0x3872eb[_0x4305('0x61')]),null);}else{var _0x4ff4ea='%'+_0x3872eb[_0x4305('0x61')]+'%';_0x173aae[_0x5bf994](_0x4305('0x69'),_0x4ff4ea,_0x4ff4ea,_0x4ff4ea);}}else{_0x4dcc0b=_['find'](_0x5874a5,[_0x4305('0x2f'),_0x4305('0x6a')]);_0x3872eb[_0x4305('0x49')]=_0x4305('0x6a');_0x1be5a8=as['buildExpression'](_0xb8a95d,_0x4dcc0b[_0x4305('0x3a')],_0x3872eb);_0x173aae[_0x5bf994](_0x1be5a8['text'],_0x1be5a8['value']['start'],_0x1be5a8[_0x4305('0x61')][_0x4305('0x20')]);}break;case _0x4305('0x6b'):var _0x3e2eae=_0x3872eb[_0x4305('0x61')][_0x4305('0x66')](',')[_0x4305('0x31')](function(_0x39609d){return Number(_0x39609d);});_0x3e2eae[_0x4305('0x34')](function(_0x25740a){_0x1b87cb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x25740a+',%');});_0x3ef75f=_[_0x4305('0x6c')](_0x3ef75f,_0x3e2eae);break;case _0x4305('0x6d'):if(_0x3872eb[_0x4305('0x64')]===_0x4305('0x65')){_0x173aae[_0x5bf994](_0x4305('0x6e'),'%'+_0x3872eb['value']+'%',null);}else{_0x4dcc0b=_['find'](_0x5874a5,[_0x4305('0x2f'),_0x4305('0x6f')]);_0x3872eb[_0x4305('0x49')]=_0x4305('0x6f');_0x1be5a8=as[_0x4305('0x70')](_0xb8a95d,_0x4dcc0b['type'],_0x3872eb);_0x173aae[_0x5bf994](_0x1be5a8[_0x4305('0x71')],_0x1be5a8[_0x4305('0x61')]['start'],_0x1be5a8[_0x4305('0x61')][_0x4305('0x20')]);}break;case _0x4305('0x72'):_0x1be5a8=as[_0x4305('0x70')]('me',null,_0x3872eb);_0x173aae[_0x5bf994](_0x1be5a8[_0x4305('0x71')],_0x1be5a8[_0x4305('0x61')][_0x4305('0x73')],_0x1be5a8[_0x4305('0x61')][_0x4305('0x20')]);break;}}else{var _0x1be5a8=as[_0x4305('0x70')](_0xb8a95d,_0x4dcc0b['type'],_0x3872eb);_0x173aae[_0x5bf994](_0x1be5a8[_0x4305('0x71')],_0x1be5a8[_0x4305('0x61')][_0x4305('0x73')],_0x1be5a8['value'][_0x4305('0x20')]);}}}else{var _0x26dfae=_(_0x58ba6f[_0x4305('0x3c')])['keys']()[_0x4305('0x31')](function(_0x5815aa){return _[_0x4305('0x74')](_0x5874a5,['name',_0x5815aa])?_0x5815aa:undefined;})[_0x4305('0x75')]()[_0x4305('0x61')]();if(!_['isEmpty'](_0x26dfae)){_0x26dfae[_0x4305('0x34')](function(_0x1ff9a2){if(_0x1ff9a2==='FaxAccountId'){_0x2d73ab['where'](_0x4305('0x76'),[][_0x4305('0x77')](_0x58ba6f['query'][_0x1ff9a2]));}else if(_0x1ff9a2==='createdAt'){var _0x24f80f=JSON[_0x4305('0x78')](_0x58ba6f[_0x4305('0x3c')][_0x1ff9a2])['$gte'];var _0x23c91c=JSON[_0x4305('0x78')](_0x58ba6f[_0x4305('0x3c')][_0x1ff9a2])[_0x4305('0x79')];_0x2d73ab[_0x4305('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x24f80f,_0x23c91c);}else{if(_0x58ba6f[_0x4305('0x3c')][_0x1ff9a2]===_0x4305('0x7a')){_0x2d73ab[_0x4305('0x46')]('i.'+_0x1ff9a2+_0x4305('0x7b'));}else{_0x2d73ab[_0x4305('0x46')]('i.'+_0x1ff9a2+_0x4305('0x7c'),_0x58ba6f['query'][_0x1ff9a2]);}}});}if(_0x58ba6f['query'][_0x4305('0x7d')]){if(_0x58ba6f[_0x4305('0x3c')][_0x4305('0x7d')]==0x1){_0x2d73ab['having'](_0x4305('0x7e'));}else{_0x2d73ab[_0x4305('0x62')](_0x4305('0x7f'));}}if(_0x58ba6f[_0x4305('0x3c')]['tag']){_0x3ef75f=_[_0x4305('0x80')](_0x58ba6f['query'][_0x4305('0x81')])?_0x58ba6f[_0x4305('0x3c')][_0x4305('0x81')]:new Array(_0x58ba6f['query']['tag']);_0x3ef75f[_0x4305('0x34')](function(_0x1faf28){_0x1b87cb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1faf28+',%');});}if(_0x58ba6f[_0x4305('0x3c')][_0x4305('0x82')]){var _0x5033e8=_0x58ba6f[_0x4305('0x3c')][_0x4305('0x82')][_0x4305('0x83')]('\x5c','\x5c\x5c')[_0x4305('0x83')](/'/g,'\x27\x27');if(qs[_0x4305('0x84')](_0x5033e8)){_0x173aae['or'](_0x4305('0x85'),_0x5033e8+'%')['or'](_0x4305('0x86'),_0x5033e8+'%');}_0x173aae['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5033e8+'%');}}_0x2d73ab[_0x4305('0x46')](_0x173aae);_0x2d73ab[_0x4305('0x87')](_0x4305('0x88'));var _0x452652={'type':db[_0x4305('0x89')]['QueryTypes']['SELECT'],'raw':!![]};var _0x27f9e6=_0x2d73ab[_0x4305('0x8a')]();_0x27f9e6[_0x4305('0x49')]('i.id');_0x27f9e6[_0x4305('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4305('0x60'));if(_0x32f75b[_0x4305('0x44')]){_0x32f75b[_0x4305('0x44')][_0x4305('0x34')](function(_0xd3b5f4){var _0x2f1083=_0xd3b5f4[0x0]===_0x4305('0x8b')?_0xd3b5f4[0x0]:'i.'+_0xd3b5f4[0x0];_0x2d73ab['order'](_0x2f1083,_0xd3b5f4[0x1]===_0x4305('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x3ef75f)){_0x2d73ab[_0x4305('0x62')](_0x1b87cb);_0x27f9e6[_0x4305('0x46')](_0x4305('0x8d'),_0x3ef75f);}BPromise['resolve']()[_0x4305('0x2c')](function(){if(!_0x45d5cb){if(_0x58ba6f[_0x4305('0x3c')][_0x4305('0x8e')])return;_0x27f9e6['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x2d73ab[_0x4305('0x46')](_0x4305('0x8f'));return;}if(_0x58ba6f[_0x4305('0x90')]['role']!==_0x4305('0x91'))return;return _0x58ba6f[_0x4305('0x90')][_0x4305('0x92')]({'attributes':['id'],'raw':!![]})[_0x4305('0x2c')](function(_0x19c538){if(_[_0x4305('0x93')](_0x19c538)){_0x27f9e6['where'](_0x4305('0x94'));_0x2d73ab[_0x4305('0x46')](_0x4305('0x94'));}else{_0x27f9e6[_0x4305('0x46')]('i.FaxAccountId\x20IN\x20?',_[_0x4305('0x31')](_0x19c538,'id'));_0x2d73ab[_0x4305('0x46')](_0x4305('0x76'),_[_0x4305('0x31')](_0x19c538,'id'));}});})[_0x4305('0x2c')](function(){if(_0x58ba6f[_0x4305('0x90')]['role']===_0x4305('0x91')&&!_0x45d5cb&&!_0x58ba6f['query']['FaxAccountId'])return[];return db[_0x4305('0x95')][_0x4305('0x3c')](_0x27f9e6[_0x4305('0x96')](),_0x452652);})[_0x4305('0x2c')](function(_0x4c905b){_0xaacec7[_0x4305('0x24')]=_0x4c905b[_0x4305('0x5e')];if(_0xaacec7[_0x4305('0x24')]===0x0)return[];return db[_0x4305('0x95')][_0x4305('0x3c')](_0x52d437[_0x4305('0x96')](),_0x452652)[_0x4305('0x2c')](function(_0x40ad49){_0x9d2095=_['keyBy'](_0x40ad49,'id');_0x452652=_['merge'](_0x452652,{'model':db[_0x4305('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x58ba6f['query'][_0x4305('0x41')]){_0x32f75b['attributes'][_0x4305('0x34')](function(_0x3d89d1){_0x2d73ab[_0x4305('0x49')]('i.'+_0x3d89d1);});}else{_0x2d73ab[_0x4305('0x49')](_0x4305('0x98'),'unreadMessages');_0x2d73ab[_0x4305('0x49')](_0x4305('0x99'),_0x4305('0x9a'));_0x2d73ab[_0x4305('0x49')](_0x4305('0x9b'),'Account.mandatoryDisposition');_0x2d73ab['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');_0x2d73ab[_0x4305('0x49')](_0x4305('0x9c'));_0x2d73ab[_0x4305('0x49')](_0x4305('0x9d'),_0x4305('0x9e'));_0x2d73ab[_0x4305('0x49')](_0x4305('0x9f'),_0x4305('0xa0'));_0x2d73ab['field'](_0x4305('0xa1'),'Contact.email');_0x2d73ab[_0x4305('0x49')]('c.phone',_0x4305('0xa2'));_0x2d73ab[_0x4305('0x49')]('c.mobile',_0x4305('0xa3'));_0x2d73ab[_0x4305('0x49')](_0x4305('0xa4'),_0x4305('0xa5'));_0x2d73ab[_0x4305('0x49')](_0x4305('0xa6'),'Owner.fullname');_0x2d73ab[_0x4305('0x49')]('o.internal',_0x4305('0xa7'));_0x2d73ab[_0x4305('0x49')](_0x4305('0xa8'),'TagIds');}if(_0x32f75b[_0x4305('0x21')])_0x2d73ab['limit'](_0x32f75b['limit']);if(_0x32f75b['offset'])_0x2d73ab[_0x4305('0x23')](_0x32f75b[_0x4305('0x23')]);return db['sequelize'][_0x4305('0x3c')](_0x2d73ab['toString'](),_0x452652);})[_0x4305('0x2c')](function(_0x360e13){if(_0x360e13[_0x4305('0x5e')]>0x0)_0x26dea0[_0x4305('0x46')](_0x4305('0xa9'),_[_0x4305('0x31')](_0x360e13,'id'));return db['sequelize'][_0x4305('0x3c')](_0x26dea0[_0x4305('0x96')](),_0x452652)['then'](function(_0xcc8f93){var _0x2f5b88=_[_0x4305('0xaa')](_0xcc8f93,'FaxInteractionId');var _0x2aec73=[];_0x360e13[_0x4305('0x34')](function(_0x476b36){_0x2aec73[_0x4305('0x35')](updateFaxInteraction(_0x476b36,_0x9d2095,_0x2f5b88));});return BPromise[_0x4305('0xab')](_0x2aec73);});});})['then'](function(_0x577b42){_0xaacec7[_0x4305('0xac')]=_0x577b42;return _0xaacec7;})['then'](respondWithFilteredResult(_0x1201fa,_0x32f75b))['catch'](handleError(_0x1201fa,null));};exports[_0x4305('0xad')]=function(_0x180463,_0x9309d0){var _0x20975a={'raw':![],'where':{'id':_0x180463[_0x4305('0xae')]['id']}},_0x5256c7={};_0x5256c7[_0x4305('0x3b')]=_[_0x4305('0x3d')](db[_0x4305('0x97')][_0x4305('0x38')]);_0x5256c7[_0x4305('0x3c')]=_[_0x4305('0x3d')](_0x180463['query']);_0x5256c7[_0x4305('0x3e')]=_[_0x4305('0x3f')](_0x5256c7[_0x4305('0x3b')],_0x5256c7[_0x4305('0x3c')]);_0x20975a['attributes']=_[_0x4305('0x3f')](_0x5256c7[_0x4305('0x3b')],qs['fields'](_0x180463[_0x4305('0x3c')][_0x4305('0x41')]));_0x20975a['attributes']=_0x20975a[_0x4305('0x40')][_0x4305('0x5e')]?_0x20975a[_0x4305('0x40')]:_0x5256c7[_0x4305('0x3b')];if(_0x180463[_0x4305('0x3c')][_0x4305('0xaf')]){_0x20975a[_0x4305('0xb0')]=[{'all':!![]}];}_0x20975a=_['merge']({},_0x20975a,_0x180463[_0x4305('0xb1')]);return db[_0x4305('0x97')][_0x4305('0x5f')](_0x20975a)[_0x4305('0x2c')](handleEntityNotFound(_0x9309d0,null))[_0x4305('0x2c')](respondWithResult(_0x9309d0,null))[_0x4305('0x36')](handleError(_0x9309d0,null));};exports[_0x4305('0xb2')]=function(_0x2d810d,_0xae40e3){return db[_0x4305('0x97')][_0x4305('0xb2')](_0x2d810d[_0x4305('0x72')],{})[_0x4305('0x2c')](respondWithResult(_0xae40e3,0xc9))[_0x4305('0x36')](handleError(_0xae40e3,null));};exports[_0x4305('0x2b')]=function(_0x2396d5,_0xef1d85){if(_0x2396d5[_0x4305('0x72')]['id']){delete _0x2396d5[_0x4305('0x72')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x2396d5[_0x4305('0xae')]['id']}})[_0x4305('0x2c')](handleEntityNotFound(_0xef1d85,null))[_0x4305('0x2c')](saveUpdates(_0x2396d5[_0x4305('0x72')],null))[_0x4305('0x2c')](respondWithResult(_0xef1d85,null))[_0x4305('0x36')](handleError(_0xef1d85,null));};exports[_0x4305('0x2d')]=function(_0x4a894f,_0xe62cac){return db[_0x4305('0x97')][_0x4305('0x5f')]({'where':{'id':_0x4a894f[_0x4305('0xae')]['id']}})[_0x4305('0x2c')](handleEntityNotFound(_0xe62cac,null))[_0x4305('0x2c')](removeEntity(_0xe62cac,null))[_0x4305('0x36')](handleError(_0xe62cac,null));};exports[_0x4305('0xb3')]=function(_0x2b5d1c,_0x447ee3){return db['FaxInteraction'][_0x4305('0xb3')]()['then'](respondWithResult(_0x447ee3,null))['catch'](handleError(_0x447ee3,null));};exports[_0x4305('0xb4')]=function(_0xf65821,_0x47f34b,_0x12b5ba){return db[_0x4305('0xb5')]['find']({'where':{'id':_0xf65821[_0x4305('0xae')]['id']}})[_0x4305('0x2c')](handleEntityNotFound(_0x47f34b,null))[_0x4305('0x2c')](function(_0x4ca468){if(_0x4ca468){return _0x4ca468[_0x4305('0xb4')](_0xf65821['body'][_0x4305('0xb6')],_['omit'](_0xf65821[_0x4305('0x72')],[_0x4305('0xb6'),'id'])||{});}})[_0x4305('0x2c')](respondWithResult(_0x47f34b,null))[_0x4305('0x36')](handleError(_0x47f34b,null));};exports[_0x4305('0xb7')]=function(_0xeef224,_0x5c96c2,_0x454b54){var _0x30cac6={'raw':![],'where':{}};var _0x3bc5f9={};var _0x2b0b87={'count':0x0,'rows':[]};return db[_0x4305('0x97')][_0x4305('0xb8')]({'where':{'id':_0xeef224['params']['id']}})[_0x4305('0x2c')](handleEntityNotFound(_0x5c96c2,null))[_0x4305('0x2c')](function(_0x5437d6){if(_0x5437d6){_0x3bc5f9['model']=_[_0x4305('0x3d')](db[_0x4305('0xb5')][_0x4305('0x38')]);_0x3bc5f9[_0x4305('0x3c')]=_[_0x4305('0x3d')](_0xeef224[_0x4305('0x3c')]);_0x3bc5f9[_0x4305('0x3e')]=_[_0x4305('0x3f')](_0x3bc5f9[_0x4305('0x3b')],_0x3bc5f9[_0x4305('0x3c')]);_0x30cac6['attributes']=_[_0x4305('0x3f')](_0x3bc5f9['model'],qs[_0x4305('0x41')](_0xeef224[_0x4305('0x3c')][_0x4305('0x41')]));_0x30cac6[_0x4305('0x40')]=_0x30cac6[_0x4305('0x40')]['length']?_0x30cac6[_0x4305('0x40')]:_0x3bc5f9[_0x4305('0x3b')];if(!_0xeef224[_0x4305('0x3c')]['hasOwnProperty']('nolimit')){_0x30cac6[_0x4305('0x21')]=qs[_0x4305('0x21')](_0xeef224[_0x4305('0x3c')][_0x4305('0x21')]);_0x30cac6['offset']=qs[_0x4305('0x23')](_0xeef224[_0x4305('0x3c')][_0x4305('0x23')]);}_0x30cac6[_0x4305('0x44')]=qs[_0x4305('0x45')](_0xeef224['query'][_0x4305('0x45')]);_0x30cac6['where']=qs[_0x4305('0x3e')](_[_0x4305('0x47')](_0xeef224[_0x4305('0x3c')],_0x3bc5f9[_0x4305('0x3e')]));_0x30cac6['where'][_0x4305('0xb9')]=_0x5437d6['id'];if(_0xeef224[_0x4305('0x3c')][_0x4305('0x82')]){_0x30cac6['where']=_[_0x4305('0xba')](_0x30cac6[_0x4305('0x46')],{'$or':_[_0x4305('0x31')](_0x30cac6[_0x4305('0x40')],function(_0x42980e){var _0x3771e9={};_0x3771e9[_0x42980e]={'$like':'%'+_0xeef224[_0x4305('0x3c')][_0x4305('0x82')]+'%'};return _0x3771e9;})});}if(_0xeef224[_0x4305('0x3c')][_0x4305('0xbb')]){var _0x29da12=_0xeef224[_0x4305('0x3c')][_0x4305('0xbb')]['split'](',');var _0x147495={};_0x147495[_0x29da12[0x0]]={'$gte':moment(_0x29da12[0x1])['format'](_0x4305('0xbc'))};_0x30cac6[_0x4305('0x46')]=_[_0x4305('0xba')](_0x30cac6[_0x4305('0x46')],_0x147495);}_0x30cac6=_[_0x4305('0xba')]({},_0x30cac6,_0xeef224[_0x4305('0xb1')]);return db[_0x4305('0xb5')][_0x4305('0x24')]({'where':_0x30cac6[_0x4305('0x46')]})[_0x4305('0x2c')](function(_0x30d649){_0x2b0b87[_0x4305('0x24')]=_0x30d649;if(_0xeef224[_0x4305('0x3c')][_0x4305('0xaf')]){_0x30cac6[_0x4305('0xb0')]=[{'all':!![]}];}return db[_0x4305('0xb5')][_0x4305('0xbd')](_0x30cac6);})[_0x4305('0x2c')](function(_0x5a8cb6){_0x2b0b87[_0x4305('0xac')]=_0x5a8cb6;return _0x2b0b87;});}})[_0x4305('0x2c')](respondWithFilteredResult(_0x5c96c2,_0x30cac6))['catch'](handleError(_0x5c96c2,null));};exports['addTags']=function(_0x48555a,_0x176cd0,_0x5aad65){return db[_0x4305('0x97')][_0x4305('0x5f')]({'where':{'id':_0x48555a['params']['id']}})[_0x4305('0x2c')](handleEntityNotFound(_0x176cd0,null))[_0x4305('0x2c')](function(_0x2a4979){if(_0x2a4979){return _0x2a4979[_0x4305('0xbe')](_0x48555a['body'][_0x4305('0xb6')],_[_0x4305('0xbf')](_0x48555a[_0x4305('0x72')],[_0x4305('0xb6'),'id'])||{})[_0x4305('0xc0')](function(){return db[_0x4305('0x6b')][_0x4305('0xbd')]({'attributes':['id',_0x4305('0x2f'),_0x4305('0x4a')],'where':{'id':_0x48555a['body'][_0x4305('0xb6')]}});})[_0x4305('0x2c')](function(_0x5360de){socket[_0x4305('0xc1')](_0x4305('0xc2'),{'id':Number(_0x48555a[_0x4305('0xae')]['id']),'tags':_0x5360de||[]});return{'id':Number(_0x48555a[_0x4305('0xae')]['id']),'tags':_0x5360de||[]};});}})[_0x4305('0x2c')](respondWithResult(_0x176cd0,null))[_0x4305('0x36')](handleError(_0x176cd0,null));};exports[_0x4305('0xc3')]=function(_0xfb3df,_0x12aad5,_0x2ce92c){return db['FaxInteraction'][_0x4305('0x5f')]({'where':{'id':_0xfb3df[_0x4305('0xae')]['id']}})[_0x4305('0x2c')](handleEntityNotFound(_0x12aad5,null))[_0x4305('0x2c')](function(_0x1494d){if(_0x1494d){return _0x1494d[_0x4305('0xc3')](_0xfb3df[_0x4305('0x3c')][_0x4305('0xb6')]);}})[_0x4305('0x2c')](respondWithStatusCode(_0x12aad5,null))[_0x4305('0x36')](handleError(_0x12aad5,null));};exports[_0x4305('0xc4')]=function(_0x57e765,_0x3d055e){var _0x19fdf9=moment()[_0x4305('0xc5')]()[_0x4305('0x96')]();var _0x3a872c=path[_0x4305('0xc6')](config[_0x4305('0xc7')],_0x4305('0xc8'),_0x4305('0xc9'),_0x4305('0xca'));var _0x56d153=path[_0x4305('0xc6')](config[_0x4305('0xc7')],_0x4305('0xc8'),_0x4305('0xc9'),_0x4305('0xcb'));var _0xede2c0=path[_0x4305('0xc6')](_0x3a872c,_0x19fdf9);var _0x295a37=util['format'](_0x4305('0xcc'),_0x57e765['params']['id'],_0x19fdf9);var _0x592d1d=path[_0x4305('0xc6')](_0x3a872c,_0x295a37);var _0xb204e0=[];_0xb204e0[_0x4305('0x35')]({'model':db[_0x4305('0xcd')],'as':_0x4305('0xcd'),'raw':!![]});var _0x9e95e0=[{'model':db[_0x4305('0xb5')],'as':'Messages','attributes':['id','body','createdAt'],'include':_0xb204e0}];return db['FaxInteraction'][_0x4305('0x5f')]({'where':{'id':_0x57e765[_0x4305('0xae')]['id']},'include':_0x9e95e0})[_0x4305('0x2c')](handleEntityNotFound(_0x3d055e,null))[_0x4305('0x2c')](function(_0x3a5c43){if(_0x3a5c43&&_0x3a5c43[_0x4305('0xce')]){var _0x351aba=_0x3a5c43['get']({'plain':!![]});fs['mkdirSync'](_0xede2c0);for(var _0x4b54a9=0x0;_0x4b54a9<_0x351aba[_0x4305('0xce')][_0x4305('0x5e')];_0x4b54a9++){var _0x3f4c52=_0x351aba[_0x4305('0xce')][_0x4b54a9][_0x4305('0xcd')];if(_0x3f4c52){var _0x55bb65=path['join'](_0x56d153,_0x3f4c52[_0x4305('0xcf')]);if(fs[_0x4305('0xd0')](_0x55bb65)){fs[_0x4305('0xd1')](_0x55bb65)[_0x4305('0xd2')](fs[_0x4305('0xd3')](path[_0x4305('0xc6')](_0xede2c0,_0x3f4c52[_0x4305('0xcf')])));}}}return BPromise[_0x4305('0xd4')]()[_0x4305('0x2c')](function(){return new BPromise(function(_0x5c946a,_0x94a71e){zipdir(_0xede2c0,{'saveTo':_0x592d1d},function(_0x1f5e3d,_0x147f25){if(_0x1f5e3d)return _0x94a71e(_0x1f5e3d);return _0x5c946a(_0x147f25);});})[_0x4305('0x2c')](function(){return new BPromise(function(_0x490a11,_0x41fd56){rimraf(_0xede2c0,function(_0x4031df){if(_0x4031df)_0x41fd56(_0x4031df);return _0x490a11();});});})[_0x4305('0x2c')](function(){return _0x3d055e[_0x4305('0xc4')](_0x592d1d,_0x295a37,function(_0x13b22c){if(_0x13b22c){console[_0x4305('0xd5')](_0x4305('0xd6'),_0x13b22c);}else{fs[_0x4305('0xd7')](_0x592d1d);}});});});}else{return _0x3d055e[_0x4305('0x1e')](0xc8);}})[_0x4305('0x36')](handleError(_0x3d055e,null));}; \ No newline at end of file +var _0x1ff4=['update','describe','FaxMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','error','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','FaxInteraction','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','UserId','body','some','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','FaxAccountId','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','params','includeAll','include','options','create'];(function(_0x132913,_0x1895b3){var _0x30506f=function(_0x5ce740){while(--_0x5ce740){_0x132913['push'](_0x132913['shift']());}};_0x30506f(++_0x1895b3);}(_0x1ff4,0xf9));var _0x41ff=function(_0x4604da,_0x2791bb){_0x4604da=_0x4604da-0x0;var _0x26e5da=_0x1ff4[_0x4604da];return _0x26e5da;};'use strict';var emlformat=require(_0x41ff('0x0'));var rimraf=require(_0x41ff('0x1'));var zipdir=require(_0x41ff('0x2'));var jsonpatch=require(_0x41ff('0x3'));var rp=require(_0x41ff('0x4'));var moment=require('moment');var BPromise=require(_0x41ff('0x5'));var Mustache=require(_0x41ff('0x6'));var util=require(_0x41ff('0x7'));var path=require(_0x41ff('0x8'));var sox=require(_0x41ff('0x9'));var csv=require(_0x41ff('0xa'));var ejs=require(_0x41ff('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x41ff('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x41ff('0xd'));var toCsv=require(_0x41ff('0xa'));var querystring=require(_0x41ff('0xe'));var Papa=require('papaparse');var Redis=require(_0x41ff('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41ff('0x10'));var logger=require(_0x41ff('0x11'))(_0x41ff('0x12'));var utils=require(_0x41ff('0x13'));var config=require(_0x41ff('0x14'));var licenseUtil=require(_0x41ff('0x15'));var db=require(_0x41ff('0x16'))['db'];config[_0x41ff('0x17')]=_[_0x41ff('0x18')](config[_0x41ff('0x17')],{'host':_0x41ff('0x19'),'port':0x18eb});var socket=require(_0x41ff('0x1a'))(new Redis(config[_0x41ff('0x17')]));require(_0x41ff('0x1b'))[_0x41ff('0x1c')](socket);function respondWithStatusCode(_0x2198b5,_0xa8f219){_0xa8f219=_0xa8f219||0xcc;return function(_0x51ff2){if(_0x51ff2){return _0x2198b5[_0x41ff('0x1d')](_0xa8f219);}return _0x2198b5[_0x41ff('0x1e')](_0xa8f219)[_0x41ff('0x1f')]();};}function respondWithResult(_0x8e7403,_0x34ba6b){_0x34ba6b=_0x34ba6b||0xc8;return function(_0x29b45c){if(_0x29b45c){return _0x8e7403[_0x41ff('0x1e')](_0x34ba6b)['json'](_0x29b45c);}};}function respondWithFilteredResult(_0x20e887,_0x29026c){return function(_0xad30e1){if(_0xad30e1){var _0xd08a0=typeof _0x29026c[_0x41ff('0x20')]==='undefined'&&typeof _0x29026c[_0x41ff('0x21')]===_0x41ff('0x22');var _0x571a0d=_0xad30e1[_0x41ff('0x23')];var _0x184f4e=_0xd08a0?0x0:_0x29026c['offset'];var _0x47e69b=_0xd08a0?_0xad30e1[_0x41ff('0x23')]:_0x29026c['offset']+_0x29026c['limit'];var _0x53254b;if(_0x47e69b>=_0x571a0d){_0x47e69b=_0x571a0d;_0x53254b=0xc8;}else{_0x53254b=0xce;}_0x20e887[_0x41ff('0x1e')](_0x53254b);return _0x20e887[_0x41ff('0x24')](_0x41ff('0x25'),_0x184f4e+'-'+_0x47e69b+'/'+_0x571a0d)[_0x41ff('0x26')](_0xad30e1);}return null;};}function patchUpdates(_0x629531){return function(_0x5bf09e){try{jsonpatch[_0x41ff('0x27')](_0x5bf09e,_0x629531,!![]);}catch(_0x19331a){return BPromise['reject'](_0x19331a);}return _0x5bf09e[_0x41ff('0x28')]();};}function saveUpdates(_0x307127,_0xccdb7){return function(_0x1815bd){if(_0x1815bd){return _0x1815bd['update'](_0x307127)['then'](function(_0x3d092f){return _0x3d092f;});}return null;};}function removeEntity(_0x1488ee,_0x562b48){return function(_0x570904){if(_0x570904){return _0x570904['destroy']()[_0x41ff('0x29')](function(){_0x1488ee[_0x41ff('0x1e')](0xcc)[_0x41ff('0x1f')]();});}};}function handleEntityNotFound(_0x1a0c8e,_0x4de575){return function(_0x66c96a){if(!_0x66c96a){_0x1a0c8e['sendStatus'](0x194);}return _0x66c96a;};}function handleError(_0x4c583d,_0x2ce4dc){_0x2ce4dc=_0x2ce4dc||0x1f4;return function(_0x2f571d){logger[_0x41ff('0x2a')](_0x2f571d['stack']);if(_0x2f571d[_0x41ff('0x2b')]){delete _0x2f571d[_0x41ff('0x2b')];}_0x4c583d[_0x41ff('0x1e')](_0x2ce4dc)[_0x41ff('0x2c')](_0x2f571d);};}function getInteractionUsers(_0x38c9c2,_0x7e3777){return new BPromise(function(_0x37847a,_0x14bff4){try{if(_0x7e3777[_0x38c9c2['id']]){_0x38c9c2[_0x41ff('0x2d')]=_['map'](_0x7e3777[_0x38c9c2['id']],function(_0x1c6a0f){return{'id':_0x1c6a0f['id'],'fullname':_0x1c6a0f[_0x41ff('0x2e')]};});}}catch(_0x5c18a6){_0x14bff4(_0x5c18a6);}_0x37847a(_0x38c9c2);});}function getInteractionTags(_0x38e705,_0x286366){return new BPromise(function(_0x11c316,_0x13a41a){try{if(_0x38e705[_0x41ff('0x2f')]){_0x38e705[_0x41ff('0x30')]=[];_0x38e705['TagIds'][_0x41ff('0x31')](',')[_0x41ff('0x32')](function(_0x546e98){_0x38e705[_0x41ff('0x30')][_0x41ff('0x33')](_0x286366[_0x546e98]);});}delete _0x38e705[_0x41ff('0x2f')];}catch(_0x89e3d6){_0x13a41a(_0x89e3d6);}_0x11c316(_0x38e705);});}function updateFaxInteraction(_0x111eb7,_0x35070c,_0x226d5e){return new BPromise(function(_0x1980e3,_0x1529ec){return getInteractionUsers(_0x111eb7,_0x226d5e)[_0x41ff('0x29')](function(_0x150afd){return getInteractionTags(_0x150afd,_0x35070c);})['then'](function(_0x21a891){_0x1980e3(_0x21a891);})[_0x41ff('0x34')](function(_0x4061cd){_0x1529ec(_0x4061cd);});});}exports['index']=function(_0x5256d7,_0x15bf83){var _0x44581a={},_0x302965={},_0x4eb15b={'count':0x0,'rows':[]};var _0x327502=_[_0x41ff('0x35')](db[_0x41ff('0x36')][_0x41ff('0x37')],function(_0x180cb5){return{'name':_0x180cb5[_0x41ff('0x38')],'type':_0x180cb5[_0x41ff('0x39')]['key']};});_0x302965['model']=_[_0x41ff('0x35')](_0x327502,_0x41ff('0x2b'));_0x302965[_0x41ff('0x3a')]=_[_0x41ff('0x3b')](_0x5256d7[_0x41ff('0x3a')]);_0x302965['filters']=_[_0x41ff('0x3c')](_0x302965['model'],_0x302965[_0x41ff('0x3a')]);_0x44581a[_0x41ff('0x3d')]=_[_0x41ff('0x3c')](_0x302965[_0x41ff('0x3e')],qs[_0x41ff('0x3f')](_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x3f')]));_0x44581a['attributes']=_0x44581a[_0x41ff('0x3d')][_0x41ff('0x40')]?_0x44581a['attributes']:_0x302965['model'];if(!_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x41')](_0x41ff('0x42'))){_0x44581a[_0x41ff('0x21')]=qs[_0x41ff('0x21')](_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x21')]);_0x44581a[_0x41ff('0x20')]=qs[_0x41ff('0x20')](_0x5256d7['query'][_0x41ff('0x20')]);}_0x44581a[_0x41ff('0x43')]=qs[_0x41ff('0x44')](_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x44')]);_0x44581a[_0x41ff('0x45')]=qs[_0x41ff('0x46')](_[_0x41ff('0x47')](_0x5256d7[_0x41ff('0x3a')],_0x302965[_0x41ff('0x46')]),_0x327502);var _0x5a6231=[];var _0x4bdc2b=squel[_0x41ff('0x48')]()[_0x41ff('0x49')]('id')['field'](_0x41ff('0x2b'))[_0x41ff('0x49')](_0x41ff('0x4a'))['from'](_0x41ff('0x4b'));var _0x5f1aa6=squel[_0x41ff('0x48')]()[_0x41ff('0x49')](_0x41ff('0x4c'))['field'](_0x41ff('0x4d'))[_0x41ff('0x49')](_0x41ff('0x4e'))[_0x41ff('0x4f')](_0x41ff('0x50'),'ui')[_0x41ff('0x51')](_0x41ff('0x52'),'u',_0x41ff('0x53'));var _0x4e633f=squel[_0x41ff('0x48')]()[_0x41ff('0x4f')]('fax_interactions','i')[_0x41ff('0x51')](_0x41ff('0x54'),'c',_0x41ff('0x55'))[_0x41ff('0x51')](_0x41ff('0x52'),'o',_0x41ff('0x56'))['left_join']('fax_accounts','a',_0x41ff('0x57'))[_0x41ff('0x51')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0x41ff('0x51')](_0x41ff('0x58'),'it',_0x41ff('0x59'))['left_join'](_0x41ff('0x4b'),'t',_0x41ff('0x5a'));var _0x55de99=squel[_0x41ff('0x5b')]();var _0x5953f5=[];var _0x200ea6=squel[_0x41ff('0x5b')]();var _0x1eded6;if(_0x5256d7[_0x41ff('0x3a')]['search']){_0x1eded6=as[_0x41ff('0x5c')](_0x5256d7['query'][_0x41ff('0x5d')]);var _0x515bdd=_0x1eded6['sqlOperator'];for(var _0x2c2988=0x0;_0x2c2988<_0x1eded6[_0x41ff('0x5e')][_0x41ff('0x40')];_0x2c2988++){var _0x3e8ed8=_0x1eded6[_0x41ff('0x5e')][_0x2c2988];var _0x5c8b2a='i';var _0x15daa9=_[_0x41ff('0x5f')](_0x327502,[_0x41ff('0x2b'),_0x3e8ed8[_0x41ff('0x49')]]);if(!_0x15daa9){switch(_0x3e8ed8[_0x41ff('0x49')]){case _0x41ff('0x60'):if(_0x3e8ed8[_0x41ff('0x61')]==0x1){_0x4e633f[_0x41ff('0x62')]('`'+_0x3e8ed8[_0x41ff('0x49')]+_0x41ff('0x63'));}else{_0x4e633f['having']('`'+_0x3e8ed8[_0x41ff('0x49')]+_0x41ff('0x64'));}break;case _0x41ff('0x65'):if(_0x3e8ed8['operator']===_0x41ff('0x66')){if(_0x3e8ed8[_0x41ff('0x61')][_0x41ff('0x31')]('\x20')['length']>0x1){_0x55de99[_0x515bdd](_0x41ff('0x67'),qs[_0x41ff('0x68')](_0x3e8ed8[_0x41ff('0x61')]),null);}else{var _0x2ddc09='%'+_0x3e8ed8[_0x41ff('0x61')]+'%';_0x55de99[_0x515bdd]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2ddc09,_0x2ddc09,_0x2ddc09);}}else{_0x15daa9=_[_0x41ff('0x5f')](_0x327502,[_0x41ff('0x2b'),_0x41ff('0x69')]);_0x3e8ed8[_0x41ff('0x49')]=_0x41ff('0x69');_0x5eb789=as[_0x41ff('0x6a')](_0x5c8b2a,_0x15daa9[_0x41ff('0x39')],_0x3e8ed8);_0x55de99[_0x515bdd](_0x5eb789[_0x41ff('0x6b')],_0x5eb789['value'][_0x41ff('0x6c')],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x1f')]);}break;case _0x41ff('0x6d'):var _0xf1bdc5=_0x3e8ed8[_0x41ff('0x61')][_0x41ff('0x31')](',')[_0x41ff('0x35')](function(_0x49ce9b){return Number(_0x49ce9b);});_0xf1bdc5[_0x41ff('0x32')](function(_0xf81dda){_0x200ea6['or'](_0x41ff('0x6e'),'%,'+_0xf81dda+',%');});_0x5953f5=_[_0x41ff('0x6f')](_0x5953f5,_0xf1bdc5);break;case'User':if(_0x3e8ed8[_0x41ff('0x70')]===_0x41ff('0x66')){_0x55de99[_0x515bdd]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3e8ed8[_0x41ff('0x61')]+'%',null);}else{_0x15daa9=_[_0x41ff('0x5f')](_0x327502,[_0x41ff('0x2b'),_0x41ff('0x71')]);_0x3e8ed8[_0x41ff('0x49')]=_0x41ff('0x71');_0x5eb789=as['buildExpression'](_0x5c8b2a,_0x15daa9['type'],_0x3e8ed8);_0x55de99[_0x515bdd](_0x5eb789['text'],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x6c')],_0x5eb789['value']['end']);}break;case _0x41ff('0x72'):_0x5eb789=as['buildExpression']('me',null,_0x3e8ed8);_0x55de99[_0x515bdd](_0x5eb789[_0x41ff('0x6b')],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x6c')],_0x5eb789['value'][_0x41ff('0x1f')]);break;}}else{var _0x5eb789=as[_0x41ff('0x6a')](_0x5c8b2a,_0x15daa9[_0x41ff('0x39')],_0x3e8ed8);_0x55de99[_0x515bdd](_0x5eb789[_0x41ff('0x6b')],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x6c')],_0x5eb789[_0x41ff('0x61')][_0x41ff('0x1f')]);}}}else{var _0x3ac2dd=_(_0x5256d7['query'])['keys']()[_0x41ff('0x35')](function(_0x5ced28){return _[_0x41ff('0x73')](_0x327502,['name',_0x5ced28])?_0x5ced28:undefined;})['compact']()[_0x41ff('0x61')]();if(!_['isEmpty'](_0x3ac2dd)){_0x3ac2dd[_0x41ff('0x32')](function(_0x30a436){if(_0x30a436==='FaxAccountId'){_0x4e633f[_0x41ff('0x45')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x5256d7[_0x41ff('0x3a')][_0x30a436]));}else if(_0x30a436===_0x41ff('0x74')){var _0x2855bf=JSON[_0x41ff('0x75')](_0x5256d7[_0x41ff('0x3a')][_0x30a436])['$gte'];var _0x40b806=JSON[_0x41ff('0x75')](_0x5256d7[_0x41ff('0x3a')][_0x30a436])[_0x41ff('0x76')];_0x4e633f[_0x41ff('0x45')](_0x41ff('0x77'),_0x2855bf,_0x40b806);}else{if(_0x5256d7[_0x41ff('0x3a')][_0x30a436]==='null'){_0x4e633f[_0x41ff('0x45')]('i.'+_0x30a436+_0x41ff('0x78'));}else{_0x4e633f['where']('i.'+_0x30a436+_0x41ff('0x79'),_0x5256d7[_0x41ff('0x3a')][_0x30a436]);}}});}if(_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x7a')]){if(_0x5256d7['query'][_0x41ff('0x7a')]==0x1){_0x4e633f[_0x41ff('0x62')](_0x41ff('0x7b'));}else{_0x4e633f[_0x41ff('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x7c')]){_0x5953f5=_[_0x41ff('0x7d')](_0x5256d7[_0x41ff('0x3a')]['tag'])?_0x5256d7[_0x41ff('0x3a')]['tag']:new Array(_0x5256d7['query'][_0x41ff('0x7c')]);_0x5953f5[_0x41ff('0x32')](function(_0x5db08f){_0x200ea6['or'](_0x41ff('0x6e'),'%,'+_0x5db08f+',%');});}if(_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x7e')]){var _0x25d397=_0x5256d7[_0x41ff('0x3a')][_0x41ff('0x7e')][_0x41ff('0x7f')]('\x5c','\x5c\x5c')[_0x41ff('0x7f')](/'/g,'\x27\x27');if(qs[_0x41ff('0x80')](_0x25d397)){_0x55de99['or'](_0x41ff('0x81'),_0x25d397+'%')['or'](_0x41ff('0x82'),_0x25d397+'%');}_0x55de99['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x25d397+'%');}}_0x4e633f[_0x41ff('0x45')](_0x55de99);_0x4e633f[_0x41ff('0x83')](_0x41ff('0x84'));var _0x1252fd={'type':db[_0x41ff('0x85')][_0x41ff('0x86')][_0x41ff('0x87')],'raw':!![]};var _0x271e39=_0x4e633f['clone']();_0x271e39['field'](_0x41ff('0x84'));_0x271e39[_0x41ff('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x44581a['order']){_0x44581a['order'][_0x41ff('0x32')](function(_0x38ba04){var _0x230024=_0x38ba04[0x0]===_0x41ff('0x88')?_0x38ba04[0x0]:'i.'+_0x38ba04[0x0];_0x4e633f[_0x41ff('0x43')](_0x230024,_0x38ba04[0x1]===_0x41ff('0x89')?![]:!![]);});}if(!_['isEmpty'](_0x5953f5)){_0x4e633f['having'](_0x200ea6);_0x271e39[_0x41ff('0x45')](_0x41ff('0x8a'),_0x5953f5);}BPromise['resolve']()[_0x41ff('0x29')](function(){if(!_0x1eded6){if(_0x5256d7[_0x41ff('0x3a')]['FaxAccountId'])return;_0x271e39[_0x41ff('0x45')](_0x41ff('0x8b'));_0x4e633f['where'](_0x41ff('0x8b'));return;}if(_0x5256d7[_0x41ff('0x8c')][_0x41ff('0x8d')]!==_0x41ff('0x8e'))return;return _0x5256d7[_0x41ff('0x8c')][_0x41ff('0x8f')]({'attributes':['id'],'raw':!![]})[_0x41ff('0x29')](function(_0x46aa0a){if(_[_0x41ff('0x90')](_0x46aa0a)){_0x271e39[_0x41ff('0x45')](_0x41ff('0x91'));_0x4e633f['where'](_0x41ff('0x91'));}else{_0x271e39[_0x41ff('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0x41ff('0x35')](_0x46aa0a,'id'));_0x4e633f[_0x41ff('0x45')](_0x41ff('0x92'),_[_0x41ff('0x35')](_0x46aa0a,'id'));}});})[_0x41ff('0x29')](function(){if(_0x5256d7[_0x41ff('0x8c')][_0x41ff('0x8d')]==='agent'&&!_0x1eded6&&!_0x5256d7['query'][_0x41ff('0x93')])return[];return db[_0x41ff('0x94')][_0x41ff('0x3a')](_0x271e39['toString'](),_0x1252fd);})['then'](function(_0x471261){_0x4eb15b['count']=_0x471261[_0x41ff('0x40')];if(_0x4eb15b['count']===0x0)return[];return db['sequelize'][_0x41ff('0x3a')](_0x4bdc2b[_0x41ff('0x95')](),_0x1252fd)[_0x41ff('0x29')](function(_0x174551){_0x5a6231=_[_0x41ff('0x96')](_0x174551,'id');_0x1252fd=_[_0x41ff('0x97')](_0x1252fd,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5256d7['query'][_0x41ff('0x3f')]){_0x44581a[_0x41ff('0x3d')][_0x41ff('0x32')](function(_0x290758){_0x4e633f[_0x41ff('0x49')]('i.'+_0x290758);});}else{_0x4e633f['field'](_0x41ff('0x98'),'unreadMessages');_0x4e633f[_0x41ff('0x49')](_0x41ff('0x99'),_0x41ff('0x9a'));_0x4e633f[_0x41ff('0x49')](_0x41ff('0x9b'),_0x41ff('0x9c'));_0x4e633f[_0x41ff('0x49')](_0x41ff('0x9d'),_0x41ff('0x88'));_0x4e633f[_0x41ff('0x49')](_0x41ff('0x9e'));_0x4e633f[_0x41ff('0x49')](_0x41ff('0x9f'),_0x41ff('0xa0'));_0x4e633f[_0x41ff('0x49')]('c.lastName',_0x41ff('0xa1'));_0x4e633f['field']('c.email',_0x41ff('0xa2'));_0x4e633f['field'](_0x41ff('0xa3'),_0x41ff('0xa4'));_0x4e633f['field']('c.mobile','Contact.mobile');_0x4e633f[_0x41ff('0x49')](_0x41ff('0xa5'),'Contact.fax');_0x4e633f[_0x41ff('0x49')]('o.fullname','Owner.fullname');_0x4e633f['field'](_0x41ff('0xa6'),'Owner.internal');_0x4e633f['field'](_0x41ff('0xa7'),'TagIds');}if(_0x44581a[_0x41ff('0x21')])_0x4e633f[_0x41ff('0x21')](_0x44581a['limit']);if(_0x44581a['offset'])_0x4e633f[_0x41ff('0x20')](_0x44581a[_0x41ff('0x20')]);return db[_0x41ff('0x94')][_0x41ff('0x3a')](_0x4e633f[_0x41ff('0x95')](),_0x1252fd);})[_0x41ff('0x29')](function(_0x3dc29e){if(_0x3dc29e[_0x41ff('0x40')]>0x0)_0x5f1aa6[_0x41ff('0x45')]('ui.FaxInteractionId\x20IN\x20?',_[_0x41ff('0x35')](_0x3dc29e,'id'));return db[_0x41ff('0x94')][_0x41ff('0x3a')](_0x5f1aa6[_0x41ff('0x95')](),_0x1252fd)['then'](function(_0x46d421){var _0x5e7d30=_[_0x41ff('0xa8')](_0x46d421,_0x41ff('0xa9'));var _0x7c6638=[];_0x3dc29e[_0x41ff('0x32')](function(_0x6231a5){_0x7c6638[_0x41ff('0x33')](updateFaxInteraction(_0x6231a5,_0x5a6231,_0x5e7d30));});return BPromise[_0x41ff('0xaa')](_0x7c6638);});});})[_0x41ff('0x29')](function(_0x1ada42){_0x4eb15b[_0x41ff('0xab')]=_0x1ada42;return _0x4eb15b;})[_0x41ff('0x29')](respondWithFilteredResult(_0x15bf83,_0x44581a))[_0x41ff('0x34')](handleError(_0x15bf83,null));};exports['show']=function(_0x25f051,_0xbf3ae2){var _0x3f0a2d={'raw':![],'where':{'id':_0x25f051[_0x41ff('0xac')]['id']}},_0x3a87b0={};_0x3a87b0[_0x41ff('0x3e')]=_[_0x41ff('0x3b')](db[_0x41ff('0x36')]['rawAttributes']);_0x3a87b0[_0x41ff('0x3a')]=_[_0x41ff('0x3b')](_0x25f051[_0x41ff('0x3a')]);_0x3a87b0[_0x41ff('0x46')]=_[_0x41ff('0x3c')](_0x3a87b0[_0x41ff('0x3e')],_0x3a87b0[_0x41ff('0x3a')]);_0x3f0a2d[_0x41ff('0x3d')]=_[_0x41ff('0x3c')](_0x3a87b0['model'],qs['fields'](_0x25f051['query']['fields']));_0x3f0a2d['attributes']=_0x3f0a2d[_0x41ff('0x3d')][_0x41ff('0x40')]?_0x3f0a2d[_0x41ff('0x3d')]:_0x3a87b0['model'];if(_0x25f051[_0x41ff('0x3a')][_0x41ff('0xad')]){_0x3f0a2d[_0x41ff('0xae')]=[{'all':!![]}];}_0x3f0a2d=_[_0x41ff('0x97')]({},_0x3f0a2d,_0x25f051[_0x41ff('0xaf')]);return db[_0x41ff('0x36')][_0x41ff('0x5f')](_0x3f0a2d)[_0x41ff('0x29')](handleEntityNotFound(_0xbf3ae2,null))['then'](respondWithResult(_0xbf3ae2,null))[_0x41ff('0x34')](handleError(_0xbf3ae2,null));};exports[_0x41ff('0xb0')]=function(_0x47a030,_0x565b58){return db[_0x41ff('0x36')][_0x41ff('0xb0')](_0x47a030['body'],{})[_0x41ff('0x29')](respondWithResult(_0x565b58,0xc9))[_0x41ff('0x34')](handleError(_0x565b58,null));};exports[_0x41ff('0xb1')]=function(_0x4187a5,_0x27f80b){if(_0x4187a5['body']['id']){delete _0x4187a5[_0x41ff('0x72')]['id'];}return db[_0x41ff('0x36')][_0x41ff('0x5f')]({'where':{'id':_0x4187a5[_0x41ff('0xac')]['id']}})['then'](handleEntityNotFound(_0x27f80b,null))[_0x41ff('0x29')](saveUpdates(_0x4187a5[_0x41ff('0x72')],null))[_0x41ff('0x29')](respondWithResult(_0x27f80b,null))['catch'](handleError(_0x27f80b,null));};exports['destroy']=function(_0xd2619f,_0x301db1){return db[_0x41ff('0x36')]['find']({'where':{'id':_0xd2619f[_0x41ff('0xac')]['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x301db1,null))['then'](removeEntity(_0x301db1,null))['catch'](handleError(_0x301db1,null));};exports[_0x41ff('0xb2')]=function(_0xf692b3,_0x3e3441){return db[_0x41ff('0x36')][_0x41ff('0xb2')]()[_0x41ff('0x29')](respondWithResult(_0x3e3441,null))[_0x41ff('0x34')](handleError(_0x3e3441,null));};exports['addMessage']=function(_0x5c5b6a,_0x260481,_0x44212d){return db[_0x41ff('0xb3')][_0x41ff('0x5f')]({'where':{'id':_0x5c5b6a[_0x41ff('0xac')]['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x260481,null))[_0x41ff('0x29')](function(_0x34214e){if(_0x34214e){return _0x34214e['addMessage'](_0x5c5b6a['body']['ids'],_[_0x41ff('0xb4')](_0x5c5b6a[_0x41ff('0x72')],[_0x41ff('0xb5'),'id'])||{});}})[_0x41ff('0x29')](respondWithResult(_0x260481,null))['catch'](handleError(_0x260481,null));};exports[_0x41ff('0xb6')]=function(_0x37be64,_0x4a14b9,_0xb44ef2){var _0x21e4bf={'raw':![],'where':{}};var _0x212be9={};var _0x11fd66={'count':0x0,'rows':[]};return db[_0x41ff('0x36')][_0x41ff('0xb7')]({'where':{'id':_0x37be64[_0x41ff('0xac')]['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x4a14b9,null))['then'](function(_0x27cd34){if(_0x27cd34){_0x212be9[_0x41ff('0x3e')]=_['keys'](db[_0x41ff('0xb3')][_0x41ff('0x37')]);_0x212be9['query']=_[_0x41ff('0x3b')](_0x37be64[_0x41ff('0x3a')]);_0x212be9['filters']=_[_0x41ff('0x3c')](_0x212be9[_0x41ff('0x3e')],_0x212be9[_0x41ff('0x3a')]);_0x21e4bf[_0x41ff('0x3d')]=_['intersection'](_0x212be9[_0x41ff('0x3e')],qs[_0x41ff('0x3f')](_0x37be64['query']['fields']));_0x21e4bf[_0x41ff('0x3d')]=_0x21e4bf[_0x41ff('0x3d')]['length']?_0x21e4bf[_0x41ff('0x3d')]:_0x212be9[_0x41ff('0x3e')];if(!_0x37be64[_0x41ff('0x3a')]['hasOwnProperty'](_0x41ff('0x42'))){_0x21e4bf[_0x41ff('0x21')]=qs[_0x41ff('0x21')](_0x37be64[_0x41ff('0x3a')]['limit']);_0x21e4bf[_0x41ff('0x20')]=qs[_0x41ff('0x20')](_0x37be64[_0x41ff('0x3a')][_0x41ff('0x20')]);}_0x21e4bf[_0x41ff('0x43')]=qs[_0x41ff('0x44')](_0x37be64['query'][_0x41ff('0x44')]);_0x21e4bf['where']=qs[_0x41ff('0x46')](_['pick'](_0x37be64['query'],_0x212be9[_0x41ff('0x46')]));_0x21e4bf[_0x41ff('0x45')][_0x41ff('0xa9')]=_0x27cd34['id'];if(_0x37be64[_0x41ff('0x3a')]['filter']){_0x21e4bf['where']=_[_0x41ff('0x97')](_0x21e4bf[_0x41ff('0x45')],{'$or':_[_0x41ff('0x35')](_0x21e4bf['attributes'],function(_0x840ac4){var _0x4c77cc={};_0x4c77cc[_0x840ac4]={'$like':'%'+_0x37be64['query']['filter']+'%'};return _0x4c77cc;})});}if(_0x37be64[_0x41ff('0x3a')]['$gte']){var _0x5cf462=_0x37be64[_0x41ff('0x3a')]['$gte'][_0x41ff('0x31')](',');var _0x5ce63d={};_0x5ce63d[_0x5cf462[0x0]]={'$gte':moment(_0x5cf462[0x1])[_0x41ff('0xb8')](_0x41ff('0xb9'))};_0x21e4bf[_0x41ff('0x45')]=_['merge'](_0x21e4bf[_0x41ff('0x45')],_0x5ce63d);}_0x21e4bf=_[_0x41ff('0x97')]({},_0x21e4bf,_0x37be64['options']);return db[_0x41ff('0xb3')]['count']({'where':_0x21e4bf[_0x41ff('0x45')]})['then'](function(_0x2df409){_0x11fd66[_0x41ff('0x23')]=_0x2df409;if(_0x37be64[_0x41ff('0x3a')][_0x41ff('0xad')]){_0x21e4bf[_0x41ff('0xae')]=[{'all':!![]}];}return db[_0x41ff('0xb3')][_0x41ff('0xba')](_0x21e4bf);})['then'](function(_0x332343){_0x11fd66[_0x41ff('0xab')]=_0x332343;return _0x11fd66;});}})[_0x41ff('0x29')](respondWithFilteredResult(_0x4a14b9,_0x21e4bf))[_0x41ff('0x34')](handleError(_0x4a14b9,null));};exports[_0x41ff('0xbb')]=function(_0x46af2a,_0x53ac98,_0xc8e316){return db['FaxInteraction'][_0x41ff('0x5f')]({'where':{'id':_0x46af2a[_0x41ff('0xac')]['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x53ac98,null))['then'](function(_0x5488c1){if(_0x5488c1){return _0x5488c1[_0x41ff('0xbc')](_0x46af2a[_0x41ff('0x72')]['ids'],_['omit'](_0x46af2a[_0x41ff('0x72')],[_0x41ff('0xb5'),'id'])||{})[_0x41ff('0xbd')](function(){return db[_0x41ff('0x6d')][_0x41ff('0xba')]({'attributes':['id','name','color'],'where':{'id':_0x46af2a[_0x41ff('0x72')]['ids']}});})[_0x41ff('0x29')](function(_0x33aff3){socket[_0x41ff('0xbe')](_0x41ff('0xbf'),{'id':Number(_0x46af2a['params']['id']),'tags':_0x33aff3||[]});return{'id':Number(_0x46af2a[_0x41ff('0xac')]['id']),'tags':_0x33aff3||[]};});}})['then'](respondWithResult(_0x53ac98,null))[_0x41ff('0x34')](handleError(_0x53ac98,null));};exports['removeTags']=function(_0x1d634a,_0x1e9c96,_0x4f48e7){return db[_0x41ff('0x36')][_0x41ff('0x5f')]({'where':{'id':_0x1d634a['params']['id']}})[_0x41ff('0x29')](handleEntityNotFound(_0x1e9c96,null))['then'](function(_0x1ab4a1){if(_0x1ab4a1){return _0x1ab4a1['removeTags'](_0x1d634a[_0x41ff('0x3a')][_0x41ff('0xb5')]);}})['then'](respondWithStatusCode(_0x1e9c96,null))[_0x41ff('0x34')](handleError(_0x1e9c96,null));};exports[_0x41ff('0xc0')]=function(_0xd043c,_0x1ad516){var _0x4db1aa=moment()[_0x41ff('0xc1')]()['toString']();var _0x7f1f55=path[_0x41ff('0xc2')](config['root'],_0x41ff('0xc3'),'files',_0x41ff('0xc4'));var _0x54f895=path[_0x41ff('0xc2')](config[_0x41ff('0xc5')],_0x41ff('0xc3'),_0x41ff('0xc6'),_0x41ff('0xc7'));var _0xf24dc1=path[_0x41ff('0xc2')](_0x7f1f55,_0x4db1aa);var _0x81a7f6=util[_0x41ff('0xb8')](_0x41ff('0xc8'),_0xd043c[_0x41ff('0xac')]['id'],_0x4db1aa);var _0x38c213=path[_0x41ff('0xc2')](_0x7f1f55,_0x81a7f6);var _0x2868b7=[];_0x2868b7[_0x41ff('0x33')]({'model':db[_0x41ff('0xc9')],'as':'Attachment','raw':!![]});var _0x4ebd0a=[{'model':db[_0x41ff('0xb3')],'as':_0x41ff('0xca'),'attributes':['id','body',_0x41ff('0x74')],'include':_0x2868b7}];return db['FaxInteraction'][_0x41ff('0x5f')]({'where':{'id':_0xd043c[_0x41ff('0xac')]['id']},'include':_0x4ebd0a})[_0x41ff('0x29')](handleEntityNotFound(_0x1ad516,null))[_0x41ff('0x29')](function(_0xfe9b6a){if(_0xfe9b6a&&_0xfe9b6a[_0x41ff('0xca')]){var _0xd7f697=_0xfe9b6a[_0x41ff('0xcb')]({'plain':!![]});fs[_0x41ff('0xcc')](_0xf24dc1);for(var _0x2ab4d4=0x0;_0x2ab4d4<_0xd7f697[_0x41ff('0xca')][_0x41ff('0x40')];_0x2ab4d4++){var _0x50d2fa=_0xd7f697['Messages'][_0x2ab4d4][_0x41ff('0xc9')];if(_0x50d2fa){var _0x594435=path[_0x41ff('0xc2')](_0x54f895,_0x50d2fa['basename']);if(fs[_0x41ff('0xcd')](_0x594435)){fs[_0x41ff('0xce')](_0x594435)[_0x41ff('0xcf')](fs[_0x41ff('0xd0')](path[_0x41ff('0xc2')](_0xf24dc1,_0x50d2fa[_0x41ff('0xd1')])));}}}return BPromise['resolve']()[_0x41ff('0x29')](function(){return new BPromise(function(_0x5349fd,_0x30ae8c){zipdir(_0xf24dc1,{'saveTo':_0x38c213},function(_0xcaceec,_0x3d4cda){if(_0xcaceec)return _0x30ae8c(_0xcaceec);return _0x5349fd(_0x3d4cda);});})[_0x41ff('0x29')](function(){return new BPromise(function(_0x4c7a5b,_0x29f864){rimraf(_0xf24dc1,function(_0x168f35){if(_0x168f35)_0x29f864(_0x168f35);return _0x4c7a5b();});});})[_0x41ff('0x29')](function(){return _0x1ad516[_0x41ff('0xc0')](_0x38c213,_0x81a7f6,function(_0x301259){if(_0x301259){console[_0x41ff('0xd2')](_0x41ff('0xd3'),_0x301259);}else{fs[_0x41ff('0xd4')](_0x38c213);}});});});}else{return _0x1ad516[_0x41ff('0x1d')](0xc8);}})[_0x41ff('0x34')](handleError(_0x1ad516,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 13c0b68..9803b6b 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 _0xafa0=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage'];(function(_0x290c29,_0xe54d31){var _0x4e4548=function(_0x2de16f){while(--_0x2de16f){_0x290c29['push'](_0x290c29['shift']());}};_0x4e4548(++_0xe54d31);}(_0xafa0,0xeb));var _0x0afa=function(_0xe44906,_0x16b431){_0xe44906=_0xe44906-0x0;var _0x34fd05=_0xafa0[_0xe44906];return _0x34fd05;};'use strict';var EventEmitter=require(_0x0afa('0x0'));var FaxInteraction=require(_0x0afa('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x0afa('0x1'))['db'][_0x0afa('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0afa('0x3')](0x0);var events={'afterCreate':_0x0afa('0x4'),'afterUpdate':'update','afterDestroy':_0x0afa('0x5')};function emitEvent(_0x1f31d2){return function(_0x2a95de,_0xc210b8,_0x1ade4f){_0x2a95de[_0x0afa('0x6')]({'attributes':['id'],'raw':!![]})[_0x0afa('0x7')](function(_0x38afd3){_0x2a95de[_0x0afa('0x8')](_0x0afa('0x9'),_0x38afd3[_0x0afa('0xa')](function(_0x2c8092){return{'id':_0x2c8092['id']};}));return FaxMessage[_0x0afa('0xb')]({'where':{'FaxInteractionId':_0x2a95de['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x17a1b1){_0x2a95de['setDataValue'](_0x0afa('0xc'),_0x17a1b1[_0x0afa('0xd')]);FaxInteractionEvents[_0x0afa('0xe')](_0x1f31d2+':'+_0x2a95de['id'],_0x2a95de);FaxInteractionEvents[_0x0afa('0xe')](_0x1f31d2,_0x2a95de);_0x1ade4f(null);})['catch'](_0x1ade4f(null));};}for(var e in events){if(events[_0x0afa('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x0afa('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x5f59=['emit','catch','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','getUsers','setDataValue','Users','findAll','then','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5f59,0x9d));var _0x95f5=function(_0x4a5d5f,_0x3b92ff){_0x4a5d5f=_0x4a5d5f-0x0;var _0x3e24bf=_0x5f59[_0x4a5d5f];return _0x3e24bf;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x95f5('0x0'))['db'][_0x95f5('0x1')];var FaxMessage=require(_0x95f5('0x0'))['db'][_0x95f5('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x95f5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x95f5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e618d){return function(_0x4b9440,_0x2fb8b9,_0x5db96a){_0x4b9440[_0x95f5('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x6fc4c){_0x4b9440[_0x95f5('0x6')](_0x95f5('0x7'),_0x6fc4c['map'](function(_0x4159c5){return{'id':_0x4159c5['id']};}));return FaxMessage[_0x95f5('0x8')]({'where':{'FaxInteractionId':_0x4b9440['id'],'direction':'in','read':![]},'raw':!![]});})[_0x95f5('0x9')](function(_0x4231ce){_0x4b9440['setDataValue']('unreadMessages',_0x4231ce[_0x95f5('0xa')]);FaxInteractionEvents[_0x95f5('0xb')](_0x5e618d+':'+_0x4b9440['id'],_0x4b9440);FaxInteractionEvents[_0x95f5('0xb')](_0x5e618d,_0x4b9440);_0x5db96a(null);})[_0x95f5('0xc')](_0x5db96a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x95f5('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index cd9dcd6..554d93b 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 _0xeb1c=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','define','FaxInteraction','fax_interactions','changed','closedAt','format'];(function(_0xed4c06,_0x5a94d0){var _0x825bae=function(_0x4792fc){while(--_0x4792fc){_0xed4c06['push'](_0xed4c06['shift']());}};_0x825bae(++_0x5a94d0);}(_0xeb1c,0x119));var _0xceb1=function(_0xc03dab,_0x492840){_0xc03dab=_0xc03dab-0x0;var _0x304e85=_0xeb1c[_0xc03dab];return _0x304e85;};'use strict';var _=require(_0xceb1('0x0'));var util=require('util');var logger=require(_0xceb1('0x1'))(_0xceb1('0x2'));var moment=require('moment');var BPromise=require(_0xceb1('0x3'));var rp=require(_0xceb1('0x4'));var fs=require('fs');var path=require(_0xceb1('0x5'));var rimraf=require(_0xceb1('0x6'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x1e5cfc,_0x14d802){return _0x1e5cfc[_0xceb1('0x7')](_0xceb1('0x8'),attributes,{'tableName':_0xceb1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x526769,_0x22310b,_0x1c204f){if(_0x526769[_0xceb1('0xa')]('closed')){_0x526769[_0xceb1('0xb')]=moment()[_0xceb1('0xc')](_0xceb1('0xd'));}_0x1c204f(null,_0x526769);}}});}; \ No newline at end of file +var _0xda15=['exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x5558a6,_0x4f8e14){var _0x26f2a8=function(_0x5499ca){while(--_0x5499ca){_0x5558a6['push'](_0x5558a6['shift']());}};_0x26f2a8(++_0x4f8e14);}(_0xda15,0xf8));var _0x5da1=function(_0x5c2914,_0x491a2a){_0x5c2914=_0x5c2914-0x0;var _0x4e9f85=_0xda15[_0x5c2914];return _0x4e9f85;};'use strict';var _=require(_0x5da1('0x0'));var util=require('util');var logger=require(_0x5da1('0x1'))(_0x5da1('0x2'));var moment=require('moment');var BPromise=require(_0x5da1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5da1('0x4'));var rimraf=require(_0x5da1('0x5'));var config=require(_0x5da1('0x6'));var attributes=require(_0x5da1('0x7'));module[_0x5da1('0x8')]=function(_0x42f0cd,_0x3ac798){return _0x42f0cd[_0x5da1('0x9')](_0x5da1('0xa'),attributes,{'tableName':_0x5da1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40e9e1,_0x889b67,_0x43ef54){if(_0x40e9e1[_0x5da1('0xc')](_0x5da1('0xd'))){_0x40e9e1[_0x5da1('0xe')]=moment()['format'](_0x5da1('0xf'));}_0x43ef54(null,_0x40e9e1);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 682a52b..715f1a0 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 _0x496a=['register','request','then','info','request\x20sent','debug','error','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','stringify','AddTagsToFaxInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x496a,0x12b));var _0xa496=function(_0x146682,_0x30b0c4){_0x146682=_0x146682-0x0;var _0x50312a=_0x496a[_0x146682];return _0x50312a;};'use strict';var _=require(_0xa496('0x0'));var util=require(_0xa496('0x1'));var moment=require('moment');var BPromise=require(_0xa496('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa496('0x3'));var db=require(_0xa496('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa496('0x5'));var config=require(_0xa496('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa496('0x7')][_0xa496('0x8')]({'port':0x232a});config[_0xa496('0x9')]=_[_0xa496('0xa')](config[_0xa496('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa496('0xb'))(new Redis(config[_0xa496('0x9')]));require(_0xa496('0xc'))[_0xa496('0xd')](socket);function respondWithRpcPromise(_0x48dd55,_0x35374a,_0x2f3567){return new BPromise(function(_0x1c647c,_0x54aacd){return client[_0xa496('0xe')](_0x48dd55,_0x2f3567)[_0xa496('0xf')](function(_0x58ad8e){logger[_0xa496('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x35374a,_0xa496('0x11'));logger[_0xa496('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x35374a,'request\x20sent',JSON['stringify'](_0x58ad8e));if(_0x58ad8e[_0xa496('0x13')]){if(_0x58ad8e[_0xa496('0x13')]['code']===0x1f4){logger['error'](_0xa496('0x14'),_0x35374a,_0x58ad8e['error']['message']);return _0x54aacd(_0x58ad8e['error'][_0xa496('0x15')]);}logger[_0xa496('0x13')](_0xa496('0x14'),_0x35374a,_0x58ad8e[_0xa496('0x13')][_0xa496('0x15')]);return _0x1c647c(_0x58ad8e['error'][_0xa496('0x15')]);}else{logger[_0xa496('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x35374a,_0xa496('0x11'));_0x1c647c(_0x58ad8e['result'][_0xa496('0x15')]);}})[_0xa496('0x16')](function(_0x4f499a){logger[_0xa496('0x13')](_0xa496('0x14'),_0x35374a,_0x4f499a);_0x54aacd(_0x4f499a);});});}exports[_0xa496('0x17')]=function(_0x5b2806){var _0x53ae5f=this;return new Promise(function(_0x383e5f,_0x26061d){return db[_0xa496('0x18')][_0xa496('0x19')](_0x5b2806['body'],{'raw':_0x5b2806[_0xa496('0x1a')]?_0x5b2806[_0xa496('0x1a')][_0xa496('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b2806[_0xa496('0x1a')]?_0x5b2806[_0xa496('0x1a')][_0xa496('0x1c')]||null:null,'attributes':_0x5b2806[_0xa496('0x1a')]?_0x5b2806[_0xa496('0x1a')][_0xa496('0x1d')]||null:null,'limit':_0x5b2806[_0xa496('0x1a')]?_0x5b2806[_0xa496('0x1a')]['limit']||null:null})[_0xa496('0xf')](function(_0x45c8d8){logger['info'](_0xa496('0x17'),_0x5b2806);logger[_0xa496('0x12')](_0xa496('0x17'),_0x5b2806,JSON[_0xa496('0x1e')](_0x45c8d8));_0x383e5f(_0x45c8d8);})['catch'](function(_0x521652){logger['error'](_0xa496('0x17'),_0x521652[_0xa496('0x15')],_0x5b2806);_0x26061d(_0x53ae5f[_0xa496('0x13')](0x1f4,_0x521652['message']));});});};exports[_0xa496('0x1f')]=function(_0x5895e5){return new Promise(function(_0x436c3a,_0x563866){return db[_0xa496('0x18')][_0xa496('0x20')]({'where':_0x5895e5['options']?_0x5895e5['options'][_0xa496('0x1c')]||null:null})[_0xa496('0xf')](function(_0xed53e6){if(_0xed53e6){return _0xed53e6[_0xa496('0x21')](_0x5895e5[_0xa496('0x22')][_0xa496('0x23')],_[_0xa496('0x24')](_0x5895e5[_0xa496('0x22')],[_0xa496('0x23'),'id'])||{});}})[_0xa496('0x25')](function(_0x11801e){logger[_0xa496('0x10')](_0xa496('0x26'),_0x5895e5);logger[_0xa496('0x12')](_0xa496('0x26'),_0x5895e5,JSON['stringify'](_0x11801e));_0x436c3a(_0x11801e);})[_0xa496('0x16')](function(_0x59b493){logger[_0xa496('0x13')]('AddTags',_0x59b493[_0xa496('0x15')],_0x5895e5);_0x563866(_this[_0xa496('0x13')](0x1f4,_0x59b493[_0xa496('0x15')]));});});}; \ No newline at end of file +var _0x7baa=['options','raw','where','attributes','limit','catch','FaxInteraction','ids','omit','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','UpdateFaxInteraction','update','body'];(function(_0x5ddeed,_0x33ce70){var _0x27b4b5=function(_0x145e99){while(--_0x145e99){_0x5ddeed['push'](_0x5ddeed['shift']());}};_0x27b4b5(++_0x33ce70);}(_0x7baa,0x14b));var _0xa7ba=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7baa[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xa7ba('0x0'));var util=require(_0xa7ba('0x1'));var moment=require(_0xa7ba('0x2'));var BPromise=require(_0xa7ba('0x3'));var rs=require(_0xa7ba('0x4'));var fs=require('fs');var Redis=require(_0xa7ba('0x5'));var db=require(_0xa7ba('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7ba('0x7'))('rpc');var config=require(_0xa7ba('0x8'));var jayson=require(_0xa7ba('0x9'));var client=jayson[_0xa7ba('0xa')][_0xa7ba('0xb')]({'port':0x232a});config[_0xa7ba('0xc')]=_['defaults'](config[_0xa7ba('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa7ba('0xd'))(new Redis(config['redis']));require(_0xa7ba('0xe'))[_0xa7ba('0xf')](socket);function respondWithRpcPromise(_0x3efd72,_0x1b54d6,_0x3bcf53){return new BPromise(function(_0xb75e78,_0x4cf1d9){return client[_0xa7ba('0x10')](_0x3efd72,_0x3bcf53)[_0xa7ba('0x11')](function(_0xf27bd1){logger[_0xa7ba('0x12')](_0xa7ba('0x13'),_0x1b54d6,_0xa7ba('0x14'));logger[_0xa7ba('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1b54d6,'request\x20sent',JSON['stringify'](_0xf27bd1));if(_0xf27bd1['error']){if(_0xf27bd1['error'][_0xa7ba('0x16')]===0x1f4){logger['error'](_0xa7ba('0x13'),_0x1b54d6,_0xf27bd1[_0xa7ba('0x17')][_0xa7ba('0x18')]);return _0x4cf1d9(_0xf27bd1[_0xa7ba('0x17')][_0xa7ba('0x18')]);}logger[_0xa7ba('0x17')](_0xa7ba('0x13'),_0x1b54d6,_0xf27bd1['error'][_0xa7ba('0x18')]);return _0xb75e78(_0xf27bd1[_0xa7ba('0x17')][_0xa7ba('0x18')]);}else{logger['info'](_0xa7ba('0x13'),_0x1b54d6,_0xa7ba('0x14'));_0xb75e78(_0xf27bd1[_0xa7ba('0x19')][_0xa7ba('0x18')]);}})['catch'](function(_0x258d39){logger[_0xa7ba('0x17')](_0xa7ba('0x13'),_0x1b54d6,_0x258d39);_0x4cf1d9(_0x258d39);});});}exports[_0xa7ba('0x1a')]=function(_0x4b977b){var _0x2885bc=this;return new Promise(function(_0x177c7c,_0x2560d1){return db['FaxInteraction'][_0xa7ba('0x1b')](_0x4b977b[_0xa7ba('0x1c')],{'raw':_0x4b977b[_0xa7ba('0x1d')]?_0x4b977b['options'][_0xa7ba('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b977b['options']?_0x4b977b[_0xa7ba('0x1d')][_0xa7ba('0x1f')]||null:null,'attributes':_0x4b977b[_0xa7ba('0x1d')]?_0x4b977b[_0xa7ba('0x1d')][_0xa7ba('0x20')]||null:null,'limit':_0x4b977b['options']?_0x4b977b['options'][_0xa7ba('0x21')]||null:null})['then'](function(_0x364ab9){logger[_0xa7ba('0x12')](_0xa7ba('0x1a'),_0x4b977b);logger['debug']('UpdateFaxInteraction',_0x4b977b,JSON['stringify'](_0x364ab9));_0x177c7c(_0x364ab9);})[_0xa7ba('0x22')](function(_0x57bb11){logger[_0xa7ba('0x17')](_0xa7ba('0x1a'),_0x57bb11['message'],_0x4b977b);_0x2560d1(_0x2885bc[_0xa7ba('0x17')](0x1f4,_0x57bb11['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x5a1e60){return new Promise(function(_0x3ed5e7,_0x1be3f9){return db[_0xa7ba('0x23')]['find']({'where':_0x5a1e60[_0xa7ba('0x1d')]?_0x5a1e60[_0xa7ba('0x1d')]['where']||null:null})[_0xa7ba('0x11')](function(_0x537012){if(_0x537012){return _0x537012['addTags'](_0x5a1e60[_0xa7ba('0x1c')][_0xa7ba('0x24')],_[_0xa7ba('0x25')](_0x5a1e60[_0xa7ba('0x1c')],['ids','id'])||{});}})['spread'](function(_0x25fb60){logger['info'](_0xa7ba('0x26'),_0x5a1e60);logger[_0xa7ba('0x15')](_0xa7ba('0x26'),_0x5a1e60,JSON[_0xa7ba('0x27')](_0x25fb60));_0x3ed5e7(_0x25fb60);})[_0xa7ba('0x22')](function(_0xf74f13){logger[_0xa7ba('0x17')](_0xa7ba('0x26'),_0xf74f13[_0xa7ba('0x18')],_0x5a1e60);_0x1be3f9(_this[_0xa7ba('0x17')](0x1f4,_0xf74f13[_0xa7ba('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 11c7bf6..0ee29cf 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 _0x1d17=['faxInteraction:','./faxInteraction.events','remove','emit','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d17,0x169));var _0x71d1=function(_0x417e3b,_0xef1caf){_0x417e3b=_0x417e3b-0x0;var _0x26c817=_0x1d17[_0x417e3b];return _0x26c817;};'use strict';var FaxInteractionEvents=require(_0x71d1('0x0'));var events=['save',_0x71d1('0x1'),'update'];function createListener(_0x4429e9,_0x480d62){return function(_0x278aec){_0x480d62[_0x71d1('0x2')](_0x4429e9,_0x278aec);};}function removeListener(_0x44315e,_0x406f75){return function(){FaxInteractionEvents[_0x71d1('0x3')](_0x44315e,_0x406f75);};}exports['register']=function(_0x55e2fe){for(var _0x450e3b=0x0,_0x257e93=events[_0x71d1('0x4')];_0x450e3b<_0x257e93;_0x450e3b++){var _0x5a2feb=events[_0x450e3b];var _0x3d1ea0=createListener(_0x71d1('0x5')+_0x5a2feb,_0x55e2fe);FaxInteractionEvents['on'](_0x5a2feb,_0x3d1ea0);}}; \ No newline at end of file +var _0x1ff7=['length','faxInteraction:','./faxInteraction.events','save','update','emit','removeListener'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0x1ff7,0x175));var _0x71ff=function(_0x573c8c,_0x2ef34d){_0x573c8c=_0x573c8c-0x0;var _0x4200a2=_0x1ff7[_0x573c8c];return _0x4200a2;};'use strict';var FaxInteractionEvents=require(_0x71ff('0x0'));var events=[_0x71ff('0x1'),'remove',_0x71ff('0x2')];function createListener(_0x1bfbe9,_0x7f3a27){return function(_0x81669e){_0x7f3a27[_0x71ff('0x3')](_0x1bfbe9,_0x81669e);};}function removeListener(_0x179c68,_0x5baf8c){return function(){FaxInteractionEvents[_0x71ff('0x4')](_0x179c68,_0x5baf8c);};}exports['register']=function(_0x3a8cc9){for(var _0x5d6ef8=0x0,_0x3aa06f=events[_0x71ff('0x5')];_0x5d6ef8<_0x3aa06f;_0x5d6ef8++){var _0x3fa9e5=events[_0x5d6ef8];var _0x5ed4a8=createListener(_0x71ff('0x6')+_0x3fa9e5,_0x3a8cc9);FaxInteractionEvents['on'](_0x3fa9e5,_0x5ed4a8);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2fd8c17..26e601a 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 _0x55db=['describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','faxinteraction:destroy','destroy','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x35f348,_0x119133){var _0x14ac45=function(_0x169109){while(--_0x169109){_0x35f348['push'](_0x35f348['shift']());}};_0x14ac45(++_0x119133);}(_0x55db,0x1b5));var _0xb55d=function(_0x5ce2f9,_0x53df07){_0x5ce2f9=_0x5ce2f9-0x0;var _0x2da67a=_0x55db[_0x5ce2f9];return _0x2da67a;};'use strict';var multer=require('multer');var util=require(_0xb55d('0x0'));var path=require(_0xb55d('0x1'));var timeout=require('connect-timeout');var express=require(_0xb55d('0x2'));var router=express[_0xb55d('0x3')]();var fs_extra=require(_0xb55d('0x4'));var auth=require(_0xb55d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb55d('0x6'));var controller=require('./faxInteraction.controller');router[_0xb55d('0x7')]('/',auth[_0xb55d('0x8')](),controller[_0xb55d('0x9')]);router[_0xb55d('0x7')](_0xb55d('0xa'),auth[_0xb55d('0x8')](),controller[_0xb55d('0xb')]);router[_0xb55d('0x7')](_0xb55d('0xc'),auth[_0xb55d('0x8')](),controller[_0xb55d('0xd')]);router[_0xb55d('0x7')](_0xb55d('0xe'),auth[_0xb55d('0x8')](),controller[_0xb55d('0xf')]);router[_0xb55d('0x7')](_0xb55d('0x10'),auth[_0xb55d('0x8')](),controller['download']);router[_0xb55d('0x11')]('/',auth[_0xb55d('0x8')](),controller[_0xb55d('0x12')]);router[_0xb55d('0x11')](_0xb55d('0xe'),auth[_0xb55d('0x8')](),controller['addMessage']);router['post'](_0xb55d('0x13'),auth['isAuthenticated'](),interaction[_0xb55d('0x14')](_0xb55d('0x15'),_0xb55d('0x16')),controller['addTags']);router[_0xb55d('0x17')](_0xb55d('0xc'),auth[_0xb55d('0x8')](),interaction['tracked'](_0xb55d('0x15'),_0xb55d('0x18')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xb55d('0x14')](_0xb55d('0x15'),_0xb55d('0x19')),controller[_0xb55d('0x1a')]);router[_0xb55d('0x1b')](_0xb55d('0x13'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xc290=['Router','fs-extra','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','get','/describe','describe','show','/:id/messages','/:id/download','download','post','addMessage','tracked','fax','faxinteraction:addtags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout'];(function(_0x299c44,_0x498795){var _0x228fda=function(_0x2f87be){while(--_0x2f87be){_0x299c44['push'](_0x299c44['shift']());}};_0x228fda(++_0x498795);}(_0xc290,0x185));var _0x0c29=function(_0x12954a,_0x304691){_0x12954a=_0x12954a-0x0;var _0x5ccde2=_0xc290[_0x12954a];return _0x5ccde2;};'use strict';var multer=require(_0x0c29('0x0'));var util=require(_0x0c29('0x1'));var path=require('path');var timeout=require(_0x0c29('0x2'));var express=require('express');var router=express[_0x0c29('0x3')]();var fs_extra=require(_0x0c29('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0c29('0x5'));var config=require('../../config/environment');var controller=require(_0x0c29('0x6'));router['get']('/',auth[_0x0c29('0x7')](),controller['index']);router[_0x0c29('0x8')](_0x0c29('0x9'),auth[_0x0c29('0x7')](),controller[_0x0c29('0xa')]);router[_0x0c29('0x8')]('/:id',auth[_0x0c29('0x7')](),controller[_0x0c29('0xb')]);router[_0x0c29('0x8')](_0x0c29('0xc'),auth[_0x0c29('0x7')](),controller['getMessages']);router['get'](_0x0c29('0xd'),auth[_0x0c29('0x7')](),controller[_0x0c29('0xe')]);router[_0x0c29('0xf')]('/',auth[_0x0c29('0x7')](),controller['create']);router['post']('/:id/messages',auth[_0x0c29('0x7')](),controller[_0x0c29('0x10')]);router[_0x0c29('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x0c29('0x11')](_0x0c29('0x12'),_0x0c29('0x13')),controller['addTags']);router[_0x0c29('0x14')](_0x0c29('0x15'),auth[_0x0c29('0x7')](),interaction[_0x0c29('0x11')]('fax',_0x0c29('0x16')),controller['update']);router[_0x0c29('0x17')](_0x0c29('0x15'),auth[_0x0c29('0x7')](),interaction[_0x0c29('0x11')](_0x0c29('0x12'),_0x0c29('0x18')),controller[_0x0c29('0x19')]);router[_0x0c29('0x17')]('/:id/tags',auth[_0x0c29('0x7')](),controller[_0x0c29('0x1a')]);module[_0x0c29('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 72e2a95..a81ac58 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 _0xe829=['TEXT','ENUM','out','DATE','sequelize','exports'];(function(_0x2f2113,_0x1ca6d8){var _0x31649d=function(_0xebaa44){while(--_0xebaa44){_0x2f2113['push'](_0x2f2113['shift']());}};_0x31649d(++_0x1ca6d8);}(_0xe829,0x1d8));var _0x9e82=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xe829[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0x9e82('0x0'));module[_0x9e82('0x1')]={'body':{'type':Sequelize[_0x9e82('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e82('0x3')]('in',_0x9e82('0x4')),'defaultValue':_0x9e82('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9e82('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9e82('0x5')]}}; \ No newline at end of file +var _0x1ddc=['out','DATE','exports','TEXT','medium','ENUM'];(function(_0x12fcaa,_0x54a756){var _0x1e4346=function(_0x31a502){while(--_0x31a502){_0x12fcaa['push'](_0x12fcaa['shift']());}};_0x1e4346(++_0x54a756);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x29acbd,_0x56ebf4){_0x29acbd=_0x29acbd-0x0;var _0x253ca5=_0x1ddc[_0x29acbd];return _0x253ca5;};'use strict';var Sequelize=require('sequelize');module[_0xc1dd('0x0')]={'body':{'type':Sequelize[_0xc1dd('0x1')](_0xc1dd('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc1dd('0x3')]('in',_0xc1dd('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xc1dd('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc1dd('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 03587e4..df69d0d 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 _0x55a5=['key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','include','find','body','describe','accept','read','format','UserId','agent','get','FaxInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','user','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','fax','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','CmContact','isNil','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','download','join','root','files','attachments','Attachment','basename','rimraf','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','name','send','index','FaxMessage','rawAttributes','fieldName'];(function(_0xa22817,_0x22ee6b){var _0x28fd9f=function(_0xc74d3e){while(--_0xc74d3e){_0xa22817['push'](_0xa22817['shift']());}};_0x28fd9f(++_0x22ee6b);}(_0x55a5,0x163));var _0x555a=function(_0x3ead55,_0x22bc51){_0x3ead55=_0x3ead55-0x0;var _0x3ea16d=_0x55a5[_0x3ead55];return _0x3ea16d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x555a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x555a('0x1'));var moment=require(_0x555a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x555a('0x3'));var csv=require(_0x555a('0x4'));var ejs=require(_0x555a('0x5'));var fs=require('fs');var fs_extra=require(_0x555a('0x6'));var _=require(_0x555a('0x7'));var squel=require(_0x555a('0x8'));var crypto=require('crypto');var jsforce=require(_0x555a('0x9'));var deskjs=require(_0x555a('0xa'));var toCsv=require(_0x555a('0x4'));var querystring=require(_0x555a('0xb'));var Papa=require(_0x555a('0xc'));var Redis=require(_0x555a('0xd'));var authService=require(_0x555a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x555a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x555a('0x10'))('api');var utils=require(_0x555a('0x11'));var config=require(_0x555a('0x12'));var licenseUtil=require(_0x555a('0x13'));var db=require(_0x555a('0x14'))['db'];config[_0x555a('0x15')]=_['defaults'](config[_0x555a('0x15')],{'host':_0x555a('0x16'),'port':0x18eb});var socket=require(_0x555a('0x17'))(new Redis(config[_0x555a('0x15')]));require(_0x555a('0x18'))[_0x555a('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x555a('0x1a')][_0x555a('0x1b')]({'port':0x232c});var client9002=jayson[_0x555a('0x1a')][_0x555a('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4f9c43,_0x8f970a,_0x63ee83,_0x127fb5){return new BPromise(function(_0x3ae7ac,_0x509ede){var _0xe37a54=_0x127fb5||client;return _0xe37a54[_0x555a('0x1c')](_0x4f9c43,_0x63ee83)['then'](function(_0x3f3c8c){logger[_0x555a('0x1d')](_0x555a('0x1e'),_0x8f970a,_0x555a('0x1f'));logger[_0x555a('0x20')](_0x555a('0x21'),_0x8f970a,_0x555a('0x1f'),JSON[_0x555a('0x22')](_0x3f3c8c));if(_0x3f3c8c[_0x555a('0x23')]){if(_0x3f3c8c[_0x555a('0x23')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x8f970a,_0x3f3c8c[_0x555a('0x23')][_0x555a('0x24')]);return _0x509ede(_0x3f3c8c['error']['message']);}logger[_0x555a('0x23')]('FaxMessage,\x20%s,\x20%s',_0x8f970a,_0x3f3c8c[_0x555a('0x23')]['message']);return _0x3ae7ac(_0x3f3c8c['error'][_0x555a('0x24')]);}else{logger[_0x555a('0x1d')]('FaxMessage,\x20%s,\x20%s',_0x8f970a,_0x555a('0x1f'));_0x3ae7ac(_0x3f3c8c[_0x555a('0x25')][_0x555a('0x24')]);}})[_0x555a('0x26')](function(_0x19144e){logger[_0x555a('0x23')](_0x555a('0x1e'),_0x8f970a,_0x19144e);_0x509ede(_0x19144e);});});}function respondWithStatusCode(_0x3dfaf8,_0x25299a){_0x25299a=_0x25299a||0xcc;return function(_0x29ef6e){if(_0x29ef6e){return _0x3dfaf8[_0x555a('0x27')](_0x25299a);}return _0x3dfaf8[_0x555a('0x28')](_0x25299a)[_0x555a('0x29')]();};}function respondWithResult(_0x21a396,_0x1a58db){_0x1a58db=_0x1a58db||0xc8;return function(_0xf9ac51){if(_0xf9ac51){return _0x21a396[_0x555a('0x28')](_0x1a58db)[_0x555a('0x2a')](_0xf9ac51);}};}function respondWithFilteredResult(_0x1a8850,_0x2c22f1){return function(_0x56513f){if(_0x56513f){var _0x1153af=typeof _0x2c22f1[_0x555a('0x2b')]===_0x555a('0x2c')&&typeof _0x2c22f1[_0x555a('0x2d')]===_0x555a('0x2c');var _0x3542b2=_0x56513f['count'];var _0x53b87d=_0x1153af?0x0:_0x2c22f1['offset'];var _0x1f4a32=_0x1153af?_0x56513f[_0x555a('0x2e')]:_0x2c22f1['offset']+_0x2c22f1[_0x555a('0x2d')];var _0x3fae0a;if(_0x1f4a32>=_0x3542b2){_0x1f4a32=_0x3542b2;_0x3fae0a=0xc8;}else{_0x3fae0a=0xce;}_0x1a8850[_0x555a('0x28')](_0x3fae0a);return _0x1a8850['set']('Content-Range',_0x53b87d+'-'+_0x1f4a32+'/'+_0x3542b2)['json'](_0x56513f);}return null;};}function patchUpdates(_0x1c8984){return function(_0x3cf2d7){try{jsonpatch[_0x555a('0x2f')](_0x3cf2d7,_0x1c8984,!![]);}catch(_0x47b684){return BPromise[_0x555a('0x30')](_0x47b684);}return _0x3cf2d7[_0x555a('0x31')]();};}function saveUpdates(_0x388dec,_0x36b51b){return function(_0x439984){if(_0x439984){return _0x439984[_0x555a('0x32')](_0x388dec)[_0x555a('0x33')](function(_0x3ad91d){return _0x3ad91d;});}return null;};}function removeEntity(_0x41a5a0,_0x14c1bd){return function(_0x26277a){if(_0x26277a){return _0x26277a[_0x555a('0x34')]()['then'](function(){_0x41a5a0[_0x555a('0x28')](0xcc)[_0x555a('0x29')]();});}};}function handleEntityNotFound(_0x19a8fa,_0x56dd57){return function(_0x3b9708){if(!_0x3b9708){_0x19a8fa['sendStatus'](0x194);}return _0x3b9708;};}function handleError(_0x9928a1,_0x36f866){_0x36f866=_0x36f866||0x1f4;return function(_0x5ac914){logger[_0x555a('0x23')](_0x5ac914['stack']);if(_0x5ac914[_0x555a('0x35')]){delete _0x5ac914['name'];}_0x9928a1[_0x555a('0x28')](_0x36f866)[_0x555a('0x36')](_0x5ac914);};}exports[_0x555a('0x37')]=function(_0x2e2b62,_0x388be2){var _0x2394dc={},_0x14227f={},_0x2152b2={'count':0x0,'rows':[]};var _0x4f2a10=_['map'](db[_0x555a('0x38')][_0x555a('0x39')],function(_0x303c6c){return{'name':_0x303c6c[_0x555a('0x3a')],'type':_0x303c6c['type'][_0x555a('0x3b')]};});_0x14227f[_0x555a('0x3c')]=_[_0x555a('0x3d')](_0x4f2a10,'name');_0x14227f[_0x555a('0x3e')]=_[_0x555a('0x3f')](_0x2e2b62['query']);_0x14227f[_0x555a('0x40')]=_[_0x555a('0x41')](_0x14227f[_0x555a('0x3c')],_0x14227f['query']);_0x2394dc[_0x555a('0x42')]=_['intersection'](_0x14227f[_0x555a('0x3c')],qs[_0x555a('0x43')](_0x2e2b62[_0x555a('0x3e')][_0x555a('0x43')]));_0x2394dc[_0x555a('0x42')]=_0x2394dc[_0x555a('0x42')]['length']?_0x2394dc[_0x555a('0x42')]:_0x14227f[_0x555a('0x3c')];if(!_0x2e2b62[_0x555a('0x3e')][_0x555a('0x44')](_0x555a('0x45'))){_0x2394dc[_0x555a('0x2d')]=qs['limit'](_0x2e2b62[_0x555a('0x3e')][_0x555a('0x2d')]);_0x2394dc[_0x555a('0x2b')]=qs['offset'](_0x2e2b62[_0x555a('0x3e')][_0x555a('0x2b')]);}_0x2394dc['order']=qs['sort'](_0x2e2b62[_0x555a('0x3e')][_0x555a('0x46')]);_0x2394dc[_0x555a('0x47')]=qs[_0x555a('0x40')](_[_0x555a('0x48')](_0x2e2b62[_0x555a('0x3e')],_0x14227f['filters']),_0x4f2a10);if(_0x2e2b62[_0x555a('0x3e')]['filter']){_0x2394dc['where']=_[_0x555a('0x49')](_0x2394dc[_0x555a('0x47')],{'$or':_['map'](_0x4f2a10,function(_0x3be661){if(_0x3be661[_0x555a('0x4a')]!==_0x555a('0x4b')){var _0x229878={};_0x229878[_0x3be661[_0x555a('0x35')]]={'$like':'%'+_0x2e2b62['query'][_0x555a('0x4c')]+'%'};return _0x229878;}})});}_0x2394dc=_[_0x555a('0x49')]({},_0x2394dc,_0x2e2b62[_0x555a('0x4d')]);var _0x2de28e={'where':_0x2394dc[_0x555a('0x47')]};return db[_0x555a('0x38')][_0x555a('0x2e')](_0x2de28e)[_0x555a('0x33')](function(_0x16c3c7){_0x2152b2[_0x555a('0x2e')]=_0x16c3c7;if(_0x2e2b62[_0x555a('0x3e')][_0x555a('0x4e')]){_0x2394dc['include']=[{'all':!![]}];}return db[_0x555a('0x38')][_0x555a('0x4f')](_0x2394dc);})[_0x555a('0x33')](function(_0x25387c){_0x2152b2[_0x555a('0x50')]=_0x25387c;return _0x2152b2;})[_0x555a('0x33')](respondWithFilteredResult(_0x388be2,_0x2394dc))[_0x555a('0x26')](handleError(_0x388be2,null));};exports[_0x555a('0x51')]=function(_0x463682,_0x52267a){var _0x4d0bae={'raw':!![],'where':{'id':_0x463682[_0x555a('0x52')]['id']}},_0x56469c={};_0x56469c[_0x555a('0x3c')]=_[_0x555a('0x3f')](db[_0x555a('0x38')]['rawAttributes']);_0x56469c[_0x555a('0x3e')]=_[_0x555a('0x3f')](_0x463682['query']);_0x56469c[_0x555a('0x40')]=_['intersection'](_0x56469c[_0x555a('0x3c')],_0x56469c[_0x555a('0x3e')]);_0x4d0bae[_0x555a('0x42')]=_[_0x555a('0x41')](_0x56469c[_0x555a('0x3c')],qs[_0x555a('0x43')](_0x463682[_0x555a('0x3e')][_0x555a('0x43')]));_0x4d0bae['attributes']=_0x4d0bae[_0x555a('0x42')][_0x555a('0x53')]?_0x4d0bae['attributes']:_0x56469c[_0x555a('0x3c')];if(_0x463682[_0x555a('0x3e')][_0x555a('0x4e')]){_0x4d0bae[_0x555a('0x54')]=[{'all':!![]}];}_0x4d0bae=_[_0x555a('0x49')]({},_0x4d0bae,_0x463682[_0x555a('0x4d')]);return db[_0x555a('0x38')][_0x555a('0x55')](_0x4d0bae)[_0x555a('0x33')](handleEntityNotFound(_0x52267a,null))[_0x555a('0x33')](respondWithResult(_0x52267a,null))[_0x555a('0x26')](handleError(_0x52267a,null));};exports['update']=function(_0x5af379,_0x5c8255){if(_0x5af379[_0x555a('0x56')]['id']){delete _0x5af379[_0x555a('0x56')]['id'];}return db[_0x555a('0x38')]['find']({'where':{'id':_0x5af379[_0x555a('0x52')]['id']}})[_0x555a('0x33')](handleEntityNotFound(_0x5c8255,null))[_0x555a('0x33')](saveUpdates(_0x5af379[_0x555a('0x56')],null))[_0x555a('0x33')](respondWithResult(_0x5c8255,null))[_0x555a('0x26')](handleError(_0x5c8255,null));};exports['destroy']=function(_0x588f70,_0x2bc363){return db[_0x555a('0x38')][_0x555a('0x55')]({'where':{'id':_0x588f70[_0x555a('0x52')]['id']}})[_0x555a('0x33')](handleEntityNotFound(_0x2bc363,null))[_0x555a('0x33')](removeEntity(_0x2bc363,null))[_0x555a('0x26')](handleError(_0x2bc363,null));};exports[_0x555a('0x57')]=function(_0x10d9ac,_0xb0e66f){return db[_0x555a('0x38')][_0x555a('0x57')]()[_0x555a('0x33')](respondWithResult(_0xb0e66f,null))['catch'](handleError(_0xb0e66f,null));};var interaction_log=require(_0x555a('0x10'))('fax-interactions');exports[_0x555a('0x58')]=function(_0x4015fd,_0x5d2b5c,_0x22e994){var _0x456dc4={'agent':{},'channel':'fax'};if(_0x4015fd['body']['id']){delete _0x4015fd[_0x555a('0x56')]['id'];}_0x4015fd[_0x555a('0x56')][_0x555a('0x59')]=!![];_0x4015fd['body']['readAt']=moment()[_0x555a('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x4015fd['body'][_0x555a('0x5b')]=_0x4015fd[_0x555a('0x56')][_0x555a('0x5b')]||_0x4015fd['user']['id'];_0x456dc4[_0x555a('0x5c')]['id']=_0x4015fd['body'][_0x555a('0x5b')];return db[_0x555a('0x38')]['find']({'where':{'id':_0x4015fd[_0x555a('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d2b5c,null))[_0x555a('0x33')](saveUpdates(_0x4015fd[_0x555a('0x56')],null))[_0x555a('0x33')](function(_0x520dd6){if(_0x520dd6){_0x456dc4[_0x555a('0x24')]=_0x520dd6[_0x555a('0x5d')]({'plain':!![]});return db[_0x555a('0x5e')][_0x555a('0x55')]({'where':{'id':_0x520dd6['FaxInteractionId']}});}return null;})[_0x555a('0x33')](handleEntityNotFound(_0x5d2b5c,null))[_0x555a('0x33')](function(_0x415eb2){if(_0x415eb2){return _0x415eb2[_0x555a('0x32')]({'UserId':_0x4015fd[_0x555a('0x56')]['UserId'],'read1stAt':_['isNil'](_0x415eb2[_0x555a('0x5f')])?moment()[_0x555a('0x5a')](_0x555a('0x60')):undefined});}return null;})[_0x555a('0x33')](function(_0x4d1f18){if(_0x4d1f18){_0x456dc4[_0x555a('0x61')]=_0x4d1f18[_0x555a('0x5d')]({'plain':!![]});interaction_log[_0x555a('0x1d')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4015fd[_0x555a('0x62')]['id'],_0x4015fd[_0x555a('0x62')][_0x555a('0x35')],_0x4015fd[_0x555a('0x62')]['role'],_0x456dc4[_0x555a('0x61')]['id'],_0x4015fd[_0x555a('0x56')]?JSON['stringify'](_0x4015fd[_0x555a('0x56')]):_0x555a('0x63'));return respondWithRpcPromise(_0x555a('0x64'),'acceptMessage',_0x456dc4);}return null;})[_0x555a('0x33')](function(_0x5d7a44){var _0x461636=_0x555a('0x65')+_0x5d7a44[_0x555a('0x24')][_0x555a('0x66')];return db[_0x555a('0x67')][_0x555a('0x3e')](_0x461636,{'type':db[_0x555a('0x68')][_0x555a('0x69')][_0x555a('0x6a')],'raw':!![]})['then'](function(_0x5d1665){return _0x5d1665;});})[_0x555a('0x33')](function(_0x257ee6){if(_0x257ee6){_0x456dc4[_0x555a('0x24')][_0x555a('0x6b')]=_0x257ee6[0x0];if(!_0x4015fd['body'][_0x555a('0x5b')])return;return db[_0x555a('0x6c')][_0x555a('0x55')]({'where':{'id':_0x4015fd[_0x555a('0x56')]['UserId'],'role':_0x555a('0x5c')},'attributes':['id',_0x555a('0x35'),_0x555a('0x6d'),_0x555a('0x6e'),_0x555a('0x6f')],'raw':!![]});}return null;})[_0x555a('0x33')](function(_0x37a051){if(!_0x37a051)return null;_0x456dc4[_0x555a('0x24')][_0x555a('0x5c')]=_0x37a051;return _0x456dc4;})['then'](function(_0x4b4966){if(_0x4b4966){if(_0x4015fd[_0x555a('0x56')][_0x555a('0x70')]){_0x456dc4['message'][_0x555a('0x71')]=util[_0x555a('0x5a')](_0x555a('0x72'),_0x4015fd['user'][_0x555a('0x35')]);_0x456dc4[_0x555a('0x24')]['channel']=_0x456dc4[_0x555a('0x73')];_0x456dc4[_0x555a('0x24')][_0x555a('0x74')]=_0x555a('0x58');return respondWithRpcPromise(_0x555a('0x75'),'EventManager',{'event':'acceptmessage','message':_0x456dc4[_0x555a('0x24')]},client9002)[_0x555a('0x33')](function(){return _0x456dc4;});}return _0x456dc4;}return null;})[_0x555a('0x33')](respondWithResult(_0x5d2b5c,null))[_0x555a('0x26')](handleError(_0x5d2b5c,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x555a('0x30')]=function(_0x1c5218,_0x34205f,_0x5bde65){var _0x3b7bd8={'agent':{},'channel':_0x555a('0x76')};if(_0x1c5218[_0x555a('0x56')]['id']){delete _0x1c5218[_0x555a('0x56')]['id'];}_0x1c5218['body'][_0x555a('0x5b')]=_0x1c5218[_0x555a('0x56')][_0x555a('0x5b')]||_0x1c5218[_0x555a('0x62')]['id'];_0x3b7bd8[_0x555a('0x5c')]['id']=_0x1c5218[_0x555a('0x56')]['UserId'];return db['FaxMessage'][_0x555a('0x55')]({'where':{'id':_0x1c5218['params']['id'],'UserId':null}})[_0x555a('0x33')](handleEntityNotFound(_0x34205f,null))['then'](function(_0x545e92){if(_0x545e92){_0x3b7bd8[_0x555a('0x24')]=_0x545e92['get']({'plain':!![]});return db[_0x555a('0x5e')]['find']({'where':{'id':_0x545e92[_0x555a('0x77')]}});}return null;})[_0x555a('0x33')](handleEntityNotFound(_0x34205f,null))[_0x555a('0x33')](function(_0x4d732e){if(_0x4d732e){_0x3b7bd8['interaction']=_0x4d732e[_0x555a('0x5d')]({'plain':!![]});interaction_log[_0x555a('0x1d')](_0x555a('0x78'),_0x1c5218[_0x555a('0x62')]['id'],_0x1c5218[_0x555a('0x62')]['name'],_0x1c5218[_0x555a('0x62')]['role'],_0x3b7bd8[_0x555a('0x61')]['id'],_0x1c5218[_0x555a('0x56')]?JSON[_0x555a('0x22')](_0x1c5218['body']):_0x555a('0x63'));return respondWithRpcPromise(_0x555a('0x79'),_0x555a('0x7a'),_0x3b7bd8);}return null;})[_0x555a('0x33')](function(_0x18f58e){var _0x25117c=_0x555a('0x65')+_0x18f58e[_0x555a('0x24')][_0x555a('0x66')];return db['sequelize']['query'](_0x25117c,{'type':db[_0x555a('0x68')][_0x555a('0x69')][_0x555a('0x6a')],'raw':!![]})['then'](function(_0x14e209){return _0x14e209;});})['then'](function(_0x332f58){if(_0x332f58){_0x3b7bd8[_0x555a('0x24')][_0x555a('0x6b')]=_0x332f58[0x0];if(!_0x1c5218['body'][_0x555a('0x5b')])return;return db['User'][_0x555a('0x55')]({'where':{'id':_0x1c5218[_0x555a('0x56')][_0x555a('0x5b')],'role':_0x555a('0x5c')},'attributes':['id',_0x555a('0x35'),_0x555a('0x6d'),_0x555a('0x6e'),_0x555a('0x6f')],'raw':!![]});}return null;})[_0x555a('0x33')](function(_0x19e686){if(!_0x19e686)return null;_0x3b7bd8[_0x555a('0x24')][_0x555a('0x5c')]=_0x19e686;return _0x3b7bd8;})[_0x555a('0x33')](function(_0x5e06cb){if(_0x5e06cb){_0x5e06cb[_0x555a('0x24')]['interface']=util[_0x555a('0x5a')]('SIP/%s',_0x1c5218[_0x555a('0x62')]['name']);_0x5e06cb[_0x555a('0x24')][_0x555a('0x73')]=_0x3b7bd8['channel'];_0x5e06cb[_0x555a('0x24')][_0x555a('0x74')]=_0x555a('0x30');respondWithRpcPromise(_0x555a('0x75'),_0x555a('0x75'),{'event':_0x555a('0x7b'),'message':_0x5e06cb['message']},client9002);return _0x3b7bd8;}return null;})['then'](respondWithResult(_0x34205f,null))[_0x555a('0x26')](handleError(_0x34205f,null));};exports[_0x555a('0x7c')]=function(_0x1a40ca,_0x2f8dfa){var _0x4786af;return db[_0x555a('0x38')]['create'](_0x1a40ca['body'],{})[_0x555a('0x33')](function(_0x5d23d6){_0x4786af=_0x5d23d6;return db[_0x555a('0x7d')]['findOne']({'where':{'id':_0x4786af['ContactId']}});})['then'](function(_0x204409){if(_[_0x555a('0x7e')](_0x204409)){return;}else{_0x4786af['fax']=_0x204409[_0x555a('0x76')];return db['Attachment']['findOne']({'where':{'id':_0x4786af['AttachmentId']}});}})[_0x555a('0x33')](function(_0x416c91){return respondWithRpcPromise(_0x555a('0x7f'),_0x555a('0x7f'),{'FaxAccountId':_[_0x555a('0x7e')](_0x1a40ca[_0x555a('0x56')])?undefined:_0x1a40ca[_0x555a('0x56')][_0x555a('0x80')],'path':_['isNil'](_0x416c91)?undefined:util[_0x555a('0x5a')](_0x555a('0x81'),_0x416c91['basename']),'fax':_['isNil'](_0x4786af[_0x555a('0x76')])?undefined:_0x4786af[_0x555a('0x76')],'AttachmentId':_0x4786af[_0x555a('0x82')]},client9002);})[_0x555a('0x33')](respondWithResult(_0x2f8dfa,0xc9))[_0x555a('0x26')](handleError(_0x2f8dfa,null));};exports[_0x555a('0x83')]=function(_0x4a385b,_0x101fea){var _0x5eba77=path[_0x555a('0x84')](config[_0x555a('0x85')],'server',_0x555a('0x86'),_0x555a('0x87'));return db[_0x555a('0x38')]['find']({'where':{'id':_0x4a385b[_0x555a('0x52')]['id']},'include':[{'model':db['Attachment'],'as':_0x555a('0x88')}]})[_0x555a('0x33')](handleEntityNotFound(_0x101fea,null))['then'](function(_0x391ed9){if(_0x391ed9){return _0x101fea[_0x555a('0x83')](path[_0x555a('0x84')](_0x5eba77,_0x391ed9[_0x555a('0x88')][_0x555a('0x89')]));}})[_0x555a('0x26')](handleError(_0x101fea,null));}; \ No newline at end of file +var _0xf28b=['save','update','then','destroy','sendStatus','stack','send','FaxMessage','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','includeAll','include','findAll','params','find','body','describe','fax-interactions','accept','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','EventManager','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','email','event','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','attachments','basename','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','code','FaxMessage,\x20%s,\x20%s','error','message','result','catch','end','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xf28b,0xee));var _0xbf28=function(_0x4d1761,_0x3f6e59){_0x4d1761=_0x4d1761-0x0;var _0x7781e9=_0xf28b[_0x4d1761];return _0x7781e9;};'use strict';var emlformat=require(_0xbf28('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbf28('0x1'));var rp=require(_0xbf28('0x2'));var moment=require(_0xbf28('0x3'));var BPromise=require(_0xbf28('0x4'));var Mustache=require(_0xbf28('0x5'));var util=require(_0xbf28('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbf28('0x7'));var fs=require('fs');var fs_extra=require(_0xbf28('0x8'));var _=require(_0xbf28('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbf28('0xa'));var deskjs=require(_0xbf28('0xb'));var toCsv=require(_0xbf28('0xc'));var querystring=require(_0xbf28('0xd'));var Papa=require(_0xbf28('0xe'));var Redis=require(_0xbf28('0xf'));var authService=require(_0xbf28('0x10'));var qs=require(_0xbf28('0x11'));var as=require(_0xbf28('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf28('0x13'))(_0xbf28('0x14'));var utils=require('../../config/utils');var config=require(_0xbf28('0x15'));var licenseUtil=require(_0xbf28('0x16'));var db=require(_0xbf28('0x17'))['db'];config[_0xbf28('0x18')]=_[_0xbf28('0x19')](config[_0xbf28('0x18')],{'host':_0xbf28('0x1a'),'port':0x18eb});var socket=require(_0xbf28('0x1b'))(new Redis(config[_0xbf28('0x18')]));require(_0xbf28('0x1c'))[_0xbf28('0x1d')](socket);var jayson=require(_0xbf28('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbf28('0x1f')][_0xbf28('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x595d83,_0x290aa5,_0x344574,_0x2e223f){return new BPromise(function(_0x5e6e9d,_0x50609b){var _0x5675e2=_0x2e223f||client;return _0x5675e2[_0xbf28('0x21')](_0x595d83,_0x344574)['then'](function(_0x331a2f){logger['info']('FaxMessage,\x20%s,\x20%s',_0x290aa5,_0xbf28('0x22'));logger[_0xbf28('0x23')](_0xbf28('0x24'),_0x290aa5,_0xbf28('0x22'),JSON['stringify'](_0x331a2f));if(_0x331a2f['error']){if(_0x331a2f['error'][_0xbf28('0x25')]===0x1f4){logger['error'](_0xbf28('0x26'),_0x290aa5,_0x331a2f[_0xbf28('0x27')][_0xbf28('0x28')]);return _0x50609b(_0x331a2f[_0xbf28('0x27')][_0xbf28('0x28')]);}logger[_0xbf28('0x27')]('FaxMessage,\x20%s,\x20%s',_0x290aa5,_0x331a2f[_0xbf28('0x27')][_0xbf28('0x28')]);return _0x5e6e9d(_0x331a2f[_0xbf28('0x27')][_0xbf28('0x28')]);}else{logger['info'](_0xbf28('0x26'),_0x290aa5,'request\x20sent');_0x5e6e9d(_0x331a2f[_0xbf28('0x29')][_0xbf28('0x28')]);}})[_0xbf28('0x2a')](function(_0x50b137){logger[_0xbf28('0x27')](_0xbf28('0x26'),_0x290aa5,_0x50b137);_0x50609b(_0x50b137);});});}function respondWithStatusCode(_0x34dcc0,_0x424f2a){_0x424f2a=_0x424f2a||0xcc;return function(_0x4522da){if(_0x4522da){return _0x34dcc0['sendStatus'](_0x424f2a);}return _0x34dcc0['status'](_0x424f2a)[_0xbf28('0x2b')]();};}function respondWithResult(_0x4b8e46,_0x3b8161){_0x3b8161=_0x3b8161||0xc8;return function(_0xcd3bcd){if(_0xcd3bcd){return _0x4b8e46[_0xbf28('0x2c')](_0x3b8161)[_0xbf28('0x2d')](_0xcd3bcd);}};}function respondWithFilteredResult(_0x3b960a,_0x448e9d){return function(_0x4e4684){if(_0x4e4684){var _0x23ef3a=typeof _0x448e9d[_0xbf28('0x2e')]==='undefined'&&typeof _0x448e9d[_0xbf28('0x2f')]===_0xbf28('0x30');var _0x4244c6=_0x4e4684['count'];var _0x4651b3=_0x23ef3a?0x0:_0x448e9d[_0xbf28('0x2e')];var _0x10581b=_0x23ef3a?_0x4e4684[_0xbf28('0x31')]:_0x448e9d[_0xbf28('0x2e')]+_0x448e9d[_0xbf28('0x2f')];var _0x5be4a0;if(_0x10581b>=_0x4244c6){_0x10581b=_0x4244c6;_0x5be4a0=0xc8;}else{_0x5be4a0=0xce;}_0x3b960a[_0xbf28('0x2c')](_0x5be4a0);return _0x3b960a[_0xbf28('0x32')](_0xbf28('0x33'),_0x4651b3+'-'+_0x10581b+'/'+_0x4244c6)[_0xbf28('0x2d')](_0x4e4684);}return null;};}function patchUpdates(_0x1cbd9d){return function(_0x52bf09){try{jsonpatch['apply'](_0x52bf09,_0x1cbd9d,!![]);}catch(_0x515886){return BPromise['reject'](_0x515886);}return _0x52bf09[_0xbf28('0x34')]();};}function saveUpdates(_0x2bc51e,_0x216c4f){return function(_0x582bef){if(_0x582bef){return _0x582bef[_0xbf28('0x35')](_0x2bc51e)[_0xbf28('0x36')](function(_0x58379a){return _0x58379a;});}return null;};}function removeEntity(_0x550168,_0x188740){return function(_0x1b9172){if(_0x1b9172){return _0x1b9172[_0xbf28('0x37')]()[_0xbf28('0x36')](function(){_0x550168[_0xbf28('0x2c')](0xcc)[_0xbf28('0x2b')]();});}};}function handleEntityNotFound(_0x20292e,_0x537eef){return function(_0x28d295){if(!_0x28d295){_0x20292e[_0xbf28('0x38')](0x194);}return _0x28d295;};}function handleError(_0x3f6fe8,_0x29710b){_0x29710b=_0x29710b||0x1f4;return function(_0x300436){logger[_0xbf28('0x27')](_0x300436[_0xbf28('0x39')]);if(_0x300436['name']){delete _0x300436['name'];}_0x3f6fe8['status'](_0x29710b)[_0xbf28('0x3a')](_0x300436);};}exports['index']=function(_0x24a0d5,_0x580644){var _0xf2d09e={},_0x302fd8={},_0x2d19b2={'count':0x0,'rows':[]};var _0x47f516=_['map'](db[_0xbf28('0x3b')][_0xbf28('0x3c')],function(_0x59f9e2){return{'name':_0x59f9e2[_0xbf28('0x3d')],'type':_0x59f9e2['type'][_0xbf28('0x3e')]};});_0x302fd8['model']=_[_0xbf28('0x3f')](_0x47f516,'name');_0x302fd8['query']=_[_0xbf28('0x40')](_0x24a0d5[_0xbf28('0x41')]);_0x302fd8[_0xbf28('0x42')]=_[_0xbf28('0x43')](_0x302fd8[_0xbf28('0x44')],_0x302fd8[_0xbf28('0x41')]);_0xf2d09e[_0xbf28('0x45')]=_[_0xbf28('0x43')](_0x302fd8[_0xbf28('0x44')],qs[_0xbf28('0x46')](_0x24a0d5[_0xbf28('0x41')]['fields']));_0xf2d09e[_0xbf28('0x45')]=_0xf2d09e[_0xbf28('0x45')][_0xbf28('0x47')]?_0xf2d09e[_0xbf28('0x45')]:_0x302fd8[_0xbf28('0x44')];if(!_0x24a0d5['query'][_0xbf28('0x48')](_0xbf28('0x49'))){_0xf2d09e[_0xbf28('0x2f')]=qs[_0xbf28('0x2f')](_0x24a0d5['query'][_0xbf28('0x2f')]);_0xf2d09e[_0xbf28('0x2e')]=qs['offset'](_0x24a0d5['query'][_0xbf28('0x2e')]);}_0xf2d09e[_0xbf28('0x4a')]=qs[_0xbf28('0x4b')](_0x24a0d5[_0xbf28('0x41')][_0xbf28('0x4b')]);_0xf2d09e[_0xbf28('0x4c')]=qs[_0xbf28('0x42')](_[_0xbf28('0x4d')](_0x24a0d5[_0xbf28('0x41')],_0x302fd8[_0xbf28('0x42')]),_0x47f516);if(_0x24a0d5['query'][_0xbf28('0x4e')]){_0xf2d09e['where']=_[_0xbf28('0x4f')](_0xf2d09e['where'],{'$or':_['map'](_0x47f516,function(_0x101da0){if(_0x101da0[_0xbf28('0x50')]!==_0xbf28('0x51')){var _0x5a857f={};_0x5a857f[_0x101da0[_0xbf28('0x52')]]={'$like':'%'+_0x24a0d5['query']['filter']+'%'};return _0x5a857f;}})});}_0xf2d09e=_[_0xbf28('0x4f')]({},_0xf2d09e,_0x24a0d5[_0xbf28('0x53')]);var _0x29516d={'where':_0xf2d09e['where']};return db['FaxMessage'][_0xbf28('0x31')](_0x29516d)[_0xbf28('0x36')](function(_0xc12cc8){_0x2d19b2[_0xbf28('0x31')]=_0xc12cc8;if(_0x24a0d5['query'][_0xbf28('0x54')]){_0xf2d09e[_0xbf28('0x55')]=[{'all':!![]}];}return db[_0xbf28('0x3b')][_0xbf28('0x56')](_0xf2d09e);})[_0xbf28('0x36')](function(_0x192bfb){_0x2d19b2['rows']=_0x192bfb;return _0x2d19b2;})[_0xbf28('0x36')](respondWithFilteredResult(_0x580644,_0xf2d09e))[_0xbf28('0x2a')](handleError(_0x580644,null));};exports['show']=function(_0x31da3f,_0x5828b7){var _0x1769ae={'raw':!![],'where':{'id':_0x31da3f[_0xbf28('0x57')]['id']}},_0x17faa1={};_0x17faa1[_0xbf28('0x44')]=_['keys'](db['FaxMessage'][_0xbf28('0x3c')]);_0x17faa1['query']=_['keys'](_0x31da3f[_0xbf28('0x41')]);_0x17faa1[_0xbf28('0x42')]=_[_0xbf28('0x43')](_0x17faa1['model'],_0x17faa1[_0xbf28('0x41')]);_0x1769ae['attributes']=_[_0xbf28('0x43')](_0x17faa1[_0xbf28('0x44')],qs[_0xbf28('0x46')](_0x31da3f[_0xbf28('0x41')]['fields']));_0x1769ae[_0xbf28('0x45')]=_0x1769ae[_0xbf28('0x45')][_0xbf28('0x47')]?_0x1769ae['attributes']:_0x17faa1[_0xbf28('0x44')];if(_0x31da3f[_0xbf28('0x41')][_0xbf28('0x54')]){_0x1769ae['include']=[{'all':!![]}];}_0x1769ae=_[_0xbf28('0x4f')]({},_0x1769ae,_0x31da3f[_0xbf28('0x53')]);return db[_0xbf28('0x3b')][_0xbf28('0x58')](_0x1769ae)[_0xbf28('0x36')](handleEntityNotFound(_0x5828b7,null))[_0xbf28('0x36')](respondWithResult(_0x5828b7,null))['catch'](handleError(_0x5828b7,null));};exports[_0xbf28('0x35')]=function(_0x25bc06,_0x13db79){if(_0x25bc06['body']['id']){delete _0x25bc06[_0xbf28('0x59')]['id'];}return db[_0xbf28('0x3b')]['find']({'where':{'id':_0x25bc06['params']['id']}})[_0xbf28('0x36')](handleEntityNotFound(_0x13db79,null))[_0xbf28('0x36')](saveUpdates(_0x25bc06[_0xbf28('0x59')],null))[_0xbf28('0x36')](respondWithResult(_0x13db79,null))[_0xbf28('0x2a')](handleError(_0x13db79,null));};exports['destroy']=function(_0x574182,_0x1394f9){return db[_0xbf28('0x3b')][_0xbf28('0x58')]({'where':{'id':_0x574182['params']['id']}})[_0xbf28('0x36')](handleEntityNotFound(_0x1394f9,null))[_0xbf28('0x36')](removeEntity(_0x1394f9,null))['catch'](handleError(_0x1394f9,null));};exports[_0xbf28('0x5a')]=function(_0x51e5d6,_0x4eac99){return db[_0xbf28('0x3b')][_0xbf28('0x5a')]()['then'](respondWithResult(_0x4eac99,null))[_0xbf28('0x2a')](handleError(_0x4eac99,null));};var interaction_log=require(_0xbf28('0x13'))(_0xbf28('0x5b'));exports[_0xbf28('0x5c')]=function(_0xeb0214,_0x4a379a,_0x19a84e){var _0xacc9a9={'agent':{},'channel':_0xbf28('0x5d')};if(_0xeb0214[_0xbf28('0x59')]['id']){delete _0xeb0214['body']['id'];}_0xeb0214[_0xbf28('0x59')][_0xbf28('0x5e')]=!![];_0xeb0214[_0xbf28('0x59')]['readAt']=moment()['format'](_0xbf28('0x5f'));_0xeb0214[_0xbf28('0x59')][_0xbf28('0x60')]=_0xeb0214[_0xbf28('0x59')][_0xbf28('0x60')]||_0xeb0214['user']['id'];_0xacc9a9['agent']['id']=_0xeb0214['body'][_0xbf28('0x60')];return db['FaxMessage'][_0xbf28('0x58')]({'where':{'id':_0xeb0214[_0xbf28('0x57')]['id'],'UserId':null}})[_0xbf28('0x36')](handleEntityNotFound(_0x4a379a,null))['then'](saveUpdates(_0xeb0214[_0xbf28('0x59')],null))['then'](function(_0x2c88a4){if(_0x2c88a4){_0xacc9a9['message']=_0x2c88a4[_0xbf28('0x61')]({'plain':!![]});return db[_0xbf28('0x62')][_0xbf28('0x58')]({'where':{'id':_0x2c88a4[_0xbf28('0x63')]}});}return null;})[_0xbf28('0x36')](handleEntityNotFound(_0x4a379a,null))[_0xbf28('0x36')](function(_0x12f5d2){if(_0x12f5d2){return _0x12f5d2[_0xbf28('0x35')]({'UserId':_0xeb0214[_0xbf28('0x59')]['UserId'],'read1stAt':_[_0xbf28('0x64')](_0x12f5d2[_0xbf28('0x65')])?moment()[_0xbf28('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbf28('0x36')](function(_0x35eb49){if(_0x35eb49){_0xacc9a9['interaction']=_0x35eb49[_0xbf28('0x61')]({'plain':!![]});interaction_log[_0xbf28('0x67')](_0xbf28('0x68'),_0xeb0214[_0xbf28('0x69')]['id'],_0xeb0214[_0xbf28('0x69')][_0xbf28('0x52')],_0xeb0214[_0xbf28('0x69')][_0xbf28('0x6a')],_0xacc9a9[_0xbf28('0x6b')]['id'],_0xeb0214[_0xbf28('0x59')]?JSON[_0xbf28('0x6c')](_0xeb0214['body']):_0xbf28('0x6d'));return respondWithRpcPromise(_0xbf28('0x6e'),_0xbf28('0x6f'),_0xacc9a9);}return null;})[_0xbf28('0x36')](function(_0x4d17ff){var _0x34b8ad='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4d17ff['message'][_0xbf28('0x70')];return db['sequelize']['query'](_0x34b8ad,{'type':db[_0xbf28('0x71')][_0xbf28('0x72')][_0xbf28('0x73')],'raw':!![]})[_0xbf28('0x36')](function(_0x4d89b0){return _0x4d89b0;});})[_0xbf28('0x36')](function(_0x35d9ff){if(_0x35d9ff){_0xacc9a9['message'][_0xbf28('0x74')]=_0x35d9ff[0x0];if(!_0xeb0214[_0xbf28('0x59')][_0xbf28('0x60')])return;return db[_0xbf28('0x75')]['find']({'where':{'id':_0xeb0214[_0xbf28('0x59')][_0xbf28('0x60')],'role':_0xbf28('0x76')},'attributes':['id',_0xbf28('0x52'),_0xbf28('0x77'),'email',_0xbf28('0x78')],'raw':!![]});}return null;})[_0xbf28('0x36')](function(_0x56dbb9){if(!_0x56dbb9)return null;_0xacc9a9['message'][_0xbf28('0x76')]=_0x56dbb9;return _0xacc9a9;})['then'](function(_0x4cc9ab){if(_0x4cc9ab){if(_0xeb0214[_0xbf28('0x59')][_0xbf28('0x79')]){_0xacc9a9[_0xbf28('0x28')][_0xbf28('0x7a')]=util[_0xbf28('0x66')](_0xbf28('0x7b'),_0xeb0214[_0xbf28('0x69')][_0xbf28('0x52')]);_0xacc9a9['message'][_0xbf28('0x7c')]=_0xacc9a9[_0xbf28('0x7c')];_0xacc9a9[_0xbf28('0x28')]['event']=_0xbf28('0x5c');return respondWithRpcPromise(_0xbf28('0x7d'),'EventManager',{'event':'acceptmessage','message':_0xacc9a9[_0xbf28('0x28')]},client9002)[_0xbf28('0x36')](function(){return _0xacc9a9;});}return _0xacc9a9;}return null;})[_0xbf28('0x36')](respondWithResult(_0x4a379a,null))[_0xbf28('0x2a')](handleError(_0x4a379a,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xbf28('0x7e')]=function(_0x246203,_0x12bbf3,_0x7e4e7){var _0x218ad2={'agent':{},'channel':_0xbf28('0x5d')};if(_0x246203['body']['id']){delete _0x246203['body']['id'];}_0x246203[_0xbf28('0x59')][_0xbf28('0x60')]=_0x246203['body'][_0xbf28('0x60')]||_0x246203[_0xbf28('0x69')]['id'];_0x218ad2[_0xbf28('0x76')]['id']=_0x246203[_0xbf28('0x59')][_0xbf28('0x60')];return db[_0xbf28('0x3b')][_0xbf28('0x58')]({'where':{'id':_0x246203['params']['id'],'UserId':null}})[_0xbf28('0x36')](handleEntityNotFound(_0x12bbf3,null))[_0xbf28('0x36')](function(_0x436cb6){if(_0x436cb6){_0x218ad2['message']=_0x436cb6['get']({'plain':!![]});return db[_0xbf28('0x62')][_0xbf28('0x58')]({'where':{'id':_0x436cb6['FaxInteractionId']}});}return null;})[_0xbf28('0x36')](handleEntityNotFound(_0x12bbf3,null))[_0xbf28('0x36')](function(_0x14cf49){if(_0x14cf49){_0x218ad2[_0xbf28('0x6b')]=_0x14cf49[_0xbf28('0x61')]({'plain':!![]});interaction_log['info'](_0xbf28('0x7f'),_0x246203[_0xbf28('0x69')]['id'],_0x246203[_0xbf28('0x69')][_0xbf28('0x52')],_0x246203[_0xbf28('0x69')]['role'],_0x218ad2[_0xbf28('0x6b')]['id'],_0x246203['body']?JSON[_0xbf28('0x6c')](_0x246203[_0xbf28('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0xbf28('0x80'),_0x218ad2);}return null;})[_0xbf28('0x36')](function(_0x554ff5){var _0x5ab328='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x554ff5['message']['ContactId'];return db[_0xbf28('0x81')]['query'](_0x5ab328,{'type':db[_0xbf28('0x71')]['QueryTypes'][_0xbf28('0x73')],'raw':!![]})[_0xbf28('0x36')](function(_0x16bd7e){return _0x16bd7e;});})[_0xbf28('0x36')](function(_0x1c6871){if(_0x1c6871){_0x218ad2['message'][_0xbf28('0x74')]=_0x1c6871[0x0];if(!_0x246203['body'][_0xbf28('0x60')])return;return db[_0xbf28('0x75')][_0xbf28('0x58')]({'where':{'id':_0x246203['body'][_0xbf28('0x60')],'role':_0xbf28('0x76')},'attributes':['id','name',_0xbf28('0x77'),_0xbf28('0x82'),_0xbf28('0x78')],'raw':!![]});}return null;})[_0xbf28('0x36')](function(_0x1dc30e){if(!_0x1dc30e)return null;_0x218ad2[_0xbf28('0x28')][_0xbf28('0x76')]=_0x1dc30e;return _0x218ad2;})[_0xbf28('0x36')](function(_0x5d2e9c){if(_0x5d2e9c){_0x5d2e9c['message']['interface']=util[_0xbf28('0x66')](_0xbf28('0x7b'),_0x246203['user'][_0xbf28('0x52')]);_0x5d2e9c[_0xbf28('0x28')][_0xbf28('0x7c')]=_0x218ad2[_0xbf28('0x7c')];_0x5d2e9c[_0xbf28('0x28')][_0xbf28('0x83')]='reject';respondWithRpcPromise(_0xbf28('0x7d'),_0xbf28('0x7d'),{'event':_0xbf28('0x84'),'message':_0x5d2e9c[_0xbf28('0x28')]},client9002);return _0x218ad2;}return null;})[_0xbf28('0x36')](respondWithResult(_0x12bbf3,null))['catch'](handleError(_0x12bbf3,null));};exports['create']=function(_0x3fd437,_0x1a69bd){var _0x345eef;return db[_0xbf28('0x3b')][_0xbf28('0x85')](_0x3fd437['body'],{})[_0xbf28('0x36')](function(_0x6586e8){_0x345eef=_0x6586e8;return db['CmContact'][_0xbf28('0x86')]({'where':{'id':_0x345eef[_0xbf28('0x70')]}});})[_0xbf28('0x36')](function(_0x2615be){if(_['isNil'](_0x2615be)){return;}else{_0x345eef['fax']=_0x2615be[_0xbf28('0x5d')];return db[_0xbf28('0x87')]['findOne']({'where':{'id':_0x345eef[_0xbf28('0x88')]}});}})[_0xbf28('0x36')](function(_0x10596e){return respondWithRpcPromise(_0xbf28('0x89'),_0xbf28('0x89'),{'FaxAccountId':_['isNil'](_0x3fd437[_0xbf28('0x59')])?undefined:_0x3fd437['body'][_0xbf28('0x8a')],'path':_[_0xbf28('0x64')](_0x10596e)?undefined:util['format'](_0xbf28('0x8b'),_0x10596e['basename']),'fax':_[_0xbf28('0x64')](_0x345eef['fax'])?undefined:_0x345eef[_0xbf28('0x5d')],'AttachmentId':_0x345eef['AttachmentId']},client9002);})[_0xbf28('0x36')](respondWithResult(_0x1a69bd,0xc9))[_0xbf28('0x2a')](handleError(_0x1a69bd,null));};exports[_0xbf28('0x8c')]=function(_0x567101,_0x186c69){var _0x10d11e=path[_0xbf28('0x8d')](config[_0xbf28('0x8e')],'server','files',_0xbf28('0x8f'));return db['FaxMessage'][_0xbf28('0x58')]({'where':{'id':_0x567101[_0xbf28('0x57')]['id']},'include':[{'model':db[_0xbf28('0x87')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x186c69,null))[_0xbf28('0x36')](function(_0x1852fa){if(_0x1852fa){return _0x186c69['download'](path[_0xbf28('0x8d')](_0x10d11e,_0x1852fa['Attachment'][_0xbf28('0x90')]));}})[_0xbf28('0x2a')](handleError(_0x186c69,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 551eab2..422c0c8 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 _0x1bb4=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x3ae783,_0x4be867){var _0x16c053=function(_0x5b229d){while(--_0x5b229d){_0x3ae783['push'](_0x3ae783['shift']());}};_0x16c053(++_0x4be867);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x338870,_0x23be64){_0x338870=_0x338870-0x0;var _0x7e35c1=_0x1bb4[_0x338870];return _0x7e35c1;};'use strict';var EventEmitter=require(_0x41bb('0x0'));var FaxMessage=require(_0x41bb('0x1'))['db'][_0x41bb('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x41bb('0x3')](0x0);var events={'afterCreate':_0x41bb('0x4'),'afterUpdate':'update','afterDestroy':_0x41bb('0x5')};function emitEvent(_0x5da3f3){return function(_0x4add6,_0x5a5b83,_0xf2cea6){FaxMessageEvents['emit'](_0x5da3f3+':'+_0x4add6['id'],_0x4add6);FaxMessageEvents[_0x41bb('0x6')](_0x5da3f3,_0x4add6);_0xf2cea6(null);};}for(var e in events){if(events[_0x41bb('0x7')](e)){var event=events[e];FaxMessage[_0x41bb('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x3641=['../../mysqldb','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4d5b5e,_0x279432){var _0x244882=function(_0x4cb892){while(--_0x4cb892){_0x4d5b5e['push'](_0x4d5b5e['shift']());}};_0x244882(++_0x279432);}(_0x3641,0x173));var _0x1364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3641[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x1364('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1364('0x1'),'afterUpdate':_0x1364('0x2'),'afterDestroy':'remove'};function emitEvent(_0x435684){return function(_0x4a9034,_0x3d14e0,_0x4e41b7){FaxMessageEvents[_0x1364('0x3')](_0x435684+':'+_0x4a9034['id'],_0x4a9034);FaxMessageEvents['emit'](_0x435684,_0x4a9034);_0x4e41b7(null);};}for(var e in events){if(events[_0x1364('0x4')](e)){var event=events[e];FaxMessage[_0x1364('0x5')](e,emitEvent(event));}}module[_0x1364('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 7ddeb61..5a96995 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 _0x18b1=['utf8mb4','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error'];(function(_0x5f44c3,_0x460f76){var _0x577bf7=function(_0x370579){while(--_0x370579){_0x5f44c3['push'](_0x5f44c3['shift']());}};_0x577bf7(++_0x460f76);}(_0x18b1,0x10f));var _0x118b=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0x18b1[_0x836465];return _0x2150ea;};'use strict';var _=require(_0x118b('0x0'));var util=require(_0x118b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x118b('0x2'));var BPromise=require(_0x118b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x118b('0x4'));var rimraf=require(_0x118b('0x5'));var config=require(_0x118b('0x6'));var attributes=require(_0x118b('0x7'));module['exports']=function(_0x57b649,_0x2e2a2c){return _0x57b649[_0x118b('0x8')](_0x118b('0x9'),attributes,{'tableName':_0x118b('0xa'),'paranoid':![],'indexes':[{'name':_0x118b('0xb'),'fields':[_0x118b('0xc')],'type':_0x118b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd5ddbf,_0x53dd1f,_0x4fc781){var _0x5cd85b=_0x57b649[_0x118b('0xe')];var _0x28fd5a=_0xd5ddbf[_0x118b('0xf')]({'plain':!![]});if(_0x28fd5a[_0x118b('0x10')][_0x118b('0x11')]()==='in'||_0x28fd5a[_0x118b('0x10')][_0x118b('0x11')]()===_0x118b('0x12')&&!_0x28fd5a[_0x118b('0x13')]&&!_[_0x118b('0x14')](_0x28fd5a[_0x118b('0x15')])){_0x5cd85b[_0x118b('0x16')][_0x118b('0x17')]({'where':{'id':_0x28fd5a[_0x118b('0x18')]}})[_0x118b('0x19')](function(_0x2007dd){if(_0x2007dd){_0x2007dd['update']({'lastMsgAt':_0x28fd5a[_0x118b('0x1a')],'lastMsgDirection':_0x28fd5a[_0x118b('0x10')]['toLowerCase']()});}})[_0x118b('0x1b')](function(_0x35fe62){console[_0x118b('0x1c')](_0x35fe62);});}_0x4fc781();}},'charset':_0x118b('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x48f9=['FULLTEXT','models','get','direction','toLowerCase','out','isNil','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x48f9,0x196));var _0x948f=function(_0x540615,_0x44757d){_0x540615=_0x540615-0x0;var _0x5818e3=_0x48f9[_0x540615];return _0x5818e3;};'use strict';var _=require(_0x948f('0x0'));var util=require(_0x948f('0x1'));var logger=require(_0x948f('0x2'))(_0x948f('0x3'));var moment=require('moment');var BPromise=require(_0x948f('0x4'));var rp=require(_0x948f('0x5'));var fs=require('fs');var path=require(_0x948f('0x6'));var rimraf=require(_0x948f('0x7'));var config=require('../../config/environment');var attributes=require(_0x948f('0x8'));module[_0x948f('0x9')]=function(_0x8f6457,_0x1cf7ea){return _0x8f6457[_0x948f('0xa')]('FaxMessage',attributes,{'tableName':_0x948f('0xb'),'paranoid':![],'indexes':[{'name':_0x948f('0xc'),'fields':[_0x948f('0xd')],'type':_0x948f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5fe412,_0x57be39,_0x6627bf){var _0x4d81f4=_0x8f6457[_0x948f('0xf')];var _0x5e907b=_0x5fe412[_0x948f('0x10')]({'plain':!![]});if(_0x5e907b[_0x948f('0x11')][_0x948f('0x12')]()==='in'||_0x5e907b[_0x948f('0x11')][_0x948f('0x12')]()===_0x948f('0x13')&&!_0x5e907b['secret']&&!_[_0x948f('0x14')](_0x5e907b['UserId'])){_0x4d81f4[_0x948f('0x15')][_0x948f('0x16')]({'where':{'id':_0x5e907b[_0x948f('0x17')]}})['then'](function(_0x42dfa3){if(_0x42dfa3){_0x42dfa3[_0x948f('0x18')]({'lastMsgAt':_0x5e907b[_0x948f('0x19')],'lastMsgDirection':_0x5e907b[_0x948f('0x11')][_0x948f('0x12')]()});}})[_0x948f('0x1a')](function(_0x29c253){console[_0x948f('0x1b')](_0x29c253);});}_0x6627bf();}},'charset':_0x948f('0x1c'),'collate':_0x948f('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 248ad79..48e24e4 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 _0x9957=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','body','options','raw','CreateFaxMessage','catch','UpdateFaxMessage','FaxMessage','where','attributes','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('FaxMessage,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['CreateFaxMessage']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['FaxMessage']['create'](_0x3ec178[_0x7995('0x1c')],{'raw':_0x3ec178[_0x7995('0x1d')]?_0x3ec178[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![]})[_0x7995('0x12')](function(_0x1c278a){logger['info'](_0x7995('0x1f'),_0x3ec178);logger[_0x7995('0x15')](_0x7995('0x1f'),_0x3ec178,JSON[_0x7995('0x17')](_0x1c278a));_0x4cbe10(_0x1c278a);})[_0x7995('0x20')](function(_0x13bc35){logger[_0x7995('0x18')](_0x7995('0x1f'),_0x13bc35['message'],_0x3ec178);_0x3a9b54(_0x3d463e[_0x7995('0x18')](0x1f4,_0x13bc35[_0x7995('0x19')]));});});};exports[_0x7995('0x21')]=function(_0x268ce7){var _0x3a3fcf=this;return new Promise(function(_0x2a307e,_0x56691a){return db[_0x7995('0x22')]['update'](_0x268ce7[_0x7995('0x1c')],{'raw':_0x268ce7[_0x7995('0x1d')]?_0x268ce7[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options'][_0x7995('0x23')]||null:null,'attributes':_0x268ce7['options']?_0x268ce7[_0x7995('0x1d')][_0x7995('0x24')]||null:null,'limit':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options']['limit']||null:null})['then'](function(_0x3573be){logger[_0x7995('0x1a')](_0x7995('0x21'),_0x268ce7);logger[_0x7995('0x15')](_0x7995('0x21'),_0x268ce7,JSON[_0x7995('0x17')](_0x3573be));_0x2a307e(_0x3573be);})['catch'](function(_0x481c74){logger[_0x7995('0x18')]('UpdateFaxMessage',_0x481c74[_0x7995('0x19')],_0x268ce7);_0x56691a(_0x3a3fcf[_0x7995('0x18')](0x1f4,_0x481c74[_0x7995('0x19')]));});});}; \ No newline at end of file +var _0xe5b3=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','then','info'];(function(_0x9ba343,_0x5ea719){var _0x40e5bb=function(_0x4808df){while(--_0x4808df){_0x9ba343['push'](_0x9ba343['shift']());}};_0x40e5bb(++_0x5ea719);}(_0xe5b3,0x133));var _0x3e5b=function(_0x343b78,_0x42394d){_0x343b78=_0x343b78-0x0;var _0x5869c5=_0xe5b3[_0x343b78];return _0x5869c5;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});config[_0x3e5b('0xc')]=_['defaults'](config[_0x3e5b('0xc')],{'host':_0x3e5b('0xd'),'port':0x18eb});var socket=require(_0x3e5b('0xe'))(new Redis(config[_0x3e5b('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1fef54,_0x3d3b6e,_0x22fc1a){return new BPromise(function(_0x17dee7,_0xeeaabc){return client['request'](_0x1fef54,_0x22fc1a)[_0x3e5b('0xf')](function(_0x52efbd){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,_0x3e5b('0x12'));logger[_0x3e5b('0x13')](_0x3e5b('0x14'),_0x3d3b6e,_0x3e5b('0x12'),JSON[_0x3e5b('0x15')](_0x52efbd));if(_0x52efbd['error']){if(_0x52efbd[_0x3e5b('0x16')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd[_0x3e5b('0x16')][_0x3e5b('0x17')]);return _0xeeaabc(_0x52efbd[_0x3e5b('0x16')]['message']);}logger[_0x3e5b('0x16')]('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd['error'][_0x3e5b('0x17')]);return _0x17dee7(_0x52efbd[_0x3e5b('0x16')]['message']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,'request\x20sent');_0x17dee7(_0x52efbd[_0x3e5b('0x18')][_0x3e5b('0x17')]);}})['catch'](function(_0x4b189d){logger[_0x3e5b('0x16')](_0x3e5b('0x11'),_0x3d3b6e,_0x4b189d);_0xeeaabc(_0x4b189d);});});}exports[_0x3e5b('0x19')]=function(_0xff4aba){var _0x24de5b=this;return new Promise(function(_0x1564b5,_0x447d36){return db[_0x3e5b('0x1a')][_0x3e5b('0x1b')](_0xff4aba[_0x3e5b('0x1c')],{'raw':_0xff4aba[_0x3e5b('0x1d')]?_0xff4aba[_0x3e5b('0x1d')][_0x3e5b('0x1e')]===undefined?!![]:![]:!![]})[_0x3e5b('0xf')](function(_0x5b46d4){logger[_0x3e5b('0x10')](_0x3e5b('0x19'),_0xff4aba);logger[_0x3e5b('0x13')](_0x3e5b('0x19'),_0xff4aba,JSON['stringify'](_0x5b46d4));_0x1564b5(_0x5b46d4);})[_0x3e5b('0x1f')](function(_0x5b33bb){logger[_0x3e5b('0x16')](_0x3e5b('0x19'),_0x5b33bb['message'],_0xff4aba);_0x447d36(_0x24de5b[_0x3e5b('0x16')](0x1f4,_0x5b33bb[_0x3e5b('0x17')]));});});};exports[_0x3e5b('0x20')]=function(_0x3c8965){var _0x3bb749=this;return new Promise(function(_0x26c7f2,_0x160e87){return db[_0x3e5b('0x1a')]['update'](_0x3c8965[_0x3e5b('0x1c')],{'raw':_0x3c8965['options']?_0x3c8965[_0x3e5b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x21')]||null:null,'attributes':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x22')]||null:null,'limit':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x23')]||null:null})[_0x3e5b('0xf')](function(_0x1e1565){logger['info'](_0x3e5b('0x20'),_0x3c8965);logger[_0x3e5b('0x13')](_0x3e5b('0x20'),_0x3c8965,JSON[_0x3e5b('0x15')](_0x1e1565));_0x26c7f2(_0x1e1565);})[_0x3e5b('0x1f')](function(_0x31e9f9){logger[_0x3e5b('0x16')]('UpdateFaxMessage',_0x31e9f9[_0x3e5b('0x17')],_0x3c8965);_0x160e87(_0x3bb749['error'](0x1f4,_0x31e9f9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 701ff72..22d68c1 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 _0x7727=['save','remove','update','register','faxMessage:'];(function(_0x4826f7,_0x14ab8b){var _0x88cdac=function(_0x41e1d3){while(--_0x41e1d3){_0x4826f7['push'](_0x4826f7['shift']());}};_0x88cdac(++_0x14ab8b);}(_0x7727,0x82));var _0x7772=function(_0x2b7c18,_0x1e914c){_0x2b7c18=_0x2b7c18-0x0;var _0x3ef88e=_0x7727[_0x2b7c18];return _0x3ef88e;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x7772('0x0'),_0x7772('0x1'),_0x7772('0x2')];function createListener(_0x3572e7,_0x527bc2){return function(_0x29a736){_0x527bc2['emit'](_0x3572e7,_0x29a736);};}function removeListener(_0x43d29b,_0x2bf4ae){return function(){FaxMessageEvents['removeListener'](_0x43d29b,_0x2bf4ae);};}exports[_0x7772('0x3')]=function(_0x761e2c){for(var _0x447d39=0x0,_0x40b4ec=events['length'];_0x447d39<_0x40b4ec;_0x447d39++){var _0x27ef2e=events[_0x447d39];var _0x3829c6=createListener(_0x7772('0x4')+_0x27ef2e,_0x761e2c);FaxMessageEvents['on'](_0x27ef2e,_0x3829c6);}}; \ No newline at end of file +var _0x7dcc=['./faxMessage.events','save','remove','update','removeListener','length','faxMessage:'];(function(_0x283b97,_0x2dd687){var _0xe5cbb9=function(_0xaf9f4a){while(--_0xaf9f4a){_0x283b97['push'](_0x283b97['shift']());}};_0xe5cbb9(++_0x2dd687);}(_0x7dcc,0xbd));var _0xc7dc=function(_0x304bd5,_0xea943d){_0x304bd5=_0x304bd5-0x0;var _0x2bcd87=_0x7dcc[_0x304bd5];return _0x2bcd87;};'use strict';var FaxMessageEvents=require(_0xc7dc('0x0'));var events=[_0xc7dc('0x1'),_0xc7dc('0x2'),_0xc7dc('0x3')];function createListener(_0x1bf633,_0x53b1b1){return function(_0x277483){_0x53b1b1['emit'](_0x1bf633,_0x277483);};}function removeListener(_0x58c9c1,_0x5aa471){return function(){FaxMessageEvents[_0xc7dc('0x4')](_0x58c9c1,_0x5aa471);};}exports['register']=function(_0x53ef19){for(var _0x4c4c9d=0x0,_0x1211af=events[_0xc7dc('0x5')];_0x4c4c9d<_0x1211af;_0x4c4c9d++){var _0x138ea7=events[_0x4c4c9d];var _0x421938=createListener(_0xc7dc('0x6')+_0x138ea7,_0x53ef19);FaxMessageEvents['on'](_0x138ea7,_0x421938);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 37c0084..cfdd05f 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 _0xb332=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','reject','delete','destroy'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb332,0xd9));var _0x2b33=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0xb332[_0x35b7d4];return _0x4e8cee;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./faxMessage.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x2b33('0x9')]);router['get'](_0x2b33('0xa'),auth[_0x2b33('0x7')](),controller[_0x2b33('0xb')]);router[_0x2b33('0x6')]('/:id/download',auth[_0x2b33('0x7')](),controller[_0x2b33('0xc')]);router[_0x2b33('0xd')]('/',auth[_0x2b33('0x7')](),interaction[_0x2b33('0xe')](_0x2b33('0xf'),_0x2b33('0x10')),controller[_0x2b33('0x11')]);router[_0x2b33('0x12')](_0x2b33('0xa'),auth[_0x2b33('0x7')](),controller['update']);router[_0x2b33('0x12')](_0x2b33('0x13'),auth[_0x2b33('0x7')](),controller['accept']);router[_0x2b33('0x12')]('/:id/reject',auth[_0x2b33('0x7')](),controller[_0x2b33('0x14')]);router[_0x2b33('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2b33('0x16')]);module[_0x2b33('0x17')]=router; \ No newline at end of file +var _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x54ed00,_0x253ac2){var _0x2f9a44=function(_0x38bfb4){while(--_0x38bfb4){_0x54ed00['push'](_0x54ed00['shift']());}};_0x2f9a44(++_0x253ac2);}(_0x593e,0xcb));var _0xe593=function(_0x3f03f0,_0x40ceaa){_0x3f03f0=_0x3f03f0-0x0;var _0x76066b=_0x593e[_0x3f03f0];return _0x76066b;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a1bf315..eb5dc59 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 _0xa8d9=['INTEGER','sequelize','exports','STRING','name','ENUM','rrmemory','roundrobin'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa8d9,0x1f1));var _0x9a8d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa8d9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9a8d('0x0'));module[_0x9a8d('0x1')]={'name':{'type':Sequelize[_0x9a8d('0x2')],'unique':_0x9a8d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9a8d('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9a8d('0x4')](_0x9a8d('0x5'),'beepall',_0x9a8d('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9a8d('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x121d=['sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x121d,0xf0));var _0xd121=function(_0x4a1b83,_0x489314){_0x4a1b83=_0x4a1b83-0x0;var _0x3233e4=_0x121d[_0x4a1b83];return _0x3233e4;};'use strict';var Sequelize=require(_0xd121('0x0'));module[_0xd121('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd121('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd121('0x3')]},'timeout':{'type':Sequelize[_0xd121('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd121('0x5')](_0xd121('0x6'),_0xd121('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd121('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index a35c823..c0ef663 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 _0x3233=['moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserFaxQueue','FaxQueueId','User','findAndCountAll','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','ids','Agents','online','voicePause','transaction','addTeams','each','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','toString','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2c50f2,_0x41150f){var _0x1fc1ba=function(_0x47806e){while(--_0x47806e){_0x2c50f2['push'](_0x2c50f2['shift']());}};_0x1fc1ba(++_0x41150f);}(_0x3233,0x115));var _0x3323=function(_0x182542,_0x5611bd){_0x182542=_0x182542-0x0;var _0x1b2ffd=_0x3233[_0x182542];return _0x1b2ffd;};'use strict';var emlformat=require(_0x3323('0x0'));var rimraf=require(_0x3323('0x1'));var zipdir=require(_0x3323('0x2'));var jsonpatch=require(_0x3323('0x3'));var rp=require(_0x3323('0x4'));var moment=require(_0x3323('0x5'));var BPromise=require(_0x3323('0x6'));var Mustache=require(_0x3323('0x7'));var util=require(_0x3323('0x8'));var path=require(_0x3323('0x9'));var sox=require('sox');var csv=require(_0x3323('0xa'));var ejs=require(_0x3323('0xb'));var fs=require('fs');var fs_extra=require(_0x3323('0xc'));var _=require(_0x3323('0xd'));var squel=require(_0x3323('0xe'));var crypto=require('crypto');var jsforce=require(_0x3323('0xf'));var deskjs=require(_0x3323('0x10'));var toCsv=require(_0x3323('0xa'));var querystring=require(_0x3323('0x11'));var Papa=require('papaparse');var Redis=require(_0x3323('0x12'));var authService=require(_0x3323('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3323('0x14'));var hardwareService=require(_0x3323('0x15'));var logger=require(_0x3323('0x16'))(_0x3323('0x17'));var utils=require(_0x3323('0x18'));var config=require(_0x3323('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3323('0x1a'))['db'];config[_0x3323('0x1b')]=_[_0x3323('0x1c')](config['redis'],{'host':_0x3323('0x1d'),'port':0x18eb});var socket=require(_0x3323('0x1e'))(new Redis(config[_0x3323('0x1b')]));require('./faxQueue.socket')[_0x3323('0x1f')](socket);function respondWithStatusCode(_0x37a826,_0x8b7e67){_0x8b7e67=_0x8b7e67||0xcc;return function(_0x4d16b0){if(_0x4d16b0){return _0x37a826[_0x3323('0x20')](_0x8b7e67);}return _0x37a826[_0x3323('0x21')](_0x8b7e67)[_0x3323('0x22')]();};}function respondWithResult(_0x20d98a,_0x36ad74){_0x36ad74=_0x36ad74||0xc8;return function(_0x372f09){if(_0x372f09){return _0x20d98a[_0x3323('0x21')](_0x36ad74)['json'](_0x372f09);}};}function respondWithFilteredResult(_0x4c5828,_0x48663a){return function(_0x4db9a6){if(_0x4db9a6){var _0x578a3a=typeof _0x48663a[_0x3323('0x23')]===_0x3323('0x24')&&typeof _0x48663a[_0x3323('0x25')]===_0x3323('0x24');var _0x919d1e=_0x4db9a6[_0x3323('0x26')];var _0x4b089d=_0x578a3a?0x0:_0x48663a[_0x3323('0x23')];var _0x2d9fad=_0x578a3a?_0x4db9a6[_0x3323('0x26')]:_0x48663a[_0x3323('0x23')]+_0x48663a[_0x3323('0x25')];var _0x2eb0f2;if(_0x2d9fad>=_0x919d1e){_0x2d9fad=_0x919d1e;_0x2eb0f2=0xc8;}else{_0x2eb0f2=0xce;}_0x4c5828[_0x3323('0x21')](_0x2eb0f2);return _0x4c5828['set'](_0x3323('0x27'),_0x4b089d+'-'+_0x2d9fad+'/'+_0x919d1e)[_0x3323('0x28')](_0x4db9a6);}return null;};}function patchUpdates(_0x5e1ecb){return function(_0x1cb642){try{jsonpatch[_0x3323('0x29')](_0x1cb642,_0x5e1ecb,!![]);}catch(_0x25a366){return BPromise[_0x3323('0x2a')](_0x25a366);}return _0x1cb642['save']();};}function saveUpdates(_0xa69f01,_0x1987e8){return function(_0x362a9d){if(_0x362a9d){return _0x362a9d[_0x3323('0x2b')](_0xa69f01)[_0x3323('0x2c')](function(_0x437181){return _0x437181;});}return null;};}function removeEntity(_0xe091c7,_0x39e7d5){return function(_0x4676c7){if(_0x4676c7){return _0x4676c7[_0x3323('0x2d')]()['then'](function(){var _0x318f45=_0x4676c7[_0x3323('0x2e')]({'plain':!![]});var _0x359812='FaxQueues';return db[_0x3323('0x2f')]['destroy']({'where':{'type':_0x359812,'resourceId':_0x318f45['id']}})[_0x3323('0x2c')](function(){return _0x4676c7;});})[_0x3323('0x2c')](function(){_0xe091c7[_0x3323('0x21')](0xcc)[_0x3323('0x22')]();});}};}function handleEntityNotFound(_0x10498f,_0x3839b3){return function(_0x4ef1a6){if(!_0x4ef1a6){_0x10498f[_0x3323('0x20')](0x194);}return _0x4ef1a6;};}function handleError(_0x3c773a,_0x33ec55){_0x33ec55=_0x33ec55||0x1f4;return function(_0x3daac2){logger[_0x3323('0x30')](_0x3daac2[_0x3323('0x31')]);if(_0x3daac2[_0x3323('0x32')]){delete _0x3daac2['name'];}_0x3c773a['status'](_0x33ec55)[_0x3323('0x33')](_0x3daac2);};}exports[_0x3323('0x34')]=function(_0xbd9b73,_0x3fe937){var _0x69dac4={},_0x9be2d0={},_0x58875a={'count':0x0,'rows':[]};var _0x39d185=_[_0x3323('0x35')](db[_0x3323('0x36')][_0x3323('0x37')],function(_0xdcca11){return{'name':_0xdcca11[_0x3323('0x38')],'type':_0xdcca11['type']['key']};});_0x9be2d0[_0x3323('0x39')]=_[_0x3323('0x35')](_0x39d185,_0x3323('0x32'));_0x9be2d0[_0x3323('0x3a')]=_[_0x3323('0x3b')](_0xbd9b73['query']);_0x9be2d0['filters']=_[_0x3323('0x3c')](_0x9be2d0[_0x3323('0x39')],_0x9be2d0[_0x3323('0x3a')]);_0x69dac4[_0x3323('0x3d')]=_[_0x3323('0x3c')](_0x9be2d0[_0x3323('0x39')],qs['fields'](_0xbd9b73[_0x3323('0x3a')][_0x3323('0x3e')]));_0x69dac4[_0x3323('0x3d')]=_0x69dac4['attributes']['length']?_0x69dac4[_0x3323('0x3d')]:_0x9be2d0[_0x3323('0x39')];if(!_0xbd9b73['query'][_0x3323('0x3f')](_0x3323('0x40'))){_0x69dac4[_0x3323('0x25')]=qs['limit'](_0xbd9b73[_0x3323('0x3a')]['limit']);_0x69dac4[_0x3323('0x23')]=qs[_0x3323('0x23')](_0xbd9b73[_0x3323('0x3a')][_0x3323('0x23')]);}_0x69dac4[_0x3323('0x41')]=qs[_0x3323('0x42')](_0xbd9b73['query'][_0x3323('0x42')]);_0x69dac4[_0x3323('0x43')]=qs[_0x3323('0x44')](_[_0x3323('0x45')](_0xbd9b73['query'],_0x9be2d0[_0x3323('0x44')]),_0x39d185);if(_0xbd9b73['query'][_0x3323('0x46')]){_0x69dac4['where']=_[_0x3323('0x47')](_0x69dac4[_0x3323('0x43')],{'$or':_['map'](_0x39d185,function(_0x4a327f){if(_0x4a327f['type']!=='VIRTUAL'){var _0x1862db={};_0x1862db[_0x4a327f[_0x3323('0x32')]]={'$like':'%'+_0xbd9b73[_0x3323('0x3a')][_0x3323('0x46')]+'%'};return _0x1862db;}})});}_0x69dac4=_['merge']({},_0x69dac4,_0xbd9b73[_0x3323('0x48')]);var _0x2d4f9c={'where':_0x69dac4[_0x3323('0x43')]};return db['FaxQueue']['count'](_0x2d4f9c)[_0x3323('0x2c')](function(_0x1f4d6b){_0x58875a[_0x3323('0x26')]=_0x1f4d6b;if(_0xbd9b73['query'][_0x3323('0x49')]){_0x69dac4[_0x3323('0x4a')]=[{'all':!![]}];}return db[_0x3323('0x36')][_0x3323('0x4b')](_0x69dac4);})['then'](function(_0x4696e1){_0x58875a[_0x3323('0x4c')]=_0x4696e1;return _0x58875a;})['then'](respondWithFilteredResult(_0x3fe937,_0x69dac4))[_0x3323('0x4d')](handleError(_0x3fe937,null));};exports[_0x3323('0x4e')]=function(_0x50e1cb,_0xa0e2d4){var _0x295b7f={'raw':!![],'where':{'id':_0x50e1cb[_0x3323('0x4f')]['id']}},_0x5902b8={};_0x5902b8[_0x3323('0x39')]=_['keys'](db['FaxQueue'][_0x3323('0x37')]);_0x5902b8[_0x3323('0x3a')]=_[_0x3323('0x3b')](_0x50e1cb[_0x3323('0x3a')]);_0x5902b8[_0x3323('0x44')]=_['intersection'](_0x5902b8[_0x3323('0x39')],_0x5902b8[_0x3323('0x3a')]);_0x295b7f[_0x3323('0x3d')]=_[_0x3323('0x3c')](_0x5902b8[_0x3323('0x39')],qs[_0x3323('0x3e')](_0x50e1cb[_0x3323('0x3a')][_0x3323('0x3e')]));_0x295b7f[_0x3323('0x3d')]=_0x295b7f[_0x3323('0x3d')][_0x3323('0x50')]?_0x295b7f['attributes']:_0x5902b8[_0x3323('0x39')];if(_0x50e1cb[_0x3323('0x3a')][_0x3323('0x49')]){_0x295b7f[_0x3323('0x4a')]=[{'all':!![]}];}_0x295b7f=_[_0x3323('0x47')]({},_0x295b7f,_0x50e1cb[_0x3323('0x48')]);return db[_0x3323('0x36')]['find'](_0x295b7f)[_0x3323('0x2c')](handleEntityNotFound(_0xa0e2d4,null))[_0x3323('0x2c')](respondWithResult(_0xa0e2d4,null))[_0x3323('0x4d')](handleError(_0xa0e2d4,null));};exports[_0x3323('0x51')]=function(_0x23f231,_0x44b724){return db['FaxQueue'][_0x3323('0x51')](_0x23f231['body'],{})['then'](function(_0x3a150e){var _0x59deaa=_0x23f231[_0x3323('0x52')]['get']({'plain':!![]});if(!_0x59deaa)throw new Error(_0x3323('0x53'));if(_0x59deaa[_0x3323('0x54')]==='user'){var _0x174080=_0x3a150e['get']({'plain':!![]});var _0x57c075=_0x3323('0x55');return db['UserProfileSection'][_0x3323('0x56')]({'where':{'name':_0x57c075,'userProfileId':_0x59deaa[_0x3323('0x57')]},'raw':!![]})[_0x3323('0x2c')](function(_0x16eb6d){if(_0x16eb6d&&_0x16eb6d[_0x3323('0x58')]===0x0){return db['UserProfileResource'][_0x3323('0x51')]({'name':_0x174080[_0x3323('0x32')],'resourceId':_0x174080['id'],'type':_0x16eb6d[_0x3323('0x32')],'sectionId':_0x16eb6d['id']},{})[_0x3323('0x2c')](function(){return _0x3a150e;});}else{return _0x3a150e;}})['catch'](function(_0x5797c8){logger['error'](_0x3323('0x59'),_0x5797c8);throw _0x5797c8;});}return _0x3a150e;})[_0x3323('0x2c')](respondWithResult(_0x44b724,0xc9))[_0x3323('0x4d')](handleError(_0x44b724,null));};exports[_0x3323('0x2b')]=function(_0x3e1f6f,_0x3bbb46){if(_0x3e1f6f[_0x3323('0x5a')]['id']){delete _0x3e1f6f[_0x3323('0x5a')]['id'];}return db['FaxQueue'][_0x3323('0x56')]({'where':{'id':_0x3e1f6f[_0x3323('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3bbb46,null))[_0x3323('0x2c')](saveUpdates(_0x3e1f6f[_0x3323('0x5a')],null))['then'](respondWithResult(_0x3bbb46,null))[_0x3323('0x4d')](handleError(_0x3bbb46,null));};exports[_0x3323('0x2d')]=function(_0x105507,_0x2ba410){return db[_0x3323('0x36')][_0x3323('0x56')]({'where':{'id':_0x105507['params']['id']}})[_0x3323('0x2c')](handleEntityNotFound(_0x2ba410,null))[_0x3323('0x2c')](removeEntity(_0x2ba410,null))['catch'](handleError(_0x2ba410,null));};exports[_0x3323('0x5b')]=function(_0x3045ca,_0x5d5028){return db[_0x3323('0x36')][_0x3323('0x5b')]()[_0x3323('0x2c')](respondWithResult(_0x5d5028,null))['catch'](handleError(_0x5d5028,null));};exports[_0x3323('0x5c')]=function(_0x339b8a,_0x5e6b48,_0xb66c6a){var _0x17cd84={'raw':!![],'where':{}},_0x5330d3={},_0x17788f;return db[_0x3323('0x36')]['findOne']({'where':{'id':_0x339b8a[_0x3323('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5e6b48,null))['then'](function(_0x4a271c){if(_0x4a271c){_0x17788f=_0x4a271c[_0x3323('0x2e')]({'plain':!![]});_0x5330d3[_0x3323('0x39')]=_[_0x3323('0x3b')](db[_0x3323('0x5d')]['rawAttributes']);_0x5330d3[_0x3323('0x3a')]=_[_0x3323('0x3b')](_0x339b8a[_0x3323('0x3a')]);_0x5330d3[_0x3323('0x44')]=_[_0x3323('0x3c')](_0x5330d3[_0x3323('0x39')],_0x5330d3[_0x3323('0x3a')]);_0x17cd84['attributes']=_[_0x3323('0x3c')](_0x5330d3[_0x3323('0x39')],qs['fields'](_0x339b8a['query'][_0x3323('0x3e')]));_0x17cd84[_0x3323('0x3d')]=_0x17cd84['attributes']['length']?_0x17cd84[_0x3323('0x3d')]:_0x5330d3[_0x3323('0x39')];if(!_0x339b8a[_0x3323('0x3a')][_0x3323('0x3f')](_0x3323('0x40'))){_0x17cd84['limit']=qs[_0x3323('0x25')](_0x339b8a[_0x3323('0x3a')][_0x3323('0x25')]);_0x17cd84['offset']=qs[_0x3323('0x23')](_0x339b8a[_0x3323('0x3a')]['offset']);}_0x17cd84['order']=qs[_0x3323('0x42')](_0x339b8a[_0x3323('0x3a')][_0x3323('0x42')]);_0x17cd84[_0x3323('0x43')]=qs['filters'](_[_0x3323('0x45')](_0x339b8a[_0x3323('0x3a')],_0x5330d3[_0x3323('0x44')]));_0x17cd84[_0x3323('0x43')][_0x3323('0x5e')]=_0x4a271c['id'];if(_0x339b8a[_0x3323('0x3a')][_0x3323('0x46')]){_0x17cd84[_0x3323('0x43')]=_[_0x3323('0x47')](_0x17cd84['where'],{'$or':_[_0x3323('0x35')](_0x17cd84[_0x3323('0x3d')],function(_0x360f3a){var _0x2f4d74={};_0x2f4d74[_0x360f3a]={'$like':'%'+_0x339b8a[_0x3323('0x3a')][_0x3323('0x46')]+'%'};return _0x2f4d74;})});}_0x17cd84=_[_0x3323('0x47')]({},_0x17cd84,_0x339b8a[_0x3323('0x48')]);return db['UserFaxQueue'][_0x3323('0x4b')](_0x17cd84);}})[_0x3323('0x2c')](function(_0x2acf69){if(_0x2acf69){return db[_0x3323('0x5f')][_0x3323('0x60')]({'where':{'id':_[_0x3323('0x35')](_0x2acf69,'UserId'),'role':'agent'},'attributes':['id','name',_0x3323('0x61'),_0x3323('0x62'),_0x3323('0x63')]});}})['then'](function(_0x4cce6c){if(_0x4cce6c){return{'count':_0x4cce6c[_0x3323('0x26')],'rows':_[_0x3323('0x35')](_0x4cce6c['rows'],function(_0x205eda){return{'membername':_0x205eda[_0x3323('0x32')],'UserId':_0x205eda['id'],'queue_name':_0x17788f['name'],'FaxQueueId':_0x17788f['id'],'interface':util[_0x3323('0x64')]('%s/%s',_0x3323('0x65'),_0x205eda[_0x3323('0x32')]),'penalty':0x0,'paused':_0x205eda[_0x3323('0x61')],'createdAt':_0x205eda[_0x3323('0x63')],'updatedAt':_0x205eda['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3323('0x2c')](respondWithFilteredResult(_0x5e6b48,_0x17cd84))['catch'](handleError(_0x5e6b48,null));};exports[_0x3323('0x66')]=function(_0xe3c797,_0x1af74c,_0x4279ab){var _0x5732ee={};var _0x1667de={};var _0x23caa0;var _0xfcad0a;return db[_0x3323('0x36')]['findOne']({'where':{'id':_0xe3c797[_0x3323('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1af74c,null))[_0x3323('0x2c')](function(_0x60a209){if(_0x60a209){_0x23caa0=_0x60a209;_0x1667de[_0x3323('0x39')]=_['keys'](db[_0x3323('0x67')][_0x3323('0x37')]);_0x1667de[_0x3323('0x3a')]=_[_0x3323('0x3b')](_0xe3c797[_0x3323('0x3a')]);_0x1667de[_0x3323('0x44')]=_[_0x3323('0x3c')](_0x1667de[_0x3323('0x39')],_0x1667de['query']);_0x5732ee[_0x3323('0x3d')]=_[_0x3323('0x3c')](_0x1667de[_0x3323('0x39')],qs[_0x3323('0x3e')](_0xe3c797[_0x3323('0x3a')][_0x3323('0x3e')]));_0x5732ee[_0x3323('0x3d')]=_0x5732ee[_0x3323('0x3d')]['length']?_0x5732ee[_0x3323('0x3d')]:_0x1667de[_0x3323('0x39')];_0x5732ee[_0x3323('0x41')]=qs[_0x3323('0x42')](_0xe3c797[_0x3323('0x3a')]['sort']);_0x5732ee[_0x3323('0x43')]=qs[_0x3323('0x44')](_[_0x3323('0x45')](_0xe3c797[_0x3323('0x3a')],_0x1667de[_0x3323('0x44')]));if(_0xe3c797['query']['filter']){_0x5732ee[_0x3323('0x43')]=_[_0x3323('0x47')](_0x5732ee[_0x3323('0x43')],{'$or':_[_0x3323('0x35')](_0x5732ee['attributes'],function(_0x265b1d){var _0x225b5a={};_0x225b5a[_0x265b1d]={'$like':'%'+_0xe3c797['query'][_0x3323('0x46')]+'%'};return _0x225b5a;})});}_0x5732ee=_[_0x3323('0x47')]({},_0x5732ee,_0xe3c797[_0x3323('0x48')]);return _0x23caa0[_0x3323('0x66')](_0x5732ee);}})[_0x3323('0x2c')](function(_0xe6e619){if(_0xe6e619){_0xfcad0a=_0xe6e619[_0x3323('0x50')];if(!_0xe3c797['query'][_0x3323('0x3f')](_0x3323('0x40'))){_0x5732ee['limit']=qs[_0x3323('0x25')](_0xe3c797[_0x3323('0x3a')][_0x3323('0x25')]);_0x5732ee[_0x3323('0x23')]=qs['offset'](_0xe3c797['query'][_0x3323('0x23')]);}return _0x23caa0[_0x3323('0x66')](_0x5732ee);}})[_0x3323('0x2c')](function(_0x49c09d){if(_0x49c09d){return _0x49c09d?{'count':_0xfcad0a,'rows':_0x49c09d}:null;}})[_0x3323('0x2c')](respondWithResult(_0x1af74c,null))['catch'](handleError(_0x1af74c,null));};exports['addTeams']=function(_0x179d2a,_0x50755a,_0x2ce289){var _0x4688f1=_0x179d2a[_0x3323('0x5a')][_0x3323('0x68')];return db[_0x3323('0x67')][_0x3323('0x4b')]({'where':{'id':_0x4688f1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3323('0x69'),'attributes':['id',_0x3323('0x32'),_0x3323('0x6a'),_0x3323('0x6b'),'interface'],'raw':!![]}]})[_0x3323('0x2c')](function(_0x253b38){if(_0x253b38){var _0x21e21f=_['flatMap'](_0x253b38,function(_0x9590f3){var _0x5ccaf4=_0x9590f3[_0x3323('0x2e')]({'plain':!![]});return _0x5ccaf4[_0x3323('0x69')];});return db[_0x3323('0x36')]['find']({'where':{'id':_0x179d2a[_0x3323('0x4f')]['id']}})[_0x3323('0x2c')](function(_0x5d9d34){return db['sequelize'][_0x3323('0x6c')](function(_0x14626c){return _0x5d9d34[_0x3323('0x6d')](_0x4688f1,{'transaction':_0x14626c})[_0x3323('0x2c')](function(){return BPromise[_0x3323('0x6e')](_0x21e21f,function(_0x42574e){return db[_0x3323('0x5d')]['findOrCreate']({'where':{'UserId':_0x42574e['id'],'FaxQueueId':_0x179d2a[_0x3323('0x4f')]['id']},'transaction':_0x14626c});});})['then'](function(){_0x21e21f['forEach'](function(_0x1112ab){socket[_0x3323('0x6f')](_0x3323('0x70'),{'UserId':_0x1112ab['id'],'FaxQueueId':_0x5d9d34['id']});});});});});}})[_0x3323('0x2c')](respondWithStatusCode(_0x50755a,null))[_0x3323('0x4d')](handleError(_0x50755a,null));};exports[_0x3323('0x71')]=function(_0x9716e8,_0xcfb7bc,_0x309851){return db[_0x3323('0x67')][_0x3323('0x4b')]({'where':{'id':_0x9716e8[_0x3323('0x3a')][_0x3323('0x68')]},'attributes':['id'],'include':[{'model':db[_0x3323('0x5f')],'as':_0x3323('0x69'),'attributes':['id'],'raw':!![]}]})[_0x3323('0x2c')](handleEntityNotFound(_0xcfb7bc,null))[_0x3323('0x2c')](function(_0x1c4191){var _0x43d039=_['map'](_0x1c4191,'id');var _0x13b7fe=[];var _0xe178e1=[];var _0x3e3549=squel[_0x3323('0x72')]();_0x3e3549[_0x3323('0x73')](_0x3323('0x74'))[_0x3323('0x75')]('team_has_fax_queues','tq')[_0x3323('0x76')](_0x3323('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3323('0x43')](_0x3323('0x78'),_0x9716e8[_0x3323('0x4f')]['id']);for(var _0x5c1e77=0x0;_0x5c1e77<_0x1c4191['length'];_0x5c1e77+=0x1){let _0x21fa12=_0x1c4191[_0x5c1e77];for(var _0x110e42=0x0;_0x110e42<_0x21fa12[_0x3323('0x69')][_0x3323('0x50')];_0x110e42+=0x1){let _0x195125=_0x21fa12[_0x3323('0x69')][_0x110e42];var _0x5bd785=_0x3e3549[_0x3323('0x79')]();_0x5bd785[_0x3323('0x43')]('ut.UserId\x20=\x20?',_0x195125['id']);_0xe178e1[_0x3323('0x7a')](db['sequelize'][_0x3323('0x3a')](_0x5bd785[_0x3323('0x7b')](),{'type':db[_0x3323('0x7c')][_0x3323('0x7d')][_0x3323('0x7e')]})[_0x3323('0x2c')](function(_0xd6e20){if(_0xd6e20['length']===0x1){return _0x195125['id'];}else{var _0x26616b=_['every'](_[_0x3323('0x35')](_0xd6e20,_0x3323('0x7f')),function(_0x40e151){return _[_0x3323('0x80')](_0x43d039,_0x40e151);});if(_0x26616b){return _0x195125['id'];}}}));}}return BPromise[_0x3323('0x81')](_0xe178e1)[_0x3323('0x2c')](function(_0x4ed0f5){_0x13b7fe=_(_0x13b7fe)[_0x3323('0x82')](_0x4ed0f5)[_0x3323('0x83')]()['value']();return db[_0x3323('0x36')][_0x3323('0x56')]({'where':{'id':_0x9716e8[_0x3323('0x4f')]['id']}})[_0x3323('0x2c')](function(_0x510d94){return db[_0x3323('0x7c')][_0x3323('0x6c')](function(_0x2832db){return _0x510d94[_0x3323('0x71')](_0x9716e8['query'][_0x3323('0x68')],{'transaction':_0x2832db})['then'](function(){if(!_[_0x3323('0x84')](_0x13b7fe)){return _0x510d94[_0x3323('0x85')](_0x13b7fe,{'transaction':_0x2832db});}})['then'](function(){_0x13b7fe[_0x3323('0x86')](function(_0x11e308){socket[_0x3323('0x6f')](_0x3323('0x87'),{'UserId':_0x11e308,'FaxQueueId':_0x510d94['id']});});});});});});})['then'](respondWithStatusCode(_0xcfb7bc,null))[_0x3323('0x4d')](handleError(_0xcfb7bc,null));};exports[_0x3323('0x88')]=function(_0x56eebb,_0x3e8641,_0x2641f2){return db[_0x3323('0x36')][_0x3323('0x56')]({'where':{'id':_0x56eebb[_0x3323('0x4f')]['id']}})[_0x3323('0x2c')](handleEntityNotFound(_0x3e8641,null))[_0x3323('0x2c')](function(_0x5056ef){if(_0x5056ef){return _0x5056ef[_0x3323('0x88')](_0x56eebb[_0x3323('0x5a')][_0x3323('0x68')],_[_0x3323('0x89')](_0x56eebb[_0x3323('0x5a')],[_0x3323('0x68'),'id'])||{})[_0x3323('0x8a')](function(_0x487e2f){for(var _0x12cc18=0x0;_0x12cc18<_0x56eebb[_0x3323('0x5a')]['ids'][_0x3323('0x50')];_0x12cc18+=0x1){socket[_0x3323('0x6f')]('userFaxQueue:save',{'UserId':Number(_0x56eebb['body'][_0x3323('0x68')][_0x12cc18]),'FaxQueueId':Number(_0x56eebb[_0x3323('0x4f')]['id'])});}return _0x487e2f;});}})['then'](respondWithResult(_0x3e8641,null))['catch'](handleError(_0x3e8641,null));};exports[_0x3323('0x85')]=function(_0x36bcac,_0x2bd79b,_0x512d94){return db[_0x3323('0x36')][_0x3323('0x56')]({'where':{'id':_0x36bcac[_0x3323('0x4f')]['id']}})[_0x3323('0x2c')](handleEntityNotFound(_0x2bd79b,null))[_0x3323('0x2c')](function(_0x5f1c49){if(_0x5f1c49){return _0x5f1c49[_0x3323('0x85')](_0x36bcac[_0x3323('0x3a')][_0x3323('0x68')])[_0x3323('0x2c')](function(){if(_[_0x3323('0x8b')](_0x36bcac[_0x3323('0x3a')]['ids'])){for(var _0x27e45a=0x0;_0x27e45a<_0x36bcac[_0x3323('0x3a')]['ids'][_0x3323('0x50')];_0x27e45a+=0x1){socket[_0x3323('0x6f')](_0x3323('0x87'),{'UserId':Number(_0x36bcac[_0x3323('0x3a')][_0x3323('0x68')][_0x27e45a]),'FaxQueueId':Number(_0x36bcac[_0x3323('0x4f')]['id'])});}}else{socket[_0x3323('0x6f')](_0x3323('0x87'),{'UserId':Number(_0x36bcac['query'][_0x3323('0x68')]),'FaxQueueId':Number(_0x36bcac[_0x3323('0x4f')]['id'])});}});}})[_0x3323('0x2c')](respondWithStatusCode(_0x2bd79b,null))['catch'](handleError(_0x2bd79b,null));};exports[_0x3323('0x8c')]=function(_0x31a2d2,_0x52b0f0,_0x1df9ea){var _0x2c335c={};var _0x17da15={};var _0x5cf135;var _0x25ae57;return db[_0x3323('0x36')]['findOne']({'where':{'id':_0x31a2d2[_0x3323('0x4f')]['id']}})[_0x3323('0x2c')](handleEntityNotFound(_0x52b0f0,null))['then'](function(_0x124c4a){if(_0x124c4a){_0x5cf135=_0x124c4a;_0x17da15[_0x3323('0x39')]=_[_0x3323('0x3b')](db[_0x3323('0x5f')][_0x3323('0x37')]);_0x17da15['query']=_[_0x3323('0x3b')](_0x31a2d2[_0x3323('0x3a')]);_0x17da15[_0x3323('0x44')]=_[_0x3323('0x3c')](_0x17da15[_0x3323('0x39')],_0x17da15[_0x3323('0x3a')]);_0x2c335c[_0x3323('0x3d')]=_[_0x3323('0x3c')](_0x17da15[_0x3323('0x39')],qs[_0x3323('0x3e')](_0x31a2d2[_0x3323('0x3a')][_0x3323('0x3e')]));_0x2c335c[_0x3323('0x3d')]=_0x2c335c['attributes'][_0x3323('0x50')]?_0x2c335c[_0x3323('0x3d')]:_0x17da15[_0x3323('0x39')];_0x2c335c['order']=qs[_0x3323('0x42')](_0x31a2d2['query'][_0x3323('0x42')]);_0x2c335c['where']=qs[_0x3323('0x44')](_[_0x3323('0x45')](_0x31a2d2['query'],_0x17da15[_0x3323('0x44')]));if(_0x31a2d2[_0x3323('0x3a')][_0x3323('0x46')]){_0x2c335c['where']=_[_0x3323('0x47')](_0x2c335c[_0x3323('0x43')],{'$or':_[_0x3323('0x35')](_0x2c335c[_0x3323('0x3d')],function(_0xeb8f22){var _0x1ee4ca={};_0x1ee4ca[_0xeb8f22]={'$like':'%'+_0x31a2d2[_0x3323('0x3a')][_0x3323('0x46')]+'%'};return _0x1ee4ca;})});}_0x2c335c=_[_0x3323('0x47')]({},_0x2c335c,_0x31a2d2['options']);return _0x5cf135[_0x3323('0x8c')](_0x2c335c);}})[_0x3323('0x2c')](function(_0x1d7402){if(_0x1d7402){_0x25ae57=_0x1d7402[_0x3323('0x50')];if(!_0x31a2d2[_0x3323('0x3a')][_0x3323('0x3f')](_0x3323('0x40'))){_0x2c335c[_0x3323('0x25')]=qs[_0x3323('0x25')](_0x31a2d2[_0x3323('0x3a')][_0x3323('0x25')]);_0x2c335c[_0x3323('0x23')]=qs['offset'](_0x31a2d2[_0x3323('0x3a')][_0x3323('0x23')]);}return _0x5cf135[_0x3323('0x8c')](_0x2c335c);}})[_0x3323('0x2c')](function(_0x37a278){if(_0x37a278){return _0x37a278?{'count':_0x25ae57,'rows':_0x37a278}:null;}})[_0x3323('0x2c')](respondWithResult(_0x52b0f0,null))[_0x3323('0x4d')](handleError(_0x52b0f0,null));}; \ No newline at end of file +var _0x938d=['clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','userFaxQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','FaxQueue','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserFaxQueue','nolimit','order','FaxQueueId','options','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','userFaxQueue:save','select','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0xb9622e,_0x91225d){var _0x12969e=function(_0x5e8b52){while(--_0x5e8b52){_0xb9622e['push'](_0xb9622e['shift']());}};_0x12969e(++_0x91225d);}(_0x938d,0x1b6));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd938('0x0'));var rimraf=require(_0xd938('0x1'));var zipdir=require(_0xd938('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd938('0x3'));var moment=require(_0xd938('0x4'));var BPromise=require(_0xd938('0x5'));var Mustache=require(_0xd938('0x6'));var util=require(_0xd938('0x7'));var path=require('path');var sox=require(_0xd938('0x8'));var csv=require(_0xd938('0x9'));var ejs=require(_0xd938('0xa'));var fs=require('fs');var fs_extra=require(_0xd938('0xb'));var _=require('lodash');var squel=require(_0xd938('0xc'));var crypto=require(_0xd938('0xd'));var jsforce=require(_0xd938('0xe'));var deskjs=require(_0xd938('0xf'));var toCsv=require(_0xd938('0x9'));var querystring=require('querystring');var Papa=require(_0xd938('0x10'));var Redis=require(_0xd938('0x11'));var authService=require(_0xd938('0x12'));var qs=require(_0xd938('0x13'));var as=require(_0xd938('0x14'));var hardwareService=require(_0xd938('0x15'));var logger=require(_0xd938('0x16'))(_0xd938('0x17'));var utils=require(_0xd938('0x18'));var config=require(_0xd938('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd938('0x1a'))['db'];config[_0xd938('0x1b')]=_['defaults'](config['redis'],{'host':_0xd938('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd938('0x1b')]));require('./faxQueue.socket')[_0xd938('0x1d')](socket);function respondWithStatusCode(_0x13e5e6,_0x45bdd1){_0x45bdd1=_0x45bdd1||0xcc;return function(_0x3ad9e3){if(_0x3ad9e3){return _0x13e5e6[_0xd938('0x1e')](_0x45bdd1);}return _0x13e5e6[_0xd938('0x1f')](_0x45bdd1)[_0xd938('0x20')]();};}function respondWithResult(_0x2a0a54,_0x58af04){_0x58af04=_0x58af04||0xc8;return function(_0x5be4ea){if(_0x5be4ea){return _0x2a0a54[_0xd938('0x1f')](_0x58af04)[_0xd938('0x21')](_0x5be4ea);}};}function respondWithFilteredResult(_0xc78e39,_0x40e3de){return function(_0xd7e41f){if(_0xd7e41f){var _0x3a4abd=typeof _0x40e3de[_0xd938('0x22')]===_0xd938('0x23')&&typeof _0x40e3de[_0xd938('0x24')]===_0xd938('0x23');var _0xeeb1ba=_0xd7e41f[_0xd938('0x25')];var _0x4f1b05=_0x3a4abd?0x0:_0x40e3de['offset'];var _0x37e0de=_0x3a4abd?_0xd7e41f[_0xd938('0x25')]:_0x40e3de[_0xd938('0x22')]+_0x40e3de[_0xd938('0x24')];var _0x220add;if(_0x37e0de>=_0xeeb1ba){_0x37e0de=_0xeeb1ba;_0x220add=0xc8;}else{_0x220add=0xce;}_0xc78e39[_0xd938('0x1f')](_0x220add);return _0xc78e39['set'](_0xd938('0x26'),_0x4f1b05+'-'+_0x37e0de+'/'+_0xeeb1ba)[_0xd938('0x21')](_0xd7e41f);}return null;};}function patchUpdates(_0x2c8183){return function(_0x14e270){try{jsonpatch[_0xd938('0x27')](_0x14e270,_0x2c8183,!![]);}catch(_0x620ad0){return BPromise[_0xd938('0x28')](_0x620ad0);}return _0x14e270[_0xd938('0x29')]();};}function saveUpdates(_0x9d4c44,_0x3a31bf){return function(_0x39684c){if(_0x39684c){return _0x39684c['update'](_0x9d4c44)[_0xd938('0x2a')](function(_0x4a320){return _0x4a320;});}return null;};}function removeEntity(_0x39a74e,_0x505a9c){return function(_0x2d6859){if(_0x2d6859){return _0x2d6859[_0xd938('0x2b')]()['then'](function(){var _0xc280f3=_0x2d6859[_0xd938('0x2c')]({'plain':!![]});var _0x146147='FaxQueues';return db[_0xd938('0x2d')][_0xd938('0x2b')]({'where':{'type':_0x146147,'resourceId':_0xc280f3['id']}})[_0xd938('0x2a')](function(){return _0x2d6859;});})[_0xd938('0x2a')](function(){_0x39a74e['status'](0xcc)[_0xd938('0x20')]();});}};}function handleEntityNotFound(_0x4fac3a,_0x9ce759){return function(_0x3ff34a){if(!_0x3ff34a){_0x4fac3a[_0xd938('0x1e')](0x194);}return _0x3ff34a;};}function handleError(_0x36e0a3,_0x2650d4){_0x2650d4=_0x2650d4||0x1f4;return function(_0x3cfd58){logger['error'](_0x3cfd58[_0xd938('0x2e')]);if(_0x3cfd58[_0xd938('0x2f')]){delete _0x3cfd58[_0xd938('0x2f')];}_0x36e0a3['status'](_0x2650d4)[_0xd938('0x30')](_0x3cfd58);};}exports[_0xd938('0x31')]=function(_0x2129a0,_0x56fc7a){var _0x5e9ed4={},_0x5a3c62={},_0xe6bfa2={'count':0x0,'rows':[]};var _0x189a17=_[_0xd938('0x32')](db['FaxQueue'][_0xd938('0x33')],function(_0x5edbac){return{'name':_0x5edbac['fieldName'],'type':_0x5edbac['type'][_0xd938('0x34')]};});_0x5a3c62[_0xd938('0x35')]=_['map'](_0x189a17,_0xd938('0x2f'));_0x5a3c62[_0xd938('0x36')]=_[_0xd938('0x37')](_0x2129a0[_0xd938('0x36')]);_0x5a3c62[_0xd938('0x38')]=_[_0xd938('0x39')](_0x5a3c62[_0xd938('0x35')],_0x5a3c62['query']);_0x5e9ed4['attributes']=_[_0xd938('0x39')](_0x5a3c62[_0xd938('0x35')],qs[_0xd938('0x3a')](_0x2129a0[_0xd938('0x36')]['fields']));_0x5e9ed4[_0xd938('0x3b')]=_0x5e9ed4[_0xd938('0x3b')][_0xd938('0x3c')]?_0x5e9ed4['attributes']:_0x5a3c62[_0xd938('0x35')];if(!_0x2129a0[_0xd938('0x36')][_0xd938('0x3d')]('nolimit')){_0x5e9ed4[_0xd938('0x24')]=qs[_0xd938('0x24')](_0x2129a0['query'][_0xd938('0x24')]);_0x5e9ed4['offset']=qs[_0xd938('0x22')](_0x2129a0['query'][_0xd938('0x22')]);}_0x5e9ed4['order']=qs[_0xd938('0x3e')](_0x2129a0['query'][_0xd938('0x3e')]);_0x5e9ed4[_0xd938('0x3f')]=qs[_0xd938('0x38')](_[_0xd938('0x40')](_0x2129a0['query'],_0x5a3c62[_0xd938('0x38')]),_0x189a17);if(_0x2129a0[_0xd938('0x36')][_0xd938('0x41')]){_0x5e9ed4[_0xd938('0x3f')]=_['merge'](_0x5e9ed4[_0xd938('0x3f')],{'$or':_[_0xd938('0x32')](_0x189a17,function(_0xfb7168){if(_0xfb7168[_0xd938('0x42')]!==_0xd938('0x43')){var _0x244d74={};_0x244d74[_0xfb7168['name']]={'$like':'%'+_0x2129a0[_0xd938('0x36')][_0xd938('0x41')]+'%'};return _0x244d74;}})});}_0x5e9ed4=_[_0xd938('0x44')]({},_0x5e9ed4,_0x2129a0['options']);var _0x431a95={'where':_0x5e9ed4[_0xd938('0x3f')]};return db[_0xd938('0x45')][_0xd938('0x25')](_0x431a95)[_0xd938('0x2a')](function(_0x256764){_0xe6bfa2[_0xd938('0x25')]=_0x256764;if(_0x2129a0[_0xd938('0x36')][_0xd938('0x46')]){_0x5e9ed4[_0xd938('0x47')]=[{'all':!![]}];}return db[_0xd938('0x45')][_0xd938('0x48')](_0x5e9ed4);})[_0xd938('0x2a')](function(_0x27e188){_0xe6bfa2['rows']=_0x27e188;return _0xe6bfa2;})[_0xd938('0x2a')](respondWithFilteredResult(_0x56fc7a,_0x5e9ed4))[_0xd938('0x49')](handleError(_0x56fc7a,null));};exports[_0xd938('0x4a')]=function(_0x17d5f3,_0x4cce90){var _0x141e08={'raw':!![],'where':{'id':_0x17d5f3[_0xd938('0x4b')]['id']}},_0x2c4dd4={};_0x2c4dd4['model']=_[_0xd938('0x37')](db[_0xd938('0x45')][_0xd938('0x33')]);_0x2c4dd4['query']=_[_0xd938('0x37')](_0x17d5f3[_0xd938('0x36')]);_0x2c4dd4[_0xd938('0x38')]=_[_0xd938('0x39')](_0x2c4dd4[_0xd938('0x35')],_0x2c4dd4[_0xd938('0x36')]);_0x141e08[_0xd938('0x3b')]=_[_0xd938('0x39')](_0x2c4dd4[_0xd938('0x35')],qs[_0xd938('0x3a')](_0x17d5f3[_0xd938('0x36')][_0xd938('0x3a')]));_0x141e08['attributes']=_0x141e08[_0xd938('0x3b')]['length']?_0x141e08[_0xd938('0x3b')]:_0x2c4dd4[_0xd938('0x35')];if(_0x17d5f3[_0xd938('0x36')][_0xd938('0x46')]){_0x141e08[_0xd938('0x47')]=[{'all':!![]}];}_0x141e08=_[_0xd938('0x44')]({},_0x141e08,_0x17d5f3['options']);return db[_0xd938('0x45')]['find'](_0x141e08)['then'](handleEntityNotFound(_0x4cce90,null))['then'](respondWithResult(_0x4cce90,null))['catch'](handleError(_0x4cce90,null));};exports[_0xd938('0x4c')]=function(_0x3c0e53,_0x13500f){return db['FaxQueue'][_0xd938('0x4c')](_0x3c0e53[_0xd938('0x4d')],{})[_0xd938('0x2a')](function(_0x32a054){var _0x4b1a81=_0x3c0e53[_0xd938('0x4e')]['get']({'plain':!![]});if(!_0x4b1a81)throw new Error(_0xd938('0x4f'));if(_0x4b1a81['role']==='user'){var _0x2b44c1=_0x32a054[_0xd938('0x2c')]({'plain':!![]});var _0x25ed72=_0xd938('0x50');return db['UserProfileSection'][_0xd938('0x51')]({'where':{'name':_0x25ed72,'userProfileId':_0x4b1a81[_0xd938('0x52')]},'raw':!![]})[_0xd938('0x2a')](function(_0x1f5c34){if(_0x1f5c34&&_0x1f5c34[_0xd938('0x53')]===0x0){return db['UserProfileResource'][_0xd938('0x4c')]({'name':_0x2b44c1[_0xd938('0x2f')],'resourceId':_0x2b44c1['id'],'type':_0x1f5c34[_0xd938('0x2f')],'sectionId':_0x1f5c34['id']},{})[_0xd938('0x2a')](function(){return _0x32a054;});}else{return _0x32a054;}})[_0xd938('0x49')](function(_0x22584c){logger[_0xd938('0x54')](_0xd938('0x55'),_0x22584c);throw _0x22584c;});}return _0x32a054;})[_0xd938('0x2a')](respondWithResult(_0x13500f,0xc9))['catch'](handleError(_0x13500f,null));};exports[_0xd938('0x56')]=function(_0x5e7762,_0x50d36c){if(_0x5e7762[_0xd938('0x4d')]['id']){delete _0x5e7762[_0xd938('0x4d')]['id'];}return db['FaxQueue'][_0xd938('0x51')]({'where':{'id':_0x5e7762[_0xd938('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50d36c,null))['then'](saveUpdates(_0x5e7762[_0xd938('0x4d')],null))[_0xd938('0x2a')](respondWithResult(_0x50d36c,null))[_0xd938('0x49')](handleError(_0x50d36c,null));};exports[_0xd938('0x2b')]=function(_0x1a3558,_0x59cd53){return db[_0xd938('0x45')][_0xd938('0x51')]({'where':{'id':_0x1a3558[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x59cd53,null))[_0xd938('0x2a')](removeEntity(_0x59cd53,null))[_0xd938('0x49')](handleError(_0x59cd53,null));};exports[_0xd938('0x57')]=function(_0x1185c0,_0x2fb08a){return db['FaxQueue'][_0xd938('0x57')]()[_0xd938('0x2a')](respondWithResult(_0x2fb08a,null))[_0xd938('0x49')](handleError(_0x2fb08a,null));};exports['getMembers']=function(_0xee17ef,_0x3a5bdb,_0x1ecceb){var _0x1630f6={'raw':!![],'where':{}},_0x330c5d={},_0xcca3e8;return db['FaxQueue'][_0xd938('0x58')]({'where':{'id':_0xee17ef['params']['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x3a5bdb,null))[_0xd938('0x2a')](function(_0x5b901e){if(_0x5b901e){_0xcca3e8=_0x5b901e['get']({'plain':!![]});_0x330c5d[_0xd938('0x35')]=_[_0xd938('0x37')](db[_0xd938('0x59')][_0xd938('0x33')]);_0x330c5d['query']=_[_0xd938('0x37')](_0xee17ef['query']);_0x330c5d[_0xd938('0x38')]=_[_0xd938('0x39')](_0x330c5d[_0xd938('0x35')],_0x330c5d[_0xd938('0x36')]);_0x1630f6[_0xd938('0x3b')]=_[_0xd938('0x39')](_0x330c5d[_0xd938('0x35')],qs[_0xd938('0x3a')](_0xee17ef[_0xd938('0x36')]['fields']));_0x1630f6[_0xd938('0x3b')]=_0x1630f6[_0xd938('0x3b')][_0xd938('0x3c')]?_0x1630f6['attributes']:_0x330c5d[_0xd938('0x35')];if(!_0xee17ef[_0xd938('0x36')][_0xd938('0x3d')](_0xd938('0x5a'))){_0x1630f6['limit']=qs[_0xd938('0x24')](_0xee17ef[_0xd938('0x36')][_0xd938('0x24')]);_0x1630f6['offset']=qs[_0xd938('0x22')](_0xee17ef['query'][_0xd938('0x22')]);}_0x1630f6[_0xd938('0x5b')]=qs['sort'](_0xee17ef[_0xd938('0x36')][_0xd938('0x3e')]);_0x1630f6['where']=qs[_0xd938('0x38')](_[_0xd938('0x40')](_0xee17ef['query'],_0x330c5d['filters']));_0x1630f6[_0xd938('0x3f')][_0xd938('0x5c')]=_0x5b901e['id'];if(_0xee17ef[_0xd938('0x36')][_0xd938('0x41')]){_0x1630f6[_0xd938('0x3f')]=_[_0xd938('0x44')](_0x1630f6[_0xd938('0x3f')],{'$or':_[_0xd938('0x32')](_0x1630f6['attributes'],function(_0x41666a){var _0x3f19dd={};_0x3f19dd[_0x41666a]={'$like':'%'+_0xee17ef['query'][_0xd938('0x41')]+'%'};return _0x3f19dd;})});}_0x1630f6=_[_0xd938('0x44')]({},_0x1630f6,_0xee17ef[_0xd938('0x5d')]);return db[_0xd938('0x59')]['findAll'](_0x1630f6);}})[_0xd938('0x2a')](function(_0x37dfa8){if(_0x37dfa8){return db[_0xd938('0x5e')][_0xd938('0x5f')]({'where':{'id':_[_0xd938('0x32')](_0x37dfa8,_0xd938('0x60')),'role':_0xd938('0x61')},'attributes':['id','name',_0xd938('0x62'),_0xd938('0x63'),_0xd938('0x64')]});}})[_0xd938('0x2a')](function(_0x495fff){if(_0x495fff){return{'count':_0x495fff['count'],'rows':_[_0xd938('0x32')](_0x495fff[_0xd938('0x65')],function(_0x2be6c1){return{'membername':_0x2be6c1[_0xd938('0x2f')],'UserId':_0x2be6c1['id'],'queue_name':_0xcca3e8[_0xd938('0x2f')],'FaxQueueId':_0xcca3e8['id'],'interface':util['format']('%s/%s',_0xd938('0x66'),_0x2be6c1[_0xd938('0x2f')]),'penalty':0x0,'paused':_0x2be6c1['faxPause'],'createdAt':_0x2be6c1[_0xd938('0x64')],'updatedAt':_0x2be6c1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd938('0x2a')](respondWithFilteredResult(_0x3a5bdb,_0x1630f6))[_0xd938('0x49')](handleError(_0x3a5bdb,null));};exports[_0xd938('0x67')]=function(_0x2e7610,_0x2ef701,_0xe14594){var _0x43cf7b={};var _0x1178be={};var _0x432a51;var _0x2ea1ed;return db['FaxQueue'][_0xd938('0x58')]({'where':{'id':_0x2e7610[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x2ef701,null))[_0xd938('0x2a')](function(_0x2f6884){if(_0x2f6884){_0x432a51=_0x2f6884;_0x1178be['model']=_[_0xd938('0x37')](db[_0xd938('0x68')][_0xd938('0x33')]);_0x1178be['query']=_[_0xd938('0x37')](_0x2e7610[_0xd938('0x36')]);_0x1178be[_0xd938('0x38')]=_['intersection'](_0x1178be['model'],_0x1178be[_0xd938('0x36')]);_0x43cf7b[_0xd938('0x3b')]=_[_0xd938('0x39')](_0x1178be['model'],qs[_0xd938('0x3a')](_0x2e7610[_0xd938('0x36')][_0xd938('0x3a')]));_0x43cf7b['attributes']=_0x43cf7b[_0xd938('0x3b')][_0xd938('0x3c')]?_0x43cf7b[_0xd938('0x3b')]:_0x1178be['model'];_0x43cf7b[_0xd938('0x5b')]=qs[_0xd938('0x3e')](_0x2e7610[_0xd938('0x36')][_0xd938('0x3e')]);_0x43cf7b[_0xd938('0x3f')]=qs[_0xd938('0x38')](_[_0xd938('0x40')](_0x2e7610[_0xd938('0x36')],_0x1178be['filters']));if(_0x2e7610[_0xd938('0x36')]['filter']){_0x43cf7b[_0xd938('0x3f')]=_[_0xd938('0x44')](_0x43cf7b[_0xd938('0x3f')],{'$or':_[_0xd938('0x32')](_0x43cf7b['attributes'],function(_0x23beb6){var _0x660071={};_0x660071[_0x23beb6]={'$like':'%'+_0x2e7610[_0xd938('0x36')]['filter']+'%'};return _0x660071;})});}_0x43cf7b=_[_0xd938('0x44')]({},_0x43cf7b,_0x2e7610['options']);return _0x432a51[_0xd938('0x67')](_0x43cf7b);}})[_0xd938('0x2a')](function(_0x3f01f2){if(_0x3f01f2){_0x2ea1ed=_0x3f01f2[_0xd938('0x3c')];if(!_0x2e7610['query']['hasOwnProperty'](_0xd938('0x5a'))){_0x43cf7b[_0xd938('0x24')]=qs['limit'](_0x2e7610[_0xd938('0x36')][_0xd938('0x24')]);_0x43cf7b[_0xd938('0x22')]=qs[_0xd938('0x22')](_0x2e7610['query']['offset']);}return _0x432a51[_0xd938('0x67')](_0x43cf7b);}})[_0xd938('0x2a')](function(_0x13afa4){if(_0x13afa4){return _0x13afa4?{'count':_0x2ea1ed,'rows':_0x13afa4}:null;}})[_0xd938('0x2a')](respondWithResult(_0x2ef701,null))[_0xd938('0x49')](handleError(_0x2ef701,null));};exports[_0xd938('0x69')]=function(_0x20c661,_0x55699c,_0x1fd7a8){var _0x1db95b=_0x20c661[_0xd938('0x4d')][_0xd938('0x6a')];return db['Team'][_0xd938('0x48')]({'where':{'id':_0x1db95b},'attributes':['id'],'include':[{'model':db[_0xd938('0x5e')],'as':_0xd938('0x6b'),'attributes':['id',_0xd938('0x2f'),_0xd938('0x6c'),_0xd938('0x6d'),_0xd938('0x6e')],'raw':!![]}]})[_0xd938('0x2a')](function(_0x5b68f6){if(_0x5b68f6){var _0x267c97=_[_0xd938('0x6f')](_0x5b68f6,function(_0x26196b){var _0x41113e=_0x26196b['get']({'plain':!![]});return _0x41113e[_0xd938('0x6b')];});return db[_0xd938('0x45')][_0xd938('0x51')]({'where':{'id':_0x20c661[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](function(_0x3404ee){return db[_0xd938('0x70')][_0xd938('0x71')](function(_0x40527d){return _0x3404ee['addTeams'](_0x1db95b,{'transaction':_0x40527d})['then'](function(){return BPromise['each'](_0x267c97,function(_0x388482){return db[_0xd938('0x59')][_0xd938('0x72')]({'where':{'UserId':_0x388482['id'],'FaxQueueId':_0x20c661['params']['id']},'transaction':_0x40527d});});})[_0xd938('0x2a')](function(){_0x267c97['forEach'](function(_0x55521d){socket[_0xd938('0x73')](_0xd938('0x74'),{'UserId':_0x55521d['id'],'FaxQueueId':_0x3404ee['id']});});});});});}})[_0xd938('0x2a')](respondWithStatusCode(_0x55699c,null))[_0xd938('0x49')](handleError(_0x55699c,null));};exports['removeTeams']=function(_0x369ea6,_0x38c7da,_0x352ccd){return db[_0xd938('0x68')][_0xd938('0x48')]({'where':{'id':_0x369ea6[_0xd938('0x36')][_0xd938('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd938('0x5e')],'as':_0xd938('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xd938('0x2a')](handleEntityNotFound(_0x38c7da,null))[_0xd938('0x2a')](function(_0x254277){var _0x24387c=_['map'](_0x254277,'id');var _0x3ce9c4=[];var _0x4b581e=[];var _0x127017=squel[_0xd938('0x75')]();_0x127017['field']('tq.TeamId')['from'](_0xd938('0x76'),'tq')[_0xd938('0x77')](_0xd938('0x78'),'ut',_0xd938('0x79'))[_0xd938('0x3f')]('FaxQueueId\x20=\x20?',_0x369ea6[_0xd938('0x4b')]['id']);for(var _0x340857=0x0;_0x340857<_0x254277[_0xd938('0x3c')];_0x340857+=0x1){let _0x308311=_0x254277[_0x340857];for(var _0xc93aaa=0x0;_0xc93aaa<_0x308311[_0xd938('0x6b')][_0xd938('0x3c')];_0xc93aaa+=0x1){let _0x606a45=_0x308311[_0xd938('0x6b')][_0xc93aaa];var _0x1af622=_0x127017[_0xd938('0x7a')]();_0x1af622[_0xd938('0x3f')](_0xd938('0x7b'),_0x606a45['id']);_0x4b581e[_0xd938('0x7c')](db[_0xd938('0x70')]['query'](_0x1af622['toString'](),{'type':db[_0xd938('0x70')]['QueryTypes'][_0xd938('0x7d')]})['then'](function(_0x120f33){if(_0x120f33[_0xd938('0x3c')]===0x1){return _0x606a45['id'];}else{var _0x36bd4a=_[_0xd938('0x7e')](_[_0xd938('0x32')](_0x120f33,_0xd938('0x7f')),function(_0x2bd505){return _['includes'](_0x24387c,_0x2bd505);});if(_0x36bd4a){return _0x606a45['id'];}}}));}}return BPromise[_0xd938('0x80')](_0x4b581e)['then'](function(_0x43053e){_0x3ce9c4=_(_0x3ce9c4)['union'](_0x43053e)[_0xd938('0x81')]()[_0xd938('0x82')]();return db[_0xd938('0x45')][_0xd938('0x51')]({'where':{'id':_0x369ea6['params']['id']}})['then'](function(_0x39a4c1){return db[_0xd938('0x70')][_0xd938('0x71')](function(_0x39de9b){return _0x39a4c1[_0xd938('0x83')](_0x369ea6['query'][_0xd938('0x6a')],{'transaction':_0x39de9b})[_0xd938('0x2a')](function(){if(!_[_0xd938('0x84')](_0x3ce9c4)){return _0x39a4c1[_0xd938('0x85')](_0x3ce9c4,{'transaction':_0x39de9b});}})[_0xd938('0x2a')](function(){_0x3ce9c4[_0xd938('0x86')](function(_0x1f9414){socket['emit'](_0xd938('0x87'),{'UserId':_0x1f9414,'FaxQueueId':_0x39a4c1['id']});});});});});});})['then'](respondWithStatusCode(_0x38c7da,null))[_0xd938('0x49')](handleError(_0x38c7da,null));};exports['addAgents']=function(_0x4927cd,_0x396708,_0x5d9274){return db[_0xd938('0x45')]['find']({'where':{'id':_0x4927cd[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x396708,null))['then'](function(_0x3c1512){if(_0x3c1512){return _0x3c1512['addAgents'](_0x4927cd[_0xd938('0x4d')][_0xd938('0x6a')],_[_0xd938('0x88')](_0x4927cd['body'],['ids','id'])||{})[_0xd938('0x89')](function(_0x1237cc){for(var _0x20fb9e=0x0;_0x20fb9e<_0x4927cd[_0xd938('0x4d')]['ids'][_0xd938('0x3c')];_0x20fb9e+=0x1){socket[_0xd938('0x73')]('userFaxQueue:save',{'UserId':Number(_0x4927cd[_0xd938('0x4d')][_0xd938('0x6a')][_0x20fb9e]),'FaxQueueId':Number(_0x4927cd['params']['id'])});}return _0x1237cc;});}})[_0xd938('0x2a')](respondWithResult(_0x396708,null))[_0xd938('0x49')](handleError(_0x396708,null));};exports['removeAgents']=function(_0x39cd3a,_0x3f44c7,_0x16f926){return db[_0xd938('0x45')][_0xd938('0x51')]({'where':{'id':_0x39cd3a[_0xd938('0x4b')]['id']}})[_0xd938('0x2a')](handleEntityNotFound(_0x3f44c7,null))[_0xd938('0x2a')](function(_0x32300a){if(_0x32300a){return _0x32300a[_0xd938('0x85')](_0x39cd3a[_0xd938('0x36')][_0xd938('0x6a')])[_0xd938('0x2a')](function(){if(_[_0xd938('0x8a')](_0x39cd3a[_0xd938('0x36')][_0xd938('0x6a')])){for(var _0x529fd=0x0;_0x529fd<_0x39cd3a[_0xd938('0x36')][_0xd938('0x6a')]['length'];_0x529fd+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x39cd3a[_0xd938('0x36')][_0xd938('0x6a')][_0x529fd]),'FaxQueueId':Number(_0x39cd3a['params']['id'])});}}else{socket[_0xd938('0x73')](_0xd938('0x87'),{'UserId':Number(_0x39cd3a['query'][_0xd938('0x6a')]),'FaxQueueId':Number(_0x39cd3a['params']['id'])});}});}})[_0xd938('0x2a')](respondWithStatusCode(_0x3f44c7,null))['catch'](handleError(_0x3f44c7,null));};exports[_0xd938('0x8b')]=function(_0x142a46,_0x36a33b,_0x5970fe){var _0x34d308={};var _0x34cf8b={};var _0x44ea38;var _0x13cbf9;return db[_0xd938('0x45')][_0xd938('0x58')]({'where':{'id':_0x142a46[_0xd938('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36a33b,null))[_0xd938('0x2a')](function(_0x87e6dc){if(_0x87e6dc){_0x44ea38=_0x87e6dc;_0x34cf8b[_0xd938('0x35')]=_[_0xd938('0x37')](db[_0xd938('0x5e')]['rawAttributes']);_0x34cf8b[_0xd938('0x36')]=_[_0xd938('0x37')](_0x142a46[_0xd938('0x36')]);_0x34cf8b[_0xd938('0x38')]=_['intersection'](_0x34cf8b[_0xd938('0x35')],_0x34cf8b[_0xd938('0x36')]);_0x34d308[_0xd938('0x3b')]=_[_0xd938('0x39')](_0x34cf8b[_0xd938('0x35')],qs[_0xd938('0x3a')](_0x142a46[_0xd938('0x36')][_0xd938('0x3a')]));_0x34d308[_0xd938('0x3b')]=_0x34d308[_0xd938('0x3b')][_0xd938('0x3c')]?_0x34d308[_0xd938('0x3b')]:_0x34cf8b[_0xd938('0x35')];_0x34d308['order']=qs[_0xd938('0x3e')](_0x142a46[_0xd938('0x36')][_0xd938('0x3e')]);_0x34d308[_0xd938('0x3f')]=qs['filters'](_[_0xd938('0x40')](_0x142a46[_0xd938('0x36')],_0x34cf8b[_0xd938('0x38')]));if(_0x142a46[_0xd938('0x36')][_0xd938('0x41')]){_0x34d308[_0xd938('0x3f')]=_['merge'](_0x34d308[_0xd938('0x3f')],{'$or':_[_0xd938('0x32')](_0x34d308[_0xd938('0x3b')],function(_0x3a4ddd){var _0x49dc4c={};_0x49dc4c[_0x3a4ddd]={'$like':'%'+_0x142a46[_0xd938('0x36')]['filter']+'%'};return _0x49dc4c;})});}_0x34d308=_[_0xd938('0x44')]({},_0x34d308,_0x142a46[_0xd938('0x5d')]);return _0x44ea38['getAgents'](_0x34d308);}})[_0xd938('0x2a')](function(_0x3b9902){if(_0x3b9902){_0x13cbf9=_0x3b9902[_0xd938('0x3c')];if(!_0x142a46['query'][_0xd938('0x3d')](_0xd938('0x5a'))){_0x34d308[_0xd938('0x24')]=qs[_0xd938('0x24')](_0x142a46[_0xd938('0x36')][_0xd938('0x24')]);_0x34d308[_0xd938('0x22')]=qs['offset'](_0x142a46['query'][_0xd938('0x22')]);}return _0x44ea38[_0xd938('0x8b')](_0x34d308);}})['then'](function(_0x1956aa){if(_0x1956aa){return _0x1956aa?{'count':_0x13cbf9,'rows':_0x1956aa}:null;}})[_0xd938('0x2a')](respondWithResult(_0x36a33b,null))[_0xd938('0x49')](handleError(_0x36a33b,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5bf6bb6..21f4ba8 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 _0xbeed=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update','remove'];(function(_0x30ea96,_0x196bc0){var _0x31b85d=function(_0x12a7a7){while(--_0x12a7a7){_0x30ea96['push'](_0x30ea96['shift']());}};_0x31b85d(++_0x196bc0);}(_0xbeed,0x193));var _0xdbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeed[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xdbee('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xdbee('0x1')](0x0);var events={'afterCreate':_0xdbee('0x2'),'afterUpdate':_0xdbee('0x3'),'afterDestroy':_0xdbee('0x4')};function emitEvent(_0x5b1b3f){return function(_0x2ef222,_0x302cf7,_0x5407aa){FaxQueueEvents[_0xdbee('0x5')](_0x5b1b3f+':'+_0x2ef222['id'],_0x2ef222);FaxQueueEvents['emit'](_0x5b1b3f,_0x2ef222);_0x5407aa(null);};}for(var e in events){if(events[_0xdbee('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xdbee('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x8c80=['remove','emit','hasOwnProperty','hook','events','FaxQueue','setMaxListeners','save'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x8c80,0x1ac));var _0x08c8=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x8c80[_0x101e7b];return _0x4995c0;};'use strict';var EventEmitter=require(_0x08c8('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x08c8('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x08c8('0x2')](0x0);var events={'afterCreate':_0x08c8('0x3'),'afterUpdate':'update','afterDestroy':_0x08c8('0x4')};function emitEvent(_0x4adcc5){return function(_0x4adda6,_0x2cbc15,_0x350a7a){FaxQueueEvents['emit'](_0x4adcc5+':'+_0x4adda6['id'],_0x4adda6);FaxQueueEvents[_0x08c8('0x5')](_0x4adcc5,_0x4adda6);_0x350a7a(null);};}for(var e in events){if(events[_0x08c8('0x6')](e)){var event=events[e];FaxQueue[_0x08c8('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 2e659d1..6e9eb24 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 _0x2bf9=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x2bf9,0x1dc));var _0x92bf=function(_0x712d97,_0x53bb9b){_0x712d97=_0x712d97-0x0;var _0x2025e6=_0x2bf9[_0x712d97];return _0x2025e6;};'use strict';var _=require(_0x92bf('0x0'));var util=require(_0x92bf('0x1'));var logger=require(_0x92bf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x92bf('0x3'));var rp=require(_0x92bf('0x4'));var fs=require('fs');var path=require(_0x92bf('0x5'));var rimraf=require(_0x92bf('0x6'));var config=require(_0x92bf('0x7'));var attributes=require(_0x92bf('0x8'));module[_0x92bf('0x9')]=function(_0x296cbf,_0x151d6f){return _0x296cbf[_0x92bf('0xa')](_0x92bf('0xb'),attributes,{'tableName':_0x92bf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56c7=['./faxQueue.attributes','exports','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x2038ea,_0x649417){var _0x285a07=function(_0x4a5766){while(--_0x4a5766){_0x2038ea['push'](_0x2038ea['shift']());}};_0x285a07(++_0x649417);}(_0x56c7,0xbf));var _0x756c=function(_0x22d7e6,_0xa620e7){_0x22d7e6=_0x22d7e6-0x0;var _0x72bc58=_0x56c7[_0x22d7e6];return _0x72bc58;};'use strict';var _=require(_0x756c('0x0'));var util=require(_0x756c('0x1'));var logger=require(_0x756c('0x2'))('api');var moment=require(_0x756c('0x3'));var BPromise=require(_0x756c('0x4'));var rp=require(_0x756c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x756c('0x6'));var attributes=require(_0x756c('0x7'));module[_0x756c('0x8')]=function(_0x2318de,_0x32c71e){return _0x2318de['define']('FaxQueue',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 218288f..5d8c7e5 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 _0xcb1c=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','options','attributes','limit','include','map','model','then','find','raw','where','ShowFaxQueue','lodash','moment','bluebird'];(function(_0x2e44af,_0x9204f6){var _0x55ea47=function(_0x195647){while(--_0x195647){_0x2e44af['push'](_0x2e44af['shift']());}};_0x55ea47(++_0x9204f6);}(_0xcb1c,0x135));var _0xccb1=function(_0x2d6ea0,_0x8f7d73){_0x2d6ea0=_0x2d6ea0-0x0;var _0x12db0c=_0xcb1c[_0x2d6ea0];return _0x12db0c;};'use strict';var _=require(_0xccb1('0x0'));var util=require('util');var moment=require(_0xccb1('0x1'));var BPromise=require(_0xccb1('0x2'));var rs=require(_0xccb1('0x3'));var fs=require('fs');var Redis=require(_0xccb1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xccb1('0x5'))(_0xccb1('0x6'));var config=require('../../config/environment');var jayson=require(_0xccb1('0x7'));var client=jayson[_0xccb1('0x8')][_0xccb1('0x9')]({'port':0x232a});config[_0xccb1('0xa')]=_[_0xccb1('0xb')](config[_0xccb1('0xa')],{'host':_0xccb1('0xc'),'port':0x18eb});var socket=require(_0xccb1('0xd'))(new Redis(config[_0xccb1('0xa')]));require('./faxQueue.socket')[_0xccb1('0xe')](socket);function respondWithRpcPromise(_0x2286e8,_0x1ef772,_0x24a4d3){return new BPromise(function(_0x3878fa,_0x4ed83b){return client[_0xccb1('0xf')](_0x2286e8,_0x24a4d3)['then'](function(_0xc94650){logger[_0xccb1('0x10')](_0xccb1('0x11'),_0x1ef772,'request\x20sent');logger[_0xccb1('0x12')](_0xccb1('0x13'),_0x1ef772,_0xccb1('0x14'),JSON[_0xccb1('0x15')](_0xc94650));if(_0xc94650[_0xccb1('0x16')]){if(_0xc94650[_0xccb1('0x16')]['code']===0x1f4){logger[_0xccb1('0x16')](_0xccb1('0x11'),_0x1ef772,_0xc94650[_0xccb1('0x16')][_0xccb1('0x17')]);return _0x4ed83b(_0xc94650[_0xccb1('0x16')][_0xccb1('0x17')]);}logger[_0xccb1('0x16')](_0xccb1('0x11'),_0x1ef772,_0xc94650[_0xccb1('0x16')][_0xccb1('0x17')]);return _0x3878fa(_0xc94650[_0xccb1('0x16')][_0xccb1('0x17')]);}else{logger[_0xccb1('0x10')](_0xccb1('0x11'),_0x1ef772,_0xccb1('0x14'));_0x3878fa(_0xc94650[_0xccb1('0x18')][_0xccb1('0x17')]);}})[_0xccb1('0x19')](function(_0x187f67){logger[_0xccb1('0x16')](_0xccb1('0x11'),_0x1ef772,_0x187f67);_0x4ed83b(_0x187f67);});});}exports[_0xccb1('0x1a')]=function(_0x325e02){var _0x13e82e=this;return new Promise(function(_0xa51128,_0x47914b){return db[_0xccb1('0x1b')]['findAll']({'raw':_0x325e02['options']?_0x325e02[_0xccb1('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x325e02[_0xccb1('0x1c')]?_0x325e02[_0xccb1('0x1c')]['where']||null:null,'attributes':_0x325e02[_0xccb1('0x1c')]?_0x325e02[_0xccb1('0x1c')][_0xccb1('0x1d')]||null:null,'limit':_0x325e02[_0xccb1('0x1c')]?_0x325e02[_0xccb1('0x1c')][_0xccb1('0x1e')]||null:null,'include':_0x325e02[_0xccb1('0x1c')]?_0x325e02[_0xccb1('0x1c')][_0xccb1('0x1f')]?_[_0xccb1('0x20')](_0x325e02[_0xccb1('0x1c')]['include'],function(_0x4a9ac2){return{'model':db[_0x4a9ac2[_0xccb1('0x21')]],'as':_0x4a9ac2['as'],'attributes':_0x4a9ac2['attributes'],'include':_0x4a9ac2['include']?_[_0xccb1('0x20')](_0x4a9ac2['include'],function(_0x5c6a4f){return{'model':db[_0x5c6a4f[_0xccb1('0x21')]],'as':_0x5c6a4f['as'],'attributes':_0x5c6a4f[_0xccb1('0x1d')],'include':_0x5c6a4f[_0xccb1('0x1f')]?_[_0xccb1('0x20')](_0x5c6a4f[_0xccb1('0x1f')],function(_0x1345bc){return{'model':db[_0x1345bc[_0xccb1('0x21')]],'as':_0x1345bc['as'],'attributes':_0x1345bc['attributes']};}):[]};}):[]};}):[]:[]})[_0xccb1('0x22')](function(_0x192f71){logger[_0xccb1('0x10')](_0xccb1('0x1a'),_0x325e02);logger[_0xccb1('0x12')](_0xccb1('0x1a'),_0x325e02,JSON[_0xccb1('0x15')](_0x192f71));_0xa51128(_0x192f71);})[_0xccb1('0x19')](function(_0xcccd12){logger[_0xccb1('0x16')](_0xccb1('0x1a'),_0xcccd12[_0xccb1('0x17')],_0x325e02);_0x47914b(_0x13e82e[_0xccb1('0x16')](0x1f4,_0xcccd12[_0xccb1('0x17')]));});});};exports['ShowFaxQueue']=function(_0x2fe7ac){var _0x67cdfa=this;return new Promise(function(_0x3083f2,_0x7ef893){return db[_0xccb1('0x1b')][_0xccb1('0x23')]({'raw':_0x2fe7ac[_0xccb1('0x1c')]?_0x2fe7ac[_0xccb1('0x1c')][_0xccb1('0x24')]===undefined?!![]:![]:!![],'where':_0x2fe7ac['options']?_0x2fe7ac[_0xccb1('0x1c')][_0xccb1('0x25')]||null:null,'attributes':_0x2fe7ac[_0xccb1('0x1c')]?_0x2fe7ac[_0xccb1('0x1c')][_0xccb1('0x1d')]||null:null,'include':_0x2fe7ac['options']?_0x2fe7ac[_0xccb1('0x1c')][_0xccb1('0x1f')]?_[_0xccb1('0x20')](_0x2fe7ac['options'][_0xccb1('0x1f')],function(_0x1ed5c3){return{'model':db[_0x1ed5c3[_0xccb1('0x21')]],'as':_0x1ed5c3['as'],'attributes':_0x1ed5c3['attributes'],'include':_0x1ed5c3[_0xccb1('0x1f')]?_[_0xccb1('0x20')](_0x1ed5c3['include'],function(_0x5914f6){return{'model':db[_0x5914f6[_0xccb1('0x21')]],'as':_0x5914f6['as'],'attributes':_0x5914f6[_0xccb1('0x1d')],'include':_0x5914f6[_0xccb1('0x1f')]?_['map'](_0x5914f6[_0xccb1('0x1f')],function(_0x17d163){return{'model':db[_0x17d163['model']],'as':_0x17d163['as'],'attributes':_0x17d163[_0xccb1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45c270){logger[_0xccb1('0x10')](_0xccb1('0x26'),_0x2fe7ac);logger[_0xccb1('0x12')](_0xccb1('0x26'),_0x2fe7ac,JSON[_0xccb1('0x15')](_0x45c270));_0x3083f2(_0x45c270);})[_0xccb1('0x19')](function(_0x816c0){logger[_0xccb1('0x16')](_0xccb1('0x26'),_0x816c0[_0xccb1('0x17')],_0x2fe7ac);_0x7ef893(_0x67cdfa[_0xccb1('0x16')](0x1f4,_0x816c0[_0xccb1('0x17')]));});});}; \ No newline at end of file +var _0x523c=['where','attributes','include','map','model','stringify','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw'];(function(_0x3ff311,_0x2bce1b){var _0x49637e=function(_0x18e002){while(--_0x18e002){_0x3ff311['push'](_0x3ff311['shift']());}};_0x49637e(++_0x2bce1b);}(_0x523c,0x1bf));var _0xc523=function(_0x41ca3e,_0x14ab10){_0x41ca3e=_0x41ca3e-0x0;var _0x4bede9=_0x523c[_0x41ca3e];return _0x4bede9;};'use strict';var _=require(_0xc523('0x0'));var util=require(_0xc523('0x1'));var moment=require(_0xc523('0x2'));var BPromise=require(_0xc523('0x3'));var rs=require(_0xc523('0x4'));var fs=require('fs');var Redis=require(_0xc523('0x5'));var db=require(_0xc523('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc523('0x7'));var config=require(_0xc523('0x8'));var jayson=require(_0xc523('0x9'));var client=jayson[_0xc523('0xa')][_0xc523('0xb')]({'port':0x232a});config[_0xc523('0xc')]=_[_0xc523('0xd')](config['redis'],{'host':_0xc523('0xe'),'port':0x18eb});var socket=require(_0xc523('0xf'))(new Redis(config[_0xc523('0xc')]));require(_0xc523('0x10'))[_0xc523('0x11')](socket);function respondWithRpcPromise(_0x56a5c1,_0x4719c3,_0x21dfa3){return new BPromise(function(_0x22fe08,_0x419476){return client[_0xc523('0x12')](_0x56a5c1,_0x21dfa3)[_0xc523('0x13')](function(_0x4449d4){logger[_0xc523('0x14')]('FaxQueue,\x20%s,\x20%s',_0x4719c3,'request\x20sent');logger[_0xc523('0x15')](_0xc523('0x16'),_0x4719c3,_0xc523('0x17'),JSON['stringify'](_0x4449d4));if(_0x4449d4[_0xc523('0x18')]){if(_0x4449d4['error']['code']===0x1f4){logger['error'](_0xc523('0x19'),_0x4719c3,_0x4449d4['error'][_0xc523('0x1a')]);return _0x419476(_0x4449d4[_0xc523('0x18')][_0xc523('0x1a')]);}logger['error'](_0xc523('0x19'),_0x4719c3,_0x4449d4['error']['message']);return _0x22fe08(_0x4449d4[_0xc523('0x18')][_0xc523('0x1a')]);}else{logger['info'](_0xc523('0x19'),_0x4719c3,_0xc523('0x17'));_0x22fe08(_0x4449d4['result']['message']);}})[_0xc523('0x1b')](function(_0x84cbae){logger['error'](_0xc523('0x19'),_0x4719c3,_0x84cbae);_0x419476(_0x84cbae);});});}exports[_0xc523('0x1c')]=function(_0xb9743a){var _0x2f6471=this;return new Promise(function(_0x493c31,_0x1e71d8){return db[_0xc523('0x1d')][_0xc523('0x1e')]({'raw':_0xb9743a[_0xc523('0x1f')]?_0xb9743a[_0xc523('0x1f')][_0xc523('0x20')]===undefined?!![]:![]:!![],'where':_0xb9743a['options']?_0xb9743a[_0xc523('0x1f')][_0xc523('0x21')]||null:null,'attributes':_0xb9743a[_0xc523('0x1f')]?_0xb9743a[_0xc523('0x1f')][_0xc523('0x22')]||null:null,'limit':_0xb9743a[_0xc523('0x1f')]?_0xb9743a[_0xc523('0x1f')]['limit']||null:null,'include':_0xb9743a[_0xc523('0x1f')]?_0xb9743a[_0xc523('0x1f')][_0xc523('0x23')]?_[_0xc523('0x24')](_0xb9743a[_0xc523('0x1f')][_0xc523('0x23')],function(_0x9d2825){return{'model':db[_0x9d2825[_0xc523('0x25')]],'as':_0x9d2825['as'],'attributes':_0x9d2825['attributes'],'include':_0x9d2825['include']?_['map'](_0x9d2825[_0xc523('0x23')],function(_0x295cec){return{'model':db[_0x295cec[_0xc523('0x25')]],'as':_0x295cec['as'],'attributes':_0x295cec[_0xc523('0x22')],'include':_0x295cec[_0xc523('0x23')]?_['map'](_0x295cec[_0xc523('0x23')],function(_0x116f66){return{'model':db[_0x116f66[_0xc523('0x25')]],'as':_0x116f66['as'],'attributes':_0x116f66['attributes']};}):[]};}):[]};}):[]:[]})[_0xc523('0x13')](function(_0x2cbde6){logger[_0xc523('0x14')](_0xc523('0x1c'),_0xb9743a);logger[_0xc523('0x15')](_0xc523('0x1c'),_0xb9743a,JSON[_0xc523('0x26')](_0x2cbde6));_0x493c31(_0x2cbde6);})[_0xc523('0x1b')](function(_0x39f8f2){logger[_0xc523('0x18')]('GetFaxQueue',_0x39f8f2[_0xc523('0x1a')],_0xb9743a);_0x1e71d8(_0x2f6471['error'](0x1f4,_0x39f8f2[_0xc523('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x27fc5c){var _0x5df80e=this;return new Promise(function(_0x569916,_0x281ba4){return db[_0xc523('0x1d')]['find']({'raw':_0x27fc5c[_0xc523('0x1f')]?_0x27fc5c[_0xc523('0x1f')][_0xc523('0x20')]===undefined?!![]:![]:!![],'where':_0x27fc5c[_0xc523('0x1f')]?_0x27fc5c[_0xc523('0x1f')][_0xc523('0x21')]||null:null,'attributes':_0x27fc5c[_0xc523('0x1f')]?_0x27fc5c['options'][_0xc523('0x22')]||null:null,'include':_0x27fc5c[_0xc523('0x1f')]?_0x27fc5c[_0xc523('0x1f')][_0xc523('0x23')]?_[_0xc523('0x24')](_0x27fc5c['options']['include'],function(_0x590ced){return{'model':db[_0x590ced[_0xc523('0x25')]],'as':_0x590ced['as'],'attributes':_0x590ced[_0xc523('0x22')],'include':_0x590ced['include']?_[_0xc523('0x24')](_0x590ced[_0xc523('0x23')],function(_0x5211cc){return{'model':db[_0x5211cc[_0xc523('0x25')]],'as':_0x5211cc['as'],'attributes':_0x5211cc[_0xc523('0x22')],'include':_0x5211cc[_0xc523('0x23')]?_[_0xc523('0x24')](_0x5211cc[_0xc523('0x23')],function(_0x1d1ec2){return{'model':db[_0x1d1ec2[_0xc523('0x25')]],'as':_0x1d1ec2['as'],'attributes':_0x1d1ec2[_0xc523('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc523('0x13')](function(_0x325a62){logger[_0xc523('0x14')](_0xc523('0x27'),_0x27fc5c);logger['debug'](_0xc523('0x27'),_0x27fc5c,JSON['stringify'](_0x325a62));_0x569916(_0x325a62);})[_0xc523('0x1b')](function(_0x5639cb){logger['error'](_0xc523('0x27'),_0x5639cb[_0xc523('0x1a')],_0x27fc5c);_0x281ba4(_0x5df80e['error'](0x1f4,_0x5639cb[_0xc523('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 4a6024c..c550b2f 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 _0x0c42=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x1e5068,_0x31e9c4){var _0x2230b6=function(_0xaa2ee){while(--_0xaa2ee){_0x1e5068['push'](_0x1e5068['shift']());}};_0x2230b6(++_0x31e9c4);}(_0x0c42,0x191));var _0x20c4=function(_0x2a8a7d,_0x211ad8){_0x2a8a7d=_0x2a8a7d-0x0;var _0x1d2092=_0x0c42[_0x2a8a7d];return _0x1d2092;};'use strict';var FaxQueueEvents=require(_0x20c4('0x0'));var events=[_0x20c4('0x1'),_0x20c4('0x2'),_0x20c4('0x3')];function createListener(_0xe6959,_0x5810aa){return function(_0x5d686d){_0x5810aa[_0x20c4('0x4')](_0xe6959,_0x5d686d);};}function removeListener(_0x1296a8,_0x24bfc1){return function(){FaxQueueEvents[_0x20c4('0x5')](_0x1296a8,_0x24bfc1);};}exports[_0x20c4('0x6')]=function(_0x58e1ed){for(var _0x339b15=0x0,_0x4c4f94=events[_0x20c4('0x7')];_0x339b15<_0x4c4f94;_0x339b15++){var _0x5d2014=events[_0x339b15];var _0xc29a61=createListener(_0x20c4('0x8')+_0x5d2014,_0x58e1ed);FaxQueueEvents['on'](_0x5d2014,_0xc29a61);}}; \ No newline at end of file +var _0xeb00=['save','emit','removeListener','register','length','./faxQueue.events'];(function(_0x3e2896,_0x2a4e68){var _0x53150a=function(_0x468214){while(--_0x468214){_0x3e2896['push'](_0x3e2896['shift']());}};_0x53150a(++_0x2a4e68);}(_0xeb00,0x1bb));var _0x0eb0=function(_0x3237ae,_0x3403fb){_0x3237ae=_0x3237ae-0x0;var _0x197d54=_0xeb00[_0x3237ae];return _0x197d54;};'use strict';var FaxQueueEvents=require(_0x0eb0('0x0'));var events=[_0x0eb0('0x1'),'remove','update'];function createListener(_0x3e7f5a,_0x391133){return function(_0xea1050){_0x391133[_0x0eb0('0x2')](_0x3e7f5a,_0xea1050);};}function removeListener(_0x430067,_0x512f1c){return function(){FaxQueueEvents[_0x0eb0('0x3')](_0x430067,_0x512f1c);};}exports[_0x0eb0('0x4')]=function(_0x223a2b){for(var _0x42e36a=0x0,_0x22c5dd=events[_0x0eb0('0x5')];_0x42e36a<_0x22c5dd;_0x42e36a++){var _0xf5ba43=events[_0x42e36a];var _0x270ead=createListener('faxQueue:'+_0xf5ba43,_0x223a2b);FaxQueueEvents['on'](_0xf5ba43,_0x270ead);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1afcc8b..4c42b36 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 _0x8ace=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','create','post','/:id/teams','addTeams','/:id/users','addAgents','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x9d58e0,_0x5ee515){var _0x5eab07=function(_0x177eb4){while(--_0x177eb4){_0x9d58e0['push'](_0x9d58e0['shift']());}};_0x5eab07(++_0x5ee515);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x19776e,_0x3690de){_0x19776e=_0x19776e-0x0;var _0xce4b5f=_0x8ace[_0x19776e];return _0xce4b5f;};'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 fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['describe']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0xb')](_0xe8ac('0x11'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0xb')]('/:id/teams',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x13')]);router[_0xe8ac('0xb')]('/:id/users',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x14')]);router['post']('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x15')]);router[_0xe8ac('0x16')](_0xe8ac('0x17'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x18')]);router[_0xe8ac('0x16')](_0xe8ac('0x19'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x1a')]);router['put'](_0xe8ac('0xf'),auth[_0xe8ac('0xc')](),controller['update']);router[_0xe8ac('0x1b')](_0xe8ac('0xf'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x1c')]);router[_0xe8ac('0x1b')](_0xe8ac('0x17'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xe8ac('0x19'),auth[_0xe8ac('0xc')](),controller['removeAgents']);module[_0xe8ac('0x1d')]=router; \ No newline at end of file +var _0xf0f4=['../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','util','express','Router','../../components/auth/service'];(function(_0x3c6835,_0x952d5c){var _0x1adeb9=function(_0xfefab3){while(--_0xfefab3){_0x3c6835['push'](_0x3c6835['shift']());}};_0x1adeb9(++_0x952d5c);}(_0xf0f4,0x182));var _0x4f0f=function(_0x589e56,_0x5e56ec){_0x589e56=_0x589e56-0x0;var _0x4a94b3=_0xf0f4[_0x589e56];return _0x4a94b3;};'use strict';var multer=require('multer');var util=require(_0x4f0f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f0f('0x1'));var router=express[_0x4f0f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4f0f('0x3'));var interaction=require(_0x4f0f('0x4'));var config=require(_0x4f0f('0x5'));var controller=require(_0x4f0f('0x6'));router[_0x4f0f('0x7')]('/',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x9')]);router['get'](_0x4f0f('0xa'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xb')]);router['get'](_0x4f0f('0xc'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xd')]);router[_0x4f0f('0x7')](_0x4f0f('0xe'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xf')]);router[_0x4f0f('0x7')]('/:id/teams',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x10')]);router[_0x4f0f('0x7')](_0x4f0f('0x11'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x12')]);router[_0x4f0f('0x13')]('/',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x14')]);router[_0x4f0f('0x13')](_0x4f0f('0x15'),auth['isAuthenticated'](),controller[_0x4f0f('0x16')]);router[_0x4f0f('0x13')](_0x4f0f('0x11'),auth[_0x4f0f('0x8')](),controller['addAgents']);router[_0x4f0f('0x17')](_0x4f0f('0xc'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x18')]);router[_0x4f0f('0x19')]('/:id',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x1a')]);router[_0x4f0f('0x19')]('/:id/teams',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x1b')]);router[_0x4f0f('0x19')]('/:id/users',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x1c')]);module[_0x4f0f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 34ccec6..b14d8d1 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 _0x3102=['DATE','sequelize','exports','STRING'];(function(_0x3fa4bd,_0x14a72d){var _0x358c95=function(_0x55c7fc){while(--_0x55c7fc){_0x3fa4bd['push'](_0x3fa4bd['shift']());}};_0x358c95(++_0x14a72d);}(_0x3102,0x119));var _0x2310=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x3102[_0x81dcac];return _0xc7803b;};'use strict';var moment=require('moment');var Sequelize=require(_0x2310('0x0'));module[_0x2310('0x1')]={'uniqueid':{'type':Sequelize[_0x2310('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2310('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2310('0x3')]},'acceptAt':{'type':Sequelize[_0x2310('0x3')]},'exitAt':{'type':Sequelize[_0x2310('0x3')]},'reason':{'type':Sequelize[_0x2310('0x2')]}}; \ No newline at end of file +var _0x6b9d=['STRING','DATE','moment','sequelize','exports'];(function(_0x1de868,_0x276f1c){var _0x85119e=function(_0x1740b6){while(--_0x1740b6){_0x1de868['push'](_0x1de868['shift']());}};_0x85119e(++_0x276f1c);}(_0x6b9d,0xed));var _0xd6b9=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x6b9d[_0x41d432];return _0x1650f9;};'use strict';var moment=require(_0xd6b9('0x0'));var Sequelize=require(_0xd6b9('0x1'));module[_0xd6b9('0x2')]={'uniqueid':{'type':Sequelize[_0xd6b9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd6b9('0x3')]},'joinAt':{'type':Sequelize[_0xd6b9('0x4')]},'leaveAt':{'type':Sequelize[_0xd6b9('0x4')]},'acceptAt':{'type':Sequelize[_0xd6b9('0x4')]},'exitAt':{'type':Sequelize[_0xd6b9('0x4')]},'reason':{'type':Sequelize[_0xd6b9('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 338dce8..5f5c0e4 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 _0x6a55=['rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','includeAll','findAll','show','keys','include','merge','options','find','catch','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','reject','save','update','then','end','error','stack','name','index','map','FaxQueueReport'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6a55,0x154));var _0x56a5=function(_0x48df04,_0x1522b1){_0x48df04=_0x48df04-0x0;var _0x4de5fa=_0x6a55[_0x48df04];return _0x4de5fa;};'use strict';var emlformat=require(_0x56a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56a5('0x1'));var jsonpatch=require(_0x56a5('0x2'));var rp=require('request-promise');var moment=require(_0x56a5('0x3'));var BPromise=require(_0x56a5('0x4'));var Mustache=require(_0x56a5('0x5'));var util=require(_0x56a5('0x6'));var path=require(_0x56a5('0x7'));var sox=require(_0x56a5('0x8'));var csv=require(_0x56a5('0x9'));var ejs=require(_0x56a5('0xa'));var fs=require('fs');var fs_extra=require(_0x56a5('0xb'));var _=require(_0x56a5('0xc'));var squel=require(_0x56a5('0xd'));var crypto=require(_0x56a5('0xe'));var jsforce=require(_0x56a5('0xf'));var deskjs=require(_0x56a5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x56a5('0x11'));var Papa=require(_0x56a5('0x12'));var Redis=require('ioredis');var authService=require(_0x56a5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56a5('0x14'));var logger=require(_0x56a5('0x15'))(_0x56a5('0x16'));var utils=require(_0x56a5('0x17'));var config=require(_0x56a5('0x18'));var licenseUtil=require(_0x56a5('0x19'));var db=require(_0x56a5('0x1a'))['db'];function respondWithStatusCode(_0x4b4dc7,_0x42dced){_0x42dced=_0x42dced||0xcc;return function(_0x5a80ed){if(_0x5a80ed){return _0x4b4dc7[_0x56a5('0x1b')](_0x42dced);}return _0x4b4dc7[_0x56a5('0x1c')](_0x42dced)['end']();};}function respondWithResult(_0x281d8b,_0x145174){_0x145174=_0x145174||0xc8;return function(_0x11f64d){if(_0x11f64d){return _0x281d8b[_0x56a5('0x1c')](_0x145174)['json'](_0x11f64d);}};}function respondWithFilteredResult(_0x3ad9d9,_0xdfce42){return function(_0x24cb7b){if(_0x24cb7b){var _0x466f52=typeof _0xdfce42[_0x56a5('0x1d')]===_0x56a5('0x1e')&&typeof _0xdfce42[_0x56a5('0x1f')]===_0x56a5('0x1e');var _0x26debc=_0x24cb7b['count'];var _0x52758f=_0x466f52?0x0:_0xdfce42[_0x56a5('0x1d')];var _0x4ed8dc=_0x466f52?_0x24cb7b[_0x56a5('0x20')]:_0xdfce42[_0x56a5('0x1d')]+_0xdfce42[_0x56a5('0x1f')];var _0x365150;if(_0x4ed8dc>=_0x26debc){_0x4ed8dc=_0x26debc;_0x365150=0xc8;}else{_0x365150=0xce;}_0x3ad9d9[_0x56a5('0x1c')](_0x365150);return _0x3ad9d9['set']('Content-Range',_0x52758f+'-'+_0x4ed8dc+'/'+_0x26debc)[_0x56a5('0x21')](_0x24cb7b);}return null;};}function patchUpdates(_0x5882cd){return function(_0x32b71f){try{jsonpatch['apply'](_0x32b71f,_0x5882cd,!![]);}catch(_0x3a8046){return BPromise[_0x56a5('0x22')](_0x3a8046);}return _0x32b71f[_0x56a5('0x23')]();};}function saveUpdates(_0x4cc2e2,_0x25eeb2){return function(_0x5bdefb){if(_0x5bdefb){return _0x5bdefb[_0x56a5('0x24')](_0x4cc2e2)['then'](function(_0x5749ea){return _0x5749ea;});}return null;};}function removeEntity(_0x1228af,_0x488b2a){return function(_0x2cc3c0){if(_0x2cc3c0){return _0x2cc3c0['destroy']()[_0x56a5('0x25')](function(){_0x1228af[_0x56a5('0x1c')](0xcc)[_0x56a5('0x26')]();});}};}function handleEntityNotFound(_0x587d78,_0x38b5e0){return function(_0x2950f6){if(!_0x2950f6){_0x587d78['sendStatus'](0x194);}return _0x2950f6;};}function handleError(_0x1a0dec,_0x3cb7ae){_0x3cb7ae=_0x3cb7ae||0x1f4;return function(_0x3dfdaf){logger[_0x56a5('0x27')](_0x3dfdaf[_0x56a5('0x28')]);if(_0x3dfdaf[_0x56a5('0x29')]){delete _0x3dfdaf['name'];}_0x1a0dec[_0x56a5('0x1c')](_0x3cb7ae)['send'](_0x3dfdaf);};}exports[_0x56a5('0x2a')]=function(_0x42b87b,_0x1355d6){var _0xb1e9c5={},_0x263188={},_0x2de197={'count':0x0,'rows':[]};var _0x512a48=_[_0x56a5('0x2b')](db[_0x56a5('0x2c')][_0x56a5('0x2d')],function(_0x5036cc){return{'name':_0x5036cc[_0x56a5('0x2e')],'type':_0x5036cc[_0x56a5('0x2f')]['key']};});_0x263188['model']=_[_0x56a5('0x2b')](_0x512a48,_0x56a5('0x29'));_0x263188[_0x56a5('0x30')]=_['keys'](_0x42b87b[_0x56a5('0x30')]);_0x263188['filters']=_[_0x56a5('0x31')](_0x263188[_0x56a5('0x32')],_0x263188[_0x56a5('0x30')]);_0xb1e9c5[_0x56a5('0x33')]=_[_0x56a5('0x31')](_0x263188[_0x56a5('0x32')],qs['fields'](_0x42b87b['query'][_0x56a5('0x34')]));_0xb1e9c5[_0x56a5('0x33')]=_0xb1e9c5['attributes'][_0x56a5('0x35')]?_0xb1e9c5[_0x56a5('0x33')]:_0x263188[_0x56a5('0x32')];if(!_0x42b87b['query'][_0x56a5('0x36')](_0x56a5('0x37'))){_0xb1e9c5[_0x56a5('0x1f')]=qs[_0x56a5('0x1f')](_0x42b87b[_0x56a5('0x30')][_0x56a5('0x1f')]);_0xb1e9c5['offset']=qs[_0x56a5('0x1d')](_0x42b87b[_0x56a5('0x30')]['offset']);}_0xb1e9c5[_0x56a5('0x38')]=qs[_0x56a5('0x39')](_0x42b87b[_0x56a5('0x30')][_0x56a5('0x39')]);_0xb1e9c5['where']=qs[_0x56a5('0x3a')](_[_0x56a5('0x3b')](_0x42b87b[_0x56a5('0x30')],_0x263188[_0x56a5('0x3a')]),_0x512a48);if(_0x42b87b[_0x56a5('0x30')][_0x56a5('0x3c')]){_0xb1e9c5['where']=_['merge'](_0xb1e9c5[_0x56a5('0x3d')],{'$or':_[_0x56a5('0x2b')](_0x512a48,function(_0x268f9c){if(_0x268f9c[_0x56a5('0x2f')]!==_0x56a5('0x3e')){var _0x41bd0b={};_0x41bd0b[_0x268f9c['name']]={'$like':'%'+_0x42b87b[_0x56a5('0x30')][_0x56a5('0x3c')]+'%'};return _0x41bd0b;}})});}_0xb1e9c5=_['merge']({},_0xb1e9c5,_0x42b87b['options']);var _0xb44fb0={'where':_0xb1e9c5[_0x56a5('0x3d')]};return db['FaxQueueReport'][_0x56a5('0x20')](_0xb44fb0)[_0x56a5('0x25')](function(_0x47b3fa){_0x2de197[_0x56a5('0x20')]=_0x47b3fa;if(_0x42b87b[_0x56a5('0x30')][_0x56a5('0x3f')]){_0xb1e9c5['include']=[{'all':!![]}];}return db[_0x56a5('0x2c')][_0x56a5('0x40')](_0xb1e9c5);})['then'](function(_0x23bfa5){_0x2de197['rows']=_0x23bfa5;return _0x2de197;})[_0x56a5('0x25')](respondWithFilteredResult(_0x1355d6,_0xb1e9c5))['catch'](handleError(_0x1355d6,null));};exports[_0x56a5('0x41')]=function(_0x17fcee,_0x4431f7){var _0x5205b8={'raw':!![],'where':{'id':_0x17fcee['params']['id']}},_0x39ee9a={};_0x39ee9a[_0x56a5('0x32')]=_[_0x56a5('0x42')](db[_0x56a5('0x2c')][_0x56a5('0x2d')]);_0x39ee9a[_0x56a5('0x30')]=_[_0x56a5('0x42')](_0x17fcee[_0x56a5('0x30')]);_0x39ee9a[_0x56a5('0x3a')]=_['intersection'](_0x39ee9a[_0x56a5('0x32')],_0x39ee9a[_0x56a5('0x30')]);_0x5205b8['attributes']=_[_0x56a5('0x31')](_0x39ee9a[_0x56a5('0x32')],qs['fields'](_0x17fcee['query'][_0x56a5('0x34')]));_0x5205b8[_0x56a5('0x33')]=_0x5205b8[_0x56a5('0x33')][_0x56a5('0x35')]?_0x5205b8[_0x56a5('0x33')]:_0x39ee9a[_0x56a5('0x32')];if(_0x17fcee['query']['includeAll']){_0x5205b8[_0x56a5('0x43')]=[{'all':!![]}];}_0x5205b8=_[_0x56a5('0x44')]({},_0x5205b8,_0x17fcee[_0x56a5('0x45')]);return db['FaxQueueReport'][_0x56a5('0x46')](_0x5205b8)['then'](handleEntityNotFound(_0x4431f7,null))[_0x56a5('0x25')](respondWithResult(_0x4431f7,null))[_0x56a5('0x47')](handleError(_0x4431f7,null));};exports[_0x56a5('0x48')]=function(_0x2ecbaa,_0x37faf5){return db[_0x56a5('0x2c')][_0x56a5('0x48')](_0x2ecbaa[_0x56a5('0x49')],{})[_0x56a5('0x25')](respondWithResult(_0x37faf5,0xc9))['catch'](handleError(_0x37faf5,null));};exports[_0x56a5('0x24')]=function(_0xaaa40c,_0x5a8ba3){if(_0xaaa40c[_0x56a5('0x49')]['id']){delete _0xaaa40c[_0x56a5('0x49')]['id'];}return db[_0x56a5('0x2c')]['find']({'where':{'id':_0xaaa40c[_0x56a5('0x4a')]['id']}})[_0x56a5('0x25')](handleEntityNotFound(_0x5a8ba3,null))[_0x56a5('0x25')](saveUpdates(_0xaaa40c['body'],null))[_0x56a5('0x25')](respondWithResult(_0x5a8ba3,null))[_0x56a5('0x47')](handleError(_0x5a8ba3,null));};exports[_0x56a5('0x4b')]=function(_0x1b0c6f,_0x2b5f2a){return db[_0x56a5('0x2c')][_0x56a5('0x46')]({'where':{'id':_0x1b0c6f[_0x56a5('0x4a')]['id']}})[_0x56a5('0x25')](handleEntityNotFound(_0x2b5f2a,null))[_0x56a5('0x25')](removeEntity(_0x2b5f2a,null))[_0x56a5('0x47')](handleError(_0x2b5f2a,null));};exports[_0x56a5('0x4c')]=function(_0x3229c8,_0xff01fa){return db[_0x56a5('0x2c')][_0x56a5('0x4c')]()['then'](respondWithResult(_0xff01fa,null))['catch'](handleError(_0xff01fa,null));}; \ No newline at end of file +var _0x579c=['path','sox','to-csv','ejs','fs-extra','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','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','order','sort','where','filters','pick','filter','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x579c,0xda));var _0xc579=function(_0x43a08a,_0x446a12){_0x43a08a=_0x43a08a-0x0;var _0x783bec=_0x579c[_0x43a08a];return _0x783bec;};'use strict';var emlformat=require(_0xc579('0x0'));var rimraf=require(_0xc579('0x1'));var zipdir=require(_0xc579('0x2'));var jsonpatch=require(_0xc579('0x3'));var rp=require(_0xc579('0x4'));var moment=require('moment');var BPromise=require(_0xc579('0x5'));var Mustache=require('mustache');var util=require(_0xc579('0x6'));var path=require(_0xc579('0x7'));var sox=require(_0xc579('0x8'));var csv=require(_0xc579('0x9'));var ejs=require(_0xc579('0xa'));var fs=require('fs');var fs_extra=require(_0xc579('0xb'));var _=require(_0xc579('0xc'));var squel=require('squel');var crypto=require(_0xc579('0xd'));var jsforce=require(_0xc579('0xe'));var deskjs=require(_0xc579('0xf'));var toCsv=require(_0xc579('0x9'));var querystring=require(_0xc579('0x10'));var Papa=require(_0xc579('0x11'));var Redis=require(_0xc579('0x12'));var authService=require(_0xc579('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc579('0x14'));var hardwareService=require(_0xc579('0x15'));var logger=require(_0xc579('0x16'))(_0xc579('0x17'));var utils=require(_0xc579('0x18'));var config=require(_0xc579('0x19'));var licenseUtil=require(_0xc579('0x1a'));var db=require(_0xc579('0x1b'))['db'];function respondWithStatusCode(_0x421812,_0x441028){_0x441028=_0x441028||0xcc;return function(_0x448d51){if(_0x448d51){return _0x421812['sendStatus'](_0x441028);}return _0x421812[_0xc579('0x1c')](_0x441028)['end']();};}function respondWithResult(_0xf5400e,_0x59243e){_0x59243e=_0x59243e||0xc8;return function(_0x424e15){if(_0x424e15){return _0xf5400e['status'](_0x59243e)[_0xc579('0x1d')](_0x424e15);}};}function respondWithFilteredResult(_0x4b3635,_0x349e82){return function(_0x115276){if(_0x115276){var _0x567de5=typeof _0x349e82['offset']===_0xc579('0x1e')&&typeof _0x349e82[_0xc579('0x1f')]===_0xc579('0x1e');var _0x414ee7=_0x115276[_0xc579('0x20')];var _0x33d341=_0x567de5?0x0:_0x349e82[_0xc579('0x21')];var _0x3da8a1=_0x567de5?_0x115276[_0xc579('0x20')]:_0x349e82[_0xc579('0x21')]+_0x349e82['limit'];var _0x463f5e;if(_0x3da8a1>=_0x414ee7){_0x3da8a1=_0x414ee7;_0x463f5e=0xc8;}else{_0x463f5e=0xce;}_0x4b3635[_0xc579('0x1c')](_0x463f5e);return _0x4b3635['set'](_0xc579('0x22'),_0x33d341+'-'+_0x3da8a1+'/'+_0x414ee7)[_0xc579('0x1d')](_0x115276);}return null;};}function patchUpdates(_0x14fcdd){return function(_0x6501bc){try{jsonpatch[_0xc579('0x23')](_0x6501bc,_0x14fcdd,!![]);}catch(_0x4417e1){return BPromise[_0xc579('0x24')](_0x4417e1);}return _0x6501bc[_0xc579('0x25')]();};}function saveUpdates(_0x55781e,_0x92657f){return function(_0xad4889){if(_0xad4889){return _0xad4889[_0xc579('0x26')](_0x55781e)[_0xc579('0x27')](function(_0x1da86e){return _0x1da86e;});}return null;};}function removeEntity(_0x565a1b,_0x3634f2){return function(_0x3cf83f){if(_0x3cf83f){return _0x3cf83f[_0xc579('0x28')]()['then'](function(){_0x565a1b[_0xc579('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4610c2,_0x21a4db){return function(_0x4d758a){if(!_0x4d758a){_0x4610c2['sendStatus'](0x194);}return _0x4d758a;};}function handleError(_0x1f8e4b,_0x5b5f4e){_0x5b5f4e=_0x5b5f4e||0x1f4;return function(_0x532b33){logger['error'](_0x532b33[_0xc579('0x29')]);if(_0x532b33[_0xc579('0x2a')]){delete _0x532b33[_0xc579('0x2a')];}_0x1f8e4b[_0xc579('0x1c')](_0x5b5f4e)[_0xc579('0x2b')](_0x532b33);};}exports[_0xc579('0x2c')]=function(_0x45fef4,_0x5c272f){var _0x4d78bc={},_0x4a5f6={},_0x4897a1={'count':0x0,'rows':[]};var _0x314daa=_[_0xc579('0x2d')](db[_0xc579('0x2e')][_0xc579('0x2f')],function(_0x1ad8f7){return{'name':_0x1ad8f7[_0xc579('0x30')],'type':_0x1ad8f7[_0xc579('0x31')][_0xc579('0x32')]};});_0x4a5f6['model']=_[_0xc579('0x2d')](_0x314daa,_0xc579('0x2a'));_0x4a5f6[_0xc579('0x33')]=_[_0xc579('0x34')](_0x45fef4['query']);_0x4a5f6['filters']=_[_0xc579('0x35')](_0x4a5f6['model'],_0x4a5f6[_0xc579('0x33')]);_0x4d78bc[_0xc579('0x36')]=_[_0xc579('0x35')](_0x4a5f6[_0xc579('0x37')],qs[_0xc579('0x38')](_0x45fef4['query'][_0xc579('0x38')]));_0x4d78bc['attributes']=_0x4d78bc[_0xc579('0x36')][_0xc579('0x39')]?_0x4d78bc['attributes']:_0x4a5f6[_0xc579('0x37')];if(!_0x45fef4[_0xc579('0x33')]['hasOwnProperty']('nolimit')){_0x4d78bc[_0xc579('0x1f')]=qs[_0xc579('0x1f')](_0x45fef4['query'][_0xc579('0x1f')]);_0x4d78bc[_0xc579('0x21')]=qs['offset'](_0x45fef4[_0xc579('0x33')]['offset']);}_0x4d78bc[_0xc579('0x3a')]=qs[_0xc579('0x3b')](_0x45fef4['query'][_0xc579('0x3b')]);_0x4d78bc[_0xc579('0x3c')]=qs[_0xc579('0x3d')](_[_0xc579('0x3e')](_0x45fef4[_0xc579('0x33')],_0x4a5f6[_0xc579('0x3d')]),_0x314daa);if(_0x45fef4['query'][_0xc579('0x3f')]){_0x4d78bc[_0xc579('0x3c')]=_['merge'](_0x4d78bc[_0xc579('0x3c')],{'$or':_[_0xc579('0x2d')](_0x314daa,function(_0x3f9bee){if(_0x3f9bee[_0xc579('0x31')]!=='VIRTUAL'){var _0x3f744f={};_0x3f744f[_0x3f9bee[_0xc579('0x2a')]]={'$like':'%'+_0x45fef4[_0xc579('0x33')]['filter']+'%'};return _0x3f744f;}})});}_0x4d78bc=_['merge']({},_0x4d78bc,_0x45fef4['options']);var _0x1ef28f={'where':_0x4d78bc[_0xc579('0x3c')]};return db[_0xc579('0x2e')][_0xc579('0x20')](_0x1ef28f)[_0xc579('0x27')](function(_0x2b60eb){_0x4897a1['count']=_0x2b60eb;if(_0x45fef4[_0xc579('0x33')]['includeAll']){_0x4d78bc[_0xc579('0x40')]=[{'all':!![]}];}return db[_0xc579('0x2e')][_0xc579('0x41')](_0x4d78bc);})[_0xc579('0x27')](function(_0x3d8f24){_0x4897a1[_0xc579('0x42')]=_0x3d8f24;return _0x4897a1;})[_0xc579('0x27')](respondWithFilteredResult(_0x5c272f,_0x4d78bc))[_0xc579('0x43')](handleError(_0x5c272f,null));};exports['show']=function(_0x2a2248,_0x2532a5){var _0x74b63d={'raw':!![],'where':{'id':_0x2a2248[_0xc579('0x44')]['id']}},_0x2449e6={};_0x2449e6[_0xc579('0x37')]=_['keys'](db[_0xc579('0x2e')][_0xc579('0x2f')]);_0x2449e6[_0xc579('0x33')]=_['keys'](_0x2a2248[_0xc579('0x33')]);_0x2449e6[_0xc579('0x3d')]=_[_0xc579('0x35')](_0x2449e6['model'],_0x2449e6[_0xc579('0x33')]);_0x74b63d['attributes']=_[_0xc579('0x35')](_0x2449e6[_0xc579('0x37')],qs[_0xc579('0x38')](_0x2a2248['query'][_0xc579('0x38')]));_0x74b63d[_0xc579('0x36')]=_0x74b63d['attributes']['length']?_0x74b63d[_0xc579('0x36')]:_0x2449e6[_0xc579('0x37')];if(_0x2a2248[_0xc579('0x33')][_0xc579('0x45')]){_0x74b63d['include']=[{'all':!![]}];}_0x74b63d=_['merge']({},_0x74b63d,_0x2a2248[_0xc579('0x46')]);return db[_0xc579('0x2e')][_0xc579('0x47')](_0x74b63d)[_0xc579('0x27')](handleEntityNotFound(_0x2532a5,null))['then'](respondWithResult(_0x2532a5,null))[_0xc579('0x43')](handleError(_0x2532a5,null));};exports[_0xc579('0x48')]=function(_0x53eb6f,_0x40d790){return db['FaxQueueReport']['create'](_0x53eb6f['body'],{})[_0xc579('0x27')](respondWithResult(_0x40d790,0xc9))[_0xc579('0x43')](handleError(_0x40d790,null));};exports[_0xc579('0x26')]=function(_0x90a0d3,_0x1f9d15){if(_0x90a0d3['body']['id']){delete _0x90a0d3[_0xc579('0x49')]['id'];}return db[_0xc579('0x2e')][_0xc579('0x47')]({'where':{'id':_0x90a0d3['params']['id']}})['then'](handleEntityNotFound(_0x1f9d15,null))[_0xc579('0x27')](saveUpdates(_0x90a0d3[_0xc579('0x49')],null))[_0xc579('0x27')](respondWithResult(_0x1f9d15,null))[_0xc579('0x43')](handleError(_0x1f9d15,null));};exports[_0xc579('0x28')]=function(_0xe1a1d7,_0x138ab2){return db['FaxQueueReport']['find']({'where':{'id':_0xe1a1d7[_0xc579('0x44')]['id']}})[_0xc579('0x27')](handleEntityNotFound(_0x138ab2,null))['then'](removeEntity(_0x138ab2,null))[_0xc579('0x43')](handleError(_0x138ab2,null));};exports['describe']=function(_0x1e4872,_0x40017a){return db[_0xc579('0x2e')][_0xc579('0x4a')]()[_0xc579('0x27')](respondWithResult(_0x40017a,null))[_0xc579('0x43')](handleError(_0x40017a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3329bb3..d85f676 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x4ddc3e,_0x35e180){var _0x519821=function(_0x10bdd1){while(--_0x10bdd1){_0x4ddc3e['push'](_0x4ddc3e['shift']());}};_0x519821(++_0x35e180);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x233136,_0x290a87){var _0x3f9034=function(_0x3e0bbe){while(--_0x3e0bbe){_0x233136['push'](_0x233136['shift']());}};_0x3f9034(++_0x290a87);}(_0xf494,0x1c6));var _0x4f49=function(_0x2e24a8,_0x11b81e){_0x2e24a8=_0x2e24a8-0x0;var _0x1a337e=_0xf494[_0x2e24a8];return _0x1a337e;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 2bfe692..b89c146 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 _0x4dde=['then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','info','stringify','UpdateFaxQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xd1aec9,_0x1e1072){var _0x1031f9=function(_0x2845bf){while(--_0x2845bf){_0xd1aec9['push'](_0xd1aec9['shift']());}};_0x1031f9(++_0x1e1072);}(_0x4dde,0xd0));var _0xe4dd=function(_0x193ed6,_0x8c899b){_0x193ed6=_0x193ed6-0x0;var _0x14671f=_0x4dde[_0x193ed6];return _0x14671f;};'use strict';var _=require(_0xe4dd('0x0'));var util=require(_0xe4dd('0x1'));var moment=require(_0xe4dd('0x2'));var BPromise=require(_0xe4dd('0x3'));var rs=require(_0xe4dd('0x4'));var fs=require('fs');var Redis=require(_0xe4dd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4dd('0x6'));var logger=require(_0xe4dd('0x7'))(_0xe4dd('0x8'));var config=require(_0xe4dd('0x9'));var jayson=require(_0xe4dd('0xa'));var client=jayson[_0xe4dd('0xb')][_0xe4dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c2945,_0x3e1993,_0x1253d9){return new BPromise(function(_0x3c9804,_0x2c085e){return client[_0xe4dd('0xd')](_0x4c2945,_0x1253d9)[_0xe4dd('0xe')](function(_0x542c1a){logger['info'](_0xe4dd('0xf'),_0x3e1993,_0xe4dd('0x10'));logger[_0xe4dd('0x11')](_0xe4dd('0x12'),_0x3e1993,_0xe4dd('0x10'),JSON['stringify'](_0x542c1a));if(_0x542c1a[_0xe4dd('0x13')]){if(_0x542c1a['error'][_0xe4dd('0x14')]===0x1f4){logger[_0xe4dd('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x3e1993,_0x542c1a['error'][_0xe4dd('0x15')]);return _0x2c085e(_0x542c1a['error'][_0xe4dd('0x15')]);}logger['error'](_0xe4dd('0xf'),_0x3e1993,_0x542c1a[_0xe4dd('0x13')]['message']);return _0x3c9804(_0x542c1a[_0xe4dd('0x13')][_0xe4dd('0x15')]);}else{logger['info'](_0xe4dd('0xf'),_0x3e1993,_0xe4dd('0x10'));_0x3c9804(_0x542c1a[_0xe4dd('0x16')]['message']);}})[_0xe4dd('0x17')](function(_0x4af9d5){logger[_0xe4dd('0x13')](_0xe4dd('0xf'),_0x3e1993,_0x4af9d5);_0x2c085e(_0x4af9d5);});});}exports[_0xe4dd('0x18')]=function(_0xdfc3be){var _0x3a5311=this;return new Promise(function(_0x4ef305,_0xa4befc){return db[_0xe4dd('0x19')][_0xe4dd('0x1a')](_0xdfc3be[_0xe4dd('0x1b')],{'raw':_0xdfc3be[_0xe4dd('0x1c')]?_0xdfc3be[_0xe4dd('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x15bcaa){logger[_0xe4dd('0x1d')](_0xe4dd('0x18'),_0xdfc3be);logger[_0xe4dd('0x11')](_0xe4dd('0x18'),_0xdfc3be,JSON[_0xe4dd('0x1e')](_0x15bcaa));_0x4ef305(_0x15bcaa);})[_0xe4dd('0x17')](function(_0x4b1359){logger['error']('CreateFaxQueueReport',_0x4b1359['message'],_0xdfc3be);_0xa4befc(_0x3a5311[_0xe4dd('0x13')](0x1f4,_0x4b1359[_0xe4dd('0x15')]));});});};exports[_0xe4dd('0x1f')]=function(_0x58c7cb){var _0x5212bf=this;return new Promise(function(_0xd601e9,_0x110ec4){return db[_0xe4dd('0x19')][_0xe4dd('0x20')](_0x58c7cb[_0xe4dd('0x1b')],{'raw':_0x58c7cb[_0xe4dd('0x1c')]?_0x58c7cb[_0xe4dd('0x1c')][_0xe4dd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58c7cb['options']?_0x58c7cb[_0xe4dd('0x1c')][_0xe4dd('0x22')]||null:null,'attributes':_0x58c7cb['options']?_0x58c7cb[_0xe4dd('0x1c')][_0xe4dd('0x23')]||null:null,'limit':_0x58c7cb[_0xe4dd('0x1c')]?_0x58c7cb[_0xe4dd('0x1c')][_0xe4dd('0x24')]||null:null})[_0xe4dd('0xe')](function(_0x20703a){logger[_0xe4dd('0x1d')](_0xe4dd('0x1f'),_0x58c7cb);logger[_0xe4dd('0x11')](_0xe4dd('0x1f'),_0x58c7cb,JSON[_0xe4dd('0x1e')](_0x20703a));_0xd601e9(_0x20703a);})[_0xe4dd('0x17')](function(_0x3b43bd){logger['error']('UpdateFaxQueueReport',_0x3b43bd[_0xe4dd('0x15')],_0x58c7cb);_0x110ec4(_0x5212bf[_0xe4dd('0x13')](0x1f4,_0x3b43bd[_0xe4dd('0x15')]));});});}; \ No newline at end of file +var _0xf545=['jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','debug','catch','UpdateFaxQueueReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x513d80,_0x1649db){var _0x174463=function(_0x3b3dcd){while(--_0x3b3dcd){_0x513d80['push'](_0x513d80['shift']());}};_0x174463(++_0x1649db);}(_0xf545,0x184));var _0x5f54=function(_0x288478,_0x23303e){_0x288478=_0x288478-0x0;var _0x234c05=_0xf545[_0x288478];return _0x234c05;};'use strict';var _=require(_0x5f54('0x0'));var util=require(_0x5f54('0x1'));var moment=require(_0x5f54('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f54('0x4'))['db'];var utils=require(_0x5f54('0x5'));var logger=require(_0x5f54('0x6'))(_0x5f54('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f54('0x8'));var client=jayson[_0x5f54('0x9')][_0x5f54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9f89b5,_0x2d7a9d,_0x3664b7){return new BPromise(function(_0x2f9d4e,_0x4b1a44){return client[_0x5f54('0xb')](_0x9f89b5,_0x3664b7)[_0x5f54('0xc')](function(_0x4bf76e){logger[_0x5f54('0xd')](_0x5f54('0xe'),_0x2d7a9d,_0x5f54('0xf'));logger['debug'](_0x5f54('0x10'),_0x2d7a9d,_0x5f54('0xf'),JSON[_0x5f54('0x11')](_0x4bf76e));if(_0x4bf76e[_0x5f54('0x12')]){if(_0x4bf76e['error']['code']===0x1f4){logger[_0x5f54('0x12')](_0x5f54('0xe'),_0x2d7a9d,_0x4bf76e[_0x5f54('0x12')]['message']);return _0x4b1a44(_0x4bf76e[_0x5f54('0x12')][_0x5f54('0x13')]);}logger[_0x5f54('0x12')](_0x5f54('0xe'),_0x2d7a9d,_0x4bf76e[_0x5f54('0x12')][_0x5f54('0x13')]);return _0x2f9d4e(_0x4bf76e['error']['message']);}else{logger[_0x5f54('0xd')](_0x5f54('0xe'),_0x2d7a9d,_0x5f54('0xf'));_0x2f9d4e(_0x4bf76e[_0x5f54('0x14')]['message']);}})['catch'](function(_0x1cb60f){logger[_0x5f54('0x12')](_0x5f54('0xe'),_0x2d7a9d,_0x1cb60f);_0x4b1a44(_0x1cb60f);});});}exports['CreateFaxQueueReport']=function(_0x5d2acf){var _0x3a0860=this;return new Promise(function(_0x465b32,_0x1f0fae){return db[_0x5f54('0x15')][_0x5f54('0x16')](_0x5d2acf[_0x5f54('0x17')],{'raw':_0x5d2acf[_0x5f54('0x18')]?_0x5d2acf['options'][_0x5f54('0x19')]===undefined?!![]:![]:!![]})[_0x5f54('0xc')](function(_0x4832c1){logger[_0x5f54('0xd')](_0x5f54('0x1a'),_0x5d2acf);logger[_0x5f54('0x1b')](_0x5f54('0x1a'),_0x5d2acf,JSON[_0x5f54('0x11')](_0x4832c1));_0x465b32(_0x4832c1);})[_0x5f54('0x1c')](function(_0x181f48){logger['error']('CreateFaxQueueReport',_0x181f48[_0x5f54('0x13')],_0x5d2acf);_0x1f0fae(_0x3a0860['error'](0x1f4,_0x181f48['message']));});});};exports[_0x5f54('0x1d')]=function(_0xe7eb27){var _0x7ef31a=this;return new Promise(function(_0xb320c,_0x13e09e){return db['FaxQueueReport']['update'](_0xe7eb27[_0x5f54('0x17')],{'raw':_0xe7eb27['options']?_0xe7eb27[_0x5f54('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe7eb27[_0x5f54('0x18')]?_0xe7eb27[_0x5f54('0x18')][_0x5f54('0x1e')]||null:null,'attributes':_0xe7eb27[_0x5f54('0x18')]?_0xe7eb27['options'][_0x5f54('0x1f')]||null:null,'limit':_0xe7eb27[_0x5f54('0x18')]?_0xe7eb27['options'][_0x5f54('0x20')]||null:null})[_0x5f54('0xc')](function(_0x49e8c4){logger['info'](_0x5f54('0x1d'),_0xe7eb27);logger[_0x5f54('0x1b')](_0x5f54('0x1d'),_0xe7eb27,JSON['stringify'](_0x49e8c4));_0xb320c(_0x49e8c4);})[_0x5f54('0x1c')](function(_0x4a6568){logger[_0x5f54('0x12')](_0x5f54('0x1d'),_0x4a6568[_0x5f54('0x13')],_0xe7eb27);_0x13e09e(_0x7ef31a['error'](0x1f4,_0x4a6568[_0x5f54('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 7e34e45..cc4ddc2 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 _0xb069=['multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','create','update','delete','destroy','exports'];(function(_0x55e91c,_0x1a3c4b){var _0x4fa18e=function(_0x33d335){while(--_0x33d335){_0x55e91c['push'](_0x55e91c['shift']());}};_0x4fa18e(++_0x1a3c4b);}(_0xb069,0x132));var _0x9b06=function(_0x233d26,_0x337f42){_0x233d26=_0x233d26-0x0;var _0x3bb33d=_0xb069[_0x233d26];return _0x3bb33d;};'use strict';var multer=require(_0x9b06('0x0'));var util=require(_0x9b06('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9b06('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9b06('0x3'));var interaction=require(_0x9b06('0x4'));var config=require(_0x9b06('0x5'));var controller=require(_0x9b06('0x6'));router['get']('/',auth[_0x9b06('0x7')](),controller[_0x9b06('0x8')]);router[_0x9b06('0x9')]('/describe',auth[_0x9b06('0x7')](),controller[_0x9b06('0xa')]);router[_0x9b06('0x9')](_0x9b06('0xb'),auth[_0x9b06('0x7')](),controller[_0x9b06('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9b06('0xd')]);router['put'](_0x9b06('0xb'),auth['isAuthenticated'](),controller[_0x9b06('0xe')]);router[_0x9b06('0xf')]('/:id',auth[_0x9b06('0x7')](),controller[_0x9b06('0x10')]);module[_0x9b06('0x11')]=router; \ No newline at end of file +var _0x9698=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','/describe','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9698,0x156));var _0x8969=function(_0x5e3b6b,_0x2ff7d9){_0x5e3b6b=_0x5e3b6b-0x0;var _0x5414a7=_0x9698[_0x5e3b6b];return _0x5414a7;};'use strict';var multer=require(_0x8969('0x0'));var util=require(_0x8969('0x1'));var path=require(_0x8969('0x2'));var timeout=require(_0x8969('0x3'));var express=require(_0x8969('0x4'));var router=express[_0x8969('0x5')]();var fs_extra=require(_0x8969('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8969('0x7'));var config=require(_0x8969('0x8'));var controller=require(_0x8969('0x9'));router['get']('/',auth[_0x8969('0xa')](),controller['index']);router[_0x8969('0xb')](_0x8969('0xc'),auth[_0x8969('0xa')](),controller['describe']);router[_0x8969('0xb')]('/:id',auth[_0x8969('0xa')](),controller['show']);router[_0x8969('0xd')]('/',auth[_0x8969('0xa')](),controller[_0x8969('0xe')]);router[_0x8969('0xf')]('/:id',auth[_0x8969('0xa')](),controller[_0x8969('0x10')]);router[_0x8969('0x11')](_0x8969('0x12'),auth['isAuthenticated'](),controller[_0x8969('0x13')]);module[_0x8969('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 290c083..c33f2ba 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0x008c,0x188));var _0xc008=function(_0x645adc,_0x23ab56){_0x645adc=_0x645adc-0x0;var _0x253557=_0x008c[_0x645adc];return _0x253557;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0xb3506d,_0x538bb5){var _0xa39f18=function(_0x5c3200){while(--_0x5c3200){_0xb3506d['push'](_0xb3506d['shift']());}};_0xa39f18(++_0x538bb5);}(_0xedd9,0xfc));var _0x9edd=function(_0x20d536,_0x467185){_0x20d536=_0x20d536-0x0;var _0x37c3a6=_0xedd9[_0x20d536];return _0x37c3a6;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index cc164be..d00f300 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 _0x1abc=['VIRTUAL','options','includeAll','catch','show','params','rawAttributes','keys','include','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2eac07,_0x336a6a){var _0xbbc288=function(_0x1f6839){while(--_0x1f6839){_0x2eac07['push'](_0x2eac07['shift']());}};_0xbbc288(++_0x336a6a);}(_0x1abc,0x1ee));var _0xc1ab=function(_0x38b602,_0x57ccd5){_0x38b602=_0x38b602-0x0;var _0x310d16=_0x1abc[_0x38b602];return _0x310d16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1ab('0x0'));var zipdir=require(_0xc1ab('0x1'));var jsonpatch=require(_0xc1ab('0x2'));var rp=require(_0xc1ab('0x3'));var moment=require(_0xc1ab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1ab('0x5'));var util=require(_0xc1ab('0x6'));var path=require(_0xc1ab('0x7'));var sox=require(_0xc1ab('0x8'));var csv=require(_0xc1ab('0x9'));var ejs=require(_0xc1ab('0xa'));var fs=require('fs');var fs_extra=require(_0xc1ab('0xb'));var _=require(_0xc1ab('0xc'));var squel=require('squel');var crypto=require(_0xc1ab('0xd'));var jsforce=require(_0xc1ab('0xe'));var deskjs=require(_0xc1ab('0xf'));var toCsv=require(_0xc1ab('0x9'));var querystring=require(_0xc1ab('0x10'));var Papa=require(_0xc1ab('0x11'));var Redis=require(_0xc1ab('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc1ab('0x13'));var as=require(_0xc1ab('0x14'));var hardwareService=require(_0xc1ab('0x15'));var logger=require(_0xc1ab('0x16'))(_0xc1ab('0x17'));var utils=require(_0xc1ab('0x18'));var config=require(_0xc1ab('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1ab('0x1a'))['db'];function respondWithStatusCode(_0x5b4058,_0x326407){_0x326407=_0x326407||0xcc;return function(_0x45886e){if(_0x45886e){return _0x5b4058[_0xc1ab('0x1b')](_0x326407);}return _0x5b4058['status'](_0x326407)[_0xc1ab('0x1c')]();};}function respondWithResult(_0x1fb78b,_0x13510e){_0x13510e=_0x13510e||0xc8;return function(_0xb5f94a){if(_0xb5f94a){return _0x1fb78b[_0xc1ab('0x1d')](_0x13510e)[_0xc1ab('0x1e')](_0xb5f94a);}};}function respondWithFilteredResult(_0x2467c0,_0x5f5238){return function(_0x2b05fa){if(_0x2b05fa){var _0x3eb39c=typeof _0x5f5238[_0xc1ab('0x1f')]===_0xc1ab('0x20')&&typeof _0x5f5238[_0xc1ab('0x21')]==='undefined';var _0x3b4716=_0x2b05fa[_0xc1ab('0x22')];var _0x5c5157=_0x3eb39c?0x0:_0x5f5238['offset'];var _0x16e58b=_0x3eb39c?_0x2b05fa['count']:_0x5f5238[_0xc1ab('0x1f')]+_0x5f5238[_0xc1ab('0x21')];var _0x3ee830;if(_0x16e58b>=_0x3b4716){_0x16e58b=_0x3b4716;_0x3ee830=0xc8;}else{_0x3ee830=0xce;}_0x2467c0[_0xc1ab('0x1d')](_0x3ee830);return _0x2467c0[_0xc1ab('0x23')](_0xc1ab('0x24'),_0x5c5157+'-'+_0x16e58b+'/'+_0x3b4716)[_0xc1ab('0x1e')](_0x2b05fa);}return null;};}function patchUpdates(_0x5cb423){return function(_0x372179){try{jsonpatch[_0xc1ab('0x25')](_0x372179,_0x5cb423,!![]);}catch(_0x318f6e){return BPromise[_0xc1ab('0x26')](_0x318f6e);}return _0x372179['save']();};}function saveUpdates(_0x29f8fb,_0x538f6c){return function(_0x5c30ae){if(_0x5c30ae){return _0x5c30ae[_0xc1ab('0x27')](_0x29f8fb)[_0xc1ab('0x28')](function(_0x55720b){return _0x55720b;});}return null;};}function removeEntity(_0x525e52,_0x12dea6){return function(_0x33eb8d){if(_0x33eb8d){return _0x33eb8d['destroy']()['then'](function(){_0x525e52[_0xc1ab('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe17f6b,_0xece0a8){return function(_0x4c6fe3){if(!_0x4c6fe3){_0xe17f6b[_0xc1ab('0x1b')](0x194);}return _0x4c6fe3;};}function handleError(_0x3f1081,_0x10df82){_0x10df82=_0x10df82||0x1f4;return function(_0x4c9a5e){logger[_0xc1ab('0x29')](_0x4c9a5e[_0xc1ab('0x2a')]);if(_0x4c9a5e[_0xc1ab('0x2b')]){delete _0x4c9a5e[_0xc1ab('0x2b')];}_0x3f1081[_0xc1ab('0x1d')](_0x10df82)[_0xc1ab('0x2c')](_0x4c9a5e);};}exports[_0xc1ab('0x2d')]=function(_0x125e75,_0x5f4287){var _0x3d7dbc={},_0x557e5e={},_0x9f5928={'count':0x0,'rows':[]};var _0x1d8ce9=_[_0xc1ab('0x2e')](db[_0xc1ab('0x2f')]['rawAttributes'],function(_0x3285ac){return{'name':_0x3285ac[_0xc1ab('0x30')],'type':_0x3285ac[_0xc1ab('0x31')][_0xc1ab('0x32')]};});_0x557e5e[_0xc1ab('0x33')]=_[_0xc1ab('0x2e')](_0x1d8ce9,_0xc1ab('0x2b'));_0x557e5e[_0xc1ab('0x34')]=_['keys'](_0x125e75['query']);_0x557e5e[_0xc1ab('0x35')]=_[_0xc1ab('0x36')](_0x557e5e['model'],_0x557e5e[_0xc1ab('0x34')]);_0x3d7dbc['attributes']=_[_0xc1ab('0x36')](_0x557e5e[_0xc1ab('0x33')],qs[_0xc1ab('0x37')](_0x125e75[_0xc1ab('0x34')]['fields']));_0x3d7dbc[_0xc1ab('0x38')]=_0x3d7dbc[_0xc1ab('0x38')][_0xc1ab('0x39')]?_0x3d7dbc[_0xc1ab('0x38')]:_0x557e5e[_0xc1ab('0x33')];if(!_0x125e75[_0xc1ab('0x34')][_0xc1ab('0x3a')](_0xc1ab('0x3b'))){_0x3d7dbc[_0xc1ab('0x21')]=qs['limit'](_0x125e75['query'][_0xc1ab('0x21')]);_0x3d7dbc[_0xc1ab('0x1f')]=qs[_0xc1ab('0x1f')](_0x125e75['query'][_0xc1ab('0x1f')]);}_0x3d7dbc[_0xc1ab('0x3c')]=qs[_0xc1ab('0x3d')](_0x125e75[_0xc1ab('0x34')][_0xc1ab('0x3d')]);_0x3d7dbc[_0xc1ab('0x3e')]=qs[_0xc1ab('0x35')](_[_0xc1ab('0x3f')](_0x125e75[_0xc1ab('0x34')],_0x557e5e['filters']),_0x1d8ce9);if(_0x125e75['query'][_0xc1ab('0x40')]){_0x3d7dbc['where']=_[_0xc1ab('0x41')](_0x3d7dbc[_0xc1ab('0x3e')],{'$or':_[_0xc1ab('0x2e')](_0x1d8ce9,function(_0x109ff5){if(_0x109ff5[_0xc1ab('0x31')]!==_0xc1ab('0x42')){var _0x2a31e4={};_0x2a31e4[_0x109ff5['name']]={'$like':'%'+_0x125e75[_0xc1ab('0x34')][_0xc1ab('0x40')]+'%'};return _0x2a31e4;}})});}_0x3d7dbc=_['merge']({},_0x3d7dbc,_0x125e75[_0xc1ab('0x43')]);var _0xc3aa75={'where':_0x3d7dbc[_0xc1ab('0x3e')]};return db[_0xc1ab('0x2f')]['count'](_0xc3aa75)[_0xc1ab('0x28')](function(_0x27ea12){_0x9f5928['count']=_0x27ea12;if(_0x125e75['query'][_0xc1ab('0x44')]){_0x3d7dbc['include']=[{'all':!![]}];}return db[_0xc1ab('0x2f')]['findAll'](_0x3d7dbc);})[_0xc1ab('0x28')](function(_0x33218a){_0x9f5928['rows']=_0x33218a;return _0x9f5928;})[_0xc1ab('0x28')](respondWithFilteredResult(_0x5f4287,_0x3d7dbc))[_0xc1ab('0x45')](handleError(_0x5f4287,null));};exports[_0xc1ab('0x46')]=function(_0x2349e3,_0x51c80b){var _0x1d01e2={'raw':!![],'where':{'id':_0x2349e3[_0xc1ab('0x47')]['id']}},_0x59fd74={};_0x59fd74[_0xc1ab('0x33')]=_['keys'](db[_0xc1ab('0x2f')][_0xc1ab('0x48')]);_0x59fd74[_0xc1ab('0x34')]=_[_0xc1ab('0x49')](_0x2349e3['query']);_0x59fd74['filters']=_[_0xc1ab('0x36')](_0x59fd74[_0xc1ab('0x33')],_0x59fd74[_0xc1ab('0x34')]);_0x1d01e2[_0xc1ab('0x38')]=_[_0xc1ab('0x36')](_0x59fd74[_0xc1ab('0x33')],qs[_0xc1ab('0x37')](_0x2349e3['query']['fields']));_0x1d01e2[_0xc1ab('0x38')]=_0x1d01e2['attributes'][_0xc1ab('0x39')]?_0x1d01e2[_0xc1ab('0x38')]:_0x59fd74[_0xc1ab('0x33')];if(_0x2349e3['query'][_0xc1ab('0x44')]){_0x1d01e2[_0xc1ab('0x4a')]=[{'all':!![]}];}_0x1d01e2=_[_0xc1ab('0x41')]({},_0x1d01e2,_0x2349e3['options']);return db['FaxTransferReport'][_0xc1ab('0x4b')](_0x1d01e2)['then'](handleEntityNotFound(_0x51c80b,null))[_0xc1ab('0x28')](respondWithResult(_0x51c80b,null))[_0xc1ab('0x45')](handleError(_0x51c80b,null));};exports[_0xc1ab('0x4c')]=function(_0x1c8312,_0x54bc41){return db[_0xc1ab('0x2f')]['create'](_0x1c8312[_0xc1ab('0x4d')],{})[_0xc1ab('0x28')](respondWithResult(_0x54bc41,0xc9))['catch'](handleError(_0x54bc41,null));};exports[_0xc1ab('0x27')]=function(_0x38330d,_0x2b7757){if(_0x38330d[_0xc1ab('0x4d')]['id']){delete _0x38330d['body']['id'];}return db[_0xc1ab('0x2f')][_0xc1ab('0x4b')]({'where':{'id':_0x38330d['params']['id']}})[_0xc1ab('0x28')](handleEntityNotFound(_0x2b7757,null))[_0xc1ab('0x28')](saveUpdates(_0x38330d[_0xc1ab('0x4d')],null))[_0xc1ab('0x28')](respondWithResult(_0x2b7757,null))[_0xc1ab('0x45')](handleError(_0x2b7757,null));};exports[_0xc1ab('0x4e')]=function(_0x499f96,_0x32097b){return db[_0xc1ab('0x2f')][_0xc1ab('0x4b')]({'where':{'id':_0x499f96['params']['id']}})[_0xc1ab('0x28')](handleEntityNotFound(_0x32097b,null))[_0xc1ab('0x28')](removeEntity(_0x32097b,null))[_0xc1ab('0x45')](handleError(_0x32097b,null));};exports[_0xc1ab('0x4f')]=function(_0x1c6508,_0x29c7df){return db[_0xc1ab('0x2f')]['describe']()[_0xc1ab('0x28')](respondWithResult(_0x29c7df,null))[_0xc1ab('0x45')](handleError(_0x29c7df,null));}; \ No newline at end of file +var _0xdaf3=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','FaxTransferReport','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xdaf3,0x169));var _0x3daf=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xdaf3[_0x433a86];return _0x23000c;};'use strict';var emlformat=require(_0x3daf('0x0'));var rimraf=require(_0x3daf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3daf('0x2'));var rp=require(_0x3daf('0x3'));var moment=require(_0x3daf('0x4'));var BPromise=require(_0x3daf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3daf('0x6'));var csv=require(_0x3daf('0x7'));var ejs=require(_0x3daf('0x8'));var fs=require('fs');var fs_extra=require(_0x3daf('0x9'));var _=require(_0x3daf('0xa'));var squel=require(_0x3daf('0xb'));var crypto=require('crypto');var jsforce=require(_0x3daf('0xc'));var deskjs=require(_0x3daf('0xd'));var toCsv=require(_0x3daf('0x7'));var querystring=require(_0x3daf('0xe'));var Papa=require(_0x3daf('0xf'));var Redis=require(_0x3daf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3daf('0x11'));var as=require(_0x3daf('0x12'));var hardwareService=require(_0x3daf('0x13'));var logger=require(_0x3daf('0x14'))(_0x3daf('0x15'));var utils=require(_0x3daf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3daf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39e584,_0x182557){_0x182557=_0x182557||0xcc;return function(_0x19343b){if(_0x19343b){return _0x39e584['sendStatus'](_0x182557);}return _0x39e584[_0x3daf('0x18')](_0x182557)[_0x3daf('0x19')]();};}function respondWithResult(_0x55a167,_0x363d9e){_0x363d9e=_0x363d9e||0xc8;return function(_0x3593eb){if(_0x3593eb){return _0x55a167[_0x3daf('0x18')](_0x363d9e)['json'](_0x3593eb);}};}function respondWithFilteredResult(_0x1cf973,_0x5d2928){return function(_0x4edfe7){if(_0x4edfe7){var _0x25e8f7=typeof _0x5d2928[_0x3daf('0x1a')]===_0x3daf('0x1b')&&typeof _0x5d2928['limit']===_0x3daf('0x1b');var _0x228cc8=_0x4edfe7[_0x3daf('0x1c')];var _0x2a1809=_0x25e8f7?0x0:_0x5d2928['offset'];var _0x292716=_0x25e8f7?_0x4edfe7[_0x3daf('0x1c')]:_0x5d2928[_0x3daf('0x1a')]+_0x5d2928[_0x3daf('0x1d')];var _0x3a2fac;if(_0x292716>=_0x228cc8){_0x292716=_0x228cc8;_0x3a2fac=0xc8;}else{_0x3a2fac=0xce;}_0x1cf973[_0x3daf('0x18')](_0x3a2fac);return _0x1cf973[_0x3daf('0x1e')](_0x3daf('0x1f'),_0x2a1809+'-'+_0x292716+'/'+_0x228cc8)[_0x3daf('0x20')](_0x4edfe7);}return null;};}function patchUpdates(_0x31a186){return function(_0x4a6efa){try{jsonpatch[_0x3daf('0x21')](_0x4a6efa,_0x31a186,!![]);}catch(_0xdc7812){return BPromise[_0x3daf('0x22')](_0xdc7812);}return _0x4a6efa[_0x3daf('0x23')]();};}function saveUpdates(_0x45dd67,_0x5e470f){return function(_0x290469){if(_0x290469){return _0x290469[_0x3daf('0x24')](_0x45dd67)['then'](function(_0x2c87f1){return _0x2c87f1;});}return null;};}function removeEntity(_0x41da95,_0x40afe3){return function(_0x2f4d5e){if(_0x2f4d5e){return _0x2f4d5e['destroy']()[_0x3daf('0x25')](function(){_0x41da95[_0x3daf('0x18')](0xcc)[_0x3daf('0x19')]();});}};}function handleEntityNotFound(_0x5a3d85,_0xff9a76){return function(_0x5c3a49){if(!_0x5c3a49){_0x5a3d85[_0x3daf('0x26')](0x194);}return _0x5c3a49;};}function handleError(_0x57b1a7,_0x3e8d81){_0x3e8d81=_0x3e8d81||0x1f4;return function(_0x3a61c4){logger[_0x3daf('0x27')](_0x3a61c4[_0x3daf('0x28')]);if(_0x3a61c4[_0x3daf('0x29')]){delete _0x3a61c4[_0x3daf('0x29')];}_0x57b1a7[_0x3daf('0x18')](_0x3e8d81)['send'](_0x3a61c4);};}exports[_0x3daf('0x2a')]=function(_0x28b3ec,_0x5235cb){var _0x5f39ea={},_0x9334ae={},_0x4035b1={'count':0x0,'rows':[]};var _0x407d3b=_['map'](db['FaxTransferReport'][_0x3daf('0x2b')],function(_0x57168c){return{'name':_0x57168c[_0x3daf('0x2c')],'type':_0x57168c[_0x3daf('0x2d')]['key']};});_0x9334ae['model']=_[_0x3daf('0x2e')](_0x407d3b,'name');_0x9334ae[_0x3daf('0x2f')]=_[_0x3daf('0x30')](_0x28b3ec['query']);_0x9334ae[_0x3daf('0x31')]=_['intersection'](_0x9334ae[_0x3daf('0x32')],_0x9334ae[_0x3daf('0x2f')]);_0x5f39ea['attributes']=_[_0x3daf('0x33')](_0x9334ae[_0x3daf('0x32')],qs[_0x3daf('0x34')](_0x28b3ec[_0x3daf('0x2f')][_0x3daf('0x34')]));_0x5f39ea[_0x3daf('0x35')]=_0x5f39ea['attributes'][_0x3daf('0x36')]?_0x5f39ea[_0x3daf('0x35')]:_0x9334ae['model'];if(!_0x28b3ec[_0x3daf('0x2f')][_0x3daf('0x37')]('nolimit')){_0x5f39ea['limit']=qs[_0x3daf('0x1d')](_0x28b3ec[_0x3daf('0x2f')][_0x3daf('0x1d')]);_0x5f39ea[_0x3daf('0x1a')]=qs[_0x3daf('0x1a')](_0x28b3ec['query'][_0x3daf('0x1a')]);}_0x5f39ea['order']=qs['sort'](_0x28b3ec['query']['sort']);_0x5f39ea['where']=qs[_0x3daf('0x31')](_['pick'](_0x28b3ec['query'],_0x9334ae['filters']),_0x407d3b);if(_0x28b3ec['query'][_0x3daf('0x38')]){_0x5f39ea[_0x3daf('0x39')]=_['merge'](_0x5f39ea[_0x3daf('0x39')],{'$or':_[_0x3daf('0x2e')](_0x407d3b,function(_0x2b0e0e){if(_0x2b0e0e[_0x3daf('0x2d')]!==_0x3daf('0x3a')){var _0x182169={};_0x182169[_0x2b0e0e['name']]={'$like':'%'+_0x28b3ec[_0x3daf('0x2f')][_0x3daf('0x38')]+'%'};return _0x182169;}})});}_0x5f39ea=_[_0x3daf('0x3b')]({},_0x5f39ea,_0x28b3ec['options']);var _0x489591={'where':_0x5f39ea[_0x3daf('0x39')]};return db['FaxTransferReport'][_0x3daf('0x1c')](_0x489591)[_0x3daf('0x25')](function(_0x4b7bbd){_0x4035b1[_0x3daf('0x1c')]=_0x4b7bbd;if(_0x28b3ec['query'][_0x3daf('0x3c')]){_0x5f39ea[_0x3daf('0x3d')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x3daf('0x3e')](_0x5f39ea);})[_0x3daf('0x25')](function(_0x5b7ea3){_0x4035b1[_0x3daf('0x3f')]=_0x5b7ea3;return _0x4035b1;})[_0x3daf('0x25')](respondWithFilteredResult(_0x5235cb,_0x5f39ea))[_0x3daf('0x40')](handleError(_0x5235cb,null));};exports[_0x3daf('0x41')]=function(_0x144f88,_0x2768d2){var _0x4e1827={'raw':!![],'where':{'id':_0x144f88[_0x3daf('0x42')]['id']}},_0x50d471={};_0x50d471[_0x3daf('0x32')]=_[_0x3daf('0x30')](db['FaxTransferReport'][_0x3daf('0x2b')]);_0x50d471[_0x3daf('0x2f')]=_[_0x3daf('0x30')](_0x144f88[_0x3daf('0x2f')]);_0x50d471['filters']=_[_0x3daf('0x33')](_0x50d471[_0x3daf('0x32')],_0x50d471['query']);_0x4e1827[_0x3daf('0x35')]=_[_0x3daf('0x33')](_0x50d471[_0x3daf('0x32')],qs[_0x3daf('0x34')](_0x144f88[_0x3daf('0x2f')][_0x3daf('0x34')]));_0x4e1827[_0x3daf('0x35')]=_0x4e1827['attributes'][_0x3daf('0x36')]?_0x4e1827['attributes']:_0x50d471[_0x3daf('0x32')];if(_0x144f88[_0x3daf('0x2f')][_0x3daf('0x3c')]){_0x4e1827[_0x3daf('0x3d')]=[{'all':!![]}];}_0x4e1827=_[_0x3daf('0x3b')]({},_0x4e1827,_0x144f88[_0x3daf('0x43')]);return db[_0x3daf('0x44')][_0x3daf('0x45')](_0x4e1827)['then'](handleEntityNotFound(_0x2768d2,null))['then'](respondWithResult(_0x2768d2,null))['catch'](handleError(_0x2768d2,null));};exports[_0x3daf('0x46')]=function(_0x30bf7b,_0x8a88d4){return db[_0x3daf('0x44')][_0x3daf('0x46')](_0x30bf7b[_0x3daf('0x47')],{})['then'](respondWithResult(_0x8a88d4,0xc9))[_0x3daf('0x40')](handleError(_0x8a88d4,null));};exports[_0x3daf('0x24')]=function(_0x1b682a,_0x2a547c){if(_0x1b682a['body']['id']){delete _0x1b682a[_0x3daf('0x47')]['id'];}return db[_0x3daf('0x44')][_0x3daf('0x45')]({'where':{'id':_0x1b682a[_0x3daf('0x42')]['id']}})[_0x3daf('0x25')](handleEntityNotFound(_0x2a547c,null))[_0x3daf('0x25')](saveUpdates(_0x1b682a[_0x3daf('0x47')],null))[_0x3daf('0x25')](respondWithResult(_0x2a547c,null))[_0x3daf('0x40')](handleError(_0x2a547c,null));};exports[_0x3daf('0x48')]=function(_0x30a84a,_0x178bb0){return db['FaxTransferReport']['find']({'where':{'id':_0x30a84a[_0x3daf('0x42')]['id']}})[_0x3daf('0x25')](handleEntityNotFound(_0x178bb0,null))['then'](removeEntity(_0x178bb0,null))[_0x3daf('0x40')](handleError(_0x178bb0,null));};exports[_0x3daf('0x49')]=function(_0xb253df,_0x379d14){return db['FaxTransferReport'][_0x3daf('0x49')]()[_0x3daf('0x25')](respondWithResult(_0x379d14,null))[_0x3daf('0x40')](handleError(_0x379d14,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ae762d9..ad6a6d8 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 _0x652d=['rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x652d,0x1a0));var _0xd652=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x652d[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0xd652('0x0'));var logger=require(_0xd652('0x1'))(_0xd652('0x2'));var moment=require(_0xd652('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd652('0x4'));var config=require(_0xd652('0x5'));var attributes=require(_0xd652('0x6'));module['exports']=function(_0x42b800,_0x3fa61c){return _0x42b800[_0xd652('0x7')](_0xd652('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xd652('0x9'),'fields':[_0xd652('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x762c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','report_fax_transfer','uniqueid','lodash','util'];(function(_0x447cc2,_0x276966){var _0x17c0ee=function(_0x162ac9){while(--_0x162ac9){_0x447cc2['push'](_0x447cc2['shift']());}};_0x17c0ee(++_0x276966);}(_0x762c,0x1d2));var _0xc762=function(_0x19a7be,_0x49f923){_0x19a7be=_0x19a7be-0x0;var _0x177c30=_0x762c[_0x19a7be];return _0x177c30;};'use strict';var _=require(_0xc762('0x0'));var util=require(_0xc762('0x1'));var logger=require(_0xc762('0x2'))(_0xc762('0x3'));var moment=require('moment');var BPromise=require(_0xc762('0x4'));var rp=require(_0xc762('0x5'));var fs=require('fs');var path=require(_0xc762('0x6'));var rimraf=require(_0xc762('0x7'));var config=require(_0xc762('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0xc762('0x9')]=function(_0x4e4f83,_0x1c8c1b){return _0x4e4f83['define']('FaxTransferReport',attributes,{'tableName':_0xc762('0xa'),'paranoid':![],'indexes':[{'name':_0xc762('0xb'),'fields':[_0xc762('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 00cc1d6..86372a5 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 _0x9def=['jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x9f4049,_0x430841){var _0x11d4e3=function(_0x375627){while(--_0x375627){_0x9f4049['push'](_0x9f4049['shift']());}};_0x11d4e3(++_0x430841);}(_0x9def,0x122));var _0xf9de=function(_0x31fa22,_0x58d5be){_0x31fa22=_0x31fa22-0x0;var _0x302c17=_0x9def[_0x31fa22];return _0x302c17;};'use strict';var _=require(_0xf9de('0x0'));var util=require(_0xf9de('0x1'));var moment=require('moment');var BPromise=require(_0xf9de('0x2'));var rs=require(_0xf9de('0x3'));var fs=require('fs');var Redis=require(_0xf9de('0x4'));var db=require(_0xf9de('0x5'))['db'];var utils=require(_0xf9de('0x6'));var logger=require(_0xf9de('0x7'))('rpc');var config=require(_0xf9de('0x8'));var jayson=require(_0xf9de('0x9'));var client=jayson[_0xf9de('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53f906,_0x1e4b5a,_0x3b490f){return new BPromise(function(_0x6ae2b6,_0x3da9c1){return client[_0xf9de('0xb')](_0x53f906,_0x3b490f)[_0xf9de('0xc')](function(_0x2e3b84){logger['info'](_0xf9de('0xd'),_0x1e4b5a,_0xf9de('0xe'));logger['debug'](_0xf9de('0xf'),_0x1e4b5a,_0xf9de('0xe'),JSON[_0xf9de('0x10')](_0x2e3b84));if(_0x2e3b84[_0xf9de('0x11')]){if(_0x2e3b84[_0xf9de('0x11')][_0xf9de('0x12')]===0x1f4){logger[_0xf9de('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x1e4b5a,_0x2e3b84['error']['message']);return _0x3da9c1(_0x2e3b84[_0xf9de('0x11')][_0xf9de('0x13')]);}logger[_0xf9de('0x11')](_0xf9de('0xd'),_0x1e4b5a,_0x2e3b84['error'][_0xf9de('0x13')]);return _0x6ae2b6(_0x2e3b84[_0xf9de('0x11')][_0xf9de('0x13')]);}else{logger[_0xf9de('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x1e4b5a,_0xf9de('0xe'));_0x6ae2b6(_0x2e3b84[_0xf9de('0x15')][_0xf9de('0x13')]);}})[_0xf9de('0x16')](function(_0x37f6a3){logger[_0xf9de('0x11')](_0xf9de('0xd'),_0x1e4b5a,_0x37f6a3);_0x3da9c1(_0x37f6a3);});});} \ No newline at end of file +var _0xf109=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x36c671,_0x35323f){var _0x15b833=function(_0x5d04fc){while(--_0x5d04fc){_0x36c671['push'](_0x36c671['shift']());}};_0x15b833(++_0x35323f);}(_0xf109,0x119));var _0x9f10=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf109[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x4'))['db'];var utils=require(_0x9f10('0x5'));var logger=require(_0x9f10('0x6'))(_0x9f10('0x7'));var config=require(_0x9f10('0x8'));var jayson=require(_0x9f10('0x9'));var client=jayson[_0x9f10('0xa')][_0x9f10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4793ed,_0x13dde0,_0x4ef636){return new BPromise(function(_0x2d89dd,_0xab5229){return client['request'](_0x4793ed,_0x4ef636)[_0x9f10('0xc')](function(_0x435fdc){logger[_0x9f10('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x13dde0,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x13dde0,_0x9f10('0xe'),JSON[_0x9f10('0x11')](_0x435fdc));if(_0x435fdc[_0x9f10('0x12')]){if(_0x435fdc[_0x9f10('0x12')]['code']===0x1f4){logger['error'](_0x9f10('0x13'),_0x13dde0,_0x435fdc[_0x9f10('0x12')][_0x9f10('0x14')]);return _0xab5229(_0x435fdc[_0x9f10('0x12')][_0x9f10('0x14')]);}logger['error'](_0x9f10('0x13'),_0x13dde0,_0x435fdc[_0x9f10('0x12')]['message']);return _0x2d89dd(_0x435fdc[_0x9f10('0x12')][_0x9f10('0x14')]);}else{logger['info'](_0x9f10('0x13'),_0x13dde0,_0x9f10('0xe'));_0x2d89dd(_0x435fdc[_0x9f10('0x15')][_0x9f10('0x14')]);}})['catch'](function(_0x4fbbe2){logger['error'](_0x9f10('0x13'),_0x13dde0,_0x4fbbe2);_0xab5229(_0x4fbbe2);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index df1b75f..521fbca 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 _0x7348=['/:id','show','post','create','update','delete','destroy','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe'];(function(_0x2154e7,_0x195446){var _0x462859=function(_0x295899){while(--_0x295899){_0x2154e7['push'](_0x2154e7['shift']());}};_0x462859(++_0x195446);}(_0x7348,0xb1));var _0x8734=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7348[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8734('0x0'));var express=require(_0x8734('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8734('0x2'));var interaction=require(_0x8734('0x3'));var config=require(_0x8734('0x4'));var controller=require(_0x8734('0x5'));router['get']('/',auth[_0x8734('0x6')](),controller[_0x8734('0x7')]);router[_0x8734('0x8')]('/describe',auth[_0x8734('0x6')](),controller[_0x8734('0x9')]);router['get'](_0x8734('0xa'),auth['isAuthenticated'](),controller[_0x8734('0xb')]);router[_0x8734('0xc')]('/',auth[_0x8734('0x6')](),controller[_0x8734('0xd')]);router['put'](_0x8734('0xa'),auth['isAuthenticated'](),controller[_0x8734('0xe')]);router[_0x8734('0xf')](_0x8734('0xa'),auth[_0x8734('0x6')](),controller[_0x8734('0x10')]);module['exports']=router; \ No newline at end of file +var _0xeec5=['update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xeec5,0x142));var _0x5eec=function(_0x5565d9,_0x56edac){_0x5565d9=_0x5565d9-0x0;var _0x2b4e90=_0xeec5[_0x5565d9];return _0x2b4e90;};'use strict';var multer=require(_0x5eec('0x0'));var util=require(_0x5eec('0x1'));var path=require(_0x5eec('0x2'));var timeout=require(_0x5eec('0x3'));var express=require(_0x5eec('0x4'));var router=express[_0x5eec('0x5')]();var fs_extra=require(_0x5eec('0x6'));var auth=require(_0x5eec('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5eec('0x8'));router[_0x5eec('0x9')]('/',auth[_0x5eec('0xa')](),controller[_0x5eec('0xb')]);router[_0x5eec('0x9')](_0x5eec('0xc'),auth[_0x5eec('0xa')](),controller[_0x5eec('0xd')]);router[_0x5eec('0x9')](_0x5eec('0xe'),auth[_0x5eec('0xa')](),controller[_0x5eec('0xf')]);router[_0x5eec('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5eec('0x11')](_0x5eec('0xe'),auth[_0x5eec('0xa')](),controller[_0x5eec('0x12')]);router[_0x5eec('0x13')](_0x5eec('0xe'),auth[_0x5eec('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index bb88df7..7a3f0d3 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 _0x4800=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','/:id','destroy','multer','util','Router','fs-extra'];(function(_0xa5ec03,_0x326231){var _0x3cf2b1=function(_0x361952){while(--_0x361952){_0xa5ec03['push'](_0xa5ec03['shift']());}};_0x3cf2b1(++_0x326231);}(_0x4800,0x1a0));var _0x0480=function(_0x26ba13,_0xe42f77){_0x26ba13=_0x26ba13-0x0;var _0x3fe15b=_0x4800[_0x26ba13];return _0x3fe15b;};'use strict';var multer=require(_0x0480('0x0'));var util=require(_0x0480('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0480('0x2')]();var fs_extra=require(_0x0480('0x3'));var auth=require(_0x0480('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0480('0x5'));var controller=require('./intDeskAccount.controller');router[_0x0480('0x6')]('/',auth[_0x0480('0x7')](),controller[_0x0480('0x8')]);router[_0x0480('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x0480('0x9')]);router[_0x0480('0x6')](_0x0480('0xa'),auth[_0x0480('0x7')](),controller[_0x0480('0xb')]);router[_0x0480('0x6')](_0x0480('0xc'),auth[_0x0480('0x7')](),controller[_0x0480('0xd')]);router[_0x0480('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x0480('0xa'),auth['isAuthenticated'](),controller[_0x0480('0xf')]);router[_0x0480('0x10')]('/:id',auth[_0x0480('0x7')](),controller[_0x0480('0x11')]);router['delete'](_0x0480('0x12'),auth[_0x0480('0x7')](),controller[_0x0480('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5434=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x5434,0x90));var _0x4543=function(_0x5ab46c,_0x47f156){_0x5ab46c=_0x5ab46c-0x0;var _0x24867f=_0x5434[_0x5ab46c];return _0x24867f;};'use strict';var multer=require(_0x4543('0x0'));var util=require(_0x4543('0x1'));var path=require(_0x4543('0x2'));var timeout=require(_0x4543('0x3'));var express=require(_0x4543('0x4'));var router=express[_0x4543('0x5')]();var fs_extra=require(_0x4543('0x6'));var auth=require(_0x4543('0x7'));var interaction=require(_0x4543('0x8'));var config=require(_0x4543('0x9'));var controller=require(_0x4543('0xa'));router[_0x4543('0xb')]('/',auth[_0x4543('0xc')](),controller[_0x4543('0xd')]);router['get'](_0x4543('0xe'),auth['isAuthenticated'](),controller[_0x4543('0xf')]);router[_0x4543('0xb')](_0x4543('0x10'),auth[_0x4543('0xc')](),controller['getConfigurations']);router[_0x4543('0xb')](_0x4543('0x11'),auth[_0x4543('0xc')](),controller['getFields']);router['post']('/',auth[_0x4543('0xc')](),controller[_0x4543('0x12')]);router[_0x4543('0x13')](_0x4543('0x10'),auth[_0x4543('0xc')](),controller[_0x4543('0x14')]);router[_0x4543('0x15')]('/:id',auth[_0x4543('0xc')](),controller[_0x4543('0x16')]);router[_0x4543('0x17')](_0x4543('0xe'),auth[_0x4543('0xc')](),controller[_0x4543('0x18')]);module[_0x4543('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 0871f37..1123c00 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 _0x1dfe=['sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x1dfe,0x84));var _0xe1df=function(_0x560157,_0x4ed2a2){_0x560157=_0x560157-0x0;var _0x5808ae=_0x1dfe[_0x560157];return _0x5808ae;};'use strict';var Sequelize=require(_0xe1df('0x0'));module[_0xe1df('0x1')]={'name':{'type':Sequelize[_0xe1df('0x2')]},'description':{'type':Sequelize[_0xe1df('0x2')]},'username':{'type':Sequelize[_0xe1df('0x2')]},'remoteUri':{'type':Sequelize[_0xe1df('0x2')]},'authType':{'type':Sequelize[_0xe1df('0x3')](_0xe1df('0x4')),'defaultValue':_0xe1df('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xe1df('0x2')]},'consumerSecret':{'type':Sequelize[_0xe1df('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xe1df('0x2')]},'serverUrl':{'type':Sequelize[_0xe1df('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe1df('0x5'),'newTab'),'defaultValue':_0xe1df('0x5')}}; \ No newline at end of file +var _0x671e=['integrationTab','STRING','ENUM','newTab'];(function(_0x42bd13,_0x2057a8){var _0x38cc96=function(_0x5d0035){while(--_0x5d0035){_0x42bd13['push'](_0x42bd13['shift']());}};_0x38cc96(++_0x2057a8);}(_0x671e,0x11d));var _0xe671=function(_0x1f03ea,_0x31633d){_0x1f03ea=_0x1f03ea-0x0;var _0x59c3e9=_0x671e[_0x1f03ea];return _0x59c3e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe671('0x0')]},'description':{'type':Sequelize[_0xe671('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xe671('0x1')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0xe671('0x0')]},'consumerKey':{'type':Sequelize[_0xe671('0x0')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe671('0x0')]},'tokenSecret':{'type':Sequelize[_0xe671('0x0')]},'serverUrl':{'type':Sequelize[_0xe671('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xe671('0x2')),'defaultValue':_0xe671('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 2a59b3c..47d169f 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 _0x072e=['fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','VIRTUAL','options','where','count','findAll','rows','catch','params','keys','rawAttributes','includeAll','include','create','body','find','getConfigurations','findOne','filter','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','password','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','username','toString','base64','_embedded','entries','test','stringify','statusCode','eml-format','rimraf','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','sendStatus','status','json','undefined','offset','limit','apply','save','update','then','destroy','error','stack','name','send','map','DeskAccount'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x072e,0xa8));var _0xe072=function(_0x5b4474,_0x5e5e9e){_0x5b4474=_0x5b4474-0x0;var _0x520728=_0x072e[_0x5b4474];return _0x520728;};'use strict';var emlformat=require(_0xe072('0x0'));var rimraf=require(_0xe072('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe072('0x2'));var BPromise=require(_0xe072('0x3'));var Mustache=require(_0xe072('0x4'));var util=require(_0xe072('0x5'));var path=require('path');var sox=require(_0xe072('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe072('0x7'));var _=require(_0xe072('0x8'));var squel=require(_0xe072('0x9'));var crypto=require(_0xe072('0xa'));var jsforce=require(_0xe072('0xb'));var deskjs=require(_0xe072('0xc'));var toCsv=require(_0xe072('0xd'));var querystring=require(_0xe072('0xe'));var Papa=require(_0xe072('0xf'));var Redis=require(_0xe072('0x10'));var authService=require(_0xe072('0x11'));var qs=require(_0xe072('0x12'));var as=require(_0xe072('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe072('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x51d16e,_0x3c85bb){_0x3c85bb=_0x3c85bb||0xcc;return function(_0x2eef77){if(_0x2eef77){return _0x51d16e[_0xe072('0x15')](_0x3c85bb);}return _0x51d16e['status'](_0x3c85bb)['end']();};}function respondWithResult(_0x1134c8,_0x538503){_0x538503=_0x538503||0xc8;return function(_0x22d27d){if(_0x22d27d){return _0x1134c8[_0xe072('0x16')](_0x538503)[_0xe072('0x17')](_0x22d27d);}};}function respondWithFilteredResult(_0x403d1d,_0x3fea65){return function(_0x462bee){if(_0x462bee){var _0x1313fd=typeof _0x3fea65['offset']===_0xe072('0x18')&&typeof _0x3fea65['limit']==='undefined';var _0x2e044c=_0x462bee['count'];var _0x45e059=_0x1313fd?0x0:_0x3fea65[_0xe072('0x19')];var _0x4aa136=_0x1313fd?_0x462bee['count']:_0x3fea65[_0xe072('0x19')]+_0x3fea65[_0xe072('0x1a')];var _0x459ff7;if(_0x4aa136>=_0x2e044c){_0x4aa136=_0x2e044c;_0x459ff7=0xc8;}else{_0x459ff7=0xce;}_0x403d1d['status'](_0x459ff7);return _0x403d1d['set']('Content-Range',_0x45e059+'-'+_0x4aa136+'/'+_0x2e044c)[_0xe072('0x17')](_0x462bee);}return null;};}function patchUpdates(_0x9ca8e4){return function(_0x50b92a){try{jsonpatch[_0xe072('0x1b')](_0x50b92a,_0x9ca8e4,!![]);}catch(_0x59c1a6){return BPromise['reject'](_0x59c1a6);}return _0x50b92a[_0xe072('0x1c')]();};}function saveUpdates(_0x33ef21,_0x5948aa){return function(_0x3b769b){if(_0x3b769b){return _0x3b769b[_0xe072('0x1d')](_0x33ef21)[_0xe072('0x1e')](function(_0x5cb5b1){return _0x5cb5b1;});}return null;};}function removeEntity(_0x123dba,_0x4afbf0){return function(_0x271345){if(_0x271345){return _0x271345[_0xe072('0x1f')]()[_0xe072('0x1e')](function(){_0x123dba[_0xe072('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f0904,_0x136d72){return function(_0xbc9250){if(!_0xbc9250){_0x3f0904['sendStatus'](0x194);}return _0xbc9250;};}function handleError(_0x41e250,_0x389b24){_0x389b24=_0x389b24||0x1f4;return function(_0x462a48){logger[_0xe072('0x20')](_0x462a48[_0xe072('0x21')]);if(_0x462a48[_0xe072('0x22')]){delete _0x462a48['name'];}_0x41e250['status'](_0x389b24)[_0xe072('0x23')](_0x462a48);};}exports['index']=function(_0x13cfa2,_0x38fce0){var _0x157ac5={},_0x365b9e={},_0x548ce9={'count':0x0,'rows':[]};var _0x22f089=_[_0xe072('0x24')](db[_0xe072('0x25')]['rawAttributes'],function(_0x4c3928){return{'name':_0x4c3928[_0xe072('0x26')],'type':_0x4c3928[_0xe072('0x27')][_0xe072('0x28')]};});_0x365b9e['model']=_['map'](_0x22f089,_0xe072('0x22'));_0x365b9e[_0xe072('0x29')]=_['keys'](_0x13cfa2['query']);_0x365b9e['filters']=_['intersection'](_0x365b9e[_0xe072('0x2a')],_0x365b9e[_0xe072('0x29')]);_0x157ac5[_0xe072('0x2b')]=_[_0xe072('0x2c')](_0x365b9e[_0xe072('0x2a')],qs[_0xe072('0x2d')](_0x13cfa2[_0xe072('0x29')][_0xe072('0x2d')]));_0x157ac5['attributes']=_0x157ac5[_0xe072('0x2b')][_0xe072('0x2e')]?_0x157ac5[_0xe072('0x2b')]:_0x365b9e['model'];if(!_0x13cfa2[_0xe072('0x29')][_0xe072('0x2f')](_0xe072('0x30'))){_0x157ac5[_0xe072('0x1a')]=qs['limit'](_0x13cfa2[_0xe072('0x29')][_0xe072('0x1a')]);_0x157ac5[_0xe072('0x19')]=qs['offset'](_0x13cfa2['query'][_0xe072('0x19')]);}_0x157ac5[_0xe072('0x31')]=qs[_0xe072('0x32')](_0x13cfa2[_0xe072('0x29')][_0xe072('0x32')]);_0x157ac5['where']=qs['filters'](_['pick'](_0x13cfa2[_0xe072('0x29')],_0x365b9e[_0xe072('0x33')]),_0x22f089);if(_0x13cfa2[_0xe072('0x29')]['filter']){_0x157ac5['where']=_[_0xe072('0x34')](_0x157ac5['where'],{'$or':_[_0xe072('0x24')](_0x22f089,function(_0x8094e1){if(_0x8094e1['type']!==_0xe072('0x35')){var _0x169eda={};_0x169eda[_0x8094e1['name']]={'$like':'%'+_0x13cfa2[_0xe072('0x29')]['filter']+'%'};return _0x169eda;}})});}_0x157ac5=_[_0xe072('0x34')]({},_0x157ac5,_0x13cfa2[_0xe072('0x36')]);var _0x5579d5={'where':_0x157ac5[_0xe072('0x37')]};return db[_0xe072('0x25')][_0xe072('0x38')](_0x5579d5)[_0xe072('0x1e')](function(_0x5bff78){_0x548ce9[_0xe072('0x38')]=_0x5bff78;if(_0x13cfa2[_0xe072('0x29')]['includeAll']){_0x157ac5['include']=[{'all':!![]}];}return db['DeskAccount'][_0xe072('0x39')](_0x157ac5);})[_0xe072('0x1e')](function(_0x5f2cb8){_0x548ce9[_0xe072('0x3a')]=_0x5f2cb8;return _0x548ce9;})[_0xe072('0x1e')](respondWithFilteredResult(_0x38fce0,_0x157ac5))[_0xe072('0x3b')](handleError(_0x38fce0,null));};exports['show']=function(_0x445b76,_0x33b79d){var _0x7abf94={'raw':![],'where':{'id':_0x445b76[_0xe072('0x3c')]['id']}},_0x241236={};_0x241236[_0xe072('0x2a')]=_[_0xe072('0x3d')](db[_0xe072('0x25')][_0xe072('0x3e')]);_0x241236[_0xe072('0x29')]=_[_0xe072('0x3d')](_0x445b76[_0xe072('0x29')]);_0x241236['filters']=_[_0xe072('0x2c')](_0x241236['model'],_0x241236[_0xe072('0x29')]);_0x7abf94[_0xe072('0x2b')]=_[_0xe072('0x2c')](_0x241236[_0xe072('0x2a')],qs[_0xe072('0x2d')](_0x445b76[_0xe072('0x29')]['fields']));_0x7abf94['attributes']=_0x7abf94[_0xe072('0x2b')][_0xe072('0x2e')]?_0x7abf94[_0xe072('0x2b')]:_0x241236['model'];if(_0x445b76[_0xe072('0x29')][_0xe072('0x3f')]){_0x7abf94[_0xe072('0x40')]=[{'all':!![]}];}_0x7abf94=_['merge']({},_0x7abf94,_0x445b76[_0xe072('0x36')]);return db['DeskAccount']['find'](_0x7abf94)[_0xe072('0x1e')](handleEntityNotFound(_0x33b79d,null))[_0xe072('0x1e')](respondWithResult(_0x33b79d,null))['catch'](handleError(_0x33b79d,null));};exports[_0xe072('0x41')]=function(_0x50794e,_0x2c745a){return db[_0xe072('0x25')][_0xe072('0x41')](_0x50794e[_0xe072('0x42')],{})['then'](respondWithResult(_0x2c745a,0xc9))[_0xe072('0x3b')](handleError(_0x2c745a,null));};exports['update']=function(_0x120802,_0x4c7022){if(_0x120802['body']['id']){delete _0x120802['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x120802[_0xe072('0x3c')]['id']}})[_0xe072('0x1e')](handleEntityNotFound(_0x4c7022,null))['then'](saveUpdates(_0x120802['body'],null))[_0xe072('0x1e')](respondWithResult(_0x4c7022,null))[_0xe072('0x3b')](handleError(_0x4c7022,null));};exports[_0xe072('0x1f')]=function(_0x4e73d3,_0x4a5d6b){return db[_0xe072('0x25')][_0xe072('0x43')]({'where':{'id':_0x4e73d3[_0xe072('0x3c')]['id']}})[_0xe072('0x1e')](handleEntityNotFound(_0x4a5d6b,null))['then'](removeEntity(_0x4a5d6b,null))[_0xe072('0x3b')](handleError(_0x4a5d6b,null));};exports[_0xe072('0x44')]=function(_0x38ade0,_0x5f6c8f,_0x2d1f7e){var _0x27d3ad={};var _0x4724f6={};var _0x1b28ec;var _0x3f805b;return db[_0xe072('0x25')][_0xe072('0x45')]({'where':{'id':_0x38ade0[_0xe072('0x3c')]['id']}})[_0xe072('0x1e')](handleEntityNotFound(_0x5f6c8f,null))[_0xe072('0x1e')](function(_0x16003e){if(_0x16003e){_0x1b28ec=_0x16003e;_0x4724f6[_0xe072('0x2a')]=_[_0xe072('0x3d')](db['DeskConfiguration'][_0xe072('0x3e')]);_0x4724f6[_0xe072('0x29')]=_[_0xe072('0x3d')](_0x38ade0[_0xe072('0x29')]);_0x4724f6['filters']=_[_0xe072('0x2c')](_0x4724f6[_0xe072('0x2a')],_0x4724f6[_0xe072('0x29')]);_0x27d3ad[_0xe072('0x2b')]=_[_0xe072('0x2c')](_0x4724f6[_0xe072('0x2a')],qs[_0xe072('0x2d')](_0x38ade0[_0xe072('0x29')][_0xe072('0x2d')]));_0x27d3ad['attributes']=_0x27d3ad[_0xe072('0x2b')]['length']?_0x27d3ad[_0xe072('0x2b')]:_0x4724f6[_0xe072('0x2a')];_0x27d3ad['order']=qs[_0xe072('0x32')](_0x38ade0[_0xe072('0x29')]['sort']);_0x27d3ad[_0xe072('0x37')]=qs['filters'](_['pick'](_0x38ade0['query'],_0x4724f6[_0xe072('0x33')]));if(_0x38ade0[_0xe072('0x29')][_0xe072('0x46')]){_0x27d3ad['where']=_[_0xe072('0x34')](_0x27d3ad['where'],{'$or':_[_0xe072('0x24')](_0x27d3ad[_0xe072('0x2b')],function(_0x52ed0f){var _0x2ab0a7={};_0x2ab0a7[_0x52ed0f]={'$like':'%'+_0x38ade0[_0xe072('0x29')]['filter']+'%'};return _0x2ab0a7;})});}_0x27d3ad=_[_0xe072('0x34')]({},_0x27d3ad,_0x38ade0[_0xe072('0x36')]);return _0x1b28ec[_0xe072('0x44')](_0x27d3ad);}})['then'](function(_0x4f2614){if(_0x4f2614){_0x3f805b=_0x4f2614['length'];if(!_0x38ade0[_0xe072('0x29')][_0xe072('0x2f')](_0xe072('0x30'))){_0x27d3ad[_0xe072('0x1a')]=qs[_0xe072('0x1a')](_0x38ade0[_0xe072('0x29')][_0xe072('0x1a')]);_0x27d3ad[_0xe072('0x19')]=qs[_0xe072('0x19')](_0x38ade0[_0xe072('0x29')][_0xe072('0x19')]);}return _0x1b28ec[_0xe072('0x44')](_0x27d3ad);}})[_0xe072('0x1e')](function(_0x4ff26b){if(_0x4ff26b){return _0x4ff26b?{'count':_0x3f805b,'rows':_0x4ff26b}:null;}})[_0xe072('0x1e')](respondWithResult(_0x5f6c8f,null))[_0xe072('0x3b')](handleError(_0x5f6c8f,null));};exports[_0xe072('0x47')]=function(_0x12a3d9,_0x52131a,_0x839e29){if(_0x12a3d9[_0xe072('0x42')]['id']){delete _0x12a3d9[_0xe072('0x42')]['id'];}return db[_0xe072('0x25')][_0xe072('0x45')]({'where':{'id':_0x12a3d9[_0xe072('0x3c')]['id']}})[_0xe072('0x1e')](handleEntityNotFound(_0x52131a,null))[_0xe072('0x1e')](function(_0x66826e){if(_0x66826e){_0x12a3d9['body'][_0xe072('0x48')]=_0x66826e['id'];_0x12a3d9[_0xe072('0x42')][_0xe072('0x49')]=integrations[_0xe072('0x4a')](_0x12a3d9[_0xe072('0x42')]['channel'],_0x12a3d9[_0xe072('0x42')]['type']);_0x12a3d9[_0xe072('0x42')][_0xe072('0x4b')]=integrations[_0xe072('0x4c')](_0x12a3d9[_0xe072('0x42')][_0xe072('0x4d')],_0x12a3d9[_0xe072('0x42')]['type']);return db['DeskConfiguration'][_0xe072('0x41')](_0x12a3d9[_0xe072('0x42')],{'include':[{'model':db['DeskField'],'as':_0xe072('0x49')},{'model':db[_0xe072('0x4e')],'as':_0xe072('0x4b')}]});}return null;})['then'](respondWithResult(_0x52131a,null))['catch'](handleError(_0x52131a,null));};exports[_0xe072('0x4f')]=function(_0x35c5ad,_0x4652b9,_0x563752){var _0x51bb96=[{'name':_0xe072('0x50'),'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 _0x28811d='';return db[_0xe072('0x25')][_0xe072('0x45')]({'where':{'id':_0x35c5ad['params']['id']},'attributes':['id',_0xe072('0x51'),'authType','username',_0xe072('0x52'),'consumerKey',_0xe072('0x53'),_0xe072('0x54'),_0xe072('0x55')]})[_0xe072('0x1e')](handleEntityNotFound(_0x4652b9,null))[_0xe072('0x1e')](function(_0x50b7d5){if(_0x50b7d5){_0x28811d=_0x50b7d5[_0xe072('0x51')];var _0x57d510=_0x28811d['slice'](-0x1);if(_0x57d510==='/'){_0x28811d=_0x28811d[_0xe072('0x56')](0x0,_0x28811d['lastIndexOf'](_0x57d510));}var _0x45fd89={'method':_0xe072('0x57'),'uri':util[_0xe072('0x58')](_0xe072('0x59'),_0x28811d),'headers':{'Content-Type':'application/json','Accept':_0xe072('0x5a')},'json':!![]};if(_0x50b7d5['authType']===_0xe072('0x5b')){_0x45fd89[_0xe072('0x5c')][_0xe072('0x5d')]=util[_0xe072('0x58')](_0xe072('0x5e'),new Buffer(util['format']('%s:%s',_0x50b7d5[_0xe072('0x5f')],_0x50b7d5[_0xe072('0x52')]))[_0xe072('0x60')](_0xe072('0x61')));}return rp(_0x45fd89)['then'](function(_0x574e13){return _0x51bb96['concat'](_[_0xe072('0x24')](_0x574e13[_0xe072('0x62')][_0xe072('0x63')],function(_0x371d1d){return{'id':_0x371d1d['name'],'name':_0x371d1d[_0xe072('0x22')],'type':_0x371d1d['type'],'active':_0x371d1d['active'],'label':_0x371d1d['label'],'custom':!![]};}));});}})[_0xe072('0x1e')](function(_0x7d306c){return{'count':_0x7d306c[_0xe072('0x2e')],'rows':_0x7d306c};})[_0xe072('0x1e')](respondWithResult(_0x4652b9,null))[_0xe072('0x3b')](function(_0x26514d){var _0x5c2f22=_0x35c5ad['query'][_0xe072('0x64')]?0x1f4:_0x26514d['statusCode']||0x1f4;logger[_0xe072('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0xe072('0x4f'),_0x5c2f22,JSON[_0xe072('0x65')](_0x26514d));delete _0x26514d[_0xe072('0x22')];if(_0x5c2f22===0x191){_0x5c2f22=0x190;}_0x4652b9[_0xe072('0x16')](_0x5c2f22)[_0xe072('0x23')](_0x35c5ad[_0xe072('0x29')][_0xe072('0x64')]?{'message':'Wrong\x20credentials','statusCode':_0x26514d[_0xe072('0x66')]}:_0x26514d);});}; \ No newline at end of file +var _0x9ee4=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','DeskConfiguration','order','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','label','test','statusCode','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query'];(function(_0x194fb4,_0x21be20){var _0x2b04b8=function(_0x4bd404){while(--_0x4bd404){_0x194fb4['push'](_0x194fb4['shift']());}};_0x2b04b8(++_0x21be20);}(_0x9ee4,0x197));var _0x49ee=function(_0x163272,_0x25e0e3){_0x163272=_0x163272-0x0;var _0x761bdd=_0x9ee4[_0x163272];return _0x761bdd;};'use strict';var emlformat=require(_0x49ee('0x0'));var rimraf=require(_0x49ee('0x1'));var zipdir=require(_0x49ee('0x2'));var jsonpatch=require(_0x49ee('0x3'));var rp=require(_0x49ee('0x4'));var moment=require(_0x49ee('0x5'));var BPromise=require(_0x49ee('0x6'));var Mustache=require(_0x49ee('0x7'));var util=require(_0x49ee('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x49ee('0x9'));var ejs=require(_0x49ee('0xa'));var fs=require('fs');var fs_extra=require(_0x49ee('0xb'));var _=require(_0x49ee('0xc'));var squel=require(_0x49ee('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x49ee('0x9'));var querystring=require(_0x49ee('0xe'));var Papa=require(_0x49ee('0xf'));var Redis=require(_0x49ee('0x10'));var authService=require(_0x49ee('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x49ee('0x12'));var hardwareService=require(_0x49ee('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x49ee('0x14'));var config=require(_0x49ee('0x15'));var licenseUtil=require(_0x49ee('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x49ee('0x17'));function respondWithStatusCode(_0xccef0d,_0x3552a9){_0x3552a9=_0x3552a9||0xcc;return function(_0x1924b5){if(_0x1924b5){return _0xccef0d[_0x49ee('0x18')](_0x3552a9);}return _0xccef0d['status'](_0x3552a9)[_0x49ee('0x19')]();};}function respondWithResult(_0x3bff47,_0x4cd1d4){_0x4cd1d4=_0x4cd1d4||0xc8;return function(_0x2ecacf){if(_0x2ecacf){return _0x3bff47['status'](_0x4cd1d4)['json'](_0x2ecacf);}};}function respondWithFilteredResult(_0x344e26,_0x2eba23){return function(_0x32ffd7){if(_0x32ffd7){var _0x5d957d=typeof _0x2eba23[_0x49ee('0x1a')]===_0x49ee('0x1b')&&typeof _0x2eba23[_0x49ee('0x1c')]===_0x49ee('0x1b');var _0x4b5ca7=_0x32ffd7[_0x49ee('0x1d')];var _0x102c45=_0x5d957d?0x0:_0x2eba23[_0x49ee('0x1a')];var _0x34906e=_0x5d957d?_0x32ffd7['count']:_0x2eba23[_0x49ee('0x1a')]+_0x2eba23[_0x49ee('0x1c')];var _0x7d5b97;if(_0x34906e>=_0x4b5ca7){_0x34906e=_0x4b5ca7;_0x7d5b97=0xc8;}else{_0x7d5b97=0xce;}_0x344e26[_0x49ee('0x1e')](_0x7d5b97);return _0x344e26[_0x49ee('0x1f')](_0x49ee('0x20'),_0x102c45+'-'+_0x34906e+'/'+_0x4b5ca7)['json'](_0x32ffd7);}return null;};}function patchUpdates(_0xfe55af){return function(_0x232ac3){try{jsonpatch[_0x49ee('0x21')](_0x232ac3,_0xfe55af,!![]);}catch(_0x350bf9){return BPromise[_0x49ee('0x22')](_0x350bf9);}return _0x232ac3[_0x49ee('0x23')]();};}function saveUpdates(_0x408e26,_0xe7d401){return function(_0x2a100f){if(_0x2a100f){return _0x2a100f[_0x49ee('0x24')](_0x408e26)[_0x49ee('0x25')](function(_0x5cb2ba){return _0x5cb2ba;});}return null;};}function removeEntity(_0x315ee9,_0x9f1846){return function(_0x5a2e14){if(_0x5a2e14){return _0x5a2e14[_0x49ee('0x26')]()[_0x49ee('0x25')](function(){_0x315ee9[_0x49ee('0x1e')](0xcc)[_0x49ee('0x19')]();});}};}function handleEntityNotFound(_0x41781d,_0x58012f){return function(_0x24808d){if(!_0x24808d){_0x41781d['sendStatus'](0x194);}return _0x24808d;};}function handleError(_0x470c11,_0x22c504){_0x22c504=_0x22c504||0x1f4;return function(_0x32ef24){logger['error'](_0x32ef24[_0x49ee('0x27')]);if(_0x32ef24[_0x49ee('0x28')]){delete _0x32ef24[_0x49ee('0x28')];}_0x470c11['status'](_0x22c504)[_0x49ee('0x29')](_0x32ef24);};}exports[_0x49ee('0x2a')]=function(_0x19bf4b,_0x2c261e){var _0x377ef5={},_0xf7fd8d={},_0x52ca1b={'count':0x0,'rows':[]};var _0x3fb95a=_[_0x49ee('0x2b')](db['DeskAccount'][_0x49ee('0x2c')],function(_0x1696f9){return{'name':_0x1696f9[_0x49ee('0x2d')],'type':_0x1696f9[_0x49ee('0x2e')]['key']};});_0xf7fd8d[_0x49ee('0x2f')]=_[_0x49ee('0x2b')](_0x3fb95a,'name');_0xf7fd8d[_0x49ee('0x30')]=_[_0x49ee('0x31')](_0x19bf4b[_0x49ee('0x30')]);_0xf7fd8d[_0x49ee('0x32')]=_['intersection'](_0xf7fd8d[_0x49ee('0x2f')],_0xf7fd8d[_0x49ee('0x30')]);_0x377ef5['attributes']=_[_0x49ee('0x33')](_0xf7fd8d[_0x49ee('0x2f')],qs['fields'](_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x34')]));_0x377ef5[_0x49ee('0x35')]=_0x377ef5[_0x49ee('0x35')][_0x49ee('0x36')]?_0x377ef5[_0x49ee('0x35')]:_0xf7fd8d['model'];if(!_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x37')](_0x49ee('0x38'))){_0x377ef5['limit']=qs[_0x49ee('0x1c')](_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x1c')]);_0x377ef5[_0x49ee('0x1a')]=qs['offset'](_0x19bf4b['query'][_0x49ee('0x1a')]);}_0x377ef5['order']=qs[_0x49ee('0x39')](_0x19bf4b['query'][_0x49ee('0x39')]);_0x377ef5[_0x49ee('0x3a')]=qs['filters'](_[_0x49ee('0x3b')](_0x19bf4b[_0x49ee('0x30')],_0xf7fd8d[_0x49ee('0x32')]),_0x3fb95a);if(_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x3c')]){_0x377ef5[_0x49ee('0x3a')]=_[_0x49ee('0x3d')](_0x377ef5[_0x49ee('0x3a')],{'$or':_[_0x49ee('0x2b')](_0x3fb95a,function(_0x509575){if(_0x509575[_0x49ee('0x2e')]!==_0x49ee('0x3e')){var _0x395dd5={};_0x395dd5[_0x509575['name']]={'$like':'%'+_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x3c')]+'%'};return _0x395dd5;}})});}_0x377ef5=_[_0x49ee('0x3d')]({},_0x377ef5,_0x19bf4b[_0x49ee('0x3f')]);var _0x25ea8d={'where':_0x377ef5['where']};return db[_0x49ee('0x40')]['count'](_0x25ea8d)[_0x49ee('0x25')](function(_0x54e514){_0x52ca1b[_0x49ee('0x1d')]=_0x54e514;if(_0x19bf4b[_0x49ee('0x30')][_0x49ee('0x41')]){_0x377ef5[_0x49ee('0x42')]=[{'all':!![]}];}return db[_0x49ee('0x40')]['findAll'](_0x377ef5);})[_0x49ee('0x25')](function(_0x58f81c){_0x52ca1b[_0x49ee('0x43')]=_0x58f81c;return _0x52ca1b;})[_0x49ee('0x25')](respondWithFilteredResult(_0x2c261e,_0x377ef5))[_0x49ee('0x44')](handleError(_0x2c261e,null));};exports[_0x49ee('0x45')]=function(_0x1f5de3,_0x153dfb){var _0x4e9497={'raw':![],'where':{'id':_0x1f5de3[_0x49ee('0x46')]['id']}},_0x559a84={};_0x559a84[_0x49ee('0x2f')]=_['keys'](db[_0x49ee('0x40')]['rawAttributes']);_0x559a84[_0x49ee('0x30')]=_['keys'](_0x1f5de3['query']);_0x559a84[_0x49ee('0x32')]=_[_0x49ee('0x33')](_0x559a84[_0x49ee('0x2f')],_0x559a84[_0x49ee('0x30')]);_0x4e9497[_0x49ee('0x35')]=_[_0x49ee('0x33')](_0x559a84[_0x49ee('0x2f')],qs[_0x49ee('0x34')](_0x1f5de3[_0x49ee('0x30')][_0x49ee('0x34')]));_0x4e9497[_0x49ee('0x35')]=_0x4e9497[_0x49ee('0x35')][_0x49ee('0x36')]?_0x4e9497[_0x49ee('0x35')]:_0x559a84[_0x49ee('0x2f')];if(_0x1f5de3[_0x49ee('0x30')]['includeAll']){_0x4e9497[_0x49ee('0x42')]=[{'all':!![]}];}_0x4e9497=_[_0x49ee('0x3d')]({},_0x4e9497,_0x1f5de3[_0x49ee('0x3f')]);return db[_0x49ee('0x40')][_0x49ee('0x47')](_0x4e9497)[_0x49ee('0x25')](handleEntityNotFound(_0x153dfb,null))[_0x49ee('0x25')](respondWithResult(_0x153dfb,null))[_0x49ee('0x44')](handleError(_0x153dfb,null));};exports['create']=function(_0x1faf06,_0x34758e){return db['DeskAccount'][_0x49ee('0x48')](_0x1faf06[_0x49ee('0x49')],{})[_0x49ee('0x25')](respondWithResult(_0x34758e,0xc9))[_0x49ee('0x44')](handleError(_0x34758e,null));};exports[_0x49ee('0x24')]=function(_0x49bf37,_0x36adb8){if(_0x49bf37[_0x49ee('0x49')]['id']){delete _0x49bf37['body']['id'];}return db['DeskAccount'][_0x49ee('0x47')]({'where':{'id':_0x49bf37[_0x49ee('0x46')]['id']}})[_0x49ee('0x25')](handleEntityNotFound(_0x36adb8,null))['then'](saveUpdates(_0x49bf37[_0x49ee('0x49')],null))['then'](respondWithResult(_0x36adb8,null))[_0x49ee('0x44')](handleError(_0x36adb8,null));};exports[_0x49ee('0x26')]=function(_0x2d7d75,_0x8faedd){return db[_0x49ee('0x40')][_0x49ee('0x47')]({'where':{'id':_0x2d7d75[_0x49ee('0x46')]['id']}})[_0x49ee('0x25')](handleEntityNotFound(_0x8faedd,null))['then'](removeEntity(_0x8faedd,null))['catch'](handleError(_0x8faedd,null));};exports[_0x49ee('0x4a')]=function(_0x504d73,_0x431236,_0x22344b){var _0x1adf14={};var _0x2501e6={};var _0xc54bfd;var _0x544f4c;return db['DeskAccount']['findOne']({'where':{'id':_0x504d73[_0x49ee('0x46')]['id']}})[_0x49ee('0x25')](handleEntityNotFound(_0x431236,null))[_0x49ee('0x25')](function(_0x43e4ea){if(_0x43e4ea){_0xc54bfd=_0x43e4ea;_0x2501e6[_0x49ee('0x2f')]=_[_0x49ee('0x31')](db[_0x49ee('0x4b')][_0x49ee('0x2c')]);_0x2501e6[_0x49ee('0x30')]=_[_0x49ee('0x31')](_0x504d73[_0x49ee('0x30')]);_0x2501e6['filters']=_[_0x49ee('0x33')](_0x2501e6[_0x49ee('0x2f')],_0x2501e6[_0x49ee('0x30')]);_0x1adf14['attributes']=_[_0x49ee('0x33')](_0x2501e6['model'],qs[_0x49ee('0x34')](_0x504d73[_0x49ee('0x30')]['fields']));_0x1adf14['attributes']=_0x1adf14[_0x49ee('0x35')]['length']?_0x1adf14[_0x49ee('0x35')]:_0x2501e6[_0x49ee('0x2f')];_0x1adf14[_0x49ee('0x4c')]=qs[_0x49ee('0x39')](_0x504d73[_0x49ee('0x30')][_0x49ee('0x39')]);_0x1adf14['where']=qs[_0x49ee('0x32')](_[_0x49ee('0x3b')](_0x504d73[_0x49ee('0x30')],_0x2501e6[_0x49ee('0x32')]));if(_0x504d73[_0x49ee('0x30')][_0x49ee('0x3c')]){_0x1adf14[_0x49ee('0x3a')]=_[_0x49ee('0x3d')](_0x1adf14[_0x49ee('0x3a')],{'$or':_[_0x49ee('0x2b')](_0x1adf14['attributes'],function(_0x4a81c4){var _0x87ce15={};_0x87ce15[_0x4a81c4]={'$like':'%'+_0x504d73[_0x49ee('0x30')][_0x49ee('0x3c')]+'%'};return _0x87ce15;})});}_0x1adf14=_[_0x49ee('0x3d')]({},_0x1adf14,_0x504d73[_0x49ee('0x3f')]);return _0xc54bfd[_0x49ee('0x4a')](_0x1adf14);}})[_0x49ee('0x25')](function(_0x2b236a){if(_0x2b236a){_0x544f4c=_0x2b236a['length'];if(!_0x504d73['query'][_0x49ee('0x37')](_0x49ee('0x38'))){_0x1adf14[_0x49ee('0x1c')]=qs[_0x49ee('0x1c')](_0x504d73[_0x49ee('0x30')][_0x49ee('0x1c')]);_0x1adf14['offset']=qs[_0x49ee('0x1a')](_0x504d73['query'][_0x49ee('0x1a')]);}return _0xc54bfd[_0x49ee('0x4a')](_0x1adf14);}})['then'](function(_0x340600){if(_0x340600){return _0x340600?{'count':_0x544f4c,'rows':_0x340600}:null;}})[_0x49ee('0x25')](respondWithResult(_0x431236,null))[_0x49ee('0x44')](handleError(_0x431236,null));};exports['addConfiguration']=function(_0x433fd0,_0x5395db,_0x529bfa){if(_0x433fd0['body']['id']){delete _0x433fd0[_0x49ee('0x49')]['id'];}return db['DeskAccount'][_0x49ee('0x4d')]({'where':{'id':_0x433fd0['params']['id']}})[_0x49ee('0x25')](handleEntityNotFound(_0x5395db,null))[_0x49ee('0x25')](function(_0x576555){if(_0x576555){_0x433fd0[_0x49ee('0x49')][_0x49ee('0x4e')]=_0x576555['id'];_0x433fd0['body']['Subjects']=integrations[_0x49ee('0x4f')](_0x433fd0[_0x49ee('0x49')][_0x49ee('0x50')],_0x433fd0['body'][_0x49ee('0x2e')]);_0x433fd0['body'][_0x49ee('0x51')]=integrations[_0x49ee('0x52')](_0x433fd0[_0x49ee('0x49')][_0x49ee('0x50')],_0x433fd0[_0x49ee('0x49')]['type']);return db[_0x49ee('0x4b')][_0x49ee('0x48')](_0x433fd0[_0x49ee('0x49')],{'include':[{'model':db[_0x49ee('0x53')],'as':_0x49ee('0x54')},{'model':db[_0x49ee('0x53')],'as':'Descriptions'}]});}return null;})[_0x49ee('0x25')](respondWithResult(_0x5395db,null))['catch'](handleError(_0x5395db,null));};exports[_0x49ee('0x55')]=function(_0x3f6d1a,_0x688662,_0x284c84){var _0x561218=[{'name':_0x49ee('0x56'),'label':_0x49ee('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x489cd9='';return db[_0x49ee('0x40')][_0x49ee('0x4d')]({'where':{'id':_0x3f6d1a['params']['id']},'attributes':['id',_0x49ee('0x57'),_0x49ee('0x58'),'username',_0x49ee('0x59'),_0x49ee('0x5a'),_0x49ee('0x5b'),_0x49ee('0x5c'),_0x49ee('0x5d')]})[_0x49ee('0x25')](handleEntityNotFound(_0x688662,null))[_0x49ee('0x25')](function(_0x3addc3){if(_0x3addc3){_0x489cd9=_0x3addc3[_0x49ee('0x57')];var _0x41a0c7=_0x489cd9[_0x49ee('0x5e')](-0x1);if(_0x41a0c7==='/'){_0x489cd9=_0x489cd9['substring'](0x0,_0x489cd9['lastIndexOf'](_0x41a0c7));}var _0x9be1ee={'method':_0x49ee('0x5f'),'uri':util[_0x49ee('0x60')](_0x49ee('0x61'),_0x489cd9),'headers':{'Content-Type':_0x49ee('0x62'),'Accept':_0x49ee('0x62')},'json':!![]};if(_0x3addc3[_0x49ee('0x58')]===_0x49ee('0x63')){_0x9be1ee[_0x49ee('0x64')][_0x49ee('0x65')]=util['format'](_0x49ee('0x66'),new Buffer(util['format'](_0x49ee('0x67'),_0x3addc3[_0x49ee('0x68')],_0x3addc3[_0x49ee('0x59')]))[_0x49ee('0x69')](_0x49ee('0x6a')));}return rp(_0x9be1ee)[_0x49ee('0x25')](function(_0x1589b5){return _0x561218[_0x49ee('0x6b')](_[_0x49ee('0x2b')](_0x1589b5[_0x49ee('0x6c')][_0x49ee('0x6d')],function(_0x26f226){return{'id':_0x26f226[_0x49ee('0x28')],'name':_0x26f226[_0x49ee('0x28')],'type':_0x26f226[_0x49ee('0x2e')],'active':_0x26f226['active'],'label':_0x26f226[_0x49ee('0x6e')],'custom':!![]};}));});}})[_0x49ee('0x25')](function(_0x1820e5){return{'count':_0x1820e5[_0x49ee('0x36')],'rows':_0x1820e5};})['then'](respondWithResult(_0x688662,null))[_0x49ee('0x44')](function(_0x1a7541){var _0x4ebbae=_0x3f6d1a[_0x49ee('0x30')][_0x49ee('0x6f')]?0x1f4:_0x1a7541[_0x49ee('0x70')]||0x1f4;logger[_0x49ee('0x71')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4ebbae,JSON['stringify'](_0x1a7541));delete _0x1a7541[_0x49ee('0x28')];if(_0x4ebbae===0x191){_0x4ebbae=0x190;}_0x688662[_0x49ee('0x1e')](_0x4ebbae)[_0x49ee('0x29')](_0x3f6d1a[_0x49ee('0x30')][_0x49ee('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x1a7541[_0x49ee('0x70')]}:_0x1a7541);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index bd3c27d..0c75a72 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 _0x1037=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x5359c4,_0x2517b7){var _0xa669b6=function(_0x51c732){while(--_0x51c732){_0x5359c4['push'](_0x5359c4['shift']());}};_0xa669b6(++_0x2517b7);}(_0x1037,0x91));var _0x7103=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x1037[_0x2d61ac];return _0x3f7d3c;};'use strict';var _=require(_0x7103('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7103('0x1'));var moment=require(_0x7103('0x2'));var BPromise=require(_0x7103('0x3'));var rp=require(_0x7103('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x7103('0x5'));module[_0x7103('0x6')]=function(_0x3ca322,_0x4b8627){return _0x3ca322[_0x7103('0x7')](_0x7103('0x8'),attributes,{'tableName':_0x7103('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde07=['./intDeskAccount.attributes','exports','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x42182d,_0x125b1a){var _0x26459b=function(_0x1b88ab){while(--_0x1b88ab){_0x42182d['push'](_0x42182d['shift']());}};_0x26459b(++_0x125b1a);}(_0xde07,0x1be));var _0x7de0=function(_0x2285f4,_0x19c2f8){_0x2285f4=_0x2285f4-0x0;var _0x3db903=_0xde07[_0x2285f4];return _0x3db903;};'use strict';var _=require(_0x7de0('0x0'));var util=require(_0x7de0('0x1'));var logger=require(_0x7de0('0x2'))(_0x7de0('0x3'));var moment=require(_0x7de0('0x4'));var BPromise=require(_0x7de0('0x5'));var rp=require(_0x7de0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7de0('0x7'));var config=require(_0x7de0('0x8'));var attributes=require(_0x7de0('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7de0('0xa')]=function(_0x167bb9,_0x47113f){return _0x167bb9['define'](_0x7de0('0xb'),attributes,{'tableName':_0x7de0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 81c8fd9..9638f0a 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 _0x8679=['map','model','include','then','GetDeskAccount','ShowDeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','result','catch','findAll','options','raw','where','attributes','limit'];(function(_0x1ccf3d,_0x461209){var _0x5345c1=function(_0x55c638){while(--_0x55c638){_0x1ccf3d['push'](_0x1ccf3d['shift']());}};_0x5345c1(++_0x461209);}(_0x8679,0x19e));var _0x9867=function(_0x32f0c7,_0x52edc6){_0x32f0c7=_0x32f0c7-0x0;var _0x2ce167=_0x8679[_0x32f0c7];return _0x2ce167;};'use strict';var _=require(_0x9867('0x0'));var util=require(_0x9867('0x1'));var moment=require(_0x9867('0x2'));var BPromise=require(_0x9867('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9867('0x4'))['db'];var utils=require(_0x9867('0x5'));var logger=require(_0x9867('0x6'))(_0x9867('0x7'));var config=require('../../config/environment');var jayson=require(_0x9867('0x8'));var client=jayson[_0x9867('0x9')][_0x9867('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x455a45,_0x483cc7,_0x4a978d){return new BPromise(function(_0x5d301f,_0x55eb5c){return client[_0x9867('0xb')](_0x455a45,_0x4a978d)['then'](function(_0x42883c){logger['info'](_0x9867('0xc'),_0x483cc7,'request\x20sent');logger[_0x9867('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x483cc7,_0x9867('0xe'),JSON[_0x9867('0xf')](_0x42883c));if(_0x42883c['error']){if(_0x42883c['error'][_0x9867('0x10')]===0x1f4){logger[_0x9867('0x11')]('DeskAccount,\x20%s,\x20%s',_0x483cc7,_0x42883c[_0x9867('0x11')]['message']);return _0x55eb5c(_0x42883c['error']['message']);}logger[_0x9867('0x11')](_0x9867('0xc'),_0x483cc7,_0x42883c[_0x9867('0x11')][_0x9867('0x12')]);return _0x5d301f(_0x42883c[_0x9867('0x11')][_0x9867('0x12')]);}else{logger[_0x9867('0x13')](_0x9867('0xc'),_0x483cc7,_0x9867('0xe'));_0x5d301f(_0x42883c[_0x9867('0x14')][_0x9867('0x12')]);}})[_0x9867('0x15')](function(_0x4a30cc){logger['error'](_0x9867('0xc'),_0x483cc7,_0x4a30cc);_0x55eb5c(_0x4a30cc);});});}exports['GetDeskAccount']=function(_0x3d0631){var _0x17d79f=this;return new Promise(function(_0x51035c,_0x3ccaea){return db['DeskAccount'][_0x9867('0x16')]({'raw':_0x3d0631[_0x9867('0x17')]?_0x3d0631[_0x9867('0x17')][_0x9867('0x18')]===undefined?!![]:![]:!![],'where':_0x3d0631[_0x9867('0x17')]?_0x3d0631['options'][_0x9867('0x19')]||null:null,'attributes':_0x3d0631[_0x9867('0x17')]?_0x3d0631[_0x9867('0x17')][_0x9867('0x1a')]||null:null,'limit':_0x3d0631[_0x9867('0x17')]?_0x3d0631[_0x9867('0x17')][_0x9867('0x1b')]||null:null,'include':_0x3d0631[_0x9867('0x17')]?_0x3d0631['options']['include']?_[_0x9867('0x1c')](_0x3d0631[_0x9867('0x17')]['include'],function(_0x4049d2){return{'model':db[_0x4049d2[_0x9867('0x1d')]],'as':_0x4049d2['as'],'attributes':_0x4049d2[_0x9867('0x1a')],'include':_0x4049d2[_0x9867('0x1e')]?_[_0x9867('0x1c')](_0x4049d2[_0x9867('0x1e')],function(_0x24681d){return{'model':db[_0x24681d[_0x9867('0x1d')]],'as':_0x24681d['as'],'attributes':_0x24681d[_0x9867('0x1a')],'include':_0x24681d[_0x9867('0x1e')]?_[_0x9867('0x1c')](_0x24681d[_0x9867('0x1e')],function(_0x6dbd63){return{'model':db[_0x6dbd63[_0x9867('0x1d')]],'as':_0x6dbd63['as'],'attributes':_0x6dbd63[_0x9867('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9867('0x1f')](function(_0x510e94){logger['info'](_0x9867('0x20'),_0x3d0631);logger[_0x9867('0xd')](_0x9867('0x20'),_0x3d0631,JSON[_0x9867('0xf')](_0x510e94));_0x51035c(_0x510e94);})[_0x9867('0x15')](function(_0x24fff4){logger['error']('GetDeskAccount',_0x24fff4[_0x9867('0x12')],_0x3d0631);_0x3ccaea(_0x17d79f[_0x9867('0x11')](0x1f4,_0x24fff4[_0x9867('0x12')]));});});};exports['ShowDeskAccount']=function(_0x4c3e16){var _0x2260de=this;return new Promise(function(_0x4abd5b,_0x29944d){return db['DeskAccount']['find']({'raw':_0x4c3e16['options']?_0x4c3e16['options'][_0x9867('0x18')]===undefined?!![]:![]:!![],'where':_0x4c3e16[_0x9867('0x17')]?_0x4c3e16['options'][_0x9867('0x19')]||null:null,'attributes':_0x4c3e16['options']?_0x4c3e16[_0x9867('0x17')]['attributes']||null:null,'include':_0x4c3e16[_0x9867('0x17')]?_0x4c3e16[_0x9867('0x17')]['include']?_['map'](_0x4c3e16[_0x9867('0x17')][_0x9867('0x1e')],function(_0x981d19){return{'model':db[_0x981d19['model']],'as':_0x981d19['as'],'attributes':_0x981d19[_0x9867('0x1a')],'include':_0x981d19[_0x9867('0x1e')]?_['map'](_0x981d19['include'],function(_0x512b6b){return{'model':db[_0x512b6b['model']],'as':_0x512b6b['as'],'attributes':_0x512b6b[_0x9867('0x1a')],'include':_0x512b6b[_0x9867('0x1e')]?_['map'](_0x512b6b[_0x9867('0x1e')],function(_0x5c8166){return{'model':db[_0x5c8166[_0x9867('0x1d')]],'as':_0x5c8166['as'],'attributes':_0x5c8166['attributes']};}):[]};}):[]};}):[]:[]})[_0x9867('0x1f')](function(_0x1cc280){logger[_0x9867('0x13')](_0x9867('0x21'),_0x4c3e16);logger[_0x9867('0xd')](_0x9867('0x21'),_0x4c3e16,JSON[_0x9867('0xf')](_0x1cc280));_0x4abd5b(_0x1cc280);})[_0x9867('0x15')](function(_0x4021b1){logger[_0x9867('0x11')]('ShowDeskAccount',_0x4021b1[_0x9867('0x12')],_0x4c3e16);_0x29944d(_0x2260de[_0x9867('0x11')](0x1f4,_0x4021b1[_0x9867('0x12')]));});});}; \ No newline at end of file +var _0x28a2=['limit','map','include','model','catch','ShowDeskAccount','DeskAccount','find','raw','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','findAll','options','attributes'];(function(_0x556ffd,_0x288cba){var _0x1cbddc=function(_0x395cc4){while(--_0x395cc4){_0x556ffd['push'](_0x556ffd['shift']());}};_0x1cbddc(++_0x288cba);}(_0x28a2,0x1de));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x228a('0x1'));var rs=require(_0x228a('0x2'));var fs=require('fs');var Redis=require(_0x228a('0x3'));var db=require(_0x228a('0x4'))['db'];var utils=require(_0x228a('0x5'));var logger=require(_0x228a('0x6'))(_0x228a('0x7'));var config=require(_0x228a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x228a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4973e8,_0x247275,_0x42aeb2){return new BPromise(function(_0x6097cb,_0x5e95ce){return client[_0x228a('0xa')](_0x4973e8,_0x42aeb2)[_0x228a('0xb')](function(_0x3d3940){logger[_0x228a('0xc')](_0x228a('0xd'),_0x247275,_0x228a('0xe'));logger[_0x228a('0xf')](_0x228a('0x10'),_0x247275,_0x228a('0xe'),JSON[_0x228a('0x11')](_0x3d3940));if(_0x3d3940[_0x228a('0x12')]){if(_0x3d3940[_0x228a('0x12')][_0x228a('0x13')]===0x1f4){logger[_0x228a('0x12')](_0x228a('0xd'),_0x247275,_0x3d3940['error'][_0x228a('0x14')]);return _0x5e95ce(_0x3d3940[_0x228a('0x12')][_0x228a('0x14')]);}logger['error'](_0x228a('0xd'),_0x247275,_0x3d3940['error']['message']);return _0x6097cb(_0x3d3940[_0x228a('0x12')]['message']);}else{logger[_0x228a('0xc')](_0x228a('0xd'),_0x247275,_0x228a('0xe'));_0x6097cb(_0x3d3940[_0x228a('0x15')]['message']);}})['catch'](function(_0x40230b){logger['error'](_0x228a('0xd'),_0x247275,_0x40230b);_0x5e95ce(_0x40230b);});});}exports[_0x228a('0x16')]=function(_0x203025){var _0x50fa95=this;return new Promise(function(_0x2d2a16,_0x4bcc0d){return db['DeskAccount'][_0x228a('0x17')]({'raw':_0x203025[_0x228a('0x18')]?_0x203025[_0x228a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x203025[_0x228a('0x18')]?_0x203025['options']['where']||null:null,'attributes':_0x203025['options']?_0x203025[_0x228a('0x18')][_0x228a('0x19')]||null:null,'limit':_0x203025[_0x228a('0x18')]?_0x203025[_0x228a('0x18')][_0x228a('0x1a')]||null:null,'include':_0x203025[_0x228a('0x18')]?_0x203025['options']['include']?_[_0x228a('0x1b')](_0x203025['options'][_0x228a('0x1c')],function(_0x4104de){return{'model':db[_0x4104de[_0x228a('0x1d')]],'as':_0x4104de['as'],'attributes':_0x4104de[_0x228a('0x19')],'include':_0x4104de['include']?_[_0x228a('0x1b')](_0x4104de['include'],function(_0x3481d3){return{'model':db[_0x3481d3[_0x228a('0x1d')]],'as':_0x3481d3['as'],'attributes':_0x3481d3[_0x228a('0x19')],'include':_0x3481d3['include']?_[_0x228a('0x1b')](_0x3481d3['include'],function(_0x12b4eb){return{'model':db[_0x12b4eb['model']],'as':_0x12b4eb['as'],'attributes':_0x12b4eb[_0x228a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4f1f){logger[_0x228a('0xc')]('GetDeskAccount',_0x203025);logger[_0x228a('0xf')](_0x228a('0x16'),_0x203025,JSON[_0x228a('0x11')](_0x1d4f1f));_0x2d2a16(_0x1d4f1f);})[_0x228a('0x1e')](function(_0x2b9aa2){logger['error']('GetDeskAccount',_0x2b9aa2[_0x228a('0x14')],_0x203025);_0x4bcc0d(_0x50fa95[_0x228a('0x12')](0x1f4,_0x2b9aa2[_0x228a('0x14')]));});});};exports[_0x228a('0x1f')]=function(_0x5c3d77){var _0x12c4b9=this;return new Promise(function(_0x2b66c5,_0x63421a){return db[_0x228a('0x20')][_0x228a('0x21')]({'raw':_0x5c3d77['options']?_0x5c3d77['options'][_0x228a('0x22')]===undefined?!![]:![]:!![],'where':_0x5c3d77[_0x228a('0x18')]?_0x5c3d77[_0x228a('0x18')][_0x228a('0x23')]||null:null,'attributes':_0x5c3d77[_0x228a('0x18')]?_0x5c3d77[_0x228a('0x18')][_0x228a('0x19')]||null:null,'include':_0x5c3d77[_0x228a('0x18')]?_0x5c3d77[_0x228a('0x18')][_0x228a('0x1c')]?_['map'](_0x5c3d77['options'][_0x228a('0x1c')],function(_0x2943d1){return{'model':db[_0x2943d1[_0x228a('0x1d')]],'as':_0x2943d1['as'],'attributes':_0x2943d1[_0x228a('0x19')],'include':_0x2943d1['include']?_[_0x228a('0x1b')](_0x2943d1['include'],function(_0x4054e){return{'model':db[_0x4054e[_0x228a('0x1d')]],'as':_0x4054e['as'],'attributes':_0x4054e[_0x228a('0x19')],'include':_0x4054e[_0x228a('0x1c')]?_[_0x228a('0x1b')](_0x4054e[_0x228a('0x1c')],function(_0x51e7e2){return{'model':db[_0x51e7e2[_0x228a('0x1d')]],'as':_0x51e7e2['as'],'attributes':_0x51e7e2[_0x228a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x228a('0xb')](function(_0x13c9b0){logger[_0x228a('0xc')]('ShowDeskAccount',_0x5c3d77);logger['debug'](_0x228a('0x1f'),_0x5c3d77,JSON['stringify'](_0x13c9b0));_0x2b66c5(_0x13c9b0);})['catch'](function(_0x2c5a79){logger[_0x228a('0x12')](_0x228a('0x1f'),_0x2c5a79['message'],_0x5c3d77);_0x63421a(_0x12c4b9[_0x228a('0x12')](0x1f4,_0x2c5a79[_0x228a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index de82614..74a71db 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x288492,_0x3784f3){var _0x541cec=function(_0x514a9b){while(--_0x514a9b){_0x288492['push'](_0x288492['shift']());}};_0x541cec(++_0x3784f3);}(_0x008c,0x188));var _0xc008=function(_0x434903,_0x2bae84){_0x434903=_0x434903-0x0;var _0x31021e=_0x008c[_0x434903];return _0x31021e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x40e0ac,_0x3d0d29){var _0x3e12d0=function(_0x18f5de){while(--_0x18f5de){_0x40e0ac['push'](_0x40e0ac['shift']());}};_0x3e12d0(++_0x3d0d29);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 5756246..3e65c36 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 _0xe072=['exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe072,0x14c));var _0x2e07=function(_0x2b1c0e,_0x2c10d6){_0x2b1c0e=_0x2b1c0e-0x0;var _0x48b56f=_0xe072[_0x2b1c0e];return _0x48b56f;};'use strict';var Sequelize=require('sequelize');module[_0x2e07('0x0')]={'name':{'type':Sequelize[_0x2e07('0x1')]},'description':{'type':Sequelize[_0x2e07('0x1')]}}; \ No newline at end of file +var _0xc252=['STRING','sequelize','exports'];(function(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_0xc252,0xa0));var _0x2c25=function(_0x427cf1,_0x32d384){_0x427cf1=_0x427cf1-0x0;var _0x704fe3=_0xc252[_0x427cf1];return _0x704fe3;};'use strict';var Sequelize=require(_0x2c25('0x0'));module[_0x2c25('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2c25('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 91457c2..2cb2b62 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 _0xd982=['then','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','catch','show','params','fields','options','find','create','body','findOne','DeskField','getFields','nolimit','getSubjects','map','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update'];(function(_0x5e2474,_0x3ca649){var _0x4b25b8=function(_0x556840){while(--_0x556840){_0x5e2474['push'](_0x5e2474['shift']());}};_0x4b25b8(++_0x3ca649);}(_0xd982,0x1c8));var _0x2d98=function(_0x543eed,_0x1f19b8){_0x543eed=_0x543eed-0x0;var _0x46df26=_0xd982[_0x543eed];return _0x46df26;};'use strict';var emlformat=require(_0x2d98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d98('0x2'));var moment=require(_0x2d98('0x3'));var BPromise=require(_0x2d98('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2d98('0x5'));var sox=require(_0x2d98('0x6'));var csv=require(_0x2d98('0x7'));var ejs=require(_0x2d98('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d98('0x9'));var squel=require(_0x2d98('0xa'));var crypto=require('crypto');var jsforce=require(_0x2d98('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2d98('0x7'));var querystring=require('querystring');var Papa=require(_0x2d98('0xc'));var Redis=require('ioredis');var authService=require(_0x2d98('0xd'));var qs=require(_0x2d98('0xe'));var as=require(_0x2d98('0xf'));var hardwareService=require(_0x2d98('0x10'));var logger=require(_0x2d98('0x11'))(_0x2d98('0x12'));var utils=require(_0x2d98('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2d98('0x14'));var db=require(_0x2d98('0x15'))['db'];function respondWithStatusCode(_0x90c39f,_0x27efff){_0x27efff=_0x27efff||0xcc;return function(_0x3c19c7){if(_0x3c19c7){return _0x90c39f[_0x2d98('0x16')](_0x27efff);}return _0x90c39f['status'](_0x27efff)[_0x2d98('0x17')]();};}function respondWithResult(_0x3bc119,_0x59d132){_0x59d132=_0x59d132||0xc8;return function(_0x400f33){if(_0x400f33){return _0x3bc119['status'](_0x59d132)[_0x2d98('0x18')](_0x400f33);}};}function respondWithFilteredResult(_0x466d5a,_0x1b670a){return function(_0x230c2c){if(_0x230c2c){var _0x5cc709=typeof _0x1b670a[_0x2d98('0x19')]===_0x2d98('0x1a')&&typeof _0x1b670a[_0x2d98('0x1b')]===_0x2d98('0x1a');var _0x30500d=_0x230c2c[_0x2d98('0x1c')];var _0x2b647e=_0x5cc709?0x0:_0x1b670a[_0x2d98('0x19')];var _0x5a2998=_0x5cc709?_0x230c2c['count']:_0x1b670a['offset']+_0x1b670a['limit'];var _0x3d07f5;if(_0x5a2998>=_0x30500d){_0x5a2998=_0x30500d;_0x3d07f5=0xc8;}else{_0x3d07f5=0xce;}_0x466d5a[_0x2d98('0x1d')](_0x3d07f5);return _0x466d5a[_0x2d98('0x1e')](_0x2d98('0x1f'),_0x2b647e+'-'+_0x5a2998+'/'+_0x30500d)[_0x2d98('0x18')](_0x230c2c);}return null;};}function patchUpdates(_0x2e0b16){return function(_0x34c4ce){try{jsonpatch[_0x2d98('0x20')](_0x34c4ce,_0x2e0b16,!![]);}catch(_0xc2f26){return BPromise[_0x2d98('0x21')](_0xc2f26);}return _0x34c4ce[_0x2d98('0x22')]();};}function saveUpdates(_0x1f4208,_0x4b172e){return function(_0x119eee){if(_0x119eee){return _0x119eee[_0x2d98('0x23')](_0x1f4208)[_0x2d98('0x24')](function(_0xbae943){return _0xbae943;});}return null;};}function removeEntity(_0x515d5,_0x63651b){return function(_0x21a2f5){if(_0x21a2f5){return _0x21a2f5['destroy']()[_0x2d98('0x24')](function(){_0x515d5['status'](0xcc)[_0x2d98('0x17')]();});}};}function handleEntityNotFound(_0x2b94fd,_0x32e244){return function(_0x1f6a4b){if(!_0x1f6a4b){_0x2b94fd['sendStatus'](0x194);}return _0x1f6a4b;};}function handleError(_0x2ce713,_0x2a7eff){_0x2a7eff=_0x2a7eff||0x1f4;return function(_0x4a7ab0){logger['error'](_0x4a7ab0[_0x2d98('0x25')]);if(_0x4a7ab0[_0x2d98('0x26')]){delete _0x4a7ab0[_0x2d98('0x26')];}_0x2ce713[_0x2d98('0x1d')](_0x2a7eff)[_0x2d98('0x27')](_0x4a7ab0);};}exports[_0x2d98('0x28')]=function(_0x795eb5,_0x372383){var _0x5e11ec={},_0x1eba73={},_0x41d393={'count':0x0,'rows':[]};var _0x1e8eff=_['map'](db[_0x2d98('0x29')][_0x2d98('0x2a')],function(_0x15ba66){return{'name':_0x15ba66[_0x2d98('0x2b')],'type':_0x15ba66['type'][_0x2d98('0x2c')]};});_0x1eba73[_0x2d98('0x2d')]=_['map'](_0x1e8eff,_0x2d98('0x26'));_0x1eba73[_0x2d98('0x2e')]=_[_0x2d98('0x2f')](_0x795eb5[_0x2d98('0x2e')]);_0x1eba73['filters']=_[_0x2d98('0x30')](_0x1eba73['model'],_0x1eba73[_0x2d98('0x2e')]);_0x5e11ec[_0x2d98('0x31')]=_[_0x2d98('0x30')](_0x1eba73[_0x2d98('0x2d')],qs['fields'](_0x795eb5[_0x2d98('0x2e')]['fields']));_0x5e11ec[_0x2d98('0x31')]=_0x5e11ec[_0x2d98('0x31')][_0x2d98('0x32')]?_0x5e11ec[_0x2d98('0x31')]:_0x1eba73[_0x2d98('0x2d')];if(!_0x795eb5[_0x2d98('0x2e')][_0x2d98('0x33')]('nolimit')){_0x5e11ec[_0x2d98('0x1b')]=qs[_0x2d98('0x1b')](_0x795eb5['query'][_0x2d98('0x1b')]);_0x5e11ec[_0x2d98('0x19')]=qs[_0x2d98('0x19')](_0x795eb5['query']['offset']);}_0x5e11ec[_0x2d98('0x34')]=qs[_0x2d98('0x35')](_0x795eb5[_0x2d98('0x2e')][_0x2d98('0x35')]);_0x5e11ec[_0x2d98('0x36')]=qs[_0x2d98('0x37')](_[_0x2d98('0x38')](_0x795eb5[_0x2d98('0x2e')],_0x1eba73[_0x2d98('0x37')]),_0x1e8eff);if(_0x795eb5[_0x2d98('0x2e')][_0x2d98('0x39')]){_0x5e11ec[_0x2d98('0x36')]=_[_0x2d98('0x3a')](_0x5e11ec['where'],{'$or':_['map'](_0x1e8eff,function(_0x2b2de3){if(_0x2b2de3[_0x2d98('0x3b')]!=='VIRTUAL'){var _0x32577c={};_0x32577c[_0x2b2de3['name']]={'$like':'%'+_0x795eb5[_0x2d98('0x2e')][_0x2d98('0x39')]+'%'};return _0x32577c;}})});}_0x5e11ec=_['merge']({},_0x5e11ec,_0x795eb5['options']);var _0x42e352={'where':_0x5e11ec['where']};return db['DeskConfiguration'][_0x2d98('0x1c')](_0x42e352)[_0x2d98('0x24')](function(_0x1ca1eb){_0x41d393['count']=_0x1ca1eb;if(_0x795eb5[_0x2d98('0x2e')][_0x2d98('0x3c')]){_0x5e11ec[_0x2d98('0x3d')]=[{'all':!![]}];}return db[_0x2d98('0x29')][_0x2d98('0x3e')](_0x5e11ec);})[_0x2d98('0x24')](function(_0x572bc9){_0x41d393['rows']=_0x572bc9;return _0x41d393;})[_0x2d98('0x24')](respondWithFilteredResult(_0x372383,_0x5e11ec))[_0x2d98('0x3f')](handleError(_0x372383,null));};exports[_0x2d98('0x40')]=function(_0x34c179,_0x36f9e0){var _0xbe9dbc={'raw':![],'where':{'id':_0x34c179[_0x2d98('0x41')]['id']}},_0x1c93da={};_0x1c93da[_0x2d98('0x2d')]=_['keys'](db[_0x2d98('0x29')]['rawAttributes']);_0x1c93da[_0x2d98('0x2e')]=_[_0x2d98('0x2f')](_0x34c179[_0x2d98('0x2e')]);_0x1c93da[_0x2d98('0x37')]=_[_0x2d98('0x30')](_0x1c93da[_0x2d98('0x2d')],_0x1c93da['query']);_0xbe9dbc[_0x2d98('0x31')]=_[_0x2d98('0x30')](_0x1c93da[_0x2d98('0x2d')],qs[_0x2d98('0x42')](_0x34c179[_0x2d98('0x2e')][_0x2d98('0x42')]));_0xbe9dbc[_0x2d98('0x31')]=_0xbe9dbc['attributes']['length']?_0xbe9dbc['attributes']:_0x1c93da[_0x2d98('0x2d')];if(_0x34c179[_0x2d98('0x2e')]['includeAll']){_0xbe9dbc['include']=[{'all':!![]}];}_0xbe9dbc=_['merge']({},_0xbe9dbc,_0x34c179[_0x2d98('0x43')]);return db['DeskConfiguration'][_0x2d98('0x44')](_0xbe9dbc)[_0x2d98('0x24')](handleEntityNotFound(_0x36f9e0,null))[_0x2d98('0x24')](respondWithResult(_0x36f9e0,null))[_0x2d98('0x3f')](handleError(_0x36f9e0,null));};exports[_0x2d98('0x45')]=function(_0x1ef1bd,_0x318d3b){return db[_0x2d98('0x29')][_0x2d98('0x45')](_0x1ef1bd[_0x2d98('0x46')],{})['then'](respondWithResult(_0x318d3b,0xc9))[_0x2d98('0x3f')](handleError(_0x318d3b,null));};exports[_0x2d98('0x23')]=function(_0x4afc6a,_0x32de87){if(_0x4afc6a['body']['id']){delete _0x4afc6a['body']['id'];}return db[_0x2d98('0x29')][_0x2d98('0x44')]({'where':{'id':_0x4afc6a[_0x2d98('0x41')]['id']}})[_0x2d98('0x24')](handleEntityNotFound(_0x32de87,null))['then'](saveUpdates(_0x4afc6a[_0x2d98('0x46')],null))[_0x2d98('0x24')](respondWithResult(_0x32de87,null))[_0x2d98('0x3f')](handleError(_0x32de87,null));};exports['destroy']=function(_0x474717,_0x4623ec){return db['DeskConfiguration'][_0x2d98('0x44')]({'where':{'id':_0x474717['params']['id']}})[_0x2d98('0x24')](handleEntityNotFound(_0x4623ec,null))[_0x2d98('0x24')](removeEntity(_0x4623ec,null))[_0x2d98('0x3f')](handleError(_0x4623ec,null));};exports['getFields']=function(_0x1c6dba,_0x4c9d62,_0xae6763){var _0x23cb01={};var _0x4a7884={};var _0x8bef20;var _0x432e80;return db['DeskConfiguration'][_0x2d98('0x47')]({'where':{'id':_0x1c6dba[_0x2d98('0x41')]['id']}})[_0x2d98('0x24')](handleEntityNotFound(_0x4c9d62,null))[_0x2d98('0x24')](function(_0x47062c){if(_0x47062c){_0x8bef20=_0x47062c;_0x4a7884['model']=_[_0x2d98('0x2f')](db[_0x2d98('0x48')]['rawAttributes']);_0x4a7884['query']=_[_0x2d98('0x2f')](_0x1c6dba[_0x2d98('0x2e')]);_0x4a7884[_0x2d98('0x37')]=_['intersection'](_0x4a7884[_0x2d98('0x2d')],_0x4a7884[_0x2d98('0x2e')]);_0x23cb01[_0x2d98('0x31')]=_[_0x2d98('0x30')](_0x4a7884[_0x2d98('0x2d')],qs[_0x2d98('0x42')](_0x1c6dba[_0x2d98('0x2e')]['fields']));_0x23cb01[_0x2d98('0x31')]=_0x23cb01['attributes'][_0x2d98('0x32')]?_0x23cb01[_0x2d98('0x31')]:_0x4a7884[_0x2d98('0x2d')];_0x23cb01['order']=qs['sort'](_0x1c6dba[_0x2d98('0x2e')]['sort']);_0x23cb01[_0x2d98('0x36')]=qs['filters'](_[_0x2d98('0x38')](_0x1c6dba[_0x2d98('0x2e')],_0x4a7884['filters']));if(_0x1c6dba[_0x2d98('0x2e')][_0x2d98('0x39')]){_0x23cb01['where']=_['merge'](_0x23cb01['where'],{'$or':_['map'](_0x23cb01[_0x2d98('0x31')],function(_0x16c5a0){var _0xc87f8f={};_0xc87f8f[_0x16c5a0]={'$like':'%'+_0x1c6dba[_0x2d98('0x2e')][_0x2d98('0x39')]+'%'};return _0xc87f8f;})});}_0x23cb01=_[_0x2d98('0x3a')]({},_0x23cb01,_0x1c6dba['options']);return _0x8bef20[_0x2d98('0x49')](_0x23cb01);}})[_0x2d98('0x24')](function(_0x42d3eb){if(_0x42d3eb){_0x432e80=_0x42d3eb[_0x2d98('0x32')];if(!_0x1c6dba[_0x2d98('0x2e')][_0x2d98('0x33')](_0x2d98('0x4a'))){_0x23cb01[_0x2d98('0x1b')]=qs[_0x2d98('0x1b')](_0x1c6dba[_0x2d98('0x2e')][_0x2d98('0x1b')]);_0x23cb01[_0x2d98('0x19')]=qs['offset'](_0x1c6dba['query'][_0x2d98('0x19')]);}return _0x8bef20[_0x2d98('0x49')](_0x23cb01);}})[_0x2d98('0x24')](function(_0x58e06c){if(_0x58e06c){return _0x58e06c?{'count':_0x432e80,'rows':_0x58e06c}:null;}})[_0x2d98('0x24')](respondWithResult(_0x4c9d62,null))[_0x2d98('0x3f')](handleError(_0x4c9d62,null));};exports[_0x2d98('0x4b')]=function(_0x3bfc94,_0x481c41,_0x1b79bb){var _0x3a91ee={};var _0x25865e={};var _0x5ccc6c;var _0x5ddefc;return db[_0x2d98('0x29')]['findOne']({'where':{'id':_0x3bfc94[_0x2d98('0x41')]['id']}})[_0x2d98('0x24')](handleEntityNotFound(_0x481c41,null))[_0x2d98('0x24')](function(_0x1f8e02){if(_0x1f8e02){_0x5ccc6c=_0x1f8e02;_0x25865e[_0x2d98('0x2d')]=_[_0x2d98('0x2f')](db['DeskField']['rawAttributes']);_0x25865e[_0x2d98('0x2e')]=_[_0x2d98('0x2f')](_0x3bfc94['query']);_0x25865e[_0x2d98('0x37')]=_[_0x2d98('0x30')](_0x25865e['model'],_0x25865e[_0x2d98('0x2e')]);_0x3a91ee[_0x2d98('0x31')]=_['intersection'](_0x25865e['model'],qs[_0x2d98('0x42')](_0x3bfc94[_0x2d98('0x2e')]['fields']));_0x3a91ee[_0x2d98('0x31')]=_0x3a91ee['attributes'][_0x2d98('0x32')]?_0x3a91ee[_0x2d98('0x31')]:_0x25865e[_0x2d98('0x2d')];_0x3a91ee['order']=qs['sort'](_0x3bfc94['query'][_0x2d98('0x35')]);_0x3a91ee[_0x2d98('0x36')]=qs[_0x2d98('0x37')](_['pick'](_0x3bfc94[_0x2d98('0x2e')],_0x25865e[_0x2d98('0x37')]));if(_0x3bfc94[_0x2d98('0x2e')]['filter']){_0x3a91ee[_0x2d98('0x36')]=_[_0x2d98('0x3a')](_0x3a91ee[_0x2d98('0x36')],{'$or':_[_0x2d98('0x4c')](_0x3a91ee[_0x2d98('0x31')],function(_0xf56264){var _0x4343ec={};_0x4343ec[_0xf56264]={'$like':'%'+_0x3bfc94[_0x2d98('0x2e')]['filter']+'%'};return _0x4343ec;})});}_0x3a91ee=_[_0x2d98('0x3a')]({},_0x3a91ee,_0x3bfc94[_0x2d98('0x43')]);return _0x5ccc6c[_0x2d98('0x4b')](_0x3a91ee);}})[_0x2d98('0x24')](function(_0x5eb1f9){if(_0x5eb1f9){_0x5ddefc=_0x5eb1f9[_0x2d98('0x32')];if(!_0x3bfc94[_0x2d98('0x2e')][_0x2d98('0x33')](_0x2d98('0x4a'))){_0x3a91ee[_0x2d98('0x1b')]=qs['limit'](_0x3bfc94[_0x2d98('0x2e')][_0x2d98('0x1b')]);_0x3a91ee[_0x2d98('0x19')]=qs[_0x2d98('0x19')](_0x3bfc94[_0x2d98('0x2e')][_0x2d98('0x19')]);}return _0x5ccc6c[_0x2d98('0x4b')](_0x3a91ee);}})[_0x2d98('0x24')](function(_0x446910){if(_0x446910){return _0x446910?{'count':_0x5ddefc,'rows':_0x446910}:null;}})[_0x2d98('0x24')](respondWithResult(_0x481c41,null))['catch'](handleError(_0x481c41,null));};exports[_0x2d98('0x4d')]=function(_0x2d9fda,_0x837f16,_0x5cd0cc){var _0x42b52a={};var _0x2ba1e0={};var _0x290e8a;var _0x14abd3;return db[_0x2d98('0x29')]['findOne']({'where':{'id':_0x2d9fda[_0x2d98('0x41')]['id']}})[_0x2d98('0x24')](handleEntityNotFound(_0x837f16,null))['then'](function(_0x281707){if(_0x281707){_0x290e8a=_0x281707;_0x2ba1e0[_0x2d98('0x2d')]=_[_0x2d98('0x2f')](db[_0x2d98('0x48')][_0x2d98('0x2a')]);_0x2ba1e0[_0x2d98('0x2e')]=_['keys'](_0x2d9fda[_0x2d98('0x2e')]);_0x2ba1e0['filters']=_[_0x2d98('0x30')](_0x2ba1e0[_0x2d98('0x2d')],_0x2ba1e0[_0x2d98('0x2e')]);_0x42b52a[_0x2d98('0x31')]=_[_0x2d98('0x30')](_0x2ba1e0[_0x2d98('0x2d')],qs[_0x2d98('0x42')](_0x2d9fda[_0x2d98('0x2e')]['fields']));_0x42b52a[_0x2d98('0x31')]=_0x42b52a[_0x2d98('0x31')][_0x2d98('0x32')]?_0x42b52a[_0x2d98('0x31')]:_0x2ba1e0[_0x2d98('0x2d')];_0x42b52a[_0x2d98('0x34')]=qs[_0x2d98('0x35')](_0x2d9fda[_0x2d98('0x2e')]['sort']);_0x42b52a[_0x2d98('0x36')]=qs[_0x2d98('0x37')](_[_0x2d98('0x38')](_0x2d9fda['query'],_0x2ba1e0[_0x2d98('0x37')]));if(_0x2d9fda[_0x2d98('0x2e')][_0x2d98('0x39')]){_0x42b52a[_0x2d98('0x36')]=_['merge'](_0x42b52a[_0x2d98('0x36')],{'$or':_[_0x2d98('0x4c')](_0x42b52a[_0x2d98('0x31')],function(_0x50edfa){var _0x4410b0={};_0x4410b0[_0x50edfa]={'$like':'%'+_0x2d9fda[_0x2d98('0x2e')][_0x2d98('0x39')]+'%'};return _0x4410b0;})});}_0x42b52a=_['merge']({},_0x42b52a,_0x2d9fda[_0x2d98('0x43')]);return _0x290e8a['getDescriptions'](_0x42b52a);}})[_0x2d98('0x24')](function(_0xdbf41f){if(_0xdbf41f){_0x14abd3=_0xdbf41f[_0x2d98('0x32')];if(!_0x2d9fda['query']['hasOwnProperty'](_0x2d98('0x4a'))){_0x42b52a[_0x2d98('0x1b')]=qs[_0x2d98('0x1b')](_0x2d9fda[_0x2d98('0x2e')][_0x2d98('0x1b')]);_0x42b52a[_0x2d98('0x19')]=qs[_0x2d98('0x19')](_0x2d9fda[_0x2d98('0x2e')]['offset']);}return _0x290e8a[_0x2d98('0x4d')](_0x42b52a);}})['then'](function(_0x1db472){if(_0x1db472){return _0x1db472?{'count':_0x14abd3,'rows':_0x1db472}:null;}})[_0x2d98('0x24')](respondWithResult(_0x837f16,null))[_0x2d98('0x3f')](handleError(_0x837f16,null));};exports[_0x2d98('0x4e')]=function(_0x3c9d9d,_0x47548b,_0xb5cce7){var _0x5a79a4={};var _0x12140e={};var _0x5db14b;var _0x46c48e;return db[_0x2d98('0x29')][_0x2d98('0x47')]({'where':{'id':_0x3c9d9d[_0x2d98('0x41')]['id']}})[_0x2d98('0x24')](handleEntityNotFound(_0x47548b,null))[_0x2d98('0x24')](function(_0x2c189f){if(_0x2c189f){_0x5db14b=_0x2c189f;_0x12140e[_0x2d98('0x2d')]=_[_0x2d98('0x2f')](db[_0x2d98('0x4f')][_0x2d98('0x2a')]);_0x12140e[_0x2d98('0x2e')]=_[_0x2d98('0x2f')](_0x3c9d9d[_0x2d98('0x2e')]);_0x12140e[_0x2d98('0x37')]=_[_0x2d98('0x30')](_0x12140e[_0x2d98('0x2d')],_0x12140e[_0x2d98('0x2e')]);_0x5a79a4[_0x2d98('0x31')]=_['intersection'](_0x12140e['model'],qs[_0x2d98('0x42')](_0x3c9d9d[_0x2d98('0x2e')][_0x2d98('0x42')]));_0x5a79a4[_0x2d98('0x31')]=_0x5a79a4[_0x2d98('0x31')][_0x2d98('0x32')]?_0x5a79a4[_0x2d98('0x31')]:_0x12140e['model'];_0x5a79a4[_0x2d98('0x34')]=qs['sort'](_0x3c9d9d[_0x2d98('0x2e')][_0x2d98('0x35')]);_0x5a79a4['where']=qs['filters'](_[_0x2d98('0x38')](_0x3c9d9d[_0x2d98('0x2e')],_0x12140e[_0x2d98('0x37')]));if(_0x3c9d9d['query'][_0x2d98('0x39')]){_0x5a79a4[_0x2d98('0x36')]=_['merge'](_0x5a79a4[_0x2d98('0x36')],{'$or':_[_0x2d98('0x4c')](_0x5a79a4[_0x2d98('0x31')],function(_0x45a87f){var _0x23d7b1={};_0x23d7b1[_0x45a87f]={'$like':'%'+_0x3c9d9d[_0x2d98('0x2e')][_0x2d98('0x39')]+'%'};return _0x23d7b1;})});}_0x5a79a4=_[_0x2d98('0x3a')]({},_0x5a79a4,_0x3c9d9d['options']);return _0x5db14b['getTags'](_0x5a79a4);}})['then'](function(_0x5c3e81){if(_0x5c3e81){_0x46c48e=_0x5c3e81[_0x2d98('0x32')];if(!_0x3c9d9d['query'][_0x2d98('0x33')](_0x2d98('0x4a'))){_0x5a79a4[_0x2d98('0x1b')]=qs['limit'](_0x3c9d9d['query'][_0x2d98('0x1b')]);_0x5a79a4[_0x2d98('0x19')]=qs['offset'](_0x3c9d9d[_0x2d98('0x2e')][_0x2d98('0x19')]);}return _0x5db14b['getTags'](_0x5a79a4);}})[_0x2d98('0x24')](function(_0x3a1384){if(_0x3a1384){return _0x3a1384?{'count':_0x46c48e,'rows':_0x3a1384}:null;}})['then'](respondWithResult(_0x47548b,null))['catch'](handleError(_0x47548b,null));};exports[_0x2d98('0x50')]=function(_0x4b6fb0,_0x29a4d8,_0x145ee0){if(_0x4b6fb0[_0x2d98('0x46')]['id']){delete _0x4b6fb0[_0x2d98('0x46')]['id'];}return db[_0x2d98('0x29')][_0x2d98('0x47')]({'where':{'id':_0x4b6fb0[_0x2d98('0x41')]['id']}})[_0x2d98('0x24')](handleEntityNotFound(_0x29a4d8,null))[_0x2d98('0x24')](function(_0x3c0760){if(_0x3c0760){return _0x3c0760[_0x2d98('0x50')](_0x4b6fb0['body'][_0x2d98('0x51')]||[]);}return null;})[_0x2d98('0x24')](respondWithResult(_0x29a4d8,null))[_0x2d98('0x3f')](handleError(_0x29a4d8,null));}; \ No newline at end of file +var _0xf2d0=['sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','merge','create','body','getFields','findOne','DeskField','order','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x515a2a,_0x50413b){var _0x28afb2=function(_0x3b5480){while(--_0x3b5480){_0x515a2a['push'](_0x515a2a['shift']());}};_0x28afb2(++_0x50413b);}(_0xf2d0,0x124));var _0x0f2d=function(_0x1151d1,_0x48e4ba){_0x1151d1=_0x1151d1-0x0;var _0x1a70a9=_0xf2d0[_0x1151d1];return _0x1a70a9;};'use strict';var emlformat=require(_0x0f2d('0x0'));var rimraf=require(_0x0f2d('0x1'));var zipdir=require(_0x0f2d('0x2'));var jsonpatch=require(_0x0f2d('0x3'));var rp=require('request-promise');var moment=require(_0x0f2d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0f2d('0x5'));var csv=require(_0x0f2d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f2d('0x7'));var _=require(_0x0f2d('0x8'));var squel=require('squel');var crypto=require(_0x0f2d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0f2d('0x6'));var querystring=require(_0x0f2d('0xa'));var Papa=require(_0x0f2d('0xb'));var Redis=require('ioredis');var authService=require(_0x0f2d('0xc'));var qs=require(_0x0f2d('0xd'));var as=require(_0x0f2d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0f2d('0xf'));var utils=require(_0x0f2d('0x10'));var config=require(_0x0f2d('0x11'));var licenseUtil=require(_0x0f2d('0x12'));var db=require(_0x0f2d('0x13'))['db'];function respondWithStatusCode(_0x3e0cac,_0x415609){_0x415609=_0x415609||0xcc;return function(_0x439b40){if(_0x439b40){return _0x3e0cac[_0x0f2d('0x14')](_0x415609);}return _0x3e0cac[_0x0f2d('0x15')](_0x415609)[_0x0f2d('0x16')]();};}function respondWithResult(_0x29bf1f,_0x4ed4eb){_0x4ed4eb=_0x4ed4eb||0xc8;return function(_0x3de660){if(_0x3de660){return _0x29bf1f[_0x0f2d('0x15')](_0x4ed4eb)[_0x0f2d('0x17')](_0x3de660);}};}function respondWithFilteredResult(_0x23ca21,_0x4a9185){return function(_0x1c16d0){if(_0x1c16d0){var _0x5d24f9=typeof _0x4a9185[_0x0f2d('0x18')]===_0x0f2d('0x19')&&typeof _0x4a9185['limit']===_0x0f2d('0x19');var _0x24aab5=_0x1c16d0[_0x0f2d('0x1a')];var _0x37682a=_0x5d24f9?0x0:_0x4a9185[_0x0f2d('0x18')];var _0x1e5444=_0x5d24f9?_0x1c16d0['count']:_0x4a9185[_0x0f2d('0x18')]+_0x4a9185['limit'];var _0x3f5366;if(_0x1e5444>=_0x24aab5){_0x1e5444=_0x24aab5;_0x3f5366=0xc8;}else{_0x3f5366=0xce;}_0x23ca21[_0x0f2d('0x15')](_0x3f5366);return _0x23ca21[_0x0f2d('0x1b')]('Content-Range',_0x37682a+'-'+_0x1e5444+'/'+_0x24aab5)[_0x0f2d('0x17')](_0x1c16d0);}return null;};}function patchUpdates(_0x58b6fb){return function(_0x43d6e8){try{jsonpatch[_0x0f2d('0x1c')](_0x43d6e8,_0x58b6fb,!![]);}catch(_0x3297cf){return BPromise[_0x0f2d('0x1d')](_0x3297cf);}return _0x43d6e8[_0x0f2d('0x1e')]();};}function saveUpdates(_0x19dda2,_0x17a345){return function(_0x326384){if(_0x326384){return _0x326384[_0x0f2d('0x1f')](_0x19dda2)[_0x0f2d('0x20')](function(_0x4dd024){return _0x4dd024;});}return null;};}function removeEntity(_0x294ea4,_0x148fa9){return function(_0x238b81){if(_0x238b81){return _0x238b81[_0x0f2d('0x21')]()[_0x0f2d('0x20')](function(){_0x294ea4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e47e0,_0x407400){return function(_0x90abf7){if(!_0x90abf7){_0x5e47e0['sendStatus'](0x194);}return _0x90abf7;};}function handleError(_0x24a763,_0x8dbeaa){_0x8dbeaa=_0x8dbeaa||0x1f4;return function(_0x3a81d2){logger['error'](_0x3a81d2[_0x0f2d('0x22')]);if(_0x3a81d2[_0x0f2d('0x23')]){delete _0x3a81d2[_0x0f2d('0x23')];}_0x24a763['status'](_0x8dbeaa)[_0x0f2d('0x24')](_0x3a81d2);};}exports['index']=function(_0x4449e1,_0xe7f6ac){var _0x682870={},_0x57f162={},_0x5bfe30={'count':0x0,'rows':[]};var _0x1a6585=_[_0x0f2d('0x25')](db[_0x0f2d('0x26')][_0x0f2d('0x27')],function(_0x2ccd44){return{'name':_0x2ccd44[_0x0f2d('0x28')],'type':_0x2ccd44[_0x0f2d('0x29')][_0x0f2d('0x2a')]};});_0x57f162['model']=_[_0x0f2d('0x25')](_0x1a6585,_0x0f2d('0x23'));_0x57f162[_0x0f2d('0x2b')]=_[_0x0f2d('0x2c')](_0x4449e1['query']);_0x57f162[_0x0f2d('0x2d')]=_[_0x0f2d('0x2e')](_0x57f162[_0x0f2d('0x2f')],_0x57f162[_0x0f2d('0x2b')]);_0x682870['attributes']=_[_0x0f2d('0x2e')](_0x57f162['model'],qs[_0x0f2d('0x30')](_0x4449e1[_0x0f2d('0x2b')]['fields']));_0x682870[_0x0f2d('0x31')]=_0x682870[_0x0f2d('0x31')][_0x0f2d('0x32')]?_0x682870['attributes']:_0x57f162[_0x0f2d('0x2f')];if(!_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x33')](_0x0f2d('0x34'))){_0x682870[_0x0f2d('0x35')]=qs[_0x0f2d('0x35')](_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x682870[_0x0f2d('0x18')]=qs[_0x0f2d('0x18')](_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x18')]);}_0x682870['order']=qs[_0x0f2d('0x36')](_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x36')]);_0x682870[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_['pick'](_0x4449e1[_0x0f2d('0x2b')],_0x57f162[_0x0f2d('0x2d')]),_0x1a6585);if(_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x38')]){_0x682870[_0x0f2d('0x37')]=_['merge'](_0x682870[_0x0f2d('0x37')],{'$or':_['map'](_0x1a6585,function(_0x21cdd3){if(_0x21cdd3['type']!==_0x0f2d('0x39')){var _0x34c488={};_0x34c488[_0x21cdd3[_0x0f2d('0x23')]]={'$like':'%'+_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x38')]+'%'};return _0x34c488;}})});}_0x682870=_['merge']({},_0x682870,_0x4449e1[_0x0f2d('0x3a')]);var _0x406b2d={'where':_0x682870['where']};return db[_0x0f2d('0x26')][_0x0f2d('0x1a')](_0x406b2d)[_0x0f2d('0x20')](function(_0x366154){_0x5bfe30[_0x0f2d('0x1a')]=_0x366154;if(_0x4449e1[_0x0f2d('0x2b')][_0x0f2d('0x3b')]){_0x682870[_0x0f2d('0x3c')]=[{'all':!![]}];}return db[_0x0f2d('0x26')][_0x0f2d('0x3d')](_0x682870);})[_0x0f2d('0x20')](function(_0x194df1){_0x5bfe30['rows']=_0x194df1;return _0x5bfe30;})[_0x0f2d('0x20')](respondWithFilteredResult(_0xe7f6ac,_0x682870))[_0x0f2d('0x3e')](handleError(_0xe7f6ac,null));};exports['show']=function(_0xdb0969,_0x15fa24){var _0x2064ed={'raw':![],'where':{'id':_0xdb0969[_0x0f2d('0x3f')]['id']}},_0x298222={};_0x298222[_0x0f2d('0x2f')]=_[_0x0f2d('0x2c')](db['DeskConfiguration'][_0x0f2d('0x27')]);_0x298222['query']=_['keys'](_0xdb0969['query']);_0x298222[_0x0f2d('0x2d')]=_['intersection'](_0x298222[_0x0f2d('0x2f')],_0x298222['query']);_0x2064ed[_0x0f2d('0x31')]=_[_0x0f2d('0x2e')](_0x298222['model'],qs['fields'](_0xdb0969[_0x0f2d('0x2b')]['fields']));_0x2064ed['attributes']=_0x2064ed['attributes'][_0x0f2d('0x32')]?_0x2064ed[_0x0f2d('0x31')]:_0x298222[_0x0f2d('0x2f')];if(_0xdb0969[_0x0f2d('0x2b')][_0x0f2d('0x3b')]){_0x2064ed[_0x0f2d('0x3c')]=[{'all':!![]}];}_0x2064ed=_[_0x0f2d('0x40')]({},_0x2064ed,_0xdb0969[_0x0f2d('0x3a')]);return db[_0x0f2d('0x26')]['find'](_0x2064ed)['then'](handleEntityNotFound(_0x15fa24,null))[_0x0f2d('0x20')](respondWithResult(_0x15fa24,null))['catch'](handleError(_0x15fa24,null));};exports[_0x0f2d('0x41')]=function(_0x3367e1,_0x57b61e){return db['DeskConfiguration'][_0x0f2d('0x41')](_0x3367e1[_0x0f2d('0x42')],{})['then'](respondWithResult(_0x57b61e,0xc9))['catch'](handleError(_0x57b61e,null));};exports[_0x0f2d('0x1f')]=function(_0x58e9ca,_0x21f620){if(_0x58e9ca[_0x0f2d('0x42')]['id']){delete _0x58e9ca['body']['id'];}return db[_0x0f2d('0x26')]['find']({'where':{'id':_0x58e9ca[_0x0f2d('0x3f')]['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0x21f620,null))[_0x0f2d('0x20')](saveUpdates(_0x58e9ca[_0x0f2d('0x42')],null))[_0x0f2d('0x20')](respondWithResult(_0x21f620,null))[_0x0f2d('0x3e')](handleError(_0x21f620,null));};exports['destroy']=function(_0x2f9fdd,_0x16c8f6){return db[_0x0f2d('0x26')]['find']({'where':{'id':_0x2f9fdd['params']['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0x16c8f6,null))['then'](removeEntity(_0x16c8f6,null))['catch'](handleError(_0x16c8f6,null));};exports[_0x0f2d('0x43')]=function(_0x435ac3,_0x3d1429,_0x40420e){var _0x54a97e={};var _0x559c36={};var _0x3eb06f;var _0x243e7d;return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x435ac3['params']['id']}})['then'](handleEntityNotFound(_0x3d1429,null))[_0x0f2d('0x20')](function(_0x38ec39){if(_0x38ec39){_0x3eb06f=_0x38ec39;_0x559c36[_0x0f2d('0x2f')]=_[_0x0f2d('0x2c')](db[_0x0f2d('0x45')][_0x0f2d('0x27')]);_0x559c36[_0x0f2d('0x2b')]=_['keys'](_0x435ac3[_0x0f2d('0x2b')]);_0x559c36[_0x0f2d('0x2d')]=_[_0x0f2d('0x2e')](_0x559c36[_0x0f2d('0x2f')],_0x559c36[_0x0f2d('0x2b')]);_0x54a97e[_0x0f2d('0x31')]=_[_0x0f2d('0x2e')](_0x559c36['model'],qs[_0x0f2d('0x30')](_0x435ac3['query'][_0x0f2d('0x30')]));_0x54a97e[_0x0f2d('0x31')]=_0x54a97e[_0x0f2d('0x31')]['length']?_0x54a97e['attributes']:_0x559c36[_0x0f2d('0x2f')];_0x54a97e[_0x0f2d('0x46')]=qs[_0x0f2d('0x36')](_0x435ac3[_0x0f2d('0x2b')]['sort']);_0x54a97e[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_[_0x0f2d('0x47')](_0x435ac3[_0x0f2d('0x2b')],_0x559c36[_0x0f2d('0x2d')]));if(_0x435ac3[_0x0f2d('0x2b')][_0x0f2d('0x38')]){_0x54a97e['where']=_[_0x0f2d('0x40')](_0x54a97e['where'],{'$or':_[_0x0f2d('0x25')](_0x54a97e['attributes'],function(_0x2f427f){var _0x285b05={};_0x285b05[_0x2f427f]={'$like':'%'+_0x435ac3[_0x0f2d('0x2b')]['filter']+'%'};return _0x285b05;})});}_0x54a97e=_[_0x0f2d('0x40')]({},_0x54a97e,_0x435ac3[_0x0f2d('0x3a')]);return _0x3eb06f[_0x0f2d('0x43')](_0x54a97e);}})['then'](function(_0xd62a5c){if(_0xd62a5c){_0x243e7d=_0xd62a5c[_0x0f2d('0x32')];if(!_0x435ac3['query'][_0x0f2d('0x33')](_0x0f2d('0x34'))){_0x54a97e['limit']=qs[_0x0f2d('0x35')](_0x435ac3[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x54a97e[_0x0f2d('0x18')]=qs['offset'](_0x435ac3['query'][_0x0f2d('0x18')]);}return _0x3eb06f[_0x0f2d('0x43')](_0x54a97e);}})['then'](function(_0x1d587b){if(_0x1d587b){return _0x1d587b?{'count':_0x243e7d,'rows':_0x1d587b}:null;}})[_0x0f2d('0x20')](respondWithResult(_0x3d1429,null))[_0x0f2d('0x3e')](handleError(_0x3d1429,null));};exports[_0x0f2d('0x48')]=function(_0x2807a5,_0xcc88df,_0x3a2941){var _0x3bcb34={};var _0x5ef79b={};var _0x36f052;var _0xe20b0;return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x2807a5['params']['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0xcc88df,null))[_0x0f2d('0x20')](function(_0x3279ef){if(_0x3279ef){_0x36f052=_0x3279ef;_0x5ef79b['model']=_[_0x0f2d('0x2c')](db['DeskField']['rawAttributes']);_0x5ef79b[_0x0f2d('0x2b')]=_[_0x0f2d('0x2c')](_0x2807a5[_0x0f2d('0x2b')]);_0x5ef79b[_0x0f2d('0x2d')]=_[_0x0f2d('0x2e')](_0x5ef79b[_0x0f2d('0x2f')],_0x5ef79b[_0x0f2d('0x2b')]);_0x3bcb34[_0x0f2d('0x31')]=_['intersection'](_0x5ef79b[_0x0f2d('0x2f')],qs['fields'](_0x2807a5['query'][_0x0f2d('0x30')]));_0x3bcb34['attributes']=_0x3bcb34[_0x0f2d('0x31')]['length']?_0x3bcb34[_0x0f2d('0x31')]:_0x5ef79b[_0x0f2d('0x2f')];_0x3bcb34['order']=qs['sort'](_0x2807a5[_0x0f2d('0x2b')][_0x0f2d('0x36')]);_0x3bcb34[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_[_0x0f2d('0x47')](_0x2807a5[_0x0f2d('0x2b')],_0x5ef79b['filters']));if(_0x2807a5['query'][_0x0f2d('0x38')]){_0x3bcb34[_0x0f2d('0x37')]=_[_0x0f2d('0x40')](_0x3bcb34[_0x0f2d('0x37')],{'$or':_[_0x0f2d('0x25')](_0x3bcb34['attributes'],function(_0x32584a){var _0x15dd9e={};_0x15dd9e[_0x32584a]={'$like':'%'+_0x2807a5['query']['filter']+'%'};return _0x15dd9e;})});}_0x3bcb34=_[_0x0f2d('0x40')]({},_0x3bcb34,_0x2807a5[_0x0f2d('0x3a')]);return _0x36f052[_0x0f2d('0x48')](_0x3bcb34);}})['then'](function(_0x26f8b1){if(_0x26f8b1){_0xe20b0=_0x26f8b1[_0x0f2d('0x32')];if(!_0x2807a5['query']['hasOwnProperty'](_0x0f2d('0x34'))){_0x3bcb34[_0x0f2d('0x35')]=qs[_0x0f2d('0x35')](_0x2807a5[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x3bcb34['offset']=qs[_0x0f2d('0x18')](_0x2807a5[_0x0f2d('0x2b')][_0x0f2d('0x18')]);}return _0x36f052[_0x0f2d('0x48')](_0x3bcb34);}})[_0x0f2d('0x20')](function(_0x600739){if(_0x600739){return _0x600739?{'count':_0xe20b0,'rows':_0x600739}:null;}})['then'](respondWithResult(_0xcc88df,null))[_0x0f2d('0x3e')](handleError(_0xcc88df,null));};exports[_0x0f2d('0x49')]=function(_0x4e0dcd,_0x2b82ca,_0x21b1a4){var _0x25e331={};var _0x87d1b4={};var _0x183696;var _0x567402;return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x4e0dcd[_0x0f2d('0x3f')]['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0x2b82ca,null))[_0x0f2d('0x20')](function(_0x56467f){if(_0x56467f){_0x183696=_0x56467f;_0x87d1b4[_0x0f2d('0x2f')]=_['keys'](db['DeskField'][_0x0f2d('0x27')]);_0x87d1b4[_0x0f2d('0x2b')]=_[_0x0f2d('0x2c')](_0x4e0dcd[_0x0f2d('0x2b')]);_0x87d1b4[_0x0f2d('0x2d')]=_[_0x0f2d('0x2e')](_0x87d1b4[_0x0f2d('0x2f')],_0x87d1b4['query']);_0x25e331[_0x0f2d('0x31')]=_['intersection'](_0x87d1b4[_0x0f2d('0x2f')],qs[_0x0f2d('0x30')](_0x4e0dcd[_0x0f2d('0x2b')][_0x0f2d('0x30')]));_0x25e331[_0x0f2d('0x31')]=_0x25e331[_0x0f2d('0x31')][_0x0f2d('0x32')]?_0x25e331['attributes']:_0x87d1b4[_0x0f2d('0x2f')];_0x25e331[_0x0f2d('0x46')]=qs[_0x0f2d('0x36')](_0x4e0dcd['query'][_0x0f2d('0x36')]);_0x25e331[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_[_0x0f2d('0x47')](_0x4e0dcd[_0x0f2d('0x2b')],_0x87d1b4[_0x0f2d('0x2d')]));if(_0x4e0dcd['query'][_0x0f2d('0x38')]){_0x25e331['where']=_[_0x0f2d('0x40')](_0x25e331[_0x0f2d('0x37')],{'$or':_[_0x0f2d('0x25')](_0x25e331['attributes'],function(_0x23f4d7){var _0x53c3e7={};_0x53c3e7[_0x23f4d7]={'$like':'%'+_0x4e0dcd[_0x0f2d('0x2b')][_0x0f2d('0x38')]+'%'};return _0x53c3e7;})});}_0x25e331=_[_0x0f2d('0x40')]({},_0x25e331,_0x4e0dcd[_0x0f2d('0x3a')]);return _0x183696[_0x0f2d('0x49')](_0x25e331);}})['then'](function(_0xe5b926){if(_0xe5b926){_0x567402=_0xe5b926[_0x0f2d('0x32')];if(!_0x4e0dcd[_0x0f2d('0x2b')][_0x0f2d('0x33')]('nolimit')){_0x25e331['limit']=qs[_0x0f2d('0x35')](_0x4e0dcd[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x25e331[_0x0f2d('0x18')]=qs['offset'](_0x4e0dcd['query'][_0x0f2d('0x18')]);}return _0x183696[_0x0f2d('0x49')](_0x25e331);}})['then'](function(_0x346efc){if(_0x346efc){return _0x346efc?{'count':_0x567402,'rows':_0x346efc}:null;}})[_0x0f2d('0x20')](respondWithResult(_0x2b82ca,null))[_0x0f2d('0x3e')](handleError(_0x2b82ca,null));};exports[_0x0f2d('0x4a')]=function(_0x3296d0,_0x1e6ff6,_0xeddf6a){var _0x4c0737={};var _0x4366da={};var _0x24e5d8;var _0x1b5c55;return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x3296d0['params']['id']}})['then'](handleEntityNotFound(_0x1e6ff6,null))[_0x0f2d('0x20')](function(_0x278c90){if(_0x278c90){_0x24e5d8=_0x278c90;_0x4366da[_0x0f2d('0x2f')]=_[_0x0f2d('0x2c')](db[_0x0f2d('0x4b')][_0x0f2d('0x27')]);_0x4366da[_0x0f2d('0x2b')]=_[_0x0f2d('0x2c')](_0x3296d0[_0x0f2d('0x2b')]);_0x4366da[_0x0f2d('0x2d')]=_['intersection'](_0x4366da[_0x0f2d('0x2f')],_0x4366da['query']);_0x4c0737[_0x0f2d('0x31')]=_[_0x0f2d('0x2e')](_0x4366da[_0x0f2d('0x2f')],qs[_0x0f2d('0x30')](_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x30')]));_0x4c0737[_0x0f2d('0x31')]=_0x4c0737[_0x0f2d('0x31')]['length']?_0x4c0737[_0x0f2d('0x31')]:_0x4366da[_0x0f2d('0x2f')];_0x4c0737['order']=qs[_0x0f2d('0x36')](_0x3296d0['query']['sort']);_0x4c0737[_0x0f2d('0x37')]=qs[_0x0f2d('0x2d')](_[_0x0f2d('0x47')](_0x3296d0[_0x0f2d('0x2b')],_0x4366da[_0x0f2d('0x2d')]));if(_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x38')]){_0x4c0737[_0x0f2d('0x37')]=_[_0x0f2d('0x40')](_0x4c0737[_0x0f2d('0x37')],{'$or':_['map'](_0x4c0737[_0x0f2d('0x31')],function(_0x4fdad2){var _0x5b29ae={};_0x5b29ae[_0x4fdad2]={'$like':'%'+_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x38')]+'%'};return _0x5b29ae;})});}_0x4c0737=_[_0x0f2d('0x40')]({},_0x4c0737,_0x3296d0[_0x0f2d('0x3a')]);return _0x24e5d8[_0x0f2d('0x4a')](_0x4c0737);}})[_0x0f2d('0x20')](function(_0x19443e){if(_0x19443e){_0x1b5c55=_0x19443e[_0x0f2d('0x32')];if(!_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x33')](_0x0f2d('0x34'))){_0x4c0737[_0x0f2d('0x35')]=qs[_0x0f2d('0x35')](_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x35')]);_0x4c0737[_0x0f2d('0x18')]=qs[_0x0f2d('0x18')](_0x3296d0[_0x0f2d('0x2b')][_0x0f2d('0x18')]);}return _0x24e5d8[_0x0f2d('0x4a')](_0x4c0737);}})['then'](function(_0x5c03b1){if(_0x5c03b1){return _0x5c03b1?{'count':_0x1b5c55,'rows':_0x5c03b1}:null;}})['then'](respondWithResult(_0x1e6ff6,null))[_0x0f2d('0x3e')](handleError(_0x1e6ff6,null));};exports[_0x0f2d('0x4c')]=function(_0x3a8109,_0x3b46e5,_0x14a691){if(_0x3a8109[_0x0f2d('0x42')]['id']){delete _0x3a8109[_0x0f2d('0x42')]['id'];}return db[_0x0f2d('0x26')][_0x0f2d('0x44')]({'where':{'id':_0x3a8109[_0x0f2d('0x3f')]['id']}})[_0x0f2d('0x20')](handleEntityNotFound(_0x3b46e5,null))['then'](function(_0x17632f){if(_0x17632f){return _0x17632f['setTags'](_0x3a8109[_0x0f2d('0x42')][_0x0f2d('0x4d')]||[]);}return null;})[_0x0f2d('0x20')](respondWithResult(_0x3b46e5,null))[_0x0f2d('0x3e')](handleError(_0x3b46e5,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 302601a..fcdfd8d 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 _0x185a=['rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4f4a9b,_0x2ec5eb){var _0x4bf31b=function(_0xbc7fdd){while(--_0xbc7fdd){_0x4f4a9b['push'](_0x4f4a9b['shift']());}};_0x4bf31b(++_0x2ec5eb);}(_0x185a,0x157));var _0xa185=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x185a[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xa185('0x0'));var util=require(_0xa185('0x1'));var logger=require(_0xa185('0x2'))(_0xa185('0x3'));var moment=require(_0xa185('0x4'));var BPromise=require(_0xa185('0x5'));var rp=require(_0xa185('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa185('0x7'));var config=require(_0xa185('0x8'));var attributes=require(_0xa185('0x9'));module[_0xa185('0xa')]=function(_0x5cc0f8,_0x5f3b66){return _0x5cc0f8[_0xa185('0xb')](_0xa185('0xc'),attributes,{'tableName':_0xa185('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x364e=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','lodash'];(function(_0x1ecee6,_0x291f7a){var _0x2e2382=function(_0x533be3){while(--_0x533be3){_0x1ecee6['push'](_0x1ecee6['shift']());}};_0x2e2382(++_0x291f7a);}(_0x364e,0x99));var _0xe364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x364e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe364('0x0'));var util=require(_0xe364('0x1'));var logger=require(_0xe364('0x2'))(_0xe364('0x3'));var moment=require(_0xe364('0x4'));var BPromise=require('bluebird');var rp=require(_0xe364('0x5'));var fs=require('fs');var path=require(_0xe364('0x6'));var rimraf=require('rimraf');var config=require(_0xe364('0x7'));var attributes=require(_0xe364('0x8'));module[_0xe364('0x9')]=function(_0x2c08fb,_0x1f39e8){return _0x2c08fb[_0xe364('0xa')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 3204677..9818885 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 _0xccef=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x427b68,_0x182ea1){var _0x372f61=function(_0x23e42f){while(--_0x23e42f){_0x427b68['push'](_0x427b68['shift']());}};_0x372f61(++_0x182ea1);}(_0xccef,0x1d4));var _0xfcce=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xccef[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var moment=require('moment');var BPromise=require(_0xfcce('0x1'));var rs=require(_0xfcce('0x2'));var fs=require('fs');var Redis=require(_0xfcce('0x3'));var db=require(_0xfcce('0x4'))['db'];var utils=require(_0xfcce('0x5'));var logger=require(_0xfcce('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcce('0x7'));var client=jayson['client'][_0xfcce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd71971,_0x12d091,_0x4598c1){return new BPromise(function(_0x117bc3,_0x380c2c){return client[_0xfcce('0x9')](_0xd71971,_0x4598c1)['then'](function(_0x382ea5){logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));logger[_0xfcce('0xd')](_0xfcce('0xe'),_0x12d091,_0xfcce('0xc'),JSON[_0xfcce('0xf')](_0x382ea5));if(_0x382ea5[_0xfcce('0x10')]){if(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x11')]===0x1f4){logger['error'](_0xfcce('0xb'),_0x12d091,_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);return _0x380c2c(_0x382ea5[_0xfcce('0x10')]['message']);}logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x382ea5['error']['message']);return _0x117bc3(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);}else{logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));_0x117bc3(_0x382ea5[_0xfcce('0x13')][_0xfcce('0x12')]);}})[_0xfcce('0x14')](function(_0x2d7611){logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x2d7611);_0x380c2c(_0x2d7611);});});} \ No newline at end of file +var _0x4325=['http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0x19e28c,_0x5853bf){var _0x1d6fc7=function(_0x256c7c){while(--_0x256c7c){_0x19e28c['push'](_0x19e28c['shift']());}};_0x1d6fc7(++_0x5853bf);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index d2b61a5..4fcdc23 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 _0x07be=['show','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x20eda4,_0x4683b1){var _0x5f362f=function(_0x531024){while(--_0x531024){_0x20eda4['push'](_0x20eda4['shift']());}};_0x5f362f(++_0x4683b1);}(_0x07be,0x8a));var _0xe07b=function(_0x2a36d2,_0x42c42a){_0x2a36d2=_0x2a36d2-0x0;var _0x17d1b8=_0x07be[_0x2a36d2];return _0x17d1b8;};'use strict';var multer=require(_0xe07b('0x0'));var util=require(_0xe07b('0x1'));var path=require(_0xe07b('0x2'));var timeout=require(_0xe07b('0x3'));var express=require(_0xe07b('0x4'));var router=express[_0xe07b('0x5')]();var fs_extra=require(_0xe07b('0x6'));var auth=require(_0xe07b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe07b('0x8'));var controller=require(_0xe07b('0x9'));router[_0xe07b('0xa')]('/',auth[_0xe07b('0xb')](),controller[_0xe07b('0xc')]);router['get'](_0xe07b('0xd'),auth[_0xe07b('0xb')](),controller[_0xe07b('0xe')]);router[_0xe07b('0xf')]('/',auth[_0xe07b('0xb')](),controller['create']);router['put'](_0xe07b('0xd'),auth[_0xe07b('0xb')](),controller[_0xe07b('0x10')]);router['delete'](_0xe07b('0xd'),auth[_0xe07b('0xb')](),controller[_0xe07b('0x11')]);module[_0xe07b('0x12')]=router; \ No newline at end of file +var _0x6bae=['index','/:id','isAuthenticated','show','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x6bae,0x84));var _0xe6ba=function(_0x4ef2e6,_0x2f4a69){_0x4ef2e6=_0x4ef2e6-0x0;var _0x43ae02=_0x6bae[_0x4ef2e6];return _0x43ae02;};'use strict';var multer=require(_0xe6ba('0x0'));var util=require(_0xe6ba('0x1'));var path=require(_0xe6ba('0x2'));var timeout=require(_0xe6ba('0x3'));var express=require(_0xe6ba('0x4'));var router=express[_0xe6ba('0x5')]();var fs_extra=require(_0xe6ba('0x6'));var auth=require(_0xe6ba('0x7'));var interaction=require(_0xe6ba('0x8'));var config=require(_0xe6ba('0x9'));var controller=require(_0xe6ba('0xa'));router[_0xe6ba('0xb')]('/',auth['isAuthenticated'](),controller[_0xe6ba('0xc')]);router[_0xe6ba('0xb')](_0xe6ba('0xd'),auth[_0xe6ba('0xe')](),controller[_0xe6ba('0xf')]);router['post']('/',auth[_0xe6ba('0xe')](),controller['create']);router[_0xe6ba('0x10')](_0xe6ba('0xd'),auth[_0xe6ba('0xe')](),controller['update']);router['delete'](_0xe6ba('0xd'),auth[_0xe6ba('0xe')](),controller['destroy']);module[_0xe6ba('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e8f03a4..91448b5 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 _0x6155=['keyValue','picklist','string','STRING','variable','BOOLEAN','sequelize','exports','customVariable'];(function(_0x4672a3,_0x2e61cf){var _0x45b1b8=function(_0x426513){while(--_0x426513){_0x4672a3['push'](_0x4672a3['shift']());}};_0x45b1b8(++_0x2e61cf);}(_0x6155,0x12f));var _0x5615=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x6155[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x5615('0x0'));module[_0x5615('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x5615('0x2'),_0x5615('0x3'),_0x5615('0x4')),'defaultValue':_0x5615('0x5')},'content':{'type':Sequelize[_0x5615('0x6')]},'key':{'type':Sequelize[_0x5615('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x5615('0x5'),_0x5615('0x7'),_0x5615('0x2'))},'keyContent':{'type':Sequelize[_0x5615('0x6')]},'idField':{'type':Sequelize[_0x5615('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5615('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5615('0x6')]}}; \ No newline at end of file +var _0x6754=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x6754,0x135));var _0x4675=function(_0x5da73f,_0x592980){_0x5da73f=_0x5da73f-0x0;var _0x1b3d73=_0x6754[_0x5da73f];return _0x1b3d73;};'use strict';var Sequelize=require('sequelize');module[_0x4675('0x0')]={'type':{'type':Sequelize[_0x4675('0x1')](_0x4675('0x2'),_0x4675('0x3'),_0x4675('0x4'),_0x4675('0x5'),'picklist'),'defaultValue':_0x4675('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4675('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4675('0x2'),_0x4675('0x3'),_0x4675('0x4'))},'keyContent':{'type':Sequelize[_0x4675('0x6')]},'idField':{'type':Sequelize[_0x4675('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4675('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4675('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 88dddf4..296d402 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 _0x1c08=['api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','type','key','name','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskField','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x66c2d8,_0x532bbc){var _0x186bd5=function(_0x457ee6){while(--_0x457ee6){_0x66c2d8['push'](_0x66c2d8['shift']());}};_0x186bd5(++_0x532bbc);}(_0x1c08,0x11c));var _0x81c0=function(_0x304fe0,_0x430c48){_0x304fe0=_0x304fe0-0x0;var _0x1649f8=_0x1c08[_0x304fe0];return _0x1649f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81c0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81c0('0x1'));var rp=require(_0x81c0('0x2'));var moment=require(_0x81c0('0x3'));var BPromise=require(_0x81c0('0x4'));var Mustache=require(_0x81c0('0x5'));var util=require(_0x81c0('0x6'));var path=require(_0x81c0('0x7'));var sox=require(_0x81c0('0x8'));var csv=require('to-csv');var ejs=require(_0x81c0('0x9'));var fs=require('fs');var fs_extra=require(_0x81c0('0xa'));var _=require('lodash');var squel=require(_0x81c0('0xb'));var crypto=require(_0x81c0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x81c0('0xd'));var querystring=require(_0x81c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x81c0('0xf'));var authService=require(_0x81c0('0x10'));var qs=require(_0x81c0('0x11'));var as=require(_0x81c0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81c0('0x13'))(_0x81c0('0x14'));var utils=require('../../config/utils');var config=require(_0x81c0('0x15'));var licenseUtil=require(_0x81c0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x246354,_0x478822){_0x478822=_0x478822||0xcc;return function(_0x28c17d){if(_0x28c17d){return _0x246354[_0x81c0('0x17')](_0x478822);}return _0x246354[_0x81c0('0x18')](_0x478822)[_0x81c0('0x19')]();};}function respondWithResult(_0x5bf020,_0x4e7a27){_0x4e7a27=_0x4e7a27||0xc8;return function(_0x25504f){if(_0x25504f){return _0x5bf020[_0x81c0('0x18')](_0x4e7a27)[_0x81c0('0x1a')](_0x25504f);}};}function respondWithFilteredResult(_0x470978,_0x18cd36){return function(_0x1bbd1a){if(_0x1bbd1a){var _0x151c5f=typeof _0x18cd36[_0x81c0('0x1b')]===_0x81c0('0x1c')&&typeof _0x18cd36[_0x81c0('0x1d')]===_0x81c0('0x1c');var _0x3b814c=_0x1bbd1a[_0x81c0('0x1e')];var _0x189b3c=_0x151c5f?0x0:_0x18cd36[_0x81c0('0x1b')];var _0x42a2b5=_0x151c5f?_0x1bbd1a[_0x81c0('0x1e')]:_0x18cd36['offset']+_0x18cd36[_0x81c0('0x1d')];var _0x51c17e;if(_0x42a2b5>=_0x3b814c){_0x42a2b5=_0x3b814c;_0x51c17e=0xc8;}else{_0x51c17e=0xce;}_0x470978['status'](_0x51c17e);return _0x470978[_0x81c0('0x1f')]('Content-Range',_0x189b3c+'-'+_0x42a2b5+'/'+_0x3b814c)[_0x81c0('0x1a')](_0x1bbd1a);}return null;};}function patchUpdates(_0x249982){return function(_0x41ea24){try{jsonpatch[_0x81c0('0x20')](_0x41ea24,_0x249982,!![]);}catch(_0x1ab8b7){return BPromise[_0x81c0('0x21')](_0x1ab8b7);}return _0x41ea24[_0x81c0('0x22')]();};}function saveUpdates(_0x4d725c,_0x5723e8){return function(_0x3aa24e){if(_0x3aa24e){return _0x3aa24e[_0x81c0('0x23')](_0x4d725c)[_0x81c0('0x24')](function(_0x420e71){return _0x420e71;});}return null;};}function removeEntity(_0x15fc7e,_0x5cea19){return function(_0x269434){if(_0x269434){return _0x269434[_0x81c0('0x25')]()[_0x81c0('0x24')](function(){_0x15fc7e[_0x81c0('0x18')](0xcc)[_0x81c0('0x19')]();});}};}function handleEntityNotFound(_0x294f78,_0x1fa346){return function(_0x10269b){if(!_0x10269b){_0x294f78[_0x81c0('0x17')](0x194);}return _0x10269b;};}function handleError(_0x53b2d6,_0x360100){_0x360100=_0x360100||0x1f4;return function(_0x3231bc){logger[_0x81c0('0x26')](_0x3231bc[_0x81c0('0x27')]);if(_0x3231bc['name']){delete _0x3231bc['name'];}_0x53b2d6['status'](_0x360100)[_0x81c0('0x28')](_0x3231bc);};}exports[_0x81c0('0x29')]=function(_0x557539,_0x30adc0){var _0x13541b={},_0x1527d6={},_0x1c65aa={'count':0x0,'rows':[]};var _0x534865=_[_0x81c0('0x2a')](db['DeskField'][_0x81c0('0x2b')],function(_0x17a44a){return{'name':_0x17a44a['fieldName'],'type':_0x17a44a[_0x81c0('0x2c')][_0x81c0('0x2d')]};});_0x1527d6['model']=_[_0x81c0('0x2a')](_0x534865,_0x81c0('0x2e'));_0x1527d6[_0x81c0('0x2f')]=_[_0x81c0('0x30')](_0x557539[_0x81c0('0x2f')]);_0x1527d6[_0x81c0('0x31')]=_[_0x81c0('0x32')](_0x1527d6['model'],_0x1527d6[_0x81c0('0x2f')]);_0x13541b['attributes']=_[_0x81c0('0x32')](_0x1527d6['model'],qs[_0x81c0('0x33')](_0x557539[_0x81c0('0x2f')][_0x81c0('0x33')]));_0x13541b[_0x81c0('0x34')]=_0x13541b[_0x81c0('0x34')]['length']?_0x13541b[_0x81c0('0x34')]:_0x1527d6[_0x81c0('0x35')];if(!_0x557539['query'][_0x81c0('0x36')](_0x81c0('0x37'))){_0x13541b[_0x81c0('0x1d')]=qs['limit'](_0x557539['query']['limit']);_0x13541b[_0x81c0('0x1b')]=qs['offset'](_0x557539['query'][_0x81c0('0x1b')]);}_0x13541b[_0x81c0('0x38')]=qs[_0x81c0('0x39')](_0x557539[_0x81c0('0x2f')][_0x81c0('0x39')]);_0x13541b['where']=qs['filters'](_[_0x81c0('0x3a')](_0x557539['query'],_0x1527d6[_0x81c0('0x31')]),_0x534865);if(_0x557539[_0x81c0('0x2f')][_0x81c0('0x3b')]){_0x13541b[_0x81c0('0x3c')]=_[_0x81c0('0x3d')](_0x13541b[_0x81c0('0x3c')],{'$or':_[_0x81c0('0x2a')](_0x534865,function(_0x75e5dd){if(_0x75e5dd['type']!==_0x81c0('0x3e')){var _0x14379f={};_0x14379f[_0x75e5dd[_0x81c0('0x2e')]]={'$like':'%'+_0x557539[_0x81c0('0x2f')][_0x81c0('0x3b')]+'%'};return _0x14379f;}})});}_0x13541b=_['merge']({},_0x13541b,_0x557539[_0x81c0('0x3f')]);var _0xd9ad80={'where':_0x13541b[_0x81c0('0x3c')]};return db[_0x81c0('0x40')][_0x81c0('0x1e')](_0xd9ad80)[_0x81c0('0x24')](function(_0x4a5680){_0x1c65aa['count']=_0x4a5680;if(_0x557539[_0x81c0('0x2f')]['includeAll']){_0x13541b[_0x81c0('0x41')]=[{'all':!![]}];}return db['DeskField'][_0x81c0('0x42')](_0x13541b);})[_0x81c0('0x24')](function(_0x160734){_0x1c65aa[_0x81c0('0x43')]=_0x160734;return _0x1c65aa;})['then'](respondWithFilteredResult(_0x30adc0,_0x13541b))[_0x81c0('0x44')](handleError(_0x30adc0,null));};exports[_0x81c0('0x45')]=function(_0x38e1af,_0xca8209){var _0x32656a={'raw':!![],'where':{'id':_0x38e1af[_0x81c0('0x46')]['id']}},_0x3cb4cc={};_0x3cb4cc[_0x81c0('0x35')]=_[_0x81c0('0x30')](db[_0x81c0('0x40')][_0x81c0('0x2b')]);_0x3cb4cc[_0x81c0('0x2f')]=_[_0x81c0('0x30')](_0x38e1af[_0x81c0('0x2f')]);_0x3cb4cc[_0x81c0('0x31')]=_['intersection'](_0x3cb4cc[_0x81c0('0x35')],_0x3cb4cc['query']);_0x32656a[_0x81c0('0x34')]=_['intersection'](_0x3cb4cc[_0x81c0('0x35')],qs['fields'](_0x38e1af[_0x81c0('0x2f')][_0x81c0('0x33')]));_0x32656a[_0x81c0('0x34')]=_0x32656a[_0x81c0('0x34')][_0x81c0('0x47')]?_0x32656a[_0x81c0('0x34')]:_0x3cb4cc[_0x81c0('0x35')];if(_0x38e1af[_0x81c0('0x2f')][_0x81c0('0x48')]){_0x32656a[_0x81c0('0x41')]=[{'all':!![]}];}_0x32656a=_[_0x81c0('0x3d')]({},_0x32656a,_0x38e1af['options']);return db[_0x81c0('0x40')][_0x81c0('0x49')](_0x32656a)['then'](handleEntityNotFound(_0xca8209,null))[_0x81c0('0x24')](respondWithResult(_0xca8209,null))[_0x81c0('0x44')](handleError(_0xca8209,null));};exports[_0x81c0('0x4a')]=function(_0x3944a3,_0x52bab5){return db[_0x81c0('0x40')][_0x81c0('0x4a')](_0x3944a3[_0x81c0('0x4b')],{})[_0x81c0('0x24')](respondWithResult(_0x52bab5,0xc9))[_0x81c0('0x44')](handleError(_0x52bab5,null));};exports[_0x81c0('0x23')]=function(_0x53bf41,_0x41365f){if(_0x53bf41[_0x81c0('0x4b')]['id']){delete _0x53bf41[_0x81c0('0x4b')]['id'];}return db[_0x81c0('0x40')]['find']({'where':{'id':_0x53bf41[_0x81c0('0x46')]['id']}})[_0x81c0('0x24')](handleEntityNotFound(_0x41365f,null))[_0x81c0('0x24')](saveUpdates(_0x53bf41[_0x81c0('0x4b')],null))[_0x81c0('0x24')](respondWithResult(_0x41365f,null))[_0x81c0('0x44')](handleError(_0x41365f,null));};exports[_0x81c0('0x25')]=function(_0x49cd74,_0x38d725){return db[_0x81c0('0x40')][_0x81c0('0x49')]({'where':{'id':_0x49cd74['params']['id']}})[_0x81c0('0x24')](handleEntityNotFound(_0x38d725,null))['then'](removeEntity(_0x38d725,null))[_0x81c0('0x44')](handleError(_0x38d725,null));}; \ No newline at end of file +var _0xa786=['destroy','end','stack','name','send','index','DeskField','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','update','then'];(function(_0x15b721,_0x2da3ab){var _0x275ace=function(_0x403c5d){while(--_0x403c5d){_0x15b721['push'](_0x15b721['shift']());}};_0x275ace(++_0x2da3ab);}(_0xa786,0x71));var _0x6a78=function(_0x4d5078,_0x4d00a3){_0x4d5078=_0x4d5078-0x0;var _0x3fb1a5=_0xa786[_0x4d5078];return _0x3fb1a5;};'use strict';var emlformat=require(_0x6a78('0x0'));var rimraf=require(_0x6a78('0x1'));var zipdir=require(_0x6a78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a78('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a78('0x4'));var util=require(_0x6a78('0x5'));var path=require(_0x6a78('0x6'));var sox=require(_0x6a78('0x7'));var csv=require(_0x6a78('0x8'));var ejs=require(_0x6a78('0x9'));var fs=require('fs');var fs_extra=require(_0x6a78('0xa'));var _=require('lodash');var squel=require(_0x6a78('0xb'));var crypto=require(_0x6a78('0xc'));var jsforce=require(_0x6a78('0xd'));var deskjs=require(_0x6a78('0xe'));var toCsv=require(_0x6a78('0x8'));var querystring=require(_0x6a78('0xf'));var Papa=require(_0x6a78('0x10'));var Redis=require(_0x6a78('0x11'));var authService=require(_0x6a78('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a78('0x13'));var hardwareService=require(_0x6a78('0x14'));var logger=require(_0x6a78('0x15'))('api');var utils=require(_0x6a78('0x16'));var config=require(_0x6a78('0x17'));var licenseUtil=require(_0x6a78('0x18'));var db=require(_0x6a78('0x19'))['db'];function respondWithStatusCode(_0x1fd1be,_0x5b633c){_0x5b633c=_0x5b633c||0xcc;return function(_0x24a60a){if(_0x24a60a){return _0x1fd1be[_0x6a78('0x1a')](_0x5b633c);}return _0x1fd1be[_0x6a78('0x1b')](_0x5b633c)['end']();};}function respondWithResult(_0x44c863,_0xecf980){_0xecf980=_0xecf980||0xc8;return function(_0x4c5351){if(_0x4c5351){return _0x44c863[_0x6a78('0x1b')](_0xecf980)[_0x6a78('0x1c')](_0x4c5351);}};}function respondWithFilteredResult(_0xe27467,_0x40ef48){return function(_0x3deede){if(_0x3deede){var _0x36e824=typeof _0x40ef48['offset']===_0x6a78('0x1d')&&typeof _0x40ef48[_0x6a78('0x1e')]===_0x6a78('0x1d');var _0x265f90=_0x3deede['count'];var _0x5e3616=_0x36e824?0x0:_0x40ef48[_0x6a78('0x1f')];var _0x585917=_0x36e824?_0x3deede['count']:_0x40ef48['offset']+_0x40ef48[_0x6a78('0x1e')];var _0xed3863;if(_0x585917>=_0x265f90){_0x585917=_0x265f90;_0xed3863=0xc8;}else{_0xed3863=0xce;}_0xe27467[_0x6a78('0x1b')](_0xed3863);return _0xe27467['set']('Content-Range',_0x5e3616+'-'+_0x585917+'/'+_0x265f90)[_0x6a78('0x1c')](_0x3deede);}return null;};}function patchUpdates(_0x29dec5){return function(_0x356b93){try{jsonpatch[_0x6a78('0x20')](_0x356b93,_0x29dec5,!![]);}catch(_0x5dc3fa){return BPromise['reject'](_0x5dc3fa);}return _0x356b93['save']();};}function saveUpdates(_0xd57884,_0x5869fd){return function(_0xd938cd){if(_0xd938cd){return _0xd938cd[_0x6a78('0x21')](_0xd57884)[_0x6a78('0x22')](function(_0x4b47b6){return _0x4b47b6;});}return null;};}function removeEntity(_0x49f711,_0xa5f42f){return function(_0x89fd2b){if(_0x89fd2b){return _0x89fd2b[_0x6a78('0x23')]()[_0x6a78('0x22')](function(){_0x49f711[_0x6a78('0x1b')](0xcc)[_0x6a78('0x24')]();});}};}function handleEntityNotFound(_0xefaa55,_0x4ea33e){return function(_0x28cbbf){if(!_0x28cbbf){_0xefaa55[_0x6a78('0x1a')](0x194);}return _0x28cbbf;};}function handleError(_0x1e91ad,_0x57a859){_0x57a859=_0x57a859||0x1f4;return function(_0x19860c){logger['error'](_0x19860c[_0x6a78('0x25')]);if(_0x19860c[_0x6a78('0x26')]){delete _0x19860c['name'];}_0x1e91ad[_0x6a78('0x1b')](_0x57a859)[_0x6a78('0x27')](_0x19860c);};}exports[_0x6a78('0x28')]=function(_0x149105,_0x5942c0){var _0x8bc302={},_0x125ca2={},_0x273a73={'count':0x0,'rows':[]};var _0x12e0c5=_['map'](db[_0x6a78('0x29')][_0x6a78('0x2a')],function(_0x3299c2){return{'name':_0x3299c2['fieldName'],'type':_0x3299c2[_0x6a78('0x2b')][_0x6a78('0x2c')]};});_0x125ca2['model']=_[_0x6a78('0x2d')](_0x12e0c5,_0x6a78('0x26'));_0x125ca2[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0x149105[_0x6a78('0x2e')]);_0x125ca2['filters']=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],_0x125ca2['query']);_0x8bc302[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0x125ca2[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x33')]));_0x8bc302['attributes']=_0x8bc302[_0x6a78('0x32')]['length']?_0x8bc302[_0x6a78('0x32')]:_0x125ca2[_0x6a78('0x31')];if(!_0x149105[_0x6a78('0x2e')][_0x6a78('0x34')](_0x6a78('0x35'))){_0x8bc302[_0x6a78('0x1e')]=qs[_0x6a78('0x1e')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x1e')]);_0x8bc302['offset']=qs['offset'](_0x149105[_0x6a78('0x2e')]['offset']);}_0x8bc302[_0x6a78('0x36')]=qs[_0x6a78('0x37')](_0x149105[_0x6a78('0x2e')][_0x6a78('0x37')]);_0x8bc302[_0x6a78('0x38')]=qs[_0x6a78('0x39')](_[_0x6a78('0x3a')](_0x149105[_0x6a78('0x2e')],_0x125ca2['filters']),_0x12e0c5);if(_0x149105[_0x6a78('0x2e')][_0x6a78('0x3b')]){_0x8bc302[_0x6a78('0x38')]=_['merge'](_0x8bc302[_0x6a78('0x38')],{'$or':_['map'](_0x12e0c5,function(_0x310ab2){if(_0x310ab2[_0x6a78('0x2b')]!==_0x6a78('0x3c')){var _0xe180fb={};_0xe180fb[_0x310ab2['name']]={'$like':'%'+_0x149105['query']['filter']+'%'};return _0xe180fb;}})});}_0x8bc302=_[_0x6a78('0x3d')]({},_0x8bc302,_0x149105[_0x6a78('0x3e')]);var _0x48eafa={'where':_0x8bc302[_0x6a78('0x38')]};return db[_0x6a78('0x29')][_0x6a78('0x3f')](_0x48eafa)[_0x6a78('0x22')](function(_0x44d5f7){_0x273a73[_0x6a78('0x3f')]=_0x44d5f7;if(_0x149105['query'][_0x6a78('0x40')]){_0x8bc302[_0x6a78('0x41')]=[{'all':!![]}];}return db[_0x6a78('0x29')][_0x6a78('0x42')](_0x8bc302);})[_0x6a78('0x22')](function(_0x23dcce){_0x273a73[_0x6a78('0x43')]=_0x23dcce;return _0x273a73;})['then'](respondWithFilteredResult(_0x5942c0,_0x8bc302))[_0x6a78('0x44')](handleError(_0x5942c0,null));};exports['show']=function(_0xeddf03,_0x4d3aec){var _0x526f09={'raw':!![],'where':{'id':_0xeddf03[_0x6a78('0x45')]['id']}},_0xc8f3e8={};_0xc8f3e8['model']=_[_0x6a78('0x2f')](db[_0x6a78('0x29')][_0x6a78('0x2a')]);_0xc8f3e8[_0x6a78('0x2e')]=_[_0x6a78('0x2f')](_0xeddf03['query']);_0xc8f3e8['filters']=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],_0xc8f3e8[_0x6a78('0x2e')]);_0x526f09[_0x6a78('0x32')]=_[_0x6a78('0x30')](_0xc8f3e8[_0x6a78('0x31')],qs[_0x6a78('0x33')](_0xeddf03['query'][_0x6a78('0x33')]));_0x526f09[_0x6a78('0x32')]=_0x526f09['attributes'][_0x6a78('0x46')]?_0x526f09[_0x6a78('0x32')]:_0xc8f3e8[_0x6a78('0x31')];if(_0xeddf03[_0x6a78('0x2e')][_0x6a78('0x40')]){_0x526f09[_0x6a78('0x41')]=[{'all':!![]}];}_0x526f09=_['merge']({},_0x526f09,_0xeddf03[_0x6a78('0x3e')]);return db[_0x6a78('0x29')][_0x6a78('0x47')](_0x526f09)[_0x6a78('0x22')](handleEntityNotFound(_0x4d3aec,null))[_0x6a78('0x22')](respondWithResult(_0x4d3aec,null))['catch'](handleError(_0x4d3aec,null));};exports[_0x6a78('0x48')]=function(_0x59a4c1,_0x1bdd6b){return db[_0x6a78('0x29')]['create'](_0x59a4c1[_0x6a78('0x49')],{})['then'](respondWithResult(_0x1bdd6b,0xc9))[_0x6a78('0x44')](handleError(_0x1bdd6b,null));};exports[_0x6a78('0x21')]=function(_0xe40d18,_0x46c94e){if(_0xe40d18[_0x6a78('0x49')]['id']){delete _0xe40d18['body']['id'];}return db['DeskField'][_0x6a78('0x47')]({'where':{'id':_0xe40d18[_0x6a78('0x45')]['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x46c94e,null))[_0x6a78('0x22')](saveUpdates(_0xe40d18['body'],null))[_0x6a78('0x22')](respondWithResult(_0x46c94e,null))[_0x6a78('0x44')](handleError(_0x46c94e,null));};exports[_0x6a78('0x23')]=function(_0x57c0c4,_0x57bd8a){return db[_0x6a78('0x29')]['find']({'where':{'id':_0x57c0c4['params']['id']}})[_0x6a78('0x22')](handleEntityNotFound(_0x57bd8a,null))[_0x6a78('0x22')](removeEntity(_0x57bd8a,null))[_0x6a78('0x44')](handleError(_0x57bd8a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d6e5735..1dd7db8 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 _0x54d3=['../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3bc8c5,_0x232f25){var _0x1aaa72=function(_0x198dca){while(--_0x198dca){_0x3bc8c5['push'](_0x3bc8c5['shift']());}};_0x1aaa72(++_0x232f25);}(_0x54d3,0x117));var _0x354d=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x54d3[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x354d('0x0'));var util=require(_0x354d('0x1'));var logger=require(_0x354d('0x2'))(_0x354d('0x3'));var moment=require(_0x354d('0x4'));var BPromise=require(_0x354d('0x5'));var rp=require(_0x354d('0x6'));var fs=require('fs');var path=require(_0x354d('0x7'));var rimraf=require(_0x354d('0x8'));var config=require(_0x354d('0x9'));var attributes=require('./intDeskField.attributes');module[_0x354d('0xa')]=function(_0x5c0fab,_0xadd2ee){return _0x5c0fab[_0x354d('0xb')](_0x354d('0xc'),attributes,{'tableName':_0x354d('0xd'),'paranoid':![],'indexes':[{'name':_0x354d('0xe'),'fields':[_0x354d('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e3=['bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0xfcfc24,_0x48ca53){var _0x58f773=function(_0x263b5f){while(--_0x263b5f){_0xfcfc24['push'](_0xfcfc24['shift']());}};_0x58f773(++_0x48ca53);}(_0x70e3,0x6c));var _0x370e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x70e3[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x370e('0x0'));var util=require('util');var logger=require(_0x370e('0x1'))(_0x370e('0x2'));var moment=require(_0x370e('0x3'));var BPromise=require(_0x370e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x370e('0x5'));var rimraf=require(_0x370e('0x6'));var config=require(_0x370e('0x7'));var attributes=require(_0x370e('0x8'));module[_0x370e('0x9')]=function(_0x4cbd9a,_0x1099d7){return _0x4cbd9a[_0x370e('0xa')](_0x370e('0xb'),attributes,{'tableName':_0x370e('0xc'),'paranoid':![],'indexes':[{'name':_0x370e('0xd'),'fields':[_0x370e('0xe'),_0x370e('0xf')],'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 830e3d1..1f051ae 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 _0xd2a2=['catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','code','error','DeskField,\x20%s,\x20%s','message','info'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0xd2a2,0x141));var _0x2d2a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd2a2[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2d2a('0x0'));var util=require(_0x2d2a('0x1'));var moment=require(_0x2d2a('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d2a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d2a('0x4'))(_0x2d2a('0x5'));var config=require(_0x2d2a('0x6'));var jayson=require(_0x2d2a('0x7'));var client=jayson[_0x2d2a('0x8')][_0x2d2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9a85c8,_0x447c08,_0x41f0ba){return new BPromise(function(_0x3f7adf,_0x46990d){return client['request'](_0x9a85c8,_0x41f0ba)[_0x2d2a('0xa')](function(_0x3f16ac){logger['info']('DeskField,\x20%s,\x20%s',_0x447c08,_0x2d2a('0xb'));logger[_0x2d2a('0xc')](_0x2d2a('0xd'),_0x447c08,'request\x20sent',JSON['stringify'](_0x3f16ac));if(_0x3f16ac['error']){if(_0x3f16ac['error'][_0x2d2a('0xe')]===0x1f4){logger[_0x2d2a('0xf')](_0x2d2a('0x10'),_0x447c08,_0x3f16ac['error'][_0x2d2a('0x11')]);return _0x46990d(_0x3f16ac[_0x2d2a('0xf')][_0x2d2a('0x11')]);}logger[_0x2d2a('0xf')](_0x2d2a('0x10'),_0x447c08,_0x3f16ac[_0x2d2a('0xf')][_0x2d2a('0x11')]);return _0x3f7adf(_0x3f16ac[_0x2d2a('0xf')][_0x2d2a('0x11')]);}else{logger[_0x2d2a('0x12')](_0x2d2a('0x10'),_0x447c08,_0x2d2a('0xb'));_0x3f7adf(_0x3f16ac['result'][_0x2d2a('0x11')]);}})[_0x2d2a('0x13')](function(_0x25ed60){logger['error']('DeskField,\x20%s,\x20%s',_0x447c08,_0x25ed60);_0x46990d(_0x25ed60);});});} \ No newline at end of file +var _0xa17f=['../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa17f,0x15e));var _0xfa17=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0xa17f[_0x25fc41];return _0x1371d1;};'use strict';var _=require('lodash');var util=require(_0xfa17('0x0'));var moment=require(_0xfa17('0x1'));var BPromise=require(_0xfa17('0x2'));var rs=require(_0xfa17('0x3'));var fs=require('fs');var Redis=require(_0xfa17('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfa17('0x5'))(_0xfa17('0x6'));var config=require(_0xfa17('0x7'));var jayson=require(_0xfa17('0x8'));var client=jayson['client'][_0xfa17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6908e6,_0x5dac2d,_0x42f9d3){return new BPromise(function(_0x8037f9,_0x176f53){return client[_0xfa17('0xa')](_0x6908e6,_0x42f9d3)[_0xfa17('0xb')](function(_0x3e47f5){logger[_0xfa17('0xc')](_0xfa17('0xd'),_0x5dac2d,_0xfa17('0xe'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x5dac2d,'request\x20sent',JSON[_0xfa17('0xf')](_0x3e47f5));if(_0x3e47f5['error']){if(_0x3e47f5[_0xfa17('0x10')][_0xfa17('0x11')]===0x1f4){logger[_0xfa17('0x10')]('DeskField,\x20%s,\x20%s',_0x5dac2d,_0x3e47f5[_0xfa17('0x10')][_0xfa17('0x12')]);return _0x176f53(_0x3e47f5[_0xfa17('0x10')][_0xfa17('0x12')]);}logger['error'](_0xfa17('0xd'),_0x5dac2d,_0x3e47f5[_0xfa17('0x10')]['message']);return _0x8037f9(_0x3e47f5[_0xfa17('0x10')][_0xfa17('0x12')]);}else{logger[_0xfa17('0xc')](_0xfa17('0xd'),_0x5dac2d,_0xfa17('0xe'));_0x8037f9(_0x3e47f5[_0xfa17('0x13')]['message']);}})[_0xfa17('0x14')](function(_0x4b8cc5){logger[_0xfa17('0x10')](_0xfa17('0xd'),_0x5dac2d,_0x4b8cc5);_0x176f53(_0x4b8cc5);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 48ddcdf..69b2cba 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 _0xc744=['get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x4c1c7f,_0x2c1b4c){var _0x5ae73c=function(_0x1e93cf){while(--_0x1e93cf){_0x4c1c7f['push'](_0x4c1c7f['shift']());}};_0x5ae73c(++_0x2c1b4c);}(_0xc744,0x170));var _0x4c74=function(_0x20654f,_0xf9e319){_0x20654f=_0x20654f-0x0;var _0x4f07f2=_0xc744[_0x20654f];return _0x4f07f2;};'use strict';var multer=require(_0x4c74('0x0'));var util=require(_0x4c74('0x1'));var path=require(_0x4c74('0x2'));var timeout=require(_0x4c74('0x3'));var express=require(_0x4c74('0x4'));var router=express[_0x4c74('0x5')]();var fs_extra=require(_0x4c74('0x6'));var auth=require(_0x4c74('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4c74('0x8'));var controller=require(_0x4c74('0x9'));router[_0x4c74('0xa')]('/',auth[_0x4c74('0xb')](),controller['index']);router[_0x4c74('0xa')](_0x4c74('0xc'),auth[_0x4c74('0xb')](),controller[_0x4c74('0xd')]);router[_0x4c74('0xa')](_0x4c74('0xe'),auth[_0x4c74('0xb')](),controller[_0x4c74('0xf')]);router[_0x4c74('0xa')]('/:id/fields',auth[_0x4c74('0xb')](),controller[_0x4c74('0x10')]);router[_0x4c74('0x11')]('/',auth[_0x4c74('0xb')](),controller['create']);router[_0x4c74('0x11')](_0x4c74('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4c74('0x12')](_0x4c74('0xc'),auth[_0x4c74('0xb')](),controller[_0x4c74('0x13')]);router[_0x4c74('0x14')](_0x4c74('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x410c=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3ff01e,_0x37205f){var _0x20b9cd=function(_0x7ec5d1){while(--_0x7ec5d1){_0x3ff01e['push'](_0x3ff01e['shift']());}};_0x20b9cd(++_0x37205f);}(_0x410c,0x1ee));var _0xc410=function(_0x388e41,_0x10cf99){_0x388e41=_0x388e41-0x0;var _0x2549cf=_0x410c[_0x388e41];return _0x2549cf;};'use strict';var multer=require('multer');var util=require(_0xc410('0x0'));var path=require(_0xc410('0x1'));var timeout=require(_0xc410('0x2'));var express=require(_0xc410('0x3'));var router=express[_0xc410('0x4')]();var fs_extra=require(_0xc410('0x5'));var auth=require(_0xc410('0x6'));var interaction=require(_0xc410('0x7'));var config=require(_0xc410('0x8'));var controller=require('./intDynamics365Account.controller');router[_0xc410('0x9')]('/',auth[_0xc410('0xa')](),controller[_0xc410('0xb')]);router[_0xc410('0x9')](_0xc410('0xc'),auth[_0xc410('0xa')](),controller[_0xc410('0xd')]);router[_0xc410('0x9')](_0xc410('0xe'),auth['isAuthenticated'](),controller[_0xc410('0xf')]);router[_0xc410('0x9')]('/:id/fields',auth[_0xc410('0xa')](),controller['getFields']);router[_0xc410('0x10')]('/',auth[_0xc410('0xa')](),controller[_0xc410('0x11')]);router[_0xc410('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc410('0x12')]('/:id',auth[_0xc410('0xa')](),controller[_0xc410('0x13')]);router['delete'](_0xc410('0xc'),auth['isAuthenticated'](),controller[_0xc410('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 77a715e..1e7204e 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 _0xd49d=['STRING','exports'];(function(_0xb78d8d,_0x3ebc1a){var _0x3a46bc=function(_0x2eb434){while(--_0x2eb434){_0xb78d8d['push'](_0xb78d8d['shift']());}};_0x3a46bc(++_0x3ebc1a);}(_0xd49d,0x83));var _0xdd49=function(_0x4c0b91,_0x401eab){_0x4c0b91=_0x4c0b91-0x0;var _0xb87209=_0xd49d[_0x4c0b91];return _0xb87209;};'use strict';var Sequelize=require('sequelize');module[_0xdd49('0x0')]={'name':{'type':Sequelize[_0xdd49('0x1')]},'username':{'type':Sequelize[_0xdd49('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xdd49('0x1')]},'tenantId':{'type':Sequelize[_0xdd49('0x1')]},'clientId':{'type':Sequelize[_0xdd49('0x1')]},'clientSecret':{'type':Sequelize[_0xdd49('0x1')]},'serverUrl':{'type':Sequelize[_0xdd49('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xdd49('0x1')]}}; \ No newline at end of file +var _0x34a7=['sequelize','exports','STRING'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x34a7,0x7b));var _0x734a=function(_0x1b8778,_0x39aa93){_0x1b8778=_0x1b8778-0x0;var _0x37bd28=_0x34a7[_0x1b8778];return _0x37bd28;};'use strict';var Sequelize=require(_0x734a('0x0'));module[_0x734a('0x1')]={'name':{'type':Sequelize[_0x734a('0x2')]},'username':{'type':Sequelize[_0x734a('0x2')]},'password':{'type':Sequelize[_0x734a('0x2')]},'remoteUri':{'type':Sequelize[_0x734a('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x734a('0x2')]},'clientSecret':{'type':Sequelize[_0x734a('0x2')]},'serverUrl':{'type':Sequelize[_0x734a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x734a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 491b3d5..8aec390 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 _0x2ce1=['intersection','include','find','create','body','update','params','getConfigurations','Dynamics365Configuration','order','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','ticketType','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidname','sentimentvalue','slainvokedidname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','username','password','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','format','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x2ce1,0x8b));var _0x12ce=function(_0x1d8572,_0x1d3ddb){_0x1d8572=_0x1d8572-0x0;var _0x54514e=_0x2ce1[_0x1d8572];return _0x54514e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x12ce('0x0'));var rp=require(_0x12ce('0x1'));var moment=require(_0x12ce('0x2'));var BPromise=require(_0x12ce('0x3'));var Mustache=require('mustache');var util=require(_0x12ce('0x4'));var path=require(_0x12ce('0x5'));var sox=require('sox');var csv=require(_0x12ce('0x6'));var ejs=require(_0x12ce('0x7'));var fs=require('fs');var fs_extra=require(_0x12ce('0x8'));var _=require('lodash');var squel=require(_0x12ce('0x9'));var crypto=require('crypto');var jsforce=require(_0x12ce('0xa'));var deskjs=require(_0x12ce('0xb'));var toCsv=require(_0x12ce('0x6'));var querystring=require('querystring');var Papa=require(_0x12ce('0xc'));var Redis=require(_0x12ce('0xd'));var authService=require(_0x12ce('0xe'));var qs=require(_0x12ce('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12ce('0x10'));var logger=require('../../config/logger')(_0x12ce('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x12ce('0x12'));var db=require(_0x12ce('0x13'))['db'];var integrations=require(_0x12ce('0x14'));function respondWithStatusCode(_0x3d274d,_0x3d1dd0){_0x3d1dd0=_0x3d1dd0||0xcc;return function(_0x3c288b){if(_0x3c288b){return _0x3d274d['sendStatus'](_0x3d1dd0);}return _0x3d274d[_0x12ce('0x15')](_0x3d1dd0)['end']();};}function respondWithResult(_0x12bcf2,_0x132867){_0x132867=_0x132867||0xc8;return function(_0x302e3e){if(_0x302e3e){return _0x12bcf2['status'](_0x132867)[_0x12ce('0x16')](_0x302e3e);}};}function respondWithFilteredResult(_0x288cff,_0x2ac396){return function(_0x39e4ec){if(_0x39e4ec){var _0x134831=typeof _0x2ac396[_0x12ce('0x17')]==='undefined'&&typeof _0x2ac396['limit']===_0x12ce('0x18');var _0x48250c=_0x39e4ec[_0x12ce('0x19')];var _0x2a0f3f=_0x134831?0x0:_0x2ac396['offset'];var _0x22ac52=_0x134831?_0x39e4ec['count']:_0x2ac396[_0x12ce('0x17')]+_0x2ac396['limit'];var _0xe24a11;if(_0x22ac52>=_0x48250c){_0x22ac52=_0x48250c;_0xe24a11=0xc8;}else{_0xe24a11=0xce;}_0x288cff['status'](_0xe24a11);return _0x288cff[_0x12ce('0x1a')]('Content-Range',_0x2a0f3f+'-'+_0x22ac52+'/'+_0x48250c)[_0x12ce('0x16')](_0x39e4ec);}return null;};}function patchUpdates(_0x521adb){return function(_0x52f813){try{jsonpatch[_0x12ce('0x1b')](_0x52f813,_0x521adb,!![]);}catch(_0x1744d6){return BPromise[_0x12ce('0x1c')](_0x1744d6);}return _0x52f813[_0x12ce('0x1d')]();};}function saveUpdates(_0x5cbb85,_0x162811){return function(_0xdd029a){if(_0xdd029a){return _0xdd029a['update'](_0x5cbb85)[_0x12ce('0x1e')](function(_0x4c86cd){return _0x4c86cd;});}return null;};}function removeEntity(_0x45a79c,_0x5c4f01){return function(_0x43c825){if(_0x43c825){return _0x43c825[_0x12ce('0x1f')]()[_0x12ce('0x1e')](function(){_0x45a79c[_0x12ce('0x15')](0xcc)[_0x12ce('0x20')]();});}};}function handleEntityNotFound(_0x186358,_0xb45ebe){return function(_0x2c99ab){if(!_0x2c99ab){_0x186358['sendStatus'](0x194);}return _0x2c99ab;};}function handleError(_0x492e77,_0x12c75e){_0x12c75e=_0x12c75e||0x1f4;return function(_0x9608af){logger[_0x12ce('0x21')](_0x9608af[_0x12ce('0x22')]);if(_0x9608af['name']){delete _0x9608af[_0x12ce('0x23')];}_0x492e77[_0x12ce('0x15')](_0x12c75e)[_0x12ce('0x24')](_0x9608af);};}exports[_0x12ce('0x25')]=function(_0x55ea43,_0x57fa70){var _0x4e511b={},_0x3ac1e3={},_0x10b653={'count':0x0,'rows':[]};var _0x54efb9=_[_0x12ce('0x26')](db[_0x12ce('0x27')][_0x12ce('0x28')],function(_0x18c305){return{'name':_0x18c305[_0x12ce('0x29')],'type':_0x18c305[_0x12ce('0x2a')][_0x12ce('0x2b')]};});_0x3ac1e3[_0x12ce('0x2c')]=_['map'](_0x54efb9,_0x12ce('0x23'));_0x3ac1e3[_0x12ce('0x2d')]=_[_0x12ce('0x2e')](_0x55ea43[_0x12ce('0x2d')]);_0x3ac1e3[_0x12ce('0x2f')]=_['intersection'](_0x3ac1e3[_0x12ce('0x2c')],_0x3ac1e3[_0x12ce('0x2d')]);_0x4e511b['attributes']=_['intersection'](_0x3ac1e3['model'],qs[_0x12ce('0x30')](_0x55ea43[_0x12ce('0x2d')][_0x12ce('0x30')]));_0x4e511b[_0x12ce('0x31')]=_0x4e511b[_0x12ce('0x31')][_0x12ce('0x32')]?_0x4e511b['attributes']:_0x3ac1e3[_0x12ce('0x2c')];if(!_0x55ea43[_0x12ce('0x2d')][_0x12ce('0x33')](_0x12ce('0x34'))){_0x4e511b[_0x12ce('0x35')]=qs[_0x12ce('0x35')](_0x55ea43[_0x12ce('0x2d')][_0x12ce('0x35')]);_0x4e511b['offset']=qs[_0x12ce('0x17')](_0x55ea43[_0x12ce('0x2d')][_0x12ce('0x17')]);}_0x4e511b['order']=qs[_0x12ce('0x36')](_0x55ea43[_0x12ce('0x2d')][_0x12ce('0x36')]);_0x4e511b['where']=qs[_0x12ce('0x2f')](_['pick'](_0x55ea43['query'],_0x3ac1e3[_0x12ce('0x2f')]),_0x54efb9);if(_0x55ea43['query'][_0x12ce('0x37')]){_0x4e511b[_0x12ce('0x38')]=_[_0x12ce('0x39')](_0x4e511b['where'],{'$or':_[_0x12ce('0x26')](_0x54efb9,function(_0x328980){if(_0x328980[_0x12ce('0x2a')]!==_0x12ce('0x3a')){var _0x332930={};_0x332930[_0x328980[_0x12ce('0x23')]]={'$like':'%'+_0x55ea43['query']['filter']+'%'};return _0x332930;}})});}_0x4e511b=_['merge']({},_0x4e511b,_0x55ea43[_0x12ce('0x3b')]);var _0x5c5367={'where':_0x4e511b[_0x12ce('0x38')]};return db['Dynamics365Account'][_0x12ce('0x19')](_0x5c5367)[_0x12ce('0x1e')](function(_0x80e31f){_0x10b653[_0x12ce('0x19')]=_0x80e31f;if(_0x55ea43[_0x12ce('0x2d')][_0x12ce('0x3c')]){_0x4e511b['include']=[{'all':!![]}];}return db[_0x12ce('0x27')][_0x12ce('0x3d')](_0x4e511b);})[_0x12ce('0x1e')](function(_0x490b9c){_0x10b653[_0x12ce('0x3e')]=_0x490b9c;return _0x10b653;})[_0x12ce('0x1e')](respondWithFilteredResult(_0x57fa70,_0x4e511b))[_0x12ce('0x3f')](handleError(_0x57fa70,null));};exports['show']=function(_0x5da8de,_0x357d92){var _0xc2bfad={'raw':![],'where':{'id':_0x5da8de['params']['id']}},_0x45a10b={};_0x45a10b[_0x12ce('0x2c')]=_[_0x12ce('0x2e')](db[_0x12ce('0x27')][_0x12ce('0x28')]);_0x45a10b[_0x12ce('0x2d')]=_[_0x12ce('0x2e')](_0x5da8de[_0x12ce('0x2d')]);_0x45a10b[_0x12ce('0x2f')]=_[_0x12ce('0x40')](_0x45a10b[_0x12ce('0x2c')],_0x45a10b[_0x12ce('0x2d')]);_0xc2bfad['attributes']=_['intersection'](_0x45a10b[_0x12ce('0x2c')],qs[_0x12ce('0x30')](_0x5da8de[_0x12ce('0x2d')]['fields']));_0xc2bfad['attributes']=_0xc2bfad['attributes'][_0x12ce('0x32')]?_0xc2bfad[_0x12ce('0x31')]:_0x45a10b[_0x12ce('0x2c')];if(_0x5da8de[_0x12ce('0x2d')][_0x12ce('0x3c')]){_0xc2bfad[_0x12ce('0x41')]=[{'all':!![]}];}_0xc2bfad=_[_0x12ce('0x39')]({},_0xc2bfad,_0x5da8de['options']);return db['Dynamics365Account'][_0x12ce('0x42')](_0xc2bfad)['then'](handleEntityNotFound(_0x357d92,null))[_0x12ce('0x1e')](respondWithResult(_0x357d92,null))[_0x12ce('0x3f')](handleError(_0x357d92,null));};exports[_0x12ce('0x43')]=function(_0xd17a37,_0x4bf956){return db[_0x12ce('0x27')]['create'](_0xd17a37[_0x12ce('0x44')],{})['then'](respondWithResult(_0x4bf956,0xc9))[_0x12ce('0x3f')](handleError(_0x4bf956,null));};exports[_0x12ce('0x45')]=function(_0x3a5849,_0x29acc3){if(_0x3a5849[_0x12ce('0x44')]['id']){delete _0x3a5849[_0x12ce('0x44')]['id'];}return db[_0x12ce('0x27')]['find']({'where':{'id':_0x3a5849['params']['id']}})[_0x12ce('0x1e')](handleEntityNotFound(_0x29acc3,null))[_0x12ce('0x1e')](saveUpdates(_0x3a5849['body'],null))['then'](respondWithResult(_0x29acc3,null))[_0x12ce('0x3f')](handleError(_0x29acc3,null));};exports[_0x12ce('0x1f')]=function(_0x7faa73,_0x3f5eef){return db[_0x12ce('0x27')][_0x12ce('0x42')]({'where':{'id':_0x7faa73[_0x12ce('0x46')]['id']}})[_0x12ce('0x1e')](handleEntityNotFound(_0x3f5eef,null))[_0x12ce('0x1e')](removeEntity(_0x3f5eef,null))[_0x12ce('0x3f')](handleError(_0x3f5eef,null));};exports[_0x12ce('0x47')]=function(_0x178a0a,_0x14b5f0,_0x4237f0){var _0x455f03={};var _0x4a4595={};var _0x4c4a5c;var _0x497187;return db[_0x12ce('0x27')]['findOne']({'where':{'id':_0x178a0a[_0x12ce('0x46')]['id']}})[_0x12ce('0x1e')](handleEntityNotFound(_0x14b5f0,null))['then'](function(_0x3a70a3){if(_0x3a70a3){_0x4c4a5c=_0x3a70a3;_0x4a4595[_0x12ce('0x2c')]=_[_0x12ce('0x2e')](db[_0x12ce('0x48')][_0x12ce('0x28')]);_0x4a4595[_0x12ce('0x2d')]=_[_0x12ce('0x2e')](_0x178a0a[_0x12ce('0x2d')]);_0x4a4595[_0x12ce('0x2f')]=_['intersection'](_0x4a4595[_0x12ce('0x2c')],_0x4a4595[_0x12ce('0x2d')]);_0x455f03['attributes']=_[_0x12ce('0x40')](_0x4a4595[_0x12ce('0x2c')],qs[_0x12ce('0x30')](_0x178a0a['query'][_0x12ce('0x30')]));_0x455f03[_0x12ce('0x31')]=_0x455f03['attributes'][_0x12ce('0x32')]?_0x455f03[_0x12ce('0x31')]:_0x4a4595[_0x12ce('0x2c')];_0x455f03[_0x12ce('0x49')]=qs[_0x12ce('0x36')](_0x178a0a['query'][_0x12ce('0x36')]);_0x455f03[_0x12ce('0x38')]=qs[_0x12ce('0x2f')](_['pick'](_0x178a0a[_0x12ce('0x2d')],_0x4a4595['filters']));if(_0x178a0a['query']['filter']){_0x455f03['where']=_[_0x12ce('0x39')](_0x455f03[_0x12ce('0x38')],{'$or':_[_0x12ce('0x26')](_0x455f03[_0x12ce('0x31')],function(_0x449df4){var _0x56e276={};_0x56e276[_0x449df4]={'$like':'%'+_0x178a0a['query'][_0x12ce('0x37')]+'%'};return _0x56e276;})});}_0x455f03=_[_0x12ce('0x39')]({},_0x455f03,_0x178a0a[_0x12ce('0x3b')]);return _0x4c4a5c[_0x12ce('0x47')](_0x455f03);}})[_0x12ce('0x1e')](function(_0x3073ae){if(_0x3073ae){_0x497187=_0x3073ae[_0x12ce('0x32')];if(!_0x178a0a['query'][_0x12ce('0x33')](_0x12ce('0x34'))){_0x455f03[_0x12ce('0x35')]=qs['limit'](_0x178a0a[_0x12ce('0x2d')][_0x12ce('0x35')]);_0x455f03['offset']=qs[_0x12ce('0x17')](_0x178a0a[_0x12ce('0x2d')]['offset']);}return _0x4c4a5c['getConfigurations'](_0x455f03);}})[_0x12ce('0x1e')](function(_0x5c2e63){if(_0x5c2e63){return _0x5c2e63?{'count':_0x497187,'rows':_0x5c2e63}:null;}})['then'](respondWithResult(_0x14b5f0,null))[_0x12ce('0x3f')](handleError(_0x14b5f0,null));};exports['addConfiguration']=function(_0x259f20,_0x3ffcdf,_0x153954){if(_0x259f20['body']['id']){delete _0x259f20[_0x12ce('0x44')]['id'];}return db[_0x12ce('0x27')][_0x12ce('0x4a')]({'where':{'id':_0x259f20[_0x12ce('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ffcdf,null))[_0x12ce('0x1e')](function(_0x5b0fe7){if(_0x5b0fe7){_0x259f20[_0x12ce('0x44')][_0x12ce('0x4b')]=_0x5b0fe7['id'];_0x259f20['body'][_0x12ce('0x4c')]=integrations[_0x12ce('0x4d')](_0x259f20[_0x12ce('0x44')][_0x12ce('0x4e')],_0x259f20[_0x12ce('0x44')][_0x12ce('0x2a')]);_0x259f20[_0x12ce('0x44')][_0x12ce('0x4f')]=integrations[_0x12ce('0x50')](_0x259f20[_0x12ce('0x44')][_0x12ce('0x4e')],_0x259f20[_0x12ce('0x44')][_0x12ce('0x2a')]);return db['Dynamics365Configuration'][_0x12ce('0x43')](_0x259f20[_0x12ce('0x44')],{'include':[{'model':db['Dynamics365Field'],'as':_0x12ce('0x4c')},{'model':db['Dynamics365Field'],'as':_0x12ce('0x4f')}]});}return null;})[_0x12ce('0x1e')](respondWithResult(_0x3ffcdf,null))[_0x12ce('0x3f')](handleError(_0x3ffcdf,null));};exports[_0x12ce('0x51')]=function(_0x360c80,_0x12d8d5,_0x5d934b){var _0x7fe407=_0x360c80[_0x12ce('0x2d')][_0x12ce('0x52')];var _0x367cba=_0x7fe407==='incident'?'Incident':_0x12ce('0x53');var _0x5d7a71='';var _0x1f7fa1='';var _0x40e114='';var _0x3ff175='';var _0x3bb78b='';var _0x48012e='';var _0x53d369='';var _0x90f4f8='';var _0x132235=[_0x12ce('0x54'),_0x12ce('0x55'),_0x12ce('0x56'),_0x12ce('0x57'),_0x12ce('0x58'),'subject',_0x12ce('0x59'),_0x12ce('0x5a'),_0x12ce('0x5b'),_0x12ce('0x5c')];var _0x447cc6=[_0x12ce('0x5d'),_0x12ce('0x5e'),_0x12ce('0x5f'),_0x12ce('0x60'),_0x12ce('0x61'),_0x12ce('0x62'),'contractdetailidname','contractidname',_0x12ce('0x63'),_0x12ce('0x64'),'createdbyname',_0x12ce('0x65'),_0x12ce('0x66'),_0x12ce('0x67'),_0x12ce('0x68'),_0x12ce('0x69'),_0x12ce('0x6a'),_0x12ce('0x6b'),_0x12ce('0x6c'),'entitlementidname',_0x12ce('0x6d'),_0x12ce('0x6e'),_0x12ce('0x6f'),_0x12ce('0x70'),_0x12ce('0x71'),_0x12ce('0x72'),_0x12ce('0x73'),'influencescore',_0x12ce('0x74'),_0x12ce('0x75'),_0x12ce('0x76'),_0x12ce('0x77'),'modifiedbyexternalpartyyominame',_0x12ce('0x78'),_0x12ce('0x79'),_0x12ce('0x7a'),_0x12ce('0x7b'),'modifiedonbehalfbyyominame',_0x12ce('0x7c'),'msdyn_iotalertname','numberofchildincidents',_0x12ce('0x7d'),_0x12ce('0x7e'),_0x12ce('0x7f'),'owneridtype','owneridyominame',_0x12ce('0x80'),_0x12ce('0x81'),_0x12ce('0x82'),_0x12ce('0x83'),_0x12ce('0x84'),_0x12ce('0x85'),_0x12ce('0x86'),'resolvebykpiidname','responseby',_0x12ce('0x87'),'responsiblecontactidyominame',_0x12ce('0x88'),_0x12ce('0x89'),'slaname',_0x12ce('0x8a'),_0x12ce('0x8b'),'statuscode',_0x12ce('0x8c'),_0x12ce('0x8d'),_0x12ce('0x8e'),_0x12ce('0x8f'),_0x12ce('0x90'),'utcconversiontimezonecode',_0x12ce('0x91')];var _0x4facd8=_0x132235['concat'](_0x447cc6);return db[_0x12ce('0x27')][_0x12ce('0x4a')]({'where':{'id':_0x360c80[_0x12ce('0x46')]['id']},'attributes':['id',_0x12ce('0x92'),_0x12ce('0x93'),_0x12ce('0x94'),'tenantId',_0x12ce('0x95'),_0x12ce('0x96')]})[_0x12ce('0x1e')](handleEntityNotFound(_0x12d8d5,null))[_0x12ce('0x1e')](function(_0x3a2e9a){if(_0x3a2e9a){_0x90f4f8=_0x3a2e9a['remoteUri'];var _0x1e1c30=_0x90f4f8[_0x12ce('0x97')](-0x1);if(_0x1e1c30==='/'){_0x90f4f8=_0x90f4f8[_0x12ce('0x98')](0x0,_0x90f4f8[_0x12ce('0x99')](_0x1e1c30));}_0x53d369=util[_0x12ce('0x9a')]('%s/api/data/v9.0/',_0x90f4f8);var _0x2c93d2={'method':_0x12ce('0x9b'),'uri':_0x12ce('0x9c')+_0x3a2e9a[_0x12ce('0x9d')]+_0x12ce('0x9e'),'form':{'client_id':_0x3a2e9a[_0x12ce('0x95')],'resource':_0x90f4f8,'username':_0x3a2e9a[_0x12ce('0x92')],'password':_0x3a2e9a[_0x12ce('0x93')],'grant_type':_0x12ce('0x93'),'client_secret':_0x3a2e9a[_0x12ce('0x96')]},'json':!![]};return rp(_0x2c93d2);}})[_0x12ce('0x1e')](function(_0x32ab05){_0x48012e=_0x32ab05[_0x12ce('0x9f')];var _0x5b189c={'method':_0x12ce('0xa0'),'uri':encodeURI(_0x53d369+_0x12ce('0xa1')+_0x367cba+'\x27'),'headers':{'Authorization':_0x12ce('0xa2')+_0x48012e,'If-None-Match':null,'OData-Version':_0x12ce('0xa3')},'json':!![]};return rp(_0x5b189c);})[_0x12ce('0x1e')](function(_0x11636c){var _0x484ec3=_0x11636c[_0x12ce('0xa4')][0x0];var _0x1bbeeb=_0x484ec3[_0x12ce('0xa5')];var _0x396495={'method':'GET','uri':_0x53d369+'EntityDefinitions('+_0x1bbeeb+_0x12ce('0xa6'),'headers':{'Authorization':_0x12ce('0xa2')+_0x48012e,'If-None-Match':null,'OData-Version':_0x12ce('0xa3')},'json':!![]};return rp(_0x396495);})[_0x12ce('0x1e')](function(_0x3610c5){_0x5d7a71=_0x3610c5;_0x1f7fa1=_0x5d7a71[_0x12ce('0xa7')];_0x1f7fa1=_['remove'](_0x1f7fa1,function(_0x187fea){return!_0x4facd8[_0x12ce('0xa8')](_0x187fea[_0x12ce('0xa9')]);});var _0x348d3b=[];var _0x2df3bc=[];_0x1f7fa1[_0x12ce('0xaa')](function(_0x2afd18){if(_0x2afd18[_0x12ce('0xab')]){var _0x1e516a=_0x2afd18[_0x12ce('0xab')][_0x12ce('0x98')](_0x2afd18['@odata.type'][_0x12ce('0x99')]('.')+0x1);if(_0x1e516a===_0x12ce('0xac')){_0x348d3b['push'](getSelectList(_0x53d369,_0x7fe407,_0x2df3bc,_0x5d7a71[_0x12ce('0xa5')],_0x2afd18['MetadataId'],_0x48012e));}}});return Promise[_0x12ce('0xad')](_0x348d3b);})['then'](function(_0x3a9d1b){_0x40e114=_0x3a9d1b[0x0];var _0x4fe09d=[];var _0x1a5a0f=[];_0x1f7fa1[_0x12ce('0xaa')](function(_0x24602e){if(!_[_0x12ce('0xae')](_0x24602e[_0x12ce('0xab')])){var _0x5d0174=_0x24602e['@odata.type'][_0x12ce('0x98')](_0x24602e[_0x12ce('0xab')][_0x12ce('0x99')]('.')+0x1);if(_0x5d0174===_0x12ce('0xaf')){_0x4fe09d[_0x12ce('0xb0')](getBooleanList(_0x53d369,_0x7fe407,_0x1a5a0f,_0x5d7a71['MetadataId'],_0x24602e[_0x12ce('0xa5')],_0x48012e));}}});return Promise[_0x12ce('0xad')](_0x4fe09d);})[_0x12ce('0x1e')](function(_0xf9db1f){_0x3ff175=_0xf9db1f[0x0];var _0x1e180a=[];var _0x2e1a28=[];_0x1f7fa1[_0x12ce('0xaa')](function(_0x4ed77){if(_0x4ed77[_0x12ce('0xab')]){var _0x3a80e6=_0x4ed77[_0x12ce('0xab')]['substring'](_0x4ed77[_0x12ce('0xab')][_0x12ce('0x99')]('.')+0x1);if(_0x3a80e6==='StringAttributeMetadata'||_0x3a80e6===_0x12ce('0xb1')||_0x3a80e6===_0x12ce('0xb2')||_0x3a80e6===_0x12ce('0xb3')||_0x3a80e6===_0x12ce('0xb4')||_0x3a80e6===_0x12ce('0xb5')||_0x3a80e6==='StatusAttributeMetadata'||_0x3a80e6===_0x12ce('0xb6')||_0x3a80e6===_0x12ce('0xb7')||_0x3a80e6===_0x12ce('0xb8')){_0x1e180a['push'](getInputList(_0x53d369,_0x7fe407,_0x3a80e6,_0x2e1a28,_0x5d7a71[_0x12ce('0xa5')],_0x4ed77[_0x12ce('0xa5')],_0x48012e));}}});return Promise[_0x12ce('0xad')](_0x1e180a);})['then'](function(_0x53faff){_0x3bb78b=_0x53faff[0x0];var _0x587f5a=_0x40e114[_0x12ce('0xb9')](_0x3ff175)[_0x12ce('0xb9')](_0x3bb78b);var _0x2910c7={'count':_0x587f5a[_0x12ce('0x32')],'rows':_0x587f5a};return _0x2910c7;})['then'](respondWithResult(_0x12d8d5,null))[_0x12ce('0x3f')](function(_0x31bb4e){var _0x3d3841=_0x360c80['query'][_0x12ce('0xba')]?0x1f4:_0x31bb4e[_0x12ce('0xbb')]||0x1f4;logger[_0x12ce('0x21')](_0x31bb4e[_0x12ce('0x22')]);delete _0x31bb4e[_0x12ce('0x23')];if(_0x3d3841===0x191){_0x3d3841=0x190;}_0x12d8d5[_0x12ce('0x15')](_0x3d3841)[_0x12ce('0x24')](_0x360c80[_0x12ce('0x2d')][_0x12ce('0xba')]?{'message':_0x12ce('0xbc'),'statusCode':_0x31bb4e[_0x12ce('0xbb')]}:_0x31bb4e);});};function getSelectList(_0x5306d3,_0x480b78,_0x21051a,_0x23a199,_0x4f99b8,_0x7b7ff4){var _0x69157e={'method':'GET','uri':_0x5306d3+'EntityDefinitions('+_0x23a199+_0x12ce('0xbd')+_0x4f99b8+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x12ce('0xbe'),'headers':{'Authorization':'Bearer\x20'+_0x7b7ff4,'If-None-Match':null,'OData-Version':_0x12ce('0xa3')},'json':!![]};return rp(_0x69157e)['then'](function(_0x111edd){var _0x457a75=[];var _0x253c0a=_0x111edd[_0x12ce('0xbf')][_0x12ce('0xc0')];_0x253c0a[_0x12ce('0xaa')](function(_0x1a607c){_0x457a75['push']({'name':_0x1a607c[_0x12ce('0xc1')][_0x12ce('0xc2')][_0x12ce('0xc1')],'value':String(_0x1a607c[_0x12ce('0xc3')])});});var _0x1e7a3b={'id':_0x480b78+'_'+_0x111edd['LogicalName'],'name':_0x111edd[_0x12ce('0xc4')][_0x12ce('0xc2')][_0x12ce('0xc1')],'custom':![],'options':_0x457a75};_0x21051a['push'](_0x1e7a3b);return _0x21051a;});}function getBooleanList(_0x29640c,_0x470590,_0x41424c,_0x12715d,_0x393706,_0x33657a){var _0x59c2c4={'method':_0x12ce('0xa0'),'uri':_0x29640c+_0x12ce('0xc5')+_0x12715d+_0x12ce('0xbd')+_0x393706+_0x12ce('0xc6'),'headers':{'Authorization':_0x12ce('0xa2')+_0x33657a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x59c2c4)[_0x12ce('0x1e')](function(_0x56f312){var _0x410e82=[];_0x410e82[_0x12ce('0xb0')]({'name':_0x56f312[_0x12ce('0xbf')]['TrueOption']['Label'][_0x12ce('0xc2')]['Label'],'value':_0x12ce('0xc7')},{'name':_0x56f312[_0x12ce('0xbf')][_0x12ce('0xc8')][_0x12ce('0xc1')][_0x12ce('0xc2')]['Label'],'value':_0x12ce('0xc9')});var _0x2a5e04={'id':_0x470590+'_'+_0x56f312['LogicalName'],'name':_0x56f312['DisplayName'][_0x12ce('0xc2')][_0x12ce('0xc1')],'custom':![],'options':_0x410e82};_0x41424c['push'](_0x2a5e04);return _0x41424c;});}function getInputList(_0x3d4e07,_0x1c60a1,_0x38b085,_0xb4a899,_0x1bde3c,_0x1a14cc,_0x5917d2){var _0x164b98={'method':'GET','uri':_0x3d4e07+'EntityDefinitions('+_0x1bde3c+_0x12ce('0xbd')+_0x1a14cc+_0x12ce('0xca')+_0x38b085+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x12ce('0xa2')+_0x5917d2,'If-None-Match':null,'OData-Version':_0x12ce('0xa3')},'json':!![]};return rp(_0x164b98)[_0x12ce('0x1e')](function(_0x2a1fe8){var _0x3bc85d={'id':_0x1c60a1+'_'+_0x2a1fe8[_0x12ce('0xa9')],'name':_0x2a1fe8[_0x12ce('0xc4')]['UserLocalizedLabel']?_0x2a1fe8['DisplayName']['UserLocalizedLabel'][_0x12ce('0xc1')]:_0x2a1fe8['LogicalName'],'custom':![],'options':[]};_0xb4a899[_0x12ce('0xb0')](_0x3bc85d);return _0xb4a899;});} \ No newline at end of file +var _0x4fdb=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','Dynamics365Account','findAll','rows','catch','show','keys','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','filter','getSubjects','channel','getDescriptions','Subjects','Dynamics365Field','Descriptions','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','caseorigincode','directioncode','accountidname','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slaname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','push','all','forEach','isNil','substring','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','stack','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','map','rawAttributes','fieldName','key','model','filters'];(function(_0x295a41,_0x377031){var _0x1ef7c5=function(_0x3679b6){while(--_0x3679b6){_0x295a41['push'](_0x295a41['shift']());}};_0x1ef7c5(++_0x377031);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x47fa6c,_0x58297b){_0x47fa6c=_0x47fa6c-0x0;var _0x1cb803=_0x4fdb[_0x47fa6c];return _0x1cb803;};'use strict';var emlformat=require(_0xb4fd('0x0'));var rimraf=require(_0xb4fd('0x1'));var zipdir=require(_0xb4fd('0x2'));var jsonpatch=require(_0xb4fd('0x3'));var rp=require(_0xb4fd('0x4'));var moment=require(_0xb4fd('0x5'));var BPromise=require(_0xb4fd('0x6'));var Mustache=require(_0xb4fd('0x7'));var util=require(_0xb4fd('0x8'));var path=require('path');var sox=require(_0xb4fd('0x9'));var csv=require('to-csv');var ejs=require(_0xb4fd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');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'];var integrations=require(_0xb4fd('0x19'));function respondWithStatusCode(_0x5ba7e1,_0x38173d){_0x38173d=_0x38173d||0xcc;return function(_0x65f08a){if(_0x65f08a){return _0x5ba7e1[_0xb4fd('0x1a')](_0x38173d);}return _0x5ba7e1['status'](_0x38173d)[_0xb4fd('0x1b')]();};}function respondWithResult(_0x1234d7,_0xc35d8d){_0xc35d8d=_0xc35d8d||0xc8;return function(_0x41e21a){if(_0x41e21a){return _0x1234d7[_0xb4fd('0x1c')](_0xc35d8d)[_0xb4fd('0x1d')](_0x41e21a);}};}function respondWithFilteredResult(_0x3a0872,_0x47e288){return function(_0x2076d5){if(_0x2076d5){var _0x12401d=typeof _0x47e288[_0xb4fd('0x1e')]===_0xb4fd('0x1f')&&typeof _0x47e288[_0xb4fd('0x20')]===_0xb4fd('0x1f');var _0x1d0812=_0x2076d5[_0xb4fd('0x21')];var _0x28ecef=_0x12401d?0x0:_0x47e288[_0xb4fd('0x1e')];var _0x19f7b0=_0x12401d?_0x2076d5['count']:_0x47e288['offset']+_0x47e288['limit'];var _0x5c14c0;if(_0x19f7b0>=_0x1d0812){_0x19f7b0=_0x1d0812;_0x5c14c0=0xc8;}else{_0x5c14c0=0xce;}_0x3a0872[_0xb4fd('0x1c')](_0x5c14c0);return _0x3a0872[_0xb4fd('0x22')](_0xb4fd('0x23'),_0x28ecef+'-'+_0x19f7b0+'/'+_0x1d0812)[_0xb4fd('0x1d')](_0x2076d5);}return null;};}function patchUpdates(_0x458133){return function(_0x2adfbd){try{jsonpatch[_0xb4fd('0x24')](_0x2adfbd,_0x458133,!![]);}catch(_0x4ffaf1){return BPromise['reject'](_0x4ffaf1);}return _0x2adfbd[_0xb4fd('0x25')]();};}function saveUpdates(_0x25bb7d,_0x157fc2){return function(_0x4a1d88){if(_0x4a1d88){return _0x4a1d88[_0xb4fd('0x26')](_0x25bb7d)['then'](function(_0x46cba4){return _0x46cba4;});}return null;};}function removeEntity(_0x4f5032,_0x2a9c8c){return function(_0x2c2d8d){if(_0x2c2d8d){return _0x2c2d8d[_0xb4fd('0x27')]()[_0xb4fd('0x28')](function(){_0x4f5032[_0xb4fd('0x1c')](0xcc)[_0xb4fd('0x1b')]();});}};}function handleEntityNotFound(_0x4f5971,_0x3498ad){return function(_0x526fb2){if(!_0x526fb2){_0x4f5971['sendStatus'](0x194);}return _0x526fb2;};}function handleError(_0x4baf02,_0x453982){_0x453982=_0x453982||0x1f4;return function(_0x4bad85){logger[_0xb4fd('0x29')](_0x4bad85['stack']);if(_0x4bad85['name']){delete _0x4bad85[_0xb4fd('0x2a')];}_0x4baf02[_0xb4fd('0x1c')](_0x453982)[_0xb4fd('0x2b')](_0x4bad85);};}exports['index']=function(_0x11ed43,_0x477a53){var _0x68776={},_0x1a653b={},_0x5d5606={'count':0x0,'rows':[]};var _0xd72bc3=_[_0xb4fd('0x2c')](db['Dynamics365Account'][_0xb4fd('0x2d')],function(_0x421c89){return{'name':_0x421c89[_0xb4fd('0x2e')],'type':_0x421c89['type'][_0xb4fd('0x2f')]};});_0x1a653b[_0xb4fd('0x30')]=_[_0xb4fd('0x2c')](_0xd72bc3,'name');_0x1a653b['query']=_['keys'](_0x11ed43['query']);_0x1a653b[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x1a653b[_0xb4fd('0x30')],_0x1a653b[_0xb4fd('0x33')]);_0x68776[_0xb4fd('0x34')]=_[_0xb4fd('0x32')](_0x1a653b[_0xb4fd('0x30')],qs[_0xb4fd('0x35')](_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x35')]));_0x68776[_0xb4fd('0x34')]=_0x68776[_0xb4fd('0x34')][_0xb4fd('0x36')]?_0x68776[_0xb4fd('0x34')]:_0x1a653b[_0xb4fd('0x30')];if(!_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x37')](_0xb4fd('0x38'))){_0x68776['limit']=qs['limit'](_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x20')]);_0x68776[_0xb4fd('0x1e')]=qs[_0xb4fd('0x1e')](_0x11ed43[_0xb4fd('0x33')]['offset']);}_0x68776[_0xb4fd('0x39')]=qs[_0xb4fd('0x3a')](_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x3a')]);_0x68776[_0xb4fd('0x3b')]=qs['filters'](_[_0xb4fd('0x3c')](_0x11ed43['query'],_0x1a653b[_0xb4fd('0x31')]),_0xd72bc3);if(_0x11ed43[_0xb4fd('0x33')]['filter']){_0x68776['where']=_[_0xb4fd('0x3d')](_0x68776[_0xb4fd('0x3b')],{'$or':_[_0xb4fd('0x2c')](_0xd72bc3,function(_0x357cf5){if(_0x357cf5[_0xb4fd('0x3e')]!==_0xb4fd('0x3f')){var _0x478cf3={};_0x478cf3[_0x357cf5[_0xb4fd('0x2a')]]={'$like':'%'+_0x11ed43[_0xb4fd('0x33')]['filter']+'%'};return _0x478cf3;}})});}_0x68776=_[_0xb4fd('0x3d')]({},_0x68776,_0x11ed43[_0xb4fd('0x40')]);var _0x17e024={'where':_0x68776[_0xb4fd('0x3b')]};return db['Dynamics365Account'][_0xb4fd('0x21')](_0x17e024)[_0xb4fd('0x28')](function(_0xdd0e59){_0x5d5606[_0xb4fd('0x21')]=_0xdd0e59;if(_0x11ed43[_0xb4fd('0x33')][_0xb4fd('0x41')]){_0x68776['include']=[{'all':!![]}];}return db[_0xb4fd('0x42')][_0xb4fd('0x43')](_0x68776);})['then'](function(_0x2120fa){_0x5d5606[_0xb4fd('0x44')]=_0x2120fa;return _0x5d5606;})[_0xb4fd('0x28')](respondWithFilteredResult(_0x477a53,_0x68776))[_0xb4fd('0x45')](handleError(_0x477a53,null));};exports[_0xb4fd('0x46')]=function(_0x5e24ff,_0x244e9d){var _0x661f32={'raw':![],'where':{'id':_0x5e24ff['params']['id']}},_0xdaac5a={};_0xdaac5a[_0xb4fd('0x30')]=_['keys'](db[_0xb4fd('0x42')][_0xb4fd('0x2d')]);_0xdaac5a['query']=_[_0xb4fd('0x47')](_0x5e24ff['query']);_0xdaac5a[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0xdaac5a[_0xb4fd('0x30')],_0xdaac5a['query']);_0x661f32[_0xb4fd('0x34')]=_[_0xb4fd('0x32')](_0xdaac5a[_0xb4fd('0x30')],qs[_0xb4fd('0x35')](_0x5e24ff[_0xb4fd('0x33')][_0xb4fd('0x35')]));_0x661f32[_0xb4fd('0x34')]=_0x661f32['attributes']['length']?_0x661f32[_0xb4fd('0x34')]:_0xdaac5a[_0xb4fd('0x30')];if(_0x5e24ff[_0xb4fd('0x33')][_0xb4fd('0x41')]){_0x661f32['include']=[{'all':!![]}];}_0x661f32=_[_0xb4fd('0x3d')]({},_0x661f32,_0x5e24ff['options']);return db['Dynamics365Account'][_0xb4fd('0x48')](_0x661f32)[_0xb4fd('0x28')](handleEntityNotFound(_0x244e9d,null))['then'](respondWithResult(_0x244e9d,null))[_0xb4fd('0x45')](handleError(_0x244e9d,null));};exports[_0xb4fd('0x49')]=function(_0x4b7fa0,_0xea231f){return db[_0xb4fd('0x42')][_0xb4fd('0x49')](_0x4b7fa0['body'],{})['then'](respondWithResult(_0xea231f,0xc9))[_0xb4fd('0x45')](handleError(_0xea231f,null));};exports[_0xb4fd('0x26')]=function(_0x17fbc7,_0x339990){if(_0x17fbc7['body']['id']){delete _0x17fbc7[_0xb4fd('0x4a')]['id'];}return db[_0xb4fd('0x42')]['find']({'where':{'id':_0x17fbc7[_0xb4fd('0x4b')]['id']}})[_0xb4fd('0x28')](handleEntityNotFound(_0x339990,null))[_0xb4fd('0x28')](saveUpdates(_0x17fbc7['body'],null))[_0xb4fd('0x28')](respondWithResult(_0x339990,null))[_0xb4fd('0x45')](handleError(_0x339990,null));};exports['destroy']=function(_0x47054f,_0x4de371){return db['Dynamics365Account'][_0xb4fd('0x48')]({'where':{'id':_0x47054f[_0xb4fd('0x4b')]['id']}})[_0xb4fd('0x28')](handleEntityNotFound(_0x4de371,null))[_0xb4fd('0x28')](removeEntity(_0x4de371,null))[_0xb4fd('0x45')](handleError(_0x4de371,null));};exports[_0xb4fd('0x4c')]=function(_0x372cb4,_0x315524,_0x44d43d){var _0x3c8a88={};var _0x77625b={};var _0x3063d0;var _0x106196;return db[_0xb4fd('0x42')][_0xb4fd('0x4d')]({'where':{'id':_0x372cb4['params']['id']}})['then'](handleEntityNotFound(_0x315524,null))[_0xb4fd('0x28')](function(_0x7c85e8){if(_0x7c85e8){_0x3063d0=_0x7c85e8;_0x77625b[_0xb4fd('0x30')]=_[_0xb4fd('0x47')](db[_0xb4fd('0x4e')]['rawAttributes']);_0x77625b['query']=_[_0xb4fd('0x47')](_0x372cb4[_0xb4fd('0x33')]);_0x77625b['filters']=_['intersection'](_0x77625b['model'],_0x77625b[_0xb4fd('0x33')]);_0x3c8a88[_0xb4fd('0x34')]=_[_0xb4fd('0x32')](_0x77625b[_0xb4fd('0x30')],qs['fields'](_0x372cb4['query'][_0xb4fd('0x35')]));_0x3c8a88[_0xb4fd('0x34')]=_0x3c8a88[_0xb4fd('0x34')]['length']?_0x3c8a88[_0xb4fd('0x34')]:_0x77625b[_0xb4fd('0x30')];_0x3c8a88[_0xb4fd('0x39')]=qs[_0xb4fd('0x3a')](_0x372cb4['query'][_0xb4fd('0x3a')]);_0x3c8a88[_0xb4fd('0x3b')]=qs['filters'](_[_0xb4fd('0x3c')](_0x372cb4['query'],_0x77625b[_0xb4fd('0x31')]));if(_0x372cb4['query'][_0xb4fd('0x4f')]){_0x3c8a88[_0xb4fd('0x3b')]=_[_0xb4fd('0x3d')](_0x3c8a88[_0xb4fd('0x3b')],{'$or':_[_0xb4fd('0x2c')](_0x3c8a88[_0xb4fd('0x34')],function(_0x2cef70){var _0x303148={};_0x303148[_0x2cef70]={'$like':'%'+_0x372cb4[_0xb4fd('0x33')][_0xb4fd('0x4f')]+'%'};return _0x303148;})});}_0x3c8a88=_[_0xb4fd('0x3d')]({},_0x3c8a88,_0x372cb4[_0xb4fd('0x40')]);return _0x3063d0[_0xb4fd('0x4c')](_0x3c8a88);}})[_0xb4fd('0x28')](function(_0x5d5d2e){if(_0x5d5d2e){_0x106196=_0x5d5d2e[_0xb4fd('0x36')];if(!_0x372cb4['query'][_0xb4fd('0x37')]('nolimit')){_0x3c8a88[_0xb4fd('0x20')]=qs[_0xb4fd('0x20')](_0x372cb4[_0xb4fd('0x33')][_0xb4fd('0x20')]);_0x3c8a88['offset']=qs['offset'](_0x372cb4[_0xb4fd('0x33')]['offset']);}return _0x3063d0[_0xb4fd('0x4c')](_0x3c8a88);}})[_0xb4fd('0x28')](function(_0x2c1c38){if(_0x2c1c38){return _0x2c1c38?{'count':_0x106196,'rows':_0x2c1c38}:null;}})['then'](respondWithResult(_0x315524,null))[_0xb4fd('0x45')](handleError(_0x315524,null));};exports['addConfiguration']=function(_0x2f2ff3,_0xa5c9fc,_0x3b8c19){if(_0x2f2ff3[_0xb4fd('0x4a')]['id']){delete _0x2f2ff3['body']['id'];}return db[_0xb4fd('0x42')]['findOne']({'where':{'id':_0x2f2ff3[_0xb4fd('0x4b')]['id']}})[_0xb4fd('0x28')](handleEntityNotFound(_0xa5c9fc,null))[_0xb4fd('0x28')](function(_0x4f832d){if(_0x4f832d){_0x2f2ff3['body']['AccountId']=_0x4f832d['id'];_0x2f2ff3[_0xb4fd('0x4a')]['Subjects']=integrations[_0xb4fd('0x50')](_0x2f2ff3['body'][_0xb4fd('0x51')],_0x2f2ff3[_0xb4fd('0x4a')][_0xb4fd('0x3e')]);_0x2f2ff3[_0xb4fd('0x4a')]['Descriptions']=integrations[_0xb4fd('0x52')](_0x2f2ff3[_0xb4fd('0x4a')][_0xb4fd('0x51')],_0x2f2ff3[_0xb4fd('0x4a')][_0xb4fd('0x3e')]);return db['Dynamics365Configuration'][_0xb4fd('0x49')](_0x2f2ff3[_0xb4fd('0x4a')],{'include':[{'model':db['Dynamics365Field'],'as':_0xb4fd('0x53')},{'model':db[_0xb4fd('0x54')],'as':_0xb4fd('0x55')}]});}return null;})[_0xb4fd('0x28')](respondWithResult(_0xa5c9fc,null))[_0xb4fd('0x45')](handleError(_0xa5c9fc,null));};exports[_0xb4fd('0x56')]=function(_0x5d763d,_0x256ca5,_0x2dc0f0){var _0x2b93e3=_0x5d763d[_0xb4fd('0x33')][_0xb4fd('0x57')];var _0x14315e=_0x2b93e3===_0xb4fd('0x58')?_0xb4fd('0x59'):_0xb4fd('0x5a');var _0xce491e='';var _0x3f9380='';var _0x3ab2ed='';var _0x88fb33='';var _0x5975c1='';var _0xb4fc00='';var _0x5d8756='';var _0xf779ab='';var _0x444ca6=[_0xb4fd('0x5b'),'description',_0xb4fd('0x5c'),'ownerid',_0xb4fd('0x5d'),'subject','phonenumber','regardingobjectid',_0xb4fd('0x5e'),'phonecall_activity_parties'];var _0x538baf=[_0xb4fd('0x5f'),'accountidyominame','actualserviceunits',_0xb4fd('0x60'),'contactidname',_0xb4fd('0x61'),_0xb4fd('0x62'),_0xb4fd('0x63'),_0xb4fd('0x64'),_0xb4fd('0x65'),'createdbyname','createdbyyominame',_0xb4fd('0x66'),_0xb4fd('0x67'),'createdonbehalfbyyominame',_0xb4fd('0x68'),_0xb4fd('0x69'),_0xb4fd('0x6a'),_0xb4fd('0x6b'),'entitlementidname',_0xb4fd('0x6c'),_0xb4fd('0x6d'),_0xb4fd('0x6e'),'exchangerate',_0xb4fd('0x6f'),_0xb4fd('0x70'),'importsequencenumber',_0xb4fd('0x71'),_0xb4fd('0x72'),_0xb4fd('0x73'),_0xb4fd('0x74'),_0xb4fd('0x75'),_0xb4fd('0x76'),_0xb4fd('0x77'),_0xb4fd('0x78'),_0xb4fd('0x79'),_0xb4fd('0x7a'),'modifiedonbehalfbyyominame',_0xb4fd('0x7b'),'msdyn_iotalertname',_0xb4fd('0x7c'),_0xb4fd('0x7d'),_0xb4fd('0x7e'),_0xb4fd('0x7f'),_0xb4fd('0x80'),_0xb4fd('0x81'),_0xb4fd('0x82'),_0xb4fd('0x83'),_0xb4fd('0x84'),_0xb4fd('0x85'),_0xb4fd('0x86'),_0xb4fd('0x87'),_0xb4fd('0x88'),_0xb4fd('0x89'),'responseby',_0xb4fd('0x8a'),'responsiblecontactidyominame',_0xb4fd('0x8b'),'slainvokedidname',_0xb4fd('0x8c'),'socialprofileidname',_0xb4fd('0x8d'),'statuscode',_0xb4fd('0x8e'),_0xb4fd('0x8f'),'timezoneruleversionnumber',_0xb4fd('0x90'),_0xb4fd('0x91'),_0xb4fd('0x92'),_0xb4fd('0x93')];var _0xdeaf57=_0x444ca6[_0xb4fd('0x94')](_0x538baf);return db[_0xb4fd('0x42')][_0xb4fd('0x4d')]({'where':{'id':_0x5d763d[_0xb4fd('0x4b')]['id']},'attributes':['id',_0xb4fd('0x95'),'password',_0xb4fd('0x96'),_0xb4fd('0x97'),_0xb4fd('0x98'),_0xb4fd('0x99')]})['then'](handleEntityNotFound(_0x256ca5,null))[_0xb4fd('0x28')](function(_0x2aa6bd){if(_0x2aa6bd){_0xf779ab=_0x2aa6bd[_0xb4fd('0x96')];var _0x57ce81=_0xf779ab['slice'](-0x1);if(_0x57ce81==='/'){_0xf779ab=_0xf779ab['substring'](0x0,_0xf779ab['lastIndexOf'](_0x57ce81));}_0x5d8756=util[_0xb4fd('0x9a')](_0xb4fd('0x9b'),_0xf779ab);var _0x5119dc={'method':_0xb4fd('0x9c'),'uri':_0xb4fd('0x9d')+_0x2aa6bd[_0xb4fd('0x97')]+'/oauth2/token','form':{'client_id':_0x2aa6bd[_0xb4fd('0x98')],'resource':_0xf779ab,'username':_0x2aa6bd[_0xb4fd('0x95')],'password':_0x2aa6bd[_0xb4fd('0x9e')],'grant_type':_0xb4fd('0x9e'),'client_secret':_0x2aa6bd[_0xb4fd('0x99')]},'json':!![]};return rp(_0x5119dc);}})[_0xb4fd('0x28')](function(_0x4d2dcb){_0xb4fc00=_0x4d2dcb[_0xb4fd('0x9f')];var _0x160cfc={'method':_0xb4fd('0xa0'),'uri':encodeURI(_0x5d8756+_0xb4fd('0xa1')+_0x14315e+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xb4fc00,'If-None-Match':null,'OData-Version':_0xb4fd('0xa2')},'json':!![]};return rp(_0x160cfc);})[_0xb4fd('0x28')](function(_0x35696c){var _0x9bc2ed=_0x35696c[_0xb4fd('0xa3')][0x0];var _0x166741=_0x9bc2ed[_0xb4fd('0xa4')];var _0x4910fc={'method':_0xb4fd('0xa0'),'uri':_0x5d8756+_0xb4fd('0xa5')+_0x166741+_0xb4fd('0xa6'),'headers':{'Authorization':_0xb4fd('0xa7')+_0xb4fc00,'If-None-Match':null,'OData-Version':_0xb4fd('0xa2')},'json':!![]};return rp(_0x4910fc);})[_0xb4fd('0x28')](function(_0x193058){_0xce491e=_0x193058;_0x3f9380=_0xce491e[_0xb4fd('0xa8')];_0x3f9380=_[_0xb4fd('0xa9')](_0x3f9380,function(_0x55e3d9){return!_0xdeaf57[_0xb4fd('0xaa')](_0x55e3d9[_0xb4fd('0xab')]);});var _0x4fdb29=[];var _0xdea929=[];_0x3f9380['forEach'](function(_0x573a3){if(_0x573a3[_0xb4fd('0xac')]){var _0x48a138=_0x573a3[_0xb4fd('0xac')]['substring'](_0x573a3['@odata.type'][_0xb4fd('0xad')]('.')+0x1);if(_0x48a138==='PicklistAttributeMetadata'){_0x4fdb29[_0xb4fd('0xae')](getSelectList(_0x5d8756,_0x2b93e3,_0xdea929,_0xce491e[_0xb4fd('0xa4')],_0x573a3[_0xb4fd('0xa4')],_0xb4fc00));}}});return Promise[_0xb4fd('0xaf')](_0x4fdb29);})[_0xb4fd('0x28')](function(_0x1398af){_0x3ab2ed=_0x1398af[0x0];var _0x31fcad=[];var _0x540d10=[];_0x3f9380[_0xb4fd('0xb0')](function(_0x3a452d){if(!_[_0xb4fd('0xb1')](_0x3a452d['@odata.type'])){var _0x1b7d62=_0x3a452d[_0xb4fd('0xac')][_0xb4fd('0xb2')](_0x3a452d[_0xb4fd('0xac')]['lastIndexOf']('.')+0x1);if(_0x1b7d62==='BooleanAttributeMetadata'){_0x31fcad[_0xb4fd('0xae')](getBooleanList(_0x5d8756,_0x2b93e3,_0x540d10,_0xce491e['MetadataId'],_0x3a452d[_0xb4fd('0xa4')],_0xb4fc00));}}});return Promise[_0xb4fd('0xaf')](_0x31fcad);})['then'](function(_0x9adc43){_0x88fb33=_0x9adc43[0x0];var _0x3d8034=[];var _0x135418=[];_0x3f9380[_0xb4fd('0xb0')](function(_0x5df3d9){if(_0x5df3d9[_0xb4fd('0xac')]){var _0x149f5a=_0x5df3d9['@odata.type'][_0xb4fd('0xb2')](_0x5df3d9[_0xb4fd('0xac')][_0xb4fd('0xad')]('.')+0x1);if(_0x149f5a===_0xb4fd('0xb3')||_0x149f5a===_0xb4fd('0xb4')||_0x149f5a===_0xb4fd('0xb5')||_0x149f5a===_0xb4fd('0xb6')||_0x149f5a===_0xb4fd('0xb7')||_0x149f5a==='DateTimeAttributeMetadata'||_0x149f5a===_0xb4fd('0xb8')||_0x149f5a===_0xb4fd('0xb9')||_0x149f5a===_0xb4fd('0xba')||_0x149f5a==='DecimalAttributeMetadata'){_0x3d8034[_0xb4fd('0xae')](getInputList(_0x5d8756,_0x2b93e3,_0x149f5a,_0x135418,_0xce491e[_0xb4fd('0xa4')],_0x5df3d9[_0xb4fd('0xa4')],_0xb4fc00));}}});return Promise[_0xb4fd('0xaf')](_0x3d8034);})[_0xb4fd('0x28')](function(_0x14cacf){_0x5975c1=_0x14cacf[0x0];var _0xe30085=_0x3ab2ed[_0xb4fd('0x94')](_0x88fb33)[_0xb4fd('0x94')](_0x5975c1);var _0x529eea={'count':_0xe30085['length'],'rows':_0xe30085};return _0x529eea;})[_0xb4fd('0x28')](respondWithResult(_0x256ca5,null))[_0xb4fd('0x45')](function(_0x4ca1e2){var _0x57fc0c=_0x5d763d['query'][_0xb4fd('0xbb')]?0x1f4:_0x4ca1e2['statusCode']||0x1f4;logger[_0xb4fd('0x29')](_0x4ca1e2[_0xb4fd('0xbc')]);delete _0x4ca1e2[_0xb4fd('0x2a')];if(_0x57fc0c===0x191){_0x57fc0c=0x190;}_0x256ca5[_0xb4fd('0x1c')](_0x57fc0c)[_0xb4fd('0x2b')](_0x5d763d[_0xb4fd('0x33')][_0xb4fd('0xbb')]?{'message':_0xb4fd('0xbd'),'statusCode':_0x4ca1e2[_0xb4fd('0xbe')]}:_0x4ca1e2);});};function getSelectList(_0x1c9f09,_0x520fd3,_0x128007,_0xb06c72,_0xa2ce3a,_0x5a81fe){var _0x26861e={'method':_0xb4fd('0xa0'),'uri':_0x1c9f09+'EntityDefinitions('+_0xb06c72+_0xb4fd('0xbf')+_0xa2ce3a+_0xb4fd('0xc0')+_0xb4fd('0xc1'),'headers':{'Authorization':_0xb4fd('0xa7')+_0x5a81fe,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x26861e)[_0xb4fd('0x28')](function(_0x40d210){var _0x3d5078=[];var _0x44d9e1=_0x40d210[_0xb4fd('0xc2')][_0xb4fd('0xc3')];_0x44d9e1[_0xb4fd('0xb0')](function(_0x1c8c04){_0x3d5078[_0xb4fd('0xae')]({'name':_0x1c8c04[_0xb4fd('0xc4')][_0xb4fd('0xc5')][_0xb4fd('0xc4')],'value':String(_0x1c8c04[_0xb4fd('0xc6')])});});var _0x2e74c3={'id':_0x520fd3+'_'+_0x40d210[_0xb4fd('0xab')],'name':_0x40d210[_0xb4fd('0xc7')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x3d5078};_0x128007[_0xb4fd('0xae')](_0x2e74c3);return _0x128007;});}function getBooleanList(_0x45e1d3,_0x1417bb,_0x36e676,_0x48e0d8,_0x38e447,_0x5a6582){var _0x36067a={'method':'GET','uri':_0x45e1d3+'EntityDefinitions('+_0x48e0d8+')/Attributes('+_0x38e447+_0xb4fd('0xc8'),'headers':{'Authorization':_0xb4fd('0xa7')+_0x5a6582,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x36067a)['then'](function(_0x4388c8){var _0xfc30f6=[];_0xfc30f6[_0xb4fd('0xae')]({'name':_0x4388c8['OptionSet'][_0xb4fd('0xc9')][_0xb4fd('0xc4')][_0xb4fd('0xc5')][_0xb4fd('0xc4')],'value':'true'},{'name':_0x4388c8[_0xb4fd('0xc2')][_0xb4fd('0xca')][_0xb4fd('0xc4')][_0xb4fd('0xc5')][_0xb4fd('0xc4')],'value':_0xb4fd('0xcb')});var _0x40a93e={'id':_0x1417bb+'_'+_0x4388c8[_0xb4fd('0xab')],'name':_0x4388c8['DisplayName'][_0xb4fd('0xc5')][_0xb4fd('0xc4')],'custom':![],'options':_0xfc30f6};_0x36e676[_0xb4fd('0xae')](_0x40a93e);return _0x36e676;});}function getInputList(_0x58d01e,_0xec3e4d,_0x581876,_0x232312,_0x582e59,_0x4c6951,_0x2cddf1){var _0x59bf94={'method':'GET','uri':_0x58d01e+_0xb4fd('0xa5')+_0x582e59+_0xb4fd('0xbf')+_0x4c6951+_0xb4fd('0xcc')+_0x581876+_0xb4fd('0xcd'),'headers':{'Authorization':'Bearer\x20'+_0x2cddf1,'If-None-Match':null,'OData-Version':_0xb4fd('0xa2')},'json':!![]};return rp(_0x59bf94)[_0xb4fd('0x28')](function(_0x57a8da){var _0x150b65={'id':_0xec3e4d+'_'+_0x57a8da[_0xb4fd('0xab')],'name':_0x57a8da[_0xb4fd('0xc7')][_0xb4fd('0xc5')]?_0x57a8da[_0xb4fd('0xc7')][_0xb4fd('0xc5')][_0xb4fd('0xc4')]:_0x57a8da[_0xb4fd('0xab')],'custom':![],'options':[]};_0x232312[_0xb4fd('0xae')](_0x150b65);return _0x232312;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f2300ab..2c97c4d 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x99dac1,_0x2449ea){var _0x138d1c=function(_0x300135){while(--_0x300135){_0x99dac1['push'](_0x99dac1['shift']());}};_0x138d1c(++_0x2449ea);}(_0xe706,0xa3));var _0x6e70=function(_0x1ffb10,_0x28ce2c){_0x1ffb10=_0x1ffb10-0x0;var _0x390ad0=_0xe706[_0x1ffb10];return _0x390ad0;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x335ca4,_0x463431){var _0x2669a0=function(_0x2608e5){while(--_0x2608e5){_0x335ca4['push'](_0x335ca4['shift']());}};_0x2669a0(++_0x463431);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 59cbb62..a947120 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 _0x2db5=['catch','Dynamics365Account','options','raw','where','attributes','include','map','model','GetDynamics365Account','ShowDynamics365Account','debug','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x2db5,0x168));var _0x52db=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x2db5[_0x30c649];return _0x3edfb9;};'use strict';var _=require('lodash');var util=require(_0x52db('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52db('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52db('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x52db('0x3'))('rpc');var config=require(_0x52db('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x52db('0x5')][_0x52db('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xf7506,_0x3253d5,_0x41caeb){return new BPromise(function(_0x2a7f2c,_0x3ccd8f){return client[_0x52db('0x7')](_0xf7506,_0x41caeb)[_0x52db('0x8')](function(_0x5e5a13){logger[_0x52db('0x9')](_0x52db('0xa'),_0x3253d5,'request\x20sent');logger['debug'](_0x52db('0xb'),_0x3253d5,_0x52db('0xc'),JSON[_0x52db('0xd')](_0x5e5a13));if(_0x5e5a13[_0x52db('0xe')]){if(_0x5e5a13[_0x52db('0xe')][_0x52db('0xf')]===0x1f4){logger['error'](_0x52db('0xa'),_0x3253d5,_0x5e5a13[_0x52db('0xe')][_0x52db('0x10')]);return _0x3ccd8f(_0x5e5a13[_0x52db('0xe')]['message']);}logger[_0x52db('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x3253d5,_0x5e5a13['error']['message']);return _0x2a7f2c(_0x5e5a13[_0x52db('0xe')][_0x52db('0x10')]);}else{logger['info'](_0x52db('0xa'),_0x3253d5,_0x52db('0xc'));_0x2a7f2c(_0x5e5a13['result'][_0x52db('0x10')]);}})[_0x52db('0x11')](function(_0x494930){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x3253d5,_0x494930);_0x3ccd8f(_0x494930);});});}exports['GetDynamics365Account']=function(_0x4efee7){var _0x2b937e=this;return new Promise(function(_0x49c6d8,_0x405706){return db[_0x52db('0x12')]['findAll']({'raw':_0x4efee7[_0x52db('0x13')]?_0x4efee7['options'][_0x52db('0x14')]===undefined?!![]:![]:!![],'where':_0x4efee7[_0x52db('0x13')]?_0x4efee7[_0x52db('0x13')][_0x52db('0x15')]||null:null,'attributes':_0x4efee7['options']?_0x4efee7[_0x52db('0x13')][_0x52db('0x16')]||null:null,'limit':_0x4efee7[_0x52db('0x13')]?_0x4efee7[_0x52db('0x13')]['limit']||null:null,'include':_0x4efee7[_0x52db('0x13')]?_0x4efee7[_0x52db('0x13')][_0x52db('0x17')]?_[_0x52db('0x18')](_0x4efee7[_0x52db('0x13')][_0x52db('0x17')],function(_0x2e967a){return{'model':db[_0x2e967a[_0x52db('0x19')]],'as':_0x2e967a['as'],'attributes':_0x2e967a[_0x52db('0x16')],'include':_0x2e967a[_0x52db('0x17')]?_[_0x52db('0x18')](_0x2e967a[_0x52db('0x17')],function(_0x57d8c6){return{'model':db[_0x57d8c6[_0x52db('0x19')]],'as':_0x57d8c6['as'],'attributes':_0x57d8c6[_0x52db('0x16')],'include':_0x57d8c6[_0x52db('0x17')]?_[_0x52db('0x18')](_0x57d8c6[_0x52db('0x17')],function(_0x4bb556){return{'model':db[_0x4bb556[_0x52db('0x19')]],'as':_0x4bb556['as'],'attributes':_0x4bb556[_0x52db('0x16')]};}):[]};}):[]};}):[]:[]})[_0x52db('0x8')](function(_0x574d27){logger['info'](_0x52db('0x1a'),_0x4efee7);logger['debug'](_0x52db('0x1a'),_0x4efee7,JSON[_0x52db('0xd')](_0x574d27));_0x49c6d8(_0x574d27);})['catch'](function(_0x332132){logger[_0x52db('0xe')](_0x52db('0x1a'),_0x332132['message'],_0x4efee7);_0x405706(_0x2b937e[_0x52db('0xe')](0x1f4,_0x332132[_0x52db('0x10')]));});});};exports['ShowDynamics365Account']=function(_0x347264){var _0x41a006=this;return new Promise(function(_0x33cd9d,_0x3442fe){return db[_0x52db('0x12')]['find']({'raw':_0x347264[_0x52db('0x13')]?_0x347264['options']['raw']===undefined?!![]:![]:!![],'where':_0x347264[_0x52db('0x13')]?_0x347264['options']['where']||null:null,'attributes':_0x347264[_0x52db('0x13')]?_0x347264[_0x52db('0x13')][_0x52db('0x16')]||null:null,'include':_0x347264[_0x52db('0x13')]?_0x347264[_0x52db('0x13')][_0x52db('0x17')]?_[_0x52db('0x18')](_0x347264[_0x52db('0x13')][_0x52db('0x17')],function(_0x4089e2){return{'model':db[_0x4089e2['model']],'as':_0x4089e2['as'],'attributes':_0x4089e2[_0x52db('0x16')],'include':_0x4089e2[_0x52db('0x17')]?_[_0x52db('0x18')](_0x4089e2['include'],function(_0x197f5b){return{'model':db[_0x197f5b[_0x52db('0x19')]],'as':_0x197f5b['as'],'attributes':_0x197f5b[_0x52db('0x16')],'include':_0x197f5b['include']?_[_0x52db('0x18')](_0x197f5b['include'],function(_0x255cd5){return{'model':db[_0x255cd5[_0x52db('0x19')]],'as':_0x255cd5['as'],'attributes':_0x255cd5[_0x52db('0x16')]};}):[]};}):[]};}):[]:[]})[_0x52db('0x8')](function(_0x37c6db){logger['info'](_0x52db('0x1b'),_0x347264);logger[_0x52db('0x1c')]('ShowDynamics365Account',_0x347264,JSON[_0x52db('0xd')](_0x37c6db));_0x33cd9d(_0x37c6db);})[_0x52db('0x11')](function(_0xc83f2e){logger[_0x52db('0xe')]('ShowDynamics365Account',_0xc83f2e[_0x52db('0x10')],_0x347264);_0x3442fe(_0x41a006['error'](0x1f4,_0xc83f2e[_0x52db('0x10')]));});});}; \ No newline at end of file +var _0x7d99=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','attributes','map','model','ShowDynamics365Account','find','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7d99,0x11e));var _0x97d9=function(_0x4a7c04,_0x234bed){_0x4a7c04=_0x4a7c04-0x0;var _0x29492c=_0x7d99[_0x4a7c04];return _0x29492c;};'use strict';var _=require(_0x97d9('0x0'));var util=require(_0x97d9('0x1'));var moment=require(_0x97d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x97d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97d9('0x4'))['db'];var utils=require(_0x97d9('0x5'));var logger=require('../../config/logger')(_0x97d9('0x6'));var config=require(_0x97d9('0x7'));var jayson=require(_0x97d9('0x8'));var client=jayson[_0x97d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa3d3f1,_0x5c024a,_0x2e9d86){return new BPromise(function(_0x1ae881,_0x202979){return client[_0x97d9('0xa')](_0xa3d3f1,_0x2e9d86)[_0x97d9('0xb')](function(_0x1b0c21){logger[_0x97d9('0xc')](_0x97d9('0xd'),_0x5c024a,_0x97d9('0xe'));logger[_0x97d9('0xf')](_0x97d9('0x10'),_0x5c024a,'request\x20sent',JSON[_0x97d9('0x11')](_0x1b0c21));if(_0x1b0c21[_0x97d9('0x12')]){if(_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x13')]===0x1f4){logger['error'](_0x97d9('0xd'),_0x5c024a,_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x14')]);return _0x202979(_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x14')]);}logger['error'](_0x97d9('0xd'),_0x5c024a,_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x14')]);return _0x1ae881(_0x1b0c21[_0x97d9('0x12')][_0x97d9('0x14')]);}else{logger[_0x97d9('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x5c024a,_0x97d9('0xe'));_0x1ae881(_0x1b0c21[_0x97d9('0x15')][_0x97d9('0x14')]);}})[_0x97d9('0x16')](function(_0x4cfb4b){logger[_0x97d9('0x12')](_0x97d9('0xd'),_0x5c024a,_0x4cfb4b);_0x202979(_0x4cfb4b);});});}exports[_0x97d9('0x17')]=function(_0x381408){var _0x3876ce=this;return new Promise(function(_0x1513f7,_0x21cf88){return db[_0x97d9('0x18')][_0x97d9('0x19')]({'raw':_0x381408[_0x97d9('0x1a')]?_0x381408[_0x97d9('0x1a')][_0x97d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x381408[_0x97d9('0x1a')]?_0x381408[_0x97d9('0x1a')][_0x97d9('0x1c')]||null:null,'attributes':_0x381408[_0x97d9('0x1a')]?_0x381408['options']['attributes']||null:null,'limit':_0x381408[_0x97d9('0x1a')]?_0x381408[_0x97d9('0x1a')][_0x97d9('0x1d')]||null:null,'include':_0x381408[_0x97d9('0x1a')]?_0x381408[_0x97d9('0x1a')]['include']?_['map'](_0x381408[_0x97d9('0x1a')][_0x97d9('0x1e')],function(_0x5e9c3e){return{'model':db[_0x5e9c3e['model']],'as':_0x5e9c3e['as'],'attributes':_0x5e9c3e[_0x97d9('0x1f')],'include':_0x5e9c3e[_0x97d9('0x1e')]?_[_0x97d9('0x20')](_0x5e9c3e[_0x97d9('0x1e')],function(_0x243a5a){return{'model':db[_0x243a5a[_0x97d9('0x21')]],'as':_0x243a5a['as'],'attributes':_0x243a5a[_0x97d9('0x1f')],'include':_0x243a5a[_0x97d9('0x1e')]?_[_0x97d9('0x20')](_0x243a5a['include'],function(_0x3930a1){return{'model':db[_0x3930a1[_0x97d9('0x21')]],'as':_0x3930a1['as'],'attributes':_0x3930a1[_0x97d9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51b669){logger[_0x97d9('0xc')]('GetDynamics365Account',_0x381408);logger[_0x97d9('0xf')](_0x97d9('0x17'),_0x381408,JSON['stringify'](_0x51b669));_0x1513f7(_0x51b669);})['catch'](function(_0x3ca33a){logger[_0x97d9('0x12')](_0x97d9('0x17'),_0x3ca33a['message'],_0x381408);_0x21cf88(_0x3876ce[_0x97d9('0x12')](0x1f4,_0x3ca33a[_0x97d9('0x14')]));});});};exports[_0x97d9('0x22')]=function(_0x2535b5){var _0x5d5be3=this;return new Promise(function(_0x28c1bd,_0x59f3aa){return db[_0x97d9('0x18')][_0x97d9('0x23')]({'raw':_0x2535b5[_0x97d9('0x1a')]?_0x2535b5[_0x97d9('0x1a')][_0x97d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x2535b5[_0x97d9('0x1a')]?_0x2535b5['options'][_0x97d9('0x1c')]||null:null,'attributes':_0x2535b5[_0x97d9('0x1a')]?_0x2535b5['options'][_0x97d9('0x1f')]||null:null,'include':_0x2535b5['options']?_0x2535b5[_0x97d9('0x1a')]['include']?_[_0x97d9('0x20')](_0x2535b5[_0x97d9('0x1a')][_0x97d9('0x1e')],function(_0x3b3bee){return{'model':db[_0x3b3bee[_0x97d9('0x21')]],'as':_0x3b3bee['as'],'attributes':_0x3b3bee[_0x97d9('0x1f')],'include':_0x3b3bee['include']?_['map'](_0x3b3bee[_0x97d9('0x1e')],function(_0x495e05){return{'model':db[_0x495e05[_0x97d9('0x21')]],'as':_0x495e05['as'],'attributes':_0x495e05['attributes'],'include':_0x495e05[_0x97d9('0x1e')]?_[_0x97d9('0x20')](_0x495e05[_0x97d9('0x1e')],function(_0x71403f){return{'model':db[_0x71403f[_0x97d9('0x21')]],'as':_0x71403f['as'],'attributes':_0x71403f[_0x97d9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x97d9('0xb')](function(_0x10384d){logger[_0x97d9('0xc')](_0x97d9('0x22'),_0x2535b5);logger[_0x97d9('0xf')](_0x97d9('0x22'),_0x2535b5,JSON[_0x97d9('0x11')](_0x10384d));_0x28c1bd(_0x10384d);})[_0x97d9('0x16')](function(_0x4d29ca){logger[_0x97d9('0x12')](_0x97d9('0x22'),_0x4d29ca[_0x97d9('0x14')],_0x2535b5);_0x59f3aa(_0x5d5be3[_0x97d9('0x12')](0x1f4,_0x4d29ca['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ec12ce4..cd22423 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 _0x1681=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Configuration.controller','get','index','isAuthenticated','/:id/fields','getFields','getSubjects','getDescriptions','post','create','/:id','update','delete','destroy'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1168('0x0'));var timeout=require(_0x1168('0x1'));var express=require(_0x1168('0x2'));var router=express[_0x1168('0x3')]();var fs_extra=require(_0x1168('0x4'));var auth=require(_0x1168('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1168('0x6'));router[_0x1168('0x7')]('/',auth['isAuthenticated'](),controller[_0x1168('0x8')]);router[_0x1168('0x7')]('/:id',auth[_0x1168('0x9')](),controller['show']);router[_0x1168('0x7')](_0x1168('0xa'),auth['isAuthenticated'](),controller[_0x1168('0xb')]);router[_0x1168('0x7')]('/:id/subjects',auth[_0x1168('0x9')](),controller[_0x1168('0xc')]);router['get']('/:id/descriptions',auth[_0x1168('0x9')](),controller[_0x1168('0xd')]);router[_0x1168('0xe')]('/',auth[_0x1168('0x9')](),controller[_0x1168('0xf')]);router['put'](_0x1168('0x10'),auth[_0x1168('0x9')](),controller[_0x1168('0x11')]);router[_0x1168('0x12')](_0x1168('0x10'),auth['isAuthenticated'](),controller[_0x1168('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0419=['Router','fs-extra','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x11a0e0,_0x35ae97){var _0x438e51=function(_0x12b5e2){while(--_0x12b5e2){_0x11a0e0['push'](_0x11a0e0['shift']());}};_0x438e51(++_0x35ae97);}(_0x0419,0x153));var _0x9041=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0x0419[_0x1b2255];return _0x33e57d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9041('0x0'));var timeout=require(_0x9041('0x1'));var express=require(_0x9041('0x2'));var router=express[_0x9041('0x3')]();var fs_extra=require(_0x9041('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9041('0x5'));var controller=require(_0x9041('0x6'));router[_0x9041('0x7')]('/',auth[_0x9041('0x8')](),controller['index']);router[_0x9041('0x7')](_0x9041('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x9041('0x7')](_0x9041('0xa'),auth[_0x9041('0x8')](),controller['getFields']);router[_0x9041('0x7')]('/:id/subjects',auth[_0x9041('0x8')](),controller[_0x9041('0xb')]);router[_0x9041('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9041('0xc')]);router[_0x9041('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9041('0xe')](_0x9041('0x9'),auth[_0x9041('0x8')](),controller[_0x9041('0xf')]);router[_0x9041('0x10')](_0x9041('0x9'),auth[_0x9041('0x8')](),controller[_0x9041('0x11')]);module[_0x9041('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 36c60da..652934b 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 _0x0a3e=['STRING','ENUM','incident'];(function(_0x4f2f91,_0x239e1a){var _0x321007=function(_0x4b4fee){while(--_0x4b4fee){_0x4f2f91['push'](_0x4f2f91['shift']());}};_0x321007(++_0x239e1a);}(_0x0a3e,0xf9));var _0xe0a3=function(_0x3db07e,_0x449530){_0x3db07e=_0x3db07e-0x0;var _0x4a6405=_0x0a3e[_0x3db07e];return _0x4a6405;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe0a3('0x0')]},'ticketType':{'type':Sequelize[_0xe0a3('0x1')](_0xe0a3('0x2'),'phonecall'),'defaultValue':_0xe0a3('0x2')}}; \ No newline at end of file +var _0x257e=['exports','incident','sequelize'];(function(_0x2dcac7,_0x48f2b4){var _0x1c81d7=function(_0x16b07f){while(--_0x16b07f){_0x2dcac7['push'](_0x2dcac7['shift']());}};_0x1c81d7(++_0x48f2b4);}(_0x257e,0x16d));var _0xe257=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x257e[_0x1b70e3];return _0x1452ab;};'use strict';var Sequelize=require(_0xe257('0x0'));module[_0xe257('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xe257('0x2'),'phonecall'),'defaultValue':_0xe257('0x2')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 607eb94..294aab9 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 _0x2ab1=['fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','Dynamics365Field','getFields','getSubjects','findOne','eml-format','rimraf','zip-dir'];(function(_0x4407e3,_0xc16a4c){var _0x1675cf=function(_0x3f947c){while(--_0x3f947c){_0x4407e3['push'](_0x4407e3['shift']());}};_0x1675cf(++_0xc16a4c);}(_0x2ab1,0x141));var _0x12ab=function(_0x39dc92,_0x32f21e){_0x39dc92=_0x39dc92-0x0;var _0x18294d=_0x2ab1[_0x39dc92];return _0x18294d;};'use strict';var emlformat=require(_0x12ab('0x0'));var rimraf=require(_0x12ab('0x1'));var zipdir=require(_0x12ab('0x2'));var jsonpatch=require(_0x12ab('0x3'));var rp=require('request-promise');var moment=require(_0x12ab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x12ab('0x5'));var util=require(_0x12ab('0x6'));var path=require(_0x12ab('0x7'));var sox=require(_0x12ab('0x8'));var csv=require('to-csv');var ejs=require(_0x12ab('0x9'));var fs=require('fs');var fs_extra=require(_0x12ab('0xa'));var _=require(_0x12ab('0xb'));var squel=require(_0x12ab('0xc'));var crypto=require(_0x12ab('0xd'));var jsforce=require(_0x12ab('0xe'));var deskjs=require(_0x12ab('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x12ab('0x10'));var Redis=require(_0x12ab('0x11'));var authService=require(_0x12ab('0x12'));var qs=require(_0x12ab('0x13'));var as=require(_0x12ab('0x14'));var hardwareService=require(_0x12ab('0x15'));var logger=require(_0x12ab('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x12ab('0x17'));var licenseUtil=require(_0x12ab('0x18'));var db=require(_0x12ab('0x19'))['db'];function respondWithStatusCode(_0x317f74,_0x309144){_0x309144=_0x309144||0xcc;return function(_0x5af177){if(_0x5af177){return _0x317f74[_0x12ab('0x1a')](_0x309144);}return _0x317f74['status'](_0x309144)[_0x12ab('0x1b')]();};}function respondWithResult(_0x23c86c,_0x53f513){_0x53f513=_0x53f513||0xc8;return function(_0x1e4ccd){if(_0x1e4ccd){return _0x23c86c['status'](_0x53f513)[_0x12ab('0x1c')](_0x1e4ccd);}};}function respondWithFilteredResult(_0x423c01,_0x547317){return function(_0x1cf1ab){if(_0x1cf1ab){var _0x499e1e=typeof _0x547317['offset']===_0x12ab('0x1d')&&typeof _0x547317[_0x12ab('0x1e')]==='undefined';var _0xe7291c=_0x1cf1ab[_0x12ab('0x1f')];var _0x1184c7=_0x499e1e?0x0:_0x547317['offset'];var _0x406b32=_0x499e1e?_0x1cf1ab[_0x12ab('0x1f')]:_0x547317['offset']+_0x547317[_0x12ab('0x1e')];var _0x539082;if(_0x406b32>=_0xe7291c){_0x406b32=_0xe7291c;_0x539082=0xc8;}else{_0x539082=0xce;}_0x423c01[_0x12ab('0x20')](_0x539082);return _0x423c01[_0x12ab('0x21')](_0x12ab('0x22'),_0x1184c7+'-'+_0x406b32+'/'+_0xe7291c)[_0x12ab('0x1c')](_0x1cf1ab);}return null;};}function patchUpdates(_0x40ef7a){return function(_0x2fdda1){try{jsonpatch['apply'](_0x2fdda1,_0x40ef7a,!![]);}catch(_0x3c0b6e){return BPromise[_0x12ab('0x23')](_0x3c0b6e);}return _0x2fdda1['save']();};}function saveUpdates(_0x126f1f,_0x7cd8e2){return function(_0x14be18){if(_0x14be18){return _0x14be18[_0x12ab('0x24')](_0x126f1f)[_0x12ab('0x25')](function(_0x4bd0b8){return _0x4bd0b8;});}return null;};}function removeEntity(_0x14af30,_0x50d27b){return function(_0x38970c){if(_0x38970c){return _0x38970c[_0x12ab('0x26')]()[_0x12ab('0x25')](function(){_0x14af30['status'](0xcc)[_0x12ab('0x1b')]();});}};}function handleEntityNotFound(_0x22f216,_0xbe634c){return function(_0x80896e){if(!_0x80896e){_0x22f216[_0x12ab('0x1a')](0x194);}return _0x80896e;};}function handleError(_0x3a309,_0x3476f4){_0x3476f4=_0x3476f4||0x1f4;return function(_0x1fdcb2){logger[_0x12ab('0x27')](_0x1fdcb2[_0x12ab('0x28')]);if(_0x1fdcb2['name']){delete _0x1fdcb2[_0x12ab('0x29')];}_0x3a309[_0x12ab('0x20')](_0x3476f4)[_0x12ab('0x2a')](_0x1fdcb2);};}exports[_0x12ab('0x2b')]=function(_0x52525f,_0x2d6131){var _0x5340be={},_0x25a6ca={},_0x2f59fe={'count':0x0,'rows':[]};var _0x5ceffc=_['map'](db[_0x12ab('0x2c')][_0x12ab('0x2d')],function(_0x5a428c){return{'name':_0x5a428c[_0x12ab('0x2e')],'type':_0x5a428c[_0x12ab('0x2f')][_0x12ab('0x30')]};});_0x25a6ca[_0x12ab('0x31')]=_[_0x12ab('0x32')](_0x5ceffc,'name');_0x25a6ca[_0x12ab('0x33')]=_[_0x12ab('0x34')](_0x52525f[_0x12ab('0x33')]);_0x25a6ca[_0x12ab('0x35')]=_[_0x12ab('0x36')](_0x25a6ca[_0x12ab('0x31')],_0x25a6ca['query']);_0x5340be[_0x12ab('0x37')]=_[_0x12ab('0x36')](_0x25a6ca['model'],qs[_0x12ab('0x38')](_0x52525f['query'][_0x12ab('0x38')]));_0x5340be[_0x12ab('0x37')]=_0x5340be['attributes'][_0x12ab('0x39')]?_0x5340be[_0x12ab('0x37')]:_0x25a6ca['model'];if(!_0x52525f[_0x12ab('0x33')][_0x12ab('0x3a')](_0x12ab('0x3b'))){_0x5340be['limit']=qs[_0x12ab('0x1e')](_0x52525f[_0x12ab('0x33')][_0x12ab('0x1e')]);_0x5340be[_0x12ab('0x3c')]=qs['offset'](_0x52525f['query'][_0x12ab('0x3c')]);}_0x5340be[_0x12ab('0x3d')]=qs[_0x12ab('0x3e')](_0x52525f[_0x12ab('0x33')]['sort']);_0x5340be[_0x12ab('0x3f')]=qs[_0x12ab('0x35')](_[_0x12ab('0x40')](_0x52525f['query'],_0x25a6ca['filters']),_0x5ceffc);if(_0x52525f[_0x12ab('0x33')][_0x12ab('0x41')]){_0x5340be[_0x12ab('0x3f')]=_[_0x12ab('0x42')](_0x5340be[_0x12ab('0x3f')],{'$or':_[_0x12ab('0x32')](_0x5ceffc,function(_0x368849){if(_0x368849[_0x12ab('0x2f')]!=='VIRTUAL'){var _0x4c27f1={};_0x4c27f1[_0x368849[_0x12ab('0x29')]]={'$like':'%'+_0x52525f['query']['filter']+'%'};return _0x4c27f1;}})});}_0x5340be=_[_0x12ab('0x42')]({},_0x5340be,_0x52525f[_0x12ab('0x43')]);var _0x1b9487={'where':_0x5340be['where']};return db['Dynamics365Configuration'][_0x12ab('0x1f')](_0x1b9487)[_0x12ab('0x25')](function(_0x37bf4a){_0x2f59fe[_0x12ab('0x1f')]=_0x37bf4a;if(_0x52525f['query'][_0x12ab('0x44')]){_0x5340be[_0x12ab('0x45')]=[{'all':!![]}];}return db[_0x12ab('0x2c')]['findAll'](_0x5340be);})[_0x12ab('0x25')](function(_0x2ace0b){_0x2f59fe[_0x12ab('0x46')]=_0x2ace0b;return _0x2f59fe;})[_0x12ab('0x25')](respondWithFilteredResult(_0x2d6131,_0x5340be))[_0x12ab('0x47')](handleError(_0x2d6131,null));};exports[_0x12ab('0x48')]=function(_0x1a6d14,_0x352d47){var _0x3fbe36={'raw':![],'where':{'id':_0x1a6d14[_0x12ab('0x49')]['id']}},_0x20862e={};_0x20862e[_0x12ab('0x31')]=_[_0x12ab('0x34')](db[_0x12ab('0x2c')][_0x12ab('0x2d')]);_0x20862e[_0x12ab('0x33')]=_[_0x12ab('0x34')](_0x1a6d14[_0x12ab('0x33')]);_0x20862e[_0x12ab('0x35')]=_['intersection'](_0x20862e[_0x12ab('0x31')],_0x20862e[_0x12ab('0x33')]);_0x3fbe36[_0x12ab('0x37')]=_[_0x12ab('0x36')](_0x20862e['model'],qs[_0x12ab('0x38')](_0x1a6d14[_0x12ab('0x33')][_0x12ab('0x38')]));_0x3fbe36[_0x12ab('0x37')]=_0x3fbe36[_0x12ab('0x37')][_0x12ab('0x39')]?_0x3fbe36[_0x12ab('0x37')]:_0x20862e[_0x12ab('0x31')];if(_0x1a6d14[_0x12ab('0x33')][_0x12ab('0x44')]){_0x3fbe36['include']=[{'all':!![]}];}_0x3fbe36=_[_0x12ab('0x42')]({},_0x3fbe36,_0x1a6d14[_0x12ab('0x43')]);return db[_0x12ab('0x2c')][_0x12ab('0x4a')](_0x3fbe36)['then'](handleEntityNotFound(_0x352d47,null))[_0x12ab('0x25')](respondWithResult(_0x352d47,null))[_0x12ab('0x47')](handleError(_0x352d47,null));};exports[_0x12ab('0x4b')]=function(_0x54db26,_0x3fd269){return db[_0x12ab('0x2c')][_0x12ab('0x4b')](_0x54db26['body'],{})[_0x12ab('0x25')](respondWithResult(_0x3fd269,0xc9))['catch'](handleError(_0x3fd269,null));};exports[_0x12ab('0x24')]=function(_0x25c3f8,_0x7c430a){if(_0x25c3f8[_0x12ab('0x4c')]['id']){delete _0x25c3f8['body']['id'];}return db['Dynamics365Configuration'][_0x12ab('0x4a')]({'where':{'id':_0x25c3f8[_0x12ab('0x49')]['id']}})[_0x12ab('0x25')](handleEntityNotFound(_0x7c430a,null))[_0x12ab('0x25')](saveUpdates(_0x25c3f8[_0x12ab('0x4c')],null))['then'](respondWithResult(_0x7c430a,null))[_0x12ab('0x47')](handleError(_0x7c430a,null));};exports[_0x12ab('0x26')]=function(_0x19b25b,_0x14c6cf){return db['Dynamics365Configuration'][_0x12ab('0x4a')]({'where':{'id':_0x19b25b['params']['id']}})[_0x12ab('0x25')](handleEntityNotFound(_0x14c6cf,null))['then'](removeEntity(_0x14c6cf,null))[_0x12ab('0x47')](handleError(_0x14c6cf,null));};exports['getFields']=function(_0x48a8b7,_0x5e9aa7,_0x4b3fa1){var _0x57a1e3={};var _0x3c9f54={};var _0xfe879e;var _0x239a62;return db[_0x12ab('0x2c')]['findOne']({'where':{'id':_0x48a8b7['params']['id']}})['then'](handleEntityNotFound(_0x5e9aa7,null))[_0x12ab('0x25')](function(_0x166c4c){if(_0x166c4c){_0xfe879e=_0x166c4c;_0x3c9f54[_0x12ab('0x31')]=_[_0x12ab('0x34')](db[_0x12ab('0x4d')][_0x12ab('0x2d')]);_0x3c9f54[_0x12ab('0x33')]=_[_0x12ab('0x34')](_0x48a8b7['query']);_0x3c9f54[_0x12ab('0x35')]=_[_0x12ab('0x36')](_0x3c9f54[_0x12ab('0x31')],_0x3c9f54[_0x12ab('0x33')]);_0x57a1e3[_0x12ab('0x37')]=_[_0x12ab('0x36')](_0x3c9f54[_0x12ab('0x31')],qs[_0x12ab('0x38')](_0x48a8b7[_0x12ab('0x33')][_0x12ab('0x38')]));_0x57a1e3[_0x12ab('0x37')]=_0x57a1e3[_0x12ab('0x37')]['length']?_0x57a1e3[_0x12ab('0x37')]:_0x3c9f54['model'];_0x57a1e3['order']=qs[_0x12ab('0x3e')](_0x48a8b7['query'][_0x12ab('0x3e')]);_0x57a1e3[_0x12ab('0x3f')]=qs[_0x12ab('0x35')](_[_0x12ab('0x40')](_0x48a8b7[_0x12ab('0x33')],_0x3c9f54[_0x12ab('0x35')]));if(_0x48a8b7[_0x12ab('0x33')][_0x12ab('0x41')]){_0x57a1e3[_0x12ab('0x3f')]=_[_0x12ab('0x42')](_0x57a1e3['where'],{'$or':_[_0x12ab('0x32')](_0x57a1e3[_0x12ab('0x37')],function(_0x449fc9){var _0x439f63={};_0x439f63[_0x449fc9]={'$like':'%'+_0x48a8b7['query'][_0x12ab('0x41')]+'%'};return _0x439f63;})});}_0x57a1e3=_[_0x12ab('0x42')]({},_0x57a1e3,_0x48a8b7['options']);return _0xfe879e[_0x12ab('0x4e')](_0x57a1e3);}})[_0x12ab('0x25')](function(_0x1dbcf3){if(_0x1dbcf3){_0x239a62=_0x1dbcf3[_0x12ab('0x39')];if(!_0x48a8b7['query'][_0x12ab('0x3a')](_0x12ab('0x3b'))){_0x57a1e3[_0x12ab('0x1e')]=qs[_0x12ab('0x1e')](_0x48a8b7[_0x12ab('0x33')][_0x12ab('0x1e')]);_0x57a1e3['offset']=qs[_0x12ab('0x3c')](_0x48a8b7[_0x12ab('0x33')][_0x12ab('0x3c')]);}return _0xfe879e[_0x12ab('0x4e')](_0x57a1e3);}})['then'](function(_0x25a798){if(_0x25a798){return _0x25a798?{'count':_0x239a62,'rows':_0x25a798}:null;}})['then'](respondWithResult(_0x5e9aa7,null))[_0x12ab('0x47')](handleError(_0x5e9aa7,null));};exports[_0x12ab('0x4f')]=function(_0x1cbb99,_0x5e2b5e,_0x2bd4b5){var _0x1ce03f={};var _0x4c736f={};var _0x549e87;var _0x354f0f;return db[_0x12ab('0x2c')][_0x12ab('0x50')]({'where':{'id':_0x1cbb99[_0x12ab('0x49')]['id']}})[_0x12ab('0x25')](handleEntityNotFound(_0x5e2b5e,null))[_0x12ab('0x25')](function(_0x3fb7f6){if(_0x3fb7f6){_0x549e87=_0x3fb7f6;_0x4c736f[_0x12ab('0x31')]=_[_0x12ab('0x34')](db['Dynamics365Field'][_0x12ab('0x2d')]);_0x4c736f[_0x12ab('0x33')]=_[_0x12ab('0x34')](_0x1cbb99[_0x12ab('0x33')]);_0x4c736f[_0x12ab('0x35')]=_[_0x12ab('0x36')](_0x4c736f[_0x12ab('0x31')],_0x4c736f['query']);_0x1ce03f['attributes']=_[_0x12ab('0x36')](_0x4c736f['model'],qs[_0x12ab('0x38')](_0x1cbb99[_0x12ab('0x33')][_0x12ab('0x38')]));_0x1ce03f[_0x12ab('0x37')]=_0x1ce03f[_0x12ab('0x37')][_0x12ab('0x39')]?_0x1ce03f['attributes']:_0x4c736f['model'];_0x1ce03f[_0x12ab('0x3d')]=qs[_0x12ab('0x3e')](_0x1cbb99[_0x12ab('0x33')][_0x12ab('0x3e')]);_0x1ce03f['where']=qs['filters'](_[_0x12ab('0x40')](_0x1cbb99[_0x12ab('0x33')],_0x4c736f[_0x12ab('0x35')]));if(_0x1cbb99['query'][_0x12ab('0x41')]){_0x1ce03f[_0x12ab('0x3f')]=_['merge'](_0x1ce03f['where'],{'$or':_[_0x12ab('0x32')](_0x1ce03f['attributes'],function(_0x50ae3e){var _0x41df4d={};_0x41df4d[_0x50ae3e]={'$like':'%'+_0x1cbb99[_0x12ab('0x33')][_0x12ab('0x41')]+'%'};return _0x41df4d;})});}_0x1ce03f=_[_0x12ab('0x42')]({},_0x1ce03f,_0x1cbb99[_0x12ab('0x43')]);return _0x549e87[_0x12ab('0x4f')](_0x1ce03f);}})['then'](function(_0x47180e){if(_0x47180e){_0x354f0f=_0x47180e[_0x12ab('0x39')];if(!_0x1cbb99['query'][_0x12ab('0x3a')]('nolimit')){_0x1ce03f[_0x12ab('0x1e')]=qs[_0x12ab('0x1e')](_0x1cbb99[_0x12ab('0x33')]['limit']);_0x1ce03f[_0x12ab('0x3c')]=qs[_0x12ab('0x3c')](_0x1cbb99[_0x12ab('0x33')][_0x12ab('0x3c')]);}return _0x549e87[_0x12ab('0x4f')](_0x1ce03f);}})[_0x12ab('0x25')](function(_0x508f94){if(_0x508f94){return _0x508f94?{'count':_0x354f0f,'rows':_0x508f94}:null;}})[_0x12ab('0x25')](respondWithResult(_0x5e2b5e,null))[_0x12ab('0x47')](handleError(_0x5e2b5e,null));};exports['getDescriptions']=function(_0x309435,_0x76b05e,_0x5b5035){var _0x3d1382={};var _0x221646={};var _0x52ea55;var _0x19dcf3;return db['Dynamics365Configuration'][_0x12ab('0x50')]({'where':{'id':_0x309435[_0x12ab('0x49')]['id']}})[_0x12ab('0x25')](handleEntityNotFound(_0x76b05e,null))[_0x12ab('0x25')](function(_0x4434e7){if(_0x4434e7){_0x52ea55=_0x4434e7;_0x221646[_0x12ab('0x31')]=_['keys'](db['Dynamics365Field'][_0x12ab('0x2d')]);_0x221646['query']=_[_0x12ab('0x34')](_0x309435[_0x12ab('0x33')]);_0x221646['filters']=_['intersection'](_0x221646['model'],_0x221646['query']);_0x3d1382['attributes']=_[_0x12ab('0x36')](_0x221646[_0x12ab('0x31')],qs[_0x12ab('0x38')](_0x309435[_0x12ab('0x33')]['fields']));_0x3d1382[_0x12ab('0x37')]=_0x3d1382[_0x12ab('0x37')][_0x12ab('0x39')]?_0x3d1382[_0x12ab('0x37')]:_0x221646[_0x12ab('0x31')];_0x3d1382[_0x12ab('0x3d')]=qs[_0x12ab('0x3e')](_0x309435[_0x12ab('0x33')][_0x12ab('0x3e')]);_0x3d1382[_0x12ab('0x3f')]=qs[_0x12ab('0x35')](_['pick'](_0x309435[_0x12ab('0x33')],_0x221646[_0x12ab('0x35')]));if(_0x309435[_0x12ab('0x33')][_0x12ab('0x41')]){_0x3d1382[_0x12ab('0x3f')]=_[_0x12ab('0x42')](_0x3d1382[_0x12ab('0x3f')],{'$or':_[_0x12ab('0x32')](_0x3d1382[_0x12ab('0x37')],function(_0x40ad07){var _0x4dcb24={};_0x4dcb24[_0x40ad07]={'$like':'%'+_0x309435['query'][_0x12ab('0x41')]+'%'};return _0x4dcb24;})});}_0x3d1382=_['merge']({},_0x3d1382,_0x309435['options']);return _0x52ea55['getDescriptions'](_0x3d1382);}})[_0x12ab('0x25')](function(_0xd39489){if(_0xd39489){_0x19dcf3=_0xd39489[_0x12ab('0x39')];if(!_0x309435[_0x12ab('0x33')][_0x12ab('0x3a')](_0x12ab('0x3b'))){_0x3d1382[_0x12ab('0x1e')]=qs['limit'](_0x309435[_0x12ab('0x33')]['limit']);_0x3d1382[_0x12ab('0x3c')]=qs['offset'](_0x309435['query']['offset']);}return _0x52ea55['getDescriptions'](_0x3d1382);}})[_0x12ab('0x25')](function(_0x3d8fe2){if(_0x3d8fe2){return _0x3d8fe2?{'count':_0x19dcf3,'rows':_0x3d8fe2}:null;}})[_0x12ab('0x25')](respondWithResult(_0x76b05e,null))['catch'](handleError(_0x76b05e,null));}; \ No newline at end of file +var _0x4d74=['json','apply','reject','save','update','then','destroy','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','body','getFields','findOne','sort','hasOwnProperty','getSubjects','Dynamics365Field','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x4d74,0x123));var _0x44d7=function(_0x201d73,_0x2a916b){_0x201d73=_0x201d73-0x0;var _0x5673e1=_0x4d74[_0x201d73];return _0x5673e1;};'use strict';var emlformat=require(_0x44d7('0x0'));var rimraf=require(_0x44d7('0x1'));var zipdir=require(_0x44d7('0x2'));var jsonpatch=require(_0x44d7('0x3'));var rp=require(_0x44d7('0x4'));var moment=require(_0x44d7('0x5'));var BPromise=require(_0x44d7('0x6'));var Mustache=require(_0x44d7('0x7'));var util=require(_0x44d7('0x8'));var path=require(_0x44d7('0x9'));var sox=require(_0x44d7('0xa'));var csv=require('to-csv');var ejs=require(_0x44d7('0xb'));var fs=require('fs');var fs_extra=require(_0x44d7('0xc'));var _=require('lodash');var squel=require(_0x44d7('0xd'));var crypto=require(_0x44d7('0xe'));var jsforce=require(_0x44d7('0xf'));var deskjs=require(_0x44d7('0x10'));var toCsv=require(_0x44d7('0x11'));var querystring=require(_0x44d7('0x12'));var Papa=require(_0x44d7('0x13'));var Redis=require(_0x44d7('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x44d7('0x15'));var as=require(_0x44d7('0x16'));var hardwareService=require(_0x44d7('0x17'));var logger=require(_0x44d7('0x18'))('api');var utils=require(_0x44d7('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x44d7('0x1a'));var db=require(_0x44d7('0x1b'))['db'];function respondWithStatusCode(_0x2f41d8,_0x176369){_0x176369=_0x176369||0xcc;return function(_0x779ea9){if(_0x779ea9){return _0x2f41d8[_0x44d7('0x1c')](_0x176369);}return _0x2f41d8[_0x44d7('0x1d')](_0x176369)[_0x44d7('0x1e')]();};}function respondWithResult(_0x15493c,_0x521a0e){_0x521a0e=_0x521a0e||0xc8;return function(_0x371100){if(_0x371100){return _0x15493c[_0x44d7('0x1d')](_0x521a0e)['json'](_0x371100);}};}function respondWithFilteredResult(_0x477eb3,_0x1ea4ad){return function(_0x2b527a){if(_0x2b527a){var _0x4314ba=typeof _0x1ea4ad[_0x44d7('0x1f')]===_0x44d7('0x20')&&typeof _0x1ea4ad[_0x44d7('0x21')]===_0x44d7('0x20');var _0x5740d2=_0x2b527a[_0x44d7('0x22')];var _0x51ecd8=_0x4314ba?0x0:_0x1ea4ad[_0x44d7('0x1f')];var _0x4d06c6=_0x4314ba?_0x2b527a[_0x44d7('0x22')]:_0x1ea4ad[_0x44d7('0x1f')]+_0x1ea4ad['limit'];var _0x4d08e4;if(_0x4d06c6>=_0x5740d2){_0x4d06c6=_0x5740d2;_0x4d08e4=0xc8;}else{_0x4d08e4=0xce;}_0x477eb3[_0x44d7('0x1d')](_0x4d08e4);return _0x477eb3[_0x44d7('0x23')](_0x44d7('0x24'),_0x51ecd8+'-'+_0x4d06c6+'/'+_0x5740d2)[_0x44d7('0x25')](_0x2b527a);}return null;};}function patchUpdates(_0x250645){return function(_0x4b2658){try{jsonpatch[_0x44d7('0x26')](_0x4b2658,_0x250645,!![]);}catch(_0x17caa7){return BPromise[_0x44d7('0x27')](_0x17caa7);}return _0x4b2658[_0x44d7('0x28')]();};}function saveUpdates(_0x15ba41,_0x35faa1){return function(_0xa3f676){if(_0xa3f676){return _0xa3f676[_0x44d7('0x29')](_0x15ba41)[_0x44d7('0x2a')](function(_0x264500){return _0x264500;});}return null;};}function removeEntity(_0x5de6b1,_0x1072f0){return function(_0x420708){if(_0x420708){return _0x420708[_0x44d7('0x2b')]()[_0x44d7('0x2a')](function(){_0x5de6b1[_0x44d7('0x1d')](0xcc)[_0x44d7('0x1e')]();});}};}function handleEntityNotFound(_0x4f7b20,_0x44d4b0){return function(_0x29c07d){if(!_0x29c07d){_0x4f7b20[_0x44d7('0x1c')](0x194);}return _0x29c07d;};}function handleError(_0x50c7f8,_0x3ada8f){_0x3ada8f=_0x3ada8f||0x1f4;return function(_0x465d3c){logger['error'](_0x465d3c['stack']);if(_0x465d3c[_0x44d7('0x2c')]){delete _0x465d3c[_0x44d7('0x2c')];}_0x50c7f8['status'](_0x3ada8f)[_0x44d7('0x2d')](_0x465d3c);};}exports[_0x44d7('0x2e')]=function(_0x451577,_0x21a184){var _0x1684eb={},_0x53eed0={},_0x3a8d5a={'count':0x0,'rows':[]};var _0x567e01=_[_0x44d7('0x2f')](db[_0x44d7('0x30')][_0x44d7('0x31')],function(_0x17bead){return{'name':_0x17bead[_0x44d7('0x32')],'type':_0x17bead[_0x44d7('0x33')]['key']};});_0x53eed0[_0x44d7('0x34')]=_[_0x44d7('0x2f')](_0x567e01,_0x44d7('0x2c'));_0x53eed0[_0x44d7('0x35')]=_[_0x44d7('0x36')](_0x451577['query']);_0x53eed0[_0x44d7('0x37')]=_[_0x44d7('0x38')](_0x53eed0[_0x44d7('0x34')],_0x53eed0['query']);_0x1684eb[_0x44d7('0x39')]=_[_0x44d7('0x38')](_0x53eed0['model'],qs[_0x44d7('0x3a')](_0x451577[_0x44d7('0x35')][_0x44d7('0x3a')]));_0x1684eb[_0x44d7('0x39')]=_0x1684eb['attributes'][_0x44d7('0x3b')]?_0x1684eb[_0x44d7('0x39')]:_0x53eed0[_0x44d7('0x34')];if(!_0x451577[_0x44d7('0x35')]['hasOwnProperty'](_0x44d7('0x3c'))){_0x1684eb[_0x44d7('0x21')]=qs[_0x44d7('0x21')](_0x451577['query'][_0x44d7('0x21')]);_0x1684eb[_0x44d7('0x1f')]=qs[_0x44d7('0x1f')](_0x451577['query'][_0x44d7('0x1f')]);}_0x1684eb['order']=qs['sort'](_0x451577[_0x44d7('0x35')]['sort']);_0x1684eb[_0x44d7('0x3d')]=qs[_0x44d7('0x37')](_[_0x44d7('0x3e')](_0x451577['query'],_0x53eed0['filters']),_0x567e01);if(_0x451577['query'][_0x44d7('0x3f')]){_0x1684eb[_0x44d7('0x3d')]=_[_0x44d7('0x40')](_0x1684eb[_0x44d7('0x3d')],{'$or':_[_0x44d7('0x2f')](_0x567e01,function(_0x275303){if(_0x275303[_0x44d7('0x33')]!==_0x44d7('0x41')){var _0x232b9d={};_0x232b9d[_0x275303[_0x44d7('0x2c')]]={'$like':'%'+_0x451577[_0x44d7('0x35')]['filter']+'%'};return _0x232b9d;}})});}_0x1684eb=_[_0x44d7('0x40')]({},_0x1684eb,_0x451577[_0x44d7('0x42')]);var _0x2e7135={'where':_0x1684eb[_0x44d7('0x3d')]};return db[_0x44d7('0x30')]['count'](_0x2e7135)[_0x44d7('0x2a')](function(_0x1435b6){_0x3a8d5a['count']=_0x1435b6;if(_0x451577[_0x44d7('0x35')][_0x44d7('0x43')]){_0x1684eb[_0x44d7('0x44')]=[{'all':!![]}];}return db[_0x44d7('0x30')]['findAll'](_0x1684eb);})[_0x44d7('0x2a')](function(_0x8fb38){_0x3a8d5a[_0x44d7('0x45')]=_0x8fb38;return _0x3a8d5a;})[_0x44d7('0x2a')](respondWithFilteredResult(_0x21a184,_0x1684eb))[_0x44d7('0x46')](handleError(_0x21a184,null));};exports['show']=function(_0xf10a4,_0x2a8cb7){var _0x57ea85={'raw':![],'where':{'id':_0xf10a4[_0x44d7('0x47')]['id']}},_0x54759f={};_0x54759f[_0x44d7('0x34')]=_[_0x44d7('0x36')](db['Dynamics365Configuration'][_0x44d7('0x31')]);_0x54759f[_0x44d7('0x35')]=_[_0x44d7('0x36')](_0xf10a4[_0x44d7('0x35')]);_0x54759f[_0x44d7('0x37')]=_['intersection'](_0x54759f['model'],_0x54759f[_0x44d7('0x35')]);_0x57ea85['attributes']=_[_0x44d7('0x38')](_0x54759f['model'],qs[_0x44d7('0x3a')](_0xf10a4['query']['fields']));_0x57ea85[_0x44d7('0x39')]=_0x57ea85[_0x44d7('0x39')][_0x44d7('0x3b')]?_0x57ea85[_0x44d7('0x39')]:_0x54759f[_0x44d7('0x34')];if(_0xf10a4[_0x44d7('0x35')]['includeAll']){_0x57ea85[_0x44d7('0x44')]=[{'all':!![]}];}_0x57ea85=_[_0x44d7('0x40')]({},_0x57ea85,_0xf10a4[_0x44d7('0x42')]);return db[_0x44d7('0x30')][_0x44d7('0x48')](_0x57ea85)[_0x44d7('0x2a')](handleEntityNotFound(_0x2a8cb7,null))['then'](respondWithResult(_0x2a8cb7,null))[_0x44d7('0x46')](handleError(_0x2a8cb7,null));};exports['create']=function(_0x2a20fe,_0x2498ae){return db[_0x44d7('0x30')]['create'](_0x2a20fe[_0x44d7('0x49')],{})[_0x44d7('0x2a')](respondWithResult(_0x2498ae,0xc9))[_0x44d7('0x46')](handleError(_0x2498ae,null));};exports[_0x44d7('0x29')]=function(_0x3c76f9,_0x534c49){if(_0x3c76f9['body']['id']){delete _0x3c76f9[_0x44d7('0x49')]['id'];}return db['Dynamics365Configuration'][_0x44d7('0x48')]({'where':{'id':_0x3c76f9['params']['id']}})[_0x44d7('0x2a')](handleEntityNotFound(_0x534c49,null))[_0x44d7('0x2a')](saveUpdates(_0x3c76f9[_0x44d7('0x49')],null))[_0x44d7('0x2a')](respondWithResult(_0x534c49,null))[_0x44d7('0x46')](handleError(_0x534c49,null));};exports[_0x44d7('0x2b')]=function(_0x345a97,_0x2cf384){return db[_0x44d7('0x30')][_0x44d7('0x48')]({'where':{'id':_0x345a97[_0x44d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cf384,null))['then'](removeEntity(_0x2cf384,null))[_0x44d7('0x46')](handleError(_0x2cf384,null));};exports[_0x44d7('0x4a')]=function(_0x4d52f9,_0x16689a,_0x264f3d){var _0x1552d8={};var _0x1fab77={};var _0x1df281;var _0x3fb370;return db[_0x44d7('0x30')][_0x44d7('0x4b')]({'where':{'id':_0x4d52f9[_0x44d7('0x47')]['id']}})[_0x44d7('0x2a')](handleEntityNotFound(_0x16689a,null))[_0x44d7('0x2a')](function(_0x4844d1){if(_0x4844d1){_0x1df281=_0x4844d1;_0x1fab77[_0x44d7('0x34')]=_[_0x44d7('0x36')](db['Dynamics365Field']['rawAttributes']);_0x1fab77[_0x44d7('0x35')]=_[_0x44d7('0x36')](_0x4d52f9['query']);_0x1fab77[_0x44d7('0x37')]=_[_0x44d7('0x38')](_0x1fab77[_0x44d7('0x34')],_0x1fab77[_0x44d7('0x35')]);_0x1552d8[_0x44d7('0x39')]=_[_0x44d7('0x38')](_0x1fab77[_0x44d7('0x34')],qs[_0x44d7('0x3a')](_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x3a')]));_0x1552d8[_0x44d7('0x39')]=_0x1552d8[_0x44d7('0x39')][_0x44d7('0x3b')]?_0x1552d8[_0x44d7('0x39')]:_0x1fab77[_0x44d7('0x34')];_0x1552d8['order']=qs[_0x44d7('0x4c')](_0x4d52f9['query'][_0x44d7('0x4c')]);_0x1552d8[_0x44d7('0x3d')]=qs['filters'](_[_0x44d7('0x3e')](_0x4d52f9['query'],_0x1fab77[_0x44d7('0x37')]));if(_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x3f')]){_0x1552d8['where']=_[_0x44d7('0x40')](_0x1552d8[_0x44d7('0x3d')],{'$or':_[_0x44d7('0x2f')](_0x1552d8[_0x44d7('0x39')],function(_0x2089b7){var _0x547df1={};_0x547df1[_0x2089b7]={'$like':'%'+_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x3f')]+'%'};return _0x547df1;})});}_0x1552d8=_[_0x44d7('0x40')]({},_0x1552d8,_0x4d52f9[_0x44d7('0x42')]);return _0x1df281[_0x44d7('0x4a')](_0x1552d8);}})[_0x44d7('0x2a')](function(_0xaf7938){if(_0xaf7938){_0x3fb370=_0xaf7938['length'];if(!_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x4d')](_0x44d7('0x3c'))){_0x1552d8[_0x44d7('0x21')]=qs[_0x44d7('0x21')](_0x4d52f9['query']['limit']);_0x1552d8[_0x44d7('0x1f')]=qs['offset'](_0x4d52f9[_0x44d7('0x35')][_0x44d7('0x1f')]);}return _0x1df281[_0x44d7('0x4a')](_0x1552d8);}})[_0x44d7('0x2a')](function(_0x20df7){if(_0x20df7){return _0x20df7?{'count':_0x3fb370,'rows':_0x20df7}:null;}})[_0x44d7('0x2a')](respondWithResult(_0x16689a,null))['catch'](handleError(_0x16689a,null));};exports[_0x44d7('0x4e')]=function(_0x161abb,_0x82c457,_0x256b66){var _0x4f0798={};var _0x5135cc={};var _0x2b5caf;var _0x31e72b;return db['Dynamics365Configuration'][_0x44d7('0x4b')]({'where':{'id':_0x161abb['params']['id']}})[_0x44d7('0x2a')](handleEntityNotFound(_0x82c457,null))[_0x44d7('0x2a')](function(_0x2b9374){if(_0x2b9374){_0x2b5caf=_0x2b9374;_0x5135cc[_0x44d7('0x34')]=_[_0x44d7('0x36')](db[_0x44d7('0x4f')][_0x44d7('0x31')]);_0x5135cc['query']=_[_0x44d7('0x36')](_0x161abb[_0x44d7('0x35')]);_0x5135cc['filters']=_[_0x44d7('0x38')](_0x5135cc['model'],_0x5135cc['query']);_0x4f0798['attributes']=_[_0x44d7('0x38')](_0x5135cc[_0x44d7('0x34')],qs[_0x44d7('0x3a')](_0x161abb[_0x44d7('0x35')][_0x44d7('0x3a')]));_0x4f0798[_0x44d7('0x39')]=_0x4f0798[_0x44d7('0x39')]['length']?_0x4f0798[_0x44d7('0x39')]:_0x5135cc[_0x44d7('0x34')];_0x4f0798[_0x44d7('0x50')]=qs[_0x44d7('0x4c')](_0x161abb[_0x44d7('0x35')][_0x44d7('0x4c')]);_0x4f0798['where']=qs[_0x44d7('0x37')](_[_0x44d7('0x3e')](_0x161abb[_0x44d7('0x35')],_0x5135cc[_0x44d7('0x37')]));if(_0x161abb[_0x44d7('0x35')]['filter']){_0x4f0798['where']=_[_0x44d7('0x40')](_0x4f0798[_0x44d7('0x3d')],{'$or':_[_0x44d7('0x2f')](_0x4f0798['attributes'],function(_0x46f197){var _0x251934={};_0x251934[_0x46f197]={'$like':'%'+_0x161abb[_0x44d7('0x35')]['filter']+'%'};return _0x251934;})});}_0x4f0798=_['merge']({},_0x4f0798,_0x161abb[_0x44d7('0x42')]);return _0x2b5caf['getSubjects'](_0x4f0798);}})[_0x44d7('0x2a')](function(_0x5aee6c){if(_0x5aee6c){_0x31e72b=_0x5aee6c[_0x44d7('0x3b')];if(!_0x161abb[_0x44d7('0x35')][_0x44d7('0x4d')](_0x44d7('0x3c'))){_0x4f0798['limit']=qs[_0x44d7('0x21')](_0x161abb['query'][_0x44d7('0x21')]);_0x4f0798[_0x44d7('0x1f')]=qs['offset'](_0x161abb[_0x44d7('0x35')]['offset']);}return _0x2b5caf[_0x44d7('0x4e')](_0x4f0798);}})[_0x44d7('0x2a')](function(_0x42c39e){if(_0x42c39e){return _0x42c39e?{'count':_0x31e72b,'rows':_0x42c39e}:null;}})[_0x44d7('0x2a')](respondWithResult(_0x82c457,null))[_0x44d7('0x46')](handleError(_0x82c457,null));};exports[_0x44d7('0x51')]=function(_0x25a7c0,_0x41cc21,_0x343f67){var _0x1c5bd2={};var _0x1b8efd={};var _0x3f4141;var _0x2e0f0b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x25a7c0[_0x44d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x41cc21,null))[_0x44d7('0x2a')](function(_0x1b3802){if(_0x1b3802){_0x3f4141=_0x1b3802;_0x1b8efd[_0x44d7('0x34')]=_['keys'](db[_0x44d7('0x4f')][_0x44d7('0x31')]);_0x1b8efd['query']=_['keys'](_0x25a7c0['query']);_0x1b8efd[_0x44d7('0x37')]=_[_0x44d7('0x38')](_0x1b8efd['model'],_0x1b8efd[_0x44d7('0x35')]);_0x1c5bd2['attributes']=_[_0x44d7('0x38')](_0x1b8efd[_0x44d7('0x34')],qs[_0x44d7('0x3a')](_0x25a7c0[_0x44d7('0x35')][_0x44d7('0x3a')]));_0x1c5bd2[_0x44d7('0x39')]=_0x1c5bd2[_0x44d7('0x39')][_0x44d7('0x3b')]?_0x1c5bd2[_0x44d7('0x39')]:_0x1b8efd['model'];_0x1c5bd2[_0x44d7('0x50')]=qs[_0x44d7('0x4c')](_0x25a7c0[_0x44d7('0x35')]['sort']);_0x1c5bd2[_0x44d7('0x3d')]=qs[_0x44d7('0x37')](_[_0x44d7('0x3e')](_0x25a7c0['query'],_0x1b8efd['filters']));if(_0x25a7c0['query'][_0x44d7('0x3f')]){_0x1c5bd2[_0x44d7('0x3d')]=_[_0x44d7('0x40')](_0x1c5bd2[_0x44d7('0x3d')],{'$or':_[_0x44d7('0x2f')](_0x1c5bd2['attributes'],function(_0x508f96){var _0x258add={};_0x258add[_0x508f96]={'$like':'%'+_0x25a7c0[_0x44d7('0x35')][_0x44d7('0x3f')]+'%'};return _0x258add;})});}_0x1c5bd2=_['merge']({},_0x1c5bd2,_0x25a7c0[_0x44d7('0x42')]);return _0x3f4141[_0x44d7('0x51')](_0x1c5bd2);}})[_0x44d7('0x2a')](function(_0x22fee5){if(_0x22fee5){_0x2e0f0b=_0x22fee5['length'];if(!_0x25a7c0['query']['hasOwnProperty'](_0x44d7('0x3c'))){_0x1c5bd2[_0x44d7('0x21')]=qs[_0x44d7('0x21')](_0x25a7c0[_0x44d7('0x35')][_0x44d7('0x21')]);_0x1c5bd2[_0x44d7('0x1f')]=qs[_0x44d7('0x1f')](_0x25a7c0[_0x44d7('0x35')][_0x44d7('0x1f')]);}return _0x3f4141[_0x44d7('0x51')](_0x1c5bd2);}})[_0x44d7('0x2a')](function(_0x3dd4bc){if(_0x3dd4bc){return _0x3dd4bc?{'count':_0x2e0f0b,'rows':_0x3dd4bc}:null;}})[_0x44d7('0x2a')](respondWithResult(_0x41cc21,null))[_0x44d7('0x46')](handleError(_0x41cc21,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4805bc3..537a120 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_0xb657b5,_0x3ccc00){var _0xa322a0=function(_0xfd0dd2){while(--_0xfd0dd2){_0xb657b5['push'](_0xb657b5['shift']());}};_0xa322a0(++_0x3ccc00);}(_0xedd9,0xfc));var _0x9edd=function(_0x392dbd,_0x22ef23){_0x392dbd=_0x392dbd-0x0;var _0x32cc7c=_0xedd9[_0x392dbd];return _0x32cc7c;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x537d72,_0x4577af){var _0x7e2aec=function(_0xc831b1){while(--_0xc831b1){_0x537d72['push'](_0x537d72['shift']());}};_0x7e2aec(++_0x4577af);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0xb4e6[_0x333798];return _0x389f4e;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','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 1aff41b..c227431 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 _0xc45c=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x476162,_0x25ac1b){var _0x5b8fc8=function(_0x23e713){while(--_0x23e713){_0x476162['push'](_0x476162['shift']());}};_0x5b8fc8(++_0x25ac1b);}(_0xc45c,0x18d));var _0xcc45=function(_0x2f5d5f,_0x114b20){_0x2f5d5f=_0x2f5d5f-0x0;var _0xbda404=_0xc45c[_0x2f5d5f];return _0xbda404;};'use strict';var _=require('lodash');var util=require(_0xcc45('0x0'));var moment=require(_0xcc45('0x1'));var BPromise=require(_0xcc45('0x2'));var rs=require(_0xcc45('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc45('0x4'))['db'];var utils=require(_0xcc45('0x5'));var logger=require(_0xcc45('0x6'))(_0xcc45('0x7'));var config=require(_0xcc45('0x8'));var jayson=require(_0xcc45('0x9'));var client=jayson[_0xcc45('0xa')][_0xcc45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x528bbd,_0x25474b,_0x35ba0a){return new BPromise(function(_0x529cd3,_0x5b33a4){return client[_0xcc45('0xc')](_0x528bbd,_0x35ba0a)['then'](function(_0x5afe76){logger[_0xcc45('0xd')](_0xcc45('0xe'),_0x25474b,_0xcc45('0xf'));logger['debug'](_0xcc45('0x10'),_0x25474b,'request\x20sent',JSON[_0xcc45('0x11')](_0x5afe76));if(_0x5afe76[_0xcc45('0x12')]){if(_0x5afe76[_0xcc45('0x12')][_0xcc45('0x13')]===0x1f4){logger[_0xcc45('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x25474b,_0x5afe76[_0xcc45('0x12')]['message']);return _0x5b33a4(_0x5afe76[_0xcc45('0x12')]['message']);}logger[_0xcc45('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x25474b,_0x5afe76[_0xcc45('0x12')][_0xcc45('0x14')]);return _0x529cd3(_0x5afe76[_0xcc45('0x12')]['message']);}else{logger[_0xcc45('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x25474b,'request\x20sent');_0x529cd3(_0x5afe76[_0xcc45('0x15')][_0xcc45('0x14')]);}})[_0xcc45('0x16')](function(_0x2fcc8c){logger[_0xcc45('0x12')](_0xcc45('0xe'),_0x25474b,_0x2fcc8c);_0x5b33a4(_0x2fcc8c);});});} \ No newline at end of file +var _0x0763=['client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x58592c,_0x18233d){var _0x4dcf36=function(_0x37e56c){while(--_0x37e56c){_0x58592c['push'](_0x58592c['shift']());}};_0x4dcf36(++_0x18233d);}(_0x0763,0x65));var _0x3076=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x0763[_0x119cd8];return _0x7072a3;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var moment=require(_0x3076('0x1'));var BPromise=require(_0x3076('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3076('0x3'));var db=require(_0x3076('0x4'))['db'];var utils=require(_0x3076('0x5'));var logger=require(_0x3076('0x6'))('rpc');var config=require(_0x3076('0x7'));var jayson=require(_0x3076('0x8'));var client=jayson[_0x3076('0x9')][_0x3076('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c154d,_0x14cdf3,_0x1ab2c1){return new BPromise(function(_0x26549b,_0x553854){return client[_0x3076('0xb')](_0x3c154d,_0x1ab2c1)[_0x3076('0xc')](function(_0xabc86b){logger[_0x3076('0xd')](_0x3076('0xe'),_0x14cdf3,_0x3076('0xf'));logger['debug'](_0x3076('0x10'),_0x14cdf3,_0x3076('0xf'),JSON[_0x3076('0x11')](_0xabc86b));if(_0xabc86b[_0x3076('0x12')]){if(_0xabc86b[_0x3076('0x12')][_0x3076('0x13')]===0x1f4){logger[_0x3076('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x14cdf3,_0xabc86b[_0x3076('0x12')][_0x3076('0x14')]);return _0x553854(_0xabc86b[_0x3076('0x12')][_0x3076('0x14')]);}logger[_0x3076('0x12')](_0x3076('0xe'),_0x14cdf3,_0xabc86b[_0x3076('0x12')][_0x3076('0x14')]);return _0x26549b(_0xabc86b[_0x3076('0x12')]['message']);}else{logger[_0x3076('0xd')](_0x3076('0xe'),_0x14cdf3,_0x3076('0xf'));_0x26549b(_0xabc86b[_0x3076('0x15')][_0x3076('0x14')]);}})['catch'](function(_0x5b1967){logger['error'](_0x3076('0xe'),_0x14cdf3,_0x5b1967);_0x553854(_0x5b1967);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ee4dd98..78604f0 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 _0xc9bd=['../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5962a0,_0x40eade){var _0x4012ab=function(_0x3f337e){while(--_0x3f337e){_0x5962a0['push'](_0x5962a0['shift']());}};_0x4012ab(++_0x40eade);}(_0xc9bd,0x13c));var _0xdc9b=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0xc9bd[_0x53f964];return _0x17be6c;};'use strict';var multer=require(_0xdc9b('0x0'));var util=require(_0xdc9b('0x1'));var path=require(_0xdc9b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdc9b('0x3')]();var fs_extra=require(_0xdc9b('0x4'));var auth=require(_0xdc9b('0x5'));var interaction=require(_0xdc9b('0x6'));var config=require(_0xdc9b('0x7'));var controller=require(_0xdc9b('0x8'));router['get']('/',auth[_0xdc9b('0x9')](),controller[_0xdc9b('0xa')]);router[_0xdc9b('0xb')](_0xdc9b('0xc'),auth[_0xdc9b('0x9')](),controller[_0xdc9b('0xd')]);router['post']('/',auth[_0xdc9b('0x9')](),controller[_0xdc9b('0xe')]);router[_0xdc9b('0xf')](_0xdc9b('0xc'),auth[_0xdc9b('0x9')](),controller[_0xdc9b('0x10')]);router[_0xdc9b('0x11')](_0xdc9b('0xc'),auth[_0xdc9b('0x9')](),controller['destroy']);module[_0xdc9b('0x12')]=router; \ No newline at end of file +var _0x1940=['show','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x1940,0x1f2));var _0x0194=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x1940[_0x2468b5];return _0x1056e4;};'use strict';var multer=require('multer');var util=require(_0x0194('0x0'));var path=require(_0x0194('0x1'));var timeout=require(_0x0194('0x2'));var express=require(_0x0194('0x3'));var router=express[_0x0194('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0194('0x5'));var interaction=require(_0x0194('0x6'));var config=require('../../config/environment');var controller=require(_0x0194('0x7'));router[_0x0194('0x8')]('/',auth[_0x0194('0x9')](),controller[_0x0194('0xa')]);router[_0x0194('0x8')](_0x0194('0xb'),auth['isAuthenticated'](),controller[_0x0194('0xc')]);router['post']('/',auth[_0x0194('0x9')](),controller['create']);router[_0x0194('0xd')](_0x0194('0xb'),auth['isAuthenticated'](),controller[_0x0194('0xe')]);router['delete'](_0x0194('0xb'),auth[_0x0194('0x9')](),controller[_0x0194('0xf')]);module[_0x0194('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 91dfc67..e81c3db 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 _0xb20a=['STRING','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xb20a,0x171));var _0xab20=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb20a[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require('sequelize');module[_0xab20('0x0')]={'type':{'type':Sequelize[_0xab20('0x1')](_0xab20('0x2'),_0xab20('0x3'),_0xab20('0x4'),_0xab20('0x5'),_0xab20('0x6')),'defaultValue':_0xab20('0x2')},'content':{'type':Sequelize[_0xab20('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xab20('0x1')](_0xab20('0x2'),_0xab20('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xab20('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab20('0x7')]}}; \ No newline at end of file +var _0x50f9=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x1f5315,_0x5f0fc9){var _0x52220e=function(_0x41b511){while(--_0x41b511){_0x1f5315['push'](_0x1f5315['shift']());}};_0x52220e(++_0x5f0fc9);}(_0x50f9,0xf4));var _0x950f=function(_0x22a7ef,_0x1d79aa){_0x22a7ef=_0x22a7ef-0x0;var _0x3cb7f9=_0x50f9[_0x22a7ef];return _0x3cb7f9;};'use strict';var Sequelize=require(_0x950f('0x0'));module[_0x950f('0x1')]={'type':{'type':Sequelize[_0x950f('0x2')](_0x950f('0x3'),_0x950f('0x4'),_0x950f('0x5'),'keyValue',_0x950f('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x950f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x950f('0x2')]('string','variable',_0x950f('0x5'))},'keyContent':{'type':Sequelize[_0x950f('0x7')]},'idField':{'type':Sequelize[_0x950f('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index bdab331..7de02a7 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 _0x5ccb=['then','error','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','include','Dynamics365Field','findAll','catch','show','params','intersection','fields','create','body','update','destroy','find','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject'];(function(_0x10df05,_0x5d1b29){var _0xd7b725=function(_0xebc4b){while(--_0xebc4b){_0x10df05['push'](_0x10df05['shift']());}};_0xd7b725(++_0x5d1b29);}(_0x5ccb,0xf1));var _0xb5cc=function(_0x4deff,_0x42c328){_0x4deff=_0x4deff-0x0;var _0x440123=_0x5ccb[_0x4deff];return _0x440123;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb5cc('0x0'));var jsonpatch=require(_0xb5cc('0x1'));var rp=require(_0xb5cc('0x2'));var moment=require(_0xb5cc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb5cc('0x4'));var util=require('util');var path=require('path');var sox=require(_0xb5cc('0x5'));var csv=require(_0xb5cc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5cc('0x7'));var _=require(_0xb5cc('0x8'));var squel=require(_0xb5cc('0x9'));var crypto=require(_0xb5cc('0xa'));var jsforce=require(_0xb5cc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb5cc('0x6'));var querystring=require('querystring');var Papa=require(_0xb5cc('0xc'));var Redis=require(_0xb5cc('0xd'));var authService=require(_0xb5cc('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb5cc('0xf'));var hardwareService=require(_0xb5cc('0x10'));var logger=require(_0xb5cc('0x11'))('api');var utils=require(_0xb5cc('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb5cc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x466f86,_0x55514d){_0x55514d=_0x55514d||0xcc;return function(_0x3ceff0){if(_0x3ceff0){return _0x466f86[_0xb5cc('0x14')](_0x55514d);}return _0x466f86[_0xb5cc('0x15')](_0x55514d)[_0xb5cc('0x16')]();};}function respondWithResult(_0x3911fc,_0x3a96ba){_0x3a96ba=_0x3a96ba||0xc8;return function(_0x47b5a0){if(_0x47b5a0){return _0x3911fc[_0xb5cc('0x15')](_0x3a96ba)[_0xb5cc('0x17')](_0x47b5a0);}};}function respondWithFilteredResult(_0x5341cf,_0x999f97){return function(_0x723807){if(_0x723807){var _0x56a61c=typeof _0x999f97['offset']===_0xb5cc('0x18')&&typeof _0x999f97[_0xb5cc('0x19')]===_0xb5cc('0x18');var _0x387258=_0x723807[_0xb5cc('0x1a')];var _0x181eda=_0x56a61c?0x0:_0x999f97[_0xb5cc('0x1b')];var _0x31be1f=_0x56a61c?_0x723807['count']:_0x999f97['offset']+_0x999f97[_0xb5cc('0x19')];var _0x53a810;if(_0x31be1f>=_0x387258){_0x31be1f=_0x387258;_0x53a810=0xc8;}else{_0x53a810=0xce;}_0x5341cf[_0xb5cc('0x15')](_0x53a810);return _0x5341cf['set'](_0xb5cc('0x1c'),_0x181eda+'-'+_0x31be1f+'/'+_0x387258)['json'](_0x723807);}return null;};}function patchUpdates(_0x3d4543){return function(_0x4e05cb){try{jsonpatch[_0xb5cc('0x1d')](_0x4e05cb,_0x3d4543,!![]);}catch(_0x55029e){return BPromise[_0xb5cc('0x1e')](_0x55029e);}return _0x4e05cb['save']();};}function saveUpdates(_0x3eae4e,_0x5b0166){return function(_0x532aa9){if(_0x532aa9){return _0x532aa9['update'](_0x3eae4e)[_0xb5cc('0x1f')](function(_0x470ba3){return _0x470ba3;});}return null;};}function removeEntity(_0x29c6f0,_0x4ba7aa){return function(_0x53ee1c){if(_0x53ee1c){return _0x53ee1c['destroy']()['then'](function(){_0x29c6f0[_0xb5cc('0x15')](0xcc)[_0xb5cc('0x16')]();});}};}function handleEntityNotFound(_0xf8246b,_0x11df12){return function(_0x43430a){if(!_0x43430a){_0xf8246b[_0xb5cc('0x14')](0x194);}return _0x43430a;};}function handleError(_0x4a5868,_0x563e95){_0x563e95=_0x563e95||0x1f4;return function(_0x5f0056){logger[_0xb5cc('0x20')](_0x5f0056['stack']);if(_0x5f0056[_0xb5cc('0x21')]){delete _0x5f0056[_0xb5cc('0x21')];}_0x4a5868[_0xb5cc('0x15')](_0x563e95)[_0xb5cc('0x22')](_0x5f0056);};}exports[_0xb5cc('0x23')]=function(_0x2a0fef,_0x4d4f18){var _0xe03b6e={},_0x1272b3={},_0x198413={'count':0x0,'rows':[]};var _0x549c39=_['map'](db['Dynamics365Field'][_0xb5cc('0x24')],function(_0x6c796){return{'name':_0x6c796[_0xb5cc('0x25')],'type':_0x6c796['type']['key']};});_0x1272b3[_0xb5cc('0x26')]=_[_0xb5cc('0x27')](_0x549c39,_0xb5cc('0x21'));_0x1272b3[_0xb5cc('0x28')]=_[_0xb5cc('0x29')](_0x2a0fef[_0xb5cc('0x28')]);_0x1272b3[_0xb5cc('0x2a')]=_['intersection'](_0x1272b3[_0xb5cc('0x26')],_0x1272b3['query']);_0xe03b6e[_0xb5cc('0x2b')]=_['intersection'](_0x1272b3['model'],qs['fields'](_0x2a0fef[_0xb5cc('0x28')]['fields']));_0xe03b6e['attributes']=_0xe03b6e[_0xb5cc('0x2b')][_0xb5cc('0x2c')]?_0xe03b6e[_0xb5cc('0x2b')]:_0x1272b3['model'];if(!_0x2a0fef[_0xb5cc('0x28')][_0xb5cc('0x2d')](_0xb5cc('0x2e'))){_0xe03b6e[_0xb5cc('0x19')]=qs['limit'](_0x2a0fef['query']['limit']);_0xe03b6e[_0xb5cc('0x1b')]=qs['offset'](_0x2a0fef['query'][_0xb5cc('0x1b')]);}_0xe03b6e[_0xb5cc('0x2f')]=qs[_0xb5cc('0x30')](_0x2a0fef[_0xb5cc('0x28')]['sort']);_0xe03b6e[_0xb5cc('0x31')]=qs[_0xb5cc('0x2a')](_['pick'](_0x2a0fef['query'],_0x1272b3[_0xb5cc('0x2a')]),_0x549c39);if(_0x2a0fef['query'][_0xb5cc('0x32')]){_0xe03b6e['where']=_['merge'](_0xe03b6e[_0xb5cc('0x31')],{'$or':_[_0xb5cc('0x27')](_0x549c39,function(_0x4a4ec1){if(_0x4a4ec1[_0xb5cc('0x33')]!=='VIRTUAL'){var _0x33a91d={};_0x33a91d[_0x4a4ec1[_0xb5cc('0x21')]]={'$like':'%'+_0x2a0fef['query'][_0xb5cc('0x32')]+'%'};return _0x33a91d;}})});}_0xe03b6e=_[_0xb5cc('0x34')]({},_0xe03b6e,_0x2a0fef[_0xb5cc('0x35')]);var _0x285315={'where':_0xe03b6e[_0xb5cc('0x31')]};return db['Dynamics365Field'][_0xb5cc('0x1a')](_0x285315)[_0xb5cc('0x1f')](function(_0x29ad2c){_0x198413[_0xb5cc('0x1a')]=_0x29ad2c;if(_0x2a0fef['query'][_0xb5cc('0x36')]){_0xe03b6e[_0xb5cc('0x37')]=[{'all':!![]}];}return db[_0xb5cc('0x38')][_0xb5cc('0x39')](_0xe03b6e);})[_0xb5cc('0x1f')](function(_0x321a0b){_0x198413['rows']=_0x321a0b;return _0x198413;})[_0xb5cc('0x1f')](respondWithFilteredResult(_0x4d4f18,_0xe03b6e))[_0xb5cc('0x3a')](handleError(_0x4d4f18,null));};exports[_0xb5cc('0x3b')]=function(_0x5c83b0,_0x46e218){var _0xbe5410={'raw':!![],'where':{'id':_0x5c83b0[_0xb5cc('0x3c')]['id']}},_0x15ce5e={};_0x15ce5e[_0xb5cc('0x26')]=_[_0xb5cc('0x29')](db['Dynamics365Field']['rawAttributes']);_0x15ce5e[_0xb5cc('0x28')]=_[_0xb5cc('0x29')](_0x5c83b0[_0xb5cc('0x28')]);_0x15ce5e['filters']=_[_0xb5cc('0x3d')](_0x15ce5e['model'],_0x15ce5e[_0xb5cc('0x28')]);_0xbe5410[_0xb5cc('0x2b')]=_[_0xb5cc('0x3d')](_0x15ce5e[_0xb5cc('0x26')],qs['fields'](_0x5c83b0[_0xb5cc('0x28')][_0xb5cc('0x3e')]));_0xbe5410[_0xb5cc('0x2b')]=_0xbe5410['attributes'][_0xb5cc('0x2c')]?_0xbe5410[_0xb5cc('0x2b')]:_0x15ce5e[_0xb5cc('0x26')];if(_0x5c83b0[_0xb5cc('0x28')][_0xb5cc('0x36')]){_0xbe5410[_0xb5cc('0x37')]=[{'all':!![]}];}_0xbe5410=_[_0xb5cc('0x34')]({},_0xbe5410,_0x5c83b0[_0xb5cc('0x35')]);return db[_0xb5cc('0x38')]['find'](_0xbe5410)[_0xb5cc('0x1f')](handleEntityNotFound(_0x46e218,null))['then'](respondWithResult(_0x46e218,null))['catch'](handleError(_0x46e218,null));};exports[_0xb5cc('0x3f')]=function(_0x49d7a2,_0x292a24){return db[_0xb5cc('0x38')][_0xb5cc('0x3f')](_0x49d7a2[_0xb5cc('0x40')],{})['then'](respondWithResult(_0x292a24,0xc9))[_0xb5cc('0x3a')](handleError(_0x292a24,null));};exports[_0xb5cc('0x41')]=function(_0x17da64,_0x3e7833){if(_0x17da64[_0xb5cc('0x40')]['id']){delete _0x17da64['body']['id'];}return db[_0xb5cc('0x38')]['find']({'where':{'id':_0x17da64[_0xb5cc('0x3c')]['id']}})[_0xb5cc('0x1f')](handleEntityNotFound(_0x3e7833,null))['then'](saveUpdates(_0x17da64[_0xb5cc('0x40')],null))[_0xb5cc('0x1f')](respondWithResult(_0x3e7833,null))[_0xb5cc('0x3a')](handleError(_0x3e7833,null));};exports[_0xb5cc('0x42')]=function(_0x5ff8e8,_0x300be1){return db['Dynamics365Field'][_0xb5cc('0x43')]({'where':{'id':_0x5ff8e8[_0xb5cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0x300be1,null))[_0xb5cc('0x1f')](removeEntity(_0x300be1,null))[_0xb5cc('0x3a')](handleError(_0x300be1,null));}; \ No newline at end of file +var _0xce10=['options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','map','Dynamics365Field','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xce10,0x16f));var _0x0ce1=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0xce10[_0x367e5b];return _0x4b909e;};'use strict';var emlformat=require(_0x0ce1('0x0'));var rimraf=require(_0x0ce1('0x1'));var zipdir=require(_0x0ce1('0x2'));var jsonpatch=require(_0x0ce1('0x3'));var rp=require('request-promise');var moment=require(_0x0ce1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0ce1('0x5'));var util=require(_0x0ce1('0x6'));var path=require('path');var sox=require(_0x0ce1('0x7'));var csv=require(_0x0ce1('0x8'));var ejs=require(_0x0ce1('0x9'));var fs=require('fs');var fs_extra=require(_0x0ce1('0xa'));var _=require(_0x0ce1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0ce1('0xc'));var deskjs=require(_0x0ce1('0xd'));var toCsv=require(_0x0ce1('0x8'));var querystring=require(_0x0ce1('0xe'));var Papa=require('papaparse');var Redis=require(_0x0ce1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0ce1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ce1('0x11'));var logger=require(_0x0ce1('0x12'))(_0x0ce1('0x13'));var utils=require(_0x0ce1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0ce1('0x15'));var db=require(_0x0ce1('0x16'))['db'];function respondWithStatusCode(_0xc186f9,_0x104788){_0x104788=_0x104788||0xcc;return function(_0x298398){if(_0x298398){return _0xc186f9['sendStatus'](_0x104788);}return _0xc186f9[_0x0ce1('0x17')](_0x104788)[_0x0ce1('0x18')]();};}function respondWithResult(_0x1ff0cf,_0x476823){_0x476823=_0x476823||0xc8;return function(_0x5169c7){if(_0x5169c7){return _0x1ff0cf[_0x0ce1('0x17')](_0x476823)[_0x0ce1('0x19')](_0x5169c7);}};}function respondWithFilteredResult(_0x860364,_0x191382){return function(_0x12ed18){if(_0x12ed18){var _0x11cfae=typeof _0x191382['offset']===_0x0ce1('0x1a')&&typeof _0x191382['limit']==='undefined';var _0x105e6b=_0x12ed18[_0x0ce1('0x1b')];var _0x3370e3=_0x11cfae?0x0:_0x191382[_0x0ce1('0x1c')];var _0x66c552=_0x11cfae?_0x12ed18[_0x0ce1('0x1b')]:_0x191382[_0x0ce1('0x1c')]+_0x191382['limit'];var _0x2c9c38;if(_0x66c552>=_0x105e6b){_0x66c552=_0x105e6b;_0x2c9c38=0xc8;}else{_0x2c9c38=0xce;}_0x860364[_0x0ce1('0x17')](_0x2c9c38);return _0x860364['set'](_0x0ce1('0x1d'),_0x3370e3+'-'+_0x66c552+'/'+_0x105e6b)[_0x0ce1('0x19')](_0x12ed18);}return null;};}function patchUpdates(_0x3456dc){return function(_0x459019){try{jsonpatch[_0x0ce1('0x1e')](_0x459019,_0x3456dc,!![]);}catch(_0x52c725){return BPromise['reject'](_0x52c725);}return _0x459019['save']();};}function saveUpdates(_0xd12639,_0x26ba82){return function(_0x174dd5){if(_0x174dd5){return _0x174dd5[_0x0ce1('0x1f')](_0xd12639)[_0x0ce1('0x20')](function(_0x55aa33){return _0x55aa33;});}return null;};}function removeEntity(_0x1d8113,_0x374424){return function(_0x371e98){if(_0x371e98){return _0x371e98[_0x0ce1('0x21')]()[_0x0ce1('0x20')](function(){_0x1d8113[_0x0ce1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a8b0,_0x1d28eb){return function(_0x4f85c1){if(!_0x4f85c1){_0x59a8b0[_0x0ce1('0x22')](0x194);}return _0x4f85c1;};}function handleError(_0x16cc61,_0x128d63){_0x128d63=_0x128d63||0x1f4;return function(_0xa748aa){logger['error'](_0xa748aa[_0x0ce1('0x23')]);if(_0xa748aa['name']){delete _0xa748aa[_0x0ce1('0x24')];}_0x16cc61[_0x0ce1('0x17')](_0x128d63)[_0x0ce1('0x25')](_0xa748aa);};}exports[_0x0ce1('0x26')]=function(_0x4ab952,_0x4b5899){var _0x549f7e={},_0x41f47d={},_0x4f2c2d={'count':0x0,'rows':[]};var _0x3c7b3d=_[_0x0ce1('0x27')](db[_0x0ce1('0x28')]['rawAttributes'],function(_0x3ab2b6){return{'name':_0x3ab2b6['fieldName'],'type':_0x3ab2b6['type'][_0x0ce1('0x29')]};});_0x41f47d[_0x0ce1('0x2a')]=_[_0x0ce1('0x27')](_0x3c7b3d,'name');_0x41f47d[_0x0ce1('0x2b')]=_[_0x0ce1('0x2c')](_0x4ab952['query']);_0x41f47d['filters']=_[_0x0ce1('0x2d')](_0x41f47d[_0x0ce1('0x2a')],_0x41f47d[_0x0ce1('0x2b')]);_0x549f7e[_0x0ce1('0x2e')]=_['intersection'](_0x41f47d['model'],qs[_0x0ce1('0x2f')](_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x2f')]));_0x549f7e[_0x0ce1('0x2e')]=_0x549f7e[_0x0ce1('0x2e')]['length']?_0x549f7e['attributes']:_0x41f47d[_0x0ce1('0x2a')];if(!_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x30')](_0x0ce1('0x31'))){_0x549f7e['limit']=qs[_0x0ce1('0x32')](_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x32')]);_0x549f7e[_0x0ce1('0x1c')]=qs['offset'](_0x4ab952['query']['offset']);}_0x549f7e[_0x0ce1('0x33')]=qs['sort'](_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x34')]);_0x549f7e[_0x0ce1('0x35')]=qs[_0x0ce1('0x36')](_['pick'](_0x4ab952[_0x0ce1('0x2b')],_0x41f47d[_0x0ce1('0x36')]),_0x3c7b3d);if(_0x4ab952[_0x0ce1('0x2b')][_0x0ce1('0x37')]){_0x549f7e[_0x0ce1('0x35')]=_[_0x0ce1('0x38')](_0x549f7e[_0x0ce1('0x35')],{'$or':_[_0x0ce1('0x27')](_0x3c7b3d,function(_0x48feb0){if(_0x48feb0[_0x0ce1('0x39')]!==_0x0ce1('0x3a')){var _0x2d97a8={};_0x2d97a8[_0x48feb0['name']]={'$like':'%'+_0x4ab952[_0x0ce1('0x2b')]['filter']+'%'};return _0x2d97a8;}})});}_0x549f7e=_['merge']({},_0x549f7e,_0x4ab952[_0x0ce1('0x3b')]);var _0x4f5e5b={'where':_0x549f7e[_0x0ce1('0x35')]};return db[_0x0ce1('0x28')][_0x0ce1('0x1b')](_0x4f5e5b)['then'](function(_0x33a44e){_0x4f2c2d[_0x0ce1('0x1b')]=_0x33a44e;if(_0x4ab952['query'][_0x0ce1('0x3c')]){_0x549f7e['include']=[{'all':!![]}];}return db[_0x0ce1('0x28')][_0x0ce1('0x3d')](_0x549f7e);})[_0x0ce1('0x20')](function(_0x5e4632){_0x4f2c2d[_0x0ce1('0x3e')]=_0x5e4632;return _0x4f2c2d;})[_0x0ce1('0x20')](respondWithFilteredResult(_0x4b5899,_0x549f7e))[_0x0ce1('0x3f')](handleError(_0x4b5899,null));};exports[_0x0ce1('0x40')]=function(_0x578d75,_0x3bfaa7){var _0x2b99ae={'raw':!![],'where':{'id':_0x578d75[_0x0ce1('0x41')]['id']}},_0x4fe4f1={};_0x4fe4f1[_0x0ce1('0x2a')]=_[_0x0ce1('0x2c')](db[_0x0ce1('0x28')][_0x0ce1('0x42')]);_0x4fe4f1[_0x0ce1('0x2b')]=_['keys'](_0x578d75[_0x0ce1('0x2b')]);_0x4fe4f1[_0x0ce1('0x36')]=_['intersection'](_0x4fe4f1[_0x0ce1('0x2a')],_0x4fe4f1[_0x0ce1('0x2b')]);_0x2b99ae[_0x0ce1('0x2e')]=_['intersection'](_0x4fe4f1[_0x0ce1('0x2a')],qs['fields'](_0x578d75[_0x0ce1('0x2b')][_0x0ce1('0x2f')]));_0x2b99ae[_0x0ce1('0x2e')]=_0x2b99ae[_0x0ce1('0x2e')]['length']?_0x2b99ae[_0x0ce1('0x2e')]:_0x4fe4f1[_0x0ce1('0x2a')];if(_0x578d75[_0x0ce1('0x2b')][_0x0ce1('0x3c')]){_0x2b99ae[_0x0ce1('0x43')]=[{'all':!![]}];}_0x2b99ae=_[_0x0ce1('0x38')]({},_0x2b99ae,_0x578d75[_0x0ce1('0x3b')]);return db[_0x0ce1('0x28')]['find'](_0x2b99ae)[_0x0ce1('0x20')](handleEntityNotFound(_0x3bfaa7,null))['then'](respondWithResult(_0x3bfaa7,null))[_0x0ce1('0x3f')](handleError(_0x3bfaa7,null));};exports[_0x0ce1('0x44')]=function(_0x25a104,_0x5edd61){return db[_0x0ce1('0x28')][_0x0ce1('0x44')](_0x25a104[_0x0ce1('0x45')],{})['then'](respondWithResult(_0x5edd61,0xc9))[_0x0ce1('0x3f')](handleError(_0x5edd61,null));};exports[_0x0ce1('0x1f')]=function(_0x1c0760,_0xa1223){if(_0x1c0760[_0x0ce1('0x45')]['id']){delete _0x1c0760[_0x0ce1('0x45')]['id'];}return db[_0x0ce1('0x28')]['find']({'where':{'id':_0x1c0760['params']['id']}})['then'](handleEntityNotFound(_0xa1223,null))[_0x0ce1('0x20')](saveUpdates(_0x1c0760['body'],null))[_0x0ce1('0x20')](respondWithResult(_0xa1223,null))[_0x0ce1('0x3f')](handleError(_0xa1223,null));};exports['destroy']=function(_0x5d3a50,_0x522142){return db[_0x0ce1('0x28')][_0x0ce1('0x46')]({'where':{'id':_0x5d3a50['params']['id']}})[_0x0ce1('0x20')](handleEntityNotFound(_0x522142,null))[_0x0ce1('0x20')](removeEntity(_0x522142,null))[_0x0ce1('0x3f')](handleError(_0x522142,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c9cf96c..04355de 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 _0x963e=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId'];(function(_0x1c686f,_0x27820d){var _0x1f0326=function(_0x100e12){while(--_0x100e12){_0x1c686f['push'](_0x1c686f['shift']());}};_0x1f0326(++_0x27820d);}(_0x963e,0xea));var _0xe963=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0x963e[_0x74745d];return _0x174ab3;};'use strict';var _=require(_0xe963('0x0'));var util=require('util');var logger=require(_0xe963('0x1'))(_0xe963('0x2'));var moment=require(_0xe963('0x3'));var BPromise=require(_0xe963('0x4'));var rp=require(_0xe963('0x5'));var fs=require('fs');var path=require(_0xe963('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xe963('0x7')]=function(_0x381c33,_0x57cbe8){return _0x381c33[_0xe963('0x8')](_0xe963('0x9'),attributes,{'tableName':_0xe963('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xe963('0xb'),_0xe963('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x832c=['define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x832c,0x91));var _0xc832=function(_0x371840,_0x3efb8d){_0x371840=_0x371840-0x0;var _0x465bde=_0x832c[_0x371840];return _0x465bde;};'use strict';var _=require(_0xc832('0x0'));var util=require(_0xc832('0x1'));var logger=require(_0xc832('0x2'))(_0xc832('0x3'));var moment=require(_0xc832('0x4'));var BPromise=require(_0xc832('0x5'));var rp=require(_0xc832('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc832('0x7'));var config=require(_0xc832('0x8'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x132f3a,_0x3cf440){return _0x132f3a[_0xc832('0x9')](_0xc832('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xc832('0xb'),'fields':[_0xc832('0xc'),_0xc832('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 441d29d..944e4cd 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 _0x15fb=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment'];(function(_0x2439f7,_0x493296){var _0x2c33db=function(_0x539bd9){while(--_0x539bd9){_0x2439f7['push'](_0x2439f7['shift']());}};_0x2c33db(++_0x493296);}(_0x15fb,0x177));var _0xb15f=function(_0x2b3a6b,_0x3cd8e7){_0x2b3a6b=_0x2b3a6b-0x0;var _0x3bd7ba=_0x15fb[_0x2b3a6b];return _0x3bd7ba;};'use strict';var _=require(_0xb15f('0x0'));var util=require(_0xb15f('0x1'));var moment=require(_0xb15f('0x2'));var BPromise=require(_0xb15f('0x3'));var rs=require(_0xb15f('0x4'));var fs=require('fs');var Redis=require(_0xb15f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb15f('0x6'))(_0xb15f('0x7'));var config=require(_0xb15f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb15f('0x9')][_0xb15f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2917f5,_0x33292b,_0x37933d){return new BPromise(function(_0x38eeb6,_0x179e96){return client['request'](_0x2917f5,_0x37933d)[_0xb15f('0xb')](function(_0x4a1ce2){logger[_0xb15f('0xc')](_0xb15f('0xd'),_0x33292b,_0xb15f('0xe'));logger[_0xb15f('0xf')](_0xb15f('0x10'),_0x33292b,_0xb15f('0xe'),JSON[_0xb15f('0x11')](_0x4a1ce2));if(_0x4a1ce2[_0xb15f('0x12')]){if(_0x4a1ce2['error']['code']===0x1f4){logger[_0xb15f('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x33292b,_0x4a1ce2[_0xb15f('0x12')]['message']);return _0x179e96(_0x4a1ce2[_0xb15f('0x12')][_0xb15f('0x13')]);}logger[_0xb15f('0x12')](_0xb15f('0xd'),_0x33292b,_0x4a1ce2[_0xb15f('0x12')][_0xb15f('0x13')]);return _0x38eeb6(_0x4a1ce2['error'][_0xb15f('0x13')]);}else{logger[_0xb15f('0xc')](_0xb15f('0xd'),_0x33292b,_0xb15f('0xe'));_0x38eeb6(_0x4a1ce2['result'][_0xb15f('0x13')]);}})[_0xb15f('0x14')](function(_0x462653){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x33292b,_0x462653);_0x179e96(_0x462653);});});} \ No newline at end of file +var _0x32df=['client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x73b80e,_0x4daa4a){var _0x4c31cd=function(_0x3663a0){while(--_0x3663a0){_0x73b80e['push'](_0x73b80e['shift']());}};_0x4c31cd(++_0x4daa4a);}(_0x32df,0xe7));var _0xf32d=function(_0x547e67,_0x47df43){_0x547e67=_0x547e67-0x0;var _0xc791c5=_0x32df[_0x547e67];return _0xc791c5;};'use strict';var _=require(_0xf32d('0x0'));var util=require(_0xf32d('0x1'));var moment=require(_0xf32d('0x2'));var BPromise=require(_0xf32d('0x3'));var rs=require(_0xf32d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf32d('0x5'))['db'];var utils=require(_0xf32d('0x6'));var logger=require(_0xf32d('0x7'))(_0xf32d('0x8'));var config=require(_0xf32d('0x9'));var jayson=require(_0xf32d('0xa'));var client=jayson[_0xf32d('0xb')][_0xf32d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17e3e5,_0x49f7cd,_0xbf0df5){return new BPromise(function(_0x51cda4,_0x381c8f){return client['request'](_0x17e3e5,_0xbf0df5)[_0xf32d('0xd')](function(_0x1cf56b){logger[_0xf32d('0xe')](_0xf32d('0xf'),_0x49f7cd,_0xf32d('0x10'));logger['debug'](_0xf32d('0x11'),_0x49f7cd,_0xf32d('0x10'),JSON[_0xf32d('0x12')](_0x1cf56b));if(_0x1cf56b[_0xf32d('0x13')]){if(_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x14')]===0x1f4){logger[_0xf32d('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x49f7cd,_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x15')]);return _0x381c8f(_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x15')]);}logger[_0xf32d('0x13')](_0xf32d('0xf'),_0x49f7cd,_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x15')]);return _0x51cda4(_0x1cf56b[_0xf32d('0x13')][_0xf32d('0x15')]);}else{logger[_0xf32d('0xe')](_0xf32d('0xf'),_0x49f7cd,_0xf32d('0x10'));_0x51cda4(_0x1cf56b['result'][_0xf32d('0x15')]);}})['catch'](function(_0x128ebe){logger[_0xf32d('0x13')](_0xf32d('0xf'),_0x49f7cd,_0x128ebe);_0x381c8f(_0x128ebe);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ca289ea..aa6beec 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 _0x4435=['express','Router','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0x4435,0x10e));var _0x5443=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x4435[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require(_0x5443('0x0'));var path=require(_0x5443('0x1'));var timeout=require(_0x5443('0x2'));var express=require(_0x5443('0x3'));var router=express[_0x5443('0x4')]();var fs_extra=require(_0x5443('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5443('0x6'));var controller=require(_0x5443('0x7'));router[_0x5443('0x8')]('/',auth[_0x5443('0x9')](),controller['index']);router[_0x5443('0x8')](_0x5443('0xa'),auth[_0x5443('0x9')](),controller[_0x5443('0xb')]);router[_0x5443('0x8')]('/:id/configurations',auth[_0x5443('0x9')](),controller['getConfigurations']);router['get'](_0x5443('0xc'),auth[_0x5443('0x9')](),controller[_0x5443('0xd')]);router[_0x5443('0xe')]('/',auth[_0x5443('0x9')](),controller['create']);router[_0x5443('0xe')](_0x5443('0xf'),auth[_0x5443('0x9')](),controller[_0x5443('0x10')]);router[_0x5443('0x11')](_0x5443('0xa'),auth[_0x5443('0x9')](),controller[_0x5443('0x12')]);router[_0x5443('0x13')](_0x5443('0xa'),auth[_0x5443('0x9')](),controller[_0x5443('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1734=['post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x13a704,_0x31dc21){var _0xe3e9aa=function(_0x52bb89){while(--_0x52bb89){_0x13a704['push'](_0x13a704['shift']());}};_0xe3e9aa(++_0x31dc21);}(_0x1734,0xfa));var _0x4173=function(_0x568162,_0x3df0a2){_0x568162=_0x568162-0x0;var _0x5c63bd=_0x1734[_0x568162];return _0x5c63bd;};'use strict';var multer=require('multer');var util=require(_0x4173('0x0'));var path=require(_0x4173('0x1'));var timeout=require(_0x4173('0x2'));var express=require(_0x4173('0x3'));var router=express[_0x4173('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4173('0x5'));var config=require('../../config/environment');var controller=require(_0x4173('0x6'));router[_0x4173('0x7')]('/',auth[_0x4173('0x8')](),controller[_0x4173('0x9')]);router['get'](_0x4173('0xa'),auth[_0x4173('0x8')](),controller[_0x4173('0xb')]);router[_0x4173('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4173('0xc')]);router[_0x4173('0x7')](_0x4173('0xd'),auth[_0x4173('0x8')](),controller['getFields']);router[_0x4173('0xe')]('/',auth[_0x4173('0x8')](),controller[_0x4173('0xf')]);router['post']('/:id/configurations',auth[_0x4173('0x8')](),controller[_0x4173('0x10')]);router[_0x4173('0x11')]('/:id',auth[_0x4173('0x8')](),controller[_0x4173('0x12')]);router[_0x4173('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4173('0x14')]);module[_0x4173('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 3bb3b79..384a82f 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 _0x4e2e=['username','remoteUri','exports','STRING'];(function(_0x5f3d47,_0x2329b8){var _0x42a103=function(_0x187f79){while(--_0x187f79){_0x5f3d47['push'](_0x5f3d47['shift']());}};_0x42a103(++_0x2329b8);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x25f67b,_0x58d56d){_0x25f67b=_0x25f67b-0x0;var _0xa54c82=_0x4e2e[_0x25f67b];return _0xa54c82;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'name':{'type':Sequelize[_0xe4e2('0x1')]},'description':{'type':Sequelize[_0xe4e2('0x1')]},'username':{'type':Sequelize[_0xe4e2('0x1')],'unique':_0xe4e2('0x2')},'apiKey':{'type':Sequelize[_0xe4e2('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e2('0x3')},'serverUrl':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7708=['sequelize','exports','STRING','remoteUri'];(function(_0xaba2a9,_0x33964e){var _0x326de2=function(_0x1279a7){while(--_0x1279a7){_0xaba2a9['push'](_0xaba2a9['shift']());}};_0x326de2(++_0x33964e);}(_0x7708,0x188));var _0x8770=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x7708[_0x23a79e];return _0x3dab57;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8770('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8770('0x3')},'serverUrl':{'type':Sequelize[_0x8770('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 62840b0..2739f0c 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 _0xfbe2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','getSubjects','Descriptions','channel','FreshdeskConfiguration','FreshdeskField','Subjects','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject','agent','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xfbe2,0x1da));var _0x2fbe=function(_0x1b10c7,_0x3c1380){_0x1b10c7=_0x1b10c7-0x0;var _0x5cd305=_0xfbe2[_0x1b10c7];return _0x5cd305;};'use strict';var emlformat=require(_0x2fbe('0x0'));var rimraf=require(_0x2fbe('0x1'));var zipdir=require(_0x2fbe('0x2'));var jsonpatch=require(_0x2fbe('0x3'));var rp=require('request-promise');var moment=require(_0x2fbe('0x4'));var BPromise=require(_0x2fbe('0x5'));var Mustache=require(_0x2fbe('0x6'));var util=require('util');var path=require(_0x2fbe('0x7'));var sox=require(_0x2fbe('0x8'));var csv=require(_0x2fbe('0x9'));var ejs=require(_0x2fbe('0xa'));var fs=require('fs');var fs_extra=require(_0x2fbe('0xb'));var _=require(_0x2fbe('0xc'));var squel=require(_0x2fbe('0xd'));var crypto=require(_0x2fbe('0xe'));var jsforce=require(_0x2fbe('0xf'));var deskjs=require(_0x2fbe('0x10'));var toCsv=require(_0x2fbe('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2fbe('0x11'));var authService=require(_0x2fbe('0x12'));var qs=require(_0x2fbe('0x13'));var as=require(_0x2fbe('0x14'));var hardwareService=require(_0x2fbe('0x15'));var logger=require(_0x2fbe('0x16'))(_0x2fbe('0x17'));var utils=require(_0x2fbe('0x18'));var config=require(_0x2fbe('0x19'));var licenseUtil=require(_0x2fbe('0x1a'));var db=require(_0x2fbe('0x1b'))['db'];var integrations=require(_0x2fbe('0x1c'));function respondWithStatusCode(_0x421387,_0x12be84){_0x12be84=_0x12be84||0xcc;return function(_0x511986){if(_0x511986){return _0x421387[_0x2fbe('0x1d')](_0x12be84);}return _0x421387[_0x2fbe('0x1e')](_0x12be84)[_0x2fbe('0x1f')]();};}function respondWithResult(_0x2dcfbb,_0x19777a){_0x19777a=_0x19777a||0xc8;return function(_0x1cff2a){if(_0x1cff2a){return _0x2dcfbb['status'](_0x19777a)[_0x2fbe('0x20')](_0x1cff2a);}};}function respondWithFilteredResult(_0x312970,_0x556a98){return function(_0x19d8fd){if(_0x19d8fd){var _0x56aa7d=typeof _0x556a98['offset']===_0x2fbe('0x21')&&typeof _0x556a98[_0x2fbe('0x22')]===_0x2fbe('0x21');var _0x7a2f2b=_0x19d8fd[_0x2fbe('0x23')];var _0x1dc730=_0x56aa7d?0x0:_0x556a98[_0x2fbe('0x24')];var _0x3fefe7=_0x56aa7d?_0x19d8fd[_0x2fbe('0x23')]:_0x556a98[_0x2fbe('0x24')]+_0x556a98[_0x2fbe('0x22')];var _0x4eed5a;if(_0x3fefe7>=_0x7a2f2b){_0x3fefe7=_0x7a2f2b;_0x4eed5a=0xc8;}else{_0x4eed5a=0xce;}_0x312970[_0x2fbe('0x1e')](_0x4eed5a);return _0x312970[_0x2fbe('0x25')](_0x2fbe('0x26'),_0x1dc730+'-'+_0x3fefe7+'/'+_0x7a2f2b)['json'](_0x19d8fd);}return null;};}function patchUpdates(_0x4c8f8f){return function(_0x451f1a){try{jsonpatch[_0x2fbe('0x27')](_0x451f1a,_0x4c8f8f,!![]);}catch(_0x2efbb3){return BPromise['reject'](_0x2efbb3);}return _0x451f1a[_0x2fbe('0x28')]();};}function saveUpdates(_0x1e3462,_0x30e978){return function(_0x489b46){if(_0x489b46){return _0x489b46[_0x2fbe('0x29')](_0x1e3462)[_0x2fbe('0x2a')](function(_0x5c1315){return _0x5c1315;});}return null;};}function removeEntity(_0x41f262,_0x5ba00e){return function(_0x14755c){if(_0x14755c){return _0x14755c[_0x2fbe('0x2b')]()[_0x2fbe('0x2a')](function(){_0x41f262[_0x2fbe('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e4255,_0x81e1fc){return function(_0x4590a2){if(!_0x4590a2){_0x5e4255[_0x2fbe('0x1d')](0x194);}return _0x4590a2;};}function handleError(_0x477e8c,_0x2a6bc8){_0x2a6bc8=_0x2a6bc8||0x1f4;return function(_0x5b52c0){logger['error'](_0x5b52c0[_0x2fbe('0x2c')]);if(_0x5b52c0[_0x2fbe('0x2d')]){delete _0x5b52c0[_0x2fbe('0x2d')];}_0x477e8c[_0x2fbe('0x1e')](_0x2a6bc8)['send'](_0x5b52c0);};}exports[_0x2fbe('0x2e')]=function(_0x5bf90c,_0x1fdf03){var _0x467760={},_0x37732d={},_0x1c9735={'count':0x0,'rows':[]};var _0x1d9376=_[_0x2fbe('0x2f')](db[_0x2fbe('0x30')][_0x2fbe('0x31')],function(_0xccf503){return{'name':_0xccf503[_0x2fbe('0x32')],'type':_0xccf503[_0x2fbe('0x33')][_0x2fbe('0x34')]};});_0x37732d['model']=_[_0x2fbe('0x2f')](_0x1d9376,_0x2fbe('0x2d'));_0x37732d[_0x2fbe('0x35')]=_['keys'](_0x5bf90c['query']);_0x37732d[_0x2fbe('0x36')]=_['intersection'](_0x37732d[_0x2fbe('0x37')],_0x37732d[_0x2fbe('0x35')]);_0x467760[_0x2fbe('0x38')]=_[_0x2fbe('0x39')](_0x37732d[_0x2fbe('0x37')],qs['fields'](_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x3a')]));_0x467760['attributes']=_0x467760['attributes']['length']?_0x467760[_0x2fbe('0x38')]:_0x37732d[_0x2fbe('0x37')];if(!_0x5bf90c['query']['hasOwnProperty']('nolimit')){_0x467760['limit']=qs[_0x2fbe('0x22')](_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x22')]);_0x467760[_0x2fbe('0x24')]=qs[_0x2fbe('0x24')](_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x24')]);}_0x467760[_0x2fbe('0x3b')]=qs[_0x2fbe('0x3c')](_0x5bf90c['query'][_0x2fbe('0x3c')]);_0x467760[_0x2fbe('0x3d')]=qs[_0x2fbe('0x36')](_[_0x2fbe('0x3e')](_0x5bf90c[_0x2fbe('0x35')],_0x37732d[_0x2fbe('0x36')]),_0x1d9376);if(_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x3f')]){_0x467760['where']=_[_0x2fbe('0x40')](_0x467760['where'],{'$or':_[_0x2fbe('0x2f')](_0x1d9376,function(_0x11bf78){if(_0x11bf78[_0x2fbe('0x33')]!==_0x2fbe('0x41')){var _0x5df9a2={};_0x5df9a2[_0x11bf78['name']]={'$like':'%'+_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x3f')]+'%'};return _0x5df9a2;}})});}_0x467760=_[_0x2fbe('0x40')]({},_0x467760,_0x5bf90c[_0x2fbe('0x42')]);var _0x34bd86={'where':_0x467760[_0x2fbe('0x3d')]};return db[_0x2fbe('0x30')][_0x2fbe('0x23')](_0x34bd86)[_0x2fbe('0x2a')](function(_0x577b3f){_0x1c9735[_0x2fbe('0x23')]=_0x577b3f;if(_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x43')]){_0x467760[_0x2fbe('0x44')]=[{'all':!![]}];}return db[_0x2fbe('0x30')][_0x2fbe('0x45')](_0x467760);})[_0x2fbe('0x2a')](function(_0x1b0bf0){_0x1c9735[_0x2fbe('0x46')]=_0x1b0bf0;return _0x1c9735;})[_0x2fbe('0x2a')](respondWithFilteredResult(_0x1fdf03,_0x467760))['catch'](handleError(_0x1fdf03,null));};exports[_0x2fbe('0x47')]=function(_0x3b4ffd,_0x1e4edd){var _0x414c0c={'raw':![],'where':{'id':_0x3b4ffd[_0x2fbe('0x48')]['id']}},_0x5b6f4a={};_0x5b6f4a[_0x2fbe('0x37')]=_[_0x2fbe('0x49')](db[_0x2fbe('0x30')][_0x2fbe('0x31')]);_0x5b6f4a['query']=_[_0x2fbe('0x49')](_0x3b4ffd[_0x2fbe('0x35')]);_0x5b6f4a[_0x2fbe('0x36')]=_[_0x2fbe('0x39')](_0x5b6f4a[_0x2fbe('0x37')],_0x5b6f4a[_0x2fbe('0x35')]);_0x414c0c[_0x2fbe('0x38')]=_[_0x2fbe('0x39')](_0x5b6f4a[_0x2fbe('0x37')],qs[_0x2fbe('0x3a')](_0x3b4ffd['query']['fields']));_0x414c0c['attributes']=_0x414c0c[_0x2fbe('0x38')][_0x2fbe('0x4a')]?_0x414c0c[_0x2fbe('0x38')]:_0x5b6f4a['model'];if(_0x3b4ffd['query']['includeAll']){_0x414c0c[_0x2fbe('0x44')]=[{'all':!![]}];}_0x414c0c=_[_0x2fbe('0x40')]({},_0x414c0c,_0x3b4ffd[_0x2fbe('0x42')]);return db[_0x2fbe('0x30')][_0x2fbe('0x4b')](_0x414c0c)[_0x2fbe('0x2a')](handleEntityNotFound(_0x1e4edd,null))[_0x2fbe('0x2a')](respondWithResult(_0x1e4edd,null))[_0x2fbe('0x4c')](handleError(_0x1e4edd,null));};exports['create']=function(_0x4597b0,_0xa6dceb){return db[_0x2fbe('0x30')][_0x2fbe('0x4d')](_0x4597b0['body'],{})[_0x2fbe('0x2a')](respondWithResult(_0xa6dceb,0xc9))[_0x2fbe('0x4c')](handleError(_0xa6dceb,null));};exports['update']=function(_0x4a213c,_0x2a3187){if(_0x4a213c['body']['id']){delete _0x4a213c[_0x2fbe('0x4e')]['id'];}return db[_0x2fbe('0x30')]['find']({'where':{'id':_0x4a213c['params']['id']}})[_0x2fbe('0x2a')](handleEntityNotFound(_0x2a3187,null))[_0x2fbe('0x2a')](saveUpdates(_0x4a213c[_0x2fbe('0x4e')],null))['then'](respondWithResult(_0x2a3187,null))['catch'](handleError(_0x2a3187,null));};exports[_0x2fbe('0x2b')]=function(_0x271a7f,_0x1dc755){return db[_0x2fbe('0x30')]['find']({'where':{'id':_0x271a7f[_0x2fbe('0x48')]['id']}})[_0x2fbe('0x2a')](handleEntityNotFound(_0x1dc755,null))['then'](removeEntity(_0x1dc755,null))[_0x2fbe('0x4c')](handleError(_0x1dc755,null));};exports[_0x2fbe('0x4f')]=function(_0x3f3151,_0x558ead,_0x3308f1){var _0x4fd22b={};var _0x4735a1={};var _0x17ce09;var _0x2bdfb0;return db[_0x2fbe('0x30')][_0x2fbe('0x50')]({'where':{'id':_0x3f3151[_0x2fbe('0x48')]['id']}})['then'](handleEntityNotFound(_0x558ead,null))[_0x2fbe('0x2a')](function(_0x5d5a5f){if(_0x5d5a5f){_0x17ce09=_0x5d5a5f;_0x4735a1[_0x2fbe('0x37')]=_[_0x2fbe('0x49')](db['FreshdeskConfiguration'][_0x2fbe('0x31')]);_0x4735a1[_0x2fbe('0x35')]=_['keys'](_0x3f3151['query']);_0x4735a1[_0x2fbe('0x36')]=_[_0x2fbe('0x39')](_0x4735a1[_0x2fbe('0x37')],_0x4735a1[_0x2fbe('0x35')]);_0x4fd22b[_0x2fbe('0x38')]=_[_0x2fbe('0x39')](_0x4735a1['model'],qs['fields'](_0x3f3151['query'][_0x2fbe('0x3a')]));_0x4fd22b[_0x2fbe('0x38')]=_0x4fd22b[_0x2fbe('0x38')][_0x2fbe('0x4a')]?_0x4fd22b[_0x2fbe('0x38')]:_0x4735a1[_0x2fbe('0x37')];_0x4fd22b[_0x2fbe('0x3b')]=qs[_0x2fbe('0x3c')](_0x3f3151[_0x2fbe('0x35')]['sort']);_0x4fd22b[_0x2fbe('0x3d')]=qs[_0x2fbe('0x36')](_[_0x2fbe('0x3e')](_0x3f3151[_0x2fbe('0x35')],_0x4735a1[_0x2fbe('0x36')]));if(_0x3f3151['query'][_0x2fbe('0x3f')]){_0x4fd22b['where']=_['merge'](_0x4fd22b[_0x2fbe('0x3d')],{'$or':_[_0x2fbe('0x2f')](_0x4fd22b[_0x2fbe('0x38')],function(_0x8a7a22){var _0x2df572={};_0x2df572[_0x8a7a22]={'$like':'%'+_0x3f3151[_0x2fbe('0x35')][_0x2fbe('0x3f')]+'%'};return _0x2df572;})});}_0x4fd22b=_[_0x2fbe('0x40')]({},_0x4fd22b,_0x3f3151[_0x2fbe('0x42')]);return _0x17ce09[_0x2fbe('0x4f')](_0x4fd22b);}})[_0x2fbe('0x2a')](function(_0x247c68){if(_0x247c68){_0x2bdfb0=_0x247c68[_0x2fbe('0x4a')];if(!_0x3f3151[_0x2fbe('0x35')][_0x2fbe('0x51')]('nolimit')){_0x4fd22b['limit']=qs[_0x2fbe('0x22')](_0x3f3151['query'][_0x2fbe('0x22')]);_0x4fd22b[_0x2fbe('0x24')]=qs['offset'](_0x3f3151[_0x2fbe('0x35')]['offset']);}return _0x17ce09[_0x2fbe('0x4f')](_0x4fd22b);}})[_0x2fbe('0x2a')](function(_0x415e76){if(_0x415e76){return _0x415e76?{'count':_0x2bdfb0,'rows':_0x415e76}:null;}})[_0x2fbe('0x2a')](respondWithResult(_0x558ead,null))[_0x2fbe('0x4c')](handleError(_0x558ead,null));};exports[_0x2fbe('0x52')]=function(_0x4b12be,_0x559682,_0x23d8c7){if(_0x4b12be[_0x2fbe('0x4e')]['id']){delete _0x4b12be[_0x2fbe('0x4e')]['id'];}return db[_0x2fbe('0x30')][_0x2fbe('0x50')]({'where':{'id':_0x4b12be[_0x2fbe('0x48')]['id']}})['then'](handleEntityNotFound(_0x559682,null))[_0x2fbe('0x2a')](function(_0x451626){if(_0x451626){_0x4b12be[_0x2fbe('0x4e')][_0x2fbe('0x53')]=_0x451626['id'];_0x4b12be['body']['Subjects']=integrations[_0x2fbe('0x54')](_0x4b12be['body']['channel'],_0x4b12be[_0x2fbe('0x4e')]['type']);_0x4b12be[_0x2fbe('0x4e')][_0x2fbe('0x55')]=integrations['getDescriptions'](_0x4b12be[_0x2fbe('0x4e')][_0x2fbe('0x56')],_0x4b12be[_0x2fbe('0x4e')][_0x2fbe('0x33')]);return db[_0x2fbe('0x57')][_0x2fbe('0x4d')](_0x4b12be[_0x2fbe('0x4e')],{'include':[{'model':db[_0x2fbe('0x58')],'as':_0x2fbe('0x59')},{'model':db[_0x2fbe('0x58')],'as':_0x2fbe('0x55')}]});}return null;})[_0x2fbe('0x2a')](respondWithResult(_0x559682,null))['catch'](handleError(_0x559682,null));};exports['getFields']=function(_0x48f2cc,_0x241796,_0x30c763){var _0x33cfe1='';return db['FreshdeskAccount'][_0x2fbe('0x50')]({'where':{'id':_0x48f2cc[_0x2fbe('0x48')]['id']},'attributes':['id',_0x2fbe('0x5a'),'apiKey']})[_0x2fbe('0x2a')](handleEntityNotFound(_0x241796,null))[_0x2fbe('0x2a')](function(_0x37b02f){if(_0x37b02f){_0x33cfe1=_0x37b02f[_0x2fbe('0x5a')];var _0x3c5a8b=_0x33cfe1[_0x2fbe('0x5b')](-0x1);if(_0x3c5a8b==='/'){_0x33cfe1=_0x33cfe1[_0x2fbe('0x5c')](0x0,_0x33cfe1[_0x2fbe('0x5d')](_0x3c5a8b));}return rp({'method':_0x2fbe('0x5e'),'uri':util[_0x2fbe('0x5f')](_0x2fbe('0x60'),_0x33cfe1,_0x2fbe('0x61')),'headers':{'Authorization':util[_0x2fbe('0x5f')](_0x2fbe('0x62'),new Buffer(util[_0x2fbe('0x5f')](_0x2fbe('0x63'),_0x37b02f['apiKey']))['toString']('base64'))},'json':!![]});}})['then'](function(_0x24d7ae){if(_0x24d7ae){var _0x2fbc02=[_0x2fbe('0x64'),_0x2fbe('0x65'),_0x2fbe('0x66'),'description',_0x2fbe('0x1e'),_0x2fbe('0x67'),_0x2fbe('0x68'),_0x2fbe('0x69'),_0x2fbe('0x6a'),_0x2fbe('0x68'),_0x2fbe('0x6b')];_['remove'](_0x24d7ae,function(_0x27634b){return _0x2fbc02[_0x2fbe('0x6c')](_0x27634b['name'])||!_0x27634b[_0x2fbe('0x6d')]&&_0x27634b['type']!==_0x2fbe('0x6e')&&_0x27634b[_0x2fbe('0x33')]!==_0x2fbe('0x6f');});return{'count':_0x24d7ae[_0x2fbe('0x4a')],'rows':_[_0x2fbe('0x2f')](_0x24d7ae,function(_0x3c72f2){return{'id':_0x3c72f2['name'],'name':_0x3c72f2[_0x2fbe('0x70')],'custom':!_0x3c72f2[_0x2fbe('0x6d')],'options':_0x3c72f2[_0x2fbe('0x71')]?_['map'](_0x3c72f2[_0x2fbe('0x71')],function(_0x2be9c4){return{'name':_[_0x2fbe('0x72')](_0x2be9c4),'value':_0x2be9c4};}):[]};})};}})[_0x2fbe('0x2a')](respondWithResult(_0x241796,null))[_0x2fbe('0x4c')](function(_0x4323f6){var _0x1ceddb=_0x48f2cc[_0x2fbe('0x35')]['test']?0x1f4:_0x4323f6[_0x2fbe('0x73')]||0x1f4;logger[_0x2fbe('0x74')](_0x2fbe('0x75'),_0x2fbe('0x76'),_0x1ceddb,JSON[_0x2fbe('0x77')](_0x4323f6));delete _0x4323f6[_0x2fbe('0x2d')];if(_0x1ceddb===0x191){_0x1ceddb=0x190;}_0x241796['status'](_0x1ceddb)[_0x2fbe('0x78')](_0x48f2cc[_0x2fbe('0x35')][_0x2fbe('0x79')]?{'message':_0x2fbe('0x7a'),'statusCode':_0x4323f6['statusCode']}:_0x4323f6);});}; \ No newline at end of file +var _0x8ce8=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','keys','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','AccountId','channel','Subjects','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','format','Basic\x20%s','requester','agent','description','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5daa3d,_0x151f7f){var _0x4365ea=function(_0x4f573f){while(--_0x4f573f){_0x5daa3d['push'](_0x5daa3d['shift']());}};_0x4365ea(++_0x151f7f);}(_0x8ce8,0xd3));var _0x88ce=function(_0x5b7895,_0x43a21a){_0x5b7895=_0x5b7895-0x0;var _0x91fe05=_0x8ce8[_0x5b7895];return _0x91fe05;};'use strict';var emlformat=require(_0x88ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88ce('0x1'));var jsonpatch=require(_0x88ce('0x2'));var rp=require(_0x88ce('0x3'));var moment=require(_0x88ce('0x4'));var BPromise=require(_0x88ce('0x5'));var Mustache=require(_0x88ce('0x6'));var util=require(_0x88ce('0x7'));var path=require(_0x88ce('0x8'));var sox=require(_0x88ce('0x9'));var csv=require(_0x88ce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88ce('0xb'));var squel=require(_0x88ce('0xc'));var crypto=require(_0x88ce('0xd'));var jsforce=require(_0x88ce('0xe'));var deskjs=require(_0x88ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x88ce('0x11'));var authService=require(_0x88ce('0x12'));var qs=require(_0x88ce('0x13'));var as=require(_0x88ce('0x14'));var hardwareService=require(_0x88ce('0x15'));var logger=require(_0x88ce('0x16'))(_0x88ce('0x17'));var utils=require(_0x88ce('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x88ce('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x88ce('0x1a'));function respondWithStatusCode(_0x3b67c8,_0x50b088){_0x50b088=_0x50b088||0xcc;return function(_0x4f06d1){if(_0x4f06d1){return _0x3b67c8[_0x88ce('0x1b')](_0x50b088);}return _0x3b67c8[_0x88ce('0x1c')](_0x50b088)[_0x88ce('0x1d')]();};}function respondWithResult(_0xad722b,_0x417896){_0x417896=_0x417896||0xc8;return function(_0x210e70){if(_0x210e70){return _0xad722b[_0x88ce('0x1c')](_0x417896)['json'](_0x210e70);}};}function respondWithFilteredResult(_0x3460e5,_0x5bcd5a){return function(_0x3da93e){if(_0x3da93e){var _0x58d3da=typeof _0x5bcd5a[_0x88ce('0x1e')]===_0x88ce('0x1f')&&typeof _0x5bcd5a[_0x88ce('0x20')]===_0x88ce('0x1f');var _0x509a84=_0x3da93e['count'];var _0xdb0d1f=_0x58d3da?0x0:_0x5bcd5a[_0x88ce('0x1e')];var _0x404df9=_0x58d3da?_0x3da93e[_0x88ce('0x21')]:_0x5bcd5a[_0x88ce('0x1e')]+_0x5bcd5a[_0x88ce('0x20')];var _0x461a8a;if(_0x404df9>=_0x509a84){_0x404df9=_0x509a84;_0x461a8a=0xc8;}else{_0x461a8a=0xce;}_0x3460e5[_0x88ce('0x1c')](_0x461a8a);return _0x3460e5[_0x88ce('0x22')](_0x88ce('0x23'),_0xdb0d1f+'-'+_0x404df9+'/'+_0x509a84)[_0x88ce('0x24')](_0x3da93e);}return null;};}function patchUpdates(_0x7de0ac){return function(_0xbe7eff){try{jsonpatch[_0x88ce('0x25')](_0xbe7eff,_0x7de0ac,!![]);}catch(_0x218308){return BPromise[_0x88ce('0x26')](_0x218308);}return _0xbe7eff['save']();};}function saveUpdates(_0x356d7d,_0x34fbcc){return function(_0x3bb68b){if(_0x3bb68b){return _0x3bb68b[_0x88ce('0x27')](_0x356d7d)[_0x88ce('0x28')](function(_0x4e45eb){return _0x4e45eb;});}return null;};}function removeEntity(_0x4c9133,_0x4dcdc4){return function(_0x22c911){if(_0x22c911){return _0x22c911[_0x88ce('0x29')]()[_0x88ce('0x28')](function(){_0x4c9133['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f0adc,_0x3383fa){return function(_0x1b9d39){if(!_0x1b9d39){_0x1f0adc[_0x88ce('0x1b')](0x194);}return _0x1b9d39;};}function handleError(_0x4b30db,_0x1efcea){_0x1efcea=_0x1efcea||0x1f4;return function(_0x19f00f){logger[_0x88ce('0x2a')](_0x19f00f[_0x88ce('0x2b')]);if(_0x19f00f[_0x88ce('0x2c')]){delete _0x19f00f[_0x88ce('0x2c')];}_0x4b30db[_0x88ce('0x1c')](_0x1efcea)[_0x88ce('0x2d')](_0x19f00f);};}exports[_0x88ce('0x2e')]=function(_0x12b9a1,_0x1814d1){var _0x47bbff={},_0x4f4205={},_0x5ceb03={'count':0x0,'rows':[]};var _0x157a28=_[_0x88ce('0x2f')](db[_0x88ce('0x30')][_0x88ce('0x31')],function(_0x544be7){return{'name':_0x544be7[_0x88ce('0x32')],'type':_0x544be7[_0x88ce('0x33')][_0x88ce('0x34')]};});_0x4f4205[_0x88ce('0x35')]=_[_0x88ce('0x2f')](_0x157a28,_0x88ce('0x2c'));_0x4f4205[_0x88ce('0x36')]=_['keys'](_0x12b9a1[_0x88ce('0x36')]);_0x4f4205[_0x88ce('0x37')]=_['intersection'](_0x4f4205[_0x88ce('0x35')],_0x4f4205[_0x88ce('0x36')]);_0x47bbff[_0x88ce('0x38')]=_[_0x88ce('0x39')](_0x4f4205[_0x88ce('0x35')],qs[_0x88ce('0x3a')](_0x12b9a1[_0x88ce('0x36')][_0x88ce('0x3a')]));_0x47bbff[_0x88ce('0x38')]=_0x47bbff['attributes'][_0x88ce('0x3b')]?_0x47bbff[_0x88ce('0x38')]:_0x4f4205[_0x88ce('0x35')];if(!_0x12b9a1['query'][_0x88ce('0x3c')](_0x88ce('0x3d'))){_0x47bbff['limit']=qs['limit'](_0x12b9a1[_0x88ce('0x36')][_0x88ce('0x20')]);_0x47bbff[_0x88ce('0x1e')]=qs[_0x88ce('0x1e')](_0x12b9a1[_0x88ce('0x36')][_0x88ce('0x1e')]);}_0x47bbff['order']=qs[_0x88ce('0x3e')](_0x12b9a1[_0x88ce('0x36')]['sort']);_0x47bbff[_0x88ce('0x3f')]=qs[_0x88ce('0x37')](_['pick'](_0x12b9a1[_0x88ce('0x36')],_0x4f4205['filters']),_0x157a28);if(_0x12b9a1[_0x88ce('0x36')][_0x88ce('0x40')]){_0x47bbff[_0x88ce('0x3f')]=_[_0x88ce('0x41')](_0x47bbff[_0x88ce('0x3f')],{'$or':_[_0x88ce('0x2f')](_0x157a28,function(_0x4e9b91){if(_0x4e9b91[_0x88ce('0x33')]!==_0x88ce('0x42')){var _0x24172a={};_0x24172a[_0x4e9b91[_0x88ce('0x2c')]]={'$like':'%'+_0x12b9a1['query'][_0x88ce('0x40')]+'%'};return _0x24172a;}})});}_0x47bbff=_[_0x88ce('0x41')]({},_0x47bbff,_0x12b9a1[_0x88ce('0x43')]);var _0x4cc1c2={'where':_0x47bbff['where']};return db[_0x88ce('0x30')][_0x88ce('0x21')](_0x4cc1c2)[_0x88ce('0x28')](function(_0x512e49){_0x5ceb03[_0x88ce('0x21')]=_0x512e49;if(_0x12b9a1[_0x88ce('0x36')]['includeAll']){_0x47bbff[_0x88ce('0x44')]=[{'all':!![]}];}return db[_0x88ce('0x30')][_0x88ce('0x45')](_0x47bbff);})[_0x88ce('0x28')](function(_0x3a4898){_0x5ceb03['rows']=_0x3a4898;return _0x5ceb03;})[_0x88ce('0x28')](respondWithFilteredResult(_0x1814d1,_0x47bbff))[_0x88ce('0x46')](handleError(_0x1814d1,null));};exports[_0x88ce('0x47')]=function(_0x123c83,_0x8132cc){var _0x29d440={'raw':![],'where':{'id':_0x123c83['params']['id']}},_0x39bfb8={};_0x39bfb8[_0x88ce('0x35')]=_[_0x88ce('0x48')](db['FreshdeskAccount'][_0x88ce('0x31')]);_0x39bfb8[_0x88ce('0x36')]=_['keys'](_0x123c83['query']);_0x39bfb8['filters']=_[_0x88ce('0x39')](_0x39bfb8[_0x88ce('0x35')],_0x39bfb8[_0x88ce('0x36')]);_0x29d440[_0x88ce('0x38')]=_[_0x88ce('0x39')](_0x39bfb8[_0x88ce('0x35')],qs[_0x88ce('0x3a')](_0x123c83['query'][_0x88ce('0x3a')]));_0x29d440['attributes']=_0x29d440[_0x88ce('0x38')][_0x88ce('0x3b')]?_0x29d440[_0x88ce('0x38')]:_0x39bfb8['model'];if(_0x123c83[_0x88ce('0x36')]['includeAll']){_0x29d440[_0x88ce('0x44')]=[{'all':!![]}];}_0x29d440=_[_0x88ce('0x41')]({},_0x29d440,_0x123c83[_0x88ce('0x43')]);return db[_0x88ce('0x30')][_0x88ce('0x49')](_0x29d440)[_0x88ce('0x28')](handleEntityNotFound(_0x8132cc,null))[_0x88ce('0x28')](respondWithResult(_0x8132cc,null))['catch'](handleError(_0x8132cc,null));};exports[_0x88ce('0x4a')]=function(_0x260015,_0x11f7b6){return db[_0x88ce('0x30')]['create'](_0x260015['body'],{})[_0x88ce('0x28')](respondWithResult(_0x11f7b6,0xc9))[_0x88ce('0x46')](handleError(_0x11f7b6,null));};exports[_0x88ce('0x27')]=function(_0x46d70a,_0x23967c){if(_0x46d70a[_0x88ce('0x4b')]['id']){delete _0x46d70a[_0x88ce('0x4b')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x46d70a[_0x88ce('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23967c,null))['then'](saveUpdates(_0x46d70a['body'],null))[_0x88ce('0x28')](respondWithResult(_0x23967c,null))['catch'](handleError(_0x23967c,null));};exports[_0x88ce('0x29')]=function(_0x23ca86,_0x2e6918){return db[_0x88ce('0x30')][_0x88ce('0x49')]({'where':{'id':_0x23ca86[_0x88ce('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e6918,null))['then'](removeEntity(_0x2e6918,null))[_0x88ce('0x46')](handleError(_0x2e6918,null));};exports[_0x88ce('0x4d')]=function(_0x1c9e37,_0x1b961c,_0x4a8ec2){var _0x4c37c9={};var _0x464e80={};var _0x4877a3;var _0x36524e;return db[_0x88ce('0x30')][_0x88ce('0x4e')]({'where':{'id':_0x1c9e37[_0x88ce('0x4c')]['id']}})[_0x88ce('0x28')](handleEntityNotFound(_0x1b961c,null))[_0x88ce('0x28')](function(_0x3b9708){if(_0x3b9708){_0x4877a3=_0x3b9708;_0x464e80[_0x88ce('0x35')]=_[_0x88ce('0x48')](db[_0x88ce('0x4f')][_0x88ce('0x31')]);_0x464e80['query']=_[_0x88ce('0x48')](_0x1c9e37[_0x88ce('0x36')]);_0x464e80[_0x88ce('0x37')]=_[_0x88ce('0x39')](_0x464e80[_0x88ce('0x35')],_0x464e80[_0x88ce('0x36')]);_0x4c37c9['attributes']=_[_0x88ce('0x39')](_0x464e80['model'],qs[_0x88ce('0x3a')](_0x1c9e37[_0x88ce('0x36')][_0x88ce('0x3a')]));_0x4c37c9[_0x88ce('0x38')]=_0x4c37c9[_0x88ce('0x38')]['length']?_0x4c37c9[_0x88ce('0x38')]:_0x464e80[_0x88ce('0x35')];_0x4c37c9['order']=qs[_0x88ce('0x3e')](_0x1c9e37['query'][_0x88ce('0x3e')]);_0x4c37c9[_0x88ce('0x3f')]=qs[_0x88ce('0x37')](_['pick'](_0x1c9e37[_0x88ce('0x36')],_0x464e80[_0x88ce('0x37')]));if(_0x1c9e37[_0x88ce('0x36')][_0x88ce('0x40')]){_0x4c37c9[_0x88ce('0x3f')]=_[_0x88ce('0x41')](_0x4c37c9[_0x88ce('0x3f')],{'$or':_[_0x88ce('0x2f')](_0x4c37c9[_0x88ce('0x38')],function(_0x58e019){var _0x49d9fd={};_0x49d9fd[_0x58e019]={'$like':'%'+_0x1c9e37[_0x88ce('0x36')][_0x88ce('0x40')]+'%'};return _0x49d9fd;})});}_0x4c37c9=_[_0x88ce('0x41')]({},_0x4c37c9,_0x1c9e37['options']);return _0x4877a3[_0x88ce('0x4d')](_0x4c37c9);}})['then'](function(_0x4bcd10){if(_0x4bcd10){_0x36524e=_0x4bcd10['length'];if(!_0x1c9e37[_0x88ce('0x36')]['hasOwnProperty'](_0x88ce('0x3d'))){_0x4c37c9[_0x88ce('0x20')]=qs[_0x88ce('0x20')](_0x1c9e37['query'][_0x88ce('0x20')]);_0x4c37c9['offset']=qs[_0x88ce('0x1e')](_0x1c9e37[_0x88ce('0x36')][_0x88ce('0x1e')]);}return _0x4877a3[_0x88ce('0x4d')](_0x4c37c9);}})['then'](function(_0x38e936){if(_0x38e936){return _0x38e936?{'count':_0x36524e,'rows':_0x38e936}:null;}})[_0x88ce('0x28')](respondWithResult(_0x1b961c,null))[_0x88ce('0x46')](handleError(_0x1b961c,null));};exports['addConfiguration']=function(_0x590d79,_0x5cddfd,_0x3e4a6b){if(_0x590d79[_0x88ce('0x4b')]['id']){delete _0x590d79[_0x88ce('0x4b')]['id'];}return db[_0x88ce('0x30')]['findOne']({'where':{'id':_0x590d79['params']['id']}})['then'](handleEntityNotFound(_0x5cddfd,null))[_0x88ce('0x28')](function(_0x287a7d){if(_0x287a7d){_0x590d79[_0x88ce('0x4b')][_0x88ce('0x50')]=_0x287a7d['id'];_0x590d79[_0x88ce('0x4b')]['Subjects']=integrations['getSubjects'](_0x590d79[_0x88ce('0x4b')][_0x88ce('0x51')],_0x590d79[_0x88ce('0x4b')][_0x88ce('0x33')]);_0x590d79[_0x88ce('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x590d79[_0x88ce('0x4b')][_0x88ce('0x51')],_0x590d79[_0x88ce('0x4b')][_0x88ce('0x33')]);return db['FreshdeskConfiguration'][_0x88ce('0x4a')](_0x590d79['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x88ce('0x52')},{'model':db[_0x88ce('0x53')],'as':_0x88ce('0x54')}]});}return null;})[_0x88ce('0x28')](respondWithResult(_0x5cddfd,null))[_0x88ce('0x46')](handleError(_0x5cddfd,null));};exports[_0x88ce('0x55')]=function(_0x19d365,_0x1f34d1,_0x41fc76){var _0x26d167='';return db[_0x88ce('0x30')][_0x88ce('0x4e')]({'where':{'id':_0x19d365[_0x88ce('0x4c')]['id']},'attributes':['id',_0x88ce('0x56'),_0x88ce('0x57')]})[_0x88ce('0x28')](handleEntityNotFound(_0x1f34d1,null))[_0x88ce('0x28')](function(_0x458343){if(_0x458343){_0x26d167=_0x458343[_0x88ce('0x56')];var _0x4c182b=_0x26d167['slice'](-0x1);if(_0x4c182b==='/'){_0x26d167=_0x26d167[_0x88ce('0x58')](0x0,_0x26d167[_0x88ce('0x59')](_0x4c182b));}return rp({'method':_0x88ce('0x5a'),'uri':util['format'](_0x88ce('0x5b'),_0x26d167,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x88ce('0x5c')](_0x88ce('0x5d'),new Buffer(util[_0x88ce('0x5c')]('%s:X',_0x458343['apiKey']))['toString']('base64'))},'json':!![]});}})['then'](function(_0x5220cc){if(_0x5220cc){var _0x3359ea=[_0x88ce('0x5e'),'subject',_0x88ce('0x5f'),_0x88ce('0x60'),_0x88ce('0x1c'),_0x88ce('0x61'),_0x88ce('0x62'),_0x88ce('0x63'),_0x88ce('0x64'),_0x88ce('0x62'),_0x88ce('0x65')];_[_0x88ce('0x66')](_0x5220cc,function(_0x168fd9){return _0x3359ea[_0x88ce('0x67')](_0x168fd9[_0x88ce('0x2c')])||!_0x168fd9['default']&&_0x168fd9['type']!==_0x88ce('0x68')&&_0x168fd9[_0x88ce('0x33')]!==_0x88ce('0x69');});return{'count':_0x5220cc[_0x88ce('0x3b')],'rows':_['map'](_0x5220cc,function(_0x2fb876){return{'id':_0x2fb876[_0x88ce('0x2c')],'name':_0x2fb876[_0x88ce('0x6a')],'custom':!_0x2fb876['default'],'options':_0x2fb876['choices']?_[_0x88ce('0x2f')](_0x2fb876[_0x88ce('0x6b')],function(_0x15ea43){return{'name':_[_0x88ce('0x6c')](_0x15ea43),'value':_0x15ea43};}):[]};})};}})['then'](respondWithResult(_0x1f34d1,null))[_0x88ce('0x46')](function(_0x12063a){var _0x2725b1=_0x19d365[_0x88ce('0x36')][_0x88ce('0x6d')]?0x1f4:_0x12063a[_0x88ce('0x6e')]||0x1f4;logger[_0x88ce('0x2a')](_0x88ce('0x6f'),_0x88ce('0x55'),_0x2725b1,JSON[_0x88ce('0x70')](_0x12063a));delete _0x12063a[_0x88ce('0x2c')];if(_0x2725b1===0x191){_0x2725b1=0x190;}_0x1f34d1['status'](_0x2725b1)[_0x88ce('0x2d')](_0x19d365[_0x88ce('0x36')][_0x88ce('0x6d')]?{'message':_0x88ce('0x71'),'statusCode':_0x12063a['statusCode']}:_0x12063a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e6b05d2..30abd56 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 _0xe646=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment'];(function(_0x385706,_0x27cd45){var _0x16aa20=function(_0x14f158){while(--_0x14f158){_0x385706['push'](_0x385706['shift']());}};_0x16aa20(++_0x27cd45);}(_0xe646,0x14c));var _0x6e64=function(_0x525e60,_0x5f2c7b){_0x525e60=_0x525e60-0x0;var _0x47fd49=_0xe646[_0x525e60];return _0x47fd49;};'use strict';var _=require(_0x6e64('0x0'));var util=require('util');var logger=require(_0x6e64('0x1'))(_0x6e64('0x2'));var moment=require(_0x6e64('0x3'));var BPromise=require(_0x6e64('0x4'));var rp=require(_0x6e64('0x5'));var fs=require('fs');var path=require(_0x6e64('0x6'));var rimraf=require(_0x6e64('0x7'));var config=require(_0x6e64('0x8'));var attributes=require(_0x6e64('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x6e64('0xa')]=function(_0x5aafcb,_0x57f2fb){return _0x5aafcb[_0x6e64('0xb')](_0x6e64('0xc'),attributes,{'tableName':_0x6e64('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cb6=['moment','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','int_freshdesk_accounts','lodash','util'];(function(_0x2d0c51,_0x52a21f){var _0x2f0bb5=function(_0x2cc7b7){while(--_0x2cc7b7){_0x2d0c51['push'](_0x2d0c51['shift']());}};_0x2f0bb5(++_0x52a21f);}(_0x8cb6,0x1ae));var _0x68cb=function(_0x45b771,_0x2caece){_0x45b771=_0x45b771-0x0;var _0x7ef73d=_0x8cb6[_0x45b771];return _0x7ef73d;};'use strict';var _=require(_0x68cb('0x0'));var util=require(_0x68cb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x68cb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x68cb('0x3'));var rimraf=require(_0x68cb('0x4'));var config=require('../../config/environment');var attributes=require(_0x68cb('0x5'));var integrations=require(_0x68cb('0x6'));module['exports']=function(_0x2932ca,_0x5a55b7){return _0x2932ca['define']('FreshdeskAccount',attributes,{'tableName':_0x68cb('0x7'),'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 f5be828..d48f30a 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 _0xdebb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','include','map','model','raw','ShowFreshdeskAccount','util','moment','bluebird','randomstring','ioredis'];(function(_0x21f234,_0x4c2912){var _0x19920b=function(_0x9cd441){while(--_0x9cd441){_0x21f234['push'](_0x21f234['shift']());}};_0x19920b(++_0x4c2912);}(_0xdebb,0x13f));var _0xbdeb=function(_0x19c106,_0x238007){_0x19c106=_0x19c106-0x0;var _0x3341d6=_0xdebb[_0x19c106];return _0x3341d6;};'use strict';var _=require('lodash');var util=require(_0xbdeb('0x0'));var moment=require(_0xbdeb('0x1'));var BPromise=require(_0xbdeb('0x2'));var rs=require(_0xbdeb('0x3'));var fs=require('fs');var Redis=require(_0xbdeb('0x4'));var db=require(_0xbdeb('0x5'))['db'];var utils=require(_0xbdeb('0x6'));var logger=require(_0xbdeb('0x7'))(_0xbdeb('0x8'));var config=require(_0xbdeb('0x9'));var jayson=require(_0xbdeb('0xa'));var client=jayson[_0xbdeb('0xb')][_0xbdeb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x196956,_0x3977a2,_0x2883b1){return new BPromise(function(_0x32ed97,_0x474b56){return client['request'](_0x196956,_0x2883b1)[_0xbdeb('0xd')](function(_0x56c29c){logger[_0xbdeb('0xe')](_0xbdeb('0xf'),_0x3977a2,_0xbdeb('0x10'));logger[_0xbdeb('0x11')](_0xbdeb('0x12'),_0x3977a2,'request\x20sent',JSON[_0xbdeb('0x13')](_0x56c29c));if(_0x56c29c[_0xbdeb('0x14')]){if(_0x56c29c['error'][_0xbdeb('0x15')]===0x1f4){logger[_0xbdeb('0x14')](_0xbdeb('0xf'),_0x3977a2,_0x56c29c[_0xbdeb('0x14')][_0xbdeb('0x16')]);return _0x474b56(_0x56c29c[_0xbdeb('0x14')][_0xbdeb('0x16')]);}logger['error'](_0xbdeb('0xf'),_0x3977a2,_0x56c29c['error'][_0xbdeb('0x16')]);return _0x32ed97(_0x56c29c[_0xbdeb('0x14')][_0xbdeb('0x16')]);}else{logger[_0xbdeb('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x3977a2,'request\x20sent');_0x32ed97(_0x56c29c[_0xbdeb('0x17')]['message']);}})[_0xbdeb('0x18')](function(_0x4fe6f0){logger['error'](_0xbdeb('0xf'),_0x3977a2,_0x4fe6f0);_0x474b56(_0x4fe6f0);});});}exports[_0xbdeb('0x19')]=function(_0x307ac6){var _0x4d456a=this;return new Promise(function(_0x147c85,_0x3dd919){return db[_0xbdeb('0x1a')][_0xbdeb('0x1b')]({'raw':_0x307ac6['options']?_0x307ac6['options']['raw']===undefined?!![]:![]:!![],'where':_0x307ac6[_0xbdeb('0x1c')]?_0x307ac6['options'][_0xbdeb('0x1d')]||null:null,'attributes':_0x307ac6[_0xbdeb('0x1c')]?_0x307ac6[_0xbdeb('0x1c')][_0xbdeb('0x1e')]||null:null,'limit':_0x307ac6[_0xbdeb('0x1c')]?_0x307ac6[_0xbdeb('0x1c')]['limit']||null:null,'include':_0x307ac6[_0xbdeb('0x1c')]?_0x307ac6[_0xbdeb('0x1c')][_0xbdeb('0x1f')]?_[_0xbdeb('0x20')](_0x307ac6[_0xbdeb('0x1c')][_0xbdeb('0x1f')],function(_0x1918e9){return{'model':db[_0x1918e9['model']],'as':_0x1918e9['as'],'attributes':_0x1918e9[_0xbdeb('0x1e')],'include':_0x1918e9[_0xbdeb('0x1f')]?_[_0xbdeb('0x20')](_0x1918e9[_0xbdeb('0x1f')],function(_0x22af86){return{'model':db[_0x22af86[_0xbdeb('0x21')]],'as':_0x22af86['as'],'attributes':_0x22af86['attributes'],'include':_0x22af86[_0xbdeb('0x1f')]?_[_0xbdeb('0x20')](_0x22af86[_0xbdeb('0x1f')],function(_0x121d52){return{'model':db[_0x121d52[_0xbdeb('0x21')]],'as':_0x121d52['as'],'attributes':_0x121d52[_0xbdeb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbdeb('0xd')](function(_0x5d0a95){logger['info'](_0xbdeb('0x19'),_0x307ac6);logger['debug'](_0xbdeb('0x19'),_0x307ac6,JSON[_0xbdeb('0x13')](_0x5d0a95));_0x147c85(_0x5d0a95);})[_0xbdeb('0x18')](function(_0x302b14){logger[_0xbdeb('0x14')](_0xbdeb('0x19'),_0x302b14['message'],_0x307ac6);_0x3dd919(_0x4d456a[_0xbdeb('0x14')](0x1f4,_0x302b14[_0xbdeb('0x16')]));});});};exports['ShowFreshdeskAccount']=function(_0x560439){var _0xd52067=this;return new Promise(function(_0x4f9ab9,_0x5b79be){return db[_0xbdeb('0x1a')]['find']({'raw':_0x560439[_0xbdeb('0x1c')]?_0x560439[_0xbdeb('0x1c')][_0xbdeb('0x22')]===undefined?!![]:![]:!![],'where':_0x560439[_0xbdeb('0x1c')]?_0x560439[_0xbdeb('0x1c')][_0xbdeb('0x1d')]||null:null,'attributes':_0x560439[_0xbdeb('0x1c')]?_0x560439[_0xbdeb('0x1c')][_0xbdeb('0x1e')]||null:null,'include':_0x560439['options']?_0x560439[_0xbdeb('0x1c')]['include']?_[_0xbdeb('0x20')](_0x560439['options']['include'],function(_0x1ebce6){return{'model':db[_0x1ebce6['model']],'as':_0x1ebce6['as'],'attributes':_0x1ebce6[_0xbdeb('0x1e')],'include':_0x1ebce6['include']?_[_0xbdeb('0x20')](_0x1ebce6['include'],function(_0x3b327f){return{'model':db[_0x3b327f[_0xbdeb('0x21')]],'as':_0x3b327f['as'],'attributes':_0x3b327f[_0xbdeb('0x1e')],'include':_0x3b327f['include']?_[_0xbdeb('0x20')](_0x3b327f[_0xbdeb('0x1f')],function(_0x4b5001){return{'model':db[_0x4b5001['model']],'as':_0x4b5001['as'],'attributes':_0x4b5001[_0xbdeb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbdeb('0xd')](function(_0x37c5fc){logger[_0xbdeb('0xe')](_0xbdeb('0x23'),_0x560439);logger[_0xbdeb('0x11')](_0xbdeb('0x23'),_0x560439,JSON[_0xbdeb('0x13')](_0x37c5fc));_0x4f9ab9(_0x37c5fc);})[_0xbdeb('0x18')](function(_0x3821fb){logger[_0xbdeb('0x14')](_0xbdeb('0x23'),_0x3821fb[_0xbdeb('0x16')],_0x560439);_0x5b79be(_0xd52067[_0xbdeb('0x14')](0x1f4,_0x3821fb['message']));});});}; \ No newline at end of file +var _0xea1c=['options','raw','limit','include','attributes','model','info','stringify','catch','ShowFreshdeskAccount','find','where','map','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll'];(function(_0x8853b1,_0x3319ec){var _0x428c8d=function(_0x326635){while(--_0x326635){_0x8853b1['push'](_0x8853b1['shift']());}};_0x428c8d(++_0x3319ec);}(_0xea1c,0xc1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcea1('0x0'));var moment=require(_0xcea1('0x1'));var BPromise=require(_0xcea1('0x2'));var rs=require(_0xcea1('0x3'));var fs=require('fs');var Redis=require(_0xcea1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcea1('0x5'));var logger=require(_0xcea1('0x6'))('rpc');var config=require(_0xcea1('0x7'));var jayson=require(_0xcea1('0x8'));var client=jayson[_0xcea1('0x9')][_0xcea1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b97d7,_0x5875d1,_0x593e11){return new BPromise(function(_0x5c454d,_0x20ef17){return client['request'](_0x5b97d7,_0x593e11)[_0xcea1('0xb')](function(_0x1b7d73){logger['info'](_0xcea1('0xc'),_0x5875d1,_0xcea1('0xd'));logger[_0xcea1('0xe')](_0xcea1('0xf'),_0x5875d1,_0xcea1('0xd'),JSON['stringify'](_0x1b7d73));if(_0x1b7d73['error']){if(_0x1b7d73[_0xcea1('0x10')][_0xcea1('0x11')]===0x1f4){logger[_0xcea1('0x10')](_0xcea1('0xc'),_0x5875d1,_0x1b7d73['error']['message']);return _0x20ef17(_0x1b7d73['error'][_0xcea1('0x12')]);}logger[_0xcea1('0x10')](_0xcea1('0xc'),_0x5875d1,_0x1b7d73[_0xcea1('0x10')][_0xcea1('0x12')]);return _0x5c454d(_0x1b7d73['error'][_0xcea1('0x12')]);}else{logger['info'](_0xcea1('0xc'),_0x5875d1,_0xcea1('0xd'));_0x5c454d(_0x1b7d73[_0xcea1('0x13')]['message']);}})['catch'](function(_0x574300){logger[_0xcea1('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x5875d1,_0x574300);_0x20ef17(_0x574300);});});}exports[_0xcea1('0x14')]=function(_0x22c564){var _0x19b094=this;return new Promise(function(_0x140ea4,_0x3eb4da){return db[_0xcea1('0x15')][_0xcea1('0x16')]({'raw':_0x22c564[_0xcea1('0x17')]?_0x22c564[_0xcea1('0x17')][_0xcea1('0x18')]===undefined?!![]:![]:!![],'where':_0x22c564[_0xcea1('0x17')]?_0x22c564[_0xcea1('0x17')]['where']||null:null,'attributes':_0x22c564[_0xcea1('0x17')]?_0x22c564[_0xcea1('0x17')]['attributes']||null:null,'limit':_0x22c564[_0xcea1('0x17')]?_0x22c564[_0xcea1('0x17')][_0xcea1('0x19')]||null:null,'include':_0x22c564['options']?_0x22c564[_0xcea1('0x17')][_0xcea1('0x1a')]?_['map'](_0x22c564[_0xcea1('0x17')][_0xcea1('0x1a')],function(_0x407227){return{'model':db[_0x407227['model']],'as':_0x407227['as'],'attributes':_0x407227[_0xcea1('0x1b')],'include':_0x407227['include']?_['map'](_0x407227[_0xcea1('0x1a')],function(_0x1a8523){return{'model':db[_0x1a8523['model']],'as':_0x1a8523['as'],'attributes':_0x1a8523[_0xcea1('0x1b')],'include':_0x1a8523['include']?_['map'](_0x1a8523['include'],function(_0x44ce27){return{'model':db[_0x44ce27[_0xcea1('0x1c')]],'as':_0x44ce27['as'],'attributes':_0x44ce27[_0xcea1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcea1('0xb')](function(_0x33ae15){logger[_0xcea1('0x1d')](_0xcea1('0x14'),_0x22c564);logger[_0xcea1('0xe')](_0xcea1('0x14'),_0x22c564,JSON[_0xcea1('0x1e')](_0x33ae15));_0x140ea4(_0x33ae15);})[_0xcea1('0x1f')](function(_0x246966){logger[_0xcea1('0x10')](_0xcea1('0x14'),_0x246966[_0xcea1('0x12')],_0x22c564);_0x3eb4da(_0x19b094[_0xcea1('0x10')](0x1f4,_0x246966[_0xcea1('0x12')]));});});};exports[_0xcea1('0x20')]=function(_0x4fe608){var _0x257ffa=this;return new Promise(function(_0x4794c6,_0x914a59){return db[_0xcea1('0x15')][_0xcea1('0x21')]({'raw':_0x4fe608[_0xcea1('0x17')]?_0x4fe608[_0xcea1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4fe608[_0xcea1('0x17')]?_0x4fe608[_0xcea1('0x17')][_0xcea1('0x22')]||null:null,'attributes':_0x4fe608[_0xcea1('0x17')]?_0x4fe608[_0xcea1('0x17')][_0xcea1('0x1b')]||null:null,'include':_0x4fe608[_0xcea1('0x17')]?_0x4fe608['options'][_0xcea1('0x1a')]?_[_0xcea1('0x23')](_0x4fe608['options'][_0xcea1('0x1a')],function(_0x4ea427){return{'model':db[_0x4ea427[_0xcea1('0x1c')]],'as':_0x4ea427['as'],'attributes':_0x4ea427['attributes'],'include':_0x4ea427[_0xcea1('0x1a')]?_[_0xcea1('0x23')](_0x4ea427[_0xcea1('0x1a')],function(_0x365a92){return{'model':db[_0x365a92[_0xcea1('0x1c')]],'as':_0x365a92['as'],'attributes':_0x365a92[_0xcea1('0x1b')],'include':_0x365a92['include']?_[_0xcea1('0x23')](_0x365a92[_0xcea1('0x1a')],function(_0xb9f6ab){return{'model':db[_0xb9f6ab[_0xcea1('0x1c')]],'as':_0xb9f6ab['as'],'attributes':_0xb9f6ab[_0xcea1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcea1('0xb')](function(_0x1d0cca){logger[_0xcea1('0x1d')](_0xcea1('0x20'),_0x4fe608);logger[_0xcea1('0xe')](_0xcea1('0x20'),_0x4fe608,JSON[_0xcea1('0x1e')](_0x1d0cca));_0x4794c6(_0x1d0cca);})['catch'](function(_0x393ba4){logger[_0xcea1('0x10')]('ShowFreshdeskAccount',_0x393ba4[_0xcea1('0x12')],_0x4fe608);_0x914a59(_0x257ffa[_0xcea1('0x10')](0x1f4,_0x393ba4[_0xcea1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 55564ae..7f95b2a 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 _0xf375=['get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41cd93,_0x382eb8){var _0x58a7f8=function(_0x19e25f){while(--_0x19e25f){_0x41cd93['push'](_0x41cd93['shift']());}};_0x58a7f8(++_0x382eb8);}(_0xf375,0x9b));var _0x5f37=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf375[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x5f37('0x0'));var path=require(_0x5f37('0x1'));var timeout=require(_0x5f37('0x2'));var express=require(_0x5f37('0x3'));var router=express[_0x5f37('0x4')]();var fs_extra=require(_0x5f37('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5f37('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x5f37('0x7')]('/',auth['isAuthenticated'](),controller[_0x5f37('0x8')]);router['get'](_0x5f37('0x9'),auth[_0x5f37('0xa')](),controller[_0x5f37('0xb')]);router[_0x5f37('0x7')](_0x5f37('0xc'),auth['isAuthenticated'](),controller[_0x5f37('0xd')]);router[_0x5f37('0x7')]('/:id/subjects',auth[_0x5f37('0xa')](),controller[_0x5f37('0xe')]);router['get'](_0x5f37('0xf'),auth['isAuthenticated'](),controller[_0x5f37('0x10')]);router['get'](_0x5f37('0x11'),auth[_0x5f37('0xa')](),controller[_0x5f37('0x12')]);router[_0x5f37('0x13')]('/',auth[_0x5f37('0xa')](),controller[_0x5f37('0x14')]);router[_0x5f37('0x13')](_0x5f37('0x11'),auth[_0x5f37('0xa')](),controller[_0x5f37('0x15')]);router[_0x5f37('0x16')](_0x5f37('0x9'),auth['isAuthenticated'](),controller[_0x5f37('0x17')]);router[_0x5f37('0x18')](_0x5f37('0x9'),auth['isAuthenticated'](),controller[_0x5f37('0x19')]);module[_0x5f37('0x1a')]=router; \ No newline at end of file +var _0xf91c=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id'];(function(_0x15d2fd,_0x382adb){var _0x421ebe=function(_0x125b58){while(--_0x125b58){_0x15d2fd['push'](_0x15d2fd['shift']());}};_0x421ebe(++_0x382adb);}(_0xf91c,0x8e));var _0xcf91=function(_0x2383f7,_0x53e3ca){_0x2383f7=_0x2383f7-0x0;var _0x1432c6=_0xf91c[_0x2383f7];return _0x1432c6;};'use strict';var multer=require(_0xcf91('0x0'));var util=require(_0xcf91('0x1'));var path=require(_0xcf91('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf91('0x3'));var router=express[_0xcf91('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcf91('0x5'));var interaction=require(_0xcf91('0x6'));var config=require(_0xcf91('0x7'));var controller=require(_0xcf91('0x8'));router[_0xcf91('0x9')]('/',auth[_0xcf91('0xa')](),controller['index']);router[_0xcf91('0x9')](_0xcf91('0xb'),auth[_0xcf91('0xa')](),controller['show']);router['get'](_0xcf91('0xc'),auth[_0xcf91('0xa')](),controller['getFields']);router[_0xcf91('0x9')](_0xcf91('0xd'),auth['isAuthenticated'](),controller[_0xcf91('0xe')]);router[_0xcf91('0x9')](_0xcf91('0xf'),auth[_0xcf91('0xa')](),controller[_0xcf91('0x10')]);router[_0xcf91('0x9')](_0xcf91('0x11'),auth[_0xcf91('0xa')](),controller[_0xcf91('0x12')]);router[_0xcf91('0x13')]('/',auth[_0xcf91('0xa')](),controller['create']);router['post']('/:id/tags',auth[_0xcf91('0xa')](),controller[_0xcf91('0x14')]);router[_0xcf91('0x15')](_0xcf91('0xb'),auth[_0xcf91('0xa')](),controller['update']);router['delete'](_0xcf91('0xb'),auth[_0xcf91('0xa')](),controller['destroy']);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 d3cba36..09cbbf7 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 _0x9811=['STRING','exports'];(function(_0x19fb2b,_0x212bd8){var _0x3be612=function(_0x264ede){while(--_0x264ede){_0x19fb2b['push'](_0x19fb2b['shift']());}};_0x3be612(++_0x212bd8);}(_0x9811,0xfb));var _0x1981=function(_0x3e7352,_0x1072f9){_0x3e7352=_0x3e7352-0x0;var _0x25f5c4=_0x9811[_0x3e7352];return _0x25f5c4;};'use strict';var Sequelize=require('sequelize');module[_0x1981('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1981('0x1')]}}; \ No newline at end of file +var _0x4161=['exports','STRING','sequelize'];(function(_0x2a723e,_0x61bb43){var _0x48a0e1=function(_0x470e57){while(--_0x470e57){_0x2a723e['push'](_0x2a723e['shift']());}};_0x48a0e1(++_0x61bb43);}(_0x4161,0x89));var _0x1416=function(_0x5edadd,_0x1fed55){_0x5edadd=_0x5edadd-0x0;var _0x328a65=_0x4161[_0x5edadd];return _0x328a65;};'use strict';var Sequelize=require(_0x1416('0x0'));module[_0x1416('0x1')]={'name':{'type':Sequelize[_0x1416('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index c05ec04..fad5d01 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 _0x5b79=['nolimit','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','create','body','update','params','destroy','findOne','keys','FreshdeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','then','error','stack','name','send','index','map','FreshdeskConfiguration','key','model','filters','intersection','query','attributes','fields','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b79,0x1b6));var _0x95b7=function(_0x485e0b,_0x5eb3e3){_0x485e0b=_0x485e0b-0x0;var _0x12283c=_0x5b79[_0x485e0b];return _0x12283c;};'use strict';var emlformat=require(_0x95b7('0x0'));var rimraf=require(_0x95b7('0x1'));var zipdir=require(_0x95b7('0x2'));var jsonpatch=require(_0x95b7('0x3'));var rp=require(_0x95b7('0x4'));var moment=require('moment');var BPromise=require(_0x95b7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x95b7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x95b7('0x7'));var fs=require('fs');var fs_extra=require(_0x95b7('0x8'));var _=require('lodash');var squel=require(_0x95b7('0x9'));var crypto=require('crypto');var jsforce=require(_0x95b7('0xa'));var deskjs=require(_0x95b7('0xb'));var toCsv=require(_0x95b7('0xc'));var querystring=require('querystring');var Papa=require(_0x95b7('0xd'));var Redis=require(_0x95b7('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x95b7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95b7('0x10'))(_0x95b7('0x11'));var utils=require(_0x95b7('0x12'));var config=require(_0x95b7('0x13'));var licenseUtil=require(_0x95b7('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36db1a,_0x4ce067){_0x4ce067=_0x4ce067||0xcc;return function(_0x317cb8){if(_0x317cb8){return _0x36db1a[_0x95b7('0x15')](_0x4ce067);}return _0x36db1a['status'](_0x4ce067)[_0x95b7('0x16')]();};}function respondWithResult(_0xb06c78,_0x27243f){_0x27243f=_0x27243f||0xc8;return function(_0x5e141c){if(_0x5e141c){return _0xb06c78[_0x95b7('0x17')](_0x27243f)['json'](_0x5e141c);}};}function respondWithFilteredResult(_0x35acf1,_0x9a6cd9){return function(_0x154364){if(_0x154364){var _0x33fa6b=typeof _0x9a6cd9[_0x95b7('0x18')]===_0x95b7('0x19')&&typeof _0x9a6cd9[_0x95b7('0x1a')]==='undefined';var _0x365ce4=_0x154364['count'];var _0x272388=_0x33fa6b?0x0:_0x9a6cd9[_0x95b7('0x18')];var _0x2b64e5=_0x33fa6b?_0x154364[_0x95b7('0x1b')]:_0x9a6cd9[_0x95b7('0x18')]+_0x9a6cd9[_0x95b7('0x1a')];var _0x44c56f;if(_0x2b64e5>=_0x365ce4){_0x2b64e5=_0x365ce4;_0x44c56f=0xc8;}else{_0x44c56f=0xce;}_0x35acf1['status'](_0x44c56f);return _0x35acf1[_0x95b7('0x1c')](_0x95b7('0x1d'),_0x272388+'-'+_0x2b64e5+'/'+_0x365ce4)[_0x95b7('0x1e')](_0x154364);}return null;};}function patchUpdates(_0x3b9b89){return function(_0x5ed096){try{jsonpatch['apply'](_0x5ed096,_0x3b9b89,!![]);}catch(_0x5b15a6){return BPromise['reject'](_0x5b15a6);}return _0x5ed096[_0x95b7('0x1f')]();};}function saveUpdates(_0x4bf5fb,_0x350341){return function(_0x49626b){if(_0x49626b){return _0x49626b['update'](_0x4bf5fb)[_0x95b7('0x20')](function(_0x3012c2){return _0x3012c2;});}return null;};}function removeEntity(_0xbbe506,_0xe1632e){return function(_0x2a87de){if(_0x2a87de){return _0x2a87de['destroy']()[_0x95b7('0x20')](function(){_0xbbe506[_0x95b7('0x17')](0xcc)[_0x95b7('0x16')]();});}};}function handleEntityNotFound(_0x1ec8f2,_0x4f8d54){return function(_0x2cd5ff){if(!_0x2cd5ff){_0x1ec8f2[_0x95b7('0x15')](0x194);}return _0x2cd5ff;};}function handleError(_0x56395a,_0x69b6a5){_0x69b6a5=_0x69b6a5||0x1f4;return function(_0x414744){logger[_0x95b7('0x21')](_0x414744[_0x95b7('0x22')]);if(_0x414744[_0x95b7('0x23')]){delete _0x414744[_0x95b7('0x23')];}_0x56395a[_0x95b7('0x17')](_0x69b6a5)[_0x95b7('0x24')](_0x414744);};}exports[_0x95b7('0x25')]=function(_0x10e26d,_0x57dfd2){var _0x198218={},_0x33f284={},_0x4686b5={'count':0x0,'rows':[]};var _0xb6c61d=_[_0x95b7('0x26')](db[_0x95b7('0x27')]['rawAttributes'],function(_0x27e8b3){return{'name':_0x27e8b3['fieldName'],'type':_0x27e8b3['type'][_0x95b7('0x28')]};});_0x33f284[_0x95b7('0x29')]=_['map'](_0xb6c61d,_0x95b7('0x23'));_0x33f284['query']=_['keys'](_0x10e26d['query']);_0x33f284[_0x95b7('0x2a')]=_[_0x95b7('0x2b')](_0x33f284[_0x95b7('0x29')],_0x33f284[_0x95b7('0x2c')]);_0x198218[_0x95b7('0x2d')]=_[_0x95b7('0x2b')](_0x33f284['model'],qs[_0x95b7('0x2e')](_0x10e26d[_0x95b7('0x2c')][_0x95b7('0x2e')]));_0x198218['attributes']=_0x198218[_0x95b7('0x2d')]['length']?_0x198218['attributes']:_0x33f284['model'];if(!_0x10e26d[_0x95b7('0x2c')][_0x95b7('0x2f')](_0x95b7('0x30'))){_0x198218[_0x95b7('0x1a')]=qs[_0x95b7('0x1a')](_0x10e26d[_0x95b7('0x2c')][_0x95b7('0x1a')]);_0x198218[_0x95b7('0x18')]=qs[_0x95b7('0x18')](_0x10e26d[_0x95b7('0x2c')][_0x95b7('0x18')]);}_0x198218['order']=qs[_0x95b7('0x31')](_0x10e26d['query'][_0x95b7('0x31')]);_0x198218['where']=qs[_0x95b7('0x2a')](_[_0x95b7('0x32')](_0x10e26d[_0x95b7('0x2c')],_0x33f284[_0x95b7('0x2a')]),_0xb6c61d);if(_0x10e26d[_0x95b7('0x2c')]['filter']){_0x198218[_0x95b7('0x33')]=_[_0x95b7('0x34')](_0x198218['where'],{'$or':_['map'](_0xb6c61d,function(_0x3d498d){if(_0x3d498d[_0x95b7('0x35')]!==_0x95b7('0x36')){var _0x24da6c={};_0x24da6c[_0x3d498d['name']]={'$like':'%'+_0x10e26d['query'][_0x95b7('0x37')]+'%'};return _0x24da6c;}})});}_0x198218=_['merge']({},_0x198218,_0x10e26d['options']);var _0x57f8f4={'where':_0x198218[_0x95b7('0x33')]};return db['FreshdeskConfiguration'][_0x95b7('0x1b')](_0x57f8f4)['then'](function(_0x1c5c3a){_0x4686b5[_0x95b7('0x1b')]=_0x1c5c3a;if(_0x10e26d[_0x95b7('0x2c')][_0x95b7('0x38')]){_0x198218[_0x95b7('0x39')]=[{'all':!![]}];}return db[_0x95b7('0x27')]['findAll'](_0x198218);})['then'](function(_0x34bab9){_0x4686b5[_0x95b7('0x3a')]=_0x34bab9;return _0x4686b5;})[_0x95b7('0x20')](respondWithFilteredResult(_0x57dfd2,_0x198218))[_0x95b7('0x3b')](handleError(_0x57dfd2,null));};exports[_0x95b7('0x3c')]=function(_0x27a174,_0x496d9f){var _0x3b926b={'raw':![],'where':{'id':_0x27a174['params']['id']}},_0x14cf9d={};_0x14cf9d[_0x95b7('0x29')]=_['keys'](db['FreshdeskConfiguration'][_0x95b7('0x3d')]);_0x14cf9d[_0x95b7('0x2c')]=_['keys'](_0x27a174['query']);_0x14cf9d[_0x95b7('0x2a')]=_[_0x95b7('0x2b')](_0x14cf9d[_0x95b7('0x29')],_0x14cf9d[_0x95b7('0x2c')]);_0x3b926b[_0x95b7('0x2d')]=_['intersection'](_0x14cf9d[_0x95b7('0x29')],qs[_0x95b7('0x2e')](_0x27a174[_0x95b7('0x2c')][_0x95b7('0x2e')]));_0x3b926b[_0x95b7('0x2d')]=_0x3b926b[_0x95b7('0x2d')][_0x95b7('0x3e')]?_0x3b926b['attributes']:_0x14cf9d[_0x95b7('0x29')];if(_0x27a174[_0x95b7('0x2c')][_0x95b7('0x38')]){_0x3b926b['include']=[{'all':!![]}];}_0x3b926b=_[_0x95b7('0x34')]({},_0x3b926b,_0x27a174[_0x95b7('0x3f')]);return db[_0x95b7('0x27')][_0x95b7('0x40')](_0x3b926b)[_0x95b7('0x20')](handleEntityNotFound(_0x496d9f,null))[_0x95b7('0x20')](respondWithResult(_0x496d9f,null))[_0x95b7('0x3b')](handleError(_0x496d9f,null));};exports['create']=function(_0x188b28,_0x83d044){return db[_0x95b7('0x27')][_0x95b7('0x41')](_0x188b28[_0x95b7('0x42')],{})[_0x95b7('0x20')](respondWithResult(_0x83d044,0xc9))[_0x95b7('0x3b')](handleError(_0x83d044,null));};exports[_0x95b7('0x43')]=function(_0x3082c4,_0x3b53c9){if(_0x3082c4[_0x95b7('0x42')]['id']){delete _0x3082c4['body']['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x3082c4[_0x95b7('0x44')]['id']}})[_0x95b7('0x20')](handleEntityNotFound(_0x3b53c9,null))[_0x95b7('0x20')](saveUpdates(_0x3082c4[_0x95b7('0x42')],null))[_0x95b7('0x20')](respondWithResult(_0x3b53c9,null))[_0x95b7('0x3b')](handleError(_0x3b53c9,null));};exports[_0x95b7('0x45')]=function(_0x4665bd,_0x416fc8){return db[_0x95b7('0x27')][_0x95b7('0x40')]({'where':{'id':_0x4665bd[_0x95b7('0x44')]['id']}})[_0x95b7('0x20')](handleEntityNotFound(_0x416fc8,null))[_0x95b7('0x20')](removeEntity(_0x416fc8,null))['catch'](handleError(_0x416fc8,null));};exports['getFields']=function(_0x5e366e,_0x1b7e6a,_0x5bae69){var _0x431f10={};var _0x24d770={};var _0x588b80;var _0x4ba14d;return db[_0x95b7('0x27')][_0x95b7('0x46')]({'where':{'id':_0x5e366e[_0x95b7('0x44')]['id']}})[_0x95b7('0x20')](handleEntityNotFound(_0x1b7e6a,null))['then'](function(_0x101bb8){if(_0x101bb8){_0x588b80=_0x101bb8;_0x24d770[_0x95b7('0x29')]=_[_0x95b7('0x47')](db[_0x95b7('0x48')][_0x95b7('0x3d')]);_0x24d770['query']=_[_0x95b7('0x47')](_0x5e366e['query']);_0x24d770[_0x95b7('0x2a')]=_[_0x95b7('0x2b')](_0x24d770[_0x95b7('0x29')],_0x24d770['query']);_0x431f10[_0x95b7('0x2d')]=_[_0x95b7('0x2b')](_0x24d770[_0x95b7('0x29')],qs[_0x95b7('0x2e')](_0x5e366e[_0x95b7('0x2c')][_0x95b7('0x2e')]));_0x431f10['attributes']=_0x431f10[_0x95b7('0x2d')]['length']?_0x431f10[_0x95b7('0x2d')]:_0x24d770[_0x95b7('0x29')];_0x431f10[_0x95b7('0x49')]=qs['sort'](_0x5e366e['query'][_0x95b7('0x31')]);_0x431f10[_0x95b7('0x33')]=qs[_0x95b7('0x2a')](_[_0x95b7('0x32')](_0x5e366e[_0x95b7('0x2c')],_0x24d770['filters']));if(_0x5e366e[_0x95b7('0x2c')][_0x95b7('0x37')]){_0x431f10[_0x95b7('0x33')]=_['merge'](_0x431f10[_0x95b7('0x33')],{'$or':_[_0x95b7('0x26')](_0x431f10[_0x95b7('0x2d')],function(_0x42b480){var _0x4acaed={};_0x4acaed[_0x42b480]={'$like':'%'+_0x5e366e[_0x95b7('0x2c')][_0x95b7('0x37')]+'%'};return _0x4acaed;})});}_0x431f10=_['merge']({},_0x431f10,_0x5e366e[_0x95b7('0x3f')]);return _0x588b80['getFields'](_0x431f10);}})[_0x95b7('0x20')](function(_0x54e050){if(_0x54e050){_0x4ba14d=_0x54e050['length'];if(!_0x5e366e[_0x95b7('0x2c')]['hasOwnProperty']('nolimit')){_0x431f10[_0x95b7('0x1a')]=qs[_0x95b7('0x1a')](_0x5e366e[_0x95b7('0x2c')][_0x95b7('0x1a')]);_0x431f10['offset']=qs[_0x95b7('0x18')](_0x5e366e[_0x95b7('0x2c')][_0x95b7('0x18')]);}return _0x588b80[_0x95b7('0x4a')](_0x431f10);}})[_0x95b7('0x20')](function(_0x3f7737){if(_0x3f7737){return _0x3f7737?{'count':_0x4ba14d,'rows':_0x3f7737}:null;}})[_0x95b7('0x20')](respondWithResult(_0x1b7e6a,null))[_0x95b7('0x3b')](handleError(_0x1b7e6a,null));};exports['getSubjects']=function(_0x1a4e79,_0x129e44,_0x1d45b0){var _0x211943={};var _0xb331c3={};var _0x50a571;var _0x1d128e;return db[_0x95b7('0x27')][_0x95b7('0x46')]({'where':{'id':_0x1a4e79[_0x95b7('0x44')]['id']}})[_0x95b7('0x20')](handleEntityNotFound(_0x129e44,null))['then'](function(_0x196227){if(_0x196227){_0x50a571=_0x196227;_0xb331c3[_0x95b7('0x29')]=_['keys'](db['FreshdeskField'][_0x95b7('0x3d')]);_0xb331c3[_0x95b7('0x2c')]=_[_0x95b7('0x47')](_0x1a4e79[_0x95b7('0x2c')]);_0xb331c3['filters']=_[_0x95b7('0x2b')](_0xb331c3[_0x95b7('0x29')],_0xb331c3['query']);_0x211943[_0x95b7('0x2d')]=_[_0x95b7('0x2b')](_0xb331c3[_0x95b7('0x29')],qs[_0x95b7('0x2e')](_0x1a4e79[_0x95b7('0x2c')][_0x95b7('0x2e')]));_0x211943['attributes']=_0x211943[_0x95b7('0x2d')][_0x95b7('0x3e')]?_0x211943[_0x95b7('0x2d')]:_0xb331c3[_0x95b7('0x29')];_0x211943[_0x95b7('0x49')]=qs[_0x95b7('0x31')](_0x1a4e79[_0x95b7('0x2c')][_0x95b7('0x31')]);_0x211943[_0x95b7('0x33')]=qs[_0x95b7('0x2a')](_[_0x95b7('0x32')](_0x1a4e79[_0x95b7('0x2c')],_0xb331c3[_0x95b7('0x2a')]));if(_0x1a4e79[_0x95b7('0x2c')][_0x95b7('0x37')]){_0x211943['where']=_['merge'](_0x211943['where'],{'$or':_['map'](_0x211943[_0x95b7('0x2d')],function(_0x6b297c){var _0x3a8038={};_0x3a8038[_0x6b297c]={'$like':'%'+_0x1a4e79[_0x95b7('0x2c')]['filter']+'%'};return _0x3a8038;})});}_0x211943=_[_0x95b7('0x34')]({},_0x211943,_0x1a4e79['options']);return _0x50a571[_0x95b7('0x4b')](_0x211943);}})[_0x95b7('0x20')](function(_0x42590a){if(_0x42590a){_0x1d128e=_0x42590a[_0x95b7('0x3e')];if(!_0x1a4e79[_0x95b7('0x2c')]['hasOwnProperty'](_0x95b7('0x30'))){_0x211943[_0x95b7('0x1a')]=qs[_0x95b7('0x1a')](_0x1a4e79[_0x95b7('0x2c')][_0x95b7('0x1a')]);_0x211943[_0x95b7('0x18')]=qs['offset'](_0x1a4e79['query']['offset']);}return _0x50a571[_0x95b7('0x4b')](_0x211943);}})[_0x95b7('0x20')](function(_0x4b0f06){if(_0x4b0f06){return _0x4b0f06?{'count':_0x1d128e,'rows':_0x4b0f06}:null;}})[_0x95b7('0x20')](respondWithResult(_0x129e44,null))['catch'](handleError(_0x129e44,null));};exports[_0x95b7('0x4c')]=function(_0x5274c4,_0x38bcba,_0x638ca6){var _0x506506={};var _0x5aa989={};var _0x37c536;var _0x5162f6;return db[_0x95b7('0x27')][_0x95b7('0x46')]({'where':{'id':_0x5274c4[_0x95b7('0x44')]['id']}})[_0x95b7('0x20')](handleEntityNotFound(_0x38bcba,null))['then'](function(_0x1a1e9b){if(_0x1a1e9b){_0x37c536=_0x1a1e9b;_0x5aa989['model']=_[_0x95b7('0x47')](db[_0x95b7('0x48')][_0x95b7('0x3d')]);_0x5aa989[_0x95b7('0x2c')]=_['keys'](_0x5274c4[_0x95b7('0x2c')]);_0x5aa989[_0x95b7('0x2a')]=_[_0x95b7('0x2b')](_0x5aa989[_0x95b7('0x29')],_0x5aa989[_0x95b7('0x2c')]);_0x506506[_0x95b7('0x2d')]=_['intersection'](_0x5aa989[_0x95b7('0x29')],qs['fields'](_0x5274c4[_0x95b7('0x2c')][_0x95b7('0x2e')]));_0x506506[_0x95b7('0x2d')]=_0x506506[_0x95b7('0x2d')][_0x95b7('0x3e')]?_0x506506[_0x95b7('0x2d')]:_0x5aa989[_0x95b7('0x29')];_0x506506[_0x95b7('0x49')]=qs[_0x95b7('0x31')](_0x5274c4[_0x95b7('0x2c')][_0x95b7('0x31')]);_0x506506['where']=qs[_0x95b7('0x2a')](_[_0x95b7('0x32')](_0x5274c4[_0x95b7('0x2c')],_0x5aa989['filters']));if(_0x5274c4[_0x95b7('0x2c')]['filter']){_0x506506[_0x95b7('0x33')]=_['merge'](_0x506506[_0x95b7('0x33')],{'$or':_['map'](_0x506506[_0x95b7('0x2d')],function(_0x3f6115){var _0x145a5f={};_0x145a5f[_0x3f6115]={'$like':'%'+_0x5274c4[_0x95b7('0x2c')][_0x95b7('0x37')]+'%'};return _0x145a5f;})});}_0x506506=_['merge']({},_0x506506,_0x5274c4[_0x95b7('0x3f')]);return _0x37c536['getDescriptions'](_0x506506);}})[_0x95b7('0x20')](function(_0x3c984e){if(_0x3c984e){_0x5162f6=_0x3c984e[_0x95b7('0x3e')];if(!_0x5274c4[_0x95b7('0x2c')][_0x95b7('0x2f')](_0x95b7('0x30'))){_0x506506['limit']=qs[_0x95b7('0x1a')](_0x5274c4[_0x95b7('0x2c')][_0x95b7('0x1a')]);_0x506506[_0x95b7('0x18')]=qs[_0x95b7('0x18')](_0x5274c4[_0x95b7('0x2c')]['offset']);}return _0x37c536[_0x95b7('0x4c')](_0x506506);}})[_0x95b7('0x20')](function(_0x311988){if(_0x311988){return _0x311988?{'count':_0x5162f6,'rows':_0x311988}:null;}})[_0x95b7('0x20')](respondWithResult(_0x38bcba,null))[_0x95b7('0x3b')](handleError(_0x38bcba,null));};exports[_0x95b7('0x4d')]=function(_0x8850b0,_0xb846da,_0x278192){var _0x37eb29={};var _0x101803={};var _0x34971b;var _0x14032e;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x8850b0[_0x95b7('0x44')]['id']}})[_0x95b7('0x20')](handleEntityNotFound(_0xb846da,null))[_0x95b7('0x20')](function(_0x31aa3a){if(_0x31aa3a){_0x34971b=_0x31aa3a;_0x101803[_0x95b7('0x29')]=_[_0x95b7('0x47')](db[_0x95b7('0x4e')][_0x95b7('0x3d')]);_0x101803[_0x95b7('0x2c')]=_[_0x95b7('0x47')](_0x8850b0[_0x95b7('0x2c')]);_0x101803[_0x95b7('0x2a')]=_[_0x95b7('0x2b')](_0x101803[_0x95b7('0x29')],_0x101803[_0x95b7('0x2c')]);_0x37eb29[_0x95b7('0x2d')]=_[_0x95b7('0x2b')](_0x101803[_0x95b7('0x29')],qs[_0x95b7('0x2e')](_0x8850b0[_0x95b7('0x2c')][_0x95b7('0x2e')]));_0x37eb29['attributes']=_0x37eb29[_0x95b7('0x2d')][_0x95b7('0x3e')]?_0x37eb29[_0x95b7('0x2d')]:_0x101803[_0x95b7('0x29')];_0x37eb29[_0x95b7('0x49')]=qs['sort'](_0x8850b0[_0x95b7('0x2c')][_0x95b7('0x31')]);_0x37eb29['where']=qs['filters'](_[_0x95b7('0x32')](_0x8850b0[_0x95b7('0x2c')],_0x101803[_0x95b7('0x2a')]));if(_0x8850b0[_0x95b7('0x2c')][_0x95b7('0x37')]){_0x37eb29['where']=_[_0x95b7('0x34')](_0x37eb29[_0x95b7('0x33')],{'$or':_['map'](_0x37eb29[_0x95b7('0x2d')],function(_0x35e8fe){var _0x2cf8b4={};_0x2cf8b4[_0x35e8fe]={'$like':'%'+_0x8850b0[_0x95b7('0x2c')][_0x95b7('0x37')]+'%'};return _0x2cf8b4;})});}_0x37eb29=_['merge']({},_0x37eb29,_0x8850b0[_0x95b7('0x3f')]);return _0x34971b[_0x95b7('0x4d')](_0x37eb29);}})[_0x95b7('0x20')](function(_0x1c470c){if(_0x1c470c){_0x14032e=_0x1c470c[_0x95b7('0x3e')];if(!_0x8850b0[_0x95b7('0x2c')][_0x95b7('0x2f')](_0x95b7('0x30'))){_0x37eb29[_0x95b7('0x1a')]=qs['limit'](_0x8850b0[_0x95b7('0x2c')][_0x95b7('0x1a')]);_0x37eb29[_0x95b7('0x18')]=qs[_0x95b7('0x18')](_0x8850b0[_0x95b7('0x2c')][_0x95b7('0x18')]);}return _0x34971b[_0x95b7('0x4d')](_0x37eb29);}})['then'](function(_0x2f4a27){if(_0x2f4a27){return _0x2f4a27?{'count':_0x14032e,'rows':_0x2f4a27}:null;}})[_0x95b7('0x20')](respondWithResult(_0xb846da,null))[_0x95b7('0x3b')](handleError(_0xb846da,null));};exports['setTags']=function(_0x505cc4,_0x42dae3,_0x3fd30d){if(_0x505cc4['body']['id']){delete _0x505cc4['body']['id'];}return db['FreshdeskConfiguration'][_0x95b7('0x46')]({'where':{'id':_0x505cc4['params']['id']}})[_0x95b7('0x20')](handleEntityNotFound(_0x42dae3,null))[_0x95b7('0x20')](function(_0x50a153){if(_0x50a153){return _0x50a153[_0x95b7('0x4f')](_0x505cc4[_0x95b7('0x42')][_0x95b7('0x50')]||[]);}return null;})[_0x95b7('0x20')](respondWithResult(_0x42dae3,null))[_0x95b7('0x3b')](handleError(_0x42dae3,null));}; \ No newline at end of file +var _0xeeea=['stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','findAll','catch','show','params','includeAll','include','options','create','body','destroy','getFields','findOne','FreshdeskField','order','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','then','error'];(function(_0x2c5987,_0x101621){var _0x55773d=function(_0x1ba37c){while(--_0x1ba37c){_0x2c5987['push'](_0x2c5987['shift']());}};_0x55773d(++_0x101621);}(_0xeeea,0x16d));var _0xaeee=function(_0x566f05,_0x160e6f){_0x566f05=_0x566f05-0x0;var _0x17833b=_0xeeea[_0x566f05];return _0x17833b;};'use strict';var emlformat=require(_0xaeee('0x0'));var rimraf=require(_0xaeee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaeee('0x2'));var rp=require(_0xaeee('0x3'));var moment=require('moment');var BPromise=require(_0xaeee('0x4'));var Mustache=require(_0xaeee('0x5'));var util=require(_0xaeee('0x6'));var path=require(_0xaeee('0x7'));var sox=require('sox');var csv=require(_0xaeee('0x8'));var ejs=require(_0xaeee('0x9'));var fs=require('fs');var fs_extra=require(_0xaeee('0xa'));var _=require(_0xaeee('0xb'));var squel=require(_0xaeee('0xc'));var crypto=require(_0xaeee('0xd'));var jsforce=require(_0xaeee('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaeee('0xf'));var Papa=require('papaparse');var Redis=require(_0xaeee('0x10'));var authService=require(_0xaeee('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaeee('0x12'));var logger=require(_0xaeee('0x13'))(_0xaeee('0x14'));var utils=require(_0xaeee('0x15'));var config=require(_0xaeee('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c6d7a,_0x246f5c){_0x246f5c=_0x246f5c||0xcc;return function(_0x44dcc9){if(_0x44dcc9){return _0x1c6d7a[_0xaeee('0x17')](_0x246f5c);}return _0x1c6d7a[_0xaeee('0x18')](_0x246f5c)['end']();};}function respondWithResult(_0xdcb878,_0x148452){_0x148452=_0x148452||0xc8;return function(_0x8cb6d9){if(_0x8cb6d9){return _0xdcb878[_0xaeee('0x18')](_0x148452)[_0xaeee('0x19')](_0x8cb6d9);}};}function respondWithFilteredResult(_0x175c4b,_0x8d307e){return function(_0x1f07eb){if(_0x1f07eb){var _0x1915f8=typeof _0x8d307e[_0xaeee('0x1a')]===_0xaeee('0x1b')&&typeof _0x8d307e['limit']==='undefined';var _0x133c07=_0x1f07eb['count'];var _0x27c93d=_0x1915f8?0x0:_0x8d307e[_0xaeee('0x1a')];var _0x10bcac=_0x1915f8?_0x1f07eb[_0xaeee('0x1c')]:_0x8d307e[_0xaeee('0x1a')]+_0x8d307e[_0xaeee('0x1d')];var _0x3c2a45;if(_0x10bcac>=_0x133c07){_0x10bcac=_0x133c07;_0x3c2a45=0xc8;}else{_0x3c2a45=0xce;}_0x175c4b[_0xaeee('0x18')](_0x3c2a45);return _0x175c4b[_0xaeee('0x1e')]('Content-Range',_0x27c93d+'-'+_0x10bcac+'/'+_0x133c07)[_0xaeee('0x19')](_0x1f07eb);}return null;};}function patchUpdates(_0x15d5ef){return function(_0x2bca97){try{jsonpatch[_0xaeee('0x1f')](_0x2bca97,_0x15d5ef,!![]);}catch(_0x229ff2){return BPromise['reject'](_0x229ff2);}return _0x2bca97[_0xaeee('0x20')]();};}function saveUpdates(_0x514531,_0x528c4c){return function(_0x1e9a30){if(_0x1e9a30){return _0x1e9a30['update'](_0x514531)['then'](function(_0x47baa3){return _0x47baa3;});}return null;};}function removeEntity(_0x221435,_0xe7b809){return function(_0x52afb7){if(_0x52afb7){return _0x52afb7['destroy']()[_0xaeee('0x21')](function(){_0x221435[_0xaeee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fe6c,_0x3d3ca9){return function(_0x14dc12){if(!_0x14dc12){_0x31fe6c[_0xaeee('0x17')](0x194);}return _0x14dc12;};}function handleError(_0xc5bd23,_0x5e12b9){_0x5e12b9=_0x5e12b9||0x1f4;return function(_0x386475){logger[_0xaeee('0x22')](_0x386475[_0xaeee('0x23')]);if(_0x386475[_0xaeee('0x24')]){delete _0x386475[_0xaeee('0x24')];}_0xc5bd23[_0xaeee('0x18')](_0x5e12b9)[_0xaeee('0x25')](_0x386475);};}exports['index']=function(_0x2de737,_0x4d32f9){var _0x45be40={},_0x42c097={},_0x2b254e={'count':0x0,'rows':[]};var _0x3b4b19=_[_0xaeee('0x26')](db[_0xaeee('0x27')][_0xaeee('0x28')],function(_0x14860a){return{'name':_0x14860a[_0xaeee('0x29')],'type':_0x14860a['type'][_0xaeee('0x2a')]};});_0x42c097[_0xaeee('0x2b')]=_[_0xaeee('0x26')](_0x3b4b19,_0xaeee('0x24'));_0x42c097['query']=_[_0xaeee('0x2c')](_0x2de737['query']);_0x42c097[_0xaeee('0x2d')]=_[_0xaeee('0x2e')](_0x42c097[_0xaeee('0x2b')],_0x42c097[_0xaeee('0x2f')]);_0x45be40['attributes']=_[_0xaeee('0x2e')](_0x42c097[_0xaeee('0x2b')],qs[_0xaeee('0x30')](_0x2de737['query'][_0xaeee('0x30')]));_0x45be40[_0xaeee('0x31')]=_0x45be40['attributes'][_0xaeee('0x32')]?_0x45be40['attributes']:_0x42c097[_0xaeee('0x2b')];if(!_0x2de737[_0xaeee('0x2f')][_0xaeee('0x33')](_0xaeee('0x34'))){_0x45be40[_0xaeee('0x1d')]=qs[_0xaeee('0x1d')](_0x2de737[_0xaeee('0x2f')][_0xaeee('0x1d')]);_0x45be40[_0xaeee('0x1a')]=qs['offset'](_0x2de737[_0xaeee('0x2f')]['offset']);}_0x45be40['order']=qs[_0xaeee('0x35')](_0x2de737[_0xaeee('0x2f')][_0xaeee('0x35')]);_0x45be40[_0xaeee('0x36')]=qs[_0xaeee('0x2d')](_['pick'](_0x2de737[_0xaeee('0x2f')],_0x42c097[_0xaeee('0x2d')]),_0x3b4b19);if(_0x2de737[_0xaeee('0x2f')][_0xaeee('0x37')]){_0x45be40[_0xaeee('0x36')]=_[_0xaeee('0x38')](_0x45be40[_0xaeee('0x36')],{'$or':_[_0xaeee('0x26')](_0x3b4b19,function(_0x228876){if(_0x228876[_0xaeee('0x39')]!==_0xaeee('0x3a')){var _0x2666bb={};_0x2666bb[_0x228876['name']]={'$like':'%'+_0x2de737[_0xaeee('0x2f')][_0xaeee('0x37')]+'%'};return _0x2666bb;}})});}_0x45be40=_[_0xaeee('0x38')]({},_0x45be40,_0x2de737['options']);var _0xf15001={'where':_0x45be40['where']};return db[_0xaeee('0x27')][_0xaeee('0x1c')](_0xf15001)['then'](function(_0x4322b4){_0x2b254e[_0xaeee('0x1c')]=_0x4322b4;if(_0x2de737['query']['includeAll']){_0x45be40['include']=[{'all':!![]}];}return db[_0xaeee('0x27')][_0xaeee('0x3b')](_0x45be40);})[_0xaeee('0x21')](function(_0x510a31){_0x2b254e['rows']=_0x510a31;return _0x2b254e;})[_0xaeee('0x21')](respondWithFilteredResult(_0x4d32f9,_0x45be40))[_0xaeee('0x3c')](handleError(_0x4d32f9,null));};exports[_0xaeee('0x3d')]=function(_0x27393b,_0x38115c){var _0x40fcc3={'raw':![],'where':{'id':_0x27393b[_0xaeee('0x3e')]['id']}},_0x4225e3={};_0x4225e3[_0xaeee('0x2b')]=_[_0xaeee('0x2c')](db[_0xaeee('0x27')]['rawAttributes']);_0x4225e3['query']=_[_0xaeee('0x2c')](_0x27393b[_0xaeee('0x2f')]);_0x4225e3[_0xaeee('0x2d')]=_[_0xaeee('0x2e')](_0x4225e3[_0xaeee('0x2b')],_0x4225e3[_0xaeee('0x2f')]);_0x40fcc3[_0xaeee('0x31')]=_[_0xaeee('0x2e')](_0x4225e3[_0xaeee('0x2b')],qs['fields'](_0x27393b[_0xaeee('0x2f')][_0xaeee('0x30')]));_0x40fcc3['attributes']=_0x40fcc3[_0xaeee('0x31')][_0xaeee('0x32')]?_0x40fcc3[_0xaeee('0x31')]:_0x4225e3[_0xaeee('0x2b')];if(_0x27393b[_0xaeee('0x2f')][_0xaeee('0x3f')]){_0x40fcc3[_0xaeee('0x40')]=[{'all':!![]}];}_0x40fcc3=_[_0xaeee('0x38')]({},_0x40fcc3,_0x27393b[_0xaeee('0x41')]);return db[_0xaeee('0x27')]['find'](_0x40fcc3)[_0xaeee('0x21')](handleEntityNotFound(_0x38115c,null))[_0xaeee('0x21')](respondWithResult(_0x38115c,null))['catch'](handleError(_0x38115c,null));};exports[_0xaeee('0x42')]=function(_0x565460,_0x25cd6f){return db[_0xaeee('0x27')][_0xaeee('0x42')](_0x565460['body'],{})[_0xaeee('0x21')](respondWithResult(_0x25cd6f,0xc9))[_0xaeee('0x3c')](handleError(_0x25cd6f,null));};exports['update']=function(_0x3c8269,_0x2ea70d){if(_0x3c8269['body']['id']){delete _0x3c8269[_0xaeee('0x43')]['id'];}return db[_0xaeee('0x27')]['find']({'where':{'id':_0x3c8269[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x2ea70d,null))['then'](saveUpdates(_0x3c8269['body'],null))[_0xaeee('0x21')](respondWithResult(_0x2ea70d,null))['catch'](handleError(_0x2ea70d,null));};exports[_0xaeee('0x44')]=function(_0x1b804f,_0x197231){return db[_0xaeee('0x27')]['find']({'where':{'id':_0x1b804f[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x197231,null))[_0xaeee('0x21')](removeEntity(_0x197231,null))['catch'](handleError(_0x197231,null));};exports[_0xaeee('0x45')]=function(_0x1fc6a3,_0x472e3e,_0x54c094){var _0x3ccd4a={};var _0x25ca54={};var _0x3cfe8e;var _0x30649d;return db['FreshdeskConfiguration'][_0xaeee('0x46')]({'where':{'id':_0x1fc6a3['params']['id']}})['then'](handleEntityNotFound(_0x472e3e,null))['then'](function(_0xd2cad2){if(_0xd2cad2){_0x3cfe8e=_0xd2cad2;_0x25ca54[_0xaeee('0x2b')]=_[_0xaeee('0x2c')](db[_0xaeee('0x47')][_0xaeee('0x28')]);_0x25ca54[_0xaeee('0x2f')]=_['keys'](_0x1fc6a3[_0xaeee('0x2f')]);_0x25ca54[_0xaeee('0x2d')]=_[_0xaeee('0x2e')](_0x25ca54[_0xaeee('0x2b')],_0x25ca54[_0xaeee('0x2f')]);_0x3ccd4a[_0xaeee('0x31')]=_[_0xaeee('0x2e')](_0x25ca54['model'],qs['fields'](_0x1fc6a3[_0xaeee('0x2f')]['fields']));_0x3ccd4a[_0xaeee('0x31')]=_0x3ccd4a['attributes'][_0xaeee('0x32')]?_0x3ccd4a[_0xaeee('0x31')]:_0x25ca54[_0xaeee('0x2b')];_0x3ccd4a[_0xaeee('0x48')]=qs[_0xaeee('0x35')](_0x1fc6a3[_0xaeee('0x2f')]['sort']);_0x3ccd4a[_0xaeee('0x36')]=qs[_0xaeee('0x2d')](_['pick'](_0x1fc6a3['query'],_0x25ca54['filters']));if(_0x1fc6a3['query']['filter']){_0x3ccd4a[_0xaeee('0x36')]=_[_0xaeee('0x38')](_0x3ccd4a[_0xaeee('0x36')],{'$or':_[_0xaeee('0x26')](_0x3ccd4a[_0xaeee('0x31')],function(_0x13b7f5){var _0x14ab13={};_0x14ab13[_0x13b7f5]={'$like':'%'+_0x1fc6a3['query'][_0xaeee('0x37')]+'%'};return _0x14ab13;})});}_0x3ccd4a=_[_0xaeee('0x38')]({},_0x3ccd4a,_0x1fc6a3[_0xaeee('0x41')]);return _0x3cfe8e[_0xaeee('0x45')](_0x3ccd4a);}})[_0xaeee('0x21')](function(_0x172453){if(_0x172453){_0x30649d=_0x172453[_0xaeee('0x32')];if(!_0x1fc6a3[_0xaeee('0x2f')][_0xaeee('0x33')]('nolimit')){_0x3ccd4a['limit']=qs[_0xaeee('0x1d')](_0x1fc6a3[_0xaeee('0x2f')][_0xaeee('0x1d')]);_0x3ccd4a[_0xaeee('0x1a')]=qs['offset'](_0x1fc6a3[_0xaeee('0x2f')]['offset']);}return _0x3cfe8e[_0xaeee('0x45')](_0x3ccd4a);}})[_0xaeee('0x21')](function(_0x4e93c4){if(_0x4e93c4){return _0x4e93c4?{'count':_0x30649d,'rows':_0x4e93c4}:null;}})[_0xaeee('0x21')](respondWithResult(_0x472e3e,null))['catch'](handleError(_0x472e3e,null));};exports['getSubjects']=function(_0x2fd37f,_0x37f9dd,_0x4eb46e){var _0x13d873={};var _0x148292={};var _0x393e75;var _0x45d222;return db['FreshdeskConfiguration'][_0xaeee('0x46')]({'where':{'id':_0x2fd37f[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x37f9dd,null))[_0xaeee('0x21')](function(_0x176cdf){if(_0x176cdf){_0x393e75=_0x176cdf;_0x148292['model']=_[_0xaeee('0x2c')](db[_0xaeee('0x47')][_0xaeee('0x28')]);_0x148292[_0xaeee('0x2f')]=_['keys'](_0x2fd37f[_0xaeee('0x2f')]);_0x148292[_0xaeee('0x2d')]=_['intersection'](_0x148292['model'],_0x148292[_0xaeee('0x2f')]);_0x13d873[_0xaeee('0x31')]=_[_0xaeee('0x2e')](_0x148292[_0xaeee('0x2b')],qs['fields'](_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x30')]));_0x13d873[_0xaeee('0x31')]=_0x13d873[_0xaeee('0x31')][_0xaeee('0x32')]?_0x13d873['attributes']:_0x148292[_0xaeee('0x2b')];_0x13d873[_0xaeee('0x48')]=qs[_0xaeee('0x35')](_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x35')]);_0x13d873[_0xaeee('0x36')]=qs[_0xaeee('0x2d')](_[_0xaeee('0x49')](_0x2fd37f[_0xaeee('0x2f')],_0x148292[_0xaeee('0x2d')]));if(_0x2fd37f[_0xaeee('0x2f')]['filter']){_0x13d873[_0xaeee('0x36')]=_['merge'](_0x13d873['where'],{'$or':_[_0xaeee('0x26')](_0x13d873[_0xaeee('0x31')],function(_0x19f344){var _0x576c07={};_0x576c07[_0x19f344]={'$like':'%'+_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x37')]+'%'};return _0x576c07;})});}_0x13d873=_['merge']({},_0x13d873,_0x2fd37f['options']);return _0x393e75['getSubjects'](_0x13d873);}})['then'](function(_0x3727dd){if(_0x3727dd){_0x45d222=_0x3727dd[_0xaeee('0x32')];if(!_0x2fd37f['query'][_0xaeee('0x33')](_0xaeee('0x34'))){_0x13d873['limit']=qs[_0xaeee('0x1d')](_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x1d')]);_0x13d873['offset']=qs[_0xaeee('0x1a')](_0x2fd37f[_0xaeee('0x2f')][_0xaeee('0x1a')]);}return _0x393e75[_0xaeee('0x4a')](_0x13d873);}})['then'](function(_0x20ce46){if(_0x20ce46){return _0x20ce46?{'count':_0x45d222,'rows':_0x20ce46}:null;}})[_0xaeee('0x21')](respondWithResult(_0x37f9dd,null))[_0xaeee('0x3c')](handleError(_0x37f9dd,null));};exports[_0xaeee('0x4b')]=function(_0x103c01,_0x298cad,_0x5de1d8){var _0x238780={};var _0x3c034f={};var _0x32fc53;var _0x24354c;return db[_0xaeee('0x27')][_0xaeee('0x46')]({'where':{'id':_0x103c01[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x298cad,null))[_0xaeee('0x21')](function(_0x573240){if(_0x573240){_0x32fc53=_0x573240;_0x3c034f[_0xaeee('0x2b')]=_[_0xaeee('0x2c')](db[_0xaeee('0x47')][_0xaeee('0x28')]);_0x3c034f['query']=_[_0xaeee('0x2c')](_0x103c01[_0xaeee('0x2f')]);_0x3c034f[_0xaeee('0x2d')]=_['intersection'](_0x3c034f[_0xaeee('0x2b')],_0x3c034f[_0xaeee('0x2f')]);_0x238780[_0xaeee('0x31')]=_['intersection'](_0x3c034f[_0xaeee('0x2b')],qs[_0xaeee('0x30')](_0x103c01[_0xaeee('0x2f')][_0xaeee('0x30')]));_0x238780['attributes']=_0x238780[_0xaeee('0x31')][_0xaeee('0x32')]?_0x238780[_0xaeee('0x31')]:_0x3c034f[_0xaeee('0x2b')];_0x238780['order']=qs[_0xaeee('0x35')](_0x103c01[_0xaeee('0x2f')][_0xaeee('0x35')]);_0x238780['where']=qs[_0xaeee('0x2d')](_[_0xaeee('0x49')](_0x103c01[_0xaeee('0x2f')],_0x3c034f[_0xaeee('0x2d')]));if(_0x103c01['query']['filter']){_0x238780['where']=_[_0xaeee('0x38')](_0x238780['where'],{'$or':_['map'](_0x238780['attributes'],function(_0x4c915b){var _0x277bc5={};_0x277bc5[_0x4c915b]={'$like':'%'+_0x103c01['query'][_0xaeee('0x37')]+'%'};return _0x277bc5;})});}_0x238780=_[_0xaeee('0x38')]({},_0x238780,_0x103c01[_0xaeee('0x41')]);return _0x32fc53[_0xaeee('0x4b')](_0x238780);}})[_0xaeee('0x21')](function(_0x228b00){if(_0x228b00){_0x24354c=_0x228b00[_0xaeee('0x32')];if(!_0x103c01['query'][_0xaeee('0x33')](_0xaeee('0x34'))){_0x238780['limit']=qs['limit'](_0x103c01[_0xaeee('0x2f')]['limit']);_0x238780[_0xaeee('0x1a')]=qs['offset'](_0x103c01[_0xaeee('0x2f')][_0xaeee('0x1a')]);}return _0x32fc53['getDescriptions'](_0x238780);}})['then'](function(_0x118f1a){if(_0x118f1a){return _0x118f1a?{'count':_0x24354c,'rows':_0x118f1a}:null;}})[_0xaeee('0x21')](respondWithResult(_0x298cad,null))[_0xaeee('0x3c')](handleError(_0x298cad,null));};exports[_0xaeee('0x4c')]=function(_0x334c30,_0x421087,_0x3bcae5){var _0x531083={};var _0x1e50a7={};var _0x3b2cb5;var _0x3a54bf;return db[_0xaeee('0x27')][_0xaeee('0x46')]({'where':{'id':_0x334c30[_0xaeee('0x3e')]['id']}})['then'](handleEntityNotFound(_0x421087,null))['then'](function(_0x2a6216){if(_0x2a6216){_0x3b2cb5=_0x2a6216;_0x1e50a7['model']=_[_0xaeee('0x2c')](db[_0xaeee('0x4d')][_0xaeee('0x28')]);_0x1e50a7[_0xaeee('0x2f')]=_['keys'](_0x334c30[_0xaeee('0x2f')]);_0x1e50a7[_0xaeee('0x2d')]=_[_0xaeee('0x2e')](_0x1e50a7['model'],_0x1e50a7[_0xaeee('0x2f')]);_0x531083[_0xaeee('0x31')]=_[_0xaeee('0x2e')](_0x1e50a7['model'],qs['fields'](_0x334c30[_0xaeee('0x2f')]['fields']));_0x531083[_0xaeee('0x31')]=_0x531083[_0xaeee('0x31')][_0xaeee('0x32')]?_0x531083[_0xaeee('0x31')]:_0x1e50a7[_0xaeee('0x2b')];_0x531083[_0xaeee('0x48')]=qs[_0xaeee('0x35')](_0x334c30[_0xaeee('0x2f')][_0xaeee('0x35')]);_0x531083[_0xaeee('0x36')]=qs['filters'](_['pick'](_0x334c30[_0xaeee('0x2f')],_0x1e50a7['filters']));if(_0x334c30[_0xaeee('0x2f')][_0xaeee('0x37')]){_0x531083['where']=_['merge'](_0x531083['where'],{'$or':_[_0xaeee('0x26')](_0x531083[_0xaeee('0x31')],function(_0x87c11e){var _0x2039f5={};_0x2039f5[_0x87c11e]={'$like':'%'+_0x334c30[_0xaeee('0x2f')][_0xaeee('0x37')]+'%'};return _0x2039f5;})});}_0x531083=_[_0xaeee('0x38')]({},_0x531083,_0x334c30[_0xaeee('0x41')]);return _0x3b2cb5[_0xaeee('0x4c')](_0x531083);}})[_0xaeee('0x21')](function(_0x4ad809){if(_0x4ad809){_0x3a54bf=_0x4ad809[_0xaeee('0x32')];if(!_0x334c30[_0xaeee('0x2f')][_0xaeee('0x33')](_0xaeee('0x34'))){_0x531083[_0xaeee('0x1d')]=qs[_0xaeee('0x1d')](_0x334c30[_0xaeee('0x2f')][_0xaeee('0x1d')]);_0x531083[_0xaeee('0x1a')]=qs['offset'](_0x334c30[_0xaeee('0x2f')][_0xaeee('0x1a')]);}return _0x3b2cb5[_0xaeee('0x4c')](_0x531083);}})[_0xaeee('0x21')](function(_0x505581){if(_0x505581){return _0x505581?{'count':_0x3a54bf,'rows':_0x505581}:null;}})['then'](respondWithResult(_0x421087,null))[_0xaeee('0x3c')](handleError(_0x421087,null));};exports[_0xaeee('0x4e')]=function(_0x38129e,_0x4f6961,_0x13daaf){if(_0x38129e[_0xaeee('0x43')]['id']){delete _0x38129e[_0xaeee('0x43')]['id'];}return db[_0xaeee('0x27')][_0xaeee('0x46')]({'where':{'id':_0x38129e[_0xaeee('0x3e')]['id']}})[_0xaeee('0x21')](handleEntityNotFound(_0x4f6961,null))[_0xaeee('0x21')](function(_0x49e0fb){if(_0x49e0fb){return _0x49e0fb[_0xaeee('0x4e')](_0x38129e[_0xaeee('0x43')][_0xaeee('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x4f6961,null))[_0xaeee('0x3c')](handleError(_0x4f6961,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 217244e..76c7e1d 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 _0xc80b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','int_freshdesk_configurations','lodash','util'];(function(_0x31e5ed,_0x2a74a1){var _0x41a124=function(_0x4953a9){while(--_0x4953a9){_0x31e5ed['push'](_0x31e5ed['shift']());}};_0x41a124(++_0x2a74a1);}(_0xc80b,0x102));var _0xbc80=function(_0x246feb,_0xae8b01){_0x246feb=_0x246feb-0x0;var _0x19394d=_0xc80b[_0x246feb];return _0x19394d;};'use strict';var _=require(_0xbc80('0x0'));var util=require(_0xbc80('0x1'));var logger=require(_0xbc80('0x2'))(_0xbc80('0x3'));var moment=require(_0xbc80('0x4'));var BPromise=require(_0xbc80('0x5'));var rp=require(_0xbc80('0x6'));var fs=require('fs');var path=require(_0xbc80('0x7'));var rimraf=require(_0xbc80('0x8'));var config=require(_0xbc80('0x9'));var attributes=require(_0xbc80('0xa'));module[_0xbc80('0xb')]=function(_0xa65377,_0x5604ab){return _0xa65377['define']('FreshdeskConfiguration',attributes,{'tableName':_0xbc80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcec=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0xdcec,0x1ec));var _0xcdce=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0xdcec[_0x4d2f00];return _0x2d7b7f;};'use strict';var _=require(_0xcdce('0x0'));var util=require(_0xcdce('0x1'));var logger=require(_0xcdce('0x2'))(_0xcdce('0x3'));var moment=require(_0xcdce('0x4'));var BPromise=require(_0xcdce('0x5'));var rp=require(_0xcdce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdce('0x7'));var config=require('../../config/environment');var attributes=require(_0xcdce('0x8'));module['exports']=function(_0x96aad2,_0x11c50f){return _0x96aad2[_0xcdce('0x9')](_0xcdce('0xa'),attributes,{'tableName':_0xcdce('0xb'),'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 30e2bc8..150f30e 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 _0x2c26=['client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c26,0x110));var _0x62c2=function(_0x17691d,_0x58c984){_0x17691d=_0x17691d-0x0;var _0x2759f7=_0x2c26[_0x17691d];return _0x2759f7;};'use strict';var _=require(_0x62c2('0x0'));var util=require(_0x62c2('0x1'));var moment=require(_0x62c2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62c2('0x3'))['db'];var utils=require(_0x62c2('0x4'));var logger=require(_0x62c2('0x5'))('rpc');var config=require(_0x62c2('0x6'));var jayson=require(_0x62c2('0x7'));var client=jayson[_0x62c2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa48f3f,_0x3b5ccf,_0x5de892){return new BPromise(function(_0x1e50cb,_0x3e0083){return client[_0x62c2('0x9')](_0xa48f3f,_0x5de892)[_0x62c2('0xa')](function(_0x2768ae){logger[_0x62c2('0xb')](_0x62c2('0xc'),_0x3b5ccf,_0x62c2('0xd'));logger[_0x62c2('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3b5ccf,_0x62c2('0xd'),JSON[_0x62c2('0xf')](_0x2768ae));if(_0x2768ae[_0x62c2('0x10')]){if(_0x2768ae['error'][_0x62c2('0x11')]===0x1f4){logger[_0x62c2('0x10')](_0x62c2('0xc'),_0x3b5ccf,_0x2768ae['error']['message']);return _0x3e0083(_0x2768ae[_0x62c2('0x10')][_0x62c2('0x12')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3b5ccf,_0x2768ae[_0x62c2('0x10')][_0x62c2('0x12')]);return _0x1e50cb(_0x2768ae[_0x62c2('0x10')][_0x62c2('0x12')]);}else{logger[_0x62c2('0xb')](_0x62c2('0xc'),_0x3b5ccf,_0x62c2('0xd'));_0x1e50cb(_0x2768ae[_0x62c2('0x13')][_0x62c2('0x12')]);}})['catch'](function(_0x520415){logger[_0x62c2('0x10')](_0x62c2('0xc'),_0x3b5ccf,_0x520415);_0x3e0083(_0x520415);});});} \ No newline at end of file +var _0xeb9e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xeb9e,0x104));var _0xeeb9=function(_0x4926ea,_0xadb10d){_0x4926ea=_0x4926ea-0x0;var _0x376182=_0xeb9e[_0x4926ea];return _0x376182;};'use strict';var _=require('lodash');var util=require(_0xeeb9('0x0'));var moment=require(_0xeeb9('0x1'));var BPromise=require(_0xeeb9('0x2'));var rs=require(_0xeeb9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeeb9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeeb9('0x5'))(_0xeeb9('0x6'));var config=require(_0xeeb9('0x7'));var jayson=require(_0xeeb9('0x8'));var client=jayson[_0xeeb9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ad0f0,_0x1f5bae,_0x5c2135){return new BPromise(function(_0x558155,_0x907322){return client[_0xeeb9('0xa')](_0x2ad0f0,_0x5c2135)['then'](function(_0x2ccbf8){logger[_0xeeb9('0xb')](_0xeeb9('0xc'),_0x1f5bae,_0xeeb9('0xd'));logger[_0xeeb9('0xe')](_0xeeb9('0xf'),_0x1f5bae,_0xeeb9('0xd'),JSON['stringify'](_0x2ccbf8));if(_0x2ccbf8['error']){if(_0x2ccbf8[_0xeeb9('0x10')][_0xeeb9('0x11')]===0x1f4){logger[_0xeeb9('0x10')](_0xeeb9('0xc'),_0x1f5bae,_0x2ccbf8[_0xeeb9('0x10')][_0xeeb9('0x12')]);return _0x907322(_0x2ccbf8[_0xeeb9('0x10')]['message']);}logger[_0xeeb9('0x10')](_0xeeb9('0xc'),_0x1f5bae,_0x2ccbf8[_0xeeb9('0x10')]['message']);return _0x558155(_0x2ccbf8[_0xeeb9('0x10')][_0xeeb9('0x12')]);}else{logger['info'](_0xeeb9('0xc'),_0x1f5bae,_0xeeb9('0xd'));_0x558155(_0x2ccbf8['result']['message']);}})[_0xeeb9('0x13')](function(_0x1ed62d){logger[_0xeeb9('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f5bae,_0x1ed62d);_0x907322(_0x1ed62d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 927e0e4..28a2294 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 _0x22e7=['put','/:id','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','show','post'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x22e7,0xf0));var _0x722e=function(_0x1b5612,_0xea6c89){_0x1b5612=_0x1b5612-0x0;var _0x535b16=_0x22e7[_0x1b5612];return _0x535b16;};'use strict';var multer=require('multer');var util=require(_0x722e('0x0'));var path=require('path');var timeout=require(_0x722e('0x1'));var express=require('express');var router=express[_0x722e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x722e('0x3'));var interaction=require(_0x722e('0x4'));var config=require(_0x722e('0x5'));var controller=require(_0x722e('0x6'));router['get']('/',auth[_0x722e('0x7')](),controller[_0x722e('0x8')]);router[_0x722e('0x9')]('/:id',auth[_0x722e('0x7')](),controller[_0x722e('0xa')]);router[_0x722e('0xb')]('/',auth[_0x722e('0x7')](),controller['create']);router[_0x722e('0xc')](_0x722e('0xd'),auth[_0x722e('0x7')](),controller[_0x722e('0xe')]);router[_0x722e('0xf')](_0x722e('0xd'),auth['isAuthenticated'](),controller[_0x722e('0x10')]);module[_0x722e('0x11')]=router; \ No newline at end of file +var _0xb98a=['isAuthenticated','/:id','show','create','put','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb98a,0x16e));var _0xab98=function(_0x4057ca,_0xbe5390){_0x4057ca=_0x4057ca-0x0;var _0x20f2ea=_0xb98a[_0x4057ca];return _0x20f2ea;};'use strict';var multer=require(_0xab98('0x0'));var util=require(_0xab98('0x1'));var path=require(_0xab98('0x2'));var timeout=require('connect-timeout');var express=require(_0xab98('0x3'));var router=express[_0xab98('0x4')]();var fs_extra=require(_0xab98('0x5'));var auth=require(_0xab98('0x6'));var interaction=require(_0xab98('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xab98('0x8')]('/',auth[_0xab98('0x9')](),controller['index']);router[_0xab98('0x8')](_0xab98('0xa'),auth['isAuthenticated'](),controller[_0xab98('0xb')]);router['post']('/',auth[_0xab98('0x9')](),controller[_0xab98('0xc')]);router[_0xab98('0xd')](_0xab98('0xa'),auth[_0xab98('0x9')](),controller[_0xab98('0xe')]);router['delete'](_0xab98('0xa'),auth[_0xab98('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 2d3b2c1..cf242e8 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 _0x937b=['exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x929c7e,_0x38c4cc){var _0x5de099=function(_0xc4e8d8){while(--_0xc4e8d8){_0x929c7e['push'](_0x929c7e['shift']());}};_0x5de099(++_0x38c4cc);}(_0x937b,0x95));var _0xb937=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x937b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb937('0x0'));module[_0xb937('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb937('0x2'),_0xb937('0x3'),_0xb937('0x4'),_0xb937('0x5'),_0xb937('0x6')),'defaultValue':_0xb937('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb937('0x7')]},'keyType':{'type':Sequelize[_0xb937('0x8')]('string',_0xb937('0x3'),_0xb937('0x4'))},'keyContent':{'type':Sequelize[_0xb937('0x7')]},'idField':{'type':Sequelize[_0xb937('0x7')]},'nameField':{'type':Sequelize[_0xb937('0x7')]},'customField':{'type':Sequelize[_0xb937('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb937('0x7')]}}; \ No newline at end of file +var _0xae72=['string','exports','ENUM','variable','customVariable','picklist','STRING'];(function(_0x265bd8,_0x507dde){var _0x1d3285=function(_0x5a9035){while(--_0x5a9035){_0x265bd8['push'](_0x265bd8['shift']());}};_0x1d3285(++_0x507dde);}(_0xae72,0x86));var _0x2ae7=function(_0x56e5a4,_0x3378ff){_0x56e5a4=_0x56e5a4-0x0;var _0x446855=_0xae72[_0x56e5a4];return _0x446855;};'use strict';var Sequelize=require('sequelize');module[_0x2ae7('0x0')]={'type':{'type':Sequelize[_0x2ae7('0x1')]('string',_0x2ae7('0x2'),_0x2ae7('0x3'),'keyValue',_0x2ae7('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2ae7('0x5')]},'key':{'type':Sequelize[_0x2ae7('0x5')]},'keyType':{'type':Sequelize[_0x2ae7('0x1')](_0x2ae7('0x6'),_0x2ae7('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x2ae7('0x5')]},'idField':{'type':Sequelize[_0x2ae7('0x5')]},'nameField':{'type':Sequelize[_0x2ae7('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ae7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 5cecc26..d59e708 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 _0xaf80=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','includeAll','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x47f8d2,_0x259040){var _0x5b31bb=function(_0x592145){while(--_0x592145){_0x47f8d2['push'](_0x47f8d2['shift']());}};_0x5b31bb(++_0x259040);}(_0xaf80,0x1ef));var _0x0af8=function(_0x272426,_0x5acc73){_0x272426=_0x272426-0x0;var _0x2e2fd7=_0xaf80[_0x272426];return _0x2e2fd7;};'use strict';var emlformat=require(_0x0af8('0x0'));var rimraf=require(_0x0af8('0x1'));var zipdir=require(_0x0af8('0x2'));var jsonpatch=require(_0x0af8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0af8('0x4'));var util=require(_0x0af8('0x5'));var path=require(_0x0af8('0x6'));var sox=require(_0x0af8('0x7'));var csv=require(_0x0af8('0x8'));var ejs=require(_0x0af8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0af8('0xa'));var crypto=require('crypto');var jsforce=require(_0x0af8('0xb'));var deskjs=require(_0x0af8('0xc'));var toCsv=require(_0x0af8('0x8'));var querystring=require('querystring');var Papa=require(_0x0af8('0xd'));var Redis=require(_0x0af8('0xe'));var authService=require(_0x0af8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0af8('0x10'));var logger=require(_0x0af8('0x11'))(_0x0af8('0x12'));var utils=require(_0x0af8('0x13'));var config=require(_0x0af8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0af8('0x15'))['db'];function respondWithStatusCode(_0x2d5892,_0x465135){_0x465135=_0x465135||0xcc;return function(_0x31d390){if(_0x31d390){return _0x2d5892[_0x0af8('0x16')](_0x465135);}return _0x2d5892[_0x0af8('0x17')](_0x465135)[_0x0af8('0x18')]();};}function respondWithResult(_0x58a9a8,_0x58ef18){_0x58ef18=_0x58ef18||0xc8;return function(_0x420432){if(_0x420432){return _0x58a9a8[_0x0af8('0x17')](_0x58ef18)[_0x0af8('0x19')](_0x420432);}};}function respondWithFilteredResult(_0x216f0b,_0x2a42a4){return function(_0x1997b8){if(_0x1997b8){var _0x4755cb=typeof _0x2a42a4[_0x0af8('0x1a')]==='undefined'&&typeof _0x2a42a4['limit']==='undefined';var _0x3294ce=_0x1997b8[_0x0af8('0x1b')];var _0x54e946=_0x4755cb?0x0:_0x2a42a4[_0x0af8('0x1a')];var _0x230a68=_0x4755cb?_0x1997b8[_0x0af8('0x1b')]:_0x2a42a4['offset']+_0x2a42a4['limit'];var _0x50b8fa;if(_0x230a68>=_0x3294ce){_0x230a68=_0x3294ce;_0x50b8fa=0xc8;}else{_0x50b8fa=0xce;}_0x216f0b[_0x0af8('0x17')](_0x50b8fa);return _0x216f0b[_0x0af8('0x1c')]('Content-Range',_0x54e946+'-'+_0x230a68+'/'+_0x3294ce)[_0x0af8('0x19')](_0x1997b8);}return null;};}function patchUpdates(_0x4891e6){return function(_0x5cbf28){try{jsonpatch[_0x0af8('0x1d')](_0x5cbf28,_0x4891e6,!![]);}catch(_0x2e0b36){return BPromise[_0x0af8('0x1e')](_0x2e0b36);}return _0x5cbf28[_0x0af8('0x1f')]();};}function saveUpdates(_0x162e95,_0x52778f){return function(_0x592523){if(_0x592523){return _0x592523[_0x0af8('0x20')](_0x162e95)[_0x0af8('0x21')](function(_0x4b0492){return _0x4b0492;});}return null;};}function removeEntity(_0x300474,_0x320d0c){return function(_0x404b25){if(_0x404b25){return _0x404b25[_0x0af8('0x22')]()[_0x0af8('0x21')](function(){_0x300474['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c6306,_0x3b2a80){return function(_0x359583){if(!_0x359583){_0x1c6306[_0x0af8('0x16')](0x194);}return _0x359583;};}function handleError(_0x510efc,_0x500fd5){_0x500fd5=_0x500fd5||0x1f4;return function(_0x315ad){logger[_0x0af8('0x23')](_0x315ad[_0x0af8('0x24')]);if(_0x315ad[_0x0af8('0x25')]){delete _0x315ad[_0x0af8('0x25')];}_0x510efc[_0x0af8('0x17')](_0x500fd5)[_0x0af8('0x26')](_0x315ad);};}exports['index']=function(_0x34aa8b,_0xf898cc){var _0x1a7fdf={},_0x20eab4={},_0x1b94cf={'count':0x0,'rows':[]};var _0x231230=_[_0x0af8('0x27')](db[_0x0af8('0x28')][_0x0af8('0x29')],function(_0x270b49){return{'name':_0x270b49[_0x0af8('0x2a')],'type':_0x270b49['type'][_0x0af8('0x2b')]};});_0x20eab4['model']=_[_0x0af8('0x27')](_0x231230,'name');_0x20eab4[_0x0af8('0x2c')]=_[_0x0af8('0x2d')](_0x34aa8b['query']);_0x20eab4[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],_0x20eab4['query']);_0x1a7fdf[_0x0af8('0x31')]=_[_0x0af8('0x2f')](_0x20eab4[_0x0af8('0x30')],qs['fields'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x32')]));_0x1a7fdf[_0x0af8('0x31')]=_0x1a7fdf[_0x0af8('0x31')][_0x0af8('0x33')]?_0x1a7fdf[_0x0af8('0x31')]:_0x20eab4['model'];if(!_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x34')](_0x0af8('0x35'))){_0x1a7fdf[_0x0af8('0x36')]=qs[_0x0af8('0x36')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x36')]);_0x1a7fdf[_0x0af8('0x1a')]=qs[_0x0af8('0x1a')](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x1a')]);}_0x1a7fdf[_0x0af8('0x37')]=qs['sort'](_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x38')]);_0x1a7fdf[_0x0af8('0x39')]=qs[_0x0af8('0x2e')](_[_0x0af8('0x3a')](_0x34aa8b[_0x0af8('0x2c')],_0x20eab4[_0x0af8('0x2e')]),_0x231230);if(_0x34aa8b['query'][_0x0af8('0x3b')]){_0x1a7fdf[_0x0af8('0x39')]=_[_0x0af8('0x3c')](_0x1a7fdf['where'],{'$or':_[_0x0af8('0x27')](_0x231230,function(_0x1082de){if(_0x1082de[_0x0af8('0x3d')]!=='VIRTUAL'){var _0x6781fe={};_0x6781fe[_0x1082de[_0x0af8('0x25')]]={'$like':'%'+_0x34aa8b[_0x0af8('0x2c')][_0x0af8('0x3b')]+'%'};return _0x6781fe;}})});}_0x1a7fdf=_[_0x0af8('0x3c')]({},_0x1a7fdf,_0x34aa8b[_0x0af8('0x3e')]);var _0x258872={'where':_0x1a7fdf['where']};return db['FreshdeskField'][_0x0af8('0x1b')](_0x258872)[_0x0af8('0x21')](function(_0x5bc8f5){_0x1b94cf[_0x0af8('0x1b')]=_0x5bc8f5;if(_0x34aa8b[_0x0af8('0x2c')]['includeAll']){_0x1a7fdf[_0x0af8('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0x0af8('0x40')](_0x1a7fdf);})[_0x0af8('0x21')](function(_0x510bec){_0x1b94cf[_0x0af8('0x41')]=_0x510bec;return _0x1b94cf;})[_0x0af8('0x21')](respondWithFilteredResult(_0xf898cc,_0x1a7fdf))['catch'](handleError(_0xf898cc,null));};exports[_0x0af8('0x42')]=function(_0x496ea4,_0x2e15ec){var _0x423eee={'raw':!![],'where':{'id':_0x496ea4['params']['id']}},_0x141d2f={};_0x141d2f['model']=_[_0x0af8('0x2d')](db[_0x0af8('0x28')][_0x0af8('0x29')]);_0x141d2f[_0x0af8('0x2c')]=_['keys'](_0x496ea4[_0x0af8('0x2c')]);_0x141d2f[_0x0af8('0x2e')]=_[_0x0af8('0x2f')](_0x141d2f['model'],_0x141d2f[_0x0af8('0x2c')]);_0x423eee[_0x0af8('0x31')]=_['intersection'](_0x141d2f[_0x0af8('0x30')],qs['fields'](_0x496ea4[_0x0af8('0x2c')]['fields']));_0x423eee['attributes']=_0x423eee['attributes'][_0x0af8('0x33')]?_0x423eee['attributes']:_0x141d2f[_0x0af8('0x30')];if(_0x496ea4['query'][_0x0af8('0x43')]){_0x423eee[_0x0af8('0x3f')]=[{'all':!![]}];}_0x423eee=_[_0x0af8('0x3c')]({},_0x423eee,_0x496ea4[_0x0af8('0x3e')]);return db[_0x0af8('0x28')]['find'](_0x423eee)['then'](handleEntityNotFound(_0x2e15ec,null))[_0x0af8('0x21')](respondWithResult(_0x2e15ec,null))[_0x0af8('0x44')](handleError(_0x2e15ec,null));};exports[_0x0af8('0x45')]=function(_0x24a104,_0x3d86e2){return db[_0x0af8('0x28')][_0x0af8('0x45')](_0x24a104['body'],{})['then'](respondWithResult(_0x3d86e2,0xc9))[_0x0af8('0x44')](handleError(_0x3d86e2,null));};exports[_0x0af8('0x20')]=function(_0x394525,_0x3c57dd){if(_0x394525['body']['id']){delete _0x394525[_0x0af8('0x46')]['id'];}return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x394525[_0x0af8('0x48')]['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0x3c57dd,null))[_0x0af8('0x21')](saveUpdates(_0x394525['body'],null))[_0x0af8('0x21')](respondWithResult(_0x3c57dd,null))['catch'](handleError(_0x3c57dd,null));};exports[_0x0af8('0x22')]=function(_0x4a43e3,_0xeddce9){return db[_0x0af8('0x28')][_0x0af8('0x47')]({'where':{'id':_0x4a43e3['params']['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0xeddce9,null))[_0x0af8('0x21')](removeEntity(_0xeddce9,null))['catch'](handleError(_0xeddce9,null));}; \ No newline at end of file +var _0x073e=['length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','keys','query','filters','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection'];(function(_0x3b71f5,_0x1d9b83){var _0xb0338f=function(_0x42da9b){while(--_0x42da9b){_0x3b71f5['push'](_0x3b71f5['shift']());}};_0xb0338f(++_0x1d9b83);}(_0x073e,0x181));var _0xe073=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0x073e[_0x4ac48d];return _0x7537af;};'use strict';var emlformat=require(_0xe073('0x0'));var rimraf=require(_0xe073('0x1'));var zipdir=require(_0xe073('0x2'));var jsonpatch=require(_0xe073('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe073('0x4'));var util=require(_0xe073('0x5'));var path=require(_0xe073('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe073('0x7'));var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe073('0x17'))['db'];function respondWithStatusCode(_0x56e3f5,_0x3dedf7){_0x3dedf7=_0x3dedf7||0xcc;return function(_0x5d2f2f){if(_0x5d2f2f){return _0x56e3f5[_0xe073('0x18')](_0x3dedf7);}return _0x56e3f5['status'](_0x3dedf7)[_0xe073('0x19')]();};}function respondWithResult(_0x27d34,_0x47828d){_0x47828d=_0x47828d||0xc8;return function(_0x2ce92d){if(_0x2ce92d){return _0x27d34[_0xe073('0x1a')](_0x47828d)[_0xe073('0x1b')](_0x2ce92d);}};}function respondWithFilteredResult(_0x2f4b36,_0xfb28f5){return function(_0x208f2e){if(_0x208f2e){var _0x26f3d3=typeof _0xfb28f5[_0xe073('0x1c')]==='undefined'&&typeof _0xfb28f5['limit']==='undefined';var _0x4c578c=_0x208f2e[_0xe073('0x1d')];var _0x10486c=_0x26f3d3?0x0:_0xfb28f5[_0xe073('0x1c')];var _0x4f9c8e=_0x26f3d3?_0x208f2e[_0xe073('0x1d')]:_0xfb28f5[_0xe073('0x1c')]+_0xfb28f5[_0xe073('0x1e')];var _0x54c10e;if(_0x4f9c8e>=_0x4c578c){_0x4f9c8e=_0x4c578c;_0x54c10e=0xc8;}else{_0x54c10e=0xce;}_0x2f4b36[_0xe073('0x1a')](_0x54c10e);return _0x2f4b36[_0xe073('0x1f')](_0xe073('0x20'),_0x10486c+'-'+_0x4f9c8e+'/'+_0x4c578c)[_0xe073('0x1b')](_0x208f2e);}return null;};}function patchUpdates(_0x43668e){return function(_0x17dd4b){try{jsonpatch[_0xe073('0x21')](_0x17dd4b,_0x43668e,!![]);}catch(_0x1d7a13){return BPromise[_0xe073('0x22')](_0x1d7a13);}return _0x17dd4b[_0xe073('0x23')]();};}function saveUpdates(_0x5143fa,_0x4405fd){return function(_0x21f9c2){if(_0x21f9c2){return _0x21f9c2[_0xe073('0x24')](_0x5143fa)[_0xe073('0x25')](function(_0x39bcb4){return _0x39bcb4;});}return null;};}function removeEntity(_0x275aa8,_0x504c26){return function(_0x4c76ef){if(_0x4c76ef){return _0x4c76ef[_0xe073('0x26')]()['then'](function(){_0x275aa8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c4137,_0x54a38b){return function(_0x50795f){if(!_0x50795f){_0x5c4137[_0xe073('0x18')](0x194);}return _0x50795f;};}function handleError(_0xff003,_0x5bd226){_0x5bd226=_0x5bd226||0x1f4;return function(_0x1fca27){logger[_0xe073('0x27')](_0x1fca27[_0xe073('0x28')]);if(_0x1fca27['name']){delete _0x1fca27[_0xe073('0x29')];}_0xff003['status'](_0x5bd226)[_0xe073('0x2a')](_0x1fca27);};}exports[_0xe073('0x2b')]=function(_0x599972,_0x5dfff9){var _0x15adbb={},_0x859ed8={},_0x278fbb={'count':0x0,'rows':[]};var _0x2f1cd2=_[_0xe073('0x2c')](db[_0xe073('0x2d')][_0xe073('0x2e')],function(_0x2a206a){return{'name':_0x2a206a['fieldName'],'type':_0x2a206a[_0xe073('0x2f')][_0xe073('0x30')]};});_0x859ed8['model']=_['map'](_0x2f1cd2,_0xe073('0x29'));_0x859ed8['query']=_[_0xe073('0x31')](_0x599972[_0xe073('0x32')]);_0x859ed8[_0xe073('0x33')]=_['intersection'](_0x859ed8['model'],_0x859ed8[_0xe073('0x32')]);_0x15adbb[_0xe073('0x34')]=_['intersection'](_0x859ed8[_0xe073('0x35')],qs[_0xe073('0x36')](_0x599972[_0xe073('0x32')]['fields']));_0x15adbb[_0xe073('0x34')]=_0x15adbb['attributes']['length']?_0x15adbb[_0xe073('0x34')]:_0x859ed8[_0xe073('0x35')];if(!_0x599972[_0xe073('0x32')]['hasOwnProperty'](_0xe073('0x37'))){_0x15adbb[_0xe073('0x1e')]=qs[_0xe073('0x1e')](_0x599972['query'][_0xe073('0x1e')]);_0x15adbb[_0xe073('0x1c')]=qs[_0xe073('0x1c')](_0x599972[_0xe073('0x32')][_0xe073('0x1c')]);}_0x15adbb[_0xe073('0x38')]=qs['sort'](_0x599972[_0xe073('0x32')][_0xe073('0x39')]);_0x15adbb[_0xe073('0x3a')]=qs['filters'](_[_0xe073('0x3b')](_0x599972[_0xe073('0x32')],_0x859ed8[_0xe073('0x33')]),_0x2f1cd2);if(_0x599972[_0xe073('0x32')][_0xe073('0x3c')]){_0x15adbb['where']=_[_0xe073('0x3d')](_0x15adbb['where'],{'$or':_[_0xe073('0x2c')](_0x2f1cd2,function(_0x22d278){if(_0x22d278[_0xe073('0x2f')]!==_0xe073('0x3e')){var _0x40f991={};_0x40f991[_0x22d278[_0xe073('0x29')]]={'$like':'%'+_0x599972[_0xe073('0x32')][_0xe073('0x3c')]+'%'};return _0x40f991;}})});}_0x15adbb=_[_0xe073('0x3d')]({},_0x15adbb,_0x599972[_0xe073('0x3f')]);var _0x12976c={'where':_0x15adbb[_0xe073('0x3a')]};return db[_0xe073('0x2d')]['count'](_0x12976c)[_0xe073('0x25')](function(_0x577c87){_0x278fbb[_0xe073('0x1d')]=_0x577c87;if(_0x599972[_0xe073('0x32')][_0xe073('0x40')]){_0x15adbb[_0xe073('0x41')]=[{'all':!![]}];}return db['FreshdeskField'][_0xe073('0x42')](_0x15adbb);})[_0xe073('0x25')](function(_0x93852a){_0x278fbb[_0xe073('0x43')]=_0x93852a;return _0x278fbb;})[_0xe073('0x25')](respondWithFilteredResult(_0x5dfff9,_0x15adbb))['catch'](handleError(_0x5dfff9,null));};exports[_0xe073('0x44')]=function(_0x4b2a82,_0x764196){var _0x2a8c57={'raw':!![],'where':{'id':_0x4b2a82[_0xe073('0x45')]['id']}},_0x125d1f={};_0x125d1f[_0xe073('0x35')]=_[_0xe073('0x31')](db[_0xe073('0x2d')][_0xe073('0x2e')]);_0x125d1f[_0xe073('0x32')]=_[_0xe073('0x31')](_0x4b2a82[_0xe073('0x32')]);_0x125d1f['filters']=_['intersection'](_0x125d1f[_0xe073('0x35')],_0x125d1f[_0xe073('0x32')]);_0x2a8c57[_0xe073('0x34')]=_[_0xe073('0x46')](_0x125d1f[_0xe073('0x35')],qs['fields'](_0x4b2a82[_0xe073('0x32')][_0xe073('0x36')]));_0x2a8c57[_0xe073('0x34')]=_0x2a8c57[_0xe073('0x34')][_0xe073('0x47')]?_0x2a8c57['attributes']:_0x125d1f[_0xe073('0x35')];if(_0x4b2a82['query']['includeAll']){_0x2a8c57[_0xe073('0x41')]=[{'all':!![]}];}_0x2a8c57=_[_0xe073('0x3d')]({},_0x2a8c57,_0x4b2a82['options']);return db['FreshdeskField'][_0xe073('0x48')](_0x2a8c57)[_0xe073('0x25')](handleEntityNotFound(_0x764196,null))[_0xe073('0x25')](respondWithResult(_0x764196,null))[_0xe073('0x49')](handleError(_0x764196,null));};exports[_0xe073('0x4a')]=function(_0x1eec23,_0x317159){return db['FreshdeskField'][_0xe073('0x4a')](_0x1eec23['body'],{})[_0xe073('0x25')](respondWithResult(_0x317159,0xc9))[_0xe073('0x49')](handleError(_0x317159,null));};exports[_0xe073('0x24')]=function(_0x4e1f1d,_0x4d5bcd){if(_0x4e1f1d[_0xe073('0x4b')]['id']){delete _0x4e1f1d[_0xe073('0x4b')]['id'];}return db[_0xe073('0x2d')]['find']({'where':{'id':_0x4e1f1d[_0xe073('0x45')]['id']}})[_0xe073('0x25')](handleEntityNotFound(_0x4d5bcd,null))[_0xe073('0x25')](saveUpdates(_0x4e1f1d[_0xe073('0x4b')],null))[_0xe073('0x25')](respondWithResult(_0x4d5bcd,null))[_0xe073('0x49')](handleError(_0x4d5bcd,null));};exports[_0xe073('0x26')]=function(_0x307541,_0x3238eb){return db['FreshdeskField'][_0xe073('0x48')]({'where':{'id':_0x307541['params']['id']}})[_0xe073('0x25')](handleEntityNotFound(_0x3238eb,null))['then'](removeEntity(_0x3238eb,null))[_0xe073('0x49')](handleError(_0x3238eb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a004f11..ffd913c 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 _0x2b44=['request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x705cc,_0x18490f){var _0x20b57a=function(_0x8dea8a){while(--_0x8dea8a){_0x705cc['push'](_0x705cc['shift']());}};_0x20b57a(++_0x18490f);}(_0x2b44,0x1d7));var _0x42b4=function(_0x4ed4e5,_0x421850){_0x4ed4e5=_0x4ed4e5-0x0;var _0x27f136=_0x2b44[_0x4ed4e5];return _0x27f136;};'use strict';var _=require(_0x42b4('0x0'));var util=require('util');var logger=require(_0x42b4('0x1'))(_0x42b4('0x2'));var moment=require(_0x42b4('0x3'));var BPromise=require(_0x42b4('0x4'));var rp=require(_0x42b4('0x5'));var fs=require('fs');var path=require(_0x42b4('0x6'));var rimraf=require(_0x42b4('0x7'));var config=require(_0x42b4('0x8'));var attributes=require(_0x42b4('0x9'));module[_0x42b4('0xa')]=function(_0x4e31d7,_0x28a60a){return _0x4e31d7[_0x42b4('0xb')](_0x42b4('0xc'),attributes,{'tableName':_0x42b4('0xd'),'paranoid':![],'indexes':[{'name':_0x42b4('0xe'),'fields':[_0x42b4('0xf'),_0x42b4('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41eb=['define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports'];(function(_0x73b6d,_0x2f9cc4){var _0xff3881=function(_0x23fc4d){while(--_0x23fc4d){_0x73b6d['push'](_0x73b6d['shift']());}};_0xff3881(++_0x2f9cc4);}(_0x41eb,0x7d));var _0xb41e=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x41eb[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0xb41e('0x0'));var util=require('util');var logger=require(_0xb41e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb41e('0x2'));var rp=require(_0xb41e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb41e('0x4'));var config=require('../../config/environment');var attributes=require(_0xb41e('0x5'));module[_0xb41e('0x6')]=function(_0x4d9f39,_0x1bcb46){return _0x4d9f39[_0xb41e('0x7')](_0xb41e('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xb41e('0x9'),'fields':[_0xb41e('0xa'),_0xb41e('0xb')],'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 4a70d98..368c577 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 _0x3507=['info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x5eafca,_0x5008e2){var _0x2b4fa0=function(_0x272b39){while(--_0x272b39){_0x5eafca['push'](_0x5eafca['shift']());}};_0x2b4fa0(++_0x5008e2);}(_0x3507,0xed));var _0x7350=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x3507[_0x4b1032];return _0x5a1d55;};'use strict';var _=require(_0x7350('0x0'));var util=require(_0x7350('0x1'));var moment=require('moment');var BPromise=require(_0x7350('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7350('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7350('0x4'))(_0x7350('0x5'));var config=require(_0x7350('0x6'));var jayson=require(_0x7350('0x7'));var client=jayson[_0x7350('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x539504,_0x2719dc,_0x59462e){return new BPromise(function(_0x2f2981,_0x247a17){return client['request'](_0x539504,_0x59462e)[_0x7350('0x9')](function(_0x2b55ca){logger[_0x7350('0xa')](_0x7350('0xb'),_0x2719dc,_0x7350('0xc'));logger[_0x7350('0xd')](_0x7350('0xe'),_0x2719dc,_0x7350('0xc'),JSON[_0x7350('0xf')](_0x2b55ca));if(_0x2b55ca['error']){if(_0x2b55ca[_0x7350('0x10')]['code']===0x1f4){logger[_0x7350('0x10')](_0x7350('0xb'),_0x2719dc,_0x2b55ca[_0x7350('0x10')][_0x7350('0x11')]);return _0x247a17(_0x2b55ca[_0x7350('0x10')][_0x7350('0x11')]);}logger[_0x7350('0x10')](_0x7350('0xb'),_0x2719dc,_0x2b55ca[_0x7350('0x10')][_0x7350('0x11')]);return _0x2f2981(_0x2b55ca[_0x7350('0x10')]['message']);}else{logger[_0x7350('0xa')](_0x7350('0xb'),_0x2719dc,'request\x20sent');_0x2f2981(_0x2b55ca['result'][_0x7350('0x11')]);}})[_0x7350('0x12')](function(_0x26ded3){logger[_0x7350('0x10')](_0x7350('0xb'),_0x2719dc,_0x26ded3);_0x247a17(_0x26ded3);});});} \ No newline at end of file +var _0xda1c=['debug','stringify','error','message','info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda1c,0x1b7));var _0xcda1=function(_0x53b97c,_0x38e649){_0x53b97c=_0x53b97c-0x0;var _0x49ad3d=_0xda1c[_0x53b97c];return _0x49ad3d;};'use strict';var _=require(_0xcda1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcda1('0x1'));var fs=require('fs');var Redis=require(_0xcda1('0x2'));var db=require(_0xcda1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcda1('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcda1('0x5')][_0xcda1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x6d6030,_0x49d967,_0x3ffb97){return new BPromise(function(_0x5aecc7,_0x2c1da5){return client[_0xcda1('0x7')](_0x6d6030,_0x3ffb97)[_0xcda1('0x8')](function(_0x626a4a){logger['info'](_0xcda1('0x9'),_0x49d967,_0xcda1('0xa'));logger[_0xcda1('0xb')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x49d967,_0xcda1('0xa'),JSON[_0xcda1('0xc')](_0x626a4a));if(_0x626a4a[_0xcda1('0xd')]){if(_0x626a4a[_0xcda1('0xd')]['code']===0x1f4){logger[_0xcda1('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x49d967,_0x626a4a[_0xcda1('0xd')][_0xcda1('0xe')]);return _0x2c1da5(_0x626a4a[_0xcda1('0xd')][_0xcda1('0xe')]);}logger['error'](_0xcda1('0x9'),_0x49d967,_0x626a4a[_0xcda1('0xd')][_0xcda1('0xe')]);return _0x5aecc7(_0x626a4a[_0xcda1('0xd')][_0xcda1('0xe')]);}else{logger[_0xcda1('0xf')](_0xcda1('0x9'),_0x49d967,'request\x20sent');_0x5aecc7(_0x626a4a[_0xcda1('0x10')][_0xcda1('0xe')]);}})[_0xcda1('0x11')](function(_0x2c87af){logger[_0xcda1('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x49d967,_0x2c87af);_0x2c1da5(_0x2c87af);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d69af50..157f056 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 _0x750a=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','create','put','delete','destroy','exports'];(function(_0x5b8a39,_0x18eb9c){var _0x12394d=function(_0x1f646a){while(--_0x1f646a){_0x5b8a39['push'](_0x5b8a39['shift']());}};_0x12394d(++_0x18eb9c);}(_0x750a,0x140));var _0xa750=function(_0x156fc1,_0x3c46d7){_0x156fc1=_0x156fc1-0x0;var _0x20df03=_0x750a[_0x156fc1];return _0x20df03;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/fields',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa750('0xf')]);router['post'](_0xa750('0xc'),auth[_0xa750('0x9')](),controller['addConfiguration']);router[_0xa750('0x10')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['update']);router[_0xa750('0x11')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);module[_0xa750('0x13')]=router; \ No newline at end of file +var _0x1be1=['getFields','post','create','addConfiguration','/:id','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0x49f7c3,_0x339f8c){var _0x147697=function(_0x2559bc){while(--_0x2559bc){_0x49f7c3['push'](_0x49f7c3['shift']());}};_0x147697(++_0x339f8c);}(_0x1be1,0x192));var _0x11be=function(_0x440cbb,_0x3b70d9){_0x440cbb=_0x440cbb-0x0;var _0x451748=_0x1be1[_0x440cbb];return _0x451748;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['getConfigurations']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);router['post'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xf')]);router['put'](_0x11be('0x10'),auth[_0x11be('0x8')](),controller['update']);router[_0x11be('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d5b01d5..e1019c4 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 _0x6a95=['exports','STRING','username','sequelize'];(function(_0x3d7fa1,_0x340c0e){var _0x4f5e46=function(_0x587608){while(--_0x587608){_0x3d7fa1['push'](_0x3d7fa1['shift']());}};_0x4f5e46(++_0x340c0e);}(_0x6a95,0x1db));var _0x56a9=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6a95[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xeb3b=['sequelize','exports','STRING'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xeb3b[_0x1ebce2];return _0x4a330c;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')]},'description':{'type':Sequelize[_0xbeb3('0x2')]},'username':{'type':Sequelize[_0xbeb3('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbeb3('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 5a50d50..736ee1c 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 _0xa15d=['to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','set','json','apply','save','update','then','error','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','findOne','FreshsalesConfiguration','sort','pick','options','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox'];(function(_0x267484,_0x3eb131){var _0x14a356=function(_0x54703b){while(--_0x54703b){_0x267484['push'](_0x267484['shift']());}};_0x14a356(++_0x3eb131);}(_0xa15d,0x131));var _0xda15=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0xa15d[_0x1f7413];return _0x2d2775;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda15('0x0'));var zipdir=require(_0xda15('0x1'));var jsonpatch=require(_0xda15('0x2'));var rp=require(_0xda15('0x3'));var moment=require('moment');var BPromise=require(_0xda15('0x4'));var Mustache=require('mustache');var util=require(_0xda15('0x5'));var path=require('path');var sox=require(_0xda15('0x6'));var csv=require(_0xda15('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda15('0x8'));var _=require('lodash');var squel=require(_0xda15('0x9'));var crypto=require(_0xda15('0xa'));var jsforce=require(_0xda15('0xb'));var deskjs=require(_0xda15('0xc'));var toCsv=require(_0xda15('0x7'));var querystring=require(_0xda15('0xd'));var Papa=require(_0xda15('0xe'));var Redis=require(_0xda15('0xf'));var authService=require(_0xda15('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xda15('0x11'));var hardwareService=require(_0xda15('0x12'));var logger=require(_0xda15('0x13'))('api');var utils=require(_0xda15('0x14'));var config=require(_0xda15('0x15'));var licenseUtil=require(_0xda15('0x16'));var db=require(_0xda15('0x17'))['db'];var integrations=require(_0xda15('0x18'));function respondWithStatusCode(_0x28e4f8,_0x2a53b3){_0x2a53b3=_0x2a53b3||0xcc;return function(_0x5dbbb9){if(_0x5dbbb9){return _0x28e4f8[_0xda15('0x19')](_0x2a53b3);}return _0x28e4f8[_0xda15('0x1a')](_0x2a53b3)[_0xda15('0x1b')]();};}function respondWithResult(_0x9f424c,_0x3ace82){_0x3ace82=_0x3ace82||0xc8;return function(_0x1deeba){if(_0x1deeba){return _0x9f424c[_0xda15('0x1a')](_0x3ace82)['json'](_0x1deeba);}};}function respondWithFilteredResult(_0x47b7d1,_0x47b4da){return function(_0x35fcef){if(_0x35fcef){var _0x879f20=typeof _0x47b4da[_0xda15('0x1c')]==='undefined'&&typeof _0x47b4da[_0xda15('0x1d')]===_0xda15('0x1e');var _0x10dd4c=_0x35fcef['count'];var _0x223e96=_0x879f20?0x0:_0x47b4da[_0xda15('0x1c')];var _0x49b1b7=_0x879f20?_0x35fcef['count']:_0x47b4da[_0xda15('0x1c')]+_0x47b4da['limit'];var _0x3fad35;if(_0x49b1b7>=_0x10dd4c){_0x49b1b7=_0x10dd4c;_0x3fad35=0xc8;}else{_0x3fad35=0xce;}_0x47b7d1['status'](_0x3fad35);return _0x47b7d1[_0xda15('0x1f')]('Content-Range',_0x223e96+'-'+_0x49b1b7+'/'+_0x10dd4c)[_0xda15('0x20')](_0x35fcef);}return null;};}function patchUpdates(_0x5f2062){return function(_0x29d735){try{jsonpatch[_0xda15('0x21')](_0x29d735,_0x5f2062,!![]);}catch(_0x426ac6){return BPromise['reject'](_0x426ac6);}return _0x29d735[_0xda15('0x22')]();};}function saveUpdates(_0x30c208,_0x1b8472){return function(_0x18ea87){if(_0x18ea87){return _0x18ea87[_0xda15('0x23')](_0x30c208)[_0xda15('0x24')](function(_0x40ffde){return _0x40ffde;});}return null;};}function removeEntity(_0x6894bc,_0x26fddf){return function(_0x5ec165){if(_0x5ec165){return _0x5ec165['destroy']()[_0xda15('0x24')](function(){_0x6894bc[_0xda15('0x1a')](0xcc)[_0xda15('0x1b')]();});}};}function handleEntityNotFound(_0x574ee9,_0x3079c8){return function(_0x51d7b7){if(!_0x51d7b7){_0x574ee9[_0xda15('0x19')](0x194);}return _0x51d7b7;};}function handleError(_0x10eb71,_0xe9be06){_0xe9be06=_0xe9be06||0x1f4;return function(_0x3b22ad){logger[_0xda15('0x25')](_0x3b22ad['stack']);if(_0x3b22ad[_0xda15('0x26')]){delete _0x3b22ad[_0xda15('0x26')];}_0x10eb71['status'](_0xe9be06)['send'](_0x3b22ad);};}exports[_0xda15('0x27')]=function(_0x2e6d09,_0x5f3e90){var _0x381a82={},_0x5b1c22={},_0x36ade4={'count':0x0,'rows':[]};var _0x506ba8=_[_0xda15('0x28')](db[_0xda15('0x29')][_0xda15('0x2a')],function(_0x8f5e3d){return{'name':_0x8f5e3d[_0xda15('0x2b')],'type':_0x8f5e3d[_0xda15('0x2c')][_0xda15('0x2d')]};});_0x5b1c22[_0xda15('0x2e')]=_[_0xda15('0x28')](_0x506ba8,_0xda15('0x26'));_0x5b1c22['query']=_['keys'](_0x2e6d09[_0xda15('0x2f')]);_0x5b1c22[_0xda15('0x30')]=_['intersection'](_0x5b1c22[_0xda15('0x2e')],_0x5b1c22[_0xda15('0x2f')]);_0x381a82[_0xda15('0x31')]=_[_0xda15('0x32')](_0x5b1c22['model'],qs[_0xda15('0x33')](_0x2e6d09[_0xda15('0x2f')][_0xda15('0x33')]));_0x381a82[_0xda15('0x31')]=_0x381a82[_0xda15('0x31')][_0xda15('0x34')]?_0x381a82[_0xda15('0x31')]:_0x5b1c22['model'];if(!_0x2e6d09[_0xda15('0x2f')]['hasOwnProperty']('nolimit')){_0x381a82[_0xda15('0x1d')]=qs[_0xda15('0x1d')](_0x2e6d09[_0xda15('0x2f')][_0xda15('0x1d')]);_0x381a82[_0xda15('0x1c')]=qs[_0xda15('0x1c')](_0x2e6d09['query'][_0xda15('0x1c')]);}_0x381a82[_0xda15('0x35')]=qs['sort'](_0x2e6d09[_0xda15('0x2f')]['sort']);_0x381a82['where']=qs[_0xda15('0x30')](_['pick'](_0x2e6d09[_0xda15('0x2f')],_0x5b1c22[_0xda15('0x30')]),_0x506ba8);if(_0x2e6d09['query'][_0xda15('0x36')]){_0x381a82[_0xda15('0x37')]=_[_0xda15('0x38')](_0x381a82[_0xda15('0x37')],{'$or':_['map'](_0x506ba8,function(_0x284766){if(_0x284766[_0xda15('0x2c')]!==_0xda15('0x39')){var _0x3bfc1c={};_0x3bfc1c[_0x284766['name']]={'$like':'%'+_0x2e6d09['query'][_0xda15('0x36')]+'%'};return _0x3bfc1c;}})});}_0x381a82=_[_0xda15('0x38')]({},_0x381a82,_0x2e6d09['options']);var _0x257a31={'where':_0x381a82[_0xda15('0x37')]};return db[_0xda15('0x29')]['count'](_0x257a31)[_0xda15('0x24')](function(_0x369181){_0x36ade4[_0xda15('0x3a')]=_0x369181;if(_0x2e6d09[_0xda15('0x2f')][_0xda15('0x3b')]){_0x381a82[_0xda15('0x3c')]=[{'all':!![]}];}return db[_0xda15('0x29')][_0xda15('0x3d')](_0x381a82);})[_0xda15('0x24')](function(_0x4c465a){_0x36ade4[_0xda15('0x3e')]=_0x4c465a;return _0x36ade4;})['then'](respondWithFilteredResult(_0x5f3e90,_0x381a82))[_0xda15('0x3f')](handleError(_0x5f3e90,null));};exports[_0xda15('0x40')]=function(_0x4e968c,_0x2c85cd){var _0x4e0a36={'raw':![],'where':{'id':_0x4e968c[_0xda15('0x41')]['id']}},_0xc059ca={};_0xc059ca[_0xda15('0x2e')]=_[_0xda15('0x42')](db[_0xda15('0x29')]['rawAttributes']);_0xc059ca[_0xda15('0x2f')]=_[_0xda15('0x42')](_0x4e968c[_0xda15('0x2f')]);_0xc059ca[_0xda15('0x30')]=_['intersection'](_0xc059ca[_0xda15('0x2e')],_0xc059ca[_0xda15('0x2f')]);_0x4e0a36[_0xda15('0x31')]=_[_0xda15('0x32')](_0xc059ca[_0xda15('0x2e')],qs[_0xda15('0x33')](_0x4e968c[_0xda15('0x2f')][_0xda15('0x33')]));_0x4e0a36[_0xda15('0x31')]=_0x4e0a36[_0xda15('0x31')][_0xda15('0x34')]?_0x4e0a36[_0xda15('0x31')]:_0xc059ca[_0xda15('0x2e')];if(_0x4e968c[_0xda15('0x2f')][_0xda15('0x3b')]){_0x4e0a36['include']=[{'all':!![]}];}_0x4e0a36=_[_0xda15('0x38')]({},_0x4e0a36,_0x4e968c['options']);return db[_0xda15('0x29')]['find'](_0x4e0a36)['then'](handleEntityNotFound(_0x2c85cd,null))[_0xda15('0x24')](respondWithResult(_0x2c85cd,null))[_0xda15('0x3f')](handleError(_0x2c85cd,null));};exports[_0xda15('0x43')]=function(_0x2b183b,_0x9a0f27){return db[_0xda15('0x29')][_0xda15('0x43')](_0x2b183b[_0xda15('0x44')],{})['then'](respondWithResult(_0x9a0f27,0xc9))[_0xda15('0x3f')](handleError(_0x9a0f27,null));};exports[_0xda15('0x23')]=function(_0x2f2871,_0x15c8d4){if(_0x2f2871[_0xda15('0x44')]['id']){delete _0x2f2871['body']['id'];}return db['FreshsalesAccount'][_0xda15('0x45')]({'where':{'id':_0x2f2871['params']['id']}})[_0xda15('0x24')](handleEntityNotFound(_0x15c8d4,null))[_0xda15('0x24')](saveUpdates(_0x2f2871[_0xda15('0x44')],null))[_0xda15('0x24')](respondWithResult(_0x15c8d4,null))[_0xda15('0x3f')](handleError(_0x15c8d4,null));};exports['destroy']=function(_0x195473,_0x52a3d3){return db[_0xda15('0x29')]['find']({'where':{'id':_0x195473[_0xda15('0x41')]['id']}})[_0xda15('0x24')](handleEntityNotFound(_0x52a3d3,null))['then'](removeEntity(_0x52a3d3,null))[_0xda15('0x3f')](handleError(_0x52a3d3,null));};exports['getConfigurations']=function(_0x8772eb,_0x6b4c84,_0x23aa19){var _0x9f57d0={};var _0x4ae5b6={};var _0x4bc734;var _0x5a60f7;return db['FreshsalesAccount'][_0xda15('0x46')]({'where':{'id':_0x8772eb['params']['id']}})[_0xda15('0x24')](handleEntityNotFound(_0x6b4c84,null))[_0xda15('0x24')](function(_0x1d7ac6){if(_0x1d7ac6){_0x4bc734=_0x1d7ac6;_0x4ae5b6[_0xda15('0x2e')]=_[_0xda15('0x42')](db[_0xda15('0x47')][_0xda15('0x2a')]);_0x4ae5b6[_0xda15('0x2f')]=_[_0xda15('0x42')](_0x8772eb[_0xda15('0x2f')]);_0x4ae5b6[_0xda15('0x30')]=_['intersection'](_0x4ae5b6[_0xda15('0x2e')],_0x4ae5b6[_0xda15('0x2f')]);_0x9f57d0[_0xda15('0x31')]=_['intersection'](_0x4ae5b6[_0xda15('0x2e')],qs[_0xda15('0x33')](_0x8772eb['query'][_0xda15('0x33')]));_0x9f57d0[_0xda15('0x31')]=_0x9f57d0[_0xda15('0x31')][_0xda15('0x34')]?_0x9f57d0['attributes']:_0x4ae5b6[_0xda15('0x2e')];_0x9f57d0[_0xda15('0x35')]=qs[_0xda15('0x48')](_0x8772eb['query'][_0xda15('0x48')]);_0x9f57d0[_0xda15('0x37')]=qs['filters'](_[_0xda15('0x49')](_0x8772eb[_0xda15('0x2f')],_0x4ae5b6['filters']));if(_0x8772eb[_0xda15('0x2f')][_0xda15('0x36')]){_0x9f57d0[_0xda15('0x37')]=_[_0xda15('0x38')](_0x9f57d0[_0xda15('0x37')],{'$or':_[_0xda15('0x28')](_0x9f57d0['attributes'],function(_0x2b7610){var _0x25105d={};_0x25105d[_0x2b7610]={'$like':'%'+_0x8772eb[_0xda15('0x2f')][_0xda15('0x36')]+'%'};return _0x25105d;})});}_0x9f57d0=_[_0xda15('0x38')]({},_0x9f57d0,_0x8772eb[_0xda15('0x4a')]);return _0x4bc734[_0xda15('0x4b')](_0x9f57d0);}})['then'](function(_0x419b0c){if(_0x419b0c){_0x5a60f7=_0x419b0c['length'];if(!_0x8772eb[_0xda15('0x2f')]['hasOwnProperty'](_0xda15('0x4c'))){_0x9f57d0[_0xda15('0x1d')]=qs[_0xda15('0x1d')](_0x8772eb[_0xda15('0x2f')]['limit']);_0x9f57d0[_0xda15('0x1c')]=qs['offset'](_0x8772eb[_0xda15('0x2f')][_0xda15('0x1c')]);}return _0x4bc734[_0xda15('0x4b')](_0x9f57d0);}})[_0xda15('0x24')](function(_0x7d3eef){if(_0x7d3eef){return _0x7d3eef?{'count':_0x5a60f7,'rows':_0x7d3eef}:null;}})[_0xda15('0x24')](respondWithResult(_0x6b4c84,null))[_0xda15('0x3f')](handleError(_0x6b4c84,null));};exports[_0xda15('0x4d')]=function(_0x444028,_0xf8136c,_0x13a886){if(_0x444028[_0xda15('0x44')]['id']){delete _0x444028[_0xda15('0x44')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x444028['params']['id']}})[_0xda15('0x24')](handleEntityNotFound(_0xf8136c,null))[_0xda15('0x24')](function(_0x3ba595){if(_0x3ba595){_0x444028['body'][_0xda15('0x4e')]=_0x3ba595['id'];_0x444028['body'][_0xda15('0x4f')]=integrations[_0xda15('0x50')](_0x444028['body'][_0xda15('0x51')],_0x444028['body'][_0xda15('0x2c')]);_0x444028[_0xda15('0x44')][_0xda15('0x52')]=integrations[_0xda15('0x53')](_0x444028[_0xda15('0x44')][_0xda15('0x51')],_0x444028[_0xda15('0x44')][_0xda15('0x2c')]);return db[_0xda15('0x47')][_0xda15('0x43')](_0x444028[_0xda15('0x44')],{'include':[{'model':db[_0xda15('0x54')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0xda15('0x52')}]});}return null;})[_0xda15('0x24')](respondWithResult(_0xf8136c,null))[_0xda15('0x3f')](handleError(_0xf8136c,null));};exports[_0xda15('0x55')]=function(_0x390066,_0x269f06,_0x3abb92){var _0xf74b74='';var _0x2064b1='';return db[_0xda15('0x29')][_0xda15('0x46')]({'where':{'id':_0x390066[_0xda15('0x41')]['id']},'attributes':['id',_0xda15('0x56'),_0xda15('0x57'),'apiKey']})[_0xda15('0x24')](handleEntityNotFound(_0x269f06,null))[_0xda15('0x24')](function(_0x599a8e){if(_0x599a8e){_0x2064b1=_0x599a8e[_0xda15('0x56')];_0xf74b74=_0x599a8e[_0xda15('0x57')];var _0x4d07fa=_0x599a8e['remoteUri'][_0xda15('0x58')](-0x1);if(_0x4d07fa==='/'){_0xf74b74=_0xf74b74[_0xda15('0x59')](0x0,_0xf74b74[_0xda15('0x5a')](_0x4d07fa));}return rp({'method':_0xda15('0x5b'),'uri':util[_0xda15('0x5c')](_0xda15('0x5d'),_0xf74b74,_0xda15('0x5e')),'headers':{'Authorization':_0xda15('0x5f')+_0x599a8e[_0xda15('0x60')]},'json':!![]});}})[_0xda15('0x24')](function(_0xafe194){if(_0xafe194){var _0x42860c=_0xafe194[_0xda15('0x61')];var _0x435afb=![];var _0x3de305=null;for(_0x3de305=0x0;_0x3de305<_0x42860c['length'];_0x3de305++){if(_0x42860c[_0x3de305]['email']===_0x2064b1){_0x435afb=!![];}}if(_0x435afb){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xda15('0x62')});}}})['then'](respondWithResult(_0x269f06,null))[_0xda15('0x3f')](function(_0x329d9a){var _0x558180=_0x390066[_0xda15('0x2f')][_0xda15('0x63')]?0x1f4:_0x329d9a[_0xda15('0x64')]||0x1f4;logger[_0xda15('0x25')](_0xda15('0x65'),_0xda15('0x55'),_0x558180,JSON[_0xda15('0x66')](_0x329d9a));delete _0x329d9a['name'];if(_0x558180===0x191){_0x558180=0x190;}_0x269f06['status'](_0x558180)['send'](_0x390066[_0xda15('0x2f')][_0xda15('0x63')]?{'message':_0xda15('0x67'),'statusCode':_0x329d9a[_0xda15('0x64')]}:_0x329d9a);});}; \ No newline at end of file +var _0xcbf2=['map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','merge','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','apiKey','remoteUri','slice','lastIndexOf','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','end','error','stack','name'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xcbf2,0xa1));var _0x2cbf=function(_0xc96ae,_0x259ceb){_0xc96ae=_0xc96ae-0x0;var _0x497081=_0xcbf2[_0xc96ae];return _0x497081;};'use strict';var emlformat=require(_0x2cbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cbf('0x1'));var jsonpatch=require(_0x2cbf('0x2'));var rp=require('request-promise');var moment=require(_0x2cbf('0x3'));var BPromise=require(_0x2cbf('0x4'));var Mustache=require(_0x2cbf('0x5'));var util=require(_0x2cbf('0x6'));var path=require(_0x2cbf('0x7'));var sox=require(_0x2cbf('0x8'));var csv=require(_0x2cbf('0x9'));var ejs=require(_0x2cbf('0xa'));var fs=require('fs');var fs_extra=require(_0x2cbf('0xb'));var _=require(_0x2cbf('0xc'));var squel=require('squel');var crypto=require(_0x2cbf('0xd'));var jsforce=require(_0x2cbf('0xe'));var deskjs=require(_0x2cbf('0xf'));var toCsv=require(_0x2cbf('0x9'));var querystring=require(_0x2cbf('0x10'));var Papa=require(_0x2cbf('0x11'));var Redis=require(_0x2cbf('0x12'));var authService=require(_0x2cbf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2cbf('0x14'));var hardwareService=require(_0x2cbf('0x15'));var logger=require(_0x2cbf('0x16'))(_0x2cbf('0x17'));var utils=require(_0x2cbf('0x18'));var config=require(_0x2cbf('0x19'));var licenseUtil=require(_0x2cbf('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x42070d,_0x5435b9){_0x5435b9=_0x5435b9||0xcc;return function(_0x3dd5f6){if(_0x3dd5f6){return _0x42070d[_0x2cbf('0x1b')](_0x5435b9);}return _0x42070d[_0x2cbf('0x1c')](_0x5435b9)['end']();};}function respondWithResult(_0x1ce538,_0x342ba9){_0x342ba9=_0x342ba9||0xc8;return function(_0x553c79){if(_0x553c79){return _0x1ce538['status'](_0x342ba9)[_0x2cbf('0x1d')](_0x553c79);}};}function respondWithFilteredResult(_0x5f4cd2,_0x3378cd){return function(_0x1363b3){if(_0x1363b3){var _0x330708=typeof _0x3378cd[_0x2cbf('0x1e')]===_0x2cbf('0x1f')&&typeof _0x3378cd[_0x2cbf('0x20')]==='undefined';var _0x4bdd81=_0x1363b3[_0x2cbf('0x21')];var _0xec2745=_0x330708?0x0:_0x3378cd[_0x2cbf('0x1e')];var _0x5ac50e=_0x330708?_0x1363b3[_0x2cbf('0x21')]:_0x3378cd[_0x2cbf('0x1e')]+_0x3378cd[_0x2cbf('0x20')];var _0x2faa11;if(_0x5ac50e>=_0x4bdd81){_0x5ac50e=_0x4bdd81;_0x2faa11=0xc8;}else{_0x2faa11=0xce;}_0x5f4cd2[_0x2cbf('0x1c')](_0x2faa11);return _0x5f4cd2[_0x2cbf('0x22')](_0x2cbf('0x23'),_0xec2745+'-'+_0x5ac50e+'/'+_0x4bdd81)['json'](_0x1363b3);}return null;};}function patchUpdates(_0x314f65){return function(_0x277d85){try{jsonpatch[_0x2cbf('0x24')](_0x277d85,_0x314f65,!![]);}catch(_0x238006){return BPromise[_0x2cbf('0x25')](_0x238006);}return _0x277d85['save']();};}function saveUpdates(_0x5f1efb,_0x5a4a3a){return function(_0x27100f){if(_0x27100f){return _0x27100f['update'](_0x5f1efb)[_0x2cbf('0x26')](function(_0x1a903f){return _0x1a903f;});}return null;};}function removeEntity(_0x3a3df7,_0x21db96){return function(_0x567ff3){if(_0x567ff3){return _0x567ff3['destroy']()[_0x2cbf('0x26')](function(){_0x3a3df7[_0x2cbf('0x1c')](0xcc)[_0x2cbf('0x27')]();});}};}function handleEntityNotFound(_0x1b649b,_0x47fd07){return function(_0xc086a4){if(!_0xc086a4){_0x1b649b[_0x2cbf('0x1b')](0x194);}return _0xc086a4;};}function handleError(_0x29b3f6,_0x46ae6c){_0x46ae6c=_0x46ae6c||0x1f4;return function(_0x47c37c){logger[_0x2cbf('0x28')](_0x47c37c[_0x2cbf('0x29')]);if(_0x47c37c[_0x2cbf('0x2a')]){delete _0x47c37c['name'];}_0x29b3f6[_0x2cbf('0x1c')](_0x46ae6c)['send'](_0x47c37c);};}exports['index']=function(_0x5cd5b5,_0x15d87d){var _0x517a4d={},_0x29951f={},_0x13e4d1={'count':0x0,'rows':[]};var _0x443224=_[_0x2cbf('0x2b')](db[_0x2cbf('0x2c')][_0x2cbf('0x2d')],function(_0x21446e){return{'name':_0x21446e[_0x2cbf('0x2e')],'type':_0x21446e[_0x2cbf('0x2f')][_0x2cbf('0x30')]};});_0x29951f[_0x2cbf('0x31')]=_[_0x2cbf('0x2b')](_0x443224,_0x2cbf('0x2a'));_0x29951f[_0x2cbf('0x32')]=_[_0x2cbf('0x33')](_0x5cd5b5[_0x2cbf('0x32')]);_0x29951f[_0x2cbf('0x34')]=_[_0x2cbf('0x35')](_0x29951f['model'],_0x29951f[_0x2cbf('0x32')]);_0x517a4d[_0x2cbf('0x36')]=_[_0x2cbf('0x35')](_0x29951f[_0x2cbf('0x31')],qs['fields'](_0x5cd5b5['query'][_0x2cbf('0x37')]));_0x517a4d[_0x2cbf('0x36')]=_0x517a4d['attributes'][_0x2cbf('0x38')]?_0x517a4d['attributes']:_0x29951f[_0x2cbf('0x31')];if(!_0x5cd5b5[_0x2cbf('0x32')]['hasOwnProperty'](_0x2cbf('0x39'))){_0x517a4d[_0x2cbf('0x20')]=qs[_0x2cbf('0x20')](_0x5cd5b5[_0x2cbf('0x32')]['limit']);_0x517a4d[_0x2cbf('0x1e')]=qs[_0x2cbf('0x1e')](_0x5cd5b5['query'][_0x2cbf('0x1e')]);}_0x517a4d[_0x2cbf('0x3a')]=qs[_0x2cbf('0x3b')](_0x5cd5b5[_0x2cbf('0x32')][_0x2cbf('0x3b')]);_0x517a4d[_0x2cbf('0x3c')]=qs[_0x2cbf('0x34')](_[_0x2cbf('0x3d')](_0x5cd5b5[_0x2cbf('0x32')],_0x29951f[_0x2cbf('0x34')]),_0x443224);if(_0x5cd5b5['query'][_0x2cbf('0x3e')]){_0x517a4d[_0x2cbf('0x3c')]=_['merge'](_0x517a4d[_0x2cbf('0x3c')],{'$or':_[_0x2cbf('0x2b')](_0x443224,function(_0x1d05cd){if(_0x1d05cd[_0x2cbf('0x2f')]!==_0x2cbf('0x3f')){var _0x127c23={};_0x127c23[_0x1d05cd['name']]={'$like':'%'+_0x5cd5b5[_0x2cbf('0x32')][_0x2cbf('0x3e')]+'%'};return _0x127c23;}})});}_0x517a4d=_['merge']({},_0x517a4d,_0x5cd5b5['options']);var _0x16076d={'where':_0x517a4d[_0x2cbf('0x3c')]};return db[_0x2cbf('0x2c')]['count'](_0x16076d)[_0x2cbf('0x26')](function(_0x352ceb){_0x13e4d1['count']=_0x352ceb;if(_0x5cd5b5[_0x2cbf('0x32')]['includeAll']){_0x517a4d['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x2cbf('0x40')](_0x517a4d);})[_0x2cbf('0x26')](function(_0x1207ad){_0x13e4d1[_0x2cbf('0x41')]=_0x1207ad;return _0x13e4d1;})[_0x2cbf('0x26')](respondWithFilteredResult(_0x15d87d,_0x517a4d))[_0x2cbf('0x42')](handleError(_0x15d87d,null));};exports[_0x2cbf('0x43')]=function(_0x904b99,_0x1505fa){var _0x2a2908={'raw':![],'where':{'id':_0x904b99[_0x2cbf('0x44')]['id']}},_0x58fb88={};_0x58fb88[_0x2cbf('0x31')]=_[_0x2cbf('0x33')](db[_0x2cbf('0x2c')]['rawAttributes']);_0x58fb88[_0x2cbf('0x32')]=_['keys'](_0x904b99[_0x2cbf('0x32')]);_0x58fb88[_0x2cbf('0x34')]=_[_0x2cbf('0x35')](_0x58fb88[_0x2cbf('0x31')],_0x58fb88['query']);_0x2a2908['attributes']=_[_0x2cbf('0x35')](_0x58fb88[_0x2cbf('0x31')],qs['fields'](_0x904b99['query'][_0x2cbf('0x37')]));_0x2a2908[_0x2cbf('0x36')]=_0x2a2908['attributes'][_0x2cbf('0x38')]?_0x2a2908[_0x2cbf('0x36')]:_0x58fb88[_0x2cbf('0x31')];if(_0x904b99[_0x2cbf('0x32')]['includeAll']){_0x2a2908[_0x2cbf('0x45')]=[{'all':!![]}];}_0x2a2908=_['merge']({},_0x2a2908,_0x904b99[_0x2cbf('0x46')]);return db[_0x2cbf('0x2c')][_0x2cbf('0x47')](_0x2a2908)[_0x2cbf('0x26')](handleEntityNotFound(_0x1505fa,null))['then'](respondWithResult(_0x1505fa,null))[_0x2cbf('0x42')](handleError(_0x1505fa,null));};exports[_0x2cbf('0x48')]=function(_0x5b98e2,_0x30ac8c){return db[_0x2cbf('0x2c')][_0x2cbf('0x48')](_0x5b98e2[_0x2cbf('0x49')],{})[_0x2cbf('0x26')](respondWithResult(_0x30ac8c,0xc9))[_0x2cbf('0x42')](handleError(_0x30ac8c,null));};exports['update']=function(_0x277d2d,_0x34489c){if(_0x277d2d['body']['id']){delete _0x277d2d[_0x2cbf('0x49')]['id'];}return db['FreshsalesAccount'][_0x2cbf('0x47')]({'where':{'id':_0x277d2d[_0x2cbf('0x44')]['id']}})[_0x2cbf('0x26')](handleEntityNotFound(_0x34489c,null))[_0x2cbf('0x26')](saveUpdates(_0x277d2d['body'],null))[_0x2cbf('0x26')](respondWithResult(_0x34489c,null))[_0x2cbf('0x42')](handleError(_0x34489c,null));};exports['destroy']=function(_0x1ae931,_0xa62bad){return db['FreshsalesAccount'][_0x2cbf('0x47')]({'where':{'id':_0x1ae931[_0x2cbf('0x44')]['id']}})['then'](handleEntityNotFound(_0xa62bad,null))[_0x2cbf('0x26')](removeEntity(_0xa62bad,null))[_0x2cbf('0x42')](handleError(_0xa62bad,null));};exports[_0x2cbf('0x4a')]=function(_0x4a8e62,_0x2eaa33,_0x2989ba){var _0x23b699={};var _0x55a30a={};var _0x210ea7;var _0x166c7d;return db[_0x2cbf('0x2c')][_0x2cbf('0x4b')]({'where':{'id':_0x4a8e62[_0x2cbf('0x44')]['id']}})[_0x2cbf('0x26')](handleEntityNotFound(_0x2eaa33,null))['then'](function(_0x55e6da){if(_0x55e6da){_0x210ea7=_0x55e6da;_0x55a30a[_0x2cbf('0x31')]=_[_0x2cbf('0x33')](db[_0x2cbf('0x4c')][_0x2cbf('0x2d')]);_0x55a30a[_0x2cbf('0x32')]=_[_0x2cbf('0x33')](_0x4a8e62[_0x2cbf('0x32')]);_0x55a30a[_0x2cbf('0x34')]=_[_0x2cbf('0x35')](_0x55a30a['model'],_0x55a30a[_0x2cbf('0x32')]);_0x23b699['attributes']=_[_0x2cbf('0x35')](_0x55a30a[_0x2cbf('0x31')],qs[_0x2cbf('0x37')](_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x37')]));_0x23b699[_0x2cbf('0x36')]=_0x23b699[_0x2cbf('0x36')][_0x2cbf('0x38')]?_0x23b699[_0x2cbf('0x36')]:_0x55a30a['model'];_0x23b699['order']=qs[_0x2cbf('0x3b')](_0x4a8e62['query']['sort']);_0x23b699[_0x2cbf('0x3c')]=qs[_0x2cbf('0x34')](_[_0x2cbf('0x3d')](_0x4a8e62[_0x2cbf('0x32')],_0x55a30a[_0x2cbf('0x34')]));if(_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x3e')]){_0x23b699[_0x2cbf('0x3c')]=_[_0x2cbf('0x4d')](_0x23b699[_0x2cbf('0x3c')],{'$or':_[_0x2cbf('0x2b')](_0x23b699[_0x2cbf('0x36')],function(_0xd8fe3){var _0x56b0b1={};_0x56b0b1[_0xd8fe3]={'$like':'%'+_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x3e')]+'%'};return _0x56b0b1;})});}_0x23b699=_[_0x2cbf('0x4d')]({},_0x23b699,_0x4a8e62[_0x2cbf('0x46')]);return _0x210ea7[_0x2cbf('0x4a')](_0x23b699);}})['then'](function(_0x48acae){if(_0x48acae){_0x166c7d=_0x48acae[_0x2cbf('0x38')];if(!_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x4e')](_0x2cbf('0x39'))){_0x23b699['limit']=qs[_0x2cbf('0x20')](_0x4a8e62['query'][_0x2cbf('0x20')]);_0x23b699['offset']=qs[_0x2cbf('0x1e')](_0x4a8e62[_0x2cbf('0x32')][_0x2cbf('0x1e')]);}return _0x210ea7['getConfigurations'](_0x23b699);}})[_0x2cbf('0x26')](function(_0x5e1dc7){if(_0x5e1dc7){return _0x5e1dc7?{'count':_0x166c7d,'rows':_0x5e1dc7}:null;}})[_0x2cbf('0x26')](respondWithResult(_0x2eaa33,null))[_0x2cbf('0x42')](handleError(_0x2eaa33,null));};exports[_0x2cbf('0x4f')]=function(_0x43b587,_0xd4973c,_0x45d203){if(_0x43b587[_0x2cbf('0x49')]['id']){delete _0x43b587[_0x2cbf('0x49')]['id'];}return db[_0x2cbf('0x2c')][_0x2cbf('0x4b')]({'where':{'id':_0x43b587[_0x2cbf('0x44')]['id']}})['then'](handleEntityNotFound(_0xd4973c,null))[_0x2cbf('0x26')](function(_0x3b83e6){if(_0x3b83e6){_0x43b587[_0x2cbf('0x49')]['AccountId']=_0x3b83e6['id'];_0x43b587[_0x2cbf('0x49')]['Subjects']=integrations[_0x2cbf('0x50')](_0x43b587[_0x2cbf('0x49')][_0x2cbf('0x51')],_0x43b587[_0x2cbf('0x49')]['type']);_0x43b587[_0x2cbf('0x49')][_0x2cbf('0x52')]=integrations[_0x2cbf('0x53')](_0x43b587[_0x2cbf('0x49')][_0x2cbf('0x51')],_0x43b587[_0x2cbf('0x49')][_0x2cbf('0x2f')]);return db[_0x2cbf('0x4c')][_0x2cbf('0x48')](_0x43b587['body'],{'include':[{'model':db[_0x2cbf('0x54')],'as':_0x2cbf('0x55')},{'model':db[_0x2cbf('0x54')],'as':_0x2cbf('0x52')}]});}return null;})['then'](respondWithResult(_0xd4973c,null))[_0x2cbf('0x42')](handleError(_0xd4973c,null));};exports[_0x2cbf('0x56')]=function(_0x40b957,_0x2550a1,_0x742a59){var _0x7189dc='';var _0x4c33d2='';return db[_0x2cbf('0x2c')][_0x2cbf('0x4b')]({'where':{'id':_0x40b957[_0x2cbf('0x44')]['id']},'attributes':['id',_0x2cbf('0x57'),'remoteUri',_0x2cbf('0x58')]})[_0x2cbf('0x26')](handleEntityNotFound(_0x2550a1,null))[_0x2cbf('0x26')](function(_0x322b6d){if(_0x322b6d){_0x4c33d2=_0x322b6d[_0x2cbf('0x57')];_0x7189dc=_0x322b6d[_0x2cbf('0x59')];var _0x2f5e59=_0x322b6d[_0x2cbf('0x59')][_0x2cbf('0x5a')](-0x1);if(_0x2f5e59==='/'){_0x7189dc=_0x7189dc['substring'](0x0,_0x7189dc[_0x2cbf('0x5b')](_0x2f5e59));}return rp({'method':'GET','uri':util['format']('%s%s',_0x7189dc,_0x2cbf('0x5c')),'headers':{'Authorization':_0x2cbf('0x5d')+_0x322b6d['apiKey']},'json':!![]});}})[_0x2cbf('0x26')](function(_0x3d17c8){if(_0x3d17c8){var _0x536045=_0x3d17c8[_0x2cbf('0x5e')];var _0x257cb3=![];var _0x2c8425=null;for(_0x2c8425=0x0;_0x2c8425<_0x536045['length'];_0x2c8425++){if(_0x536045[_0x2c8425][_0x2cbf('0x5f')]===_0x4c33d2){_0x257cb3=!![];}}if(_0x257cb3){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2cbf('0x60')});}}})[_0x2cbf('0x26')](respondWithResult(_0x2550a1,null))[_0x2cbf('0x42')](function(_0x5a078d){var _0x556ae7=_0x40b957['query'][_0x2cbf('0x61')]?0x1f4:_0x5a078d[_0x2cbf('0x62')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x556ae7,JSON[_0x2cbf('0x63')](_0x5a078d));delete _0x5a078d[_0x2cbf('0x2a')];if(_0x556ae7===0x191){_0x556ae7=0x190;}_0x2550a1['status'](_0x556ae7)[_0x2cbf('0x64')](_0x40b957[_0x2cbf('0x32')]['test']?{'message':_0x2cbf('0x65'),'statusCode':_0x5a078d[_0x2cbf('0x62')]}:_0x5a078d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 80f5344..e840f52 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 _0xcaf2=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x2cdcf9,_0x8a09d1){var _0x39412d=function(_0x7b476e){while(--_0x7b476e){_0x2cdcf9['push'](_0x2cdcf9['shift']());}};_0x39412d(++_0x8a09d1);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2111bc,_0x2d65d5){_0x2111bc=_0x2111bc-0x0;var _0x1ff93b=_0xcaf2[_0x2111bc];return _0x1ff93b;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));var integrations=require(_0x2caf('0x7'));module[_0x2caf('0x8')]=function(_0x599ce7,_0xc44e4e){return _0x599ce7[_0x2caf('0x9')](_0x2caf('0xa'),attributes,{'tableName':_0x2caf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66fa=['exports','define','FreshsalesAccount','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1c3b3e,_0x149302){var _0x3f2128=function(_0x1841e1){while(--_0x1841e1){_0x1c3b3e['push'](_0x1c3b3e['shift']());}};_0x3f2128(++_0x149302);}(_0x66fa,0x117));var _0xa66f=function(_0x172cf0,_0xbd1c7b){_0x172cf0=_0x172cf0-0x0;var _0x441d9c=_0x66fa[_0x172cf0];return _0x441d9c;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var fs=require('fs');var path=require(_0xa66f('0x6'));var rimraf=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xa66f('0x9')]=function(_0x20a150,_0x2f0b78){return _0x20a150[_0xa66f('0xa')](_0xa66f('0xb'),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 c0972b8..a2964e3 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 _0x7880=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetFreshsalesAccount','findAll','options','raw','attributes','include','map','model','then','ShowFreshsalesAccount','FreshsalesAccount','find','where','util','moment','bluebird','randomstring'];(function(_0x14978e,_0x3ab441){var _0x54db2e=function(_0x489b5d){while(--_0x489b5d){_0x14978e['push'](_0x14978e['shift']());}};_0x54db2e(++_0x3ab441);}(_0x7880,0x1f4));var _0x0788=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x7880[_0x4a9a17];return _0x30e831;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});}exports[_0x0788('0x17')]=function(_0x5b2bdc){var _0x654e4b=this;return new Promise(function(_0x415f19,_0x17ae59){return db['FreshsalesAccount'][_0x0788('0x18')]({'raw':_0x5b2bdc[_0x0788('0x19')]?_0x5b2bdc['options'][_0x0788('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b2bdc['options']?_0x5b2bdc[_0x0788('0x19')]['where']||null:null,'attributes':_0x5b2bdc[_0x0788('0x19')]?_0x5b2bdc[_0x0788('0x19')][_0x0788('0x1b')]||null:null,'limit':_0x5b2bdc[_0x0788('0x19')]?_0x5b2bdc[_0x0788('0x19')]['limit']||null:null,'include':_0x5b2bdc['options']?_0x5b2bdc[_0x0788('0x19')][_0x0788('0x1c')]?_[_0x0788('0x1d')](_0x5b2bdc[_0x0788('0x19')]['include'],function(_0x4d5c93){return{'model':db[_0x4d5c93[_0x0788('0x1e')]],'as':_0x4d5c93['as'],'attributes':_0x4d5c93[_0x0788('0x1b')],'include':_0x4d5c93[_0x0788('0x1c')]?_['map'](_0x4d5c93['include'],function(_0x240459){return{'model':db[_0x240459[_0x0788('0x1e')]],'as':_0x240459['as'],'attributes':_0x240459['attributes'],'include':_0x240459['include']?_[_0x0788('0x1d')](_0x240459[_0x0788('0x1c')],function(_0x57fda1){return{'model':db[_0x57fda1[_0x0788('0x1e')]],'as':_0x57fda1['as'],'attributes':_0x57fda1[_0x0788('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0788('0x1f')](function(_0x18fc0e){logger[_0x0788('0x14')](_0x0788('0x17'),_0x5b2bdc);logger[_0x0788('0xf')](_0x0788('0x17'),_0x5b2bdc,JSON['stringify'](_0x18fc0e));_0x415f19(_0x18fc0e);})['catch'](function(_0x3c5246){logger[_0x0788('0x11')]('GetFreshsalesAccount',_0x3c5246['message'],_0x5b2bdc);_0x17ae59(_0x654e4b[_0x0788('0x11')](0x1f4,_0x3c5246[_0x0788('0x13')]));});});};exports[_0x0788('0x20')]=function(_0x436031){var _0x44cbfb=this;return new Promise(function(_0x44bff2,_0x327d67){return db[_0x0788('0x21')][_0x0788('0x22')]({'raw':_0x436031[_0x0788('0x19')]?_0x436031['options'][_0x0788('0x1a')]===undefined?!![]:![]:!![],'where':_0x436031[_0x0788('0x19')]?_0x436031[_0x0788('0x19')][_0x0788('0x23')]||null:null,'attributes':_0x436031[_0x0788('0x19')]?_0x436031[_0x0788('0x19')][_0x0788('0x1b')]||null:null,'include':_0x436031[_0x0788('0x19')]?_0x436031[_0x0788('0x19')][_0x0788('0x1c')]?_['map'](_0x436031['options']['include'],function(_0x5633da){return{'model':db[_0x5633da['model']],'as':_0x5633da['as'],'attributes':_0x5633da['attributes'],'include':_0x5633da[_0x0788('0x1c')]?_[_0x0788('0x1d')](_0x5633da[_0x0788('0x1c')],function(_0x574576){return{'model':db[_0x574576[_0x0788('0x1e')]],'as':_0x574576['as'],'attributes':_0x574576[_0x0788('0x1b')],'include':_0x574576[_0x0788('0x1c')]?_[_0x0788('0x1d')](_0x574576['include'],function(_0x2ed940){return{'model':db[_0x2ed940['model']],'as':_0x2ed940['as'],'attributes':_0x2ed940[_0x0788('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9d1edb){logger[_0x0788('0x14')]('ShowFreshsalesAccount',_0x436031);logger[_0x0788('0xf')](_0x0788('0x20'),_0x436031,JSON['stringify'](_0x9d1edb));_0x44bff2(_0x9d1edb);})[_0x0788('0x16')](function(_0x5eb693){logger[_0x0788('0x11')]('ShowFreshsalesAccount',_0x5eb693[_0x0788('0x13')],_0x436031);_0x327d67(_0x44cbfb['error'](0x1f4,_0x5eb693[_0x0788('0x13')]));});});}; \ No newline at end of file +var _0xb016=['include','model','debug','ShowFreshsalesAccount','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xb016,0x159));var _0x6b01=function(_0x17ae83,_0x506414){_0x17ae83=_0x17ae83-0x0;var _0x228e52=_0xb016[_0x17ae83];return _0x228e52;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')]({'raw':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x18')]===undefined?!![]:![]:!![],'where':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x9c6571['options']?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1b')]||null:null,'include':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')]['include']?_[_0x6b01('0x1c')](_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1d')],function(_0x51243c){return{'model':db[_0x51243c[_0x6b01('0x1e')]],'as':_0x51243c['as'],'attributes':_0x51243c[_0x6b01('0x1a')],'include':_0x51243c[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x51243c[_0x6b01('0x1d')],function(_0x2456e9){return{'model':db[_0x2456e9[_0x6b01('0x1e')]],'as':_0x2456e9['as'],'attributes':_0x2456e9[_0x6b01('0x1a')],'include':_0x2456e9[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2456e9[_0x6b01('0x1d')],function(_0xa846d8){return{'model':db[_0xa846d8[_0x6b01('0x1e')]],'as':_0xa846d8['as'],'attributes':_0xa846d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x220efb){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1f')]('GetFreshsalesAccount',_0x9c6571,JSON['stringify'](_0x220efb));_0x18f336(_0x220efb);})[_0x6b01('0x13')](function(_0x3df3d4){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x3df3d4[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x3df3d4['message']));});});};exports[_0x6b01('0x20')]=function(_0x5482a8){var _0x3942d7=this;return new Promise(function(_0x4e7e32,_0x6920cf){return db[_0x6b01('0x15')][_0x6b01('0x21')]({'raw':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x5482a8['options']?_0x5482a8['options'][_0x6b01('0x1a')]||null:null,'include':_0x5482a8['options']?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x5482a8['options'][_0x6b01('0x1d')],function(_0x42d5f7){return{'model':db[_0x42d5f7[_0x6b01('0x1e')]],'as':_0x42d5f7['as'],'attributes':_0x42d5f7['attributes'],'include':_0x42d5f7[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x42d5f7[_0x6b01('0x1d')],function(_0x2eb34f){return{'model':db[_0x2eb34f[_0x6b01('0x1e')]],'as':_0x2eb34f['as'],'attributes':_0x2eb34f['attributes'],'include':_0x2eb34f[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2eb34f[_0x6b01('0x1d')],function(_0x5269c7){return{'model':db[_0x5269c7[_0x6b01('0x1e')]],'as':_0x5269c7['as'],'attributes':_0x5269c7[_0x6b01('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x3154d7){logger['info'](_0x6b01('0x20'),_0x5482a8);logger['debug'](_0x6b01('0x20'),_0x5482a8,JSON[_0x6b01('0xe')](_0x3154d7));_0x4e7e32(_0x3154d7);})[_0x6b01('0x13')](function(_0x318b8b){logger[_0x6b01('0xf')](_0x6b01('0x20'),_0x318b8b[_0x6b01('0x11')],_0x5482a8);_0x6920cf(_0x3942d7['error'](0x1f4,_0x318b8b[_0x6b01('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3a61984..9049be4 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 _0x7f92=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','delete','/:id','destroy'];(function(_0x14fed5,_0x3b5a4d){var _0x26d790=function(_0x5949c8){while(--_0x5949c8){_0x14fed5['push'](_0x14fed5['shift']());}};_0x26d790(++_0x3b5a4d);}(_0x7f92,0x1dd));var _0x27f9=function(_0x3f3da3,_0x4cb011){_0x3f3da3=_0x3f3da3-0x0;var _0x5338bf=_0x7f92[_0x3f3da3];return _0x5338bf;};'use strict';var multer=require(_0x27f9('0x0'));var util=require(_0x27f9('0x1'));var path=require(_0x27f9('0x2'));var timeout=require(_0x27f9('0x3'));var express=require(_0x27f9('0x4'));var router=express[_0x27f9('0x5')]();var fs_extra=require(_0x27f9('0x6'));var auth=require(_0x27f9('0x7'));var interaction=require(_0x27f9('0x8'));var config=require(_0x27f9('0x9'));var controller=require(_0x27f9('0xa'));router[_0x27f9('0xb')]('/',auth['isAuthenticated'](),controller[_0x27f9('0xc')]);router[_0x27f9('0xb')]('/:id',auth[_0x27f9('0xd')](),controller[_0x27f9('0xe')]);router['get'](_0x27f9('0xf'),auth[_0x27f9('0xd')](),controller[_0x27f9('0x10')]);router[_0x27f9('0xb')](_0x27f9('0x11'),auth[_0x27f9('0xd')](),controller[_0x27f9('0x12')]);router[_0x27f9('0xb')](_0x27f9('0x13'),auth['isAuthenticated'](),controller[_0x27f9('0x14')]);router[_0x27f9('0x15')]('/',auth[_0x27f9('0xd')](),controller[_0x27f9('0x16')]);router[_0x27f9('0x17')]('/:id',auth[_0x27f9('0xd')](),controller['update']);router[_0x27f9('0x18')](_0x27f9('0x19'),auth[_0x27f9('0xd')](),controller[_0x27f9('0x1a')]);module[_0x27f9('0x1b')]=router; \ No newline at end of file +var _0x004f=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0xf19af5,_0x2414bf){var _0x198afd=function(_0x45e8ba){while(--_0x45e8ba){_0xf19af5['push'](_0xf19af5['shift']());}};_0x198afd(++_0x2414bf);}(_0x004f,0xe9));var _0xf004=function(_0x3cef3b,_0x3a42ee){_0x3cef3b=_0x3cef3b-0x0;var _0x111907=_0x004f[_0x3cef3b];return _0x111907;};'use strict';var multer=require(_0xf004('0x0'));var util=require(_0xf004('0x1'));var path=require(_0xf004('0x2'));var timeout=require(_0xf004('0x3'));var express=require(_0xf004('0x4'));var router=express['Router']();var fs_extra=require(_0xf004('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf004('0x6'));var config=require('../../config/environment');var controller=require(_0xf004('0x7'));router[_0xf004('0x8')]('/',auth[_0xf004('0x9')](),controller[_0xf004('0xa')]);router[_0xf004('0x8')]('/:id',auth[_0xf004('0x9')](),controller[_0xf004('0xb')]);router[_0xf004('0x8')](_0xf004('0xc'),auth[_0xf004('0x9')](),controller['getSubjects']);router[_0xf004('0x8')](_0xf004('0xd'),auth['isAuthenticated'](),controller[_0xf004('0xe')]);router[_0xf004('0x8')](_0xf004('0xf'),auth[_0xf004('0x9')](),controller[_0xf004('0x10')]);router[_0xf004('0x11')]('/',auth[_0xf004('0x9')](),controller[_0xf004('0x12')]);router[_0xf004('0x13')](_0xf004('0x14'),auth['isAuthenticated'](),controller[_0xf004('0x15')]);router[_0xf004('0x16')]('/:id',auth[_0xf004('0x9')](),controller[_0xf004('0x17')]);module[_0xf004('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index eb3942d..78dc2e9 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 _0xa92d=['exports','STRING','sequelize'];(function(_0x54c1f7,_0x13cd63){var _0x422520=function(_0x3fe781){while(--_0x3fe781){_0x54c1f7['push'](_0x54c1f7['shift']());}};_0x422520(++_0x13cd63);}(_0xa92d,0x19a));var _0xda92=function(_0x29c92d,_0x44f5d9){_0x29c92d=_0x29c92d-0x0;var _0x53e143=_0xa92d[_0x29c92d];return _0x53e143;};'use strict';var Sequelize=require(_0xda92('0x0'));module[_0xda92('0x1')]={'name':{'type':Sequelize[_0xda92('0x2')]},'description':{'type':Sequelize[_0xda92('0x2')]}}; \ No newline at end of file +var _0xc2ac=['STRING','exports'];(function(_0x1c25c0,_0x575b5b){var _0x588338=function(_0x54651a){while(--_0x54651a){_0x1c25c0['push'](_0x1c25c0['shift']());}};_0x588338(++_0x575b5b);}(_0xc2ac,0x143));var _0xcc2a=function(_0x2e6023,_0x3497e3){_0x2e6023=_0x2e6023-0x0;var _0x48ae6e=_0xc2ac[_0x2e6023];return _0x48ae6e;};'use strict';var Sequelize=require('sequelize');module[_0xcc2a('0x0')]={'name':{'type':Sequelize[_0xcc2a('0x1')]},'description':{'type':Sequelize[_0xcc2a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index fe3e9d0..f91bf61 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 _0x67ee=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','FreshsalesConfiguration','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','getSubjects','FreshsalesField','getDescriptions','getFields','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','key'];(function(_0x55542b,_0x435e1e){var _0x488038=function(_0x30708e){while(--_0x30708e){_0x55542b['push'](_0x55542b['shift']());}};_0x488038(++_0x435e1e);}(_0x67ee,0x1c8));var _0xe67e=function(_0x4c6f5b,_0x5a7292){_0x4c6f5b=_0x4c6f5b-0x0;var _0x32163c=_0x67ee[_0x4c6f5b];return _0x32163c;};'use strict';var emlformat=require(_0xe67e('0x0'));var rimraf=require(_0xe67e('0x1'));var zipdir=require(_0xe67e('0x2'));var jsonpatch=require(_0xe67e('0x3'));var rp=require(_0xe67e('0x4'));var moment=require(_0xe67e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe67e('0x6'));var path=require(_0xe67e('0x7'));var sox=require(_0xe67e('0x8'));var csv=require('to-csv');var ejs=require(_0xe67e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe67e('0xa'));var jsforce=require(_0xe67e('0xb'));var deskjs=require(_0xe67e('0xc'));var toCsv=require(_0xe67e('0xd'));var querystring=require('querystring');var Papa=require(_0xe67e('0xe'));var Redis=require(_0xe67e('0xf'));var authService=require(_0xe67e('0x10'));var qs=require(_0xe67e('0x11'));var as=require(_0xe67e('0x12'));var hardwareService=require(_0xe67e('0x13'));var logger=require(_0xe67e('0x14'))(_0xe67e('0x15'));var utils=require(_0xe67e('0x16'));var config=require(_0xe67e('0x17'));var licenseUtil=require(_0xe67e('0x18'));var db=require(_0xe67e('0x19'))['db'];function respondWithStatusCode(_0xc1fc29,_0x177a57){_0x177a57=_0x177a57||0xcc;return function(_0x4d6bc1){if(_0x4d6bc1){return _0xc1fc29[_0xe67e('0x1a')](_0x177a57);}return _0xc1fc29[_0xe67e('0x1b')](_0x177a57)[_0xe67e('0x1c')]();};}function respondWithResult(_0x5e9e0d,_0x326742){_0x326742=_0x326742||0xc8;return function(_0x10b124){if(_0x10b124){return _0x5e9e0d[_0xe67e('0x1b')](_0x326742)['json'](_0x10b124);}};}function respondWithFilteredResult(_0x175a47,_0xc6b0bb){return function(_0x503e98){if(_0x503e98){var _0x5e8048=typeof _0xc6b0bb['offset']===_0xe67e('0x1d')&&typeof _0xc6b0bb['limit']==='undefined';var _0x5e5043=_0x503e98[_0xe67e('0x1e')];var _0x3eceb0=_0x5e8048?0x0:_0xc6b0bb[_0xe67e('0x1f')];var _0x1be6f1=_0x5e8048?_0x503e98['count']:_0xc6b0bb[_0xe67e('0x1f')]+_0xc6b0bb[_0xe67e('0x20')];var _0xc45b64;if(_0x1be6f1>=_0x5e5043){_0x1be6f1=_0x5e5043;_0xc45b64=0xc8;}else{_0xc45b64=0xce;}_0x175a47['status'](_0xc45b64);return _0x175a47[_0xe67e('0x21')](_0xe67e('0x22'),_0x3eceb0+'-'+_0x1be6f1+'/'+_0x5e5043)[_0xe67e('0x23')](_0x503e98);}return null;};}function patchUpdates(_0x521c27){return function(_0x14e88b){try{jsonpatch['apply'](_0x14e88b,_0x521c27,!![]);}catch(_0xd0b63d){return BPromise[_0xe67e('0x24')](_0xd0b63d);}return _0x14e88b[_0xe67e('0x25')]();};}function saveUpdates(_0x3d2a1b,_0x373777){return function(_0x149a88){if(_0x149a88){return _0x149a88[_0xe67e('0x26')](_0x3d2a1b)[_0xe67e('0x27')](function(_0x27e74a){return _0x27e74a;});}return null;};}function removeEntity(_0x49e11f,_0x229dc1){return function(_0x2f8729){if(_0x2f8729){return _0x2f8729[_0xe67e('0x28')]()[_0xe67e('0x27')](function(){_0x49e11f[_0xe67e('0x1b')](0xcc)[_0xe67e('0x1c')]();});}};}function handleEntityNotFound(_0x59a488,_0x5ec571){return function(_0x26011d){if(!_0x26011d){_0x59a488[_0xe67e('0x1a')](0x194);}return _0x26011d;};}function handleError(_0x518f52,_0x12a358){_0x12a358=_0x12a358||0x1f4;return function(_0x4aa695){logger[_0xe67e('0x29')](_0x4aa695[_0xe67e('0x2a')]);if(_0x4aa695[_0xe67e('0x2b')]){delete _0x4aa695['name'];}_0x518f52[_0xe67e('0x1b')](_0x12a358)[_0xe67e('0x2c')](_0x4aa695);};}exports[_0xe67e('0x2d')]=function(_0x501f5f,_0x3c636d){var _0x294430={},_0x28f04f={},_0x1657e6={'count':0x0,'rows':[]};var _0xd2b0f5=_[_0xe67e('0x2e')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x11a207){return{'name':_0x11a207['fieldName'],'type':_0x11a207['type'][_0xe67e('0x2f')]};});_0x28f04f[_0xe67e('0x30')]=_[_0xe67e('0x2e')](_0xd2b0f5,_0xe67e('0x2b'));_0x28f04f[_0xe67e('0x31')]=_[_0xe67e('0x32')](_0x501f5f['query']);_0x28f04f[_0xe67e('0x33')]=_['intersection'](_0x28f04f[_0xe67e('0x30')],_0x28f04f[_0xe67e('0x31')]);_0x294430[_0xe67e('0x34')]=_[_0xe67e('0x35')](_0x28f04f[_0xe67e('0x30')],qs['fields'](_0x501f5f[_0xe67e('0x31')][_0xe67e('0x36')]));_0x294430[_0xe67e('0x34')]=_0x294430[_0xe67e('0x34')][_0xe67e('0x37')]?_0x294430[_0xe67e('0x34')]:_0x28f04f[_0xe67e('0x30')];if(!_0x501f5f['query'][_0xe67e('0x38')](_0xe67e('0x39'))){_0x294430[_0xe67e('0x20')]=qs[_0xe67e('0x20')](_0x501f5f['query']['limit']);_0x294430['offset']=qs['offset'](_0x501f5f[_0xe67e('0x31')]['offset']);}_0x294430[_0xe67e('0x3a')]=qs[_0xe67e('0x3b')](_0x501f5f[_0xe67e('0x31')][_0xe67e('0x3b')]);_0x294430['where']=qs['filters'](_[_0xe67e('0x3c')](_0x501f5f[_0xe67e('0x31')],_0x28f04f[_0xe67e('0x33')]),_0xd2b0f5);if(_0x501f5f[_0xe67e('0x31')][_0xe67e('0x3d')]){_0x294430[_0xe67e('0x3e')]=_[_0xe67e('0x3f')](_0x294430['where'],{'$or':_[_0xe67e('0x2e')](_0xd2b0f5,function(_0x37025a){if(_0x37025a[_0xe67e('0x40')]!==_0xe67e('0x41')){var _0x18496={};_0x18496[_0x37025a[_0xe67e('0x2b')]]={'$like':'%'+_0x501f5f[_0xe67e('0x31')]['filter']+'%'};return _0x18496;}})});}_0x294430=_[_0xe67e('0x3f')]({},_0x294430,_0x501f5f[_0xe67e('0x42')]);var _0x388949={'where':_0x294430[_0xe67e('0x3e')]};return db['FreshsalesConfiguration'][_0xe67e('0x1e')](_0x388949)[_0xe67e('0x27')](function(_0x1157d9){_0x1657e6['count']=_0x1157d9;if(_0x501f5f[_0xe67e('0x31')]['includeAll']){_0x294430[_0xe67e('0x43')]=[{'all':!![]}];}return db[_0xe67e('0x44')][_0xe67e('0x45')](_0x294430);})[_0xe67e('0x27')](function(_0x244e3d){_0x1657e6[_0xe67e('0x46')]=_0x244e3d;return _0x1657e6;})['then'](respondWithFilteredResult(_0x3c636d,_0x294430))['catch'](handleError(_0x3c636d,null));};exports[_0xe67e('0x47')]=function(_0x4982f0,_0x196b4b){var _0x5dcf50={'raw':![],'where':{'id':_0x4982f0[_0xe67e('0x48')]['id']}},_0xb49f={};_0xb49f['model']=_['keys'](db[_0xe67e('0x44')][_0xe67e('0x49')]);_0xb49f[_0xe67e('0x31')]=_[_0xe67e('0x32')](_0x4982f0[_0xe67e('0x31')]);_0xb49f[_0xe67e('0x33')]=_[_0xe67e('0x35')](_0xb49f['model'],_0xb49f[_0xe67e('0x31')]);_0x5dcf50[_0xe67e('0x34')]=_[_0xe67e('0x35')](_0xb49f[_0xe67e('0x30')],qs['fields'](_0x4982f0[_0xe67e('0x31')][_0xe67e('0x36')]));_0x5dcf50['attributes']=_0x5dcf50[_0xe67e('0x34')][_0xe67e('0x37')]?_0x5dcf50[_0xe67e('0x34')]:_0xb49f[_0xe67e('0x30')];if(_0x4982f0[_0xe67e('0x31')][_0xe67e('0x4a')]){_0x5dcf50[_0xe67e('0x43')]=[{'all':!![]}];}_0x5dcf50=_['merge']({},_0x5dcf50,_0x4982f0[_0xe67e('0x42')]);return db[_0xe67e('0x44')][_0xe67e('0x4b')](_0x5dcf50)[_0xe67e('0x27')](handleEntityNotFound(_0x196b4b,null))['then'](respondWithResult(_0x196b4b,null))[_0xe67e('0x4c')](handleError(_0x196b4b,null));};exports['create']=function(_0x5c9bb8,_0x25af50){return db['FreshsalesConfiguration'][_0xe67e('0x4d')](_0x5c9bb8[_0xe67e('0x4e')],{})[_0xe67e('0x27')](respondWithResult(_0x25af50,0xc9))['catch'](handleError(_0x25af50,null));};exports[_0xe67e('0x26')]=function(_0x46ba8e,_0x237a81){if(_0x46ba8e[_0xe67e('0x4e')]['id']){delete _0x46ba8e[_0xe67e('0x4e')]['id'];}return db[_0xe67e('0x44')]['find']({'where':{'id':_0x46ba8e['params']['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0x237a81,null))[_0xe67e('0x27')](saveUpdates(_0x46ba8e['body'],null))[_0xe67e('0x27')](respondWithResult(_0x237a81,null))[_0xe67e('0x4c')](handleError(_0x237a81,null));};exports[_0xe67e('0x28')]=function(_0x53d8e3,_0x4da9c7){return db[_0xe67e('0x44')][_0xe67e('0x4b')]({'where':{'id':_0x53d8e3[_0xe67e('0x48')]['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0x4da9c7,null))[_0xe67e('0x27')](removeEntity(_0x4da9c7,null))[_0xe67e('0x4c')](handleError(_0x4da9c7,null));};exports[_0xe67e('0x4f')]=function(_0x5cdd80,_0x1ea507,_0x45341d){var _0x23d08f={};var _0x3deab1={};var _0x120cbc;var _0x582b88;return db[_0xe67e('0x44')]['findOne']({'where':{'id':_0x5cdd80['params']['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0x1ea507,null))[_0xe67e('0x27')](function(_0x1c7756){if(_0x1c7756){_0x120cbc=_0x1c7756;_0x3deab1['model']=_['keys'](db[_0xe67e('0x50')][_0xe67e('0x49')]);_0x3deab1['query']=_[_0xe67e('0x32')](_0x5cdd80[_0xe67e('0x31')]);_0x3deab1[_0xe67e('0x33')]=_[_0xe67e('0x35')](_0x3deab1['model'],_0x3deab1[_0xe67e('0x31')]);_0x23d08f[_0xe67e('0x34')]=_[_0xe67e('0x35')](_0x3deab1[_0xe67e('0x30')],qs[_0xe67e('0x36')](_0x5cdd80[_0xe67e('0x31')][_0xe67e('0x36')]));_0x23d08f['attributes']=_0x23d08f[_0xe67e('0x34')][_0xe67e('0x37')]?_0x23d08f[_0xe67e('0x34')]:_0x3deab1['model'];_0x23d08f[_0xe67e('0x3a')]=qs[_0xe67e('0x3b')](_0x5cdd80['query'][_0xe67e('0x3b')]);_0x23d08f[_0xe67e('0x3e')]=qs['filters'](_[_0xe67e('0x3c')](_0x5cdd80['query'],_0x3deab1['filters']));if(_0x5cdd80[_0xe67e('0x31')][_0xe67e('0x3d')]){_0x23d08f[_0xe67e('0x3e')]=_[_0xe67e('0x3f')](_0x23d08f['where'],{'$or':_['map'](_0x23d08f[_0xe67e('0x34')],function(_0x3189fc){var _0x55e988={};_0x55e988[_0x3189fc]={'$like':'%'+_0x5cdd80['query'][_0xe67e('0x3d')]+'%'};return _0x55e988;})});}_0x23d08f=_['merge']({},_0x23d08f,_0x5cdd80[_0xe67e('0x42')]);return _0x120cbc['getSubjects'](_0x23d08f);}})[_0xe67e('0x27')](function(_0x57b51c){if(_0x57b51c){_0x582b88=_0x57b51c[_0xe67e('0x37')];if(!_0x5cdd80[_0xe67e('0x31')][_0xe67e('0x38')](_0xe67e('0x39'))){_0x23d08f[_0xe67e('0x20')]=qs['limit'](_0x5cdd80[_0xe67e('0x31')][_0xe67e('0x20')]);_0x23d08f[_0xe67e('0x1f')]=qs[_0xe67e('0x1f')](_0x5cdd80[_0xe67e('0x31')][_0xe67e('0x1f')]);}return _0x120cbc[_0xe67e('0x4f')](_0x23d08f);}})[_0xe67e('0x27')](function(_0x15ff91){if(_0x15ff91){return _0x15ff91?{'count':_0x582b88,'rows':_0x15ff91}:null;}})[_0xe67e('0x27')](respondWithResult(_0x1ea507,null))[_0xe67e('0x4c')](handleError(_0x1ea507,null));};exports[_0xe67e('0x51')]=function(_0x49d52d,_0x229bc1,_0x2ace31){var _0x254103={};var _0x18b658={};var _0x42f54c;var _0x572683;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x49d52d[_0xe67e('0x48')]['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0x229bc1,null))['then'](function(_0x5e5895){if(_0x5e5895){_0x42f54c=_0x5e5895;_0x18b658['model']=_[_0xe67e('0x32')](db['FreshsalesField'][_0xe67e('0x49')]);_0x18b658['query']=_[_0xe67e('0x32')](_0x49d52d[_0xe67e('0x31')]);_0x18b658[_0xe67e('0x33')]=_[_0xe67e('0x35')](_0x18b658[_0xe67e('0x30')],_0x18b658[_0xe67e('0x31')]);_0x254103['attributes']=_['intersection'](_0x18b658[_0xe67e('0x30')],qs['fields'](_0x49d52d[_0xe67e('0x31')][_0xe67e('0x36')]));_0x254103['attributes']=_0x254103[_0xe67e('0x34')][_0xe67e('0x37')]?_0x254103['attributes']:_0x18b658[_0xe67e('0x30')];_0x254103['order']=qs['sort'](_0x49d52d[_0xe67e('0x31')][_0xe67e('0x3b')]);_0x254103['where']=qs[_0xe67e('0x33')](_[_0xe67e('0x3c')](_0x49d52d[_0xe67e('0x31')],_0x18b658[_0xe67e('0x33')]));if(_0x49d52d[_0xe67e('0x31')][_0xe67e('0x3d')]){_0x254103[_0xe67e('0x3e')]=_[_0xe67e('0x3f')](_0x254103[_0xe67e('0x3e')],{'$or':_['map'](_0x254103[_0xe67e('0x34')],function(_0x503244){var _0x310648={};_0x310648[_0x503244]={'$like':'%'+_0x49d52d['query'][_0xe67e('0x3d')]+'%'};return _0x310648;})});}_0x254103=_[_0xe67e('0x3f')]({},_0x254103,_0x49d52d[_0xe67e('0x42')]);return _0x42f54c[_0xe67e('0x51')](_0x254103);}})['then'](function(_0x6ea648){if(_0x6ea648){_0x572683=_0x6ea648['length'];if(!_0x49d52d[_0xe67e('0x31')]['hasOwnProperty'](_0xe67e('0x39'))){_0x254103['limit']=qs[_0xe67e('0x20')](_0x49d52d['query'][_0xe67e('0x20')]);_0x254103['offset']=qs[_0xe67e('0x1f')](_0x49d52d['query'][_0xe67e('0x1f')]);}return _0x42f54c[_0xe67e('0x51')](_0x254103);}})['then'](function(_0x353763){if(_0x353763){return _0x353763?{'count':_0x572683,'rows':_0x353763}:null;}})['then'](respondWithResult(_0x229bc1,null))['catch'](handleError(_0x229bc1,null));};exports[_0xe67e('0x52')]=function(_0x56c5c2,_0xf974cd,_0x1a0250){var _0x36809e={};var _0x33af7c={};var _0x18a7ae;var _0x98975f;return db[_0xe67e('0x44')][_0xe67e('0x53')]({'where':{'id':_0x56c5c2[_0xe67e('0x48')]['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0xf974cd,null))[_0xe67e('0x27')](function(_0x3d8029){if(_0x3d8029){_0x18a7ae=_0x3d8029;_0x33af7c[_0xe67e('0x30')]=_[_0xe67e('0x32')](db['FreshsalesField'][_0xe67e('0x49')]);_0x33af7c[_0xe67e('0x31')]=_['keys'](_0x56c5c2[_0xe67e('0x31')]);_0x33af7c['filters']=_[_0xe67e('0x35')](_0x33af7c[_0xe67e('0x30')],_0x33af7c[_0xe67e('0x31')]);_0x36809e['attributes']=_[_0xe67e('0x35')](_0x33af7c[_0xe67e('0x30')],qs['fields'](_0x56c5c2['query']['fields']));_0x36809e[_0xe67e('0x34')]=_0x36809e[_0xe67e('0x34')][_0xe67e('0x37')]?_0x36809e[_0xe67e('0x34')]:_0x33af7c['model'];_0x36809e[_0xe67e('0x3a')]=qs[_0xe67e('0x3b')](_0x56c5c2['query']['sort']);_0x36809e[_0xe67e('0x3e')]=qs['filters'](_[_0xe67e('0x3c')](_0x56c5c2[_0xe67e('0x31')],_0x33af7c[_0xe67e('0x33')]));if(_0x56c5c2[_0xe67e('0x31')][_0xe67e('0x3d')]){_0x36809e[_0xe67e('0x3e')]=_['merge'](_0x36809e[_0xe67e('0x3e')],{'$or':_['map'](_0x36809e['attributes'],function(_0x5924c2){var _0x2673b3={};_0x2673b3[_0x5924c2]={'$like':'%'+_0x56c5c2[_0xe67e('0x31')][_0xe67e('0x3d')]+'%'};return _0x2673b3;})});}_0x36809e=_[_0xe67e('0x3f')]({},_0x36809e,_0x56c5c2[_0xe67e('0x42')]);return _0x18a7ae[_0xe67e('0x52')](_0x36809e);}})[_0xe67e('0x27')](function(_0x2c3fdd){if(_0x2c3fdd){_0x98975f=_0x2c3fdd['length'];if(!_0x56c5c2[_0xe67e('0x31')]['hasOwnProperty'](_0xe67e('0x39'))){_0x36809e['limit']=qs[_0xe67e('0x20')](_0x56c5c2[_0xe67e('0x31')][_0xe67e('0x20')]);_0x36809e[_0xe67e('0x1f')]=qs[_0xe67e('0x1f')](_0x56c5c2[_0xe67e('0x31')][_0xe67e('0x1f')]);}return _0x18a7ae[_0xe67e('0x52')](_0x36809e);}})[_0xe67e('0x27')](function(_0x2b5e22){if(_0x2b5e22){return _0x2b5e22?{'count':_0x98975f,'rows':_0x2b5e22}:null;}})[_0xe67e('0x27')](respondWithResult(_0xf974cd,null))[_0xe67e('0x4c')](handleError(_0xf974cd,null));}; \ No newline at end of file +var _0x120d=['findOne','FreshsalesField','order','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','FreshsalesConfiguration','findAll','rows','catch','show','params','keys','include','find','create','body','getSubjects'];(function(_0x50d2bd,_0x5cf444){var _0x2b8bd7=function(_0x3576c2){while(--_0x3576c2){_0x50d2bd['push'](_0x50d2bd['shift']());}};_0x2b8bd7(++_0x5cf444);}(_0x120d,0x140));var _0xd120=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x120d[_0xdd0313];return _0x2bd7e8;};'use strict';var emlformat=require(_0xd120('0x0'));var rimraf=require(_0xd120('0x1'));var zipdir=require(_0xd120('0x2'));var jsonpatch=require(_0xd120('0x3'));var rp=require('request-promise');var moment=require(_0xd120('0x4'));var BPromise=require(_0xd120('0x5'));var Mustache=require(_0xd120('0x6'));var util=require('util');var path=require(_0xd120('0x7'));var sox=require(_0xd120('0x8'));var csv=require(_0xd120('0x9'));var ejs=require(_0xd120('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd120('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd120('0xc'));var toCsv=require(_0xd120('0x9'));var querystring=require(_0xd120('0xd'));var Papa=require(_0xd120('0xe'));var Redis=require('ioredis');var authService=require(_0xd120('0xf'));var qs=require(_0xd120('0x10'));var as=require(_0xd120('0x11'));var hardwareService=require(_0xd120('0x12'));var logger=require('../../config/logger')(_0xd120('0x13'));var utils=require(_0xd120('0x14'));var config=require(_0xd120('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd120('0x16'))['db'];function respondWithStatusCode(_0x4daafd,_0x38036b){_0x38036b=_0x38036b||0xcc;return function(_0x551eae){if(_0x551eae){return _0x4daafd['sendStatus'](_0x38036b);}return _0x4daafd[_0xd120('0x17')](_0x38036b)[_0xd120('0x18')]();};}function respondWithResult(_0x5d1702,_0x1ee8de){_0x1ee8de=_0x1ee8de||0xc8;return function(_0x33d417){if(_0x33d417){return _0x5d1702[_0xd120('0x17')](_0x1ee8de)[_0xd120('0x19')](_0x33d417);}};}function respondWithFilteredResult(_0x37e229,_0x1fe0a8){return function(_0x39364e){if(_0x39364e){var _0x32192f=typeof _0x1fe0a8['offset']===_0xd120('0x1a')&&typeof _0x1fe0a8[_0xd120('0x1b')]===_0xd120('0x1a');var _0x265854=_0x39364e[_0xd120('0x1c')];var _0x522e14=_0x32192f?0x0:_0x1fe0a8['offset'];var _0x5c4d01=_0x32192f?_0x39364e['count']:_0x1fe0a8[_0xd120('0x1d')]+_0x1fe0a8[_0xd120('0x1b')];var _0x18ef2c;if(_0x5c4d01>=_0x265854){_0x5c4d01=_0x265854;_0x18ef2c=0xc8;}else{_0x18ef2c=0xce;}_0x37e229[_0xd120('0x17')](_0x18ef2c);return _0x37e229['set'](_0xd120('0x1e'),_0x522e14+'-'+_0x5c4d01+'/'+_0x265854)['json'](_0x39364e);}return null;};}function patchUpdates(_0xf31ed4){return function(_0x356059){try{jsonpatch[_0xd120('0x1f')](_0x356059,_0xf31ed4,!![]);}catch(_0x58f97b){return BPromise[_0xd120('0x20')](_0x58f97b);}return _0x356059[_0xd120('0x21')]();};}function saveUpdates(_0x58b3ab,_0x58dde0){return function(_0x1262a2){if(_0x1262a2){return _0x1262a2[_0xd120('0x22')](_0x58b3ab)[_0xd120('0x23')](function(_0x384454){return _0x384454;});}return null;};}function removeEntity(_0x4fff77,_0x26cfc8){return function(_0x2da038){if(_0x2da038){return _0x2da038[_0xd120('0x24')]()[_0xd120('0x23')](function(){_0x4fff77[_0xd120('0x17')](0xcc)[_0xd120('0x18')]();});}};}function handleEntityNotFound(_0x10ffec,_0xd6883d){return function(_0x10cae3){if(!_0x10cae3){_0x10ffec[_0xd120('0x25')](0x194);}return _0x10cae3;};}function handleError(_0x14cb75,_0x3bc3da){_0x3bc3da=_0x3bc3da||0x1f4;return function(_0x4ea26f){logger[_0xd120('0x26')](_0x4ea26f[_0xd120('0x27')]);if(_0x4ea26f[_0xd120('0x28')]){delete _0x4ea26f[_0xd120('0x28')];}_0x14cb75[_0xd120('0x17')](_0x3bc3da)[_0xd120('0x29')](_0x4ea26f);};}exports[_0xd120('0x2a')]=function(_0x1da4b5,_0x13f844){var _0x25cb1b={},_0x5f2e35={},_0x3626fd={'count':0x0,'rows':[]};var _0x445789=_[_0xd120('0x2b')](db['FreshsalesConfiguration'][_0xd120('0x2c')],function(_0x2c2da0){return{'name':_0x2c2da0['fieldName'],'type':_0x2c2da0['type']['key']};});_0x5f2e35['model']=_['map'](_0x445789,_0xd120('0x28'));_0x5f2e35[_0xd120('0x2d')]=_['keys'](_0x1da4b5['query']);_0x5f2e35[_0xd120('0x2e')]=_[_0xd120('0x2f')](_0x5f2e35['model'],_0x5f2e35[_0xd120('0x2d')]);_0x25cb1b['attributes']=_[_0xd120('0x2f')](_0x5f2e35[_0xd120('0x30')],qs[_0xd120('0x31')](_0x1da4b5[_0xd120('0x2d')]['fields']));_0x25cb1b[_0xd120('0x32')]=_0x25cb1b['attributes'][_0xd120('0x33')]?_0x25cb1b[_0xd120('0x32')]:_0x5f2e35[_0xd120('0x30')];if(!_0x1da4b5[_0xd120('0x2d')][_0xd120('0x34')](_0xd120('0x35'))){_0x25cb1b['limit']=qs[_0xd120('0x1b')](_0x1da4b5[_0xd120('0x2d')][_0xd120('0x1b')]);_0x25cb1b[_0xd120('0x1d')]=qs[_0xd120('0x1d')](_0x1da4b5[_0xd120('0x2d')][_0xd120('0x1d')]);}_0x25cb1b['order']=qs[_0xd120('0x36')](_0x1da4b5[_0xd120('0x2d')]['sort']);_0x25cb1b['where']=qs['filters'](_[_0xd120('0x37')](_0x1da4b5[_0xd120('0x2d')],_0x5f2e35[_0xd120('0x2e')]),_0x445789);if(_0x1da4b5[_0xd120('0x2d')][_0xd120('0x38')]){_0x25cb1b[_0xd120('0x39')]=_[_0xd120('0x3a')](_0x25cb1b[_0xd120('0x39')],{'$or':_['map'](_0x445789,function(_0xb7beb5){if(_0xb7beb5[_0xd120('0x3b')]!==_0xd120('0x3c')){var _0x923968={};_0x923968[_0xb7beb5[_0xd120('0x28')]]={'$like':'%'+_0x1da4b5[_0xd120('0x2d')][_0xd120('0x38')]+'%'};return _0x923968;}})});}_0x25cb1b=_[_0xd120('0x3a')]({},_0x25cb1b,_0x1da4b5[_0xd120('0x3d')]);var _0x4458b0={'where':_0x25cb1b[_0xd120('0x39')]};return db['FreshsalesConfiguration'][_0xd120('0x1c')](_0x4458b0)[_0xd120('0x23')](function(_0x1efd4f){_0x3626fd[_0xd120('0x1c')]=_0x1efd4f;if(_0x1da4b5['query'][_0xd120('0x3e')]){_0x25cb1b['include']=[{'all':!![]}];}return db[_0xd120('0x3f')][_0xd120('0x40')](_0x25cb1b);})['then'](function(_0xe90366){_0x3626fd[_0xd120('0x41')]=_0xe90366;return _0x3626fd;})['then'](respondWithFilteredResult(_0x13f844,_0x25cb1b))[_0xd120('0x42')](handleError(_0x13f844,null));};exports[_0xd120('0x43')]=function(_0x40b272,_0x4c312a){var _0x8ee587={'raw':![],'where':{'id':_0x40b272[_0xd120('0x44')]['id']}},_0x2c6004={};_0x2c6004[_0xd120('0x30')]=_[_0xd120('0x45')](db[_0xd120('0x3f')][_0xd120('0x2c')]);_0x2c6004[_0xd120('0x2d')]=_['keys'](_0x40b272[_0xd120('0x2d')]);_0x2c6004[_0xd120('0x2e')]=_[_0xd120('0x2f')](_0x2c6004[_0xd120('0x30')],_0x2c6004['query']);_0x8ee587['attributes']=_[_0xd120('0x2f')](_0x2c6004[_0xd120('0x30')],qs[_0xd120('0x31')](_0x40b272['query'][_0xd120('0x31')]));_0x8ee587[_0xd120('0x32')]=_0x8ee587[_0xd120('0x32')][_0xd120('0x33')]?_0x8ee587[_0xd120('0x32')]:_0x2c6004['model'];if(_0x40b272[_0xd120('0x2d')][_0xd120('0x3e')]){_0x8ee587[_0xd120('0x46')]=[{'all':!![]}];}_0x8ee587=_[_0xd120('0x3a')]({},_0x8ee587,_0x40b272[_0xd120('0x3d')]);return db[_0xd120('0x3f')][_0xd120('0x47')](_0x8ee587)['then'](handleEntityNotFound(_0x4c312a,null))[_0xd120('0x23')](respondWithResult(_0x4c312a,null))['catch'](handleError(_0x4c312a,null));};exports['create']=function(_0x290954,_0x11e6ab){return db[_0xd120('0x3f')][_0xd120('0x48')](_0x290954[_0xd120('0x49')],{})['then'](respondWithResult(_0x11e6ab,0xc9))[_0xd120('0x42')](handleError(_0x11e6ab,null));};exports[_0xd120('0x22')]=function(_0x1d310e,_0x2748f3){if(_0x1d310e[_0xd120('0x49')]['id']){delete _0x1d310e['body']['id'];}return db[_0xd120('0x3f')][_0xd120('0x47')]({'where':{'id':_0x1d310e[_0xd120('0x44')]['id']}})['then'](handleEntityNotFound(_0x2748f3,null))[_0xd120('0x23')](saveUpdates(_0x1d310e['body'],null))['then'](respondWithResult(_0x2748f3,null))[_0xd120('0x42')](handleError(_0x2748f3,null));};exports['destroy']=function(_0x1b721e,_0x172d2e){return db['FreshsalesConfiguration'][_0xd120('0x47')]({'where':{'id':_0x1b721e[_0xd120('0x44')]['id']}})[_0xd120('0x23')](handleEntityNotFound(_0x172d2e,null))[_0xd120('0x23')](removeEntity(_0x172d2e,null))[_0xd120('0x42')](handleError(_0x172d2e,null));};exports[_0xd120('0x4a')]=function(_0x5f2b14,_0x347443,_0x4a6dc7){var _0x29a519={};var _0x37ac25={};var _0x2e8b51;var _0x540429;return db[_0xd120('0x3f')][_0xd120('0x4b')]({'where':{'id':_0x5f2b14['params']['id']}})[_0xd120('0x23')](handleEntityNotFound(_0x347443,null))[_0xd120('0x23')](function(_0x543771){if(_0x543771){_0x2e8b51=_0x543771;_0x37ac25[_0xd120('0x30')]=_['keys'](db[_0xd120('0x4c')]['rawAttributes']);_0x37ac25['query']=_[_0xd120('0x45')](_0x5f2b14[_0xd120('0x2d')]);_0x37ac25['filters']=_[_0xd120('0x2f')](_0x37ac25[_0xd120('0x30')],_0x37ac25[_0xd120('0x2d')]);_0x29a519['attributes']=_[_0xd120('0x2f')](_0x37ac25[_0xd120('0x30')],qs[_0xd120('0x31')](_0x5f2b14[_0xd120('0x2d')]['fields']));_0x29a519[_0xd120('0x32')]=_0x29a519[_0xd120('0x32')][_0xd120('0x33')]?_0x29a519[_0xd120('0x32')]:_0x37ac25[_0xd120('0x30')];_0x29a519['order']=qs[_0xd120('0x36')](_0x5f2b14['query'][_0xd120('0x36')]);_0x29a519[_0xd120('0x39')]=qs['filters'](_['pick'](_0x5f2b14[_0xd120('0x2d')],_0x37ac25[_0xd120('0x2e')]));if(_0x5f2b14[_0xd120('0x2d')][_0xd120('0x38')]){_0x29a519[_0xd120('0x39')]=_[_0xd120('0x3a')](_0x29a519['where'],{'$or':_[_0xd120('0x2b')](_0x29a519[_0xd120('0x32')],function(_0x375ec5){var _0x49dcbe={};_0x49dcbe[_0x375ec5]={'$like':'%'+_0x5f2b14[_0xd120('0x2d')][_0xd120('0x38')]+'%'};return _0x49dcbe;})});}_0x29a519=_[_0xd120('0x3a')]({},_0x29a519,_0x5f2b14[_0xd120('0x3d')]);return _0x2e8b51[_0xd120('0x4a')](_0x29a519);}})[_0xd120('0x23')](function(_0x3fa1d5){if(_0x3fa1d5){_0x540429=_0x3fa1d5[_0xd120('0x33')];if(!_0x5f2b14['query'][_0xd120('0x34')]('nolimit')){_0x29a519['limit']=qs[_0xd120('0x1b')](_0x5f2b14['query'][_0xd120('0x1b')]);_0x29a519[_0xd120('0x1d')]=qs[_0xd120('0x1d')](_0x5f2b14['query']['offset']);}return _0x2e8b51[_0xd120('0x4a')](_0x29a519);}})['then'](function(_0x29ff1d){if(_0x29ff1d){return _0x29ff1d?{'count':_0x540429,'rows':_0x29ff1d}:null;}})[_0xd120('0x23')](respondWithResult(_0x347443,null))[_0xd120('0x42')](handleError(_0x347443,null));};exports['getDescriptions']=function(_0x3ecf44,_0x3eac1c,_0x748550){var _0x1d6ddf={};var _0x6ea31e={};var _0x4da516;var _0x15a2cb;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3ecf44[_0xd120('0x44')]['id']}})[_0xd120('0x23')](handleEntityNotFound(_0x3eac1c,null))[_0xd120('0x23')](function(_0x34dd96){if(_0x34dd96){_0x4da516=_0x34dd96;_0x6ea31e['model']=_['keys'](db[_0xd120('0x4c')][_0xd120('0x2c')]);_0x6ea31e[_0xd120('0x2d')]=_[_0xd120('0x45')](_0x3ecf44['query']);_0x6ea31e[_0xd120('0x2e')]=_[_0xd120('0x2f')](_0x6ea31e['model'],_0x6ea31e[_0xd120('0x2d')]);_0x1d6ddf[_0xd120('0x32')]=_[_0xd120('0x2f')](_0x6ea31e['model'],qs['fields'](_0x3ecf44[_0xd120('0x2d')][_0xd120('0x31')]));_0x1d6ddf[_0xd120('0x32')]=_0x1d6ddf[_0xd120('0x32')][_0xd120('0x33')]?_0x1d6ddf[_0xd120('0x32')]:_0x6ea31e[_0xd120('0x30')];_0x1d6ddf['order']=qs[_0xd120('0x36')](_0x3ecf44[_0xd120('0x2d')][_0xd120('0x36')]);_0x1d6ddf[_0xd120('0x39')]=qs[_0xd120('0x2e')](_[_0xd120('0x37')](_0x3ecf44[_0xd120('0x2d')],_0x6ea31e[_0xd120('0x2e')]));if(_0x3ecf44[_0xd120('0x2d')][_0xd120('0x38')]){_0x1d6ddf[_0xd120('0x39')]=_['merge'](_0x1d6ddf[_0xd120('0x39')],{'$or':_[_0xd120('0x2b')](_0x1d6ddf[_0xd120('0x32')],function(_0xfb4243){var _0x3f3b83={};_0x3f3b83[_0xfb4243]={'$like':'%'+_0x3ecf44[_0xd120('0x2d')][_0xd120('0x38')]+'%'};return _0x3f3b83;})});}_0x1d6ddf=_[_0xd120('0x3a')]({},_0x1d6ddf,_0x3ecf44[_0xd120('0x3d')]);return _0x4da516['getDescriptions'](_0x1d6ddf);}})[_0xd120('0x23')](function(_0x3e7a7e){if(_0x3e7a7e){_0x15a2cb=_0x3e7a7e[_0xd120('0x33')];if(!_0x3ecf44[_0xd120('0x2d')]['hasOwnProperty']('nolimit')){_0x1d6ddf[_0xd120('0x1b')]=qs[_0xd120('0x1b')](_0x3ecf44[_0xd120('0x2d')][_0xd120('0x1b')]);_0x1d6ddf[_0xd120('0x1d')]=qs[_0xd120('0x1d')](_0x3ecf44['query'][_0xd120('0x1d')]);}return _0x4da516['getDescriptions'](_0x1d6ddf);}})[_0xd120('0x23')](function(_0x5f44cc){if(_0x5f44cc){return _0x5f44cc?{'count':_0x15a2cb,'rows':_0x5f44cc}:null;}})[_0xd120('0x23')](respondWithResult(_0x3eac1c,null))['catch'](handleError(_0x3eac1c,null));};exports['getFields']=function(_0x1eb15e,_0xb591f9,_0x373d72){var _0x1fcc74={};var _0x232aa1={};var _0x35ade5;var _0x3b7b1c;return db[_0xd120('0x3f')][_0xd120('0x4b')]({'where':{'id':_0x1eb15e['params']['id']}})[_0xd120('0x23')](handleEntityNotFound(_0xb591f9,null))[_0xd120('0x23')](function(_0x459d66){if(_0x459d66){_0x35ade5=_0x459d66;_0x232aa1[_0xd120('0x30')]=_['keys'](db[_0xd120('0x4c')]['rawAttributes']);_0x232aa1[_0xd120('0x2d')]=_[_0xd120('0x45')](_0x1eb15e[_0xd120('0x2d')]);_0x232aa1[_0xd120('0x2e')]=_['intersection'](_0x232aa1[_0xd120('0x30')],_0x232aa1['query']);_0x1fcc74['attributes']=_['intersection'](_0x232aa1[_0xd120('0x30')],qs[_0xd120('0x31')](_0x1eb15e[_0xd120('0x2d')][_0xd120('0x31')]));_0x1fcc74['attributes']=_0x1fcc74['attributes'][_0xd120('0x33')]?_0x1fcc74[_0xd120('0x32')]:_0x232aa1[_0xd120('0x30')];_0x1fcc74[_0xd120('0x4d')]=qs[_0xd120('0x36')](_0x1eb15e[_0xd120('0x2d')][_0xd120('0x36')]);_0x1fcc74[_0xd120('0x39')]=qs[_0xd120('0x2e')](_[_0xd120('0x37')](_0x1eb15e[_0xd120('0x2d')],_0x232aa1[_0xd120('0x2e')]));if(_0x1eb15e[_0xd120('0x2d')][_0xd120('0x38')]){_0x1fcc74[_0xd120('0x39')]=_['merge'](_0x1fcc74[_0xd120('0x39')],{'$or':_['map'](_0x1fcc74[_0xd120('0x32')],function(_0x3997c6){var _0x54ceca={};_0x54ceca[_0x3997c6]={'$like':'%'+_0x1eb15e[_0xd120('0x2d')][_0xd120('0x38')]+'%'};return _0x54ceca;})});}_0x1fcc74=_['merge']({},_0x1fcc74,_0x1eb15e['options']);return _0x35ade5[_0xd120('0x4e')](_0x1fcc74);}})['then'](function(_0x50b60a){if(_0x50b60a){_0x3b7b1c=_0x50b60a['length'];if(!_0x1eb15e[_0xd120('0x2d')]['hasOwnProperty'](_0xd120('0x35'))){_0x1fcc74[_0xd120('0x1b')]=qs[_0xd120('0x1b')](_0x1eb15e[_0xd120('0x2d')][_0xd120('0x1b')]);_0x1fcc74[_0xd120('0x1d')]=qs[_0xd120('0x1d')](_0x1eb15e[_0xd120('0x2d')][_0xd120('0x1d')]);}return _0x35ade5[_0xd120('0x4e')](_0x1fcc74);}})[_0xd120('0x23')](function(_0x5dd12d){if(_0x5dd12d){return _0x5dd12d?{'count':_0x3b7b1c,'rows':_0x5dd12d}:null;}})[_0xd120('0x23')](respondWithResult(_0xb591f9,null))[_0xd120('0x42')](handleError(_0xb591f9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c8f722d..f7c7aca 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 _0xacf3=['api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','../../config/logger'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0xacf3,0x184));var _0x3acf=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xacf3[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x3acf('0x0'));var util=require('util');var logger=require(_0x3acf('0x1'))(_0x3acf('0x2'));var moment=require(_0x3acf('0x3'));var BPromise=require(_0x3acf('0x4'));var rp=require(_0x3acf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3acf('0x6'));var attributes=require(_0x3acf('0x7'));module['exports']=function(_0x11a9e7,_0x2dcc50){return _0x11a9e7[_0x3acf('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x3acf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1941=['util','../../config/logger','api','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x4f0f6d,_0x28b6f4){var _0x2b2c98=function(_0x433703){while(--_0x433703){_0x4f0f6d['push'](_0x4f0f6d['shift']());}};_0x2b2c98(++_0x28b6f4);}(_0x1941,0x13e));var _0x1194=function(_0x54c1b8,_0x240280){_0x54c1b8=_0x54c1b8-0x0;var _0x1eda32=_0x1941[_0x54c1b8];return _0x1eda32;};'use strict';var _=require(_0x1194('0x0'));var util=require(_0x1194('0x1'));var logger=require(_0x1194('0x2'))(_0x1194('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1194('0x4'));var fs=require('fs');var path=require(_0x1194('0x5'));var rimraf=require('rimraf');var config=require(_0x1194('0x6'));var attributes=require(_0x1194('0x7'));module[_0x1194('0x8')]=function(_0x5412a4,_0x5a1c6b){return _0x5412a4['define'](_0x1194('0x9'),attributes,{'tableName':_0x1194('0xa'),'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 9e2da00..6142eec 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 _0xa56d=['result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x56c957,_0x53fb93){var _0x1c9833=function(_0x11330b){while(--_0x11330b){_0x56c957['push'](_0x56c957['shift']());}};_0x1c9833(++_0x53fb93);}(_0xa56d,0x1cf));var _0xda56=function(_0x1df172,_0x2b1236){_0x1df172=_0x1df172-0x0;var _0x221797=_0xa56d[_0x1df172];return _0x221797;};'use strict';var _=require('lodash');var util=require(_0xda56('0x0'));var moment=require('moment');var BPromise=require(_0xda56('0x1'));var rs=require(_0xda56('0x2'));var fs=require('fs');var Redis=require(_0xda56('0x3'));var db=require(_0xda56('0x4'))['db'];var utils=require(_0xda56('0x5'));var logger=require(_0xda56('0x6'))(_0xda56('0x7'));var config=require(_0xda56('0x8'));var jayson=require(_0xda56('0x9'));var client=jayson[_0xda56('0xa')][_0xda56('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ba46d,_0x39510d,_0x52e13e){return new BPromise(function(_0x1b244d,_0x391bb0){return client['request'](_0x1ba46d,_0x52e13e)['then'](function(_0x1c6a8a){logger[_0xda56('0xc')](_0xda56('0xd'),_0x39510d,_0xda56('0xe'));logger[_0xda56('0xf')](_0xda56('0x10'),_0x39510d,_0xda56('0xe'),JSON[_0xda56('0x11')](_0x1c6a8a));if(_0x1c6a8a[_0xda56('0x12')]){if(_0x1c6a8a['error'][_0xda56('0x13')]===0x1f4){logger[_0xda56('0x12')](_0xda56('0xd'),_0x39510d,_0x1c6a8a[_0xda56('0x12')][_0xda56('0x14')]);return _0x391bb0(_0x1c6a8a[_0xda56('0x12')]['message']);}logger[_0xda56('0x12')](_0xda56('0xd'),_0x39510d,_0x1c6a8a[_0xda56('0x12')][_0xda56('0x14')]);return _0x1b244d(_0x1c6a8a['error'][_0xda56('0x14')]);}else{logger['info'](_0xda56('0xd'),_0x39510d,_0xda56('0xe'));_0x1b244d(_0x1c6a8a[_0xda56('0x15')]['message']);}})['catch'](function(_0x2f0df4){logger[_0xda56('0x12')](_0xda56('0xd'),_0x39510d,_0x2f0df4);_0x391bb0(_0x2f0df4);});});} \ No newline at end of file +var _0xd534=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd534,0x182));var _0x4d53=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd534[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x4d53('0x0'));var moment=require(_0x4d53('0x1'));var BPromise=require(_0x4d53('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d53('0x3'));var db=require(_0x4d53('0x4'))['db'];var utils=require(_0x4d53('0x5'));var logger=require(_0x4d53('0x6'))(_0x4d53('0x7'));var config=require(_0x4d53('0x8'));var jayson=require(_0x4d53('0x9'));var client=jayson[_0x4d53('0xa')][_0x4d53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5351f8,_0x170c23,_0x3bf002){return new BPromise(function(_0x52a817,_0x51ee2c){return client[_0x4d53('0xc')](_0x5351f8,_0x3bf002)[_0x4d53('0xd')](function(_0x37fbb8){logger[_0x4d53('0xe')](_0x4d53('0xf'),_0x170c23,_0x4d53('0x10'));logger[_0x4d53('0x11')](_0x4d53('0x12'),_0x170c23,_0x4d53('0x10'),JSON[_0x4d53('0x13')](_0x37fbb8));if(_0x37fbb8[_0x4d53('0x14')]){if(_0x37fbb8[_0x4d53('0x14')][_0x4d53('0x15')]===0x1f4){logger['error'](_0x4d53('0xf'),_0x170c23,_0x37fbb8['error'][_0x4d53('0x16')]);return _0x51ee2c(_0x37fbb8[_0x4d53('0x14')][_0x4d53('0x16')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x170c23,_0x37fbb8['error'][_0x4d53('0x16')]);return _0x52a817(_0x37fbb8[_0x4d53('0x14')][_0x4d53('0x16')]);}else{logger[_0x4d53('0xe')](_0x4d53('0xf'),_0x170c23,_0x4d53('0x10'));_0x52a817(_0x37fbb8['result'][_0x4d53('0x16')]);}})['catch'](function(_0x5014ab){logger['error'](_0x4d53('0xf'),_0x170c23,_0x5014ab);_0x51ee2c(_0x5014ab);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 4991ca1..2e0b5d5 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 _0x43fd=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3480f4,_0x153a97){var _0x293b02=function(_0x812b30){while(--_0x812b30){_0x3480f4['push'](_0x3480f4['shift']());}};_0x293b02(++_0x153a97);}(_0x43fd,0x150));var _0xd43f=function(_0xb4b8bb,_0x51bb4b){_0xb4b8bb=_0xb4b8bb-0x0;var _0x95b430=_0x43fd[_0xb4b8bb];return _0x95b430;};'use strict';var multer=require(_0xd43f('0x0'));var util=require(_0xd43f('0x1'));var path=require('path');var timeout=require(_0xd43f('0x2'));var express=require('express');var router=express[_0xd43f('0x3')]();var fs_extra=require(_0xd43f('0x4'));var auth=require(_0xd43f('0x5'));var interaction=require(_0xd43f('0x6'));var config=require(_0xd43f('0x7'));var controller=require(_0xd43f('0x8'));router[_0xd43f('0x9')]('/',auth[_0xd43f('0xa')](),controller[_0xd43f('0xb')]);router[_0xd43f('0x9')](_0xd43f('0xc'),auth[_0xd43f('0xa')](),controller[_0xd43f('0xd')]);router[_0xd43f('0xe')]('/',auth['isAuthenticated'](),controller[_0xd43f('0xf')]);router[_0xd43f('0x10')](_0xd43f('0xc'),auth['isAuthenticated'](),controller[_0xd43f('0x11')]);router[_0xd43f('0x12')]('/:id',auth[_0xd43f('0xa')](),controller[_0xd43f('0x13')]);module[_0xd43f('0x14')]=router; \ No newline at end of file +var _0x3756=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','multer','util'];(function(_0x4e40db,_0x2499ad){var _0x832e9c=function(_0x41206e){while(--_0x41206e){_0x4e40db['push'](_0x4e40db['shift']());}};_0x832e9c(++_0x2499ad);}(_0x3756,0x116));var _0x6375=function(_0x18748e,_0x4ac47e){_0x18748e=_0x18748e-0x0;var _0x225284=_0x3756[_0x18748e];return _0x225284;};'use strict';var multer=require(_0x6375('0x0'));var util=require(_0x6375('0x1'));var path=require(_0x6375('0x2'));var timeout=require(_0x6375('0x3'));var express=require(_0x6375('0x4'));var router=express[_0x6375('0x5')]();var fs_extra=require(_0x6375('0x6'));var auth=require(_0x6375('0x7'));var interaction=require(_0x6375('0x8'));var config=require(_0x6375('0x9'));var controller=require(_0x6375('0xa'));router[_0x6375('0xb')]('/',auth[_0x6375('0xc')](),controller[_0x6375('0xd')]);router[_0x6375('0xb')](_0x6375('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6375('0xf')]('/',auth[_0x6375('0xc')](),controller[_0x6375('0x10')]);router[_0x6375('0x11')](_0x6375('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x6375('0x12')](_0x6375('0xe'),auth[_0x6375('0xc')](),controller[_0x6375('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 32fd676..9927ecb 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 _0xa115=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xa115,0x1e5));var _0x5a11=function(_0x3e95fd,_0x117176){_0x3e95fd=_0x3e95fd-0x0;var _0x44a83f=_0xa115[_0x3e95fd];return _0x44a83f;};'use strict';var Sequelize=require(_0x5a11('0x0'));module[_0x5a11('0x1')]={'type':{'type':Sequelize[_0x5a11('0x2')](_0x5a11('0x3'),_0x5a11('0x4'),_0x5a11('0x5'),_0x5a11('0x6'),_0x5a11('0x7')),'defaultValue':_0x5a11('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5a11('0x8')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x5a11('0x8')]},'idField':{'type':Sequelize[_0x5a11('0x8')]},'nameField':{'type':Sequelize[_0x5a11('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a11('0x8')]}}; \ No newline at end of file +var _0x92c8=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x4193fc,_0x2b7bf5){var _0x541099=function(_0x582767){while(--_0x582767){_0x4193fc['push'](_0x4193fc['shift']());}};_0x541099(++_0x2b7bf5);}(_0x92c8,0x1c1));var _0x892c=function(_0x38887e,_0x2866bd){_0x38887e=_0x38887e-0x0;var _0xd175b4=_0x92c8[_0x38887e];return _0xd175b4;};'use strict';var Sequelize=require(_0x892c('0x0'));module[_0x892c('0x1')]={'type':{'type':Sequelize[_0x892c('0x2')](_0x892c('0x3'),_0x892c('0x4'),_0x892c('0x5'),_0x892c('0x6'),_0x892c('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x892c('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x892c('0x3'),_0x892c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x892c('0x8')]},'idField':{'type':Sequelize[_0x892c('0x8')]},'nameField':{'type':Sequelize[_0x892c('0x8')]},'customField':{'type':Sequelize[_0x892c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x892c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 9720bdd..07a4bdf 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 _0xd568=['key','query','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','include','rows','catch','show','keys','find','create','body','update','params','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','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/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type'];(function(_0x5da0e3,_0x27454c){var _0x1e8759=function(_0x16c960){while(--_0x16c960){_0x5da0e3['push'](_0x5da0e3['shift']());}};_0x1e8759(++_0x27454c);}(_0xd568,0x183));var _0x8d56=function(_0x4e7d41,_0x347526){_0x4e7d41=_0x4e7d41-0x0;var _0x4528ed=_0xd568[_0x4e7d41];return _0x4528ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d56('0x0'));var zipdir=require(_0x8d56('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d56('0x2'));var moment=require(_0x8d56('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8d56('0x4'));var util=require('util');var path=require(_0x8d56('0x5'));var sox=require('sox');var csv=require(_0x8d56('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d56('0x7'));var squel=require(_0x8d56('0x8'));var crypto=require(_0x8d56('0x9'));var jsforce=require(_0x8d56('0xa'));var deskjs=require(_0x8d56('0xb'));var toCsv=require(_0x8d56('0x6'));var querystring=require(_0x8d56('0xc'));var Papa=require(_0x8d56('0xd'));var Redis=require(_0x8d56('0xe'));var authService=require(_0x8d56('0xf'));var qs=require(_0x8d56('0x10'));var as=require(_0x8d56('0x11'));var hardwareService=require(_0x8d56('0x12'));var logger=require('../../config/logger')(_0x8d56('0x13'));var utils=require(_0x8d56('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8d56('0x15'));var db=require(_0x8d56('0x16'))['db'];function respondWithStatusCode(_0x1505c2,_0x15cb57){_0x15cb57=_0x15cb57||0xcc;return function(_0x202155){if(_0x202155){return _0x1505c2[_0x8d56('0x17')](_0x15cb57);}return _0x1505c2['status'](_0x15cb57)['end']();};}function respondWithResult(_0x5902a4,_0x244023){_0x244023=_0x244023||0xc8;return function(_0x330c60){if(_0x330c60){return _0x5902a4[_0x8d56('0x18')](_0x244023)[_0x8d56('0x19')](_0x330c60);}};}function respondWithFilteredResult(_0x231609,_0x1b79be){return function(_0x29ee8e){if(_0x29ee8e){var _0x27d802=typeof _0x1b79be['offset']===_0x8d56('0x1a')&&typeof _0x1b79be['limit']===_0x8d56('0x1a');var _0x256b6e=_0x29ee8e['count'];var _0x26feab=_0x27d802?0x0:_0x1b79be[_0x8d56('0x1b')];var _0x35226e=_0x27d802?_0x29ee8e['count']:_0x1b79be[_0x8d56('0x1b')]+_0x1b79be[_0x8d56('0x1c')];var _0x558fbf;if(_0x35226e>=_0x256b6e){_0x35226e=_0x256b6e;_0x558fbf=0xc8;}else{_0x558fbf=0xce;}_0x231609[_0x8d56('0x18')](_0x558fbf);return _0x231609['set'](_0x8d56('0x1d'),_0x26feab+'-'+_0x35226e+'/'+_0x256b6e)[_0x8d56('0x19')](_0x29ee8e);}return null;};}function patchUpdates(_0xe7e658){return function(_0x50fed5){try{jsonpatch[_0x8d56('0x1e')](_0x50fed5,_0xe7e658,!![]);}catch(_0x5d6e6d){return BPromise[_0x8d56('0x1f')](_0x5d6e6d);}return _0x50fed5[_0x8d56('0x20')]();};}function saveUpdates(_0x5a96c9,_0x2d137f){return function(_0x17d3c5){if(_0x17d3c5){return _0x17d3c5['update'](_0x5a96c9)[_0x8d56('0x21')](function(_0x2690f5){return _0x2690f5;});}return null;};}function removeEntity(_0x2d6d4f,_0x5ec23b){return function(_0x338b6d){if(_0x338b6d){return _0x338b6d[_0x8d56('0x22')]()[_0x8d56('0x21')](function(){_0x2d6d4f[_0x8d56('0x18')](0xcc)[_0x8d56('0x23')]();});}};}function handleEntityNotFound(_0x1116bc,_0x27f4be){return function(_0x503cd2){if(!_0x503cd2){_0x1116bc[_0x8d56('0x17')](0x194);}return _0x503cd2;};}function handleError(_0x591472,_0x538545){_0x538545=_0x538545||0x1f4;return function(_0xfff456){logger[_0x8d56('0x24')](_0xfff456[_0x8d56('0x25')]);if(_0xfff456[_0x8d56('0x26')]){delete _0xfff456[_0x8d56('0x26')];}_0x591472[_0x8d56('0x18')](_0x538545)['send'](_0xfff456);};}exports[_0x8d56('0x27')]=function(_0x5b63de,_0x4f1e73){var _0x1f5840={},_0x9f1cf8={},_0x17f97b={'count':0x0,'rows':[]};var _0x2776bb=_[_0x8d56('0x28')](db[_0x8d56('0x29')][_0x8d56('0x2a')],function(_0x166aaa){return{'name':_0x166aaa[_0x8d56('0x2b')],'type':_0x166aaa[_0x8d56('0x2c')][_0x8d56('0x2d')]};});_0x9f1cf8['model']=_['map'](_0x2776bb,_0x8d56('0x26'));_0x9f1cf8[_0x8d56('0x2e')]=_['keys'](_0x5b63de[_0x8d56('0x2e')]);_0x9f1cf8[_0x8d56('0x2f')]=_[_0x8d56('0x30')](_0x9f1cf8[_0x8d56('0x31')],_0x9f1cf8[_0x8d56('0x2e')]);_0x1f5840[_0x8d56('0x32')]=_[_0x8d56('0x30')](_0x9f1cf8[_0x8d56('0x31')],qs[_0x8d56('0x33')](_0x5b63de[_0x8d56('0x2e')][_0x8d56('0x33')]));_0x1f5840['attributes']=_0x1f5840[_0x8d56('0x32')][_0x8d56('0x34')]?_0x1f5840['attributes']:_0x9f1cf8['model'];if(!_0x5b63de['query']['hasOwnProperty']('nolimit')){_0x1f5840[_0x8d56('0x1c')]=qs[_0x8d56('0x1c')](_0x5b63de[_0x8d56('0x2e')][_0x8d56('0x1c')]);_0x1f5840['offset']=qs[_0x8d56('0x1b')](_0x5b63de[_0x8d56('0x2e')][_0x8d56('0x1b')]);}_0x1f5840[_0x8d56('0x35')]=qs[_0x8d56('0x36')](_0x5b63de[_0x8d56('0x2e')][_0x8d56('0x36')]);_0x1f5840['where']=qs[_0x8d56('0x2f')](_[_0x8d56('0x37')](_0x5b63de[_0x8d56('0x2e')],_0x9f1cf8[_0x8d56('0x2f')]),_0x2776bb);if(_0x5b63de[_0x8d56('0x2e')][_0x8d56('0x38')]){_0x1f5840['where']=_[_0x8d56('0x39')](_0x1f5840[_0x8d56('0x3a')],{'$or':_[_0x8d56('0x28')](_0x2776bb,function(_0x2b5ac6){if(_0x2b5ac6[_0x8d56('0x2c')]!==_0x8d56('0x3b')){var _0x206f8c={};_0x206f8c[_0x2b5ac6[_0x8d56('0x26')]]={'$like':'%'+_0x5b63de[_0x8d56('0x2e')][_0x8d56('0x38')]+'%'};return _0x206f8c;}})});}_0x1f5840=_[_0x8d56('0x39')]({},_0x1f5840,_0x5b63de['options']);var _0x17155a={'where':_0x1f5840[_0x8d56('0x3a')]};return db['FreshsalesField']['count'](_0x17155a)[_0x8d56('0x21')](function(_0x259d98){_0x17f97b[_0x8d56('0x3c')]=_0x259d98;if(_0x5b63de['query'][_0x8d56('0x3d')]){_0x1f5840[_0x8d56('0x3e')]=[{'all':!![]}];}return db[_0x8d56('0x29')]['findAll'](_0x1f5840);})[_0x8d56('0x21')](function(_0x19d686){_0x17f97b[_0x8d56('0x3f')]=_0x19d686;return _0x17f97b;})[_0x8d56('0x21')](respondWithFilteredResult(_0x4f1e73,_0x1f5840))[_0x8d56('0x40')](handleError(_0x4f1e73,null));};exports[_0x8d56('0x41')]=function(_0x5b1b10,_0x35574c){var _0x1e4d55={'raw':!![],'where':{'id':_0x5b1b10['params']['id']}},_0x1d0219={};_0x1d0219[_0x8d56('0x31')]=_[_0x8d56('0x42')](db[_0x8d56('0x29')]['rawAttributes']);_0x1d0219[_0x8d56('0x2e')]=_[_0x8d56('0x42')](_0x5b1b10[_0x8d56('0x2e')]);_0x1d0219[_0x8d56('0x2f')]=_['intersection'](_0x1d0219[_0x8d56('0x31')],_0x1d0219['query']);_0x1e4d55[_0x8d56('0x32')]=_[_0x8d56('0x30')](_0x1d0219['model'],qs[_0x8d56('0x33')](_0x5b1b10['query']['fields']));_0x1e4d55[_0x8d56('0x32')]=_0x1e4d55[_0x8d56('0x32')][_0x8d56('0x34')]?_0x1e4d55[_0x8d56('0x32')]:_0x1d0219[_0x8d56('0x31')];if(_0x5b1b10[_0x8d56('0x2e')][_0x8d56('0x3d')]){_0x1e4d55[_0x8d56('0x3e')]=[{'all':!![]}];}_0x1e4d55=_['merge']({},_0x1e4d55,_0x5b1b10['options']);return db[_0x8d56('0x29')][_0x8d56('0x43')](_0x1e4d55)[_0x8d56('0x21')](handleEntityNotFound(_0x35574c,null))[_0x8d56('0x21')](respondWithResult(_0x35574c,null))[_0x8d56('0x40')](handleError(_0x35574c,null));};exports[_0x8d56('0x44')]=function(_0x21ebb5,_0x4c9356){return db[_0x8d56('0x29')][_0x8d56('0x44')](_0x21ebb5[_0x8d56('0x45')],{})[_0x8d56('0x21')](respondWithResult(_0x4c9356,0xc9))[_0x8d56('0x40')](handleError(_0x4c9356,null));};exports[_0x8d56('0x46')]=function(_0x533fe2,_0x3b5af0){if(_0x533fe2[_0x8d56('0x45')]['id']){delete _0x533fe2[_0x8d56('0x45')]['id'];}return db['FreshsalesField'][_0x8d56('0x43')]({'where':{'id':_0x533fe2[_0x8d56('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b5af0,null))[_0x8d56('0x21')](saveUpdates(_0x533fe2[_0x8d56('0x45')],null))[_0x8d56('0x21')](respondWithResult(_0x3b5af0,null))[_0x8d56('0x40')](handleError(_0x3b5af0,null));};exports['destroy']=function(_0x1f9ecd,_0x305cfa){return db[_0x8d56('0x29')][_0x8d56('0x43')]({'where':{'id':_0x1f9ecd[_0x8d56('0x47')]['id']}})[_0x8d56('0x21')](handleEntityNotFound(_0x305cfa,null))['then'](removeEntity(_0x305cfa,null))['catch'](handleError(_0x305cfa,null));}; \ No newline at end of file +var _0xe1ce=['update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','catch','create','body'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe1ce,0xda));var _0xee1c=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xe1ce[_0x56916d];return _0x2b7f1f;};'use strict';var emlformat=require(_0xee1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee1c('0x1'));var jsonpatch=require(_0xee1c('0x2'));var rp=require(_0xee1c('0x3'));var moment=require(_0xee1c('0x4'));var BPromise=require(_0xee1c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xee1c('0x6'));var sox=require(_0xee1c('0x7'));var csv=require(_0xee1c('0x8'));var ejs=require(_0xee1c('0x9'));var fs=require('fs');var fs_extra=require(_0xee1c('0xa'));var _=require('lodash');var squel=require(_0xee1c('0xb'));var crypto=require(_0xee1c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xee1c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee1c('0xe'));var Redis=require(_0xee1c('0xf'));var authService=require(_0xee1c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xee1c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee1c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee1c('0x13'))['db'];function respondWithStatusCode(_0x263568,_0x1fb7da){_0x1fb7da=_0x1fb7da||0xcc;return function(_0x5db599){if(_0x5db599){return _0x263568[_0xee1c('0x14')](_0x1fb7da);}return _0x263568[_0xee1c('0x15')](_0x1fb7da)[_0xee1c('0x16')]();};}function respondWithResult(_0x445422,_0x131d4d){_0x131d4d=_0x131d4d||0xc8;return function(_0x357408){if(_0x357408){return _0x445422[_0xee1c('0x15')](_0x131d4d)[_0xee1c('0x17')](_0x357408);}};}function respondWithFilteredResult(_0x3991ef,_0x3e9f8e){return function(_0x2a7f85){if(_0x2a7f85){var _0x531399=typeof _0x3e9f8e[_0xee1c('0x18')]===_0xee1c('0x19')&&typeof _0x3e9f8e[_0xee1c('0x1a')]===_0xee1c('0x19');var _0xfdc313=_0x2a7f85[_0xee1c('0x1b')];var _0x1a3f8a=_0x531399?0x0:_0x3e9f8e[_0xee1c('0x18')];var _0x28a2a8=_0x531399?_0x2a7f85['count']:_0x3e9f8e[_0xee1c('0x18')]+_0x3e9f8e[_0xee1c('0x1a')];var _0x489335;if(_0x28a2a8>=_0xfdc313){_0x28a2a8=_0xfdc313;_0x489335=0xc8;}else{_0x489335=0xce;}_0x3991ef[_0xee1c('0x15')](_0x489335);return _0x3991ef[_0xee1c('0x1c')]('Content-Range',_0x1a3f8a+'-'+_0x28a2a8+'/'+_0xfdc313)[_0xee1c('0x17')](_0x2a7f85);}return null;};}function patchUpdates(_0x5bbbbf){return function(_0x3a80b6){try{jsonpatch['apply'](_0x3a80b6,_0x5bbbbf,!![]);}catch(_0x3ad9d1){return BPromise[_0xee1c('0x1d')](_0x3ad9d1);}return _0x3a80b6[_0xee1c('0x1e')]();};}function saveUpdates(_0x427528,_0xafea8e){return function(_0x14a852){if(_0x14a852){return _0x14a852['update'](_0x427528)['then'](function(_0x2c35e1){return _0x2c35e1;});}return null;};}function removeEntity(_0x366b08,_0x38a8cd){return function(_0xf9dd97){if(_0xf9dd97){return _0xf9dd97[_0xee1c('0x1f')]()[_0xee1c('0x20')](function(){_0x366b08['status'](0xcc)[_0xee1c('0x16')]();});}};}function handleEntityNotFound(_0x32eddf,_0x25c460){return function(_0x383a17){if(!_0x383a17){_0x32eddf[_0xee1c('0x14')](0x194);}return _0x383a17;};}function handleError(_0x12981f,_0x72beee){_0x72beee=_0x72beee||0x1f4;return function(_0x85add6){logger[_0xee1c('0x21')](_0x85add6[_0xee1c('0x22')]);if(_0x85add6[_0xee1c('0x23')]){delete _0x85add6[_0xee1c('0x23')];}_0x12981f[_0xee1c('0x15')](_0x72beee)[_0xee1c('0x24')](_0x85add6);};}exports[_0xee1c('0x25')]=function(_0x4bdaa7,_0x5216ec){var _0x3ce809={},_0x45ff16={},_0x3f668a={'count':0x0,'rows':[]};var _0xd5f07f=_[_0xee1c('0x26')](db[_0xee1c('0x27')][_0xee1c('0x28')],function(_0x16afc0){return{'name':_0x16afc0[_0xee1c('0x29')],'type':_0x16afc0[_0xee1c('0x2a')][_0xee1c('0x2b')]};});_0x45ff16[_0xee1c('0x2c')]=_['map'](_0xd5f07f,'name');_0x45ff16[_0xee1c('0x2d')]=_['keys'](_0x4bdaa7[_0xee1c('0x2d')]);_0x45ff16['filters']=_[_0xee1c('0x2e')](_0x45ff16['model'],_0x45ff16['query']);_0x3ce809[_0xee1c('0x2f')]=_[_0xee1c('0x2e')](_0x45ff16[_0xee1c('0x2c')],qs[_0xee1c('0x30')](_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x30')]));_0x3ce809[_0xee1c('0x2f')]=_0x3ce809[_0xee1c('0x2f')][_0xee1c('0x31')]?_0x3ce809['attributes']:_0x45ff16[_0xee1c('0x2c')];if(!_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x32')]('nolimit')){_0x3ce809[_0xee1c('0x1a')]=qs['limit'](_0x4bdaa7[_0xee1c('0x2d')]['limit']);_0x3ce809['offset']=qs[_0xee1c('0x18')](_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x18')]);}_0x3ce809[_0xee1c('0x33')]=qs[_0xee1c('0x34')](_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x34')]);_0x3ce809[_0xee1c('0x35')]=qs['filters'](_[_0xee1c('0x36')](_0x4bdaa7['query'],_0x45ff16[_0xee1c('0x37')]),_0xd5f07f);if(_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x38')]){_0x3ce809[_0xee1c('0x35')]=_[_0xee1c('0x39')](_0x3ce809[_0xee1c('0x35')],{'$or':_[_0xee1c('0x26')](_0xd5f07f,function(_0x4fef66){if(_0x4fef66[_0xee1c('0x2a')]!==_0xee1c('0x3a')){var _0x581237={};_0x581237[_0x4fef66[_0xee1c('0x23')]]={'$like':'%'+_0x4bdaa7['query'][_0xee1c('0x38')]+'%'};return _0x581237;}})});}_0x3ce809=_['merge']({},_0x3ce809,_0x4bdaa7['options']);var _0x391e17={'where':_0x3ce809[_0xee1c('0x35')]};return db[_0xee1c('0x27')][_0xee1c('0x1b')](_0x391e17)[_0xee1c('0x20')](function(_0x31a2d8){_0x3f668a[_0xee1c('0x1b')]=_0x31a2d8;if(_0x4bdaa7[_0xee1c('0x2d')][_0xee1c('0x3b')]){_0x3ce809[_0xee1c('0x3c')]=[{'all':!![]}];}return db[_0xee1c('0x27')][_0xee1c('0x3d')](_0x3ce809);})[_0xee1c('0x20')](function(_0x1953b4){_0x3f668a[_0xee1c('0x3e')]=_0x1953b4;return _0x3f668a;})[_0xee1c('0x20')](respondWithFilteredResult(_0x5216ec,_0x3ce809))['catch'](handleError(_0x5216ec,null));};exports[_0xee1c('0x3f')]=function(_0x3fc6a5,_0x330862){var _0x447e8b={'raw':!![],'where':{'id':_0x3fc6a5['params']['id']}},_0x48e976={};_0x48e976[_0xee1c('0x2c')]=_[_0xee1c('0x40')](db[_0xee1c('0x27')]['rawAttributes']);_0x48e976[_0xee1c('0x2d')]=_[_0xee1c('0x40')](_0x3fc6a5['query']);_0x48e976[_0xee1c('0x37')]=_[_0xee1c('0x2e')](_0x48e976[_0xee1c('0x2c')],_0x48e976[_0xee1c('0x2d')]);_0x447e8b[_0xee1c('0x2f')]=_['intersection'](_0x48e976['model'],qs['fields'](_0x3fc6a5[_0xee1c('0x2d')][_0xee1c('0x30')]));_0x447e8b[_0xee1c('0x2f')]=_0x447e8b[_0xee1c('0x2f')][_0xee1c('0x31')]?_0x447e8b['attributes']:_0x48e976[_0xee1c('0x2c')];if(_0x3fc6a5[_0xee1c('0x2d')][_0xee1c('0x3b')]){_0x447e8b[_0xee1c('0x3c')]=[{'all':!![]}];}_0x447e8b=_[_0xee1c('0x39')]({},_0x447e8b,_0x3fc6a5[_0xee1c('0x41')]);return db[_0xee1c('0x27')][_0xee1c('0x42')](_0x447e8b)[_0xee1c('0x20')](handleEntityNotFound(_0x330862,null))['then'](respondWithResult(_0x330862,null))[_0xee1c('0x43')](handleError(_0x330862,null));};exports[_0xee1c('0x44')]=function(_0x12c96b,_0x5b6687){return db[_0xee1c('0x27')][_0xee1c('0x44')](_0x12c96b[_0xee1c('0x45')],{})[_0xee1c('0x20')](respondWithResult(_0x5b6687,0xc9))[_0xee1c('0x43')](handleError(_0x5b6687,null));};exports[_0xee1c('0x46')]=function(_0x5e6918,_0x5f023c){if(_0x5e6918[_0xee1c('0x45')]['id']){delete _0x5e6918[_0xee1c('0x45')]['id'];}return db[_0xee1c('0x27')][_0xee1c('0x42')]({'where':{'id':_0x5e6918['params']['id']}})[_0xee1c('0x20')](handleEntityNotFound(_0x5f023c,null))[_0xee1c('0x20')](saveUpdates(_0x5e6918[_0xee1c('0x45')],null))[_0xee1c('0x20')](respondWithResult(_0x5f023c,null))['catch'](handleError(_0x5f023c,null));};exports[_0xee1c('0x1f')]=function(_0x26c933,_0x1f2c69){return db[_0xee1c('0x27')][_0xee1c('0x42')]({'where':{'id':_0x26c933[_0xee1c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f2c69,null))[_0xee1c('0x20')](removeEntity(_0x1f2c69,null))[_0xee1c('0x43')](handleError(_0x1f2c69,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0ad446d..ca70080 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 _0x0bb4=['api','moment','bluebird','request-promise','rimraf','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','idField','lodash','util'];(function(_0x11e8e0,_0x41e389){var _0x4df7dc=function(_0x4c4aed){while(--_0x4c4aed){_0x11e8e0['push'](_0x11e8e0['shift']());}};_0x4df7dc(++_0x41e389);}(_0x0bb4,0x77));var _0x40bb=function(_0x116839,_0x511619){_0x116839=_0x116839-0x0;var _0x21c1ce=_0x0bb4[_0x116839];return _0x21c1ce;};'use strict';var _=require(_0x40bb('0x0'));var util=require(_0x40bb('0x1'));var logger=require('../../config/logger')(_0x40bb('0x2'));var moment=require(_0x40bb('0x3'));var BPromise=require(_0x40bb('0x4'));var rp=require(_0x40bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x40bb('0x7'));module['exports']=function(_0xa8c628,_0xe75667){return _0xa8c628['define'](_0x40bb('0x8'),attributes,{'tableName':_0x40bb('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x40bb('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f42=['api','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','lodash','util','../../config/logger'];(function(_0x121d21,_0x3d5dca){var _0xd80c4e=function(_0x33e61a){while(--_0x33e61a){_0x121d21['push'](_0x121d21['shift']());}};_0xd80c4e(++_0x3d5dca);}(_0x0f42,0x126));var _0x20f4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0f42[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x20f4('0x0'));var util=require(_0x20f4('0x1'));var logger=require(_0x20f4('0x2'))(_0x20f4('0x3'));var moment=require('moment');var BPromise=require(_0x20f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20f4('0x5'));var rimraf=require('rimraf');var config=require(_0x20f4('0x6'));var attributes=require(_0x20f4('0x7'));module[_0x20f4('0x8')]=function(_0x4c3214,_0x435359){return _0x4c3214[_0x20f4('0x9')]('FreshsalesField',attributes,{'tableName':_0x20f4('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 105936d..0a69b6d 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 _0x6d38=['request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x17d8e5,_0x253683){var _0x1b6389=function(_0x45e570){while(--_0x45e570){_0x17d8e5['push'](_0x17d8e5['shift']());}};_0x1b6389(++_0x253683);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x6d38[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x2ef3,0xba));var _0x32ef=function(_0x256b5c,_0x466913){_0x256b5c=_0x256b5c-0x0;var _0x5b942f=_0x2ef3[_0x256b5c];return _0x5b942f;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index cabcce9..d7baa49 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x47a595,_0x203326){var _0x263bdf=function(_0x3eb3b1){while(--_0x3eb3b1){_0x47a595['push'](_0x47a595['shift']());}};_0x263bdf(++_0x203326);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5e2555,_0x482726){var _0x570dbd=function(_0x577496){while(--_0x577496){_0x5e2555['push'](_0x5e2555['shift']());}};_0x570dbd(++_0x482726);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 4086f1e..e9ff3b0 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 _0x7fea=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7fea,0x149));var _0xa7fe=function(_0x50157d,_0x316734){_0x50157d=_0x50157d-0x0;var _0x20b570=_0x7fea[_0x50157d];return _0x20b570;};'use strict';var Sequelize=require('sequelize');module[_0xa7fe('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa7fe('0x1')],'unique':_0xa7fe('0x2')},'remoteUri':{'type':Sequelize[_0xa7fe('0x1')]},'password':{'type':Sequelize[_0xa7fe('0x1')]},'clientId':{'type':Sequelize[_0xa7fe('0x1')]},'clientSecret':{'type':Sequelize[_0xa7fe('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa7fe('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa7fe('0x3')](_0xa7fe('0x4'),_0xa7fe('0x5')),'defaultValue':_0xa7fe('0x4')}}; \ No newline at end of file +var _0x8a2a=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x125458,_0x1fadb4){var _0x4e1b85=function(_0xff8422){while(--_0xff8422){_0x125458['push'](_0x125458['shift']());}};_0x4e1b85(++_0x1fadb4);}(_0x8a2a,0x11f));var _0xa8a2=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x8a2a[_0x1bf809];return _0x1caa4e;};'use strict';var Sequelize=require('sequelize');module[_0xa8a2('0x0')]={'name':{'type':Sequelize[_0xa8a2('0x1')]},'description':{'type':Sequelize[_0xa8a2('0x1')]},'username':{'type':Sequelize[_0xa8a2('0x1')],'unique':_0xa8a2('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa8a2('0x1')]},'clientId':{'type':Sequelize[_0xa8a2('0x1')]},'clientSecret':{'type':Sequelize[_0xa8a2('0x1')]},'securityToken':{'type':Sequelize[_0xa8a2('0x1')]},'serverUrl':{'type':Sequelize[_0xa8a2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa8a2('0x3')](_0xa8a2('0x4'),_0xa8a2('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a08e106..a13ee8c 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 _0xf93e=['attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','body','find','catch','destroy','getConfigurations','findOne','SalesforceConfiguration','length','order','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','picklist','boolean','email','phone','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','error','stack','name','send','SalesforceAccount','rawAttributes','fieldName','map','query','keys','filters','intersection','model'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xf93e,0x1b8));var _0xef93=function(_0x4021ea,_0x10c785){_0x4021ea=_0x4021ea-0x0;var _0x34becd=_0xf93e[_0x4021ea];return _0x34becd;};'use strict';var emlformat=require(_0xef93('0x0'));var rimraf=require(_0xef93('0x1'));var zipdir=require(_0xef93('0x2'));var jsonpatch=require(_0xef93('0x3'));var rp=require('request-promise');var moment=require(_0xef93('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xef93('0x5'));var sox=require('sox');var csv=require(_0xef93('0x6'));var ejs=require(_0xef93('0x7'));var fs=require('fs');var fs_extra=require(_0xef93('0x8'));var _=require(_0xef93('0x9'));var squel=require(_0xef93('0xa'));var crypto=require(_0xef93('0xb'));var jsforce=require(_0xef93('0xc'));var deskjs=require(_0xef93('0xd'));var toCsv=require(_0xef93('0x6'));var querystring=require(_0xef93('0xe'));var Papa=require(_0xef93('0xf'));var Redis=require(_0xef93('0x10'));var authService=require(_0xef93('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xef93('0x12'));var hardwareService=require(_0xef93('0x13'));var logger=require(_0xef93('0x14'))(_0xef93('0x15'));var utils=require('../../config/utils');var config=require(_0xef93('0x16'));var licenseUtil=require(_0xef93('0x17'));var db=require(_0xef93('0x18'))['db'];var integrations=require(_0xef93('0x19'));function respondWithStatusCode(_0x44084a,_0x117290){_0x117290=_0x117290||0xcc;return function(_0x3462bb){if(_0x3462bb){return _0x44084a[_0xef93('0x1a')](_0x117290);}return _0x44084a[_0xef93('0x1b')](_0x117290)[_0xef93('0x1c')]();};}function respondWithResult(_0x28b48f,_0x39088e){_0x39088e=_0x39088e||0xc8;return function(_0x394f57){if(_0x394f57){return _0x28b48f['status'](_0x39088e)[_0xef93('0x1d')](_0x394f57);}};}function respondWithFilteredResult(_0x5de85c,_0x1f2a9d){return function(_0x469005){if(_0x469005){var _0x30fe70=typeof _0x1f2a9d['offset']===_0xef93('0x1e')&&typeof _0x1f2a9d[_0xef93('0x1f')]===_0xef93('0x1e');var _0x210de1=_0x469005[_0xef93('0x20')];var _0xbd5b5a=_0x30fe70?0x0:_0x1f2a9d[_0xef93('0x21')];var _0x1c154f=_0x30fe70?_0x469005[_0xef93('0x20')]:_0x1f2a9d[_0xef93('0x21')]+_0x1f2a9d[_0xef93('0x1f')];var _0x2f1aba;if(_0x1c154f>=_0x210de1){_0x1c154f=_0x210de1;_0x2f1aba=0xc8;}else{_0x2f1aba=0xce;}_0x5de85c[_0xef93('0x1b')](_0x2f1aba);return _0x5de85c[_0xef93('0x22')]('Content-Range',_0xbd5b5a+'-'+_0x1c154f+'/'+_0x210de1)['json'](_0x469005);}return null;};}function patchUpdates(_0x36aef8){return function(_0x1ddec6){try{jsonpatch['apply'](_0x1ddec6,_0x36aef8,!![]);}catch(_0x32fe93){return BPromise[_0xef93('0x23')](_0x32fe93);}return _0x1ddec6[_0xef93('0x24')]();};}function saveUpdates(_0x12838f,_0x3eae9f){return function(_0x1171fb){if(_0x1171fb){return _0x1171fb[_0xef93('0x25')](_0x12838f)[_0xef93('0x26')](function(_0x2a60a1){return _0x2a60a1;});}return null;};}function removeEntity(_0x99bdf4,_0x39efdc){return function(_0x3a3300){if(_0x3a3300){return _0x3a3300['destroy']()[_0xef93('0x26')](function(){_0x99bdf4[_0xef93('0x1b')](0xcc)[_0xef93('0x1c')]();});}};}function handleEntityNotFound(_0x1b5747,_0x146797){return function(_0x4973f1){if(!_0x4973f1){_0x1b5747[_0xef93('0x1a')](0x194);}return _0x4973f1;};}function handleError(_0x50127e,_0x26e8c1){_0x26e8c1=_0x26e8c1||0x1f4;return function(_0x54543e){logger[_0xef93('0x27')](_0x54543e[_0xef93('0x28')]);if(_0x54543e[_0xef93('0x29')]){delete _0x54543e[_0xef93('0x29')];}_0x50127e[_0xef93('0x1b')](_0x26e8c1)[_0xef93('0x2a')](_0x54543e);};}exports['index']=function(_0x292c9d,_0x555b37){var _0x12ecc2={},_0x508b5f={},_0x438203={'count':0x0,'rows':[]};var _0x4c65d8=_['map'](db[_0xef93('0x2b')][_0xef93('0x2c')],function(_0x2bd2b3){return{'name':_0x2bd2b3[_0xef93('0x2d')],'type':_0x2bd2b3['type']['key']};});_0x508b5f['model']=_[_0xef93('0x2e')](_0x4c65d8,_0xef93('0x29'));_0x508b5f[_0xef93('0x2f')]=_[_0xef93('0x30')](_0x292c9d[_0xef93('0x2f')]);_0x508b5f[_0xef93('0x31')]=_[_0xef93('0x32')](_0x508b5f[_0xef93('0x33')],_0x508b5f[_0xef93('0x2f')]);_0x12ecc2[_0xef93('0x34')]=_['intersection'](_0x508b5f[_0xef93('0x33')],qs[_0xef93('0x35')](_0x292c9d[_0xef93('0x2f')][_0xef93('0x35')]));_0x12ecc2[_0xef93('0x34')]=_0x12ecc2['attributes']['length']?_0x12ecc2[_0xef93('0x34')]:_0x508b5f[_0xef93('0x33')];if(!_0x292c9d[_0xef93('0x2f')][_0xef93('0x36')](_0xef93('0x37'))){_0x12ecc2[_0xef93('0x1f')]=qs[_0xef93('0x1f')](_0x292c9d[_0xef93('0x2f')][_0xef93('0x1f')]);_0x12ecc2[_0xef93('0x21')]=qs['offset'](_0x292c9d[_0xef93('0x2f')][_0xef93('0x21')]);}_0x12ecc2['order']=qs[_0xef93('0x38')](_0x292c9d['query'][_0xef93('0x38')]);_0x12ecc2[_0xef93('0x39')]=qs[_0xef93('0x31')](_[_0xef93('0x3a')](_0x292c9d['query'],_0x508b5f[_0xef93('0x31')]),_0x4c65d8);if(_0x292c9d[_0xef93('0x2f')][_0xef93('0x3b')]){_0x12ecc2['where']=_['merge'](_0x12ecc2['where'],{'$or':_[_0xef93('0x2e')](_0x4c65d8,function(_0xa9ef1f){if(_0xa9ef1f['type']!==_0xef93('0x3c')){var _0x19f128={};_0x19f128[_0xa9ef1f['name']]={'$like':'%'+_0x292c9d[_0xef93('0x2f')][_0xef93('0x3b')]+'%'};return _0x19f128;}})});}_0x12ecc2=_[_0xef93('0x3d')]({},_0x12ecc2,_0x292c9d[_0xef93('0x3e')]);var _0x206e10={'where':_0x12ecc2['where']};return db[_0xef93('0x2b')][_0xef93('0x20')](_0x206e10)[_0xef93('0x26')](function(_0x3f5049){_0x438203[_0xef93('0x20')]=_0x3f5049;if(_0x292c9d[_0xef93('0x2f')][_0xef93('0x3f')]){_0x12ecc2[_0xef93('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xef93('0x41')](_0x12ecc2);})[_0xef93('0x26')](function(_0x4cba16){_0x438203[_0xef93('0x42')]=_0x4cba16;return _0x438203;})[_0xef93('0x26')](respondWithFilteredResult(_0x555b37,_0x12ecc2))['catch'](handleError(_0x555b37,null));};exports[_0xef93('0x43')]=function(_0x4ebda0,_0x11b749){var _0x2e1d3e={'raw':![],'where':{'id':_0x4ebda0[_0xef93('0x44')]['id']}},_0x839a7f={};_0x839a7f['model']=_[_0xef93('0x30')](db['SalesforceAccount'][_0xef93('0x2c')]);_0x839a7f['query']=_['keys'](_0x4ebda0[_0xef93('0x2f')]);_0x839a7f[_0xef93('0x31')]=_['intersection'](_0x839a7f['model'],_0x839a7f[_0xef93('0x2f')]);_0x2e1d3e['attributes']=_[_0xef93('0x32')](_0x839a7f[_0xef93('0x33')],qs[_0xef93('0x35')](_0x4ebda0[_0xef93('0x2f')][_0xef93('0x35')]));_0x2e1d3e['attributes']=_0x2e1d3e[_0xef93('0x34')]['length']?_0x2e1d3e[_0xef93('0x34')]:_0x839a7f[_0xef93('0x33')];if(_0x4ebda0[_0xef93('0x2f')][_0xef93('0x3f')]){_0x2e1d3e['include']=[{'all':!![]}];}_0x2e1d3e=_[_0xef93('0x3d')]({},_0x2e1d3e,_0x4ebda0['options']);return db[_0xef93('0x2b')]['find'](_0x2e1d3e)[_0xef93('0x26')](handleEntityNotFound(_0x11b749,null))['then'](respondWithResult(_0x11b749,null))['catch'](handleError(_0x11b749,null));};exports[_0xef93('0x45')]=function(_0x4f53de,_0x44443c){return db[_0xef93('0x2b')]['create'](_0x4f53de[_0xef93('0x46')],{})[_0xef93('0x26')](respondWithResult(_0x44443c,0xc9))['catch'](handleError(_0x44443c,null));};exports['update']=function(_0x57a771,_0x564cb8){if(_0x57a771[_0xef93('0x46')]['id']){delete _0x57a771[_0xef93('0x46')]['id'];}return db[_0xef93('0x2b')][_0xef93('0x47')]({'where':{'id':_0x57a771[_0xef93('0x44')]['id']}})['then'](handleEntityNotFound(_0x564cb8,null))[_0xef93('0x26')](saveUpdates(_0x57a771[_0xef93('0x46')],null))[_0xef93('0x26')](respondWithResult(_0x564cb8,null))[_0xef93('0x48')](handleError(_0x564cb8,null));};exports[_0xef93('0x49')]=function(_0x6e848a,_0x14e0a3){return db['SalesforceAccount'][_0xef93('0x47')]({'where':{'id':_0x6e848a[_0xef93('0x44')]['id']}})[_0xef93('0x26')](handleEntityNotFound(_0x14e0a3,null))[_0xef93('0x26')](removeEntity(_0x14e0a3,null))[_0xef93('0x48')](handleError(_0x14e0a3,null));};exports[_0xef93('0x4a')]=function(_0x25a0a2,_0x19a839,_0x3d9218){var _0x47fa92={};var _0x2dfa60={};var _0x2c3fe6;var _0x59be6d;return db[_0xef93('0x2b')][_0xef93('0x4b')]({'where':{'id':_0x25a0a2[_0xef93('0x44')]['id']}})[_0xef93('0x26')](handleEntityNotFound(_0x19a839,null))[_0xef93('0x26')](function(_0xf6bbdc){if(_0xf6bbdc){_0x2c3fe6=_0xf6bbdc;_0x2dfa60[_0xef93('0x33')]=_[_0xef93('0x30')](db[_0xef93('0x4c')][_0xef93('0x2c')]);_0x2dfa60[_0xef93('0x2f')]=_[_0xef93('0x30')](_0x25a0a2[_0xef93('0x2f')]);_0x2dfa60[_0xef93('0x31')]=_[_0xef93('0x32')](_0x2dfa60[_0xef93('0x33')],_0x2dfa60[_0xef93('0x2f')]);_0x47fa92[_0xef93('0x34')]=_[_0xef93('0x32')](_0x2dfa60['model'],qs[_0xef93('0x35')](_0x25a0a2[_0xef93('0x2f')][_0xef93('0x35')]));_0x47fa92[_0xef93('0x34')]=_0x47fa92[_0xef93('0x34')][_0xef93('0x4d')]?_0x47fa92[_0xef93('0x34')]:_0x2dfa60['model'];_0x47fa92[_0xef93('0x4e')]=qs[_0xef93('0x38')](_0x25a0a2[_0xef93('0x2f')]['sort']);_0x47fa92[_0xef93('0x39')]=qs[_0xef93('0x31')](_[_0xef93('0x3a')](_0x25a0a2['query'],_0x2dfa60['filters']));if(_0x25a0a2['query'][_0xef93('0x3b')]){_0x47fa92[_0xef93('0x39')]=_[_0xef93('0x3d')](_0x47fa92['where'],{'$or':_[_0xef93('0x2e')](_0x47fa92[_0xef93('0x34')],function(_0x59bbde){var _0x40815b={};_0x40815b[_0x59bbde]={'$like':'%'+_0x25a0a2[_0xef93('0x2f')][_0xef93('0x3b')]+'%'};return _0x40815b;})});}_0x47fa92=_[_0xef93('0x3d')]({},_0x47fa92,_0x25a0a2[_0xef93('0x3e')]);return _0x2c3fe6[_0xef93('0x4a')](_0x47fa92);}})[_0xef93('0x26')](function(_0x4bfbdd){if(_0x4bfbdd){_0x59be6d=_0x4bfbdd['length'];if(!_0x25a0a2[_0xef93('0x2f')][_0xef93('0x36')]('nolimit')){_0x47fa92['limit']=qs[_0xef93('0x1f')](_0x25a0a2['query'][_0xef93('0x1f')]);_0x47fa92[_0xef93('0x21')]=qs['offset'](_0x25a0a2[_0xef93('0x2f')][_0xef93('0x21')]);}return _0x2c3fe6[_0xef93('0x4a')](_0x47fa92);}})[_0xef93('0x26')](function(_0x1816b4){if(_0x1816b4){return _0x1816b4?{'count':_0x59be6d,'rows':_0x1816b4}:null;}})[_0xef93('0x26')](respondWithResult(_0x19a839,null))['catch'](handleError(_0x19a839,null));};exports['addConfiguration']=function(_0x41ebff,_0x3fc6b7,_0x3fff64){if(_0x41ebff['body']['id']){delete _0x41ebff[_0xef93('0x46')]['id'];}return db['SalesforceAccount'][_0xef93('0x4b')]({'where':{'id':_0x41ebff[_0xef93('0x44')]['id']}})[_0xef93('0x26')](handleEntityNotFound(_0x3fc6b7,null))[_0xef93('0x26')](function(_0x163469){if(_0x163469){_0x41ebff['body']['AccountId']=_0x163469['id'];_0x41ebff[_0xef93('0x46')][_0xef93('0x4f')]=integrations[_0xef93('0x50')](_0x41ebff['body'][_0xef93('0x51')],_0x41ebff[_0xef93('0x46')]['type']);_0x41ebff[_0xef93('0x46')][_0xef93('0x52')]=integrations[_0xef93('0x53')](_0x41ebff['body'][_0xef93('0x51')],_0x41ebff[_0xef93('0x46')][_0xef93('0x54')]);return db[_0xef93('0x4c')][_0xef93('0x45')](_0x41ebff[_0xef93('0x46')],{'include':[{'model':db[_0xef93('0x55')],'as':'Subjects'},{'model':db[_0xef93('0x55')],'as':_0xef93('0x52')}]});}return null;})['then'](respondWithResult(_0x3fc6b7,null))[_0xef93('0x48')](handleError(_0x3fc6b7,null));};exports['getFields']=function(_0x39187c,_0x5edd14,_0x6058ca){var _0x33abdf;var _0x49d6ca='';var _0x21b1e2=_0xef93('0x56');return db[_0xef93('0x2b')]['findOne']({'where':{'id':_0x39187c['params']['id']},'attributes':['id',_0xef93('0x57'),_0xef93('0x58'),_0xef93('0x59'),_0xef93('0x5a'),_0xef93('0x5b'),_0xef93('0x5c')]})[_0xef93('0x26')](handleEntityNotFound(_0x5edd14,null))['then'](function(_0x51657b){if(_0x51657b){_0x49d6ca=_0x51657b[_0xef93('0x57')];var _0x333b28=_0x49d6ca[_0xef93('0x5d')](-0x1);if(_0x333b28==='/'){_0x49d6ca=_0x49d6ca[_0xef93('0x5e')](0x0,_0x49d6ca['lastIndexOf'](_0x333b28));}_0x33abdf=new jsforce[(_0xef93('0x5f'))]({'oauth2':{'loginUrl':_0x49d6ca,'clientId':_0x51657b[_0xef93('0x58')],'clientSecret':_0x51657b[_0xef93('0x59')]}});return _0x33abdf[_0xef93('0x60')](_0x51657b['username'],_0x51657b[_0xef93('0x5b')][_0xef93('0x61')](_0x51657b[_0xef93('0x5c')]));}})[_0xef93('0x26')](function(_0x3313fa){if(_0x3313fa){if(!_[_0xef93('0x62')](_0x39187c['query'][_0xef93('0x63')])){_0x21b1e2=_0x39187c['query']['ticketType'];}return _0x33abdf[_0xef93('0x64')](_0x21b1e2)[_0xef93('0x65')]();}})[_0xef93('0x26')](function(_0x2f1348){var _0x585fa6=['OwnerId',_0xef93('0x66'),_0xef93('0x67'),_0xef93('0x68'),_0xef93('0x69'),'Description'];var _0x16ccba=['string','int',_0xef93('0x6a'),_0xef93('0x6b'),_0xef93('0x6c'),'textarea',_0xef93('0x6d')];if(_0x2f1348){_['remove'](_0x2f1348[_0xef93('0x35')],function(_0x5267d5){return _0x585fa6['includes'](_0x5267d5[_0xef93('0x29')])||!_0x16ccba[_0xef93('0x6e')](_0x5267d5[_0xef93('0x54')]);});return{'count':_0x2f1348[_0xef93('0x35')][_0xef93('0x4d')],'rows':_[_0xef93('0x2e')](_0x2f1348['fields'],function(_0x3df050){return{'id':_0x3df050[_0xef93('0x29')],'name':_0x3df050[_0xef93('0x6f')],'custom':_0x3df050[_0xef93('0x70')],'options':_0x3df050[_0xef93('0x71')]['length']>0x0?_[_0xef93('0x2e')](_0x3df050[_0xef93('0x71')],function(_0x5ab9ca){return{'name':_0x5ab9ca[_0xef93('0x6f')],'value':_0x5ab9ca[_0xef93('0x72')]};}):_0x3df050['type']==_0xef93('0x6b')?[{'name':_0xef93('0x73'),'value':_0xef93('0x74')},{'name':_0xef93('0x75'),'value':_0xef93('0x76')}]:[]};})};}})['then'](respondWithResult(_0x5edd14,null))[_0xef93('0x48')](function(_0x58927c){var _0x30a1cb=_0x39187c['query'][_0xef93('0x77')]?0x1f4:_0x58927c[_0xef93('0x78')]||0x1f4;logger[_0xef93('0x27')](_0xef93('0x79'),'getFields',_0x30a1cb,JSON[_0xef93('0x7a')](_0x58927c));delete _0x58927c[_0xef93('0x29')];if(_0x30a1cb===0x191){_0x30a1cb=0x190;}_0x5edd14[_0xef93('0x1b')](_0x30a1cb)[_0xef93('0x2a')](_0x39187c[_0xef93('0x2f')][_0xef93('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x58927c['statusCode']}:_0x58927c);});}; \ No newline at end of file +var _0xabd8=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','name','send','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','SalesforceConfiguration','pick','options','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','securityToken','remoteUri','slice','substring','Connection','password','concat','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','test','statusCode','stringify','rimraf','zip-dir','request-promise','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xabd8,0xe0));var _0x8abd=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xabd8[_0xdc37a1];return _0x99b4fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8abd('0x0'));var zipdir=require(_0x8abd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8abd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8abd('0x3'));var util=require('util');var path=require('path');var sox=require(_0x8abd('0x4'));var csv=require(_0x8abd('0x5'));var ejs=require(_0x8abd('0x6'));var fs=require('fs');var fs_extra=require(_0x8abd('0x7'));var _=require('lodash');var squel=require(_0x8abd('0x8'));var crypto=require(_0x8abd('0x9'));var jsforce=require(_0x8abd('0xa'));var deskjs=require(_0x8abd('0xb'));var toCsv=require(_0x8abd('0x5'));var querystring=require(_0x8abd('0xc'));var Papa=require(_0x8abd('0xd'));var Redis=require(_0x8abd('0xe'));var authService=require(_0x8abd('0xf'));var qs=require(_0x8abd('0x10'));var as=require(_0x8abd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8abd('0x12'))('api');var utils=require(_0x8abd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8abd('0x14'));var db=require(_0x8abd('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2744e3,_0x45e6c3){_0x45e6c3=_0x45e6c3||0xcc;return function(_0x1395f0){if(_0x1395f0){return _0x2744e3[_0x8abd('0x16')](_0x45e6c3);}return _0x2744e3[_0x8abd('0x17')](_0x45e6c3)[_0x8abd('0x18')]();};}function respondWithResult(_0x217906,_0x2206b6){_0x2206b6=_0x2206b6||0xc8;return function(_0x180d49){if(_0x180d49){return _0x217906[_0x8abd('0x17')](_0x2206b6)[_0x8abd('0x19')](_0x180d49);}};}function respondWithFilteredResult(_0x25e7b6,_0x5a0c64){return function(_0x126032){if(_0x126032){var _0xe1ab96=typeof _0x5a0c64[_0x8abd('0x1a')]===_0x8abd('0x1b')&&typeof _0x5a0c64[_0x8abd('0x1c')]===_0x8abd('0x1b');var _0xae71c1=_0x126032[_0x8abd('0x1d')];var _0x324db5=_0xe1ab96?0x0:_0x5a0c64['offset'];var _0x5f0d19=_0xe1ab96?_0x126032[_0x8abd('0x1d')]:_0x5a0c64[_0x8abd('0x1a')]+_0x5a0c64[_0x8abd('0x1c')];var _0x2de279;if(_0x5f0d19>=_0xae71c1){_0x5f0d19=_0xae71c1;_0x2de279=0xc8;}else{_0x2de279=0xce;}_0x25e7b6[_0x8abd('0x17')](_0x2de279);return _0x25e7b6[_0x8abd('0x1e')](_0x8abd('0x1f'),_0x324db5+'-'+_0x5f0d19+'/'+_0xae71c1)[_0x8abd('0x19')](_0x126032);}return null;};}function patchUpdates(_0x4e3316){return function(_0xd326fd){try{jsonpatch[_0x8abd('0x20')](_0xd326fd,_0x4e3316,!![]);}catch(_0x466dd7){return BPromise[_0x8abd('0x21')](_0x466dd7);}return _0xd326fd['save']();};}function saveUpdates(_0x588934,_0x3bc444){return function(_0x4da56e){if(_0x4da56e){return _0x4da56e[_0x8abd('0x22')](_0x588934)[_0x8abd('0x23')](function(_0x4324af){return _0x4324af;});}return null;};}function removeEntity(_0x344ecf,_0x370b88){return function(_0x25ce4f){if(_0x25ce4f){return _0x25ce4f['destroy']()[_0x8abd('0x23')](function(){_0x344ecf[_0x8abd('0x17')](0xcc)[_0x8abd('0x18')]();});}};}function handleEntityNotFound(_0x357f76,_0x20a4f2){return function(_0x2786d9){if(!_0x2786d9){_0x357f76[_0x8abd('0x16')](0x194);}return _0x2786d9;};}function handleError(_0x3af21a,_0x500b44){_0x500b44=_0x500b44||0x1f4;return function(_0x279ff6){logger['error'](_0x279ff6['stack']);if(_0x279ff6[_0x8abd('0x24')]){delete _0x279ff6[_0x8abd('0x24')];}_0x3af21a[_0x8abd('0x17')](_0x500b44)[_0x8abd('0x25')](_0x279ff6);};}exports['index']=function(_0x3a5bc7,_0x4c7c6){var _0x4cd44f={},_0x59a380={},_0x44d346={'count':0x0,'rows':[]};var _0x4a3caa=_[_0x8abd('0x26')](db['SalesforceAccount'][_0x8abd('0x27')],function(_0x1c8eef){return{'name':_0x1c8eef['fieldName'],'type':_0x1c8eef[_0x8abd('0x28')][_0x8abd('0x29')]};});_0x59a380[_0x8abd('0x2a')]=_[_0x8abd('0x26')](_0x4a3caa,_0x8abd('0x24'));_0x59a380[_0x8abd('0x2b')]=_[_0x8abd('0x2c')](_0x3a5bc7['query']);_0x59a380['filters']=_[_0x8abd('0x2d')](_0x59a380['model'],_0x59a380[_0x8abd('0x2b')]);_0x4cd44f['attributes']=_['intersection'](_0x59a380['model'],qs[_0x8abd('0x2e')](_0x3a5bc7['query'][_0x8abd('0x2e')]));_0x4cd44f['attributes']=_0x4cd44f[_0x8abd('0x2f')][_0x8abd('0x30')]?_0x4cd44f[_0x8abd('0x2f')]:_0x59a380[_0x8abd('0x2a')];if(!_0x3a5bc7[_0x8abd('0x2b')][_0x8abd('0x31')](_0x8abd('0x32'))){_0x4cd44f[_0x8abd('0x1c')]=qs['limit'](_0x3a5bc7[_0x8abd('0x2b')]['limit']);_0x4cd44f['offset']=qs[_0x8abd('0x1a')](_0x3a5bc7[_0x8abd('0x2b')][_0x8abd('0x1a')]);}_0x4cd44f[_0x8abd('0x33')]=qs[_0x8abd('0x34')](_0x3a5bc7['query']['sort']);_0x4cd44f[_0x8abd('0x35')]=qs[_0x8abd('0x36')](_['pick'](_0x3a5bc7[_0x8abd('0x2b')],_0x59a380[_0x8abd('0x36')]),_0x4a3caa);if(_0x3a5bc7[_0x8abd('0x2b')][_0x8abd('0x37')]){_0x4cd44f['where']=_[_0x8abd('0x38')](_0x4cd44f[_0x8abd('0x35')],{'$or':_[_0x8abd('0x26')](_0x4a3caa,function(_0x4722bb){if(_0x4722bb[_0x8abd('0x28')]!==_0x8abd('0x39')){var _0x2496f3={};_0x2496f3[_0x4722bb['name']]={'$like':'%'+_0x3a5bc7[_0x8abd('0x2b')]['filter']+'%'};return _0x2496f3;}})});}_0x4cd44f=_[_0x8abd('0x38')]({},_0x4cd44f,_0x3a5bc7['options']);var _0xd91d3c={'where':_0x4cd44f[_0x8abd('0x35')]};return db[_0x8abd('0x3a')][_0x8abd('0x1d')](_0xd91d3c)['then'](function(_0x7e369f){_0x44d346[_0x8abd('0x1d')]=_0x7e369f;if(_0x3a5bc7['query'][_0x8abd('0x3b')]){_0x4cd44f[_0x8abd('0x3c')]=[{'all':!![]}];}return db[_0x8abd('0x3a')][_0x8abd('0x3d')](_0x4cd44f);})[_0x8abd('0x23')](function(_0x57a3b9){_0x44d346[_0x8abd('0x3e')]=_0x57a3b9;return _0x44d346;})[_0x8abd('0x23')](respondWithFilteredResult(_0x4c7c6,_0x4cd44f))[_0x8abd('0x3f')](handleError(_0x4c7c6,null));};exports[_0x8abd('0x40')]=function(_0x3aae29,_0x32e223){var _0x15ea14={'raw':![],'where':{'id':_0x3aae29[_0x8abd('0x41')]['id']}},_0x5b7c03={};_0x5b7c03[_0x8abd('0x2a')]=_[_0x8abd('0x2c')](db[_0x8abd('0x3a')][_0x8abd('0x27')]);_0x5b7c03[_0x8abd('0x2b')]=_['keys'](_0x3aae29[_0x8abd('0x2b')]);_0x5b7c03[_0x8abd('0x36')]=_[_0x8abd('0x2d')](_0x5b7c03[_0x8abd('0x2a')],_0x5b7c03[_0x8abd('0x2b')]);_0x15ea14['attributes']=_[_0x8abd('0x2d')](_0x5b7c03[_0x8abd('0x2a')],qs[_0x8abd('0x2e')](_0x3aae29[_0x8abd('0x2b')][_0x8abd('0x2e')]));_0x15ea14[_0x8abd('0x2f')]=_0x15ea14[_0x8abd('0x2f')]['length']?_0x15ea14[_0x8abd('0x2f')]:_0x5b7c03[_0x8abd('0x2a')];if(_0x3aae29[_0x8abd('0x2b')][_0x8abd('0x3b')]){_0x15ea14[_0x8abd('0x3c')]=[{'all':!![]}];}_0x15ea14=_['merge']({},_0x15ea14,_0x3aae29['options']);return db['SalesforceAccount'][_0x8abd('0x42')](_0x15ea14)['then'](handleEntityNotFound(_0x32e223,null))['then'](respondWithResult(_0x32e223,null))[_0x8abd('0x3f')](handleError(_0x32e223,null));};exports[_0x8abd('0x43')]=function(_0x3a7f6d,_0x48c593){return db[_0x8abd('0x3a')][_0x8abd('0x43')](_0x3a7f6d['body'],{})[_0x8abd('0x23')](respondWithResult(_0x48c593,0xc9))[_0x8abd('0x3f')](handleError(_0x48c593,null));};exports[_0x8abd('0x22')]=function(_0x3930be,_0x34d655){if(_0x3930be[_0x8abd('0x44')]['id']){delete _0x3930be[_0x8abd('0x44')]['id'];}return db[_0x8abd('0x3a')][_0x8abd('0x42')]({'where':{'id':_0x3930be[_0x8abd('0x41')]['id']}})['then'](handleEntityNotFound(_0x34d655,null))['then'](saveUpdates(_0x3930be['body'],null))['then'](respondWithResult(_0x34d655,null))[_0x8abd('0x3f')](handleError(_0x34d655,null));};exports[_0x8abd('0x45')]=function(_0x224a19,_0x476c06){return db[_0x8abd('0x3a')][_0x8abd('0x42')]({'where':{'id':_0x224a19[_0x8abd('0x41')]['id']}})[_0x8abd('0x23')](handleEntityNotFound(_0x476c06,null))[_0x8abd('0x23')](removeEntity(_0x476c06,null))[_0x8abd('0x3f')](handleError(_0x476c06,null));};exports[_0x8abd('0x46')]=function(_0x48f190,_0x5abeb7,_0x262c3c){var _0x46855c={};var _0x59ec6a={};var _0x20b372;var _0x160d5f;return db[_0x8abd('0x3a')]['findOne']({'where':{'id':_0x48f190[_0x8abd('0x41')]['id']}})['then'](handleEntityNotFound(_0x5abeb7,null))[_0x8abd('0x23')](function(_0xcb18db){if(_0xcb18db){_0x20b372=_0xcb18db;_0x59ec6a['model']=_[_0x8abd('0x2c')](db[_0x8abd('0x47')][_0x8abd('0x27')]);_0x59ec6a[_0x8abd('0x2b')]=_[_0x8abd('0x2c')](_0x48f190['query']);_0x59ec6a[_0x8abd('0x36')]=_[_0x8abd('0x2d')](_0x59ec6a[_0x8abd('0x2a')],_0x59ec6a[_0x8abd('0x2b')]);_0x46855c[_0x8abd('0x2f')]=_[_0x8abd('0x2d')](_0x59ec6a[_0x8abd('0x2a')],qs['fields'](_0x48f190[_0x8abd('0x2b')][_0x8abd('0x2e')]));_0x46855c['attributes']=_0x46855c[_0x8abd('0x2f')][_0x8abd('0x30')]?_0x46855c[_0x8abd('0x2f')]:_0x59ec6a[_0x8abd('0x2a')];_0x46855c[_0x8abd('0x33')]=qs[_0x8abd('0x34')](_0x48f190[_0x8abd('0x2b')][_0x8abd('0x34')]);_0x46855c['where']=qs[_0x8abd('0x36')](_[_0x8abd('0x48')](_0x48f190[_0x8abd('0x2b')],_0x59ec6a[_0x8abd('0x36')]));if(_0x48f190[_0x8abd('0x2b')]['filter']){_0x46855c['where']=_[_0x8abd('0x38')](_0x46855c[_0x8abd('0x35')],{'$or':_[_0x8abd('0x26')](_0x46855c[_0x8abd('0x2f')],function(_0x23da28){var _0x1afd33={};_0x1afd33[_0x23da28]={'$like':'%'+_0x48f190[_0x8abd('0x2b')][_0x8abd('0x37')]+'%'};return _0x1afd33;})});}_0x46855c=_[_0x8abd('0x38')]({},_0x46855c,_0x48f190[_0x8abd('0x49')]);return _0x20b372[_0x8abd('0x46')](_0x46855c);}})[_0x8abd('0x23')](function(_0x28987e){if(_0x28987e){_0x160d5f=_0x28987e[_0x8abd('0x30')];if(!_0x48f190['query'][_0x8abd('0x31')](_0x8abd('0x32'))){_0x46855c['limit']=qs[_0x8abd('0x1c')](_0x48f190[_0x8abd('0x2b')][_0x8abd('0x1c')]);_0x46855c['offset']=qs[_0x8abd('0x1a')](_0x48f190[_0x8abd('0x2b')][_0x8abd('0x1a')]);}return _0x20b372[_0x8abd('0x46')](_0x46855c);}})[_0x8abd('0x23')](function(_0x197006){if(_0x197006){return _0x197006?{'count':_0x160d5f,'rows':_0x197006}:null;}})[_0x8abd('0x23')](respondWithResult(_0x5abeb7,null))['catch'](handleError(_0x5abeb7,null));};exports[_0x8abd('0x4a')]=function(_0x1230d1,_0x5b8620,_0x139a57){if(_0x1230d1['body']['id']){delete _0x1230d1[_0x8abd('0x44')]['id'];}return db[_0x8abd('0x3a')][_0x8abd('0x4b')]({'where':{'id':_0x1230d1[_0x8abd('0x41')]['id']}})[_0x8abd('0x23')](handleEntityNotFound(_0x5b8620,null))[_0x8abd('0x23')](function(_0x429422){if(_0x429422){_0x1230d1[_0x8abd('0x44')][_0x8abd('0x4c')]=_0x429422['id'];_0x1230d1['body'][_0x8abd('0x4d')]=integrations[_0x8abd('0x4e')](_0x1230d1[_0x8abd('0x44')][_0x8abd('0x4f')],_0x1230d1[_0x8abd('0x44')][_0x8abd('0x28')]);_0x1230d1[_0x8abd('0x44')][_0x8abd('0x50')]=integrations[_0x8abd('0x51')](_0x1230d1[_0x8abd('0x44')][_0x8abd('0x4f')],_0x1230d1[_0x8abd('0x44')][_0x8abd('0x28')]);return db['SalesforceConfiguration'][_0x8abd('0x43')](_0x1230d1[_0x8abd('0x44')],{'include':[{'model':db[_0x8abd('0x52')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x8abd('0x50')}]});}return null;})[_0x8abd('0x23')](respondWithResult(_0x5b8620,null))[_0x8abd('0x3f')](handleError(_0x5b8620,null));};exports[_0x8abd('0x53')]=function(_0x5e025b,_0x2db566,_0x4ec24b){var _0x327a17;var _0xd21a0b='';var _0x507ee9=_0x8abd('0x54');return db[_0x8abd('0x3a')][_0x8abd('0x4b')]({'where':{'id':_0x5e025b['params']['id']},'attributes':['id','remoteUri',_0x8abd('0x55'),_0x8abd('0x56'),_0x8abd('0x57'),'password',_0x8abd('0x58')]})[_0x8abd('0x23')](handleEntityNotFound(_0x2db566,null))[_0x8abd('0x23')](function(_0x30008a){if(_0x30008a){_0xd21a0b=_0x30008a[_0x8abd('0x59')];var _0x4a0ba3=_0xd21a0b[_0x8abd('0x5a')](-0x1);if(_0x4a0ba3==='/'){_0xd21a0b=_0xd21a0b[_0x8abd('0x5b')](0x0,_0xd21a0b['lastIndexOf'](_0x4a0ba3));}_0x327a17=new jsforce[(_0x8abd('0x5c'))]({'oauth2':{'loginUrl':_0xd21a0b,'clientId':_0x30008a[_0x8abd('0x55')],'clientSecret':_0x30008a[_0x8abd('0x56')]}});return _0x327a17['login'](_0x30008a[_0x8abd('0x57')],_0x30008a[_0x8abd('0x5d')][_0x8abd('0x5e')](_0x30008a[_0x8abd('0x58')]));}})[_0x8abd('0x23')](function(_0x29c48f){if(_0x29c48f){if(!_['isNil'](_0x5e025b[_0x8abd('0x2b')][_0x8abd('0x5f')])){_0x507ee9=_0x5e025b[_0x8abd('0x2b')][_0x8abd('0x5f')];}return _0x327a17[_0x8abd('0x60')](_0x507ee9)['describe']();}})[_0x8abd('0x23')](function(_0x19d57c){var _0x200158=[_0x8abd('0x61'),_0x8abd('0x62'),_0x8abd('0x63'),_0x8abd('0x64'),_0x8abd('0x65'),_0x8abd('0x66')];var _0x216233=[_0x8abd('0x67'),_0x8abd('0x68'),_0x8abd('0x69'),_0x8abd('0x6a'),_0x8abd('0x6b'),_0x8abd('0x6c'),_0x8abd('0x6d')];if(_0x19d57c){_[_0x8abd('0x6e')](_0x19d57c[_0x8abd('0x2e')],function(_0xdb8a6b){return _0x200158[_0x8abd('0x6f')](_0xdb8a6b['name'])||!_0x216233[_0x8abd('0x6f')](_0xdb8a6b[_0x8abd('0x28')]);});return{'count':_0x19d57c['fields']['length'],'rows':_[_0x8abd('0x26')](_0x19d57c[_0x8abd('0x2e')],function(_0x446d4d){return{'id':_0x446d4d[_0x8abd('0x24')],'name':_0x446d4d[_0x8abd('0x70')],'custom':_0x446d4d[_0x8abd('0x71')],'options':_0x446d4d[_0x8abd('0x72')][_0x8abd('0x30')]>0x0?_[_0x8abd('0x26')](_0x446d4d[_0x8abd('0x72')],function(_0x13d547){return{'name':_0x13d547[_0x8abd('0x70')],'value':_0x13d547[_0x8abd('0x73')]};}):_0x446d4d[_0x8abd('0x28')]=='boolean'?[{'name':_0x8abd('0x74'),'value':_0x8abd('0x75')},{'name':_0x8abd('0x76'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x2db566,null))[_0x8abd('0x3f')](function(_0x51cc1a){var _0x4efa92=_0x5e025b[_0x8abd('0x2b')][_0x8abd('0x77')]?0x1f4:_0x51cc1a[_0x8abd('0x78')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4efa92,JSON[_0x8abd('0x79')](_0x51cc1a));delete _0x51cc1a[_0x8abd('0x24')];if(_0x4efa92===0x191){_0x4efa92=0x190;}_0x2db566[_0x8abd('0x17')](_0x4efa92)[_0x8abd('0x25')](_0x5e025b[_0x8abd('0x2b')][_0x8abd('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x51cc1a[_0x8abd('0x78')]}:_0x51cc1a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a7ed27d..2468d09 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 _0xecd2=['int_salesforce_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','SalesforceAccount'];(function(_0x18af0a,_0x578923){var _0x1b8894=function(_0x5a5107){while(--_0x5a5107){_0x18af0a['push'](_0x18af0a['shift']());}};_0x1b8894(++_0x578923);}(_0xecd2,0x139));var _0x2ecd=function(_0x3c0ab5,_0x5874e5){_0x3c0ab5=_0x3c0ab5-0x0;var _0xae11fe=_0xecd2[_0x3c0ab5];return _0xae11fe;};'use strict';var _=require(_0x2ecd('0x0'));var util=require(_0x2ecd('0x1'));var logger=require('../../config/logger')(_0x2ecd('0x2'));var moment=require(_0x2ecd('0x3'));var BPromise=require(_0x2ecd('0x4'));var rp=require(_0x2ecd('0x5'));var fs=require('fs');var path=require(_0x2ecd('0x6'));var rimraf=require(_0x2ecd('0x7'));var config=require(_0x2ecd('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x2ecd('0x9'));module['exports']=function(_0x1c38e7,_0x1c010f){return _0x1c38e7['define'](_0x2ecd('0xa'),attributes,{'tableName':_0x2ecd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1df=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','int_salesforce_accounts'];(function(_0x1156f7,_0x1cc279){var _0x15825a=function(_0x1f7864){while(--_0x1f7864){_0x1156f7['push'](_0x1156f7['shift']());}};_0x15825a(++_0x1cc279);}(_0xe1df,0x120));var _0xfe1d=function(_0x418935,_0x5d3f59){_0x418935=_0x418935-0x0;var _0x5cdcee=_0xe1df[_0x418935];return _0x5cdcee;};'use strict';var _=require(_0xfe1d('0x0'));var util=require(_0xfe1d('0x1'));var logger=require(_0xfe1d('0x2'))(_0xfe1d('0x3'));var moment=require(_0xfe1d('0x4'));var BPromise=require(_0xfe1d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe1d('0x6'));var config=require(_0xfe1d('0x7'));var attributes=require(_0xfe1d('0x8'));var integrations=require(_0xfe1d('0x9'));module[_0xfe1d('0xa')]=function(_0x4a9c22,_0x45d2fa){return _0x4a9c22['define']('SalesforceAccount',attributes,{'tableName':_0xfe1d('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 00fb558..8c78d6c 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 _0x910e=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetSalesforceAccount','catch','find','ShowSalesforceAccount'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x910e,0x128));var _0xe910=function(_0x550614,_0x566a23){_0x550614=_0x550614-0x0;var _0x18b9be=_0x910e[_0x550614];return _0x18b9be;};'use strict';var _=require(_0xe910('0x0'));var util=require(_0xe910('0x1'));var moment=require(_0xe910('0x2'));var BPromise=require(_0xe910('0x3'));var rs=require(_0xe910('0x4'));var fs=require('fs');var Redis=require(_0xe910('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe910('0x6'));var logger=require(_0xe910('0x7'))('rpc');var config=require(_0xe910('0x8'));var jayson=require(_0xe910('0x9'));var client=jayson[_0xe910('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0bd2,_0x36b4a1,_0x446f5e){return new BPromise(function(_0xa1de34,_0x37d9f6){return client[_0xe910('0xb')](_0x3b0bd2,_0x446f5e)[_0xe910('0xc')](function(_0x6d540d){logger[_0xe910('0xd')](_0xe910('0xe'),_0x36b4a1,_0xe910('0xf'));logger[_0xe910('0x10')](_0xe910('0x11'),_0x36b4a1,_0xe910('0xf'),JSON[_0xe910('0x12')](_0x6d540d));if(_0x6d540d[_0xe910('0x13')]){if(_0x6d540d[_0xe910('0x13')][_0xe910('0x14')]===0x1f4){logger[_0xe910('0x13')](_0xe910('0xe'),_0x36b4a1,_0x6d540d[_0xe910('0x13')][_0xe910('0x15')]);return _0x37d9f6(_0x6d540d[_0xe910('0x13')][_0xe910('0x15')]);}logger[_0xe910('0x13')](_0xe910('0xe'),_0x36b4a1,_0x6d540d[_0xe910('0x13')][_0xe910('0x15')]);return _0xa1de34(_0x6d540d[_0xe910('0x13')][_0xe910('0x15')]);}else{logger[_0xe910('0xd')](_0xe910('0xe'),_0x36b4a1,_0xe910('0xf'));_0xa1de34(_0x6d540d[_0xe910('0x16')][_0xe910('0x15')]);}})['catch'](function(_0x13f810){logger[_0xe910('0x13')](_0xe910('0xe'),_0x36b4a1,_0x13f810);_0x37d9f6(_0x13f810);});});}exports['GetSalesforceAccount']=function(_0x1d31f6){var _0x736ef5=this;return new Promise(function(_0x56f042,_0x3f9c25){return db[_0xe910('0x17')][_0xe910('0x18')]({'raw':_0x1d31f6[_0xe910('0x19')]?_0x1d31f6[_0xe910('0x19')][_0xe910('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d31f6[_0xe910('0x19')]?_0x1d31f6[_0xe910('0x19')][_0xe910('0x1b')]||null:null,'attributes':_0x1d31f6[_0xe910('0x19')]?_0x1d31f6['options']['attributes']||null:null,'limit':_0x1d31f6['options']?_0x1d31f6[_0xe910('0x19')][_0xe910('0x1c')]||null:null,'include':_0x1d31f6[_0xe910('0x19')]?_0x1d31f6['options'][_0xe910('0x1d')]?_[_0xe910('0x1e')](_0x1d31f6[_0xe910('0x19')]['include'],function(_0x227676){return{'model':db[_0x227676[_0xe910('0x1f')]],'as':_0x227676['as'],'attributes':_0x227676[_0xe910('0x20')],'include':_0x227676[_0xe910('0x1d')]?_[_0xe910('0x1e')](_0x227676[_0xe910('0x1d')],function(_0x170e6b){return{'model':db[_0x170e6b[_0xe910('0x1f')]],'as':_0x170e6b['as'],'attributes':_0x170e6b[_0xe910('0x20')],'include':_0x170e6b[_0xe910('0x1d')]?_[_0xe910('0x1e')](_0x170e6b['include'],function(_0x5b1d9c){return{'model':db[_0x5b1d9c[_0xe910('0x1f')]],'as':_0x5b1d9c['as'],'attributes':_0x5b1d9c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe910('0xc')](function(_0x5e2594){logger['info'](_0xe910('0x21'),_0x1d31f6);logger[_0xe910('0x10')](_0xe910('0x21'),_0x1d31f6,JSON[_0xe910('0x12')](_0x5e2594));_0x56f042(_0x5e2594);})[_0xe910('0x22')](function(_0x42207a){logger['error'](_0xe910('0x21'),_0x42207a[_0xe910('0x15')],_0x1d31f6);_0x3f9c25(_0x736ef5[_0xe910('0x13')](0x1f4,_0x42207a[_0xe910('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x4aa734){var _0x273585=this;return new Promise(function(_0x4934df,_0x4f515d){return db[_0xe910('0x17')][_0xe910('0x23')]({'raw':_0x4aa734[_0xe910('0x19')]?_0x4aa734[_0xe910('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4aa734[_0xe910('0x19')]?_0x4aa734[_0xe910('0x19')][_0xe910('0x1b')]||null:null,'attributes':_0x4aa734[_0xe910('0x19')]?_0x4aa734[_0xe910('0x19')][_0xe910('0x20')]||null:null,'include':_0x4aa734[_0xe910('0x19')]?_0x4aa734[_0xe910('0x19')]['include']?_[_0xe910('0x1e')](_0x4aa734[_0xe910('0x19')][_0xe910('0x1d')],function(_0x411e36){return{'model':db[_0x411e36['model']],'as':_0x411e36['as'],'attributes':_0x411e36['attributes'],'include':_0x411e36[_0xe910('0x1d')]?_[_0xe910('0x1e')](_0x411e36[_0xe910('0x1d')],function(_0x1fa336){return{'model':db[_0x1fa336[_0xe910('0x1f')]],'as':_0x1fa336['as'],'attributes':_0x1fa336[_0xe910('0x20')],'include':_0x1fa336[_0xe910('0x1d')]?_[_0xe910('0x1e')](_0x1fa336['include'],function(_0x8fb7a5){return{'model':db[_0x8fb7a5['model']],'as':_0x8fb7a5['as'],'attributes':_0x8fb7a5[_0xe910('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe910('0xc')](function(_0x2e7cb5){logger[_0xe910('0xd')](_0xe910('0x24'),_0x4aa734);logger[_0xe910('0x10')](_0xe910('0x24'),_0x4aa734,JSON[_0xe910('0x12')](_0x2e7cb5));_0x4934df(_0x2e7cb5);})['catch'](function(_0x32d086){logger['error']('ShowSalesforceAccount',_0x32d086[_0xe910('0x15')],_0x4aa734);_0x4f515d(_0x273585[_0xe910('0x13')](0x1f4,_0x32d086[_0xe910('0x15')]));});});}; \ No newline at end of file +var _0x68bc=['findAll','options','raw','limit','include','model','attributes','map','then','GetSalesforceAccount','find','where','ShowSalesforceAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SalesforceAccount'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x68bc,0xbc));var _0xc68b=function(_0x4e2a5a,_0x2dbc48){_0x4e2a5a=_0x4e2a5a-0x0;var _0x5bb4d1=_0x68bc[_0x4e2a5a];return _0x5bb4d1;};'use strict';var _=require(_0xc68b('0x0'));var util=require('util');var moment=require(_0xc68b('0x1'));var BPromise=require('bluebird');var rs=require(_0xc68b('0x2'));var fs=require('fs');var Redis=require(_0xc68b('0x3'));var db=require(_0xc68b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc68b('0x5'))(_0xc68b('0x6'));var config=require(_0xc68b('0x7'));var jayson=require(_0xc68b('0x8'));var client=jayson['client'][_0xc68b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24b08f,_0x32f12a,_0x35b48a){return new BPromise(function(_0x1367fc,_0x29035b){return client[_0xc68b('0xa')](_0x24b08f,_0x35b48a)['then'](function(_0x158daa){logger[_0xc68b('0xb')](_0xc68b('0xc'),_0x32f12a,'request\x20sent');logger[_0xc68b('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x32f12a,_0xc68b('0xe'),JSON[_0xc68b('0xf')](_0x158daa));if(_0x158daa[_0xc68b('0x10')]){if(_0x158daa['error'][_0xc68b('0x11')]===0x1f4){logger[_0xc68b('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x32f12a,_0x158daa[_0xc68b('0x10')][_0xc68b('0x12')]);return _0x29035b(_0x158daa['error'][_0xc68b('0x12')]);}logger[_0xc68b('0x10')](_0xc68b('0xc'),_0x32f12a,_0x158daa['error'][_0xc68b('0x12')]);return _0x1367fc(_0x158daa[_0xc68b('0x10')]['message']);}else{logger['info'](_0xc68b('0xc'),_0x32f12a,'request\x20sent');_0x1367fc(_0x158daa[_0xc68b('0x13')][_0xc68b('0x12')]);}})[_0xc68b('0x14')](function(_0x2aa925){logger[_0xc68b('0x10')](_0xc68b('0xc'),_0x32f12a,_0x2aa925);_0x29035b(_0x2aa925);});});}exports['GetSalesforceAccount']=function(_0xdc96ab){var _0x19ef67=this;return new Promise(function(_0x27174d,_0x5e236a){return db[_0xc68b('0x15')][_0xc68b('0x16')]({'raw':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')][_0xc68b('0x18')]===undefined?!![]:![]:!![],'where':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')]['where']||null:null,'attributes':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab['options']['attributes']||null:null,'limit':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')][_0xc68b('0x19')]||null:null,'include':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')][_0xc68b('0x1a')]?_['map'](_0xdc96ab[_0xc68b('0x17')]['include'],function(_0x38f759){return{'model':db[_0x38f759[_0xc68b('0x1b')]],'as':_0x38f759['as'],'attributes':_0x38f759[_0xc68b('0x1c')],'include':_0x38f759['include']?_[_0xc68b('0x1d')](_0x38f759[_0xc68b('0x1a')],function(_0x11c5d){return{'model':db[_0x11c5d[_0xc68b('0x1b')]],'as':_0x11c5d['as'],'attributes':_0x11c5d[_0xc68b('0x1c')],'include':_0x11c5d['include']?_[_0xc68b('0x1d')](_0x11c5d['include'],function(_0x647bea){return{'model':db[_0x647bea[_0xc68b('0x1b')]],'as':_0x647bea['as'],'attributes':_0x647bea[_0xc68b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc68b('0x1e')](function(_0x417533){logger[_0xc68b('0xb')](_0xc68b('0x1f'),_0xdc96ab);logger[_0xc68b('0xd')](_0xc68b('0x1f'),_0xdc96ab,JSON['stringify'](_0x417533));_0x27174d(_0x417533);})[_0xc68b('0x14')](function(_0x23a862){logger[_0xc68b('0x10')](_0xc68b('0x1f'),_0x23a862[_0xc68b('0x12')],_0xdc96ab);_0x5e236a(_0x19ef67[_0xc68b('0x10')](0x1f4,_0x23a862[_0xc68b('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x2ef82f){var _0x412ce8=this;return new Promise(function(_0x2e1699,_0x7d8830){return db['SalesforceAccount'][_0xc68b('0x20')]({'raw':_0x2ef82f['options']?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x18')]===undefined?!![]:![]:!![],'where':_0x2ef82f['options']?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x21')]||null:null,'attributes':_0x2ef82f[_0xc68b('0x17')]?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x1c')]||null:null,'include':_0x2ef82f[_0xc68b('0x17')]?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x1a')]?_[_0xc68b('0x1d')](_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x1a')],function(_0x4718a1){return{'model':db[_0x4718a1[_0xc68b('0x1b')]],'as':_0x4718a1['as'],'attributes':_0x4718a1[_0xc68b('0x1c')],'include':_0x4718a1[_0xc68b('0x1a')]?_[_0xc68b('0x1d')](_0x4718a1[_0xc68b('0x1a')],function(_0x2a095b){return{'model':db[_0x2a095b[_0xc68b('0x1b')]],'as':_0x2a095b['as'],'attributes':_0x2a095b[_0xc68b('0x1c')],'include':_0x2a095b[_0xc68b('0x1a')]?_['map'](_0x2a095b[_0xc68b('0x1a')],function(_0x571b0d){return{'model':db[_0x571b0d[_0xc68b('0x1b')]],'as':_0x571b0d['as'],'attributes':_0x571b0d[_0xc68b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc68b('0x1e')](function(_0x527d89){logger[_0xc68b('0xb')]('ShowSalesforceAccount',_0x2ef82f);logger[_0xc68b('0xd')](_0xc68b('0x22'),_0x2ef82f,JSON[_0xc68b('0xf')](_0x527d89));_0x2e1699(_0x527d89);})[_0xc68b('0x14')](function(_0x23bd5f){logger[_0xc68b('0x10')](_0xc68b('0x22'),_0x23bd5f['message'],_0x2ef82f);_0x7d8830(_0x412ce8[_0xc68b('0x10')](0x1f4,_0x23bd5f['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 25b15f7..0423cdd 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x357c4c,_0x11351c){var _0xc190f1=function(_0x3d6005){while(--_0x3d6005){_0x357c4c['push'](_0x357c4c['shift']());}};_0xc190f1(++_0x11351c);}(_0x7a54,0x106));var _0x47a5=function(_0x3cf02c,_0xffa2ef){_0x3cf02c=_0x3cf02c-0x0;var _0x34be87=_0x7a54[_0x3cf02c];return _0x34be87;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5d9cd2,_0x41ecec){var _0x2dea21=function(_0x4a203f){while(--_0x4a203f){_0x5d9cd2['push'](_0x5d9cd2['shift']());}};_0x2dea21(++_0x41ecec);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index bbedd6f..cc0061b 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 _0xa3e8=['account','sequelize','exports','STRING','ENUM','Task','contact','lead','account_contact_lead'];(function(_0x5a52cb,_0x3cc28f){var _0x56cc1a=function(_0x5116ec){while(--_0x5116ec){_0x5a52cb['push'](_0x5a52cb['shift']());}};_0x56cc1a(++_0x3cc28f);}(_0xa3e8,0x1f0));var _0x8a3e=function(_0x59dcc,_0x18b815){_0x59dcc=_0x59dcc-0x0;var _0x25891d=_0xa3e8[_0x59dcc];return _0x25891d;};'use strict';var Sequelize=require(_0x8a3e('0x0'));module[_0x8a3e('0x1')]={'name':{'type':Sequelize[_0x8a3e('0x2')]},'description':{'type':Sequelize[_0x8a3e('0x2')]},'ticketType':{'type':Sequelize[_0x8a3e('0x3')](_0x8a3e('0x4'),'Case'),'defaultValue':_0x8a3e('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x8a3e('0x5'),_0x8a3e('0x6'),_0x8a3e('0x7'),_0x8a3e('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x8a3e('0x5'),_0x8a3e('0x6'),_0x8a3e('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x8a3e('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x8a3e('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x8a3e('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x283d=['nothing','contact','lead','sequelize','exports','STRING','ENUM','Task','Case','account_contact_lead','account','contact_lead'];(function(_0x2fe4b5,_0x439480){var _0x2b9c0b=function(_0x5bfca9){while(--_0x5bfca9){_0x2fe4b5['push'](_0x2fe4b5['shift']());}};_0x2b9c0b(++_0x439480);}(_0x283d,0x9f));var _0xd283=function(_0x3fcc9d,_0x1c6ffc){_0x3fcc9d=_0x3fcc9d-0x0;var _0x3205fe=_0x283d[_0x3fcc9d];return _0x3205fe;};'use strict';var Sequelize=require(_0xd283('0x0'));module[_0xd283('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd283('0x2')]},'ticketType':{'type':Sequelize[_0xd283('0x3')](_0xd283('0x4'),_0xd283('0x5')),'defaultValue':_0xd283('0x4')},'moduleSearch':{'type':Sequelize[_0xd283('0x3')]('contact_lead','contact','lead',_0xd283('0x6'),_0xd283('0x7')),'defaultValue':_0xd283('0x8')},'moduleCreate':{'type':Sequelize[_0xd283('0x3')](_0xd283('0x9'),_0xd283('0xa'),_0xd283('0xb'),_0xd283('0x7')),'defaultValue':_0xd283('0xb')},'leadId':{'type':Sequelize[_0xd283('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd283('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd283('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd283('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index aff6173..f45b943 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 _0xedc1=['find','create','update','body','getFields','findOne','pick','filter','nolimit','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x3906fe,_0x4729b4){var _0x8cb00b=function(_0x4db14e){while(--_0x4db14e){_0x3906fe['push'](_0x3906fe['shift']());}};_0x8cb00b(++_0x4729b4);}(_0xedc1,0x158));var _0x1edc=function(_0x239b5e,_0x208a3f){_0x239b5e=_0x239b5e-0x0;var _0x577f3d=_0xedc1[_0x239b5e];return _0x577f3d;};'use strict';var emlformat=require(_0x1edc('0x0'));var rimraf=require(_0x1edc('0x1'));var zipdir=require(_0x1edc('0x2'));var jsonpatch=require(_0x1edc('0x3'));var rp=require(_0x1edc('0x4'));var moment=require(_0x1edc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1edc('0x6'));var util=require(_0x1edc('0x7'));var path=require('path');var sox=require(_0x1edc('0x8'));var csv=require(_0x1edc('0x9'));var ejs=require(_0x1edc('0xa'));var fs=require('fs');var fs_extra=require(_0x1edc('0xb'));var _=require(_0x1edc('0xc'));var squel=require(_0x1edc('0xd'));var crypto=require(_0x1edc('0xe'));var jsforce=require(_0x1edc('0xf'));var deskjs=require(_0x1edc('0x10'));var toCsv=require(_0x1edc('0x9'));var querystring=require(_0x1edc('0x11'));var Papa=require(_0x1edc('0x12'));var Redis=require('ioredis');var authService=require(_0x1edc('0x13'));var qs=require(_0x1edc('0x14'));var as=require(_0x1edc('0x15'));var hardwareService=require(_0x1edc('0x16'));var logger=require('../../config/logger')(_0x1edc('0x17'));var utils=require('../../config/utils');var config=require(_0x1edc('0x18'));var licenseUtil=require(_0x1edc('0x19'));var db=require(_0x1edc('0x1a'))['db'];function respondWithStatusCode(_0x419fc4,_0x22b0ff){_0x22b0ff=_0x22b0ff||0xcc;return function(_0x4a599e){if(_0x4a599e){return _0x419fc4[_0x1edc('0x1b')](_0x22b0ff);}return _0x419fc4['status'](_0x22b0ff)[_0x1edc('0x1c')]();};}function respondWithResult(_0x41737c,_0x129b8d){_0x129b8d=_0x129b8d||0xc8;return function(_0x57ecf8){if(_0x57ecf8){return _0x41737c[_0x1edc('0x1d')](_0x129b8d)[_0x1edc('0x1e')](_0x57ecf8);}};}function respondWithFilteredResult(_0x2f553c,_0x4d7730){return function(_0x236345){if(_0x236345){var _0x384e09=typeof _0x4d7730[_0x1edc('0x1f')]===_0x1edc('0x20')&&typeof _0x4d7730[_0x1edc('0x21')]===_0x1edc('0x20');var _0x2aa695=_0x236345['count'];var _0x1dedb8=_0x384e09?0x0:_0x4d7730['offset'];var _0x23e7a2=_0x384e09?_0x236345[_0x1edc('0x22')]:_0x4d7730[_0x1edc('0x1f')]+_0x4d7730[_0x1edc('0x21')];var _0x47fcdc;if(_0x23e7a2>=_0x2aa695){_0x23e7a2=_0x2aa695;_0x47fcdc=0xc8;}else{_0x47fcdc=0xce;}_0x2f553c[_0x1edc('0x1d')](_0x47fcdc);return _0x2f553c['set'](_0x1edc('0x23'),_0x1dedb8+'-'+_0x23e7a2+'/'+_0x2aa695)[_0x1edc('0x1e')](_0x236345);}return null;};}function patchUpdates(_0x9752e7){return function(_0x6c2cad){try{jsonpatch[_0x1edc('0x24')](_0x6c2cad,_0x9752e7,!![]);}catch(_0x5ef325){return BPromise['reject'](_0x5ef325);}return _0x6c2cad[_0x1edc('0x25')]();};}function saveUpdates(_0xe740b6,_0x504b89){return function(_0x20c872){if(_0x20c872){return _0x20c872['update'](_0xe740b6)[_0x1edc('0x26')](function(_0x362598){return _0x362598;});}return null;};}function removeEntity(_0x52872f,_0x20780f){return function(_0x4c467b){if(_0x4c467b){return _0x4c467b[_0x1edc('0x27')]()[_0x1edc('0x26')](function(){_0x52872f[_0x1edc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23f6c2,_0x4f2a9c){return function(_0x3ce3a3){if(!_0x3ce3a3){_0x23f6c2[_0x1edc('0x1b')](0x194);}return _0x3ce3a3;};}function handleError(_0x26192d,_0x2dd0bb){_0x2dd0bb=_0x2dd0bb||0x1f4;return function(_0xc5b2bd){logger[_0x1edc('0x28')](_0xc5b2bd[_0x1edc('0x29')]);if(_0xc5b2bd[_0x1edc('0x2a')]){delete _0xc5b2bd[_0x1edc('0x2a')];}_0x26192d['status'](_0x2dd0bb)[_0x1edc('0x2b')](_0xc5b2bd);};}exports[_0x1edc('0x2c')]=function(_0x13918c,_0x33c5bc){var _0x39fe30={},_0x37609c={},_0x46cdb6={'count':0x0,'rows':[]};var _0x1dd6b7=_[_0x1edc('0x2d')](db[_0x1edc('0x2e')][_0x1edc('0x2f')],function(_0x1ec09b){return{'name':_0x1ec09b[_0x1edc('0x30')],'type':_0x1ec09b[_0x1edc('0x31')]['key']};});_0x37609c[_0x1edc('0x32')]=_[_0x1edc('0x2d')](_0x1dd6b7,'name');_0x37609c['query']=_[_0x1edc('0x33')](_0x13918c[_0x1edc('0x34')]);_0x37609c[_0x1edc('0x35')]=_[_0x1edc('0x36')](_0x37609c[_0x1edc('0x32')],_0x37609c[_0x1edc('0x34')]);_0x39fe30[_0x1edc('0x37')]=_[_0x1edc('0x36')](_0x37609c[_0x1edc('0x32')],qs[_0x1edc('0x38')](_0x13918c[_0x1edc('0x34')]['fields']));_0x39fe30[_0x1edc('0x37')]=_0x39fe30[_0x1edc('0x37')][_0x1edc('0x39')]?_0x39fe30['attributes']:_0x37609c[_0x1edc('0x32')];if(!_0x13918c[_0x1edc('0x34')][_0x1edc('0x3a')]('nolimit')){_0x39fe30['limit']=qs[_0x1edc('0x21')](_0x13918c[_0x1edc('0x34')][_0x1edc('0x21')]);_0x39fe30[_0x1edc('0x1f')]=qs[_0x1edc('0x1f')](_0x13918c[_0x1edc('0x34')][_0x1edc('0x1f')]);}_0x39fe30[_0x1edc('0x3b')]=qs['sort'](_0x13918c['query'][_0x1edc('0x3c')]);_0x39fe30[_0x1edc('0x3d')]=qs[_0x1edc('0x35')](_['pick'](_0x13918c[_0x1edc('0x34')],_0x37609c[_0x1edc('0x35')]),_0x1dd6b7);if(_0x13918c[_0x1edc('0x34')]['filter']){_0x39fe30[_0x1edc('0x3d')]=_[_0x1edc('0x3e')](_0x39fe30[_0x1edc('0x3d')],{'$or':_[_0x1edc('0x2d')](_0x1dd6b7,function(_0x4186c){if(_0x4186c[_0x1edc('0x31')]!=='VIRTUAL'){var _0x4d9e70={};_0x4d9e70[_0x4186c[_0x1edc('0x2a')]]={'$like':'%'+_0x13918c[_0x1edc('0x34')]['filter']+'%'};return _0x4d9e70;}})});}_0x39fe30=_['merge']({},_0x39fe30,_0x13918c[_0x1edc('0x3f')]);var _0x103aca={'where':_0x39fe30[_0x1edc('0x3d')]};return db[_0x1edc('0x2e')][_0x1edc('0x22')](_0x103aca)['then'](function(_0x1a5c4e){_0x46cdb6[_0x1edc('0x22')]=_0x1a5c4e;if(_0x13918c[_0x1edc('0x34')][_0x1edc('0x40')]){_0x39fe30[_0x1edc('0x41')]=[{'all':!![]}];}return db[_0x1edc('0x2e')][_0x1edc('0x42')](_0x39fe30);})['then'](function(_0x402534){_0x46cdb6[_0x1edc('0x43')]=_0x402534;return _0x46cdb6;})[_0x1edc('0x26')](respondWithFilteredResult(_0x33c5bc,_0x39fe30))[_0x1edc('0x44')](handleError(_0x33c5bc,null));};exports[_0x1edc('0x45')]=function(_0x33f55c,_0x4f66da){var _0x595c06={'raw':![],'where':{'id':_0x33f55c[_0x1edc('0x46')]['id']}},_0x151488={};_0x151488[_0x1edc('0x32')]=_[_0x1edc('0x33')](db[_0x1edc('0x2e')][_0x1edc('0x2f')]);_0x151488[_0x1edc('0x34')]=_[_0x1edc('0x33')](_0x33f55c[_0x1edc('0x34')]);_0x151488[_0x1edc('0x35')]=_[_0x1edc('0x36')](_0x151488[_0x1edc('0x32')],_0x151488['query']);_0x595c06[_0x1edc('0x37')]=_[_0x1edc('0x36')](_0x151488[_0x1edc('0x32')],qs['fields'](_0x33f55c[_0x1edc('0x34')][_0x1edc('0x38')]));_0x595c06[_0x1edc('0x37')]=_0x595c06[_0x1edc('0x37')][_0x1edc('0x39')]?_0x595c06[_0x1edc('0x37')]:_0x151488[_0x1edc('0x32')];if(_0x33f55c['query']['includeAll']){_0x595c06[_0x1edc('0x41')]=[{'all':!![]}];}_0x595c06=_[_0x1edc('0x3e')]({},_0x595c06,_0x33f55c[_0x1edc('0x3f')]);return db['SalesforceConfiguration'][_0x1edc('0x47')](_0x595c06)[_0x1edc('0x26')](handleEntityNotFound(_0x4f66da,null))[_0x1edc('0x26')](respondWithResult(_0x4f66da,null))[_0x1edc('0x44')](handleError(_0x4f66da,null));};exports[_0x1edc('0x48')]=function(_0xefc1b3,_0x172b9f){return db[_0x1edc('0x2e')][_0x1edc('0x48')](_0xefc1b3['body'],{})[_0x1edc('0x26')](respondWithResult(_0x172b9f,0xc9))[_0x1edc('0x44')](handleError(_0x172b9f,null));};exports[_0x1edc('0x49')]=function(_0x155b20,_0x3643b4){if(_0x155b20[_0x1edc('0x4a')]['id']){delete _0x155b20[_0x1edc('0x4a')]['id'];}return db[_0x1edc('0x2e')][_0x1edc('0x47')]({'where':{'id':_0x155b20[_0x1edc('0x46')]['id']}})[_0x1edc('0x26')](handleEntityNotFound(_0x3643b4,null))[_0x1edc('0x26')](saveUpdates(_0x155b20['body'],null))[_0x1edc('0x26')](respondWithResult(_0x3643b4,null))['catch'](handleError(_0x3643b4,null));};exports[_0x1edc('0x27')]=function(_0x384625,_0x181596){return db['SalesforceConfiguration'][_0x1edc('0x47')]({'where':{'id':_0x384625[_0x1edc('0x46')]['id']}})[_0x1edc('0x26')](handleEntityNotFound(_0x181596,null))[_0x1edc('0x26')](removeEntity(_0x181596,null))[_0x1edc('0x44')](handleError(_0x181596,null));};exports[_0x1edc('0x4b')]=function(_0x52eee4,_0x52c766,_0x422bfa){var _0x31e42c={};var _0x15975b={};var _0x910534;var _0x45ce9f;return db[_0x1edc('0x2e')][_0x1edc('0x4c')]({'where':{'id':_0x52eee4['params']['id']}})[_0x1edc('0x26')](handleEntityNotFound(_0x52c766,null))[_0x1edc('0x26')](function(_0x4137a0){if(_0x4137a0){_0x910534=_0x4137a0;_0x15975b['model']=_[_0x1edc('0x33')](db['SalesforceField'][_0x1edc('0x2f')]);_0x15975b['query']=_[_0x1edc('0x33')](_0x52eee4[_0x1edc('0x34')]);_0x15975b[_0x1edc('0x35')]=_[_0x1edc('0x36')](_0x15975b[_0x1edc('0x32')],_0x15975b[_0x1edc('0x34')]);_0x31e42c['attributes']=_[_0x1edc('0x36')](_0x15975b[_0x1edc('0x32')],qs[_0x1edc('0x38')](_0x52eee4[_0x1edc('0x34')]['fields']));_0x31e42c[_0x1edc('0x37')]=_0x31e42c[_0x1edc('0x37')][_0x1edc('0x39')]?_0x31e42c['attributes']:_0x15975b[_0x1edc('0x32')];_0x31e42c[_0x1edc('0x3b')]=qs['sort'](_0x52eee4[_0x1edc('0x34')][_0x1edc('0x3c')]);_0x31e42c[_0x1edc('0x3d')]=qs[_0x1edc('0x35')](_[_0x1edc('0x4d')](_0x52eee4['query'],_0x15975b['filters']));if(_0x52eee4['query'][_0x1edc('0x4e')]){_0x31e42c[_0x1edc('0x3d')]=_['merge'](_0x31e42c['where'],{'$or':_['map'](_0x31e42c[_0x1edc('0x37')],function(_0xa086b){var _0x431537={};_0x431537[_0xa086b]={'$like':'%'+_0x52eee4[_0x1edc('0x34')][_0x1edc('0x4e')]+'%'};return _0x431537;})});}_0x31e42c=_[_0x1edc('0x3e')]({},_0x31e42c,_0x52eee4['options']);return _0x910534[_0x1edc('0x4b')](_0x31e42c);}})[_0x1edc('0x26')](function(_0x41acc4){if(_0x41acc4){_0x45ce9f=_0x41acc4['length'];if(!_0x52eee4[_0x1edc('0x34')][_0x1edc('0x3a')](_0x1edc('0x4f'))){_0x31e42c[_0x1edc('0x21')]=qs['limit'](_0x52eee4[_0x1edc('0x34')]['limit']);_0x31e42c['offset']=qs[_0x1edc('0x1f')](_0x52eee4[_0x1edc('0x34')][_0x1edc('0x1f')]);}return _0x910534[_0x1edc('0x4b')](_0x31e42c);}})[_0x1edc('0x26')](function(_0x6f7a6c){if(_0x6f7a6c){return _0x6f7a6c?{'count':_0x45ce9f,'rows':_0x6f7a6c}:null;}})[_0x1edc('0x26')](respondWithResult(_0x52c766,null))[_0x1edc('0x44')](handleError(_0x52c766,null));};exports[_0x1edc('0x50')]=function(_0x180eee,_0x55689a,_0x51db50){var _0x15aee3={};var _0x346d71={};var _0x4b7372;var _0x3739bf;return db[_0x1edc('0x2e')][_0x1edc('0x4c')]({'where':{'id':_0x180eee[_0x1edc('0x46')]['id']}})[_0x1edc('0x26')](handleEntityNotFound(_0x55689a,null))[_0x1edc('0x26')](function(_0x2e9c44){if(_0x2e9c44){_0x4b7372=_0x2e9c44;_0x346d71[_0x1edc('0x32')]=_[_0x1edc('0x33')](db['SalesforceField'][_0x1edc('0x2f')]);_0x346d71[_0x1edc('0x34')]=_[_0x1edc('0x33')](_0x180eee[_0x1edc('0x34')]);_0x346d71['filters']=_[_0x1edc('0x36')](_0x346d71[_0x1edc('0x32')],_0x346d71[_0x1edc('0x34')]);_0x15aee3[_0x1edc('0x37')]=_[_0x1edc('0x36')](_0x346d71['model'],qs[_0x1edc('0x38')](_0x180eee[_0x1edc('0x34')][_0x1edc('0x38')]));_0x15aee3[_0x1edc('0x37')]=_0x15aee3[_0x1edc('0x37')][_0x1edc('0x39')]?_0x15aee3['attributes']:_0x346d71[_0x1edc('0x32')];_0x15aee3[_0x1edc('0x3b')]=qs['sort'](_0x180eee[_0x1edc('0x34')]['sort']);_0x15aee3[_0x1edc('0x3d')]=qs[_0x1edc('0x35')](_[_0x1edc('0x4d')](_0x180eee[_0x1edc('0x34')],_0x346d71[_0x1edc('0x35')]));if(_0x180eee[_0x1edc('0x34')][_0x1edc('0x4e')]){_0x15aee3[_0x1edc('0x3d')]=_[_0x1edc('0x3e')](_0x15aee3[_0x1edc('0x3d')],{'$or':_[_0x1edc('0x2d')](_0x15aee3[_0x1edc('0x37')],function(_0x27e917){var _0x20d834={};_0x20d834[_0x27e917]={'$like':'%'+_0x180eee[_0x1edc('0x34')][_0x1edc('0x4e')]+'%'};return _0x20d834;})});}_0x15aee3=_[_0x1edc('0x3e')]({},_0x15aee3,_0x180eee[_0x1edc('0x3f')]);return _0x4b7372[_0x1edc('0x50')](_0x15aee3);}})['then'](function(_0x55fda4){if(_0x55fda4){_0x3739bf=_0x55fda4[_0x1edc('0x39')];if(!_0x180eee['query'][_0x1edc('0x3a')](_0x1edc('0x4f'))){_0x15aee3[_0x1edc('0x21')]=qs[_0x1edc('0x21')](_0x180eee[_0x1edc('0x34')]['limit']);_0x15aee3[_0x1edc('0x1f')]=qs[_0x1edc('0x1f')](_0x180eee[_0x1edc('0x34')]['offset']);}return _0x4b7372['getSubjects'](_0x15aee3);}})[_0x1edc('0x26')](function(_0x63655c){if(_0x63655c){return _0x63655c?{'count':_0x3739bf,'rows':_0x63655c}:null;}})['then'](respondWithResult(_0x55689a,null))[_0x1edc('0x44')](handleError(_0x55689a,null));};exports['getDescriptions']=function(_0x378149,_0x48b850,_0x141288){var _0x5e5a24={};var _0x55e581={};var _0xa056af;var _0x209cc9;return db[_0x1edc('0x2e')][_0x1edc('0x4c')]({'where':{'id':_0x378149[_0x1edc('0x46')]['id']}})[_0x1edc('0x26')](handleEntityNotFound(_0x48b850,null))['then'](function(_0x4db904){if(_0x4db904){_0xa056af=_0x4db904;_0x55e581[_0x1edc('0x32')]=_['keys'](db[_0x1edc('0x51')]['rawAttributes']);_0x55e581[_0x1edc('0x34')]=_[_0x1edc('0x33')](_0x378149['query']);_0x55e581[_0x1edc('0x35')]=_[_0x1edc('0x36')](_0x55e581[_0x1edc('0x32')],_0x55e581[_0x1edc('0x34')]);_0x5e5a24[_0x1edc('0x37')]=_[_0x1edc('0x36')](_0x55e581[_0x1edc('0x32')],qs[_0x1edc('0x38')](_0x378149[_0x1edc('0x34')][_0x1edc('0x38')]));_0x5e5a24[_0x1edc('0x37')]=_0x5e5a24[_0x1edc('0x37')][_0x1edc('0x39')]?_0x5e5a24[_0x1edc('0x37')]:_0x55e581[_0x1edc('0x32')];_0x5e5a24['order']=qs[_0x1edc('0x3c')](_0x378149[_0x1edc('0x34')][_0x1edc('0x3c')]);_0x5e5a24[_0x1edc('0x3d')]=qs[_0x1edc('0x35')](_[_0x1edc('0x4d')](_0x378149[_0x1edc('0x34')],_0x55e581[_0x1edc('0x35')]));if(_0x378149['query'][_0x1edc('0x4e')]){_0x5e5a24[_0x1edc('0x3d')]=_[_0x1edc('0x3e')](_0x5e5a24['where'],{'$or':_[_0x1edc('0x2d')](_0x5e5a24[_0x1edc('0x37')],function(_0x3bbbc8){var _0x21d490={};_0x21d490[_0x3bbbc8]={'$like':'%'+_0x378149[_0x1edc('0x34')][_0x1edc('0x4e')]+'%'};return _0x21d490;})});}_0x5e5a24=_[_0x1edc('0x3e')]({},_0x5e5a24,_0x378149['options']);return _0xa056af[_0x1edc('0x52')](_0x5e5a24);}})[_0x1edc('0x26')](function(_0x124044){if(_0x124044){_0x209cc9=_0x124044['length'];if(!_0x378149[_0x1edc('0x34')][_0x1edc('0x3a')](_0x1edc('0x4f'))){_0x5e5a24[_0x1edc('0x21')]=qs[_0x1edc('0x21')](_0x378149['query'][_0x1edc('0x21')]);_0x5e5a24[_0x1edc('0x1f')]=qs[_0x1edc('0x1f')](_0x378149['query'][_0x1edc('0x1f')]);}return _0xa056af['getDescriptions'](_0x5e5a24);}})[_0x1edc('0x26')](function(_0x444ab9){if(_0x444ab9){return _0x444ab9?{'count':_0x209cc9,'rows':_0x444ab9}:null;}})[_0x1edc('0x26')](respondWithResult(_0x48b850,null))['catch'](handleError(_0x48b850,null));}; \ No newline at end of file +var _0xef2c=['mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0xa85dbd,_0x2838a5){var _0x3be7aa=function(_0x2573f8){while(--_0x2573f8){_0xa85dbd['push'](_0xa85dbd['shift']());}};_0x3be7aa(++_0x2838a5);}(_0xef2c,0x177));var _0xcef2=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xef2c[_0x32f9ca];return _0x52e083;};'use strict';var emlformat=require(_0xcef2('0x0'));var rimraf=require(_0xcef2('0x1'));var zipdir=require(_0xcef2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcef2('0x3'));var BPromise=require(_0xcef2('0x4'));var Mustache=require(_0xcef2('0x5'));var util=require(_0xcef2('0x6'));var path=require(_0xcef2('0x7'));var sox=require(_0xcef2('0x8'));var csv=require(_0xcef2('0x9'));var ejs=require(_0xcef2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcef2('0xb'));var squel=require(_0xcef2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcef2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcef2('0xe'));var authService=require(_0xcef2('0xf'));var qs=require(_0xcef2('0x10'));var as=require(_0xcef2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcef2('0x12'));var utils=require(_0xcef2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcef2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29404d,_0x3ac41e){_0x3ac41e=_0x3ac41e||0xcc;return function(_0x4527ed){if(_0x4527ed){return _0x29404d[_0xcef2('0x15')](_0x3ac41e);}return _0x29404d[_0xcef2('0x16')](_0x3ac41e)[_0xcef2('0x17')]();};}function respondWithResult(_0x38cae6,_0x1da842){_0x1da842=_0x1da842||0xc8;return function(_0x1567eb){if(_0x1567eb){return _0x38cae6[_0xcef2('0x16')](_0x1da842)[_0xcef2('0x18')](_0x1567eb);}};}function respondWithFilteredResult(_0x3df183,_0x54963c){return function(_0x1e6c7a){if(_0x1e6c7a){var _0x3c42a6=typeof _0x54963c['offset']===_0xcef2('0x19')&&typeof _0x54963c[_0xcef2('0x1a')]===_0xcef2('0x19');var _0x30df0f=_0x1e6c7a[_0xcef2('0x1b')];var _0x466f14=_0x3c42a6?0x0:_0x54963c['offset'];var _0x34eec9=_0x3c42a6?_0x1e6c7a[_0xcef2('0x1b')]:_0x54963c[_0xcef2('0x1c')]+_0x54963c[_0xcef2('0x1a')];var _0x2ef257;if(_0x34eec9>=_0x30df0f){_0x34eec9=_0x30df0f;_0x2ef257=0xc8;}else{_0x2ef257=0xce;}_0x3df183[_0xcef2('0x16')](_0x2ef257);return _0x3df183['set']('Content-Range',_0x466f14+'-'+_0x34eec9+'/'+_0x30df0f)[_0xcef2('0x18')](_0x1e6c7a);}return null;};}function patchUpdates(_0x212ae7){return function(_0x49f315){try{jsonpatch[_0xcef2('0x1d')](_0x49f315,_0x212ae7,!![]);}catch(_0x24de35){return BPromise[_0xcef2('0x1e')](_0x24de35);}return _0x49f315[_0xcef2('0x1f')]();};}function saveUpdates(_0x585230,_0x30dcfe){return function(_0x5a5974){if(_0x5a5974){return _0x5a5974[_0xcef2('0x20')](_0x585230)[_0xcef2('0x21')](function(_0x37f3b7){return _0x37f3b7;});}return null;};}function removeEntity(_0x2faa4a,_0x27094b){return function(_0xdcf3e7){if(_0xdcf3e7){return _0xdcf3e7[_0xcef2('0x22')]()[_0xcef2('0x21')](function(){_0x2faa4a[_0xcef2('0x16')](0xcc)[_0xcef2('0x17')]();});}};}function handleEntityNotFound(_0x3d827b,_0x85a58f){return function(_0x53c68c){if(!_0x53c68c){_0x3d827b['sendStatus'](0x194);}return _0x53c68c;};}function handleError(_0x4ce98f,_0xe69fdc){_0xe69fdc=_0xe69fdc||0x1f4;return function(_0x350b6e){logger[_0xcef2('0x23')](_0x350b6e['stack']);if(_0x350b6e[_0xcef2('0x24')]){delete _0x350b6e[_0xcef2('0x24')];}_0x4ce98f[_0xcef2('0x16')](_0xe69fdc)['send'](_0x350b6e);};}exports[_0xcef2('0x25')]=function(_0x1c079b,_0x41f4da){var _0x1e36cb={},_0x225cc6={},_0xd85e75={'count':0x0,'rows':[]};var _0xf649a3=_[_0xcef2('0x26')](db[_0xcef2('0x27')][_0xcef2('0x28')],function(_0x2f5253){return{'name':_0x2f5253[_0xcef2('0x29')],'type':_0x2f5253[_0xcef2('0x2a')][_0xcef2('0x2b')]};});_0x225cc6[_0xcef2('0x2c')]=_[_0xcef2('0x26')](_0xf649a3,_0xcef2('0x24'));_0x225cc6[_0xcef2('0x2d')]=_[_0xcef2('0x2e')](_0x1c079b[_0xcef2('0x2d')]);_0x225cc6[_0xcef2('0x2f')]=_[_0xcef2('0x30')](_0x225cc6[_0xcef2('0x2c')],_0x225cc6[_0xcef2('0x2d')]);_0x1e36cb['attributes']=_[_0xcef2('0x30')](_0x225cc6['model'],qs[_0xcef2('0x31')](_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x31')]));_0x1e36cb[_0xcef2('0x32')]=_0x1e36cb[_0xcef2('0x32')][_0xcef2('0x33')]?_0x1e36cb[_0xcef2('0x32')]:_0x225cc6['model'];if(!_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x34')](_0xcef2('0x35'))){_0x1e36cb[_0xcef2('0x1a')]=qs[_0xcef2('0x1a')](_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x1a')]);_0x1e36cb['offset']=qs[_0xcef2('0x1c')](_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x1c')]);}_0x1e36cb[_0xcef2('0x36')]=qs[_0xcef2('0x37')](_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x37')]);_0x1e36cb[_0xcef2('0x38')]=qs[_0xcef2('0x2f')](_['pick'](_0x1c079b['query'],_0x225cc6[_0xcef2('0x2f')]),_0xf649a3);if(_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x39')]){_0x1e36cb[_0xcef2('0x38')]=_['merge'](_0x1e36cb[_0xcef2('0x38')],{'$or':_[_0xcef2('0x26')](_0xf649a3,function(_0x463216){if(_0x463216[_0xcef2('0x2a')]!==_0xcef2('0x3a')){var _0x467d72={};_0x467d72[_0x463216[_0xcef2('0x24')]]={'$like':'%'+_0x1c079b['query']['filter']+'%'};return _0x467d72;}})});}_0x1e36cb=_['merge']({},_0x1e36cb,_0x1c079b[_0xcef2('0x3b')]);var _0x212c29={'where':_0x1e36cb[_0xcef2('0x38')]};return db[_0xcef2('0x27')][_0xcef2('0x1b')](_0x212c29)['then'](function(_0x5d4003){_0xd85e75['count']=_0x5d4003;if(_0x1c079b[_0xcef2('0x2d')][_0xcef2('0x3c')]){_0x1e36cb[_0xcef2('0x3d')]=[{'all':!![]}];}return db[_0xcef2('0x27')][_0xcef2('0x3e')](_0x1e36cb);})['then'](function(_0x473940){_0xd85e75['rows']=_0x473940;return _0xd85e75;})[_0xcef2('0x21')](respondWithFilteredResult(_0x41f4da,_0x1e36cb))[_0xcef2('0x3f')](handleError(_0x41f4da,null));};exports[_0xcef2('0x40')]=function(_0x4654d3,_0x162053){var _0x39f0b2={'raw':![],'where':{'id':_0x4654d3[_0xcef2('0x41')]['id']}},_0x14f63a={};_0x14f63a[_0xcef2('0x2c')]=_[_0xcef2('0x2e')](db[_0xcef2('0x27')][_0xcef2('0x28')]);_0x14f63a['query']=_[_0xcef2('0x2e')](_0x4654d3[_0xcef2('0x2d')]);_0x14f63a[_0xcef2('0x2f')]=_[_0xcef2('0x30')](_0x14f63a[_0xcef2('0x2c')],_0x14f63a[_0xcef2('0x2d')]);_0x39f0b2['attributes']=_['intersection'](_0x14f63a[_0xcef2('0x2c')],qs[_0xcef2('0x31')](_0x4654d3[_0xcef2('0x2d')][_0xcef2('0x31')]));_0x39f0b2[_0xcef2('0x32')]=_0x39f0b2[_0xcef2('0x32')][_0xcef2('0x33')]?_0x39f0b2[_0xcef2('0x32')]:_0x14f63a[_0xcef2('0x2c')];if(_0x4654d3[_0xcef2('0x2d')]['includeAll']){_0x39f0b2[_0xcef2('0x3d')]=[{'all':!![]}];}_0x39f0b2=_[_0xcef2('0x42')]({},_0x39f0b2,_0x4654d3['options']);return db[_0xcef2('0x27')][_0xcef2('0x43')](_0x39f0b2)['then'](handleEntityNotFound(_0x162053,null))['then'](respondWithResult(_0x162053,null))[_0xcef2('0x3f')](handleError(_0x162053,null));};exports[_0xcef2('0x44')]=function(_0x1098fa,_0xb2f831){return db[_0xcef2('0x27')][_0xcef2('0x44')](_0x1098fa[_0xcef2('0x45')],{})[_0xcef2('0x21')](respondWithResult(_0xb2f831,0xc9))[_0xcef2('0x3f')](handleError(_0xb2f831,null));};exports[_0xcef2('0x20')]=function(_0x320315,_0x92bf59){if(_0x320315[_0xcef2('0x45')]['id']){delete _0x320315[_0xcef2('0x45')]['id'];}return db[_0xcef2('0x27')]['find']({'where':{'id':_0x320315[_0xcef2('0x41')]['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x92bf59,null))[_0xcef2('0x21')](saveUpdates(_0x320315[_0xcef2('0x45')],null))['then'](respondWithResult(_0x92bf59,null))[_0xcef2('0x3f')](handleError(_0x92bf59,null));};exports[_0xcef2('0x22')]=function(_0x2c4ccf,_0x2ac09c){return db[_0xcef2('0x27')]['find']({'where':{'id':_0x2c4ccf['params']['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x2ac09c,null))['then'](removeEntity(_0x2ac09c,null))[_0xcef2('0x3f')](handleError(_0x2ac09c,null));};exports[_0xcef2('0x46')]=function(_0x328245,_0x230f74,_0xe71c94){var _0x1efea0={};var _0x2fa33b={};var _0x23ba0b;var _0x4e75ec;return db[_0xcef2('0x27')][_0xcef2('0x47')]({'where':{'id':_0x328245['params']['id']}})['then'](handleEntityNotFound(_0x230f74,null))[_0xcef2('0x21')](function(_0x3aa28a){if(_0x3aa28a){_0x23ba0b=_0x3aa28a;_0x2fa33b['model']=_['keys'](db[_0xcef2('0x48')][_0xcef2('0x28')]);_0x2fa33b[_0xcef2('0x2d')]=_[_0xcef2('0x2e')](_0x328245['query']);_0x2fa33b[_0xcef2('0x2f')]=_[_0xcef2('0x30')](_0x2fa33b['model'],_0x2fa33b['query']);_0x1efea0['attributes']=_['intersection'](_0x2fa33b['model'],qs[_0xcef2('0x31')](_0x328245[_0xcef2('0x2d')][_0xcef2('0x31')]));_0x1efea0[_0xcef2('0x32')]=_0x1efea0[_0xcef2('0x32')][_0xcef2('0x33')]?_0x1efea0[_0xcef2('0x32')]:_0x2fa33b[_0xcef2('0x2c')];_0x1efea0[_0xcef2('0x36')]=qs[_0xcef2('0x37')](_0x328245['query'][_0xcef2('0x37')]);_0x1efea0['where']=qs[_0xcef2('0x2f')](_[_0xcef2('0x49')](_0x328245['query'],_0x2fa33b[_0xcef2('0x2f')]));if(_0x328245[_0xcef2('0x2d')][_0xcef2('0x39')]){_0x1efea0[_0xcef2('0x38')]=_['merge'](_0x1efea0[_0xcef2('0x38')],{'$or':_[_0xcef2('0x26')](_0x1efea0[_0xcef2('0x32')],function(_0x579539){var _0x3396a={};_0x3396a[_0x579539]={'$like':'%'+_0x328245[_0xcef2('0x2d')]['filter']+'%'};return _0x3396a;})});}_0x1efea0=_[_0xcef2('0x42')]({},_0x1efea0,_0x328245[_0xcef2('0x3b')]);return _0x23ba0b[_0xcef2('0x46')](_0x1efea0);}})[_0xcef2('0x21')](function(_0x456d4e){if(_0x456d4e){_0x4e75ec=_0x456d4e[_0xcef2('0x33')];if(!_0x328245[_0xcef2('0x2d')][_0xcef2('0x34')](_0xcef2('0x35'))){_0x1efea0[_0xcef2('0x1a')]=qs[_0xcef2('0x1a')](_0x328245[_0xcef2('0x2d')][_0xcef2('0x1a')]);_0x1efea0['offset']=qs[_0xcef2('0x1c')](_0x328245['query'][_0xcef2('0x1c')]);}return _0x23ba0b['getFields'](_0x1efea0);}})[_0xcef2('0x21')](function(_0x3a15b0){if(_0x3a15b0){return _0x3a15b0?{'count':_0x4e75ec,'rows':_0x3a15b0}:null;}})[_0xcef2('0x21')](respondWithResult(_0x230f74,null))[_0xcef2('0x3f')](handleError(_0x230f74,null));};exports['getSubjects']=function(_0x564aa4,_0x5806f0,_0x5f21d8){var _0x5ebb32={};var _0x44e023={};var _0x14bd37;var _0x3774be;return db[_0xcef2('0x27')][_0xcef2('0x47')]({'where':{'id':_0x564aa4['params']['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x5806f0,null))['then'](function(_0x43659e){if(_0x43659e){_0x14bd37=_0x43659e;_0x44e023['model']=_[_0xcef2('0x2e')](db[_0xcef2('0x48')]['rawAttributes']);_0x44e023[_0xcef2('0x2d')]=_[_0xcef2('0x2e')](_0x564aa4['query']);_0x44e023['filters']=_[_0xcef2('0x30')](_0x44e023[_0xcef2('0x2c')],_0x44e023[_0xcef2('0x2d')]);_0x5ebb32['attributes']=_[_0xcef2('0x30')](_0x44e023[_0xcef2('0x2c')],qs[_0xcef2('0x31')](_0x564aa4[_0xcef2('0x2d')]['fields']));_0x5ebb32[_0xcef2('0x32')]=_0x5ebb32[_0xcef2('0x32')]['length']?_0x5ebb32['attributes']:_0x44e023[_0xcef2('0x2c')];_0x5ebb32['order']=qs[_0xcef2('0x37')](_0x564aa4[_0xcef2('0x2d')]['sort']);_0x5ebb32[_0xcef2('0x38')]=qs[_0xcef2('0x2f')](_['pick'](_0x564aa4[_0xcef2('0x2d')],_0x44e023[_0xcef2('0x2f')]));if(_0x564aa4[_0xcef2('0x2d')][_0xcef2('0x39')]){_0x5ebb32['where']=_[_0xcef2('0x42')](_0x5ebb32['where'],{'$or':_[_0xcef2('0x26')](_0x5ebb32[_0xcef2('0x32')],function(_0x33fc0d){var _0x3dc543={};_0x3dc543[_0x33fc0d]={'$like':'%'+_0x564aa4[_0xcef2('0x2d')]['filter']+'%'};return _0x3dc543;})});}_0x5ebb32=_['merge']({},_0x5ebb32,_0x564aa4[_0xcef2('0x3b')]);return _0x14bd37['getSubjects'](_0x5ebb32);}})[_0xcef2('0x21')](function(_0x3ae4b3){if(_0x3ae4b3){_0x3774be=_0x3ae4b3[_0xcef2('0x33')];if(!_0x564aa4['query'][_0xcef2('0x34')]('nolimit')){_0x5ebb32[_0xcef2('0x1a')]=qs[_0xcef2('0x1a')](_0x564aa4[_0xcef2('0x2d')][_0xcef2('0x1a')]);_0x5ebb32[_0xcef2('0x1c')]=qs[_0xcef2('0x1c')](_0x564aa4[_0xcef2('0x2d')][_0xcef2('0x1c')]);}return _0x14bd37[_0xcef2('0x4a')](_0x5ebb32);}})['then'](function(_0x3fc84f){if(_0x3fc84f){return _0x3fc84f?{'count':_0x3774be,'rows':_0x3fc84f}:null;}})[_0xcef2('0x21')](respondWithResult(_0x5806f0,null))[_0xcef2('0x3f')](handleError(_0x5806f0,null));};exports[_0xcef2('0x4b')]=function(_0x75570a,_0x426cd0,_0x1dffef){var _0x5d7d8b={};var _0x3bdf51={};var _0x1791d5;var _0x5ca718;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x75570a['params']['id']}})[_0xcef2('0x21')](handleEntityNotFound(_0x426cd0,null))['then'](function(_0x518fab){if(_0x518fab){_0x1791d5=_0x518fab;_0x3bdf51[_0xcef2('0x2c')]=_[_0xcef2('0x2e')](db['SalesforceField']['rawAttributes']);_0x3bdf51[_0xcef2('0x2d')]=_[_0xcef2('0x2e')](_0x75570a[_0xcef2('0x2d')]);_0x3bdf51[_0xcef2('0x2f')]=_[_0xcef2('0x30')](_0x3bdf51[_0xcef2('0x2c')],_0x3bdf51[_0xcef2('0x2d')]);_0x5d7d8b['attributes']=_['intersection'](_0x3bdf51[_0xcef2('0x2c')],qs['fields'](_0x75570a[_0xcef2('0x2d')]['fields']));_0x5d7d8b['attributes']=_0x5d7d8b[_0xcef2('0x32')][_0xcef2('0x33')]?_0x5d7d8b[_0xcef2('0x32')]:_0x3bdf51[_0xcef2('0x2c')];_0x5d7d8b[_0xcef2('0x36')]=qs['sort'](_0x75570a[_0xcef2('0x2d')][_0xcef2('0x37')]);_0x5d7d8b[_0xcef2('0x38')]=qs[_0xcef2('0x2f')](_[_0xcef2('0x49')](_0x75570a[_0xcef2('0x2d')],_0x3bdf51['filters']));if(_0x75570a['query']['filter']){_0x5d7d8b['where']=_[_0xcef2('0x42')](_0x5d7d8b[_0xcef2('0x38')],{'$or':_[_0xcef2('0x26')](_0x5d7d8b['attributes'],function(_0x2ea24c){var _0x2bc964={};_0x2bc964[_0x2ea24c]={'$like':'%'+_0x75570a[_0xcef2('0x2d')][_0xcef2('0x39')]+'%'};return _0x2bc964;})});}_0x5d7d8b=_[_0xcef2('0x42')]({},_0x5d7d8b,_0x75570a[_0xcef2('0x3b')]);return _0x1791d5['getDescriptions'](_0x5d7d8b);}})[_0xcef2('0x21')](function(_0x2bdd39){if(_0x2bdd39){_0x5ca718=_0x2bdd39[_0xcef2('0x33')];if(!_0x75570a['query'][_0xcef2('0x34')](_0xcef2('0x35'))){_0x5d7d8b[_0xcef2('0x1a')]=qs[_0xcef2('0x1a')](_0x75570a[_0xcef2('0x2d')][_0xcef2('0x1a')]);_0x5d7d8b[_0xcef2('0x1c')]=qs[_0xcef2('0x1c')](_0x75570a[_0xcef2('0x2d')][_0xcef2('0x1c')]);}return _0x1791d5[_0xcef2('0x4b')](_0x5d7d8b);}})[_0xcef2('0x21')](function(_0xf753c5){if(_0xf753c5){return _0xf753c5?{'count':_0x5ca718,'rows':_0xf753c5}:null;}})[_0xcef2('0x21')](respondWithResult(_0x426cd0,null))[_0xcef2('0x3f')](handleError(_0x426cd0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index aa6be1e..82b154f 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 _0x3c91=['path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1034f8,_0x2b21a0){var _0x1016cb=function(_0x4643a6){while(--_0x4643a6){_0x1034f8['push'](_0x1034f8['shift']());}};_0x1016cb(++_0x2b21a0);}(_0x3c91,0xbd));var _0x13c9=function(_0x26a50c,_0x55c0e9){_0x26a50c=_0x26a50c-0x0;var _0x42be1b=_0x3c91[_0x26a50c];return _0x42be1b;};'use strict';var _=require(_0x13c9('0x0'));var util=require(_0x13c9('0x1'));var logger=require(_0x13c9('0x2'))(_0x13c9('0x3'));var moment=require(_0x13c9('0x4'));var BPromise=require(_0x13c9('0x5'));var rp=require(_0x13c9('0x6'));var fs=require('fs');var path=require(_0x13c9('0x7'));var rimraf=require(_0x13c9('0x8'));var config=require(_0x13c9('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x13c9('0xa')]=function(_0x1c4d34,_0x1c0de8){return _0x1c4d34[_0x13c9('0xb')](_0x13c9('0xc'),attributes,{'tableName':_0x13c9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72dd=['request-promise','path','./intSalesforceConfiguration.attributes','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32e138,_0x262511){var _0x53f70c=function(_0x2ad6d1){while(--_0x2ad6d1){_0x32e138['push'](_0x32e138['shift']());}};_0x53f70c(++_0x262511);}(_0x72dd,0x1ee));var _0xd72d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x72dd[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd72d('0x0'));var util=require(_0xd72d('0x1'));var logger=require(_0xd72d('0x2'))(_0xd72d('0x3'));var moment=require(_0xd72d('0x4'));var BPromise=require(_0xd72d('0x5'));var rp=require(_0xd72d('0x6'));var fs=require('fs');var path=require(_0xd72d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd72d('0x8'));module['exports']=function(_0x1697a1,_0x5ebf36){return _0x1697a1['define']('SalesforceConfiguration',attributes,{'tableName':_0xd72d('0x9'),'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 75de74f..d2bae3b 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 _0x18af=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x418911,_0x5dddb6){var _0xe99456=function(_0x1f87a3){while(--_0x1f87a3){_0x418911['push'](_0x418911['shift']());}};_0xe99456(++_0x5dddb6);}(_0x18af,0x1e2));var _0xf18a=function(_0x58a7d7,_0x404727){_0x58a7d7=_0x58a7d7-0x0;var _0x35c0db=_0x18af[_0x58a7d7];return _0x35c0db;};'use strict';var _=require('lodash');var util=require(_0xf18a('0x0'));var moment=require(_0xf18a('0x1'));var BPromise=require('bluebird');var rs=require(_0xf18a('0x2'));var fs=require('fs');var Redis=require(_0xf18a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf18a('0x4'));var logger=require(_0xf18a('0x5'))(_0xf18a('0x6'));var config=require(_0xf18a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf18a('0x8')][_0xf18a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4edd89,_0x5807be,_0x11be52){return new BPromise(function(_0x36d423,_0x2d8f30){return client[_0xf18a('0xa')](_0x4edd89,_0x11be52)[_0xf18a('0xb')](function(_0x27d68e){logger[_0xf18a('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5807be,_0xf18a('0xd'));logger[_0xf18a('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5807be,_0xf18a('0xd'),JSON[_0xf18a('0xf')](_0x27d68e));if(_0x27d68e[_0xf18a('0x10')]){if(_0x27d68e[_0xf18a('0x10')][_0xf18a('0x11')]===0x1f4){logger[_0xf18a('0x10')](_0xf18a('0x12'),_0x5807be,_0x27d68e[_0xf18a('0x10')]['message']);return _0x2d8f30(_0x27d68e['error']['message']);}logger['error'](_0xf18a('0x12'),_0x5807be,_0x27d68e[_0xf18a('0x10')][_0xf18a('0x13')]);return _0x36d423(_0x27d68e[_0xf18a('0x10')][_0xf18a('0x13')]);}else{logger[_0xf18a('0xc')](_0xf18a('0x12'),_0x5807be,_0xf18a('0xd'));_0x36d423(_0x27d68e[_0xf18a('0x14')][_0xf18a('0x13')]);}})[_0xf18a('0x15')](function(_0x215e8c){logger[_0xf18a('0x10')](_0xf18a('0x12'),_0x5807be,_0x215e8c);_0x2d8f30(_0x215e8c);});});} \ No newline at end of file +var _0x0f48=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x1b305b,_0x445d8d){var _0x3801f2=function(_0x98c4c5){while(--_0x98c4c5){_0x1b305b['push'](_0x1b305b['shift']());}};_0x3801f2(++_0x445d8d);}(_0x0f48,0x9a));var _0x80f4=function(_0xf332c8,_0x3f1e2a){_0xf332c8=_0xf332c8-0x0;var _0x38c0fb=_0x0f48[_0xf332c8];return _0x38c0fb;};'use strict';var _=require(_0x80f4('0x0'));var util=require(_0x80f4('0x1'));var moment=require(_0x80f4('0x2'));var BPromise=require(_0x80f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80f4('0x4'));var db=require(_0x80f4('0x5'))['db'];var utils=require(_0x80f4('0x6'));var logger=require(_0x80f4('0x7'))('rpc');var config=require(_0x80f4('0x8'));var jayson=require(_0x80f4('0x9'));var client=jayson[_0x80f4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39319c,_0x15b237,_0x2c9b8e){return new BPromise(function(_0x1045db,_0x566314){return client[_0x80f4('0xb')](_0x39319c,_0x2c9b8e)[_0x80f4('0xc')](function(_0x17755a){logger[_0x80f4('0xd')](_0x80f4('0xe'),_0x15b237,_0x80f4('0xf'));logger[_0x80f4('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x15b237,'request\x20sent',JSON[_0x80f4('0x11')](_0x17755a));if(_0x17755a[_0x80f4('0x12')]){if(_0x17755a[_0x80f4('0x12')]['code']===0x1f4){logger[_0x80f4('0x12')](_0x80f4('0xe'),_0x15b237,_0x17755a[_0x80f4('0x12')][_0x80f4('0x13')]);return _0x566314(_0x17755a['error'][_0x80f4('0x13')]);}logger[_0x80f4('0x12')](_0x80f4('0xe'),_0x15b237,_0x17755a[_0x80f4('0x12')][_0x80f4('0x13')]);return _0x1045db(_0x17755a[_0x80f4('0x12')][_0x80f4('0x13')]);}else{logger[_0x80f4('0xd')](_0x80f4('0xe'),_0x15b237,_0x80f4('0xf'));_0x1045db(_0x17755a[_0x80f4('0x14')][_0x80f4('0x13')]);}})[_0x80f4('0x15')](function(_0x2de8c7){logger[_0x80f4('0x12')](_0x80f4('0xe'),_0x15b237,_0x2de8c7);_0x566314(_0x2de8c7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ecaab84..40846af 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 _0x5ff2=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x490486,_0xd8363f){var _0x3eb33d=function(_0x1e3168){while(--_0x1e3168){_0x490486['push'](_0x490486['shift']());}};_0x3eb33d(++_0xd8363f);}(_0x5ff2,0x189));var _0x25ff=function(_0x44c8cb,_0x2e28c7){_0x44c8cb=_0x44c8cb-0x0;var _0x3bf406=_0x5ff2[_0x44c8cb];return _0x3bf406;};'use strict';var multer=require(_0x25ff('0x0'));var util=require(_0x25ff('0x1'));var path=require(_0x25ff('0x2'));var timeout=require('connect-timeout');var express=require(_0x25ff('0x3'));var router=express[_0x25ff('0x4')]();var fs_extra=require(_0x25ff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x25ff('0x6'));var config=require(_0x25ff('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x25ff('0x8')]);router['get'](_0x25ff('0x9'),auth[_0x25ff('0xa')](),controller[_0x25ff('0xb')]);router[_0x25ff('0xc')]('/',auth['isAuthenticated'](),controller[_0x25ff('0xd')]);router[_0x25ff('0xe')](_0x25ff('0x9'),auth[_0x25ff('0xa')](),controller[_0x25ff('0xf')]);router[_0x25ff('0x10')](_0x25ff('0x9'),auth[_0x25ff('0xa')](),controller[_0x25ff('0x11')]);module['exports']=router; \ No newline at end of file +var _0x162f=['update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','show','post','isAuthenticated','create','put'];(function(_0xc673a3,_0x5354c9){var _0x56b292=function(_0x4755d3){while(--_0x4755d3){_0xc673a3['push'](_0xc673a3['shift']());}};_0x56b292(++_0x5354c9);}(_0x162f,0x75));var _0xf162=function(_0x22d105,_0xd381d2){_0x22d105=_0x22d105-0x0;var _0x4455bb=_0x162f[_0x22d105];return _0x4455bb;};'use strict';var multer=require('multer');var util=require(_0xf162('0x0'));var path=require('path');var timeout=require(_0xf162('0x1'));var express=require(_0xf162('0x2'));var router=express[_0xf162('0x3')]();var fs_extra=require(_0xf162('0x4'));var auth=require(_0xf162('0x5'));var interaction=require(_0xf162('0x6'));var config=require('../../config/environment');var controller=require(_0xf162('0x7'));router[_0xf162('0x8')]('/',auth['isAuthenticated'](),controller[_0xf162('0x9')]);router['get'](_0xf162('0xa'),auth['isAuthenticated'](),controller[_0xf162('0xb')]);router[_0xf162('0xc')]('/',auth[_0xf162('0xd')](),controller[_0xf162('0xe')]);router[_0xf162('0xf')](_0xf162('0xa'),auth[_0xf162('0xd')](),controller[_0xf162('0x10')]);router['delete'](_0xf162('0xa'),auth[_0xf162('0xd')](),controller[_0xf162('0x11')]);module[_0xf162('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b223f05..142672f 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 _0x1192=['picklist','string','STRING','ENUM','variable','customVariable','keyValue'];(function(_0x114bd5,_0x564bce){var _0x16f252=function(_0x1ddf95){while(--_0x1ddf95){_0x114bd5['push'](_0x114bd5['shift']());}};_0x16f252(++_0x564bce);}(_0x1192,0x1d2));var _0x2119=function(_0x2c94d4,_0x43af5a){_0x2c94d4=_0x2c94d4-0x0;var _0x138a94=_0x1192[_0x2c94d4];return _0x138a94;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x2119('0x0'),_0x2119('0x1'),_0x2119('0x2'),_0x2119('0x3')),'defaultValue':_0x2119('0x4')},'content':{'type':Sequelize[_0x2119('0x5')]},'key':{'type':Sequelize[_0x2119('0x5')]},'keyType':{'type':Sequelize[_0x2119('0x6')]('string','variable',_0x2119('0x1'))},'keyContent':{'type':Sequelize[_0x2119('0x5')]},'idField':{'type':Sequelize[_0x2119('0x5')]},'variableName':{'type':Sequelize[_0x2119('0x5')]}}; \ No newline at end of file +var _0x61f0=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x574377,_0x29f805){var _0x224202=function(_0x365772){while(--_0x365772){_0x574377['push'](_0x574377['shift']());}};_0x224202(++_0x29f805);}(_0x61f0,0xc2));var _0x061f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x61f0[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x061f('0x0'));module[_0x061f('0x1')]={'type':{'type':Sequelize[_0x061f('0x2')](_0x061f('0x3'),_0x061f('0x4'),_0x061f('0x5'),_0x061f('0x6'),_0x061f('0x7')),'defaultValue':_0x061f('0x3')},'content':{'type':Sequelize[_0x061f('0x8')]},'key':{'type':Sequelize[_0x061f('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x061f('0x3'),_0x061f('0x4'),_0x061f('0x5'))},'keyContent':{'type':Sequelize[_0x061f('0x8')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x061f('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index fa18950..59ecfa6 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 _0xadfc=['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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','apply','destroy','end','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','create','body','find','params'];(function(_0x5cb7cb,_0x5ba26d){var _0xbcc31=function(_0x15af23){while(--_0x15af23){_0x5cb7cb['push'](_0x5cb7cb['shift']());}};_0xbcc31(++_0x5ba26d);}(_0xadfc,0x12c));var _0xcadf=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xadfc[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0xcadf('0x0'));var rimraf=require(_0xcadf('0x1'));var zipdir=require(_0xcadf('0x2'));var jsonpatch=require(_0xcadf('0x3'));var rp=require(_0xcadf('0x4'));var moment=require(_0xcadf('0x5'));var BPromise=require(_0xcadf('0x6'));var Mustache=require(_0xcadf('0x7'));var util=require(_0xcadf('0x8'));var path=require(_0xcadf('0x9'));var sox=require(_0xcadf('0xa'));var csv=require(_0xcadf('0xb'));var ejs=require(_0xcadf('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcadf('0xd'));var squel=require(_0xcadf('0xe'));var crypto=require(_0xcadf('0xf'));var jsforce=require(_0xcadf('0x10'));var deskjs=require(_0xcadf('0x11'));var toCsv=require(_0xcadf('0xb'));var querystring=require('querystring');var Papa=require(_0xcadf('0x12'));var Redis=require(_0xcadf('0x13'));var authService=require(_0xcadf('0x14'));var qs=require(_0xcadf('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcadf('0x16'));var logger=require(_0xcadf('0x17'))(_0xcadf('0x18'));var utils=require(_0xcadf('0x19'));var config=require(_0xcadf('0x1a'));var licenseUtil=require(_0xcadf('0x1b'));var db=require(_0xcadf('0x1c'))['db'];function respondWithStatusCode(_0x185dbf,_0x242784){_0x242784=_0x242784||0xcc;return function(_0x431a47){if(_0x431a47){return _0x185dbf[_0xcadf('0x1d')](_0x242784);}return _0x185dbf[_0xcadf('0x1e')](_0x242784)['end']();};}function respondWithResult(_0x23b87a,_0x23a7b6){_0x23a7b6=_0x23a7b6||0xc8;return function(_0x2e346b){if(_0x2e346b){return _0x23b87a['status'](_0x23a7b6)[_0xcadf('0x1f')](_0x2e346b);}};}function respondWithFilteredResult(_0x287465,_0x10c069){return function(_0x305445){if(_0x305445){var _0x55d6f0=typeof _0x10c069[_0xcadf('0x20')]==='undefined'&&typeof _0x10c069['limit']===_0xcadf('0x21');var _0x1da7d9=_0x305445[_0xcadf('0x22')];var _0x227a07=_0x55d6f0?0x0:_0x10c069[_0xcadf('0x20')];var _0x1d9df8=_0x55d6f0?_0x305445[_0xcadf('0x22')]:_0x10c069[_0xcadf('0x20')]+_0x10c069[_0xcadf('0x23')];var _0x17c4ee;if(_0x1d9df8>=_0x1da7d9){_0x1d9df8=_0x1da7d9;_0x17c4ee=0xc8;}else{_0x17c4ee=0xce;}_0x287465[_0xcadf('0x1e')](_0x17c4ee);return _0x287465['set']('Content-Range',_0x227a07+'-'+_0x1d9df8+'/'+_0x1da7d9)[_0xcadf('0x1f')](_0x305445);}return null;};}function patchUpdates(_0x54de1c){return function(_0x384594){try{jsonpatch[_0xcadf('0x24')](_0x384594,_0x54de1c,!![]);}catch(_0x508a1f){return BPromise['reject'](_0x508a1f);}return _0x384594['save']();};}function saveUpdates(_0xd4c43a,_0x2a8afa){return function(_0x5ade4d){if(_0x5ade4d){return _0x5ade4d['update'](_0xd4c43a)['then'](function(_0x74e01d){return _0x74e01d;});}return null;};}function removeEntity(_0x52fdf2,_0x4a5f83){return function(_0x548b66){if(_0x548b66){return _0x548b66[_0xcadf('0x25')]()['then'](function(){_0x52fdf2['status'](0xcc)[_0xcadf('0x26')]();});}};}function handleEntityNotFound(_0x47b364,_0x2959ca){return function(_0x5c3d3f){if(!_0x5c3d3f){_0x47b364[_0xcadf('0x1d')](0x194);}return _0x5c3d3f;};}function handleError(_0x4574fc,_0x2bcbaf){_0x2bcbaf=_0x2bcbaf||0x1f4;return function(_0x575905){logger[_0xcadf('0x27')](_0x575905[_0xcadf('0x28')]);if(_0x575905[_0xcadf('0x29')]){delete _0x575905[_0xcadf('0x29')];}_0x4574fc[_0xcadf('0x1e')](_0x2bcbaf)[_0xcadf('0x2a')](_0x575905);};}exports[_0xcadf('0x2b')]=function(_0x81674c,_0x3d93da){var _0x51eb34={},_0x1acd03={},_0x4d9ce2={'count':0x0,'rows':[]};var _0xf96f96=_[_0xcadf('0x2c')](db[_0xcadf('0x2d')][_0xcadf('0x2e')],function(_0x49ea2e){return{'name':_0x49ea2e[_0xcadf('0x2f')],'type':_0x49ea2e[_0xcadf('0x30')]['key']};});_0x1acd03[_0xcadf('0x31')]=_[_0xcadf('0x2c')](_0xf96f96,_0xcadf('0x29'));_0x1acd03[_0xcadf('0x32')]=_[_0xcadf('0x33')](_0x81674c[_0xcadf('0x32')]);_0x1acd03[_0xcadf('0x34')]=_[_0xcadf('0x35')](_0x1acd03[_0xcadf('0x31')],_0x1acd03[_0xcadf('0x32')]);_0x51eb34['attributes']=_[_0xcadf('0x35')](_0x1acd03[_0xcadf('0x31')],qs[_0xcadf('0x36')](_0x81674c[_0xcadf('0x32')][_0xcadf('0x36')]));_0x51eb34['attributes']=_0x51eb34[_0xcadf('0x37')][_0xcadf('0x38')]?_0x51eb34['attributes']:_0x1acd03[_0xcadf('0x31')];if(!_0x81674c['query'][_0xcadf('0x39')]('nolimit')){_0x51eb34[_0xcadf('0x23')]=qs[_0xcadf('0x23')](_0x81674c['query'][_0xcadf('0x23')]);_0x51eb34[_0xcadf('0x20')]=qs['offset'](_0x81674c['query'][_0xcadf('0x20')]);}_0x51eb34[_0xcadf('0x3a')]=qs['sort'](_0x81674c[_0xcadf('0x32')][_0xcadf('0x3b')]);_0x51eb34[_0xcadf('0x3c')]=qs[_0xcadf('0x34')](_['pick'](_0x81674c[_0xcadf('0x32')],_0x1acd03[_0xcadf('0x34')]),_0xf96f96);if(_0x81674c['query'][_0xcadf('0x3d')]){_0x51eb34['where']=_[_0xcadf('0x3e')](_0x51eb34[_0xcadf('0x3c')],{'$or':_['map'](_0xf96f96,function(_0x5b2332){if(_0x5b2332[_0xcadf('0x30')]!==_0xcadf('0x3f')){var _0x251f5c={};_0x251f5c[_0x5b2332[_0xcadf('0x29')]]={'$like':'%'+_0x81674c[_0xcadf('0x32')][_0xcadf('0x3d')]+'%'};return _0x251f5c;}})});}_0x51eb34=_[_0xcadf('0x3e')]({},_0x51eb34,_0x81674c[_0xcadf('0x40')]);var _0x19dc39={'where':_0x51eb34[_0xcadf('0x3c')]};return db[_0xcadf('0x2d')]['count'](_0x19dc39)[_0xcadf('0x41')](function(_0x139868){_0x4d9ce2[_0xcadf('0x22')]=_0x139868;if(_0x81674c[_0xcadf('0x32')][_0xcadf('0x42')]){_0x51eb34[_0xcadf('0x43')]=[{'all':!![]}];}return db['SalesforceField'][_0xcadf('0x44')](_0x51eb34);})[_0xcadf('0x41')](function(_0x596765){_0x4d9ce2[_0xcadf('0x45')]=_0x596765;return _0x4d9ce2;})[_0xcadf('0x41')](respondWithFilteredResult(_0x3d93da,_0x51eb34))['catch'](handleError(_0x3d93da,null));};exports['show']=function(_0x53999d,_0x2702ee){var _0x84d1d0={'raw':!![],'where':{'id':_0x53999d['params']['id']}},_0x183a2f={};_0x183a2f[_0xcadf('0x31')]=_['keys'](db[_0xcadf('0x2d')][_0xcadf('0x2e')]);_0x183a2f[_0xcadf('0x32')]=_['keys'](_0x53999d['query']);_0x183a2f['filters']=_['intersection'](_0x183a2f[_0xcadf('0x31')],_0x183a2f[_0xcadf('0x32')]);_0x84d1d0['attributes']=_[_0xcadf('0x35')](_0x183a2f[_0xcadf('0x31')],qs[_0xcadf('0x36')](_0x53999d[_0xcadf('0x32')][_0xcadf('0x36')]));_0x84d1d0[_0xcadf('0x37')]=_0x84d1d0[_0xcadf('0x37')]['length']?_0x84d1d0[_0xcadf('0x37')]:_0x183a2f[_0xcadf('0x31')];if(_0x53999d[_0xcadf('0x32')][_0xcadf('0x42')]){_0x84d1d0[_0xcadf('0x43')]=[{'all':!![]}];}_0x84d1d0=_[_0xcadf('0x3e')]({},_0x84d1d0,_0x53999d[_0xcadf('0x40')]);return db[_0xcadf('0x2d')]['find'](_0x84d1d0)[_0xcadf('0x41')](handleEntityNotFound(_0x2702ee,null))[_0xcadf('0x41')](respondWithResult(_0x2702ee,null))[_0xcadf('0x46')](handleError(_0x2702ee,null));};exports[_0xcadf('0x47')]=function(_0x5796e0,_0x38192d){return db[_0xcadf('0x2d')]['create'](_0x5796e0[_0xcadf('0x48')],{})['then'](respondWithResult(_0x38192d,0xc9))[_0xcadf('0x46')](handleError(_0x38192d,null));};exports['update']=function(_0x3c2467,_0x47ca23){if(_0x3c2467['body']['id']){delete _0x3c2467[_0xcadf('0x48')]['id'];}return db[_0xcadf('0x2d')][_0xcadf('0x49')]({'where':{'id':_0x3c2467[_0xcadf('0x4a')]['id']}})[_0xcadf('0x41')](handleEntityNotFound(_0x47ca23,null))[_0xcadf('0x41')](saveUpdates(_0x3c2467[_0xcadf('0x48')],null))[_0xcadf('0x41')](respondWithResult(_0x47ca23,null))[_0xcadf('0x46')](handleError(_0x47ca23,null));};exports[_0xcadf('0x25')]=function(_0x3ac7a9,_0x1cbd83){return db[_0xcadf('0x2d')][_0xcadf('0x49')]({'where':{'id':_0x3ac7a9[_0xcadf('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1cbd83,null))[_0xcadf('0x41')](removeEntity(_0x1cbd83,null))[_0xcadf('0x46')](handleError(_0x1cbd83,null));}; \ No newline at end of file +var _0xeed7=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xeed7,0x12b));var _0x7eed=function(_0x1d730b,_0x36a559){_0x1d730b=_0x1d730b-0x0;var _0x23fad6=_0xeed7[_0x1d730b];return _0x23fad6;};'use strict';var emlformat=require(_0x7eed('0x0'));var rimraf=require(_0x7eed('0x1'));var zipdir=require(_0x7eed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7eed('0x3'));var moment=require(_0x7eed('0x4'));var BPromise=require(_0x7eed('0x5'));var Mustache=require(_0x7eed('0x6'));var util=require(_0x7eed('0x7'));var path=require(_0x7eed('0x8'));var sox=require(_0x7eed('0x9'));var csv=require(_0x7eed('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7eed('0xb'));var squel=require(_0x7eed('0xc'));var crypto=require(_0x7eed('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7eed('0xe'));var toCsv=require(_0x7eed('0xa'));var querystring=require(_0x7eed('0xf'));var Papa=require(_0x7eed('0x10'));var Redis=require('ioredis');var authService=require(_0x7eed('0x11'));var qs=require(_0x7eed('0x12'));var as=require(_0x7eed('0x13'));var hardwareService=require(_0x7eed('0x14'));var logger=require(_0x7eed('0x15'))(_0x7eed('0x16'));var utils=require(_0x7eed('0x17'));var config=require(_0x7eed('0x18'));var licenseUtil=require(_0x7eed('0x19'));var db=require(_0x7eed('0x1a'))['db'];function respondWithStatusCode(_0x393f57,_0x5816ce){_0x5816ce=_0x5816ce||0xcc;return function(_0x434f2f){if(_0x434f2f){return _0x393f57[_0x7eed('0x1b')](_0x5816ce);}return _0x393f57[_0x7eed('0x1c')](_0x5816ce)[_0x7eed('0x1d')]();};}function respondWithResult(_0x17f5f0,_0x148be9){_0x148be9=_0x148be9||0xc8;return function(_0x44b6fd){if(_0x44b6fd){return _0x17f5f0[_0x7eed('0x1c')](_0x148be9)[_0x7eed('0x1e')](_0x44b6fd);}};}function respondWithFilteredResult(_0x4990d7,_0x145e0a){return function(_0x4600fb){if(_0x4600fb){var _0x34d10d=typeof _0x145e0a[_0x7eed('0x1f')]==='undefined'&&typeof _0x145e0a['limit']===_0x7eed('0x20');var _0x404684=_0x4600fb[_0x7eed('0x21')];var _0xb1b7e6=_0x34d10d?0x0:_0x145e0a[_0x7eed('0x1f')];var _0x127253=_0x34d10d?_0x4600fb[_0x7eed('0x21')]:_0x145e0a[_0x7eed('0x1f')]+_0x145e0a[_0x7eed('0x22')];var _0x201d66;if(_0x127253>=_0x404684){_0x127253=_0x404684;_0x201d66=0xc8;}else{_0x201d66=0xce;}_0x4990d7[_0x7eed('0x1c')](_0x201d66);return _0x4990d7[_0x7eed('0x23')](_0x7eed('0x24'),_0xb1b7e6+'-'+_0x127253+'/'+_0x404684)[_0x7eed('0x1e')](_0x4600fb);}return null;};}function patchUpdates(_0x3d4481){return function(_0x5e73a0){try{jsonpatch[_0x7eed('0x25')](_0x5e73a0,_0x3d4481,!![]);}catch(_0x4b3c1f){return BPromise[_0x7eed('0x26')](_0x4b3c1f);}return _0x5e73a0[_0x7eed('0x27')]();};}function saveUpdates(_0x401e1b,_0x166d24){return function(_0x3b6e4d){if(_0x3b6e4d){return _0x3b6e4d[_0x7eed('0x28')](_0x401e1b)[_0x7eed('0x29')](function(_0x345d37){return _0x345d37;});}return null;};}function removeEntity(_0xe7d5b4,_0x1fef4c){return function(_0x35bc28){if(_0x35bc28){return _0x35bc28['destroy']()['then'](function(){_0xe7d5b4[_0x7eed('0x1c')](0xcc)[_0x7eed('0x1d')]();});}};}function handleEntityNotFound(_0x998de7,_0x11ffcf){return function(_0x193283){if(!_0x193283){_0x998de7[_0x7eed('0x1b')](0x194);}return _0x193283;};}function handleError(_0x274fc1,_0x55f05c){_0x55f05c=_0x55f05c||0x1f4;return function(_0x45b0c7){logger[_0x7eed('0x2a')](_0x45b0c7[_0x7eed('0x2b')]);if(_0x45b0c7[_0x7eed('0x2c')]){delete _0x45b0c7[_0x7eed('0x2c')];}_0x274fc1[_0x7eed('0x1c')](_0x55f05c)[_0x7eed('0x2d')](_0x45b0c7);};}exports[_0x7eed('0x2e')]=function(_0x384c0f,_0x22ff6c){var _0x5a47c6={},_0x554ad2={},_0x309bf6={'count':0x0,'rows':[]};var _0x548c2d=_[_0x7eed('0x2f')](db[_0x7eed('0x30')][_0x7eed('0x31')],function(_0x4f2c9d){return{'name':_0x4f2c9d[_0x7eed('0x32')],'type':_0x4f2c9d[_0x7eed('0x33')]['key']};});_0x554ad2[_0x7eed('0x34')]=_[_0x7eed('0x2f')](_0x548c2d,_0x7eed('0x2c'));_0x554ad2[_0x7eed('0x35')]=_['keys'](_0x384c0f['query']);_0x554ad2[_0x7eed('0x36')]=_[_0x7eed('0x37')](_0x554ad2[_0x7eed('0x34')],_0x554ad2[_0x7eed('0x35')]);_0x5a47c6[_0x7eed('0x38')]=_[_0x7eed('0x37')](_0x554ad2[_0x7eed('0x34')],qs['fields'](_0x384c0f[_0x7eed('0x35')][_0x7eed('0x39')]));_0x5a47c6[_0x7eed('0x38')]=_0x5a47c6['attributes'][_0x7eed('0x3a')]?_0x5a47c6[_0x7eed('0x38')]:_0x554ad2['model'];if(!_0x384c0f['query'][_0x7eed('0x3b')](_0x7eed('0x3c'))){_0x5a47c6[_0x7eed('0x22')]=qs[_0x7eed('0x22')](_0x384c0f[_0x7eed('0x35')][_0x7eed('0x22')]);_0x5a47c6['offset']=qs[_0x7eed('0x1f')](_0x384c0f[_0x7eed('0x35')]['offset']);}_0x5a47c6[_0x7eed('0x3d')]=qs[_0x7eed('0x3e')](_0x384c0f[_0x7eed('0x35')][_0x7eed('0x3e')]);_0x5a47c6['where']=qs[_0x7eed('0x36')](_[_0x7eed('0x3f')](_0x384c0f[_0x7eed('0x35')],_0x554ad2[_0x7eed('0x36')]),_0x548c2d);if(_0x384c0f[_0x7eed('0x35')]['filter']){_0x5a47c6[_0x7eed('0x40')]=_['merge'](_0x5a47c6[_0x7eed('0x40')],{'$or':_['map'](_0x548c2d,function(_0x455e65){if(_0x455e65[_0x7eed('0x33')]!=='VIRTUAL'){var _0x5a0805={};_0x5a0805[_0x455e65['name']]={'$like':'%'+_0x384c0f[_0x7eed('0x35')][_0x7eed('0x41')]+'%'};return _0x5a0805;}})});}_0x5a47c6=_[_0x7eed('0x42')]({},_0x5a47c6,_0x384c0f['options']);var _0x3ba74e={'where':_0x5a47c6[_0x7eed('0x40')]};return db[_0x7eed('0x30')]['count'](_0x3ba74e)['then'](function(_0x34100d){_0x309bf6['count']=_0x34100d;if(_0x384c0f[_0x7eed('0x35')][_0x7eed('0x43')]){_0x5a47c6[_0x7eed('0x44')]=[{'all':!![]}];}return db[_0x7eed('0x30')][_0x7eed('0x45')](_0x5a47c6);})[_0x7eed('0x29')](function(_0x2a947b){_0x309bf6[_0x7eed('0x46')]=_0x2a947b;return _0x309bf6;})[_0x7eed('0x29')](respondWithFilteredResult(_0x22ff6c,_0x5a47c6))[_0x7eed('0x47')](handleError(_0x22ff6c,null));};exports[_0x7eed('0x48')]=function(_0x1fe534,_0x1e6a40){var _0x40b791={'raw':!![],'where':{'id':_0x1fe534[_0x7eed('0x49')]['id']}},_0x2c24ac={};_0x2c24ac[_0x7eed('0x34')]=_[_0x7eed('0x4a')](db[_0x7eed('0x30')][_0x7eed('0x31')]);_0x2c24ac[_0x7eed('0x35')]=_[_0x7eed('0x4a')](_0x1fe534[_0x7eed('0x35')]);_0x2c24ac['filters']=_[_0x7eed('0x37')](_0x2c24ac['model'],_0x2c24ac[_0x7eed('0x35')]);_0x40b791['attributes']=_['intersection'](_0x2c24ac[_0x7eed('0x34')],qs[_0x7eed('0x39')](_0x1fe534[_0x7eed('0x35')][_0x7eed('0x39')]));_0x40b791[_0x7eed('0x38')]=_0x40b791[_0x7eed('0x38')][_0x7eed('0x3a')]?_0x40b791[_0x7eed('0x38')]:_0x2c24ac[_0x7eed('0x34')];if(_0x1fe534['query'][_0x7eed('0x43')]){_0x40b791[_0x7eed('0x44')]=[{'all':!![]}];}_0x40b791=_[_0x7eed('0x42')]({},_0x40b791,_0x1fe534[_0x7eed('0x4b')]);return db[_0x7eed('0x30')][_0x7eed('0x4c')](_0x40b791)['then'](handleEntityNotFound(_0x1e6a40,null))[_0x7eed('0x29')](respondWithResult(_0x1e6a40,null))['catch'](handleError(_0x1e6a40,null));};exports[_0x7eed('0x4d')]=function(_0x2946bc,_0x1e9576){return db[_0x7eed('0x30')][_0x7eed('0x4d')](_0x2946bc[_0x7eed('0x4e')],{})[_0x7eed('0x29')](respondWithResult(_0x1e9576,0xc9))[_0x7eed('0x47')](handleError(_0x1e9576,null));};exports[_0x7eed('0x28')]=function(_0x32fb51,_0xb8ee60){if(_0x32fb51[_0x7eed('0x4e')]['id']){delete _0x32fb51[_0x7eed('0x4e')]['id'];}return db['SalesforceField'][_0x7eed('0x4c')]({'where':{'id':_0x32fb51[_0x7eed('0x49')]['id']}})['then'](handleEntityNotFound(_0xb8ee60,null))[_0x7eed('0x29')](saveUpdates(_0x32fb51[_0x7eed('0x4e')],null))['then'](respondWithResult(_0xb8ee60,null))[_0x7eed('0x47')](handleError(_0xb8ee60,null));};exports[_0x7eed('0x4f')]=function(_0x4edfd7,_0x26807f){return db[_0x7eed('0x30')]['find']({'where':{'id':_0x4edfd7[_0x7eed('0x49')]['id']}})['then'](handleEntityNotFound(_0x26807f,null))[_0x7eed('0x29')](removeEntity(_0x26807f,null))[_0x7eed('0x47')](handleError(_0x26807f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 968d5e7..ee5bec7 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 _0x3cae=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','../../config/logger','bluebird','request-promise','path','./intSalesforceField.attributes'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x3cae,0x193));var _0xe3ca=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x3cae[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3ca('0x0'))('api');var moment=require('moment');var BPromise=require(_0xe3ca('0x1'));var rp=require(_0xe3ca('0x2'));var fs=require('fs');var path=require(_0xe3ca('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3ca('0x4'));module[_0xe3ca('0x5')]=function(_0x299ee0,_0x10a06a){return _0x299ee0[_0xe3ca('0x6')](_0xe3ca('0x7'),attributes,{'tableName':_0xe3ca('0x8'),'paranoid':![],'indexes':[{'name':_0xe3ca('0x9'),'fields':[_0xe3ca('0xa'),_0xe3ca('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5dc=['salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x45af30,_0x7c6ab2){var _0x20313b=function(_0x4d3e89){while(--_0x4d3e89){_0x45af30['push'](_0x45af30['shift']());}};_0x20313b(++_0x7c6ab2);}(_0xd5dc,0x199));var _0xcd5d=function(_0x2e8712,_0x2edf5e){_0x2e8712=_0x2e8712-0x0;var _0x1c5357=_0xd5dc[_0x2e8712];return _0x1c5357;};'use strict';var _=require(_0xcd5d('0x0'));var util=require('util');var logger=require(_0xcd5d('0x1'))(_0xcd5d('0x2'));var moment=require('moment');var BPromise=require(_0xcd5d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd5d('0x4'));var rimraf=require(_0xcd5d('0x5'));var config=require(_0xcd5d('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0xcd5d('0x7')]=function(_0x1b72b5,_0x4723d4){return _0x1b72b5[_0xcd5d('0x8')](_0xcd5d('0x9'),attributes,{'tableName':_0xcd5d('0xa'),'paranoid':![],'indexes':[{'name':_0xcd5d('0xb'),'fields':[_0xcd5d('0xc'),_0xcd5d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 5733784..e1412c3 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 _0x8ed1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x576fd6,_0x1f6d40){var _0x37b431=function(_0x20891f){while(--_0x20891f){_0x576fd6['push'](_0x576fd6['shift']());}};_0x37b431(++_0x1f6d40);}(_0x8ed1,0x1e2));var _0x18ed=function(_0x4b6f12,_0x48fb9d){_0x4b6f12=_0x4b6f12-0x0;var _0x182cf5=_0x8ed1[_0x4b6f12];return _0x182cf5;};'use strict';var _=require(_0x18ed('0x0'));var util=require(_0x18ed('0x1'));var moment=require(_0x18ed('0x2'));var BPromise=require(_0x18ed('0x3'));var rs=require(_0x18ed('0x4'));var fs=require('fs');var Redis=require(_0x18ed('0x5'));var db=require(_0x18ed('0x6'))['db'];var utils=require(_0x18ed('0x7'));var logger=require(_0x18ed('0x8'))(_0x18ed('0x9'));var config=require('../../config/environment');var jayson=require(_0x18ed('0xa'));var client=jayson[_0x18ed('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x333a02,_0x51857c,_0x4a53ca){return new BPromise(function(_0x58838e,_0x3deb41){return client['request'](_0x333a02,_0x4a53ca)[_0x18ed('0xc')](function(_0x5899b4){logger['info'](_0x18ed('0xd'),_0x51857c,_0x18ed('0xe'));logger[_0x18ed('0xf')](_0x18ed('0x10'),_0x51857c,'request\x20sent',JSON[_0x18ed('0x11')](_0x5899b4));if(_0x5899b4[_0x18ed('0x12')]){if(_0x5899b4[_0x18ed('0x12')]['code']===0x1f4){logger[_0x18ed('0x12')](_0x18ed('0xd'),_0x51857c,_0x5899b4[_0x18ed('0x12')]['message']);return _0x3deb41(_0x5899b4[_0x18ed('0x12')]['message']);}logger['error'](_0x18ed('0xd'),_0x51857c,_0x5899b4['error'][_0x18ed('0x13')]);return _0x58838e(_0x5899b4[_0x18ed('0x12')][_0x18ed('0x13')]);}else{logger[_0x18ed('0x14')](_0x18ed('0xd'),_0x51857c,_0x18ed('0xe'));_0x58838e(_0x5899b4[_0x18ed('0x15')][_0x18ed('0x13')]);}})[_0x18ed('0x16')](function(_0x3f4f3c){logger[_0x18ed('0x12')](_0x18ed('0xd'),_0x51857c,_0x3f4f3c);_0x3deb41(_0x3f4f3c);});});} \ No newline at end of file +var _0xb8d5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','stringify','error','code','message','result','util','moment'];(function(_0x4f6888,_0x4f4cea){var _0xf83e3=function(_0x29cfae){while(--_0x29cfae){_0x4f6888['push'](_0x4f6888['shift']());}};_0xf83e3(++_0x4f4cea);}(_0xb8d5,0x1a2));var _0x5b8d=function(_0x4a8d6b,_0x3eb452){_0x4a8d6b=_0x4a8d6b-0x0;var _0x3c9a04=_0xb8d5[_0x4a8d6b];return _0x3c9a04;};'use strict';var _=require('lodash');var util=require(_0x5b8d('0x0'));var moment=require(_0x5b8d('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b8d('0x2'));var fs=require('fs');var Redis=require(_0x5b8d('0x3'));var db=require(_0x5b8d('0x4'))['db'];var utils=require(_0x5b8d('0x5'));var logger=require(_0x5b8d('0x6'))(_0x5b8d('0x7'));var config=require(_0x5b8d('0x8'));var jayson=require(_0x5b8d('0x9'));var client=jayson[_0x5b8d('0xa')][_0x5b8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18a827,_0x555c4e,_0x10a0bc){return new BPromise(function(_0x427543,_0x228052){return client[_0x5b8d('0xc')](_0x18a827,_0x10a0bc)[_0x5b8d('0xd')](function(_0x4e649a){logger[_0x5b8d('0xe')](_0x5b8d('0xf'),_0x555c4e,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x555c4e,'request\x20sent',JSON[_0x5b8d('0x10')](_0x4e649a));if(_0x4e649a['error']){if(_0x4e649a[_0x5b8d('0x11')][_0x5b8d('0x12')]===0x1f4){logger[_0x5b8d('0x11')]('SalesforceField,\x20%s,\x20%s',_0x555c4e,_0x4e649a[_0x5b8d('0x11')]['message']);return _0x228052(_0x4e649a[_0x5b8d('0x11')][_0x5b8d('0x13')]);}logger[_0x5b8d('0x11')]('SalesforceField,\x20%s,\x20%s',_0x555c4e,_0x4e649a[_0x5b8d('0x11')][_0x5b8d('0x13')]);return _0x427543(_0x4e649a[_0x5b8d('0x11')]['message']);}else{logger['info'](_0x5b8d('0xf'),_0x555c4e,'request\x20sent');_0x427543(_0x4e649a[_0x5b8d('0x14')][_0x5b8d('0x13')]);}})['catch'](function(_0xf2bda6){logger['error'](_0x5b8d('0xf'),_0x555c4e,_0xf2bda6);_0x228052(_0xf2bda6);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 418e7fc..84f7445 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 _0x296f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','delete','destroy'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0x296f,0x91));var _0xf296=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x296f[_0x4b4f24];return _0x1c13d4;};'use strict';var multer=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var path=require(_0xf296('0x2'));var timeout=require(_0xf296('0x3'));var express=require(_0xf296('0x4'));var router=express[_0xf296('0x5')]();var fs_extra=require(_0xf296('0x6'));var auth=require(_0xf296('0x7'));var interaction=require(_0xf296('0x8'));var config=require(_0xf296('0x9'));var controller=require(_0xf296('0xa'));router[_0xf296('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf296('0xb')]('/:id',auth[_0xf296('0xc')](),controller[_0xf296('0xd')]);router[_0xf296('0xb')](_0xf296('0xe'),auth[_0xf296('0xc')](),controller[_0xf296('0xf')]);router[_0xf296('0xb')](_0xf296('0x10'),auth[_0xf296('0xc')](),controller[_0xf296('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf296('0x12')](_0xf296('0xe'),auth[_0xf296('0xc')](),controller[_0xf296('0x13')]);router['put'](_0xf296('0x14'),auth[_0xf296('0xc')](),controller['update']);router[_0xf296('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf296('0x16')]);module[_0xf296('0x17')]=router; \ No newline at end of file +var _0x1752=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','addConfiguration','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4ba102,_0x3dc213){var _0x1f35e7=function(_0xceae5a){while(--_0xceae5a){_0x4ba102['push'](_0x4ba102['shift']());}};_0x1f35e7(++_0x3dc213);}(_0x1752,0xa5));var _0x2175=function(_0x3a92b3,_0x319210){_0x3a92b3=_0x3a92b3-0x0;var _0x285238=_0x1752[_0x3a92b3];return _0x285238;};'use strict';var multer=require('multer');var util=require(_0x2175('0x0'));var path=require(_0x2175('0x1'));var timeout=require(_0x2175('0x2'));var express=require(_0x2175('0x3'));var router=express[_0x2175('0x4')]();var fs_extra=require(_0x2175('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2175('0x6'));var config=require(_0x2175('0x7'));var controller=require(_0x2175('0x8'));router[_0x2175('0x9')]('/',auth[_0x2175('0xa')](),controller[_0x2175('0xb')]);router[_0x2175('0x9')](_0x2175('0xc'),auth[_0x2175('0xa')](),controller[_0x2175('0xd')]);router['get'](_0x2175('0xe'),auth[_0x2175('0xa')](),controller[_0x2175('0xf')]);router[_0x2175('0x9')](_0x2175('0x10'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x2175('0xa')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x2175('0x11')]);router['put'](_0x2175('0xc'),auth[_0x2175('0xa')](),controller['update']);router[_0x2175('0x12')](_0x2175('0xc'),auth[_0x2175('0xa')](),controller[_0x2175('0x13')]);module[_0x2175('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index a651314..496e680 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 _0xa0d5=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4e4271,_0x1bd1db){var _0x165448=function(_0x119d40){while(--_0x119d40){_0x4e4271['push'](_0x4e4271['shift']());}};_0x165448(++_0x1bd1db);}(_0xa0d5,0x112));var _0x5a0d=function(_0x1a8469,_0x2ffccf){_0x1a8469=_0x1a8469-0x0;var _0x19c2dd=_0xa0d5[_0x1a8469];return _0x19c2dd;};'use strict';var Sequelize=require(_0x5a0d('0x0'));module[_0x5a0d('0x1')]={'name':{'type':Sequelize[_0x5a0d('0x2')]},'description':{'type':Sequelize[_0x5a0d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x5a0d('0x3')},'password':{'type':Sequelize[_0x5a0d('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5a0d('0x4')},'serverUrl':{'type':Sequelize[_0x5a0d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xed6d=['remoteUri','sequelize','exports','STRING','username'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xed6d,0xc9));var _0xded6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xed6d[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0xded6('0x0'));module[_0xded6('0x1')]={'name':{'type':Sequelize[_0xded6('0x2')]},'description':{'type':Sequelize[_0xded6('0x2')]},'username':{'type':Sequelize[_0xded6('0x2')],'unique':_0xded6('0x3')},'password':{'type':Sequelize[_0xded6('0x2')]},'email':{'type':Sequelize[_0xded6('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xded6('0x4')},'serverUrl':{'type':Sequelize[_0xded6('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index afe7b05..b55fd65 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 _0x7eaf=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','type','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','impact','business_service','priority','sys_domain_path','rfc','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','follow_up','sys_id','urgency','problem_id','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x154d1e,_0x1f705a){var _0x17568e=function(_0x2da0bb){while(--_0x2da0bb){_0x154d1e['push'](_0x154d1e['shift']());}};_0x17568e(++_0x1f705a);}(_0x7eaf,0xac));var _0xf7ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eaf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7ea('0x0'));var zipdir=require(_0xf7ea('0x1'));var jsonpatch=require(_0xf7ea('0x2'));var rp=require(_0xf7ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf7ea('0x4'));var util=require(_0xf7ea('0x5'));var path=require('path');var sox=require(_0xf7ea('0x6'));var csv=require(_0xf7ea('0x7'));var ejs=require(_0xf7ea('0x8'));var fs=require('fs');var fs_extra=require(_0xf7ea('0x9'));var _=require(_0xf7ea('0xa'));var squel=require(_0xf7ea('0xb'));var crypto=require(_0xf7ea('0xc'));var jsforce=require(_0xf7ea('0xd'));var deskjs=require(_0xf7ea('0xe'));var toCsv=require(_0xf7ea('0x7'));var querystring=require(_0xf7ea('0xf'));var Papa=require(_0xf7ea('0x10'));var Redis=require(_0xf7ea('0x11'));var authService=require(_0xf7ea('0x12'));var qs=require(_0xf7ea('0x13'));var as=require(_0xf7ea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7ea('0x15'))(_0xf7ea('0x16'));var utils=require(_0xf7ea('0x17'));var config=require(_0xf7ea('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf7ea('0x19'))['db'];var integrations=require(_0xf7ea('0x1a'));function respondWithStatusCode(_0x379b58,_0x288d35){_0x288d35=_0x288d35||0xcc;return function(_0x375b9e){if(_0x375b9e){return _0x379b58['sendStatus'](_0x288d35);}return _0x379b58[_0xf7ea('0x1b')](_0x288d35)[_0xf7ea('0x1c')]();};}function respondWithResult(_0xd0cb59,_0xefc650){_0xefc650=_0xefc650||0xc8;return function(_0x3784bd){if(_0x3784bd){return _0xd0cb59[_0xf7ea('0x1b')](_0xefc650)[_0xf7ea('0x1d')](_0x3784bd);}};}function respondWithFilteredResult(_0x52f6e5,_0x53398a){return function(_0x2b12c1){if(_0x2b12c1){var _0x4b0de6=typeof _0x53398a[_0xf7ea('0x1e')]==='undefined'&&typeof _0x53398a['limit']===_0xf7ea('0x1f');var _0x2f5ec7=_0x2b12c1[_0xf7ea('0x20')];var _0x4b3288=_0x4b0de6?0x0:_0x53398a[_0xf7ea('0x1e')];var _0x2cc85d=_0x4b0de6?_0x2b12c1[_0xf7ea('0x20')]:_0x53398a['offset']+_0x53398a[_0xf7ea('0x21')];var _0x2a9519;if(_0x2cc85d>=_0x2f5ec7){_0x2cc85d=_0x2f5ec7;_0x2a9519=0xc8;}else{_0x2a9519=0xce;}_0x52f6e5[_0xf7ea('0x1b')](_0x2a9519);return _0x52f6e5[_0xf7ea('0x22')](_0xf7ea('0x23'),_0x4b3288+'-'+_0x2cc85d+'/'+_0x2f5ec7)[_0xf7ea('0x1d')](_0x2b12c1);}return null;};}function patchUpdates(_0x5b33fa){return function(_0x203f5a){try{jsonpatch[_0xf7ea('0x24')](_0x203f5a,_0x5b33fa,!![]);}catch(_0x14711c){return BPromise[_0xf7ea('0x25')](_0x14711c);}return _0x203f5a[_0xf7ea('0x26')]();};}function saveUpdates(_0x5b596e,_0xb55e53){return function(_0x186200){if(_0x186200){return _0x186200[_0xf7ea('0x27')](_0x5b596e)['then'](function(_0x4f4c1f){return _0x4f4c1f;});}return null;};}function removeEntity(_0x4fdb6e,_0x585dc6){return function(_0x2a2989){if(_0x2a2989){return _0x2a2989[_0xf7ea('0x28')]()[_0xf7ea('0x29')](function(){_0x4fdb6e[_0xf7ea('0x1b')](0xcc)[_0xf7ea('0x1c')]();});}};}function handleEntityNotFound(_0x46b1c8,_0x168c90){return function(_0x377955){if(!_0x377955){_0x46b1c8[_0xf7ea('0x2a')](0x194);}return _0x377955;};}function handleError(_0x559678,_0x42f29c){_0x42f29c=_0x42f29c||0x1f4;return function(_0x22d56f){logger[_0xf7ea('0x2b')](_0x22d56f[_0xf7ea('0x2c')]);if(_0x22d56f['name']){delete _0x22d56f[_0xf7ea('0x2d')];}_0x559678[_0xf7ea('0x1b')](_0x42f29c)[_0xf7ea('0x2e')](_0x22d56f);};}exports[_0xf7ea('0x2f')]=function(_0x3a83fa,_0x17ca3e){var _0x281d5e={},_0x529629={},_0x957f4f={'count':0x0,'rows':[]};var _0x1ad651=_[_0xf7ea('0x30')](db[_0xf7ea('0x31')][_0xf7ea('0x32')],function(_0x17ec0f){return{'name':_0x17ec0f[_0xf7ea('0x33')],'type':_0x17ec0f['type']['key']};});_0x529629['model']=_[_0xf7ea('0x30')](_0x1ad651,_0xf7ea('0x2d'));_0x529629[_0xf7ea('0x34')]=_[_0xf7ea('0x35')](_0x3a83fa[_0xf7ea('0x34')]);_0x529629[_0xf7ea('0x36')]=_[_0xf7ea('0x37')](_0x529629[_0xf7ea('0x38')],_0x529629[_0xf7ea('0x34')]);_0x281d5e['attributes']=_['intersection'](_0x529629['model'],qs[_0xf7ea('0x39')](_0x3a83fa[_0xf7ea('0x34')][_0xf7ea('0x39')]));_0x281d5e[_0xf7ea('0x3a')]=_0x281d5e['attributes'][_0xf7ea('0x3b')]?_0x281d5e[_0xf7ea('0x3a')]:_0x529629['model'];if(!_0x3a83fa[_0xf7ea('0x34')][_0xf7ea('0x3c')](_0xf7ea('0x3d'))){_0x281d5e[_0xf7ea('0x21')]=qs[_0xf7ea('0x21')](_0x3a83fa['query'][_0xf7ea('0x21')]);_0x281d5e[_0xf7ea('0x1e')]=qs['offset'](_0x3a83fa['query'][_0xf7ea('0x1e')]);}_0x281d5e[_0xf7ea('0x3e')]=qs['sort'](_0x3a83fa[_0xf7ea('0x34')][_0xf7ea('0x3f')]);_0x281d5e['where']=qs['filters'](_[_0xf7ea('0x40')](_0x3a83fa[_0xf7ea('0x34')],_0x529629[_0xf7ea('0x36')]),_0x1ad651);if(_0x3a83fa['query'][_0xf7ea('0x41')]){_0x281d5e[_0xf7ea('0x42')]=_[_0xf7ea('0x43')](_0x281d5e[_0xf7ea('0x42')],{'$or':_[_0xf7ea('0x30')](_0x1ad651,function(_0x483a2b){if(_0x483a2b['type']!==_0xf7ea('0x44')){var _0x3e5921={};_0x3e5921[_0x483a2b[_0xf7ea('0x2d')]]={'$like':'%'+_0x3a83fa[_0xf7ea('0x34')][_0xf7ea('0x41')]+'%'};return _0x3e5921;}})});}_0x281d5e=_['merge']({},_0x281d5e,_0x3a83fa[_0xf7ea('0x45')]);var _0x1f09ab={'where':_0x281d5e[_0xf7ea('0x42')]};return db['ServicenowAccount']['count'](_0x1f09ab)['then'](function(_0x475e5c){_0x957f4f[_0xf7ea('0x20')]=_0x475e5c;if(_0x3a83fa[_0xf7ea('0x34')][_0xf7ea('0x46')]){_0x281d5e[_0xf7ea('0x47')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xf7ea('0x48')](_0x281d5e);})[_0xf7ea('0x29')](function(_0x11430d){_0x957f4f[_0xf7ea('0x49')]=_0x11430d;return _0x957f4f;})[_0xf7ea('0x29')](respondWithFilteredResult(_0x17ca3e,_0x281d5e))[_0xf7ea('0x4a')](handleError(_0x17ca3e,null));};exports[_0xf7ea('0x4b')]=function(_0x1dc721,_0x554abe){var _0x533e1b={'raw':![],'where':{'id':_0x1dc721['params']['id']}},_0xb4efdd={};_0xb4efdd[_0xf7ea('0x38')]=_[_0xf7ea('0x35')](db[_0xf7ea('0x31')]['rawAttributes']);_0xb4efdd[_0xf7ea('0x34')]=_['keys'](_0x1dc721[_0xf7ea('0x34')]);_0xb4efdd['filters']=_[_0xf7ea('0x37')](_0xb4efdd[_0xf7ea('0x38')],_0xb4efdd['query']);_0x533e1b['attributes']=_[_0xf7ea('0x37')](_0xb4efdd[_0xf7ea('0x38')],qs[_0xf7ea('0x39')](_0x1dc721[_0xf7ea('0x34')][_0xf7ea('0x39')]));_0x533e1b[_0xf7ea('0x3a')]=_0x533e1b['attributes'][_0xf7ea('0x3b')]?_0x533e1b[_0xf7ea('0x3a')]:_0xb4efdd['model'];if(_0x1dc721['query'][_0xf7ea('0x46')]){_0x533e1b['include']=[{'all':!![]}];}_0x533e1b=_[_0xf7ea('0x43')]({},_0x533e1b,_0x1dc721[_0xf7ea('0x45')]);return db['ServicenowAccount'][_0xf7ea('0x4c')](_0x533e1b)['then'](handleEntityNotFound(_0x554abe,null))[_0xf7ea('0x29')](respondWithResult(_0x554abe,null))['catch'](handleError(_0x554abe,null));};exports[_0xf7ea('0x4d')]=function(_0x217b38,_0x188287){return db[_0xf7ea('0x31')][_0xf7ea('0x4d')](_0x217b38['body'],{})[_0xf7ea('0x29')](respondWithResult(_0x188287,0xc9))['catch'](handleError(_0x188287,null));};exports[_0xf7ea('0x27')]=function(_0x508814,_0xae5052){if(_0x508814[_0xf7ea('0x4e')]['id']){delete _0x508814[_0xf7ea('0x4e')]['id'];}return db[_0xf7ea('0x31')][_0xf7ea('0x4c')]({'where':{'id':_0x508814[_0xf7ea('0x4f')]['id']}})['then'](handleEntityNotFound(_0xae5052,null))['then'](saveUpdates(_0x508814[_0xf7ea('0x4e')],null))[_0xf7ea('0x29')](respondWithResult(_0xae5052,null))[_0xf7ea('0x4a')](handleError(_0xae5052,null));};exports[_0xf7ea('0x28')]=function(_0x3e00ba,_0x488744){return db[_0xf7ea('0x31')][_0xf7ea('0x4c')]({'where':{'id':_0x3e00ba[_0xf7ea('0x4f')]['id']}})[_0xf7ea('0x29')](handleEntityNotFound(_0x488744,null))[_0xf7ea('0x29')](removeEntity(_0x488744,null))[_0xf7ea('0x4a')](handleError(_0x488744,null));};exports['getConfigurations']=function(_0x164174,_0x55465b,_0x57bb62){var _0x484785={};var _0x72ac94={};var _0x7dbb92;var _0x2e1220;return db[_0xf7ea('0x31')]['findOne']({'where':{'id':_0x164174[_0xf7ea('0x4f')]['id']}})['then'](handleEntityNotFound(_0x55465b,null))[_0xf7ea('0x29')](function(_0x335b0b){if(_0x335b0b){_0x7dbb92=_0x335b0b;_0x72ac94['model']=_[_0xf7ea('0x35')](db['ServicenowConfiguration'][_0xf7ea('0x32')]);_0x72ac94['query']=_[_0xf7ea('0x35')](_0x164174[_0xf7ea('0x34')]);_0x72ac94[_0xf7ea('0x36')]=_[_0xf7ea('0x37')](_0x72ac94[_0xf7ea('0x38')],_0x72ac94[_0xf7ea('0x34')]);_0x484785['attributes']=_[_0xf7ea('0x37')](_0x72ac94[_0xf7ea('0x38')],qs[_0xf7ea('0x39')](_0x164174[_0xf7ea('0x34')][_0xf7ea('0x39')]));_0x484785['attributes']=_0x484785[_0xf7ea('0x3a')][_0xf7ea('0x3b')]?_0x484785[_0xf7ea('0x3a')]:_0x72ac94['model'];_0x484785[_0xf7ea('0x3e')]=qs['sort'](_0x164174[_0xf7ea('0x34')][_0xf7ea('0x3f')]);_0x484785[_0xf7ea('0x42')]=qs[_0xf7ea('0x36')](_[_0xf7ea('0x40')](_0x164174[_0xf7ea('0x34')],_0x72ac94[_0xf7ea('0x36')]));if(_0x164174['query']['filter']){_0x484785[_0xf7ea('0x42')]=_[_0xf7ea('0x43')](_0x484785['where'],{'$or':_['map'](_0x484785[_0xf7ea('0x3a')],function(_0x34c63f){var _0x58c31c={};_0x58c31c[_0x34c63f]={'$like':'%'+_0x164174[_0xf7ea('0x34')][_0xf7ea('0x41')]+'%'};return _0x58c31c;})});}_0x484785=_[_0xf7ea('0x43')]({},_0x484785,_0x164174['options']);return _0x7dbb92[_0xf7ea('0x50')](_0x484785);}})['then'](function(_0x21ab88){if(_0x21ab88){_0x2e1220=_0x21ab88['length'];if(!_0x164174[_0xf7ea('0x34')]['hasOwnProperty']('nolimit')){_0x484785['limit']=qs[_0xf7ea('0x21')](_0x164174[_0xf7ea('0x34')][_0xf7ea('0x21')]);_0x484785[_0xf7ea('0x1e')]=qs[_0xf7ea('0x1e')](_0x164174[_0xf7ea('0x34')][_0xf7ea('0x1e')]);}return _0x7dbb92[_0xf7ea('0x50')](_0x484785);}})['then'](function(_0x112f6a){if(_0x112f6a){return _0x112f6a?{'count':_0x2e1220,'rows':_0x112f6a}:null;}})['then'](respondWithResult(_0x55465b,null))[_0xf7ea('0x4a')](handleError(_0x55465b,null));};exports['addConfiguration']=function(_0x2557a6,_0xddf0a9,_0x2d925f){if(_0x2557a6['body']['id']){delete _0x2557a6[_0xf7ea('0x4e')]['id'];}return db['ServicenowAccount'][_0xf7ea('0x51')]({'where':{'id':_0x2557a6[_0xf7ea('0x4f')]['id']}})[_0xf7ea('0x29')](handleEntityNotFound(_0xddf0a9,null))[_0xf7ea('0x29')](function(_0x11e5d7){if(_0x11e5d7){_0x2557a6[_0xf7ea('0x4e')][_0xf7ea('0x52')]=_0x11e5d7['id'];_0x2557a6[_0xf7ea('0x4e')]['Subjects']=integrations[_0xf7ea('0x53')](_0x2557a6[_0xf7ea('0x4e')][_0xf7ea('0x54')],_0x2557a6['body']['type']);_0x2557a6[_0xf7ea('0x4e')][_0xf7ea('0x55')]=integrations[_0xf7ea('0x56')](_0x2557a6[_0xf7ea('0x4e')][_0xf7ea('0x54')],_0x2557a6[_0xf7ea('0x4e')][_0xf7ea('0x57')]);return db['ServicenowConfiguration']['create'](_0x2557a6['body'],{'include':[{'model':db[_0xf7ea('0x58')],'as':'Subjects'},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0xf7ea('0x29')](respondWithResult(_0xddf0a9,null))[_0xf7ea('0x4a')](handleError(_0xddf0a9,null));};exports[_0xf7ea('0x59')]=function(_0x31e527,_0x492aa9,_0x2771ed){var _0x59815a=['made_sla',_0xf7ea('0x5a'),_0xf7ea('0x5b'),_0xf7ea('0x5c'),_0xf7ea('0x5d'),_0xf7ea('0x5e'),_0xf7ea('0x5f'),_0xf7ea('0x60'),_0xf7ea('0x61')];var _0x15b3cb=[_0xf7ea('0x62'),_0xf7ea('0x63'),_0xf7ea('0x64'),_0xf7ea('0x65'),_0xf7ea('0x66'),_0xf7ea('0x67'),'child_incidents',_0xf7ea('0x5a'),_0xf7ea('0x68'),'number',_0xf7ea('0x69'),_0xf7ea('0x6a'),_0xf7ea('0x6b'),_0xf7ea('0x6c'),'sys_created_on',_0xf7ea('0x6d'),_0xf7ea('0x6e'),_0xf7ea('0x6f'),_0xf7ea('0x5b'),_0xf7ea('0x3e'),_0xf7ea('0x70'),'closed_at',_0xf7ea('0x71'),'delivery_plan',_0xf7ea('0x72'),'active','work_notes_list',_0xf7ea('0x73'),_0xf7ea('0x74'),_0xf7ea('0x75'),_0xf7ea('0x76'),'time_worked','expected_start',_0xf7ea('0x77'),'business_duration',_0xf7ea('0x78'),_0xf7ea('0x79'),_0xf7ea('0x7a'),_0xf7ea('0x7b'),_0xf7ea('0x7c'),_0xf7ea('0x7d'),_0xf7ea('0x5c'),_0xf7ea('0x7e'),_0xf7ea('0x7f'),_0xf7ea('0x5d'),_0xf7ea('0x80'),'delivery_task',_0xf7ea('0x81'),_0xf7ea('0x82'),_0xf7ea('0x83'),_0xf7ea('0x84'),'description',_0xf7ea('0x85'),_0xf7ea('0x5e'),'sys_class_name','close_notes','closed_by',_0xf7ea('0x86'),'parent_incident',_0xf7ea('0x87'),'contact_type','reopened_by',_0xf7ea('0x5f'),_0xf7ea('0x88'),_0xf7ea('0x89'),'company','reassignment_count',_0xf7ea('0x8a'),_0xf7ea('0x8b'),_0xf7ea('0x60'),_0xf7ea('0x8c'),_0xf7ea('0x8d'),'approval',_0xf7ea('0x8e'),_0xf7ea('0x8f'),_0xf7ea('0x90'),_0xf7ea('0x91'),_0xf7ea('0x92'),_0xf7ea('0x93'),'upon_approval',_0xf7ea('0x94'),_0xf7ea('0x95'),'category'];var _0x1bfd86='';var _0x5204a5='';var _0x152215=[];var _0x46d658='';var _0x42a028='';var _0x46e105=[];var _0x5c2b3c='';var _0x21d541='';var _0x3c5bed={};var _0x115a8a='';return db[_0xf7ea('0x31')][_0xf7ea('0x51')]({'where':{'id':_0x31e527[_0xf7ea('0x4f')]['id']},'attributes':['id',_0xf7ea('0x96'),_0xf7ea('0x97'),_0xf7ea('0x98'),_0xf7ea('0x99'),_0xf7ea('0x9a')]})[_0xf7ea('0x29')](handleEntityNotFound(_0x492aa9,null))[_0xf7ea('0x29')](function(_0x40676d){if(_0x40676d){_0x115a8a=_0x40676d[_0xf7ea('0x99')];var _0x203ba8=_0x115a8a[_0xf7ea('0x9b')](-0x1);if(_0x203ba8==='/'){_0x115a8a=_0x115a8a['substring'](0x0,_0x115a8a[_0xf7ea('0x9c')](_0x203ba8));}_0x21d541=util[_0xf7ea('0x9d')]('%s/api/now/doc/table/schema/',_0x115a8a);_0x5c2b3c=util['format']('%s/api/now/table/',_0x115a8a);_0x3c5bed={'user':_0x40676d[_0xf7ea('0x96')],'pass':_0x40676d['password']};var _0x461855={'method':'GET','uri':_0x21d541+_0xf7ea('0x9e'),'auth':_0x3c5bed,'json':!![]};return rp(_0x461855);}})['then'](function(_0x10f096){if(_0x10f096[_0xf7ea('0x9f')][_0xf7ea('0x3b')]>0x0){_0x1bfd86=_0x10f096['result'];}console[_0xf7ea('0xa0')](_0xf7ea('0xa1'),_0x1bfd86);_0x46e105=[];_0x5204a5=Object[_0xf7ea('0xa2')]([],_0x1bfd86);_[_0xf7ea('0xa3')](_0x5204a5,function(_0x278572){return!_0x59815a[_0xf7ea('0xa4')](_0x278572[_0xf7ea('0x2d')]);});_0x5204a5[_0xf7ea('0xa5')](function(_0x4e0e50){var _0x2c544d=createFieldObject(_0x5c2b3c,_0x3c5bed,_0x4e0e50[_0xf7ea('0xa6')],_0x4e0e50['name'],_0x4e0e50['label'],![]);_0x46e105[_0xf7ea('0xa7')](_0x2c544d);});return Promise[_0xf7ea('0xa8')](_0x46e105);})[_0xf7ea('0x29')](function(_0x327df5){_0x152215=_0x327df5;_0x46d658=Object[_0xf7ea('0xa2')]([],_0x1bfd86);console[_0xf7ea('0xa0')](_0xf7ea('0xa9'),_0x1bfd86);_[_0xf7ea('0xa3')](_0x46d658,function(_0x2816fa){return _0x15b3cb[_0xf7ea('0xa4')](_0x2816fa['name']);});console['log'](_0xf7ea('0xaa'),_0x46d658);_0x46e105=[];_0x46d658[_0xf7ea('0xa5')](function(_0x7de6e6){var _0x5a18f2=createFieldObject(_0x5c2b3c,_0x3c5bed,_0x7de6e6[_0xf7ea('0xa6')],_0x7de6e6['name'],_0x7de6e6[_0xf7ea('0xab')],!![]);_0x46e105[_0xf7ea('0xa7')](_0x5a18f2);});return Promise['all'](_0x46e105);})[_0xf7ea('0x29')](function(_0x4ed7ce){_0x42a028=_0x4ed7ce;var _0x390ecd=_0x152215[_0xf7ea('0xac')](_0x42a028);return{'count':_0x390ecd['length'],'rows':_0x390ecd};})[_0xf7ea('0x29')](respondWithResult(_0x492aa9,null))[_0xf7ea('0x4a')](function(_0x2aa549){console['log'](_0xf7ea('0xad')+_0x2aa549);var _0x29ae6b=_0x31e527[_0xf7ea('0x34')][_0xf7ea('0xae')]?0x1f4:_0x2aa549[_0xf7ea('0xaf')]||0x1f4;logger[_0xf7ea('0x2b')](_0x2aa549[_0xf7ea('0x2c')]);delete _0x2aa549[_0xf7ea('0x2d')];if(_0x29ae6b===0x191){_0x29ae6b=0x190;}_0x492aa9[_0xf7ea('0x1b')](_0x29ae6b)[_0xf7ea('0x2e')](_0x31e527[_0xf7ea('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2aa549[_0xf7ea('0xaf')]}:_0x2aa549);});};function createFieldObject(_0x3f7d4a,_0x8b3390,_0x3802d8,_0x14ce1b,_0x19d818,_0x182d4a){return new Promise(function(_0x13bf68,_0x2a7ba7){var _0x28208e={'id':_0x14ce1b,'name':_0x19d818,'custom':_0x182d4a};if(_0x3802d8===_0xf7ea('0xb0')){_0x28208e['options']=[{'name':'True','value':_0xf7ea('0xb1')},{'name':_0xf7ea('0xb2'),'value':_0xf7ea('0xb3')}];_0x13bf68(_0x28208e);}else{var _0x3db6e1={'method':_0xf7ea('0xb4'),'uri':_0x3f7d4a+_0xf7ea('0xb5')+_0x14ce1b,'auth':_0x8b3390,'json':!![]};return rp(_0x3db6e1)[_0xf7ea('0x29')](function(_0x4757eb){var _0x357ab6=[];if(_0x4757eb[_0xf7ea('0x9f')][_0xf7ea('0x3b')]>0x0){_0x4757eb['result'][_0xf7ea('0xa5')](function(_0x4da8f0){if(_0x4da8f0[_0xf7ea('0xb6')]===_0xf7ea('0xb3')){var _0x388bbd={'name':_0x4da8f0[_0xf7ea('0xab')],'value':_0x4da8f0[_0xf7ea('0xb7')]};_0x357ab6['push'](_0x388bbd);}});}_0x28208e[_0xf7ea('0x45')]=_0x357ab6;if(_0x28208e[_0xf7ea('0x45')][_0xf7ea('0x3b')]>0x0){_0x13bf68(_0x28208e);}else{if(_0x182d4a==![]){_0x13bf68();}else{_0x13bf68(_0x28208e);}}});}});} \ No newline at end of file +var _0x22ff=['name','index','map','ServicenowAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','findOne','ServicenowConfiguration','length','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','notify','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','stack','send','boolean','True','true','false','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error'];(function(_0x495635,_0x4ab1d6){var _0x48a96a=function(_0x245a99){while(--_0x245a99){_0x495635['push'](_0x495635['shift']());}};_0x48a96a(++_0x4ab1d6);}(_0x22ff,0x149));var _0xf22f=function(_0x332597,_0x33648e){_0x332597=_0x332597-0x0;var _0x70870e=_0x22ff[_0x332597];return _0x70870e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf22f('0x0'));var zipdir=require(_0xf22f('0x1'));var jsonpatch=require(_0xf22f('0x2'));var rp=require(_0xf22f('0x3'));var moment=require(_0xf22f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf22f('0x5'));var util=require(_0xf22f('0x6'));var path=require(_0xf22f('0x7'));var sox=require(_0xf22f('0x8'));var csv=require(_0xf22f('0x9'));var ejs=require(_0xf22f('0xa'));var fs=require('fs');var fs_extra=require(_0xf22f('0xb'));var _=require(_0xf22f('0xc'));var squel=require(_0xf22f('0xd'));var crypto=require(_0xf22f('0xe'));var jsforce=require(_0xf22f('0xf'));var deskjs=require(_0xf22f('0x10'));var toCsv=require(_0xf22f('0x9'));var querystring=require(_0xf22f('0x11'));var Papa=require('papaparse');var Redis=require(_0xf22f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf22f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf22f('0x14'));var logger=require(_0xf22f('0x15'))(_0xf22f('0x16'));var utils=require('../../config/utils');var config=require(_0xf22f('0x17'));var licenseUtil=require(_0xf22f('0x18'));var db=require(_0xf22f('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2fff51,_0xba2c3f){_0xba2c3f=_0xba2c3f||0xcc;return function(_0x64fb06){if(_0x64fb06){return _0x2fff51['sendStatus'](_0xba2c3f);}return _0x2fff51['status'](_0xba2c3f)['end']();};}function respondWithResult(_0x43ef1b,_0x155649){_0x155649=_0x155649||0xc8;return function(_0x2d52ac){if(_0x2d52ac){return _0x43ef1b[_0xf22f('0x1a')](_0x155649)['json'](_0x2d52ac);}};}function respondWithFilteredResult(_0x4d37bf,_0x53068c){return function(_0x47471e){if(_0x47471e){var _0x2f03c0=typeof _0x53068c[_0xf22f('0x1b')]===_0xf22f('0x1c')&&typeof _0x53068c[_0xf22f('0x1d')]===_0xf22f('0x1c');var _0xf60f49=_0x47471e[_0xf22f('0x1e')];var _0x2bb98f=_0x2f03c0?0x0:_0x53068c[_0xf22f('0x1b')];var _0x2352df=_0x2f03c0?_0x47471e[_0xf22f('0x1e')]:_0x53068c[_0xf22f('0x1b')]+_0x53068c[_0xf22f('0x1d')];var _0x275cd5;if(_0x2352df>=_0xf60f49){_0x2352df=_0xf60f49;_0x275cd5=0xc8;}else{_0x275cd5=0xce;}_0x4d37bf[_0xf22f('0x1a')](_0x275cd5);return _0x4d37bf[_0xf22f('0x1f')](_0xf22f('0x20'),_0x2bb98f+'-'+_0x2352df+'/'+_0xf60f49)[_0xf22f('0x21')](_0x47471e);}return null;};}function patchUpdates(_0x48b4a9){return function(_0x40c51b){try{jsonpatch[_0xf22f('0x22')](_0x40c51b,_0x48b4a9,!![]);}catch(_0x28fa28){return BPromise['reject'](_0x28fa28);}return _0x40c51b[_0xf22f('0x23')]();};}function saveUpdates(_0x5157d7,_0x566888){return function(_0x11225c){if(_0x11225c){return _0x11225c[_0xf22f('0x24')](_0x5157d7)[_0xf22f('0x25')](function(_0x333706){return _0x333706;});}return null;};}function removeEntity(_0x5a51c1,_0x162c34){return function(_0xf6d3e6){if(_0xf6d3e6){return _0xf6d3e6[_0xf22f('0x26')]()['then'](function(){_0x5a51c1['status'](0xcc)[_0xf22f('0x27')]();});}};}function handleEntityNotFound(_0x1288b5,_0x363234){return function(_0x5a895e){if(!_0x5a895e){_0x1288b5['sendStatus'](0x194);}return _0x5a895e;};}function handleError(_0xb1fb8,_0x1cb049){_0x1cb049=_0x1cb049||0x1f4;return function(_0x33e3e4){logger[_0xf22f('0x28')](_0x33e3e4['stack']);if(_0x33e3e4[_0xf22f('0x29')]){delete _0x33e3e4[_0xf22f('0x29')];}_0xb1fb8['status'](_0x1cb049)['send'](_0x33e3e4);};}exports[_0xf22f('0x2a')]=function(_0x6454c5,_0x4cc3b8){var _0x44a593={},_0x744eb1={},_0x5b3ede={'count':0x0,'rows':[]};var _0x26cb6e=_[_0xf22f('0x2b')](db[_0xf22f('0x2c')][_0xf22f('0x2d')],function(_0x17a200){return{'name':_0x17a200['fieldName'],'type':_0x17a200[_0xf22f('0x2e')][_0xf22f('0x2f')]};});_0x744eb1[_0xf22f('0x30')]=_['map'](_0x26cb6e,'name');_0x744eb1[_0xf22f('0x31')]=_[_0xf22f('0x32')](_0x6454c5[_0xf22f('0x31')]);_0x744eb1['filters']=_[_0xf22f('0x33')](_0x744eb1['model'],_0x744eb1['query']);_0x44a593[_0xf22f('0x34')]=_[_0xf22f('0x33')](_0x744eb1[_0xf22f('0x30')],qs[_0xf22f('0x35')](_0x6454c5[_0xf22f('0x31')][_0xf22f('0x35')]));_0x44a593['attributes']=_0x44a593[_0xf22f('0x34')]['length']?_0x44a593['attributes']:_0x744eb1['model'];if(!_0x6454c5[_0xf22f('0x31')][_0xf22f('0x36')](_0xf22f('0x37'))){_0x44a593['limit']=qs[_0xf22f('0x1d')](_0x6454c5[_0xf22f('0x31')][_0xf22f('0x1d')]);_0x44a593['offset']=qs[_0xf22f('0x1b')](_0x6454c5['query'][_0xf22f('0x1b')]);}_0x44a593[_0xf22f('0x38')]=qs[_0xf22f('0x39')](_0x6454c5['query'][_0xf22f('0x39')]);_0x44a593['where']=qs[_0xf22f('0x3a')](_[_0xf22f('0x3b')](_0x6454c5['query'],_0x744eb1[_0xf22f('0x3a')]),_0x26cb6e);if(_0x6454c5['query']['filter']){_0x44a593[_0xf22f('0x3c')]=_[_0xf22f('0x3d')](_0x44a593['where'],{'$or':_[_0xf22f('0x2b')](_0x26cb6e,function(_0x3f4fda){if(_0x3f4fda['type']!==_0xf22f('0x3e')){var _0x334c69={};_0x334c69[_0x3f4fda[_0xf22f('0x29')]]={'$like':'%'+_0x6454c5[_0xf22f('0x31')]['filter']+'%'};return _0x334c69;}})});}_0x44a593=_[_0xf22f('0x3d')]({},_0x44a593,_0x6454c5[_0xf22f('0x3f')]);var _0xa2c07c={'where':_0x44a593[_0xf22f('0x3c')]};return db[_0xf22f('0x2c')][_0xf22f('0x1e')](_0xa2c07c)[_0xf22f('0x25')](function(_0x2ed213){_0x5b3ede[_0xf22f('0x1e')]=_0x2ed213;if(_0x6454c5[_0xf22f('0x31')][_0xf22f('0x40')]){_0x44a593['include']=[{'all':!![]}];}return db[_0xf22f('0x2c')][_0xf22f('0x41')](_0x44a593);})[_0xf22f('0x25')](function(_0xef08bf){_0x5b3ede[_0xf22f('0x42')]=_0xef08bf;return _0x5b3ede;})[_0xf22f('0x25')](respondWithFilteredResult(_0x4cc3b8,_0x44a593))[_0xf22f('0x43')](handleError(_0x4cc3b8,null));};exports[_0xf22f('0x44')]=function(_0x497b2f,_0x210b6c){var _0x16367f={'raw':![],'where':{'id':_0x497b2f[_0xf22f('0x45')]['id']}},_0x62d1fe={};_0x62d1fe[_0xf22f('0x30')]=_[_0xf22f('0x32')](db[_0xf22f('0x2c')]['rawAttributes']);_0x62d1fe[_0xf22f('0x31')]=_[_0xf22f('0x32')](_0x497b2f['query']);_0x62d1fe['filters']=_['intersection'](_0x62d1fe[_0xf22f('0x30')],_0x62d1fe['query']);_0x16367f[_0xf22f('0x34')]=_[_0xf22f('0x33')](_0x62d1fe[_0xf22f('0x30')],qs[_0xf22f('0x35')](_0x497b2f[_0xf22f('0x31')]['fields']));_0x16367f['attributes']=_0x16367f['attributes']['length']?_0x16367f[_0xf22f('0x34')]:_0x62d1fe[_0xf22f('0x30')];if(_0x497b2f[_0xf22f('0x31')][_0xf22f('0x40')]){_0x16367f[_0xf22f('0x46')]=[{'all':!![]}];}_0x16367f=_[_0xf22f('0x3d')]({},_0x16367f,_0x497b2f[_0xf22f('0x3f')]);return db[_0xf22f('0x2c')][_0xf22f('0x47')](_0x16367f)['then'](handleEntityNotFound(_0x210b6c,null))[_0xf22f('0x25')](respondWithResult(_0x210b6c,null))[_0xf22f('0x43')](handleError(_0x210b6c,null));};exports[_0xf22f('0x48')]=function(_0x27658e,_0x187ae7){return db['ServicenowAccount'][_0xf22f('0x48')](_0x27658e[_0xf22f('0x49')],{})[_0xf22f('0x25')](respondWithResult(_0x187ae7,0xc9))[_0xf22f('0x43')](handleError(_0x187ae7,null));};exports['update']=function(_0x322617,_0x561533){if(_0x322617[_0xf22f('0x49')]['id']){delete _0x322617['body']['id'];}return db[_0xf22f('0x2c')][_0xf22f('0x47')]({'where':{'id':_0x322617[_0xf22f('0x45')]['id']}})['then'](handleEntityNotFound(_0x561533,null))['then'](saveUpdates(_0x322617[_0xf22f('0x49')],null))[_0xf22f('0x25')](respondWithResult(_0x561533,null))[_0xf22f('0x43')](handleError(_0x561533,null));};exports['destroy']=function(_0x1c2406,_0x4e9be1){return db[_0xf22f('0x2c')]['find']({'where':{'id':_0x1c2406['params']['id']}})[_0xf22f('0x25')](handleEntityNotFound(_0x4e9be1,null))[_0xf22f('0x25')](removeEntity(_0x4e9be1,null))['catch'](handleError(_0x4e9be1,null));};exports['getConfigurations']=function(_0x39bbcb,_0x2dcf6e,_0x325ba8){var _0x56d45c={};var _0x1c3a17={};var _0x350e97;var _0x4d8266;return db[_0xf22f('0x2c')][_0xf22f('0x4a')]({'where':{'id':_0x39bbcb[_0xf22f('0x45')]['id']}})[_0xf22f('0x25')](handleEntityNotFound(_0x2dcf6e,null))[_0xf22f('0x25')](function(_0x166d5e){if(_0x166d5e){_0x350e97=_0x166d5e;_0x1c3a17['model']=_[_0xf22f('0x32')](db[_0xf22f('0x4b')][_0xf22f('0x2d')]);_0x1c3a17[_0xf22f('0x31')]=_[_0xf22f('0x32')](_0x39bbcb[_0xf22f('0x31')]);_0x1c3a17[_0xf22f('0x3a')]=_['intersection'](_0x1c3a17[_0xf22f('0x30')],_0x1c3a17[_0xf22f('0x31')]);_0x56d45c[_0xf22f('0x34')]=_[_0xf22f('0x33')](_0x1c3a17[_0xf22f('0x30')],qs['fields'](_0x39bbcb['query'][_0xf22f('0x35')]));_0x56d45c[_0xf22f('0x34')]=_0x56d45c[_0xf22f('0x34')][_0xf22f('0x4c')]?_0x56d45c[_0xf22f('0x34')]:_0x1c3a17[_0xf22f('0x30')];_0x56d45c[_0xf22f('0x38')]=qs[_0xf22f('0x39')](_0x39bbcb['query']['sort']);_0x56d45c[_0xf22f('0x3c')]=qs['filters'](_[_0xf22f('0x3b')](_0x39bbcb[_0xf22f('0x31')],_0x1c3a17[_0xf22f('0x3a')]));if(_0x39bbcb[_0xf22f('0x31')][_0xf22f('0x4d')]){_0x56d45c[_0xf22f('0x3c')]=_[_0xf22f('0x3d')](_0x56d45c[_0xf22f('0x3c')],{'$or':_[_0xf22f('0x2b')](_0x56d45c['attributes'],function(_0x1c3514){var _0x281f91={};_0x281f91[_0x1c3514]={'$like':'%'+_0x39bbcb[_0xf22f('0x31')]['filter']+'%'};return _0x281f91;})});}_0x56d45c=_[_0xf22f('0x3d')]({},_0x56d45c,_0x39bbcb[_0xf22f('0x3f')]);return _0x350e97[_0xf22f('0x4e')](_0x56d45c);}})['then'](function(_0x564b08){if(_0x564b08){_0x4d8266=_0x564b08[_0xf22f('0x4c')];if(!_0x39bbcb[_0xf22f('0x31')]['hasOwnProperty'](_0xf22f('0x37'))){_0x56d45c['limit']=qs[_0xf22f('0x1d')](_0x39bbcb[_0xf22f('0x31')][_0xf22f('0x1d')]);_0x56d45c['offset']=qs[_0xf22f('0x1b')](_0x39bbcb[_0xf22f('0x31')][_0xf22f('0x1b')]);}return _0x350e97['getConfigurations'](_0x56d45c);}})[_0xf22f('0x25')](function(_0x31d185){if(_0x31d185){return _0x31d185?{'count':_0x4d8266,'rows':_0x31d185}:null;}})[_0xf22f('0x25')](respondWithResult(_0x2dcf6e,null))[_0xf22f('0x43')](handleError(_0x2dcf6e,null));};exports[_0xf22f('0x4f')]=function(_0x87114f,_0x334166,_0x50c8da){if(_0x87114f[_0xf22f('0x49')]['id']){delete _0x87114f[_0xf22f('0x49')]['id'];}return db[_0xf22f('0x2c')][_0xf22f('0x4a')]({'where':{'id':_0x87114f[_0xf22f('0x45')]['id']}})[_0xf22f('0x25')](handleEntityNotFound(_0x334166,null))[_0xf22f('0x25')](function(_0x32c4e5){if(_0x32c4e5){_0x87114f[_0xf22f('0x49')][_0xf22f('0x50')]=_0x32c4e5['id'];_0x87114f[_0xf22f('0x49')][_0xf22f('0x51')]=integrations[_0xf22f('0x52')](_0x87114f[_0xf22f('0x49')]['channel'],_0x87114f[_0xf22f('0x49')]['type']);_0x87114f[_0xf22f('0x49')]['Descriptions']=integrations[_0xf22f('0x53')](_0x87114f[_0xf22f('0x49')][_0xf22f('0x54')],_0x87114f[_0xf22f('0x49')]['type']);return db[_0xf22f('0x4b')][_0xf22f('0x48')](_0x87114f[_0xf22f('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0xf22f('0x51')},{'model':db['ServicenowField'],'as':_0xf22f('0x55')}]});}return null;})[_0xf22f('0x25')](respondWithResult(_0x334166,null))[_0xf22f('0x43')](handleError(_0x334166,null));};exports[_0xf22f('0x56')]=function(_0x3de6b3,_0x32b609,_0x3d8b30){var _0x441ee7=['made_sla',_0xf22f('0x57'),_0xf22f('0x58'),_0xf22f('0x59'),_0xf22f('0x5a'),'notify',_0xf22f('0x5b'),'severity',_0xf22f('0x5c')];var _0x5e219c=[_0xf22f('0x5d'),'made_sla',_0xf22f('0x5e'),_0xf22f('0x5f'),_0xf22f('0x60'),'sys_updated_on',_0xf22f('0x61'),_0xf22f('0x57'),_0xf22f('0x62'),_0xf22f('0x63'),_0xf22f('0x64'),'sys_updated_by',_0xf22f('0x65'),_0xf22f('0x66'),_0xf22f('0x67'),'sys_domain',_0xf22f('0x68'),_0xf22f('0x69'),_0xf22f('0x58'),_0xf22f('0x38'),'calendar_stc',_0xf22f('0x6a'),_0xf22f('0x6b'),_0xf22f('0x6c'),_0xf22f('0x6d'),_0xf22f('0x6e'),_0xf22f('0x6f'),_0xf22f('0x70'),_0xf22f('0x71'),_0xf22f('0x72'),'rfc',_0xf22f('0x73'),_0xf22f('0x74'),'opened_at',_0xf22f('0x75'),_0xf22f('0x76'),_0xf22f('0x77'),_0xf22f('0x78'),_0xf22f('0x79'),_0xf22f('0x7a'),_0xf22f('0x7b'),'subcategory',_0xf22f('0x7c'),_0xf22f('0x7d'),_0xf22f('0x5a'),'correlation_display',_0xf22f('0x7e'),'work_start',_0xf22f('0x7f'),_0xf22f('0x80'),_0xf22f('0x81'),_0xf22f('0x82'),'calendar_duration',_0xf22f('0x83'),_0xf22f('0x84'),_0xf22f('0x85'),_0xf22f('0x86'),'follow_up',_0xf22f('0x87'),_0xf22f('0x88'),_0xf22f('0x89'),_0xf22f('0x8a'),_0xf22f('0x5b'),'urgency',_0xf22f('0x8b'),_0xf22f('0x8c'),_0xf22f('0x8d'),_0xf22f('0x8e'),_0xf22f('0x8f'),'severity','comments',_0xf22f('0x90'),_0xf22f('0x91'),_0xf22f('0x92'),_0xf22f('0x93'),_0xf22f('0x94'),_0xf22f('0x95'),_0xf22f('0x96'),'escalation',_0xf22f('0x97'),_0xf22f('0x98'),'location','category'];var _0x6fdc4d='';var _0x18384e='';var _0x14090c=[];var _0x2e7f14='';var _0xf24bf6='';var _0x4fb746=[];var _0x18f466='';var _0x5d6cf5='';var _0x14cf70={};var _0x2dc673='';return db[_0xf22f('0x2c')][_0xf22f('0x4a')]({'where':{'id':_0x3de6b3['params']['id']},'attributes':['id',_0xf22f('0x99'),_0xf22f('0x9a'),_0xf22f('0x9b'),_0xf22f('0x9c'),_0xf22f('0x9d')]})[_0xf22f('0x25')](handleEntityNotFound(_0x32b609,null))[_0xf22f('0x25')](function(_0x5d3601){if(_0x5d3601){_0x2dc673=_0x5d3601[_0xf22f('0x9c')];var _0x507e00=_0x2dc673[_0xf22f('0x9e')](-0x1);if(_0x507e00==='/'){_0x2dc673=_0x2dc673['substring'](0x0,_0x2dc673['lastIndexOf'](_0x507e00));}_0x5d6cf5=util[_0xf22f('0x9f')](_0xf22f('0xa0'),_0x2dc673);_0x18f466=util['format'](_0xf22f('0xa1'),_0x2dc673);_0x14cf70={'user':_0x5d3601[_0xf22f('0x99')],'pass':_0x5d3601[_0xf22f('0x9a')]};var _0x4be907={'method':_0xf22f('0xa2'),'uri':_0x5d6cf5+'incident?sysparm_display_value=all','auth':_0x14cf70,'json':!![]};return rp(_0x4be907);}})[_0xf22f('0x25')](function(_0x48fc5d){if(_0x48fc5d[_0xf22f('0xa3')]['length']>0x0){_0x6fdc4d=_0x48fc5d[_0xf22f('0xa3')];}console[_0xf22f('0xa4')](_0xf22f('0xa5'),_0x6fdc4d);_0x4fb746=[];_0x18384e=Object[_0xf22f('0xa6')]([],_0x6fdc4d);_[_0xf22f('0xa7')](_0x18384e,function(_0x1ad8c6){return!_0x441ee7[_0xf22f('0xa8')](_0x1ad8c6[_0xf22f('0x29')]);});_0x18384e[_0xf22f('0xa9')](function(_0x5eb6b5){var _0x238405=createFieldObject(_0x18f466,_0x14cf70,_0x5eb6b5[_0xf22f('0xaa')],_0x5eb6b5[_0xf22f('0x29')],_0x5eb6b5[_0xf22f('0xab')],![]);_0x4fb746[_0xf22f('0xac')](_0x238405);});return Promise[_0xf22f('0xad')](_0x4fb746);})['then'](function(_0x1ae1d5){_0x14090c=_0x1ae1d5;_0x2e7f14=Object[_0xf22f('0xa6')]([],_0x6fdc4d);console[_0xf22f('0xa4')]('TCL:\x20_object',_0x6fdc4d);_[_0xf22f('0xa7')](_0x2e7f14,function(_0xeb5933){return _0x5e219c[_0xf22f('0xa8')](_0xeb5933['name']);});console[_0xf22f('0xa4')](_0xf22f('0xae'),_0x2e7f14);_0x4fb746=[];_0x2e7f14[_0xf22f('0xa9')](function(_0x1d895a){var _0x3ae3f7=createFieldObject(_0x18f466,_0x14cf70,_0x1d895a[_0xf22f('0xaa')],_0x1d895a[_0xf22f('0x29')],_0x1d895a[_0xf22f('0xab')],!![]);_0x4fb746[_0xf22f('0xac')](_0x3ae3f7);});return Promise[_0xf22f('0xad')](_0x4fb746);})[_0xf22f('0x25')](function(_0xf4f3ca){_0xf24bf6=_0xf4f3ca;var _0x5e1524=_0x14090c['concat'](_0xf24bf6);return{'count':_0x5e1524[_0xf22f('0x4c')],'rows':_0x5e1524};})[_0xf22f('0x25')](respondWithResult(_0x32b609,null))[_0xf22f('0x43')](function(_0x3bce5b){console['log'](_0xf22f('0xaf')+_0x3bce5b);var _0x4fed=_0x3de6b3['query'][_0xf22f('0xb0')]?0x1f4:_0x3bce5b[_0xf22f('0xb1')]||0x1f4;logger[_0xf22f('0x28')](_0x3bce5b[_0xf22f('0xb2')]);delete _0x3bce5b[_0xf22f('0x29')];if(_0x4fed===0x191){_0x4fed=0x190;}_0x32b609[_0xf22f('0x1a')](_0x4fed)[_0xf22f('0xb3')](_0x3de6b3[_0xf22f('0x31')][_0xf22f('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x3bce5b[_0xf22f('0xb1')]}:_0x3bce5b);});};function createFieldObject(_0x31d1d8,_0x1d92b6,_0x224cb0,_0x3ccb93,_0x4fba9b,_0x55e2a0){return new Promise(function(_0x33af8c,_0x3d4f75){var _0x167bf7={'id':_0x3ccb93,'name':_0x4fba9b,'custom':_0x55e2a0};if(_0x224cb0===_0xf22f('0xb4')){_0x167bf7[_0xf22f('0x3f')]=[{'name':_0xf22f('0xb5'),'value':_0xf22f('0xb6')},{'name':'False','value':_0xf22f('0xb7')}];_0x33af8c(_0x167bf7);}else{var _0xbd01a5={'method':'GET','uri':_0x31d1d8+'sys_choice?sysparm_query=name=incident^element='+_0x3ccb93,'auth':_0x1d92b6,'json':!![]};return rp(_0xbd01a5)['then'](function(_0x10dd0c){var _0xbe8aea=[];if(_0x10dd0c[_0xf22f('0xa3')]['length']>0x0){_0x10dd0c[_0xf22f('0xa3')][_0xf22f('0xa9')](function(_0x8404f3){if(_0x8404f3['inactive']===_0xf22f('0xb7')){var _0xfa9fd={'name':_0x8404f3[_0xf22f('0xab')],'value':_0x8404f3[_0xf22f('0xb8')]};_0xbe8aea[_0xf22f('0xac')](_0xfa9fd);}});}_0x167bf7[_0xf22f('0x3f')]=_0xbe8aea;if(_0x167bf7[_0xf22f('0x3f')][_0xf22f('0x4c')]>0x0){_0x33af8c(_0x167bf7);}else{if(_0x55e2a0==![]){_0x33af8c();}else{_0x33af8c(_0x167bf7);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 126e1c2..0c14598 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 _0x90b1=['define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x90b1,0x1bb));var _0x190b=function(_0x262ff6,_0x158799){_0x262ff6=_0x262ff6-0x0;var _0x4c9b82=_0x90b1[_0x262ff6];return _0x4c9b82;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x27ff8c,_0x34a689){return _0x27ff8c[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['rimraf','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x15b9cc,_0x456106){var _0x1c16a2=function(_0x59294f){while(--_0x59294f){_0x15b9cc['push'](_0x15b9cc['shift']());}};_0x1c16a2(++_0x456106);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4b54e3,_0x2655e1){_0x4b54e3=_0x4b54e3-0x0;var _0xcfc057=_0xc1c6[_0x4b54e3];return _0xcfc057;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x6c1c('0x7'));module['exports']=function(_0x50c1bb,_0x582bec){return _0x50c1bb[_0x6c1c('0x8')](_0x6c1c('0x9'),attributes,{'tableName':_0x6c1c('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 0010afb..eea49f5 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 _0xa2c8=['ServicenowAccount','options','attributes','limit','include','map','model','raw','where','ShowServicenowAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetServicenowAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2c8,0x175));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var moment=require('moment');var BPromise=require(_0x8a2c('0x2'));var rs=require(_0x8a2c('0x3'));var fs=require('fs');var Redis=require(_0x8a2c('0x4'));var db=require(_0x8a2c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a2c('0x6'))(_0x8a2c('0x7'));var config=require(_0x8a2c('0x8'));var jayson=require(_0x8a2c('0x9'));var client=jayson[_0x8a2c('0xa')][_0x8a2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d5e33,_0x51360b,_0x59673a){return new BPromise(function(_0x20d4be,_0x4fcd5e){return client['request'](_0x4d5e33,_0x59673a)[_0x8a2c('0xc')](function(_0x194487){logger[_0x8a2c('0xd')](_0x8a2c('0xe'),_0x51360b,_0x8a2c('0xf'));logger[_0x8a2c('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x51360b,_0x8a2c('0xf'),JSON[_0x8a2c('0x11')](_0x194487));if(_0x194487[_0x8a2c('0x12')]){if(_0x194487[_0x8a2c('0x12')][_0x8a2c('0x13')]===0x1f4){logger['error'](_0x8a2c('0xe'),_0x51360b,_0x194487[_0x8a2c('0x12')][_0x8a2c('0x14')]);return _0x4fcd5e(_0x194487['error'][_0x8a2c('0x14')]);}logger[_0x8a2c('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x51360b,_0x194487[_0x8a2c('0x12')][_0x8a2c('0x14')]);return _0x20d4be(_0x194487[_0x8a2c('0x12')][_0x8a2c('0x14')]);}else{logger[_0x8a2c('0xd')](_0x8a2c('0xe'),_0x51360b,_0x8a2c('0xf'));_0x20d4be(_0x194487['result'][_0x8a2c('0x14')]);}})[_0x8a2c('0x15')](function(_0x5f09c1){logger[_0x8a2c('0x12')](_0x8a2c('0xe'),_0x51360b,_0x5f09c1);_0x4fcd5e(_0x5f09c1);});});}exports[_0x8a2c('0x16')]=function(_0x5a8416){var _0x4a6e50=this;return new Promise(function(_0x2e7033,_0xcff8ed){return db[_0x8a2c('0x17')]['findAll']({'raw':_0x5a8416[_0x8a2c('0x18')]?_0x5a8416['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a8416[_0x8a2c('0x18')]?_0x5a8416['options']['where']||null:null,'attributes':_0x5a8416[_0x8a2c('0x18')]?_0x5a8416[_0x8a2c('0x18')][_0x8a2c('0x19')]||null:null,'limit':_0x5a8416[_0x8a2c('0x18')]?_0x5a8416[_0x8a2c('0x18')][_0x8a2c('0x1a')]||null:null,'include':_0x5a8416[_0x8a2c('0x18')]?_0x5a8416[_0x8a2c('0x18')][_0x8a2c('0x1b')]?_[_0x8a2c('0x1c')](_0x5a8416[_0x8a2c('0x18')][_0x8a2c('0x1b')],function(_0x5dee15){return{'model':db[_0x5dee15['model']],'as':_0x5dee15['as'],'attributes':_0x5dee15[_0x8a2c('0x19')],'include':_0x5dee15[_0x8a2c('0x1b')]?_[_0x8a2c('0x1c')](_0x5dee15[_0x8a2c('0x1b')],function(_0x128521){return{'model':db[_0x128521[_0x8a2c('0x1d')]],'as':_0x128521['as'],'attributes':_0x128521['attributes'],'include':_0x128521[_0x8a2c('0x1b')]?_['map'](_0x128521['include'],function(_0x3b92da){return{'model':db[_0x3b92da[_0x8a2c('0x1d')]],'as':_0x3b92da['as'],'attributes':_0x3b92da['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a2c('0xc')](function(_0x2cc653){logger[_0x8a2c('0xd')](_0x8a2c('0x16'),_0x5a8416);logger[_0x8a2c('0x10')](_0x8a2c('0x16'),_0x5a8416,JSON[_0x8a2c('0x11')](_0x2cc653));_0x2e7033(_0x2cc653);})[_0x8a2c('0x15')](function(_0x1b8612){logger[_0x8a2c('0x12')]('GetServicenowAccount',_0x1b8612[_0x8a2c('0x14')],_0x5a8416);_0xcff8ed(_0x4a6e50[_0x8a2c('0x12')](0x1f4,_0x1b8612[_0x8a2c('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x1249b7){var _0x11e2e6=this;return new Promise(function(_0x5bb448,_0x3d140c){return db[_0x8a2c('0x17')]['find']({'raw':_0x1249b7[_0x8a2c('0x18')]?_0x1249b7[_0x8a2c('0x18')][_0x8a2c('0x1e')]===undefined?!![]:![]:!![],'where':_0x1249b7[_0x8a2c('0x18')]?_0x1249b7[_0x8a2c('0x18')][_0x8a2c('0x1f')]||null:null,'attributes':_0x1249b7['options']?_0x1249b7[_0x8a2c('0x18')][_0x8a2c('0x19')]||null:null,'include':_0x1249b7[_0x8a2c('0x18')]?_0x1249b7[_0x8a2c('0x18')][_0x8a2c('0x1b')]?_[_0x8a2c('0x1c')](_0x1249b7[_0x8a2c('0x18')]['include'],function(_0x3a7d2e){return{'model':db[_0x3a7d2e[_0x8a2c('0x1d')]],'as':_0x3a7d2e['as'],'attributes':_0x3a7d2e[_0x8a2c('0x19')],'include':_0x3a7d2e[_0x8a2c('0x1b')]?_[_0x8a2c('0x1c')](_0x3a7d2e['include'],function(_0x461082){return{'model':db[_0x461082['model']],'as':_0x461082['as'],'attributes':_0x461082[_0x8a2c('0x19')],'include':_0x461082[_0x8a2c('0x1b')]?_[_0x8a2c('0x1c')](_0x461082[_0x8a2c('0x1b')],function(_0xb106cb){return{'model':db[_0xb106cb[_0x8a2c('0x1d')]],'as':_0xb106cb['as'],'attributes':_0xb106cb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3761ab){logger[_0x8a2c('0xd')]('ShowServicenowAccount',_0x1249b7);logger[_0x8a2c('0x10')](_0x8a2c('0x20'),_0x1249b7,JSON[_0x8a2c('0x11')](_0x3761ab));_0x5bb448(_0x3761ab);})['catch'](function(_0x4caf68){logger['error'](_0x8a2c('0x20'),_0x4caf68['message'],_0x1249b7);_0x3d140c(_0x11e2e6['error'](0x1f4,_0x4caf68[_0x8a2c('0x14')]));});});}; \ No newline at end of file +var _0xf569=['client','http','request','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','include','model','attributes','map','then','debug','catch','ShowServicenowAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x427740,_0x4868a0){var _0x541a9d=function(_0x195c11){while(--_0x195c11){_0x427740['push'](_0x427740['shift']());}};_0x541a9d(++_0x4868a0);}(_0xf569,0x86));var _0x9f56=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xf569[_0x1a9204];return _0x17ca68;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var moment=require(_0x9f56('0x1'));var BPromise=require(_0x9f56('0x2'));var rs=require(_0x9f56('0x3'));var fs=require('fs');var Redis=require(_0x9f56('0x4'));var db=require(_0x9f56('0x5'))['db'];var utils=require(_0x9f56('0x6'));var logger=require('../../config/logger')(_0x9f56('0x7'));var config=require(_0x9f56('0x8'));var jayson=require(_0x9f56('0x9'));var client=jayson[_0x9f56('0xa')][_0x9f56('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19b326,_0x3fd106,_0x34fb61){return new BPromise(function(_0x4d44ea,_0x1d3674){return client[_0x9f56('0xc')](_0x19b326,_0x34fb61)['then'](function(_0x2015f1){logger[_0x9f56('0xd')](_0x9f56('0xe'),_0x3fd106,'request\x20sent');logger['debug'](_0x9f56('0xf'),_0x3fd106,_0x9f56('0x10'),JSON[_0x9f56('0x11')](_0x2015f1));if(_0x2015f1[_0x9f56('0x12')]){if(_0x2015f1[_0x9f56('0x12')][_0x9f56('0x13')]===0x1f4){logger['error'](_0x9f56('0xe'),_0x3fd106,_0x2015f1[_0x9f56('0x12')][_0x9f56('0x14')]);return _0x1d3674(_0x2015f1[_0x9f56('0x12')][_0x9f56('0x14')]);}logger[_0x9f56('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x3fd106,_0x2015f1['error'][_0x9f56('0x14')]);return _0x4d44ea(_0x2015f1[_0x9f56('0x12')]['message']);}else{logger[_0x9f56('0xd')](_0x9f56('0xe'),_0x3fd106,_0x9f56('0x10'));_0x4d44ea(_0x2015f1[_0x9f56('0x15')][_0x9f56('0x14')]);}})['catch'](function(_0x17db0b){logger[_0x9f56('0x12')](_0x9f56('0xe'),_0x3fd106,_0x17db0b);_0x1d3674(_0x17db0b);});});}exports[_0x9f56('0x16')]=function(_0x45a07c){var _0x213619=this;return new Promise(function(_0x31273e,_0x4b5b75){return db[_0x9f56('0x17')][_0x9f56('0x18')]({'raw':_0x45a07c[_0x9f56('0x19')]?_0x45a07c[_0x9f56('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x45a07c[_0x9f56('0x19')]?_0x45a07c[_0x9f56('0x19')]['where']||null:null,'attributes':_0x45a07c[_0x9f56('0x19')]?_0x45a07c[_0x9f56('0x19')]['attributes']||null:null,'limit':_0x45a07c['options']?_0x45a07c[_0x9f56('0x19')]['limit']||null:null,'include':_0x45a07c[_0x9f56('0x19')]?_0x45a07c[_0x9f56('0x19')][_0x9f56('0x1a')]?_['map'](_0x45a07c['options'][_0x9f56('0x1a')],function(_0xfee9ab){return{'model':db[_0xfee9ab[_0x9f56('0x1b')]],'as':_0xfee9ab['as'],'attributes':_0xfee9ab[_0x9f56('0x1c')],'include':_0xfee9ab[_0x9f56('0x1a')]?_[_0x9f56('0x1d')](_0xfee9ab[_0x9f56('0x1a')],function(_0x203e42){return{'model':db[_0x203e42[_0x9f56('0x1b')]],'as':_0x203e42['as'],'attributes':_0x203e42[_0x9f56('0x1c')],'include':_0x203e42[_0x9f56('0x1a')]?_[_0x9f56('0x1d')](_0x203e42['include'],function(_0x3c0bf9){return{'model':db[_0x3c0bf9[_0x9f56('0x1b')]],'as':_0x3c0bf9['as'],'attributes':_0x3c0bf9[_0x9f56('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9f56('0x1e')](function(_0x90e4cb){logger[_0x9f56('0xd')](_0x9f56('0x16'),_0x45a07c);logger[_0x9f56('0x1f')]('GetServicenowAccount',_0x45a07c,JSON[_0x9f56('0x11')](_0x90e4cb));_0x31273e(_0x90e4cb);})[_0x9f56('0x20')](function(_0x1ffa49){logger[_0x9f56('0x12')](_0x9f56('0x16'),_0x1ffa49[_0x9f56('0x14')],_0x45a07c);_0x4b5b75(_0x213619[_0x9f56('0x12')](0x1f4,_0x1ffa49[_0x9f56('0x14')]));});});};exports[_0x9f56('0x21')]=function(_0x2432ca){var _0x31c128=this;return new Promise(function(_0x4bca9a,_0x183e2c){return db[_0x9f56('0x17')][_0x9f56('0x22')]({'raw':_0x2432ca[_0x9f56('0x19')]?_0x2432ca['options'][_0x9f56('0x23')]===undefined?!![]:![]:!![],'where':_0x2432ca[_0x9f56('0x19')]?_0x2432ca[_0x9f56('0x19')]['where']||null:null,'attributes':_0x2432ca[_0x9f56('0x19')]?_0x2432ca[_0x9f56('0x19')][_0x9f56('0x1c')]||null:null,'include':_0x2432ca[_0x9f56('0x19')]?_0x2432ca[_0x9f56('0x19')][_0x9f56('0x1a')]?_['map'](_0x2432ca[_0x9f56('0x19')][_0x9f56('0x1a')],function(_0x421f9e){return{'model':db[_0x421f9e[_0x9f56('0x1b')]],'as':_0x421f9e['as'],'attributes':_0x421f9e[_0x9f56('0x1c')],'include':_0x421f9e['include']?_[_0x9f56('0x1d')](_0x421f9e['include'],function(_0x599a96){return{'model':db[_0x599a96['model']],'as':_0x599a96['as'],'attributes':_0x599a96['attributes'],'include':_0x599a96[_0x9f56('0x1a')]?_[_0x9f56('0x1d')](_0x599a96[_0x9f56('0x1a')],function(_0x2705bb){return{'model':db[_0x2705bb[_0x9f56('0x1b')]],'as':_0x2705bb['as'],'attributes':_0x2705bb[_0x9f56('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9f56('0x1e')](function(_0x7f4437){logger[_0x9f56('0xd')](_0x9f56('0x21'),_0x2432ca);logger[_0x9f56('0x1f')](_0x9f56('0x21'),_0x2432ca,JSON[_0x9f56('0x11')](_0x7f4437));_0x4bca9a(_0x7f4437);})[_0x9f56('0x20')](function(_0x43a5d2){logger[_0x9f56('0x12')]('ShowServicenowAccount',_0x43a5d2[_0x9f56('0x14')],_0x2432ca);_0x183e2c(_0x31c128[_0x9f56('0x12')](0x1f4,_0x43a5d2[_0x9f56('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index f433502..864ad59 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 _0xf9fc=['create','put','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x417e0a,_0x446db8){var _0x223dab=function(_0x56978c){while(--_0x56978c){_0x417e0a['push'](_0x417e0a['shift']());}};_0x223dab(++_0x446db8);}(_0xf9fc,0x15e));var _0xcf9f=function(_0x4ac15d,_0x48732e){_0x4ac15d=_0x4ac15d-0x0;var _0x356e10=_0xf9fc[_0x4ac15d];return _0x356e10;};'use strict';var multer=require(_0xcf9f('0x0'));var util=require('util');var path=require(_0xcf9f('0x1'));var timeout=require(_0xcf9f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcf9f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcf9f('0x4'));var config=require(_0xcf9f('0x5'));var controller=require(_0xcf9f('0x6'));router[_0xcf9f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcf9f('0x8'),auth[_0xcf9f('0x9')](),controller[_0xcf9f('0xa')]);router[_0xcf9f('0x7')](_0xcf9f('0xb'),auth[_0xcf9f('0x9')](),controller[_0xcf9f('0xc')]);router[_0xcf9f('0x7')](_0xcf9f('0xd'),auth[_0xcf9f('0x9')](),controller[_0xcf9f('0xe')]);router[_0xcf9f('0x7')](_0xcf9f('0xf'),auth[_0xcf9f('0x9')](),controller[_0xcf9f('0x10')]);router[_0xcf9f('0x11')]('/',auth[_0xcf9f('0x9')](),controller[_0xcf9f('0x12')]);router[_0xcf9f('0x13')](_0xcf9f('0x8'),auth[_0xcf9f('0x9')](),controller[_0xcf9f('0x14')]);router[_0xcf9f('0x15')](_0xcf9f('0x8'),auth[_0xcf9f('0x9')](),controller['destroy']);module[_0xcf9f('0x16')]=router; \ No newline at end of file +var _0x4670=['./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getDescriptions','post','create','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4883cb,_0x3df63c){var _0x33aad7=function(_0x2e901e){while(--_0x2e901e){_0x4883cb['push'](_0x4883cb['shift']());}};_0x33aad7(++_0x3df63c);}(_0x4670,0x189));var _0x0467=function(_0x429bb5,_0x5783d9){_0x429bb5=_0x429bb5-0x0;var _0x510ea9=_0x4670[_0x429bb5];return _0x510ea9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0467('0x0'));var timeout=require(_0x0467('0x1'));var express=require('express');var router=express[_0x0467('0x2')]();var fs_extra=require(_0x0467('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0467('0x4'));var config=require(_0x0467('0x5'));var controller=require(_0x0467('0x6'));router[_0x0467('0x7')]('/',auth['isAuthenticated'](),controller[_0x0467('0x8')]);router['get'](_0x0467('0x9'),auth[_0x0467('0xa')](),controller[_0x0467('0xb')]);router['get'](_0x0467('0xc'),auth[_0x0467('0xa')](),controller['getFields']);router[_0x0467('0x7')](_0x0467('0xd'),auth[_0x0467('0xa')](),controller['getSubjects']);router[_0x0467('0x7')]('/:id/descriptions',auth[_0x0467('0xa')](),controller[_0x0467('0xe')]);router[_0x0467('0xf')]('/',auth[_0x0467('0xa')](),controller[_0x0467('0x10')]);router['put'](_0x0467('0x9'),auth[_0x0467('0xa')](),controller[_0x0467('0x11')]);router[_0x0467('0x12')](_0x0467('0x9'),auth[_0x0467('0xa')](),controller[_0x0467('0x13')]);module[_0x0467('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 9e4d8cb..ddf5ecd 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 _0xc9b0=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9b0,0x108));var _0x0c9b=function(_0xb2eec4,_0x53fa83){_0xb2eec4=_0xb2eec4-0x0;var _0x5bc476=_0xc9b0[_0xb2eec4];return _0x5bc476;};'use strict';var Sequelize=require(_0x0c9b('0x0'));module[_0x0c9b('0x1')]={'name':{'type':Sequelize[_0x0c9b('0x2')]},'description':{'type':Sequelize[_0x0c9b('0x2')]}}; \ No newline at end of file +var _0xf70a=['sequelize','STRING'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xf70a,0x1b2));var _0xaf70=function(_0x12a5ac,_0x4cb0d2){_0x12a5ac=_0x12a5ac-0x0;var _0x282958=_0xf70a[_0x12a5ac];return _0x282958;};'use strict';var Sequelize=require(_0xaf70('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaf70('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 97cd014..875b621 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 _0xa64a=['then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','ServicenowConfiguration','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','findOne','ServicenowField','rawAttributes','filter','getFields','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update'];(function(_0x14d6bb,_0x388b8e){var _0x191d22=function(_0x32ac70){while(--_0x32ac70){_0x14d6bb['push'](_0x14d6bb['shift']());}};_0x191d22(++_0x388b8e);}(_0xa64a,0xce));var _0xaa64=function(_0x247197,_0x47981b){_0x247197=_0x247197-0x0;var _0x187a6f=_0xa64a[_0x247197];return _0x187a6f;};'use strict';var emlformat=require(_0xaa64('0x0'));var rimraf=require(_0xaa64('0x1'));var zipdir=require(_0xaa64('0x2'));var jsonpatch=require(_0xaa64('0x3'));var rp=require(_0xaa64('0x4'));var moment=require(_0xaa64('0x5'));var BPromise=require(_0xaa64('0x6'));var Mustache=require(_0xaa64('0x7'));var util=require(_0xaa64('0x8'));var path=require(_0xaa64('0x9'));var sox=require(_0xaa64('0xa'));var csv=require(_0xaa64('0xb'));var ejs=require(_0xaa64('0xc'));var fs=require('fs');var fs_extra=require(_0xaa64('0xd'));var _=require(_0xaa64('0xe'));var squel=require(_0xaa64('0xf'));var crypto=require('crypto');var jsforce=require(_0xaa64('0x10'));var deskjs=require(_0xaa64('0x11'));var toCsv=require(_0xaa64('0xb'));var querystring=require('querystring');var Papa=require(_0xaa64('0x12'));var Redis=require('ioredis');var authService=require(_0xaa64('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaa64('0x14'));var hardwareService=require(_0xaa64('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xaa64('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa64('0x17'))['db'];function respondWithStatusCode(_0xd3fcfc,_0x5f4f8a){_0x5f4f8a=_0x5f4f8a||0xcc;return function(_0x2940db){if(_0x2940db){return _0xd3fcfc[_0xaa64('0x18')](_0x5f4f8a);}return _0xd3fcfc['status'](_0x5f4f8a)[_0xaa64('0x19')]();};}function respondWithResult(_0x375092,_0xd48d66){_0xd48d66=_0xd48d66||0xc8;return function(_0x5213b6){if(_0x5213b6){return _0x375092[_0xaa64('0x1a')](_0xd48d66)[_0xaa64('0x1b')](_0x5213b6);}};}function respondWithFilteredResult(_0x1d075d,_0x2a514b){return function(_0x1a927){if(_0x1a927){var _0x3106b0=typeof _0x2a514b[_0xaa64('0x1c')]===_0xaa64('0x1d')&&typeof _0x2a514b['limit']===_0xaa64('0x1d');var _0x2cee62=_0x1a927[_0xaa64('0x1e')];var _0x528ba4=_0x3106b0?0x0:_0x2a514b[_0xaa64('0x1c')];var _0x41ea0a=_0x3106b0?_0x1a927[_0xaa64('0x1e')]:_0x2a514b[_0xaa64('0x1c')]+_0x2a514b[_0xaa64('0x1f')];var _0x1a4d22;if(_0x41ea0a>=_0x2cee62){_0x41ea0a=_0x2cee62;_0x1a4d22=0xc8;}else{_0x1a4d22=0xce;}_0x1d075d[_0xaa64('0x1a')](_0x1a4d22);return _0x1d075d[_0xaa64('0x20')](_0xaa64('0x21'),_0x528ba4+'-'+_0x41ea0a+'/'+_0x2cee62)['json'](_0x1a927);}return null;};}function patchUpdates(_0x201062){return function(_0x4987db){try{jsonpatch['apply'](_0x4987db,_0x201062,!![]);}catch(_0x204b52){return BPromise[_0xaa64('0x22')](_0x204b52);}return _0x4987db[_0xaa64('0x23')]();};}function saveUpdates(_0x3f6ac0,_0x9e6524){return function(_0x1a344f){if(_0x1a344f){return _0x1a344f[_0xaa64('0x24')](_0x3f6ac0)[_0xaa64('0x25')](function(_0x5e8ffc){return _0x5e8ffc;});}return null;};}function removeEntity(_0x52cb5a,_0x3eaacd){return function(_0x42049e){if(_0x42049e){return _0x42049e['destroy']()[_0xaa64('0x25')](function(){_0x52cb5a[_0xaa64('0x1a')](0xcc)[_0xaa64('0x19')]();});}};}function handleEntityNotFound(_0xa38b45,_0x2e4240){return function(_0x1f167f){if(!_0x1f167f){_0xa38b45['sendStatus'](0x194);}return _0x1f167f;};}function handleError(_0x56de8b,_0x59f113){_0x59f113=_0x59f113||0x1f4;return function(_0x35f846){logger[_0xaa64('0x26')](_0x35f846[_0xaa64('0x27')]);if(_0x35f846[_0xaa64('0x28')]){delete _0x35f846[_0xaa64('0x28')];}_0x56de8b[_0xaa64('0x1a')](_0x59f113)[_0xaa64('0x29')](_0x35f846);};}exports[_0xaa64('0x2a')]=function(_0x308ecc,_0x886f52){var _0xf4fcc9={},_0x129f66={},_0x13f7b9={'count':0x0,'rows':[]};var _0x311780=_[_0xaa64('0x2b')](db['ServicenowConfiguration']['rawAttributes'],function(_0x41f58e){return{'name':_0x41f58e[_0xaa64('0x2c')],'type':_0x41f58e[_0xaa64('0x2d')][_0xaa64('0x2e')]};});_0x129f66[_0xaa64('0x2f')]=_[_0xaa64('0x2b')](_0x311780,_0xaa64('0x28'));_0x129f66[_0xaa64('0x30')]=_['keys'](_0x308ecc[_0xaa64('0x30')]);_0x129f66[_0xaa64('0x31')]=_[_0xaa64('0x32')](_0x129f66[_0xaa64('0x2f')],_0x129f66[_0xaa64('0x30')]);_0xf4fcc9[_0xaa64('0x33')]=_[_0xaa64('0x32')](_0x129f66[_0xaa64('0x2f')],qs[_0xaa64('0x34')](_0x308ecc[_0xaa64('0x30')]['fields']));_0xf4fcc9[_0xaa64('0x33')]=_0xf4fcc9[_0xaa64('0x33')][_0xaa64('0x35')]?_0xf4fcc9[_0xaa64('0x33')]:_0x129f66['model'];if(!_0x308ecc[_0xaa64('0x30')]['hasOwnProperty'](_0xaa64('0x36'))){_0xf4fcc9[_0xaa64('0x1f')]=qs[_0xaa64('0x1f')](_0x308ecc[_0xaa64('0x30')][_0xaa64('0x1f')]);_0xf4fcc9[_0xaa64('0x1c')]=qs['offset'](_0x308ecc[_0xaa64('0x30')][_0xaa64('0x1c')]);}_0xf4fcc9[_0xaa64('0x37')]=qs[_0xaa64('0x38')](_0x308ecc[_0xaa64('0x30')]['sort']);_0xf4fcc9[_0xaa64('0x39')]=qs[_0xaa64('0x31')](_[_0xaa64('0x3a')](_0x308ecc[_0xaa64('0x30')],_0x129f66[_0xaa64('0x31')]),_0x311780);if(_0x308ecc[_0xaa64('0x30')]['filter']){_0xf4fcc9['where']=_[_0xaa64('0x3b')](_0xf4fcc9[_0xaa64('0x39')],{'$or':_[_0xaa64('0x2b')](_0x311780,function(_0x29e5e7){if(_0x29e5e7['type']!=='VIRTUAL'){var _0x36f583={};_0x36f583[_0x29e5e7[_0xaa64('0x28')]]={'$like':'%'+_0x308ecc['query']['filter']+'%'};return _0x36f583;}})});}_0xf4fcc9=_[_0xaa64('0x3b')]({},_0xf4fcc9,_0x308ecc[_0xaa64('0x3c')]);var _0x48f754={'where':_0xf4fcc9[_0xaa64('0x39')]};return db[_0xaa64('0x3d')][_0xaa64('0x1e')](_0x48f754)[_0xaa64('0x25')](function(_0x1fff44){_0x13f7b9[_0xaa64('0x1e')]=_0x1fff44;if(_0x308ecc[_0xaa64('0x30')][_0xaa64('0x3e')]){_0xf4fcc9[_0xaa64('0x3f')]=[{'all':!![]}];}return db[_0xaa64('0x3d')]['findAll'](_0xf4fcc9);})[_0xaa64('0x25')](function(_0x523364){_0x13f7b9[_0xaa64('0x40')]=_0x523364;return _0x13f7b9;})[_0xaa64('0x25')](respondWithFilteredResult(_0x886f52,_0xf4fcc9))[_0xaa64('0x41')](handleError(_0x886f52,null));};exports[_0xaa64('0x42')]=function(_0x307527,_0xdc9caa){var _0x3e05e1={'raw':![],'where':{'id':_0x307527[_0xaa64('0x43')]['id']}},_0x59c9dd={};_0x59c9dd['model']=_['keys'](db[_0xaa64('0x3d')]['rawAttributes']);_0x59c9dd[_0xaa64('0x30')]=_[_0xaa64('0x44')](_0x307527[_0xaa64('0x30')]);_0x59c9dd[_0xaa64('0x31')]=_[_0xaa64('0x32')](_0x59c9dd[_0xaa64('0x2f')],_0x59c9dd[_0xaa64('0x30')]);_0x3e05e1[_0xaa64('0x33')]=_['intersection'](_0x59c9dd['model'],qs[_0xaa64('0x34')](_0x307527[_0xaa64('0x30')][_0xaa64('0x34')]));_0x3e05e1[_0xaa64('0x33')]=_0x3e05e1[_0xaa64('0x33')]['length']?_0x3e05e1['attributes']:_0x59c9dd[_0xaa64('0x2f')];if(_0x307527[_0xaa64('0x30')][_0xaa64('0x3e')]){_0x3e05e1[_0xaa64('0x3f')]=[{'all':!![]}];}_0x3e05e1=_[_0xaa64('0x3b')]({},_0x3e05e1,_0x307527['options']);return db[_0xaa64('0x3d')][_0xaa64('0x45')](_0x3e05e1)[_0xaa64('0x25')](handleEntityNotFound(_0xdc9caa,null))[_0xaa64('0x25')](respondWithResult(_0xdc9caa,null))['catch'](handleError(_0xdc9caa,null));};exports[_0xaa64('0x46')]=function(_0x490ac6,_0x241954){return db['ServicenowConfiguration'][_0xaa64('0x46')](_0x490ac6['body'],{})[_0xaa64('0x25')](respondWithResult(_0x241954,0xc9))['catch'](handleError(_0x241954,null));};exports[_0xaa64('0x24')]=function(_0x1a5049,_0x2fad2e){if(_0x1a5049[_0xaa64('0x47')]['id']){delete _0x1a5049[_0xaa64('0x47')]['id'];}return db[_0xaa64('0x3d')][_0xaa64('0x45')]({'where':{'id':_0x1a5049['params']['id']}})['then'](handleEntityNotFound(_0x2fad2e,null))[_0xaa64('0x25')](saveUpdates(_0x1a5049[_0xaa64('0x47')],null))[_0xaa64('0x25')](respondWithResult(_0x2fad2e,null))[_0xaa64('0x41')](handleError(_0x2fad2e,null));};exports[_0xaa64('0x48')]=function(_0x27e2ef,_0x4215e5){return db[_0xaa64('0x3d')][_0xaa64('0x45')]({'where':{'id':_0x27e2ef[_0xaa64('0x43')]['id']}})[_0xaa64('0x25')](handleEntityNotFound(_0x4215e5,null))['then'](removeEntity(_0x4215e5,null))['catch'](handleError(_0x4215e5,null));};exports['getFields']=function(_0x478c3e,_0x3dd806,_0x24944b){var _0x40033a={};var _0x6ecd34={};var _0x5aef50;var _0x222001;return db['ServicenowConfiguration'][_0xaa64('0x49')]({'where':{'id':_0x478c3e[_0xaa64('0x43')]['id']}})[_0xaa64('0x25')](handleEntityNotFound(_0x3dd806,null))[_0xaa64('0x25')](function(_0x1afdd1){if(_0x1afdd1){_0x5aef50=_0x1afdd1;_0x6ecd34['model']=_[_0xaa64('0x44')](db[_0xaa64('0x4a')][_0xaa64('0x4b')]);_0x6ecd34[_0xaa64('0x30')]=_[_0xaa64('0x44')](_0x478c3e[_0xaa64('0x30')]);_0x6ecd34['filters']=_[_0xaa64('0x32')](_0x6ecd34[_0xaa64('0x2f')],_0x6ecd34[_0xaa64('0x30')]);_0x40033a['attributes']=_[_0xaa64('0x32')](_0x6ecd34[_0xaa64('0x2f')],qs[_0xaa64('0x34')](_0x478c3e[_0xaa64('0x30')][_0xaa64('0x34')]));_0x40033a[_0xaa64('0x33')]=_0x40033a['attributes']['length']?_0x40033a[_0xaa64('0x33')]:_0x6ecd34[_0xaa64('0x2f')];_0x40033a[_0xaa64('0x37')]=qs[_0xaa64('0x38')](_0x478c3e['query']['sort']);_0x40033a[_0xaa64('0x39')]=qs[_0xaa64('0x31')](_[_0xaa64('0x3a')](_0x478c3e['query'],_0x6ecd34[_0xaa64('0x31')]));if(_0x478c3e[_0xaa64('0x30')][_0xaa64('0x4c')]){_0x40033a['where']=_[_0xaa64('0x3b')](_0x40033a['where'],{'$or':_['map'](_0x40033a[_0xaa64('0x33')],function(_0x444247){var _0x53f6ed={};_0x53f6ed[_0x444247]={'$like':'%'+_0x478c3e[_0xaa64('0x30')][_0xaa64('0x4c')]+'%'};return _0x53f6ed;})});}_0x40033a=_['merge']({},_0x40033a,_0x478c3e[_0xaa64('0x3c')]);return _0x5aef50[_0xaa64('0x4d')](_0x40033a);}})[_0xaa64('0x25')](function(_0x11b809){if(_0x11b809){_0x222001=_0x11b809[_0xaa64('0x35')];if(!_0x478c3e[_0xaa64('0x30')]['hasOwnProperty'](_0xaa64('0x36'))){_0x40033a[_0xaa64('0x1f')]=qs[_0xaa64('0x1f')](_0x478c3e[_0xaa64('0x30')]['limit']);_0x40033a[_0xaa64('0x1c')]=qs['offset'](_0x478c3e[_0xaa64('0x30')]['offset']);}return _0x5aef50[_0xaa64('0x4d')](_0x40033a);}})[_0xaa64('0x25')](function(_0xbe52a4){if(_0xbe52a4){return _0xbe52a4?{'count':_0x222001,'rows':_0xbe52a4}:null;}})[_0xaa64('0x25')](respondWithResult(_0x3dd806,null))['catch'](handleError(_0x3dd806,null));};exports[_0xaa64('0x4e')]=function(_0x500b35,_0x24d055,_0x2d648a){var _0x5588bb={};var _0x592b7f={};var _0x21a5f3;var _0x51cd62;return db[_0xaa64('0x3d')][_0xaa64('0x49')]({'where':{'id':_0x500b35[_0xaa64('0x43')]['id']}})[_0xaa64('0x25')](handleEntityNotFound(_0x24d055,null))[_0xaa64('0x25')](function(_0x32be5f){if(_0x32be5f){_0x21a5f3=_0x32be5f;_0x592b7f[_0xaa64('0x2f')]=_[_0xaa64('0x44')](db[_0xaa64('0x4a')][_0xaa64('0x4b')]);_0x592b7f[_0xaa64('0x30')]=_[_0xaa64('0x44')](_0x500b35[_0xaa64('0x30')]);_0x592b7f[_0xaa64('0x31')]=_['intersection'](_0x592b7f[_0xaa64('0x2f')],_0x592b7f[_0xaa64('0x30')]);_0x5588bb[_0xaa64('0x33')]=_[_0xaa64('0x32')](_0x592b7f[_0xaa64('0x2f')],qs[_0xaa64('0x34')](_0x500b35[_0xaa64('0x30')]['fields']));_0x5588bb[_0xaa64('0x33')]=_0x5588bb[_0xaa64('0x33')][_0xaa64('0x35')]?_0x5588bb[_0xaa64('0x33')]:_0x592b7f['model'];_0x5588bb['order']=qs[_0xaa64('0x38')](_0x500b35[_0xaa64('0x30')][_0xaa64('0x38')]);_0x5588bb[_0xaa64('0x39')]=qs[_0xaa64('0x31')](_[_0xaa64('0x3a')](_0x500b35[_0xaa64('0x30')],_0x592b7f[_0xaa64('0x31')]));if(_0x500b35[_0xaa64('0x30')]['filter']){_0x5588bb[_0xaa64('0x39')]=_['merge'](_0x5588bb[_0xaa64('0x39')],{'$or':_[_0xaa64('0x2b')](_0x5588bb[_0xaa64('0x33')],function(_0xd08e8c){var _0x5d3f00={};_0x5d3f00[_0xd08e8c]={'$like':'%'+_0x500b35[_0xaa64('0x30')][_0xaa64('0x4c')]+'%'};return _0x5d3f00;})});}_0x5588bb=_[_0xaa64('0x3b')]({},_0x5588bb,_0x500b35[_0xaa64('0x3c')]);return _0x21a5f3[_0xaa64('0x4e')](_0x5588bb);}})[_0xaa64('0x25')](function(_0x2aff19){if(_0x2aff19){_0x51cd62=_0x2aff19[_0xaa64('0x35')];if(!_0x500b35['query']['hasOwnProperty'](_0xaa64('0x36'))){_0x5588bb[_0xaa64('0x1f')]=qs[_0xaa64('0x1f')](_0x500b35['query'][_0xaa64('0x1f')]);_0x5588bb['offset']=qs[_0xaa64('0x1c')](_0x500b35[_0xaa64('0x30')][_0xaa64('0x1c')]);}return _0x21a5f3['getSubjects'](_0x5588bb);}})[_0xaa64('0x25')](function(_0x437ea2){if(_0x437ea2){return _0x437ea2?{'count':_0x51cd62,'rows':_0x437ea2}:null;}})[_0xaa64('0x25')](respondWithResult(_0x24d055,null))[_0xaa64('0x41')](handleError(_0x24d055,null));};exports[_0xaa64('0x4f')]=function(_0x292dd0,_0x177590,_0xa86bff){var _0x4fe509={};var _0x2a385d={};var _0x36701e;var _0x38dd35;return db[_0xaa64('0x3d')]['findOne']({'where':{'id':_0x292dd0[_0xaa64('0x43')]['id']}})[_0xaa64('0x25')](handleEntityNotFound(_0x177590,null))[_0xaa64('0x25')](function(_0x2dcade){if(_0x2dcade){_0x36701e=_0x2dcade;_0x2a385d['model']=_[_0xaa64('0x44')](db[_0xaa64('0x4a')][_0xaa64('0x4b')]);_0x2a385d['query']=_[_0xaa64('0x44')](_0x292dd0[_0xaa64('0x30')]);_0x2a385d[_0xaa64('0x31')]=_['intersection'](_0x2a385d[_0xaa64('0x2f')],_0x2a385d['query']);_0x4fe509['attributes']=_[_0xaa64('0x32')](_0x2a385d[_0xaa64('0x2f')],qs['fields'](_0x292dd0[_0xaa64('0x30')]['fields']));_0x4fe509[_0xaa64('0x33')]=_0x4fe509[_0xaa64('0x33')][_0xaa64('0x35')]?_0x4fe509[_0xaa64('0x33')]:_0x2a385d['model'];_0x4fe509[_0xaa64('0x37')]=qs['sort'](_0x292dd0[_0xaa64('0x30')][_0xaa64('0x38')]);_0x4fe509[_0xaa64('0x39')]=qs[_0xaa64('0x31')](_[_0xaa64('0x3a')](_0x292dd0['query'],_0x2a385d['filters']));if(_0x292dd0[_0xaa64('0x30')][_0xaa64('0x4c')]){_0x4fe509[_0xaa64('0x39')]=_['merge'](_0x4fe509[_0xaa64('0x39')],{'$or':_[_0xaa64('0x2b')](_0x4fe509[_0xaa64('0x33')],function(_0x1ec51f){var _0x156ccd={};_0x156ccd[_0x1ec51f]={'$like':'%'+_0x292dd0[_0xaa64('0x30')][_0xaa64('0x4c')]+'%'};return _0x156ccd;})});}_0x4fe509=_[_0xaa64('0x3b')]({},_0x4fe509,_0x292dd0[_0xaa64('0x3c')]);return _0x36701e[_0xaa64('0x4f')](_0x4fe509);}})['then'](function(_0x361032){if(_0x361032){_0x38dd35=_0x361032[_0xaa64('0x35')];if(!_0x292dd0[_0xaa64('0x30')][_0xaa64('0x50')](_0xaa64('0x36'))){_0x4fe509[_0xaa64('0x1f')]=qs[_0xaa64('0x1f')](_0x292dd0['query'][_0xaa64('0x1f')]);_0x4fe509[_0xaa64('0x1c')]=qs[_0xaa64('0x1c')](_0x292dd0[_0xaa64('0x30')][_0xaa64('0x1c')]);}return _0x36701e['getDescriptions'](_0x4fe509);}})[_0xaa64('0x25')](function(_0x4e1c7c){if(_0x4e1c7c){return _0x4e1c7c?{'count':_0x38dd35,'rows':_0x4e1c7c}:null;}})[_0xaa64('0x25')](respondWithResult(_0x177590,null))[_0xaa64('0x41')](handleError(_0x177590,null));}; \ No newline at end of file +var _0x27de=['index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','keys','fields','includeAll','update','find','destroy','getFields','findOne','options','ServicenowField','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','end','name','send'];(function(_0x81c724,_0x1042a8){var _0x13e49a=function(_0x59a4ea){while(--_0x59a4ea){_0x81c724['push'](_0x81c724['shift']());}};_0x13e49a(++_0x1042a8);}(_0x27de,0x108));var _0xe27d=function(_0x2a6885,_0xe5b68e){_0x2a6885=_0x2a6885-0x0;var _0x30e958=_0x27de[_0x2a6885];return _0x30e958;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe27d('0x0'));var zipdir=require(_0xe27d('0x1'));var jsonpatch=require(_0xe27d('0x2'));var rp=require(_0xe27d('0x3'));var moment=require(_0xe27d('0x4'));var BPromise=require(_0xe27d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe27d('0x6'));var sox=require(_0xe27d('0x7'));var csv=require(_0xe27d('0x8'));var ejs=require(_0xe27d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe27d('0xa'));var squel=require('squel');var crypto=require(_0xe27d('0xb'));var jsforce=require(_0xe27d('0xc'));var deskjs=require(_0xe27d('0xd'));var toCsv=require(_0xe27d('0x8'));var querystring=require(_0xe27d('0xe'));var Papa=require(_0xe27d('0xf'));var Redis=require(_0xe27d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe27d('0x11'));var hardwareService=require(_0xe27d('0x12'));var logger=require('../../config/logger')(_0xe27d('0x13'));var utils=require(_0xe27d('0x14'));var config=require(_0xe27d('0x15'));var licenseUtil=require(_0xe27d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe1d0,_0x5c2525){_0x5c2525=_0x5c2525||0xcc;return function(_0x14156f){if(_0x14156f){return _0x3fe1d0['sendStatus'](_0x5c2525);}return _0x3fe1d0[_0xe27d('0x17')](_0x5c2525)['end']();};}function respondWithResult(_0x3465cb,_0x1918a2){_0x1918a2=_0x1918a2||0xc8;return function(_0x13dbc1){if(_0x13dbc1){return _0x3465cb[_0xe27d('0x17')](_0x1918a2)[_0xe27d('0x18')](_0x13dbc1);}};}function respondWithFilteredResult(_0x16e5ae,_0x392da2){return function(_0xcd2905){if(_0xcd2905){var _0x1fbd56=typeof _0x392da2[_0xe27d('0x19')]===_0xe27d('0x1a')&&typeof _0x392da2[_0xe27d('0x1b')]===_0xe27d('0x1a');var _0x20f743=_0xcd2905[_0xe27d('0x1c')];var _0x2939b0=_0x1fbd56?0x0:_0x392da2[_0xe27d('0x19')];var _0x129b0c=_0x1fbd56?_0xcd2905['count']:_0x392da2[_0xe27d('0x19')]+_0x392da2['limit'];var _0x22e1e4;if(_0x129b0c>=_0x20f743){_0x129b0c=_0x20f743;_0x22e1e4=0xc8;}else{_0x22e1e4=0xce;}_0x16e5ae['status'](_0x22e1e4);return _0x16e5ae['set'](_0xe27d('0x1d'),_0x2939b0+'-'+_0x129b0c+'/'+_0x20f743)[_0xe27d('0x18')](_0xcd2905);}return null;};}function patchUpdates(_0x254c2f){return function(_0x299776){try{jsonpatch[_0xe27d('0x1e')](_0x299776,_0x254c2f,!![]);}catch(_0x16477c){return BPromise['reject'](_0x16477c);}return _0x299776[_0xe27d('0x1f')]();};}function saveUpdates(_0x3fc780,_0xbf6fa){return function(_0x170036){if(_0x170036){return _0x170036['update'](_0x3fc780)[_0xe27d('0x20')](function(_0x49dc3a){return _0x49dc3a;});}return null;};}function removeEntity(_0x57a53d,_0x4a0a17){return function(_0x162f23){if(_0x162f23){return _0x162f23['destroy']()[_0xe27d('0x20')](function(){_0x57a53d[_0xe27d('0x17')](0xcc)[_0xe27d('0x21')]();});}};}function handleEntityNotFound(_0xef1724,_0x4fb9bd){return function(_0x3dfab7){if(!_0x3dfab7){_0xef1724['sendStatus'](0x194);}return _0x3dfab7;};}function handleError(_0x4ce411,_0x2ca7e1){_0x2ca7e1=_0x2ca7e1||0x1f4;return function(_0x2de23c){logger['error'](_0x2de23c['stack']);if(_0x2de23c[_0xe27d('0x22')]){delete _0x2de23c[_0xe27d('0x22')];}_0x4ce411[_0xe27d('0x17')](_0x2ca7e1)[_0xe27d('0x23')](_0x2de23c);};}exports[_0xe27d('0x24')]=function(_0x527f8e,_0x469474){var _0xd36dd4={},_0x240aa3={},_0x1095f7={'count':0x0,'rows':[]};var _0x7dcfb2=_[_0xe27d('0x25')](db[_0xe27d('0x26')][_0xe27d('0x27')],function(_0x1221a){return{'name':_0x1221a[_0xe27d('0x28')],'type':_0x1221a[_0xe27d('0x29')][_0xe27d('0x2a')]};});_0x240aa3[_0xe27d('0x2b')]=_[_0xe27d('0x25')](_0x7dcfb2,'name');_0x240aa3[_0xe27d('0x2c')]=_['keys'](_0x527f8e['query']);_0x240aa3[_0xe27d('0x2d')]=_[_0xe27d('0x2e')](_0x240aa3[_0xe27d('0x2b')],_0x240aa3[_0xe27d('0x2c')]);_0xd36dd4[_0xe27d('0x2f')]=_[_0xe27d('0x2e')](_0x240aa3[_0xe27d('0x2b')],qs['fields'](_0x527f8e[_0xe27d('0x2c')]['fields']));_0xd36dd4[_0xe27d('0x2f')]=_0xd36dd4[_0xe27d('0x2f')][_0xe27d('0x30')]?_0xd36dd4[_0xe27d('0x2f')]:_0x240aa3[_0xe27d('0x2b')];if(!_0x527f8e[_0xe27d('0x2c')]['hasOwnProperty'](_0xe27d('0x31'))){_0xd36dd4[_0xe27d('0x1b')]=qs['limit'](_0x527f8e[_0xe27d('0x2c')][_0xe27d('0x1b')]);_0xd36dd4[_0xe27d('0x19')]=qs['offset'](_0x527f8e[_0xe27d('0x2c')][_0xe27d('0x19')]);}_0xd36dd4[_0xe27d('0x32')]=qs[_0xe27d('0x33')](_0x527f8e[_0xe27d('0x2c')][_0xe27d('0x33')]);_0xd36dd4[_0xe27d('0x34')]=qs['filters'](_[_0xe27d('0x35')](_0x527f8e['query'],_0x240aa3[_0xe27d('0x2d')]),_0x7dcfb2);if(_0x527f8e['query'][_0xe27d('0x36')]){_0xd36dd4[_0xe27d('0x34')]=_[_0xe27d('0x37')](_0xd36dd4[_0xe27d('0x34')],{'$or':_[_0xe27d('0x25')](_0x7dcfb2,function(_0x6dc03e){if(_0x6dc03e[_0xe27d('0x29')]!==_0xe27d('0x38')){var _0x2ef393={};_0x2ef393[_0x6dc03e[_0xe27d('0x22')]]={'$like':'%'+_0x527f8e[_0xe27d('0x2c')][_0xe27d('0x36')]+'%'};return _0x2ef393;}})});}_0xd36dd4=_[_0xe27d('0x37')]({},_0xd36dd4,_0x527f8e['options']);var _0x524aec={'where':_0xd36dd4[_0xe27d('0x34')]};return db[_0xe27d('0x26')][_0xe27d('0x1c')](_0x524aec)[_0xe27d('0x20')](function(_0x3df1e1){_0x1095f7[_0xe27d('0x1c')]=_0x3df1e1;if(_0x527f8e[_0xe27d('0x2c')]['includeAll']){_0xd36dd4[_0xe27d('0x39')]=[{'all':!![]}];}return db[_0xe27d('0x26')][_0xe27d('0x3a')](_0xd36dd4);})[_0xe27d('0x20')](function(_0x1e72e7){_0x1095f7[_0xe27d('0x3b')]=_0x1e72e7;return _0x1095f7;})[_0xe27d('0x20')](respondWithFilteredResult(_0x469474,_0xd36dd4))[_0xe27d('0x3c')](handleError(_0x469474,null));};exports['show']=function(_0x27d955,_0xc925b8){var _0x32f1a1={'raw':![],'where':{'id':_0x27d955[_0xe27d('0x3d')]['id']}},_0xf976a6={};_0xf976a6['model']=_[_0xe27d('0x3e')](db['ServicenowConfiguration'][_0xe27d('0x27')]);_0xf976a6[_0xe27d('0x2c')]=_[_0xe27d('0x3e')](_0x27d955['query']);_0xf976a6['filters']=_[_0xe27d('0x2e')](_0xf976a6[_0xe27d('0x2b')],_0xf976a6[_0xe27d('0x2c')]);_0x32f1a1[_0xe27d('0x2f')]=_[_0xe27d('0x2e')](_0xf976a6[_0xe27d('0x2b')],qs[_0xe27d('0x3f')](_0x27d955[_0xe27d('0x2c')][_0xe27d('0x3f')]));_0x32f1a1[_0xe27d('0x2f')]=_0x32f1a1['attributes']['length']?_0x32f1a1[_0xe27d('0x2f')]:_0xf976a6[_0xe27d('0x2b')];if(_0x27d955[_0xe27d('0x2c')][_0xe27d('0x40')]){_0x32f1a1[_0xe27d('0x39')]=[{'all':!![]}];}_0x32f1a1=_[_0xe27d('0x37')]({},_0x32f1a1,_0x27d955['options']);return db[_0xe27d('0x26')]['find'](_0x32f1a1)[_0xe27d('0x20')](handleEntityNotFound(_0xc925b8,null))['then'](respondWithResult(_0xc925b8,null))['catch'](handleError(_0xc925b8,null));};exports['create']=function(_0x4122f8,_0x260273){return db[_0xe27d('0x26')]['create'](_0x4122f8['body'],{})[_0xe27d('0x20')](respondWithResult(_0x260273,0xc9))[_0xe27d('0x3c')](handleError(_0x260273,null));};exports[_0xe27d('0x41')]=function(_0x5ad9e3,_0x51e2b4){if(_0x5ad9e3['body']['id']){delete _0x5ad9e3['body']['id'];}return db[_0xe27d('0x26')][_0xe27d('0x42')]({'where':{'id':_0x5ad9e3[_0xe27d('0x3d')]['id']}})[_0xe27d('0x20')](handleEntityNotFound(_0x51e2b4,null))['then'](saveUpdates(_0x5ad9e3['body'],null))['then'](respondWithResult(_0x51e2b4,null))['catch'](handleError(_0x51e2b4,null));};exports[_0xe27d('0x43')]=function(_0x54c457,_0x169657){return db[_0xe27d('0x26')][_0xe27d('0x42')]({'where':{'id':_0x54c457[_0xe27d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x169657,null))[_0xe27d('0x20')](removeEntity(_0x169657,null))[_0xe27d('0x3c')](handleError(_0x169657,null));};exports[_0xe27d('0x44')]=function(_0x388f1e,_0x383466,_0x2161cf){var _0x2b5dab={};var _0x37c5e3={};var _0x2b73c7;var _0x1ad641;return db['ServicenowConfiguration'][_0xe27d('0x45')]({'where':{'id':_0x388f1e['params']['id']}})[_0xe27d('0x20')](handleEntityNotFound(_0x383466,null))[_0xe27d('0x20')](function(_0x5a861b){if(_0x5a861b){_0x2b73c7=_0x5a861b;_0x37c5e3['model']=_[_0xe27d('0x3e')](db['ServicenowField'][_0xe27d('0x27')]);_0x37c5e3[_0xe27d('0x2c')]=_['keys'](_0x388f1e[_0xe27d('0x2c')]);_0x37c5e3['filters']=_['intersection'](_0x37c5e3['model'],_0x37c5e3[_0xe27d('0x2c')]);_0x2b5dab[_0xe27d('0x2f')]=_['intersection'](_0x37c5e3[_0xe27d('0x2b')],qs[_0xe27d('0x3f')](_0x388f1e[_0xe27d('0x2c')][_0xe27d('0x3f')]));_0x2b5dab['attributes']=_0x2b5dab[_0xe27d('0x2f')][_0xe27d('0x30')]?_0x2b5dab[_0xe27d('0x2f')]:_0x37c5e3['model'];_0x2b5dab['order']=qs[_0xe27d('0x33')](_0x388f1e[_0xe27d('0x2c')][_0xe27d('0x33')]);_0x2b5dab[_0xe27d('0x34')]=qs['filters'](_['pick'](_0x388f1e[_0xe27d('0x2c')],_0x37c5e3[_0xe27d('0x2d')]));if(_0x388f1e[_0xe27d('0x2c')][_0xe27d('0x36')]){_0x2b5dab[_0xe27d('0x34')]=_[_0xe27d('0x37')](_0x2b5dab[_0xe27d('0x34')],{'$or':_[_0xe27d('0x25')](_0x2b5dab[_0xe27d('0x2f')],function(_0x45bab3){var _0x103bef={};_0x103bef[_0x45bab3]={'$like':'%'+_0x388f1e[_0xe27d('0x2c')]['filter']+'%'};return _0x103bef;})});}_0x2b5dab=_['merge']({},_0x2b5dab,_0x388f1e[_0xe27d('0x46')]);return _0x2b73c7[_0xe27d('0x44')](_0x2b5dab);}})[_0xe27d('0x20')](function(_0x37bc35){if(_0x37bc35){_0x1ad641=_0x37bc35[_0xe27d('0x30')];if(!_0x388f1e[_0xe27d('0x2c')]['hasOwnProperty'](_0xe27d('0x31'))){_0x2b5dab[_0xe27d('0x1b')]=qs['limit'](_0x388f1e[_0xe27d('0x2c')][_0xe27d('0x1b')]);_0x2b5dab[_0xe27d('0x19')]=qs[_0xe27d('0x19')](_0x388f1e['query'][_0xe27d('0x19')]);}return _0x2b73c7[_0xe27d('0x44')](_0x2b5dab);}})[_0xe27d('0x20')](function(_0x4de655){if(_0x4de655){return _0x4de655?{'count':_0x1ad641,'rows':_0x4de655}:null;}})[_0xe27d('0x20')](respondWithResult(_0x383466,null))[_0xe27d('0x3c')](handleError(_0x383466,null));};exports['getSubjects']=function(_0x5a6c55,_0x479a5a,_0x41937c){var _0x365f32={};var _0x35cd12={};var _0x23688f;var _0x14ea0c;return db['ServicenowConfiguration'][_0xe27d('0x45')]({'where':{'id':_0x5a6c55[_0xe27d('0x3d')]['id']}})[_0xe27d('0x20')](handleEntityNotFound(_0x479a5a,null))[_0xe27d('0x20')](function(_0x3df7c6){if(_0x3df7c6){_0x23688f=_0x3df7c6;_0x35cd12[_0xe27d('0x2b')]=_['keys'](db[_0xe27d('0x47')]['rawAttributes']);_0x35cd12[_0xe27d('0x2c')]=_[_0xe27d('0x3e')](_0x5a6c55[_0xe27d('0x2c')]);_0x35cd12[_0xe27d('0x2d')]=_['intersection'](_0x35cd12[_0xe27d('0x2b')],_0x35cd12[_0xe27d('0x2c')]);_0x365f32[_0xe27d('0x2f')]=_[_0xe27d('0x2e')](_0x35cd12[_0xe27d('0x2b')],qs[_0xe27d('0x3f')](_0x5a6c55[_0xe27d('0x2c')][_0xe27d('0x3f')]));_0x365f32[_0xe27d('0x2f')]=_0x365f32[_0xe27d('0x2f')][_0xe27d('0x30')]?_0x365f32['attributes']:_0x35cd12['model'];_0x365f32[_0xe27d('0x32')]=qs[_0xe27d('0x33')](_0x5a6c55['query'][_0xe27d('0x33')]);_0x365f32[_0xe27d('0x34')]=qs[_0xe27d('0x2d')](_['pick'](_0x5a6c55[_0xe27d('0x2c')],_0x35cd12[_0xe27d('0x2d')]));if(_0x5a6c55[_0xe27d('0x2c')][_0xe27d('0x36')]){_0x365f32[_0xe27d('0x34')]=_['merge'](_0x365f32[_0xe27d('0x34')],{'$or':_[_0xe27d('0x25')](_0x365f32[_0xe27d('0x2f')],function(_0x53d6ba){var _0xd56a07={};_0xd56a07[_0x53d6ba]={'$like':'%'+_0x5a6c55['query'][_0xe27d('0x36')]+'%'};return _0xd56a07;})});}_0x365f32=_[_0xe27d('0x37')]({},_0x365f32,_0x5a6c55[_0xe27d('0x46')]);return _0x23688f[_0xe27d('0x48')](_0x365f32);}})[_0xe27d('0x20')](function(_0x3f68e5){if(_0x3f68e5){_0x14ea0c=_0x3f68e5[_0xe27d('0x30')];if(!_0x5a6c55[_0xe27d('0x2c')][_0xe27d('0x49')](_0xe27d('0x31'))){_0x365f32[_0xe27d('0x1b')]=qs[_0xe27d('0x1b')](_0x5a6c55[_0xe27d('0x2c')][_0xe27d('0x1b')]);_0x365f32[_0xe27d('0x19')]=qs[_0xe27d('0x19')](_0x5a6c55[_0xe27d('0x2c')]['offset']);}return _0x23688f[_0xe27d('0x48')](_0x365f32);}})[_0xe27d('0x20')](function(_0x92fde5){if(_0x92fde5){return _0x92fde5?{'count':_0x14ea0c,'rows':_0x92fde5}:null;}})[_0xe27d('0x20')](respondWithResult(_0x479a5a,null))['catch'](handleError(_0x479a5a,null));};exports['getDescriptions']=function(_0x50081f,_0x5a13d8,_0x515113){var _0x57b546={};var _0x10498e={};var _0x4482c7;var _0xc5c91e;return db[_0xe27d('0x26')]['findOne']({'where':{'id':_0x50081f['params']['id']}})[_0xe27d('0x20')](handleEntityNotFound(_0x5a13d8,null))[_0xe27d('0x20')](function(_0x5e48b3){if(_0x5e48b3){_0x4482c7=_0x5e48b3;_0x10498e[_0xe27d('0x2b')]=_[_0xe27d('0x3e')](db[_0xe27d('0x47')][_0xe27d('0x27')]);_0x10498e[_0xe27d('0x2c')]=_[_0xe27d('0x3e')](_0x50081f[_0xe27d('0x2c')]);_0x10498e['filters']=_['intersection'](_0x10498e[_0xe27d('0x2b')],_0x10498e['query']);_0x57b546[_0xe27d('0x2f')]=_[_0xe27d('0x2e')](_0x10498e['model'],qs['fields'](_0x50081f['query'][_0xe27d('0x3f')]));_0x57b546[_0xe27d('0x2f')]=_0x57b546[_0xe27d('0x2f')][_0xe27d('0x30')]?_0x57b546[_0xe27d('0x2f')]:_0x10498e[_0xe27d('0x2b')];_0x57b546[_0xe27d('0x32')]=qs[_0xe27d('0x33')](_0x50081f['query'][_0xe27d('0x33')]);_0x57b546[_0xe27d('0x34')]=qs['filters'](_['pick'](_0x50081f[_0xe27d('0x2c')],_0x10498e['filters']));if(_0x50081f[_0xe27d('0x2c')]['filter']){_0x57b546[_0xe27d('0x34')]=_['merge'](_0x57b546[_0xe27d('0x34')],{'$or':_['map'](_0x57b546[_0xe27d('0x2f')],function(_0x77201e){var _0x15a0c0={};_0x15a0c0[_0x77201e]={'$like':'%'+_0x50081f[_0xe27d('0x2c')][_0xe27d('0x36')]+'%'};return _0x15a0c0;})});}_0x57b546=_[_0xe27d('0x37')]({},_0x57b546,_0x50081f[_0xe27d('0x46')]);return _0x4482c7[_0xe27d('0x4a')](_0x57b546);}})[_0xe27d('0x20')](function(_0x542b02){if(_0x542b02){_0xc5c91e=_0x542b02['length'];if(!_0x50081f[_0xe27d('0x2c')][_0xe27d('0x49')](_0xe27d('0x31'))){_0x57b546['limit']=qs[_0xe27d('0x1b')](_0x50081f[_0xe27d('0x2c')][_0xe27d('0x1b')]);_0x57b546[_0xe27d('0x19')]=qs[_0xe27d('0x19')](_0x50081f['query'][_0xe27d('0x19')]);}return _0x4482c7[_0xe27d('0x4a')](_0x57b546);}})[_0xe27d('0x20')](function(_0x4d82b5){if(_0x4d82b5){return _0x4d82b5?{'count':_0xc5c91e,'rows':_0x4d82b5}:null;}})[_0xe27d('0x20')](respondWithResult(_0x5a13d8,null))['catch'](handleError(_0x5a13d8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e836974..ada0b6d 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 _0xc900=['api','moment','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','../../config/logger'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xc900,0xb3));var _0x0c90=function(_0x376a26,_0x3109e5){_0x376a26=_0x376a26-0x0;var _0x37db25=_0xc900[_0x376a26];return _0x37db25;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa988=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x25af6c,_0x13ba84){var _0x2bf300=function(_0x1c8294){while(--_0x1c8294){_0x25af6c['push'](_0x25af6c['shift']());}};_0x2bf300(++_0x13ba84);}(_0xa988,0x1a7));var _0x8a98=function(_0x31934e,_0x34d021){_0x31934e=_0x31934e-0x0;var _0x171a1c=_0xa988[_0x31934e];return _0x171a1c;};'use strict';var _=require(_0x8a98('0x0'));var util=require(_0x8a98('0x1'));var logger=require(_0x8a98('0x2'))(_0x8a98('0x3'));var moment=require(_0x8a98('0x4'));var BPromise=require('bluebird');var rp=require(_0x8a98('0x5'));var fs=require('fs');var path=require(_0x8a98('0x6'));var rimraf=require(_0x8a98('0x7'));var config=require(_0x8a98('0x8'));var attributes=require(_0x8a98('0x9'));module[_0x8a98('0xa')]=function(_0x3eb5cf,_0x3fcd06){return _0x3eb5cf['define'](_0x8a98('0xb'),attributes,{'tableName':_0x8a98('0xc'),'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 c525001..2f43ef3 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 _0x9034=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','util'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9034,0x1cd));var _0x4903=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9034[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x4903('0x0'));var moment=require(_0x4903('0x1'));var BPromise=require('bluebird');var rs=require(_0x4903('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4903('0x3'))['db'];var utils=require(_0x4903('0x4'));var logger=require(_0x4903('0x5'))(_0x4903('0x6'));var config=require('../../config/environment');var jayson=require(_0x4903('0x7'));var client=jayson[_0x4903('0x8')][_0x4903('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7c7e0e,_0x2911ec,_0x53ffff){return new BPromise(function(_0x1c51cd,_0x230baa){return client[_0x4903('0xa')](_0x7c7e0e,_0x53ffff)[_0x4903('0xb')](function(_0x1dd7e8){logger['info'](_0x4903('0xc'),_0x2911ec,'request\x20sent');logger[_0x4903('0xd')](_0x4903('0xe'),_0x2911ec,'request\x20sent',JSON[_0x4903('0xf')](_0x1dd7e8));if(_0x1dd7e8['error']){if(_0x1dd7e8[_0x4903('0x10')][_0x4903('0x11')]===0x1f4){logger[_0x4903('0x10')](_0x4903('0xc'),_0x2911ec,_0x1dd7e8[_0x4903('0x10')]['message']);return _0x230baa(_0x1dd7e8[_0x4903('0x10')][_0x4903('0x12')]);}logger[_0x4903('0x10')](_0x4903('0xc'),_0x2911ec,_0x1dd7e8[_0x4903('0x10')][_0x4903('0x12')]);return _0x1c51cd(_0x1dd7e8[_0x4903('0x10')]['message']);}else{logger[_0x4903('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2911ec,_0x4903('0x14'));_0x1c51cd(_0x1dd7e8[_0x4903('0x15')][_0x4903('0x12')]);}})['catch'](function(_0x47ecfb){logger[_0x4903('0x10')](_0x4903('0xc'),_0x2911ec,_0x47ecfb);_0x230baa(_0x47ecfb);});});} \ No newline at end of file +var _0x0a08=['info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x13a7b0,_0x587c97){var _0x1790a1=function(_0x20afae){while(--_0x20afae){_0x13a7b0['push'](_0x13a7b0['shift']());}};_0x1790a1(++_0x587c97);}(_0x0a08,0x153));var _0x80a0=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x0a08[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x80a0('0x0'));var util=require(_0x80a0('0x1'));var moment=require(_0x80a0('0x2'));var BPromise=require(_0x80a0('0x3'));var rs=require(_0x80a0('0x4'));var fs=require('fs');var Redis=require(_0x80a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x80a0('0x6'));var logger=require('../../config/logger')(_0x80a0('0x7'));var config=require(_0x80a0('0x8'));var jayson=require(_0x80a0('0x9'));var client=jayson[_0x80a0('0xa')][_0x80a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x216c4e,_0x4f0894,_0x39f40b){return new BPromise(function(_0x108f57,_0x42afec){return client['request'](_0x216c4e,_0x39f40b)[_0x80a0('0xc')](function(_0x15d7e1){logger[_0x80a0('0xd')](_0x80a0('0xe'),_0x4f0894,'request\x20sent');logger[_0x80a0('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4f0894,_0x80a0('0x10'),JSON[_0x80a0('0x11')](_0x15d7e1));if(_0x15d7e1[_0x80a0('0x12')]){if(_0x15d7e1[_0x80a0('0x12')]['code']===0x1f4){logger[_0x80a0('0x12')](_0x80a0('0xe'),_0x4f0894,_0x15d7e1[_0x80a0('0x12')][_0x80a0('0x13')]);return _0x42afec(_0x15d7e1[_0x80a0('0x12')][_0x80a0('0x13')]);}logger['error'](_0x80a0('0xe'),_0x4f0894,_0x15d7e1[_0x80a0('0x12')]['message']);return _0x108f57(_0x15d7e1[_0x80a0('0x12')]['message']);}else{logger[_0x80a0('0xd')](_0x80a0('0xe'),_0x4f0894,_0x80a0('0x10'));_0x108f57(_0x15d7e1[_0x80a0('0x14')][_0x80a0('0x13')]);}})[_0x80a0('0x15')](function(_0x252762){logger[_0x80a0('0x12')](_0x80a0('0xe'),_0x4f0894,_0x252762);_0x42afec(_0x252762);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index cb33201..6c73db6 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 _0x2d5a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','util','path'];(function(_0x1c7572,_0x317b88){var _0x382274=function(_0x5cc950){while(--_0x5cc950){_0x1c7572['push'](_0x1c7572['shift']());}};_0x382274(++_0x317b88);}(_0x2d5a,0x178));var _0xa2d5=function(_0x3ddb21,_0x21f10d){_0x3ddb21=_0x3ddb21-0x0;var _0x4d8318=_0x2d5a[_0x3ddb21];return _0x4d8318;};'use strict';var multer=require('multer');var util=require(_0xa2d5('0x0'));var path=require(_0xa2d5('0x1'));var timeout=require('connect-timeout');var express=require(_0xa2d5('0x2'));var router=express[_0xa2d5('0x3')]();var fs_extra=require(_0xa2d5('0x4'));var auth=require(_0xa2d5('0x5'));var interaction=require(_0xa2d5('0x6'));var config=require('../../config/environment');var controller=require(_0xa2d5('0x7'));router[_0xa2d5('0x8')]('/',auth[_0xa2d5('0x9')](),controller[_0xa2d5('0xa')]);router['get'](_0xa2d5('0xb'),auth[_0xa2d5('0x9')](),controller[_0xa2d5('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa2d5('0xd')]);router['put'](_0xa2d5('0xb'),auth['isAuthenticated'](),controller[_0xa2d5('0xe')]);router[_0xa2d5('0xf')]('/:id',auth[_0xa2d5('0x9')](),controller[_0xa2d5('0x10')]);module[_0xa2d5('0x11')]=router; \ No newline at end of file +var _0x0ef1=['get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller'];(function(_0x53084c,_0x4a10a7){var _0x3725c5=function(_0x2d650c){while(--_0x2d650c){_0x53084c['push'](_0x53084c['shift']());}};_0x3725c5(++_0x4a10a7);}(_0x0ef1,0x1ad));var _0x10ef=function(_0xe2e224,_0x546ace){_0xe2e224=_0xe2e224-0x0;var _0x5734b8=_0x0ef1[_0xe2e224];return _0x5734b8;};'use strict';var multer=require(_0x10ef('0x0'));var util=require('util');var path=require(_0x10ef('0x1'));var timeout=require(_0x10ef('0x2'));var express=require(_0x10ef('0x3'));var router=express['Router']();var fs_extra=require(_0x10ef('0x4'));var auth=require(_0x10ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x10ef('0x6'));var controller=require(_0x10ef('0x7'));router[_0x10ef('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x10ef('0x9')](),controller[_0x10ef('0xa')]);router[_0x10ef('0xb')]('/',auth[_0x10ef('0x9')](),controller[_0x10ef('0xc')]);router[_0x10ef('0xd')](_0x10ef('0xe'),auth['isAuthenticated'](),controller[_0x10ef('0xf')]);router[_0x10ef('0x10')](_0x10ef('0xe'),auth[_0x10ef('0x9')](),controller[_0x10ef('0x11')]);module[_0x10ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 9843433..93ec191 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 _0xc6f4=['sequelize','ENUM','string','variable','picklist','STRING','BOOLEAN'];(function(_0x351fb7,_0xa2e158){var _0x391fa9=function(_0x3f58a2){while(--_0x3f58a2){_0x351fb7['push'](_0x351fb7['shift']());}};_0x391fa9(++_0xa2e158);}(_0xc6f4,0x149));var _0x4c6f=function(_0x35509e,_0x238376){_0x35509e=_0x35509e-0x0;var _0x305ee9=_0xc6f4[_0x35509e];return _0x305ee9;};'use strict';var Sequelize=require(_0x4c6f('0x0'));module['exports']={'type':{'type':Sequelize[_0x4c6f('0x1')](_0x4c6f('0x2'),_0x4c6f('0x3'),'customVariable','keyValue',_0x4c6f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4c6f('0x5')]},'key':{'type':Sequelize[_0x4c6f('0x5')]},'keyType':{'type':Sequelize[_0x4c6f('0x1')](_0x4c6f('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x4c6f('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4c6f('0x5')]},'customField':{'type':Sequelize[_0x4c6f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0431=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x3b04ab,_0x2e0e2){var _0x494c5e=function(_0x1f5822){while(--_0x1f5822){_0x3b04ab['push'](_0x3b04ab['shift']());}};_0x494c5e(++_0x2e0e2);}(_0x0431,0x168));var _0x1043=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x0431[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x1043('0x0'));module[_0x1043('0x1')]={'type':{'type':Sequelize[_0x1043('0x2')](_0x1043('0x3'),_0x1043('0x4'),_0x1043('0x5'),_0x1043('0x6'),_0x1043('0x7')),'defaultValue':_0x1043('0x3')},'content':{'type':Sequelize[_0x1043('0x8')]},'key':{'type':Sequelize[_0x1043('0x8')]},'keyType':{'type':Sequelize[_0x1043('0x2')](_0x1043('0x3'),_0x1043('0x4'),_0x1043('0x5'))},'keyContent':{'type':Sequelize[_0x1043('0x8')]},'idField':{'type':Sequelize[_0x1043('0x8')]},'nameField':{'type':Sequelize[_0x1043('0x8')]},'customField':{'type':Sequelize[_0x1043('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1043('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 2f52629..91acc32 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 _0xa780=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','send','index','ServicenowField','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','intersection','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3ee63b,_0xbf9092){var _0x380dbd=function(_0x27525d){while(--_0x27525d){_0x3ee63b['push'](_0x3ee63b['shift']());}};_0x380dbd(++_0xbf9092);}(_0xa780,0x1f1));var _0x0a78=function(_0xe74cda,_0x1a9c91){_0xe74cda=_0xe74cda-0x0;var _0x430397=_0xa780[_0xe74cda];return _0x430397;};'use strict';var emlformat=require(_0x0a78('0x0'));var rimraf=require(_0x0a78('0x1'));var zipdir=require(_0x0a78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a78('0x3'));var BPromise=require(_0x0a78('0x4'));var Mustache=require('mustache');var util=require(_0x0a78('0x5'));var path=require(_0x0a78('0x6'));var sox=require('sox');var csv=require(_0x0a78('0x7'));var ejs=require(_0x0a78('0x8'));var fs=require('fs');var fs_extra=require(_0x0a78('0x9'));var _=require(_0x0a78('0xa'));var squel=require(_0x0a78('0xb'));var crypto=require(_0x0a78('0xc'));var jsforce=require(_0x0a78('0xd'));var deskjs=require(_0x0a78('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a78('0xf'));var Redis=require(_0x0a78('0x10'));var authService=require(_0x0a78('0x11'));var qs=require(_0x0a78('0x12'));var as=require(_0x0a78('0x13'));var hardwareService=require(_0x0a78('0x14'));var logger=require(_0x0a78('0x15'))('api');var utils=require(_0x0a78('0x16'));var config=require(_0x0a78('0x17'));var licenseUtil=require(_0x0a78('0x18'));var db=require(_0x0a78('0x19'))['db'];function respondWithStatusCode(_0xa05e39,_0x37728d){_0x37728d=_0x37728d||0xcc;return function(_0x441deb){if(_0x441deb){return _0xa05e39[_0x0a78('0x1a')](_0x37728d);}return _0xa05e39[_0x0a78('0x1b')](_0x37728d)[_0x0a78('0x1c')]();};}function respondWithResult(_0x5ad182,_0x3682ae){_0x3682ae=_0x3682ae||0xc8;return function(_0x471bf8){if(_0x471bf8){return _0x5ad182[_0x0a78('0x1b')](_0x3682ae)[_0x0a78('0x1d')](_0x471bf8);}};}function respondWithFilteredResult(_0xd4358a,_0x146dca){return function(_0x8a0b61){if(_0x8a0b61){var _0x593dfc=typeof _0x146dca[_0x0a78('0x1e')]===_0x0a78('0x1f')&&typeof _0x146dca[_0x0a78('0x20')]===_0x0a78('0x1f');var _0xaf7311=_0x8a0b61['count'];var _0x4f1686=_0x593dfc?0x0:_0x146dca[_0x0a78('0x1e')];var _0x2a8c8f=_0x593dfc?_0x8a0b61[_0x0a78('0x21')]:_0x146dca['offset']+_0x146dca[_0x0a78('0x20')];var _0x41aae4;if(_0x2a8c8f>=_0xaf7311){_0x2a8c8f=_0xaf7311;_0x41aae4=0xc8;}else{_0x41aae4=0xce;}_0xd4358a[_0x0a78('0x1b')](_0x41aae4);return _0xd4358a[_0x0a78('0x22')](_0x0a78('0x23'),_0x4f1686+'-'+_0x2a8c8f+'/'+_0xaf7311)[_0x0a78('0x1d')](_0x8a0b61);}return null;};}function patchUpdates(_0x3378bf){return function(_0x3a8b51){try{jsonpatch['apply'](_0x3a8b51,_0x3378bf,!![]);}catch(_0x4712d8){return BPromise[_0x0a78('0x24')](_0x4712d8);}return _0x3a8b51[_0x0a78('0x25')]();};}function saveUpdates(_0x18556a,_0x1b2140){return function(_0x1cc708){if(_0x1cc708){return _0x1cc708['update'](_0x18556a)[_0x0a78('0x26')](function(_0x505b6a){return _0x505b6a;});}return null;};}function removeEntity(_0x2e6fa7,_0x3f9576){return function(_0x4b2386){if(_0x4b2386){return _0x4b2386[_0x0a78('0x27')]()[_0x0a78('0x26')](function(){_0x2e6fa7[_0x0a78('0x1b')](0xcc)[_0x0a78('0x1c')]();});}};}function handleEntityNotFound(_0x466a8b,_0x2cca9a){return function(_0x16ecbe){if(!_0x16ecbe){_0x466a8b[_0x0a78('0x1a')](0x194);}return _0x16ecbe;};}function handleError(_0x4095bd,_0xe3550){_0xe3550=_0xe3550||0x1f4;return function(_0x41b4a7){logger['error'](_0x41b4a7[_0x0a78('0x28')]);if(_0x41b4a7['name']){delete _0x41b4a7[_0x0a78('0x29')];}_0x4095bd[_0x0a78('0x1b')](_0xe3550)[_0x0a78('0x2a')](_0x41b4a7);};}exports[_0x0a78('0x2b')]=function(_0x27ad9f,_0x275edd){var _0x131561={},_0x3a1a0c={},_0x4cd1e2={'count':0x0,'rows':[]};var _0x388572=_['map'](db[_0x0a78('0x2c')]['rawAttributes'],function(_0x242987){return{'name':_0x242987[_0x0a78('0x2d')],'type':_0x242987[_0x0a78('0x2e')]['key']};});_0x3a1a0c[_0x0a78('0x2f')]=_['map'](_0x388572,_0x0a78('0x29'));_0x3a1a0c[_0x0a78('0x30')]=_['keys'](_0x27ad9f[_0x0a78('0x30')]);_0x3a1a0c[_0x0a78('0x31')]=_['intersection'](_0x3a1a0c['model'],_0x3a1a0c[_0x0a78('0x30')]);_0x131561[_0x0a78('0x32')]=_['intersection'](_0x3a1a0c[_0x0a78('0x2f')],qs[_0x0a78('0x33')](_0x27ad9f[_0x0a78('0x30')]['fields']));_0x131561[_0x0a78('0x32')]=_0x131561[_0x0a78('0x32')]['length']?_0x131561['attributes']:_0x3a1a0c[_0x0a78('0x2f')];if(!_0x27ad9f['query'][_0x0a78('0x34')]('nolimit')){_0x131561[_0x0a78('0x20')]=qs[_0x0a78('0x20')](_0x27ad9f[_0x0a78('0x30')]['limit']);_0x131561[_0x0a78('0x1e')]=qs['offset'](_0x27ad9f['query'][_0x0a78('0x1e')]);}_0x131561['order']=qs[_0x0a78('0x35')](_0x27ad9f[_0x0a78('0x30')][_0x0a78('0x35')]);_0x131561[_0x0a78('0x36')]=qs['filters'](_['pick'](_0x27ad9f[_0x0a78('0x30')],_0x3a1a0c[_0x0a78('0x31')]),_0x388572);if(_0x27ad9f[_0x0a78('0x30')][_0x0a78('0x37')]){_0x131561[_0x0a78('0x36')]=_[_0x0a78('0x38')](_0x131561[_0x0a78('0x36')],{'$or':_[_0x0a78('0x39')](_0x388572,function(_0x16d5e3){if(_0x16d5e3[_0x0a78('0x2e')]!==_0x0a78('0x3a')){var _0x5dbdea={};_0x5dbdea[_0x16d5e3[_0x0a78('0x29')]]={'$like':'%'+_0x27ad9f['query'][_0x0a78('0x37')]+'%'};return _0x5dbdea;}})});}_0x131561=_[_0x0a78('0x38')]({},_0x131561,_0x27ad9f[_0x0a78('0x3b')]);var _0x4a9f05={'where':_0x131561[_0x0a78('0x36')]};return db['ServicenowField'][_0x0a78('0x21')](_0x4a9f05)['then'](function(_0x2dec91){_0x4cd1e2[_0x0a78('0x21')]=_0x2dec91;if(_0x27ad9f['query']['includeAll']){_0x131561[_0x0a78('0x3c')]=[{'all':!![]}];}return db['ServicenowField'][_0x0a78('0x3d')](_0x131561);})[_0x0a78('0x26')](function(_0x4fcd95){_0x4cd1e2['rows']=_0x4fcd95;return _0x4cd1e2;})[_0x0a78('0x26')](respondWithFilteredResult(_0x275edd,_0x131561))[_0x0a78('0x3e')](handleError(_0x275edd,null));};exports[_0x0a78('0x3f')]=function(_0x517397,_0x8634b3){var _0x59e891={'raw':!![],'where':{'id':_0x517397[_0x0a78('0x40')]['id']}},_0xda3e48={};_0xda3e48[_0x0a78('0x2f')]=_[_0x0a78('0x41')](db['ServicenowField'][_0x0a78('0x42')]);_0xda3e48['query']=_['keys'](_0x517397[_0x0a78('0x30')]);_0xda3e48[_0x0a78('0x31')]=_[_0x0a78('0x43')](_0xda3e48[_0x0a78('0x2f')],_0xda3e48[_0x0a78('0x30')]);_0x59e891[_0x0a78('0x32')]=_['intersection'](_0xda3e48['model'],qs[_0x0a78('0x33')](_0x517397['query'][_0x0a78('0x33')]));_0x59e891[_0x0a78('0x32')]=_0x59e891[_0x0a78('0x32')]['length']?_0x59e891[_0x0a78('0x32')]:_0xda3e48[_0x0a78('0x2f')];if(_0x517397[_0x0a78('0x30')][_0x0a78('0x44')]){_0x59e891[_0x0a78('0x3c')]=[{'all':!![]}];}_0x59e891=_[_0x0a78('0x38')]({},_0x59e891,_0x517397[_0x0a78('0x3b')]);return db[_0x0a78('0x2c')][_0x0a78('0x45')](_0x59e891)[_0x0a78('0x26')](handleEntityNotFound(_0x8634b3,null))['then'](respondWithResult(_0x8634b3,null))[_0x0a78('0x3e')](handleError(_0x8634b3,null));};exports[_0x0a78('0x46')]=function(_0x5d2c4f,_0x5c7660){return db[_0x0a78('0x2c')][_0x0a78('0x46')](_0x5d2c4f[_0x0a78('0x47')],{})[_0x0a78('0x26')](respondWithResult(_0x5c7660,0xc9))[_0x0a78('0x3e')](handleError(_0x5c7660,null));};exports[_0x0a78('0x48')]=function(_0x2014a6,_0x5e3575){if(_0x2014a6['body']['id']){delete _0x2014a6['body']['id'];}return db[_0x0a78('0x2c')][_0x0a78('0x45')]({'where':{'id':_0x2014a6['params']['id']}})[_0x0a78('0x26')](handleEntityNotFound(_0x5e3575,null))[_0x0a78('0x26')](saveUpdates(_0x2014a6[_0x0a78('0x47')],null))[_0x0a78('0x26')](respondWithResult(_0x5e3575,null))[_0x0a78('0x3e')](handleError(_0x5e3575,null));};exports['destroy']=function(_0x5a95f6,_0x579c11){return db['ServicenowField']['find']({'where':{'id':_0x5a95f6[_0x0a78('0x40')]['id']}})[_0x0a78('0x26')](handleEntityNotFound(_0x579c11,null))[_0x0a78('0x26')](removeEntity(_0x579c11,null))[_0x0a78('0x3e')](handleError(_0x579c11,null));}; \ No newline at end of file +var _0x1515=['lodash','squel','jsforce','desk.js','to-csv','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra'];(function(_0x3cd898,_0x444cfa){var _0x2e79f5=function(_0x51774a){while(--_0x51774a){_0x3cd898['push'](_0x3cd898['shift']());}};_0x2e79f5(++_0x444cfa);}(_0x1515,0x8a));var _0x5151=function(_0x595c57,_0x506643){_0x595c57=_0x595c57-0x0;var _0x10186f=_0x1515[_0x595c57];return _0x10186f;};'use strict';var emlformat=require(_0x5151('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5151('0x1'));var jsonpatch=require(_0x5151('0x2'));var rp=require(_0x5151('0x3'));var moment=require(_0x5151('0x4'));var BPromise=require(_0x5151('0x5'));var Mustache=require(_0x5151('0x6'));var util=require(_0x5151('0x7'));var path=require(_0x5151('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5151('0x9'));var _=require(_0x5151('0xa'));var squel=require(_0x5151('0xb'));var crypto=require('crypto');var jsforce=require(_0x5151('0xc'));var deskjs=require(_0x5151('0xd'));var toCsv=require(_0x5151('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5151('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5151('0x10'));var logger=require(_0x5151('0x11'))(_0x5151('0x12'));var utils=require(_0x5151('0x13'));var config=require(_0x5151('0x14'));var licenseUtil=require(_0x5151('0x15'));var db=require(_0x5151('0x16'))['db'];function respondWithStatusCode(_0x3acaaf,_0x50411b){_0x50411b=_0x50411b||0xcc;return function(_0x679967){if(_0x679967){return _0x3acaaf[_0x5151('0x17')](_0x50411b);}return _0x3acaaf[_0x5151('0x18')](_0x50411b)[_0x5151('0x19')]();};}function respondWithResult(_0x4b1bf9,_0x4f6383){_0x4f6383=_0x4f6383||0xc8;return function(_0x4b5d0e){if(_0x4b5d0e){return _0x4b1bf9[_0x5151('0x18')](_0x4f6383)[_0x5151('0x1a')](_0x4b5d0e);}};}function respondWithFilteredResult(_0x42797c,_0x35a9c0){return function(_0x310e5){if(_0x310e5){var _0x2706d0=typeof _0x35a9c0[_0x5151('0x1b')]===_0x5151('0x1c')&&typeof _0x35a9c0[_0x5151('0x1d')]===_0x5151('0x1c');var _0x373aae=_0x310e5[_0x5151('0x1e')];var _0x1adbe2=_0x2706d0?0x0:_0x35a9c0[_0x5151('0x1b')];var _0x30464f=_0x2706d0?_0x310e5[_0x5151('0x1e')]:_0x35a9c0[_0x5151('0x1b')]+_0x35a9c0[_0x5151('0x1d')];var _0xf19d7d;if(_0x30464f>=_0x373aae){_0x30464f=_0x373aae;_0xf19d7d=0xc8;}else{_0xf19d7d=0xce;}_0x42797c['status'](_0xf19d7d);return _0x42797c[_0x5151('0x1f')](_0x5151('0x20'),_0x1adbe2+'-'+_0x30464f+'/'+_0x373aae)['json'](_0x310e5);}return null;};}function patchUpdates(_0x339971){return function(_0x2b10b3){try{jsonpatch['apply'](_0x2b10b3,_0x339971,!![]);}catch(_0x3c6886){return BPromise[_0x5151('0x21')](_0x3c6886);}return _0x2b10b3['save']();};}function saveUpdates(_0xcf243,_0x1b336f){return function(_0x59552d){if(_0x59552d){return _0x59552d['update'](_0xcf243)[_0x5151('0x22')](function(_0x4dc5da){return _0x4dc5da;});}return null;};}function removeEntity(_0x3e41a6,_0x268e8b){return function(_0x4cf622){if(_0x4cf622){return _0x4cf622['destroy']()[_0x5151('0x22')](function(){_0x3e41a6[_0x5151('0x18')](0xcc)[_0x5151('0x19')]();});}};}function handleEntityNotFound(_0x45b0b3,_0x286fd6){return function(_0x2886a2){if(!_0x2886a2){_0x45b0b3['sendStatus'](0x194);}return _0x2886a2;};}function handleError(_0x2f668f,_0x489166){_0x489166=_0x489166||0x1f4;return function(_0x2bc64a){logger[_0x5151('0x23')](_0x2bc64a[_0x5151('0x24')]);if(_0x2bc64a['name']){delete _0x2bc64a[_0x5151('0x25')];}_0x2f668f[_0x5151('0x18')](_0x489166)[_0x5151('0x26')](_0x2bc64a);};}exports[_0x5151('0x27')]=function(_0x10d6d6,_0x19c06d){var _0x11c580={},_0x5718ab={},_0x495efb={'count':0x0,'rows':[]};var _0x89f3e3=_['map'](db[_0x5151('0x28')][_0x5151('0x29')],function(_0x42e1fe){return{'name':_0x42e1fe[_0x5151('0x2a')],'type':_0x42e1fe[_0x5151('0x2b')][_0x5151('0x2c')]};});_0x5718ab[_0x5151('0x2d')]=_[_0x5151('0x2e')](_0x89f3e3,'name');_0x5718ab[_0x5151('0x2f')]=_[_0x5151('0x30')](_0x10d6d6[_0x5151('0x2f')]);_0x5718ab[_0x5151('0x31')]=_[_0x5151('0x32')](_0x5718ab[_0x5151('0x2d')],_0x5718ab['query']);_0x11c580[_0x5151('0x33')]=_[_0x5151('0x32')](_0x5718ab[_0x5151('0x2d')],qs[_0x5151('0x34')](_0x10d6d6['query'][_0x5151('0x34')]));_0x11c580[_0x5151('0x33')]=_0x11c580[_0x5151('0x33')][_0x5151('0x35')]?_0x11c580[_0x5151('0x33')]:_0x5718ab[_0x5151('0x2d')];if(!_0x10d6d6['query'][_0x5151('0x36')](_0x5151('0x37'))){_0x11c580[_0x5151('0x1d')]=qs[_0x5151('0x1d')](_0x10d6d6[_0x5151('0x2f')][_0x5151('0x1d')]);_0x11c580[_0x5151('0x1b')]=qs['offset'](_0x10d6d6[_0x5151('0x2f')][_0x5151('0x1b')]);}_0x11c580[_0x5151('0x38')]=qs[_0x5151('0x39')](_0x10d6d6[_0x5151('0x2f')]['sort']);_0x11c580[_0x5151('0x3a')]=qs[_0x5151('0x31')](_['pick'](_0x10d6d6[_0x5151('0x2f')],_0x5718ab['filters']),_0x89f3e3);if(_0x10d6d6[_0x5151('0x2f')][_0x5151('0x3b')]){_0x11c580[_0x5151('0x3a')]=_[_0x5151('0x3c')](_0x11c580[_0x5151('0x3a')],{'$or':_[_0x5151('0x2e')](_0x89f3e3,function(_0x37fc93){if(_0x37fc93[_0x5151('0x2b')]!==_0x5151('0x3d')){var _0x529b53={};_0x529b53[_0x37fc93[_0x5151('0x25')]]={'$like':'%'+_0x10d6d6[_0x5151('0x2f')][_0x5151('0x3b')]+'%'};return _0x529b53;}})});}_0x11c580=_[_0x5151('0x3c')]({},_0x11c580,_0x10d6d6[_0x5151('0x3e')]);var _0x26aefc={'where':_0x11c580[_0x5151('0x3a')]};return db[_0x5151('0x28')][_0x5151('0x1e')](_0x26aefc)[_0x5151('0x22')](function(_0x414ef9){_0x495efb[_0x5151('0x1e')]=_0x414ef9;if(_0x10d6d6[_0x5151('0x2f')][_0x5151('0x3f')]){_0x11c580[_0x5151('0x40')]=[{'all':!![]}];}return db[_0x5151('0x28')][_0x5151('0x41')](_0x11c580);})['then'](function(_0x332f00){_0x495efb[_0x5151('0x42')]=_0x332f00;return _0x495efb;})['then'](respondWithFilteredResult(_0x19c06d,_0x11c580))[_0x5151('0x43')](handleError(_0x19c06d,null));};exports['show']=function(_0x30fc8b,_0x15593f){var _0x3f5da0={'raw':!![],'where':{'id':_0x30fc8b[_0x5151('0x44')]['id']}},_0x288d60={};_0x288d60[_0x5151('0x2d')]=_[_0x5151('0x30')](db[_0x5151('0x28')][_0x5151('0x29')]);_0x288d60[_0x5151('0x2f')]=_[_0x5151('0x30')](_0x30fc8b[_0x5151('0x2f')]);_0x288d60[_0x5151('0x31')]=_[_0x5151('0x32')](_0x288d60['model'],_0x288d60[_0x5151('0x2f')]);_0x3f5da0[_0x5151('0x33')]=_[_0x5151('0x32')](_0x288d60['model'],qs[_0x5151('0x34')](_0x30fc8b[_0x5151('0x2f')][_0x5151('0x34')]));_0x3f5da0[_0x5151('0x33')]=_0x3f5da0[_0x5151('0x33')][_0x5151('0x35')]?_0x3f5da0['attributes']:_0x288d60[_0x5151('0x2d')];if(_0x30fc8b['query'][_0x5151('0x3f')]){_0x3f5da0[_0x5151('0x40')]=[{'all':!![]}];}_0x3f5da0=_[_0x5151('0x3c')]({},_0x3f5da0,_0x30fc8b[_0x5151('0x3e')]);return db[_0x5151('0x28')][_0x5151('0x45')](_0x3f5da0)[_0x5151('0x22')](handleEntityNotFound(_0x15593f,null))['then'](respondWithResult(_0x15593f,null))[_0x5151('0x43')](handleError(_0x15593f,null));};exports[_0x5151('0x46')]=function(_0x1cc016,_0x933fcd){return db[_0x5151('0x28')][_0x5151('0x46')](_0x1cc016['body'],{})[_0x5151('0x22')](respondWithResult(_0x933fcd,0xc9))[_0x5151('0x43')](handleError(_0x933fcd,null));};exports[_0x5151('0x47')]=function(_0x5ecada,_0x9d01d9){if(_0x5ecada['body']['id']){delete _0x5ecada[_0x5151('0x48')]['id'];}return db['ServicenowField'][_0x5151('0x45')]({'where':{'id':_0x5ecada['params']['id']}})[_0x5151('0x22')](handleEntityNotFound(_0x9d01d9,null))['then'](saveUpdates(_0x5ecada['body'],null))['then'](respondWithResult(_0x9d01d9,null))['catch'](handleError(_0x9d01d9,null));};exports[_0x5151('0x49')]=function(_0x5d7394,_0xd1bdd7){return db[_0x5151('0x28')]['find']({'where':{'id':_0x5d7394[_0x5151('0x44')]['id']}})[_0x5151('0x22')](handleEntityNotFound(_0xd1bdd7,null))[_0x5151('0x22')](removeEntity(_0xd1bdd7,null))[_0x5151('0x43')](handleError(_0xd1bdd7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 70ba25b..1aed526 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 _0xcf7b=['servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xcf7b,0xb9));var _0xbcf7=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xcf7b[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xbcf7('0x0'));var util=require(_0xbcf7('0x1'));var logger=require(_0xbcf7('0x2'))(_0xbcf7('0x3'));var moment=require(_0xbcf7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcf7('0x5'));var rimraf=require(_0xbcf7('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0xbcf7('0x7')]=function(_0x448b0d,_0x55f523){return _0x448b0d[_0xbcf7('0x8')](_0xbcf7('0x9'),attributes,{'tableName':_0xbcf7('0xa'),'paranoid':![],'indexes':[{'name':_0xbcf7('0xb'),'fields':[_0xbcf7('0xc'),_0xbcf7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x292c=['idField','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','ServicenowField','int_servicenow_fields'];(function(_0xe00d48,_0x59414a){var _0x1a2b19=function(_0x5b112){while(--_0x5b112){_0xe00d48['push'](_0xe00d48['shift']());}};_0x1a2b19(++_0x59414a);}(_0x292c,0x12d));var _0xc292=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x292c[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0xc292('0x0'));var util=require(_0xc292('0x1'));var logger=require('../../config/logger')(_0xc292('0x2'));var moment=require(_0xc292('0x3'));var BPromise=require('bluebird');var rp=require(_0xc292('0x4'));var fs=require('fs');var path=require(_0xc292('0x5'));var rimraf=require('rimraf');var config=require(_0xc292('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xc292('0x7')]=function(_0x38a123,_0x36cc50){return _0x38a123[_0xc292('0x8')](_0xc292('0x9'),attributes,{'tableName':_0xc292('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xc292('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 165782b..f1ddbc2 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x9adf1b,_0x3ac695){var _0x960269=function(_0x368ca6){while(--_0x368ca6){_0x9adf1b['push'](_0x9adf1b['shift']());}};_0x960269(++_0x3ac695);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x31ba1a,_0x4e88ce){var _0xf8402b=function(_0x15c426){while(--_0x15c426){_0x31ba1a['push'](_0x31ba1a['shift']());}};_0xf8402b(++_0x4e88ce);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2710db,_0x583fb9){_0x2710db=_0x2710db-0x0;var _0x355927=_0xf4eb[_0x2710db];return _0x355927;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 859f21b..009f6a0 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x28b61c,_0x818415){var _0x1f0f6f=function(_0x129630){while(--_0x129630){_0x28b61c['push'](_0x28b61c['shift']());}};_0x1f0f6f(++_0x818415);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x179da2,_0x41489c){var _0x16bbf3=function(_0x43c356){while(--_0x43c356){_0x179da2['push'](_0x179da2['shift']());}};_0x16bbf3(++_0x41489c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 91c4bda..1628d2e 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x12df7d,_0x3957c0){var _0x49571d=function(_0x8d71a2){while(--_0x8d71a2){_0x12df7d['push'](_0x12df7d['shift']());}};_0x49571d(++_0x3957c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4c512e,_0x3b89ca){var _0x538ba6=function(_0x1ef163){while(--_0x1ef163){_0x4c512e['push'](_0x4c512e['shift']());}};_0x538ba6(++_0x3b89ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 8dbbf55..236f2aa 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 _0xba23=['Content-Range','apply','reject','save','update','then','error','stack','name','send','SugarcrmAccount','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','find','create','body','destroy','params','findOne','rawAttributes','getConfigurations','AccountId','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','Calls','values','module_fields','remove','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set'];(function(_0x332b7d,_0x326638){var _0x393dac=function(_0x579dcf){while(--_0x579dcf){_0x332b7d['push'](_0x332b7d['shift']());}};_0x393dac(++_0x326638);}(_0xba23,0x13a));var _0x3ba2=function(_0x39a54b,_0x2c7641){_0x39a54b=_0x39a54b-0x0;var _0x290572=_0xba23[_0x39a54b];return _0x290572;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ba2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ba2('0x1'));var rp=require(_0x3ba2('0x2'));var moment=require('moment');var BPromise=require(_0x3ba2('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3ba2('0x4'));var sox=require(_0x3ba2('0x5'));var csv=require(_0x3ba2('0x6'));var ejs=require(_0x3ba2('0x7'));var fs=require('fs');var fs_extra=require(_0x3ba2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ba2('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3ba2('0x6'));var querystring=require(_0x3ba2('0xa'));var Papa=require('papaparse');var Redis=require(_0x3ba2('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3ba2('0xc'));var hardwareService=require(_0x3ba2('0xd'));var logger=require(_0x3ba2('0xe'))('api');var utils=require(_0x3ba2('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x3ba2('0x10'));var db=require(_0x3ba2('0x11'))['db'];var integrations=require(_0x3ba2('0x12'));function respondWithStatusCode(_0x3bda42,_0x310b68){_0x310b68=_0x310b68||0xcc;return function(_0x538ceb){if(_0x538ceb){return _0x3bda42[_0x3ba2('0x13')](_0x310b68);}return _0x3bda42['status'](_0x310b68)[_0x3ba2('0x14')]();};}function respondWithResult(_0x17a817,_0x49d4ff){_0x49d4ff=_0x49d4ff||0xc8;return function(_0x2c56aa){if(_0x2c56aa){return _0x17a817[_0x3ba2('0x15')](_0x49d4ff)[_0x3ba2('0x16')](_0x2c56aa);}};}function respondWithFilteredResult(_0x343b0c,_0x470198){return function(_0x3407fc){if(_0x3407fc){var _0x34c7a6=typeof _0x470198[_0x3ba2('0x17')]===_0x3ba2('0x18')&&typeof _0x470198['limit']===_0x3ba2('0x18');var _0x135775=_0x3407fc[_0x3ba2('0x19')];var _0x23f93f=_0x34c7a6?0x0:_0x470198[_0x3ba2('0x17')];var _0x5078dd=_0x34c7a6?_0x3407fc['count']:_0x470198['offset']+_0x470198[_0x3ba2('0x1a')];var _0x2c6491;if(_0x5078dd>=_0x135775){_0x5078dd=_0x135775;_0x2c6491=0xc8;}else{_0x2c6491=0xce;}_0x343b0c[_0x3ba2('0x15')](_0x2c6491);return _0x343b0c[_0x3ba2('0x1b')](_0x3ba2('0x1c'),_0x23f93f+'-'+_0x5078dd+'/'+_0x135775)['json'](_0x3407fc);}return null;};}function patchUpdates(_0x58a090){return function(_0x47a4cf){try{jsonpatch[_0x3ba2('0x1d')](_0x47a4cf,_0x58a090,!![]);}catch(_0x3d25ee){return BPromise[_0x3ba2('0x1e')](_0x3d25ee);}return _0x47a4cf[_0x3ba2('0x1f')]();};}function saveUpdates(_0x59a895,_0x4eeae6){return function(_0x5b20d5){if(_0x5b20d5){return _0x5b20d5[_0x3ba2('0x20')](_0x59a895)[_0x3ba2('0x21')](function(_0x1097d2){return _0x1097d2;});}return null;};}function removeEntity(_0x22413a,_0x16ff05){return function(_0x3829c2){if(_0x3829c2){return _0x3829c2['destroy']()[_0x3ba2('0x21')](function(){_0x22413a['status'](0xcc)[_0x3ba2('0x14')]();});}};}function handleEntityNotFound(_0x5c928e,_0x1f30c7){return function(_0x1e9032){if(!_0x1e9032){_0x5c928e['sendStatus'](0x194);}return _0x1e9032;};}function handleError(_0x2e8d28,_0x467df9){_0x467df9=_0x467df9||0x1f4;return function(_0x2e3d0e){logger[_0x3ba2('0x22')](_0x2e3d0e[_0x3ba2('0x23')]);if(_0x2e3d0e[_0x3ba2('0x24')]){delete _0x2e3d0e[_0x3ba2('0x24')];}_0x2e8d28[_0x3ba2('0x15')](_0x467df9)[_0x3ba2('0x25')](_0x2e3d0e);};}exports['index']=function(_0x46439,_0x588774){var _0x44b410={},_0x284b8e={},_0x355110={'count':0x0,'rows':[]};var _0x290eee=_['map'](db[_0x3ba2('0x26')]['rawAttributes'],function(_0x352271){return{'name':_0x352271['fieldName'],'type':_0x352271[_0x3ba2('0x27')][_0x3ba2('0x28')]};});_0x284b8e[_0x3ba2('0x29')]=_[_0x3ba2('0x2a')](_0x290eee,_0x3ba2('0x24'));_0x284b8e['query']=_['keys'](_0x46439[_0x3ba2('0x2b')]);_0x284b8e[_0x3ba2('0x2c')]=_[_0x3ba2('0x2d')](_0x284b8e[_0x3ba2('0x29')],_0x284b8e['query']);_0x44b410[_0x3ba2('0x2e')]=_[_0x3ba2('0x2d')](_0x284b8e[_0x3ba2('0x29')],qs['fields'](_0x46439[_0x3ba2('0x2b')][_0x3ba2('0x2f')]));_0x44b410[_0x3ba2('0x2e')]=_0x44b410[_0x3ba2('0x2e')]['length']?_0x44b410[_0x3ba2('0x2e')]:_0x284b8e['model'];if(!_0x46439[_0x3ba2('0x2b')][_0x3ba2('0x30')](_0x3ba2('0x31'))){_0x44b410[_0x3ba2('0x1a')]=qs[_0x3ba2('0x1a')](_0x46439[_0x3ba2('0x2b')][_0x3ba2('0x1a')]);_0x44b410[_0x3ba2('0x17')]=qs[_0x3ba2('0x17')](_0x46439[_0x3ba2('0x2b')][_0x3ba2('0x17')]);}_0x44b410[_0x3ba2('0x32')]=qs[_0x3ba2('0x33')](_0x46439[_0x3ba2('0x2b')][_0x3ba2('0x33')]);_0x44b410[_0x3ba2('0x34')]=qs[_0x3ba2('0x2c')](_[_0x3ba2('0x35')](_0x46439[_0x3ba2('0x2b')],_0x284b8e[_0x3ba2('0x2c')]),_0x290eee);if(_0x46439[_0x3ba2('0x2b')][_0x3ba2('0x36')]){_0x44b410['where']=_[_0x3ba2('0x37')](_0x44b410['where'],{'$or':_['map'](_0x290eee,function(_0x50fcb5){if(_0x50fcb5[_0x3ba2('0x27')]!==_0x3ba2('0x38')){var _0x4167e5={};_0x4167e5[_0x50fcb5['name']]={'$like':'%'+_0x46439[_0x3ba2('0x2b')][_0x3ba2('0x36')]+'%'};return _0x4167e5;}})});}_0x44b410=_['merge']({},_0x44b410,_0x46439[_0x3ba2('0x39')]);var _0x5e5759={'where':_0x44b410['where']};return db['SugarcrmAccount'][_0x3ba2('0x19')](_0x5e5759)['then'](function(_0xbe88d2){_0x355110['count']=_0xbe88d2;if(_0x46439[_0x3ba2('0x2b')][_0x3ba2('0x3a')]){_0x44b410[_0x3ba2('0x3b')]=[{'all':!![]}];}return db[_0x3ba2('0x26')][_0x3ba2('0x3c')](_0x44b410);})[_0x3ba2('0x21')](function(_0x5bb334){_0x355110[_0x3ba2('0x3d')]=_0x5bb334;return _0x355110;})[_0x3ba2('0x21')](respondWithFilteredResult(_0x588774,_0x44b410))[_0x3ba2('0x3e')](handleError(_0x588774,null));};exports['show']=function(_0x14b941,_0x544a6a){var _0x53ece0={'raw':![],'where':{'id':_0x14b941['params']['id']}},_0x2df047={};_0x2df047[_0x3ba2('0x29')]=_[_0x3ba2('0x3f')](db[_0x3ba2('0x26')]['rawAttributes']);_0x2df047[_0x3ba2('0x2b')]=_[_0x3ba2('0x3f')](_0x14b941[_0x3ba2('0x2b')]);_0x2df047[_0x3ba2('0x2c')]=_[_0x3ba2('0x2d')](_0x2df047[_0x3ba2('0x29')],_0x2df047[_0x3ba2('0x2b')]);_0x53ece0[_0x3ba2('0x2e')]=_[_0x3ba2('0x2d')](_0x2df047[_0x3ba2('0x29')],qs[_0x3ba2('0x2f')](_0x14b941[_0x3ba2('0x2b')][_0x3ba2('0x2f')]));_0x53ece0['attributes']=_0x53ece0[_0x3ba2('0x2e')][_0x3ba2('0x40')]?_0x53ece0[_0x3ba2('0x2e')]:_0x2df047['model'];if(_0x14b941['query'][_0x3ba2('0x3a')]){_0x53ece0['include']=[{'all':!![]}];}_0x53ece0=_['merge']({},_0x53ece0,_0x14b941[_0x3ba2('0x39')]);return db[_0x3ba2('0x26')][_0x3ba2('0x41')](_0x53ece0)[_0x3ba2('0x21')](handleEntityNotFound(_0x544a6a,null))[_0x3ba2('0x21')](respondWithResult(_0x544a6a,null))['catch'](handleError(_0x544a6a,null));};exports['create']=function(_0x883abe,_0x1bccd0){return db['SugarcrmAccount'][_0x3ba2('0x42')](_0x883abe[_0x3ba2('0x43')],{})[_0x3ba2('0x21')](respondWithResult(_0x1bccd0,0xc9))['catch'](handleError(_0x1bccd0,null));};exports['update']=function(_0x489135,_0x2da18b){if(_0x489135[_0x3ba2('0x43')]['id']){delete _0x489135['body']['id'];}return db[_0x3ba2('0x26')]['find']({'where':{'id':_0x489135['params']['id']}})[_0x3ba2('0x21')](handleEntityNotFound(_0x2da18b,null))[_0x3ba2('0x21')](saveUpdates(_0x489135[_0x3ba2('0x43')],null))['then'](respondWithResult(_0x2da18b,null))[_0x3ba2('0x3e')](handleError(_0x2da18b,null));};exports[_0x3ba2('0x44')]=function(_0x3bc574,_0x3cdada){return db[_0x3ba2('0x26')][_0x3ba2('0x41')]({'where':{'id':_0x3bc574[_0x3ba2('0x45')]['id']}})[_0x3ba2('0x21')](handleEntityNotFound(_0x3cdada,null))[_0x3ba2('0x21')](removeEntity(_0x3cdada,null))[_0x3ba2('0x3e')](handleError(_0x3cdada,null));};exports['getConfigurations']=function(_0x3a8181,_0x57757b,_0x10c17d){var _0x503bdf={};var _0x3e8f3c={};var _0x14deed;var _0x1efa04;return db['SugarcrmAccount'][_0x3ba2('0x46')]({'where':{'id':_0x3a8181[_0x3ba2('0x45')]['id']}})['then'](handleEntityNotFound(_0x57757b,null))['then'](function(_0x414e0e){if(_0x414e0e){_0x14deed=_0x414e0e;_0x3e8f3c['model']=_['keys'](db['SugarcrmConfiguration'][_0x3ba2('0x47')]);_0x3e8f3c['query']=_[_0x3ba2('0x3f')](_0x3a8181[_0x3ba2('0x2b')]);_0x3e8f3c[_0x3ba2('0x2c')]=_[_0x3ba2('0x2d')](_0x3e8f3c['model'],_0x3e8f3c[_0x3ba2('0x2b')]);_0x503bdf['attributes']=_[_0x3ba2('0x2d')](_0x3e8f3c[_0x3ba2('0x29')],qs[_0x3ba2('0x2f')](_0x3a8181['query'][_0x3ba2('0x2f')]));_0x503bdf[_0x3ba2('0x2e')]=_0x503bdf[_0x3ba2('0x2e')][_0x3ba2('0x40')]?_0x503bdf[_0x3ba2('0x2e')]:_0x3e8f3c[_0x3ba2('0x29')];_0x503bdf[_0x3ba2('0x32')]=qs[_0x3ba2('0x33')](_0x3a8181[_0x3ba2('0x2b')]['sort']);_0x503bdf[_0x3ba2('0x34')]=qs[_0x3ba2('0x2c')](_[_0x3ba2('0x35')](_0x3a8181['query'],_0x3e8f3c[_0x3ba2('0x2c')]));if(_0x3a8181[_0x3ba2('0x2b')]['filter']){_0x503bdf[_0x3ba2('0x34')]=_[_0x3ba2('0x37')](_0x503bdf[_0x3ba2('0x34')],{'$or':_['map'](_0x503bdf[_0x3ba2('0x2e')],function(_0x5c6b45){var _0x3d2869={};_0x3d2869[_0x5c6b45]={'$like':'%'+_0x3a8181[_0x3ba2('0x2b')][_0x3ba2('0x36')]+'%'};return _0x3d2869;})});}_0x503bdf=_[_0x3ba2('0x37')]({},_0x503bdf,_0x3a8181[_0x3ba2('0x39')]);return _0x14deed['getConfigurations'](_0x503bdf);}})[_0x3ba2('0x21')](function(_0x1739a9){if(_0x1739a9){_0x1efa04=_0x1739a9['length'];if(!_0x3a8181[_0x3ba2('0x2b')][_0x3ba2('0x30')](_0x3ba2('0x31'))){_0x503bdf[_0x3ba2('0x1a')]=qs[_0x3ba2('0x1a')](_0x3a8181[_0x3ba2('0x2b')]['limit']);_0x503bdf[_0x3ba2('0x17')]=qs['offset'](_0x3a8181[_0x3ba2('0x2b')][_0x3ba2('0x17')]);}return _0x14deed[_0x3ba2('0x48')](_0x503bdf);}})[_0x3ba2('0x21')](function(_0x395b7a){if(_0x395b7a){return _0x395b7a?{'count':_0x1efa04,'rows':_0x395b7a}:null;}})[_0x3ba2('0x21')](respondWithResult(_0x57757b,null))[_0x3ba2('0x3e')](handleError(_0x57757b,null));};exports['addConfiguration']=function(_0x50a33b,_0x486474,_0x17c005){if(_0x50a33b[_0x3ba2('0x43')]['id']){delete _0x50a33b[_0x3ba2('0x43')]['id'];}return db['SugarcrmAccount'][_0x3ba2('0x46')]({'where':{'id':_0x50a33b[_0x3ba2('0x45')]['id']}})[_0x3ba2('0x21')](handleEntityNotFound(_0x486474,null))[_0x3ba2('0x21')](function(_0x12f4dc){if(_0x12f4dc){_0x50a33b['body'][_0x3ba2('0x49')]=_0x12f4dc['id'];_0x50a33b[_0x3ba2('0x43')]['Subjects']=integrations['getSubjects'](_0x50a33b[_0x3ba2('0x43')][_0x3ba2('0x4a')],_0x50a33b[_0x3ba2('0x43')][_0x3ba2('0x27')]);_0x50a33b[_0x3ba2('0x43')]['Descriptions']=integrations[_0x3ba2('0x4b')](_0x50a33b[_0x3ba2('0x43')][_0x3ba2('0x4a')],_0x50a33b[_0x3ba2('0x43')][_0x3ba2('0x27')]);return db[_0x3ba2('0x4c')]['create'](_0x50a33b['body'],{'include':[{'model':db[_0x3ba2('0x4d')],'as':_0x3ba2('0x4e')},{'model':db[_0x3ba2('0x4d')],'as':'Descriptions'}]});}return null;})[_0x3ba2('0x21')](respondWithResult(_0x486474,null))[_0x3ba2('0x3e')](handleError(_0x486474,null));};exports[_0x3ba2('0x4f')]=function(_0x54109a,_0x1d748a,_0x246ca4){var _0x5aa875='';var _0x2d3daa=['id',_0x3ba2('0x24'),_0x3ba2('0x50'),_0x3ba2('0x51'),_0x3ba2('0x52'),'date_start',_0x3ba2('0x53'),_0x3ba2('0x54'),_0x3ba2('0x55'),'parent_type',_0x3ba2('0x56'),_0x3ba2('0x57')];return db[_0x3ba2('0x26')][_0x3ba2('0x46')]({'where':{'id':_0x54109a['params']['id']},'attributes':['id',_0x3ba2('0x58'),'password',_0x3ba2('0x59')]})[_0x3ba2('0x21')](handleEntityNotFound(_0x1d748a,null))['then'](function(_0x2e56af){if(_0x2e56af){_0x5aa875=_0x2e56af[_0x3ba2('0x59')];var _0x5a6697=_0x5aa875[_0x3ba2('0x5a')](-0x1);if(_0x5a6697==='/'){_0x5aa875=_0x5aa875[_0x3ba2('0x5b')](0x0,_0x5aa875[_0x3ba2('0x5c')](_0x5a6697));}return rp({'method':_0x3ba2('0x5d'),'uri':util[_0x3ba2('0x5e')](_0x3ba2('0x5f'),_0x5aa875,_0x3ba2('0x60')),'json':!![],'form':{'method':_0x3ba2('0x61'),'input_type':_0x3ba2('0x62'),'response_type':_0x3ba2('0x62'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2e56af['username'],'password':_0x2e56af[_0x3ba2('0x63')],'encryption':_0x3ba2('0x64')},'application':_0x3ba2('0x65')})}});}})[_0x3ba2('0x21')](function(_0x472212){if(_0x472212&&_0x472212['name']!=='Invalid\x20Login'&&_0x472212[_0x3ba2('0x24')]!==_0x3ba2('0x66')){return rp({'method':_0x3ba2('0x5d'),'uri':util[_0x3ba2('0x5e')](_0x3ba2('0x5f'),_0x5aa875,_0x3ba2('0x60')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x3ba2('0x62'),'rest_data':JSON['stringify']({'session':_0x472212['id'],'module_name':_0x3ba2('0x67')})}})[_0x3ba2('0x21')](function(_0x19aba6){if(_0x19aba6){var _0x3c9c47=_[_0x3ba2('0x68')](_0x19aba6[_0x3ba2('0x69')]);_[_0x3ba2('0x6a')](_0x3c9c47,function(_0x331243){return _0x2d3daa['includes'](_0x331243['name']);});return{'count':_0x3c9c47[_0x3ba2('0x40')],'rows':_['map'](_0x3c9c47,function(_0x4c930a){return{'id':_0x4c930a[_0x3ba2('0x24')],'name':_0x4c930a[_0x3ba2('0x6b')],'custom':_[_0x3ba2('0x6c')](_0x4c930a['name'],'_c')?!![]:![],'options':_0x4c930a[_0x3ba2('0x39')]?_[_0x3ba2('0x2a')](_[_0x3ba2('0x68')](_0x4c930a[_0x3ba2('0x39')]),function(_0x5edcb1){return{'name':_0x5edcb1['value'],'value':_0x5edcb1[_0x3ba2('0x24')]};}):[]};})};}})[_0x3ba2('0x21')](respondWithResult(_0x1d748a,null))[_0x3ba2('0x3e')](function(_0x5d5307){var _0x3f9c49=_0x54109a[_0x3ba2('0x2b')][_0x3ba2('0x6d')]?0x1f4:_0x5d5307[_0x3ba2('0x6e')]||0x1f4;logger[_0x3ba2('0x22')](_0x3ba2('0x6f'),_0x3ba2('0x4f'),_0x3f9c49,JSON[_0x3ba2('0x70')](_0x5d5307));delete _0x5d5307[_0x3ba2('0x24')];if(_0x3f9c49===0x191){_0x3f9c49=0x190;}_0x1d748a[_0x3ba2('0x15')](_0x3f9c49)[_0x3ba2('0x25')](_0x54109a[_0x3ba2('0x2b')][_0x3ba2('0x6d')]?{'message':_0x3ba2('0x71'),'statusCode':_0x5d5307[_0x3ba2('0x6e')]}:_0x5d5307);});}else{var _0x1b167c=0x1f4;_0x1d748a[_0x3ba2('0x15')](_0x1b167c)['send']({'message':_0x3ba2('0x71'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x209c=['params','includeAll','find','catch','create','body','getConfigurations','findOne','keys','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','values','module_fields','remove','includes','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmAccount','findAll'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x209c,0x1a5));var _0xc209=function(_0x24f5e4,_0x51c3a3){_0x24f5e4=_0x24f5e4-0x0;var _0x9f6f18=_0x209c[_0x24f5e4];return _0x9f6f18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc209('0x0'));var zipdir=require(_0xc209('0x1'));var jsonpatch=require(_0xc209('0x2'));var rp=require(_0xc209('0x3'));var moment=require('moment');var BPromise=require(_0xc209('0x4'));var Mustache=require(_0xc209('0x5'));var util=require('util');var path=require(_0xc209('0x6'));var sox=require(_0xc209('0x7'));var csv=require(_0xc209('0x8'));var ejs=require(_0xc209('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc209('0xa'));var squel=require(_0xc209('0xb'));var crypto=require(_0xc209('0xc'));var jsforce=require(_0xc209('0xd'));var deskjs=require(_0xc209('0xe'));var toCsv=require(_0xc209('0x8'));var querystring=require('querystring');var Papa=require(_0xc209('0xf'));var Redis=require('ioredis');var authService=require(_0xc209('0x10'));var qs=require(_0xc209('0x11'));var as=require(_0xc209('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc209('0x13'))(_0xc209('0x14'));var utils=require(_0xc209('0x15'));var config=require(_0xc209('0x16'));var licenseUtil=require(_0xc209('0x17'));var db=require(_0xc209('0x18'))['db'];var integrations=require(_0xc209('0x19'));function respondWithStatusCode(_0xc2b3b9,_0x29e7f6){_0x29e7f6=_0x29e7f6||0xcc;return function(_0x2e5c4f){if(_0x2e5c4f){return _0xc2b3b9[_0xc209('0x1a')](_0x29e7f6);}return _0xc2b3b9[_0xc209('0x1b')](_0x29e7f6)[_0xc209('0x1c')]();};}function respondWithResult(_0x515d88,_0x34d8f1){_0x34d8f1=_0x34d8f1||0xc8;return function(_0x2712c8){if(_0x2712c8){return _0x515d88['status'](_0x34d8f1)[_0xc209('0x1d')](_0x2712c8);}};}function respondWithFilteredResult(_0x52db12,_0x2fc32a){return function(_0xa0eb1){if(_0xa0eb1){var _0xc7421e=typeof _0x2fc32a['offset']==='undefined'&&typeof _0x2fc32a[_0xc209('0x1e')]===_0xc209('0x1f');var _0x18756c=_0xa0eb1[_0xc209('0x20')];var _0x3bf586=_0xc7421e?0x0:_0x2fc32a[_0xc209('0x21')];var _0x470d64=_0xc7421e?_0xa0eb1[_0xc209('0x20')]:_0x2fc32a[_0xc209('0x21')]+_0x2fc32a[_0xc209('0x1e')];var _0x3f2836;if(_0x470d64>=_0x18756c){_0x470d64=_0x18756c;_0x3f2836=0xc8;}else{_0x3f2836=0xce;}_0x52db12[_0xc209('0x1b')](_0x3f2836);return _0x52db12[_0xc209('0x22')](_0xc209('0x23'),_0x3bf586+'-'+_0x470d64+'/'+_0x18756c)['json'](_0xa0eb1);}return null;};}function patchUpdates(_0x3d8a0f){return function(_0x2ddfb8){try{jsonpatch[_0xc209('0x24')](_0x2ddfb8,_0x3d8a0f,!![]);}catch(_0x52b120){return BPromise[_0xc209('0x25')](_0x52b120);}return _0x2ddfb8[_0xc209('0x26')]();};}function saveUpdates(_0x440f86,_0x44a1d3){return function(_0x4e5f74){if(_0x4e5f74){return _0x4e5f74[_0xc209('0x27')](_0x440f86)[_0xc209('0x28')](function(_0xc091f5){return _0xc091f5;});}return null;};}function removeEntity(_0x2af79c,_0x90dad2){return function(_0x3facb4){if(_0x3facb4){return _0x3facb4[_0xc209('0x29')]()[_0xc209('0x28')](function(){_0x2af79c[_0xc209('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484260,_0x36d563){return function(_0x33375c){if(!_0x33375c){_0x484260['sendStatus'](0x194);}return _0x33375c;};}function handleError(_0x463606,_0x2f273d){_0x2f273d=_0x2f273d||0x1f4;return function(_0x89b16a){logger[_0xc209('0x2a')](_0x89b16a[_0xc209('0x2b')]);if(_0x89b16a['name']){delete _0x89b16a[_0xc209('0x2c')];}_0x463606[_0xc209('0x1b')](_0x2f273d)[_0xc209('0x2d')](_0x89b16a);};}exports[_0xc209('0x2e')]=function(_0x26dd67,_0x48a4ef){var _0x47196f={},_0x4a330f={},_0x182601={'count':0x0,'rows':[]};var _0x387b16=_[_0xc209('0x2f')](db['SugarcrmAccount'][_0xc209('0x30')],function(_0x4abcbf){return{'name':_0x4abcbf[_0xc209('0x31')],'type':_0x4abcbf[_0xc209('0x32')][_0xc209('0x33')]};});_0x4a330f[_0xc209('0x34')]=_[_0xc209('0x2f')](_0x387b16,_0xc209('0x2c'));_0x4a330f[_0xc209('0x35')]=_['keys'](_0x26dd67[_0xc209('0x35')]);_0x4a330f[_0xc209('0x36')]=_[_0xc209('0x37')](_0x4a330f['model'],_0x4a330f[_0xc209('0x35')]);_0x47196f[_0xc209('0x38')]=_[_0xc209('0x37')](_0x4a330f[_0xc209('0x34')],qs[_0xc209('0x39')](_0x26dd67[_0xc209('0x35')][_0xc209('0x39')]));_0x47196f['attributes']=_0x47196f[_0xc209('0x38')][_0xc209('0x3a')]?_0x47196f[_0xc209('0x38')]:_0x4a330f[_0xc209('0x34')];if(!_0x26dd67['query'][_0xc209('0x3b')](_0xc209('0x3c'))){_0x47196f[_0xc209('0x1e')]=qs[_0xc209('0x1e')](_0x26dd67[_0xc209('0x35')][_0xc209('0x1e')]);_0x47196f[_0xc209('0x21')]=qs[_0xc209('0x21')](_0x26dd67['query'][_0xc209('0x21')]);}_0x47196f[_0xc209('0x3d')]=qs[_0xc209('0x3e')](_0x26dd67[_0xc209('0x35')]['sort']);_0x47196f[_0xc209('0x3f')]=qs[_0xc209('0x36')](_[_0xc209('0x40')](_0x26dd67['query'],_0x4a330f['filters']),_0x387b16);if(_0x26dd67[_0xc209('0x35')][_0xc209('0x41')]){_0x47196f[_0xc209('0x3f')]=_[_0xc209('0x42')](_0x47196f[_0xc209('0x3f')],{'$or':_['map'](_0x387b16,function(_0x88d3d3){if(_0x88d3d3[_0xc209('0x32')]!==_0xc209('0x43')){var _0x162274={};_0x162274[_0x88d3d3[_0xc209('0x2c')]]={'$like':'%'+_0x26dd67[_0xc209('0x35')]['filter']+'%'};return _0x162274;}})});}_0x47196f=_[_0xc209('0x42')]({},_0x47196f,_0x26dd67[_0xc209('0x44')]);var _0x4f8ed1={'where':_0x47196f[_0xc209('0x3f')]};return db[_0xc209('0x45')][_0xc209('0x20')](_0x4f8ed1)['then'](function(_0x427ae3){_0x182601[_0xc209('0x20')]=_0x427ae3;if(_0x26dd67['query']['includeAll']){_0x47196f['include']=[{'all':!![]}];}return db[_0xc209('0x45')][_0xc209('0x46')](_0x47196f);})['then'](function(_0x446287){_0x182601['rows']=_0x446287;return _0x182601;})[_0xc209('0x28')](respondWithFilteredResult(_0x48a4ef,_0x47196f))['catch'](handleError(_0x48a4ef,null));};exports['show']=function(_0x46c9ae,_0x5c0a9a){var _0x18aa9f={'raw':![],'where':{'id':_0x46c9ae[_0xc209('0x47')]['id']}},_0x3f4ffa={};_0x3f4ffa[_0xc209('0x34')]=_['keys'](db[_0xc209('0x45')][_0xc209('0x30')]);_0x3f4ffa['query']=_['keys'](_0x46c9ae[_0xc209('0x35')]);_0x3f4ffa['filters']=_[_0xc209('0x37')](_0x3f4ffa[_0xc209('0x34')],_0x3f4ffa[_0xc209('0x35')]);_0x18aa9f[_0xc209('0x38')]=_[_0xc209('0x37')](_0x3f4ffa[_0xc209('0x34')],qs[_0xc209('0x39')](_0x46c9ae[_0xc209('0x35')][_0xc209('0x39')]));_0x18aa9f[_0xc209('0x38')]=_0x18aa9f[_0xc209('0x38')][_0xc209('0x3a')]?_0x18aa9f[_0xc209('0x38')]:_0x3f4ffa[_0xc209('0x34')];if(_0x46c9ae[_0xc209('0x35')][_0xc209('0x48')]){_0x18aa9f['include']=[{'all':!![]}];}_0x18aa9f=_[_0xc209('0x42')]({},_0x18aa9f,_0x46c9ae[_0xc209('0x44')]);return db[_0xc209('0x45')][_0xc209('0x49')](_0x18aa9f)[_0xc209('0x28')](handleEntityNotFound(_0x5c0a9a,null))[_0xc209('0x28')](respondWithResult(_0x5c0a9a,null))[_0xc209('0x4a')](handleError(_0x5c0a9a,null));};exports['create']=function(_0x52c3c3,_0x4b38be){return db[_0xc209('0x45')][_0xc209('0x4b')](_0x52c3c3[_0xc209('0x4c')],{})['then'](respondWithResult(_0x4b38be,0xc9))[_0xc209('0x4a')](handleError(_0x4b38be,null));};exports[_0xc209('0x27')]=function(_0x3746a5,_0x34b5a6){if(_0x3746a5['body']['id']){delete _0x3746a5['body']['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x3746a5['params']['id']}})[_0xc209('0x28')](handleEntityNotFound(_0x34b5a6,null))[_0xc209('0x28')](saveUpdates(_0x3746a5[_0xc209('0x4c')],null))[_0xc209('0x28')](respondWithResult(_0x34b5a6,null))[_0xc209('0x4a')](handleError(_0x34b5a6,null));};exports[_0xc209('0x29')]=function(_0x3ffa01,_0xf27ff7){return db[_0xc209('0x45')][_0xc209('0x49')]({'where':{'id':_0x3ffa01['params']['id']}})['then'](handleEntityNotFound(_0xf27ff7,null))[_0xc209('0x28')](removeEntity(_0xf27ff7,null))[_0xc209('0x4a')](handleError(_0xf27ff7,null));};exports[_0xc209('0x4d')]=function(_0x4ef8ac,_0x145e3b,_0x45c078){var _0x1f4e91={};var _0x1eb3bd={};var _0x3ac52f;var _0x576192;return db[_0xc209('0x45')][_0xc209('0x4e')]({'where':{'id':_0x4ef8ac[_0xc209('0x47')]['id']}})[_0xc209('0x28')](handleEntityNotFound(_0x145e3b,null))[_0xc209('0x28')](function(_0xd22207){if(_0xd22207){_0x3ac52f=_0xd22207;_0x1eb3bd[_0xc209('0x34')]=_[_0xc209('0x4f')](db[_0xc209('0x50')][_0xc209('0x30')]);_0x1eb3bd['query']=_[_0xc209('0x4f')](_0x4ef8ac[_0xc209('0x35')]);_0x1eb3bd['filters']=_[_0xc209('0x37')](_0x1eb3bd['model'],_0x1eb3bd[_0xc209('0x35')]);_0x1f4e91[_0xc209('0x38')]=_['intersection'](_0x1eb3bd[_0xc209('0x34')],qs[_0xc209('0x39')](_0x4ef8ac['query'][_0xc209('0x39')]));_0x1f4e91[_0xc209('0x38')]=_0x1f4e91[_0xc209('0x38')][_0xc209('0x3a')]?_0x1f4e91['attributes']:_0x1eb3bd[_0xc209('0x34')];_0x1f4e91[_0xc209('0x3d')]=qs['sort'](_0x4ef8ac[_0xc209('0x35')][_0xc209('0x3e')]);_0x1f4e91[_0xc209('0x3f')]=qs[_0xc209('0x36')](_['pick'](_0x4ef8ac[_0xc209('0x35')],_0x1eb3bd[_0xc209('0x36')]));if(_0x4ef8ac[_0xc209('0x35')][_0xc209('0x41')]){_0x1f4e91[_0xc209('0x3f')]=_['merge'](_0x1f4e91['where'],{'$or':_['map'](_0x1f4e91['attributes'],function(_0x555b6e){var _0x3398a3={};_0x3398a3[_0x555b6e]={'$like':'%'+_0x4ef8ac[_0xc209('0x35')]['filter']+'%'};return _0x3398a3;})});}_0x1f4e91=_[_0xc209('0x42')]({},_0x1f4e91,_0x4ef8ac[_0xc209('0x44')]);return _0x3ac52f[_0xc209('0x4d')](_0x1f4e91);}})['then'](function(_0x419a87){if(_0x419a87){_0x576192=_0x419a87[_0xc209('0x3a')];if(!_0x4ef8ac[_0xc209('0x35')][_0xc209('0x3b')](_0xc209('0x3c'))){_0x1f4e91['limit']=qs[_0xc209('0x1e')](_0x4ef8ac[_0xc209('0x35')]['limit']);_0x1f4e91[_0xc209('0x21')]=qs[_0xc209('0x21')](_0x4ef8ac[_0xc209('0x35')][_0xc209('0x21')]);}return _0x3ac52f[_0xc209('0x4d')](_0x1f4e91);}})[_0xc209('0x28')](function(_0x1cc0ca){if(_0x1cc0ca){return _0x1cc0ca?{'count':_0x576192,'rows':_0x1cc0ca}:null;}})[_0xc209('0x28')](respondWithResult(_0x145e3b,null))[_0xc209('0x4a')](handleError(_0x145e3b,null));};exports[_0xc209('0x51')]=function(_0x93d5c,_0x30f746,_0x1a86b2){if(_0x93d5c[_0xc209('0x4c')]['id']){delete _0x93d5c[_0xc209('0x4c')]['id'];}return db[_0xc209('0x45')][_0xc209('0x4e')]({'where':{'id':_0x93d5c[_0xc209('0x47')]['id']}})[_0xc209('0x28')](handleEntityNotFound(_0x30f746,null))[_0xc209('0x28')](function(_0x4deb5c){if(_0x4deb5c){_0x93d5c[_0xc209('0x4c')][_0xc209('0x52')]=_0x4deb5c['id'];_0x93d5c[_0xc209('0x4c')][_0xc209('0x53')]=integrations[_0xc209('0x54')](_0x93d5c['body'][_0xc209('0x55')],_0x93d5c[_0xc209('0x4c')][_0xc209('0x32')]);_0x93d5c[_0xc209('0x4c')][_0xc209('0x56')]=integrations['getDescriptions'](_0x93d5c[_0xc209('0x4c')]['channel'],_0x93d5c[_0xc209('0x4c')][_0xc209('0x32')]);return db['SugarcrmConfiguration'][_0xc209('0x4b')](_0x93d5c[_0xc209('0x4c')],{'include':[{'model':db[_0xc209('0x57')],'as':'Subjects'},{'model':db[_0xc209('0x57')],'as':_0xc209('0x56')}]});}return null;})['then'](respondWithResult(_0x30f746,null))['catch'](handleError(_0x30f746,null));};exports[_0xc209('0x58')]=function(_0x36266c,_0x88f20c,_0x2c7df8){var _0x39875a='';var _0x213ff7=['id',_0xc209('0x2c'),_0xc209('0x59'),_0xc209('0x5a'),_0xc209('0x5b'),'date_start',_0xc209('0x5c'),_0xc209('0x5d'),_0xc209('0x5e'),_0xc209('0x5f'),_0xc209('0x60'),_0xc209('0x61')];return db['SugarcrmAccount'][_0xc209('0x4e')]({'where':{'id':_0x36266c[_0xc209('0x47')]['id']},'attributes':['id',_0xc209('0x62'),_0xc209('0x63'),_0xc209('0x64')]})['then'](handleEntityNotFound(_0x88f20c,null))['then'](function(_0x364b16){if(_0x364b16){_0x39875a=_0x364b16['remoteUri'];var _0xc59787=_0x39875a['slice'](-0x1);if(_0xc59787==='/'){_0x39875a=_0x39875a['substring'](0x0,_0x39875a[_0xc209('0x65')](_0xc59787));}return rp({'method':_0xc209('0x66'),'uri':util[_0xc209('0x67')](_0xc209('0x68'),_0x39875a,_0xc209('0x69')),'json':!![],'form':{'method':_0xc209('0x6a'),'input_type':_0xc209('0x6b'),'response_type':_0xc209('0x6b'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x364b16[_0xc209('0x62')],'password':_0x364b16[_0xc209('0x63')],'encryption':_0xc209('0x6c')},'application':_0xc209('0x6d')})}});}})[_0xc209('0x28')](function(_0x4be369){if(_0x4be369&&_0x4be369[_0xc209('0x2c')]!==_0xc209('0x6e')&&_0x4be369[_0xc209('0x2c')]!==_0xc209('0x6f')){return rp({'method':'POST','uri':util[_0xc209('0x67')]('%s%s',_0x39875a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xc209('0x70'),'input_type':_0xc209('0x6b'),'response_type':_0xc209('0x6b'),'rest_data':JSON[_0xc209('0x71')]({'session':_0x4be369['id'],'module_name':'Calls'})}})[_0xc209('0x28')](function(_0x1e8e4c){if(_0x1e8e4c){var _0x24a18b=_[_0xc209('0x72')](_0x1e8e4c[_0xc209('0x73')]);_[_0xc209('0x74')](_0x24a18b,function(_0x1d00ab){return _0x213ff7[_0xc209('0x75')](_0x1d00ab[_0xc209('0x2c')]);});return{'count':_0x24a18b[_0xc209('0x3a')],'rows':_['map'](_0x24a18b,function(_0x3f618b){return{'id':_0x3f618b[_0xc209('0x2c')],'name':_0x3f618b[_0xc209('0x76')],'custom':_['endsWith'](_0x3f618b['name'],'_c')?!![]:![],'options':_0x3f618b[_0xc209('0x44')]?_[_0xc209('0x2f')](_[_0xc209('0x72')](_0x3f618b[_0xc209('0x44')]),function(_0x3d460a){return{'name':_0x3d460a['value'],'value':_0x3d460a[_0xc209('0x2c')]};}):[]};})};}})[_0xc209('0x28')](respondWithResult(_0x88f20c,null))[_0xc209('0x4a')](function(_0x5ec861){var _0x5afe57=_0x36266c[_0xc209('0x35')][_0xc209('0x77')]?0x1f4:_0x5ec861['statusCode']||0x1f4;logger[_0xc209('0x2a')](_0xc209('0x78'),_0xc209('0x58'),_0x5afe57,JSON[_0xc209('0x71')](_0x5ec861));delete _0x5ec861['name'];if(_0x5afe57===0x191){_0x5afe57=0x190;}_0x88f20c['status'](_0x5afe57)['send'](_0x36266c['query'][_0xc209('0x77')]?{'message':_0xc209('0x79'),'statusCode':_0x5ec861[_0xc209('0x7a')]}:_0x5ec861);});}else{var _0x25efcb=0x1f4;_0x88f20c[_0xc209('0x1b')](_0x25efcb)[_0xc209('0x2d')]({'message':_0xc209('0x79'),'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 a0d0154..17e8669 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 _0x4147=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','exports'];(function(_0x458edc,_0x9baf98){var _0x44af29=function(_0x41929c){while(--_0x41929c){_0x458edc['push'](_0x458edc['shift']());}};_0x44af29(++_0x9baf98);}(_0x4147,0x1a7));var _0x7414=function(_0x5d0ecb,_0x4d8543){_0x5d0ecb=_0x5d0ecb-0x0;var _0x4a5c24=_0x4147[_0x5d0ecb];return _0x4a5c24;};'use strict';var _=require(_0x7414('0x0'));var util=require(_0x7414('0x1'));var logger=require(_0x7414('0x2'))(_0x7414('0x3'));var moment=require('moment');var BPromise=require(_0x7414('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7414('0x5'));var rimraf=require('rimraf');var config=require(_0x7414('0x6'));var attributes=require(_0x7414('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x7414('0x8')]=function(_0x2ffd60,_0x4a76ab){return _0x2ffd60[_0x7414('0x9')](_0x7414('0xa'),attributes,{'tableName':_0x7414('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1617=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','util','api','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1617,0xa5));var _0x7161=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x1617[_0x3a73bc];return _0x32891b;};'use strict';var _=require('lodash');var util=require(_0x7161('0x0'));var logger=require('../../config/logger')(_0x7161('0x1'));var moment=require('moment');var BPromise=require(_0x7161('0x2'));var rp=require(_0x7161('0x3'));var fs=require('fs');var path=require(_0x7161('0x4'));var rimraf=require(_0x7161('0x5'));var config=require(_0x7161('0x6'));var attributes=require(_0x7161('0x7'));var integrations=require(_0x7161('0x8'));module['exports']=function(_0x579241,_0x24f962){return _0x579241[_0x7161('0x9')](_0x7161('0xa'),attributes,{'tableName':_0x7161('0xb'),'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 9177850..0a27a51 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 _0x52ec=['where','attributes','include','map','model','then','ShowSugarcrmAccount','find','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','raw','options'];(function(_0x1f5d78,_0x586cba){var _0x1a596d=function(_0x3828d5){while(--_0x3828d5){_0x1f5d78['push'](_0x1f5d78['shift']());}};_0x1a596d(++_0x586cba);}(_0x52ec,0x19b));var _0xc52e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x52ec[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0xc52e('0x0'));var util=require(_0xc52e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc52e('0x2'));var fs=require('fs');var Redis=require(_0xc52e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc52e('0x4'))(_0xc52e('0x5'));var config=require(_0xc52e('0x6'));var jayson=require(_0xc52e('0x7'));var client=jayson[_0xc52e('0x8')][_0xc52e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf00693,_0x2dba17,_0x1e5d0a){return new BPromise(function(_0x298ad3,_0xdeb5a0){return client['request'](_0xf00693,_0x1e5d0a)['then'](function(_0x42a7e2){logger[_0xc52e('0xa')](_0xc52e('0xb'),_0x2dba17,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2dba17,_0xc52e('0xc'),JSON[_0xc52e('0xd')](_0x42a7e2));if(_0x42a7e2[_0xc52e('0xe')]){if(_0x42a7e2[_0xc52e('0xe')][_0xc52e('0xf')]===0x1f4){logger[_0xc52e('0xe')](_0xc52e('0xb'),_0x2dba17,_0x42a7e2['error'][_0xc52e('0x10')]);return _0xdeb5a0(_0x42a7e2[_0xc52e('0xe')]['message']);}logger[_0xc52e('0xe')](_0xc52e('0xb'),_0x2dba17,_0x42a7e2[_0xc52e('0xe')][_0xc52e('0x10')]);return _0x298ad3(_0x42a7e2[_0xc52e('0xe')][_0xc52e('0x10')]);}else{logger[_0xc52e('0xa')](_0xc52e('0xb'),_0x2dba17,_0xc52e('0xc'));_0x298ad3(_0x42a7e2[_0xc52e('0x11')]['message']);}})[_0xc52e('0x12')](function(_0x171cc5){logger[_0xc52e('0xe')](_0xc52e('0xb'),_0x2dba17,_0x171cc5);_0xdeb5a0(_0x171cc5);});});}exports[_0xc52e('0x13')]=function(_0x124f29){var _0x288ac2=this;return new Promise(function(_0x256153,_0x31a424){return db[_0xc52e('0x14')]['findAll']({'raw':_0x124f29['options']?_0x124f29['options'][_0xc52e('0x15')]===undefined?!![]:![]:!![],'where':_0x124f29[_0xc52e('0x16')]?_0x124f29[_0xc52e('0x16')][_0xc52e('0x17')]||null:null,'attributes':_0x124f29[_0xc52e('0x16')]?_0x124f29['options'][_0xc52e('0x18')]||null:null,'limit':_0x124f29[_0xc52e('0x16')]?_0x124f29[_0xc52e('0x16')]['limit']||null:null,'include':_0x124f29[_0xc52e('0x16')]?_0x124f29[_0xc52e('0x16')]['include']?_['map'](_0x124f29[_0xc52e('0x16')][_0xc52e('0x19')],function(_0x4345ce){return{'model':db[_0x4345ce['model']],'as':_0x4345ce['as'],'attributes':_0x4345ce[_0xc52e('0x18')],'include':_0x4345ce[_0xc52e('0x19')]?_[_0xc52e('0x1a')](_0x4345ce[_0xc52e('0x19')],function(_0x11d216){return{'model':db[_0x11d216[_0xc52e('0x1b')]],'as':_0x11d216['as'],'attributes':_0x11d216['attributes'],'include':_0x11d216[_0xc52e('0x19')]?_[_0xc52e('0x1a')](_0x11d216[_0xc52e('0x19')],function(_0x539fa0){return{'model':db[_0x539fa0[_0xc52e('0x1b')]],'as':_0x539fa0['as'],'attributes':_0x539fa0[_0xc52e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc52e('0x1c')](function(_0x4022a9){logger['info'](_0xc52e('0x13'),_0x124f29);logger['debug']('GetSugarcrmAccount',_0x124f29,JSON[_0xc52e('0xd')](_0x4022a9));_0x256153(_0x4022a9);})['catch'](function(_0x305569){logger['error'](_0xc52e('0x13'),_0x305569[_0xc52e('0x10')],_0x124f29);_0x31a424(_0x288ac2[_0xc52e('0xe')](0x1f4,_0x305569[_0xc52e('0x10')]));});});};exports[_0xc52e('0x1d')]=function(_0x8bc7cc){var _0x5c6111=this;return new Promise(function(_0x2b738a,_0x4fdff0){return db['SugarcrmAccount'][_0xc52e('0x1e')]({'raw':_0x8bc7cc[_0xc52e('0x16')]?_0x8bc7cc['options'][_0xc52e('0x15')]===undefined?!![]:![]:!![],'where':_0x8bc7cc[_0xc52e('0x16')]?_0x8bc7cc['options'][_0xc52e('0x17')]||null:null,'attributes':_0x8bc7cc[_0xc52e('0x16')]?_0x8bc7cc[_0xc52e('0x16')][_0xc52e('0x18')]||null:null,'include':_0x8bc7cc[_0xc52e('0x16')]?_0x8bc7cc[_0xc52e('0x16')][_0xc52e('0x19')]?_[_0xc52e('0x1a')](_0x8bc7cc[_0xc52e('0x16')][_0xc52e('0x19')],function(_0x3f9e66){return{'model':db[_0x3f9e66[_0xc52e('0x1b')]],'as':_0x3f9e66['as'],'attributes':_0x3f9e66[_0xc52e('0x18')],'include':_0x3f9e66[_0xc52e('0x19')]?_[_0xc52e('0x1a')](_0x3f9e66[_0xc52e('0x19')],function(_0x6cff97){return{'model':db[_0x6cff97['model']],'as':_0x6cff97['as'],'attributes':_0x6cff97[_0xc52e('0x18')],'include':_0x6cff97[_0xc52e('0x19')]?_[_0xc52e('0x1a')](_0x6cff97[_0xc52e('0x19')],function(_0x47d593){return{'model':db[_0x47d593[_0xc52e('0x1b')]],'as':_0x47d593['as'],'attributes':_0x47d593[_0xc52e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x442992){logger[_0xc52e('0xa')](_0xc52e('0x1d'),_0x8bc7cc);logger['debug']('ShowSugarcrmAccount',_0x8bc7cc,JSON[_0xc52e('0xd')](_0x442992));_0x2b738a(_0x442992);})['catch'](function(_0x2bedbc){logger[_0xc52e('0xe')]('ShowSugarcrmAccount',_0x2bedbc[_0xc52e('0x10')],_0x8bc7cc);_0x4fdff0(_0x5c6111[_0xc52e('0xe')](0x1f4,_0x2bedbc['message']));});});}; \ No newline at end of file +var _0x6913=['ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x3a9832,_0x28b818){var _0x48c2af=function(_0x177833){while(--_0x177833){_0x3a9832['push'](_0x3a9832['shift']());}};_0x48c2af(++_0x28b818);}(_0x6913,0x1df));var _0x3691=function(_0x4d791f,_0xf61730){_0x4d791f=_0x4d791f-0x0;var _0x106060=_0x6913[_0x4d791f];return _0x106060;};'use strict';var _=require(_0x3691('0x0'));var util=require(_0x3691('0x1'));var moment=require('moment');var BPromise=require(_0x3691('0x2'));var rs=require(_0x3691('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3691('0x4'))['db'];var utils=require(_0x3691('0x5'));var logger=require('../../config/logger')(_0x3691('0x6'));var config=require('../../config/environment');var jayson=require(_0x3691('0x7'));var client=jayson[_0x3691('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46e6d6,_0x4f2c4e,_0x351609){return new BPromise(function(_0x1e113e,_0x438712){return client[_0x3691('0x9')](_0x46e6d6,_0x351609)['then'](function(_0x1d64d5){logger[_0x3691('0xa')](_0x3691('0xb'),_0x4f2c4e,_0x3691('0xc'));logger[_0x3691('0xd')](_0x3691('0xe'),_0x4f2c4e,_0x3691('0xc'),JSON[_0x3691('0xf')](_0x1d64d5));if(_0x1d64d5['error']){if(_0x1d64d5[_0x3691('0x10')][_0x3691('0x11')]===0x1f4){logger[_0x3691('0x10')](_0x3691('0xb'),_0x4f2c4e,_0x1d64d5[_0x3691('0x10')][_0x3691('0x12')]);return _0x438712(_0x1d64d5['error'][_0x3691('0x12')]);}logger[_0x3691('0x10')](_0x3691('0xb'),_0x4f2c4e,_0x1d64d5[_0x3691('0x10')][_0x3691('0x12')]);return _0x1e113e(_0x1d64d5[_0x3691('0x10')][_0x3691('0x12')]);}else{logger[_0x3691('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f2c4e,_0x3691('0xc'));_0x1e113e(_0x1d64d5['result']['message']);}})[_0x3691('0x13')](function(_0x5212cc){logger[_0x3691('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f2c4e,_0x5212cc);_0x438712(_0x5212cc);});});}exports[_0x3691('0x14')]=function(_0x521bad){var _0x557218=this;return new Promise(function(_0x4fd417,_0x4887cb){return db['SugarcrmAccount'][_0x3691('0x15')]({'raw':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x17')]===undefined?!![]:![]:!![],'where':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x18')]||null:null,'attributes':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x19')]||null:null,'limit':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x1a')]||null:null,'include':_0x521bad[_0x3691('0x16')]?_0x521bad[_0x3691('0x16')][_0x3691('0x1b')]?_[_0x3691('0x1c')](_0x521bad[_0x3691('0x16')]['include'],function(_0xbf96bc){return{'model':db[_0xbf96bc[_0x3691('0x1d')]],'as':_0xbf96bc['as'],'attributes':_0xbf96bc[_0x3691('0x19')],'include':_0xbf96bc[_0x3691('0x1b')]?_['map'](_0xbf96bc['include'],function(_0x4e557e){return{'model':db[_0x4e557e['model']],'as':_0x4e557e['as'],'attributes':_0x4e557e[_0x3691('0x19')],'include':_0x4e557e[_0x3691('0x1b')]?_[_0x3691('0x1c')](_0x4e557e[_0x3691('0x1b')],function(_0x1d8573){return{'model':db[_0x1d8573[_0x3691('0x1d')]],'as':_0x1d8573['as'],'attributes':_0x1d8573[_0x3691('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3691('0x1e')](function(_0x599ea8){logger[_0x3691('0xa')](_0x3691('0x14'),_0x521bad);logger[_0x3691('0xd')](_0x3691('0x14'),_0x521bad,JSON[_0x3691('0xf')](_0x599ea8));_0x4fd417(_0x599ea8);})[_0x3691('0x13')](function(_0x5dff52){logger[_0x3691('0x10')](_0x3691('0x14'),_0x5dff52[_0x3691('0x12')],_0x521bad);_0x4887cb(_0x557218[_0x3691('0x10')](0x1f4,_0x5dff52[_0x3691('0x12')]));});});};exports[_0x3691('0x1f')]=function(_0x4307c3){var _0x2b63eb=this;return new Promise(function(_0x266cc7,_0x48a744){return db[_0x3691('0x20')][_0x3691('0x21')]({'raw':_0x4307c3[_0x3691('0x16')]?_0x4307c3[_0x3691('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4307c3[_0x3691('0x16')]?_0x4307c3[_0x3691('0x16')][_0x3691('0x18')]||null:null,'attributes':_0x4307c3[_0x3691('0x16')]?_0x4307c3[_0x3691('0x16')][_0x3691('0x19')]||null:null,'include':_0x4307c3[_0x3691('0x16')]?_0x4307c3[_0x3691('0x16')]['include']?_[_0x3691('0x1c')](_0x4307c3[_0x3691('0x16')][_0x3691('0x1b')],function(_0xb99d){return{'model':db[_0xb99d['model']],'as':_0xb99d['as'],'attributes':_0xb99d[_0x3691('0x19')],'include':_0xb99d[_0x3691('0x1b')]?_['map'](_0xb99d[_0x3691('0x1b')],function(_0x444132){return{'model':db[_0x444132[_0x3691('0x1d')]],'as':_0x444132['as'],'attributes':_0x444132[_0x3691('0x19')],'include':_0x444132[_0x3691('0x1b')]?_['map'](_0x444132['include'],function(_0xf76bcf){return{'model':db[_0xf76bcf[_0x3691('0x1d')]],'as':_0xf76bcf['as'],'attributes':_0xf76bcf[_0x3691('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3691('0x1e')](function(_0x5c00cd){logger[_0x3691('0xa')]('ShowSugarcrmAccount',_0x4307c3);logger[_0x3691('0xd')]('ShowSugarcrmAccount',_0x4307c3,JSON[_0x3691('0xf')](_0x5c00cd));_0x266cc7(_0x5c00cd);})[_0x3691('0x13')](function(_0x1c2187){logger[_0x3691('0x10')]('ShowSugarcrmAccount',_0x1c2187[_0x3691('0x12')],_0x4307c3);_0x48a744(_0x2b63eb[_0x3691('0x10')](0x1f4,_0x1c2187['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9687311..6ae7740 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 _0x686b=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x686b,0xc8));var _0xb686=function(_0x51a3e7,_0x3fcb56){_0x51a3e7=_0x51a3e7-0x0;var _0x1374a2=_0x686b[_0x51a3e7];return _0x1374a2;};'use strict';var multer=require(_0xb686('0x0'));var util=require(_0xb686('0x1'));var path=require(_0xb686('0x2'));var timeout=require('connect-timeout');var express=require(_0xb686('0x3'));var router=express[_0xb686('0x4')]();var fs_extra=require(_0xb686('0x5'));var auth=require(_0xb686('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb686('0x7'));var controller=require(_0xb686('0x8'));router[_0xb686('0x9')]('/',auth[_0xb686('0xa')](),controller[_0xb686('0xb')]);router[_0xb686('0x9')]('/:id',auth[_0xb686('0xa')](),controller[_0xb686('0xc')]);router[_0xb686('0x9')](_0xb686('0xd'),auth['isAuthenticated'](),controller[_0xb686('0xe')]);router[_0xb686('0x9')](_0xb686('0xf'),auth[_0xb686('0xa')](),controller[_0xb686('0x10')]);router[_0xb686('0x9')](_0xb686('0x11'),auth[_0xb686('0xa')](),controller[_0xb686('0x12')]);router[_0xb686('0x13')]('/',auth[_0xb686('0xa')](),controller[_0xb686('0x14')]);router[_0xb686('0x15')](_0xb686('0x16'),auth['isAuthenticated'](),controller[_0xb686('0x17')]);router['delete'](_0xb686('0x16'),auth['isAuthenticated'](),controller[_0xb686('0x18')]);module['exports']=router; \ No newline at end of file +var _0xdbd7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','/:id','destroy','exports','multer','util'];(function(_0x22404b,_0x5bc9df){var _0x5a9b28=function(_0x861071){while(--_0x861071){_0x22404b['push'](_0x22404b['shift']());}};_0x5a9b28(++_0x5bc9df);}(_0xdbd7,0x8e));var _0x7dbd=function(_0x488023,_0x22660b){_0x488023=_0x488023-0x0;var _0x1140c7=_0xdbd7[_0x488023];return _0x1140c7;};'use strict';var multer=require(_0x7dbd('0x0'));var util=require(_0x7dbd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7dbd('0x2'));var interaction=require(_0x7dbd('0x3'));var config=require(_0x7dbd('0x4'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x7dbd('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7dbd('0x5')]('/:id',auth[_0x7dbd('0x6')](),controller['show']);router[_0x7dbd('0x5')](_0x7dbd('0x7'),auth[_0x7dbd('0x6')](),controller[_0x7dbd('0x8')]);router[_0x7dbd('0x5')](_0x7dbd('0x9'),auth[_0x7dbd('0x6')](),controller[_0x7dbd('0xa')]);router['get'](_0x7dbd('0xb'),auth[_0x7dbd('0x6')](),controller['getDescriptions']);router[_0x7dbd('0xc')]('/',auth[_0x7dbd('0x6')](),controller['create']);router[_0x7dbd('0xd')]('/:id',auth[_0x7dbd('0x6')](),controller[_0x7dbd('0xe')]);router['delete'](_0x7dbd('0xf'),auth[_0x7dbd('0x6')](),controller[_0x7dbd('0x10')]);module[_0x7dbd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 98ef7b3..8aba231 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 _0x3ed2=['sequelize','exports','STRING'];(function(_0x37f364,_0x56f6ae){var _0x1a97dd=function(_0x4f4161){while(--_0x4f4161){_0x37f364['push'](_0x37f364['shift']());}};_0x1a97dd(++_0x56f6ae);}(_0x3ed2,0x1b9));var _0x23ed=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0x3ed2[_0x3cec45];return _0x51d691;};'use strict';var Sequelize=require(_0x23ed('0x0'));module[_0x23ed('0x1')]={'name':{'type':Sequelize[_0x23ed('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc3d6=['exports','STRING','sequelize'];(function(_0x4649aa,_0xa96950){var _0xf8c283=function(_0x313526){while(--_0x313526){_0x4649aa['push'](_0x4649aa['shift']());}};_0xf8c283(++_0xa96950);}(_0xc3d6,0xc5));var _0x6c3d=function(_0x2932be,_0x215977){_0x2932be=_0x2932be-0x0;var _0x40a721=_0xc3d6[_0x2932be];return _0x40a721;};'use strict';var Sequelize=require(_0x6c3d('0x0'));module[_0x6c3d('0x1')]={'name':{'type':Sequelize[_0x6c3d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c161316..1182f81 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 _0xcfa7=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','include','find','create','catch','body','params','getFields','findOne','SugarcrmField','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x3699de,_0xa891d4){var _0x3289bf=function(_0x593297){while(--_0x593297){_0x3699de['push'](_0x3699de['shift']());}};_0x3289bf(++_0xa891d4);}(_0xcfa7,0x94));var _0x7cfa=function(_0x1c5417,_0x21b96c){_0x1c5417=_0x1c5417-0x0;var _0x5b2ec0=_0xcfa7[_0x1c5417];return _0x5b2ec0;};'use strict';var emlformat=require(_0x7cfa('0x0'));var rimraf=require(_0x7cfa('0x1'));var zipdir=require(_0x7cfa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7cfa('0x3'));var moment=require(_0x7cfa('0x4'));var BPromise=require(_0x7cfa('0x5'));var Mustache=require(_0x7cfa('0x6'));var util=require(_0x7cfa('0x7'));var path=require(_0x7cfa('0x8'));var sox=require(_0x7cfa('0x9'));var csv=require(_0x7cfa('0xa'));var ejs=require(_0x7cfa('0xb'));var fs=require('fs');var fs_extra=require(_0x7cfa('0xc'));var _=require(_0x7cfa('0xd'));var squel=require('squel');var crypto=require(_0x7cfa('0xe'));var jsforce=require(_0x7cfa('0xf'));var deskjs=require(_0x7cfa('0x10'));var toCsv=require(_0x7cfa('0xa'));var querystring=require(_0x7cfa('0x11'));var Papa=require('papaparse');var Redis=require(_0x7cfa('0x12'));var authService=require(_0x7cfa('0x13'));var qs=require(_0x7cfa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7cfa('0x15'));var logger=require('../../config/logger')(_0x7cfa('0x16'));var utils=require(_0x7cfa('0x17'));var config=require(_0x7cfa('0x18'));var licenseUtil=require(_0x7cfa('0x19'));var db=require(_0x7cfa('0x1a'))['db'];function respondWithStatusCode(_0x59edf1,_0x693861){_0x693861=_0x693861||0xcc;return function(_0x3739cd){if(_0x3739cd){return _0x59edf1[_0x7cfa('0x1b')](_0x693861);}return _0x59edf1['status'](_0x693861)['end']();};}function respondWithResult(_0x1c78bd,_0x445543){_0x445543=_0x445543||0xc8;return function(_0x5a0644){if(_0x5a0644){return _0x1c78bd['status'](_0x445543)[_0x7cfa('0x1c')](_0x5a0644);}};}function respondWithFilteredResult(_0x47f910,_0x342de6){return function(_0x47ba9d){if(_0x47ba9d){var _0x47aab5=typeof _0x342de6[_0x7cfa('0x1d')]===_0x7cfa('0x1e')&&typeof _0x342de6[_0x7cfa('0x1f')]===_0x7cfa('0x1e');var _0x2a442b=_0x47ba9d[_0x7cfa('0x20')];var _0x4e3d8a=_0x47aab5?0x0:_0x342de6['offset'];var _0x2cb76e=_0x47aab5?_0x47ba9d[_0x7cfa('0x20')]:_0x342de6[_0x7cfa('0x1d')]+_0x342de6[_0x7cfa('0x1f')];var _0x791ca5;if(_0x2cb76e>=_0x2a442b){_0x2cb76e=_0x2a442b;_0x791ca5=0xc8;}else{_0x791ca5=0xce;}_0x47f910[_0x7cfa('0x21')](_0x791ca5);return _0x47f910[_0x7cfa('0x22')](_0x7cfa('0x23'),_0x4e3d8a+'-'+_0x2cb76e+'/'+_0x2a442b)['json'](_0x47ba9d);}return null;};}function patchUpdates(_0x353dd3){return function(_0x3aac0c){try{jsonpatch[_0x7cfa('0x24')](_0x3aac0c,_0x353dd3,!![]);}catch(_0x47e2e8){return BPromise[_0x7cfa('0x25')](_0x47e2e8);}return _0x3aac0c[_0x7cfa('0x26')]();};}function saveUpdates(_0x3285f6,_0x324fa1){return function(_0x577faa){if(_0x577faa){return _0x577faa[_0x7cfa('0x27')](_0x3285f6)[_0x7cfa('0x28')](function(_0x3b1daa){return _0x3b1daa;});}return null;};}function removeEntity(_0x52595c,_0x270cf9){return function(_0x24fdd0){if(_0x24fdd0){return _0x24fdd0[_0x7cfa('0x29')]()[_0x7cfa('0x28')](function(){_0x52595c[_0x7cfa('0x21')](0xcc)[_0x7cfa('0x2a')]();});}};}function handleEntityNotFound(_0x2540f2,_0x32e3a1){return function(_0x27215f){if(!_0x27215f){_0x2540f2[_0x7cfa('0x1b')](0x194);}return _0x27215f;};}function handleError(_0x2b60e7,_0x1198ca){_0x1198ca=_0x1198ca||0x1f4;return function(_0x5a00dc){logger[_0x7cfa('0x2b')](_0x5a00dc[_0x7cfa('0x2c')]);if(_0x5a00dc['name']){delete _0x5a00dc[_0x7cfa('0x2d')];}_0x2b60e7[_0x7cfa('0x21')](_0x1198ca)['send'](_0x5a00dc);};}exports[_0x7cfa('0x2e')]=function(_0x158e28,_0x32b820){var _0x30de43={},_0x45e181={},_0x49d032={'count':0x0,'rows':[]};var _0x4be2bc=_[_0x7cfa('0x2f')](db[_0x7cfa('0x30')]['rawAttributes'],function(_0x2efda3){return{'name':_0x2efda3[_0x7cfa('0x31')],'type':_0x2efda3[_0x7cfa('0x32')][_0x7cfa('0x33')]};});_0x45e181['model']=_[_0x7cfa('0x2f')](_0x4be2bc,_0x7cfa('0x2d'));_0x45e181[_0x7cfa('0x34')]=_[_0x7cfa('0x35')](_0x158e28[_0x7cfa('0x34')]);_0x45e181[_0x7cfa('0x36')]=_[_0x7cfa('0x37')](_0x45e181[_0x7cfa('0x38')],_0x45e181[_0x7cfa('0x34')]);_0x30de43[_0x7cfa('0x39')]=_[_0x7cfa('0x37')](_0x45e181['model'],qs[_0x7cfa('0x3a')](_0x158e28[_0x7cfa('0x34')]['fields']));_0x30de43['attributes']=_0x30de43[_0x7cfa('0x39')][_0x7cfa('0x3b')]?_0x30de43[_0x7cfa('0x39')]:_0x45e181[_0x7cfa('0x38')];if(!_0x158e28[_0x7cfa('0x34')][_0x7cfa('0x3c')](_0x7cfa('0x3d'))){_0x30de43['limit']=qs[_0x7cfa('0x1f')](_0x158e28[_0x7cfa('0x34')][_0x7cfa('0x1f')]);_0x30de43['offset']=qs[_0x7cfa('0x1d')](_0x158e28[_0x7cfa('0x34')][_0x7cfa('0x1d')]);}_0x30de43['order']=qs[_0x7cfa('0x3e')](_0x158e28[_0x7cfa('0x34')][_0x7cfa('0x3e')]);_0x30de43[_0x7cfa('0x3f')]=qs[_0x7cfa('0x36')](_[_0x7cfa('0x40')](_0x158e28[_0x7cfa('0x34')],_0x45e181[_0x7cfa('0x36')]),_0x4be2bc);if(_0x158e28[_0x7cfa('0x34')][_0x7cfa('0x41')]){_0x30de43['where']=_[_0x7cfa('0x42')](_0x30de43['where'],{'$or':_['map'](_0x4be2bc,function(_0x15bdad){if(_0x15bdad[_0x7cfa('0x32')]!==_0x7cfa('0x43')){var _0x5c618a={};_0x5c618a[_0x15bdad[_0x7cfa('0x2d')]]={'$like':'%'+_0x158e28[_0x7cfa('0x34')]['filter']+'%'};return _0x5c618a;}})});}_0x30de43=_[_0x7cfa('0x42')]({},_0x30de43,_0x158e28[_0x7cfa('0x44')]);var _0x2c495f={'where':_0x30de43[_0x7cfa('0x3f')]};return db[_0x7cfa('0x30')]['count'](_0x2c495f)[_0x7cfa('0x28')](function(_0x34b829){_0x49d032['count']=_0x34b829;if(_0x158e28[_0x7cfa('0x34')][_0x7cfa('0x45')]){_0x30de43['include']=[{'all':!![]}];}return db[_0x7cfa('0x30')][_0x7cfa('0x46')](_0x30de43);})['then'](function(_0x14f8da){_0x49d032[_0x7cfa('0x47')]=_0x14f8da;return _0x49d032;})[_0x7cfa('0x28')](respondWithFilteredResult(_0x32b820,_0x30de43))['catch'](handleError(_0x32b820,null));};exports[_0x7cfa('0x48')]=function(_0x2d179c,_0x26c295){var _0x4e8e34={'raw':![],'where':{'id':_0x2d179c['params']['id']}},_0x119148={};_0x119148['model']=_[_0x7cfa('0x35')](db['SugarcrmConfiguration'][_0x7cfa('0x49')]);_0x119148[_0x7cfa('0x34')]=_[_0x7cfa('0x35')](_0x2d179c[_0x7cfa('0x34')]);_0x119148[_0x7cfa('0x36')]=_['intersection'](_0x119148[_0x7cfa('0x38')],_0x119148[_0x7cfa('0x34')]);_0x4e8e34[_0x7cfa('0x39')]=_['intersection'](_0x119148[_0x7cfa('0x38')],qs[_0x7cfa('0x3a')](_0x2d179c['query']['fields']));_0x4e8e34[_0x7cfa('0x39')]=_0x4e8e34['attributes'][_0x7cfa('0x3b')]?_0x4e8e34[_0x7cfa('0x39')]:_0x119148[_0x7cfa('0x38')];if(_0x2d179c[_0x7cfa('0x34')]['includeAll']){_0x4e8e34[_0x7cfa('0x4a')]=[{'all':!![]}];}_0x4e8e34=_[_0x7cfa('0x42')]({},_0x4e8e34,_0x2d179c[_0x7cfa('0x44')]);return db['SugarcrmConfiguration'][_0x7cfa('0x4b')](_0x4e8e34)[_0x7cfa('0x28')](handleEntityNotFound(_0x26c295,null))['then'](respondWithResult(_0x26c295,null))['catch'](handleError(_0x26c295,null));};exports[_0x7cfa('0x4c')]=function(_0x364d11,_0x22c5ae){return db[_0x7cfa('0x30')][_0x7cfa('0x4c')](_0x364d11['body'],{})[_0x7cfa('0x28')](respondWithResult(_0x22c5ae,0xc9))[_0x7cfa('0x4d')](handleError(_0x22c5ae,null));};exports[_0x7cfa('0x27')]=function(_0x57358c,_0x46500b){if(_0x57358c[_0x7cfa('0x4e')]['id']){delete _0x57358c[_0x7cfa('0x4e')]['id'];}return db['SugarcrmConfiguration'][_0x7cfa('0x4b')]({'where':{'id':_0x57358c['params']['id']}})[_0x7cfa('0x28')](handleEntityNotFound(_0x46500b,null))[_0x7cfa('0x28')](saveUpdates(_0x57358c['body'],null))[_0x7cfa('0x28')](respondWithResult(_0x46500b,null))['catch'](handleError(_0x46500b,null));};exports[_0x7cfa('0x29')]=function(_0x2884bc,_0x50145f){return db[_0x7cfa('0x30')][_0x7cfa('0x4b')]({'where':{'id':_0x2884bc[_0x7cfa('0x4f')]['id']}})[_0x7cfa('0x28')](handleEntityNotFound(_0x50145f,null))[_0x7cfa('0x28')](removeEntity(_0x50145f,null))['catch'](handleError(_0x50145f,null));};exports[_0x7cfa('0x50')]=function(_0x970bc6,_0x5bf641,_0x3d480e){var _0x202e3f={};var _0x9e93c8={};var _0xe9848b;var _0x4eec;return db[_0x7cfa('0x30')][_0x7cfa('0x51')]({'where':{'id':_0x970bc6[_0x7cfa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5bf641,null))['then'](function(_0x1c4b53){if(_0x1c4b53){_0xe9848b=_0x1c4b53;_0x9e93c8[_0x7cfa('0x38')]=_[_0x7cfa('0x35')](db[_0x7cfa('0x52')][_0x7cfa('0x49')]);_0x9e93c8['query']=_[_0x7cfa('0x35')](_0x970bc6[_0x7cfa('0x34')]);_0x9e93c8['filters']=_['intersection'](_0x9e93c8[_0x7cfa('0x38')],_0x9e93c8[_0x7cfa('0x34')]);_0x202e3f[_0x7cfa('0x39')]=_['intersection'](_0x9e93c8[_0x7cfa('0x38')],qs[_0x7cfa('0x3a')](_0x970bc6[_0x7cfa('0x34')][_0x7cfa('0x3a')]));_0x202e3f[_0x7cfa('0x39')]=_0x202e3f['attributes'][_0x7cfa('0x3b')]?_0x202e3f['attributes']:_0x9e93c8['model'];_0x202e3f['order']=qs[_0x7cfa('0x3e')](_0x970bc6[_0x7cfa('0x34')]['sort']);_0x202e3f[_0x7cfa('0x3f')]=qs[_0x7cfa('0x36')](_[_0x7cfa('0x40')](_0x970bc6[_0x7cfa('0x34')],_0x9e93c8[_0x7cfa('0x36')]));if(_0x970bc6['query'][_0x7cfa('0x41')]){_0x202e3f[_0x7cfa('0x3f')]=_[_0x7cfa('0x42')](_0x202e3f[_0x7cfa('0x3f')],{'$or':_[_0x7cfa('0x2f')](_0x202e3f[_0x7cfa('0x39')],function(_0x2ba76b){var _0x3735fa={};_0x3735fa[_0x2ba76b]={'$like':'%'+_0x970bc6['query'][_0x7cfa('0x41')]+'%'};return _0x3735fa;})});}_0x202e3f=_[_0x7cfa('0x42')]({},_0x202e3f,_0x970bc6[_0x7cfa('0x44')]);return _0xe9848b[_0x7cfa('0x50')](_0x202e3f);}})[_0x7cfa('0x28')](function(_0x9ef6b7){if(_0x9ef6b7){_0x4eec=_0x9ef6b7[_0x7cfa('0x3b')];if(!_0x970bc6['query'][_0x7cfa('0x3c')](_0x7cfa('0x3d'))){_0x202e3f[_0x7cfa('0x1f')]=qs[_0x7cfa('0x1f')](_0x970bc6[_0x7cfa('0x34')][_0x7cfa('0x1f')]);_0x202e3f[_0x7cfa('0x1d')]=qs['offset'](_0x970bc6[_0x7cfa('0x34')][_0x7cfa('0x1d')]);}return _0xe9848b[_0x7cfa('0x50')](_0x202e3f);}})[_0x7cfa('0x28')](function(_0x2e6704){if(_0x2e6704){return _0x2e6704?{'count':_0x4eec,'rows':_0x2e6704}:null;}})[_0x7cfa('0x28')](respondWithResult(_0x5bf641,null))[_0x7cfa('0x4d')](handleError(_0x5bf641,null));};exports[_0x7cfa('0x53')]=function(_0x4a598a,_0x468777,_0x1e16ff){var _0x409c0e={};var _0x165fef={};var _0x4c032b;var _0x3e5da2;return db[_0x7cfa('0x30')]['findOne']({'where':{'id':_0x4a598a[_0x7cfa('0x4f')]['id']}})[_0x7cfa('0x28')](handleEntityNotFound(_0x468777,null))['then'](function(_0x5d04aa){if(_0x5d04aa){_0x4c032b=_0x5d04aa;_0x165fef[_0x7cfa('0x38')]=_['keys'](db[_0x7cfa('0x52')][_0x7cfa('0x49')]);_0x165fef[_0x7cfa('0x34')]=_[_0x7cfa('0x35')](_0x4a598a['query']);_0x165fef['filters']=_[_0x7cfa('0x37')](_0x165fef[_0x7cfa('0x38')],_0x165fef[_0x7cfa('0x34')]);_0x409c0e[_0x7cfa('0x39')]=_['intersection'](_0x165fef[_0x7cfa('0x38')],qs[_0x7cfa('0x3a')](_0x4a598a[_0x7cfa('0x34')][_0x7cfa('0x3a')]));_0x409c0e[_0x7cfa('0x39')]=_0x409c0e[_0x7cfa('0x39')][_0x7cfa('0x3b')]?_0x409c0e[_0x7cfa('0x39')]:_0x165fef['model'];_0x409c0e[_0x7cfa('0x54')]=qs[_0x7cfa('0x3e')](_0x4a598a[_0x7cfa('0x34')][_0x7cfa('0x3e')]);_0x409c0e['where']=qs[_0x7cfa('0x36')](_[_0x7cfa('0x40')](_0x4a598a[_0x7cfa('0x34')],_0x165fef['filters']));if(_0x4a598a[_0x7cfa('0x34')][_0x7cfa('0x41')]){_0x409c0e[_0x7cfa('0x3f')]=_[_0x7cfa('0x42')](_0x409c0e[_0x7cfa('0x3f')],{'$or':_[_0x7cfa('0x2f')](_0x409c0e[_0x7cfa('0x39')],function(_0x5ba8ed){var _0x4eee67={};_0x4eee67[_0x5ba8ed]={'$like':'%'+_0x4a598a['query']['filter']+'%'};return _0x4eee67;})});}_0x409c0e=_[_0x7cfa('0x42')]({},_0x409c0e,_0x4a598a[_0x7cfa('0x44')]);return _0x4c032b[_0x7cfa('0x53')](_0x409c0e);}})[_0x7cfa('0x28')](function(_0x205199){if(_0x205199){_0x3e5da2=_0x205199[_0x7cfa('0x3b')];if(!_0x4a598a[_0x7cfa('0x34')][_0x7cfa('0x3c')](_0x7cfa('0x3d'))){_0x409c0e['limit']=qs[_0x7cfa('0x1f')](_0x4a598a[_0x7cfa('0x34')][_0x7cfa('0x1f')]);_0x409c0e[_0x7cfa('0x1d')]=qs[_0x7cfa('0x1d')](_0x4a598a['query'][_0x7cfa('0x1d')]);}return _0x4c032b['getSubjects'](_0x409c0e);}})[_0x7cfa('0x28')](function(_0x3c291d){if(_0x3c291d){return _0x3c291d?{'count':_0x3e5da2,'rows':_0x3c291d}:null;}})[_0x7cfa('0x28')](respondWithResult(_0x468777,null))[_0x7cfa('0x4d')](handleError(_0x468777,null));};exports[_0x7cfa('0x55')]=function(_0x1b9abf,_0x563244,_0x4fa76d){var _0x493ed5={};var _0x2800ea={};var _0x47d3e4;var _0x4cf12f;return db[_0x7cfa('0x30')][_0x7cfa('0x51')]({'where':{'id':_0x1b9abf[_0x7cfa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x563244,null))[_0x7cfa('0x28')](function(_0x346e8d){if(_0x346e8d){_0x47d3e4=_0x346e8d;_0x2800ea['model']=_[_0x7cfa('0x35')](db[_0x7cfa('0x52')][_0x7cfa('0x49')]);_0x2800ea[_0x7cfa('0x34')]=_[_0x7cfa('0x35')](_0x1b9abf[_0x7cfa('0x34')]);_0x2800ea[_0x7cfa('0x36')]=_[_0x7cfa('0x37')](_0x2800ea[_0x7cfa('0x38')],_0x2800ea[_0x7cfa('0x34')]);_0x493ed5['attributes']=_[_0x7cfa('0x37')](_0x2800ea[_0x7cfa('0x38')],qs[_0x7cfa('0x3a')](_0x1b9abf[_0x7cfa('0x34')][_0x7cfa('0x3a')]));_0x493ed5['attributes']=_0x493ed5[_0x7cfa('0x39')][_0x7cfa('0x3b')]?_0x493ed5['attributes']:_0x2800ea[_0x7cfa('0x38')];_0x493ed5[_0x7cfa('0x54')]=qs['sort'](_0x1b9abf[_0x7cfa('0x34')][_0x7cfa('0x3e')]);_0x493ed5['where']=qs[_0x7cfa('0x36')](_[_0x7cfa('0x40')](_0x1b9abf[_0x7cfa('0x34')],_0x2800ea[_0x7cfa('0x36')]));if(_0x1b9abf[_0x7cfa('0x34')]['filter']){_0x493ed5['where']=_[_0x7cfa('0x42')](_0x493ed5[_0x7cfa('0x3f')],{'$or':_[_0x7cfa('0x2f')](_0x493ed5[_0x7cfa('0x39')],function(_0x5e42de){var _0x4b549d={};_0x4b549d[_0x5e42de]={'$like':'%'+_0x1b9abf['query'][_0x7cfa('0x41')]+'%'};return _0x4b549d;})});}_0x493ed5=_['merge']({},_0x493ed5,_0x1b9abf['options']);return _0x47d3e4['getDescriptions'](_0x493ed5);}})[_0x7cfa('0x28')](function(_0x55d92a){if(_0x55d92a){_0x4cf12f=_0x55d92a[_0x7cfa('0x3b')];if(!_0x1b9abf[_0x7cfa('0x34')][_0x7cfa('0x3c')](_0x7cfa('0x3d'))){_0x493ed5[_0x7cfa('0x1f')]=qs[_0x7cfa('0x1f')](_0x1b9abf['query'][_0x7cfa('0x1f')]);_0x493ed5[_0x7cfa('0x1d')]=qs[_0x7cfa('0x1d')](_0x1b9abf[_0x7cfa('0x34')][_0x7cfa('0x1d')]);}return _0x47d3e4[_0x7cfa('0x55')](_0x493ed5);}})[_0x7cfa('0x28')](function(_0x29b9bf){if(_0x29b9bf){return _0x29b9bf?{'count':_0x4cf12f,'rows':_0x29b9bf}:null;}})[_0x7cfa('0x28')](respondWithResult(_0x563244,null))['catch'](handleError(_0x563244,null));}; \ No newline at end of file +var _0x95c9=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','params','keys','catch','create','body','find','getFields','hasOwnProperty','getSubjects','getDescriptions','findOne','SugarcrmField','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1ee127,_0x289068){var _0x352c3f=function(_0x2b663c){while(--_0x2b663c){_0x1ee127['push'](_0x1ee127['shift']());}};_0x352c3f(++_0x289068);}(_0x95c9,0x99));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x995c('0x0'));var rimraf=require(_0x995c('0x1'));var zipdir=require(_0x995c('0x2'));var jsonpatch=require(_0x995c('0x3'));var rp=require('request-promise');var moment=require(_0x995c('0x4'));var BPromise=require(_0x995c('0x5'));var Mustache=require(_0x995c('0x6'));var util=require(_0x995c('0x7'));var path=require(_0x995c('0x8'));var sox=require(_0x995c('0x9'));var csv=require(_0x995c('0xa'));var ejs=require(_0x995c('0xb'));var fs=require('fs');var fs_extra=require(_0x995c('0xc'));var _=require(_0x995c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x995c('0xe'));var deskjs=require(_0x995c('0xf'));var toCsv=require(_0x995c('0xa'));var querystring=require(_0x995c('0x10'));var Papa=require(_0x995c('0x11'));var Redis=require(_0x995c('0x12'));var authService=require(_0x995c('0x13'));var qs=require(_0x995c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x995c('0x15'));var logger=require(_0x995c('0x16'))(_0x995c('0x17'));var utils=require(_0x995c('0x18'));var config=require(_0x995c('0x19'));var licenseUtil=require(_0x995c('0x1a'));var db=require(_0x995c('0x1b'))['db'];function respondWithStatusCode(_0x3910e3,_0x2b5ffc){_0x2b5ffc=_0x2b5ffc||0xcc;return function(_0x1763d3){if(_0x1763d3){return _0x3910e3[_0x995c('0x1c')](_0x2b5ffc);}return _0x3910e3['status'](_0x2b5ffc)[_0x995c('0x1d')]();};}function respondWithResult(_0x5c984d,_0x422b43){_0x422b43=_0x422b43||0xc8;return function(_0xc85b08){if(_0xc85b08){return _0x5c984d[_0x995c('0x1e')](_0x422b43)[_0x995c('0x1f')](_0xc85b08);}};}function respondWithFilteredResult(_0x56da43,_0x1f53aa){return function(_0x179c70){if(_0x179c70){var _0x3a17e7=typeof _0x1f53aa[_0x995c('0x20')]==='undefined'&&typeof _0x1f53aa['limit']===_0x995c('0x21');var _0x21f355=_0x179c70['count'];var _0x34482d=_0x3a17e7?0x0:_0x1f53aa[_0x995c('0x20')];var _0x175ec7=_0x3a17e7?_0x179c70[_0x995c('0x22')]:_0x1f53aa[_0x995c('0x20')]+_0x1f53aa[_0x995c('0x23')];var _0x3e21d1;if(_0x175ec7>=_0x21f355){_0x175ec7=_0x21f355;_0x3e21d1=0xc8;}else{_0x3e21d1=0xce;}_0x56da43[_0x995c('0x1e')](_0x3e21d1);return _0x56da43[_0x995c('0x24')](_0x995c('0x25'),_0x34482d+'-'+_0x175ec7+'/'+_0x21f355)[_0x995c('0x1f')](_0x179c70);}return null;};}function patchUpdates(_0x1a9ec0){return function(_0x503025){try{jsonpatch[_0x995c('0x26')](_0x503025,_0x1a9ec0,!![]);}catch(_0x54426d){return BPromise[_0x995c('0x27')](_0x54426d);}return _0x503025[_0x995c('0x28')]();};}function saveUpdates(_0x40bf44,_0x5e8075){return function(_0x40e7d2){if(_0x40e7d2){return _0x40e7d2[_0x995c('0x29')](_0x40bf44)['then'](function(_0x2024e8){return _0x2024e8;});}return null;};}function removeEntity(_0xa2230b,_0x34e4f0){return function(_0x66f5d9){if(_0x66f5d9){return _0x66f5d9[_0x995c('0x2a')]()['then'](function(){_0xa2230b[_0x995c('0x1e')](0xcc)[_0x995c('0x1d')]();});}};}function handleEntityNotFound(_0x439581,_0x56bf4f){return function(_0xadfec){if(!_0xadfec){_0x439581[_0x995c('0x1c')](0x194);}return _0xadfec;};}function handleError(_0x229406,_0xe61aaa){_0xe61aaa=_0xe61aaa||0x1f4;return function(_0x7c9bf0){logger[_0x995c('0x2b')](_0x7c9bf0[_0x995c('0x2c')]);if(_0x7c9bf0[_0x995c('0x2d')]){delete _0x7c9bf0['name'];}_0x229406[_0x995c('0x1e')](_0xe61aaa)[_0x995c('0x2e')](_0x7c9bf0);};}exports['index']=function(_0x193664,_0x5e9c10){var _0x54e9c8={},_0x3b360e={},_0x2cf3f5={'count':0x0,'rows':[]};var _0x15e51f=_[_0x995c('0x2f')](db[_0x995c('0x30')][_0x995c('0x31')],function(_0x3998cb){return{'name':_0x3998cb[_0x995c('0x32')],'type':_0x3998cb[_0x995c('0x33')][_0x995c('0x34')]};});_0x3b360e['model']=_['map'](_0x15e51f,_0x995c('0x2d'));_0x3b360e[_0x995c('0x35')]=_['keys'](_0x193664[_0x995c('0x35')]);_0x3b360e[_0x995c('0x36')]=_['intersection'](_0x3b360e[_0x995c('0x37')],_0x3b360e[_0x995c('0x35')]);_0x54e9c8[_0x995c('0x38')]=_[_0x995c('0x39')](_0x3b360e[_0x995c('0x37')],qs[_0x995c('0x3a')](_0x193664['query'][_0x995c('0x3a')]));_0x54e9c8[_0x995c('0x38')]=_0x54e9c8[_0x995c('0x38')][_0x995c('0x3b')]?_0x54e9c8[_0x995c('0x38')]:_0x3b360e[_0x995c('0x37')];if(!_0x193664['query']['hasOwnProperty'](_0x995c('0x3c'))){_0x54e9c8[_0x995c('0x23')]=qs[_0x995c('0x23')](_0x193664[_0x995c('0x35')][_0x995c('0x23')]);_0x54e9c8[_0x995c('0x20')]=qs['offset'](_0x193664[_0x995c('0x35')][_0x995c('0x20')]);}_0x54e9c8[_0x995c('0x3d')]=qs[_0x995c('0x3e')](_0x193664[_0x995c('0x35')]['sort']);_0x54e9c8['where']=qs[_0x995c('0x36')](_[_0x995c('0x3f')](_0x193664[_0x995c('0x35')],_0x3b360e[_0x995c('0x36')]),_0x15e51f);if(_0x193664[_0x995c('0x35')][_0x995c('0x40')]){_0x54e9c8[_0x995c('0x41')]=_[_0x995c('0x42')](_0x54e9c8[_0x995c('0x41')],{'$or':_[_0x995c('0x2f')](_0x15e51f,function(_0x1fbaa3){if(_0x1fbaa3['type']!==_0x995c('0x43')){var _0x89091f={};_0x89091f[_0x1fbaa3[_0x995c('0x2d')]]={'$like':'%'+_0x193664[_0x995c('0x35')]['filter']+'%'};return _0x89091f;}})});}_0x54e9c8=_[_0x995c('0x42')]({},_0x54e9c8,_0x193664[_0x995c('0x44')]);var _0xecee80={'where':_0x54e9c8[_0x995c('0x41')]};return db[_0x995c('0x30')]['count'](_0xecee80)['then'](function(_0x227039){_0x2cf3f5['count']=_0x227039;if(_0x193664[_0x995c('0x35')][_0x995c('0x45')]){_0x54e9c8[_0x995c('0x46')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x995c('0x47')](_0x54e9c8);})[_0x995c('0x48')](function(_0x4d5340){_0x2cf3f5[_0x995c('0x49')]=_0x4d5340;return _0x2cf3f5;})['then'](respondWithFilteredResult(_0x5e9c10,_0x54e9c8))['catch'](handleError(_0x5e9c10,null));};exports['show']=function(_0x4ee90e,_0x4e42d0){var _0x135a18={'raw':![],'where':{'id':_0x4ee90e[_0x995c('0x4a')]['id']}},_0x176af2={};_0x176af2['model']=_['keys'](db['SugarcrmConfiguration'][_0x995c('0x31')]);_0x176af2[_0x995c('0x35')]=_[_0x995c('0x4b')](_0x4ee90e[_0x995c('0x35')]);_0x176af2[_0x995c('0x36')]=_[_0x995c('0x39')](_0x176af2[_0x995c('0x37')],_0x176af2['query']);_0x135a18[_0x995c('0x38')]=_['intersection'](_0x176af2['model'],qs[_0x995c('0x3a')](_0x4ee90e[_0x995c('0x35')][_0x995c('0x3a')]));_0x135a18[_0x995c('0x38')]=_0x135a18[_0x995c('0x38')][_0x995c('0x3b')]?_0x135a18[_0x995c('0x38')]:_0x176af2['model'];if(_0x4ee90e[_0x995c('0x35')][_0x995c('0x45')]){_0x135a18[_0x995c('0x46')]=[{'all':!![]}];}_0x135a18=_[_0x995c('0x42')]({},_0x135a18,_0x4ee90e['options']);return db[_0x995c('0x30')]['find'](_0x135a18)['then'](handleEntityNotFound(_0x4e42d0,null))[_0x995c('0x48')](respondWithResult(_0x4e42d0,null))[_0x995c('0x4c')](handleError(_0x4e42d0,null));};exports[_0x995c('0x4d')]=function(_0x40cc31,_0x6d22f5){return db['SugarcrmConfiguration'][_0x995c('0x4d')](_0x40cc31[_0x995c('0x4e')],{})['then'](respondWithResult(_0x6d22f5,0xc9))[_0x995c('0x4c')](handleError(_0x6d22f5,null));};exports['update']=function(_0x226f05,_0x421ac5){if(_0x226f05['body']['id']){delete _0x226f05[_0x995c('0x4e')]['id'];}return db[_0x995c('0x30')]['find']({'where':{'id':_0x226f05[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x421ac5,null))[_0x995c('0x48')](saveUpdates(_0x226f05[_0x995c('0x4e')],null))['then'](respondWithResult(_0x421ac5,null))[_0x995c('0x4c')](handleError(_0x421ac5,null));};exports[_0x995c('0x2a')]=function(_0x2ff4bd,_0x31485d){return db[_0x995c('0x30')][_0x995c('0x4f')]({'where':{'id':_0x2ff4bd[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x31485d,null))['then'](removeEntity(_0x31485d,null))[_0x995c('0x4c')](handleError(_0x31485d,null));};exports['getFields']=function(_0x5b5708,_0x5c232c,_0x12d2f1){var _0x95faa={};var _0x15b375={};var _0x242f72;var _0xea6d75;return db[_0x995c('0x30')]['findOne']({'where':{'id':_0x5b5708[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x5c232c,null))[_0x995c('0x48')](function(_0xc72b97){if(_0xc72b97){_0x242f72=_0xc72b97;_0x15b375[_0x995c('0x37')]=_[_0x995c('0x4b')](db['SugarcrmField'][_0x995c('0x31')]);_0x15b375['query']=_['keys'](_0x5b5708[_0x995c('0x35')]);_0x15b375[_0x995c('0x36')]=_['intersection'](_0x15b375[_0x995c('0x37')],_0x15b375[_0x995c('0x35')]);_0x95faa[_0x995c('0x38')]=_[_0x995c('0x39')](_0x15b375['model'],qs['fields'](_0x5b5708[_0x995c('0x35')]['fields']));_0x95faa[_0x995c('0x38')]=_0x95faa[_0x995c('0x38')][_0x995c('0x3b')]?_0x95faa[_0x995c('0x38')]:_0x15b375['model'];_0x95faa[_0x995c('0x3d')]=qs[_0x995c('0x3e')](_0x5b5708['query'][_0x995c('0x3e')]);_0x95faa[_0x995c('0x41')]=qs[_0x995c('0x36')](_[_0x995c('0x3f')](_0x5b5708[_0x995c('0x35')],_0x15b375[_0x995c('0x36')]));if(_0x5b5708[_0x995c('0x35')][_0x995c('0x40')]){_0x95faa[_0x995c('0x41')]=_[_0x995c('0x42')](_0x95faa[_0x995c('0x41')],{'$or':_[_0x995c('0x2f')](_0x95faa['attributes'],function(_0x5d402d){var _0x21634b={};_0x21634b[_0x5d402d]={'$like':'%'+_0x5b5708['query'][_0x995c('0x40')]+'%'};return _0x21634b;})});}_0x95faa=_[_0x995c('0x42')]({},_0x95faa,_0x5b5708[_0x995c('0x44')]);return _0x242f72[_0x995c('0x50')](_0x95faa);}})['then'](function(_0x3b4cc7){if(_0x3b4cc7){_0xea6d75=_0x3b4cc7[_0x995c('0x3b')];if(!_0x5b5708[_0x995c('0x35')][_0x995c('0x51')](_0x995c('0x3c'))){_0x95faa[_0x995c('0x23')]=qs['limit'](_0x5b5708[_0x995c('0x35')]['limit']);_0x95faa[_0x995c('0x20')]=qs[_0x995c('0x20')](_0x5b5708['query'][_0x995c('0x20')]);}return _0x242f72[_0x995c('0x50')](_0x95faa);}})[_0x995c('0x48')](function(_0x40b4bc){if(_0x40b4bc){return _0x40b4bc?{'count':_0xea6d75,'rows':_0x40b4bc}:null;}})[_0x995c('0x48')](respondWithResult(_0x5c232c,null))[_0x995c('0x4c')](handleError(_0x5c232c,null));};exports['getSubjects']=function(_0x40fc5e,_0x1617b3,_0x39a884){var _0x1d8639={};var _0xf49c93={};var _0x2424d3;var _0x434c0a;return db[_0x995c('0x30')]['findOne']({'where':{'id':_0x40fc5e[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x1617b3,null))[_0x995c('0x48')](function(_0x54d120){if(_0x54d120){_0x2424d3=_0x54d120;_0xf49c93['model']=_[_0x995c('0x4b')](db['SugarcrmField'][_0x995c('0x31')]);_0xf49c93[_0x995c('0x35')]=_[_0x995c('0x4b')](_0x40fc5e[_0x995c('0x35')]);_0xf49c93[_0x995c('0x36')]=_[_0x995c('0x39')](_0xf49c93[_0x995c('0x37')],_0xf49c93[_0x995c('0x35')]);_0x1d8639[_0x995c('0x38')]=_[_0x995c('0x39')](_0xf49c93[_0x995c('0x37')],qs['fields'](_0x40fc5e[_0x995c('0x35')]['fields']));_0x1d8639['attributes']=_0x1d8639['attributes'][_0x995c('0x3b')]?_0x1d8639[_0x995c('0x38')]:_0xf49c93[_0x995c('0x37')];_0x1d8639[_0x995c('0x3d')]=qs['sort'](_0x40fc5e[_0x995c('0x35')][_0x995c('0x3e')]);_0x1d8639[_0x995c('0x41')]=qs[_0x995c('0x36')](_[_0x995c('0x3f')](_0x40fc5e[_0x995c('0x35')],_0xf49c93[_0x995c('0x36')]));if(_0x40fc5e['query'][_0x995c('0x40')]){_0x1d8639[_0x995c('0x41')]=_['merge'](_0x1d8639[_0x995c('0x41')],{'$or':_[_0x995c('0x2f')](_0x1d8639[_0x995c('0x38')],function(_0xb3467d){var _0x39e720={};_0x39e720[_0xb3467d]={'$like':'%'+_0x40fc5e[_0x995c('0x35')][_0x995c('0x40')]+'%'};return _0x39e720;})});}_0x1d8639=_[_0x995c('0x42')]({},_0x1d8639,_0x40fc5e['options']);return _0x2424d3[_0x995c('0x52')](_0x1d8639);}})[_0x995c('0x48')](function(_0x14b2c4){if(_0x14b2c4){_0x434c0a=_0x14b2c4[_0x995c('0x3b')];if(!_0x40fc5e[_0x995c('0x35')]['hasOwnProperty'](_0x995c('0x3c'))){_0x1d8639[_0x995c('0x23')]=qs['limit'](_0x40fc5e[_0x995c('0x35')][_0x995c('0x23')]);_0x1d8639[_0x995c('0x20')]=qs[_0x995c('0x20')](_0x40fc5e[_0x995c('0x35')][_0x995c('0x20')]);}return _0x2424d3['getSubjects'](_0x1d8639);}})['then'](function(_0x2ed37a){if(_0x2ed37a){return _0x2ed37a?{'count':_0x434c0a,'rows':_0x2ed37a}:null;}})[_0x995c('0x48')](respondWithResult(_0x1617b3,null))[_0x995c('0x4c')](handleError(_0x1617b3,null));};exports[_0x995c('0x53')]=function(_0x36ddda,_0x5945ad,_0x24f940){var _0x1b3c70={};var _0x27d917={};var _0x8bbd20;var _0xa178b8;return db['SugarcrmConfiguration'][_0x995c('0x54')]({'where':{'id':_0x36ddda[_0x995c('0x4a')]['id']}})[_0x995c('0x48')](handleEntityNotFound(_0x5945ad,null))[_0x995c('0x48')](function(_0x343bc6){if(_0x343bc6){_0x8bbd20=_0x343bc6;_0x27d917[_0x995c('0x37')]=_['keys'](db[_0x995c('0x55')][_0x995c('0x31')]);_0x27d917[_0x995c('0x35')]=_['keys'](_0x36ddda[_0x995c('0x35')]);_0x27d917[_0x995c('0x36')]=_['intersection'](_0x27d917[_0x995c('0x37')],_0x27d917[_0x995c('0x35')]);_0x1b3c70[_0x995c('0x38')]=_[_0x995c('0x39')](_0x27d917['model'],qs[_0x995c('0x3a')](_0x36ddda[_0x995c('0x35')][_0x995c('0x3a')]));_0x1b3c70['attributes']=_0x1b3c70['attributes']['length']?_0x1b3c70[_0x995c('0x38')]:_0x27d917[_0x995c('0x37')];_0x1b3c70[_0x995c('0x3d')]=qs[_0x995c('0x3e')](_0x36ddda[_0x995c('0x35')][_0x995c('0x3e')]);_0x1b3c70[_0x995c('0x41')]=qs[_0x995c('0x36')](_[_0x995c('0x3f')](_0x36ddda[_0x995c('0x35')],_0x27d917[_0x995c('0x36')]));if(_0x36ddda[_0x995c('0x35')]['filter']){_0x1b3c70['where']=_['merge'](_0x1b3c70['where'],{'$or':_[_0x995c('0x2f')](_0x1b3c70['attributes'],function(_0x21bacd){var _0x47a28b={};_0x47a28b[_0x21bacd]={'$like':'%'+_0x36ddda[_0x995c('0x35')][_0x995c('0x40')]+'%'};return _0x47a28b;})});}_0x1b3c70=_[_0x995c('0x42')]({},_0x1b3c70,_0x36ddda['options']);return _0x8bbd20[_0x995c('0x53')](_0x1b3c70);}})[_0x995c('0x48')](function(_0x5b5920){if(_0x5b5920){_0xa178b8=_0x5b5920['length'];if(!_0x36ddda[_0x995c('0x35')]['hasOwnProperty'](_0x995c('0x3c'))){_0x1b3c70[_0x995c('0x23')]=qs[_0x995c('0x23')](_0x36ddda['query'][_0x995c('0x23')]);_0x1b3c70[_0x995c('0x20')]=qs[_0x995c('0x20')](_0x36ddda[_0x995c('0x35')][_0x995c('0x20')]);}return _0x8bbd20['getDescriptions'](_0x1b3c70);}})[_0x995c('0x48')](function(_0x209165){if(_0x209165){return _0x209165?{'count':_0xa178b8,'rows':_0x209165}:null;}})[_0x995c('0x48')](respondWithResult(_0x5945ad,null))['catch'](handleError(_0x5945ad,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index df8ea5d..ba56601 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 _0x5c75=['api','request-promise','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x5c75,0x1b6));var _0x55c7=function(_0x599f13,_0x1c0140){_0x599f13=_0x599f13-0x0;var _0x1ebd6a=_0x5c75[_0x599f13];return _0x1ebd6a;};'use strict';var _=require(_0x55c7('0x0'));var util=require('util');var logger=require(_0x55c7('0x1'))(_0x55c7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x55c7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x55c7('0x4'));var attributes=require(_0x55c7('0x5'));module[_0x55c7('0x6')]=function(_0x4b6430,_0x22e583){return _0x4b6430[_0x55c7('0x7')](_0x55c7('0x8'),attributes,{'tableName':_0x55c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e3c=['moment','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api'];(function(_0x376be8,_0x4ab14e){var _0x327b16=function(_0x18b394){while(--_0x18b394){_0x376be8['push'](_0x376be8['shift']());}};_0x327b16(++_0x4ab14e);}(_0x3e3c,0xd5));var _0xc3e3=function(_0x4355b4,_0x378da9){_0x4355b4=_0x4355b4-0x0;var _0x199e44=_0x3e3c[_0x4355b4];return _0x199e44;};'use strict';var _=require(_0xc3e3('0x0'));var util=require('util');var logger=require(_0xc3e3('0x1'))(_0xc3e3('0x2'));var moment=require(_0xc3e3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3e3('0x5'));var config=require(_0xc3e3('0x6'));var attributes=require(_0xc3e3('0x7'));module[_0xc3e3('0x8')]=function(_0x353b7d,_0xf86870){return _0x353b7d[_0xc3e3('0x9')](_0xc3e3('0xa'),attributes,{'tableName':_0xc3e3('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 4894745..ac3e046 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 _0x3949=['../../config/logger','../../config/environment','jayson/promise','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x164e0d,_0x25f0aa){var _0x3920da=function(_0x29c6c0){while(--_0x29c6c0){_0x164e0d['push'](_0x164e0d['shift']());}};_0x3920da(++_0x25f0aa);}(_0x3949,0x118));var _0x9394=function(_0x2e2568,_0x3f4818){_0x2e2568=_0x2e2568-0x0;var _0x58c455=_0x3949[_0x2e2568];return _0x58c455;};'use strict';var _=require(_0x9394('0x0'));var util=require(_0x9394('0x1'));var moment=require(_0x9394('0x2'));var BPromise=require('bluebird');var rs=require(_0x9394('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9394('0x4'))['db'];var utils=require(_0x9394('0x5'));var logger=require(_0x9394('0x6'))('rpc');var config=require(_0x9394('0x7'));var jayson=require(_0x9394('0x8'));var client=jayson['client'][_0x9394('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ca086,_0x447df2,_0x5a1748){return new BPromise(function(_0x576a1d,_0x25edad){return client['request'](_0x5ca086,_0x5a1748)[_0x9394('0xa')](function(_0x3271f9){logger[_0x9394('0xb')](_0x9394('0xc'),_0x447df2,_0x9394('0xd'));logger[_0x9394('0xe')](_0x9394('0xf'),_0x447df2,_0x9394('0xd'),JSON[_0x9394('0x10')](_0x3271f9));if(_0x3271f9[_0x9394('0x11')]){if(_0x3271f9['error'][_0x9394('0x12')]===0x1f4){logger['error'](_0x9394('0xc'),_0x447df2,_0x3271f9['error'][_0x9394('0x13')]);return _0x25edad(_0x3271f9[_0x9394('0x11')]['message']);}logger[_0x9394('0x11')](_0x9394('0xc'),_0x447df2,_0x3271f9[_0x9394('0x11')][_0x9394('0x13')]);return _0x576a1d(_0x3271f9[_0x9394('0x11')][_0x9394('0x13')]);}else{logger[_0x9394('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x447df2,_0x9394('0xd'));_0x576a1d(_0x3271f9[_0x9394('0x14')][_0x9394('0x13')]);}})[_0x9394('0x15')](function(_0x2c75e4){logger[_0x9394('0x11')](_0x9394('0xc'),_0x447df2,_0x2c75e4);_0x25edad(_0x2c75e4);});});} \ No newline at end of file +var _0xcd8c=['../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0xcd8c,0xd0));var _0xccd8=function(_0x5815af,_0x361f0b){_0x5815af=_0x5815af-0x0;var _0x3f14cb=_0xcd8c[_0x5815af];return _0x3f14cb;};'use strict';var _=require('lodash');var util=require(_0xccd8('0x0'));var moment=require(_0xccd8('0x1'));var BPromise=require(_0xccd8('0x2'));var rs=require(_0xccd8('0x3'));var fs=require('fs');var Redis=require(_0xccd8('0x4'));var db=require(_0xccd8('0x5'))['db'];var utils=require(_0xccd8('0x6'));var logger=require('../../config/logger')(_0xccd8('0x7'));var config=require(_0xccd8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xccd8('0x9')][_0xccd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ef68d,_0x1ab072,_0x4f6aa0){return new BPromise(function(_0x27786a,_0x507d2c){return client[_0xccd8('0xb')](_0x5ef68d,_0x4f6aa0)[_0xccd8('0xc')](function(_0x1d1aa0){logger[_0xccd8('0xd')](_0xccd8('0xe'),_0x1ab072,_0xccd8('0xf'));logger[_0xccd8('0x10')](_0xccd8('0x11'),_0x1ab072,'request\x20sent',JSON[_0xccd8('0x12')](_0x1d1aa0));if(_0x1d1aa0[_0xccd8('0x13')]){if(_0x1d1aa0[_0xccd8('0x13')][_0xccd8('0x14')]===0x1f4){logger['error'](_0xccd8('0xe'),_0x1ab072,_0x1d1aa0[_0xccd8('0x13')][_0xccd8('0x15')]);return _0x507d2c(_0x1d1aa0[_0xccd8('0x13')]['message']);}logger['error'](_0xccd8('0xe'),_0x1ab072,_0x1d1aa0[_0xccd8('0x13')][_0xccd8('0x15')]);return _0x27786a(_0x1d1aa0[_0xccd8('0x13')][_0xccd8('0x15')]);}else{logger['info'](_0xccd8('0xe'),_0x1ab072,_0xccd8('0xf'));_0x27786a(_0x1d1aa0[_0xccd8('0x16')][_0xccd8('0x15')]);}})[_0xccd8('0x17')](function(_0x31f2bf){logger[_0xccd8('0x13')](_0xccd8('0xe'),_0x1ab072,_0x31f2bf);_0x507d2c(_0x31f2bf);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2614c58..ec89d13 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 _0xd413=['express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','util','path'];(function(_0x489716,_0x309836){var _0x3c2bf1=function(_0x358262){while(--_0x358262){_0x489716['push'](_0x489716['shift']());}};_0x3c2bf1(++_0x309836);}(_0xd413,0x7e));var _0x3d41=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0xd413[_0x1526e1];return _0x249a1e;};'use strict';var multer=require('multer');var util=require(_0x3d41('0x0'));var path=require(_0x3d41('0x1'));var timeout=require('connect-timeout');var express=require(_0x3d41('0x2'));var router=express[_0x3d41('0x3')]();var fs_extra=require(_0x3d41('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3d41('0x5'));var config=require('../../config/environment');var controller=require(_0x3d41('0x6'));router['get']('/',auth[_0x3d41('0x7')](),controller[_0x3d41('0x8')]);router[_0x3d41('0x9')](_0x3d41('0xa'),auth['isAuthenticated'](),controller[_0x3d41('0xb')]);router['post']('/',auth[_0x3d41('0x7')](),controller[_0x3d41('0xc')]);router[_0x3d41('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3d41('0xe')]);router[_0x3d41('0xf')](_0x3d41('0xa'),auth[_0x3d41('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2552=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x906575,_0x36eda6){var _0x2ca509=function(_0x5ad5d6){while(--_0x5ad5d6){_0x906575['push'](_0x906575['shift']());}};_0x2ca509(++_0x36eda6);}(_0x2552,0x1b7));var _0x2255=function(_0x37355e,_0x300682){_0x37355e=_0x37355e-0x0;var _0x4d934c=_0x2552[_0x37355e];return _0x4d934c;};'use strict';var multer=require(_0x2255('0x0'));var util=require(_0x2255('0x1'));var path=require(_0x2255('0x2'));var timeout=require(_0x2255('0x3'));var express=require(_0x2255('0x4'));var router=express[_0x2255('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2255('0x6'));var interaction=require(_0x2255('0x7'));var config=require(_0x2255('0x8'));var controller=require('./intSugarcrmField.controller');router[_0x2255('0x9')]('/',auth[_0x2255('0xa')](),controller[_0x2255('0xb')]);router[_0x2255('0x9')](_0x2255('0xc'),auth[_0x2255('0xa')](),controller[_0x2255('0xd')]);router['post']('/',auth[_0x2255('0xa')](),controller[_0x2255('0xe')]);router[_0x2255('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2255('0x10')]);router[_0x2255('0x11')]('/:id',auth[_0x2255('0xa')](),controller[_0x2255('0x12')]);module[_0x2255('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 61d0d86..67c129b 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 _0x549a=['string','variable','customVariable','STRING','sequelize','ENUM'];(function(_0x55847d,_0x56d803){var _0x416818=function(_0x370c23){while(--_0x370c23){_0x55847d['push'](_0x55847d['shift']());}};_0x416818(++_0x56d803);}(_0x549a,0x1f0));var _0xa549=function(_0x1383d5,_0xc5e413){_0x1383d5=_0x1383d5-0x0;var _0x3f9970=_0x549a[_0x1383d5];return _0x3f9970;};'use strict';var Sequelize=require(_0xa549('0x0'));module['exports']={'type':{'type':Sequelize[_0xa549('0x1')](_0xa549('0x2'),_0xa549('0x3'),_0xa549('0x4'),'keyValue','picklist'),'defaultValue':_0xa549('0x2')},'content':{'type':Sequelize[_0xa549('0x5')]},'key':{'type':Sequelize[_0xa549('0x5')]},'keyType':{'type':Sequelize[_0xa549('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xa549('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa549('0x5')]}}; \ No newline at end of file +var _0x414b=['STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x3e99d8,_0x15974f){var _0xcc365a=function(_0x5b1a58){while(--_0x5b1a58){_0x3e99d8['push'](_0x3e99d8['shift']());}};_0xcc365a(++_0x15974f);}(_0x414b,0x72));var _0xb414=function(_0x2a2f48,_0x5611f9){_0x2a2f48=_0x2a2f48-0x0;var _0x412a43=_0x414b[_0x2a2f48];return _0x412a43;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb414('0x0')](_0xb414('0x1'),_0xb414('0x2'),_0xb414('0x3'),_0xb414('0x4'),_0xb414('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb414('0x6')]},'key':{'type':Sequelize[_0xb414('0x6')]},'keyType':{'type':Sequelize[_0xb414('0x0')](_0xb414('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb414('0x6')]},'idField':{'type':Sequelize[_0xb414('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb414('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb414('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 8e34f94..959b1f4 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 _0x3538=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','SugarcrmField','rows','catch','show','params','keys','intersection','length','includeAll','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0x3538,0x194));var _0x8353=function(_0x39b449,_0x33aed6){_0x39b449=_0x39b449-0x0;var _0x5ac0aa=_0x3538[_0x39b449];return _0x5ac0aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8353('0x0'));var zipdir=require(_0x8353('0x1'));var jsonpatch=require(_0x8353('0x2'));var rp=require(_0x8353('0x3'));var moment=require(_0x8353('0x4'));var BPromise=require(_0x8353('0x5'));var Mustache=require(_0x8353('0x6'));var util=require(_0x8353('0x7'));var path=require(_0x8353('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8353('0x9'));var _=require(_0x8353('0xa'));var squel=require(_0x8353('0xb'));var crypto=require(_0x8353('0xc'));var jsforce=require(_0x8353('0xd'));var deskjs=require(_0x8353('0xe'));var toCsv=require(_0x8353('0xf'));var querystring=require(_0x8353('0x10'));var Papa=require(_0x8353('0x11'));var Redis=require(_0x8353('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8353('0x13'));var as=require(_0x8353('0x14'));var hardwareService=require(_0x8353('0x15'));var logger=require(_0x8353('0x16'))('api');var utils=require(_0x8353('0x17'));var config=require(_0x8353('0x18'));var licenseUtil=require(_0x8353('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d582f,_0x1927e0){_0x1927e0=_0x1927e0||0xcc;return function(_0x5ae064){if(_0x5ae064){return _0x2d582f[_0x8353('0x1a')](_0x1927e0);}return _0x2d582f[_0x8353('0x1b')](_0x1927e0)[_0x8353('0x1c')]();};}function respondWithResult(_0x33ed0b,_0x3ad320){_0x3ad320=_0x3ad320||0xc8;return function(_0x34f46d){if(_0x34f46d){return _0x33ed0b[_0x8353('0x1b')](_0x3ad320)[_0x8353('0x1d')](_0x34f46d);}};}function respondWithFilteredResult(_0x275712,_0x586d60){return function(_0x4128ef){if(_0x4128ef){var _0x1181cd=typeof _0x586d60['offset']===_0x8353('0x1e')&&typeof _0x586d60[_0x8353('0x1f')]===_0x8353('0x1e');var _0x43d10a=_0x4128ef[_0x8353('0x20')];var _0x563ad0=_0x1181cd?0x0:_0x586d60[_0x8353('0x21')];var _0x3ec401=_0x1181cd?_0x4128ef[_0x8353('0x20')]:_0x586d60[_0x8353('0x21')]+_0x586d60['limit'];var _0x203976;if(_0x3ec401>=_0x43d10a){_0x3ec401=_0x43d10a;_0x203976=0xc8;}else{_0x203976=0xce;}_0x275712['status'](_0x203976);return _0x275712[_0x8353('0x22')](_0x8353('0x23'),_0x563ad0+'-'+_0x3ec401+'/'+_0x43d10a)[_0x8353('0x1d')](_0x4128ef);}return null;};}function patchUpdates(_0x347b86){return function(_0xcc9939){try{jsonpatch[_0x8353('0x24')](_0xcc9939,_0x347b86,!![]);}catch(_0x4eb0c7){return BPromise['reject'](_0x4eb0c7);}return _0xcc9939[_0x8353('0x25')]();};}function saveUpdates(_0x52f702,_0x3dd488){return function(_0x466816){if(_0x466816){return _0x466816[_0x8353('0x26')](_0x52f702)[_0x8353('0x27')](function(_0x54dfb2){return _0x54dfb2;});}return null;};}function removeEntity(_0x1e7e2d,_0x412e78){return function(_0x4c98f4){if(_0x4c98f4){return _0x4c98f4[_0x8353('0x28')]()[_0x8353('0x27')](function(){_0x1e7e2d[_0x8353('0x1b')](0xcc)[_0x8353('0x1c')]();});}};}function handleEntityNotFound(_0x2b93cc,_0x36afc6){return function(_0x5fe347){if(!_0x5fe347){_0x2b93cc[_0x8353('0x1a')](0x194);}return _0x5fe347;};}function handleError(_0x42d0c4,_0x381375){_0x381375=_0x381375||0x1f4;return function(_0x37972c){logger[_0x8353('0x29')](_0x37972c[_0x8353('0x2a')]);if(_0x37972c[_0x8353('0x2b')]){delete _0x37972c[_0x8353('0x2b')];}_0x42d0c4[_0x8353('0x1b')](_0x381375)[_0x8353('0x2c')](_0x37972c);};}exports[_0x8353('0x2d')]=function(_0x288e28,_0x2363cc){var _0x3b6bb2={},_0x2ca4c4={},_0x1969a5={'count':0x0,'rows':[]};var _0x35c3ad=_[_0x8353('0x2e')](db['SugarcrmField'][_0x8353('0x2f')],function(_0x483455){return{'name':_0x483455['fieldName'],'type':_0x483455[_0x8353('0x30')][_0x8353('0x31')]};});_0x2ca4c4[_0x8353('0x32')]=_['map'](_0x35c3ad,_0x8353('0x2b'));_0x2ca4c4[_0x8353('0x33')]=_['keys'](_0x288e28[_0x8353('0x33')]);_0x2ca4c4['filters']=_['intersection'](_0x2ca4c4[_0x8353('0x32')],_0x2ca4c4[_0x8353('0x33')]);_0x3b6bb2[_0x8353('0x34')]=_['intersection'](_0x2ca4c4[_0x8353('0x32')],qs[_0x8353('0x35')](_0x288e28[_0x8353('0x33')]['fields']));_0x3b6bb2[_0x8353('0x34')]=_0x3b6bb2[_0x8353('0x34')]['length']?_0x3b6bb2['attributes']:_0x2ca4c4[_0x8353('0x32')];if(!_0x288e28['query'][_0x8353('0x36')](_0x8353('0x37'))){_0x3b6bb2[_0x8353('0x1f')]=qs[_0x8353('0x1f')](_0x288e28[_0x8353('0x33')][_0x8353('0x1f')]);_0x3b6bb2[_0x8353('0x21')]=qs[_0x8353('0x21')](_0x288e28[_0x8353('0x33')]['offset']);}_0x3b6bb2[_0x8353('0x38')]=qs[_0x8353('0x39')](_0x288e28[_0x8353('0x33')][_0x8353('0x39')]);_0x3b6bb2[_0x8353('0x3a')]=qs[_0x8353('0x3b')](_[_0x8353('0x3c')](_0x288e28[_0x8353('0x33')],_0x2ca4c4[_0x8353('0x3b')]),_0x35c3ad);if(_0x288e28['query'][_0x8353('0x3d')]){_0x3b6bb2[_0x8353('0x3a')]=_[_0x8353('0x3e')](_0x3b6bb2['where'],{'$or':_[_0x8353('0x2e')](_0x35c3ad,function(_0x4907e7){if(_0x4907e7[_0x8353('0x30')]!=='VIRTUAL'){var _0x166c3d={};_0x166c3d[_0x4907e7[_0x8353('0x2b')]]={'$like':'%'+_0x288e28['query']['filter']+'%'};return _0x166c3d;}})});}_0x3b6bb2=_['merge']({},_0x3b6bb2,_0x288e28['options']);var _0x52f2d6={'where':_0x3b6bb2[_0x8353('0x3a')]};return db[_0x8353('0x3f')]['count'](_0x52f2d6)[_0x8353('0x27')](function(_0x2e94e1){_0x1969a5[_0x8353('0x20')]=_0x2e94e1;if(_0x288e28[_0x8353('0x33')]['includeAll']){_0x3b6bb2['include']=[{'all':!![]}];}return db[_0x8353('0x3f')]['findAll'](_0x3b6bb2);})['then'](function(_0x619cc7){_0x1969a5[_0x8353('0x40')]=_0x619cc7;return _0x1969a5;})[_0x8353('0x27')](respondWithFilteredResult(_0x2363cc,_0x3b6bb2))[_0x8353('0x41')](handleError(_0x2363cc,null));};exports[_0x8353('0x42')]=function(_0x36840b,_0x156186){var _0x40350a={'raw':!![],'where':{'id':_0x36840b[_0x8353('0x43')]['id']}},_0x31338d={};_0x31338d[_0x8353('0x32')]=_[_0x8353('0x44')](db[_0x8353('0x3f')][_0x8353('0x2f')]);_0x31338d['query']=_[_0x8353('0x44')](_0x36840b[_0x8353('0x33')]);_0x31338d[_0x8353('0x3b')]=_[_0x8353('0x45')](_0x31338d[_0x8353('0x32')],_0x31338d['query']);_0x40350a['attributes']=_[_0x8353('0x45')](_0x31338d[_0x8353('0x32')],qs[_0x8353('0x35')](_0x36840b['query'][_0x8353('0x35')]));_0x40350a[_0x8353('0x34')]=_0x40350a['attributes'][_0x8353('0x46')]?_0x40350a['attributes']:_0x31338d[_0x8353('0x32')];if(_0x36840b['query'][_0x8353('0x47')]){_0x40350a['include']=[{'all':!![]}];}_0x40350a=_[_0x8353('0x3e')]({},_0x40350a,_0x36840b[_0x8353('0x48')]);return db[_0x8353('0x3f')][_0x8353('0x49')](_0x40350a)['then'](handleEntityNotFound(_0x156186,null))[_0x8353('0x27')](respondWithResult(_0x156186,null))[_0x8353('0x41')](handleError(_0x156186,null));};exports[_0x8353('0x4a')]=function(_0x459d7a,_0x45ab7a){return db[_0x8353('0x3f')]['create'](_0x459d7a[_0x8353('0x4b')],{})['then'](respondWithResult(_0x45ab7a,0xc9))[_0x8353('0x41')](handleError(_0x45ab7a,null));};exports[_0x8353('0x26')]=function(_0x58dbdb,_0x6c5c37){if(_0x58dbdb[_0x8353('0x4b')]['id']){delete _0x58dbdb['body']['id'];}return db[_0x8353('0x3f')]['find']({'where':{'id':_0x58dbdb[_0x8353('0x43')]['id']}})[_0x8353('0x27')](handleEntityNotFound(_0x6c5c37,null))[_0x8353('0x27')](saveUpdates(_0x58dbdb['body'],null))[_0x8353('0x27')](respondWithResult(_0x6c5c37,null))['catch'](handleError(_0x6c5c37,null));};exports['destroy']=function(_0x2e7566,_0x79c630){return db[_0x8353('0x3f')][_0x8353('0x49')]({'where':{'id':_0x2e7566[_0x8353('0x43')]['id']}})[_0x8353('0x27')](handleEntityNotFound(_0x79c630,null))['then'](removeEntity(_0x79c630,null))[_0x8353('0x41')](handleError(_0x79c630,null));}; \ No newline at end of file +var _0x7ab2=['crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','SugarcrmField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','options','includeAll','include','findAll','rows','show','params','keys','merge','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2ac84e,_0x3d8931){var _0x481a04=function(_0x367b52){while(--_0x367b52){_0x2ac84e['push'](_0x2ac84e['shift']());}};_0x481a04(++_0x3d8931);}(_0x7ab2,0xca));var _0x27ab=function(_0x12c557,_0x49349d){_0x12c557=_0x12c557-0x0;var _0x13f83c=_0x7ab2[_0x12c557];return _0x13f83c;};'use strict';var emlformat=require(_0x27ab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x27ab('0x1'));var rp=require(_0x27ab('0x2'));var moment=require(_0x27ab('0x3'));var BPromise=require(_0x27ab('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x27ab('0x5'));var sox=require('sox');var csv=require(_0x27ab('0x6'));var ejs=require(_0x27ab('0x7'));var fs=require('fs');var fs_extra=require(_0x27ab('0x8'));var _=require(_0x27ab('0x9'));var squel=require(_0x27ab('0xa'));var crypto=require(_0x27ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x27ab('0xc'));var toCsv=require(_0x27ab('0x6'));var querystring=require('querystring');var Papa=require(_0x27ab('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x27ab('0xe'));var as=require(_0x27ab('0xf'));var hardwareService=require(_0x27ab('0x10'));var logger=require(_0x27ab('0x11'))(_0x27ab('0x12'));var utils=require(_0x27ab('0x13'));var config=require(_0x27ab('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9e2701,_0x643747){_0x643747=_0x643747||0xcc;return function(_0x1d5f8d){if(_0x1d5f8d){return _0x9e2701[_0x27ab('0x15')](_0x643747);}return _0x9e2701['status'](_0x643747)['end']();};}function respondWithResult(_0x3ab137,_0x225f51){_0x225f51=_0x225f51||0xc8;return function(_0x14f04d){if(_0x14f04d){return _0x3ab137[_0x27ab('0x16')](_0x225f51)[_0x27ab('0x17')](_0x14f04d);}};}function respondWithFilteredResult(_0x7bb772,_0x18113d){return function(_0xd88b91){if(_0xd88b91){var _0x55190b=typeof _0x18113d['offset']==='undefined'&&typeof _0x18113d[_0x27ab('0x18')]===_0x27ab('0x19');var _0xea9bd5=_0xd88b91[_0x27ab('0x1a')];var _0x39f221=_0x55190b?0x0:_0x18113d[_0x27ab('0x1b')];var _0x1ffc45=_0x55190b?_0xd88b91['count']:_0x18113d[_0x27ab('0x1b')]+_0x18113d['limit'];var _0x5adae8;if(_0x1ffc45>=_0xea9bd5){_0x1ffc45=_0xea9bd5;_0x5adae8=0xc8;}else{_0x5adae8=0xce;}_0x7bb772[_0x27ab('0x16')](_0x5adae8);return _0x7bb772['set'](_0x27ab('0x1c'),_0x39f221+'-'+_0x1ffc45+'/'+_0xea9bd5)[_0x27ab('0x17')](_0xd88b91);}return null;};}function patchUpdates(_0x2748ae){return function(_0x36a0d1){try{jsonpatch[_0x27ab('0x1d')](_0x36a0d1,_0x2748ae,!![]);}catch(_0x2b07ff){return BPromise[_0x27ab('0x1e')](_0x2b07ff);}return _0x36a0d1[_0x27ab('0x1f')]();};}function saveUpdates(_0x29aded,_0x28f532){return function(_0x11f201){if(_0x11f201){return _0x11f201[_0x27ab('0x20')](_0x29aded)[_0x27ab('0x21')](function(_0x1c8cae){return _0x1c8cae;});}return null;};}function removeEntity(_0x1bb5a6,_0x26191a){return function(_0x2e3750){if(_0x2e3750){return _0x2e3750[_0x27ab('0x22')]()[_0x27ab('0x21')](function(){_0x1bb5a6['status'](0xcc)[_0x27ab('0x23')]();});}};}function handleEntityNotFound(_0x38b540,_0x3756a7){return function(_0x24b72a){if(!_0x24b72a){_0x38b540[_0x27ab('0x15')](0x194);}return _0x24b72a;};}function handleError(_0x5f0e5d,_0x533f66){_0x533f66=_0x533f66||0x1f4;return function(_0x472ed4){logger[_0x27ab('0x24')](_0x472ed4[_0x27ab('0x25')]);if(_0x472ed4[_0x27ab('0x26')]){delete _0x472ed4[_0x27ab('0x26')];}_0x5f0e5d['status'](_0x533f66)[_0x27ab('0x27')](_0x472ed4);};}exports['index']=function(_0x5c9fff,_0xe61fd5){var _0x2e4f05={},_0x2358fd={},_0x86c546={'count':0x0,'rows':[]};var _0x3941ac=_['map'](db[_0x27ab('0x28')][_0x27ab('0x29')],function(_0x3b648f){return{'name':_0x3b648f['fieldName'],'type':_0x3b648f[_0x27ab('0x2a')][_0x27ab('0x2b')]};});_0x2358fd[_0x27ab('0x2c')]=_['map'](_0x3941ac,_0x27ab('0x26'));_0x2358fd['query']=_['keys'](_0x5c9fff[_0x27ab('0x2d')]);_0x2358fd[_0x27ab('0x2e')]=_[_0x27ab('0x2f')](_0x2358fd[_0x27ab('0x2c')],_0x2358fd[_0x27ab('0x2d')]);_0x2e4f05[_0x27ab('0x30')]=_[_0x27ab('0x2f')](_0x2358fd['model'],qs['fields'](_0x5c9fff[_0x27ab('0x2d')][_0x27ab('0x31')]));_0x2e4f05[_0x27ab('0x30')]=_0x2e4f05[_0x27ab('0x30')]['length']?_0x2e4f05[_0x27ab('0x30')]:_0x2358fd[_0x27ab('0x2c')];if(!_0x5c9fff['query'][_0x27ab('0x32')](_0x27ab('0x33'))){_0x2e4f05[_0x27ab('0x18')]=qs[_0x27ab('0x18')](_0x5c9fff[_0x27ab('0x2d')]['limit']);_0x2e4f05['offset']=qs[_0x27ab('0x1b')](_0x5c9fff[_0x27ab('0x2d')][_0x27ab('0x1b')]);}_0x2e4f05[_0x27ab('0x34')]=qs[_0x27ab('0x35')](_0x5c9fff[_0x27ab('0x2d')][_0x27ab('0x35')]);_0x2e4f05[_0x27ab('0x36')]=qs[_0x27ab('0x2e')](_[_0x27ab('0x37')](_0x5c9fff[_0x27ab('0x2d')],_0x2358fd[_0x27ab('0x2e')]),_0x3941ac);if(_0x5c9fff['query']['filter']){_0x2e4f05[_0x27ab('0x36')]=_['merge'](_0x2e4f05[_0x27ab('0x36')],{'$or':_[_0x27ab('0x38')](_0x3941ac,function(_0x240eee){if(_0x240eee['type']!=='VIRTUAL'){var _0x4f0362={};_0x4f0362[_0x240eee['name']]={'$like':'%'+_0x5c9fff[_0x27ab('0x2d')][_0x27ab('0x39')]+'%'};return _0x4f0362;}})});}_0x2e4f05=_['merge']({},_0x2e4f05,_0x5c9fff[_0x27ab('0x3a')]);var _0x2b9f18={'where':_0x2e4f05[_0x27ab('0x36')]};return db[_0x27ab('0x28')][_0x27ab('0x1a')](_0x2b9f18)[_0x27ab('0x21')](function(_0xabc46e){_0x86c546[_0x27ab('0x1a')]=_0xabc46e;if(_0x5c9fff['query'][_0x27ab('0x3b')]){_0x2e4f05[_0x27ab('0x3c')]=[{'all':!![]}];}return db['SugarcrmField'][_0x27ab('0x3d')](_0x2e4f05);})[_0x27ab('0x21')](function(_0x2d6a84){_0x86c546[_0x27ab('0x3e')]=_0x2d6a84;return _0x86c546;})[_0x27ab('0x21')](respondWithFilteredResult(_0xe61fd5,_0x2e4f05))['catch'](handleError(_0xe61fd5,null));};exports[_0x27ab('0x3f')]=function(_0x4c59be,_0x1712b6){var _0x55e621={'raw':!![],'where':{'id':_0x4c59be[_0x27ab('0x40')]['id']}},_0x3ed800={};_0x3ed800['model']=_[_0x27ab('0x41')](db[_0x27ab('0x28')][_0x27ab('0x29')]);_0x3ed800['query']=_['keys'](_0x4c59be[_0x27ab('0x2d')]);_0x3ed800['filters']=_[_0x27ab('0x2f')](_0x3ed800['model'],_0x3ed800[_0x27ab('0x2d')]);_0x55e621[_0x27ab('0x30')]=_[_0x27ab('0x2f')](_0x3ed800[_0x27ab('0x2c')],qs['fields'](_0x4c59be[_0x27ab('0x2d')][_0x27ab('0x31')]));_0x55e621[_0x27ab('0x30')]=_0x55e621['attributes']['length']?_0x55e621[_0x27ab('0x30')]:_0x3ed800[_0x27ab('0x2c')];if(_0x4c59be['query'][_0x27ab('0x3b')]){_0x55e621['include']=[{'all':!![]}];}_0x55e621=_[_0x27ab('0x42')]({},_0x55e621,_0x4c59be[_0x27ab('0x3a')]);return db['SugarcrmField'][_0x27ab('0x43')](_0x55e621)[_0x27ab('0x21')](handleEntityNotFound(_0x1712b6,null))[_0x27ab('0x21')](respondWithResult(_0x1712b6,null))[_0x27ab('0x44')](handleError(_0x1712b6,null));};exports['create']=function(_0x12b001,_0x4fa101){return db['SugarcrmField'][_0x27ab('0x45')](_0x12b001['body'],{})['then'](respondWithResult(_0x4fa101,0xc9))[_0x27ab('0x44')](handleError(_0x4fa101,null));};exports[_0x27ab('0x20')]=function(_0x3936c5,_0x451cbc){if(_0x3936c5['body']['id']){delete _0x3936c5[_0x27ab('0x46')]['id'];}return db[_0x27ab('0x28')][_0x27ab('0x43')]({'where':{'id':_0x3936c5[_0x27ab('0x40')]['id']}})[_0x27ab('0x21')](handleEntityNotFound(_0x451cbc,null))[_0x27ab('0x21')](saveUpdates(_0x3936c5[_0x27ab('0x46')],null))[_0x27ab('0x21')](respondWithResult(_0x451cbc,null))[_0x27ab('0x44')](handleError(_0x451cbc,null));};exports[_0x27ab('0x22')]=function(_0x14461e,_0x58dc1e){return db[_0x27ab('0x28')][_0x27ab('0x43')]({'where':{'id':_0x14461e[_0x27ab('0x40')]['id']}})[_0x27ab('0x21')](handleEntityNotFound(_0x58dc1e,null))[_0x27ab('0x21')](removeEntity(_0x58dc1e,null))[_0x27ab('0x44')](handleError(_0x58dc1e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ca66c09..e5b2e85 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 _0xa632=['../../config/logger','api','moment','request-promise','path','./intSugarcrmField.attributes','exports','SugarcrmField','idField','lodash','util'];(function(_0x55a631,_0x346621){var _0x4d3f35=function(_0x172f68){while(--_0x172f68){_0x55a631['push'](_0x55a631['shift']());}};_0x4d3f35(++_0x346621);}(_0xa632,0x1cc));var _0x2a63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa632[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2a63('0x0'));var util=require(_0x2a63('0x1'));var logger=require(_0x2a63('0x2'))(_0x2a63('0x3'));var moment=require(_0x2a63('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a63('0x5'));var fs=require('fs');var path=require(_0x2a63('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2a63('0x7'));module[_0x2a63('0x8')]=function(_0x1eed57,_0x482c51){return _0x1eed57['define'](_0x2a63('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x2a63('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c93=['bluebird','request-promise','path','../../config/environment','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','api'];(function(_0x4089c7,_0x120195){var _0x33dd04=function(_0x4e4fea){while(--_0x4e4fea){_0x4089c7['push'](_0x4089c7['shift']());}};_0x33dd04(++_0x120195);}(_0x3c93,0x1de));var _0x33c9=function(_0x29cea6,_0x3b8b19){_0x29cea6=_0x29cea6-0x0;var _0x3bf4d1=_0x3c93[_0x29cea6];return _0x3bf4d1;};'use strict';var _=require('lodash');var util=require(_0x33c9('0x0'));var logger=require('../../config/logger')(_0x33c9('0x1'));var moment=require('moment');var BPromise=require(_0x33c9('0x2'));var rp=require(_0x33c9('0x3'));var fs=require('fs');var path=require(_0x33c9('0x4'));var rimraf=require('rimraf');var config=require(_0x33c9('0x5'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0xbdd932,_0x5c4fc9){return _0xbdd932[_0x33c9('0x6')](_0x33c9('0x7'),attributes,{'tableName':_0x33c9('0x8'),'paranoid':![],'indexes':[{'name':_0x33c9('0x9'),'fields':[_0x33c9('0xa'),_0x33c9('0xb')],'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 7f95b2e..932e6ef 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 _0xe5fb=['SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5f1d50,_0x368c01){var _0x24cdfa=function(_0x4b1665){while(--_0x4b1665){_0x5f1d50['push'](_0x5f1d50['shift']());}};_0x24cdfa(++_0x368c01);}(_0xe5fb,0x179));var _0xbe5f=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xe5fb[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0xbe5f('0x0'));var util=require(_0xbe5f('0x1'));var moment=require('moment');var BPromise=require(_0xbe5f('0x2'));var rs=require(_0xbe5f('0x3'));var fs=require('fs');var Redis=require(_0xbe5f('0x4'));var db=require(_0xbe5f('0x5'))['db'];var utils=require(_0xbe5f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe5f('0x7'));var jayson=require(_0xbe5f('0x8'));var client=jayson[_0xbe5f('0x9')][_0xbe5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x531079,_0xbfee59,_0x3a21ad){return new BPromise(function(_0x161a0f,_0x187861){return client[_0xbe5f('0xb')](_0x531079,_0x3a21ad)[_0xbe5f('0xc')](function(_0x30aaaa){logger[_0xbe5f('0xd')](_0xbe5f('0xe'),_0xbfee59,'request\x20sent');logger[_0xbe5f('0xf')](_0xbe5f('0x10'),_0xbfee59,_0xbe5f('0x11'),JSON[_0xbe5f('0x12')](_0x30aaaa));if(_0x30aaaa[_0xbe5f('0x13')]){if(_0x30aaaa[_0xbe5f('0x13')][_0xbe5f('0x14')]===0x1f4){logger[_0xbe5f('0x13')](_0xbe5f('0xe'),_0xbfee59,_0x30aaaa['error'][_0xbe5f('0x15')]);return _0x187861(_0x30aaaa['error']['message']);}logger['error'](_0xbe5f('0xe'),_0xbfee59,_0x30aaaa['error'][_0xbe5f('0x15')]);return _0x161a0f(_0x30aaaa[_0xbe5f('0x13')][_0xbe5f('0x15')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0xbfee59,_0xbe5f('0x11'));_0x161a0f(_0x30aaaa[_0xbe5f('0x16')][_0xbe5f('0x15')]);}})['catch'](function(_0x13a189){logger[_0xbe5f('0x13')](_0xbe5f('0xe'),_0xbfee59,_0x13a189);_0x187861(_0x13a189);});});} \ No newline at end of file +var _0x938f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x51cd94,_0x4b6a50){var _0x4b4097=function(_0x29c45a){while(--_0x29c45a){_0x51cd94['push'](_0x51cd94['shift']());}};_0x4b4097(++_0x4b6a50);}(_0x938f,0x13c));var _0xf938=function(_0x34af74,_0x59ab9d){_0x34af74=_0x34af74-0x0;var _0x12d74b=_0x938f[_0x34af74];return _0x12d74b;};'use strict';var _=require(_0xf938('0x0'));var util=require(_0xf938('0x1'));var moment=require(_0xf938('0x2'));var BPromise=require(_0xf938('0x3'));var rs=require(_0xf938('0x4'));var fs=require('fs');var Redis=require(_0xf938('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf938('0x6'));var logger=require(_0xf938('0x7'))(_0xf938('0x8'));var config=require(_0xf938('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf938('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x424f02,_0x3fc350,_0x102dba){return new BPromise(function(_0x3c912c,_0x34ca99){return client[_0xf938('0xb')](_0x424f02,_0x102dba)[_0xf938('0xc')](function(_0x4fe8cc){logger[_0xf938('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x3fc350,_0xf938('0xe'));logger[_0xf938('0xf')](_0xf938('0x10'),_0x3fc350,_0xf938('0xe'),JSON[_0xf938('0x11')](_0x4fe8cc));if(_0x4fe8cc[_0xf938('0x12')]){if(_0x4fe8cc['error'][_0xf938('0x13')]===0x1f4){logger[_0xf938('0x12')](_0xf938('0x14'),_0x3fc350,_0x4fe8cc['error'][_0xf938('0x15')]);return _0x34ca99(_0x4fe8cc['error']['message']);}logger[_0xf938('0x12')](_0xf938('0x14'),_0x3fc350,_0x4fe8cc['error'][_0xf938('0x15')]);return _0x3c912c(_0x4fe8cc[_0xf938('0x12')][_0xf938('0x15')]);}else{logger['info'](_0xf938('0x14'),_0x3fc350,_0xf938('0xe'));_0x3c912c(_0x4fe8cc['result'][_0xf938('0x15')]);}})[_0xf938('0x16')](function(_0x15bcb9){logger[_0xf938('0x12')](_0xf938('0x14'),_0x3fc350,_0x15bcb9);_0x34ca99(_0x15bcb9);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ca65871..cdb2b9b 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 _0x402f=['delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','put'];(function(_0x3072d4,_0xae4733){var _0x3fb4cf=function(_0x21b783){while(--_0x21b783){_0x3072d4['push'](_0x3072d4['shift']());}};_0x3fb4cf(++_0xae4733);}(_0x402f,0x6f));var _0xf402=function(_0x50cba8,_0x2acf1c){_0x50cba8=_0x50cba8-0x0;var _0x326c72=_0x402f[_0x50cba8];return _0x326c72;};'use strict';var multer=require(_0xf402('0x0'));var util=require('util');var path=require(_0xf402('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf402('0x2')]();var fs_extra=require(_0xf402('0x3'));var auth=require(_0xf402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf402('0x5'));var controller=require('./intVtigerAccount.controller');router[_0xf402('0x6')]('/',auth[_0xf402('0x7')](),controller[_0xf402('0x8')]);router[_0xf402('0x6')](_0xf402('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xf402('0x6')](_0xf402('0xa'),auth[_0xf402('0x7')](),controller[_0xf402('0xb')]);router[_0xf402('0x6')](_0xf402('0xc'),auth[_0xf402('0x7')](),controller[_0xf402('0xd')]);router['post']('/',auth[_0xf402('0x7')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xf402('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf402('0xf')]('/:id',auth[_0xf402('0x7')](),controller[_0xf402('0x10')]);module[_0xf402('0x11')]=router; \ No newline at end of file +var _0x520e=['post','create','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x520e,0x90));var _0xe520=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x520e[_0x5471ec];return _0x121d4c;};'use strict';var multer=require(_0xe520('0x0'));var util=require(_0xe520('0x1'));var path=require(_0xe520('0x2'));var timeout=require(_0xe520('0x3'));var express=require(_0xe520('0x4'));var router=express[_0xe520('0x5')]();var fs_extra=require(_0xe520('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe520('0x7'));var config=require(_0xe520('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xe520('0x9')]('/',auth[_0xe520('0xa')](),controller[_0xe520('0xb')]);router[_0xe520('0x9')](_0xe520('0xc'),auth[_0xe520('0xa')](),controller['show']);router[_0xe520('0x9')](_0xe520('0xd'),auth[_0xe520('0xa')](),controller[_0xe520('0xe')]);router[_0xe520('0x9')](_0xe520('0xf'),auth[_0xe520('0xa')](),controller[_0xe520('0x10')]);router[_0xe520('0x11')]('/',auth[_0xe520('0xa')](),controller[_0xe520('0x12')]);router[_0xe520('0x11')](_0xe520('0xd'),auth[_0xe520('0xa')](),controller[_0xe520('0x13')]);router[_0xe520('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe520('0x15')]);router['delete'](_0xe520('0xc'),auth[_0xe520('0xa')](),controller['destroy']);module[_0xe520('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index aca2e0f..d3e14c4 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 _0x6eb6=['exports','STRING','HelpDesk','sequelize'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0x6eb6,0x1bb));var _0x66eb=function(_0x24cfdb,_0x4240f7){_0x24cfdb=_0x24cfdb-0x0;var _0x47d37e=_0x6eb6[_0x24cfdb];return _0x47d37e;};'use strict';var Sequelize=require(_0x66eb('0x0'));module[_0x66eb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x66eb('0x2')]},'username':{'type':Sequelize[_0x66eb('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x66eb('0x2')],'allowNull':![],'defaultValue':_0x66eb('0x3')},'remoteUri':{'type':Sequelize[_0x66eb('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x66eb('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x66eb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x309b=['exports','STRING','HelpDesk'];(function(_0x47127f,_0x38131c){var _0x1f432a=function(_0x5f314b){while(--_0x5f314b){_0x47127f['push'](_0x47127f['shift']());}};_0x1f432a(++_0x38131c);}(_0x309b,0x114));var _0xb309=function(_0x2f9b0c,_0x4bf62a){_0x2f9b0c=_0x2f9b0c-0x0;var _0x4a3c19=_0x309b[_0x2f9b0c];return _0x4a3c19;};'use strict';var Sequelize=require('sequelize');module[_0xb309('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb309('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb309('0x2')},'remoteUri':{'type':Sequelize[_0xb309('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb309('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb309('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index dab228b..8c37671 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 _0xc66f=['login','token','describe','result','sessionName','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','log','vTiger\x20error:\x20','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','send','index','VtigerAccount','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','getConfigurations','addConfiguration','findOne','Descriptions','getDescriptions','channel','Subjects','VtigerField','getFields','username','description','moduleName','accessKey','remoteUri','slice','substring','format','%s/webservice.php','getchallenge','success'];(function(_0x42e98c,_0x3a829a){var _0x2ff4f9=function(_0x296843){while(--_0x296843){_0x42e98c['push'](_0x42e98c['shift']());}};_0x2ff4f9(++_0x3a829a);}(_0xc66f,0x1d7));var _0xfc66=function(_0x63680d,_0x3dc13c){_0x63680d=_0x63680d-0x0;var _0x3a9cc8=_0xc66f[_0x63680d];return _0x3a9cc8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc66('0x0'));var jsonpatch=require(_0xfc66('0x1'));var rp=require(_0xfc66('0x2'));var moment=require(_0xfc66('0x3'));var BPromise=require(_0xfc66('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfc66('0x5'));var csv=require(_0xfc66('0x6'));var ejs=require(_0xfc66('0x7'));var fs=require('fs');var fs_extra=require(_0xfc66('0x8'));var _=require(_0xfc66('0x9'));var squel=require(_0xfc66('0xa'));var crypto=require('crypto');var jsforce=require(_0xfc66('0xb'));var deskjs=require(_0xfc66('0xc'));var toCsv=require(_0xfc66('0x6'));var querystring=require('querystring');var Papa=require(_0xfc66('0xd'));var Redis=require(_0xfc66('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfc66('0xf'));var as=require(_0xfc66('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc66('0x11'))(_0xfc66('0x12'));var utils=require(_0xfc66('0x13'));var config=require(_0xfc66('0x14'));var licenseUtil=require(_0xfc66('0x15'));var db=require(_0xfc66('0x16'))['db'];var integrations=require(_0xfc66('0x17'));function respondWithStatusCode(_0x1aff73,_0x30654e){_0x30654e=_0x30654e||0xcc;return function(_0x199f4d){if(_0x199f4d){return _0x1aff73['sendStatus'](_0x30654e);}return _0x1aff73[_0xfc66('0x18')](_0x30654e)[_0xfc66('0x19')]();};}function respondWithResult(_0x555419,_0x29f800){_0x29f800=_0x29f800||0xc8;return function(_0x168e27){if(_0x168e27){return _0x555419['status'](_0x29f800)[_0xfc66('0x1a')](_0x168e27);}};}function respondWithFilteredResult(_0x5c1709,_0x307ce8){return function(_0x4dc755){if(_0x4dc755){var _0x5f296b=typeof _0x307ce8[_0xfc66('0x1b')]===_0xfc66('0x1c')&&typeof _0x307ce8[_0xfc66('0x1d')]===_0xfc66('0x1c');var _0x27ff9f=_0x4dc755[_0xfc66('0x1e')];var _0x3c85c3=_0x5f296b?0x0:_0x307ce8[_0xfc66('0x1b')];var _0x4914ae=_0x5f296b?_0x4dc755[_0xfc66('0x1e')]:_0x307ce8[_0xfc66('0x1b')]+_0x307ce8[_0xfc66('0x1d')];var _0x1c2d20;if(_0x4914ae>=_0x27ff9f){_0x4914ae=_0x27ff9f;_0x1c2d20=0xc8;}else{_0x1c2d20=0xce;}_0x5c1709['status'](_0x1c2d20);return _0x5c1709[_0xfc66('0x1f')](_0xfc66('0x20'),_0x3c85c3+'-'+_0x4914ae+'/'+_0x27ff9f)[_0xfc66('0x1a')](_0x4dc755);}return null;};}function patchUpdates(_0x364dc4){return function(_0x93cab5){try{jsonpatch[_0xfc66('0x21')](_0x93cab5,_0x364dc4,!![]);}catch(_0x4d79f9){return BPromise[_0xfc66('0x22')](_0x4d79f9);}return _0x93cab5[_0xfc66('0x23')]();};}function saveUpdates(_0x491e8f,_0x5a5dcd){return function(_0x32d637){if(_0x32d637){return _0x32d637[_0xfc66('0x24')](_0x491e8f)['then'](function(_0x5067eb){return _0x5067eb;});}return null;};}function removeEntity(_0x29b5be,_0x27c755){return function(_0x15d25f){if(_0x15d25f){return _0x15d25f[_0xfc66('0x25')]()[_0xfc66('0x26')](function(){_0x29b5be[_0xfc66('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ae757,_0x149f52){return function(_0x4eba99){if(!_0x4eba99){_0x3ae757[_0xfc66('0x27')](0x194);}return _0x4eba99;};}function handleError(_0x5828da,_0x3c5b12){_0x3c5b12=_0x3c5b12||0x1f4;return function(_0x4bf56d){logger['error'](_0x4bf56d['stack']);if(_0x4bf56d[_0xfc66('0x28')]){delete _0x4bf56d['name'];}_0x5828da[_0xfc66('0x18')](_0x3c5b12)[_0xfc66('0x29')](_0x4bf56d);};}exports[_0xfc66('0x2a')]=function(_0x12ad79,_0x29efca){var _0x1a31be={},_0x1461ba={},_0x121cd0={'count':0x0,'rows':[]};var _0x15e037=_['map'](db[_0xfc66('0x2b')]['rawAttributes'],function(_0x25cccf){return{'name':_0x25cccf['fieldName'],'type':_0x25cccf[_0xfc66('0x2c')][_0xfc66('0x2d')]};});_0x1461ba['model']=_[_0xfc66('0x2e')](_0x15e037,_0xfc66('0x28'));_0x1461ba[_0xfc66('0x2f')]=_[_0xfc66('0x30')](_0x12ad79[_0xfc66('0x2f')]);_0x1461ba[_0xfc66('0x31')]=_[_0xfc66('0x32')](_0x1461ba[_0xfc66('0x33')],_0x1461ba[_0xfc66('0x2f')]);_0x1a31be[_0xfc66('0x34')]=_['intersection'](_0x1461ba[_0xfc66('0x33')],qs[_0xfc66('0x35')](_0x12ad79[_0xfc66('0x2f')][_0xfc66('0x35')]));_0x1a31be[_0xfc66('0x34')]=_0x1a31be[_0xfc66('0x34')][_0xfc66('0x36')]?_0x1a31be[_0xfc66('0x34')]:_0x1461ba['model'];if(!_0x12ad79[_0xfc66('0x2f')][_0xfc66('0x37')](_0xfc66('0x38'))){_0x1a31be['limit']=qs[_0xfc66('0x1d')](_0x12ad79['query'][_0xfc66('0x1d')]);_0x1a31be['offset']=qs[_0xfc66('0x1b')](_0x12ad79['query'][_0xfc66('0x1b')]);}_0x1a31be[_0xfc66('0x39')]=qs['sort'](_0x12ad79[_0xfc66('0x2f')][_0xfc66('0x3a')]);_0x1a31be['where']=qs[_0xfc66('0x31')](_[_0xfc66('0x3b')](_0x12ad79[_0xfc66('0x2f')],_0x1461ba['filters']),_0x15e037);if(_0x12ad79[_0xfc66('0x2f')][_0xfc66('0x3c')]){_0x1a31be[_0xfc66('0x3d')]=_[_0xfc66('0x3e')](_0x1a31be[_0xfc66('0x3d')],{'$or':_[_0xfc66('0x2e')](_0x15e037,function(_0xaf6c75){if(_0xaf6c75['type']!=='VIRTUAL'){var _0xa9dfad={};_0xa9dfad[_0xaf6c75[_0xfc66('0x28')]]={'$like':'%'+_0x12ad79[_0xfc66('0x2f')][_0xfc66('0x3c')]+'%'};return _0xa9dfad;}})});}_0x1a31be=_[_0xfc66('0x3e')]({},_0x1a31be,_0x12ad79[_0xfc66('0x3f')]);var _0x44a311={'where':_0x1a31be[_0xfc66('0x3d')]};return db[_0xfc66('0x2b')][_0xfc66('0x1e')](_0x44a311)['then'](function(_0x53d5f1){_0x121cd0[_0xfc66('0x1e')]=_0x53d5f1;if(_0x12ad79['query'][_0xfc66('0x40')]){_0x1a31be[_0xfc66('0x41')]=[{'all':!![]}];}return db[_0xfc66('0x2b')]['findAll'](_0x1a31be);})['then'](function(_0x298028){_0x121cd0[_0xfc66('0x42')]=_0x298028;return _0x121cd0;})['then'](respondWithFilteredResult(_0x29efca,_0x1a31be))[_0xfc66('0x43')](handleError(_0x29efca,null));};exports[_0xfc66('0x44')]=function(_0x475984,_0x223344){var _0x5727dc={'raw':![],'where':{'id':_0x475984['params']['id']}},_0x10495d={};_0x10495d[_0xfc66('0x33')]=_[_0xfc66('0x30')](db[_0xfc66('0x2b')][_0xfc66('0x45')]);_0x10495d[_0xfc66('0x2f')]=_[_0xfc66('0x30')](_0x475984[_0xfc66('0x2f')]);_0x10495d[_0xfc66('0x31')]=_['intersection'](_0x10495d[_0xfc66('0x33')],_0x10495d[_0xfc66('0x2f')]);_0x5727dc[_0xfc66('0x34')]=_[_0xfc66('0x32')](_0x10495d['model'],qs[_0xfc66('0x35')](_0x475984[_0xfc66('0x2f')][_0xfc66('0x35')]));_0x5727dc['attributes']=_0x5727dc[_0xfc66('0x34')][_0xfc66('0x36')]?_0x5727dc['attributes']:_0x10495d[_0xfc66('0x33')];if(_0x475984['query'][_0xfc66('0x40')]){_0x5727dc[_0xfc66('0x41')]=[{'all':!![]}];}_0x5727dc=_[_0xfc66('0x3e')]({},_0x5727dc,_0x475984[_0xfc66('0x3f')]);return db['VtigerAccount'][_0xfc66('0x46')](_0x5727dc)[_0xfc66('0x26')](handleEntityNotFound(_0x223344,null))[_0xfc66('0x26')](respondWithResult(_0x223344,null))['catch'](handleError(_0x223344,null));};exports[_0xfc66('0x47')]=function(_0x51fcf5,_0x5941da){return db['VtigerAccount'][_0xfc66('0x47')](_0x51fcf5['body'],{})[_0xfc66('0x26')](respondWithResult(_0x5941da,0xc9))[_0xfc66('0x43')](handleError(_0x5941da,null));};exports['update']=function(_0x875316,_0x20bc13){if(_0x875316[_0xfc66('0x48')]['id']){delete _0x875316[_0xfc66('0x48')]['id'];}return db[_0xfc66('0x2b')][_0xfc66('0x46')]({'where':{'id':_0x875316[_0xfc66('0x49')]['id']}})[_0xfc66('0x26')](handleEntityNotFound(_0x20bc13,null))[_0xfc66('0x26')](saveUpdates(_0x875316[_0xfc66('0x48')],null))[_0xfc66('0x26')](respondWithResult(_0x20bc13,null))[_0xfc66('0x43')](handleError(_0x20bc13,null));};exports[_0xfc66('0x25')]=function(_0x5b630f,_0x2b1b01){return db[_0xfc66('0x2b')][_0xfc66('0x46')]({'where':{'id':_0x5b630f[_0xfc66('0x49')]['id']}})[_0xfc66('0x26')](handleEntityNotFound(_0x2b1b01,null))[_0xfc66('0x26')](removeEntity(_0x2b1b01,null))[_0xfc66('0x43')](handleError(_0x2b1b01,null));};exports[_0xfc66('0x4a')]=function(_0x24399e,_0x1b8894,_0x574254){var _0x41d07d={};var _0x452a19={};var _0xe26134;var _0x30c167;return db[_0xfc66('0x2b')]['findOne']({'where':{'id':_0x24399e[_0xfc66('0x49')]['id']}})[_0xfc66('0x26')](handleEntityNotFound(_0x1b8894,null))[_0xfc66('0x26')](function(_0x5373a2){if(_0x5373a2){_0xe26134=_0x5373a2;_0x452a19[_0xfc66('0x33')]=_['keys'](db['VtigerConfiguration'][_0xfc66('0x45')]);_0x452a19[_0xfc66('0x2f')]=_[_0xfc66('0x30')](_0x24399e['query']);_0x452a19[_0xfc66('0x31')]=_[_0xfc66('0x32')](_0x452a19[_0xfc66('0x33')],_0x452a19[_0xfc66('0x2f')]);_0x41d07d[_0xfc66('0x34')]=_['intersection'](_0x452a19['model'],qs['fields'](_0x24399e['query']['fields']));_0x41d07d[_0xfc66('0x34')]=_0x41d07d[_0xfc66('0x34')][_0xfc66('0x36')]?_0x41d07d[_0xfc66('0x34')]:_0x452a19[_0xfc66('0x33')];_0x41d07d[_0xfc66('0x39')]=qs[_0xfc66('0x3a')](_0x24399e[_0xfc66('0x2f')][_0xfc66('0x3a')]);_0x41d07d['where']=qs[_0xfc66('0x31')](_[_0xfc66('0x3b')](_0x24399e[_0xfc66('0x2f')],_0x452a19[_0xfc66('0x31')]));if(_0x24399e['query'][_0xfc66('0x3c')]){_0x41d07d[_0xfc66('0x3d')]=_['merge'](_0x41d07d['where'],{'$or':_[_0xfc66('0x2e')](_0x41d07d['attributes'],function(_0x503703){var _0x9014ad={};_0x9014ad[_0x503703]={'$like':'%'+_0x24399e[_0xfc66('0x2f')][_0xfc66('0x3c')]+'%'};return _0x9014ad;})});}_0x41d07d=_[_0xfc66('0x3e')]({},_0x41d07d,_0x24399e[_0xfc66('0x3f')]);return _0xe26134[_0xfc66('0x4a')](_0x41d07d);}})[_0xfc66('0x26')](function(_0xeec9d2){if(_0xeec9d2){_0x30c167=_0xeec9d2[_0xfc66('0x36')];if(!_0x24399e[_0xfc66('0x2f')][_0xfc66('0x37')]('nolimit')){_0x41d07d[_0xfc66('0x1d')]=qs['limit'](_0x24399e[_0xfc66('0x2f')][_0xfc66('0x1d')]);_0x41d07d['offset']=qs[_0xfc66('0x1b')](_0x24399e[_0xfc66('0x2f')]['offset']);}return _0xe26134[_0xfc66('0x4a')](_0x41d07d);}})[_0xfc66('0x26')](function(_0x2cddb3){if(_0x2cddb3){return _0x2cddb3?{'count':_0x30c167,'rows':_0x2cddb3}:null;}})[_0xfc66('0x26')](respondWithResult(_0x1b8894,null))[_0xfc66('0x43')](handleError(_0x1b8894,null));};exports[_0xfc66('0x4b')]=function(_0x5d9989,_0x13a544,_0x9fcba1){if(_0x5d9989['body']['id']){delete _0x5d9989[_0xfc66('0x48')]['id'];}return db[_0xfc66('0x2b')][_0xfc66('0x4c')]({'where':{'id':_0x5d9989[_0xfc66('0x49')]['id']}})[_0xfc66('0x26')](handleEntityNotFound(_0x13a544,null))[_0xfc66('0x26')](function(_0x569015){if(_0x569015){_0x5d9989['body']['AccountId']=_0x569015['id'];_0x5d9989[_0xfc66('0x48')]['Subjects']=integrations['getSubjects'](_0x5d9989[_0xfc66('0x48')]['channel'],_0x5d9989[_0xfc66('0x48')]['type']);_0x5d9989[_0xfc66('0x48')][_0xfc66('0x4d')]=integrations[_0xfc66('0x4e')](_0x5d9989['body'][_0xfc66('0x4f')],_0x5d9989['body'][_0xfc66('0x2c')]);return db['VtigerConfiguration'][_0xfc66('0x47')](_0x5d9989[_0xfc66('0x48')],{'include':[{'model':db['VtigerField'],'as':_0xfc66('0x50')},{'model':db[_0xfc66('0x51')],'as':_0xfc66('0x4d')}]});}return null;})[_0xfc66('0x26')](respondWithResult(_0x13a544,null))[_0xfc66('0x43')](handleError(_0x13a544,null));};var md5=require('md5');exports[_0xfc66('0x52')]=function(_0x18717a,_0x1f1bce,_0x3ef104){var _0x109136=null;var _0x4bbc8e=null;var _0x407169=null;var _0x34e061=null;var _0x259fa6='';return db[_0xfc66('0x2b')][_0xfc66('0x4c')]({'where':{'id':_0x18717a['params']['id']},'attributes':['id',_0xfc66('0x28'),_0xfc66('0x53'),_0xfc66('0x54'),_0xfc66('0x55'),'remoteUri','serverUrl',_0xfc66('0x56')]})[_0xfc66('0x26')](handleEntityNotFound(_0x1f1bce,null))[_0xfc66('0x26')](function(_0x53d9f2){if(_0x53d9f2){_0x109136=_0x53d9f2[_0xfc66('0x53')];_0x4bbc8e=_0x53d9f2[_0xfc66('0x56')];_0x407169=_0x53d9f2[_0xfc66('0x55')];_0x259fa6=_0x53d9f2[_0xfc66('0x57')];var _0x3c8896=_0x259fa6[_0xfc66('0x58')](-0x1);if(_0x3c8896==='/'){_0x259fa6=_0x259fa6[_0xfc66('0x59')](0x0,_0x259fa6['lastIndexOf'](_0x3c8896));}_0x34e061=util[_0xfc66('0x5a')](_0xfc66('0x5b'),_0x259fa6);var _0x423894={'method':'GET','uri':_0x34e061,'qs':{'operation':_0xfc66('0x5c'),'username':_0x53d9f2[_0xfc66('0x53')]},'json':!![]};return rp(_0x423894);}})[_0xfc66('0x26')](function(_0x1bfe54){if(_0x1bfe54[_0xfc66('0x5d')]){var _0x297f36={'method':'POST','uri':_0x34e061,'form':{'operation':_0xfc66('0x5e'),'username':_0x109136,'accessKey':md5(_0x1bfe54['result'][_0xfc66('0x5f')]+_0x4bbc8e)},'json':!![]};return rp(_0x297f36);}})[_0xfc66('0x26')](function(_0x303a64){if(_0x303a64[_0xfc66('0x5d')]){var _0x127afe={'method':'GET','uri':_0x34e061,'qs':{'operation':_0xfc66('0x60'),'username':_0x109136,'sessionName':_0x303a64[_0xfc66('0x61')][_0xfc66('0x62')],'elementType':_0x407169},'json':!![]};return rp(_0x127afe);}})[_0xfc66('0x26')](function(_0x3c26fc){if(_0x3c26fc['success']){var _0x54533c=['autogenerated','reference',_0xfc66('0x63')];_[_0xfc66('0x64')](_0x3c26fc['result'][_0xfc66('0x35')],function(_0x13f19a){return _0x54533c[_0xfc66('0x65')](_0x13f19a[_0xfc66('0x2c')][_0xfc66('0x28')]);});_[_0xfc66('0x64')](_0x3c26fc[_0xfc66('0x61')][_0xfc66('0x35')],function(_0x3d9a57){return _0x3d9a57[_0xfc66('0x66')]===_0xfc66('0x67');});return{'count':_0x3c26fc[_0xfc66('0x61')][_0xfc66('0x35')]['length'],'rows':_[_0xfc66('0x2e')](_0x3c26fc[_0xfc66('0x61')]['fields'],function(_0x2990e8){return{'id':_0x2990e8[_0xfc66('0x28')],'name':_0x2990e8['label'],'custom':_[_0xfc66('0x68')](_0x2990e8[_0xfc66('0x28')],_0xfc66('0x69'))?!![]:![],'options':_0x2990e8[_0xfc66('0x2c')][_0xfc66('0x28')]===_0xfc66('0x6a')&&_0x2990e8[_0xfc66('0x2c')][_0xfc66('0x6b')][_0xfc66('0x36')]>0x0?_[_0xfc66('0x2e')](_0x2990e8['type'][_0xfc66('0x6b')],function(_0x5456f2){return{'name':_0x5456f2[_0xfc66('0x6c')],'value':_0x5456f2['value']};}):[]};})};}})['then'](respondWithResult(_0x1f1bce,null))[_0xfc66('0x43')](function(_0x190f96){console[_0xfc66('0x6d')](_0xfc66('0x6e')+_0x190f96);var _0x272ce3=_0x18717a[_0xfc66('0x2f')][_0xfc66('0x6f')]?0x1f4:_0x190f96['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xfc66('0x52'),_0x272ce3,JSON['stringify'](_0x190f96));delete _0x190f96[_0xfc66('0x28')];if(_0x272ce3===0x191){_0x272ce3=0x190;}_0x1f1bce[_0xfc66('0x18')](_0x272ce3)[_0xfc66('0x29')](_0x18717a[_0xfc66('0x2f')][_0xfc66('0x6f')]?{'message':_0xfc66('0x70'),'statusCode':_0x190f96['statusCode']}:_0x190f96);});}; \ No newline at end of file +var _0xea40=['getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','channel','type','Descriptions','VtigerField','Subjects','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','sessionName','autogenerated','reference','owner','includes','editable','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xea40,0x81));var _0x0ea4=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0xea40[_0x5c4585];return _0x21dede;};'use strict';var emlformat=require(_0x0ea4('0x0'));var rimraf=require(_0x0ea4('0x1'));var zipdir=require(_0x0ea4('0x2'));var jsonpatch=require(_0x0ea4('0x3'));var rp=require(_0x0ea4('0x4'));var moment=require(_0x0ea4('0x5'));var BPromise=require(_0x0ea4('0x6'));var Mustache=require(_0x0ea4('0x7'));var util=require(_0x0ea4('0x8'));var path=require(_0x0ea4('0x9'));var sox=require('sox');var csv=require(_0x0ea4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ea4('0xb'));var _=require('lodash');var squel=require(_0x0ea4('0xc'));var crypto=require(_0x0ea4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0ea4('0xe'));var toCsv=require(_0x0ea4('0xa'));var querystring=require(_0x0ea4('0xf'));var Papa=require(_0x0ea4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0ea4('0x11'));var as=require(_0x0ea4('0x12'));var hardwareService=require(_0x0ea4('0x13'));var logger=require('../../config/logger')(_0x0ea4('0x14'));var utils=require(_0x0ea4('0x15'));var config=require(_0x0ea4('0x16'));var licenseUtil=require(_0x0ea4('0x17'));var db=require(_0x0ea4('0x18'))['db'];var integrations=require(_0x0ea4('0x19'));function respondWithStatusCode(_0x4e57e5,_0x32a043){_0x32a043=_0x32a043||0xcc;return function(_0x4d0dff){if(_0x4d0dff){return _0x4e57e5[_0x0ea4('0x1a')](_0x32a043);}return _0x4e57e5['status'](_0x32a043)[_0x0ea4('0x1b')]();};}function respondWithResult(_0x1e7e55,_0x3f64ad){_0x3f64ad=_0x3f64ad||0xc8;return function(_0x59875f){if(_0x59875f){return _0x1e7e55[_0x0ea4('0x1c')](_0x3f64ad)[_0x0ea4('0x1d')](_0x59875f);}};}function respondWithFilteredResult(_0x974a3c,_0x1ffc60){return function(_0x1533cd){if(_0x1533cd){var _0x20b17a=typeof _0x1ffc60[_0x0ea4('0x1e')]===_0x0ea4('0x1f')&&typeof _0x1ffc60[_0x0ea4('0x20')]===_0x0ea4('0x1f');var _0x49cadd=_0x1533cd[_0x0ea4('0x21')];var _0x1d512a=_0x20b17a?0x0:_0x1ffc60[_0x0ea4('0x1e')];var _0x5a6565=_0x20b17a?_0x1533cd['count']:_0x1ffc60[_0x0ea4('0x1e')]+_0x1ffc60[_0x0ea4('0x20')];var _0x324ae3;if(_0x5a6565>=_0x49cadd){_0x5a6565=_0x49cadd;_0x324ae3=0xc8;}else{_0x324ae3=0xce;}_0x974a3c['status'](_0x324ae3);return _0x974a3c[_0x0ea4('0x22')](_0x0ea4('0x23'),_0x1d512a+'-'+_0x5a6565+'/'+_0x49cadd)[_0x0ea4('0x1d')](_0x1533cd);}return null;};}function patchUpdates(_0x21ab4d){return function(_0xf16a29){try{jsonpatch[_0x0ea4('0x24')](_0xf16a29,_0x21ab4d,!![]);}catch(_0x114dd0){return BPromise['reject'](_0x114dd0);}return _0xf16a29['save']();};}function saveUpdates(_0x3ac014,_0x1953e8){return function(_0x508146){if(_0x508146){return _0x508146[_0x0ea4('0x25')](_0x3ac014)[_0x0ea4('0x26')](function(_0x36f154){return _0x36f154;});}return null;};}function removeEntity(_0x21bf3d,_0x8e7d03){return function(_0x2f6b35){if(_0x2f6b35){return _0x2f6b35[_0x0ea4('0x27')]()[_0x0ea4('0x26')](function(){_0x21bf3d[_0x0ea4('0x1c')](0xcc)[_0x0ea4('0x1b')]();});}};}function handleEntityNotFound(_0x3470ae,_0x432719){return function(_0x3ceba6){if(!_0x3ceba6){_0x3470ae[_0x0ea4('0x1a')](0x194);}return _0x3ceba6;};}function handleError(_0x2b4770,_0x4ce651){_0x4ce651=_0x4ce651||0x1f4;return function(_0x6cda88){logger[_0x0ea4('0x28')](_0x6cda88[_0x0ea4('0x29')]);if(_0x6cda88[_0x0ea4('0x2a')]){delete _0x6cda88[_0x0ea4('0x2a')];}_0x2b4770[_0x0ea4('0x1c')](_0x4ce651)[_0x0ea4('0x2b')](_0x6cda88);};}exports[_0x0ea4('0x2c')]=function(_0xee5a0a,_0x56d58f){var _0x529664={},_0x1357bf={},_0x2c3437={'count':0x0,'rows':[]};var _0x3eb1dd=_[_0x0ea4('0x2d')](db[_0x0ea4('0x2e')][_0x0ea4('0x2f')],function(_0x3380d9){return{'name':_0x3380d9[_0x0ea4('0x30')],'type':_0x3380d9['type'][_0x0ea4('0x31')]};});_0x1357bf[_0x0ea4('0x32')]=_[_0x0ea4('0x2d')](_0x3eb1dd,_0x0ea4('0x2a'));_0x1357bf[_0x0ea4('0x33')]=_[_0x0ea4('0x34')](_0xee5a0a[_0x0ea4('0x33')]);_0x1357bf[_0x0ea4('0x35')]=_[_0x0ea4('0x36')](_0x1357bf[_0x0ea4('0x32')],_0x1357bf[_0x0ea4('0x33')]);_0x529664['attributes']=_[_0x0ea4('0x36')](_0x1357bf[_0x0ea4('0x32')],qs[_0x0ea4('0x37')](_0xee5a0a['query'][_0x0ea4('0x37')]));_0x529664[_0x0ea4('0x38')]=_0x529664[_0x0ea4('0x38')][_0x0ea4('0x39')]?_0x529664[_0x0ea4('0x38')]:_0x1357bf['model'];if(!_0xee5a0a['query'][_0x0ea4('0x3a')](_0x0ea4('0x3b'))){_0x529664['limit']=qs[_0x0ea4('0x20')](_0xee5a0a[_0x0ea4('0x33')][_0x0ea4('0x20')]);_0x529664[_0x0ea4('0x1e')]=qs[_0x0ea4('0x1e')](_0xee5a0a[_0x0ea4('0x33')][_0x0ea4('0x1e')]);}_0x529664[_0x0ea4('0x3c')]=qs[_0x0ea4('0x3d')](_0xee5a0a[_0x0ea4('0x33')]['sort']);_0x529664[_0x0ea4('0x3e')]=qs[_0x0ea4('0x35')](_[_0x0ea4('0x3f')](_0xee5a0a['query'],_0x1357bf[_0x0ea4('0x35')]),_0x3eb1dd);if(_0xee5a0a[_0x0ea4('0x33')]['filter']){_0x529664[_0x0ea4('0x3e')]=_['merge'](_0x529664['where'],{'$or':_['map'](_0x3eb1dd,function(_0x652a1c){if(_0x652a1c['type']!==_0x0ea4('0x40')){var _0x2bd155={};_0x2bd155[_0x652a1c[_0x0ea4('0x2a')]]={'$like':'%'+_0xee5a0a[_0x0ea4('0x33')][_0x0ea4('0x41')]+'%'};return _0x2bd155;}})});}_0x529664=_[_0x0ea4('0x42')]({},_0x529664,_0xee5a0a[_0x0ea4('0x43')]);var _0xf6b1d4={'where':_0x529664[_0x0ea4('0x3e')]};return db['VtigerAccount']['count'](_0xf6b1d4)[_0x0ea4('0x26')](function(_0x39754a){_0x2c3437[_0x0ea4('0x21')]=_0x39754a;if(_0xee5a0a[_0x0ea4('0x33')][_0x0ea4('0x44')]){_0x529664[_0x0ea4('0x45')]=[{'all':!![]}];}return db['VtigerAccount'][_0x0ea4('0x46')](_0x529664);})[_0x0ea4('0x26')](function(_0x2f42f9){_0x2c3437[_0x0ea4('0x47')]=_0x2f42f9;return _0x2c3437;})['then'](respondWithFilteredResult(_0x56d58f,_0x529664))[_0x0ea4('0x48')](handleError(_0x56d58f,null));};exports[_0x0ea4('0x49')]=function(_0x337ce8,_0x69d104){var _0x141f09={'raw':![],'where':{'id':_0x337ce8[_0x0ea4('0x4a')]['id']}},_0x48537f={};_0x48537f[_0x0ea4('0x32')]=_[_0x0ea4('0x34')](db[_0x0ea4('0x2e')][_0x0ea4('0x2f')]);_0x48537f[_0x0ea4('0x33')]=_['keys'](_0x337ce8['query']);_0x48537f['filters']=_[_0x0ea4('0x36')](_0x48537f['model'],_0x48537f[_0x0ea4('0x33')]);_0x141f09[_0x0ea4('0x38')]=_['intersection'](_0x48537f['model'],qs[_0x0ea4('0x37')](_0x337ce8['query']['fields']));_0x141f09['attributes']=_0x141f09['attributes'][_0x0ea4('0x39')]?_0x141f09[_0x0ea4('0x38')]:_0x48537f[_0x0ea4('0x32')];if(_0x337ce8[_0x0ea4('0x33')][_0x0ea4('0x44')]){_0x141f09[_0x0ea4('0x45')]=[{'all':!![]}];}_0x141f09=_['merge']({},_0x141f09,_0x337ce8[_0x0ea4('0x43')]);return db[_0x0ea4('0x2e')][_0x0ea4('0x4b')](_0x141f09)['then'](handleEntityNotFound(_0x69d104,null))[_0x0ea4('0x26')](respondWithResult(_0x69d104,null))[_0x0ea4('0x48')](handleError(_0x69d104,null));};exports[_0x0ea4('0x4c')]=function(_0x3ae71e,_0x114504){return db[_0x0ea4('0x2e')][_0x0ea4('0x4c')](_0x3ae71e[_0x0ea4('0x4d')],{})[_0x0ea4('0x26')](respondWithResult(_0x114504,0xc9))[_0x0ea4('0x48')](handleError(_0x114504,null));};exports[_0x0ea4('0x25')]=function(_0x267d76,_0x3811a3){if(_0x267d76[_0x0ea4('0x4d')]['id']){delete _0x267d76[_0x0ea4('0x4d')]['id'];}return db['VtigerAccount'][_0x0ea4('0x4b')]({'where':{'id':_0x267d76[_0x0ea4('0x4a')]['id']}})[_0x0ea4('0x26')](handleEntityNotFound(_0x3811a3,null))[_0x0ea4('0x26')](saveUpdates(_0x267d76[_0x0ea4('0x4d')],null))['then'](respondWithResult(_0x3811a3,null))[_0x0ea4('0x48')](handleError(_0x3811a3,null));};exports[_0x0ea4('0x27')]=function(_0x58d5a7,_0x20b86a){return db[_0x0ea4('0x2e')][_0x0ea4('0x4b')]({'where':{'id':_0x58d5a7['params']['id']}})[_0x0ea4('0x26')](handleEntityNotFound(_0x20b86a,null))[_0x0ea4('0x26')](removeEntity(_0x20b86a,null))[_0x0ea4('0x48')](handleError(_0x20b86a,null));};exports['getConfigurations']=function(_0x2e1e98,_0x126dae,_0x501d04){var _0x3837ec={};var _0x5b4a43={};var _0x3dff78;var _0x3b1061;return db['VtigerAccount'][_0x0ea4('0x4e')]({'where':{'id':_0x2e1e98[_0x0ea4('0x4a')]['id']}})[_0x0ea4('0x26')](handleEntityNotFound(_0x126dae,null))[_0x0ea4('0x26')](function(_0xad39d1){if(_0xad39d1){_0x3dff78=_0xad39d1;_0x5b4a43['model']=_['keys'](db[_0x0ea4('0x4f')][_0x0ea4('0x2f')]);_0x5b4a43[_0x0ea4('0x33')]=_['keys'](_0x2e1e98[_0x0ea4('0x33')]);_0x5b4a43['filters']=_[_0x0ea4('0x36')](_0x5b4a43[_0x0ea4('0x32')],_0x5b4a43['query']);_0x3837ec[_0x0ea4('0x38')]=_[_0x0ea4('0x36')](_0x5b4a43['model'],qs[_0x0ea4('0x37')](_0x2e1e98[_0x0ea4('0x33')]['fields']));_0x3837ec['attributes']=_0x3837ec[_0x0ea4('0x38')][_0x0ea4('0x39')]?_0x3837ec[_0x0ea4('0x38')]:_0x5b4a43[_0x0ea4('0x32')];_0x3837ec['order']=qs[_0x0ea4('0x3d')](_0x2e1e98[_0x0ea4('0x33')][_0x0ea4('0x3d')]);_0x3837ec['where']=qs['filters'](_[_0x0ea4('0x3f')](_0x2e1e98[_0x0ea4('0x33')],_0x5b4a43[_0x0ea4('0x35')]));if(_0x2e1e98[_0x0ea4('0x33')][_0x0ea4('0x41')]){_0x3837ec[_0x0ea4('0x3e')]=_[_0x0ea4('0x42')](_0x3837ec['where'],{'$or':_[_0x0ea4('0x2d')](_0x3837ec['attributes'],function(_0x31044f){var _0x3e7bf6={};_0x3e7bf6[_0x31044f]={'$like':'%'+_0x2e1e98['query'][_0x0ea4('0x41')]+'%'};return _0x3e7bf6;})});}_0x3837ec=_[_0x0ea4('0x42')]({},_0x3837ec,_0x2e1e98['options']);return _0x3dff78[_0x0ea4('0x50')](_0x3837ec);}})[_0x0ea4('0x26')](function(_0x4835ff){if(_0x4835ff){_0x3b1061=_0x4835ff['length'];if(!_0x2e1e98[_0x0ea4('0x33')][_0x0ea4('0x3a')](_0x0ea4('0x3b'))){_0x3837ec['limit']=qs['limit'](_0x2e1e98[_0x0ea4('0x33')]['limit']);_0x3837ec['offset']=qs[_0x0ea4('0x1e')](_0x2e1e98[_0x0ea4('0x33')]['offset']);}return _0x3dff78[_0x0ea4('0x50')](_0x3837ec);}})[_0x0ea4('0x26')](function(_0x355730){if(_0x355730){return _0x355730?{'count':_0x3b1061,'rows':_0x355730}:null;}})['then'](respondWithResult(_0x126dae,null))['catch'](handleError(_0x126dae,null));};exports[_0x0ea4('0x51')]=function(_0x1378e3,_0x2dd46b,_0x3f4c1b){if(_0x1378e3['body']['id']){delete _0x1378e3[_0x0ea4('0x4d')]['id'];}return db[_0x0ea4('0x2e')][_0x0ea4('0x4e')]({'where':{'id':_0x1378e3['params']['id']}})[_0x0ea4('0x26')](handleEntityNotFound(_0x2dd46b,null))[_0x0ea4('0x26')](function(_0x555e6a){if(_0x555e6a){_0x1378e3[_0x0ea4('0x4d')][_0x0ea4('0x52')]=_0x555e6a['id'];_0x1378e3['body']['Subjects']=integrations['getSubjects'](_0x1378e3[_0x0ea4('0x4d')][_0x0ea4('0x53')],_0x1378e3['body'][_0x0ea4('0x54')]);_0x1378e3[_0x0ea4('0x4d')][_0x0ea4('0x55')]=integrations['getDescriptions'](_0x1378e3['body'][_0x0ea4('0x53')],_0x1378e3['body'][_0x0ea4('0x54')]);return db[_0x0ea4('0x4f')][_0x0ea4('0x4c')](_0x1378e3[_0x0ea4('0x4d')],{'include':[{'model':db[_0x0ea4('0x56')],'as':_0x0ea4('0x57')},{'model':db[_0x0ea4('0x56')],'as':_0x0ea4('0x55')}]});}return null;})[_0x0ea4('0x26')](respondWithResult(_0x2dd46b,null))[_0x0ea4('0x48')](handleError(_0x2dd46b,null));};var md5=require(_0x0ea4('0x58'));exports['getFields']=function(_0x33ceaa,_0x40f99e,_0x1d68eb){var _0x2ede9a=null;var _0x5c8b35=null;var _0x4702d9=null;var _0x54a0b0=null;var _0x14b987='';return db[_0x0ea4('0x2e')]['findOne']({'where':{'id':_0x33ceaa[_0x0ea4('0x4a')]['id']},'attributes':['id',_0x0ea4('0x2a'),_0x0ea4('0x59'),_0x0ea4('0x5a'),_0x0ea4('0x5b'),_0x0ea4('0x5c'),_0x0ea4('0x5d'),_0x0ea4('0x5e')]})[_0x0ea4('0x26')](handleEntityNotFound(_0x40f99e,null))[_0x0ea4('0x26')](function(_0x3989f9){if(_0x3989f9){_0x2ede9a=_0x3989f9[_0x0ea4('0x59')];_0x5c8b35=_0x3989f9['accessKey'];_0x4702d9=_0x3989f9[_0x0ea4('0x5b')];_0x14b987=_0x3989f9[_0x0ea4('0x5c')];var _0xc30a25=_0x14b987[_0x0ea4('0x5f')](-0x1);if(_0xc30a25==='/'){_0x14b987=_0x14b987[_0x0ea4('0x60')](0x0,_0x14b987[_0x0ea4('0x61')](_0xc30a25));}_0x54a0b0=util[_0x0ea4('0x62')](_0x0ea4('0x63'),_0x14b987);var _0x3f6b0d={'method':_0x0ea4('0x64'),'uri':_0x54a0b0,'qs':{'operation':'getchallenge','username':_0x3989f9[_0x0ea4('0x59')]},'json':!![]};return rp(_0x3f6b0d);}})['then'](function(_0x969f01){if(_0x969f01[_0x0ea4('0x65')]){var _0x3f0781={'method':_0x0ea4('0x66'),'uri':_0x54a0b0,'form':{'operation':_0x0ea4('0x67'),'username':_0x2ede9a,'accessKey':md5(_0x969f01[_0x0ea4('0x68')][_0x0ea4('0x69')]+_0x5c8b35)},'json':!![]};return rp(_0x3f0781);}})[_0x0ea4('0x26')](function(_0x15ee13){if(_0x15ee13['success']){var _0x3280f1={'method':_0x0ea4('0x64'),'uri':_0x54a0b0,'qs':{'operation':'describe','username':_0x2ede9a,'sessionName':_0x15ee13[_0x0ea4('0x68')][_0x0ea4('0x6a')],'elementType':_0x4702d9},'json':!![]};return rp(_0x3280f1);}})[_0x0ea4('0x26')](function(_0x4f1a77){if(_0x4f1a77['success']){var _0xad15a4=[_0x0ea4('0x6b'),_0x0ea4('0x6c'),_0x0ea4('0x6d')];_['remove'](_0x4f1a77[_0x0ea4('0x68')]['fields'],function(_0xac5979){return _0xad15a4[_0x0ea4('0x6e')](_0xac5979[_0x0ea4('0x54')][_0x0ea4('0x2a')]);});_['remove'](_0x4f1a77[_0x0ea4('0x68')][_0x0ea4('0x37')],function(_0x29c2ac){return _0x29c2ac[_0x0ea4('0x6f')]==='false';});return{'count':_0x4f1a77[_0x0ea4('0x68')][_0x0ea4('0x37')][_0x0ea4('0x39')],'rows':_[_0x0ea4('0x2d')](_0x4f1a77[_0x0ea4('0x68')][_0x0ea4('0x37')],function(_0x499886){return{'id':_0x499886[_0x0ea4('0x2a')],'name':_0x499886[_0x0ea4('0x70')],'custom':_[_0x0ea4('0x71')](_0x499886['name'],_0x0ea4('0x72'))?!![]:![],'options':_0x499886[_0x0ea4('0x54')][_0x0ea4('0x2a')]===_0x0ea4('0x73')&&_0x499886[_0x0ea4('0x54')][_0x0ea4('0x74')][_0x0ea4('0x39')]>0x0?_[_0x0ea4('0x2d')](_0x499886['type'][_0x0ea4('0x74')],function(_0x2c71c8){return{'name':_0x2c71c8[_0x0ea4('0x70')],'value':_0x2c71c8['value']};}):[]};})};}})[_0x0ea4('0x26')](respondWithResult(_0x40f99e,null))[_0x0ea4('0x48')](function(_0x2f7a6d){console[_0x0ea4('0x75')](_0x0ea4('0x76')+_0x2f7a6d);var _0x31d81e=_0x33ceaa[_0x0ea4('0x33')][_0x0ea4('0x77')]?0x1f4:_0x2f7a6d[_0x0ea4('0x78')]||0x1f4;logger['error'](_0x0ea4('0x79'),_0x0ea4('0x7a'),_0x31d81e,JSON[_0x0ea4('0x7b')](_0x2f7a6d));delete _0x2f7a6d[_0x0ea4('0x2a')];if(_0x31d81e===0x191){_0x31d81e=0x190;}_0x40f99e[_0x0ea4('0x1c')](_0x31d81e)[_0x0ea4('0x2b')](_0x33ceaa[_0x0ea4('0x33')][_0x0ea4('0x77')]?{'message':_0x0ea4('0x7c'),'statusCode':_0x2f7a6d['statusCode']}:_0x2f7a6d);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 62f9784..24dd2e1 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 _0x006d=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash','util','api'];(function(_0x52f98f,_0x2b96ec){var _0x2205eb=function(_0x15794c){while(--_0x15794c){_0x52f98f['push'](_0x52f98f['shift']());}};_0x2205eb(++_0x2b96ec);}(_0x006d,0x1ad));var _0xd006=function(_0x52a5f9,_0x15ed44){_0x52a5f9=_0x52a5f9-0x0;var _0x18afaa=_0x006d[_0x52a5f9];return _0x18afaa;};'use strict';var _=require(_0xd006('0x0'));var util=require(_0xd006('0x1'));var logger=require('../../config/logger')(_0xd006('0x2'));var moment=require(_0xd006('0x3'));var BPromise=require(_0xd006('0x4'));var rp=require(_0xd006('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd006('0x6'));var config=require(_0xd006('0x7'));var attributes=require(_0xd006('0x8'));var integrations=require(_0xd006('0x9'));module['exports']=function(_0x1f779b,_0x571ea8){return _0x1f779b['define'](_0xd006('0xa'),attributes,{'tableName':_0xd006('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60e3=['define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x43688c,_0x3a89c4){var _0x3f1954=function(_0x2ff878){while(--_0x2ff878){_0x43688c['push'](_0x43688c['shift']());}};_0x3f1954(++_0x3a89c4);}(_0x60e3,0x1bf));var _0x360e=function(_0x3b1a38,_0x3c1a7a){_0x3b1a38=_0x3b1a38-0x0;var _0x50a021=_0x60e3[_0x3b1a38];return _0x50a021;};'use strict';var _=require('lodash');var util=require(_0x360e('0x0'));var logger=require(_0x360e('0x1'))(_0x360e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x360e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x360e('0x4'));var config=require(_0x360e('0x5'));var attributes=require(_0x360e('0x6'));var integrations=require(_0x360e('0x7'));module[_0x360e('0x8')]=function(_0x4eef9a,_0x486237){return _0x4eef9a[_0x360e('0x9')](_0x360e('0xa'),attributes,{'tableName':_0x360e('0xb'),'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 4ffa0a4..cc55b34 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 _0x1d2d=['error','code','message','result','catch','VtigerAccount','findAll','raw','where','options','attributes','limit','map','include','model','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x153597,_0x492f6f){var _0x27d9de=function(_0x42f31f){while(--_0x42f31f){_0x153597['push'](_0x153597['shift']());}};_0x27d9de(++_0x492f6f);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x2bff5d,_0x5473d8){_0x2bff5d=_0x2bff5d-0x0;var _0x11264f=_0x1d2d[_0x2bff5d];return _0x11264f;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});}exports['GetVtigerAccount']=function(_0x3be186){var _0x55320b=this;return new Promise(function(_0x247b3a,_0x42565b){return db[_0xd1d2('0x18')][_0xd1d2('0x19')]({'raw':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1b')]||null:null,'attributes':_0x3be186[_0xd1d2('0x1c')]?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'limit':_0x3be186['options']?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1e')]||null:null,'include':_0x3be186[_0xd1d2('0x1c')]?_0x3be186['options']['include']?_[_0xd1d2('0x1f')](_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x20')],function(_0x2f92ee){return{'model':db[_0x2f92ee[_0xd1d2('0x21')]],'as':_0x2f92ee['as'],'attributes':_0x2f92ee[_0xd1d2('0x1d')],'include':_0x2f92ee[_0xd1d2('0x20')]?_['map'](_0x2f92ee[_0xd1d2('0x20')],function(_0x42da6d){return{'model':db[_0x42da6d[_0xd1d2('0x21')]],'as':_0x42da6d['as'],'attributes':_0x42da6d[_0xd1d2('0x1d')],'include':_0x42da6d[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x42da6d[_0xd1d2('0x20')],function(_0x34faf7){return{'model':db[_0x34faf7[_0xd1d2('0x21')]],'as':_0x34faf7['as'],'attributes':_0x34faf7[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x4e1bc2){logger['info'](_0xd1d2('0x22'),_0x3be186);logger[_0xd1d2('0x10')](_0xd1d2('0x22'),_0x3be186,JSON[_0xd1d2('0x12')](_0x4e1bc2));_0x247b3a(_0x4e1bc2);})[_0xd1d2('0x17')](function(_0x48ade1){logger[_0xd1d2('0x13')](_0xd1d2('0x22'),_0x48ade1[_0xd1d2('0x15')],_0x3be186);_0x42565b(_0x55320b['error'](0x1f4,_0x48ade1[_0xd1d2('0x15')]));});});};exports[_0xd1d2('0x23')]=function(_0xbd855a){var _0x56557d=this;return new Promise(function(_0x419db7,_0x18528f){return db[_0xd1d2('0x18')][_0xd1d2('0x24')]({'raw':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1b')]||null:null,'attributes':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'include':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0xbd855a[_0xd1d2('0x1c')]['include'],function(_0x1541ff){return{'model':db[_0x1541ff[_0xd1d2('0x21')]],'as':_0x1541ff['as'],'attributes':_0x1541ff[_0xd1d2('0x1d')],'include':_0x1541ff['include']?_[_0xd1d2('0x1f')](_0x1541ff['include'],function(_0x57a7fb){return{'model':db[_0x57a7fb[_0xd1d2('0x21')]],'as':_0x57a7fb['as'],'attributes':_0x57a7fb[_0xd1d2('0x1d')],'include':_0x57a7fb[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x57a7fb[_0xd1d2('0x20')],function(_0x2d2d12){return{'model':db[_0x2d2d12['model']],'as':_0x2d2d12['as'],'attributes':_0x2d2d12[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x5bdf40){logger[_0xd1d2('0xd')](_0xd1d2('0x23'),_0xbd855a);logger[_0xd1d2('0x10')](_0xd1d2('0x23'),_0xbd855a,JSON['stringify'](_0x5bdf40));_0x419db7(_0x5bdf40);})['catch'](function(_0x2fd2c5){logger['error']('ShowVtigerAccount',_0x2fd2c5['message'],_0xbd855a);_0x18528f(_0x56557d[_0xd1d2('0x13')](0x1f4,_0x2fd2c5['message']));});});}; \ No newline at end of file +var _0x5ec6=['util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','ShowVtigerAccount','find','lodash'];(function(_0x2341ac,_0x219ad7){var _0x265442=function(_0x42c3dd){while(--_0x42c3dd){_0x2341ac['push'](_0x2341ac['shift']());}};_0x265442(++_0x219ad7);}(_0x5ec6,0x7f));var _0x65ec=function(_0x431790,_0x4f1dc9){_0x431790=_0x431790-0x0;var _0x4bb946=_0x5ec6[_0x431790];return _0x4bb946;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('VtigerAccount,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});}exports[_0x65ec('0x14')]=function(_0x1254f8){var _0xb4ed90=this;return new Promise(function(_0x29ebc4,_0xd81ed3){return db[_0x65ec('0x15')][_0x65ec('0x16')]({'raw':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x19')]||null:null,'attributes':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'limit':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')]['limit']||null:null,'include':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0x47288d){return{'model':db[_0x47288d['model']],'as':_0x47288d['as'],'attributes':_0x47288d[_0x65ec('0x1a')],'include':_0x47288d[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x47288d[_0x65ec('0x1b')],function(_0x288e66){return{'model':db[_0x288e66[_0x65ec('0x1d')]],'as':_0x288e66['as'],'attributes':_0x288e66[_0x65ec('0x1a')],'include':_0x288e66[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x288e66['include'],function(_0x10baef){return{'model':db[_0x10baef[_0x65ec('0x1d')]],'as':_0x10baef['as'],'attributes':_0x10baef[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x4de451){logger[_0x65ec('0x12')]('GetVtigerAccount',_0x1254f8);logger[_0x65ec('0xc')](_0x65ec('0x14'),_0x1254f8,JSON[_0x65ec('0xe')](_0x4de451));_0x29ebc4(_0x4de451);})[_0x65ec('0x13')](function(_0x14431d){logger[_0x65ec('0xf')](_0x65ec('0x14'),_0x14431d[_0x65ec('0x11')],_0x1254f8);_0xd81ed3(_0xb4ed90[_0x65ec('0xf')](0x1f4,_0x14431d[_0x65ec('0x11')]));});});};exports[_0x65ec('0x1e')]=function(_0x4b435c){var _0x50d81f=this;return new Promise(function(_0x1d2e24,_0x5084af){return db[_0x65ec('0x15')][_0x65ec('0x1f')]({'raw':_0x4b435c['options']?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')]['where']||null:null,'attributes':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'include':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0xff3f3c){return{'model':db[_0xff3f3c['model']],'as':_0xff3f3c['as'],'attributes':_0xff3f3c[_0x65ec('0x1a')],'include':_0xff3f3c[_0x65ec('0x1b')]?_['map'](_0xff3f3c[_0x65ec('0x1b')],function(_0x24a242){return{'model':db[_0x24a242[_0x65ec('0x1d')]],'as':_0x24a242['as'],'attributes':_0x24a242[_0x65ec('0x1a')],'include':_0x24a242[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x24a242[_0x65ec('0x1b')],function(_0x5afcfc){return{'model':db[_0x5afcfc[_0x65ec('0x1d')]],'as':_0x5afcfc['as'],'attributes':_0x5afcfc[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x185447){logger['info'](_0x65ec('0x1e'),_0x4b435c);logger[_0x65ec('0xc')](_0x65ec('0x1e'),_0x4b435c,JSON[_0x65ec('0xe')](_0x185447));_0x1d2e24(_0x185447);})['catch'](function(_0x59a1c2){logger[_0x65ec('0xf')]('ShowVtigerAccount',_0x59a1c2[_0x65ec('0x11')],_0x4b435c);_0x5084af(_0x50d81f[_0x65ec('0xf')](0x1f4,_0x59a1c2['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6fb6fb7..a860605 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 _0xb932=['put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getDescriptions','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb932,0xb9));var _0x2b93=function(_0x5d368b,_0x3cd638){_0x5d368b=_0x5d368b-0x0;var _0x25d786=_0xb932[_0x5d368b];return _0x25d786;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2b93('0x0'));var timeout=require(_0x2b93('0x1'));var express=require(_0x2b93('0x2'));var router=express[_0x2b93('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b93('0x4'));var interaction=require(_0x2b93('0x5'));var config=require(_0x2b93('0x6'));var controller=require(_0x2b93('0x7'));router[_0x2b93('0x8')]('/',auth[_0x2b93('0x9')](),controller['index']);router[_0x2b93('0x8')](_0x2b93('0xa'),auth[_0x2b93('0x9')](),controller[_0x2b93('0xb')]);router[_0x2b93('0x8')]('/:id/fields',auth[_0x2b93('0x9')](),controller[_0x2b93('0xc')]);router[_0x2b93('0x8')]('/:id/subjects',auth[_0x2b93('0x9')](),controller['getSubjects']);router[_0x2b93('0x8')]('/:id/descriptions',auth[_0x2b93('0x9')](),controller[_0x2b93('0xd')]);router['post']('/',auth[_0x2b93('0x9')](),controller[_0x2b93('0xe')]);router[_0x2b93('0xf')](_0x2b93('0xa'),auth[_0x2b93('0x9')](),controller[_0x2b93('0x10')]);router[_0x2b93('0x11')](_0x2b93('0xa'),auth[_0x2b93('0x9')](),controller[_0x2b93('0x12')]);module[_0x2b93('0x13')]=router; \ No newline at end of file +var _0xdcde=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3c11a0,_0x88755d){var _0x40178a=function(_0x25d0d6){while(--_0x25d0d6){_0x3c11a0['push'](_0x3c11a0['shift']());}};_0x40178a(++_0x88755d);}(_0xdcde,0xd6));var _0xedcd=function(_0x5da83d,_0x3815bb){_0x5da83d=_0x5da83d-0x0;var _0x67238=_0xdcde[_0x5da83d];return _0x67238;};'use strict';var multer=require(_0xedcd('0x0'));var util=require(_0xedcd('0x1'));var path=require('path');var timeout=require(_0xedcd('0x2'));var express=require(_0xedcd('0x3'));var router=express[_0xedcd('0x4')]();var fs_extra=require(_0xedcd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xedcd('0x6'));var config=require(_0xedcd('0x7'));var controller=require(_0xedcd('0x8'));router[_0xedcd('0x9')]('/',auth[_0xedcd('0xa')](),controller[_0xedcd('0xb')]);router[_0xedcd('0x9')](_0xedcd('0xc'),auth[_0xedcd('0xa')](),controller[_0xedcd('0xd')]);router['get'](_0xedcd('0xe'),auth[_0xedcd('0xa')](),controller[_0xedcd('0xf')]);router[_0xedcd('0x9')](_0xedcd('0x10'),auth[_0xedcd('0xa')](),controller[_0xedcd('0x11')]);router[_0xedcd('0x9')](_0xedcd('0x12'),auth['isAuthenticated'](),controller[_0xedcd('0x13')]);router[_0xedcd('0x14')]('/',auth[_0xedcd('0xa')](),controller[_0xedcd('0x15')]);router[_0xedcd('0x16')](_0xedcd('0xc'),auth['isAuthenticated'](),controller[_0xedcd('0x17')]);router[_0xedcd('0x18')](_0xedcd('0xc'),auth[_0xedcd('0xa')](),controller[_0xedcd('0x19')]);module[_0xedcd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 3ec1b1b..c9bb4a4 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 _0x41f7=['STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x41f7,0x137));var _0x741f=function(_0x43d8d5,_0x419537){_0x43d8d5=_0x43d8d5-0x0;var _0x447173=_0x41f7[_0x43d8d5];return _0x447173;};'use strict';var Sequelize=require(_0x741f('0x0'));module['exports']={'name':{'type':Sequelize[_0x741f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7bf6=['exports','STRING','sequelize'];(function(_0xbe5db9,_0x33e19b){var _0x165e98=function(_0x363507){while(--_0x363507){_0xbe5db9['push'](_0xbe5db9['shift']());}};_0x165e98(++_0x33e19b);}(_0x7bf6,0xaa));var _0x67bf=function(_0x1d1cc2,_0x299f8d){_0x1d1cc2=_0x1d1cc2-0x0;var _0x1476f6=_0x7bf6[_0x1d1cc2];return _0x1476f6;};'use strict';var Sequelize=require(_0x67bf('0x0'));module[_0x67bf('0x1')]={'name':{'type':Sequelize[_0x67bf('0x2')]},'description':{'type':Sequelize[_0x67bf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 0a0e6cf..2241c57 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 _0x6400=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','zip-dir','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3aeec2,_0x167576){var _0xbf0ef1=function(_0x18101d){while(--_0x18101d){_0x3aeec2['push'](_0x3aeec2['shift']());}};_0xbf0ef1(++_0x167576);}(_0x6400,0x1ee));var _0x0640=function(_0x31004c,_0x503c2e){_0x31004c=_0x31004c-0x0;var _0x399a98=_0x6400[_0x31004c];return _0x399a98;};'use strict';var emlformat=require(_0x0640('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0640('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0640('0x2'));var BPromise=require(_0x0640('0x3'));var Mustache=require(_0x0640('0x4'));var util=require(_0x0640('0x5'));var path=require('path');var sox=require(_0x0640('0x6'));var csv=require('to-csv');var ejs=require(_0x0640('0x7'));var fs=require('fs');var fs_extra=require(_0x0640('0x8'));var _=require(_0x0640('0x9'));var squel=require(_0x0640('0xa'));var crypto=require(_0x0640('0xb'));var jsforce=require(_0x0640('0xc'));var deskjs=require(_0x0640('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0640('0xe'));var Redis=require(_0x0640('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0640('0x10'));var as=require(_0x0640('0x11'));var hardwareService=require(_0x0640('0x12'));var logger=require(_0x0640('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0640('0x14'));var licenseUtil=require(_0x0640('0x15'));var db=require(_0x0640('0x16'))['db'];function respondWithStatusCode(_0x3cf505,_0x2a58e7){_0x2a58e7=_0x2a58e7||0xcc;return function(_0x349783){if(_0x349783){return _0x3cf505['sendStatus'](_0x2a58e7);}return _0x3cf505['status'](_0x2a58e7)[_0x0640('0x17')]();};}function respondWithResult(_0x2c89dd,_0x256b73){_0x256b73=_0x256b73||0xc8;return function(_0x3fb2b9){if(_0x3fb2b9){return _0x2c89dd['status'](_0x256b73)[_0x0640('0x18')](_0x3fb2b9);}};}function respondWithFilteredResult(_0x5e592e,_0xb19806){return function(_0x4f211a){if(_0x4f211a){var _0x9d8242=typeof _0xb19806[_0x0640('0x19')]===_0x0640('0x1a')&&typeof _0xb19806[_0x0640('0x1b')]===_0x0640('0x1a');var _0x409e55=_0x4f211a[_0x0640('0x1c')];var _0x3f43ac=_0x9d8242?0x0:_0xb19806[_0x0640('0x19')];var _0x11b3b1=_0x9d8242?_0x4f211a['count']:_0xb19806[_0x0640('0x19')]+_0xb19806[_0x0640('0x1b')];var _0x3b0b18;if(_0x11b3b1>=_0x409e55){_0x11b3b1=_0x409e55;_0x3b0b18=0xc8;}else{_0x3b0b18=0xce;}_0x5e592e[_0x0640('0x1d')](_0x3b0b18);return _0x5e592e[_0x0640('0x1e')]('Content-Range',_0x3f43ac+'-'+_0x11b3b1+'/'+_0x409e55)[_0x0640('0x18')](_0x4f211a);}return null;};}function patchUpdates(_0x2ac318){return function(_0x585b0b){try{jsonpatch[_0x0640('0x1f')](_0x585b0b,_0x2ac318,!![]);}catch(_0x401dee){return BPromise[_0x0640('0x20')](_0x401dee);}return _0x585b0b[_0x0640('0x21')]();};}function saveUpdates(_0x35a939,_0x1de48e){return function(_0x428766){if(_0x428766){return _0x428766[_0x0640('0x22')](_0x35a939)[_0x0640('0x23')](function(_0x5d6935){return _0x5d6935;});}return null;};}function removeEntity(_0x3793ac,_0x179918){return function(_0x1c73c6){if(_0x1c73c6){return _0x1c73c6[_0x0640('0x24')]()[_0x0640('0x23')](function(){_0x3793ac[_0x0640('0x1d')](0xcc)[_0x0640('0x17')]();});}};}function handleEntityNotFound(_0x2f5fc7,_0x2598fd){return function(_0x3faa2c){if(!_0x3faa2c){_0x2f5fc7['sendStatus'](0x194);}return _0x3faa2c;};}function handleError(_0x33b730,_0x3d38a2){_0x3d38a2=_0x3d38a2||0x1f4;return function(_0x2e995b){logger[_0x0640('0x25')](_0x2e995b[_0x0640('0x26')]);if(_0x2e995b[_0x0640('0x27')]){delete _0x2e995b[_0x0640('0x27')];}_0x33b730[_0x0640('0x1d')](_0x3d38a2)[_0x0640('0x28')](_0x2e995b);};}exports['index']=function(_0x2d583a,_0xec0cb4){var _0x3db0a4={},_0x143457={},_0x415dd9={'count':0x0,'rows':[]};var _0x5b278a=_[_0x0640('0x29')](db[_0x0640('0x2a')]['rawAttributes'],function(_0x239b5a){return{'name':_0x239b5a[_0x0640('0x2b')],'type':_0x239b5a[_0x0640('0x2c')][_0x0640('0x2d')]};});_0x143457[_0x0640('0x2e')]=_['map'](_0x5b278a,_0x0640('0x27'));_0x143457[_0x0640('0x2f')]=_[_0x0640('0x30')](_0x2d583a['query']);_0x143457[_0x0640('0x31')]=_[_0x0640('0x32')](_0x143457['model'],_0x143457[_0x0640('0x2f')]);_0x3db0a4[_0x0640('0x33')]=_[_0x0640('0x32')](_0x143457[_0x0640('0x2e')],qs[_0x0640('0x34')](_0x2d583a[_0x0640('0x2f')]['fields']));_0x3db0a4[_0x0640('0x33')]=_0x3db0a4[_0x0640('0x33')][_0x0640('0x35')]?_0x3db0a4[_0x0640('0x33')]:_0x143457[_0x0640('0x2e')];if(!_0x2d583a[_0x0640('0x2f')][_0x0640('0x36')](_0x0640('0x37'))){_0x3db0a4['limit']=qs['limit'](_0x2d583a[_0x0640('0x2f')]['limit']);_0x3db0a4[_0x0640('0x19')]=qs['offset'](_0x2d583a[_0x0640('0x2f')][_0x0640('0x19')]);}_0x3db0a4[_0x0640('0x38')]=qs[_0x0640('0x39')](_0x2d583a[_0x0640('0x2f')]['sort']);_0x3db0a4[_0x0640('0x3a')]=qs[_0x0640('0x31')](_[_0x0640('0x3b')](_0x2d583a[_0x0640('0x2f')],_0x143457[_0x0640('0x31')]),_0x5b278a);if(_0x2d583a[_0x0640('0x2f')][_0x0640('0x3c')]){_0x3db0a4[_0x0640('0x3a')]=_[_0x0640('0x3d')](_0x3db0a4[_0x0640('0x3a')],{'$or':_[_0x0640('0x29')](_0x5b278a,function(_0x192ba3){if(_0x192ba3[_0x0640('0x2c')]!==_0x0640('0x3e')){var _0x2f0e95={};_0x2f0e95[_0x192ba3[_0x0640('0x27')]]={'$like':'%'+_0x2d583a[_0x0640('0x2f')]['filter']+'%'};return _0x2f0e95;}})});}_0x3db0a4=_[_0x0640('0x3d')]({},_0x3db0a4,_0x2d583a[_0x0640('0x3f')]);var _0x1035ba={'where':_0x3db0a4[_0x0640('0x3a')]};return db['VtigerConfiguration'][_0x0640('0x1c')](_0x1035ba)[_0x0640('0x23')](function(_0x4b856a){_0x415dd9[_0x0640('0x1c')]=_0x4b856a;if(_0x2d583a[_0x0640('0x2f')][_0x0640('0x40')]){_0x3db0a4['include']=[{'all':!![]}];}return db[_0x0640('0x2a')][_0x0640('0x41')](_0x3db0a4);})[_0x0640('0x23')](function(_0x23ddaf){_0x415dd9[_0x0640('0x42')]=_0x23ddaf;return _0x415dd9;})[_0x0640('0x23')](respondWithFilteredResult(_0xec0cb4,_0x3db0a4))[_0x0640('0x43')](handleError(_0xec0cb4,null));};exports['show']=function(_0x4a835d,_0x1040d2){var _0x33215a={'raw':![],'where':{'id':_0x4a835d[_0x0640('0x44')]['id']}},_0x3599dd={};_0x3599dd[_0x0640('0x2e')]=_['keys'](db[_0x0640('0x2a')][_0x0640('0x45')]);_0x3599dd[_0x0640('0x2f')]=_[_0x0640('0x30')](_0x4a835d[_0x0640('0x2f')]);_0x3599dd[_0x0640('0x31')]=_[_0x0640('0x32')](_0x3599dd[_0x0640('0x2e')],_0x3599dd['query']);_0x33215a[_0x0640('0x33')]=_[_0x0640('0x32')](_0x3599dd['model'],qs[_0x0640('0x34')](_0x4a835d[_0x0640('0x2f')][_0x0640('0x34')]));_0x33215a[_0x0640('0x33')]=_0x33215a[_0x0640('0x33')]['length']?_0x33215a[_0x0640('0x33')]:_0x3599dd[_0x0640('0x2e')];if(_0x4a835d['query'][_0x0640('0x40')]){_0x33215a[_0x0640('0x46')]=[{'all':!![]}];}_0x33215a=_[_0x0640('0x3d')]({},_0x33215a,_0x4a835d[_0x0640('0x3f')]);return db[_0x0640('0x2a')][_0x0640('0x47')](_0x33215a)['then'](handleEntityNotFound(_0x1040d2,null))['then'](respondWithResult(_0x1040d2,null))[_0x0640('0x43')](handleError(_0x1040d2,null));};exports[_0x0640('0x48')]=function(_0x3a2672,_0x7148f){return db[_0x0640('0x2a')][_0x0640('0x48')](_0x3a2672[_0x0640('0x49')],{})[_0x0640('0x23')](respondWithResult(_0x7148f,0xc9))['catch'](handleError(_0x7148f,null));};exports[_0x0640('0x22')]=function(_0x17cbda,_0x17a26d){if(_0x17cbda[_0x0640('0x49')]['id']){delete _0x17cbda[_0x0640('0x49')]['id'];}return db[_0x0640('0x2a')][_0x0640('0x47')]({'where':{'id':_0x17cbda[_0x0640('0x44')]['id']}})[_0x0640('0x23')](handleEntityNotFound(_0x17a26d,null))[_0x0640('0x23')](saveUpdates(_0x17cbda[_0x0640('0x49')],null))[_0x0640('0x23')](respondWithResult(_0x17a26d,null))[_0x0640('0x43')](handleError(_0x17a26d,null));};exports[_0x0640('0x24')]=function(_0x214b1b,_0x31be3f){return db[_0x0640('0x2a')][_0x0640('0x47')]({'where':{'id':_0x214b1b[_0x0640('0x44')]['id']}})[_0x0640('0x23')](handleEntityNotFound(_0x31be3f,null))[_0x0640('0x23')](removeEntity(_0x31be3f,null))[_0x0640('0x43')](handleError(_0x31be3f,null));};exports[_0x0640('0x4a')]=function(_0x59ab7a,_0x115b2e,_0x57a351){var _0x461e7a={};var _0x30cc34={};var _0xe6ea5c;var _0xd5cf5;return db[_0x0640('0x2a')][_0x0640('0x4b')]({'where':{'id':_0x59ab7a[_0x0640('0x44')]['id']}})[_0x0640('0x23')](handleEntityNotFound(_0x115b2e,null))[_0x0640('0x23')](function(_0x51bed2){if(_0x51bed2){_0xe6ea5c=_0x51bed2;_0x30cc34[_0x0640('0x2e')]=_['keys'](db[_0x0640('0x4c')][_0x0640('0x45')]);_0x30cc34['query']=_[_0x0640('0x30')](_0x59ab7a[_0x0640('0x2f')]);_0x30cc34['filters']=_[_0x0640('0x32')](_0x30cc34[_0x0640('0x2e')],_0x30cc34[_0x0640('0x2f')]);_0x461e7a['attributes']=_['intersection'](_0x30cc34[_0x0640('0x2e')],qs['fields'](_0x59ab7a[_0x0640('0x2f')][_0x0640('0x34')]));_0x461e7a[_0x0640('0x33')]=_0x461e7a[_0x0640('0x33')][_0x0640('0x35')]?_0x461e7a[_0x0640('0x33')]:_0x30cc34[_0x0640('0x2e')];_0x461e7a[_0x0640('0x38')]=qs[_0x0640('0x39')](_0x59ab7a[_0x0640('0x2f')][_0x0640('0x39')]);_0x461e7a['where']=qs[_0x0640('0x31')](_[_0x0640('0x3b')](_0x59ab7a[_0x0640('0x2f')],_0x30cc34[_0x0640('0x31')]));if(_0x59ab7a['query']['filter']){_0x461e7a[_0x0640('0x3a')]=_[_0x0640('0x3d')](_0x461e7a[_0x0640('0x3a')],{'$or':_[_0x0640('0x29')](_0x461e7a['attributes'],function(_0x548c97){var _0x345b89={};_0x345b89[_0x548c97]={'$like':'%'+_0x59ab7a[_0x0640('0x2f')][_0x0640('0x3c')]+'%'};return _0x345b89;})});}_0x461e7a=_['merge']({},_0x461e7a,_0x59ab7a[_0x0640('0x3f')]);return _0xe6ea5c[_0x0640('0x4a')](_0x461e7a);}})[_0x0640('0x23')](function(_0x24dca2){if(_0x24dca2){_0xd5cf5=_0x24dca2[_0x0640('0x35')];if(!_0x59ab7a[_0x0640('0x2f')][_0x0640('0x36')](_0x0640('0x37'))){_0x461e7a['limit']=qs[_0x0640('0x1b')](_0x59ab7a[_0x0640('0x2f')][_0x0640('0x1b')]);_0x461e7a['offset']=qs[_0x0640('0x19')](_0x59ab7a[_0x0640('0x2f')]['offset']);}return _0xe6ea5c[_0x0640('0x4a')](_0x461e7a);}})['then'](function(_0x55fc77){if(_0x55fc77){return _0x55fc77?{'count':_0xd5cf5,'rows':_0x55fc77}:null;}})['then'](respondWithResult(_0x115b2e,null))[_0x0640('0x43')](handleError(_0x115b2e,null));};exports[_0x0640('0x4d')]=function(_0x287e1e,_0x3475be,_0x262c64){var _0x49d72c={};var _0x229c90={};var _0x2e5e2f;var _0x48cf60;return db[_0x0640('0x2a')]['findOne']({'where':{'id':_0x287e1e[_0x0640('0x44')]['id']}})[_0x0640('0x23')](handleEntityNotFound(_0x3475be,null))[_0x0640('0x23')](function(_0x8fbc43){if(_0x8fbc43){_0x2e5e2f=_0x8fbc43;_0x229c90['model']=_[_0x0640('0x30')](db[_0x0640('0x4c')][_0x0640('0x45')]);_0x229c90['query']=_[_0x0640('0x30')](_0x287e1e[_0x0640('0x2f')]);_0x229c90[_0x0640('0x31')]=_[_0x0640('0x32')](_0x229c90[_0x0640('0x2e')],_0x229c90[_0x0640('0x2f')]);_0x49d72c[_0x0640('0x33')]=_[_0x0640('0x32')](_0x229c90[_0x0640('0x2e')],qs['fields'](_0x287e1e['query'][_0x0640('0x34')]));_0x49d72c[_0x0640('0x33')]=_0x49d72c[_0x0640('0x33')][_0x0640('0x35')]?_0x49d72c[_0x0640('0x33')]:_0x229c90[_0x0640('0x2e')];_0x49d72c['order']=qs[_0x0640('0x39')](_0x287e1e[_0x0640('0x2f')][_0x0640('0x39')]);_0x49d72c[_0x0640('0x3a')]=qs[_0x0640('0x31')](_['pick'](_0x287e1e[_0x0640('0x2f')],_0x229c90[_0x0640('0x31')]));if(_0x287e1e['query'][_0x0640('0x3c')]){_0x49d72c[_0x0640('0x3a')]=_[_0x0640('0x3d')](_0x49d72c[_0x0640('0x3a')],{'$or':_[_0x0640('0x29')](_0x49d72c[_0x0640('0x33')],function(_0x5b0d21){var _0x25286b={};_0x25286b[_0x5b0d21]={'$like':'%'+_0x287e1e[_0x0640('0x2f')][_0x0640('0x3c')]+'%'};return _0x25286b;})});}_0x49d72c=_['merge']({},_0x49d72c,_0x287e1e[_0x0640('0x3f')]);return _0x2e5e2f[_0x0640('0x4d')](_0x49d72c);}})[_0x0640('0x23')](function(_0x1c6294){if(_0x1c6294){_0x48cf60=_0x1c6294[_0x0640('0x35')];if(!_0x287e1e[_0x0640('0x2f')]['hasOwnProperty']('nolimit')){_0x49d72c['limit']=qs[_0x0640('0x1b')](_0x287e1e[_0x0640('0x2f')]['limit']);_0x49d72c[_0x0640('0x19')]=qs[_0x0640('0x19')](_0x287e1e['query'][_0x0640('0x19')]);}return _0x2e5e2f[_0x0640('0x4d')](_0x49d72c);}})[_0x0640('0x23')](function(_0x106a3f){if(_0x106a3f){return _0x106a3f?{'count':_0x48cf60,'rows':_0x106a3f}:null;}})[_0x0640('0x23')](respondWithResult(_0x3475be,null))[_0x0640('0x43')](handleError(_0x3475be,null));};exports[_0x0640('0x4e')]=function(_0xf21891,_0x50cdf1,_0x17a1b4){var _0x54094c={};var _0x19439a={};var _0x559d03;var _0x20d9f1;return db['VtigerConfiguration'][_0x0640('0x4b')]({'where':{'id':_0xf21891['params']['id']}})['then'](handleEntityNotFound(_0x50cdf1,null))[_0x0640('0x23')](function(_0x11d272){if(_0x11d272){_0x559d03=_0x11d272;_0x19439a['model']=_['keys'](db['VtigerField'][_0x0640('0x45')]);_0x19439a['query']=_[_0x0640('0x30')](_0xf21891[_0x0640('0x2f')]);_0x19439a[_0x0640('0x31')]=_['intersection'](_0x19439a[_0x0640('0x2e')],_0x19439a[_0x0640('0x2f')]);_0x54094c[_0x0640('0x33')]=_['intersection'](_0x19439a[_0x0640('0x2e')],qs[_0x0640('0x34')](_0xf21891[_0x0640('0x2f')][_0x0640('0x34')]));_0x54094c['attributes']=_0x54094c[_0x0640('0x33')]['length']?_0x54094c[_0x0640('0x33')]:_0x19439a[_0x0640('0x2e')];_0x54094c[_0x0640('0x38')]=qs[_0x0640('0x39')](_0xf21891[_0x0640('0x2f')][_0x0640('0x39')]);_0x54094c[_0x0640('0x3a')]=qs['filters'](_['pick'](_0xf21891['query'],_0x19439a[_0x0640('0x31')]));if(_0xf21891[_0x0640('0x2f')]['filter']){_0x54094c[_0x0640('0x3a')]=_[_0x0640('0x3d')](_0x54094c['where'],{'$or':_[_0x0640('0x29')](_0x54094c[_0x0640('0x33')],function(_0x5af4f5){var _0x559e16={};_0x559e16[_0x5af4f5]={'$like':'%'+_0xf21891[_0x0640('0x2f')][_0x0640('0x3c')]+'%'};return _0x559e16;})});}_0x54094c=_[_0x0640('0x3d')]({},_0x54094c,_0xf21891[_0x0640('0x3f')]);return _0x559d03[_0x0640('0x4e')](_0x54094c);}})['then'](function(_0x208066){if(_0x208066){_0x20d9f1=_0x208066[_0x0640('0x35')];if(!_0xf21891[_0x0640('0x2f')][_0x0640('0x36')]('nolimit')){_0x54094c['limit']=qs[_0x0640('0x1b')](_0xf21891[_0x0640('0x2f')]['limit']);_0x54094c[_0x0640('0x19')]=qs[_0x0640('0x19')](_0xf21891[_0x0640('0x2f')][_0x0640('0x19')]);}return _0x559d03[_0x0640('0x4e')](_0x54094c);}})[_0x0640('0x23')](function(_0x4e2119){if(_0x4e2119){return _0x4e2119?{'count':_0x20d9f1,'rows':_0x4e2119}:null;}})[_0x0640('0x23')](respondWithResult(_0x50cdf1,null))[_0x0640('0x43')](handleError(_0x50cdf1,null));}; \ No newline at end of file +var _0xa6e6=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','status','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','VtigerConfiguration','findAll','show','params','keys','find','catch','create','body','getFields','findOne','VtigerField','sort','getSubjects','getDescriptions','eml-format','zip-dir','moment'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0xa6e6,0x183));var _0x6a6e=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xa6e6[_0x3b5ad9];return _0x611ae9;};'use strict';var emlformat=require(_0x6a6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a6e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a6e('0x2'));var BPromise=require(_0x6a6e('0x3'));var Mustache=require(_0x6a6e('0x4'));var util=require(_0x6a6e('0x5'));var path=require(_0x6a6e('0x6'));var sox=require(_0x6a6e('0x7'));var csv=require('to-csv');var ejs=require(_0x6a6e('0x8'));var fs=require('fs');var fs_extra=require(_0x6a6e('0x9'));var _=require(_0x6a6e('0xa'));var squel=require('squel');var crypto=require(_0x6a6e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a6e('0xc'));var toCsv=require(_0x6a6e('0xd'));var querystring=require(_0x6a6e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6a6e('0xf'));var as=require(_0x6a6e('0x10'));var hardwareService=require(_0x6a6e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6a6e('0x12'));var config=require(_0x6a6e('0x13'));var licenseUtil=require(_0x6a6e('0x14'));var db=require(_0x6a6e('0x15'))['db'];function respondWithStatusCode(_0x4e8576,_0x1fe1cb){_0x1fe1cb=_0x1fe1cb||0xcc;return function(_0x3cdf0a){if(_0x3cdf0a){return _0x4e8576[_0x6a6e('0x16')](_0x1fe1cb);}return _0x4e8576['status'](_0x1fe1cb)[_0x6a6e('0x17')]();};}function respondWithResult(_0x14fde1,_0x5a204d){_0x5a204d=_0x5a204d||0xc8;return function(_0x3bf167){if(_0x3bf167){return _0x14fde1['status'](_0x5a204d)[_0x6a6e('0x18')](_0x3bf167);}};}function respondWithFilteredResult(_0x1c4497,_0x171e28){return function(_0x5ba627){if(_0x5ba627){var _0x4f7ecf=typeof _0x171e28[_0x6a6e('0x19')]===_0x6a6e('0x1a')&&typeof _0x171e28['limit']===_0x6a6e('0x1a');var _0x7be14f=_0x5ba627[_0x6a6e('0x1b')];var _0x2f11c9=_0x4f7ecf?0x0:_0x171e28['offset'];var _0x160f6d=_0x4f7ecf?_0x5ba627[_0x6a6e('0x1b')]:_0x171e28[_0x6a6e('0x19')]+_0x171e28['limit'];var _0x5e6821;if(_0x160f6d>=_0x7be14f){_0x160f6d=_0x7be14f;_0x5e6821=0xc8;}else{_0x5e6821=0xce;}_0x1c4497['status'](_0x5e6821);return _0x1c4497[_0x6a6e('0x1c')]('Content-Range',_0x2f11c9+'-'+_0x160f6d+'/'+_0x7be14f)['json'](_0x5ba627);}return null;};}function patchUpdates(_0x485594){return function(_0x39f1c1){try{jsonpatch[_0x6a6e('0x1d')](_0x39f1c1,_0x485594,!![]);}catch(_0x4edb3e){return BPromise[_0x6a6e('0x1e')](_0x4edb3e);}return _0x39f1c1[_0x6a6e('0x1f')]();};}function saveUpdates(_0x388306,_0x40581c){return function(_0x482f5a){if(_0x482f5a){return _0x482f5a[_0x6a6e('0x20')](_0x388306)[_0x6a6e('0x21')](function(_0x4b4eb5){return _0x4b4eb5;});}return null;};}function removeEntity(_0x4c0718,_0x4d197f){return function(_0x2b7645){if(_0x2b7645){return _0x2b7645[_0x6a6e('0x22')]()['then'](function(){_0x4c0718['status'](0xcc)[_0x6a6e('0x17')]();});}};}function handleEntityNotFound(_0x5976f9,_0xaf3ddb){return function(_0x1246d8){if(!_0x1246d8){_0x5976f9[_0x6a6e('0x16')](0x194);}return _0x1246d8;};}function handleError(_0x3f4a62,_0x115de2){_0x115de2=_0x115de2||0x1f4;return function(_0x3a3aa7){logger[_0x6a6e('0x23')](_0x3a3aa7[_0x6a6e('0x24')]);if(_0x3a3aa7[_0x6a6e('0x25')]){delete _0x3a3aa7[_0x6a6e('0x25')];}_0x3f4a62[_0x6a6e('0x26')](_0x115de2)['send'](_0x3a3aa7);};}exports[_0x6a6e('0x27')]=function(_0xc7b968,_0x4244fe){var _0x4820db={},_0x2673c4={},_0x131fff={'count':0x0,'rows':[]};var _0x9403c4=_[_0x6a6e('0x28')](db['VtigerConfiguration'][_0x6a6e('0x29')],function(_0x3d1f81){return{'name':_0x3d1f81[_0x6a6e('0x2a')],'type':_0x3d1f81[_0x6a6e('0x2b')][_0x6a6e('0x2c')]};});_0x2673c4[_0x6a6e('0x2d')]=_[_0x6a6e('0x28')](_0x9403c4,'name');_0x2673c4[_0x6a6e('0x2e')]=_['keys'](_0xc7b968['query']);_0x2673c4[_0x6a6e('0x2f')]=_[_0x6a6e('0x30')](_0x2673c4[_0x6a6e('0x2d')],_0x2673c4[_0x6a6e('0x2e')]);_0x4820db['attributes']=_[_0x6a6e('0x30')](_0x2673c4[_0x6a6e('0x2d')],qs['fields'](_0xc7b968['query'][_0x6a6e('0x31')]));_0x4820db[_0x6a6e('0x32')]=_0x4820db[_0x6a6e('0x32')][_0x6a6e('0x33')]?_0x4820db['attributes']:_0x2673c4[_0x6a6e('0x2d')];if(!_0xc7b968[_0x6a6e('0x2e')]['hasOwnProperty'](_0x6a6e('0x34'))){_0x4820db[_0x6a6e('0x35')]=qs[_0x6a6e('0x35')](_0xc7b968[_0x6a6e('0x2e')]['limit']);_0x4820db[_0x6a6e('0x19')]=qs['offset'](_0xc7b968[_0x6a6e('0x2e')]['offset']);}_0x4820db[_0x6a6e('0x36')]=qs['sort'](_0xc7b968[_0x6a6e('0x2e')]['sort']);_0x4820db['where']=qs[_0x6a6e('0x2f')](_[_0x6a6e('0x37')](_0xc7b968['query'],_0x2673c4[_0x6a6e('0x2f')]),_0x9403c4);if(_0xc7b968[_0x6a6e('0x2e')][_0x6a6e('0x38')]){_0x4820db[_0x6a6e('0x39')]=_[_0x6a6e('0x3a')](_0x4820db[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x9403c4,function(_0x164ed9){if(_0x164ed9['type']!==_0x6a6e('0x3b')){var _0x568657={};_0x568657[_0x164ed9[_0x6a6e('0x25')]]={'$like':'%'+_0xc7b968[_0x6a6e('0x2e')][_0x6a6e('0x38')]+'%'};return _0x568657;}})});}_0x4820db=_['merge']({},_0x4820db,_0xc7b968[_0x6a6e('0x3c')]);var _0x3a901c={'where':_0x4820db[_0x6a6e('0x39')]};return db['VtigerConfiguration'][_0x6a6e('0x1b')](_0x3a901c)['then'](function(_0x9dd9ae){_0x131fff[_0x6a6e('0x1b')]=_0x9dd9ae;if(_0xc7b968[_0x6a6e('0x2e')][_0x6a6e('0x3d')]){_0x4820db[_0x6a6e('0x3e')]=[{'all':!![]}];}return db[_0x6a6e('0x3f')][_0x6a6e('0x40')](_0x4820db);})[_0x6a6e('0x21')](function(_0x3b3f11){_0x131fff['rows']=_0x3b3f11;return _0x131fff;})[_0x6a6e('0x21')](respondWithFilteredResult(_0x4244fe,_0x4820db))['catch'](handleError(_0x4244fe,null));};exports[_0x6a6e('0x41')]=function(_0x4ea1d3,_0x460275){var _0x1e8d2a={'raw':![],'where':{'id':_0x4ea1d3[_0x6a6e('0x42')]['id']}},_0xd233c={};_0xd233c[_0x6a6e('0x2d')]=_['keys'](db[_0x6a6e('0x3f')][_0x6a6e('0x29')]);_0xd233c[_0x6a6e('0x2e')]=_[_0x6a6e('0x43')](_0x4ea1d3[_0x6a6e('0x2e')]);_0xd233c['filters']=_[_0x6a6e('0x30')](_0xd233c[_0x6a6e('0x2d')],_0xd233c[_0x6a6e('0x2e')]);_0x1e8d2a[_0x6a6e('0x32')]=_['intersection'](_0xd233c['model'],qs[_0x6a6e('0x31')](_0x4ea1d3[_0x6a6e('0x2e')]['fields']));_0x1e8d2a[_0x6a6e('0x32')]=_0x1e8d2a['attributes'][_0x6a6e('0x33')]?_0x1e8d2a[_0x6a6e('0x32')]:_0xd233c[_0x6a6e('0x2d')];if(_0x4ea1d3[_0x6a6e('0x2e')][_0x6a6e('0x3d')]){_0x1e8d2a[_0x6a6e('0x3e')]=[{'all':!![]}];}_0x1e8d2a=_['merge']({},_0x1e8d2a,_0x4ea1d3['options']);return db[_0x6a6e('0x3f')][_0x6a6e('0x44')](_0x1e8d2a)[_0x6a6e('0x21')](handleEntityNotFound(_0x460275,null))[_0x6a6e('0x21')](respondWithResult(_0x460275,null))[_0x6a6e('0x45')](handleError(_0x460275,null));};exports[_0x6a6e('0x46')]=function(_0x4f2a67,_0x3e5d47){return db['VtigerConfiguration'][_0x6a6e('0x46')](_0x4f2a67[_0x6a6e('0x47')],{})[_0x6a6e('0x21')](respondWithResult(_0x3e5d47,0xc9))[_0x6a6e('0x45')](handleError(_0x3e5d47,null));};exports[_0x6a6e('0x20')]=function(_0x3c4dfb,_0x29d4d1){if(_0x3c4dfb[_0x6a6e('0x47')]['id']){delete _0x3c4dfb[_0x6a6e('0x47')]['id'];}return db[_0x6a6e('0x3f')][_0x6a6e('0x44')]({'where':{'id':_0x3c4dfb[_0x6a6e('0x42')]['id']}})[_0x6a6e('0x21')](handleEntityNotFound(_0x29d4d1,null))['then'](saveUpdates(_0x3c4dfb[_0x6a6e('0x47')],null))[_0x6a6e('0x21')](respondWithResult(_0x29d4d1,null))[_0x6a6e('0x45')](handleError(_0x29d4d1,null));};exports['destroy']=function(_0x525559,_0x11088d){return db[_0x6a6e('0x3f')][_0x6a6e('0x44')]({'where':{'id':_0x525559['params']['id']}})[_0x6a6e('0x21')](handleEntityNotFound(_0x11088d,null))[_0x6a6e('0x21')](removeEntity(_0x11088d,null))[_0x6a6e('0x45')](handleError(_0x11088d,null));};exports[_0x6a6e('0x48')]=function(_0x1f8881,_0xbbd037,_0xb2106c){var _0x42940b={};var _0x1be2db={};var _0x5995b4;var _0x507403;return db['VtigerConfiguration'][_0x6a6e('0x49')]({'where':{'id':_0x1f8881[_0x6a6e('0x42')]['id']}})[_0x6a6e('0x21')](handleEntityNotFound(_0xbbd037,null))[_0x6a6e('0x21')](function(_0x32a853){if(_0x32a853){_0x5995b4=_0x32a853;_0x1be2db[_0x6a6e('0x2d')]=_['keys'](db[_0x6a6e('0x4a')][_0x6a6e('0x29')]);_0x1be2db['query']=_[_0x6a6e('0x43')](_0x1f8881[_0x6a6e('0x2e')]);_0x1be2db[_0x6a6e('0x2f')]=_['intersection'](_0x1be2db[_0x6a6e('0x2d')],_0x1be2db[_0x6a6e('0x2e')]);_0x42940b['attributes']=_[_0x6a6e('0x30')](_0x1be2db['model'],qs[_0x6a6e('0x31')](_0x1f8881['query']['fields']));_0x42940b[_0x6a6e('0x32')]=_0x42940b[_0x6a6e('0x32')][_0x6a6e('0x33')]?_0x42940b[_0x6a6e('0x32')]:_0x1be2db[_0x6a6e('0x2d')];_0x42940b[_0x6a6e('0x36')]=qs['sort'](_0x1f8881[_0x6a6e('0x2e')][_0x6a6e('0x4b')]);_0x42940b[_0x6a6e('0x39')]=qs[_0x6a6e('0x2f')](_[_0x6a6e('0x37')](_0x1f8881[_0x6a6e('0x2e')],_0x1be2db[_0x6a6e('0x2f')]));if(_0x1f8881['query'][_0x6a6e('0x38')]){_0x42940b[_0x6a6e('0x39')]=_[_0x6a6e('0x3a')](_0x42940b[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x42940b[_0x6a6e('0x32')],function(_0x1013cc){var _0x486bda={};_0x486bda[_0x1013cc]={'$like':'%'+_0x1f8881[_0x6a6e('0x2e')][_0x6a6e('0x38')]+'%'};return _0x486bda;})});}_0x42940b=_['merge']({},_0x42940b,_0x1f8881[_0x6a6e('0x3c')]);return _0x5995b4[_0x6a6e('0x48')](_0x42940b);}})[_0x6a6e('0x21')](function(_0x32ce7d){if(_0x32ce7d){_0x507403=_0x32ce7d[_0x6a6e('0x33')];if(!_0x1f8881[_0x6a6e('0x2e')]['hasOwnProperty'](_0x6a6e('0x34'))){_0x42940b[_0x6a6e('0x35')]=qs[_0x6a6e('0x35')](_0x1f8881[_0x6a6e('0x2e')][_0x6a6e('0x35')]);_0x42940b[_0x6a6e('0x19')]=qs[_0x6a6e('0x19')](_0x1f8881[_0x6a6e('0x2e')][_0x6a6e('0x19')]);}return _0x5995b4['getFields'](_0x42940b);}})[_0x6a6e('0x21')](function(_0x4be44a){if(_0x4be44a){return _0x4be44a?{'count':_0x507403,'rows':_0x4be44a}:null;}})[_0x6a6e('0x21')](respondWithResult(_0xbbd037,null))[_0x6a6e('0x45')](handleError(_0xbbd037,null));};exports[_0x6a6e('0x4c')]=function(_0x807474,_0x3dd9e1,_0x243ef0){var _0x5b18dc={};var _0x3c4c5f={};var _0x337a49;var _0x5b45b4;return db[_0x6a6e('0x3f')][_0x6a6e('0x49')]({'where':{'id':_0x807474['params']['id']}})['then'](handleEntityNotFound(_0x3dd9e1,null))[_0x6a6e('0x21')](function(_0x52dd39){if(_0x52dd39){_0x337a49=_0x52dd39;_0x3c4c5f['model']=_[_0x6a6e('0x43')](db[_0x6a6e('0x4a')]['rawAttributes']);_0x3c4c5f[_0x6a6e('0x2e')]=_[_0x6a6e('0x43')](_0x807474[_0x6a6e('0x2e')]);_0x3c4c5f[_0x6a6e('0x2f')]=_[_0x6a6e('0x30')](_0x3c4c5f[_0x6a6e('0x2d')],_0x3c4c5f[_0x6a6e('0x2e')]);_0x5b18dc[_0x6a6e('0x32')]=_[_0x6a6e('0x30')](_0x3c4c5f[_0x6a6e('0x2d')],qs['fields'](_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x31')]));_0x5b18dc['attributes']=_0x5b18dc['attributes'][_0x6a6e('0x33')]?_0x5b18dc[_0x6a6e('0x32')]:_0x3c4c5f[_0x6a6e('0x2d')];_0x5b18dc[_0x6a6e('0x36')]=qs[_0x6a6e('0x4b')](_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x4b')]);_0x5b18dc[_0x6a6e('0x39')]=qs[_0x6a6e('0x2f')](_[_0x6a6e('0x37')](_0x807474['query'],_0x3c4c5f[_0x6a6e('0x2f')]));if(_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x38')]){_0x5b18dc[_0x6a6e('0x39')]=_[_0x6a6e('0x3a')](_0x5b18dc[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x5b18dc['attributes'],function(_0x382431){var _0x7c9da1={};_0x7c9da1[_0x382431]={'$like':'%'+_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x38')]+'%'};return _0x7c9da1;})});}_0x5b18dc=_[_0x6a6e('0x3a')]({},_0x5b18dc,_0x807474['options']);return _0x337a49[_0x6a6e('0x4c')](_0x5b18dc);}})[_0x6a6e('0x21')](function(_0xa8fb27){if(_0xa8fb27){_0x5b45b4=_0xa8fb27[_0x6a6e('0x33')];if(!_0x807474[_0x6a6e('0x2e')]['hasOwnProperty'](_0x6a6e('0x34'))){_0x5b18dc[_0x6a6e('0x35')]=qs['limit'](_0x807474[_0x6a6e('0x2e')][_0x6a6e('0x35')]);_0x5b18dc[_0x6a6e('0x19')]=qs[_0x6a6e('0x19')](_0x807474['query']['offset']);}return _0x337a49[_0x6a6e('0x4c')](_0x5b18dc);}})[_0x6a6e('0x21')](function(_0x8fcc78){if(_0x8fcc78){return _0x8fcc78?{'count':_0x5b45b4,'rows':_0x8fcc78}:null;}})[_0x6a6e('0x21')](respondWithResult(_0x3dd9e1,null))[_0x6a6e('0x45')](handleError(_0x3dd9e1,null));};exports[_0x6a6e('0x4d')]=function(_0x260d1c,_0x334775,_0x4aedad){var _0x29b791={};var _0x2d1222={};var _0x3058fd;var _0x540f86;return db[_0x6a6e('0x3f')]['findOne']({'where':{'id':_0x260d1c[_0x6a6e('0x42')]['id']}})['then'](handleEntityNotFound(_0x334775,null))[_0x6a6e('0x21')](function(_0x4f0f28){if(_0x4f0f28){_0x3058fd=_0x4f0f28;_0x2d1222['model']=_[_0x6a6e('0x43')](db[_0x6a6e('0x4a')]['rawAttributes']);_0x2d1222[_0x6a6e('0x2e')]=_[_0x6a6e('0x43')](_0x260d1c[_0x6a6e('0x2e')]);_0x2d1222[_0x6a6e('0x2f')]=_[_0x6a6e('0x30')](_0x2d1222[_0x6a6e('0x2d')],_0x2d1222[_0x6a6e('0x2e')]);_0x29b791['attributes']=_['intersection'](_0x2d1222[_0x6a6e('0x2d')],qs[_0x6a6e('0x31')](_0x260d1c[_0x6a6e('0x2e')][_0x6a6e('0x31')]));_0x29b791[_0x6a6e('0x32')]=_0x29b791[_0x6a6e('0x32')][_0x6a6e('0x33')]?_0x29b791[_0x6a6e('0x32')]:_0x2d1222['model'];_0x29b791[_0x6a6e('0x36')]=qs[_0x6a6e('0x4b')](_0x260d1c[_0x6a6e('0x2e')][_0x6a6e('0x4b')]);_0x29b791[_0x6a6e('0x39')]=qs['filters'](_['pick'](_0x260d1c[_0x6a6e('0x2e')],_0x2d1222[_0x6a6e('0x2f')]));if(_0x260d1c[_0x6a6e('0x2e')][_0x6a6e('0x38')]){_0x29b791[_0x6a6e('0x39')]=_['merge'](_0x29b791[_0x6a6e('0x39')],{'$or':_[_0x6a6e('0x28')](_0x29b791['attributes'],function(_0x8462d1){var _0x1650a0={};_0x1650a0[_0x8462d1]={'$like':'%'+_0x260d1c['query'][_0x6a6e('0x38')]+'%'};return _0x1650a0;})});}_0x29b791=_['merge']({},_0x29b791,_0x260d1c[_0x6a6e('0x3c')]);return _0x3058fd[_0x6a6e('0x4d')](_0x29b791);}})[_0x6a6e('0x21')](function(_0x41924b){if(_0x41924b){_0x540f86=_0x41924b[_0x6a6e('0x33')];if(!_0x260d1c[_0x6a6e('0x2e')]['hasOwnProperty'](_0x6a6e('0x34'))){_0x29b791[_0x6a6e('0x35')]=qs[_0x6a6e('0x35')](_0x260d1c[_0x6a6e('0x2e')][_0x6a6e('0x35')]);_0x29b791[_0x6a6e('0x19')]=qs['offset'](_0x260d1c[_0x6a6e('0x2e')]['offset']);}return _0x3058fd[_0x6a6e('0x4d')](_0x29b791);}})[_0x6a6e('0x21')](function(_0x1a74a0){if(_0x1a74a0){return _0x1a74a0?{'count':_0x540f86,'rows':_0x1a74a0}:null;}})[_0x6a6e('0x21')](respondWithResult(_0x334775,null))['catch'](handleError(_0x334775,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 887a5a7..8099068 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 _0x14a1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','util','../../config/logger'];(function(_0x543719,_0xea44b8){var _0x38bb38=function(_0x3b494a){while(--_0x3b494a){_0x543719['push'](_0x543719['shift']());}};_0x38bb38(++_0xea44b8);}(_0x14a1,0x11e));var _0x114a=function(_0x36446e,_0x1518cd){_0x36446e=_0x36446e-0x0;var _0x1d2a6d=_0x14a1[_0x36446e];return _0x1d2a6d;};'use strict';var _=require('lodash');var util=require(_0x114a('0x0'));var logger=require(_0x114a('0x1'))('api');var moment=require(_0x114a('0x2'));var BPromise=require(_0x114a('0x3'));var rp=require(_0x114a('0x4'));var fs=require('fs');var path=require(_0x114a('0x5'));var rimraf=require(_0x114a('0x6'));var config=require(_0x114a('0x7'));var attributes=require(_0x114a('0x8'));module[_0x114a('0x9')]=function(_0x2f2c66,_0xd624d8){return _0x2f2c66[_0x114a('0xa')](_0x114a('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda0d=['bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','util','moment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xda0d,0xfe));var _0xdda0=function(_0x215d85,_0x2cf379){_0x215d85=_0x215d85-0x0;var _0x1d8783=_0xda0d[_0x215d85];return _0x1d8783;};'use strict';var _=require('lodash');var util=require(_0xdda0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdda0('0x1'));var BPromise=require(_0xdda0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdda0('0x3'));var rimraf=require(_0xdda0('0x4'));var config=require(_0xdda0('0x5'));var attributes=require(_0xdda0('0x6'));module[_0xdda0('0x7')]=function(_0x23a30d,_0x4879ba){return _0x23a30d['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','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 97fd3b9..c06017e 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 _0x1e82=['error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5b95f2,_0x2adb49){var _0x376b33=function(_0x57c21b){while(--_0x57c21b){_0x5b95f2['push'](_0x5b95f2['shift']());}};_0x376b33(++_0x2adb49);}(_0x1e82,0x91));var _0x21e8=function(_0xa48793,_0x3ed0e1){_0xa48793=_0xa48793-0x0;var _0x3f57b2=_0x1e82[_0xa48793];return _0x3f57b2;};'use strict';var _=require(_0x21e8('0x0'));var util=require('util');var moment=require(_0x21e8('0x1'));var BPromise=require(_0x21e8('0x2'));var rs=require(_0x21e8('0x3'));var fs=require('fs');var Redis=require(_0x21e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x21e8('0x5'));var logger=require(_0x21e8('0x6'))(_0x21e8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x21e8('0x8')][_0x21e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52c83b,_0x2d5a92,_0xcd1a91){return new BPromise(function(_0x3b41be,_0x14a483){return client[_0x21e8('0xa')](_0x52c83b,_0xcd1a91)[_0x21e8('0xb')](function(_0x4413eb){logger[_0x21e8('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x2d5a92,_0x21e8('0xd'));logger['debug'](_0x21e8('0xe'),_0x2d5a92,_0x21e8('0xd'),JSON['stringify'](_0x4413eb));if(_0x4413eb[_0x21e8('0xf')]){if(_0x4413eb[_0x21e8('0xf')][_0x21e8('0x10')]===0x1f4){logger['error'](_0x21e8('0x11'),_0x2d5a92,_0x4413eb[_0x21e8('0xf')]['message']);return _0x14a483(_0x4413eb[_0x21e8('0xf')]['message']);}logger[_0x21e8('0xf')](_0x21e8('0x11'),_0x2d5a92,_0x4413eb[_0x21e8('0xf')][_0x21e8('0x12')]);return _0x3b41be(_0x4413eb[_0x21e8('0xf')][_0x21e8('0x12')]);}else{logger[_0x21e8('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x2d5a92,'request\x20sent');_0x3b41be(_0x4413eb['result']['message']);}})[_0x21e8('0x13')](function(_0x2c3fdd){logger[_0x21e8('0xf')](_0x21e8('0x11'),_0x2d5a92,_0x2c3fdd);_0x14a483(_0x2c3fdd);});});} \ No newline at end of file +var _0xb410=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb410,0x1ca));var _0x0b41=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb410[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x0b41('0x0'));var util=require(_0x0b41('0x1'));var moment=require(_0x0b41('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b41('0x3'));var fs=require('fs');var Redis=require(_0x0b41('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b41('0x5'));var logger=require(_0x0b41('0x6'))(_0x0b41('0x7'));var config=require(_0x0b41('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0b41('0x9')][_0x0b41('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2337ba,_0x4d0591,_0x3c740d){return new BPromise(function(_0x4bb21a,_0x5bc144){return client[_0x0b41('0xb')](_0x2337ba,_0x3c740d)[_0x0b41('0xc')](function(_0x2b83f7){logger[_0x0b41('0xd')](_0x0b41('0xe'),_0x4d0591,_0x0b41('0xf'));logger[_0x0b41('0x10')](_0x0b41('0x11'),_0x4d0591,_0x0b41('0xf'),JSON[_0x0b41('0x12')](_0x2b83f7));if(_0x2b83f7[_0x0b41('0x13')]){if(_0x2b83f7['error'][_0x0b41('0x14')]===0x1f4){logger[_0x0b41('0x13')](_0x0b41('0xe'),_0x4d0591,_0x2b83f7[_0x0b41('0x13')]['message']);return _0x5bc144(_0x2b83f7['error'][_0x0b41('0x15')]);}logger['error'](_0x0b41('0xe'),_0x4d0591,_0x2b83f7['error'][_0x0b41('0x15')]);return _0x4bb21a(_0x2b83f7[_0x0b41('0x13')][_0x0b41('0x15')]);}else{logger[_0x0b41('0xd')](_0x0b41('0xe'),_0x4d0591,_0x0b41('0xf'));_0x4bb21a(_0x2b83f7['result'][_0x0b41('0x15')]);}})[_0x0b41('0x16')](function(_0x2017b9){logger[_0x0b41('0x13')](_0x0b41('0xe'),_0x4d0591,_0x2017b9);_0x5bc144(_0x2017b9);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index dba895e..eb00cd4 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 _0x1657=['./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','exports','multer','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x2bf6a0,_0x348ef2){var _0x3563db=function(_0x314d12){while(--_0x314d12){_0x2bf6a0['push'](_0x2bf6a0['shift']());}};_0x3563db(++_0x348ef2);}(_0x1657,0x19b));var _0x7165=function(_0x360988,_0x2b5d69){_0x360988=_0x360988-0x0;var _0x587f7d=_0x1657[_0x360988];return _0x587f7d;};'use strict';var multer=require(_0x7165('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7165('0x1'));var express=require(_0x7165('0x2'));var router=express['Router']();var fs_extra=require(_0x7165('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7165('0x4'));var controller=require(_0x7165('0x5'));router['get']('/',auth[_0x7165('0x6')](),controller[_0x7165('0x7')]);router[_0x7165('0x8')](_0x7165('0x9'),auth[_0x7165('0x6')](),controller[_0x7165('0xa')]);router[_0x7165('0xb')]('/',auth[_0x7165('0x6')](),controller[_0x7165('0xc')]);router[_0x7165('0xd')](_0x7165('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x7165('0xe')](_0x7165('0x9'),auth[_0x7165('0x6')](),controller['destroy']);module[_0x7165('0xf')]=router; \ No newline at end of file +var _0x6f1c=['/:id','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post'];(function(_0x5ea151,_0x5a0510){var _0x1ff0d6=function(_0x231b9c){while(--_0x231b9c){_0x5ea151['push'](_0x5ea151['shift']());}};_0x1ff0d6(++_0x5a0510);}(_0x6f1c,0x8c));var _0xc6f1=function(_0x3978f4,_0x2afaec){_0x3978f4=_0x3978f4-0x0;var _0x554e5c=_0x6f1c[_0x3978f4];return _0x554e5c;};'use strict';var multer=require(_0xc6f1('0x0'));var util=require(_0xc6f1('0x1'));var path=require(_0xc6f1('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6f1('0x3'));var router=express['Router']();var fs_extra=require(_0xc6f1('0x4'));var auth=require(_0xc6f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6f1('0x6'));var controller=require(_0xc6f1('0x7'));router[_0xc6f1('0x8')]('/',auth[_0xc6f1('0x9')](),controller[_0xc6f1('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc6f1('0xb')]);router[_0xc6f1('0xc')]('/',auth[_0xc6f1('0x9')](),controller['create']);router['put'](_0xc6f1('0xd'),auth[_0xc6f1('0x9')](),controller[_0xc6f1('0xe')]);router['delete'](_0xc6f1('0xd'),auth[_0xc6f1('0x9')](),controller[_0xc6f1('0xf')]);module[_0xc6f1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 79364ac..61e89ae 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 _0x6cd6=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x2966c3,_0x3201c8){var _0x5e4e92=function(_0x8a587a){while(--_0x8a587a){_0x2966c3['push'](_0x2966c3['shift']());}};_0x5e4e92(++_0x3201c8);}(_0x6cd6,0x7c));var _0x66cd=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x6cd6[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x66cd('0x0'));module[_0x66cd('0x1')]={'type':{'type':Sequelize[_0x66cd('0x2')](_0x66cd('0x3'),_0x66cd('0x4'),_0x66cd('0x5'),'keyValue',_0x66cd('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x66cd('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x66cd('0x2')](_0x66cd('0x3'),_0x66cd('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x66cd('0x7')]},'nameField':{'type':Sequelize[_0x66cd('0x7')]},'customField':{'type':Sequelize[_0x66cd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x66cd('0x7')]}}; \ No newline at end of file +var _0xd005=['BOOLEAN','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable'];(function(_0x4c2f8d,_0x55bc33){var _0x16c437=function(_0x36b9f6){while(--_0x36b9f6){_0x4c2f8d['push'](_0x4c2f8d['shift']());}};_0x16c437(++_0x55bc33);}(_0xd005,0x19f));var _0x5d00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd005[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x5d00('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5d00('0x1'),'variable',_0x5d00('0x2'),_0x5d00('0x3'),_0x5d00('0x4')),'defaultValue':_0x5d00('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5d00('0x5')]},'keyType':{'type':Sequelize[_0x5d00('0x6')]('string',_0x5d00('0x7'),_0x5d00('0x2'))},'keyContent':{'type':Sequelize[_0x5d00('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5d00('0x5')]},'customField':{'type':Sequelize[_0x5d00('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5d00('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index dbeb888..ff1b80e 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 _0x5241=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x267d42,_0x14e056){var _0x231808=function(_0x35e449){while(--_0x35e449){_0x267d42['push'](_0x267d42['shift']());}};_0x231808(++_0x14e056);}(_0x5241,0x15a));var _0x1524=function(_0xe2fa14,_0x7d37ba){_0xe2fa14=_0xe2fa14-0x0;var _0x4a5502=_0x5241[_0xe2fa14];return _0x4a5502;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1524('0x0'));var zipdir=require(_0x1524('0x1'));var jsonpatch=require(_0x1524('0x2'));var rp=require('request-promise');var moment=require(_0x1524('0x3'));var BPromise=require(_0x1524('0x4'));var Mustache=require(_0x1524('0x5'));var util=require(_0x1524('0x6'));var path=require('path');var sox=require(_0x1524('0x7'));var csv=require('to-csv');var ejs=require(_0x1524('0x8'));var fs=require('fs');var fs_extra=require(_0x1524('0x9'));var _=require('lodash');var squel=require(_0x1524('0xa'));var crypto=require(_0x1524('0xb'));var jsforce=require(_0x1524('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1524('0xd'));var querystring=require(_0x1524('0xe'));var Papa=require(_0x1524('0xf'));var Redis=require(_0x1524('0x10'));var authService=require(_0x1524('0x11'));var qs=require(_0x1524('0x12'));var as=require(_0x1524('0x13'));var hardwareService=require(_0x1524('0x14'));var logger=require(_0x1524('0x15'))('api');var utils=require(_0x1524('0x16'));var config=require(_0x1524('0x17'));var licenseUtil=require(_0x1524('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f9572,_0x3061dd){_0x3061dd=_0x3061dd||0xcc;return function(_0x226fc8){if(_0x226fc8){return _0x3f9572['sendStatus'](_0x3061dd);}return _0x3f9572[_0x1524('0x19')](_0x3061dd)[_0x1524('0x1a')]();};}function respondWithResult(_0x2e06bb,_0x5dfbcd){_0x5dfbcd=_0x5dfbcd||0xc8;return function(_0x1a56fd){if(_0x1a56fd){return _0x2e06bb[_0x1524('0x19')](_0x5dfbcd)[_0x1524('0x1b')](_0x1a56fd);}};}function respondWithFilteredResult(_0x484fdc,_0x2e15b3){return function(_0x4fd215){if(_0x4fd215){var _0x448a7c=typeof _0x2e15b3['offset']===_0x1524('0x1c')&&typeof _0x2e15b3[_0x1524('0x1d')]===_0x1524('0x1c');var _0x54164=_0x4fd215['count'];var _0x272a72=_0x448a7c?0x0:_0x2e15b3['offset'];var _0x5d9f5b=_0x448a7c?_0x4fd215[_0x1524('0x1e')]:_0x2e15b3[_0x1524('0x1f')]+_0x2e15b3[_0x1524('0x1d')];var _0x24d38a;if(_0x5d9f5b>=_0x54164){_0x5d9f5b=_0x54164;_0x24d38a=0xc8;}else{_0x24d38a=0xce;}_0x484fdc['status'](_0x24d38a);return _0x484fdc[_0x1524('0x20')](_0x1524('0x21'),_0x272a72+'-'+_0x5d9f5b+'/'+_0x54164)['json'](_0x4fd215);}return null;};}function patchUpdates(_0xee1b32){return function(_0x33af31){try{jsonpatch[_0x1524('0x22')](_0x33af31,_0xee1b32,!![]);}catch(_0x4559d4){return BPromise['reject'](_0x4559d4);}return _0x33af31[_0x1524('0x23')]();};}function saveUpdates(_0x3d9a42,_0x3c6cc9){return function(_0x512e2d){if(_0x512e2d){return _0x512e2d[_0x1524('0x24')](_0x3d9a42)['then'](function(_0x5af861){return _0x5af861;});}return null;};}function removeEntity(_0x1ac535,_0x5b7874){return function(_0x37cb87){if(_0x37cb87){return _0x37cb87[_0x1524('0x25')]()[_0x1524('0x26')](function(){_0x1ac535[_0x1524('0x19')](0xcc)[_0x1524('0x1a')]();});}};}function handleEntityNotFound(_0x42703a,_0x1505ae){return function(_0x14bbd5){if(!_0x14bbd5){_0x42703a['sendStatus'](0x194);}return _0x14bbd5;};}function handleError(_0x158adf,_0x3e3d82){_0x3e3d82=_0x3e3d82||0x1f4;return function(_0x31cfe0){logger[_0x1524('0x27')](_0x31cfe0[_0x1524('0x28')]);if(_0x31cfe0[_0x1524('0x29')]){delete _0x31cfe0[_0x1524('0x29')];}_0x158adf[_0x1524('0x19')](_0x3e3d82)[_0x1524('0x2a')](_0x31cfe0);};}exports['index']=function(_0xe9b97d,_0x4760b9){var _0x8fe8a={},_0x5fc4ad={},_0x51a0db={'count':0x0,'rows':[]};var _0x4b6b83=_[_0x1524('0x2b')](db[_0x1524('0x2c')][_0x1524('0x2d')],function(_0x5ac0ef){return{'name':_0x5ac0ef[_0x1524('0x2e')],'type':_0x5ac0ef[_0x1524('0x2f')][_0x1524('0x30')]};});_0x5fc4ad['model']=_[_0x1524('0x2b')](_0x4b6b83,_0x1524('0x29'));_0x5fc4ad['query']=_['keys'](_0xe9b97d[_0x1524('0x31')]);_0x5fc4ad[_0x1524('0x32')]=_[_0x1524('0x33')](_0x5fc4ad[_0x1524('0x34')],_0x5fc4ad[_0x1524('0x31')]);_0x8fe8a['attributes']=_[_0x1524('0x33')](_0x5fc4ad[_0x1524('0x34')],qs[_0x1524('0x35')](_0xe9b97d[_0x1524('0x31')][_0x1524('0x35')]));_0x8fe8a['attributes']=_0x8fe8a[_0x1524('0x36')][_0x1524('0x37')]?_0x8fe8a[_0x1524('0x36')]:_0x5fc4ad[_0x1524('0x34')];if(!_0xe9b97d[_0x1524('0x31')]['hasOwnProperty'](_0x1524('0x38'))){_0x8fe8a[_0x1524('0x1d')]=qs[_0x1524('0x1d')](_0xe9b97d[_0x1524('0x31')]['limit']);_0x8fe8a[_0x1524('0x1f')]=qs[_0x1524('0x1f')](_0xe9b97d[_0x1524('0x31')][_0x1524('0x1f')]);}_0x8fe8a['order']=qs[_0x1524('0x39')](_0xe9b97d['query'][_0x1524('0x39')]);_0x8fe8a[_0x1524('0x3a')]=qs['filters'](_['pick'](_0xe9b97d['query'],_0x5fc4ad['filters']),_0x4b6b83);if(_0xe9b97d['query'][_0x1524('0x3b')]){_0x8fe8a[_0x1524('0x3a')]=_[_0x1524('0x3c')](_0x8fe8a[_0x1524('0x3a')],{'$or':_[_0x1524('0x2b')](_0x4b6b83,function(_0x21a6db){if(_0x21a6db[_0x1524('0x2f')]!==_0x1524('0x3d')){var _0x48238f={};_0x48238f[_0x21a6db['name']]={'$like':'%'+_0xe9b97d[_0x1524('0x31')]['filter']+'%'};return _0x48238f;}})});}_0x8fe8a=_[_0x1524('0x3c')]({},_0x8fe8a,_0xe9b97d['options']);var _0x10d3a4={'where':_0x8fe8a[_0x1524('0x3a')]};return db[_0x1524('0x2c')][_0x1524('0x1e')](_0x10d3a4)['then'](function(_0x5421b3){_0x51a0db[_0x1524('0x1e')]=_0x5421b3;if(_0xe9b97d[_0x1524('0x31')][_0x1524('0x3e')]){_0x8fe8a[_0x1524('0x3f')]=[{'all':!![]}];}return db[_0x1524('0x2c')][_0x1524('0x40')](_0x8fe8a);})[_0x1524('0x26')](function(_0x5ecfeb){_0x51a0db[_0x1524('0x41')]=_0x5ecfeb;return _0x51a0db;})['then'](respondWithFilteredResult(_0x4760b9,_0x8fe8a))[_0x1524('0x42')](handleError(_0x4760b9,null));};exports[_0x1524('0x43')]=function(_0x3fdc59,_0x51b946){var _0x2d009a={'raw':!![],'where':{'id':_0x3fdc59[_0x1524('0x44')]['id']}},_0x886cf0={};_0x886cf0[_0x1524('0x34')]=_['keys'](db['VtigerField'][_0x1524('0x2d')]);_0x886cf0['query']=_[_0x1524('0x45')](_0x3fdc59[_0x1524('0x31')]);_0x886cf0[_0x1524('0x32')]=_[_0x1524('0x33')](_0x886cf0[_0x1524('0x34')],_0x886cf0[_0x1524('0x31')]);_0x2d009a[_0x1524('0x36')]=_[_0x1524('0x33')](_0x886cf0[_0x1524('0x34')],qs[_0x1524('0x35')](_0x3fdc59[_0x1524('0x31')]['fields']));_0x2d009a[_0x1524('0x36')]=_0x2d009a[_0x1524('0x36')]['length']?_0x2d009a[_0x1524('0x36')]:_0x886cf0['model'];if(_0x3fdc59['query'][_0x1524('0x3e')]){_0x2d009a[_0x1524('0x3f')]=[{'all':!![]}];}_0x2d009a=_[_0x1524('0x3c')]({},_0x2d009a,_0x3fdc59['options']);return db['VtigerField'][_0x1524('0x46')](_0x2d009a)[_0x1524('0x26')](handleEntityNotFound(_0x51b946,null))[_0x1524('0x26')](respondWithResult(_0x51b946,null))[_0x1524('0x42')](handleError(_0x51b946,null));};exports['create']=function(_0x4d694d,_0x16cff9){return db[_0x1524('0x2c')][_0x1524('0x47')](_0x4d694d[_0x1524('0x48')],{})[_0x1524('0x26')](respondWithResult(_0x16cff9,0xc9))[_0x1524('0x42')](handleError(_0x16cff9,null));};exports['update']=function(_0xb9e6cf,_0x48fc53){if(_0xb9e6cf[_0x1524('0x48')]['id']){delete _0xb9e6cf['body']['id'];}return db[_0x1524('0x2c')][_0x1524('0x46')]({'where':{'id':_0xb9e6cf[_0x1524('0x44')]['id']}})['then'](handleEntityNotFound(_0x48fc53,null))[_0x1524('0x26')](saveUpdates(_0xb9e6cf[_0x1524('0x48')],null))['then'](respondWithResult(_0x48fc53,null))[_0x1524('0x42')](handleError(_0x48fc53,null));};exports[_0x1524('0x25')]=function(_0x51a86e,_0xf2d051){return db[_0x1524('0x2c')][_0x1524('0x46')]({'where':{'id':_0x51a86e['params']['id']}})[_0x1524('0x26')](handleEntityNotFound(_0xf2d051,null))[_0x1524('0x26')](removeEntity(_0xf2d051,null))[_0x1524('0x42')](handleError(_0xf2d051,null));}; \ No newline at end of file +var _0x190d=['rawAttributes','fieldName','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','count','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','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','end','offset','undefined','limit','status','set','json','apply','save','then','destroy','error','stack','name','send','index','VtigerField'];(function(_0x1d3db5,_0x3fa1d6){var _0x3123fe=function(_0x1f6c8b){while(--_0x1f6c8b){_0x1d3db5['push'](_0x1d3db5['shift']());}};_0x3123fe(++_0x3fa1d6);}(_0x190d,0x13b));var _0xd190=function(_0x40e197,_0x229884){_0x40e197=_0x40e197-0x0;var _0x1c76bd=_0x190d[_0x40e197];return _0x1c76bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd190('0x0'));var rp=require(_0xd190('0x1'));var moment=require(_0xd190('0x2'));var BPromise=require(_0xd190('0x3'));var Mustache=require('mustache');var util=require(_0xd190('0x4'));var path=require(_0xd190('0x5'));var sox=require('sox');var csv=require(_0xd190('0x6'));var ejs=require(_0xd190('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd190('0x8'));var squel=require(_0xd190('0x9'));var crypto=require(_0xd190('0xa'));var jsforce=require(_0xd190('0xb'));var deskjs=require(_0xd190('0xc'));var toCsv=require(_0xd190('0x6'));var querystring=require('querystring');var Papa=require(_0xd190('0xd'));var Redis=require('ioredis');var authService=require(_0xd190('0xe'));var qs=require(_0xd190('0xf'));var as=require(_0xd190('0x10'));var hardwareService=require(_0xd190('0x11'));var logger=require(_0xd190('0x12'))(_0xd190('0x13'));var utils=require(_0xd190('0x14'));var config=require(_0xd190('0x15'));var licenseUtil=require(_0xd190('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b53a3,_0x3417c6){_0x3417c6=_0x3417c6||0xcc;return function(_0x4c79d9){if(_0x4c79d9){return _0x2b53a3['sendStatus'](_0x3417c6);}return _0x2b53a3['status'](_0x3417c6)[_0xd190('0x17')]();};}function respondWithResult(_0xd7710a,_0x1eff98){_0x1eff98=_0x1eff98||0xc8;return function(_0x5cdfa3){if(_0x5cdfa3){return _0xd7710a['status'](_0x1eff98)['json'](_0x5cdfa3);}};}function respondWithFilteredResult(_0x5763b1,_0x3a4388){return function(_0x14e9d5){if(_0x14e9d5){var _0x1b3f5d=typeof _0x3a4388[_0xd190('0x18')]===_0xd190('0x19')&&typeof _0x3a4388[_0xd190('0x1a')]===_0xd190('0x19');var _0x16e235=_0x14e9d5['count'];var _0x5a28f3=_0x1b3f5d?0x0:_0x3a4388[_0xd190('0x18')];var _0x176d9c=_0x1b3f5d?_0x14e9d5['count']:_0x3a4388[_0xd190('0x18')]+_0x3a4388[_0xd190('0x1a')];var _0x57331f;if(_0x176d9c>=_0x16e235){_0x176d9c=_0x16e235;_0x57331f=0xc8;}else{_0x57331f=0xce;}_0x5763b1[_0xd190('0x1b')](_0x57331f);return _0x5763b1[_0xd190('0x1c')]('Content-Range',_0x5a28f3+'-'+_0x176d9c+'/'+_0x16e235)[_0xd190('0x1d')](_0x14e9d5);}return null;};}function patchUpdates(_0x474363){return function(_0x400c97){try{jsonpatch[_0xd190('0x1e')](_0x400c97,_0x474363,!![]);}catch(_0x27a378){return BPromise['reject'](_0x27a378);}return _0x400c97[_0xd190('0x1f')]();};}function saveUpdates(_0xb2ddd4,_0x36cf6f){return function(_0x2727d1){if(_0x2727d1){return _0x2727d1['update'](_0xb2ddd4)[_0xd190('0x20')](function(_0x5b2ffe){return _0x5b2ffe;});}return null;};}function removeEntity(_0x56b9b1,_0x3e0e1c){return function(_0x40bb0b){if(_0x40bb0b){return _0x40bb0b[_0xd190('0x21')]()['then'](function(){_0x56b9b1[_0xd190('0x1b')](0xcc)[_0xd190('0x17')]();});}};}function handleEntityNotFound(_0x12e21f,_0x247f60){return function(_0x3dee9e){if(!_0x3dee9e){_0x12e21f['sendStatus'](0x194);}return _0x3dee9e;};}function handleError(_0x38d36e,_0x3a2cf9){_0x3a2cf9=_0x3a2cf9||0x1f4;return function(_0x2b7b87){logger[_0xd190('0x22')](_0x2b7b87[_0xd190('0x23')]);if(_0x2b7b87[_0xd190('0x24')]){delete _0x2b7b87[_0xd190('0x24')];}_0x38d36e[_0xd190('0x1b')](_0x3a2cf9)[_0xd190('0x25')](_0x2b7b87);};}exports[_0xd190('0x26')]=function(_0x1ef06,_0x5d7b4c){var _0x3cb769={},_0x2f6e76={},_0x4059b2={'count':0x0,'rows':[]};var _0x198182=_['map'](db[_0xd190('0x27')][_0xd190('0x28')],function(_0x3791a8){return{'name':_0x3791a8[_0xd190('0x29')],'type':_0x3791a8['type']['key']};});_0x2f6e76['model']=_[_0xd190('0x2a')](_0x198182,_0xd190('0x24'));_0x2f6e76[_0xd190('0x2b')]=_[_0xd190('0x2c')](_0x1ef06[_0xd190('0x2b')]);_0x2f6e76[_0xd190('0x2d')]=_[_0xd190('0x2e')](_0x2f6e76['model'],_0x2f6e76[_0xd190('0x2b')]);_0x3cb769[_0xd190('0x2f')]=_[_0xd190('0x2e')](_0x2f6e76[_0xd190('0x30')],qs['fields'](_0x1ef06['query'][_0xd190('0x31')]));_0x3cb769['attributes']=_0x3cb769[_0xd190('0x2f')]['length']?_0x3cb769['attributes']:_0x2f6e76['model'];if(!_0x1ef06[_0xd190('0x2b')][_0xd190('0x32')](_0xd190('0x33'))){_0x3cb769[_0xd190('0x1a')]=qs[_0xd190('0x1a')](_0x1ef06[_0xd190('0x2b')][_0xd190('0x1a')]);_0x3cb769[_0xd190('0x18')]=qs['offset'](_0x1ef06[_0xd190('0x2b')][_0xd190('0x18')]);}_0x3cb769[_0xd190('0x34')]=qs['sort'](_0x1ef06[_0xd190('0x2b')][_0xd190('0x35')]);_0x3cb769['where']=qs['filters'](_['pick'](_0x1ef06[_0xd190('0x2b')],_0x2f6e76['filters']),_0x198182);if(_0x1ef06['query'][_0xd190('0x36')]){_0x3cb769[_0xd190('0x37')]=_[_0xd190('0x38')](_0x3cb769[_0xd190('0x37')],{'$or':_[_0xd190('0x2a')](_0x198182,function(_0x23cbec){if(_0x23cbec[_0xd190('0x39')]!=='VIRTUAL'){var _0x2068b4={};_0x2068b4[_0x23cbec[_0xd190('0x24')]]={'$like':'%'+_0x1ef06['query'][_0xd190('0x36')]+'%'};return _0x2068b4;}})});}_0x3cb769=_[_0xd190('0x38')]({},_0x3cb769,_0x1ef06['options']);var _0x24b653={'where':_0x3cb769[_0xd190('0x37')]};return db[_0xd190('0x27')][_0xd190('0x3a')](_0x24b653)[_0xd190('0x20')](function(_0xfbe7cf){_0x4059b2[_0xd190('0x3a')]=_0xfbe7cf;if(_0x1ef06[_0xd190('0x2b')][_0xd190('0x3b')]){_0x3cb769[_0xd190('0x3c')]=[{'all':!![]}];}return db[_0xd190('0x27')][_0xd190('0x3d')](_0x3cb769);})['then'](function(_0x428ccd){_0x4059b2[_0xd190('0x3e')]=_0x428ccd;return _0x4059b2;})[_0xd190('0x20')](respondWithFilteredResult(_0x5d7b4c,_0x3cb769))[_0xd190('0x3f')](handleError(_0x5d7b4c,null));};exports[_0xd190('0x40')]=function(_0x49eb94,_0x29570b){var _0x1f46be={'raw':!![],'where':{'id':_0x49eb94[_0xd190('0x41')]['id']}},_0x1bafde={};_0x1bafde['model']=_[_0xd190('0x2c')](db[_0xd190('0x27')][_0xd190('0x28')]);_0x1bafde[_0xd190('0x2b')]=_['keys'](_0x49eb94[_0xd190('0x2b')]);_0x1bafde[_0xd190('0x2d')]=_[_0xd190('0x2e')](_0x1bafde[_0xd190('0x30')],_0x1bafde[_0xd190('0x2b')]);_0x1f46be[_0xd190('0x2f')]=_['intersection'](_0x1bafde['model'],qs[_0xd190('0x31')](_0x49eb94['query'][_0xd190('0x31')]));_0x1f46be[_0xd190('0x2f')]=_0x1f46be[_0xd190('0x2f')][_0xd190('0x42')]?_0x1f46be[_0xd190('0x2f')]:_0x1bafde[_0xd190('0x30')];if(_0x49eb94[_0xd190('0x2b')][_0xd190('0x3b')]){_0x1f46be[_0xd190('0x3c')]=[{'all':!![]}];}_0x1f46be=_[_0xd190('0x38')]({},_0x1f46be,_0x49eb94[_0xd190('0x43')]);return db[_0xd190('0x27')]['find'](_0x1f46be)[_0xd190('0x20')](handleEntityNotFound(_0x29570b,null))[_0xd190('0x20')](respondWithResult(_0x29570b,null))['catch'](handleError(_0x29570b,null));};exports[_0xd190('0x44')]=function(_0x33b7c2,_0x2e50d7){return db[_0xd190('0x27')][_0xd190('0x44')](_0x33b7c2[_0xd190('0x45')],{})[_0xd190('0x20')](respondWithResult(_0x2e50d7,0xc9))['catch'](handleError(_0x2e50d7,null));};exports['update']=function(_0x3f450c,_0x3e1bc8){if(_0x3f450c[_0xd190('0x45')]['id']){delete _0x3f450c[_0xd190('0x45')]['id'];}return db['VtigerField'][_0xd190('0x46')]({'where':{'id':_0x3f450c[_0xd190('0x41')]['id']}})[_0xd190('0x20')](handleEntityNotFound(_0x3e1bc8,null))['then'](saveUpdates(_0x3f450c['body'],null))[_0xd190('0x20')](respondWithResult(_0x3e1bc8,null))['catch'](handleError(_0x3e1bc8,null));};exports[_0xd190('0x21')]=function(_0x3d931b,_0x141c50){return db[_0xd190('0x27')][_0xd190('0x46')]({'where':{'id':_0x3d931b[_0xd190('0x41')]['id']}})[_0xd190('0x20')](handleEntityNotFound(_0x141c50,null))['then'](removeEntity(_0x141c50,null))['catch'](handleError(_0x141c50,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c12fae8..b3a87d0 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 _0x02ea=['request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0x02ea,0x96));var _0xa02e=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x02ea[_0x1265ed];return _0x5ac459;};'use strict';var _=require(_0xa02e('0x0'));var util=require(_0xa02e('0x1'));var logger=require(_0xa02e('0x2'))(_0xa02e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa02e('0x4'));var fs=require('fs');var path=require(_0xa02e('0x5'));var rimraf=require(_0xa02e('0x6'));var config=require(_0xa02e('0x7'));var attributes=require('./intVtigerField.attributes');module[_0xa02e('0x8')]=function(_0x47a38d,_0x20cf82){return _0x47a38d[_0xa02e('0x9')](_0xa02e('0xa'),attributes,{'tableName':_0xa02e('0xb'),'paranoid':![],'indexes':[{'name':_0xa02e('0xc'),'fields':[_0xa02e('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50a6=['VtigerField','vtiger_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','define'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x50a6,0x1ca));var _0x650a=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0x50a6[_0x347399];return _0x24e7be;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var logger=require(_0x650a('0x2'))('api');var moment=require(_0x650a('0x3'));var BPromise=require(_0x650a('0x4'));var rp=require(_0x650a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x650a('0x6'));var config=require(_0x650a('0x7'));var attributes=require(_0x650a('0x8'));module['exports']=function(_0x313864,_0x12ee1d){return _0x313864[_0x650a('0x9')](_0x650a('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x650a('0xb'),'fields':['idField',_0x650a('0xc')],'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 751d34b..4a30669 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 _0xa948=['request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','info','VtigerField,\x20%s,\x20%s'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa948,0xa9));var _0x8a94=function(_0xf136bc,_0x4cb677){_0xf136bc=_0xf136bc-0x0;var _0x447aa6=_0xa948[_0xf136bc];return _0x447aa6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8a94('0x0'));var BPromise=require(_0x8a94('0x1'));var rs=require(_0x8a94('0x2'));var fs=require('fs');var Redis=require(_0x8a94('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8a94('0x4'))('rpc');var config=require(_0x8a94('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8a94('0x6')][_0x8a94('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15ec3b,_0x54f95b,_0x30607e){return new BPromise(function(_0x3c8652,_0x1d1a27){return client[_0x8a94('0x8')](_0x15ec3b,_0x30607e)['then'](function(_0x14f69e){logger[_0x8a94('0x9')](_0x8a94('0xa'),_0x54f95b,_0x8a94('0xb'));logger['debug'](_0x8a94('0xc'),_0x54f95b,_0x8a94('0xb'),JSON['stringify'](_0x14f69e));if(_0x14f69e[_0x8a94('0xd')]){if(_0x14f69e[_0x8a94('0xd')][_0x8a94('0xe')]===0x1f4){logger['error'](_0x8a94('0xa'),_0x54f95b,_0x14f69e[_0x8a94('0xd')][_0x8a94('0xf')]);return _0x1d1a27(_0x14f69e[_0x8a94('0xd')][_0x8a94('0xf')]);}logger[_0x8a94('0xd')](_0x8a94('0xa'),_0x54f95b,_0x14f69e[_0x8a94('0xd')][_0x8a94('0xf')]);return _0x3c8652(_0x14f69e[_0x8a94('0xd')]['message']);}else{logger['info'](_0x8a94('0xa'),_0x54f95b,_0x8a94('0xb'));_0x3c8652(_0x14f69e[_0x8a94('0x10')][_0x8a94('0xf')]);}})[_0x8a94('0x11')](function(_0x39b3e1){logger[_0x8a94('0xd')](_0x8a94('0xa'),_0x54f95b,_0x39b3e1);_0x1d1a27(_0x39b3e1);});});} \ No newline at end of file +var _0x7a79=['client','http','request','then','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a79,0x1dc));var _0x97a7=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x7a79[_0x3203a1];return _0x24215e;};'use strict';var _=require('lodash');var util=require(_0x97a7('0x0'));var moment=require(_0x97a7('0x1'));var BPromise=require(_0x97a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x97a7('0x4'));var logger=require(_0x97a7('0x5'))(_0x97a7('0x6'));var config=require('../../config/environment');var jayson=require(_0x97a7('0x7'));var client=jayson[_0x97a7('0x8')][_0x97a7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x307312,_0x5957d9,_0x3df97b){return new BPromise(function(_0x59d386,_0x387969){return client[_0x97a7('0xa')](_0x307312,_0x3df97b)[_0x97a7('0xb')](function(_0x403890){logger['info']('VtigerField,\x20%s,\x20%s',_0x5957d9,_0x97a7('0xc'));logger[_0x97a7('0xd')](_0x97a7('0xe'),_0x5957d9,_0x97a7('0xc'),JSON[_0x97a7('0xf')](_0x403890));if(_0x403890['error']){if(_0x403890[_0x97a7('0x10')][_0x97a7('0x11')]===0x1f4){logger[_0x97a7('0x10')](_0x97a7('0x12'),_0x5957d9,_0x403890[_0x97a7('0x10')][_0x97a7('0x13')]);return _0x387969(_0x403890['error']['message']);}logger[_0x97a7('0x10')](_0x97a7('0x12'),_0x5957d9,_0x403890['error']['message']);return _0x59d386(_0x403890[_0x97a7('0x10')][_0x97a7('0x13')]);}else{logger[_0x97a7('0x14')](_0x97a7('0x12'),_0x5957d9,_0x97a7('0xc'));_0x59d386(_0x403890[_0x97a7('0x15')][_0x97a7('0x13')]);}})['catch'](function(_0x132e6c){logger[_0x97a7('0x10')](_0x97a7('0x12'),_0x5957d9,_0x132e6c);_0x387969(_0x132e6c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ba2a6f2..31ceb35 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 _0xafb3=['/:id','/:id/configurations','getConfigurations','getFields','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0xcd59eb,_0x3d8db4){var _0x3f024e=function(_0x500c47){while(--_0x500c47){_0xcd59eb['push'](_0xcd59eb['shift']());}};_0x3f024e(++_0x3d8db4);}(_0xafb3,0x121));var _0x3afb=function(_0x451407,_0x21fad8){_0x451407=_0x451407-0x0;var _0x514d81=_0xafb3[_0x451407];return _0x514d81;};'use strict';var multer=require(_0x3afb('0x0'));var util=require(_0x3afb('0x1'));var path=require('path');var timeout=require(_0x3afb('0x2'));var express=require(_0x3afb('0x3'));var router=express[_0x3afb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3afb('0x5'));var interaction=require(_0x3afb('0x6'));var config=require(_0x3afb('0x7'));var controller=require(_0x3afb('0x8'));router[_0x3afb('0x9')]('/',auth[_0x3afb('0xa')](),controller['index']);router[_0x3afb('0x9')](_0x3afb('0xb'),auth[_0x3afb('0xa')](),controller['show']);router[_0x3afb('0x9')](_0x3afb('0xc'),auth[_0x3afb('0xa')](),controller[_0x3afb('0xd')]);router[_0x3afb('0x9')]('/:id/fields',auth[_0x3afb('0xa')](),controller[_0x3afb('0xe')]);router[_0x3afb('0xf')]('/',auth[_0x3afb('0xa')](),controller['create']);router[_0x3afb('0xf')](_0x3afb('0xc'),auth[_0x3afb('0xa')](),controller['addConfiguration']);router[_0x3afb('0x10')](_0x3afb('0xb'),auth[_0x3afb('0xa')](),controller[_0x3afb('0x11')]);router[_0x3afb('0x12')](_0x3afb('0xb'),auth[_0x3afb('0xa')](),controller[_0x3afb('0x13')]);module['exports']=router; \ No newline at end of file +var _0x84a2=['../../config/environment','./intZendeskAccount.controller','get','index','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','/:id','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x84a2,0x103));var _0x284a=function(_0x515cff,_0x27d4a5){_0x515cff=_0x515cff-0x0;var _0x419c0e=_0x84a2[_0x515cff];return _0x419c0e;};'use strict';var multer=require('multer');var util=require(_0x284a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x284a('0x1'));var router=express['Router']();var fs_extra=require(_0x284a('0x2'));var auth=require(_0x284a('0x3'));var interaction=require(_0x284a('0x4'));var config=require(_0x284a('0x5'));var controller=require(_0x284a('0x6'));router[_0x284a('0x7')]('/',auth['isAuthenticated'](),controller[_0x284a('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x284a('0x7')](_0x284a('0x9'),auth[_0x284a('0xa')](),controller[_0x284a('0xb')]);router['get'](_0x284a('0xc'),auth[_0x284a('0xa')](),controller[_0x284a('0xd')]);router[_0x284a('0xe')]('/',auth[_0x284a('0xa')](),controller[_0x284a('0xf')]);router[_0x284a('0xe')](_0x284a('0x9'),auth[_0x284a('0xa')](),controller[_0x284a('0x10')]);router['put']('/:id',auth[_0x284a('0xa')](),controller[_0x284a('0x11')]);router[_0x284a('0x12')](_0x284a('0x13'),auth['isAuthenticated'](),controller[_0x284a('0x14')]);module[_0x284a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 7ff978f..0464870 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 _0x5fab=['ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x2d65b2,_0x24b162){var _0x17f21e=function(_0x4e9e4d){while(--_0x4e9e4d){_0x2d65b2['push'](_0x2d65b2['shift']());}};_0x17f21e(++_0x24b162);}(_0x5fab,0x177));var _0xb5fa=function(_0x156e60,_0x18ef4b){_0x156e60=_0x156e60-0x0;var _0xe8a8e3=_0x5fab[_0x156e60];return _0xe8a8e3;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5fa('0x2')]},'username':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x3')},'password':{'type':Sequelize[_0xb5fa('0x2')]},'token':{'type':Sequelize[_0xb5fa('0x2')]},'remoteUri':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x4')},'authType':{'type':Sequelize[_0xb5fa('0x5')](_0xb5fa('0x6'),_0xb5fa('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x5')](_0xb5fa('0x8'),_0xb5fa('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x44ff=['password','integrationTab','newTab','exports','STRING','remoteUri','token'];(function(_0x57ca75,_0x4c03fd){var _0x551d12=function(_0x4b24a5){while(--_0x4b24a5){_0x57ca75['push'](_0x57ca75['shift']());}};_0x551d12(++_0x4c03fd);}(_0x44ff,0x1c3));var _0xf44f=function(_0x55805d,_0x3815b2){_0x55805d=_0x55805d-0x0;var _0x263d53=_0x44ff[_0x55805d];return _0x263d53;};'use strict';var Sequelize=require('sequelize');module[_0xf44f('0x0')]={'name':{'type':Sequelize[_0xf44f('0x1')]},'description':{'type':Sequelize[_0xf44f('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf44f('0x1')],'unique':_0xf44f('0x2')},'authType':{'type':Sequelize['ENUM']('password',_0xf44f('0x3')),'defaultValue':_0xf44f('0x4')},'serverUrl':{'type':Sequelize[_0xf44f('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf44f('0x5'),_0xf44f('0x6')),'defaultValue':_0xf44f('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index ac7fcab..a862eef 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 _0xe605=['password','token','authType','remoteUri','slice','GET','format','headers','Basic\x20%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','ZendeskAccount','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username'];(function(_0x4fa66c,_0x51f9a3){var _0x9b192b=function(_0x5a930f){while(--_0x5a930f){_0x4fa66c['push'](_0x4fa66c['shift']());}};_0x9b192b(++_0x51f9a3);}(_0xe605,0x92));var _0x5e60=function(_0x232829,_0x2c3bbb){_0x232829=_0x232829-0x0;var _0x4a4edd=_0xe605[_0x232829];return _0x4a4edd;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5e60('0x19'));function respondWithStatusCode(_0x178782,_0x1f4e14){_0x1f4e14=_0x1f4e14||0xcc;return function(_0xe039de){if(_0xe039de){return _0x178782[_0x5e60('0x1a')](_0x1f4e14);}return _0x178782[_0x5e60('0x1b')](_0x1f4e14)['end']();};}function respondWithResult(_0x209adb,_0x45304f){_0x45304f=_0x45304f||0xc8;return function(_0x21e3c8){if(_0x21e3c8){return _0x209adb[_0x5e60('0x1b')](_0x45304f)['json'](_0x21e3c8);}};}function respondWithFilteredResult(_0x20af5f,_0x529ffe){return function(_0x1ffd77){if(_0x1ffd77){var _0x3bc7d8=typeof _0x529ffe['offset']===_0x5e60('0x1c')&&typeof _0x529ffe[_0x5e60('0x1d')]===_0x5e60('0x1c');var _0x43045a=_0x1ffd77['count'];var _0xdd0a71=_0x3bc7d8?0x0:_0x529ffe[_0x5e60('0x1e')];var _0x52cc15=_0x3bc7d8?_0x1ffd77[_0x5e60('0x1f')]:_0x529ffe[_0x5e60('0x1e')]+_0x529ffe[_0x5e60('0x1d')];var _0x311fef;if(_0x52cc15>=_0x43045a){_0x52cc15=_0x43045a;_0x311fef=0xc8;}else{_0x311fef=0xce;}_0x20af5f[_0x5e60('0x1b')](_0x311fef);return _0x20af5f[_0x5e60('0x20')](_0x5e60('0x21'),_0xdd0a71+'-'+_0x52cc15+'/'+_0x43045a)[_0x5e60('0x22')](_0x1ffd77);}return null;};}function patchUpdates(_0x3282e4){return function(_0x45f1a6){try{jsonpatch[_0x5e60('0x23')](_0x45f1a6,_0x3282e4,!![]);}catch(_0x578437){return BPromise[_0x5e60('0x24')](_0x578437);}return _0x45f1a6['save']();};}function saveUpdates(_0x376069,_0x1a44e5){return function(_0x2b0bae){if(_0x2b0bae){return _0x2b0bae[_0x5e60('0x25')](_0x376069)[_0x5e60('0x26')](function(_0x2a499e){return _0x2a499e;});}return null;};}function removeEntity(_0x2636f1,_0x5d2c03){return function(_0x18d527){if(_0x18d527){return _0x18d527[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2636f1['status'](0xcc)[_0x5e60('0x28')]();});}};}function handleEntityNotFound(_0x56e3a5,_0x2d8aac){return function(_0x153459){if(!_0x153459){_0x56e3a5['sendStatus'](0x194);}return _0x153459;};}function handleError(_0x3bedea,_0x5712f7){_0x5712f7=_0x5712f7||0x1f4;return function(_0x23d187){logger[_0x5e60('0x29')](_0x23d187['stack']);if(_0x23d187[_0x5e60('0x2a')]){delete _0x23d187[_0x5e60('0x2a')];}_0x3bedea['status'](_0x5712f7)[_0x5e60('0x2b')](_0x23d187);};}exports[_0x5e60('0x2c')]=function(_0x52c97c,_0x5431a8){var _0x52f668={},_0xf25956={},_0x235cc7={'count':0x0,'rows':[]};var _0x2e8e9e=_[_0x5e60('0x2d')](db[_0x5e60('0x2e')]['rawAttributes'],function(_0x168ce6){return{'name':_0x168ce6[_0x5e60('0x2f')],'type':_0x168ce6['type'][_0x5e60('0x30')]};});_0xf25956['model']=_['map'](_0x2e8e9e,_0x5e60('0x2a'));_0xf25956[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x52c97c[_0x5e60('0x31')]);_0xf25956[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0xf25956[_0x5e60('0x35')],_0xf25956[_0x5e60('0x31')]);_0x52f668[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0xf25956['model'],qs[_0x5e60('0x37')](_0x52c97c['query']['fields']));_0x52f668[_0x5e60('0x36')]=_0x52f668[_0x5e60('0x36')]['length']?_0x52f668[_0x5e60('0x36')]:_0xf25956['model'];if(!_0x52c97c[_0x5e60('0x31')][_0x5e60('0x38')](_0x5e60('0x39'))){_0x52f668[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x52f668[_0x5e60('0x1e')]=qs['offset'](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1e')]);}_0x52f668[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x52f668[_0x5e60('0x3c')]=qs['filters'](_[_0x5e60('0x3d')](_0x52c97c[_0x5e60('0x31')],_0xf25956['filters']),_0x2e8e9e);if(_0x52c97c['query'][_0x5e60('0x3e')]){_0x52f668[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x52f668[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x2e8e9e,function(_0x4d2cd0){if(_0x4d2cd0[_0x5e60('0x40')]!==_0x5e60('0x41')){var _0x415208={};_0x415208[_0x4d2cd0[_0x5e60('0x2a')]]={'$like':'%'+_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3e')]+'%'};return _0x415208;}})});}_0x52f668=_[_0x5e60('0x3f')]({},_0x52f668,_0x52c97c['options']);var _0x401bf1={'where':_0x52f668[_0x5e60('0x3c')]};return db['ZendeskAccount']['count'](_0x401bf1)['then'](function(_0x15a97b){_0x235cc7[_0x5e60('0x1f')]=_0x15a97b;if(_0x52c97c[_0x5e60('0x31')][_0x5e60('0x42')]){_0x52f668['include']=[{'all':!![]}];}return db[_0x5e60('0x2e')][_0x5e60('0x43')](_0x52f668);})['then'](function(_0x5bda22){_0x235cc7[_0x5e60('0x44')]=_0x5bda22;return _0x235cc7;})[_0x5e60('0x26')](respondWithFilteredResult(_0x5431a8,_0x52f668))[_0x5e60('0x45')](handleError(_0x5431a8,null));};exports[_0x5e60('0x46')]=function(_0x39ab09,_0x3899ae){var _0x2522d2={'raw':![],'where':{'id':_0x39ab09[_0x5e60('0x47')]['id']}},_0x2812e1={};_0x2812e1['model']=_[_0x5e60('0x32')](db[_0x5e60('0x2e')]['rawAttributes']);_0x2812e1[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x39ab09[_0x5e60('0x31')]);_0x2812e1[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2812e1['model'],_0x2812e1[_0x5e60('0x31')]);_0x2522d2[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0x2812e1[_0x5e60('0x35')],qs['fields'](_0x39ab09['query']['fields']));_0x2522d2[_0x5e60('0x36')]=_0x2522d2[_0x5e60('0x36')][_0x5e60('0x48')]?_0x2522d2[_0x5e60('0x36')]:_0x2812e1[_0x5e60('0x35')];if(_0x39ab09[_0x5e60('0x31')]['includeAll']){_0x2522d2[_0x5e60('0x49')]=[{'all':!![]}];}_0x2522d2=_[_0x5e60('0x3f')]({},_0x2522d2,_0x39ab09[_0x5e60('0x4a')]);return db[_0x5e60('0x2e')][_0x5e60('0x4b')](_0x2522d2)[_0x5e60('0x26')](handleEntityNotFound(_0x3899ae,null))[_0x5e60('0x26')](respondWithResult(_0x3899ae,null))['catch'](handleError(_0x3899ae,null));};exports[_0x5e60('0x4c')]=function(_0x3ed45d,_0x21a116){return db[_0x5e60('0x2e')][_0x5e60('0x4c')](_0x3ed45d[_0x5e60('0x4d')],{})[_0x5e60('0x26')](respondWithResult(_0x21a116,0xc9))[_0x5e60('0x45')](handleError(_0x21a116,null));};exports[_0x5e60('0x25')]=function(_0x350d6d,_0xe5e675){if(_0x350d6d[_0x5e60('0x4d')]['id']){delete _0x350d6d[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x350d6d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0xe5e675,null))[_0x5e60('0x26')](saveUpdates(_0x350d6d['body'],null))['then'](respondWithResult(_0xe5e675,null))[_0x5e60('0x45')](handleError(_0xe5e675,null));};exports['destroy']=function(_0x3525d,_0x1d247e){return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x3525d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x1d247e,null))['then'](removeEntity(_0x1d247e,null))['catch'](handleError(_0x1d247e,null));};exports[_0x5e60('0x4e')]=function(_0x1e4e41,_0x457c37,_0x4a2d67){var _0x594068={};var _0x31ced8={};var _0x46f3ba;var _0x179cc6;return db['ZendeskAccount'][_0x5e60('0x4f')]({'where':{'id':_0x1e4e41[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x457c37,null))[_0x5e60('0x26')](function(_0x17d002){if(_0x17d002){_0x46f3ba=_0x17d002;_0x31ced8[_0x5e60('0x35')]=_['keys'](db[_0x5e60('0x50')][_0x5e60('0x51')]);_0x31ced8['query']=_[_0x5e60('0x32')](_0x1e4e41[_0x5e60('0x31')]);_0x31ced8[_0x5e60('0x33')]=_['intersection'](_0x31ced8[_0x5e60('0x35')],_0x31ced8[_0x5e60('0x31')]);_0x594068['attributes']=_[_0x5e60('0x34')](_0x31ced8[_0x5e60('0x35')],qs[_0x5e60('0x37')](_0x1e4e41[_0x5e60('0x31')]['fields']));_0x594068[_0x5e60('0x36')]=_0x594068[_0x5e60('0x36')]['length']?_0x594068[_0x5e60('0x36')]:_0x31ced8['model'];_0x594068[_0x5e60('0x3a')]=qs['sort'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x594068['where']=qs[_0x5e60('0x33')](_['pick'](_0x1e4e41[_0x5e60('0x31')],_0x31ced8['filters']));if(_0x1e4e41[_0x5e60('0x31')]['filter']){_0x594068[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x594068[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x594068[_0x5e60('0x36')],function(_0x2b8343){var _0x3d1e35={};_0x3d1e35[_0x2b8343]={'$like':'%'+_0x1e4e41['query'][_0x5e60('0x3e')]+'%'};return _0x3d1e35;})});}_0x594068=_[_0x5e60('0x3f')]({},_0x594068,_0x1e4e41[_0x5e60('0x4a')]);return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0x35aad7){if(_0x35aad7){_0x179cc6=_0x35aad7['length'];if(!_0x1e4e41['query']['hasOwnProperty'](_0x5e60('0x39'))){_0x594068[_0x5e60('0x1d')]=qs['limit'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x594068['offset']=qs[_0x5e60('0x1e')](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1e')]);}return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0xcd2232){if(_0xcd2232){return _0xcd2232?{'count':_0x179cc6,'rows':_0xcd2232}:null;}})[_0x5e60('0x26')](respondWithResult(_0x457c37,null))[_0x5e60('0x45')](handleError(_0x457c37,null));};exports[_0x5e60('0x52')]=function(_0x406c3a,_0x157aad,_0x15921d){if(_0x406c3a[_0x5e60('0x4d')]['id']){delete _0x406c3a[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4f')]({'where':{'id':_0x406c3a[_0x5e60('0x47')]['id']}})['then'](handleEntityNotFound(_0x157aad,null))[_0x5e60('0x26')](function(_0x1706d6){if(_0x1706d6){_0x406c3a[_0x5e60('0x4d')]['AccountId']=_0x1706d6['id'];_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x53')]=integrations['getSubjects'](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a['body'][_0x5e60('0x40')]);_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x55')]=integrations[_0x5e60('0x56')](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x40')]);return db[_0x5e60('0x50')]['create'](_0x406c3a[_0x5e60('0x4d')],{'include':[{'model':db[_0x5e60('0x57')],'as':_0x5e60('0x53')},{'model':db['ZendeskField'],'as':_0x5e60('0x55')}]});}return null;})[_0x5e60('0x26')](respondWithResult(_0x157aad,null))[_0x5e60('0x45')](handleError(_0x157aad,null));};exports[_0x5e60('0x58')]=function(_0x3e85fe,_0x559f8c,_0x4560e1){var _0x213c7e='';return db[_0x5e60('0x2e')]['findOne']({'where':{'id':_0x3e85fe['params']['id']},'attributes':['id',_0x5e60('0x59'),_0x5e60('0x5a'),_0x5e60('0x5b'),_0x5e60('0x5c'),_0x5e60('0x5d')]})[_0x5e60('0x26')](handleEntityNotFound(_0x559f8c,null))[_0x5e60('0x26')](function(_0x563e69){if(_0x563e69){_0x213c7e=_0x563e69[_0x5e60('0x5d')];var _0x199edd=_0x213c7e[_0x5e60('0x5e')](-0x1);if(_0x199edd==='/'){_0x213c7e=_0x213c7e['substring'](0x0,_0x213c7e['lastIndexOf'](_0x199edd));}var _0x447bd3={'method':_0x5e60('0x5f'),'uri':util[_0x5e60('0x60')]('%s/%s',_0x213c7e,'ticket_fields'),'json':!![]};switch(_0x563e69[_0x5e60('0x5c')]){case _0x5e60('0x5a'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5a')]))[_0x5e60('0x63')](_0x5e60('0x64')))};break;case _0x5e60('0x5b'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s/token:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5b')]))['toString'](_0x5e60('0x64')))};break;default:throw new db[(_0x5e60('0x65'))]['ValidationError'](_0x5e60('0x66'));}return rp(_0x447bd3);}})[_0x5e60('0x26')](function(_0x391505){if(_0x391505){var _0x1b4aee=[_0x5e60('0x67'),_0x5e60('0x68'),'group',_0x5e60('0x69')];_[_0x5e60('0x6a')](_0x391505[_0x5e60('0x6b')],function(_0x222d94){return _0x1b4aee[_0x5e60('0x6c')](_0x222d94[_0x5e60('0x40')]);});return{'count':_0x391505[_0x5e60('0x6b')][_0x5e60('0x48')],'rows':_[_0x5e60('0x2d')](_0x391505['ticket_fields'],function(_0x10b77b){return{'id':_0x10b77b['id'],'name':_0x10b77b[_0x5e60('0x6d')]>0x7?_0x10b77b[_0x5e60('0x6e')]:_0x10b77b[_0x5e60('0x40')],'custom':_0x10b77b[_0x5e60('0x6d')]>0x7?!![]:![],'options':_0x10b77b[_0x5e60('0x6f')]?_0x10b77b[_0x5e60('0x6f')]:_0x10b77b[_0x5e60('0x70')]?_0x10b77b[_0x5e60('0x70')]:[]};})};}})[_0x5e60('0x26')](respondWithResult(_0x559f8c,null))['catch'](function(_0x5ab78f){var _0x5d2839=_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?0x1f4:_0x5ab78f[_0x5e60('0x72')]||0x1f4;logger[_0x5e60('0x29')](_0x5e60('0x73'),_0x5e60('0x58'),_0x5d2839,JSON[_0x5e60('0x74')](_0x5ab78f));delete _0x5ab78f[_0x5e60('0x2a')];if(_0x5d2839===0x191){_0x5d2839=0x190;}_0x559f8c[_0x5e60('0x1b')](_0x5d2839)['send'](_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?{'message':_0x5e60('0x75'),'statusCode':_0x5ab78f['statusCode']}:_0x5ab78f);});}; \ No newline at end of file +var _0xe706=['getConfigurations','findOne','ZendeskConfiguration','pick','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','channel','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','GET','format','password','headers','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','show','includeAll','include','find','create','body','catch','params'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0xe706,0xa3));var _0x6e70=function(_0x5f46ee,_0x550dbb){_0x5f46ee=_0x5f46ee-0x0;var _0x5f3804=_0xe706[_0x5f46ee];return _0x5f3804;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));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('0xa'));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'));function respondWithStatusCode(_0x3b38f3,_0x310eb7){_0x310eb7=_0x310eb7||0xcc;return function(_0xa1eb74){if(_0xa1eb74){return _0x3b38f3[_0x6e70('0x1e')](_0x310eb7);}return _0x3b38f3['status'](_0x310eb7)['end']();};}function respondWithResult(_0x48bc72,_0x257e81){_0x257e81=_0x257e81||0xc8;return function(_0x5a37a6){if(_0x5a37a6){return _0x48bc72['status'](_0x257e81)[_0x6e70('0x1f')](_0x5a37a6);}};}function respondWithFilteredResult(_0x22c50c,_0x5d9263){return function(_0x24f3ac){if(_0x24f3ac){var _0x5c3fe7=typeof _0x5d9263[_0x6e70('0x20')]===_0x6e70('0x21')&&typeof _0x5d9263['limit']==='undefined';var _0x3bd572=_0x24f3ac['count'];var _0x28a21f=_0x5c3fe7?0x0:_0x5d9263[_0x6e70('0x20')];var _0x53acdc=_0x5c3fe7?_0x24f3ac['count']:_0x5d9263[_0x6e70('0x20')]+_0x5d9263[_0x6e70('0x22')];var _0x2368eb;if(_0x53acdc>=_0x3bd572){_0x53acdc=_0x3bd572;_0x2368eb=0xc8;}else{_0x2368eb=0xce;}_0x22c50c[_0x6e70('0x23')](_0x2368eb);return _0x22c50c[_0x6e70('0x24')](_0x6e70('0x25'),_0x28a21f+'-'+_0x53acdc+'/'+_0x3bd572)[_0x6e70('0x1f')](_0x24f3ac);}return null;};}function patchUpdates(_0x44a49f){return function(_0x29326f){try{jsonpatch[_0x6e70('0x26')](_0x29326f,_0x44a49f,!![]);}catch(_0x4a0cfe){return BPromise[_0x6e70('0x27')](_0x4a0cfe);}return _0x29326f[_0x6e70('0x28')]();};}function saveUpdates(_0x27b294,_0x502b2d){return function(_0x3ccd87){if(_0x3ccd87){return _0x3ccd87[_0x6e70('0x29')](_0x27b294)[_0x6e70('0x2a')](function(_0x50da2c){return _0x50da2c;});}return null;};}function removeEntity(_0x10fc91,_0x538b9c){return function(_0x50aec2){if(_0x50aec2){return _0x50aec2['destroy']()[_0x6e70('0x2a')](function(){_0x10fc91[_0x6e70('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ecdf1,_0x1196ed){return function(_0x5f268f){if(!_0x5f268f){_0x3ecdf1[_0x6e70('0x1e')](0x194);}return _0x5f268f;};}function handleError(_0x67fb43,_0x2bb231){_0x2bb231=_0x2bb231||0x1f4;return function(_0x4a67ac){logger['error'](_0x4a67ac[_0x6e70('0x2b')]);if(_0x4a67ac[_0x6e70('0x2c')]){delete _0x4a67ac[_0x6e70('0x2c')];}_0x67fb43[_0x6e70('0x23')](_0x2bb231)[_0x6e70('0x2d')](_0x4a67ac);};}exports['index']=function(_0x1952ea,_0x406f29){var _0xecf336={},_0x2864a0={},_0x396a67={'count':0x0,'rows':[]};var _0x20a225=_[_0x6e70('0x2e')](db[_0x6e70('0x2f')][_0x6e70('0x30')],function(_0x3a5d30){return{'name':_0x3a5d30['fieldName'],'type':_0x3a5d30[_0x6e70('0x31')]['key']};});_0x2864a0[_0x6e70('0x32')]=_['map'](_0x20a225,_0x6e70('0x2c'));_0x2864a0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1952ea['query']);_0x2864a0[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x2864a0['model'],_0x2864a0[_0x6e70('0x33')]);_0xecf336[_0x6e70('0x37')]=_['intersection'](_0x2864a0[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x38')]));_0xecf336[_0x6e70('0x37')]=_0xecf336[_0x6e70('0x37')][_0x6e70('0x39')]?_0xecf336[_0x6e70('0x37')]:_0x2864a0[_0x6e70('0x32')];if(!_0x1952ea[_0x6e70('0x33')]['hasOwnProperty'](_0x6e70('0x3a'))){_0xecf336['limit']=qs[_0x6e70('0x22')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x22')]);_0xecf336[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x20')]);}_0xecf336[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3c')]);_0xecf336[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_['pick'](_0x1952ea['query'],_0x2864a0['filters']),_0x20a225);if(_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]){_0xecf336[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0xecf336[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x20a225,function(_0x572a71){if(_0x572a71[_0x6e70('0x31')]!==_0x6e70('0x40')){var _0x1c5cde={};_0x1c5cde[_0x572a71[_0x6e70('0x2c')]]={'$like':'%'+_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]+'%'};return _0x1c5cde;}})});}_0xecf336=_[_0x6e70('0x3f')]({},_0xecf336,_0x1952ea[_0x6e70('0x41')]);var _0x5be100={'where':_0xecf336[_0x6e70('0x3d')]};return db[_0x6e70('0x2f')][_0x6e70('0x42')](_0x5be100)[_0x6e70('0x2a')](function(_0x201da9){_0x396a67[_0x6e70('0x42')]=_0x201da9;if(_0x1952ea[_0x6e70('0x33')]['includeAll']){_0xecf336['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x6e70('0x43')](_0xecf336);})[_0x6e70('0x2a')](function(_0x83847b){_0x396a67[_0x6e70('0x44')]=_0x83847b;return _0x396a67;})[_0x6e70('0x2a')](respondWithFilteredResult(_0x406f29,_0xecf336))['catch'](handleError(_0x406f29,null));};exports[_0x6e70('0x45')]=function(_0x2a58d7,_0x2a2aca){var _0x52b197={'raw':![],'where':{'id':_0x2a58d7['params']['id']}},_0x544ad0={};_0x544ad0[_0x6e70('0x32')]=_['keys'](db[_0x6e70('0x2f')][_0x6e70('0x30')]);_0x544ad0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x2a58d7['query']);_0x544ad0[_0x6e70('0x35')]=_['intersection'](_0x544ad0[_0x6e70('0x32')],_0x544ad0[_0x6e70('0x33')]);_0x52b197[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x544ad0['model'],qs[_0x6e70('0x38')](_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x38')]));_0x52b197[_0x6e70('0x37')]=_0x52b197[_0x6e70('0x37')][_0x6e70('0x39')]?_0x52b197[_0x6e70('0x37')]:_0x544ad0['model'];if(_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x46')]){_0x52b197[_0x6e70('0x47')]=[{'all':!![]}];}_0x52b197=_[_0x6e70('0x3f')]({},_0x52b197,_0x2a58d7[_0x6e70('0x41')]);return db[_0x6e70('0x2f')][_0x6e70('0x48')](_0x52b197)['then'](handleEntityNotFound(_0x2a2aca,null))[_0x6e70('0x2a')](respondWithResult(_0x2a2aca,null))['catch'](handleError(_0x2a2aca,null));};exports[_0x6e70('0x49')]=function(_0x3836e4,_0x4b351e){return db['ZendeskAccount'][_0x6e70('0x49')](_0x3836e4[_0x6e70('0x4a')],{})[_0x6e70('0x2a')](respondWithResult(_0x4b351e,0xc9))['catch'](handleError(_0x4b351e,null));};exports['update']=function(_0x238ebb,_0x11ac3d){if(_0x238ebb[_0x6e70('0x4a')]['id']){delete _0x238ebb[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x238ebb['params']['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x11ac3d,null))[_0x6e70('0x2a')](saveUpdates(_0x238ebb[_0x6e70('0x4a')],null))[_0x6e70('0x2a')](respondWithResult(_0x11ac3d,null))[_0x6e70('0x4b')](handleError(_0x11ac3d,null));};exports['destroy']=function(_0x4ae901,_0x2c5538){return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4ae901[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x2c5538,null))['then'](removeEntity(_0x2c5538,null))[_0x6e70('0x4b')](handleError(_0x2c5538,null));};exports[_0x6e70('0x4d')]=function(_0x1fa320,_0x23ebfb,_0x3aba34){var _0x4a111a={};var _0x1142cd={};var _0x1dd242;var _0x2c20d3;return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x1fa320[_0x6e70('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23ebfb,null))[_0x6e70('0x2a')](function(_0x8d425d){if(_0x8d425d){_0x1dd242=_0x8d425d;_0x1142cd['model']=_[_0x6e70('0x34')](db[_0x6e70('0x4f')]['rawAttributes']);_0x1142cd[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1fa320[_0x6e70('0x33')]);_0x1142cd[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x1142cd['model'],_0x1142cd[_0x6e70('0x33')]);_0x4a111a[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x1142cd[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x38')]));_0x4a111a[_0x6e70('0x37')]=_0x4a111a[_0x6e70('0x37')][_0x6e70('0x39')]?_0x4a111a[_0x6e70('0x37')]:_0x1142cd[_0x6e70('0x32')];_0x4a111a[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3c')]);_0x4a111a[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_[_0x6e70('0x50')](_0x1fa320[_0x6e70('0x33')],_0x1142cd['filters']));if(_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3e')]){_0x4a111a[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0x4a111a[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x4a111a['attributes'],function(_0x42bd85){var _0x6cabf0={};_0x6cabf0[_0x42bd85]={'$like':'%'+_0x1fa320['query'][_0x6e70('0x3e')]+'%'};return _0x6cabf0;})});}_0x4a111a=_[_0x6e70('0x3f')]({},_0x4a111a,_0x1fa320[_0x6e70('0x41')]);return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2f9be4){if(_0x2f9be4){_0x2c20d3=_0x2f9be4[_0x6e70('0x39')];if(!_0x1fa320[_0x6e70('0x33')][_0x6e70('0x51')](_0x6e70('0x3a'))){_0x4a111a[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x1fa320['query']['limit']);_0x4a111a[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x20')]);}return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2e972b){if(_0x2e972b){return _0x2e972b?{'count':_0x2c20d3,'rows':_0x2e972b}:null;}})[_0x6e70('0x2a')](respondWithResult(_0x23ebfb,null))['catch'](handleError(_0x23ebfb,null));};exports['addConfiguration']=function(_0x355708,_0x47fbed,_0x2a8fb7){if(_0x355708[_0x6e70('0x4a')]['id']){delete _0x355708[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x355708[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x47fbed,null))[_0x6e70('0x2a')](function(_0x570115){if(_0x570115){_0x355708[_0x6e70('0x4a')][_0x6e70('0x52')]=_0x570115['id'];_0x355708[_0x6e70('0x4a')][_0x6e70('0x53')]=integrations[_0x6e70('0x54')](_0x355708['body']['channel'],_0x355708['body'][_0x6e70('0x31')]);_0x355708[_0x6e70('0x4a')][_0x6e70('0x55')]=integrations['getDescriptions'](_0x355708['body'][_0x6e70('0x56')],_0x355708[_0x6e70('0x4a')][_0x6e70('0x31')]);return db[_0x6e70('0x4f')][_0x6e70('0x49')](_0x355708[_0x6e70('0x4a')],{'include':[{'model':db['ZendeskField'],'as':_0x6e70('0x53')},{'model':db[_0x6e70('0x57')],'as':_0x6e70('0x55')}]});}return null;})[_0x6e70('0x2a')](respondWithResult(_0x47fbed,null))['catch'](handleError(_0x47fbed,null));};exports[_0x6e70('0x58')]=function(_0x531097,_0x5b4046,_0x30487b){var _0x3249a5='';return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x531097[_0x6e70('0x4c')]['id']},'attributes':['id',_0x6e70('0x59'),'password',_0x6e70('0x5a'),_0x6e70('0x5b'),_0x6e70('0x5c')]})[_0x6e70('0x2a')](handleEntityNotFound(_0x5b4046,null))[_0x6e70('0x2a')](function(_0x13c092){if(_0x13c092){_0x3249a5=_0x13c092[_0x6e70('0x5c')];var _0xd9b4a9=_0x3249a5[_0x6e70('0x5d')](-0x1);if(_0xd9b4a9==='/'){_0x3249a5=_0x3249a5[_0x6e70('0x5e')](0x0,_0x3249a5['lastIndexOf'](_0xd9b4a9));}var _0x44c877={'method':_0x6e70('0x5f'),'uri':util[_0x6e70('0x60')]('%s/%s',_0x3249a5,'ticket_fields'),'json':!![]};switch(_0x13c092[_0x6e70('0x5b')]){case _0x6e70('0x61'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util['format']('%s:%s',_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x61')]))['toString'](_0x6e70('0x64')))};break;case _0x6e70('0x5a'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util[_0x6e70('0x60')](_0x6e70('0x65'),_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x5a')]))[_0x6e70('0x66')](_0x6e70('0x64')))};break;default:throw new db[(_0x6e70('0x67'))][(_0x6e70('0x68'))](_0x6e70('0x69'));}return rp(_0x44c877);}})['then'](function(_0x5b3cb0){if(_0x5b3cb0){var _0x39ed95=['subject',_0x6e70('0x6a'),'group','assignee'];_[_0x6e70('0x6b')](_0x5b3cb0['ticket_fields'],function(_0x576069){return _0x39ed95[_0x6e70('0x6c')](_0x576069[_0x6e70('0x31')]);});return{'count':_0x5b3cb0[_0x6e70('0x6d')]['length'],'rows':_['map'](_0x5b3cb0['ticket_fields'],function(_0x3e7be7){return{'id':_0x3e7be7['id'],'name':_0x3e7be7['position']>0x7?_0x3e7be7[_0x6e70('0x6e')]:_0x3e7be7[_0x6e70('0x31')],'custom':_0x3e7be7[_0x6e70('0x6f')]>0x7?!![]:![],'options':_0x3e7be7[_0x6e70('0x70')]?_0x3e7be7[_0x6e70('0x70')]:_0x3e7be7[_0x6e70('0x71')]?_0x3e7be7[_0x6e70('0x71')]:[]};})};}})['then'](respondWithResult(_0x5b4046,null))[_0x6e70('0x4b')](function(_0x2493b0){var _0xb649a6=_0x531097['query'][_0x6e70('0x72')]?0x1f4:_0x2493b0[_0x6e70('0x73')]||0x1f4;logger[_0x6e70('0x74')](_0x6e70('0x75'),_0x6e70('0x58'),_0xb649a6,JSON[_0x6e70('0x76')](_0x2493b0));delete _0x2493b0[_0x6e70('0x2c')];if(_0xb649a6===0x191){_0xb649a6=0x190;}_0x5b4046[_0x6e70('0x23')](_0xb649a6)[_0x6e70('0x2d')](_0x531097['query'][_0x6e70('0x72')]?{'message':_0x6e70('0x77'),'statusCode':_0x2493b0['statusCode']}:_0x2493b0);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 6438d19..395b2b3 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 _0x2266=['moment','bluebird','request-promise','rimraf','exports','define','ZendeskAccount','util','../../config/logger'];(function(_0x791798,_0x419135){var _0x33f33e=function(_0x11224e){while(--_0x11224e){_0x791798['push'](_0x791798['shift']());}};_0x33f33e(++_0x419135);}(_0x2266,0x154));var _0x6226=function(_0x157c68,_0x3d852c){_0x157c68=_0x157c68-0x0;var _0x1023f2=_0x2266[_0x157c68];return _0x1023f2;};'use strict';var _=require('lodash');var util=require(_0x6226('0x0'));var logger=require(_0x6226('0x1'))('api');var moment=require(_0x6226('0x2'));var BPromise=require(_0x6226('0x3'));var rp=require(_0x6226('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6226('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x6226('0x6')]=function(_0xf76f9f,_0x4a05fd){return _0xf76f9f[_0x6226('0x7')](_0x6226('0x8'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54e0=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts','lodash','moment','bluebird','path'];(function(_0x3dbd5f,_0x4dff30){var _0x3c619a=function(_0x379f01){while(--_0x379f01){_0x3dbd5f['push'](_0x3dbd5f['shift']());}};_0x3c619a(++_0x4dff30);}(_0x54e0,0x182));var _0x054e=function(_0x18f674,_0x47cd0a){_0x18f674=_0x18f674-0x0;var _0xdd157f=_0x54e0[_0x18f674];return _0xdd157f;};'use strict';var _=require(_0x054e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x054e('0x1'));var BPromise=require(_0x054e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x054e('0x3'));var rimraf=require(_0x054e('0x4'));var config=require(_0x054e('0x5'));var attributes=require(_0x054e('0x6'));var integrations=require(_0x054e('0x7'));module['exports']=function(_0x3bfad4,_0x294608){return _0x3bfad4[_0x054e('0x8')]('ZendeskAccount',attributes,{'tableName':_0x054e('0x9'),'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 e71e683..6330369 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 _0x03c6=['message','GetZendeskAccount','ZendeskAccount','findAll','raw','options','where','attributes','limit','include','model','map','then','stringify','ShowZendeskAccount','find','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','error','code','ZendeskAccount,\x20%s,\x20%s'];(function(_0x42af41,_0x4200bf){var _0x1c50df=function(_0x3c7224){while(--_0x3c7224){_0x42af41['push'](_0x42af41['shift']());}};_0x1c50df(++_0x4200bf);}(_0x03c6,0xb1));var _0x603c=function(_0x571060,_0x230223){_0x571060=_0x571060-0x0;var _0x402dcc=_0x03c6[_0x571060];return _0x402dcc;};'use strict';var _=require(_0x603c('0x0'));var util=require(_0x603c('0x1'));var moment=require(_0x603c('0x2'));var BPromise=require(_0x603c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x603c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x603c('0x5'));var logger=require('../../config/logger')(_0x603c('0x6'));var config=require(_0x603c('0x7'));var jayson=require(_0x603c('0x8'));var client=jayson['client'][_0x603c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42c8c3,_0x29a975,_0x46a136){return new BPromise(function(_0x1062b4,_0x452d1e){return client['request'](_0x42c8c3,_0x46a136)['then'](function(_0x37276f){logger[_0x603c('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x29a975,_0x603c('0xb'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x29a975,_0x603c('0xb'),JSON['stringify'](_0x37276f));if(_0x37276f[_0x603c('0xc')]){if(_0x37276f[_0x603c('0xc')][_0x603c('0xd')]===0x1f4){logger[_0x603c('0xc')](_0x603c('0xe'),_0x29a975,_0x37276f[_0x603c('0xc')][_0x603c('0xf')]);return _0x452d1e(_0x37276f[_0x603c('0xc')]['message']);}logger['error'](_0x603c('0xe'),_0x29a975,_0x37276f[_0x603c('0xc')][_0x603c('0xf')]);return _0x1062b4(_0x37276f[_0x603c('0xc')][_0x603c('0xf')]);}else{logger[_0x603c('0xa')](_0x603c('0xe'),_0x29a975,_0x603c('0xb'));_0x1062b4(_0x37276f['result'][_0x603c('0xf')]);}})['catch'](function(_0x1651e6){logger[_0x603c('0xc')](_0x603c('0xe'),_0x29a975,_0x1651e6);_0x452d1e(_0x1651e6);});});}exports[_0x603c('0x10')]=function(_0x12f4e8){var _0x401077=this;return new Promise(function(_0x1c522d,_0x29dfd5){return db[_0x603c('0x11')][_0x603c('0x12')]({'raw':_0x12f4e8['options']?_0x12f4e8['options'][_0x603c('0x13')]===undefined?!![]:![]:!![],'where':_0x12f4e8[_0x603c('0x14')]?_0x12f4e8['options'][_0x603c('0x15')]||null:null,'attributes':_0x12f4e8[_0x603c('0x14')]?_0x12f4e8['options'][_0x603c('0x16')]||null:null,'limit':_0x12f4e8[_0x603c('0x14')]?_0x12f4e8[_0x603c('0x14')][_0x603c('0x17')]||null:null,'include':_0x12f4e8['options']?_0x12f4e8['options'][_0x603c('0x18')]?_['map'](_0x12f4e8['options'][_0x603c('0x18')],function(_0x3fb7ff){return{'model':db[_0x3fb7ff[_0x603c('0x19')]],'as':_0x3fb7ff['as'],'attributes':_0x3fb7ff[_0x603c('0x16')],'include':_0x3fb7ff[_0x603c('0x18')]?_[_0x603c('0x1a')](_0x3fb7ff[_0x603c('0x18')],function(_0x56446c){return{'model':db[_0x56446c[_0x603c('0x19')]],'as':_0x56446c['as'],'attributes':_0x56446c[_0x603c('0x16')],'include':_0x56446c['include']?_[_0x603c('0x1a')](_0x56446c[_0x603c('0x18')],function(_0x2cdc52){return{'model':db[_0x2cdc52[_0x603c('0x19')]],'as':_0x2cdc52['as'],'attributes':_0x2cdc52[_0x603c('0x16')]};}):[]};}):[]};}):[]:[]})[_0x603c('0x1b')](function(_0x3d812f){logger[_0x603c('0xa')](_0x603c('0x10'),_0x12f4e8);logger['debug'](_0x603c('0x10'),_0x12f4e8,JSON[_0x603c('0x1c')](_0x3d812f));_0x1c522d(_0x3d812f);})['catch'](function(_0xe310d2){logger['error'](_0x603c('0x10'),_0xe310d2['message'],_0x12f4e8);_0x29dfd5(_0x401077[_0x603c('0xc')](0x1f4,_0xe310d2[_0x603c('0xf')]));});});};exports[_0x603c('0x1d')]=function(_0x46d78c){var _0x24d12d=this;return new Promise(function(_0x1164c1,_0x18908f){return db[_0x603c('0x11')][_0x603c('0x1e')]({'raw':_0x46d78c[_0x603c('0x14')]?_0x46d78c[_0x603c('0x14')][_0x603c('0x13')]===undefined?!![]:![]:!![],'where':_0x46d78c[_0x603c('0x14')]?_0x46d78c[_0x603c('0x14')][_0x603c('0x15')]||null:null,'attributes':_0x46d78c[_0x603c('0x14')]?_0x46d78c[_0x603c('0x14')][_0x603c('0x16')]||null:null,'include':_0x46d78c[_0x603c('0x14')]?_0x46d78c['options']['include']?_[_0x603c('0x1a')](_0x46d78c['options'][_0x603c('0x18')],function(_0x46e370){return{'model':db[_0x46e370[_0x603c('0x19')]],'as':_0x46e370['as'],'attributes':_0x46e370['attributes'],'include':_0x46e370[_0x603c('0x18')]?_[_0x603c('0x1a')](_0x46e370[_0x603c('0x18')],function(_0xb68bda){return{'model':db[_0xb68bda['model']],'as':_0xb68bda['as'],'attributes':_0xb68bda[_0x603c('0x16')],'include':_0xb68bda[_0x603c('0x18')]?_[_0x603c('0x1a')](_0xb68bda[_0x603c('0x18')],function(_0x4a828a){return{'model':db[_0x4a828a[_0x603c('0x19')]],'as':_0x4a828a['as'],'attributes':_0x4a828a['attributes']};}):[]};}):[]};}):[]:[]})[_0x603c('0x1b')](function(_0x4e60d8){logger[_0x603c('0xa')](_0x603c('0x1d'),_0x46d78c);logger[_0x603c('0x1f')]('ShowZendeskAccount',_0x46d78c,JSON['stringify'](_0x4e60d8));_0x1164c1(_0x4e60d8);})['catch'](function(_0x1ba06b){logger[_0x603c('0xc')](_0x603c('0x1d'),_0x1ba06b[_0x603c('0xf')],_0x46d78c);_0x18908f(_0x24d12d[_0x603c('0xc')](0x1f4,_0x1ba06b['message']));});});}; \ No newline at end of file +var _0x6838=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','ShowZendeskAccount','find','moment'];(function(_0xc4e092,_0x5059f7){var _0xa4f542=function(_0x302769){while(--_0x302769){_0xc4e092['push'](_0xc4e092['shift']());}};_0xa4f542(++_0x5059f7);}(_0x6838,0x7b));var _0x8683=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0x6838[_0x5b077b];return _0x16faf7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8683('0x0'));var BPromise=require(_0x8683('0x1'));var rs=require(_0x8683('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8683('0x3'))['db'];var utils=require(_0x8683('0x4'));var logger=require('../../config/logger')(_0x8683('0x5'));var config=require(_0x8683('0x6'));var jayson=require(_0x8683('0x7'));var client=jayson[_0x8683('0x8')][_0x8683('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d59c8,_0xf807b1,_0x5df399){return new BPromise(function(_0x5c88c2,_0x110bad){return client['request'](_0x1d59c8,_0x5df399)[_0x8683('0xa')](function(_0x565014){logger[_0x8683('0xb')](_0x8683('0xc'),_0xf807b1,_0x8683('0xd'));logger[_0x8683('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0xf807b1,_0x8683('0xd'),JSON[_0x8683('0xf')](_0x565014));if(_0x565014[_0x8683('0x10')]){if(_0x565014[_0x8683('0x10')][_0x8683('0x11')]===0x1f4){logger[_0x8683('0x10')](_0x8683('0xc'),_0xf807b1,_0x565014['error'][_0x8683('0x12')]);return _0x110bad(_0x565014[_0x8683('0x10')][_0x8683('0x12')]);}logger[_0x8683('0x10')](_0x8683('0xc'),_0xf807b1,_0x565014[_0x8683('0x10')][_0x8683('0x12')]);return _0x5c88c2(_0x565014[_0x8683('0x10')][_0x8683('0x12')]);}else{logger[_0x8683('0xb')](_0x8683('0xc'),_0xf807b1,'request\x20sent');_0x5c88c2(_0x565014['result'][_0x8683('0x12')]);}})[_0x8683('0x13')](function(_0x18248e){logger[_0x8683('0x10')](_0x8683('0xc'),_0xf807b1,_0x18248e);_0x110bad(_0x18248e);});});}exports[_0x8683('0x14')]=function(_0x52efb4){var _0x434c0b=this;return new Promise(function(_0x359377,_0x2db028){return db[_0x8683('0x15')][_0x8683('0x16')]({'raw':_0x52efb4[_0x8683('0x17')]?_0x52efb4['options'][_0x8683('0x18')]===undefined?!![]:![]:!![],'where':_0x52efb4['options']?_0x52efb4['options']['where']||null:null,'attributes':_0x52efb4[_0x8683('0x17')]?_0x52efb4[_0x8683('0x17')][_0x8683('0x19')]||null:null,'limit':_0x52efb4[_0x8683('0x17')]?_0x52efb4['options']['limit']||null:null,'include':_0x52efb4[_0x8683('0x17')]?_0x52efb4[_0x8683('0x17')][_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x52efb4[_0x8683('0x17')][_0x8683('0x1a')],function(_0x1ccf9a){return{'model':db[_0x1ccf9a[_0x8683('0x1c')]],'as':_0x1ccf9a['as'],'attributes':_0x1ccf9a[_0x8683('0x19')],'include':_0x1ccf9a[_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x1ccf9a[_0x8683('0x1a')],function(_0x521f67){return{'model':db[_0x521f67[_0x8683('0x1c')]],'as':_0x521f67['as'],'attributes':_0x521f67['attributes'],'include':_0x521f67[_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x521f67[_0x8683('0x1a')],function(_0x3e5120){return{'model':db[_0x3e5120['model']],'as':_0x3e5120['as'],'attributes':_0x3e5120['attributes']};}):[]};}):[]};}):[]:[]})[_0x8683('0xa')](function(_0x1b0d86){logger[_0x8683('0xb')](_0x8683('0x14'),_0x52efb4);logger[_0x8683('0xe')](_0x8683('0x14'),_0x52efb4,JSON[_0x8683('0xf')](_0x1b0d86));_0x359377(_0x1b0d86);})[_0x8683('0x13')](function(_0x43cc4c){logger[_0x8683('0x10')](_0x8683('0x14'),_0x43cc4c[_0x8683('0x12')],_0x52efb4);_0x2db028(_0x434c0b[_0x8683('0x10')](0x1f4,_0x43cc4c[_0x8683('0x12')]));});});};exports[_0x8683('0x1d')]=function(_0x4030f8){var _0x223188=this;return new Promise(function(_0x4bc62a,_0x36bd2f){return db[_0x8683('0x15')][_0x8683('0x1e')]({'raw':_0x4030f8[_0x8683('0x17')]?_0x4030f8[_0x8683('0x17')][_0x8683('0x18')]===undefined?!![]:![]:!![],'where':_0x4030f8[_0x8683('0x17')]?_0x4030f8['options']['where']||null:null,'attributes':_0x4030f8[_0x8683('0x17')]?_0x4030f8['options'][_0x8683('0x19')]||null:null,'include':_0x4030f8[_0x8683('0x17')]?_0x4030f8[_0x8683('0x17')][_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x4030f8['options'][_0x8683('0x1a')],function(_0x579f67){return{'model':db[_0x579f67[_0x8683('0x1c')]],'as':_0x579f67['as'],'attributes':_0x579f67[_0x8683('0x19')],'include':_0x579f67[_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x579f67[_0x8683('0x1a')],function(_0x2bb363){return{'model':db[_0x2bb363[_0x8683('0x1c')]],'as':_0x2bb363['as'],'attributes':_0x2bb363[_0x8683('0x19')],'include':_0x2bb363[_0x8683('0x1a')]?_[_0x8683('0x1b')](_0x2bb363[_0x8683('0x1a')],function(_0x1f8d52){return{'model':db[_0x1f8d52[_0x8683('0x1c')]],'as':_0x1f8d52['as'],'attributes':_0x1f8d52[_0x8683('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8683('0xa')](function(_0x23b5a4){logger[_0x8683('0xb')](_0x8683('0x1d'),_0x4030f8);logger['debug'](_0x8683('0x1d'),_0x4030f8,JSON[_0x8683('0xf')](_0x23b5a4));_0x4bc62a(_0x23b5a4);})[_0x8683('0x13')](function(_0x4ba2be){logger[_0x8683('0x10')]('ShowZendeskAccount',_0x4ba2be['message'],_0x4030f8);_0x36bd2f(_0x223188[_0x8683('0x10')](0x1f4,_0x4ba2be[_0x8683('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 0e15ffb..f2a2849 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','put','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x23cc52,_0x233d01){var _0x1ec9ef=function(_0x5aa319){while(--_0x5aa319){_0x23cc52['push'](_0x23cc52['shift']());}};_0x1ec9ef(++_0x233d01);}(_0xda3f,0xec));var _0xfda3=function(_0x21a2e2,_0x342cd1){_0x21a2e2=_0x21a2e2-0x0;var _0x7f373c=_0xda3f[_0x21a2e2];return _0x7f373c;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./intZendeskConfiguration.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/descriptions',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0x5')](_0xfda3('0xe'),auth[_0xfda3('0x6')](),controller['getTags']);router[_0xfda3('0xf')]('/',auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xf')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xfda3('0x11')](_0xfda3('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x12')]);module[_0xfda3('0x13')]=router; \ No newline at end of file +var _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x200e00,_0x11ebeb){var _0x2b65b6=function(_0x2d2753){while(--_0x2d2753){_0x200e00['push'](_0x200e00['shift']());}};_0x2b65b6(++_0x11ebeb);}(_0x757a,0xde));var _0xa757=function(_0x24879e,_0x34cc62){_0x24879e=_0x24879e-0x0;var _0x288df4=_0x757a[_0x24879e];return _0x288df4;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f4e86ad..a03321b 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 _0xca1b=['STRING'];(function(_0xa3f341,_0x3715bd){var _0x24d737=function(_0x329a77){while(--_0x329a77){_0xa3f341['push'](_0xa3f341['shift']());}};_0x24d737(++_0x3715bd);}(_0xca1b,0x1ee));var _0xbca1=function(_0x5003e3,_0x35160a){_0x5003e3=_0x5003e3-0x0;var _0x5f4212=_0xca1b[_0x5003e3];return _0x5f4212;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbca1('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa38e=['STRING','sequelize'];(function(_0x13e062,_0x125d96){var _0x3c3693=function(_0x399106){while(--_0x399106){_0x13e062['push'](_0x13e062['shift']());}};_0x3c3693(++_0x125d96);}(_0xa38e,0xf1));var _0xea38=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0xa38e[_0x2d126e];return _0xcb04d3;};'use strict';var Sequelize=require(_0xea38('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xea38('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 13bbc6d..33d4481 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 _0x222e=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','count','Content-Range','json','save','update','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','then','includeAll','findAll','rows','show','params','catch','body','find','getFields','ZendeskField','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','rimraf','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x222e,0x12a));var _0xe222=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x222e[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe222('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe222('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xe222('0x2'));var util=require('util');var path=require(_0xe222('0x3'));var sox=require(_0xe222('0x4'));var csv=require(_0xe222('0x5'));var ejs=require(_0xe222('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe222('0x7'));var crypto=require(_0xe222('0x8'));var jsforce=require(_0xe222('0x9'));var deskjs=require(_0xe222('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe222('0xb'));var Papa=require(_0xe222('0xc'));var Redis=require(_0xe222('0xd'));var authService=require(_0xe222('0xe'));var qs=require(_0xe222('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe222('0x10'))(_0xe222('0x11'));var utils=require(_0xe222('0x12'));var config=require(_0xe222('0x13'));var licenseUtil=require(_0xe222('0x14'));var db=require(_0xe222('0x15'))['db'];function respondWithStatusCode(_0x119fd4,_0x1fbcbb){_0x1fbcbb=_0x1fbcbb||0xcc;return function(_0x1b6c64){if(_0x1b6c64){return _0x119fd4[_0xe222('0x16')](_0x1fbcbb);}return _0x119fd4['status'](_0x1fbcbb)[_0xe222('0x17')]();};}function respondWithResult(_0x21d35f,_0x3575a9){_0x3575a9=_0x3575a9||0xc8;return function(_0x30546e){if(_0x30546e){return _0x21d35f[_0xe222('0x18')](_0x3575a9)['json'](_0x30546e);}};}function respondWithFilteredResult(_0x6ef8ac,_0x1aa540){return function(_0x30a628){if(_0x30a628){var _0x7d04eb=typeof _0x1aa540[_0xe222('0x19')]==='undefined'&&typeof _0x1aa540[_0xe222('0x1a')]==='undefined';var _0x3d8a5f=_0x30a628[_0xe222('0x1b')];var _0x3a3656=_0x7d04eb?0x0:_0x1aa540[_0xe222('0x19')];var _0x55e321=_0x7d04eb?_0x30a628[_0xe222('0x1b')]:_0x1aa540['offset']+_0x1aa540[_0xe222('0x1a')];var _0x2569c7;if(_0x55e321>=_0x3d8a5f){_0x55e321=_0x3d8a5f;_0x2569c7=0xc8;}else{_0x2569c7=0xce;}_0x6ef8ac[_0xe222('0x18')](_0x2569c7);return _0x6ef8ac['set'](_0xe222('0x1c'),_0x3a3656+'-'+_0x55e321+'/'+_0x3d8a5f)[_0xe222('0x1d')](_0x30a628);}return null;};}function patchUpdates(_0x1d9868){return function(_0x3d54c2){try{jsonpatch['apply'](_0x3d54c2,_0x1d9868,!![]);}catch(_0x6508f5){return BPromise['reject'](_0x6508f5);}return _0x3d54c2[_0xe222('0x1e')]();};}function saveUpdates(_0x40138b,_0x48376b){return function(_0x2df91b){if(_0x2df91b){return _0x2df91b[_0xe222('0x1f')](_0x40138b)['then'](function(_0x55c69f){return _0x55c69f;});}return null;};}function removeEntity(_0x412335,_0x55c879){return function(_0x326267){if(_0x326267){return _0x326267[_0xe222('0x20')]()['then'](function(){_0x412335[_0xe222('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x236c61,_0x444a38){return function(_0x2178c8){if(!_0x2178c8){_0x236c61['sendStatus'](0x194);}return _0x2178c8;};}function handleError(_0x11c63f,_0x493ec8){_0x493ec8=_0x493ec8||0x1f4;return function(_0x1416ff){logger['error'](_0x1416ff[_0xe222('0x21')]);if(_0x1416ff[_0xe222('0x22')]){delete _0x1416ff[_0xe222('0x22')];}_0x11c63f[_0xe222('0x18')](_0x493ec8)[_0xe222('0x23')](_0x1416ff);};}exports[_0xe222('0x24')]=function(_0x5067ec,_0x27144d){var _0x1a5b81={},_0x3e5f0e={},_0x5108f5={'count':0x0,'rows':[]};var _0x1f505e=_[_0xe222('0x25')](db[_0xe222('0x26')][_0xe222('0x27')],function(_0x4be70b){return{'name':_0x4be70b[_0xe222('0x28')],'type':_0x4be70b[_0xe222('0x29')]['key']};});_0x3e5f0e[_0xe222('0x2a')]=_[_0xe222('0x25')](_0x1f505e,_0xe222('0x22'));_0x3e5f0e[_0xe222('0x2b')]=_[_0xe222('0x2c')](_0x5067ec[_0xe222('0x2b')]);_0x3e5f0e[_0xe222('0x2d')]=_[_0xe222('0x2e')](_0x3e5f0e['model'],_0x3e5f0e[_0xe222('0x2b')]);_0x1a5b81[_0xe222('0x2f')]=_[_0xe222('0x2e')](_0x3e5f0e['model'],qs[_0xe222('0x30')](_0x5067ec[_0xe222('0x2b')][_0xe222('0x30')]));_0x1a5b81[_0xe222('0x2f')]=_0x1a5b81[_0xe222('0x2f')][_0xe222('0x31')]?_0x1a5b81[_0xe222('0x2f')]:_0x3e5f0e['model'];if(!_0x5067ec[_0xe222('0x2b')]['hasOwnProperty']('nolimit')){_0x1a5b81[_0xe222('0x1a')]=qs['limit'](_0x5067ec[_0xe222('0x2b')]['limit']);_0x1a5b81[_0xe222('0x19')]=qs[_0xe222('0x19')](_0x5067ec[_0xe222('0x2b')]['offset']);}_0x1a5b81[_0xe222('0x32')]=qs['sort'](_0x5067ec[_0xe222('0x2b')][_0xe222('0x33')]);_0x1a5b81[_0xe222('0x34')]=qs[_0xe222('0x2d')](_[_0xe222('0x35')](_0x5067ec['query'],_0x3e5f0e['filters']),_0x1f505e);if(_0x5067ec[_0xe222('0x2b')][_0xe222('0x36')]){_0x1a5b81[_0xe222('0x34')]=_[_0xe222('0x37')](_0x1a5b81[_0xe222('0x34')],{'$or':_[_0xe222('0x25')](_0x1f505e,function(_0x1fa5a7){if(_0x1fa5a7[_0xe222('0x29')]!=='VIRTUAL'){var _0x26bad5={};_0x26bad5[_0x1fa5a7[_0xe222('0x22')]]={'$like':'%'+_0x5067ec[_0xe222('0x2b')][_0xe222('0x36')]+'%'};return _0x26bad5;}})});}_0x1a5b81=_[_0xe222('0x37')]({},_0x1a5b81,_0x5067ec[_0xe222('0x38')]);var _0x36fad6={'where':_0x1a5b81['where']};return db[_0xe222('0x26')][_0xe222('0x1b')](_0x36fad6)[_0xe222('0x39')](function(_0xc07795){_0x5108f5[_0xe222('0x1b')]=_0xc07795;if(_0x5067ec[_0xe222('0x2b')][_0xe222('0x3a')]){_0x1a5b81['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xe222('0x3b')](_0x1a5b81);})['then'](function(_0x2746f0){_0x5108f5[_0xe222('0x3c')]=_0x2746f0;return _0x5108f5;})[_0xe222('0x39')](respondWithFilteredResult(_0x27144d,_0x1a5b81))['catch'](handleError(_0x27144d,null));};exports[_0xe222('0x3d')]=function(_0x23f8f8,_0x17121e){var _0xba65bc={'raw':![],'where':{'id':_0x23f8f8[_0xe222('0x3e')]['id']}},_0x37d99b={};_0x37d99b[_0xe222('0x2a')]=_[_0xe222('0x2c')](db['ZendeskConfiguration'][_0xe222('0x27')]);_0x37d99b[_0xe222('0x2b')]=_[_0xe222('0x2c')](_0x23f8f8[_0xe222('0x2b')]);_0x37d99b[_0xe222('0x2d')]=_['intersection'](_0x37d99b[_0xe222('0x2a')],_0x37d99b['query']);_0xba65bc[_0xe222('0x2f')]=_[_0xe222('0x2e')](_0x37d99b[_0xe222('0x2a')],qs[_0xe222('0x30')](_0x23f8f8['query'][_0xe222('0x30')]));_0xba65bc[_0xe222('0x2f')]=_0xba65bc[_0xe222('0x2f')]['length']?_0xba65bc['attributes']:_0x37d99b[_0xe222('0x2a')];if(_0x23f8f8['query'][_0xe222('0x3a')]){_0xba65bc['include']=[{'all':!![]}];}_0xba65bc=_[_0xe222('0x37')]({},_0xba65bc,_0x23f8f8[_0xe222('0x38')]);return db[_0xe222('0x26')]['find'](_0xba65bc)[_0xe222('0x39')](handleEntityNotFound(_0x17121e,null))[_0xe222('0x39')](respondWithResult(_0x17121e,null))[_0xe222('0x3f')](handleError(_0x17121e,null));};exports['create']=function(_0x4b8fc0,_0x31ed14){return db[_0xe222('0x26')]['create'](_0x4b8fc0['body'],{})['then'](respondWithResult(_0x31ed14,0xc9))['catch'](handleError(_0x31ed14,null));};exports['update']=function(_0x4c1537,_0x3a0a33){if(_0x4c1537[_0xe222('0x40')]['id']){delete _0x4c1537[_0xe222('0x40')]['id'];}return db[_0xe222('0x26')][_0xe222('0x41')]({'where':{'id':_0x4c1537[_0xe222('0x3e')]['id']}})[_0xe222('0x39')](handleEntityNotFound(_0x3a0a33,null))[_0xe222('0x39')](saveUpdates(_0x4c1537[_0xe222('0x40')],null))['then'](respondWithResult(_0x3a0a33,null))['catch'](handleError(_0x3a0a33,null));};exports[_0xe222('0x20')]=function(_0xb870,_0x1af44b){return db[_0xe222('0x26')][_0xe222('0x41')]({'where':{'id':_0xb870[_0xe222('0x3e')]['id']}})[_0xe222('0x39')](handleEntityNotFound(_0x1af44b,null))['then'](removeEntity(_0x1af44b,null))[_0xe222('0x3f')](handleError(_0x1af44b,null));};exports[_0xe222('0x42')]=function(_0x25aed0,_0x27c1df,_0x1ca6d7){var _0x1f80bf={};var _0x5e521e={};var _0x183486;var _0x43c197;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x25aed0[_0xe222('0x3e')]['id']}})[_0xe222('0x39')](handleEntityNotFound(_0x27c1df,null))[_0xe222('0x39')](function(_0x5ca1b9){if(_0x5ca1b9){_0x183486=_0x5ca1b9;_0x5e521e[_0xe222('0x2a')]=_[_0xe222('0x2c')](db[_0xe222('0x43')][_0xe222('0x27')]);_0x5e521e[_0xe222('0x2b')]=_[_0xe222('0x2c')](_0x25aed0[_0xe222('0x2b')]);_0x5e521e[_0xe222('0x2d')]=_[_0xe222('0x2e')](_0x5e521e['model'],_0x5e521e[_0xe222('0x2b')]);_0x1f80bf[_0xe222('0x2f')]=_['intersection'](_0x5e521e['model'],qs['fields'](_0x25aed0[_0xe222('0x2b')][_0xe222('0x30')]));_0x1f80bf[_0xe222('0x2f')]=_0x1f80bf[_0xe222('0x2f')][_0xe222('0x31')]?_0x1f80bf[_0xe222('0x2f')]:_0x5e521e[_0xe222('0x2a')];_0x1f80bf[_0xe222('0x32')]=qs[_0xe222('0x33')](_0x25aed0[_0xe222('0x2b')][_0xe222('0x33')]);_0x1f80bf[_0xe222('0x34')]=qs['filters'](_['pick'](_0x25aed0[_0xe222('0x2b')],_0x5e521e[_0xe222('0x2d')]));if(_0x25aed0[_0xe222('0x2b')]['filter']){_0x1f80bf[_0xe222('0x34')]=_[_0xe222('0x37')](_0x1f80bf[_0xe222('0x34')],{'$or':_[_0xe222('0x25')](_0x1f80bf[_0xe222('0x2f')],function(_0x391af2){var _0x15372d={};_0x15372d[_0x391af2]={'$like':'%'+_0x25aed0[_0xe222('0x2b')][_0xe222('0x36')]+'%'};return _0x15372d;})});}_0x1f80bf=_[_0xe222('0x37')]({},_0x1f80bf,_0x25aed0[_0xe222('0x38')]);return _0x183486[_0xe222('0x42')](_0x1f80bf);}})['then'](function(_0x218756){if(_0x218756){_0x43c197=_0x218756[_0xe222('0x31')];if(!_0x25aed0['query'][_0xe222('0x44')](_0xe222('0x45'))){_0x1f80bf[_0xe222('0x1a')]=qs[_0xe222('0x1a')](_0x25aed0[_0xe222('0x2b')][_0xe222('0x1a')]);_0x1f80bf[_0xe222('0x19')]=qs['offset'](_0x25aed0[_0xe222('0x2b')][_0xe222('0x19')]);}return _0x183486[_0xe222('0x42')](_0x1f80bf);}})[_0xe222('0x39')](function(_0x323dcc){if(_0x323dcc){return _0x323dcc?{'count':_0x43c197,'rows':_0x323dcc}:null;}})[_0xe222('0x39')](respondWithResult(_0x27c1df,null))[_0xe222('0x3f')](handleError(_0x27c1df,null));};exports[_0xe222('0x46')]=function(_0x1f1456,_0xb1bf47,_0x5a9365){var _0x479364={};var _0x493584={};var _0x3762ef;var _0x517b1b;return db['ZendeskConfiguration'][_0xe222('0x47')]({'where':{'id':_0x1f1456[_0xe222('0x3e')]['id']}})[_0xe222('0x39')](handleEntityNotFound(_0xb1bf47,null))[_0xe222('0x39')](function(_0x22cc28){if(_0x22cc28){_0x3762ef=_0x22cc28;_0x493584[_0xe222('0x2a')]=_[_0xe222('0x2c')](db[_0xe222('0x43')][_0xe222('0x27')]);_0x493584[_0xe222('0x2b')]=_['keys'](_0x1f1456[_0xe222('0x2b')]);_0x493584[_0xe222('0x2d')]=_[_0xe222('0x2e')](_0x493584[_0xe222('0x2a')],_0x493584[_0xe222('0x2b')]);_0x479364[_0xe222('0x2f')]=_['intersection'](_0x493584['model'],qs[_0xe222('0x30')](_0x1f1456[_0xe222('0x2b')][_0xe222('0x30')]));_0x479364[_0xe222('0x2f')]=_0x479364[_0xe222('0x2f')][_0xe222('0x31')]?_0x479364[_0xe222('0x2f')]:_0x493584[_0xe222('0x2a')];_0x479364['order']=qs['sort'](_0x1f1456['query']['sort']);_0x479364[_0xe222('0x34')]=qs[_0xe222('0x2d')](_[_0xe222('0x35')](_0x1f1456[_0xe222('0x2b')],_0x493584['filters']));if(_0x1f1456[_0xe222('0x2b')][_0xe222('0x36')]){_0x479364['where']=_[_0xe222('0x37')](_0x479364[_0xe222('0x34')],{'$or':_[_0xe222('0x25')](_0x479364[_0xe222('0x2f')],function(_0xf18b7a){var _0x4ead61={};_0x4ead61[_0xf18b7a]={'$like':'%'+_0x1f1456[_0xe222('0x2b')]['filter']+'%'};return _0x4ead61;})});}_0x479364=_[_0xe222('0x37')]({},_0x479364,_0x1f1456[_0xe222('0x38')]);return _0x3762ef[_0xe222('0x46')](_0x479364);}})[_0xe222('0x39')](function(_0x2d74ec){if(_0x2d74ec){_0x517b1b=_0x2d74ec[_0xe222('0x31')];if(!_0x1f1456[_0xe222('0x2b')]['hasOwnProperty'](_0xe222('0x45'))){_0x479364[_0xe222('0x1a')]=qs[_0xe222('0x1a')](_0x1f1456[_0xe222('0x2b')][_0xe222('0x1a')]);_0x479364[_0xe222('0x19')]=qs[_0xe222('0x19')](_0x1f1456[_0xe222('0x2b')][_0xe222('0x19')]);}return _0x3762ef[_0xe222('0x46')](_0x479364);}})[_0xe222('0x39')](function(_0x1112fd){if(_0x1112fd){return _0x1112fd?{'count':_0x517b1b,'rows':_0x1112fd}:null;}})[_0xe222('0x39')](respondWithResult(_0xb1bf47,null))['catch'](handleError(_0xb1bf47,null));};exports['getDescriptions']=function(_0x1b1e8a,_0x3c5033,_0x5c650e){var _0x13957e={};var _0x22df4b={};var _0x4ad7d8;var _0x58f096;return db[_0xe222('0x26')][_0xe222('0x47')]({'where':{'id':_0x1b1e8a[_0xe222('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3c5033,null))['then'](function(_0x3e8fb1){if(_0x3e8fb1){_0x4ad7d8=_0x3e8fb1;_0x22df4b[_0xe222('0x2a')]=_[_0xe222('0x2c')](db['ZendeskField'][_0xe222('0x27')]);_0x22df4b[_0xe222('0x2b')]=_[_0xe222('0x2c')](_0x1b1e8a[_0xe222('0x2b')]);_0x22df4b[_0xe222('0x2d')]=_[_0xe222('0x2e')](_0x22df4b[_0xe222('0x2a')],_0x22df4b['query']);_0x13957e[_0xe222('0x2f')]=_[_0xe222('0x2e')](_0x22df4b[_0xe222('0x2a')],qs['fields'](_0x1b1e8a[_0xe222('0x2b')][_0xe222('0x30')]));_0x13957e[_0xe222('0x2f')]=_0x13957e[_0xe222('0x2f')][_0xe222('0x31')]?_0x13957e['attributes']:_0x22df4b[_0xe222('0x2a')];_0x13957e['order']=qs[_0xe222('0x33')](_0x1b1e8a[_0xe222('0x2b')][_0xe222('0x33')]);_0x13957e[_0xe222('0x34')]=qs[_0xe222('0x2d')](_[_0xe222('0x35')](_0x1b1e8a[_0xe222('0x2b')],_0x22df4b['filters']));if(_0x1b1e8a[_0xe222('0x2b')]['filter']){_0x13957e[_0xe222('0x34')]=_['merge'](_0x13957e[_0xe222('0x34')],{'$or':_[_0xe222('0x25')](_0x13957e[_0xe222('0x2f')],function(_0x1371c8){var _0x15e834={};_0x15e834[_0x1371c8]={'$like':'%'+_0x1b1e8a[_0xe222('0x2b')][_0xe222('0x36')]+'%'};return _0x15e834;})});}_0x13957e=_[_0xe222('0x37')]({},_0x13957e,_0x1b1e8a[_0xe222('0x38')]);return _0x4ad7d8[_0xe222('0x48')](_0x13957e);}})[_0xe222('0x39')](function(_0x916ff0){if(_0x916ff0){_0x58f096=_0x916ff0['length'];if(!_0x1b1e8a[_0xe222('0x2b')][_0xe222('0x44')](_0xe222('0x45'))){_0x13957e[_0xe222('0x1a')]=qs[_0xe222('0x1a')](_0x1b1e8a[_0xe222('0x2b')][_0xe222('0x1a')]);_0x13957e[_0xe222('0x19')]=qs[_0xe222('0x19')](_0x1b1e8a[_0xe222('0x2b')]['offset']);}return _0x4ad7d8[_0xe222('0x48')](_0x13957e);}})[_0xe222('0x39')](function(_0x3ad239){if(_0x3ad239){return _0x3ad239?{'count':_0x58f096,'rows':_0x3ad239}:null;}})[_0xe222('0x39')](respondWithResult(_0x3c5033,null))[_0xe222('0x3f')](handleError(_0x3c5033,null));};exports[_0xe222('0x49')]=function(_0x27be0a,_0x5ee572,_0x21947c){var _0x16a6be={};var _0x45a810={};var _0x1e8760;var _0x565eb5;return db['ZendeskConfiguration'][_0xe222('0x47')]({'where':{'id':_0x27be0a['params']['id']}})[_0xe222('0x39')](handleEntityNotFound(_0x5ee572,null))['then'](function(_0x48aa34){if(_0x48aa34){_0x1e8760=_0x48aa34;_0x45a810[_0xe222('0x2a')]=_['keys'](db[_0xe222('0x4a')]['rawAttributes']);_0x45a810['query']=_['keys'](_0x27be0a[_0xe222('0x2b')]);_0x45a810[_0xe222('0x2d')]=_['intersection'](_0x45a810[_0xe222('0x2a')],_0x45a810[_0xe222('0x2b')]);_0x16a6be['attributes']=_[_0xe222('0x2e')](_0x45a810[_0xe222('0x2a')],qs[_0xe222('0x30')](_0x27be0a['query'][_0xe222('0x30')]));_0x16a6be[_0xe222('0x2f')]=_0x16a6be['attributes'][_0xe222('0x31')]?_0x16a6be['attributes']:_0x45a810[_0xe222('0x2a')];_0x16a6be[_0xe222('0x32')]=qs['sort'](_0x27be0a[_0xe222('0x2b')]['sort']);_0x16a6be[_0xe222('0x34')]=qs['filters'](_[_0xe222('0x35')](_0x27be0a['query'],_0x45a810[_0xe222('0x2d')]));if(_0x27be0a[_0xe222('0x2b')][_0xe222('0x36')]){_0x16a6be[_0xe222('0x34')]=_['merge'](_0x16a6be[_0xe222('0x34')],{'$or':_[_0xe222('0x25')](_0x16a6be['attributes'],function(_0x3fa0dd){var _0x278875={};_0x278875[_0x3fa0dd]={'$like':'%'+_0x27be0a[_0xe222('0x2b')]['filter']+'%'};return _0x278875;})});}_0x16a6be=_[_0xe222('0x37')]({},_0x16a6be,_0x27be0a[_0xe222('0x38')]);return _0x1e8760['getTags'](_0x16a6be);}})[_0xe222('0x39')](function(_0x4fb1ad){if(_0x4fb1ad){_0x565eb5=_0x4fb1ad[_0xe222('0x31')];if(!_0x27be0a['query'][_0xe222('0x44')](_0xe222('0x45'))){_0x16a6be[_0xe222('0x1a')]=qs[_0xe222('0x1a')](_0x27be0a[_0xe222('0x2b')]['limit']);_0x16a6be['offset']=qs[_0xe222('0x19')](_0x27be0a[_0xe222('0x2b')]['offset']);}return _0x1e8760['getTags'](_0x16a6be);}})[_0xe222('0x39')](function(_0x46bac7){if(_0x46bac7){return _0x46bac7?{'count':_0x565eb5,'rows':_0x46bac7}:null;}})[_0xe222('0x39')](respondWithResult(_0x5ee572,null))['catch'](handleError(_0x5ee572,null));};exports[_0xe222('0x4b')]=function(_0x4fd245,_0x52b3ba,_0x16bb75){if(_0x4fd245[_0xe222('0x40')]['id']){delete _0x4fd245['body']['id'];}return db[_0xe222('0x26')]['findOne']({'where':{'id':_0x4fd245['params']['id']}})[_0xe222('0x39')](handleEntityNotFound(_0x52b3ba,null))[_0xe222('0x39')](function(_0x288bf0){if(_0x288bf0){return _0x288bf0[_0xe222('0x4b')](_0x4fd245[_0xe222('0x40')][_0xe222('0x4c')]||[]);}return null;})['then'](respondWithResult(_0x52b3ba,null))[_0xe222('0x3f')](handleError(_0x52b3ba,null));}; \ No newline at end of file +var _0x94b0=['rows','show','params','length','includeAll','catch','create','body','update','destroy','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll'];(function(_0x2eeca7,_0x47ca76){var _0x420e12=function(_0x171076){while(--_0x171076){_0x2eeca7['push'](_0x2eeca7['shift']());}};_0x420e12(++_0x47ca76);}(_0x94b0,0xc4));var _0x094b=function(_0x14fda9,_0x52860f){_0x14fda9=_0x14fda9-0x0;var _0x4046e6=_0x94b0[_0x14fda9];return _0x4046e6;};'use strict';var emlformat=require(_0x094b('0x0'));var rimraf=require(_0x094b('0x1'));var zipdir=require(_0x094b('0x2'));var jsonpatch=require(_0x094b('0x3'));var rp=require(_0x094b('0x4'));var moment=require(_0x094b('0x5'));var BPromise=require(_0x094b('0x6'));var Mustache=require(_0x094b('0x7'));var util=require(_0x094b('0x8'));var path=require(_0x094b('0x9'));var sox=require('sox');var csv=require(_0x094b('0xa'));var ejs=require(_0x094b('0xb'));var fs=require('fs');var fs_extra=require(_0x094b('0xc'));var _=require(_0x094b('0xd'));var squel=require(_0x094b('0xe'));var crypto=require('crypto');var jsforce=require(_0x094b('0xf'));var deskjs=require(_0x094b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x094b('0x11'));var Papa=require('papaparse');var Redis=require(_0x094b('0x12'));var authService=require(_0x094b('0x13'));var qs=require(_0x094b('0x14'));var as=require(_0x094b('0x15'));var hardwareService=require(_0x094b('0x16'));var logger=require(_0x094b('0x17'))(_0x094b('0x18'));var utils=require(_0x094b('0x19'));var config=require(_0x094b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x094b('0x1b'))['db'];function respondWithStatusCode(_0xa5593f,_0x3eb0ad){_0x3eb0ad=_0x3eb0ad||0xcc;return function(_0x343a91){if(_0x343a91){return _0xa5593f['sendStatus'](_0x3eb0ad);}return _0xa5593f[_0x094b('0x1c')](_0x3eb0ad)[_0x094b('0x1d')]();};}function respondWithResult(_0x36d800,_0x15d9d0){_0x15d9d0=_0x15d9d0||0xc8;return function(_0xdd6e77){if(_0xdd6e77){return _0x36d800[_0x094b('0x1c')](_0x15d9d0)[_0x094b('0x1e')](_0xdd6e77);}};}function respondWithFilteredResult(_0x3dd993,_0x59fbf0){return function(_0x52be86){if(_0x52be86){var _0x2f1750=typeof _0x59fbf0[_0x094b('0x1f')]===_0x094b('0x20')&&typeof _0x59fbf0[_0x094b('0x21')]===_0x094b('0x20');var _0x50311d=_0x52be86[_0x094b('0x22')];var _0x3b3b48=_0x2f1750?0x0:_0x59fbf0[_0x094b('0x1f')];var _0x36a2ea=_0x2f1750?_0x52be86['count']:_0x59fbf0['offset']+_0x59fbf0[_0x094b('0x21')];var _0x4c4fb0;if(_0x36a2ea>=_0x50311d){_0x36a2ea=_0x50311d;_0x4c4fb0=0xc8;}else{_0x4c4fb0=0xce;}_0x3dd993[_0x094b('0x1c')](_0x4c4fb0);return _0x3dd993[_0x094b('0x23')](_0x094b('0x24'),_0x3b3b48+'-'+_0x36a2ea+'/'+_0x50311d)[_0x094b('0x1e')](_0x52be86);}return null;};}function patchUpdates(_0x4c7c07){return function(_0x29b596){try{jsonpatch[_0x094b('0x25')](_0x29b596,_0x4c7c07,!![]);}catch(_0x237594){return BPromise[_0x094b('0x26')](_0x237594);}return _0x29b596[_0x094b('0x27')]();};}function saveUpdates(_0x542141,_0x5b0b70){return function(_0x16a3cb){if(_0x16a3cb){return _0x16a3cb['update'](_0x542141)[_0x094b('0x28')](function(_0xf276da){return _0xf276da;});}return null;};}function removeEntity(_0x4f0a9d,_0x324cbc){return function(_0x18700a){if(_0x18700a){return _0x18700a['destroy']()[_0x094b('0x28')](function(){_0x4f0a9d[_0x094b('0x1c')](0xcc)[_0x094b('0x1d')]();});}};}function handleEntityNotFound(_0x592460,_0x535e4a){return function(_0x2b5bc9){if(!_0x2b5bc9){_0x592460['sendStatus'](0x194);}return _0x2b5bc9;};}function handleError(_0x37ca53,_0x335737){_0x335737=_0x335737||0x1f4;return function(_0x55667d){logger['error'](_0x55667d[_0x094b('0x29')]);if(_0x55667d[_0x094b('0x2a')]){delete _0x55667d[_0x094b('0x2a')];}_0x37ca53['status'](_0x335737)['send'](_0x55667d);};}exports[_0x094b('0x2b')]=function(_0x11e01d,_0xb7da4f){var _0x541dfb={},_0x387333={},_0x513003={'count':0x0,'rows':[]};var _0x2c41d8=_[_0x094b('0x2c')](db[_0x094b('0x2d')][_0x094b('0x2e')],function(_0x731c40){return{'name':_0x731c40[_0x094b('0x2f')],'type':_0x731c40[_0x094b('0x30')][_0x094b('0x31')]};});_0x387333[_0x094b('0x32')]=_[_0x094b('0x2c')](_0x2c41d8,_0x094b('0x2a'));_0x387333['query']=_[_0x094b('0x33')](_0x11e01d[_0x094b('0x34')]);_0x387333[_0x094b('0x35')]=_[_0x094b('0x36')](_0x387333['model'],_0x387333[_0x094b('0x34')]);_0x541dfb[_0x094b('0x37')]=_[_0x094b('0x36')](_0x387333[_0x094b('0x32')],qs[_0x094b('0x38')](_0x11e01d[_0x094b('0x34')][_0x094b('0x38')]));_0x541dfb[_0x094b('0x37')]=_0x541dfb[_0x094b('0x37')]['length']?_0x541dfb[_0x094b('0x37')]:_0x387333[_0x094b('0x32')];if(!_0x11e01d['query']['hasOwnProperty'](_0x094b('0x39'))){_0x541dfb[_0x094b('0x21')]=qs[_0x094b('0x21')](_0x11e01d[_0x094b('0x34')]['limit']);_0x541dfb[_0x094b('0x1f')]=qs[_0x094b('0x1f')](_0x11e01d[_0x094b('0x34')][_0x094b('0x1f')]);}_0x541dfb[_0x094b('0x3a')]=qs[_0x094b('0x3b')](_0x11e01d[_0x094b('0x34')][_0x094b('0x3b')]);_0x541dfb[_0x094b('0x3c')]=qs[_0x094b('0x35')](_[_0x094b('0x3d')](_0x11e01d[_0x094b('0x34')],_0x387333['filters']),_0x2c41d8);if(_0x11e01d[_0x094b('0x34')][_0x094b('0x3e')]){_0x541dfb[_0x094b('0x3c')]=_['merge'](_0x541dfb[_0x094b('0x3c')],{'$or':_[_0x094b('0x2c')](_0x2c41d8,function(_0x178b48){if(_0x178b48['type']!==_0x094b('0x3f')){var _0x83d7f={};_0x83d7f[_0x178b48['name']]={'$like':'%'+_0x11e01d[_0x094b('0x34')]['filter']+'%'};return _0x83d7f;}})});}_0x541dfb=_[_0x094b('0x40')]({},_0x541dfb,_0x11e01d[_0x094b('0x41')]);var _0x2e481d={'where':_0x541dfb[_0x094b('0x3c')]};return db[_0x094b('0x2d')][_0x094b('0x22')](_0x2e481d)[_0x094b('0x28')](function(_0x31fc57){_0x513003['count']=_0x31fc57;if(_0x11e01d[_0x094b('0x34')]['includeAll']){_0x541dfb[_0x094b('0x42')]=[{'all':!![]}];}return db[_0x094b('0x2d')][_0x094b('0x43')](_0x541dfb);})['then'](function(_0x3ca4a7){_0x513003[_0x094b('0x44')]=_0x3ca4a7;return _0x513003;})[_0x094b('0x28')](respondWithFilteredResult(_0xb7da4f,_0x541dfb))['catch'](handleError(_0xb7da4f,null));};exports[_0x094b('0x45')]=function(_0x58deeb,_0x5d2ac4){var _0x2814a1={'raw':![],'where':{'id':_0x58deeb[_0x094b('0x46')]['id']}},_0x2d53e7={};_0x2d53e7[_0x094b('0x32')]=_[_0x094b('0x33')](db['ZendeskConfiguration'][_0x094b('0x2e')]);_0x2d53e7[_0x094b('0x34')]=_[_0x094b('0x33')](_0x58deeb[_0x094b('0x34')]);_0x2d53e7[_0x094b('0x35')]=_['intersection'](_0x2d53e7['model'],_0x2d53e7[_0x094b('0x34')]);_0x2814a1[_0x094b('0x37')]=_[_0x094b('0x36')](_0x2d53e7[_0x094b('0x32')],qs[_0x094b('0x38')](_0x58deeb['query']['fields']));_0x2814a1[_0x094b('0x37')]=_0x2814a1[_0x094b('0x37')][_0x094b('0x47')]?_0x2814a1['attributes']:_0x2d53e7[_0x094b('0x32')];if(_0x58deeb['query'][_0x094b('0x48')]){_0x2814a1[_0x094b('0x42')]=[{'all':!![]}];}_0x2814a1=_[_0x094b('0x40')]({},_0x2814a1,_0x58deeb[_0x094b('0x41')]);return db['ZendeskConfiguration']['find'](_0x2814a1)[_0x094b('0x28')](handleEntityNotFound(_0x5d2ac4,null))['then'](respondWithResult(_0x5d2ac4,null))[_0x094b('0x49')](handleError(_0x5d2ac4,null));};exports[_0x094b('0x4a')]=function(_0x48ae0c,_0x1b88ae){return db[_0x094b('0x2d')]['create'](_0x48ae0c[_0x094b('0x4b')],{})[_0x094b('0x28')](respondWithResult(_0x1b88ae,0xc9))[_0x094b('0x49')](handleError(_0x1b88ae,null));};exports[_0x094b('0x4c')]=function(_0x2c2ba6,_0xe86b01){if(_0x2c2ba6[_0x094b('0x4b')]['id']){delete _0x2c2ba6[_0x094b('0x4b')]['id'];}return db[_0x094b('0x2d')]['find']({'where':{'id':_0x2c2ba6[_0x094b('0x46')]['id']}})[_0x094b('0x28')](handleEntityNotFound(_0xe86b01,null))[_0x094b('0x28')](saveUpdates(_0x2c2ba6[_0x094b('0x4b')],null))[_0x094b('0x28')](respondWithResult(_0xe86b01,null))['catch'](handleError(_0xe86b01,null));};exports[_0x094b('0x4d')]=function(_0x5080d1,_0x57dc10){return db[_0x094b('0x2d')]['find']({'where':{'id':_0x5080d1[_0x094b('0x46')]['id']}})[_0x094b('0x28')](handleEntityNotFound(_0x57dc10,null))['then'](removeEntity(_0x57dc10,null))[_0x094b('0x49')](handleError(_0x57dc10,null));};exports[_0x094b('0x4e')]=function(_0x383ac6,_0x2623f9,_0x566acb){var _0x1fb288={};var _0x404fc6={};var _0xd50e;var _0x540736;return db[_0x094b('0x2d')][_0x094b('0x4f')]({'where':{'id':_0x383ac6[_0x094b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2623f9,null))['then'](function(_0x1f0705){if(_0x1f0705){_0xd50e=_0x1f0705;_0x404fc6['model']=_['keys'](db[_0x094b('0x50')][_0x094b('0x2e')]);_0x404fc6[_0x094b('0x34')]=_['keys'](_0x383ac6[_0x094b('0x34')]);_0x404fc6[_0x094b('0x35')]=_['intersection'](_0x404fc6[_0x094b('0x32')],_0x404fc6[_0x094b('0x34')]);_0x1fb288[_0x094b('0x37')]=_[_0x094b('0x36')](_0x404fc6[_0x094b('0x32')],qs[_0x094b('0x38')](_0x383ac6['query'][_0x094b('0x38')]));_0x1fb288[_0x094b('0x37')]=_0x1fb288[_0x094b('0x37')][_0x094b('0x47')]?_0x1fb288[_0x094b('0x37')]:_0x404fc6[_0x094b('0x32')];_0x1fb288[_0x094b('0x3a')]=qs[_0x094b('0x3b')](_0x383ac6[_0x094b('0x34')][_0x094b('0x3b')]);_0x1fb288[_0x094b('0x3c')]=qs[_0x094b('0x35')](_[_0x094b('0x3d')](_0x383ac6[_0x094b('0x34')],_0x404fc6[_0x094b('0x35')]));if(_0x383ac6[_0x094b('0x34')][_0x094b('0x3e')]){_0x1fb288['where']=_[_0x094b('0x40')](_0x1fb288[_0x094b('0x3c')],{'$or':_[_0x094b('0x2c')](_0x1fb288[_0x094b('0x37')],function(_0x4e19c9){var _0x2896d3={};_0x2896d3[_0x4e19c9]={'$like':'%'+_0x383ac6[_0x094b('0x34')][_0x094b('0x3e')]+'%'};return _0x2896d3;})});}_0x1fb288=_['merge']({},_0x1fb288,_0x383ac6[_0x094b('0x41')]);return _0xd50e[_0x094b('0x4e')](_0x1fb288);}})['then'](function(_0x41cdfa){if(_0x41cdfa){_0x540736=_0x41cdfa[_0x094b('0x47')];if(!_0x383ac6[_0x094b('0x34')][_0x094b('0x51')](_0x094b('0x39'))){_0x1fb288[_0x094b('0x21')]=qs['limit'](_0x383ac6[_0x094b('0x34')]['limit']);_0x1fb288[_0x094b('0x1f')]=qs[_0x094b('0x1f')](_0x383ac6[_0x094b('0x34')]['offset']);}return _0xd50e['getFields'](_0x1fb288);}})[_0x094b('0x28')](function(_0x46e066){if(_0x46e066){return _0x46e066?{'count':_0x540736,'rows':_0x46e066}:null;}})[_0x094b('0x28')](respondWithResult(_0x2623f9,null))[_0x094b('0x49')](handleError(_0x2623f9,null));};exports[_0x094b('0x52')]=function(_0x1f1a8e,_0x1f1c71,_0x16b56c){var _0xedc91b={};var _0x1d7b07={};var _0x3e14ae;var _0x537d11;return db[_0x094b('0x2d')][_0x094b('0x4f')]({'where':{'id':_0x1f1a8e[_0x094b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f1c71,null))['then'](function(_0x1a9185){if(_0x1a9185){_0x3e14ae=_0x1a9185;_0x1d7b07[_0x094b('0x32')]=_[_0x094b('0x33')](db[_0x094b('0x50')][_0x094b('0x2e')]);_0x1d7b07[_0x094b('0x34')]=_[_0x094b('0x33')](_0x1f1a8e['query']);_0x1d7b07[_0x094b('0x35')]=_[_0x094b('0x36')](_0x1d7b07[_0x094b('0x32')],_0x1d7b07['query']);_0xedc91b[_0x094b('0x37')]=_[_0x094b('0x36')](_0x1d7b07[_0x094b('0x32')],qs[_0x094b('0x38')](_0x1f1a8e[_0x094b('0x34')][_0x094b('0x38')]));_0xedc91b[_0x094b('0x37')]=_0xedc91b['attributes'][_0x094b('0x47')]?_0xedc91b[_0x094b('0x37')]:_0x1d7b07[_0x094b('0x32')];_0xedc91b[_0x094b('0x3a')]=qs[_0x094b('0x3b')](_0x1f1a8e[_0x094b('0x34')][_0x094b('0x3b')]);_0xedc91b[_0x094b('0x3c')]=qs['filters'](_['pick'](_0x1f1a8e['query'],_0x1d7b07[_0x094b('0x35')]));if(_0x1f1a8e[_0x094b('0x34')][_0x094b('0x3e')]){_0xedc91b['where']=_[_0x094b('0x40')](_0xedc91b['where'],{'$or':_[_0x094b('0x2c')](_0xedc91b[_0x094b('0x37')],function(_0x2881ad){var _0x4c560f={};_0x4c560f[_0x2881ad]={'$like':'%'+_0x1f1a8e['query'][_0x094b('0x3e')]+'%'};return _0x4c560f;})});}_0xedc91b=_[_0x094b('0x40')]({},_0xedc91b,_0x1f1a8e[_0x094b('0x41')]);return _0x3e14ae['getSubjects'](_0xedc91b);}})[_0x094b('0x28')](function(_0x9b9c52){if(_0x9b9c52){_0x537d11=_0x9b9c52[_0x094b('0x47')];if(!_0x1f1a8e[_0x094b('0x34')][_0x094b('0x51')](_0x094b('0x39'))){_0xedc91b[_0x094b('0x21')]=qs['limit'](_0x1f1a8e[_0x094b('0x34')][_0x094b('0x21')]);_0xedc91b[_0x094b('0x1f')]=qs['offset'](_0x1f1a8e['query'][_0x094b('0x1f')]);}return _0x3e14ae[_0x094b('0x52')](_0xedc91b);}})[_0x094b('0x28')](function(_0x3c70c1){if(_0x3c70c1){return _0x3c70c1?{'count':_0x537d11,'rows':_0x3c70c1}:null;}})['then'](respondWithResult(_0x1f1c71,null))['catch'](handleError(_0x1f1c71,null));};exports[_0x094b('0x53')]=function(_0x44e565,_0x915be1,_0x4425fc){var _0x20f802={};var _0x2a0c84={};var _0x5133de;var _0x1cc21a;return db[_0x094b('0x2d')][_0x094b('0x4f')]({'where':{'id':_0x44e565[_0x094b('0x46')]['id']}})['then'](handleEntityNotFound(_0x915be1,null))[_0x094b('0x28')](function(_0x38919e){if(_0x38919e){_0x5133de=_0x38919e;_0x2a0c84[_0x094b('0x32')]=_[_0x094b('0x33')](db[_0x094b('0x50')][_0x094b('0x2e')]);_0x2a0c84['query']=_[_0x094b('0x33')](_0x44e565['query']);_0x2a0c84[_0x094b('0x35')]=_[_0x094b('0x36')](_0x2a0c84['model'],_0x2a0c84[_0x094b('0x34')]);_0x20f802[_0x094b('0x37')]=_[_0x094b('0x36')](_0x2a0c84[_0x094b('0x32')],qs[_0x094b('0x38')](_0x44e565['query'][_0x094b('0x38')]));_0x20f802[_0x094b('0x37')]=_0x20f802[_0x094b('0x37')][_0x094b('0x47')]?_0x20f802[_0x094b('0x37')]:_0x2a0c84['model'];_0x20f802[_0x094b('0x3a')]=qs[_0x094b('0x3b')](_0x44e565[_0x094b('0x34')]['sort']);_0x20f802['where']=qs[_0x094b('0x35')](_[_0x094b('0x3d')](_0x44e565[_0x094b('0x34')],_0x2a0c84[_0x094b('0x35')]));if(_0x44e565['query'][_0x094b('0x3e')]){_0x20f802['where']=_[_0x094b('0x40')](_0x20f802[_0x094b('0x3c')],{'$or':_[_0x094b('0x2c')](_0x20f802[_0x094b('0x37')],function(_0x489d82){var _0x4b9b76={};_0x4b9b76[_0x489d82]={'$like':'%'+_0x44e565[_0x094b('0x34')]['filter']+'%'};return _0x4b9b76;})});}_0x20f802=_[_0x094b('0x40')]({},_0x20f802,_0x44e565[_0x094b('0x41')]);return _0x5133de[_0x094b('0x53')](_0x20f802);}})[_0x094b('0x28')](function(_0x14574c){if(_0x14574c){_0x1cc21a=_0x14574c['length'];if(!_0x44e565[_0x094b('0x34')][_0x094b('0x51')](_0x094b('0x39'))){_0x20f802[_0x094b('0x21')]=qs[_0x094b('0x21')](_0x44e565[_0x094b('0x34')][_0x094b('0x21')]);_0x20f802[_0x094b('0x1f')]=qs['offset'](_0x44e565['query'][_0x094b('0x1f')]);}return _0x5133de[_0x094b('0x53')](_0x20f802);}})['then'](function(_0x16e827){if(_0x16e827){return _0x16e827?{'count':_0x1cc21a,'rows':_0x16e827}:null;}})[_0x094b('0x28')](respondWithResult(_0x915be1,null))[_0x094b('0x49')](handleError(_0x915be1,null));};exports['getTags']=function(_0x5dce62,_0xdcb309,_0x31c671){var _0x277afb={};var _0x41ee79={};var _0xc4ddc4;var _0x52e294;return db['ZendeskConfiguration'][_0x094b('0x4f')]({'where':{'id':_0x5dce62[_0x094b('0x46')]['id']}})['then'](handleEntityNotFound(_0xdcb309,null))[_0x094b('0x28')](function(_0x382740){if(_0x382740){_0xc4ddc4=_0x382740;_0x41ee79[_0x094b('0x32')]=_[_0x094b('0x33')](db[_0x094b('0x54')][_0x094b('0x2e')]);_0x41ee79['query']=_['keys'](_0x5dce62[_0x094b('0x34')]);_0x41ee79['filters']=_['intersection'](_0x41ee79['model'],_0x41ee79[_0x094b('0x34')]);_0x277afb['attributes']=_[_0x094b('0x36')](_0x41ee79[_0x094b('0x32')],qs['fields'](_0x5dce62[_0x094b('0x34')]['fields']));_0x277afb['attributes']=_0x277afb[_0x094b('0x37')][_0x094b('0x47')]?_0x277afb[_0x094b('0x37')]:_0x41ee79['model'];_0x277afb['order']=qs[_0x094b('0x3b')](_0x5dce62[_0x094b('0x34')][_0x094b('0x3b')]);_0x277afb[_0x094b('0x3c')]=qs[_0x094b('0x35')](_[_0x094b('0x3d')](_0x5dce62[_0x094b('0x34')],_0x41ee79[_0x094b('0x35')]));if(_0x5dce62[_0x094b('0x34')][_0x094b('0x3e')]){_0x277afb['where']=_[_0x094b('0x40')](_0x277afb[_0x094b('0x3c')],{'$or':_[_0x094b('0x2c')](_0x277afb[_0x094b('0x37')],function(_0x31945c){var _0x4995f0={};_0x4995f0[_0x31945c]={'$like':'%'+_0x5dce62['query'][_0x094b('0x3e')]+'%'};return _0x4995f0;})});}_0x277afb=_[_0x094b('0x40')]({},_0x277afb,_0x5dce62['options']);return _0xc4ddc4['getTags'](_0x277afb);}})['then'](function(_0x4dff85){if(_0x4dff85){_0x52e294=_0x4dff85['length'];if(!_0x5dce62[_0x094b('0x34')][_0x094b('0x51')](_0x094b('0x39'))){_0x277afb[_0x094b('0x21')]=qs['limit'](_0x5dce62[_0x094b('0x34')][_0x094b('0x21')]);_0x277afb[_0x094b('0x1f')]=qs[_0x094b('0x1f')](_0x5dce62[_0x094b('0x34')]['offset']);}return _0xc4ddc4[_0x094b('0x55')](_0x277afb);}})['then'](function(_0xd76589){if(_0xd76589){return _0xd76589?{'count':_0x52e294,'rows':_0xd76589}:null;}})[_0x094b('0x28')](respondWithResult(_0xdcb309,null))[_0x094b('0x49')](handleError(_0xdcb309,null));};exports[_0x094b('0x56')]=function(_0x1854b3,_0x52b278,_0x1bfe36){if(_0x1854b3['body']['id']){delete _0x1854b3[_0x094b('0x4b')]['id'];}return db[_0x094b('0x2d')]['findOne']({'where':{'id':_0x1854b3[_0x094b('0x46')]['id']}})[_0x094b('0x28')](handleEntityNotFound(_0x52b278,null))[_0x094b('0x28')](function(_0x5cb115){if(_0x5cb115){return _0x5cb115[_0x094b('0x56')](_0x1854b3['body'][_0x094b('0x57')]||[]);}return null;})['then'](respondWithResult(_0x52b278,null))[_0x094b('0x49')](handleError(_0x52b278,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c98cf79..c912a90 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 _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0x34b1b8,_0x54c9bf){var _0x542dd8=function(_0xff3f89){while(--_0xff3f89){_0x34b1b8['push'](_0x34b1b8['shift']());}};_0x542dd8(++_0x54c9bf);}(_0x4fc2,0x111));var _0x24fc=function(_0x29a91c,_0x5ac2c5){_0x29a91c=_0x29a91c-0x0;var _0x2ab4ff=_0x4fc2[_0x29a91c];return _0x2ab4ff;};'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 _0xb574=['./intZendeskConfiguration.attributes','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x339b1c,_0x21f42e){var _0x1a37f0=function(_0x41ea50){while(--_0x41ea50){_0x339b1c['push'](_0x339b1c['shift']());}};_0x1a37f0(++_0x21f42e);}(_0xb574,0x106));var _0x4b57=function(_0x20cdc4,_0x14b72e){_0x20cdc4=_0x20cdc4-0x0;var _0x13cd59=_0xb574[_0x20cdc4];return _0x13cd59;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require('../../config/logger')(_0x4b57('0x2'));var moment=require(_0x4b57('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b57('0x4'));var fs=require('fs');var path=require(_0x4b57('0x5'));var rimraf=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var attributes=require(_0x4b57('0x8'));module['exports']=function(_0x4eb019,_0x1c97e5){return _0x4eb019['define']('ZendeskConfiguration',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 bbe3f36..81daa88 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 _0x59e9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x1f2fef,_0x3a7011){var _0x21ee26=function(_0x4638a5){while(--_0x4638a5){_0x1f2fef['push'](_0x1f2fef['shift']());}};_0x21ee26(++_0x3a7011);}(_0x59e9,0xdd));var _0x959e=function(_0x48e216,_0x309fe7){_0x48e216=_0x48e216-0x0;var _0xfdaff7=_0x59e9[_0x48e216];return _0xfdaff7;};'use strict';var _=require(_0x959e('0x0'));var util=require(_0x959e('0x1'));var moment=require(_0x959e('0x2'));var BPromise=require(_0x959e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x959e('0x4'));var db=require(_0x959e('0x5'))['db'];var utils=require(_0x959e('0x6'));var logger=require(_0x959e('0x7'))(_0x959e('0x8'));var config=require(_0x959e('0x9'));var jayson=require(_0x959e('0xa'));var client=jayson[_0x959e('0xb')][_0x959e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x186c10,_0x29186f,_0x1644fc){return new BPromise(function(_0x366291,_0x57fe6d){return client[_0x959e('0xd')](_0x186c10,_0x1644fc)[_0x959e('0xe')](function(_0x36a5c3){logger[_0x959e('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x29186f,_0x959e('0x10'));logger[_0x959e('0x11')](_0x959e('0x12'),_0x29186f,_0x959e('0x10'),JSON[_0x959e('0x13')](_0x36a5c3));if(_0x36a5c3[_0x959e('0x14')]){if(_0x36a5c3[_0x959e('0x14')][_0x959e('0x15')]===0x1f4){logger[_0x959e('0x14')](_0x959e('0x16'),_0x29186f,_0x36a5c3['error']['message']);return _0x57fe6d(_0x36a5c3[_0x959e('0x14')][_0x959e('0x17')]);}logger[_0x959e('0x14')](_0x959e('0x16'),_0x29186f,_0x36a5c3[_0x959e('0x14')][_0x959e('0x17')]);return _0x366291(_0x36a5c3[_0x959e('0x14')][_0x959e('0x17')]);}else{logger[_0x959e('0xf')](_0x959e('0x16'),_0x29186f,'request\x20sent');_0x366291(_0x36a5c3['result'][_0x959e('0x17')]);}})[_0x959e('0x18')](function(_0x1886e1){logger[_0x959e('0x14')](_0x959e('0x16'),_0x29186f,_0x1886e1);_0x57fe6d(_0x1886e1);});});} \ No newline at end of file +var _0xddf4=['code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x23129b,_0x2d13ae){var _0x3b2fe9=function(_0x4cd6b7){while(--_0x4cd6b7){_0x23129b['push'](_0x23129b['shift']());}};_0x3b2fe9(++_0x2d13ae);}(_0xddf4,0xea));var _0x4ddf=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xddf4[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0x4ddf('0x0'));var util=require(_0x4ddf('0x1'));var moment=require(_0x4ddf('0x2'));var BPromise=require(_0x4ddf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ddf('0x4'));var db=require(_0x4ddf('0x5'))['db'];var utils=require(_0x4ddf('0x6'));var logger=require(_0x4ddf('0x7'))(_0x4ddf('0x8'));var config=require(_0x4ddf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ddf('0xa')][_0x4ddf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d7777,_0xc180fb,_0x322739){return new BPromise(function(_0x534fbc,_0x5bbd94){return client[_0x4ddf('0xc')](_0x3d7777,_0x322739)[_0x4ddf('0xd')](function(_0x5a73c2){logger['info'](_0x4ddf('0xe'),_0xc180fb,_0x4ddf('0xf'));logger[_0x4ddf('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xc180fb,_0x4ddf('0xf'),JSON[_0x4ddf('0x11')](_0x5a73c2));if(_0x5a73c2[_0x4ddf('0x12')]){if(_0x5a73c2['error'][_0x4ddf('0x13')]===0x1f4){logger[_0x4ddf('0x12')](_0x4ddf('0xe'),_0xc180fb,_0x5a73c2['error'][_0x4ddf('0x14')]);return _0x5bbd94(_0x5a73c2[_0x4ddf('0x12')][_0x4ddf('0x14')]);}logger[_0x4ddf('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0xc180fb,_0x5a73c2[_0x4ddf('0x12')][_0x4ddf('0x14')]);return _0x534fbc(_0x5a73c2[_0x4ddf('0x12')][_0x4ddf('0x14')]);}else{logger[_0x4ddf('0x15')](_0x4ddf('0xe'),_0xc180fb,_0x4ddf('0xf'));_0x534fbc(_0x5a73c2[_0x4ddf('0x16')][_0x4ddf('0x14')]);}})['catch'](function(_0x23e97c){logger[_0x4ddf('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0xc180fb,_0x23e97c);_0x5bbd94(_0x23e97c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ee0fef7..bbf3541 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 _0x4755=['/:id','show','post','create','update','delete','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5f02e6,_0x26ac3a){var _0x454b5e=function(_0x2e7d13){while(--_0x2e7d13){_0x5f02e6['push'](_0x5f02e6['shift']());}};_0x454b5e(++_0x26ac3a);}(_0x4755,0xba));var _0x5475=function(_0x2a2e72,_0x1de962){_0x2a2e72=_0x2a2e72-0x0;var _0x3cfb4a=_0x4755[_0x2a2e72];return _0x3cfb4a;};'use strict';var multer=require('multer');var util=require(_0x5475('0x0'));var path=require(_0x5475('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5475('0x2')]();var fs_extra=require(_0x5475('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5475('0x4'));var config=require(_0x5475('0x5'));var controller=require('./intZendeskField.controller');router[_0x5475('0x6')]('/',auth[_0x5475('0x7')](),controller[_0x5475('0x8')]);router['get'](_0x5475('0x9'),auth[_0x5475('0x7')](),controller[_0x5475('0xa')]);router[_0x5475('0xb')]('/',auth[_0x5475('0x7')](),controller[_0x5475('0xc')]);router['put']('/:id',auth[_0x5475('0x7')](),controller[_0x5475('0xd')]);router[_0x5475('0xe')]('/:id',auth[_0x5475('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x08cd=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','destroy','multer','util','path','Router','fs-extra'];(function(_0xf94a45,_0x24796a){var _0x2b2ee8=function(_0x108f08){while(--_0x108f08){_0xf94a45['push'](_0xf94a45['shift']());}};_0x2b2ee8(++_0x24796a);}(_0x08cd,0x1ae));var _0xd08c=function(_0x4091c5,_0x5102cd){_0x4091c5=_0x4091c5-0x0;var _0x1ac660=_0x08cd[_0x4091c5];return _0x1ac660;};'use strict';var multer=require(_0xd08c('0x0'));var util=require(_0xd08c('0x1'));var path=require(_0xd08c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd08c('0x3')]();var fs_extra=require(_0xd08c('0x4'));var auth=require(_0xd08c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd08c('0x6'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xd08c('0x7')](),controller[_0xd08c('0x8')]);router[_0xd08c('0x9')](_0xd08c('0xa'),auth[_0xd08c('0x7')](),controller[_0xd08c('0xb')]);router[_0xd08c('0xc')]('/',auth[_0xd08c('0x7')](),controller[_0xd08c('0xd')]);router['put'](_0xd08c('0xa'),auth[_0xd08c('0x7')](),controller['update']);router['delete'](_0xd08c('0xa'),auth[_0xd08c('0x7')](),controller[_0xd08c('0xe')]);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 b2625ea..c00652a 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 _0xa88b=['customVariable','keyValue','picklist','STRING','exports','ENUM','string','variable'];(function(_0x4f5185,_0x346568){var _0x1c9c2d=function(_0x5c458d){while(--_0x5c458d){_0x4f5185['push'](_0x4f5185['shift']());}};_0x1c9c2d(++_0x346568);}(_0xa88b,0x1e4));var _0xba88=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0xa88b[_0xf2f332];return _0x56cce3;};'use strict';var Sequelize=require('sequelize');module[_0xba88('0x0')]={'type':{'type':Sequelize[_0xba88('0x1')](_0xba88('0x2'),_0xba88('0x3'),_0xba88('0x4'),_0xba88('0x5'),_0xba88('0x6')),'defaultValue':_0xba88('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xba88('0x1')]('string',_0xba88('0x3'),_0xba88('0x4'))},'keyContent':{'type':Sequelize[_0xba88('0x7')]},'idField':{'type':Sequelize[_0xba88('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba88('0x7')]}}; \ No newline at end of file +var _0xcecc=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0xcecc,0x1c0));var _0xccec=function(_0x5e6815,_0x322750){_0x5e6815=_0x5e6815-0x0;var _0x5e4a69=_0xcecc[_0x5e6815];return _0x5e4a69;};'use strict';var Sequelize=require(_0xccec('0x0'));module[_0xccec('0x1')]={'type':{'type':Sequelize[_0xccec('0x2')](_0xccec('0x3'),_0xccec('0x4'),_0xccec('0x5'),'keyValue',_0xccec('0x6')),'defaultValue':_0xccec('0x3')},'content':{'type':Sequelize[_0xccec('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xccec('0x2')](_0xccec('0x3'),_0xccec('0x4'),_0xccec('0x5'))},'keyContent':{'type':Sequelize[_0xccec('0x7')]},'idField':{'type':Sequelize[_0xccec('0x7')]},'nameField':{'type':Sequelize[_0xccec('0x7')]},'customField':{'type':Sequelize[_0xccec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xccec('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1e8b386..048f479 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 _0x500f=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','save','update','then','destroy','error','send','index','map','ZendeskField','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2d4524,_0x27fc37){var _0x5745a1=function(_0x24d38e){while(--_0x24d38e){_0x2d4524['push'](_0x2d4524['shift']());}};_0x5745a1(++_0x27fc37);}(_0x500f,0x1d5));var _0xf500=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x500f[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xf500('0x0'));var rimraf=require(_0xf500('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf500('0x2'));var rp=require(_0xf500('0x3'));var moment=require(_0xf500('0x4'));var BPromise=require(_0xf500('0x5'));var Mustache=require(_0xf500('0x6'));var util=require(_0xf500('0x7'));var path=require('path');var sox=require(_0xf500('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf500('0x9'));var _=require(_0xf500('0xa'));var squel=require(_0xf500('0xb'));var crypto=require(_0xf500('0xc'));var jsforce=require(_0xf500('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf500('0xe'));var Papa=require(_0xf500('0xf'));var Redis=require(_0xf500('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf500('0x11'));var as=require(_0xf500('0x12'));var hardwareService=require(_0xf500('0x13'));var logger=require(_0xf500('0x14'))(_0xf500('0x15'));var utils=require(_0xf500('0x16'));var config=require(_0xf500('0x17'));var licenseUtil=require(_0xf500('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d83b9,_0x52de0f){_0x52de0f=_0x52de0f||0xcc;return function(_0x45b6f1){if(_0x45b6f1){return _0x5d83b9[_0xf500('0x19')](_0x52de0f);}return _0x5d83b9[_0xf500('0x1a')](_0x52de0f)[_0xf500('0x1b')]();};}function respondWithResult(_0x1f00db,_0x4522d7){_0x4522d7=_0x4522d7||0xc8;return function(_0x3a4467){if(_0x3a4467){return _0x1f00db[_0xf500('0x1a')](_0x4522d7)['json'](_0x3a4467);}};}function respondWithFilteredResult(_0x25fae8,_0x1c293f){return function(_0x3f9a34){if(_0x3f9a34){var _0x788563=typeof _0x1c293f['offset']===_0xf500('0x1c')&&typeof _0x1c293f[_0xf500('0x1d')]===_0xf500('0x1c');var _0x55b2a4=_0x3f9a34[_0xf500('0x1e')];var _0x32a187=_0x788563?0x0:_0x1c293f[_0xf500('0x1f')];var _0x4cc885=_0x788563?_0x3f9a34[_0xf500('0x1e')]:_0x1c293f[_0xf500('0x1f')]+_0x1c293f[_0xf500('0x1d')];var _0xb654;if(_0x4cc885>=_0x55b2a4){_0x4cc885=_0x55b2a4;_0xb654=0xc8;}else{_0xb654=0xce;}_0x25fae8[_0xf500('0x1a')](_0xb654);return _0x25fae8['set'](_0xf500('0x20'),_0x32a187+'-'+_0x4cc885+'/'+_0x55b2a4)['json'](_0x3f9a34);}return null;};}function patchUpdates(_0x309453){return function(_0x405adc){try{jsonpatch['apply'](_0x405adc,_0x309453,!![]);}catch(_0x3117cb){return BPromise['reject'](_0x3117cb);}return _0x405adc[_0xf500('0x21')]();};}function saveUpdates(_0x5e76b2,_0x4c9cc9){return function(_0x437e96){if(_0x437e96){return _0x437e96[_0xf500('0x22')](_0x5e76b2)[_0xf500('0x23')](function(_0x159f22){return _0x159f22;});}return null;};}function removeEntity(_0x1ca5b6,_0x58df06){return function(_0x45c8f5){if(_0x45c8f5){return _0x45c8f5[_0xf500('0x24')]()[_0xf500('0x23')](function(){_0x1ca5b6[_0xf500('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f6ae,_0x3029be){return function(_0x4627c4){if(!_0x4627c4){_0x22f6ae[_0xf500('0x19')](0x194);}return _0x4627c4;};}function handleError(_0x46310d,_0x4a8fe8){_0x4a8fe8=_0x4a8fe8||0x1f4;return function(_0x5e4240){logger[_0xf500('0x25')](_0x5e4240['stack']);if(_0x5e4240['name']){delete _0x5e4240['name'];}_0x46310d[_0xf500('0x1a')](_0x4a8fe8)[_0xf500('0x26')](_0x5e4240);};}exports[_0xf500('0x27')]=function(_0x2cac77,_0xe2f0d5){var _0x6139e8={},_0xc5664f={},_0x2c9de7={'count':0x0,'rows':[]};var _0x1448ee=_[_0xf500('0x28')](db[_0xf500('0x29')][_0xf500('0x2a')],function(_0x756d22){return{'name':_0x756d22[_0xf500('0x2b')],'type':_0x756d22[_0xf500('0x2c')]['key']};});_0xc5664f[_0xf500('0x2d')]=_[_0xf500('0x28')](_0x1448ee,_0xf500('0x2e'));_0xc5664f['query']=_[_0xf500('0x2f')](_0x2cac77[_0xf500('0x30')]);_0xc5664f[_0xf500('0x31')]=_[_0xf500('0x32')](_0xc5664f[_0xf500('0x2d')],_0xc5664f[_0xf500('0x30')]);_0x6139e8[_0xf500('0x33')]=_[_0xf500('0x32')](_0xc5664f[_0xf500('0x2d')],qs[_0xf500('0x34')](_0x2cac77[_0xf500('0x30')][_0xf500('0x34')]));_0x6139e8[_0xf500('0x33')]=_0x6139e8[_0xf500('0x33')][_0xf500('0x35')]?_0x6139e8[_0xf500('0x33')]:_0xc5664f[_0xf500('0x2d')];if(!_0x2cac77[_0xf500('0x30')]['hasOwnProperty']('nolimit')){_0x6139e8[_0xf500('0x1d')]=qs[_0xf500('0x1d')](_0x2cac77[_0xf500('0x30')]['limit']);_0x6139e8['offset']=qs[_0xf500('0x1f')](_0x2cac77[_0xf500('0x30')][_0xf500('0x1f')]);}_0x6139e8[_0xf500('0x36')]=qs[_0xf500('0x37')](_0x2cac77[_0xf500('0x30')][_0xf500('0x37')]);_0x6139e8['where']=qs['filters'](_['pick'](_0x2cac77[_0xf500('0x30')],_0xc5664f['filters']),_0x1448ee);if(_0x2cac77['query'][_0xf500('0x38')]){_0x6139e8[_0xf500('0x39')]=_[_0xf500('0x3a')](_0x6139e8[_0xf500('0x39')],{'$or':_[_0xf500('0x28')](_0x1448ee,function(_0x269c6a){if(_0x269c6a['type']!==_0xf500('0x3b')){var _0x11b2e5={};_0x11b2e5[_0x269c6a[_0xf500('0x2e')]]={'$like':'%'+_0x2cac77[_0xf500('0x30')][_0xf500('0x38')]+'%'};return _0x11b2e5;}})});}_0x6139e8=_[_0xf500('0x3a')]({},_0x6139e8,_0x2cac77['options']);var _0x1f5709={'where':_0x6139e8[_0xf500('0x39')]};return db[_0xf500('0x29')][_0xf500('0x1e')](_0x1f5709)[_0xf500('0x23')](function(_0x32fefd){_0x2c9de7['count']=_0x32fefd;if(_0x2cac77[_0xf500('0x30')][_0xf500('0x3c')]){_0x6139e8[_0xf500('0x3d')]=[{'all':!![]}];}return db[_0xf500('0x29')][_0xf500('0x3e')](_0x6139e8);})['then'](function(_0x249ab6){_0x2c9de7['rows']=_0x249ab6;return _0x2c9de7;})['then'](respondWithFilteredResult(_0xe2f0d5,_0x6139e8))[_0xf500('0x3f')](handleError(_0xe2f0d5,null));};exports['show']=function(_0x19e3ac,_0xa548c2){var _0x445c84={'raw':!![],'where':{'id':_0x19e3ac[_0xf500('0x40')]['id']}},_0x1e0f37={};_0x1e0f37[_0xf500('0x2d')]=_[_0xf500('0x2f')](db['ZendeskField'][_0xf500('0x2a')]);_0x1e0f37[_0xf500('0x30')]=_[_0xf500('0x2f')](_0x19e3ac['query']);_0x1e0f37[_0xf500('0x31')]=_[_0xf500('0x32')](_0x1e0f37[_0xf500('0x2d')],_0x1e0f37['query']);_0x445c84[_0xf500('0x33')]=_[_0xf500('0x32')](_0x1e0f37[_0xf500('0x2d')],qs[_0xf500('0x34')](_0x19e3ac['query'][_0xf500('0x34')]));_0x445c84['attributes']=_0x445c84[_0xf500('0x33')]['length']?_0x445c84['attributes']:_0x1e0f37[_0xf500('0x2d')];if(_0x19e3ac[_0xf500('0x30')][_0xf500('0x3c')]){_0x445c84[_0xf500('0x3d')]=[{'all':!![]}];}_0x445c84=_['merge']({},_0x445c84,_0x19e3ac[_0xf500('0x41')]);return db[_0xf500('0x29')][_0xf500('0x42')](_0x445c84)[_0xf500('0x23')](handleEntityNotFound(_0xa548c2,null))[_0xf500('0x23')](respondWithResult(_0xa548c2,null))[_0xf500('0x3f')](handleError(_0xa548c2,null));};exports[_0xf500('0x43')]=function(_0x36a5a2,_0x233aed){return db[_0xf500('0x29')][_0xf500('0x43')](_0x36a5a2[_0xf500('0x44')],{})['then'](respondWithResult(_0x233aed,0xc9))['catch'](handleError(_0x233aed,null));};exports[_0xf500('0x22')]=function(_0x2c0907,_0x435250){if(_0x2c0907[_0xf500('0x44')]['id']){delete _0x2c0907[_0xf500('0x44')]['id'];}return db[_0xf500('0x29')][_0xf500('0x42')]({'where':{'id':_0x2c0907['params']['id']}})[_0xf500('0x23')](handleEntityNotFound(_0x435250,null))['then'](saveUpdates(_0x2c0907[_0xf500('0x44')],null))[_0xf500('0x23')](respondWithResult(_0x435250,null))[_0xf500('0x3f')](handleError(_0x435250,null));};exports[_0xf500('0x24')]=function(_0x3137a8,_0x1106e0){return db['ZendeskField'][_0xf500('0x42')]({'where':{'id':_0x3137a8['params']['id']}})['then'](handleEntityNotFound(_0x1106e0,null))[_0xf500('0x23')](removeEntity(_0x1106e0,null))[_0xf500('0x3f')](handleError(_0x1106e0,null));}; \ No newline at end of file +var _0x15b7=['send','index','map','ZendeskField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','apply','save','then','destroy','error','stack','name','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x15b7,0x13a));var _0x715b=function(_0x54dfe4,_0x13c62d){_0x54dfe4=_0x54dfe4-0x0;var _0x2b8482=_0x15b7[_0x54dfe4];return _0x2b8482;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x715b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x715b('0x1'));var moment=require(_0x715b('0x2'));var BPromise=require(_0x715b('0x3'));var Mustache=require('mustache');var util=require(_0x715b('0x4'));var path=require(_0x715b('0x5'));var sox=require(_0x715b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x715b('0x7'));var _=require(_0x715b('0x8'));var squel=require(_0x715b('0x9'));var crypto=require(_0x715b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x715b('0xb'));var querystring=require('querystring');var Papa=require(_0x715b('0xc'));var Redis=require(_0x715b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x715b('0xe'));var as=require(_0x715b('0xf'));var hardwareService=require(_0x715b('0x10'));var logger=require(_0x715b('0x11'))('api');var utils=require(_0x715b('0x12'));var config=require(_0x715b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x715b('0x14'))['db'];function respondWithStatusCode(_0x2f341b,_0x2cd619){_0x2cd619=_0x2cd619||0xcc;return function(_0x429c05){if(_0x429c05){return _0x2f341b[_0x715b('0x15')](_0x2cd619);}return _0x2f341b['status'](_0x2cd619)[_0x715b('0x16')]();};}function respondWithResult(_0x5a42ac,_0xb623be){_0xb623be=_0xb623be||0xc8;return function(_0x1b1267){if(_0x1b1267){return _0x5a42ac['status'](_0xb623be)[_0x715b('0x17')](_0x1b1267);}};}function respondWithFilteredResult(_0x5004a6,_0x48e194){return function(_0x18d021){if(_0x18d021){var _0x31b79e=typeof _0x48e194[_0x715b('0x18')]==='undefined'&&typeof _0x48e194[_0x715b('0x19')]===_0x715b('0x1a');var _0x3fa454=_0x18d021[_0x715b('0x1b')];var _0x27d498=_0x31b79e?0x0:_0x48e194[_0x715b('0x18')];var _0x3d8207=_0x31b79e?_0x18d021[_0x715b('0x1b')]:_0x48e194[_0x715b('0x18')]+_0x48e194[_0x715b('0x19')];var _0x5c731e;if(_0x3d8207>=_0x3fa454){_0x3d8207=_0x3fa454;_0x5c731e=0xc8;}else{_0x5c731e=0xce;}_0x5004a6['status'](_0x5c731e);return _0x5004a6['set']('Content-Range',_0x27d498+'-'+_0x3d8207+'/'+_0x3fa454)[_0x715b('0x17')](_0x18d021);}return null;};}function patchUpdates(_0x4bb35a){return function(_0x105f47){try{jsonpatch[_0x715b('0x1c')](_0x105f47,_0x4bb35a,!![]);}catch(_0x5991c9){return BPromise['reject'](_0x5991c9);}return _0x105f47[_0x715b('0x1d')]();};}function saveUpdates(_0x445929,_0x841c76){return function(_0x18695e){if(_0x18695e){return _0x18695e['update'](_0x445929)[_0x715b('0x1e')](function(_0xf1fbd5){return _0xf1fbd5;});}return null;};}function removeEntity(_0x58e6c5,_0x434827){return function(_0x2bda78){if(_0x2bda78){return _0x2bda78[_0x715b('0x1f')]()[_0x715b('0x1e')](function(){_0x58e6c5['status'](0xcc)[_0x715b('0x16')]();});}};}function handleEntityNotFound(_0x426af1,_0x24828c){return function(_0x48a4d3){if(!_0x48a4d3){_0x426af1['sendStatus'](0x194);}return _0x48a4d3;};}function handleError(_0xf7992a,_0x1e6a68){_0x1e6a68=_0x1e6a68||0x1f4;return function(_0x2465cd){logger[_0x715b('0x20')](_0x2465cd[_0x715b('0x21')]);if(_0x2465cd[_0x715b('0x22')]){delete _0x2465cd['name'];}_0xf7992a[_0x715b('0x23')](_0x1e6a68)[_0x715b('0x24')](_0x2465cd);};}exports[_0x715b('0x25')]=function(_0x52eb5c,_0x2cb4f7){var _0x48eafa={},_0x5af092={},_0x4b1ff7={'count':0x0,'rows':[]};var _0x3c02ef=_[_0x715b('0x26')](db[_0x715b('0x27')]['rawAttributes'],function(_0x1ee1ec){return{'name':_0x1ee1ec[_0x715b('0x28')],'type':_0x1ee1ec[_0x715b('0x29')]['key']};});_0x5af092[_0x715b('0x2a')]=_[_0x715b('0x26')](_0x3c02ef,_0x715b('0x22'));_0x5af092[_0x715b('0x2b')]=_[_0x715b('0x2c')](_0x52eb5c[_0x715b('0x2b')]);_0x5af092[_0x715b('0x2d')]=_[_0x715b('0x2e')](_0x5af092[_0x715b('0x2a')],_0x5af092[_0x715b('0x2b')]);_0x48eafa[_0x715b('0x2f')]=_[_0x715b('0x2e')](_0x5af092[_0x715b('0x2a')],qs['fields'](_0x52eb5c[_0x715b('0x2b')][_0x715b('0x30')]));_0x48eafa[_0x715b('0x2f')]=_0x48eafa['attributes'][_0x715b('0x31')]?_0x48eafa[_0x715b('0x2f')]:_0x5af092[_0x715b('0x2a')];if(!_0x52eb5c[_0x715b('0x2b')][_0x715b('0x32')](_0x715b('0x33'))){_0x48eafa['limit']=qs[_0x715b('0x19')](_0x52eb5c[_0x715b('0x2b')][_0x715b('0x19')]);_0x48eafa['offset']=qs[_0x715b('0x18')](_0x52eb5c['query'][_0x715b('0x18')]);}_0x48eafa[_0x715b('0x34')]=qs[_0x715b('0x35')](_0x52eb5c[_0x715b('0x2b')][_0x715b('0x35')]);_0x48eafa[_0x715b('0x36')]=qs[_0x715b('0x2d')](_[_0x715b('0x37')](_0x52eb5c[_0x715b('0x2b')],_0x5af092[_0x715b('0x2d')]),_0x3c02ef);if(_0x52eb5c[_0x715b('0x2b')][_0x715b('0x38')]){_0x48eafa[_0x715b('0x36')]=_[_0x715b('0x39')](_0x48eafa['where'],{'$or':_['map'](_0x3c02ef,function(_0x3b52e9){if(_0x3b52e9[_0x715b('0x29')]!=='VIRTUAL'){var _0x4b3d7d={};_0x4b3d7d[_0x3b52e9[_0x715b('0x22')]]={'$like':'%'+_0x52eb5c[_0x715b('0x2b')][_0x715b('0x38')]+'%'};return _0x4b3d7d;}})});}_0x48eafa=_[_0x715b('0x39')]({},_0x48eafa,_0x52eb5c[_0x715b('0x3a')]);var _0x105523={'where':_0x48eafa[_0x715b('0x36')]};return db[_0x715b('0x27')]['count'](_0x105523)[_0x715b('0x1e')](function(_0x3b3aa6){_0x4b1ff7[_0x715b('0x1b')]=_0x3b3aa6;if(_0x52eb5c['query'][_0x715b('0x3b')]){_0x48eafa[_0x715b('0x3c')]=[{'all':!![]}];}return db['ZendeskField'][_0x715b('0x3d')](_0x48eafa);})[_0x715b('0x1e')](function(_0x4cbbd7){_0x4b1ff7[_0x715b('0x3e')]=_0x4cbbd7;return _0x4b1ff7;})[_0x715b('0x1e')](respondWithFilteredResult(_0x2cb4f7,_0x48eafa))['catch'](handleError(_0x2cb4f7,null));};exports[_0x715b('0x3f')]=function(_0x273171,_0x5466eb){var _0x5870f0={'raw':!![],'where':{'id':_0x273171[_0x715b('0x40')]['id']}},_0x220764={};_0x220764['model']=_[_0x715b('0x2c')](db[_0x715b('0x27')][_0x715b('0x41')]);_0x220764[_0x715b('0x2b')]=_[_0x715b('0x2c')](_0x273171[_0x715b('0x2b')]);_0x220764[_0x715b('0x2d')]=_['intersection'](_0x220764[_0x715b('0x2a')],_0x220764[_0x715b('0x2b')]);_0x5870f0[_0x715b('0x2f')]=_[_0x715b('0x2e')](_0x220764['model'],qs['fields'](_0x273171[_0x715b('0x2b')][_0x715b('0x30')]));_0x5870f0['attributes']=_0x5870f0[_0x715b('0x2f')]['length']?_0x5870f0['attributes']:_0x220764[_0x715b('0x2a')];if(_0x273171[_0x715b('0x2b')]['includeAll']){_0x5870f0['include']=[{'all':!![]}];}_0x5870f0=_[_0x715b('0x39')]({},_0x5870f0,_0x273171[_0x715b('0x3a')]);return db['ZendeskField'][_0x715b('0x42')](_0x5870f0)[_0x715b('0x1e')](handleEntityNotFound(_0x5466eb,null))[_0x715b('0x1e')](respondWithResult(_0x5466eb,null))[_0x715b('0x43')](handleError(_0x5466eb,null));};exports['create']=function(_0xba6178,_0x13eae8){return db[_0x715b('0x27')][_0x715b('0x44')](_0xba6178[_0x715b('0x45')],{})['then'](respondWithResult(_0x13eae8,0xc9))[_0x715b('0x43')](handleError(_0x13eae8,null));};exports['update']=function(_0x143d4b,_0x5c740a){if(_0x143d4b[_0x715b('0x45')]['id']){delete _0x143d4b[_0x715b('0x45')]['id'];}return db[_0x715b('0x27')]['find']({'where':{'id':_0x143d4b[_0x715b('0x40')]['id']}})[_0x715b('0x1e')](handleEntityNotFound(_0x5c740a,null))[_0x715b('0x1e')](saveUpdates(_0x143d4b[_0x715b('0x45')],null))['then'](respondWithResult(_0x5c740a,null))[_0x715b('0x43')](handleError(_0x5c740a,null));};exports[_0x715b('0x1f')]=function(_0x5df3f1,_0x9498f5){return db[_0x715b('0x27')]['find']({'where':{'id':_0x5df3f1[_0x715b('0x40')]['id']}})[_0x715b('0x1e')](handleEntityNotFound(_0x9498f5,null))[_0x715b('0x1e')](removeEntity(_0x9498f5,null))[_0x715b('0x43')](handleError(_0x9498f5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f7516a1..403cf4a 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 _0xc8e0=['api','bluebird','request-promise','path','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3a16d4,_0x23ecda){var _0x31ea9c=function(_0x35fea8){while(--_0x35fea8){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x31ea9c(++_0x23ecda);}(_0xc8e0,0x84));var _0x0c8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc8e0[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x0c8e('0x0'));var util=require(_0x0c8e('0x1'));var logger=require(_0x0c8e('0x2'))(_0x0c8e('0x3'));var moment=require('moment');var BPromise=require(_0x0c8e('0x4'));var rp=require(_0x0c8e('0x5'));var fs=require('fs');var path=require(_0x0c8e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0c8e('0x7'));module[_0x0c8e('0x8')]=function(_0x19b57b,_0x10db21){return _0x19b57b[_0x0c8e('0x9')](_0x0c8e('0xa'),attributes,{'tableName':_0x0c8e('0xb'),'paranoid':![],'indexes':[{'name':_0x0c8e('0xc'),'fields':[_0x0c8e('0xd'),_0x0c8e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a0f=['idField','util','api','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','define','ZendeskField'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9a0f,0x15f));var _0xf9a0=function(_0x5cfe2c,_0x281794){_0x5cfe2c=_0x5cfe2c-0x0;var _0x94d05a=_0x9a0f[_0x5cfe2c];return _0x94d05a;};'use strict';var _=require('lodash');var util=require(_0xf9a0('0x0'));var logger=require('../../config/logger')(_0xf9a0('0x1'));var moment=require(_0xf9a0('0x2'));var BPromise=require(_0xf9a0('0x3'));var rp=require(_0xf9a0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf9a0('0x5'));var attributes=require(_0xf9a0('0x6'));module['exports']=function(_0x5c4ad9,_0x583edf){return _0x5c4ad9[_0xf9a0('0x7')](_0xf9a0('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xf9a0('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index fd2b9c4..f381d6a 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 _0x7f1b=['util','ioredis','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7f1b,0x198));var _0xb7f1=function(_0x1b7c25,_0xd9a4df){_0x1b7c25=_0x1b7c25-0x0;var _0x548eba=_0x7f1b[_0x1b7c25];return _0x548eba;};'use strict';var _=require('lodash');var util=require(_0xb7f1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7f1('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb7f1('0x2'));var config=require('../../config/environment');var jayson=require(_0xb7f1('0x3'));var client=jayson[_0xb7f1('0x4')][_0xb7f1('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3fd613,_0x4cc89c,_0x36aa2e){return new BPromise(function(_0x5b4819,_0x7708cc){return client['request'](_0x3fd613,_0x36aa2e)[_0xb7f1('0x6')](function(_0x3cc73e){logger[_0xb7f1('0x7')]('ZendeskField,\x20%s,\x20%s',_0x4cc89c,_0xb7f1('0x8'));logger[_0xb7f1('0x9')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4cc89c,_0xb7f1('0x8'),JSON[_0xb7f1('0xa')](_0x3cc73e));if(_0x3cc73e[_0xb7f1('0xb')]){if(_0x3cc73e[_0xb7f1('0xb')][_0xb7f1('0xc')]===0x1f4){logger['error'](_0xb7f1('0xd'),_0x4cc89c,_0x3cc73e['error'][_0xb7f1('0xe')]);return _0x7708cc(_0x3cc73e[_0xb7f1('0xb')]['message']);}logger[_0xb7f1('0xb')]('ZendeskField,\x20%s,\x20%s',_0x4cc89c,_0x3cc73e[_0xb7f1('0xb')][_0xb7f1('0xe')]);return _0x5b4819(_0x3cc73e[_0xb7f1('0xb')][_0xb7f1('0xe')]);}else{logger[_0xb7f1('0x7')]('ZendeskField,\x20%s,\x20%s',_0x4cc89c,_0xb7f1('0x8'));_0x5b4819(_0x3cc73e[_0xb7f1('0xf')][_0xb7f1('0xe')]);}})[_0xb7f1('0x10')](function(_0x483ae2){logger['error'](_0xb7f1('0xd'),_0x4cc89c,_0x483ae2);_0x7708cc(_0x483ae2);});});} \ No newline at end of file +var _0x390a=['../../config/logger','rpc','../../config/environment','client','http','then','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x308881,_0x267509){var _0x1086c3=function(_0x5aea40){while(--_0x5aea40){_0x308881['push'](_0x308881['shift']());}};_0x1086c3(++_0x267509);}(_0x390a,0x177));var _0xa390=function(_0x2b80f4,_0x587a50){_0x2b80f4=_0x2b80f4-0x0;var _0x86804c=_0x390a[_0x2b80f4];return _0x86804c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa390('0x0'));var BPromise=require(_0xa390('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa390('0x2'));var db=require(_0xa390('0x3'))['db'];var utils=require(_0xa390('0x4'));var logger=require(_0xa390('0x5'))(_0xa390('0x6'));var config=require(_0xa390('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa390('0x8')][_0xa390('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e6fff,_0x3f115f,_0x35facd){return new BPromise(function(_0x51f9a4,_0x3d5a7c){return client['request'](_0x3e6fff,_0x35facd)[_0xa390('0xa')](function(_0x5a436f){logger['info'](_0xa390('0xb'),_0x3f115f,'request\x20sent');logger[_0xa390('0xc')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3f115f,_0xa390('0xd'),JSON[_0xa390('0xe')](_0x5a436f));if(_0x5a436f[_0xa390('0xf')]){if(_0x5a436f['error'][_0xa390('0x10')]===0x1f4){logger[_0xa390('0xf')]('ZendeskField,\x20%s,\x20%s',_0x3f115f,_0x5a436f[_0xa390('0xf')][_0xa390('0x11')]);return _0x3d5a7c(_0x5a436f['error'][_0xa390('0x11')]);}logger[_0xa390('0xf')](_0xa390('0xb'),_0x3f115f,_0x5a436f[_0xa390('0xf')][_0xa390('0x11')]);return _0x51f9a4(_0x5a436f[_0xa390('0xf')][_0xa390('0x11')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x3f115f,_0xa390('0xd'));_0x51f9a4(_0x5a436f[_0xa390('0x12')][_0xa390('0x11')]);}})[_0xa390('0x13')](function(_0x421f00){logger['error'](_0xa390('0xb'),_0x3f115f,_0x421f00);_0x3d5a7c(_0x421f00);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 49ac100..a03b003 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 _0x147f=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x147f,0x141));var _0xf147=function(_0x59ebfc,_0x2b13e7){_0x59ebfc=_0x59ebfc-0x0;var _0x5484c9=_0x147f[_0x59ebfc];return _0x5484c9;};'use strict';var multer=require(_0xf147('0x0'));var util=require(_0xf147('0x1'));var path=require(_0xf147('0x2'));var timeout=require(_0xf147('0x3'));var express=require(_0xf147('0x4'));var router=express[_0xf147('0x5')]();var fs_extra=require(_0xf147('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf147('0x7'));var config=require(_0xf147('0x8'));var controller=require(_0xf147('0x9'));router['get']('/',auth[_0xf147('0xa')](),controller[_0xf147('0xb')]);router[_0xf147('0xc')]('/:id',auth[_0xf147('0xa')](),controller[_0xf147('0xd')]);router[_0xf147('0xc')](_0xf147('0xe'),auth['isAuthenticated'](),controller[_0xf147('0xf')]);router[_0xf147('0xc')](_0xf147('0x10'),auth[_0xf147('0xa')](),controller[_0xf147('0x11')]);router['post']('/',auth[_0xf147('0xa')](),controller[_0xf147('0x12')]);router['post'](_0xf147('0xe'),auth[_0xf147('0xa')](),controller[_0xf147('0x13')]);router[_0xf147('0x14')](_0xf147('0x15'),auth[_0xf147('0xa')](),controller[_0xf147('0x16')]);router[_0xf147('0x17')](_0xf147('0x15'),auth['isAuthenticated'](),controller[_0xf147('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb06e=['show','/:id/configurations','get','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb06e,0x1d8));var _0xeb06=function(_0x2ddb37,_0x4fa2bb){_0x2ddb37=_0x2ddb37-0x0;var _0x326b70=_0xb06e[_0x2ddb37];return _0x326b70;};'use strict';var multer=require('multer');var util=require(_0xeb06('0x0'));var path=require(_0xeb06('0x1'));var timeout=require(_0xeb06('0x2'));var express=require(_0xeb06('0x3'));var router=express['Router']();var fs_extra=require(_0xeb06('0x4'));var auth=require(_0xeb06('0x5'));var interaction=require(_0xeb06('0x6'));var config=require(_0xeb06('0x7'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xeb06('0x8')](),controller[_0xeb06('0x9')]);router['get'](_0xeb06('0xa'),auth[_0xeb06('0x8')](),controller[_0xeb06('0xb')]);router['get'](_0xeb06('0xc'),auth[_0xeb06('0x8')](),controller['getConfigurations']);router[_0xeb06('0xd')](_0xeb06('0xe'),auth[_0xeb06('0x8')](),controller[_0xeb06('0xf')]);router[_0xeb06('0x10')]('/',auth[_0xeb06('0x8')](),controller[_0xeb06('0x11')]);router[_0xeb06('0x10')](_0xeb06('0xc'),auth[_0xeb06('0x8')](),controller[_0xeb06('0x12')]);router[_0xeb06('0x13')](_0xeb06('0xa'),auth[_0xeb06('0x8')](),controller[_0xeb06('0x14')]);router['delete'](_0xeb06('0xa'),auth[_0xeb06('0x8')](),controller[_0xeb06('0x15')]);module[_0xeb06('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 86d1941..03d189c 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 _0xedd9=['exports','STRING'];(function(_0x1b9ec4,_0x8f1049){var _0x4f4eee=function(_0x16344e){while(--_0x16344e){_0x1b9ec4['push'](_0x1b9ec4['shift']());}};_0x4f4eee(++_0x8f1049);}(_0xedd9,0xfc));var _0x9edd=function(_0x49b91d,_0x56c023){_0x49b91d=_0x49b91d-0x0;var _0x5064a6=_0xedd9[_0x49b91d];return _0x5064a6;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')]},'description':{'type':Sequelize[_0x9edd('0x1')]},'host':{'type':Sequelize[_0x9edd('0x1')]},'zone':{'type':Sequelize[_0x9edd('0x1')]},'clientId':{'type':Sequelize[_0x9edd('0x1')]},'clientSecret':{'type':Sequelize[_0x9edd('0x1')]},'serverUrl':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x9edd('0x1')]}}; \ No newline at end of file +var _0x4522=['STRING'];(function(_0x3ecdc7,_0x5978ee){var _0x4c9d74=function(_0x1394b3){while(--_0x1394b3){_0x3ecdc7['push'](_0x3ecdc7['shift']());}};_0x4c9d74(++_0x5978ee);}(_0x4522,0x1a0));var _0x2452=function(_0x5d4eb3,_0x45660d){_0x5d4eb3=_0x5d4eb3-0x0;var _0x4abaa1=_0x4522[_0x5d4eb3];return _0x4abaa1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 84aec26..db88902 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 _0x291d=['model','attributes','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','findOne','ZohoConfiguration','order','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientId','serverUrl','code','slice','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','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','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','save','update','destroy','then','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','query','keys','filters','intersection'];(function(_0x5549a4,_0x41de46){var _0x429ccf=function(_0x1b8a02){while(--_0x1b8a02){_0x5549a4['push'](_0x5549a4['shift']());}};_0x429ccf(++_0x41de46);}(_0x291d,0x1d1));var _0xd291=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x291d[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd291('0x0'));var zipdir=require(_0xd291('0x1'));var jsonpatch=require(_0xd291('0x2'));var rp=require(_0xd291('0x3'));var moment=require('moment');var BPromise=require(_0xd291('0x4'));var Mustache=require(_0xd291('0x5'));var util=require(_0xd291('0x6'));var path=require(_0xd291('0x7'));var sox=require(_0xd291('0x8'));var csv=require(_0xd291('0x9'));var ejs=require(_0xd291('0xa'));var fs=require('fs');var fs_extra=require(_0xd291('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd291('0xc'));var jsforce=require(_0xd291('0xd'));var deskjs=require(_0xd291('0xe'));var toCsv=require(_0xd291('0x9'));var querystring=require(_0xd291('0xf'));var Papa=require(_0xd291('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd291('0x11'));var hardwareService=require(_0xd291('0x12'));var logger=require(_0xd291('0x13'))(_0xd291('0x14'));var utils=require(_0xd291('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd291('0x16'))['db'];var integrations=require(_0xd291('0x17'));function respondWithStatusCode(_0x4c3dc1,_0x13e0ce){_0x13e0ce=_0x13e0ce||0xcc;return function(_0x4c8601){if(_0x4c8601){return _0x4c3dc1[_0xd291('0x18')](_0x13e0ce);}return _0x4c3dc1[_0xd291('0x19')](_0x13e0ce)[_0xd291('0x1a')]();};}function respondWithResult(_0x5efd32,_0x1b5ed2){_0x1b5ed2=_0x1b5ed2||0xc8;return function(_0x3fdd09){if(_0x3fdd09){return _0x5efd32[_0xd291('0x19')](_0x1b5ed2)['json'](_0x3fdd09);}};}function respondWithFilteredResult(_0x3fe43c,_0x510892){return function(_0x1368f1){if(_0x1368f1){var _0x48d6a8=typeof _0x510892['offset']===_0xd291('0x1b')&&typeof _0x510892['limit']===_0xd291('0x1b');var _0x3b61c4=_0x1368f1[_0xd291('0x1c')];var _0xd466fd=_0x48d6a8?0x0:_0x510892[_0xd291('0x1d')];var _0xff092b=_0x48d6a8?_0x1368f1[_0xd291('0x1c')]:_0x510892[_0xd291('0x1d')]+_0x510892[_0xd291('0x1e')];var _0x6ad050;if(_0xff092b>=_0x3b61c4){_0xff092b=_0x3b61c4;_0x6ad050=0xc8;}else{_0x6ad050=0xce;}_0x3fe43c['status'](_0x6ad050);return _0x3fe43c[_0xd291('0x1f')](_0xd291('0x20'),_0xd466fd+'-'+_0xff092b+'/'+_0x3b61c4)[_0xd291('0x21')](_0x1368f1);}return null;};}function patchUpdates(_0x30f80c){return function(_0x3f9025){try{jsonpatch['apply'](_0x3f9025,_0x30f80c,!![]);}catch(_0x59fa8f){return BPromise['reject'](_0x59fa8f);}return _0x3f9025[_0xd291('0x22')]();};}function saveUpdates(_0x2666c2,_0x1ce6a1){return function(_0x28f2ed){if(_0x28f2ed){return _0x28f2ed[_0xd291('0x23')](_0x2666c2)['then'](function(_0x4acb66){return _0x4acb66;});}return null;};}function removeEntity(_0x29db49,_0x530d50){return function(_0x3978ca){if(_0x3978ca){return _0x3978ca[_0xd291('0x24')]()[_0xd291('0x25')](function(){_0x29db49[_0xd291('0x19')](0xcc)[_0xd291('0x1a')]();});}};}function handleEntityNotFound(_0x32bb26,_0x4297b8){return function(_0x5d3ce2){if(!_0x5d3ce2){_0x32bb26[_0xd291('0x18')](0x194);}return _0x5d3ce2;};}function handleError(_0x270aa1,_0x3543b6){_0x3543b6=_0x3543b6||0x1f4;return function(_0x34d065){logger[_0xd291('0x26')](_0x34d065[_0xd291('0x27')]);if(_0x34d065[_0xd291('0x28')]){delete _0x34d065[_0xd291('0x28')];}_0x270aa1[_0xd291('0x19')](_0x3543b6)[_0xd291('0x29')](_0x34d065);};}exports[_0xd291('0x2a')]=function(_0x4af1ba,_0x2accd2){var _0x38c541={},_0x3d0a78={},_0x555a1e={'count':0x0,'rows':[]};var _0x3fa9bb=_[_0xd291('0x2b')](db[_0xd291('0x2c')][_0xd291('0x2d')],function(_0x2d405e){return{'name':_0x2d405e[_0xd291('0x2e')],'type':_0x2d405e['type']['key']};});_0x3d0a78['model']=_[_0xd291('0x2b')](_0x3fa9bb,'name');_0x3d0a78[_0xd291('0x2f')]=_[_0xd291('0x30')](_0x4af1ba[_0xd291('0x2f')]);_0x3d0a78[_0xd291('0x31')]=_[_0xd291('0x32')](_0x3d0a78[_0xd291('0x33')],_0x3d0a78[_0xd291('0x2f')]);_0x38c541[_0xd291('0x34')]=_['intersection'](_0x3d0a78['model'],qs[_0xd291('0x35')](_0x4af1ba[_0xd291('0x2f')][_0xd291('0x35')]));_0x38c541[_0xd291('0x34')]=_0x38c541['attributes']['length']?_0x38c541[_0xd291('0x34')]:_0x3d0a78[_0xd291('0x33')];if(!_0x4af1ba[_0xd291('0x2f')]['hasOwnProperty'](_0xd291('0x36'))){_0x38c541[_0xd291('0x1e')]=qs[_0xd291('0x1e')](_0x4af1ba[_0xd291('0x2f')][_0xd291('0x1e')]);_0x38c541['offset']=qs[_0xd291('0x1d')](_0x4af1ba[_0xd291('0x2f')]['offset']);}_0x38c541['order']=qs[_0xd291('0x37')](_0x4af1ba['query'][_0xd291('0x37')]);_0x38c541[_0xd291('0x38')]=qs['filters'](_[_0xd291('0x39')](_0x4af1ba[_0xd291('0x2f')],_0x3d0a78[_0xd291('0x31')]),_0x3fa9bb);if(_0x4af1ba[_0xd291('0x2f')][_0xd291('0x3a')]){_0x38c541[_0xd291('0x38')]=_[_0xd291('0x3b')](_0x38c541[_0xd291('0x38')],{'$or':_[_0xd291('0x2b')](_0x3fa9bb,function(_0x7ece8b){if(_0x7ece8b[_0xd291('0x3c')]!==_0xd291('0x3d')){var _0x1b67fa={};_0x1b67fa[_0x7ece8b['name']]={'$like':'%'+_0x4af1ba[_0xd291('0x2f')][_0xd291('0x3a')]+'%'};return _0x1b67fa;}})});}_0x38c541=_[_0xd291('0x3b')]({},_0x38c541,_0x4af1ba[_0xd291('0x3e')]);var _0x3b9187={'where':_0x38c541[_0xd291('0x38')]};return db[_0xd291('0x2c')][_0xd291('0x1c')](_0x3b9187)[_0xd291('0x25')](function(_0x1eba35){_0x555a1e[_0xd291('0x1c')]=_0x1eba35;if(_0x4af1ba[_0xd291('0x2f')][_0xd291('0x3f')]){_0x38c541[_0xd291('0x40')]=[{'all':!![]}];}return db[_0xd291('0x2c')][_0xd291('0x41')](_0x38c541);})['then'](function(_0x570f7f){_0x555a1e['rows']=_0x570f7f;return _0x555a1e;})[_0xd291('0x25')](respondWithFilteredResult(_0x2accd2,_0x38c541))[_0xd291('0x42')](handleError(_0x2accd2,null));};exports[_0xd291('0x43')]=function(_0x470afd,_0x228e90){var _0x324e2b={'raw':![],'where':{'id':_0x470afd[_0xd291('0x44')]['id']}},_0x369272={};_0x369272[_0xd291('0x33')]=_[_0xd291('0x30')](db['ZohoAccount'][_0xd291('0x2d')]);_0x369272['query']=_[_0xd291('0x30')](_0x470afd[_0xd291('0x2f')]);_0x369272[_0xd291('0x31')]=_[_0xd291('0x32')](_0x369272['model'],_0x369272[_0xd291('0x2f')]);_0x324e2b[_0xd291('0x34')]=_[_0xd291('0x32')](_0x369272[_0xd291('0x33')],qs['fields'](_0x470afd['query'][_0xd291('0x35')]));_0x324e2b[_0xd291('0x34')]=_0x324e2b[_0xd291('0x34')][_0xd291('0x45')]?_0x324e2b['attributes']:_0x369272['model'];if(_0x470afd[_0xd291('0x2f')]['includeAll']){_0x324e2b[_0xd291('0x40')]=[{'all':!![]}];}_0x324e2b=_[_0xd291('0x3b')]({},_0x324e2b,_0x470afd[_0xd291('0x3e')]);return db[_0xd291('0x2c')][_0xd291('0x46')](_0x324e2b)[_0xd291('0x25')](handleEntityNotFound(_0x228e90,null))[_0xd291('0x25')](respondWithResult(_0x228e90,null))[_0xd291('0x42')](handleError(_0x228e90,null));};exports[_0xd291('0x47')]=function(_0x1d1f66,_0x2b3037){return db[_0xd291('0x2c')]['create'](_0x1d1f66[_0xd291('0x48')],{})['then'](respondWithResult(_0x2b3037,0xc9))['catch'](handleError(_0x2b3037,null));};exports[_0xd291('0x23')]=function(_0x3596df,_0x1c7a95){if(_0x3596df[_0xd291('0x48')]['id']){delete _0x3596df[_0xd291('0x48')]['id'];}return db[_0xd291('0x2c')]['find']({'where':{'id':_0x3596df[_0xd291('0x44')]['id']}})[_0xd291('0x25')](handleEntityNotFound(_0x1c7a95,null))[_0xd291('0x25')](saveUpdates(_0x3596df[_0xd291('0x48')],null))['then'](respondWithResult(_0x1c7a95,null))[_0xd291('0x42')](handleError(_0x1c7a95,null));};exports[_0xd291('0x24')]=function(_0x20e742,_0x1df2e7){return db['ZohoAccount'][_0xd291('0x46')]({'where':{'id':_0x20e742[_0xd291('0x44')]['id']}})[_0xd291('0x25')](handleEntityNotFound(_0x1df2e7,null))[_0xd291('0x25')](removeEntity(_0x1df2e7,null))['catch'](handleError(_0x1df2e7,null));};exports['getConfigurations']=function(_0xcb0461,_0x37b5dd,_0x3aa9bb){var _0x317eaa={};var _0x44bb2c={};var _0x33e1dc;var _0x463972;return db[_0xd291('0x2c')][_0xd291('0x49')]({'where':{'id':_0xcb0461[_0xd291('0x44')]['id']}})[_0xd291('0x25')](handleEntityNotFound(_0x37b5dd,null))['then'](function(_0x434831){if(_0x434831){_0x33e1dc=_0x434831;_0x44bb2c[_0xd291('0x33')]=_[_0xd291('0x30')](db[_0xd291('0x4a')][_0xd291('0x2d')]);_0x44bb2c['query']=_[_0xd291('0x30')](_0xcb0461[_0xd291('0x2f')]);_0x44bb2c['filters']=_['intersection'](_0x44bb2c[_0xd291('0x33')],_0x44bb2c[_0xd291('0x2f')]);_0x317eaa[_0xd291('0x34')]=_[_0xd291('0x32')](_0x44bb2c['model'],qs[_0xd291('0x35')](_0xcb0461[_0xd291('0x2f')][_0xd291('0x35')]));_0x317eaa[_0xd291('0x34')]=_0x317eaa['attributes'][_0xd291('0x45')]?_0x317eaa['attributes']:_0x44bb2c[_0xd291('0x33')];_0x317eaa[_0xd291('0x4b')]=qs['sort'](_0xcb0461[_0xd291('0x2f')][_0xd291('0x37')]);_0x317eaa[_0xd291('0x38')]=qs[_0xd291('0x31')](_['pick'](_0xcb0461[_0xd291('0x2f')],_0x44bb2c[_0xd291('0x31')]));if(_0xcb0461[_0xd291('0x2f')][_0xd291('0x3a')]){_0x317eaa[_0xd291('0x38')]=_['merge'](_0x317eaa[_0xd291('0x38')],{'$or':_[_0xd291('0x2b')](_0x317eaa['attributes'],function(_0x59ebc7){var _0x42fe90={};_0x42fe90[_0x59ebc7]={'$like':'%'+_0xcb0461[_0xd291('0x2f')][_0xd291('0x3a')]+'%'};return _0x42fe90;})});}_0x317eaa=_[_0xd291('0x3b')]({},_0x317eaa,_0xcb0461[_0xd291('0x3e')]);return _0x33e1dc[_0xd291('0x4c')](_0x317eaa);}})['then'](function(_0x455acc){if(_0x455acc){_0x463972=_0x455acc[_0xd291('0x45')];if(!_0xcb0461['query'][_0xd291('0x4d')](_0xd291('0x36'))){_0x317eaa[_0xd291('0x1e')]=qs[_0xd291('0x1e')](_0xcb0461[_0xd291('0x2f')][_0xd291('0x1e')]);_0x317eaa[_0xd291('0x1d')]=qs[_0xd291('0x1d')](_0xcb0461[_0xd291('0x2f')][_0xd291('0x1d')]);}return _0x33e1dc[_0xd291('0x4c')](_0x317eaa);}})[_0xd291('0x25')](function(_0x1feab4){if(_0x1feab4){return _0x1feab4?{'count':_0x463972,'rows':_0x1feab4}:null;}})[_0xd291('0x25')](respondWithResult(_0x37b5dd,null))['catch'](handleError(_0x37b5dd,null));};exports[_0xd291('0x4e')]=function(_0x300c85,_0x53d887,_0x509029){if(_0x300c85['body']['id']){delete _0x300c85['body']['id'];}return db[_0xd291('0x2c')]['findOne']({'where':{'id':_0x300c85[_0xd291('0x44')]['id']}})[_0xd291('0x25')](handleEntityNotFound(_0x53d887,null))[_0xd291('0x25')](function(_0x27f9dd){if(_0x27f9dd){_0x300c85[_0xd291('0x48')][_0xd291('0x4f')]=_0x27f9dd['id'];_0x300c85['body'][_0xd291('0x50')]=integrations[_0xd291('0x51')](_0x300c85[_0xd291('0x48')][_0xd291('0x52')],_0x300c85[_0xd291('0x48')][_0xd291('0x3c')]);_0x300c85[_0xd291('0x48')][_0xd291('0x53')]=integrations['getDescriptions'](_0x300c85[_0xd291('0x48')][_0xd291('0x52')],_0x300c85[_0xd291('0x48')][_0xd291('0x3c')]);return db[_0xd291('0x4a')]['create'](_0x300c85[_0xd291('0x48')],{'include':[{'model':db[_0xd291('0x54')],'as':_0xd291('0x50')},{'model':db[_0xd291('0x54')],'as':_0xd291('0x53')}]});}return null;})[_0xd291('0x25')](respondWithResult(_0x53d887,null))['catch'](handleError(_0x53d887,null));};function getAccessToken(_0x4f4cee){return new Promise(function(_0x2d2663,_0x309760){var _0x3b0b5d;switch(_0x4f4cee['zone']){case'US':_0x3b0b5d=_0xd291('0x55');break;case'AU':_0x3b0b5d=_0xd291('0x56');break;case'EU':_0x3b0b5d='https://accounts.zoho.eu';break;case'IN':_0x3b0b5d=_0xd291('0x57');break;case'CN':_0x3b0b5d=_0xd291('0x58');break;default:_0x3b0b5d='https://accounts.zoho.eu';break;}var _0x16750e={'method':_0xd291('0x59'),'uri':_0x3b0b5d+'/oauth/v2/token','qs':{'refresh_token':_0x4f4cee[_0xd291('0x5a')],'client_id':_0x4f4cee['clientId'],'client_secret':_0x4f4cee[_0xd291('0x5b')],'grant_type':_0xd291('0x5c')},'json':!![]};return rp(_0x16750e)[_0xd291('0x25')](function(_0x253ece){if(_0x253ece[_0xd291('0x5d')]){_0x2d2663(_0x253ece[_0xd291('0x5d')]);}else{_0x309760(_0xd291('0x5e'));}})[_0xd291('0x42')](function(_0x5b7f8f){_0x309760(_0x5b7f8f);});});}exports[_0xd291('0x5f')]=function(_0x17c7af,_0x31ba92,_0x25905d){var _0x32cc53,_0x44eb03,_0x4d6d6d,_0x496999,_0x5a6312;return db[_0xd291('0x2c')][_0xd291('0x49')]({'where':{'id':_0x17c7af[_0xd291('0x44')]['id']},'attributes':['id',_0xd291('0x60'),_0xd291('0x61'),_0xd291('0x62'),_0xd291('0x5b'),_0xd291('0x63'),_0xd291('0x64'),_0xd291('0x5a')]})['then'](handleEntityNotFound(_0x31ba92,null))[_0xd291('0x25')](function(_0x404169){_0x5a6312=_0x404169;_0x32cc53=_0x5a6312[_0xd291('0x60')];_0x44eb03=_0x32cc53==='zoho.eu'?'eu':'com';_0x4d6d6d=_0x5a6312[_0xd291('0x63')];var _0x2c85d3=_0x4d6d6d[_0xd291('0x65')](-0x1);if(_0x2c85d3==='/'||_0x2c85d3==='\x5c'||_0x2c85d3===':'){_0x4d6d6d=_0x4d6d6d['substring'](0x0,_0x4d6d6d[_0xd291('0x66')](_0x2c85d3));}if(!_0x5a6312[_0xd291('0x5a')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5a6312);})[_0xd291('0x25')](function(_0x2dec40){if(_0x2dec40){return rp({'method':'GET','uri':util[_0xd291('0x67')](_0xd291('0x68'),_0x44eb03),'qs':{'module':_0xd291('0x69')},'headers':{'Authorization':_0xd291('0x6a')+_0x2dec40},'json':!![]});}})[_0xd291('0x25')](function(_0x5972a1){if(_0x5972a1){if(_0x5972a1[_0xd291('0x6b')]&&_0x5972a1[_0xd291('0x6b')][_0xd291('0x26')]){throw new Error(_0x5972a1[_0xd291('0x6b')][_0xd291('0x26')][_0xd291('0x6c')]);}var _0x431a9a=[];var _0x33f8dc=[];var _0x260ce2=[_0xd291('0x6d'),_0xd291('0x6e'),'Description',_0xd291('0x6f'),_0xd291('0x70'),_0xd291('0x71'),_0xd291('0x72'),_0xd291('0x73')];_0x33f8dc=_['remove'](_0x5972a1[_0xd291('0x35')],function(_0x25c076){return _0x260ce2[_0xd291('0x74')](_0x25c076[_0xd291('0x75')]);});for(var _0x2a73e0=0x0;_0x2a73e0<_0x33f8dc[_0xd291('0x45')];_0x2a73e0++){if(_0x33f8dc[_0x2a73e0][_0xd291('0x76')]===![]){_0x431a9a[_0xd291('0x77')]({'id':_0x33f8dc[_0x2a73e0]['id'],'name':_0x33f8dc[_0x2a73e0][_0xd291('0x78')],'custom':_0x33f8dc[_0x2a73e0][_0xd291('0x79')],'options':_0x33f8dc[_0x2a73e0]['data_type']===_0xd291('0x7a')&&_0x33f8dc[_0x2a73e0][_0xd291('0x7b')]['length']>-0x1?_[_0xd291('0x2b')](_0x33f8dc[_0x2a73e0][_0xd291('0x7b')],function(_0x5133fb){return{'name':_0x5133fb,'value':_0x5133fb};}):[]});}}return{'count':_0x431a9a[_0xd291('0x45')],'rows':_0x431a9a};}else{return{'count':0x0,'rows':[]};}})[_0xd291('0x25')](respondWithResult(_0x31ba92,null))['catch'](function(_0x585c08){var _0x3498f3=_0x17c7af[_0xd291('0x2f')][_0xd291('0x7c')]?0x1f4:_0x585c08[_0xd291('0x7d')]||0x1f4;logger[_0xd291('0x26')](_0xd291('0x7e'),_0xd291('0x5f'),_0x3498f3,JSON[_0xd291('0x7f')](_0x585c08));delete _0x585c08[_0xd291('0x28')];if(_0x3498f3===0x191){_0x3498f3=0x190;}_0x31ba92[_0xd291('0x19')](_0x3498f3)['send'](_0x17c7af['query']['test']?{'message':_0xd291('0x80'),'statusCode':_0x585c08['statusCode']}:_0x585c08);});}; \ No newline at end of file +var _0x79a2=['Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','getConfigurations','findOne','order','hasOwnProperty','addConfiguration','channel','getDescriptions','ZohoConfiguration','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token'];(function(_0x4a06ad,_0x4184bc){var _0x264297=function(_0x11d9bc){while(--_0x11d9bc){_0x4a06ad['push'](_0x4a06ad['shift']());}};_0x264297(++_0x4184bc);}(_0x79a2,0x138));var _0x279a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x79a2[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x279a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x279a('0x1'));var BPromise=require(_0x279a('0x2'));var Mustache=require(_0x279a('0x3'));var util=require(_0x279a('0x4'));var path=require(_0x279a('0x5'));var sox=require(_0x279a('0x6'));var csv=require(_0x279a('0x7'));var ejs=require(_0x279a('0x8'));var fs=require('fs');var fs_extra=require(_0x279a('0x9'));var _=require(_0x279a('0xa'));var squel=require(_0x279a('0xb'));var crypto=require(_0x279a('0xc'));var jsforce=require(_0x279a('0xd'));var deskjs=require(_0x279a('0xe'));var toCsv=require(_0x279a('0x7'));var querystring=require(_0x279a('0xf'));var Papa=require(_0x279a('0x10'));var Redis=require(_0x279a('0x11'));var authService=require(_0x279a('0x12'));var qs=require(_0x279a('0x13'));var as=require(_0x279a('0x14'));var hardwareService=require(_0x279a('0x15'));var logger=require(_0x279a('0x16'))(_0x279a('0x17'));var utils=require(_0x279a('0x18'));var config=require(_0x279a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x279a('0x1a'))['db'];var integrations=require(_0x279a('0x1b'));function respondWithStatusCode(_0x2a0210,_0x3eaf03){_0x3eaf03=_0x3eaf03||0xcc;return function(_0xab8680){if(_0xab8680){return _0x2a0210[_0x279a('0x1c')](_0x3eaf03);}return _0x2a0210[_0x279a('0x1d')](_0x3eaf03)[_0x279a('0x1e')]();};}function respondWithResult(_0x2ab541,_0x2dded3){_0x2dded3=_0x2dded3||0xc8;return function(_0x33ac8b){if(_0x33ac8b){return _0x2ab541['status'](_0x2dded3)[_0x279a('0x1f')](_0x33ac8b);}};}function respondWithFilteredResult(_0x33042f,_0x148921){return function(_0x16b5ad){if(_0x16b5ad){var _0xe55d=typeof _0x148921['offset']==='undefined'&&typeof _0x148921['limit']==='undefined';var _0x3e42e0=_0x16b5ad[_0x279a('0x20')];var _0x224a13=_0xe55d?0x0:_0x148921[_0x279a('0x21')];var _0x2bed45=_0xe55d?_0x16b5ad[_0x279a('0x20')]:_0x148921['offset']+_0x148921[_0x279a('0x22')];var _0x252843;if(_0x2bed45>=_0x3e42e0){_0x2bed45=_0x3e42e0;_0x252843=0xc8;}else{_0x252843=0xce;}_0x33042f[_0x279a('0x1d')](_0x252843);return _0x33042f[_0x279a('0x23')](_0x279a('0x24'),_0x224a13+'-'+_0x2bed45+'/'+_0x3e42e0)[_0x279a('0x1f')](_0x16b5ad);}return null;};}function patchUpdates(_0x1581bc){return function(_0x3bcf7a){try{jsonpatch[_0x279a('0x25')](_0x3bcf7a,_0x1581bc,!![]);}catch(_0x525a53){return BPromise['reject'](_0x525a53);}return _0x3bcf7a[_0x279a('0x26')]();};}function saveUpdates(_0x227572,_0xdb8a11){return function(_0x34298a){if(_0x34298a){return _0x34298a[_0x279a('0x27')](_0x227572)[_0x279a('0x28')](function(_0x51f81d){return _0x51f81d;});}return null;};}function removeEntity(_0x458694,_0x26c6f6){return function(_0x4de82a){if(_0x4de82a){return _0x4de82a[_0x279a('0x29')]()[_0x279a('0x28')](function(){_0x458694[_0x279a('0x1d')](0xcc)[_0x279a('0x1e')]();});}};}function handleEntityNotFound(_0x5a2b66,_0x1bd51f){return function(_0x11c8a3){if(!_0x11c8a3){_0x5a2b66[_0x279a('0x1c')](0x194);}return _0x11c8a3;};}function handleError(_0x2477bb,_0x44d62f){_0x44d62f=_0x44d62f||0x1f4;return function(_0x3f7895){logger['error'](_0x3f7895[_0x279a('0x2a')]);if(_0x3f7895[_0x279a('0x2b')]){delete _0x3f7895[_0x279a('0x2b')];}_0x2477bb['status'](_0x44d62f)[_0x279a('0x2c')](_0x3f7895);};}exports['index']=function(_0x4782d8,_0x3deeae){var _0x42ef46={},_0x23a91b={},_0x1cd750={'count':0x0,'rows':[]};var _0x4e1975=_[_0x279a('0x2d')](db[_0x279a('0x2e')][_0x279a('0x2f')],function(_0x64d49b){return{'name':_0x64d49b[_0x279a('0x30')],'type':_0x64d49b[_0x279a('0x31')][_0x279a('0x32')]};});_0x23a91b[_0x279a('0x33')]=_['map'](_0x4e1975,_0x279a('0x2b'));_0x23a91b[_0x279a('0x34')]=_['keys'](_0x4782d8[_0x279a('0x34')]);_0x23a91b[_0x279a('0x35')]=_[_0x279a('0x36')](_0x23a91b['model'],_0x23a91b[_0x279a('0x34')]);_0x42ef46[_0x279a('0x37')]=_[_0x279a('0x36')](_0x23a91b[_0x279a('0x33')],qs[_0x279a('0x38')](_0x4782d8[_0x279a('0x34')][_0x279a('0x38')]));_0x42ef46['attributes']=_0x42ef46[_0x279a('0x37')][_0x279a('0x39')]?_0x42ef46[_0x279a('0x37')]:_0x23a91b[_0x279a('0x33')];if(!_0x4782d8[_0x279a('0x34')]['hasOwnProperty'](_0x279a('0x3a'))){_0x42ef46[_0x279a('0x22')]=qs[_0x279a('0x22')](_0x4782d8[_0x279a('0x34')][_0x279a('0x22')]);_0x42ef46['offset']=qs[_0x279a('0x21')](_0x4782d8[_0x279a('0x34')][_0x279a('0x21')]);}_0x42ef46['order']=qs[_0x279a('0x3b')](_0x4782d8[_0x279a('0x34')]['sort']);_0x42ef46[_0x279a('0x3c')]=qs[_0x279a('0x35')](_[_0x279a('0x3d')](_0x4782d8['query'],_0x23a91b[_0x279a('0x35')]),_0x4e1975);if(_0x4782d8[_0x279a('0x34')][_0x279a('0x3e')]){_0x42ef46[_0x279a('0x3c')]=_['merge'](_0x42ef46[_0x279a('0x3c')],{'$or':_[_0x279a('0x2d')](_0x4e1975,function(_0x3f3b40){if(_0x3f3b40[_0x279a('0x31')]!==_0x279a('0x3f')){var _0x4e2e8b={};_0x4e2e8b[_0x3f3b40[_0x279a('0x2b')]]={'$like':'%'+_0x4782d8[_0x279a('0x34')][_0x279a('0x3e')]+'%'};return _0x4e2e8b;}})});}_0x42ef46=_[_0x279a('0x40')]({},_0x42ef46,_0x4782d8[_0x279a('0x41')]);var _0x4dc980={'where':_0x42ef46[_0x279a('0x3c')]};return db[_0x279a('0x2e')][_0x279a('0x20')](_0x4dc980)[_0x279a('0x28')](function(_0x337008){_0x1cd750[_0x279a('0x20')]=_0x337008;if(_0x4782d8[_0x279a('0x34')][_0x279a('0x42')]){_0x42ef46[_0x279a('0x43')]=[{'all':!![]}];}return db['ZohoAccount'][_0x279a('0x44')](_0x42ef46);})[_0x279a('0x28')](function(_0x514ba9){_0x1cd750[_0x279a('0x45')]=_0x514ba9;return _0x1cd750;})[_0x279a('0x28')](respondWithFilteredResult(_0x3deeae,_0x42ef46))[_0x279a('0x46')](handleError(_0x3deeae,null));};exports[_0x279a('0x47')]=function(_0x4b2b17,_0x387624){var _0x3e3dff={'raw':![],'where':{'id':_0x4b2b17['params']['id']}},_0x1221e2={};_0x1221e2[_0x279a('0x33')]=_['keys'](db[_0x279a('0x2e')]['rawAttributes']);_0x1221e2['query']=_[_0x279a('0x48')](_0x4b2b17[_0x279a('0x34')]);_0x1221e2['filters']=_[_0x279a('0x36')](_0x1221e2[_0x279a('0x33')],_0x1221e2[_0x279a('0x34')]);_0x3e3dff['attributes']=_[_0x279a('0x36')](_0x1221e2['model'],qs[_0x279a('0x38')](_0x4b2b17[_0x279a('0x34')][_0x279a('0x38')]));_0x3e3dff[_0x279a('0x37')]=_0x3e3dff[_0x279a('0x37')][_0x279a('0x39')]?_0x3e3dff[_0x279a('0x37')]:_0x1221e2[_0x279a('0x33')];if(_0x4b2b17['query'][_0x279a('0x42')]){_0x3e3dff[_0x279a('0x43')]=[{'all':!![]}];}_0x3e3dff=_['merge']({},_0x3e3dff,_0x4b2b17[_0x279a('0x41')]);return db[_0x279a('0x2e')]['find'](_0x3e3dff)['then'](handleEntityNotFound(_0x387624,null))[_0x279a('0x28')](respondWithResult(_0x387624,null))[_0x279a('0x46')](handleError(_0x387624,null));};exports[_0x279a('0x49')]=function(_0x210297,_0x11beb8){return db[_0x279a('0x2e')]['create'](_0x210297[_0x279a('0x4a')],{})['then'](respondWithResult(_0x11beb8,0xc9))[_0x279a('0x46')](handleError(_0x11beb8,null));};exports[_0x279a('0x27')]=function(_0x38463,_0x424db0){if(_0x38463[_0x279a('0x4a')]['id']){delete _0x38463[_0x279a('0x4a')]['id'];}return db['ZohoAccount'][_0x279a('0x4b')]({'where':{'id':_0x38463[_0x279a('0x4c')]['id']}})[_0x279a('0x28')](handleEntityNotFound(_0x424db0,null))[_0x279a('0x28')](saveUpdates(_0x38463['body'],null))[_0x279a('0x28')](respondWithResult(_0x424db0,null))[_0x279a('0x46')](handleError(_0x424db0,null));};exports[_0x279a('0x29')]=function(_0x504f58,_0x10d876){return db[_0x279a('0x2e')]['find']({'where':{'id':_0x504f58[_0x279a('0x4c')]['id']}})[_0x279a('0x28')](handleEntityNotFound(_0x10d876,null))[_0x279a('0x28')](removeEntity(_0x10d876,null))['catch'](handleError(_0x10d876,null));};exports[_0x279a('0x4d')]=function(_0x43e7b0,_0x301c46,_0x357453){var _0xfbc90={};var _0x5832fd={};var _0x25a433;var _0x2725f;return db[_0x279a('0x2e')][_0x279a('0x4e')]({'where':{'id':_0x43e7b0[_0x279a('0x4c')]['id']}})[_0x279a('0x28')](handleEntityNotFound(_0x301c46,null))[_0x279a('0x28')](function(_0x339782){if(_0x339782){_0x25a433=_0x339782;_0x5832fd[_0x279a('0x33')]=_[_0x279a('0x48')](db['ZohoConfiguration'][_0x279a('0x2f')]);_0x5832fd[_0x279a('0x34')]=_[_0x279a('0x48')](_0x43e7b0[_0x279a('0x34')]);_0x5832fd[_0x279a('0x35')]=_[_0x279a('0x36')](_0x5832fd[_0x279a('0x33')],_0x5832fd[_0x279a('0x34')]);_0xfbc90[_0x279a('0x37')]=_[_0x279a('0x36')](_0x5832fd[_0x279a('0x33')],qs[_0x279a('0x38')](_0x43e7b0['query'][_0x279a('0x38')]));_0xfbc90['attributes']=_0xfbc90['attributes'][_0x279a('0x39')]?_0xfbc90[_0x279a('0x37')]:_0x5832fd[_0x279a('0x33')];_0xfbc90[_0x279a('0x4f')]=qs[_0x279a('0x3b')](_0x43e7b0['query']['sort']);_0xfbc90[_0x279a('0x3c')]=qs['filters'](_[_0x279a('0x3d')](_0x43e7b0[_0x279a('0x34')],_0x5832fd[_0x279a('0x35')]));if(_0x43e7b0['query'][_0x279a('0x3e')]){_0xfbc90[_0x279a('0x3c')]=_[_0x279a('0x40')](_0xfbc90[_0x279a('0x3c')],{'$or':_[_0x279a('0x2d')](_0xfbc90[_0x279a('0x37')],function(_0x52838a){var _0x1731b1={};_0x1731b1[_0x52838a]={'$like':'%'+_0x43e7b0[_0x279a('0x34')][_0x279a('0x3e')]+'%'};return _0x1731b1;})});}_0xfbc90=_['merge']({},_0xfbc90,_0x43e7b0['options']);return _0x25a433[_0x279a('0x4d')](_0xfbc90);}})[_0x279a('0x28')](function(_0x2ca318){if(_0x2ca318){_0x2725f=_0x2ca318[_0x279a('0x39')];if(!_0x43e7b0[_0x279a('0x34')][_0x279a('0x50')](_0x279a('0x3a'))){_0xfbc90[_0x279a('0x22')]=qs[_0x279a('0x22')](_0x43e7b0['query']['limit']);_0xfbc90[_0x279a('0x21')]=qs[_0x279a('0x21')](_0x43e7b0[_0x279a('0x34')]['offset']);}return _0x25a433[_0x279a('0x4d')](_0xfbc90);}})['then'](function(_0x1288a7){if(_0x1288a7){return _0x1288a7?{'count':_0x2725f,'rows':_0x1288a7}:null;}})[_0x279a('0x28')](respondWithResult(_0x301c46,null))[_0x279a('0x46')](handleError(_0x301c46,null));};exports[_0x279a('0x51')]=function(_0x203a13,_0x195c66,_0x1dd48f){if(_0x203a13['body']['id']){delete _0x203a13[_0x279a('0x4a')]['id'];}return db[_0x279a('0x2e')][_0x279a('0x4e')]({'where':{'id':_0x203a13[_0x279a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x195c66,null))[_0x279a('0x28')](function(_0x4f6755){if(_0x4f6755){_0x203a13[_0x279a('0x4a')]['AccountId']=_0x4f6755['id'];_0x203a13[_0x279a('0x4a')]['Subjects']=integrations['getSubjects'](_0x203a13[_0x279a('0x4a')][_0x279a('0x52')],_0x203a13[_0x279a('0x4a')][_0x279a('0x31')]);_0x203a13[_0x279a('0x4a')]['Descriptions']=integrations[_0x279a('0x53')](_0x203a13[_0x279a('0x4a')]['channel'],_0x203a13['body'][_0x279a('0x31')]);return db[_0x279a('0x54')][_0x279a('0x49')](_0x203a13[_0x279a('0x4a')],{'include':[{'model':db[_0x279a('0x55')],'as':_0x279a('0x56')},{'model':db[_0x279a('0x55')],'as':_0x279a('0x57')}]});}return null;})[_0x279a('0x28')](respondWithResult(_0x195c66,null))[_0x279a('0x46')](handleError(_0x195c66,null));};function getAccessToken(_0x528cc7){return new Promise(function(_0x550740,_0x27a8f0){var _0x22d561;switch(_0x528cc7[_0x279a('0x58')]){case'US':_0x22d561=_0x279a('0x59');break;case'AU':_0x22d561=_0x279a('0x5a');break;case'EU':_0x22d561=_0x279a('0x5b');break;case'IN':_0x22d561=_0x279a('0x5c');break;case'CN':_0x22d561='https://accounts.zoho.com.cn';break;default:_0x22d561=_0x279a('0x5b');break;}var _0x16617d={'method':_0x279a('0x5d'),'uri':_0x22d561+_0x279a('0x5e'),'qs':{'refresh_token':_0x528cc7[_0x279a('0x5f')],'client_id':_0x528cc7[_0x279a('0x60')],'client_secret':_0x528cc7[_0x279a('0x61')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x16617d)[_0x279a('0x28')](function(_0x52f462){if(_0x52f462[_0x279a('0x62')]){_0x550740(_0x52f462[_0x279a('0x62')]);}else{_0x27a8f0(_0x279a('0x63'));}})[_0x279a('0x46')](function(_0xc46608){_0x27a8f0(_0xc46608);});});}exports[_0x279a('0x64')]=function(_0x1ba669,_0x5653cd,_0x375490){var _0x5479bf,_0x116ed6,_0x2b86a7,_0x5b82f0,_0x345f3c;return db['ZohoAccount'][_0x279a('0x4e')]({'where':{'id':_0x1ba669['params']['id']},'attributes':['id',_0x279a('0x65'),'zone',_0x279a('0x60'),_0x279a('0x61'),_0x279a('0x66'),'code',_0x279a('0x5f')]})['then'](handleEntityNotFound(_0x5653cd,null))[_0x279a('0x28')](function(_0x43bf2e){_0x345f3c=_0x43bf2e;_0x5479bf=_0x345f3c['host'];_0x116ed6=_0x5479bf===_0x279a('0x67')?'eu':_0x279a('0x68');_0x2b86a7=_0x345f3c[_0x279a('0x66')];var _0xc11674=_0x2b86a7[_0x279a('0x69')](-0x1);if(_0xc11674==='/'||_0xc11674==='\x5c'||_0xc11674===':'){_0x2b86a7=_0x2b86a7[_0x279a('0x6a')](0x0,_0x2b86a7[_0x279a('0x6b')](_0xc11674));}if(!_0x345f3c[_0x279a('0x5f')]){throw new Error(_0x279a('0x6c'));}return getAccessToken(_0x345f3c);})[_0x279a('0x28')](function(_0x480fdf){if(_0x480fdf){return rp({'method':_0x279a('0x6d'),'uri':util['format'](_0x279a('0x6e'),_0x116ed6),'qs':{'module':_0x279a('0x6f')},'headers':{'Authorization':_0x279a('0x70')+_0x480fdf},'json':!![]});}})[_0x279a('0x28')](function(_0x786335){if(_0x786335){if(_0x786335[_0x279a('0x71')]&&_0x786335[_0x279a('0x71')][_0x279a('0x72')]){throw new Error(_0x786335['response'][_0x279a('0x72')][_0x279a('0x73')]);}var _0x1e7936=[];var _0xff581f=[];var _0x453192=[_0x279a('0x74'),_0x279a('0x75'),_0x279a('0x76'),_0x279a('0x77'),_0x279a('0x78'),_0x279a('0x79'),_0x279a('0x7a'),_0x279a('0x7b')];_0xff581f=_['remove'](_0x786335[_0x279a('0x38')],function(_0x28ddd9){return _0x453192[_0x279a('0x7c')](_0x28ddd9[_0x279a('0x7d')]);});for(var _0x549e2c=0x0;_0x549e2c<_0xff581f[_0x279a('0x39')];_0x549e2c++){if(_0xff581f[_0x549e2c][_0x279a('0x7e')]===![]){_0x1e7936[_0x279a('0x7f')]({'id':_0xff581f[_0x549e2c]['id'],'name':_0xff581f[_0x549e2c][_0x279a('0x80')],'custom':_0xff581f[_0x549e2c][_0x279a('0x81')],'options':_0xff581f[_0x549e2c][_0x279a('0x82')]===_0x279a('0x83')&&_0xff581f[_0x549e2c][_0x279a('0x84')][_0x279a('0x39')]>-0x1?_[_0x279a('0x2d')](_0xff581f[_0x549e2c]['pick_list_values'],function(_0x54c426){return{'name':_0x54c426,'value':_0x54c426};}):[]});}}return{'count':_0x1e7936[_0x279a('0x39')],'rows':_0x1e7936};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5653cd,null))['catch'](function(_0x3a357b){var _0x493461=_0x1ba669[_0x279a('0x34')][_0x279a('0x85')]?0x1f4:_0x3a357b[_0x279a('0x86')]||0x1f4;logger['error'](_0x279a('0x87'),_0x279a('0x64'),_0x493461,JSON[_0x279a('0x88')](_0x3a357b));delete _0x3a357b[_0x279a('0x2b')];if(_0x493461===0x191){_0x493461=0x190;}_0x5653cd['status'](_0x493461)[_0x279a('0x2c')](_0x1ba669[_0x279a('0x34')][_0x279a('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x3a357b[_0x279a('0x86')]}:_0x3a357b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4005d48..bd58071 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 _0xa890=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','https://accounts.zoho.in','/oauth/v2/token','authorization_code','then','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x492e32,_0x2e0a93){var _0x4a335e=function(_0x1f4998){while(--_0x1f4998){_0x492e32['push'](_0x492e32['shift']());}};_0x4a335e(++_0x2e0a93);}(_0xa890,0x105));var _0x0a89=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xa890[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x0a89('0x0'));var util=require(_0x0a89('0x1'));var logger=require(_0x0a89('0x2'))(_0x0a89('0x3'));var moment=require(_0x0a89('0x4'));var BPromise=require('bluebird');var rp=require(_0x0a89('0x5'));var fs=require('fs');var path=require(_0x0a89('0x6'));var rimraf=require('rimraf');var config=require(_0x0a89('0x7'));var attributes=require(_0x0a89('0x8'));var integrations=require(_0x0a89('0x9'));module[_0x0a89('0xa')]=function(_0x550040,_0xabe296){return _0x550040['define']('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x263782,_0x16958d,_0x3ee0a4){if(_0x263782[_0x0a89('0xb')](_0x0a89('0xc'))||_0x263782[_0x0a89('0xb')](_0x0a89('0xd'))||_0x263782[_0x0a89('0xb')](_0x0a89('0xe'))||_0x263782[_0x0a89('0xb')](_0x0a89('0xf'))||_0x263782[_0x0a89('0xb')](_0x0a89('0x10'))||_0x263782[_0x0a89('0xb')](_0x0a89('0x11'))){var _0x4ad939,_0x36fb8b;_0x4ad939=_0x263782[_0x0a89('0xd')];var _0x20bcb0=_0x4ad939['slice'](-0x1);if(_0x20bcb0==='/'||_0x20bcb0==='\x5c'||_0x20bcb0===':'){_0x4ad939=_0x4ad939[_0x0a89('0x12')](0x0,_0x4ad939[_0x0a89('0x13')](_0x20bcb0));}switch(_0x263782['zone']){case'US':_0x36fb8b=_0x0a89('0x14');break;case'AU':_0x36fb8b=_0x0a89('0x15');break;case'IN':_0x36fb8b='https://accounts.zoho.in';break;case'CN':_0x36fb8b=_0x0a89('0x16');break;default:_0x36fb8b=_0x0a89('0x17');break;}var _0x279fe6={'method':_0x0a89('0x18'),'uri':_0x36fb8b+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x263782[_0x0a89('0xe')],'client_secret':_0x263782['clientSecret'],'redirect_uri':_0x263782[_0x0a89('0xd')],'code':_0x263782['code']},'headers':{'Content-Type':_0x0a89('0x19')}};return rp(_0x279fe6)['then'](function(_0x2c380d){var _0x56d777=JSON[_0x0a89('0x1a')](_0x2c380d);if(_0x56d777[_0x0a89('0x1b')]){_0x263782[_0x0a89('0x1c')]=_0x56d777[_0x0a89('0x1b')];logger[_0x0a89('0x1d')](util[_0x0a89('0x1e')](_0x0a89('0x1f'),_0x263782[_0x0a89('0x20')],_0x263782['id']));}else{logger[_0x0a89('0x21')](util[_0x0a89('0x1e')](_0x0a89('0x22'),_0x263782[_0x0a89('0x20')],_0x263782['id']),util[_0x0a89('0x23')](_0x56d777,{'showHidden':![],'depth':null}));}return _0x3ee0a4(null,_0x16958d);})[_0x0a89('0x24')](function(_0x453ff0){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x263782['name'],_0x263782['id']),util[_0x0a89('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x3ee0a4(_0x453ff0);});}else{return _0x3ee0a4(null,_0x16958d);}},'beforeUpdate':function(_0x4bfea8,_0x56dea3,_0x1e78d9){if(_0x4bfea8[_0x0a89('0xb')](_0x0a89('0xc'))||_0x4bfea8[_0x0a89('0xb')](_0x0a89('0xd'))||_0x4bfea8[_0x0a89('0xb')](_0x0a89('0xe'))||_0x4bfea8[_0x0a89('0xb')](_0x0a89('0xf'))||_0x4bfea8[_0x0a89('0xb')]('code')||_0x4bfea8[_0x0a89('0xb')](_0x0a89('0x11'))){var _0x17ee1d,_0x422e96;_0x17ee1d=_0x4bfea8['serverUrl'];var _0x5cda60=_0x17ee1d[_0x0a89('0x25')](-0x1);if(_0x5cda60==='/'||_0x5cda60==='\x5c'||_0x5cda60===':'){_0x17ee1d=_0x17ee1d[_0x0a89('0x12')](0x0,_0x17ee1d[_0x0a89('0x13')](_0x5cda60));}switch(_0x4bfea8['zone']){case'US':_0x422e96=_0x0a89('0x14');break;case'AU':_0x422e96=_0x0a89('0x15');break;case'IN':_0x422e96=_0x0a89('0x26');break;case'CN':_0x422e96=_0x0a89('0x16');break;default:_0x422e96=_0x0a89('0x17');break;}var _0x2f781f={'method':'POST','uri':_0x422e96+_0x0a89('0x27'),'form':{'grant_type':_0x0a89('0x28'),'client_id':_0x4bfea8['clientId'],'client_secret':_0x4bfea8['clientSecret'],'redirect_uri':_0x4bfea8[_0x0a89('0xd')],'code':_0x4bfea8[_0x0a89('0x10')]},'headers':{'Content-Type':_0x0a89('0x19')}};return rp(_0x2f781f)[_0x0a89('0x29')](function(_0x370127){var _0x5aa86=JSON['parse'](_0x370127);if(_0x5aa86['refresh_token']){_0x4bfea8['refreshToken']=_0x5aa86['refresh_token'];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4bfea8[_0x0a89('0x20')],_0x4bfea8['id']));}else{logger['error'](util[_0x0a89('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4bfea8[_0x0a89('0x20')],_0x4bfea8['id']),util['inspect'](_0x5aa86,{'showHidden':![],'depth':null}));}return _0x1e78d9(null,_0x56dea3);})[_0x0a89('0x24')](function(_0x1bc30d){logger['error'](util[_0x0a89('0x1e')](_0x0a89('0x22'),_0x4bfea8['name'],_0x4bfea8['id']),util[_0x0a89('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x1e78d9(_0x1bc30d);});}else{return _0x1e78d9(null,_0x56dea3);}}}});}; \ No newline at end of file +var _0x89cf=['application/x-www-form-urlencoded','then','parse','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com','https://accounts.zoho.com.cn','name','lodash','util','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','clientSecret'];(function(_0x4b66ae,_0x367707){var _0x3bb455=function(_0x40958e){while(--_0x40958e){_0x4b66ae['push'](_0x4b66ae['shift']());}};_0x3bb455(++_0x367707);}(_0x89cf,0x19e));var _0xf89c=function(_0x10714c,_0x169b40){_0x10714c=_0x10714c-0x0;var _0x3c0491=_0x89cf[_0x10714c];return _0x3c0491;};'use strict';var _=require(_0xf89c('0x0'));var util=require(_0xf89c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf89c('0x2'));var BPromise=require(_0xf89c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf89c('0x4'));var rimraf=require('rimraf');var config=require(_0xf89c('0x5'));var attributes=require(_0xf89c('0x6'));var integrations=require(_0xf89c('0x7'));module[_0xf89c('0x8')]=function(_0x8b4652,_0x4f0657){return _0x8b4652[_0xf89c('0x9')](_0xf89c('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x48e10b,_0x4e4444,_0x46bb91){if(_0x48e10b[_0xf89c('0xb')](_0xf89c('0xc'))||_0x48e10b[_0xf89c('0xb')](_0xf89c('0xd'))||_0x48e10b[_0xf89c('0xb')]('clientId')||_0x48e10b['changed']('clientSecret')||_0x48e10b['changed'](_0xf89c('0xe'))||_0x48e10b[_0xf89c('0xb')](_0xf89c('0xf'))){var _0x428356,_0x3d4319;_0x428356=_0x48e10b[_0xf89c('0xd')];var _0x52732c=_0x428356[_0xf89c('0x10')](-0x1);if(_0x52732c==='/'||_0x52732c==='\x5c'||_0x52732c===':'){_0x428356=_0x428356[_0xf89c('0x11')](0x0,_0x428356[_0xf89c('0x12')](_0x52732c));}switch(_0x48e10b['zone']){case'US':_0x3d4319='https://accounts.zoho.com';break;case'AU':_0x3d4319=_0xf89c('0x13');break;case'IN':_0x3d4319=_0xf89c('0x14');break;case'CN':_0x3d4319='https://accounts.zoho.com.cn';break;default:_0x3d4319=_0xf89c('0x15');break;}var _0x23de9f={'method':'POST','uri':_0x3d4319+_0xf89c('0x16'),'form':{'grant_type':_0xf89c('0x17'),'client_id':_0x48e10b[_0xf89c('0x18')],'client_secret':_0x48e10b[_0xf89c('0x19')],'redirect_uri':_0x48e10b[_0xf89c('0xd')],'code':_0x48e10b[_0xf89c('0xe')]},'headers':{'Content-Type':_0xf89c('0x1a')}};return rp(_0x23de9f)[_0xf89c('0x1b')](function(_0x57aa77){var _0x2759f9=JSON[_0xf89c('0x1c')](_0x57aa77);if(_0x2759f9['refresh_token']){_0x48e10b[_0xf89c('0x1d')]=_0x2759f9['refresh_token'];logger[_0xf89c('0x1e')](util[_0xf89c('0x1f')](_0xf89c('0x20'),_0x48e10b['name'],_0x48e10b['id']));}else{logger[_0xf89c('0x21')](util[_0xf89c('0x1f')](_0xf89c('0x22'),_0x48e10b['name'],_0x48e10b['id']),util[_0xf89c('0x23')](_0x2759f9,{'showHidden':![],'depth':null}));}return _0x46bb91(null,_0x4e4444);})[_0xf89c('0x24')](function(_0x58ded4){logger[_0xf89c('0x21')](util[_0xf89c('0x1f')](_0xf89c('0x22'),_0x48e10b['name'],_0x48e10b['id']),util[_0xf89c('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x46bb91(_0x58ded4);});}else{return _0x46bb91(null,_0x4e4444);}},'beforeUpdate':function(_0x5dca5e,_0xcd82c4,_0x20abc0){if(_0x5dca5e[_0xf89c('0xb')](_0xf89c('0xc'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0xd'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0x18'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0x19'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0xe'))||_0x5dca5e[_0xf89c('0xb')](_0xf89c('0xf'))){var _0x4f1666,_0xe56d62;_0x4f1666=_0x5dca5e[_0xf89c('0xd')];var _0x7684fd=_0x4f1666[_0xf89c('0x10')](-0x1);if(_0x7684fd==='/'||_0x7684fd==='\x5c'||_0x7684fd===':'){_0x4f1666=_0x4f1666[_0xf89c('0x11')](0x0,_0x4f1666[_0xf89c('0x12')](_0x7684fd));}switch(_0x5dca5e[_0xf89c('0xc')]){case'US':_0xe56d62=_0xf89c('0x25');break;case'AU':_0xe56d62=_0xf89c('0x13');break;case'IN':_0xe56d62=_0xf89c('0x14');break;case'CN':_0xe56d62=_0xf89c('0x26');break;default:_0xe56d62='https://accounts.zoho.eu';break;}var _0x1473d9={'method':'POST','uri':_0xe56d62+_0xf89c('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x5dca5e[_0xf89c('0x18')],'client_secret':_0x5dca5e[_0xf89c('0x19')],'redirect_uri':_0x5dca5e[_0xf89c('0xd')],'code':_0x5dca5e[_0xf89c('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1473d9)[_0xf89c('0x1b')](function(_0x5ec3ee){var _0x3fcc93=JSON[_0xf89c('0x1c')](_0x5ec3ee);if(_0x3fcc93['refresh_token']){_0x5dca5e[_0xf89c('0x1d')]=_0x3fcc93['refresh_token'];logger[_0xf89c('0x1e')](util[_0xf89c('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5dca5e[_0xf89c('0x27')],_0x5dca5e['id']));}else{logger[_0xf89c('0x21')](util[_0xf89c('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5dca5e[_0xf89c('0x27')],_0x5dca5e['id']),util[_0xf89c('0x23')](_0x3fcc93,{'showHidden':![],'depth':null}));}return _0x20abc0(null,_0xcd82c4);})[_0xf89c('0x24')](function(_0x43064e){logger[_0xf89c('0x21')](util['format'](_0xf89c('0x22'),_0x5dca5e[_0xf89c('0x27')],_0x5dca5e['id']),util[_0xf89c('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x20abc0(_0x43064e);});}else{return _0x20abc0(null,_0xcd82c4);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index bb5addb..7a4e6ef 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 _0x677a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','limit','map','include','attributes','model','then','debug','ShowZohoAccount','find','lodash','moment'];(function(_0x13ffab,_0x449a1c){var _0x11cfda=function(_0x2cd296){while(--_0x2cd296){_0x13ffab['push'](_0x13ffab['shift']());}};_0x11cfda(++_0x449a1c);}(_0x677a,0xd6));var _0xa677=function(_0x11fbc4,_0x41cdcc){_0x11fbc4=_0x11fbc4-0x0;var _0x25dc49=_0x677a[_0x11fbc4];return _0x25dc49;};'use strict';var _=require(_0xa677('0x0'));var util=require('util');var moment=require(_0xa677('0x1'));var BPromise=require(_0xa677('0x2'));var rs=require(_0xa677('0x3'));var fs=require('fs');var Redis=require(_0xa677('0x4'));var db=require(_0xa677('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa677('0x6'))(_0xa677('0x7'));var config=require(_0xa677('0x8'));var jayson=require(_0xa677('0x9'));var client=jayson[_0xa677('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x303092,_0x1c997f,_0x130b66){return new BPromise(function(_0x10fb5e,_0x568910){return client['request'](_0x303092,_0x130b66)['then'](function(_0x43d392){logger['info'](_0xa677('0xb'),_0x1c997f,_0xa677('0xc'));logger['debug'](_0xa677('0xd'),_0x1c997f,_0xa677('0xc'),JSON[_0xa677('0xe')](_0x43d392));if(_0x43d392[_0xa677('0xf')]){if(_0x43d392['error'][_0xa677('0x10')]===0x1f4){logger[_0xa677('0xf')](_0xa677('0xb'),_0x1c997f,_0x43d392[_0xa677('0xf')]['message']);return _0x568910(_0x43d392[_0xa677('0xf')]['message']);}logger[_0xa677('0xf')](_0xa677('0xb'),_0x1c997f,_0x43d392[_0xa677('0xf')][_0xa677('0x11')]);return _0x10fb5e(_0x43d392[_0xa677('0xf')][_0xa677('0x11')]);}else{logger[_0xa677('0x12')](_0xa677('0xb'),_0x1c997f,_0xa677('0xc'));_0x10fb5e(_0x43d392[_0xa677('0x13')][_0xa677('0x11')]);}})[_0xa677('0x14')](function(_0x37316c){logger[_0xa677('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x1c997f,_0x37316c);_0x568910(_0x37316c);});});}exports[_0xa677('0x15')]=function(_0x5db4d2){var _0x495c70=this;return new Promise(function(_0x4e6b3d,_0xbc3f5b){return db[_0xa677('0x16')][_0xa677('0x17')]({'raw':_0x5db4d2[_0xa677('0x18')]?_0x5db4d2['options'][_0xa677('0x19')]===undefined?!![]:![]:!![],'where':_0x5db4d2[_0xa677('0x18')]?_0x5db4d2[_0xa677('0x18')][_0xa677('0x1a')]||null:null,'attributes':_0x5db4d2[_0xa677('0x18')]?_0x5db4d2[_0xa677('0x18')]['attributes']||null:null,'limit':_0x5db4d2[_0xa677('0x18')]?_0x5db4d2['options'][_0xa677('0x1b')]||null:null,'include':_0x5db4d2[_0xa677('0x18')]?_0x5db4d2[_0xa677('0x18')]['include']?_[_0xa677('0x1c')](_0x5db4d2[_0xa677('0x18')][_0xa677('0x1d')],function(_0x1c59e4){return{'model':db[_0x1c59e4['model']],'as':_0x1c59e4['as'],'attributes':_0x1c59e4[_0xa677('0x1e')],'include':_0x1c59e4[_0xa677('0x1d')]?_['map'](_0x1c59e4[_0xa677('0x1d')],function(_0xe54876){return{'model':db[_0xe54876[_0xa677('0x1f')]],'as':_0xe54876['as'],'attributes':_0xe54876[_0xa677('0x1e')],'include':_0xe54876[_0xa677('0x1d')]?_[_0xa677('0x1c')](_0xe54876['include'],function(_0x34dee4){return{'model':db[_0x34dee4[_0xa677('0x1f')]],'as':_0x34dee4['as'],'attributes':_0x34dee4[_0xa677('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa677('0x20')](function(_0x428987){logger[_0xa677('0x12')]('GetZohoAccount',_0x5db4d2);logger[_0xa677('0x21')](_0xa677('0x15'),_0x5db4d2,JSON[_0xa677('0xe')](_0x428987));_0x4e6b3d(_0x428987);})['catch'](function(_0x2d1e6b){logger[_0xa677('0xf')](_0xa677('0x15'),_0x2d1e6b[_0xa677('0x11')],_0x5db4d2);_0xbc3f5b(_0x495c70['error'](0x1f4,_0x2d1e6b[_0xa677('0x11')]));});});};exports[_0xa677('0x22')]=function(_0x4117e1){var _0x5ed0a1=this;return new Promise(function(_0x36f653,_0x2fefd7){return db[_0xa677('0x16')][_0xa677('0x23')]({'raw':_0x4117e1[_0xa677('0x18')]?_0x4117e1[_0xa677('0x18')][_0xa677('0x19')]===undefined?!![]:![]:!![],'where':_0x4117e1[_0xa677('0x18')]?_0x4117e1['options'][_0xa677('0x1a')]||null:null,'attributes':_0x4117e1['options']?_0x4117e1[_0xa677('0x18')][_0xa677('0x1e')]||null:null,'include':_0x4117e1[_0xa677('0x18')]?_0x4117e1[_0xa677('0x18')][_0xa677('0x1d')]?_[_0xa677('0x1c')](_0x4117e1[_0xa677('0x18')][_0xa677('0x1d')],function(_0x32460e){return{'model':db[_0x32460e['model']],'as':_0x32460e['as'],'attributes':_0x32460e[_0xa677('0x1e')],'include':_0x32460e['include']?_[_0xa677('0x1c')](_0x32460e[_0xa677('0x1d')],function(_0x2e6431){return{'model':db[_0x2e6431[_0xa677('0x1f')]],'as':_0x2e6431['as'],'attributes':_0x2e6431['attributes'],'include':_0x2e6431[_0xa677('0x1d')]?_[_0xa677('0x1c')](_0x2e6431[_0xa677('0x1d')],function(_0x534fa6){return{'model':db[_0x534fa6['model']],'as':_0x534fa6['as'],'attributes':_0x534fa6[_0xa677('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa677('0x20')](function(_0x3775d0){logger['info']('ShowZohoAccount',_0x4117e1);logger[_0xa677('0x21')](_0xa677('0x22'),_0x4117e1,JSON[_0xa677('0xe')](_0x3775d0));_0x36f653(_0x3775d0);})[_0xa677('0x14')](function(_0x52a56e){logger[_0xa677('0xf')](_0xa677('0x22'),_0x52a56e['message'],_0x4117e1);_0x2fefd7(_0x5ed0a1['error'](0x1f4,_0x52a56e[_0xa677('0x11')]));});});}; \ No newline at end of file +var _0x6f75=['ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','options','raw','attributes','limit','include','map','model','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x8445ad,_0x3fc81d){var _0x13e22=function(_0x3c5dc1){while(--_0x3c5dc1){_0x8445ad['push'](_0x8445ad['shift']());}};_0x13e22(++_0x3fc81d);}(_0x6f75,0x71));var _0x56f7=function(_0x16e957,_0xfe9f78){_0x16e957=_0x16e957-0x0;var _0x47529f=_0x6f75[_0x16e957];return _0x47529f;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var rs=require(_0x56f7('0x4'));var fs=require('fs');var Redis=require(_0x56f7('0x5'));var db=require(_0x56f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56f7('0x7'))(_0x56f7('0x8'));var config=require(_0x56f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x137d14,_0xcc51b1,_0x4b5dcc){return new BPromise(function(_0x184bf7,_0x5155ff){return client['request'](_0x137d14,_0x4b5dcc)[_0x56f7('0xa')](function(_0x1e607c){logger[_0x56f7('0xb')](_0x56f7('0xc'),_0xcc51b1,_0x56f7('0xd'));logger[_0x56f7('0xe')](_0x56f7('0xf'),_0xcc51b1,_0x56f7('0xd'),JSON[_0x56f7('0x10')](_0x1e607c));if(_0x1e607c[_0x56f7('0x11')]){if(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x12')]===0x1f4){logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c['error'][_0x56f7('0x13')]);return _0x5155ff(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);return _0x184bf7(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0xcc51b1,_0x56f7('0xd'));_0x184bf7(_0x1e607c[_0x56f7('0x14')][_0x56f7('0x13')]);}})[_0x56f7('0x15')](function(_0x40fb77){logger[_0x56f7('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xcc51b1,_0x40fb77);_0x5155ff(_0x40fb77);});});}exports[_0x56f7('0x16')]=function(_0x789c67){var _0x4f0e3a=this;return new Promise(function(_0x5af8cf,_0x2ccb9e){return db[_0x56f7('0x17')]['findAll']({'raw':_0x789c67[_0x56f7('0x18')]?_0x789c67[_0x56f7('0x18')][_0x56f7('0x19')]===undefined?!![]:![]:!![],'where':_0x789c67['options']?_0x789c67['options']['where']||null:null,'attributes':_0x789c67[_0x56f7('0x18')]?_0x789c67[_0x56f7('0x18')][_0x56f7('0x1a')]||null:null,'limit':_0x789c67[_0x56f7('0x18')]?_0x789c67[_0x56f7('0x18')][_0x56f7('0x1b')]||null:null,'include':_0x789c67['options']?_0x789c67['options'][_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x789c67[_0x56f7('0x18')]['include'],function(_0x1cfaca){return{'model':db[_0x1cfaca[_0x56f7('0x1e')]],'as':_0x1cfaca['as'],'attributes':_0x1cfaca[_0x56f7('0x1a')],'include':_0x1cfaca[_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x1cfaca[_0x56f7('0x1c')],function(_0x2209d9){return{'model':db[_0x2209d9[_0x56f7('0x1e')]],'as':_0x2209d9['as'],'attributes':_0x2209d9[_0x56f7('0x1a')],'include':_0x2209d9[_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x2209d9['include'],function(_0x1b5267){return{'model':db[_0x1b5267[_0x56f7('0x1e')]],'as':_0x1b5267['as'],'attributes':_0x1b5267['attributes']};}):[]};}):[]};}):[]:[]})[_0x56f7('0xa')](function(_0xfec74c){logger[_0x56f7('0xb')](_0x56f7('0x16'),_0x789c67);logger[_0x56f7('0xe')](_0x56f7('0x16'),_0x789c67,JSON[_0x56f7('0x10')](_0xfec74c));_0x5af8cf(_0xfec74c);})[_0x56f7('0x15')](function(_0x4c59a0){logger[_0x56f7('0x11')](_0x56f7('0x16'),_0x4c59a0['message'],_0x789c67);_0x2ccb9e(_0x4f0e3a['error'](0x1f4,_0x4c59a0[_0x56f7('0x13')]));});});};exports[_0x56f7('0x1f')]=function(_0x4c985b){var _0x219a2b=this;return new Promise(function(_0x1bd0c2,_0x38fbe7){return db[_0x56f7('0x17')]['find']({'raw':_0x4c985b['options']?_0x4c985b['options'][_0x56f7('0x19')]===undefined?!![]:![]:!![],'where':_0x4c985b['options']?_0x4c985b['options']['where']||null:null,'attributes':_0x4c985b[_0x56f7('0x18')]?_0x4c985b[_0x56f7('0x18')][_0x56f7('0x1a')]||null:null,'include':_0x4c985b[_0x56f7('0x18')]?_0x4c985b['options'][_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x4c985b[_0x56f7('0x18')][_0x56f7('0x1c')],function(_0x407a79){return{'model':db[_0x407a79['model']],'as':_0x407a79['as'],'attributes':_0x407a79[_0x56f7('0x1a')],'include':_0x407a79['include']?_[_0x56f7('0x1d')](_0x407a79['include'],function(_0x48ff44){return{'model':db[_0x48ff44[_0x56f7('0x1e')]],'as':_0x48ff44['as'],'attributes':_0x48ff44[_0x56f7('0x1a')],'include':_0x48ff44[_0x56f7('0x1c')]?_[_0x56f7('0x1d')](_0x48ff44[_0x56f7('0x1c')],function(_0x2afcc8){return{'model':db[_0x2afcc8['model']],'as':_0x2afcc8['as'],'attributes':_0x2afcc8[_0x56f7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x56f7('0xa')](function(_0x587ddc){logger['info'](_0x56f7('0x1f'),_0x4c985b);logger[_0x56f7('0xe')](_0x56f7('0x1f'),_0x4c985b,JSON['stringify'](_0x587ddc));_0x1bd0c2(_0x587ddc);})[_0x56f7('0x15')](function(_0x69dcfd){logger[_0x56f7('0x11')](_0x56f7('0x1f'),_0x69dcfd['message'],_0x4c985b);_0x38fbe7(_0x219a2b[_0x56f7('0x11')](0x1f4,_0x69dcfd[_0x56f7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index c055c00..ba310f2 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 _0x2896=['update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2896,0x163));var _0x6289=function(_0x4a703b,_0x34a03d){_0x4a703b=_0x4a703b-0x0;var _0x496179=_0x2896[_0x4a703b];return _0x496179;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6289('0x0'));var timeout=require(_0x6289('0x1'));var express=require(_0x6289('0x2'));var router=express['Router']();var fs_extra=require(_0x6289('0x3'));var auth=require(_0x6289('0x4'));var interaction=require(_0x6289('0x5'));var config=require(_0x6289('0x6'));var controller=require(_0x6289('0x7'));router[_0x6289('0x8')]('/',auth[_0x6289('0x9')](),controller[_0x6289('0xa')]);router[_0x6289('0x8')](_0x6289('0xb'),auth['isAuthenticated'](),controller[_0x6289('0xc')]);router[_0x6289('0x8')](_0x6289('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x6289('0x8')]('/:id/subjects',auth[_0x6289('0x9')](),controller[_0x6289('0xe')]);router['get'](_0x6289('0xf'),auth[_0x6289('0x9')](),controller[_0x6289('0x10')]);router[_0x6289('0x11')]('/',auth['isAuthenticated'](),controller[_0x6289('0x12')]);router['put'](_0x6289('0xb'),auth['isAuthenticated'](),controller[_0x6289('0x13')]);router[_0x6289('0x14')](_0x6289('0xb'),auth[_0x6289('0x9')](),controller['destroy']);module[_0x6289('0x15')]=router; \ No newline at end of file +var _0x27b0=['path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer'];(function(_0x19d9d7,_0x6c2304){var _0x57bb06=function(_0x45a0bd){while(--_0x45a0bd){_0x19d9d7['push'](_0x19d9d7['shift']());}};_0x57bb06(++_0x6c2304);}(_0x27b0,0x1df));var _0x027b=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x27b0[_0x1f6f84];return _0x177f40;};'use strict';var multer=require(_0x027b('0x0'));var util=require('util');var path=require(_0x027b('0x1'));var timeout=require(_0x027b('0x2'));var express=require('express');var router=express[_0x027b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x027b('0x4'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x027b('0x5')]('/',auth[_0x027b('0x6')](),controller['index']);router[_0x027b('0x5')](_0x027b('0x7'),auth[_0x027b('0x6')](),controller['show']);router[_0x027b('0x5')](_0x027b('0x8'),auth[_0x027b('0x6')](),controller[_0x027b('0x9')]);router['get'](_0x027b('0xa'),auth[_0x027b('0x6')](),controller[_0x027b('0xb')]);router['get'](_0x027b('0xc'),auth[_0x027b('0x6')](),controller[_0x027b('0xd')]);router[_0x027b('0xe')]('/',auth[_0x027b('0x6')](),controller[_0x027b('0xf')]);router['put']('/:id',auth[_0x027b('0x6')](),controller[_0x027b('0x10')]);router[_0x027b('0x11')](_0x027b('0x7'),auth[_0x027b('0x6')](),controller[_0x027b('0x12')]);module[_0x027b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index fd05b33..7dad90a 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 _0x4040=['exports','STRING','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x509bdf,_0x4518a8){var _0x2363de=function(_0x59f1e4){while(--_0x59f1e4){_0x509bdf['push'](_0x509bdf['shift']());}};_0x2363de(++_0x4518a8);}(_0x4040,0x1bf));var _0x0404=function(_0x12d726,_0x20f1c1){_0x12d726=_0x12d726-0x0;var _0x3be12f=_0x4040[_0x12d726];return _0x3be12f;};'use strict';var Sequelize=require(_0x0404('0x0'));module[_0x0404('0x1')]={'name':{'type':Sequelize[_0x0404('0x2')]},'moduleCreate':{'type':Sequelize[_0x0404('0x3')](_0x0404('0x4'),_0x0404('0x5'),_0x0404('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x0404('0x7'),_0x0404('0x5'),_0x0404('0x4')),'defaultValue':_0x0404('0x7')},'description':{'type':Sequelize[_0x0404('0x2')]}}; \ No newline at end of file +var _0xa7f1=['contact','nothing','contact_lead','STRING','exports','ENUM','lead'];(function(_0x31cc4a,_0x49fcf6){var _0x11d222=function(_0x2e7394){while(--_0x2e7394){_0x31cc4a['push'](_0x31cc4a['shift']());}};_0x11d222(++_0x49fcf6);}(_0xa7f1,0x11c));var _0x1a7f=function(_0x56a7bc,_0x41d6f6){_0x56a7bc=_0x56a7bc-0x0;var _0x4f5883=_0xa7f1[_0x56a7bc];return _0x4f5883;};'use strict';var Sequelize=require('sequelize');module[_0x1a7f('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x1a7f('0x1')](_0x1a7f('0x2'),_0x1a7f('0x3'),_0x1a7f('0x4')),'defaultValue':_0x1a7f('0x2')},'moduleSearch':{'type':Sequelize[_0x1a7f('0x1')](_0x1a7f('0x5'),_0x1a7f('0x3'),_0x1a7f('0x2')),'defaultValue':_0x1a7f('0x5')},'description':{'type':Sequelize[_0x1a7f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 6a11737..c987326 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 _0x36b0=['error','stack','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','name','filter','merge','options','then','include','findAll','rows','catch','show','params','create','body','find','findOne','ZohoField','order','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','sendStatus'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x36b0,0x1d5));var _0x036b=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x36b0[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x036b('0x0'));var rimraf=require(_0x036b('0x1'));var zipdir=require(_0x036b('0x2'));var jsonpatch=require(_0x036b('0x3'));var rp=require(_0x036b('0x4'));var moment=require(_0x036b('0x5'));var BPromise=require(_0x036b('0x6'));var Mustache=require(_0x036b('0x7'));var util=require(_0x036b('0x8'));var path=require(_0x036b('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x036b('0xa'));var fs=require('fs');var fs_extra=require(_0x036b('0xb'));var _=require(_0x036b('0xc'));var squel=require(_0x036b('0xd'));var crypto=require(_0x036b('0xe'));var jsforce=require(_0x036b('0xf'));var deskjs=require(_0x036b('0x10'));var toCsv=require(_0x036b('0x11'));var querystring=require(_0x036b('0x12'));var Papa=require(_0x036b('0x13'));var Redis=require(_0x036b('0x14'));var authService=require(_0x036b('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x036b('0x16'));var logger=require(_0x036b('0x17'))('api');var utils=require(_0x036b('0x18'));var config=require(_0x036b('0x19'));var licenseUtil=require(_0x036b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x453015,_0x3ba781){_0x3ba781=_0x3ba781||0xcc;return function(_0x526e99){if(_0x526e99){return _0x453015['sendStatus'](_0x3ba781);}return _0x453015[_0x036b('0x1b')](_0x3ba781)[_0x036b('0x1c')]();};}function respondWithResult(_0x117bcb,_0x57221b){_0x57221b=_0x57221b||0xc8;return function(_0xa4d541){if(_0xa4d541){return _0x117bcb[_0x036b('0x1b')](_0x57221b)['json'](_0xa4d541);}};}function respondWithFilteredResult(_0x1ad2c4,_0x290bd6){return function(_0x20f5e3){if(_0x20f5e3){var _0x234e51=typeof _0x290bd6[_0x036b('0x1d')]===_0x036b('0x1e')&&typeof _0x290bd6[_0x036b('0x1f')]===_0x036b('0x1e');var _0x4b3afa=_0x20f5e3[_0x036b('0x20')];var _0x48f1d5=_0x234e51?0x0:_0x290bd6[_0x036b('0x1d')];var _0x11263f=_0x234e51?_0x20f5e3[_0x036b('0x20')]:_0x290bd6[_0x036b('0x1d')]+_0x290bd6[_0x036b('0x1f')];var _0xf3b27f;if(_0x11263f>=_0x4b3afa){_0x11263f=_0x4b3afa;_0xf3b27f=0xc8;}else{_0xf3b27f=0xce;}_0x1ad2c4[_0x036b('0x1b')](_0xf3b27f);return _0x1ad2c4[_0x036b('0x21')](_0x036b('0x22'),_0x48f1d5+'-'+_0x11263f+'/'+_0x4b3afa)[_0x036b('0x23')](_0x20f5e3);}return null;};}function patchUpdates(_0x26f418){return function(_0x24deef){try{jsonpatch['apply'](_0x24deef,_0x26f418,!![]);}catch(_0x4f2b73){return BPromise[_0x036b('0x24')](_0x4f2b73);}return _0x24deef[_0x036b('0x25')]();};}function saveUpdates(_0x34c706,_0x14e911){return function(_0x5a3cfb){if(_0x5a3cfb){return _0x5a3cfb[_0x036b('0x26')](_0x34c706)['then'](function(_0x284039){return _0x284039;});}return null;};}function removeEntity(_0x444499,_0x3ace60){return function(_0x519790){if(_0x519790){return _0x519790[_0x036b('0x27')]()['then'](function(){_0x444499[_0x036b('0x1b')](0xcc)[_0x036b('0x1c')]();});}};}function handleEntityNotFound(_0x23c403,_0xeae8c9){return function(_0x2e0a49){if(!_0x2e0a49){_0x23c403[_0x036b('0x28')](0x194);}return _0x2e0a49;};}function handleError(_0x55dbff,_0x50b501){_0x50b501=_0x50b501||0x1f4;return function(_0x27babe){logger[_0x036b('0x29')](_0x27babe[_0x036b('0x2a')]);if(_0x27babe['name']){delete _0x27babe['name'];}_0x55dbff['status'](_0x50b501)[_0x036b('0x2b')](_0x27babe);};}exports[_0x036b('0x2c')]=function(_0x36c6c5,_0x39474d){var _0x34d252={},_0x3aba10={},_0x5dd7b8={'count':0x0,'rows':[]};var _0x20f99b=_[_0x036b('0x2d')](db[_0x036b('0x2e')][_0x036b('0x2f')],function(_0x5609a3){return{'name':_0x5609a3[_0x036b('0x30')],'type':_0x5609a3[_0x036b('0x31')][_0x036b('0x32')]};});_0x3aba10[_0x036b('0x33')]=_[_0x036b('0x2d')](_0x20f99b,'name');_0x3aba10[_0x036b('0x34')]=_[_0x036b('0x35')](_0x36c6c5[_0x036b('0x34')]);_0x3aba10[_0x036b('0x36')]=_[_0x036b('0x37')](_0x3aba10[_0x036b('0x33')],_0x3aba10['query']);_0x34d252[_0x036b('0x38')]=_[_0x036b('0x37')](_0x3aba10[_0x036b('0x33')],qs[_0x036b('0x39')](_0x36c6c5[_0x036b('0x34')][_0x036b('0x39')]));_0x34d252[_0x036b('0x38')]=_0x34d252[_0x036b('0x38')][_0x036b('0x3a')]?_0x34d252[_0x036b('0x38')]:_0x3aba10[_0x036b('0x33')];if(!_0x36c6c5[_0x036b('0x34')]['hasOwnProperty'](_0x036b('0x3b'))){_0x34d252['limit']=qs[_0x036b('0x1f')](_0x36c6c5[_0x036b('0x34')][_0x036b('0x1f')]);_0x34d252[_0x036b('0x1d')]=qs['offset'](_0x36c6c5[_0x036b('0x34')][_0x036b('0x1d')]);}_0x34d252['order']=qs[_0x036b('0x3c')](_0x36c6c5[_0x036b('0x34')][_0x036b('0x3c')]);_0x34d252[_0x036b('0x3d')]=qs[_0x036b('0x36')](_[_0x036b('0x3e')](_0x36c6c5[_0x036b('0x34')],_0x3aba10['filters']),_0x20f99b);if(_0x36c6c5[_0x036b('0x34')]['filter']){_0x34d252[_0x036b('0x3d')]=_['merge'](_0x34d252[_0x036b('0x3d')],{'$or':_[_0x036b('0x2d')](_0x20f99b,function(_0x234701){if(_0x234701[_0x036b('0x31')]!==_0x036b('0x3f')){var _0x3e0038={};_0x3e0038[_0x234701[_0x036b('0x40')]]={'$like':'%'+_0x36c6c5[_0x036b('0x34')][_0x036b('0x41')]+'%'};return _0x3e0038;}})});}_0x34d252=_[_0x036b('0x42')]({},_0x34d252,_0x36c6c5[_0x036b('0x43')]);var _0x20d70a={'where':_0x34d252[_0x036b('0x3d')]};return db['ZohoConfiguration'][_0x036b('0x20')](_0x20d70a)[_0x036b('0x44')](function(_0x31cbc7){_0x5dd7b8[_0x036b('0x20')]=_0x31cbc7;if(_0x36c6c5[_0x036b('0x34')]['includeAll']){_0x34d252[_0x036b('0x45')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x036b('0x46')](_0x34d252);})[_0x036b('0x44')](function(_0x4361e3){_0x5dd7b8[_0x036b('0x47')]=_0x4361e3;return _0x5dd7b8;})['then'](respondWithFilteredResult(_0x39474d,_0x34d252))[_0x036b('0x48')](handleError(_0x39474d,null));};exports[_0x036b('0x49')]=function(_0x4829ff,_0x4671fd){var _0x40cfe4={'raw':![],'where':{'id':_0x4829ff[_0x036b('0x4a')]['id']}},_0x360f46={};_0x360f46[_0x036b('0x33')]=_['keys'](db[_0x036b('0x2e')]['rawAttributes']);_0x360f46[_0x036b('0x34')]=_[_0x036b('0x35')](_0x4829ff[_0x036b('0x34')]);_0x360f46[_0x036b('0x36')]=_[_0x036b('0x37')](_0x360f46[_0x036b('0x33')],_0x360f46[_0x036b('0x34')]);_0x40cfe4[_0x036b('0x38')]=_['intersection'](_0x360f46[_0x036b('0x33')],qs['fields'](_0x4829ff[_0x036b('0x34')][_0x036b('0x39')]));_0x40cfe4[_0x036b('0x38')]=_0x40cfe4[_0x036b('0x38')][_0x036b('0x3a')]?_0x40cfe4[_0x036b('0x38')]:_0x360f46[_0x036b('0x33')];if(_0x4829ff[_0x036b('0x34')]['includeAll']){_0x40cfe4['include']=[{'all':!![]}];}_0x40cfe4=_[_0x036b('0x42')]({},_0x40cfe4,_0x4829ff[_0x036b('0x43')]);return db[_0x036b('0x2e')]['find'](_0x40cfe4)[_0x036b('0x44')](handleEntityNotFound(_0x4671fd,null))[_0x036b('0x44')](respondWithResult(_0x4671fd,null))[_0x036b('0x48')](handleError(_0x4671fd,null));};exports[_0x036b('0x4b')]=function(_0x504ef3,_0x1db711){return db[_0x036b('0x2e')][_0x036b('0x4b')](_0x504ef3[_0x036b('0x4c')],{})['then'](respondWithResult(_0x1db711,0xc9))[_0x036b('0x48')](handleError(_0x1db711,null));};exports[_0x036b('0x26')]=function(_0x696e9c,_0x5d5218){if(_0x696e9c[_0x036b('0x4c')]['id']){delete _0x696e9c[_0x036b('0x4c')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x696e9c[_0x036b('0x4a')]['id']}})[_0x036b('0x44')](handleEntityNotFound(_0x5d5218,null))[_0x036b('0x44')](saveUpdates(_0x696e9c[_0x036b('0x4c')],null))[_0x036b('0x44')](respondWithResult(_0x5d5218,null))['catch'](handleError(_0x5d5218,null));};exports[_0x036b('0x27')]=function(_0x57f861,_0x68b003){return db[_0x036b('0x2e')][_0x036b('0x4d')]({'where':{'id':_0x57f861[_0x036b('0x4a')]['id']}})[_0x036b('0x44')](handleEntityNotFound(_0x68b003,null))[_0x036b('0x44')](removeEntity(_0x68b003,null))[_0x036b('0x48')](handleError(_0x68b003,null));};exports['getFields']=function(_0x209e3d,_0x357d9b,_0x2b664e){var _0x4e232f={};var _0x16a598={};var _0x23eba7;var _0xc6ec4;return db[_0x036b('0x2e')][_0x036b('0x4e')]({'where':{'id':_0x209e3d['params']['id']}})[_0x036b('0x44')](handleEntityNotFound(_0x357d9b,null))[_0x036b('0x44')](function(_0x2a9995){if(_0x2a9995){_0x23eba7=_0x2a9995;_0x16a598['model']=_[_0x036b('0x35')](db[_0x036b('0x4f')]['rawAttributes']);_0x16a598['query']=_[_0x036b('0x35')](_0x209e3d[_0x036b('0x34')]);_0x16a598[_0x036b('0x36')]=_[_0x036b('0x37')](_0x16a598[_0x036b('0x33')],_0x16a598[_0x036b('0x34')]);_0x4e232f['attributes']=_['intersection'](_0x16a598[_0x036b('0x33')],qs['fields'](_0x209e3d[_0x036b('0x34')]['fields']));_0x4e232f[_0x036b('0x38')]=_0x4e232f['attributes'][_0x036b('0x3a')]?_0x4e232f['attributes']:_0x16a598['model'];_0x4e232f[_0x036b('0x50')]=qs[_0x036b('0x3c')](_0x209e3d[_0x036b('0x34')][_0x036b('0x3c')]);_0x4e232f[_0x036b('0x3d')]=qs[_0x036b('0x36')](_[_0x036b('0x3e')](_0x209e3d[_0x036b('0x34')],_0x16a598[_0x036b('0x36')]));if(_0x209e3d['query'][_0x036b('0x41')]){_0x4e232f[_0x036b('0x3d')]=_[_0x036b('0x42')](_0x4e232f[_0x036b('0x3d')],{'$or':_[_0x036b('0x2d')](_0x4e232f[_0x036b('0x38')],function(_0x43155c){var _0x4e67e6={};_0x4e67e6[_0x43155c]={'$like':'%'+_0x209e3d[_0x036b('0x34')][_0x036b('0x41')]+'%'};return _0x4e67e6;})});}_0x4e232f=_[_0x036b('0x42')]({},_0x4e232f,_0x209e3d[_0x036b('0x43')]);return _0x23eba7[_0x036b('0x51')](_0x4e232f);}})[_0x036b('0x44')](function(_0x533b5f){if(_0x533b5f){_0xc6ec4=_0x533b5f[_0x036b('0x3a')];if(!_0x209e3d[_0x036b('0x34')][_0x036b('0x52')]('nolimit')){_0x4e232f[_0x036b('0x1f')]=qs[_0x036b('0x1f')](_0x209e3d['query'][_0x036b('0x1f')]);_0x4e232f[_0x036b('0x1d')]=qs['offset'](_0x209e3d[_0x036b('0x34')][_0x036b('0x1d')]);}return _0x23eba7[_0x036b('0x51')](_0x4e232f);}})[_0x036b('0x44')](function(_0x48d11d){if(_0x48d11d){return _0x48d11d?{'count':_0xc6ec4,'rows':_0x48d11d}:null;}})[_0x036b('0x44')](respondWithResult(_0x357d9b,null))[_0x036b('0x48')](handleError(_0x357d9b,null));};exports[_0x036b('0x53')]=function(_0x1b5ffb,_0x2d150a,_0x380ed7){var _0x5d348d={};var _0x214260={};var _0x2ae912;var _0x489c29;return db[_0x036b('0x2e')][_0x036b('0x4e')]({'where':{'id':_0x1b5ffb[_0x036b('0x4a')]['id']}})[_0x036b('0x44')](handleEntityNotFound(_0x2d150a,null))[_0x036b('0x44')](function(_0x13044c){if(_0x13044c){_0x2ae912=_0x13044c;_0x214260[_0x036b('0x33')]=_['keys'](db[_0x036b('0x4f')]['rawAttributes']);_0x214260[_0x036b('0x34')]=_[_0x036b('0x35')](_0x1b5ffb[_0x036b('0x34')]);_0x214260[_0x036b('0x36')]=_[_0x036b('0x37')](_0x214260[_0x036b('0x33')],_0x214260[_0x036b('0x34')]);_0x5d348d[_0x036b('0x38')]=_['intersection'](_0x214260[_0x036b('0x33')],qs[_0x036b('0x39')](_0x1b5ffb[_0x036b('0x34')][_0x036b('0x39')]));_0x5d348d[_0x036b('0x38')]=_0x5d348d[_0x036b('0x38')][_0x036b('0x3a')]?_0x5d348d[_0x036b('0x38')]:_0x214260[_0x036b('0x33')];_0x5d348d[_0x036b('0x50')]=qs[_0x036b('0x3c')](_0x1b5ffb[_0x036b('0x34')][_0x036b('0x3c')]);_0x5d348d[_0x036b('0x3d')]=qs[_0x036b('0x36')](_[_0x036b('0x3e')](_0x1b5ffb[_0x036b('0x34')],_0x214260['filters']));if(_0x1b5ffb[_0x036b('0x34')][_0x036b('0x41')]){_0x5d348d[_0x036b('0x3d')]=_[_0x036b('0x42')](_0x5d348d[_0x036b('0x3d')],{'$or':_[_0x036b('0x2d')](_0x5d348d[_0x036b('0x38')],function(_0x2004a5){var _0x300de4={};_0x300de4[_0x2004a5]={'$like':'%'+_0x1b5ffb[_0x036b('0x34')][_0x036b('0x41')]+'%'};return _0x300de4;})});}_0x5d348d=_['merge']({},_0x5d348d,_0x1b5ffb[_0x036b('0x43')]);return _0x2ae912[_0x036b('0x53')](_0x5d348d);}})['then'](function(_0x2a1246){if(_0x2a1246){_0x489c29=_0x2a1246[_0x036b('0x3a')];if(!_0x1b5ffb[_0x036b('0x34')][_0x036b('0x52')](_0x036b('0x3b'))){_0x5d348d[_0x036b('0x1f')]=qs[_0x036b('0x1f')](_0x1b5ffb['query'][_0x036b('0x1f')]);_0x5d348d[_0x036b('0x1d')]=qs['offset'](_0x1b5ffb['query'][_0x036b('0x1d')]);}return _0x2ae912[_0x036b('0x53')](_0x5d348d);}})[_0x036b('0x44')](function(_0x54ceba){if(_0x54ceba){return _0x54ceba?{'count':_0x489c29,'rows':_0x54ceba}:null;}})[_0x036b('0x44')](respondWithResult(_0x2d150a,null))['catch'](handleError(_0x2d150a,null));};exports[_0x036b('0x54')]=function(_0x53e4d1,_0x3bf038,_0x827d9){var _0x363f40={};var _0x32536e={};var _0x5ecd73;var _0x1c8405;return db[_0x036b('0x2e')]['findOne']({'where':{'id':_0x53e4d1[_0x036b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3bf038,null))[_0x036b('0x44')](function(_0x3298fd){if(_0x3298fd){_0x5ecd73=_0x3298fd;_0x32536e[_0x036b('0x33')]=_[_0x036b('0x35')](db['ZohoField'][_0x036b('0x2f')]);_0x32536e['query']=_[_0x036b('0x35')](_0x53e4d1[_0x036b('0x34')]);_0x32536e['filters']=_[_0x036b('0x37')](_0x32536e[_0x036b('0x33')],_0x32536e[_0x036b('0x34')]);_0x363f40[_0x036b('0x38')]=_[_0x036b('0x37')](_0x32536e[_0x036b('0x33')],qs[_0x036b('0x39')](_0x53e4d1[_0x036b('0x34')]['fields']));_0x363f40[_0x036b('0x38')]=_0x363f40[_0x036b('0x38')]['length']?_0x363f40['attributes']:_0x32536e[_0x036b('0x33')];_0x363f40[_0x036b('0x50')]=qs[_0x036b('0x3c')](_0x53e4d1['query'][_0x036b('0x3c')]);_0x363f40[_0x036b('0x3d')]=qs[_0x036b('0x36')](_[_0x036b('0x3e')](_0x53e4d1[_0x036b('0x34')],_0x32536e[_0x036b('0x36')]));if(_0x53e4d1[_0x036b('0x34')][_0x036b('0x41')]){_0x363f40['where']=_[_0x036b('0x42')](_0x363f40[_0x036b('0x3d')],{'$or':_[_0x036b('0x2d')](_0x363f40[_0x036b('0x38')],function(_0x3e0ec3){var _0x1fa8d5={};_0x1fa8d5[_0x3e0ec3]={'$like':'%'+_0x53e4d1['query'][_0x036b('0x41')]+'%'};return _0x1fa8d5;})});}_0x363f40=_[_0x036b('0x42')]({},_0x363f40,_0x53e4d1[_0x036b('0x43')]);return _0x5ecd73[_0x036b('0x54')](_0x363f40);}})[_0x036b('0x44')](function(_0x57a1ca){if(_0x57a1ca){_0x1c8405=_0x57a1ca[_0x036b('0x3a')];if(!_0x53e4d1[_0x036b('0x34')][_0x036b('0x52')]('nolimit')){_0x363f40[_0x036b('0x1f')]=qs['limit'](_0x53e4d1[_0x036b('0x34')][_0x036b('0x1f')]);_0x363f40[_0x036b('0x1d')]=qs[_0x036b('0x1d')](_0x53e4d1['query']['offset']);}return _0x5ecd73[_0x036b('0x54')](_0x363f40);}})[_0x036b('0x44')](function(_0x248a4c){if(_0x248a4c){return _0x248a4c?{'count':_0x1c8405,'rows':_0x248a4c}:null;}})[_0x036b('0x44')](respondWithResult(_0x3bf038,null))[_0x036b('0x48')](handleError(_0x3bf038,null));}; \ No newline at end of file +var _0x8ccc=['undefined','offset','count','set','Content-Range','apply','reject','save','destroy','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','then','catch','show','params','find','create','update','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/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','limit'];(function(_0x3e228c,_0x57206f){var _0x12f226=function(_0x14f8a2){while(--_0x14f8a2){_0x3e228c['push'](_0x3e228c['shift']());}};_0x12f226(++_0x57206f);}(_0x8ccc,0x183));var _0xc8cc=function(_0x34def0,_0x554b5b){_0x34def0=_0x34def0-0x0;var _0x2be1c9=_0x8ccc[_0x34def0];return _0x2be1c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8cc('0x0'));var zipdir=require(_0xc8cc('0x1'));var jsonpatch=require(_0xc8cc('0x2'));var rp=require(_0xc8cc('0x3'));var moment=require('moment');var BPromise=require(_0xc8cc('0x4'));var Mustache=require(_0xc8cc('0x5'));var util=require(_0xc8cc('0x6'));var path=require(_0xc8cc('0x7'));var sox=require('sox');var csv=require(_0xc8cc('0x8'));var ejs=require(_0xc8cc('0x9'));var fs=require('fs');var fs_extra=require(_0xc8cc('0xa'));var _=require(_0xc8cc('0xb'));var squel=require(_0xc8cc('0xc'));var crypto=require(_0xc8cc('0xd'));var jsforce=require(_0xc8cc('0xe'));var deskjs=require(_0xc8cc('0xf'));var toCsv=require(_0xc8cc('0x8'));var querystring=require(_0xc8cc('0x10'));var Papa=require(_0xc8cc('0x11'));var Redis=require(_0xc8cc('0x12'));var authService=require(_0xc8cc('0x13'));var qs=require(_0xc8cc('0x14'));var as=require(_0xc8cc('0x15'));var hardwareService=require(_0xc8cc('0x16'));var logger=require(_0xc8cc('0x17'))('api');var utils=require(_0xc8cc('0x18'));var config=require(_0xc8cc('0x19'));var licenseUtil=require(_0xc8cc('0x1a'));var db=require(_0xc8cc('0x1b'))['db'];function respondWithStatusCode(_0x3f886a,_0x5ec92f){_0x5ec92f=_0x5ec92f||0xcc;return function(_0x2175a9){if(_0x2175a9){return _0x3f886a[_0xc8cc('0x1c')](_0x5ec92f);}return _0x3f886a[_0xc8cc('0x1d')](_0x5ec92f)[_0xc8cc('0x1e')]();};}function respondWithResult(_0x369ebc,_0x172a11){_0x172a11=_0x172a11||0xc8;return function(_0x267dc9){if(_0x267dc9){return _0x369ebc[_0xc8cc('0x1d')](_0x172a11)[_0xc8cc('0x1f')](_0x267dc9);}};}function respondWithFilteredResult(_0x3b4029,_0x39ec1e){return function(_0x3074de){if(_0x3074de){var _0x346328=typeof _0x39ec1e['offset']==='undefined'&&typeof _0x39ec1e[_0xc8cc('0x20')]===_0xc8cc('0x21');var _0x3826d8=_0x3074de['count'];var _0x5ad150=_0x346328?0x0:_0x39ec1e[_0xc8cc('0x22')];var _0x26f8a3=_0x346328?_0x3074de[_0xc8cc('0x23')]:_0x39ec1e[_0xc8cc('0x22')]+_0x39ec1e[_0xc8cc('0x20')];var _0x2814e1;if(_0x26f8a3>=_0x3826d8){_0x26f8a3=_0x3826d8;_0x2814e1=0xc8;}else{_0x2814e1=0xce;}_0x3b4029[_0xc8cc('0x1d')](_0x2814e1);return _0x3b4029[_0xc8cc('0x24')](_0xc8cc('0x25'),_0x5ad150+'-'+_0x26f8a3+'/'+_0x3826d8)[_0xc8cc('0x1f')](_0x3074de);}return null;};}function patchUpdates(_0x25fa7d){return function(_0x590aa1){try{jsonpatch[_0xc8cc('0x26')](_0x590aa1,_0x25fa7d,!![]);}catch(_0x60e7f8){return BPromise[_0xc8cc('0x27')](_0x60e7f8);}return _0x590aa1[_0xc8cc('0x28')]();};}function saveUpdates(_0x4ce1b9,_0x5f22d9){return function(_0x3ec568){if(_0x3ec568){return _0x3ec568['update'](_0x4ce1b9)['then'](function(_0xfe556a){return _0xfe556a;});}return null;};}function removeEntity(_0x3cfa64,_0x44018d){return function(_0x2553ab){if(_0x2553ab){return _0x2553ab[_0xc8cc('0x29')]()['then'](function(){_0x3cfa64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x246760,_0x4910f0){return function(_0x31d82d){if(!_0x31d82d){_0x246760[_0xc8cc('0x1c')](0x194);}return _0x31d82d;};}function handleError(_0x1e82e6,_0x36af35){_0x36af35=_0x36af35||0x1f4;return function(_0x48379f){logger['error'](_0x48379f[_0xc8cc('0x2a')]);if(_0x48379f[_0xc8cc('0x2b')]){delete _0x48379f['name'];}_0x1e82e6['status'](_0x36af35)['send'](_0x48379f);};}exports[_0xc8cc('0x2c')]=function(_0xe9df63,_0x46751e){var _0x4b32aa={},_0x207f76={},_0x16deed={'count':0x0,'rows':[]};var _0x102487=_[_0xc8cc('0x2d')](db[_0xc8cc('0x2e')][_0xc8cc('0x2f')],function(_0x4a54e9){return{'name':_0x4a54e9[_0xc8cc('0x30')],'type':_0x4a54e9[_0xc8cc('0x31')][_0xc8cc('0x32')]};});_0x207f76[_0xc8cc('0x33')]=_[_0xc8cc('0x2d')](_0x102487,'name');_0x207f76['query']=_[_0xc8cc('0x34')](_0xe9df63['query']);_0x207f76[_0xc8cc('0x35')]=_[_0xc8cc('0x36')](_0x207f76[_0xc8cc('0x33')],_0x207f76['query']);_0x4b32aa[_0xc8cc('0x37')]=_[_0xc8cc('0x36')](_0x207f76[_0xc8cc('0x33')],qs[_0xc8cc('0x38')](_0xe9df63[_0xc8cc('0x39')]['fields']));_0x4b32aa[_0xc8cc('0x37')]=_0x4b32aa[_0xc8cc('0x37')][_0xc8cc('0x3a')]?_0x4b32aa['attributes']:_0x207f76['model'];if(!_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x3b')](_0xc8cc('0x3c'))){_0x4b32aa['limit']=qs[_0xc8cc('0x20')](_0xe9df63['query'][_0xc8cc('0x20')]);_0x4b32aa[_0xc8cc('0x22')]=qs[_0xc8cc('0x22')](_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x22')]);}_0x4b32aa[_0xc8cc('0x3d')]=qs[_0xc8cc('0x3e')](_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x3e')]);_0x4b32aa['where']=qs[_0xc8cc('0x35')](_[_0xc8cc('0x3f')](_0xe9df63[_0xc8cc('0x39')],_0x207f76['filters']),_0x102487);if(_0xe9df63[_0xc8cc('0x39')]['filter']){_0x4b32aa['where']=_['merge'](_0x4b32aa[_0xc8cc('0x40')],{'$or':_[_0xc8cc('0x2d')](_0x102487,function(_0x4e5f18){if(_0x4e5f18[_0xc8cc('0x31')]!==_0xc8cc('0x41')){var _0x1b4290={};_0x1b4290[_0x4e5f18['name']]={'$like':'%'+_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x42')]+'%'};return _0x1b4290;}})});}_0x4b32aa=_[_0xc8cc('0x43')]({},_0x4b32aa,_0xe9df63[_0xc8cc('0x44')]);var _0x128998={'where':_0x4b32aa[_0xc8cc('0x40')]};return db[_0xc8cc('0x2e')][_0xc8cc('0x23')](_0x128998)['then'](function(_0x2aa0c6){_0x16deed['count']=_0x2aa0c6;if(_0xe9df63[_0xc8cc('0x39')][_0xc8cc('0x45')]){_0x4b32aa['include']=[{'all':!![]}];}return db[_0xc8cc('0x2e')][_0xc8cc('0x46')](_0x4b32aa);})[_0xc8cc('0x47')](function(_0x3ec0fb){_0x16deed['rows']=_0x3ec0fb;return _0x16deed;})[_0xc8cc('0x47')](respondWithFilteredResult(_0x46751e,_0x4b32aa))[_0xc8cc('0x48')](handleError(_0x46751e,null));};exports[_0xc8cc('0x49')]=function(_0xe2dd72,_0x231981){var _0x406525={'raw':![],'where':{'id':_0xe2dd72[_0xc8cc('0x4a')]['id']}},_0x5969ce={};_0x5969ce[_0xc8cc('0x33')]=_[_0xc8cc('0x34')](db['ZohoConfiguration'][_0xc8cc('0x2f')]);_0x5969ce[_0xc8cc('0x39')]=_['keys'](_0xe2dd72[_0xc8cc('0x39')]);_0x5969ce[_0xc8cc('0x35')]=_[_0xc8cc('0x36')](_0x5969ce[_0xc8cc('0x33')],_0x5969ce[_0xc8cc('0x39')]);_0x406525[_0xc8cc('0x37')]=_[_0xc8cc('0x36')](_0x5969ce[_0xc8cc('0x33')],qs[_0xc8cc('0x38')](_0xe2dd72[_0xc8cc('0x39')][_0xc8cc('0x38')]));_0x406525['attributes']=_0x406525[_0xc8cc('0x37')]['length']?_0x406525[_0xc8cc('0x37')]:_0x5969ce[_0xc8cc('0x33')];if(_0xe2dd72[_0xc8cc('0x39')]['includeAll']){_0x406525['include']=[{'all':!![]}];}_0x406525=_[_0xc8cc('0x43')]({},_0x406525,_0xe2dd72['options']);return db[_0xc8cc('0x2e')][_0xc8cc('0x4b')](_0x406525)[_0xc8cc('0x47')](handleEntityNotFound(_0x231981,null))[_0xc8cc('0x47')](respondWithResult(_0x231981,null))[_0xc8cc('0x48')](handleError(_0x231981,null));};exports[_0xc8cc('0x4c')]=function(_0x578928,_0x16333d){return db[_0xc8cc('0x2e')]['create'](_0x578928['body'],{})['then'](respondWithResult(_0x16333d,0xc9))['catch'](handleError(_0x16333d,null));};exports[_0xc8cc('0x4d')]=function(_0x274e7a,_0x3c494f){if(_0x274e7a[_0xc8cc('0x4e')]['id']){delete _0x274e7a['body']['id'];}return db[_0xc8cc('0x2e')][_0xc8cc('0x4b')]({'where':{'id':_0x274e7a['params']['id']}})[_0xc8cc('0x47')](handleEntityNotFound(_0x3c494f,null))['then'](saveUpdates(_0x274e7a[_0xc8cc('0x4e')],null))[_0xc8cc('0x47')](respondWithResult(_0x3c494f,null))[_0xc8cc('0x48')](handleError(_0x3c494f,null));};exports[_0xc8cc('0x29')]=function(_0x31c180,_0x9389d8){return db[_0xc8cc('0x2e')][_0xc8cc('0x4b')]({'where':{'id':_0x31c180[_0xc8cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x9389d8,null))[_0xc8cc('0x47')](removeEntity(_0x9389d8,null))[_0xc8cc('0x48')](handleError(_0x9389d8,null));};exports[_0xc8cc('0x4f')]=function(_0x329c2b,_0x425a77,_0x317352){var _0x31cd9e={};var _0x37d055={};var _0x25743b;var _0x1aed30;return db[_0xc8cc('0x2e')][_0xc8cc('0x50')]({'where':{'id':_0x329c2b[_0xc8cc('0x4a')]['id']}})[_0xc8cc('0x47')](handleEntityNotFound(_0x425a77,null))['then'](function(_0x1a67b6){if(_0x1a67b6){_0x25743b=_0x1a67b6;_0x37d055[_0xc8cc('0x33')]=_[_0xc8cc('0x34')](db[_0xc8cc('0x51')][_0xc8cc('0x2f')]);_0x37d055[_0xc8cc('0x39')]=_[_0xc8cc('0x34')](_0x329c2b[_0xc8cc('0x39')]);_0x37d055[_0xc8cc('0x35')]=_[_0xc8cc('0x36')](_0x37d055[_0xc8cc('0x33')],_0x37d055['query']);_0x31cd9e['attributes']=_[_0xc8cc('0x36')](_0x37d055[_0xc8cc('0x33')],qs[_0xc8cc('0x38')](_0x329c2b[_0xc8cc('0x39')]['fields']));_0x31cd9e[_0xc8cc('0x37')]=_0x31cd9e[_0xc8cc('0x37')][_0xc8cc('0x3a')]?_0x31cd9e[_0xc8cc('0x37')]:_0x37d055[_0xc8cc('0x33')];_0x31cd9e[_0xc8cc('0x3d')]=qs[_0xc8cc('0x3e')](_0x329c2b[_0xc8cc('0x39')][_0xc8cc('0x3e')]);_0x31cd9e[_0xc8cc('0x40')]=qs['filters'](_[_0xc8cc('0x3f')](_0x329c2b[_0xc8cc('0x39')],_0x37d055[_0xc8cc('0x35')]));if(_0x329c2b[_0xc8cc('0x39')][_0xc8cc('0x42')]){_0x31cd9e[_0xc8cc('0x40')]=_[_0xc8cc('0x43')](_0x31cd9e[_0xc8cc('0x40')],{'$or':_[_0xc8cc('0x2d')](_0x31cd9e[_0xc8cc('0x37')],function(_0x10506d){var _0x260e74={};_0x260e74[_0x10506d]={'$like':'%'+_0x329c2b[_0xc8cc('0x39')][_0xc8cc('0x42')]+'%'};return _0x260e74;})});}_0x31cd9e=_['merge']({},_0x31cd9e,_0x329c2b[_0xc8cc('0x44')]);return _0x25743b[_0xc8cc('0x4f')](_0x31cd9e);}})[_0xc8cc('0x47')](function(_0x1ae03b){if(_0x1ae03b){_0x1aed30=_0x1ae03b[_0xc8cc('0x3a')];if(!_0x329c2b['query'][_0xc8cc('0x3b')](_0xc8cc('0x3c'))){_0x31cd9e['limit']=qs['limit'](_0x329c2b[_0xc8cc('0x39')][_0xc8cc('0x20')]);_0x31cd9e[_0xc8cc('0x22')]=qs[_0xc8cc('0x22')](_0x329c2b['query'][_0xc8cc('0x22')]);}return _0x25743b[_0xc8cc('0x4f')](_0x31cd9e);}})[_0xc8cc('0x47')](function(_0x27263e){if(_0x27263e){return _0x27263e?{'count':_0x1aed30,'rows':_0x27263e}:null;}})[_0xc8cc('0x47')](respondWithResult(_0x425a77,null))['catch'](handleError(_0x425a77,null));};exports['getSubjects']=function(_0xdb34d7,_0x30288b,_0x4a4aad){var _0x3ce36a={};var _0x123ecb={};var _0x2c45c3;var _0x4789d0;return db[_0xc8cc('0x2e')]['findOne']({'where':{'id':_0xdb34d7[_0xc8cc('0x4a')]['id']}})[_0xc8cc('0x47')](handleEntityNotFound(_0x30288b,null))['then'](function(_0x55b005){if(_0x55b005){_0x2c45c3=_0x55b005;_0x123ecb['model']=_['keys'](db[_0xc8cc('0x51')]['rawAttributes']);_0x123ecb[_0xc8cc('0x39')]=_[_0xc8cc('0x34')](_0xdb34d7[_0xc8cc('0x39')]);_0x123ecb[_0xc8cc('0x35')]=_[_0xc8cc('0x36')](_0x123ecb[_0xc8cc('0x33')],_0x123ecb[_0xc8cc('0x39')]);_0x3ce36a[_0xc8cc('0x37')]=_['intersection'](_0x123ecb[_0xc8cc('0x33')],qs[_0xc8cc('0x38')](_0xdb34d7[_0xc8cc('0x39')]['fields']));_0x3ce36a[_0xc8cc('0x37')]=_0x3ce36a[_0xc8cc('0x37')][_0xc8cc('0x3a')]?_0x3ce36a[_0xc8cc('0x37')]:_0x123ecb[_0xc8cc('0x33')];_0x3ce36a[_0xc8cc('0x3d')]=qs[_0xc8cc('0x3e')](_0xdb34d7[_0xc8cc('0x39')][_0xc8cc('0x3e')]);_0x3ce36a[_0xc8cc('0x40')]=qs['filters'](_[_0xc8cc('0x3f')](_0xdb34d7[_0xc8cc('0x39')],_0x123ecb[_0xc8cc('0x35')]));if(_0xdb34d7[_0xc8cc('0x39')]['filter']){_0x3ce36a[_0xc8cc('0x40')]=_[_0xc8cc('0x43')](_0x3ce36a[_0xc8cc('0x40')],{'$or':_[_0xc8cc('0x2d')](_0x3ce36a[_0xc8cc('0x37')],function(_0x1f45be){var _0x1dfd98={};_0x1dfd98[_0x1f45be]={'$like':'%'+_0xdb34d7[_0xc8cc('0x39')][_0xc8cc('0x42')]+'%'};return _0x1dfd98;})});}_0x3ce36a=_[_0xc8cc('0x43')]({},_0x3ce36a,_0xdb34d7[_0xc8cc('0x44')]);return _0x2c45c3[_0xc8cc('0x52')](_0x3ce36a);}})['then'](function(_0x16cce6){if(_0x16cce6){_0x4789d0=_0x16cce6[_0xc8cc('0x3a')];if(!_0xdb34d7['query']['hasOwnProperty'](_0xc8cc('0x3c'))){_0x3ce36a[_0xc8cc('0x20')]=qs[_0xc8cc('0x20')](_0xdb34d7[_0xc8cc('0x39')]['limit']);_0x3ce36a[_0xc8cc('0x22')]=qs['offset'](_0xdb34d7[_0xc8cc('0x39')]['offset']);}return _0x2c45c3[_0xc8cc('0x52')](_0x3ce36a);}})[_0xc8cc('0x47')](function(_0x292b83){if(_0x292b83){return _0x292b83?{'count':_0x4789d0,'rows':_0x292b83}:null;}})['then'](respondWithResult(_0x30288b,null))[_0xc8cc('0x48')](handleError(_0x30288b,null));};exports[_0xc8cc('0x53')]=function(_0x24ecc8,_0x52688c,_0x57ea9f){var _0x43d0ee={};var _0x3e9852={};var _0x4183d8;var _0x48f2f7;return db[_0xc8cc('0x2e')][_0xc8cc('0x50')]({'where':{'id':_0x24ecc8[_0xc8cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52688c,null))[_0xc8cc('0x47')](function(_0x3fa1ea){if(_0x3fa1ea){_0x4183d8=_0x3fa1ea;_0x3e9852[_0xc8cc('0x33')]=_[_0xc8cc('0x34')](db[_0xc8cc('0x51')][_0xc8cc('0x2f')]);_0x3e9852['query']=_[_0xc8cc('0x34')](_0x24ecc8[_0xc8cc('0x39')]);_0x3e9852[_0xc8cc('0x35')]=_['intersection'](_0x3e9852['model'],_0x3e9852[_0xc8cc('0x39')]);_0x43d0ee['attributes']=_[_0xc8cc('0x36')](_0x3e9852[_0xc8cc('0x33')],qs['fields'](_0x24ecc8[_0xc8cc('0x39')][_0xc8cc('0x38')]));_0x43d0ee[_0xc8cc('0x37')]=_0x43d0ee['attributes'][_0xc8cc('0x3a')]?_0x43d0ee[_0xc8cc('0x37')]:_0x3e9852[_0xc8cc('0x33')];_0x43d0ee[_0xc8cc('0x3d')]=qs[_0xc8cc('0x3e')](_0x24ecc8['query'][_0xc8cc('0x3e')]);_0x43d0ee[_0xc8cc('0x40')]=qs[_0xc8cc('0x35')](_[_0xc8cc('0x3f')](_0x24ecc8[_0xc8cc('0x39')],_0x3e9852[_0xc8cc('0x35')]));if(_0x24ecc8[_0xc8cc('0x39')][_0xc8cc('0x42')]){_0x43d0ee[_0xc8cc('0x40')]=_[_0xc8cc('0x43')](_0x43d0ee[_0xc8cc('0x40')],{'$or':_[_0xc8cc('0x2d')](_0x43d0ee['attributes'],function(_0xafb755){var _0x2d4cef={};_0x2d4cef[_0xafb755]={'$like':'%'+_0x24ecc8['query'][_0xc8cc('0x42')]+'%'};return _0x2d4cef;})});}_0x43d0ee=_[_0xc8cc('0x43')]({},_0x43d0ee,_0x24ecc8['options']);return _0x4183d8[_0xc8cc('0x53')](_0x43d0ee);}})[_0xc8cc('0x47')](function(_0x1301ae){if(_0x1301ae){_0x48f2f7=_0x1301ae['length'];if(!_0x24ecc8['query'][_0xc8cc('0x3b')](_0xc8cc('0x3c'))){_0x43d0ee[_0xc8cc('0x20')]=qs[_0xc8cc('0x20')](_0x24ecc8[_0xc8cc('0x39')][_0xc8cc('0x20')]);_0x43d0ee[_0xc8cc('0x22')]=qs[_0xc8cc('0x22')](_0x24ecc8[_0xc8cc('0x39')][_0xc8cc('0x22')]);}return _0x4183d8['getDescriptions'](_0x43d0ee);}})[_0xc8cc('0x47')](function(_0x158a3a){if(_0x158a3a){return _0x158a3a?{'count':_0x48f2f7,'rows':_0x158a3a}:null;}})['then'](respondWithResult(_0x52688c,null))['catch'](handleError(_0x52688c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ca1b280..c94f99d 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 _0xbad9=['../../config/environment','define','ZohoConfiguration','int_zoho_configurations','../../config/logger','moment','bluebird','rimraf'];(function(_0x1a8f82,_0x82ac38){var _0x39efa7=function(_0x25e733){while(--_0x25e733){_0x1a8f82['push'](_0x1a8f82['shift']());}};_0x39efa7(++_0x82ac38);}(_0xbad9,0x84));var _0x9bad=function(_0x23743f,_0x2f11b7){_0x23743f=_0x23743f-0x0;var _0x5f0569=_0xbad9[_0x23743f];return _0x5f0569;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9bad('0x0'))('api');var moment=require(_0x9bad('0x1'));var BPromise=require(_0x9bad('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9bad('0x3'));var config=require(_0x9bad('0x4'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x5581fc,_0x3753ce){return _0x5581fc[_0x9bad('0x5')](_0x9bad('0x6'),attributes,{'tableName':_0x9bad('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f25=['./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2161a9,_0x482cb6){var _0xfcef73=function(_0x1b7708){while(--_0x1b7708){_0x2161a9['push'](_0x2161a9['shift']());}};_0xfcef73(++_0x482cb6);}(_0x7f25,0x1ed));var _0x57f2=function(_0xd02def,_0x144f25){_0xd02def=_0xd02def-0x0;var _0x2e8374=_0x7f25[_0xd02def];return _0x2e8374;};'use strict';var _=require(_0x57f2('0x0'));var util=require(_0x57f2('0x1'));var logger=require(_0x57f2('0x2'))('api');var moment=require(_0x57f2('0x3'));var BPromise=require(_0x57f2('0x4'));var rp=require(_0x57f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57f2('0x6'));var config=require('../../config/environment');var attributes=require(_0x57f2('0x7'));module[_0x57f2('0x8')]=function(_0x1b9250,_0x3219c7){return _0x1b9250['define']('ZohoConfiguration',attributes,{'tableName':_0x57f2('0x9'),'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 f8691d0..061e8a1 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 _0xe862=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xe862,0x12e));var _0x2e86=function(_0x2511a4,_0x4e0478){_0x2511a4=_0x2511a4-0x0;var _0x46e7b9=_0xe862[_0x2511a4];return _0x46e7b9;};'use strict';var _=require(_0x2e86('0x0'));var util=require(_0x2e86('0x1'));var moment=require(_0x2e86('0x2'));var BPromise=require(_0x2e86('0x3'));var rs=require(_0x2e86('0x4'));var fs=require('fs');var Redis=require(_0x2e86('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e86('0x6'));var logger=require(_0x2e86('0x7'))(_0x2e86('0x8'));var config=require(_0x2e86('0x9'));var jayson=require(_0x2e86('0xa'));var client=jayson[_0x2e86('0xb')][_0x2e86('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8c3fb1,_0x116820,_0x494773){return new BPromise(function(_0x73c2d8,_0x2ae700){return client['request'](_0x8c3fb1,_0x494773)[_0x2e86('0xd')](function(_0x3cc846){logger[_0x2e86('0xe')](_0x2e86('0xf'),_0x116820,'request\x20sent');logger['debug'](_0x2e86('0x10'),_0x116820,_0x2e86('0x11'),JSON['stringify'](_0x3cc846));if(_0x3cc846['error']){if(_0x3cc846[_0x2e86('0x12')]['code']===0x1f4){logger[_0x2e86('0x12')](_0x2e86('0xf'),_0x116820,_0x3cc846[_0x2e86('0x12')][_0x2e86('0x13')]);return _0x2ae700(_0x3cc846[_0x2e86('0x12')]['message']);}logger[_0x2e86('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x116820,_0x3cc846['error'][_0x2e86('0x13')]);return _0x73c2d8(_0x3cc846[_0x2e86('0x12')]['message']);}else{logger['info'](_0x2e86('0xf'),_0x116820,'request\x20sent');_0x73c2d8(_0x3cc846[_0x2e86('0x14')][_0x2e86('0x13')]);}})[_0x2e86('0x15')](function(_0x2f5d3d){logger[_0x2e86('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x116820,_0x2f5d3d);_0x2ae700(_0x2f5d3d);});});} \ No newline at end of file +var _0x6a4c=['stringify','error','code','message','util','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x45b1fa,_0x242474){var _0x514dfd=function(_0x151354){while(--_0x151354){_0x45b1fa['push'](_0x45b1fa['shift']());}};_0x514dfd(++_0x242474);}(_0x6a4c,0x1f3));var _0xc6a4=function(_0x3043a7,_0xdfc3db){_0x3043a7=_0x3043a7-0x0;var _0x4ee5a3=_0x6a4c[_0x3043a7];return _0x4ee5a3;};'use strict';var _=require('lodash');var util=require(_0xc6a4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6a4('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6a4('0x2'));var logger=require(_0xc6a4('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc6a4('0x4'));var client=jayson[_0xc6a4('0x5')][_0xc6a4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x302199,_0x3e8a28,_0x331148){return new BPromise(function(_0x5063e1,_0x457499){return client[_0xc6a4('0x7')](_0x302199,_0x331148)['then'](function(_0x3fdd00){logger[_0xc6a4('0x8')](_0xc6a4('0x9'),_0x3e8a28,_0xc6a4('0xa'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3e8a28,_0xc6a4('0xa'),JSON[_0xc6a4('0xb')](_0x3fdd00));if(_0x3fdd00[_0xc6a4('0xc')]){if(_0x3fdd00[_0xc6a4('0xc')][_0xc6a4('0xd')]===0x1f4){logger[_0xc6a4('0xc')](_0xc6a4('0x9'),_0x3e8a28,_0x3fdd00[_0xc6a4('0xc')][_0xc6a4('0xe')]);return _0x457499(_0x3fdd00[_0xc6a4('0xc')][_0xc6a4('0xe')]);}logger['error'](_0xc6a4('0x9'),_0x3e8a28,_0x3fdd00['error'][_0xc6a4('0xe')]);return _0x5063e1(_0x3fdd00[_0xc6a4('0xc')][_0xc6a4('0xe')]);}else{logger[_0xc6a4('0x8')](_0xc6a4('0x9'),_0x3e8a28,_0xc6a4('0xa'));_0x5063e1(_0x3fdd00['result']['message']);}})['catch'](function(_0x130143){logger[_0xc6a4('0xc')](_0xc6a4('0x9'),_0x3e8a28,_0x130143);_0x457499(_0x130143);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 182f984..05ad712 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 _0xdfaa=['index','/:id','show','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xdfaa,0x14a));var _0xadfa=function(_0x201636,_0x138d3e){_0x201636=_0x201636-0x0;var _0x141c40=_0xdfaa[_0x201636];return _0x141c40;};'use strict';var multer=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var path=require(_0xadfa('0x2'));var timeout=require(_0xadfa('0x3'));var express=require(_0xadfa('0x4'));var router=express['Router']();var fs_extra=require(_0xadfa('0x5'));var auth=require(_0xadfa('0x6'));var interaction=require(_0xadfa('0x7'));var config=require(_0xadfa('0x8'));var controller=require(_0xadfa('0x9'));router[_0xadfa('0xa')]('/',auth[_0xadfa('0xb')](),controller[_0xadfa('0xc')]);router[_0xadfa('0xa')](_0xadfa('0xd'),auth[_0xadfa('0xb')](),controller[_0xadfa('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xadfa('0xd'),auth[_0xadfa('0xb')](),controller[_0xadfa('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xadfa('0x10')]);module[_0xadfa('0x11')]=router; \ No newline at end of file +var _0x4504=['index','get','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x3716e6,_0x1a51df){var _0xd06104=function(_0x2127de){while(--_0x2127de){_0x3716e6['push'](_0x3716e6['shift']());}};_0xd06104(++_0x1a51df);}(_0x4504,0x14d));var _0x4450=function(_0x40ee8f,_0x54f7bf){_0x40ee8f=_0x40ee8f-0x0;var _0x363bb6=_0x4504[_0x40ee8f];return _0x363bb6;};'use strict';var multer=require(_0x4450('0x0'));var util=require(_0x4450('0x1'));var path=require(_0x4450('0x2'));var timeout=require(_0x4450('0x3'));var express=require(_0x4450('0x4'));var router=express['Router']();var fs_extra=require(_0x4450('0x5'));var auth=require(_0x4450('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4450('0x7'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x4450('0x8')](),controller[_0x4450('0x9')]);router[_0x4450('0xa')]('/:id',auth[_0x4450('0x8')](),controller[_0x4450('0xb')]);router[_0x4450('0xc')]('/',auth[_0x4450('0x8')](),controller[_0x4450('0xd')]);router['put']('/:id',auth[_0x4450('0x8')](),controller[_0x4450('0xe')]);router[_0x4450('0xf')](_0x4450('0x10'),auth[_0x4450('0x8')](),controller[_0x4450('0x11')]);module[_0x4450('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6ccabd5..3f2223b 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 _0x6a21=['ENUM','variable','customVariable','string','STRING','sequelize'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6a21,0xef));var _0x16a2=function(_0x42a9f4,_0x579720){_0x42a9f4=_0x42a9f4-0x0;var _0x3e0020=_0x6a21[_0x42a9f4];return _0x3e0020;};'use strict';var Sequelize=require(_0x16a2('0x0'));module['exports']={'type':{'type':Sequelize[_0x16a2('0x1')]('string',_0x16a2('0x2'),_0x16a2('0x3'),'keyValue','picklist'),'defaultValue':_0x16a2('0x4')},'content':{'type':Sequelize[_0x16a2('0x5')]},'key':{'type':Sequelize[_0x16a2('0x5')]},'keyType':{'type':Sequelize[_0x16a2('0x1')](_0x16a2('0x4'),_0x16a2('0x2'),_0x16a2('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x16a2('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x16a2('0x5')]}}; \ No newline at end of file +var _0xd92e=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x2bcd69,_0x322ba2){var _0x2cfdd9=function(_0xc6cb5a){while(--_0xc6cb5a){_0x2bcd69['push'](_0x2bcd69['shift']());}};_0x2cfdd9(++_0x322ba2);}(_0xd92e,0xf2));var _0xed92=function(_0x427a09,_0x1ba036){_0x427a09=_0x427a09-0x0;var _0x3e99ff=_0xd92e[_0x427a09];return _0x3e99ff;};'use strict';var Sequelize=require(_0xed92('0x0'));module[_0xed92('0x1')]={'type':{'type':Sequelize[_0xed92('0x2')](_0xed92('0x3'),_0xed92('0x4'),_0xed92('0x5'),_0xed92('0x6'),'picklist'),'defaultValue':_0xed92('0x3')},'content':{'type':Sequelize[_0xed92('0x7')]},'key':{'type':Sequelize[_0xed92('0x7')]},'keyType':{'type':Sequelize[_0xed92('0x2')](_0xed92('0x3'),_0xed92('0x4'),_0xed92('0x5'))},'keyContent':{'type':Sequelize[_0xed92('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xed92('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xed92('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a93efba..3f9555c 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 _0xfb0b=['show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','save','update','then','error','stack','name','send','index','map','ZohoField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch'];(function(_0x2ac9c1,_0x343b1f){var _0x4501cf=function(_0x932c4c){while(--_0x932c4c){_0x2ac9c1['push'](_0x2ac9c1['shift']());}};_0x4501cf(++_0x343b1f);}(_0xfb0b,0x94));var _0xbfb0=function(_0x59130e,_0x5b4bb0){_0x59130e=_0x59130e-0x0;var _0x1fe51e=_0xfb0b[_0x59130e];return _0x1fe51e;};'use strict';var emlformat=require(_0xbfb0('0x0'));var rimraf=require(_0xbfb0('0x1'));var zipdir=require(_0xbfb0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbfb0('0x3'));var moment=require(_0xbfb0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbfb0('0x5'));var path=require('path');var sox=require(_0xbfb0('0x6'));var csv=require(_0xbfb0('0x7'));var ejs=require(_0xbfb0('0x8'));var fs=require('fs');var fs_extra=require(_0xbfb0('0x9'));var _=require(_0xbfb0('0xa'));var squel=require(_0xbfb0('0xb'));var crypto=require('crypto');var jsforce=require(_0xbfb0('0xc'));var deskjs=require(_0xbfb0('0xd'));var toCsv=require(_0xbfb0('0x7'));var querystring=require(_0xbfb0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbfb0('0xf'));var hardwareService=require(_0xbfb0('0x10'));var logger=require(_0xbfb0('0x11'))('api');var utils=require(_0xbfb0('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbfb0('0x13'));var db=require(_0xbfb0('0x14'))['db'];function respondWithStatusCode(_0x41afc9,_0x410d77){_0x410d77=_0x410d77||0xcc;return function(_0x884a70){if(_0x884a70){return _0x41afc9[_0xbfb0('0x15')](_0x410d77);}return _0x41afc9['status'](_0x410d77)[_0xbfb0('0x16')]();};}function respondWithResult(_0x567237,_0x4dc587){_0x4dc587=_0x4dc587||0xc8;return function(_0x47e716){if(_0x47e716){return _0x567237[_0xbfb0('0x17')](_0x4dc587)[_0xbfb0('0x18')](_0x47e716);}};}function respondWithFilteredResult(_0x198001,_0x3617f3){return function(_0x27f7a1){if(_0x27f7a1){var _0x213994=typeof _0x3617f3[_0xbfb0('0x19')]===_0xbfb0('0x1a')&&typeof _0x3617f3[_0xbfb0('0x1b')]===_0xbfb0('0x1a');var _0x2496b8=_0x27f7a1['count'];var _0x5c8a1e=_0x213994?0x0:_0x3617f3[_0xbfb0('0x19')];var _0x3b0a50=_0x213994?_0x27f7a1['count']:_0x3617f3[_0xbfb0('0x19')]+_0x3617f3[_0xbfb0('0x1b')];var _0x4a6a88;if(_0x3b0a50>=_0x2496b8){_0x3b0a50=_0x2496b8;_0x4a6a88=0xc8;}else{_0x4a6a88=0xce;}_0x198001[_0xbfb0('0x17')](_0x4a6a88);return _0x198001['set'](_0xbfb0('0x1c'),_0x5c8a1e+'-'+_0x3b0a50+'/'+_0x2496b8)[_0xbfb0('0x18')](_0x27f7a1);}return null;};}function patchUpdates(_0xf52bd5){return function(_0x14eae9){try{jsonpatch['apply'](_0x14eae9,_0xf52bd5,!![]);}catch(_0x31c2eb){return BPromise['reject'](_0x31c2eb);}return _0x14eae9[_0xbfb0('0x1d')]();};}function saveUpdates(_0x5317fe,_0x16bb6e){return function(_0x4cae5a){if(_0x4cae5a){return _0x4cae5a[_0xbfb0('0x1e')](_0x5317fe)['then'](function(_0x278b3d){return _0x278b3d;});}return null;};}function removeEntity(_0x19e16d,_0x40bb06){return function(_0x3ab347){if(_0x3ab347){return _0x3ab347['destroy']()[_0xbfb0('0x1f')](function(){_0x19e16d[_0xbfb0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e86c8,_0x1625e3){return function(_0x1e4a2e){if(!_0x1e4a2e){_0x4e86c8[_0xbfb0('0x15')](0x194);}return _0x1e4a2e;};}function handleError(_0x52e7e5,_0x143685){_0x143685=_0x143685||0x1f4;return function(_0x4af626){logger[_0xbfb0('0x20')](_0x4af626[_0xbfb0('0x21')]);if(_0x4af626[_0xbfb0('0x22')]){delete _0x4af626[_0xbfb0('0x22')];}_0x52e7e5[_0xbfb0('0x17')](_0x143685)[_0xbfb0('0x23')](_0x4af626);};}exports[_0xbfb0('0x24')]=function(_0x57ab45,_0xb2a68d){var _0x14711={},_0x25fea2={},_0x2ea3eb={'count':0x0,'rows':[]};var _0x5ce41b=_[_0xbfb0('0x25')](db[_0xbfb0('0x26')]['rawAttributes'],function(_0x188c90){return{'name':_0x188c90[_0xbfb0('0x27')],'type':_0x188c90[_0xbfb0('0x28')][_0xbfb0('0x29')]};});_0x25fea2[_0xbfb0('0x2a')]=_[_0xbfb0('0x25')](_0x5ce41b,_0xbfb0('0x22'));_0x25fea2[_0xbfb0('0x2b')]=_[_0xbfb0('0x2c')](_0x57ab45[_0xbfb0('0x2b')]);_0x25fea2[_0xbfb0('0x2d')]=_[_0xbfb0('0x2e')](_0x25fea2['model'],_0x25fea2['query']);_0x14711['attributes']=_[_0xbfb0('0x2e')](_0x25fea2[_0xbfb0('0x2a')],qs[_0xbfb0('0x2f')](_0x57ab45[_0xbfb0('0x2b')][_0xbfb0('0x2f')]));_0x14711[_0xbfb0('0x30')]=_0x14711[_0xbfb0('0x30')][_0xbfb0('0x31')]?_0x14711['attributes']:_0x25fea2['model'];if(!_0x57ab45['query'][_0xbfb0('0x32')](_0xbfb0('0x33'))){_0x14711[_0xbfb0('0x1b')]=qs[_0xbfb0('0x1b')](_0x57ab45[_0xbfb0('0x2b')]['limit']);_0x14711['offset']=qs[_0xbfb0('0x19')](_0x57ab45[_0xbfb0('0x2b')][_0xbfb0('0x19')]);}_0x14711[_0xbfb0('0x34')]=qs[_0xbfb0('0x35')](_0x57ab45[_0xbfb0('0x2b')][_0xbfb0('0x35')]);_0x14711[_0xbfb0('0x36')]=qs[_0xbfb0('0x2d')](_[_0xbfb0('0x37')](_0x57ab45['query'],_0x25fea2['filters']),_0x5ce41b);if(_0x57ab45[_0xbfb0('0x2b')][_0xbfb0('0x38')]){_0x14711['where']=_[_0xbfb0('0x39')](_0x14711['where'],{'$or':_[_0xbfb0('0x25')](_0x5ce41b,function(_0x2a4366){if(_0x2a4366['type']!=='VIRTUAL'){var _0x250d33={};_0x250d33[_0x2a4366[_0xbfb0('0x22')]]={'$like':'%'+_0x57ab45['query'][_0xbfb0('0x38')]+'%'};return _0x250d33;}})});}_0x14711=_['merge']({},_0x14711,_0x57ab45[_0xbfb0('0x3a')]);var _0x4f53e9={'where':_0x14711['where']};return db[_0xbfb0('0x26')][_0xbfb0('0x3b')](_0x4f53e9)[_0xbfb0('0x1f')](function(_0x15848d){_0x2ea3eb[_0xbfb0('0x3b')]=_0x15848d;if(_0x57ab45['query'][_0xbfb0('0x3c')]){_0x14711[_0xbfb0('0x3d')]=[{'all':!![]}];}return db[_0xbfb0('0x26')][_0xbfb0('0x3e')](_0x14711);})[_0xbfb0('0x1f')](function(_0x90da0c){_0x2ea3eb[_0xbfb0('0x3f')]=_0x90da0c;return _0x2ea3eb;})[_0xbfb0('0x1f')](respondWithFilteredResult(_0xb2a68d,_0x14711))[_0xbfb0('0x40')](handleError(_0xb2a68d,null));};exports[_0xbfb0('0x41')]=function(_0x1646ca,_0x11b17e){var _0x43859e={'raw':!![],'where':{'id':_0x1646ca[_0xbfb0('0x42')]['id']}},_0x3caaf3={};_0x3caaf3[_0xbfb0('0x2a')]=_[_0xbfb0('0x2c')](db[_0xbfb0('0x26')]['rawAttributes']);_0x3caaf3[_0xbfb0('0x2b')]=_[_0xbfb0('0x2c')](_0x1646ca[_0xbfb0('0x2b')]);_0x3caaf3[_0xbfb0('0x2d')]=_[_0xbfb0('0x2e')](_0x3caaf3[_0xbfb0('0x2a')],_0x3caaf3[_0xbfb0('0x2b')]);_0x43859e[_0xbfb0('0x30')]=_[_0xbfb0('0x2e')](_0x3caaf3[_0xbfb0('0x2a')],qs['fields'](_0x1646ca['query'][_0xbfb0('0x2f')]));_0x43859e[_0xbfb0('0x30')]=_0x43859e['attributes']['length']?_0x43859e[_0xbfb0('0x30')]:_0x3caaf3[_0xbfb0('0x2a')];if(_0x1646ca[_0xbfb0('0x2b')][_0xbfb0('0x3c')]){_0x43859e[_0xbfb0('0x3d')]=[{'all':!![]}];}_0x43859e=_[_0xbfb0('0x39')]({},_0x43859e,_0x1646ca['options']);return db[_0xbfb0('0x26')][_0xbfb0('0x43')](_0x43859e)[_0xbfb0('0x1f')](handleEntityNotFound(_0x11b17e,null))[_0xbfb0('0x1f')](respondWithResult(_0x11b17e,null))[_0xbfb0('0x40')](handleError(_0x11b17e,null));};exports[_0xbfb0('0x44')]=function(_0xa7aecb,_0x8887b0){return db[_0xbfb0('0x26')][_0xbfb0('0x44')](_0xa7aecb[_0xbfb0('0x45')],{})[_0xbfb0('0x1f')](respondWithResult(_0x8887b0,0xc9))[_0xbfb0('0x40')](handleError(_0x8887b0,null));};exports[_0xbfb0('0x1e')]=function(_0x2845da,_0xf085ab){if(_0x2845da[_0xbfb0('0x45')]['id']){delete _0x2845da[_0xbfb0('0x45')]['id'];}return db[_0xbfb0('0x26')][_0xbfb0('0x43')]({'where':{'id':_0x2845da[_0xbfb0('0x42')]['id']}})[_0xbfb0('0x1f')](handleEntityNotFound(_0xf085ab,null))[_0xbfb0('0x1f')](saveUpdates(_0x2845da[_0xbfb0('0x45')],null))['then'](respondWithResult(_0xf085ab,null))[_0xbfb0('0x40')](handleError(_0xf085ab,null));};exports[_0xbfb0('0x46')]=function(_0x45233e,_0x3c4865){return db[_0xbfb0('0x26')][_0xbfb0('0x43')]({'where':{'id':_0x45233e[_0xbfb0('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c4865,null))[_0xbfb0('0x1f')](removeEntity(_0x3c4865,null))[_0xbfb0('0x40')](handleError(_0x3c4865,null));}; \ No newline at end of file +var _0x2825=['limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','catch','show','length','find','create','body','update','params','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x46be5f,_0x170cab){var _0x192673=function(_0x304b3b){while(--_0x304b3b){_0x46be5f['push'](_0x46be5f['shift']());}};_0x192673(++_0x170cab);}(_0x2825,0x195));var _0x5282=function(_0x48c222,_0x5c2682){_0x48c222=_0x48c222-0x0;var _0x56f159=_0x2825[_0x48c222];return _0x56f159;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5282('0x0'));var moment=require(_0x5282('0x1'));var BPromise=require(_0x5282('0x2'));var Mustache=require('mustache');var util=require(_0x5282('0x3'));var path=require(_0x5282('0x4'));var sox=require(_0x5282('0x5'));var csv=require(_0x5282('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5282('0x7'));var _=require('lodash');var squel=require(_0x5282('0x8'));var crypto=require(_0x5282('0x9'));var jsforce=require(_0x5282('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5282('0x6'));var querystring=require(_0x5282('0xb'));var Papa=require(_0x5282('0xc'));var Redis=require('ioredis');var authService=require(_0x5282('0xd'));var qs=require(_0x5282('0xe'));var as=require(_0x5282('0xf'));var hardwareService=require(_0x5282('0x10'));var logger=require(_0x5282('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5282('0x12'));var licenseUtil=require(_0x5282('0x13'));var db=require(_0x5282('0x14'))['db'];function respondWithStatusCode(_0x502382,_0x89bfb){_0x89bfb=_0x89bfb||0xcc;return function(_0x4d5c9d){if(_0x4d5c9d){return _0x502382[_0x5282('0x15')](_0x89bfb);}return _0x502382[_0x5282('0x16')](_0x89bfb)[_0x5282('0x17')]();};}function respondWithResult(_0x50acd2,_0x55ca18){_0x55ca18=_0x55ca18||0xc8;return function(_0x1cb6a4){if(_0x1cb6a4){return _0x50acd2[_0x5282('0x16')](_0x55ca18)[_0x5282('0x18')](_0x1cb6a4);}};}function respondWithFilteredResult(_0x16f43b,_0x49da44){return function(_0x176977){if(_0x176977){var _0x379867=typeof _0x49da44[_0x5282('0x19')]===_0x5282('0x1a')&&typeof _0x49da44[_0x5282('0x1b')]===_0x5282('0x1a');var _0x9f5df9=_0x176977['count'];var _0x52909a=_0x379867?0x0:_0x49da44[_0x5282('0x19')];var _0x15efff=_0x379867?_0x176977[_0x5282('0x1c')]:_0x49da44[_0x5282('0x19')]+_0x49da44[_0x5282('0x1b')];var _0x5e8e98;if(_0x15efff>=_0x9f5df9){_0x15efff=_0x9f5df9;_0x5e8e98=0xc8;}else{_0x5e8e98=0xce;}_0x16f43b['status'](_0x5e8e98);return _0x16f43b[_0x5282('0x1d')](_0x5282('0x1e'),_0x52909a+'-'+_0x15efff+'/'+_0x9f5df9)['json'](_0x176977);}return null;};}function patchUpdates(_0x35b216){return function(_0x268b79){try{jsonpatch[_0x5282('0x1f')](_0x268b79,_0x35b216,!![]);}catch(_0xaa9d6e){return BPromise['reject'](_0xaa9d6e);}return _0x268b79[_0x5282('0x20')]();};}function saveUpdates(_0x186be3,_0x16bb7d){return function(_0x9779a5){if(_0x9779a5){return _0x9779a5['update'](_0x186be3)[_0x5282('0x21')](function(_0x3b63db){return _0x3b63db;});}return null;};}function removeEntity(_0x1dcf81,_0x1ef536){return function(_0xb51465){if(_0xb51465){return _0xb51465[_0x5282('0x22')]()[_0x5282('0x21')](function(){_0x1dcf81[_0x5282('0x16')](0xcc)[_0x5282('0x17')]();});}};}function handleEntityNotFound(_0x21877e,_0x29a004){return function(_0x4505e9){if(!_0x4505e9){_0x21877e['sendStatus'](0x194);}return _0x4505e9;};}function handleError(_0x4c1db7,_0x23c5de){_0x23c5de=_0x23c5de||0x1f4;return function(_0x459a97){logger[_0x5282('0x23')](_0x459a97[_0x5282('0x24')]);if(_0x459a97[_0x5282('0x25')]){delete _0x459a97[_0x5282('0x25')];}_0x4c1db7[_0x5282('0x16')](_0x23c5de)[_0x5282('0x26')](_0x459a97);};}exports[_0x5282('0x27')]=function(_0x389f91,_0x44ca3a){var _0x5ad30d={},_0x11047a={},_0x1caf5a={'count':0x0,'rows':[]};var _0x19eb01=_[_0x5282('0x28')](db[_0x5282('0x29')][_0x5282('0x2a')],function(_0x59620d){return{'name':_0x59620d['fieldName'],'type':_0x59620d[_0x5282('0x2b')][_0x5282('0x2c')]};});_0x11047a[_0x5282('0x2d')]=_[_0x5282('0x28')](_0x19eb01,_0x5282('0x25'));_0x11047a['query']=_[_0x5282('0x2e')](_0x389f91[_0x5282('0x2f')]);_0x11047a[_0x5282('0x30')]=_[_0x5282('0x31')](_0x11047a[_0x5282('0x2d')],_0x11047a[_0x5282('0x2f')]);_0x5ad30d['attributes']=_[_0x5282('0x31')](_0x11047a[_0x5282('0x2d')],qs[_0x5282('0x32')](_0x389f91[_0x5282('0x2f')][_0x5282('0x32')]));_0x5ad30d[_0x5282('0x33')]=_0x5ad30d['attributes']['length']?_0x5ad30d[_0x5282('0x33')]:_0x11047a['model'];if(!_0x389f91['query'][_0x5282('0x34')](_0x5282('0x35'))){_0x5ad30d[_0x5282('0x1b')]=qs['limit'](_0x389f91[_0x5282('0x2f')][_0x5282('0x1b')]);_0x5ad30d[_0x5282('0x19')]=qs[_0x5282('0x19')](_0x389f91[_0x5282('0x2f')][_0x5282('0x19')]);}_0x5ad30d[_0x5282('0x36')]=qs[_0x5282('0x37')](_0x389f91[_0x5282('0x2f')][_0x5282('0x37')]);_0x5ad30d['where']=qs[_0x5282('0x30')](_[_0x5282('0x38')](_0x389f91[_0x5282('0x2f')],_0x11047a['filters']),_0x19eb01);if(_0x389f91['query']['filter']){_0x5ad30d[_0x5282('0x39')]=_[_0x5282('0x3a')](_0x5ad30d[_0x5282('0x39')],{'$or':_[_0x5282('0x28')](_0x19eb01,function(_0x167bbb){if(_0x167bbb['type']!=='VIRTUAL'){var _0x3b27ae={};_0x3b27ae[_0x167bbb[_0x5282('0x25')]]={'$like':'%'+_0x389f91[_0x5282('0x2f')][_0x5282('0x3b')]+'%'};return _0x3b27ae;}})});}_0x5ad30d=_[_0x5282('0x3a')]({},_0x5ad30d,_0x389f91[_0x5282('0x3c')]);var _0x7bcf28={'where':_0x5ad30d[_0x5282('0x39')]};return db[_0x5282('0x29')][_0x5282('0x1c')](_0x7bcf28)['then'](function(_0x170242){_0x1caf5a[_0x5282('0x1c')]=_0x170242;if(_0x389f91['query'][_0x5282('0x3d')]){_0x5ad30d[_0x5282('0x3e')]=[{'all':!![]}];}return db[_0x5282('0x29')][_0x5282('0x3f')](_0x5ad30d);})[_0x5282('0x21')](function(_0x4d61cd){_0x1caf5a['rows']=_0x4d61cd;return _0x1caf5a;})['then'](respondWithFilteredResult(_0x44ca3a,_0x5ad30d))[_0x5282('0x40')](handleError(_0x44ca3a,null));};exports[_0x5282('0x41')]=function(_0x486211,_0x236ebe){var _0x13dbf3={'raw':!![],'where':{'id':_0x486211['params']['id']}},_0x59b965={};_0x59b965['model']=_[_0x5282('0x2e')](db[_0x5282('0x29')][_0x5282('0x2a')]);_0x59b965[_0x5282('0x2f')]=_[_0x5282('0x2e')](_0x486211[_0x5282('0x2f')]);_0x59b965[_0x5282('0x30')]=_[_0x5282('0x31')](_0x59b965['model'],_0x59b965[_0x5282('0x2f')]);_0x13dbf3[_0x5282('0x33')]=_[_0x5282('0x31')](_0x59b965['model'],qs[_0x5282('0x32')](_0x486211['query'][_0x5282('0x32')]));_0x13dbf3[_0x5282('0x33')]=_0x13dbf3[_0x5282('0x33')][_0x5282('0x42')]?_0x13dbf3[_0x5282('0x33')]:_0x59b965[_0x5282('0x2d')];if(_0x486211[_0x5282('0x2f')]['includeAll']){_0x13dbf3[_0x5282('0x3e')]=[{'all':!![]}];}_0x13dbf3=_[_0x5282('0x3a')]({},_0x13dbf3,_0x486211[_0x5282('0x3c')]);return db['ZohoField'][_0x5282('0x43')](_0x13dbf3)[_0x5282('0x21')](handleEntityNotFound(_0x236ebe,null))[_0x5282('0x21')](respondWithResult(_0x236ebe,null))[_0x5282('0x40')](handleError(_0x236ebe,null));};exports['create']=function(_0x51cb7a,_0x485d78){return db['ZohoField'][_0x5282('0x44')](_0x51cb7a[_0x5282('0x45')],{})['then'](respondWithResult(_0x485d78,0xc9))[_0x5282('0x40')](handleError(_0x485d78,null));};exports[_0x5282('0x46')]=function(_0x5aff58,_0x509372){if(_0x5aff58[_0x5282('0x45')]['id']){delete _0x5aff58[_0x5282('0x45')]['id'];}return db[_0x5282('0x29')][_0x5282('0x43')]({'where':{'id':_0x5aff58[_0x5282('0x47')]['id']}})['then'](handleEntityNotFound(_0x509372,null))[_0x5282('0x21')](saveUpdates(_0x5aff58['body'],null))[_0x5282('0x21')](respondWithResult(_0x509372,null))[_0x5282('0x40')](handleError(_0x509372,null));};exports[_0x5282('0x22')]=function(_0x5c1e83,_0xea9cb8){return db[_0x5282('0x29')][_0x5282('0x43')]({'where':{'id':_0x5c1e83[_0x5282('0x47')]['id']}})[_0x5282('0x21')](handleEntityNotFound(_0xea9cb8,null))[_0x5282('0x21')](removeEntity(_0xea9cb8,null))['catch'](handleError(_0xea9cb8,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index e11a7f3..9b069fd 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 _0x0adf=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x326855,_0x1d3e58){var _0x63aa22=function(_0x53ee92){while(--_0x53ee92){_0x326855['push'](_0x326855['shift']());}};_0x63aa22(++_0x1d3e58);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x176c47,_0x5504e8){_0x176c47=_0x176c47-0x0;var _0x4ac81b=_0x0adf[_0x176c47];return _0x4ac81b;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));module['exports']=function(_0x3bbf85,_0x53221f){return _0x3bbf85[_0xf0ad('0xa')](_0xf0ad('0xb'),attributes,{'tableName':_0xf0ad('0xc'),'paranoid':![],'indexes':[{'name':_0xf0ad('0xd'),'fields':[_0xf0ad('0xe'),_0xf0ad('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x1eaa74,_0xcbbafc){var _0x2fd0e0=function(_0x14eafa){while(--_0x14eafa){_0x1eaa74['push'](_0x1eaa74['shift']());}};_0x2fd0e0(++_0xcbbafc);}(_0x2a07,0x74));var _0x72a0=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0x2a07[_0x589eb4];return _0xf50816;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xf'),_0x72a0('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index cc792fe..e519597 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 _0xdfba=['client','request','then','info','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x546fef,_0x513861){var _0x471044=function(_0x237d20){while(--_0x237d20){_0x546fef['push'](_0x546fef['shift']());}};_0x471044(++_0x513861);}(_0xdfba,0x19c));var _0xadfb=function(_0x594e7a,_0x5455af){_0x594e7a=_0x594e7a-0x0;var _0x14369d=_0xdfba[_0x594e7a];return _0x14369d;};'use strict';var _=require(_0xadfb('0x0'));var util=require('util');var moment=require(_0xadfb('0x1'));var BPromise=require(_0xadfb('0x2'));var rs=require(_0xadfb('0x3'));var fs=require('fs');var Redis=require(_0xadfb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xadfb('0x5'));var logger=require(_0xadfb('0x6'))('rpc');var config=require(_0xadfb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xadfb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x965d94,_0x534d0b,_0x2e1f68){return new BPromise(function(_0x459739,_0x1d2229){return client[_0xadfb('0x9')](_0x965d94,_0x2e1f68)[_0xadfb('0xa')](function(_0x54a906){logger[_0xadfb('0xb')](_0xadfb('0xc'),_0x534d0b,'request\x20sent');logger[_0xadfb('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x534d0b,_0xadfb('0xe'),JSON[_0xadfb('0xf')](_0x54a906));if(_0x54a906[_0xadfb('0x10')]){if(_0x54a906['error'][_0xadfb('0x11')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x534d0b,_0x54a906[_0xadfb('0x10')][_0xadfb('0x12')]);return _0x1d2229(_0x54a906[_0xadfb('0x10')][_0xadfb('0x12')]);}logger['error'](_0xadfb('0xc'),_0x534d0b,_0x54a906[_0xadfb('0x10')][_0xadfb('0x12')]);return _0x459739(_0x54a906[_0xadfb('0x10')][_0xadfb('0x12')]);}else{logger['info'](_0xadfb('0xc'),_0x534d0b,_0xadfb('0xe'));_0x459739(_0x54a906[_0xadfb('0x13')][_0xadfb('0x12')]);}})['catch'](function(_0x13319f){logger[_0xadfb('0x10')](_0xadfb('0xc'),_0x534d0b,_0x13319f);_0x1d2229(_0x13319f);});});} \ No newline at end of file +var _0xf0e6=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf0e6,0x16e));var _0x6f0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0e6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6f0e('0x0'));var util=require('util');var moment=require(_0x6f0e('0x1'));var BPromise=require(_0x6f0e('0x2'));var rs=require(_0x6f0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f0e('0x4'))['db'];var utils=require(_0x6f0e('0x5'));var logger=require('../../config/logger')(_0x6f0e('0x6'));var config=require(_0x6f0e('0x7'));var jayson=require(_0x6f0e('0x8'));var client=jayson[_0x6f0e('0x9')][_0x6f0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57d817,_0x51c1eb,_0x344e0a){return new BPromise(function(_0x6bfc01,_0x4a1104){return client[_0x6f0e('0xb')](_0x57d817,_0x344e0a)[_0x6f0e('0xc')](function(_0x23ddfc){logger[_0x6f0e('0xd')](_0x6f0e('0xe'),_0x51c1eb,_0x6f0e('0xf'));logger[_0x6f0e('0x10')](_0x6f0e('0x11'),_0x51c1eb,_0x6f0e('0xf'),JSON[_0x6f0e('0x12')](_0x23ddfc));if(_0x23ddfc[_0x6f0e('0x13')]){if(_0x23ddfc[_0x6f0e('0x13')][_0x6f0e('0x14')]===0x1f4){logger[_0x6f0e('0x13')](_0x6f0e('0xe'),_0x51c1eb,_0x23ddfc['error'][_0x6f0e('0x15')]);return _0x4a1104(_0x23ddfc[_0x6f0e('0x13')][_0x6f0e('0x15')]);}logger['error'](_0x6f0e('0xe'),_0x51c1eb,_0x23ddfc[_0x6f0e('0x13')][_0x6f0e('0x15')]);return _0x6bfc01(_0x23ddfc[_0x6f0e('0x13')][_0x6f0e('0x15')]);}else{logger[_0x6f0e('0xd')]('ZohoField,\x20%s,\x20%s',_0x51c1eb,_0x6f0e('0xf'));_0x6bfc01(_0x23ddfc[_0x6f0e('0x16')][_0x6f0e('0x15')]);}})[_0x6f0e('0x17')](function(_0x3a99be){logger['error'](_0x6f0e('0xe'),_0x51c1eb,_0x3a99be);_0x4a1104(_0x3a99be);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 1eeca8c..8160226 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x317911,_0x5ed189){var _0x5ae05e=function(_0x1f26ab){while(--_0x1f26ab){_0x317911['push'](_0x317911['shift']());}};_0x5ae05e(++_0x5ed189);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xe7f153,_0xe07497){var _0x5b452b=function(_0x119164){while(--_0x119164){_0xe7f153['push'](_0xe7f153['shift']());}};_0x5b452b(++_0xe07497);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 07c65a1..7651ccd 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 _0xf9b2=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x248d94,_0x3b5a1b){var _0x4f604f=function(_0x1d00f0){while(--_0x1d00f0){_0x248d94['push'](_0x248d94['shift']());}};_0x4f604f(++_0x3b5a1b);}(_0xf9b2,0x9a));var _0x2f9b=function(_0x591103,_0x59a9c5){_0x591103=_0x591103-0x0;var _0x4ea86d=_0xf9b2[_0x591103];return _0x4ea86d;};'use strict';var Sequelize=require(_0x2f9b('0x0'));module[_0x2f9b('0x1')]={'name':{'type':Sequelize[_0x2f9b('0x2')],'allowNull':![],'unique':_0x2f9b('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2f9b('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x2f9b('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2f9b('0x2')]},'size':{'type':Sequelize[_0x2f9b('0x5')]},'active':{'type':Sequelize[_0x2f9b('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x2f9b('0x2')]},'logo':{'type':Sequelize[_0x2f9b('0x2')]},'state':{'type':Sequelize[_0x2f9b('0x2')],'unique':_0x2f9b('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x2f9b('0x2')]},'remoteUri':{'type':Sequelize[_0x2f9b('0x2')]},'link':{'type':Sequelize[_0x2f9b('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x94df=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x94df,0xa3));var _0xf94d=function(_0x33321f,_0x5122ec){_0x33321f=_0x33321f-0x0;var _0x5dc246=_0x94df[_0x33321f];return _0x5dc246;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'name':{'type':Sequelize[_0xf94d('0x2')],'allowNull':![],'unique':_0xf94d('0x3')},'version':{'type':Sequelize[_0xf94d('0x2')],'allowNull':![],'unique':_0xf94d('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xf94d('0x4')},'filename':{'type':Sequelize[_0xf94d('0x2')]},'path':{'type':Sequelize[_0xf94d('0x2')]},'type':{'type':Sequelize[_0xf94d('0x2')]},'size':{'type':Sequelize[_0xf94d('0x5')]},'active':{'type':Sequelize[_0xf94d('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xf94d('0x2')]},'logo':{'type':Sequelize[_0xf94d('0x2')]},'state':{'type':Sequelize[_0xf94d('0x2')],'unique':_0xf94d('0x7')},'description':{'type':Sequelize[_0xf94d('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf94d('0x2')]},'link':{'type':Sequelize[_0xf94d('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 88d018d..c6263ab 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 _0xafc4=['reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','Integration','includeAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x11226f,_0x3c4e23){var _0x291be4=function(_0x48bff2){while(--_0x48bff2){_0x11226f['push'](_0x11226f['shift']());}};_0x291be4(++_0x3c4e23);}(_0xafc4,0x69));var _0x4afc=function(_0x1c0e94,_0x549878){_0x1c0e94=_0x1c0e94-0x0;var _0x54f54d=_0xafc4[_0x1c0e94];return _0x54f54d;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['Integration'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['Integration']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));}; \ No newline at end of file +var _0x53ec=['count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','Integration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x53ec,0x192));var _0xc53e=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0x53ec[_0x3d00db];return _0x41f115;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');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('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')](_0x4458c8['body'],{})[_0xc53e('0x24')](respondWithResult(_0x15e744,0xc9))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x5a6e41,_0x33d45c){if(_0x5a6e41[_0xc53e('0x46')]['id']){delete _0x5a6e41[_0xc53e('0x46')]['id'];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x5a6e41[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x33d45c,null))[_0xc53e('0x24')](saveUpdates(_0x5a6e41[_0xc53e('0x46')],null))[_0xc53e('0x24')](respondWithResult(_0x33d45c,null))['catch'](handleError(_0x33d45c,null));};exports[_0xc53e('0x47')]=function(_0x17cf13,_0x38520c){return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x17cf13['params']['id']}})['then'](handleEntityNotFound(_0x38520c,null))[_0xc53e('0x24')](removeEntity(_0x38520c,null))['catch'](handleError(_0x38520c,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f2f453c..0ce20f8 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 _0x6e7f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','define','integrations','lodash'];(function(_0xbedcd2,_0x430535){var _0x2b4386=function(_0x1ceaef){while(--_0x1ceaef){_0xbedcd2['push'](_0xbedcd2['shift']());}};_0x2b4386(++_0x430535);}(_0x6e7f,0x12b));var _0xf6e7=function(_0x2224e2,_0x15feaf){_0x2224e2=_0x2224e2-0x0;var _0x7ecc4d=_0x6e7f[_0x2224e2];return _0x7ecc4d;};'use strict';var _=require(_0xf6e7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf6e7('0x1'));var moment=require(_0xf6e7('0x2'));var BPromise=require(_0xf6e7('0x3'));var rp=require(_0xf6e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6e7('0x5'));var config=require(_0xf6e7('0x6'));var attributes=require(_0xf6e7('0x7'));module['exports']=function(_0x5bfd81,_0x325c22){return _0x5bfd81[_0xf6e7('0x8')]('Integration',attributes,{'tableName':_0xf6e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06f5=['api','moment','bluebird','path','rimraf','./integration.attributes','exports','Integration','lodash','util','../../config/logger'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x06f5,0xce));var _0x506f=function(_0x4e4a44,_0x105c11){_0x4e4a44=_0x4e4a44-0x0;var _0x28a81e=_0x06f5[_0x4e4a44];return _0x28a81e;};'use strict';var _=require(_0x506f('0x0'));var util=require(_0x506f('0x1'));var logger=require(_0x506f('0x2'))(_0x506f('0x3'));var moment=require(_0x506f('0x4'));var BPromise=require(_0x506f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x506f('0x6'));var rimraf=require(_0x506f('0x7'));var config=require('../../config/environment');var attributes=require(_0x506f('0x8'));module[_0x506f('0x9')]=function(_0x184f13,_0x21d7f2){return _0x184f13['define'](_0x506f('0xa'),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 680e9a2..5ee3f8f 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 _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1ac550,_0x841d3b){var _0x290241=function(_0x5406b1){while(--_0x5406b1){_0x1ac550['push'](_0x1ac550['shift']());}};_0x290241(++_0x841d3b);}(_0x57ca,0x108));var _0xa57c=function(_0x18f2f5,_0x3bab2c){_0x18f2f5=_0x18f2f5-0x0;var _0x2f5981=_0x57ca[_0x18f2f5];return _0x2f5981;};'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')]('Integration,\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')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x45d56b,_0x3b99e4){var _0xd62e37=function(_0x12f150){while(--_0x12f150){_0x45d56b['push'](_0x45d56b['shift']());}};_0xd62e37(++_0x3b99e4);}(_0xda2d,0x102));var _0xdda2=function(_0x50a9d2,_0x174627){_0x50a9d2=_0x50a9d2-0x0;var _0x2d681c=_0xda2d[_0x50a9d2];return _0x2d681c;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 8eda710..2014f6d 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 _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x423e69,_0x58c1a2){var _0x58d4e9=function(_0x236e62){while(--_0x236e62){_0x423e69['push'](_0x423e69['shift']());}};_0x58d4e9(++_0x58c1a2);}(_0x524e,0x15e));var _0xe524=function(_0x15c19d,_0xa0c0d4){_0x15c19d=_0x15c19d-0x0;var _0x1c1bcd=_0x524e[_0x15c19d];return _0x1c1bcd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['get','isAuthenticated','index','describe','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller'];(function(_0x2f68da,_0x521e11){var _0x5cd9fb=function(_0x49705a){while(--_0x49705a){_0x2f68da['push'](_0x2f68da['shift']());}};_0x5cd9fb(++_0x521e11);}(_0x0b0e,0x187));var _0xe0b0=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x0b0e[_0xa1e3ca];return _0x5005ab;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0xe')]('/',auth[_0xe0b0('0xa')](),controller['create']);router[_0xe0b0('0xf')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);module[_0xe0b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4abece6..7467b9d 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 _0xc37f=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xc37f,0x73));var _0xfc37=function(_0x4bba82,_0x11d7ea){_0x4bba82=_0x4bba82-0x0;var _0x388016=_0xc37f[_0x4bba82];return _0x388016;};'use strict';var Sequelize=require(_0xfc37('0x0'));module['exports']={'integration':{'type':Sequelize[_0xfc37('0x1')]},'eventChannel':{'type':Sequelize[_0xfc37('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xfc37('0x2')]},'contacts':{'type':Sequelize[_0xfc37('0x1')]},'uniqueid':{'type':Sequelize[_0xfc37('0x1')]},'calleridnum':{'type':Sequelize[_0xfc37('0x1')]},'calleridname':{'type':Sequelize[_0xfc37('0x1')]},'queue':{'type':Sequelize[_0xfc37('0x1')]},'interface':{'type':Sequelize[_0xfc37('0x1')]},'membername':{'type':Sequelize[_0xfc37('0x1')]},'agentcalledAt':{'type':Sequelize[_0xfc37('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfc37('0x3')]},'holdtime':{'type':Sequelize[_0xfc37('0x2')]},'agentcomplete':{'type':Sequelize[_0xfc37('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xfc37('0x3')]},'talktime':{'type':Sequelize[_0xfc37('0x2')]},'agentacw':{'type':Sequelize[_0xfc37('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfc37('0x2')]},'reason':{'type':Sequelize[_0xfc37('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xfc37('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xfc37('0x3')]},'agentdump':{'type':Sequelize[_0xfc37('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xfc37('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfc37('0x1')]},'connectedlinenum':{'type':Sequelize[_0xfc37('0x1')]},'connectedlinename':{'type':Sequelize[_0xfc37('0x1')]},'language':{'type':Sequelize[_0xfc37('0x1')]},'accountcode':{'type':Sequelize[_0xfc37('0x1')]},'context':{'type':Sequelize[_0xfc37('0x1')]},'exten':{'type':Sequelize[_0xfc37('0x1')]},'priority':{'type':Sequelize[_0xfc37('0x1')]},'destchannel':{'type':Sequelize[_0xfc37('0x1')]},'destchannelstate':{'type':Sequelize[_0xfc37('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xfc37('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xfc37('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xfc37('0x1')]},'destaccountcode':{'type':Sequelize[_0xfc37('0x1')]},'destcontext':{'type':Sequelize[_0xfc37('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xfc37('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xfc37('0x1')]},'from':{'type':Sequelize[_0xfc37('0x1')]},'to':{'type':Sequelize[_0xfc37('0x1')]},'cc':{'type':Sequelize[_0xfc37('0x1')]},'attachment':{'type':Sequelize[_0xfc37('0x5')]},'html':{'type':Sequelize[_0xfc37('0x5')]},'text':{'type':Sequelize[_0xfc37('0x5')]},'status':{'type':Sequelize[_0xfc37('0x6')](_0xfc37('0x7'),_0xfc37('0x8'),_0xfc37('0x9'),_0xfc37('0xa'))},'url':{'type':Sequelize[_0xfc37('0x1')]},'app':{'type':Sequelize[_0xfc37('0x1')]},'appdata':{'type':Sequelize[_0xfc37('0x1')]},'projectId':{'type':Sequelize[_0xfc37('0x2')]}}; \ No newline at end of file +var _0xc298=['SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x2b9e76,_0x467e25){var _0x4c014e=function(_0x165284){while(--_0x165284){_0x2b9e76['push'](_0x2b9e76['shift']());}};_0x4c014e(++_0x467e25);}(_0xc298,0xbf));var _0x8c29=function(_0x2cdae3,_0x5856e2){_0x2cdae3=_0x2cdae3-0x0;var _0x241c0f=_0xc298[_0x2cdae3];return _0x241c0f;};'use strict';var Sequelize=require(_0x8c29('0x0'));module['exports']={'integration':{'type':Sequelize[_0x8c29('0x1')]},'eventChannel':{'type':Sequelize[_0x8c29('0x1')]},'exitStatus':{'type':Sequelize[_0x8c29('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x8c29('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8c29('0x1')]},'calleridnum':{'type':Sequelize[_0x8c29('0x1')]},'calleridname':{'type':Sequelize[_0x8c29('0x1')]},'queue':{'type':Sequelize[_0x8c29('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8c29('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8c29('0x3')]},'holdtime':{'type':Sequelize[_0x8c29('0x2')]},'agentcomplete':{'type':Sequelize[_0x8c29('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8c29('0x3')]},'talktime':{'type':Sequelize[_0x8c29('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8c29('0x2')]},'reason':{'type':Sequelize[_0x8c29('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x8c29('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8c29('0x3')]},'agentdump':{'type':Sequelize[_0x8c29('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x8c29('0x1')]},'channel':{'type':Sequelize[_0x8c29('0x1')]},'channelstate':{'type':Sequelize[_0x8c29('0x2')]},'channelstatedesc':{'type':Sequelize[_0x8c29('0x1')]},'connectedlinenum':{'type':Sequelize[_0x8c29('0x1')]},'connectedlinename':{'type':Sequelize[_0x8c29('0x1')]},'language':{'type':Sequelize[_0x8c29('0x1')]},'accountcode':{'type':Sequelize[_0x8c29('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x8c29('0x1')]},'priority':{'type':Sequelize[_0x8c29('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8c29('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x8c29('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x8c29('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x8c29('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x8c29('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x8c29('0x1')]},'destexten':{'type':Sequelize[_0x8c29('0x1')]},'destpriority':{'type':Sequelize[_0x8c29('0x1')]},'destuniqueid':{'type':Sequelize[_0x8c29('0x1')]},'messageId':{'type':Sequelize[_0x8c29('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x8c29('0x1')]},'cc':{'type':Sequelize[_0x8c29('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x8c29('0x5')]},'status':{'type':Sequelize[_0x8c29('0x6')](_0x8c29('0x7'),_0x8c29('0x8'),_0x8c29('0x9'),_0x8c29('0xa'))},'url':{'type':Sequelize[_0x8c29('0x1')]},'app':{'type':Sequelize[_0x8c29('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 94e89c6..cda8088 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 _0x9983=['ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','findAll','rows','catch','params','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x2d3d18,_0x475f4c){var _0x202f49=function(_0x41abb5){while(--_0x41abb5){_0x2d3d18['push'](_0x2d3d18['shift']());}};_0x202f49(++_0x475f4c);}(_0x9983,0x15b));var _0x3998=function(_0xcd239a,_0x249347){_0xcd239a=_0xcd239a-0x0;var _0x522928=_0x9983[_0xcd239a];return _0x522928;};'use strict';var emlformat=require(_0x3998('0x0'));var rimraf=require(_0x3998('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3998('0x2'));var rp=require(_0x3998('0x3'));var moment=require(_0x3998('0x4'));var BPromise=require(_0x3998('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3998('0x6'));var sox=require(_0x3998('0x7'));var csv=require('to-csv');var ejs=require(_0x3998('0x8'));var fs=require('fs');var fs_extra=require(_0x3998('0x9'));var _=require('lodash');var squel=require(_0x3998('0xa'));var crypto=require(_0x3998('0xb'));var jsforce=require(_0x3998('0xc'));var deskjs=require(_0x3998('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3998('0xe'));var Redis=require(_0x3998('0xf'));var authService=require(_0x3998('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3998('0x11'));var logger=require('../../config/logger')(_0x3998('0x12'));var utils=require(_0x3998('0x13'));var config=require(_0x3998('0x14'));var licenseUtil=require(_0x3998('0x15'));var db=require(_0x3998('0x16'))['db'];function respondWithStatusCode(_0x404dd1,_0x4034a3){_0x4034a3=_0x4034a3||0xcc;return function(_0x4b1c2c){if(_0x4b1c2c){return _0x404dd1[_0x3998('0x17')](_0x4034a3);}return _0x404dd1[_0x3998('0x18')](_0x4034a3)[_0x3998('0x19')]();};}function respondWithResult(_0x1d3d3d,_0x2ac9db){_0x2ac9db=_0x2ac9db||0xc8;return function(_0x3c432a){if(_0x3c432a){return _0x1d3d3d[_0x3998('0x18')](_0x2ac9db)[_0x3998('0x1a')](_0x3c432a);}};}function respondWithFilteredResult(_0x10fcca,_0x534d6b){return function(_0x377244){if(_0x377244){var _0x12cf81=typeof _0x534d6b[_0x3998('0x1b')]===_0x3998('0x1c')&&typeof _0x534d6b[_0x3998('0x1d')]===_0x3998('0x1c');var _0x320696=_0x377244[_0x3998('0x1e')];var _0x6ebecb=_0x12cf81?0x0:_0x534d6b[_0x3998('0x1b')];var _0x12491a=_0x12cf81?_0x377244[_0x3998('0x1e')]:_0x534d6b[_0x3998('0x1b')]+_0x534d6b['limit'];var _0x191d84;if(_0x12491a>=_0x320696){_0x12491a=_0x320696;_0x191d84=0xc8;}else{_0x191d84=0xce;}_0x10fcca[_0x3998('0x18')](_0x191d84);return _0x10fcca[_0x3998('0x1f')](_0x3998('0x20'),_0x6ebecb+'-'+_0x12491a+'/'+_0x320696)[_0x3998('0x1a')](_0x377244);}return null;};}function patchUpdates(_0x3dc994){return function(_0x2af509){try{jsonpatch['apply'](_0x2af509,_0x3dc994,!![]);}catch(_0x3212ca){return BPromise[_0x3998('0x21')](_0x3212ca);}return _0x2af509['save']();};}function saveUpdates(_0x5dac40,_0x38b95e){return function(_0x4cf852){if(_0x4cf852){return _0x4cf852[_0x3998('0x22')](_0x5dac40)[_0x3998('0x23')](function(_0x547bab){return _0x547bab;});}return null;};}function removeEntity(_0x154dfe,_0x74ff2d){return function(_0x365ee6){if(_0x365ee6){return _0x365ee6[_0x3998('0x24')]()[_0x3998('0x23')](function(){_0x154dfe[_0x3998('0x18')](0xcc)[_0x3998('0x19')]();});}};}function handleEntityNotFound(_0x515c62,_0xd08229){return function(_0x25650b){if(!_0x25650b){_0x515c62[_0x3998('0x17')](0x194);}return _0x25650b;};}function handleError(_0x94fb10,_0x9b431f){_0x9b431f=_0x9b431f||0x1f4;return function(_0x311f60){logger['error'](_0x311f60['stack']);if(_0x311f60[_0x3998('0x25')]){delete _0x311f60[_0x3998('0x25')];}_0x94fb10['status'](_0x9b431f)[_0x3998('0x26')](_0x311f60);};}exports['index']=function(_0x52315e,_0x1af3d9){var _0x37b20b={},_0x12e259={},_0x1f5b7e={'count':0x0,'rows':[]};var _0x563577=_[_0x3998('0x27')](db['IntegrationReport'][_0x3998('0x28')],function(_0x47cb74){return{'name':_0x47cb74[_0x3998('0x29')],'type':_0x47cb74[_0x3998('0x2a')][_0x3998('0x2b')]};});_0x12e259[_0x3998('0x2c')]=_['map'](_0x563577,_0x3998('0x25'));_0x12e259[_0x3998('0x2d')]=_[_0x3998('0x2e')](_0x52315e[_0x3998('0x2d')]);_0x12e259['filters']=_['intersection'](_0x12e259['model'],_0x12e259[_0x3998('0x2d')]);_0x37b20b['attributes']=_[_0x3998('0x2f')](_0x12e259[_0x3998('0x2c')],qs[_0x3998('0x30')](_0x52315e[_0x3998('0x2d')]['fields']));_0x37b20b[_0x3998('0x31')]=_0x37b20b[_0x3998('0x31')][_0x3998('0x32')]?_0x37b20b[_0x3998('0x31')]:_0x12e259[_0x3998('0x2c')];if(!_0x52315e[_0x3998('0x2d')]['hasOwnProperty'](_0x3998('0x33'))){_0x37b20b['limit']=qs['limit'](_0x52315e['query'][_0x3998('0x1d')]);_0x37b20b[_0x3998('0x1b')]=qs[_0x3998('0x1b')](_0x52315e[_0x3998('0x2d')]['offset']);}_0x37b20b[_0x3998('0x34')]=qs[_0x3998('0x35')](_0x52315e[_0x3998('0x2d')][_0x3998('0x35')]);_0x37b20b[_0x3998('0x36')]=qs[_0x3998('0x37')](_['pick'](_0x52315e[_0x3998('0x2d')],_0x12e259[_0x3998('0x37')]),_0x563577);if(_0x52315e['query'][_0x3998('0x38')]){_0x37b20b[_0x3998('0x36')]=_[_0x3998('0x39')](_0x37b20b['where'],{'$or':_[_0x3998('0x27')](_0x563577,function(_0x21f2bc){if(_0x21f2bc[_0x3998('0x2a')]!==_0x3998('0x3a')){var _0x2c0513={};_0x2c0513[_0x21f2bc[_0x3998('0x25')]]={'$like':'%'+_0x52315e[_0x3998('0x2d')][_0x3998('0x38')]+'%'};return _0x2c0513;}})});}_0x37b20b=_[_0x3998('0x39')]({},_0x37b20b,_0x52315e[_0x3998('0x3b')]);var _0x3a45c0={'where':_0x37b20b[_0x3998('0x36')]};return db[_0x3998('0x3c')][_0x3998('0x1e')](_0x3a45c0)[_0x3998('0x23')](function(_0x3bfe97){_0x1f5b7e[_0x3998('0x1e')]=_0x3bfe97;if(_0x52315e[_0x3998('0x2d')][_0x3998('0x3d')]){_0x37b20b['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x3998('0x3e')](_0x37b20b);})['then'](function(_0x41d84c){_0x1f5b7e[_0x3998('0x3f')]=_0x41d84c;return _0x1f5b7e;})[_0x3998('0x23')](respondWithFilteredResult(_0x1af3d9,_0x37b20b))[_0x3998('0x40')](handleError(_0x1af3d9,null));};exports['show']=function(_0x26f354,_0xbbc403){var _0x2125c2={'raw':![],'where':{'id':_0x26f354[_0x3998('0x41')]['id']}},_0x2539cb={};_0x2539cb[_0x3998('0x2c')]=_[_0x3998('0x2e')](db[_0x3998('0x3c')][_0x3998('0x28')]);_0x2539cb[_0x3998('0x2d')]=_[_0x3998('0x2e')](_0x26f354[_0x3998('0x2d')]);_0x2539cb[_0x3998('0x37')]=_[_0x3998('0x2f')](_0x2539cb[_0x3998('0x2c')],_0x2539cb['query']);_0x2125c2['attributes']=_[_0x3998('0x2f')](_0x2539cb[_0x3998('0x2c')],qs['fields'](_0x26f354[_0x3998('0x2d')][_0x3998('0x30')]));_0x2125c2[_0x3998('0x31')]=_0x2125c2[_0x3998('0x31')][_0x3998('0x32')]?_0x2125c2['attributes']:_0x2539cb[_0x3998('0x2c')];if(_0x26f354[_0x3998('0x2d')][_0x3998('0x3d')]){_0x2125c2[_0x3998('0x42')]=[{'all':!![]}];}_0x2125c2=_[_0x3998('0x39')]({},_0x2125c2,_0x26f354[_0x3998('0x3b')]);return db[_0x3998('0x3c')]['find'](_0x2125c2)[_0x3998('0x23')](handleEntityNotFound(_0xbbc403,null))[_0x3998('0x23')](respondWithResult(_0xbbc403,null))['catch'](handleError(_0xbbc403,null));};exports[_0x3998('0x43')]=function(_0x21a5ab,_0x10bed7){return db[_0x3998('0x3c')][_0x3998('0x43')](_0x21a5ab[_0x3998('0x44')],{})[_0x3998('0x23')](respondWithResult(_0x10bed7,0xc9))[_0x3998('0x40')](handleError(_0x10bed7,null));};exports[_0x3998('0x22')]=function(_0x21e27a,_0x4cc1cf){if(_0x21e27a['body']['id']){delete _0x21e27a[_0x3998('0x44')]['id'];}return db['IntegrationReport'][_0x3998('0x45')]({'where':{'id':_0x21e27a[_0x3998('0x41')]['id']}})['then'](handleEntityNotFound(_0x4cc1cf,null))[_0x3998('0x23')](saveUpdates(_0x21e27a['body'],null))[_0x3998('0x23')](respondWithResult(_0x4cc1cf,null))['catch'](handleError(_0x4cc1cf,null));};exports[_0x3998('0x24')]=function(_0x3ef999,_0x1a9141){return db[_0x3998('0x3c')][_0x3998('0x45')]({'where':{'id':_0x3ef999[_0x3998('0x41')]['id']}})[_0x3998('0x23')](handleEntityNotFound(_0x1a9141,null))[_0x3998('0x23')](removeEntity(_0x1a9141,null))[_0x3998('0x40')](handleError(_0x1a9141,null));};exports[_0x3998('0x46')]=function(_0x897413,_0x39d751){return db[_0x3998('0x3c')][_0x3998('0x46')]()[_0x3998('0x23')](respondWithResult(_0x39d751,null))[_0x3998('0x40')](handleError(_0x39d751,null));}; \ No newline at end of file +var _0xc892=['status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','IntegrationReport','includeAll','include','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','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'];(function(_0x2a8249,_0x2c6b2b){var _0x1bd2cc=function(_0x2a0098){while(--_0x2a0098){_0x2a8249['push'](_0x2a8249['shift']());}};_0x1bd2cc(++_0x2c6b2b);}(_0xc892,0x14f));var _0x2c89=function(_0x158cd8,_0x3bf412){_0x158cd8=_0x158cd8-0x0;var _0x5b93ad=_0xc892[_0x158cd8];return _0x5b93ad;};'use strict';var emlformat=require(_0x2c89('0x0'));var rimraf=require(_0x2c89('0x1'));var zipdir=require(_0x2c89('0x2'));var jsonpatch=require(_0x2c89('0x3'));var rp=require(_0x2c89('0x4'));var moment=require(_0x2c89('0x5'));var BPromise=require(_0x2c89('0x6'));var Mustache=require('mustache');var util=require(_0x2c89('0x7'));var path=require(_0x2c89('0x8'));var sox=require(_0x2c89('0x9'));var csv=require(_0x2c89('0xa'));var ejs=require(_0x2c89('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c89('0xc'));var squel=require(_0x2c89('0xd'));var crypto=require(_0x2c89('0xe'));var jsforce=require(_0x2c89('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2c89('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2c89('0x10'));var authService=require(_0x2c89('0x11'));var qs=require(_0x2c89('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c89('0x13'));var logger=require(_0x2c89('0x14'))(_0x2c89('0x15'));var utils=require(_0x2c89('0x16'));var config=require(_0x2c89('0x17'));var licenseUtil=require(_0x2c89('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc1fb51,_0x1ed4e1){_0x1ed4e1=_0x1ed4e1||0xcc;return function(_0x444823){if(_0x444823){return _0xc1fb51['sendStatus'](_0x1ed4e1);}return _0xc1fb51[_0x2c89('0x19')](_0x1ed4e1)[_0x2c89('0x1a')]();};}function respondWithResult(_0x387e9d,_0x400239){_0x400239=_0x400239||0xc8;return function(_0x374e94){if(_0x374e94){return _0x387e9d[_0x2c89('0x19')](_0x400239)['json'](_0x374e94);}};}function respondWithFilteredResult(_0x1f566a,_0x4012ed){return function(_0x379f0d){if(_0x379f0d){var _0x4fecff=typeof _0x4012ed['offset']==='undefined'&&typeof _0x4012ed[_0x2c89('0x1b')]===_0x2c89('0x1c');var _0x2cd048=_0x379f0d[_0x2c89('0x1d')];var _0x46bdd2=_0x4fecff?0x0:_0x4012ed['offset'];var _0x2ea800=_0x4fecff?_0x379f0d['count']:_0x4012ed[_0x2c89('0x1e')]+_0x4012ed['limit'];var _0x361079;if(_0x2ea800>=_0x2cd048){_0x2ea800=_0x2cd048;_0x361079=0xc8;}else{_0x361079=0xce;}_0x1f566a[_0x2c89('0x19')](_0x361079);return _0x1f566a[_0x2c89('0x1f')](_0x2c89('0x20'),_0x46bdd2+'-'+_0x2ea800+'/'+_0x2cd048)[_0x2c89('0x21')](_0x379f0d);}return null;};}function patchUpdates(_0x2fb130){return function(_0x3cfbff){try{jsonpatch[_0x2c89('0x22')](_0x3cfbff,_0x2fb130,!![]);}catch(_0x26fd8a){return BPromise['reject'](_0x26fd8a);}return _0x3cfbff[_0x2c89('0x23')]();};}function saveUpdates(_0x1c8329,_0x2872cf){return function(_0xd40169){if(_0xd40169){return _0xd40169[_0x2c89('0x24')](_0x1c8329)[_0x2c89('0x25')](function(_0x276d8b){return _0x276d8b;});}return null;};}function removeEntity(_0x60ca47,_0x4f3379){return function(_0x23963b){if(_0x23963b){return _0x23963b[_0x2c89('0x26')]()[_0x2c89('0x25')](function(){_0x60ca47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ddd20,_0x490403){return function(_0x4d36d7){if(!_0x4d36d7){_0x4ddd20['sendStatus'](0x194);}return _0x4d36d7;};}function handleError(_0x3ab2b2,_0x4d05df){_0x4d05df=_0x4d05df||0x1f4;return function(_0x21b56a){logger['error'](_0x21b56a[_0x2c89('0x27')]);if(_0x21b56a[_0x2c89('0x28')]){delete _0x21b56a['name'];}_0x3ab2b2['status'](_0x4d05df)[_0x2c89('0x29')](_0x21b56a);};}exports['index']=function(_0x2b96cd,_0x5e2f26){var _0x338c4d={},_0x1d9d8c={},_0x456adf={'count':0x0,'rows':[]};var _0x20e318=_[_0x2c89('0x2a')](db['IntegrationReport'][_0x2c89('0x2b')],function(_0x17ff1c){return{'name':_0x17ff1c[_0x2c89('0x2c')],'type':_0x17ff1c['type'][_0x2c89('0x2d')]};});_0x1d9d8c[_0x2c89('0x2e')]=_['map'](_0x20e318,_0x2c89('0x28'));_0x1d9d8c['query']=_[_0x2c89('0x2f')](_0x2b96cd[_0x2c89('0x30')]);_0x1d9d8c[_0x2c89('0x31')]=_[_0x2c89('0x32')](_0x1d9d8c['model'],_0x1d9d8c[_0x2c89('0x30')]);_0x338c4d[_0x2c89('0x33')]=_['intersection'](_0x1d9d8c[_0x2c89('0x2e')],qs[_0x2c89('0x34')](_0x2b96cd[_0x2c89('0x30')][_0x2c89('0x34')]));_0x338c4d['attributes']=_0x338c4d['attributes'][_0x2c89('0x35')]?_0x338c4d['attributes']:_0x1d9d8c[_0x2c89('0x2e')];if(!_0x2b96cd[_0x2c89('0x30')]['hasOwnProperty'](_0x2c89('0x36'))){_0x338c4d[_0x2c89('0x1b')]=qs['limit'](_0x2b96cd[_0x2c89('0x30')][_0x2c89('0x1b')]);_0x338c4d[_0x2c89('0x1e')]=qs[_0x2c89('0x1e')](_0x2b96cd[_0x2c89('0x30')][_0x2c89('0x1e')]);}_0x338c4d['order']=qs[_0x2c89('0x37')](_0x2b96cd['query'][_0x2c89('0x37')]);_0x338c4d['where']=qs[_0x2c89('0x31')](_[_0x2c89('0x38')](_0x2b96cd[_0x2c89('0x30')],_0x1d9d8c[_0x2c89('0x31')]),_0x20e318);if(_0x2b96cd['query'][_0x2c89('0x39')]){_0x338c4d[_0x2c89('0x3a')]=_[_0x2c89('0x3b')](_0x338c4d['where'],{'$or':_[_0x2c89('0x2a')](_0x20e318,function(_0x459be3){if(_0x459be3[_0x2c89('0x3c')]!==_0x2c89('0x3d')){var _0x5179ab={};_0x5179ab[_0x459be3[_0x2c89('0x28')]]={'$like':'%'+_0x2b96cd[_0x2c89('0x30')]['filter']+'%'};return _0x5179ab;}})});}_0x338c4d=_[_0x2c89('0x3b')]({},_0x338c4d,_0x2b96cd[_0x2c89('0x3e')]);var _0x5bac5b={'where':_0x338c4d['where']};return db[_0x2c89('0x3f')][_0x2c89('0x1d')](_0x5bac5b)[_0x2c89('0x25')](function(_0x40d05a){_0x456adf[_0x2c89('0x1d')]=_0x40d05a;if(_0x2b96cd[_0x2c89('0x30')][_0x2c89('0x40')]){_0x338c4d[_0x2c89('0x41')]=[{'all':!![]}];}return db[_0x2c89('0x3f')]['findAll'](_0x338c4d);})[_0x2c89('0x25')](function(_0x7d29bc){_0x456adf['rows']=_0x7d29bc;return _0x456adf;})[_0x2c89('0x25')](respondWithFilteredResult(_0x5e2f26,_0x338c4d))[_0x2c89('0x42')](handleError(_0x5e2f26,null));};exports['show']=function(_0x40ce51,_0x506939){var _0x392ed6={'raw':![],'where':{'id':_0x40ce51['params']['id']}},_0x352dfa={};_0x352dfa[_0x2c89('0x2e')]=_[_0x2c89('0x2f')](db[_0x2c89('0x3f')][_0x2c89('0x2b')]);_0x352dfa[_0x2c89('0x30')]=_['keys'](_0x40ce51[_0x2c89('0x30')]);_0x352dfa[_0x2c89('0x31')]=_['intersection'](_0x352dfa[_0x2c89('0x2e')],_0x352dfa[_0x2c89('0x30')]);_0x392ed6['attributes']=_[_0x2c89('0x32')](_0x352dfa['model'],qs[_0x2c89('0x34')](_0x40ce51[_0x2c89('0x30')]['fields']));_0x392ed6['attributes']=_0x392ed6[_0x2c89('0x33')]['length']?_0x392ed6[_0x2c89('0x33')]:_0x352dfa['model'];if(_0x40ce51['query'][_0x2c89('0x40')]){_0x392ed6[_0x2c89('0x41')]=[{'all':!![]}];}_0x392ed6=_[_0x2c89('0x3b')]({},_0x392ed6,_0x40ce51[_0x2c89('0x3e')]);return db[_0x2c89('0x3f')][_0x2c89('0x43')](_0x392ed6)[_0x2c89('0x25')](handleEntityNotFound(_0x506939,null))[_0x2c89('0x25')](respondWithResult(_0x506939,null))[_0x2c89('0x42')](handleError(_0x506939,null));};exports['create']=function(_0x1d7661,_0x574a24){return db[_0x2c89('0x3f')][_0x2c89('0x44')](_0x1d7661['body'],{})[_0x2c89('0x25')](respondWithResult(_0x574a24,0xc9))[_0x2c89('0x42')](handleError(_0x574a24,null));};exports[_0x2c89('0x24')]=function(_0x33d344,_0x1abad3){if(_0x33d344[_0x2c89('0x45')]['id']){delete _0x33d344['body']['id'];}return db[_0x2c89('0x3f')][_0x2c89('0x43')]({'where':{'id':_0x33d344[_0x2c89('0x46')]['id']}})[_0x2c89('0x25')](handleEntityNotFound(_0x1abad3,null))['then'](saveUpdates(_0x33d344[_0x2c89('0x45')],null))[_0x2c89('0x25')](respondWithResult(_0x1abad3,null))['catch'](handleError(_0x1abad3,null));};exports[_0x2c89('0x26')]=function(_0x99b029,_0x4ca030){return db[_0x2c89('0x3f')][_0x2c89('0x43')]({'where':{'id':_0x99b029[_0x2c89('0x46')]['id']}})[_0x2c89('0x25')](handleEntityNotFound(_0x4ca030,null))['then'](removeEntity(_0x4ca030,null))[_0x2c89('0x42')](handleError(_0x4ca030,null));};exports[_0x2c89('0x47')]=function(_0x5ac01e,_0x15e85d){return db[_0x2c89('0x3f')][_0x2c89('0x47')]()[_0x2c89('0x25')](respondWithResult(_0x15e85d,null))['catch'](handleError(_0x15e85d,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 1a8e04c..00d81a3 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 _0x0c15=['../../config/environment','./integrationReport.attributes','exports','IntegrationReport','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xc6b1e,_0x2f3232){var _0x2fd0ae=function(_0x5bb7d4){while(--_0x5bb7d4){_0xc6b1e['push'](_0xc6b1e['shift']());}};_0x2fd0ae(++_0x2f3232);}(_0x0c15,0x16f));var _0x50c1=function(_0x5d2777,_0x2e6526){_0x5d2777=_0x5d2777-0x0;var _0x11e9a5=_0x0c15[_0x5d2777];return _0x11e9a5;};'use strict';var _=require('lodash');var util=require(_0x50c1('0x0'));var logger=require(_0x50c1('0x1'))(_0x50c1('0x2'));var moment=require('moment');var BPromise=require(_0x50c1('0x3'));var rp=require(_0x50c1('0x4'));var fs=require('fs');var path=require(_0x50c1('0x5'));var rimraf=require(_0x50c1('0x6'));var config=require(_0x50c1('0x7'));var attributes=require(_0x50c1('0x8'));module[_0x50c1('0x9')]=function(_0x5a51a4,_0x1e80fe){return _0x5a51a4['define'](_0x50c1('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ecc=['moment','bluebird','../../config/environment','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api'];(function(_0x2070c9,_0x40401a){var _0x28b55e=function(_0xc08ba3){while(--_0xc08ba3){_0x2070c9['push'](_0x2070c9['shift']());}};_0x28b55e(++_0x40401a);}(_0x8ecc,0xee));var _0xc8ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ecc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8ec('0x0'));var util=require(_0xc8ec('0x1'));var logger=require(_0xc8ec('0x2'))(_0xc8ec('0x3'));var moment=require(_0xc8ec('0x4'));var BPromise=require(_0xc8ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc8ec('0x6'));var attributes=require('./integrationReport.attributes');module[_0xc8ec('0x7')]=function(_0xf7d814,_0x5f16df){return _0xf7d814[_0xc8ec('0x8')](_0xc8ec('0x9'),attributes,{'tableName':_0xc8ec('0xa'),'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 a17efcf..69c7ba4 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 _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x30735c,_0x37ba13){var _0x1c2072=function(_0x311c07){while(--_0x311c07){_0x30735c['push'](_0x30735c['shift']());}};_0x1c2072(++_0x37ba13);}(_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 moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0x814b=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x814b,0x1a2));var _0xb814=function(_0x324d77,_0x307ef7){_0x324d77=_0x324d77-0x0;var _0x2a77a7=_0x814b[_0x324d77];return _0x2a77a7;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index dd8a155..ea3518e 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 _0x8d6f=['/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','show','getIntervals','post','create','addIntervals','put'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8d6f,0x1bb));var _0xf8d6=function(_0x2b8ce3,_0xacd15d){_0x2b8ce3=_0x2b8ce3-0x0;var _0x10217c=_0x8d6f[_0x2b8ce3];return _0x10217c;};'use strict';var multer=require(_0xf8d6('0x0'));var util=require(_0xf8d6('0x1'));var path=require(_0xf8d6('0x2'));var timeout=require(_0xf8d6('0x3'));var express=require(_0xf8d6('0x4'));var router=express[_0xf8d6('0x5')]();var fs_extra=require(_0xf8d6('0x6'));var auth=require(_0xf8d6('0x7'));var interaction=require(_0xf8d6('0x8'));var config=require(_0xf8d6('0x9'));var controller=require(_0xf8d6('0xa'));router[_0xf8d6('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf8d6('0xb')]('/:id',auth[_0xf8d6('0xc')](),controller[_0xf8d6('0xd')]);router[_0xf8d6('0xb')]('/:id/sub_intervals',auth[_0xf8d6('0xc')](),controller[_0xf8d6('0xe')]);router[_0xf8d6('0xf')]('/',auth[_0xf8d6('0xc')](),controller[_0xf8d6('0x10')]);router[_0xf8d6('0xf')]('/:id/sub_intervals',auth[_0xf8d6('0xc')](),controller['addInterval']);router[_0xf8d6('0xf')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0xf8d6('0x11')]);router[_0xf8d6('0x12')](_0xf8d6('0x13'),auth[_0xf8d6('0xc')](),controller[_0xf8d6('0x14')]);router['delete']('/:id',auth[_0xf8d6('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x46cb=['../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','put','update','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4e9a52,_0x25b20d){var _0x2d425f=function(_0x4f2157){while(--_0x4f2157){_0x4e9a52['push'](_0x4e9a52['shift']());}};_0x2d425f(++_0x25b20d);}(_0x46cb,0xd6));var _0xb46c=function(_0xd8face,_0x4ef518){_0xd8face=_0xd8face-0x0;var _0x38d98d=_0x46cb[_0xd8face];return _0x38d98d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb46c('0x0'));var express=require(_0xb46c('0x1'));var router=express[_0xb46c('0x2')]();var fs_extra=require(_0xb46c('0x3'));var auth=require(_0xb46c('0x4'));var interaction=require(_0xb46c('0x5'));var config=require(_0xb46c('0x6'));var controller=require(_0xb46c('0x7'));router[_0xb46c('0x8')]('/',auth[_0xb46c('0x9')](),controller[_0xb46c('0xa')]);router[_0xb46c('0x8')](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller['show']);router[_0xb46c('0x8')](_0xb46c('0xc'),auth[_0xb46c('0x9')](),controller[_0xb46c('0xd')]);router[_0xb46c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xb46c('0xc'),auth[_0xb46c('0x9')](),controller[_0xb46c('0xf')]);router[_0xb46c('0xe')](_0xb46c('0x10'),auth[_0xb46c('0x9')](),controller['addIntervals']);router[_0xb46c('0x11')]('/:id',auth[_0xb46c('0x9')](),controller[_0xb46c('0x12')]);router['delete'](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller[_0xb46c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e643485..111508f 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 _0xbe12=['STRING','sequelize'];(function(_0x5d8388,_0x166cd7){var _0x3aa743=function(_0x29c02f){while(--_0x29c02f){_0x5d8388['push'](_0x5d8388['shift']());}};_0x3aa743(++_0x166cd7);}(_0xbe12,0x167));var _0x2be1=function(_0x149eb2,_0x467466){_0x149eb2=_0x149eb2-0x0;var _0x47d529=_0xbe12[_0x149eb2];return _0x47d529;};'use strict';var Sequelize=require(_0x2be1('0x0'));module['exports']={'name':{'type':Sequelize[_0x2be1('0x1')]},'description':{'type':Sequelize[_0x2be1('0x1')]},'interval':{'type':Sequelize[_0x2be1('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xec13=['exports','STRING','sequelize'];(function(_0x511016,_0x434344){var _0x2d537a=function(_0x4989c5){while(--_0x4989c5){_0x511016['push'](_0x511016['shift']());}};_0x2d537a(++_0x434344);}(_0xec13,0x116));var _0x3ec1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xec13[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x3ec1('0x0'));module[_0x3ec1('0x1')]={'name':{'type':Sequelize[_0x3ec1('0x2')]},'description':{'type':Sequelize[_0x3ec1('0x2')]},'interval':{'type':Sequelize[_0x3ec1('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 14c0f3a..25c4248 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 _0x6511=['send','map','Interval','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','filter','options','count','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addInterval','getIntervals','findOne','sequelize','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','offset','undefined','limit','set','json','reject','save','update','destroy','then','get','Intervals','UserProfileResource','error','name'];(function(_0x48c2c7,_0x394038){var _0xcc4f5b=function(_0xe117f8){while(--_0xe117f8){_0x48c2c7['push'](_0x48c2c7['shift']());}};_0xcc4f5b(++_0x394038);}(_0x6511,0x172));var _0x1651=function(_0x3db791,_0xc96e9b){_0x3db791=_0x3db791-0x0;var _0x4d4eb0=_0x6511[_0x3db791];return _0x4d4eb0;};'use strict';var emlformat=require(_0x1651('0x0'));var rimraf=require(_0x1651('0x1'));var zipdir=require(_0x1651('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1651('0x3'));var BPromise=require(_0x1651('0x4'));var Mustache=require(_0x1651('0x5'));var util=require('util');var path=require(_0x1651('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1651('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1651('0x8'));var squel=require(_0x1651('0x9'));var crypto=require(_0x1651('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1651('0xb'));var querystring=require(_0x1651('0xc'));var Papa=require(_0x1651('0xd'));var Redis=require(_0x1651('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1651('0xf'));var as=require(_0x1651('0x10'));var hardwareService=require(_0x1651('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1651('0x12'));var config=require(_0x1651('0x13'));var licenseUtil=require(_0x1651('0x14'));var db=require(_0x1651('0x15'))['db'];var extensions=require(_0x1651('0x16'));function respondWithStatusCode(_0xaa5f11,_0x311d2a){_0x311d2a=_0x311d2a||0xcc;return function(_0x49a2ff){if(_0x49a2ff){return _0xaa5f11['sendStatus'](_0x311d2a);}return _0xaa5f11[_0x1651('0x17')](_0x311d2a)[_0x1651('0x18')]();};}function respondWithResult(_0x325ebe,_0x193273){_0x193273=_0x193273||0xc8;return function(_0x3ac57e){if(_0x3ac57e){return _0x325ebe['status'](_0x193273)['json'](_0x3ac57e);}};}function respondWithFilteredResult(_0x4c6c84,_0x3e3ba0){return function(_0x2626df){if(_0x2626df){var _0x31fadd=typeof _0x3e3ba0[_0x1651('0x19')]===_0x1651('0x1a')&&typeof _0x3e3ba0[_0x1651('0x1b')]===_0x1651('0x1a');var _0x1a2349=_0x2626df['count'];var _0x56f3cc=_0x31fadd?0x0:_0x3e3ba0[_0x1651('0x19')];var _0x101d37=_0x31fadd?_0x2626df['count']:_0x3e3ba0[_0x1651('0x19')]+_0x3e3ba0[_0x1651('0x1b')];var _0x42fbe1;if(_0x101d37>=_0x1a2349){_0x101d37=_0x1a2349;_0x42fbe1=0xc8;}else{_0x42fbe1=0xce;}_0x4c6c84[_0x1651('0x17')](_0x42fbe1);return _0x4c6c84[_0x1651('0x1c')]('Content-Range',_0x56f3cc+'-'+_0x101d37+'/'+_0x1a2349)[_0x1651('0x1d')](_0x2626df);}return null;};}function patchUpdates(_0x201b50){return function(_0x23ec51){try{jsonpatch['apply'](_0x23ec51,_0x201b50,!![]);}catch(_0x504dc8){return BPromise[_0x1651('0x1e')](_0x504dc8);}return _0x23ec51[_0x1651('0x1f')]();};}function saveUpdates(_0x34a8bb,_0x597d37){return function(_0x391b19){if(_0x391b19){return _0x391b19[_0x1651('0x20')](_0x34a8bb)['then'](function(_0x3dc5c7){return _0x3dc5c7;});}return null;};}function removeEntity(_0x24191a,_0x5595d1){return function(_0x448b35){if(_0x448b35){return _0x448b35[_0x1651('0x21')]()[_0x1651('0x22')](function(){var _0x36f8f3=_0x448b35[_0x1651('0x23')]({'plain':!![]});var _0x564f47=_0x1651('0x24');return db[_0x1651('0x25')][_0x1651('0x21')]({'where':{'type':_0x564f47,'resourceId':_0x36f8f3['id']}})[_0x1651('0x22')](function(){return _0x448b35;});})[_0x1651('0x22')](function(){_0x24191a['status'](0xcc)[_0x1651('0x18')]();});}};}function handleEntityNotFound(_0x3d75e8,_0x251777){return function(_0x53bccf){if(!_0x53bccf){_0x3d75e8['sendStatus'](0x194);}return _0x53bccf;};}function handleError(_0x4fef84,_0x76f749){_0x76f749=_0x76f749||0x1f4;return function(_0x59abc2){logger[_0x1651('0x26')](_0x59abc2['stack']);if(_0x59abc2['name']){delete _0x59abc2[_0x1651('0x27')];}_0x4fef84[_0x1651('0x17')](_0x76f749)[_0x1651('0x28')](_0x59abc2);};}exports['index']=function(_0x570985,_0x4635c6){var _0x4f4781={},_0x1dfc1f={},_0x4dcc7b={'count':0x0,'rows':[]};var _0x782683=_[_0x1651('0x29')](db[_0x1651('0x2a')][_0x1651('0x2b')],function(_0x22d61a){return{'name':_0x22d61a['fieldName'],'type':_0x22d61a['type'][_0x1651('0x2c')]};});_0x1dfc1f[_0x1651('0x2d')]=_[_0x1651('0x29')](_0x782683,_0x1651('0x27'));_0x1dfc1f['query']=_[_0x1651('0x2e')](_0x570985[_0x1651('0x2f')]);_0x1dfc1f[_0x1651('0x30')]=_[_0x1651('0x31')](_0x1dfc1f[_0x1651('0x2d')],_0x1dfc1f[_0x1651('0x2f')]);_0x4f4781[_0x1651('0x32')]=_[_0x1651('0x31')](_0x1dfc1f['model'],qs[_0x1651('0x33')](_0x570985[_0x1651('0x2f')][_0x1651('0x33')]));_0x4f4781[_0x1651('0x32')]=_0x4f4781[_0x1651('0x32')][_0x1651('0x34')]?_0x4f4781['attributes']:_0x1dfc1f[_0x1651('0x2d')];if(!_0x570985[_0x1651('0x2f')][_0x1651('0x35')]('nolimit')){_0x4f4781['limit']=qs[_0x1651('0x1b')](_0x570985[_0x1651('0x2f')]['limit']);_0x4f4781[_0x1651('0x19')]=qs[_0x1651('0x19')](_0x570985[_0x1651('0x2f')][_0x1651('0x19')]);}_0x4f4781[_0x1651('0x36')]=qs[_0x1651('0x37')](_0x570985[_0x1651('0x2f')][_0x1651('0x37')]);_0x4f4781[_0x1651('0x38')]=qs[_0x1651('0x30')](_['pick'](_0x570985[_0x1651('0x2f')],_0x1dfc1f[_0x1651('0x30')]),_0x782683);if(_0x570985[_0x1651('0x2f')]['filter']){_0x4f4781[_0x1651('0x38')]=_[_0x1651('0x39')](_0x4f4781[_0x1651('0x38')],{'$or':_[_0x1651('0x29')](_0x782683,function(_0x4231ef){if(_0x4231ef[_0x1651('0x3a')]!=='VIRTUAL'){var _0x59bbfd={};_0x59bbfd[_0x4231ef['name']]={'$like':'%'+_0x570985['query'][_0x1651('0x3b')]+'%'};return _0x59bbfd;}})});}_0x4f4781=_[_0x1651('0x39')]({},_0x4f4781,_0x570985[_0x1651('0x3c')]);var _0xb92bd0={'where':_0x4f4781[_0x1651('0x38')]};return db['Interval'][_0x1651('0x3d')](_0xb92bd0)[_0x1651('0x22')](function(_0x2ee561){_0x4dcc7b[_0x1651('0x3d')]=_0x2ee561;if(_0x570985[_0x1651('0x2f')][_0x1651('0x3e')]){_0x4f4781[_0x1651('0x3f')]=[{'all':!![]}];}return db[_0x1651('0x2a')]['findAll'](_0x4f4781);})[_0x1651('0x22')](function(_0x450e5d){_0x4dcc7b['rows']=_0x450e5d;return _0x4dcc7b;})['then'](respondWithFilteredResult(_0x4635c6,_0x4f4781))[_0x1651('0x40')](handleError(_0x4635c6,null));};exports[_0x1651('0x41')]=function(_0x5b7cc9,_0x38165c){var _0xde5679={'raw':!![],'where':{'id':_0x5b7cc9[_0x1651('0x42')]['id']}},_0x233fd7={};_0x233fd7[_0x1651('0x2d')]=_[_0x1651('0x2e')](db[_0x1651('0x2a')][_0x1651('0x2b')]);_0x233fd7[_0x1651('0x2f')]=_[_0x1651('0x2e')](_0x5b7cc9[_0x1651('0x2f')]);_0x233fd7['filters']=_['intersection'](_0x233fd7[_0x1651('0x2d')],_0x233fd7[_0x1651('0x2f')]);_0xde5679[_0x1651('0x32')]=_[_0x1651('0x31')](_0x233fd7[_0x1651('0x2d')],qs[_0x1651('0x33')](_0x5b7cc9[_0x1651('0x2f')][_0x1651('0x33')]));_0xde5679[_0x1651('0x32')]=_0xde5679['attributes'][_0x1651('0x34')]?_0xde5679[_0x1651('0x32')]:_0x233fd7[_0x1651('0x2d')];if(_0x5b7cc9[_0x1651('0x2f')]['includeAll']){_0xde5679[_0x1651('0x3f')]=[{'all':!![]}];}_0xde5679=_['merge']({},_0xde5679,_0x5b7cc9[_0x1651('0x3c')]);return db[_0x1651('0x2a')][_0x1651('0x43')](_0xde5679)[_0x1651('0x22')](handleEntityNotFound(_0x38165c,null))[_0x1651('0x22')](respondWithResult(_0x38165c,null))[_0x1651('0x40')](handleError(_0x38165c,null));};exports[_0x1651('0x44')]=function(_0x14e8b5,_0x318828){return db[_0x1651('0x2a')][_0x1651('0x44')](_0x14e8b5[_0x1651('0x45')],{})[_0x1651('0x22')](function(_0x5b86ff){var _0x1a1175=_0x14e8b5[_0x1651('0x46')][_0x1651('0x23')]({'plain':!![]});if(!_0x1a1175)throw new Error(_0x1651('0x47'));if(_0x1a1175[_0x1651('0x48')]===_0x1651('0x46')){var _0x3f54c3=_0x5b86ff[_0x1651('0x23')]({'plain':!![]});var _0x598809=_0x1651('0x24');return db[_0x1651('0x49')][_0x1651('0x43')]({'where':{'name':_0x598809,'userProfileId':_0x1a1175[_0x1651('0x4a')]},'raw':!![]})[_0x1651('0x22')](function(_0x137089){if(_0x137089&&_0x137089[_0x1651('0x4b')]===0x0){return db[_0x1651('0x25')]['create']({'name':_0x3f54c3['name'],'resourceId':_0x3f54c3['id'],'type':_0x137089[_0x1651('0x27')],'sectionId':_0x137089['id']},{})[_0x1651('0x22')](function(){return _0x5b86ff;});}else{return _0x5b86ff;}})[_0x1651('0x40')](function(_0x43d00c){logger[_0x1651('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43d00c);throw _0x43d00c;});}return _0x5b86ff;})[_0x1651('0x22')](respondWithResult(_0x318828,0xc9))[_0x1651('0x40')](handleError(_0x318828,null));};exports[_0x1651('0x20')]=function(_0x4d9388,_0x2c808c){if(_0x4d9388['body']['id']){delete _0x4d9388[_0x1651('0x45')]['id'];}return db[_0x1651('0x2a')][_0x1651('0x43')]({'where':{'id':_0x4d9388[_0x1651('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c808c,null))[_0x1651('0x22')](saveUpdates(_0x4d9388[_0x1651('0x45')],null))[_0x1651('0x22')](respondWithResult(_0x2c808c,null))[_0x1651('0x40')](handleError(_0x2c808c,null));};exports[_0x1651('0x21')]=function(_0x31758f,_0x453a9c){return db[_0x1651('0x2a')]['find']({'where':{'id':_0x31758f[_0x1651('0x42')]['id']}})[_0x1651('0x22')](handleEntityNotFound(_0x453a9c,null))['then'](removeEntity(_0x453a9c,null))[_0x1651('0x40')](handleError(_0x453a9c,null));};exports[_0x1651('0x4c')]=function(_0x49ecbb,_0x409983,_0x2967bc){if(_0x49ecbb[_0x1651('0x45')]['id']){delete _0x49ecbb['body']['id'];}return db[_0x1651('0x2a')][_0x1651('0x43')]({'where':{'id':_0x49ecbb[_0x1651('0x42')]['id']}})['then'](handleEntityNotFound(_0x409983,null))[_0x1651('0x22')](function(_0x11c6bc){if(_0x11c6bc){_0x49ecbb['body']['IntervalId']=_0x11c6bc['id'];return db['Interval'][_0x1651('0x44')](_0x49ecbb[_0x1651('0x45')]);}})[_0x1651('0x22')](respondWithResult(_0x409983,null))['catch'](handleError(_0x409983,null));};exports[_0x1651('0x4d')]=function(_0x91d62c,_0x4cafa4,_0xe4a23c){var _0x104f45={};var _0x5b4553={};var _0x320de0;var _0x214089;return db[_0x1651('0x2a')][_0x1651('0x4e')]({'where':{'id':_0x91d62c[_0x1651('0x42')]['id']}})[_0x1651('0x22')](handleEntityNotFound(_0x4cafa4,null))[_0x1651('0x22')](function(_0x456e04){if(_0x456e04){_0x320de0=_0x456e04;_0x5b4553['model']=_[_0x1651('0x2e')](db['Interval']['rawAttributes']);_0x5b4553[_0x1651('0x2f')]=_[_0x1651('0x2e')](_0x91d62c[_0x1651('0x2f')]);_0x5b4553[_0x1651('0x30')]=_[_0x1651('0x31')](_0x5b4553[_0x1651('0x2d')],_0x5b4553['query']);_0x104f45[_0x1651('0x32')]=_[_0x1651('0x31')](_0x5b4553[_0x1651('0x2d')],qs[_0x1651('0x33')](_0x91d62c[_0x1651('0x2f')][_0x1651('0x33')]));_0x104f45[_0x1651('0x32')]=_0x104f45[_0x1651('0x32')][_0x1651('0x34')]?_0x104f45[_0x1651('0x32')]:_0x5b4553[_0x1651('0x2d')];_0x104f45[_0x1651('0x36')]=qs[_0x1651('0x37')](_0x91d62c[_0x1651('0x2f')][_0x1651('0x37')]);_0x104f45['where']=qs[_0x1651('0x30')](_['pick'](_0x91d62c[_0x1651('0x2f')],_0x5b4553[_0x1651('0x30')]));if(_0x91d62c['query'][_0x1651('0x3b')]){_0x104f45[_0x1651('0x38')]=_[_0x1651('0x39')](_0x104f45['where'],{'$or':_[_0x1651('0x29')](_0x104f45['attributes'],function(_0x15716c){var _0x208ca5={};_0x208ca5[_0x15716c]={'$like':'%'+_0x91d62c[_0x1651('0x2f')][_0x1651('0x3b')]+'%'};return _0x208ca5;})});}_0x104f45=_[_0x1651('0x39')]({},_0x104f45,_0x91d62c[_0x1651('0x3c')]);return _0x320de0[_0x1651('0x4d')](_0x104f45);}})[_0x1651('0x22')](function(_0x7d38af){if(_0x7d38af){_0x214089=_0x7d38af[_0x1651('0x34')];if(!_0x91d62c['query']['hasOwnProperty']('nolimit')){_0x104f45[_0x1651('0x1b')]=qs[_0x1651('0x1b')](_0x91d62c[_0x1651('0x2f')]['limit']);_0x104f45[_0x1651('0x19')]=qs['offset'](_0x91d62c[_0x1651('0x2f')][_0x1651('0x19')]);}return _0x320de0[_0x1651('0x4d')](_0x104f45);}})[_0x1651('0x22')](function(_0x1c8975){if(_0x1c8975){return _0x1c8975?{'count':_0x214089,'rows':_0x1c8975}:null;}})[_0x1651('0x22')](respondWithResult(_0x4cafa4,null))[_0x1651('0x40')](handleError(_0x4cafa4,null));};exports['addIntervals']=function(_0x2e85df,_0xbfbb97,_0x4e985f){return db[_0x1651('0x2a')][_0x1651('0x4e')]({'where':{'id':_0x2e85df['params']['id']}})[_0x1651('0x22')](handleEntityNotFound(_0xbfbb97,null))[_0x1651('0x22')](function(_0x43aa2c){if(_0x43aa2c){return db[_0x1651('0x4f')]['transaction'](function(_0x5dd568){return db['Interval'][_0x1651('0x21')]({'where':{'IntervalId':_0x2e85df[_0x1651('0x42')]['id']},'transaction':_0x5dd568})['then'](function(_0x4a399c){var _0x298624=_[_0x1651('0x29')](_0x2e85df['body'],function(_0x36d454){delete _0x36d454['id'];_0x36d454[_0x1651('0x50')]=_0x2e85df['params']['id'];return _0x36d454;});return db[_0x1651('0x2a')][_0x1651('0x51')](_0x298624,{'transaction':_0x5dd568});});})[_0x1651('0x22')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x2e85df[_0x1651('0x42')]['id']}});});}})[_0x1651('0x22')](respondWithResult(_0xbfbb97,null))['catch'](handleError(_0xbfbb97,null));}; \ No newline at end of file +var _0x2260=['end','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Interval','findAll','show','rawAttributes','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','findOne','getIntervals','hasOwnProperty','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status'];(function(_0x316a28,_0x216300){var _0x476ea7=function(_0x45f6b7){while(--_0x45f6b7){_0x316a28['push'](_0x316a28['shift']());}};_0x476ea7(++_0x216300);}(_0x2260,0x101));var _0x0226=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x2260[_0x10004e];return _0x5af990;};'use strict';var emlformat=require(_0x0226('0x0'));var rimraf=require(_0x0226('0x1'));var zipdir=require(_0x0226('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0226('0x3'));var moment=require(_0x0226('0x4'));var BPromise=require(_0x0226('0x5'));var Mustache=require(_0x0226('0x6'));var util=require(_0x0226('0x7'));var path=require(_0x0226('0x8'));var sox=require(_0x0226('0x9'));var csv=require(_0x0226('0xa'));var ejs=require(_0x0226('0xb'));var fs=require('fs');var fs_extra=require(_0x0226('0xc'));var _=require(_0x0226('0xd'));var squel=require(_0x0226('0xe'));var crypto=require(_0x0226('0xf'));var jsforce=require(_0x0226('0x10'));var deskjs=require(_0x0226('0x11'));var toCsv=require(_0x0226('0xa'));var querystring=require('querystring');var Papa=require(_0x0226('0x12'));var Redis=require(_0x0226('0x13'));var authService=require(_0x0226('0x14'));var qs=require(_0x0226('0x15'));var as=require(_0x0226('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0226('0x17'))(_0x0226('0x18'));var utils=require('../../config/utils');var config=require(_0x0226('0x19'));var licenseUtil=require(_0x0226('0x1a'));var db=require(_0x0226('0x1b'))['db'];var extensions=require(_0x0226('0x1c'));function respondWithStatusCode(_0x2819d2,_0x5aa329){_0x5aa329=_0x5aa329||0xcc;return function(_0x356ea4){if(_0x356ea4){return _0x2819d2[_0x0226('0x1d')](_0x5aa329);}return _0x2819d2[_0x0226('0x1e')](_0x5aa329)[_0x0226('0x1f')]();};}function respondWithResult(_0x4f5953,_0x5dd4a1){_0x5dd4a1=_0x5dd4a1||0xc8;return function(_0x43ef44){if(_0x43ef44){return _0x4f5953['status'](_0x5dd4a1)['json'](_0x43ef44);}};}function respondWithFilteredResult(_0x46eb91,_0x4ea86d){return function(_0x48035b){if(_0x48035b){var _0x58e425=typeof _0x4ea86d['offset']===_0x0226('0x20')&&typeof _0x4ea86d[_0x0226('0x21')]===_0x0226('0x20');var _0x1a2ef8=_0x48035b[_0x0226('0x22')];var _0x46fa8d=_0x58e425?0x0:_0x4ea86d[_0x0226('0x23')];var _0x121ec9=_0x58e425?_0x48035b['count']:_0x4ea86d[_0x0226('0x23')]+_0x4ea86d[_0x0226('0x21')];var _0x46e8e8;if(_0x121ec9>=_0x1a2ef8){_0x121ec9=_0x1a2ef8;_0x46e8e8=0xc8;}else{_0x46e8e8=0xce;}_0x46eb91[_0x0226('0x1e')](_0x46e8e8);return _0x46eb91['set'](_0x0226('0x24'),_0x46fa8d+'-'+_0x121ec9+'/'+_0x1a2ef8)['json'](_0x48035b);}return null;};}function patchUpdates(_0x2b15e1){return function(_0x52b77d){try{jsonpatch[_0x0226('0x25')](_0x52b77d,_0x2b15e1,!![]);}catch(_0x4eec94){return BPromise[_0x0226('0x26')](_0x4eec94);}return _0x52b77d[_0x0226('0x27')]();};}function saveUpdates(_0x8812fe,_0x553acc){return function(_0x4f0b8d){if(_0x4f0b8d){return _0x4f0b8d[_0x0226('0x28')](_0x8812fe)[_0x0226('0x29')](function(_0x2a9f19){return _0x2a9f19;});}return null;};}function removeEntity(_0x392c16,_0x40830d){return function(_0x27a33e){if(_0x27a33e){return _0x27a33e['destroy']()[_0x0226('0x29')](function(){var _0x3948d0=_0x27a33e['get']({'plain':!![]});var _0x521f7a=_0x0226('0x2a');return db[_0x0226('0x2b')][_0x0226('0x2c')]({'where':{'type':_0x521f7a,'resourceId':_0x3948d0['id']}})['then'](function(){return _0x27a33e;});})['then'](function(){_0x392c16[_0x0226('0x1e')](0xcc)[_0x0226('0x1f')]();});}};}function handleEntityNotFound(_0x5b4125,_0x3dbaf4){return function(_0x4d81b0){if(!_0x4d81b0){_0x5b4125[_0x0226('0x1d')](0x194);}return _0x4d81b0;};}function handleError(_0x3add13,_0xd4a53b){_0xd4a53b=_0xd4a53b||0x1f4;return function(_0x1b46fc){logger[_0x0226('0x2d')](_0x1b46fc[_0x0226('0x2e')]);if(_0x1b46fc[_0x0226('0x2f')]){delete _0x1b46fc[_0x0226('0x2f')];}_0x3add13[_0x0226('0x1e')](_0xd4a53b)[_0x0226('0x30')](_0x1b46fc);};}exports[_0x0226('0x31')]=function(_0x2a0424,_0x480e9a){var _0x45e44d={},_0x19cbb1={},_0x71599f={'count':0x0,'rows':[]};var _0x430e8a=_[_0x0226('0x32')](db['Interval']['rawAttributes'],function(_0x35f487){return{'name':_0x35f487[_0x0226('0x33')],'type':_0x35f487[_0x0226('0x34')][_0x0226('0x35')]};});_0x19cbb1[_0x0226('0x36')]=_[_0x0226('0x32')](_0x430e8a,_0x0226('0x2f'));_0x19cbb1[_0x0226('0x37')]=_[_0x0226('0x38')](_0x2a0424['query']);_0x19cbb1['filters']=_[_0x0226('0x39')](_0x19cbb1[_0x0226('0x36')],_0x19cbb1[_0x0226('0x37')]);_0x45e44d[_0x0226('0x3a')]=_[_0x0226('0x39')](_0x19cbb1[_0x0226('0x36')],qs[_0x0226('0x3b')](_0x2a0424[_0x0226('0x37')]['fields']));_0x45e44d['attributes']=_0x45e44d['attributes'][_0x0226('0x3c')]?_0x45e44d['attributes']:_0x19cbb1[_0x0226('0x36')];if(!_0x2a0424['query']['hasOwnProperty'](_0x0226('0x3d'))){_0x45e44d[_0x0226('0x21')]=qs[_0x0226('0x21')](_0x2a0424['query'][_0x0226('0x21')]);_0x45e44d[_0x0226('0x23')]=qs['offset'](_0x2a0424[_0x0226('0x37')][_0x0226('0x23')]);}_0x45e44d[_0x0226('0x3e')]=qs[_0x0226('0x3f')](_0x2a0424[_0x0226('0x37')][_0x0226('0x3f')]);_0x45e44d[_0x0226('0x40')]=qs[_0x0226('0x41')](_[_0x0226('0x42')](_0x2a0424['query'],_0x19cbb1[_0x0226('0x41')]),_0x430e8a);if(_0x2a0424['query'][_0x0226('0x43')]){_0x45e44d[_0x0226('0x40')]=_[_0x0226('0x44')](_0x45e44d[_0x0226('0x40')],{'$or':_[_0x0226('0x32')](_0x430e8a,function(_0x7bf80){if(_0x7bf80[_0x0226('0x34')]!==_0x0226('0x45')){var _0x3df95b={};_0x3df95b[_0x7bf80[_0x0226('0x2f')]]={'$like':'%'+_0x2a0424['query']['filter']+'%'};return _0x3df95b;}})});}_0x45e44d=_['merge']({},_0x45e44d,_0x2a0424[_0x0226('0x46')]);var _0xb961ef={'where':_0x45e44d[_0x0226('0x40')]};return db[_0x0226('0x47')][_0x0226('0x22')](_0xb961ef)[_0x0226('0x29')](function(_0x5d579e){_0x71599f[_0x0226('0x22')]=_0x5d579e;if(_0x2a0424[_0x0226('0x37')]['includeAll']){_0x45e44d['include']=[{'all':!![]}];}return db['Interval'][_0x0226('0x48')](_0x45e44d);})['then'](function(_0x5574eb){_0x71599f['rows']=_0x5574eb;return _0x71599f;})[_0x0226('0x29')](respondWithFilteredResult(_0x480e9a,_0x45e44d))['catch'](handleError(_0x480e9a,null));};exports[_0x0226('0x49')]=function(_0x267bc0,_0x44e73b){var _0x130f99={'raw':!![],'where':{'id':_0x267bc0['params']['id']}},_0x463768={};_0x463768[_0x0226('0x36')]=_[_0x0226('0x38')](db[_0x0226('0x47')][_0x0226('0x4a')]);_0x463768['query']=_[_0x0226('0x38')](_0x267bc0[_0x0226('0x37')]);_0x463768[_0x0226('0x41')]=_['intersection'](_0x463768[_0x0226('0x36')],_0x463768[_0x0226('0x37')]);_0x130f99[_0x0226('0x3a')]=_['intersection'](_0x463768[_0x0226('0x36')],qs['fields'](_0x267bc0['query']['fields']));_0x130f99[_0x0226('0x3a')]=_0x130f99[_0x0226('0x3a')][_0x0226('0x3c')]?_0x130f99[_0x0226('0x3a')]:_0x463768['model'];if(_0x267bc0['query'][_0x0226('0x4b')]){_0x130f99['include']=[{'all':!![]}];}_0x130f99=_[_0x0226('0x44')]({},_0x130f99,_0x267bc0[_0x0226('0x46')]);return db[_0x0226('0x47')][_0x0226('0x4c')](_0x130f99)[_0x0226('0x29')](handleEntityNotFound(_0x44e73b,null))[_0x0226('0x29')](respondWithResult(_0x44e73b,null))[_0x0226('0x4d')](handleError(_0x44e73b,null));};exports['create']=function(_0x3eb173,_0x1b4cdc){return db[_0x0226('0x47')][_0x0226('0x4e')](_0x3eb173[_0x0226('0x4f')],{})['then'](function(_0xdff77f){var _0x1aa319=_0x3eb173[_0x0226('0x50')][_0x0226('0x51')]({'plain':!![]});if(!_0x1aa319)throw new Error(_0x0226('0x52'));if(_0x1aa319['role']==='user'){var _0x1a74c3=_0xdff77f[_0x0226('0x51')]({'plain':!![]});var _0x45c98f=_0x0226('0x2a');return db[_0x0226('0x53')][_0x0226('0x4c')]({'where':{'name':_0x45c98f,'userProfileId':_0x1aa319[_0x0226('0x54')]},'raw':!![]})[_0x0226('0x29')](function(_0x4d2ae4){if(_0x4d2ae4&&_0x4d2ae4[_0x0226('0x55')]===0x0){return db[_0x0226('0x2b')]['create']({'name':_0x1a74c3[_0x0226('0x2f')],'resourceId':_0x1a74c3['id'],'type':_0x4d2ae4[_0x0226('0x2f')],'sectionId':_0x4d2ae4['id']},{})['then'](function(){return _0xdff77f;});}else{return _0xdff77f;}})['catch'](function(_0x5c53ee){logger[_0x0226('0x2d')](_0x0226('0x56'),_0x5c53ee);throw _0x5c53ee;});}return _0xdff77f;})[_0x0226('0x29')](respondWithResult(_0x1b4cdc,0xc9))[_0x0226('0x4d')](handleError(_0x1b4cdc,null));};exports[_0x0226('0x28')]=function(_0x302e56,_0x3904a7){if(_0x302e56[_0x0226('0x4f')]['id']){delete _0x302e56[_0x0226('0x4f')]['id'];}return db[_0x0226('0x47')][_0x0226('0x4c')]({'where':{'id':_0x302e56['params']['id']}})[_0x0226('0x29')](handleEntityNotFound(_0x3904a7,null))[_0x0226('0x29')](saveUpdates(_0x302e56[_0x0226('0x4f')],null))['then'](respondWithResult(_0x3904a7,null))[_0x0226('0x4d')](handleError(_0x3904a7,null));};exports[_0x0226('0x2c')]=function(_0x16db71,_0x1fbbca){return db[_0x0226('0x47')]['find']({'where':{'id':_0x16db71[_0x0226('0x57')]['id']}})['then'](handleEntityNotFound(_0x1fbbca,null))['then'](removeEntity(_0x1fbbca,null))[_0x0226('0x4d')](handleError(_0x1fbbca,null));};exports[_0x0226('0x58')]=function(_0xe1ef2,_0x43d41d,_0x2a95d4){if(_0xe1ef2[_0x0226('0x4f')]['id']){delete _0xe1ef2[_0x0226('0x4f')]['id'];}return db[_0x0226('0x47')][_0x0226('0x4c')]({'where':{'id':_0xe1ef2[_0x0226('0x57')]['id']}})[_0x0226('0x29')](handleEntityNotFound(_0x43d41d,null))[_0x0226('0x29')](function(_0x12932e){if(_0x12932e){_0xe1ef2[_0x0226('0x4f')][_0x0226('0x59')]=_0x12932e['id'];return db['Interval'][_0x0226('0x4e')](_0xe1ef2[_0x0226('0x4f')]);}})[_0x0226('0x29')](respondWithResult(_0x43d41d,null))['catch'](handleError(_0x43d41d,null));};exports['getIntervals']=function(_0x56f0ce,_0x4ec21e,_0x486bd4){var _0x43070b={};var _0x12b394={};var _0x34346e;var _0x3fffec;return db['Interval'][_0x0226('0x5a')]({'where':{'id':_0x56f0ce[_0x0226('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ec21e,null))[_0x0226('0x29')](function(_0x5d2f16){if(_0x5d2f16){_0x34346e=_0x5d2f16;_0x12b394[_0x0226('0x36')]=_[_0x0226('0x38')](db[_0x0226('0x47')][_0x0226('0x4a')]);_0x12b394[_0x0226('0x37')]=_[_0x0226('0x38')](_0x56f0ce[_0x0226('0x37')]);_0x12b394[_0x0226('0x41')]=_[_0x0226('0x39')](_0x12b394[_0x0226('0x36')],_0x12b394[_0x0226('0x37')]);_0x43070b[_0x0226('0x3a')]=_['intersection'](_0x12b394['model'],qs['fields'](_0x56f0ce[_0x0226('0x37')][_0x0226('0x3b')]));_0x43070b[_0x0226('0x3a')]=_0x43070b['attributes'][_0x0226('0x3c')]?_0x43070b['attributes']:_0x12b394[_0x0226('0x36')];_0x43070b[_0x0226('0x3e')]=qs[_0x0226('0x3f')](_0x56f0ce[_0x0226('0x37')][_0x0226('0x3f')]);_0x43070b[_0x0226('0x40')]=qs[_0x0226('0x41')](_[_0x0226('0x42')](_0x56f0ce[_0x0226('0x37')],_0x12b394[_0x0226('0x41')]));if(_0x56f0ce[_0x0226('0x37')][_0x0226('0x43')]){_0x43070b[_0x0226('0x40')]=_[_0x0226('0x44')](_0x43070b[_0x0226('0x40')],{'$or':_[_0x0226('0x32')](_0x43070b[_0x0226('0x3a')],function(_0x492f68){var _0x490317={};_0x490317[_0x492f68]={'$like':'%'+_0x56f0ce[_0x0226('0x37')][_0x0226('0x43')]+'%'};return _0x490317;})});}_0x43070b=_[_0x0226('0x44')]({},_0x43070b,_0x56f0ce['options']);return _0x34346e[_0x0226('0x5b')](_0x43070b);}})['then'](function(_0x18715f){if(_0x18715f){_0x3fffec=_0x18715f[_0x0226('0x3c')];if(!_0x56f0ce[_0x0226('0x37')][_0x0226('0x5c')](_0x0226('0x3d'))){_0x43070b[_0x0226('0x21')]=qs['limit'](_0x56f0ce['query'][_0x0226('0x21')]);_0x43070b['offset']=qs[_0x0226('0x23')](_0x56f0ce['query'][_0x0226('0x23')]);}return _0x34346e['getIntervals'](_0x43070b);}})[_0x0226('0x29')](function(_0x154a53){if(_0x154a53){return _0x154a53?{'count':_0x3fffec,'rows':_0x154a53}:null;}})[_0x0226('0x29')](respondWithResult(_0x4ec21e,null))['catch'](handleError(_0x4ec21e,null));};exports['addIntervals']=function(_0x11d8c2,_0x33f522,_0x1f7f39){return db['Interval'][_0x0226('0x5a')]({'where':{'id':_0x11d8c2[_0x0226('0x57')]['id']}})[_0x0226('0x29')](handleEntityNotFound(_0x33f522,null))['then'](function(_0x30b1b2){if(_0x30b1b2){return db[_0x0226('0x5d')][_0x0226('0x5e')](function(_0xd15d12){return db[_0x0226('0x47')][_0x0226('0x2c')]({'where':{'IntervalId':_0x11d8c2[_0x0226('0x57')]['id']},'transaction':_0xd15d12})[_0x0226('0x29')](function(_0x5cee0d){var _0x8f3da=_['map'](_0x11d8c2[_0x0226('0x4f')],function(_0x1a7252){delete _0x1a7252['id'];_0x1a7252[_0x0226('0x59')]=_0x11d8c2[_0x0226('0x57')]['id'];return _0x1a7252;});return db[_0x0226('0x47')][_0x0226('0x5f')](_0x8f3da,{'transaction':_0xd15d12});});})[_0x0226('0x29')](function(){return db[_0x0226('0x47')][_0x0226('0x48')]({'where':{'IntervalId':_0x11d8c2[_0x0226('0x57')]['id']}});});}})['then'](respondWithResult(_0x33f522,null))[_0x0226('0x4d')](handleError(_0x33f522,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 5f297a0..19ba716 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 _0xcb68=['exports','tools_intervals','rewrite','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./interval.attributes'];(function(_0x488f6b,_0x33b8d4){var _0x4407e8=function(_0x5a3d78){while(--_0x5a3d78){_0x488f6b['push'](_0x488f6b['shift']());}};_0x4407e8(++_0x33b8d4);}(_0xcb68,0x1a7));var _0x8cb6=function(_0x4c885a,_0x215658){_0x4c885a=_0x4c885a-0x0;var _0x45f021=_0xcb68[_0x4c885a];return _0x45f021;};'use strict';var _=require(_0x8cb6('0x0'));var util=require('util');var logger=require(_0x8cb6('0x1'))('api');var moment=require(_0x8cb6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cb6('0x3'));var rimraf=require(_0x8cb6('0x4'));var config=require(_0x8cb6('0x5'));var attributes=require(_0x8cb6('0x6'));var extensions=require('../../components/extensions/rewrite');module[_0x8cb6('0x7')]=function(_0x1e1f5c,_0x1630bd){return _0x1e1f5c['define']('Interval',attributes,{'tableName':_0x8cb6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1eb5a7,_0x1f4a44){extensions[_0x8cb6('0x9')](_0x1e1f5c,_0x1eb5a7);},'afterBulkCreate':function(_0x4a3ab5,_0x550e0e,_0x3de9a5){_0x3de9a5();extensions[_0x8cb6('0x9')](_0x1e1f5c,_0x4a3ab5[0x0]);},'afterUpdate':function(_0x49a434,_0x257326){extensions[_0x8cb6('0x9')](_0x1e1f5c,_0x49a434);},'afterDestroy':function(_0x5cb2aa,_0x3d81f2){extensions[_0x8cb6('0x9')](_0x1e1f5c,_0x5cb2aa);}}});}; \ No newline at end of file +var _0x1332=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite'];(function(_0x132ecc,_0x96b970){var _0x175ef5=function(_0x153902){while(--_0x153902){_0x132ecc['push'](_0x132ecc['shift']());}};_0x175ef5(++_0x96b970);}(_0x1332,0x1d4));var _0x2133=function(_0xa63a30,_0x275c35){_0xa63a30=_0xa63a30-0x0;var _0xa993ee=_0x1332[_0xa63a30];return _0xa993ee;};'use strict';var _=require(_0x2133('0x0'));var util=require(_0x2133('0x1'));var logger=require(_0x2133('0x2'))(_0x2133('0x3'));var moment=require(_0x2133('0x4'));var BPromise=require(_0x2133('0x5'));var rp=require(_0x2133('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2133('0x7'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0x2133('0x8'));module['exports']=function(_0x2704d1,_0x42c2cc){return _0x2704d1[_0x2133('0x9')](_0x2133('0xa'),attributes,{'tableName':_0x2133('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x35cc72,_0x486e1a){extensions[_0x2133('0xc')](_0x2704d1,_0x35cc72);},'afterBulkCreate':function(_0x1b93a1,_0xf9f1e2,_0x2c8ac1){_0x2c8ac1();extensions['rewrite'](_0x2704d1,_0x1b93a1[0x0]);},'afterUpdate':function(_0x1965ef,_0x4ffb6f){extensions['rewrite'](_0x2704d1,_0x1965ef);},'afterDestroy':function(_0x5f3060,_0x43c54d){extensions['rewrite'](_0x2704d1,_0x5f3060);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 28217b4..c1ed8af 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index fb83de1..61bcba3 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x545939,_0x2a98b5){var _0x48e6b8=function(_0x1b919c){while(--_0x1b919c){_0x545939['push'](_0x545939['shift']());}};_0x48e6b8(++_0x2a98b5);}(_0xdb28,0x106));var _0x8db2=function(_0x2a7780,_0x556d88){_0x2a7780=_0x2a7780-0x0;var _0x41e9de=_0xdb28[_0x2a7780];return _0x41e9de;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb10b,0x12a));var _0xbb10=function(_0xa92559,_0x1d2e45){_0xa92559=_0xa92559-0x0;var _0x502df8=_0xb10b[_0xa92559];return _0x502df8;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 39844cf..3218e36 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 _0x103b=['end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','customfield_10102','Basic\x20','toString','base64','request','setEncoding','utf8','data','statusCode','json','parse','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0x103b,0x136));var _0xb103=function(_0x8b7e2d,_0x548663){_0x8b7e2d=_0x8b7e2d-0x0;var _0x361a95=_0x103b[_0x8b7e2d];return _0x361a95;};'use strict';var BPromise=require(_0xb103('0x0'));var https=require(_0xb103('0x1'));var logger=require('../../config/logger')(_0xb103('0x2'));var USERNAME=_0xb103('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x3b5d55,_0x1c3e6f){var _0x1d212a={'fields':{'project':{'key':_0x3b5d55[_0xb103('0x4')]||_0xb103('0x5')},'summary':(_0x3b5d55[_0xb103('0x6')]||_0xb103('0x7'))+_0xb103('0x8')+_0x3b5d55['ip'],'description':_0x3b5d55['description']||JSON[_0xb103('0x9')](_0x3b5d55),'issuetype':{'name':_0x3b5d55[_0xb103('0xa')]||'Bug'}}};_0x1d212a[_0xb103('0xb')][_0xb103('0xc')]=_0x3b5d55[_0xb103('0xd')];_0x1d212a[_0xb103('0xb')][_0xb103('0xe')]=_0x3b5d55[_0xb103('0xf')];_0x1d212a[_0xb103('0xb')]['customfield_11502']=_0x3b5d55[_0xb103('0x10')];_0x1d212a[_0xb103('0xb')][_0xb103('0x11')]=_0x3b5d55[_0xb103('0x12')];_0x1d212a[_0xb103('0xb')][_0xb103('0x13')]=_0x3b5d55['reason'];_0x1d212a[_0xb103('0xb')][_0xb103('0x14')]=_0x3b5d55['ip'];var _0x19ae66={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xb103('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0xb103('0x16')](_0xb103('0x17'))}};var _0x54e523=JSON[_0xb103('0x9')](_0x1d212a);var _0x35494e=https[_0xb103('0x18')](_0x19ae66,function(_0x548724){_0x548724[_0xb103('0x19')](_0xb103('0x1a'));var _0x4ae752='';_0x548724['on'](_0xb103('0x1b'),function(_0x45b7df){_0x4ae752+=_0x45b7df;});_0x548724['on']('end',function(){if(_0x1c3e6f){return _0x1c3e6f['status'](_0x548724[_0xb103('0x1c')])[_0xb103('0x1d')](JSON[_0xb103('0x1e')](_0x4ae752));}});});_0x35494e['on']('error',function(_0x37d93f){if(_0x1c3e6f){return _0x1c3e6f[_0xb103('0x1f')](0x1f4)[_0xb103('0x1d')]({'errors':[{'message':_0xb103('0x20'),'type':'api.jira'}]});}});_0x35494e[_0xb103('0x21')](_0x54e523);_0x35494e[_0xb103('0x22')]();}exports[_0xb103('0x23')]=openIssue;exports[_0xb103('0x24')]=function(_0x583e7a,_0x5e3187){_0x583e7a[_0xb103('0x25')]['ip']=_0x583e7a[_0xb103('0x26')][_0xb103('0x27')]||_0x583e7a[_0xb103('0x28')][_0xb103('0x29')]||_0x583e7a['socket'][_0xb103('0x29')]||_0x583e7a[_0xb103('0x28')][_0xb103('0x2a')][_0xb103('0x29')];return openIssue(_0x583e7a[_0xb103('0x25')],_0x5e3187);}; \ No newline at end of file +var _0x72f0=['../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','end','statusCode','json','parse','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird'];(function(_0x57aaff,_0x53d28e){var _0x362f63=function(_0xd748fa){while(--_0xd748fa){_0x57aaff['push'](_0x57aaff['shift']());}};_0x362f63(++_0x53d28e);}(_0x72f0,0x1e3));var _0x072f=function(_0x13b3b5,_0x52d8d8){_0x13b3b5=_0x13b3b5-0x0;var _0x337cd0=_0x72f0[_0x13b3b5];return _0x337cd0;};'use strict';var BPromise=require(_0x072f('0x0'));var https=require('https');var logger=require(_0x072f('0x1'))(_0x072f('0x2'));var USERNAME=_0x072f('0x3');var PASSWORD=_0x072f('0x4');function openIssue(_0x2fa3f9,_0x29c130){var _0x4e5565={'fields':{'project':{'key':_0x2fa3f9['key']||_0x072f('0x5')},'summary':(_0x2fa3f9[_0x072f('0x6')]||'Report')+_0x072f('0x7')+_0x2fa3f9['ip'],'description':_0x2fa3f9[_0x072f('0x8')]||JSON[_0x072f('0x9')](_0x2fa3f9),'issuetype':{'name':_0x2fa3f9[_0x072f('0xa')]||_0x072f('0xb')}}};_0x4e5565[_0x072f('0xc')][_0x072f('0xd')]=_0x2fa3f9[_0x072f('0xe')];_0x4e5565[_0x072f('0xc')][_0x072f('0xf')]=_0x2fa3f9[_0x072f('0x10')];_0x4e5565[_0x072f('0xc')][_0x072f('0x11')]=_0x2fa3f9[_0x072f('0x12')];_0x4e5565[_0x072f('0xc')]['customfield_11503']=_0x2fa3f9[_0x072f('0x13')];_0x4e5565['fields'][_0x072f('0x14')]=_0x2fa3f9['reason'];_0x4e5565[_0x072f('0xc')]['customfield_10102']=_0x2fa3f9['ip'];var _0x2de74f={'host':_0x072f('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x072f('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x072f('0x17'),'Authorization':_0x072f('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x072f('0x19')]('base64')}};var _0x1f93ca=JSON[_0x072f('0x9')](_0x4e5565);var _0x14d481=https[_0x072f('0x1a')](_0x2de74f,function(_0x4d8ddb){_0x4d8ddb[_0x072f('0x1b')](_0x072f('0x1c'));var _0x54eb7d='';_0x4d8ddb['on'](_0x072f('0x1d'),function(_0x3e3b5c){_0x54eb7d+=_0x3e3b5c;});_0x4d8ddb['on'](_0x072f('0x1e'),function(){if(_0x29c130){return _0x29c130['status'](_0x4d8ddb[_0x072f('0x1f')])[_0x072f('0x20')](JSON[_0x072f('0x21')](_0x54eb7d));}});});_0x14d481['on']('error',function(_0xd5723c){if(_0x29c130){return _0x29c130['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x072f('0x22')}]});}});_0x14d481[_0x072f('0x23')](_0x1f93ca);_0x14d481[_0x072f('0x1e')]();}exports[_0x072f('0x24')]=openIssue;exports[_0x072f('0x25')]=function(_0x3339eb,_0x4b8400){_0x3339eb[_0x072f('0x26')]['ip']=_0x3339eb[_0x072f('0x27')][_0x072f('0x28')]||_0x3339eb[_0x072f('0x29')]['remoteAddress']||_0x3339eb[_0x072f('0x2a')][_0x072f('0x2b')]||_0x3339eb[_0x072f('0x29')][_0x072f('0x2a')][_0x072f('0x2b')];return openIssue(_0x3339eb[_0x072f('0x26')],_0x4b8400);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 1b2b255..ba5c5ae 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 _0x22fb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1e707c,_0x1b89c1){var _0x3d6e3f=function(_0x5833e5){while(--_0x5833e5){_0x1e707c['push'](_0x1e707c['shift']());}};_0x3d6e3f(++_0x1b89c1);}(_0x22fb,0x192));var _0xb22f=function(_0x292a36,_0x5034c7){_0x292a36=_0x292a36-0x0;var _0x182564=_0x22fb[_0x292a36];return _0x182564;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x480cca,_0x33709f){var _0x22bcdb=function(_0x15ab17){while(--_0x15ab17){_0x480cca['push'](_0x480cca['shift']());}};_0x22bcdb(++_0x33709f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x46411e,_0x4f9c38){_0x46411e=_0x46411e-0x0;var _0x3d1bda=_0xa8a8[_0x46411e];return _0x3d1bda;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('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 fc6132f..8b822b5 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x17068b,_0x460593){_0x17068b=_0x17068b-0x0;var _0x350666=_0x7a54[_0x17068b];return _0x350666;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7a54,0x106));var _0x47a5=function(_0x3c06ea,_0x50c010){_0x3c06ea=_0x3c06ea-0x0;var _0x93fb5d=_0x7a54[_0x3c06ea];return _0x93fb5d;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 6af88c2..a7c97bd 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 _0xb4c7=['JscriptyAnswerReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x48a044,_0x10e97b){var _0x16c5f8=function(_0x4d33b9){while(--_0x4d33b9){_0x48a044['push'](_0x48a044['shift']());}};_0x16c5f8(++_0x10e97b);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x13004b,_0x3dd330){_0x13004b=_0x13004b-0x0;var _0x3ebad3=_0xb4c7[_0x13004b];return _0x3ebad3;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require('moment');var BPromise=require(_0x7b4c('0x5'));var Mustache=require(_0x7b4c('0x6'));var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require(_0x7b4c('0x9'));var csv=require('to-csv');var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xf'));var querystring=require(_0x7b4c('0x10'));var Papa=require(_0x7b4c('0x11'));var Redis=require(_0x7b4c('0x12'));var authService=require(_0x7b4c('0x13'));var qs=require(_0x7b4c('0x14'));var as=require(_0x7b4c('0x15'));var hardwareService=require(_0x7b4c('0x16'));var logger=require(_0x7b4c('0x17'))(_0x7b4c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x19'));var db=require(_0x7b4c('0x1a'))['db'];function respondWithStatusCode(_0x38656b,_0x1722ad){_0x1722ad=_0x1722ad||0xcc;return function(_0x3e1558){if(_0x3e1558){return _0x38656b[_0x7b4c('0x1b')](_0x1722ad);}return _0x38656b[_0x7b4c('0x1c')](_0x1722ad)[_0x7b4c('0x1d')]();};}function respondWithResult(_0x25b90b,_0x387488){_0x387488=_0x387488||0xc8;return function(_0x593a19){if(_0x593a19){return _0x25b90b[_0x7b4c('0x1c')](_0x387488)[_0x7b4c('0x1e')](_0x593a19);}};}function respondWithFilteredResult(_0xdc71cd,_0x2a0e2f){return function(_0xa0a812){if(_0xa0a812){var _0x2471b3=typeof _0x2a0e2f[_0x7b4c('0x1f')]===_0x7b4c('0x20')&&typeof _0x2a0e2f['limit']===_0x7b4c('0x20');var _0xe71d88=_0xa0a812[_0x7b4c('0x21')];var _0x36c02a=_0x2471b3?0x0:_0x2a0e2f['offset'];var _0x3ce10c=_0x2471b3?_0xa0a812[_0x7b4c('0x21')]:_0x2a0e2f[_0x7b4c('0x1f')]+_0x2a0e2f[_0x7b4c('0x22')];var _0x2d4c72;if(_0x3ce10c>=_0xe71d88){_0x3ce10c=_0xe71d88;_0x2d4c72=0xc8;}else{_0x2d4c72=0xce;}_0xdc71cd[_0x7b4c('0x1c')](_0x2d4c72);return _0xdc71cd[_0x7b4c('0x23')](_0x7b4c('0x24'),_0x36c02a+'-'+_0x3ce10c+'/'+_0xe71d88)[_0x7b4c('0x1e')](_0xa0a812);}return null;};}function patchUpdates(_0x55e3df){return function(_0x1f06ec){try{jsonpatch[_0x7b4c('0x25')](_0x1f06ec,_0x55e3df,!![]);}catch(_0x11996d){return BPromise[_0x7b4c('0x26')](_0x11996d);}return _0x1f06ec[_0x7b4c('0x27')]();};}function saveUpdates(_0x168ac9,_0x176704){return function(_0x3d4826){if(_0x3d4826){return _0x3d4826[_0x7b4c('0x28')](_0x168ac9)[_0x7b4c('0x29')](function(_0x5eec1e){return _0x5eec1e;});}return null;};}function removeEntity(_0x45438c,_0x4350c9){return function(_0x276271){if(_0x276271){return _0x276271[_0x7b4c('0x2a')]()[_0x7b4c('0x29')](function(){_0x45438c[_0x7b4c('0x1c')](0xcc)[_0x7b4c('0x1d')]();});}};}function handleEntityNotFound(_0x459eb4,_0x1f311e){return function(_0x1a69db){if(!_0x1a69db){_0x459eb4[_0x7b4c('0x1b')](0x194);}return _0x1a69db;};}function handleError(_0x257da2,_0x316e5f){_0x316e5f=_0x316e5f||0x1f4;return function(_0x501f75){logger[_0x7b4c('0x2b')](_0x501f75[_0x7b4c('0x2c')]);if(_0x501f75[_0x7b4c('0x2d')]){delete _0x501f75[_0x7b4c('0x2d')];}_0x257da2[_0x7b4c('0x1c')](_0x316e5f)[_0x7b4c('0x2e')](_0x501f75);};}exports[_0x7b4c('0x2f')]=function(_0x2552f9,_0x3e4a46){var _0x9a799b={},_0x3585cd={},_0x130ace={'count':0x0,'rows':[]};var _0x3544bc=_[_0x7b4c('0x30')](db[_0x7b4c('0x31')][_0x7b4c('0x32')],function(_0x1d0724){return{'name':_0x1d0724[_0x7b4c('0x33')],'type':_0x1d0724[_0x7b4c('0x34')]['key']};});_0x3585cd['model']=_['map'](_0x3544bc,_0x7b4c('0x2d'));_0x3585cd[_0x7b4c('0x35')]=_[_0x7b4c('0x36')](_0x2552f9[_0x7b4c('0x35')]);_0x3585cd['filters']=_[_0x7b4c('0x37')](_0x3585cd[_0x7b4c('0x38')],_0x3585cd['query']);_0x9a799b[_0x7b4c('0x39')]=_['intersection'](_0x3585cd[_0x7b4c('0x38')],qs[_0x7b4c('0x3a')](_0x2552f9[_0x7b4c('0x35')]['fields']));_0x9a799b[_0x7b4c('0x39')]=_0x9a799b[_0x7b4c('0x39')]['length']?_0x9a799b[_0x7b4c('0x39')]:_0x3585cd[_0x7b4c('0x38')];if(!_0x2552f9[_0x7b4c('0x35')][_0x7b4c('0x3b')]('nolimit')){_0x9a799b['limit']=qs[_0x7b4c('0x22')](_0x2552f9[_0x7b4c('0x35')]['limit']);_0x9a799b[_0x7b4c('0x1f')]=qs['offset'](_0x2552f9['query'][_0x7b4c('0x1f')]);}_0x9a799b[_0x7b4c('0x3c')]=qs[_0x7b4c('0x3d')](_0x2552f9[_0x7b4c('0x35')]['sort']);_0x9a799b[_0x7b4c('0x3e')]=qs[_0x7b4c('0x3f')](_[_0x7b4c('0x40')](_0x2552f9[_0x7b4c('0x35')],_0x3585cd[_0x7b4c('0x3f')]),_0x3544bc);if(_0x2552f9[_0x7b4c('0x35')][_0x7b4c('0x41')]){_0x9a799b['where']=_['merge'](_0x9a799b[_0x7b4c('0x3e')],{'$or':_[_0x7b4c('0x30')](_0x3544bc,function(_0x31ef1e){if(_0x31ef1e[_0x7b4c('0x34')]!==_0x7b4c('0x42')){var _0x592834={};_0x592834[_0x31ef1e[_0x7b4c('0x2d')]]={'$like':'%'+_0x2552f9[_0x7b4c('0x35')][_0x7b4c('0x41')]+'%'};return _0x592834;}})});}_0x9a799b=_[_0x7b4c('0x43')]({},_0x9a799b,_0x2552f9[_0x7b4c('0x44')]);var _0x25659d={'where':_0x9a799b[_0x7b4c('0x3e')]};return db[_0x7b4c('0x31')][_0x7b4c('0x21')](_0x25659d)['then'](function(_0x2a4085){_0x130ace['count']=_0x2a4085;if(_0x2552f9[_0x7b4c('0x35')]['includeAll']){_0x9a799b[_0x7b4c('0x45')]=[{'all':!![]}];}return db[_0x7b4c('0x31')]['findAll'](_0x9a799b);})['then'](function(_0x354578){_0x130ace[_0x7b4c('0x46')]=_0x354578;return _0x130ace;})[_0x7b4c('0x29')](respondWithFilteredResult(_0x3e4a46,_0x9a799b))[_0x7b4c('0x47')](handleError(_0x3e4a46,null));};exports['show']=function(_0x2b1681,_0x2ed731){var _0x100774={'raw':!![],'where':{'id':_0x2b1681[_0x7b4c('0x48')]['id']}},_0x5d4ed8={};_0x5d4ed8['model']=_['keys'](db[_0x7b4c('0x31')]['rawAttributes']);_0x5d4ed8[_0x7b4c('0x35')]=_[_0x7b4c('0x36')](_0x2b1681[_0x7b4c('0x35')]);_0x5d4ed8[_0x7b4c('0x3f')]=_[_0x7b4c('0x37')](_0x5d4ed8[_0x7b4c('0x38')],_0x5d4ed8[_0x7b4c('0x35')]);_0x100774[_0x7b4c('0x39')]=_[_0x7b4c('0x37')](_0x5d4ed8['model'],qs[_0x7b4c('0x3a')](_0x2b1681['query']['fields']));_0x100774[_0x7b4c('0x39')]=_0x100774[_0x7b4c('0x39')]['length']?_0x100774['attributes']:_0x5d4ed8[_0x7b4c('0x38')];if(_0x2b1681[_0x7b4c('0x35')][_0x7b4c('0x49')]){_0x100774[_0x7b4c('0x45')]=[{'all':!![]}];}_0x100774=_[_0x7b4c('0x43')]({},_0x100774,_0x2b1681[_0x7b4c('0x44')]);return db[_0x7b4c('0x31')][_0x7b4c('0x4a')](_0x100774)['then'](handleEntityNotFound(_0x2ed731,null))[_0x7b4c('0x29')](respondWithResult(_0x2ed731,null))[_0x7b4c('0x47')](handleError(_0x2ed731,null));};exports[_0x7b4c('0x4b')]=function(_0x387efd,_0xc76435){return db[_0x7b4c('0x31')][_0x7b4c('0x4b')](_0x387efd[_0x7b4c('0x4c')],{})[_0x7b4c('0x29')](respondWithResult(_0xc76435,0xc9))['catch'](handleError(_0xc76435,null));};exports['update']=function(_0x1884a4,_0x3f6aaa){if(_0x1884a4[_0x7b4c('0x4c')]['id']){delete _0x1884a4['body']['id'];}return db[_0x7b4c('0x31')][_0x7b4c('0x4a')]({'where':{'id':_0x1884a4['params']['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x3f6aaa,null))['then'](saveUpdates(_0x1884a4[_0x7b4c('0x4c')],null))['then'](respondWithResult(_0x3f6aaa,null))[_0x7b4c('0x47')](handleError(_0x3f6aaa,null));};exports['destroy']=function(_0x15d7f1,_0x11faed){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x15d7f1[_0x7b4c('0x48')]['id']}})[_0x7b4c('0x29')](handleEntityNotFound(_0x11faed,null))[_0x7b4c('0x29')](removeEntity(_0x11faed,null))['catch'](handleError(_0x11faed,null));};exports['describe']=function(_0x2fc5b5,_0x1c118a){return db['JscriptyAnswerReport']['describe']()[_0x7b4c('0x29')](respondWithResult(_0x1c118a,null))[_0x7b4c('0x47')](handleError(_0x1c118a,null));}; \ No newline at end of file +var _0xdded=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','include','findAll','catch','show','params','length','includeAll','merge','options','find','create','body','describe','eml-format','rimraf'];(function(_0x2ca854,_0x2c039c){var _0x5c4d97=function(_0x397dfe){while(--_0x397dfe){_0x2ca854['push'](_0x2ca854['shift']());}};_0x5c4d97(++_0x2c039c);}(_0xdded,0x17a));var _0xddde=function(_0x24e0c2,_0x4af47b){_0x24e0c2=_0x24e0c2-0x0;var _0x7e1484=_0xdded[_0x24e0c2];return _0x7e1484;};'use strict';var emlformat=require(_0xddde('0x0'));var rimraf=require(_0xddde('0x1'));var zipdir=require(_0xddde('0x2'));var jsonpatch=require(_0xddde('0x3'));var rp=require(_0xddde('0x4'));var moment=require(_0xddde('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddde('0x6'));var util=require(_0xddde('0x7'));var path=require(_0xddde('0x8'));var sox=require(_0xddde('0x9'));var csv=require(_0xddde('0xa'));var ejs=require(_0xddde('0xb'));var fs=require('fs');var fs_extra=require(_0xddde('0xc'));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('0xa'));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=typeof _0x3698d4[_0xddde('0x1d')]==='undefined'&&typeof _0x3698d4[_0xddde('0x1e')]===_0xddde('0x1f');var _0x338fa7=_0x48f602[_0xddde('0x20')];var _0x2f0e58=_0x5de7ce?0x0:_0x3698d4['offset'];var _0x249f19=_0x5de7ce?_0x48f602[_0xddde('0x20')]:_0x3698d4['offset']+_0x3698d4[_0xddde('0x1e')];var _0x1185f9;if(_0x249f19>=_0x338fa7){_0x249f19=_0x338fa7;_0x1185f9=0xc8;}else{_0x1185f9=0xce;}_0xbe1df5['status'](_0x1185f9);return _0xbe1df5['set'](_0xddde('0x21'),_0x2f0e58+'-'+_0x249f19+'/'+_0x338fa7)['json'](_0x48f602);}return null;};}function patchUpdates(_0x1ef35a){return function(_0x5175bd){try{jsonpatch[_0xddde('0x22')](_0x5175bd,_0x1ef35a,!![]);}catch(_0xea045b){return BPromise['reject'](_0xea045b);}return _0x5175bd['save']();};}function saveUpdates(_0x3cfd91,_0x107bca){return function(_0x97bb0f){if(_0x97bb0f){return _0x97bb0f[_0xddde('0x23')](_0x3cfd91)[_0xddde('0x24')](function(_0xa663e4){return _0xa663e4;});}return null;};}function removeEntity(_0x3bc4bf,_0x56a33a){return function(_0x59320f){if(_0x59320f){return _0x59320f[_0xddde('0x25')]()[_0xddde('0x24')](function(){_0x3bc4bf[_0xddde('0x1a')](0xcc)[_0xddde('0x1b')]();});}};}function handleEntityNotFound(_0xdb57ef,_0x533332){return function(_0x394da0){if(!_0x394da0){_0xdb57ef[_0xddde('0x19')](0x194);}return _0x394da0;};}function handleError(_0x4ca351,_0x4bd409){_0x4bd409=_0x4bd409||0x1f4;return function(_0xa60e85){logger[_0xddde('0x26')](_0xa60e85['stack']);if(_0xa60e85[_0xddde('0x27')]){delete _0xa60e85[_0xddde('0x27')];}_0x4ca351['status'](_0x4bd409)[_0xddde('0x28')](_0xa60e85);};}exports[_0xddde('0x29')]=function(_0x2dd131,_0x32be0f){var _0x477d44={},_0xb5d4b6={},_0x450bac={'count':0x0,'rows':[]};var _0x7c0c18=_[_0xddde('0x2a')](db[_0xddde('0x2b')][_0xddde('0x2c')],function(_0x1ff3e2){return{'name':_0x1ff3e2[_0xddde('0x2d')],'type':_0x1ff3e2[_0xddde('0x2e')][_0xddde('0x2f')]};});_0xb5d4b6[_0xddde('0x30')]=_[_0xddde('0x2a')](_0x7c0c18,_0xddde('0x27'));_0xb5d4b6[_0xddde('0x31')]=_[_0xddde('0x32')](_0x2dd131['query']);_0xb5d4b6['filters']=_[_0xddde('0x33')](_0xb5d4b6[_0xddde('0x30')],_0xb5d4b6[_0xddde('0x31')]);_0x477d44['attributes']=_['intersection'](_0xb5d4b6[_0xddde('0x30')],qs[_0xddde('0x34')](_0x2dd131[_0xddde('0x31')][_0xddde('0x34')]));_0x477d44['attributes']=_0x477d44[_0xddde('0x35')]['length']?_0x477d44[_0xddde('0x35')]:_0xb5d4b6[_0xddde('0x30')];if(!_0x2dd131[_0xddde('0x31')][_0xddde('0x36')](_0xddde('0x37'))){_0x477d44[_0xddde('0x1e')]=qs[_0xddde('0x1e')](_0x2dd131[_0xddde('0x31')][_0xddde('0x1e')]);_0x477d44[_0xddde('0x1d')]=qs[_0xddde('0x1d')](_0x2dd131[_0xddde('0x31')]['offset']);}_0x477d44[_0xddde('0x38')]=qs[_0xddde('0x39')](_0x2dd131['query']['sort']);_0x477d44['where']=qs[_0xddde('0x3a')](_[_0xddde('0x3b')](_0x2dd131[_0xddde('0x31')],_0xb5d4b6[_0xddde('0x3a')]),_0x7c0c18);if(_0x2dd131[_0xddde('0x31')][_0xddde('0x3c')]){_0x477d44[_0xddde('0x3d')]=_['merge'](_0x477d44['where'],{'$or':_[_0xddde('0x2a')](_0x7c0c18,function(_0x5595a7){if(_0x5595a7[_0xddde('0x2e')]!==_0xddde('0x3e')){var _0x4c356a={};_0x4c356a[_0x5595a7[_0xddde('0x27')]]={'$like':'%'+_0x2dd131[_0xddde('0x31')][_0xddde('0x3c')]+'%'};return _0x4c356a;}})});}_0x477d44=_['merge']({},_0x477d44,_0x2dd131['options']);var _0x434868={'where':_0x477d44['where']};return db[_0xddde('0x2b')][_0xddde('0x20')](_0x434868)[_0xddde('0x24')](function(_0x216b12){_0x450bac[_0xddde('0x20')]=_0x216b12;if(_0x2dd131[_0xddde('0x31')]['includeAll']){_0x477d44[_0xddde('0x3f')]=[{'all':!![]}];}return db[_0xddde('0x2b')][_0xddde('0x40')](_0x477d44);})[_0xddde('0x24')](function(_0x10d9d3){_0x450bac['rows']=_0x10d9d3;return _0x450bac;})[_0xddde('0x24')](respondWithFilteredResult(_0x32be0f,_0x477d44))[_0xddde('0x41')](handleError(_0x32be0f,null));};exports[_0xddde('0x42')]=function(_0x3a52b5,_0x21b469){var _0xb0c016={'raw':!![],'where':{'id':_0x3a52b5[_0xddde('0x43')]['id']}},_0x6cbadb={};_0x6cbadb[_0xddde('0x30')]=_['keys'](db[_0xddde('0x2b')]['rawAttributes']);_0x6cbadb[_0xddde('0x31')]=_[_0xddde('0x32')](_0x3a52b5['query']);_0x6cbadb[_0xddde('0x3a')]=_[_0xddde('0x33')](_0x6cbadb[_0xddde('0x30')],_0x6cbadb['query']);_0xb0c016['attributes']=_['intersection'](_0x6cbadb[_0xddde('0x30')],qs[_0xddde('0x34')](_0x3a52b5[_0xddde('0x31')][_0xddde('0x34')]));_0xb0c016['attributes']=_0xb0c016[_0xddde('0x35')][_0xddde('0x44')]?_0xb0c016[_0xddde('0x35')]:_0x6cbadb['model'];if(_0x3a52b5[_0xddde('0x31')][_0xddde('0x45')]){_0xb0c016[_0xddde('0x3f')]=[{'all':!![]}];}_0xb0c016=_[_0xddde('0x46')]({},_0xb0c016,_0x3a52b5[_0xddde('0x47')]);return db['JscriptyAnswerReport'][_0xddde('0x48')](_0xb0c016)['then'](handleEntityNotFound(_0x21b469,null))[_0xddde('0x24')](respondWithResult(_0x21b469,null))['catch'](handleError(_0x21b469,null));};exports[_0xddde('0x49')]=function(_0x3c3c6c,_0x1db505){return db[_0xddde('0x2b')][_0xddde('0x49')](_0x3c3c6c[_0xddde('0x4a')],{})[_0xddde('0x24')](respondWithResult(_0x1db505,0xc9))[_0xddde('0x41')](handleError(_0x1db505,null));};exports['update']=function(_0x3ad9b6,_0x1b4a00){if(_0x3ad9b6[_0xddde('0x4a')]['id']){delete _0x3ad9b6[_0xddde('0x4a')]['id'];}return db[_0xddde('0x2b')][_0xddde('0x48')]({'where':{'id':_0x3ad9b6['params']['id']}})[_0xddde('0x24')](handleEntityNotFound(_0x1b4a00,null))[_0xddde('0x24')](saveUpdates(_0x3ad9b6[_0xddde('0x4a')],null))[_0xddde('0x24')](respondWithResult(_0x1b4a00,null))[_0xddde('0x41')](handleError(_0x1b4a00,null));};exports['destroy']=function(_0x2a8537,_0x42a325){return db[_0xddde('0x2b')][_0xddde('0x48')]({'where':{'id':_0x2a8537[_0xddde('0x43')]['id']}})[_0xddde('0x24')](handleEntityNotFound(_0x42a325,null))[_0xddde('0x24')](removeEntity(_0x42a325,null))[_0xddde('0x41')](handleError(_0x42a325,null));};exports[_0xddde('0x4b')]=function(_0xff548d,_0x43fcf6){return db[_0xddde('0x2b')][_0xddde('0x4b')]()[_0xddde('0x24')](respondWithResult(_0x43fcf6,null))[_0xddde('0x41')](handleError(_0x43fcf6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index c3d8785..eb354f7 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 _0xa9ff=['bluebird','request-promise','path','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','util','api','moment'];(function(_0x21a764,_0x27ea83){var _0x23c0a1=function(_0x25a6c7){while(--_0x25a6c7){_0x21a764['push'](_0x21a764['shift']());}};_0x23c0a1(++_0x27ea83);}(_0xa9ff,0x1ec));var _0xfa9f=function(_0x5b989e,_0x4e28f9){_0x5b989e=_0x5b989e-0x0;var _0x36f054=_0xa9ff[_0x5b989e];return _0x36f054;};'use strict';var _=require('lodash');var util=require(_0xfa9f('0x0'));var logger=require('../../config/logger')(_0xfa9f('0x1'));var moment=require(_0xfa9f('0x2'));var BPromise=require(_0xfa9f('0x3'));var rp=require(_0xfa9f('0x4'));var fs=require('fs');var path=require(_0xfa9f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa9f('0x6'));module['exports']=function(_0x424e25,_0x13f8dd){return _0x424e25['define'](_0xfa9f('0x7'),attributes,{'tableName':_0xfa9f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9904=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x359059,_0x29503b){var _0x4a4ba4=function(_0x1c5d1f){while(--_0x1c5d1f){_0x359059['push'](_0x359059['shift']());}};_0x4a4ba4(++_0x29503b);}(_0x9904,0xb8));var _0x4990=function(_0x5380c5,_0x5bc69f){_0x5380c5=_0x5380c5-0x0;var _0x32c4a6=_0x9904[_0x5380c5];return _0x32c4a6;};'use strict';var _=require(_0x4990('0x0'));var util=require(_0x4990('0x1'));var logger=require(_0x4990('0x2'))(_0x4990('0x3'));var moment=require('moment');var BPromise=require(_0x4990('0x4'));var rp=require(_0x4990('0x5'));var fs=require('fs');var path=require(_0x4990('0x6'));var rimraf=require('rimraf');var config=require(_0x4990('0x7'));var attributes=require(_0x4990('0x8'));module[_0x4990('0x9')]=function(_0x2f35d3,_0xfe370a){return _0x2f35d3[_0x4990('0xa')](_0x4990('0xb'),attributes,{'tableName':_0x4990('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 8cf4bf3..b7a9fa9 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 _0xeee8=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4c97be,_0x4d9a65){var _0x39bd2e=function(_0x497769){while(--_0x497769){_0x4c97be['push'](_0x4c97be['shift']());}};_0x39bd2e(++_0x4d9a65);}(_0xeee8,0x102));var _0x8eee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeee8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8eee('0x0'));var util=require(_0x8eee('0x1'));var moment=require(_0x8eee('0x2'));var BPromise=require(_0x8eee('0x3'));var rs=require(_0x8eee('0x4'));var fs=require('fs');var Redis=require(_0x8eee('0x5'));var db=require(_0x8eee('0x6'))['db'];var utils=require(_0x8eee('0x7'));var logger=require('../../config/logger')(_0x8eee('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8eee('0x9')][_0x8eee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x850769,_0x31334f,_0x24122e){return new BPromise(function(_0x48e57e,_0xd63f1){return client[_0x8eee('0xb')](_0x850769,_0x24122e)[_0x8eee('0xc')](function(_0x4ed460){logger['info'](_0x8eee('0xd'),_0x31334f,_0x8eee('0xe'));logger[_0x8eee('0xf')](_0x8eee('0x10'),_0x31334f,_0x8eee('0xe'),JSON['stringify'](_0x4ed460));if(_0x4ed460[_0x8eee('0x11')]){if(_0x4ed460[_0x8eee('0x11')]['code']===0x1f4){logger[_0x8eee('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x31334f,_0x4ed460['error'][_0x8eee('0x12')]);return _0xd63f1(_0x4ed460['error'][_0x8eee('0x12')]);}logger['error'](_0x8eee('0xd'),_0x31334f,_0x4ed460[_0x8eee('0x11')][_0x8eee('0x12')]);return _0x48e57e(_0x4ed460[_0x8eee('0x11')][_0x8eee('0x12')]);}else{logger[_0x8eee('0x13')](_0x8eee('0xd'),_0x31334f,'request\x20sent');_0x48e57e(_0x4ed460[_0x8eee('0x14')][_0x8eee('0x12')]);}})['catch'](function(_0x439c45){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x31334f,_0x439c45);_0xd63f1(_0x439c45);});});} \ No newline at end of file +var _0x2c65=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0x2c65,0xd1));var _0x52c6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2c65[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x52c6('0x0'));var util=require(_0x52c6('0x1'));var moment=require(_0x52c6('0x2'));var BPromise=require(_0x52c6('0x3'));var rs=require(_0x52c6('0x4'));var fs=require('fs');var Redis=require(_0x52c6('0x5'));var db=require(_0x52c6('0x6'))['db'];var utils=require(_0x52c6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x52c6('0x8'));var jayson=require(_0x52c6('0x9'));var client=jayson['client'][_0x52c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4761b3,_0x3448e0,_0x4c2c03){return new BPromise(function(_0x271700,_0x8ccf57){return client[_0x52c6('0xb')](_0x4761b3,_0x4c2c03)[_0x52c6('0xc')](function(_0x23ca5e){logger[_0x52c6('0xd')](_0x52c6('0xe'),_0x3448e0,'request\x20sent');logger['debug'](_0x52c6('0xf'),_0x3448e0,_0x52c6('0x10'),JSON['stringify'](_0x23ca5e));if(_0x23ca5e[_0x52c6('0x11')]){if(_0x23ca5e[_0x52c6('0x11')][_0x52c6('0x12')]===0x1f4){logger[_0x52c6('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3448e0,_0x23ca5e[_0x52c6('0x11')][_0x52c6('0x13')]);return _0x8ccf57(_0x23ca5e[_0x52c6('0x11')][_0x52c6('0x13')]);}logger['error'](_0x52c6('0xe'),_0x3448e0,_0x23ca5e['error']['message']);return _0x271700(_0x23ca5e[_0x52c6('0x11')][_0x52c6('0x13')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3448e0,_0x52c6('0x10'));_0x271700(_0x23ca5e[_0x52c6('0x14')][_0x52c6('0x13')]);}})[_0x52c6('0x15')](function(_0x1e61e4){logger[_0x52c6('0x11')](_0x52c6('0xe'),_0x3448e0,_0x1e61e4);_0x8ccf57(_0x1e61e4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 32a9c0b..1c9fa4a 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 _0x8216=['../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','/:id/clone','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x480b5d,_0xeb6e39){var _0x11ae70=function(_0x4e3bc8){while(--_0x4e3bc8){_0x480b5d['push'](_0x480b5d['shift']());}};_0x11ae70(++_0xeb6e39);}(_0x8216,0x1f1));var _0x6821=function(_0x31761a,_0x46fb49){_0x31761a=_0x31761a-0x0;var _0x1e8402=_0x8216[_0x31761a];return _0x1e8402;};'use strict';var multer=require(_0x6821('0x0'));var util=require('util');var path=require(_0x6821('0x1'));var timeout=require(_0x6821('0x2'));var express=require(_0x6821('0x3'));var router=express[_0x6821('0x4')]();var fs_extra=require(_0x6821('0x5'));var auth=require(_0x6821('0x6'));var interaction=require(_0x6821('0x7'));var config=require('../../config/environment');var controller=require(_0x6821('0x8'));router[_0x6821('0x9')]('/',auth[_0x6821('0xa')](),controller[_0x6821('0xb')]);router[_0x6821('0x9')](_0x6821('0xc'),auth[_0x6821('0xa')](),controller[_0x6821('0xd')]);router[_0x6821('0x9')](_0x6821('0xe'),auth[_0x6821('0xa')](),controller[_0x6821('0xf')]);router[_0x6821('0x9')](_0x6821('0x10'),auth[_0x6821('0xa')](),controller[_0x6821('0x11')]);router[_0x6821('0x9')](_0x6821('0x12'),auth[_0x6821('0xa')](),timeout('30s'),controller[_0x6821('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6821('0x14'),auth[_0x6821('0xa')](),controller['clone']);router['put'](_0x6821('0xc'),auth[_0x6821('0xa')](),controller[_0x6821('0x15')]);router[_0x6821('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x6821('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5ba8=['put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','create','post','/:id/clone','clone'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x5ba8,0x16b));var _0x85ba=function(_0x3d3870,_0x5bc14){_0x3d3870=_0x3d3870-0x0;var _0x47df13=_0x5ba8[_0x3d3870];return _0x47df13;};'use strict';var multer=require(_0x85ba('0x0'));var util=require(_0x85ba('0x1'));var path=require('path');var timeout=require(_0x85ba('0x2'));var express=require(_0x85ba('0x3'));var router=express['Router']();var fs_extra=require(_0x85ba('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x85ba('0x5'));var config=require(_0x85ba('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x85ba('0x7')](),controller[_0x85ba('0x8')]);router[_0x85ba('0x9')](_0x85ba('0xa'),auth[_0x85ba('0x7')](),controller[_0x85ba('0xb')]);router[_0x85ba('0x9')](_0x85ba('0xc'),auth['isAuthenticated'](),controller[_0x85ba('0xd')]);router['get']('/:id/answers',auth[_0x85ba('0x7')](),controller[_0x85ba('0xe')]);router[_0x85ba('0x9')](_0x85ba('0xf'),auth[_0x85ba('0x7')](),timeout(_0x85ba('0x10')),controller['getSummary']);router['post']('/',auth[_0x85ba('0x7')](),controller[_0x85ba('0x11')]);router[_0x85ba('0x12')](_0x85ba('0x13'),auth[_0x85ba('0x7')](),controller[_0x85ba('0x14')]);router[_0x85ba('0x15')](_0x85ba('0xa'),auth[_0x85ba('0x7')](),controller[_0x85ba('0x16')]);router['delete'](_0x85ba('0xa'),auth[_0x85ba('0x7')](),controller['destroy']);module[_0x85ba('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index cfd6cc2..956b384 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 _0xeb05=['description','BOOLEAN','util','exports','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name'];(function(_0x2859f9,_0x55c196){var _0x1b6067=function(_0xc8c39){while(--_0xc8c39){_0x2859f9['push'](_0x2859f9['shift']());}};_0x1b6067(++_0x55c196);}(_0xeb05,0x1b5));var _0x5eb0=function(_0x2af99b,_0x20b53b){_0x2af99b=_0x2af99b-0x0;var _0x1b5d77=_0xeb05[_0x2af99b];return _0x1b5d77;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x5eb0('0x0'));module[_0x5eb0('0x1')]={'name':{'type':Sequelize[_0x5eb0('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x5eb0('0x2')]},'formData':{'type':Sequelize[_0x5eb0('0x3')](_0x5eb0('0x4')),'set':function(_0x5efea3){if(_[_0x5eb0('0x5')](_0x5efea3)){this[_0x5eb0('0x6')](_0x5eb0('0x7'),JSON[_0x5eb0('0x8')](_0x5efea3));}else if(_[_0x5eb0('0x9')](_0x5efea3)){this[_0x5eb0('0x6')](_0x5eb0('0x7'),_0x5efea3);}else{this[_0x5eb0('0x6')]('formData',util['format'](_0x5eb0('0xa'),this[_0x5eb0('0xb')](_0x5eb0('0xc'))||'',this['getDataValue'](_0x5eb0('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5eb0('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5eb0('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xe1e7=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','exports','STRING','name','long','formData','stringify','isString','setDataValue','format'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xe1e7,0x163));var _0x7e1e=function(_0x4b4204,_0x177efa){_0x4b4204=_0x4b4204-0x0;var _0x591f75=_0xe1e7[_0x4b4204];return _0x591f75;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require('util');module[_0x7e1e('0x0')]={'name':{'type':Sequelize[_0x7e1e('0x1')],'unique':_0x7e1e('0x2')},'description':{'type':Sequelize[_0x7e1e('0x1')]},'formData':{'type':Sequelize['TEXT'](_0x7e1e('0x3')),'set':function(_0x11a3f3){if(_['isObjectLike'](_0x11a3f3)){this['setDataValue'](_0x7e1e('0x4'),JSON[_0x7e1e('0x5')](_0x11a3f3));}else if(_[_0x7e1e('0x6')](_0x11a3f3)){this[_0x7e1e('0x7')](_0x7e1e('0x4'),_0x11a3f3);}else{this['setDataValue'](_0x7e1e('0x4'),util[_0x7e1e('0x8')](_0x7e1e('0x9'),this[_0x7e1e('0xa')]('name')||'',this[_0x7e1e('0xa')](_0x7e1e('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7e1e('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7e1e('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 8c71924..34429fb 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 _0xffda=['download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','error','stack','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','includeAll','include','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','body','omit','updatedAt','getSessions','findOne','keys','JscriptySessionReport','getAnswers','JscriptyAnswerReport','indexOf','toString','replace','getSummary','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type'];(function(_0x4fb18d,_0x2a524d){var _0x5d2258=function(_0x2c75a0){while(--_0x2c75a0){_0x4fb18d['push'](_0x4fb18d['shift']());}};_0x5d2258(++_0x2a524d);}(_0xffda,0x73));var _0xaffd=function(_0x24c8fb,_0x53daa4){_0x24c8fb=_0x24c8fb-0x0;var _0x49337f=_0xffda[_0x24c8fb];return _0x49337f;};'use strict';var emlformat=require(_0xaffd('0x0'));var rimraf=require(_0xaffd('0x1'));var zipdir=require(_0xaffd('0x2'));var jsonpatch=require(_0xaffd('0x3'));var rp=require('request-promise');var moment=require(_0xaffd('0x4'));var BPromise=require(_0xaffd('0x5'));var Mustache=require(_0xaffd('0x6'));var util=require('util');var path=require(_0xaffd('0x7'));var sox=require('sox');var csv=require(_0xaffd('0x8'));var ejs=require(_0xaffd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaffd('0xa'));var crypto=require(_0xaffd('0xb'));var jsforce=require(_0xaffd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaffd('0x8'));var querystring=require(_0xaffd('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaffd('0xe'));var qs=require(_0xaffd('0xf'));var as=require(_0xaffd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaffd('0x11'))(_0xaffd('0x12'));var utils=require('../../config/utils');var config=require(_0xaffd('0x13'));var licenseUtil=require(_0xaffd('0x14'));var db=require(_0xaffd('0x15'))['db'];function respondWithStatusCode(_0x270b2e,_0x144652){_0x144652=_0x144652||0xcc;return function(_0x5e5c2b){if(_0x5e5c2b){return _0x270b2e[_0xaffd('0x16')](_0x144652);}return _0x270b2e['status'](_0x144652)['end']();};}function respondWithResult(_0x4549a2,_0x2da32c){_0x2da32c=_0x2da32c||0xc8;return function(_0x1be095){if(_0x1be095){return _0x4549a2['status'](_0x2da32c)[_0xaffd('0x17')](_0x1be095);}};}function respondWithFilteredResult(_0x35ebc6,_0x14caba){return function(_0x2de573){if(_0x2de573){var _0x1557bf=typeof _0x14caba[_0xaffd('0x18')]===_0xaffd('0x19')&&typeof _0x14caba[_0xaffd('0x1a')]==='undefined';var _0x71699a=_0x2de573[_0xaffd('0x1b')];var _0x421507=_0x1557bf?0x0:_0x14caba[_0xaffd('0x18')];var _0x257c0c=_0x1557bf?_0x2de573[_0xaffd('0x1b')]:_0x14caba['offset']+_0x14caba['limit'];var _0x56cbb0;if(_0x257c0c>=_0x71699a){_0x257c0c=_0x71699a;_0x56cbb0=0xc8;}else{_0x56cbb0=0xce;}_0x35ebc6[_0xaffd('0x1c')](_0x56cbb0);return _0x35ebc6[_0xaffd('0x1d')]('Content-Range',_0x421507+'-'+_0x257c0c+'/'+_0x71699a)[_0xaffd('0x17')](_0x2de573);}return null;};}function patchUpdates(_0x1055df){return function(_0x1b4ad1){try{jsonpatch[_0xaffd('0x1e')](_0x1b4ad1,_0x1055df,!![]);}catch(_0x2c8f9c){return BPromise[_0xaffd('0x1f')](_0x2c8f9c);}return _0x1b4ad1[_0xaffd('0x20')]();};}function saveUpdates(_0x1a7fe3,_0x449419){return function(_0xe9a941){if(_0xe9a941){return _0xe9a941[_0xaffd('0x21')](_0x1a7fe3)[_0xaffd('0x22')](function(_0x42b1a2){return _0x42b1a2;});}return null;};}function removeEntity(_0x180cea,_0xa29103){return function(_0x1aa1db){if(_0x1aa1db){return _0x1aa1db[_0xaffd('0x23')]()[_0xaffd('0x22')](function(){var _0x4f7d0f=_0x1aa1db[_0xaffd('0x24')]({'plain':!![]});var _0x216367=_0xaffd('0x25');return db[_0xaffd('0x26')][_0xaffd('0x23')]({'where':{'type':_0x216367,'resourceId':_0x4f7d0f['id']}})[_0xaffd('0x22')](function(){return _0x1aa1db;});})[_0xaffd('0x22')](function(){_0x180cea[_0xaffd('0x1c')](0xcc)[_0xaffd('0x27')]();});}};}function handleEntityNotFound(_0x59ac3f,_0x2ae708){return function(_0x5a043f){if(!_0x5a043f){_0x59ac3f['sendStatus'](0x194);}return _0x5a043f;};}function handleError(_0x1f4da9,_0x4b4d7e){_0x4b4d7e=_0x4b4d7e||0x1f4;return function(_0x1d1f1e){logger[_0xaffd('0x28')](_0x1d1f1e[_0xaffd('0x29')]);if(_0x1d1f1e['name']){delete _0x1d1f1e[_0xaffd('0x2a')];}_0x1f4da9[_0xaffd('0x1c')](_0x4b4d7e)[_0xaffd('0x2b')](_0x1d1f1e);};}exports[_0xaffd('0x2c')]=function(_0xa4f13,_0x562812){var _0x4ef464={},_0x1efc3b={},_0x55eab1={'count':0x0,'rows':[]};var _0x939c85=_[_0xaffd('0x2d')](db[_0xaffd('0x2e')]['rawAttributes'],function(_0x80fcc6){return{'name':_0x80fcc6[_0xaffd('0x2f')],'type':_0x80fcc6[_0xaffd('0x30')][_0xaffd('0x31')]};});_0x1efc3b[_0xaffd('0x32')]=_[_0xaffd('0x2d')](_0x939c85,_0xaffd('0x2a'));_0x1efc3b[_0xaffd('0x33')]=_['keys'](_0xa4f13[_0xaffd('0x33')]);_0x1efc3b['filters']=_['intersection'](_0x1efc3b[_0xaffd('0x32')],_0x1efc3b[_0xaffd('0x33')]);_0x4ef464['attributes']=_[_0xaffd('0x34')](_0x1efc3b['model'],qs[_0xaffd('0x35')](_0xa4f13[_0xaffd('0x33')][_0xaffd('0x35')]));_0x4ef464[_0xaffd('0x36')]=_0x4ef464[_0xaffd('0x36')][_0xaffd('0x37')]?_0x4ef464[_0xaffd('0x36')]:_0x1efc3b[_0xaffd('0x32')];if(!_0xa4f13['query'][_0xaffd('0x38')](_0xaffd('0x39'))){_0x4ef464[_0xaffd('0x1a')]=qs[_0xaffd('0x1a')](_0xa4f13[_0xaffd('0x33')]['limit']);_0x4ef464[_0xaffd('0x18')]=qs[_0xaffd('0x18')](_0xa4f13[_0xaffd('0x33')][_0xaffd('0x18')]);}_0x4ef464[_0xaffd('0x3a')]=qs[_0xaffd('0x3b')](_0xa4f13[_0xaffd('0x33')]['sort']);_0x4ef464[_0xaffd('0x3c')]=qs[_0xaffd('0x3d')](_[_0xaffd('0x3e')](_0xa4f13[_0xaffd('0x33')],_0x1efc3b[_0xaffd('0x3d')]),_0x939c85);if(_0xa4f13['query'][_0xaffd('0x3f')]){_0x4ef464[_0xaffd('0x3c')]=_['merge'](_0x4ef464[_0xaffd('0x3c')],{'$or':_[_0xaffd('0x2d')](_0x939c85,function(_0x203bf6){if(_0x203bf6[_0xaffd('0x30')]!==_0xaffd('0x40')){var _0x360b7f={};_0x360b7f[_0x203bf6['name']]={'$like':'%'+_0xa4f13['query'][_0xaffd('0x3f')]+'%'};return _0x360b7f;}})});}_0x4ef464=_['merge']({},_0x4ef464,_0xa4f13[_0xaffd('0x41')]);var _0x52fcb6={'where':_0x4ef464[_0xaffd('0x3c')]};return db[_0xaffd('0x2e')][_0xaffd('0x1b')](_0x52fcb6)[_0xaffd('0x22')](function(_0x13fb86){_0x55eab1['count']=_0x13fb86;if(_0xa4f13['query']['includeAll']){_0x4ef464['include']=[{'all':!![]}];}return db[_0xaffd('0x2e')][_0xaffd('0x42')](_0x4ef464);})['then'](function(_0x5b8f43){_0x55eab1[_0xaffd('0x43')]=_0x5b8f43;return _0x55eab1;})['then'](respondWithFilteredResult(_0x562812,_0x4ef464))[_0xaffd('0x44')](handleError(_0x562812,null));};exports[_0xaffd('0x45')]=function(_0x4409e4,_0x96588b){var _0x2c3cb7={'raw':![],'where':{'id':_0x4409e4['params']['id']}},_0x119659={};_0x119659[_0xaffd('0x32')]=_['keys'](db[_0xaffd('0x2e')][_0xaffd('0x46')]);_0x119659['query']=_['keys'](_0x4409e4[_0xaffd('0x33')]);_0x119659['filters']=_[_0xaffd('0x34')](_0x119659[_0xaffd('0x32')],_0x119659[_0xaffd('0x33')]);_0x2c3cb7['attributes']=_[_0xaffd('0x34')](_0x119659[_0xaffd('0x32')],qs[_0xaffd('0x35')](_0x4409e4[_0xaffd('0x33')]['fields']));_0x2c3cb7[_0xaffd('0x36')]=_0x2c3cb7[_0xaffd('0x36')][_0xaffd('0x37')]?_0x2c3cb7['attributes']:_0x119659['model'];if(_0x4409e4[_0xaffd('0x33')][_0xaffd('0x47')]){_0x2c3cb7[_0xaffd('0x48')]=[{'all':!![]}];}_0x2c3cb7=_[_0xaffd('0x49')]({},_0x2c3cb7,_0x4409e4['options']);return db['JscriptyProject'][_0xaffd('0x4a')](_0x2c3cb7)[_0xaffd('0x22')](handleEntityNotFound(_0x96588b,null))[_0xaffd('0x22')](respondWithResult(_0x96588b,null))[_0xaffd('0x44')](handleError(_0x96588b,null));};exports[_0xaffd('0x4b')]=function(_0x46dc61,_0x38e3a1){return db['JscriptyProject'][_0xaffd('0x4b')](_0x46dc61['body'],{})['then'](function(_0x165a31){var _0x703c85=_0x46dc61[_0xaffd('0x4c')]['get']({'plain':!![]});if(!_0x703c85)throw new Error(_0xaffd('0x4d'));if(_0x703c85['role']==='user'){var _0x158b08=_0x165a31['get']({'plain':!![]});var _0x3dda42='Projects';return db[_0xaffd('0x4e')][_0xaffd('0x4a')]({'where':{'name':_0x3dda42,'userProfileId':_0x703c85[_0xaffd('0x4f')]},'raw':!![]})[_0xaffd('0x22')](function(_0x16f24d){if(_0x16f24d&&_0x16f24d[_0xaffd('0x50')]===0x0){return db[_0xaffd('0x26')][_0xaffd('0x4b')]({'name':_0x158b08['name'],'resourceId':_0x158b08['id'],'type':_0x16f24d[_0xaffd('0x2a')],'sectionId':_0x16f24d['id']},{})[_0xaffd('0x22')](function(){return _0x165a31;});}else{return _0x165a31;}})['catch'](function(_0x4bf2a0){logger[_0xaffd('0x28')](_0xaffd('0x51'),_0x4bf2a0);throw _0x4bf2a0;});}return _0x165a31;})['then'](respondWithResult(_0x38e3a1,0xc9))['catch'](handleError(_0x38e3a1,null));};exports[_0xaffd('0x52')]=function(_0x1ed070,_0x12e0c3){var _0x23ba02={'where':{'id':_0x1ed070[_0xaffd('0x53')]['id']}},_0x555aad={};_0x555aad['model']=_['keys'](db[_0xaffd('0x2e')][_0xaffd('0x46')]);_0x23ba02[_0xaffd('0x36')]=_[_0xaffd('0x34')](_0x555aad[_0xaffd('0x32')],qs[_0xaffd('0x35')](_0x1ed070[_0xaffd('0x33')]['fields']));_0x23ba02[_0xaffd('0x36')]=_0x23ba02[_0xaffd('0x36')][_0xaffd('0x37')]?_0x23ba02['attributes']:_0x555aad[_0xaffd('0x32')];if(_0x1ed070[_0xaffd('0x33')][_0xaffd('0x47')]){_0x23ba02['include']=[{'all':!![]}];}_0x23ba02=_[_0xaffd('0x49')]({},_0x23ba02,_0x1ed070[_0xaffd('0x41')]);return db[_0xaffd('0x2e')]['find'](_0x23ba02)['then'](handleEntityNotFound(_0x12e0c3,null))[_0xaffd('0x22')](function(_0x347701){if(_0x347701){var _0x5bd0b5=_0x347701[_0xaffd('0x24')]({'plain':!![]});_0x5bd0b5=qs['omit'](_0x5bd0b5,['id',_0xaffd('0x54'),'updatedAt']);_0x1ed070[_0xaffd('0x55')]=_[_0xaffd('0x56')](_0x1ed070[_0xaffd('0x55')],['id','createdAt',_0xaffd('0x57')]);return db['JscriptyProject']['create'](_[_0xaffd('0x49')](_0x5bd0b5,_0x1ed070[_0xaffd('0x55')]),{'include':_0x1ed070['query'][_0xaffd('0x47')]?[{'all':!![]}]:undefined})[_0xaffd('0x22')](function(_0x3e6efb){var _0x5dfebc=_0x1ed070[_0xaffd('0x4c')]['get']({'plain':!![]});if(!_0x5dfebc)throw new Error(_0xaffd('0x4d'));if(_0x5dfebc['role']==='user'){var _0x1f210b=_0x3e6efb[_0xaffd('0x24')]({'plain':!![]});var _0x574194=_0xaffd('0x25');return db[_0xaffd('0x4e')][_0xaffd('0x4a')]({'where':{'name':_0x574194,'userProfileId':_0x5dfebc[_0xaffd('0x4f')]},'raw':!![]})[_0xaffd('0x22')](function(_0x347cd4){if(_0x347cd4&&_0x347cd4[_0xaffd('0x50')]===0x0){return db[_0xaffd('0x26')]['create']({'name':_0x1f210b['name'],'resourceId':_0x1f210b['id'],'type':_0x347cd4[_0xaffd('0x2a')],'sectionId':_0x347cd4['id']},{})[_0xaffd('0x22')](function(){return _0x3e6efb;});}else{return _0x3e6efb;}})[_0xaffd('0x44')](function(_0x19b609){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19b609);throw _0x19b609;});}return _0x3e6efb;});}})[_0xaffd('0x22')](respondWithResult(_0x12e0c3,0xc9))[_0xaffd('0x44')](handleError(_0x12e0c3,null));};exports[_0xaffd('0x21')]=function(_0x2ccfbb,_0x36b22f){if(_0x2ccfbb['body']['id']){delete _0x2ccfbb[_0xaffd('0x55')]['id'];}return db[_0xaffd('0x2e')][_0xaffd('0x4a')]({'where':{'id':_0x2ccfbb['params']['id']}})[_0xaffd('0x22')](handleEntityNotFound(_0x36b22f,null))[_0xaffd('0x22')](saveUpdates(_0x2ccfbb[_0xaffd('0x55')],null))['then'](respondWithResult(_0x36b22f,null))[_0xaffd('0x44')](handleError(_0x36b22f,null));};exports[_0xaffd('0x23')]=function(_0x409185,_0x1fff43){return db[_0xaffd('0x2e')][_0xaffd('0x4a')]({'where':{'id':_0x409185['params']['id']}})['then'](handleEntityNotFound(_0x1fff43,null))[_0xaffd('0x22')](removeEntity(_0x1fff43,null))[_0xaffd('0x44')](handleError(_0x1fff43,null));};exports[_0xaffd('0x58')]=function(_0x285652,_0x506aae,_0x4e79d3){var _0x3baa7b={'raw':!![],'where':{}};var _0x1358fb={};var _0x55c190={'count':0x0,'rows':[]};return db[_0xaffd('0x2e')][_0xaffd('0x59')]({'where':{'id':_0x285652['params']['id']}})[_0xaffd('0x22')](handleEntityNotFound(_0x506aae,null))[_0xaffd('0x22')](function(_0x5d5c9e){if(_0x5d5c9e){_0x1358fb[_0xaffd('0x32')]=_[_0xaffd('0x5a')](db[_0xaffd('0x5b')][_0xaffd('0x46')]);_0x1358fb[_0xaffd('0x33')]=_[_0xaffd('0x5a')](_0x285652[_0xaffd('0x33')]);_0x1358fb[_0xaffd('0x3d')]=_[_0xaffd('0x34')](_0x1358fb['model'],_0x1358fb[_0xaffd('0x33')]);_0x3baa7b[_0xaffd('0x36')]=_['intersection'](_0x1358fb[_0xaffd('0x32')],qs[_0xaffd('0x35')](_0x285652[_0xaffd('0x33')][_0xaffd('0x35')]));_0x3baa7b[_0xaffd('0x36')]=_0x3baa7b[_0xaffd('0x36')][_0xaffd('0x37')]?_0x3baa7b[_0xaffd('0x36')]:_0x1358fb[_0xaffd('0x32')];if(!_0x285652[_0xaffd('0x33')][_0xaffd('0x38')](_0xaffd('0x39'))){_0x3baa7b[_0xaffd('0x1a')]=qs[_0xaffd('0x1a')](_0x285652[_0xaffd('0x33')][_0xaffd('0x1a')]);_0x3baa7b['offset']=qs[_0xaffd('0x18')](_0x285652[_0xaffd('0x33')]['offset']);}_0x3baa7b[_0xaffd('0x3a')]=qs[_0xaffd('0x3b')](_0x285652[_0xaffd('0x33')][_0xaffd('0x3b')]);_0x3baa7b['where']=qs[_0xaffd('0x3d')](_[_0xaffd('0x3e')](_0x285652['query'],_0x1358fb[_0xaffd('0x3d')]));_0x3baa7b[_0xaffd('0x3c')]['ProjectId']=_0x5d5c9e['id'];if(_0x285652[_0xaffd('0x33')][_0xaffd('0x3f')]){_0x3baa7b[_0xaffd('0x3c')]=_[_0xaffd('0x49')](_0x3baa7b[_0xaffd('0x3c')],{'$or':_['map'](_0x3baa7b[_0xaffd('0x36')],function(_0x1792d5){var _0x5c4d95={};_0x5c4d95[_0x1792d5]={'$like':'%'+_0x285652[_0xaffd('0x33')][_0xaffd('0x3f')]+'%'};return _0x5c4d95;})});}_0x3baa7b=_[_0xaffd('0x49')]({},_0x3baa7b,_0x285652[_0xaffd('0x41')]);return db[_0xaffd('0x5b')]['count']({'where':_0x3baa7b['where']})[_0xaffd('0x22')](function(_0x2109f4){_0x55c190[_0xaffd('0x1b')]=_0x2109f4;if(_0x285652[_0xaffd('0x33')]['includeAll']){_0x3baa7b['include']=[{'all':!![]}];}return db[_0xaffd('0x5b')][_0xaffd('0x42')](_0x3baa7b);})[_0xaffd('0x22')](function(_0xc0ba09){_0x55c190[_0xaffd('0x43')]=_0xc0ba09;return _0x55c190;});}})['then'](respondWithFilteredResult(_0x506aae,_0x3baa7b))[_0xaffd('0x44')](handleError(_0x506aae,null));};exports[_0xaffd('0x5c')]=function(_0x18a8a5,_0x277a94,_0x8229b){var _0x37b61b={'raw':!![],'where':{}};var _0x1550cc={};var _0x3de6e1={'count':0x0,'rows':[]};return db[_0xaffd('0x2e')][_0xaffd('0x59')]({'where':{'id':_0x18a8a5[_0xaffd('0x53')]['id']}})['then'](handleEntityNotFound(_0x277a94,null))[_0xaffd('0x22')](function(_0x5bbc1e){if(_0x5bbc1e){_0x1550cc[_0xaffd('0x32')]=_[_0xaffd('0x5a')](db[_0xaffd('0x5d')][_0xaffd('0x46')]);_0x1550cc[_0xaffd('0x33')]=_[_0xaffd('0x5a')](_0x18a8a5[_0xaffd('0x33')]);_0x1550cc['filters']=_['intersection'](_0x1550cc[_0xaffd('0x32')],_0x1550cc[_0xaffd('0x33')]);_0x37b61b[_0xaffd('0x36')]=_[_0xaffd('0x34')](_0x1550cc[_0xaffd('0x32')],qs[_0xaffd('0x35')](_0x18a8a5[_0xaffd('0x33')][_0xaffd('0x35')]));_0x37b61b['attributes']=_0x37b61b['attributes'][_0xaffd('0x37')]?_0x37b61b[_0xaffd('0x36')]:_0x1550cc[_0xaffd('0x32')];if(!_0x18a8a5[_0xaffd('0x33')][_0xaffd('0x38')]('nolimit')){_0x37b61b[_0xaffd('0x1a')]=qs[_0xaffd('0x1a')](_0x18a8a5[_0xaffd('0x33')][_0xaffd('0x1a')]);_0x37b61b[_0xaffd('0x18')]=qs[_0xaffd('0x18')](_0x18a8a5[_0xaffd('0x33')][_0xaffd('0x18')]);}_0x37b61b[_0xaffd('0x3a')]=qs[_0xaffd('0x3b')](_0x18a8a5[_0xaffd('0x33')][_0xaffd('0x3b')]);_0x37b61b[_0xaffd('0x3c')]=qs[_0xaffd('0x3d')](_[_0xaffd('0x3e')](_0x18a8a5['query'],_0x1550cc['filters']));_0x37b61b[_0xaffd('0x3c')]['ProjectId']=_0x5bbc1e['id'];if(_0x18a8a5[_0xaffd('0x33')][_0xaffd('0x3f')]){_0x37b61b['where']=_['merge'](_0x37b61b[_0xaffd('0x3c')],{'$or':_[_0xaffd('0x2d')](_0x37b61b[_0xaffd('0x36')],function(_0x408774){var _0x2a125e={};_0x2a125e[_0x408774]={'$like':'%'+_0x18a8a5[_0xaffd('0x33')]['filter']+'%'};return _0x2a125e;})});}_0x37b61b=_[_0xaffd('0x49')]({},_0x37b61b,_0x18a8a5[_0xaffd('0x41')]);return db[_0xaffd('0x5d')]['count']({'where':_0x37b61b[_0xaffd('0x3c')]})['then'](function(_0x32d6a7){_0x3de6e1[_0xaffd('0x1b')]=_0x32d6a7;if(_0x18a8a5['query'][_0xaffd('0x47')]){_0x37b61b['include']=[{'all':!![]}];}return db[_0xaffd('0x5d')]['findAll'](_0x37b61b);})['then'](function(_0xb0d85c){_0x3de6e1[_0xaffd('0x43')]=_0xb0d85c;return _0x3de6e1;});}})[_0xaffd('0x22')](respondWithFilteredResult(_0x277a94,_0x37b61b))[_0xaffd('0x44')](handleError(_0x277a94,null));};function char(_0x2c74b4){return'number'===typeof _0x2c74b4?String['fromCharCode'][_0xaffd('0x1e')](null,arguments):_0x2c74b4;}function needsEncapsulation(_0x6abd32){return!!_0x6abd32&&(_0x6abd32['toString']()[_0xaffd('0x5e')](char(0xd))>=0x0||_0x6abd32[_0xaffd('0x5f')]()[_0xaffd('0x5e')](char(0xa))>=0x0||_0x6abd32[_0xaffd('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x6abd32['toString']()[_0xaffd('0x5e')](char(0x22))>=0x0);}function encapsulate(_0xded444){var _0x33c66e=char(0x22),_0x5d9ba7='\x5c'+char(0x22),_0x550e22=_0xded444[_0xaffd('0x5f')]()[_0xaffd('0x60')](new RegExp(_0x33c66e,'g'),_0x5d9ba7);return _0x33c66e+_0x550e22+_0x33c66e;}exports[_0xaffd('0x61')]=function(_0x15aa5d,_0x309a7a,_0x154f66){var _0x190073,_0x401646;var _0x53fb10={'where':{'ProjectId':_0x15aa5d[_0xaffd('0x53')]['id']}};if(_0x15aa5d['query']['startTime']){_0x53fb10[_0xaffd('0x3c')][_0xaffd('0x62')]=JSON['parse'](_0x15aa5d[_0xaffd('0x33')]['startTime']);}return db[_0xaffd('0x5b')][_0xaffd('0x42')](_0x53fb10)['then'](handleEntityNotFound(_0x309a7a,null))['then'](function(_0x6e50ab){if(_0x6e50ab){_0x190073=_0x6e50ab;return db[_0xaffd('0x63')]['findAll']({'where':{'SessionId':{'$in':_[_0xaffd('0x2d')](_0x190073,'id')},'ProjectId':_0x15aa5d[_0xaffd('0x53')]['id']},'order':_0xaffd('0x64')});}})[_0xaffd('0x22')](handleEntityNotFound(_0x309a7a,null))[_0xaffd('0x22')](function(_0x3f85b7){if(_0x3f85b7){_0x401646=_0x3f85b7;var _0x378682={};for(var _0x9c64df=0x0,_0x2b3786=_0x401646[_0xaffd('0x37')];_0x9c64df<_0x2b3786;_0x9c64df++){if(!_0x378682[_0xaffd('0x38')](_0x401646[_0x9c64df][_0xaffd('0x65')])){_0x378682[_0x401646[_0x9c64df][_0xaffd('0x65')]]=needsEncapsulation(_0x401646[_0x9c64df][_0xaffd('0x66')])?encapsulate(_0x401646[_0x9c64df][_0xaffd('0x66')]):_0x401646[_0x9c64df][_0xaffd('0x66')];}}var _0x229be8=[],_0x16619d={};for(var _0x1f9c8e=0x0,_0x586cca=_0x190073[_0xaffd('0x37')];_0x1f9c8e<_0x586cca;_0x1f9c8e++){_0x16619d={'ProjectId':_0x15aa5d['params']['id'],'SessionId':_0x190073[_0x1f9c8e]['id'],'StartTime':moment(_0x190073[_0x1f9c8e][_0xaffd('0x62')])[_0xaffd('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4b1ff4=0x0,_0x56c03e=_0x401646[_0xaffd('0x37')];_0x4b1ff4<_0x56c03e;_0x4b1ff4++){if(_0x401646[_0x4b1ff4][_0xaffd('0x68')]==_0x190073[_0x1f9c8e]['id']&&_0x378682[_0xaffd('0x38')](_0x401646[_0x4b1ff4][_0xaffd('0x65')])){_0x16619d[_0x378682[_0x401646[_0x4b1ff4]['questionId']]]=_0x401646[_0x4b1ff4][_0xaffd('0x69')];}}for(var _0xfe4a00 in _0x378682){if(!_0x16619d[_0xaffd('0x38')](_0x378682[_0xfe4a00])){_0x16619d[_0x378682[_0xfe4a00]]=null;}}_0x229be8[_0xaffd('0x6a')](_0x16619d);}return _0x229be8;}})[_0xaffd('0x22')](function(_0x48e66e){if(!_[_0xaffd('0x6b')](_0x48e66e)){var _0x47973b=toCsv(_0x48e66e);var _0x2c3d39=Date['now']();fs['writeFileSync'](util[_0xaffd('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x15aa5d[_0xaffd('0x53')]['id'],_0x2c3d39),_0x47973b);_0x309a7a[_0xaffd('0x6c')](_0xaffd('0x6d'),_0xaffd('0x6e')+util['format'](_0xaffd('0x6f'),_0x15aa5d[_0xaffd('0x53')]['id'],_0x2c3d39));_0x309a7a['setHeader'](_0xaffd('0x70'),'text/csv');return _0x309a7a[_0xaffd('0x71')](util[_0xaffd('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x15aa5d[_0xaffd('0x53')]['id'],_0x2c3d39));}else{return _0x309a7a[_0xaffd('0x16')](0xcc);}})[_0xaffd('0x44')](handleError(_0x309a7a,null));}; \ No newline at end of file +var _0x1399=['isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','include','find','omit','createdAt','updatedAt','role','destroy','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x1399,0x16c));var _0x9139=function(_0x125bad,_0x4bc955){_0x125bad=_0x125bad-0x0;var _0x40e256=_0x1399[_0x125bad];return _0x40e256;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=typeof _0x52c57b[_0x9139('0x18')]===_0x9139('0x19')&&typeof _0x52c57b[_0x9139('0x1a')]===_0x9139('0x19');var _0x4bd957=_0x159e50['count'];var _0x13cab8=_0x3e2bad?0x0:_0x52c57b[_0x9139('0x18')];var _0x5e0a59=_0x3e2bad?_0x159e50['count']:_0x52c57b[_0x9139('0x18')]+_0x52c57b[_0x9139('0x1a')];var _0x56add4;if(_0x5e0a59>=_0x4bd957){_0x5e0a59=_0x4bd957;_0x56add4=0xc8;}else{_0x56add4=0xce;}_0x58307f[_0x9139('0x16')](_0x56add4);return _0x58307f[_0x9139('0x1b')](_0x9139('0x1c'),_0x13cab8+'-'+_0x5e0a59+'/'+_0x4bd957)[_0x9139('0x1d')](_0x159e50);}return null;};}function patchUpdates(_0xd2eb33){return function(_0x6f901b){try{jsonpatch[_0x9139('0x1e')](_0x6f901b,_0xd2eb33,!![]);}catch(_0x45fa16){return BPromise[_0x9139('0x1f')](_0x45fa16);}return _0x6f901b[_0x9139('0x20')]();};}function saveUpdates(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x21')](_0x1bac18)[_0x9139('0x22')](function(_0x31635a){return _0x31635a;});}return null;};}function removeEntity(_0x1aee3b,_0x934732){return function(_0x1a7350){if(_0x1a7350){return _0x1a7350['destroy']()[_0x9139('0x22')](function(){var _0x31c22d=_0x1a7350['get']({'plain':!![]});var _0x3ed4da=_0x9139('0x23');return db[_0x9139('0x24')]['destroy']({'where':{'type':_0x3ed4da,'resourceId':_0x31c22d['id']}})[_0x9139('0x22')](function(){return _0x1a7350;});})[_0x9139('0x22')](function(){_0x1aee3b['status'](0xcc)[_0x9139('0x17')]();});}};}function handleEntityNotFound(_0x39e8cf,_0x452d9a){return function(_0x55e95f){if(!_0x55e95f){_0x39e8cf[_0x9139('0x25')](0x194);}return _0x55e95f;};}function handleError(_0x22e11e,_0x2a35fd){_0x2a35fd=_0x2a35fd||0x1f4;return function(_0x22994c){logger[_0x9139('0x26')](_0x22994c[_0x9139('0x27')]);if(_0x22994c[_0x9139('0x28')]){delete _0x22994c['name'];}_0x22e11e['status'](_0x2a35fd)[_0x9139('0x29')](_0x22994c);};}exports[_0x9139('0x2a')]=function(_0xd27355,_0x4c1693){var _0x50d545={},_0x24e8d5={},_0x2118a2={'count':0x0,'rows':[]};var _0x2dff49=_[_0x9139('0x2b')](db[_0x9139('0x2c')]['rawAttributes'],function(_0x5a1673){return{'name':_0x5a1673[_0x9139('0x2d')],'type':_0x5a1673['type']['key']};});_0x24e8d5[_0x9139('0x2e')]=_[_0x9139('0x2b')](_0x2dff49,'name');_0x24e8d5[_0x9139('0x2f')]=_[_0x9139('0x30')](_0xd27355['query']);_0x24e8d5[_0x9139('0x31')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],_0x24e8d5[_0x9139('0x2f')]);_0x50d545[_0x9139('0x33')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],qs[_0x9139('0x34')](_0xd27355[_0x9139('0x2f')][_0x9139('0x34')]));_0x50d545[_0x9139('0x33')]=_0x50d545['attributes'][_0x9139('0x35')]?_0x50d545[_0x9139('0x33')]:_0x24e8d5['model'];if(!_0xd27355[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x50d545['limit']=qs[_0x9139('0x1a')](_0xd27355[_0x9139('0x2f')][_0x9139('0x1a')]);_0x50d545[_0x9139('0x18')]=qs[_0x9139('0x18')](_0xd27355[_0x9139('0x2f')][_0x9139('0x18')]);}_0x50d545[_0x9139('0x38')]=qs[_0x9139('0x39')](_0xd27355[_0x9139('0x2f')]['sort']);_0x50d545[_0x9139('0x3a')]=qs[_0x9139('0x31')](_[_0x9139('0x3b')](_0xd27355[_0x9139('0x2f')],_0x24e8d5[_0x9139('0x31')]),_0x2dff49);if(_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]){_0x50d545['where']=_[_0x9139('0x3d')](_0x50d545['where'],{'$or':_[_0x9139('0x2b')](_0x2dff49,function(_0x11789e){if(_0x11789e[_0x9139('0x3e')]!=='VIRTUAL'){var _0x1228b6={};_0x1228b6[_0x11789e[_0x9139('0x28')]]={'$like':'%'+_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]+'%'};return _0x1228b6;}})});}_0x50d545=_[_0x9139('0x3d')]({},_0x50d545,_0xd27355[_0x9139('0x3f')]);var _0x3c98a4={'where':_0x50d545[_0x9139('0x3a')]};return db[_0x9139('0x2c')][_0x9139('0x40')](_0x3c98a4)['then'](function(_0xf14393){_0x2118a2[_0x9139('0x40')]=_0xf14393;if(_0xd27355[_0x9139('0x2f')]['includeAll']){_0x50d545['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x9139('0x41')](_0x50d545);})[_0x9139('0x22')](function(_0x3611b4){_0x2118a2[_0x9139('0x42')]=_0x3611b4;return _0x2118a2;})[_0x9139('0x22')](respondWithFilteredResult(_0x4c1693,_0x50d545))['catch'](handleError(_0x4c1693,null));};exports[_0x9139('0x43')]=function(_0x2f3ed4,_0x40fd52){var _0xf81f77={'raw':![],'where':{'id':_0x2f3ed4['params']['id']}},_0x2197ff={};_0x2197ff[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x2c')][_0x9139('0x44')]);_0x2197ff['query']=_['keys'](_0x2f3ed4[_0x9139('0x2f')]);_0x2197ff[_0x9139('0x31')]=_['intersection'](_0x2197ff['model'],_0x2197ff[_0x9139('0x2f')]);_0xf81f77[_0x9139('0x33')]=_['intersection'](_0x2197ff[_0x9139('0x2e')],qs[_0x9139('0x34')](_0x2f3ed4['query'][_0x9139('0x34')]));_0xf81f77['attributes']=_0xf81f77['attributes'][_0x9139('0x35')]?_0xf81f77[_0x9139('0x33')]:_0x2197ff[_0x9139('0x2e')];if(_0x2f3ed4[_0x9139('0x2f')][_0x9139('0x45')]){_0xf81f77['include']=[{'all':!![]}];}_0xf81f77=_[_0x9139('0x3d')]({},_0xf81f77,_0x2f3ed4[_0x9139('0x3f')]);return db[_0x9139('0x2c')]['find'](_0xf81f77)[_0x9139('0x22')](handleEntityNotFound(_0x40fd52,null))[_0x9139('0x22')](respondWithResult(_0x40fd52,null))[_0x9139('0x46')](handleError(_0x40fd52,null));};exports[_0x9139('0x47')]=function(_0x215793,_0x31395f){return db[_0x9139('0x2c')][_0x9139('0x47')](_0x215793[_0x9139('0x48')],{})[_0x9139('0x22')](function(_0x2da28c){var _0x54c926=_0x215793[_0x9139('0x49')][_0x9139('0x4a')]({'plain':!![]});if(!_0x54c926)throw new Error(_0x9139('0x4b'));if(_0x54c926['role']===_0x9139('0x49')){var _0x46f77a=_0x2da28c['get']({'plain':!![]});var _0x2f4a6f=_0x9139('0x23');return db[_0x9139('0x4c')]['find']({'where':{'name':_0x2f4a6f,'userProfileId':_0x54c926[_0x9139('0x4d')]},'raw':!![]})[_0x9139('0x22')](function(_0x1404ce){if(_0x1404ce&&_0x1404ce[_0x9139('0x4e')]===0x0){return db['UserProfileResource'][_0x9139('0x47')]({'name':_0x46f77a[_0x9139('0x28')],'resourceId':_0x46f77a['id'],'type':_0x1404ce[_0x9139('0x28')],'sectionId':_0x1404ce['id']},{})['then'](function(){return _0x2da28c;});}else{return _0x2da28c;}})[_0x9139('0x46')](function(_0x146201){logger[_0x9139('0x26')](_0x9139('0x4f'),_0x146201);throw _0x146201;});}return _0x2da28c;})[_0x9139('0x22')](respondWithResult(_0x31395f,0xc9))[_0x9139('0x46')](handleError(_0x31395f,null));};exports[_0x9139('0x50')]=function(_0x5857bf,_0x35002d){var _0x2d361f={'where':{'id':_0x5857bf[_0x9139('0x51')]['id']}},_0x5f3a48={};_0x5f3a48[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x2c')][_0x9139('0x44')]);_0x2d361f['attributes']=_[_0x9139('0x32')](_0x5f3a48[_0x9139('0x2e')],qs['fields'](_0x5857bf['query'][_0x9139('0x34')]));_0x2d361f[_0x9139('0x33')]=_0x2d361f[_0x9139('0x33')]['length']?_0x2d361f[_0x9139('0x33')]:_0x5f3a48['model'];if(_0x5857bf['query'][_0x9139('0x45')]){_0x2d361f[_0x9139('0x52')]=[{'all':!![]}];}_0x2d361f=_[_0x9139('0x3d')]({},_0x2d361f,_0x5857bf[_0x9139('0x3f')]);return db['JscriptyProject'][_0x9139('0x53')](_0x2d361f)[_0x9139('0x22')](handleEntityNotFound(_0x35002d,null))[_0x9139('0x22')](function(_0x4a74d2){if(_0x4a74d2){var _0x18421a=_0x4a74d2[_0x9139('0x4a')]({'plain':!![]});_0x18421a=qs[_0x9139('0x54')](_0x18421a,['id',_0x9139('0x55'),_0x9139('0x56')]);_0x5857bf[_0x9139('0x48')]=_[_0x9139('0x54')](_0x5857bf[_0x9139('0x48')],['id',_0x9139('0x55'),_0x9139('0x56')]);return db[_0x9139('0x2c')][_0x9139('0x47')](_[_0x9139('0x3d')](_0x18421a,_0x5857bf[_0x9139('0x48')]),{'include':_0x5857bf['query'][_0x9139('0x45')]?[{'all':!![]}]:undefined})[_0x9139('0x22')](function(_0x3ef34c){var _0x37433c=_0x5857bf[_0x9139('0x49')]['get']({'plain':!![]});if(!_0x37433c)throw new Error(_0x9139('0x4b'));if(_0x37433c[_0x9139('0x57')]===_0x9139('0x49')){var _0x196be1=_0x3ef34c[_0x9139('0x4a')]({'plain':!![]});var _0x581ae0='Projects';return db[_0x9139('0x4c')][_0x9139('0x53')]({'where':{'name':_0x581ae0,'userProfileId':_0x37433c['userProfileId']},'raw':!![]})[_0x9139('0x22')](function(_0xd20c65){if(_0xd20c65&&_0xd20c65[_0x9139('0x4e')]===0x0){return db[_0x9139('0x24')][_0x9139('0x47')]({'name':_0x196be1[_0x9139('0x28')],'resourceId':_0x196be1['id'],'type':_0xd20c65[_0x9139('0x28')],'sectionId':_0xd20c65['id']},{})[_0x9139('0x22')](function(){return _0x3ef34c;});}else{return _0x3ef34c;}})[_0x9139('0x46')](function(_0x53a27f){logger[_0x9139('0x26')](_0x9139('0x4f'),_0x53a27f);throw _0x53a27f;});}return _0x3ef34c;});}})[_0x9139('0x22')](respondWithResult(_0x35002d,0xc9))[_0x9139('0x46')](handleError(_0x35002d,null));};exports['update']=function(_0x53152f,_0x46b5cb){if(_0x53152f[_0x9139('0x48')]['id']){delete _0x53152f[_0x9139('0x48')]['id'];}return db[_0x9139('0x2c')]['find']({'where':{'id':_0x53152f[_0x9139('0x51')]['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x46b5cb,null))['then'](saveUpdates(_0x53152f[_0x9139('0x48')],null))[_0x9139('0x22')](respondWithResult(_0x46b5cb,null))[_0x9139('0x46')](handleError(_0x46b5cb,null));};exports[_0x9139('0x58')]=function(_0x198ddb,_0x45eeda){return db[_0x9139('0x2c')][_0x9139('0x53')]({'where':{'id':_0x198ddb['params']['id']}})['then'](handleEntityNotFound(_0x45eeda,null))['then'](removeEntity(_0x45eeda,null))[_0x9139('0x46')](handleError(_0x45eeda,null));};exports[_0x9139('0x59')]=function(_0x2235fb,_0x4eefd8,_0x42f66c){var _0x3f3d58={'raw':!![],'where':{}};var _0x42d389={};var _0x235241={'count':0x0,'rows':[]};return db[_0x9139('0x2c')][_0x9139('0x5a')]({'where':{'id':_0x2235fb['params']['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x4eefd8,null))['then'](function(_0xf079b8){if(_0xf079b8){_0x42d389['model']=_[_0x9139('0x30')](db[_0x9139('0x5b')]['rawAttributes']);_0x42d389['query']=_[_0x9139('0x30')](_0x2235fb[_0x9139('0x2f')]);_0x42d389[_0x9139('0x31')]=_['intersection'](_0x42d389[_0x9139('0x2e')],_0x42d389[_0x9139('0x2f')]);_0x3f3d58[_0x9139('0x33')]=_[_0x9139('0x32')](_0x42d389['model'],qs['fields'](_0x2235fb[_0x9139('0x2f')][_0x9139('0x34')]));_0x3f3d58['attributes']=_0x3f3d58[_0x9139('0x33')][_0x9139('0x35')]?_0x3f3d58[_0x9139('0x33')]:_0x42d389[_0x9139('0x2e')];if(!_0x2235fb[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x3f3d58[_0x9139('0x1a')]=qs[_0x9139('0x1a')](_0x2235fb[_0x9139('0x2f')][_0x9139('0x1a')]);_0x3f3d58[_0x9139('0x18')]=qs[_0x9139('0x18')](_0x2235fb['query'][_0x9139('0x18')]);}_0x3f3d58[_0x9139('0x38')]=qs[_0x9139('0x39')](_0x2235fb[_0x9139('0x2f')][_0x9139('0x39')]);_0x3f3d58['where']=qs[_0x9139('0x31')](_['pick'](_0x2235fb[_0x9139('0x2f')],_0x42d389[_0x9139('0x31')]));_0x3f3d58[_0x9139('0x3a')]['ProjectId']=_0xf079b8['id'];if(_0x2235fb[_0x9139('0x2f')][_0x9139('0x3c')]){_0x3f3d58['where']=_[_0x9139('0x3d')](_0x3f3d58[_0x9139('0x3a')],{'$or':_[_0x9139('0x2b')](_0x3f3d58[_0x9139('0x33')],function(_0x16a1f6){var _0x451458={};_0x451458[_0x16a1f6]={'$like':'%'+_0x2235fb[_0x9139('0x2f')][_0x9139('0x3c')]+'%'};return _0x451458;})});}_0x3f3d58=_[_0x9139('0x3d')]({},_0x3f3d58,_0x2235fb['options']);return db[_0x9139('0x5b')][_0x9139('0x40')]({'where':_0x3f3d58[_0x9139('0x3a')]})[_0x9139('0x22')](function(_0x276609){_0x235241['count']=_0x276609;if(_0x2235fb[_0x9139('0x2f')][_0x9139('0x45')]){_0x3f3d58['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x9139('0x41')](_0x3f3d58);})[_0x9139('0x22')](function(_0x1a3833){_0x235241[_0x9139('0x42')]=_0x1a3833;return _0x235241;});}})['then'](respondWithFilteredResult(_0x4eefd8,_0x3f3d58))[_0x9139('0x46')](handleError(_0x4eefd8,null));};exports[_0x9139('0x5c')]=function(_0x2a4696,_0x2e5727,_0xf3162b){var _0x13510c={'raw':!![],'where':{}};var _0x3f0ddd={};var _0x207f10={'count':0x0,'rows':[]};return db[_0x9139('0x2c')][_0x9139('0x5a')]({'where':{'id':_0x2a4696[_0x9139('0x51')]['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x2e5727,null))[_0x9139('0x22')](function(_0x100c61){if(_0x100c61){_0x3f0ddd[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x5d')][_0x9139('0x44')]);_0x3f0ddd[_0x9139('0x2f')]=_['keys'](_0x2a4696[_0x9139('0x2f')]);_0x3f0ddd[_0x9139('0x31')]=_[_0x9139('0x32')](_0x3f0ddd[_0x9139('0x2e')],_0x3f0ddd[_0x9139('0x2f')]);_0x13510c['attributes']=_[_0x9139('0x32')](_0x3f0ddd[_0x9139('0x2e')],qs[_0x9139('0x34')](_0x2a4696[_0x9139('0x2f')][_0x9139('0x34')]));_0x13510c[_0x9139('0x33')]=_0x13510c[_0x9139('0x33')]['length']?_0x13510c['attributes']:_0x3f0ddd[_0x9139('0x2e')];if(!_0x2a4696[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x13510c['limit']=qs['limit'](_0x2a4696[_0x9139('0x2f')][_0x9139('0x1a')]);_0x13510c[_0x9139('0x18')]=qs[_0x9139('0x18')](_0x2a4696[_0x9139('0x2f')][_0x9139('0x18')]);}_0x13510c[_0x9139('0x38')]=qs[_0x9139('0x39')](_0x2a4696[_0x9139('0x2f')]['sort']);_0x13510c[_0x9139('0x3a')]=qs['filters'](_[_0x9139('0x3b')](_0x2a4696[_0x9139('0x2f')],_0x3f0ddd[_0x9139('0x31')]));_0x13510c[_0x9139('0x3a')]['ProjectId']=_0x100c61['id'];if(_0x2a4696['query'][_0x9139('0x3c')]){_0x13510c[_0x9139('0x3a')]=_[_0x9139('0x3d')](_0x13510c[_0x9139('0x3a')],{'$or':_[_0x9139('0x2b')](_0x13510c['attributes'],function(_0x47e8bf){var _0x315f1a={};_0x315f1a[_0x47e8bf]={'$like':'%'+_0x2a4696['query'][_0x9139('0x3c')]+'%'};return _0x315f1a;})});}_0x13510c=_[_0x9139('0x3d')]({},_0x13510c,_0x2a4696[_0x9139('0x3f')]);return db['JscriptyAnswerReport'][_0x9139('0x40')]({'where':_0x13510c[_0x9139('0x3a')]})[_0x9139('0x22')](function(_0x1213c6){_0x207f10[_0x9139('0x40')]=_0x1213c6;if(_0x2a4696[_0x9139('0x2f')]['includeAll']){_0x13510c[_0x9139('0x52')]=[{'all':!![]}];}return db[_0x9139('0x5d')][_0x9139('0x41')](_0x13510c);})[_0x9139('0x22')](function(_0x53ecf0){_0x207f10['rows']=_0x53ecf0;return _0x207f10;});}})[_0x9139('0x22')](respondWithFilteredResult(_0x2e5727,_0x13510c))[_0x9139('0x46')](handleError(_0x2e5727,null));};function char(_0x4fe06f){return'number'===typeof _0x4fe06f?String[_0x9139('0x5e')]['apply'](null,arguments):_0x4fe06f;}function needsEncapsulation(_0x43514f){return!!_0x43514f&&(_0x43514f['toString']()['indexOf'](char(0xd))>=0x0||_0x43514f[_0x9139('0x5f')]()[_0x9139('0x60')](char(0xa))>=0x0||_0x43514f[_0x9139('0x5f')]()[_0x9139('0x60')](char(0x2c))>=0x0||_0x43514f[_0x9139('0x5f')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4f7b28){var _0x2d5136=char(0x22),_0xc0aed='\x5c'+char(0x22),_0x459e1e=_0x4f7b28[_0x9139('0x5f')]()['replace'](new RegExp(_0x2d5136,'g'),_0xc0aed);return _0x2d5136+_0x459e1e+_0x2d5136;}exports[_0x9139('0x61')]=function(_0x4fc4f5,_0xee2971,_0x4dae55){var _0x17aa23,_0x5b5a60;var _0x11e439={'where':{'ProjectId':_0x4fc4f5['params']['id']}};if(_0x4fc4f5['query'][_0x9139('0x62')]){_0x11e439[_0x9139('0x3a')][_0x9139('0x63')]=JSON['parse'](_0x4fc4f5[_0x9139('0x2f')]['startTime']);}return db[_0x9139('0x5b')][_0x9139('0x41')](_0x11e439)[_0x9139('0x22')](handleEntityNotFound(_0xee2971,null))[_0x9139('0x22')](function(_0x354e08){if(_0x354e08){_0x17aa23=_0x354e08;return db[_0x9139('0x64')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x17aa23,'id')},'ProjectId':_0x4fc4f5[_0x9139('0x51')]['id']},'order':_0x9139('0x65')});}})[_0x9139('0x22')](handleEntityNotFound(_0xee2971,null))[_0x9139('0x22')](function(_0xb2cb17){if(_0xb2cb17){_0x5b5a60=_0xb2cb17;var _0x4d9e23={};for(var _0x5beb9d=0x0,_0x28b7bc=_0x5b5a60[_0x9139('0x35')];_0x5beb9d<_0x28b7bc;_0x5beb9d++){if(!_0x4d9e23[_0x9139('0x36')](_0x5b5a60[_0x5beb9d][_0x9139('0x66')])){_0x4d9e23[_0x5b5a60[_0x5beb9d][_0x9139('0x66')]]=needsEncapsulation(_0x5b5a60[_0x5beb9d][_0x9139('0x67')])?encapsulate(_0x5b5a60[_0x5beb9d]['question']):_0x5b5a60[_0x5beb9d]['question'];}}var _0x2fb0f0=[],_0x310f49={};for(var _0x10d4ac=0x0,_0x49d58d=_0x17aa23['length'];_0x10d4ac<_0x49d58d;_0x10d4ac++){_0x310f49={'ProjectId':_0x4fc4f5[_0x9139('0x51')]['id'],'SessionId':_0x17aa23[_0x10d4ac]['id'],'StartTime':moment(_0x17aa23[_0x10d4ac]['starttime'])[_0x9139('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x156dca=0x0,_0x332381=_0x5b5a60['length'];_0x156dca<_0x332381;_0x156dca++){if(_0x5b5a60[_0x156dca][_0x9139('0x69')]==_0x17aa23[_0x10d4ac]['id']&&_0x4d9e23['hasOwnProperty'](_0x5b5a60[_0x156dca]['questionId'])){_0x310f49[_0x4d9e23[_0x5b5a60[_0x156dca][_0x9139('0x66')]]]=_0x5b5a60[_0x156dca][_0x9139('0x6a')];}}for(var _0xd3ec0b in _0x4d9e23){if(!_0x310f49[_0x9139('0x36')](_0x4d9e23[_0xd3ec0b])){_0x310f49[_0x4d9e23[_0xd3ec0b]]=null;}}_0x2fb0f0[_0x9139('0x6b')](_0x310f49);}return _0x2fb0f0;}})[_0x9139('0x22')](function(_0x4cce2c){if(!_[_0x9139('0x6c')](_0x4cce2c)){var _0x3b5254=toCsv(_0x4cce2c);var _0x80b742=Date[_0x9139('0x6d')]();fs['writeFileSync'](util[_0x9139('0x68')](_0x9139('0x6e'),_0x4fc4f5[_0x9139('0x51')]['id'],_0x80b742),_0x3b5254);_0xee2971[_0x9139('0x6f')](_0x9139('0x70'),_0x9139('0x71')+util[_0x9139('0x68')](_0x9139('0x72'),_0x4fc4f5['params']['id'],_0x80b742));_0xee2971[_0x9139('0x6f')](_0x9139('0x73'),_0x9139('0x74'));return _0xee2971[_0x9139('0x75')](util[_0x9139('0x68')](_0x9139('0x6e'),_0x4fc4f5[_0x9139('0x51')]['id'],_0x80b742));}else{return _0xee2971[_0x9139('0x25')](0xcc);}})['catch'](handleError(_0xee2971,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 825003d..98a3aa7 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 _0x52ad=['./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x52ad,0x1d8));var _0xd52a=function(_0x1f7683,_0x292b31){_0x1f7683=_0x1f7683-0x0;var _0x3cb2e0=_0x52ad[_0x1f7683];return _0x3cb2e0;};'use strict';var _=require(_0xd52a('0x0'));var util=require(_0xd52a('0x1'));var logger=require(_0xd52a('0x2'))(_0xd52a('0x3'));var moment=require('moment');var BPromise=require(_0xd52a('0x4'));var rp=require(_0xd52a('0x5'));var fs=require('fs');var path=require(_0xd52a('0x6'));var rimraf=require(_0xd52a('0x7'));var config=require(_0xd52a('0x8'));var attributes=require(_0xd52a('0x9'));module[_0xd52a('0xa')]=function(_0x1f8aec,_0x186c1e){return _0x1f8aec['define'](_0xd52a('0xb'),attributes,{'tableName':_0xd52a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89c3=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x60b245,_0xa99bae){var _0x928472=function(_0x4365c6){while(--_0x4365c6){_0x60b245['push'](_0x60b245['shift']());}};_0x928472(++_0xa99bae);}(_0x89c3,0xff));var _0x389c=function(_0x372f8d,_0xaf56ae){_0x372f8d=_0x372f8d-0x0;var _0x4267f1=_0x89c3[_0x372f8d];return _0x4267f1;};'use strict';var _=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var logger=require(_0x389c('0x2'))(_0x389c('0x3'));var moment=require(_0x389c('0x4'));var BPromise=require(_0x389c('0x5'));var rp=require(_0x389c('0x6'));var fs=require('fs');var path=require(_0x389c('0x7'));var rimraf=require('rimraf');var config=require(_0x389c('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x389c('0x9')]=function(_0x4bece6,_0x51f5f5){return _0x4bece6[_0x389c('0xa')]('JscriptyProject',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 816feeb..c5e5db8 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0xda3f,0xec));var _0xfda3=function(_0xf6850d,_0x57dfc6){_0xf6850d=_0xf6850d-0x0;var _0x2762a8=_0xda3f[_0xf6850d];return _0x2762a8;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xac4a,0x13f));var _0xaac4=function(_0x1ebdb7,_0x59fa85){_0x1ebdb7=_0x1ebdb7-0x0;var _0x176286=_0xac4a[_0x1ebdb7];return _0x176286;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d287fc2..37a38b3 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 _0x95b6=['./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3498f5,_0x35cbaf){var _0x2273da=function(_0x51b358){while(--_0x51b358){_0x3498f5['push'](_0x3498f5['shift']());}};_0x2273da(++_0x35cbaf);}(_0x95b6,0x142));var _0x695b=function(_0x4ba7ff,_0x508e09){_0x4ba7ff=_0x4ba7ff-0x0;var _0x3870a7=_0x95b6[_0x4ba7ff];return _0x3870a7;};'use strict';var multer=require('multer');var util=require(_0x695b('0x0'));var path=require(_0x695b('0x1'));var timeout=require(_0x695b('0x2'));var express=require(_0x695b('0x3'));var router=express[_0x695b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x695b('0x5'));var interaction=require(_0x695b('0x6'));var config=require(_0x695b('0x7'));var controller=require(_0x695b('0x8'));router[_0x695b('0x9')]('/',auth[_0x695b('0xa')](),controller[_0x695b('0xb')]);router[_0x695b('0x9')](_0x695b('0xc'),auth['isAuthenticated'](),controller[_0x695b('0xd')]);router[_0x695b('0x9')](_0x695b('0xe'),auth['isAuthenticated'](),controller[_0x695b('0xf')]);router[_0x695b('0x10')]('/',auth[_0x695b('0xa')](),controller['create']);router[_0x695b('0x11')]('/:id',auth[_0x695b('0xa')](),controller[_0x695b('0x12')]);router[_0x695b('0x13')](_0x695b('0xe'),auth['isAuthenticated'](),controller[_0x695b('0x14')]);module[_0x695b('0x15')]=router; \ No newline at end of file +var _0xc16c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x3eec1a,_0x28a1af){var _0x50ac15=function(_0x470954){while(--_0x470954){_0x3eec1a['push'](_0x3eec1a['shift']());}};_0x50ac15(++_0x28a1af);}(_0xc16c,0x121));var _0xcc16=function(_0x252983,_0x6de0da){_0x252983=_0x252983-0x0;var _0x3df207=_0xc16c[_0x252983];return _0x3df207;};'use strict';var multer=require('multer');var util=require(_0xcc16('0x0'));var path=require(_0xcc16('0x1'));var timeout=require(_0xcc16('0x2'));var express=require(_0xcc16('0x3'));var router=express['Router']();var fs_extra=require(_0xcc16('0x4'));var auth=require(_0xcc16('0x5'));var interaction=require(_0xcc16('0x6'));var config=require(_0xcc16('0x7'));var controller=require(_0xcc16('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc16('0x9')]);router[_0xcc16('0xa')](_0xcc16('0xb'),auth[_0xcc16('0xc')](),controller[_0xcc16('0xd')]);router[_0xcc16('0xa')](_0xcc16('0xe'),auth[_0xcc16('0xc')](),controller[_0xcc16('0xf')]);router['post']('/',auth[_0xcc16('0xc')](),controller[_0xcc16('0x10')]);router['put'](_0xcc16('0xe'),auth[_0xcc16('0xc')](),controller[_0xcc16('0x11')]);router[_0xcc16('0x12')](_0xcc16('0xe'),auth[_0xcc16('0xc')](),controller[_0xcc16('0x13')]);module[_0xcc16('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index afb9327..7b51d2b 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x4abb6e,_0x1ad80d){_0x4abb6e=_0x4abb6e-0x0;var _0x58c895=_0x7a54[_0x4abb6e];return _0x58c895;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x503f31,_0x244346){_0x503f31=_0x503f31-0x0;var _0x4a08e0=_0x7a54[_0x503f31];return _0x4a08e0;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 5668652..b6c3d76 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 _0x5af0=['body','update','destroy','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','stack','name','send','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x5af0,0x1c6));var _0x05af=function(_0x4a3fad,_0x1ae3c5){_0x4a3fad=_0x4a3fad-0x0;var _0x7fbd9f=_0x5af0[_0x4a3fad];return _0x7fbd9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x05af('0x0'));var rp=require(_0x05af('0x1'));var moment=require(_0x05af('0x2'));var BPromise=require(_0x05af('0x3'));var Mustache=require(_0x05af('0x4'));var util=require(_0x05af('0x5'));var path=require(_0x05af('0x6'));var sox=require(_0x05af('0x7'));var csv=require('to-csv');var ejs=require(_0x05af('0x8'));var fs=require('fs');var fs_extra=require(_0x05af('0x9'));var _=require(_0x05af('0xa'));var squel=require(_0x05af('0xb'));var crypto=require(_0x05af('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x05af('0xd'));var toCsv=require(_0x05af('0xe'));var querystring=require(_0x05af('0xf'));var Papa=require(_0x05af('0x10'));var Redis=require(_0x05af('0x11'));var authService=require(_0x05af('0x12'));var qs=require(_0x05af('0x13'));var as=require(_0x05af('0x14'));var hardwareService=require(_0x05af('0x15'));var logger=require('../../config/logger')(_0x05af('0x16'));var utils=require('../../config/utils');var config=require(_0x05af('0x17'));var licenseUtil=require(_0x05af('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48437a,_0x585bbe){_0x585bbe=_0x585bbe||0xcc;return function(_0x1b5927){if(_0x1b5927){return _0x48437a[_0x05af('0x19')](_0x585bbe);}return _0x48437a[_0x05af('0x1a')](_0x585bbe)[_0x05af('0x1b')]();};}function respondWithResult(_0x411898,_0xced6dd){_0xced6dd=_0xced6dd||0xc8;return function(_0x516c49){if(_0x516c49){return _0x411898[_0x05af('0x1a')](_0xced6dd)[_0x05af('0x1c')](_0x516c49);}};}function respondWithFilteredResult(_0x3fd8e2,_0xa80dd4){return function(_0x4a1254){if(_0x4a1254){var _0x13d310=typeof _0xa80dd4[_0x05af('0x1d')]===_0x05af('0x1e')&&typeof _0xa80dd4[_0x05af('0x1f')]===_0x05af('0x1e');var _0x4fed68=_0x4a1254[_0x05af('0x20')];var _0x2f5c8d=_0x13d310?0x0:_0xa80dd4[_0x05af('0x1d')];var _0x453f0a=_0x13d310?_0x4a1254[_0x05af('0x20')]:_0xa80dd4[_0x05af('0x1d')]+_0xa80dd4['limit'];var _0x3dd548;if(_0x453f0a>=_0x4fed68){_0x453f0a=_0x4fed68;_0x3dd548=0xc8;}else{_0x3dd548=0xce;}_0x3fd8e2['status'](_0x3dd548);return _0x3fd8e2[_0x05af('0x21')]('Content-Range',_0x2f5c8d+'-'+_0x453f0a+'/'+_0x4fed68)[_0x05af('0x1c')](_0x4a1254);}return null;};}function patchUpdates(_0x3617dd){return function(_0x2486cd){try{jsonpatch[_0x05af('0x22')](_0x2486cd,_0x3617dd,!![]);}catch(_0x202624){return BPromise['reject'](_0x202624);}return _0x2486cd[_0x05af('0x23')]();};}function saveUpdates(_0x3f25ed,_0x7543d5){return function(_0x271212){if(_0x271212){return _0x271212['update'](_0x3f25ed)[_0x05af('0x24')](function(_0x21203d){return _0x21203d;});}return null;};}function removeEntity(_0x2dfe8b,_0x33d849){return function(_0x54df7c){if(_0x54df7c){return _0x54df7c['destroy']()[_0x05af('0x24')](function(){_0x2dfe8b[_0x05af('0x1a')](0xcc)[_0x05af('0x1b')]();});}};}function handleEntityNotFound(_0x4339dd,_0x4709c6){return function(_0x1d09b2){if(!_0x1d09b2){_0x4339dd['sendStatus'](0x194);}return _0x1d09b2;};}function handleError(_0x22c0f9,_0x4b7659){_0x4b7659=_0x4b7659||0x1f4;return function(_0x299e23){logger['error'](_0x299e23[_0x05af('0x25')]);if(_0x299e23[_0x05af('0x26')]){delete _0x299e23[_0x05af('0x26')];}_0x22c0f9[_0x05af('0x1a')](_0x4b7659)[_0x05af('0x27')](_0x299e23);};}exports['index']=function(_0x542e6d,_0x3b2c3f){var _0x441f26={},_0x2a38dc={},_0xb3803d={'count':0x0,'rows':[]};var _0x5c6517=_['map'](db[_0x05af('0x28')][_0x05af('0x29')],function(_0x1dadf9){return{'name':_0x1dadf9[_0x05af('0x2a')],'type':_0x1dadf9['type'][_0x05af('0x2b')]};});_0x2a38dc[_0x05af('0x2c')]=_['map'](_0x5c6517,_0x05af('0x26'));_0x2a38dc[_0x05af('0x2d')]=_['keys'](_0x542e6d[_0x05af('0x2d')]);_0x2a38dc[_0x05af('0x2e')]=_[_0x05af('0x2f')](_0x2a38dc['model'],_0x2a38dc[_0x05af('0x2d')]);_0x441f26[_0x05af('0x30')]=_[_0x05af('0x2f')](_0x2a38dc['model'],qs['fields'](_0x542e6d[_0x05af('0x2d')][_0x05af('0x31')]));_0x441f26[_0x05af('0x30')]=_0x441f26[_0x05af('0x30')][_0x05af('0x32')]?_0x441f26[_0x05af('0x30')]:_0x2a38dc['model'];if(!_0x542e6d[_0x05af('0x2d')][_0x05af('0x33')](_0x05af('0x34'))){_0x441f26['limit']=qs[_0x05af('0x1f')](_0x542e6d[_0x05af('0x2d')][_0x05af('0x1f')]);_0x441f26[_0x05af('0x1d')]=qs[_0x05af('0x1d')](_0x542e6d[_0x05af('0x2d')][_0x05af('0x1d')]);}_0x441f26[_0x05af('0x35')]=qs[_0x05af('0x36')](_0x542e6d[_0x05af('0x2d')][_0x05af('0x36')]);_0x441f26[_0x05af('0x37')]=qs[_0x05af('0x2e')](_['pick'](_0x542e6d[_0x05af('0x2d')],_0x2a38dc[_0x05af('0x2e')]),_0x5c6517);if(_0x542e6d[_0x05af('0x2d')][_0x05af('0x38')]){_0x441f26[_0x05af('0x37')]=_[_0x05af('0x39')](_0x441f26[_0x05af('0x37')],{'$or':_[_0x05af('0x3a')](_0x5c6517,function(_0x5e8ac6){if(_0x5e8ac6[_0x05af('0x3b')]!==_0x05af('0x3c')){var _0x49c5f8={};_0x49c5f8[_0x5e8ac6['name']]={'$like':'%'+_0x542e6d[_0x05af('0x2d')][_0x05af('0x38')]+'%'};return _0x49c5f8;}})});}_0x441f26=_[_0x05af('0x39')]({},_0x441f26,_0x542e6d['options']);var _0x106b29={'where':_0x441f26[_0x05af('0x37')]};return db[_0x05af('0x28')][_0x05af('0x20')](_0x106b29)[_0x05af('0x24')](function(_0x2dbc15){_0xb3803d[_0x05af('0x20')]=_0x2dbc15;if(_0x542e6d[_0x05af('0x2d')][_0x05af('0x3d')]){_0x441f26[_0x05af('0x3e')]=[{'all':!![]}];}return db[_0x05af('0x28')][_0x05af('0x3f')](_0x441f26);})[_0x05af('0x24')](function(_0x1f19c2){_0xb3803d[_0x05af('0x40')]=_0x1f19c2;return _0xb3803d;})['then'](respondWithFilteredResult(_0x3b2c3f,_0x441f26))[_0x05af('0x41')](handleError(_0x3b2c3f,null));};exports['show']=function(_0x27d097,_0x1e62df){var _0x199c74={'raw':!![],'where':{'id':_0x27d097[_0x05af('0x42')]['id']}},_0x2eabdf={};_0x2eabdf[_0x05af('0x2c')]=_[_0x05af('0x43')](db[_0x05af('0x28')][_0x05af('0x29')]);_0x2eabdf['query']=_[_0x05af('0x43')](_0x27d097['query']);_0x2eabdf['filters']=_[_0x05af('0x2f')](_0x2eabdf[_0x05af('0x2c')],_0x2eabdf[_0x05af('0x2d')]);_0x199c74['attributes']=_[_0x05af('0x2f')](_0x2eabdf[_0x05af('0x2c')],qs[_0x05af('0x31')](_0x27d097[_0x05af('0x2d')][_0x05af('0x31')]));_0x199c74['attributes']=_0x199c74['attributes'][_0x05af('0x32')]?_0x199c74['attributes']:_0x2eabdf[_0x05af('0x2c')];if(_0x27d097['query']['includeAll']){_0x199c74[_0x05af('0x3e')]=[{'all':!![]}];}_0x199c74=_[_0x05af('0x39')]({},_0x199c74,_0x27d097[_0x05af('0x44')]);return db[_0x05af('0x28')][_0x05af('0x45')](_0x199c74)['then'](handleEntityNotFound(_0x1e62df,null))[_0x05af('0x24')](respondWithResult(_0x1e62df,null))[_0x05af('0x41')](handleError(_0x1e62df,null));};exports[_0x05af('0x46')]=function(_0x1ed895,_0x5c0e57){return db['JscriptyQuestionReport'][_0x05af('0x46')](_0x1ed895[_0x05af('0x47')],{})[_0x05af('0x24')](respondWithResult(_0x5c0e57,0xc9))['catch'](handleError(_0x5c0e57,null));};exports[_0x05af('0x48')]=function(_0x3ab41b,_0x5e1794){if(_0x3ab41b[_0x05af('0x47')]['id']){delete _0x3ab41b[_0x05af('0x47')]['id'];}return db[_0x05af('0x28')][_0x05af('0x45')]({'where':{'id':_0x3ab41b[_0x05af('0x42')]['id']}})[_0x05af('0x24')](handleEntityNotFound(_0x5e1794,null))[_0x05af('0x24')](saveUpdates(_0x3ab41b[_0x05af('0x47')],null))[_0x05af('0x24')](respondWithResult(_0x5e1794,null))[_0x05af('0x41')](handleError(_0x5e1794,null));};exports[_0x05af('0x49')]=function(_0x2b19b5,_0x2ae43b){return db[_0x05af('0x28')]['find']({'where':{'id':_0x2b19b5[_0x05af('0x42')]['id']}})[_0x05af('0x24')](handleEntityNotFound(_0x2ae43b,null))[_0x05af('0x24')](removeEntity(_0x2ae43b,null))[_0x05af('0x41')](handleError(_0x2ae43b,null));};exports[_0x05af('0x4a')]=function(_0x303b21,_0xc48293){return db[_0x05af('0x28')][_0x05af('0x4a')]()['then'](respondWithResult(_0xc48293,null))[_0x05af('0x41')](handleError(_0xc48293,null));}; \ No newline at end of file +var _0xd3dd=['order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','JscriptyQuestionReport','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x447b84,_0x368591){var _0x492d68=function(_0x3afdde){while(--_0x3afdde){_0x447b84['push'](_0x447b84['shift']());}};_0x492d68(++_0x368591);}(_0xd3dd,0xad));var _0xdd3d=function(_0x1c3c83,_0x80c101){_0x1c3c83=_0x1c3c83-0x0;var _0x1d747e=_0xd3dd[_0x1c3c83];return _0x1d747e;};'use strict';var emlformat=require(_0xdd3d('0x0'));var rimraf=require(_0xdd3d('0x1'));var zipdir=require(_0xdd3d('0x2'));var jsonpatch=require(_0xdd3d('0x3'));var rp=require(_0xdd3d('0x4'));var moment=require(_0xdd3d('0x5'));var BPromise=require(_0xdd3d('0x6'));var Mustache=require('mustache');var util=require(_0xdd3d('0x7'));var path=require('path');var sox=require(_0xdd3d('0x8'));var csv=require(_0xdd3d('0x9'));var ejs=require(_0xdd3d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd3d('0xb'));var squel=require(_0xdd3d('0xc'));var crypto=require(_0xdd3d('0xd'));var jsforce=require(_0xdd3d('0xe'));var deskjs=require(_0xdd3d('0xf'));var toCsv=require(_0xdd3d('0x9'));var querystring=require('querystring');var Papa=require(_0xdd3d('0x10'));var Redis=require(_0xdd3d('0x11'));var authService=require(_0xdd3d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdd3d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdd3d('0x14'));var utils=require(_0xdd3d('0x15'));var config=require(_0xdd3d('0x16'));var licenseUtil=require(_0xdd3d('0x17'));var db=require(_0xdd3d('0x18'))['db'];function respondWithStatusCode(_0x3c51c0,_0x12c844){_0x12c844=_0x12c844||0xcc;return function(_0xa06658){if(_0xa06658){return _0x3c51c0[_0xdd3d('0x19')](_0x12c844);}return _0x3c51c0[_0xdd3d('0x1a')](_0x12c844)[_0xdd3d('0x1b')]();};}function respondWithResult(_0x56ab70,_0x50868d){_0x50868d=_0x50868d||0xc8;return function(_0x12b685){if(_0x12b685){return _0x56ab70[_0xdd3d('0x1a')](_0x50868d)[_0xdd3d('0x1c')](_0x12b685);}};}function respondWithFilteredResult(_0x2918b1,_0xc6b9a3){return function(_0xed99a9){if(_0xed99a9){var _0x4edf3a=typeof _0xc6b9a3[_0xdd3d('0x1d')]===_0xdd3d('0x1e')&&typeof _0xc6b9a3[_0xdd3d('0x1f')]==='undefined';var _0x3ce384=_0xed99a9['count'];var _0x26edb6=_0x4edf3a?0x0:_0xc6b9a3[_0xdd3d('0x1d')];var _0x577acd=_0x4edf3a?_0xed99a9['count']:_0xc6b9a3[_0xdd3d('0x1d')]+_0xc6b9a3[_0xdd3d('0x1f')];var _0x420b20;if(_0x577acd>=_0x3ce384){_0x577acd=_0x3ce384;_0x420b20=0xc8;}else{_0x420b20=0xce;}_0x2918b1[_0xdd3d('0x1a')](_0x420b20);return _0x2918b1[_0xdd3d('0x20')]('Content-Range',_0x26edb6+'-'+_0x577acd+'/'+_0x3ce384)[_0xdd3d('0x1c')](_0xed99a9);}return null;};}function patchUpdates(_0x4fa2bf){return function(_0x45beec){try{jsonpatch[_0xdd3d('0x21')](_0x45beec,_0x4fa2bf,!![]);}catch(_0x386ebb){return BPromise[_0xdd3d('0x22')](_0x386ebb);}return _0x45beec[_0xdd3d('0x23')]();};}function saveUpdates(_0x164a2d,_0x2e329a){return function(_0x44c2da){if(_0x44c2da){return _0x44c2da['update'](_0x164a2d)[_0xdd3d('0x24')](function(_0x31bff5){return _0x31bff5;});}return null;};}function removeEntity(_0x33cf61,_0xabba67){return function(_0xb0eeb3){if(_0xb0eeb3){return _0xb0eeb3[_0xdd3d('0x25')]()[_0xdd3d('0x24')](function(){_0x33cf61[_0xdd3d('0x1a')](0xcc)[_0xdd3d('0x1b')]();});}};}function handleEntityNotFound(_0x178e7d,_0x90e4de){return function(_0x3388da){if(!_0x3388da){_0x178e7d['sendStatus'](0x194);}return _0x3388da;};}function handleError(_0xd7f531,_0x584d5e){_0x584d5e=_0x584d5e||0x1f4;return function(_0xaeee37){logger[_0xdd3d('0x26')](_0xaeee37[_0xdd3d('0x27')]);if(_0xaeee37[_0xdd3d('0x28')]){delete _0xaeee37[_0xdd3d('0x28')];}_0xd7f531[_0xdd3d('0x1a')](_0x584d5e)['send'](_0xaeee37);};}exports[_0xdd3d('0x29')]=function(_0x4d03e0,_0x2cbd9c){var _0x10409d={},_0x2862be={},_0x1d86f1={'count':0x0,'rows':[]};var _0x4104b0=_[_0xdd3d('0x2a')](db[_0xdd3d('0x2b')]['rawAttributes'],function(_0xf991b8){return{'name':_0xf991b8[_0xdd3d('0x2c')],'type':_0xf991b8[_0xdd3d('0x2d')]['key']};});_0x2862be[_0xdd3d('0x2e')]=_[_0xdd3d('0x2a')](_0x4104b0,'name');_0x2862be[_0xdd3d('0x2f')]=_[_0xdd3d('0x30')](_0x4d03e0[_0xdd3d('0x2f')]);_0x2862be[_0xdd3d('0x31')]=_['intersection'](_0x2862be[_0xdd3d('0x2e')],_0x2862be[_0xdd3d('0x2f')]);_0x10409d[_0xdd3d('0x32')]=_['intersection'](_0x2862be[_0xdd3d('0x2e')],qs['fields'](_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x33')]));_0x10409d[_0xdd3d('0x32')]=_0x10409d[_0xdd3d('0x32')][_0xdd3d('0x34')]?_0x10409d['attributes']:_0x2862be[_0xdd3d('0x2e')];if(!_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x35')](_0xdd3d('0x36'))){_0x10409d['limit']=qs['limit'](_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x1f')]);_0x10409d['offset']=qs[_0xdd3d('0x1d')](_0x4d03e0['query'][_0xdd3d('0x1d')]);}_0x10409d[_0xdd3d('0x37')]=qs[_0xdd3d('0x38')](_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x38')]);_0x10409d[_0xdd3d('0x39')]=qs[_0xdd3d('0x31')](_[_0xdd3d('0x3a')](_0x4d03e0[_0xdd3d('0x2f')],_0x2862be['filters']),_0x4104b0);if(_0x4d03e0[_0xdd3d('0x2f')][_0xdd3d('0x3b')]){_0x10409d[_0xdd3d('0x39')]=_[_0xdd3d('0x3c')](_0x10409d['where'],{'$or':_['map'](_0x4104b0,function(_0x391337){if(_0x391337[_0xdd3d('0x2d')]!==_0xdd3d('0x3d')){var _0x4b3d04={};_0x4b3d04[_0x391337['name']]={'$like':'%'+_0x4d03e0['query'][_0xdd3d('0x3b')]+'%'};return _0x4b3d04;}})});}_0x10409d=_['merge']({},_0x10409d,_0x4d03e0[_0xdd3d('0x3e')]);var _0x148861={'where':_0x10409d[_0xdd3d('0x39')]};return db['JscriptyQuestionReport'][_0xdd3d('0x3f')](_0x148861)['then'](function(_0x5bc5be){_0x1d86f1['count']=_0x5bc5be;if(_0x4d03e0['query'][_0xdd3d('0x40')]){_0x10409d[_0xdd3d('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xdd3d('0x42')](_0x10409d);})[_0xdd3d('0x24')](function(_0x233993){_0x1d86f1[_0xdd3d('0x43')]=_0x233993;return _0x1d86f1;})[_0xdd3d('0x24')](respondWithFilteredResult(_0x2cbd9c,_0x10409d))[_0xdd3d('0x44')](handleError(_0x2cbd9c,null));};exports['show']=function(_0xf1ac93,_0x55a0fe){var _0x43c5d8={'raw':!![],'where':{'id':_0xf1ac93[_0xdd3d('0x45')]['id']}},_0x68debd={};_0x68debd[_0xdd3d('0x2e')]=_['keys'](db[_0xdd3d('0x2b')][_0xdd3d('0x46')]);_0x68debd[_0xdd3d('0x2f')]=_[_0xdd3d('0x30')](_0xf1ac93['query']);_0x68debd[_0xdd3d('0x31')]=_[_0xdd3d('0x47')](_0x68debd[_0xdd3d('0x2e')],_0x68debd['query']);_0x43c5d8[_0xdd3d('0x32')]=_[_0xdd3d('0x47')](_0x68debd[_0xdd3d('0x2e')],qs[_0xdd3d('0x33')](_0xf1ac93[_0xdd3d('0x2f')]['fields']));_0x43c5d8['attributes']=_0x43c5d8[_0xdd3d('0x32')][_0xdd3d('0x34')]?_0x43c5d8[_0xdd3d('0x32')]:_0x68debd[_0xdd3d('0x2e')];if(_0xf1ac93['query'][_0xdd3d('0x40')]){_0x43c5d8['include']=[{'all':!![]}];}_0x43c5d8=_[_0xdd3d('0x3c')]({},_0x43c5d8,_0xf1ac93[_0xdd3d('0x3e')]);return db['JscriptyQuestionReport']['find'](_0x43c5d8)[_0xdd3d('0x24')](handleEntityNotFound(_0x55a0fe,null))[_0xdd3d('0x24')](respondWithResult(_0x55a0fe,null))[_0xdd3d('0x44')](handleError(_0x55a0fe,null));};exports[_0xdd3d('0x48')]=function(_0x33224b,_0x5eabb4){return db[_0xdd3d('0x2b')][_0xdd3d('0x48')](_0x33224b[_0xdd3d('0x49')],{})[_0xdd3d('0x24')](respondWithResult(_0x5eabb4,0xc9))[_0xdd3d('0x44')](handleError(_0x5eabb4,null));};exports['update']=function(_0x5c6171,_0x2d73bd){if(_0x5c6171[_0xdd3d('0x49')]['id']){delete _0x5c6171[_0xdd3d('0x49')]['id'];}return db[_0xdd3d('0x2b')]['find']({'where':{'id':_0x5c6171[_0xdd3d('0x45')]['id']}})[_0xdd3d('0x24')](handleEntityNotFound(_0x2d73bd,null))[_0xdd3d('0x24')](saveUpdates(_0x5c6171[_0xdd3d('0x49')],null))[_0xdd3d('0x24')](respondWithResult(_0x2d73bd,null))['catch'](handleError(_0x2d73bd,null));};exports[_0xdd3d('0x25')]=function(_0xe900b5,_0x24d207){return db['JscriptyQuestionReport'][_0xdd3d('0x4a')]({'where':{'id':_0xe900b5[_0xdd3d('0x45')]['id']}})[_0xdd3d('0x24')](handleEntityNotFound(_0x24d207,null))[_0xdd3d('0x24')](removeEntity(_0x24d207,null))[_0xdd3d('0x44')](handleError(_0x24d207,null));};exports[_0xdd3d('0x4b')]=function(_0x13e149,_0x46c7f2){return db[_0xdd3d('0x2b')][_0xdd3d('0x4b')]()[_0xdd3d('0x24')](respondWithResult(_0x46c7f2,null))[_0xdd3d('0x44')](handleError(_0x46c7f2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 5c62923..6414525 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 _0x5c8e=['lodash','util','api','bluebird','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x1e685f,_0x2eda9c){var _0x1457cc=function(_0x3d2745){while(--_0x3d2745){_0x1e685f['push'](_0x1e685f['shift']());}};_0x1457cc(++_0x2eda9c);}(_0x5c8e,0x6e));var _0xe5c8=function(_0x340c71,_0x4c2298){_0x340c71=_0x340c71-0x0;var _0x4d477=_0x5c8e[_0x340c71];return _0x4d477;};'use strict';var _=require(_0xe5c8('0x0'));var util=require(_0xe5c8('0x1'));var logger=require('../../config/logger')(_0xe5c8('0x2'));var moment=require('moment');var BPromise=require(_0xe5c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5c8('0x4'));var rimraf=require('rimraf');var config=require(_0xe5c8('0x5'));var attributes=require(_0xe5c8('0x6'));module[_0xe5c8('0x7')]=function(_0x193610,_0x5bb428){return _0x193610[_0xe5c8('0x8')](_0xe5c8('0x9'),attributes,{'tableName':_0xe5c8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07a8=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x250e00,_0x587cd6){var _0x4d9898=function(_0x4bda0a){while(--_0x4bda0a){_0x250e00['push'](_0x250e00['shift']());}};_0x4d9898(++_0x587cd6);}(_0x07a8,0x17b));var _0x807a=function(_0x894dcb,_0x3727ca){_0x894dcb=_0x894dcb-0x0;var _0x54f5c6=_0x07a8[_0x894dcb];return _0x54f5c6;};'use strict';var _=require(_0x807a('0x0'));var util=require(_0x807a('0x1'));var logger=require(_0x807a('0x2'))(_0x807a('0x3'));var moment=require(_0x807a('0x4'));var BPromise=require(_0x807a('0x5'));var rp=require(_0x807a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x807a('0x7'));var config=require(_0x807a('0x8'));var attributes=require(_0x807a('0x9'));module[_0x807a('0xa')]=function(_0xbe5f03,_0x341a73){return _0xbe5f03['define'](_0x807a('0xb'),attributes,{'tableName':_0x807a('0xc'),'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 4cb84c8..1ba9d8c 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 _0x2d03=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x452a70,_0xe8a88b){var _0x3da6c2=function(_0x21197a){while(--_0x21197a){_0x452a70['push'](_0x452a70['shift']());}};_0x3da6c2(++_0xe8a88b);}(_0x2d03,0x1ee));var _0x32d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d03[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x32d0('0x0'));var util=require(_0x32d0('0x1'));var moment=require(_0x32d0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32d0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x32d0('0x4'));var logger=require(_0x32d0('0x5'))(_0x32d0('0x6'));var config=require('../../config/environment');var jayson=require(_0x32d0('0x7'));var client=jayson[_0x32d0('0x8')][_0x32d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ba2de,_0x33b31a,_0x18432b){return new BPromise(function(_0x33cd4b,_0x17405b){return client[_0x32d0('0xa')](_0x5ba2de,_0x18432b)[_0x32d0('0xb')](function(_0x102b09){logger['info'](_0x32d0('0xc'),_0x33b31a,_0x32d0('0xd'));logger[_0x32d0('0xe')](_0x32d0('0xf'),_0x33b31a,_0x32d0('0xd'),JSON[_0x32d0('0x10')](_0x102b09));if(_0x102b09[_0x32d0('0x11')]){if(_0x102b09[_0x32d0('0x11')]['code']===0x1f4){logger['error'](_0x32d0('0xc'),_0x33b31a,_0x102b09[_0x32d0('0x11')][_0x32d0('0x12')]);return _0x17405b(_0x102b09['error'][_0x32d0('0x12')]);}logger[_0x32d0('0x11')](_0x32d0('0xc'),_0x33b31a,_0x102b09[_0x32d0('0x11')]['message']);return _0x33cd4b(_0x102b09[_0x32d0('0x11')][_0x32d0('0x12')]);}else{logger[_0x32d0('0x13')](_0x32d0('0xc'),_0x33b31a,'request\x20sent');_0x33cd4b(_0x102b09[_0x32d0('0x14')][_0x32d0('0x12')]);}})[_0x32d0('0x15')](function(_0x38b05e){logger[_0x32d0('0x11')](_0x32d0('0xc'),_0x33b31a,_0x38b05e);_0x17405b(_0x38b05e);});});} \ No newline at end of file +var _0x53ad=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1252a7,_0x242e76){var _0x4310ad=function(_0x2b803f){while(--_0x2b803f){_0x1252a7['push'](_0x1252a7['shift']());}};_0x4310ad(++_0x242e76);}(_0x53ad,0xa0));var _0xd53a=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x53ad[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xd53a('0x0'));var util=require('util');var moment=require(_0xd53a('0x1'));var BPromise=require(_0xd53a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd53a('0x3'));var db=require(_0xd53a('0x4'))['db'];var utils=require(_0xd53a('0x5'));var logger=require('../../config/logger')(_0xd53a('0x6'));var config=require('../../config/environment');var jayson=require(_0xd53a('0x7'));var client=jayson[_0xd53a('0x8')][_0xd53a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20043c,_0x2c44af,_0x3b0426){return new BPromise(function(_0x95331f,_0x2993ec){return client[_0xd53a('0xa')](_0x20043c,_0x3b0426)[_0xd53a('0xb')](function(_0x46cd14){logger[_0xd53a('0xc')](_0xd53a('0xd'),_0x2c44af,_0xd53a('0xe'));logger[_0xd53a('0xf')](_0xd53a('0x10'),_0x2c44af,_0xd53a('0xe'),JSON[_0xd53a('0x11')](_0x46cd14));if(_0x46cd14[_0xd53a('0x12')]){if(_0x46cd14['error'][_0xd53a('0x13')]===0x1f4){logger['error'](_0xd53a('0xd'),_0x2c44af,_0x46cd14[_0xd53a('0x12')][_0xd53a('0x14')]);return _0x2993ec(_0x46cd14[_0xd53a('0x12')][_0xd53a('0x14')]);}logger[_0xd53a('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2c44af,_0x46cd14['error']['message']);return _0x95331f(_0x46cd14[_0xd53a('0x12')][_0xd53a('0x14')]);}else{logger['info'](_0xd53a('0xd'),_0x2c44af,'request\x20sent');_0x95331f(_0x46cd14[_0xd53a('0x15')][_0xd53a('0x14')]);}})[_0xd53a('0x16')](function(_0xc6c2be){logger[_0xd53a('0x12')](_0xd53a('0xd'),_0x2c44af,_0xc6c2be);_0x2993ec(_0xc6c2be);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 3a9ab8d..cbb6b6b 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 _0x4a3e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','/:id/questions','getQuestions','post','create','put','update','multer'];(function(_0x41c15a,_0x1d10f1){var _0xf671f1=function(_0x1aed49){while(--_0x1aed49){_0x41c15a['push'](_0x41c15a['shift']());}};_0xf671f1(++_0x1d10f1);}(_0x4a3e,0xef));var _0xe4a3=function(_0x3d8836,_0x407d2c){_0x3d8836=_0x3d8836-0x0;var _0x173f72=_0x4a3e[_0x3d8836];return _0x173f72;};'use strict';var multer=require(_0xe4a3('0x0'));var util=require('util');var path=require(_0xe4a3('0x1'));var timeout=require(_0xe4a3('0x2'));var express=require(_0xe4a3('0x3'));var router=express[_0xe4a3('0x4')]();var fs_extra=require(_0xe4a3('0x5'));var auth=require(_0xe4a3('0x6'));var interaction=require(_0xe4a3('0x7'));var config=require('../../config/environment');var controller=require(_0xe4a3('0x8'));router[_0xe4a3('0x9')]('/',auth[_0xe4a3('0xa')](),controller[_0xe4a3('0xb')]);router[_0xe4a3('0x9')]('/describe',auth[_0xe4a3('0xa')](),controller[_0xe4a3('0xc')]);router['get'](_0xe4a3('0xd'),auth[_0xe4a3('0xa')](),controller['show']);router[_0xe4a3('0x9')](_0xe4a3('0xe'),auth[_0xe4a3('0xa')](),controller[_0xe4a3('0xf')]);router[_0xe4a3('0x10')]('/',auth[_0xe4a3('0xa')](),controller[_0xe4a3('0x11')]);router[_0xe4a3('0x12')]('/:id',auth[_0xe4a3('0xa')](),controller[_0xe4a3('0x13')]);router['delete'](_0xe4a3('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0706=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x82b961,_0x56d40b){var _0x32728d=function(_0x954c31){while(--_0x954c31){_0x82b961['push'](_0x82b961['shift']());}};_0x32728d(++_0x56d40b);}(_0x0706,0xef));var _0x6070=function(_0x14da2e,_0x1a8186){_0x14da2e=_0x14da2e-0x0;var _0x19459b=_0x0706[_0x14da2e];return _0x19459b;};'use strict';var multer=require(_0x6070('0x0'));var util=require(_0x6070('0x1'));var path=require(_0x6070('0x2'));var timeout=require('connect-timeout');var express=require(_0x6070('0x3'));var router=express[_0x6070('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6070('0x5'));var interaction=require(_0x6070('0x6'));var config=require(_0x6070('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x6070('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6070('0x8')](_0x6070('0x9'),auth[_0x6070('0xa')](),controller[_0x6070('0xb')]);router[_0x6070('0x8')](_0x6070('0xc'),auth[_0x6070('0xa')](),controller['show']);router[_0x6070('0x8')](_0x6070('0xd'),auth[_0x6070('0xa')](),controller[_0x6070('0xe')]);router[_0x6070('0xf')]('/',auth[_0x6070('0xa')](),controller[_0x6070('0x10')]);router[_0x6070('0x11')]('/:id',auth[_0x6070('0xa')](),controller[_0x6070('0x12')]);router[_0x6070('0x13')](_0x6070('0xc'),auth[_0x6070('0xa')](),controller[_0x6070('0x14')]);module[_0x6070('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9329d1d..51aba4d 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 _0xa997=['sequelize','exports','DATE','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x331abf,_0x20c56d){var _0x29abb5=function(_0x54675b){while(--_0x54675b){_0x331abf['push'](_0x331abf['shift']());}};_0x29abb5(++_0x20c56d);}(_0xa997,0x15e));var _0x7a99=function(_0x20dd9b,_0x3c0fb8){_0x20dd9b=_0x20dd9b-0x0;var _0x2de3b0=_0xa997[_0x20dd9b];return _0x2de3b0;};'use strict';var moment=require(_0x7a99('0x0'));var Sequelize=require(_0x7a99('0x1'));module[_0x7a99('0x2')]={'starttime':{'type':Sequelize[_0x7a99('0x3')],'set':function(_0x3777e8){this['setDataValue']('starttime',_0x3777e8);this[_0x7a99('0x4')]('endtime',moment()[_0x7a99('0x5')](_0x7a99('0x6')));}},'endtime':{'type':Sequelize[_0x7a99('0x3')]},'membername':{'type':Sequelize[_0x7a99('0x7')]},'projectname':{'type':Sequelize[_0x7a99('0x7')]},'queue':{'type':Sequelize[_0x7a99('0x7')]},'uniqueid':{'type':Sequelize[_0x7a99('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7a99('0x7')]},'completed':{'type':Sequelize[_0x7a99('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x0007=['YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','format'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0007,0x1ee));var _0x7000=function(_0x2442dd,_0x269ded){_0x2442dd=_0x2442dd-0x0;var _0x9d4594=_0x0007[_0x2442dd];return _0x9d4594;};'use strict';var moment=require(_0x7000('0x0'));var Sequelize=require(_0x7000('0x1'));module[_0x7000('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x704959){this[_0x7000('0x3')](_0x7000('0x4'),_0x704959);this[_0x7000('0x3')]('endtime',moment()[_0x7000('0x5')](_0x7000('0x6')));}},'endtime':{'type':Sequelize[_0x7000('0x7')]},'membername':{'type':Sequelize[_0x7000('0x8')]},'projectname':{'type':Sequelize[_0x7000('0x8')]},'queue':{'type':Sequelize[_0x7000('0x8')]},'uniqueid':{'type':Sequelize[_0x7000('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7000('0x8')]},'completed':{'type':Sequelize[_0x7000('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 046e46a..43b6183 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 _0x31b3=['VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','find','body','describe','getQuestions','findOne','JscriptyQuestionReport','order','sort','options','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge'];(function(_0x1061c5,_0x5a377b){var _0x3dcb74=function(_0x2aad94){while(--_0x2aad94){_0x1061c5['push'](_0x1061c5['shift']());}};_0x3dcb74(++_0x5a377b);}(_0x31b3,0x13e));var _0x331b=function(_0x5b6828,_0x4a19d9){_0x5b6828=_0x5b6828-0x0;var _0x2dbd2c=_0x31b3[_0x5b6828];return _0x2dbd2c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x331b('0x0'));var jsonpatch=require(_0x331b('0x1'));var rp=require(_0x331b('0x2'));var moment=require(_0x331b('0x3'));var BPromise=require(_0x331b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x331b('0x5'));var sox=require(_0x331b('0x6'));var csv=require(_0x331b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x331b('0x8'));var _=require(_0x331b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x331b('0xa'));var deskjs=require(_0x331b('0xb'));var toCsv=require(_0x331b('0x7'));var querystring=require(_0x331b('0xc'));var Papa=require('papaparse');var Redis=require(_0x331b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x331b('0xe'));var as=require(_0x331b('0xf'));var hardwareService=require(_0x331b('0x10'));var logger=require(_0x331b('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x331b('0x12'))['db'];function respondWithStatusCode(_0x1954d2,_0x422246){_0x422246=_0x422246||0xcc;return function(_0x17ad51){if(_0x17ad51){return _0x1954d2[_0x331b('0x13')](_0x422246);}return _0x1954d2['status'](_0x422246)[_0x331b('0x14')]();};}function respondWithResult(_0x410830,_0x5a1ff3){_0x5a1ff3=_0x5a1ff3||0xc8;return function(_0x46c11e){if(_0x46c11e){return _0x410830[_0x331b('0x15')](_0x5a1ff3)[_0x331b('0x16')](_0x46c11e);}};}function respondWithFilteredResult(_0x32884f,_0x1fa680){return function(_0x520f2e){if(_0x520f2e){var _0x20f737=typeof _0x1fa680[_0x331b('0x17')]===_0x331b('0x18')&&typeof _0x1fa680[_0x331b('0x19')]==='undefined';var _0x409ca1=_0x520f2e[_0x331b('0x1a')];var _0x403123=_0x20f737?0x0:_0x1fa680[_0x331b('0x17')];var _0x2fcf87=_0x20f737?_0x520f2e[_0x331b('0x1a')]:_0x1fa680[_0x331b('0x17')]+_0x1fa680[_0x331b('0x19')];var _0x5e4de7;if(_0x2fcf87>=_0x409ca1){_0x2fcf87=_0x409ca1;_0x5e4de7=0xc8;}else{_0x5e4de7=0xce;}_0x32884f[_0x331b('0x15')](_0x5e4de7);return _0x32884f['set'](_0x331b('0x1b'),_0x403123+'-'+_0x2fcf87+'/'+_0x409ca1)[_0x331b('0x16')](_0x520f2e);}return null;};}function patchUpdates(_0x5e5d35){return function(_0x513fd2){try{jsonpatch[_0x331b('0x1c')](_0x513fd2,_0x5e5d35,!![]);}catch(_0x14d63e){return BPromise[_0x331b('0x1d')](_0x14d63e);}return _0x513fd2[_0x331b('0x1e')]();};}function saveUpdates(_0x123868,_0x5e70d9){return function(_0x11ce7f){if(_0x11ce7f){return _0x11ce7f[_0x331b('0x1f')](_0x123868)['then'](function(_0x3cb930){return _0x3cb930;});}return null;};}function removeEntity(_0x441e03,_0x36b36f){return function(_0xe7cba2){if(_0xe7cba2){return _0xe7cba2[_0x331b('0x20')]()[_0x331b('0x21')](function(){_0x441e03[_0x331b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c5a0e,_0x395b5e){return function(_0x5026f3){if(!_0x5026f3){_0x5c5a0e[_0x331b('0x13')](0x194);}return _0x5026f3;};}function handleError(_0x437546,_0x2d4360){_0x2d4360=_0x2d4360||0x1f4;return function(_0x3c7e5f){logger[_0x331b('0x22')](_0x3c7e5f[_0x331b('0x23')]);if(_0x3c7e5f['name']){delete _0x3c7e5f[_0x331b('0x24')];}_0x437546[_0x331b('0x15')](_0x2d4360)['send'](_0x3c7e5f);};}exports[_0x331b('0x25')]=function(_0x3c2686,_0x5d0a49){var _0x4b4e51={},_0x516c70={},_0x29f8b1={'count':0x0,'rows':[]};var _0x242786=_[_0x331b('0x26')](db[_0x331b('0x27')][_0x331b('0x28')],function(_0x160e21){return{'name':_0x160e21[_0x331b('0x29')],'type':_0x160e21[_0x331b('0x2a')][_0x331b('0x2b')]};});_0x516c70['model']=_['map'](_0x242786,_0x331b('0x24'));_0x516c70[_0x331b('0x2c')]=_[_0x331b('0x2d')](_0x3c2686[_0x331b('0x2c')]);_0x516c70['filters']=_[_0x331b('0x2e')](_0x516c70[_0x331b('0x2f')],_0x516c70[_0x331b('0x2c')]);_0x4b4e51[_0x331b('0x30')]=_['intersection'](_0x516c70['model'],qs['fields'](_0x3c2686[_0x331b('0x2c')]['fields']));_0x4b4e51['attributes']=_0x4b4e51[_0x331b('0x30')][_0x331b('0x31')]?_0x4b4e51['attributes']:_0x516c70[_0x331b('0x2f')];if(!_0x3c2686['query'][_0x331b('0x32')](_0x331b('0x33'))){_0x4b4e51[_0x331b('0x19')]=qs['limit'](_0x3c2686[_0x331b('0x2c')][_0x331b('0x19')]);_0x4b4e51[_0x331b('0x17')]=qs[_0x331b('0x17')](_0x3c2686[_0x331b('0x2c')][_0x331b('0x17')]);}_0x4b4e51['order']=qs['sort'](_0x3c2686['query']['sort']);_0x4b4e51[_0x331b('0x34')]=qs[_0x331b('0x35')](_[_0x331b('0x36')](_0x3c2686['query'],_0x516c70[_0x331b('0x35')]),_0x242786);if(_0x3c2686[_0x331b('0x2c')][_0x331b('0x37')]){_0x4b4e51[_0x331b('0x34')]=_[_0x331b('0x38')](_0x4b4e51[_0x331b('0x34')],{'$or':_[_0x331b('0x26')](_0x242786,function(_0x54477e){if(_0x54477e[_0x331b('0x2a')]!==_0x331b('0x39')){var _0xf6d565={};_0xf6d565[_0x54477e['name']]={'$like':'%'+_0x3c2686['query'][_0x331b('0x37')]+'%'};return _0xf6d565;}})});}_0x4b4e51=_[_0x331b('0x38')]({},_0x4b4e51,_0x3c2686['options']);var _0x1bc16e={'where':_0x4b4e51['where']};return db['JscriptySessionReport'][_0x331b('0x1a')](_0x1bc16e)[_0x331b('0x21')](function(_0xe24fe1){_0x29f8b1[_0x331b('0x1a')]=_0xe24fe1;if(_0x3c2686['query'][_0x331b('0x3a')]){_0x4b4e51[_0x331b('0x3b')]=[{'all':!![]}];}return db[_0x331b('0x27')][_0x331b('0x3c')](_0x4b4e51);})[_0x331b('0x21')](function(_0x43fe87){_0x29f8b1[_0x331b('0x3d')]=_0x43fe87;return _0x29f8b1;})['then'](respondWithFilteredResult(_0x5d0a49,_0x4b4e51))[_0x331b('0x3e')](handleError(_0x5d0a49,null));};exports[_0x331b('0x3f')]=function(_0x324cc3,_0x32a833){var _0x2f5b72={'raw':!![],'where':{'id':_0x324cc3[_0x331b('0x40')]['id']}},_0x7c2279={};_0x7c2279[_0x331b('0x2f')]=_[_0x331b('0x2d')](db[_0x331b('0x27')]['rawAttributes']);_0x7c2279[_0x331b('0x2c')]=_['keys'](_0x324cc3[_0x331b('0x2c')]);_0x7c2279[_0x331b('0x35')]=_[_0x331b('0x2e')](_0x7c2279[_0x331b('0x2f')],_0x7c2279['query']);_0x2f5b72[_0x331b('0x30')]=_[_0x331b('0x2e')](_0x7c2279['model'],qs['fields'](_0x324cc3[_0x331b('0x2c')][_0x331b('0x41')]));_0x2f5b72[_0x331b('0x30')]=_0x2f5b72[_0x331b('0x30')][_0x331b('0x31')]?_0x2f5b72[_0x331b('0x30')]:_0x7c2279['model'];if(_0x324cc3[_0x331b('0x2c')][_0x331b('0x3a')]){_0x2f5b72[_0x331b('0x3b')]=[{'all':!![]}];}_0x2f5b72=_['merge']({},_0x2f5b72,_0x324cc3['options']);return db['JscriptySessionReport'][_0x331b('0x42')](_0x2f5b72)[_0x331b('0x21')](handleEntityNotFound(_0x32a833,null))[_0x331b('0x21')](respondWithResult(_0x32a833,null))['catch'](handleError(_0x32a833,null));};exports['create']=function(_0x14704e,_0x1c692b){return db[_0x331b('0x27')]['create'](_0x14704e[_0x331b('0x43')],{})[_0x331b('0x21')](respondWithResult(_0x1c692b,0xc9))[_0x331b('0x3e')](handleError(_0x1c692b,null));};exports['update']=function(_0x54e81d,_0x3305b2){if(_0x54e81d[_0x331b('0x43')]['id']){delete _0x54e81d[_0x331b('0x43')]['id'];}return db[_0x331b('0x27')][_0x331b('0x42')]({'where':{'id':_0x54e81d[_0x331b('0x40')]['id']}})[_0x331b('0x21')](handleEntityNotFound(_0x3305b2,null))[_0x331b('0x21')](saveUpdates(_0x54e81d['body'],null))[_0x331b('0x21')](respondWithResult(_0x3305b2,null))[_0x331b('0x3e')](handleError(_0x3305b2,null));};exports['destroy']=function(_0xd1a55d,_0x59ad3b){return db['JscriptySessionReport'][_0x331b('0x42')]({'where':{'id':_0xd1a55d['params']['id']}})[_0x331b('0x21')](handleEntityNotFound(_0x59ad3b,null))[_0x331b('0x21')](removeEntity(_0x59ad3b,null))[_0x331b('0x3e')](handleError(_0x59ad3b,null));};exports[_0x331b('0x44')]=function(_0x597fc0,_0x1c073b){return db[_0x331b('0x27')][_0x331b('0x44')]()[_0x331b('0x21')](respondWithResult(_0x1c073b,null))[_0x331b('0x3e')](handleError(_0x1c073b,null));};exports[_0x331b('0x45')]=function(_0x248c8b,_0x2c281b,_0x31280e){var _0x135001={'raw':!![],'where':{}};var _0x23849e={};var _0x4b12a2={'count':0x0,'rows':[]};return db[_0x331b('0x27')][_0x331b('0x46')]({'where':{'id':_0x248c8b[_0x331b('0x40')]['id']}})[_0x331b('0x21')](handleEntityNotFound(_0x2c281b,null))['then'](function(_0x51078a){if(_0x51078a){_0x23849e['model']=_['keys'](db[_0x331b('0x47')][_0x331b('0x28')]);_0x23849e[_0x331b('0x2c')]=_[_0x331b('0x2d')](_0x248c8b[_0x331b('0x2c')]);_0x23849e[_0x331b('0x35')]=_[_0x331b('0x2e')](_0x23849e[_0x331b('0x2f')],_0x23849e[_0x331b('0x2c')]);_0x135001[_0x331b('0x30')]=_[_0x331b('0x2e')](_0x23849e[_0x331b('0x2f')],qs['fields'](_0x248c8b[_0x331b('0x2c')][_0x331b('0x41')]));_0x135001[_0x331b('0x30')]=_0x135001[_0x331b('0x30')]['length']?_0x135001[_0x331b('0x30')]:_0x23849e['model'];if(!_0x248c8b[_0x331b('0x2c')][_0x331b('0x32')](_0x331b('0x33'))){_0x135001[_0x331b('0x19')]=qs[_0x331b('0x19')](_0x248c8b[_0x331b('0x2c')]['limit']);_0x135001[_0x331b('0x17')]=qs[_0x331b('0x17')](_0x248c8b[_0x331b('0x2c')][_0x331b('0x17')]);}_0x135001[_0x331b('0x48')]=qs['sort'](_0x248c8b['query'][_0x331b('0x49')]);_0x135001[_0x331b('0x34')]=qs[_0x331b('0x35')](_[_0x331b('0x36')](_0x248c8b[_0x331b('0x2c')],_0x23849e['filters']));_0x135001['where']['SessionId']=_0x51078a['id'];if(_0x248c8b[_0x331b('0x2c')][_0x331b('0x37')]){_0x135001[_0x331b('0x34')]=_[_0x331b('0x38')](_0x135001['where'],{'$or':_[_0x331b('0x26')](_0x135001['attributes'],function(_0x3930e1){var _0x49e84f={};_0x49e84f[_0x3930e1]={'$like':'%'+_0x248c8b[_0x331b('0x2c')]['filter']+'%'};return _0x49e84f;})});}_0x135001=_[_0x331b('0x38')]({},_0x135001,_0x248c8b[_0x331b('0x4a')]);return db[_0x331b('0x47')][_0x331b('0x1a')]({'where':_0x135001[_0x331b('0x34')]})['then'](function(_0x568d3e){_0x4b12a2[_0x331b('0x1a')]=_0x568d3e;if(_0x248c8b[_0x331b('0x2c')]['includeAll']){_0x135001[_0x331b('0x3b')]=[{'all':!![]}];}return db[_0x331b('0x47')][_0x331b('0x3c')](_0x135001);})['then'](function(_0x1ef048){_0x4b12a2[_0x331b('0x3d')]=_0x1ef048;return _0x4b12a2;});}})[_0x331b('0x21')](respondWithFilteredResult(_0x2c281b,_0x135001))[_0x331b('0x3e')](handleError(_0x2c281b,null));}; \ No newline at end of file +var _0x5567=['fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','update','params','describe','getQuestions','JscriptyQuestionReport','sort','pick','SessionId','filter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','send','index','map','JscriptySessionReport'];(function(_0x54d285,_0x454de7){var _0x1cc0c5=function(_0x1ee50f){while(--_0x1ee50f){_0x54d285['push'](_0x54d285['shift']());}};_0x1cc0c5(++_0x454de7);}(_0x5567,0x11c));var _0x7556=function(_0x2bff66,_0x15e26d){_0x2bff66=_0x2bff66-0x0;var _0x57dee3=_0x5567[_0x2bff66];return _0x57dee3;};'use strict';var emlformat=require(_0x7556('0x0'));var rimraf=require(_0x7556('0x1'));var zipdir=require(_0x7556('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7556('0x3'));var moment=require(_0x7556('0x4'));var BPromise=require(_0x7556('0x5'));var Mustache=require(_0x7556('0x6'));var util=require('util');var path=require(_0x7556('0x7'));var sox=require(_0x7556('0x8'));var csv=require(_0x7556('0x9'));var ejs=require(_0x7556('0xa'));var fs=require('fs');var fs_extra=require(_0x7556('0xb'));var _=require('lodash');var squel=require(_0x7556('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7556('0xd'));var toCsv=require(_0x7556('0x9'));var querystring=require(_0x7556('0xe'));var Papa=require(_0x7556('0xf'));var Redis=require('ioredis');var authService=require(_0x7556('0x10'));var qs=require(_0x7556('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7556('0x12'));var logger=require(_0x7556('0x13'))(_0x7556('0x14'));var utils=require(_0x7556('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7556('0x16'));var db=require(_0x7556('0x17'))['db'];function respondWithStatusCode(_0x3d897d,_0x4c4133){_0x4c4133=_0x4c4133||0xcc;return function(_0x531e79){if(_0x531e79){return _0x3d897d[_0x7556('0x18')](_0x4c4133);}return _0x3d897d[_0x7556('0x19')](_0x4c4133)[_0x7556('0x1a')]();};}function respondWithResult(_0x1d8e2f,_0x59bcb4){_0x59bcb4=_0x59bcb4||0xc8;return function(_0x44f7b2){if(_0x44f7b2){return _0x1d8e2f['status'](_0x59bcb4)[_0x7556('0x1b')](_0x44f7b2);}};}function respondWithFilteredResult(_0x5b20b4,_0x286851){return function(_0xee0b69){if(_0xee0b69){var _0x4af02b=typeof _0x286851['offset']===_0x7556('0x1c')&&typeof _0x286851[_0x7556('0x1d')]==='undefined';var _0x29c40e=_0xee0b69[_0x7556('0x1e')];var _0x1aaf80=_0x4af02b?0x0:_0x286851[_0x7556('0x1f')];var _0x3d85b6=_0x4af02b?_0xee0b69[_0x7556('0x1e')]:_0x286851['offset']+_0x286851['limit'];var _0x489f1e;if(_0x3d85b6>=_0x29c40e){_0x3d85b6=_0x29c40e;_0x489f1e=0xc8;}else{_0x489f1e=0xce;}_0x5b20b4['status'](_0x489f1e);return _0x5b20b4['set'](_0x7556('0x20'),_0x1aaf80+'-'+_0x3d85b6+'/'+_0x29c40e)['json'](_0xee0b69);}return null;};}function patchUpdates(_0x384b17){return function(_0x3f5c10){try{jsonpatch[_0x7556('0x21')](_0x3f5c10,_0x384b17,!![]);}catch(_0x4dd531){return BPromise[_0x7556('0x22')](_0x4dd531);}return _0x3f5c10[_0x7556('0x23')]();};}function saveUpdates(_0x1417eb,_0x43379a){return function(_0x53a35c){if(_0x53a35c){return _0x53a35c['update'](_0x1417eb)['then'](function(_0x1b8e32){return _0x1b8e32;});}return null;};}function removeEntity(_0x588b5d,_0x5bb572){return function(_0x1bb3bb){if(_0x1bb3bb){return _0x1bb3bb[_0x7556('0x24')]()[_0x7556('0x25')](function(){_0x588b5d[_0x7556('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7097,_0x12c42a){return function(_0x446dd2){if(!_0x446dd2){_0x4a7097[_0x7556('0x18')](0x194);}return _0x446dd2;};}function handleError(_0x9ab9f9,_0x38750a){_0x38750a=_0x38750a||0x1f4;return function(_0xe859d3){logger[_0x7556('0x26')](_0xe859d3[_0x7556('0x27')]);if(_0xe859d3['name']){delete _0xe859d3['name'];}_0x9ab9f9[_0x7556('0x19')](_0x38750a)[_0x7556('0x28')](_0xe859d3);};}exports[_0x7556('0x29')]=function(_0x1e6823,_0x560eef){var _0x307d21={},_0x3fd5fd={},_0x265306={'count':0x0,'rows':[]};var _0x4025dd=_[_0x7556('0x2a')](db[_0x7556('0x2b')]['rawAttributes'],function(_0x3d395f){return{'name':_0x3d395f[_0x7556('0x2c')],'type':_0x3d395f[_0x7556('0x2d')][_0x7556('0x2e')]};});_0x3fd5fd[_0x7556('0x2f')]=_[_0x7556('0x2a')](_0x4025dd,_0x7556('0x30'));_0x3fd5fd[_0x7556('0x31')]=_['keys'](_0x1e6823[_0x7556('0x31')]);_0x3fd5fd[_0x7556('0x32')]=_[_0x7556('0x33')](_0x3fd5fd['model'],_0x3fd5fd[_0x7556('0x31')]);_0x307d21[_0x7556('0x34')]=_[_0x7556('0x33')](_0x3fd5fd[_0x7556('0x2f')],qs[_0x7556('0x35')](_0x1e6823[_0x7556('0x31')][_0x7556('0x35')]));_0x307d21[_0x7556('0x34')]=_0x307d21[_0x7556('0x34')][_0x7556('0x36')]?_0x307d21[_0x7556('0x34')]:_0x3fd5fd['model'];if(!_0x1e6823[_0x7556('0x31')][_0x7556('0x37')](_0x7556('0x38'))){_0x307d21[_0x7556('0x1d')]=qs[_0x7556('0x1d')](_0x1e6823[_0x7556('0x31')][_0x7556('0x1d')]);_0x307d21[_0x7556('0x1f')]=qs['offset'](_0x1e6823['query'][_0x7556('0x1f')]);}_0x307d21[_0x7556('0x39')]=qs['sort'](_0x1e6823[_0x7556('0x31')]['sort']);_0x307d21['where']=qs[_0x7556('0x32')](_['pick'](_0x1e6823[_0x7556('0x31')],_0x3fd5fd[_0x7556('0x32')]),_0x4025dd);if(_0x1e6823[_0x7556('0x31')]['filter']){_0x307d21[_0x7556('0x3a')]=_['merge'](_0x307d21[_0x7556('0x3a')],{'$or':_[_0x7556('0x2a')](_0x4025dd,function(_0x5a2783){if(_0x5a2783[_0x7556('0x2d')]!==_0x7556('0x3b')){var _0x2fd954={};_0x2fd954[_0x5a2783[_0x7556('0x30')]]={'$like':'%'+_0x1e6823['query']['filter']+'%'};return _0x2fd954;}})});}_0x307d21=_[_0x7556('0x3c')]({},_0x307d21,_0x1e6823[_0x7556('0x3d')]);var _0x2d84b2={'where':_0x307d21[_0x7556('0x3a')]};return db[_0x7556('0x2b')][_0x7556('0x1e')](_0x2d84b2)[_0x7556('0x25')](function(_0x26f4f2){_0x265306[_0x7556('0x1e')]=_0x26f4f2;if(_0x1e6823['query'][_0x7556('0x3e')]){_0x307d21[_0x7556('0x3f')]=[{'all':!![]}];}return db[_0x7556('0x2b')][_0x7556('0x40')](_0x307d21);})[_0x7556('0x25')](function(_0x39d3d1){_0x265306[_0x7556('0x41')]=_0x39d3d1;return _0x265306;})[_0x7556('0x25')](respondWithFilteredResult(_0x560eef,_0x307d21))[_0x7556('0x42')](handleError(_0x560eef,null));};exports[_0x7556('0x43')]=function(_0x5b29e1,_0x1a9332){var _0x1dd06b={'raw':!![],'where':{'id':_0x5b29e1['params']['id']}},_0x545f90={};_0x545f90[_0x7556('0x2f')]=_[_0x7556('0x44')](db[_0x7556('0x2b')][_0x7556('0x45')]);_0x545f90['query']=_[_0x7556('0x44')](_0x5b29e1[_0x7556('0x31')]);_0x545f90[_0x7556('0x32')]=_[_0x7556('0x33')](_0x545f90[_0x7556('0x2f')],_0x545f90[_0x7556('0x31')]);_0x1dd06b['attributes']=_[_0x7556('0x33')](_0x545f90[_0x7556('0x2f')],qs['fields'](_0x5b29e1[_0x7556('0x31')][_0x7556('0x35')]));_0x1dd06b[_0x7556('0x34')]=_0x1dd06b[_0x7556('0x34')]['length']?_0x1dd06b['attributes']:_0x545f90[_0x7556('0x2f')];if(_0x5b29e1[_0x7556('0x31')][_0x7556('0x3e')]){_0x1dd06b['include']=[{'all':!![]}];}_0x1dd06b=_['merge']({},_0x1dd06b,_0x5b29e1[_0x7556('0x3d')]);return db[_0x7556('0x2b')][_0x7556('0x46')](_0x1dd06b)[_0x7556('0x25')](handleEntityNotFound(_0x1a9332,null))[_0x7556('0x25')](respondWithResult(_0x1a9332,null))[_0x7556('0x42')](handleError(_0x1a9332,null));};exports[_0x7556('0x47')]=function(_0x4d290c,_0x3055f3){return db[_0x7556('0x2b')][_0x7556('0x47')](_0x4d290c[_0x7556('0x48')],{})[_0x7556('0x25')](respondWithResult(_0x3055f3,0xc9))['catch'](handleError(_0x3055f3,null));};exports[_0x7556('0x49')]=function(_0x466cfc,_0x279d75){if(_0x466cfc[_0x7556('0x48')]['id']){delete _0x466cfc[_0x7556('0x48')]['id'];}return db['JscriptySessionReport'][_0x7556('0x46')]({'where':{'id':_0x466cfc[_0x7556('0x4a')]['id']}})[_0x7556('0x25')](handleEntityNotFound(_0x279d75,null))[_0x7556('0x25')](saveUpdates(_0x466cfc[_0x7556('0x48')],null))[_0x7556('0x25')](respondWithResult(_0x279d75,null))['catch'](handleError(_0x279d75,null));};exports[_0x7556('0x24')]=function(_0x579e59,_0x4381ce){return db[_0x7556('0x2b')][_0x7556('0x46')]({'where':{'id':_0x579e59['params']['id']}})[_0x7556('0x25')](handleEntityNotFound(_0x4381ce,null))[_0x7556('0x25')](removeEntity(_0x4381ce,null))[_0x7556('0x42')](handleError(_0x4381ce,null));};exports[_0x7556('0x4b')]=function(_0x424a85,_0x55d25c){return db[_0x7556('0x2b')]['describe']()[_0x7556('0x25')](respondWithResult(_0x55d25c,null))[_0x7556('0x42')](handleError(_0x55d25c,null));};exports[_0x7556('0x4c')]=function(_0x58e5d6,_0x34f539,_0x160ff2){var _0x3e15fa={'raw':!![],'where':{}};var _0x254d83={};var _0x38776b={'count':0x0,'rows':[]};return db[_0x7556('0x2b')]['findOne']({'where':{'id':_0x58e5d6[_0x7556('0x4a')]['id']}})['then'](handleEntityNotFound(_0x34f539,null))['then'](function(_0x277220){if(_0x277220){_0x254d83[_0x7556('0x2f')]=_[_0x7556('0x44')](db[_0x7556('0x4d')][_0x7556('0x45')]);_0x254d83[_0x7556('0x31')]=_[_0x7556('0x44')](_0x58e5d6['query']);_0x254d83['filters']=_[_0x7556('0x33')](_0x254d83[_0x7556('0x2f')],_0x254d83[_0x7556('0x31')]);_0x3e15fa[_0x7556('0x34')]=_[_0x7556('0x33')](_0x254d83[_0x7556('0x2f')],qs[_0x7556('0x35')](_0x58e5d6['query'][_0x7556('0x35')]));_0x3e15fa[_0x7556('0x34')]=_0x3e15fa[_0x7556('0x34')]['length']?_0x3e15fa[_0x7556('0x34')]:_0x254d83[_0x7556('0x2f')];if(!_0x58e5d6[_0x7556('0x31')]['hasOwnProperty']('nolimit')){_0x3e15fa[_0x7556('0x1d')]=qs[_0x7556('0x1d')](_0x58e5d6[_0x7556('0x31')][_0x7556('0x1d')]);_0x3e15fa['offset']=qs['offset'](_0x58e5d6[_0x7556('0x31')][_0x7556('0x1f')]);}_0x3e15fa[_0x7556('0x39')]=qs['sort'](_0x58e5d6[_0x7556('0x31')][_0x7556('0x4e')]);_0x3e15fa[_0x7556('0x3a')]=qs[_0x7556('0x32')](_[_0x7556('0x4f')](_0x58e5d6['query'],_0x254d83[_0x7556('0x32')]));_0x3e15fa[_0x7556('0x3a')][_0x7556('0x50')]=_0x277220['id'];if(_0x58e5d6[_0x7556('0x31')][_0x7556('0x51')]){_0x3e15fa[_0x7556('0x3a')]=_[_0x7556('0x3c')](_0x3e15fa[_0x7556('0x3a')],{'$or':_[_0x7556('0x2a')](_0x3e15fa[_0x7556('0x34')],function(_0x39c493){var _0x44b11f={};_0x44b11f[_0x39c493]={'$like':'%'+_0x58e5d6[_0x7556('0x31')]['filter']+'%'};return _0x44b11f;})});}_0x3e15fa=_[_0x7556('0x3c')]({},_0x3e15fa,_0x58e5d6[_0x7556('0x3d')]);return db[_0x7556('0x4d')]['count']({'where':_0x3e15fa['where']})[_0x7556('0x25')](function(_0x2470f7){_0x38776b['count']=_0x2470f7;if(_0x58e5d6[_0x7556('0x31')][_0x7556('0x3e')]){_0x3e15fa[_0x7556('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7556('0x40')](_0x3e15fa);})[_0x7556('0x25')](function(_0x520930){_0x38776b[_0x7556('0x41')]=_0x520930;return _0x38776b;});}})[_0x7556('0x25')](respondWithFilteredResult(_0x34f539,_0x3e15fa))[_0x7556('0x42')](handleError(_0x34f539,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 3db43ff..218e7df 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 _0xdc97=['path','../../config/environment','./jscriptySessionReport.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x44e7b9,_0xf7f5cc){var _0x1de7ac=function(_0x307551){while(--_0x307551){_0x44e7b9['push'](_0x44e7b9['shift']());}};_0x1de7ac(++_0xf7f5cc);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3ffd91,_0x2c5edd){_0x3ffd91=_0x3ffd91-0x0;var _0x738fa5=_0xdc97[_0x3ffd91];return _0x738fa5;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['lodash','api','moment','bluebird','request-promise','path','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions'];(function(_0x32715c,_0x317ddb){var _0x101baf=function(_0x20db55){while(--_0x20db55){_0x32715c['push'](_0x32715c['shift']());}};_0x101baf(++_0x317ddb);}(_0x1623,0xab));var _0x3162=function(_0x184d85,_0x36491a){_0x184d85=_0x184d85-0x0;var _0x22814a=_0x1623[_0x184d85];return _0x22814a;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'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 bd0a19d..f066caf 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 _0x0424=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x0424,0x159));var _0x4042=function(_0x2dfd28,_0x153b3c){_0x2dfd28=_0x2dfd28-0x0;var _0x49c016=_0x0424[_0x2dfd28];return _0x49c016;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});} \ No newline at end of file +var _0x6455=['client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5f4720,_0x1b3681){var _0x547b28=function(_0x2eddc1){while(--_0x2eddc1){_0x5f4720['push'](_0x5f4720['shift']());}};_0x547b28(++_0x1b3681);}(_0x6455,0x97));var _0x5645=function(_0x461448,_0x371e6d){_0x461448=_0x461448-0x0;var _0x3968fe=_0x6455[_0x461448];return _0x3968fe;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d672,_0xa14a06,_0x278d86){return new BPromise(function(_0x518a28,_0x5f4037){return client[_0x5645('0xc')](_0x37d672,_0x278d86)[_0x5645('0xd')](function(_0x38c07a){logger[_0x5645('0xe')](_0x5645('0xf'),_0xa14a06,_0x5645('0x10'));logger['debug'](_0x5645('0x11'),_0xa14a06,_0x5645('0x10'),JSON[_0x5645('0x12')](_0x38c07a));if(_0x38c07a[_0x5645('0x13')]){if(_0x38c07a['error'][_0x5645('0x14')]===0x1f4){logger['error'](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);return _0x5f4037(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')]['message']);return _0x518a28(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}else{logger[_0x5645('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0xa14a06,'request\x20sent');_0x518a28(_0x38c07a[_0x5645('0x16')][_0x5645('0x15')]);}})['catch'](function(_0x35e0c7){logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x35e0c7);_0x5f4037(_0x35e0c7);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 87ffa86..853b6be 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 _0xb8ca=['../../config/environment','./license.controller','get','index','put','/:id','update','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x967e44,_0x58bfad){var _0x367b80=function(_0x4ef1b3){while(--_0x4ef1b3){_0x967e44['push'](_0x967e44['shift']());}};_0x367b80(++_0x58bfad);}(_0xb8ca,0x89));var _0xab8c=function(_0x32095f,_0x42e972){_0x32095f=_0x32095f-0x0;var _0xd2d7b3=_0xb8ca[_0x32095f];return _0xd2d7b3;};'use strict';var multer=require(_0xab8c('0x0'));var util=require(_0xab8c('0x1'));var path=require(_0xab8c('0x2'));var timeout=require('connect-timeout');var express=require(_0xab8c('0x3'));var router=express[_0xab8c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab8c('0x5'));var config=require(_0xab8c('0x6'));var controller=require(_0xab8c('0x7'));router[_0xab8c('0x8')]('/',controller[_0xab8c('0x9')]);router[_0xab8c('0xa')](_0xab8c('0xb'),auth['isAuthenticated'](),controller[_0xab8c('0xc')]);module['exports']=router; \ No newline at end of file +var _0x8e52=['get','index','put','/:id','isAuthenticated','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x27ebe8,_0x21dd01){var _0x431778=function(_0xcf97c6){while(--_0xcf97c6){_0x27ebe8['push'](_0x27ebe8['shift']());}};_0x431778(++_0x21dd01);}(_0x8e52,0x1c6));var _0x28e5=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0x8e52[_0x291aaf];return _0x5571e6;};'use strict';var multer=require('multer');var util=require(_0x28e5('0x0'));var path=require(_0x28e5('0x1'));var timeout=require(_0x28e5('0x2'));var express=require(_0x28e5('0x3'));var router=express[_0x28e5('0x4')]();var fs_extra=require(_0x28e5('0x5'));var auth=require(_0x28e5('0x6'));var interaction=require(_0x28e5('0x7'));var config=require(_0x28e5('0x8'));var controller=require(_0x28e5('0x9'));router[_0x28e5('0xa')]('/',controller[_0x28e5('0xb')]);router[_0x28e5('0xc')](_0x28e5('0xd'),auth[_0x28e5('0xe')](),controller['update']);module[_0x28e5('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 8643d10..4e27a38 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 _0xc950=['exports','sequelize'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0xc950,0x1a7));var _0x0c95=function(_0x4cff78,_0x46acf3){_0x4cff78=_0x4cff78-0x0;var _0x382913=_0xc950[_0x4cff78];return _0x382913;};'use strict';var Sequelize=require(_0x0c95('0x0'));module[_0x0c95('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4a0b=['TEXT','STRING','INTEGER','sequelize'];(function(_0x2bdcc5,_0xb8f532){var _0x2ea7c3=function(_0x2c6f05){while(--_0x2c6f05){_0x2bdcc5['push'](_0x2bdcc5['shift']());}};_0x2ea7c3(++_0xb8f532);}(_0x4a0b,0x147));var _0xb4a0=function(_0x5bb4f4,_0x4e41dc){_0x5bb4f4=_0x5bb4f4-0x0;var _0x32cc12=_0x4a0b[_0x5bb4f4];return _0x32cc12;};'use strict';var Sequelize=require(_0xb4a0('0x0'));module['exports']={'license':{'type':Sequelize[_0xb4a0('0x1')]},'data1':{'type':Sequelize[_0xb4a0('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xb4a0('0x3')],'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 410115a..d282d04 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 _0x1261=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','index','model','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','params','get','key','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x868406,_0x33e2ea){var _0x1ab94f=function(_0x48c7b3){while(--_0x48c7b3){_0x868406['push'](_0x868406['shift']());}};_0x1ab94f(++_0x33e2ea);}(_0x1261,0x144));var _0x1126=function(_0x6b25ac,_0xe9fa01){_0x6b25ac=_0x6b25ac-0x0;var _0x4c84e9=_0x1261[_0x6b25ac];return _0x4c84e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}var utilLicense=require('../../config/license/util');exports[_0x1126('0x29')]=function(_0x23d2bc,_0x4a334a){var _0x3fa694={'raw':!![],'where':{'id':0x1}},_0x4bf807={};_0x4bf807[_0x1126('0x2a')]=_['keys'](db[_0x1126('0x2b')]['rawAttributes']);_0x4bf807[_0x1126('0x2c')]=_['keys'](_0x23d2bc['query']);_0x4bf807['filters']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],_0x4bf807[_0x1126('0x2c')]);_0x3fa694['attributes']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],qs['fields'](_0x23d2bc[_0x1126('0x2c')][_0x1126('0x2e')]));_0x3fa694[_0x1126('0x2f')]=_0x3fa694[_0x1126('0x2f')]['length']?_0x3fa694['attributes']:_0x4bf807[_0x1126('0x2a')];_0x3fa694=_[_0x1126('0x30')]({},_0x3fa694,_0x23d2bc[_0x1126('0x31')]);return utilLicense[_0x1126('0x32')](_0x3fa694)['then'](respondWithResult(_0x4a334a,null))[_0x1126('0x33')](handleError(_0x4a334a,null));};exports[_0x1126('0x24')]=function(_0x313ebe,_0x22436c){if(_0x313ebe[_0x1126('0x34')]['id']){delete _0x313ebe['body']['id'];}return db[_0x1126('0x2b')][_0x1126('0x35')]({'where':{'id':_0x313ebe[_0x1126('0x36')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x22436c,null))['then'](function(_0x4ca51c){var _0x22827a=_0x4ca51c[_0x1126('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x22827a,_0x313ebe[_0x1126('0x34')][_0x1126('0x38')]);})[_0x1126('0x25')](function(_0x5c08b9){if(!_0x5c08b9['demo']){return saveUpdates(_0x313ebe[_0x1126('0x34')],null);}return _0x5c08b9;})[_0x1126('0x25')](respondWithResult(_0x22436c,null))[_0x1126('0x33')](handleError(_0x22436c,null));}; \ No newline at end of file +var _0x5fab=['checkLicense','key','demo','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','then','catch','body','find','params'];(function(_0x166c15,_0x17858c){var _0x28c0bd=function(_0x43e5fe){while(--_0x43e5fe){_0x166c15['push'](_0x166c15['shift']());}};_0x28c0bd(++_0x17858c);}(_0x5fab,0x177));var _0xb5fa=function(_0x16ffe2,_0x2f73ed){_0x16ffe2=_0x16ffe2-0x0;var _0x4193e5=_0x5fab[_0x16ffe2];return _0x4193e5;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}var utilLicense=require(_0xb5fa('0x18'));exports[_0xb5fa('0x2b')]=function(_0x3506a4,_0x358549){var _0x353314={'raw':!![],'where':{'id':0x1}},_0x409af9={};_0x409af9[_0xb5fa('0x2c')]=_[_0xb5fa('0x2d')](db[_0xb5fa('0x2e')][_0xb5fa('0x2f')]);_0x409af9[_0xb5fa('0x30')]=_[_0xb5fa('0x2d')](_0x3506a4[_0xb5fa('0x30')]);_0x409af9[_0xb5fa('0x31')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],_0x409af9[_0xb5fa('0x30')]);_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],qs[_0xb5fa('0x34')](_0x3506a4['query'][_0xb5fa('0x34')]));_0x353314['attributes']=_0x353314['attributes']['length']?_0x353314[_0xb5fa('0x33')]:_0x409af9['model'];_0x353314=_[_0xb5fa('0x35')]({},_0x353314,_0x3506a4['options']);return utilLicense['getLicense'](_0x353314)[_0xb5fa('0x36')](respondWithResult(_0x358549,null))[_0xb5fa('0x37')](handleError(_0x358549,null));};exports['update']=function(_0x59f41d,_0x3d73c2){if(_0x59f41d[_0xb5fa('0x38')]['id']){delete _0x59f41d[_0xb5fa('0x38')]['id'];}return db['License'][_0xb5fa('0x39')]({'where':{'id':_0x59f41d[_0xb5fa('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3d73c2,null))[_0xb5fa('0x36')](function(_0x2056de){var _0x204d6b=_0x2056de['get']({'plain':!![]});return utilLicense[_0xb5fa('0x3b')](_0x204d6b,_0x59f41d[_0xb5fa('0x38')][_0xb5fa('0x3c')]);})['then'](function(_0x117694){if(!_0x117694[_0xb5fa('0x3d')]){return saveUpdates(_0x59f41d[_0xb5fa('0x38')],null);}return _0x117694;})[_0xb5fa('0x36')](respondWithResult(_0x3d73c2,null))['catch'](handleError(_0x3d73c2,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d1e5f77..a545460 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 _0x5b17=['moment','rimraf','../../config/environment','./license.attributes','define','license','lodash','api'];(function(_0x326052,_0x5a1ff7){var _0x57dbb7=function(_0x5393d0){while(--_0x5393d0){_0x326052['push'](_0x326052['shift']());}};_0x57dbb7(++_0x5a1ff7);}(_0x5b17,0x1be));var _0x75b1=function(_0x343343,_0x72c4ad){_0x343343=_0x343343-0x0;var _0x46992b=_0x5b17[_0x343343];return _0x46992b;};'use strict';var _=require(_0x75b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x75b1('0x1'));var moment=require(_0x75b1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x75b1('0x3'));var config=require(_0x75b1('0x4'));var attributes=require(_0x75b1('0x5'));module['exports']=function(_0x49cec9,_0x51604d){return _0x49cec9[_0x75b1('0x6')]('License',attributes,{'tableName':_0x75b1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd83=['util','../../config/logger','api','moment','bluebird','rimraf','exports','define','License','license'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0xbd83,0x140));var _0x3bd8=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xbd83[_0xbeb808];return _0x5d6909;};'use strict';var _=require('lodash');var util=require(_0x3bd8('0x0'));var logger=require(_0x3bd8('0x1'))(_0x3bd8('0x2'));var moment=require(_0x3bd8('0x3'));var BPromise=require(_0x3bd8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3bd8('0x5'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x3bd8('0x6')]=function(_0x1246f9,_0x127256){return _0x1246f9[_0x3bd8('0x7')](_0x3bd8('0x8'),attributes,{'tableName':_0x3bd8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 94ad842..01fc73a 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 _0xf657=['code','message','License,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x48db8c,_0x4a1555){var _0x232929=function(_0x29e11c){while(--_0x29e11c){_0x48db8c['push'](_0x48db8c['shift']());}};_0x232929(++_0x4a1555);}(_0xf657,0x16c));var _0x7f65=function(_0x19e4e,_0x51255c){_0x19e4e=_0x19e4e-0x0;var _0xaef8c4=_0xf657[_0x19e4e];return _0xaef8c4;};'use strict';var _=require(_0x7f65('0x0'));var util=require(_0x7f65('0x1'));var moment=require(_0x7f65('0x2'));var BPromise=require(_0x7f65('0x3'));var rs=require(_0x7f65('0x4'));var fs=require('fs');var Redis=require(_0x7f65('0x5'));var db=require(_0x7f65('0x6'))['db'];var utils=require(_0x7f65('0x7'));var logger=require(_0x7f65('0x8'))(_0x7f65('0x9'));var config=require(_0x7f65('0xa'));var jayson=require(_0x7f65('0xb'));var client=jayson['client'][_0x7f65('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15fcaa,_0x6fa2be,_0x3af131){return new BPromise(function(_0x951a5d,_0x42a45e){return client[_0x7f65('0xd')](_0x15fcaa,_0x3af131)[_0x7f65('0xe')](function(_0x4eeba1){logger[_0x7f65('0xf')]('License,\x20%s,\x20%s',_0x6fa2be,_0x7f65('0x10'));logger[_0x7f65('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x6fa2be,_0x7f65('0x10'),JSON[_0x7f65('0x12')](_0x4eeba1));if(_0x4eeba1['error']){if(_0x4eeba1[_0x7f65('0x13')][_0x7f65('0x14')]===0x1f4){logger[_0x7f65('0x13')]('License,\x20%s,\x20%s',_0x6fa2be,_0x4eeba1[_0x7f65('0x13')][_0x7f65('0x15')]);return _0x42a45e(_0x4eeba1['error'][_0x7f65('0x15')]);}logger[_0x7f65('0x13')](_0x7f65('0x16'),_0x6fa2be,_0x4eeba1[_0x7f65('0x13')][_0x7f65('0x15')]);return _0x951a5d(_0x4eeba1['error'][_0x7f65('0x15')]);}else{logger[_0x7f65('0xf')](_0x7f65('0x16'),_0x6fa2be,_0x7f65('0x10'));_0x951a5d(_0x4eeba1[_0x7f65('0x17')][_0x7f65('0x15')]);}})['catch'](function(_0x1e893e){logger[_0x7f65('0x13')]('License,\x20%s,\x20%s',_0x6fa2be,_0x1e893e);_0x42a45e(_0x1e893e);});});} \ No newline at end of file +var _0xb75d=['stringify','error','code','License,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s,\x20%s'];(function(_0x385b16,_0x248dc9){var _0xf204d8=function(_0x44fab9){while(--_0x44fab9){_0x385b16['push'](_0x385b16['shift']());}};_0xf204d8(++_0x248dc9);}(_0xb75d,0x12c));var _0xdb75=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xb75d[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0xdb75('0x0'));var util=require('util');var moment=require(_0xdb75('0x1'));var BPromise=require(_0xdb75('0x2'));var rs=require(_0xdb75('0x3'));var fs=require('fs');var Redis=require(_0xdb75('0x4'));var db=require(_0xdb75('0x5'))['db'];var utils=require(_0xdb75('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xdb75('0x7'));var jayson=require(_0xdb75('0x8'));var client=jayson[_0xdb75('0x9')][_0xdb75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaf6d4f,_0x4ea92e,_0x1f4090){return new BPromise(function(_0x5e4ebe,_0x3aa4b4){return client[_0xdb75('0xb')](_0xaf6d4f,_0x1f4090)[_0xdb75('0xc')](function(_0x107ed7){logger[_0xdb75('0xd')]('License,\x20%s,\x20%s',_0x4ea92e,'request\x20sent');logger['debug'](_0xdb75('0xe'),_0x4ea92e,'request\x20sent',JSON[_0xdb75('0xf')](_0x107ed7));if(_0x107ed7[_0xdb75('0x10')]){if(_0x107ed7[_0xdb75('0x10')][_0xdb75('0x11')]===0x1f4){logger['error'](_0xdb75('0x12'),_0x4ea92e,_0x107ed7[_0xdb75('0x10')][_0xdb75('0x13')]);return _0x3aa4b4(_0x107ed7[_0xdb75('0x10')][_0xdb75('0x13')]);}logger['error'](_0xdb75('0x12'),_0x4ea92e,_0x107ed7['error'][_0xdb75('0x13')]);return _0x5e4ebe(_0x107ed7['error']['message']);}else{logger['info'](_0xdb75('0x12'),_0x4ea92e,'request\x20sent');_0x5e4ebe(_0x107ed7['result'][_0xdb75('0x13')]);}})[_0xdb75('0x14')](function(_0x1c42c6){logger['error']('License,\x20%s,\x20%s',_0x4ea92e,_0x1c42c6);_0x3aa4b4(_0x1c42c6);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index d728ab7..be19ce2 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 _0xde2a=['addInteraction','/:id/applications','addApplications','send','put','update','delete','removeDispositions','removeImap','/:id/out_servers','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','getSmtp','/:id/interactions','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','addSmtp'];(function(_0x326182,_0x3fa49a){var _0x43c756=function(_0x4af98f){while(--_0x4af98f){_0x326182['push'](_0x326182['shift']());}};_0x43c756(++_0x3fa49a);}(_0xde2a,0xce));var _0xade2=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xde2a[_0x4c440b];return _0x2d48cf;};'use strict';var multer=require(_0xade2('0x0'));var util=require(_0xade2('0x1'));var path=require('path');var timeout=require(_0xade2('0x2'));var express=require(_0xade2('0x3'));var router=express[_0xade2('0x4')]();var fs_extra=require(_0xade2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xade2('0x6'));var config=require(_0xade2('0x7'));var controller=require(_0xade2('0x8'));router['get']('/',auth[_0xade2('0x9')](),controller[_0xade2('0xa')]);router['get'](_0xade2('0xb'),auth[_0xade2('0x9')](),controller[_0xade2('0xc')]);router[_0xade2('0xd')](_0xade2('0xe'),auth[_0xade2('0x9')](),controller[_0xade2('0xf')]);router[_0xade2('0xd')](_0xade2('0x10'),auth['isAuthenticated'](),controller[_0xade2('0x11')]);router[_0xade2('0xd')](_0xade2('0x12'),auth[_0xade2('0x9')](),controller['getAnswers']);router[_0xade2('0xd')](_0xade2('0x13'),auth['isAuthenticated'](),controller[_0xade2('0x14')]);router[_0xade2('0xd')]('/:id/out_servers',auth[_0xade2('0x9')](),controller[_0xade2('0x15')]);router['get'](_0xade2('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xade2('0xd')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xade2('0xd')](_0xade2('0x17'),auth['isAuthenticated'](),controller[_0xade2('0x18')]);router[_0xade2('0xd')](_0xade2('0x19'),auth['isAuthenticated'](),controller[_0xade2('0x1a')]);router[_0xade2('0xd')](_0xade2('0x1b'),auth[_0xade2('0x9')](),controller[_0xade2('0x1c')]);router[_0xade2('0x1d')](_0xade2('0x10'),auth[_0xade2('0x9')](),controller['addDisposition']);router[_0xade2('0x1d')](_0xade2('0x12'),auth[_0xade2('0x9')](),controller[_0xade2('0x1e')]);router[_0xade2('0x1d')]('/',auth[_0xade2('0x9')](),controller[_0xade2('0x1f')]);router[_0xade2('0x1d')]('/:id/in_servers',auth[_0xade2('0x9')](),controller[_0xade2('0x20')]);router[_0xade2('0x1d')]('/:id/out_servers',auth[_0xade2('0x9')](),controller[_0xade2('0x21')]);router[_0xade2('0x1d')](_0xade2('0x16'),auth[_0xade2('0x9')](),controller[_0xade2('0x22')]);router['post'](_0xade2('0x23'),auth[_0xade2('0x9')](),controller[_0xade2('0x24')]);router['post']('/:id/send',auth[_0xade2('0x9')](),controller[_0xade2('0x25')]);router['post'](_0xade2('0x1b'),auth['isAuthenticated'](),controller['addAgents']);router[_0xade2('0x26')](_0xade2('0xe'),auth[_0xade2('0x9')](),controller[_0xade2('0x27')]);router[_0xade2('0x28')](_0xade2('0x10'),auth[_0xade2('0x9')](),controller[_0xade2('0x29')]);router[_0xade2('0x28')]('/:id/canned_answers',auth[_0xade2('0x9')](),controller['removeAnswers']);router[_0xade2('0x28')](_0xade2('0x13'),auth[_0xade2('0x9')](),controller[_0xade2('0x2a')]);router['delete'](_0xade2('0x2b'),auth[_0xade2('0x9')](),controller[_0xade2('0x2c')]);router[_0xade2('0x28')](_0xade2('0xe'),auth[_0xade2('0x9')](),controller[_0xade2('0x2d')]);router['delete'](_0xade2('0x1b'),auth['isAuthenticated'](),controller[_0xade2('0x2e')]);module[_0xade2('0x2f')]=router; \ No newline at end of file +var _0x3aae=['/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','delete','removeDispositions','removeAnswers','/:id/in_servers','removeImap','removeSmtp','destroy','/:id/users','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers'];(function(_0x19e9da,_0x422d6d){var _0x12a0e8=function(_0x4ece0d){while(--_0x4ece0d){_0x19e9da['push'](_0x19e9da['shift']());}};_0x12a0e8(++_0x422d6d);}(_0x3aae,0x78));var _0xe3aa=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3aae[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xe3aa('0x0'));var util=require('util');var path=require(_0xe3aa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe3aa('0x2')]();var fs_extra=require(_0xe3aa('0x3'));var auth=require(_0xe3aa('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0xe3aa('0x5')]('/',auth['isAuthenticated'](),controller[_0xe3aa('0x6')]);router[_0xe3aa('0x5')](_0xe3aa('0x7'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x9')]);router[_0xe3aa('0x5')](_0xe3aa('0xa'),auth['isAuthenticated'](),controller[_0xe3aa('0xb')]);router['get'](_0xe3aa('0xc'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0xd')]);router[_0xe3aa('0x5')](_0xe3aa('0xe'),auth['isAuthenticated'](),controller[_0xe3aa('0xf')]);router[_0xe3aa('0x5')]('/:id/in_servers',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x10')]);router['get'](_0xe3aa('0x11'),auth[_0xe3aa('0x8')](),controller['getSmtp']);router['get'](_0xe3aa('0x12'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x13')]);router[_0xe3aa('0x5')](_0xe3aa('0x14'),auth['isAuthenticated'](),controller[_0xe3aa('0x15')]);router[_0xe3aa('0x5')](_0xe3aa('0x16'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x17')]);router['get'](_0xe3aa('0x18'),auth['isAuthenticated'](),controller['verifySmtp']);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xe3aa('0x19')]('/:id/dispositions',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x1a')]);router[_0xe3aa('0x19')](_0xe3aa('0xe'),auth['isAuthenticated'](),controller[_0xe3aa('0x1b')]);router[_0xe3aa('0x19')]('/',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x1c')]);router[_0xe3aa('0x19')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xe3aa('0x1d')]);router[_0xe3aa('0x19')](_0xe3aa('0x11'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x1e')]);router[_0xe3aa('0x19')](_0xe3aa('0x12'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x1f')]);router['post'](_0xe3aa('0x14'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x20')]);router[_0xe3aa('0x19')](_0xe3aa('0x21'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x22')]);router[_0xe3aa('0x19')]('/:id/users',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x23')]);router['put'](_0xe3aa('0xa'),auth[_0xe3aa('0x8')](),controller['update']);router[_0xe3aa('0x24')]('/:id/dispositions',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x25')]);router[_0xe3aa('0x24')]('/:id/canned_answers',auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x26')]);router['delete'](_0xe3aa('0x27'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x28')]);router[_0xe3aa('0x24')](_0xe3aa('0x11'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x29')]);router[_0xe3aa('0x24')](_0xe3aa('0xa'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x2a')]);router[_0xe3aa('0x24')](_0xe3aa('0x2b'),auth[_0xe3aa('0x8')](),controller[_0xe3aa('0x2c')]);module[_0xe3aa('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d9aeed2..6af1ab6 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 _0x3148=['INTEGER','UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x179ae9,_0x66ee1a){var _0x1027b=function(_0x3d60c9){while(--_0x3d60c9){_0x179ae9['push'](_0x179ae9['shift']());}};_0x1027b(++_0x66ee1a);}(_0x3148,0x1d3));var _0x8314=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x3148[_0x41382c];return _0x4da35b;};'use strict';var Sequelize=require(_0x8314('0x0'));module[_0x8314('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x8314('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x8314('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x8314('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8314('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x8314('0x4')]},'markAsUnread':{'type':Sequelize[_0x8314('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8314('0x2')],'allowNull':![],'defaultValue':_0x8314('0x5')},'fontSize':{'type':Sequelize[_0x8314('0x6')](0x2)[_0x8314('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8314('0x4')],'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[_0x8314('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8314('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8314('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8314('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8314('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8314('0x6')],'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[_0x8314('0x3')],'defaultValue':![],'comment':_0x8314('0x8'),'set':function(_0x16bfa1){if(!_0x16bfa1)this[_0x8314('0x9')]('mandatoryDispositionPauseId',null);this[_0x8314('0x9')](_0x8314('0xa'),_0x16bfa1);}}}; \ No newline at end of file +var _0xa9b1=['mandatoryDisposition','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x288478,_0x23303e){var _0x234c05=function(_0x4ff5a5){while(--_0x4ff5a5){_0x288478['push'](_0x288478['shift']());}};_0x234c05(++_0x23303e);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x1a9b('0x0')]},'name':{'type':Sequelize[_0x1a9b('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x1a9b('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1a9b('0x0')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a9b('0x2')},'fontSize':{'type':Sequelize[_0x1a9b('0x3')](0x2)[_0x1a9b('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1a9b('0x5')],'defaultValue':function(){return _0x1a9b('0x6');}},'notificationSound':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a9b('0x3')],'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[_0x1a9b('0x1')],'defaultValue':![],'comment':_0x1a9b('0x7'),'set':function(_0x2c2ee4){if(!_0x2c2ee4)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x1a9b('0x8'),_0x2c2ee4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 7a908e1..c968e26 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 _0x3e06=['apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','params','Imap','keys','find','body','describe','addDisposition','MailAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','create','CannedAnswer','email','active','description','isNil','cauthentication','user','cuser','password','cpassword','authentication','port','host','service','cservice','pass','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','color','tag','findAll','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','$gte','split','format','MailMessage','true','CmList','List','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','secure','SendMail','sendMail','List\x20not\x20found','ListId','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','auth','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','set','json'];(function(_0x151321,_0x437d1a){var _0x152cb6=function(_0x1fd885){while(--_0x1fd885){_0x151321['push'](_0x151321['shift']());}};_0x152cb6(++_0x437d1a);}(_0x3e06,0x8b));var _0x63e0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3e06[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x63e0('0x0'));var jsonpatch=require(_0x63e0('0x1'));var rp=require('request-promise');var moment=require(_0x63e0('0x2'));var BPromise=require(_0x63e0('0x3'));var Mustache=require('mustache');var util=require(_0x63e0('0x4'));var path=require(_0x63e0('0x5'));var sox=require('sox');var csv=require(_0x63e0('0x6'));var ejs=require(_0x63e0('0x7'));var fs=require('fs');var fs_extra=require(_0x63e0('0x8'));var _=require(_0x63e0('0x9'));var squel=require(_0x63e0('0xa'));var crypto=require(_0x63e0('0xb'));var jsforce=require(_0x63e0('0xc'));var deskjs=require(_0x63e0('0xd'));var toCsv=require(_0x63e0('0x6'));var querystring=require(_0x63e0('0xe'));var Papa=require(_0x63e0('0xf'));var htmlToText=require(_0x63e0('0x10'));var juice=require(_0x63e0('0x11'));var Redis=require(_0x63e0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x63e0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x63e0('0x14'))(_0x63e0('0x15'));var utils=require(_0x63e0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x63e0('0x17'))['db'];config[_0x63e0('0x18')]=_[_0x63e0('0x19')](config[_0x63e0('0x18')],{'host':_0x63e0('0x1a'),'port':0x18eb});var socket=require(_0x63e0('0x1b'))(new Redis(config['redis']));require(_0x63e0('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x63e0('0x1d')]['http']({'port':0x232b});function respondWithRpcPromise(_0x3c7529,_0x1dffa3,_0x218563,_0x20191f){return new BPromise(function(_0xdd330b,_0xc3ff4f){var _0x3ccb4a=_0x20191f||client;return _0x3ccb4a[_0x63e0('0x1e')](_0x3c7529,_0x218563)[_0x63e0('0x1f')](function(_0x3170bb){logger[_0x63e0('0x20')](_0x63e0('0x21'),_0x1dffa3,_0x63e0('0x22'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1dffa3,'request\x20sent',JSON[_0x63e0('0x23')](_0x3170bb));if(_0x3170bb[_0x63e0('0x24')]){if(_0x3170bb[_0x63e0('0x24')]['code']===0x1f4){logger['error'](_0x63e0('0x21'),_0x1dffa3,_0x3170bb['error'][_0x63e0('0x25')]);return _0xc3ff4f(_0x3170bb[_0x63e0('0x24')][_0x63e0('0x25')]);}logger[_0x63e0('0x24')]('MailAccount,\x20%s,\x20%s',_0x1dffa3,_0x3170bb[_0x63e0('0x24')][_0x63e0('0x25')]);return _0xdd330b(_0x3170bb['error']['message']);}else{logger[_0x63e0('0x20')](_0x63e0('0x21'),_0x1dffa3,_0x63e0('0x22'));_0xdd330b(_0x3170bb[_0x63e0('0x26')]['message']);}})[_0x63e0('0x27')](function(_0x16c1b7){logger[_0x63e0('0x24')]('MailAccount,\x20%s,\x20%s',_0x1dffa3,_0x16c1b7);_0xc3ff4f(_0x16c1b7);});});}function respondWithStatusCode(_0x16f3cf,_0x5d9da3){_0x5d9da3=_0x5d9da3||0xcc;return function(_0x232cd9){if(_0x232cd9){return _0x16f3cf[_0x63e0('0x28')](_0x5d9da3);}return _0x16f3cf[_0x63e0('0x29')](_0x5d9da3)[_0x63e0('0x2a')]();};}function respondWithResult(_0x194a17,_0x10c55f){_0x10c55f=_0x10c55f||0xc8;return function(_0x3dec23){if(_0x3dec23){return _0x194a17[_0x63e0('0x29')](_0x10c55f)['json'](_0x3dec23);}};}function respondWithFilteredResult(_0x58a9dd,_0x27f266){return function(_0x1e2b48){if(_0x1e2b48){var _0x389449=typeof _0x27f266[_0x63e0('0x2b')]===_0x63e0('0x2c')&&typeof _0x27f266[_0x63e0('0x2d')]===_0x63e0('0x2c');var _0x73ebba=_0x1e2b48['count'];var _0xb57d1e=_0x389449?0x0:_0x27f266[_0x63e0('0x2b')];var _0x36d7eb=_0x389449?_0x1e2b48['count']:_0x27f266[_0x63e0('0x2b')]+_0x27f266[_0x63e0('0x2d')];var _0x39324f;if(_0x36d7eb>=_0x73ebba){_0x36d7eb=_0x73ebba;_0x39324f=0xc8;}else{_0x39324f=0xce;}_0x58a9dd[_0x63e0('0x29')](_0x39324f);return _0x58a9dd[_0x63e0('0x2e')]('Content-Range',_0xb57d1e+'-'+_0x36d7eb+'/'+_0x73ebba)[_0x63e0('0x2f')](_0x1e2b48);}return null;};}function patchUpdates(_0x4b49ee){return function(_0x15714b){try{jsonpatch[_0x63e0('0x30')](_0x15714b,_0x4b49ee,!![]);}catch(_0x3ec737){return BPromise[_0x63e0('0x31')](_0x3ec737);}return _0x15714b[_0x63e0('0x32')]();};}function saveUpdates(_0x1ca004,_0x2afd1c){return function(_0x8ba85b){if(_0x8ba85b){return _0x8ba85b[_0x63e0('0x33')](_0x1ca004)[_0x63e0('0x1f')](function(_0x2b27b8){return _0x2b27b8;});}return null;};}function removeEntity(_0x25e0a5,_0x5ad7d5){return function(_0x38bfe5){if(_0x38bfe5){return _0x38bfe5[_0x63e0('0x34')]()[_0x63e0('0x1f')](function(){var _0x2f0be4=_0x38bfe5[_0x63e0('0x35')]({'plain':!![]});var _0x50f3ff=_0x63e0('0x36');return db[_0x63e0('0x37')][_0x63e0('0x34')]({'where':{'type':_0x50f3ff,'resourceId':_0x2f0be4['id']}})[_0x63e0('0x1f')](function(){return _0x38bfe5;});})[_0x63e0('0x1f')](function(){_0x25e0a5[_0x63e0('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2be155,_0x4e5a8c){return function(_0x21d8e4){if(!_0x21d8e4){_0x2be155[_0x63e0('0x28')](0x194);}return _0x21d8e4;};}function handleError(_0x10a1ef,_0x3b0c69){_0x3b0c69=_0x3b0c69||0x1f4;return function(_0x2a3333){logger[_0x63e0('0x24')](_0x2a3333[_0x63e0('0x38')]);if(_0x2a3333[_0x63e0('0x39')]){delete _0x2a3333[_0x63e0('0x39')];}_0x10a1ef[_0x63e0('0x29')](_0x3b0c69)['send'](_0x2a3333);};}exports['index']=function(_0x5d09f0,_0xfe3fc8){var _0x2fe55d={'include':[{'model':db[_0x63e0('0x3a')],'as':'Imap'},{'model':db[_0x63e0('0x3b')],'as':_0x63e0('0x3c')},{'model':db[_0x63e0('0x3d')],'as':_0x63e0('0x3e')}]},_0x23980c={},_0x2ea34d={'count':0x0,'rows':[]};var _0x2eb72a=_[_0x63e0('0x3f')](db[_0x63e0('0x40')][_0x63e0('0x41')],function(_0x2e050b){return{'name':_0x2e050b[_0x63e0('0x42')],'type':_0x2e050b['type'][_0x63e0('0x43')]};});_0x23980c[_0x63e0('0x44')]=_[_0x63e0('0x3f')](_0x2eb72a,_0x63e0('0x39'));_0x23980c['query']=_['keys'](_0x5d09f0[_0x63e0('0x45')]);_0x23980c[_0x63e0('0x46')]=_['intersection'](_0x23980c['model'],_0x23980c[_0x63e0('0x45')]);_0x2fe55d[_0x63e0('0x47')]=_[_0x63e0('0x48')](_0x23980c[_0x63e0('0x44')],qs[_0x63e0('0x49')](_0x5d09f0[_0x63e0('0x45')][_0x63e0('0x49')]));_0x2fe55d['attributes']=_0x2fe55d[_0x63e0('0x47')][_0x63e0('0x4a')]?_0x2fe55d[_0x63e0('0x47')]:_0x23980c['model'];if(!_0x5d09f0[_0x63e0('0x45')]['hasOwnProperty'](_0x63e0('0x4b'))){_0x2fe55d[_0x63e0('0x2d')]=qs[_0x63e0('0x2d')](_0x5d09f0[_0x63e0('0x45')]['limit']);_0x2fe55d['offset']=qs[_0x63e0('0x2b')](_0x5d09f0[_0x63e0('0x45')][_0x63e0('0x2b')]);}_0x2fe55d[_0x63e0('0x4c')]=qs[_0x63e0('0x4d')](_0x5d09f0[_0x63e0('0x45')][_0x63e0('0x4d')]);_0x2fe55d[_0x63e0('0x4e')]=qs['filters'](_[_0x63e0('0x4f')](_0x5d09f0['query'],_0x23980c[_0x63e0('0x46')]),_0x2eb72a);if(_0x5d09f0[_0x63e0('0x45')][_0x63e0('0x50')]){_0x2fe55d[_0x63e0('0x4e')]=_['merge'](_0x2fe55d['where'],{'$or':_[_0x63e0('0x3f')](_0x2eb72a,function(_0x3a413a){if(_0x3a413a['type']!=='VIRTUAL'){var _0x56990f={};_0x56990f[_0x3a413a[_0x63e0('0x39')]]={'$like':'%'+_0x5d09f0[_0x63e0('0x45')]['filter']+'%'};return _0x56990f;}})});}_0x2fe55d=_[_0x63e0('0x51')]({},_0x2fe55d,_0x5d09f0[_0x63e0('0x52')]);var _0x1d61fc={'where':_0x2fe55d[_0x63e0('0x4e')]};return db[_0x63e0('0x40')][_0x63e0('0x53')](_0x1d61fc)['then'](function(_0x182b03){_0x2ea34d[_0x63e0('0x53')]=_0x182b03;if(_0x5d09f0[_0x63e0('0x45')][_0x63e0('0x54')]){_0x2fe55d[_0x63e0('0x55')]=[{'all':!![]}];}return db[_0x63e0('0x40')]['findAll'](_0x2fe55d);})[_0x63e0('0x1f')](function(_0x57a59e){_0x2ea34d[_0x63e0('0x56')]=_0x57a59e;return _0x2ea34d;})['then'](respondWithFilteredResult(_0xfe3fc8,_0x2fe55d))[_0x63e0('0x27')](handleError(_0xfe3fc8,null));};exports['show']=function(_0x194152,_0x1d225a){var _0x573ddf={'raw':![],'where':{'id':_0x194152[_0x63e0('0x57')]['id']},'include':[{'model':db[_0x63e0('0x3a')],'as':_0x63e0('0x58')},{'model':db[_0x63e0('0x3b')],'as':_0x63e0('0x3c')},{'model':db[_0x63e0('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2843cd={};_0x2843cd[_0x63e0('0x44')]=_[_0x63e0('0x59')](db['MailAccount']['rawAttributes']);_0x2843cd[_0x63e0('0x45')]=_[_0x63e0('0x59')](_0x194152[_0x63e0('0x45')]);_0x2843cd[_0x63e0('0x46')]=_[_0x63e0('0x48')](_0x2843cd['model'],_0x2843cd['query']);_0x573ddf[_0x63e0('0x47')]=_[_0x63e0('0x48')](_0x2843cd[_0x63e0('0x44')],qs[_0x63e0('0x49')](_0x194152[_0x63e0('0x45')][_0x63e0('0x49')]));_0x573ddf[_0x63e0('0x47')]=_0x573ddf['attributes'][_0x63e0('0x4a')]?_0x573ddf[_0x63e0('0x47')]:_0x2843cd['model'];if(_0x194152[_0x63e0('0x45')][_0x63e0('0x54')]){_0x573ddf[_0x63e0('0x55')]=[{'all':!![]}];}_0x573ddf=_[_0x63e0('0x51')]({},_0x573ddf,_0x194152[_0x63e0('0x52')]);return db[_0x63e0('0x40')][_0x63e0('0x5a')](_0x573ddf)[_0x63e0('0x1f')](handleEntityNotFound(_0x1d225a,null))[_0x63e0('0x1f')](respondWithResult(_0x1d225a,null))['catch'](handleError(_0x1d225a,null));};exports[_0x63e0('0x33')]=function(_0x1b08ea,_0x582ff3){if(_0x1b08ea[_0x63e0('0x5b')]['id']){delete _0x1b08ea['body']['id'];}return db[_0x63e0('0x40')][_0x63e0('0x5a')]({'where':{'id':_0x1b08ea[_0x63e0('0x57')]['id']},'include':[{'model':db[_0x63e0('0x3a')],'as':_0x63e0('0x58')},{'model':db[_0x63e0('0x3b')],'as':_0x63e0('0x3c')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x63e0('0x1f')](handleEntityNotFound(_0x582ff3,null))[_0x63e0('0x1f')](saveUpdates(_0x1b08ea['body'],null))[_0x63e0('0x1f')](function(_0x5da9bf){if(_0x5da9bf&&_0x1b08ea[_0x63e0('0x5b')][_0x63e0('0x58')]){return db[_0x63e0('0x3a')][_0x63e0('0x33')](_0x1b08ea[_0x63e0('0x5b')][_0x63e0('0x58')],{'where':{'MailAccountId':_0x5da9bf['id']}})[_0x63e0('0x1f')](function(){return _0x5da9bf;});}return _0x5da9bf;})[_0x63e0('0x1f')](function(_0x491d1a){if(_0x491d1a&&_0x1b08ea[_0x63e0('0x5b')][_0x63e0('0x3c')]){return db[_0x63e0('0x3b')][_0x63e0('0x33')](_0x1b08ea[_0x63e0('0x5b')][_0x63e0('0x3c')],{'where':{'MailAccountId':_0x491d1a['id']}})[_0x63e0('0x1f')](function(){return _0x491d1a;});}return _0x491d1a;})['then'](respondWithResult(_0x582ff3,null))[_0x63e0('0x27')](handleError(_0x582ff3,null));};exports['describe']=function(_0x1105ba,_0x224826){return db[_0x63e0('0x40')][_0x63e0('0x5c')]()[_0x63e0('0x1f')](respondWithResult(_0x224826,null))[_0x63e0('0x27')](handleError(_0x224826,null));};exports[_0x63e0('0x5d')]=function(_0x3c4602,_0x12fe33,_0x4293ae){if(_0x3c4602[_0x63e0('0x5b')]['id']){delete _0x3c4602['body']['id'];}return db[_0x63e0('0x40')][_0x63e0('0x5a')]({'where':{'id':_0x3c4602[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x12fe33,null))[_0x63e0('0x1f')](function(_0xf40fd7){if(_0xf40fd7){_0x3c4602['body'][_0x63e0('0x5e')]=_0xf40fd7['id'];return db[_0x63e0('0x5f')]['create'](_0x3c4602[_0x63e0('0x5b')]);}})[_0x63e0('0x1f')](respondWithResult(_0x12fe33,null))['catch'](handleError(_0x12fe33,null));};exports['getDispositions']=function(_0x3ad1ed,_0x252f94,_0x1c7e90){var _0x3c3901={'raw':![],'where':{}};var _0x47cfec={};var _0x342611={'count':0x0,'rows':[]};return db[_0x63e0('0x40')][_0x63e0('0x60')]({'where':{'id':_0x3ad1ed[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x252f94,null))[_0x63e0('0x1f')](function(_0x1f86bc){if(_0x1f86bc){_0x47cfec[_0x63e0('0x44')]=_[_0x63e0('0x59')](db[_0x63e0('0x5f')][_0x63e0('0x41')]);_0x47cfec[_0x63e0('0x45')]=_['keys'](_0x3ad1ed['query']);_0x47cfec['filters']=_[_0x63e0('0x48')](_0x47cfec[_0x63e0('0x44')],_0x47cfec['query']);_0x3c3901['attributes']=_[_0x63e0('0x48')](_0x47cfec[_0x63e0('0x44')],qs[_0x63e0('0x49')](_0x3ad1ed[_0x63e0('0x45')][_0x63e0('0x49')]));_0x3c3901[_0x63e0('0x47')]=_0x3c3901['attributes']['length']?_0x3c3901[_0x63e0('0x47')]:_0x47cfec[_0x63e0('0x44')];if(!_0x3ad1ed['query'][_0x63e0('0x61')](_0x63e0('0x4b'))){_0x3c3901['limit']=qs[_0x63e0('0x2d')](_0x3ad1ed[_0x63e0('0x45')]['limit']);_0x3c3901[_0x63e0('0x2b')]=qs['offset'](_0x3ad1ed[_0x63e0('0x45')][_0x63e0('0x2b')]);}_0x3c3901[_0x63e0('0x4c')]=qs[_0x63e0('0x4d')](_0x3ad1ed[_0x63e0('0x45')][_0x63e0('0x4d')]);_0x3c3901[_0x63e0('0x4e')]=qs['filters'](_[_0x63e0('0x4f')](_0x3ad1ed[_0x63e0('0x45')],_0x47cfec[_0x63e0('0x46')]));_0x3c3901[_0x63e0('0x4e')][_0x63e0('0x5e')]=_0x1f86bc['id'];if(_0x3ad1ed[_0x63e0('0x45')]['filter']){_0x3c3901[_0x63e0('0x4e')]=_['merge'](_0x3c3901['where'],{'$or':_['map'](_0x3c3901[_0x63e0('0x47')],function(_0x33b645){var _0x2d9375={};_0x2d9375[_0x33b645]={'$like':'%'+_0x3ad1ed[_0x63e0('0x45')][_0x63e0('0x50')]+'%'};return _0x2d9375;})});}_0x3c3901=_[_0x63e0('0x51')]({},_0x3c3901,_0x3ad1ed[_0x63e0('0x52')]);return db['Disposition'][_0x63e0('0x53')]({'where':_0x3c3901[_0x63e0('0x4e')]})[_0x63e0('0x1f')](function(_0x48996e){_0x342611[_0x63e0('0x53')]=_0x48996e;if(_0x3ad1ed[_0x63e0('0x45')][_0x63e0('0x54')]){_0x3c3901[_0x63e0('0x55')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3c3901);})[_0x63e0('0x1f')](function(_0x206285){_0x342611['rows']=_0x206285;return _0x342611;});}})[_0x63e0('0x1f')](respondWithFilteredResult(_0x252f94,_0x3c3901))[_0x63e0('0x27')](handleError(_0x252f94,null));};exports[_0x63e0('0x62')]=function(_0x4e8803,_0x67b2a8,_0x555573){return db['MailAccount'][_0x63e0('0x5a')]({'where':{'id':_0x4e8803[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x67b2a8,null))[_0x63e0('0x1f')](function(_0x1a9245){if(_0x1a9245){return _0x1a9245[_0x63e0('0x62')](_0x4e8803[_0x63e0('0x45')][_0x63e0('0x63')]);}})[_0x63e0('0x1f')](respondWithStatusCode(_0x67b2a8,null))[_0x63e0('0x27')](handleError(_0x67b2a8,null));};exports[_0x63e0('0x64')]=function(_0x44698a,_0x3b4ea9,_0x418df5){if(_0x44698a['body']['id']){delete _0x44698a[_0x63e0('0x5b')]['id'];}return db[_0x63e0('0x40')][_0x63e0('0x5a')]({'where':{'id':_0x44698a['params']['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x3b4ea9,null))[_0x63e0('0x1f')](function(_0x3671d0){if(_0x3671d0){_0x44698a[_0x63e0('0x5b')][_0x63e0('0x5e')]=_0x3671d0['id'];return db['CannedAnswer'][_0x63e0('0x65')](_0x44698a[_0x63e0('0x5b')]);}})[_0x63e0('0x1f')](respondWithResult(_0x3b4ea9,null))[_0x63e0('0x27')](handleError(_0x3b4ea9,null));};exports['getAnswers']=function(_0x12e756,_0x411c04,_0x3aeeea){var _0x2f54a8={'raw':![],'where':{}};var _0x47d9b6={};var _0x33011c={'count':0x0,'rows':[]};return db['MailAccount'][_0x63e0('0x60')]({'where':{'id':_0x12e756[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x411c04,null))[_0x63e0('0x1f')](function(_0x2a3bcd){if(_0x2a3bcd){_0x47d9b6[_0x63e0('0x44')]=_[_0x63e0('0x59')](db['CannedAnswer'][_0x63e0('0x41')]);_0x47d9b6['query']=_['keys'](_0x12e756[_0x63e0('0x45')]);_0x47d9b6[_0x63e0('0x46')]=_[_0x63e0('0x48')](_0x47d9b6['model'],_0x47d9b6[_0x63e0('0x45')]);_0x2f54a8[_0x63e0('0x47')]=_[_0x63e0('0x48')](_0x47d9b6[_0x63e0('0x44')],qs[_0x63e0('0x49')](_0x12e756[_0x63e0('0x45')]['fields']));_0x2f54a8['attributes']=_0x2f54a8[_0x63e0('0x47')][_0x63e0('0x4a')]?_0x2f54a8[_0x63e0('0x47')]:_0x47d9b6[_0x63e0('0x44')];if(!_0x12e756['query'][_0x63e0('0x61')](_0x63e0('0x4b'))){_0x2f54a8[_0x63e0('0x2d')]=qs['limit'](_0x12e756[_0x63e0('0x45')][_0x63e0('0x2d')]);_0x2f54a8[_0x63e0('0x2b')]=qs['offset'](_0x12e756['query'][_0x63e0('0x2b')]);}_0x2f54a8['order']=qs[_0x63e0('0x4d')](_0x12e756[_0x63e0('0x45')][_0x63e0('0x4d')]);_0x2f54a8[_0x63e0('0x4e')]=qs[_0x63e0('0x46')](_[_0x63e0('0x4f')](_0x12e756[_0x63e0('0x45')],_0x47d9b6['filters']));_0x2f54a8[_0x63e0('0x4e')][_0x63e0('0x5e')]=_0x2a3bcd['id'];if(_0x12e756[_0x63e0('0x45')]['filter']){_0x2f54a8['where']=_['merge'](_0x2f54a8[_0x63e0('0x4e')],{'$or':_[_0x63e0('0x3f')](_0x2f54a8[_0x63e0('0x47')],function(_0x29ad3d){var _0x2cb32e={};_0x2cb32e[_0x29ad3d]={'$like':'%'+_0x12e756['query']['filter']+'%'};return _0x2cb32e;})});}_0x2f54a8=_['merge']({},_0x2f54a8,_0x12e756[_0x63e0('0x52')]);return db[_0x63e0('0x66')][_0x63e0('0x53')]({'where':_0x2f54a8[_0x63e0('0x4e')]})[_0x63e0('0x1f')](function(_0x2ab094){_0x33011c[_0x63e0('0x53')]=_0x2ab094;if(_0x12e756[_0x63e0('0x45')][_0x63e0('0x54')]){_0x2f54a8[_0x63e0('0x55')]=[{'all':!![]}];}return db[_0x63e0('0x66')]['findAll'](_0x2f54a8);})[_0x63e0('0x1f')](function(_0x369d06){_0x33011c[_0x63e0('0x56')]=_0x369d06;return _0x33011c;});}})['then'](respondWithFilteredResult(_0x411c04,_0x2f54a8))['catch'](handleError(_0x411c04,null));};exports['removeAnswers']=function(_0x3d6482,_0x3343b5,_0x43aa12){return db[_0x63e0('0x40')][_0x63e0('0x5a')]({'where':{'id':_0x3d6482['params']['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x3343b5,null))['then'](function(_0x350cd8){if(_0x350cd8){return _0x350cd8['removeAnswers'](_0x3d6482[_0x63e0('0x45')][_0x63e0('0x63')]);}})[_0x63e0('0x1f')](respondWithStatusCode(_0x3343b5,null))[_0x63e0('0x27')](handleError(_0x3343b5,null));};exports[_0x63e0('0x65')]=function(_0x4f34c8,_0x3b24e2){var _0x16f4a3={'name':_0x4f34c8['body'][_0x63e0('0x39')],'key':_0x4f34c8[_0x63e0('0x5b')][_0x63e0('0x43')],'email':_0x4f34c8['body'][_0x63e0('0x67')],'ListId':_0x4f34c8[_0x63e0('0x5b')]['ListId'],'active':!_['isNil'](_0x4f34c8[_0x63e0('0x5b')][_0x63e0('0x68')])?_0x4f34c8[_0x63e0('0x5b')][_0x63e0('0x68')]:!![],'description':_0x4f34c8['body'][_0x63e0('0x69')]||null,'Imap':{},'Smtp':{}};if(_[_0x63e0('0x6a')](_0x4f34c8['body']['cservice'])){if(_0x4f34c8[_0x63e0('0x5b')][_0x63e0('0x6b')]){_0x16f4a3[_0x63e0('0x58')][_0x63e0('0x6c')]=_0x16f4a3[_0x63e0('0x3c')][_0x63e0('0x6c')]=_0x4f34c8[_0x63e0('0x5b')][_0x63e0('0x6d')];_0x16f4a3[_0x63e0('0x58')][_0x63e0('0x6e')]=_0x16f4a3[_0x63e0('0x3c')]['pass']=_0x4f34c8['body'][_0x63e0('0x6f')];}else{_0x16f4a3[_0x63e0('0x58')][_0x63e0('0x70')]=_0x16f4a3[_0x63e0('0x3c')][_0x63e0('0x70')]=![];}_0x16f4a3[_0x63e0('0x58')]['host']=_0x4f34c8['body']['Imap']['host'];_0x16f4a3[_0x63e0('0x58')][_0x63e0('0x71')]=_0x4f34c8[_0x63e0('0x5b')][_0x63e0('0x58')][_0x63e0('0x71')];_0x16f4a3[_0x63e0('0x3c')][_0x63e0('0x72')]=_0x4f34c8[_0x63e0('0x5b')]['Smtp'][_0x63e0('0x72')];_0x16f4a3[_0x63e0('0x3c')][_0x63e0('0x71')]=_0x4f34c8[_0x63e0('0x5b')][_0x63e0('0x3c')][_0x63e0('0x71')];}else{_0x16f4a3['Imap'][_0x63e0('0x73')]=_0x16f4a3[_0x63e0('0x3c')][_0x63e0('0x73')]=_0x4f34c8['body'][_0x63e0('0x74')];_0x16f4a3['Imap'][_0x63e0('0x6c')]=_0x16f4a3[_0x63e0('0x3c')]['user']=_0x4f34c8[_0x63e0('0x5b')][_0x63e0('0x6d')];_0x16f4a3[_0x63e0('0x58')][_0x63e0('0x6e')]=_0x16f4a3[_0x63e0('0x3c')][_0x63e0('0x75')]=_0x4f34c8[_0x63e0('0x5b')][_0x63e0('0x6f')];}return db[_0x63e0('0x40')]['create'](_0x16f4a3,{'include':[{'model':db[_0x63e0('0x3b')],'as':_0x63e0('0x3c')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x63e0('0x1f')](function(_0x1e39e0){var _0x8636a2=_0x4f34c8[_0x63e0('0x6c')][_0x63e0('0x35')]({'plain':!![]});if(!_0x8636a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8636a2[_0x63e0('0x76')]===_0x63e0('0x6c')){var _0x40355=_0x1e39e0[_0x63e0('0x35')]({'plain':!![]});return db[_0x63e0('0x77')][_0x63e0('0x5a')]({'where':{'name':_0x63e0('0x36'),'userProfileId':_0x8636a2[_0x63e0('0x78')]},'raw':!![]})[_0x63e0('0x1f')](function(_0x299b56){if(_0x299b56&&_0x299b56[_0x63e0('0x79')]===0x0){return db[_0x63e0('0x37')][_0x63e0('0x65')]({'name':_0x40355[_0x63e0('0x39')],'resourceId':_0x40355['id'],'type':_0x299b56['name'],'sectionId':_0x299b56['id']},{})[_0x63e0('0x1f')](function(){return _0x1e39e0;});}else{return _0x1e39e0;}})[_0x63e0('0x27')](function(_0x26b45a){logger[_0x63e0('0x24')](_0x63e0('0x7a'),_0x26b45a);throw _0x26b45a;});}return _0x1e39e0;})[_0x63e0('0x1f')](respondWithResult(_0x3b24e2,0xc9))[_0x63e0('0x27')](handleError(_0x3b24e2,null));};exports[_0x63e0('0x7b')]=function(_0xabf2b8,_0x39720b,_0x518697){return db['MailAccount'][_0x63e0('0x60')]({'where':{'id':_0xabf2b8[_0x63e0('0x57')]['id']}})['then'](handleEntityNotFound(_0x39720b,null))[_0x63e0('0x1f')](function(_0x421aa8){if(_0x421aa8){return _0x421aa8[_0x63e0('0x7b')]();}return null;})['then'](respondWithResult(_0x39720b,null))[_0x63e0('0x27')](handleError(_0x39720b,null));};exports['addImap']=function(_0x541992,_0x578c27,_0xeac07c){if(_0x541992[_0x63e0('0x5b')]['id']){delete _0x541992[_0x63e0('0x5b')]['id'];}return db[_0x63e0('0x40')][_0x63e0('0x5a')]({'where':{'id':_0x541992['params']['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x578c27,null))[_0x63e0('0x1f')](function(_0x15c695){if(_0x15c695){_0x541992['body'][_0x63e0('0x5e')]=_0x15c695['id'];return db[_0x63e0('0x3a')][_0x63e0('0x65')](_0x541992[_0x63e0('0x5b')]);}})[_0x63e0('0x1f')](respondWithResult(_0x578c27,null))[_0x63e0('0x27')](handleError(_0x578c27,null));};exports['removeImap']=function(_0x376a7e,_0x508cbd,_0x44cf4c){return db[_0x63e0('0x40')][_0x63e0('0x60')]({'where':{'id':_0x376a7e[_0x63e0('0x57')]['id']}})['then'](handleEntityNotFound(_0x508cbd,null))[_0x63e0('0x1f')](function(_0x47f17a){if(_0x47f17a){return _0x47f17a[_0x63e0('0x7c')](null);}return null;})[_0x63e0('0x1f')](respondWithStatusCode(_0x508cbd,null))[_0x63e0('0x27')](handleError(_0x508cbd,null));};exports['getSmtp']=function(_0x4d669a,_0x3bf391,_0x1a18e8){return db[_0x63e0('0x40')][_0x63e0('0x60')]({'where':{'id':_0x4d669a[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x3bf391,null))[_0x63e0('0x1f')](function(_0x46a814){if(_0x46a814){return _0x46a814[_0x63e0('0x7d')]();}return null;})['then'](respondWithResult(_0x3bf391,null))[_0x63e0('0x27')](handleError(_0x3bf391,null));};exports['addSmtp']=function(_0x428d11,_0x206f4a,_0x41b6d0){if(_0x428d11[_0x63e0('0x5b')]['id']){delete _0x428d11[_0x63e0('0x5b')]['id'];}return db[_0x63e0('0x40')]['find']({'where':{'id':_0x428d11[_0x63e0('0x57')]['id']}})['then'](handleEntityNotFound(_0x206f4a,null))[_0x63e0('0x1f')](function(_0x48ee23){if(_0x48ee23){_0x428d11[_0x63e0('0x5b')][_0x63e0('0x5e')]=_0x48ee23['id'];return db[_0x63e0('0x3b')][_0x63e0('0x65')](_0x428d11[_0x63e0('0x5b')]);}})[_0x63e0('0x1f')](respondWithResult(_0x206f4a,null))['catch'](handleError(_0x206f4a,null));};exports[_0x63e0('0x7e')]=function(_0x577cb6,_0xd18fb5,_0x2f70cb){return db[_0x63e0('0x40')]['findOne']({'where':{'id':_0x577cb6[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0xd18fb5,null))[_0x63e0('0x1f')](function(_0x58d8a6){if(_0x58d8a6){return _0x58d8a6[_0x63e0('0x7f')](null);}return null;})[_0x63e0('0x1f')](respondWithStatusCode(_0xd18fb5,null))[_0x63e0('0x27')](handleError(_0xd18fb5,null));};exports[_0x63e0('0x80')]=function(_0x3b53f6,_0x5f1aab,_0x501033){return db[_0x63e0('0x81')][_0x63e0('0x5a')]({'where':{'id':_0x3b53f6[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x5f1aab,null))[_0x63e0('0x1f')](function(_0x5a4b11){if(_0x5a4b11){return _0x5a4b11['addInteraction'](_0x3b53f6['body'][_0x63e0('0x63')],_[_0x63e0('0x82')](_0x3b53f6[_0x63e0('0x5b')],[_0x63e0('0x63'),'id'])||{});}})[_0x63e0('0x1f')](respondWithResult(_0x5f1aab,null))[_0x63e0('0x27')](handleError(_0x5f1aab,null));};exports[_0x63e0('0x83')]=function(_0x4cf9d3,_0xe4ef25,_0x24bc86){var _0x3a5d53={'raw':![],'where':{}};var _0xc4004f={};var _0x116370={'count':0x0,'rows':[]};return db[_0x63e0('0x40')][_0x63e0('0x60')]({'where':{'id':_0x4cf9d3[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0xe4ef25,null))[_0x63e0('0x1f')](function(_0x280011){if(_0x280011){_0xc4004f[_0x63e0('0x44')]=_[_0x63e0('0x59')](db['MailInteraction']['rawAttributes']);_0xc4004f['query']=_[_0x63e0('0x59')](_0x4cf9d3[_0x63e0('0x45')]);_0xc4004f[_0x63e0('0x46')]=_[_0x63e0('0x48')](_0xc4004f[_0x63e0('0x44')],_0xc4004f[_0x63e0('0x45')]);_0x3a5d53['attributes']=_['intersection'](_0xc4004f[_0x63e0('0x44')],qs[_0x63e0('0x49')](_0x4cf9d3['query']['fields']));_0x3a5d53[_0x63e0('0x47')]=_0x3a5d53['attributes']['length']?_0x3a5d53[_0x63e0('0x47')]:_0xc4004f[_0x63e0('0x44')];if(!_0x4cf9d3[_0x63e0('0x45')][_0x63e0('0x61')](_0x63e0('0x4b'))){_0x3a5d53[_0x63e0('0x2d')]=qs[_0x63e0('0x2d')](_0x4cf9d3[_0x63e0('0x45')][_0x63e0('0x2d')]);_0x3a5d53['offset']=qs[_0x63e0('0x2b')](_0x4cf9d3[_0x63e0('0x45')]['offset']);}_0x3a5d53['order']=qs[_0x63e0('0x4d')](_0x4cf9d3[_0x63e0('0x45')]['sort']);_0x3a5d53[_0x63e0('0x4e')]=qs[_0x63e0('0x46')](_['pick'](_0x4cf9d3[_0x63e0('0x45')],_0xc4004f[_0x63e0('0x46')]));_0x3a5d53[_0x63e0('0x4e')][_0x63e0('0x5e')]=_0x280011['id'];if(_0x4cf9d3[_0x63e0('0x45')][_0x63e0('0x50')]){_0x3a5d53[_0x63e0('0x4e')]=_[_0x63e0('0x51')](_0x3a5d53[_0x63e0('0x4e')],{'$or':_[_0x63e0('0x3f')](_0x3a5d53['attributes'],function(_0x4e5d15){var _0x39d45e={};_0x39d45e[_0x4e5d15]={'$like':'%'+_0x4cf9d3[_0x63e0('0x45')][_0x63e0('0x50')]+'%'};return _0x39d45e;})});}_0x3a5d53=_[_0x63e0('0x51')]({},_0x3a5d53,_0x4cf9d3[_0x63e0('0x52')]);return db[_0x63e0('0x81')]['count']({'where':_0x3a5d53['where']})[_0x63e0('0x1f')](function(_0x2ae2ab){_0x116370['count']=_0x2ae2ab;if(_0x4cf9d3[_0x63e0('0x45')][_0x63e0('0x54')]){_0x3a5d53[_0x63e0('0x55')]=[{'model':db[_0x63e0('0x84')],'as':_0x63e0('0x85'),'required':![]},{'model':db[_0x63e0('0x86')],'as':_0x63e0('0x87'),'attributes':['name','fullname',_0x63e0('0x88')],'required':![]},{'model':db[_0x63e0('0x89')],'as':'Tags','attributes':['id','name',_0x63e0('0x8a')],'where':_0x4cf9d3['query'][_0x63e0('0x8b')]?{'id':_0x4cf9d3[_0x63e0('0x45')][_0x63e0('0x8b')]}:undefined,'required':_0x4cf9d3[_0x63e0('0x45')][_0x63e0('0x8b')]?!![]:![]}];}return db[_0x63e0('0x81')][_0x63e0('0x8c')](_0x3a5d53);})[_0x63e0('0x1f')](function(_0x12c357){_0x116370[_0x63e0('0x56')]=_0x12c357;return _0x116370;});}})[_0x63e0('0x1f')](respondWithFilteredResult(_0xe4ef25,_0x3a5d53))[_0x63e0('0x27')](handleError(_0xe4ef25,null));};exports['addApplications']=function(_0x2ef24f,_0x59823c,_0x2d93b1){return db['MailAccount']['findOne']({'where':{'id':_0x2ef24f['params']['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x59823c,null))[_0x63e0('0x1f')](function(_0x24b562){if(_0x24b562){return db[_0x63e0('0x8d')][_0x63e0('0x8e')](function(_0x1d4fa0){return db[_0x63e0('0x8f')][_0x63e0('0x34')]({'where':{'MailAccountId':_0x2ef24f[_0x63e0('0x57')]['id']},'transaction':_0x1d4fa0})[_0x63e0('0x1f')](function(_0x53fc27){var _0x18a302=_['map'](_0x2ef24f[_0x63e0('0x5b')],function(_0x2d147d){_0x2d147d['MailAccountId']=_0x2ef24f[_0x63e0('0x57')]['id'];return _0x2d147d;});return db['MailApplication'][_0x63e0('0x90')](_0x18a302,{'transaction':_0x1d4fa0});});})[_0x63e0('0x1f')](function(){return db[_0x63e0('0x8f')][_0x63e0('0x91')]({'where':{'MailAccountId':_0x2ef24f['params']['id']},'order':_0x63e0('0x92')});});}})['then'](respondWithResult(_0x59823c,null))['catch'](handleError(_0x59823c,null));};exports[_0x63e0('0x93')]=function(_0xb87548,_0xaeb437,_0x55fa03){var _0x106a76={};var _0x40923d={};var _0x4beecb;var _0x114a44;return db['MailAccount'][_0x63e0('0x60')]({'where':{'id':_0xb87548[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0xaeb437,null))[_0x63e0('0x1f')](function(_0x3ffcdc){if(_0x3ffcdc){_0x4beecb=_0x3ffcdc;_0x40923d[_0x63e0('0x44')]=_['keys'](db[_0x63e0('0x8f')][_0x63e0('0x41')]);_0x40923d[_0x63e0('0x45')]=_[_0x63e0('0x59')](_0xb87548['query']);_0x40923d['filters']=_[_0x63e0('0x48')](_0x40923d[_0x63e0('0x44')],_0x40923d['query']);_0x106a76[_0x63e0('0x47')]=_[_0x63e0('0x48')](_0x40923d[_0x63e0('0x44')],qs['fields'](_0xb87548[_0x63e0('0x45')][_0x63e0('0x49')]));_0x106a76['attributes']=_0x106a76[_0x63e0('0x47')][_0x63e0('0x4a')]?_0x106a76[_0x63e0('0x47')]:_0x40923d[_0x63e0('0x44')];_0x106a76[_0x63e0('0x4c')]=qs[_0x63e0('0x4d')](_0xb87548[_0x63e0('0x45')]['sort']);_0x106a76[_0x63e0('0x4e')]=qs[_0x63e0('0x46')](_[_0x63e0('0x4f')](_0xb87548['query'],_0x40923d[_0x63e0('0x46')]));if(_0xb87548[_0x63e0('0x45')][_0x63e0('0x50')]){_0x106a76[_0x63e0('0x4e')]=_[_0x63e0('0x51')](_0x106a76[_0x63e0('0x4e')],{'$or':_['map'](_0x106a76[_0x63e0('0x47')],function(_0x458ab1){var _0x12c30b={};_0x12c30b[_0x458ab1]={'$like':'%'+_0xb87548[_0x63e0('0x45')][_0x63e0('0x50')]+'%'};return _0x12c30b;})});}_0x106a76=_[_0x63e0('0x51')]({},_0x106a76,_0xb87548[_0x63e0('0x52')]);return _0x4beecb[_0x63e0('0x93')](_0x106a76);}})[_0x63e0('0x1f')](function(_0x31f599){if(_0x31f599){_0x114a44=_0x31f599[_0x63e0('0x4a')];if(!_0xb87548[_0x63e0('0x45')][_0x63e0('0x61')](_0x63e0('0x4b'))){_0x106a76[_0x63e0('0x2d')]=qs[_0x63e0('0x2d')](_0xb87548['query'][_0x63e0('0x2d')]);_0x106a76[_0x63e0('0x2b')]=qs[_0x63e0('0x2b')](_0xb87548[_0x63e0('0x45')]['offset']);}return _0x4beecb['getApplications'](_0x106a76);}})[_0x63e0('0x1f')](function(_0x48069d){if(_0x48069d){return _0x48069d?{'count':_0x114a44,'rows':_0x48069d}:null;}})[_0x63e0('0x1f')](respondWithResult(_0xaeb437,null))[_0x63e0('0x27')](handleError(_0xaeb437,null));};exports['getMessages']=function(_0xe99962,_0x50de06,_0x27e3de){var _0x1ffeec={'raw':!![],'where':{}};var _0x4e01ea={};var _0x518f21={'count':0x0,'rows':[]};return db['MailAccount'][_0x63e0('0x60')]({'where':{'id':_0xe99962[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x50de06,null))[_0x63e0('0x1f')](function(_0x62b30c){if(_0x62b30c){_0x4e01ea[_0x63e0('0x44')]=_['keys'](db['MailMessage']['rawAttributes']);_0x4e01ea[_0x63e0('0x45')]=_[_0x63e0('0x59')](_0xe99962['query']);_0x4e01ea[_0x63e0('0x46')]=_['intersection'](_0x4e01ea[_0x63e0('0x44')],_0x4e01ea[_0x63e0('0x45')]);_0x1ffeec[_0x63e0('0x47')]=_[_0x63e0('0x48')](_0x4e01ea['model'],qs[_0x63e0('0x49')](_0xe99962[_0x63e0('0x45')][_0x63e0('0x49')]));_0x1ffeec[_0x63e0('0x47')]=_0x1ffeec[_0x63e0('0x47')][_0x63e0('0x4a')]?_0x1ffeec['attributes']:_0x4e01ea[_0x63e0('0x44')];if(!_0xe99962[_0x63e0('0x45')][_0x63e0('0x61')](_0x63e0('0x4b'))){_0x1ffeec[_0x63e0('0x2d')]=qs[_0x63e0('0x2d')](_0xe99962[_0x63e0('0x45')]['limit']);_0x1ffeec[_0x63e0('0x2b')]=qs[_0x63e0('0x2b')](_0xe99962[_0x63e0('0x45')][_0x63e0('0x2b')]);}_0x1ffeec[_0x63e0('0x4c')]=qs[_0x63e0('0x4d')](_0xe99962[_0x63e0('0x45')][_0x63e0('0x4d')]);_0x1ffeec[_0x63e0('0x4e')]=qs[_0x63e0('0x46')](_[_0x63e0('0x4f')](_0xe99962[_0x63e0('0x45')],_0x4e01ea[_0x63e0('0x46')]));_0x1ffeec[_0x63e0('0x4e')]['MailAccountId']=_0x62b30c['id'];if(_0xe99962[_0x63e0('0x45')]['filter']){_0x1ffeec['where']=_[_0x63e0('0x51')](_0x1ffeec[_0x63e0('0x4e')],{'$or':_['map'](_0x1ffeec[_0x63e0('0x47')],function(_0x5de7b0){var _0x4b3189={};_0x4b3189[_0x5de7b0]={'$like':'%'+_0xe99962['query'][_0x63e0('0x50')]+'%'};return _0x4b3189;})});}if(_0xe99962[_0x63e0('0x45')][_0x63e0('0x94')]){var _0x52ae89=_0xe99962['query']['$gte'][_0x63e0('0x95')](',');var _0x4602bf={};_0x4602bf[_0x52ae89[0x0]]={'$gte':moment(_0x52ae89[0x1])[_0x63e0('0x96')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1ffeec['where']=_[_0x63e0('0x51')](_0x1ffeec[_0x63e0('0x4e')],_0x4602bf);}_0x1ffeec=_['merge']({},_0x1ffeec,_0xe99962[_0x63e0('0x52')]);return db[_0x63e0('0x97')]['count']({'where':_0x1ffeec[_0x63e0('0x4e')]})[_0x63e0('0x1f')](function(_0xf54065){_0x518f21[_0x63e0('0x53')]=_0xf54065;if(_0xe99962[_0x63e0('0x45')][_0x63e0('0x54')]){_0x1ffeec[_0x63e0('0x55')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1ffeec);})[_0x63e0('0x1f')](function(_0x549d1e){if(_0xe99962[_0x63e0('0x45')]['inlineCss']===_0x63e0('0x98')){for(var _0x57aae9=0x0;_0x57aae9<_0x549d1e[_0x63e0('0x4a')];_0x57aae9++){_0x549d1e[_0x57aae9][_0x63e0('0x5b')]=juice(_0x549d1e[_0x57aae9][_0x63e0('0x5b')]);}}_0x518f21[_0x63e0('0x56')]=_0x549d1e;return _0x518f21;});}})['then'](respondWithFilteredResult(_0x50de06,_0x1ffeec))[_0x63e0('0x27')](handleError(_0x50de06,null));};exports['send']=function(_0x36f4e4,_0x3fca5f,_0x56cd48){var _0x50bee8,_0x37186e={},_0x1bca53;if(_0x36f4e4['body']['to']){_0x1bca53=_0x36f4e4['body']['to'][_0x63e0('0x95')](',')[0x0];}return db[_0x63e0('0x40')][_0x63e0('0x5a')]({'where':{'id':_0x36f4e4[_0x63e0('0x57')]['id']},'include':[{'model':db[_0x63e0('0x99')],'as':_0x63e0('0x9a'),'include':[{'model':db[_0x63e0('0x84')],'as':_0x63e0('0x9b'),'where':{'email':_0x1bca53},'limit':0x1,'order':[[_0x63e0('0x9c'),_0x63e0('0x9d')]]}]},{'model':db['MailServerOut'],'as':_0x63e0('0x3c'),'raw':!![]}]})[_0x63e0('0x1f')](handleEntityNotFound(_0x3fca5f,null))['then'](function(_0x40dd5d){if(_0x40dd5d){_0x50bee8=_0x40dd5d;if(_0x40dd5d[_0x63e0('0x3c')]){if(_[_0x63e0('0x6a')](_0x36f4e4[_0x63e0('0x5b')][_0x63e0('0x9e')])){_0x36f4e4[_0x63e0('0x5b')][_0x63e0('0x9e')]=util[_0x63e0('0x96')]('%s\x20<%s>',_0x40dd5d[_0x63e0('0x39')],_0x40dd5d[_0x63e0('0x67')]||_0x40dd5d[_0x63e0('0x3c')][_0x63e0('0x6c')]);}if(_0x36f4e4[_0x63e0('0x5b')][_0x63e0('0x9f')]&&_0x36f4e4[_0x63e0('0x5b')][_0x63e0('0x9f')][_0x63e0('0x4a')]){for(var _0x169dbd=0x0;_0x169dbd<_0x36f4e4[_0x63e0('0x5b')][_0x63e0('0x9f')][_0x63e0('0x4a')];_0x169dbd+=0x1){_0x36f4e4[_0x63e0('0x5b')][_0x63e0('0x9f')][_0x169dbd]={'filename':_0x36f4e4['body'][_0x63e0('0x9f')][_0x169dbd][_0x63e0('0x39')],'path':path[_0x63e0('0xa0')](config[_0x63e0('0xa1')],_0x63e0('0xa2'),_0x36f4e4['body'][_0x63e0('0x9f')][_0x169dbd][_0x63e0('0xa3')])};}}var _0x2315ac={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x40dd5d['Smtp']['service'])){if(_0x40dd5d[_0x63e0('0x3c')][_0x63e0('0x70')]){_0x2315ac['auth']={'user':_0x40dd5d[_0x63e0('0x3c')]['user'],'pass':_0x40dd5d[_0x63e0('0x3c')][_0x63e0('0x75')]};}_0x2315ac[_0x63e0('0x72')]=_0x40dd5d[_0x63e0('0x3c')][_0x63e0('0x72')];_0x2315ac['port']=_0x40dd5d['Smtp'][_0x63e0('0x71')];_0x2315ac['secure']=_0x40dd5d['Smtp'][_0x63e0('0xa4')];}else{_0x2315ac[_0x63e0('0x73')]=_0x40dd5d['Smtp'][_0x63e0('0x73')];_0x2315ac['auth']={'user':_0x40dd5d[_0x63e0('0x3c')][_0x63e0('0x6c')],'pass':_0x40dd5d['Smtp'][_0x63e0('0x75')]};}return respondWithRpcPromise(_0x63e0('0xa5'),_0x63e0('0xa6'),{'account':_0x2315ac,'message':_0x36f4e4[_0x63e0('0x5b')]});}else{throw new Error(_0x63e0('0xa7'));}}})[_0x63e0('0x1f')](function(_0x4c2c5b){if(_0x4c2c5b){_0x37186e=_0x4c2c5b;if(_0x50bee8[_0x63e0('0x9a')]){if(_0x50bee8[_0x63e0('0x9a')][_0x63e0('0x9b')]['length']){return _0x50bee8[_0x63e0('0x9a')][_0x63e0('0x9b')][0x0];}else{return db[_0x63e0('0x84')][_0x63e0('0x65')](_[_0x63e0('0x19')](_0x36f4e4['body'],{'firstName':_0x36f4e4['body']['to'],'email':_0x36f4e4[_0x63e0('0x5b')]['to'],'phone':_0x36f4e4[_0x63e0('0x5b')]['to'],'ListId':_0x50bee8[_0x63e0('0xa8')]}));}}else{throw new Error(_0x63e0('0xa7'));}}})[_0x63e0('0x1f')](function(_0x54efd2){if(_0x54efd2){var _0x413800={'UserId':_0x36f4e4['user']['id'],'ContactId':_0x54efd2['id'],'MailAccountId':_0x50bee8['id'],'inReplyTo':_0x37186e[_0x63e0('0xa9')],'to':_0x36f4e4[_0x63e0('0x5b')]['from'],'cc':_0x36f4e4['body']['cc'],'subject':_0x36f4e4[_0x63e0('0x5b')]['subject'],'attach':_0x36f4e4[_0x63e0('0x5b')][_0x63e0('0xaa')],'firstMsgDirection':_0x63e0('0xab'),'lastMsgAt':moment()[_0x63e0('0x96')](_0x63e0('0xac')),'lastMsgDirection':_0x63e0('0xab'),'Messages':[_[_0x63e0('0x51')](_0x36f4e4[_0x63e0('0x5b')],{'messageId':_0x37186e[_0x63e0('0xa9')],'sentAt':moment()[_0x63e0('0x96')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x50bee8['id'],'UserId':_0x36f4e4[_0x63e0('0x6c')]['id'],'ContactId':_0x54efd2['id']})]};if(_0x36f4e4['body'][_0x63e0('0xad')]){_0x413800=_[_0x63e0('0x51')](_0x413800,_0x36f4e4[_0x63e0('0x5b')][_0x63e0('0xad')]);}return db[_0x63e0('0x81')][_0x63e0('0x65')](_0x413800,{'include':[{'model':db[_0x63e0('0x97')],'as':_0x63e0('0xae')}]});}})['then'](respondWithResult(_0x3fca5f,null))[_0x63e0('0x27')](handleError(_0x3fca5f,null));};exports[_0x63e0('0xaf')]=function(_0x223878,_0x3fcbbf,_0x137353){return db[_0x63e0('0x40')]['find']({'where':{'id':_0x223878[_0x63e0('0x57')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x63e0('0x3c'),'raw':!![]}]})[_0x63e0('0x1f')](handleEntityNotFound(_0x3fcbbf,null))[_0x63e0('0x1f')](function(_0x447f16){if(_0x447f16&&_0x447f16[_0x63e0('0x3c')]){var _0x1dab24={'id':_0x447f16['id'],'tls':{'rejectUnauthorized':![]}};if(_0x447f16['Smtp'][_0x63e0('0x73')]){_0x1dab24['service']=_0x447f16[_0x63e0('0x3c')][_0x63e0('0x73')];}else{_0x1dab24[_0x63e0('0x72')]=_0x447f16[_0x63e0('0x3c')][_0x63e0('0x72')];_0x1dab24[_0x63e0('0x71')]=_0x447f16[_0x63e0('0x3c')][_0x63e0('0x71')];_0x1dab24[_0x63e0('0xa4')]=_0x447f16[_0x63e0('0x3c')]['secure'];}if(_0x447f16[_0x63e0('0x3c')]['authentication']){_0x1dab24[_0x63e0('0xb0')]={'user':_0x447f16[_0x63e0('0x3c')][_0x63e0('0x6c')],'pass':_0x447f16[_0x63e0('0x3c')][_0x63e0('0x75')]};}return respondWithRpcPromise(_0x63e0('0xb1'),_0x63e0('0xaf'),{'account':_0x1dab24});}})[_0x63e0('0x1f')](respondWithResult(_0x3fcbbf,null))[_0x63e0('0x27')](handleError(_0x3fcbbf,null));};exports[_0x63e0('0x34')]=function(_0x4addc2,_0xe4324f){return db[_0x63e0('0x40')][_0x63e0('0x5a')]({'where':{'id':_0x4addc2[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0xe4324f,null))[_0x63e0('0x1f')](function(_0x471e03){if(_0x471e03&&_0x471e03[_0x63e0('0x73')]){throw new db[(_0x63e0('0xb2'))]['ValidationError'](_0x63e0('0xb3'));}return _0x471e03;})['then'](removeEntity(_0xe4324f,null))['catch'](handleError(_0xe4324f,null));};exports['addAgents']=function(_0x4c4c30,_0x54fa32,_0x59577a){return db[_0x63e0('0x40')][_0x63e0('0x5a')]({'where':{'id':_0x4c4c30[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x54fa32,null))['then'](function(_0x52a081){if(_0x52a081){return _0x52a081[_0x63e0('0xb4')](_0x4c4c30[_0x63e0('0x5b')]['ids'],_[_0x63e0('0x82')](_0x4c4c30['body'],['ids','id'])||{})['spread'](function(_0x2bb1f1){for(var _0x3f5f4c=0x0;_0x3f5f4c<_0x4c4c30[_0x63e0('0x5b')][_0x63e0('0x63')]['length'];_0x3f5f4c+=0x1){socket[_0x63e0('0xb5')](_0x63e0('0xb6'),{'UserId':Number(_0x4c4c30[_0x63e0('0x5b')]['ids'][_0x3f5f4c]),'MailAccountId':Number(_0x4c4c30[_0x63e0('0x57')]['id'])});}return _0x2bb1f1;});}})[_0x63e0('0x1f')](respondWithResult(_0x54fa32,null))[_0x63e0('0x27')](handleError(_0x54fa32,null));};exports['removeAgents']=function(_0x471727,_0x438855,_0x50d90a){return db[_0x63e0('0x40')][_0x63e0('0x5a')]({'where':{'id':_0x471727[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x438855,null))[_0x63e0('0x1f')](function(_0x794285){if(_0x794285){return _0x794285[_0x63e0('0xb7')](_0x471727[_0x63e0('0x45')][_0x63e0('0x63')])[_0x63e0('0x1f')](function(){if(_[_0x63e0('0xb8')](_0x471727[_0x63e0('0x45')][_0x63e0('0x63')])){for(var _0x3a3549=0x0;_0x3a3549<_0x471727[_0x63e0('0x45')][_0x63e0('0x63')][_0x63e0('0x4a')];_0x3a3549+=0x1){socket[_0x63e0('0xb5')](_0x63e0('0xb9'),{'UserId':Number(_0x471727[_0x63e0('0x45')][_0x63e0('0x63')][_0x3a3549]),'MailAccountId':Number(_0x471727[_0x63e0('0x57')]['id'])});}}else{socket[_0x63e0('0xb5')](_0x63e0('0xb9'),{'UserId':Number(_0x471727[_0x63e0('0x45')][_0x63e0('0x63')]),'MailAccountId':Number(_0x471727[_0x63e0('0x57')]['id'])});}});}})[_0x63e0('0x1f')](respondWithStatusCode(_0x438855,null))[_0x63e0('0x27')](handleError(_0x438855,null));};exports[_0x63e0('0xba')]=function(_0x99be9f,_0x4c43dd,_0x4dd337){var _0x42d85c={};var _0x2bc6c6={};var _0x97c906;var _0x508ead;return db['MailAccount']['findOne']({'where':{'id':_0x99be9f[_0x63e0('0x57')]['id']}})[_0x63e0('0x1f')](handleEntityNotFound(_0x4c43dd,null))[_0x63e0('0x1f')](function(_0x62961a){if(_0x62961a){_0x97c906=_0x62961a;_0x2bc6c6[_0x63e0('0x44')]=_[_0x63e0('0x59')](db['User'][_0x63e0('0x41')]);_0x2bc6c6[_0x63e0('0x45')]=_[_0x63e0('0x59')](_0x99be9f['query']);_0x2bc6c6[_0x63e0('0x46')]=_[_0x63e0('0x48')](_0x2bc6c6[_0x63e0('0x44')],_0x2bc6c6[_0x63e0('0x45')]);_0x42d85c[_0x63e0('0x47')]=_[_0x63e0('0x48')](_0x2bc6c6['model'],qs[_0x63e0('0x49')](_0x99be9f[_0x63e0('0x45')][_0x63e0('0x49')]));_0x42d85c[_0x63e0('0x47')]=_0x42d85c[_0x63e0('0x47')][_0x63e0('0x4a')]?_0x42d85c['attributes']:_0x2bc6c6['model'];_0x42d85c[_0x63e0('0x4c')]=qs[_0x63e0('0x4d')](_0x99be9f[_0x63e0('0x45')][_0x63e0('0x4d')]);_0x42d85c[_0x63e0('0x4e')]=qs[_0x63e0('0x46')](_[_0x63e0('0x4f')](_0x99be9f[_0x63e0('0x45')],_0x2bc6c6[_0x63e0('0x46')]));if(_0x99be9f[_0x63e0('0x45')][_0x63e0('0x50')]){_0x42d85c['where']=_['merge'](_0x42d85c[_0x63e0('0x4e')],{'$or':_[_0x63e0('0x3f')](_0x42d85c['attributes'],function(_0x5b0e41){var _0x424a84={};_0x424a84[_0x5b0e41]={'$like':'%'+_0x99be9f[_0x63e0('0x45')][_0x63e0('0x50')]+'%'};return _0x424a84;})});}_0x42d85c=_[_0x63e0('0x51')]({},_0x42d85c,_0x99be9f[_0x63e0('0x52')]);return _0x97c906[_0x63e0('0xba')](_0x42d85c);}})[_0x63e0('0x1f')](function(_0x577f11){if(_0x577f11){_0x508ead=_0x577f11[_0x63e0('0x4a')];if(!_0x99be9f[_0x63e0('0x45')][_0x63e0('0x61')](_0x63e0('0x4b'))){_0x42d85c[_0x63e0('0x2d')]=qs[_0x63e0('0x2d')](_0x99be9f['query'][_0x63e0('0x2d')]);_0x42d85c[_0x63e0('0x2b')]=qs[_0x63e0('0x2b')](_0x99be9f[_0x63e0('0x45')]['offset']);}return _0x97c906[_0x63e0('0xba')](_0x42d85c);}})[_0x63e0('0x1f')](function(_0x574bb5){if(_0x574bb5){return _0x574bb5?{'count':_0x508ead,'rows':_0x574bb5}:null;}})['then'](respondWithResult(_0x4c43dd,null))[_0x63e0('0x27')](handleError(_0x4c43dd,null));}; \ No newline at end of file +var _0xc5b1=['sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','MailAccounts','UserProfileResource','stack','name','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','body','params','addDisposition','Disposition','getDispositions','rawAttributes','MailAccountId','filter','removeDispositions','ids','CannedAnswer','create','getAnswers','findOne','removeAnswers','key','email','ListId','isNil','active','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','User','Owner','fullname','internal','Tags','color','tag','MailInteraction','addApplications','sequelize','transaction','MailApplication','findAndCountAll','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','send','split','CmList','List','Contacts','DESC','from','%s\x20<%s>','attachments','join','root','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','CmContact','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xc5b1,0x98));var _0x1c5b=function(_0x3b1cda,_0x340fa0){_0x3b1cda=_0x3b1cda-0x0;var _0x19a821=_0xc5b1[_0x3b1cda];return _0x19a821;};'use strict';var emlformat=require(_0x1c5b('0x0'));var rimraf=require(_0x1c5b('0x1'));var zipdir=require(_0x1c5b('0x2'));var jsonpatch=require(_0x1c5b('0x3'));var rp=require(_0x1c5b('0x4'));var moment=require(_0x1c5b('0x5'));var BPromise=require(_0x1c5b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1c5b('0x7'));var sox=require(_0x1c5b('0x8'));var csv=require(_0x1c5b('0x9'));var ejs=require(_0x1c5b('0xa'));var fs=require('fs');var fs_extra=require(_0x1c5b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1c5b('0xc'));var jsforce=require(_0x1c5b('0xd'));var deskjs=require(_0x1c5b('0xe'));var toCsv=require(_0x1c5b('0x9'));var querystring=require(_0x1c5b('0xf'));var Papa=require(_0x1c5b('0x10'));var htmlToText=require('html-to-text');var juice=require(_0x1c5b('0x11'));var Redis=require(_0x1c5b('0x12'));var authService=require(_0x1c5b('0x13'));var qs=require(_0x1c5b('0x14'));var as=require(_0x1c5b('0x15'));var hardwareService=require(_0x1c5b('0x16'));var logger=require(_0x1c5b('0x17'))(_0x1c5b('0x18'));var utils=require('../../config/utils');var config=require(_0x1c5b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c5b('0x1a'))['db'];config[_0x1c5b('0x1b')]=_[_0x1c5b('0x1c')](config[_0x1c5b('0x1b')],{'host':_0x1c5b('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c5b('0x1b')]));require(_0x1c5b('0x1e'))[_0x1c5b('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1c5b('0x20')][_0x1c5b('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x58d5c6,_0x38c993,_0x56ab4f,_0x1a0971){return new BPromise(function(_0x46c743,_0x8adb31){var _0x47474b=_0x1a0971||client;return _0x47474b[_0x1c5b('0x22')](_0x58d5c6,_0x56ab4f)[_0x1c5b('0x23')](function(_0x393aff){logger['info'](_0x1c5b('0x24'),_0x38c993,_0x1c5b('0x25'));logger[_0x1c5b('0x26')](_0x1c5b('0x27'),_0x38c993,_0x1c5b('0x25'),JSON[_0x1c5b('0x28')](_0x393aff));if(_0x393aff['error']){if(_0x393aff[_0x1c5b('0x29')][_0x1c5b('0x2a')]===0x1f4){logger['error'](_0x1c5b('0x24'),_0x38c993,_0x393aff[_0x1c5b('0x29')][_0x1c5b('0x2b')]);return _0x8adb31(_0x393aff['error'][_0x1c5b('0x2b')]);}logger[_0x1c5b('0x29')](_0x1c5b('0x24'),_0x38c993,_0x393aff['error'][_0x1c5b('0x2b')]);return _0x46c743(_0x393aff['error'][_0x1c5b('0x2b')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x38c993,_0x1c5b('0x25'));_0x46c743(_0x393aff[_0x1c5b('0x2c')][_0x1c5b('0x2b')]);}})[_0x1c5b('0x2d')](function(_0x3962cc){logger['error'](_0x1c5b('0x24'),_0x38c993,_0x3962cc);_0x8adb31(_0x3962cc);});});}function respondWithStatusCode(_0x1c2247,_0x20d63b){_0x20d63b=_0x20d63b||0xcc;return function(_0x3702cc){if(_0x3702cc){return _0x1c2247[_0x1c5b('0x2e')](_0x20d63b);}return _0x1c2247[_0x1c5b('0x2f')](_0x20d63b)[_0x1c5b('0x30')]();};}function respondWithResult(_0x33e317,_0xf958ed){_0xf958ed=_0xf958ed||0xc8;return function(_0x51a37f){if(_0x51a37f){return _0x33e317[_0x1c5b('0x2f')](_0xf958ed)[_0x1c5b('0x31')](_0x51a37f);}};}function respondWithFilteredResult(_0x73c654,_0x3c2771){return function(_0xbc30a4){if(_0xbc30a4){var _0x4c8dfe=typeof _0x3c2771['offset']===_0x1c5b('0x32')&&typeof _0x3c2771[_0x1c5b('0x33')]===_0x1c5b('0x32');var _0x37fd5d=_0xbc30a4[_0x1c5b('0x34')];var _0x228751=_0x4c8dfe?0x0:_0x3c2771[_0x1c5b('0x35')];var _0x252766=_0x4c8dfe?_0xbc30a4[_0x1c5b('0x34')]:_0x3c2771[_0x1c5b('0x35')]+_0x3c2771[_0x1c5b('0x33')];var _0x582502;if(_0x252766>=_0x37fd5d){_0x252766=_0x37fd5d;_0x582502=0xc8;}else{_0x582502=0xce;}_0x73c654[_0x1c5b('0x2f')](_0x582502);return _0x73c654[_0x1c5b('0x36')](_0x1c5b('0x37'),_0x228751+'-'+_0x252766+'/'+_0x37fd5d)[_0x1c5b('0x31')](_0xbc30a4);}return null;};}function patchUpdates(_0x97d5b2){return function(_0xd4f181){try{jsonpatch[_0x1c5b('0x38')](_0xd4f181,_0x97d5b2,!![]);}catch(_0x2be968){return BPromise['reject'](_0x2be968);}return _0xd4f181['save']();};}function saveUpdates(_0xc06d76,_0x2f497d){return function(_0x29f7a2){if(_0x29f7a2){return _0x29f7a2[_0x1c5b('0x39')](_0xc06d76)[_0x1c5b('0x23')](function(_0x510978){return _0x510978;});}return null;};}function removeEntity(_0x1d194f,_0x5bb521){return function(_0x25abb3){if(_0x25abb3){return _0x25abb3[_0x1c5b('0x3a')]()[_0x1c5b('0x23')](function(){var _0x1be54e=_0x25abb3['get']({'plain':!![]});var _0x138f7e=_0x1c5b('0x3b');return db[_0x1c5b('0x3c')][_0x1c5b('0x3a')]({'where':{'type':_0x138f7e,'resourceId':_0x1be54e['id']}})[_0x1c5b('0x23')](function(){return _0x25abb3;});})[_0x1c5b('0x23')](function(){_0x1d194f['status'](0xcc)[_0x1c5b('0x30')]();});}};}function handleEntityNotFound(_0x514672,_0x275a1c){return function(_0x322514){if(!_0x322514){_0x514672['sendStatus'](0x194);}return _0x322514;};}function handleError(_0xa086dd,_0x160fb9){_0x160fb9=_0x160fb9||0x1f4;return function(_0x5afe1e){logger[_0x1c5b('0x29')](_0x5afe1e[_0x1c5b('0x3d')]);if(_0x5afe1e[_0x1c5b('0x3e')]){delete _0x5afe1e['name'];}_0xa086dd['status'](_0x160fb9)['send'](_0x5afe1e);};}exports['index']=function(_0x379720,_0x35dd32){var _0xe1fd69={'include':[{'model':db[_0x1c5b('0x3f')],'as':_0x1c5b('0x40')},{'model':db[_0x1c5b('0x41')],'as':_0x1c5b('0x42')},{'model':db[_0x1c5b('0x43')],'as':_0x1c5b('0x44')}]},_0x2d5bbd={},_0x4f77dc={'count':0x0,'rows':[]};var _0x1574b6=_[_0x1c5b('0x45')](db[_0x1c5b('0x46')]['rawAttributes'],function(_0x1a71ea){return{'name':_0x1a71ea[_0x1c5b('0x47')],'type':_0x1a71ea[_0x1c5b('0x48')]['key']};});_0x2d5bbd[_0x1c5b('0x49')]=_[_0x1c5b('0x45')](_0x1574b6,_0x1c5b('0x3e'));_0x2d5bbd[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x379720['query']);_0x2d5bbd[_0x1c5b('0x4c')]=_['intersection'](_0x2d5bbd['model'],_0x2d5bbd[_0x1c5b('0x4a')]);_0xe1fd69[_0x1c5b('0x4d')]=_[_0x1c5b('0x4e')](_0x2d5bbd[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x379720[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0xe1fd69[_0x1c5b('0x4d')]=_0xe1fd69[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0xe1fd69['attributes']:_0x2d5bbd['model'];if(!_0x379720[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0xe1fd69[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x379720[_0x1c5b('0x4a')]['limit']);_0xe1fd69[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x379720[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}_0xe1fd69[_0x1c5b('0x53')]=qs[_0x1c5b('0x54')](_0x379720[_0x1c5b('0x4a')]['sort']);_0xe1fd69[_0x1c5b('0x55')]=qs[_0x1c5b('0x4c')](_[_0x1c5b('0x56')](_0x379720[_0x1c5b('0x4a')],_0x2d5bbd[_0x1c5b('0x4c')]),_0x1574b6);if(_0x379720[_0x1c5b('0x4a')]['filter']){_0xe1fd69[_0x1c5b('0x55')]=_[_0x1c5b('0x57')](_0xe1fd69[_0x1c5b('0x55')],{'$or':_[_0x1c5b('0x45')](_0x1574b6,function(_0x4cae22){if(_0x4cae22[_0x1c5b('0x48')]!==_0x1c5b('0x58')){var _0x32ee4a={};_0x32ee4a[_0x4cae22[_0x1c5b('0x3e')]]={'$like':'%'+_0x379720[_0x1c5b('0x4a')]['filter']+'%'};return _0x32ee4a;}})});}_0xe1fd69=_[_0x1c5b('0x57')]({},_0xe1fd69,_0x379720[_0x1c5b('0x59')]);var _0x146317={'where':_0xe1fd69[_0x1c5b('0x55')]};return db[_0x1c5b('0x46')][_0x1c5b('0x34')](_0x146317)[_0x1c5b('0x23')](function(_0xd9162){_0x4f77dc[_0x1c5b('0x34')]=_0xd9162;if(_0x379720[_0x1c5b('0x4a')][_0x1c5b('0x5a')]){_0xe1fd69[_0x1c5b('0x5b')]=[{'all':!![]}];}return db[_0x1c5b('0x46')][_0x1c5b('0x5c')](_0xe1fd69);})[_0x1c5b('0x23')](function(_0x260c6b){_0x4f77dc[_0x1c5b('0x5d')]=_0x260c6b;return _0x4f77dc;})[_0x1c5b('0x23')](respondWithFilteredResult(_0x35dd32,_0xe1fd69))[_0x1c5b('0x2d')](handleError(_0x35dd32,null));};exports[_0x1c5b('0x5e')]=function(_0x4df766,_0x219fd6){var _0x4bafee={'raw':![],'where':{'id':_0x4df766['params']['id']},'include':[{'model':db[_0x1c5b('0x3f')],'as':_0x1c5b('0x40')},{'model':db[_0x1c5b('0x41')],'as':_0x1c5b('0x42')},{'model':db[_0x1c5b('0x43')],'as':_0x1c5b('0x44')}]},_0x42d00c={};_0x42d00c[_0x1c5b('0x49')]=_[_0x1c5b('0x4b')](db['MailAccount']['rawAttributes']);_0x42d00c[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x4df766[_0x1c5b('0x4a')]);_0x42d00c['filters']=_['intersection'](_0x42d00c[_0x1c5b('0x49')],_0x42d00c['query']);_0x4bafee[_0x1c5b('0x4d')]=_['intersection'](_0x42d00c[_0x1c5b('0x49')],qs['fields'](_0x4df766[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x4bafee[_0x1c5b('0x4d')]=_0x4bafee[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x4bafee[_0x1c5b('0x4d')]:_0x42d00c[_0x1c5b('0x49')];if(_0x4df766[_0x1c5b('0x4a')]['includeAll']){_0x4bafee[_0x1c5b('0x5b')]=[{'all':!![]}];}_0x4bafee=_[_0x1c5b('0x57')]({},_0x4bafee,_0x4df766['options']);return db[_0x1c5b('0x46')][_0x1c5b('0x5f')](_0x4bafee)[_0x1c5b('0x23')](handleEntityNotFound(_0x219fd6,null))[_0x1c5b('0x23')](respondWithResult(_0x219fd6,null))[_0x1c5b('0x2d')](handleError(_0x219fd6,null));};exports[_0x1c5b('0x39')]=function(_0x3ec946,_0x414885){if(_0x3ec946[_0x1c5b('0x60')]['id']){delete _0x3ec946[_0x1c5b('0x60')]['id'];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x3ec946[_0x1c5b('0x61')]['id']},'include':[{'model':db[_0x1c5b('0x3f')],'as':_0x1c5b('0x40')},{'model':db[_0x1c5b('0x41')],'as':'Smtp'},{'model':db[_0x1c5b('0x43')],'as':_0x1c5b('0x44')}]})['then'](handleEntityNotFound(_0x414885,null))['then'](saveUpdates(_0x3ec946[_0x1c5b('0x60')],null))[_0x1c5b('0x23')](function(_0x448b1f){if(_0x448b1f&&_0x3ec946[_0x1c5b('0x60')]['Imap']){return db[_0x1c5b('0x3f')]['update'](_0x3ec946['body'][_0x1c5b('0x40')],{'where':{'MailAccountId':_0x448b1f['id']}})[_0x1c5b('0x23')](function(){return _0x448b1f;});}return _0x448b1f;})['then'](function(_0x59d03){if(_0x59d03&&_0x3ec946[_0x1c5b('0x60')][_0x1c5b('0x42')]){return db[_0x1c5b('0x41')][_0x1c5b('0x39')](_0x3ec946[_0x1c5b('0x60')][_0x1c5b('0x42')],{'where':{'MailAccountId':_0x59d03['id']}})['then'](function(){return _0x59d03;});}return _0x59d03;})['then'](respondWithResult(_0x414885,null))[_0x1c5b('0x2d')](handleError(_0x414885,null));};exports['describe']=function(_0x5c203d,_0x585e4d){return db['MailAccount']['describe']()[_0x1c5b('0x23')](respondWithResult(_0x585e4d,null))[_0x1c5b('0x2d')](handleError(_0x585e4d,null));};exports[_0x1c5b('0x62')]=function(_0x3c7203,_0x6cfbc2,_0x2f0880){if(_0x3c7203['body']['id']){delete _0x3c7203[_0x1c5b('0x60')]['id'];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x3c7203[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x6cfbc2,null))['then'](function(_0x10d4f0){if(_0x10d4f0){_0x3c7203[_0x1c5b('0x60')]['MailAccountId']=_0x10d4f0['id'];return db[_0x1c5b('0x63')]['create'](_0x3c7203[_0x1c5b('0x60')]);}})[_0x1c5b('0x23')](respondWithResult(_0x6cfbc2,null))[_0x1c5b('0x2d')](handleError(_0x6cfbc2,null));};exports[_0x1c5b('0x64')]=function(_0x13e32f,_0x1162fb,_0x13c131){var _0x566ecb={'raw':![],'where':{}};var _0x356a7e={};var _0x2293c3={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')]['findOne']({'where':{'id':_0x13e32f[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x1162fb,null))[_0x1c5b('0x23')](function(_0x417000){if(_0x417000){_0x356a7e[_0x1c5b('0x49')]=_[_0x1c5b('0x4b')](db[_0x1c5b('0x63')][_0x1c5b('0x65')]);_0x356a7e[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x13e32f[_0x1c5b('0x4a')]);_0x356a7e[_0x1c5b('0x4c')]=_[_0x1c5b('0x4e')](_0x356a7e[_0x1c5b('0x49')],_0x356a7e[_0x1c5b('0x4a')]);_0x566ecb['attributes']=_[_0x1c5b('0x4e')](_0x356a7e[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x566ecb[_0x1c5b('0x4d')]=_0x566ecb[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x566ecb[_0x1c5b('0x4d')]:_0x356a7e[_0x1c5b('0x49')];if(!_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x566ecb[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x33')]);_0x566ecb[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}_0x566ecb[_0x1c5b('0x53')]=qs[_0x1c5b('0x54')](_0x13e32f['query']['sort']);_0x566ecb[_0x1c5b('0x55')]=qs['filters'](_[_0x1c5b('0x56')](_0x13e32f[_0x1c5b('0x4a')],_0x356a7e[_0x1c5b('0x4c')]));_0x566ecb['where'][_0x1c5b('0x66')]=_0x417000['id'];if(_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x67')]){_0x566ecb[_0x1c5b('0x55')]=_[_0x1c5b('0x57')](_0x566ecb[_0x1c5b('0x55')],{'$or':_['map'](_0x566ecb[_0x1c5b('0x4d')],function(_0x48c6aa){var _0x11fa0d={};_0x11fa0d[_0x48c6aa]={'$like':'%'+_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x11fa0d;})});}_0x566ecb=_[_0x1c5b('0x57')]({},_0x566ecb,_0x13e32f[_0x1c5b('0x59')]);return db[_0x1c5b('0x63')][_0x1c5b('0x34')]({'where':_0x566ecb['where']})[_0x1c5b('0x23')](function(_0x4b4052){_0x2293c3[_0x1c5b('0x34')]=_0x4b4052;if(_0x13e32f[_0x1c5b('0x4a')][_0x1c5b('0x5a')]){_0x566ecb[_0x1c5b('0x5b')]=[{'all':!![]}];}return db[_0x1c5b('0x63')][_0x1c5b('0x5c')](_0x566ecb);})[_0x1c5b('0x23')](function(_0x2cfbd1){_0x2293c3[_0x1c5b('0x5d')]=_0x2cfbd1;return _0x2293c3;});}})['then'](respondWithFilteredResult(_0x1162fb,_0x566ecb))['catch'](handleError(_0x1162fb,null));};exports[_0x1c5b('0x68')]=function(_0x514f92,_0x299ac8,_0x22d8eb){return db['MailAccount'][_0x1c5b('0x5f')]({'where':{'id':_0x514f92[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x299ac8,null))['then'](function(_0x761e82){if(_0x761e82){return _0x761e82[_0x1c5b('0x68')](_0x514f92[_0x1c5b('0x4a')][_0x1c5b('0x69')]);}})['then'](respondWithStatusCode(_0x299ac8,null))['catch'](handleError(_0x299ac8,null));};exports['addAnswer']=function(_0x617e5c,_0x10c7b8,_0x5170f3){if(_0x617e5c[_0x1c5b('0x60')]['id']){delete _0x617e5c[_0x1c5b('0x60')]['id'];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x617e5c[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x10c7b8,null))[_0x1c5b('0x23')](function(_0x3b90d8){if(_0x3b90d8){_0x617e5c['body'][_0x1c5b('0x66')]=_0x3b90d8['id'];return db[_0x1c5b('0x6a')][_0x1c5b('0x6b')](_0x617e5c[_0x1c5b('0x60')]);}})[_0x1c5b('0x23')](respondWithResult(_0x10c7b8,null))['catch'](handleError(_0x10c7b8,null));};exports[_0x1c5b('0x6c')]=function(_0x77c70d,_0x5c6c71,_0x5c716f){var _0x3795b4={'raw':![],'where':{}};var _0x2328fd={};var _0x46cb0f={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x77c70d['params']['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x5c6c71,null))[_0x1c5b('0x23')](function(_0x175619){if(_0x175619){_0x2328fd['model']=_[_0x1c5b('0x4b')](db[_0x1c5b('0x6a')]['rawAttributes']);_0x2328fd[_0x1c5b('0x4a')]=_['keys'](_0x77c70d[_0x1c5b('0x4a')]);_0x2328fd[_0x1c5b('0x4c')]=_['intersection'](_0x2328fd[_0x1c5b('0x49')],_0x2328fd[_0x1c5b('0x4a')]);_0x3795b4[_0x1c5b('0x4d')]=_[_0x1c5b('0x4e')](_0x2328fd[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x3795b4[_0x1c5b('0x4d')]=_0x3795b4[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x3795b4[_0x1c5b('0x4d')]:_0x2328fd['model'];if(!_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x3795b4[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x77c70d[_0x1c5b('0x4a')]['limit']);_0x3795b4[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}_0x3795b4['order']=qs[_0x1c5b('0x54')](_0x77c70d['query'][_0x1c5b('0x54')]);_0x3795b4[_0x1c5b('0x55')]=qs[_0x1c5b('0x4c')](_[_0x1c5b('0x56')](_0x77c70d[_0x1c5b('0x4a')],_0x2328fd['filters']));_0x3795b4[_0x1c5b('0x55')]['MailAccountId']=_0x175619['id'];if(_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x67')]){_0x3795b4[_0x1c5b('0x55')]=_['merge'](_0x3795b4[_0x1c5b('0x55')],{'$or':_['map'](_0x3795b4[_0x1c5b('0x4d')],function(_0x439e12){var _0x22fcc7={};_0x22fcc7[_0x439e12]={'$like':'%'+_0x77c70d[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x22fcc7;})});}_0x3795b4=_['merge']({},_0x3795b4,_0x77c70d[_0x1c5b('0x59')]);return db[_0x1c5b('0x6a')][_0x1c5b('0x34')]({'where':_0x3795b4['where']})[_0x1c5b('0x23')](function(_0x111143){_0x46cb0f[_0x1c5b('0x34')]=_0x111143;if(_0x77c70d[_0x1c5b('0x4a')]['includeAll']){_0x3795b4[_0x1c5b('0x5b')]=[{'all':!![]}];}return db[_0x1c5b('0x6a')][_0x1c5b('0x5c')](_0x3795b4);})['then'](function(_0x4478a3){_0x46cb0f[_0x1c5b('0x5d')]=_0x4478a3;return _0x46cb0f;});}})['then'](respondWithFilteredResult(_0x5c6c71,_0x3795b4))[_0x1c5b('0x2d')](handleError(_0x5c6c71,null));};exports[_0x1c5b('0x6e')]=function(_0x310170,_0x1e571b,_0x265392){return db['MailAccount']['find']({'where':{'id':_0x310170[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x1e571b,null))[_0x1c5b('0x23')](function(_0xc47701){if(_0xc47701){return _0xc47701[_0x1c5b('0x6e')](_0x310170[_0x1c5b('0x4a')][_0x1c5b('0x69')]);}})[_0x1c5b('0x23')](respondWithStatusCode(_0x1e571b,null))['catch'](handleError(_0x1e571b,null));};exports['create']=function(_0x3e3a51,_0x1dce65){var _0x497ab8={'name':_0x3e3a51[_0x1c5b('0x60')]['name'],'key':_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x6f')],'email':_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x70')],'ListId':_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x71')],'active':!_[_0x1c5b('0x72')](_0x3e3a51['body'][_0x1c5b('0x73')])?_0x3e3a51[_0x1c5b('0x60')]['active']:!![],'description':_0x3e3a51[_0x1c5b('0x60')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x1c5b('0x72')](_0x3e3a51['body'][_0x1c5b('0x74')])){if(_0x3e3a51['body']['cauthentication']){_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x75')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x75')]=_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x76')];_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x77')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x78')]=_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x79')];}else{_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x7a')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x7a')]=![];}_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x7b')]=_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x40')][_0x1c5b('0x7b')];_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x7c')]=_0x3e3a51[_0x1c5b('0x60')]['Imap'][_0x1c5b('0x7c')];_0x497ab8['Smtp']['host']=_0x3e3a51['body'][_0x1c5b('0x42')][_0x1c5b('0x7b')];_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x7c')]=_0x3e3a51['body']['Smtp'][_0x1c5b('0x7c')];}else{_0x497ab8['Imap'][_0x1c5b('0x7d')]=_0x497ab8['Smtp'][_0x1c5b('0x7d')]=_0x3e3a51[_0x1c5b('0x60')][_0x1c5b('0x74')];_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x75')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x75')]=_0x3e3a51[_0x1c5b('0x60')]['cuser'];_0x497ab8[_0x1c5b('0x40')][_0x1c5b('0x77')]=_0x497ab8[_0x1c5b('0x42')][_0x1c5b('0x78')]=_0x3e3a51['body']['cpassword'];}return db[_0x1c5b('0x46')][_0x1c5b('0x6b')](_0x497ab8,{'include':[{'model':db[_0x1c5b('0x41')],'as':_0x1c5b('0x42')},{'model':db['MailServerIn'],'as':_0x1c5b('0x40')}]})[_0x1c5b('0x23')](function(_0x4e90e5){var _0x21805c=_0x3e3a51[_0x1c5b('0x75')][_0x1c5b('0x7e')]({'plain':!![]});if(!_0x21805c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21805c[_0x1c5b('0x7f')]===_0x1c5b('0x75')){var _0xd3f8e1=_0x4e90e5[_0x1c5b('0x7e')]({'plain':!![]});return db[_0x1c5b('0x80')][_0x1c5b('0x5f')]({'where':{'name':_0x1c5b('0x3b'),'userProfileId':_0x21805c[_0x1c5b('0x81')]},'raw':!![]})['then'](function(_0x536446){if(_0x536446&&_0x536446[_0x1c5b('0x82')]===0x0){return db[_0x1c5b('0x3c')][_0x1c5b('0x6b')]({'name':_0xd3f8e1['name'],'resourceId':_0xd3f8e1['id'],'type':_0x536446[_0x1c5b('0x3e')],'sectionId':_0x536446['id']},{})[_0x1c5b('0x23')](function(){return _0x4e90e5;});}else{return _0x4e90e5;}})[_0x1c5b('0x2d')](function(_0x4ee1a5){logger[_0x1c5b('0x29')](_0x1c5b('0x83'),_0x4ee1a5);throw _0x4ee1a5;});}return _0x4e90e5;})[_0x1c5b('0x23')](respondWithResult(_0x1dce65,0xc9))[_0x1c5b('0x2d')](handleError(_0x1dce65,null));};exports[_0x1c5b('0x84')]=function(_0x41751f,_0x2c0362,_0x2cbfc8){return db[_0x1c5b('0x46')]['findOne']({'where':{'id':_0x41751f[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x2c0362,null))['then'](function(_0x35a8f2){if(_0x35a8f2){return _0x35a8f2['getImap']();}return null;})[_0x1c5b('0x23')](respondWithResult(_0x2c0362,null))['catch'](handleError(_0x2c0362,null));};exports['addImap']=function(_0x2ec390,_0x37d1ed,_0x11a011){if(_0x2ec390['body']['id']){delete _0x2ec390['body']['id'];}return db['MailAccount'][_0x1c5b('0x5f')]({'where':{'id':_0x2ec390[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x37d1ed,null))[_0x1c5b('0x23')](function(_0x88472a){if(_0x88472a){_0x2ec390[_0x1c5b('0x60')][_0x1c5b('0x66')]=_0x88472a['id'];return db[_0x1c5b('0x3f')][_0x1c5b('0x6b')](_0x2ec390[_0x1c5b('0x60')]);}})[_0x1c5b('0x23')](respondWithResult(_0x37d1ed,null))[_0x1c5b('0x2d')](handleError(_0x37d1ed,null));};exports[_0x1c5b('0x85')]=function(_0x44e8fa,_0x2e2c11,_0x5198be){return db['MailAccount'][_0x1c5b('0x6d')]({'where':{'id':_0x44e8fa[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x2e2c11,null))[_0x1c5b('0x23')](function(_0x1e440d){if(_0x1e440d){return _0x1e440d[_0x1c5b('0x86')](null);}return null;})[_0x1c5b('0x23')](respondWithStatusCode(_0x2e2c11,null))[_0x1c5b('0x2d')](handleError(_0x2e2c11,null));};exports[_0x1c5b('0x87')]=function(_0x1e0967,_0x1b9d7a,_0x227122){return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x1e0967['params']['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x1b9d7a,null))[_0x1c5b('0x23')](function(_0x2c0b2b){if(_0x2c0b2b){return _0x2c0b2b[_0x1c5b('0x87')]();}return null;})[_0x1c5b('0x23')](respondWithResult(_0x1b9d7a,null))[_0x1c5b('0x2d')](handleError(_0x1b9d7a,null));};exports[_0x1c5b('0x88')]=function(_0x4fcdf5,_0x527b67,_0x1e4db7){if(_0x4fcdf5[_0x1c5b('0x60')]['id']){delete _0x4fcdf5['body']['id'];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x4fcdf5['params']['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x527b67,null))[_0x1c5b('0x23')](function(_0x33d0b3){if(_0x33d0b3){_0x4fcdf5['body'][_0x1c5b('0x66')]=_0x33d0b3['id'];return db['MailServerOut'][_0x1c5b('0x6b')](_0x4fcdf5[_0x1c5b('0x60')]);}})['then'](respondWithResult(_0x527b67,null))[_0x1c5b('0x2d')](handleError(_0x527b67,null));};exports[_0x1c5b('0x89')]=function(_0x496de1,_0xc87808,_0x56ff36){return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x496de1[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0xc87808,null))[_0x1c5b('0x23')](function(_0x5aa90a){if(_0x5aa90a){return _0x5aa90a[_0x1c5b('0x8a')](null);}return null;})['then'](respondWithStatusCode(_0xc87808,null))[_0x1c5b('0x2d')](handleError(_0xc87808,null));};exports[_0x1c5b('0x8b')]=function(_0x35d58a,_0x2eb494,_0x21c2c3){return db['MailInteraction'][_0x1c5b('0x5f')]({'where':{'id':_0x35d58a['params']['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x2eb494,null))[_0x1c5b('0x23')](function(_0x18e850){if(_0x18e850){return _0x18e850[_0x1c5b('0x8b')](_0x35d58a[_0x1c5b('0x60')][_0x1c5b('0x69')],_['omit'](_0x35d58a[_0x1c5b('0x60')],[_0x1c5b('0x69'),'id'])||{});}})[_0x1c5b('0x23')](respondWithResult(_0x2eb494,null))[_0x1c5b('0x2d')](handleError(_0x2eb494,null));};exports[_0x1c5b('0x8c')]=function(_0x984c8d,_0x5bb2f8,_0x1a9f30){var _0x5a8966={'raw':![],'where':{}};var _0x2ec072={};var _0x32dd29={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x984c8d[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x5bb2f8,null))[_0x1c5b('0x23')](function(_0x4ec069){if(_0x4ec069){_0x2ec072[_0x1c5b('0x49')]=_[_0x1c5b('0x4b')](db['MailInteraction']['rawAttributes']);_0x2ec072[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x984c8d[_0x1c5b('0x4a')]);_0x2ec072[_0x1c5b('0x4c')]=_['intersection'](_0x2ec072[_0x1c5b('0x49')],_0x2ec072[_0x1c5b('0x4a')]);_0x5a8966[_0x1c5b('0x4d')]=_[_0x1c5b('0x4e')](_0x2ec072[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x984c8d[_0x1c5b('0x4a')]['fields']));_0x5a8966['attributes']=_0x5a8966[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x5a8966[_0x1c5b('0x4d')]:_0x2ec072[_0x1c5b('0x49')];if(!_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x5a8966[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x984c8d[_0x1c5b('0x4a')]['limit']);_0x5a8966[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}_0x5a8966[_0x1c5b('0x53')]=qs[_0x1c5b('0x54')](_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x54')]);_0x5a8966[_0x1c5b('0x55')]=qs['filters'](_['pick'](_0x984c8d['query'],_0x2ec072['filters']));_0x5a8966['where'][_0x1c5b('0x66')]=_0x4ec069['id'];if(_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x67')]){_0x5a8966[_0x1c5b('0x55')]=_[_0x1c5b('0x57')](_0x5a8966[_0x1c5b('0x55')],{'$or':_[_0x1c5b('0x45')](_0x5a8966[_0x1c5b('0x4d')],function(_0xb1f9c3){var _0x33531a={};_0x33531a[_0xb1f9c3]={'$like':'%'+_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x33531a;})});}_0x5a8966=_[_0x1c5b('0x57')]({},_0x5a8966,_0x984c8d[_0x1c5b('0x59')]);return db['MailInteraction'][_0x1c5b('0x34')]({'where':_0x5a8966[_0x1c5b('0x55')]})[_0x1c5b('0x23')](function(_0x4d50c0){_0x32dd29[_0x1c5b('0x34')]=_0x4d50c0;if(_0x984c8d['query']['includeAll']){_0x5a8966['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1c5b('0x8d')],'as':_0x1c5b('0x8e'),'attributes':[_0x1c5b('0x3e'),_0x1c5b('0x8f'),_0x1c5b('0x90')],'required':![]},{'model':db['Tag'],'as':_0x1c5b('0x91'),'attributes':['id',_0x1c5b('0x3e'),_0x1c5b('0x92')],'where':_0x984c8d[_0x1c5b('0x4a')]['tag']?{'id':_0x984c8d['query'][_0x1c5b('0x93')]}:undefined,'required':_0x984c8d[_0x1c5b('0x4a')][_0x1c5b('0x93')]?!![]:![]}];}return db[_0x1c5b('0x94')][_0x1c5b('0x5c')](_0x5a8966);})[_0x1c5b('0x23')](function(_0x40635e){_0x32dd29['rows']=_0x40635e;return _0x32dd29;});}})[_0x1c5b('0x23')](respondWithFilteredResult(_0x5bb2f8,_0x5a8966))[_0x1c5b('0x2d')](handleError(_0x5bb2f8,null));};exports[_0x1c5b('0x95')]=function(_0x12eae0,_0x3c0703,_0xee74e0){return db[_0x1c5b('0x46')]['findOne']({'where':{'id':_0x12eae0[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x3c0703,null))[_0x1c5b('0x23')](function(_0x5e8e70){if(_0x5e8e70){return db[_0x1c5b('0x96')][_0x1c5b('0x97')](function(_0x2ab39e){return db[_0x1c5b('0x98')][_0x1c5b('0x3a')]({'where':{'MailAccountId':_0x12eae0[_0x1c5b('0x61')]['id']},'transaction':_0x2ab39e})['then'](function(_0x4a8fbc){var _0x89bd16=_[_0x1c5b('0x45')](_0x12eae0[_0x1c5b('0x60')],function(_0x320cfb){_0x320cfb['MailAccountId']=_0x12eae0[_0x1c5b('0x61')]['id'];return _0x320cfb;});return db[_0x1c5b('0x98')]['bulkCreate'](_0x89bd16,{'transaction':_0x2ab39e});});})[_0x1c5b('0x23')](function(){return db[_0x1c5b('0x98')][_0x1c5b('0x99')]({'where':{'MailAccountId':_0x12eae0[_0x1c5b('0x61')]['id']},'order':'priority'});});}})[_0x1c5b('0x23')](respondWithResult(_0x3c0703,null))['catch'](handleError(_0x3c0703,null));};exports[_0x1c5b('0x9a')]=function(_0x4a93b8,_0x2889c0,_0x7c6637){var _0x57c6ac={};var _0x578882={};var _0x40cbce;var _0x133c30;return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x4a93b8[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x2889c0,null))['then'](function(_0x238acb){if(_0x238acb){_0x40cbce=_0x238acb;_0x578882[_0x1c5b('0x49')]=_[_0x1c5b('0x4b')](db[_0x1c5b('0x98')][_0x1c5b('0x65')]);_0x578882['query']=_[_0x1c5b('0x4b')](_0x4a93b8[_0x1c5b('0x4a')]);_0x578882[_0x1c5b('0x4c')]=_[_0x1c5b('0x4e')](_0x578882[_0x1c5b('0x49')],_0x578882[_0x1c5b('0x4a')]);_0x57c6ac[_0x1c5b('0x4d')]=_['intersection'](_0x578882[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x4a93b8[_0x1c5b('0x4a')]['fields']));_0x57c6ac[_0x1c5b('0x4d')]=_0x57c6ac[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x57c6ac[_0x1c5b('0x4d')]:_0x578882[_0x1c5b('0x49')];_0x57c6ac[_0x1c5b('0x53')]=qs['sort'](_0x4a93b8[_0x1c5b('0x4a')][_0x1c5b('0x54')]);_0x57c6ac[_0x1c5b('0x55')]=qs[_0x1c5b('0x4c')](_[_0x1c5b('0x56')](_0x4a93b8[_0x1c5b('0x4a')],_0x578882[_0x1c5b('0x4c')]));if(_0x4a93b8['query'][_0x1c5b('0x67')]){_0x57c6ac[_0x1c5b('0x55')]=_[_0x1c5b('0x57')](_0x57c6ac[_0x1c5b('0x55')],{'$or':_[_0x1c5b('0x45')](_0x57c6ac['attributes'],function(_0x4d634b){var _0x238944={};_0x238944[_0x4d634b]={'$like':'%'+_0x4a93b8[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x238944;})});}_0x57c6ac=_[_0x1c5b('0x57')]({},_0x57c6ac,_0x4a93b8[_0x1c5b('0x59')]);return _0x40cbce['getApplications'](_0x57c6ac);}})['then'](function(_0x178c5b){if(_0x178c5b){_0x133c30=_0x178c5b['length'];if(!_0x4a93b8[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x57c6ac[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x4a93b8[_0x1c5b('0x4a')][_0x1c5b('0x33')]);_0x57c6ac['offset']=qs['offset'](_0x4a93b8['query']['offset']);}return _0x40cbce[_0x1c5b('0x9a')](_0x57c6ac);}})[_0x1c5b('0x23')](function(_0x518b83){if(_0x518b83){return _0x518b83?{'count':_0x133c30,'rows':_0x518b83}:null;}})[_0x1c5b('0x23')](respondWithResult(_0x2889c0,null))['catch'](handleError(_0x2889c0,null));};exports[_0x1c5b('0x9b')]=function(_0x4449de,_0x2ae5ac,_0x408a9a){var _0x1eb3cc={'raw':!![],'where':{}};var _0x1206c0={};var _0x51ef03={'count':0x0,'rows':[]};return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x4449de[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x2ae5ac,null))[_0x1c5b('0x23')](function(_0x3f4f7e){if(_0x3f4f7e){_0x1206c0['model']=_['keys'](db[_0x1c5b('0x9c')][_0x1c5b('0x65')]);_0x1206c0['query']=_['keys'](_0x4449de[_0x1c5b('0x4a')]);_0x1206c0[_0x1c5b('0x4c')]=_[_0x1c5b('0x4e')](_0x1206c0['model'],_0x1206c0[_0x1c5b('0x4a')]);_0x1eb3cc[_0x1c5b('0x4d')]=_['intersection'](_0x1206c0[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x1eb3cc['attributes']=_0x1eb3cc[_0x1c5b('0x4d')]['length']?_0x1eb3cc[_0x1c5b('0x4d')]:_0x1206c0['model'];if(!_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x1eb3cc[_0x1c5b('0x33')]=qs[_0x1c5b('0x33')](_0x4449de[_0x1c5b('0x4a')]['limit']);_0x1eb3cc['offset']=qs[_0x1c5b('0x35')](_0x4449de[_0x1c5b('0x4a')]['offset']);}_0x1eb3cc['order']=qs[_0x1c5b('0x54')](_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x54')]);_0x1eb3cc[_0x1c5b('0x55')]=qs[_0x1c5b('0x4c')](_['pick'](_0x4449de[_0x1c5b('0x4a')],_0x1206c0[_0x1c5b('0x4c')]));_0x1eb3cc[_0x1c5b('0x55')][_0x1c5b('0x66')]=_0x3f4f7e['id'];if(_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x67')]){_0x1eb3cc['where']=_[_0x1c5b('0x57')](_0x1eb3cc[_0x1c5b('0x55')],{'$or':_[_0x1c5b('0x45')](_0x1eb3cc[_0x1c5b('0x4d')],function(_0x190672){var _0x2def49={};_0x2def49[_0x190672]={'$like':'%'+_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x2def49;})});}if(_0x4449de['query'][_0x1c5b('0x9d')]){var _0xf2ec3f=_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x9d')]['split'](',');var _0x387bb5={};_0x387bb5[_0xf2ec3f[0x0]]={'$gte':moment(_0xf2ec3f[0x1])[_0x1c5b('0x9e')](_0x1c5b('0x9f'))};_0x1eb3cc['where']=_['merge'](_0x1eb3cc['where'],_0x387bb5);}_0x1eb3cc=_['merge']({},_0x1eb3cc,_0x4449de[_0x1c5b('0x59')]);return db['MailMessage'][_0x1c5b('0x34')]({'where':_0x1eb3cc['where']})[_0x1c5b('0x23')](function(_0x4d9e86){_0x51ef03[_0x1c5b('0x34')]=_0x4d9e86;if(_0x4449de[_0x1c5b('0x4a')][_0x1c5b('0x5a')]){_0x1eb3cc['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1eb3cc);})['then'](function(_0x1766ad){if(_0x4449de['query']['inlineCss']===_0x1c5b('0xa0')){for(var _0x590ac6=0x0;_0x590ac6<_0x1766ad['length'];_0x590ac6++){_0x1766ad[_0x590ac6][_0x1c5b('0x60')]=juice(_0x1766ad[_0x590ac6][_0x1c5b('0x60')]);}}_0x51ef03['rows']=_0x1766ad;return _0x51ef03;});}})[_0x1c5b('0x23')](respondWithFilteredResult(_0x2ae5ac,_0x1eb3cc))[_0x1c5b('0x2d')](handleError(_0x2ae5ac,null));};exports[_0x1c5b('0xa1')]=function(_0x167de2,_0x4351fb,_0x189e90){var _0x32ecda,_0x3afb24={},_0x4839db;if(_0x167de2[_0x1c5b('0x60')]['to']){_0x4839db=_0x167de2['body']['to'][_0x1c5b('0xa2')](',')[0x0];}return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x167de2[_0x1c5b('0x61')]['id']},'include':[{'model':db[_0x1c5b('0xa3')],'as':_0x1c5b('0xa4'),'include':[{'model':db['CmContact'],'as':_0x1c5b('0xa5'),'where':{'email':_0x4839db},'limit':0x1,'order':[['updatedAt',_0x1c5b('0xa6')]]}]},{'model':db['MailServerOut'],'as':_0x1c5b('0x42'),'raw':!![]}]})[_0x1c5b('0x23')](handleEntityNotFound(_0x4351fb,null))[_0x1c5b('0x23')](function(_0x55fda7){if(_0x55fda7){_0x32ecda=_0x55fda7;if(_0x55fda7[_0x1c5b('0x42')]){if(_[_0x1c5b('0x72')](_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa7')])){_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa7')]=util['format'](_0x1c5b('0xa8'),_0x55fda7[_0x1c5b('0x3e')],_0x55fda7[_0x1c5b('0x70')]||_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x75')]);}if(_0x167de2['body'][_0x1c5b('0xa9')]&&_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x1c5b('0x50')]){for(var _0x5c93db=0x0;_0x5c93db<_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x1c5b('0x50')];_0x5c93db+=0x1){_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x5c93db]={'filename':_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x5c93db][_0x1c5b('0x3e')],'path':path[_0x1c5b('0xaa')](config[_0x1c5b('0xab')],'server/files/attachments',_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa9')][_0x5c93db][_0x1c5b('0xac')])};}}var _0x1feee9={'tls':{'rejectUnauthorized':![]}};if(_[_0x1c5b('0x72')](_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x7d')])){if(_0x55fda7['Smtp'][_0x1c5b('0x7a')]){_0x1feee9['auth']={'user':_0x55fda7[_0x1c5b('0x42')]['user'],'pass':_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x78')]};}_0x1feee9[_0x1c5b('0x7b')]=_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x7b')];_0x1feee9[_0x1c5b('0x7c')]=_0x55fda7['Smtp'][_0x1c5b('0x7c')];_0x1feee9[_0x1c5b('0xad')]=_0x55fda7['Smtp'][_0x1c5b('0xad')];}else{_0x1feee9[_0x1c5b('0x7d')]=_0x55fda7['Smtp'][_0x1c5b('0x7d')];_0x1feee9[_0x1c5b('0xae')]={'user':_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x75')],'pass':_0x55fda7[_0x1c5b('0x42')][_0x1c5b('0x78')]};}return respondWithRpcPromise(_0x1c5b('0xaf'),_0x1c5b('0xb0'),{'account':_0x1feee9,'message':_0x167de2[_0x1c5b('0x60')]});}else{throw new Error(_0x1c5b('0xb1'));}}})[_0x1c5b('0x23')](function(_0x183464){if(_0x183464){_0x3afb24=_0x183464;if(_0x32ecda[_0x1c5b('0xa4')]){if(_0x32ecda['List']['Contacts'][_0x1c5b('0x50')]){return _0x32ecda['List'][_0x1c5b('0xa5')][0x0];}else{return db[_0x1c5b('0xb2')]['create'](_[_0x1c5b('0x1c')](_0x167de2[_0x1c5b('0x60')],{'firstName':_0x167de2[_0x1c5b('0x60')]['to'],'email':_0x167de2[_0x1c5b('0x60')]['to'],'phone':_0x167de2[_0x1c5b('0x60')]['to'],'ListId':_0x32ecda[_0x1c5b('0x71')]}));}}else{throw new Error(_0x1c5b('0xb1'));}}})[_0x1c5b('0x23')](function(_0xc1c7ce){if(_0xc1c7ce){var _0x36f233={'UserId':_0x167de2['user']['id'],'ContactId':_0xc1c7ce['id'],'MailAccountId':_0x32ecda['id'],'inReplyTo':_0x3afb24[_0x1c5b('0xb3')],'to':_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xa7')],'cc':_0x167de2['body']['cc'],'subject':_0x167de2['body'][_0x1c5b('0xb4')],'attach':_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xb5')],'firstMsgDirection':_0x1c5b('0xb6'),'lastMsgAt':moment()[_0x1c5b('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x1c5b('0xb6'),'Messages':[_[_0x1c5b('0x57')](_0x167de2[_0x1c5b('0x60')],{'messageId':_0x3afb24[_0x1c5b('0xb3')],'sentAt':moment()[_0x1c5b('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x32ecda['id'],'UserId':_0x167de2[_0x1c5b('0x75')]['id'],'ContactId':_0xc1c7ce['id']})]};if(_0x167de2[_0x1c5b('0x60')][_0x1c5b('0xb7')]){_0x36f233=_[_0x1c5b('0x57')](_0x36f233,_0x167de2[_0x1c5b('0x60')]['Interaction']);}return db[_0x1c5b('0x94')][_0x1c5b('0x6b')](_0x36f233,{'include':[{'model':db[_0x1c5b('0x9c')],'as':_0x1c5b('0xb8')}]});}})[_0x1c5b('0x23')](respondWithResult(_0x4351fb,null))['catch'](handleError(_0x4351fb,null));};exports[_0x1c5b('0xb9')]=function(_0xf76da2,_0x272109,_0x709b8c){return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0xf76da2[_0x1c5b('0x61')]['id']},'include':[{'model':db[_0x1c5b('0x41')],'as':_0x1c5b('0x42'),'raw':!![]}]})[_0x1c5b('0x23')](handleEntityNotFound(_0x272109,null))[_0x1c5b('0x23')](function(_0x51bc64){if(_0x51bc64&&_0x51bc64[_0x1c5b('0x42')]){var _0x27cb22={'id':_0x51bc64['id'],'tls':{'rejectUnauthorized':![]}};if(_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7d')]){_0x27cb22[_0x1c5b('0x7d')]=_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7d')];}else{_0x27cb22[_0x1c5b('0x7b')]=_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7b')];_0x27cb22['port']=_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7c')];_0x27cb22[_0x1c5b('0xad')]=_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0xad')];}if(_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x7a')]){_0x27cb22[_0x1c5b('0xae')]={'user':_0x51bc64[_0x1c5b('0x42')][_0x1c5b('0x75')],'pass':_0x51bc64[_0x1c5b('0x42')]['pass']};}return respondWithRpcPromise(_0x1c5b('0xba'),_0x1c5b('0xb9'),{'account':_0x27cb22});}})['then'](respondWithResult(_0x272109,null))[_0x1c5b('0x2d')](handleError(_0x272109,null));};exports['destroy']=function(_0x140edf,_0x30ddbf){return db[_0x1c5b('0x46')]['find']({'where':{'id':_0x140edf[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x30ddbf,null))[_0x1c5b('0x23')](function(_0x16fd3e){if(_0x16fd3e&&_0x16fd3e['service']){throw new db[(_0x1c5b('0xbb'))][(_0x1c5b('0xbc'))](_0x1c5b('0xbd'));}return _0x16fd3e;})[_0x1c5b('0x23')](removeEntity(_0x30ddbf,null))[_0x1c5b('0x2d')](handleError(_0x30ddbf,null));};exports[_0x1c5b('0xbe')]=function(_0x2c3eff,_0x225c40,_0xd39be){return db[_0x1c5b('0x46')][_0x1c5b('0x5f')]({'where':{'id':_0x2c3eff[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0x225c40,null))['then'](function(_0x1254ab){if(_0x1254ab){return _0x1254ab[_0x1c5b('0xbe')](_0x2c3eff[_0x1c5b('0x60')][_0x1c5b('0x69')],_['omit'](_0x2c3eff[_0x1c5b('0x60')],[_0x1c5b('0x69'),'id'])||{})[_0x1c5b('0xbf')](function(_0x1ebc6a){for(var _0x4ac3a3=0x0;_0x4ac3a3<_0x2c3eff[_0x1c5b('0x60')][_0x1c5b('0x69')][_0x1c5b('0x50')];_0x4ac3a3+=0x1){socket[_0x1c5b('0xc0')](_0x1c5b('0xc1'),{'UserId':Number(_0x2c3eff[_0x1c5b('0x60')][_0x1c5b('0x69')][_0x4ac3a3]),'MailAccountId':Number(_0x2c3eff[_0x1c5b('0x61')]['id'])});}return _0x1ebc6a;});}})['then'](respondWithResult(_0x225c40,null))[_0x1c5b('0x2d')](handleError(_0x225c40,null));};exports[_0x1c5b('0xc2')]=function(_0xa5c2c0,_0x6383ed,_0x40b8a5){return db['MailAccount'][_0x1c5b('0x5f')]({'where':{'id':_0xa5c2c0[_0x1c5b('0x61')]['id']}})['then'](handleEntityNotFound(_0x6383ed,null))[_0x1c5b('0x23')](function(_0x4735a2){if(_0x4735a2){return _0x4735a2[_0x1c5b('0xc2')](_0xa5c2c0[_0x1c5b('0x4a')][_0x1c5b('0x69')])['then'](function(){if(_[_0x1c5b('0xc3')](_0xa5c2c0[_0x1c5b('0x4a')]['ids'])){for(var _0x3dfa20=0x0;_0x3dfa20<_0xa5c2c0[_0x1c5b('0x4a')][_0x1c5b('0x69')][_0x1c5b('0x50')];_0x3dfa20+=0x1){socket[_0x1c5b('0xc0')](_0x1c5b('0xc4'),{'UserId':Number(_0xa5c2c0[_0x1c5b('0x4a')][_0x1c5b('0x69')][_0x3dfa20]),'MailAccountId':Number(_0xa5c2c0[_0x1c5b('0x61')]['id'])});}}else{socket[_0x1c5b('0xc0')](_0x1c5b('0xc4'),{'UserId':Number(_0xa5c2c0[_0x1c5b('0x4a')][_0x1c5b('0x69')]),'MailAccountId':Number(_0xa5c2c0[_0x1c5b('0x61')]['id'])});}});}})[_0x1c5b('0x23')](respondWithStatusCode(_0x6383ed,null))[_0x1c5b('0x2d')](handleError(_0x6383ed,null));};exports[_0x1c5b('0xc5')]=function(_0x3d960e,_0xffe2,_0x41c4c4){var _0x44b9c6={};var _0x3678d8={};var _0x588051;var _0x5df9b1;return db[_0x1c5b('0x46')][_0x1c5b('0x6d')]({'where':{'id':_0x3d960e[_0x1c5b('0x61')]['id']}})[_0x1c5b('0x23')](handleEntityNotFound(_0xffe2,null))[_0x1c5b('0x23')](function(_0x523d7d){if(_0x523d7d){_0x588051=_0x523d7d;_0x3678d8['model']=_[_0x1c5b('0x4b')](db[_0x1c5b('0x8d')]['rawAttributes']);_0x3678d8[_0x1c5b('0x4a')]=_[_0x1c5b('0x4b')](_0x3d960e[_0x1c5b('0x4a')]);_0x3678d8[_0x1c5b('0x4c')]=_[_0x1c5b('0x4e')](_0x3678d8[_0x1c5b('0x49')],_0x3678d8[_0x1c5b('0x4a')]);_0x44b9c6[_0x1c5b('0x4d')]=_[_0x1c5b('0x4e')](_0x3678d8[_0x1c5b('0x49')],qs[_0x1c5b('0x4f')](_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x4f')]));_0x44b9c6[_0x1c5b('0x4d')]=_0x44b9c6[_0x1c5b('0x4d')][_0x1c5b('0x50')]?_0x44b9c6[_0x1c5b('0x4d')]:_0x3678d8[_0x1c5b('0x49')];_0x44b9c6[_0x1c5b('0x53')]=qs[_0x1c5b('0x54')](_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x54')]);_0x44b9c6['where']=qs[_0x1c5b('0x4c')](_[_0x1c5b('0x56')](_0x3d960e[_0x1c5b('0x4a')],_0x3678d8[_0x1c5b('0x4c')]));if(_0x3d960e['query'][_0x1c5b('0x67')]){_0x44b9c6[_0x1c5b('0x55')]=_['merge'](_0x44b9c6['where'],{'$or':_[_0x1c5b('0x45')](_0x44b9c6[_0x1c5b('0x4d')],function(_0x5aa63b){var _0x4a7178={};_0x4a7178[_0x5aa63b]={'$like':'%'+_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x67')]+'%'};return _0x4a7178;})});}_0x44b9c6=_[_0x1c5b('0x57')]({},_0x44b9c6,_0x3d960e['options']);return _0x588051[_0x1c5b('0xc5')](_0x44b9c6);}})[_0x1c5b('0x23')](function(_0x2077d1){if(_0x2077d1){_0x5df9b1=_0x2077d1[_0x1c5b('0x50')];if(!_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x51')](_0x1c5b('0x52'))){_0x44b9c6['limit']=qs['limit'](_0x3d960e['query'][_0x1c5b('0x33')]);_0x44b9c6[_0x1c5b('0x35')]=qs[_0x1c5b('0x35')](_0x3d960e[_0x1c5b('0x4a')][_0x1c5b('0x35')]);}return _0x588051[_0x1c5b('0xc5')](_0x44b9c6);}})[_0x1c5b('0x23')](function(_0x2f7ce6){if(_0x2f7ce6){return _0x2f7ce6?{'count':_0x5df9b1,'rows':_0x2f7ce6}:null;}})[_0x1c5b('0x23')](respondWithResult(_0xffe2,null))[_0x1c5b('0x2d')](handleError(_0xffe2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 7ecaab1..7a60a0d 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 _0xdf8d=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xdf8d,0x1e0));var _0xddf8=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xdf8d[_0x381589];return _0x2a075d;};'use strict';var EventEmitter=require(_0xddf8('0x0'));var MailAccount=require(_0xddf8('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xddf8('0x2')](0x0);var events={'afterCreate':_0xddf8('0x3'),'afterUpdate':'update','afterDestroy':_0xddf8('0x4')};function emitEvent(_0x259813){return function(_0x394389,_0x418f84,_0x4fecf6){MailAccountEvents[_0xddf8('0x5')](_0x259813+':'+_0x394389['id'],_0x394389);MailAccountEvents[_0xddf8('0x5')](_0x259813,_0x394389);_0x4fecf6(null);};}for(var e in events){if(events[_0xddf8('0x6')](e)){var event=events[e];MailAccount[_0xddf8('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x4f75=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x5be1fb,_0x3b19c3){var _0x29c471=function(_0x3c81b){while(--_0x3c81b){_0x5be1fb['push'](_0x5be1fb['shift']());}};_0x29c471(++_0x3b19c3);}(_0x4f75,0xbb));var _0x54f7=function(_0x2a80cf,_0x3975a0){_0x2a80cf=_0x2a80cf-0x0;var _0x42f7f9=_0x4f75[_0x2a80cf];return _0x42f7f9;};'use strict';var EventEmitter=require(_0x54f7('0x0'));var MailAccount=require(_0x54f7('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x54f7('0x2')](0x0);var events={'afterCreate':_0x54f7('0x3'),'afterUpdate':'update','afterDestroy':_0x54f7('0x4')};function emitEvent(_0x383133){return function(_0x141cd0,_0x328d55,_0x11c0c9){MailAccountEvents[_0x54f7('0x5')](_0x383133+':'+_0x141cd0['id'],_0x141cd0);MailAccountEvents['emit'](_0x383133,_0x141cd0);_0x11c0c9(null);};}for(var e in events){if(events[_0x54f7('0x6')](e)){var event=events[e];MailAccount[_0x54f7('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index d11ca37..10d4bba 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 _0x3916=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','util','../../config/logger'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x3916,0x116));var _0x6391=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x3916[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require(_0x6391('0x0'));var logger=require(_0x6391('0x1'))(_0x6391('0x2'));var moment=require(_0x6391('0x3'));var BPromise=require(_0x6391('0x4'));var rp=require(_0x6391('0x5'));var fs=require('fs');var path=require(_0x6391('0x6'));var rimraf=require(_0x6391('0x7'));var config=require(_0x6391('0x8'));var attributes=require(_0x6391('0x9'));module[_0x6391('0xa')]=function(_0x2086fa,_0x2c0c43){return _0x2086fa[_0x6391('0xb')](_0x6391('0xc'),attributes,{'tableName':_0x6391('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x354d=['MailAccount','lodash','api','moment','bluebird','rimraf','../../config/environment','./mailAccount.attributes','exports'];(function(_0x3f9d37,_0x1c1590){var _0x450b65=function(_0x49f20d){while(--_0x49f20d){_0x3f9d37['push'](_0x3f9d37['shift']());}};_0x450b65(++_0x1c1590);}(_0x354d,0x14e));var _0xd354=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x354d[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd354('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd354('0x1'));var moment=require(_0xd354('0x2'));var BPromise=require(_0xd354('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd354('0x4'));var config=require(_0xd354('0x5'));var attributes=require(_0xd354('0x6'));module[_0xd354('0x7')]=function(_0x513423,_0x40b992){return _0x513423['define'](_0xd354('0x8'),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 a3c9d0b..a06fd99 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 _0xea95=['agent','name','startRouting','Start','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','stringify','find','ShowMailAccount','body','mail','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','MailApplication','MailServerOut','Smtp','then','get','omit','Applications','applications','list','orderBy','priority','asc','autoclose','push','close','length','create','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originCc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','unshift'];(function(_0x33fd2b,_0x20b4d9){var _0x477c38=function(_0x610438){while(--_0x610438){_0x33fd2b['push'](_0x33fd2b['shift']());}};_0x477c38(++_0x20b4d9);}(_0xea95,0x6d));var _0x5ea9=function(_0xab8d49,_0x46ed0a){_0xab8d49=_0xab8d49-0x0;var _0x2fbaa8=_0xea95[_0xab8d49];return _0x2fbaa8;};'use strict';var _=require('lodash');var util=require(_0x5ea9('0x0'));var moment=require('moment');var BPromise=require(_0x5ea9('0x1'));var rs=require(_0x5ea9('0x2'));var fs=require('fs');var Redis=require(_0x5ea9('0x3'));var db=require(_0x5ea9('0x4'))['db'];var utils=require(_0x5ea9('0x5'));var logger=require(_0x5ea9('0x6'))(_0x5ea9('0x7'));var config=require(_0x5ea9('0x8'));var jayson=require(_0x5ea9('0x9'));var client=jayson['client'][_0x5ea9('0xa')]({'port':0x232c});config['redis']=_[_0x5ea9('0xb')](config[_0x5ea9('0xc')],{'host':_0x5ea9('0xd'),'port':0x18eb});var socket=require(_0x5ea9('0xe'))(new Redis(config[_0x5ea9('0xc')]));require('./mailAccount.socket')[_0x5ea9('0xf')](socket);function respondWithRpcPromise(_0x743739,_0x1a2bfb,_0x4a5ddb){return new BPromise(function(_0x1c9097,_0xa8d03c){return client[_0x5ea9('0x10')](_0x743739,_0x4a5ddb)['then'](function(_0x2e8e20){logger[_0x5ea9('0x11')](_0x5ea9('0x12'),_0x1a2bfb,_0x5ea9('0x13'));logger[_0x5ea9('0x14')](_0x5ea9('0x15'),_0x1a2bfb,_0x5ea9('0x13'),JSON['stringify'](_0x2e8e20));if(_0x2e8e20[_0x5ea9('0x16')]){if(_0x2e8e20[_0x5ea9('0x16')][_0x5ea9('0x17')]===0x1f4){logger['error'](_0x5ea9('0x12'),_0x1a2bfb,_0x2e8e20[_0x5ea9('0x16')][_0x5ea9('0x18')]);return _0xa8d03c(_0x2e8e20[_0x5ea9('0x16')]['message']);}logger[_0x5ea9('0x16')](_0x5ea9('0x12'),_0x1a2bfb,_0x2e8e20[_0x5ea9('0x16')]['message']);return _0x1c9097(_0x2e8e20['error']['message']);}else{logger['info'](_0x5ea9('0x12'),_0x1a2bfb,_0x5ea9('0x13'));_0x1c9097(_0x2e8e20[_0x5ea9('0x19')][_0x5ea9('0x18')]);}})[_0x5ea9('0x1a')](function(_0x1571a4){logger[_0x5ea9('0x16')](_0x5ea9('0x12'),_0x1a2bfb,_0x1571a4);_0xa8d03c(_0x1571a4);});});}exports[_0x5ea9('0x1b')]=function(_0x175125){var _0x278ca8=this;return new Promise(function(_0x5ba937,_0x1eecb8){return db[_0x5ea9('0x1c')][_0x5ea9('0x1d')]({'raw':_0x175125['options']?_0x175125[_0x5ea9('0x1e')][_0x5ea9('0x1f')]===undefined?!![]:![]:!![],'where':_0x175125[_0x5ea9('0x1e')]?_0x175125[_0x5ea9('0x1e')][_0x5ea9('0x20')]||null:null,'attributes':_0x175125[_0x5ea9('0x1e')]?_0x175125[_0x5ea9('0x1e')][_0x5ea9('0x21')]||null:null,'limit':_0x175125[_0x5ea9('0x1e')]?_0x175125[_0x5ea9('0x1e')]['limit']||null:null,'include':_0x175125[_0x5ea9('0x1e')]?_0x175125[_0x5ea9('0x1e')][_0x5ea9('0x22')]?_[_0x5ea9('0x23')](_0x175125[_0x5ea9('0x1e')][_0x5ea9('0x22')],function(_0x5f262e){return{'model':db[_0x5f262e['model']],'as':_0x5f262e['as'],'attributes':_0x5f262e[_0x5ea9('0x21')],'include':_0x5f262e['include']?_[_0x5ea9('0x23')](_0x5f262e[_0x5ea9('0x22')],function(_0x2b9298){return{'model':db[_0x2b9298[_0x5ea9('0x24')]],'as':_0x2b9298['as'],'attributes':_0x2b9298['attributes'],'include':_0x2b9298[_0x5ea9('0x22')]?_[_0x5ea9('0x23')](_0x2b9298[_0x5ea9('0x22')],function(_0x497b33){return{'model':db[_0x497b33[_0x5ea9('0x24')]],'as':_0x497b33['as'],'attributes':_0x497b33[_0x5ea9('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4af11e){logger[_0x5ea9('0x11')](_0x5ea9('0x1b'),_0x175125);logger[_0x5ea9('0x14')](_0x5ea9('0x1b'),_0x175125,JSON[_0x5ea9('0x25')](_0x4af11e));_0x5ba937(_0x4af11e);})[_0x5ea9('0x1a')](function(_0x1d27d9){logger[_0x5ea9('0x16')](_0x5ea9('0x1b'),_0x1d27d9[_0x5ea9('0x18')],_0x175125);_0x1eecb8(_0x278ca8[_0x5ea9('0x16')](0x1f4,_0x1d27d9[_0x5ea9('0x18')]));});});};exports['ShowMailAccount']=function(_0x4566a4){var _0xe0f500=this;return new Promise(function(_0x4f377a,_0x20ea34){return db[_0x5ea9('0x1c')][_0x5ea9('0x26')]({'raw':_0x4566a4[_0x5ea9('0x1e')]?_0x4566a4['options'][_0x5ea9('0x1f')]===undefined?!![]:![]:!![],'where':_0x4566a4['options']?_0x4566a4[_0x5ea9('0x1e')][_0x5ea9('0x20')]||null:null,'attributes':_0x4566a4['options']?_0x4566a4[_0x5ea9('0x1e')][_0x5ea9('0x21')]||null:null,'include':_0x4566a4[_0x5ea9('0x1e')]?_0x4566a4[_0x5ea9('0x1e')][_0x5ea9('0x22')]?_['map'](_0x4566a4[_0x5ea9('0x1e')]['include'],function(_0x2e699a){return{'model':db[_0x2e699a[_0x5ea9('0x24')]],'as':_0x2e699a['as'],'attributes':_0x2e699a[_0x5ea9('0x21')],'include':_0x2e699a[_0x5ea9('0x22')]?_[_0x5ea9('0x23')](_0x2e699a[_0x5ea9('0x22')],function(_0xa71592){return{'model':db[_0xa71592[_0x5ea9('0x24')]],'as':_0xa71592['as'],'attributes':_0xa71592[_0x5ea9('0x21')],'include':_0xa71592[_0x5ea9('0x22')]?_[_0x5ea9('0x23')](_0xa71592[_0x5ea9('0x22')],function(_0x295c9b){return{'model':db[_0x295c9b[_0x5ea9('0x24')]],'as':_0x295c9b['as'],'attributes':_0x295c9b[_0x5ea9('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349358){logger['info'](_0x5ea9('0x27'),_0x4566a4);logger[_0x5ea9('0x14')](_0x5ea9('0x27'),_0x4566a4,JSON[_0x5ea9('0x25')](_0x349358));_0x4f377a(_0x349358);})[_0x5ea9('0x1a')](function(_0x260a08){logger[_0x5ea9('0x16')](_0x5ea9('0x27'),_0x260a08[_0x5ea9('0x18')],_0x4566a4);_0x20ea34(_0xe0f500[_0x5ea9('0x16')](0x1f4,_0x260a08[_0x5ea9('0x18')]));});});};exports['NotifyMailAccount']=function(_0x351f7a){var _0x3b7f0d=this;return new Promise(function(_0x5006e0,_0x4a78bc){var _0x8a7813={'body':_0x351f7a[_0x5ea9('0x28')],'channel':_0x5ea9('0x29')};var _0x4495c3=_[_0x5ea9('0x2a')](_['keys'](db[_0x5ea9('0x2b')][_0x5ea9('0x2c')]),[_0x5ea9('0x2d'),_0x5ea9('0x2e'),_0x5ea9('0x2f'),_0x5ea9('0x30')]);var _0x4312a0=![];if(_0x351f7a[_0x5ea9('0x28')]['id']){delete _0x351f7a[_0x5ea9('0x28')]['id'];}if(_['isNil'](_0x351f7a['body'][_0x5ea9('0x31')])){return _0x4a78bc(_0x3b7f0d[_0x5ea9('0x16')](0x1f4,_0x5ea9('0x32')));}if(_[_0x5ea9('0x33')](_0x351f7a[_0x5ea9('0x28')]['body'])||_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x28')]===''){return _0x4a78bc(_0x3b7f0d[_0x5ea9('0x16')](0x1f4,_0x5ea9('0x34')));}if(_[_0x5ea9('0x33')](_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x35')])){return _0x4a78bc(_0x3b7f0d[_0x5ea9('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4495c3));}if(!_[_0x5ea9('0x36')](_0x4495c3,_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x35')])){return _0x4a78bc(_0x3b7f0d[_0x5ea9('0x16')](0x1f4,_0x5ea9('0x37')+_0x4495c3));}var _0x32fd9f={};_0x32fd9f[_0x351f7a['body'][_0x5ea9('0x35')]]=_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x31')];return db[_0x5ea9('0x1c')][_0x5ea9('0x26')]({'where':{'id':_0x351f7a[_0x5ea9('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x5ea9('0x39'),'include':[{'model':db['CmContact'],'as':_0x5ea9('0x3a'),'where':_0x32fd9f,'limit':0x1,'order':[[_0x5ea9('0x2e'),'DESC']]}]},{'model':db[_0x5ea9('0x3b')],'as':'Applications'},{'model':db[_0x5ea9('0x3c')],'as':_0x5ea9('0x3d')}]})[_0x5ea9('0x3e')](function(_0x29eee2){if(_0x29eee2&&_0x29eee2['List']){var _0x5166ff=_0x29eee2[_0x5ea9('0x3f')]({'plain':!![]});_0x8a7813[_0x5ea9('0x38')]=_[_0x5ea9('0x40')](_0x5166ff,[_0x5ea9('0x41'),_0x5ea9('0x39')]);_0x8a7813[_0x5ea9('0x42')]=_0x5166ff[_0x5ea9('0x41')];_0x8a7813[_0x5ea9('0x43')]=_0x5166ff['List'];_0x8a7813[_0x5ea9('0x42')]=_[_0x5ea9('0x44')](_0x8a7813[_0x5ea9('0x42')],[_0x5ea9('0x45')],[_0x5ea9('0x46')]);if(_0x8a7813[_0x5ea9('0x38')]&&_0x8a7813[_0x5ea9('0x38')][_0x5ea9('0x47')]){_0x8a7813[_0x5ea9('0x42')][_0x5ea9('0x48')]({'id':0x0,'priority':_0x8a7813['applications']['length']+0x1,'app':_0x5ea9('0x49'),'appdata':_0x5ea9('0x47'),'interval':'*,*,*,*'});}if(_0x8a7813[_0x5ea9('0x38')][_0x5ea9('0x41')]){delete _0x8a7813['account'][_0x5ea9('0x41')];}if(_0x8a7813[_0x5ea9('0x38')][_0x5ea9('0x39')]){delete _0x8a7813[_0x5ea9('0x38')][_0x5ea9('0x39')];}if(_0x5166ff[_0x5ea9('0x39')][_0x5ea9('0x3a')][_0x5ea9('0x4a')]){return _0x5166ff[_0x5ea9('0x39')]['Contacts'][0x0];}var _0x24cf8c=_[_0x5ea9('0xb')](_0x351f7a['body'],{'firstName':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x31')],'ListId':_0x5166ff['ListId']});_0x24cf8c[_0x351f7a[_0x5ea9('0x28')]['mapKey']]=_0x351f7a['body'][_0x5ea9('0x31')];return db[_0x5ea9('0x2b')][_0x5ea9('0x4b')](_0x24cf8c);}else{throw new Error('List\x20not\x20found');}})[_0x5ea9('0x3e')](function(_0x4d4b1e){_0x8a7813['contact']=_0x4d4b1e;if(_0x4d4b1e){if(!_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x4c')]){_0x351f7a['body'][_0x5ea9('0x18')][_0x5ea9('0x4c')]=rs[_0x5ea9('0x4d')]()+'\x20'+_0x351f7a[_0x5ea9('0x28')]['message'][_0x5ea9('0x31')];}var _0x3f377d={'ContactId':_0x4d4b1e['id'],'MailAccountId':_0x351f7a[_0x5ea9('0x38')]['id'],'inReplyTo':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x4c')],'to':_0x351f7a[_0x5ea9('0x28')]['message'][_0x5ea9('0x31')],'cc':_0x351f7a['body'][_0x5ea9('0x18')]['cc'],'subject':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x4e')],'attach':_0x351f7a[_0x5ea9('0x28')]['message'][_0x5ea9('0x4f')],'lastMsgAt':moment()[_0x5ea9('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x5ea9('0x51')]['find']({'where':{'closed':![],'MailAccountId':_0x351f7a['account']['id']},'include':[{'model':db[_0x5ea9('0x52')],'as':_0x5ea9('0x53'),'attributes':[_0x5ea9('0x4c')],'where':{'messageId':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x54')]}}]})[_0x5ea9('0x3e')](function(_0x2f8ee3){if(_0x2f8ee3){return[_0x2f8ee3,![]];}return db[_0x5ea9('0x51')][_0x5ea9('0x4b')](_0x3f377d)['then'](function(_0x4e2432){return[_0x4e2432,!![]];});});}else{throw new Error(_0x5ea9('0x55'));}})[_0x5ea9('0x56')](function(_0x25b8fe,_0x5c19e1){if(_0x25b8fe){_0x4312a0=_0x5c19e1;if(!_0x5c19e1){return _0x25b8fe[_0x5ea9('0x57')]({'inReplyTo':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x4c')],'to':_0x351f7a['body'][_0x5ea9('0x18')][_0x5ea9('0x31')],'cc':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')]['cc'],'subject':_0x351f7a[_0x5ea9('0x28')]['message'][_0x5ea9('0x4e')],'attach':_0x25b8fe[_0x5ea9('0x4f')]?_0x25b8fe[_0x5ea9('0x4f')]:_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x5ea9('0x58')),'lastMsgAt':moment()[_0x5ea9('0x50')](_0x5ea9('0x58')),'lastMsgDirection':'in'});}else{return _0x25b8fe;}}})['then'](function(_0x143fae){_0x8a7813[_0x5ea9('0x59')]=_0x143fae[_0x5ea9('0x3f')]({'plain':!![]});_0x8a7813['interaction'][_0x5ea9('0x5a')]=_0x4312a0;return db[_0x5ea9('0x52')][_0x5ea9('0x4b')]({'body':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x28')],'MailAccountId':_0x351f7a[_0x5ea9('0x38')]['id'],'MailInteractionId':_0x143fae['id'],'direction':'in','ContactId':_0x8a7813['contact']['id'],'messageId':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x4c')],'from':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x31')],'to':_0x351f7a['body'][_0x5ea9('0x18')]['to'],'cc':_0x351f7a[_0x5ea9('0x28')]['message']['cc'],'subject':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x4e')],'attach':_0x351f7a['body']['message'][_0x5ea9('0x4f')],'Attachments':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x5b')],'originTo':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')]['originTo'],'originCc':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x5c')],'bcc':_0x351f7a[_0x5ea9('0x28')]['message']['bcc'],'ChatWebsiteId':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')][_0x5ea9('0x5d')]||null,'originChannel':_0x351f7a[_0x5ea9('0x28')][_0x5ea9('0x18')]['originChannel']||_0x5ea9('0x5e'),'ChatOfflineMessageId':_0x351f7a[_0x5ea9('0x28')]['message'][_0x5ea9('0x5f')]||null},{'include':[{'model':db[_0x5ea9('0x60')],'as':_0x5ea9('0x61')}]});})['then'](function(_0x526ad4){_0x8a7813[_0x5ea9('0x18')]=_0x526ad4;if(_0x8a7813[_0x5ea9('0x59')][_0x5ea9('0x62')]){return db[_0x5ea9('0x63')][_0x5ea9('0x26')]({'attributes':['id','name'],'where':{'id':_0x8a7813['interaction'][_0x5ea9('0x62')]}})[_0x5ea9('0x3e')](function(_0x153612){if(_0x153612){_0x8a7813['applications'][_0x5ea9('0x64')]({'id':0x0,'priority':0x0,'app':_0x5ea9('0x65'),'appdata':_0x153612[_0x5ea9('0x66')]+','+(_0x8a7813['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x5ea9('0x67'),_0x8a7813);});}return respondWithRpcPromise(_0x5ea9('0x68'),_0x5ea9('0x67'),_0x8a7813);})[_0x5ea9('0x3e')](function(_0x53ac66){_0x5006e0(_0x53ac66);})[_0x5ea9('0x1a')](function(_0x2a0214){_0x4a78bc(_0x3b7f0d['error'](0x1f4,_0x2a0214['message']));});});}; \ No newline at end of file +var _0xae50=['omit','applications','list','orderBy','priority','asc','autoclose','push','close','length','create','contact','messageId','generate','subject','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','format','interaction','created','attachments','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','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','GetMailAccount','MailAccount','findAll','options','where','attributes','include','map','model','ShowMailAccount','find','raw','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','Contacts','updatedAt','MailApplication','Applications','MailServerOut','Smtp','get'];(function(_0x3d2587,_0x4c59be){var _0x137742=function(_0x24bdee){while(--_0x24bdee){_0x3d2587['push'](_0x3d2587['shift']());}};_0x137742(++_0x4c59be);}(_0xae50,0x179));var _0x0ae5=function(_0x2d9535,_0x4bc592){_0x2d9535=_0x2d9535-0x0;var _0xb4e710=_0xae50[_0x2d9535];return _0xb4e710;};'use strict';var _=require(_0x0ae5('0x0'));var util=require(_0x0ae5('0x1'));var moment=require(_0x0ae5('0x2'));var BPromise=require(_0x0ae5('0x3'));var rs=require(_0x0ae5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ae5('0x5'))['db'];var utils=require(_0x0ae5('0x6'));var logger=require(_0x0ae5('0x7'))(_0x0ae5('0x8'));var config=require(_0x0ae5('0x9'));var jayson=require(_0x0ae5('0xa'));var client=jayson['client'][_0x0ae5('0xb')]({'port':0x232c});config[_0x0ae5('0xc')]=_[_0x0ae5('0xd')](config[_0x0ae5('0xc')],{'host':_0x0ae5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ae5('0xc')]));require(_0x0ae5('0xf'))[_0x0ae5('0x10')](socket);function respondWithRpcPromise(_0x392722,_0x27e9dd,_0x368dcc){return new BPromise(function(_0x555b93,_0x240c6f){return client[_0x0ae5('0x11')](_0x392722,_0x368dcc)[_0x0ae5('0x12')](function(_0x49d9c7){logger[_0x0ae5('0x13')](_0x0ae5('0x14'),_0x27e9dd,_0x0ae5('0x15'));logger[_0x0ae5('0x16')](_0x0ae5('0x17'),_0x27e9dd,'request\x20sent',JSON[_0x0ae5('0x18')](_0x49d9c7));if(_0x49d9c7['error']){if(_0x49d9c7[_0x0ae5('0x19')][_0x0ae5('0x1a')]===0x1f4){logger[_0x0ae5('0x19')](_0x0ae5('0x14'),_0x27e9dd,_0x49d9c7[_0x0ae5('0x19')][_0x0ae5('0x1b')]);return _0x240c6f(_0x49d9c7[_0x0ae5('0x19')][_0x0ae5('0x1b')]);}logger[_0x0ae5('0x19')](_0x0ae5('0x14'),_0x27e9dd,_0x49d9c7['error'][_0x0ae5('0x1b')]);return _0x555b93(_0x49d9c7[_0x0ae5('0x19')][_0x0ae5('0x1b')]);}else{logger[_0x0ae5('0x13')](_0x0ae5('0x14'),_0x27e9dd,_0x0ae5('0x15'));_0x555b93(_0x49d9c7[_0x0ae5('0x1c')][_0x0ae5('0x1b')]);}})[_0x0ae5('0x1d')](function(_0x272dc6){logger['error']('MailAccount,\x20%s,\x20%s',_0x27e9dd,_0x272dc6);_0x240c6f(_0x272dc6);});});}exports[_0x0ae5('0x1e')]=function(_0x43eacd){var _0x7751a0=this;return new Promise(function(_0x8af735,_0x183286){return db[_0x0ae5('0x1f')][_0x0ae5('0x20')]({'raw':_0x43eacd['options']?_0x43eacd[_0x0ae5('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x43eacd[_0x0ae5('0x21')]?_0x43eacd[_0x0ae5('0x21')][_0x0ae5('0x22')]||null:null,'attributes':_0x43eacd[_0x0ae5('0x21')]?_0x43eacd['options'][_0x0ae5('0x23')]||null:null,'limit':_0x43eacd[_0x0ae5('0x21')]?_0x43eacd[_0x0ae5('0x21')]['limit']||null:null,'include':_0x43eacd[_0x0ae5('0x21')]?_0x43eacd['options'][_0x0ae5('0x24')]?_[_0x0ae5('0x25')](_0x43eacd[_0x0ae5('0x21')][_0x0ae5('0x24')],function(_0x50f519){return{'model':db[_0x50f519[_0x0ae5('0x26')]],'as':_0x50f519['as'],'attributes':_0x50f519[_0x0ae5('0x23')],'include':_0x50f519['include']?_[_0x0ae5('0x25')](_0x50f519[_0x0ae5('0x24')],function(_0x58f521){return{'model':db[_0x58f521[_0x0ae5('0x26')]],'as':_0x58f521['as'],'attributes':_0x58f521[_0x0ae5('0x23')],'include':_0x58f521[_0x0ae5('0x24')]?_[_0x0ae5('0x25')](_0x58f521[_0x0ae5('0x24')],function(_0x23b82c){return{'model':db[_0x23b82c[_0x0ae5('0x26')]],'as':_0x23b82c['as'],'attributes':_0x23b82c[_0x0ae5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0ae5('0x12')](function(_0x2da991){logger['info']('GetMailAccount',_0x43eacd);logger[_0x0ae5('0x16')]('GetMailAccount',_0x43eacd,JSON['stringify'](_0x2da991));_0x8af735(_0x2da991);})[_0x0ae5('0x1d')](function(_0x1481bc){logger[_0x0ae5('0x19')](_0x0ae5('0x1e'),_0x1481bc[_0x0ae5('0x1b')],_0x43eacd);_0x183286(_0x7751a0[_0x0ae5('0x19')](0x1f4,_0x1481bc[_0x0ae5('0x1b')]));});});};exports[_0x0ae5('0x27')]=function(_0x128263){var _0x3e4a21=this;return new Promise(function(_0x40217d,_0x594a3a){return db[_0x0ae5('0x1f')][_0x0ae5('0x28')]({'raw':_0x128263[_0x0ae5('0x21')]?_0x128263[_0x0ae5('0x21')][_0x0ae5('0x29')]===undefined?!![]:![]:!![],'where':_0x128263['options']?_0x128263['options'][_0x0ae5('0x22')]||null:null,'attributes':_0x128263[_0x0ae5('0x21')]?_0x128263[_0x0ae5('0x21')][_0x0ae5('0x23')]||null:null,'include':_0x128263[_0x0ae5('0x21')]?_0x128263['options'][_0x0ae5('0x24')]?_[_0x0ae5('0x25')](_0x128263[_0x0ae5('0x21')][_0x0ae5('0x24')],function(_0x117a23){return{'model':db[_0x117a23[_0x0ae5('0x26')]],'as':_0x117a23['as'],'attributes':_0x117a23[_0x0ae5('0x23')],'include':_0x117a23[_0x0ae5('0x24')]?_['map'](_0x117a23[_0x0ae5('0x24')],function(_0xa3e785){return{'model':db[_0xa3e785[_0x0ae5('0x26')]],'as':_0xa3e785['as'],'attributes':_0xa3e785[_0x0ae5('0x23')],'include':_0xa3e785['include']?_[_0x0ae5('0x25')](_0xa3e785[_0x0ae5('0x24')],function(_0x33d400){return{'model':db[_0x33d400[_0x0ae5('0x26')]],'as':_0x33d400['as'],'attributes':_0x33d400[_0x0ae5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0ae5('0x12')](function(_0x5c0110){logger[_0x0ae5('0x13')](_0x0ae5('0x27'),_0x128263);logger['debug']('ShowMailAccount',_0x128263,JSON[_0x0ae5('0x18')](_0x5c0110));_0x40217d(_0x5c0110);})[_0x0ae5('0x1d')](function(_0x42a84e){logger['error'](_0x0ae5('0x27'),_0x42a84e[_0x0ae5('0x1b')],_0x128263);_0x594a3a(_0x3e4a21[_0x0ae5('0x19')](0x1f4,_0x42a84e['message']));});});};exports[_0x0ae5('0x2a')]=function(_0xbcc7a2){var _0xb71e86=this;return new Promise(function(_0x11ae91,_0x22c8bb){var _0x39c0bd={'body':_0xbcc7a2[_0x0ae5('0x2b')],'channel':_0x0ae5('0x2c')};var _0x4a1af0=_[_0x0ae5('0x2d')](_['keys'](db[_0x0ae5('0x2e')][_0x0ae5('0x2f')]),['createdAt','updatedAt',_0x0ae5('0x30'),_0x0ae5('0x31')]);var _0x505301=![];if(_0xbcc7a2['body']['id']){delete _0xbcc7a2[_0x0ae5('0x2b')]['id'];}if(_['isNil'](_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x32')])){return _0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x0ae5('0x33')));}if(_['isNil'](_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x2b')])||_0xbcc7a2[_0x0ae5('0x2b')]['body']===''){return _0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x0ae5('0x34')));}if(_['isNil'](_0xbcc7a2[_0x0ae5('0x2b')]['mapKey'])){return _0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x0ae5('0x35')+_0x4a1af0));}if(!_[_0x0ae5('0x36')](_0x4a1af0,_0xbcc7a2[_0x0ae5('0x2b')]['mapKey'])){return _0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x0ae5('0x37')+_0x4a1af0));}var _0x378489={};_0x378489[_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x38')]]=_0xbcc7a2['body'][_0x0ae5('0x32')];return db[_0x0ae5('0x1f')][_0x0ae5('0x28')]({'where':{'id':_0xbcc7a2[_0x0ae5('0x39')]['id']},'include':[{'model':db[_0x0ae5('0x3a')],'as':_0x0ae5('0x3b'),'include':[{'model':db['CmContact'],'as':_0x0ae5('0x3c'),'where':_0x378489,'limit':0x1,'order':[[_0x0ae5('0x3d'),'DESC']]}]},{'model':db[_0x0ae5('0x3e')],'as':_0x0ae5('0x3f')},{'model':db[_0x0ae5('0x40')],'as':_0x0ae5('0x41')}]})[_0x0ae5('0x12')](function(_0x421305){if(_0x421305&&_0x421305['List']){var _0x1eb9d2=_0x421305[_0x0ae5('0x42')]({'plain':!![]});_0x39c0bd[_0x0ae5('0x39')]=_[_0x0ae5('0x43')](_0x1eb9d2,['Applications','List']);_0x39c0bd[_0x0ae5('0x44')]=_0x1eb9d2[_0x0ae5('0x3f')];_0x39c0bd[_0x0ae5('0x45')]=_0x1eb9d2[_0x0ae5('0x3b')];_0x39c0bd[_0x0ae5('0x44')]=_[_0x0ae5('0x46')](_0x39c0bd[_0x0ae5('0x44')],[_0x0ae5('0x47')],[_0x0ae5('0x48')]);if(_0x39c0bd[_0x0ae5('0x39')]&&_0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x49')]){_0x39c0bd[_0x0ae5('0x44')][_0x0ae5('0x4a')]({'id':0x0,'priority':_0x39c0bd[_0x0ae5('0x44')]['length']+0x1,'app':_0x0ae5('0x4b'),'appdata':_0x0ae5('0x49'),'interval':'*,*,*,*'});}if(_0x39c0bd[_0x0ae5('0x39')]['Applications']){delete _0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x3f')];}if(_0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x3b')]){delete _0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x3b')];}if(_0x1eb9d2[_0x0ae5('0x3b')][_0x0ae5('0x3c')][_0x0ae5('0x4c')]){return _0x1eb9d2['List'][_0x0ae5('0x3c')][0x0];}var _0x29c16d=_[_0x0ae5('0xd')](_0xbcc7a2[_0x0ae5('0x2b')],{'firstName':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x32')],'ListId':_0x1eb9d2['ListId']});_0x29c16d[_0xbcc7a2['body'][_0x0ae5('0x38')]]=_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x32')];return db[_0x0ae5('0x2e')][_0x0ae5('0x4d')](_0x29c16d);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x16b12d){_0x39c0bd[_0x0ae5('0x4e')]=_0x16b12d;if(_0x16b12d){if(!_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x4f')]){_0xbcc7a2['body'][_0x0ae5('0x1b')]['messageId']=rs[_0x0ae5('0x50')]()+'\x20'+_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x32')];}var _0x3ba50a={'ContactId':_0x16b12d['id'],'MailAccountId':_0xbcc7a2[_0x0ae5('0x39')]['id'],'inReplyTo':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x4f')],'to':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x32')],'cc':_0xbcc7a2[_0x0ae5('0x2b')]['message']['cc'],'subject':_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x51')],'attach':_0xbcc7a2['body'][_0x0ae5('0x1b')]['attach'],'lastMsgAt':moment()['format'](_0x0ae5('0x52')),'lastMsgDirection':'in'};return db[_0x0ae5('0x53')]['find']({'where':{'closed':![],'MailAccountId':_0xbcc7a2[_0x0ae5('0x39')]['id']},'include':[{'model':db[_0x0ae5('0x54')],'as':_0x0ae5('0x55'),'attributes':['messageId'],'where':{'messageId':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x56')]}}]})[_0x0ae5('0x12')](function(_0x4c3980){if(_0x4c3980){return[_0x4c3980,![]];}return db[_0x0ae5('0x53')]['create'](_0x3ba50a)[_0x0ae5('0x12')](function(_0x5f5846){return[_0x5f5846,!![]];});});}else{throw new Error(_0x0ae5('0x57'));}})[_0x0ae5('0x58')](function(_0x334878,_0x4d805d){if(_0x334878){_0x505301=_0x4d805d;if(!_0x4d805d){return _0x334878[_0x0ae5('0x59')]({'inReplyTo':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x4f')],'to':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x32')],'cc':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')]['cc'],'subject':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x51')],'attach':_0x334878[_0x0ae5('0x5a')]?_0x334878[_0x0ae5('0x5a')]:_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x5a')],'substatus':null,'substatusAt':moment()[_0x0ae5('0x5b')](_0x0ae5('0x52')),'lastMsgAt':moment()[_0x0ae5('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x334878;}}})[_0x0ae5('0x12')](function(_0x3f8cbc){_0x39c0bd[_0x0ae5('0x5c')]=_0x3f8cbc[_0x0ae5('0x42')]({'plain':!![]});_0x39c0bd['interaction'][_0x0ae5('0x5d')]=_0x505301;return db[_0x0ae5('0x54')][_0x0ae5('0x4d')]({'body':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x2b')],'MailAccountId':_0xbcc7a2[_0x0ae5('0x39')]['id'],'MailInteractionId':_0x3f8cbc['id'],'direction':'in','ContactId':_0x39c0bd[_0x0ae5('0x4e')]['id'],'messageId':_0xbcc7a2[_0x0ae5('0x2b')]['message']['messageId'],'from':_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x32')],'to':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')]['to'],'cc':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')]['cc'],'subject':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x51')],'attach':_0xbcc7a2['body'][_0x0ae5('0x1b')][_0x0ae5('0x5a')],'Attachments':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x5e')],'originTo':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x5f')],'originCc':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x60')],'bcc':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x61')],'ChatWebsiteId':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')]['ChatWebsiteId']||null,'originChannel':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x62')]||'Email','ChatOfflineMessageId':_0xbcc7a2[_0x0ae5('0x2b')][_0x0ae5('0x1b')][_0x0ae5('0x63')]||null},{'include':[{'model':db[_0x0ae5('0x64')],'as':_0x0ae5('0x65')}]});})[_0x0ae5('0x12')](function(_0x23f423){_0x39c0bd['message']=_0x23f423;if(_0x39c0bd[_0x0ae5('0x5c')]['UserId']){return db[_0x0ae5('0x66')][_0x0ae5('0x28')]({'attributes':['id',_0x0ae5('0x67')],'where':{'id':_0x39c0bd[_0x0ae5('0x5c')][_0x0ae5('0x68')]}})['then'](function(_0x336521){if(_0x336521){_0x39c0bd[_0x0ae5('0x44')][_0x0ae5('0x69')]({'id':0x0,'priority':0x0,'app':_0x0ae5('0x6a'),'appdata':_0x336521[_0x0ae5('0x67')]+','+(_0x39c0bd[_0x0ae5('0x39')][_0x0ae5('0x6b')]||0xa),'interval':_0x0ae5('0x6c')});}return respondWithRpcPromise('Start',_0x0ae5('0x6d'),_0x39c0bd);});}return respondWithRpcPromise(_0x0ae5('0x6e'),_0x0ae5('0x6d'),_0x39c0bd);})[_0x0ae5('0x12')](function(_0x1b3caa){_0x11ae91(_0x1b3caa);})[_0x0ae5('0x1d')](function(_0x4c268a){_0x22c8bb(_0xb71e86[_0x0ae5('0x19')](0x1f4,_0x4c268a[_0x0ae5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f703c08..ebe82cc 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 _0x3b6b=['save','update','emit','register','length'];(function(_0x4990e6,_0xfca09a){var _0x107bf6=function(_0xd720b9){while(--_0xd720b9){_0x4990e6['push'](_0x4990e6['shift']());}};_0x107bf6(++_0xfca09a);}(_0x3b6b,0x87));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xb3b6('0x0'),'remove',_0xb3b6('0x1')];function createListener(_0xe471e,_0x25964e){return function(_0x4cec82){_0x25964e[_0xb3b6('0x2')](_0xe471e,_0x4cec82);};}function removeListener(_0x4d4b6e,_0x2da3ee){return function(){MailAccountEvents['removeListener'](_0x4d4b6e,_0x2da3ee);};}exports[_0xb3b6('0x3')]=function(_0x107d64){for(var _0x847895=0x0,_0x5b782e=events[_0xb3b6('0x4')];_0x847895<_0x5b782e;_0x847895++){var _0x3be0b9=events[_0x847895];var _0x34ea2b=createListener('mailAccount:'+_0x3be0b9,_0x107d64);MailAccountEvents['on'](_0x3be0b9,_0x34ea2b);}}; \ No newline at end of file +var _0xdb21=['length','mailAccount:','./mailAccount.events','save','update','removeListener','register'];(function(_0x594e4a,_0x6fa99f){var _0x3d4a53=function(_0x59123c){while(--_0x59123c){_0x594e4a['push'](_0x594e4a['shift']());}};_0x3d4a53(++_0x6fa99f);}(_0xdb21,0xcd));var _0x1db2=function(_0x288478,_0x23303e){_0x288478=_0x288478-0x0;var _0x234c05=_0xdb21[_0x288478];return _0x234c05;};'use strict';var MailAccountEvents=require(_0x1db2('0x0'));var events=[_0x1db2('0x1'),'remove',_0x1db2('0x2')];function createListener(_0x19f0df,_0x2f38e9){return function(_0x1d1d5c){_0x2f38e9['emit'](_0x19f0df,_0x1d1d5c);};}function removeListener(_0x3b352c,_0x45ca76){return function(){MailAccountEvents[_0x1db2('0x3')](_0x3b352c,_0x45ca76);};}exports[_0x1db2('0x4')]=function(_0x23784b){for(var _0x1f5184=0x0,_0x2091b4=events[_0x1db2('0x5')];_0x1f5184<_0x2091b4;_0x1f5184++){var _0x6285ab=events[_0x1f5184];var _0x55af3a=createListener(_0x1db2('0x6')+_0x6285ab,_0x23784b);MailAccountEvents['on'](_0x6285ab,_0x55af3a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 48649bb..4f5fcdb 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 _0xc8f7=['put','update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x2b45d9,_0x3f4e3e){var _0x26f957=function(_0x487782){while(--_0x487782){_0x2b45d9['push'](_0x2b45d9['shift']());}};_0x26f957(++_0x3f4e3e);}(_0xc8f7,0x1b7));var _0x7c8f=function(_0xa5e4cb,_0x5bc810){_0xa5e4cb=_0xa5e4cb-0x0;var _0x41bf88=_0xc8f7[_0xa5e4cb];return _0x41bf88;};'use strict';var multer=require(_0x7c8f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7c8f('0x1'));var express=require(_0x7c8f('0x2'));var router=express['Router']();var fs_extra=require(_0x7c8f('0x3'));var auth=require(_0x7c8f('0x4'));var interaction=require(_0x7c8f('0x5'));var config=require('../../config/environment');var controller=require(_0x7c8f('0x6'));router[_0x7c8f('0x7')](_0x7c8f('0x8'),auth[_0x7c8f('0x9')](),controller[_0x7c8f('0xa')]);router[_0x7c8f('0xb')](_0x7c8f('0x8'),auth['isAuthenticated'](),controller[_0x7c8f('0xc')]);router['delete'](_0x7c8f('0x8'),auth[_0x7c8f('0x9')](),controller[_0x7c8f('0xd')]);module[_0x7c8f('0xe')]=router; \ No newline at end of file +var _0xaece=['/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show'];(function(_0x1e145e,_0x26460f){var _0x5a8eca=function(_0x1234ff){while(--_0x1234ff){_0x1e145e['push'](_0x1e145e['shift']());}};_0x5a8eca(++_0x26460f);}(_0xaece,0xb6));var _0xeaec=function(_0x17c003,_0x241582){_0x17c003=_0x17c003-0x0;var _0x2866aa=_0xaece[_0x17c003];return _0x2866aa;};'use strict';var multer=require(_0xeaec('0x0'));var util=require(_0xeaec('0x1'));var path=require(_0xeaec('0x2'));var timeout=require(_0xeaec('0x3'));var express=require(_0xeaec('0x4'));var router=express['Router']();var fs_extra=require(_0xeaec('0x5'));var auth=require(_0xeaec('0x6'));var interaction=require(_0xeaec('0x7'));var config=require(_0xeaec('0x8'));var controller=require(_0xeaec('0x9'));router[_0xeaec('0xa')]('/:id',auth[_0xeaec('0xb')](),controller[_0xeaec('0xc')]);router['put'](_0xeaec('0xd'),auth[_0xeaec('0xb')](),controller['update']);router['delete']('/:id',auth[_0xeaec('0xb')](),controller[_0xeaec('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 89195f3..b07f513 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 _0x4cdc=['TEXT','STRING','*,*,*,*','noop'];(function(_0x32e7da,_0x922583){var _0x317acf=function(_0x13f3b0){while(--_0x13f3b0){_0x32e7da['push'](_0x32e7da['shift']());}};_0x317acf(++_0x922583);}(_0x4cdc,0xe7));var _0xc4cd=function(_0x12e2f1,_0x17c2f0){_0x12e2f1=_0x12e2f1-0x0;var _0x3b45ba=_0x4cdc[_0x12e2f1];return _0x3b45ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc4cd('0x0')},'appdata':{'type':Sequelize[_0xc4cd('0x1')]()},'description':{'type':Sequelize[_0xc4cd('0x2')]},'interval':{'type':Sequelize[_0xc4cd('0x2')],'defaultValue':_0xc4cd('0x3')}}; \ No newline at end of file +var _0x0e88=['INTEGER','STRING','exports'];(function(_0x12b1a2,_0x269a7f){var _0x17bf43=function(_0x4c0c32){while(--_0x4c0c32){_0x12b1a2['push'](_0x12b1a2['shift']());}};_0x17bf43(++_0x269a7f);}(_0x0e88,0x194));var _0x80e8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0e88[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x80e8('0x0')]={'priority':{'type':Sequelize[_0x80e8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x80e8('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x80e8('0x2')]},'interval':{'type':Sequelize[_0x80e8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index ae7adad..a997adc 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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x5a32bb,_0x2d24ca){var _0x594bce=function(_0xd5e301){while(--_0xd5e301){_0x5a32bb['push'](_0x5a32bb['shift']());}};_0x594bce(++_0x2d24ca);}(_0x70e0,0x17b));var _0x070e=function(_0x3f4f37,_0x22de80){_0x3f4f37=_0x3f4f37-0x0;var _0x416887=_0x70e0[_0x3f4f37];return _0x416887;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x194adf,_0x220258){var _0x2242e3=function(_0x42afcd){while(--_0x42afcd){_0x194adf['push'](_0x194adf['shift']());}};_0x2242e3(++_0x220258);}(_0x70e0,0x17b));var _0x070e=function(_0x2b126e,_0x5c6a70){_0x2b126e=_0x2b126e-0x0;var _0x11bdc4=_0x70e0[_0x2b126e];return _0x11bdc4;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5e46c81..e2299e2 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 _0x0356=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailApplication.attributes','exports','define','mail_applications'];(function(_0xf2726b,_0x87deb7){var _0xa61a5=function(_0x27759c){while(--_0x27759c){_0xf2726b['push'](_0xf2726b['shift']());}};_0xa61a5(++_0x87deb7);}(_0x0356,0x112));var _0x6035=function(_0x3c75af,_0x2ca08e){_0x3c75af=_0x3c75af-0x0;var _0xfbf0db=_0x0356[_0x3c75af];return _0xfbf0db;};'use strict';var _=require(_0x6035('0x0'));var util=require(_0x6035('0x1'));var logger=require(_0x6035('0x2'))(_0x6035('0x3'));var moment=require(_0x6035('0x4'));var BPromise=require(_0x6035('0x5'));var rp=require(_0x6035('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6035('0x7'));var attributes=require(_0x6035('0x8'));module[_0x6035('0x9')]=function(_0x2f5d27,_0x4a963b){return _0x2f5d27[_0x6035('0xa')]('MailApplication',attributes,{'tableName':_0x6035('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6035('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x73c9=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x310eeb,_0x48821f){var _0xc33f1c=function(_0x1975fc){while(--_0x1975fc){_0x310eeb['push'](_0x310eeb['shift']());}};_0xc33f1c(++_0x48821f);}(_0x73c9,0xde));var _0x973c=function(_0xcdd286,_0x138504){_0xcdd286=_0xcdd286-0x0;var _0x324ffe=_0x73c9[_0xcdd286];return _0x324ffe;};'use strict';var _=require(_0x973c('0x0'));var util=require(_0x973c('0x1'));var logger=require('../../config/logger')(_0x973c('0x2'));var moment=require(_0x973c('0x3'));var BPromise=require(_0x973c('0x4'));var rp=require(_0x973c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x973c('0x6'));var config=require(_0x973c('0x7'));var attributes=require('./mailApplication.attributes');module[_0x973c('0x8')]=function(_0x3dbe04,_0x5c79a0){return _0x3dbe04[_0x973c('0x9')](_0x973c('0xa'),attributes,{'tableName':_0x973c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x973c('0xc'),'collate':_0x973c('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index e1d50e6..6e293a7 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 _0x8b89=['info','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailApplication,\x20%s,\x20%s','result','catch','UpdateMailApplication','MailApplication','options','where','attributes','limit'];(function(_0x2d4439,_0x3d65dc){var _0x2f2e15=function(_0x18d122){while(--_0x18d122){_0x2d4439['push'](_0x2d4439['shift']());}};_0x2f2e15(++_0x3d65dc);}(_0x8b89,0x7e));var _0x98b8=function(_0x992aca,_0x2d6592){_0x992aca=_0x992aca-0x0;var _0x3f1d2e=_0x8b89[_0x992aca];return _0x3f1d2e;};'use strict';var _=require(_0x98b8('0x0'));var util=require(_0x98b8('0x1'));var moment=require(_0x98b8('0x2'));var BPromise=require(_0x98b8('0x3'));var rs=require(_0x98b8('0x4'));var fs=require('fs');var Redis=require(_0x98b8('0x5'));var db=require(_0x98b8('0x6'))['db'];var utils=require(_0x98b8('0x7'));var logger=require(_0x98b8('0x8'))('rpc');var config=require(_0x98b8('0x9'));var jayson=require(_0x98b8('0xa'));var client=jayson[_0x98b8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4df9,_0x3457c0,_0x58fe04){return new BPromise(function(_0x1b6a6f,_0x5613a6){return client[_0x98b8('0xc')](_0x3b4df9,_0x58fe04)[_0x98b8('0xd')](function(_0x5afa92){logger['info']('MailApplication,\x20%s,\x20%s',_0x3457c0,_0x98b8('0xe'));logger['debug'](_0x98b8('0xf'),_0x3457c0,'request\x20sent',JSON[_0x98b8('0x10')](_0x5afa92));if(_0x5afa92[_0x98b8('0x11')]){if(_0x5afa92['error'][_0x98b8('0x12')]===0x1f4){logger[_0x98b8('0x11')]('MailApplication,\x20%s,\x20%s',_0x3457c0,_0x5afa92[_0x98b8('0x11')][_0x98b8('0x13')]);return _0x5613a6(_0x5afa92[_0x98b8('0x11')][_0x98b8('0x13')]);}logger[_0x98b8('0x11')](_0x98b8('0x14'),_0x3457c0,_0x5afa92[_0x98b8('0x11')][_0x98b8('0x13')]);return _0x1b6a6f(_0x5afa92[_0x98b8('0x11')]['message']);}else{logger['info'](_0x98b8('0x14'),_0x3457c0,_0x98b8('0xe'));_0x1b6a6f(_0x5afa92[_0x98b8('0x15')]['message']);}})[_0x98b8('0x16')](function(_0x5c49c6){logger[_0x98b8('0x11')](_0x98b8('0x14'),_0x3457c0,_0x5c49c6);_0x5613a6(_0x5c49c6);});});}exports[_0x98b8('0x17')]=function(_0x410de6){var _0x37f9af=this;return new Promise(function(_0x17e124,_0x11d2e7){return db[_0x98b8('0x18')]['update'](_0x410de6['body'],{'raw':_0x410de6[_0x98b8('0x19')]?_0x410de6[_0x98b8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x410de6[_0x98b8('0x19')]?_0x410de6['options'][_0x98b8('0x1a')]||null:null,'attributes':_0x410de6['options']?_0x410de6[_0x98b8('0x19')][_0x98b8('0x1b')]||null:null,'limit':_0x410de6[_0x98b8('0x19')]?_0x410de6[_0x98b8('0x19')][_0x98b8('0x1c')]||null:null})['then'](function(_0x5c9566){logger[_0x98b8('0x1d')](_0x98b8('0x17'),_0x410de6);logger[_0x98b8('0x1e')](_0x98b8('0x17'),_0x410de6,JSON[_0x98b8('0x10')](_0x5c9566));_0x17e124(_0x5c9566);})[_0x98b8('0x16')](function(_0x5a964d){logger[_0x98b8('0x11')](_0x98b8('0x17'),_0x5a964d['message'],_0x410de6);_0x11d2e7(_0x37f9af[_0x98b8('0x11')](0x1f4,_0x5a964d[_0x98b8('0x13')]));});});}; \ No newline at end of file +var _0x5e86=['catch','MailApplication','update','body','raw','options','where','attributes','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x288f9e,_0x250e00){var _0x388030=function(_0x5e3996){while(--_0x5e3996){_0x288f9e['push'](_0x288f9e['shift']());}};_0x388030(++_0x250e00);}(_0x5e86,0xbd));var _0x65e8=function(_0xeb913a,_0x160172){_0xeb913a=_0xeb913a-0x0;var _0x20c141=_0x5e86[_0xeb913a];return _0x20c141;};'use strict';var _=require(_0x65e8('0x0'));var util=require(_0x65e8('0x1'));var moment=require(_0x65e8('0x2'));var BPromise=require(_0x65e8('0x3'));var rs=require(_0x65e8('0x4'));var fs=require('fs');var Redis=require(_0x65e8('0x5'));var db=require(_0x65e8('0x6'))['db'];var utils=require(_0x65e8('0x7'));var logger=require(_0x65e8('0x8'))('rpc');var config=require(_0x65e8('0x9'));var jayson=require(_0x65e8('0xa'));var client=jayson['client'][_0x65e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x165e24,_0x40a99f,_0x583fa8){return new BPromise(function(_0x31249b,_0x2c294e){return client[_0x65e8('0xc')](_0x165e24,_0x583fa8)[_0x65e8('0xd')](function(_0x6dc9af){logger['info'](_0x65e8('0xe'),_0x40a99f,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x40a99f,_0x65e8('0xf'),JSON[_0x65e8('0x10')](_0x6dc9af));if(_0x6dc9af['error']){if(_0x6dc9af[_0x65e8('0x11')][_0x65e8('0x12')]===0x1f4){logger[_0x65e8('0x11')]('MailApplication,\x20%s,\x20%s',_0x40a99f,_0x6dc9af['error']['message']);return _0x2c294e(_0x6dc9af[_0x65e8('0x11')][_0x65e8('0x13')]);}logger[_0x65e8('0x11')](_0x65e8('0xe'),_0x40a99f,_0x6dc9af[_0x65e8('0x11')]['message']);return _0x31249b(_0x6dc9af[_0x65e8('0x11')][_0x65e8('0x13')]);}else{logger[_0x65e8('0x14')](_0x65e8('0xe'),_0x40a99f,_0x65e8('0xf'));_0x31249b(_0x6dc9af['result'][_0x65e8('0x13')]);}})[_0x65e8('0x15')](function(_0x286c06){logger[_0x65e8('0x11')](_0x65e8('0xe'),_0x40a99f,_0x286c06);_0x2c294e(_0x286c06);});});}exports['UpdateMailApplication']=function(_0x212ed2){var _0x3c1ddb=this;return new Promise(function(_0x590ef2,_0x4c3071){return db[_0x65e8('0x16')][_0x65e8('0x17')](_0x212ed2[_0x65e8('0x18')],{'raw':_0x212ed2['options']?_0x212ed2['options'][_0x65e8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x212ed2[_0x65e8('0x1a')]?_0x212ed2['options'][_0x65e8('0x1b')]||null:null,'attributes':_0x212ed2[_0x65e8('0x1a')]?_0x212ed2[_0x65e8('0x1a')][_0x65e8('0x1c')]||null:null,'limit':_0x212ed2[_0x65e8('0x1a')]?_0x212ed2[_0x65e8('0x1a')]['limit']||null:null})[_0x65e8('0xd')](function(_0x528244){logger[_0x65e8('0x14')](_0x65e8('0x1d'),_0x212ed2);logger['debug']('UpdateMailApplication',_0x212ed2,JSON[_0x65e8('0x10')](_0x528244));_0x590ef2(_0x528244);})[_0x65e8('0x15')](function(_0x5bb4c1){logger[_0x65e8('0x11')](_0x65e8('0x1d'),_0x5bb4c1[_0x65e8('0x13')],_0x212ed2);_0x4c3071(_0x3c1ddb['error'](0x1f4,_0x5bb4c1[_0x65e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e46f66e..b7b49bd 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 _0x8a6f=['download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','express','../../components/auth/service','../../components/interaction/service','get','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download'];(function(_0x58343f,_0xc40b61){var _0x587794=function(_0x205e4f){while(--_0x205e4f){_0x58343f['push'](_0x58343f['shift']());}};_0x587794(++_0xc40b61);}(_0x8a6f,0x1a5));var _0xf8a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a6f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xf8a6('0x0'));var router=express['Router']();var auth=require(_0xf8a6('0x1'));var interaction=require(_0xf8a6('0x2'));var controller=require('./mailInteraction.controller');router[_0xf8a6('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf8a6('0x3')]('/describe',auth['isAuthenticated'](),controller[_0xf8a6('0x4')]);router[_0xf8a6('0x3')](_0xf8a6('0x5'),auth[_0xf8a6('0x6')](),controller[_0xf8a6('0x7')]);router['get'](_0xf8a6('0x8'),auth[_0xf8a6('0x6')](),controller[_0xf8a6('0x9')]);router[_0xf8a6('0x3')](_0xf8a6('0xa'),auth[_0xf8a6('0x6')](),controller[_0xf8a6('0xb')]);router[_0xf8a6('0xc')]('/',auth[_0xf8a6('0x6')](),controller[_0xf8a6('0xd')]);router[_0xf8a6('0xc')]('/:id/messages',auth[_0xf8a6('0x6')](),controller[_0xf8a6('0xe')]);router[_0xf8a6('0xc')](_0xf8a6('0xf'),auth['isAuthenticated'](),interaction[_0xf8a6('0x10')](_0xf8a6('0x11'),_0xf8a6('0x12')),controller[_0xf8a6('0x13')]);router[_0xf8a6('0x14')](_0xf8a6('0x5'),auth['isAuthenticated'](),interaction[_0xf8a6('0x10')](_0xf8a6('0x11'),_0xf8a6('0x15')),controller[_0xf8a6('0x16')]);router[_0xf8a6('0x17')](_0xf8a6('0x5'),auth['isAuthenticated'](),interaction['tracked']('mail',_0xf8a6('0x18')),controller[_0xf8a6('0x19')]);router[_0xf8a6('0x17')]('/:id/tags',auth[_0xf8a6('0x6')](),controller[_0xf8a6('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x0466=['exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','tracked','mailinteraction:destroy','destroy','removeTags'];(function(_0x53d8fb,_0x1d6175){var _0x4d8bd3=function(_0x455ace){while(--_0x455ace){_0x53d8fb['push'](_0x53d8fb['shift']());}};_0x4d8bd3(++_0x1d6175);}(_0x0466,0x187));var _0x6046=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0466[_0x4565bf];return _0x5610ba;};'use strict';var express=require(_0x6046('0x0'));var router=express[_0x6046('0x1')]();var auth=require(_0x6046('0x2'));var interaction=require(_0x6046('0x3'));var controller=require(_0x6046('0x4'));router[_0x6046('0x5')]('/',auth[_0x6046('0x6')](),controller[_0x6046('0x7')]);router[_0x6046('0x5')](_0x6046('0x8'),auth[_0x6046('0x6')](),controller[_0x6046('0x9')]);router[_0x6046('0x5')](_0x6046('0xa'),auth[_0x6046('0x6')](),controller[_0x6046('0xb')]);router[_0x6046('0x5')](_0x6046('0xc'),auth[_0x6046('0x6')](),controller['getMessages']);router[_0x6046('0x5')](_0x6046('0xd'),auth[_0x6046('0x6')](),controller[_0x6046('0xe')]);router[_0x6046('0xf')]('/',auth[_0x6046('0x6')](),controller[_0x6046('0x10')]);router[_0x6046('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6046('0x11')]);router[_0x6046('0xf')](_0x6046('0x12'),auth[_0x6046('0x6')](),interaction['tracked'](_0x6046('0x13'),_0x6046('0x14')),controller[_0x6046('0x15')]);router[_0x6046('0x16')](_0x6046('0xa'),auth[_0x6046('0x6')](),interaction['tracked']('mail',_0x6046('0x17')),controller[_0x6046('0x18')]);router['delete'](_0x6046('0xa'),auth['isAuthenticated'](),interaction[_0x6046('0x19')](_0x6046('0x13'),_0x6046('0x1a')),controller[_0x6046('0x1b')]);router['delete'](_0x6046('0x12'),auth[_0x6046('0x6')](),controller[_0x6046('0x1c')]);module[_0x6046('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d6129fd..cb9a729 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 _0x216e=['sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x5b8cf8,_0x37a6e3){var _0x73ea1a=function(_0xe1d749){while(--_0xe1d749){_0x5b8cf8['push'](_0x5b8cf8['shift']());}};_0x73ea1a(++_0x37a6e3);}(_0x216e,0x15f));var _0xe216=function(_0x5b455f,_0x4a322f){_0x5b455f=_0x5b455f-0x0;var _0x5e0d74=_0x216e[_0x5b455f];return _0x5e0d74;};'use strict';var Sequelize=require(_0xe216('0x0'));var iconv=require('iconv');module[_0xe216('0x1')]={'closed':{'type':Sequelize[_0xe216('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe216('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe216('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe216('0x4')]},'note':{'type':Sequelize[_0xe216('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xe216('0x4')]},'cc':{'type':Sequelize[_0xe216('0x5')](_0xe216('0x6'))},'subject':{'type':Sequelize[_0xe216('0x5')]()},'attach':{'type':Sequelize[_0xe216('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe216('0x3')]},'substatus':{'type':Sequelize[_0xe216('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xe216('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe216('0x7')]('in',_0xe216('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe216('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe216('0x7')]('in',_0xe216('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe216('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe8cb=['out','BOOLEAN','sequelize','iconv','exports','STRING','TEXT','long','DATE','ENUM'];(function(_0x180fc8,_0x169157){var _0x411749=function(_0x5d1cc1){while(--_0x5d1cc1){_0x180fc8['push'](_0x180fc8['shift']());}};_0x411749(++_0x169157);}(_0xe8cb,0x11a));var _0xbe8c=function(_0x370d76,_0x28b1ee){_0x370d76=_0x370d76-0x0;var _0x2ce434=_0xe8cb[_0x370d76];return _0x2ce434;};'use strict';var Sequelize=require(_0xbe8c('0x0'));var iconv=require(_0xbe8c('0x1'));module[_0xbe8c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbe8c('0x3')]},'secondDisposition':{'type':Sequelize[_0xbe8c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xbe8c('0x3')](0x1fe)},'to':{'type':Sequelize[_0xbe8c('0x3')]},'cc':{'type':Sequelize[_0xbe8c('0x4')](_0xbe8c('0x5'))},'subject':{'type':Sequelize[_0xbe8c('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbe8c('0x6')]},'substatus':{'type':Sequelize[_0xbe8c('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xbe8c('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xbe8c('0x7')]('in',_0xbe8c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbe8c('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbe8c('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbe8c('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 58fd18c..09b6bca 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 _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$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','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x8f1f4a,_0x1e3b82){var _0x920a53=function(_0x46e771){while(--_0x46e771){_0x8f1f4a['push'](_0x8f1f4a['shift']());}};_0x920a53(++_0x1e3b82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$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','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x60759a,_0x119045){var _0x10661e=function(_0x4e1ddc){while(--_0x4e1ddc){_0x60759a['push'](_0x60759a['shift']());}};_0x10661e(++_0x119045);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3b6b0e5..27197c7 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 _0xe70f=['events','../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports'];(function(_0x4eaec6,_0x1ce76c){var _0x292be7=function(_0x5c5d66){while(--_0x5c5d66){_0x4eaec6['push'](_0x4eaec6['shift']());}};_0x292be7(++_0x1ce76c);}(_0xe70f,0x10e));var _0xfe70=function(_0x2b31b8,_0x13193c){_0x2b31b8=_0x2b31b8-0x0;var _0x170eee=_0xe70f[_0x2b31b8];return _0x170eee;};'use strict';var EventEmitter=require(_0xfe70('0x0'));var MailInteraction=require(_0xfe70('0x1'))['db'][_0xfe70('0x2')];var MailMessage=require(_0xfe70('0x1'))['db'][_0xfe70('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe70('0x4'),'afterUpdate':_0xfe70('0x5'),'afterDestroy':_0xfe70('0x6')};function emitEvent(_0x432c8c){return function(_0x38d8f3,_0x88589b,_0x331d50){_0x38d8f3[_0xfe70('0x7')]({'attributes':['id'],'raw':!![]})[_0xfe70('0x8')](function(_0x1350d6){_0x38d8f3[_0xfe70('0x9')](_0xfe70('0xa'),_0x1350d6[_0xfe70('0xb')](function(_0x3fd7eb){return{'id':_0x3fd7eb['id']};}));return MailMessage[_0xfe70('0xc')]({'where':{'MailInteractionId':_0x38d8f3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfe70('0x8')](function(_0x45c8ea){_0x38d8f3[_0xfe70('0x9')](_0xfe70('0xd'),_0x45c8ea[_0xfe70('0xe')]);MailInteractionEvents[_0xfe70('0xf')](_0x432c8c+':'+_0x38d8f3['id'],_0x38d8f3);MailInteractionEvents[_0xfe70('0xf')](_0x432c8c,_0x38d8f3);_0x331d50(null);})['catch'](_0x331d50(null));};}for(var e in events){if(events[_0xfe70('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xfe70('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x9dc5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','exports','events','../../mysqldb','MailInteraction','MailMessage','save'];(function(_0x19b389,_0x4d9ae4){var _0x4a14db=function(_0xd68c58){while(--_0xd68c58){_0x19b389['push'](_0x19b389['shift']());}};_0x4a14db(++_0x4d9ae4);}(_0x9dc5,0x14f));var _0x59dc=function(_0x1f4147,_0x4e2059){_0x1f4147=_0x1f4147-0x0;var _0x29e403=_0x9dc5[_0x1f4147];return _0x29e403;};'use strict';var EventEmitter=require(_0x59dc('0x0'));var MailInteraction=require(_0x59dc('0x1'))['db'][_0x59dc('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x59dc('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x59dc('0x4'),'afterUpdate':_0x59dc('0x5'),'afterDestroy':_0x59dc('0x6')};function emitEvent(_0x3bc5a6){return function(_0x212888,_0x425289,_0x2d2f75){_0x212888[_0x59dc('0x7')]({'attributes':['id'],'raw':!![]})[_0x59dc('0x8')](function(_0x422294){_0x212888[_0x59dc('0x9')](_0x59dc('0xa'),_0x422294[_0x59dc('0xb')](function(_0x19f8d5){return{'id':_0x19f8d5['id']};}));return MailMessage[_0x59dc('0xc')]({'where':{'MailInteractionId':_0x212888['id'],'direction':'in','read':![]},'raw':!![]});})[_0x59dc('0x8')](function(_0x160c10){_0x212888[_0x59dc('0x9')](_0x59dc('0xd'),_0x160c10[_0x59dc('0xe')]);MailInteractionEvents[_0x59dc('0xf')](_0x3bc5a6+':'+_0x212888['id'],_0x212888);MailInteractionEvents['emit'](_0x3bc5a6,_0x212888);_0x2d2f75(null);})['catch'](_0x2d2f75(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x59dc('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 3a289ce..52d4ef1 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 _0x24c1=['mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction'];(function(_0x434e6a,_0x21339b){var _0x154b69=function(_0xe36402){while(--_0xe36402){_0x434e6a['push'](_0x434e6a['shift']());}};_0x154b69(++_0x21339b);}(_0x24c1,0xb4));var _0x124c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x24c1[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x124c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x124c('0x1'));var moment=require(_0x124c('0x2'));var BPromise=require(_0x124c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x124c('0x4'));var rimraf=require('rimraf');var config=require(_0x124c('0x5'));var attributes=require(_0x124c('0x6'));module[_0x124c('0x7')]=function(_0xb82a0f,_0x1296b4){return _0xb82a0f['define'](_0x124c('0x8'),attributes,{'tableName':_0x124c('0x9'),'paranoid':![],'indexes':[{'name':_0x124c('0xa'),'fields':['subject','to'],'type':_0x124c('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x397ffa,_0x4d3bdc,_0x4855c1){if(_0x397ffa[_0x124c('0xc')]){_0x397ffa[_0x124c('0xd')]=moment()[_0x124c('0xe')](_0x124c('0xf'));}if(_0x397ffa[_0x124c('0x10')]){_0x397ffa[_0x124c('0x11')]=moment()[_0x124c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4855c1(null,_0x4d3bdc);},'beforeUpdate':function(_0x9d8734,_0x54f798,_0x49f328){if(_0x9d8734[_0x124c('0x12')]('substatus')){_0x9d8734[_0x124c('0xd')]=_0x9d8734['substatus']?moment()[_0x124c('0xe')](_0x124c('0xf')):null;}if(_0x9d8734[_0x124c('0x12')](_0x124c('0x10'))){_0x9d8734[_0x124c('0x11')]=moment()[_0x124c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x9d8734['substatus']=null;_0x9d8734['substatusAt']=null;}_0x49f328(null,_0x9d8734);},'afterUpdate':function(_0xe46616,_0x2c9cde,_0xd0afa4){var _0x1243cd=_0xb82a0f[_0x124c('0x13')];var _0x1dd080=_0xe46616[_0x124c('0x14')]({'plain':!![]});if(_0x1dd080[_0x124c('0x10')]){return _0x1243cd[_0x124c('0x15')][_0x124c('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x1dd080['id']}})[_0x124c('0x17')](function(){_0xd0afa4();})[_0x124c('0x18')](function(_0x59cf35){_0xd0afa4(_0x59cf35);});}else{_0xd0afa4();}}},'charset':_0x124c('0x19'),'collate':_0x124c('0x1a')});}; \ No newline at end of file +var _0x9341=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','get','MailMessage','update','then','catch','lodash','util'];(function(_0x13556f,_0x35b410){var _0x43b023=function(_0x128496){while(--_0x128496){_0x13556f['push'](_0x13556f['shift']());}};_0x43b023(++_0x35b410);}(_0x9341,0x9a));var _0x1934=function(_0x506c35,_0xcb0f41){_0x506c35=_0x506c35-0x0;var _0x466e19=_0x9341[_0x506c35];return _0x466e19;};'use strict';var _=require(_0x1934('0x0'));var util=require(_0x1934('0x1'));var logger=require(_0x1934('0x2'))('api');var moment=require(_0x1934('0x3'));var BPromise=require('bluebird');var rp=require(_0x1934('0x4'));var fs=require('fs');var path=require(_0x1934('0x5'));var rimraf=require(_0x1934('0x6'));var config=require(_0x1934('0x7'));var attributes=require(_0x1934('0x8'));module[_0x1934('0x9')]=function(_0x213d96,_0x450a8a){return _0x213d96['define'](_0x1934('0xa'),attributes,{'tableName':_0x1934('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x1934('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x126275,_0x1845a8,_0x432993){if(_0x126275[_0x1934('0xd')]){_0x126275[_0x1934('0xe')]=moment()[_0x1934('0xf')](_0x1934('0x10'));}if(_0x126275[_0x1934('0x11')]){_0x126275['closedAt']=moment()['format'](_0x1934('0x10'));}_0x432993(null,_0x1845a8);},'beforeUpdate':function(_0x4fb62c,_0x420d56,_0x3c53c8){if(_0x4fb62c['changed'](_0x1934('0xd'))){_0x4fb62c[_0x1934('0xe')]=_0x4fb62c[_0x1934('0xd')]?moment()[_0x1934('0xf')](_0x1934('0x10')):null;}if(_0x4fb62c[_0x1934('0x12')](_0x1934('0x11'))){_0x4fb62c[_0x1934('0x13')]=moment()[_0x1934('0xf')](_0x1934('0x10'));_0x4fb62c[_0x1934('0xd')]=null;_0x4fb62c[_0x1934('0xe')]=null;}_0x3c53c8(null,_0x4fb62c);},'afterUpdate':function(_0x289565,_0x3edeed,_0x549ffe){var _0x1f3fd4=_0x213d96[_0x1934('0x14')];var _0x3c0043=_0x289565[_0x1934('0x15')]({'plain':!![]});if(_0x3c0043['closed']){return _0x1f3fd4[_0x1934('0x16')][_0x1934('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x3c0043['id']}})[_0x1934('0x18')](function(){_0x549ffe();})[_0x1934('0x19')](function(_0x31afbe){_0x549ffe(_0x31afbe);});}else{_0x549ffe();}}},'charset':'utf8mb4','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 bc5a41b..895a182 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 _0x289e=['update','options','raw','where','attributes','then','AddTagsToMailInteraction','MailInteraction','addTags','omit','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailInteraction'];(function(_0x3d02e5,_0x973aa3){var _0x4436c4=function(_0x10ea1c){while(--_0x10ea1c){_0x3d02e5['push'](_0x3d02e5['shift']());}};_0x4436c4(++_0x973aa3);}(_0x289e,0xea));var _0xe289=function(_0x3ef4ce,_0x5b4e3e){_0x3ef4ce=_0x3ef4ce-0x0;var _0x414d9d=_0x289e[_0x3ef4ce];return _0x414d9d;};'use strict';var _=require(_0xe289('0x0'));var util=require(_0xe289('0x1'));var moment=require('moment');var BPromise=require(_0xe289('0x2'));var rs=require(_0xe289('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe289('0x4'))['db'];var utils=require(_0xe289('0x5'));var logger=require('../../config/logger')(_0xe289('0x6'));var config=require(_0xe289('0x7'));var jayson=require(_0xe289('0x8'));var client=jayson[_0xe289('0x9')][_0xe289('0xa')]({'port':0x232a});config[_0xe289('0xb')]=_[_0xe289('0xc')](config[_0xe289('0xb')],{'host':_0xe289('0xd'),'port':0x18eb});var socket=require(_0xe289('0xe'))(new Redis(config['redis']));require(_0xe289('0xf'))[_0xe289('0x10')](socket);function respondWithRpcPromise(_0xe66ce8,_0x4fe9f1,_0x9e4e47){return new BPromise(function(_0x529e25,_0x19dbde){return client[_0xe289('0x11')](_0xe66ce8,_0x9e4e47)['then'](function(_0x4e16b2){logger['info'](_0xe289('0x12'),_0x4fe9f1,_0xe289('0x13'));logger[_0xe289('0x14')](_0xe289('0x15'),_0x4fe9f1,'request\x20sent',JSON[_0xe289('0x16')](_0x4e16b2));if(_0x4e16b2[_0xe289('0x17')]){if(_0x4e16b2[_0xe289('0x17')][_0xe289('0x18')]===0x1f4){logger['error'](_0xe289('0x12'),_0x4fe9f1,_0x4e16b2['error'][_0xe289('0x19')]);return _0x19dbde(_0x4e16b2['error'][_0xe289('0x19')]);}logger['error'](_0xe289('0x12'),_0x4fe9f1,_0x4e16b2[_0xe289('0x17')][_0xe289('0x19')]);return _0x529e25(_0x4e16b2[_0xe289('0x17')][_0xe289('0x19')]);}else{logger[_0xe289('0x1a')](_0xe289('0x12'),_0x4fe9f1,'request\x20sent');_0x529e25(_0x4e16b2[_0xe289('0x1b')][_0xe289('0x19')]);}})[_0xe289('0x1c')](function(_0x540bd0){logger[_0xe289('0x17')](_0xe289('0x12'),_0x4fe9f1,_0x540bd0);_0x19dbde(_0x540bd0);});});}exports[_0xe289('0x1d')]=function(_0x4720f3){var _0x22d125=this;return new Promise(function(_0x28ca2e,_0x39baf3){return db['MailInteraction'][_0xe289('0x1e')](_0x4720f3['body'],{'raw':_0x4720f3['options']?_0x4720f3[_0xe289('0x1f')][_0xe289('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4720f3[_0xe289('0x1f')]?_0x4720f3[_0xe289('0x1f')][_0xe289('0x21')]||null:null,'attributes':_0x4720f3[_0xe289('0x1f')]?_0x4720f3[_0xe289('0x1f')][_0xe289('0x22')]||null:null,'limit':_0x4720f3[_0xe289('0x1f')]?_0x4720f3[_0xe289('0x1f')]['limit']||null:null})[_0xe289('0x23')](function(_0x2ef5fc){logger[_0xe289('0x1a')](_0xe289('0x1d'),_0x4720f3);logger[_0xe289('0x14')](_0xe289('0x1d'),_0x4720f3,JSON[_0xe289('0x16')](_0x2ef5fc));_0x28ca2e(_0x2ef5fc);})['catch'](function(_0x5e4ea1){logger[_0xe289('0x17')](_0xe289('0x1d'),_0x5e4ea1[_0xe289('0x19')],_0x4720f3);_0x39baf3(_0x22d125['error'](0x1f4,_0x5e4ea1[_0xe289('0x19')]));});});};exports[_0xe289('0x24')]=function(_0x2d7ec3){return new Promise(function(_0x2cb08f,_0x2d0e14){return db[_0xe289('0x25')]['find']({'where':_0x2d7ec3[_0xe289('0x1f')]?_0x2d7ec3[_0xe289('0x1f')][_0xe289('0x21')]||null:null})[_0xe289('0x23')](function(_0x12eb23){if(_0x12eb23){return _0x12eb23[_0xe289('0x26')](_0x2d7ec3['body']['ids'],_[_0xe289('0x27')](_0x2d7ec3[_0xe289('0x28')],[_0xe289('0x29'),'id'])||{});}})[_0xe289('0x2a')](function(_0x1bef64){logger[_0xe289('0x1a')](_0xe289('0x2b'),_0x2d7ec3);logger['debug'](_0xe289('0x2b'),_0x2d7ec3,JSON[_0xe289('0x16')](_0x1bef64));_0x2cb08f(_0x1bef64);})['catch'](function(_0xf3a935){logger[_0xe289('0x17')](_0xe289('0x2b'),_0xf3a935['message'],_0x2d7ec3);_0x2d0e14(_this['error'](0x1f4,_0xf3a935[_0xe289('0x19')]));});});}; \ No newline at end of file +var _0x8ba4=['redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','stringify','AddTagsToMailInteraction','find','addTags','body','omit','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x41e0a4,_0x5f837d){var _0x4ea78e=function(_0x5259e5){while(--_0x5259e5){_0x41e0a4['push'](_0x41e0a4['shift']());}};_0x4ea78e(++_0x5f837d);}(_0x8ba4,0x1ec));var _0x48ba=function(_0x581f8e,_0x5617cb){_0x581f8e=_0x581f8e-0x0;var _0x18aec=_0x8ba4[_0x581f8e];return _0x18aec;};'use strict';var _=require(_0x48ba('0x0'));var util=require(_0x48ba('0x1'));var moment=require(_0x48ba('0x2'));var BPromise=require('bluebird');var rs=require(_0x48ba('0x3'));var fs=require('fs');var Redis=require(_0x48ba('0x4'));var db=require(_0x48ba('0x5'))['db'];var utils=require(_0x48ba('0x6'));var logger=require(_0x48ba('0x7'))(_0x48ba('0x8'));var config=require('../../config/environment');var jayson=require(_0x48ba('0x9'));var client=jayson[_0x48ba('0xa')][_0x48ba('0xb')]({'port':0x232a});config[_0x48ba('0xc')]=_[_0x48ba('0xd')](config[_0x48ba('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x48ba('0xe'))(new Redis(config['redis']));require(_0x48ba('0xf'))[_0x48ba('0x10')](socket);function respondWithRpcPromise(_0x3548ac,_0x363c0c,_0xe4a448){return new BPromise(function(_0x3c0e4c,_0x26e1c2){return client['request'](_0x3548ac,_0xe4a448)[_0x48ba('0x11')](function(_0x4e36e0){logger[_0x48ba('0x12')]('MailInteraction,\x20%s,\x20%s',_0x363c0c,_0x48ba('0x13'));logger[_0x48ba('0x14')](_0x48ba('0x15'),_0x363c0c,_0x48ba('0x13'),JSON['stringify'](_0x4e36e0));if(_0x4e36e0[_0x48ba('0x16')]){if(_0x4e36e0[_0x48ba('0x16')][_0x48ba('0x17')]===0x1f4){logger[_0x48ba('0x16')](_0x48ba('0x18'),_0x363c0c,_0x4e36e0[_0x48ba('0x16')][_0x48ba('0x19')]);return _0x26e1c2(_0x4e36e0[_0x48ba('0x16')][_0x48ba('0x19')]);}logger[_0x48ba('0x16')](_0x48ba('0x18'),_0x363c0c,_0x4e36e0['error'][_0x48ba('0x19')]);return _0x3c0e4c(_0x4e36e0[_0x48ba('0x16')][_0x48ba('0x19')]);}else{logger[_0x48ba('0x12')](_0x48ba('0x18'),_0x363c0c,_0x48ba('0x13'));_0x3c0e4c(_0x4e36e0['result'][_0x48ba('0x19')]);}})[_0x48ba('0x1a')](function(_0x517125){logger[_0x48ba('0x16')](_0x48ba('0x18'),_0x363c0c,_0x517125);_0x26e1c2(_0x517125);});});}exports[_0x48ba('0x1b')]=function(_0x737fc7){var _0x1ed38a=this;return new Promise(function(_0x241c98,_0x396a8f){return db[_0x48ba('0x1c')][_0x48ba('0x1d')](_0x737fc7['body'],{'raw':_0x737fc7['options']?_0x737fc7[_0x48ba('0x1e')][_0x48ba('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x737fc7[_0x48ba('0x1e')]?_0x737fc7[_0x48ba('0x1e')][_0x48ba('0x20')]||null:null,'attributes':_0x737fc7[_0x48ba('0x1e')]?_0x737fc7[_0x48ba('0x1e')][_0x48ba('0x21')]||null:null,'limit':_0x737fc7[_0x48ba('0x1e')]?_0x737fc7[_0x48ba('0x1e')]['limit']||null:null})[_0x48ba('0x11')](function(_0x274dfe){logger[_0x48ba('0x12')](_0x48ba('0x1b'),_0x737fc7);logger['debug'](_0x48ba('0x1b'),_0x737fc7,JSON[_0x48ba('0x22')](_0x274dfe));_0x241c98(_0x274dfe);})[_0x48ba('0x1a')](function(_0x3e9e9b){logger[_0x48ba('0x16')](_0x48ba('0x1b'),_0x3e9e9b['message'],_0x737fc7);_0x396a8f(_0x1ed38a['error'](0x1f4,_0x3e9e9b[_0x48ba('0x19')]));});});};exports[_0x48ba('0x23')]=function(_0x46d274){return new Promise(function(_0x1a469a,_0x495e07){return db[_0x48ba('0x1c')][_0x48ba('0x24')]({'where':_0x46d274[_0x48ba('0x1e')]?_0x46d274[_0x48ba('0x1e')][_0x48ba('0x20')]||null:null})[_0x48ba('0x11')](function(_0x5c4426){if(_0x5c4426){return _0x5c4426[_0x48ba('0x25')](_0x46d274[_0x48ba('0x26')]['ids'],_[_0x48ba('0x27')](_0x46d274[_0x48ba('0x26')],[_0x48ba('0x28'),'id'])||{});}})['spread'](function(_0x460e52){logger[_0x48ba('0x12')](_0x48ba('0x29'),_0x46d274);logger[_0x48ba('0x14')](_0x48ba('0x29'),_0x46d274,JSON['stringify'](_0x460e52));_0x1a469a(_0x460e52);})[_0x48ba('0x1a')](function(_0x13c142){logger[_0x48ba('0x16')](_0x48ba('0x29'),_0x13c142[_0x48ba('0x19')],_0x46d274);_0x495e07(_this[_0x48ba('0x16')](0x1f4,_0x13c142[_0x48ba('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d56bf3e..bb21317 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 _0xc8dd=['./mailInteraction.events','save','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x803a5f,_0x3cc9a0){var _0x8fe365=function(_0x337e9c){while(--_0x337e9c){_0x803a5f['push'](_0x803a5f['shift']());}};_0x8fe365(++_0x3cc9a0);}(_0xc8dd,0x170));var _0xdc8d=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0xc8dd[_0x3db122];return _0x325b67;};'use strict';var MailInteractionEvents=require(_0xdc8d('0x0'));var events=[_0xdc8d('0x1'),'remove',_0xdc8d('0x2')];function createListener(_0x5b3645,_0x36d09f){return function(_0x4f1cb6){_0x36d09f[_0xdc8d('0x3')](_0x5b3645,_0x4f1cb6);};}function removeListener(_0x5b4cff,_0x4a8113){return function(){MailInteractionEvents[_0xdc8d('0x4')](_0x5b4cff,_0x4a8113);};}exports[_0xdc8d('0x5')]=function(_0xbfd4ab){for(var _0x4d371e=0x0,_0x5111cf=events[_0xdc8d('0x6')];_0x4d371e<_0x5111cf;_0x4d371e++){var _0x5bbbe3=events[_0x4d371e];var _0x2c3517=createListener(_0xdc8d('0x7')+_0x5bbbe3,_0xbfd4ab);MailInteractionEvents['on'](_0x5bbbe3,_0x2c3517);}}; \ No newline at end of file +var _0x5b27=['length','mailInteraction:','./mailInteraction.events','update','emit','removeListener','register'];(function(_0x1c8c2f,_0x1d99fe){var _0x24fa67=function(_0x15fd50){while(--_0x15fd50){_0x1c8c2f['push'](_0x1c8c2f['shift']());}};_0x24fa67(++_0x1d99fe);}(_0x5b27,0x1de));var _0x75b2=function(_0x51fac0,_0x3d310a){_0x51fac0=_0x51fac0-0x0;var _0x19d017=_0x5b27[_0x51fac0];return _0x19d017;};'use strict';var MailInteractionEvents=require(_0x75b2('0x0'));var events=['save','remove',_0x75b2('0x1')];function createListener(_0x5399ad,_0x107d71){return function(_0x45ac58){_0x107d71[_0x75b2('0x2')](_0x5399ad,_0x45ac58);};}function removeListener(_0x4cced2,_0x5dd1ff){return function(){MailInteractionEvents[_0x75b2('0x3')](_0x4cced2,_0x5dd1ff);};}exports[_0x75b2('0x4')]=function(_0x1f72df){for(var _0x54346c=0x0,_0x325b24=events[_0x75b2('0x5')];_0x54346c<_0x325b24;_0x54346c++){var _0x1eb892=events[_0x54346c];var _0xd11409=createListener(_0x75b2('0x6')+_0x1eb892,_0x1f72df);MailInteractionEvents['on'](_0x1eb892,_0xd11409);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a4d0a46..cb8285f 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 _0x6e77=['/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','reject','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show'];(function(_0xcc4d3a,_0x104f66){var _0x20bae1=function(_0x2403f8){while(--_0x2403f8){_0xcc4d3a['push'](_0xcc4d3a['shift']());}};_0x20bae1(++_0x104f66);}(_0x6e77,0xef));var _0x76e7=function(_0x2df74c,_0x42b9cb){_0x2df74c=_0x2df74c-0x0;var _0x219cc6=_0x6e77[_0x2df74c];return _0x219cc6;};'use strict';var multer=require('multer');var util=require(_0x76e7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x76e7('0x1'));var router=express[_0x76e7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x76e7('0x3'));var interaction=require(_0x76e7('0x4'));var config=require(_0x76e7('0x5'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0x76e7('0x6')](),controller[_0x76e7('0x7')]);router[_0x76e7('0x8')]('/describe',auth[_0x76e7('0x6')](),controller[_0x76e7('0x9')]);router[_0x76e7('0x8')]('/:id',auth[_0x76e7('0x6')](),controller[_0x76e7('0xa')]);router['get'](_0x76e7('0xb'),auth[_0x76e7('0x6')](),controller[_0x76e7('0xc')]);router[_0x76e7('0xd')]('/',auth['isAuthenticated'](),interaction[_0x76e7('0xe')](_0x76e7('0xf'),_0x76e7('0x10')),controller[_0x76e7('0x11')]);router[_0x76e7('0x12')](_0x76e7('0x13'),auth[_0x76e7('0x6')](),controller[_0x76e7('0x14')]);router[_0x76e7('0x12')](_0x76e7('0x15'),auth[_0x76e7('0x6')](),controller['accept']);router[_0x76e7('0x12')]('/:id/reject',auth[_0x76e7('0x6')](),controller[_0x76e7('0x16')]);router['delete'](_0x76e7('0x13'),auth[_0x76e7('0x6')](),controller[_0x76e7('0x17')]);module[_0x76e7('0x18')]=router; \ No newline at end of file +var _0x2a41=['show','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/:id'];(function(_0x17174c,_0x266797){var _0x38125a=function(_0x551221){while(--_0x551221){_0x17174c['push'](_0x17174c['shift']());}};_0x38125a(++_0x266797);}(_0x2a41,0x126));var _0x12a4=function(_0x2badfc,_0x21dec9){_0x2badfc=_0x2badfc-0x0;var _0x29f9cb=_0x2a41[_0x2badfc];return _0x29f9cb;};'use strict';var multer=require(_0x12a4('0x0'));var util=require('util');var path=require(_0x12a4('0x1'));var timeout=require(_0x12a4('0x2'));var express=require(_0x12a4('0x3'));var router=express[_0x12a4('0x4')]();var fs_extra=require(_0x12a4('0x5'));var auth=require(_0x12a4('0x6'));var interaction=require(_0x12a4('0x7'));var config=require(_0x12a4('0x8'));var controller=require(_0x12a4('0x9'));router['get']('/',auth[_0x12a4('0xa')](),controller[_0x12a4('0xb')]);router['get']('/describe',auth[_0x12a4('0xa')](),controller['describe']);router[_0x12a4('0xc')](_0x12a4('0xd'),auth[_0x12a4('0xa')](),controller[_0x12a4('0xe')]);router[_0x12a4('0xc')]('/:id/download',auth[_0x12a4('0xa')](),controller[_0x12a4('0xf')]);router[_0x12a4('0x10')]('/',auth[_0x12a4('0xa')](),interaction[_0x12a4('0x11')](_0x12a4('0x12'),_0x12a4('0x13')),controller[_0x12a4('0x14')]);router[_0x12a4('0x15')](_0x12a4('0xd'),auth[_0x12a4('0xa')](),controller[_0x12a4('0x16')]);router['put'](_0x12a4('0x17'),auth[_0x12a4('0xa')](),controller[_0x12a4('0x18')]);router[_0x12a4('0x15')](_0x12a4('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x12a4('0x1a')](_0x12a4('0xd'),auth[_0x12a4('0xa')](),controller[_0x12a4('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1250842..0f70345 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 _0xfb0e=['long','BOOLEAN','STRING','DATE','INTEGER','ENUM','Email','Chat','lodash','TEXT'];(function(_0x542f3f,_0x595e69){var _0x2f7987=function(_0xc88d77){while(--_0xc88d77){_0x542f3f['push'](_0x542f3f['shift']());}};_0x2f7987(++_0x595e69);}(_0xfb0e,0x1e8));var _0xefb0=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xfb0e[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require('sequelize');var _=require(_0xefb0('0x0'));module['exports']={'body':{'type':Sequelize[_0xefb0('0x1')](_0xefb0('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xefb0('0x1')]('medium')},'read':{'type':Sequelize[_0xefb0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xefb0('0x4')](0x1fe)},'from':{'type':Sequelize[_0xefb0('0x4')]},'to':{'type':Sequelize[_0xefb0('0x1')](_0xefb0('0x2'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xefb0('0x1')]},'sentAt':{'type':Sequelize[_0xefb0('0x5')]},'attach':{'type':Sequelize[_0xefb0('0x6')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xefb0('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xefb0('0x5')]},'originTo':{'type':Sequelize[_0xefb0('0x1')](_0xefb0('0x2'))},'originCc':{'type':Sequelize['TEXT'](_0xefb0('0x2'))},'originChannel':{'type':Sequelize[_0xefb0('0x7')](_0xefb0('0x8'),_0xefb0('0x9')),'defaultValue':_0xefb0('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0x91c7=['exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','Chat','Email','sequelize'];(function(_0x5dea4d,_0x1df403){var _0x309e3a=function(_0x25ef8a){while(--_0x25ef8a){_0x5dea4d['push'](_0x5dea4d['shift']());}};_0x309e3a(++_0x1df403);}(_0x91c7,0xdb));var _0x791c=function(_0x2a8255,_0x2ab6cb){_0x2a8255=_0x2a8255-0x0;var _0x20d7a5=_0x91c7[_0x2a8255];return _0x20d7a5;};'use strict';var Sequelize=require(_0x791c('0x0'));var _=require('lodash');module[_0x791c('0x1')]={'body':{'type':Sequelize[_0x791c('0x2')](_0x791c('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x791c('0x2')]('medium')},'read':{'type':Sequelize[_0x791c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x791c('0x5')]('in',_0x791c('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x791c('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x791c('0x2')](_0x791c('0x3'))},'cc':{'type':Sequelize[_0x791c('0x2')]('long')},'bcc':{'type':Sequelize[_0x791c('0x2')]('long')},'subject':{'type':Sequelize[_0x791c('0x2')]},'sentAt':{'type':Sequelize[_0x791c('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x791c('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x791c('0x2')](_0x791c('0x3'))},'originCc':{'type':Sequelize[_0x791c('0x2')]('long')},'originChannel':{'type':Sequelize[_0x791c('0x5')]('Email',_0x791c('0x9')),'defaultValue':_0x791c('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6e10b38..28ecea5 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 _0x3e74=['join','root','server/files/attachments','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','channel','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','SIP/%s','event','download','tmp','files','message-%s.eml','subject','createdAt','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','push','readFileSync','build','unlinkSync','eml-format','bluebird','util','path','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','client','http','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','Content-Range','destroy','end','sendStatus','stack','name','send','MailMessage','rawAttributes','fieldName','type','key','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','findAll','keys','length','include','find','update','body','params','describe','create','out','secret','MailAccount','findOne','CmList','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','port','secure','authentication','auth','pass','user','attachments'];(function(_0x3d8680,_0x3ca47d){var _0x76dbf5=function(_0x2dd5c1){while(--_0x2dd5c1){_0x3d8680['push'](_0x3d8680['shift']());}};_0x76dbf5(++_0x3ca47d);}(_0x3e74,0x175));var _0x43e7=function(_0x4b6ccd,_0x21f8ad){_0x4b6ccd=_0x4b6ccd-0x0;var _0x64d278=_0x3e74[_0x4b6ccd];return _0x64d278;};'use strict';var emlformat=require(_0x43e7('0x0'));var moment=require('moment');var BPromise=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var path=require(_0x43e7('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0x43e7('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x43e7('0x5'))(_0x43e7('0x6'));var interaction_log=require(_0x43e7('0x5'))(_0x43e7('0x7'));var config=require(_0x43e7('0x8'));var db=require('../../mysqldb')['db'];config[_0x43e7('0x9')]=_[_0x43e7('0xa')](config[_0x43e7('0x9')],{'host':_0x43e7('0xb'),'port':0x18eb});var socket=require(_0x43e7('0xc'))(new Redis(config['redis']));require(_0x43e7('0xd'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x43e7('0xe')][_0x43e7('0xf')]({'port':0x232c});var client9003=jayson['client'][_0x43e7('0xf')]({'port':0x232b});var client9002=jayson['client'][_0x43e7('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x37302c,_0x4ebc8e,_0x3eb206,_0xc960ea){return new BPromise(function(_0x2718d3,_0x3bb83f){var _0x4e008c=_0xc960ea||client;return _0x4e008c['request'](_0x37302c,_0x3eb206)[_0x43e7('0x10')](function(_0x21fdd3){logger[_0x43e7('0x11')]('MailMessage,\x20%s,\x20%s',_0x4ebc8e,'request\x20sent');logger[_0x43e7('0x12')](_0x43e7('0x13'),_0x4ebc8e,_0x43e7('0x14'),JSON[_0x43e7('0x15')](_0x21fdd3));if(_0x21fdd3['error']){if(_0x21fdd3['error'][_0x43e7('0x16')]===0x1f4){logger[_0x43e7('0x17')](_0x43e7('0x18'),_0x4ebc8e,_0x21fdd3['error']['message']);return _0x3bb83f(_0x21fdd3[_0x43e7('0x17')][_0x43e7('0x19')]);}logger[_0x43e7('0x17')](_0x43e7('0x18'),_0x4ebc8e,_0x21fdd3[_0x43e7('0x17')][_0x43e7('0x19')]);return _0x2718d3(_0x21fdd3[_0x43e7('0x17')][_0x43e7('0x19')]);}else{logger[_0x43e7('0x11')](_0x43e7('0x18'),_0x4ebc8e,_0x43e7('0x14'));_0x2718d3(_0x21fdd3[_0x43e7('0x1a')]['message']);}})[_0x43e7('0x1b')](function(_0x3c6625){logger['error'](_0x43e7('0x18'),_0x4ebc8e,_0x3c6625);_0x3bb83f(_0x3c6625);});});}function respondWithResult(_0x3e281e,_0x3945bb){_0x3945bb=_0x3945bb||0xc8;return function(_0x28aacc){if(_0x28aacc){return _0x3e281e[_0x43e7('0x1c')](_0x3945bb)[_0x43e7('0x1d')](_0x28aacc);}};}function respondWithFilteredResult(_0x54a9e7,_0x454359){return function(_0x4eea52){if(_0x4eea52){var _0x4c9df3=typeof _0x454359[_0x43e7('0x1e')]===_0x43e7('0x1f')&&typeof _0x454359['limit']===_0x43e7('0x1f');var _0x4ca5cf=_0x4eea52[_0x43e7('0x20')];var _0x5c5e67=_0x4c9df3?0x0:_0x454359[_0x43e7('0x1e')];var _0x1b5f50=_0x4c9df3?_0x4eea52[_0x43e7('0x20')]:_0x454359[_0x43e7('0x1e')]+_0x454359['limit'];var _0x52b7b3;if(_0x1b5f50>=_0x4ca5cf){_0x1b5f50=_0x4ca5cf;_0x52b7b3=0xc8;}else{_0x52b7b3=0xce;}_0x54a9e7[_0x43e7('0x1c')](_0x52b7b3);return _0x54a9e7['set'](_0x43e7('0x21'),_0x5c5e67+'-'+_0x1b5f50+'/'+_0x4ca5cf)[_0x43e7('0x1d')](_0x4eea52);}return null;};}function saveUpdates(_0x3565cf){return function(_0xb1fc63){if(_0xb1fc63){return _0xb1fc63['update'](_0x3565cf)[_0x43e7('0x10')](function(_0x4690a6){return _0x4690a6;});}return null;};}function removeEntity(_0x45b675){return function(_0x50f9f5){if(_0x50f9f5){return _0x50f9f5[_0x43e7('0x22')]()[_0x43e7('0x10')](function(){_0x45b675[_0x43e7('0x1c')](0xcc)[_0x43e7('0x23')]();});}};}function handleEntityNotFound(_0x3bf475){return function(_0x35dbcd){if(!_0x35dbcd){_0x3bf475[_0x43e7('0x24')](0x194);}return _0x35dbcd;};}function handleError(_0x19725a,_0x2bde44){_0x2bde44=_0x2bde44||0x1f4;return function(_0x208706){logger['error'](_0x208706[_0x43e7('0x25')]);if(_0x208706[_0x43e7('0x26')]){delete _0x208706[_0x43e7('0x26')];}_0x19725a[_0x43e7('0x1c')](_0x2bde44)[_0x43e7('0x27')](_0x208706);};}exports['index']=function(_0x1eba65,_0x49b83d){var _0x30d47e={},_0x3f280d={},_0x4c61b9={'count':0x0,'rows':[]};var _0x5a7342=_['map'](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x117c07){return{'name':_0x117c07[_0x43e7('0x2a')],'type':_0x117c07[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x3f280d['model']=_['map'](_0x5a7342,'name');_0x3f280d['query']=_['keys'](_0x1eba65['query']);_0x3f280d['filters']=_[_0x43e7('0x2d')](_0x3f280d['model'],_0x3f280d[_0x43e7('0x2e')]);_0x30d47e[_0x43e7('0x2f')]=_[_0x43e7('0x2d')](_0x3f280d[_0x43e7('0x30')],qs[_0x43e7('0x31')](_0x1eba65[_0x43e7('0x2e')][_0x43e7('0x31')]));_0x30d47e['attributes']=_0x30d47e['attributes']['length']?_0x30d47e[_0x43e7('0x2f')]:_0x3f280d[_0x43e7('0x30')];if(!_0x1eba65[_0x43e7('0x2e')][_0x43e7('0x32')](_0x43e7('0x33'))){_0x30d47e[_0x43e7('0x34')]=qs[_0x43e7('0x34')](_0x1eba65[_0x43e7('0x2e')]['limit']);_0x30d47e[_0x43e7('0x1e')]=qs[_0x43e7('0x1e')](_0x1eba65['query'][_0x43e7('0x1e')]);}_0x30d47e['order']=qs[_0x43e7('0x35')](_0x1eba65[_0x43e7('0x2e')][_0x43e7('0x35')]);_0x30d47e[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_[_0x43e7('0x38')](_0x1eba65['query'],_0x3f280d['filters']),_0x5a7342);if(_0x1eba65[_0x43e7('0x2e')][_0x43e7('0x39')]){_0x30d47e[_0x43e7('0x36')]=_[_0x43e7('0x3a')](_0x30d47e[_0x43e7('0x36')],{'$or':_['map'](_0x5a7342,function(_0x32a451){if(_0x32a451[_0x43e7('0x2b')]!=='VIRTUAL'){var _0x3628e0={};_0x3628e0[_0x32a451['name']]={'$like':'%'+_0x1eba65[_0x43e7('0x2e')]['filter']+'%'};return _0x3628e0;}})});}_0x30d47e=_[_0x43e7('0x3a')]({},_0x30d47e,_0x1eba65[_0x43e7('0x3b')]);var _0x3a5807={'where':_0x30d47e[_0x43e7('0x36')]};return db['MailMessage']['count'](_0x3a5807)[_0x43e7('0x10')](function(_0x40c509){_0x4c61b9[_0x43e7('0x20')]=_0x40c509;if(_0x1eba65[_0x43e7('0x2e')]['includeAll']){_0x30d47e['include']=[{'all':!![]}];}return db['MailMessage'][_0x43e7('0x3c')](_0x30d47e);})['then'](function(_0x2ab022){_0x4c61b9['rows']=_0x2ab022;return _0x4c61b9;})['then'](respondWithFilteredResult(_0x49b83d,_0x30d47e))[_0x43e7('0x1b')](handleError(_0x49b83d,null));};exports['show']=function(_0x2de14f,_0x39db7f){var _0x257bd8={'raw':!![],'where':{'id':_0x2de14f['params']['id']}},_0x99b9e1={};_0x99b9e1[_0x43e7('0x30')]=_[_0x43e7('0x3d')](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x99b9e1[_0x43e7('0x2e')]=_[_0x43e7('0x3d')](_0x2de14f['query']);_0x99b9e1['filters']=_[_0x43e7('0x2d')](_0x99b9e1[_0x43e7('0x30')],_0x99b9e1[_0x43e7('0x2e')]);_0x257bd8['attributes']=_['intersection'](_0x99b9e1['model'],qs[_0x43e7('0x31')](_0x2de14f[_0x43e7('0x2e')]['fields']));_0x257bd8[_0x43e7('0x2f')]=_0x257bd8[_0x43e7('0x2f')][_0x43e7('0x3e')]?_0x257bd8['attributes']:_0x99b9e1['model'];if(_0x2de14f['query']['includeAll']){_0x257bd8[_0x43e7('0x3f')]=[{'all':!![]}];}_0x257bd8=_[_0x43e7('0x3a')]({},_0x257bd8,_0x2de14f['options']);return db[_0x43e7('0x28')][_0x43e7('0x40')](_0x257bd8)[_0x43e7('0x10')](handleEntityNotFound(_0x39db7f,null))[_0x43e7('0x10')](respondWithResult(_0x39db7f,null))['catch'](handleError(_0x39db7f,null));};exports[_0x43e7('0x41')]=function(_0x483f20,_0x4bebd4){if(_0x483f20[_0x43e7('0x42')]['id']){delete _0x483f20[_0x43e7('0x42')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x40')]({'where':{'id':_0x483f20[_0x43e7('0x43')]['id']}})[_0x43e7('0x10')](handleEntityNotFound(_0x4bebd4,null))[_0x43e7('0x10')](saveUpdates(_0x483f20[_0x43e7('0x42')],null))[_0x43e7('0x10')](respondWithResult(_0x4bebd4,null))[_0x43e7('0x1b')](handleError(_0x4bebd4,null));};exports['destroy']=function(_0x119d34,_0x46c910){return db['MailMessage'][_0x43e7('0x40')]({'where':{'id':_0x119d34['params']['id']}})[_0x43e7('0x10')](handleEntityNotFound(_0x46c910,null))[_0x43e7('0x10')](removeEntity(_0x46c910,null))[_0x43e7('0x1b')](handleError(_0x46c910,null));};exports[_0x43e7('0x44')]=function(_0xfe13fa,_0x5e5556){return db['MailMessage'][_0x43e7('0x44')]()[_0x43e7('0x10')](respondWithResult(_0x5e5556,null))[_0x43e7('0x1b')](handleError(_0x5e5556,null));};exports[_0x43e7('0x45')]=function(_0x23d835,_0x25bb44){return db[_0x43e7('0x28')][_0x43e7('0x45')](_0x23d835[_0x43e7('0x42')])[_0x43e7('0x10')](function(_0x312306){if(_0x312306){if(_0x312306['direction']===_0x43e7('0x46')&&!_0x312306[_0x43e7('0x47')]){var _0x50a3fa,_0x4314d8,_0x220bf2;if(_0x23d835[_0x43e7('0x42')]['to']){_0x4314d8=_0x23d835['body']['to']['split'](',')[0x0];}return db[_0x43e7('0x48')][_0x43e7('0x49')]({'where':{'id':_0x312306['MailAccountId']},'include':[{'model':db[_0x43e7('0x4a')],'as':'List','include':[{'model':db['CmContact'],'as':_0x43e7('0x4b'),'where':{'email':_0x4314d8},'limit':0x1,'order':[[_0x43e7('0x4c'),_0x43e7('0x4d')]]}]},{'model':db[_0x43e7('0x4e')],'as':_0x43e7('0x4f'),'raw':!![]}]})['then'](function(_0xc3976){_0x50a3fa=_0xc3976;if(_0x50a3fa&&_0x50a3fa[_0x43e7('0x4f')]){var _0x4d89bd={'tls':{'rejectUnauthorized':![]}};if(_[_0x43e7('0x50')](_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x51')])){_0x4d89bd['host']=_0x50a3fa['Smtp']['host'];_0x4d89bd[_0x43e7('0x52')]=_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x52')];_0x4d89bd[_0x43e7('0x53')]=_0x50a3fa['Smtp']['secure'];if(_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x54')]){_0x4d89bd[_0x43e7('0x55')]={'user':_0x50a3fa[_0x43e7('0x4f')]['user'],'pass':_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x56')]};}}else{_0x4d89bd[_0x43e7('0x51')]=_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x51')];_0x4d89bd[_0x43e7('0x55')]={'user':_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x57')],'pass':_0x50a3fa[_0x43e7('0x4f')][_0x43e7('0x56')]};_0x4d89bd[_0x43e7('0x53')]=_0x50a3fa['Smtp']['secure'];}if(_0x23d835[_0x43e7('0x42')]['attachments']&&_0x23d835['body']['attachments'][_0x43e7('0x3e')]){for(var _0xe666b0=0x0;_0xe666b0<_0x23d835['body'][_0x43e7('0x58')][_0x43e7('0x3e')];_0xe666b0+=0x1){_0x23d835[_0x43e7('0x42')]['attachments'][_0xe666b0]={'filename':_0x23d835[_0x43e7('0x42')][_0x43e7('0x58')][_0xe666b0][_0x43e7('0x26')],'path':path[_0x43e7('0x59')](config[_0x43e7('0x5a')],_0x43e7('0x5b'),_0x23d835[_0x43e7('0x42')]['attachments'][_0xe666b0][_0x43e7('0x5c')])};}}_0x220bf2={'account':_0x4d89bd,'message':_0x23d835[_0x43e7('0x42')]};return;}})[_0x43e7('0x10')](function(){if(_0x50a3fa['List']){if(_0x50a3fa['List'][_0x43e7('0x4b')]['length']){return _0x50a3fa['List'][_0x43e7('0x4b')][0x0];}else{return db[_0x43e7('0x5d')]['create'](_[_0x43e7('0xa')](_0x23d835[_0x43e7('0x42')],{'firstName':_0x23d835[_0x43e7('0x42')]['to'],'email':_0x23d835[_0x43e7('0x42')]['to'],'phone':_0x23d835[_0x43e7('0x42')]['to'],'ListId':_0x50a3fa[_0x43e7('0x5e')]}));}}else{throw new Error(_0x43e7('0x5f'));}})['then'](function(){if(_0x220bf2){return respondWithRpcPromise(_0x43e7('0x60'),_0x43e7('0x61'),_0x220bf2,client9003)['then'](function(_0x418213){return _0x312306['update']({'read':!![],'messageId':_0x418213[_0x43e7('0x62')],'sentAt':moment()[_0x43e7('0x63')](_0x43e7('0x64'))});})[_0x43e7('0x1b')](function(_0x506361){logger[_0x43e7('0x17')]('%s',JSON[_0x43e7('0x15')](_0x506361));return _0x312306;});}return _0x312306;});}return _0x312306;}})[_0x43e7('0x10')](respondWithResult(_0x25bb44,0xc9))['catch'](handleError(_0x25bb44,null));};exports[_0x43e7('0x65')]=function(_0x38fa5b,_0x219dc6){var _0x703a30={'agent':{},'channel':_0x43e7('0x66')};if(_0x38fa5b['body']['id']){delete _0x38fa5b[_0x43e7('0x42')]['id'];}_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x67')]=!![];_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x68')]=moment()[_0x43e7('0x63')](_0x43e7('0x64'));_0x38fa5b['body']['UserId']=_0x38fa5b[_0x43e7('0x42')]['UserId']||_0x38fa5b['user']['id'];_0x703a30['agent']['id']=_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x69')];return db[_0x43e7('0x28')][_0x43e7('0x40')]({'where':{'id':_0x38fa5b[_0x43e7('0x43')]['id'],'UserId':null}})[_0x43e7('0x10')](handleEntityNotFound(_0x219dc6,null))['then'](saveUpdates(_0x38fa5b[_0x43e7('0x42')],null))[_0x43e7('0x10')](function(_0x2cd420){if(_0x2cd420){_0x703a30['message']=_0x2cd420[_0x43e7('0x6a')]({'plain':!![]});return db[_0x43e7('0x6b')][_0x43e7('0x40')]({'where':{'id':_0x2cd420[_0x43e7('0x6c')]}});}return null;})[_0x43e7('0x10')](handleEntityNotFound(_0x219dc6,null))[_0x43e7('0x10')](function(_0x1d4a29){if(_0x1d4a29){return _0x1d4a29[_0x43e7('0x41')]({'UserId':_0x38fa5b['body']['UserId'],'read1stAt':_['isNil'](_0x1d4a29[_0x43e7('0x6d')])?moment()[_0x43e7('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x43e7('0x10')](function(_0x39a787){if(_0x39a787){_0x703a30[_0x43e7('0x6e')]=_0x39a787[_0x43e7('0x6a')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x38fa5b['user']['id'],_0x38fa5b[_0x43e7('0x57')][_0x43e7('0x26')],_0x38fa5b['user']['role'],_0x703a30[_0x43e7('0x6e')]['id'],_0x38fa5b[_0x43e7('0x42')]?JSON[_0x43e7('0x15')](_0x38fa5b['body']):_0x43e7('0x6f'));return respondWithRpcPromise(_0x43e7('0x70'),_0x43e7('0x71'),_0x703a30);}return null;})[_0x43e7('0x10')](function(_0x48f1dc){var _0x1d7048='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x48f1dc[_0x43e7('0x19')][_0x43e7('0x72')];return db[_0x43e7('0x73')][_0x43e7('0x2e')](_0x1d7048,{'type':db[_0x43e7('0x74')][_0x43e7('0x75')][_0x43e7('0x76')],'raw':!![]})['then'](function(_0x109c86){return _0x109c86;});})[_0x43e7('0x10')](function(_0x1aea4e){if(_0x1aea4e){_0x703a30[_0x43e7('0x19')]['contact']=_0x1aea4e[0x0];if(!_0x38fa5b['body']['UserId'])return;return db[_0x43e7('0x77')]['find']({'where':{'id':_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x69')],'role':_0x43e7('0x78')},'attributes':['id',_0x43e7('0x26'),_0x43e7('0x79'),_0x43e7('0x7a'),_0x43e7('0x7b')],'raw':!![]});}return null;})[_0x43e7('0x10')](function(_0x363af5){if(!_0x363af5)return null;_0x703a30[_0x43e7('0x19')][_0x43e7('0x78')]=_0x363af5;return _0x703a30;})['then'](function(_0xeaef5c){if(_0xeaef5c){if(_0x38fa5b[_0x43e7('0x42')][_0x43e7('0x7c')]){_0x703a30[_0x43e7('0x19')][_0x43e7('0x7d')]=util['format']('SIP/%s',_0x38fa5b[_0x43e7('0x57')][_0x43e7('0x26')]);_0x703a30['message'][_0x43e7('0x7e')]=_0x703a30[_0x43e7('0x7e')];_0x703a30['message']['event']=_0x43e7('0x65');_0x703a30[_0x43e7('0x19')][_0x43e7('0x42')]=htmlToText[_0x43e7('0x7f')](_0x703a30[_0x43e7('0x19')]['body']);return respondWithRpcPromise('EventManager',_0x43e7('0x80'),{'event':_0x43e7('0x81'),'message':_0x703a30[_0x43e7('0x19')]},client9002)[_0x43e7('0x10')](function(){return _0x703a30;});}return _0x703a30;}return null;})['then'](respondWithResult(_0x219dc6,null))[_0x43e7('0x1b')](handleError(_0x219dc6,null));};exports[_0x43e7('0x82')]=function(_0x1ed590,_0x15ee83){var _0x5bc060={'agent':{},'channel':_0x43e7('0x66')};if(_0x1ed590[_0x43e7('0x42')]['id']){delete _0x1ed590[_0x43e7('0x42')]['id'];}_0x1ed590[_0x43e7('0x42')][_0x43e7('0x69')]=_0x1ed590['body'][_0x43e7('0x69')]||_0x1ed590[_0x43e7('0x57')]['id'];_0x5bc060['agent']['id']=_0x1ed590[_0x43e7('0x42')][_0x43e7('0x69')];return db[_0x43e7('0x28')][_0x43e7('0x40')]({'where':{'id':_0x1ed590['params']['id'],'UserId':null}})[_0x43e7('0x10')](handleEntityNotFound(_0x15ee83,null))['then'](function(_0x130b41){if(_0x130b41){_0x5bc060[_0x43e7('0x19')]=_0x130b41[_0x43e7('0x6a')]({'plain':!![]});return db[_0x43e7('0x6b')][_0x43e7('0x40')]({'where':{'id':_0x130b41[_0x43e7('0x6c')]}});}return null;})[_0x43e7('0x10')](handleEntityNotFound(_0x15ee83,null))[_0x43e7('0x10')](function(_0xa693a3){if(_0xa693a3){_0x5bc060['interaction']=_0xa693a3[_0x43e7('0x6a')]({'plain':!![]});interaction_log[_0x43e7('0x11')](_0x43e7('0x83'),_0x1ed590[_0x43e7('0x57')]['id'],_0x1ed590['user']['name'],_0x1ed590[_0x43e7('0x57')][_0x43e7('0x84')],_0x5bc060[_0x43e7('0x6e')]['id'],_0x1ed590['body']?JSON[_0x43e7('0x15')](_0x1ed590['body']):'null');return respondWithRpcPromise('RejectMessage',_0x43e7('0x85'),_0x5bc060);}return null;})['then'](function(_0x28f15e){var _0x233819=_0x43e7('0x86')+_0x28f15e[_0x43e7('0x19')][_0x43e7('0x72')];return db['sequelize']['query'](_0x233819,{'type':db[_0x43e7('0x74')][_0x43e7('0x75')]['SELECT'],'raw':!![]})[_0x43e7('0x10')](function(_0x10fd28){return _0x10fd28;});})[_0x43e7('0x10')](function(_0x3310ef){if(_0x3310ef){_0x5bc060[_0x43e7('0x19')][_0x43e7('0x87')]=_0x3310ef[0x0];if(!_0x1ed590[_0x43e7('0x42')][_0x43e7('0x69')])return;return db[_0x43e7('0x77')][_0x43e7('0x40')]({'where':{'id':_0x1ed590[_0x43e7('0x42')][_0x43e7('0x69')],'role':_0x43e7('0x78')},'attributes':['id',_0x43e7('0x26'),_0x43e7('0x79'),_0x43e7('0x7a'),_0x43e7('0x7b')],'raw':!![]});}return null;})[_0x43e7('0x10')](function(_0xec3d2a){if(!_0xec3d2a)return null;_0x5bc060[_0x43e7('0x19')][_0x43e7('0x78')]=_0xec3d2a;return _0x5bc060;})[_0x43e7('0x10')](function(_0x492c2f){if(_0x492c2f){_0x492c2f[_0x43e7('0x19')][_0x43e7('0x7d')]=util[_0x43e7('0x63')](_0x43e7('0x88'),_0x1ed590['user'][_0x43e7('0x26')]);_0x492c2f['message'][_0x43e7('0x7e')]=_0x5bc060[_0x43e7('0x7e')];_0x492c2f[_0x43e7('0x19')][_0x43e7('0x89')]=_0x43e7('0x82');_0x492c2f[_0x43e7('0x19')]['body']=htmlToText[_0x43e7('0x7f')](_0x5bc060[_0x43e7('0x19')][_0x43e7('0x42')]);respondWithRpcPromise(_0x43e7('0x80'),_0x43e7('0x80'),{'event':'rejectmessage','message':_0x492c2f['message']},client9002);return _0x5bc060;}return null;})[_0x43e7('0x10')](respondWithResult(_0x15ee83,null))['catch'](handleError(_0x15ee83,null));};exports[_0x43e7('0x8a')]=function(_0x45aef7,_0x35e743){var _0x29ef54=moment()['unix']()['toString']();var _0x52ddb7=path[_0x43e7('0x59')](config['root'],'server','files',_0x43e7('0x8b'));var _0x1e6ddb=path['join'](config[_0x43e7('0x5a')],'server',_0x43e7('0x8c'),_0x43e7('0x58'));var _0x271f55=util[_0x43e7('0x63')](_0x43e7('0x8d'),_0x29ef54);return db['MailMessage'][_0x43e7('0x40')]({'where':{'id':_0x45aef7[_0x43e7('0x43')]['id']},'attributes':['id',_0x43e7('0x42'),'from','to','cc','bcc',_0x43e7('0x8e'),_0x43e7('0x8f')],'include':_0x45aef7[_0x43e7('0x2e')][_0x43e7('0x58')]?[{'model':db['Attachment'],'as':_0x43e7('0x90')}]:undefined})[_0x43e7('0x10')](handleEntityNotFound(_0x35e743,null))[_0x43e7('0x10')](function(_0x56150e){if(_0x56150e){var _0x41a222=_0x56150e;var _0x2c410e={'from':_0x41a222[_0x43e7('0x91')],'to':_0x41a222['to'],'subject':_0x41a222[_0x43e7('0x8e')],'html':_0x41a222['body'],'headers':{'Date':moment(_0x41a222[_0x43e7('0x8f')])['format'](_0x43e7('0x92'))},'attachments':[]};if(_0x56150e['cc']){_0x2c410e[_0x43e7('0x93')]['Cc']=_0x56150e['cc'];}if(_0x56150e['bcc']){_0x2c410e['headers'][_0x43e7('0x94')]=_0x56150e[_0x43e7('0x95')];}return new BPromise(function(_0x21d001,_0x4600e5){if(_0x56150e[_0x43e7('0x90')]){for(var _0x28986d=0x0;_0x28986d<_0x56150e[_0x43e7('0x90')][_0x43e7('0x3e')];_0x28986d++){var _0x1bff0a=_0x56150e[_0x43e7('0x90')][_0x28986d];var _0x615c=path['join'](_0x1e6ddb,_0x1bff0a[_0x43e7('0x5c')]);if(fs['existsSync'](_0x615c)){_0x2c410e[_0x43e7('0x58')][_0x43e7('0x96')]({'name':_0x1bff0a[_0x43e7('0x26')],'contentType':_0x1bff0a['type'],'data':fs[_0x43e7('0x97')](_0x615c)});}}}emlformat[_0x43e7('0x98')](_0x2c410e,function(_0x119cd2,_0x352405){if(_0x119cd2)return _0x4600e5(_0x119cd2);fs['writeFileSync'](path[_0x43e7('0x59')](_0x52ddb7,_0x271f55),_0x352405);return _0x21d001(_0x352405);});});}})[_0x43e7('0x10')](function(_0x524dc2){if(_0x524dc2){return _0x35e743['download'](path['join'](_0x52ddb7,_0x271f55),_0x271f55,function(_0x124024){if(!_0x124024)fs[_0x43e7('0x99')](path[_0x43e7('0x59')](_0x52ddb7,_0x271f55));});}})[_0x43e7('0x1b')](handleError(_0x35e743,null));}; \ No newline at end of file +var _0x008c=['pass','attachments','join','root','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','agent','get','MailInteraction','update','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','email','manual','channel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','sequelize','fullname','interface','SIP/%s','rejectmessage','download','unix','toString','tmp','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','localhost','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','json','offset','undefined','limit','count','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','body','destroy','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user'];(function(_0x68c432,_0x3f3a3e){var _0x6515fe=function(_0x464c60){while(--_0x464c60){_0x68c432['push'](_0x68c432['shift']());}};_0x6515fe(++_0x3f3a3e);}(_0x008c,0x188));var _0xc008=function(_0x42ee1e,_0x3f1a64){_0x42ee1e=_0x42ee1e-0x0;var _0x1e21b8=_0x008c[_0x42ee1e];return _0x1e21b8;};'use strict';var emlformat=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var BPromise=require(_0xc008('0x2'));var util=require(_0xc008('0x3'));var path=require(_0xc008('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc008('0x5'));var htmlToText=require(_0xc008('0x6'));var qs=require(_0xc008('0x7'));var logger=require(_0xc008('0x8'))(_0xc008('0x9'));var interaction_log=require(_0xc008('0x8'))(_0xc008('0xa'));var config=require(_0xc008('0xb'));var db=require(_0xc008('0xc'))['db'];config['redis']=_[_0xc008('0xd')](config['redis'],{'host':_0xc008('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc008('0xf'))[_0xc008('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0xc008('0x11')][_0xc008('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xc008('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x332fd4,_0x2ea200,_0x2a5b4e,_0x9ffa93){return new BPromise(function(_0x1819c6,_0x69726e){var _0x593f7a=_0x9ffa93||client;return _0x593f7a['request'](_0x332fd4,_0x2a5b4e)[_0xc008('0x13')](function(_0x50c1ab){logger[_0xc008('0x14')](_0xc008('0x15'),_0x2ea200,_0xc008('0x16'));logger[_0xc008('0x17')](_0xc008('0x18'),_0x2ea200,'request\x20sent',JSON['stringify'](_0x50c1ab));if(_0x50c1ab['error']){if(_0x50c1ab[_0xc008('0x19')][_0xc008('0x1a')]===0x1f4){logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error']['message']);return _0x69726e(_0x50c1ab['error']['message']);}logger[_0xc008('0x19')](_0xc008('0x15'),_0x2ea200,_0x50c1ab['error'][_0xc008('0x1b')]);return _0x1819c6(_0x50c1ab['error']['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x2ea200,_0xc008('0x16'));_0x1819c6(_0x50c1ab['result']['message']);}})['catch'](function(_0x4a582d){logger['error'](_0xc008('0x15'),_0x2ea200,_0x4a582d);_0x69726e(_0x4a582d);});});}function respondWithResult(_0x4777a6,_0x251db2){_0x251db2=_0x251db2||0xc8;return function(_0x415af3){if(_0x415af3){return _0x4777a6[_0xc008('0x1c')](_0x251db2)[_0xc008('0x1d')](_0x415af3);}};}function respondWithFilteredResult(_0x4f43e2,_0x459fd9){return function(_0x5c85f2){if(_0x5c85f2){var _0x58a6ea=typeof _0x459fd9[_0xc008('0x1e')]===_0xc008('0x1f')&&typeof _0x459fd9[_0xc008('0x20')]===_0xc008('0x1f');var _0x5410f5=_0x5c85f2['count'];var _0x5de1e9=_0x58a6ea?0x0:_0x459fd9[_0xc008('0x1e')];var _0x15dade=_0x58a6ea?_0x5c85f2[_0xc008('0x21')]:_0x459fd9[_0xc008('0x1e')]+_0x459fd9['limit'];var _0x5e2aca;if(_0x15dade>=_0x5410f5){_0x15dade=_0x5410f5;_0x5e2aca=0xc8;}else{_0x5e2aca=0xce;}_0x4f43e2['status'](_0x5e2aca);return _0x4f43e2['set']('Content-Range',_0x5de1e9+'-'+_0x15dade+'/'+_0x5410f5)[_0xc008('0x1d')](_0x5c85f2);}return null;};}function saveUpdates(_0x29ba43){return function(_0x25eae4){if(_0x25eae4){return _0x25eae4['update'](_0x29ba43)[_0xc008('0x13')](function(_0x32390d){return _0x32390d;});}return null;};}function removeEntity(_0x209591){return function(_0x2a7d4f){if(_0x2a7d4f){return _0x2a7d4f['destroy']()[_0xc008('0x13')](function(){_0x209591[_0xc008('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58db82){return function(_0x539766){if(!_0x539766){_0x58db82[_0xc008('0x22')](0x194);}return _0x539766;};}function handleError(_0x267abd,_0xf831f2){_0xf831f2=_0xf831f2||0x1f4;return function(_0x10889f){logger[_0xc008('0x19')](_0x10889f[_0xc008('0x23')]);if(_0x10889f[_0xc008('0x24')]){delete _0x10889f[_0xc008('0x24')];}_0x267abd[_0xc008('0x1c')](_0xf831f2)[_0xc008('0x25')](_0x10889f);};}exports[_0xc008('0x26')]=function(_0x1ac7c8,_0x596ee8){var _0x334a09={},_0x4b7fd4={},_0x499754={'count':0x0,'rows':[]};var _0xaf4b84=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xd0e05a){return{'name':_0xd0e05a[_0xc008('0x2a')],'type':_0xd0e05a[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x4b7fd4[_0xc008('0x2d')]=_['map'](_0xaf4b84,_0xc008('0x24'));_0x4b7fd4[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x1ac7c8[_0xc008('0x2e')]);_0x4b7fd4[_0xc008('0x30')]=_[_0xc008('0x31')](_0x4b7fd4[_0xc008('0x2d')],_0x4b7fd4['query']);_0x334a09[_0xc008('0x32')]=_[_0xc008('0x31')](_0x4b7fd4['model'],qs[_0xc008('0x33')](_0x1ac7c8[_0xc008('0x2e')]['fields']));_0x334a09[_0xc008('0x32')]=_0x334a09[_0xc008('0x32')][_0xc008('0x34')]?_0x334a09['attributes']:_0x4b7fd4['model'];if(!_0x1ac7c8['query'][_0xc008('0x35')]('nolimit')){_0x334a09[_0xc008('0x20')]=qs[_0xc008('0x20')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x20')]);_0x334a09[_0xc008('0x1e')]=qs[_0xc008('0x1e')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x1e')]);}_0x334a09[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x37')]);_0x334a09[_0xc008('0x38')]=qs[_0xc008('0x30')](_['pick'](_0x1ac7c8[_0xc008('0x2e')],_0x4b7fd4[_0xc008('0x30')]),_0xaf4b84);if(_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]){_0x334a09['where']=_[_0xc008('0x3a')](_0x334a09[_0xc008('0x38')],{'$or':_[_0xc008('0x27')](_0xaf4b84,function(_0x36e7ae){if(_0x36e7ae[_0xc008('0x2b')]!=='VIRTUAL'){var _0x398cdd={};_0x398cdd[_0x36e7ae[_0xc008('0x24')]]={'$like':'%'+_0x1ac7c8[_0xc008('0x2e')][_0xc008('0x39')]+'%'};return _0x398cdd;}})});}_0x334a09=_[_0xc008('0x3a')]({},_0x334a09,_0x1ac7c8['options']);var _0xf4cc4b={'where':_0x334a09[_0xc008('0x38')]};return db[_0xc008('0x28')][_0xc008('0x21')](_0xf4cc4b)['then'](function(_0x26cd05){_0x499754[_0xc008('0x21')]=_0x26cd05;if(_0x1ac7c8[_0xc008('0x2e')]['includeAll']){_0x334a09[_0xc008('0x3b')]=[{'all':!![]}];}return db['MailMessage'][_0xc008('0x3c')](_0x334a09);})['then'](function(_0x46fa8f){_0x499754[_0xc008('0x3d')]=_0x46fa8f;return _0x499754;})['then'](respondWithFilteredResult(_0x596ee8,_0x334a09))[_0xc008('0x3e')](handleError(_0x596ee8,null));};exports[_0xc008('0x3f')]=function(_0x6d6d4c,_0x5caaa2){var _0x1cec64={'raw':!![],'where':{'id':_0x6d6d4c[_0xc008('0x40')]['id']}},_0x2a9b5c={};_0x2a9b5c[_0xc008('0x2d')]=_[_0xc008('0x2f')](db[_0xc008('0x28')]['rawAttributes']);_0x2a9b5c['query']=_['keys'](_0x6d6d4c[_0xc008('0x2e')]);_0x2a9b5c[_0xc008('0x30')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],_0x2a9b5c[_0xc008('0x2e')]);_0x1cec64[_0xc008('0x32')]=_[_0xc008('0x31')](_0x2a9b5c[_0xc008('0x2d')],qs['fields'](_0x6d6d4c['query']['fields']));_0x1cec64[_0xc008('0x32')]=_0x1cec64[_0xc008('0x32')][_0xc008('0x34')]?_0x1cec64['attributes']:_0x2a9b5c[_0xc008('0x2d')];if(_0x6d6d4c[_0xc008('0x2e')][_0xc008('0x41')]){_0x1cec64[_0xc008('0x3b')]=[{'all':!![]}];}_0x1cec64=_[_0xc008('0x3a')]({},_0x1cec64,_0x6d6d4c[_0xc008('0x42')]);return db[_0xc008('0x28')][_0xc008('0x43')](_0x1cec64)[_0xc008('0x13')](handleEntityNotFound(_0x5caaa2,null))[_0xc008('0x13')](respondWithResult(_0x5caaa2,null))['catch'](handleError(_0x5caaa2,null));};exports['update']=function(_0x223056,_0x51cb14){if(_0x223056[_0xc008('0x44')]['id']){delete _0x223056[_0xc008('0x44')]['id'];}return db[_0xc008('0x28')]['find']({'where':{'id':_0x223056[_0xc008('0x40')]['id']}})[_0xc008('0x13')](handleEntityNotFound(_0x51cb14,null))[_0xc008('0x13')](saveUpdates(_0x223056[_0xc008('0x44')],null))[_0xc008('0x13')](respondWithResult(_0x51cb14,null))['catch'](handleError(_0x51cb14,null));};exports[_0xc008('0x45')]=function(_0x27b022,_0x4b4c6d){return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x27b022['params']['id']}})['then'](handleEntityNotFound(_0x4b4c6d,null))[_0xc008('0x13')](removeEntity(_0x4b4c6d,null))[_0xc008('0x3e')](handleError(_0x4b4c6d,null));};exports[_0xc008('0x46')]=function(_0x30d0aa,_0x14b6a0){return db['MailMessage']['describe']()[_0xc008('0x13')](respondWithResult(_0x14b6a0,null))['catch'](handleError(_0x14b6a0,null));};exports[_0xc008('0x47')]=function(_0x25d351,_0xf94fcb){return db[_0xc008('0x28')][_0xc008('0x47')](_0x25d351[_0xc008('0x44')])['then'](function(_0x2ea742){if(_0x2ea742){if(_0x2ea742[_0xc008('0x48')]===_0xc008('0x49')&&!_0x2ea742[_0xc008('0x4a')]){var _0x4424f5,_0x5aa385,_0x41fae3;if(_0x25d351['body']['to']){_0x5aa385=_0x25d351['body']['to']['split'](',')[0x0];}return db[_0xc008('0x4b')][_0xc008('0x4c')]({'where':{'id':_0x2ea742[_0xc008('0x4d')]},'include':[{'model':db['CmList'],'as':_0xc008('0x4e'),'include':[{'model':db[_0xc008('0x4f')],'as':_0xc008('0x50'),'where':{'email':_0x5aa385},'limit':0x1,'order':[['updatedAt',_0xc008('0x51')]]}]},{'model':db[_0xc008('0x52')],'as':_0xc008('0x53'),'raw':!![]}]})[_0xc008('0x13')](function(_0x5baff1){_0x4424f5=_0x5baff1;if(_0x4424f5&&_0x4424f5[_0xc008('0x53')]){var _0x4eaa6d={'tls':{'rejectUnauthorized':![]}};if(_[_0xc008('0x54')](_0x4424f5[_0xc008('0x53')][_0xc008('0x55')])){_0x4eaa6d[_0xc008('0x56')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x56')];_0x4eaa6d['port']=_0x4424f5[_0xc008('0x53')]['port'];_0x4eaa6d['secure']=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];if(_0x4424f5['Smtp'][_0xc008('0x58')]){_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};}}else{_0x4eaa6d[_0xc008('0x55')]=_0x4424f5['Smtp'][_0xc008('0x55')];_0x4eaa6d[_0xc008('0x59')]={'user':_0x4424f5[_0xc008('0x53')][_0xc008('0x5a')],'pass':_0x4424f5[_0xc008('0x53')][_0xc008('0x5b')]};_0x4eaa6d[_0xc008('0x57')]=_0x4424f5[_0xc008('0x53')][_0xc008('0x57')];}if(_0x25d351[_0xc008('0x44')][_0xc008('0x5c')]&&_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')]){for(var _0x4e0251=0x0;_0x4e0251<_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0xc008('0x34')];_0x4e0251+=0x1){_0x25d351['body'][_0xc008('0x5c')][_0x4e0251]={'filename':_0x25d351[_0xc008('0x44')]['attachments'][_0x4e0251]['name'],'path':path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x5f'),_0x25d351[_0xc008('0x44')][_0xc008('0x5c')][_0x4e0251][_0xc008('0x60')])};}}_0x41fae3={'account':_0x4eaa6d,'message':_0x25d351[_0xc008('0x44')]};return;}})[_0xc008('0x13')](function(){if(_0x4424f5[_0xc008('0x4e')]){if(_0x4424f5[_0xc008('0x4e')][_0xc008('0x50')]['length']){return _0x4424f5[_0xc008('0x4e')][_0xc008('0x50')][0x0];}else{return db[_0xc008('0x4f')][_0xc008('0x47')](_['defaults'](_0x25d351[_0xc008('0x44')],{'firstName':_0x25d351['body']['to'],'email':_0x25d351[_0xc008('0x44')]['to'],'phone':_0x25d351[_0xc008('0x44')]['to'],'ListId':_0x4424f5[_0xc008('0x61')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xc008('0x13')](function(){if(_0x41fae3){return respondWithRpcPromise(_0xc008('0x62'),_0xc008('0x63'),_0x41fae3,client9003)['then'](function(_0x35b28a){return _0x2ea742['update']({'read':!![],'messageId':_0x35b28a[_0xc008('0x64')],'sentAt':moment()[_0xc008('0x65')](_0xc008('0x66'))});})[_0xc008('0x3e')](function(_0x295ec7){logger['error']('%s',JSON[_0xc008('0x67')](_0x295ec7));return _0x2ea742;});}return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x13')](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x68')]=function(_0x5233bb,_0x278cbe){var _0x50bfe5={'agent':{},'channel':_0xc008('0x69')};if(_0x5233bb['body']['id']){delete _0x5233bb[_0xc008('0x44')]['id'];}_0x5233bb[_0xc008('0x44')][_0xc008('0x6a')]=!![];_0x5233bb[_0xc008('0x44')]['readAt']=moment()[_0xc008('0x65')](_0xc008('0x66'));_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]=_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')]||_0x5233bb[_0xc008('0x5a')]['id'];_0x50bfe5[_0xc008('0x6c')]['id']=_0x5233bb['body'][_0xc008('0x6b')];return db['MailMessage']['find']({'where':{'id':_0x5233bb['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](saveUpdates(_0x5233bb[_0xc008('0x44')],null))[_0xc008('0x13')](function(_0xc2f684){if(_0xc2f684){_0x50bfe5[_0xc008('0x1b')]=_0xc2f684[_0xc008('0x6d')]({'plain':!![]});return db[_0xc008('0x6e')][_0xc008('0x43')]({'where':{'id':_0xc2f684['MailInteractionId']}});}return null;})[_0xc008('0x13')](handleEntityNotFound(_0x278cbe,null))[_0xc008('0x13')](function(_0x2b1b26){if(_0x2b1b26){return _0x2b1b26[_0xc008('0x6f')]({'UserId':_0x5233bb[_0xc008('0x44')][_0xc008('0x6b')],'read1stAt':_[_0xc008('0x54')](_0x2b1b26[_0xc008('0x70')])?moment()[_0xc008('0x65')](_0xc008('0x66')):undefined});}return null;})[_0xc008('0x13')](function(_0x1dd9fe){if(_0x1dd9fe){_0x50bfe5['interaction']=_0x1dd9fe['get']({'plain':!![]});interaction_log[_0xc008('0x14')](_0xc008('0x71'),_0x5233bb[_0xc008('0x5a')]['id'],_0x5233bb['user'][_0xc008('0x24')],_0x5233bb[_0xc008('0x5a')]['role'],_0x50bfe5['interaction']['id'],_0x5233bb['body']?JSON[_0xc008('0x67')](_0x5233bb[_0xc008('0x44')]):_0xc008('0x72'));return respondWithRpcPromise(_0xc008('0x73'),_0xc008('0x74'),_0x50bfe5);}return null;})[_0xc008('0x13')](function(_0x285c09){var _0x43ba59=_0xc008('0x75')+_0x285c09[_0xc008('0x1b')]['ContactId'];return db['sequelize'][_0xc008('0x2e')](_0x43ba59,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})[_0xc008('0x13')](function(_0x37fc2c){return _0x37fc2c;});})['then'](function(_0x5794fe){if(_0x5794fe){_0x50bfe5[_0xc008('0x1b')][_0xc008('0x79')]=_0x5794fe[0x0];if(!_0x5233bb[_0xc008('0x44')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5233bb['body']['UserId'],'role':'agent'},'attributes':['id',_0xc008('0x24'),'fullname',_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x41151e){if(!_0x41151e)return null;_0x50bfe5[_0xc008('0x1b')]['agent']=_0x41151e;return _0x50bfe5;})['then'](function(_0x2ff671){if(_0x2ff671){if(_0x5233bb['body'][_0xc008('0x7b')]){_0x50bfe5[_0xc008('0x1b')]['interface']=util[_0xc008('0x65')]('SIP/%s',_0x5233bb['user'][_0xc008('0x24')]);_0x50bfe5[_0xc008('0x1b')]['channel']=_0x50bfe5[_0xc008('0x7c')];_0x50bfe5[_0xc008('0x1b')][_0xc008('0x7d')]='accept';_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x50bfe5[_0xc008('0x1b')][_0xc008('0x44')]);return respondWithRpcPromise(_0xc008('0x7f'),'EventManager',{'event':_0xc008('0x80'),'message':_0x50bfe5[_0xc008('0x1b')]},client9002)[_0xc008('0x13')](function(){return _0x50bfe5;});}return _0x50bfe5;}return null;})['then'](respondWithResult(_0x278cbe,null))[_0xc008('0x3e')](handleError(_0x278cbe,null));};exports[_0xc008('0x81')]=function(_0x4452a8,_0x4914ed){var _0x48c38b={'agent':{},'channel':'mail'};if(_0x4452a8[_0xc008('0x44')]['id']){delete _0x4452a8[_0xc008('0x44')]['id'];}_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]=_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')]||_0x4452a8[_0xc008('0x5a')]['id'];_0x48c38b[_0xc008('0x6c')]['id']=_0x4452a8['body'][_0xc008('0x6b')];return db[_0xc008('0x28')]['find']({'where':{'id':_0x4452a8['params']['id'],'UserId':null}})[_0xc008('0x13')](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x2be063){if(_0x2be063){_0x48c38b[_0xc008('0x1b')]=_0x2be063[_0xc008('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xc008('0x43')]({'where':{'id':_0x2be063[_0xc008('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x4914ed,null))[_0xc008('0x13')](function(_0x1cc68f){if(_0x1cc68f){_0x48c38b[_0xc008('0x83')]=_0x1cc68f[_0xc008('0x6d')]({'plain':!![]});interaction_log['info'](_0xc008('0x84'),_0x4452a8[_0xc008('0x5a')]['id'],_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')],_0x4452a8['user'][_0xc008('0x85')],_0x48c38b[_0xc008('0x83')]['id'],_0x4452a8['body']?JSON['stringify'](_0x4452a8[_0xc008('0x44')]):'null');return respondWithRpcPromise(_0xc008('0x86'),_0xc008('0x87'),_0x48c38b);}return null;})['then'](function(_0x1b6858){var _0x201ffa=_0xc008('0x75')+_0x1b6858[_0xc008('0x1b')][_0xc008('0x88')];return db[_0xc008('0x89')][_0xc008('0x2e')](_0x201ffa,{'type':db[_0xc008('0x76')][_0xc008('0x77')][_0xc008('0x78')],'raw':!![]})['then'](function(_0x49e6d5){return _0x49e6d5;});})[_0xc008('0x13')](function(_0x3d6f70){if(_0x3d6f70){_0x48c38b['message'][_0xc008('0x79')]=_0x3d6f70[0x0];if(!_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')])return;return db['User'][_0xc008('0x43')]({'where':{'id':_0x4452a8[_0xc008('0x44')][_0xc008('0x6b')],'role':_0xc008('0x6c')},'attributes':['id',_0xc008('0x24'),_0xc008('0x8a'),_0xc008('0x7a'),'internal'],'raw':!![]});}return null;})[_0xc008('0x13')](function(_0x49cd29){if(!_0x49cd29)return null;_0x48c38b[_0xc008('0x1b')][_0xc008('0x6c')]=_0x49cd29;return _0x48c38b;})[_0xc008('0x13')](function(_0x583077){if(_0x583077){_0x583077[_0xc008('0x1b')][_0xc008('0x8b')]=util[_0xc008('0x65')](_0xc008('0x8c'),_0x4452a8[_0xc008('0x5a')][_0xc008('0x24')]);_0x583077[_0xc008('0x1b')][_0xc008('0x7c')]=_0x48c38b[_0xc008('0x7c')];_0x583077[_0xc008('0x1b')]['event']=_0xc008('0x81');_0x583077[_0xc008('0x1b')][_0xc008('0x44')]=htmlToText[_0xc008('0x7e')](_0x48c38b[_0xc008('0x1b')]['body']);respondWithRpcPromise(_0xc008('0x7f'),_0xc008('0x7f'),{'event':_0xc008('0x8d'),'message':_0x583077[_0xc008('0x1b')]},client9002);return _0x48c38b;}return null;})[_0xc008('0x13')](respondWithResult(_0x4914ed,null))[_0xc008('0x3e')](handleError(_0x4914ed,null));};exports[_0xc008('0x8e')]=function(_0x220170,_0x2cc170){var _0x3e200b=moment()[_0xc008('0x8f')]()[_0xc008('0x90')]();var _0x2e2c2a=path[_0xc008('0x5d')](config[_0xc008('0x5e')],'server','files',_0xc008('0x91'));var _0x276ced=path[_0xc008('0x5d')](config[_0xc008('0x5e')],_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x5c'));var _0x3eb3de=util[_0xc008('0x65')]('message-%s.eml',_0x3e200b);return db[_0xc008('0x28')][_0xc008('0x43')]({'where':{'id':_0x220170['params']['id']},'attributes':['id',_0xc008('0x44'),_0xc008('0x94'),'to','cc',_0xc008('0x95'),_0xc008('0x96'),_0xc008('0x97')],'include':_0x220170[_0xc008('0x2e')]['attachments']?[{'model':db[_0xc008('0x98')],'as':_0xc008('0x99')}]:undefined})[_0xc008('0x13')](handleEntityNotFound(_0x2cc170,null))[_0xc008('0x13')](function(_0x59e3d0){if(_0x59e3d0){var _0x13a0bd=_0x59e3d0;var _0x5d5d2f={'from':_0x13a0bd[_0xc008('0x94')],'to':_0x13a0bd['to'],'subject':_0x13a0bd[_0xc008('0x96')],'html':_0x13a0bd['body'],'headers':{'Date':moment(_0x13a0bd[_0xc008('0x97')])['format'](_0xc008('0x9a'))},'attachments':[]};if(_0x59e3d0['cc']){_0x5d5d2f['headers']['Cc']=_0x59e3d0['cc'];}if(_0x59e3d0['bcc']){_0x5d5d2f['headers'][_0xc008('0x9b')]=_0x59e3d0[_0xc008('0x95')];}return new BPromise(function(_0x48f40f,_0x4fda8){if(_0x59e3d0[_0xc008('0x99')]){for(var _0x4a7692=0x0;_0x4a7692<_0x59e3d0[_0xc008('0x99')][_0xc008('0x34')];_0x4a7692++){var _0x1564a9=_0x59e3d0['Attachments'][_0x4a7692];var _0x33cad3=path[_0xc008('0x5d')](_0x276ced,_0x1564a9[_0xc008('0x60')]);if(fs[_0xc008('0x9c')](_0x33cad3)){_0x5d5d2f[_0xc008('0x5c')][_0xc008('0x9d')]({'name':_0x1564a9[_0xc008('0x24')],'contentType':_0x1564a9[_0xc008('0x2b')],'data':fs[_0xc008('0x9e')](_0x33cad3)});}}}emlformat[_0xc008('0x9f')](_0x5d5d2f,function(_0x427fd2,_0x4ea18b){if(_0x427fd2)return _0x4fda8(_0x427fd2);fs[_0xc008('0xa0')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x4ea18b);return _0x48f40f(_0x4ea18b);});});}})[_0xc008('0x13')](function(_0x4b946a){if(_0x4b946a){return _0x2cc170[_0xc008('0x8e')](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de),_0x3eb3de,function(_0x3f6018){if(!_0x3f6018)fs['unlinkSync'](path[_0xc008('0x5d')](_0x2e2c2a,_0x3eb3de));});}})['catch'](handleError(_0x2cc170,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fc35df0..26b1841 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 _0x2c7e=['hook','exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x42e99a,_0x2bf350){var _0x105c5b=function(_0x4c7046){while(--_0x4c7046){_0x42e99a['push'](_0x42e99a['shift']());}};_0x105c5b(++_0x2bf350);}(_0x2c7e,0x1ba));var _0xe2c7=function(_0x12cfa5,_0x1cbd4b){_0x12cfa5=_0x12cfa5-0x0;var _0x2aec83=_0x2c7e[_0x12cfa5];return _0x2aec83;};'use strict';var EventEmitter=require(_0xe2c7('0x0'));var MailMessage=require(_0xe2c7('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe2c7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe2c7('0x3')};function emitEvent(_0x1e6da3){return function(_0x1f69b7,_0x227d22,_0x48835a){MailMessageEvents[_0xe2c7('0x4')](_0x1e6da3+':'+_0x1f69b7['id'],_0x1f69b7);MailMessageEvents['emit'](_0x1e6da3,_0x1f69b7);_0x48835a(null);};}for(var e in events){if(events[_0xe2c7('0x5')](e)){var event=events[e];MailMessage[_0xe2c7('0x6')](e,emitEvent(event));}}module[_0xe2c7('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x1bd9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0x1bd9,0x98));var _0x91bd=function(_0xa5b54f,_0x1a2438){_0xa5b54f=_0xa5b54f-0x0;var _0x377f6e=_0x1bd9[_0xa5b54f];return _0x377f6e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x91bd('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x91bd('0x1')](0x0);var events={'afterCreate':_0x91bd('0x2'),'afterUpdate':_0x91bd('0x3'),'afterDestroy':_0x91bd('0x4')};function emitEvent(_0x59e511){return function(_0x165505,_0x591be,_0x4129c1){MailMessageEvents[_0x91bd('0x5')](_0x59e511+':'+_0x165505['id'],_0x165505);MailMessageEvents[_0x91bd('0x5')](_0x59e511,_0x165505);_0x4129c1(null);};}for(var e in events){if(events[_0x91bd('0x6')](e)){var event=events[e];MailMessage[_0x91bd('0x7')](e,emitEvent(event));}}module[_0x91bd('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 8ba49a6..a15519c 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 _0x9600=['update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','mail_messages','messageId','plainBody','subject','FULLTEXT','fromString','models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','then'];(function(_0x22229a,_0x22967c){var _0x2f7173=function(_0x50a3b4){while(--_0x50a3b4){_0x22229a['push'](_0x22229a['shift']());}};_0x2f7173(++_0x22967c);}(_0x9600,0x1d6));var _0x0960=function(_0x3b7d70,_0x30450e){_0x3b7d70=_0x3b7d70-0x0;var _0x472d7d=_0x9600[_0x3b7d70];return _0x472d7d;};'use strict';var _=require(_0x0960('0x0'));var util=require(_0x0960('0x1'));var logger=require(_0x0960('0x2'))(_0x0960('0x3'));var moment=require(_0x0960('0x4'));var BPromise=require('bluebird');var rp=require(_0x0960('0x5'));var htmlToText=require(_0x0960('0x6'));var fs=require('fs');var path=require(_0x0960('0x7'));var rimraf=require(_0x0960('0x8'));var config=require(_0x0960('0x9'));var attributes=require(_0x0960('0xa'));module['exports']=function(_0x4928fa,_0x37b6c0){return _0x4928fa['define']('MailMessage',attributes,{'tableName':_0x0960('0xb'),'paranoid':![],'indexes':[{'name':_0x0960('0xc'),'fields':[_0x0960('0xc')]},{'name':'fti_mail_messages','fields':[_0x0960('0xd'),_0x0960('0xe')],'type':_0x0960('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x538c43,_0x473961,_0x28eec7){if(_0x538c43['body']){_0x538c43[_0x0960('0xd')]=htmlToText[_0x0960('0x10')](_0x538c43['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x28eec7(null,_0x473961);},'afterCreate':function(_0x58ab5f,_0x228af6,_0x2e7b75){var _0x2e9193=_0x4928fa[_0x0960('0x11')];var _0x3cbbc7=_0x58ab5f[_0x0960('0x12')]({'plain':!![]});if(_0x3cbbc7[_0x0960('0x13')][_0x0960('0x14')]()==='in'||_0x3cbbc7['direction']['toLowerCase']()===_0x0960('0x15')&&!_0x3cbbc7[_0x0960('0x16')]&&!_['isNil'](_0x3cbbc7[_0x0960('0x17')])){_0x2e9193[_0x0960('0x18')]['findOne']({'where':{'id':_0x3cbbc7['MailInteractionId']}})[_0x0960('0x19')](function(_0x1ad02b){if(_0x1ad02b){_0x1ad02b[_0x0960('0x1a')]({'lastMsgAt':_0x3cbbc7['createdAt'],'lastMsgDirection':_0x3cbbc7[_0x0960('0x13')][_0x0960('0x14')]()});}})[_0x0960('0x1b')](function(_0x4b13c2){console[_0x0960('0x1c')](_0x4b13c2);});}_0x2e7b75();}},'charset':_0x0960('0x1d'),'collate':_0x0960('0x1e')});}; \ No newline at end of file +var _0x2bf5=['update','createdAt','error','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','plainBody','fromString','body','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then'];(function(_0x217281,_0x3e87c7){var _0x16209b=function(_0x25f6fb){while(--_0x25f6fb){_0x217281['push'](_0x217281['shift']());}};_0x16209b(++_0x3e87c7);}(_0x2bf5,0x1d2));var _0x52bf=function(_0x51743d,_0x5aa931){_0x51743d=_0x51743d-0x0;var _0x5bcf7f=_0x2bf5[_0x51743d];return _0x5bcf7f;};'use strict';var _=require(_0x52bf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x52bf('0x1'));var moment=require(_0x52bf('0x2'));var BPromise=require(_0x52bf('0x3'));var rp=require(_0x52bf('0x4'));var htmlToText=require(_0x52bf('0x5'));var fs=require('fs');var path=require(_0x52bf('0x6'));var rimraf=require('rimraf');var config=require(_0x52bf('0x7'));var attributes=require(_0x52bf('0x8'));module['exports']=function(_0x38e039,_0xd2fcf2){return _0x38e039[_0x52bf('0x9')](_0x52bf('0xa'),attributes,{'tableName':_0x52bf('0xb'),'paranoid':![],'indexes':[{'name':_0x52bf('0xc'),'fields':['messageId']},{'name':_0x52bf('0xd'),'fields':['plainBody','subject'],'type':_0x52bf('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b3cb1,_0x2cd1dc,_0xdb884a){if(_0x5b3cb1['body']){_0x5b3cb1[_0x52bf('0xf')]=htmlToText[_0x52bf('0x10')](_0x5b3cb1[_0x52bf('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xdb884a(null,_0x2cd1dc);},'afterCreate':function(_0x3e114d,_0x214e7e,_0x286bd1){var _0x35f935=_0x38e039['models'];var _0x52e744=_0x3e114d[_0x52bf('0x12')]({'plain':!![]});if(_0x52e744[_0x52bf('0x13')]['toLowerCase']()==='in'||_0x52e744['direction'][_0x52bf('0x14')]()===_0x52bf('0x15')&&!_0x52e744[_0x52bf('0x16')]&&!_[_0x52bf('0x17')](_0x52e744[_0x52bf('0x18')])){_0x35f935[_0x52bf('0x19')][_0x52bf('0x1a')]({'where':{'id':_0x52e744[_0x52bf('0x1b')]}})[_0x52bf('0x1c')](function(_0x4541f6){if(_0x4541f6){_0x4541f6[_0x52bf('0x1d')]({'lastMsgAt':_0x52e744[_0x52bf('0x1e')],'lastMsgDirection':_0x52e744[_0x52bf('0x13')][_0x52bf('0x14')]()});}})['catch'](function(_0xcf5502){console[_0x52bf('0x1f')](_0xcf5502);});}_0x286bd1();}},'charset':'utf8mb4','collate':_0x52bf('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 2c5cb42..91d8011 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 _0x5fdc=['catch','CreateMailMessage','MailMessage','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0x5fdc,0x127));var _0xc5fd=function(_0x19b30a,_0xff44c3){_0x19b30a=_0x19b30a-0x0;var _0x778097=_0x5fdc[_0x19b30a];return _0x778097;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rs=require(_0xc5fd('0x4'));var fs=require('fs');var Redis=require(_0xc5fd('0x5'));var db=require(_0xc5fd('0x6'))['db'];var utils=require(_0xc5fd('0x7'));var logger=require(_0xc5fd('0x8'))(_0xc5fd('0x9'));var config=require(_0xc5fd('0xa'));var jayson=require(_0xc5fd('0xb'));var client=jayson[_0xc5fd('0xc')][_0xc5fd('0xd')]({'port':0x232a});config[_0xc5fd('0xe')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc5fd('0xf'))(new Redis(config[_0xc5fd('0xe')]));require(_0xc5fd('0x10'))[_0xc5fd('0x11')](socket);function respondWithRpcPromise(_0x4e6d35,_0x4e1e94,_0x3442dd){return new BPromise(function(_0x1edeec,_0x39a95a){return client[_0xc5fd('0x12')](_0x4e6d35,_0x3442dd)[_0xc5fd('0x13')](function(_0x368c80){logger['info'](_0xc5fd('0x14'),_0x4e1e94,'request\x20sent');logger['debug'](_0xc5fd('0x15'),_0x4e1e94,_0xc5fd('0x16'),JSON[_0xc5fd('0x17')](_0x368c80));if(_0x368c80[_0xc5fd('0x18')]){if(_0x368c80[_0xc5fd('0x18')][_0xc5fd('0x19')]===0x1f4){logger[_0xc5fd('0x18')](_0xc5fd('0x14'),_0x4e1e94,_0x368c80['error'][_0xc5fd('0x1a')]);return _0x39a95a(_0x368c80[_0xc5fd('0x18')][_0xc5fd('0x1a')]);}logger[_0xc5fd('0x18')]('MailMessage,\x20%s,\x20%s',_0x4e1e94,_0x368c80['error']['message']);return _0x1edeec(_0x368c80['error']['message']);}else{logger[_0xc5fd('0x1b')](_0xc5fd('0x14'),_0x4e1e94,_0xc5fd('0x16'));_0x1edeec(_0x368c80[_0xc5fd('0x1c')][_0xc5fd('0x1a')]);}})[_0xc5fd('0x1d')](function(_0xfd14c7){logger['error'](_0xc5fd('0x14'),_0x4e1e94,_0xfd14c7);_0x39a95a(_0xfd14c7);});});}exports[_0xc5fd('0x1e')]=function(_0x32eac2){var _0x9c12e4=this;return new Promise(function(_0x3b3093,_0x48024e){return db[_0xc5fd('0x1f')][_0xc5fd('0x20')](_0x32eac2[_0xc5fd('0x21')],{'raw':_0x32eac2[_0xc5fd('0x22')]?_0x32eac2['options']['raw']===undefined?!![]:![]:!![]})[_0xc5fd('0x13')](function(_0x2ab935){logger[_0xc5fd('0x1b')](_0xc5fd('0x1e'),_0x32eac2);logger[_0xc5fd('0x23')](_0xc5fd('0x1e'),_0x32eac2,JSON['stringify'](_0x2ab935));_0x3b3093(_0x2ab935);})[_0xc5fd('0x1d')](function(_0x2701f7){logger[_0xc5fd('0x18')](_0xc5fd('0x1e'),_0x2701f7[_0xc5fd('0x1a')],_0x32eac2);_0x48024e(_0x9c12e4[_0xc5fd('0x18')](0x1f4,_0x2701f7[_0xc5fd('0x1a')]));});});}; \ No newline at end of file +var _0x5b12=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','create','options','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x5b12,0xa3));var _0x25b1=function(_0x1fd72a,_0x5aca7d){_0x1fd72a=_0x1fd72a-0x0;var _0x4c5075=_0x5b12[_0x1fd72a];return _0x4c5075;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});config['redis']=_[_0x25b1('0x8')](config[_0x25b1('0x9')],{'host':_0x25b1('0xa'),'port':0x18eb});var socket=require(_0x25b1('0xb'))(new Redis(config[_0x25b1('0x9')]));require(_0x25b1('0xc'))[_0x25b1('0xd')](socket);function respondWithRpcPromise(_0x6235e2,_0x5b7224,_0x2b739e){return new BPromise(function(_0x1c28cf,_0x2cee35){return client[_0x25b1('0xe')](_0x6235e2,_0x2b739e)[_0x25b1('0xf')](function(_0x8a71af){logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));logger[_0x25b1('0x13')](_0x25b1('0x14'),_0x5b7224,_0x25b1('0x12'),JSON[_0x25b1('0x15')](_0x8a71af));if(_0x8a71af[_0x25b1('0x16')]){if(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x17')]===0x1f4){logger['error'](_0x25b1('0x11'),_0x5b7224,_0x8a71af[_0x25b1('0x16')]['message']);return _0x2cee35(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x18')]);}logger[_0x25b1('0x16')]('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x8a71af['error'][_0x25b1('0x18')]);return _0x1c28cf(_0x8a71af['error'][_0x25b1('0x18')]);}else{logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));_0x1c28cf(_0x8a71af[_0x25b1('0x19')][_0x25b1('0x18')]);}})[_0x25b1('0x1a')](function(_0x292463){logger['error']('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x292463);_0x2cee35(_0x292463);});});}exports[_0x25b1('0x1b')]=function(_0x501dc8){var _0x174f4a=this;return new Promise(function(_0x50ae0f,_0x3bfd7d){return db['MailMessage'][_0x25b1('0x1c')](_0x501dc8['body'],{'raw':_0x501dc8[_0x25b1('0x1d')]?_0x501dc8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3bca9f){logger[_0x25b1('0x10')]('CreateMailMessage',_0x501dc8);logger[_0x25b1('0x13')](_0x25b1('0x1b'),_0x501dc8,JSON[_0x25b1('0x15')](_0x3bca9f));_0x50ae0f(_0x3bca9f);})[_0x25b1('0x1a')](function(_0x1aabbb){logger['error'](_0x25b1('0x1b'),_0x1aabbb[_0x25b1('0x18')],_0x501dc8);_0x3bfd7d(_0x174f4a[_0x25b1('0x16')](0x1f4,_0x1aabbb[_0x25b1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3907ff0..d17433d 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 _0xd1ab=['remove','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x525f69,_0x14ddd9){var _0x2c5a87=function(_0x5b02bc){while(--_0x5b02bc){_0x525f69['push'](_0x525f69['shift']());}};_0x2c5a87(++_0x14ddd9);}(_0xd1ab,0x101));var _0xbd1a=function(_0x2a2f0d,_0x56b22a){_0x2a2f0d=_0x2a2f0d-0x0;var _0x36809c=_0xd1ab[_0x2a2f0d];return _0x36809c;};'use strict';var MailMessageEvents=require(_0xbd1a('0x0'));var events=[_0xbd1a('0x1'),_0xbd1a('0x2'),'update'];function createListener(_0x14f6f7,_0xf4f8c8){return function(_0x270356){_0xf4f8c8['emit'](_0x14f6f7,_0x270356);};}function removeListener(_0x284528,_0xd21de7){return function(){MailMessageEvents[_0xbd1a('0x3')](_0x284528,_0xd21de7);};}exports[_0xbd1a('0x4')]=function(_0x1239ba){for(var _0x1cee8b=0x0,_0x3a222e=events[_0xbd1a('0x5')];_0x1cee8b<_0x3a222e;_0x1cee8b++){var _0x24d570=events[_0x1cee8b];var _0x23055a=createListener(_0xbd1a('0x6')+_0x24d570,_0x1239ba);MailMessageEvents['on'](_0x24d570,_0x23055a);}}; \ No newline at end of file +var _0x573a=['emit','removeListener','register','mailMessage:','./mailMessage.events','remove','update'];(function(_0x1ca93c,_0x3271ab){var _0x185169=function(_0x507763){while(--_0x507763){_0x1ca93c['push'](_0x1ca93c['shift']());}};_0x185169(++_0x3271ab);}(_0x573a,0x82));var _0xa573=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x573a[_0x4a5494];return _0x57cbb5;};'use strict';var MailMessageEvents=require(_0xa573('0x0'));var events=['save',_0xa573('0x1'),_0xa573('0x2')];function createListener(_0x284d55,_0xf509c2){return function(_0x38c4b6){_0xf509c2[_0xa573('0x3')](_0x284d55,_0x38c4b6);};}function removeListener(_0x97d2b3,_0x48f7eb){return function(){MailMessageEvents[_0xa573('0x4')](_0x97d2b3,_0x48f7eb);};}exports[_0xa573('0x5')]=function(_0x281922){for(var _0x110d77=0x0,_0x1bb25b=events['length'];_0x110d77<_0x1bb25b;_0x110d77++){var _0x281bd0=events[_0x110d77];var _0x278f55=createListener(_0xa573('0x6')+_0x281bd0,_0x281922);MailMessageEvents['on'](_0x281bd0,_0x278f55);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ba5300f..b7710e5 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 _0xe2b5=['get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8b11c4,_0x3ce8fd){var _0x25d5c0=function(_0x900524){while(--_0x900524){_0x8b11c4['push'](_0x8b11c4['shift']());}};_0x25d5c0(++_0x3ce8fd);}(_0xe2b5,0x136));var _0x5e2b=function(_0x2baf40,_0x5ebef2){_0x2baf40=_0x2baf40-0x0;var _0x2bb2cb=_0xe2b5[_0x2baf40];return _0x2bb2cb;};'use strict';var multer=require(_0x5e2b('0x0'));var util=require(_0x5e2b('0x1'));var path=require(_0x5e2b('0x2'));var timeout=require(_0x5e2b('0x3'));var express=require(_0x5e2b('0x4'));var router=express[_0x5e2b('0x5')]();var fs_extra=require(_0x5e2b('0x6'));var auth=require(_0x5e2b('0x7'));var interaction=require(_0x5e2b('0x8'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0x5e2b('0x9')]('/',auth[_0x5e2b('0xa')](),controller['index']);router[_0x5e2b('0x9')](_0x5e2b('0xb'),auth[_0x5e2b('0xa')](),controller[_0x5e2b('0xc')]);router[_0x5e2b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5e2b('0xd')]);router['get'](_0x5e2b('0xe'),auth[_0x5e2b('0xa')](),controller[_0x5e2b('0xf')]);router[_0x5e2b('0x9')](_0x5e2b('0x10'),auth[_0x5e2b('0xa')](),controller[_0x5e2b('0x11')]);router[_0x5e2b('0x9')](_0x5e2b('0x12'),auth['isAuthenticated'](),controller[_0x5e2b('0x13')]);router[_0x5e2b('0x14')]('/',auth['isAuthenticated'](),controller[_0x5e2b('0x15')]);router[_0x5e2b('0x14')](_0x5e2b('0x10'),auth[_0x5e2b('0xa')](),controller[_0x5e2b('0x16')]);router['post'](_0x5e2b('0x12'),auth[_0x5e2b('0xa')](),controller['addAgents']);router[_0x5e2b('0x17')](_0x5e2b('0x18'),auth[_0x5e2b('0xa')](),controller[_0x5e2b('0x19')]);router[_0x5e2b('0x1a')](_0x5e2b('0x18'),auth[_0x5e2b('0xa')](),controller[_0x5e2b('0x1b')]);router[_0x5e2b('0x1a')](_0x5e2b('0x10'),auth[_0x5e2b('0xa')](),controller['removeTeams']);router['delete'](_0x5e2b('0x12'),auth[_0x5e2b('0xa')](),controller['removeAgents']);module[_0x5e2b('0x1c')]=router; \ No newline at end of file +var _0xe9b8=['/:id/users','getAgents','create','post','/:id/teams','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','show','/:id/members','getTeams'];(function(_0x5bb6ab,_0x68052b){var _0x7f58a2=function(_0x5e9004){while(--_0x5e9004){_0x5bb6ab['push'](_0x5bb6ab['shift']());}};_0x7f58a2(++_0x68052b);}(_0xe9b8,0x116));var _0x8e9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe9b8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8e9b('0x0'));var util=require(_0x8e9b('0x1'));var path=require(_0x8e9b('0x2'));var timeout=require(_0x8e9b('0x3'));var express=require(_0x8e9b('0x4'));var router=express[_0x8e9b('0x5')]();var fs_extra=require(_0x8e9b('0x6'));var auth=require(_0x8e9b('0x7'));var interaction=require(_0x8e9b('0x8'));var config=require(_0x8e9b('0x9'));var controller=require(_0x8e9b('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x8e9b('0xb')]);router[_0x8e9b('0xc')](_0x8e9b('0xd'),auth[_0x8e9b('0xe')](),controller[_0x8e9b('0xf')]);router[_0x8e9b('0xc')]('/:id',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x10')]);router['get'](_0x8e9b('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0x8e9b('0xc')]('/:id/teams',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x12')]);router[_0x8e9b('0xc')](_0x8e9b('0x13'),auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x14')]);router['post']('/',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x15')]);router[_0x8e9b('0x16')](_0x8e9b('0x17'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8e9b('0x16')]('/:id/users',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x18')]);router[_0x8e9b('0x19')]('/:id',auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x1a')]);router[_0x8e9b('0x1b')](_0x8e9b('0x1c'),auth['isAuthenticated'](),controller[_0x8e9b('0x1d')]);router[_0x8e9b('0x1b')](_0x8e9b('0x17'),auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x1e')]);router['delete'](_0x8e9b('0x13'),auth[_0x8e9b('0xe')](),controller[_0x8e9b('0x1f')]);module[_0x8e9b('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4599e12..d5d673a 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 _0x205c=['rrmemory','beepall','roundrobin','STRING','INTEGER','ENUM'];(function(_0x36efdd,_0x1dccab){var _0x3b8364=function(_0x39a93f){while(--_0x39a93f){_0x36efdd['push'](_0x36efdd['shift']());}};_0x3b8364(++_0x1dccab);}(_0x205c,0x177));var _0xc205=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x205c[_0x355ce8];return _0x1db8b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc205('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc205('0x0')]},'timeout':{'type':Sequelize[_0xc205('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc205('0x2')](_0xc205('0x3'),_0xc205('0x4'),_0xc205('0x5'))}}; \ No newline at end of file +var _0x2abe=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2abe,0x109));var _0xe2ab=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2abe[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0xe2ab('0x0')]={'name':{'type':Sequelize[_0xe2ab('0x1')],'unique':_0xe2ab('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe2ab('0x1')]},'timeout':{'type':Sequelize[_0xe2ab('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe2ab('0x4')](_0xe2ab('0x5'),_0xe2ab('0x6'),_0xe2ab('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 46216f4..6663c79 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 _0x1455=['userMailQueue:remove','omit','spread','userMailQueue:save','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','undefined','limit','offset','count','set','json','apply','then','destroy','get','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserMailQueue','nolimit','MailQueueId','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','union','compact','value','removeAgents'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x1455,0x97));var _0x5145=function(_0x24e9f8,_0x1b0073){_0x24e9f8=_0x24e9f8-0x0;var _0x5f0d3d=_0x1455[_0x24e9f8];return _0x5f0d3d;};'use strict';var emlformat=require(_0x5145('0x0'));var rimraf=require(_0x5145('0x1'));var zipdir=require(_0x5145('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5145('0x3'));var moment=require(_0x5145('0x4'));var BPromise=require(_0x5145('0x5'));var Mustache=require(_0x5145('0x6'));var util=require(_0x5145('0x7'));var path=require(_0x5145('0x8'));var sox=require(_0x5145('0x9'));var csv=require('to-csv');var ejs=require(_0x5145('0xa'));var fs=require('fs');var fs_extra=require(_0x5145('0xb'));var _=require(_0x5145('0xc'));var squel=require('squel');var crypto=require(_0x5145('0xd'));var jsforce=require(_0x5145('0xe'));var deskjs=require(_0x5145('0xf'));var toCsv=require(_0x5145('0x10'));var querystring=require('querystring');var Papa=require(_0x5145('0x11'));var Redis=require(_0x5145('0x12'));var authService=require(_0x5145('0x13'));var qs=require(_0x5145('0x14'));var as=require(_0x5145('0x15'));var hardwareService=require(_0x5145('0x16'));var logger=require(_0x5145('0x17'))(_0x5145('0x18'));var utils=require(_0x5145('0x19'));var config=require(_0x5145('0x1a'));var licenseUtil=require(_0x5145('0x1b'));var db=require(_0x5145('0x1c'))['db'];config[_0x5145('0x1d')]=_[_0x5145('0x1e')](config['redis'],{'host':_0x5145('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5145('0x1d')]));require('./mailQueue.socket')[_0x5145('0x20')](socket);function respondWithStatusCode(_0x174add,_0xc77804){_0xc77804=_0xc77804||0xcc;return function(_0x582572){if(_0x582572){return _0x174add[_0x5145('0x21')](_0xc77804);}return _0x174add[_0x5145('0x22')](_0xc77804)[_0x5145('0x23')]();};}function respondWithResult(_0x3b8555,_0x3ed99e){_0x3ed99e=_0x3ed99e||0xc8;return function(_0x3bbac1){if(_0x3bbac1){return _0x3b8555['status'](_0x3ed99e)['json'](_0x3bbac1);}};}function respondWithFilteredResult(_0x406b28,_0x211613){return function(_0x4da496){if(_0x4da496){var _0x184e37=typeof _0x211613['offset']===_0x5145('0x24')&&typeof _0x211613[_0x5145('0x25')]==='undefined';var _0x3b1974=_0x4da496['count'];var _0x1c319f=_0x184e37?0x0:_0x211613[_0x5145('0x26')];var _0xb6039f=_0x184e37?_0x4da496[_0x5145('0x27')]:_0x211613[_0x5145('0x26')]+_0x211613['limit'];var _0x1660e;if(_0xb6039f>=_0x3b1974){_0xb6039f=_0x3b1974;_0x1660e=0xc8;}else{_0x1660e=0xce;}_0x406b28['status'](_0x1660e);return _0x406b28[_0x5145('0x28')]('Content-Range',_0x1c319f+'-'+_0xb6039f+'/'+_0x3b1974)[_0x5145('0x29')](_0x4da496);}return null;};}function patchUpdates(_0x2a1cf5){return function(_0xf5e766){try{jsonpatch[_0x5145('0x2a')](_0xf5e766,_0x2a1cf5,!![]);}catch(_0x58a6b1){return BPromise['reject'](_0x58a6b1);}return _0xf5e766['save']();};}function saveUpdates(_0xea624,_0x1f2649){return function(_0xffb4c7){if(_0xffb4c7){return _0xffb4c7['update'](_0xea624)[_0x5145('0x2b')](function(_0x2d9c77){return _0x2d9c77;});}return null;};}function removeEntity(_0xfddbe5,_0x49fdd2){return function(_0x487c66){if(_0x487c66){return _0x487c66[_0x5145('0x2c')]()[_0x5145('0x2b')](function(){var _0x22ce9c=_0x487c66[_0x5145('0x2d')]({'plain':!![]});var _0x53769a='MailQueues';return db['UserProfileResource'][_0x5145('0x2c')]({'where':{'type':_0x53769a,'resourceId':_0x22ce9c['id']}})[_0x5145('0x2b')](function(){return _0x487c66;});})[_0x5145('0x2b')](function(){_0xfddbe5[_0x5145('0x22')](0xcc)[_0x5145('0x23')]();});}};}function handleEntityNotFound(_0x1849b5,_0x3addfd){return function(_0x19360c){if(!_0x19360c){_0x1849b5[_0x5145('0x21')](0x194);}return _0x19360c;};}function handleError(_0x2a7c56,_0x2f83b6){_0x2f83b6=_0x2f83b6||0x1f4;return function(_0x339142){logger[_0x5145('0x2e')](_0x339142[_0x5145('0x2f')]);if(_0x339142[_0x5145('0x30')]){delete _0x339142['name'];}_0x2a7c56['status'](_0x2f83b6)[_0x5145('0x31')](_0x339142);};}exports[_0x5145('0x32')]=function(_0x1a9925,_0xb8ea3f){var _0x5c70ed={},_0x90444f={},_0x2e1d96={'count':0x0,'rows':[]};var _0xd73e98=_[_0x5145('0x33')](db[_0x5145('0x34')][_0x5145('0x35')],function(_0x1899f5){return{'name':_0x1899f5[_0x5145('0x36')],'type':_0x1899f5[_0x5145('0x37')][_0x5145('0x38')]};});_0x90444f['model']=_[_0x5145('0x33')](_0xd73e98,_0x5145('0x30'));_0x90444f[_0x5145('0x39')]=_[_0x5145('0x3a')](_0x1a9925['query']);_0x90444f[_0x5145('0x3b')]=_[_0x5145('0x3c')](_0x90444f['model'],_0x90444f['query']);_0x5c70ed[_0x5145('0x3d')]=_[_0x5145('0x3c')](_0x90444f[_0x5145('0x3e')],qs[_0x5145('0x3f')](_0x1a9925[_0x5145('0x39')][_0x5145('0x3f')]));_0x5c70ed[_0x5145('0x3d')]=_0x5c70ed[_0x5145('0x3d')][_0x5145('0x40')]?_0x5c70ed[_0x5145('0x3d')]:_0x90444f[_0x5145('0x3e')];if(!_0x1a9925[_0x5145('0x39')]['hasOwnProperty']('nolimit')){_0x5c70ed[_0x5145('0x25')]=qs[_0x5145('0x25')](_0x1a9925['query'][_0x5145('0x25')]);_0x5c70ed[_0x5145('0x26')]=qs[_0x5145('0x26')](_0x1a9925[_0x5145('0x39')][_0x5145('0x26')]);}_0x5c70ed[_0x5145('0x41')]=qs['sort'](_0x1a9925[_0x5145('0x39')][_0x5145('0x42')]);_0x5c70ed[_0x5145('0x43')]=qs[_0x5145('0x3b')](_[_0x5145('0x44')](_0x1a9925[_0x5145('0x39')],_0x90444f[_0x5145('0x3b')]),_0xd73e98);if(_0x1a9925[_0x5145('0x39')]['filter']){_0x5c70ed[_0x5145('0x43')]=_[_0x5145('0x45')](_0x5c70ed[_0x5145('0x43')],{'$or':_[_0x5145('0x33')](_0xd73e98,function(_0x2ef76c){if(_0x2ef76c[_0x5145('0x37')]!=='VIRTUAL'){var _0x3b1c68={};_0x3b1c68[_0x2ef76c[_0x5145('0x30')]]={'$like':'%'+_0x1a9925[_0x5145('0x39')][_0x5145('0x46')]+'%'};return _0x3b1c68;}})});}_0x5c70ed=_[_0x5145('0x45')]({},_0x5c70ed,_0x1a9925[_0x5145('0x47')]);var _0x3c9e7e={'where':_0x5c70ed[_0x5145('0x43')]};return db['MailQueue']['count'](_0x3c9e7e)['then'](function(_0x590f0e){_0x2e1d96['count']=_0x590f0e;if(_0x1a9925['query'][_0x5145('0x48')]){_0x5c70ed[_0x5145('0x49')]=[{'all':!![]}];}return db[_0x5145('0x34')][_0x5145('0x4a')](_0x5c70ed);})[_0x5145('0x2b')](function(_0x145826){_0x2e1d96[_0x5145('0x4b')]=_0x145826;return _0x2e1d96;})[_0x5145('0x2b')](respondWithFilteredResult(_0xb8ea3f,_0x5c70ed))['catch'](handleError(_0xb8ea3f,null));};exports['show']=function(_0x1e4b4d,_0x145dd7){var _0x5134fd={'raw':!![],'where':{'id':_0x1e4b4d[_0x5145('0x4c')]['id']}},_0x2d5a77={};_0x2d5a77['model']=_[_0x5145('0x3a')](db[_0x5145('0x34')][_0x5145('0x35')]);_0x2d5a77[_0x5145('0x39')]=_[_0x5145('0x3a')](_0x1e4b4d['query']);_0x2d5a77[_0x5145('0x3b')]=_[_0x5145('0x3c')](_0x2d5a77[_0x5145('0x3e')],_0x2d5a77[_0x5145('0x39')]);_0x5134fd['attributes']=_[_0x5145('0x3c')](_0x2d5a77[_0x5145('0x3e')],qs[_0x5145('0x3f')](_0x1e4b4d[_0x5145('0x39')][_0x5145('0x3f')]));_0x5134fd[_0x5145('0x3d')]=_0x5134fd[_0x5145('0x3d')]['length']?_0x5134fd[_0x5145('0x3d')]:_0x2d5a77[_0x5145('0x3e')];if(_0x1e4b4d[_0x5145('0x39')][_0x5145('0x48')]){_0x5134fd[_0x5145('0x49')]=[{'all':!![]}];}_0x5134fd=_[_0x5145('0x45')]({},_0x5134fd,_0x1e4b4d[_0x5145('0x47')]);return db[_0x5145('0x34')][_0x5145('0x4d')](_0x5134fd)[_0x5145('0x2b')](handleEntityNotFound(_0x145dd7,null))[_0x5145('0x2b')](respondWithResult(_0x145dd7,null))['catch'](handleError(_0x145dd7,null));};exports[_0x5145('0x4e')]=function(_0x430c3e,_0x9b4d50){return db[_0x5145('0x34')]['create'](_0x430c3e[_0x5145('0x4f')],{})['then'](function(_0x112449){var _0x398328=_0x430c3e[_0x5145('0x50')][_0x5145('0x2d')]({'plain':!![]});if(!_0x398328)throw new Error(_0x5145('0x51'));if(_0x398328[_0x5145('0x52')]===_0x5145('0x50')){var _0x32ad4e=_0x112449[_0x5145('0x2d')]({'plain':!![]});var _0x4b9b93=_0x5145('0x53');return db[_0x5145('0x54')]['find']({'where':{'name':_0x4b9b93,'userProfileId':_0x398328[_0x5145('0x55')]},'raw':!![]})[_0x5145('0x2b')](function(_0x19a7ab){if(_0x19a7ab&&_0x19a7ab[_0x5145('0x56')]===0x0){return db[_0x5145('0x57')][_0x5145('0x4e')]({'name':_0x32ad4e[_0x5145('0x30')],'resourceId':_0x32ad4e['id'],'type':_0x19a7ab[_0x5145('0x30')],'sectionId':_0x19a7ab['id']},{})['then'](function(){return _0x112449;});}else{return _0x112449;}})[_0x5145('0x58')](function(_0x31b344){logger[_0x5145('0x2e')](_0x5145('0x59'),_0x31b344);throw _0x31b344;});}return _0x112449;})[_0x5145('0x2b')](respondWithResult(_0x9b4d50,0xc9))[_0x5145('0x58')](handleError(_0x9b4d50,null));};exports[_0x5145('0x5a')]=function(_0x3682e7,_0x5b3ac3){if(_0x3682e7[_0x5145('0x4f')]['id']){delete _0x3682e7[_0x5145('0x4f')]['id'];}return db[_0x5145('0x34')][_0x5145('0x4d')]({'where':{'id':_0x3682e7[_0x5145('0x4c')]['id']}})[_0x5145('0x2b')](handleEntityNotFound(_0x5b3ac3,null))[_0x5145('0x2b')](saveUpdates(_0x3682e7[_0x5145('0x4f')],null))[_0x5145('0x2b')](respondWithResult(_0x5b3ac3,null))[_0x5145('0x58')](handleError(_0x5b3ac3,null));};exports['destroy']=function(_0x2b1278,_0x380dca){return db[_0x5145('0x34')][_0x5145('0x4d')]({'where':{'id':_0x2b1278[_0x5145('0x4c')]['id']}})['then'](handleEntityNotFound(_0x380dca,null))[_0x5145('0x2b')](removeEntity(_0x380dca,null))[_0x5145('0x58')](handleError(_0x380dca,null));};exports[_0x5145('0x5b')]=function(_0x1ac18c,_0xee8880){return db['MailQueue'][_0x5145('0x5b')]()[_0x5145('0x2b')](respondWithResult(_0xee8880,null))[_0x5145('0x58')](handleError(_0xee8880,null));};exports['getMembers']=function(_0x439d8b,_0x528f58,_0x13ee77){var _0x2470a0={'raw':!![],'where':{}},_0x1e149f={},_0x16637b;return db[_0x5145('0x34')]['findOne']({'where':{'id':_0x439d8b[_0x5145('0x4c')]['id']}})[_0x5145('0x2b')](handleEntityNotFound(_0x528f58,null))['then'](function(_0x826cae){if(_0x826cae){_0x16637b=_0x826cae[_0x5145('0x2d')]({'plain':!![]});_0x1e149f['model']=_['keys'](db[_0x5145('0x5c')]['rawAttributes']);_0x1e149f[_0x5145('0x39')]=_[_0x5145('0x3a')](_0x439d8b[_0x5145('0x39')]);_0x1e149f[_0x5145('0x3b')]=_[_0x5145('0x3c')](_0x1e149f[_0x5145('0x3e')],_0x1e149f[_0x5145('0x39')]);_0x2470a0[_0x5145('0x3d')]=_[_0x5145('0x3c')](_0x1e149f[_0x5145('0x3e')],qs['fields'](_0x439d8b[_0x5145('0x39')][_0x5145('0x3f')]));_0x2470a0[_0x5145('0x3d')]=_0x2470a0[_0x5145('0x3d')][_0x5145('0x40')]?_0x2470a0['attributes']:_0x1e149f[_0x5145('0x3e')];if(!_0x439d8b[_0x5145('0x39')]['hasOwnProperty'](_0x5145('0x5d'))){_0x2470a0[_0x5145('0x25')]=qs[_0x5145('0x25')](_0x439d8b[_0x5145('0x39')][_0x5145('0x25')]);_0x2470a0[_0x5145('0x26')]=qs['offset'](_0x439d8b[_0x5145('0x39')]['offset']);}_0x2470a0[_0x5145('0x41')]=qs[_0x5145('0x42')](_0x439d8b['query'][_0x5145('0x42')]);_0x2470a0[_0x5145('0x43')]=qs[_0x5145('0x3b')](_[_0x5145('0x44')](_0x439d8b[_0x5145('0x39')],_0x1e149f[_0x5145('0x3b')]));_0x2470a0['where'][_0x5145('0x5e')]=_0x826cae['id'];if(_0x439d8b[_0x5145('0x39')][_0x5145('0x46')]){_0x2470a0[_0x5145('0x43')]=_[_0x5145('0x45')](_0x2470a0[_0x5145('0x43')],{'$or':_[_0x5145('0x33')](_0x2470a0['attributes'],function(_0x3dff48){var _0x393a0c={};_0x393a0c[_0x3dff48]={'$like':'%'+_0x439d8b['query'][_0x5145('0x46')]+'%'};return _0x393a0c;})});}_0x2470a0=_[_0x5145('0x45')]({},_0x2470a0,_0x439d8b[_0x5145('0x47')]);return db['UserMailQueue'][_0x5145('0x4a')](_0x2470a0);}})[_0x5145('0x2b')](function(_0x2a617f){if(_0x2a617f){return db['User'][_0x5145('0x5f')]({'where':{'id':_[_0x5145('0x33')](_0x2a617f,'UserId'),'role':_0x5145('0x60')},'attributes':['id',_0x5145('0x30'),_0x5145('0x61'),_0x5145('0x62'),_0x5145('0x63')]});}})['then'](function(_0x46743f){if(_0x46743f){return{'count':_0x46743f['count'],'rows':_[_0x5145('0x33')](_0x46743f[_0x5145('0x4b')],function(_0x341285){return{'membername':_0x341285['name'],'UserId':_0x341285['id'],'queue_name':_0x16637b[_0x5145('0x30')],'MailQueueId':_0x16637b['id'],'interface':util[_0x5145('0x64')](_0x5145('0x65'),_0x5145('0x66'),_0x341285[_0x5145('0x30')]),'penalty':0x0,'paused':_0x341285[_0x5145('0x61')],'createdAt':_0x341285[_0x5145('0x63')],'updatedAt':_0x341285[_0x5145('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5145('0x2b')](respondWithFilteredResult(_0x528f58,_0x2470a0))[_0x5145('0x58')](handleError(_0x528f58,null));};exports[_0x5145('0x67')]=function(_0x4bdf29,_0x339c84,_0x412d1d){var _0x29ab66={};var _0x16aafe={};var _0x11ea52;var _0xc59073;return db['MailQueue'][_0x5145('0x68')]({'where':{'id':_0x4bdf29[_0x5145('0x4c')]['id']}})['then'](handleEntityNotFound(_0x339c84,null))[_0x5145('0x2b')](function(_0x3c4c10){if(_0x3c4c10){_0x11ea52=_0x3c4c10;_0x16aafe['model']=_['keys'](db[_0x5145('0x69')][_0x5145('0x35')]);_0x16aafe[_0x5145('0x39')]=_[_0x5145('0x3a')](_0x4bdf29[_0x5145('0x39')]);_0x16aafe['filters']=_[_0x5145('0x3c')](_0x16aafe[_0x5145('0x3e')],_0x16aafe[_0x5145('0x39')]);_0x29ab66[_0x5145('0x3d')]=_['intersection'](_0x16aafe['model'],qs[_0x5145('0x3f')](_0x4bdf29[_0x5145('0x39')]['fields']));_0x29ab66[_0x5145('0x3d')]=_0x29ab66['attributes']['length']?_0x29ab66[_0x5145('0x3d')]:_0x16aafe[_0x5145('0x3e')];_0x29ab66[_0x5145('0x41')]=qs[_0x5145('0x42')](_0x4bdf29[_0x5145('0x39')][_0x5145('0x42')]);_0x29ab66['where']=qs[_0x5145('0x3b')](_['pick'](_0x4bdf29[_0x5145('0x39')],_0x16aafe[_0x5145('0x3b')]));if(_0x4bdf29[_0x5145('0x39')][_0x5145('0x46')]){_0x29ab66[_0x5145('0x43')]=_[_0x5145('0x45')](_0x29ab66[_0x5145('0x43')],{'$or':_['map'](_0x29ab66[_0x5145('0x3d')],function(_0x3d0316){var _0x2251ab={};_0x2251ab[_0x3d0316]={'$like':'%'+_0x4bdf29[_0x5145('0x39')]['filter']+'%'};return _0x2251ab;})});}_0x29ab66=_[_0x5145('0x45')]({},_0x29ab66,_0x4bdf29[_0x5145('0x47')]);return _0x11ea52[_0x5145('0x67')](_0x29ab66);}})[_0x5145('0x2b')](function(_0x3935c7){if(_0x3935c7){_0xc59073=_0x3935c7[_0x5145('0x40')];if(!_0x4bdf29[_0x5145('0x39')]['hasOwnProperty'](_0x5145('0x5d'))){_0x29ab66[_0x5145('0x25')]=qs[_0x5145('0x25')](_0x4bdf29['query'][_0x5145('0x25')]);_0x29ab66[_0x5145('0x26')]=qs[_0x5145('0x26')](_0x4bdf29[_0x5145('0x39')]['offset']);}return _0x11ea52[_0x5145('0x67')](_0x29ab66);}})[_0x5145('0x2b')](function(_0x20479b){if(_0x20479b){return _0x20479b?{'count':_0xc59073,'rows':_0x20479b}:null;}})['then'](respondWithResult(_0x339c84,null))[_0x5145('0x58')](handleError(_0x339c84,null));};exports[_0x5145('0x6a')]=function(_0x5cd1ce,_0x353b41,_0x4dad69){var _0x255041=_0x5cd1ce[_0x5145('0x4f')][_0x5145('0x6b')];return db[_0x5145('0x69')][_0x5145('0x4a')]({'where':{'id':_0x255041},'attributes':['id'],'include':[{'model':db[_0x5145('0x6c')],'as':_0x5145('0x6d'),'attributes':['id','name',_0x5145('0x6e'),_0x5145('0x6f'),_0x5145('0x70')],'raw':!![]}]})[_0x5145('0x2b')](function(_0x2f9adf){if(_0x2f9adf){var _0xb9ab04=_[_0x5145('0x71')](_0x2f9adf,function(_0xf33ea2){var _0x3a8264=_0xf33ea2[_0x5145('0x2d')]({'plain':!![]});return _0x3a8264[_0x5145('0x6d')];});return db[_0x5145('0x34')][_0x5145('0x4d')]({'where':{'id':_0x5cd1ce['params']['id']}})[_0x5145('0x2b')](function(_0x1f5285){return db[_0x5145('0x72')][_0x5145('0x73')](function(_0x2fc9df){return _0x1f5285['addTeams'](_0x255041,{'transaction':_0x2fc9df})['then'](function(){return BPromise[_0x5145('0x74')](_0xb9ab04,function(_0x16d361){return db['UserMailQueue'][_0x5145('0x75')]({'where':{'UserId':_0x16d361['id'],'MailQueueId':_0x5cd1ce[_0x5145('0x4c')]['id']},'transaction':_0x2fc9df});});})['then'](function(){_0xb9ab04[_0x5145('0x76')](function(_0x3dab5c){socket[_0x5145('0x77')]('userMailQueue:save',{'UserId':_0x3dab5c['id'],'MailQueueId':_0x1f5285['id']});});});});});}})[_0x5145('0x2b')](respondWithStatusCode(_0x353b41,null))[_0x5145('0x58')](handleError(_0x353b41,null));};exports[_0x5145('0x78')]=function(_0x13d9ff,_0x186a52,_0x267bb1){return db[_0x5145('0x69')]['findAll']({'where':{'id':_0x13d9ff[_0x5145('0x39')][_0x5145('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x5145('0x6c')],'as':_0x5145('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x5145('0x2b')](handleEntityNotFound(_0x186a52,null))['then'](function(_0x538f58){var _0x37450c=_[_0x5145('0x33')](_0x538f58,'id');var _0xdad4c8=[];var _0x12ce82=[];var _0x4f3fb5=squel[_0x5145('0x79')]();_0x4f3fb5[_0x5145('0x7a')]('tq.TeamId')['from'](_0x5145('0x7b'),'tq')[_0x5145('0x7c')](_0x5145('0x7d'),'ut',_0x5145('0x7e'))[_0x5145('0x43')](_0x5145('0x7f'),_0x13d9ff['params']['id']);for(var _0x3aeafa=0x0;_0x3aeafa<_0x538f58[_0x5145('0x40')];_0x3aeafa+=0x1){let _0x5e9c27=_0x538f58[_0x3aeafa];for(var _0x5a108e=0x0;_0x5a108e<_0x5e9c27[_0x5145('0x6d')][_0x5145('0x40')];_0x5a108e+=0x1){let _0x3e85df=_0x5e9c27[_0x5145('0x6d')][_0x5a108e];var _0x427703=_0x4f3fb5[_0x5145('0x80')]();_0x427703[_0x5145('0x43')](_0x5145('0x81'),_0x3e85df['id']);_0x12ce82[_0x5145('0x82')](db['sequelize'][_0x5145('0x39')](_0x427703[_0x5145('0x83')](),{'type':db[_0x5145('0x72')][_0x5145('0x84')]['SELECT']})[_0x5145('0x2b')](function(_0x30f7d4){if(_0x30f7d4[_0x5145('0x40')]===0x1){return _0x3e85df['id'];}else{var _0xbacb3c=_[_0x5145('0x85')](_['map'](_0x30f7d4,'TeamId'),function(_0x417878){return _[_0x5145('0x86')](_0x37450c,_0x417878);});if(_0xbacb3c){return _0x3e85df['id'];}}}));}}return BPromise['all'](_0x12ce82)[_0x5145('0x2b')](function(_0x36682b){_0xdad4c8=_(_0xdad4c8)[_0x5145('0x87')](_0x36682b)[_0x5145('0x88')]()[_0x5145('0x89')]();return db[_0x5145('0x34')][_0x5145('0x4d')]({'where':{'id':_0x13d9ff[_0x5145('0x4c')]['id']}})['then'](function(_0x5dc41c){return db[_0x5145('0x72')]['transaction'](function(_0x23e4d6){return _0x5dc41c[_0x5145('0x78')](_0x13d9ff['query']['ids'],{'transaction':_0x23e4d6})['then'](function(){if(!_['isEmpty'](_0xdad4c8)){return _0x5dc41c[_0x5145('0x8a')](_0xdad4c8,{'transaction':_0x23e4d6});}})[_0x5145('0x2b')](function(){_0xdad4c8[_0x5145('0x76')](function(_0x190cdc){socket[_0x5145('0x77')](_0x5145('0x8b'),{'UserId':_0x190cdc,'MailQueueId':_0x5dc41c['id']});});});});});});})[_0x5145('0x2b')](respondWithStatusCode(_0x186a52,null))[_0x5145('0x58')](handleError(_0x186a52,null));};exports['addAgents']=function(_0x1ed545,_0x312733,_0x445aa7){return db[_0x5145('0x34')][_0x5145('0x4d')]({'where':{'id':_0x1ed545[_0x5145('0x4c')]['id']}})[_0x5145('0x2b')](handleEntityNotFound(_0x312733,null))[_0x5145('0x2b')](function(_0x1fe4d4){if(_0x1fe4d4){return _0x1fe4d4['addAgents'](_0x1ed545['body'][_0x5145('0x6b')],_[_0x5145('0x8c')](_0x1ed545[_0x5145('0x4f')],[_0x5145('0x6b'),'id'])||{})[_0x5145('0x8d')](function(_0x22e2a3){for(var _0x3b6de6=0x0;_0x3b6de6<_0x1ed545[_0x5145('0x4f')][_0x5145('0x6b')]['length'];_0x3b6de6+=0x1){socket[_0x5145('0x77')](_0x5145('0x8e'),{'UserId':Number(_0x1ed545[_0x5145('0x4f')][_0x5145('0x6b')][_0x3b6de6]),'MailQueueId':Number(_0x1ed545['params']['id'])});}return _0x22e2a3;});}})[_0x5145('0x2b')](respondWithResult(_0x312733,null))[_0x5145('0x58')](handleError(_0x312733,null));};exports['removeAgents']=function(_0xb2e5c0,_0x275ab8,_0x140c20){return db[_0x5145('0x34')][_0x5145('0x4d')]({'where':{'id':_0xb2e5c0[_0x5145('0x4c')]['id']}})[_0x5145('0x2b')](handleEntityNotFound(_0x275ab8,null))[_0x5145('0x2b')](function(_0x378ae6){if(_0x378ae6){return _0x378ae6[_0x5145('0x8a')](_0xb2e5c0[_0x5145('0x39')][_0x5145('0x6b')])[_0x5145('0x2b')](function(){if(_['isArray'](_0xb2e5c0['query'][_0x5145('0x6b')])){for(var _0x35be59=0x0;_0x35be59<_0xb2e5c0[_0x5145('0x39')][_0x5145('0x6b')][_0x5145('0x40')];_0x35be59+=0x1){socket[_0x5145('0x77')](_0x5145('0x8b'),{'UserId':Number(_0xb2e5c0['query'][_0x5145('0x6b')][_0x35be59]),'MailQueueId':Number(_0xb2e5c0[_0x5145('0x4c')]['id'])});}}else{socket['emit'](_0x5145('0x8b'),{'UserId':Number(_0xb2e5c0[_0x5145('0x39')][_0x5145('0x6b')]),'MailQueueId':Number(_0xb2e5c0[_0x5145('0x4c')]['id'])});}});}})[_0x5145('0x2b')](respondWithStatusCode(_0x275ab8,null))[_0x5145('0x58')](handleError(_0x275ab8,null));};exports[_0x5145('0x8f')]=function(_0x1d0038,_0x56e30e,_0xfd95ba){var _0xaf7f76={};var _0x258764={};var _0x5d54a4;var _0x2592bf;return db[_0x5145('0x34')]['findOne']({'where':{'id':_0x1d0038[_0x5145('0x4c')]['id']}})[_0x5145('0x2b')](handleEntityNotFound(_0x56e30e,null))[_0x5145('0x2b')](function(_0x836701){if(_0x836701){_0x5d54a4=_0x836701;_0x258764[_0x5145('0x3e')]=_[_0x5145('0x3a')](db[_0x5145('0x6c')]['rawAttributes']);_0x258764['query']=_['keys'](_0x1d0038['query']);_0x258764[_0x5145('0x3b')]=_['intersection'](_0x258764[_0x5145('0x3e')],_0x258764['query']);_0xaf7f76[_0x5145('0x3d')]=_[_0x5145('0x3c')](_0x258764['model'],qs['fields'](_0x1d0038[_0x5145('0x39')][_0x5145('0x3f')]));_0xaf7f76[_0x5145('0x3d')]=_0xaf7f76[_0x5145('0x3d')][_0x5145('0x40')]?_0xaf7f76['attributes']:_0x258764['model'];_0xaf7f76[_0x5145('0x41')]=qs['sort'](_0x1d0038['query'][_0x5145('0x42')]);_0xaf7f76[_0x5145('0x43')]=qs[_0x5145('0x3b')](_[_0x5145('0x44')](_0x1d0038[_0x5145('0x39')],_0x258764[_0x5145('0x3b')]));if(_0x1d0038['query'][_0x5145('0x46')]){_0xaf7f76[_0x5145('0x43')]=_['merge'](_0xaf7f76[_0x5145('0x43')],{'$or':_[_0x5145('0x33')](_0xaf7f76[_0x5145('0x3d')],function(_0x33cc12){var _0x2995da={};_0x2995da[_0x33cc12]={'$like':'%'+_0x1d0038[_0x5145('0x39')][_0x5145('0x46')]+'%'};return _0x2995da;})});}_0xaf7f76=_['merge']({},_0xaf7f76,_0x1d0038['options']);return _0x5d54a4[_0x5145('0x8f')](_0xaf7f76);}})[_0x5145('0x2b')](function(_0x125f31){if(_0x125f31){_0x2592bf=_0x125f31[_0x5145('0x40')];if(!_0x1d0038[_0x5145('0x39')][_0x5145('0x90')](_0x5145('0x5d'))){_0xaf7f76[_0x5145('0x25')]=qs[_0x5145('0x25')](_0x1d0038[_0x5145('0x39')][_0x5145('0x25')]);_0xaf7f76[_0x5145('0x26')]=qs['offset'](_0x1d0038['query'][_0x5145('0x26')]);}return _0x5d54a4[_0x5145('0x8f')](_0xaf7f76);}})[_0x5145('0x2b')](function(_0x1b4d1d){if(_0x1b4d1d){return _0x1b4d1d?{'count':_0x2592bf,'rows':_0x1b4d1d}:null;}})['then'](respondWithResult(_0x56e30e,null))['catch'](handleError(_0x56e30e,null));}; \ No newline at end of file +var _0x0879=['create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserMailQueue','hasOwnProperty','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','stack','name','index','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','catch','show','params','user','role','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x0879,0x1e9));var _0x9087=function(_0x20aed7,_0x441459){_0x20aed7=_0x20aed7-0x0;var _0x4480ae=_0x0879[_0x20aed7];return _0x4480ae;};'use strict';var emlformat=require(_0x9087('0x0'));var rimraf=require(_0x9087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9087('0x2'));var rp=require(_0x9087('0x3'));var moment=require(_0x9087('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9087('0x5'));var util=require(_0x9087('0x6'));var path=require(_0x9087('0x7'));var sox=require(_0x9087('0x8'));var csv=require('to-csv');var ejs=require(_0x9087('0x9'));var fs=require('fs');var fs_extra=require(_0x9087('0xa'));var _=require(_0x9087('0xb'));var squel=require(_0x9087('0xc'));var crypto=require(_0x9087('0xd'));var jsforce=require(_0x9087('0xe'));var deskjs=require(_0x9087('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9087('0x10'));var Papa=require('papaparse');var Redis=require(_0x9087('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9087('0x12'));var hardwareService=require(_0x9087('0x13'));var logger=require('../../config/logger')(_0x9087('0x14'));var utils=require(_0x9087('0x15'));var config=require(_0x9087('0x16'));var licenseUtil=require(_0x9087('0x17'));var db=require('../../mysqldb')['db'];config[_0x9087('0x18')]=_[_0x9087('0x19')](config[_0x9087('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9087('0x1a'))(new Redis(config[_0x9087('0x18')]));require(_0x9087('0x1b'))['register'](socket);function respondWithStatusCode(_0x43e290,_0x377e9a){_0x377e9a=_0x377e9a||0xcc;return function(_0x250fb0){if(_0x250fb0){return _0x43e290[_0x9087('0x1c')](_0x377e9a);}return _0x43e290['status'](_0x377e9a)[_0x9087('0x1d')]();};}function respondWithResult(_0x144521,_0x51fc87){_0x51fc87=_0x51fc87||0xc8;return function(_0x47d3e3){if(_0x47d3e3){return _0x144521[_0x9087('0x1e')](_0x51fc87)['json'](_0x47d3e3);}};}function respondWithFilteredResult(_0x5590f9,_0xd9b1b){return function(_0x569a46){if(_0x569a46){var _0x45e93e=typeof _0xd9b1b[_0x9087('0x1f')]===_0x9087('0x20')&&typeof _0xd9b1b[_0x9087('0x21')]===_0x9087('0x20');var _0x1e99b7=_0x569a46[_0x9087('0x22')];var _0x2b36ad=_0x45e93e?0x0:_0xd9b1b['offset'];var _0x54b512=_0x45e93e?_0x569a46[_0x9087('0x22')]:_0xd9b1b[_0x9087('0x1f')]+_0xd9b1b[_0x9087('0x21')];var _0x209f95;if(_0x54b512>=_0x1e99b7){_0x54b512=_0x1e99b7;_0x209f95=0xc8;}else{_0x209f95=0xce;}_0x5590f9[_0x9087('0x1e')](_0x209f95);return _0x5590f9[_0x9087('0x23')]('Content-Range',_0x2b36ad+'-'+_0x54b512+'/'+_0x1e99b7)[_0x9087('0x24')](_0x569a46);}return null;};}function patchUpdates(_0x585c86){return function(_0x346707){try{jsonpatch[_0x9087('0x25')](_0x346707,_0x585c86,!![]);}catch(_0xc3cab4){return BPromise[_0x9087('0x26')](_0xc3cab4);}return _0x346707[_0x9087('0x27')]();};}function saveUpdates(_0x52713b,_0x45c711){return function(_0x17b43a){if(_0x17b43a){return _0x17b43a[_0x9087('0x28')](_0x52713b)[_0x9087('0x29')](function(_0x4f3e97){return _0x4f3e97;});}return null;};}function removeEntity(_0x73e123,_0x4ca6b7){return function(_0x228fd6){if(_0x228fd6){return _0x228fd6[_0x9087('0x2a')]()[_0x9087('0x29')](function(){var _0x3e4141=_0x228fd6[_0x9087('0x2b')]({'plain':!![]});var _0x5c25c7=_0x9087('0x2c');return db[_0x9087('0x2d')]['destroy']({'where':{'type':_0x5c25c7,'resourceId':_0x3e4141['id']}})[_0x9087('0x29')](function(){return _0x228fd6;});})[_0x9087('0x29')](function(){_0x73e123[_0x9087('0x1e')](0xcc)[_0x9087('0x1d')]();});}};}function handleEntityNotFound(_0x189929,_0x400919){return function(_0x306386){if(!_0x306386){_0x189929[_0x9087('0x1c')](0x194);}return _0x306386;};}function handleError(_0x572345,_0x23d9eb){_0x23d9eb=_0x23d9eb||0x1f4;return function(_0x28e922){logger['error'](_0x28e922[_0x9087('0x2e')]);if(_0x28e922[_0x9087('0x2f')]){delete _0x28e922['name'];}_0x572345[_0x9087('0x1e')](_0x23d9eb)['send'](_0x28e922);};}exports[_0x9087('0x30')]=function(_0x5b7b00,_0x118a8e){var _0x51fc25={},_0x18a83b={},_0x5484ee={'count':0x0,'rows':[]};var _0x3f6625=_['map'](db['MailQueue'][_0x9087('0x31')],function(_0x515b07){return{'name':_0x515b07[_0x9087('0x32')],'type':_0x515b07['type'][_0x9087('0x33')]};});_0x18a83b['model']=_['map'](_0x3f6625,_0x9087('0x2f'));_0x18a83b[_0x9087('0x34')]=_[_0x9087('0x35')](_0x5b7b00[_0x9087('0x34')]);_0x18a83b[_0x9087('0x36')]=_['intersection'](_0x18a83b['model'],_0x18a83b[_0x9087('0x34')]);_0x51fc25[_0x9087('0x37')]=_[_0x9087('0x38')](_0x18a83b[_0x9087('0x39')],qs[_0x9087('0x3a')](_0x5b7b00[_0x9087('0x34')][_0x9087('0x3a')]));_0x51fc25[_0x9087('0x37')]=_0x51fc25['attributes'][_0x9087('0x3b')]?_0x51fc25['attributes']:_0x18a83b[_0x9087('0x39')];if(!_0x5b7b00[_0x9087('0x34')]['hasOwnProperty'](_0x9087('0x3c'))){_0x51fc25[_0x9087('0x21')]=qs[_0x9087('0x21')](_0x5b7b00[_0x9087('0x34')][_0x9087('0x21')]);_0x51fc25[_0x9087('0x1f')]=qs['offset'](_0x5b7b00[_0x9087('0x34')][_0x9087('0x1f')]);}_0x51fc25[_0x9087('0x3d')]=qs[_0x9087('0x3e')](_0x5b7b00[_0x9087('0x34')]['sort']);_0x51fc25[_0x9087('0x3f')]=qs['filters'](_['pick'](_0x5b7b00['query'],_0x18a83b[_0x9087('0x36')]),_0x3f6625);if(_0x5b7b00[_0x9087('0x34')][_0x9087('0x40')]){_0x51fc25[_0x9087('0x3f')]=_[_0x9087('0x41')](_0x51fc25[_0x9087('0x3f')],{'$or':_[_0x9087('0x42')](_0x3f6625,function(_0x4cf5e2){if(_0x4cf5e2['type']!==_0x9087('0x43')){var _0x1e4f14={};_0x1e4f14[_0x4cf5e2[_0x9087('0x2f')]]={'$like':'%'+_0x5b7b00[_0x9087('0x34')][_0x9087('0x40')]+'%'};return _0x1e4f14;}})});}_0x51fc25=_[_0x9087('0x41')]({},_0x51fc25,_0x5b7b00[_0x9087('0x44')]);var _0x2f0d6d={'where':_0x51fc25['where']};return db[_0x9087('0x45')][_0x9087('0x22')](_0x2f0d6d)['then'](function(_0x37e532){_0x5484ee[_0x9087('0x22')]=_0x37e532;if(_0x5b7b00['query'][_0x9087('0x46')]){_0x51fc25[_0x9087('0x47')]=[{'all':!![]}];}return db['MailQueue'][_0x9087('0x48')](_0x51fc25);})['then'](function(_0x39fecb){_0x5484ee[_0x9087('0x49')]=_0x39fecb;return _0x5484ee;})['then'](respondWithFilteredResult(_0x118a8e,_0x51fc25))[_0x9087('0x4a')](handleError(_0x118a8e,null));};exports[_0x9087('0x4b')]=function(_0x3f0f99,_0x1a0742){var _0x1ddf7e={'raw':!![],'where':{'id':_0x3f0f99[_0x9087('0x4c')]['id']}},_0x5b2ef8={};_0x5b2ef8[_0x9087('0x39')]=_[_0x9087('0x35')](db['MailQueue'][_0x9087('0x31')]);_0x5b2ef8[_0x9087('0x34')]=_[_0x9087('0x35')](_0x3f0f99[_0x9087('0x34')]);_0x5b2ef8[_0x9087('0x36')]=_[_0x9087('0x38')](_0x5b2ef8['model'],_0x5b2ef8[_0x9087('0x34')]);_0x1ddf7e[_0x9087('0x37')]=_[_0x9087('0x38')](_0x5b2ef8[_0x9087('0x39')],qs[_0x9087('0x3a')](_0x3f0f99[_0x9087('0x34')][_0x9087('0x3a')]));_0x1ddf7e[_0x9087('0x37')]=_0x1ddf7e[_0x9087('0x37')][_0x9087('0x3b')]?_0x1ddf7e[_0x9087('0x37')]:_0x5b2ef8[_0x9087('0x39')];if(_0x3f0f99[_0x9087('0x34')][_0x9087('0x46')]){_0x1ddf7e['include']=[{'all':!![]}];}_0x1ddf7e=_['merge']({},_0x1ddf7e,_0x3f0f99[_0x9087('0x44')]);return db[_0x9087('0x45')]['find'](_0x1ddf7e)['then'](handleEntityNotFound(_0x1a0742,null))['then'](respondWithResult(_0x1a0742,null))[_0x9087('0x4a')](handleError(_0x1a0742,null));};exports['create']=function(_0x9f10a1,_0x257fbb){return db[_0x9087('0x45')]['create'](_0x9f10a1['body'],{})[_0x9087('0x29')](function(_0x16158d){var _0x18274=_0x9f10a1[_0x9087('0x4d')]['get']({'plain':!![]});if(!_0x18274)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18274[_0x9087('0x4e')]===_0x9087('0x4d')){var _0x1ed0ee=_0x16158d['get']({'plain':!![]});var _0x52346a=_0x9087('0x2c');return db[_0x9087('0x4f')][_0x9087('0x50')]({'where':{'name':_0x52346a,'userProfileId':_0x18274[_0x9087('0x51')]},'raw':!![]})[_0x9087('0x29')](function(_0x32c2f9){if(_0x32c2f9&&_0x32c2f9[_0x9087('0x52')]===0x0){return db[_0x9087('0x2d')][_0x9087('0x53')]({'name':_0x1ed0ee['name'],'resourceId':_0x1ed0ee['id'],'type':_0x32c2f9['name'],'sectionId':_0x32c2f9['id']},{})[_0x9087('0x29')](function(){return _0x16158d;});}else{return _0x16158d;}})[_0x9087('0x4a')](function(_0x2a7837){logger[_0x9087('0x54')](_0x9087('0x55'),_0x2a7837);throw _0x2a7837;});}return _0x16158d;})['then'](respondWithResult(_0x257fbb,0xc9))[_0x9087('0x4a')](handleError(_0x257fbb,null));};exports[_0x9087('0x28')]=function(_0x459d23,_0x25dac1){if(_0x459d23['body']['id']){delete _0x459d23[_0x9087('0x56')]['id'];}return db[_0x9087('0x45')][_0x9087('0x50')]({'where':{'id':_0x459d23[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x25dac1,null))[_0x9087('0x29')](saveUpdates(_0x459d23[_0x9087('0x56')],null))['then'](respondWithResult(_0x25dac1,null))[_0x9087('0x4a')](handleError(_0x25dac1,null));};exports[_0x9087('0x2a')]=function(_0x190b17,_0x3cb66d){return db[_0x9087('0x45')][_0x9087('0x50')]({'where':{'id':_0x190b17[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x3cb66d,null))[_0x9087('0x29')](removeEntity(_0x3cb66d,null))[_0x9087('0x4a')](handleError(_0x3cb66d,null));};exports[_0x9087('0x57')]=function(_0x11663e,_0x7da4fb){return db['MailQueue']['describe']()[_0x9087('0x29')](respondWithResult(_0x7da4fb,null))['catch'](handleError(_0x7da4fb,null));};exports[_0x9087('0x58')]=function(_0x20e2d4,_0x171294,_0x8d69a1){var _0x3a0c31={'raw':!![],'where':{}},_0x13abc5={},_0x17aa11;return db[_0x9087('0x45')]['findOne']({'where':{'id':_0x20e2d4['params']['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x171294,null))[_0x9087('0x29')](function(_0x4541bd){if(_0x4541bd){_0x17aa11=_0x4541bd[_0x9087('0x2b')]({'plain':!![]});_0x13abc5[_0x9087('0x39')]=_[_0x9087('0x35')](db[_0x9087('0x59')][_0x9087('0x31')]);_0x13abc5['query']=_[_0x9087('0x35')](_0x20e2d4[_0x9087('0x34')]);_0x13abc5[_0x9087('0x36')]=_['intersection'](_0x13abc5['model'],_0x13abc5[_0x9087('0x34')]);_0x3a0c31[_0x9087('0x37')]=_['intersection'](_0x13abc5[_0x9087('0x39')],qs[_0x9087('0x3a')](_0x20e2d4[_0x9087('0x34')][_0x9087('0x3a')]));_0x3a0c31[_0x9087('0x37')]=_0x3a0c31[_0x9087('0x37')][_0x9087('0x3b')]?_0x3a0c31[_0x9087('0x37')]:_0x13abc5[_0x9087('0x39')];if(!_0x20e2d4[_0x9087('0x34')][_0x9087('0x5a')](_0x9087('0x3c'))){_0x3a0c31[_0x9087('0x21')]=qs['limit'](_0x20e2d4[_0x9087('0x34')][_0x9087('0x21')]);_0x3a0c31[_0x9087('0x1f')]=qs[_0x9087('0x1f')](_0x20e2d4[_0x9087('0x34')][_0x9087('0x1f')]);}_0x3a0c31[_0x9087('0x3d')]=qs[_0x9087('0x3e')](_0x20e2d4[_0x9087('0x34')][_0x9087('0x3e')]);_0x3a0c31[_0x9087('0x3f')]=qs[_0x9087('0x36')](_[_0x9087('0x5b')](_0x20e2d4[_0x9087('0x34')],_0x13abc5[_0x9087('0x36')]));_0x3a0c31[_0x9087('0x3f')][_0x9087('0x5c')]=_0x4541bd['id'];if(_0x20e2d4['query'][_0x9087('0x40')]){_0x3a0c31['where']=_[_0x9087('0x41')](_0x3a0c31[_0x9087('0x3f')],{'$or':_['map'](_0x3a0c31[_0x9087('0x37')],function(_0x3266f4){var _0x9f5d42={};_0x9f5d42[_0x3266f4]={'$like':'%'+_0x20e2d4[_0x9087('0x34')][_0x9087('0x40')]+'%'};return _0x9f5d42;})});}_0x3a0c31=_[_0x9087('0x41')]({},_0x3a0c31,_0x20e2d4[_0x9087('0x44')]);return db[_0x9087('0x59')][_0x9087('0x48')](_0x3a0c31);}})['then'](function(_0x303d13){if(_0x303d13){return db[_0x9087('0x5d')][_0x9087('0x5e')]({'where':{'id':_[_0x9087('0x42')](_0x303d13,_0x9087('0x5f')),'role':_0x9087('0x60')},'attributes':['id',_0x9087('0x2f'),_0x9087('0x61'),_0x9087('0x62'),'createdAt']});}})[_0x9087('0x29')](function(_0x2c7d78){if(_0x2c7d78){return{'count':_0x2c7d78[_0x9087('0x22')],'rows':_[_0x9087('0x42')](_0x2c7d78['rows'],function(_0xe739b9){return{'membername':_0xe739b9[_0x9087('0x2f')],'UserId':_0xe739b9['id'],'queue_name':_0x17aa11['name'],'MailQueueId':_0x17aa11['id'],'interface':util[_0x9087('0x63')](_0x9087('0x64'),_0x9087('0x65'),_0xe739b9[_0x9087('0x2f')]),'penalty':0x0,'paused':_0xe739b9['mailPause'],'createdAt':_0xe739b9[_0x9087('0x66')],'updatedAt':_0xe739b9[_0x9087('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9087('0x29')](respondWithFilteredResult(_0x171294,_0x3a0c31))[_0x9087('0x4a')](handleError(_0x171294,null));};exports[_0x9087('0x67')]=function(_0x1bf1f1,_0x5ecc95,_0x401deb){var _0x38945e={};var _0xd73918={};var _0x4ee2d5;var _0x210acb;return db[_0x9087('0x45')][_0x9087('0x68')]({'where':{'id':_0x1bf1f1[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x5ecc95,null))[_0x9087('0x29')](function(_0x2d303d){if(_0x2d303d){_0x4ee2d5=_0x2d303d;_0xd73918['model']=_[_0x9087('0x35')](db[_0x9087('0x69')][_0x9087('0x31')]);_0xd73918[_0x9087('0x34')]=_[_0x9087('0x35')](_0x1bf1f1[_0x9087('0x34')]);_0xd73918[_0x9087('0x36')]=_[_0x9087('0x38')](_0xd73918[_0x9087('0x39')],_0xd73918[_0x9087('0x34')]);_0x38945e[_0x9087('0x37')]=_[_0x9087('0x38')](_0xd73918[_0x9087('0x39')],qs['fields'](_0x1bf1f1[_0x9087('0x34')][_0x9087('0x3a')]));_0x38945e['attributes']=_0x38945e[_0x9087('0x37')][_0x9087('0x3b')]?_0x38945e[_0x9087('0x37')]:_0xd73918[_0x9087('0x39')];_0x38945e[_0x9087('0x3d')]=qs['sort'](_0x1bf1f1[_0x9087('0x34')][_0x9087('0x3e')]);_0x38945e[_0x9087('0x3f')]=qs[_0x9087('0x36')](_['pick'](_0x1bf1f1[_0x9087('0x34')],_0xd73918[_0x9087('0x36')]));if(_0x1bf1f1[_0x9087('0x34')][_0x9087('0x40')]){_0x38945e[_0x9087('0x3f')]=_[_0x9087('0x41')](_0x38945e[_0x9087('0x3f')],{'$or':_['map'](_0x38945e[_0x9087('0x37')],function(_0xe026e7){var _0x5afd5a={};_0x5afd5a[_0xe026e7]={'$like':'%'+_0x1bf1f1[_0x9087('0x34')]['filter']+'%'};return _0x5afd5a;})});}_0x38945e=_['merge']({},_0x38945e,_0x1bf1f1['options']);return _0x4ee2d5[_0x9087('0x67')](_0x38945e);}})[_0x9087('0x29')](function(_0x302196){if(_0x302196){_0x210acb=_0x302196[_0x9087('0x3b')];if(!_0x1bf1f1['query']['hasOwnProperty'](_0x9087('0x3c'))){_0x38945e['limit']=qs[_0x9087('0x21')](_0x1bf1f1['query']['limit']);_0x38945e['offset']=qs[_0x9087('0x1f')](_0x1bf1f1['query'][_0x9087('0x1f')]);}return _0x4ee2d5['getTeams'](_0x38945e);}})[_0x9087('0x29')](function(_0x2b47df){if(_0x2b47df){return _0x2b47df?{'count':_0x210acb,'rows':_0x2b47df}:null;}})[_0x9087('0x29')](respondWithResult(_0x5ecc95,null))['catch'](handleError(_0x5ecc95,null));};exports[_0x9087('0x6a')]=function(_0x2addcb,_0x1c5b12,_0x26542d){var _0x3a2000=_0x2addcb[_0x9087('0x56')][_0x9087('0x6b')];return db[_0x9087('0x69')][_0x9087('0x48')]({'where':{'id':_0x3a2000},'attributes':['id'],'include':[{'model':db[_0x9087('0x5d')],'as':_0x9087('0x6c'),'attributes':['id',_0x9087('0x2f'),_0x9087('0x6d'),'voicePause',_0x9087('0x6e')],'raw':!![]}]})[_0x9087('0x29')](function(_0x3f3afd){if(_0x3f3afd){var _0x8cf759=_[_0x9087('0x6f')](_0x3f3afd,function(_0x461b75){var _0x6257a2=_0x461b75[_0x9087('0x2b')]({'plain':!![]});return _0x6257a2[_0x9087('0x6c')];});return db[_0x9087('0x45')][_0x9087('0x50')]({'where':{'id':_0x2addcb[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](function(_0x29ac9b){return db[_0x9087('0x70')][_0x9087('0x71')](function(_0xa0549d){return _0x29ac9b[_0x9087('0x6a')](_0x3a2000,{'transaction':_0xa0549d})[_0x9087('0x29')](function(){return BPromise[_0x9087('0x72')](_0x8cf759,function(_0x1fd554){return db[_0x9087('0x59')][_0x9087('0x73')]({'where':{'UserId':_0x1fd554['id'],'MailQueueId':_0x2addcb['params']['id']},'transaction':_0xa0549d});});})[_0x9087('0x29')](function(){_0x8cf759[_0x9087('0x74')](function(_0x284281){socket[_0x9087('0x75')](_0x9087('0x76'),{'UserId':_0x284281['id'],'MailQueueId':_0x29ac9b['id']});});});});});}})['then'](respondWithStatusCode(_0x1c5b12,null))[_0x9087('0x4a')](handleError(_0x1c5b12,null));};exports[_0x9087('0x77')]=function(_0x4b6a64,_0x2fe083,_0x26fbba){return db[_0x9087('0x69')][_0x9087('0x48')]({'where':{'id':_0x4b6a64[_0x9087('0x34')][_0x9087('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x9087('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9087('0x29')](handleEntityNotFound(_0x2fe083,null))[_0x9087('0x29')](function(_0x4b866f){var _0x52ee44=_[_0x9087('0x42')](_0x4b866f,'id');var _0x9561f6=[];var _0x12195c=[];var _0x3cde6c=squel[_0x9087('0x78')]();_0x3cde6c[_0x9087('0x79')]('tq.TeamId')[_0x9087('0x7a')](_0x9087('0x7b'),'tq')['join'](_0x9087('0x7c'),'ut',_0x9087('0x7d'))['where'](_0x9087('0x7e'),_0x4b6a64[_0x9087('0x4c')]['id']);for(var _0x16bfe2=0x0;_0x16bfe2<_0x4b866f[_0x9087('0x3b')];_0x16bfe2+=0x1){let _0xd7a7ac=_0x4b866f[_0x16bfe2];for(var _0x14542a=0x0;_0x14542a<_0xd7a7ac[_0x9087('0x6c')][_0x9087('0x3b')];_0x14542a+=0x1){let _0x2fc810=_0xd7a7ac[_0x9087('0x6c')][_0x14542a];var _0x205906=_0x3cde6c[_0x9087('0x7f')]();_0x205906[_0x9087('0x3f')]('ut.UserId\x20=\x20?',_0x2fc810['id']);_0x12195c[_0x9087('0x80')](db['sequelize'][_0x9087('0x34')](_0x205906[_0x9087('0x81')](),{'type':db['sequelize']['QueryTypes'][_0x9087('0x82')]})[_0x9087('0x29')](function(_0x278ba3){if(_0x278ba3[_0x9087('0x3b')]===0x1){return _0x2fc810['id'];}else{var _0x5f0b19=_[_0x9087('0x83')](_['map'](_0x278ba3,_0x9087('0x84')),function(_0x15a53e){return _[_0x9087('0x85')](_0x52ee44,_0x15a53e);});if(_0x5f0b19){return _0x2fc810['id'];}}}));}}return BPromise['all'](_0x12195c)['then'](function(_0x4671cb){_0x9561f6=_(_0x9561f6)[_0x9087('0x86')](_0x4671cb)[_0x9087('0x87')]()[_0x9087('0x88')]();return db[_0x9087('0x45')][_0x9087('0x50')]({'where':{'id':_0x4b6a64[_0x9087('0x4c')]['id']}})['then'](function(_0x6190ed){return db['sequelize']['transaction'](function(_0x307162){return _0x6190ed[_0x9087('0x77')](_0x4b6a64[_0x9087('0x34')][_0x9087('0x6b')],{'transaction':_0x307162})[_0x9087('0x29')](function(){if(!_[_0x9087('0x89')](_0x9561f6)){return _0x6190ed[_0x9087('0x8a')](_0x9561f6,{'transaction':_0x307162});}})[_0x9087('0x29')](function(){_0x9561f6[_0x9087('0x74')](function(_0x5a0e8d){socket[_0x9087('0x75')](_0x9087('0x8b'),{'UserId':_0x5a0e8d,'MailQueueId':_0x6190ed['id']});});});});});});})[_0x9087('0x29')](respondWithStatusCode(_0x2fe083,null))['catch'](handleError(_0x2fe083,null));};exports['addAgents']=function(_0x527f7d,_0x137a24,_0x3d3ba2){return db['MailQueue'][_0x9087('0x50')]({'where':{'id':_0x527f7d[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x137a24,null))['then'](function(_0x42eb60){if(_0x42eb60){return _0x42eb60[_0x9087('0x8c')](_0x527f7d['body'][_0x9087('0x6b')],_['omit'](_0x527f7d[_0x9087('0x56')],['ids','id'])||{})[_0x9087('0x8d')](function(_0x2e38a5){for(var _0xabcb87=0x0;_0xabcb87<_0x527f7d['body'][_0x9087('0x6b')][_0x9087('0x3b')];_0xabcb87+=0x1){socket[_0x9087('0x75')](_0x9087('0x76'),{'UserId':Number(_0x527f7d[_0x9087('0x56')][_0x9087('0x6b')][_0xabcb87]),'MailQueueId':Number(_0x527f7d[_0x9087('0x4c')]['id'])});}return _0x2e38a5;});}})[_0x9087('0x29')](respondWithResult(_0x137a24,null))['catch'](handleError(_0x137a24,null));};exports[_0x9087('0x8a')]=function(_0x27d188,_0x2e9e1d,_0x107543){return db[_0x9087('0x45')]['find']({'where':{'id':_0x27d188[_0x9087('0x4c')]['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x2e9e1d,null))['then'](function(_0x5482be){if(_0x5482be){return _0x5482be[_0x9087('0x8a')](_0x27d188['query'][_0x9087('0x6b')])['then'](function(){if(_['isArray'](_0x27d188[_0x9087('0x34')][_0x9087('0x6b')])){for(var _0x514213=0x0;_0x514213<_0x27d188[_0x9087('0x34')][_0x9087('0x6b')]['length'];_0x514213+=0x1){socket[_0x9087('0x75')]('userMailQueue:remove',{'UserId':Number(_0x27d188[_0x9087('0x34')]['ids'][_0x514213]),'MailQueueId':Number(_0x27d188[_0x9087('0x4c')]['id'])});}}else{socket['emit'](_0x9087('0x8b'),{'UserId':Number(_0x27d188['query'][_0x9087('0x6b')]),'MailQueueId':Number(_0x27d188[_0x9087('0x4c')]['id'])});}});}})[_0x9087('0x29')](respondWithStatusCode(_0x2e9e1d,null))['catch'](handleError(_0x2e9e1d,null));};exports[_0x9087('0x8e')]=function(_0x5dfa4c,_0x1e3750,_0x4d32e6){var _0x1588f6={};var _0x32d1e2={};var _0x161661;var _0x5c4ca9;return db[_0x9087('0x45')]['findOne']({'where':{'id':_0x5dfa4c['params']['id']}})[_0x9087('0x29')](handleEntityNotFound(_0x1e3750,null))[_0x9087('0x29')](function(_0x122435){if(_0x122435){_0x161661=_0x122435;_0x32d1e2[_0x9087('0x39')]=_['keys'](db[_0x9087('0x5d')]['rawAttributes']);_0x32d1e2[_0x9087('0x34')]=_['keys'](_0x5dfa4c[_0x9087('0x34')]);_0x32d1e2[_0x9087('0x36')]=_[_0x9087('0x38')](_0x32d1e2[_0x9087('0x39')],_0x32d1e2[_0x9087('0x34')]);_0x1588f6[_0x9087('0x37')]=_[_0x9087('0x38')](_0x32d1e2[_0x9087('0x39')],qs[_0x9087('0x3a')](_0x5dfa4c[_0x9087('0x34')]['fields']));_0x1588f6[_0x9087('0x37')]=_0x1588f6[_0x9087('0x37')][_0x9087('0x3b')]?_0x1588f6[_0x9087('0x37')]:_0x32d1e2[_0x9087('0x39')];_0x1588f6[_0x9087('0x3d')]=qs[_0x9087('0x3e')](_0x5dfa4c[_0x9087('0x34')][_0x9087('0x3e')]);_0x1588f6['where']=qs[_0x9087('0x36')](_[_0x9087('0x5b')](_0x5dfa4c[_0x9087('0x34')],_0x32d1e2['filters']));if(_0x5dfa4c[_0x9087('0x34')][_0x9087('0x40')]){_0x1588f6['where']=_['merge'](_0x1588f6[_0x9087('0x3f')],{'$or':_[_0x9087('0x42')](_0x1588f6[_0x9087('0x37')],function(_0x5abc6d){var _0x317d96={};_0x317d96[_0x5abc6d]={'$like':'%'+_0x5dfa4c[_0x9087('0x34')][_0x9087('0x40')]+'%'};return _0x317d96;})});}_0x1588f6=_['merge']({},_0x1588f6,_0x5dfa4c[_0x9087('0x44')]);return _0x161661[_0x9087('0x8e')](_0x1588f6);}})[_0x9087('0x29')](function(_0x2488b1){if(_0x2488b1){_0x5c4ca9=_0x2488b1['length'];if(!_0x5dfa4c[_0x9087('0x34')][_0x9087('0x5a')](_0x9087('0x3c'))){_0x1588f6[_0x9087('0x21')]=qs[_0x9087('0x21')](_0x5dfa4c[_0x9087('0x34')][_0x9087('0x21')]);_0x1588f6[_0x9087('0x1f')]=qs[_0x9087('0x1f')](_0x5dfa4c[_0x9087('0x34')]['offset']);}return _0x161661['getAgents'](_0x1588f6);}})[_0x9087('0x29')](function(_0x4b8403){if(_0x4b8403){return _0x4b8403?{'count':_0x5c4ca9,'rows':_0x4b8403}:null;}})[_0x9087('0x29')](respondWithResult(_0x1e3750,null))['catch'](handleError(_0x1e3750,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3645358..e38cc70 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 _0xd06c=['emit','hook','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x306dc2,_0x25ebaa){var _0x38f5b8=function(_0x1ef917){while(--_0x1ef917){_0x306dc2['push'](_0x306dc2['shift']());}};_0x38f5b8(++_0x25ebaa);}(_0xd06c,0x19a));var _0xcd06=function(_0x44389f,_0x5ee930){_0x44389f=_0x44389f-0x0;var _0xc0c4a6=_0xd06c[_0x44389f];return _0xc0c4a6;};'use strict';var EventEmitter=require(_0xcd06('0x0'));var MailQueue=require(_0xcd06('0x1'))['db'][_0xcd06('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xcd06('0x3')](0x0);var events={'afterCreate':_0xcd06('0x4'),'afterUpdate':_0xcd06('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2beee2){return function(_0x5770d3,_0x58548c,_0x6edd62){MailQueueEvents[_0xcd06('0x6')](_0x2beee2+':'+_0x5770d3['id'],_0x5770d3);MailQueueEvents[_0xcd06('0x6')](_0x2beee2,_0x5770d3);_0x6edd62(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xcd06('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x167c=['events','save','update','remove','hasOwnProperty','hook','exports'];(function(_0xe41448,_0x2dd011){var _0x2ad7fa=function(_0x29f0af){while(--_0x29f0af){_0xe41448['push'](_0xe41448['shift']());}};_0x2ad7fa(++_0x2dd011);}(_0x167c,0x134));var _0xc167=function(_0x302b2d,_0x2dbd4f){_0x302b2d=_0x302b2d-0x0;var _0x57e94b=_0x167c[_0x302b2d];return _0x57e94b;};'use strict';var EventEmitter=require(_0xc167('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc167('0x1'),'afterUpdate':_0xc167('0x2'),'afterDestroy':_0xc167('0x3')};function emitEvent(_0x301eca){return function(_0x36f3c0,_0x1182d0,_0x27164c){MailQueueEvents['emit'](_0x301eca+':'+_0x36f3c0['id'],_0x36f3c0);MailQueueEvents['emit'](_0x301eca,_0x36f3c0);_0x27164c(null);};}for(var e in events){if(events[_0xc167('0x4')](e)){var event=events[e];MailQueue[_0xc167('0x5')](e,emitEvent(event));}}module[_0xc167('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d0db321..d580275 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 _0xa6eb=['MailQueue','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x22260d,_0x353af5){var _0x2e0cc8=function(_0xf3ae5d){while(--_0xf3ae5d){_0x22260d['push'](_0x22260d['shift']());}};_0x2e0cc8(++_0x353af5);}(_0xa6eb,0x181));var _0xba6e=function(_0x14c639,_0x21b561){_0x14c639=_0x14c639-0x0;var _0x3ddc85=_0xa6eb[_0x14c639];return _0x3ddc85;};'use strict';var _=require('lodash');var util=require(_0xba6e('0x0'));var logger=require(_0xba6e('0x1'))(_0xba6e('0x2'));var moment=require(_0xba6e('0x3'));var BPromise=require(_0xba6e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba6e('0x5'));var rimraf=require(_0xba6e('0x6'));var config=require(_0xba6e('0x7'));var attributes=require(_0xba6e('0x8'));module[_0xba6e('0x9')]=function(_0x38ba7e,_0x389a48){return _0x38ba7e[_0xba6e('0xa')](_0xba6e('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d4b=['./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1d4b,0xc4));var _0xb1d4=function(_0x5956ee,_0x54e5ec){_0x5956ee=_0x5956ee-0x0;var _0x269f1f=_0x1d4b[_0x5956ee];return _0x269f1f;};'use strict';var _=require(_0xb1d4('0x0'));var util=require(_0xb1d4('0x1'));var logger=require(_0xb1d4('0x2'))(_0xb1d4('0x3'));var moment=require('moment');var BPromise=require(_0xb1d4('0x4'));var rp=require(_0xb1d4('0x5'));var fs=require('fs');var path=require(_0xb1d4('0x6'));var rimraf=require('rimraf');var config=require(_0xb1d4('0x7'));var attributes=require(_0xb1d4('0x8'));module[_0xb1d4('0x9')]=function(_0x479b26,_0x258147){return _0x479b26['define'](_0xb1d4('0xa'),attributes,{'tableName':_0xb1d4('0xb'),'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 8961b78..2c7d4d2 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 _0xf3bb=['defaults','localhost','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1c6c30,_0x1dd870){var _0x4b343a=function(_0x50c685){while(--_0x50c685){_0x1c6c30['push'](_0x1c6c30['shift']());}};_0x4b343a(++_0x1dd870);}(_0xf3bb,0x1e0));var _0xbf3b=function(_0x2d7242,_0xba374f){_0x2d7242=_0x2d7242-0x0;var _0x4c77f=_0xf3bb[_0x2d7242];return _0x4c77f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf3b('0x0'));var BPromise=require(_0xbf3b('0x1'));var rs=require(_0xbf3b('0x2'));var fs=require('fs');var Redis=require(_0xbf3b('0x3'));var db=require(_0xbf3b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf3b('0x5'))(_0xbf3b('0x6'));var config=require(_0xbf3b('0x7'));var jayson=require(_0xbf3b('0x8'));var client=jayson[_0xbf3b('0x9')][_0xbf3b('0xa')]({'port':0x232a});config[_0xbf3b('0xb')]=_[_0xbf3b('0xc')](config['redis'],{'host':_0xbf3b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf3b('0xb')]));require(_0xbf3b('0xe'))[_0xbf3b('0xf')](socket);function respondWithRpcPromise(_0x2fce5f,_0xd8f5a8,_0x4fae24){return new BPromise(function(_0x1f27d3,_0x3c972f){return client['request'](_0x2fce5f,_0x4fae24)[_0xbf3b('0x10')](function(_0x28b542){logger['info'](_0xbf3b('0x11'),_0xd8f5a8,'request\x20sent');logger[_0xbf3b('0x12')](_0xbf3b('0x13'),_0xd8f5a8,'request\x20sent',JSON[_0xbf3b('0x14')](_0x28b542));if(_0x28b542[_0xbf3b('0x15')]){if(_0x28b542[_0xbf3b('0x15')][_0xbf3b('0x16')]===0x1f4){logger['error'](_0xbf3b('0x11'),_0xd8f5a8,_0x28b542[_0xbf3b('0x15')][_0xbf3b('0x17')]);return _0x3c972f(_0x28b542[_0xbf3b('0x15')][_0xbf3b('0x17')]);}logger[_0xbf3b('0x15')](_0xbf3b('0x11'),_0xd8f5a8,_0x28b542[_0xbf3b('0x15')][_0xbf3b('0x17')]);return _0x1f27d3(_0x28b542[_0xbf3b('0x15')][_0xbf3b('0x17')]);}else{logger[_0xbf3b('0x18')](_0xbf3b('0x11'),_0xd8f5a8,_0xbf3b('0x19'));_0x1f27d3(_0x28b542[_0xbf3b('0x1a')]['message']);}})[_0xbf3b('0x1b')](function(_0xd51307){logger[_0xbf3b('0x15')](_0xbf3b('0x11'),_0xd8f5a8,_0xd51307);_0x3c972f(_0xd51307);});});}exports[_0xbf3b('0x1c')]=function(_0x13b5e1){var _0x40fe25=this;return new Promise(function(_0x549353,_0xf9678b){return db[_0xbf3b('0x1d')][_0xbf3b('0x1e')]({'raw':_0x13b5e1[_0xbf3b('0x1f')]?_0x13b5e1[_0xbf3b('0x1f')][_0xbf3b('0x20')]===undefined?!![]:![]:!![],'where':_0x13b5e1[_0xbf3b('0x1f')]?_0x13b5e1[_0xbf3b('0x1f')][_0xbf3b('0x21')]||null:null,'attributes':_0x13b5e1[_0xbf3b('0x1f')]?_0x13b5e1[_0xbf3b('0x1f')][_0xbf3b('0x22')]||null:null,'limit':_0x13b5e1[_0xbf3b('0x1f')]?_0x13b5e1['options'][_0xbf3b('0x23')]||null:null,'include':_0x13b5e1[_0xbf3b('0x1f')]?_0x13b5e1[_0xbf3b('0x1f')][_0xbf3b('0x24')]?_[_0xbf3b('0x25')](_0x13b5e1[_0xbf3b('0x1f')][_0xbf3b('0x24')],function(_0x3d9e68){return{'model':db[_0x3d9e68[_0xbf3b('0x26')]],'as':_0x3d9e68['as'],'attributes':_0x3d9e68[_0xbf3b('0x22')],'include':_0x3d9e68[_0xbf3b('0x24')]?_[_0xbf3b('0x25')](_0x3d9e68[_0xbf3b('0x24')],function(_0x282c4d){return{'model':db[_0x282c4d[_0xbf3b('0x26')]],'as':_0x282c4d['as'],'attributes':_0x282c4d[_0xbf3b('0x22')],'include':_0x282c4d[_0xbf3b('0x24')]?_[_0xbf3b('0x25')](_0x282c4d[_0xbf3b('0x24')],function(_0x2083a2){return{'model':db[_0x2083a2[_0xbf3b('0x26')]],'as':_0x2083a2['as'],'attributes':_0x2083a2[_0xbf3b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbf3b('0x10')](function(_0x34b7c7){logger['info'](_0xbf3b('0x1c'),_0x13b5e1);logger[_0xbf3b('0x12')](_0xbf3b('0x1c'),_0x13b5e1,JSON[_0xbf3b('0x14')](_0x34b7c7));_0x549353(_0x34b7c7);})[_0xbf3b('0x1b')](function(_0x342377){logger[_0xbf3b('0x15')](_0xbf3b('0x1c'),_0x342377[_0xbf3b('0x17')],_0x13b5e1);_0xf9678b(_0x40fe25[_0xbf3b('0x15')](0x1f4,_0x342377[_0xbf3b('0x17')]));});});};exports[_0xbf3b('0x27')]=function(_0x45db52){var _0x3fbec3=this;return new Promise(function(_0x4adc20,_0x251e7f){return db[_0xbf3b('0x1d')][_0xbf3b('0x28')]({'raw':_0x45db52[_0xbf3b('0x1f')]?_0x45db52[_0xbf3b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x45db52['options']?_0x45db52[_0xbf3b('0x1f')]['where']||null:null,'attributes':_0x45db52[_0xbf3b('0x1f')]?_0x45db52[_0xbf3b('0x1f')]['attributes']||null:null,'include':_0x45db52[_0xbf3b('0x1f')]?_0x45db52[_0xbf3b('0x1f')][_0xbf3b('0x24')]?_[_0xbf3b('0x25')](_0x45db52[_0xbf3b('0x1f')][_0xbf3b('0x24')],function(_0x13baeb){return{'model':db[_0x13baeb[_0xbf3b('0x26')]],'as':_0x13baeb['as'],'attributes':_0x13baeb[_0xbf3b('0x22')],'include':_0x13baeb[_0xbf3b('0x24')]?_[_0xbf3b('0x25')](_0x13baeb[_0xbf3b('0x24')],function(_0x16c0e3){return{'model':db[_0x16c0e3['model']],'as':_0x16c0e3['as'],'attributes':_0x16c0e3[_0xbf3b('0x22')],'include':_0x16c0e3['include']?_[_0xbf3b('0x25')](_0x16c0e3[_0xbf3b('0x24')],function(_0xc15112){return{'model':db[_0xc15112[_0xbf3b('0x26')]],'as':_0xc15112['as'],'attributes':_0xc15112[_0xbf3b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbf3b('0x10')](function(_0x107aaa){logger['info'](_0xbf3b('0x27'),_0x45db52);logger[_0xbf3b('0x12')](_0xbf3b('0x27'),_0x45db52,JSON['stringify'](_0x107aaa));_0x4adc20(_0x107aaa);})[_0xbf3b('0x1b')](function(_0x59b8d9){logger['error'](_0xbf3b('0x27'),_0x59b8d9[_0xbf3b('0x17')],_0x45db52);_0x251e7f(_0x3fbec3[_0xbf3b('0x15')](0x1f4,_0x59b8d9[_0xbf3b('0x17')]));});});}; \ No newline at end of file +var _0xbb94=['socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetMailQueue','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowMailQueue','MailQueue','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x13d103,_0x335ad5){var _0x4c0dc2=function(_0x1e06e5){while(--_0x1e06e5){_0x13d103['push'](_0x13d103['shift']());}};_0x4c0dc2(++_0x335ad5);}(_0xbb94,0xde));var _0x4bb9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbb94[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4bb9('0x0'));var BPromise=require('bluebird');var rs=require(_0x4bb9('0x1'));var fs=require('fs');var Redis=require(_0x4bb9('0x2'));var db=require(_0x4bb9('0x3'))['db'];var utils=require(_0x4bb9('0x4'));var logger=require(_0x4bb9('0x5'))(_0x4bb9('0x6'));var config=require(_0x4bb9('0x7'));var jayson=require(_0x4bb9('0x8'));var client=jayson[_0x4bb9('0x9')]['http']({'port':0x232a});config[_0x4bb9('0xa')]=_[_0x4bb9('0xb')](config[_0x4bb9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4bb9('0xc'))(new Redis(config[_0x4bb9('0xa')]));require('./mailQueue.socket')[_0x4bb9('0xd')](socket);function respondWithRpcPromise(_0x491671,_0x44aa5a,_0xd3731a){return new BPromise(function(_0x56e6f6,_0x5368b7){return client[_0x4bb9('0xe')](_0x491671,_0xd3731a)[_0x4bb9('0xf')](function(_0x4e8b99){logger[_0x4bb9('0x10')](_0x4bb9('0x11'),_0x44aa5a,'request\x20sent');logger[_0x4bb9('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x44aa5a,_0x4bb9('0x13'),JSON[_0x4bb9('0x14')](_0x4e8b99));if(_0x4e8b99[_0x4bb9('0x15')]){if(_0x4e8b99[_0x4bb9('0x15')][_0x4bb9('0x16')]===0x1f4){logger['error'](_0x4bb9('0x11'),_0x44aa5a,_0x4e8b99[_0x4bb9('0x15')][_0x4bb9('0x17')]);return _0x5368b7(_0x4e8b99[_0x4bb9('0x15')][_0x4bb9('0x17')]);}logger[_0x4bb9('0x15')](_0x4bb9('0x11'),_0x44aa5a,_0x4e8b99['error'][_0x4bb9('0x17')]);return _0x56e6f6(_0x4e8b99[_0x4bb9('0x15')]['message']);}else{logger[_0x4bb9('0x10')]('MailQueue,\x20%s,\x20%s',_0x44aa5a,_0x4bb9('0x13'));_0x56e6f6(_0x4e8b99[_0x4bb9('0x18')]['message']);}})['catch'](function(_0x2474e0){logger[_0x4bb9('0x15')](_0x4bb9('0x11'),_0x44aa5a,_0x2474e0);_0x5368b7(_0x2474e0);});});}exports[_0x4bb9('0x19')]=function(_0xeed6ae){var _0x4f0b2e=this;return new Promise(function(_0x1e8512,_0x302651){return db['MailQueue'][_0x4bb9('0x1a')]({'raw':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')][_0x4bb9('0x1c')]===undefined?!![]:![]:!![],'where':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')][_0x4bb9('0x1d')]||null:null,'attributes':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')][_0x4bb9('0x1e')]||null:null,'limit':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')][_0x4bb9('0x1f')]||null:null,'include':_0xeed6ae[_0x4bb9('0x1b')]?_0xeed6ae[_0x4bb9('0x1b')]['include']?_[_0x4bb9('0x20')](_0xeed6ae['options'][_0x4bb9('0x21')],function(_0x5200d6){return{'model':db[_0x5200d6[_0x4bb9('0x22')]],'as':_0x5200d6['as'],'attributes':_0x5200d6[_0x4bb9('0x1e')],'include':_0x5200d6['include']?_[_0x4bb9('0x20')](_0x5200d6[_0x4bb9('0x21')],function(_0x25025a){return{'model':db[_0x25025a[_0x4bb9('0x22')]],'as':_0x25025a['as'],'attributes':_0x25025a[_0x4bb9('0x1e')],'include':_0x25025a['include']?_[_0x4bb9('0x20')](_0x25025a[_0x4bb9('0x21')],function(_0x5f216e){return{'model':db[_0x5f216e[_0x4bb9('0x22')]],'as':_0x5f216e['as'],'attributes':_0x5f216e[_0x4bb9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4bb9('0xf')](function(_0x513b05){logger[_0x4bb9('0x10')](_0x4bb9('0x19'),_0xeed6ae);logger[_0x4bb9('0x12')](_0x4bb9('0x19'),_0xeed6ae,JSON[_0x4bb9('0x14')](_0x513b05));_0x1e8512(_0x513b05);})[_0x4bb9('0x23')](function(_0x2e48c7){logger[_0x4bb9('0x15')](_0x4bb9('0x19'),_0x2e48c7['message'],_0xeed6ae);_0x302651(_0x4f0b2e[_0x4bb9('0x15')](0x1f4,_0x2e48c7['message']));});});};exports[_0x4bb9('0x24')]=function(_0x5c38b0){var _0x472fef=this;return new Promise(function(_0x1bcf65,_0x56f00f){return db[_0x4bb9('0x25')][_0x4bb9('0x26')]({'raw':_0x5c38b0[_0x4bb9('0x1b')]?_0x5c38b0[_0x4bb9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5c38b0['options']?_0x5c38b0[_0x4bb9('0x1b')][_0x4bb9('0x1d')]||null:null,'attributes':_0x5c38b0['options']?_0x5c38b0[_0x4bb9('0x1b')]['attributes']||null:null,'include':_0x5c38b0[_0x4bb9('0x1b')]?_0x5c38b0[_0x4bb9('0x1b')][_0x4bb9('0x21')]?_[_0x4bb9('0x20')](_0x5c38b0[_0x4bb9('0x1b')]['include'],function(_0x10a1ca){return{'model':db[_0x10a1ca[_0x4bb9('0x22')]],'as':_0x10a1ca['as'],'attributes':_0x10a1ca['attributes'],'include':_0x10a1ca[_0x4bb9('0x21')]?_['map'](_0x10a1ca[_0x4bb9('0x21')],function(_0x80225d){return{'model':db[_0x80225d[_0x4bb9('0x22')]],'as':_0x80225d['as'],'attributes':_0x80225d[_0x4bb9('0x1e')],'include':_0x80225d[_0x4bb9('0x21')]?_[_0x4bb9('0x20')](_0x80225d[_0x4bb9('0x21')],function(_0x2a156e){return{'model':db[_0x2a156e[_0x4bb9('0x22')]],'as':_0x2a156e['as'],'attributes':_0x2a156e[_0x4bb9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4bb9('0xf')](function(_0xb8cf4d){logger['info'](_0x4bb9('0x24'),_0x5c38b0);logger[_0x4bb9('0x12')](_0x4bb9('0x24'),_0x5c38b0,JSON[_0x4bb9('0x14')](_0xb8cf4d));_0x1bcf65(_0xb8cf4d);})[_0x4bb9('0x23')](function(_0x35f6b6){logger[_0x4bb9('0x15')](_0x4bb9('0x24'),_0x35f6b6[_0x4bb9('0x17')],_0x5c38b0);_0x56f00f(_0x472fef[_0x4bb9('0x15')](0x1f4,_0x35f6b6[_0x4bb9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8290f1c..d93b56d 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 _0x54bd=['register','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x38b91b,_0x36a12e){var _0x304415=function(_0x3f62ec){while(--_0x3f62ec){_0x38b91b['push'](_0x38b91b['shift']());}};_0x304415(++_0x36a12e);}(_0x54bd,0x9a));var _0xd54b=function(_0x35a1cb,_0x5985c3){_0x35a1cb=_0x35a1cb-0x0;var _0x2cd095=_0x54bd[_0x35a1cb];return _0x2cd095;};'use strict';var MailQueueEvents=require(_0xd54b('0x0'));var events=[_0xd54b('0x1'),_0xd54b('0x2'),_0xd54b('0x3')];function createListener(_0x2391b6,_0x5e7034){return function(_0x4f22d4){_0x5e7034[_0xd54b('0x4')](_0x2391b6,_0x4f22d4);};}function removeListener(_0x18bbf6,_0x4dc045){return function(){MailQueueEvents[_0xd54b('0x5')](_0x18bbf6,_0x4dc045);};}exports[_0xd54b('0x6')]=function(_0x52190c){for(var _0x21a670=0x0,_0xff037c=events['length'];_0x21a670<_0xff037c;_0x21a670++){var _0x8046b2=events[_0x21a670];var _0x171422=createListener(_0xd54b('0x7')+_0x8046b2,_0x52190c);MailQueueEvents['on'](_0x8046b2,_0x171422);}}; \ No newline at end of file +var _0x1275=['removeListener','register','length','mailQueue:','remove','update'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x1275,0x1a8));var _0x5127=function(_0x4f64a7,_0x2f6f18){_0x4f64a7=_0x4f64a7-0x0;var _0x207e54=_0x1275[_0x4f64a7];return _0x207e54;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x5127('0x0'),_0x5127('0x1')];function createListener(_0x569992,_0x2233c9){return function(_0x1b6c73){_0x2233c9['emit'](_0x569992,_0x1b6c73);};}function removeListener(_0x510ceb,_0xb7a8df){return function(){MailQueueEvents[_0x5127('0x2')](_0x510ceb,_0xb7a8df);};}exports[_0x5127('0x3')]=function(_0x42e9be){for(var _0x16e302=0x0,_0x3d1a18=events[_0x5127('0x4')];_0x16e302<_0x3d1a18;_0x16e302++){var _0x512251=events[_0x16e302];var _0x2b5cb6=createListener(_0x5127('0x5')+_0x512251,_0x42e9be);MailQueueEvents['on'](_0x512251,_0x2b5cb6);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 03cc3dc..4d5d776 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 _0x5673=['describe','/:id','show','post','create','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3f330e,_0x4d3abd){var _0x11c1d1=function(_0x449cb9){while(--_0x449cb9){_0x3f330e['push'](_0x3f330e['shift']());}};_0x11c1d1(++_0x4d3abd);}(_0x5673,0x183));var _0x3567=function(_0x3fe440,_0x18d0cb){_0x3fe440=_0x3fe440-0x0;var _0x30cf95=_0x5673[_0x3fe440];return _0x30cf95;};'use strict';var multer=require(_0x3567('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3567('0x1'));var express=require(_0x3567('0x2'));var router=express[_0x3567('0x3')]();var fs_extra=require(_0x3567('0x4'));var auth=require(_0x3567('0x5'));var interaction=require(_0x3567('0x6'));var config=require('../../config/environment');var controller=require(_0x3567('0x7'));router[_0x3567('0x8')]('/',auth[_0x3567('0x9')](),controller[_0x3567('0xa')]);router[_0x3567('0x8')](_0x3567('0xb'),auth[_0x3567('0x9')](),controller[_0x3567('0xc')]);router['get'](_0x3567('0xd'),auth[_0x3567('0x9')](),controller[_0x3567('0xe')]);router[_0x3567('0xf')]('/',auth['isAuthenticated'](),controller[_0x3567('0x10')]);router['put'](_0x3567('0xd'),auth[_0x3567('0x9')](),controller['update']);router['delete'](_0x3567('0xd'),auth['isAuthenticated'](),controller[_0x3567('0x11')]);module[_0x3567('0x12')]=router; \ No newline at end of file +var _0xe63f=['describe','show','post','create','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xe63f,0xc7));var _0xfe63=function(_0xd4e9a2,_0x5d2475){_0xd4e9a2=_0xd4e9a2-0x0;var _0x10ceb7=_0xe63f[_0xd4e9a2];return _0x10ceb7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfe63('0x0'));var express=require(_0xfe63('0x1'));var router=express[_0xfe63('0x2')]();var fs_extra=require(_0xfe63('0x3'));var auth=require(_0xfe63('0x4'));var interaction=require(_0xfe63('0x5'));var config=require(_0xfe63('0x6'));var controller=require(_0xfe63('0x7'));router[_0xfe63('0x8')]('/',auth[_0xfe63('0x9')](),controller[_0xfe63('0xa')]);router[_0xfe63('0x8')]('/describe',auth[_0xfe63('0x9')](),controller[_0xfe63('0xb')]);router[_0xfe63('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfe63('0xc')]);router[_0xfe63('0xd')]('/',auth[_0xfe63('0x9')](),controller[_0xfe63('0xe')]);router[_0xfe63('0xf')](_0xfe63('0x10'),auth[_0xfe63('0x9')](),controller[_0xfe63('0x11')]);router[_0xfe63('0x12')](_0xfe63('0x10'),auth[_0xfe63('0x9')](),controller[_0xfe63('0x13')]);module[_0xfe63('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index e509578..2726ccb 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 _0x3dd8=['DATE','sequelize','STRING'];(function(_0x1273fb,_0x2beed5){var _0x52cd74=function(_0x3239dd){while(--_0x3239dd){_0x1273fb['push'](_0x1273fb['shift']());}};_0x52cd74(++_0x2beed5);}(_0x3dd8,0x199));var _0x83dd=function(_0x2e7a97,_0x20748d){_0x2e7a97=_0x2e7a97-0x0;var _0x2d40ff=_0x3dd8[_0x2e7a97];return _0x2d40ff;};'use strict';var moment=require('moment');var Sequelize=require(_0x83dd('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x83dd('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x83dd('0x2')]},'exitAt':{'type':Sequelize[_0x83dd('0x2')]},'reason':{'type':Sequelize[_0x83dd('0x1')]}}; \ No newline at end of file +var _0x692c=['DATE','moment','sequelize','exports','STRING'];(function(_0x35f322,_0xe60d04){var _0x30cf95=function(_0x10d171){while(--_0x10d171){_0x35f322['push'](_0x35f322['shift']());}};_0x30cf95(++_0xe60d04);}(_0x692c,0x6a));var _0xc692=function(_0x626bdc,_0xf35622){_0x626bdc=_0x626bdc-0x0;var _0xde1e27=_0x692c[_0x626bdc];return _0xde1e27;};'use strict';var moment=require(_0xc692('0x0'));var Sequelize=require(_0xc692('0x1'));module[_0xc692('0x2')]={'uniqueid':{'type':Sequelize[_0xc692('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc692('0x3')]},'joinAt':{'type':Sequelize[_0xc692('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc692('0x4')]},'exitAt':{'type':Sequelize[_0xc692('0x4')]},'reason':{'type':Sequelize[_0xc692('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e463b13..8cb4f6f 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 _0xa46e=['body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','MailQueueReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create'];(function(_0xd825ac,_0x570ed6){var _0x1f503d=function(_0x328b31){while(--_0x328b31){_0xd825ac['push'](_0xd825ac['shift']());}};_0x1f503d(++_0x570ed6);}(_0xa46e,0x8a));var _0xea46=function(_0x260b48,_0x117977){_0x260b48=_0x260b48-0x0;var _0x3f730b=_0xa46e[_0x260b48];return _0x3f730b;};'use strict';var emlformat=require(_0xea46('0x0'));var rimraf=require(_0xea46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea46('0x2'));var rp=require(_0xea46('0x3'));var moment=require(_0xea46('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea46('0x5'));var util=require('util');var path=require(_0xea46('0x6'));var sox=require('sox');var csv=require(_0xea46('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea46('0x8'));var _=require(_0xea46('0x9'));var squel=require('squel');var crypto=require(_0xea46('0xa'));var jsforce=require(_0xea46('0xb'));var deskjs=require(_0xea46('0xc'));var toCsv=require(_0xea46('0x7'));var querystring=require(_0xea46('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea46('0xe'));var as=require(_0xea46('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea46('0x10'))(_0xea46('0x11'));var utils=require(_0xea46('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xea46('0x13'));var db=require(_0xea46('0x14'))['db'];function respondWithStatusCode(_0x4e10f3,_0x13390c){_0x13390c=_0x13390c||0xcc;return function(_0x1a4fe2){if(_0x1a4fe2){return _0x4e10f3['sendStatus'](_0x13390c);}return _0x4e10f3[_0xea46('0x15')](_0x13390c)['end']();};}function respondWithResult(_0x3024af,_0x42c328){_0x42c328=_0x42c328||0xc8;return function(_0x6c4bc4){if(_0x6c4bc4){return _0x3024af[_0xea46('0x15')](_0x42c328)[_0xea46('0x16')](_0x6c4bc4);}};}function respondWithFilteredResult(_0x2ef436,_0x81ee45){return function(_0x20a79c){if(_0x20a79c){var _0x176ad2=typeof _0x81ee45['offset']===_0xea46('0x17')&&typeof _0x81ee45[_0xea46('0x18')]===_0xea46('0x17');var _0x59f28e=_0x20a79c['count'];var _0x19d5c1=_0x176ad2?0x0:_0x81ee45[_0xea46('0x19')];var _0x5cf5dd=_0x176ad2?_0x20a79c['count']:_0x81ee45[_0xea46('0x19')]+_0x81ee45[_0xea46('0x18')];var _0x4ff93d;if(_0x5cf5dd>=_0x59f28e){_0x5cf5dd=_0x59f28e;_0x4ff93d=0xc8;}else{_0x4ff93d=0xce;}_0x2ef436[_0xea46('0x15')](_0x4ff93d);return _0x2ef436[_0xea46('0x1a')](_0xea46('0x1b'),_0x19d5c1+'-'+_0x5cf5dd+'/'+_0x59f28e)[_0xea46('0x16')](_0x20a79c);}return null;};}function patchUpdates(_0x53b8db){return function(_0x2b6491){try{jsonpatch['apply'](_0x2b6491,_0x53b8db,!![]);}catch(_0x515e32){return BPromise[_0xea46('0x1c')](_0x515e32);}return _0x2b6491['save']();};}function saveUpdates(_0x4cc673,_0x5064d8){return function(_0x3b25fe){if(_0x3b25fe){return _0x3b25fe[_0xea46('0x1d')](_0x4cc673)[_0xea46('0x1e')](function(_0x5beb44){return _0x5beb44;});}return null;};}function removeEntity(_0x16f8fa,_0x59b10d){return function(_0x12e688){if(_0x12e688){return _0x12e688[_0xea46('0x1f')]()['then'](function(){_0x16f8fa[_0xea46('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3a8f,_0x114bf9){return function(_0xd4cf78){if(!_0xd4cf78){_0x2b3a8f['sendStatus'](0x194);}return _0xd4cf78;};}function handleError(_0x5d2de1,_0x44e797){_0x44e797=_0x44e797||0x1f4;return function(_0x38ac07){logger['error'](_0x38ac07[_0xea46('0x20')]);if(_0x38ac07['name']){delete _0x38ac07[_0xea46('0x21')];}_0x5d2de1['status'](_0x44e797)[_0xea46('0x22')](_0x38ac07);};}exports[_0xea46('0x23')]=function(_0x6710ae,_0x44517d){var _0x146995={},_0x174345={},_0x4a5149={'count':0x0,'rows':[]};var _0x382bbc=_[_0xea46('0x24')](db[_0xea46('0x25')]['rawAttributes'],function(_0x3e7856){return{'name':_0x3e7856[_0xea46('0x26')],'type':_0x3e7856[_0xea46('0x27')]['key']};});_0x174345['model']=_['map'](_0x382bbc,_0xea46('0x21'));_0x174345[_0xea46('0x28')]=_[_0xea46('0x29')](_0x6710ae[_0xea46('0x28')]);_0x174345[_0xea46('0x2a')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],_0x174345[_0xea46('0x28')]);_0x146995[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],qs['fields'](_0x6710ae[_0xea46('0x28')][_0xea46('0x2e')]));_0x146995[_0xea46('0x2d')]=_0x146995[_0xea46('0x2d')][_0xea46('0x2f')]?_0x146995[_0xea46('0x2d')]:_0x174345[_0xea46('0x2c')];if(!_0x6710ae['query'][_0xea46('0x30')](_0xea46('0x31'))){_0x146995[_0xea46('0x18')]=qs[_0xea46('0x18')](_0x6710ae[_0xea46('0x28')]['limit']);_0x146995['offset']=qs[_0xea46('0x19')](_0x6710ae[_0xea46('0x28')]['offset']);}_0x146995[_0xea46('0x32')]=qs[_0xea46('0x33')](_0x6710ae[_0xea46('0x28')][_0xea46('0x33')]);_0x146995['where']=qs['filters'](_[_0xea46('0x34')](_0x6710ae['query'],_0x174345[_0xea46('0x2a')]),_0x382bbc);if(_0x6710ae[_0xea46('0x28')]['filter']){_0x146995[_0xea46('0x35')]=_[_0xea46('0x36')](_0x146995['where'],{'$or':_[_0xea46('0x24')](_0x382bbc,function(_0xefad3e){if(_0xefad3e['type']!==_0xea46('0x37')){var _0x41e9e8={};_0x41e9e8[_0xefad3e[_0xea46('0x21')]]={'$like':'%'+_0x6710ae[_0xea46('0x28')]['filter']+'%'};return _0x41e9e8;}})});}_0x146995=_[_0xea46('0x36')]({},_0x146995,_0x6710ae[_0xea46('0x38')]);var _0x338c2d={'where':_0x146995[_0xea46('0x35')]};return db[_0xea46('0x25')]['count'](_0x338c2d)[_0xea46('0x1e')](function(_0xdb2e11){_0x4a5149['count']=_0xdb2e11;if(_0x6710ae[_0xea46('0x28')][_0xea46('0x39')]){_0x146995[_0xea46('0x3a')]=[{'all':!![]}];}return db[_0xea46('0x25')]['findAll'](_0x146995);})[_0xea46('0x1e')](function(_0x1cc8f8){_0x4a5149[_0xea46('0x3b')]=_0x1cc8f8;return _0x4a5149;})['then'](respondWithFilteredResult(_0x44517d,_0x146995))[_0xea46('0x3c')](handleError(_0x44517d,null));};exports[_0xea46('0x3d')]=function(_0x2c9491,_0x32c81c){var _0x3164c5={'raw':!![],'where':{'id':_0x2c9491[_0xea46('0x3e')]['id']}},_0xc45d74={};_0xc45d74[_0xea46('0x2c')]=_[_0xea46('0x29')](db[_0xea46('0x25')][_0xea46('0x3f')]);_0xc45d74[_0xea46('0x28')]=_[_0xea46('0x29')](_0x2c9491[_0xea46('0x28')]);_0xc45d74[_0xea46('0x2a')]=_['intersection'](_0xc45d74['model'],_0xc45d74[_0xea46('0x28')]);_0x3164c5[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0xc45d74[_0xea46('0x2c')],qs['fields'](_0x2c9491['query']['fields']));_0x3164c5[_0xea46('0x2d')]=_0x3164c5[_0xea46('0x2d')]['length']?_0x3164c5[_0xea46('0x2d')]:_0xc45d74[_0xea46('0x2c')];if(_0x2c9491[_0xea46('0x28')][_0xea46('0x39')]){_0x3164c5[_0xea46('0x3a')]=[{'all':!![]}];}_0x3164c5=_['merge']({},_0x3164c5,_0x2c9491[_0xea46('0x38')]);return db['MailQueueReport'][_0xea46('0x40')](_0x3164c5)[_0xea46('0x1e')](handleEntityNotFound(_0x32c81c,null))[_0xea46('0x1e')](respondWithResult(_0x32c81c,null))[_0xea46('0x3c')](handleError(_0x32c81c,null));};exports[_0xea46('0x41')]=function(_0x1260d1,_0x36f697){return db['MailQueueReport'][_0xea46('0x41')](_0x1260d1[_0xea46('0x42')],{})['then'](respondWithResult(_0x36f697,0xc9))[_0xea46('0x3c')](handleError(_0x36f697,null));};exports[_0xea46('0x1d')]=function(_0x24d929,_0x548572){if(_0x24d929['body']['id']){delete _0x24d929[_0xea46('0x42')]['id'];}return db[_0xea46('0x25')][_0xea46('0x40')]({'where':{'id':_0x24d929[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x548572,null))[_0xea46('0x1e')](saveUpdates(_0x24d929[_0xea46('0x42')],null))[_0xea46('0x1e')](respondWithResult(_0x548572,null))[_0xea46('0x3c')](handleError(_0x548572,null));};exports[_0xea46('0x1f')]=function(_0x48ad1c,_0x2144a0){return db['MailQueueReport'][_0xea46('0x40')]({'where':{'id':_0x48ad1c[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x2144a0,null))['then'](removeEntity(_0x2144a0,null))[_0xea46('0x3c')](handleError(_0x2144a0,null));};exports[_0xea46('0x43')]=function(_0x334937,_0x2f49c8){return db['MailQueueReport']['describe']()[_0xea46('0x1e')](respondWithResult(_0x2f49c8,null))[_0xea46('0x3c')](handleError(_0x2f49c8,null));}; \ No newline at end of file +var _0x0598=['include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','then','end','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x0598,0x92));var _0x8059=function(_0x295d2e,_0x33501e){_0x295d2e=_0x295d2e-0x0;var _0x42cfec=_0x0598[_0x295d2e];return _0x42cfec;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){_0x21ac82[_0x8059('0x13')](0xcc)[_0x8059('0x1e')]();});}};}function handleEntityNotFound(_0x59d3a6,_0x140f64){return function(_0x2cd179){if(!_0x2cd179){_0x59d3a6[_0x8059('0x12')](0x194);}return _0x2cd179;};}function handleError(_0x3e2d2b,_0x202b30){_0x202b30=_0x202b30||0x1f4;return function(_0x54b88b){logger[_0x8059('0x1f')](_0x54b88b[_0x8059('0x20')]);if(_0x54b88b[_0x8059('0x21')]){delete _0x54b88b['name'];}_0x3e2d2b['status'](_0x202b30)['send'](_0x54b88b);};}exports[_0x8059('0x22')]=function(_0xbebe0e,_0xc32b1f){var _0x1009af={},_0x59abe9={},_0x1eb71b={'count':0x0,'rows':[]};var _0x50b737=_[_0x8059('0x23')](db[_0x8059('0x24')]['rawAttributes'],function(_0x3814f5){return{'name':_0x3814f5[_0x8059('0x25')],'type':_0x3814f5[_0x8059('0x26')][_0x8059('0x27')]};});_0x59abe9[_0x8059('0x28')]=_[_0x8059('0x23')](_0x50b737,_0x8059('0x21'));_0x59abe9[_0x8059('0x29')]=_['keys'](_0xbebe0e[_0x8059('0x29')]);_0x59abe9[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],_0x59abe9[_0x8059('0x29')]);_0x1009af['attributes']=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],qs[_0x8059('0x2c')](_0xbebe0e[_0x8059('0x29')][_0x8059('0x2c')]));_0x1009af[_0x8059('0x2d')]=_0x1009af[_0x8059('0x2d')][_0x8059('0x2e')]?_0x1009af[_0x8059('0x2d')]:_0x59abe9[_0x8059('0x28')];if(!_0xbebe0e['query'][_0x8059('0x2f')]('nolimit')){_0x1009af[_0x8059('0x16')]=qs['limit'](_0xbebe0e['query'][_0x8059('0x16')]);_0x1009af['offset']=qs[_0x8059('0x18')](_0xbebe0e['query'][_0x8059('0x18')]);}_0x1009af['order']=qs[_0x8059('0x30')](_0xbebe0e[_0x8059('0x29')]['sort']);_0x1009af[_0x8059('0x31')]=qs[_0x8059('0x2a')](_[_0x8059('0x32')](_0xbebe0e['query'],_0x59abe9[_0x8059('0x2a')]),_0x50b737);if(_0xbebe0e['query'][_0x8059('0x33')]){_0x1009af['where']=_[_0x8059('0x34')](_0x1009af[_0x8059('0x31')],{'$or':_[_0x8059('0x23')](_0x50b737,function(_0xb3b3c1){if(_0xb3b3c1['type']!==_0x8059('0x35')){var _0x55aaec={};_0x55aaec[_0xb3b3c1['name']]={'$like':'%'+_0xbebe0e[_0x8059('0x29')][_0x8059('0x33')]+'%'};return _0x55aaec;}})});}_0x1009af=_[_0x8059('0x34')]({},_0x1009af,_0xbebe0e[_0x8059('0x36')]);var _0x2f68b0={'where':_0x1009af['where']};return db['MailQueueReport']['count'](_0x2f68b0)['then'](function(_0x373e10){_0x1eb71b[_0x8059('0x17')]=_0x373e10;if(_0xbebe0e[_0x8059('0x29')]['includeAll']){_0x1009af[_0x8059('0x37')]=[{'all':!![]}];}return db[_0x8059('0x24')]['findAll'](_0x1009af);})[_0x8059('0x1d')](function(_0x2980cb){_0x1eb71b[_0x8059('0x38')]=_0x2980cb;return _0x1eb71b;})['then'](respondWithFilteredResult(_0xc32b1f,_0x1009af))[_0x8059('0x39')](handleError(_0xc32b1f,null));};exports[_0x8059('0x3a')]=function(_0x57eb56,_0x338493){var _0x280047={'raw':!![],'where':{'id':_0x57eb56[_0x8059('0x3b')]['id']}},_0x3f00de={};_0x3f00de[_0x8059('0x28')]=_[_0x8059('0x3c')](db[_0x8059('0x24')][_0x8059('0x3d')]);_0x3f00de[_0x8059('0x29')]=_[_0x8059('0x3c')](_0x57eb56[_0x8059('0x29')]);_0x3f00de[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],_0x3f00de[_0x8059('0x29')]);_0x280047[_0x8059('0x2d')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],qs[_0x8059('0x2c')](_0x57eb56[_0x8059('0x29')][_0x8059('0x2c')]));_0x280047[_0x8059('0x2d')]=_0x280047[_0x8059('0x2d')]['length']?_0x280047[_0x8059('0x2d')]:_0x3f00de['model'];if(_0x57eb56['query'][_0x8059('0x3e')]){_0x280047['include']=[{'all':!![]}];}_0x280047=_[_0x8059('0x34')]({},_0x280047,_0x57eb56['options']);return db[_0x8059('0x24')][_0x8059('0x3f')](_0x280047)[_0x8059('0x1d')](handleEntityNotFound(_0x338493,null))[_0x8059('0x1d')](respondWithResult(_0x338493,null))[_0x8059('0x39')](handleError(_0x338493,null));};exports[_0x8059('0x40')]=function(_0x538ab6,_0x301dca){return db['MailQueueReport'][_0x8059('0x40')](_0x538ab6[_0x8059('0x41')],{})[_0x8059('0x1d')](respondWithResult(_0x301dca,0xc9))['catch'](handleError(_0x301dca,null));};exports[_0x8059('0x1b')]=function(_0x120665,_0x46bec8){if(_0x120665[_0x8059('0x41')]['id']){delete _0x120665['body']['id'];}return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x120665[_0x8059('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46bec8,null))[_0x8059('0x1d')](saveUpdates(_0x120665['body'],null))['then'](respondWithResult(_0x46bec8,null))[_0x8059('0x39')](handleError(_0x46bec8,null));};exports['destroy']=function(_0x20caa3,_0x54d2d2){return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x20caa3['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x54d2d2,null))['then'](removeEntity(_0x54d2d2,null))[_0x8059('0x39')](handleError(_0x54d2d2,null));};exports[_0x8059('0x42')]=function(_0x429cf0,_0x5d5f16){return db[_0x8059('0x24')]['describe']()[_0x8059('0x1d')](respondWithResult(_0x5d5f16,null))[_0x8059('0x39')](handleError(_0x5d5f16,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a4dddef..4f991c5 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 _0x07b5=['define','report_mail_queue','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','./mailQueueReport.attributes'];(function(_0x1f59e5,_0x5189a4){var _0x30a627=function(_0x250a58){while(--_0x250a58){_0x1f59e5['push'](_0x1f59e5['shift']());}};_0x30a627(++_0x5189a4);}(_0x07b5,0x1ed));var _0x507b=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0x07b5[_0xe39824];return _0x4bc31e;};'use strict';var _=require(_0x507b('0x0'));var util=require('util');var logger=require(_0x507b('0x1'))('api');var moment=require(_0x507b('0x2'));var BPromise=require('bluebird');var rp=require(_0x507b('0x3'));var fs=require('fs');var path=require(_0x507b('0x4'));var rimraf=require(_0x507b('0x5'));var config=require('../../config/environment');var attributes=require(_0x507b('0x6'));module['exports']=function(_0x1553d6,_0x511ac8){return _0x1553d6[_0x507b('0x7')]('MailQueueReport',attributes,{'tableName':_0x507b('0x8'),'paranoid':![],'indexes':[{'name':_0x507b('0x9'),'fields':[_0x507b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde7b=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xde7b,0x111));var _0xbde7=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xde7b[_0x346737];return _0x1ade2e;};'use strict';var _=require('lodash');var util=require(_0xbde7('0x0'));var logger=require(_0xbde7('0x1'))('api');var moment=require(_0xbde7('0x2'));var BPromise=require(_0xbde7('0x3'));var rp=require(_0xbde7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbde7('0x5'));var config=require(_0xbde7('0x6'));var attributes=require(_0xbde7('0x7'));module[_0xbde7('0x8')]=function(_0x49c793,_0x276130){return _0x49c793[_0xbde7('0x9')](_0xbde7('0xa'),attributes,{'tableName':_0xbde7('0xb'),'paranoid':![],'indexes':[{'name':_0xbde7('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3c528c3..ee23797 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x3e5d87,_0x4f6802){var _0x220928=function(_0x2b7fdc){while(--_0x2b7fdc){_0x3e5d87['push'](_0x3e5d87['shift']());}};_0x220928(++_0x4f6802);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x54562f,_0x4a9eb7){var _0x2f738c=function(_0x4bf29a){while(--_0x4bf29a){_0x54562f['push'](_0x54562f['shift']());}};_0x2f738c(++_0x4a9eb7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1aacc4,_0xca5ccb){_0x1aacc4=_0x1aacc4-0x0;var _0x448919=_0x5f2f[_0x1aacc4];return _0x448919;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 9cbfb25..38a97e8 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2c4bc8,_0x116642){var _0x122241=function(_0x6c3c70){while(--_0x6c3c70){_0x2c4bc8['push'](_0x2c4bc8['shift']());}};_0x122241(++_0x116642);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xcb91[_0x334599];return _0x4cdff2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x126923,_0x5c773c){var _0x83797c=function(_0x2700ff){while(--_0x2700ff){_0x126923['push'](_0x126923['shift']());}};_0x83797c(++_0x5c773c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x28014d,_0x383e2f){_0x28014d=_0x28014d-0x0;var _0x2572cc=_0xcb91[_0x28014d];return _0x2572cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 25252bf..8535aac 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 _0x6e6c=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc6e6('0x2')]},'authentication':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc6e6('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc6e6('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xc6e6('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc6e6('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x94df=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0xd7ae17,_0x2f5a89){var _0x337cce=function(_0x2908d4){while(--_0x2908d4){_0xd7ae17['push'](_0xd7ae17['shift']());}};_0x337cce(++_0x2f5a89);}(_0x94df,0xa3));var _0xf94d=function(_0x12403f,_0x3488c1){_0x12403f=_0x12403f-0x0;var _0x1ccbde=_0x94df[_0x12403f];return _0x1ccbde;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'description':{'type':Sequelize[_0xf94d('0x2')]},'host':{'type':Sequelize[_0xf94d('0x2')]},'authentication':{'type':Sequelize[_0xf94d('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf94d('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf94d('0x4')]},'tls':{'type':Sequelize[_0xf94d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf94d('0x2')],'defaultValue':_0xf94d('0x5')},'connTimeout':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf94d('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index f73481a..cb6d98d 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 _0x7e43=['request-promise','path','rimraf','./mailServerIn.attributes','exports','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c6e91,_0x3451a7){var _0x135169=function(_0x1beee0){while(--_0x1beee0){_0x4c6e91['push'](_0x4c6e91['shift']());}};_0x135169(++_0x3451a7);}(_0x7e43,0x96));var _0x37e4=function(_0x1fa658,_0x411d06){_0x1fa658=_0x1fa658-0x0;var _0xcca109=_0x7e43[_0x1fa658];return _0xcca109;};'use strict';var _=require(_0x37e4('0x0'));var util=require(_0x37e4('0x1'));var logger=require(_0x37e4('0x2'))(_0x37e4('0x3'));var moment=require(_0x37e4('0x4'));var BPromise=require(_0x37e4('0x5'));var rp=require(_0x37e4('0x6'));var fs=require('fs');var path=require(_0x37e4('0x7'));var rimraf=require(_0x37e4('0x8'));var config=require('../../config/environment');var attributes=require(_0x37e4('0x9'));module[_0x37e4('0xa')]=function(_0x266185,_0x10ab4a){return _0x266185['define']('MailServerIn',attributes,{'tableName':_0x37e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b01=['path','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x299714,_0x542387){var _0x10c64f=function(_0x641afd){while(--_0x641afd){_0x299714['push'](_0x299714['shift']());}};_0x10c64f(++_0x542387);}(_0x7b01,0xe7));var _0x17b0=function(_0x5b7675,_0x59cffa){_0x5b7675=_0x5b7675-0x0;var _0x183cca=_0x7b01[_0x5b7675];return _0x183cca;};'use strict';var _=require(_0x17b0('0x0'));var util=require(_0x17b0('0x1'));var logger=require(_0x17b0('0x2'))(_0x17b0('0x3'));var moment=require(_0x17b0('0x4'));var BPromise=require(_0x17b0('0x5'));var rp=require(_0x17b0('0x6'));var fs=require('fs');var path=require(_0x17b0('0x7'));var rimraf=require(_0x17b0('0x8'));var config=require(_0x17b0('0x9'));var attributes=require('./mailServerIn.attributes');module[_0x17b0('0xa')]=function(_0x155f4a,_0x1195cb){return _0x155f4a[_0x17b0('0xb')](_0x17b0('0xc'),attributes,{'tableName':_0x17b0('0xd'),'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 5ee3fed..fa96063 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 _0xf632=['../../config/environment','jayson/promise','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','MailServerIn','findAll','options','raw','where','attributes','limit','model','include','then','GetMailServerIn','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x2e4ca2,_0xbf5d7a){var _0x27e17b=function(_0x5a4095){while(--_0x5a4095){_0x2e4ca2['push'](_0x2e4ca2['shift']());}};_0x27e17b(++_0xbf5d7a);}(_0xf632,0xf9));var _0x2f63=function(_0x44efee,_0x5e4641){_0x44efee=_0x44efee-0x0;var _0xa3b2c=_0xf632[_0x44efee];return _0xa3b2c;};'use strict';var _=require(_0x2f63('0x0'));var util=require(_0x2f63('0x1'));var moment=require(_0x2f63('0x2'));var BPromise=require(_0x2f63('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f63('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f63('0x5'))(_0x2f63('0x6'));var config=require(_0x2f63('0x7'));var jayson=require(_0x2f63('0x8'));var client=jayson['client'][_0x2f63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb728,_0x210fb4,_0xd2ddee){return new BPromise(function(_0x503399,_0x31321c){return client[_0x2f63('0xa')](_0x2cb728,_0xd2ddee)['then'](function(_0x4fc157){logger[_0x2f63('0xb')](_0x2f63('0xc'),_0x210fb4,_0x2f63('0xd'));logger[_0x2f63('0xe')](_0x2f63('0xf'),_0x210fb4,_0x2f63('0xd'),JSON['stringify'](_0x4fc157));if(_0x4fc157[_0x2f63('0x10')]){if(_0x4fc157[_0x2f63('0x10')]['code']===0x1f4){logger[_0x2f63('0x10')]('MailServerIn,\x20%s,\x20%s',_0x210fb4,_0x4fc157[_0x2f63('0x10')]['message']);return _0x31321c(_0x4fc157[_0x2f63('0x10')][_0x2f63('0x11')]);}logger[_0x2f63('0x10')](_0x2f63('0xc'),_0x210fb4,_0x4fc157[_0x2f63('0x10')][_0x2f63('0x11')]);return _0x503399(_0x4fc157[_0x2f63('0x10')][_0x2f63('0x11')]);}else{logger[_0x2f63('0xb')]('MailServerIn,\x20%s,\x20%s',_0x210fb4,_0x2f63('0xd'));_0x503399(_0x4fc157[_0x2f63('0x12')][_0x2f63('0x11')]);}})['catch'](function(_0x178b4d){logger[_0x2f63('0x10')](_0x2f63('0xc'),_0x210fb4,_0x178b4d);_0x31321c(_0x178b4d);});});}exports['GetMailServerIn']=function(_0xc49a6d){var _0x2e0aa6=this;return new Promise(function(_0x40a207,_0x29dc5e){return db[_0x2f63('0x13')][_0x2f63('0x14')]({'raw':_0xc49a6d[_0x2f63('0x15')]?_0xc49a6d[_0x2f63('0x15')][_0x2f63('0x16')]===undefined?!![]:![]:!![],'where':_0xc49a6d[_0x2f63('0x15')]?_0xc49a6d['options'][_0x2f63('0x17')]||null:null,'attributes':_0xc49a6d[_0x2f63('0x15')]?_0xc49a6d[_0x2f63('0x15')][_0x2f63('0x18')]||null:null,'limit':_0xc49a6d['options']?_0xc49a6d['options'][_0x2f63('0x19')]||null:null,'include':_0xc49a6d[_0x2f63('0x15')]?_0xc49a6d[_0x2f63('0x15')]['include']?_['map'](_0xc49a6d[_0x2f63('0x15')]['include'],function(_0x501f8f){return{'model':db[_0x501f8f[_0x2f63('0x1a')]],'as':_0x501f8f['as'],'attributes':_0x501f8f[_0x2f63('0x18')],'include':_0x501f8f[_0x2f63('0x1b')]?_['map'](_0x501f8f[_0x2f63('0x1b')],function(_0x8b869c){return{'model':db[_0x8b869c[_0x2f63('0x1a')]],'as':_0x8b869c['as'],'attributes':_0x8b869c[_0x2f63('0x18')],'include':_0x8b869c[_0x2f63('0x1b')]?_['map'](_0x8b869c[_0x2f63('0x1b')],function(_0x3cef62){return{'model':db[_0x3cef62[_0x2f63('0x1a')]],'as':_0x3cef62['as'],'attributes':_0x3cef62[_0x2f63('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2f63('0x1c')](function(_0xc7f6d8){logger[_0x2f63('0xb')](_0x2f63('0x1d'),_0xc49a6d);logger[_0x2f63('0xe')](_0x2f63('0x1d'),_0xc49a6d,JSON[_0x2f63('0x1e')](_0xc7f6d8));_0x40a207(_0xc7f6d8);})[_0x2f63('0x1f')](function(_0x4995b2){logger[_0x2f63('0x10')](_0x2f63('0x1d'),_0x4995b2[_0x2f63('0x11')],_0xc49a6d);_0x29dc5e(_0x2e0aa6[_0x2f63('0x10')](0x1f4,_0x4995b2[_0x2f63('0x11')]));});});}; \ No newline at end of file +var _0x4cdd=['stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','MailServerIn','options','raw','attributes','limit','include','map','model','GetMailServerIn'];(function(_0x1d7979,_0x4c5bab){var _0x56e268=function(_0xda433e){while(--_0xda433e){_0x1d7979['push'](_0x1d7979['shift']());}};_0x56e268(++_0x4c5bab);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x4263d7,_0x3f638c){_0x4263d7=_0x4263d7-0x0;var _0x4dbd61=_0x4cdd[_0x4263d7];return _0x4dbd61;};'use strict';var _=require(_0xd4cd('0x0'));var util=require(_0xd4cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4cd('0x2'));var fs=require('fs');var Redis=require(_0xd4cd('0x3'));var db=require(_0xd4cd('0x4'))['db'];var utils=require(_0xd4cd('0x5'));var logger=require(_0xd4cd('0x6'))(_0xd4cd('0x7'));var config=require(_0xd4cd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3065,_0x4f4739,_0x24db75){return new BPromise(function(_0x4a0e74,_0x168dc1){return client[_0xd4cd('0x9')](_0x3c3065,_0x24db75)[_0xd4cd('0xa')](function(_0x456c40){logger[_0xd4cd('0xb')](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');logger[_0xd4cd('0xd')](_0xd4cd('0xe'),_0x4f4739,_0xd4cd('0xf'),JSON['stringify'](_0x456c40));if(_0x456c40['error']){if(_0x456c40['error'][_0xd4cd('0x10')]===0x1f4){logger[_0xd4cd('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40['error'][_0xd4cd('0x12')]);return _0x168dc1(_0x456c40[_0xd4cd('0x11')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40[_0xd4cd('0x11')][_0xd4cd('0x12')]);return _0x4a0e74(_0x456c40['error']['message']);}else{logger['info'](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');_0x4a0e74(_0x456c40['result'][_0xd4cd('0x12')]);}})[_0xd4cd('0x13')](function(_0x346760){logger[_0xd4cd('0x11')](_0xd4cd('0xc'),_0x4f4739,_0x346760);_0x168dc1(_0x346760);});});}exports['GetMailServerIn']=function(_0x3062e6){var _0x3888fe=this;return new Promise(function(_0x4eea06,_0x3e0a87){return db[_0xd4cd('0x14')]['findAll']({'raw':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x16')]===undefined?!![]:![]:!![],'where':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')]['where']||null:null,'attributes':_0x3062e6['options']?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x17')]||null:null,'limit':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x18')]||null:null,'include':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6['options'][_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x3062e6['options'][_0xd4cd('0x19')],function(_0x2e2dbf){return{'model':db[_0x2e2dbf['model']],'as':_0x2e2dbf['as'],'attributes':_0x2e2dbf[_0xd4cd('0x17')],'include':_0x2e2dbf['include']?_['map'](_0x2e2dbf[_0xd4cd('0x19')],function(_0x27bbe8){return{'model':db[_0x27bbe8[_0xd4cd('0x1b')]],'as':_0x27bbe8['as'],'attributes':_0x27bbe8[_0xd4cd('0x17')],'include':_0x27bbe8[_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x27bbe8[_0xd4cd('0x19')],function(_0x443f9e){return{'model':db[_0x443f9e[_0xd4cd('0x1b')]],'as':_0x443f9e['as'],'attributes':_0x443f9e[_0xd4cd('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd4cd('0xa')](function(_0x43f459){logger[_0xd4cd('0xb')](_0xd4cd('0x1c'),_0x3062e6);logger['debug'](_0xd4cd('0x1c'),_0x3062e6,JSON[_0xd4cd('0x1d')](_0x43f459));_0x4eea06(_0x43f459);})['catch'](function(_0xe245f3){logger[_0xd4cd('0x11')]('GetMailServerIn',_0xe245f3[_0xd4cd('0x12')],_0x3062e6);_0x3e0a87(_0x3888fe[_0xd4cd('0x11')](0x1f4,_0xe245f3[_0xd4cd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3befd17..4e33e7b 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 68e0a2e..ff30082 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 _0xa18d=['sequelize','STRING','BOOLEAN'];(function(_0x1a61a8,_0x2d263f){var _0x2387b6=function(_0xda5551){while(--_0xda5551){_0x1a61a8['push'](_0x1a61a8['shift']());}};_0x2387b6(++_0x2d263f);}(_0xa18d,0x6c));var _0xda18=function(_0x318edc,_0x576d10){_0x318edc=_0x318edc-0x0;var _0x3579a0=_0xa18d[_0x318edc];return _0x3579a0;};'use strict';var Sequelize=require(_0xda18('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xda18('0x1')]},'user':{'type':Sequelize[_0xda18('0x1')]},'pass':{'type':Sequelize[_0xda18('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xda18('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xda18('0x1')]},'authentication':{'type':Sequelize[_0xda18('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb072=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xb072,0x1a7));var _0x2b07=function(_0x16d01e,_0x22b076){_0x16d01e=_0x16d01e-0x0;var _0x317830=_0xb072[_0x16d01e];return _0x317830;};'use strict';var Sequelize=require(_0x2b07('0x0'));module[_0x2b07('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2b07('0x2')]},'user':{'type':Sequelize[_0x2b07('0x2')]},'pass':{'type':Sequelize[_0x2b07('0x2')]},'port':{'type':Sequelize[_0x2b07('0x3')]},'secure':{'type':Sequelize[_0x2b07('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x2b07('0x2')]},'authentication':{'type':Sequelize[_0x2b07('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 ae310db..4130de8 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 _0x61d4=['count','includeAll','rows','catch','show','params','include','options','find','create','body','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','set','Content-Range','json','apply','save','update','then','destroy','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1e00da,_0x4c1cf8){var _0x16e478=function(_0x2b06c0){while(--_0x2b06c0){_0x1e00da['push'](_0x1e00da['shift']());}};_0x16e478(++_0x4c1cf8);}(_0x61d4,0x13b));var _0x461d=function(_0x11314c,_0x2ca8d7){_0x11314c=_0x11314c-0x0;var _0x12cb4a=_0x61d4[_0x11314c];return _0x12cb4a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x461d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x461d('0x1'));var rp=require(_0x461d('0x2'));var moment=require(_0x461d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x461d('0x4'));var sox=require(_0x461d('0x5'));var csv=require(_0x461d('0x6'));var ejs=require(_0x461d('0x7'));var fs=require('fs');var fs_extra=require(_0x461d('0x8'));var _=require(_0x461d('0x9'));var squel=require(_0x461d('0xa'));var crypto=require(_0x461d('0xb'));var jsforce=require(_0x461d('0xc'));var deskjs=require(_0x461d('0xd'));var toCsv=require(_0x461d('0x6'));var querystring=require(_0x461d('0xe'));var Papa=require(_0x461d('0xf'));var Redis=require(_0x461d('0x10'));var authService=require(_0x461d('0x11'));var qs=require(_0x461d('0x12'));var as=require(_0x461d('0x13'));var hardwareService=require(_0x461d('0x14'));var logger=require(_0x461d('0x15'))(_0x461d('0x16'));var utils=require(_0x461d('0x17'));var config=require(_0x461d('0x18'));var licenseUtil=require(_0x461d('0x19'));var db=require(_0x461d('0x1a'))['db'];function respondWithStatusCode(_0x4cecc1,_0x2c02b6){_0x2c02b6=_0x2c02b6||0xcc;return function(_0x401f55){if(_0x401f55){return _0x4cecc1[_0x461d('0x1b')](_0x2c02b6);}return _0x4cecc1[_0x461d('0x1c')](_0x2c02b6)['end']();};}function respondWithResult(_0x1884bc,_0x375db0){_0x375db0=_0x375db0||0xc8;return function(_0x3c303c){if(_0x3c303c){return _0x1884bc[_0x461d('0x1c')](_0x375db0)['json'](_0x3c303c);}};}function respondWithFilteredResult(_0x28a229,_0x5c769b){return function(_0x34d9fa){if(_0x34d9fa){var _0x3584d8=typeof _0x5c769b[_0x461d('0x1d')]===_0x461d('0x1e')&&typeof _0x5c769b['limit']===_0x461d('0x1e');var _0x544d90=_0x34d9fa['count'];var _0x3861c7=_0x3584d8?0x0:_0x5c769b['offset'];var _0x2217fe=_0x3584d8?_0x34d9fa['count']:_0x5c769b[_0x461d('0x1d')]+_0x5c769b['limit'];var _0x2675ab;if(_0x2217fe>=_0x544d90){_0x2217fe=_0x544d90;_0x2675ab=0xc8;}else{_0x2675ab=0xce;}_0x28a229['status'](_0x2675ab);return _0x28a229[_0x461d('0x1f')](_0x461d('0x20'),_0x3861c7+'-'+_0x2217fe+'/'+_0x544d90)[_0x461d('0x21')](_0x34d9fa);}return null;};}function patchUpdates(_0x52a8e4){return function(_0x17d47e){try{jsonpatch[_0x461d('0x22')](_0x17d47e,_0x52a8e4,!![]);}catch(_0x5130f4){return BPromise['reject'](_0x5130f4);}return _0x17d47e[_0x461d('0x23')]();};}function saveUpdates(_0x29544e,_0x249b79){return function(_0x1a5c07){if(_0x1a5c07){return _0x1a5c07[_0x461d('0x24')](_0x29544e)[_0x461d('0x25')](function(_0x3b4a82){return _0x3b4a82;});}return null;};}function removeEntity(_0x109e7f,_0x3f9903){return function(_0x551e53){if(_0x551e53){return _0x551e53[_0x461d('0x26')]()['then'](function(){_0x109e7f[_0x461d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2545b7,_0x360be1){return function(_0x57e4a3){if(!_0x57e4a3){_0x2545b7[_0x461d('0x1b')](0x194);}return _0x57e4a3;};}function handleError(_0x8fbabc,_0x570957){_0x570957=_0x570957||0x1f4;return function(_0x5b8b40){logger['error'](_0x5b8b40[_0x461d('0x27')]);if(_0x5b8b40[_0x461d('0x28')]){delete _0x5b8b40[_0x461d('0x28')];}_0x8fbabc[_0x461d('0x1c')](_0x570957)['send'](_0x5b8b40);};}exports[_0x461d('0x29')]=function(_0xf21f28,_0x47266d){var _0x3a68db={},_0x181fb2={},_0x5cf826={'count':0x0,'rows':[]};var _0x228dbf=_[_0x461d('0x2a')](db[_0x461d('0x2b')][_0x461d('0x2c')],function(_0x230c46){return{'name':_0x230c46[_0x461d('0x2d')],'type':_0x230c46[_0x461d('0x2e')][_0x461d('0x2f')]};});_0x181fb2[_0x461d('0x30')]=_[_0x461d('0x2a')](_0x228dbf,_0x461d('0x28'));_0x181fb2[_0x461d('0x31')]=_[_0x461d('0x32')](_0xf21f28[_0x461d('0x31')]);_0x181fb2[_0x461d('0x33')]=_['intersection'](_0x181fb2[_0x461d('0x30')],_0x181fb2['query']);_0x3a68db[_0x461d('0x34')]=_[_0x461d('0x35')](_0x181fb2[_0x461d('0x30')],qs[_0x461d('0x36')](_0xf21f28[_0x461d('0x31')][_0x461d('0x36')]));_0x3a68db[_0x461d('0x34')]=_0x3a68db[_0x461d('0x34')][_0x461d('0x37')]?_0x3a68db[_0x461d('0x34')]:_0x181fb2[_0x461d('0x30')];if(!_0xf21f28['query'][_0x461d('0x38')](_0x461d('0x39'))){_0x3a68db[_0x461d('0x3a')]=qs['limit'](_0xf21f28[_0x461d('0x31')][_0x461d('0x3a')]);_0x3a68db[_0x461d('0x1d')]=qs[_0x461d('0x1d')](_0xf21f28['query'][_0x461d('0x1d')]);}_0x3a68db['order']=qs[_0x461d('0x3b')](_0xf21f28[_0x461d('0x31')][_0x461d('0x3b')]);_0x3a68db[_0x461d('0x3c')]=qs['filters'](_[_0x461d('0x3d')](_0xf21f28['query'],_0x181fb2['filters']),_0x228dbf);if(_0xf21f28['query'][_0x461d('0x3e')]){_0x3a68db['where']=_[_0x461d('0x3f')](_0x3a68db[_0x461d('0x3c')],{'$or':_[_0x461d('0x2a')](_0x228dbf,function(_0x5ea940){if(_0x5ea940[_0x461d('0x2e')]!==_0x461d('0x40')){var _0x9ab264={};_0x9ab264[_0x5ea940[_0x461d('0x28')]]={'$like':'%'+_0xf21f28[_0x461d('0x31')]['filter']+'%'};return _0x9ab264;}})});}_0x3a68db=_[_0x461d('0x3f')]({},_0x3a68db,_0xf21f28['options']);var _0xc13b3={'where':_0x3a68db[_0x461d('0x3c')]};return db['MailServerOut'][_0x461d('0x41')](_0xc13b3)['then'](function(_0x5043dc){_0x5cf826['count']=_0x5043dc;if(_0xf21f28[_0x461d('0x31')][_0x461d('0x42')]){_0x3a68db['include']=[{'all':!![]}];}return db[_0x461d('0x2b')]['findAll'](_0x3a68db);})[_0x461d('0x25')](function(_0x37131d){_0x5cf826[_0x461d('0x43')]=_0x37131d;return _0x5cf826;})[_0x461d('0x25')](respondWithFilteredResult(_0x47266d,_0x3a68db))[_0x461d('0x44')](handleError(_0x47266d,null));};exports[_0x461d('0x45')]=function(_0x11f369,_0x4888de){var _0x3769fd={'raw':!![],'where':{'id':_0x11f369[_0x461d('0x46')]['id']}},_0x56f538={};_0x56f538['model']=_[_0x461d('0x32')](db[_0x461d('0x2b')][_0x461d('0x2c')]);_0x56f538['query']=_['keys'](_0x11f369['query']);_0x56f538['filters']=_[_0x461d('0x35')](_0x56f538[_0x461d('0x30')],_0x56f538[_0x461d('0x31')]);_0x3769fd['attributes']=_[_0x461d('0x35')](_0x56f538['model'],qs[_0x461d('0x36')](_0x11f369[_0x461d('0x31')][_0x461d('0x36')]));_0x3769fd['attributes']=_0x3769fd[_0x461d('0x34')]['length']?_0x3769fd[_0x461d('0x34')]:_0x56f538[_0x461d('0x30')];if(_0x11f369[_0x461d('0x31')][_0x461d('0x42')]){_0x3769fd[_0x461d('0x47')]=[{'all':!![]}];}_0x3769fd=_['merge']({},_0x3769fd,_0x11f369[_0x461d('0x48')]);return db[_0x461d('0x2b')][_0x461d('0x49')](_0x3769fd)[_0x461d('0x25')](handleEntityNotFound(_0x4888de,null))[_0x461d('0x25')](respondWithResult(_0x4888de,null))[_0x461d('0x44')](handleError(_0x4888de,null));};exports[_0x461d('0x4a')]=function(_0x460cfd,_0x1e9c0c){return db['MailServerOut'][_0x461d('0x4a')](_0x460cfd['body'],{})[_0x461d('0x25')](respondWithResult(_0x1e9c0c,0xc9))[_0x461d('0x44')](handleError(_0x1e9c0c,null));};exports[_0x461d('0x24')]=function(_0x350914,_0x4036bf){if(_0x350914[_0x461d('0x4b')]['id']){delete _0x350914[_0x461d('0x4b')]['id'];}return db['MailServerOut'][_0x461d('0x49')]({'where':{'id':_0x350914['params']['id']}})['then'](handleEntityNotFound(_0x4036bf,null))[_0x461d('0x25')](saveUpdates(_0x350914[_0x461d('0x4b')],null))[_0x461d('0x25')](respondWithResult(_0x4036bf,null))[_0x461d('0x44')](handleError(_0x4036bf,null));};exports[_0x461d('0x26')]=function(_0x22c69a,_0x3769e1){return db[_0x461d('0x2b')][_0x461d('0x49')]({'where':{'id':_0x22c69a[_0x461d('0x46')]['id']}})[_0x461d('0x25')](handleEntityNotFound(_0x3769e1,null))[_0x461d('0x25')](removeEntity(_0x3769e1,null))['catch'](handleError(_0x3769e1,null));}; \ No newline at end of file +var _0xc3fa=['rows','catch','show','params','keys','include','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','index','MailServerOut','rawAttributes','fieldName','type','filters','intersection','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0xef7152,_0x13d200){var _0x37d2cb=function(_0x2fbef8){while(--_0x2fbef8){_0xef7152['push'](_0xef7152['shift']());}};_0x37d2cb(++_0x13d200);}(_0xc3fa,0x132));var _0xac3f=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0xc3fa[_0x151381];return _0x2afab6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac3f('0x0'));var zipdir=require(_0xac3f('0x1'));var jsonpatch=require(_0xac3f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xac3f('0x3'));var Mustache=require(_0xac3f('0x4'));var util=require('util');var path=require(_0xac3f('0x5'));var sox=require(_0xac3f('0x6'));var csv=require(_0xac3f('0x7'));var ejs=require(_0xac3f('0x8'));var fs=require('fs');var fs_extra=require(_0xac3f('0x9'));var _=require(_0xac3f('0xa'));var squel=require(_0xac3f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac3f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xac3f('0xd'));var Papa=require(_0xac3f('0xe'));var Redis=require(_0xac3f('0xf'));var authService=require(_0xac3f('0x10'));var qs=require(_0xac3f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac3f('0x12'));var logger=require(_0xac3f('0x13'))('api');var utils=require(_0xac3f('0x14'));var config=require(_0xac3f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xac3f('0x16'))['db'];function respondWithStatusCode(_0x5723f2,_0xa818b4){_0xa818b4=_0xa818b4||0xcc;return function(_0x20bf69){if(_0x20bf69){return _0x5723f2['sendStatus'](_0xa818b4);}return _0x5723f2[_0xac3f('0x17')](_0xa818b4)[_0xac3f('0x18')]();};}function respondWithResult(_0x3837c5,_0x1bfb28){_0x1bfb28=_0x1bfb28||0xc8;return function(_0xb76351){if(_0xb76351){return _0x3837c5[_0xac3f('0x17')](_0x1bfb28)[_0xac3f('0x19')](_0xb76351);}};}function respondWithFilteredResult(_0x49a9c3,_0x8ca0d6){return function(_0x2986ef){if(_0x2986ef){var _0x2b7941=typeof _0x8ca0d6[_0xac3f('0x1a')]===_0xac3f('0x1b')&&typeof _0x8ca0d6[_0xac3f('0x1c')]==='undefined';var _0x4c2a75=_0x2986ef[_0xac3f('0x1d')];var _0x4097a9=_0x2b7941?0x0:_0x8ca0d6['offset'];var _0x50c85e=_0x2b7941?_0x2986ef[_0xac3f('0x1d')]:_0x8ca0d6[_0xac3f('0x1a')]+_0x8ca0d6[_0xac3f('0x1c')];var _0x3bb343;if(_0x50c85e>=_0x4c2a75){_0x50c85e=_0x4c2a75;_0x3bb343=0xc8;}else{_0x3bb343=0xce;}_0x49a9c3[_0xac3f('0x17')](_0x3bb343);return _0x49a9c3[_0xac3f('0x1e')](_0xac3f('0x1f'),_0x4097a9+'-'+_0x50c85e+'/'+_0x4c2a75)[_0xac3f('0x19')](_0x2986ef);}return null;};}function patchUpdates(_0x2a16cf){return function(_0x5717b9){try{jsonpatch[_0xac3f('0x20')](_0x5717b9,_0x2a16cf,!![]);}catch(_0x2e7249){return BPromise['reject'](_0x2e7249);}return _0x5717b9[_0xac3f('0x21')]();};}function saveUpdates(_0x53b358,_0x56426f){return function(_0x3944e1){if(_0x3944e1){return _0x3944e1[_0xac3f('0x22')](_0x53b358)['then'](function(_0x5e0a8b){return _0x5e0a8b;});}return null;};}function removeEntity(_0x5251d9,_0x1688ab){return function(_0x4e449c){if(_0x4e449c){return _0x4e449c['destroy']()[_0xac3f('0x23')](function(){_0x5251d9[_0xac3f('0x17')](0xcc)[_0xac3f('0x18')]();});}};}function handleEntityNotFound(_0x54cea6,_0x293fca){return function(_0x5ed541){if(!_0x5ed541){_0x54cea6[_0xac3f('0x24')](0x194);}return _0x5ed541;};}function handleError(_0x61bf16,_0x320613){_0x320613=_0x320613||0x1f4;return function(_0x40fd5e){logger[_0xac3f('0x25')](_0x40fd5e[_0xac3f('0x26')]);if(_0x40fd5e[_0xac3f('0x27')]){delete _0x40fd5e[_0xac3f('0x27')];}_0x61bf16[_0xac3f('0x17')](_0x320613)['send'](_0x40fd5e);};}exports[_0xac3f('0x28')]=function(_0x52230a,_0x4429c5){var _0xde19dd={},_0x23046a={},_0x14f5db={'count':0x0,'rows':[]};var _0x147ea7=_['map'](db[_0xac3f('0x29')][_0xac3f('0x2a')],function(_0x4da314){return{'name':_0x4da314[_0xac3f('0x2b')],'type':_0x4da314[_0xac3f('0x2c')]['key']};});_0x23046a['model']=_['map'](_0x147ea7,_0xac3f('0x27'));_0x23046a['query']=_['keys'](_0x52230a['query']);_0x23046a[_0xac3f('0x2d')]=_[_0xac3f('0x2e')](_0x23046a['model'],_0x23046a[_0xac3f('0x2f')]);_0xde19dd['attributes']=_['intersection'](_0x23046a[_0xac3f('0x30')],qs[_0xac3f('0x31')](_0x52230a[_0xac3f('0x2f')]['fields']));_0xde19dd[_0xac3f('0x32')]=_0xde19dd[_0xac3f('0x32')][_0xac3f('0x33')]?_0xde19dd['attributes']:_0x23046a['model'];if(!_0x52230a['query'][_0xac3f('0x34')](_0xac3f('0x35'))){_0xde19dd[_0xac3f('0x1c')]=qs[_0xac3f('0x1c')](_0x52230a[_0xac3f('0x2f')][_0xac3f('0x1c')]);_0xde19dd[_0xac3f('0x1a')]=qs['offset'](_0x52230a['query'][_0xac3f('0x1a')]);}_0xde19dd[_0xac3f('0x36')]=qs[_0xac3f('0x37')](_0x52230a['query']['sort']);_0xde19dd[_0xac3f('0x38')]=qs[_0xac3f('0x2d')](_[_0xac3f('0x39')](_0x52230a[_0xac3f('0x2f')],_0x23046a[_0xac3f('0x2d')]),_0x147ea7);if(_0x52230a[_0xac3f('0x2f')][_0xac3f('0x3a')]){_0xde19dd['where']=_[_0xac3f('0x3b')](_0xde19dd[_0xac3f('0x38')],{'$or':_['map'](_0x147ea7,function(_0x31cb36){if(_0x31cb36['type']!==_0xac3f('0x3c')){var _0x180464={};_0x180464[_0x31cb36[_0xac3f('0x27')]]={'$like':'%'+_0x52230a['query'][_0xac3f('0x3a')]+'%'};return _0x180464;}})});}_0xde19dd=_['merge']({},_0xde19dd,_0x52230a[_0xac3f('0x3d')]);var _0x1a2f45={'where':_0xde19dd[_0xac3f('0x38')]};return db[_0xac3f('0x29')][_0xac3f('0x1d')](_0x1a2f45)['then'](function(_0x5a9c91){_0x14f5db[_0xac3f('0x1d')]=_0x5a9c91;if(_0x52230a[_0xac3f('0x2f')][_0xac3f('0x3e')]){_0xde19dd['include']=[{'all':!![]}];}return db[_0xac3f('0x29')][_0xac3f('0x3f')](_0xde19dd);})[_0xac3f('0x23')](function(_0x31891d){_0x14f5db[_0xac3f('0x40')]=_0x31891d;return _0x14f5db;})['then'](respondWithFilteredResult(_0x4429c5,_0xde19dd))[_0xac3f('0x41')](handleError(_0x4429c5,null));};exports[_0xac3f('0x42')]=function(_0x4ccb2f,_0x258fce){var _0x17af49={'raw':!![],'where':{'id':_0x4ccb2f[_0xac3f('0x43')]['id']}},_0x4d6475={};_0x4d6475['model']=_['keys'](db[_0xac3f('0x29')]['rawAttributes']);_0x4d6475[_0xac3f('0x2f')]=_[_0xac3f('0x44')](_0x4ccb2f[_0xac3f('0x2f')]);_0x4d6475[_0xac3f('0x2d')]=_[_0xac3f('0x2e')](_0x4d6475['model'],_0x4d6475[_0xac3f('0x2f')]);_0x17af49[_0xac3f('0x32')]=_[_0xac3f('0x2e')](_0x4d6475[_0xac3f('0x30')],qs[_0xac3f('0x31')](_0x4ccb2f[_0xac3f('0x2f')]['fields']));_0x17af49['attributes']=_0x17af49[_0xac3f('0x32')][_0xac3f('0x33')]?_0x17af49[_0xac3f('0x32')]:_0x4d6475[_0xac3f('0x30')];if(_0x4ccb2f[_0xac3f('0x2f')]['includeAll']){_0x17af49[_0xac3f('0x45')]=[{'all':!![]}];}_0x17af49=_[_0xac3f('0x3b')]({},_0x17af49,_0x4ccb2f[_0xac3f('0x3d')]);return db[_0xac3f('0x29')]['find'](_0x17af49)['then'](handleEntityNotFound(_0x258fce,null))[_0xac3f('0x23')](respondWithResult(_0x258fce,null))[_0xac3f('0x41')](handleError(_0x258fce,null));};exports[_0xac3f('0x46')]=function(_0x3cf061,_0x461fc1){return db[_0xac3f('0x29')][_0xac3f('0x46')](_0x3cf061['body'],{})['then'](respondWithResult(_0x461fc1,0xc9))[_0xac3f('0x41')](handleError(_0x461fc1,null));};exports[_0xac3f('0x22')]=function(_0x1373d9,_0x13e80b){if(_0x1373d9[_0xac3f('0x47')]['id']){delete _0x1373d9[_0xac3f('0x47')]['id'];}return db[_0xac3f('0x29')][_0xac3f('0x48')]({'where':{'id':_0x1373d9[_0xac3f('0x43')]['id']}})[_0xac3f('0x23')](handleEntityNotFound(_0x13e80b,null))[_0xac3f('0x23')](saveUpdates(_0x1373d9[_0xac3f('0x47')],null))[_0xac3f('0x23')](respondWithResult(_0x13e80b,null))[_0xac3f('0x41')](handleError(_0x13e80b,null));};exports[_0xac3f('0x49')]=function(_0x2c79ab,_0x4698d1){return db[_0xac3f('0x29')][_0xac3f('0x48')]({'where':{'id':_0x2c79ab[_0xac3f('0x43')]['id']}})[_0xac3f('0x23')](handleEntityNotFound(_0x4698d1,null))[_0xac3f('0x23')](removeEntity(_0x4698d1,null))[_0xac3f('0x41')](handleError(_0x4698d1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index bb27eaf..2bf2496 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 _0x6562=['path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','moment','bluebird'];(function(_0xa36a2c,_0x356786){var _0x536a48=function(_0x1e86ee){while(--_0x1e86ee){_0xa36a2c['push'](_0xa36a2c['shift']());}};_0x536a48(++_0x356786);}(_0x6562,0x66));var _0x2656=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0x6562[_0x2f6233];return _0x1c9c36;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2656('0x0'));var BPromise=require(_0x2656('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2656('0x2'));var rimraf=require('rimraf');var config=require(_0x2656('0x3'));var attributes=require(_0x2656('0x4'));module[_0x2656('0x5')]=function(_0x325bf9,_0x3afd00){return _0x325bf9[_0x2656('0x6')](_0x2656('0x7'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ddc=['mail_servers_out','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x1ec77b,_0x29e031){var _0x1d7fc1=function(_0xd08bae){while(--_0xd08bae){_0x1ec77b['push'](_0x1ec77b['shift']());}};_0x1d7fc1(++_0x29e031);}(_0x8ddc,0x127));var _0xc8dd=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x8ddc[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0xc8dd('0x0'));var util=require(_0xc8dd('0x1'));var logger=require(_0xc8dd('0x2'))(_0xc8dd('0x3'));var moment=require(_0xc8dd('0x4'));var BPromise=require('bluebird');var rp=require(_0xc8dd('0x5'));var fs=require('fs');var path=require(_0xc8dd('0x6'));var rimraf=require(_0xc8dd('0x7'));var config=require(_0xc8dd('0x8'));var attributes=require(_0xc8dd('0x9'));module[_0xc8dd('0xa')]=function(_0x73fff8,_0x3b8c34){return _0x73fff8[_0xc8dd('0xb')](_0xc8dd('0xc'),attributes,{'tableName':_0xc8dd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index b8e5fed..2227070 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x20ae3b,_0x23a21c){var _0x391475=function(_0x590776){while(--_0x590776){_0x20ae3b['push'](_0x20ae3b['shift']());}};_0x391475(++_0x23a21c);}(_0xadb5,0xad));var _0x5adb=function(_0x1e9f6b,_0x2ccf9e){_0x1e9f6b=_0x1e9f6b-0x0;var _0x4c5419=_0xadb5[_0x1e9f6b];return _0x4c5419;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x73628a,_0x5544ce){var _0x5d99c5=function(_0x163255){while(--_0x163255){_0x73628a['push'](_0x73628a['shift']());}};_0x5d99c5(++_0x5544ce);}(_0x1261,0x144));var _0x1126=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0x1261[_0x2baca1];return _0x9aa62a;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0590721..cd5c41c 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 _0xff90=['post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4b6602,_0x229d6c){var _0x5909de=function(_0x10eaf7){while(--_0x10eaf7){_0x4b6602['push'](_0x4b6602['shift']());}};_0x5909de(++_0x229d6c);}(_0xff90,0x17b));var _0x0ff9=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xff90[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0ff9('0x0'));var util=require('util');var path=require(_0x0ff9('0x1'));var timeout=require(_0x0ff9('0x2'));var express=require(_0x0ff9('0x3'));var router=express[_0x0ff9('0x4')]();var fs_extra=require(_0x0ff9('0x5'));var auth=require(_0x0ff9('0x6'));var interaction=require(_0x0ff9('0x7'));var config=require(_0x0ff9('0x8'));var controller=require(_0x0ff9('0x9'));router[_0x0ff9('0xa')]('/',auth[_0x0ff9('0xb')](),controller[_0x0ff9('0xc')]);router['get'](_0x0ff9('0xd'),auth[_0x0ff9('0xb')](),controller[_0x0ff9('0xe')]);router['get'](_0x0ff9('0xf'),auth[_0x0ff9('0xb')](),controller[_0x0ff9('0x10')]);router[_0x0ff9('0x11')]('/',auth[_0x0ff9('0xb')](),controller[_0x0ff9('0x12')]);router[_0x0ff9('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0ff9('0x14')]);router['delete']('/:id',auth[_0x0ff9('0xb')](),controller['destroy']);module[_0x0ff9('0x15')]=router; \ No newline at end of file +var _0x3da8=['put','update','delete','exports','multer','util','connect-timeout','express','Router','../../config/environment','./mailSubstatus.controller','isAuthenticated','get','/describe','describe','/:id','create'];(function(_0x29c3d1,_0xd92dbb){var _0xd46316=function(_0x4c8975){while(--_0x4c8975){_0x29c3d1['push'](_0x29c3d1['shift']());}};_0xd46316(++_0xd92dbb);}(_0x3da8,0xf2));var _0x83da=function(_0x164237,_0x23da9b){_0x164237=_0x164237-0x0;var _0x32c567=_0x3da8[_0x164237];return _0x32c567;};'use strict';var multer=require(_0x83da('0x0'));var util=require(_0x83da('0x1'));var path=require('path');var timeout=require(_0x83da('0x2'));var express=require(_0x83da('0x3'));var router=express[_0x83da('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x83da('0x5'));var controller=require(_0x83da('0x6'));router['get']('/',auth[_0x83da('0x7')](),controller['index']);router[_0x83da('0x8')](_0x83da('0x9'),auth[_0x83da('0x7')](),controller[_0x83da('0xa')]);router[_0x83da('0x8')](_0x83da('0xb'),auth[_0x83da('0x7')](),controller['show']);router['post']('/',auth[_0x83da('0x7')](),controller[_0x83da('0xc')]);router[_0x83da('0xd')](_0x83da('0xb'),auth[_0x83da('0x7')](),controller[_0x83da('0xe')]);router[_0x83da('0xf')](_0x83da('0xb'),auth[_0x83da('0x7')](),controller['destroy']);module[_0x83da('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e33c632..67d036c 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 _0x86f4=['STRING','name','sequelize','exports'];(function(_0x130fa6,_0x4d915f){var _0x6512bc=function(_0x1f3efe){while(--_0x1f3efe){_0x130fa6['push'](_0x130fa6['shift']());}};_0x6512bc(++_0x4d915f);}(_0x86f4,0x18a));var _0x486f=function(_0x5c76e4,_0x575d2c){_0x5c76e4=_0x5c76e4-0x0;var _0x443d3d=_0x86f4[_0x5c76e4];return _0x443d3d;};'use strict';var Sequelize=require(_0x486f('0x0'));module[_0x486f('0x1')]={'name':{'type':Sequelize[_0x486f('0x2')],'unique':_0x486f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x486f('0x2')]}}; \ No newline at end of file +var _0x0309=['STRING','sequelize'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x0309,0x165));var _0x9030=function(_0x1a6fec,_0x33077c){_0x1a6fec=_0x1a6fec-0x0;var _0x283065=_0x0309[_0x1a6fec];return _0x283065;};'use strict';var Sequelize=require(_0x9030('0x0'));module['exports']={'name':{'type':Sequelize[_0x9030('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9030('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f9015f2..d725718 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 _0xd950=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailSubstatus','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','catch','params','attributes','includeAll','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x39829b,_0x2321f0){var _0x174aa4=function(_0x3c6fde){while(--_0x3c6fde){_0x39829b['push'](_0x39829b['shift']());}};_0x174aa4(++_0x2321f0);}(_0xd950,0x126));var _0x0d95=function(_0x2d622e,_0x17d647){_0x2d622e=_0x2d622e-0x0;var _0x3ba734=_0xd950[_0x2d622e];return _0x3ba734;};'use strict';var emlformat=require(_0x0d95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d95('0x1'));var jsonpatch=require(_0x0d95('0x2'));var rp=require(_0x0d95('0x3'));var moment=require(_0x0d95('0x4'));var BPromise=require(_0x0d95('0x5'));var Mustache=require('mustache');var util=require(_0x0d95('0x6'));var path=require(_0x0d95('0x7'));var sox=require(_0x0d95('0x8'));var csv=require(_0x0d95('0x9'));var ejs=require(_0x0d95('0xa'));var fs=require('fs');var fs_extra=require(_0x0d95('0xb'));var _=require(_0x0d95('0xc'));var squel=require(_0x0d95('0xd'));var crypto=require(_0x0d95('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0d95('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0d95('0x10'));var Papa=require(_0x0d95('0x11'));var Redis=require(_0x0d95('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0d95('0x13'));var as=require(_0x0d95('0x14'));var hardwareService=require(_0x0d95('0x15'));var logger=require(_0x0d95('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0d95('0x17'));var licenseUtil=require(_0x0d95('0x18'));var db=require(_0x0d95('0x19'))['db'];function respondWithStatusCode(_0x37eaf6,_0x3f70b6){_0x3f70b6=_0x3f70b6||0xcc;return function(_0x5bc298){if(_0x5bc298){return _0x37eaf6['sendStatus'](_0x3f70b6);}return _0x37eaf6['status'](_0x3f70b6)[_0x0d95('0x1a')]();};}function respondWithResult(_0x5b7650,_0x39ae01){_0x39ae01=_0x39ae01||0xc8;return function(_0x3bcc26){if(_0x3bcc26){return _0x5b7650[_0x0d95('0x1b')](_0x39ae01)[_0x0d95('0x1c')](_0x3bcc26);}};}function respondWithFilteredResult(_0x27d13c,_0x13da7d){return function(_0xe82b47){if(_0xe82b47){var _0x3ce803=typeof _0x13da7d[_0x0d95('0x1d')]===_0x0d95('0x1e')&&typeof _0x13da7d[_0x0d95('0x1f')]===_0x0d95('0x1e');var _0x116eaf=_0xe82b47[_0x0d95('0x20')];var _0x215de5=_0x3ce803?0x0:_0x13da7d[_0x0d95('0x1d')];var _0x2e3957=_0x3ce803?_0xe82b47[_0x0d95('0x20')]:_0x13da7d['offset']+_0x13da7d['limit'];var _0x3de773;if(_0x2e3957>=_0x116eaf){_0x2e3957=_0x116eaf;_0x3de773=0xc8;}else{_0x3de773=0xce;}_0x27d13c['status'](_0x3de773);return _0x27d13c[_0x0d95('0x21')](_0x0d95('0x22'),_0x215de5+'-'+_0x2e3957+'/'+_0x116eaf)[_0x0d95('0x1c')](_0xe82b47);}return null;};}function patchUpdates(_0x3bb9d9){return function(_0x7d6b4b){try{jsonpatch[_0x0d95('0x23')](_0x7d6b4b,_0x3bb9d9,!![]);}catch(_0x195b34){return BPromise[_0x0d95('0x24')](_0x195b34);}return _0x7d6b4b[_0x0d95('0x25')]();};}function saveUpdates(_0x75c4d3,_0x8c153c){return function(_0x4f5b3d){if(_0x4f5b3d){return _0x4f5b3d['update'](_0x75c4d3)[_0x0d95('0x26')](function(_0x31aa28){return _0x31aa28;});}return null;};}function removeEntity(_0x107d50,_0x3dec23){return function(_0x3d0f67){if(_0x3d0f67){return _0x3d0f67[_0x0d95('0x27')]()[_0x0d95('0x26')](function(){_0x107d50['status'](0xcc)[_0x0d95('0x1a')]();});}};}function handleEntityNotFound(_0xfd75bf,_0x331517){return function(_0x164969){if(!_0x164969){_0xfd75bf[_0x0d95('0x28')](0x194);}return _0x164969;};}function handleError(_0x426ce5,_0xd70b24){_0xd70b24=_0xd70b24||0x1f4;return function(_0x5dae08){logger[_0x0d95('0x29')](_0x5dae08['stack']);if(_0x5dae08[_0x0d95('0x2a')]){delete _0x5dae08['name'];}_0x426ce5[_0x0d95('0x1b')](_0xd70b24)[_0x0d95('0x2b')](_0x5dae08);};}exports['index']=function(_0x28531a,_0x4cf84b){var _0x483983={},_0x4b0dc6={},_0x433713={'count':0x0,'rows':[]};var _0x56f255=_[_0x0d95('0x2c')](db[_0x0d95('0x2d')][_0x0d95('0x2e')],function(_0x47e868){return{'name':_0x47e868[_0x0d95('0x2f')],'type':_0x47e868[_0x0d95('0x30')]['key']};});_0x4b0dc6['model']=_['map'](_0x56f255,_0x0d95('0x2a'));_0x4b0dc6[_0x0d95('0x31')]=_[_0x0d95('0x32')](_0x28531a[_0x0d95('0x31')]);_0x4b0dc6[_0x0d95('0x33')]=_['intersection'](_0x4b0dc6[_0x0d95('0x34')],_0x4b0dc6[_0x0d95('0x31')]);_0x483983['attributes']=_[_0x0d95('0x35')](_0x4b0dc6[_0x0d95('0x34')],qs[_0x0d95('0x36')](_0x28531a[_0x0d95('0x31')]['fields']));_0x483983['attributes']=_0x483983['attributes'][_0x0d95('0x37')]?_0x483983['attributes']:_0x4b0dc6[_0x0d95('0x34')];if(!_0x28531a[_0x0d95('0x31')]['hasOwnProperty'](_0x0d95('0x38'))){_0x483983[_0x0d95('0x1f')]=qs[_0x0d95('0x1f')](_0x28531a[_0x0d95('0x31')][_0x0d95('0x1f')]);_0x483983['offset']=qs[_0x0d95('0x1d')](_0x28531a[_0x0d95('0x31')][_0x0d95('0x1d')]);}_0x483983[_0x0d95('0x39')]=qs[_0x0d95('0x3a')](_0x28531a['query'][_0x0d95('0x3a')]);_0x483983[_0x0d95('0x3b')]=qs[_0x0d95('0x33')](_['pick'](_0x28531a['query'],_0x4b0dc6[_0x0d95('0x33')]),_0x56f255);if(_0x28531a[_0x0d95('0x31')]['filter']){_0x483983[_0x0d95('0x3b')]=_[_0x0d95('0x3c')](_0x483983[_0x0d95('0x3b')],{'$or':_[_0x0d95('0x2c')](_0x56f255,function(_0x4e27ab){if(_0x4e27ab[_0x0d95('0x30')]!==_0x0d95('0x3d')){var _0xd07f45={};_0xd07f45[_0x4e27ab[_0x0d95('0x2a')]]={'$like':'%'+_0x28531a[_0x0d95('0x31')][_0x0d95('0x3e')]+'%'};return _0xd07f45;}})});}_0x483983=_['merge']({},_0x483983,_0x28531a[_0x0d95('0x3f')]);var _0x2c6da0={'where':_0x483983[_0x0d95('0x3b')]};return db['MailSubstatus'][_0x0d95('0x20')](_0x2c6da0)['then'](function(_0x3b3f8b){_0x433713[_0x0d95('0x20')]=_0x3b3f8b;if(_0x28531a['query']['includeAll']){_0x483983[_0x0d95('0x40')]=[{'all':!![]}];}return db[_0x0d95('0x2d')]['findAll'](_0x483983);})[_0x0d95('0x26')](function(_0x56e4c6){_0x433713[_0x0d95('0x41')]=_0x56e4c6;return _0x433713;})['then'](respondWithFilteredResult(_0x4cf84b,_0x483983))[_0x0d95('0x42')](handleError(_0x4cf84b,null));};exports['show']=function(_0x517748,_0x400d15){var _0x5811e5={'raw':!![],'where':{'id':_0x517748[_0x0d95('0x43')]['id']}},_0x3e4cb9={};_0x3e4cb9[_0x0d95('0x34')]=_[_0x0d95('0x32')](db['MailSubstatus'][_0x0d95('0x2e')]);_0x3e4cb9['query']=_[_0x0d95('0x32')](_0x517748['query']);_0x3e4cb9[_0x0d95('0x33')]=_[_0x0d95('0x35')](_0x3e4cb9[_0x0d95('0x34')],_0x3e4cb9[_0x0d95('0x31')]);_0x5811e5[_0x0d95('0x44')]=_[_0x0d95('0x35')](_0x3e4cb9[_0x0d95('0x34')],qs[_0x0d95('0x36')](_0x517748['query'][_0x0d95('0x36')]));_0x5811e5['attributes']=_0x5811e5[_0x0d95('0x44')]['length']?_0x5811e5['attributes']:_0x3e4cb9[_0x0d95('0x34')];if(_0x517748['query'][_0x0d95('0x45')]){_0x5811e5['include']=[{'all':!![]}];}_0x5811e5=_[_0x0d95('0x3c')]({},_0x5811e5,_0x517748['options']);return db['MailSubstatus']['find'](_0x5811e5)['then'](handleEntityNotFound(_0x400d15,null))[_0x0d95('0x26')](respondWithResult(_0x400d15,null))[_0x0d95('0x42')](handleError(_0x400d15,null));};exports[_0x0d95('0x46')]=function(_0x1dfa12,_0x1875e9){return db[_0x0d95('0x2d')][_0x0d95('0x46')](_0x1dfa12['body'],{})[_0x0d95('0x26')](respondWithResult(_0x1875e9,0xc9))[_0x0d95('0x42')](handleError(_0x1875e9,null));};exports[_0x0d95('0x47')]=function(_0x26b1ce,_0x487bcd){if(_0x26b1ce[_0x0d95('0x48')]['id']){delete _0x26b1ce['body']['id'];}return db[_0x0d95('0x2d')][_0x0d95('0x49')]({'where':{'id':_0x26b1ce[_0x0d95('0x43')]['id']}})[_0x0d95('0x26')](handleEntityNotFound(_0x487bcd,null))[_0x0d95('0x26')](saveUpdates(_0x26b1ce[_0x0d95('0x48')],null))[_0x0d95('0x26')](respondWithResult(_0x487bcd,null))[_0x0d95('0x42')](handleError(_0x487bcd,null));};exports[_0x0d95('0x27')]=function(_0x2793b1,_0x915df3){return db[_0x0d95('0x2d')][_0x0d95('0x49')]({'where':{'id':_0x2793b1[_0x0d95('0x43')]['id']}})[_0x0d95('0x26')](handleEntityNotFound(_0x915df3,null))[_0x0d95('0x26')](removeEntity(_0x915df3,null))[_0x0d95('0x42')](handleError(_0x915df3,null));};exports[_0x0d95('0x4a')]=function(_0x19ce05,_0x49f948){return db[_0x0d95('0x2d')][_0x0d95('0x4a')]()[_0x0d95('0x26')](respondWithResult(_0x49f948,null))[_0x0d95('0x42')](handleError(_0x49f948,null));}; \ No newline at end of file +var _0xf170=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','stack','send','index','map','MailSubstatus','rawAttributes','fieldName','name','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','mustache','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1c1b20,_0x2ae408){var _0x4b56bf=function(_0x555571){while(--_0x555571){_0x1c1b20['push'](_0x1c1b20['shift']());}};_0x4b56bf(++_0x2ae408);}(_0xf170,0x80));var _0x0f17=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xf170[_0x2ec2bf];return _0x2c279c;};'use strict';var emlformat=require(_0x0f17('0x0'));var rimraf=require(_0x0f17('0x1'));var zipdir=require(_0x0f17('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0f17('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0f17('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0f17('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f17('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f17('0x7'));var jsforce=require(_0x0f17('0x8'));var deskjs=require(_0x0f17('0x9'));var toCsv=require(_0x0f17('0x5'));var querystring=require(_0x0f17('0xa'));var Papa=require(_0x0f17('0xb'));var Redis=require('ioredis');var authService=require(_0x0f17('0xc'));var qs=require(_0x0f17('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f17('0xe'));var logger=require(_0x0f17('0xf'))(_0x0f17('0x10'));var utils=require(_0x0f17('0x11'));var config=require(_0x0f17('0x12'));var licenseUtil=require(_0x0f17('0x13'));var db=require(_0x0f17('0x14'))['db'];function respondWithStatusCode(_0x3dbbc2,_0x3a1397){_0x3a1397=_0x3a1397||0xcc;return function(_0x22a971){if(_0x22a971){return _0x3dbbc2[_0x0f17('0x15')](_0x3a1397);}return _0x3dbbc2[_0x0f17('0x16')](_0x3a1397)['end']();};}function respondWithResult(_0x2f826d,_0x1bb915){_0x1bb915=_0x1bb915||0xc8;return function(_0x3430d3){if(_0x3430d3){return _0x2f826d[_0x0f17('0x16')](_0x1bb915)[_0x0f17('0x17')](_0x3430d3);}};}function respondWithFilteredResult(_0x14d76a,_0x233e19){return function(_0x2d8739){if(_0x2d8739){var _0x3872c6=typeof _0x233e19[_0x0f17('0x18')]===_0x0f17('0x19')&&typeof _0x233e19[_0x0f17('0x1a')]===_0x0f17('0x19');var _0x7d6b3=_0x2d8739['count'];var _0x408003=_0x3872c6?0x0:_0x233e19[_0x0f17('0x18')];var _0x129bd5=_0x3872c6?_0x2d8739[_0x0f17('0x1b')]:_0x233e19['offset']+_0x233e19[_0x0f17('0x1a')];var _0x392f33;if(_0x129bd5>=_0x7d6b3){_0x129bd5=_0x7d6b3;_0x392f33=0xc8;}else{_0x392f33=0xce;}_0x14d76a[_0x0f17('0x16')](_0x392f33);return _0x14d76a[_0x0f17('0x1c')](_0x0f17('0x1d'),_0x408003+'-'+_0x129bd5+'/'+_0x7d6b3)['json'](_0x2d8739);}return null;};}function patchUpdates(_0x59a712){return function(_0x5d4e0c){try{jsonpatch['apply'](_0x5d4e0c,_0x59a712,!![]);}catch(_0x59403f){return BPromise['reject'](_0x59403f);}return _0x5d4e0c[_0x0f17('0x1e')]();};}function saveUpdates(_0x45fca4,_0xc33453){return function(_0x3ec68f){if(_0x3ec68f){return _0x3ec68f[_0x0f17('0x1f')](_0x45fca4)[_0x0f17('0x20')](function(_0x3d56d1){return _0x3d56d1;});}return null;};}function removeEntity(_0x4a4b1a,_0x478119){return function(_0x304d04){if(_0x304d04){return _0x304d04[_0x0f17('0x21')]()['then'](function(){_0x4a4b1a[_0x0f17('0x16')](0xcc)[_0x0f17('0x22')]();});}};}function handleEntityNotFound(_0x36c8b7,_0x59afb5){return function(_0x3bad63){if(!_0x3bad63){_0x36c8b7[_0x0f17('0x15')](0x194);}return _0x3bad63;};}function handleError(_0x5badce,_0x5445d2){_0x5445d2=_0x5445d2||0x1f4;return function(_0x56eab4){logger['error'](_0x56eab4[_0x0f17('0x23')]);if(_0x56eab4['name']){delete _0x56eab4['name'];}_0x5badce['status'](_0x5445d2)[_0x0f17('0x24')](_0x56eab4);};}exports[_0x0f17('0x25')]=function(_0x4a381a,_0x1d5b29){var _0x2a9af5={},_0x530fac={},_0x22aa77={'count':0x0,'rows':[]};var _0x2b7441=_[_0x0f17('0x26')](db[_0x0f17('0x27')][_0x0f17('0x28')],function(_0x436e5a){return{'name':_0x436e5a[_0x0f17('0x29')],'type':_0x436e5a['type']['key']};});_0x530fac['model']=_[_0x0f17('0x26')](_0x2b7441,_0x0f17('0x2a'));_0x530fac[_0x0f17('0x2b')]=_[_0x0f17('0x2c')](_0x4a381a[_0x0f17('0x2b')]);_0x530fac['filters']=_['intersection'](_0x530fac[_0x0f17('0x2d')],_0x530fac[_0x0f17('0x2b')]);_0x2a9af5[_0x0f17('0x2e')]=_[_0x0f17('0x2f')](_0x530fac['model'],qs[_0x0f17('0x30')](_0x4a381a[_0x0f17('0x2b')][_0x0f17('0x30')]));_0x2a9af5[_0x0f17('0x2e')]=_0x2a9af5[_0x0f17('0x2e')][_0x0f17('0x31')]?_0x2a9af5[_0x0f17('0x2e')]:_0x530fac[_0x0f17('0x2d')];if(!_0x4a381a[_0x0f17('0x2b')]['hasOwnProperty'](_0x0f17('0x32'))){_0x2a9af5[_0x0f17('0x1a')]=qs['limit'](_0x4a381a[_0x0f17('0x2b')][_0x0f17('0x1a')]);_0x2a9af5[_0x0f17('0x18')]=qs[_0x0f17('0x18')](_0x4a381a[_0x0f17('0x2b')][_0x0f17('0x18')]);}_0x2a9af5[_0x0f17('0x33')]=qs[_0x0f17('0x34')](_0x4a381a['query']['sort']);_0x2a9af5[_0x0f17('0x35')]=qs[_0x0f17('0x36')](_[_0x0f17('0x37')](_0x4a381a[_0x0f17('0x2b')],_0x530fac['filters']),_0x2b7441);if(_0x4a381a['query'][_0x0f17('0x38')]){_0x2a9af5[_0x0f17('0x35')]=_['merge'](_0x2a9af5[_0x0f17('0x35')],{'$or':_[_0x0f17('0x26')](_0x2b7441,function(_0x1ff063){if(_0x1ff063['type']!==_0x0f17('0x39')){var _0x4cef81={};_0x4cef81[_0x1ff063[_0x0f17('0x2a')]]={'$like':'%'+_0x4a381a['query'][_0x0f17('0x38')]+'%'};return _0x4cef81;}})});}_0x2a9af5=_[_0x0f17('0x3a')]({},_0x2a9af5,_0x4a381a[_0x0f17('0x3b')]);var _0x357c4f={'where':_0x2a9af5[_0x0f17('0x35')]};return db[_0x0f17('0x27')][_0x0f17('0x1b')](_0x357c4f)['then'](function(_0x2a24b2){_0x22aa77['count']=_0x2a24b2;if(_0x4a381a[_0x0f17('0x2b')][_0x0f17('0x3c')]){_0x2a9af5[_0x0f17('0x3d')]=[{'all':!![]}];}return db[_0x0f17('0x27')][_0x0f17('0x3e')](_0x2a9af5);})[_0x0f17('0x20')](function(_0x9343d3){_0x22aa77[_0x0f17('0x3f')]=_0x9343d3;return _0x22aa77;})[_0x0f17('0x20')](respondWithFilteredResult(_0x1d5b29,_0x2a9af5))[_0x0f17('0x40')](handleError(_0x1d5b29,null));};exports[_0x0f17('0x41')]=function(_0xebefeb,_0x403653){var _0x37845b={'raw':!![],'where':{'id':_0xebefeb['params']['id']}},_0x28f01b={};_0x28f01b[_0x0f17('0x2d')]=_[_0x0f17('0x2c')](db[_0x0f17('0x27')]['rawAttributes']);_0x28f01b[_0x0f17('0x2b')]=_[_0x0f17('0x2c')](_0xebefeb['query']);_0x28f01b['filters']=_['intersection'](_0x28f01b[_0x0f17('0x2d')],_0x28f01b['query']);_0x37845b[_0x0f17('0x2e')]=_['intersection'](_0x28f01b[_0x0f17('0x2d')],qs[_0x0f17('0x30')](_0xebefeb['query'][_0x0f17('0x30')]));_0x37845b[_0x0f17('0x2e')]=_0x37845b[_0x0f17('0x2e')][_0x0f17('0x31')]?_0x37845b[_0x0f17('0x2e')]:_0x28f01b[_0x0f17('0x2d')];if(_0xebefeb['query'][_0x0f17('0x3c')]){_0x37845b[_0x0f17('0x3d')]=[{'all':!![]}];}_0x37845b=_[_0x0f17('0x3a')]({},_0x37845b,_0xebefeb[_0x0f17('0x3b')]);return db[_0x0f17('0x27')][_0x0f17('0x42')](_0x37845b)[_0x0f17('0x20')](handleEntityNotFound(_0x403653,null))['then'](respondWithResult(_0x403653,null))[_0x0f17('0x40')](handleError(_0x403653,null));};exports[_0x0f17('0x43')]=function(_0x4ea0cb,_0x57793a){return db['MailSubstatus']['create'](_0x4ea0cb['body'],{})[_0x0f17('0x20')](respondWithResult(_0x57793a,0xc9))[_0x0f17('0x40')](handleError(_0x57793a,null));};exports['update']=function(_0x3cef76,_0x356f3a){if(_0x3cef76[_0x0f17('0x44')]['id']){delete _0x3cef76[_0x0f17('0x44')]['id'];}return db[_0x0f17('0x27')][_0x0f17('0x42')]({'where':{'id':_0x3cef76[_0x0f17('0x45')]['id']}})[_0x0f17('0x20')](handleEntityNotFound(_0x356f3a,null))[_0x0f17('0x20')](saveUpdates(_0x3cef76[_0x0f17('0x44')],null))[_0x0f17('0x20')](respondWithResult(_0x356f3a,null))['catch'](handleError(_0x356f3a,null));};exports[_0x0f17('0x21')]=function(_0x2cb0af,_0x42f20a){return db[_0x0f17('0x27')]['find']({'where':{'id':_0x2cb0af['params']['id']}})['then'](handleEntityNotFound(_0x42f20a,null))[_0x0f17('0x20')](removeEntity(_0x42f20a,null))[_0x0f17('0x40')](handleError(_0x42f20a,null));};exports[_0x0f17('0x46')]=function(_0x350c4e,_0x5f282a){return db[_0x0f17('0x27')][_0x0f17('0x46')]()[_0x0f17('0x20')](respondWithResult(_0x5f282a,null))[_0x0f17('0x40')](handleError(_0x5f282a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 40e60a4..a6e0281 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 _0xb542=['path','rimraf','../../config/environment','MailSubstatus','mail_substatuses','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2f78e2,_0x4adbb2){var _0x2d5b68=function(_0x5ce491){while(--_0x5ce491){_0x2f78e2['push'](_0x2f78e2['shift']());}};_0x2d5b68(++_0x4adbb2);}(_0xb542,0x109));var _0x2b54=function(_0x4ca7c8,_0x3050d9){_0x4ca7c8=_0x4ca7c8-0x0;var _0x1b67e2=_0xb542[_0x4ca7c8];return _0x1b67e2;};'use strict';var _=require(_0x2b54('0x0'));var util=require('util');var logger=require(_0x2b54('0x1'))('api');var moment=require(_0x2b54('0x2'));var BPromise=require(_0x2b54('0x3'));var rp=require(_0x2b54('0x4'));var fs=require('fs');var path=require(_0x2b54('0x5'));var rimraf=require(_0x2b54('0x6'));var config=require(_0x2b54('0x7'));var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x2eee01,_0x17606a){return _0x2eee01['define'](_0x2b54('0x8'),attributes,{'tableName':_0x2b54('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd790=['mail_substatuses','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x53871c,_0xade12c){var _0x3a10ff=function(_0x443efe){while(--_0x443efe){_0x53871c['push'](_0x53871c['shift']());}};_0x3a10ff(++_0xade12c);}(_0xd790,0x83));var _0x0d79=function(_0x56260c,_0x3594bc){_0x56260c=_0x56260c-0x0;var _0x3293b9=_0xd790[_0x56260c];return _0x3293b9;};'use strict';var _=require(_0x0d79('0x0'));var util=require(_0x0d79('0x1'));var logger=require('../../config/logger')(_0x0d79('0x2'));var moment=require(_0x0d79('0x3'));var BPromise=require(_0x0d79('0x4'));var rp=require(_0x0d79('0x5'));var fs=require('fs');var path=require(_0x0d79('0x6'));var rimraf=require(_0x0d79('0x7'));var config=require('../../config/environment');var attributes=require(_0x0d79('0x8'));module[_0x0d79('0x9')]=function(_0xdfef71,_0x1af400){return _0xdfef71[_0x0d79('0xa')](_0x0d79('0xb'),attributes,{'tableName':_0x0d79('0xc'),'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 362e267..cdba591 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 _0xad64=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring'];(function(_0x30fc6a,_0x2476ea){var _0x297c32=function(_0x5cc9c6){while(--_0x5cc9c6){_0x30fc6a['push'](_0x30fc6a['shift']());}};_0x297c32(++_0x2476ea);}(_0xad64,0xb5));var _0x4ad6=function(_0x385631,_0x400cd0){_0x385631=_0x385631-0x0;var _0x8d04c1=_0xad64[_0x385631];return _0x8d04c1;};'use strict';var _=require(_0x4ad6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4ad6('0x1'));var rs=require(_0x4ad6('0x2'));var fs=require('fs');var Redis=require(_0x4ad6('0x3'));var db=require(_0x4ad6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ad6('0x5'))(_0x4ad6('0x6'));var config=require(_0x4ad6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4ad6('0x8')][_0x4ad6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26be39,_0x280445,_0x2349cd){return new BPromise(function(_0x3c56df,_0x9bd6b6){return client[_0x4ad6('0xa')](_0x26be39,_0x2349cd)[_0x4ad6('0xb')](function(_0x224799){logger['info'](_0x4ad6('0xc'),_0x280445,'request\x20sent');logger[_0x4ad6('0xd')](_0x4ad6('0xe'),_0x280445,_0x4ad6('0xf'),JSON[_0x4ad6('0x10')](_0x224799));if(_0x224799[_0x4ad6('0x11')]){if(_0x224799[_0x4ad6('0x11')][_0x4ad6('0x12')]===0x1f4){logger['error'](_0x4ad6('0xc'),_0x280445,_0x224799['error']['message']);return _0x9bd6b6(_0x224799['error'][_0x4ad6('0x13')]);}logger['error'](_0x4ad6('0xc'),_0x280445,_0x224799[_0x4ad6('0x11')]['message']);return _0x3c56df(_0x224799[_0x4ad6('0x11')][_0x4ad6('0x13')]);}else{logger[_0x4ad6('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x280445,_0x4ad6('0xf'));_0x3c56df(_0x224799[_0x4ad6('0x15')][_0x4ad6('0x13')]);}})[_0x4ad6('0x16')](function(_0x403740){logger['error'](_0x4ad6('0xc'),_0x280445,_0x403740);_0x9bd6b6(_0x403740);});});} \ No newline at end of file +var _0x0a08=['catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x0a08,0x65));var _0x80a0=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x0a08[_0x481bf7];return _0x461787;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x80a0('0x0'));var BPromise=require(_0x80a0('0x1'));var rs=require(_0x80a0('0x2'));var fs=require('fs');var Redis=require(_0x80a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x80a0('0x4'));var logger=require(_0x80a0('0x5'))(_0x80a0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x80a0('0x7')][_0x80a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb94b55,_0x46b894,_0xb0743c){return new BPromise(function(_0x811df7,_0x29064b){return client[_0x80a0('0x9')](_0xb94b55,_0xb0743c)[_0x80a0('0xa')](function(_0x15d188){logger[_0x80a0('0xb')](_0x80a0('0xc'),_0x46b894,_0x80a0('0xd'));logger[_0x80a0('0xe')](_0x80a0('0xf'),_0x46b894,_0x80a0('0xd'),JSON['stringify'](_0x15d188));if(_0x15d188[_0x80a0('0x10')]){if(_0x15d188[_0x80a0('0x10')][_0x80a0('0x11')]===0x1f4){logger[_0x80a0('0x10')](_0x80a0('0xc'),_0x46b894,_0x15d188[_0x80a0('0x10')][_0x80a0('0x12')]);return _0x29064b(_0x15d188[_0x80a0('0x10')][_0x80a0('0x12')]);}logger[_0x80a0('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x46b894,_0x15d188[_0x80a0('0x10')][_0x80a0('0x12')]);return _0x811df7(_0x15d188[_0x80a0('0x10')]['message']);}else{logger['info'](_0x80a0('0xc'),_0x46b894,_0x80a0('0xd'));_0x811df7(_0x15d188['result'][_0x80a0('0x12')]);}})[_0x80a0('0x13')](function(_0x1c2576){logger[_0x80a0('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x46b894,_0x1c2576);_0x29064b(_0x1c2576);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ce9eee6..f135250 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 _0xd499=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','/:id','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd499,0x93));var _0x9d49=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xd499[_0x38c652];return _0x218a37;};'use strict';var multer=require(_0x9d49('0x0'));var util=require(_0x9d49('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9d49('0x2')]();var fs_extra=require(_0x9d49('0x3'));var auth=require(_0x9d49('0x4'));var interaction=require(_0x9d49('0x5'));var config=require(_0x9d49('0x6'));var controller=require(_0x9d49('0x7'));router[_0x9d49('0x8')]('/',auth[_0x9d49('0x9')](),controller['index']);router[_0x9d49('0x8')](_0x9d49('0xa'),auth[_0x9d49('0x9')](),controller[_0x9d49('0xb')]);router['get']('/:id',auth[_0x9d49('0x9')](),controller[_0x9d49('0xc')]);router[_0x9d49('0xd')]('/',auth[_0x9d49('0x9')](),controller['create']);router['put'](_0x9d49('0xe'),auth[_0x9d49('0x9')](),controller[_0x9d49('0xf')]);router[_0x9d49('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9d49('0x11')]);module[_0x9d49('0x12')]=router; \ No newline at end of file +var _0x9448=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./mailTransferReport.controller','index','get','/describe','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9448,0x112));var _0x8944=function(_0xd07790,_0x3db009){_0xd07790=_0xd07790-0x0;var _0x32f10e=_0x9448[_0xd07790];return _0x32f10e;};'use strict';var multer=require(_0x8944('0x0'));var util=require(_0x8944('0x1'));var path=require(_0x8944('0x2'));var timeout=require(_0x8944('0x3'));var express=require(_0x8944('0x4'));var router=express[_0x8944('0x5')]();var fs_extra=require(_0x8944('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8944('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8944('0x8')]);router[_0x8944('0x9')](_0x8944('0xa'),auth[_0x8944('0xb')](),controller[_0x8944('0xc')]);router[_0x8944('0x9')](_0x8944('0xd'),auth[_0x8944('0xb')](),controller[_0x8944('0xe')]);router[_0x8944('0xf')]('/',auth['isAuthenticated'](),controller[_0x8944('0x10')]);router[_0x8944('0x11')]('/:id',auth[_0x8944('0xb')](),controller[_0x8944('0x12')]);router[_0x8944('0x13')](_0x8944('0xd'),auth[_0x8944('0xb')](),controller[_0x8944('0x14')]);module[_0x8944('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 0a68dd4..6aaa1e9 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x54ef,0x112));var _0xf54e=function(_0x145fca,_0x49dde0){_0x145fca=_0x145fca-0x0;var _0x86623d=_0x54ef[_0x145fca];return _0x86623d;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index fa01f7f..e679bf2 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 _0xcfaa=['key','model','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','create','body','catch','describe','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','index','map','MailTransferReport','rawAttributes','fieldName'];(function(_0xc0d498,_0x268586){var _0x486115=function(_0x4b0307){while(--_0x4b0307){_0xc0d498['push'](_0xc0d498['shift']());}};_0x486115(++_0x268586);}(_0xcfaa,0x196));var _0xacfa=function(_0x4948d3,_0x206130){_0x4948d3=_0x4948d3-0x0;var _0x4ea424=_0xcfaa[_0x4948d3];return _0x4ea424;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xacfa('0x0'));var jsonpatch=require(_0xacfa('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xacfa('0x2'));var Mustache=require('mustache');var util=require(_0xacfa('0x3'));var path=require(_0xacfa('0x4'));var sox=require(_0xacfa('0x5'));var csv=require(_0xacfa('0x6'));var ejs=require(_0xacfa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacfa('0x8'));var squel=require(_0xacfa('0x9'));var crypto=require('crypto');var jsforce=require(_0xacfa('0xa'));var deskjs=require(_0xacfa('0xb'));var toCsv=require(_0xacfa('0x6'));var querystring=require(_0xacfa('0xc'));var Papa=require(_0xacfa('0xd'));var Redis=require(_0xacfa('0xe'));var authService=require(_0xacfa('0xf'));var qs=require(_0xacfa('0x10'));var as=require(_0xacfa('0x11'));var hardwareService=require(_0xacfa('0x12'));var logger=require(_0xacfa('0x13'))('api');var utils=require(_0xacfa('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xacfa('0x15'))['db'];function respondWithStatusCode(_0x4cb08c,_0x312bf5){_0x312bf5=_0x312bf5||0xcc;return function(_0x4d8c43){if(_0x4d8c43){return _0x4cb08c[_0xacfa('0x16')](_0x312bf5);}return _0x4cb08c[_0xacfa('0x17')](_0x312bf5)[_0xacfa('0x18')]();};}function respondWithResult(_0x43cd25,_0x5e00dc){_0x5e00dc=_0x5e00dc||0xc8;return function(_0x372691){if(_0x372691){return _0x43cd25[_0xacfa('0x17')](_0x5e00dc)[_0xacfa('0x19')](_0x372691);}};}function respondWithFilteredResult(_0xdc8a0f,_0x5df4a5){return function(_0x5b270b){if(_0x5b270b){var _0x1a81a8=typeof _0x5df4a5[_0xacfa('0x1a')]==='undefined'&&typeof _0x5df4a5['limit']===_0xacfa('0x1b');var _0x1000f8=_0x5b270b[_0xacfa('0x1c')];var _0x4996c3=_0x1a81a8?0x0:_0x5df4a5[_0xacfa('0x1a')];var _0x42e825=_0x1a81a8?_0x5b270b[_0xacfa('0x1c')]:_0x5df4a5[_0xacfa('0x1a')]+_0x5df4a5[_0xacfa('0x1d')];var _0x4e745b;if(_0x42e825>=_0x1000f8){_0x42e825=_0x1000f8;_0x4e745b=0xc8;}else{_0x4e745b=0xce;}_0xdc8a0f[_0xacfa('0x17')](_0x4e745b);return _0xdc8a0f[_0xacfa('0x1e')]('Content-Range',_0x4996c3+'-'+_0x42e825+'/'+_0x1000f8)[_0xacfa('0x19')](_0x5b270b);}return null;};}function patchUpdates(_0x3f00bb){return function(_0x2bd983){try{jsonpatch[_0xacfa('0x1f')](_0x2bd983,_0x3f00bb,!![]);}catch(_0x2f8adf){return BPromise[_0xacfa('0x20')](_0x2f8adf);}return _0x2bd983[_0xacfa('0x21')]();};}function saveUpdates(_0x2e0199,_0x119090){return function(_0x6ca3be){if(_0x6ca3be){return _0x6ca3be[_0xacfa('0x22')](_0x2e0199)[_0xacfa('0x23')](function(_0x523a8a){return _0x523a8a;});}return null;};}function removeEntity(_0x4e0bce,_0x2455b7){return function(_0xe32183){if(_0xe32183){return _0xe32183[_0xacfa('0x24')]()[_0xacfa('0x23')](function(){_0x4e0bce['status'](0xcc)[_0xacfa('0x18')]();});}};}function handleEntityNotFound(_0x466bcd,_0x268ce1){return function(_0x42f333){if(!_0x42f333){_0x466bcd[_0xacfa('0x16')](0x194);}return _0x42f333;};}function handleError(_0x1259e2,_0xca4412){_0xca4412=_0xca4412||0x1f4;return function(_0x3ef249){logger[_0xacfa('0x25')](_0x3ef249[_0xacfa('0x26')]);if(_0x3ef249['name']){delete _0x3ef249['name'];}_0x1259e2['status'](_0xca4412)['send'](_0x3ef249);};}exports[_0xacfa('0x27')]=function(_0x26fa29,_0x4c9454){var _0xf548f9={},_0x3a0c3d={},_0x4195b4={'count':0x0,'rows':[]};var _0x222f99=_[_0xacfa('0x28')](db[_0xacfa('0x29')][_0xacfa('0x2a')],function(_0x4d5cf8){return{'name':_0x4d5cf8[_0xacfa('0x2b')],'type':_0x4d5cf8['type'][_0xacfa('0x2c')]};});_0x3a0c3d[_0xacfa('0x2d')]=_['map'](_0x222f99,_0xacfa('0x2e'));_0x3a0c3d['query']=_[_0xacfa('0x2f')](_0x26fa29[_0xacfa('0x30')]);_0x3a0c3d[_0xacfa('0x31')]=_[_0xacfa('0x32')](_0x3a0c3d[_0xacfa('0x2d')],_0x3a0c3d[_0xacfa('0x30')]);_0xf548f9['attributes']=_['intersection'](_0x3a0c3d['model'],qs['fields'](_0x26fa29[_0xacfa('0x30')][_0xacfa('0x33')]));_0xf548f9[_0xacfa('0x34')]=_0xf548f9[_0xacfa('0x34')]['length']?_0xf548f9['attributes']:_0x3a0c3d[_0xacfa('0x2d')];if(!_0x26fa29['query'][_0xacfa('0x35')](_0xacfa('0x36'))){_0xf548f9[_0xacfa('0x1d')]=qs['limit'](_0x26fa29[_0xacfa('0x30')][_0xacfa('0x1d')]);_0xf548f9[_0xacfa('0x1a')]=qs[_0xacfa('0x1a')](_0x26fa29['query'][_0xacfa('0x1a')]);}_0xf548f9[_0xacfa('0x37')]=qs['sort'](_0x26fa29[_0xacfa('0x30')][_0xacfa('0x38')]);_0xf548f9[_0xacfa('0x39')]=qs[_0xacfa('0x31')](_['pick'](_0x26fa29['query'],_0x3a0c3d[_0xacfa('0x31')]),_0x222f99);if(_0x26fa29[_0xacfa('0x30')][_0xacfa('0x3a')]){_0xf548f9[_0xacfa('0x39')]=_[_0xacfa('0x3b')](_0xf548f9[_0xacfa('0x39')],{'$or':_[_0xacfa('0x28')](_0x222f99,function(_0x1cac1a){if(_0x1cac1a[_0xacfa('0x3c')]!==_0xacfa('0x3d')){var _0x5d7d65={};_0x5d7d65[_0x1cac1a[_0xacfa('0x2e')]]={'$like':'%'+_0x26fa29['query'][_0xacfa('0x3a')]+'%'};return _0x5d7d65;}})});}_0xf548f9=_[_0xacfa('0x3b')]({},_0xf548f9,_0x26fa29[_0xacfa('0x3e')]);var _0x3752d9={'where':_0xf548f9[_0xacfa('0x39')]};return db['MailTransferReport']['count'](_0x3752d9)[_0xacfa('0x23')](function(_0xa6c4b3){_0x4195b4[_0xacfa('0x1c')]=_0xa6c4b3;if(_0x26fa29[_0xacfa('0x30')]['includeAll']){_0xf548f9[_0xacfa('0x3f')]=[{'all':!![]}];}return db[_0xacfa('0x29')][_0xacfa('0x40')](_0xf548f9);})[_0xacfa('0x23')](function(_0x206cdd){_0x4195b4[_0xacfa('0x41')]=_0x206cdd;return _0x4195b4;})[_0xacfa('0x23')](respondWithFilteredResult(_0x4c9454,_0xf548f9))['catch'](handleError(_0x4c9454,null));};exports[_0xacfa('0x42')]=function(_0x365735,_0x20863e){var _0x92d084={'raw':!![],'where':{'id':_0x365735[_0xacfa('0x43')]['id']}},_0x94e7f9={};_0x94e7f9[_0xacfa('0x2d')]=_['keys'](db[_0xacfa('0x29')][_0xacfa('0x2a')]);_0x94e7f9[_0xacfa('0x30')]=_[_0xacfa('0x2f')](_0x365735[_0xacfa('0x30')]);_0x94e7f9[_0xacfa('0x31')]=_[_0xacfa('0x32')](_0x94e7f9[_0xacfa('0x2d')],_0x94e7f9['query']);_0x92d084[_0xacfa('0x34')]=_[_0xacfa('0x32')](_0x94e7f9['model'],qs['fields'](_0x365735['query']['fields']));_0x92d084[_0xacfa('0x34')]=_0x92d084[_0xacfa('0x34')][_0xacfa('0x44')]?_0x92d084[_0xacfa('0x34')]:_0x94e7f9[_0xacfa('0x2d')];if(_0x365735['query'][_0xacfa('0x45')]){_0x92d084[_0xacfa('0x3f')]=[{'all':!![]}];}_0x92d084=_[_0xacfa('0x3b')]({},_0x92d084,_0x365735[_0xacfa('0x3e')]);return db['MailTransferReport'][_0xacfa('0x46')](_0x92d084)['then'](handleEntityNotFound(_0x20863e,null))['then'](respondWithResult(_0x20863e,null))['catch'](handleError(_0x20863e,null));};exports[_0xacfa('0x47')]=function(_0x17e3b1,_0x2124c8){return db['MailTransferReport']['create'](_0x17e3b1[_0xacfa('0x48')],{})[_0xacfa('0x23')](respondWithResult(_0x2124c8,0xc9))['catch'](handleError(_0x2124c8,null));};exports[_0xacfa('0x22')]=function(_0x2c6179,_0x4ce886){if(_0x2c6179[_0xacfa('0x48')]['id']){delete _0x2c6179[_0xacfa('0x48')]['id'];}return db[_0xacfa('0x29')][_0xacfa('0x46')]({'where':{'id':_0x2c6179['params']['id']}})[_0xacfa('0x23')](handleEntityNotFound(_0x4ce886,null))[_0xacfa('0x23')](saveUpdates(_0x2c6179[_0xacfa('0x48')],null))[_0xacfa('0x23')](respondWithResult(_0x4ce886,null))[_0xacfa('0x49')](handleError(_0x4ce886,null));};exports['destroy']=function(_0x12b23f,_0x33939b){return db['MailTransferReport'][_0xacfa('0x46')]({'where':{'id':_0x12b23f[_0xacfa('0x43')]['id']}})[_0xacfa('0x23')](handleEntityNotFound(_0x33939b,null))[_0xacfa('0x23')](removeEntity(_0x33939b,null))[_0xacfa('0x49')](handleError(_0x33939b,null));};exports[_0xacfa('0x4a')]=function(_0x340ee3,_0x17f011){return db[_0xacfa('0x29')][_0xacfa('0x4a')]()[_0xacfa('0x23')](respondWithResult(_0x17f011,null))['catch'](handleError(_0x17f011,null));}; \ No newline at end of file +var _0x4a20=['show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch'];(function(_0xefe95f,_0x4c6493){var _0x29a7ee=function(_0x15c070){while(--_0x15c070){_0xefe95f['push'](_0xefe95f['shift']());}};_0x29a7ee(++_0x4c6493);}(_0x4a20,0xa5));var _0x04a2=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x4a20[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0x04a2('0x0'));var rimraf=require(_0x04a2('0x1'));var zipdir=require(_0x04a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04a2('0x3'));var moment=require(_0x04a2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04a2('0x5'));var path=require(_0x04a2('0x6'));var sox=require(_0x04a2('0x7'));var csv=require(_0x04a2('0x8'));var ejs=require(_0x04a2('0x9'));var fs=require('fs');var fs_extra=require(_0x04a2('0xa'));var _=require(_0x04a2('0xb'));var squel=require('squel');var crypto=require(_0x04a2('0xc'));var jsforce=require(_0x04a2('0xd'));var deskjs=require(_0x04a2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x04a2('0xf'));var Redis=require(_0x04a2('0x10'));var authService=require(_0x04a2('0x11'));var qs=require(_0x04a2('0x12'));var as=require(_0x04a2('0x13'));var hardwareService=require(_0x04a2('0x14'));var logger=require(_0x04a2('0x15'))(_0x04a2('0x16'));var utils=require(_0x04a2('0x17'));var config=require(_0x04a2('0x18'));var licenseUtil=require(_0x04a2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x541f06,_0x46a4d6){_0x46a4d6=_0x46a4d6||0xcc;return function(_0x2b6d12){if(_0x2b6d12){return _0x541f06[_0x04a2('0x1a')](_0x46a4d6);}return _0x541f06[_0x04a2('0x1b')](_0x46a4d6)[_0x04a2('0x1c')]();};}function respondWithResult(_0x45f57c,_0x243c77){_0x243c77=_0x243c77||0xc8;return function(_0xf4749d){if(_0xf4749d){return _0x45f57c[_0x04a2('0x1b')](_0x243c77)[_0x04a2('0x1d')](_0xf4749d);}};}function respondWithFilteredResult(_0x23fda0,_0x188a36){return function(_0x1f3b6b){if(_0x1f3b6b){var _0xb34b88=typeof _0x188a36[_0x04a2('0x1e')]===_0x04a2('0x1f')&&typeof _0x188a36[_0x04a2('0x20')]===_0x04a2('0x1f');var _0x4e7395=_0x1f3b6b[_0x04a2('0x21')];var _0x5c70ab=_0xb34b88?0x0:_0x188a36[_0x04a2('0x1e')];var _0x1c5ef8=_0xb34b88?_0x1f3b6b[_0x04a2('0x21')]:_0x188a36[_0x04a2('0x1e')]+_0x188a36[_0x04a2('0x20')];var _0x1b553a;if(_0x1c5ef8>=_0x4e7395){_0x1c5ef8=_0x4e7395;_0x1b553a=0xc8;}else{_0x1b553a=0xce;}_0x23fda0[_0x04a2('0x1b')](_0x1b553a);return _0x23fda0[_0x04a2('0x22')](_0x04a2('0x23'),_0x5c70ab+'-'+_0x1c5ef8+'/'+_0x4e7395)[_0x04a2('0x1d')](_0x1f3b6b);}return null;};}function patchUpdates(_0x4e5c84){return function(_0x18a079){try{jsonpatch['apply'](_0x18a079,_0x4e5c84,!![]);}catch(_0x56cf8d){return BPromise[_0x04a2('0x24')](_0x56cf8d);}return _0x18a079[_0x04a2('0x25')]();};}function saveUpdates(_0x875bcc,_0x2b929e){return function(_0x21d522){if(_0x21d522){return _0x21d522[_0x04a2('0x26')](_0x875bcc)[_0x04a2('0x27')](function(_0x44fabb){return _0x44fabb;});}return null;};}function removeEntity(_0x4a95ca,_0x5e1f20){return function(_0x53bba2){if(_0x53bba2){return _0x53bba2[_0x04a2('0x28')]()['then'](function(){_0x4a95ca[_0x04a2('0x1b')](0xcc)[_0x04a2('0x1c')]();});}};}function handleEntityNotFound(_0x2c53f9,_0x3b2e25){return function(_0x2acf7b){if(!_0x2acf7b){_0x2c53f9[_0x04a2('0x1a')](0x194);}return _0x2acf7b;};}function handleError(_0x516d60,_0x4bfb23){_0x4bfb23=_0x4bfb23||0x1f4;return function(_0x21de81){logger[_0x04a2('0x29')](_0x21de81[_0x04a2('0x2a')]);if(_0x21de81[_0x04a2('0x2b')]){delete _0x21de81['name'];}_0x516d60[_0x04a2('0x1b')](_0x4bfb23)[_0x04a2('0x2c')](_0x21de81);};}exports[_0x04a2('0x2d')]=function(_0x57ce6f,_0x3b6816){var _0x545ffe={},_0x2fe80c={},_0x5bafc3={'count':0x0,'rows':[]};var _0x276c95=_[_0x04a2('0x2e')](db[_0x04a2('0x2f')][_0x04a2('0x30')],function(_0x406d68){return{'name':_0x406d68[_0x04a2('0x31')],'type':_0x406d68['type'][_0x04a2('0x32')]};});_0x2fe80c[_0x04a2('0x33')]=_['map'](_0x276c95,_0x04a2('0x2b'));_0x2fe80c[_0x04a2('0x34')]=_[_0x04a2('0x35')](_0x57ce6f[_0x04a2('0x34')]);_0x2fe80c['filters']=_[_0x04a2('0x36')](_0x2fe80c[_0x04a2('0x33')],_0x2fe80c[_0x04a2('0x34')]);_0x545ffe['attributes']=_[_0x04a2('0x36')](_0x2fe80c[_0x04a2('0x33')],qs[_0x04a2('0x37')](_0x57ce6f[_0x04a2('0x34')]['fields']));_0x545ffe[_0x04a2('0x38')]=_0x545ffe['attributes']['length']?_0x545ffe[_0x04a2('0x38')]:_0x2fe80c[_0x04a2('0x33')];if(!_0x57ce6f['query'][_0x04a2('0x39')](_0x04a2('0x3a'))){_0x545ffe['limit']=qs[_0x04a2('0x20')](_0x57ce6f[_0x04a2('0x34')][_0x04a2('0x20')]);_0x545ffe[_0x04a2('0x1e')]=qs[_0x04a2('0x1e')](_0x57ce6f[_0x04a2('0x34')]['offset']);}_0x545ffe[_0x04a2('0x3b')]=qs[_0x04a2('0x3c')](_0x57ce6f['query']['sort']);_0x545ffe[_0x04a2('0x3d')]=qs[_0x04a2('0x3e')](_[_0x04a2('0x3f')](_0x57ce6f[_0x04a2('0x34')],_0x2fe80c[_0x04a2('0x3e')]),_0x276c95);if(_0x57ce6f[_0x04a2('0x34')][_0x04a2('0x40')]){_0x545ffe[_0x04a2('0x3d')]=_[_0x04a2('0x41')](_0x545ffe[_0x04a2('0x3d')],{'$or':_[_0x04a2('0x2e')](_0x276c95,function(_0x174dc0){if(_0x174dc0[_0x04a2('0x42')]!=='VIRTUAL'){var _0x1233f4={};_0x1233f4[_0x174dc0[_0x04a2('0x2b')]]={'$like':'%'+_0x57ce6f[_0x04a2('0x34')]['filter']+'%'};return _0x1233f4;}})});}_0x545ffe=_['merge']({},_0x545ffe,_0x57ce6f[_0x04a2('0x43')]);var _0x2b87a9={'where':_0x545ffe[_0x04a2('0x3d')]};return db[_0x04a2('0x2f')][_0x04a2('0x21')](_0x2b87a9)[_0x04a2('0x27')](function(_0xd874a6){_0x5bafc3['count']=_0xd874a6;if(_0x57ce6f[_0x04a2('0x34')][_0x04a2('0x44')]){_0x545ffe[_0x04a2('0x45')]=[{'all':!![]}];}return db[_0x04a2('0x2f')][_0x04a2('0x46')](_0x545ffe);})[_0x04a2('0x27')](function(_0x138732){_0x5bafc3['rows']=_0x138732;return _0x5bafc3;})[_0x04a2('0x27')](respondWithFilteredResult(_0x3b6816,_0x545ffe))[_0x04a2('0x47')](handleError(_0x3b6816,null));};exports[_0x04a2('0x48')]=function(_0x4f0d91,_0x58aaa8){var _0x551b36={'raw':!![],'where':{'id':_0x4f0d91['params']['id']}},_0x436646={};_0x436646[_0x04a2('0x33')]=_[_0x04a2('0x35')](db[_0x04a2('0x2f')][_0x04a2('0x30')]);_0x436646['query']=_[_0x04a2('0x35')](_0x4f0d91[_0x04a2('0x34')]);_0x436646[_0x04a2('0x3e')]=_[_0x04a2('0x36')](_0x436646[_0x04a2('0x33')],_0x436646[_0x04a2('0x34')]);_0x551b36[_0x04a2('0x38')]=_[_0x04a2('0x36')](_0x436646[_0x04a2('0x33')],qs[_0x04a2('0x37')](_0x4f0d91[_0x04a2('0x34')]['fields']));_0x551b36[_0x04a2('0x38')]=_0x551b36[_0x04a2('0x38')][_0x04a2('0x49')]?_0x551b36[_0x04a2('0x38')]:_0x436646['model'];if(_0x4f0d91['query'][_0x04a2('0x44')]){_0x551b36['include']=[{'all':!![]}];}_0x551b36=_['merge']({},_0x551b36,_0x4f0d91[_0x04a2('0x43')]);return db[_0x04a2('0x2f')][_0x04a2('0x4a')](_0x551b36)[_0x04a2('0x27')](handleEntityNotFound(_0x58aaa8,null))[_0x04a2('0x27')](respondWithResult(_0x58aaa8,null))[_0x04a2('0x47')](handleError(_0x58aaa8,null));};exports['create']=function(_0x4965b,_0x4ba9e1){return db[_0x04a2('0x2f')][_0x04a2('0x4b')](_0x4965b[_0x04a2('0x4c')],{})[_0x04a2('0x27')](respondWithResult(_0x4ba9e1,0xc9))['catch'](handleError(_0x4ba9e1,null));};exports[_0x04a2('0x26')]=function(_0x5b6dd4,_0x50dd7a){if(_0x5b6dd4[_0x04a2('0x4c')]['id']){delete _0x5b6dd4[_0x04a2('0x4c')]['id'];}return db[_0x04a2('0x2f')][_0x04a2('0x4a')]({'where':{'id':_0x5b6dd4[_0x04a2('0x4d')]['id']}})[_0x04a2('0x27')](handleEntityNotFound(_0x50dd7a,null))[_0x04a2('0x27')](saveUpdates(_0x5b6dd4[_0x04a2('0x4c')],null))['then'](respondWithResult(_0x50dd7a,null))[_0x04a2('0x47')](handleError(_0x50dd7a,null));};exports[_0x04a2('0x28')]=function(_0x2fd706,_0x16a7c7){return db['MailTransferReport']['find']({'where':{'id':_0x2fd706[_0x04a2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16a7c7,null))['then'](removeEntity(_0x16a7c7,null))[_0x04a2('0x47')](handleError(_0x16a7c7,null));};exports[_0x04a2('0x4e')]=function(_0x542f0e,_0x40a3be){return db[_0x04a2('0x2f')]['describe']()['then'](respondWithResult(_0x40a3be,null))['catch'](handleError(_0x40a3be,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index dabdb35..c6f0374 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 _0x7d33=['rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5232a9,_0x30a72d){var _0x5cc4e2=function(_0x2e8236){while(--_0x2e8236){_0x5232a9['push'](_0x5232a9['shift']());}};_0x5cc4e2(++_0x30a72d);}(_0x7d33,0x162));var _0x37d3=function(_0x5925e9,_0x51b161){_0x5925e9=_0x5925e9-0x0;var _0x72efff=_0x7d33[_0x5925e9];return _0x72efff;};'use strict';var _=require(_0x37d3('0x0'));var util=require('util');var logger=require(_0x37d3('0x1'))(_0x37d3('0x2'));var moment=require(_0x37d3('0x3'));var BPromise=require(_0x37d3('0x4'));var rp=require(_0x37d3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37d3('0x6'));var config=require(_0x37d3('0x7'));var attributes=require(_0x37d3('0x8'));module['exports']=function(_0x4a5bba,_0x18ca57){return _0x4a5bba[_0x37d3('0x9')](_0x37d3('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x37d3('0xb'),'fields':[_0x37d3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa81a=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x279841,_0x4e9e3b){var _0x4d3a9f=function(_0x261c2d){while(--_0x261c2d){_0x279841['push'](_0x279841['shift']());}};_0x4d3a9f(++_0x4e9e3b);}(_0xa81a,0x1f1));var _0xaa81=function(_0xd5c365,_0x4040b7){_0xd5c365=_0xd5c365-0x0;var _0x3e4875=_0xa81a[_0xd5c365];return _0x3e4875;};'use strict';var _=require(_0xaa81('0x0'));var util=require('util');var logger=require(_0xaa81('0x1'))(_0xaa81('0x2'));var moment=require(_0xaa81('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa81('0x4'));var fs=require('fs');var path=require(_0xaa81('0x5'));var rimraf=require(_0xaa81('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa81('0x7'));module[_0xaa81('0x8')]=function(_0x597248,_0x1df780){return _0x597248[_0xaa81('0x9')](_0xaa81('0xa'),attributes,{'tableName':_0xaa81('0xb'),'paranoid':![],'indexes':[{'name':_0xaa81('0xc'),'fields':[_0xaa81('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 0543f32..4cd6738 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 _0x24b3=['request','then','info','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailTransferReport,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x24b3,0x15a));var _0x324b=function(_0x5a7c4c,_0x499747){_0x5a7c4c=_0x5a7c4c-0x0;var _0x4478e9=_0x24b3[_0x5a7c4c];return _0x4478e9;};'use strict';var _=require(_0x324b('0x0'));var util=require(_0x324b('0x1'));var moment=require(_0x324b('0x2'));var BPromise=require(_0x324b('0x3'));var rs=require(_0x324b('0x4'));var fs=require('fs');var Redis=require(_0x324b('0x5'));var db=require(_0x324b('0x6'))['db'];var utils=require(_0x324b('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x324b('0x8'));var client=jayson[_0x324b('0x9')][_0x324b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27f20c,_0x30ed6f,_0x525058){return new BPromise(function(_0x2de96c,_0x376489){return client[_0x324b('0xb')](_0x27f20c,_0x525058)[_0x324b('0xc')](function(_0x405c11){logger[_0x324b('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x30ed6f,'request\x20sent');logger['debug'](_0x324b('0xe'),_0x30ed6f,_0x324b('0xf'),JSON[_0x324b('0x10')](_0x405c11));if(_0x405c11[_0x324b('0x11')]){if(_0x405c11[_0x324b('0x11')][_0x324b('0x12')]===0x1f4){logger[_0x324b('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x30ed6f,_0x405c11['error']['message']);return _0x376489(_0x405c11[_0x324b('0x11')]['message']);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x30ed6f,_0x405c11[_0x324b('0x11')][_0x324b('0x13')]);return _0x2de96c(_0x405c11['error'][_0x324b('0x13')]);}else{logger[_0x324b('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x30ed6f,_0x324b('0xf'));_0x2de96c(_0x405c11['result'][_0x324b('0x13')]);}})['catch'](function(_0x31b611){logger[_0x324b('0x11')](_0x324b('0x14'),_0x30ed6f,_0x31b611);_0x376489(_0x31b611);});});} \ No newline at end of file +var _0x57f1=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','lodash'];(function(_0xe57447,_0x44f6e0){var _0x5666e4=function(_0x119d34){while(--_0x119d34){_0xe57447['push'](_0xe57447['shift']());}};_0x5666e4(++_0x44f6e0);}(_0x57f1,0x141));var _0x157f=function(_0x3f6b3f,_0x2c6dc3){_0x3f6b3f=_0x3f6b3f-0x0;var _0x27db54=_0x57f1[_0x3f6b3f];return _0x27db54;};'use strict';var _=require(_0x157f('0x0'));var util=require(_0x157f('0x1'));var moment=require(_0x157f('0x2'));var BPromise=require(_0x157f('0x3'));var rs=require(_0x157f('0x4'));var fs=require('fs');var Redis=require(_0x157f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x157f('0x6'))(_0x157f('0x7'));var config=require(_0x157f('0x8'));var jayson=require(_0x157f('0x9'));var client=jayson[_0x157f('0xa')][_0x157f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x683a50,_0x1e49eb,_0x2144dc){return new BPromise(function(_0x5a753e,_0x4259b1){return client['request'](_0x683a50,_0x2144dc)[_0x157f('0xc')](function(_0x56f5ab){logger[_0x157f('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x1e49eb,'request\x20sent');logger[_0x157f('0xe')](_0x157f('0xf'),_0x1e49eb,_0x157f('0x10'),JSON[_0x157f('0x11')](_0x56f5ab));if(_0x56f5ab[_0x157f('0x12')]){if(_0x56f5ab[_0x157f('0x12')][_0x157f('0x13')]===0x1f4){logger[_0x157f('0x12')](_0x157f('0x14'),_0x1e49eb,_0x56f5ab[_0x157f('0x12')]['message']);return _0x4259b1(_0x56f5ab[_0x157f('0x12')][_0x157f('0x15')]);}logger[_0x157f('0x12')](_0x157f('0x14'),_0x1e49eb,_0x56f5ab[_0x157f('0x12')][_0x157f('0x15')]);return _0x5a753e(_0x56f5ab['error'][_0x157f('0x15')]);}else{logger[_0x157f('0xd')](_0x157f('0x14'),_0x1e49eb,_0x157f('0x10'));_0x5a753e(_0x56f5ab[_0x157f('0x16')][_0x157f('0x15')]);}})['catch'](function(_0x5201df){logger[_0x157f('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x1e49eb,_0x5201df);_0x4259b1(_0x5201df);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 392ca6f..16275c2 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 _0x3e57=['/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x557c28,_0x59f86d){var _0x429917=function(_0x1e7d94){while(--_0x1e7d94){_0x557c28['push'](_0x557c28['shift']());}};_0x429917(++_0x59f86d);}(_0x3e57,0x1aa));var _0x73e5=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0x3e57[_0x9edfd5];return _0x330738;};'use strict';var multer=require(_0x73e5('0x0'));var util=require(_0x73e5('0x1'));var path=require(_0x73e5('0x2'));var timeout=require(_0x73e5('0x3'));var express=require(_0x73e5('0x4'));var router=express[_0x73e5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x73e5('0x6'));var interaction=require(_0x73e5('0x7'));var config=require(_0x73e5('0x8'));var controller=require('./memberReport.controller');router[_0x73e5('0x9')]('/',auth['isAuthenticated'](),controller[_0x73e5('0xa')]);router[_0x73e5('0x9')](_0x73e5('0xb'),auth[_0x73e5('0xc')](),controller[_0x73e5('0xd')]);router['get'](_0x73e5('0xe'),auth['isAuthenticated'](),controller[_0x73e5('0xf')]);router[_0x73e5('0x10')]('/',auth[_0x73e5('0xc')](),controller[_0x73e5('0x11')]);router['put'](_0x73e5('0xe'),auth[_0x73e5('0xc')](),controller[_0x73e5('0x12')]);router[_0x73e5('0x13')]('/:id',auth[_0x73e5('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6b78=['create','put','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x29ed5a,_0x11abda){var _0x1ca80c=function(_0xaf6506){while(--_0xaf6506){_0x29ed5a['push'](_0x29ed5a['shift']());}};_0x1ca80c(++_0x11abda);}(_0x6b78,0x136));var _0x86b7=function(_0xae7928,_0x4f823d){_0xae7928=_0xae7928-0x0;var _0x30d1af=_0x6b78[_0xae7928];return _0x30d1af;};'use strict';var multer=require(_0x86b7('0x0'));var util=require('util');var path=require(_0x86b7('0x1'));var timeout=require(_0x86b7('0x2'));var express=require('express');var router=express[_0x86b7('0x3')]();var fs_extra=require(_0x86b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x86b7('0x5'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x86b7('0x6')]('/',auth[_0x86b7('0x7')](),controller[_0x86b7('0x8')]);router['get'](_0x86b7('0x9'),auth['isAuthenticated'](),controller[_0x86b7('0xa')]);router['get'](_0x86b7('0xb'),auth[_0x86b7('0x7')](),controller[_0x86b7('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x86b7('0xd')]);router[_0x86b7('0xe')]('/:id',auth[_0x86b7('0x7')](),controller['update']);router['delete'](_0x86b7('0xb'),auth[_0x86b7('0x7')](),controller[_0x86b7('0xf')]);module[_0x86b7('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 6282729..6f80c59 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 _0x32ff=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x5bb182,_0x7019a4){var _0x20f348=function(_0x1d43f4){while(--_0x1d43f4){_0x5bb182['push'](_0x5bb182['shift']());}};_0x20f348(++_0x7019a4);}(_0x32ff,0xc7));var _0xf32f=function(_0x3932ca,_0x16abfa){_0x3932ca=_0x3932ca-0x0;var _0x2cffaf=_0x32ff[_0x3932ca];return _0x2cffaf;};'use strict';var Sequelize=require(_0xf32f('0x0'));var moment=require(_0xf32f('0x1'));module[_0xf32f('0x2')]={'channel':{'type':Sequelize[_0xf32f('0x3')]},'membername':{'type':Sequelize[_0xf32f('0x3')]},'interface':{'type':Sequelize[_0xf32f('0x3')]},'type':{'type':Sequelize[_0xf32f('0x3')],'defaultValue':_0xf32f('0x4'),'comment':_0xf32f('0x5')},'duration':{'type':Sequelize[_0xf32f('0x6')]},'enterAt':{'type':Sequelize[_0xf32f('0x7')]},'exitAt':{'type':Sequelize[_0xf32f('0x7')],'set':function(_0x2a209f){var _0x5e5080=moment(_0x2a209f);var _0x1b688d=moment(this['getDataValue'](_0xf32f('0x8')));var _0x2756a3=_0x5e5080[_0xf32f('0x9')](_0x1b688d,_0xf32f('0xa'));this[_0xf32f('0xb')](_0xf32f('0xc'),_0x2a209f);this[_0xf32f('0xb')](_0xf32f('0xd'),_0x2756a3||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xf32f('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0xf32f('0xe')},'data4':{'type':Sequelize[_0xf32f('0x3')],'comment':_0xf32f('0xf')},'data5':{'type':Sequelize[_0xf32f('0x3')],'comment':_0xf32f('0x10')},'role':{'type':Sequelize[_0xf32f('0x3')]},'internal':{'type':Sequelize[_0xf32f('0x6')]},'uniqueid':{'type':Sequelize[_0xf32f('0x3')]}}; \ No newline at end of file +var _0x7794=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x5cef2b,_0x43cb68){var _0x1b144e=function(_0xa4cecf){while(--_0xa4cecf){_0x5cef2b['push'](_0x5cef2b['shift']());}};_0x1b144e(++_0x43cb68);}(_0x7794,0x7b));var _0x4779=function(_0x1a68f7,_0x35e028){_0x1a68f7=_0x1a68f7-0x0;var _0x51b498=_0x7794[_0x1a68f7];return _0x51b498;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4779('0x0'));module[_0x4779('0x1')]={'channel':{'type':Sequelize[_0x4779('0x2')]},'membername':{'type':Sequelize[_0x4779('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4779('0x2')],'defaultValue':_0x4779('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x4779('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x53fd58){var _0x45cd71=moment(_0x53fd58);var _0x339512=moment(this['getDataValue'](_0x4779('0x5')));var _0x13bb66=_0x45cd71[_0x4779('0x6')](_0x339512,_0x4779('0x7'));this[_0x4779('0x8')](_0x4779('0x9'),_0x53fd58);this[_0x4779('0x8')]('duration',_0x13bb66||null);}},'data1':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xa')},'data2':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xb')},'data3':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xc')},'data4':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xd')},'data5':{'type':Sequelize[_0x4779('0x2')],'comment':_0x4779('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'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 dfdb7e9..8a3a138 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55ca,0x126));var _0xa55c=function(_0x105c51,_0x412d34){_0x105c51=_0x105c51-0x0;var _0x1f727d=_0x55ca[_0x105c51];return _0x1f727d;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x916a4d,_0x5a26cd){var _0x90ff04=function(_0x3767a6){while(--_0x3767a6){_0x916a4d['push'](_0x916a4d['shift']());}};_0x90ff04(++_0x5a26cd);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index fccd572..de2dedf 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 _0xb928=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xb928,0x16e));var _0x8b92=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb928[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x8b92('0x0'));var util=require(_0x8b92('0x1'));var logger=require(_0x8b92('0x2'))(_0x8b92('0x3'));var moment=require(_0x8b92('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b92('0x6'));var config=require(_0x8b92('0x7'));var attributes=require(_0x8b92('0x8'));module[_0x8b92('0x9')]=function(_0x11678f,_0x59cc61){return _0x11678f[_0x8b92('0xa')](_0x8b92('0xb'),attributes,{'tableName':_0x8b92('0xc'),'paranoid':![],'indexes':[{'name':_0x8b92('0xd'),'fields':[_0x8b92('0xe'),_0x8b92('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb296=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface','lodash','util'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xb296,0xa3));var _0x6b29=function(_0x432591,_0x4d06c1){_0x432591=_0x432591-0x0;var _0x421634=_0xb296[_0x432591];return _0x421634;};'use strict';var _=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var logger=require(_0x6b29('0x2'))(_0x6b29('0x3'));var moment=require(_0x6b29('0x4'));var BPromise=require(_0x6b29('0x5'));var rp=require(_0x6b29('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b29('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b29('0x8'));module[_0x6b29('0x9')]=function(_0x5e0aa1,_0x327329){return _0x5e0aa1[_0x6b29('0xa')](_0x6b29('0xb'),attributes,{'tableName':_0x6b29('0xc'),'paranoid':![],'indexes':[{'name':_0x6b29('0xd'),'fields':['membername',_0x6b29('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index e1e6828..70ae2b3 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 _0xb931=['GetMemberReport','MemberReport','findAll','options','attributes','limit','include','map','model','debug','catch','CreateMemberReport','body','raw','then','update','UpdateMemberReport','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3600e4,_0x215e86){var _0x494bfa=function(_0x27c571){while(--_0x27c571){_0x3600e4['push'](_0x3600e4['shift']());}};_0x494bfa(++_0x215e86);}(_0xb931,0x155));var _0x1b93=function(_0x4a79f8,_0x9d87b){_0x4a79f8=_0x4a79f8-0x0;var _0x26a2b3=_0xb931[_0x4a79f8];return _0x26a2b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1b93('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b93('0x1'));var db=require(_0x1b93('0x2'))['db'];var utils=require(_0x1b93('0x3'));var logger=require(_0x1b93('0x4'))(_0x1b93('0x5'));var config=require(_0x1b93('0x6'));var jayson=require(_0x1b93('0x7'));var client=jayson[_0x1b93('0x8')][_0x1b93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c482c,_0x369a19,_0x55cda6){return new BPromise(function(_0x7462d7,_0x3dc130){return client[_0x1b93('0xa')](_0x1c482c,_0x55cda6)['then'](function(_0x541e77){logger[_0x1b93('0xb')](_0x1b93('0xc'),_0x369a19,_0x1b93('0xd'));logger['debug'](_0x1b93('0xe'),_0x369a19,'request\x20sent',JSON[_0x1b93('0xf')](_0x541e77));if(_0x541e77[_0x1b93('0x10')]){if(_0x541e77['error']['code']===0x1f4){logger[_0x1b93('0x10')](_0x1b93('0xc'),_0x369a19,_0x541e77[_0x1b93('0x10')]['message']);return _0x3dc130(_0x541e77[_0x1b93('0x10')]['message']);}logger[_0x1b93('0x10')](_0x1b93('0xc'),_0x369a19,_0x541e77[_0x1b93('0x10')][_0x1b93('0x11')]);return _0x7462d7(_0x541e77[_0x1b93('0x10')][_0x1b93('0x11')]);}else{logger['info'](_0x1b93('0xc'),_0x369a19,_0x1b93('0xd'));_0x7462d7(_0x541e77[_0x1b93('0x12')][_0x1b93('0x11')]);}})['catch'](function(_0x294be5){logger[_0x1b93('0x10')]('MemberReport,\x20%s,\x20%s',_0x369a19,_0x294be5);_0x3dc130(_0x294be5);});});}exports[_0x1b93('0x13')]=function(_0x339c5b){var _0x4ed0d5=this;return new Promise(function(_0x5ccbf4,_0x5f4d17){return db[_0x1b93('0x14')][_0x1b93('0x15')]({'raw':_0x339c5b[_0x1b93('0x16')]?_0x339c5b[_0x1b93('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x339c5b[_0x1b93('0x16')]?_0x339c5b[_0x1b93('0x16')]['where']||null:null,'attributes':_0x339c5b['options']?_0x339c5b[_0x1b93('0x16')][_0x1b93('0x17')]||null:null,'limit':_0x339c5b[_0x1b93('0x16')]?_0x339c5b[_0x1b93('0x16')][_0x1b93('0x18')]||null:null,'include':_0x339c5b[_0x1b93('0x16')]?_0x339c5b['options'][_0x1b93('0x19')]?_[_0x1b93('0x1a')](_0x339c5b[_0x1b93('0x16')]['include'],function(_0x1cfcd1){return{'model':db[_0x1cfcd1[_0x1b93('0x1b')]],'as':_0x1cfcd1['as'],'attributes':_0x1cfcd1[_0x1b93('0x17')],'include':_0x1cfcd1[_0x1b93('0x19')]?_[_0x1b93('0x1a')](_0x1cfcd1[_0x1b93('0x19')],function(_0x13cddc){return{'model':db[_0x13cddc[_0x1b93('0x1b')]],'as':_0x13cddc['as'],'attributes':_0x13cddc[_0x1b93('0x17')],'include':_0x13cddc[_0x1b93('0x19')]?_[_0x1b93('0x1a')](_0x13cddc[_0x1b93('0x19')],function(_0xa15258){return{'model':db[_0xa15258[_0x1b93('0x1b')]],'as':_0xa15258['as'],'attributes':_0xa15258[_0x1b93('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56e2d3){logger[_0x1b93('0xb')](_0x1b93('0x13'),_0x339c5b);logger[_0x1b93('0x1c')](_0x1b93('0x13'),_0x339c5b,JSON[_0x1b93('0xf')](_0x56e2d3));_0x5ccbf4(_0x56e2d3);})[_0x1b93('0x1d')](function(_0x59983e){logger['error'](_0x1b93('0x13'),_0x59983e[_0x1b93('0x11')],_0x339c5b);_0x5f4d17(_0x4ed0d5[_0x1b93('0x10')](0x1f4,_0x59983e['message']));});});};exports[_0x1b93('0x1e')]=function(_0x49873d){var _0x758971=this;return new Promise(function(_0x3d18c8,_0x38755c){return db['MemberReport']['create'](_0x49873d[_0x1b93('0x1f')],{'raw':_0x49873d['options']?_0x49873d[_0x1b93('0x16')][_0x1b93('0x20')]===undefined?!![]:![]:!![]})[_0x1b93('0x21')](function(_0x49c445){logger[_0x1b93('0xb')](_0x1b93('0x1e'),_0x49873d);logger[_0x1b93('0x1c')](_0x1b93('0x1e'),_0x49873d,JSON[_0x1b93('0xf')](_0x49c445));_0x3d18c8(_0x49c445);})[_0x1b93('0x1d')](function(_0xe46935){logger[_0x1b93('0x10')](_0x1b93('0x1e'),_0xe46935[_0x1b93('0x11')],_0x49873d);_0x38755c(_0x758971[_0x1b93('0x10')](0x1f4,_0xe46935['message']));});});};exports['UpdateMemberReport']=function(_0x1b0afa){var _0x6816b8=this;return new Promise(function(_0x1109b4,_0x102da3){return db[_0x1b93('0x14')][_0x1b93('0x22')](_0x1b0afa[_0x1b93('0x1f')],{'raw':_0x1b0afa['options']?_0x1b0afa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b0afa[_0x1b93('0x16')]?_0x1b0afa[_0x1b93('0x16')]['where']||null:null,'attributes':_0x1b0afa['options']?_0x1b0afa[_0x1b93('0x16')][_0x1b93('0x17')]||null:null,'limit':_0x1b0afa['options']?_0x1b0afa[_0x1b93('0x16')]['limit']||null:null})[_0x1b93('0x21')](function(_0x3da1b5){logger[_0x1b93('0xb')](_0x1b93('0x23'),_0x1b0afa);logger[_0x1b93('0x1c')](_0x1b93('0x23'),_0x1b0afa,JSON['stringify'](_0x3da1b5));_0x1109b4(_0x3da1b5);})[_0x1b93('0x1d')](function(_0x4b016d){logger[_0x1b93('0x10')]('UpdateMemberReport',_0x4b016d[_0x1b93('0x11')],_0x1b0afa);_0x102da3(_0x6816b8[_0x1b93('0x10')](0x1f4,_0x4b016d[_0x1b93('0x11')]));});});}; \ No newline at end of file +var _0x12e9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','MemberReport','options','raw','where','attributes','include','model','map','then','info','GetMemberReport','stringify','create','body','CreateMemberReport','UpdateMemberReport','update','moment','randomstring','ioredis'];(function(_0x220079,_0x237f40){var _0x2c2610=function(_0x38b9cd){while(--_0x38b9cd){_0x220079['push'](_0x220079['shift']());}};_0x2c2610(++_0x237f40);}(_0x12e9,0x66));var _0x912e=function(_0x41899d,_0x2082c1){_0x41899d=_0x41899d-0x0;var _0x49bb4c=_0x12e9[_0x41899d];return _0x49bb4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x912e('0x0'));var BPromise=require('bluebird');var rs=require(_0x912e('0x1'));var fs=require('fs');var Redis=require(_0x912e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x912e('0x3'));var logger=require(_0x912e('0x4'))('rpc');var config=require(_0x912e('0x5'));var jayson=require(_0x912e('0x6'));var client=jayson[_0x912e('0x7')][_0x912e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f4dbb,_0x2e950a,_0x2ccba9){return new BPromise(function(_0x2a8fc3,_0x7ac782){return client[_0x912e('0x9')](_0x4f4dbb,_0x2ccba9)['then'](function(_0x4beb4d){logger['info'](_0x912e('0xa'),_0x2e950a,_0x912e('0xb'));logger[_0x912e('0xc')](_0x912e('0xd'),_0x2e950a,_0x912e('0xb'),JSON['stringify'](_0x4beb4d));if(_0x4beb4d[_0x912e('0xe')]){if(_0x4beb4d[_0x912e('0xe')][_0x912e('0xf')]===0x1f4){logger[_0x912e('0xe')](_0x912e('0xa'),_0x2e950a,_0x4beb4d[_0x912e('0xe')][_0x912e('0x10')]);return _0x7ac782(_0x4beb4d[_0x912e('0xe')][_0x912e('0x10')]);}logger[_0x912e('0xe')](_0x912e('0xa'),_0x2e950a,_0x4beb4d[_0x912e('0xe')]['message']);return _0x2a8fc3(_0x4beb4d[_0x912e('0xe')]['message']);}else{logger['info'](_0x912e('0xa'),_0x2e950a,_0x912e('0xb'));_0x2a8fc3(_0x4beb4d[_0x912e('0x11')]['message']);}})['catch'](function(_0x174227){logger[_0x912e('0xe')](_0x912e('0xa'),_0x2e950a,_0x174227);_0x7ac782(_0x174227);});});}exports['GetMemberReport']=function(_0x36fb67){var _0x100790=this;return new Promise(function(_0x3286bb,_0x1d3345){return db[_0x912e('0x12')]['findAll']({'raw':_0x36fb67[_0x912e('0x13')]?_0x36fb67[_0x912e('0x13')][_0x912e('0x14')]===undefined?!![]:![]:!![],'where':_0x36fb67[_0x912e('0x13')]?_0x36fb67[_0x912e('0x13')][_0x912e('0x15')]||null:null,'attributes':_0x36fb67[_0x912e('0x13')]?_0x36fb67[_0x912e('0x13')][_0x912e('0x16')]||null:null,'limit':_0x36fb67[_0x912e('0x13')]?_0x36fb67[_0x912e('0x13')]['limit']||null:null,'include':_0x36fb67[_0x912e('0x13')]?_0x36fb67['options'][_0x912e('0x17')]?_['map'](_0x36fb67[_0x912e('0x13')][_0x912e('0x17')],function(_0x59feaa){return{'model':db[_0x59feaa[_0x912e('0x18')]],'as':_0x59feaa['as'],'attributes':_0x59feaa[_0x912e('0x16')],'include':_0x59feaa[_0x912e('0x17')]?_[_0x912e('0x19')](_0x59feaa[_0x912e('0x17')],function(_0x5ba003){return{'model':db[_0x5ba003[_0x912e('0x18')]],'as':_0x5ba003['as'],'attributes':_0x5ba003[_0x912e('0x16')],'include':_0x5ba003[_0x912e('0x17')]?_['map'](_0x5ba003[_0x912e('0x17')],function(_0x52c388){return{'model':db[_0x52c388[_0x912e('0x18')]],'as':_0x52c388['as'],'attributes':_0x52c388[_0x912e('0x16')]};}):[]};}):[]};}):[]:[]})[_0x912e('0x1a')](function(_0x3c6a2a){logger[_0x912e('0x1b')]('GetMemberReport',_0x36fb67);logger[_0x912e('0xc')](_0x912e('0x1c'),_0x36fb67,JSON[_0x912e('0x1d')](_0x3c6a2a));_0x3286bb(_0x3c6a2a);})['catch'](function(_0x357668){logger['error']('GetMemberReport',_0x357668['message'],_0x36fb67);_0x1d3345(_0x100790[_0x912e('0xe')](0x1f4,_0x357668['message']));});});};exports['CreateMemberReport']=function(_0x58d575){var _0x3f61a2=this;return new Promise(function(_0x106e86,_0x3c4cac){return db[_0x912e('0x12')][_0x912e('0x1e')](_0x58d575[_0x912e('0x1f')],{'raw':_0x58d575[_0x912e('0x13')]?_0x58d575[_0x912e('0x13')][_0x912e('0x14')]===undefined?!![]:![]:!![]})[_0x912e('0x1a')](function(_0x2faa5d){logger[_0x912e('0x1b')](_0x912e('0x20'),_0x58d575);logger['debug']('CreateMemberReport',_0x58d575,JSON[_0x912e('0x1d')](_0x2faa5d));_0x106e86(_0x2faa5d);})['catch'](function(_0xe5f115){logger[_0x912e('0xe')](_0x912e('0x20'),_0xe5f115[_0x912e('0x10')],_0x58d575);_0x3c4cac(_0x3f61a2[_0x912e('0xe')](0x1f4,_0xe5f115[_0x912e('0x10')]));});});};exports[_0x912e('0x21')]=function(_0x2405e1){var _0x7314f1=this;return new Promise(function(_0x1aa316,_0x5dd9e9){return db[_0x912e('0x12')][_0x912e('0x22')](_0x2405e1[_0x912e('0x1f')],{'raw':_0x2405e1[_0x912e('0x13')]?_0x2405e1[_0x912e('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2405e1[_0x912e('0x13')]?_0x2405e1['options'][_0x912e('0x15')]||null:null,'attributes':_0x2405e1[_0x912e('0x13')]?_0x2405e1[_0x912e('0x13')]['attributes']||null:null,'limit':_0x2405e1[_0x912e('0x13')]?_0x2405e1[_0x912e('0x13')]['limit']||null:null})[_0x912e('0x1a')](function(_0x3e3418){logger['info'](_0x912e('0x21'),_0x2405e1);logger[_0x912e('0xc')](_0x912e('0x21'),_0x2405e1,JSON[_0x912e('0x1d')](_0x3e3418));_0x1aa316(_0x3e3418);})['catch'](function(_0x243ee9){logger['error']('UpdateMemberReport',_0x243ee9[_0x912e('0x10')],_0x2405e1);_0x5dd9e9(_0x7314f1[_0x912e('0xe')](0x1f4,_0x243ee9[_0x912e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index fec0b01..31d3604 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 _0x67fa=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x3aa974,_0x22182f){var _0x1bfbe7=function(_0x59005e){while(--_0x59005e){_0x3aa974['push'](_0x3aa974['shift']());}};_0x1bfbe7(++_0x22182f);}(_0x67fa,0xc7));var _0xa67f=function(_0x40456b,_0x5d129b){_0x40456b=_0x40456b-0x0;var _0x20e58c=_0x67fa[_0x40456b];return _0x20e58c;};'use strict';var multer=require('multer');var util=require(_0xa67f('0x0'));var path=require(_0xa67f('0x1'));var timeout=require(_0xa67f('0x2'));var express=require('express');var router=express[_0xa67f('0x3')]();var fs_extra=require(_0xa67f('0x4'));var auth=require(_0xa67f('0x5'));var interaction=require(_0xa67f('0x6'));var config=require(_0xa67f('0x7'));var controller=require(_0xa67f('0x8'));router[_0xa67f('0x9')]('/',controller[_0xa67f('0xa')]);module[_0xa67f('0xb')]=router; \ No newline at end of file +var _0xad60=['exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./migration.controller','get','index'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xad60,0x19f));var _0x0ad6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xad60[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ad6('0x0'));var timeout=require(_0x0ad6('0x1'));var express=require('express');var router=express[_0x0ad6('0x2')]();var fs_extra=require(_0x0ad6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0ad6('0x4'));var config=require('../../config/environment');var controller=require(_0x0ad6('0x5'));router[_0x0ad6('0x6')]('/',controller[_0x0ad6('0x7')]);module[_0x0ad6('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 02277e7..a11cdbd 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 _0x7aef=['sequelize','exports','STRING','version'];(function(_0xe57ad7,_0x5c4374){var _0x190f4b=function(_0x312902){while(--_0x312902){_0xe57ad7['push'](_0xe57ad7['shift']());}};_0x190f4b(++_0x5c4374);}(_0x7aef,0x1d8));var _0xf7ae=function(_0x122146,_0x472de0){_0x122146=_0x122146-0x0;var _0x125837=_0x7aef[_0x122146];return _0x125837;};'use strict';var Sequelize=require(_0xf7ae('0x0'));module[_0xf7ae('0x1')]={'version':{'type':Sequelize[_0xf7ae('0x2')],'unique':_0xf7ae('0x3')}}; \ No newline at end of file +var _0x3415=['STRING','version'];(function(_0x2a9ae5,_0x5cc8a6){var _0x49257f=function(_0x1cd1cd){while(--_0x1cd1cd){_0x2a9ae5['push'](_0x2a9ae5['shift']());}};_0x49257f(++_0x5cc8a6);}(_0x3415,0x158));var _0x5341=function(_0x5a7226,_0x5e524b){_0x5a7226=_0x5a7226-0x0;var _0x1d74f3=_0x3415[_0x5a7226];return _0x1d74f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x5341('0x0')],'unique':_0x5341('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 5b78484..d3c2735 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 _0x0e06=['type','key','model','query','filters','attributes','fields','nolimit','order','sort','where','filter','merge','map','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','destroy','then','sendStatus','stack','name','Migration','rawAttributes','fieldName'];(function(_0x556672,_0x312845){var _0x43cbe1=function(_0x42e7b9){while(--_0x42e7b9){_0x556672['push'](_0x556672['shift']());}};_0x43cbe1(++_0x312845);}(_0x0e06,0x92));var _0x60e0=function(_0x1c4e53,_0x16d65a){_0x1c4e53=_0x1c4e53-0x0;var _0x47180a=_0x0e06[_0x1c4e53];return _0x47180a;};'use strict';var emlformat=require(_0x60e0('0x0'));var rimraf=require(_0x60e0('0x1'));var zipdir=require(_0x60e0('0x2'));var jsonpatch=require(_0x60e0('0x3'));var rp=require('request-promise');var moment=require(_0x60e0('0x4'));var BPromise=require(_0x60e0('0x5'));var Mustache=require(_0x60e0('0x6'));var util=require(_0x60e0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x60e0('0x8'));var ejs=require(_0x60e0('0x9'));var fs=require('fs');var fs_extra=require(_0x60e0('0xa'));var _=require(_0x60e0('0xb'));var squel=require('squel');var crypto=require(_0x60e0('0xc'));var jsforce=require(_0x60e0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x60e0('0xe'));var Papa=require(_0x60e0('0xf'));var Redis=require(_0x60e0('0x10'));var authService=require(_0x60e0('0x11'));var qs=require(_0x60e0('0x12'));var as=require(_0x60e0('0x13'));var hardwareService=require(_0x60e0('0x14'));var logger=require(_0x60e0('0x15'))(_0x60e0('0x16'));var utils=require(_0x60e0('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x476ef2,_0x512d6e){_0x512d6e=_0x512d6e||0xcc;return function(_0x5beca0){if(_0x5beca0){return _0x476ef2['sendStatus'](_0x512d6e);}return _0x476ef2[_0x60e0('0x18')](_0x512d6e)[_0x60e0('0x19')]();};}function respondWithResult(_0x289fd2,_0x22e60e){_0x22e60e=_0x22e60e||0xc8;return function(_0x2e2423){if(_0x2e2423){return _0x289fd2[_0x60e0('0x18')](_0x22e60e)[_0x60e0('0x1a')](_0x2e2423);}};}function respondWithFilteredResult(_0x7c51ff,_0x24aed4){return function(_0x44cdef){if(_0x44cdef){var _0x43b367=typeof _0x24aed4['offset']===_0x60e0('0x1b')&&typeof _0x24aed4[_0x60e0('0x1c')]===_0x60e0('0x1b');var _0x18b755=_0x44cdef[_0x60e0('0x1d')];var _0x31b0e7=_0x43b367?0x0:_0x24aed4['offset'];var _0x413f29=_0x43b367?_0x44cdef[_0x60e0('0x1d')]:_0x24aed4[_0x60e0('0x1e')]+_0x24aed4[_0x60e0('0x1c')];var _0x56a122;if(_0x413f29>=_0x18b755){_0x413f29=_0x18b755;_0x56a122=0xc8;}else{_0x56a122=0xce;}_0x7c51ff['status'](_0x56a122);return _0x7c51ff[_0x60e0('0x1f')](_0x60e0('0x20'),_0x31b0e7+'-'+_0x413f29+'/'+_0x18b755)[_0x60e0('0x1a')](_0x44cdef);}return null;};}function patchUpdates(_0x1b565b){return function(_0x4c8c1d){try{jsonpatch['apply'](_0x4c8c1d,_0x1b565b,!![]);}catch(_0x14b2ca){return BPromise[_0x60e0('0x21')](_0x14b2ca);}return _0x4c8c1d['save']();};}function saveUpdates(_0x778be1,_0x1c9399){return function(_0x4c81c7){if(_0x4c81c7){return _0x4c81c7[_0x60e0('0x22')](_0x778be1)['then'](function(_0x2af5e1){return _0x2af5e1;});}return null;};}function removeEntity(_0x54ec2d,_0x1b788f){return function(_0x2c7418){if(_0x2c7418){return _0x2c7418[_0x60e0('0x23')]()[_0x60e0('0x24')](function(){_0x54ec2d['status'](0xcc)[_0x60e0('0x19')]();});}};}function handleEntityNotFound(_0x51bef0,_0x130199){return function(_0x5d9e51){if(!_0x5d9e51){_0x51bef0[_0x60e0('0x25')](0x194);}return _0x5d9e51;};}function handleError(_0x17678f,_0x16b122){_0x16b122=_0x16b122||0x1f4;return function(_0x2a0ea5){logger['error'](_0x2a0ea5[_0x60e0('0x26')]);if(_0x2a0ea5[_0x60e0('0x27')]){delete _0x2a0ea5[_0x60e0('0x27')];}_0x17678f[_0x60e0('0x18')](_0x16b122)['send'](_0x2a0ea5);};}exports['index']=function(_0x2340c7,_0x2e4c10){var _0x15ab28={},_0x29449c={},_0x3c5f83={'count':0x0,'rows':[]};var _0x11b9a2=_['map'](db[_0x60e0('0x28')][_0x60e0('0x29')],function(_0x11b028){return{'name':_0x11b028[_0x60e0('0x2a')],'type':_0x11b028[_0x60e0('0x2b')][_0x60e0('0x2c')]};});_0x29449c[_0x60e0('0x2d')]=_['map'](_0x11b9a2,_0x60e0('0x27'));_0x29449c[_0x60e0('0x2e')]=_['keys'](_0x2340c7[_0x60e0('0x2e')]);_0x29449c[_0x60e0('0x2f')]=_['intersection'](_0x29449c[_0x60e0('0x2d')],_0x29449c['query']);_0x15ab28[_0x60e0('0x30')]=_['intersection'](_0x29449c['model'],qs[_0x60e0('0x31')](_0x2340c7['query'][_0x60e0('0x31')]));_0x15ab28[_0x60e0('0x30')]=_0x15ab28['attributes']['length']?_0x15ab28[_0x60e0('0x30')]:_0x29449c[_0x60e0('0x2d')];if(!_0x2340c7[_0x60e0('0x2e')]['hasOwnProperty'](_0x60e0('0x32'))){_0x15ab28[_0x60e0('0x1c')]=qs[_0x60e0('0x1c')](_0x2340c7['query'][_0x60e0('0x1c')]);_0x15ab28['offset']=qs[_0x60e0('0x1e')](_0x2340c7['query'][_0x60e0('0x1e')]);}_0x15ab28[_0x60e0('0x33')]=qs[_0x60e0('0x34')](_0x2340c7['query']['sort']);_0x15ab28[_0x60e0('0x35')]=qs[_0x60e0('0x2f')](_['pick'](_0x2340c7[_0x60e0('0x2e')],_0x29449c[_0x60e0('0x2f')]),_0x11b9a2);if(_0x2340c7[_0x60e0('0x2e')][_0x60e0('0x36')]){_0x15ab28[_0x60e0('0x35')]=_[_0x60e0('0x37')](_0x15ab28[_0x60e0('0x35')],{'$or':_[_0x60e0('0x38')](_0x11b9a2,function(_0x467fdb){if(_0x467fdb[_0x60e0('0x2b')]!=='VIRTUAL'){var _0x592e03={};_0x592e03[_0x467fdb[_0x60e0('0x27')]]={'$like':'%'+_0x2340c7[_0x60e0('0x2e')]['filter']+'%'};return _0x592e03;}})});}_0x15ab28=_[_0x60e0('0x37')]({},_0x15ab28,_0x2340c7[_0x60e0('0x39')]);var _0x592ccf={'where':_0x15ab28['where']};return db[_0x60e0('0x28')][_0x60e0('0x1d')](_0x592ccf)['then'](function(_0x3cc708){_0x3c5f83[_0x60e0('0x1d')]=_0x3cc708;if(_0x2340c7['query'][_0x60e0('0x3a')]){_0x15ab28[_0x60e0('0x3b')]=[{'all':!![]}];}return db[_0x60e0('0x28')][_0x60e0('0x3c')](_0x15ab28);})[_0x60e0('0x24')](function(_0x24023c){_0x3c5f83[_0x60e0('0x3d')]=_0x24023c;return _0x3c5f83;})[_0x60e0('0x24')](respondWithFilteredResult(_0x2e4c10,_0x15ab28))[_0x60e0('0x3e')](handleError(_0x2e4c10,null));}; \ No newline at end of file +var _0x4a05=['type','model','name','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','rows','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','map','Migration','rawAttributes'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x4a05,0x112));var _0x54a0=function(_0x3bc158,_0x436e3a){_0x3bc158=_0x3bc158-0x0;var _0x977671=_0x4a05[_0x3bc158];return _0x977671;};'use strict';var emlformat=require(_0x54a0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x54a0('0x1'));var rp=require(_0x54a0('0x2'));var moment=require(_0x54a0('0x3'));var BPromise=require(_0x54a0('0x4'));var Mustache=require(_0x54a0('0x5'));var util=require('util');var path=require(_0x54a0('0x6'));var sox=require(_0x54a0('0x7'));var csv=require(_0x54a0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54a0('0x9'));var _=require('lodash');var squel=require(_0x54a0('0xa'));var crypto=require(_0x54a0('0xb'));var jsforce=require(_0x54a0('0xc'));var deskjs=require(_0x54a0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x54a0('0xe'));var Papa=require(_0x54a0('0xf'));var Redis=require(_0x54a0('0x10'));var authService=require(_0x54a0('0x11'));var qs=require(_0x54a0('0x12'));var as=require(_0x54a0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54a0('0x14'))('api');var utils=require(_0x54a0('0x15'));var config=require(_0x54a0('0x16'));var licenseUtil=require(_0x54a0('0x17'));var db=require(_0x54a0('0x18'))['db'];function respondWithStatusCode(_0x4af15b,_0x487cea){_0x487cea=_0x487cea||0xcc;return function(_0x5e3f88){if(_0x5e3f88){return _0x4af15b[_0x54a0('0x19')](_0x487cea);}return _0x4af15b[_0x54a0('0x1a')](_0x487cea)[_0x54a0('0x1b')]();};}function respondWithResult(_0x2aeb5a,_0x140bda){_0x140bda=_0x140bda||0xc8;return function(_0x3a9cc8){if(_0x3a9cc8){return _0x2aeb5a[_0x54a0('0x1a')](_0x140bda)[_0x54a0('0x1c')](_0x3a9cc8);}};}function respondWithFilteredResult(_0x549166,_0x17dff0){return function(_0x1e89a2){if(_0x1e89a2){var _0x441f96=typeof _0x17dff0[_0x54a0('0x1d')]==='undefined'&&typeof _0x17dff0[_0x54a0('0x1e')]==='undefined';var _0x4a1200=_0x1e89a2['count'];var _0x405b2e=_0x441f96?0x0:_0x17dff0[_0x54a0('0x1d')];var _0x2834f7=_0x441f96?_0x1e89a2['count']:_0x17dff0[_0x54a0('0x1d')]+_0x17dff0['limit'];var _0x1cc950;if(_0x2834f7>=_0x4a1200){_0x2834f7=_0x4a1200;_0x1cc950=0xc8;}else{_0x1cc950=0xce;}_0x549166[_0x54a0('0x1a')](_0x1cc950);return _0x549166['set'](_0x54a0('0x1f'),_0x405b2e+'-'+_0x2834f7+'/'+_0x4a1200)['json'](_0x1e89a2);}return null;};}function patchUpdates(_0x28ed20){return function(_0x3d6731){try{jsonpatch[_0x54a0('0x20')](_0x3d6731,_0x28ed20,!![]);}catch(_0x29c02b){return BPromise[_0x54a0('0x21')](_0x29c02b);}return _0x3d6731[_0x54a0('0x22')]();};}function saveUpdates(_0x353ff0,_0x16a486){return function(_0x2c2eb2){if(_0x2c2eb2){return _0x2c2eb2[_0x54a0('0x23')](_0x353ff0)[_0x54a0('0x24')](function(_0x44c81){return _0x44c81;});}return null;};}function removeEntity(_0x212036,_0x163b7c){return function(_0x3eb514){if(_0x3eb514){return _0x3eb514[_0x54a0('0x25')]()[_0x54a0('0x24')](function(){_0x212036[_0x54a0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50db81,_0x113975){return function(_0x1ba25f){if(!_0x1ba25f){_0x50db81[_0x54a0('0x19')](0x194);}return _0x1ba25f;};}function handleError(_0x4f0ad3,_0x32c769){_0x32c769=_0x32c769||0x1f4;return function(_0x2c1737){logger['error'](_0x2c1737['stack']);if(_0x2c1737['name']){delete _0x2c1737['name'];}_0x4f0ad3[_0x54a0('0x1a')](_0x32c769)['send'](_0x2c1737);};}exports['index']=function(_0x2709c4,_0x3a98a7){var _0x422281={},_0x640020={},_0x205fa3={'count':0x0,'rows':[]};var _0xdc6ef3=_[_0x54a0('0x26')](db[_0x54a0('0x27')][_0x54a0('0x28')],function(_0x5b67f0){return{'name':_0x5b67f0['fieldName'],'type':_0x5b67f0[_0x54a0('0x29')]['key']};});_0x640020[_0x54a0('0x2a')]=_[_0x54a0('0x26')](_0xdc6ef3,_0x54a0('0x2b'));_0x640020[_0x54a0('0x2c')]=_['keys'](_0x2709c4[_0x54a0('0x2c')]);_0x640020['filters']=_['intersection'](_0x640020[_0x54a0('0x2a')],_0x640020[_0x54a0('0x2c')]);_0x422281[_0x54a0('0x2d')]=_[_0x54a0('0x2e')](_0x640020['model'],qs['fields'](_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x2f')]));_0x422281[_0x54a0('0x2d')]=_0x422281[_0x54a0('0x2d')][_0x54a0('0x30')]?_0x422281['attributes']:_0x640020['model'];if(!_0x2709c4['query']['hasOwnProperty'](_0x54a0('0x31'))){_0x422281['limit']=qs[_0x54a0('0x1e')](_0x2709c4['query'][_0x54a0('0x1e')]);_0x422281['offset']=qs[_0x54a0('0x1d')](_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x1d')]);}_0x422281[_0x54a0('0x32')]=qs[_0x54a0('0x33')](_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x33')]);_0x422281[_0x54a0('0x34')]=qs['filters'](_[_0x54a0('0x35')](_0x2709c4['query'],_0x640020[_0x54a0('0x36')]),_0xdc6ef3);if(_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x37')]){_0x422281[_0x54a0('0x34')]=_[_0x54a0('0x38')](_0x422281[_0x54a0('0x34')],{'$or':_[_0x54a0('0x26')](_0xdc6ef3,function(_0x4c2be3){if(_0x4c2be3['type']!==_0x54a0('0x39')){var _0x166e71={};_0x166e71[_0x4c2be3['name']]={'$like':'%'+_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x37')]+'%'};return _0x166e71;}})});}_0x422281=_[_0x54a0('0x38')]({},_0x422281,_0x2709c4[_0x54a0('0x3a')]);var _0x1c08fe={'where':_0x422281['where']};return db[_0x54a0('0x27')][_0x54a0('0x3b')](_0x1c08fe)[_0x54a0('0x24')](function(_0x31aa2b){_0x205fa3[_0x54a0('0x3b')]=_0x31aa2b;if(_0x2709c4[_0x54a0('0x2c')]['includeAll']){_0x422281[_0x54a0('0x3c')]=[{'all':!![]}];}return db[_0x54a0('0x27')]['findAll'](_0x422281);})['then'](function(_0x15712d){_0x205fa3[_0x54a0('0x3d')]=_0x15712d;return _0x205fa3;})['then'](respondWithFilteredResult(_0x3a98a7,_0x422281))[_0x54a0('0x3e')](handleError(_0x3a98a7,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e8f461f..a23d42f 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 _0xa9a9=['./migration.attributes','exports','Migration','migrations','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0xecab6a,_0x3c768a){var _0x40b98b=function(_0x448a28){while(--_0x448a28){_0xecab6a['push'](_0xecab6a['shift']());}};_0x40b98b(++_0x3c768a);}(_0xa9a9,0x108));var _0x9a9a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa9a9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9a9a('0x0'));var util=require(_0x9a9a('0x1'));var logger=require('../../config/logger')(_0x9a9a('0x2'));var moment=require('moment');var BPromise=require(_0x9a9a('0x3'));var rp=require(_0x9a9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a9a('0x5'));var config=require('../../config/environment');var attributes=require(_0x9a9a('0x6'));module[_0x9a9a('0x7')]=function(_0x131413,_0x4ada44){return _0x131413['define'](_0x9a9a('0x8'),attributes,{'tableName':_0x9a9a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde48=['./migration.attributes','define','migrations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x21b0e1,_0x7a8b77){var _0x25ad36=function(_0xffb259){while(--_0xffb259){_0x21b0e1['push'](_0x21b0e1['shift']());}};_0x25ad36(++_0x7a8b77);}(_0xde48,0x1cb));var _0x8de4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xde48[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x8de4('0x0'));var util=require(_0x8de4('0x1'));var logger=require(_0x8de4('0x2'))('api');var moment=require(_0x8de4('0x3'));var BPromise=require(_0x8de4('0x4'));var rp=require(_0x8de4('0x5'));var fs=require('fs');var path=require(_0x8de4('0x6'));var rimraf=require(_0x8de4('0x7'));var config=require(_0x8de4('0x8'));var attributes=require(_0x8de4('0x9'));module['exports']=function(_0x2235bf,_0x312c4d){return _0x2235bf[_0x8de4('0xa')]('Migration',attributes,{'tableName':_0x8de4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 561b277..42add48 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 _0x67da=['error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x67da,0x192));var _0xa67d=function(_0x3016e2,_0x2e51a0){_0x3016e2=_0x3016e2-0x0;var _0x1f067b=_0x67da[_0x3016e2];return _0x1f067b;};'use strict';var _=require('lodash');var util=require(_0xa67d('0x0'));var moment=require(_0xa67d('0x1'));var BPromise=require(_0xa67d('0x2'));var rs=require(_0xa67d('0x3'));var fs=require('fs');var Redis=require(_0xa67d('0x4'));var db=require(_0xa67d('0x5'))['db'];var utils=require(_0xa67d('0x6'));var logger=require(_0xa67d('0x7'))(_0xa67d('0x8'));var config=require(_0xa67d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa67d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d2734,_0x31d56a,_0x2346f4){return new BPromise(function(_0x10f89a,_0x2c37c2){return client[_0xa67d('0xb')](_0x4d2734,_0x2346f4)[_0xa67d('0xc')](function(_0x330a9f){logger[_0xa67d('0xd')](_0xa67d('0xe'),_0x31d56a,_0xa67d('0xf'));logger['debug'](_0xa67d('0x10'),_0x31d56a,_0xa67d('0xf'),JSON[_0xa67d('0x11')](_0x330a9f));if(_0x330a9f[_0xa67d('0x12')]){if(_0x330a9f['error'][_0xa67d('0x13')]===0x1f4){logger[_0xa67d('0x12')]('Migration,\x20%s,\x20%s',_0x31d56a,_0x330a9f['error'][_0xa67d('0x14')]);return _0x2c37c2(_0x330a9f['error'][_0xa67d('0x14')]);}logger['error']('Migration,\x20%s,\x20%s',_0x31d56a,_0x330a9f[_0xa67d('0x12')][_0xa67d('0x14')]);return _0x10f89a(_0x330a9f['error'][_0xa67d('0x14')]);}else{logger[_0xa67d('0xd')](_0xa67d('0xe'),_0x31d56a,_0xa67d('0xf'));_0x10f89a(_0x330a9f['result']['message']);}})['catch'](function(_0x4fa50f){logger[_0xa67d('0x12')]('Migration,\x20%s,\x20%s',_0x31d56a,_0x4fa50f);_0x2c37c2(_0x4fa50f);});});} \ No newline at end of file +var _0xb32d=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x545f2c,_0x58fbca){var _0x24305c=function(_0x1ff754){while(--_0x1ff754){_0x545f2c['push'](_0x545f2c['shift']());}};_0x24305c(++_0x58fbca);}(_0xb32d,0x1da));var _0xdb32=function(_0x107a84,_0x206679){_0x107a84=_0x107a84-0x0;var _0x3c494a=_0xb32d[_0x107a84];return _0x3c494a;};'use strict';var _=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var moment=require(_0xdb32('0x2'));var BPromise=require(_0xdb32('0x3'));var rs=require(_0xdb32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb32('0x5'));var logger=require(_0xdb32('0x6'))('rpc');var config=require(_0xdb32('0x7'));var jayson=require(_0xdb32('0x8'));var client=jayson[_0xdb32('0x9')][_0xdb32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f4af0,_0x386309,_0x5bb076){return new BPromise(function(_0x3b0995,_0x2686db){return client[_0xdb32('0xb')](_0x6f4af0,_0x5bb076)[_0xdb32('0xc')](function(_0x30e03d){logger[_0xdb32('0xd')](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));logger[_0xdb32('0x10')](_0xdb32('0x11'),_0x386309,_0xdb32('0xf'),JSON[_0xdb32('0x12')](_0x30e03d));if(_0x30e03d[_0xdb32('0x13')]){if(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x14')]===0x1f4){logger[_0xdb32('0x13')](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x2686db(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}logger['error'](_0xdb32('0xe'),_0x386309,_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);return _0x3b0995(_0x30e03d[_0xdb32('0x13')][_0xdb32('0x15')]);}else{logger['info'](_0xdb32('0xe'),_0x386309,_0xdb32('0xf'));_0x3b0995(_0x30e03d[_0xdb32('0x16')]['message']);}})['catch'](function(_0x59a5f8){logger['error'](_0xdb32('0xe'),_0x386309,_0x59a5f8);_0x2686db(_0x59a5f8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index bb2c6c7..b9a3522 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 _0x9303=['show','post','create','destroy','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./network.controller','get','index','isAuthenticated'];(function(_0x51af8c,_0x7ae22f){var _0x170551=function(_0x140494){while(--_0x140494){_0x51af8c['push'](_0x51af8c['shift']());}};_0x170551(++_0x7ae22f);}(_0x9303,0xd7));var _0x3930=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x9303[_0x416cdc];return _0x1931ce;};'use strict';var multer=require(_0x3930('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3930('0x1'));var express=require('express');var router=express[_0x3930('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3930('0x3'));var config=require(_0x3930('0x4'));var controller=require(_0x3930('0x5'));router[_0x3930('0x6')]('/',auth['isAuthenticated'](),controller[_0x3930('0x7')]);router['get']('/:id',auth[_0x3930('0x8')](),controller[_0x3930('0x9')]);router[_0x3930('0xa')]('/',auth[_0x3930('0x8')](),controller[_0x3930('0xb')]);router['put']('/:id',auth[_0x3930('0x8')](),controller['update']);router['delete']('/:id',auth[_0x3930('0x8')](),controller[_0x3930('0xc')]);module[_0x3930('0xd')]=router; \ No newline at end of file +var _0xcde7=['connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','path'];(function(_0x4d34f0,_0x1534b3){var _0x42b500=function(_0x4b3fe1){while(--_0x4b3fe1){_0x4d34f0['push'](_0x4d34f0['shift']());}};_0x42b500(++_0x1534b3);}(_0xcde7,0x65));var _0x7cde=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcde7[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7cde('0x0'));var timeout=require(_0x7cde('0x1'));var express=require(_0x7cde('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7cde('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7cde('0x4'));var controller=require(_0x7cde('0x5'));router[_0x7cde('0x6')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0x8')]);router[_0x7cde('0x6')]('/:id',auth[_0x7cde('0x7')](),controller['show']);router[_0x7cde('0x9')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0xa')]);router[_0x7cde('0xb')]('/:id',auth[_0x7cde('0x7')](),controller[_0x7cde('0xc')]);router[_0x7cde('0xd')](_0x7cde('0xe'),auth[_0x7cde('0x7')](),controller[_0x7cde('0xf')]);module[_0x7cde('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 52cadfa..25de5ee 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 _0x265f=['stun','turn','STRING','exports','ENUM','localnet','externip'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x265f,0x10d));var _0xf265=function(_0x34efa6,_0x343fe2){_0x34efa6=_0x34efa6-0x0;var _0x469490=_0x265f[_0x34efa6];return _0x469490;};'use strict';var Sequelize=require('sequelize');module[_0xf265('0x0')]={'type':{'type':Sequelize[_0xf265('0x1')](_0xf265('0x2'),_0xf265('0x3'),_0xf265('0x4'),_0xf265('0x5'))},'value':{'type':Sequelize[_0xf265('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf265('0x6')]}}; \ No newline at end of file +var _0x6096=['exports','localnet','stun','turn','STRING','sequelize'];(function(_0x1771a4,_0x5daef8){var _0x2191d7=function(_0x5c9e2f){while(--_0x5c9e2f){_0x1771a4['push'](_0x1771a4['shift']());}};_0x2191d7(++_0x5daef8);}(_0x6096,0xbf));var _0x6609=function(_0x1a759e,_0x23ca52){_0x1a759e=_0x1a759e-0x0;var _0x1c0ba7=_0x6096[_0x1a759e];return _0x1c0ba7;};'use strict';var Sequelize=require(_0x6609('0x0'));module[_0x6609('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6609('0x2'),'externip',_0x6609('0x3'),_0x6609('0x4'))},'value':{'type':Sequelize[_0x6609('0x5')]},'username':{'type':Sequelize[_0x6609('0x5')]},'password':{'type':Sequelize[_0x6609('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 23ba4d0..e89cc95 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 _0x0e85=['utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','STUN','readFileSync','TURN','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','then','destroy','sendStatus','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','VIRTUAL','merge','Network','count','includeAll','include','findAll','rows','show','params','rawAttributes','length','options','find','sequelize','transaction','create','body','toUpperCase','join','server/files/templates/stun_multiple.ejs'];(function(_0x16938f,_0x35e57f){var _0x5c66e9=function(_0x5167d7){while(--_0x5167d7){_0x16938f['push'](_0x16938f['shift']());}};_0x5c66e9(++_0x35e57f);}(_0x0e85,0x7c));var _0x50e8=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x0e85[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];var jayson=require(_0x50e8('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cb45c,_0x2abda1,_0x1a4c85,_0x473aa7){return new BPromise(function(_0x54efd3,_0x18596f){var _0x3149d4=_0x473aa7||client;return _0x3149d4[_0x50e8('0x18')](_0x3cb45c,_0x1a4c85)['then'](function(_0x5524a3){logger[_0x50e8('0x19')](_0x50e8('0x1a'),_0x2abda1,_0x50e8('0x1b'));logger[_0x50e8('0x1c')](_0x50e8('0x1d'),_0x2abda1,_0x50e8('0x1b'),JSON['stringify'](_0x5524a3));if(_0x5524a3['error']){if(_0x5524a3[_0x50e8('0x1e')][_0x50e8('0x1f')]===0x1f4){logger[_0x50e8('0x1e')](_0x50e8('0x1a'),_0x2abda1,_0x5524a3[_0x50e8('0x1e')][_0x50e8('0x20')]);return _0x18596f(_0x5524a3[_0x50e8('0x1e')]['message']);}logger[_0x50e8('0x1e')]('Network,\x20%s,\x20%s',_0x2abda1,_0x5524a3[_0x50e8('0x1e')][_0x50e8('0x20')]);return _0x54efd3(_0x5524a3[_0x50e8('0x1e')][_0x50e8('0x20')]);}else{logger[_0x50e8('0x19')]('Network,\x20%s,\x20%s',_0x2abda1,_0x50e8('0x1b'));_0x54efd3(_0x5524a3[_0x50e8('0x21')]['message']);}})[_0x50e8('0x22')](function(_0x41500f){logger['error'](_0x50e8('0x1a'),_0x2abda1,_0x41500f);_0x18596f(_0x41500f);});});}function respondWithStatusCode(_0xe7e56c,_0x4f56b7){_0x4f56b7=_0x4f56b7||0xcc;return function(_0x47a3d8){if(_0x47a3d8){return _0xe7e56c['sendStatus'](_0x4f56b7);}return _0xe7e56c[_0x50e8('0x23')](_0x4f56b7)[_0x50e8('0x24')]();};}function respondWithResult(_0x124402,_0x371a1f){_0x371a1f=_0x371a1f||0xc8;return function(_0xc2f832){if(_0xc2f832){return _0x124402[_0x50e8('0x23')](_0x371a1f)['json'](_0xc2f832);}};}function respondWithFilteredResult(_0x3a6442,_0x396611){return function(_0x4b3a09){if(_0x4b3a09){var _0x177201=typeof _0x396611[_0x50e8('0x25')]===_0x50e8('0x26')&&typeof _0x396611[_0x50e8('0x27')]==='undefined';var _0x1f5a6c=_0x4b3a09['count'];var _0x30fedf=_0x177201?0x0:_0x396611[_0x50e8('0x25')];var _0x42bbef=_0x177201?_0x4b3a09['count']:_0x396611[_0x50e8('0x25')]+_0x396611[_0x50e8('0x27')];var _0x1bed48;if(_0x42bbef>=_0x1f5a6c){_0x42bbef=_0x1f5a6c;_0x1bed48=0xc8;}else{_0x1bed48=0xce;}_0x3a6442[_0x50e8('0x23')](_0x1bed48);return _0x3a6442[_0x50e8('0x28')](_0x50e8('0x29'),_0x30fedf+'-'+_0x42bbef+'/'+_0x1f5a6c)[_0x50e8('0x2a')](_0x4b3a09);}return null;};}function patchUpdates(_0x54d81d){return function(_0x290fd2){try{jsonpatch[_0x50e8('0x2b')](_0x290fd2,_0x54d81d,!![]);}catch(_0x535c24){return BPromise['reject'](_0x535c24);}return _0x290fd2[_0x50e8('0x2c')]();};}function saveUpdates(_0x3543b2,_0x32db93){return function(_0x47ace2){if(_0x47ace2){return _0x47ace2['update'](_0x3543b2)[_0x50e8('0x2d')](function(_0x19e3cc){return _0x19e3cc;});}return null;};}function removeEntity(_0x5c2e04,_0x26b974){return function(_0x17c6a5){if(_0x17c6a5){return _0x17c6a5[_0x50e8('0x2e')]()[_0x50e8('0x2d')](function(){_0x5c2e04['status'](0xcc)[_0x50e8('0x24')]();});}};}function handleEntityNotFound(_0x4ec6ad,_0x3aec30){return function(_0x33fc5b){if(!_0x33fc5b){_0x4ec6ad[_0x50e8('0x2f')](0x194);}return _0x33fc5b;};}function handleError(_0x5e2c30,_0x306816){_0x306816=_0x306816||0x1f4;return function(_0x40f566){logger['error'](_0x40f566[_0x50e8('0x30')]);if(_0x40f566[_0x50e8('0x31')]){delete _0x40f566[_0x50e8('0x31')];}_0x5e2c30[_0x50e8('0x23')](_0x306816)['send'](_0x40f566);};}exports[_0x50e8('0x32')]=function(_0x40dbe8,_0x24d3ea){var _0x4e2a37={},_0x5e556c={},_0x3c7778={'count':0x0,'rows':[]};var _0x2d0ccf=_[_0x50e8('0x33')](db['Network']['rawAttributes'],function(_0x5dff99){return{'name':_0x5dff99[_0x50e8('0x34')],'type':_0x5dff99[_0x50e8('0x35')][_0x50e8('0x36')]};});_0x5e556c[_0x50e8('0x37')]=_[_0x50e8('0x33')](_0x2d0ccf,_0x50e8('0x31'));_0x5e556c[_0x50e8('0x38')]=_[_0x50e8('0x39')](_0x40dbe8[_0x50e8('0x38')]);_0x5e556c[_0x50e8('0x3a')]=_['intersection'](_0x5e556c[_0x50e8('0x37')],_0x5e556c[_0x50e8('0x38')]);_0x4e2a37[_0x50e8('0x3b')]=_[_0x50e8('0x3c')](_0x5e556c['model'],qs[_0x50e8('0x3d')](_0x40dbe8[_0x50e8('0x38')][_0x50e8('0x3d')]));_0x4e2a37[_0x50e8('0x3b')]=_0x4e2a37[_0x50e8('0x3b')]['length']?_0x4e2a37['attributes']:_0x5e556c[_0x50e8('0x37')];if(!_0x40dbe8[_0x50e8('0x38')]['hasOwnProperty'](_0x50e8('0x3e'))){_0x4e2a37[_0x50e8('0x27')]=qs[_0x50e8('0x27')](_0x40dbe8[_0x50e8('0x38')][_0x50e8('0x27')]);_0x4e2a37[_0x50e8('0x25')]=qs[_0x50e8('0x25')](_0x40dbe8[_0x50e8('0x38')]['offset']);}_0x4e2a37[_0x50e8('0x3f')]=qs[_0x50e8('0x40')](_0x40dbe8[_0x50e8('0x38')][_0x50e8('0x40')]);_0x4e2a37['where']=qs[_0x50e8('0x3a')](_[_0x50e8('0x41')](_0x40dbe8[_0x50e8('0x38')],_0x5e556c[_0x50e8('0x3a')]),_0x2d0ccf);if(_0x40dbe8['query'][_0x50e8('0x42')]){_0x4e2a37['where']=_['merge'](_0x4e2a37['where'],{'$or':_[_0x50e8('0x33')](_0x2d0ccf,function(_0x30077f){if(_0x30077f['type']!==_0x50e8('0x43')){var _0x2007c4={};_0x2007c4[_0x30077f[_0x50e8('0x31')]]={'$like':'%'+_0x40dbe8[_0x50e8('0x38')][_0x50e8('0x42')]+'%'};return _0x2007c4;}})});}_0x4e2a37=_[_0x50e8('0x44')]({},_0x4e2a37,_0x40dbe8['options']);var _0x16fdf6={'where':_0x4e2a37['where']};return db[_0x50e8('0x45')][_0x50e8('0x46')](_0x16fdf6)['then'](function(_0xcac7c2){_0x3c7778['count']=_0xcac7c2;if(_0x40dbe8[_0x50e8('0x38')][_0x50e8('0x47')]){_0x4e2a37[_0x50e8('0x48')]=[{'all':!![]}];}return db[_0x50e8('0x45')][_0x50e8('0x49')](_0x4e2a37);})[_0x50e8('0x2d')](function(_0x229d60){_0x3c7778[_0x50e8('0x4a')]=_0x229d60;return _0x3c7778;})[_0x50e8('0x2d')](respondWithFilteredResult(_0x24d3ea,_0x4e2a37))[_0x50e8('0x22')](handleError(_0x24d3ea,null));};exports[_0x50e8('0x4b')]=function(_0x49bfa8,_0x179f6b){var _0x275a1b={'raw':!![],'where':{'id':_0x49bfa8[_0x50e8('0x4c')]['id']}},_0x479431={};_0x479431['model']=_[_0x50e8('0x39')](db['Network'][_0x50e8('0x4d')]);_0x479431[_0x50e8('0x38')]=_[_0x50e8('0x39')](_0x49bfa8[_0x50e8('0x38')]);_0x479431[_0x50e8('0x3a')]=_[_0x50e8('0x3c')](_0x479431[_0x50e8('0x37')],_0x479431['query']);_0x275a1b[_0x50e8('0x3b')]=_[_0x50e8('0x3c')](_0x479431[_0x50e8('0x37')],qs[_0x50e8('0x3d')](_0x49bfa8[_0x50e8('0x38')][_0x50e8('0x3d')]));_0x275a1b['attributes']=_0x275a1b[_0x50e8('0x3b')][_0x50e8('0x4e')]?_0x275a1b[_0x50e8('0x3b')]:_0x479431[_0x50e8('0x37')];if(_0x49bfa8['query'][_0x50e8('0x47')]){_0x275a1b[_0x50e8('0x48')]=[{'all':!![]}];}_0x275a1b=_[_0x50e8('0x44')]({},_0x275a1b,_0x49bfa8[_0x50e8('0x4f')]);return db[_0x50e8('0x45')][_0x50e8('0x50')](_0x275a1b)[_0x50e8('0x2d')](handleEntityNotFound(_0x179f6b,null))['then'](respondWithResult(_0x179f6b,null))['catch'](handleError(_0x179f6b,null));};exports['create']=function(_0x2b54ad,_0x1400e7,_0x35b237){var _0x1c9e78;return db[_0x50e8('0x51')][_0x50e8('0x52')](function(_0x566723){return db[_0x50e8('0x45')][_0x50e8('0x53')](_0x2b54ad[_0x50e8('0x54')],{'raw':!![]})[_0x50e8('0x2d')](function(_0x4a3281){_0x1c9e78=_0x4a3281;return db[_0x50e8('0x45')][_0x50e8('0x49')]({'where':{'type':_0x2b54ad[_0x50e8('0x54')][_0x50e8('0x35')]},'raw':!![]});})[_0x50e8('0x2d')](function(_0x454268){if(_0x1c9e78['type'][_0x50e8('0x55')]()=='STUN'){var _0x583aea=fs['readFileSync'](path[_0x50e8('0x56')](config['root'],_0x50e8('0x57')),_0x50e8('0x58'));var _0x339f53=ejs[_0x50e8('0x59')](_0x583aea,{'networks':_0x454268||[]});fs[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x339f53);return respondWithRpcPromise(_0x50e8('0x5c'),'create',{'module':_0x50e8('0x5d')});}else if(_0x1c9e78[_0x50e8('0x35')][_0x50e8('0x55')]()=='TURN'){var _0x498fbe=fs['readFileSync'](path[_0x50e8('0x56')](config[_0x50e8('0x5e')],_0x50e8('0x5f')),_0x50e8('0x58'));var _0x3327d5=ejs[_0x50e8('0x59')](_0x498fbe,{'networks':_0x454268||[]});fs['writeFileSync'](_0x50e8('0x60'),_0x3327d5);return respondWithRpcPromise('Reload',_0x50e8('0x53'),{'module':_0x50e8('0x5d')});}else{var _0x5ad5ec=fs['readFileSync'](path['join'](config[_0x50e8('0x5e')],_0x50e8('0x61')),'utf8');var _0x351047=ejs[_0x50e8('0x59')](_0x5ad5ec,{'networks':_0x454268||[]});fs[_0x50e8('0x5a')](util[_0x50e8('0x62')](_0x50e8('0x63'),_0x2b54ad['body'][_0x50e8('0x35')][_0x50e8('0x64')]()),_0x351047);return respondWithRpcPromise(_0x50e8('0x5c'),'create',{'module':'chan_sip.so'});}return null;})[_0x50e8('0x2d')](function(){return _0x1c9e78;});})[_0x50e8('0x2d')](respondWithResult(_0x1400e7,0xc9))[_0x50e8('0x22')](handleError(_0x1400e7,null));};exports[_0x50e8('0x65')]=function(_0x2b59f5,_0x257f9e,_0x58714c){var _0x51ffae;return db[_0x50e8('0x51')]['transaction'](function(_0x1fc530){return db[_0x50e8('0x45')]['find']({'where':{'id':_0x2b59f5[_0x50e8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x257f9e,null))['then'](saveUpdates(_0x2b59f5['body'],null))[_0x50e8('0x2d')](function(_0x2d4fe8){if(_0x2d4fe8){_0x51ffae=_0x2d4fe8;return db[_0x50e8('0x45')][_0x50e8('0x49')]({'where':{'type':_0x51ffae['type']},'raw':!![]});}return null;})['then'](function(_0x25d89e){if(_0x51ffae[_0x50e8('0x35')][_0x50e8('0x55')]()==_0x50e8('0x66')){var _0x20c5e8=fs[_0x50e8('0x67')](path[_0x50e8('0x56')](config[_0x50e8('0x5e')],_0x50e8('0x57')),_0x50e8('0x58'));var _0x109920=ejs[_0x50e8('0x59')](_0x20c5e8,{'networks':_0x25d89e||[]});fs[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x109920);return respondWithRpcPromise(_0x50e8('0x5c'),_0x50e8('0x65'),{'module':_0x50e8('0x5d')});}else if(_0x51ffae[_0x50e8('0x35')]['toUpperCase']()==_0x50e8('0x68')){var _0x474978=fs[_0x50e8('0x67')](path[_0x50e8('0x56')](config['root'],_0x50e8('0x5f')),_0x50e8('0x58'));var _0x26c505=ejs[_0x50e8('0x59')](_0x474978,{'networks':_0x25d89e||[]});fs[_0x50e8('0x5a')](_0x50e8('0x60'),_0x26c505);return respondWithRpcPromise('Reload',_0x50e8('0x65'),{'module':_0x50e8('0x5d')});}else{var _0x19e44c=fs[_0x50e8('0x67')](path['join'](config[_0x50e8('0x5e')],'server/files/templates/network.ejs'),_0x50e8('0x58'));var _0x1ef8e8=ejs[_0x50e8('0x59')](_0x19e44c,{'networks':_0x25d89e||[]});fs[_0x50e8('0x5a')](util[_0x50e8('0x62')]('/etc/asterisk/sip_xcally_%s.conf',_0x2b59f5[_0x50e8('0x54')][_0x50e8('0x35')][_0x50e8('0x64')]()),_0x1ef8e8);return respondWithRpcPromise(_0x50e8('0x5c'),_0x50e8('0x65'),{'module':_0x50e8('0x69')});}return null;})['then'](function(_0x248f73){if(_0x248f73){return _0x51ffae;}return null;});})[_0x50e8('0x2d')](respondWithResult(_0x257f9e,null))['catch'](handleError(_0x257f9e,null));};exports[_0x50e8('0x2e')]=function(_0x2fc1b6,_0x4f72e7,_0x3d56e7){var _0x4bcb64;return db[_0x50e8('0x45')][_0x50e8('0x50')]({'where':{'id':_0x2fc1b6['params']['id']}})[_0x50e8('0x2d')](function(_0x1733f5){_0x4bcb64=_0x1733f5;return _0x1733f5;})[_0x50e8('0x2d')](handleEntityNotFound(_0x4f72e7,null))[_0x50e8('0x2d')](removeEntity(_0x4f72e7,null))['then'](function(){if(_0x4bcb64){return db[_0x50e8('0x45')]['findAll']({'where':{'type':_0x4bcb64[_0x50e8('0x35')]},'raw':!![]});}})[_0x50e8('0x2d')](function(_0x52cb34){if(_0x4bcb64[_0x50e8('0x35')][_0x50e8('0x55')]()==_0x50e8('0x66')){var _0x2ea86b=fs[_0x50e8('0x67')](path[_0x50e8('0x56')](config[_0x50e8('0x5e')],_0x50e8('0x57')),_0x50e8('0x58'));var _0x48d16a=ejs[_0x50e8('0x59')](_0x2ea86b,{'networks':_0x52cb34||[]});fs[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x48d16a);return respondWithRpcPromise('Reload',_0x50e8('0x2e'),{'module':_0x50e8('0x5d')});}else if(_0x4bcb64[_0x50e8('0x35')]['toUpperCase']()=='TURN'){var _0x37839e=fs[_0x50e8('0x67')](path['join'](config[_0x50e8('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x50e8('0x58'));var _0x21bff2=ejs[_0x50e8('0x59')](_0x37839e,{'networks':_0x52cb34||[]});fs[_0x50e8('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x21bff2);return respondWithRpcPromise(_0x50e8('0x5c'),'destroy',{'module':_0x50e8('0x5d')});}else{var _0x51ea2a=fs['readFileSync'](path[_0x50e8('0x56')](config[_0x50e8('0x5e')],'server/files/templates/network.ejs'),_0x50e8('0x58'));var _0x5a34d7=ejs[_0x50e8('0x59')](_0x51ea2a,{'networks':_0x52cb34||[]});fs['writeFileSync'](util['format'](_0x50e8('0x63'),_0x2fc1b6[_0x50e8('0x54')][_0x50e8('0x35')][_0x50e8('0x64')]()),_0x5a34d7);return respondWithRpcPromise('Reload',_0x50e8('0x2e'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x4f72e7,null));}; \ No newline at end of file +var _0xce5c=['root','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','toLowerCase','chan_sip.so','update','sequelize','params','STUN','/etc/asterisk/turn_xcally.conf','destroy','format','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','Network','includeAll','include','findAll','show','find','transaction','create','body','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN'];(function(_0x4cd3db,_0x28e2a0){var _0x20135a=function(_0x27cdca){while(--_0x27cdca){_0x4cd3db['push'](_0x4cd3db['shift']());}};_0x20135a(++_0x28e2a0);}(_0xce5c,0x79));var _0xcce5=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xce5c[_0x3bfdde];return _0x3f752a;};'use strict';var emlformat=require(_0xcce5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcce5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcce5('0x2'));var BPromise=require(_0xcce5('0x3'));var Mustache=require(_0xcce5('0x4'));var util=require('util');var path=require(_0xcce5('0x5'));var sox=require(_0xcce5('0x6'));var csv=require(_0xcce5('0x7'));var ejs=require(_0xcce5('0x8'));var fs=require('fs');var fs_extra=require(_0xcce5('0x9'));var _=require(_0xcce5('0xa'));var squel=require(_0xcce5('0xb'));var crypto=require(_0xcce5('0xc'));var jsforce=require(_0xcce5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcce5('0x7'));var querystring=require(_0xcce5('0xe'));var Papa=require(_0xcce5('0xf'));var Redis=require(_0xcce5('0x10'));var authService=require(_0xcce5('0x11'));var qs=require(_0xcce5('0x12'));var as=require(_0xcce5('0x13'));var hardwareService=require(_0xcce5('0x14'));var logger=require(_0xcce5('0x15'))(_0xcce5('0x16'));var utils=require(_0xcce5('0x17'));var config=require(_0xcce5('0x18'));var licenseUtil=require(_0xcce5('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcce5('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44c437,_0x2318b7,_0x4e82d9,_0x1fa558){return new BPromise(function(_0x29a501,_0x2dc241){var _0xbbe1d9=_0x1fa558||client;return _0xbbe1d9['request'](_0x44c437,_0x4e82d9)[_0xcce5('0x1b')](function(_0x3b7cef){logger[_0xcce5('0x1c')](_0xcce5('0x1d'),_0x2318b7,_0xcce5('0x1e'));logger[_0xcce5('0x1f')](_0xcce5('0x20'),_0x2318b7,_0xcce5('0x1e'),JSON[_0xcce5('0x21')](_0x3b7cef));if(_0x3b7cef[_0xcce5('0x22')]){if(_0x3b7cef['error'][_0xcce5('0x23')]===0x1f4){logger[_0xcce5('0x22')]('Network,\x20%s,\x20%s',_0x2318b7,_0x3b7cef[_0xcce5('0x22')][_0xcce5('0x24')]);return _0x2dc241(_0x3b7cef[_0xcce5('0x22')][_0xcce5('0x24')]);}logger['error'](_0xcce5('0x1d'),_0x2318b7,_0x3b7cef[_0xcce5('0x22')]['message']);return _0x29a501(_0x3b7cef[_0xcce5('0x22')][_0xcce5('0x24')]);}else{logger[_0xcce5('0x1c')](_0xcce5('0x1d'),_0x2318b7,_0xcce5('0x1e'));_0x29a501(_0x3b7cef[_0xcce5('0x25')]['message']);}})[_0xcce5('0x26')](function(_0x5b05ce){logger['error']('Network,\x20%s,\x20%s',_0x2318b7,_0x5b05ce);_0x2dc241(_0x5b05ce);});});}function respondWithStatusCode(_0x581632,_0x124919){_0x124919=_0x124919||0xcc;return function(_0x179f04){if(_0x179f04){return _0x581632[_0xcce5('0x27')](_0x124919);}return _0x581632[_0xcce5('0x28')](_0x124919)[_0xcce5('0x29')]();};}function respondWithResult(_0x389d10,_0x33ca89){_0x33ca89=_0x33ca89||0xc8;return function(_0x5e801a){if(_0x5e801a){return _0x389d10[_0xcce5('0x28')](_0x33ca89)[_0xcce5('0x2a')](_0x5e801a);}};}function respondWithFilteredResult(_0x5c88d4,_0x589e63){return function(_0x3dbbaf){if(_0x3dbbaf){var _0x15c7d8=typeof _0x589e63[_0xcce5('0x2b')]===_0xcce5('0x2c')&&typeof _0x589e63[_0xcce5('0x2d')]===_0xcce5('0x2c');var _0x360a43=_0x3dbbaf[_0xcce5('0x2e')];var _0x13ae88=_0x15c7d8?0x0:_0x589e63[_0xcce5('0x2b')];var _0x2209a6=_0x15c7d8?_0x3dbbaf[_0xcce5('0x2e')]:_0x589e63[_0xcce5('0x2b')]+_0x589e63[_0xcce5('0x2d')];var _0x19b4e4;if(_0x2209a6>=_0x360a43){_0x2209a6=_0x360a43;_0x19b4e4=0xc8;}else{_0x19b4e4=0xce;}_0x5c88d4['status'](_0x19b4e4);return _0x5c88d4[_0xcce5('0x2f')](_0xcce5('0x30'),_0x13ae88+'-'+_0x2209a6+'/'+_0x360a43)['json'](_0x3dbbaf);}return null;};}function patchUpdates(_0x40b50d){return function(_0x57a240){try{jsonpatch[_0xcce5('0x31')](_0x57a240,_0x40b50d,!![]);}catch(_0xe7c038){return BPromise['reject'](_0xe7c038);}return _0x57a240[_0xcce5('0x32')]();};}function saveUpdates(_0x14d3f5,_0x430b52){return function(_0x3194ac){if(_0x3194ac){return _0x3194ac['update'](_0x14d3f5)[_0xcce5('0x1b')](function(_0x39005b){return _0x39005b;});}return null;};}function removeEntity(_0x9189ec,_0x539c20){return function(_0x208540){if(_0x208540){return _0x208540['destroy']()[_0xcce5('0x1b')](function(){_0x9189ec[_0xcce5('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28fc1d,_0x1e3f9a){return function(_0x314a32){if(!_0x314a32){_0x28fc1d[_0xcce5('0x27')](0x194);}return _0x314a32;};}function handleError(_0x99b718,_0x206240){_0x206240=_0x206240||0x1f4;return function(_0x14a48e){logger['error'](_0x14a48e[_0xcce5('0x33')]);if(_0x14a48e[_0xcce5('0x34')]){delete _0x14a48e[_0xcce5('0x34')];}_0x99b718['status'](_0x206240)[_0xcce5('0x35')](_0x14a48e);};}exports[_0xcce5('0x36')]=function(_0x2f692a,_0x3043f0){var _0x508c33={},_0x2ad305={},_0xf07982={'count':0x0,'rows':[]};var _0x39f4cc=_[_0xcce5('0x37')](db['Network'][_0xcce5('0x38')],function(_0x19b50e){return{'name':_0x19b50e['fieldName'],'type':_0x19b50e[_0xcce5('0x39')][_0xcce5('0x3a')]};});_0x2ad305[_0xcce5('0x3b')]=_[_0xcce5('0x37')](_0x39f4cc,_0xcce5('0x34'));_0x2ad305['query']=_[_0xcce5('0x3c')](_0x2f692a['query']);_0x2ad305[_0xcce5('0x3d')]=_['intersection'](_0x2ad305[_0xcce5('0x3b')],_0x2ad305[_0xcce5('0x3e')]);_0x508c33[_0xcce5('0x3f')]=_[_0xcce5('0x40')](_0x2ad305[_0xcce5('0x3b')],qs['fields'](_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x41')]));_0x508c33['attributes']=_0x508c33[_0xcce5('0x3f')][_0xcce5('0x42')]?_0x508c33[_0xcce5('0x3f')]:_0x2ad305[_0xcce5('0x3b')];if(!_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x43')](_0xcce5('0x44'))){_0x508c33['limit']=qs['limit'](_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x2d')]);_0x508c33['offset']=qs[_0xcce5('0x2b')](_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x2b')]);}_0x508c33[_0xcce5('0x45')]=qs[_0xcce5('0x46')](_0x2f692a[_0xcce5('0x3e')]['sort']);_0x508c33['where']=qs[_0xcce5('0x3d')](_[_0xcce5('0x47')](_0x2f692a['query'],_0x2ad305['filters']),_0x39f4cc);if(_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x48')]){_0x508c33['where']=_[_0xcce5('0x49')](_0x508c33[_0xcce5('0x4a')],{'$or':_['map'](_0x39f4cc,function(_0x3a4a6f){if(_0x3a4a6f['type']!==_0xcce5('0x4b')){var _0x109c7a={};_0x109c7a[_0x3a4a6f[_0xcce5('0x34')]]={'$like':'%'+_0x2f692a[_0xcce5('0x3e')][_0xcce5('0x48')]+'%'};return _0x109c7a;}})});}_0x508c33=_['merge']({},_0x508c33,_0x2f692a[_0xcce5('0x4c')]);var _0x10f9f4={'where':_0x508c33[_0xcce5('0x4a')]};return db[_0xcce5('0x4d')][_0xcce5('0x2e')](_0x10f9f4)[_0xcce5('0x1b')](function(_0x34a2a9){_0xf07982[_0xcce5('0x2e')]=_0x34a2a9;if(_0x2f692a['query'][_0xcce5('0x4e')]){_0x508c33[_0xcce5('0x4f')]=[{'all':!![]}];}return db[_0xcce5('0x4d')][_0xcce5('0x50')](_0x508c33);})[_0xcce5('0x1b')](function(_0x12fc13){_0xf07982['rows']=_0x12fc13;return _0xf07982;})[_0xcce5('0x1b')](respondWithFilteredResult(_0x3043f0,_0x508c33))[_0xcce5('0x26')](handleError(_0x3043f0,null));};exports[_0xcce5('0x51')]=function(_0x61bb16,_0x3db801){var _0xd0c94b={'raw':!![],'where':{'id':_0x61bb16['params']['id']}},_0x3aad26={};_0x3aad26[_0xcce5('0x3b')]=_[_0xcce5('0x3c')](db[_0xcce5('0x4d')]['rawAttributes']);_0x3aad26[_0xcce5('0x3e')]=_[_0xcce5('0x3c')](_0x61bb16[_0xcce5('0x3e')]);_0x3aad26[_0xcce5('0x3d')]=_[_0xcce5('0x40')](_0x3aad26['model'],_0x3aad26[_0xcce5('0x3e')]);_0xd0c94b[_0xcce5('0x3f')]=_[_0xcce5('0x40')](_0x3aad26['model'],qs[_0xcce5('0x41')](_0x61bb16[_0xcce5('0x3e')][_0xcce5('0x41')]));_0xd0c94b['attributes']=_0xd0c94b[_0xcce5('0x3f')][_0xcce5('0x42')]?_0xd0c94b['attributes']:_0x3aad26[_0xcce5('0x3b')];if(_0x61bb16[_0xcce5('0x3e')][_0xcce5('0x4e')]){_0xd0c94b[_0xcce5('0x4f')]=[{'all':!![]}];}_0xd0c94b=_[_0xcce5('0x49')]({},_0xd0c94b,_0x61bb16[_0xcce5('0x4c')]);return db[_0xcce5('0x4d')][_0xcce5('0x52')](_0xd0c94b)[_0xcce5('0x1b')](handleEntityNotFound(_0x3db801,null))[_0xcce5('0x1b')](respondWithResult(_0x3db801,null))[_0xcce5('0x26')](handleError(_0x3db801,null));};exports['create']=function(_0x35165b,_0x3f67a2,_0x151aeb){var _0x270da3;return db['sequelize'][_0xcce5('0x53')](function(_0x279503){return db['Network'][_0xcce5('0x54')](_0x35165b['body'],{'raw':!![]})['then'](function(_0x443e74){_0x270da3=_0x443e74;return db[_0xcce5('0x4d')]['findAll']({'where':{'type':_0x35165b[_0xcce5('0x55')][_0xcce5('0x39')]},'raw':!![]});})[_0xcce5('0x1b')](function(_0x23defe){if(_0x270da3[_0xcce5('0x39')][_0xcce5('0x56')]()=='STUN'){var _0x5e550a=fs[_0xcce5('0x57')](path[_0xcce5('0x58')](config['root'],_0xcce5('0x59')),_0xcce5('0x5a'));var _0x4d76d6=ejs[_0xcce5('0x5b')](_0x5e550a,{'networks':_0x23defe||[]});fs[_0xcce5('0x5c')](_0xcce5('0x5d'),_0x4d76d6);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x54'),{'module':_0xcce5('0x5f')});}else if(_0x270da3[_0xcce5('0x39')][_0xcce5('0x56')]()==_0xcce5('0x60')){var _0x2925f7=fs[_0xcce5('0x57')](path['join'](config[_0xcce5('0x61')],_0xcce5('0x62')),_0xcce5('0x5a'));var _0x131ddd=ejs[_0xcce5('0x5b')](_0x2925f7,{'networks':_0x23defe||[]});fs[_0xcce5('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x131ddd);return respondWithRpcPromise('Reload','create',{'module':_0xcce5('0x5f')});}else{var _0x1d3023=fs[_0xcce5('0x57')](path[_0xcce5('0x58')](config['root'],_0xcce5('0x63')),_0xcce5('0x5a'));var _0x126fdd=ejs[_0xcce5('0x5b')](_0x1d3023,{'networks':_0x23defe||[]});fs[_0xcce5('0x5c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x35165b[_0xcce5('0x55')][_0xcce5('0x39')][_0xcce5('0x64')]()),_0x126fdd);return respondWithRpcPromise('Reload','create',{'module':_0xcce5('0x65')});}return null;})[_0xcce5('0x1b')](function(){return _0x270da3;});})['then'](respondWithResult(_0x3f67a2,0xc9))[_0xcce5('0x26')](handleError(_0x3f67a2,null));};exports[_0xcce5('0x66')]=function(_0x1cb7fa,_0x916638,_0xfa5f2){var _0x3d40f6;return db[_0xcce5('0x67')][_0xcce5('0x53')](function(_0x40b4b0){return db[_0xcce5('0x4d')][_0xcce5('0x52')]({'where':{'id':_0x1cb7fa[_0xcce5('0x68')]['id']}})['then'](handleEntityNotFound(_0x916638,null))['then'](saveUpdates(_0x1cb7fa[_0xcce5('0x55')],null))['then'](function(_0x4d774a){if(_0x4d774a){_0x3d40f6=_0x4d774a;return db[_0xcce5('0x4d')][_0xcce5('0x50')]({'where':{'type':_0x3d40f6[_0xcce5('0x39')]},'raw':!![]});}return null;})['then'](function(_0x16c47a){if(_0x3d40f6[_0xcce5('0x39')]['toUpperCase']()==_0xcce5('0x69')){var _0x47f700=fs['readFileSync'](path[_0xcce5('0x58')](config[_0xcce5('0x61')],_0xcce5('0x59')),_0xcce5('0x5a'));var _0x5923fc=ejs[_0xcce5('0x5b')](_0x47f700,{'networks':_0x16c47a||[]});fs[_0xcce5('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x5923fc);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x66'),{'module':_0xcce5('0x5f')});}else if(_0x3d40f6[_0xcce5('0x39')][_0xcce5('0x56')]()=='TURN'){var _0x3cafc8=fs['readFileSync'](path['join'](config[_0xcce5('0x61')],'server/files/templates/turn_multiple.ejs'),_0xcce5('0x5a'));var _0x531d09=ejs[_0xcce5('0x5b')](_0x3cafc8,{'networks':_0x16c47a||[]});fs[_0xcce5('0x5c')](_0xcce5('0x6a'),_0x531d09);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x66'),{'module':'res_stun_monitor.so'});}else{var _0x50f129=fs['readFileSync'](path[_0xcce5('0x58')](config[_0xcce5('0x61')],_0xcce5('0x63')),'utf8');var _0x5c546f=ejs['render'](_0x50f129,{'networks':_0x16c47a||[]});fs[_0xcce5('0x5c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1cb7fa[_0xcce5('0x55')]['type'][_0xcce5('0x64')]()),_0x5c546f);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x66'),{'module':_0xcce5('0x65')});}return null;})[_0xcce5('0x1b')](function(_0x909d2e){if(_0x909d2e){return _0x3d40f6;}return null;});})[_0xcce5('0x1b')](respondWithResult(_0x916638,null))[_0xcce5('0x26')](handleError(_0x916638,null));};exports[_0xcce5('0x6b')]=function(_0xd7e08d,_0x1d6c23,_0x38965b){var _0x3605f8;return db[_0xcce5('0x4d')][_0xcce5('0x52')]({'where':{'id':_0xd7e08d[_0xcce5('0x68')]['id']}})[_0xcce5('0x1b')](function(_0x5d72c9){_0x3605f8=_0x5d72c9;return _0x5d72c9;})[_0xcce5('0x1b')](handleEntityNotFound(_0x1d6c23,null))['then'](removeEntity(_0x1d6c23,null))['then'](function(){if(_0x3605f8){return db[_0xcce5('0x4d')][_0xcce5('0x50')]({'where':{'type':_0x3605f8[_0xcce5('0x39')]},'raw':!![]});}})[_0xcce5('0x1b')](function(_0x4386c6){if(_0x3605f8[_0xcce5('0x39')]['toUpperCase']()==_0xcce5('0x69')){var _0x15d87e=fs['readFileSync'](path[_0xcce5('0x58')](config['root'],_0xcce5('0x59')),_0xcce5('0x5a'));var _0x1e7f40=ejs[_0xcce5('0x5b')](_0x15d87e,{'networks':_0x4386c6||[]});fs[_0xcce5('0x5c')](_0xcce5('0x5d'),_0x1e7f40);return respondWithRpcPromise('Reload',_0xcce5('0x6b'),{'module':_0xcce5('0x5f')});}else if(_0x3605f8[_0xcce5('0x39')]['toUpperCase']()==_0xcce5('0x60')){var _0x3f0fa5=fs['readFileSync'](path[_0xcce5('0x58')](config[_0xcce5('0x61')],_0xcce5('0x62')),_0xcce5('0x5a'));var _0x4db34b=ejs[_0xcce5('0x5b')](_0x3f0fa5,{'networks':_0x4386c6||[]});fs[_0xcce5('0x5c')](_0xcce5('0x6a'),_0x4db34b);return respondWithRpcPromise(_0xcce5('0x5e'),'destroy',{'module':_0xcce5('0x5f')});}else{var _0x5089c8=fs[_0xcce5('0x57')](path['join'](config['root'],_0xcce5('0x63')),_0xcce5('0x5a'));var _0x4ada7a=ejs[_0xcce5('0x5b')](_0x5089c8,{'networks':_0x4386c6||[]});fs[_0xcce5('0x5c')](util[_0xcce5('0x6c')]('/etc/asterisk/sip_xcally_%s.conf',_0xd7e08d[_0xcce5('0x55')][_0xcce5('0x39')][_0xcce5('0x64')]()),_0x4ada7a);return respondWithRpcPromise(_0xcce5('0x5e'),_0xcce5('0x6b'),{'module':_0xcce5('0x65')});}return null;})[_0xcce5('0x26')](handleError(_0x1d6c23,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 899394e..77675ef 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 _0xf4eb=['./network.attributes','exports','define','network','lodash','bluebird','rimraf','../../config/environment'];(function(_0x1118da,_0x2fde4c){var _0x7374da=function(_0x46f897){while(--_0x46f897){_0x1118da['push'](_0x1118da['shift']());}};_0x7374da(++_0x2fde4c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x152548,_0x5a3524){_0x152548=_0x152548-0x0;var _0x51dfc8=_0xf4eb[_0x152548];return _0x51dfc8;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('Network',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','network','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a0fb5,_0x52fdb9){var _0x412869=function(_0x52b155){while(--_0x52b155){_0x4a0fb5['push'](_0x4a0fb5['shift']());}};_0x412869(++_0x52fdb9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./network.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('Network',attributes,{'tableName':_0x0d8b('0x8'),'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 b822cce..ba288b2 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x50e473,_0x3041f9){var _0x366913=function(_0x39ddd5){while(--_0x39ddd5){_0x50e473['push'](_0x50e473['shift']());}};_0x366913(++_0x3041f9);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x25c019,_0x1e4058){_0x25c019=_0x25c019-0x0;var _0x56681e=_0x7a54[_0x25c019];return _0x56681e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 4a71c96..d25bce6 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 _0x4436=['connect-timeout','express','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','post','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path'];(function(_0x42dc72,_0xc29abc){var _0x114720=function(_0x7c257d){while(--_0x7c257d){_0x42dc72['push'](_0x42dc72['shift']());}};_0x114720(++_0xc29abc);}(_0x4436,0x91));var _0x6443=function(_0x459503,_0x5cc336){_0x459503=_0x459503-0x0;var _0x423649=_0x4436[_0x459503];return _0x423649;};'use strict';var multer=require(_0x6443('0x0'));var util=require(_0x6443('0x1'));var path=require(_0x6443('0x2'));var timeout=require(_0x6443('0x3'));var express=require(_0x6443('0x4'));var router=express['Router']();var fs_extra=require(_0x6443('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6443('0x6'));var controller=require(_0x6443('0x7'));router[_0x6443('0x8')]('/',auth[_0x6443('0x9')](),controller['index']);router['get'](_0x6443('0xa'),auth[_0x6443('0x9')](),controller[_0x6443('0xb')]);router[_0x6443('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6443('0xc')]);router[_0x6443('0x8')](_0x6443('0xd'),auth['isAuthenticated'](),controller[_0x6443('0xe')]);router[_0x6443('0x8')](_0x6443('0xf'),auth[_0x6443('0x9')](),controller[_0x6443('0x10')]);router['get'](_0x6443('0x11'),auth['isAuthenticated'](),controller[_0x6443('0x12')]);router[_0x6443('0x8')]('/:id/interactions',auth[_0x6443('0x9')](),controller[_0x6443('0x13')]);router[_0x6443('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x6443('0x14')]('/',auth[_0x6443('0x9')](),controller['create']);router[_0x6443('0x14')](_0x6443('0xd'),auth[_0x6443('0x9')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x6443('0x9')](),controller[_0x6443('0x15')]);router['post'](_0x6443('0x16'),controller[_0x6443('0x17')]);router[_0x6443('0x14')](_0x6443('0x11'),auth[_0x6443('0x9')](),controller[_0x6443('0x18')]);router[_0x6443('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x6443('0x19')]);router[_0x6443('0x14')](_0x6443('0x1a'),auth['isAuthenticated'](),controller[_0x6443('0x1b')]);router[_0x6443('0x1c')](_0x6443('0x1d'),auth[_0x6443('0x9')](),controller[_0x6443('0x1e')]);router['delete'](_0x6443('0x1d'),auth[_0x6443('0x9')](),controller['destroy']);router[_0x6443('0x1f')](_0x6443('0xd'),auth['isAuthenticated'](),controller[_0x6443('0x20')]);router[_0x6443('0x1f')](_0x6443('0xf'),auth[_0x6443('0x9')](),controller[_0x6443('0x21')]);router[_0x6443('0x1f')](_0x6443('0x22'),auth['isAuthenticated'](),controller[_0x6443('0x23')]);module[_0x6443('0x24')]=router; \ No newline at end of file +var _0xaeeb=['/:id/send','put','delete','destroy','removeDispositions','removeAnswers','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','/:id/applications','addApplications','addAgents'];(function(_0x62fdb8,_0xbfab9e){var _0x32f44e=function(_0x204bb8){while(--_0x204bb8){_0x62fdb8['push'](_0x62fdb8['shift']());}};_0x32f44e(++_0xbfab9e);}(_0xaeeb,0x14a));var _0xbaee=function(_0x2e725f,_0x4e8f74){_0x2e725f=_0x2e725f-0x0;var _0x3349db=_0xaeeb[_0x2e725f];return _0x3349db;};'use strict';var multer=require(_0xbaee('0x0'));var util=require(_0xbaee('0x1'));var path=require('path');var timeout=require(_0xbaee('0x2'));var express=require(_0xbaee('0x3'));var router=express[_0xbaee('0x4')]();var fs_extra=require(_0xbaee('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbaee('0x6'));var config=require(_0xbaee('0x7'));var controller=require(_0xbaee('0x8'));router[_0xbaee('0x9')]('/',auth['isAuthenticated'](),controller[_0xbaee('0xa')]);router['get'](_0xbaee('0xb'),auth[_0xbaee('0xc')](),controller[_0xbaee('0xd')]);router['get'](_0xbaee('0xe'),auth[_0xbaee('0xc')](),controller[_0xbaee('0xf')]);router['get'](_0xbaee('0x10'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x11')]);router[_0xbaee('0x9')](_0xbaee('0x12'),auth['isAuthenticated'](),controller[_0xbaee('0x13')]);router[_0xbaee('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xbaee('0x9')]('/:id/interactions',auth[_0xbaee('0xc')](),controller[_0xbaee('0x14')]);router[_0xbaee('0x9')](_0xbaee('0x15'),auth['isAuthenticated'](),controller[_0xbaee('0x16')]);router[_0xbaee('0x17')]('/',auth[_0xbaee('0xc')](),controller[_0xbaee('0x18')]);router[_0xbaee('0x17')](_0xbaee('0x10'),auth[_0xbaee('0xc')](),controller['addDisposition']);router[_0xbaee('0x17')](_0xbaee('0x12'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x19')]);router[_0xbaee('0x17')](_0xbaee('0x1a'),controller['notify']);router[_0xbaee('0x17')](_0xbaee('0x1b'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x1c')]);router[_0xbaee('0x17')](_0xbaee('0x15'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x1d')]);router['post'](_0xbaee('0x1e'),auth[_0xbaee('0xc')](),controller['send']);router[_0xbaee('0x1f')](_0xbaee('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xbaee('0x20')](_0xbaee('0xe'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x21')]);router['delete'](_0xbaee('0x10'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x22')]);router[_0xbaee('0x20')](_0xbaee('0x12'),auth[_0xbaee('0xc')](),controller[_0xbaee('0x23')]);router[_0xbaee('0x20')]('/:id/users',auth[_0xbaee('0xc')](),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 4e1c484..11938e4 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 _0x2f38=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x2f38,0x72));var _0x82f3=function(_0x262eb7,_0x48f88b){_0x262eb7=_0x262eb7-0x0;var _0x2feecc=_0x2f38[_0x262eb7];return _0x2feecc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x82f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x82f3('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x82f3('0x1')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x82f3('0x2')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x82f3('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x82f3('0x3')],'defaultValue':function(){return _0x82f3('0x4');}},'notificationSound':{'type':Sequelize[_0x82f3('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x82f3('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x82f3('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x82f3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x82f3('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x82f3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x82f3('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x82f3('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x82f3('0x5')],'defaultValue':![],'comment':_0x82f3('0x8'),'set':function(_0x4e7bef){if(!_0x4e7bef)this[_0x82f3('0x9')](_0x82f3('0xa'),null);this[_0x82f3('0x9')](_0x82f3('0xb'),_0x4e7bef);}}}; \ No newline at end of file +var _0xf5db=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x4e7dd7,_0x3e7134){var _0x4f4461=function(_0x17aabb){while(--_0x17aabb){_0x4e7dd7['push'](_0x4e7dd7['shift']());}};_0x4f4461(++_0x3e7134);}(_0xf5db,0x1a7));var _0xbf5d=function(_0x3bda15,_0x2a1cae){_0x3bda15=_0x3bda15-0x0;var _0x129f06=_0xf5db[_0x3bda15];return _0x129f06;};'use strict';var Sequelize=require(_0xbf5d('0x0'));var rs=require(_0xbf5d('0x1'));module['exports']={'name':{'type':Sequelize[_0xbf5d('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xbf5d('0x2')],'defaultValue':function(){return rs[_0xbf5d('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xbf5d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbf5d('0x4');}},'notificationSound':{'type':Sequelize[_0xbf5d('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf5d('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbf5d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbf5d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf5d('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbf5d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf5d('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbf5d('0x5')],'defaultValue':![],'comment':_0xbf5d('0x7'),'set':function(_0x150f7f){if(!_0x150f7f)this[_0xbf5d('0x8')](_0xbf5d('0x9'),null);this[_0xbf5d('0x8')]('mandatoryDisposition',_0x150f7f);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 0836cdf..5ea93ca 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 _0x7cf5=['path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','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','limit','undefined','count','offset','set','Content-Range','apply','reject','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','mandatoryDispositionPause','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','account','applications','Applications','list','priority','asc','Contacts','ListId','CmContact','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','EventManager','notify','addApplications','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','zip-dir','moment','bluebird','mustache','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7cf5,0xb9));var _0x57cf=function(_0x5b1064,_0x2d9842){_0x5b1064=_0x5b1064-0x0;var _0x470de8=_0x7cf5[_0x5b1064];return _0x470de8;};'use strict';var emlformat=require(_0x57cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x57cf('0x2'));var BPromise=require(_0x57cf('0x3'));var Mustache=require(_0x57cf('0x4'));var util=require(_0x57cf('0x5'));var path=require(_0x57cf('0x6'));var sox=require(_0x57cf('0x7'));var csv=require(_0x57cf('0x8'));var ejs=require(_0x57cf('0x9'));var fs=require('fs');var fs_extra=require(_0x57cf('0xa'));var _=require('lodash');var squel=require(_0x57cf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x57cf('0xc'));var toCsv=require('to-csv');var querystring=require(_0x57cf('0xd'));var Papa=require('papaparse');var Redis=require(_0x57cf('0xe'));var authService=require(_0x57cf('0xf'));var qs=require(_0x57cf('0x10'));var as=require(_0x57cf('0x11'));var hardwareService=require(_0x57cf('0x12'));var logger=require(_0x57cf('0x13'))('api');var utils=require(_0x57cf('0x14'));var config=require(_0x57cf('0x15'));var licenseUtil=require(_0x57cf('0x16'));var db=require(_0x57cf('0x17'))['db'];config[_0x57cf('0x18')]=_[_0x57cf('0x19')](config['redis'],{'host':_0x57cf('0x1a'),'port':0x18eb});var socket=require(_0x57cf('0x1b'))(new Redis(config[_0x57cf('0x18')]));require(_0x57cf('0x1c'))[_0x57cf('0x1d')](socket);var jayson=require(_0x57cf('0x1e'));var client=jayson[_0x57cf('0x1f')][_0x57cf('0x20')]({'port':0x232c});var client9002=jayson[_0x57cf('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16ebcb,_0x5aaf44,_0x28aa3a,_0x33bea6){return new BPromise(function(_0x3b30d8,_0x2fb526){var _0x352197=_0x33bea6||client;return _0x352197[_0x57cf('0x21')](_0x16ebcb,_0x28aa3a)[_0x57cf('0x22')](function(_0x5b0c51){logger['info'](_0x57cf('0x23'),_0x5aaf44,_0x57cf('0x24'));logger[_0x57cf('0x25')](_0x57cf('0x26'),_0x5aaf44,_0x57cf('0x24'),JSON[_0x57cf('0x27')](_0x5b0c51));if(_0x5b0c51[_0x57cf('0x28')]){if(_0x5b0c51[_0x57cf('0x28')][_0x57cf('0x29')]===0x1f4){logger[_0x57cf('0x28')](_0x57cf('0x23'),_0x5aaf44,_0x5b0c51[_0x57cf('0x28')][_0x57cf('0x2a')]);return _0x2fb526(_0x5b0c51[_0x57cf('0x28')][_0x57cf('0x2a')]);}logger[_0x57cf('0x28')](_0x57cf('0x23'),_0x5aaf44,_0x5b0c51[_0x57cf('0x28')][_0x57cf('0x2a')]);return _0x3b30d8(_0x5b0c51['error'][_0x57cf('0x2a')]);}else{logger[_0x57cf('0x2b')](_0x57cf('0x23'),_0x5aaf44,_0x57cf('0x24'));_0x3b30d8(_0x5b0c51[_0x57cf('0x2c')][_0x57cf('0x2a')]);}})['catch'](function(_0x77cc16){logger['error'](_0x57cf('0x23'),_0x5aaf44,_0x77cc16);_0x2fb526(_0x77cc16);});});}function respondWithStatusCode(_0x280b87,_0x30f9db){_0x30f9db=_0x30f9db||0xcc;return function(_0xac7afd){if(_0xac7afd){return _0x280b87[_0x57cf('0x2d')](_0x30f9db);}return _0x280b87[_0x57cf('0x2e')](_0x30f9db)[_0x57cf('0x2f')]();};}function respondWithResult(_0x59ba35,_0x88e353){_0x88e353=_0x88e353||0xc8;return function(_0x429eba){if(_0x429eba){return _0x59ba35['status'](_0x88e353)[_0x57cf('0x30')](_0x429eba);}};}function respondWithFilteredResult(_0x450b07,_0x4d40b2){return function(_0x31831b){if(_0x31831b){var _0xb6d4d3=typeof _0x4d40b2['offset']==='undefined'&&typeof _0x4d40b2[_0x57cf('0x31')]===_0x57cf('0x32');var _0x3020ec=_0x31831b[_0x57cf('0x33')];var _0x53af87=_0xb6d4d3?0x0:_0x4d40b2[_0x57cf('0x34')];var _0x474185=_0xb6d4d3?_0x31831b[_0x57cf('0x33')]:_0x4d40b2[_0x57cf('0x34')]+_0x4d40b2[_0x57cf('0x31')];var _0x141a66;if(_0x474185>=_0x3020ec){_0x474185=_0x3020ec;_0x141a66=0xc8;}else{_0x141a66=0xce;}_0x450b07['status'](_0x141a66);return _0x450b07[_0x57cf('0x35')](_0x57cf('0x36'),_0x53af87+'-'+_0x474185+'/'+_0x3020ec)[_0x57cf('0x30')](_0x31831b);}return null;};}function patchUpdates(_0xbbead1){return function(_0x118aa2){try{jsonpatch[_0x57cf('0x37')](_0x118aa2,_0xbbead1,!![]);}catch(_0x14c8eb){return BPromise[_0x57cf('0x38')](_0x14c8eb);}return _0x118aa2['save']();};}function saveUpdates(_0x513f00,_0x25a967){return function(_0x5d2c59){if(_0x5d2c59){return _0x5d2c59['update'](_0x513f00)[_0x57cf('0x22')](function(_0x4ffe74){return _0x4ffe74;});}return null;};}function removeEntity(_0xe6ba97,_0x16bbc6){return function(_0x585f66){if(_0x585f66){return _0x585f66[_0x57cf('0x39')]()[_0x57cf('0x22')](function(){var _0x4af91b=_0x585f66[_0x57cf('0x3a')]({'plain':!![]});var _0x19a265=_0x57cf('0x3b');return db[_0x57cf('0x3c')][_0x57cf('0x39')]({'where':{'type':_0x19a265,'resourceId':_0x4af91b['id']}})[_0x57cf('0x22')](function(){return _0x585f66;});})[_0x57cf('0x22')](function(){_0xe6ba97[_0x57cf('0x2e')](0xcc)[_0x57cf('0x2f')]();});}};}function handleEntityNotFound(_0x4e35aa,_0x1f8adf){return function(_0x391f6e){if(!_0x391f6e){_0x4e35aa[_0x57cf('0x2d')](0x194);}return _0x391f6e;};}function handleError(_0x5f0104,_0xba7bd5){_0xba7bd5=_0xba7bd5||0x1f4;return function(_0x17f549){logger[_0x57cf('0x28')](_0x17f549[_0x57cf('0x3d')]);if(_0x17f549['name']){delete _0x17f549[_0x57cf('0x3e')];}_0x5f0104[_0x57cf('0x2e')](_0xba7bd5)[_0x57cf('0x3f')](_0x17f549);};}exports[_0x57cf('0x40')]=function(_0x5ed606,_0x1e0779){var _0x34ff03={'include':[{'model':db[_0x57cf('0x41')],'as':'mandatoryDispositionPause'}]},_0x3faf3e={},_0x19dbfb={'count':0x0,'rows':[]};var _0x4acad9=_[_0x57cf('0x42')](db[_0x57cf('0x43')][_0x57cf('0x44')],function(_0x53745e){return{'name':_0x53745e[_0x57cf('0x45')],'type':_0x53745e['type']['key']};});_0x3faf3e[_0x57cf('0x46')]=_[_0x57cf('0x42')](_0x4acad9,_0x57cf('0x3e'));_0x3faf3e['query']=_[_0x57cf('0x47')](_0x5ed606[_0x57cf('0x48')]);_0x3faf3e[_0x57cf('0x49')]=_[_0x57cf('0x4a')](_0x3faf3e[_0x57cf('0x46')],_0x3faf3e[_0x57cf('0x48')]);_0x34ff03[_0x57cf('0x4b')]=_[_0x57cf('0x4a')](_0x3faf3e[_0x57cf('0x46')],qs[_0x57cf('0x4c')](_0x5ed606['query'][_0x57cf('0x4c')]));_0x34ff03['attributes']=_0x34ff03[_0x57cf('0x4b')][_0x57cf('0x4d')]?_0x34ff03[_0x57cf('0x4b')]:_0x3faf3e['model'];if(!_0x5ed606['query'][_0x57cf('0x4e')]('nolimit')){_0x34ff03[_0x57cf('0x31')]=qs[_0x57cf('0x31')](_0x5ed606[_0x57cf('0x48')][_0x57cf('0x31')]);_0x34ff03[_0x57cf('0x34')]=qs[_0x57cf('0x34')](_0x5ed606['query'][_0x57cf('0x34')]);}_0x34ff03[_0x57cf('0x4f')]=qs[_0x57cf('0x50')](_0x5ed606['query']['sort']);_0x34ff03[_0x57cf('0x51')]=qs[_0x57cf('0x49')](_[_0x57cf('0x52')](_0x5ed606['query'],_0x3faf3e['filters']),_0x4acad9);if(_0x5ed606[_0x57cf('0x48')][_0x57cf('0x53')]){_0x34ff03[_0x57cf('0x51')]=_[_0x57cf('0x54')](_0x34ff03[_0x57cf('0x51')],{'$or':_[_0x57cf('0x42')](_0x4acad9,function(_0x453919){if(_0x453919[_0x57cf('0x55')]!=='VIRTUAL'){var _0xac6b41={};_0xac6b41[_0x453919[_0x57cf('0x3e')]]={'$like':'%'+_0x5ed606['query'][_0x57cf('0x53')]+'%'};return _0xac6b41;}})});}_0x34ff03=_[_0x57cf('0x54')]({},_0x34ff03,_0x5ed606[_0x57cf('0x56')]);var _0x5d1995={'where':_0x34ff03[_0x57cf('0x51')]};return db[_0x57cf('0x43')][_0x57cf('0x33')](_0x5d1995)[_0x57cf('0x22')](function(_0x3841cf){_0x19dbfb[_0x57cf('0x33')]=_0x3841cf;if(_0x5ed606[_0x57cf('0x48')]['includeAll']){_0x34ff03[_0x57cf('0x57')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x57cf('0x58')](_0x34ff03);})['then'](function(_0x43f5bf){_0x19dbfb[_0x57cf('0x59')]=_0x43f5bf;return _0x19dbfb;})[_0x57cf('0x22')](respondWithFilteredResult(_0x1e0779,_0x34ff03))[_0x57cf('0x5a')](handleError(_0x1e0779,null));};exports[_0x57cf('0x5b')]=function(_0x1fa493,_0x4b1563){var _0x3b7542={'raw':![],'where':{'id':_0x1fa493[_0x57cf('0x5c')]['id']},'include':[{'model':db[_0x57cf('0x41')],'as':_0x57cf('0x5d')}]},_0x862987={};_0x862987[_0x57cf('0x46')]=_[_0x57cf('0x47')](db[_0x57cf('0x43')][_0x57cf('0x44')]);_0x862987[_0x57cf('0x48')]=_['keys'](_0x1fa493[_0x57cf('0x48')]);_0x862987[_0x57cf('0x49')]=_['intersection'](_0x862987['model'],_0x862987[_0x57cf('0x48')]);_0x3b7542[_0x57cf('0x4b')]=_['intersection'](_0x862987[_0x57cf('0x46')],qs[_0x57cf('0x4c')](_0x1fa493[_0x57cf('0x48')][_0x57cf('0x4c')]));_0x3b7542['attributes']=_0x3b7542['attributes'][_0x57cf('0x4d')]?_0x3b7542[_0x57cf('0x4b')]:_0x862987[_0x57cf('0x46')];if(_0x1fa493['query'][_0x57cf('0x5e')]){_0x3b7542[_0x57cf('0x57')]=[{'all':!![]}];}_0x3b7542=_[_0x57cf('0x54')]({},_0x3b7542,_0x1fa493['options']);return db[_0x57cf('0x43')][_0x57cf('0x5f')](_0x3b7542)[_0x57cf('0x22')](handleEntityNotFound(_0x4b1563,null))[_0x57cf('0x22')](respondWithResult(_0x4b1563,null))['catch'](handleError(_0x4b1563,null));};exports[_0x57cf('0x60')]=function(_0xed93c7,_0x40e350){return db['OpenchannelAccount'][_0x57cf('0x60')](_0xed93c7['body'],{})[_0x57cf('0x22')](function(_0x58358b){var _0x5ca4b4=_0xed93c7['user'][_0x57cf('0x3a')]({'plain':!![]});if(!_0x5ca4b4)throw new Error(_0x57cf('0x61'));if(_0x5ca4b4[_0x57cf('0x62')]===_0x57cf('0x63')){var _0x138f95=_0x58358b[_0x57cf('0x3a')]({'plain':!![]});var _0x397e84=_0x57cf('0x3b');return db['UserProfileSection'][_0x57cf('0x5f')]({'where':{'name':_0x397e84,'userProfileId':_0x5ca4b4[_0x57cf('0x64')]},'raw':!![]})['then'](function(_0x427e0f){if(_0x427e0f&&_0x427e0f['autoAssociation']===0x0){return db[_0x57cf('0x3c')]['create']({'name':_0x138f95[_0x57cf('0x3e')],'resourceId':_0x138f95['id'],'type':_0x427e0f[_0x57cf('0x3e')],'sectionId':_0x427e0f['id']},{})['then'](function(){return _0x58358b;});}else{return _0x58358b;}})[_0x57cf('0x5a')](function(_0x57b688){logger[_0x57cf('0x28')](_0x57cf('0x65'),_0x57b688);throw _0x57b688;});}return _0x58358b;})[_0x57cf('0x22')](respondWithResult(_0x40e350,0xc9))[_0x57cf('0x5a')](handleError(_0x40e350,null));};exports['update']=function(_0x8fd7e8,_0x13b27e){if(_0x8fd7e8[_0x57cf('0x66')]['id']){delete _0x8fd7e8[_0x57cf('0x66')]['id'];}return db[_0x57cf('0x43')][_0x57cf('0x5f')]({'where':{'id':_0x8fd7e8[_0x57cf('0x5c')]['id']},'include':[{'model':db[_0x57cf('0x41')],'as':'mandatoryDispositionPause'}]})[_0x57cf('0x22')](handleEntityNotFound(_0x13b27e,null))[_0x57cf('0x22')](saveUpdates(_0x8fd7e8[_0x57cf('0x66')],null))[_0x57cf('0x22')](respondWithResult(_0x13b27e,null))[_0x57cf('0x5a')](handleError(_0x13b27e,null));};exports['destroy']=function(_0x4b621f,_0x147fcc){return db[_0x57cf('0x43')][_0x57cf('0x5f')]({'where':{'id':_0x4b621f[_0x57cf('0x5c')]['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x147fcc,null))['then'](removeEntity(_0x147fcc,null))['catch'](handleError(_0x147fcc,null));};exports['describe']=function(_0x599d67,_0x223d00){return db[_0x57cf('0x43')][_0x57cf('0x67')]()[_0x57cf('0x22')](respondWithResult(_0x223d00,null))[_0x57cf('0x5a')](handleError(_0x223d00,null));};exports['addDisposition']=function(_0xf55bc7,_0x936873,_0x269685){if(_0xf55bc7[_0x57cf('0x66')]['id']){delete _0xf55bc7[_0x57cf('0x66')]['id'];}return db['OpenchannelAccount'][_0x57cf('0x5f')]({'where':{'id':_0xf55bc7[_0x57cf('0x5c')]['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x936873,null))[_0x57cf('0x22')](function(_0x3febed){if(_0x3febed){_0xf55bc7['body'][_0x57cf('0x68')]=_0x3febed['id'];return db[_0x57cf('0x69')]['create'](_0xf55bc7[_0x57cf('0x66')]);}})[_0x57cf('0x22')](respondWithResult(_0x936873,null))[_0x57cf('0x5a')](handleError(_0x936873,null));};exports['getDispositions']=function(_0x11652b,_0x4f70b7,_0x1e89d0){var _0x36060d={'raw':![],'where':{}};var _0x505897={};var _0x1a3ee4={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x57cf('0x6a')]({'where':{'id':_0x11652b['params']['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x4f70b7,null))[_0x57cf('0x22')](function(_0x5ecc75){if(_0x5ecc75){_0x505897[_0x57cf('0x46')]=_[_0x57cf('0x47')](db['Disposition'][_0x57cf('0x44')]);_0x505897[_0x57cf('0x48')]=_['keys'](_0x11652b[_0x57cf('0x48')]);_0x505897[_0x57cf('0x49')]=_[_0x57cf('0x4a')](_0x505897[_0x57cf('0x46')],_0x505897[_0x57cf('0x48')]);_0x36060d['attributes']=_[_0x57cf('0x4a')](_0x505897[_0x57cf('0x46')],qs[_0x57cf('0x4c')](_0x11652b['query'][_0x57cf('0x4c')]));_0x36060d[_0x57cf('0x4b')]=_0x36060d[_0x57cf('0x4b')][_0x57cf('0x4d')]?_0x36060d[_0x57cf('0x4b')]:_0x505897[_0x57cf('0x46')];if(!_0x11652b['query'][_0x57cf('0x4e')](_0x57cf('0x6b'))){_0x36060d[_0x57cf('0x31')]=qs[_0x57cf('0x31')](_0x11652b[_0x57cf('0x48')][_0x57cf('0x31')]);_0x36060d[_0x57cf('0x34')]=qs[_0x57cf('0x34')](_0x11652b[_0x57cf('0x48')][_0x57cf('0x34')]);}_0x36060d[_0x57cf('0x4f')]=qs[_0x57cf('0x50')](_0x11652b[_0x57cf('0x48')]['sort']);_0x36060d[_0x57cf('0x51')]=qs[_0x57cf('0x49')](_['pick'](_0x11652b[_0x57cf('0x48')],_0x505897[_0x57cf('0x49')]));_0x36060d[_0x57cf('0x51')]['OpenchannelAccountId']=_0x5ecc75['id'];if(_0x11652b[_0x57cf('0x48')][_0x57cf('0x53')]){_0x36060d['where']=_[_0x57cf('0x54')](_0x36060d[_0x57cf('0x51')],{'$or':_[_0x57cf('0x42')](_0x36060d[_0x57cf('0x4b')],function(_0x5097ae){var _0x3ed0c5={};_0x3ed0c5[_0x5097ae]={'$like':'%'+_0x11652b[_0x57cf('0x48')]['filter']+'%'};return _0x3ed0c5;})});}_0x36060d=_[_0x57cf('0x54')]({},_0x36060d,_0x11652b['options']);return db[_0x57cf('0x69')]['count']({'where':_0x36060d[_0x57cf('0x51')]})['then'](function(_0x2cc5f7){_0x1a3ee4[_0x57cf('0x33')]=_0x2cc5f7;if(_0x11652b[_0x57cf('0x48')][_0x57cf('0x5e')]){_0x36060d[_0x57cf('0x57')]=[{'all':!![]}];}return db[_0x57cf('0x69')][_0x57cf('0x58')](_0x36060d);})['then'](function(_0x1a982f){_0x1a3ee4[_0x57cf('0x59')]=_0x1a982f;return _0x1a3ee4;});}})[_0x57cf('0x22')](respondWithFilteredResult(_0x4f70b7,_0x36060d))[_0x57cf('0x5a')](handleError(_0x4f70b7,null));};exports[_0x57cf('0x6c')]=function(_0x1b5860,_0xa3a63c,_0x25c19f){return db['OpenchannelAccount'][_0x57cf('0x5f')]({'where':{'id':_0x1b5860['params']['id']}})['then'](handleEntityNotFound(_0xa3a63c,null))[_0x57cf('0x22')](function(_0x21b1b5){if(_0x21b1b5){return _0x21b1b5['removeDispositions'](_0x1b5860[_0x57cf('0x48')][_0x57cf('0x6d')]);}})[_0x57cf('0x22')](respondWithStatusCode(_0xa3a63c,null))['catch'](handleError(_0xa3a63c,null));};exports[_0x57cf('0x6e')]=function(_0x1a18d7,_0x26d716,_0x25a782){if(_0x1a18d7[_0x57cf('0x66')]['id']){delete _0x1a18d7[_0x57cf('0x66')]['id'];}return db[_0x57cf('0x43')][_0x57cf('0x5f')]({'where':{'id':_0x1a18d7[_0x57cf('0x5c')]['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x26d716,null))[_0x57cf('0x22')](function(_0x5f0ce5){if(_0x5f0ce5){_0x1a18d7['body'][_0x57cf('0x68')]=_0x5f0ce5['id'];return db[_0x57cf('0x6f')]['create'](_0x1a18d7[_0x57cf('0x66')]);}})[_0x57cf('0x22')](respondWithResult(_0x26d716,null))['catch'](handleError(_0x26d716,null));};exports[_0x57cf('0x70')]=function(_0x16358a,_0x2abec6,_0x180e9e){var _0xf1b82a={'raw':![],'where':{}};var _0x13d49b={};var _0x154924={'count':0x0,'rows':[]};return db[_0x57cf('0x43')]['findOne']({'where':{'id':_0x16358a[_0x57cf('0x5c')]['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x2abec6,null))['then'](function(_0x1b8c54){if(_0x1b8c54){_0x13d49b[_0x57cf('0x46')]=_[_0x57cf('0x47')](db['CannedAnswer']['rawAttributes']);_0x13d49b[_0x57cf('0x48')]=_[_0x57cf('0x47')](_0x16358a[_0x57cf('0x48')]);_0x13d49b[_0x57cf('0x49')]=_['intersection'](_0x13d49b[_0x57cf('0x46')],_0x13d49b['query']);_0xf1b82a['attributes']=_[_0x57cf('0x4a')](_0x13d49b[_0x57cf('0x46')],qs[_0x57cf('0x4c')](_0x16358a[_0x57cf('0x48')][_0x57cf('0x4c')]));_0xf1b82a[_0x57cf('0x4b')]=_0xf1b82a[_0x57cf('0x4b')][_0x57cf('0x4d')]?_0xf1b82a[_0x57cf('0x4b')]:_0x13d49b[_0x57cf('0x46')];if(!_0x16358a['query'][_0x57cf('0x4e')]('nolimit')){_0xf1b82a['limit']=qs[_0x57cf('0x31')](_0x16358a['query'][_0x57cf('0x31')]);_0xf1b82a[_0x57cf('0x34')]=qs[_0x57cf('0x34')](_0x16358a['query'][_0x57cf('0x34')]);}_0xf1b82a[_0x57cf('0x4f')]=qs[_0x57cf('0x50')](_0x16358a[_0x57cf('0x48')]['sort']);_0xf1b82a['where']=qs[_0x57cf('0x49')](_['pick'](_0x16358a[_0x57cf('0x48')],_0x13d49b['filters']));_0xf1b82a[_0x57cf('0x51')][_0x57cf('0x68')]=_0x1b8c54['id'];if(_0x16358a[_0x57cf('0x48')][_0x57cf('0x53')]){_0xf1b82a[_0x57cf('0x51')]=_[_0x57cf('0x54')](_0xf1b82a[_0x57cf('0x51')],{'$or':_[_0x57cf('0x42')](_0xf1b82a[_0x57cf('0x4b')],function(_0x124f21){var _0x1fa16d={};_0x1fa16d[_0x124f21]={'$like':'%'+_0x16358a[_0x57cf('0x48')][_0x57cf('0x53')]+'%'};return _0x1fa16d;})});}_0xf1b82a=_[_0x57cf('0x54')]({},_0xf1b82a,_0x16358a[_0x57cf('0x56')]);return db[_0x57cf('0x6f')][_0x57cf('0x33')]({'where':_0xf1b82a[_0x57cf('0x51')]})[_0x57cf('0x22')](function(_0x485311){_0x154924[_0x57cf('0x33')]=_0x485311;if(_0x16358a[_0x57cf('0x48')][_0x57cf('0x5e')]){_0xf1b82a['include']=[{'all':!![]}];}return db[_0x57cf('0x6f')][_0x57cf('0x58')](_0xf1b82a);})[_0x57cf('0x22')](function(_0x2db899){_0x154924[_0x57cf('0x59')]=_0x2db899;return _0x154924;});}})[_0x57cf('0x22')](respondWithFilteredResult(_0x2abec6,_0xf1b82a))[_0x57cf('0x5a')](handleError(_0x2abec6,null));};exports[_0x57cf('0x71')]=function(_0x330380,_0x2238cd,_0x2de3fc){return db[_0x57cf('0x43')][_0x57cf('0x5f')]({'where':{'id':_0x330380[_0x57cf('0x5c')]['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x2238cd,null))[_0x57cf('0x22')](function(_0x361b5d){if(_0x361b5d){return _0x361b5d[_0x57cf('0x71')](_0x330380[_0x57cf('0x48')][_0x57cf('0x6d')]);}})[_0x57cf('0x22')](respondWithStatusCode(_0x2238cd,null))[_0x57cf('0x5a')](handleError(_0x2238cd,null));};exports['notify']=function(_0x3e9866,_0x8a3918,_0x4d2005){var _0x91ad08={'body':_0x3e9866['body'],'channel':_0x57cf('0x72')};var _0x50c363=[];var _0x14a1a4=[];var _0x1c9cee={};var _0x4b04d5=![];return db['CmContact'][_0x57cf('0x67')]()[_0x57cf('0x22')](function(_0xd26bd7){if(!_0xd26bd7){throw new db[(_0x57cf('0x73'))][(_0x57cf('0x74'))](_0x57cf('0x75'));}_0x50c363=_['difference'](_[_0x57cf('0x47')](_0xd26bd7),[_0x57cf('0x76'),_0x57cf('0x77')]);_0x14a1a4=_[_0x57cf('0x78')](_['keys'](_0xd26bd7),[_0x57cf('0x76'),'updatedAt',_0x57cf('0x79'),'ListId']);if(_0x3e9866[_0x57cf('0x66')]['id']){delete _0x3e9866['body']['id'];}if(_[_0x57cf('0x7a')](_0x3e9866[_0x57cf('0x66')][_0x57cf('0x7b')])){throw new db['Sequelize'][(_0x57cf('0x74'))](_0x57cf('0x7c'));}if(_[_0x57cf('0x7a')](_0x3e9866['body'][_0x57cf('0x66')])||_0x3e9866[_0x57cf('0x66')][_0x57cf('0x66')]===''){throw new db[(_0x57cf('0x73'))][(_0x57cf('0x74'))](_0x57cf('0x7d'));}if(_[_0x57cf('0x7a')](_0x3e9866['body'][_0x57cf('0x7e')])){throw new db[(_0x57cf('0x73'))][(_0x57cf('0x74'))](_0x57cf('0x7f')+_0x14a1a4);}if(!_[_0x57cf('0x80')](_0x14a1a4,_0x3e9866[_0x57cf('0x66')][_0x57cf('0x7e')])){throw new db[(_0x57cf('0x73'))][(_0x57cf('0x74'))](_0x57cf('0x81')+_0x14a1a4);}_0x1c9cee[_0x3e9866[_0x57cf('0x66')][_0x57cf('0x7e')]]=_0x3e9866[_0x57cf('0x66')][_0x57cf('0x7b')];})[_0x57cf('0x22')](function(){return db['OpenchannelAccount'][_0x57cf('0x5f')]({'where':{'id':_0x3e9866[_0x57cf('0x5c')]['id']},'include':[{'model':db[_0x57cf('0x82')],'as':_0x57cf('0x83'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1c9cee,'limit':0x1,'order':[[_0x57cf('0x77'),_0x57cf('0x84')]]}]},{'model':db[_0x57cf('0x85')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x8a3918,null))['then'](function(_0xdf7cb8){if(_0xdf7cb8&&_0xdf7cb8[_0x57cf('0x83')]){_0x91ad08[_0x57cf('0x86')]=_0xdf7cb8;_0x91ad08[_0x57cf('0x87')]=_0xdf7cb8[_0x57cf('0x88')];_0x91ad08[_0x57cf('0x89')]=_0xdf7cb8['List'];_0x91ad08['applications']=_['orderBy'](_0x91ad08[_0x57cf('0x87')],[_0x57cf('0x8a')],[_0x57cf('0x8b')]);if(_0x91ad08[_0x57cf('0x86')][_0x57cf('0x88')]){delete _0x91ad08[_0x57cf('0x86')][_0x57cf('0x88')];}if(_0x91ad08[_0x57cf('0x86')][_0x57cf('0x83')]&&_0x91ad08[_0x57cf('0x86')][_0x57cf('0x83')][_0x57cf('0x8c')][_0x57cf('0x4d')]){return _0x91ad08[_0x57cf('0x86')]['List'][_0x57cf('0x8c')][0x0];}var _0x45cfc6=_[_0x57cf('0x19')](_0x3e9866[_0x57cf('0x66')],{'firstName':_0x3e9866[_0x57cf('0x66')][_0x57cf('0x7b')],'ListId':_0xdf7cb8[_0x57cf('0x8d')]});_0x45cfc6[_0x3e9866[_0x57cf('0x66')]['mapKey']]=_0x3e9866['body']['from'];return db[_0x57cf('0x8e')][_0x57cf('0x60')](_0x45cfc6,{'fields':_0x50c363,'raw':!![]});}})[_0x57cf('0x22')](handleEntityNotFound(_0x8a3918,null))[_0x57cf('0x22')](function(_0x41c09d){_0x91ad08[_0x57cf('0x8f')]=_0x41c09d;if(_0x41c09d){var _0x57bec2={'ContactId':_0x41c09d['id'],'OpenchannelAccountId':_0x3e9866[_0x57cf('0x5c')]['id'],'from':(_0x41c09d['firstName']||'')+'\x20'+(_0x41c09d[_0x57cf('0x90')]||'')};var _0x3ed76d={'OpenchannelAccountId':_0x3e9866[_0x57cf('0x5c')]['id'],'closed':![]};if(_0x3e9866[_0x57cf('0x66')]['threadId']){_0x3ed76d[_0x57cf('0x91')]=_0x3e9866[_0x57cf('0x66')]['threadId'];return db[_0x57cf('0x92')][_0x57cf('0x5f')]({'where':_0x3ed76d})[_0x57cf('0x22')](function(_0x49aa39){if(_0x49aa39){return[_0x49aa39,![]];}_0x57bec2[_0x57cf('0x91')]=_0x3e9866['body'][_0x57cf('0x91')];_0x57bec2[_0x57cf('0x93')]=_0x3e9866[_0x57cf('0x66')][_0x57cf('0x93')];return db[_0x57cf('0x92')][_0x57cf('0x60')](_0x57bec2)[_0x57cf('0x22')](function(_0x24aa84){return[_0x24aa84,!![]];});});}else{_0x3ed76d[_0x57cf('0x91')]=null;}_0x3ed76d[_0x57cf('0x94')]=_0x41c09d['id'];return db[_0x57cf('0x92')][_0x57cf('0x5f')]({'where':_0x3ed76d})[_0x57cf('0x22')](function(_0x4ff50e){if(_0x4ff50e){return[_0x4ff50e,![]];}return db['OpenchannelInteraction']['create'](_0x57bec2)[_0x57cf('0x22')](function(_0x2e5347){return[_0x2e5347,!![]];});});}})[_0x57cf('0x95')](function(_0x33d1d4,_0x489ee2){if(_0x33d1d4){_0x4b04d5=_0x489ee2;if(!_0x489ee2){var _0x233731={'from':(_0x91ad08['contact'][_0x57cf('0x96')]||'')+'\x20'+(_0x91ad08[_0x57cf('0x8f')][_0x57cf('0x90')]||'')};if(_0x3e9866[_0x57cf('0x66')]['threadId']&&_0x3e9866[_0x57cf('0x66')][_0x57cf('0x97')]&&_0x3e9866['body']['threadId']!=_0x3e9866[_0x57cf('0x66')][_0x57cf('0x97')]){_0x233731['threadId']=_0x3e9866[_0x57cf('0x66')][_0x57cf('0x97')];}return _0x33d1d4['update'](_0x233731);}else{return _0x33d1d4;}}})[_0x57cf('0x22')](function(_0x3bc310){_0x91ad08[_0x57cf('0x98')]=_0x3bc310['get']({'plain':!![]});_0x91ad08[_0x57cf('0x98')][_0x57cf('0x99')]=_0x4b04d5;if(_0x91ad08[_0x57cf('0x98')][_0x57cf('0x99')]){if(_0x91ad08[_0x57cf('0x86')][_0x57cf('0x9a')]){_0x91ad08[_0x57cf('0x87')][_0x57cf('0x9b')]({'id':0x0,'priority':_0x91ad08[_0x57cf('0x87')][_0x57cf('0x4d')]+0x1,'app':_0x57cf('0x9c'),'appdata':_0x57cf('0x9d'),'interval':_0x57cf('0x9e')});}}return db[_0x57cf('0x9f')][_0x57cf('0x60')]({'body':_0x3e9866[_0x57cf('0x66')][_0x57cf('0x66')],'OpenchannelAccountId':_0x3e9866[_0x57cf('0x5c')]['id'],'OpenchannelInteractionId':_0x3bc310['id'],'direction':'in','ContactId':_0x91ad08['contact']['id'],'AttachmentId':_0x3e9866['body'][_0x57cf('0xa0')]});})['then'](function(_0x1fe99f){_0x91ad08[_0x57cf('0x2a')]=_0x1fe99f;if(_0x91ad08[_0x57cf('0x98')][_0x57cf('0xa1')]){return db[_0x57cf('0xa2')][_0x57cf('0x5f')]({'attributes':['id','name'],'where':{'id':_0x91ad08[_0x57cf('0x98')][_0x57cf('0xa1')]}})[_0x57cf('0x22')](function(_0x5d685e){if(_0x5d685e){_0x91ad08['applications'][_0x57cf('0xa3')]({'id':0x0,'priority':0x0,'app':_0x57cf('0xa4'),'appdata':_0x5d685e['name']+','+(_0x91ad08[_0x57cf('0x86')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x91ad08[_0x57cf('0xa5')]=![];}return respondWithRpcPromise('Start','startRouting',_0x91ad08);});}return respondWithRpcPromise('Start','startRouting',_0x91ad08);})[_0x57cf('0x22')](function(_0x3dffc5){respondWithRpcPromise('EventManager',_0x57cf('0xa6'),{'event':_0x57cf('0xa7'),'message':_0x3dffc5},client9002);return _0x3dffc5;})[_0x57cf('0x22')](respondWithResult(_0x8a3918,null))[_0x57cf('0x5a')](handleError(_0x8a3918,null));};exports[_0x57cf('0xa8')]=function(_0x41d30d,_0x48d444,_0x5c22a0){return db['OpenchannelAccount'][_0x57cf('0x6a')]({'where':{'id':_0x41d30d[_0x57cf('0x5c')]['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x48d444,null))['then'](function(_0xcc9179){if(_0xcc9179){return db['sequelize'][_0x57cf('0xa9')](function(_0x2e34b1){return db[_0x57cf('0x85')][_0x57cf('0x39')]({'where':{'OpenchannelAccountId':_0x41d30d['params']['id']},'transaction':_0x2e34b1})[_0x57cf('0x22')](function(_0x594c44){var _0x5ea2d7=_[_0x57cf('0x42')](_0x41d30d[_0x57cf('0x66')],function(_0x33a063){_0x33a063['OpenchannelAccountId']=_0x41d30d[_0x57cf('0x5c')]['id'];return _0x33a063;});return db['OpenchannelApplication'][_0x57cf('0xaa')](_0x5ea2d7,{'transaction':_0x2e34b1});});})[_0x57cf('0x22')](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x41d30d['params']['id']},'order':'priority'});});}})[_0x57cf('0x22')](respondWithResult(_0x48d444,null))[_0x57cf('0x5a')](handleError(_0x48d444,null));};exports[_0x57cf('0xab')]=function(_0x4a473d,_0x45e144,_0x21c28b){var _0x422c8d={};var _0x1d1ef2={};var _0xd652b8;var _0x56ad27;return db['OpenchannelAccount'][_0x57cf('0x6a')]({'where':{'id':_0x4a473d[_0x57cf('0x5c')]['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x45e144,null))[_0x57cf('0x22')](function(_0x474817){if(_0x474817){_0xd652b8=_0x474817;_0x1d1ef2[_0x57cf('0x46')]=_[_0x57cf('0x47')](db[_0x57cf('0x85')][_0x57cf('0x44')]);_0x1d1ef2[_0x57cf('0x48')]=_[_0x57cf('0x47')](_0x4a473d['query']);_0x1d1ef2[_0x57cf('0x49')]=_[_0x57cf('0x4a')](_0x1d1ef2[_0x57cf('0x46')],_0x1d1ef2[_0x57cf('0x48')]);_0x422c8d[_0x57cf('0x4b')]=_[_0x57cf('0x4a')](_0x1d1ef2[_0x57cf('0x46')],qs[_0x57cf('0x4c')](_0x4a473d[_0x57cf('0x48')]['fields']));_0x422c8d['attributes']=_0x422c8d['attributes'][_0x57cf('0x4d')]?_0x422c8d[_0x57cf('0x4b')]:_0x1d1ef2['model'];_0x422c8d[_0x57cf('0x4f')]=qs[_0x57cf('0x50')](_0x4a473d[_0x57cf('0x48')][_0x57cf('0x50')]);_0x422c8d[_0x57cf('0x51')]=qs[_0x57cf('0x49')](_[_0x57cf('0x52')](_0x4a473d['query'],_0x1d1ef2['filters']));if(_0x4a473d[_0x57cf('0x48')][_0x57cf('0x53')]){_0x422c8d[_0x57cf('0x51')]=_['merge'](_0x422c8d['where'],{'$or':_['map'](_0x422c8d[_0x57cf('0x4b')],function(_0x24154a){var _0x4ec802={};_0x4ec802[_0x24154a]={'$like':'%'+_0x4a473d[_0x57cf('0x48')]['filter']+'%'};return _0x4ec802;})});}_0x422c8d=_[_0x57cf('0x54')]({},_0x422c8d,_0x4a473d[_0x57cf('0x56')]);return _0xd652b8[_0x57cf('0xab')](_0x422c8d);}})[_0x57cf('0x22')](function(_0x4bf4b3){if(_0x4bf4b3){_0x56ad27=_0x4bf4b3[_0x57cf('0x4d')];if(!_0x4a473d['query'][_0x57cf('0x4e')]('nolimit')){_0x422c8d['limit']=qs['limit'](_0x4a473d['query'][_0x57cf('0x31')]);_0x422c8d[_0x57cf('0x34')]=qs[_0x57cf('0x34')](_0x4a473d[_0x57cf('0x48')]['offset']);}return _0xd652b8['getApplications'](_0x422c8d);}})[_0x57cf('0x22')](function(_0x413150){if(_0x413150){return _0x413150?{'count':_0x56ad27,'rows':_0x413150}:null;}})[_0x57cf('0x22')](respondWithResult(_0x45e144,null))[_0x57cf('0x5a')](handleError(_0x45e144,null));};exports[_0x57cf('0xac')]=function(_0x552038,_0x27f436,_0x152481){var _0x409d79={'raw':![],'where':{}};var _0x46813d={};var _0x527a02={'count':0x0,'rows':[]};return db[_0x57cf('0x43')][_0x57cf('0x6a')]({'where':{'id':_0x552038['params']['id']}})['then'](handleEntityNotFound(_0x27f436,null))[_0x57cf('0x22')](function(_0x3e50c6){if(_0x3e50c6){_0x46813d['model']=_[_0x57cf('0x47')](db[_0x57cf('0x92')][_0x57cf('0x44')]);_0x46813d[_0x57cf('0x48')]=_[_0x57cf('0x47')](_0x552038[_0x57cf('0x48')]);_0x46813d[_0x57cf('0x49')]=_[_0x57cf('0x4a')](_0x46813d[_0x57cf('0x46')],_0x46813d[_0x57cf('0x48')]);_0x409d79['attributes']=_[_0x57cf('0x4a')](_0x46813d['model'],qs['fields'](_0x552038[_0x57cf('0x48')][_0x57cf('0x4c')]));_0x409d79[_0x57cf('0x4b')]=_0x409d79[_0x57cf('0x4b')]['length']?_0x409d79[_0x57cf('0x4b')]:_0x46813d[_0x57cf('0x46')];if(!_0x552038[_0x57cf('0x48')][_0x57cf('0x4e')]('nolimit')){_0x409d79[_0x57cf('0x31')]=qs[_0x57cf('0x31')](_0x552038[_0x57cf('0x48')][_0x57cf('0x31')]);_0x409d79[_0x57cf('0x34')]=qs[_0x57cf('0x34')](_0x552038[_0x57cf('0x48')]['offset']);}_0x409d79[_0x57cf('0x4f')]=qs[_0x57cf('0x50')](_0x552038[_0x57cf('0x48')][_0x57cf('0x50')]);_0x409d79[_0x57cf('0x51')]=qs[_0x57cf('0x49')](_[_0x57cf('0x52')](_0x552038[_0x57cf('0x48')],_0x46813d['filters']));_0x409d79[_0x57cf('0x51')][_0x57cf('0x68')]=_0x3e50c6['id'];if(_0x552038[_0x57cf('0x48')][_0x57cf('0x53')]){_0x409d79[_0x57cf('0x51')]=_[_0x57cf('0x54')](_0x409d79['where'],{'$or':_['map'](_0x409d79[_0x57cf('0x4b')],function(_0x161a50){var _0x778bdf={};_0x778bdf[_0x161a50]={'$like':'%'+_0x552038['query'][_0x57cf('0x53')]+'%'};return _0x778bdf;})});}_0x409d79=_[_0x57cf('0x54')]({},_0x409d79,_0x552038['options']);return db['OpenchannelInteraction'][_0x57cf('0x33')]({'where':_0x409d79['where']})[_0x57cf('0x22')](function(_0x3e4abc){_0x527a02[_0x57cf('0x33')]=_0x3e4abc;if(_0x552038[_0x57cf('0x48')][_0x57cf('0x5e')]){_0x409d79[_0x57cf('0x57')]=[{'model':db[_0x57cf('0x8e')],'as':_0x57cf('0xad'),'required':![]},{'model':db[_0x57cf('0xa2')],'as':_0x57cf('0xae'),'attributes':[_0x57cf('0x3e'),_0x57cf('0xaf'),'internal'],'required':![]},{'model':db[_0x57cf('0xb0')],'as':_0x57cf('0xb1'),'attributes':['id',_0x57cf('0x3e'),_0x57cf('0xb2')],'where':_0x552038['query'][_0x57cf('0xb3')]?{'id':_0x552038[_0x57cf('0x48')][_0x57cf('0xb3')]}:undefined,'required':_0x552038['query'][_0x57cf('0xb3')]?!![]:![]}];}return db[_0x57cf('0x92')][_0x57cf('0x58')](_0x409d79);})[_0x57cf('0x22')](function(_0x2163a7){_0x527a02['rows']=_0x2163a7;return _0x527a02;});}})[_0x57cf('0x22')](respondWithFilteredResult(_0x27f436,_0x409d79))['catch'](handleError(_0x27f436,null));};exports[_0x57cf('0xb4')]=function(_0x5ac0c6,_0x2e5e61,_0x20c194){return db[_0x57cf('0x43')][_0x57cf('0x5f')]({'where':{'id':_0x5ac0c6['params']['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x2e5e61,null))[_0x57cf('0x22')](function(_0x3dc6be){if(_0x3dc6be){return _0x3dc6be[_0x57cf('0xb4')](_0x5ac0c6[_0x57cf('0x66')]['ids'],_[_0x57cf('0xb5')](_0x5ac0c6[_0x57cf('0x66')],['ids','id'])||{})[_0x57cf('0x95')](function(_0x15fa50){for(var _0x15ba41=0x0;_0x15ba41<_0x5ac0c6['body'][_0x57cf('0x6d')]['length'];_0x15ba41+=0x1){socket[_0x57cf('0xb6')](_0x57cf('0xb7'),{'UserId':Number(_0x5ac0c6['body']['ids'][_0x15ba41]),'OpenchannelAccountId':Number(_0x5ac0c6['params']['id'])});}return _0x15fa50;});}})[_0x57cf('0x22')](respondWithResult(_0x2e5e61,null))[_0x57cf('0x5a')](handleError(_0x2e5e61,null));};exports[_0x57cf('0xb8')]=function(_0x44ec63,_0x1826e8,_0x2428d2){return db[_0x57cf('0x43')][_0x57cf('0x5f')]({'where':{'id':_0x44ec63[_0x57cf('0x5c')]['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x1826e8,null))[_0x57cf('0x22')](function(_0x423c63){if(_0x423c63){return _0x423c63['removeAgents'](_0x44ec63[_0x57cf('0x48')][_0x57cf('0x6d')])[_0x57cf('0x22')](function(){if(_[_0x57cf('0xb9')](_0x44ec63[_0x57cf('0x48')]['ids'])){for(var _0x431228=0x0;_0x431228<_0x44ec63['query'][_0x57cf('0x6d')][_0x57cf('0x4d')];_0x431228+=0x1){socket[_0x57cf('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x44ec63['query'][_0x57cf('0x6d')][_0x431228]),'OpenchannelAccountId':Number(_0x44ec63[_0x57cf('0x5c')]['id'])});}}else{socket[_0x57cf('0xb6')](_0x57cf('0xba'),{'UserId':Number(_0x44ec63[_0x57cf('0x48')]['ids']),'OpenchannelAccountId':Number(_0x44ec63[_0x57cf('0x5c')]['id'])});}});}})[_0x57cf('0x22')](respondWithStatusCode(_0x1826e8,null))[_0x57cf('0x5a')](handleError(_0x1826e8,null));};exports[_0x57cf('0xbb')]=function(_0x13f113,_0x196805,_0x4eac24){var _0x11ac25={};var _0x2c3d56={};var _0x23d708;var _0x3eabac;return db['OpenchannelAccount'][_0x57cf('0x6a')]({'where':{'id':_0x13f113['params']['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x196805,null))[_0x57cf('0x22')](function(_0xae7815){if(_0xae7815){_0x23d708=_0xae7815;_0x2c3d56[_0x57cf('0x46')]=_['keys'](db['User']['rawAttributes']);_0x2c3d56[_0x57cf('0x48')]=_[_0x57cf('0x47')](_0x13f113['query']);_0x2c3d56['filters']=_[_0x57cf('0x4a')](_0x2c3d56[_0x57cf('0x46')],_0x2c3d56[_0x57cf('0x48')]);_0x11ac25['attributes']=_[_0x57cf('0x4a')](_0x2c3d56[_0x57cf('0x46')],qs[_0x57cf('0x4c')](_0x13f113['query']['fields']));_0x11ac25[_0x57cf('0x4b')]=_0x11ac25['attributes'][_0x57cf('0x4d')]?_0x11ac25[_0x57cf('0x4b')]:_0x2c3d56[_0x57cf('0x46')];_0x11ac25[_0x57cf('0x4f')]=qs['sort'](_0x13f113[_0x57cf('0x48')][_0x57cf('0x50')]);_0x11ac25[_0x57cf('0x51')]=qs['filters'](_[_0x57cf('0x52')](_0x13f113[_0x57cf('0x48')],_0x2c3d56[_0x57cf('0x49')]));if(_0x13f113['query'][_0x57cf('0x53')]){_0x11ac25[_0x57cf('0x51')]=_[_0x57cf('0x54')](_0x11ac25[_0x57cf('0x51')],{'$or':_[_0x57cf('0x42')](_0x11ac25[_0x57cf('0x4b')],function(_0x4c33b4){var _0x1bfd05={};_0x1bfd05[_0x4c33b4]={'$like':'%'+_0x13f113[_0x57cf('0x48')][_0x57cf('0x53')]+'%'};return _0x1bfd05;})});}_0x11ac25=_[_0x57cf('0x54')]({},_0x11ac25,_0x13f113[_0x57cf('0x56')]);return _0x23d708[_0x57cf('0xbb')](_0x11ac25);}})[_0x57cf('0x22')](function(_0x5e679d){if(_0x5e679d){_0x3eabac=_0x5e679d['length'];if(!_0x13f113['query']['hasOwnProperty'](_0x57cf('0x6b'))){_0x11ac25[_0x57cf('0x31')]=qs['limit'](_0x13f113[_0x57cf('0x48')][_0x57cf('0x31')]);_0x11ac25['offset']=qs[_0x57cf('0x34')](_0x13f113[_0x57cf('0x48')][_0x57cf('0x34')]);}return _0x23d708[_0x57cf('0xbb')](_0x11ac25);}})['then'](function(_0x10febb){if(_0x10febb){return _0x10febb?{'count':_0x3eabac,'rows':_0x10febb}:null;}})[_0x57cf('0x22')](respondWithResult(_0x196805,null))['catch'](handleError(_0x196805,null));};exports['send']=function(_0xa40f70,_0x5d47d7,_0x1ce497){var _0x316ffc,_0x377f5d,_0x4aaa6c;if(_[_0x57cf('0x7a')](_0xa40f70[_0x57cf('0x66')]['body'])||_0xa40f70['body'][_0x57cf('0x66')]===''){throw new db['Sequelize'][(_0x57cf('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xa40f70[_0x57cf('0x66')]['to'])){}_0x316ffc=_0xa40f70[_0x57cf('0x66')]['to'];return db[_0x57cf('0x43')][_0x57cf('0x6a')]({'where':{'id':_0xa40f70[_0x57cf('0x5c')]['id']}})[_0x57cf('0x22')](handleEntityNotFound(_0x5d47d7,null))[_0x57cf('0x22')](function(_0x162892){if(_0x162892){return db['OpenchannelAccount']['find']({'where':{'id':_0x162892['id']},'include':[{'model':db['CmList'],'as':_0x57cf('0x83'),'include':[{'model':db[_0x57cf('0x8e')],'as':_0x57cf('0x8c'),'where':{[_0x162892[_0x57cf('0x7e')]]:_0x316ffc},'limit':0x1,'order':[[_0x57cf('0x77'),_0x57cf('0x84')]]}]}]})['then'](handleEntityNotFound(_0x5d47d7,null))[_0x57cf('0x22')](function(_0x23817e){if(_0x23817e&&_0x23817e[_0x57cf('0x83')]){_0x377f5d=_0x23817e['get']({'plain':!![]});if(_0x377f5d['List']&&_0x377f5d['List'][_0x57cf('0x8c')]['length']){return _0x377f5d[_0x57cf('0x83')][_0x57cf('0x8c')][0x0];}return db['CmContact'][_0x57cf('0x60')](_[_0x57cf('0x19')](_0xa40f70[_0x57cf('0x66')],{'firstName':_0x316ffc,[_0x23817e[_0x57cf('0x7e')]]:_0x316ffc,'phone':_0x316ffc,'ListId':_0x377f5d['ListId']}));}})[_0x57cf('0x22')](handleEntityNotFound(_0x5d47d7,null))['then'](function(_0x1c0f0a){if(_0x1c0f0a){_0x4aaa6c=_0x1c0f0a;return db[_0x57cf('0x92')]['find']({'where':{'ContactId':_0x4aaa6c['id'],'closed':![],'OpenchannelAccountId':_0x377f5d['id']}})[_0x57cf('0x22')](function(_0x13d5ab){if(_0x13d5ab){return[_0x13d5ab,![]];}return db['OpenchannelInteraction'][_0x57cf('0x60')]({'UserId':_0xa40f70[_0x57cf('0x63')]['id'],'ContactId':_0x4aaa6c['id'],'OpenchannelAccountId':_0x377f5d['id'],'lastMsgDirection':_0x57cf('0xbc'),'Messages':[_[_0x57cf('0x54')](_0xa40f70[_0x57cf('0x66')],{'read':![],'body':_0xa40f70[_0x57cf('0x66')][_0x57cf('0x66')],'OpenchannelAccountId':_0x377f5d['id'],'UserId':_0xa40f70[_0x57cf('0x63')]['id'],'ContactId':_0x4aaa6c['id']})]},{'include':[{'model':db[_0x57cf('0x9f')],'as':_0x57cf('0xbd')}]})['then'](function(_0x3b7de7){return[_0x3b7de7,!![]];});});}})['spread'](function(_0x2072c6,_0x5879af){if(_0x5879af){return _0x2072c6;}return db['OpenchannelMessage']['create'](_[_0x57cf('0x54')](_0xa40f70[_0x57cf('0x66')],{'read':![],'body':_0xa40f70[_0x57cf('0x66')]['body'],'OpenchannelAccountId':_0x377f5d['id'],'OpenchannelInteractionId':_0x2072c6['id'],'UserId':_0xa40f70['user']['id'],'ContactId':_0x4aaa6c['id']}))[_0x57cf('0x22')](function(_0x2beca2){_0x2072c6[_0x57cf('0xbe')][_0x57cf('0xbd')]=[];_0x2072c6['dataValues'][_0x57cf('0xbd')][_0x57cf('0x9b')](_0x2beca2[_0x57cf('0xbe')]);return _0x2072c6;});});}})[_0x57cf('0x22')](respondWithResult(_0x5d47d7,null))[_0x57cf('0x5a')](handleError(_0x5d47d7,null));}; \ No newline at end of file +var _0x692c=['addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','Contacts','ListId','CmContact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','push','close','unmanaged','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','bulkCreate','findAndCountAll','getApplications','getInteractions','User','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','dataValues','Messages','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','status','end','undefined','limit','count','offset','Content-Range','json','save','update','get','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','sort','pick','removeDispositions','ids'];(function(_0x2a7678,_0x12e86e){var _0xcbef37=function(_0x5cc667){while(--_0x5cc667){_0x2a7678['push'](_0x2a7678['shift']());}};_0xcbef37(++_0x12e86e);}(_0x692c,0x1bb));var _0xc692=function(_0x3ce692,_0x491ea9){_0x3ce692=_0x3ce692-0x0;var _0x5307f3=_0x692c[_0x3ce692];return _0x5307f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc692('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc692('0x1'));var BPromise=require(_0xc692('0x2'));var Mustache=require(_0xc692('0x3'));var util=require(_0xc692('0x4'));var path=require(_0xc692('0x5'));var sox=require(_0xc692('0x6'));var csv=require(_0xc692('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc692('0x8'));var _=require(_0xc692('0x9'));var squel=require(_0xc692('0xa'));var crypto=require(_0xc692('0xb'));var jsforce=require(_0xc692('0xc'));var deskjs=require(_0xc692('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc692('0xe'));var authService=require(_0xc692('0xf'));var qs=require(_0xc692('0x10'));var as=require(_0xc692('0x11'));var hardwareService=require(_0xc692('0x12'));var logger=require(_0xc692('0x13'))(_0xc692('0x14'));var utils=require(_0xc692('0x15'));var config=require(_0xc692('0x16'));var licenseUtil=require(_0xc692('0x17'));var db=require(_0xc692('0x18'))['db'];config['redis']=_[_0xc692('0x19')](config[_0xc692('0x1a')],{'host':_0xc692('0x1b'),'port':0x18eb});var socket=require(_0xc692('0x1c'))(new Redis(config[_0xc692('0x1a')]));require(_0xc692('0x1d'))[_0xc692('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc692('0x1f')]({'port':0x232c});var client9002=jayson[_0xc692('0x20')][_0xc692('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1dcda0,_0x2e933a,_0x4d6b1e,_0x1a5f06){return new BPromise(function(_0x54c37,_0x3c0604){var _0x333d00=_0x1a5f06||client;return _0x333d00[_0xc692('0x21')](_0x1dcda0,_0x4d6b1e)[_0xc692('0x22')](function(_0x1229c9){logger[_0xc692('0x23')](_0xc692('0x24'),_0x2e933a,_0xc692('0x25'));logger[_0xc692('0x26')](_0xc692('0x27'),_0x2e933a,'request\x20sent',JSON['stringify'](_0x1229c9));if(_0x1229c9[_0xc692('0x28')]){if(_0x1229c9[_0xc692('0x28')][_0xc692('0x29')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2e933a,_0x1229c9[_0xc692('0x28')][_0xc692('0x2a')]);return _0x3c0604(_0x1229c9[_0xc692('0x28')][_0xc692('0x2a')]);}logger['error'](_0xc692('0x24'),_0x2e933a,_0x1229c9[_0xc692('0x28')]['message']);return _0x54c37(_0x1229c9['error'][_0xc692('0x2a')]);}else{logger[_0xc692('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x2e933a,_0xc692('0x25'));_0x54c37(_0x1229c9['result']['message']);}})['catch'](function(_0x13366f){logger['error'](_0xc692('0x24'),_0x2e933a,_0x13366f);_0x3c0604(_0x13366f);});});}function respondWithStatusCode(_0x3021d4,_0x4beef9){_0x4beef9=_0x4beef9||0xcc;return function(_0x5ba625){if(_0x5ba625){return _0x3021d4['sendStatus'](_0x4beef9);}return _0x3021d4[_0xc692('0x2b')](_0x4beef9)[_0xc692('0x2c')]();};}function respondWithResult(_0x411f29,_0x19ca87){_0x19ca87=_0x19ca87||0xc8;return function(_0x47e6f8){if(_0x47e6f8){return _0x411f29['status'](_0x19ca87)['json'](_0x47e6f8);}};}function respondWithFilteredResult(_0x566683,_0x30be97){return function(_0x5b488a){if(_0x5b488a){var _0x5c1fa2=typeof _0x30be97['offset']===_0xc692('0x2d')&&typeof _0x30be97[_0xc692('0x2e')]===_0xc692('0x2d');var _0x35ebfc=_0x5b488a[_0xc692('0x2f')];var _0x254bcb=_0x5c1fa2?0x0:_0x30be97[_0xc692('0x30')];var _0x5bf375=_0x5c1fa2?_0x5b488a[_0xc692('0x2f')]:_0x30be97[_0xc692('0x30')]+_0x30be97[_0xc692('0x2e')];var _0x2609e7;if(_0x5bf375>=_0x35ebfc){_0x5bf375=_0x35ebfc;_0x2609e7=0xc8;}else{_0x2609e7=0xce;}_0x566683[_0xc692('0x2b')](_0x2609e7);return _0x566683['set'](_0xc692('0x31'),_0x254bcb+'-'+_0x5bf375+'/'+_0x35ebfc)[_0xc692('0x32')](_0x5b488a);}return null;};}function patchUpdates(_0x561adb){return function(_0x249089){try{jsonpatch['apply'](_0x249089,_0x561adb,!![]);}catch(_0x3156a5){return BPromise['reject'](_0x3156a5);}return _0x249089[_0xc692('0x33')]();};}function saveUpdates(_0x5c2760,_0x6f42e4){return function(_0x3b51c3){if(_0x3b51c3){return _0x3b51c3[_0xc692('0x34')](_0x5c2760)[_0xc692('0x22')](function(_0x11d87e){return _0x11d87e;});}return null;};}function removeEntity(_0xa0ee42,_0x585668){return function(_0x18e500){if(_0x18e500){return _0x18e500['destroy']()[_0xc692('0x22')](function(){var _0x3765c4=_0x18e500[_0xc692('0x35')]({'plain':!![]});var _0x5c09fc='OpenchannelAccounts';return db[_0xc692('0x36')][_0xc692('0x37')]({'where':{'type':_0x5c09fc,'resourceId':_0x3765c4['id']}})[_0xc692('0x22')](function(){return _0x18e500;});})[_0xc692('0x22')](function(){_0xa0ee42[_0xc692('0x2b')](0xcc)[_0xc692('0x2c')]();});}};}function handleEntityNotFound(_0x2bedc7,_0x174b5c){return function(_0x2721ad){if(!_0x2721ad){_0x2bedc7['sendStatus'](0x194);}return _0x2721ad;};}function handleError(_0x3c2f48,_0x4256c0){_0x4256c0=_0x4256c0||0x1f4;return function(_0x4ddeab){logger[_0xc692('0x28')](_0x4ddeab[_0xc692('0x38')]);if(_0x4ddeab[_0xc692('0x39')]){delete _0x4ddeab[_0xc692('0x39')];}_0x3c2f48[_0xc692('0x2b')](_0x4256c0)[_0xc692('0x3a')](_0x4ddeab);};}exports[_0xc692('0x3b')]=function(_0xb98436,_0x3dc03c){var _0x503038={'include':[{'model':db[_0xc692('0x3c')],'as':_0xc692('0x3d')}]},_0x33d5d4={},_0x404e74={'count':0x0,'rows':[]};var _0x52d8c8=_[_0xc692('0x3e')](db[_0xc692('0x3f')][_0xc692('0x40')],function(_0x275647){return{'name':_0x275647[_0xc692('0x41')],'type':_0x275647[_0xc692('0x42')][_0xc692('0x43')]};});_0x33d5d4[_0xc692('0x44')]=_[_0xc692('0x3e')](_0x52d8c8,_0xc692('0x39'));_0x33d5d4[_0xc692('0x45')]=_[_0xc692('0x46')](_0xb98436[_0xc692('0x45')]);_0x33d5d4[_0xc692('0x47')]=_[_0xc692('0x48')](_0x33d5d4[_0xc692('0x44')],_0x33d5d4[_0xc692('0x45')]);_0x503038['attributes']=_[_0xc692('0x48')](_0x33d5d4[_0xc692('0x44')],qs[_0xc692('0x49')](_0xb98436[_0xc692('0x45')][_0xc692('0x49')]));_0x503038[_0xc692('0x4a')]=_0x503038['attributes'][_0xc692('0x4b')]?_0x503038[_0xc692('0x4a')]:_0x33d5d4[_0xc692('0x44')];if(!_0xb98436[_0xc692('0x45')][_0xc692('0x4c')](_0xc692('0x4d'))){_0x503038[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0xb98436[_0xc692('0x45')][_0xc692('0x2e')]);_0x503038['offset']=qs[_0xc692('0x30')](_0xb98436['query'][_0xc692('0x30')]);}_0x503038[_0xc692('0x4e')]=qs['sort'](_0xb98436['query']['sort']);_0x503038[_0xc692('0x4f')]=qs['filters'](_['pick'](_0xb98436[_0xc692('0x45')],_0x33d5d4[_0xc692('0x47')]),_0x52d8c8);if(_0xb98436[_0xc692('0x45')][_0xc692('0x50')]){_0x503038[_0xc692('0x4f')]=_[_0xc692('0x51')](_0x503038['where'],{'$or':_[_0xc692('0x3e')](_0x52d8c8,function(_0x6851e1){if(_0x6851e1[_0xc692('0x42')]!=='VIRTUAL'){var _0x189f5a={};_0x189f5a[_0x6851e1[_0xc692('0x39')]]={'$like':'%'+_0xb98436[_0xc692('0x45')]['filter']+'%'};return _0x189f5a;}})});}_0x503038=_[_0xc692('0x51')]({},_0x503038,_0xb98436[_0xc692('0x52')]);var _0x45fa95={'where':_0x503038[_0xc692('0x4f')]};return db[_0xc692('0x3f')][_0xc692('0x2f')](_0x45fa95)['then'](function(_0x4e8d03){_0x404e74[_0xc692('0x2f')]=_0x4e8d03;if(_0xb98436[_0xc692('0x45')][_0xc692('0x53')]){_0x503038['include']=[{'all':!![]}];}return db[_0xc692('0x3f')][_0xc692('0x54')](_0x503038);})[_0xc692('0x22')](function(_0x2ed11a){_0x404e74[_0xc692('0x55')]=_0x2ed11a;return _0x404e74;})[_0xc692('0x22')](respondWithFilteredResult(_0x3dc03c,_0x503038))[_0xc692('0x56')](handleError(_0x3dc03c,null));};exports[_0xc692('0x57')]=function(_0x466c35,_0x86aad1){var _0x1ee49b={'raw':![],'where':{'id':_0x466c35[_0xc692('0x58')]['id']},'include':[{'model':db[_0xc692('0x3c')],'as':'mandatoryDispositionPause'}]},_0xd7bfc5={};_0xd7bfc5[_0xc692('0x44')]=_[_0xc692('0x46')](db['OpenchannelAccount'][_0xc692('0x40')]);_0xd7bfc5[_0xc692('0x45')]=_[_0xc692('0x46')](_0x466c35[_0xc692('0x45')]);_0xd7bfc5['filters']=_['intersection'](_0xd7bfc5['model'],_0xd7bfc5[_0xc692('0x45')]);_0x1ee49b[_0xc692('0x4a')]=_[_0xc692('0x48')](_0xd7bfc5[_0xc692('0x44')],qs[_0xc692('0x49')](_0x466c35[_0xc692('0x45')][_0xc692('0x49')]));_0x1ee49b[_0xc692('0x4a')]=_0x1ee49b[_0xc692('0x4a')][_0xc692('0x4b')]?_0x1ee49b[_0xc692('0x4a')]:_0xd7bfc5[_0xc692('0x44')];if(_0x466c35[_0xc692('0x45')][_0xc692('0x53')]){_0x1ee49b[_0xc692('0x59')]=[{'all':!![]}];}_0x1ee49b=_['merge']({},_0x1ee49b,_0x466c35[_0xc692('0x52')]);return db[_0xc692('0x3f')][_0xc692('0x5a')](_0x1ee49b)[_0xc692('0x22')](handleEntityNotFound(_0x86aad1,null))['then'](respondWithResult(_0x86aad1,null))[_0xc692('0x56')](handleError(_0x86aad1,null));};exports[_0xc692('0x5b')]=function(_0x40d630,_0x5d198e){return db[_0xc692('0x3f')][_0xc692('0x5b')](_0x40d630[_0xc692('0x5c')],{})[_0xc692('0x22')](function(_0x1ce4c8){var _0x5580b5=_0x40d630[_0xc692('0x5d')][_0xc692('0x35')]({'plain':!![]});if(!_0x5580b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5580b5[_0xc692('0x5e')]===_0xc692('0x5d')){var _0x1af56f=_0x1ce4c8[_0xc692('0x35')]({'plain':!![]});var _0x47d388=_0xc692('0x5f');return db[_0xc692('0x60')]['find']({'where':{'name':_0x47d388,'userProfileId':_0x5580b5['userProfileId']},'raw':!![]})['then'](function(_0x2c4e52){if(_0x2c4e52&&_0x2c4e52[_0xc692('0x61')]===0x0){return db[_0xc692('0x36')][_0xc692('0x5b')]({'name':_0x1af56f[_0xc692('0x39')],'resourceId':_0x1af56f['id'],'type':_0x2c4e52[_0xc692('0x39')],'sectionId':_0x2c4e52['id']},{})[_0xc692('0x22')](function(){return _0x1ce4c8;});}else{return _0x1ce4c8;}})[_0xc692('0x56')](function(_0x2e7b6c){logger[_0xc692('0x28')](_0xc692('0x62'),_0x2e7b6c);throw _0x2e7b6c;});}return _0x1ce4c8;})[_0xc692('0x22')](respondWithResult(_0x5d198e,0xc9))[_0xc692('0x56')](handleError(_0x5d198e,null));};exports[_0xc692('0x34')]=function(_0x2b06d5,_0x39b818){if(_0x2b06d5[_0xc692('0x5c')]['id']){delete _0x2b06d5[_0xc692('0x5c')]['id'];}return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x2b06d5[_0xc692('0x58')]['id']},'include':[{'model':db[_0xc692('0x3c')],'as':_0xc692('0x3d')}]})['then'](handleEntityNotFound(_0x39b818,null))[_0xc692('0x22')](saveUpdates(_0x2b06d5[_0xc692('0x5c')],null))[_0xc692('0x22')](respondWithResult(_0x39b818,null))[_0xc692('0x56')](handleError(_0x39b818,null));};exports[_0xc692('0x37')]=function(_0x106831,_0x262791){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x106831['params']['id']}})['then'](handleEntityNotFound(_0x262791,null))[_0xc692('0x22')](removeEntity(_0x262791,null))[_0xc692('0x56')](handleError(_0x262791,null));};exports[_0xc692('0x63')]=function(_0x3923bb,_0x39487e){return db[_0xc692('0x3f')][_0xc692('0x63')]()[_0xc692('0x22')](respondWithResult(_0x39487e,null))[_0xc692('0x56')](handleError(_0x39487e,null));};exports[_0xc692('0x64')]=function(_0x4681e3,_0x32be17,_0x42fe68){if(_0x4681e3[_0xc692('0x5c')]['id']){delete _0x4681e3['body']['id'];}return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x4681e3['params']['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x32be17,null))[_0xc692('0x22')](function(_0x52c57d){if(_0x52c57d){_0x4681e3[_0xc692('0x5c')][_0xc692('0x65')]=_0x52c57d['id'];return db[_0xc692('0x66')][_0xc692('0x5b')](_0x4681e3['body']);}})['then'](respondWithResult(_0x32be17,null))[_0xc692('0x56')](handleError(_0x32be17,null));};exports[_0xc692('0x67')]=function(_0x20ffd0,_0x3ef263,_0x4034f7){var _0x106b4d={'raw':![],'where':{}};var _0x394b52={};var _0x2fe245={'count':0x0,'rows':[]};return db[_0xc692('0x3f')][_0xc692('0x68')]({'where':{'id':_0x20ffd0['params']['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x3ef263,null))[_0xc692('0x22')](function(_0x101926){if(_0x101926){_0x394b52[_0xc692('0x44')]=_['keys'](db['Disposition']['rawAttributes']);_0x394b52[_0xc692('0x45')]=_[_0xc692('0x46')](_0x20ffd0[_0xc692('0x45')]);_0x394b52[_0xc692('0x47')]=_[_0xc692('0x48')](_0x394b52[_0xc692('0x44')],_0x394b52[_0xc692('0x45')]);_0x106b4d[_0xc692('0x4a')]=_[_0xc692('0x48')](_0x394b52[_0xc692('0x44')],qs[_0xc692('0x49')](_0x20ffd0[_0xc692('0x45')][_0xc692('0x49')]));_0x106b4d['attributes']=_0x106b4d[_0xc692('0x4a')]['length']?_0x106b4d[_0xc692('0x4a')]:_0x394b52[_0xc692('0x44')];if(!_0x20ffd0[_0xc692('0x45')]['hasOwnProperty'](_0xc692('0x4d'))){_0x106b4d[_0xc692('0x2e')]=qs['limit'](_0x20ffd0[_0xc692('0x45')][_0xc692('0x2e')]);_0x106b4d[_0xc692('0x30')]=qs[_0xc692('0x30')](_0x20ffd0['query'][_0xc692('0x30')]);}_0x106b4d[_0xc692('0x4e')]=qs['sort'](_0x20ffd0[_0xc692('0x45')][_0xc692('0x69')]);_0x106b4d['where']=qs[_0xc692('0x47')](_[_0xc692('0x6a')](_0x20ffd0[_0xc692('0x45')],_0x394b52[_0xc692('0x47')]));_0x106b4d['where'][_0xc692('0x65')]=_0x101926['id'];if(_0x20ffd0['query']['filter']){_0x106b4d[_0xc692('0x4f')]=_['merge'](_0x106b4d[_0xc692('0x4f')],{'$or':_[_0xc692('0x3e')](_0x106b4d[_0xc692('0x4a')],function(_0x179a1e){var _0x434d8d={};_0x434d8d[_0x179a1e]={'$like':'%'+_0x20ffd0[_0xc692('0x45')][_0xc692('0x50')]+'%'};return _0x434d8d;})});}_0x106b4d=_[_0xc692('0x51')]({},_0x106b4d,_0x20ffd0[_0xc692('0x52')]);return db[_0xc692('0x66')]['count']({'where':_0x106b4d[_0xc692('0x4f')]})[_0xc692('0x22')](function(_0x3a3917){_0x2fe245[_0xc692('0x2f')]=_0x3a3917;if(_0x20ffd0['query'][_0xc692('0x53')]){_0x106b4d[_0xc692('0x59')]=[{'all':!![]}];}return db[_0xc692('0x66')][_0xc692('0x54')](_0x106b4d);})['then'](function(_0x3779d8){_0x2fe245[_0xc692('0x55')]=_0x3779d8;return _0x2fe245;});}})[_0xc692('0x22')](respondWithFilteredResult(_0x3ef263,_0x106b4d))['catch'](handleError(_0x3ef263,null));};exports[_0xc692('0x6b')]=function(_0x1e40c5,_0x1dfa9b,_0x44579a){return db['OpenchannelAccount'][_0xc692('0x5a')]({'where':{'id':_0x1e40c5[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x1dfa9b,null))[_0xc692('0x22')](function(_0x3b5730){if(_0x3b5730){return _0x3b5730[_0xc692('0x6b')](_0x1e40c5[_0xc692('0x45')][_0xc692('0x6c')]);}})[_0xc692('0x22')](respondWithStatusCode(_0x1dfa9b,null))[_0xc692('0x56')](handleError(_0x1dfa9b,null));};exports[_0xc692('0x6d')]=function(_0xcafe44,_0x26835e,_0x56d439){if(_0xcafe44['body']['id']){delete _0xcafe44['body']['id'];}return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0xcafe44[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x26835e,null))[_0xc692('0x22')](function(_0x12b6f3){if(_0x12b6f3){_0xcafe44['body'][_0xc692('0x65')]=_0x12b6f3['id'];return db[_0xc692('0x6e')][_0xc692('0x5b')](_0xcafe44[_0xc692('0x5c')]);}})[_0xc692('0x22')](respondWithResult(_0x26835e,null))[_0xc692('0x56')](handleError(_0x26835e,null));};exports[_0xc692('0x6f')]=function(_0x567257,_0x11a0d4,_0x559e09){var _0x371743={'raw':![],'where':{}};var _0x4e15bd={};var _0xbb6c35={'count':0x0,'rows':[]};return db[_0xc692('0x3f')]['findOne']({'where':{'id':_0x567257[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x11a0d4,null))['then'](function(_0x41acf4){if(_0x41acf4){_0x4e15bd[_0xc692('0x44')]=_['keys'](db['CannedAnswer'][_0xc692('0x40')]);_0x4e15bd['query']=_['keys'](_0x567257[_0xc692('0x45')]);_0x4e15bd['filters']=_['intersection'](_0x4e15bd[_0xc692('0x44')],_0x4e15bd[_0xc692('0x45')]);_0x371743[_0xc692('0x4a')]=_[_0xc692('0x48')](_0x4e15bd[_0xc692('0x44')],qs['fields'](_0x567257[_0xc692('0x45')][_0xc692('0x49')]));_0x371743[_0xc692('0x4a')]=_0x371743[_0xc692('0x4a')][_0xc692('0x4b')]?_0x371743[_0xc692('0x4a')]:_0x4e15bd['model'];if(!_0x567257['query'][_0xc692('0x4c')](_0xc692('0x4d'))){_0x371743[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0x567257[_0xc692('0x45')][_0xc692('0x2e')]);_0x371743[_0xc692('0x30')]=qs[_0xc692('0x30')](_0x567257[_0xc692('0x45')][_0xc692('0x30')]);}_0x371743[_0xc692('0x4e')]=qs[_0xc692('0x69')](_0x567257[_0xc692('0x45')][_0xc692('0x69')]);_0x371743[_0xc692('0x4f')]=qs[_0xc692('0x47')](_['pick'](_0x567257[_0xc692('0x45')],_0x4e15bd[_0xc692('0x47')]));_0x371743[_0xc692('0x4f')]['OpenchannelAccountId']=_0x41acf4['id'];if(_0x567257['query'][_0xc692('0x50')]){_0x371743[_0xc692('0x4f')]=_['merge'](_0x371743['where'],{'$or':_['map'](_0x371743[_0xc692('0x4a')],function(_0x4caef2){var _0x5240b8={};_0x5240b8[_0x4caef2]={'$like':'%'+_0x567257[_0xc692('0x45')][_0xc692('0x50')]+'%'};return _0x5240b8;})});}_0x371743=_['merge']({},_0x371743,_0x567257[_0xc692('0x52')]);return db[_0xc692('0x6e')][_0xc692('0x2f')]({'where':_0x371743[_0xc692('0x4f')]})[_0xc692('0x22')](function(_0x3880af){_0xbb6c35[_0xc692('0x2f')]=_0x3880af;if(_0x567257[_0xc692('0x45')][_0xc692('0x53')]){_0x371743[_0xc692('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc692('0x54')](_0x371743);})['then'](function(_0x547242){_0xbb6c35[_0xc692('0x55')]=_0x547242;return _0xbb6c35;});}})['then'](respondWithFilteredResult(_0x11a0d4,_0x371743))[_0xc692('0x56')](handleError(_0x11a0d4,null));};exports[_0xc692('0x70')]=function(_0x232e2a,_0x251d7d,_0x5f1e9a){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x232e2a[_0xc692('0x58')]['id']}})['then'](handleEntityNotFound(_0x251d7d,null))[_0xc692('0x22')](function(_0x5bd396){if(_0x5bd396){return _0x5bd396[_0xc692('0x70')](_0x232e2a[_0xc692('0x45')]['ids']);}})[_0xc692('0x22')](respondWithStatusCode(_0x251d7d,null))[_0xc692('0x56')](handleError(_0x251d7d,null));};exports[_0xc692('0x71')]=function(_0x29325c,_0x275eae,_0x5de786){var _0x2fcb49={'body':_0x29325c[_0xc692('0x5c')],'channel':_0xc692('0x72')};var _0x47aa2c=[];var _0x4de215=[];var _0xf7efd3={};var _0x56ad5a=![];return db['CmContact'][_0xc692('0x63')]()[_0xc692('0x22')](function(_0x6ef90d){if(!_0x6ef90d){throw new db[(_0xc692('0x73'))][(_0xc692('0x74'))](_0xc692('0x75'));}_0x47aa2c=_['difference'](_[_0xc692('0x46')](_0x6ef90d),['createdAt',_0xc692('0x76')]);_0x4de215=_[_0xc692('0x77')](_[_0xc692('0x46')](_0x6ef90d),['createdAt',_0xc692('0x76'),_0xc692('0x78'),'ListId']);if(_0x29325c['body']['id']){delete _0x29325c[_0xc692('0x5c')]['id'];}if(_[_0xc692('0x79')](_0x29325c[_0xc692('0x5c')][_0xc692('0x7a')])){throw new db[(_0xc692('0x73'))][(_0xc692('0x74'))](_0xc692('0x7b'));}if(_[_0xc692('0x79')](_0x29325c['body']['body'])||_0x29325c[_0xc692('0x5c')][_0xc692('0x5c')]===''){throw new db[(_0xc692('0x73'))][(_0xc692('0x74'))](_0xc692('0x7c'));}if(_[_0xc692('0x79')](_0x29325c['body'][_0xc692('0x7d')])){throw new db['Sequelize'][(_0xc692('0x74'))](_0xc692('0x7e')+_0x4de215);}if(!_[_0xc692('0x7f')](_0x4de215,_0x29325c[_0xc692('0x5c')][_0xc692('0x7d')])){throw new db['Sequelize'][(_0xc692('0x74'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4de215);}_0xf7efd3[_0x29325c[_0xc692('0x5c')][_0xc692('0x7d')]]=_0x29325c[_0xc692('0x5c')]['from'];})[_0xc692('0x22')](function(){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x29325c['params']['id']},'include':[{'model':db[_0xc692('0x80')],'as':_0xc692('0x81'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xf7efd3,'limit':0x1,'order':[[_0xc692('0x76'),_0xc692('0x82')]]}]},{'model':db[_0xc692('0x83')],'as':_0xc692('0x84')}]});})[_0xc692('0x22')](handleEntityNotFound(_0x275eae,null))[_0xc692('0x22')](function(_0x298112){if(_0x298112&&_0x298112[_0xc692('0x81')]){_0x2fcb49[_0xc692('0x85')]=_0x298112;_0x2fcb49['applications']=_0x298112['Applications'];_0x2fcb49['list']=_0x298112[_0xc692('0x81')];_0x2fcb49[_0xc692('0x86')]=_[_0xc692('0x87')](_0x2fcb49[_0xc692('0x86')],[_0xc692('0x88')],['asc']);if(_0x2fcb49[_0xc692('0x85')][_0xc692('0x84')]){delete _0x2fcb49[_0xc692('0x85')][_0xc692('0x84')];}if(_0x2fcb49['account']['List']&&_0x2fcb49[_0xc692('0x85')][_0xc692('0x81')]['Contacts'][_0xc692('0x4b')]){return _0x2fcb49[_0xc692('0x85')]['List'][_0xc692('0x89')][0x0];}var _0x66b519=_[_0xc692('0x19')](_0x29325c[_0xc692('0x5c')],{'firstName':_0x29325c['body'][_0xc692('0x7a')],'ListId':_0x298112[_0xc692('0x8a')]});_0x66b519[_0x29325c[_0xc692('0x5c')][_0xc692('0x7d')]]=_0x29325c[_0xc692('0x5c')][_0xc692('0x7a')];return db[_0xc692('0x8b')][_0xc692('0x5b')](_0x66b519,{'fields':_0x47aa2c,'raw':!![]});}})[_0xc692('0x22')](handleEntityNotFound(_0x275eae,null))['then'](function(_0x50405c){_0x2fcb49['contact']=_0x50405c;if(_0x50405c){var _0x52e3e8={'ContactId':_0x50405c['id'],'OpenchannelAccountId':_0x29325c['params']['id'],'from':(_0x50405c[_0xc692('0x8c')]||'')+'\x20'+(_0x50405c['lastName']||'')};var _0x262e49={'OpenchannelAccountId':_0x29325c[_0xc692('0x58')]['id'],'closed':![]};if(_0x29325c[_0xc692('0x5c')]['threadId']){_0x262e49[_0xc692('0x8d')]=_0x29325c[_0xc692('0x5c')][_0xc692('0x8d')];return db[_0xc692('0x8e')][_0xc692('0x5a')]({'where':_0x262e49})[_0xc692('0x22')](function(_0x47fad3){if(_0x47fad3){return[_0x47fad3,![]];}_0x52e3e8[_0xc692('0x8d')]=_0x29325c[_0xc692('0x5c')][_0xc692('0x8d')];_0x52e3e8[_0xc692('0x8f')]=_0x29325c[_0xc692('0x5c')]['externalUrl'];return db[_0xc692('0x8e')][_0xc692('0x5b')](_0x52e3e8)[_0xc692('0x22')](function(_0x1fd09a){return[_0x1fd09a,!![]];});});}else{_0x262e49[_0xc692('0x8d')]=null;}_0x262e49[_0xc692('0x90')]=_0x50405c['id'];return db[_0xc692('0x8e')][_0xc692('0x5a')]({'where':_0x262e49})[_0xc692('0x22')](function(_0x30661e){if(_0x30661e){return[_0x30661e,![]];}return db[_0xc692('0x8e')][_0xc692('0x5b')](_0x52e3e8)[_0xc692('0x22')](function(_0x2b37eb){return[_0x2b37eb,!![]];});});}})[_0xc692('0x91')](function(_0x92be6a,_0x57d3c2){if(_0x92be6a){_0x56ad5a=_0x57d3c2;if(!_0x57d3c2){var _0x38d656={'from':(_0x2fcb49[_0xc692('0x92')]['firstName']||'')+'\x20'+(_0x2fcb49[_0xc692('0x92')][_0xc692('0x93')]||'')};if(_0x29325c[_0xc692('0x5c')][_0xc692('0x8d')]&&_0x29325c[_0xc692('0x5c')]['messageId']&&_0x29325c[_0xc692('0x5c')][_0xc692('0x8d')]!=_0x29325c[_0xc692('0x5c')][_0xc692('0x94')]){_0x38d656['threadId']=_0x29325c[_0xc692('0x5c')]['messageId'];}return _0x92be6a[_0xc692('0x34')](_0x38d656);}else{return _0x92be6a;}}})[_0xc692('0x22')](function(_0x83f081){_0x2fcb49[_0xc692('0x95')]=_0x83f081['get']({'plain':!![]});_0x2fcb49[_0xc692('0x95')]['created']=_0x56ad5a;if(_0x2fcb49[_0xc692('0x95')][_0xc692('0x96')]){if(_0x2fcb49['account']['autoclose']){_0x2fcb49[_0xc692('0x86')][_0xc692('0x97')]({'id':0x0,'priority':_0x2fcb49['applications']['length']+0x1,'app':_0xc692('0x98'),'appdata':_0xc692('0x99'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xc692('0x5b')]({'body':_0x29325c[_0xc692('0x5c')]['body'],'OpenchannelAccountId':_0x29325c[_0xc692('0x58')]['id'],'OpenchannelInteractionId':_0x83f081['id'],'direction':'in','ContactId':_0x2fcb49[_0xc692('0x92')]['id'],'AttachmentId':_0x29325c['body'][_0xc692('0x9a')]});})['then'](function(_0x71c558){_0x2fcb49[_0xc692('0x2a')]=_0x71c558;if(_0x2fcb49[_0xc692('0x95')]['UserId']){return db['User'][_0xc692('0x5a')]({'attributes':['id',_0xc692('0x39')],'where':{'id':_0x2fcb49['interaction'][_0xc692('0x9b')]}})['then'](function(_0x445a18){if(_0x445a18){_0x2fcb49['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xc692('0x9c'),'appdata':_0x445a18['name']+','+(_0x2fcb49['account'][_0xc692('0x9d')]||0xa),'interval':_0xc692('0x9e')});_0x2fcb49['forcedOwnership']=![];}return respondWithRpcPromise(_0xc692('0x9f'),_0xc692('0xa0'),_0x2fcb49);});}return respondWithRpcPromise(_0xc692('0x9f'),_0xc692('0xa0'),_0x2fcb49);})[_0xc692('0x22')](function(_0x2ef94a){respondWithRpcPromise(_0xc692('0xa1'),_0xc692('0xa1'),{'event':_0xc692('0x71'),'message':_0x2ef94a},client9002);return _0x2ef94a;})[_0xc692('0x22')](respondWithResult(_0x275eae,null))[_0xc692('0x56')](handleError(_0x275eae,null));};exports['addApplications']=function(_0x4d2d2f,_0x37baba,_0x32354b){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4d2d2f['params']['id']}})['then'](handleEntityNotFound(_0x37baba,null))['then'](function(_0x3fc94c){if(_0x3fc94c){return db['sequelize']['transaction'](function(_0x201400){return db[_0xc692('0x83')]['destroy']({'where':{'OpenchannelAccountId':_0x4d2d2f[_0xc692('0x58')]['id']},'transaction':_0x201400})[_0xc692('0x22')](function(_0x5e5d55){var _0xae6123=_[_0xc692('0x3e')](_0x4d2d2f[_0xc692('0x5c')],function(_0x452249){_0x452249[_0xc692('0x65')]=_0x4d2d2f[_0xc692('0x58')]['id'];return _0x452249;});return db[_0xc692('0x83')][_0xc692('0xa2')](_0xae6123,{'transaction':_0x201400});});})[_0xc692('0x22')](function(){return db[_0xc692('0x83')][_0xc692('0xa3')]({'where':{'OpenchannelAccountId':_0x4d2d2f['params']['id']},'order':_0xc692('0x88')});});}})[_0xc692('0x22')](respondWithResult(_0x37baba,null))['catch'](handleError(_0x37baba,null));};exports[_0xc692('0xa4')]=function(_0x2d88e3,_0x82ccf4,_0x230989){var _0x24239d={};var _0x43d2c1={};var _0x21f424;var _0x40490;return db['OpenchannelAccount'][_0xc692('0x68')]({'where':{'id':_0x2d88e3[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x82ccf4,null))['then'](function(_0x49874c){if(_0x49874c){_0x21f424=_0x49874c;_0x43d2c1[_0xc692('0x44')]=_[_0xc692('0x46')](db['OpenchannelApplication'][_0xc692('0x40')]);_0x43d2c1[_0xc692('0x45')]=_['keys'](_0x2d88e3[_0xc692('0x45')]);_0x43d2c1[_0xc692('0x47')]=_['intersection'](_0x43d2c1[_0xc692('0x44')],_0x43d2c1[_0xc692('0x45')]);_0x24239d['attributes']=_[_0xc692('0x48')](_0x43d2c1[_0xc692('0x44')],qs[_0xc692('0x49')](_0x2d88e3[_0xc692('0x45')][_0xc692('0x49')]));_0x24239d['attributes']=_0x24239d[_0xc692('0x4a')][_0xc692('0x4b')]?_0x24239d[_0xc692('0x4a')]:_0x43d2c1[_0xc692('0x44')];_0x24239d[_0xc692('0x4e')]=qs[_0xc692('0x69')](_0x2d88e3[_0xc692('0x45')][_0xc692('0x69')]);_0x24239d[_0xc692('0x4f')]=qs[_0xc692('0x47')](_[_0xc692('0x6a')](_0x2d88e3['query'],_0x43d2c1[_0xc692('0x47')]));if(_0x2d88e3['query'][_0xc692('0x50')]){_0x24239d['where']=_[_0xc692('0x51')](_0x24239d['where'],{'$or':_[_0xc692('0x3e')](_0x24239d[_0xc692('0x4a')],function(_0x39f244){var _0x255051={};_0x255051[_0x39f244]={'$like':'%'+_0x2d88e3['query']['filter']+'%'};return _0x255051;})});}_0x24239d=_[_0xc692('0x51')]({},_0x24239d,_0x2d88e3[_0xc692('0x52')]);return _0x21f424['getApplications'](_0x24239d);}})[_0xc692('0x22')](function(_0x2291ce){if(_0x2291ce){_0x40490=_0x2291ce[_0xc692('0x4b')];if(!_0x2d88e3['query']['hasOwnProperty']('nolimit')){_0x24239d[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0x2d88e3['query'][_0xc692('0x2e')]);_0x24239d['offset']=qs[_0xc692('0x30')](_0x2d88e3[_0xc692('0x45')][_0xc692('0x30')]);}return _0x21f424['getApplications'](_0x24239d);}})[_0xc692('0x22')](function(_0x4045d2){if(_0x4045d2){return _0x4045d2?{'count':_0x40490,'rows':_0x4045d2}:null;}})[_0xc692('0x22')](respondWithResult(_0x82ccf4,null))[_0xc692('0x56')](handleError(_0x82ccf4,null));};exports[_0xc692('0xa5')]=function(_0x136be3,_0x411241,_0x57443b){var _0x32cb58={'raw':![],'where':{}};var _0x2dac0d={};var _0xb18600={'count':0x0,'rows':[]};return db[_0xc692('0x3f')]['findOne']({'where':{'id':_0x136be3[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x411241,null))[_0xc692('0x22')](function(_0x4aa991){if(_0x4aa991){_0x2dac0d['model']=_[_0xc692('0x46')](db[_0xc692('0x8e')][_0xc692('0x40')]);_0x2dac0d[_0xc692('0x45')]=_[_0xc692('0x46')](_0x136be3[_0xc692('0x45')]);_0x2dac0d['filters']=_[_0xc692('0x48')](_0x2dac0d[_0xc692('0x44')],_0x2dac0d['query']);_0x32cb58['attributes']=_['intersection'](_0x2dac0d['model'],qs[_0xc692('0x49')](_0x136be3[_0xc692('0x45')][_0xc692('0x49')]));_0x32cb58['attributes']=_0x32cb58[_0xc692('0x4a')][_0xc692('0x4b')]?_0x32cb58[_0xc692('0x4a')]:_0x2dac0d[_0xc692('0x44')];if(!_0x136be3['query'][_0xc692('0x4c')](_0xc692('0x4d'))){_0x32cb58[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0x136be3[_0xc692('0x45')][_0xc692('0x2e')]);_0x32cb58[_0xc692('0x30')]=qs[_0xc692('0x30')](_0x136be3[_0xc692('0x45')][_0xc692('0x30')]);}_0x32cb58[_0xc692('0x4e')]=qs[_0xc692('0x69')](_0x136be3[_0xc692('0x45')][_0xc692('0x69')]);_0x32cb58[_0xc692('0x4f')]=qs[_0xc692('0x47')](_[_0xc692('0x6a')](_0x136be3[_0xc692('0x45')],_0x2dac0d[_0xc692('0x47')]));_0x32cb58[_0xc692('0x4f')][_0xc692('0x65')]=_0x4aa991['id'];if(_0x136be3[_0xc692('0x45')]['filter']){_0x32cb58[_0xc692('0x4f')]=_[_0xc692('0x51')](_0x32cb58[_0xc692('0x4f')],{'$or':_[_0xc692('0x3e')](_0x32cb58[_0xc692('0x4a')],function(_0x4c5777){var _0x341c1e={};_0x341c1e[_0x4c5777]={'$like':'%'+_0x136be3[_0xc692('0x45')][_0xc692('0x50')]+'%'};return _0x341c1e;})});}_0x32cb58=_['merge']({},_0x32cb58,_0x136be3[_0xc692('0x52')]);return db[_0xc692('0x8e')][_0xc692('0x2f')]({'where':_0x32cb58['where']})[_0xc692('0x22')](function(_0x5cf969){_0xb18600[_0xc692('0x2f')]=_0x5cf969;if(_0x136be3[_0xc692('0x45')]['includeAll']){_0x32cb58[_0xc692('0x59')]=[{'model':db[_0xc692('0x8b')],'as':'Contact','required':![]},{'model':db[_0xc692('0xa6')],'as':_0xc692('0xa7'),'attributes':[_0xc692('0x39'),_0xc692('0xa8'),_0xc692('0xa9')],'required':![]},{'model':db[_0xc692('0xaa')],'as':_0xc692('0xab'),'attributes':['id',_0xc692('0x39'),'color'],'where':_0x136be3[_0xc692('0x45')][_0xc692('0xac')]?{'id':_0x136be3['query'][_0xc692('0xac')]}:undefined,'required':_0x136be3[_0xc692('0x45')][_0xc692('0xac')]?!![]:![]}];}return db[_0xc692('0x8e')][_0xc692('0x54')](_0x32cb58);})[_0xc692('0x22')](function(_0x39034e){_0xb18600['rows']=_0x39034e;return _0xb18600;});}})[_0xc692('0x22')](respondWithFilteredResult(_0x411241,_0x32cb58))['catch'](handleError(_0x411241,null));};exports['addAgents']=function(_0x11242b,_0x387848,_0x250b84){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x11242b['params']['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x387848,null))['then'](function(_0x1bee48){if(_0x1bee48){return _0x1bee48[_0xc692('0xad')](_0x11242b[_0xc692('0x5c')]['ids'],_[_0xc692('0xae')](_0x11242b[_0xc692('0x5c')],[_0xc692('0x6c'),'id'])||{})[_0xc692('0x91')](function(_0x3aac93){for(var _0x25f533=0x0;_0x25f533<_0x11242b['body'][_0xc692('0x6c')][_0xc692('0x4b')];_0x25f533+=0x1){socket[_0xc692('0xaf')]('userOpenchannelAccount:save',{'UserId':Number(_0x11242b['body'][_0xc692('0x6c')][_0x25f533]),'OpenchannelAccountId':Number(_0x11242b[_0xc692('0x58')]['id'])});}return _0x3aac93;});}})[_0xc692('0x22')](respondWithResult(_0x387848,null))['catch'](handleError(_0x387848,null));};exports[_0xc692('0xb0')]=function(_0x2731e2,_0x23ce89,_0x23b69b){return db['OpenchannelAccount'][_0xc692('0x5a')]({'where':{'id':_0x2731e2[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x23ce89,null))['then'](function(_0x13c53e){if(_0x13c53e){return _0x13c53e['removeAgents'](_0x2731e2[_0xc692('0x45')][_0xc692('0x6c')])[_0xc692('0x22')](function(){if(_[_0xc692('0xb1')](_0x2731e2[_0xc692('0x45')][_0xc692('0x6c')])){for(var _0x2fb84b=0x0;_0x2fb84b<_0x2731e2[_0xc692('0x45')]['ids'][_0xc692('0x4b')];_0x2fb84b+=0x1){socket[_0xc692('0xaf')](_0xc692('0xb2'),{'UserId':Number(_0x2731e2[_0xc692('0x45')]['ids'][_0x2fb84b]),'OpenchannelAccountId':Number(_0x2731e2[_0xc692('0x58')]['id'])});}}else{socket['emit'](_0xc692('0xb2'),{'UserId':Number(_0x2731e2['query'][_0xc692('0x6c')]),'OpenchannelAccountId':Number(_0x2731e2[_0xc692('0x58')]['id'])});}});}})[_0xc692('0x22')](respondWithStatusCode(_0x23ce89,null))['catch'](handleError(_0x23ce89,null));};exports[_0xc692('0xb3')]=function(_0xd9c17f,_0x1a1f49,_0x305f60){var _0x422612={};var _0x5dc296={};var _0x1167a1;var _0x5ce7e5;return db['OpenchannelAccount'][_0xc692('0x68')]({'where':{'id':_0xd9c17f['params']['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x1a1f49,null))['then'](function(_0x24c443){if(_0x24c443){_0x1167a1=_0x24c443;_0x5dc296['model']=_['keys'](db[_0xc692('0xa6')]['rawAttributes']);_0x5dc296['query']=_[_0xc692('0x46')](_0xd9c17f[_0xc692('0x45')]);_0x5dc296[_0xc692('0x47')]=_[_0xc692('0x48')](_0x5dc296[_0xc692('0x44')],_0x5dc296['query']);_0x422612['attributes']=_[_0xc692('0x48')](_0x5dc296[_0xc692('0x44')],qs[_0xc692('0x49')](_0xd9c17f[_0xc692('0x45')]['fields']));_0x422612[_0xc692('0x4a')]=_0x422612[_0xc692('0x4a')][_0xc692('0x4b')]?_0x422612[_0xc692('0x4a')]:_0x5dc296[_0xc692('0x44')];_0x422612[_0xc692('0x4e')]=qs['sort'](_0xd9c17f[_0xc692('0x45')]['sort']);_0x422612[_0xc692('0x4f')]=qs[_0xc692('0x47')](_['pick'](_0xd9c17f['query'],_0x5dc296[_0xc692('0x47')]));if(_0xd9c17f[_0xc692('0x45')][_0xc692('0x50')]){_0x422612['where']=_[_0xc692('0x51')](_0x422612[_0xc692('0x4f')],{'$or':_[_0xc692('0x3e')](_0x422612[_0xc692('0x4a')],function(_0x6a087b){var _0x2fa7c7={};_0x2fa7c7[_0x6a087b]={'$like':'%'+_0xd9c17f[_0xc692('0x45')][_0xc692('0x50')]+'%'};return _0x2fa7c7;})});}_0x422612=_[_0xc692('0x51')]({},_0x422612,_0xd9c17f[_0xc692('0x52')]);return _0x1167a1['getAgents'](_0x422612);}})[_0xc692('0x22')](function(_0x13230d){if(_0x13230d){_0x5ce7e5=_0x13230d[_0xc692('0x4b')];if(!_0xd9c17f[_0xc692('0x45')][_0xc692('0x4c')]('nolimit')){_0x422612[_0xc692('0x2e')]=qs[_0xc692('0x2e')](_0xd9c17f[_0xc692('0x45')]['limit']);_0x422612[_0xc692('0x30')]=qs[_0xc692('0x30')](_0xd9c17f['query'][_0xc692('0x30')]);}return _0x1167a1[_0xc692('0xb3')](_0x422612);}})[_0xc692('0x22')](function(_0x301167){if(_0x301167){return _0x301167?{'count':_0x5ce7e5,'rows':_0x301167}:null;}})[_0xc692('0x22')](respondWithResult(_0x1a1f49,null))['catch'](handleError(_0x1a1f49,null));};exports[_0xc692('0x3a')]=function(_0x1fad6b,_0x596535,_0x34d1af){var _0x264514,_0x184847,_0x5f4a74;if(_[_0xc692('0x79')](_0x1fad6b[_0xc692('0x5c')]['body'])||_0x1fad6b['body'][_0xc692('0x5c')]===''){throw new db[(_0xc692('0x73'))][(_0xc692('0x74'))](_0xc692('0x7c'));}if(_['isNil'](_0x1fad6b[_0xc692('0x5c')]['to'])){}_0x264514=_0x1fad6b[_0xc692('0x5c')]['to'];return db[_0xc692('0x3f')][_0xc692('0x68')]({'where':{'id':_0x1fad6b[_0xc692('0x58')]['id']}})[_0xc692('0x22')](handleEntityNotFound(_0x596535,null))['then'](function(_0x424585){if(_0x424585){return db[_0xc692('0x3f')][_0xc692('0x5a')]({'where':{'id':_0x424585['id']},'include':[{'model':db[_0xc692('0x80')],'as':'List','include':[{'model':db[_0xc692('0x8b')],'as':'Contacts','where':{[_0x424585[_0xc692('0x7d')]]:_0x264514},'limit':0x1,'order':[[_0xc692('0x76'),_0xc692('0x82')]]}]}]})[_0xc692('0x22')](handleEntityNotFound(_0x596535,null))[_0xc692('0x22')](function(_0x6978d4){if(_0x6978d4&&_0x6978d4[_0xc692('0x81')]){_0x184847=_0x6978d4[_0xc692('0x35')]({'plain':!![]});if(_0x184847[_0xc692('0x81')]&&_0x184847[_0xc692('0x81')][_0xc692('0x89')][_0xc692('0x4b')]){return _0x184847['List']['Contacts'][0x0];}return db[_0xc692('0x8b')]['create'](_[_0xc692('0x19')](_0x1fad6b[_0xc692('0x5c')],{'firstName':_0x264514,[_0x6978d4['mapKey']]:_0x264514,'phone':_0x264514,'ListId':_0x184847['ListId']}));}})[_0xc692('0x22')](handleEntityNotFound(_0x596535,null))[_0xc692('0x22')](function(_0x45b2ba){if(_0x45b2ba){_0x5f4a74=_0x45b2ba;return db[_0xc692('0x8e')]['find']({'where':{'ContactId':_0x5f4a74['id'],'closed':![],'OpenchannelAccountId':_0x184847['id']}})[_0xc692('0x22')](function(_0x216309){if(_0x216309){return[_0x216309,![]];}return db[_0xc692('0x8e')]['create']({'UserId':_0x1fad6b[_0xc692('0x5d')]['id'],'ContactId':_0x5f4a74['id'],'OpenchannelAccountId':_0x184847['id'],'lastMsgDirection':_0xc692('0xb4'),'Messages':[_[_0xc692('0x51')](_0x1fad6b[_0xc692('0x5c')],{'read':![],'body':_0x1fad6b[_0xc692('0x5c')][_0xc692('0x5c')],'OpenchannelAccountId':_0x184847['id'],'UserId':_0x1fad6b[_0xc692('0x5d')]['id'],'ContactId':_0x5f4a74['id']})]},{'include':[{'model':db[_0xc692('0xb5')],'as':'Messages'}]})[_0xc692('0x22')](function(_0x54a56a){return[_0x54a56a,!![]];});});}})[_0xc692('0x91')](function(_0x5d01f4,_0x59430a){if(_0x59430a){return _0x5d01f4;}return db['OpenchannelMessage'][_0xc692('0x5b')](_[_0xc692('0x51')](_0x1fad6b[_0xc692('0x5c')],{'read':![],'body':_0x1fad6b['body'][_0xc692('0x5c')],'OpenchannelAccountId':_0x184847['id'],'OpenchannelInteractionId':_0x5d01f4['id'],'UserId':_0x1fad6b[_0xc692('0x5d')]['id'],'ContactId':_0x5f4a74['id']}))[_0xc692('0x22')](function(_0x5df822){_0x5d01f4[_0xc692('0xb6')]['Messages']=[];_0x5d01f4[_0xc692('0xb6')][_0xc692('0xb7')][_0xc692('0x97')](_0x5df822[_0xc692('0xb6')]);return _0x5d01f4;});});}})[_0xc692('0x22')](respondWithResult(_0x596535,null))['catch'](handleError(_0x596535,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 2efa188..c5e8479 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 _0x2547=['hasOwnProperty','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x2defc4,_0x25dbea){var _0x10e80a=function(_0x2c13c1){while(--_0x2c13c1){_0x2defc4['push'](_0x2defc4['shift']());}};_0x10e80a(++_0x25dbea);}(_0x2547,0x1cd));var _0x7254=function(_0x4f4aa2,_0x46c663){_0x4f4aa2=_0x4f4aa2-0x0;var _0x4c1735=_0x2547[_0x4f4aa2];return _0x4c1735;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x7254('0x0'))['db'][_0x7254('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7254('0x2')](0x0);var events={'afterCreate':_0x7254('0x3'),'afterUpdate':_0x7254('0x4'),'afterDestroy':_0x7254('0x5')};function emitEvent(_0x9f3435){return function(_0x265ebf,_0x53a02f,_0x2ddeae){OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435+':'+_0x265ebf['id'],_0x265ebf);OpenchannelAccountEvents[_0x7254('0x6')](_0x9f3435,_0x265ebf);_0x2ddeae(null);};}for(var e in events){if(events[_0x7254('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x7254('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x23092b,_0x13e81e){var _0x307d77=function(_0x3f820a){while(--_0x3f820a){_0x23092b['push'](_0x23092b['shift']());}};_0x307d77(++_0x13e81e);}(_0x13f6,0x124));var _0x613f=function(_0x585950,_0xf4ca1f){_0x585950=_0x585950-0x0;var _0x35c421=_0x13f6[_0x585950];return _0x35c421;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 2fefdd5..20590c7 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2154f9,_0x2bf283){var _0x5f3335=function(_0x5a2e57){while(--_0x5a2e57){_0x2154f9['push'](_0x2154f9['shift']());}};_0x5f3335(++_0x2bf283);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x471289,_0x263668){var _0x210939=function(_0x443a14){while(--_0x443a14){_0x471289['push'](_0x471289['shift']());}};_0x210939(++_0x263668);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 719c933..52d9c52 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 _0xe130=['then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe130,0x127));var _0x0e13=function(_0x1a3a91,_0x4a3315){_0x1a3a91=_0x1a3a91-0x0;var _0x3ab688=_0xe130[_0x1a3a91];return _0x3ab688;};'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});config[_0x0e13('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0e13('0xc'))(new Redis(config[_0x0e13('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2906e9,_0x124e0d,_0x3aad73){return new BPromise(function(_0x2e385d,_0x53f9a9){return client['request'](_0x2906e9,_0x3aad73)[_0x0e13('0xd')](function(_0x37a04e){logger[_0x0e13('0xe')](_0x0e13('0xf'),_0x124e0d,'request\x20sent');logger[_0x0e13('0x10')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x124e0d,_0x0e13('0x11'),JSON[_0x0e13('0x12')](_0x37a04e));if(_0x37a04e[_0x0e13('0x13')]){if(_0x37a04e[_0x0e13('0x13')][_0x0e13('0x14')]===0x1f4){logger[_0x0e13('0x13')](_0x0e13('0xf'),_0x124e0d,_0x37a04e[_0x0e13('0x13')][_0x0e13('0x15')]);return _0x53f9a9(_0x37a04e['error'][_0x0e13('0x15')]);}logger[_0x0e13('0x13')](_0x0e13('0xf'),_0x124e0d,_0x37a04e[_0x0e13('0x13')][_0x0e13('0x15')]);return _0x2e385d(_0x37a04e[_0x0e13('0x13')]['message']);}else{logger[_0x0e13('0xe')](_0x0e13('0xf'),_0x124e0d,'request\x20sent');_0x2e385d(_0x37a04e['result'][_0x0e13('0x15')]);}})['catch'](function(_0x2063ca){logger['error'](_0x0e13('0xf'),_0x124e0d,_0x2063ca);_0x53f9a9(_0x2063ca);});});} \ No newline at end of file +var _0x97c1=['../../config/environment','http','redis','defaults','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});config[_0x197c('0x9')]=_[_0x197c('0xa')](config[_0x197c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x197c('0x9')]));require('./openchannelAccount.socket')[_0x197c('0xb')](socket);function respondWithRpcPromise(_0x3e83e6,_0x853d68,_0x286af5){return new BPromise(function(_0x49cd61,_0x46fb80){return client[_0x197c('0xc')](_0x3e83e6,_0x286af5)[_0x197c('0xd')](function(_0x1c5428){logger[_0x197c('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x853d68,_0x197c('0xf'));logger[_0x197c('0x10')](_0x197c('0x11'),_0x853d68,_0x197c('0xf'),JSON['stringify'](_0x1c5428));if(_0x1c5428[_0x197c('0x12')]){if(_0x1c5428[_0x197c('0x12')][_0x197c('0x13')]===0x1f4){logger[_0x197c('0x12')](_0x197c('0x14'),_0x853d68,_0x1c5428[_0x197c('0x12')]['message']);return _0x46fb80(_0x1c5428['error'][_0x197c('0x15')]);}logger[_0x197c('0x12')](_0x197c('0x14'),_0x853d68,_0x1c5428[_0x197c('0x12')][_0x197c('0x15')]);return _0x49cd61(_0x1c5428[_0x197c('0x12')][_0x197c('0x15')]);}else{logger[_0x197c('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x853d68,_0x197c('0xf'));_0x49cd61(_0x1c5428['result']['message']);}})[_0x197c('0x16')](function(_0x226756){logger[_0x197c('0x12')](_0x197c('0x14'),_0x853d68,_0x226756);_0x46fb80(_0x226756);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index bedf07b..63c7c34 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 _0xb74d=['length','openchannelAccount:','./openchannelAccount.events','remove','emit','removeListener','register'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xb74d,0x16e));var _0xdb74=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0xb74d[_0x21b706];return _0x13b94a;};'use strict';var OpenchannelAccountEvents=require(_0xdb74('0x0'));var events=['save',_0xdb74('0x1'),'update'];function createListener(_0x3f540e,_0x5700f0){return function(_0x1ba155){_0x5700f0[_0xdb74('0x2')](_0x3f540e,_0x1ba155);};}function removeListener(_0x61bd15,_0x4b3b06){return function(){OpenchannelAccountEvents[_0xdb74('0x3')](_0x61bd15,_0x4b3b06);};}exports[_0xdb74('0x4')]=function(_0xd2d2f0){for(var _0x4dbe91=0x0,_0x5183ae=events[_0xdb74('0x5')];_0x4dbe91<_0x5183ae;_0x4dbe91++){var _0x4bf15e=events[_0x4dbe91];var _0x3e44b7=createListener(_0xdb74('0x6')+_0x4bf15e,_0xd2d2f0);OpenchannelAccountEvents['on'](_0x4bf15e,_0x3e44b7);}}; \ No newline at end of file +var _0x9f62=['save','update','removeListener','register','length'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0x9f62,0x154));var _0x29f6=function(_0x5d8284,_0x26db89){_0x5d8284=_0x5d8284-0x0;var _0x2afddc=_0x9f62[_0x5d8284];return _0x2afddc;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x29f6('0x0'),'remove',_0x29f6('0x1')];function createListener(_0x254ab3,_0x548050){return function(_0x5618b7){_0x548050['emit'](_0x254ab3,_0x5618b7);};}function removeListener(_0x258ddd,_0x2f0420){return function(){OpenchannelAccountEvents[_0x29f6('0x2')](_0x258ddd,_0x2f0420);};}exports[_0x29f6('0x3')]=function(_0x595034){for(var _0xf66137=0x0,_0x272876=events[_0x29f6('0x4')];_0xf66137<_0x272876;_0xf66137++){var _0x2ba602=events[_0xf66137];var _0x416c6c=createListener('openchannelAccount:'+_0x2ba602,_0x595034);OpenchannelAccountEvents['on'](_0x2ba602,_0x416c6c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 35f1961..540c8d8 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 _0xe66b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','update','exports','multer','path','connect-timeout','express'];(function(_0x288bd8,_0xfe0c9a){var _0x31dea6=function(_0x57bb9c){while(--_0x57bb9c){_0x288bd8['push'](_0x288bd8['shift']());}};_0x31dea6(++_0xfe0c9a);}(_0xe66b,0x137));var _0xbe66=function(_0x48d3e6,_0x38d7f5){_0x48d3e6=_0x48d3e6-0x0;var _0x197959=_0xe66b[_0x48d3e6];return _0x197959;};'use strict';var multer=require(_0xbe66('0x0'));var util=require('util');var path=require(_0xbe66('0x1'));var timeout=require(_0xbe66('0x2'));var express=require(_0xbe66('0x3'));var router=express[_0xbe66('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbe66('0x5'));var interaction=require(_0xbe66('0x6'));var config=require(_0xbe66('0x7'));var controller=require('./openchannelApplication.controller');router[_0xbe66('0x8')]('/',auth[_0xbe66('0x9')](),controller[_0xbe66('0xa')]);router['get'](_0xbe66('0xb'),auth[_0xbe66('0x9')](),controller['show']);router[_0xbe66('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbe66('0xb'),auth[_0xbe66('0x9')](),controller[_0xbe66('0xd')]);router['delete'](_0xbe66('0xb'),auth[_0xbe66('0x9')](),controller['destroy']);module[_0xbe66('0xe')]=router; \ No newline at end of file +var _0x60a1=['show','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x3efcd5,_0x9bbba3){var _0x54e50a=function(_0x34d7f4){while(--_0x34d7f4){_0x3efcd5['push'](_0x3efcd5['shift']());}};_0x54e50a(++_0x9bbba3);}(_0x60a1,0x1ac));var _0x160a=function(_0x5e86fe,_0x302f50){_0x5e86fe=_0x5e86fe-0x0;var _0x50ce69=_0x60a1[_0x5e86fe];return _0x50ce69;};'use strict';var multer=require(_0x160a('0x0'));var util=require(_0x160a('0x1'));var path=require(_0x160a('0x2'));var timeout=require(_0x160a('0x3'));var express=require('express');var router=express[_0x160a('0x4')]();var fs_extra=require(_0x160a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x160a('0x6'));var config=require(_0x160a('0x7'));var controller=require(_0x160a('0x8'));router[_0x160a('0x9')]('/',auth[_0x160a('0xa')](),controller[_0x160a('0xb')]);router[_0x160a('0x9')]('/:id',auth[_0x160a('0xa')](),controller[_0x160a('0xc')]);router['post']('/',auth[_0x160a('0xa')](),controller[_0x160a('0xd')]);router[_0x160a('0xe')]('/:id',auth[_0x160a('0xa')](),controller[_0x160a('0xf')]);router[_0x160a('0x10')](_0x160a('0x11'),auth[_0x160a('0xa')](),controller[_0x160a('0x12')]);module[_0x160a('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 fc4ac47..2eb5e53 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 _0xcb25=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x19ba5f,_0x514264){var _0x5b9fa6=function(_0x52a4a2){while(--_0x52a4a2){_0x19ba5f['push'](_0x19ba5f['shift']());}};_0x5b9fa6(++_0x514264);}(_0xcb25,0x1ec));var _0x5cb2=function(_0x357702,_0x203968){_0x357702=_0x357702-0x0;var _0x4dd94a=_0xcb25[_0x357702];return _0x4dd94a;};'use strict';var Sequelize=require(_0x5cb2('0x0'));module[_0x5cb2('0x1')]={'priority':{'type':Sequelize[_0x5cb2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5cb2('0x3')],'allowNull':![],'defaultValue':_0x5cb2('0x4')},'appdata':{'type':Sequelize[_0x5cb2('0x5')]()},'description':{'type':Sequelize[_0x5cb2('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5cb2('0x6')}}; \ No newline at end of file +var _0x02b6=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x24a9ed,_0x5ed83e){var _0x1f1390=function(_0x2f4945){while(--_0x2f4945){_0x24a9ed['push'](_0x24a9ed['shift']());}};_0x1f1390(++_0x5ed83e);}(_0x02b6,0xa3));var _0x602b=function(_0x5681fb,_0x3baf28){_0x5681fb=_0x5681fb-0x0;var _0x3d1f31=_0x02b6[_0x5681fb];return _0x3d1f31;};'use strict';var Sequelize=require(_0x602b('0x0'));module[_0x602b('0x1')]={'priority':{'type':Sequelize[_0x602b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x602b('0x3')},'appdata':{'type':Sequelize[_0x602b('0x4')]()},'description':{'type':Sequelize[_0x602b('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x602b('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 01465ce..a2ceb53 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 _0xd98b=['stack','name','send','index','map','OpenchannelApplication','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','then','destroy','end','error'];(function(_0x43d8ff,_0xdddbb9){var _0x178e50=function(_0x17bd70){while(--_0x17bd70){_0x43d8ff['push'](_0x43d8ff['shift']());}};_0x178e50(++_0xdddbb9);}(_0xd98b,0x10f));var _0xbd98=function(_0x96a34a,_0x48b3c6){_0x96a34a=_0x96a34a-0x0;var _0x4e325e=_0xd98b[_0x96a34a];return _0x4e325e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd98('0x0'));var zipdir=require(_0xbd98('0x1'));var jsonpatch=require(_0xbd98('0x2'));var rp=require(_0xbd98('0x3'));var moment=require(_0xbd98('0x4'));var BPromise=require(_0xbd98('0x5'));var Mustache=require(_0xbd98('0x6'));var util=require(_0xbd98('0x7'));var path=require(_0xbd98('0x8'));var sox=require(_0xbd98('0x9'));var csv=require(_0xbd98('0xa'));var ejs=require(_0xbd98('0xb'));var fs=require('fs');var fs_extra=require(_0xbd98('0xc'));var _=require(_0xbd98('0xd'));var squel=require(_0xbd98('0xe'));var crypto=require(_0xbd98('0xf'));var jsforce=require(_0xbd98('0x10'));var deskjs=require(_0xbd98('0x11'));var toCsv=require(_0xbd98('0xa'));var querystring=require(_0xbd98('0x12'));var Papa=require(_0xbd98('0x13'));var Redis=require('ioredis');var authService=require(_0xbd98('0x14'));var qs=require(_0xbd98('0x15'));var as=require(_0xbd98('0x16'));var hardwareService=require(_0xbd98('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbd98('0x18'));var licenseUtil=require(_0xbd98('0x19'));var db=require(_0xbd98('0x1a'))['db'];function respondWithStatusCode(_0x16980b,_0x2c9a70){_0x2c9a70=_0x2c9a70||0xcc;return function(_0x51ceb2){if(_0x51ceb2){return _0x16980b[_0xbd98('0x1b')](_0x2c9a70);}return _0x16980b[_0xbd98('0x1c')](_0x2c9a70)['end']();};}function respondWithResult(_0x4401c2,_0xc0c1bb){_0xc0c1bb=_0xc0c1bb||0xc8;return function(_0x490340){if(_0x490340){return _0x4401c2[_0xbd98('0x1c')](_0xc0c1bb)['json'](_0x490340);}};}function respondWithFilteredResult(_0x19f5cd,_0x3328e2){return function(_0x333b4f){if(_0x333b4f){var _0xf6f6cf=typeof _0x3328e2[_0xbd98('0x1d')]===_0xbd98('0x1e')&&typeof _0x3328e2['limit']===_0xbd98('0x1e');var _0x476753=_0x333b4f[_0xbd98('0x1f')];var _0x244255=_0xf6f6cf?0x0:_0x3328e2[_0xbd98('0x1d')];var _0x4f7270=_0xf6f6cf?_0x333b4f[_0xbd98('0x1f')]:_0x3328e2[_0xbd98('0x1d')]+_0x3328e2['limit'];var _0x285ea3;if(_0x4f7270>=_0x476753){_0x4f7270=_0x476753;_0x285ea3=0xc8;}else{_0x285ea3=0xce;}_0x19f5cd[_0xbd98('0x1c')](_0x285ea3);return _0x19f5cd[_0xbd98('0x20')](_0xbd98('0x21'),_0x244255+'-'+_0x4f7270+'/'+_0x476753)[_0xbd98('0x22')](_0x333b4f);}return null;};}function patchUpdates(_0x587fde){return function(_0x5ac059){try{jsonpatch[_0xbd98('0x23')](_0x5ac059,_0x587fde,!![]);}catch(_0x189174){return BPromise[_0xbd98('0x24')](_0x189174);}return _0x5ac059['save']();};}function saveUpdates(_0x4e4def,_0x39b051){return function(_0x5622f7){if(_0x5622f7){return _0x5622f7['update'](_0x4e4def)[_0xbd98('0x25')](function(_0x19296a){return _0x19296a;});}return null;};}function removeEntity(_0x2d8dba,_0x57346c){return function(_0x4dd08f){if(_0x4dd08f){return _0x4dd08f[_0xbd98('0x26')]()[_0xbd98('0x25')](function(){_0x2d8dba['status'](0xcc)[_0xbd98('0x27')]();});}};}function handleEntityNotFound(_0x27ba1f,_0x21b3ce){return function(_0x3b2ef0){if(!_0x3b2ef0){_0x27ba1f[_0xbd98('0x1b')](0x194);}return _0x3b2ef0;};}function handleError(_0x2ffba2,_0x265cd2){_0x265cd2=_0x265cd2||0x1f4;return function(_0xdbea1d){logger[_0xbd98('0x28')](_0xdbea1d[_0xbd98('0x29')]);if(_0xdbea1d['name']){delete _0xdbea1d[_0xbd98('0x2a')];}_0x2ffba2[_0xbd98('0x1c')](_0x265cd2)[_0xbd98('0x2b')](_0xdbea1d);};}exports[_0xbd98('0x2c')]=function(_0x1f85fc,_0x5526e8){var _0x18839b={},_0x249621={},_0x139d1f={'count':0x0,'rows':[]};var _0x2999e1=_[_0xbd98('0x2d')](db[_0xbd98('0x2e')]['rawAttributes'],function(_0x2631a8){return{'name':_0x2631a8[_0xbd98('0x2f')],'type':_0x2631a8['type'][_0xbd98('0x30')]};});_0x249621['model']=_[_0xbd98('0x2d')](_0x2999e1,_0xbd98('0x2a'));_0x249621[_0xbd98('0x31')]=_[_0xbd98('0x32')](_0x1f85fc[_0xbd98('0x31')]);_0x249621[_0xbd98('0x33')]=_[_0xbd98('0x34')](_0x249621[_0xbd98('0x35')],_0x249621[_0xbd98('0x31')]);_0x18839b[_0xbd98('0x36')]=_[_0xbd98('0x34')](_0x249621[_0xbd98('0x35')],qs['fields'](_0x1f85fc[_0xbd98('0x31')][_0xbd98('0x37')]));_0x18839b[_0xbd98('0x36')]=_0x18839b['attributes'][_0xbd98('0x38')]?_0x18839b[_0xbd98('0x36')]:_0x249621['model'];if(!_0x1f85fc[_0xbd98('0x31')][_0xbd98('0x39')](_0xbd98('0x3a'))){_0x18839b[_0xbd98('0x3b')]=qs[_0xbd98('0x3b')](_0x1f85fc[_0xbd98('0x31')]['limit']);_0x18839b[_0xbd98('0x1d')]=qs[_0xbd98('0x1d')](_0x1f85fc[_0xbd98('0x31')][_0xbd98('0x1d')]);}_0x18839b[_0xbd98('0x3c')]=qs[_0xbd98('0x3d')](_0x1f85fc[_0xbd98('0x31')][_0xbd98('0x3d')]);_0x18839b[_0xbd98('0x3e')]=qs[_0xbd98('0x33')](_[_0xbd98('0x3f')](_0x1f85fc[_0xbd98('0x31')],_0x249621[_0xbd98('0x33')]),_0x2999e1);if(_0x1f85fc['query'][_0xbd98('0x40')]){_0x18839b[_0xbd98('0x3e')]=_['merge'](_0x18839b[_0xbd98('0x3e')],{'$or':_[_0xbd98('0x2d')](_0x2999e1,function(_0x42ab7e){if(_0x42ab7e[_0xbd98('0x41')]!==_0xbd98('0x42')){var _0x3bd9f6={};_0x3bd9f6[_0x42ab7e[_0xbd98('0x2a')]]={'$like':'%'+_0x1f85fc[_0xbd98('0x31')][_0xbd98('0x40')]+'%'};return _0x3bd9f6;}})});}_0x18839b=_[_0xbd98('0x43')]({},_0x18839b,_0x1f85fc['options']);var _0x508765={'where':_0x18839b[_0xbd98('0x3e')]};return db[_0xbd98('0x2e')]['count'](_0x508765)[_0xbd98('0x25')](function(_0x49d8ba){_0x139d1f[_0xbd98('0x1f')]=_0x49d8ba;if(_0x1f85fc[_0xbd98('0x31')][_0xbd98('0x44')]){_0x18839b[_0xbd98('0x45')]=[{'all':!![]}];}return db[_0xbd98('0x2e')][_0xbd98('0x46')](_0x18839b);})[_0xbd98('0x25')](function(_0x549371){_0x139d1f['rows']=_0x549371;return _0x139d1f;})[_0xbd98('0x25')](respondWithFilteredResult(_0x5526e8,_0x18839b))[_0xbd98('0x47')](handleError(_0x5526e8,null));};exports['show']=function(_0x48fe25,_0x2d77f5){var _0x4f3f68={'raw':!![],'where':{'id':_0x48fe25[_0xbd98('0x48')]['id']}},_0x31badc={};_0x31badc['model']=_['keys'](db[_0xbd98('0x2e')][_0xbd98('0x49')]);_0x31badc[_0xbd98('0x31')]=_[_0xbd98('0x32')](_0x48fe25['query']);_0x31badc[_0xbd98('0x33')]=_['intersection'](_0x31badc[_0xbd98('0x35')],_0x31badc['query']);_0x4f3f68[_0xbd98('0x36')]=_['intersection'](_0x31badc[_0xbd98('0x35')],qs[_0xbd98('0x37')](_0x48fe25[_0xbd98('0x31')][_0xbd98('0x37')]));_0x4f3f68[_0xbd98('0x36')]=_0x4f3f68[_0xbd98('0x36')][_0xbd98('0x38')]?_0x4f3f68[_0xbd98('0x36')]:_0x31badc[_0xbd98('0x35')];if(_0x48fe25[_0xbd98('0x31')][_0xbd98('0x44')]){_0x4f3f68[_0xbd98('0x45')]=[{'all':!![]}];}_0x4f3f68=_['merge']({},_0x4f3f68,_0x48fe25['options']);return db[_0xbd98('0x2e')][_0xbd98('0x4a')](_0x4f3f68)['then'](handleEntityNotFound(_0x2d77f5,null))[_0xbd98('0x25')](respondWithResult(_0x2d77f5,null))[_0xbd98('0x47')](handleError(_0x2d77f5,null));};exports[_0xbd98('0x4b')]=function(_0x4741a1,_0x42a23e){return db[_0xbd98('0x2e')]['create'](_0x4741a1[_0xbd98('0x4c')],{})[_0xbd98('0x25')](respondWithResult(_0x42a23e,0xc9))['catch'](handleError(_0x42a23e,null));};exports[_0xbd98('0x4d')]=function(_0x4e6ad1,_0x5783c2){if(_0x4e6ad1[_0xbd98('0x4c')]['id']){delete _0x4e6ad1[_0xbd98('0x4c')]['id'];}return db[_0xbd98('0x2e')]['find']({'where':{'id':_0x4e6ad1[_0xbd98('0x48')]['id']}})[_0xbd98('0x25')](handleEntityNotFound(_0x5783c2,null))['then'](saveUpdates(_0x4e6ad1[_0xbd98('0x4c')],null))[_0xbd98('0x25')](respondWithResult(_0x5783c2,null))[_0xbd98('0x47')](handleError(_0x5783c2,null));};exports[_0xbd98('0x26')]=function(_0x5c81ea,_0xe05bd0){return db[_0xbd98('0x2e')][_0xbd98('0x4a')]({'where':{'id':_0x5c81ea['params']['id']}})[_0xbd98('0x25')](handleEntityNotFound(_0xe05bd0,null))[_0xbd98('0x25')](removeEntity(_0xe05bd0,null))[_0xbd98('0x47')](handleError(_0xe05bd0,null));}; \ No newline at end of file +var _0x960d=['../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','update','then','destroy','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util'];(function(_0x239473,_0x4f5af6){var _0x26b6a7=function(_0x5b1f87){while(--_0x5b1f87){_0x239473['push'](_0x239473['shift']());}};_0x26b6a7(++_0x4f5af6);}(_0x960d,0x1e2));var _0xd960=function(_0x35f7b4,_0x2481bc){_0x35f7b4=_0x35f7b4-0x0;var _0x242e40=_0x960d[_0x35f7b4];return _0x242e40;};'use strict';var emlformat=require(_0xd960('0x0'));var rimraf=require(_0xd960('0x1'));var zipdir=require(_0xd960('0x2'));var jsonpatch=require(_0xd960('0x3'));var rp=require('request-promise');var moment=require(_0xd960('0x4'));var BPromise=require(_0xd960('0x5'));var Mustache=require('mustache');var util=require(_0xd960('0x6'));var path=require(_0xd960('0x7'));var sox=require(_0xd960('0x8'));var csv=require(_0xd960('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd960('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd960('0xb'));var jsforce=require(_0xd960('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd960('0x9'));var querystring=require(_0xd960('0xd'));var Papa=require(_0xd960('0xe'));var Redis=require(_0xd960('0xf'));var authService=require(_0xd960('0x10'));var qs=require(_0xd960('0x11'));var as=require(_0xd960('0x12'));var hardwareService=require(_0xd960('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd960('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd960('0x15'));var db=require(_0xd960('0x16'))['db'];function respondWithStatusCode(_0x5e6c7d,_0x457a8e){_0x457a8e=_0x457a8e||0xcc;return function(_0x15d960){if(_0x15d960){return _0x5e6c7d[_0xd960('0x17')](_0x457a8e);}return _0x5e6c7d['status'](_0x457a8e)[_0xd960('0x18')]();};}function respondWithResult(_0xfdb2ff,_0x3f571d){_0x3f571d=_0x3f571d||0xc8;return function(_0x109db4){if(_0x109db4){return _0xfdb2ff[_0xd960('0x19')](_0x3f571d)[_0xd960('0x1a')](_0x109db4);}};}function respondWithFilteredResult(_0x2f6e65,_0x57937f){return function(_0x9c06cc){if(_0x9c06cc){var _0x1f924d=typeof _0x57937f['offset']===_0xd960('0x1b')&&typeof _0x57937f[_0xd960('0x1c')]==='undefined';var _0x8ec3ad=_0x9c06cc[_0xd960('0x1d')];var _0x561c4f=_0x1f924d?0x0:_0x57937f[_0xd960('0x1e')];var _0x2720bd=_0x1f924d?_0x9c06cc[_0xd960('0x1d')]:_0x57937f['offset']+_0x57937f[_0xd960('0x1c')];var _0x343193;if(_0x2720bd>=_0x8ec3ad){_0x2720bd=_0x8ec3ad;_0x343193=0xc8;}else{_0x343193=0xce;}_0x2f6e65[_0xd960('0x19')](_0x343193);return _0x2f6e65[_0xd960('0x1f')]('Content-Range',_0x561c4f+'-'+_0x2720bd+'/'+_0x8ec3ad)[_0xd960('0x1a')](_0x9c06cc);}return null;};}function patchUpdates(_0x377e8f){return function(_0x1a1b8f){try{jsonpatch[_0xd960('0x20')](_0x1a1b8f,_0x377e8f,!![]);}catch(_0x3dba3a){return BPromise['reject'](_0x3dba3a);}return _0x1a1b8f['save']();};}function saveUpdates(_0x19a5b3,_0x575117){return function(_0xd6f02e){if(_0xd6f02e){return _0xd6f02e[_0xd960('0x21')](_0x19a5b3)[_0xd960('0x22')](function(_0x17cb28){return _0x17cb28;});}return null;};}function removeEntity(_0x21e754,_0x1e3ad0){return function(_0x3800a2){if(_0x3800a2){return _0x3800a2[_0xd960('0x23')]()[_0xd960('0x22')](function(){_0x21e754[_0xd960('0x19')](0xcc)[_0xd960('0x18')]();});}};}function handleEntityNotFound(_0x2f4265,_0x134427){return function(_0x33a9b7){if(!_0x33a9b7){_0x2f4265[_0xd960('0x17')](0x194);}return _0x33a9b7;};}function handleError(_0x3fe60c,_0x2d0c4b){_0x2d0c4b=_0x2d0c4b||0x1f4;return function(_0x2b6def){logger[_0xd960('0x24')](_0x2b6def['stack']);if(_0x2b6def[_0xd960('0x25')]){delete _0x2b6def[_0xd960('0x25')];}_0x3fe60c[_0xd960('0x19')](_0x2d0c4b)[_0xd960('0x26')](_0x2b6def);};}exports[_0xd960('0x27')]=function(_0x1ee642,_0x466b2a){var _0x42d7bf={},_0xabd164={},_0x9addd0={'count':0x0,'rows':[]};var _0x2a3e46=_[_0xd960('0x28')](db[_0xd960('0x29')][_0xd960('0x2a')],function(_0x4f7247){return{'name':_0x4f7247[_0xd960('0x2b')],'type':_0x4f7247['type']['key']};});_0xabd164[_0xd960('0x2c')]=_[_0xd960('0x28')](_0x2a3e46,_0xd960('0x25'));_0xabd164[_0xd960('0x2d')]=_[_0xd960('0x2e')](_0x1ee642[_0xd960('0x2d')]);_0xabd164[_0xd960('0x2f')]=_[_0xd960('0x30')](_0xabd164[_0xd960('0x2c')],_0xabd164[_0xd960('0x2d')]);_0x42d7bf[_0xd960('0x31')]=_[_0xd960('0x30')](_0xabd164[_0xd960('0x2c')],qs['fields'](_0x1ee642['query']['fields']));_0x42d7bf[_0xd960('0x31')]=_0x42d7bf[_0xd960('0x31')][_0xd960('0x32')]?_0x42d7bf['attributes']:_0xabd164[_0xd960('0x2c')];if(!_0x1ee642['query'][_0xd960('0x33')](_0xd960('0x34'))){_0x42d7bf[_0xd960('0x1c')]=qs['limit'](_0x1ee642[_0xd960('0x2d')][_0xd960('0x1c')]);_0x42d7bf['offset']=qs[_0xd960('0x1e')](_0x1ee642['query'][_0xd960('0x1e')]);}_0x42d7bf[_0xd960('0x35')]=qs[_0xd960('0x36')](_0x1ee642[_0xd960('0x2d')][_0xd960('0x36')]);_0x42d7bf[_0xd960('0x37')]=qs[_0xd960('0x2f')](_[_0xd960('0x38')](_0x1ee642[_0xd960('0x2d')],_0xabd164[_0xd960('0x2f')]),_0x2a3e46);if(_0x1ee642['query'][_0xd960('0x39')]){_0x42d7bf[_0xd960('0x37')]=_[_0xd960('0x3a')](_0x42d7bf[_0xd960('0x37')],{'$or':_['map'](_0x2a3e46,function(_0x56bee4){if(_0x56bee4['type']!==_0xd960('0x3b')){var _0x20a007={};_0x20a007[_0x56bee4[_0xd960('0x25')]]={'$like':'%'+_0x1ee642['query']['filter']+'%'};return _0x20a007;}})});}_0x42d7bf=_['merge']({},_0x42d7bf,_0x1ee642['options']);var _0x38cd1b={'where':_0x42d7bf[_0xd960('0x37')]};return db[_0xd960('0x29')]['count'](_0x38cd1b)[_0xd960('0x22')](function(_0x14490d){_0x9addd0[_0xd960('0x1d')]=_0x14490d;if(_0x1ee642[_0xd960('0x2d')][_0xd960('0x3c')]){_0x42d7bf[_0xd960('0x3d')]=[{'all':!![]}];}return db[_0xd960('0x29')][_0xd960('0x3e')](_0x42d7bf);})[_0xd960('0x22')](function(_0x2f6b77){_0x9addd0[_0xd960('0x3f')]=_0x2f6b77;return _0x9addd0;})[_0xd960('0x22')](respondWithFilteredResult(_0x466b2a,_0x42d7bf))[_0xd960('0x40')](handleError(_0x466b2a,null));};exports[_0xd960('0x41')]=function(_0x55428f,_0x2b0e9a){var _0x3b172b={'raw':!![],'where':{'id':_0x55428f[_0xd960('0x42')]['id']}},_0x308cb6={};_0x308cb6['model']=_[_0xd960('0x2e')](db[_0xd960('0x29')][_0xd960('0x2a')]);_0x308cb6['query']=_[_0xd960('0x2e')](_0x55428f[_0xd960('0x2d')]);_0x308cb6[_0xd960('0x2f')]=_['intersection'](_0x308cb6[_0xd960('0x2c')],_0x308cb6[_0xd960('0x2d')]);_0x3b172b['attributes']=_[_0xd960('0x30')](_0x308cb6[_0xd960('0x2c')],qs[_0xd960('0x43')](_0x55428f['query'][_0xd960('0x43')]));_0x3b172b[_0xd960('0x31')]=_0x3b172b[_0xd960('0x31')][_0xd960('0x32')]?_0x3b172b[_0xd960('0x31')]:_0x308cb6['model'];if(_0x55428f[_0xd960('0x2d')][_0xd960('0x3c')]){_0x3b172b[_0xd960('0x3d')]=[{'all':!![]}];}_0x3b172b=_['merge']({},_0x3b172b,_0x55428f[_0xd960('0x44')]);return db[_0xd960('0x29')][_0xd960('0x45')](_0x3b172b)[_0xd960('0x22')](handleEntityNotFound(_0x2b0e9a,null))[_0xd960('0x22')](respondWithResult(_0x2b0e9a,null))[_0xd960('0x40')](handleError(_0x2b0e9a,null));};exports[_0xd960('0x46')]=function(_0x5ee3a1,_0x4172b5){return db['OpenchannelApplication'][_0xd960('0x46')](_0x5ee3a1[_0xd960('0x47')],{})[_0xd960('0x22')](respondWithResult(_0x4172b5,0xc9))[_0xd960('0x40')](handleError(_0x4172b5,null));};exports[_0xd960('0x21')]=function(_0x2e6bcd,_0x51fa35){if(_0x2e6bcd[_0xd960('0x47')]['id']){delete _0x2e6bcd[_0xd960('0x47')]['id'];}return db[_0xd960('0x29')][_0xd960('0x45')]({'where':{'id':_0x2e6bcd['params']['id']}})[_0xd960('0x22')](handleEntityNotFound(_0x51fa35,null))[_0xd960('0x22')](saveUpdates(_0x2e6bcd[_0xd960('0x47')],null))['then'](respondWithResult(_0x51fa35,null))[_0xd960('0x40')](handleError(_0x51fa35,null));};exports['destroy']=function(_0x36c436,_0x234fc3){return db[_0xd960('0x29')][_0xd960('0x45')]({'where':{'id':_0x36c436[_0xd960('0x42')]['id']}})['then'](handleEntityNotFound(_0x234fc3,null))[_0xd960('0x22')](removeEntity(_0x234fc3,null))[_0xd960('0x40')](handleError(_0x234fc3,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b1705ac..3af1b47 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 _0x839f=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports'];(function(_0x51308b,_0xa423a9){var _0x3f23c2=function(_0x580b97){while(--_0x580b97){_0x51308b['push'](_0x51308b['shift']());}};_0x3f23c2(++_0xa423a9);}(_0x839f,0xf1));var _0xf839=function(_0x3f5166,_0x1f2652){_0x3f5166=_0x3f5166-0x0;var _0x37557f=_0x839f[_0x3f5166];return _0x37557f;};'use strict';var _=require(_0xf839('0x0'));var util=require(_0xf839('0x1'));var logger=require(_0xf839('0x2'))('api');var moment=require(_0xf839('0x3'));var BPromise=require(_0xf839('0x4'));var rp=require(_0xf839('0x5'));var fs=require('fs');var path=require(_0xf839('0x6'));var rimraf=require(_0xf839('0x7'));var config=require(_0xf839('0x8'));var attributes=require(_0xf839('0x9'));module[_0xf839('0xa')]=function(_0x1a8be6,_0x1c4920){return _0x1a8be6[_0xf839('0xb')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf839('0xc'),'collate':_0xf839('0xd')});}; \ No newline at end of file +var _0xd60d=['moment','request-promise','rimraf','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','api'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0xd60d,0x17e));var _0xdd60=function(_0x264f2e,_0x619b7d){_0x264f2e=_0x264f2e-0x0;var _0x316d36=_0xd60d[_0x264f2e];return _0x316d36;};'use strict';var _=require('lodash');var util=require(_0xdd60('0x0'));var logger=require(_0xdd60('0x1'))(_0xdd60('0x2'));var moment=require(_0xdd60('0x3'));var BPromise=require('bluebird');var rp=require(_0xdd60('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd60('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd60('0x6'));module['exports']=function(_0xae8a62,_0x20a7dc){return _0xae8a62[_0xdd60('0x7')](_0xdd60('0x8'),attributes,{'tableName':_0xdd60('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd60('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 3945c19..a1c8fa1 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 _0x283e=['OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','update','body','options','raw','where','limit','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x283e,0xda));var _0xe283=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x283e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe283('0x0'));var util=require('util');var moment=require(_0xe283('0x1'));var BPromise=require('bluebird');var rs=require(_0xe283('0x2'));var fs=require('fs');var Redis=require(_0xe283('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe283('0x4'))(_0xe283('0x5'));var config=require(_0xe283('0x6'));var jayson=require(_0xe283('0x7'));var client=jayson[_0xe283('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e6270,_0x4c0eca,_0x5da112){return new BPromise(function(_0xaff6,_0x1dbdc6){return client[_0xe283('0x9')](_0x2e6270,_0x5da112)[_0xe283('0xa')](function(_0x2b78f0){logger[_0xe283('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x4c0eca,_0xe283('0xc'));logger[_0xe283('0xd')](_0xe283('0xe'),_0x4c0eca,_0xe283('0xc'),JSON[_0xe283('0xf')](_0x2b78f0));if(_0x2b78f0[_0xe283('0x10')]){if(_0x2b78f0[_0xe283('0x10')][_0xe283('0x11')]===0x1f4){logger[_0xe283('0x10')](_0xe283('0x12'),_0x4c0eca,_0x2b78f0[_0xe283('0x10')][_0xe283('0x13')]);return _0x1dbdc6(_0x2b78f0[_0xe283('0x10')]['message']);}logger['error'](_0xe283('0x12'),_0x4c0eca,_0x2b78f0[_0xe283('0x10')][_0xe283('0x13')]);return _0xaff6(_0x2b78f0[_0xe283('0x10')][_0xe283('0x13')]);}else{logger[_0xe283('0xb')](_0xe283('0x12'),_0x4c0eca,_0xe283('0xc'));_0xaff6(_0x2b78f0[_0xe283('0x14')][_0xe283('0x13')]);}})[_0xe283('0x15')](function(_0x3c03cf){logger[_0xe283('0x10')](_0xe283('0x12'),_0x4c0eca,_0x3c03cf);_0x1dbdc6(_0x3c03cf);});});}exports[_0xe283('0x16')]=function(_0x53d7d9){var _0x2dbbdb=this;return new Promise(function(_0x2af371,_0x64510e){return db['OpenchannelApplication'][_0xe283('0x17')](_0x53d7d9[_0xe283('0x18')],{'raw':_0x53d7d9[_0xe283('0x19')]?_0x53d7d9[_0xe283('0x19')][_0xe283('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53d7d9['options']?_0x53d7d9[_0xe283('0x19')][_0xe283('0x1b')]||null:null,'attributes':_0x53d7d9[_0xe283('0x19')]?_0x53d7d9[_0xe283('0x19')]['attributes']||null:null,'limit':_0x53d7d9['options']?_0x53d7d9[_0xe283('0x19')][_0xe283('0x1c')]||null:null})['then'](function(_0x4b3824){logger[_0xe283('0xb')](_0xe283('0x16'),_0x53d7d9);logger[_0xe283('0xd')]('UpdateOpenchannelApplication',_0x53d7d9,JSON['stringify'](_0x4b3824));_0x2af371(_0x4b3824);})['catch'](function(_0x23886c){logger[_0xe283('0x10')](_0xe283('0x16'),_0x23886c[_0xe283('0x13')],_0x53d7d9);_0x64510e(_0x2dbbdb[_0xe283('0x10')](0x1f4,_0x23886c[_0xe283('0x13')]));});});}; \ No newline at end of file +var _0x8426=['update','body','options','raw','attributes','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x4523b3,_0x4cf522){var _0x63f922=function(_0x2ffd44){while(--_0x2ffd44){_0x4523b3['push'](_0x4523b3['shift']());}};_0x63f922(++_0x4cf522);}(_0x8426,0x114));var _0x6842=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8426[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x6842('0x0'));var moment=require(_0x6842('0x1'));var BPromise=require(_0x6842('0x2'));var rs=require(_0x6842('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6842('0x4'));var logger=require(_0x6842('0x5'))(_0x6842('0x6'));var config=require(_0x6842('0x7'));var jayson=require(_0x6842('0x8'));var client=jayson[_0x6842('0x9')][_0x6842('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cd01f,_0x18604c,_0x239072){return new BPromise(function(_0x27e392,_0x53c683){return client['request'](_0x4cd01f,_0x239072)[_0x6842('0xb')](function(_0x17d8e8){logger[_0x6842('0xc')](_0x6842('0xd'),_0x18604c,_0x6842('0xe'));logger[_0x6842('0xf')](_0x6842('0x10'),_0x18604c,'request\x20sent',JSON[_0x6842('0x11')](_0x17d8e8));if(_0x17d8e8[_0x6842('0x12')]){if(_0x17d8e8[_0x6842('0x12')][_0x6842('0x13')]===0x1f4){logger[_0x6842('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x18604c,_0x17d8e8[_0x6842('0x12')][_0x6842('0x14')]);return _0x53c683(_0x17d8e8['error'][_0x6842('0x14')]);}logger[_0x6842('0x12')](_0x6842('0xd'),_0x18604c,_0x17d8e8['error'][_0x6842('0x14')]);return _0x27e392(_0x17d8e8[_0x6842('0x12')][_0x6842('0x14')]);}else{logger['info'](_0x6842('0xd'),_0x18604c,_0x6842('0xe'));_0x27e392(_0x17d8e8[_0x6842('0x15')][_0x6842('0x14')]);}})['catch'](function(_0x38141d){logger[_0x6842('0x12')](_0x6842('0xd'),_0x18604c,_0x38141d);_0x53c683(_0x38141d);});});}exports[_0x6842('0x16')]=function(_0x526fa5){var _0x4106c2=this;return new Promise(function(_0x581472,_0x456e35){return db[_0x6842('0x17')][_0x6842('0x18')](_0x526fa5[_0x6842('0x19')],{'raw':_0x526fa5[_0x6842('0x1a')]?_0x526fa5[_0x6842('0x1a')][_0x6842('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x526fa5[_0x6842('0x1a')]?_0x526fa5[_0x6842('0x1a')]['where']||null:null,'attributes':_0x526fa5[_0x6842('0x1a')]?_0x526fa5[_0x6842('0x1a')][_0x6842('0x1c')]||null:null,'limit':_0x526fa5[_0x6842('0x1a')]?_0x526fa5[_0x6842('0x1a')]['limit']||null:null})[_0x6842('0xb')](function(_0x442ad8){logger[_0x6842('0xc')]('UpdateOpenchannelApplication',_0x526fa5);logger['debug'](_0x6842('0x16'),_0x526fa5,JSON[_0x6842('0x11')](_0x442ad8));_0x581472(_0x442ad8);})[_0x6842('0x1d')](function(_0x4f313e){logger[_0x6842('0x12')](_0x6842('0x16'),_0x4f313e[_0x6842('0x14')],_0x526fa5);_0x456e35(_0x4106c2[_0x6842('0x12')](0x1f4,_0x4f313e[_0x6842('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 797507e..4ee6c0a 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 _0x7a01=['delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','openchannel','update'];(function(_0x2d4e0f,_0x87154d){var _0x20c171=function(_0x579009){while(--_0x579009){_0x2d4e0f['push'](_0x2d4e0f['shift']());}};_0x20c171(++_0x87154d);}(_0x7a01,0xed));var _0x17a0=function(_0x1cf7fc,_0x404f27){_0x1cf7fc=_0x1cf7fc-0x0;var _0x257fd2=_0x7a01[_0x1cf7fc];return _0x257fd2;};'use strict';var multer=require(_0x17a0('0x0'));var util=require(_0x17a0('0x1'));var path=require('path');var timeout=require(_0x17a0('0x2'));var express=require(_0x17a0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x17a0('0x4'));var interaction=require(_0x17a0('0x5'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x17a0('0x6')]('/',auth[_0x17a0('0x7')](),controller[_0x17a0('0x8')]);router['get'](_0x17a0('0x9'),auth[_0x17a0('0x7')](),controller[_0x17a0('0xa')]);router[_0x17a0('0x6')](_0x17a0('0xb'),auth['isAuthenticated'](),controller[_0x17a0('0xc')]);router['get'](_0x17a0('0xd'),auth[_0x17a0('0x7')](),controller['getMessages']);router[_0x17a0('0x6')](_0x17a0('0xe'),auth[_0x17a0('0x7')](),controller[_0x17a0('0xf')]);router['post']('/',auth[_0x17a0('0x7')](),controller[_0x17a0('0x10')]);router[_0x17a0('0x11')](_0x17a0('0xd'),auth[_0x17a0('0x7')](),controller[_0x17a0('0x12')]);router[_0x17a0('0x11')](_0x17a0('0x13'),auth[_0x17a0('0x7')](),interaction[_0x17a0('0x14')]('openchannel',_0x17a0('0x15')),controller['addTags']);router['put'](_0x17a0('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x17a0('0x16'),'openchannelinteraction:update'),controller[_0x17a0('0x17')]);router[_0x17a0('0x18')](_0x17a0('0xb'),auth[_0x17a0('0x7')](),interaction[_0x17a0('0x14')]('openchannel',_0x17a0('0x19')),controller[_0x17a0('0x1a')]);router[_0x17a0('0x18')](_0x17a0('0x13'),auth[_0x17a0('0x7')](),controller[_0x17a0('0x1b')]);module[_0x17a0('0x1c')]=router; \ No newline at end of file +var _0x392f=['/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','addMessage'];(function(_0x522b6f,_0x557102){var _0x3dd7a1=function(_0x42685d){while(--_0x42685d){_0x522b6f['push'](_0x522b6f['shift']());}};_0x3dd7a1(++_0x557102);}(_0x392f,0x9c));var _0xf392=function(_0x39c545,_0x4a7b5c){_0x39c545=_0x39c545-0x0;var _0x2ceed9=_0x392f[_0x39c545];return _0x2ceed9;};'use strict';var multer=require(_0xf392('0x0'));var util=require(_0xf392('0x1'));var path=require(_0xf392('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf392('0x3')]();var fs_extra=require(_0xf392('0x4'));var auth=require(_0xf392('0x5'));var interaction=require(_0xf392('0x6'));var config=require(_0xf392('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf392('0x8')]('/describe',auth[_0xf392('0x9')](),controller[_0xf392('0xa')]);router[_0xf392('0x8')](_0xf392('0xb'),auth[_0xf392('0x9')](),controller[_0xf392('0xc')]);router[_0xf392('0x8')]('/:id/messages',auth[_0xf392('0x9')](),controller[_0xf392('0xd')]);router['get'](_0xf392('0xe'),auth[_0xf392('0x9')](),controller[_0xf392('0xf')]);router[_0xf392('0x10')]('/',auth[_0xf392('0x9')](),controller['create']);router[_0xf392('0x10')]('/:id/messages',auth[_0xf392('0x9')](),controller[_0xf392('0x11')]);router[_0xf392('0x10')](_0xf392('0x12'),auth[_0xf392('0x9')](),interaction[_0xf392('0x13')](_0xf392('0x14'),'openchannelinteraction:addtags'),controller[_0xf392('0x15')]);router[_0xf392('0x16')](_0xf392('0xb'),auth['isAuthenticated'](),interaction[_0xf392('0x13')](_0xf392('0x14'),_0xf392('0x17')),controller[_0xf392('0x18')]);router['delete'](_0xf392('0xb'),auth[_0xf392('0x9')](),interaction[_0xf392('0x13')](_0xf392('0x14'),_0xf392('0x19')),controller[_0xf392('0x1a')]);router[_0xf392('0x1b')]('/:id/tags',auth[_0xf392('0x9')](),controller['removeTags']);module[_0xf392('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 3035cd0..7e06474 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 _0x097c=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x631475,_0x44f08d){var _0x1c569f=function(_0xbe196){while(--_0xbe196){_0x631475['push'](_0x631475['shift']());}};_0x1c569f(++_0x44f08d);}(_0x097c,0x1d5));var _0xc097=function(_0x431daf,_0x2b0bcf){_0x431daf=_0x431daf-0x0;var _0x27849c=_0x097c[_0x431daf];return _0x27849c;};'use strict';var Sequelize=require(_0xc097('0x0'));module[_0xc097('0x1')]={'closed':{'type':Sequelize[_0xc097('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc097('0x3')]},'secondDisposition':{'type':Sequelize[_0xc097('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc097('0x3')]},'note':{'type':Sequelize[_0xc097('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xc097('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xc097('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc097('0x5')]('in',_0xc097('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc097('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6d4f=['exports','BOOLEAN','DATE','STRING','sequelize'];(function(_0x1367aa,_0x3eb3ef){var _0x3a11b7=function(_0x5539fb){while(--_0x5539fb){_0x1367aa['push'](_0x1367aa['shift']());}};_0x3a11b7(++_0x3eb3ef);}(_0x6d4f,0x121));var _0xf6d4=function(_0x4e8db9,_0x15ff81){_0x4e8db9=_0x4e8db9-0x0;var _0x1fc3be=_0x6d4f[_0x4e8db9];return _0x1fc3be;};'use strict';var Sequelize=require(_0xf6d4('0x0'));module[_0xf6d4('0x1')]={'closed':{'type':Sequelize[_0xf6d4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf6d4('0x3')]},'disposition':{'type':Sequelize[_0xf6d4('0x4')]},'secondDisposition':{'type':Sequelize[_0xf6d4('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf6d4('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf6d4('0x3')]},'threadId':{'type':Sequelize[_0xf6d4('0x4')]},'externalUrl':{'type':Sequelize[_0xf6d4('0x4')]},'lastMsgAt':{'type':Sequelize[_0xf6d4('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf6d4('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf6d4('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index bd7adfa..cc4a36c 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 _0x23b9=['model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','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','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','OpenchannelAccountId','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','user','sequelize','toString','count','keyBy','fields','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','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','OpenchannelInteractionId','all','rows','show','params','includeAll','include','merge','options','create','describe','OpenchannelMessage','ids','omit','getMessages','findOne','format','findAll','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Owner','get','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key'];(function(_0x5c1ddc,_0x587040){var _0x542a11=function(_0x532a5d){while(--_0x532a5d){_0x5c1ddc['push'](_0x5c1ddc['shift']());}};_0x542a11(++_0x587040);}(_0x23b9,0x1a8));var _0x923b=function(_0x220571,_0x1f51e2){_0x220571=_0x220571-0x0;var _0x5c0fc1=_0x23b9[_0x220571];return _0x5c0fc1;};'use strict';var emlformat=require(_0x923b('0x0'));var rimraf=require(_0x923b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x923b('0x2'));var rp=require('request-promise');var moment=require(_0x923b('0x3'));var BPromise=require(_0x923b('0x4'));var Mustache=require(_0x923b('0x5'));var util=require(_0x923b('0x6'));var path=require(_0x923b('0x7'));var sox=require('sox');var csv=require(_0x923b('0x8'));var ejs=require(_0x923b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x923b('0xa'));var crypto=require(_0x923b('0xb'));var jsforce=require(_0x923b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x923b('0x8'));var querystring=require(_0x923b('0xd'));var Papa=require(_0x923b('0xe'));var Redis=require(_0x923b('0xf'));var authService=require(_0x923b('0x10'));var qs=require(_0x923b('0x11'));var as=require(_0x923b('0x12'));var pdf=require(_0x923b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x923b('0x14'))(_0x923b('0x15'));var utils=require(_0x923b('0x16'));var config=require(_0x923b('0x17'));var licenseUtil=require(_0x923b('0x18'));var db=require('../../mysqldb')['db'];config[_0x923b('0x19')]=_[_0x923b('0x1a')](config[_0x923b('0x19')],{'host':_0x923b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x923b('0x19')]));require(_0x923b('0x1c'))['register'](socket);function respondWithStatusCode(_0x52ea4f,_0x4ea4c1){_0x4ea4c1=_0x4ea4c1||0xcc;return function(_0x56ce4c){if(_0x56ce4c){return _0x52ea4f[_0x923b('0x1d')](_0x4ea4c1);}return _0x52ea4f[_0x923b('0x1e')](_0x4ea4c1)[_0x923b('0x1f')]();};}function respondWithResult(_0x358d18,_0x4ff437){_0x4ff437=_0x4ff437||0xc8;return function(_0x44f813){if(_0x44f813){return _0x358d18[_0x923b('0x1e')](_0x4ff437)[_0x923b('0x20')](_0x44f813);}};}function respondWithFilteredResult(_0x1466fe,_0x111705){return function(_0x346830){if(_0x346830){var _0x4a7c14=typeof _0x111705[_0x923b('0x21')]===_0x923b('0x22')&&typeof _0x111705[_0x923b('0x23')]===_0x923b('0x22');var _0x3e7fa9=_0x346830['count'];var _0x4fb35c=_0x4a7c14?0x0:_0x111705[_0x923b('0x21')];var _0x11c1d8=_0x4a7c14?_0x346830['count']:_0x111705[_0x923b('0x21')]+_0x111705[_0x923b('0x23')];var _0x3b5f4d;if(_0x11c1d8>=_0x3e7fa9){_0x11c1d8=_0x3e7fa9;_0x3b5f4d=0xc8;}else{_0x3b5f4d=0xce;}_0x1466fe[_0x923b('0x1e')](_0x3b5f4d);return _0x1466fe[_0x923b('0x24')]('Content-Range',_0x4fb35c+'-'+_0x11c1d8+'/'+_0x3e7fa9)[_0x923b('0x20')](_0x346830);}return null;};}function patchUpdates(_0x5c274d){return function(_0x118ad9){try{jsonpatch[_0x923b('0x25')](_0x118ad9,_0x5c274d,!![]);}catch(_0x194387){return BPromise[_0x923b('0x26')](_0x194387);}return _0x118ad9['save']();};}function saveUpdates(_0x5adbdd,_0x127d03){return function(_0x3b5928){if(_0x3b5928){return _0x3b5928[_0x923b('0x27')](_0x5adbdd)[_0x923b('0x28')](function(_0x2ec6f5){return _0x2ec6f5;});}return null;};}function removeEntity(_0x3b6aa7,_0x4d24f7){return function(_0x612299){if(_0x612299){return _0x612299[_0x923b('0x29')]()['then'](function(){_0x3b6aa7[_0x923b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3cce,_0x56523c){return function(_0x44e498){if(!_0x44e498){_0x5c3cce[_0x923b('0x1d')](0x194);}return _0x44e498;};}function handleError(_0x26ce7d,_0x109668){_0x109668=_0x109668||0x1f4;return function(_0x13f0f5){logger[_0x923b('0x2a')](_0x13f0f5[_0x923b('0x2b')]);if(_0x13f0f5[_0x923b('0x2c')]){delete _0x13f0f5[_0x923b('0x2c')];}_0x26ce7d[_0x923b('0x1e')](_0x109668)['send'](_0x13f0f5);};}function getInteractionUsers(_0x5c093d,_0x300191){return new BPromise(function(_0x5f0cd0,_0x2c2d9f){try{if(_0x300191[_0x5c093d['id']]){_0x5c093d[_0x923b('0x2d')]=_[_0x923b('0x2e')](_0x300191[_0x5c093d['id']],function(_0x5668fd){return{'id':_0x5668fd['id'],'fullname':_0x5668fd[_0x923b('0x2f')]};});}}catch(_0xcd828f){_0x2c2d9f(_0xcd828f);}_0x5f0cd0(_0x5c093d);});}function getInteractionTags(_0x29ae9d,_0x939e7){return new BPromise(function(_0x3b979a,_0x361762){try{if(_0x29ae9d[_0x923b('0x30')]){_0x29ae9d['Tags']=[];_0x29ae9d[_0x923b('0x30')][_0x923b('0x31')](',')[_0x923b('0x32')](function(_0x3a77a5){_0x29ae9d[_0x923b('0x33')][_0x923b('0x34')](_0x939e7[_0x3a77a5]);});}delete _0x29ae9d[_0x923b('0x30')];}catch(_0x37158f){_0x361762(_0x37158f);}_0x3b979a(_0x29ae9d);});}function updateOpenchannelInteraction(_0xe7ac91,_0x168a85,_0x4c01ce){return new BPromise(function(_0x650599,_0x5b235c){return getInteractionUsers(_0xe7ac91,_0x4c01ce)['then'](function(_0x4af3a3){return getInteractionTags(_0x4af3a3,_0x168a85);})['then'](function(_0x5ccbdd){_0x650599(_0x5ccbdd);})[_0x923b('0x35')](function(_0x3dcdc1){_0x5b235c(_0x3dcdc1);});});}exports[_0x923b('0x36')]=function(_0x5d01eb,_0x55f380){var _0x4fcd61={},_0x55d882={},_0x28828c={'count':0x0,'rows':[]};var _0x5b2977=_[_0x923b('0x2e')](db[_0x923b('0x37')][_0x923b('0x38')],function(_0x46f7ce){return{'name':_0x46f7ce[_0x923b('0x39')],'type':_0x46f7ce[_0x923b('0x3a')][_0x923b('0x3b')]};});_0x55d882[_0x923b('0x3c')]=_[_0x923b('0x2e')](_0x5b2977,_0x923b('0x2c'));_0x55d882[_0x923b('0x3d')]=_[_0x923b('0x3e')](_0x5d01eb['query']);_0x55d882[_0x923b('0x3f')]=_[_0x923b('0x40')](_0x55d882[_0x923b('0x3c')],_0x55d882[_0x923b('0x3d')]);_0x4fcd61[_0x923b('0x41')]=_[_0x923b('0x40')](_0x55d882['model'],qs['fields'](_0x5d01eb[_0x923b('0x3d')]['fields']));_0x4fcd61['attributes']=_0x4fcd61['attributes'][_0x923b('0x42')]?_0x4fcd61[_0x923b('0x41')]:_0x55d882[_0x923b('0x3c')];if(!_0x5d01eb[_0x923b('0x3d')][_0x923b('0x43')](_0x923b('0x44'))){_0x4fcd61[_0x923b('0x23')]=qs[_0x923b('0x23')](_0x5d01eb[_0x923b('0x3d')]['limit']);_0x4fcd61['offset']=qs[_0x923b('0x21')](_0x5d01eb[_0x923b('0x3d')][_0x923b('0x21')]);}_0x4fcd61[_0x923b('0x45')]=qs[_0x923b('0x46')](_0x5d01eb['query'][_0x923b('0x46')]);_0x4fcd61[_0x923b('0x47')]=qs[_0x923b('0x3f')](_[_0x923b('0x48')](_0x5d01eb[_0x923b('0x3d')],_0x55d882[_0x923b('0x3f')]),_0x5b2977);var _0x2fcbc5=[];var _0x54ff12=squel[_0x923b('0x49')]()[_0x923b('0x4a')]('id')[_0x923b('0x4a')](_0x923b('0x2c'))[_0x923b('0x4a')](_0x923b('0x4b'))[_0x923b('0x4c')](_0x923b('0x4d'));var _0x5ecd4b=squel['select']()['field'](_0x923b('0x4e'))[_0x923b('0x4a')]('u.fullname')[_0x923b('0x4a')](_0x923b('0x4f'))['from'](_0x923b('0x50'),'ui')[_0x923b('0x51')](_0x923b('0x52'),'u',_0x923b('0x53'));var _0x1e963a=squel['select']()[_0x923b('0x4c')](_0x923b('0x54'),'i')[_0x923b('0x51')](_0x923b('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x923b('0x56'))[_0x923b('0x51')]('openchannel_accounts','a',_0x923b('0x57'))[_0x923b('0x51')](_0x923b('0x58'),'me',_0x923b('0x59'))[_0x923b('0x51')]('openchannel_interaction_has_tags','it',_0x923b('0x5a'))['left_join']('tools_tags','t',_0x923b('0x5b'));var _0x3d0a08=squel[_0x923b('0x5c')]();var _0x195c6e=[];var _0x224705=squel[_0x923b('0x5c')]();var _0x56994d;if(_0x5d01eb[_0x923b('0x3d')][_0x923b('0x5d')]){_0x56994d=as[_0x923b('0x5e')](_0x5d01eb[_0x923b('0x3d')][_0x923b('0x5d')]);var _0x4ea097=_0x56994d[_0x923b('0x5f')];for(var _0x438271=0x0;_0x438271<_0x56994d[_0x923b('0x60')][_0x923b('0x42')];_0x438271++){var _0x2f5d4d=_0x56994d[_0x923b('0x60')][_0x438271];var _0x93a447='i';var _0x562905=_[_0x923b('0x61')](_0x5b2977,['name',_0x2f5d4d[_0x923b('0x4a')]]);if(!_0x562905){switch(_0x2f5d4d[_0x923b('0x4a')]){case _0x923b('0x62'):if(_0x2f5d4d['value']==0x1){_0x1e963a[_0x923b('0x63')]('`'+_0x2f5d4d[_0x923b('0x4a')]+_0x923b('0x64'));}else{_0x1e963a[_0x923b('0x63')]('`'+_0x2f5d4d[_0x923b('0x4a')]+_0x923b('0x65'));}break;case'Contact':if(_0x2f5d4d[_0x923b('0x66')]===_0x923b('0x67')){if(_0x2f5d4d[_0x923b('0x68')][_0x923b('0x31')]('\x20')[_0x923b('0x42')]>0x1){_0x3d0a08[_0x4ea097](_0x923b('0x69'),qs[_0x923b('0x6a')](_0x2f5d4d[_0x923b('0x68')]),null);}else{var _0x94a7b1='%'+_0x2f5d4d[_0x923b('0x68')]+'%';_0x3d0a08[_0x4ea097](_0x923b('0x6b'),_0x94a7b1,_0x94a7b1,_0x94a7b1);}}else{_0x562905=_['find'](_0x5b2977,[_0x923b('0x2c'),_0x923b('0x6c')]);_0x2f5d4d[_0x923b('0x4a')]=_0x923b('0x6c');_0x4ce368=as['buildExpression'](_0x93a447,_0x562905[_0x923b('0x3a')],_0x2f5d4d);_0x3d0a08[_0x4ea097](_0x4ce368[_0x923b('0x6d')],_0x4ce368[_0x923b('0x68')][_0x923b('0x6e')],_0x4ce368[_0x923b('0x68')][_0x923b('0x1f')]);}break;case'Tag':var _0x5b55fc=_0x2f5d4d[_0x923b('0x68')][_0x923b('0x31')](',')[_0x923b('0x2e')](function(_0x4ac194){return Number(_0x4ac194);});_0x5b55fc[_0x923b('0x32')](function(_0x525725){_0x224705['or'](_0x923b('0x6f'),'%,'+_0x525725+',%');});_0x195c6e=_[_0x923b('0x70')](_0x195c6e,_0x5b55fc);break;case _0x923b('0x71'):if(_0x2f5d4d[_0x923b('0x66')]==='$substring'){_0x3d0a08[_0x4ea097](_0x923b('0x72'),'%'+_0x2f5d4d[_0x923b('0x68')]+'%',null);}else{_0x562905=_[_0x923b('0x61')](_0x5b2977,['name',_0x923b('0x73')]);_0x2f5d4d[_0x923b('0x4a')]=_0x923b('0x73');_0x4ce368=as[_0x923b('0x74')](_0x93a447,_0x562905[_0x923b('0x3a')],_0x2f5d4d);_0x3d0a08[_0x4ea097](_0x4ce368['text'],_0x4ce368['value']['start'],_0x4ce368[_0x923b('0x68')]['end']);}break;case _0x923b('0x75'):_0x4ce368=as['buildExpression']('me',null,_0x2f5d4d);_0x3d0a08[_0x4ea097](_0x4ce368[_0x923b('0x6d')],_0x4ce368[_0x923b('0x68')][_0x923b('0x6e')],_0x4ce368[_0x923b('0x68')]['end']);break;}}else{var _0x4ce368=as[_0x923b('0x74')](_0x93a447,_0x562905['type'],_0x2f5d4d);_0x3d0a08[_0x4ea097](_0x4ce368[_0x923b('0x6d')],_0x4ce368[_0x923b('0x68')][_0x923b('0x6e')],_0x4ce368[_0x923b('0x68')]['end']);}}}else{var _0x24b899=_(_0x5d01eb[_0x923b('0x3d')])[_0x923b('0x3e')]()['map'](function(_0x58794a){return _[_0x923b('0x76')](_0x5b2977,[_0x923b('0x2c'),_0x58794a])?_0x58794a:undefined;})[_0x923b('0x77')]()['value']();if(!_['isEmpty'](_0x24b899)){_0x24b899[_0x923b('0x32')](function(_0x1bddad){if(_0x1bddad===_0x923b('0x78')){_0x1e963a[_0x923b('0x47')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x5d01eb[_0x923b('0x3d')][_0x1bddad]));}else if(_0x1bddad===_0x923b('0x79')){var _0x509638=JSON['parse'](_0x5d01eb['query'][_0x1bddad])[_0x923b('0x7a')];var _0x19426e=JSON[_0x923b('0x7b')](_0x5d01eb[_0x923b('0x3d')][_0x1bddad])[_0x923b('0x7c')];_0x1e963a[_0x923b('0x47')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x509638,_0x19426e);}else{if(_0x5d01eb[_0x923b('0x3d')][_0x1bddad]===_0x923b('0x7d')){_0x1e963a[_0x923b('0x47')]('i.'+_0x1bddad+_0x923b('0x7e'));}else{_0x1e963a[_0x923b('0x47')]('i.'+_0x1bddad+_0x923b('0x7f'),_0x5d01eb[_0x923b('0x3d')][_0x1bddad]);}}});}if(_0x5d01eb['query'][_0x923b('0x80')]){if(_0x5d01eb[_0x923b('0x3d')][_0x923b('0x80')]==0x1){_0x1e963a[_0x923b('0x63')](_0x923b('0x81'));}else{_0x1e963a[_0x923b('0x63')](_0x923b('0x82'));}}if(_0x5d01eb[_0x923b('0x3d')][_0x923b('0x83')]){_0x195c6e=_[_0x923b('0x84')](_0x5d01eb[_0x923b('0x3d')][_0x923b('0x83')])?_0x5d01eb[_0x923b('0x3d')]['tag']:new Array(_0x5d01eb['query'][_0x923b('0x83')]);_0x195c6e[_0x923b('0x32')](function(_0x3d9eeb){_0x224705['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3d9eeb+',%');});}if(_0x5d01eb['query'][_0x923b('0x85')]){var _0x2e95b6=_0x5d01eb[_0x923b('0x3d')][_0x923b('0x85')][_0x923b('0x86')]('\x5c','\x5c\x5c')[_0x923b('0x86')](/'/g,'\x27\x27');if(qs[_0x923b('0x87')](_0x2e95b6)){_0x3d0a08['or'](_0x923b('0x88'),_0x2e95b6+'%');}else{_0x3d0a08['or'](_0x923b('0x89'),qs[_0x923b('0x6a')](_0x2e95b6))['or'](_0x923b('0x8a'),_0x2e95b6+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2e95b6+'%');}}}_0x1e963a[_0x923b('0x47')](_0x3d0a08);_0x1e963a[_0x923b('0x8b')](_0x923b('0x8c'));var _0x969865={'type':db[_0x923b('0x8d')]['QueryTypes']['SELECT'],'raw':!![]};var _0x2ff15c=_0x1e963a[_0x923b('0x8e')]();_0x2ff15c[_0x923b('0x4a')]('i.id');_0x2ff15c[_0x923b('0x4a')](_0x923b('0x8f'),'unreadMessages');if(_0x4fcd61['order']){_0x4fcd61['order'][_0x923b('0x32')](function(_0x2a191d){var _0x177d09=_0x2a191d[0x0]==='contactName'?_0x2a191d[0x0]:'i.'+_0x2a191d[0x0];_0x1e963a[_0x923b('0x45')](_0x177d09,_0x2a191d[0x1]===_0x923b('0x90')?![]:!![]);});}if(!_[_0x923b('0x91')](_0x195c6e)){_0x1e963a['having'](_0x224705);_0x2ff15c['where'](_0x923b('0x92'),_0x195c6e);}BPromise[_0x923b('0x93')]()[_0x923b('0x28')](function(){if(!_0x56994d){if(_0x5d01eb['query']['OpenchannelAccountId'])return;_0x2ff15c[_0x923b('0x47')](_0x923b('0x94'));_0x1e963a[_0x923b('0x47')](_0x923b('0x94'));return;}if(_0x5d01eb['user']['role']!==_0x923b('0x95'))return;return _0x5d01eb['user'][_0x923b('0x96')]({'attributes':['id'],'raw':!![]})[_0x923b('0x28')](function(_0x1d756b){if(_[_0x923b('0x91')](_0x1d756b)){_0x2ff15c['where'](_0x923b('0x97'));_0x1e963a['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x2ff15c[_0x923b('0x47')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x923b('0x2e')](_0x1d756b,'id'));_0x1e963a[_0x923b('0x47')](_0x923b('0x98'),_[_0x923b('0x2e')](_0x1d756b,'id'));}});})[_0x923b('0x28')](function(){if(_0x5d01eb[_0x923b('0x99')]['role']===_0x923b('0x95')&&!_0x56994d&&!_0x5d01eb[_0x923b('0x3d')][_0x923b('0x78')])return[];return db[_0x923b('0x9a')][_0x923b('0x3d')](_0x2ff15c[_0x923b('0x9b')](),_0x969865);})[_0x923b('0x28')](function(_0x3e9fd5){_0x28828c[_0x923b('0x9c')]=_0x3e9fd5[_0x923b('0x42')];if(_0x28828c[_0x923b('0x9c')]===0x0)return[];return db[_0x923b('0x9a')][_0x923b('0x3d')](_0x54ff12[_0x923b('0x9b')](),_0x969865)['then'](function(_0x75b5bb){_0x2fcbc5=_[_0x923b('0x9d')](_0x75b5bb,'id');_0x969865=_['merge'](_0x969865,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d01eb[_0x923b('0x3d')][_0x923b('0x9e')]){_0x4fcd61['attributes']['forEach'](function(_0x22ef34){_0x1e963a[_0x923b('0x4a')]('i.'+_0x22ef34);});}else{_0x1e963a[_0x923b('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x923b('0x62'));_0x1e963a[_0x923b('0x4a')](_0x923b('0x9f'),'Account.key');_0x1e963a['field'](_0x923b('0xa0'),_0x923b('0xa1'));_0x1e963a[_0x923b('0x4a')](_0x923b('0xa2'),_0x923b('0xa3'));_0x1e963a[_0x923b('0x4a')](_0x923b('0xa4'));_0x1e963a[_0x923b('0x4a')]('c.firstName',_0x923b('0xa5'));_0x1e963a[_0x923b('0x4a')](_0x923b('0xa6'),_0x923b('0xa7'));_0x1e963a[_0x923b('0x4a')]('c.email',_0x923b('0xa8'));_0x1e963a[_0x923b('0x4a')](_0x923b('0xa9'),_0x923b('0xaa'));_0x1e963a['field'](_0x923b('0xab'),'Contact.mobile');_0x1e963a[_0x923b('0x4a')](_0x923b('0xac'),_0x923b('0xad'));_0x1e963a[_0x923b('0x4a')](_0x923b('0xae'),_0x923b('0xaf'));_0x1e963a['field'](_0x923b('0xb0'),_0x923b('0xb1'));_0x1e963a[_0x923b('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4fcd61[_0x923b('0x23')])_0x1e963a[_0x923b('0x23')](_0x4fcd61[_0x923b('0x23')]);if(_0x4fcd61[_0x923b('0x21')])_0x1e963a['offset'](_0x4fcd61[_0x923b('0x21')]);return db[_0x923b('0x9a')][_0x923b('0x3d')](_0x1e963a[_0x923b('0x9b')](),_0x969865);})['then'](function(_0x125399){if(_0x125399[_0x923b('0x42')]>0x0)_0x5ecd4b[_0x923b('0x47')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x923b('0x2e')](_0x125399,'id'));return db['sequelize']['query'](_0x5ecd4b[_0x923b('0x9b')](),_0x969865)[_0x923b('0x28')](function(_0x2bb856){var _0x34e249=_['groupBy'](_0x2bb856,_0x923b('0xb2'));var _0x15cbd5=[];_0x125399[_0x923b('0x32')](function(_0x4e35a8){_0x15cbd5[_0x923b('0x34')](updateOpenchannelInteraction(_0x4e35a8,_0x2fcbc5,_0x34e249));});return BPromise[_0x923b('0xb3')](_0x15cbd5);});});})[_0x923b('0x28')](function(_0x4027f5){_0x28828c[_0x923b('0xb4')]=_0x4027f5;return _0x28828c;})['then'](respondWithFilteredResult(_0x55f380,_0x4fcd61))[_0x923b('0x35')](handleError(_0x55f380,null));};exports[_0x923b('0xb5')]=function(_0x3f8353,_0x479467){var _0x3f0b20={};if(_0x3f8353[_0x923b('0x3d')][_0x923b('0x3a')]&&_0x3f8353[_0x923b('0x3d')][_0x923b('0x3a')]===_0x923b('0x4c')){_0x3f0b20[_0x923b('0x4c')]=_0x3f8353['params']['id'];}else{_0x3f0b20['id']=_0x3f8353[_0x923b('0xb6')]['id'];}var _0x3de7e6={'raw':![],'where':_0x3f0b20},_0x50bce2={};_0x50bce2[_0x923b('0x3c')]=_[_0x923b('0x3e')](db[_0x923b('0x37')][_0x923b('0x38')]);_0x50bce2[_0x923b('0x3d')]=_[_0x923b('0x3e')](_0x3f8353[_0x923b('0x3d')]);_0x50bce2[_0x923b('0x3f')]=_[_0x923b('0x40')](_0x50bce2[_0x923b('0x3c')],_0x50bce2[_0x923b('0x3d')]);_0x3de7e6[_0x923b('0x41')]=_['intersection'](_0x50bce2[_0x923b('0x3c')],qs['fields'](_0x3f8353[_0x923b('0x3d')][_0x923b('0x9e')]));_0x3de7e6['attributes']=_0x3de7e6[_0x923b('0x41')]['length']?_0x3de7e6[_0x923b('0x41')]:_0x50bce2['model'];if(_0x3f8353[_0x923b('0x3d')][_0x923b('0xb7')]){_0x3de7e6[_0x923b('0xb8')]=[{'all':!![]}];}_0x3de7e6=_[_0x923b('0xb9')]({},_0x3de7e6,_0x3f8353[_0x923b('0xba')]);return db[_0x923b('0x37')][_0x923b('0x61')](_0x3de7e6)[_0x923b('0x28')](handleEntityNotFound(_0x479467,null))[_0x923b('0x28')](respondWithResult(_0x479467,null))[_0x923b('0x35')](handleError(_0x479467,null));};exports['create']=function(_0x1bb7c4,_0x19e8a6){return db['OpenchannelInteraction'][_0x923b('0xbb')](_0x1bb7c4[_0x923b('0x75')],{})[_0x923b('0x28')](respondWithResult(_0x19e8a6,0xc9))[_0x923b('0x35')](handleError(_0x19e8a6,null));};exports['update']=function(_0x53f25f,_0x3ae04a){if(_0x53f25f[_0x923b('0x75')]['id']){delete _0x53f25f['body']['id'];}return db[_0x923b('0x37')]['find']({'where':{'id':_0x53f25f[_0x923b('0xb6')]['id']}})[_0x923b('0x28')](handleEntityNotFound(_0x3ae04a,null))[_0x923b('0x28')](saveUpdates(_0x53f25f['body'],null))[_0x923b('0x28')](respondWithResult(_0x3ae04a,null))['catch'](handleError(_0x3ae04a,null));};exports['destroy']=function(_0x5770f5,_0x542b36){return db[_0x923b('0x37')][_0x923b('0x61')]({'where':{'id':_0x5770f5[_0x923b('0xb6')]['id']}})['then'](handleEntityNotFound(_0x542b36,null))['then'](removeEntity(_0x542b36,null))[_0x923b('0x35')](handleError(_0x542b36,null));};exports[_0x923b('0xbc')]=function(_0x12863a,_0x573671){return db[_0x923b('0x37')][_0x923b('0xbc')]()[_0x923b('0x28')](respondWithResult(_0x573671,null))[_0x923b('0x35')](handleError(_0x573671,null));};exports['addMessage']=function(_0x39f890,_0x196a91,_0x1c1969){return db[_0x923b('0xbd')]['find']({'where':{'id':_0x39f890['params']['id']}})[_0x923b('0x28')](handleEntityNotFound(_0x196a91,null))[_0x923b('0x28')](function(_0x1fd715){if(_0x1fd715){return _0x1fd715['addMessage'](_0x39f890[_0x923b('0x75')][_0x923b('0xbe')],_[_0x923b('0xbf')](_0x39f890[_0x923b('0x75')],[_0x923b('0xbe'),'id'])||{});}})[_0x923b('0x28')](respondWithResult(_0x196a91,null))[_0x923b('0x35')](handleError(_0x196a91,null));};exports[_0x923b('0xc0')]=function(_0x43d7a0,_0x4c6b2f,_0x4abc54){var _0x3e3293={'raw':![],'where':{}};var _0x17ef79={};var _0x4c7af2={'count':0x0,'rows':[]};return db[_0x923b('0x37')][_0x923b('0xc1')]({'where':{'id':_0x43d7a0['params']['id']}})['then'](handleEntityNotFound(_0x4c6b2f,null))[_0x923b('0x28')](function(_0x50ef75){if(_0x50ef75){_0x17ef79[_0x923b('0x3c')]=_[_0x923b('0x3e')](db[_0x923b('0xbd')][_0x923b('0x38')]);_0x17ef79[_0x923b('0x3d')]=_[_0x923b('0x3e')](_0x43d7a0[_0x923b('0x3d')]);_0x17ef79[_0x923b('0x3f')]=_[_0x923b('0x40')](_0x17ef79[_0x923b('0x3c')],_0x17ef79['query']);_0x3e3293['attributes']=_['intersection'](_0x17ef79[_0x923b('0x3c')],qs['fields'](_0x43d7a0[_0x923b('0x3d')][_0x923b('0x9e')]));_0x3e3293[_0x923b('0x41')]=_0x3e3293['attributes'][_0x923b('0x42')]?_0x3e3293[_0x923b('0x41')]:_0x17ef79[_0x923b('0x3c')];if(!_0x43d7a0[_0x923b('0x3d')][_0x923b('0x43')](_0x923b('0x44'))){_0x3e3293[_0x923b('0x23')]=qs['limit'](_0x43d7a0[_0x923b('0x3d')][_0x923b('0x23')]);_0x3e3293[_0x923b('0x21')]=qs[_0x923b('0x21')](_0x43d7a0['query'][_0x923b('0x21')]);}_0x3e3293[_0x923b('0x45')]=qs['sort'](_0x43d7a0['query']['sort']);_0x3e3293['where']=qs[_0x923b('0x3f')](_['pick'](_0x43d7a0[_0x923b('0x3d')],_0x17ef79['filters']));_0x3e3293['where']['OpenchannelInteractionId']=_0x50ef75['id'];if(_0x43d7a0[_0x923b('0x3d')][_0x923b('0x85')]){_0x3e3293[_0x923b('0x47')]=_[_0x923b('0xb9')](_0x3e3293[_0x923b('0x47')],{'$or':_['map'](_0x3e3293['attributes'],function(_0x3a6b82){var _0x5a9898={};_0x5a9898[_0x3a6b82]={'$like':'%'+_0x43d7a0[_0x923b('0x3d')][_0x923b('0x85')]+'%'};return _0x5a9898;})});}if(_0x43d7a0[_0x923b('0x3d')]['$gte']){var _0x467679=_0x43d7a0['query']['$gte']['split'](',');var _0x5e0987={};_0x5e0987[_0x467679[0x0]]={'$gte':moment(_0x467679[0x1])[_0x923b('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3e3293[_0x923b('0x47')]=_[_0x923b('0xb9')](_0x3e3293[_0x923b('0x47')],_0x5e0987);}_0x3e3293=_[_0x923b('0xb9')]({},_0x3e3293,_0x43d7a0[_0x923b('0xba')]);return db['OpenchannelMessage'][_0x923b('0x9c')]({'where':_0x3e3293[_0x923b('0x47')]})[_0x923b('0x28')](function(_0x53a31c){_0x4c7af2[_0x923b('0x9c')]=_0x53a31c;if(_0x43d7a0[_0x923b('0x3d')][_0x923b('0xb7')]){_0x3e3293['include']=[{'all':!![]}];}return db[_0x923b('0xbd')][_0x923b('0xc3')](_0x3e3293);})[_0x923b('0x28')](function(_0x314aeb){_0x4c7af2[_0x923b('0xb4')]=_0x314aeb;return _0x4c7af2;});}})[_0x923b('0x28')](respondWithFilteredResult(_0x4c6b2f,_0x3e3293))[_0x923b('0x35')](handleError(_0x4c6b2f,null));};exports['addTags']=function(_0x1cc09e,_0x2f6204,_0x2ae85b){return db['OpenchannelInteraction'][_0x923b('0x61')]({'where':{'id':_0x1cc09e[_0x923b('0xb6')]['id']}})[_0x923b('0x28')](handleEntityNotFound(_0x2f6204,null))[_0x923b('0x28')](function(_0x23fdae){if(_0x23fdae){return _0x23fdae[_0x923b('0xc4')](_0x1cc09e[_0x923b('0x75')]['ids'],_[_0x923b('0xbf')](_0x1cc09e[_0x923b('0x75')],[_0x923b('0xbe'),'id'])||{})['spread'](function(){return db[_0x923b('0xc5')][_0x923b('0xc3')]({'attributes':['id',_0x923b('0x2c'),_0x923b('0x4b')],'where':{'id':_0x1cc09e[_0x923b('0x75')][_0x923b('0xbe')]}});})[_0x923b('0x28')](function(_0xf3a90){socket[_0x923b('0xc6')](_0x923b('0xc7'),{'id':Number(_0x1cc09e['params']['id']),'tags':_0xf3a90||[]});return{'id':Number(_0x1cc09e[_0x923b('0xb6')]['id']),'tags':_0xf3a90||[]};});}})['then'](respondWithResult(_0x2f6204,null))[_0x923b('0x35')](handleError(_0x2f6204,null));};exports[_0x923b('0xc8')]=function(_0x511ecc,_0x2ce004,_0x809854){return db[_0x923b('0x37')][_0x923b('0x61')]({'where':{'id':_0x511ecc['params']['id']}})['then'](handleEntityNotFound(_0x2ce004,null))[_0x923b('0x28')](function(_0x4ccd2d){if(_0x4ccd2d){return _0x4ccd2d[_0x923b('0xc8')](_0x511ecc[_0x923b('0x3d')][_0x923b('0xbe')]);}})[_0x923b('0x28')](respondWithStatusCode(_0x2ce004,null))[_0x923b('0x35')](handleError(_0x2ce004,null));};exports['download']=function(_0x16e711,_0x2096c6){var _0x3db7d2=moment()[_0x923b('0xc9')]()['toString']();var _0x7f8d3b=path['join'](config[_0x923b('0xca')],_0x923b('0xcb'),_0x923b('0xcc'),_0x923b('0xcd'));var _0x2debc6=path[_0x923b('0xce')](config[_0x923b('0xca')],_0x923b('0xcb'),_0x923b('0xcc'),_0x923b('0xcf'));var _0x29f714=path[_0x923b('0xce')](_0x7f8d3b,_0x3db7d2);var _0x118117=util[_0x923b('0xc2')](_0x923b('0xd0'),_0x16e711['params']['id'],_0x3db7d2);var _0x22c61f=path[_0x923b('0xce')](_0x7f8d3b,_0x118117);var _0xc023ed=[];_0xc023ed[_0x923b('0x34')]({'model':db[_0x923b('0x71')],'as':_0x923b('0x71'),'attributes':['id',_0x923b('0x2f')],'raw':!![]});_0xc023ed[_0x923b('0x34')]({'model':db[_0x923b('0xd1')],'as':_0x923b('0xd2'),'attributes':['id',_0x923b('0xd3'),_0x923b('0xd4')],'raw':!![]});if(_0x16e711[_0x923b('0x3d')][_0x923b('0xcf')]){_0xc023ed['push']({'model':db[_0x923b('0xd5')],'as':_0x923b('0xd5'),'raw':!![]});}var _0x56fa09=[{'model':db[_0x923b('0xbd')],'as':_0x923b('0xd6'),'attributes':['id','body',_0x923b('0x79'),_0x923b('0xd7'),_0x923b('0xd8'),_0x923b('0x80')],'include':_0xc023ed}];_0x56fa09[_0x923b('0x34')]({'model':db[_0x923b('0xd9')],'as':'Account','attributes':['id',_0x923b('0x2c')]});_0x56fa09['push']({'model':db[_0x923b('0x71')],'as':_0x923b('0xda'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x923b('0x61')]({'where':{'id':_0x16e711[_0x923b('0xb6')]['id']},'include':_0x56fa09})[_0x923b('0x28')](handleEntityNotFound(_0x2096c6,null))[_0x923b('0x28')](function(_0x308a48){if(_0x308a48){var _0x51e7f7=_0x308a48[_0x923b('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x29f714);var _0xa9f2d4={'channel':_0x923b('0xdc'),'account':_0x51e7f7[_0x923b('0xdd')]['name'],'agent':_0x51e7f7['Owner']?_0x51e7f7['Owner'][_0x923b('0x2f')]:_0x923b('0xde'),'createdAt':moment(_0x51e7f7['createdAt'])['format'](_0x923b('0xdf'))[_0x923b('0x9b')](),'closedAt':_0x51e7f7['closed']?moment(_0x51e7f7[_0x923b('0xe0')])[_0x923b('0xc2')](_0x923b('0xdf'))[_0x923b('0x9b')]():'','disposition':_0x51e7f7[_0x923b('0xe1')],'visibility':_0x51e7f7[_0x923b('0xe2')]?_0x923b('0xe3'):_0x923b('0xe4'),'messages':_(_0x51e7f7[_0x923b('0xd6')])[_0x923b('0x85')]({'secret':![]})[_0x923b('0x2e')](function(_0x31e10f){if(_0x31e10f[_0x923b('0xd5')]){var _0xa6c4bb=path['join'](_0x2debc6,_0x31e10f[_0x923b('0xd5')][_0x923b('0xe5')]);if(fs[_0x923b('0xe6')](_0xa6c4bb)){fs[_0x923b('0xe7')](_0xa6c4bb)['pipe'](fs[_0x923b('0xe8')](path[_0x923b('0xce')](_0x29f714,_0x31e10f[_0x923b('0xd5')]['basename'])));}}return{'date':moment(_0x31e10f[_0x923b('0x79')])[_0x923b('0xc2')](_0x923b('0xdf'))[_0x923b('0x9b')](),'sender':_0x31e10f[_0x923b('0xd7')]===_0x923b('0xe9')?_0x31e10f[_0x923b('0x71')]?_0x31e10f[_0x923b('0x71')][_0x923b('0x2f')]:'System':_0x31e10f[_0x923b('0xd2')][_0x923b('0xd3')]+(_0x31e10f[_0x923b('0xd2')][_0x923b('0xd4')]?'\x20'+_0x31e10f[_0x923b('0xd2')][_0x923b('0xd4')]:''),'body':_0x31e10f[_0x923b('0xd5')]?_0x31e10f[_0x923b('0xd5')][_0x923b('0xe5')]:_0x31e10f[_0x923b('0x75')],'direction':_0x31e10f[_0x923b('0xd7')]==='out'?'A':'C','secret':_0x31e10f[_0x923b('0xd8')],'read':_0x31e10f['read'],'attachment':_0x31e10f['Attachment']};})['value']()};return ejs[_0x923b('0xea')](path[_0x923b('0xce')](config[_0x923b('0xca')],_0x923b('0xcb'),_0x923b('0xeb'),_0x923b('0xec')),{'interaction':_0xa9f2d4})[_0x923b('0x28')](function(_0x31a313){var _0x4d17ac=path['join'](_0x29f714,_0x923b('0xed')+_0x51e7f7['id']+'-'+_0x3db7d2+_0x923b('0xee'));var _0x4c73db={'path':_0x4d17ac,'channel':'Openchannel','interactionId':_0x51e7f7['id']};return pdf[_0x923b('0xef')](_0x31a313,_0x4c73db);})[_0x923b('0x28')](function(){return new BPromise(function(_0x1f4161,_0x47ec3d){zipdir(_0x29f714,{'saveTo':_0x22c61f},function(_0x225be7,_0x3ac064){if(_0x225be7)return _0x47ec3d(_0x225be7);return _0x1f4161(_0x3ac064);});})[_0x923b('0x28')](function(){return new BPromise(function(_0x5db008,_0x121b9c){rimraf(_0x29f714,function(_0x249fdc){if(_0x249fdc)_0x121b9c(_0x249fdc);return _0x5db008();});});})[_0x923b('0x28')](function(){return _0x2096c6[_0x923b('0xf0')](_0x22c61f,_0x118117,function(_0x2d8fac){if(_0x2d8fac){console[_0x923b('0xf1')]('err',_0x2d8fac);}else{fs['unlinkSync'](_0x22c61f);}});});});}else{return _0x2096c6['sendStatus'](0xc8);}})[_0x923b('0x35')](handleError(_0x2096c6,null));}; \ No newline at end of file +var _0xb79e=['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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','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','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','Contact','operator','$substring','value','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','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','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','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','OpenchannelInteraction','unreadMessages','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','all','rows','intersection','options','create','update','params','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','nolimit','pick','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','Tag','color','emit','download','join','files','root','server','transcript-%d-%s.zip','CmContact','firstName','attachments','Messages','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','closed','closedAt','disposition','threadId','Public','Attachment','existsSync','createReadStream','createWriteStream','basename','lastName','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0xb79e,0xf7));var _0xeb79=function(_0x6c5d40,_0x4390ab){_0x6c5d40=_0x6c5d40-0x0;var _0x20724c=_0xb79e[_0x6c5d40];return _0x20724c;};'use strict';var emlformat=require(_0xeb79('0x0'));var rimraf=require(_0xeb79('0x1'));var zipdir=require(_0xeb79('0x2'));var jsonpatch=require(_0xeb79('0x3'));var rp=require(_0xeb79('0x4'));var moment=require(_0xeb79('0x5'));var BPromise=require(_0xeb79('0x6'));var Mustache=require(_0xeb79('0x7'));var util=require(_0xeb79('0x8'));var path=require(_0xeb79('0x9'));var sox=require(_0xeb79('0xa'));var csv=require(_0xeb79('0xb'));var ejs=require(_0xeb79('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb79('0xd'));var squel=require(_0xeb79('0xe'));var crypto=require(_0xeb79('0xf'));var jsforce=require(_0xeb79('0x10'));var deskjs=require(_0xeb79('0x11'));var toCsv=require(_0xeb79('0xb'));var querystring=require(_0xeb79('0x12'));var Papa=require(_0xeb79('0x13'));var Redis=require(_0xeb79('0x14'));var authService=require(_0xeb79('0x15'));var qs=require(_0xeb79('0x16'));var as=require(_0xeb79('0x17'));var pdf=require(_0xeb79('0x18'));var hardwareService=require(_0xeb79('0x19'));var logger=require(_0xeb79('0x1a'))(_0xeb79('0x1b'));var utils=require('../../config/utils');var config=require(_0xeb79('0x1c'));var licenseUtil=require(_0xeb79('0x1d'));var db=require('../../mysqldb')['db'];config[_0xeb79('0x1e')]=_[_0xeb79('0x1f')](config[_0xeb79('0x1e')],{'host':_0xeb79('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb79('0x1e')]));require(_0xeb79('0x21'))[_0xeb79('0x22')](socket);function respondWithStatusCode(_0x394562,_0x2f6c79){_0x2f6c79=_0x2f6c79||0xcc;return function(_0x1c29e0){if(_0x1c29e0){return _0x394562[_0xeb79('0x23')](_0x2f6c79);}return _0x394562[_0xeb79('0x24')](_0x2f6c79)[_0xeb79('0x25')]();};}function respondWithResult(_0x301da5,_0x4a46c8){_0x4a46c8=_0x4a46c8||0xc8;return function(_0x35f175){if(_0x35f175){return _0x301da5['status'](_0x4a46c8)[_0xeb79('0x26')](_0x35f175);}};}function respondWithFilteredResult(_0x3f657a,_0x4ff664){return function(_0x582fd7){if(_0x582fd7){var _0x2f7074=typeof _0x4ff664[_0xeb79('0x27')]===_0xeb79('0x28')&&typeof _0x4ff664[_0xeb79('0x29')]===_0xeb79('0x28');var _0x4300c0=_0x582fd7[_0xeb79('0x2a')];var _0x171a47=_0x2f7074?0x0:_0x4ff664['offset'];var _0x12d326=_0x2f7074?_0x582fd7[_0xeb79('0x2a')]:_0x4ff664[_0xeb79('0x27')]+_0x4ff664['limit'];var _0x1a6ce6;if(_0x12d326>=_0x4300c0){_0x12d326=_0x4300c0;_0x1a6ce6=0xc8;}else{_0x1a6ce6=0xce;}_0x3f657a[_0xeb79('0x24')](_0x1a6ce6);return _0x3f657a[_0xeb79('0x2b')](_0xeb79('0x2c'),_0x171a47+'-'+_0x12d326+'/'+_0x4300c0)['json'](_0x582fd7);}return null;};}function patchUpdates(_0x5c9a09){return function(_0x165fcf){try{jsonpatch['apply'](_0x165fcf,_0x5c9a09,!![]);}catch(_0x2a8321){return BPromise[_0xeb79('0x2d')](_0x2a8321);}return _0x165fcf[_0xeb79('0x2e')]();};}function saveUpdates(_0x3cc78a,_0x3bb083){return function(_0x170dca){if(_0x170dca){return _0x170dca['update'](_0x3cc78a)['then'](function(_0x4c4f12){return _0x4c4f12;});}return null;};}function removeEntity(_0x48d1ba,_0x54c319){return function(_0x402fbf){if(_0x402fbf){return _0x402fbf[_0xeb79('0x2f')]()[_0xeb79('0x30')](function(){_0x48d1ba[_0xeb79('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126a5f,_0x54e8bc){return function(_0x55c008){if(!_0x55c008){_0x126a5f[_0xeb79('0x23')](0x194);}return _0x55c008;};}function handleError(_0x47148d,_0x47a5d5){_0x47a5d5=_0x47a5d5||0x1f4;return function(_0x38ebf3){logger['error'](_0x38ebf3[_0xeb79('0x31')]);if(_0x38ebf3[_0xeb79('0x32')]){delete _0x38ebf3[_0xeb79('0x32')];}_0x47148d[_0xeb79('0x24')](_0x47a5d5)[_0xeb79('0x33')](_0x38ebf3);};}function getInteractionUsers(_0x4844c2,_0x349f9e){return new BPromise(function(_0x48845f,_0xa21385){try{if(_0x349f9e[_0x4844c2['id']]){_0x4844c2[_0xeb79('0x34')]=_[_0xeb79('0x35')](_0x349f9e[_0x4844c2['id']],function(_0x32dbec){return{'id':_0x32dbec['id'],'fullname':_0x32dbec[_0xeb79('0x36')]};});}}catch(_0x30497b){_0xa21385(_0x30497b);}_0x48845f(_0x4844c2);});}function getInteractionTags(_0x54f7d7,_0x55ed76){return new BPromise(function(_0x41ac57,_0x199ed5){try{if(_0x54f7d7[_0xeb79('0x37')]){_0x54f7d7[_0xeb79('0x38')]=[];_0x54f7d7[_0xeb79('0x37')][_0xeb79('0x39')](',')[_0xeb79('0x3a')](function(_0x45339b){_0x54f7d7['Tags']['push'](_0x55ed76[_0x45339b]);});}delete _0x54f7d7[_0xeb79('0x37')];}catch(_0x23e178){_0x199ed5(_0x23e178);}_0x41ac57(_0x54f7d7);});}function updateOpenchannelInteraction(_0x559664,_0x16a767,_0xb85417){return new BPromise(function(_0x1026b1,_0x1b037f){return getInteractionUsers(_0x559664,_0xb85417)[_0xeb79('0x30')](function(_0xbaa22c){return getInteractionTags(_0xbaa22c,_0x16a767);})[_0xeb79('0x30')](function(_0x1be944){_0x1026b1(_0x1be944);})[_0xeb79('0x3b')](function(_0x5f1b57){_0x1b037f(_0x5f1b57);});});}exports[_0xeb79('0x3c')]=function(_0x5b5569,_0x53269f){var _0x4029a9={},_0x44b529={},_0x32673e={'count':0x0,'rows':[]};var _0x65c7ad=_[_0xeb79('0x35')](db['OpenchannelInteraction'][_0xeb79('0x3d')],function(_0x462470){return{'name':_0x462470[_0xeb79('0x3e')],'type':_0x462470[_0xeb79('0x3f')][_0xeb79('0x40')]};});_0x44b529[_0xeb79('0x41')]=_[_0xeb79('0x35')](_0x65c7ad,_0xeb79('0x32'));_0x44b529[_0xeb79('0x42')]=_[_0xeb79('0x43')](_0x5b5569[_0xeb79('0x42')]);_0x44b529[_0xeb79('0x44')]=_['intersection'](_0x44b529[_0xeb79('0x41')],_0x44b529[_0xeb79('0x42')]);_0x4029a9[_0xeb79('0x45')]=_['intersection'](_0x44b529[_0xeb79('0x41')],qs[_0xeb79('0x46')](_0x5b5569[_0xeb79('0x42')][_0xeb79('0x46')]));_0x4029a9[_0xeb79('0x45')]=_0x4029a9['attributes'][_0xeb79('0x47')]?_0x4029a9[_0xeb79('0x45')]:_0x44b529[_0xeb79('0x41')];if(!_0x5b5569[_0xeb79('0x42')][_0xeb79('0x48')]('nolimit')){_0x4029a9[_0xeb79('0x29')]=qs[_0xeb79('0x29')](_0x5b5569[_0xeb79('0x42')]['limit']);_0x4029a9[_0xeb79('0x27')]=qs['offset'](_0x5b5569['query']['offset']);}_0x4029a9['order']=qs['sort'](_0x5b5569['query'][_0xeb79('0x49')]);_0x4029a9[_0xeb79('0x4a')]=qs[_0xeb79('0x44')](_['pick'](_0x5b5569[_0xeb79('0x42')],_0x44b529['filters']),_0x65c7ad);var _0x4c50ac=[];var _0x146f6a=squel[_0xeb79('0x4b')]()[_0xeb79('0x4c')]('id')['field'](_0xeb79('0x32'))[_0xeb79('0x4c')]('color')[_0xeb79('0x4d')](_0xeb79('0x4e'));var _0xcdfc72=squel[_0xeb79('0x4b')]()['field'](_0xeb79('0x4f'))['field'](_0xeb79('0x50'))[_0xeb79('0x4c')](_0xeb79('0x51'))[_0xeb79('0x4d')](_0xeb79('0x52'),'ui')[_0xeb79('0x53')](_0xeb79('0x54'),'u',_0xeb79('0x55'));var _0x17ec94=squel[_0xeb79('0x4b')]()['from'](_0xeb79('0x56'),'i')[_0xeb79('0x53')](_0xeb79('0x57'),'c',_0xeb79('0x58'))[_0xeb79('0x53')]('users','o',_0xeb79('0x59'))[_0xeb79('0x53')](_0xeb79('0x5a'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xeb79('0x53')](_0xeb79('0x5b'),'me',_0xeb79('0x5c'))[_0xeb79('0x53')](_0xeb79('0x5d'),'it',_0xeb79('0x5e'))[_0xeb79('0x53')]('tools_tags','t',_0xeb79('0x5f'));var _0xb2b2d9=squel[_0xeb79('0x60')]();var _0x47854e=[];var _0x5d6c2d=squel['expr']();var _0x3f54ea;if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x61')]){_0x3f54ea=as[_0xeb79('0x62')](_0x5b5569[_0xeb79('0x42')][_0xeb79('0x61')]);var _0x35f6eb=_0x3f54ea[_0xeb79('0x63')];for(var _0x35631f=0x0;_0x35631f<_0x3f54ea[_0xeb79('0x64')][_0xeb79('0x47')];_0x35631f++){var _0x4a83e2=_0x3f54ea[_0xeb79('0x64')][_0x35631f];var _0x230924='i';var _0x1bb39f=_[_0xeb79('0x65')](_0x65c7ad,['name',_0x4a83e2['field']]);if(!_0x1bb39f){switch(_0x4a83e2[_0xeb79('0x4c')]){case'unreadMessages':if(_0x4a83e2['value']==0x1){_0x17ec94[_0xeb79('0x66')]('`'+_0x4a83e2[_0xeb79('0x4c')]+'`\x20=\x200');}else{_0x17ec94[_0xeb79('0x66')]('`'+_0x4a83e2[_0xeb79('0x4c')]+'`\x20>\x200');}break;case _0xeb79('0x67'):if(_0x4a83e2[_0xeb79('0x68')]===_0xeb79('0x69')){if(_0x4a83e2[_0xeb79('0x6a')][_0xeb79('0x39')]('\x20')[_0xeb79('0x47')]>0x1){_0xb2b2d9[_0x35f6eb](_0xeb79('0x6b'),qs[_0xeb79('0x6c')](_0x4a83e2[_0xeb79('0x6a')]),null);}else{var _0x3a5ed6='%'+_0x4a83e2[_0xeb79('0x6a')]+'%';_0xb2b2d9[_0x35f6eb](_0xeb79('0x6d'),_0x3a5ed6,_0x3a5ed6,_0x3a5ed6);}}else{_0x1bb39f=_[_0xeb79('0x65')](_0x65c7ad,[_0xeb79('0x32'),_0xeb79('0x6e')]);_0x4a83e2['field']='ContactId';_0x49a26e=as[_0xeb79('0x6f')](_0x230924,_0x1bb39f[_0xeb79('0x3f')],_0x4a83e2);_0xb2b2d9[_0x35f6eb](_0x49a26e[_0xeb79('0x70')],_0x49a26e[_0xeb79('0x6a')][_0xeb79('0x71')],_0x49a26e[_0xeb79('0x6a')]['end']);}break;case'Tag':var _0x51a0c4=_0x4a83e2[_0xeb79('0x6a')][_0xeb79('0x39')](',')[_0xeb79('0x35')](function(_0x343d02){return Number(_0x343d02);});_0x51a0c4[_0xeb79('0x3a')](function(_0x476c69){_0x5d6c2d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x476c69+',%');});_0x47854e=_[_0xeb79('0x72')](_0x47854e,_0x51a0c4);break;case _0xeb79('0x73'):if(_0x4a83e2[_0xeb79('0x68')]===_0xeb79('0x69')){_0xb2b2d9[_0x35f6eb](_0xeb79('0x74'),'%'+_0x4a83e2[_0xeb79('0x6a')]+'%',null);}else{_0x1bb39f=_[_0xeb79('0x65')](_0x65c7ad,[_0xeb79('0x32'),_0xeb79('0x75')]);_0x4a83e2[_0xeb79('0x4c')]='UserId';_0x49a26e=as[_0xeb79('0x6f')](_0x230924,_0x1bb39f[_0xeb79('0x3f')],_0x4a83e2);_0xb2b2d9[_0x35f6eb](_0x49a26e[_0xeb79('0x70')],_0x49a26e[_0xeb79('0x6a')][_0xeb79('0x71')],_0x49a26e['value'][_0xeb79('0x25')]);}break;case _0xeb79('0x76'):_0x49a26e=as['buildExpression']('me',null,_0x4a83e2);_0xb2b2d9[_0x35f6eb](_0x49a26e[_0xeb79('0x70')],_0x49a26e[_0xeb79('0x6a')]['start'],_0x49a26e[_0xeb79('0x6a')][_0xeb79('0x25')]);break;}}else{var _0x49a26e=as[_0xeb79('0x6f')](_0x230924,_0x1bb39f[_0xeb79('0x3f')],_0x4a83e2);_0xb2b2d9[_0x35f6eb](_0x49a26e[_0xeb79('0x70')],_0x49a26e[_0xeb79('0x6a')][_0xeb79('0x71')],_0x49a26e['value'][_0xeb79('0x25')]);}}}else{var _0x486223=_(_0x5b5569[_0xeb79('0x42')])[_0xeb79('0x43')]()[_0xeb79('0x35')](function(_0x25d5e9){return _[_0xeb79('0x77')](_0x65c7ad,[_0xeb79('0x32'),_0x25d5e9])?_0x25d5e9:undefined;})[_0xeb79('0x78')]()[_0xeb79('0x6a')]();if(!_[_0xeb79('0x79')](_0x486223)){_0x486223['forEach'](function(_0x57d9ee){if(_0x57d9ee===_0xeb79('0x7a')){_0x17ec94[_0xeb79('0x4a')](_0xeb79('0x7b'),[][_0xeb79('0x7c')](_0x5b5569['query'][_0x57d9ee]));}else if(_0x57d9ee===_0xeb79('0x7d')){var _0x2449a4=JSON['parse'](_0x5b5569[_0xeb79('0x42')][_0x57d9ee])[_0xeb79('0x7e')];var _0x5d842d=JSON[_0xeb79('0x7f')](_0x5b5569[_0xeb79('0x42')][_0x57d9ee])[_0xeb79('0x80')];_0x17ec94[_0xeb79('0x4a')](_0xeb79('0x81'),_0x2449a4,_0x5d842d);}else{if(_0x5b5569[_0xeb79('0x42')][_0x57d9ee]==='null'){_0x17ec94[_0xeb79('0x4a')]('i.'+_0x57d9ee+_0xeb79('0x82'));}else{_0x17ec94[_0xeb79('0x4a')]('i.'+_0x57d9ee+'\x20=\x20?',_0x5b5569[_0xeb79('0x42')][_0x57d9ee]);}}});}if(_0x5b5569['query'][_0xeb79('0x83')]){if(_0x5b5569['query'][_0xeb79('0x83')]==0x1){_0x17ec94[_0xeb79('0x66')]('`unreadMessages`\x20=\x200');}else{_0x17ec94[_0xeb79('0x66')]('`unreadMessages`\x20>\x200');}}if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x84')]){_0x47854e=_[_0xeb79('0x85')](_0x5b5569['query'][_0xeb79('0x84')])?_0x5b5569['query']['tag']:new Array(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x84')]);_0x47854e[_0xeb79('0x3a')](function(_0x282f7c){_0x5d6c2d['or'](_0xeb79('0x86'),'%,'+_0x282f7c+',%');});}if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x87')]){var _0x472dec=_0x5b5569[_0xeb79('0x42')]['filter'][_0xeb79('0x88')]('\x5c','\x5c\x5c')[_0xeb79('0x88')](/'/g,'\x27\x27');if(qs[_0xeb79('0x89')](_0x472dec)){_0xb2b2d9['or'](_0xeb79('0x8a'),_0x472dec+'%');}else{_0xb2b2d9['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xeb79('0x6c')](_0x472dec))['or'](_0xeb79('0x8b'),_0x472dec+'%')['or'](_0xeb79('0x8c'),_0x472dec+'%');}}}_0x17ec94[_0xeb79('0x4a')](_0xb2b2d9);_0x17ec94[_0xeb79('0x8d')](_0xeb79('0x8e'));var _0x4c1a11={'type':db[_0xeb79('0x8f')][_0xeb79('0x90')][_0xeb79('0x91')],'raw':!![]};var _0x10b2eb=_0x17ec94[_0xeb79('0x92')]();_0x10b2eb[_0xeb79('0x4c')](_0xeb79('0x8e'));_0x10b2eb['field'](_0xeb79('0x93'),'unreadMessages');if(_0x4029a9[_0xeb79('0x94')]){_0x4029a9['order']['forEach'](function(_0x3ee0ec){var _0x3a0955=_0x3ee0ec[0x0]===_0xeb79('0x95')?_0x3ee0ec[0x0]:'i.'+_0x3ee0ec[0x0];_0x17ec94[_0xeb79('0x94')](_0x3a0955,_0x3ee0ec[0x1]===_0xeb79('0x96')?![]:!![]);});}if(!_[_0xeb79('0x79')](_0x47854e)){_0x17ec94[_0xeb79('0x66')](_0x5d6c2d);_0x10b2eb[_0xeb79('0x4a')]('t.id\x20IN\x20?',_0x47854e);}BPromise[_0xeb79('0x97')]()['then'](function(){if(!_0x3f54ea){if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x7a')])return;_0x10b2eb['where'](_0xeb79('0x98'));_0x17ec94['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5b5569[_0xeb79('0x99')][_0xeb79('0x9a')]!==_0xeb79('0x9b'))return;return _0x5b5569[_0xeb79('0x99')][_0xeb79('0x9c')]({'attributes':['id'],'raw':!![]})[_0xeb79('0x30')](function(_0xa811c9){if(_['isEmpty'](_0xa811c9)){_0x10b2eb[_0xeb79('0x4a')](_0xeb79('0x9d'));_0x17ec94[_0xeb79('0x4a')](_0xeb79('0x9d'));}else{_0x10b2eb[_0xeb79('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xeb79('0x35')](_0xa811c9,'id'));_0x17ec94['where'](_0xeb79('0x7b'),_[_0xeb79('0x35')](_0xa811c9,'id'));}});})['then'](function(){if(_0x5b5569[_0xeb79('0x99')][_0xeb79('0x9a')]===_0xeb79('0x9b')&&!_0x3f54ea&&!_0x5b5569['query'][_0xeb79('0x7a')])return[];return db[_0xeb79('0x9e')][_0xeb79('0x42')](_0x10b2eb[_0xeb79('0x9f')](),_0x4c1a11);})['then'](function(_0x3bea21){_0x32673e[_0xeb79('0x2a')]=_0x3bea21[_0xeb79('0x47')];if(_0x32673e[_0xeb79('0x2a')]===0x0)return[];return db['sequelize']['query'](_0x146f6a[_0xeb79('0x9f')](),_0x4c1a11)[_0xeb79('0x30')](function(_0x4c43df){_0x4c50ac=_['keyBy'](_0x4c43df,'id');_0x4c1a11=_[_0xeb79('0xa0')](_0x4c1a11,{'model':db[_0xeb79('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b5569[_0xeb79('0x42')][_0xeb79('0x46')]){_0x4029a9[_0xeb79('0x45')][_0xeb79('0x3a')](function(_0x589563){_0x17ec94[_0xeb79('0x4c')]('i.'+_0x589563);});}else{_0x17ec94[_0xeb79('0x4c')](_0xeb79('0x93'),_0xeb79('0xa2'));_0x17ec94['field']('a.key','Account.key');_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xa3'),_0xeb79('0xa4'));_0x17ec94[_0xeb79('0x4c')]('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',_0xeb79('0x95'));_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xa5'));_0x17ec94['field'](_0xeb79('0xa6'),'Contact.firstName');_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xa7'),_0xeb79('0xa8'));_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xa9'),_0xeb79('0xaa'));_0x17ec94['field'](_0xeb79('0xab'),'Contact.phone');_0x17ec94[_0xeb79('0x4c')](_0xeb79('0xac'),_0xeb79('0xad'));_0x17ec94[_0xeb79('0x4c')]('c.fax',_0xeb79('0xae'));_0x17ec94['field'](_0xeb79('0xaf'),_0xeb79('0xb0'));_0x17ec94[_0xeb79('0x4c')]('o.internal',_0xeb79('0xb1'));_0x17ec94['field'](_0xeb79('0xb2'),'TagIds');}if(_0x4029a9['limit'])_0x17ec94[_0xeb79('0x29')](_0x4029a9[_0xeb79('0x29')]);if(_0x4029a9[_0xeb79('0x27')])_0x17ec94[_0xeb79('0x27')](_0x4029a9['offset']);return db[_0xeb79('0x9e')][_0xeb79('0x42')](_0x17ec94[_0xeb79('0x9f')](),_0x4c1a11);})[_0xeb79('0x30')](function(_0x572be2){if(_0x572be2[_0xeb79('0x47')]>0x0)_0xcdfc72['where'](_0xeb79('0xb3'),_[_0xeb79('0x35')](_0x572be2,'id'));return db[_0xeb79('0x9e')][_0xeb79('0x42')](_0xcdfc72[_0xeb79('0x9f')](),_0x4c1a11)[_0xeb79('0x30')](function(_0x4ecbbd){var _0x29968d=_[_0xeb79('0xb4')](_0x4ecbbd,'OpenchannelInteractionId');var _0x262760=[];_0x572be2[_0xeb79('0x3a')](function(_0x2ea0fb){_0x262760[_0xeb79('0xb5')](updateOpenchannelInteraction(_0x2ea0fb,_0x4c50ac,_0x29968d));});return BPromise[_0xeb79('0xb6')](_0x262760);});});})[_0xeb79('0x30')](function(_0x28dcaa){_0x32673e[_0xeb79('0xb7')]=_0x28dcaa;return _0x32673e;})['then'](respondWithFilteredResult(_0x53269f,_0x4029a9))[_0xeb79('0x3b')](handleError(_0x53269f,null));};exports['show']=function(_0x38e96f,_0x48252f){var _0x2eaa50={};if(_0x38e96f[_0xeb79('0x42')][_0xeb79('0x3f')]&&_0x38e96f[_0xeb79('0x42')][_0xeb79('0x3f')]==='from'){_0x2eaa50[_0xeb79('0x4d')]=_0x38e96f['params']['id'];}else{_0x2eaa50['id']=_0x38e96f['params']['id'];}var _0x18c5a7={'raw':![],'where':_0x2eaa50},_0x527972={};_0x527972[_0xeb79('0x41')]=_[_0xeb79('0x43')](db[_0xeb79('0xa1')][_0xeb79('0x3d')]);_0x527972[_0xeb79('0x42')]=_[_0xeb79('0x43')](_0x38e96f[_0xeb79('0x42')]);_0x527972[_0xeb79('0x44')]=_[_0xeb79('0xb8')](_0x527972[_0xeb79('0x41')],_0x527972[_0xeb79('0x42')]);_0x18c5a7[_0xeb79('0x45')]=_['intersection'](_0x527972[_0xeb79('0x41')],qs[_0xeb79('0x46')](_0x38e96f[_0xeb79('0x42')]['fields']));_0x18c5a7['attributes']=_0x18c5a7[_0xeb79('0x45')][_0xeb79('0x47')]?_0x18c5a7[_0xeb79('0x45')]:_0x527972[_0xeb79('0x41')];if(_0x38e96f[_0xeb79('0x42')]['includeAll']){_0x18c5a7['include']=[{'all':!![]}];}_0x18c5a7=_[_0xeb79('0xa0')]({},_0x18c5a7,_0x38e96f[_0xeb79('0xb9')]);return db[_0xeb79('0xa1')]['find'](_0x18c5a7)['then'](handleEntityNotFound(_0x48252f,null))[_0xeb79('0x30')](respondWithResult(_0x48252f,null))[_0xeb79('0x3b')](handleError(_0x48252f,null));};exports[_0xeb79('0xba')]=function(_0x205fc6,_0x14ecd3){return db[_0xeb79('0xa1')][_0xeb79('0xba')](_0x205fc6[_0xeb79('0x76')],{})['then'](respondWithResult(_0x14ecd3,0xc9))[_0xeb79('0x3b')](handleError(_0x14ecd3,null));};exports[_0xeb79('0xbb')]=function(_0x1c8419,_0x41ed36){if(_0x1c8419[_0xeb79('0x76')]['id']){delete _0x1c8419[_0xeb79('0x76')]['id'];}return db[_0xeb79('0xa1')][_0xeb79('0x65')]({'where':{'id':_0x1c8419[_0xeb79('0xbc')]['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x41ed36,null))['then'](saveUpdates(_0x1c8419[_0xeb79('0x76')],null))[_0xeb79('0x30')](respondWithResult(_0x41ed36,null))['catch'](handleError(_0x41ed36,null));};exports[_0xeb79('0x2f')]=function(_0x4d6c2c,_0x227575){return db[_0xeb79('0xa1')]['find']({'where':{'id':_0x4d6c2c[_0xeb79('0xbc')]['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x227575,null))[_0xeb79('0x30')](removeEntity(_0x227575,null))[_0xeb79('0x3b')](handleError(_0x227575,null));};exports[_0xeb79('0xbd')]=function(_0x60aee7,_0x1cb9dc){return db[_0xeb79('0xa1')][_0xeb79('0xbd')]()[_0xeb79('0x30')](respondWithResult(_0x1cb9dc,null))[_0xeb79('0x3b')](handleError(_0x1cb9dc,null));};exports[_0xeb79('0xbe')]=function(_0x4370fc,_0x4e6788,_0x43092b){return db[_0xeb79('0xbf')]['find']({'where':{'id':_0x4370fc['params']['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x4e6788,null))[_0xeb79('0x30')](function(_0x4dbb31){if(_0x4dbb31){return _0x4dbb31['addMessage'](_0x4370fc[_0xeb79('0x76')][_0xeb79('0xc0')],_['omit'](_0x4370fc[_0xeb79('0x76')],[_0xeb79('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x4e6788,null))['catch'](handleError(_0x4e6788,null));};exports[_0xeb79('0xc1')]=function(_0x637993,_0x25eec5,_0x497085){var _0x429284={'raw':![],'where':{}};var _0xb003a5={};var _0x4d17eb={'count':0x0,'rows':[]};return db[_0xeb79('0xa1')][_0xeb79('0xc2')]({'where':{'id':_0x637993[_0xeb79('0xbc')]['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x25eec5,null))[_0xeb79('0x30')](function(_0x4d19ca){if(_0x4d19ca){_0xb003a5[_0xeb79('0x41')]=_[_0xeb79('0x43')](db['OpenchannelMessage']['rawAttributes']);_0xb003a5[_0xeb79('0x42')]=_[_0xeb79('0x43')](_0x637993[_0xeb79('0x42')]);_0xb003a5[_0xeb79('0x44')]=_[_0xeb79('0xb8')](_0xb003a5[_0xeb79('0x41')],_0xb003a5['query']);_0x429284[_0xeb79('0x45')]=_['intersection'](_0xb003a5[_0xeb79('0x41')],qs['fields'](_0x637993['query'][_0xeb79('0x46')]));_0x429284[_0xeb79('0x45')]=_0x429284['attributes'][_0xeb79('0x47')]?_0x429284[_0xeb79('0x45')]:_0xb003a5[_0xeb79('0x41')];if(!_0x637993[_0xeb79('0x42')][_0xeb79('0x48')](_0xeb79('0xc3'))){_0x429284[_0xeb79('0x29')]=qs[_0xeb79('0x29')](_0x637993[_0xeb79('0x42')][_0xeb79('0x29')]);_0x429284[_0xeb79('0x27')]=qs[_0xeb79('0x27')](_0x637993[_0xeb79('0x42')][_0xeb79('0x27')]);}_0x429284[_0xeb79('0x94')]=qs[_0xeb79('0x49')](_0x637993[_0xeb79('0x42')]['sort']);_0x429284['where']=qs[_0xeb79('0x44')](_[_0xeb79('0xc4')](_0x637993['query'],_0xb003a5[_0xeb79('0x44')]));_0x429284[_0xeb79('0x4a')][_0xeb79('0xc5')]=_0x4d19ca['id'];if(_0x637993[_0xeb79('0x42')][_0xeb79('0x87')]){_0x429284[_0xeb79('0x4a')]=_[_0xeb79('0xa0')](_0x429284[_0xeb79('0x4a')],{'$or':_['map'](_0x429284[_0xeb79('0x45')],function(_0x151861){var _0x3c048c={};_0x3c048c[_0x151861]={'$like':'%'+_0x637993['query'][_0xeb79('0x87')]+'%'};return _0x3c048c;})});}if(_0x637993[_0xeb79('0x42')]['$gte']){var _0x1969e5=_0x637993[_0xeb79('0x42')][_0xeb79('0x7e')]['split'](',');var _0x253934={};_0x253934[_0x1969e5[0x0]]={'$gte':moment(_0x1969e5[0x1])[_0xeb79('0xc6')](_0xeb79('0xc7'))};_0x429284[_0xeb79('0x4a')]=_['merge'](_0x429284[_0xeb79('0x4a')],_0x253934);}_0x429284=_[_0xeb79('0xa0')]({},_0x429284,_0x637993[_0xeb79('0xb9')]);return db[_0xeb79('0xbf')][_0xeb79('0x2a')]({'where':_0x429284[_0xeb79('0x4a')]})[_0xeb79('0x30')](function(_0x57406b){_0x4d17eb['count']=_0x57406b;if(_0x637993['query']['includeAll']){_0x429284[_0xeb79('0xc8')]=[{'all':!![]}];}return db[_0xeb79('0xbf')][_0xeb79('0xc9')](_0x429284);})[_0xeb79('0x30')](function(_0x1c58bf){_0x4d17eb[_0xeb79('0xb7')]=_0x1c58bf;return _0x4d17eb;});}})[_0xeb79('0x30')](respondWithFilteredResult(_0x25eec5,_0x429284))[_0xeb79('0x3b')](handleError(_0x25eec5,null));};exports[_0xeb79('0xca')]=function(_0x40c76b,_0x1d60e0,_0x3a7815){return db[_0xeb79('0xa1')]['find']({'where':{'id':_0x40c76b[_0xeb79('0xbc')]['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x1d60e0,null))['then'](function(_0x26d26c){if(_0x26d26c){return _0x26d26c[_0xeb79('0xcb')](_0x40c76b['body'][_0xeb79('0xc0')],_['omit'](_0x40c76b['body'],['ids','id'])||{})[_0xeb79('0xcc')](function(){return db[_0xeb79('0xcd')]['findAll']({'attributes':['id',_0xeb79('0x32'),_0xeb79('0xce')],'where':{'id':_0x40c76b[_0xeb79('0x76')][_0xeb79('0xc0')]}});})['then'](function(_0x7d918e){socket[_0xeb79('0xcf')]('openchannelInteractionTags:save',{'id':Number(_0x40c76b[_0xeb79('0xbc')]['id']),'tags':_0x7d918e||[]});return{'id':Number(_0x40c76b['params']['id']),'tags':_0x7d918e||[]};});}})[_0xeb79('0x30')](respondWithResult(_0x1d60e0,null))[_0xeb79('0x3b')](handleError(_0x1d60e0,null));};exports['removeTags']=function(_0x3532ad,_0x42ba2e,_0x28a4da){return db[_0xeb79('0xa1')][_0xeb79('0x65')]({'where':{'id':_0x3532ad['params']['id']}})[_0xeb79('0x30')](handleEntityNotFound(_0x42ba2e,null))[_0xeb79('0x30')](function(_0x288a6e){if(_0x288a6e){return _0x288a6e['removeTags'](_0x3532ad[_0xeb79('0x42')][_0xeb79('0xc0')]);}})[_0xeb79('0x30')](respondWithStatusCode(_0x42ba2e,null))['catch'](handleError(_0x42ba2e,null));};exports[_0xeb79('0xd0')]=function(_0x5d8398,_0x7f128b){var _0x2f6948=moment()['unix']()[_0xeb79('0x9f')]();var _0x593144=path[_0xeb79('0xd1')](config['root'],'server',_0xeb79('0xd2'),'tmp');var _0x5ac21e=path['join'](config[_0xeb79('0xd3')],_0xeb79('0xd4'),_0xeb79('0xd2'),'attachments');var _0x12189b=path[_0xeb79('0xd1')](_0x593144,_0x2f6948);var _0x1e75d7=util[_0xeb79('0xc6')](_0xeb79('0xd5'),_0x5d8398[_0xeb79('0xbc')]['id'],_0x2f6948);var _0x44b461=path[_0xeb79('0xd1')](_0x593144,_0x1e75d7);var _0x1b176d=[];_0x1b176d[_0xeb79('0xb5')]({'model':db[_0xeb79('0x73')],'as':_0xeb79('0x73'),'attributes':['id',_0xeb79('0x36')],'raw':!![]});_0x1b176d['push']({'model':db[_0xeb79('0xd6')],'as':'Contact','attributes':['id',_0xeb79('0xd7'),'lastName'],'raw':!![]});if(_0x5d8398['query'][_0xeb79('0xd8')]){_0x1b176d[_0xeb79('0xb5')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x1bc967=[{'model':db[_0xeb79('0xbf')],'as':_0xeb79('0xd9'),'attributes':['id',_0xeb79('0x76'),_0xeb79('0x7d'),_0xeb79('0xda'),_0xeb79('0xdb'),_0xeb79('0x83')],'include':_0x1b176d}];_0x1bc967['push']({'model':db[_0xeb79('0xdc')],'as':'Account','attributes':['id',_0xeb79('0x32')]});_0x1bc967[_0xeb79('0xb5')]({'model':db['User'],'as':_0xeb79('0xdd'),'attributes':['id',_0xeb79('0x36')]});return db[_0xeb79('0xa1')][_0xeb79('0x65')]({'where':{'id':_0x5d8398[_0xeb79('0xbc')]['id']},'include':_0x1bc967})['then'](handleEntityNotFound(_0x7f128b,null))[_0xeb79('0x30')](function(_0x4edde1){if(_0x4edde1){var _0x39fb07=_0x4edde1[_0xeb79('0xde')]({'plain':!![]});fs[_0xeb79('0xdf')](_0x12189b);var _0x3767ce={'channel':_0xeb79('0xe0'),'account':_0x39fb07[_0xeb79('0xe1')][_0xeb79('0x32')],'agent':_0x39fb07[_0xeb79('0xdd')]?_0x39fb07[_0xeb79('0xdd')]['fullname']:_0xeb79('0xe2'),'createdAt':moment(_0x39fb07['createdAt'])[_0xeb79('0xc6')](_0xeb79('0xc7'))[_0xeb79('0x9f')](),'closedAt':_0x39fb07[_0xeb79('0xe3')]?moment(_0x39fb07[_0xeb79('0xe4')])[_0xeb79('0xc6')](_0xeb79('0xc7'))[_0xeb79('0x9f')]():'','disposition':_0x39fb07[_0xeb79('0xe5')],'visibility':_0x39fb07[_0xeb79('0xe6')]?_0xeb79('0xe7'):'Private','messages':_(_0x39fb07[_0xeb79('0xd9')])['filter']({'secret':![]})[_0xeb79('0x35')](function(_0x205dd2){if(_0x205dd2[_0xeb79('0xe8')]){var _0x51e1be=path['join'](_0x5ac21e,_0x205dd2[_0xeb79('0xe8')]['basename']);if(fs[_0xeb79('0xe9')](_0x51e1be)){fs[_0xeb79('0xea')](_0x51e1be)['pipe'](fs[_0xeb79('0xeb')](path['join'](_0x12189b,_0x205dd2[_0xeb79('0xe8')][_0xeb79('0xec')])));}}return{'date':moment(_0x205dd2[_0xeb79('0x7d')])[_0xeb79('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')[_0xeb79('0x9f')](),'sender':_0x205dd2[_0xeb79('0xda')]==='out'?_0x205dd2[_0xeb79('0x73')]?_0x205dd2[_0xeb79('0x73')][_0xeb79('0x36')]:'System':_0x205dd2[_0xeb79('0x67')]['firstName']+(_0x205dd2[_0xeb79('0x67')][_0xeb79('0xed')]?'\x20'+_0x205dd2[_0xeb79('0x67')][_0xeb79('0xed')]:''),'body':_0x205dd2[_0xeb79('0xe8')]?_0x205dd2[_0xeb79('0xe8')]['basename']:_0x205dd2[_0xeb79('0x76')],'direction':_0x205dd2[_0xeb79('0xda')]===_0xeb79('0xee')?'A':'C','secret':_0x205dd2[_0xeb79('0xdb')],'read':_0x205dd2[_0xeb79('0x83')],'attachment':_0x205dd2['Attachment']};})[_0xeb79('0x6a')]()};return ejs[_0xeb79('0xef')](path['join'](config[_0xeb79('0xd3')],_0xeb79('0xd4'),_0xeb79('0xf0'),_0xeb79('0xf1')),{'interaction':_0x3767ce})['then'](function(_0x5ba7c9){var _0x4e757e=path['join'](_0x12189b,_0xeb79('0xf2')+_0x39fb07['id']+'-'+_0x2f6948+_0xeb79('0xf3'));var _0xfed8e2={'path':_0x4e757e,'channel':'Openchannel','interactionId':_0x39fb07['id']};return pdf[_0xeb79('0xf4')](_0x5ba7c9,_0xfed8e2);})[_0xeb79('0x30')](function(){return new BPromise(function(_0x146ccb,_0x4d5376){zipdir(_0x12189b,{'saveTo':_0x44b461},function(_0x80daa9,_0x54bf1c){if(_0x80daa9)return _0x4d5376(_0x80daa9);return _0x146ccb(_0x54bf1c);});})[_0xeb79('0x30')](function(){return new BPromise(function(_0x358515,_0x3fe073){rimraf(_0x12189b,function(_0x2c16a0){if(_0x2c16a0)_0x3fe073(_0x2c16a0);return _0x358515();});});})[_0xeb79('0x30')](function(){return _0x7f128b[_0xeb79('0xd0')](_0x44b461,_0x1e75d7,function(_0x45100f){if(_0x45100f){console[_0xeb79('0xf5')]('err',_0x45100f);}else{fs[_0xeb79('0xf6')](_0x44b461);}});});});}else{return _0x7f128b[_0xeb79('0x23')](0xc8);}})[_0xeb79('0x3b')](handleError(_0x7f128b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 078559f..fde8ba6 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 _0x91aa=['save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x21e9e1,_0x170d53){var _0x2086ff=function(_0x3318ea){while(--_0x3318ea){_0x21e9e1['push'](_0x21e9e1['shift']());}};_0x2086ff(++_0x170d53);}(_0x91aa,0x127));var _0xa91a=function(_0x9fd912,_0x3cfcc0){_0x9fd912=_0x9fd912-0x0;var _0x3dd624=_0x91aa[_0x9fd912];return _0x3dd624;};'use strict';var EventEmitter=require(_0xa91a('0x0'));var OpenchannelInteraction=require(_0xa91a('0x1'))['db'][_0xa91a('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xa91a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa91a('0x4')](0x0);var events={'afterCreate':_0xa91a('0x5'),'afterUpdate':_0xa91a('0x6'),'afterDestroy':_0xa91a('0x7')};function emitEvent(_0x3dde36){return function(_0x334291,_0x448892,_0xf0b77f){_0x334291[_0xa91a('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x268db0){_0x334291[_0xa91a('0x9')](_0xa91a('0xa'),_0x268db0[_0xa91a('0xb')](function(_0x32d5d8){return{'id':_0x32d5d8['id']};}));return OpenchannelMessage[_0xa91a('0xc')]({'where':{'OpenchannelInteractionId':_0x334291['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa91a('0xd')](function(_0x5df909){_0x334291[_0xa91a('0x9')](_0xa91a('0xe'),_0x5df909[_0xa91a('0xf')]);OpenchannelInteractionEvents['emit'](_0x3dde36+':'+_0x334291['id'],_0x334291);OpenchannelInteractionEvents[_0xa91a('0x10')](_0x3dde36,_0x334291);_0xf0b77f(null);})[_0xa91a('0x11')](_0xf0b77f(null));};}for(var e in events){if(events[_0xa91a('0x12')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xa91a('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xa37e=['hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','map','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xa37e,0x1e9));var _0xea37=function(_0x1db7c4,_0x3ee62c){_0x1db7c4=_0x1db7c4-0x0;var _0x35bf98=_0xa37e[_0x1db7c4];return _0x35bf98;};'use strict';var EventEmitter=require(_0xea37('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xea37('0x1')];var OpenchannelMessage=require(_0xea37('0x2'))['db'][_0xea37('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xea37('0x4')](0x0);var events={'afterCreate':_0xea37('0x5'),'afterUpdate':_0xea37('0x6'),'afterDestroy':'remove'};function emitEvent(_0x470ea8){return function(_0x4bf4d3,_0x298d6d,_0x2ca15f){_0x4bf4d3[_0xea37('0x7')]({'attributes':['id'],'raw':!![]})[_0xea37('0x8')](function(_0x1f1255){_0x4bf4d3['setDataValue']('Users',_0x1f1255[_0xea37('0x9')](function(_0x47210b){return{'id':_0x47210b['id']};}));return OpenchannelMessage[_0xea37('0xa')]({'where':{'OpenchannelInteractionId':_0x4bf4d3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xea37('0x8')](function(_0x5ca548){_0x4bf4d3[_0xea37('0xb')](_0xea37('0xc'),_0x5ca548[_0xea37('0xd')]);OpenchannelInteractionEvents[_0xea37('0xe')](_0x470ea8+':'+_0x4bf4d3['id'],_0x4bf4d3);OpenchannelInteractionEvents[_0xea37('0xe')](_0x470ea8,_0x4bf4d3);_0x2ca15f(null);})['catch'](_0x2ca15f(null));};}for(var e in events){if(events[_0xea37('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xea37('0x10')](e,emitEvent(event));}}module[_0xea37('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9742125..a1747c4 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 _0x433f=['changed','closedAt','format','util','../../config/logger','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1c4b40,_0x138292){var _0x8cf74e=function(_0x4528e7){while(--_0x4528e7){_0x1c4b40['push'](_0x1c4b40['shift']());}};_0x8cf74e(++_0x138292);}(_0x433f,0x1b6));var _0xf433=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x433f[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xf433('0x0'));var logger=require(_0xf433('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf433('0x2'));var rp=require(_0xf433('0x3'));var fs=require('fs');var path=require(_0xf433('0x4'));var rimraf=require(_0xf433('0x5'));var config=require('../../config/environment');var attributes=require(_0xf433('0x6'));module[_0xf433('0x7')]=function(_0x535c80,_0xee66c8){return _0x535c80[_0xf433('0x8')]('OpenchannelInteraction',attributes,{'tableName':_0xf433('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf433('0xa'),'collate':_0xf433('0xb'),'hooks':{'beforeUpdate':function(_0x2cb68a,_0x59f476,_0x1e1601){if(_0x2cb68a[_0xf433('0xc')]('closed')){_0x2cb68a[_0xf433('0xd')]=moment()[_0xf433('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1e1601(null,_0x2cb68a);}}});}; \ No newline at end of file +var _0x30cd=['moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x2e87aa,_0x553dcb){var _0x4b25=function(_0x2d3612){while(--_0x2d3612){_0x2e87aa['push'](_0x2e87aa['shift']());}};_0x4b25(++_0x553dcb);}(_0x30cd,0x1e3));var _0xd30c=function(_0x25cacb,_0x49f700){_0x25cacb=_0x25cacb-0x0;var _0x382b5d=_0x30cd[_0x25cacb];return _0x382b5d;};'use strict';var _=require(_0xd30c('0x0'));var util=require(_0xd30c('0x1'));var logger=require(_0xd30c('0x2'))('api');var moment=require(_0xd30c('0x3'));var BPromise=require(_0xd30c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd30c('0x5'));var rimraf=require(_0xd30c('0x6'));var config=require(_0xd30c('0x7'));var attributes=require(_0xd30c('0x8'));module[_0xd30c('0x9')]=function(_0x352f7d,_0x699ce0){return _0x352f7d['define'](_0xd30c('0xa'),attributes,{'tableName':_0xd30c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd30c('0xc'),'collate':_0xd30c('0xd'),'hooks':{'beforeUpdate':function(_0x44af2e,_0x1d2d98,_0x23aef6){if(_0x44af2e[_0xd30c('0xe')](_0xd30c('0xf'))){_0x44af2e[_0xd30c('0x10')]=moment()[_0xd30c('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x23aef6(null,_0x44af2e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4042606..e52da6e 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 _0xf5a4=['request','then','request\x20sent','debug','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket'];(function(_0x259ccc,_0xa5fb99){var _0x353a33=function(_0x1835e6){while(--_0x1835e6){_0x259ccc['push'](_0x259ccc['shift']());}};_0x353a33(++_0xa5fb99);}(_0xf5a4,0x110));var _0x4f5a=function(_0x5d71c7,_0x1e2ea0){_0x5d71c7=_0x5d71c7-0x0;var _0x289b53=_0xf5a4[_0x5d71c7];return _0x289b53;};'use strict';var _=require(_0x4f5a('0x0'));var util=require(_0x4f5a('0x1'));var moment=require(_0x4f5a('0x2'));var BPromise=require(_0x4f5a('0x3'));var rs=require(_0x4f5a('0x4'));var fs=require('fs');var Redis=require(_0x4f5a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f5a('0x6'));var logger=require(_0x4f5a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4f5a('0x8'));var client=jayson[_0x4f5a('0x9')][_0x4f5a('0xa')]({'port':0x232a});config[_0x4f5a('0xb')]=_[_0x4f5a('0xc')](config['redis'],{'host':_0x4f5a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4f5a('0xe'))['register'](socket);function respondWithRpcPromise(_0x6b8992,_0x3cae5e,_0x3e7009){return new BPromise(function(_0x2d69ea,_0x5057f8){return client[_0x4f5a('0xf')](_0x6b8992,_0x3e7009)[_0x4f5a('0x10')](function(_0x4fea28){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x3cae5e,_0x4f5a('0x11'));logger[_0x4f5a('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3cae5e,_0x4f5a('0x11'),JSON['stringify'](_0x4fea28));if(_0x4fea28[_0x4f5a('0x13')]){if(_0x4fea28[_0x4f5a('0x13')][_0x4f5a('0x14')]===0x1f4){logger['error'](_0x4f5a('0x15'),_0x3cae5e,_0x4fea28['error'][_0x4f5a('0x16')]);return _0x5057f8(_0x4fea28[_0x4f5a('0x13')][_0x4f5a('0x16')]);}logger[_0x4f5a('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3cae5e,_0x4fea28[_0x4f5a('0x13')][_0x4f5a('0x16')]);return _0x2d69ea(_0x4fea28['error'][_0x4f5a('0x16')]);}else{logger[_0x4f5a('0x17')](_0x4f5a('0x15'),_0x3cae5e,_0x4f5a('0x11'));_0x2d69ea(_0x4fea28[_0x4f5a('0x18')][_0x4f5a('0x16')]);}})['catch'](function(_0x308b01){logger[_0x4f5a('0x13')](_0x4f5a('0x15'),_0x3cae5e,_0x308b01);_0x5057f8(_0x308b01);});});}exports[_0x4f5a('0x19')]=function(_0x1a79e){var _0x44d616=this;return new Promise(function(_0x45dc66,_0x256364){return db['OpenchannelInteraction'][_0x4f5a('0x1a')](_0x1a79e[_0x4f5a('0x1b')],{'raw':_0x1a79e[_0x4f5a('0x1c')]?_0x1a79e[_0x4f5a('0x1c')][_0x4f5a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a79e[_0x4f5a('0x1c')]?_0x1a79e[_0x4f5a('0x1c')][_0x4f5a('0x1e')]||null:null,'attributes':_0x1a79e['options']?_0x1a79e[_0x4f5a('0x1c')][_0x4f5a('0x1f')]||null:null,'limit':_0x1a79e[_0x4f5a('0x1c')]?_0x1a79e['options'][_0x4f5a('0x20')]||null:null})[_0x4f5a('0x10')](function(_0x5707a7){logger[_0x4f5a('0x17')]('UpdateOpenchannelInteraction',_0x1a79e);logger[_0x4f5a('0x12')](_0x4f5a('0x19'),_0x1a79e,JSON['stringify'](_0x5707a7));_0x45dc66(_0x5707a7);})[_0x4f5a('0x21')](function(_0x2ec31d){logger[_0x4f5a('0x13')](_0x4f5a('0x19'),_0x2ec31d[_0x4f5a('0x16')],_0x1a79e);_0x256364(_0x44d616['error'](0x1f4,_0x2ec31d[_0x4f5a('0x16')]));});});};exports[_0x4f5a('0x22')]=function(_0x147ee8){return new Promise(function(_0x16fbdf,_0x310db3){return db['OpenchannelInteraction'][_0x4f5a('0x23')]({'where':_0x147ee8['options']?_0x147ee8[_0x4f5a('0x1c')][_0x4f5a('0x1e')]||null:null})['then'](function(_0x154432){if(_0x154432){return _0x154432[_0x4f5a('0x24')](_0x147ee8[_0x4f5a('0x1b')]['ids'],_[_0x4f5a('0x25')](_0x147ee8['body'],['ids','id'])||{});}})[_0x4f5a('0x26')](function(_0x1f3ea7){logger['info'](_0x4f5a('0x27'),_0x147ee8);logger[_0x4f5a('0x12')]('AddTags',_0x147ee8,JSON[_0x4f5a('0x28')](_0x1f3ea7));_0x16fbdf(_0x1f3ea7);})[_0x4f5a('0x21')](function(_0x21b6f8){logger[_0x4f5a('0x13')](_0x4f5a('0x27'),_0x21b6f8[_0x4f5a('0x16')],_0x147ee8);_0x310db3(_this[_0x4f5a('0x13')](0x1f4,_0x21b6f8['message']));});});}; \ No newline at end of file +var _0xb53c=['rpc','../../config/environment','client','http','redis','defaults','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x44e827,_0x145ed8){var _0xa19d97=function(_0x3a1176){while(--_0x3a1176){_0x44e827['push'](_0x44e827['shift']());}};_0xa19d97(++_0x145ed8);}(_0xb53c,0x124));var _0xcb53=function(_0x160bab,_0x34a7d6){_0x160bab=_0x160bab-0x0;var _0x4a8ed9=_0xb53c[_0x160bab];return _0x4a8ed9;};'use strict';var _=require(_0xcb53('0x0'));var util=require(_0xcb53('0x1'));var moment=require(_0xcb53('0x2'));var BPromise=require(_0xcb53('0x3'));var rs=require(_0xcb53('0x4'));var fs=require('fs');var Redis=require(_0xcb53('0x5'));var db=require(_0xcb53('0x6'))['db'];var utils=require(_0xcb53('0x7'));var logger=require(_0xcb53('0x8'))(_0xcb53('0x9'));var config=require(_0xcb53('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcb53('0xb')][_0xcb53('0xc')]({'port':0x232a});config[_0xcb53('0xd')]=_[_0xcb53('0xe')](config[_0xcb53('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb53('0xd')]));require(_0xcb53('0xf'))[_0xcb53('0x10')](socket);function respondWithRpcPromise(_0x354784,_0x47c553,_0x470e63){return new BPromise(function(_0x487f66,_0x23d845){return client[_0xcb53('0x11')](_0x354784,_0x470e63)[_0xcb53('0x12')](function(_0x5b16e2){logger[_0xcb53('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x47c553,_0xcb53('0x14'));logger[_0xcb53('0x15')](_0xcb53('0x16'),_0x47c553,_0xcb53('0x14'),JSON[_0xcb53('0x17')](_0x5b16e2));if(_0x5b16e2[_0xcb53('0x18')]){if(_0x5b16e2[_0xcb53('0x18')][_0xcb53('0x19')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x47c553,_0x5b16e2['error'][_0xcb53('0x1a')]);return _0x23d845(_0x5b16e2[_0xcb53('0x18')][_0xcb53('0x1a')]);}logger['error'](_0xcb53('0x1b'),_0x47c553,_0x5b16e2[_0xcb53('0x18')][_0xcb53('0x1a')]);return _0x487f66(_0x5b16e2[_0xcb53('0x18')]['message']);}else{logger[_0xcb53('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x47c553,_0xcb53('0x14'));_0x487f66(_0x5b16e2['result'][_0xcb53('0x1a')]);}})['catch'](function(_0x39a1bd){logger[_0xcb53('0x18')](_0xcb53('0x1b'),_0x47c553,_0x39a1bd);_0x23d845(_0x39a1bd);});});}exports[_0xcb53('0x1c')]=function(_0x879258){var _0x98ddf1=this;return new Promise(function(_0x13f653,_0x1bd4c7){return db[_0xcb53('0x1d')]['update'](_0x879258['body'],{'raw':_0x879258[_0xcb53('0x1e')]?_0x879258[_0xcb53('0x1e')][_0xcb53('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x879258[_0xcb53('0x1e')]?_0x879258[_0xcb53('0x1e')][_0xcb53('0x20')]||null:null,'attributes':_0x879258[_0xcb53('0x1e')]?_0x879258[_0xcb53('0x1e')][_0xcb53('0x21')]||null:null,'limit':_0x879258[_0xcb53('0x1e')]?_0x879258[_0xcb53('0x1e')][_0xcb53('0x22')]||null:null})[_0xcb53('0x12')](function(_0x519d83){logger[_0xcb53('0x13')](_0xcb53('0x1c'),_0x879258);logger[_0xcb53('0x15')](_0xcb53('0x1c'),_0x879258,JSON[_0xcb53('0x17')](_0x519d83));_0x13f653(_0x519d83);})[_0xcb53('0x23')](function(_0x3cd7f3){logger[_0xcb53('0x18')](_0xcb53('0x1c'),_0x3cd7f3[_0xcb53('0x1a')],_0x879258);_0x1bd4c7(_0x98ddf1[_0xcb53('0x18')](0x1f4,_0x3cd7f3['message']));});});};exports[_0xcb53('0x24')]=function(_0x22253d){return new Promise(function(_0x269c5e,_0x473a9b){return db['OpenchannelInteraction']['find']({'where':_0x22253d['options']?_0x22253d[_0xcb53('0x1e')][_0xcb53('0x20')]||null:null})[_0xcb53('0x12')](function(_0x7d9c25){if(_0x7d9c25){return _0x7d9c25[_0xcb53('0x25')](_0x22253d[_0xcb53('0x26')][_0xcb53('0x27')],_[_0xcb53('0x28')](_0x22253d['body'],['ids','id'])||{});}})[_0xcb53('0x29')](function(_0x17e0ec){logger[_0xcb53('0x13')](_0xcb53('0x2a'),_0x22253d);logger[_0xcb53('0x15')]('AddTags',_0x22253d,JSON[_0xcb53('0x17')](_0x17e0ec));_0x269c5e(_0x17e0ec);})['catch'](function(_0x3c1971){logger[_0xcb53('0x18')](_0xcb53('0x2a'),_0x3c1971[_0xcb53('0x1a')],_0x22253d);_0x473a9b(_this[_0xcb53('0x18')](0x1f4,_0x3c1971[_0xcb53('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 565884f..1d57839 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 _0x9c1c=['remove','update','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x1877c9,_0x25bb45){var _0x4b3758=function(_0x57c4f3){while(--_0x57c4f3){_0x1877c9['push'](_0x1877c9['shift']());}};_0x4b3758(++_0x25bb45);}(_0x9c1c,0x186));var _0xc9c1=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0x9c1c[_0x25fc41];return _0x1371d1;};'use strict';var OpenchannelInteractionEvents=require(_0xc9c1('0x0'));var events=[_0xc9c1('0x1'),_0xc9c1('0x2'),_0xc9c1('0x3')];function createListener(_0x109a68,_0x5370c0){return function(_0xac0b72){_0x5370c0[_0xc9c1('0x4')](_0x109a68,_0xac0b72);};}function removeListener(_0x14f0ec,_0x135f36){return function(){OpenchannelInteractionEvents[_0xc9c1('0x5')](_0x14f0ec,_0x135f36);};}exports['register']=function(_0x8ae227){for(var _0x198bb0=0x0,_0x29877e=events[_0xc9c1('0x6')];_0x198bb0<_0x29877e;_0x198bb0++){var _0x13a7f3=events[_0x198bb0];var _0x2081c3=createListener(_0xc9c1('0x7')+_0x13a7f3,_0x8ae227);OpenchannelInteractionEvents['on'](_0x13a7f3,_0x2081c3);}}; \ No newline at end of file +var _0x47a9=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener','register'];(function(_0x4db723,_0x3c32eb){var _0x2302f9=function(_0x521dad){while(--_0x521dad){_0x4db723['push'](_0x4db723['shift']());}};_0x2302f9(++_0x3c32eb);}(_0x47a9,0x92));var _0x947a=function(_0x404e39,_0x4afcf9){_0x404e39=_0x404e39-0x0;var _0x1089dd=_0x47a9[_0x404e39];return _0x1089dd;};'use strict';var OpenchannelInteractionEvents=require(_0x947a('0x0'));var events=[_0x947a('0x1'),_0x947a('0x2'),_0x947a('0x3')];function createListener(_0x4d59ca,_0x4d809d){return function(_0x5811e2){_0x4d809d['emit'](_0x4d59ca,_0x5811e2);};}function removeListener(_0x6728dc,_0x44533f){return function(){OpenchannelInteractionEvents[_0x947a('0x4')](_0x6728dc,_0x44533f);};}exports[_0x947a('0x5')]=function(_0x5c80b9){for(var _0x38da1e=0x0,_0x1c7a68=events[_0x947a('0x6')];_0x38da1e<_0x1c7a68;_0x38da1e++){var _0x459c46=events[_0x38da1e];var _0x3aa7d2=createListener(_0x947a('0x7')+_0x459c46,_0x5c80b9);OpenchannelInteractionEvents['on'](_0x459c46,_0x3aa7d2);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 0eaa510..546d93f 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x5b66b4,_0x425681){var _0x51be0f=function(_0x52bac1){while(--_0x52bac1){_0x5b66b4['push'](_0x5b66b4['shift']());}};_0x51be0f(++_0x425681);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x240674,_0x5821fa){var _0x2e9173=function(_0x4f98e3){while(--_0x4f98e3){_0x240674['push'](_0x240674['shift']());}};_0x2e9173(++_0x5821fa);}(_0xe706,0xa3));var _0x6e70=function(_0x355ca3,_0xd3e1e7){_0x355ca3=_0x355ca3-0x0;var _0x55edba=_0xe706[_0x355ca3];return _0x55edba;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 1747b42..784cb68 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 _0x63a5=['exports','TEXT','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x45b2f2,_0x5df9e2){var _0x409f5c=function(_0x1917e7){while(--_0x1917e7){_0x45b2f2['push'](_0x45b2f2['shift']());}};_0x409f5c(++_0x5df9e2);}(_0x63a5,0x18e));var _0x563a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x63a5[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'body':{'type':Sequelize[_0x563a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x563a('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x563a('0x4')]('in',_0x563a('0x5')),'defaultValue':_0x563a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x563a('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc692=['exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x3c9570,_0x4d502a){var _0xc9d539=function(_0x2bffbf){while(--_0x2bffbf){_0x3c9570['push'](_0x3c9570['shift']());}};_0xc9d539(++_0x4d502a);}(_0xc692,0x15f));var _0x2c69=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xc692[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x2c69('0x0'));module[_0x2c69('0x1')]={'body':{'type':Sequelize[_0x2c69('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2c69('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2c69('0x4')]('in',_0x2c69('0x5')),'defaultValue':_0x2c69('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2c69('0x6')]},'providerName':{'type':Sequelize[_0x2c69('0x7')]},'providerResponse':{'type':Sequelize[_0x2c69('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 9288562..0a36269 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 _0xa218=['sort','where','filter','merge','VIRTUAL','name','options','count','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','openchannel-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','EventManager','acceptmessage','openchannel','RejectMessage','rejectMessage','internal','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','update','stack','map','OpenchannelMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0xb478c9,_0x20d2be){var _0x9debd8=function(_0x3ec8a7){while(--_0x3ec8a7){_0xb478c9['push'](_0xb478c9['shift']());}};_0x9debd8(++_0x20d2be);}(_0xa218,0x12d));var _0x8a21=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xa218[_0x1b2ff7];return _0x31656a;};'use strict';var emlformat=require(_0x8a21('0x0'));var rimraf=require(_0x8a21('0x1'));var zipdir=require(_0x8a21('0x2'));var jsonpatch=require(_0x8a21('0x3'));var rp=require('request-promise');var moment=require(_0x8a21('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8a21('0x5'));var util=require(_0x8a21('0x6'));var path=require(_0x8a21('0x7'));var sox=require(_0x8a21('0x8'));var csv=require(_0x8a21('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a21('0xa'));var _=require(_0x8a21('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8a21('0xc'));var toCsv=require(_0x8a21('0x9'));var querystring=require(_0x8a21('0xd'));var Papa=require(_0x8a21('0xe'));var Redis=require('ioredis');var authService=require(_0x8a21('0xf'));var qs=require(_0x8a21('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a21('0x11'));var logger=require(_0x8a21('0x12'))('api');var utils=require(_0x8a21('0x13'));var config=require(_0x8a21('0x14'));var licenseUtil=require(_0x8a21('0x15'));var db=require(_0x8a21('0x16'))['db'];config['redis']=_['defaults'](config[_0x8a21('0x17')],{'host':_0x8a21('0x18'),'port':0x18eb});var socket=require(_0x8a21('0x19'))(new Redis(config['redis']));require(_0x8a21('0x1a'))[_0x8a21('0x1b')](socket);var jayson=require(_0x8a21('0x1c'));var client=jayson[_0x8a21('0x1d')][_0x8a21('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x8a21('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x12e3da,_0x4ac212,_0xe751db,_0x5c8061){return new BPromise(function(_0x2bc03e,_0xa3b4e7){var _0x26b557=_0x5c8061||client;return _0x26b557[_0x8a21('0x1f')](_0x12e3da,_0xe751db)[_0x8a21('0x20')](function(_0x4e4e00){logger[_0x8a21('0x21')](_0x8a21('0x22'),_0x4ac212,_0x8a21('0x23'));logger[_0x8a21('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4ac212,_0x8a21('0x23'),JSON[_0x8a21('0x25')](_0x4e4e00));if(_0x4e4e00[_0x8a21('0x26')]){if(_0x4e4e00[_0x8a21('0x26')][_0x8a21('0x27')]===0x1f4){logger[_0x8a21('0x26')](_0x8a21('0x22'),_0x4ac212,_0x4e4e00[_0x8a21('0x26')][_0x8a21('0x28')]);return _0xa3b4e7(_0x4e4e00[_0x8a21('0x26')][_0x8a21('0x28')]);}logger[_0x8a21('0x26')](_0x8a21('0x22'),_0x4ac212,_0x4e4e00[_0x8a21('0x26')][_0x8a21('0x28')]);return _0x2bc03e(_0x4e4e00[_0x8a21('0x26')][_0x8a21('0x28')]);}else{logger[_0x8a21('0x21')](_0x8a21('0x22'),_0x4ac212,_0x8a21('0x23'));_0x2bc03e(_0x4e4e00[_0x8a21('0x29')][_0x8a21('0x28')]);}})['catch'](function(_0x15be6b){logger[_0x8a21('0x26')](_0x8a21('0x22'),_0x4ac212,_0x15be6b);_0xa3b4e7(_0x15be6b);});});}function respondWithStatusCode(_0x189693,_0x210070){_0x210070=_0x210070||0xcc;return function(_0x2c9d66){if(_0x2c9d66){return _0x189693[_0x8a21('0x2a')](_0x210070);}return _0x189693['status'](_0x210070)['end']();};}function respondWithResult(_0x47ec9c,_0x41df68){_0x41df68=_0x41df68||0xc8;return function(_0x10351e){if(_0x10351e){return _0x47ec9c[_0x8a21('0x2b')](_0x41df68)[_0x8a21('0x2c')](_0x10351e);}};}function respondWithFilteredResult(_0x2ff715,_0x373ca8){return function(_0x38f0a0){if(_0x38f0a0){var _0x483dbf=typeof _0x373ca8['offset']===_0x8a21('0x2d')&&typeof _0x373ca8[_0x8a21('0x2e')]==='undefined';var _0x3dddd9=_0x38f0a0['count'];var _0x1eeff7=_0x483dbf?0x0:_0x373ca8[_0x8a21('0x2f')];var _0x119d74=_0x483dbf?_0x38f0a0['count']:_0x373ca8['offset']+_0x373ca8[_0x8a21('0x2e')];var _0x5a3799;if(_0x119d74>=_0x3dddd9){_0x119d74=_0x3dddd9;_0x5a3799=0xc8;}else{_0x5a3799=0xce;}_0x2ff715['status'](_0x5a3799);return _0x2ff715[_0x8a21('0x30')](_0x8a21('0x31'),_0x1eeff7+'-'+_0x119d74+'/'+_0x3dddd9)['json'](_0x38f0a0);}return null;};}function patchUpdates(_0x379824){return function(_0x3c69c8){try{jsonpatch[_0x8a21('0x32')](_0x3c69c8,_0x379824,!![]);}catch(_0x268fdc){return BPromise[_0x8a21('0x33')](_0x268fdc);}return _0x3c69c8['save']();};}function saveUpdates(_0x511bda,_0x5db2ea){return function(_0x452f18){if(_0x452f18){return _0x452f18[_0x8a21('0x34')](_0x511bda)[_0x8a21('0x20')](function(_0x56dc20){return _0x56dc20;});}return null;};}function removeEntity(_0x32a745,_0x19ba2a){return function(_0x36de9a){if(_0x36de9a){return _0x36de9a['destroy']()[_0x8a21('0x20')](function(){_0x32a745['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x467116,_0x4a239a){return function(_0x593bc5){if(!_0x593bc5){_0x467116[_0x8a21('0x2a')](0x194);}return _0x593bc5;};}function handleError(_0x569e3f,_0x4806c9){_0x4806c9=_0x4806c9||0x1f4;return function(_0x47c128){logger[_0x8a21('0x26')](_0x47c128[_0x8a21('0x35')]);if(_0x47c128['name']){delete _0x47c128['name'];}_0x569e3f[_0x8a21('0x2b')](_0x4806c9)['send'](_0x47c128);};}exports['index']=function(_0xa13216,_0x14191e){var _0x59d13d={},_0x346985={},_0x59a30d={'count':0x0,'rows':[]};var _0x315d42=_[_0x8a21('0x36')](db[_0x8a21('0x37')]['rawAttributes'],function(_0x3b14d8){return{'name':_0x3b14d8['fieldName'],'type':_0x3b14d8[_0x8a21('0x38')][_0x8a21('0x39')]};});_0x346985[_0x8a21('0x3a')]=_[_0x8a21('0x36')](_0x315d42,'name');_0x346985[_0x8a21('0x3b')]=_['keys'](_0xa13216[_0x8a21('0x3b')]);_0x346985[_0x8a21('0x3c')]=_[_0x8a21('0x3d')](_0x346985[_0x8a21('0x3a')],_0x346985[_0x8a21('0x3b')]);_0x59d13d[_0x8a21('0x3e')]=_[_0x8a21('0x3d')](_0x346985[_0x8a21('0x3a')],qs[_0x8a21('0x3f')](_0xa13216['query'][_0x8a21('0x3f')]));_0x59d13d[_0x8a21('0x3e')]=_0x59d13d[_0x8a21('0x3e')][_0x8a21('0x40')]?_0x59d13d[_0x8a21('0x3e')]:_0x346985[_0x8a21('0x3a')];if(!_0xa13216['query'][_0x8a21('0x41')](_0x8a21('0x42'))){_0x59d13d[_0x8a21('0x2e')]=qs[_0x8a21('0x2e')](_0xa13216[_0x8a21('0x3b')][_0x8a21('0x2e')]);_0x59d13d[_0x8a21('0x2f')]=qs[_0x8a21('0x2f')](_0xa13216['query'][_0x8a21('0x2f')]);}_0x59d13d[_0x8a21('0x43')]=qs[_0x8a21('0x44')](_0xa13216[_0x8a21('0x3b')][_0x8a21('0x44')]);_0x59d13d[_0x8a21('0x45')]=qs[_0x8a21('0x3c')](_['pick'](_0xa13216[_0x8a21('0x3b')],_0x346985[_0x8a21('0x3c')]),_0x315d42);if(_0xa13216[_0x8a21('0x3b')][_0x8a21('0x46')]){_0x59d13d[_0x8a21('0x45')]=_[_0x8a21('0x47')](_0x59d13d[_0x8a21('0x45')],{'$or':_[_0x8a21('0x36')](_0x315d42,function(_0x8f362f){if(_0x8f362f[_0x8a21('0x38')]!==_0x8a21('0x48')){var _0x2ad9e8={};_0x2ad9e8[_0x8f362f[_0x8a21('0x49')]]={'$like':'%'+_0xa13216[_0x8a21('0x3b')]['filter']+'%'};return _0x2ad9e8;}})});}_0x59d13d=_['merge']({},_0x59d13d,_0xa13216[_0x8a21('0x4a')]);var _0x5accf2={'where':_0x59d13d['where']};return db[_0x8a21('0x37')][_0x8a21('0x4b')](_0x5accf2)['then'](function(_0x4b4f52){_0x59a30d[_0x8a21('0x4b')]=_0x4b4f52;if(_0xa13216[_0x8a21('0x3b')][_0x8a21('0x4c')]){_0x59d13d['include']=[{'all':!![]}];}return db[_0x8a21('0x37')][_0x8a21('0x4d')](_0x59d13d);})[_0x8a21('0x20')](function(_0x499f57){_0x59a30d[_0x8a21('0x4e')]=_0x499f57;return _0x59a30d;})['then'](respondWithFilteredResult(_0x14191e,_0x59d13d))[_0x8a21('0x4f')](handleError(_0x14191e,null));};exports[_0x8a21('0x50')]=function(_0x4b4feb,_0x1a3b8e){var _0x39c659={'raw':!![],'where':{'id':_0x4b4feb[_0x8a21('0x51')]['id']}},_0x4981cf={};_0x4981cf[_0x8a21('0x3a')]=_[_0x8a21('0x52')](db['OpenchannelMessage'][_0x8a21('0x53')]);_0x4981cf[_0x8a21('0x3b')]=_[_0x8a21('0x52')](_0x4b4feb[_0x8a21('0x3b')]);_0x4981cf[_0x8a21('0x3c')]=_[_0x8a21('0x3d')](_0x4981cf[_0x8a21('0x3a')],_0x4981cf['query']);_0x39c659[_0x8a21('0x3e')]=_[_0x8a21('0x3d')](_0x4981cf[_0x8a21('0x3a')],qs[_0x8a21('0x3f')](_0x4b4feb[_0x8a21('0x3b')][_0x8a21('0x3f')]));_0x39c659[_0x8a21('0x3e')]=_0x39c659[_0x8a21('0x3e')][_0x8a21('0x40')]?_0x39c659[_0x8a21('0x3e')]:_0x4981cf[_0x8a21('0x3a')];if(_0x4b4feb['query']['includeAll']){_0x39c659['include']=[{'all':!![]}];}_0x39c659=_[_0x8a21('0x47')]({},_0x39c659,_0x4b4feb['options']);return db['OpenchannelMessage'][_0x8a21('0x54')](_0x39c659)['then'](handleEntityNotFound(_0x1a3b8e,null))[_0x8a21('0x20')](respondWithResult(_0x1a3b8e,null))[_0x8a21('0x4f')](handleError(_0x1a3b8e,null));};exports[_0x8a21('0x55')]=function(_0x4e10a7,_0x1a31c0){return db[_0x8a21('0x37')][_0x8a21('0x55')](_0x4e10a7[_0x8a21('0x56')],{})[_0x8a21('0x20')](respondWithResult(_0x1a31c0,0xc9))[_0x8a21('0x4f')](handleError(_0x1a31c0,null));};exports[_0x8a21('0x34')]=function(_0x276405,_0x396211){if(_0x276405[_0x8a21('0x56')]['id']){delete _0x276405[_0x8a21('0x56')]['id'];}return db[_0x8a21('0x37')][_0x8a21('0x54')]({'where':{'id':_0x276405[_0x8a21('0x51')]['id']}})['then'](handleEntityNotFound(_0x396211,null))['then'](saveUpdates(_0x276405[_0x8a21('0x56')],null))['then'](respondWithResult(_0x396211,null))[_0x8a21('0x4f')](handleError(_0x396211,null));};exports['destroy']=function(_0x5a1ca4,_0x440337){return db['OpenchannelMessage'][_0x8a21('0x54')]({'where':{'id':_0x5a1ca4[_0x8a21('0x51')]['id']}})[_0x8a21('0x20')](handleEntityNotFound(_0x440337,null))[_0x8a21('0x20')](removeEntity(_0x440337,null))[_0x8a21('0x4f')](handleError(_0x440337,null));};exports['describe']=function(_0x15e721,_0x6066d3){return db[_0x8a21('0x37')]['describe']()[_0x8a21('0x20')](respondWithResult(_0x6066d3,null))[_0x8a21('0x4f')](handleError(_0x6066d3,null));};var interaction_log=require('../../config/logger')(_0x8a21('0x57'));exports[_0x8a21('0x58')]=function(_0x3ab4ef,_0x533bf0,_0x18cbfa){var _0x1de925={'agent':{},'channel':'openchannel'};if(_0x3ab4ef[_0x8a21('0x56')]['id']){delete _0x3ab4ef['body']['id'];}_0x3ab4ef['body'][_0x8a21('0x59')]=!![];_0x3ab4ef[_0x8a21('0x56')]['readAt']=moment()[_0x8a21('0x5a')](_0x8a21('0x5b'));_0x3ab4ef[_0x8a21('0x56')][_0x8a21('0x5c')]=_0x3ab4ef[_0x8a21('0x56')][_0x8a21('0x5c')]||_0x3ab4ef[_0x8a21('0x5d')]['id'];_0x1de925[_0x8a21('0x5e')]['id']=_0x3ab4ef[_0x8a21('0x56')][_0x8a21('0x5c')];return db['OpenchannelMessage'][_0x8a21('0x54')]({'where':{'id':_0x3ab4ef[_0x8a21('0x51')]['id'],'UserId':null}})[_0x8a21('0x20')](handleEntityNotFound(_0x533bf0,null))['then'](saveUpdates(_0x3ab4ef[_0x8a21('0x56')],null))[_0x8a21('0x20')](function(_0x57e291){if(_0x57e291){_0x1de925[_0x8a21('0x28')]=_0x57e291[_0x8a21('0x5f')]({'plain':!![]});return db[_0x8a21('0x60')][_0x8a21('0x54')]({'where':{'id':_0x57e291[_0x8a21('0x61')]}});}return null;})[_0x8a21('0x20')](handleEntityNotFound(_0x533bf0,null))[_0x8a21('0x20')](function(_0x17f010){if(_0x17f010){return _0x17f010[_0x8a21('0x34')]({'UserId':_0x3ab4ef['body'][_0x8a21('0x5c')],'read1stAt':_[_0x8a21('0x62')](_0x17f010[_0x8a21('0x63')])?moment()['format'](_0x8a21('0x5b')):undefined});}return null;})[_0x8a21('0x20')](function(_0x2ac188){if(_0x2ac188){_0x1de925[_0x8a21('0x64')]=_0x2ac188[_0x8a21('0x5f')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ab4ef['user']['id'],_0x3ab4ef[_0x8a21('0x5d')][_0x8a21('0x49')],_0x3ab4ef[_0x8a21('0x5d')][_0x8a21('0x65')],_0x1de925[_0x8a21('0x64')]['id'],_0x3ab4ef['body']?JSON[_0x8a21('0x25')](_0x3ab4ef['body']):_0x8a21('0x66'));return respondWithRpcPromise('AcceptMessage',_0x8a21('0x67'),_0x1de925);}return null;})[_0x8a21('0x20')](function(_0x2b6124){var _0x1c2da7=_0x8a21('0x68')+_0x2b6124[_0x8a21('0x28')]['ContactId'];return db[_0x8a21('0x69')][_0x8a21('0x3b')](_0x1c2da7,{'type':db[_0x8a21('0x6a')][_0x8a21('0x6b')][_0x8a21('0x6c')],'raw':!![]})[_0x8a21('0x20')](function(_0x435bcc){return _0x435bcc;});})[_0x8a21('0x20')](function(_0x474978){if(_0x474978){_0x1de925[_0x8a21('0x28')][_0x8a21('0x6d')]=_0x474978[0x0];if(!_0x3ab4ef[_0x8a21('0x56')][_0x8a21('0x5c')])return;return db[_0x8a21('0x6e')]['find']({'where':{'id':_0x3ab4ef['body']['UserId'],'role':'agent'},'attributes':['id','name',_0x8a21('0x6f'),_0x8a21('0x70'),'internal'],'raw':!![]});}return null;})[_0x8a21('0x20')](function(_0x3b0ea9){if(!_0x3b0ea9)return null;_0x1de925[_0x8a21('0x28')]['agent']=_0x3b0ea9;return _0x1de925;})[_0x8a21('0x20')](function(_0x569370){if(_0x569370){if(_0x3ab4ef[_0x8a21('0x56')][_0x8a21('0x71')]){_0x1de925[_0x8a21('0x28')][_0x8a21('0x72')]=util[_0x8a21('0x5a')](_0x8a21('0x73'),_0x3ab4ef[_0x8a21('0x5d')][_0x8a21('0x49')]);_0x1de925[_0x8a21('0x28')][_0x8a21('0x74')]=_0x1de925[_0x8a21('0x74')];_0x1de925[_0x8a21('0x28')]['event']=_0x8a21('0x58');return respondWithRpcPromise(_0x8a21('0x75'),_0x8a21('0x75'),{'event':_0x8a21('0x76'),'message':_0x1de925[_0x8a21('0x28')]},client9002)[_0x8a21('0x20')](function(){return _0x1de925;});}return _0x1de925;}return null;})[_0x8a21('0x20')](respondWithResult(_0x533bf0,null))[_0x8a21('0x4f')](handleError(_0x533bf0,null));};var interaction_log=require(_0x8a21('0x12'))('openchannel-interactions');exports['reject']=function(_0x252549,_0x428999,_0x3d8c76){var _0x106bee={'agent':{},'channel':_0x8a21('0x77')};if(_0x252549[_0x8a21('0x56')]['id']){delete _0x252549[_0x8a21('0x56')]['id'];}_0x252549[_0x8a21('0x56')][_0x8a21('0x5c')]=_0x252549[_0x8a21('0x56')][_0x8a21('0x5c')]||_0x252549[_0x8a21('0x5d')]['id'];_0x106bee[_0x8a21('0x5e')]['id']=_0x252549[_0x8a21('0x56')][_0x8a21('0x5c')];return db[_0x8a21('0x37')][_0x8a21('0x54')]({'where':{'id':_0x252549[_0x8a21('0x51')]['id'],'UserId':null}})[_0x8a21('0x20')](handleEntityNotFound(_0x428999,null))[_0x8a21('0x20')](function(_0x4341bc){if(_0x4341bc){_0x106bee[_0x8a21('0x28')]=_0x4341bc['get']({'plain':!![]});return db[_0x8a21('0x60')][_0x8a21('0x54')]({'where':{'id':_0x4341bc[_0x8a21('0x61')]}});}return null;})[_0x8a21('0x20')](handleEntityNotFound(_0x428999,null))[_0x8a21('0x20')](function(_0x4f7ac8){if(_0x4f7ac8){_0x106bee['interaction']=_0x4f7ac8[_0x8a21('0x5f')]({'plain':!![]});interaction_log[_0x8a21('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x252549[_0x8a21('0x5d')]['id'],_0x252549['user'][_0x8a21('0x49')],_0x252549[_0x8a21('0x5d')][_0x8a21('0x65')],_0x106bee['interaction']['id'],_0x252549[_0x8a21('0x56')]?JSON['stringify'](_0x252549[_0x8a21('0x56')]):_0x8a21('0x66'));return respondWithRpcPromise(_0x8a21('0x78'),_0x8a21('0x79'),_0x106bee);}return null;})['then'](function(_0x31a7dd){var _0x3d3127=_0x8a21('0x68')+_0x31a7dd[_0x8a21('0x28')]['ContactId'];return db['sequelize'][_0x8a21('0x3b')](_0x3d3127,{'type':db[_0x8a21('0x6a')][_0x8a21('0x6b')][_0x8a21('0x6c')],'raw':!![]})['then'](function(_0x5adda2){return _0x5adda2;});})[_0x8a21('0x20')](function(_0x27ed3e){if(_0x27ed3e){_0x106bee['message']['contact']=_0x27ed3e[0x0];if(!_0x252549[_0x8a21('0x56')][_0x8a21('0x5c')])return;return db[_0x8a21('0x6e')][_0x8a21('0x54')]({'where':{'id':_0x252549[_0x8a21('0x56')][_0x8a21('0x5c')],'role':_0x8a21('0x5e')},'attributes':['id','name',_0x8a21('0x6f'),_0x8a21('0x70'),_0x8a21('0x7a')],'raw':!![]});}return null;})['then'](function(_0x3ebd39){if(!_0x3ebd39)return null;_0x106bee['message']['agent']=_0x3ebd39;return _0x106bee;})[_0x8a21('0x20')](function(_0x58c5b8){if(_0x58c5b8){_0x58c5b8['message'][_0x8a21('0x72')]=util[_0x8a21('0x5a')](_0x8a21('0x73'),_0x252549['user'][_0x8a21('0x49')]);_0x58c5b8['message'][_0x8a21('0x74')]=_0x106bee[_0x8a21('0x74')];_0x58c5b8[_0x8a21('0x28')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x58c5b8[_0x8a21('0x28')]},client9002);return _0x106bee;}return null;})[_0x8a21('0x20')](respondWithResult(_0x428999,null))[_0x8a21('0x4f')](handleError(_0x428999,null));}; \ No newline at end of file +var _0x8921=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','Sequelize','contact','User','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x406f12,_0x3620aa){var _0x1e0fd2=function(_0xc8e670){while(--_0xc8e670){_0x406f12['push'](_0x406f12['shift']());}};_0x1e0fd2(++_0x3620aa);}(_0x8921,0x110));var _0x1892=function(_0x36edf9,_0x51af75){_0x36edf9=_0x36edf9-0x0;var _0x48b0f8=_0x8921[_0x36edf9];return _0x48b0f8;};'use strict';var emlformat=require(_0x1892('0x0'));var rimraf=require(_0x1892('0x1'));var zipdir=require(_0x1892('0x2'));var jsonpatch=require(_0x1892('0x3'));var rp=require(_0x1892('0x4'));var moment=require(_0x1892('0x5'));var BPromise=require(_0x1892('0x6'));var Mustache=require('mustache');var util=require(_0x1892('0x7'));var path=require(_0x1892('0x8'));var sox=require(_0x1892('0x9'));var csv=require(_0x1892('0xa'));var ejs=require(_0x1892('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1892('0xc'));var squel=require(_0x1892('0xd'));var crypto=require(_0x1892('0xe'));var jsforce=require(_0x1892('0xf'));var deskjs=require(_0x1892('0x10'));var toCsv=require(_0x1892('0xa'));var querystring=require(_0x1892('0x11'));var Papa=require(_0x1892('0x12'));var Redis=require(_0x1892('0x13'));var authService=require(_0x1892('0x14'));var qs=require(_0x1892('0x15'));var as=require(_0x1892('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1892('0x17'))(_0x1892('0x18'));var utils=require(_0x1892('0x19'));var config=require(_0x1892('0x1a'));var licenseUtil=require(_0x1892('0x1b'));var db=require(_0x1892('0x1c'))['db'];config[_0x1892('0x1d')]=_['defaults'](config[_0x1892('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x1892('0x1e'))(new Redis(config['redis']));require(_0x1892('0x1f'))['register'](socket);var jayson=require(_0x1892('0x20'));var client=jayson['client'][_0x1892('0x21')]({'port':0x232c});var client9002=jayson[_0x1892('0x22')][_0x1892('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2265b8,_0x1edfa5,_0xea2168,_0x118639){return new BPromise(function(_0x21bf13,_0x1b67d4){var _0x2619c0=_0x118639||client;return _0x2619c0[_0x1892('0x23')](_0x2265b8,_0xea2168)['then'](function(_0x4bd8b5){logger[_0x1892('0x24')](_0x1892('0x25'),_0x1edfa5,_0x1892('0x26'));logger[_0x1892('0x27')](_0x1892('0x28'),_0x1edfa5,_0x1892('0x26'),JSON[_0x1892('0x29')](_0x4bd8b5));if(_0x4bd8b5[_0x1892('0x2a')]){if(_0x4bd8b5[_0x1892('0x2a')][_0x1892('0x2b')]===0x1f4){logger[_0x1892('0x2a')](_0x1892('0x25'),_0x1edfa5,_0x4bd8b5[_0x1892('0x2a')][_0x1892('0x2c')]);return _0x1b67d4(_0x4bd8b5[_0x1892('0x2a')]['message']);}logger[_0x1892('0x2a')](_0x1892('0x25'),_0x1edfa5,_0x4bd8b5[_0x1892('0x2a')][_0x1892('0x2c')]);return _0x21bf13(_0x4bd8b5['error']['message']);}else{logger[_0x1892('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x1edfa5,_0x1892('0x26'));_0x21bf13(_0x4bd8b5[_0x1892('0x2d')][_0x1892('0x2c')]);}})[_0x1892('0x2e')](function(_0x206a37){logger[_0x1892('0x2a')]('OpenchannelMessage,\x20%s,\x20%s',_0x1edfa5,_0x206a37);_0x1b67d4(_0x206a37);});});}function respondWithStatusCode(_0xc1e10,_0x28709b){_0x28709b=_0x28709b||0xcc;return function(_0x44406c){if(_0x44406c){return _0xc1e10[_0x1892('0x2f')](_0x28709b);}return _0xc1e10[_0x1892('0x30')](_0x28709b)[_0x1892('0x31')]();};}function respondWithResult(_0x589732,_0x5dfaf5){_0x5dfaf5=_0x5dfaf5||0xc8;return function(_0x143342){if(_0x143342){return _0x589732[_0x1892('0x30')](_0x5dfaf5)['json'](_0x143342);}};}function respondWithFilteredResult(_0x34b67b,_0x23b4fd){return function(_0x3b81d7){if(_0x3b81d7){var _0x59f0e0=typeof _0x23b4fd[_0x1892('0x32')]===_0x1892('0x33')&&typeof _0x23b4fd[_0x1892('0x34')]==='undefined';var _0x21e10b=_0x3b81d7['count'];var _0x28cfd0=_0x59f0e0?0x0:_0x23b4fd['offset'];var _0x41b70b=_0x59f0e0?_0x3b81d7[_0x1892('0x35')]:_0x23b4fd[_0x1892('0x32')]+_0x23b4fd[_0x1892('0x34')];var _0xfbcc1;if(_0x41b70b>=_0x21e10b){_0x41b70b=_0x21e10b;_0xfbcc1=0xc8;}else{_0xfbcc1=0xce;}_0x34b67b[_0x1892('0x30')](_0xfbcc1);return _0x34b67b[_0x1892('0x36')](_0x1892('0x37'),_0x28cfd0+'-'+_0x41b70b+'/'+_0x21e10b)[_0x1892('0x38')](_0x3b81d7);}return null;};}function patchUpdates(_0x45a5ff){return function(_0x3063eb){try{jsonpatch[_0x1892('0x39')](_0x3063eb,_0x45a5ff,!![]);}catch(_0x427ce8){return BPromise[_0x1892('0x3a')](_0x427ce8);}return _0x3063eb[_0x1892('0x3b')]();};}function saveUpdates(_0x3c2c57,_0x1644b5){return function(_0x50f72f){if(_0x50f72f){return _0x50f72f[_0x1892('0x3c')](_0x3c2c57)['then'](function(_0x46e5ee){return _0x46e5ee;});}return null;};}function removeEntity(_0x50692c,_0x2e3556){return function(_0x50da25){if(_0x50da25){return _0x50da25['destroy']()[_0x1892('0x3d')](function(){_0x50692c['status'](0xcc)[_0x1892('0x31')]();});}};}function handleEntityNotFound(_0x293e1c,_0x164c46){return function(_0x20d1f9){if(!_0x20d1f9){_0x293e1c['sendStatus'](0x194);}return _0x20d1f9;};}function handleError(_0x39c1e6,_0x5a1359){_0x5a1359=_0x5a1359||0x1f4;return function(_0x583fa5){logger[_0x1892('0x2a')](_0x583fa5[_0x1892('0x3e')]);if(_0x583fa5[_0x1892('0x3f')]){delete _0x583fa5[_0x1892('0x3f')];}_0x39c1e6[_0x1892('0x30')](_0x5a1359)[_0x1892('0x40')](_0x583fa5);};}exports[_0x1892('0x41')]=function(_0xaf2673,_0x708702){var _0x3e7403={},_0x643c61={},_0x2c62e0={'count':0x0,'rows':[]};var _0x5ed879=_[_0x1892('0x42')](db[_0x1892('0x43')][_0x1892('0x44')],function(_0x429fba){return{'name':_0x429fba[_0x1892('0x45')],'type':_0x429fba[_0x1892('0x46')][_0x1892('0x47')]};});_0x643c61[_0x1892('0x48')]=_[_0x1892('0x42')](_0x5ed879,'name');_0x643c61[_0x1892('0x49')]=_['keys'](_0xaf2673['query']);_0x643c61[_0x1892('0x4a')]=_['intersection'](_0x643c61[_0x1892('0x48')],_0x643c61[_0x1892('0x49')]);_0x3e7403[_0x1892('0x4b')]=_[_0x1892('0x4c')](_0x643c61[_0x1892('0x48')],qs['fields'](_0xaf2673[_0x1892('0x49')][_0x1892('0x4d')]));_0x3e7403['attributes']=_0x3e7403[_0x1892('0x4b')]['length']?_0x3e7403[_0x1892('0x4b')]:_0x643c61[_0x1892('0x48')];if(!_0xaf2673[_0x1892('0x49')][_0x1892('0x4e')](_0x1892('0x4f'))){_0x3e7403[_0x1892('0x34')]=qs['limit'](_0xaf2673[_0x1892('0x49')][_0x1892('0x34')]);_0x3e7403[_0x1892('0x32')]=qs[_0x1892('0x32')](_0xaf2673[_0x1892('0x49')][_0x1892('0x32')]);}_0x3e7403[_0x1892('0x50')]=qs[_0x1892('0x51')](_0xaf2673[_0x1892('0x49')][_0x1892('0x51')]);_0x3e7403[_0x1892('0x52')]=qs['filters'](_[_0x1892('0x53')](_0xaf2673[_0x1892('0x49')],_0x643c61[_0x1892('0x4a')]),_0x5ed879);if(_0xaf2673['query'][_0x1892('0x54')]){_0x3e7403['where']=_[_0x1892('0x55')](_0x3e7403['where'],{'$or':_['map'](_0x5ed879,function(_0x92e23f){if(_0x92e23f[_0x1892('0x46')]!==_0x1892('0x56')){var _0x2a1774={};_0x2a1774[_0x92e23f[_0x1892('0x3f')]]={'$like':'%'+_0xaf2673[_0x1892('0x49')][_0x1892('0x54')]+'%'};return _0x2a1774;}})});}_0x3e7403=_[_0x1892('0x55')]({},_0x3e7403,_0xaf2673[_0x1892('0x57')]);var _0x2e9bae={'where':_0x3e7403[_0x1892('0x52')]};return db[_0x1892('0x43')][_0x1892('0x35')](_0x2e9bae)[_0x1892('0x3d')](function(_0x43caa5){_0x2c62e0[_0x1892('0x35')]=_0x43caa5;if(_0xaf2673[_0x1892('0x49')][_0x1892('0x58')]){_0x3e7403[_0x1892('0x59')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1892('0x5a')](_0x3e7403);})[_0x1892('0x3d')](function(_0x3ef43a){_0x2c62e0[_0x1892('0x5b')]=_0x3ef43a;return _0x2c62e0;})['then'](respondWithFilteredResult(_0x708702,_0x3e7403))[_0x1892('0x2e')](handleError(_0x708702,null));};exports[_0x1892('0x5c')]=function(_0xc8324a,_0x175eec){var _0x2e9c3c={'raw':!![],'where':{'id':_0xc8324a[_0x1892('0x5d')]['id']}},_0x334287={};_0x334287[_0x1892('0x48')]=_[_0x1892('0x5e')](db['OpenchannelMessage'][_0x1892('0x44')]);_0x334287[_0x1892('0x49')]=_[_0x1892('0x5e')](_0xc8324a['query']);_0x334287[_0x1892('0x4a')]=_[_0x1892('0x4c')](_0x334287[_0x1892('0x48')],_0x334287[_0x1892('0x49')]);_0x2e9c3c['attributes']=_['intersection'](_0x334287[_0x1892('0x48')],qs[_0x1892('0x4d')](_0xc8324a[_0x1892('0x49')][_0x1892('0x4d')]));_0x2e9c3c['attributes']=_0x2e9c3c['attributes'][_0x1892('0x5f')]?_0x2e9c3c[_0x1892('0x4b')]:_0x334287['model'];if(_0xc8324a[_0x1892('0x49')][_0x1892('0x58')]){_0x2e9c3c[_0x1892('0x59')]=[{'all':!![]}];}_0x2e9c3c=_[_0x1892('0x55')]({},_0x2e9c3c,_0xc8324a[_0x1892('0x57')]);return db[_0x1892('0x43')][_0x1892('0x60')](_0x2e9c3c)[_0x1892('0x3d')](handleEntityNotFound(_0x175eec,null))[_0x1892('0x3d')](respondWithResult(_0x175eec,null))[_0x1892('0x2e')](handleError(_0x175eec,null));};exports[_0x1892('0x61')]=function(_0x5234be,_0x85b2f3){return db[_0x1892('0x43')]['create'](_0x5234be[_0x1892('0x62')],{})['then'](respondWithResult(_0x85b2f3,0xc9))[_0x1892('0x2e')](handleError(_0x85b2f3,null));};exports['update']=function(_0x34b5d9,_0x16a11f){if(_0x34b5d9['body']['id']){delete _0x34b5d9[_0x1892('0x62')]['id'];}return db[_0x1892('0x43')][_0x1892('0x60')]({'where':{'id':_0x34b5d9[_0x1892('0x5d')]['id']}})[_0x1892('0x3d')](handleEntityNotFound(_0x16a11f,null))[_0x1892('0x3d')](saveUpdates(_0x34b5d9[_0x1892('0x62')],null))[_0x1892('0x3d')](respondWithResult(_0x16a11f,null))[_0x1892('0x2e')](handleError(_0x16a11f,null));};exports[_0x1892('0x63')]=function(_0x5179c1,_0x3b421a){return db[_0x1892('0x43')][_0x1892('0x60')]({'where':{'id':_0x5179c1['params']['id']}})[_0x1892('0x3d')](handleEntityNotFound(_0x3b421a,null))['then'](removeEntity(_0x3b421a,null))[_0x1892('0x2e')](handleError(_0x3b421a,null));};exports['describe']=function(_0x30cf28,_0x37b30f){return db[_0x1892('0x43')][_0x1892('0x64')]()[_0x1892('0x3d')](respondWithResult(_0x37b30f,null))[_0x1892('0x2e')](handleError(_0x37b30f,null));};var interaction_log=require(_0x1892('0x17'))(_0x1892('0x65'));exports[_0x1892('0x66')]=function(_0x56a6ad,_0x152b7f,_0x271a21){var _0xdc3380={'agent':{},'channel':_0x1892('0x67')};if(_0x56a6ad[_0x1892('0x62')]['id']){delete _0x56a6ad[_0x1892('0x62')]['id'];}_0x56a6ad['body'][_0x1892('0x68')]=!![];_0x56a6ad['body'][_0x1892('0x69')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x56a6ad['body'][_0x1892('0x6a')]=_0x56a6ad['body'][_0x1892('0x6a')]||_0x56a6ad[_0x1892('0x6b')]['id'];_0xdc3380[_0x1892('0x6c')]['id']=_0x56a6ad[_0x1892('0x62')][_0x1892('0x6a')];return db[_0x1892('0x43')][_0x1892('0x60')]({'where':{'id':_0x56a6ad[_0x1892('0x5d')]['id'],'UserId':null}})[_0x1892('0x3d')](handleEntityNotFound(_0x152b7f,null))[_0x1892('0x3d')](saveUpdates(_0x56a6ad[_0x1892('0x62')],null))['then'](function(_0x2f63be){if(_0x2f63be){_0xdc3380[_0x1892('0x2c')]=_0x2f63be[_0x1892('0x6d')]({'plain':!![]});return db[_0x1892('0x6e')][_0x1892('0x60')]({'where':{'id':_0x2f63be['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x152b7f,null))[_0x1892('0x3d')](function(_0xdc4364){if(_0xdc4364){return _0xdc4364[_0x1892('0x3c')]({'UserId':_0x56a6ad[_0x1892('0x62')][_0x1892('0x6a')],'read1stAt':_[_0x1892('0x6f')](_0xdc4364[_0x1892('0x70')])?moment()[_0x1892('0x71')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1892('0x3d')](function(_0x305746){if(_0x305746){_0xdc3380[_0x1892('0x72')]=_0x305746[_0x1892('0x6d')]({'plain':!![]});interaction_log[_0x1892('0x24')](_0x1892('0x73'),_0x56a6ad[_0x1892('0x6b')]['id'],_0x56a6ad['user']['name'],_0x56a6ad[_0x1892('0x6b')]['role'],_0xdc3380[_0x1892('0x72')]['id'],_0x56a6ad[_0x1892('0x62')]?JSON[_0x1892('0x29')](_0x56a6ad[_0x1892('0x62')]):'null');return respondWithRpcPromise(_0x1892('0x74'),_0x1892('0x75'),_0xdc3380);}return null;})[_0x1892('0x3d')](function(_0x5f926e){var _0x1108f2=_0x1892('0x76')+_0x5f926e['message'][_0x1892('0x77')];return db['sequelize'][_0x1892('0x49')](_0x1108f2,{'type':db['Sequelize'][_0x1892('0x78')][_0x1892('0x79')],'raw':!![]})[_0x1892('0x3d')](function(_0x525d24){return _0x525d24;});})[_0x1892('0x3d')](function(_0x1e45c2){if(_0x1e45c2){_0xdc3380[_0x1892('0x2c')]['contact']=_0x1e45c2[0x0];if(!_0x56a6ad['body'][_0x1892('0x6a')])return;return db['User']['find']({'where':{'id':_0x56a6ad[_0x1892('0x62')][_0x1892('0x6a')],'role':'agent'},'attributes':['id',_0x1892('0x3f'),_0x1892('0x7a'),_0x1892('0x7b'),_0x1892('0x7c')],'raw':!![]});}return null;})['then'](function(_0x1be543){if(!_0x1be543)return null;_0xdc3380['message']['agent']=_0x1be543;return _0xdc3380;})[_0x1892('0x3d')](function(_0x25e92c){if(_0x25e92c){if(_0x56a6ad[_0x1892('0x62')]['manual']){_0xdc3380[_0x1892('0x2c')][_0x1892('0x7d')]=util[_0x1892('0x71')](_0x1892('0x7e'),_0x56a6ad['user'][_0x1892('0x3f')]);_0xdc3380[_0x1892('0x2c')][_0x1892('0x7f')]=_0xdc3380[_0x1892('0x7f')];_0xdc3380['message'][_0x1892('0x80')]=_0x1892('0x66');return respondWithRpcPromise(_0x1892('0x81'),_0x1892('0x81'),{'event':_0x1892('0x82'),'message':_0xdc3380['message']},client9002)[_0x1892('0x3d')](function(){return _0xdc3380;});}return _0xdc3380;}return null;})[_0x1892('0x3d')](respondWithResult(_0x152b7f,null))[_0x1892('0x2e')](handleError(_0x152b7f,null));};var interaction_log=require('../../config/logger')(_0x1892('0x65'));exports['reject']=function(_0xa56851,_0x3f538d,_0x22d164){var _0x4cd529={'agent':{},'channel':_0x1892('0x67')};if(_0xa56851['body']['id']){delete _0xa56851[_0x1892('0x62')]['id'];}_0xa56851[_0x1892('0x62')][_0x1892('0x6a')]=_0xa56851['body'][_0x1892('0x6a')]||_0xa56851[_0x1892('0x6b')]['id'];_0x4cd529[_0x1892('0x6c')]['id']=_0xa56851[_0x1892('0x62')][_0x1892('0x6a')];return db[_0x1892('0x43')][_0x1892('0x60')]({'where':{'id':_0xa56851[_0x1892('0x5d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f538d,null))[_0x1892('0x3d')](function(_0x57028e){if(_0x57028e){_0x4cd529[_0x1892('0x2c')]=_0x57028e['get']({'plain':!![]});return db[_0x1892('0x6e')][_0x1892('0x60')]({'where':{'id':_0x57028e['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3f538d,null))[_0x1892('0x3d')](function(_0xd33f34){if(_0xd33f34){_0x4cd529[_0x1892('0x72')]=_0xd33f34['get']({'plain':!![]});interaction_log[_0x1892('0x24')](_0x1892('0x83'),_0xa56851[_0x1892('0x6b')]['id'],_0xa56851[_0x1892('0x6b')]['name'],_0xa56851['user'][_0x1892('0x84')],_0x4cd529['interaction']['id'],_0xa56851[_0x1892('0x62')]?JSON[_0x1892('0x29')](_0xa56851[_0x1892('0x62')]):_0x1892('0x85'));return respondWithRpcPromise(_0x1892('0x86'),_0x1892('0x87'),_0x4cd529);}return null;})[_0x1892('0x3d')](function(_0x14bce8){var _0x3a3f77=_0x1892('0x76')+_0x14bce8[_0x1892('0x2c')][_0x1892('0x77')];return db['sequelize'][_0x1892('0x49')](_0x3a3f77,{'type':db[_0x1892('0x88')]['QueryTypes'][_0x1892('0x79')],'raw':!![]})[_0x1892('0x3d')](function(_0x48aff7){return _0x48aff7;});})['then'](function(_0x37c74a){if(_0x37c74a){_0x4cd529[_0x1892('0x2c')][_0x1892('0x89')]=_0x37c74a[0x0];if(!_0xa56851[_0x1892('0x62')][_0x1892('0x6a')])return;return db[_0x1892('0x8a')]['find']({'where':{'id':_0xa56851[_0x1892('0x62')]['UserId'],'role':'agent'},'attributes':['id',_0x1892('0x3f'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x1892('0x3d')](function(_0x366669){if(!_0x366669)return null;_0x4cd529[_0x1892('0x2c')][_0x1892('0x6c')]=_0x366669;return _0x4cd529;})[_0x1892('0x3d')](function(_0x3d3f86){if(_0x3d3f86){_0x3d3f86[_0x1892('0x2c')][_0x1892('0x7d')]=util[_0x1892('0x71')]('SIP/%s',_0xa56851[_0x1892('0x6b')][_0x1892('0x3f')]);_0x3d3f86[_0x1892('0x2c')][_0x1892('0x7f')]=_0x4cd529[_0x1892('0x7f')];_0x3d3f86[_0x1892('0x2c')]['event']=_0x1892('0x3a');respondWithRpcPromise(_0x1892('0x81'),_0x1892('0x81'),{'event':_0x1892('0x8b'),'message':_0x3d3f86[_0x1892('0x2c')]},client9002);return _0x4cd529;}return null;})[_0x1892('0x3d')](respondWithResult(_0x3f538d,null))['catch'](handleError(_0x3f538d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 39ab4f0..a257647 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 _0xf1b9=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x57d463,_0x504d2a){var _0x39c275=function(_0x303c61){while(--_0x303c61){_0x57d463['push'](_0x57d463['shift']());}};_0x39c275(++_0x504d2a);}(_0xf1b9,0x128));var _0x9f1b=function(_0x522943,_0x4f38c3){_0x522943=_0x522943-0x0;var _0x2ed4e6=_0xf1b9[_0x522943];return _0x2ed4e6;};'use strict';var EventEmitter=require(_0x9f1b('0x0'));var OpenchannelMessage=require(_0x9f1b('0x1'))['db'][_0x9f1b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9f1b('0x3')](0x0);var events={'afterCreate':_0x9f1b('0x4'),'afterUpdate':_0x9f1b('0x5'),'afterDestroy':_0x9f1b('0x6')};function emitEvent(_0x53117d){return function(_0x67c996,_0x986643,_0x2d6cc2){OpenchannelMessageEvents['emit'](_0x53117d+':'+_0x67c996['id'],_0x67c996);OpenchannelMessageEvents['emit'](_0x53117d,_0x67c996);_0x2d6cc2(null);};}for(var e in events){if(events[_0x9f1b('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x28b4=['emit','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','remove'];(function(_0x3a79a1,_0x3a12d9){var _0x43a83b=function(_0x3d83d8){while(--_0x3d83d8){_0x3a79a1['push'](_0x3a79a1['shift']());}};_0x43a83b(++_0x3a12d9);}(_0x28b4,0xb1));var _0x428b=function(_0x3947f0,_0x36a4aa){_0x3947f0=_0x3947f0-0x0;var _0x4712be=_0x28b4[_0x3947f0];return _0x4712be;};'use strict';var EventEmitter=require(_0x428b('0x0'));var OpenchannelMessage=require(_0x428b('0x1'))['db'][_0x428b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x428b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x428b('0x4')};function emitEvent(_0x5466ff){return function(_0x26ee3f,_0x2ce485,_0x25db82){OpenchannelMessageEvents[_0x428b('0x5')](_0x5466ff+':'+_0x26ee3f['id'],_0x26ee3f);OpenchannelMessageEvents[_0x428b('0x5')](_0x5466ff,_0x26ee3f);_0x25db82(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x428b('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 49608d4..060b78f 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 _0xf7b4=['OpenchannelInteractionId','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','out','secret','CmContact','OpenchannelAccount','OpenchannelAccountId','Interactions'];(function(_0x110332,_0x21edf4){var _0x7e7dcb=function(_0x24b0ab){while(--_0x24b0ab){_0x110332['push'](_0x110332['shift']());}};_0x7e7dcb(++_0x21edf4);}(_0xf7b4,0x152));var _0x4f7b=function(_0x37707a,_0x4443a1){_0x37707a=_0x37707a-0x0;var _0x376883=_0xf7b4[_0x37707a];return _0x376883;};'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':[{'name':_0x4f7b('0xb'),'fields':[_0x4f7b('0xc')],'type':_0x4f7b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c714d,_0x433563,_0x1016e0){var _0x479208=_0x2637f0[_0x4f7b('0xe')];var _0x3a3d6c=_0x5c714d[_0x4f7b('0xf')]({'plain':!![]});if(_0x3a3d6c[_0x4f7b('0x10')][_0x4f7b('0x11')]()==='in'||_0x3a3d6c['direction'][_0x4f7b('0x11')]()==='out'&&!_0x3a3d6c['secret']&&!_[_0x4f7b('0x12')](_0x3a3d6c[_0x4f7b('0x13')])){_0x479208[_0x4f7b('0x14')][_0x4f7b('0x15')]({'where':{'id':_0x3a3d6c['OpenchannelInteractionId']}})[_0x4f7b('0x16')](function(_0x368091){if(_0x368091){_0x368091[_0x4f7b('0x17')]({'lastMsgAt':_0x3a3d6c[_0x4f7b('0x18')],'lastMsgDirection':_0x3a3d6c[_0x4f7b('0x10')][_0x4f7b('0x11')]()});}})[_0x4f7b('0x19')](function(_0x2437cc){console[_0x4f7b('0x1a')](_0x2437cc);});}if(_0x3a3d6c[_0x4f7b('0x10')]===_0x4f7b('0x1b')&&!_0x3a3d6c[_0x4f7b('0x1c')]){var _0x50a161;_0x479208[_0x4f7b('0x1d')]['describe']()['then'](function(_0x24e5cf){return _0x479208[_0x4f7b('0x1e')]['find']({'where':{'id':_0x3a3d6c[_0x4f7b('0x1f')]},'include':[{'model':_0x479208[_0x4f7b('0x14')],'as':_0x4f7b('0x20'),'where':{'id':_0x3a3d6c[_0x4f7b('0x21')]},'limit':0x1,'include':[{'model':_0x479208['CmContact'],'as':_0x4f7b('0x22'),'attributes':_['keys'](_0x24e5cf)}]}]});})[_0x4f7b('0x16')](function(_0x12374b){_0x50a161=_0x12374b[_0x4f7b('0xf')]({'plain':!![]});if(_0x50a161&&_0x50a161[_0x4f7b('0x23')]){logger[_0x4f7b('0x24')](_0x4f7b('0x25'),_0x4f7b('0x26'),util[_0x4f7b('0x27')](_0x4f7b('0x28'),_0x3a3d6c['id'],_0x50a161['replyUri']));if(_0x50a161[_0x4f7b('0x20')]&&_0x50a161[_0x4f7b('0x20')][_0x4f7b('0x29')]){_0x3a3d6c['Interaction']=_[_0x4f7b('0x2a')](_0x50a161[_0x4f7b('0x20')][0x0],'Contact');_0x3a3d6c[_0x4f7b('0x22')]=_0x50a161['Interactions'][0x0][_0x4f7b('0x22')];}var _0x433563={'method':_0x4f7b('0x2b'),'uri':encodeURI(_0x50a161[_0x4f7b('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x433563[_0x4f7b('0x2c')]){case _0x4f7b('0x2d'):_0x433563['qs']=_0x3a3d6c;break;case _0x4f7b('0x2b'):_0x433563[_0x4f7b('0xc')]=_0x3a3d6c;break;}return rp(_0x433563)['then'](function(_0x6c9626){logger[_0x4f7b('0x24')](_0x4f7b('0x25'),'afterCreate',util[_0x4f7b('0x27')](_0x4f7b('0x2e'),_0x3a3d6c['id'],_0x50a161[_0x4f7b('0x23')]));if(_0x6c9626[_0x4f7b('0xc')][_0x4f7b('0x2f')]&&_0x6c9626['body'][_0x4f7b('0x2f')]!=_0x3a3d6c[_0x4f7b('0x30')][_0x4f7b('0x2f')]){return _0x479208['OpenchannelInteraction'][_0x4f7b('0x17')]({'threadId':_0x6c9626['body']['threadId']},{'logging':!![],'where':{'id':_0x3a3d6c[_0x4f7b('0x30')]['id']}});}else{return;}})['then'](function(){return _0x5c714d[_0x4f7b('0x17')]({'read':!![]});})[_0x4f7b('0x19')](function(_0x22f489){logger[_0x4f7b('0x1a')](_0x4f7b('0x25'),_0x4f7b('0x26'),util[_0x4f7b('0x31')](_0x22f489,{'showHidden':![],'depth':null}));_0x1016e0();});}else{_0x1016e0();}})[_0x4f7b('0x32')](function(){_0x1016e0();});}else{_0x1016e0();}}},'charset':_0x4f7b('0x33'),'collate':_0x4f7b('0x34')});}; \ No newline at end of file +var _0x0972=['rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','replyUri','length','Interaction','omit','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','finally','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0972,0x64));var _0x2097=function(_0x3d68df,_0x5af574){_0x3d68df=_0x3d68df-0x0;var _0x378db4=_0x0972[_0x3d68df];return _0x378db4;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x2097('0x9'),'paranoid':![],'indexes':[{'name':_0x2097('0xa'),'fields':[_0x2097('0xb')],'type':_0x2097('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b8fac,_0x59d947,_0x2e0024){var _0x3b8b76=_0x2f84d8[_0x2097('0xd')];var _0x430754=_0x3b8fac[_0x2097('0xe')]({'plain':!![]});if(_0x430754[_0x2097('0xf')][_0x2097('0x10')]()==='in'||_0x430754[_0x2097('0xf')][_0x2097('0x10')]()===_0x2097('0x11')&&!_0x430754[_0x2097('0x12')]&&!_[_0x2097('0x13')](_0x430754[_0x2097('0x14')])){_0x3b8b76[_0x2097('0x15')][_0x2097('0x16')]({'where':{'id':_0x430754[_0x2097('0x17')]}})[_0x2097('0x18')](function(_0x1c9ef9){if(_0x1c9ef9){_0x1c9ef9[_0x2097('0x19')]({'lastMsgAt':_0x430754[_0x2097('0x1a')],'lastMsgDirection':_0x430754['direction'][_0x2097('0x10')]()});}})[_0x2097('0x1b')](function(_0x4d31bc){console['error'](_0x4d31bc);});}if(_0x430754['direction']===_0x2097('0x11')&&!_0x430754['secret']){var _0x28c35c;_0x3b8b76[_0x2097('0x1c')][_0x2097('0x1d')]()[_0x2097('0x18')](function(_0x44c584){return _0x3b8b76['OpenchannelAccount'][_0x2097('0x1e')]({'where':{'id':_0x430754[_0x2097('0x1f')]},'include':[{'model':_0x3b8b76[_0x2097('0x15')],'as':_0x2097('0x20'),'where':{'id':_0x430754[_0x2097('0x17')]},'limit':0x1,'include':[{'model':_0x3b8b76[_0x2097('0x1c')],'as':_0x2097('0x21'),'attributes':_[_0x2097('0x22')](_0x44c584)}]}]});})['then'](function(_0x4d957e){_0x28c35c=_0x4d957e[_0x2097('0xe')]({'plain':!![]});if(_0x28c35c&&_0x28c35c['replyUri']){logger[_0x2097('0x23')](_0x2097('0x24'),'afterCreate',util[_0x2097('0x25')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x430754['id'],_0x28c35c[_0x2097('0x26')]));if(_0x28c35c[_0x2097('0x20')]&&_0x28c35c[_0x2097('0x20')][_0x2097('0x27')]){_0x430754[_0x2097('0x28')]=_[_0x2097('0x29')](_0x28c35c['Interactions'][0x0],_0x2097('0x21'));_0x430754['Contact']=_0x28c35c[_0x2097('0x20')][0x0][_0x2097('0x21')];}var _0x59d947={'method':_0x2097('0x2a'),'uri':encodeURI(_0x28c35c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x59d947[_0x2097('0x2b')]){case _0x2097('0x2c'):_0x59d947['qs']=_0x430754;break;case'POST':_0x59d947[_0x2097('0xb')]=_0x430754;break;}return rp(_0x59d947)['then'](function(_0x29b879){logger['info'](_0x2097('0x24'),_0x2097('0x2d'),util[_0x2097('0x25')](_0x2097('0x2e'),_0x430754['id'],_0x28c35c[_0x2097('0x26')]));if(_0x29b879[_0x2097('0xb')][_0x2097('0x2f')]&&_0x29b879['body'][_0x2097('0x2f')]!=_0x430754[_0x2097('0x28')]['threadId']){return _0x3b8b76[_0x2097('0x15')][_0x2097('0x19')]({'threadId':_0x29b879['body']['threadId']},{'logging':!![],'where':{'id':_0x430754[_0x2097('0x28')]['id']}});}else{return;}})[_0x2097('0x18')](function(){return _0x3b8fac[_0x2097('0x19')]({'read':!![]});})[_0x2097('0x1b')](function(_0x74ccdc){logger[_0x2097('0x30')]('OpenchannelMessage,\x20%s,\x20%s',_0x2097('0x2d'),util['inspect'](_0x74ccdc,{'showHidden':![],'depth':null}));_0x2e0024();});}else{_0x2e0024();}})[_0x2097('0x31')](function(){_0x2e0024();});}else{_0x2e0024();}}},'charset':_0x2097('0x32'),'collate':_0x2097('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 0b2f47a..d2eda17 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1ce129,_0x9fca0b){var _0x3c29e2=function(_0x4fd7a7){while(--_0x4fd7a7){_0x1ce129['push'](_0x1ce129['shift']());}};_0x3c29e2(++_0x9fca0b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +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(_0x42554d,_0x2dc2e6){var _0x5e9e01=function(_0x5561ea){while(--_0x5561ea){_0x42554d['push'](_0x42554d['shift']());}};_0x5e9e01(++_0x2dc2e6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3d2362,_0x3ca9f0){_0x3d2362=_0x3d2362-0x0;var _0x1b4b5a=_0x5f2f[_0x3d2362];return _0x1b4b5a;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index a90b780..8d2606a 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 _0x82f8=['length','save','remove','emit','removeListener','register'];(function(_0xe70f6c,_0x3b734d){var _0x29d959=function(_0x37c8d9){while(--_0x37c8d9){_0xe70f6c['push'](_0xe70f6c['shift']());}};_0x29d959(++_0x3b734d);}(_0x82f8,0x157));var _0x882f=function(_0x1096a8,_0x1bf228){_0x1096a8=_0x1096a8-0x0;var _0x5e1a53=_0x82f8[_0x1096a8];return _0x5e1a53;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x882f('0x0'),_0x882f('0x1'),'update'];function createListener(_0xac1624,_0x2ffd9c){return function(_0x106930){_0x2ffd9c[_0x882f('0x2')](_0xac1624,_0x106930);};}function removeListener(_0x2fad3e,_0x181655){return function(){OpenchannelMessageEvents[_0x882f('0x3')](_0x2fad3e,_0x181655);};}exports[_0x882f('0x4')]=function(_0x4efdc9){for(var _0x57fc29=0x0,_0x3c414d=events[_0x882f('0x5')];_0x57fc29<_0x3c414d;_0x57fc29++){var _0x3efa94=events[_0x57fc29];var _0x2e6f92=createListener('openchannelMessage:'+_0x3efa94,_0x4efdc9);OpenchannelMessageEvents['on'](_0x3efa94,_0x2e6f92);}}; \ No newline at end of file +var _0x5379=['remove','emit','length','./openchannelMessage.events','save'];(function(_0x5a30e8,_0x595db8){var _0x4095c0=function(_0x40424a){while(--_0x40424a){_0x5a30e8['push'](_0x5a30e8['shift']());}};_0x4095c0(++_0x595db8);}(_0x5379,0x1a2));var _0x9537=function(_0x553cde,_0x2c697a){_0x553cde=_0x553cde-0x0;var _0x25335d=_0x5379[_0x553cde];return _0x25335d;};'use strict';var OpenchannelMessageEvents=require(_0x9537('0x0'));var events=[_0x9537('0x1'),_0x9537('0x2'),'update'];function createListener(_0x2e1f6f,_0x5a0662){return function(_0x449248){_0x5a0662[_0x9537('0x3')](_0x2e1f6f,_0x449248);};}function removeListener(_0x2bc830,_0x35ff2c){return function(){OpenchannelMessageEvents['removeListener'](_0x2bc830,_0x35ff2c);};}exports['register']=function(_0x3ee12d){for(var _0x5a62f0=0x0,_0x227ac6=events[_0x9537('0x4')];_0x5a62f0<_0x227ac6;_0x5a62f0++){var _0x379123=events[_0x5a62f0];var _0x2b7054=createListener('openchannelMessage:'+_0x379123,_0x3ee12d);OpenchannelMessageEvents['on'](_0x379123,_0x2b7054);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 0ea5aac..037f746 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 _0x4842=['index','/describe','describe','/:id','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','delete','removeAgents','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x5d90b9,_0x39692a){var _0x22fef0=function(_0xa3c5a7){while(--_0xa3c5a7){_0x5d90b9['push'](_0x5d90b9['shift']());}};_0x22fef0(++_0x39692a);}(_0x4842,0x147));var _0x2484=function(_0x2ac99f,_0x41acaa){_0x2ac99f=_0x2ac99f-0x0;var _0x168114=_0x4842[_0x2ac99f];return _0x168114;};'use strict';var multer=require('multer');var util=require(_0x2484('0x0'));var path=require(_0x2484('0x1'));var timeout=require('connect-timeout');var express=require(_0x2484('0x2'));var router=express[_0x2484('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2484('0x4'));var config=require(_0x2484('0x5'));var controller=require(_0x2484('0x6'));router[_0x2484('0x7')]('/',auth[_0x2484('0x8')](),controller[_0x2484('0x9')]);router['get'](_0x2484('0xa'),auth['isAuthenticated'](),controller[_0x2484('0xb')]);router[_0x2484('0x7')](_0x2484('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2484('0x7')](_0x2484('0xd'),auth[_0x2484('0x8')](),controller['getMembers']);router[_0x2484('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2484('0xe')]);router[_0x2484('0x7')](_0x2484('0xf'),auth[_0x2484('0x8')](),controller[_0x2484('0x10')]);router[_0x2484('0x11')]('/',auth['isAuthenticated'](),controller[_0x2484('0x12')]);router[_0x2484('0x11')](_0x2484('0x13'),auth[_0x2484('0x8')](),controller['addTeams']);router[_0x2484('0x11')](_0x2484('0xf'),auth[_0x2484('0x8')](),controller[_0x2484('0x14')]);router['put'](_0x2484('0xc'),auth[_0x2484('0x8')](),controller['update']);router['delete'](_0x2484('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x2484('0x15')](_0x2484('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x2484('0xf'),auth[_0x2484('0x8')](),controller[_0x2484('0x16')]);module[_0x2484('0x17')]=router; \ No newline at end of file +var _0xc378=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','create','addTeams','post','addAgents','update','delete','removeTeams','/:id/users','removeAgents','exports','multer','util'];(function(_0x48773d,_0x32346f){var _0x2f0694=function(_0x24efbe){while(--_0x24efbe){_0x48773d['push'](_0x48773d['shift']());}};_0x2f0694(++_0x32346f);}(_0xc378,0x16a));var _0x8c37=function(_0x13c174,_0xda25fe){_0x13c174=_0x13c174-0x0;var _0x160654=_0xc378[_0x13c174];return _0x160654;};'use strict';var multer=require(_0x8c37('0x0'));var util=require(_0x8c37('0x1'));var path=require('path');var timeout=require(_0x8c37('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8c37('0x3'));var auth=require(_0x8c37('0x4'));var interaction=require(_0x8c37('0x5'));var config=require('../../config/environment');var controller=require(_0x8c37('0x6'));router[_0x8c37('0x7')]('/',auth[_0x8c37('0x8')](),controller[_0x8c37('0x9')]);router[_0x8c37('0x7')](_0x8c37('0xa'),auth[_0x8c37('0x8')](),controller[_0x8c37('0xb')]);router['get'](_0x8c37('0xc'),auth[_0x8c37('0x8')](),controller[_0x8c37('0xd')]);router[_0x8c37('0x7')]('/:id/members',auth[_0x8c37('0x8')](),controller[_0x8c37('0xe')]);router[_0x8c37('0x7')](_0x8c37('0xf'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x10')]);router[_0x8c37('0x7')]('/:id/users',auth[_0x8c37('0x8')](),controller[_0x8c37('0x11')]);router['post']('/',auth[_0x8c37('0x8')](),controller[_0x8c37('0x12')]);router['post'](_0x8c37('0xf'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x13')]);router[_0x8c37('0x14')]('/:id/users',auth[_0x8c37('0x8')](),controller[_0x8c37('0x15')]);router['put'](_0x8c37('0xc'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x16')]);router[_0x8c37('0x17')](_0x8c37('0xc'),auth[_0x8c37('0x8')](),controller['destroy']);router[_0x8c37('0x17')](_0x8c37('0xf'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x18')]);router[_0x8c37('0x17')](_0x8c37('0x19'),auth[_0x8c37('0x8')](),controller[_0x8c37('0x1a')]);module[_0x8c37('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 42dd97f..2671665 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 _0x4da6=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4da6,0x198));var _0x64da=function(_0x3cb6ab,_0x5e7131){_0x3cb6ab=_0x3cb6ab-0x0;var _0x4e7b17=_0x4da6[_0x3cb6ab];return _0x4e7b17;};'use strict';var Sequelize=require(_0x64da('0x0'));module[_0x64da('0x1')]={'name':{'type':Sequelize[_0x64da('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x64da('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x64da('0x4')](_0x64da('0x5'),_0x64da('0x6'),_0x64da('0x7'))}}; \ No newline at end of file +var _0x8b87=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x3f8648,_0x17cb1a){var _0x44c3fd=function(_0x1ab02b){while(--_0x1ab02b){_0x3f8648['push'](_0x3f8648['shift']());}};_0x44c3fd(++_0x17cb1a);}(_0x8b87,0x162));var _0x78b8=function(_0xd278f9,_0x157d43){_0xd278f9=_0xd278f9-0x0;var _0x3d7e95=_0x8b87[_0xd278f9];return _0x3d7e95;};'use strict';var Sequelize=require('sequelize');module[_0x78b8('0x0')]={'name':{'type':Sequelize[_0x78b8('0x1')],'unique':_0x78b8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x78b8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x78b8('0x4')](_0x78b8('0x5'),_0x78b8('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 59f7c3e..897efb4 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 _0x0fbc=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params','describe','UserOpenchannelQueue','length','OpenchannelQueueId','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','removeTeams','User','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','end','status','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','OpenchannelQueue','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','include'];(function(_0x179bf8,_0x3c45a5){var _0x582450=function(_0x22b5e0){while(--_0x22b5e0){_0x179bf8['push'](_0x179bf8['shift']());}};_0x582450(++_0x3c45a5);}(_0x0fbc,0x157));var _0xc0fb=function(_0x54a191,_0x3381cf){_0x54a191=_0x54a191-0x0;var _0x39b21f=_0x0fbc[_0x54a191];return _0x39b21f;};'use strict';var emlformat=require(_0xc0fb('0x0'));var rimraf=require(_0xc0fb('0x1'));var zipdir=require(_0xc0fb('0x2'));var jsonpatch=require(_0xc0fb('0x3'));var rp=require(_0xc0fb('0x4'));var moment=require(_0xc0fb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc0fb('0x6'));var path=require('path');var sox=require(_0xc0fb('0x7'));var csv=require(_0xc0fb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0fb('0x9'));var _=require(_0xc0fb('0xa'));var squel=require(_0xc0fb('0xb'));var crypto=require(_0xc0fb('0xc'));var jsforce=require(_0xc0fb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc0fb('0x8'));var querystring=require(_0xc0fb('0xe'));var Papa=require(_0xc0fb('0xf'));var Redis=require(_0xc0fb('0x10'));var authService=require(_0xc0fb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc0fb('0x12'));var hardwareService=require(_0xc0fb('0x13'));var logger=require(_0xc0fb('0x14'))('api');var utils=require(_0xc0fb('0x15'));var config=require(_0xc0fb('0x16'));var licenseUtil=require(_0xc0fb('0x17'));var db=require(_0xc0fb('0x18'))['db'];config[_0xc0fb('0x19')]=_[_0xc0fb('0x1a')](config[_0xc0fb('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xc0fb('0x1b')](socket);function respondWithStatusCode(_0x23342e,_0x344661){_0x344661=_0x344661||0xcc;return function(_0x42cebc){if(_0x42cebc){return _0x23342e[_0xc0fb('0x1c')](_0x344661);}return _0x23342e['status'](_0x344661)[_0xc0fb('0x1d')]();};}function respondWithResult(_0x4d9c06,_0x566655){_0x566655=_0x566655||0xc8;return function(_0x258026){if(_0x258026){return _0x4d9c06[_0xc0fb('0x1e')](_0x566655)['json'](_0x258026);}};}function respondWithFilteredResult(_0x832e67,_0x147876){return function(_0x241c0c){if(_0x241c0c){var _0x41aa18=typeof _0x147876[_0xc0fb('0x1f')]==='undefined'&&typeof _0x147876['limit']==='undefined';var _0x218692=_0x241c0c[_0xc0fb('0x20')];var _0x391b0c=_0x41aa18?0x0:_0x147876[_0xc0fb('0x1f')];var _0x15e39d=_0x41aa18?_0x241c0c['count']:_0x147876['offset']+_0x147876[_0xc0fb('0x21')];var _0x5818bd;if(_0x15e39d>=_0x218692){_0x15e39d=_0x218692;_0x5818bd=0xc8;}else{_0x5818bd=0xce;}_0x832e67['status'](_0x5818bd);return _0x832e67[_0xc0fb('0x22')](_0xc0fb('0x23'),_0x391b0c+'-'+_0x15e39d+'/'+_0x218692)[_0xc0fb('0x24')](_0x241c0c);}return null;};}function patchUpdates(_0x3f79ce){return function(_0x3e8fc5){try{jsonpatch[_0xc0fb('0x25')](_0x3e8fc5,_0x3f79ce,!![]);}catch(_0x12402d){return BPromise[_0xc0fb('0x26')](_0x12402d);}return _0x3e8fc5['save']();};}function saveUpdates(_0x5c2998,_0x2637e6){return function(_0x523a01){if(_0x523a01){return _0x523a01[_0xc0fb('0x27')](_0x5c2998)[_0xc0fb('0x28')](function(_0x582481){return _0x582481;});}return null;};}function removeEntity(_0x427d1b,_0x5a7fae){return function(_0x5cd663){if(_0x5cd663){return _0x5cd663[_0xc0fb('0x29')]()[_0xc0fb('0x28')](function(){var _0x58d3e6=_0x5cd663[_0xc0fb('0x2a')]({'plain':!![]});var _0x1b6caf=_0xc0fb('0x2b');return db[_0xc0fb('0x2c')]['destroy']({'where':{'type':_0x1b6caf,'resourceId':_0x58d3e6['id']}})[_0xc0fb('0x28')](function(){return _0x5cd663;});})['then'](function(){_0x427d1b[_0xc0fb('0x1e')](0xcc)[_0xc0fb('0x1d')]();});}};}function handleEntityNotFound(_0x2111dc,_0x192e94){return function(_0x50d674){if(!_0x50d674){_0x2111dc[_0xc0fb('0x1c')](0x194);}return _0x50d674;};}function handleError(_0x131277,_0xd369c1){_0xd369c1=_0xd369c1||0x1f4;return function(_0x3993d3){logger[_0xc0fb('0x2d')](_0x3993d3[_0xc0fb('0x2e')]);if(_0x3993d3[_0xc0fb('0x2f')]){delete _0x3993d3[_0xc0fb('0x2f')];}_0x131277[_0xc0fb('0x1e')](_0xd369c1)['send'](_0x3993d3);};}exports[_0xc0fb('0x30')]=function(_0x547232,_0x27dab2){var _0x1b2da2={},_0x293305={},_0x34b657={'count':0x0,'rows':[]};var _0x1dbcb2=_[_0xc0fb('0x31')](db[_0xc0fb('0x32')][_0xc0fb('0x33')],function(_0x256890){return{'name':_0x256890['fieldName'],'type':_0x256890[_0xc0fb('0x34')]['key']};});_0x293305[_0xc0fb('0x35')]=_[_0xc0fb('0x31')](_0x1dbcb2,'name');_0x293305[_0xc0fb('0x36')]=_[_0xc0fb('0x37')](_0x547232['query']);_0x293305[_0xc0fb('0x38')]=_['intersection'](_0x293305['model'],_0x293305['query']);_0x1b2da2['attributes']=_[_0xc0fb('0x39')](_0x293305['model'],qs['fields'](_0x547232[_0xc0fb('0x36')][_0xc0fb('0x3a')]));_0x1b2da2['attributes']=_0x1b2da2[_0xc0fb('0x3b')]['length']?_0x1b2da2['attributes']:_0x293305[_0xc0fb('0x35')];if(!_0x547232[_0xc0fb('0x36')]['hasOwnProperty'](_0xc0fb('0x3c'))){_0x1b2da2[_0xc0fb('0x21')]=qs[_0xc0fb('0x21')](_0x547232['query'][_0xc0fb('0x21')]);_0x1b2da2['offset']=qs[_0xc0fb('0x1f')](_0x547232[_0xc0fb('0x36')][_0xc0fb('0x1f')]);}_0x1b2da2[_0xc0fb('0x3d')]=qs[_0xc0fb('0x3e')](_0x547232[_0xc0fb('0x36')][_0xc0fb('0x3e')]);_0x1b2da2[_0xc0fb('0x3f')]=qs['filters'](_[_0xc0fb('0x40')](_0x547232['query'],_0x293305[_0xc0fb('0x38')]),_0x1dbcb2);if(_0x547232[_0xc0fb('0x36')]['filter']){_0x1b2da2['where']=_['merge'](_0x1b2da2['where'],{'$or':_[_0xc0fb('0x31')](_0x1dbcb2,function(_0x18b6c9){if(_0x18b6c9['type']!=='VIRTUAL'){var _0x3ea85a={};_0x3ea85a[_0x18b6c9['name']]={'$like':'%'+_0x547232[_0xc0fb('0x36')][_0xc0fb('0x41')]+'%'};return _0x3ea85a;}})});}_0x1b2da2=_[_0xc0fb('0x42')]({},_0x1b2da2,_0x547232[_0xc0fb('0x43')]);var _0x1821ce={'where':_0x1b2da2[_0xc0fb('0x3f')]};return db['OpenchannelQueue'][_0xc0fb('0x20')](_0x1821ce)['then'](function(_0x368600){_0x34b657['count']=_0x368600;if(_0x547232[_0xc0fb('0x36')][_0xc0fb('0x44')]){_0x1b2da2['include']=[{'all':!![]}];}return db[_0xc0fb('0x32')][_0xc0fb('0x45')](_0x1b2da2);})[_0xc0fb('0x28')](function(_0x347455){_0x34b657[_0xc0fb('0x46')]=_0x347455;return _0x34b657;})[_0xc0fb('0x28')](respondWithFilteredResult(_0x27dab2,_0x1b2da2))[_0xc0fb('0x47')](handleError(_0x27dab2,null));};exports[_0xc0fb('0x48')]=function(_0x136af8,_0x43694f){var _0x2b87b3={'raw':!![],'where':{'id':_0x136af8['params']['id']}},_0x369c74={};_0x369c74[_0xc0fb('0x35')]=_[_0xc0fb('0x37')](db[_0xc0fb('0x32')]['rawAttributes']);_0x369c74[_0xc0fb('0x36')]=_[_0xc0fb('0x37')](_0x136af8[_0xc0fb('0x36')]);_0x369c74[_0xc0fb('0x38')]=_[_0xc0fb('0x39')](_0x369c74[_0xc0fb('0x35')],_0x369c74[_0xc0fb('0x36')]);_0x2b87b3[_0xc0fb('0x3b')]=_[_0xc0fb('0x39')](_0x369c74['model'],qs[_0xc0fb('0x3a')](_0x136af8[_0xc0fb('0x36')][_0xc0fb('0x3a')]));_0x2b87b3[_0xc0fb('0x3b')]=_0x2b87b3[_0xc0fb('0x3b')]['length']?_0x2b87b3[_0xc0fb('0x3b')]:_0x369c74[_0xc0fb('0x35')];if(_0x136af8[_0xc0fb('0x36')][_0xc0fb('0x44')]){_0x2b87b3[_0xc0fb('0x49')]=[{'all':!![]}];}_0x2b87b3=_[_0xc0fb('0x42')]({},_0x2b87b3,_0x136af8['options']);return db[_0xc0fb('0x32')][_0xc0fb('0x4a')](_0x2b87b3)[_0xc0fb('0x28')](handleEntityNotFound(_0x43694f,null))[_0xc0fb('0x28')](respondWithResult(_0x43694f,null))[_0xc0fb('0x47')](handleError(_0x43694f,null));};exports['create']=function(_0x2f0e4a,_0x195eba){return db[_0xc0fb('0x32')][_0xc0fb('0x4b')](_0x2f0e4a[_0xc0fb('0x4c')],{})[_0xc0fb('0x28')](function(_0x1d186b){var _0x9875d0=_0x2f0e4a[_0xc0fb('0x4d')]['get']({'plain':!![]});if(!_0x9875d0)throw new Error(_0xc0fb('0x4e'));if(_0x9875d0[_0xc0fb('0x4f')]===_0xc0fb('0x4d')){var _0x2ccc45=_0x1d186b[_0xc0fb('0x2a')]({'plain':!![]});var _0x3b2bab='OpenchannelQueues';return db[_0xc0fb('0x50')][_0xc0fb('0x4a')]({'where':{'name':_0x3b2bab,'userProfileId':_0x9875d0['userProfileId']},'raw':!![]})['then'](function(_0x32c309){if(_0x32c309&&_0x32c309['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2ccc45[_0xc0fb('0x2f')],'resourceId':_0x2ccc45['id'],'type':_0x32c309[_0xc0fb('0x2f')],'sectionId':_0x32c309['id']},{})['then'](function(){return _0x1d186b;});}else{return _0x1d186b;}})[_0xc0fb('0x47')](function(_0x530cfd){logger[_0xc0fb('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x530cfd);throw _0x530cfd;});}return _0x1d186b;})[_0xc0fb('0x28')](respondWithResult(_0x195eba,0xc9))[_0xc0fb('0x47')](handleError(_0x195eba,null));};exports[_0xc0fb('0x27')]=function(_0x2c951f,_0x47540b){if(_0x2c951f['body']['id']){delete _0x2c951f[_0xc0fb('0x4c')]['id'];}return db[_0xc0fb('0x32')][_0xc0fb('0x4a')]({'where':{'id':_0x2c951f[_0xc0fb('0x51')]['id']}})['then'](handleEntityNotFound(_0x47540b,null))[_0xc0fb('0x28')](saveUpdates(_0x2c951f['body'],null))[_0xc0fb('0x28')](respondWithResult(_0x47540b,null))[_0xc0fb('0x47')](handleError(_0x47540b,null));};exports[_0xc0fb('0x29')]=function(_0x328f6b,_0x5c089d){return db[_0xc0fb('0x32')]['find']({'where':{'id':_0x328f6b[_0xc0fb('0x51')]['id']}})[_0xc0fb('0x28')](handleEntityNotFound(_0x5c089d,null))[_0xc0fb('0x28')](removeEntity(_0x5c089d,null))[_0xc0fb('0x47')](handleError(_0x5c089d,null));};exports['describe']=function(_0x4bc1d5,_0x157156){return db[_0xc0fb('0x32')][_0xc0fb('0x52')]()['then'](respondWithResult(_0x157156,null))[_0xc0fb('0x47')](handleError(_0x157156,null));};exports['getMembers']=function(_0x3e459f,_0x118206,_0x5f3f6d){var _0x2cf808={'raw':!![],'where':{}},_0xba05c2={},_0x166da0;return db[_0xc0fb('0x32')]['findOne']({'where':{'id':_0x3e459f[_0xc0fb('0x51')]['id']}})['then'](handleEntityNotFound(_0x118206,null))['then'](function(_0x1de669){if(_0x1de669){_0x166da0=_0x1de669[_0xc0fb('0x2a')]({'plain':!![]});_0xba05c2[_0xc0fb('0x35')]=_['keys'](db[_0xc0fb('0x53')][_0xc0fb('0x33')]);_0xba05c2['query']=_[_0xc0fb('0x37')](_0x3e459f['query']);_0xba05c2[_0xc0fb('0x38')]=_['intersection'](_0xba05c2['model'],_0xba05c2['query']);_0x2cf808[_0xc0fb('0x3b')]=_[_0xc0fb('0x39')](_0xba05c2[_0xc0fb('0x35')],qs['fields'](_0x3e459f[_0xc0fb('0x36')]['fields']));_0x2cf808[_0xc0fb('0x3b')]=_0x2cf808[_0xc0fb('0x3b')][_0xc0fb('0x54')]?_0x2cf808[_0xc0fb('0x3b')]:_0xba05c2[_0xc0fb('0x35')];if(!_0x3e459f['query']['hasOwnProperty']('nolimit')){_0x2cf808[_0xc0fb('0x21')]=qs['limit'](_0x3e459f[_0xc0fb('0x36')][_0xc0fb('0x21')]);_0x2cf808['offset']=qs[_0xc0fb('0x1f')](_0x3e459f['query'][_0xc0fb('0x1f')]);}_0x2cf808[_0xc0fb('0x3d')]=qs[_0xc0fb('0x3e')](_0x3e459f['query'][_0xc0fb('0x3e')]);_0x2cf808['where']=qs[_0xc0fb('0x38')](_[_0xc0fb('0x40')](_0x3e459f[_0xc0fb('0x36')],_0xba05c2[_0xc0fb('0x38')]));_0x2cf808[_0xc0fb('0x3f')][_0xc0fb('0x55')]=_0x1de669['id'];if(_0x3e459f[_0xc0fb('0x36')]['filter']){_0x2cf808[_0xc0fb('0x3f')]=_[_0xc0fb('0x42')](_0x2cf808[_0xc0fb('0x3f')],{'$or':_[_0xc0fb('0x31')](_0x2cf808['attributes'],function(_0x55e299){var _0x20d824={};_0x20d824[_0x55e299]={'$like':'%'+_0x3e459f[_0xc0fb('0x36')][_0xc0fb('0x41')]+'%'};return _0x20d824;})});}_0x2cf808=_[_0xc0fb('0x42')]({},_0x2cf808,_0x3e459f[_0xc0fb('0x43')]);return db['UserOpenchannelQueue'][_0xc0fb('0x45')](_0x2cf808);}})[_0xc0fb('0x28')](function(_0x272f83){if(_0x272f83){return db['User'][_0xc0fb('0x56')]({'where':{'id':_[_0xc0fb('0x31')](_0x272f83,'UserId'),'role':_0xc0fb('0x57')},'attributes':['id',_0xc0fb('0x2f'),_0xc0fb('0x58'),_0xc0fb('0x59'),_0xc0fb('0x5a')]});}})[_0xc0fb('0x28')](function(_0x11e78b){if(_0x11e78b){return{'count':_0x11e78b[_0xc0fb('0x20')],'rows':_['map'](_0x11e78b[_0xc0fb('0x46')],function(_0x2a865f){return{'membername':_0x2a865f['name'],'UserId':_0x2a865f['id'],'queue_name':_0x166da0[_0xc0fb('0x2f')],'OpenchannelQueueId':_0x166da0['id'],'interface':util[_0xc0fb('0x5b')](_0xc0fb('0x5c'),_0xc0fb('0x5d'),_0x2a865f[_0xc0fb('0x2f')]),'penalty':0x0,'paused':_0x2a865f[_0xc0fb('0x58')],'createdAt':_0x2a865f[_0xc0fb('0x5a')],'updatedAt':_0x2a865f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc0fb('0x28')](respondWithFilteredResult(_0x118206,_0x2cf808))[_0xc0fb('0x47')](handleError(_0x118206,null));};exports[_0xc0fb('0x5e')]=function(_0x5bcbeb,_0x2d4195,_0x2aa765){var _0x15be95={};var _0x3e2baa={};var _0x6d7a;var _0xa6c5d2;return db['OpenchannelQueue'][_0xc0fb('0x5f')]({'where':{'id':_0x5bcbeb['params']['id']}})[_0xc0fb('0x28')](handleEntityNotFound(_0x2d4195,null))[_0xc0fb('0x28')](function(_0x215e44){if(_0x215e44){_0x6d7a=_0x215e44;_0x3e2baa[_0xc0fb('0x35')]=_[_0xc0fb('0x37')](db[_0xc0fb('0x60')]['rawAttributes']);_0x3e2baa[_0xc0fb('0x36')]=_[_0xc0fb('0x37')](_0x5bcbeb[_0xc0fb('0x36')]);_0x3e2baa[_0xc0fb('0x38')]=_[_0xc0fb('0x39')](_0x3e2baa[_0xc0fb('0x35')],_0x3e2baa[_0xc0fb('0x36')]);_0x15be95[_0xc0fb('0x3b')]=_['intersection'](_0x3e2baa[_0xc0fb('0x35')],qs[_0xc0fb('0x3a')](_0x5bcbeb[_0xc0fb('0x36')][_0xc0fb('0x3a')]));_0x15be95['attributes']=_0x15be95['attributes'][_0xc0fb('0x54')]?_0x15be95['attributes']:_0x3e2baa[_0xc0fb('0x35')];_0x15be95[_0xc0fb('0x3d')]=qs[_0xc0fb('0x3e')](_0x5bcbeb[_0xc0fb('0x36')][_0xc0fb('0x3e')]);_0x15be95[_0xc0fb('0x3f')]=qs['filters'](_[_0xc0fb('0x40')](_0x5bcbeb[_0xc0fb('0x36')],_0x3e2baa[_0xc0fb('0x38')]));if(_0x5bcbeb[_0xc0fb('0x36')][_0xc0fb('0x41')]){_0x15be95[_0xc0fb('0x3f')]=_[_0xc0fb('0x42')](_0x15be95[_0xc0fb('0x3f')],{'$or':_[_0xc0fb('0x31')](_0x15be95[_0xc0fb('0x3b')],function(_0x14dae2){var _0x495d9d={};_0x495d9d[_0x14dae2]={'$like':'%'+_0x5bcbeb[_0xc0fb('0x36')]['filter']+'%'};return _0x495d9d;})});}_0x15be95=_[_0xc0fb('0x42')]({},_0x15be95,_0x5bcbeb[_0xc0fb('0x43')]);return _0x6d7a[_0xc0fb('0x5e')](_0x15be95);}})[_0xc0fb('0x28')](function(_0x5a868d){if(_0x5a868d){_0xa6c5d2=_0x5a868d[_0xc0fb('0x54')];if(!_0x5bcbeb[_0xc0fb('0x36')][_0xc0fb('0x61')](_0xc0fb('0x3c'))){_0x15be95['limit']=qs[_0xc0fb('0x21')](_0x5bcbeb[_0xc0fb('0x36')][_0xc0fb('0x21')]);_0x15be95['offset']=qs[_0xc0fb('0x1f')](_0x5bcbeb['query']['offset']);}return _0x6d7a[_0xc0fb('0x5e')](_0x15be95);}})['then'](function(_0x2bc32c){if(_0x2bc32c){return _0x2bc32c?{'count':_0xa6c5d2,'rows':_0x2bc32c}:null;}})['then'](respondWithResult(_0x2d4195,null))[_0xc0fb('0x47')](handleError(_0x2d4195,null));};exports[_0xc0fb('0x62')]=function(_0x42f742,_0x55e629,_0x500d33){var _0x1adc15=_0x42f742['body'][_0xc0fb('0x63')];return db['Team'][_0xc0fb('0x45')]({'where':{'id':_0x1adc15},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc0fb('0x64'),'attributes':['id',_0xc0fb('0x2f'),_0xc0fb('0x65'),_0xc0fb('0x66'),_0xc0fb('0x67')],'raw':!![]}]})[_0xc0fb('0x28')](function(_0x29ea04){if(_0x29ea04){var _0x4bb4f3=_[_0xc0fb('0x68')](_0x29ea04,function(_0x5bc6a0){var _0x520d75=_0x5bc6a0[_0xc0fb('0x2a')]({'plain':!![]});return _0x520d75[_0xc0fb('0x64')];});return db['OpenchannelQueue'][_0xc0fb('0x4a')]({'where':{'id':_0x42f742['params']['id']}})[_0xc0fb('0x28')](function(_0x2d8dfb){return db[_0xc0fb('0x69')][_0xc0fb('0x6a')](function(_0x14b4f7){return _0x2d8dfb[_0xc0fb('0x62')](_0x1adc15,{'transaction':_0x14b4f7})['then'](function(){return BPromise[_0xc0fb('0x6b')](_0x4bb4f3,function(_0x2b4ae7){return db[_0xc0fb('0x53')]['findOrCreate']({'where':{'UserId':_0x2b4ae7['id'],'OpenchannelQueueId':_0x42f742[_0xc0fb('0x51')]['id']},'transaction':_0x14b4f7});});})['then'](function(){_0x4bb4f3[_0xc0fb('0x6c')](function(_0x4cb6ce){socket[_0xc0fb('0x6d')]('userOpenchannelQueue:save',{'UserId':_0x4cb6ce['id'],'OpenchannelQueueId':_0x2d8dfb['id']});});});});});}})[_0xc0fb('0x28')](respondWithStatusCode(_0x55e629,null))['catch'](handleError(_0x55e629,null));};exports[_0xc0fb('0x6e')]=function(_0xeda42e,_0x4727b3,_0x21cbee){return db[_0xc0fb('0x60')][_0xc0fb('0x45')]({'where':{'id':_0xeda42e[_0xc0fb('0x36')][_0xc0fb('0x63')]},'attributes':['id'],'include':[{'model':db[_0xc0fb('0x6f')],'as':_0xc0fb('0x64'),'attributes':['id'],'raw':!![]}]})[_0xc0fb('0x28')](handleEntityNotFound(_0x4727b3,null))[_0xc0fb('0x28')](function(_0x1638a1){var _0x297ef3=_[_0xc0fb('0x31')](_0x1638a1,'id');var _0xe081db=[];var _0x1768e3=[];var _0x5f5dd4=squel[_0xc0fb('0x70')]();_0x5f5dd4[_0xc0fb('0x71')](_0xc0fb('0x72'))[_0xc0fb('0x73')](_0xc0fb('0x74'),'tq')['join'](_0xc0fb('0x75'),'ut',_0xc0fb('0x76'))[_0xc0fb('0x3f')](_0xc0fb('0x77'),_0xeda42e['params']['id']);for(var _0x3d6a63=0x0;_0x3d6a63<_0x1638a1[_0xc0fb('0x54')];_0x3d6a63+=0x1){let _0x5920b1=_0x1638a1[_0x3d6a63];for(var _0x16c4bb=0x0;_0x16c4bb<_0x5920b1[_0xc0fb('0x64')]['length'];_0x16c4bb+=0x1){let _0x1c790=_0x5920b1[_0xc0fb('0x64')][_0x16c4bb];var _0x49eef2=_0x5f5dd4[_0xc0fb('0x78')]();_0x49eef2[_0xc0fb('0x3f')](_0xc0fb('0x79'),_0x1c790['id']);_0x1768e3[_0xc0fb('0x7a')](db[_0xc0fb('0x69')]['query'](_0x49eef2['toString'](),{'type':db['sequelize'][_0xc0fb('0x7b')][_0xc0fb('0x7c')]})[_0xc0fb('0x28')](function(_0x3696be){if(_0x3696be[_0xc0fb('0x54')]===0x1){return _0x1c790['id'];}else{var _0xcd5471=_['every'](_[_0xc0fb('0x31')](_0x3696be,_0xc0fb('0x7d')),function(_0x519284){return _[_0xc0fb('0x7e')](_0x297ef3,_0x519284);});if(_0xcd5471){return _0x1c790['id'];}}}));}}return BPromise['all'](_0x1768e3)['then'](function(_0x1e3d5f){_0xe081db=_(_0xe081db)[_0xc0fb('0x7f')](_0x1e3d5f)[_0xc0fb('0x80')]()[_0xc0fb('0x81')]();return db['OpenchannelQueue'][_0xc0fb('0x4a')]({'where':{'id':_0xeda42e['params']['id']}})[_0xc0fb('0x28')](function(_0x46b778){return db['sequelize'][_0xc0fb('0x6a')](function(_0x5ecb2b){return _0x46b778[_0xc0fb('0x6e')](_0xeda42e[_0xc0fb('0x36')][_0xc0fb('0x63')],{'transaction':_0x5ecb2b})['then'](function(){if(!_[_0xc0fb('0x82')](_0xe081db)){return _0x46b778[_0xc0fb('0x83')](_0xe081db,{'transaction':_0x5ecb2b});}})[_0xc0fb('0x28')](function(){_0xe081db['forEach'](function(_0x3f9953){socket[_0xc0fb('0x6d')](_0xc0fb('0x84'),{'UserId':_0x3f9953,'OpenchannelQueueId':_0x46b778['id']});});});});});});})[_0xc0fb('0x28')](respondWithStatusCode(_0x4727b3,null))['catch'](handleError(_0x4727b3,null));};exports[_0xc0fb('0x85')]=function(_0x53f513,_0x1f71f3,_0x22b706){return db[_0xc0fb('0x32')][_0xc0fb('0x4a')]({'where':{'id':_0x53f513[_0xc0fb('0x51')]['id']}})[_0xc0fb('0x28')](handleEntityNotFound(_0x1f71f3,null))['then'](function(_0x3790f5){if(_0x3790f5){return _0x3790f5['addAgents'](_0x53f513[_0xc0fb('0x4c')]['ids'],_[_0xc0fb('0x86')](_0x53f513[_0xc0fb('0x4c')],[_0xc0fb('0x63'),'id'])||{})[_0xc0fb('0x87')](function(_0x40a486){for(var _0x4837e9=0x0;_0x4837e9<_0x53f513[_0xc0fb('0x4c')]['ids'][_0xc0fb('0x54')];_0x4837e9+=0x1){socket[_0xc0fb('0x6d')](_0xc0fb('0x88'),{'UserId':Number(_0x53f513[_0xc0fb('0x4c')][_0xc0fb('0x63')][_0x4837e9]),'OpenchannelQueueId':Number(_0x53f513[_0xc0fb('0x51')]['id'])});}return _0x40a486;});}})[_0xc0fb('0x28')](respondWithResult(_0x1f71f3,null))[_0xc0fb('0x47')](handleError(_0x1f71f3,null));};exports[_0xc0fb('0x83')]=function(_0x3e4ca6,_0x17dbfd,_0x41deec){return db['OpenchannelQueue'][_0xc0fb('0x4a')]({'where':{'id':_0x3e4ca6[_0xc0fb('0x51')]['id']}})['then'](handleEntityNotFound(_0x17dbfd,null))[_0xc0fb('0x28')](function(_0x52bde2){if(_0x52bde2){return _0x52bde2[_0xc0fb('0x83')](_0x3e4ca6[_0xc0fb('0x36')][_0xc0fb('0x63')])['then'](function(){if(_[_0xc0fb('0x89')](_0x3e4ca6[_0xc0fb('0x36')][_0xc0fb('0x63')])){for(var _0xaa697b=0x0;_0xaa697b<_0x3e4ca6[_0xc0fb('0x36')][_0xc0fb('0x63')][_0xc0fb('0x54')];_0xaa697b+=0x1){socket[_0xc0fb('0x6d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3e4ca6[_0xc0fb('0x36')]['ids'][_0xaa697b]),'OpenchannelQueueId':Number(_0x3e4ca6['params']['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x3e4ca6['query'][_0xc0fb('0x63')]),'OpenchannelQueueId':Number(_0x3e4ca6[_0xc0fb('0x51')]['id'])});}});}})[_0xc0fb('0x28')](respondWithStatusCode(_0x17dbfd,null))[_0xc0fb('0x47')](handleError(_0x17dbfd,null));};exports[_0xc0fb('0x8a')]=function(_0x90e1a3,_0x95b0a3,_0x3d8793){var _0x5c65e6={};var _0x101b95={};var _0x57dd1e;var _0x20ccbb;return db[_0xc0fb('0x32')][_0xc0fb('0x5f')]({'where':{'id':_0x90e1a3['params']['id']}})[_0xc0fb('0x28')](handleEntityNotFound(_0x95b0a3,null))[_0xc0fb('0x28')](function(_0x72b7b6){if(_0x72b7b6){_0x57dd1e=_0x72b7b6;_0x101b95['model']=_[_0xc0fb('0x37')](db[_0xc0fb('0x6f')][_0xc0fb('0x33')]);_0x101b95['query']=_[_0xc0fb('0x37')](_0x90e1a3['query']);_0x101b95[_0xc0fb('0x38')]=_['intersection'](_0x101b95['model'],_0x101b95['query']);_0x5c65e6[_0xc0fb('0x3b')]=_[_0xc0fb('0x39')](_0x101b95[_0xc0fb('0x35')],qs[_0xc0fb('0x3a')](_0x90e1a3[_0xc0fb('0x36')][_0xc0fb('0x3a')]));_0x5c65e6['attributes']=_0x5c65e6['attributes'][_0xc0fb('0x54')]?_0x5c65e6[_0xc0fb('0x3b')]:_0x101b95[_0xc0fb('0x35')];_0x5c65e6[_0xc0fb('0x3d')]=qs[_0xc0fb('0x3e')](_0x90e1a3[_0xc0fb('0x36')]['sort']);_0x5c65e6[_0xc0fb('0x3f')]=qs['filters'](_['pick'](_0x90e1a3[_0xc0fb('0x36')],_0x101b95[_0xc0fb('0x38')]));if(_0x90e1a3[_0xc0fb('0x36')][_0xc0fb('0x41')]){_0x5c65e6[_0xc0fb('0x3f')]=_[_0xc0fb('0x42')](_0x5c65e6[_0xc0fb('0x3f')],{'$or':_['map'](_0x5c65e6[_0xc0fb('0x3b')],function(_0xc8510e){var _0x4071c8={};_0x4071c8[_0xc8510e]={'$like':'%'+_0x90e1a3[_0xc0fb('0x36')][_0xc0fb('0x41')]+'%'};return _0x4071c8;})});}_0x5c65e6=_[_0xc0fb('0x42')]({},_0x5c65e6,_0x90e1a3[_0xc0fb('0x43')]);return _0x57dd1e[_0xc0fb('0x8a')](_0x5c65e6);}})[_0xc0fb('0x28')](function(_0x11decb){if(_0x11decb){_0x20ccbb=_0x11decb[_0xc0fb('0x54')];if(!_0x90e1a3[_0xc0fb('0x36')][_0xc0fb('0x61')]('nolimit')){_0x5c65e6[_0xc0fb('0x21')]=qs[_0xc0fb('0x21')](_0x90e1a3[_0xc0fb('0x36')][_0xc0fb('0x21')]);_0x5c65e6[_0xc0fb('0x1f')]=qs['offset'](_0x90e1a3[_0xc0fb('0x36')]['offset']);}return _0x57dd1e[_0xc0fb('0x8a')](_0x5c65e6);}})[_0xc0fb('0x28')](function(_0x2977af){if(_0x2977af){return _0x2977af?{'count':_0x20ccbb,'rows':_0x2977af}:null;}})[_0xc0fb('0x28')](respondWithResult(_0x95b0a3,null))[_0xc0fb('0x47')](handleError(_0x95b0a3,null));}; \ No newline at end of file +var _0x85cd=['findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','status','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','UserId','openchannelPause','createdAt','format','updatedAt','getTeams','Team','order','nolimit','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each'];(function(_0x21d2d6,_0xa4612e){var _0x31602e=function(_0x2a4e6a){while(--_0x2a4e6a){_0x21d2d6['push'](_0x21d2d6['shift']());}};_0x31602e(++_0xa4612e);}(_0x85cd,0x13b));var _0xd85c=function(_0x45c8a6,_0x5587e3){_0x45c8a6=_0x45c8a6-0x0;var _0x53b596=_0x85cd[_0x45c8a6];return _0x53b596;};'use strict';var emlformat=require(_0xd85c('0x0'));var rimraf=require(_0xd85c('0x1'));var zipdir=require(_0xd85c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd85c('0x3'));var BPromise=require(_0xd85c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd85c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd85c('0x6'));var fs=require('fs');var fs_extra=require(_0xd85c('0x7'));var _=require(_0xd85c('0x8'));var squel=require(_0xd85c('0x9'));var crypto=require(_0xd85c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd85c('0xb'));var toCsv=require(_0xd85c('0xc'));var querystring=require(_0xd85c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd85c('0xe'));var as=require(_0xd85c('0xf'));var hardwareService=require(_0xd85c('0x10'));var logger=require(_0xd85c('0x11'))(_0xd85c('0x12'));var utils=require(_0xd85c('0x13'));var config=require(_0xd85c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd85c('0x15')]=_[_0xd85c('0x16')](config[_0xd85c('0x15')],{'host':_0xd85c('0x17'),'port':0x18eb});var socket=require(_0xd85c('0x18'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xd85c('0x19')](socket);function respondWithStatusCode(_0x9bd41b,_0x25a31c){_0x25a31c=_0x25a31c||0xcc;return function(_0x4702ba){if(_0x4702ba){return _0x9bd41b[_0xd85c('0x1a')](_0x25a31c);}return _0x9bd41b['status'](_0x25a31c)[_0xd85c('0x1b')]();};}function respondWithResult(_0x5b348a,_0x43aa96){_0x43aa96=_0x43aa96||0xc8;return function(_0x35de95){if(_0x35de95){return _0x5b348a['status'](_0x43aa96)[_0xd85c('0x1c')](_0x35de95);}};}function respondWithFilteredResult(_0x1e6f9d,_0xc7f99f){return function(_0x9d6e1b){if(_0x9d6e1b){var _0x24c601=typeof _0xc7f99f[_0xd85c('0x1d')]===_0xd85c('0x1e')&&typeof _0xc7f99f[_0xd85c('0x1f')]==='undefined';var _0x5dd61b=_0x9d6e1b[_0xd85c('0x20')];var _0x34de18=_0x24c601?0x0:_0xc7f99f[_0xd85c('0x1d')];var _0x446007=_0x24c601?_0x9d6e1b[_0xd85c('0x20')]:_0xc7f99f['offset']+_0xc7f99f[_0xd85c('0x1f')];var _0x4f4248;if(_0x446007>=_0x5dd61b){_0x446007=_0x5dd61b;_0x4f4248=0xc8;}else{_0x4f4248=0xce;}_0x1e6f9d['status'](_0x4f4248);return _0x1e6f9d[_0xd85c('0x21')](_0xd85c('0x22'),_0x34de18+'-'+_0x446007+'/'+_0x5dd61b)[_0xd85c('0x1c')](_0x9d6e1b);}return null;};}function patchUpdates(_0x382a39){return function(_0x50264a){try{jsonpatch['apply'](_0x50264a,_0x382a39,!![]);}catch(_0x1bcb60){return BPromise[_0xd85c('0x23')](_0x1bcb60);}return _0x50264a[_0xd85c('0x24')]();};}function saveUpdates(_0x41ddcb,_0x246e25){return function(_0x3ec847){if(_0x3ec847){return _0x3ec847[_0xd85c('0x25')](_0x41ddcb)[_0xd85c('0x26')](function(_0x4e78ba){return _0x4e78ba;});}return null;};}function removeEntity(_0xf3028b,_0x394190){return function(_0x394368){if(_0x394368){return _0x394368[_0xd85c('0x27')]()['then'](function(){var _0x5a7ec9=_0x394368[_0xd85c('0x28')]({'plain':!![]});var _0x1ee617=_0xd85c('0x29');return db[_0xd85c('0x2a')][_0xd85c('0x27')]({'where':{'type':_0x1ee617,'resourceId':_0x5a7ec9['id']}})[_0xd85c('0x26')](function(){return _0x394368;});})[_0xd85c('0x26')](function(){_0xf3028b[_0xd85c('0x2b')](0xcc)[_0xd85c('0x1b')]();});}};}function handleEntityNotFound(_0xa8c199,_0x27d61f){return function(_0x5dc61a){if(!_0x5dc61a){_0xa8c199['sendStatus'](0x194);}return _0x5dc61a;};}function handleError(_0x1f50b0,_0x2558d8){_0x2558d8=_0x2558d8||0x1f4;return function(_0x4b9e17){logger[_0xd85c('0x2c')](_0x4b9e17[_0xd85c('0x2d')]);if(_0x4b9e17[_0xd85c('0x2e')]){delete _0x4b9e17[_0xd85c('0x2e')];}_0x1f50b0['status'](_0x2558d8)[_0xd85c('0x2f')](_0x4b9e17);};}exports[_0xd85c('0x30')]=function(_0x8eeeb0,_0x5d10d){var _0x4cfb0c={},_0x4681f1={},_0xb9e7a7={'count':0x0,'rows':[]};var _0x53a086=_[_0xd85c('0x31')](db[_0xd85c('0x32')][_0xd85c('0x33')],function(_0x532c92){return{'name':_0x532c92[_0xd85c('0x34')],'type':_0x532c92['type'][_0xd85c('0x35')]};});_0x4681f1[_0xd85c('0x36')]=_[_0xd85c('0x31')](_0x53a086,_0xd85c('0x2e'));_0x4681f1[_0xd85c('0x37')]=_[_0xd85c('0x38')](_0x8eeeb0[_0xd85c('0x37')]);_0x4681f1[_0xd85c('0x39')]=_['intersection'](_0x4681f1[_0xd85c('0x36')],_0x4681f1[_0xd85c('0x37')]);_0x4cfb0c[_0xd85c('0x3a')]=_[_0xd85c('0x3b')](_0x4681f1[_0xd85c('0x36')],qs['fields'](_0x8eeeb0[_0xd85c('0x37')][_0xd85c('0x3c')]));_0x4cfb0c[_0xd85c('0x3a')]=_0x4cfb0c[_0xd85c('0x3a')][_0xd85c('0x3d')]?_0x4cfb0c[_0xd85c('0x3a')]:_0x4681f1[_0xd85c('0x36')];if(!_0x8eeeb0['query'][_0xd85c('0x3e')]('nolimit')){_0x4cfb0c[_0xd85c('0x1f')]=qs['limit'](_0x8eeeb0['query'][_0xd85c('0x1f')]);_0x4cfb0c['offset']=qs[_0xd85c('0x1d')](_0x8eeeb0[_0xd85c('0x37')][_0xd85c('0x1d')]);}_0x4cfb0c['order']=qs[_0xd85c('0x3f')](_0x8eeeb0[_0xd85c('0x37')][_0xd85c('0x3f')]);_0x4cfb0c[_0xd85c('0x40')]=qs[_0xd85c('0x39')](_[_0xd85c('0x41')](_0x8eeeb0[_0xd85c('0x37')],_0x4681f1[_0xd85c('0x39')]),_0x53a086);if(_0x8eeeb0[_0xd85c('0x37')]['filter']){_0x4cfb0c['where']=_[_0xd85c('0x42')](_0x4cfb0c['where'],{'$or':_[_0xd85c('0x31')](_0x53a086,function(_0x133ecd){if(_0x133ecd['type']!==_0xd85c('0x43')){var _0x5af0fa={};_0x5af0fa[_0x133ecd[_0xd85c('0x2e')]]={'$like':'%'+_0x8eeeb0['query'][_0xd85c('0x44')]+'%'};return _0x5af0fa;}})});}_0x4cfb0c=_[_0xd85c('0x42')]({},_0x4cfb0c,_0x8eeeb0[_0xd85c('0x45')]);var _0xb96e35={'where':_0x4cfb0c['where']};return db['OpenchannelQueue'][_0xd85c('0x20')](_0xb96e35)['then'](function(_0xe9dd12){_0xb9e7a7[_0xd85c('0x20')]=_0xe9dd12;if(_0x8eeeb0['query'][_0xd85c('0x46')]){_0x4cfb0c[_0xd85c('0x47')]=[{'all':!![]}];}return db[_0xd85c('0x32')][_0xd85c('0x48')](_0x4cfb0c);})['then'](function(_0x3779c6){_0xb9e7a7[_0xd85c('0x49')]=_0x3779c6;return _0xb9e7a7;})[_0xd85c('0x26')](respondWithFilteredResult(_0x5d10d,_0x4cfb0c))[_0xd85c('0x4a')](handleError(_0x5d10d,null));};exports[_0xd85c('0x4b')]=function(_0x62e9be,_0x45361a){var _0x2dc429={'raw':!![],'where':{'id':_0x62e9be[_0xd85c('0x4c')]['id']}},_0x14da6c={};_0x14da6c['model']=_['keys'](db[_0xd85c('0x32')]['rawAttributes']);_0x14da6c[_0xd85c('0x37')]=_['keys'](_0x62e9be[_0xd85c('0x37')]);_0x14da6c[_0xd85c('0x39')]=_['intersection'](_0x14da6c[_0xd85c('0x36')],_0x14da6c[_0xd85c('0x37')]);_0x2dc429[_0xd85c('0x3a')]=_[_0xd85c('0x3b')](_0x14da6c['model'],qs[_0xd85c('0x3c')](_0x62e9be['query'][_0xd85c('0x3c')]));_0x2dc429['attributes']=_0x2dc429[_0xd85c('0x3a')]['length']?_0x2dc429[_0xd85c('0x3a')]:_0x14da6c['model'];if(_0x62e9be[_0xd85c('0x37')][_0xd85c('0x46')]){_0x2dc429['include']=[{'all':!![]}];}_0x2dc429=_['merge']({},_0x2dc429,_0x62e9be[_0xd85c('0x45')]);return db[_0xd85c('0x32')][_0xd85c('0x4d')](_0x2dc429)[_0xd85c('0x26')](handleEntityNotFound(_0x45361a,null))[_0xd85c('0x26')](respondWithResult(_0x45361a,null))['catch'](handleError(_0x45361a,null));};exports[_0xd85c('0x4e')]=function(_0x13b843,_0x40254e){return db[_0xd85c('0x32')][_0xd85c('0x4e')](_0x13b843['body'],{})[_0xd85c('0x26')](function(_0x9ee621){var _0x2149ed=_0x13b843[_0xd85c('0x4f')][_0xd85c('0x28')]({'plain':!![]});if(!_0x2149ed)throw new Error(_0xd85c('0x50'));if(_0x2149ed[_0xd85c('0x51')]===_0xd85c('0x4f')){var _0x2a71c1=_0x9ee621[_0xd85c('0x28')]({'plain':!![]});var _0x1fc57c=_0xd85c('0x29');return db['UserProfileSection'][_0xd85c('0x4d')]({'where':{'name':_0x1fc57c,'userProfileId':_0x2149ed['userProfileId']},'raw':!![]})[_0xd85c('0x26')](function(_0x3bbc90){if(_0x3bbc90&&_0x3bbc90[_0xd85c('0x52')]===0x0){return db[_0xd85c('0x2a')][_0xd85c('0x4e')]({'name':_0x2a71c1[_0xd85c('0x2e')],'resourceId':_0x2a71c1['id'],'type':_0x3bbc90['name'],'sectionId':_0x3bbc90['id']},{})[_0xd85c('0x26')](function(){return _0x9ee621;});}else{return _0x9ee621;}})[_0xd85c('0x4a')](function(_0x47611a){logger[_0xd85c('0x2c')](_0xd85c('0x53'),_0x47611a);throw _0x47611a;});}return _0x9ee621;})[_0xd85c('0x26')](respondWithResult(_0x40254e,0xc9))[_0xd85c('0x4a')](handleError(_0x40254e,null));};exports[_0xd85c('0x25')]=function(_0x227401,_0x3ea68a){if(_0x227401['body']['id']){delete _0x227401[_0xd85c('0x54')]['id'];}return db[_0xd85c('0x32')][_0xd85c('0x4d')]({'where':{'id':_0x227401[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](handleEntityNotFound(_0x3ea68a,null))['then'](saveUpdates(_0x227401['body'],null))[_0xd85c('0x26')](respondWithResult(_0x3ea68a,null))[_0xd85c('0x4a')](handleError(_0x3ea68a,null));};exports[_0xd85c('0x27')]=function(_0x25dc0a,_0x2757a2){return db['OpenchannelQueue']['find']({'where':{'id':_0x25dc0a[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](handleEntityNotFound(_0x2757a2,null))[_0xd85c('0x26')](removeEntity(_0x2757a2,null))[_0xd85c('0x4a')](handleError(_0x2757a2,null));};exports[_0xd85c('0x55')]=function(_0x3952e9,_0x237a69){return db['OpenchannelQueue'][_0xd85c('0x55')]()[_0xd85c('0x26')](respondWithResult(_0x237a69,null))[_0xd85c('0x4a')](handleError(_0x237a69,null));};exports[_0xd85c('0x56')]=function(_0x4c157e,_0x4a651a,_0x458750){var _0x4dc087={'raw':!![],'where':{}},_0x1fa4b4={},_0xccaed3;return db[_0xd85c('0x32')][_0xd85c('0x57')]({'where':{'id':_0x4c157e[_0xd85c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a651a,null))[_0xd85c('0x26')](function(_0x618ba9){if(_0x618ba9){_0xccaed3=_0x618ba9['get']({'plain':!![]});_0x1fa4b4['model']=_[_0xd85c('0x38')](db[_0xd85c('0x58')][_0xd85c('0x33')]);_0x1fa4b4['query']=_[_0xd85c('0x38')](_0x4c157e[_0xd85c('0x37')]);_0x1fa4b4[_0xd85c('0x39')]=_[_0xd85c('0x3b')](_0x1fa4b4[_0xd85c('0x36')],_0x1fa4b4[_0xd85c('0x37')]);_0x4dc087['attributes']=_[_0xd85c('0x3b')](_0x1fa4b4[_0xd85c('0x36')],qs[_0xd85c('0x3c')](_0x4c157e[_0xd85c('0x37')][_0xd85c('0x3c')]));_0x4dc087[_0xd85c('0x3a')]=_0x4dc087[_0xd85c('0x3a')][_0xd85c('0x3d')]?_0x4dc087[_0xd85c('0x3a')]:_0x1fa4b4[_0xd85c('0x36')];if(!_0x4c157e[_0xd85c('0x37')]['hasOwnProperty']('nolimit')){_0x4dc087[_0xd85c('0x1f')]=qs[_0xd85c('0x1f')](_0x4c157e['query'][_0xd85c('0x1f')]);_0x4dc087['offset']=qs[_0xd85c('0x1d')](_0x4c157e[_0xd85c('0x37')][_0xd85c('0x1d')]);}_0x4dc087['order']=qs[_0xd85c('0x3f')](_0x4c157e['query'][_0xd85c('0x3f')]);_0x4dc087[_0xd85c('0x40')]=qs[_0xd85c('0x39')](_[_0xd85c('0x41')](_0x4c157e[_0xd85c('0x37')],_0x1fa4b4['filters']));_0x4dc087[_0xd85c('0x40')][_0xd85c('0x59')]=_0x618ba9['id'];if(_0x4c157e['query'][_0xd85c('0x44')]){_0x4dc087[_0xd85c('0x40')]=_[_0xd85c('0x42')](_0x4dc087[_0xd85c('0x40')],{'$or':_[_0xd85c('0x31')](_0x4dc087['attributes'],function(_0x189a1d){var _0x5d1b03={};_0x5d1b03[_0x189a1d]={'$like':'%'+_0x4c157e[_0xd85c('0x37')][_0xd85c('0x44')]+'%'};return _0x5d1b03;})});}_0x4dc087=_['merge']({},_0x4dc087,_0x4c157e[_0xd85c('0x45')]);return db['UserOpenchannelQueue'][_0xd85c('0x48')](_0x4dc087);}})[_0xd85c('0x26')](function(_0x14d997){if(_0x14d997){return db['User'][_0xd85c('0x5a')]({'where':{'id':_[_0xd85c('0x31')](_0x14d997,_0xd85c('0x5b')),'role':'agent'},'attributes':['id',_0xd85c('0x2e'),_0xd85c('0x5c'),'updatedAt',_0xd85c('0x5d')]});}})[_0xd85c('0x26')](function(_0x366a07){if(_0x366a07){return{'count':_0x366a07[_0xd85c('0x20')],'rows':_['map'](_0x366a07['rows'],function(_0x54f604){return{'membername':_0x54f604[_0xd85c('0x2e')],'UserId':_0x54f604['id'],'queue_name':_0xccaed3['name'],'OpenchannelQueueId':_0xccaed3['id'],'interface':util[_0xd85c('0x5e')]('%s/%s','SIP',_0x54f604[_0xd85c('0x2e')]),'penalty':0x0,'paused':_0x54f604[_0xd85c('0x5c')],'createdAt':_0x54f604[_0xd85c('0x5d')],'updatedAt':_0x54f604[_0xd85c('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a651a,_0x4dc087))[_0xd85c('0x4a')](handleError(_0x4a651a,null));};exports[_0xd85c('0x60')]=function(_0x529d91,_0xadd9e,_0x17a177){var _0x3f6971={};var _0x3a727d={};var _0x3deb5f;var _0x79bd63;return db[_0xd85c('0x32')][_0xd85c('0x57')]({'where':{'id':_0x529d91[_0xd85c('0x4c')]['id']}})['then'](handleEntityNotFound(_0xadd9e,null))[_0xd85c('0x26')](function(_0xed7767){if(_0xed7767){_0x3deb5f=_0xed7767;_0x3a727d['model']=_[_0xd85c('0x38')](db[_0xd85c('0x61')][_0xd85c('0x33')]);_0x3a727d[_0xd85c('0x37')]=_[_0xd85c('0x38')](_0x529d91['query']);_0x3a727d[_0xd85c('0x39')]=_['intersection'](_0x3a727d['model'],_0x3a727d['query']);_0x3f6971['attributes']=_['intersection'](_0x3a727d['model'],qs[_0xd85c('0x3c')](_0x529d91[_0xd85c('0x37')][_0xd85c('0x3c')]));_0x3f6971[_0xd85c('0x3a')]=_0x3f6971[_0xd85c('0x3a')]['length']?_0x3f6971[_0xd85c('0x3a')]:_0x3a727d['model'];_0x3f6971[_0xd85c('0x62')]=qs[_0xd85c('0x3f')](_0x529d91['query'][_0xd85c('0x3f')]);_0x3f6971['where']=qs['filters'](_['pick'](_0x529d91[_0xd85c('0x37')],_0x3a727d[_0xd85c('0x39')]));if(_0x529d91['query'][_0xd85c('0x44')]){_0x3f6971[_0xd85c('0x40')]=_[_0xd85c('0x42')](_0x3f6971[_0xd85c('0x40')],{'$or':_[_0xd85c('0x31')](_0x3f6971[_0xd85c('0x3a')],function(_0xa80f49){var _0x84357a={};_0x84357a[_0xa80f49]={'$like':'%'+_0x529d91['query'][_0xd85c('0x44')]+'%'};return _0x84357a;})});}_0x3f6971=_[_0xd85c('0x42')]({},_0x3f6971,_0x529d91[_0xd85c('0x45')]);return _0x3deb5f['getTeams'](_0x3f6971);}})[_0xd85c('0x26')](function(_0x33b548){if(_0x33b548){_0x79bd63=_0x33b548[_0xd85c('0x3d')];if(!_0x529d91[_0xd85c('0x37')][_0xd85c('0x3e')](_0xd85c('0x63'))){_0x3f6971[_0xd85c('0x1f')]=qs[_0xd85c('0x1f')](_0x529d91['query'][_0xd85c('0x1f')]);_0x3f6971[_0xd85c('0x1d')]=qs['offset'](_0x529d91[_0xd85c('0x37')][_0xd85c('0x1d')]);}return _0x3deb5f[_0xd85c('0x60')](_0x3f6971);}})[_0xd85c('0x26')](function(_0x57c280){if(_0x57c280){return _0x57c280?{'count':_0x79bd63,'rows':_0x57c280}:null;}})[_0xd85c('0x26')](respondWithResult(_0xadd9e,null))[_0xd85c('0x4a')](handleError(_0xadd9e,null));};exports[_0xd85c('0x64')]=function(_0xe6378e,_0x11b3d7,_0xdda062){var _0x269f70=_0xe6378e['body'][_0xd85c('0x65')];return db[_0xd85c('0x61')][_0xd85c('0x48')]({'where':{'id':_0x269f70},'attributes':['id'],'include':[{'model':db[_0xd85c('0x66')],'as':_0xd85c('0x67'),'attributes':['id',_0xd85c('0x2e'),_0xd85c('0x68'),_0xd85c('0x69'),_0xd85c('0x6a')],'raw':!![]}]})[_0xd85c('0x26')](function(_0x354272){if(_0x354272){var _0x37b730=_[_0xd85c('0x6b')](_0x354272,function(_0x319408){var _0xc5482e=_0x319408[_0xd85c('0x28')]({'plain':!![]});return _0xc5482e[_0xd85c('0x67')];});return db[_0xd85c('0x32')][_0xd85c('0x4d')]({'where':{'id':_0xe6378e['params']['id']}})[_0xd85c('0x26')](function(_0x2a04fe){return db[_0xd85c('0x6c')][_0xd85c('0x6d')](function(_0x17d654){return _0x2a04fe[_0xd85c('0x64')](_0x269f70,{'transaction':_0x17d654})['then'](function(){return BPromise[_0xd85c('0x6e')](_0x37b730,function(_0x383400){return db[_0xd85c('0x58')][_0xd85c('0x6f')]({'where':{'UserId':_0x383400['id'],'OpenchannelQueueId':_0xe6378e[_0xd85c('0x4c')]['id']},'transaction':_0x17d654});});})[_0xd85c('0x26')](function(){_0x37b730[_0xd85c('0x70')](function(_0x4a8904){socket[_0xd85c('0x71')]('userOpenchannelQueue:save',{'UserId':_0x4a8904['id'],'OpenchannelQueueId':_0x2a04fe['id']});});});});});}})[_0xd85c('0x26')](respondWithStatusCode(_0x11b3d7,null))[_0xd85c('0x4a')](handleError(_0x11b3d7,null));};exports[_0xd85c('0x72')]=function(_0x142a0e,_0x3652a6,_0x26fd1f){return db['Team'][_0xd85c('0x48')]({'where':{'id':_0x142a0e[_0xd85c('0x37')][_0xd85c('0x65')]},'attributes':['id'],'include':[{'model':db[_0xd85c('0x66')],'as':_0xd85c('0x67'),'attributes':['id'],'raw':!![]}]})[_0xd85c('0x26')](handleEntityNotFound(_0x3652a6,null))[_0xd85c('0x26')](function(_0x54d267){var _0xd3c328=_[_0xd85c('0x31')](_0x54d267,'id');var _0x4434d5=[];var _0x33ead7=[];var _0x21fa86=squel['select']();_0x21fa86[_0xd85c('0x73')](_0xd85c('0x74'))[_0xd85c('0x75')]('team_has_openchannel_queues','tq')[_0xd85c('0x76')](_0xd85c('0x77'),'ut',_0xd85c('0x78'))[_0xd85c('0x40')](_0xd85c('0x79'),_0x142a0e[_0xd85c('0x4c')]['id']);for(var _0xef9770=0x0;_0xef9770<_0x54d267[_0xd85c('0x3d')];_0xef9770+=0x1){let _0x299114=_0x54d267[_0xef9770];for(var _0x40ba64=0x0;_0x40ba64<_0x299114[_0xd85c('0x67')][_0xd85c('0x3d')];_0x40ba64+=0x1){let _0x8dd6e8=_0x299114[_0xd85c('0x67')][_0x40ba64];var _0x53a943=_0x21fa86[_0xd85c('0x7a')]();_0x53a943[_0xd85c('0x40')](_0xd85c('0x7b'),_0x8dd6e8['id']);_0x33ead7[_0xd85c('0x7c')](db[_0xd85c('0x6c')][_0xd85c('0x37')](_0x53a943[_0xd85c('0x7d')](),{'type':db[_0xd85c('0x6c')][_0xd85c('0x7e')][_0xd85c('0x7f')]})['then'](function(_0x44d4e3){if(_0x44d4e3[_0xd85c('0x3d')]===0x1){return _0x8dd6e8['id'];}else{var _0x295fa9=_[_0xd85c('0x80')](_[_0xd85c('0x31')](_0x44d4e3,'TeamId'),function(_0x422fde){return _[_0xd85c('0x81')](_0xd3c328,_0x422fde);});if(_0x295fa9){return _0x8dd6e8['id'];}}}));}}return BPromise[_0xd85c('0x82')](_0x33ead7)['then'](function(_0x5cc993){_0x4434d5=_(_0x4434d5)[_0xd85c('0x83')](_0x5cc993)['compact']()[_0xd85c('0x84')]();return db[_0xd85c('0x32')][_0xd85c('0x4d')]({'where':{'id':_0x142a0e[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](function(_0x13e591){return db[_0xd85c('0x6c')][_0xd85c('0x6d')](function(_0x9387aa){return _0x13e591[_0xd85c('0x72')](_0x142a0e[_0xd85c('0x37')]['ids'],{'transaction':_0x9387aa})[_0xd85c('0x26')](function(){if(!_[_0xd85c('0x85')](_0x4434d5)){return _0x13e591[_0xd85c('0x86')](_0x4434d5,{'transaction':_0x9387aa});}})[_0xd85c('0x26')](function(){_0x4434d5[_0xd85c('0x70')](function(_0x4c90f4){socket[_0xd85c('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x4c90f4,'OpenchannelQueueId':_0x13e591['id']});});});});});});})[_0xd85c('0x26')](respondWithStatusCode(_0x3652a6,null))[_0xd85c('0x4a')](handleError(_0x3652a6,null));};exports['addAgents']=function(_0x546962,_0x148ed5,_0x3e1919){return db[_0xd85c('0x32')][_0xd85c('0x4d')]({'where':{'id':_0x546962['params']['id']}})['then'](handleEntityNotFound(_0x148ed5,null))[_0xd85c('0x26')](function(_0x44d084){if(_0x44d084){return _0x44d084[_0xd85c('0x87')](_0x546962[_0xd85c('0x54')][_0xd85c('0x65')],_[_0xd85c('0x88')](_0x546962['body'],[_0xd85c('0x65'),'id'])||{})[_0xd85c('0x89')](function(_0x1e0a1b){for(var _0x27ffe7=0x0;_0x27ffe7<_0x546962[_0xd85c('0x54')][_0xd85c('0x65')][_0xd85c('0x3d')];_0x27ffe7+=0x1){socket[_0xd85c('0x71')](_0xd85c('0x8a'),{'UserId':Number(_0x546962[_0xd85c('0x54')][_0xd85c('0x65')][_0x27ffe7]),'OpenchannelQueueId':Number(_0x546962[_0xd85c('0x4c')]['id'])});}return _0x1e0a1b;});}})[_0xd85c('0x26')](respondWithResult(_0x148ed5,null))['catch'](handleError(_0x148ed5,null));};exports['removeAgents']=function(_0x670c9b,_0x394e0a,_0x1cf95a){return db['OpenchannelQueue'][_0xd85c('0x4d')]({'where':{'id':_0x670c9b[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](handleEntityNotFound(_0x394e0a,null))[_0xd85c('0x26')](function(_0x2ef0f2){if(_0x2ef0f2){return _0x2ef0f2[_0xd85c('0x86')](_0x670c9b[_0xd85c('0x37')][_0xd85c('0x65')])[_0xd85c('0x26')](function(){if(_[_0xd85c('0x8b')](_0x670c9b['query'][_0xd85c('0x65')])){for(var _0x84b96=0x0;_0x84b96<_0x670c9b[_0xd85c('0x37')][_0xd85c('0x65')]['length'];_0x84b96+=0x1){socket['emit'](_0xd85c('0x8c'),{'UserId':Number(_0x670c9b[_0xd85c('0x37')]['ids'][_0x84b96]),'OpenchannelQueueId':Number(_0x670c9b[_0xd85c('0x4c')]['id'])});}}else{socket['emit'](_0xd85c('0x8c'),{'UserId':Number(_0x670c9b[_0xd85c('0x37')][_0xd85c('0x65')]),'OpenchannelQueueId':Number(_0x670c9b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x394e0a,null))['catch'](handleError(_0x394e0a,null));};exports[_0xd85c('0x8d')]=function(_0x1fad6e,_0x14553b,_0x54f069){var _0x308c47={};var _0x2bcdfd={};var _0x54a086;var _0x31b7ff;return db[_0xd85c('0x32')][_0xd85c('0x57')]({'where':{'id':_0x1fad6e[_0xd85c('0x4c')]['id']}})[_0xd85c('0x26')](handleEntityNotFound(_0x14553b,null))['then'](function(_0x27ca78){if(_0x27ca78){_0x54a086=_0x27ca78;_0x2bcdfd[_0xd85c('0x36')]=_[_0xd85c('0x38')](db['User'][_0xd85c('0x33')]);_0x2bcdfd[_0xd85c('0x37')]=_[_0xd85c('0x38')](_0x1fad6e[_0xd85c('0x37')]);_0x2bcdfd[_0xd85c('0x39')]=_['intersection'](_0x2bcdfd[_0xd85c('0x36')],_0x2bcdfd[_0xd85c('0x37')]);_0x308c47[_0xd85c('0x3a')]=_[_0xd85c('0x3b')](_0x2bcdfd['model'],qs[_0xd85c('0x3c')](_0x1fad6e[_0xd85c('0x37')]['fields']));_0x308c47['attributes']=_0x308c47[_0xd85c('0x3a')][_0xd85c('0x3d')]?_0x308c47['attributes']:_0x2bcdfd[_0xd85c('0x36')];_0x308c47[_0xd85c('0x62')]=qs['sort'](_0x1fad6e[_0xd85c('0x37')]['sort']);_0x308c47['where']=qs[_0xd85c('0x39')](_[_0xd85c('0x41')](_0x1fad6e[_0xd85c('0x37')],_0x2bcdfd[_0xd85c('0x39')]));if(_0x1fad6e[_0xd85c('0x37')][_0xd85c('0x44')]){_0x308c47[_0xd85c('0x40')]=_[_0xd85c('0x42')](_0x308c47[_0xd85c('0x40')],{'$or':_[_0xd85c('0x31')](_0x308c47[_0xd85c('0x3a')],function(_0x3dc86e){var _0x91a672={};_0x91a672[_0x3dc86e]={'$like':'%'+_0x1fad6e['query'][_0xd85c('0x44')]+'%'};return _0x91a672;})});}_0x308c47=_['merge']({},_0x308c47,_0x1fad6e[_0xd85c('0x45')]);return _0x54a086[_0xd85c('0x8d')](_0x308c47);}})[_0xd85c('0x26')](function(_0x13f24d){if(_0x13f24d){_0x31b7ff=_0x13f24d[_0xd85c('0x3d')];if(!_0x1fad6e[_0xd85c('0x37')][_0xd85c('0x3e')](_0xd85c('0x63'))){_0x308c47['limit']=qs[_0xd85c('0x1f')](_0x1fad6e[_0xd85c('0x37')]['limit']);_0x308c47['offset']=qs[_0xd85c('0x1d')](_0x1fad6e['query'][_0xd85c('0x1d')]);}return _0x54a086[_0xd85c('0x8d')](_0x308c47);}})['then'](function(_0x572536){if(_0x572536){return _0x572536?{'count':_0x31b7ff,'rows':_0x572536}:null;}})[_0xd85c('0x26')](respondWithResult(_0x14553b,null))[_0xd85c('0x4a')](handleError(_0x14553b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0b19cfa..a383ffa 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 _0xf1b1=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1b1,0x189));var _0x1f1b=function(_0x111614,_0x4a7ac4){_0x111614=_0x111614-0x0;var _0x2c958e=_0xf1b1[_0x111614];return _0x2c958e;};'use strict';var EventEmitter=require(_0x1f1b('0x0'));var OpenchannelQueue=require(_0x1f1b('0x1'))['db'][_0x1f1b('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1f1b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1f1b('0x4'),'afterDestroy':_0x1f1b('0x5')};function emitEvent(_0x370ea8){return function(_0x9ed722,_0x40eea9,_0x19b3c0){OpenchannelQueueEvents[_0x1f1b('0x6')](_0x370ea8+':'+_0x9ed722['id'],_0x9ed722);OpenchannelQueueEvents['emit'](_0x370ea8,_0x9ed722);_0x19b3c0(null);};}for(var e in events){if(events[_0x1f1b('0x7')](e)){var event=events[e];OpenchannelQueue[_0x1f1b('0x8')](e,emitEvent(event));}}module[_0x1f1b('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3ebd=['save','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5c4c10,_0xb1a77b){var _0x4d145e=function(_0x313b8a){while(--_0x313b8a){_0x5c4c10['push'](_0x5c4c10['shift']());}};_0x4d145e(++_0xb1a77b);}(_0x3ebd,0x177));var _0xd3eb=function(_0x2b03d8,_0x548a27){_0x2b03d8=_0x2b03d8-0x0;var _0x42b5d7=_0x3ebd[_0x2b03d8];return _0x42b5d7;};'use strict';var EventEmitter=require(_0xd3eb('0x0'));var OpenchannelQueue=require(_0xd3eb('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd3eb('0x2')](0x0);var events={'afterCreate':_0xd3eb('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e4490){return function(_0x24d219,_0x45ec7f,_0x4f9b12){OpenchannelQueueEvents[_0xd3eb('0x4')](_0x1e4490+':'+_0x24d219['id'],_0x24d219);OpenchannelQueueEvents[_0xd3eb('0x4')](_0x1e4490,_0x24d219);_0x4f9b12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xd3eb('0x5')](e,emitEvent(event));}}module[_0xd3eb('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index c19b13e..653beb6 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 _0xc4df=['OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0xc4df,0x89));var _0xfc4d=function(_0x296ab6,_0x4faf19){_0x296ab6=_0x296ab6-0x0;var _0xc07b5b=_0xc4df[_0x296ab6];return _0xc07b5b;};'use strict';var _=require(_0xfc4d('0x0'));var util=require(_0xfc4d('0x1'));var logger=require(_0xfc4d('0x2'))(_0xfc4d('0x3'));var moment=require(_0xfc4d('0x4'));var BPromise=require(_0xfc4d('0x5'));var rp=require(_0xfc4d('0x6'));var fs=require('fs');var path=require(_0xfc4d('0x7'));var rimraf=require(_0xfc4d('0x8'));var config=require(_0xfc4d('0x9'));var attributes=require(_0xfc4d('0xa'));module[_0xfc4d('0xb')]=function(_0x3aad15,_0xf5105a){return _0x3aad15[_0xfc4d('0xc')](_0xfc4d('0xd'),attributes,{'tableName':_0xfc4d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe725=['OpenchannelQueue','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe725,0xa1));var _0x5e72=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe725[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x5e72('0x0'));var logger=require(_0x5e72('0x1'))(_0x5e72('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e72('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e72('0x4'));var config=require(_0x5e72('0x5'));var attributes=require(_0x5e72('0x6'));module[_0x5e72('0x7')]=function(_0x59ba7c,_0x251087){return _0x59ba7c[_0x5e72('0x8')](_0x5e72('0x9'),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 6594698..0ba1894 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 _0x4061=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue','raw','stringify','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4061,0x18b));var _0x1406=function(_0x56fc62,_0x3a25ef){_0x56fc62=_0x56fc62-0x0;var _0x5a4105=_0x4061[_0x56fc62];return _0x5a4105;};'use strict';var _=require(_0x1406('0x0'));var util=require(_0x1406('0x1'));var moment=require(_0x1406('0x2'));var BPromise=require(_0x1406('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1406('0x4'))['db'];var utils=require(_0x1406('0x5'));var logger=require(_0x1406('0x6'))(_0x1406('0x7'));var config=require(_0x1406('0x8'));var jayson=require(_0x1406('0x9'));var client=jayson[_0x1406('0xa')][_0x1406('0xb')]({'port':0x232a});config['redis']=_[_0x1406('0xc')](config['redis'],{'host':_0x1406('0xd'),'port':0x18eb});var socket=require(_0x1406('0xe'))(new Redis(config[_0x1406('0xf')]));require(_0x1406('0x10'))[_0x1406('0x11')](socket);function respondWithRpcPromise(_0x1f4658,_0x2213f7,_0x220796){return new BPromise(function(_0x761c2,_0x17d140){return client[_0x1406('0x12')](_0x1f4658,_0x220796)[_0x1406('0x13')](function(_0x5d1bd5){logger[_0x1406('0x14')](_0x1406('0x15'),_0x2213f7,_0x1406('0x16'));logger[_0x1406('0x17')](_0x1406('0x18'),_0x2213f7,_0x1406('0x16'),JSON['stringify'](_0x5d1bd5));if(_0x5d1bd5['error']){if(_0x5d1bd5[_0x1406('0x19')]['code']===0x1f4){logger[_0x1406('0x19')](_0x1406('0x15'),_0x2213f7,_0x5d1bd5[_0x1406('0x19')][_0x1406('0x1a')]);return _0x17d140(_0x5d1bd5[_0x1406('0x19')]['message']);}logger['error'](_0x1406('0x15'),_0x2213f7,_0x5d1bd5['error'][_0x1406('0x1a')]);return _0x761c2(_0x5d1bd5[_0x1406('0x19')][_0x1406('0x1a')]);}else{logger['info'](_0x1406('0x15'),_0x2213f7,'request\x20sent');_0x761c2(_0x5d1bd5['result'][_0x1406('0x1a')]);}})[_0x1406('0x1b')](function(_0x1c5fb7){logger[_0x1406('0x19')](_0x1406('0x15'),_0x2213f7,_0x1c5fb7);_0x17d140(_0x1c5fb7);});});}exports[_0x1406('0x1c')]=function(_0x5ddb0a){var _0x4bf199=this;return new Promise(function(_0x27a252,_0x1b61f8){return db[_0x1406('0x1d')]['findAll']({'raw':_0x5ddb0a[_0x1406('0x1e')]?_0x5ddb0a[_0x1406('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5ddb0a[_0x1406('0x1e')]?_0x5ddb0a[_0x1406('0x1e')][_0x1406('0x1f')]||null:null,'attributes':_0x5ddb0a[_0x1406('0x1e')]?_0x5ddb0a[_0x1406('0x1e')][_0x1406('0x20')]||null:null,'limit':_0x5ddb0a[_0x1406('0x1e')]?_0x5ddb0a[_0x1406('0x1e')][_0x1406('0x21')]||null:null,'include':_0x5ddb0a[_0x1406('0x1e')]?_0x5ddb0a[_0x1406('0x1e')][_0x1406('0x22')]?_[_0x1406('0x23')](_0x5ddb0a['options'][_0x1406('0x22')],function(_0x500add){return{'model':db[_0x500add[_0x1406('0x24')]],'as':_0x500add['as'],'attributes':_0x500add['attributes'],'include':_0x500add[_0x1406('0x22')]?_[_0x1406('0x23')](_0x500add[_0x1406('0x22')],function(_0x59eeb5){return{'model':db[_0x59eeb5[_0x1406('0x24')]],'as':_0x59eeb5['as'],'attributes':_0x59eeb5['attributes'],'include':_0x59eeb5[_0x1406('0x22')]?_[_0x1406('0x23')](_0x59eeb5['include'],function(_0x30cff4){return{'model':db[_0x30cff4[_0x1406('0x24')]],'as':_0x30cff4['as'],'attributes':_0x30cff4[_0x1406('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1406('0x13')](function(_0x32076d){logger['info']('GetOpenchannelQueue',_0x5ddb0a);logger['debug'](_0x1406('0x1c'),_0x5ddb0a,JSON['stringify'](_0x32076d));_0x27a252(_0x32076d);})[_0x1406('0x1b')](function(_0x30eca1){logger[_0x1406('0x19')]('GetOpenchannelQueue',_0x30eca1[_0x1406('0x1a')],_0x5ddb0a);_0x1b61f8(_0x4bf199[_0x1406('0x19')](0x1f4,_0x30eca1[_0x1406('0x1a')]));});});};exports[_0x1406('0x25')]=function(_0x3d405e){var _0x47eb24=this;return new Promise(function(_0x9551b3,_0x25eddc){return db[_0x1406('0x1d')]['find']({'raw':_0x3d405e['options']?_0x3d405e[_0x1406('0x1e')][_0x1406('0x26')]===undefined?!![]:![]:!![],'where':_0x3d405e[_0x1406('0x1e')]?_0x3d405e[_0x1406('0x1e')][_0x1406('0x1f')]||null:null,'attributes':_0x3d405e[_0x1406('0x1e')]?_0x3d405e[_0x1406('0x1e')][_0x1406('0x20')]||null:null,'include':_0x3d405e[_0x1406('0x1e')]?_0x3d405e[_0x1406('0x1e')][_0x1406('0x22')]?_[_0x1406('0x23')](_0x3d405e['options'][_0x1406('0x22')],function(_0x5631ea){return{'model':db[_0x5631ea[_0x1406('0x24')]],'as':_0x5631ea['as'],'attributes':_0x5631ea[_0x1406('0x20')],'include':_0x5631ea[_0x1406('0x22')]?_[_0x1406('0x23')](_0x5631ea['include'],function(_0x44a207){return{'model':db[_0x44a207[_0x1406('0x24')]],'as':_0x44a207['as'],'attributes':_0x44a207[_0x1406('0x20')],'include':_0x44a207[_0x1406('0x22')]?_[_0x1406('0x23')](_0x44a207[_0x1406('0x22')],function(_0x11b700){return{'model':db[_0x11b700[_0x1406('0x24')]],'as':_0x11b700['as'],'attributes':_0x11b700[_0x1406('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24354d){logger['info'](_0x1406('0x25'),_0x3d405e);logger['debug'](_0x1406('0x25'),_0x3d405e,JSON[_0x1406('0x27')](_0x24354d));_0x9551b3(_0x24354d);})['catch'](function(_0x2e8516){logger[_0x1406('0x19')](_0x1406('0x25'),_0x2e8516[_0x1406('0x1a')],_0x3d405e);_0x25eddc(_0x47eb24[_0x1406('0x19')](0x1f4,_0x2e8516[_0x1406('0x1a')]));});});}; \ No newline at end of file +var _0x6a49=['find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','map','include','model','then','info','stringify','ShowOpenchannelQueue'];(function(_0x2959aa,_0xfd86ec){var _0x28d095=function(_0x35f7bd){while(--_0x35f7bd){_0x2959aa['push'](_0x2959aa['shift']());}};_0x28d095(++_0xfd86ec);}(_0x6a49,0x127));var _0x96a4=function(_0x7f738a,_0x455d93){_0x7f738a=_0x7f738a-0x0;var _0x4f4f5b=_0x6a49[_0x7f738a];return _0x4f4f5b;};'use strict';var _=require(_0x96a4('0x0'));var util=require(_0x96a4('0x1'));var moment=require(_0x96a4('0x2'));var BPromise=require(_0x96a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96a4('0x4'));var db=require(_0x96a4('0x5'))['db'];var utils=require(_0x96a4('0x6'));var logger=require(_0x96a4('0x7'))(_0x96a4('0x8'));var config=require(_0x96a4('0x9'));var jayson=require(_0x96a4('0xa'));var client=jayson[_0x96a4('0xb')][_0x96a4('0xc')]({'port':0x232a});config[_0x96a4('0xd')]=_[_0x96a4('0xe')](config[_0x96a4('0xd')],{'host':_0x96a4('0xf'),'port':0x18eb});var socket=require(_0x96a4('0x10'))(new Redis(config['redis']));require(_0x96a4('0x11'))['register'](socket);function respondWithRpcPromise(_0x3b48a9,_0x5ac734,_0x3092ce){return new BPromise(function(_0x1fad60,_0x42cff6){return client['request'](_0x3b48a9,_0x3092ce)['then'](function(_0x2f8b3a){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x5ac734,_0x96a4('0x12'));logger[_0x96a4('0x13')](_0x96a4('0x14'),_0x5ac734,_0x96a4('0x12'),JSON['stringify'](_0x2f8b3a));if(_0x2f8b3a[_0x96a4('0x15')]){if(_0x2f8b3a['error'][_0x96a4('0x16')]===0x1f4){logger[_0x96a4('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ac734,_0x2f8b3a[_0x96a4('0x15')]['message']);return _0x42cff6(_0x2f8b3a[_0x96a4('0x15')][_0x96a4('0x17')]);}logger['error'](_0x96a4('0x18'),_0x5ac734,_0x2f8b3a[_0x96a4('0x15')][_0x96a4('0x17')]);return _0x1fad60(_0x2f8b3a['error'][_0x96a4('0x17')]);}else{logger['info'](_0x96a4('0x18'),_0x5ac734,_0x96a4('0x12'));_0x1fad60(_0x2f8b3a[_0x96a4('0x19')][_0x96a4('0x17')]);}})[_0x96a4('0x1a')](function(_0x3e6835){logger[_0x96a4('0x15')](_0x96a4('0x18'),_0x5ac734,_0x3e6835);_0x42cff6(_0x3e6835);});});}exports[_0x96a4('0x1b')]=function(_0x40155f){var _0x20c5ec=this;return new Promise(function(_0x367a0d,_0x47dc43){return db[_0x96a4('0x1c')]['findAll']({'raw':_0x40155f[_0x96a4('0x1d')]?_0x40155f[_0x96a4('0x1d')][_0x96a4('0x1e')]===undefined?!![]:![]:!![],'where':_0x40155f[_0x96a4('0x1d')]?_0x40155f['options'][_0x96a4('0x1f')]||null:null,'attributes':_0x40155f['options']?_0x40155f[_0x96a4('0x1d')][_0x96a4('0x20')]||null:null,'limit':_0x40155f[_0x96a4('0x1d')]?_0x40155f[_0x96a4('0x1d')][_0x96a4('0x21')]||null:null,'include':_0x40155f[_0x96a4('0x1d')]?_0x40155f[_0x96a4('0x1d')]['include']?_[_0x96a4('0x22')](_0x40155f[_0x96a4('0x1d')]['include'],function(_0x289a4d){return{'model':db[_0x289a4d['model']],'as':_0x289a4d['as'],'attributes':_0x289a4d['attributes'],'include':_0x289a4d['include']?_[_0x96a4('0x22')](_0x289a4d[_0x96a4('0x23')],function(_0x472780){return{'model':db[_0x472780['model']],'as':_0x472780['as'],'attributes':_0x472780[_0x96a4('0x20')],'include':_0x472780[_0x96a4('0x23')]?_['map'](_0x472780[_0x96a4('0x23')],function(_0x13b192){return{'model':db[_0x13b192[_0x96a4('0x24')]],'as':_0x13b192['as'],'attributes':_0x13b192[_0x96a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x96a4('0x25')](function(_0x3e7adf){logger[_0x96a4('0x26')](_0x96a4('0x1b'),_0x40155f);logger['debug'](_0x96a4('0x1b'),_0x40155f,JSON[_0x96a4('0x27')](_0x3e7adf));_0x367a0d(_0x3e7adf);})['catch'](function(_0x31a96b){logger[_0x96a4('0x15')]('GetOpenchannelQueue',_0x31a96b['message'],_0x40155f);_0x47dc43(_0x20c5ec[_0x96a4('0x15')](0x1f4,_0x31a96b[_0x96a4('0x17')]));});});};exports[_0x96a4('0x28')]=function(_0x5ea0c2){var _0x42e4a7=this;return new Promise(function(_0x4dc0b4,_0x2c2e4d){return db[_0x96a4('0x1c')][_0x96a4('0x29')]({'raw':_0x5ea0c2[_0x96a4('0x1d')]?_0x5ea0c2[_0x96a4('0x1d')][_0x96a4('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ea0c2[_0x96a4('0x1d')]?_0x5ea0c2[_0x96a4('0x1d')][_0x96a4('0x1f')]||null:null,'attributes':_0x5ea0c2[_0x96a4('0x1d')]?_0x5ea0c2[_0x96a4('0x1d')][_0x96a4('0x20')]||null:null,'include':_0x5ea0c2[_0x96a4('0x1d')]?_0x5ea0c2[_0x96a4('0x1d')][_0x96a4('0x23')]?_[_0x96a4('0x22')](_0x5ea0c2['options'][_0x96a4('0x23')],function(_0x3905ec){return{'model':db[_0x3905ec[_0x96a4('0x24')]],'as':_0x3905ec['as'],'attributes':_0x3905ec[_0x96a4('0x20')],'include':_0x3905ec[_0x96a4('0x23')]?_[_0x96a4('0x22')](_0x3905ec[_0x96a4('0x23')],function(_0x153f2b){return{'model':db[_0x153f2b[_0x96a4('0x24')]],'as':_0x153f2b['as'],'attributes':_0x153f2b[_0x96a4('0x20')],'include':_0x153f2b['include']?_[_0x96a4('0x22')](_0x153f2b[_0x96a4('0x23')],function(_0x793c9d){return{'model':db[_0x793c9d[_0x96a4('0x24')]],'as':_0x793c9d['as'],'attributes':_0x793c9d[_0x96a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x96a4('0x25')](function(_0x555f5d){logger[_0x96a4('0x26')]('ShowOpenchannelQueue',_0x5ea0c2);logger['debug'](_0x96a4('0x28'),_0x5ea0c2,JSON[_0x96a4('0x27')](_0x555f5d));_0x4dc0b4(_0x555f5d);})[_0x96a4('0x1a')](function(_0x5b1a0e){logger['error'](_0x96a4('0x28'),_0x5b1a0e[_0x96a4('0x17')],_0x5ea0c2);_0x2c2e4d(_0x42e4a7[_0x96a4('0x15')](0x1f4,_0x5b1a0e[_0x96a4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f5dedf4..662e367 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 _0x0b7f=['openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener','register','length'];(function(_0x573ad5,_0x31f51f){var _0x48aaf=function(_0x59bae8){while(--_0x59bae8){_0x573ad5['push'](_0x573ad5['shift']());}};_0x48aaf(++_0x31f51f);}(_0x0b7f,0x79));var _0xf0b7=function(_0x56eee9,_0xb31d5b){_0x56eee9=_0x56eee9-0x0;var _0xb012bb=_0x0b7f[_0x56eee9];return _0xb012bb;};'use strict';var OpenchannelQueueEvents=require(_0xf0b7('0x0'));var events=[_0xf0b7('0x1'),'remove',_0xf0b7('0x2')];function createListener(_0x4a2794,_0x13922b){return function(_0x532163){_0x13922b[_0xf0b7('0x3')](_0x4a2794,_0x532163);};}function removeListener(_0x3916fd,_0x2bb6b5){return function(){OpenchannelQueueEvents[_0xf0b7('0x4')](_0x3916fd,_0x2bb6b5);};}exports[_0xf0b7('0x5')]=function(_0x128c11){for(var _0x9fc80f=0x0,_0x3df58b=events[_0xf0b7('0x6')];_0x9fc80f<_0x3df58b;_0x9fc80f++){var _0x1ccdc8=events[_0x9fc80f];var _0x407e50=createListener(_0xf0b7('0x7')+_0x1ccdc8,_0x128c11);OpenchannelQueueEvents['on'](_0x1ccdc8,_0x407e50);}}; \ No newline at end of file +var _0x90d9=['length','openchannelQueue:','save','remove','update','emit','register'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x90d9,0xd4));var _0x990d=function(_0x596465,_0xfe090a){_0x596465=_0x596465-0x0;var _0x461225=_0x90d9[_0x596465];return _0x461225;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x990d('0x0'),_0x990d('0x1'),_0x990d('0x2')];function createListener(_0x1c975b,_0xb2ef49){return function(_0x25339f){_0xb2ef49[_0x990d('0x3')](_0x1c975b,_0x25339f);};}function removeListener(_0x5176a6,_0x2234d1){return function(){OpenchannelQueueEvents['removeListener'](_0x5176a6,_0x2234d1);};}exports[_0x990d('0x4')]=function(_0x5aaa5c){for(var _0x402b22=0x0,_0x2224f5=events[_0x990d('0x5')];_0x402b22<_0x2224f5;_0x402b22++){var _0x5d1393=events[_0x402b22];var _0x268729=createListener(_0x990d('0x6')+_0x5d1393,_0x5aaa5c);OpenchannelQueueEvents['on'](_0x5d1393,_0x268729);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 058173e..adda4da 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 _0xd940=['get','/:id','show','post','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','isAuthenticated'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xd940,0xb7));var _0x0d94=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0xd940[_0x16ea87];return _0x6e7b1c;};'use strict';var multer=require(_0x0d94('0x0'));var util=require('util');var path=require(_0x0d94('0x1'));var timeout=require(_0x0d94('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0d94('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0d94('0x4'));var config=require(_0x0d94('0x5'));var controller=require(_0x0d94('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d94('0x7')]);router['get']('/describe',auth[_0x0d94('0x8')](),controller['describe']);router[_0x0d94('0x9')](_0x0d94('0xa'),auth[_0x0d94('0x8')](),controller[_0x0d94('0xb')]);router[_0x0d94('0xc')]('/',auth[_0x0d94('0x8')](),controller['create']);router['put'](_0x0d94('0xa'),auth[_0x0d94('0x8')](),controller[_0x0d94('0xd')]);router[_0x0d94('0xe')]('/:id',auth[_0x0d94('0x8')](),controller[_0x0d94('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc19e=['../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4c317b,_0x1d46c8){var _0x33ca3d=function(_0x565a24){while(--_0x565a24){_0x4c317b['push'](_0x4c317b['shift']());}};_0x33ca3d(++_0x1d46c8);}(_0xc19e,0x176));var _0xec19=function(_0x4d3d96,_0xdc594c){_0x4d3d96=_0x4d3d96-0x0;var _0x44a018=_0xc19e[_0x4d3d96];return _0x44a018;};'use strict';var multer=require(_0xec19('0x0'));var util=require(_0xec19('0x1'));var path=require('path');var timeout=require(_0xec19('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xec19('0x3'));var auth=require(_0xec19('0x4'));var interaction=require(_0xec19('0x5'));var config=require(_0xec19('0x6'));var controller=require(_0xec19('0x7'));router[_0xec19('0x8')]('/',auth['isAuthenticated'](),controller[_0xec19('0x9')]);router[_0xec19('0x8')](_0xec19('0xa'),auth[_0xec19('0xb')](),controller['describe']);router[_0xec19('0x8')](_0xec19('0xc'),auth[_0xec19('0xb')](),controller[_0xec19('0xd')]);router['post']('/',auth[_0xec19('0xb')](),controller[_0xec19('0xe')]);router[_0xec19('0xf')](_0xec19('0xc'),auth[_0xec19('0xb')](),controller[_0xec19('0x10')]);router[_0xec19('0x11')](_0xec19('0xc'),auth[_0xec19('0xb')](),controller['destroy']);module[_0xec19('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 18d4ace..9196986 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 _0xab3f=['STRING','DATE','moment','sequelize','exports'];(function(_0x5584ed,_0x1d839b){var _0x4f0640=function(_0x3ad461){while(--_0x3ad461){_0x5584ed['push'](_0x5584ed['shift']());}};_0x4f0640(++_0x1d839b);}(_0xab3f,0x17e));var _0xfab3=function(_0x142d53,_0x4ed6b4){_0x142d53=_0x142d53-0x0;var _0x28a17a=_0xab3f[_0x142d53];return _0x28a17a;};'use strict';var moment=require(_0xfab3('0x0'));var Sequelize=require(_0xfab3('0x1'));module[_0xfab3('0x2')]={'uniqueid':{'type':Sequelize[_0xfab3('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfab3('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfab3('0x4')]},'exitAt':{'type':Sequelize[_0xfab3('0x4')]},'reason':{'type':Sequelize[_0xfab3('0x3')]}}; \ No newline at end of file +var _0x1f1c=['DATE','sequelize','STRING'];(function(_0x135ebc,_0x123430){var _0x210162=function(_0x4c7459){while(--_0x4c7459){_0x135ebc['push'](_0x135ebc['shift']());}};_0x210162(++_0x123430);}(_0x1f1c,0x1ed));var _0xc1f1=function(_0x1d8226,_0x27906c){_0x1d8226=_0x1d8226-0x0;var _0x2cd685=_0x1f1c[_0x1d8226];return _0x2cd685;};'use strict';var moment=require('moment');var Sequelize=require(_0xc1f1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc1f1('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xc1f1('0x1')]},'joinAt':{'type':Sequelize[_0xc1f1('0x2')]},'leaveAt':{'type':Sequelize[_0xc1f1('0x2')]},'acceptAt':{'type':Sequelize[_0xc1f1('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc1f1('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6bfa973..5f022bc 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 _0x58e1=['fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','OpenchannelQueueReport','count','includeAll','include','catch','params','merge','find','create','body','describe','zip-dir','moment','bluebird','mustache','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x58e1,0x127));var _0x158e=function(_0x25f743,_0x765664){_0x25f743=_0x25f743-0x0;var _0x2ba165=_0x58e1[_0x25f743];return _0x2ba165;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x158e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x158e('0x1'));var BPromise=require(_0x158e('0x2'));var Mustache=require(_0x158e('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x158e('0x4'));var squel=require(_0x158e('0x5'));var crypto=require(_0x158e('0x6'));var jsforce=require(_0x158e('0x7'));var deskjs=require(_0x158e('0x8'));var toCsv=require(_0x158e('0x9'));var querystring=require(_0x158e('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x158e('0xb'));var qs=require(_0x158e('0xc'));var as=require(_0x158e('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x158e('0xe'))('api');var utils=require(_0x158e('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x158e('0x10'));var db=require(_0x158e('0x11'))['db'];function respondWithStatusCode(_0x311e2a,_0x121361){_0x121361=_0x121361||0xcc;return function(_0x2da693){if(_0x2da693){return _0x311e2a[_0x158e('0x12')](_0x121361);}return _0x311e2a[_0x158e('0x13')](_0x121361)['end']();};}function respondWithResult(_0x4eeaf2,_0x23affb){_0x23affb=_0x23affb||0xc8;return function(_0x24778d){if(_0x24778d){return _0x4eeaf2[_0x158e('0x13')](_0x23affb)[_0x158e('0x14')](_0x24778d);}};}function respondWithFilteredResult(_0x423fdb,_0x456e6f){return function(_0x464a60){if(_0x464a60){var _0x56d4b0=typeof _0x456e6f[_0x158e('0x15')]===_0x158e('0x16')&&typeof _0x456e6f['limit']===_0x158e('0x16');var _0x4707d9=_0x464a60['count'];var _0x5b8295=_0x56d4b0?0x0:_0x456e6f[_0x158e('0x15')];var _0x2e3ba3=_0x56d4b0?_0x464a60['count']:_0x456e6f['offset']+_0x456e6f[_0x158e('0x17')];var _0x36c435;if(_0x2e3ba3>=_0x4707d9){_0x2e3ba3=_0x4707d9;_0x36c435=0xc8;}else{_0x36c435=0xce;}_0x423fdb[_0x158e('0x13')](_0x36c435);return _0x423fdb['set'](_0x158e('0x18'),_0x5b8295+'-'+_0x2e3ba3+'/'+_0x4707d9)[_0x158e('0x14')](_0x464a60);}return null;};}function patchUpdates(_0x38a4e6){return function(_0x2739fb){try{jsonpatch[_0x158e('0x19')](_0x2739fb,_0x38a4e6,!![]);}catch(_0x183e56){return BPromise[_0x158e('0x1a')](_0x183e56);}return _0x2739fb[_0x158e('0x1b')]();};}function saveUpdates(_0x1c052f,_0x1e9569){return function(_0x4eb86b){if(_0x4eb86b){return _0x4eb86b[_0x158e('0x1c')](_0x1c052f)['then'](function(_0x5b7965){return _0x5b7965;});}return null;};}function removeEntity(_0x3d4cc5,_0x3eed6d){return function(_0x25264f){if(_0x25264f){return _0x25264f[_0x158e('0x1d')]()[_0x158e('0x1e')](function(){_0x3d4cc5[_0x158e('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcfeff5,_0x2911c2){return function(_0x3e1a74){if(!_0x3e1a74){_0xcfeff5[_0x158e('0x12')](0x194);}return _0x3e1a74;};}function handleError(_0x494dd9,_0x50eea8){_0x50eea8=_0x50eea8||0x1f4;return function(_0x96f5ea){logger[_0x158e('0x1f')](_0x96f5ea['stack']);if(_0x96f5ea[_0x158e('0x20')]){delete _0x96f5ea[_0x158e('0x20')];}_0x494dd9['status'](_0x50eea8)[_0x158e('0x21')](_0x96f5ea);};}exports[_0x158e('0x22')]=function(_0xb7d571,_0x4e1467){var _0x4c9569={},_0x4cbebe={},_0x3b0fcb={'count':0x0,'rows':[]};var _0x1f317a=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x3fb797){return{'name':_0x3fb797[_0x158e('0x23')],'type':_0x3fb797[_0x158e('0x24')][_0x158e('0x25')]};});_0x4cbebe[_0x158e('0x26')]=_[_0x158e('0x27')](_0x1f317a,_0x158e('0x20'));_0x4cbebe[_0x158e('0x28')]=_[_0x158e('0x29')](_0xb7d571['query']);_0x4cbebe[_0x158e('0x2a')]=_[_0x158e('0x2b')](_0x4cbebe[_0x158e('0x26')],_0x4cbebe[_0x158e('0x28')]);_0x4c9569[_0x158e('0x2c')]=_[_0x158e('0x2b')](_0x4cbebe['model'],qs[_0x158e('0x2d')](_0xb7d571[_0x158e('0x28')][_0x158e('0x2d')]));_0x4c9569[_0x158e('0x2c')]=_0x4c9569[_0x158e('0x2c')][_0x158e('0x2e')]?_0x4c9569['attributes']:_0x4cbebe[_0x158e('0x26')];if(!_0xb7d571[_0x158e('0x28')]['hasOwnProperty'](_0x158e('0x2f'))){_0x4c9569[_0x158e('0x17')]=qs[_0x158e('0x17')](_0xb7d571[_0x158e('0x28')]['limit']);_0x4c9569[_0x158e('0x15')]=qs[_0x158e('0x15')](_0xb7d571[_0x158e('0x28')][_0x158e('0x15')]);}_0x4c9569[_0x158e('0x30')]=qs[_0x158e('0x31')](_0xb7d571[_0x158e('0x28')][_0x158e('0x31')]);_0x4c9569[_0x158e('0x32')]=qs['filters'](_[_0x158e('0x33')](_0xb7d571[_0x158e('0x28')],_0x4cbebe[_0x158e('0x2a')]),_0x1f317a);if(_0xb7d571['query'][_0x158e('0x34')]){_0x4c9569[_0x158e('0x32')]=_['merge'](_0x4c9569[_0x158e('0x32')],{'$or':_[_0x158e('0x27')](_0x1f317a,function(_0x2c999c){if(_0x2c999c['type']!==_0x158e('0x35')){var _0x200716={};_0x200716[_0x2c999c[_0x158e('0x20')]]={'$like':'%'+_0xb7d571[_0x158e('0x28')][_0x158e('0x34')]+'%'};return _0x200716;}})});}_0x4c9569=_['merge']({},_0x4c9569,_0xb7d571[_0x158e('0x36')]);var _0x3f7382={'where':_0x4c9569[_0x158e('0x32')]};return db[_0x158e('0x37')]['count'](_0x3f7382)[_0x158e('0x1e')](function(_0x1ff999){_0x3b0fcb[_0x158e('0x38')]=_0x1ff999;if(_0xb7d571['query'][_0x158e('0x39')]){_0x4c9569[_0x158e('0x3a')]=[{'all':!![]}];}return db[_0x158e('0x37')]['findAll'](_0x4c9569);})['then'](function(_0x2f812b){_0x3b0fcb['rows']=_0x2f812b;return _0x3b0fcb;})[_0x158e('0x1e')](respondWithFilteredResult(_0x4e1467,_0x4c9569))[_0x158e('0x3b')](handleError(_0x4e1467,null));};exports['show']=function(_0x219c24,_0x66bf94){var _0x354194={'raw':!![],'where':{'id':_0x219c24[_0x158e('0x3c')]['id']}},_0x10da61={};_0x10da61[_0x158e('0x26')]=_[_0x158e('0x29')](db[_0x158e('0x37')]['rawAttributes']);_0x10da61['query']=_[_0x158e('0x29')](_0x219c24[_0x158e('0x28')]);_0x10da61['filters']=_[_0x158e('0x2b')](_0x10da61[_0x158e('0x26')],_0x10da61[_0x158e('0x28')]);_0x354194[_0x158e('0x2c')]=_[_0x158e('0x2b')](_0x10da61['model'],qs[_0x158e('0x2d')](_0x219c24['query']['fields']));_0x354194[_0x158e('0x2c')]=_0x354194['attributes'][_0x158e('0x2e')]?_0x354194[_0x158e('0x2c')]:_0x10da61[_0x158e('0x26')];if(_0x219c24[_0x158e('0x28')][_0x158e('0x39')]){_0x354194[_0x158e('0x3a')]=[{'all':!![]}];}_0x354194=_[_0x158e('0x3d')]({},_0x354194,_0x219c24[_0x158e('0x36')]);return db['OpenchannelQueueReport'][_0x158e('0x3e')](_0x354194)['then'](handleEntityNotFound(_0x66bf94,null))[_0x158e('0x1e')](respondWithResult(_0x66bf94,null))[_0x158e('0x3b')](handleError(_0x66bf94,null));};exports[_0x158e('0x3f')]=function(_0x4710bb,_0x19cb4b){return db[_0x158e('0x37')]['create'](_0x4710bb[_0x158e('0x40')],{})[_0x158e('0x1e')](respondWithResult(_0x19cb4b,0xc9))[_0x158e('0x3b')](handleError(_0x19cb4b,null));};exports['update']=function(_0x202306,_0xdb58ca){if(_0x202306['body']['id']){delete _0x202306['body']['id'];}return db[_0x158e('0x37')][_0x158e('0x3e')]({'where':{'id':_0x202306[_0x158e('0x3c')]['id']}})[_0x158e('0x1e')](handleEntityNotFound(_0xdb58ca,null))[_0x158e('0x1e')](saveUpdates(_0x202306[_0x158e('0x40')],null))['then'](respondWithResult(_0xdb58ca,null))[_0x158e('0x3b')](handleError(_0xdb58ca,null));};exports['destroy']=function(_0x4e9f39,_0x75582d){return db[_0x158e('0x37')][_0x158e('0x3e')]({'where':{'id':_0x4e9f39[_0x158e('0x3c')]['id']}})[_0x158e('0x1e')](handleEntityNotFound(_0x75582d,null))[_0x158e('0x1e')](removeEntity(_0x75582d,null))[_0x158e('0x3b')](handleError(_0x75582d,null));};exports[_0x158e('0x41')]=function(_0x2dad54,_0x30e7e6){return db['OpenchannelQueueReport'][_0x158e('0x41')]()[_0x158e('0x1e')](respondWithResult(_0x30e7e6,null))[_0x158e('0x3b')](handleError(_0x30e7e6,null));}; \ No newline at end of file +var _0xc10a=['apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','OpenchannelQueueReport','findAll','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc10a,0x161));var _0xac10=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xc10a[_0xc77819];return _0x1c9434;};'use strict';var emlformat=require(_0xac10('0x0'));var rimraf=require(_0xac10('0x1'));var zipdir=require(_0xac10('0x2'));var jsonpatch=require(_0xac10('0x3'));var rp=require(_0xac10('0x4'));var moment=require(_0xac10('0x5'));var BPromise=require(_0xac10('0x6'));var Mustache=require(_0xac10('0x7'));var util=require(_0xac10('0x8'));var path=require(_0xac10('0x9'));var sox=require(_0xac10('0xa'));var csv=require(_0xac10('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac10('0xc'));var _=require(_0xac10('0xd'));var squel=require(_0xac10('0xe'));var crypto=require(_0xac10('0xf'));var jsforce=require(_0xac10('0x10'));var deskjs=require(_0xac10('0x11'));var toCsv=require('to-csv');var querystring=require(_0xac10('0x12'));var Papa=require('papaparse');var Redis=require(_0xac10('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xac10('0x14'));var as=require(_0xac10('0x15'));var hardwareService=require(_0xac10('0x16'));var logger=require(_0xac10('0x17'))(_0xac10('0x18'));var utils=require('../../config/utils');var config=require(_0xac10('0x19'));var licenseUtil=require(_0xac10('0x1a'));var db=require(_0xac10('0x1b'))['db'];function respondWithStatusCode(_0x4b7715,_0x21eefb){_0x21eefb=_0x21eefb||0xcc;return function(_0x3ad7c5){if(_0x3ad7c5){return _0x4b7715[_0xac10('0x1c')](_0x21eefb);}return _0x4b7715[_0xac10('0x1d')](_0x21eefb)[_0xac10('0x1e')]();};}function respondWithResult(_0x306820,_0x445bcc){_0x445bcc=_0x445bcc||0xc8;return function(_0x2de7c8){if(_0x2de7c8){return _0x306820['status'](_0x445bcc)[_0xac10('0x1f')](_0x2de7c8);}};}function respondWithFilteredResult(_0xccfee7,_0x3a9110){return function(_0x303a49){if(_0x303a49){var _0x464541=typeof _0x3a9110['offset']===_0xac10('0x20')&&typeof _0x3a9110['limit']===_0xac10('0x20');var _0x384fe0=_0x303a49[_0xac10('0x21')];var _0x3ba3e9=_0x464541?0x0:_0x3a9110['offset'];var _0x46510b=_0x464541?_0x303a49['count']:_0x3a9110[_0xac10('0x22')]+_0x3a9110[_0xac10('0x23')];var _0xb7bfff;if(_0x46510b>=_0x384fe0){_0x46510b=_0x384fe0;_0xb7bfff=0xc8;}else{_0xb7bfff=0xce;}_0xccfee7['status'](_0xb7bfff);return _0xccfee7[_0xac10('0x24')]('Content-Range',_0x3ba3e9+'-'+_0x46510b+'/'+_0x384fe0)['json'](_0x303a49);}return null;};}function patchUpdates(_0x50141f){return function(_0x42b8e3){try{jsonpatch[_0xac10('0x25')](_0x42b8e3,_0x50141f,!![]);}catch(_0x43a0e4){return BPromise[_0xac10('0x26')](_0x43a0e4);}return _0x42b8e3[_0xac10('0x27')]();};}function saveUpdates(_0x43ee5a,_0x34ae26){return function(_0x1cfdbe){if(_0x1cfdbe){return _0x1cfdbe[_0xac10('0x28')](_0x43ee5a)[_0xac10('0x29')](function(_0x5a84e0){return _0x5a84e0;});}return null;};}function removeEntity(_0x5cfa07,_0x18f47e){return function(_0x54aebd){if(_0x54aebd){return _0x54aebd[_0xac10('0x2a')]()['then'](function(){_0x5cfa07[_0xac10('0x1d')](0xcc)[_0xac10('0x1e')]();});}};}function handleEntityNotFound(_0x280b03,_0x2c2718){return function(_0x25c1d8){if(!_0x25c1d8){_0x280b03['sendStatus'](0x194);}return _0x25c1d8;};}function handleError(_0x2f1072,_0x59a96b){_0x59a96b=_0x59a96b||0x1f4;return function(_0x1d56a4){logger['error'](_0x1d56a4[_0xac10('0x2b')]);if(_0x1d56a4[_0xac10('0x2c')]){delete _0x1d56a4['name'];}_0x2f1072['status'](_0x59a96b)['send'](_0x1d56a4);};}exports[_0xac10('0x2d')]=function(_0x7f7200,_0x546019){var _0x17de4d={},_0x9b887a={},_0x590f8f={'count':0x0,'rows':[]};var _0x41d098=_[_0xac10('0x2e')](db['OpenchannelQueueReport'][_0xac10('0x2f')],function(_0x36a1f7){return{'name':_0x36a1f7[_0xac10('0x30')],'type':_0x36a1f7['type']['key']};});_0x9b887a[_0xac10('0x31')]=_[_0xac10('0x2e')](_0x41d098,_0xac10('0x2c'));_0x9b887a[_0xac10('0x32')]=_[_0xac10('0x33')](_0x7f7200['query']);_0x9b887a[_0xac10('0x34')]=_[_0xac10('0x35')](_0x9b887a[_0xac10('0x31')],_0x9b887a[_0xac10('0x32')]);_0x17de4d[_0xac10('0x36')]=_[_0xac10('0x35')](_0x9b887a[_0xac10('0x31')],qs[_0xac10('0x37')](_0x7f7200[_0xac10('0x32')]['fields']));_0x17de4d[_0xac10('0x36')]=_0x17de4d[_0xac10('0x36')][_0xac10('0x38')]?_0x17de4d[_0xac10('0x36')]:_0x9b887a[_0xac10('0x31')];if(!_0x7f7200[_0xac10('0x32')][_0xac10('0x39')](_0xac10('0x3a'))){_0x17de4d[_0xac10('0x23')]=qs[_0xac10('0x23')](_0x7f7200[_0xac10('0x32')]['limit']);_0x17de4d[_0xac10('0x22')]=qs[_0xac10('0x22')](_0x7f7200[_0xac10('0x32')]['offset']);}_0x17de4d['order']=qs[_0xac10('0x3b')](_0x7f7200[_0xac10('0x32')][_0xac10('0x3b')]);_0x17de4d[_0xac10('0x3c')]=qs[_0xac10('0x34')](_[_0xac10('0x3d')](_0x7f7200[_0xac10('0x32')],_0x9b887a[_0xac10('0x34')]),_0x41d098);if(_0x7f7200[_0xac10('0x32')][_0xac10('0x3e')]){_0x17de4d[_0xac10('0x3c')]=_['merge'](_0x17de4d[_0xac10('0x3c')],{'$or':_[_0xac10('0x2e')](_0x41d098,function(_0x5b8335){if(_0x5b8335[_0xac10('0x3f')]!==_0xac10('0x40')){var _0xe5fb32={};_0xe5fb32[_0x5b8335[_0xac10('0x2c')]]={'$like':'%'+_0x7f7200['query'][_0xac10('0x3e')]+'%'};return _0xe5fb32;}})});}_0x17de4d=_[_0xac10('0x41')]({},_0x17de4d,_0x7f7200[_0xac10('0x42')]);var _0x4a719c={'where':_0x17de4d[_0xac10('0x3c')]};return db['OpenchannelQueueReport']['count'](_0x4a719c)[_0xac10('0x29')](function(_0x19f1b1){_0x590f8f[_0xac10('0x21')]=_0x19f1b1;if(_0x7f7200[_0xac10('0x32')]['includeAll']){_0x17de4d[_0xac10('0x43')]=[{'all':!![]}];}return db[_0xac10('0x44')][_0xac10('0x45')](_0x17de4d);})[_0xac10('0x29')](function(_0x3ee87e){_0x590f8f['rows']=_0x3ee87e;return _0x590f8f;})[_0xac10('0x29')](respondWithFilteredResult(_0x546019,_0x17de4d))[_0xac10('0x46')](handleError(_0x546019,null));};exports[_0xac10('0x47')]=function(_0x192913,_0x32ff81){var _0xc5eda8={'raw':!![],'where':{'id':_0x192913['params']['id']}},_0x12bc29={};_0x12bc29['model']=_[_0xac10('0x33')](db[_0xac10('0x44')][_0xac10('0x2f')]);_0x12bc29[_0xac10('0x32')]=_[_0xac10('0x33')](_0x192913[_0xac10('0x32')]);_0x12bc29[_0xac10('0x34')]=_[_0xac10('0x35')](_0x12bc29[_0xac10('0x31')],_0x12bc29[_0xac10('0x32')]);_0xc5eda8[_0xac10('0x36')]=_[_0xac10('0x35')](_0x12bc29[_0xac10('0x31')],qs['fields'](_0x192913[_0xac10('0x32')][_0xac10('0x37')]));_0xc5eda8['attributes']=_0xc5eda8['attributes']['length']?_0xc5eda8['attributes']:_0x12bc29[_0xac10('0x31')];if(_0x192913['query'][_0xac10('0x48')]){_0xc5eda8[_0xac10('0x43')]=[{'all':!![]}];}_0xc5eda8=_[_0xac10('0x41')]({},_0xc5eda8,_0x192913[_0xac10('0x42')]);return db[_0xac10('0x44')][_0xac10('0x49')](_0xc5eda8)[_0xac10('0x29')](handleEntityNotFound(_0x32ff81,null))[_0xac10('0x29')](respondWithResult(_0x32ff81,null))[_0xac10('0x46')](handleError(_0x32ff81,null));};exports[_0xac10('0x4a')]=function(_0x5040ba,_0x7ce988){return db[_0xac10('0x44')]['create'](_0x5040ba[_0xac10('0x4b')],{})[_0xac10('0x29')](respondWithResult(_0x7ce988,0xc9))[_0xac10('0x46')](handleError(_0x7ce988,null));};exports[_0xac10('0x28')]=function(_0x120f7e,_0x9d47e3){if(_0x120f7e[_0xac10('0x4b')]['id']){delete _0x120f7e['body']['id'];}return db[_0xac10('0x44')][_0xac10('0x49')]({'where':{'id':_0x120f7e[_0xac10('0x4c')]['id']}})[_0xac10('0x29')](handleEntityNotFound(_0x9d47e3,null))[_0xac10('0x29')](saveUpdates(_0x120f7e['body'],null))[_0xac10('0x29')](respondWithResult(_0x9d47e3,null))[_0xac10('0x46')](handleError(_0x9d47e3,null));};exports['destroy']=function(_0x2918a3,_0x4051e7){return db[_0xac10('0x44')][_0xac10('0x49')]({'where':{'id':_0x2918a3[_0xac10('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4051e7,null))[_0xac10('0x29')](removeEntity(_0x4051e7,null))[_0xac10('0x46')](handleError(_0x4051e7,null));};exports[_0xac10('0x4d')]=function(_0x1f8497,_0x51a7fb){return db[_0xac10('0x44')]['describe']()[_0xac10('0x29')](respondWithResult(_0x51a7fb,null))['catch'](handleError(_0x51a7fb,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index e4d5c0c..d2b9126 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0xccd979,_0x3c0743){var _0x1f08ab=function(_0x17e115){while(--_0x17e115){_0xccd979['push'](_0xccd979['shift']());}};_0x1f08ab(++_0x3c0743);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0xbbf34a,_0x50d3c4){var _0x2f29c5=function(_0x584f37){while(--_0x584f37){_0xbbf34a['push'](_0xbbf34a['shift']());}};_0x2f29c5(++_0x50d3c4);}(_0x2ef3,0xba));var _0x32ef=function(_0x3c5b75,_0x2f3015){_0x3c5b75=_0x3c5b75-0x0;var _0x3dc846=_0x2ef3[_0x3c5b75];return _0x3dc846;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 13bf4b7..1bf23ed 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 _0x5eb8=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','stringify','UpdateOpenchannelQueueReport','where','attributes','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x13c1e2,_0x16eace){var _0x36086a=function(_0x2f0854){while(--_0x2f0854){_0x13c1e2['push'](_0x13c1e2['shift']());}};_0x36086a(++_0x16eace);}(_0x5eb8,0xb0));var _0x85eb=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0x5eb8[_0x85d5a8];return _0x20479b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['CreateOpenchannelQueueReport']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')](_0x50d2a8[_0x85eb('0x17')],{'raw':_0x50d2a8['options']?_0x50d2a8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![]})[_0x85eb('0x1a')](function(_0x4e8041){logger['info']('CreateOpenchannelQueueReport',_0x50d2a8);logger['debug'](_0x85eb('0x1b'),_0x50d2a8,JSON[_0x85eb('0x1c')](_0x4e8041));_0x39ca96(_0x4e8041);})[_0x85eb('0x14')](function(_0x255ca7){logger[_0x85eb('0x12')](_0x85eb('0x1b'),_0x255ca7['message'],_0x50d2a8);_0x10cf2f(_0xe198ca['error'](0x1f4,_0x255ca7['message']));});});};exports[_0x85eb('0x1d')]=function(_0x1426c8){var _0x3f7a4d=this;return new Promise(function(_0x28b87d,_0x312b3e){return db[_0x85eb('0x15')]['update'](_0x1426c8[_0x85eb('0x17')],{'raw':_0x1426c8[_0x85eb('0x18')]?_0x1426c8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1426c8[_0x85eb('0x18')]?_0x1426c8['options'][_0x85eb('0x1e')]||null:null,'attributes':_0x1426c8[_0x85eb('0x18')]?_0x1426c8[_0x85eb('0x18')][_0x85eb('0x1f')]||null:null,'limit':_0x1426c8[_0x85eb('0x18')]?_0x1426c8[_0x85eb('0x18')]['limit']||null:null})['then'](function(_0x37515c){logger['info'](_0x85eb('0x1d'),_0x1426c8);logger['debug'](_0x85eb('0x1d'),_0x1426c8,JSON[_0x85eb('0x1c')](_0x37515c));_0x28b87d(_0x37515c);})[_0x85eb('0x14')](function(_0x1d9278){logger[_0x85eb('0x12')](_0x85eb('0x1d'),_0x1d9278[_0x85eb('0x13')],_0x1426c8);_0x312b3e(_0x3f7a4d['error'](0x1f4,_0x1d9278[_0x85eb('0x13')]));});});}; \ No newline at end of file +var _0x4227=['CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x3f1861,_0x7b4285){var _0x7ca70a=function(_0x119b09){while(--_0x119b09){_0x3f1861['push'](_0x3f1861['shift']());}};_0x7ca70a(++_0x7b4285);}(_0x4227,0x89));var _0x7422=function(_0x24cebf,_0x60ac39){_0x24cebf=_0x24cebf-0x0;var _0x2e770a=_0x4227[_0x24cebf];return _0x2e770a;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7422('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7422('0x2'));var db=require(_0x7422('0x3'))['db'];var utils=require(_0x7422('0x4'));var logger=require('../../config/logger')(_0x7422('0x5'));var config=require(_0x7422('0x6'));var jayson=require(_0x7422('0x7'));var client=jayson[_0x7422('0x8')][_0x7422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3432,_0xe99299,_0x45ca1a){return new BPromise(function(_0x12965e,_0x599d78){return client[_0x7422('0xa')](_0x2b3432,_0x45ca1a)[_0x7422('0xb')](function(_0x25de34){logger['info'](_0x7422('0xc'),_0xe99299,'request\x20sent');logger[_0x7422('0xd')](_0x7422('0xe'),_0xe99299,_0x7422('0xf'),JSON[_0x7422('0x10')](_0x25de34));if(_0x25de34[_0x7422('0x11')]){if(_0x25de34['error'][_0x7422('0x12')]===0x1f4){logger[_0x7422('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x25de34[_0x7422('0x11')][_0x7422('0x13')]);return _0x599d78(_0x25de34['error'][_0x7422('0x13')]);}logger[_0x7422('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x25de34['error'][_0x7422('0x13')]);return _0x12965e(_0x25de34['error'][_0x7422('0x13')]);}else{logger[_0x7422('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x7422('0xf'));_0x12965e(_0x25de34[_0x7422('0x15')][_0x7422('0x13')]);}})[_0x7422('0x16')](function(_0x2946ca){logger[_0x7422('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x2946ca);_0x599d78(_0x2946ca);});});}exports[_0x7422('0x17')]=function(_0xa7ff41){var _0x493f59=this;return new Promise(function(_0x30656d,_0x57b8bf){return db[_0x7422('0x18')]['create'](_0xa7ff41[_0x7422('0x19')],{'raw':_0xa7ff41[_0x7422('0x1a')]?_0xa7ff41[_0x7422('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7422('0xb')](function(_0xacaad1){logger[_0x7422('0x14')](_0x7422('0x17'),_0xa7ff41);logger['debug']('CreateOpenchannelQueueReport',_0xa7ff41,JSON[_0x7422('0x10')](_0xacaad1));_0x30656d(_0xacaad1);})[_0x7422('0x16')](function(_0x20c1e3){logger[_0x7422('0x11')](_0x7422('0x17'),_0x20c1e3[_0x7422('0x13')],_0xa7ff41);_0x57b8bf(_0x493f59[_0x7422('0x11')](0x1f4,_0x20c1e3['message']));});});};exports[_0x7422('0x1b')]=function(_0x46b927){var _0x4fc200=this;return new Promise(function(_0x3a5a0c,_0x23fb68){return db[_0x7422('0x18')][_0x7422('0x1c')](_0x46b927['body'],{'raw':_0x46b927[_0x7422('0x1a')]?_0x46b927[_0x7422('0x1a')][_0x7422('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b927[_0x7422('0x1a')]?_0x46b927[_0x7422('0x1a')]['where']||null:null,'attributes':_0x46b927[_0x7422('0x1a')]?_0x46b927[_0x7422('0x1a')][_0x7422('0x1e')]||null:null,'limit':_0x46b927[_0x7422('0x1a')]?_0x46b927['options'][_0x7422('0x1f')]||null:null})[_0x7422('0xb')](function(_0x9b0144){logger[_0x7422('0x14')]('UpdateOpenchannelQueueReport',_0x46b927);logger[_0x7422('0xd')](_0x7422('0x1b'),_0x46b927,JSON['stringify'](_0x9b0144));_0x3a5a0c(_0x9b0144);})['catch'](function(_0x2baac6){logger[_0x7422('0x11')]('UpdateOpenchannelQueueReport',_0x2baac6[_0x7422('0x13')],_0x46b927);_0x23fb68(_0x4fc200[_0x7422('0x11')](0x1f4,_0x2baac6[_0x7422('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 53cd4c4..fbd38c3 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 _0x4446=['/:id','show','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2594ef,_0x3540d1){var _0x246eb5=function(_0x54518f){while(--_0x54518f){_0x2594ef['push'](_0x2594ef['shift']());}};_0x246eb5(++_0x3540d1);}(_0x4446,0x1bc));var _0x6444=function(_0x5b753f,_0x304c69){_0x5b753f=_0x5b753f-0x0;var _0x158414=_0x4446[_0x5b753f];return _0x158414;};'use strict';var multer=require(_0x6444('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6444('0x1'));var express=require(_0x6444('0x2'));var router=express['Router']();var fs_extra=require(_0x6444('0x3'));var auth=require(_0x6444('0x4'));var interaction=require(_0x6444('0x5'));var config=require(_0x6444('0x6'));var controller=require(_0x6444('0x7'));router[_0x6444('0x8')]('/',auth[_0x6444('0x9')](),controller[_0x6444('0xa')]);router[_0x6444('0x8')](_0x6444('0xb'),auth[_0x6444('0x9')](),controller['describe']);router[_0x6444('0x8')](_0x6444('0xc'),auth[_0x6444('0x9')](),controller[_0x6444('0xd')]);router['post']('/',auth[_0x6444('0x9')](),controller['create']);router[_0x6444('0xe')](_0x6444('0xc'),auth[_0x6444('0x9')](),controller[_0x6444('0xf')]);router[_0x6444('0x10')](_0x6444('0xc'),auth['isAuthenticated'](),controller[_0x6444('0x11')]);module[_0x6444('0x12')]=router; \ No newline at end of file +var _0x2553=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2553,0xc7));var _0x3255=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x2553[_0x506d2f];return _0x101255;};'use strict';var multer=require(_0x3255('0x0'));var util=require(_0x3255('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3255('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3255('0x3'));var interaction=require(_0x3255('0x4'));var config=require(_0x3255('0x5'));var controller=require('./openchannelTransferReport.controller');router[_0x3255('0x6')]('/',auth[_0x3255('0x7')](),controller[_0x3255('0x8')]);router[_0x3255('0x6')](_0x3255('0x9'),auth[_0x3255('0x7')](),controller[_0x3255('0xa')]);router[_0x3255('0x6')]('/:id',auth[_0x3255('0x7')](),controller[_0x3255('0xb')]);router[_0x3255('0xc')]('/',auth[_0x3255('0x7')](),controller[_0x3255('0xd')]);router[_0x3255('0xe')]('/:id',auth[_0x3255('0x7')](),controller[_0x3255('0xf')]);router[_0x3255('0x10')](_0x3255('0x11'),auth[_0x3255('0x7')](),controller[_0x3255('0x12')]);module[_0x3255('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 4113894..d50d428 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x13bf70,_0x1d6a0b){var _0x2d1e30=function(_0x42e490){while(--_0x42e490){_0x13bf70['push'](_0x13bf70['shift']());}};_0x2d1e30(++_0x1d6a0b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x27314d,_0x33c0f2){var _0x30a648=function(_0x21e50b){while(--_0x21e50b){_0x27314d['push'](_0x27314d['shift']());}};_0x30a648(++_0x33c0f2);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 79f43fe..a128826 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 _0xc264=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','length','order','where','merge','VIRTUAL','filter','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','attributes','options','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0x5f2a8e,_0x20bb34){var _0x235a61=function(_0x3dd8e8){while(--_0x3dd8e8){_0x5f2a8e['push'](_0x5f2a8e['shift']());}};_0x235a61(++_0x20bb34);}(_0xc264,0x1ab));var _0x4c26=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0xc264[_0x5c5c52];return _0x4229ff;};'use strict';var emlformat=require(_0x4c26('0x0'));var rimraf=require(_0x4c26('0x1'));var zipdir=require(_0x4c26('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4c26('0x3'));var BPromise=require(_0x4c26('0x4'));var Mustache=require(_0x4c26('0x5'));var util=require(_0x4c26('0x6'));var path=require('path');var sox=require(_0x4c26('0x7'));var csv=require(_0x4c26('0x8'));var ejs=require(_0x4c26('0x9'));var fs=require('fs');var fs_extra=require(_0x4c26('0xa'));var _=require(_0x4c26('0xb'));var squel=require(_0x4c26('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c26('0xd'));var toCsv=require(_0x4c26('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4c26('0xe'));var authService=require(_0x4c26('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c26('0x10'));var logger=require(_0x4c26('0x11'))(_0x4c26('0x12'));var utils=require(_0x4c26('0x13'));var config=require(_0x4c26('0x14'));var licenseUtil=require(_0x4c26('0x15'));var db=require(_0x4c26('0x16'))['db'];function respondWithStatusCode(_0x46f92f,_0x2affe2){_0x2affe2=_0x2affe2||0xcc;return function(_0x356f04){if(_0x356f04){return _0x46f92f[_0x4c26('0x17')](_0x2affe2);}return _0x46f92f['status'](_0x2affe2)[_0x4c26('0x18')]();};}function respondWithResult(_0x472eb2,_0x5f518e){_0x5f518e=_0x5f518e||0xc8;return function(_0x3e32c8){if(_0x3e32c8){return _0x472eb2[_0x4c26('0x19')](_0x5f518e)[_0x4c26('0x1a')](_0x3e32c8);}};}function respondWithFilteredResult(_0x5ee7f8,_0x284b6b){return function(_0x468f4){if(_0x468f4){var _0x51fe27=typeof _0x284b6b[_0x4c26('0x1b')]===_0x4c26('0x1c')&&typeof _0x284b6b['limit']==='undefined';var _0xc35e79=_0x468f4[_0x4c26('0x1d')];var _0x43dc67=_0x51fe27?0x0:_0x284b6b[_0x4c26('0x1b')];var _0x26124f=_0x51fe27?_0x468f4[_0x4c26('0x1d')]:_0x284b6b[_0x4c26('0x1b')]+_0x284b6b[_0x4c26('0x1e')];var _0x44dd4b;if(_0x26124f>=_0xc35e79){_0x26124f=_0xc35e79;_0x44dd4b=0xc8;}else{_0x44dd4b=0xce;}_0x5ee7f8['status'](_0x44dd4b);return _0x5ee7f8['set']('Content-Range',_0x43dc67+'-'+_0x26124f+'/'+_0xc35e79)['json'](_0x468f4);}return null;};}function patchUpdates(_0x2b9fce){return function(_0x5ab93a){try{jsonpatch[_0x4c26('0x1f')](_0x5ab93a,_0x2b9fce,!![]);}catch(_0x51f8b7){return BPromise[_0x4c26('0x20')](_0x51f8b7);}return _0x5ab93a['save']();};}function saveUpdates(_0x46e097,_0x48bb77){return function(_0x370321){if(_0x370321){return _0x370321[_0x4c26('0x21')](_0x46e097)[_0x4c26('0x22')](function(_0xda2374){return _0xda2374;});}return null;};}function removeEntity(_0x4e49dc,_0x411e95){return function(_0x5537a8){if(_0x5537a8){return _0x5537a8[_0x4c26('0x23')]()[_0x4c26('0x22')](function(){_0x4e49dc[_0x4c26('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4373dd,_0x75ba76){return function(_0x451936){if(!_0x451936){_0x4373dd[_0x4c26('0x17')](0x194);}return _0x451936;};}function handleError(_0x4f80e1,_0x17791a){_0x17791a=_0x17791a||0x1f4;return function(_0x1f4f26){logger[_0x4c26('0x24')](_0x1f4f26[_0x4c26('0x25')]);if(_0x1f4f26[_0x4c26('0x26')]){delete _0x1f4f26[_0x4c26('0x26')];}_0x4f80e1[_0x4c26('0x19')](_0x17791a)[_0x4c26('0x27')](_0x1f4f26);};}exports[_0x4c26('0x28')]=function(_0x4506fd,_0x5df6ac){var _0x327ab8={},_0x52096f={},_0x5ac861={'count':0x0,'rows':[]};var _0x1f3067=_[_0x4c26('0x29')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x2230a7){return{'name':_0x2230a7[_0x4c26('0x2a')],'type':_0x2230a7[_0x4c26('0x2b')][_0x4c26('0x2c')]};});_0x52096f[_0x4c26('0x2d')]=_[_0x4c26('0x29')](_0x1f3067,'name');_0x52096f[_0x4c26('0x2e')]=_[_0x4c26('0x2f')](_0x4506fd[_0x4c26('0x2e')]);_0x52096f[_0x4c26('0x30')]=_[_0x4c26('0x31')](_0x52096f[_0x4c26('0x2d')],_0x52096f[_0x4c26('0x2e')]);_0x327ab8['attributes']=_[_0x4c26('0x31')](_0x52096f[_0x4c26('0x2d')],qs['fields'](_0x4506fd['query']['fields']));_0x327ab8['attributes']=_0x327ab8['attributes'][_0x4c26('0x32')]?_0x327ab8['attributes']:_0x52096f['model'];if(!_0x4506fd[_0x4c26('0x2e')]['hasOwnProperty']('nolimit')){_0x327ab8[_0x4c26('0x1e')]=qs[_0x4c26('0x1e')](_0x4506fd['query'][_0x4c26('0x1e')]);_0x327ab8[_0x4c26('0x1b')]=qs[_0x4c26('0x1b')](_0x4506fd[_0x4c26('0x2e')]['offset']);}_0x327ab8[_0x4c26('0x33')]=qs['sort'](_0x4506fd['query']['sort']);_0x327ab8[_0x4c26('0x34')]=qs['filters'](_['pick'](_0x4506fd[_0x4c26('0x2e')],_0x52096f[_0x4c26('0x30')]),_0x1f3067);if(_0x4506fd['query']['filter']){_0x327ab8['where']=_[_0x4c26('0x35')](_0x327ab8[_0x4c26('0x34')],{'$or':_[_0x4c26('0x29')](_0x1f3067,function(_0x3874e5){if(_0x3874e5[_0x4c26('0x2b')]!==_0x4c26('0x36')){var _0x2c0f1b={};_0x2c0f1b[_0x3874e5[_0x4c26('0x26')]]={'$like':'%'+_0x4506fd['query'][_0x4c26('0x37')]+'%'};return _0x2c0f1b;}})});}_0x327ab8=_[_0x4c26('0x35')]({},_0x327ab8,_0x4506fd['options']);var _0x38cc92={'where':_0x327ab8[_0x4c26('0x34')]};return db[_0x4c26('0x38')][_0x4c26('0x1d')](_0x38cc92)['then'](function(_0x3e9027){_0x5ac861[_0x4c26('0x1d')]=_0x3e9027;if(_0x4506fd['query'][_0x4c26('0x39')]){_0x327ab8[_0x4c26('0x3a')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x4c26('0x3b')](_0x327ab8);})[_0x4c26('0x22')](function(_0x2da29f){_0x5ac861[_0x4c26('0x3c')]=_0x2da29f;return _0x5ac861;})[_0x4c26('0x22')](respondWithFilteredResult(_0x5df6ac,_0x327ab8))[_0x4c26('0x3d')](handleError(_0x5df6ac,null));};exports[_0x4c26('0x3e')]=function(_0x4a1c8a,_0x43465a){var _0x376e0b={'raw':!![],'where':{'id':_0x4a1c8a[_0x4c26('0x3f')]['id']}},_0x33e4ca={};_0x33e4ca['model']=_[_0x4c26('0x2f')](db['OpenchannelTransferReport'][_0x4c26('0x40')]);_0x33e4ca[_0x4c26('0x2e')]=_['keys'](_0x4a1c8a[_0x4c26('0x2e')]);_0x33e4ca['filters']=_[_0x4c26('0x31')](_0x33e4ca['model'],_0x33e4ca[_0x4c26('0x2e')]);_0x376e0b['attributes']=_[_0x4c26('0x31')](_0x33e4ca[_0x4c26('0x2d')],qs['fields'](_0x4a1c8a[_0x4c26('0x2e')][_0x4c26('0x41')]));_0x376e0b['attributes']=_0x376e0b[_0x4c26('0x42')][_0x4c26('0x32')]?_0x376e0b[_0x4c26('0x42')]:_0x33e4ca[_0x4c26('0x2d')];if(_0x4a1c8a['query'][_0x4c26('0x39')]){_0x376e0b[_0x4c26('0x3a')]=[{'all':!![]}];}_0x376e0b=_[_0x4c26('0x35')]({},_0x376e0b,_0x4a1c8a[_0x4c26('0x43')]);return db[_0x4c26('0x38')]['find'](_0x376e0b)[_0x4c26('0x22')](handleEntityNotFound(_0x43465a,null))['then'](respondWithResult(_0x43465a,null))['catch'](handleError(_0x43465a,null));};exports[_0x4c26('0x44')]=function(_0x25d687,_0x6c2880){return db[_0x4c26('0x38')][_0x4c26('0x44')](_0x25d687['body'],{})['then'](respondWithResult(_0x6c2880,0xc9))[_0x4c26('0x3d')](handleError(_0x6c2880,null));};exports[_0x4c26('0x21')]=function(_0x26a078,_0x4e9478){if(_0x26a078[_0x4c26('0x45')]['id']){delete _0x26a078['body']['id'];}return db[_0x4c26('0x38')][_0x4c26('0x46')]({'where':{'id':_0x26a078[_0x4c26('0x3f')]['id']}})[_0x4c26('0x22')](handleEntityNotFound(_0x4e9478,null))[_0x4c26('0x22')](saveUpdates(_0x26a078['body'],null))['then'](respondWithResult(_0x4e9478,null))[_0x4c26('0x3d')](handleError(_0x4e9478,null));};exports[_0x4c26('0x23')]=function(_0x195f2d,_0x33f994){return db['OpenchannelTransferReport'][_0x4c26('0x46')]({'where':{'id':_0x195f2d[_0x4c26('0x3f')]['id']}})[_0x4c26('0x22')](handleEntityNotFound(_0x33f994,null))[_0x4c26('0x22')](removeEntity(_0x33f994,null))[_0x4c26('0x3d')](handleError(_0x33f994,null));};exports[_0x4c26('0x47')]=function(_0xc7151,_0x12c7e0){return db[_0x4c26('0x38')]['describe']()['then'](respondWithResult(_0x12c7e0,null))[_0x4c26('0x3d')](handleError(_0x12c7e0,null));}; \ No newline at end of file +var _0x4124=['hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','name','index','map','OpenchannelTransferReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','length'];(function(_0xdeff63,_0x2032c6){var _0x5b9101=function(_0x10f1ec){while(--_0x10f1ec){_0xdeff63['push'](_0xdeff63['shift']());}};_0x5b9101(++_0x2032c6);}(_0x4124,0x128));var _0x4412=function(_0x57671a,_0x303181){_0x57671a=_0x57671a-0x0;var _0x523694=_0x4124[_0x57671a];return _0x523694;};'use strict';var emlformat=require(_0x4412('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4412('0x1'));var jsonpatch=require(_0x4412('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4412('0x3'));var Mustache=require(_0x4412('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4412('0x5'));var csv=require(_0x4412('0x6'));var ejs=require(_0x4412('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4412('0x8'));var squel=require(_0x4412('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4412('0xa'));var toCsv=require(_0x4412('0x6'));var querystring=require(_0x4412('0xb'));var Papa=require(_0x4412('0xc'));var Redis=require('ioredis');var authService=require(_0x4412('0xd'));var qs=require(_0x4412('0xe'));var as=require(_0x4412('0xf'));var hardwareService=require(_0x4412('0x10'));var logger=require('../../config/logger')(_0x4412('0x11'));var utils=require('../../config/utils');var config=require(_0x4412('0x12'));var licenseUtil=require(_0x4412('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32472a,_0x11c299){_0x11c299=_0x11c299||0xcc;return function(_0x53cfb1){if(_0x53cfb1){return _0x32472a[_0x4412('0x14')](_0x11c299);}return _0x32472a[_0x4412('0x15')](_0x11c299)[_0x4412('0x16')]();};}function respondWithResult(_0x3cc6fc,_0x5c1a7a){_0x5c1a7a=_0x5c1a7a||0xc8;return function(_0x4f1670){if(_0x4f1670){return _0x3cc6fc[_0x4412('0x15')](_0x5c1a7a)[_0x4412('0x17')](_0x4f1670);}};}function respondWithFilteredResult(_0x5f2769,_0x1ae385){return function(_0x29b630){if(_0x29b630){var _0x5dd429=typeof _0x1ae385[_0x4412('0x18')]==='undefined'&&typeof _0x1ae385[_0x4412('0x19')]===_0x4412('0x1a');var _0x52f052=_0x29b630[_0x4412('0x1b')];var _0x5b4b09=_0x5dd429?0x0:_0x1ae385['offset'];var _0x4bb8fc=_0x5dd429?_0x29b630[_0x4412('0x1b')]:_0x1ae385['offset']+_0x1ae385['limit'];var _0x37318e;if(_0x4bb8fc>=_0x52f052){_0x4bb8fc=_0x52f052;_0x37318e=0xc8;}else{_0x37318e=0xce;}_0x5f2769[_0x4412('0x15')](_0x37318e);return _0x5f2769[_0x4412('0x1c')](_0x4412('0x1d'),_0x5b4b09+'-'+_0x4bb8fc+'/'+_0x52f052)[_0x4412('0x17')](_0x29b630);}return null;};}function patchUpdates(_0x38989f){return function(_0x3a248b){try{jsonpatch[_0x4412('0x1e')](_0x3a248b,_0x38989f,!![]);}catch(_0x41d525){return BPromise[_0x4412('0x1f')](_0x41d525);}return _0x3a248b['save']();};}function saveUpdates(_0x4a4ab3,_0x24f817){return function(_0x4ac023){if(_0x4ac023){return _0x4ac023[_0x4412('0x20')](_0x4a4ab3)['then'](function(_0x35e4a2){return _0x35e4a2;});}return null;};}function removeEntity(_0x44f81b,_0x399dd1){return function(_0x348787){if(_0x348787){return _0x348787[_0x4412('0x21')]()[_0x4412('0x22')](function(){_0x44f81b[_0x4412('0x15')](0xcc)[_0x4412('0x16')]();});}};}function handleEntityNotFound(_0x308a02,_0x569f5b){return function(_0x4ea49c){if(!_0x4ea49c){_0x308a02[_0x4412('0x14')](0x194);}return _0x4ea49c;};}function handleError(_0x74be29,_0x380fb8){_0x380fb8=_0x380fb8||0x1f4;return function(_0x4630e0){logger['error'](_0x4630e0['stack']);if(_0x4630e0[_0x4412('0x23')]){delete _0x4630e0[_0x4412('0x23')];}_0x74be29[_0x4412('0x15')](_0x380fb8)['send'](_0x4630e0);};}exports[_0x4412('0x24')]=function(_0x4db15c,_0xd06d2f){var _0xb9f6a={},_0x19d0c8={},_0x104108={'count':0x0,'rows':[]};var _0x3d0465=_[_0x4412('0x25')](db[_0x4412('0x26')]['rawAttributes'],function(_0x1285da){return{'name':_0x1285da[_0x4412('0x27')],'type':_0x1285da[_0x4412('0x28')][_0x4412('0x29')]};});_0x19d0c8['model']=_['map'](_0x3d0465,_0x4412('0x23'));_0x19d0c8[_0x4412('0x2a')]=_[_0x4412('0x2b')](_0x4db15c[_0x4412('0x2a')]);_0x19d0c8['filters']=_[_0x4412('0x2c')](_0x19d0c8[_0x4412('0x2d')],_0x19d0c8[_0x4412('0x2a')]);_0xb9f6a['attributes']=_[_0x4412('0x2c')](_0x19d0c8['model'],qs[_0x4412('0x2e')](_0x4db15c['query'][_0x4412('0x2e')]));_0xb9f6a[_0x4412('0x2f')]=_0xb9f6a['attributes'][_0x4412('0x30')]?_0xb9f6a['attributes']:_0x19d0c8[_0x4412('0x2d')];if(!_0x4db15c['query'][_0x4412('0x31')]('nolimit')){_0xb9f6a[_0x4412('0x19')]=qs['limit'](_0x4db15c[_0x4412('0x2a')]['limit']);_0xb9f6a[_0x4412('0x18')]=qs[_0x4412('0x18')](_0x4db15c[_0x4412('0x2a')]['offset']);}_0xb9f6a[_0x4412('0x32')]=qs[_0x4412('0x33')](_0x4db15c[_0x4412('0x2a')]['sort']);_0xb9f6a[_0x4412('0x34')]=qs['filters'](_[_0x4412('0x35')](_0x4db15c[_0x4412('0x2a')],_0x19d0c8[_0x4412('0x36')]),_0x3d0465);if(_0x4db15c[_0x4412('0x2a')][_0x4412('0x37')]){_0xb9f6a[_0x4412('0x34')]=_[_0x4412('0x38')](_0xb9f6a[_0x4412('0x34')],{'$or':_[_0x4412('0x25')](_0x3d0465,function(_0x1aca37){if(_0x1aca37[_0x4412('0x28')]!==_0x4412('0x39')){var _0x356a72={};_0x356a72[_0x1aca37[_0x4412('0x23')]]={'$like':'%'+_0x4db15c[_0x4412('0x2a')][_0x4412('0x37')]+'%'};return _0x356a72;}})});}_0xb9f6a=_[_0x4412('0x38')]({},_0xb9f6a,_0x4db15c[_0x4412('0x3a')]);var _0x58f838={'where':_0xb9f6a[_0x4412('0x34')]};return db[_0x4412('0x26')][_0x4412('0x1b')](_0x58f838)['then'](function(_0x2748d4){_0x104108['count']=_0x2748d4;if(_0x4db15c[_0x4412('0x2a')][_0x4412('0x3b')]){_0xb9f6a[_0x4412('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0xb9f6a);})[_0x4412('0x22')](function(_0xe7744b){_0x104108['rows']=_0xe7744b;return _0x104108;})[_0x4412('0x22')](respondWithFilteredResult(_0xd06d2f,_0xb9f6a))[_0x4412('0x3d')](handleError(_0xd06d2f,null));};exports[_0x4412('0x3e')]=function(_0x14ab8b,_0x12a1bb){var _0x1a8a83={'raw':!![],'where':{'id':_0x14ab8b['params']['id']}},_0x4d8b36={};_0x4d8b36[_0x4412('0x2d')]=_[_0x4412('0x2b')](db['OpenchannelTransferReport'][_0x4412('0x3f')]);_0x4d8b36['query']=_[_0x4412('0x2b')](_0x14ab8b[_0x4412('0x2a')]);_0x4d8b36[_0x4412('0x36')]=_['intersection'](_0x4d8b36[_0x4412('0x2d')],_0x4d8b36[_0x4412('0x2a')]);_0x1a8a83[_0x4412('0x2f')]=_[_0x4412('0x2c')](_0x4d8b36[_0x4412('0x2d')],qs[_0x4412('0x2e')](_0x14ab8b[_0x4412('0x2a')]['fields']));_0x1a8a83[_0x4412('0x2f')]=_0x1a8a83[_0x4412('0x2f')]['length']?_0x1a8a83[_0x4412('0x2f')]:_0x4d8b36[_0x4412('0x2d')];if(_0x14ab8b[_0x4412('0x2a')][_0x4412('0x3b')]){_0x1a8a83[_0x4412('0x3c')]=[{'all':!![]}];}_0x1a8a83=_[_0x4412('0x38')]({},_0x1a8a83,_0x14ab8b[_0x4412('0x3a')]);return db[_0x4412('0x26')][_0x4412('0x40')](_0x1a8a83)[_0x4412('0x22')](handleEntityNotFound(_0x12a1bb,null))['then'](respondWithResult(_0x12a1bb,null))[_0x4412('0x3d')](handleError(_0x12a1bb,null));};exports[_0x4412('0x41')]=function(_0x8312ac,_0x2a63b3){return db[_0x4412('0x26')]['create'](_0x8312ac[_0x4412('0x42')],{})[_0x4412('0x22')](respondWithResult(_0x2a63b3,0xc9))['catch'](handleError(_0x2a63b3,null));};exports['update']=function(_0xce3727,_0x472ac6){if(_0xce3727[_0x4412('0x42')]['id']){delete _0xce3727[_0x4412('0x42')]['id'];}return db[_0x4412('0x26')][_0x4412('0x40')]({'where':{'id':_0xce3727['params']['id']}})[_0x4412('0x22')](handleEntityNotFound(_0x472ac6,null))[_0x4412('0x22')](saveUpdates(_0xce3727['body'],null))['then'](respondWithResult(_0x472ac6,null))['catch'](handleError(_0x472ac6,null));};exports[_0x4412('0x21')]=function(_0x2d9b98,_0x44a8fd){return db[_0x4412('0x26')][_0x4412('0x40')]({'where':{'id':_0x2d9b98[_0x4412('0x43')]['id']}})['then'](handleEntityNotFound(_0x44a8fd,null))[_0x4412('0x22')](removeEntity(_0x44a8fd,null))[_0x4412('0x3d')](handleError(_0x44a8fd,null));};exports['describe']=function(_0x235e5f,_0x30df90){return db[_0x4412('0x26')][_0x4412('0x44')]()[_0x4412('0x22')](respondWithResult(_0x30df90,null))['catch'](handleError(_0x30df90,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e0b23c0..a16528d 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 _0x94f8=['exports','define','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x47e48d,_0x1df508){var _0x569499=function(_0x4c8932){while(--_0x4c8932){_0x47e48d['push'](_0x47e48d['shift']());}};_0x569499(++_0x1df508);}(_0x94f8,0x67));var _0x894f=function(_0x505b1,_0x3f2a5d){_0x505b1=_0x505b1-0x0;var _0x6f5380=_0x94f8[_0x505b1];return _0x6f5380;};'use strict';var _=require(_0x894f('0x0'));var util=require('util');var logger=require(_0x894f('0x1'))(_0x894f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x894f('0x3'));var fs=require('fs');var path=require(_0x894f('0x4'));var rimraf=require(_0x894f('0x5'));var config=require(_0x894f('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x894f('0x7')]=function(_0x36b165,_0x11af1c){return _0x36b165[_0x894f('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x894f('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x894f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54ab=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x264f53,_0x33db5f){var _0x490668=function(_0xc3a7d4){while(--_0xc3a7d4){_0x264f53['push'](_0x264f53['shift']());}};_0x490668(++_0x33db5f);}(_0x54ab,0xf7));var _0xb54a=function(_0x14ca4e,_0x2ca826){_0x14ca4e=_0x14ca4e-0x0;var _0x157e46=_0x54ab[_0x14ca4e];return _0x157e46;};'use strict';var _=require(_0xb54a('0x0'));var util=require(_0xb54a('0x1'));var logger=require('../../config/logger')(_0xb54a('0x2'));var moment=require('moment');var BPromise=require(_0xb54a('0x3'));var rp=require(_0xb54a('0x4'));var fs=require('fs');var path=require(_0xb54a('0x5'));var rimraf=require(_0xb54a('0x6'));var config=require(_0xb54a('0x7'));var attributes=require(_0xb54a('0x8'));module[_0xb54a('0x9')]=function(_0x40f876,_0x21bee8){return _0x40f876[_0xb54a('0xa')](_0xb54a('0xb'),attributes,{'tableName':_0xb54a('0xc'),'paranoid':![],'indexes':[{'name':_0xb54a('0xd'),'fields':[_0xb54a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index aa1ac9f..8edbd66 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 _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x4336ce,_0x4af4f5){var _0x2445cf=function(_0x5210d7){while(--_0x5210d7){_0x4336ce['push'](_0x4336ce['shift']());}};_0x2445cf(++_0x4af4f5);}(_0x0e85,0x7c));var _0x50e8=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x0e85[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var moment=require('moment');var BPromise=require(_0x50e8('0x2'));var rs=require(_0x50e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x50e8('0x4'))('rpc');var config=require(_0x50e8('0x5'));var jayson=require(_0x50e8('0x6'));var client=jayson[_0x50e8('0x7')][_0x50e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){return client[_0x50e8('0x9')](_0x5e8b01,_0x108edc)[_0x50e8('0xa')](function(_0x5825f5){logger[_0x50e8('0xb')](_0x50e8('0xc'),_0x3ce904,_0x50e8('0xd'));logger[_0x50e8('0xe')](_0x50e8('0xf'),_0x3ce904,_0x50e8('0xd'),JSON[_0x50e8('0x10')](_0x5825f5));if(_0x5825f5[_0x50e8('0x11')]){if(_0x5825f5['error']['code']===0x1f4){logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error']['message']);return _0x988da0(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}logger[_0x50e8('0x11')](_0x50e8('0xc'),_0x3ce904,_0x5825f5['error'][_0x50e8('0x12')]);return _0x42665e(_0x5825f5[_0x50e8('0x11')][_0x50e8('0x12')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file +var _0x102b=['error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','stringify'];(function(_0x20fe10,_0x4aa816){var _0x5202ac=function(_0x14a8d1){while(--_0x14a8d1){_0x20fe10['push'](_0x20fe10['shift']());}};_0x5202ac(++_0x4aa816);}(_0x102b,0x1be));var _0xb102=function(_0x52eeaa,_0x4591f8){_0x52eeaa=_0x52eeaa-0x0;var _0x5c9216=_0x102b[_0x52eeaa];return _0x5c9216;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var moment=require('moment');var BPromise=require(_0xb102('0x1'));var rs=require(_0xb102('0x2'));var fs=require('fs');var Redis=require(_0xb102('0x3'));var db=require(_0xb102('0x4'))['db'];var utils=require(_0xb102('0x5'));var logger=require(_0xb102('0x6'))(_0xb102('0x7'));var config=require(_0xb102('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb102('0x9')][_0xb102('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd131eb,_0x256052,_0x1ee0c0){return new BPromise(function(_0x5879bb,_0x338e0f){return client['request'](_0xd131eb,_0x1ee0c0)['then'](function(_0xee2164){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x256052,_0xb102('0xb'));logger[_0xb102('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x256052,_0xb102('0xb'),JSON[_0xb102('0xd')](_0xee2164));if(_0xee2164[_0xb102('0xe')]){if(_0xee2164[_0xb102('0xe')][_0xb102('0xf')]===0x1f4){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0xee2164['error'][_0xb102('0x11')]);return _0x338e0f(_0xee2164['error'][_0xb102('0x11')]);}logger[_0xb102('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x256052,_0xee2164[_0xb102('0xe')][_0xb102('0x11')]);return _0x5879bb(_0xee2164['error'][_0xb102('0x11')]);}else{logger[_0xb102('0x12')](_0xb102('0x10'),_0x256052,'request\x20sent');_0x5879bb(_0xee2164['result']['message']);}})[_0xb102('0x13')](function(_0x7f3487){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0x7f3487);_0x338e0f(_0x7f3487);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 51d0c83..0e88169 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 _0x1b70=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','exports','multer','util','path','connect-timeout'];(function(_0x2c672f,_0x246a79){var _0x5cd832=function(_0x19660f){while(--_0x19660f){_0x2c672f['push'](_0x2c672f['shift']());}};_0x5cd832(++_0x246a79);}(_0x1b70,0xa7));var _0x01b7=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x1b70[_0x264d4d];return _0xc917e2;};'use strict';var multer=require(_0x01b7('0x0'));var util=require(_0x01b7('0x1'));var path=require(_0x01b7('0x2'));var timeout=require(_0x01b7('0x3'));var express=require(_0x01b7('0x4'));var router=express[_0x01b7('0x5')]();var fs_extra=require(_0x01b7('0x6'));var auth=require(_0x01b7('0x7'));var interaction=require(_0x01b7('0x8'));var config=require(_0x01b7('0x9'));var controller=require('./pause.controller');router[_0x01b7('0xa')]('/',auth[_0x01b7('0xb')](),controller[_0x01b7('0xc')]);router['get'](_0x01b7('0xd'),auth['isAuthenticated'](),controller[_0x01b7('0xe')]);router[_0x01b7('0xf')]('/',auth[_0x01b7('0xb')](),controller[_0x01b7('0x10')]);router['put'](_0x01b7('0xd'),auth[_0x01b7('0xb')](),controller['update']);router[_0x01b7('0x11')](_0x01b7('0xd'),auth[_0x01b7('0xb')](),controller['destroy']);module[_0x01b7('0x12')]=router; \ No newline at end of file +var _0xaff1=['isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaff1,0x1d3));var _0x1aff=function(_0x58aeb9,_0x6c3f84){_0x58aeb9=_0x58aeb9-0x0;var _0xc3130a=_0xaff1[_0x58aeb9];return _0xc3130a;};'use strict';var multer=require('multer');var util=require(_0x1aff('0x0'));var path=require('path');var timeout=require(_0x1aff('0x1'));var express=require(_0x1aff('0x2'));var router=express['Router']();var fs_extra=require(_0x1aff('0x3'));var auth=require(_0x1aff('0x4'));var interaction=require(_0x1aff('0x5'));var config=require(_0x1aff('0x6'));var controller=require(_0x1aff('0x7'));router['get']('/',auth[_0x1aff('0x8')](),controller[_0x1aff('0x9')]);router[_0x1aff('0xa')]('/:id',auth[_0x1aff('0x8')](),controller[_0x1aff('0xb')]);router[_0x1aff('0xc')]('/',auth[_0x1aff('0x8')](),controller[_0x1aff('0xd')]);router[_0x1aff('0xe')](_0x1aff('0xf'),auth[_0x1aff('0x8')](),controller[_0x1aff('0x10')]);router[_0x1aff('0x11')](_0x1aff('0xf'),auth['isAuthenticated'](),controller[_0x1aff('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 544ef57..1a5613c 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 _0x90db=['exports'];(function(_0x53e9d8,_0x227d0b){var _0x235823=function(_0xf1ffc0){while(--_0xf1ffc0){_0x53e9d8['push'](_0x53e9d8['shift']());}};_0x235823(++_0x227d0b);}(_0x90db,0x18d));var _0xb90d=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x90db[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require('sequelize');module[_0xb90d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8db7=['exports','STRING','name','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8db7,0x12f));var _0x78db=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x8db7[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x78db('0x0'));module[_0x78db('0x1')]={'name':{'type':Sequelize[_0x78db('0x2')],'unique':_0x78db('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x78db('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ef106a4..b0558fe 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 _0x0cd9=['includeAll','include','Pause','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','get','Pauses','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0xf4e143,_0x44204c){var _0x35695b=function(_0x3a88e9){while(--_0x3a88e9){_0xf4e143['push'](_0xf4e143['shift']());}};_0x35695b(++_0x44204c);}(_0x0cd9,0x106));var _0x90cd=function(_0x3925c7,_0x4e870c){_0x3925c7=_0x3925c7-0x0;var _0x58c9db=_0x0cd9[_0x3925c7];return _0x58c9db;};'use strict';var emlformat=require(_0x90cd('0x0'));var rimraf=require(_0x90cd('0x1'));var zipdir=require(_0x90cd('0x2'));var jsonpatch=require(_0x90cd('0x3'));var rp=require(_0x90cd('0x4'));var moment=require('moment');var BPromise=require(_0x90cd('0x5'));var Mustache=require(_0x90cd('0x6'));var util=require(_0x90cd('0x7'));var path=require(_0x90cd('0x8'));var sox=require(_0x90cd('0x9'));var csv=require('to-csv');var ejs=require(_0x90cd('0xa'));var fs=require('fs');var fs_extra=require(_0x90cd('0xb'));var _=require(_0x90cd('0xc'));var squel=require('squel');var crypto=require(_0x90cd('0xd'));var jsforce=require(_0x90cd('0xe'));var deskjs=require(_0x90cd('0xf'));var toCsv=require(_0x90cd('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x90cd('0x11'));var authService=require(_0x90cd('0x12'));var qs=require(_0x90cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90cd('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x90cd('0x15'));var config=require(_0x90cd('0x16'));var licenseUtil=require(_0x90cd('0x17'));var db=require(_0x90cd('0x18'))['db'];function respondWithStatusCode(_0x137d4c,_0x414f3b){_0x414f3b=_0x414f3b||0xcc;return function(_0x5634f9){if(_0x5634f9){return _0x137d4c[_0x90cd('0x19')](_0x414f3b);}return _0x137d4c[_0x90cd('0x1a')](_0x414f3b)['end']();};}function respondWithResult(_0x8d4feb,_0x251290){_0x251290=_0x251290||0xc8;return function(_0x5d3aa1){if(_0x5d3aa1){return _0x8d4feb[_0x90cd('0x1a')](_0x251290)['json'](_0x5d3aa1);}};}function respondWithFilteredResult(_0xb4df94,_0x29d98b){return function(_0x319470){if(_0x319470){var _0x576ee8=typeof _0x29d98b[_0x90cd('0x1b')]===_0x90cd('0x1c')&&typeof _0x29d98b['limit']===_0x90cd('0x1c');var _0x1579da=_0x319470[_0x90cd('0x1d')];var _0x1ab4cc=_0x576ee8?0x0:_0x29d98b[_0x90cd('0x1b')];var _0x252dab=_0x576ee8?_0x319470[_0x90cd('0x1d')]:_0x29d98b[_0x90cd('0x1b')]+_0x29d98b[_0x90cd('0x1e')];var _0x208ffb;if(_0x252dab>=_0x1579da){_0x252dab=_0x1579da;_0x208ffb=0xc8;}else{_0x208ffb=0xce;}_0xb4df94[_0x90cd('0x1a')](_0x208ffb);return _0xb4df94[_0x90cd('0x1f')](_0x90cd('0x20'),_0x1ab4cc+'-'+_0x252dab+'/'+_0x1579da)[_0x90cd('0x21')](_0x319470);}return null;};}function patchUpdates(_0x3961d2){return function(_0x59d6cf){try{jsonpatch[_0x90cd('0x22')](_0x59d6cf,_0x3961d2,!![]);}catch(_0x564187){return BPromise[_0x90cd('0x23')](_0x564187);}return _0x59d6cf['save']();};}function saveUpdates(_0x3aeb05,_0xf6ee84){return function(_0x5f3e42){if(_0x5f3e42){return _0x5f3e42['update'](_0x3aeb05)[_0x90cd('0x24')](function(_0xc6d83e){return _0xc6d83e;});}return null;};}function removeEntity(_0x476ff6,_0xfa5f56){return function(_0x4d3c4d){if(_0x4d3c4d){return _0x4d3c4d[_0x90cd('0x25')]()[_0x90cd('0x24')](function(){var _0x37304c=_0x4d3c4d[_0x90cd('0x26')]({'plain':!![]});var _0x31e843=_0x90cd('0x27');return db['UserProfileResource'][_0x90cd('0x25')]({'where':{'type':_0x31e843,'resourceId':_0x37304c['id']}})[_0x90cd('0x24')](function(){return _0x4d3c4d;});})[_0x90cd('0x24')](function(){_0x476ff6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d10be,_0x14a164){return function(_0x5dee75){if(!_0x5dee75){_0x1d10be['sendStatus'](0x194);}return _0x5dee75;};}function handleError(_0x31f5c3,_0x3d50e0){_0x3d50e0=_0x3d50e0||0x1f4;return function(_0x1099c0){logger[_0x90cd('0x28')](_0x1099c0[_0x90cd('0x29')]);if(_0x1099c0[_0x90cd('0x2a')]){delete _0x1099c0[_0x90cd('0x2a')];}_0x31f5c3[_0x90cd('0x1a')](_0x3d50e0)[_0x90cd('0x2b')](_0x1099c0);};}exports[_0x90cd('0x2c')]=function(_0x567f63,_0xc26ee8){var _0x9719e0={},_0xcdc65a={},_0x183bda={'count':0x0,'rows':[]};var _0x34fbf5=_[_0x90cd('0x2d')](db['Pause'][_0x90cd('0x2e')],function(_0x3b8df5){return{'name':_0x3b8df5[_0x90cd('0x2f')],'type':_0x3b8df5[_0x90cd('0x30')]['key']};});_0xcdc65a['model']=_[_0x90cd('0x2d')](_0x34fbf5,_0x90cd('0x2a'));_0xcdc65a[_0x90cd('0x31')]=_[_0x90cd('0x32')](_0x567f63['query']);_0xcdc65a[_0x90cd('0x33')]=_[_0x90cd('0x34')](_0xcdc65a[_0x90cd('0x35')],_0xcdc65a[_0x90cd('0x31')]);_0x9719e0[_0x90cd('0x36')]=_[_0x90cd('0x34')](_0xcdc65a['model'],qs[_0x90cd('0x37')](_0x567f63[_0x90cd('0x31')][_0x90cd('0x37')]));_0x9719e0[_0x90cd('0x36')]=_0x9719e0[_0x90cd('0x36')][_0x90cd('0x38')]?_0x9719e0[_0x90cd('0x36')]:_0xcdc65a[_0x90cd('0x35')];if(!_0x567f63[_0x90cd('0x31')][_0x90cd('0x39')](_0x90cd('0x3a'))){_0x9719e0[_0x90cd('0x1e')]=qs[_0x90cd('0x1e')](_0x567f63[_0x90cd('0x31')]['limit']);_0x9719e0[_0x90cd('0x1b')]=qs[_0x90cd('0x1b')](_0x567f63['query'][_0x90cd('0x1b')]);}_0x9719e0[_0x90cd('0x3b')]=qs[_0x90cd('0x3c')](_0x567f63['query'][_0x90cd('0x3c')]);_0x9719e0[_0x90cd('0x3d')]=qs[_0x90cd('0x33')](_['pick'](_0x567f63[_0x90cd('0x31')],_0xcdc65a[_0x90cd('0x33')]),_0x34fbf5);if(_0x567f63[_0x90cd('0x31')][_0x90cd('0x3e')]){_0x9719e0[_0x90cd('0x3d')]=_[_0x90cd('0x3f')](_0x9719e0['where'],{'$or':_[_0x90cd('0x2d')](_0x34fbf5,function(_0xb4ba60){if(_0xb4ba60[_0x90cd('0x30')]!==_0x90cd('0x40')){var _0x5f397d={};_0x5f397d[_0xb4ba60[_0x90cd('0x2a')]]={'$like':'%'+_0x567f63[_0x90cd('0x31')][_0x90cd('0x3e')]+'%'};return _0x5f397d;}})});}_0x9719e0=_[_0x90cd('0x3f')]({},_0x9719e0,_0x567f63[_0x90cd('0x41')]);var _0x372566={'where':_0x9719e0[_0x90cd('0x3d')]};return db['Pause']['count'](_0x372566)[_0x90cd('0x24')](function(_0x218f3c){_0x183bda[_0x90cd('0x1d')]=_0x218f3c;if(_0x567f63[_0x90cd('0x31')][_0x90cd('0x42')]){_0x9719e0[_0x90cd('0x43')]=[{'all':!![]}];}return db[_0x90cd('0x44')]['findAll'](_0x9719e0);})[_0x90cd('0x24')](function(_0x3bf5a8){_0x183bda[_0x90cd('0x45')]=_0x3bf5a8;return _0x183bda;})['then'](respondWithFilteredResult(_0xc26ee8,_0x9719e0))[_0x90cd('0x46')](handleError(_0xc26ee8,null));};exports['show']=function(_0x4be4c1,_0x38cf55){var _0x4d0cd2={'raw':!![],'where':{'id':_0x4be4c1[_0x90cd('0x47')]['id']}},_0x59c678={};_0x59c678[_0x90cd('0x35')]=_[_0x90cd('0x32')](db[_0x90cd('0x44')]['rawAttributes']);_0x59c678[_0x90cd('0x31')]=_[_0x90cd('0x32')](_0x4be4c1['query']);_0x59c678['filters']=_[_0x90cd('0x34')](_0x59c678[_0x90cd('0x35')],_0x59c678['query']);_0x4d0cd2[_0x90cd('0x36')]=_['intersection'](_0x59c678[_0x90cd('0x35')],qs[_0x90cd('0x37')](_0x4be4c1[_0x90cd('0x31')][_0x90cd('0x37')]));_0x4d0cd2[_0x90cd('0x36')]=_0x4d0cd2['attributes'][_0x90cd('0x38')]?_0x4d0cd2[_0x90cd('0x36')]:_0x59c678[_0x90cd('0x35')];if(_0x4be4c1[_0x90cd('0x31')][_0x90cd('0x42')]){_0x4d0cd2[_0x90cd('0x43')]=[{'all':!![]}];}_0x4d0cd2=_[_0x90cd('0x3f')]({},_0x4d0cd2,_0x4be4c1[_0x90cd('0x41')]);return db[_0x90cd('0x44')][_0x90cd('0x48')](_0x4d0cd2)['then'](handleEntityNotFound(_0x38cf55,null))[_0x90cd('0x24')](respondWithResult(_0x38cf55,null))[_0x90cd('0x46')](handleError(_0x38cf55,null));};exports[_0x90cd('0x49')]=function(_0x270908,_0x7897){return db[_0x90cd('0x44')][_0x90cd('0x49')](_0x270908['body'],{})[_0x90cd('0x24')](function(_0x1202d6){var _0x3b2e91=_0x270908[_0x90cd('0x4a')]['get']({'plain':!![]});if(!_0x3b2e91)throw new Error(_0x90cd('0x4b'));if(_0x3b2e91[_0x90cd('0x4c')]==='user'){var _0x24a635=_0x1202d6[_0x90cd('0x26')]({'plain':!![]});var _0x1f03ac='Pauses';return db[_0x90cd('0x4d')][_0x90cd('0x48')]({'where':{'name':_0x1f03ac,'userProfileId':_0x3b2e91[_0x90cd('0x4e')]},'raw':!![]})[_0x90cd('0x24')](function(_0x553190){if(_0x553190&&_0x553190[_0x90cd('0x4f')]===0x0){return db['UserProfileResource'][_0x90cd('0x49')]({'name':_0x24a635[_0x90cd('0x2a')],'resourceId':_0x24a635['id'],'type':_0x553190[_0x90cd('0x2a')],'sectionId':_0x553190['id']},{})[_0x90cd('0x24')](function(){return _0x1202d6;});}else{return _0x1202d6;}})['catch'](function(_0x34dc6f){logger[_0x90cd('0x28')](_0x90cd('0x50'),_0x34dc6f);throw _0x34dc6f;});}return _0x1202d6;})[_0x90cd('0x24')](respondWithResult(_0x7897,0xc9))['catch'](handleError(_0x7897,null));};exports['update']=function(_0x412ce0,_0x356b8f){if(_0x412ce0[_0x90cd('0x51')]['id']){delete _0x412ce0[_0x90cd('0x51')]['id'];}return db[_0x90cd('0x44')][_0x90cd('0x48')]({'where':{'id':_0x412ce0[_0x90cd('0x47')]['id']}})['then'](handleEntityNotFound(_0x356b8f,null))[_0x90cd('0x24')](saveUpdates(_0x412ce0[_0x90cd('0x51')],null))['then'](respondWithResult(_0x356b8f,null))[_0x90cd('0x46')](handleError(_0x356b8f,null));};exports[_0x90cd('0x25')]=function(_0x26cb98,_0x52a6ba){return db[_0x90cd('0x44')][_0x90cd('0x48')]({'where':{'id':_0x26cb98[_0x90cd('0x47')]['id']}})[_0x90cd('0x24')](handleEntityNotFound(_0x52a6ba,null))[_0x90cd('0x24')](removeEntity(_0x52a6ba,null))[_0x90cd('0x46')](handleError(_0x52a6ba,null));}; \ No newline at end of file +var _0x90e9=['nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','keys','intersection','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','get','Pauses','name','send','Pause','rawAttributes','type','map','filters','attributes','model','fields','query','length','hasOwnProperty'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x90e9,0x6a));var _0x990e=function(_0x3fc6eb,_0x16b9b4){_0x3fc6eb=_0x3fc6eb-0x0;var _0x537c9c=_0x90e9[_0x3fc6eb];return _0x537c9c;};'use strict';var emlformat=require(_0x990e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x990e('0x1'));var rp=require(_0x990e('0x2'));var moment=require(_0x990e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x990e('0x4'));var path=require(_0x990e('0x5'));var sox=require(_0x990e('0x6'));var csv=require(_0x990e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x990e('0x8'));var _=require('lodash');var squel=require(_0x990e('0x9'));var crypto=require(_0x990e('0xa'));var jsforce=require(_0x990e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x990e('0xc'));var Papa=require(_0x990e('0xd'));var Redis=require(_0x990e('0xe'));var authService=require(_0x990e('0xf'));var qs=require(_0x990e('0x10'));var as=require(_0x990e('0x11'));var hardwareService=require(_0x990e('0x12'));var logger=require('../../config/logger')(_0x990e('0x13'));var utils=require(_0x990e('0x14'));var config=require(_0x990e('0x15'));var licenseUtil=require(_0x990e('0x16'));var db=require(_0x990e('0x17'))['db'];function respondWithStatusCode(_0x8d1c82,_0x3ef1ce){_0x3ef1ce=_0x3ef1ce||0xcc;return function(_0xaa12b2){if(_0xaa12b2){return _0x8d1c82[_0x990e('0x18')](_0x3ef1ce);}return _0x8d1c82['status'](_0x3ef1ce)[_0x990e('0x19')]();};}function respondWithResult(_0x9b10fd,_0x201417){_0x201417=_0x201417||0xc8;return function(_0x26a8e4){if(_0x26a8e4){return _0x9b10fd[_0x990e('0x1a')](_0x201417)[_0x990e('0x1b')](_0x26a8e4);}};}function respondWithFilteredResult(_0x5e1514,_0x4a5869){return function(_0x206457){if(_0x206457){var _0x49b625=typeof _0x4a5869['offset']===_0x990e('0x1c')&&typeof _0x4a5869['limit']==='undefined';var _0x1c93bb=_0x206457[_0x990e('0x1d')];var _0xea00d7=_0x49b625?0x0:_0x4a5869[_0x990e('0x1e')];var _0x28f23a=_0x49b625?_0x206457[_0x990e('0x1d')]:_0x4a5869['offset']+_0x4a5869['limit'];var _0x145a8c;if(_0x28f23a>=_0x1c93bb){_0x28f23a=_0x1c93bb;_0x145a8c=0xc8;}else{_0x145a8c=0xce;}_0x5e1514[_0x990e('0x1a')](_0x145a8c);return _0x5e1514['set'](_0x990e('0x1f'),_0xea00d7+'-'+_0x28f23a+'/'+_0x1c93bb)[_0x990e('0x1b')](_0x206457);}return null;};}function patchUpdates(_0x3c2b7c){return function(_0x7f999c){try{jsonpatch[_0x990e('0x20')](_0x7f999c,_0x3c2b7c,!![]);}catch(_0x39c6ca){return BPromise[_0x990e('0x21')](_0x39c6ca);}return _0x7f999c['save']();};}function saveUpdates(_0x4db6b7,_0x21f6a0){return function(_0x389870){if(_0x389870){return _0x389870[_0x990e('0x22')](_0x4db6b7)[_0x990e('0x23')](function(_0x4e13e2){return _0x4e13e2;});}return null;};}function removeEntity(_0x508b13,_0x2687ad){return function(_0x16e849){if(_0x16e849){return _0x16e849[_0x990e('0x24')]()[_0x990e('0x23')](function(){var _0x28eff3=_0x16e849[_0x990e('0x25')]({'plain':!![]});var _0x1af0a4=_0x990e('0x26');return db['UserProfileResource'][_0x990e('0x24')]({'where':{'type':_0x1af0a4,'resourceId':_0x28eff3['id']}})[_0x990e('0x23')](function(){return _0x16e849;});})[_0x990e('0x23')](function(){_0x508b13['status'](0xcc)[_0x990e('0x19')]();});}};}function handleEntityNotFound(_0x1b3e65,_0x3a4d10){return function(_0x4e0d73){if(!_0x4e0d73){_0x1b3e65[_0x990e('0x18')](0x194);}return _0x4e0d73;};}function handleError(_0x440755,_0x5f03ac){_0x5f03ac=_0x5f03ac||0x1f4;return function(_0x16d42a){logger['error'](_0x16d42a['stack']);if(_0x16d42a[_0x990e('0x27')]){delete _0x16d42a['name'];}_0x440755[_0x990e('0x1a')](_0x5f03ac)[_0x990e('0x28')](_0x16d42a);};}exports['index']=function(_0x125074,_0x33a80c){var _0x519fa9={},_0x5403ba={},_0x5cc3c1={'count':0x0,'rows':[]};var _0x3862ac=_['map'](db[_0x990e('0x29')][_0x990e('0x2a')],function(_0x51ecb4){return{'name':_0x51ecb4['fieldName'],'type':_0x51ecb4[_0x990e('0x2b')]['key']};});_0x5403ba['model']=_[_0x990e('0x2c')](_0x3862ac,_0x990e('0x27'));_0x5403ba['query']=_['keys'](_0x125074['query']);_0x5403ba[_0x990e('0x2d')]=_['intersection'](_0x5403ba['model'],_0x5403ba['query']);_0x519fa9[_0x990e('0x2e')]=_['intersection'](_0x5403ba[_0x990e('0x2f')],qs[_0x990e('0x30')](_0x125074[_0x990e('0x31')][_0x990e('0x30')]));_0x519fa9[_0x990e('0x2e')]=_0x519fa9[_0x990e('0x2e')][_0x990e('0x32')]?_0x519fa9[_0x990e('0x2e')]:_0x5403ba[_0x990e('0x2f')];if(!_0x125074[_0x990e('0x31')][_0x990e('0x33')](_0x990e('0x34'))){_0x519fa9[_0x990e('0x35')]=qs[_0x990e('0x35')](_0x125074['query'][_0x990e('0x35')]);_0x519fa9[_0x990e('0x1e')]=qs[_0x990e('0x1e')](_0x125074[_0x990e('0x31')][_0x990e('0x1e')]);}_0x519fa9['order']=qs[_0x990e('0x36')](_0x125074[_0x990e('0x31')][_0x990e('0x36')]);_0x519fa9[_0x990e('0x37')]=qs[_0x990e('0x2d')](_[_0x990e('0x38')](_0x125074[_0x990e('0x31')],_0x5403ba[_0x990e('0x2d')]),_0x3862ac);if(_0x125074[_0x990e('0x31')][_0x990e('0x39')]){_0x519fa9[_0x990e('0x37')]=_[_0x990e('0x3a')](_0x519fa9[_0x990e('0x37')],{'$or':_['map'](_0x3862ac,function(_0x8604f2){if(_0x8604f2[_0x990e('0x2b')]!==_0x990e('0x3b')){var _0x5a581b={};_0x5a581b[_0x8604f2['name']]={'$like':'%'+_0x125074['query']['filter']+'%'};return _0x5a581b;}})});}_0x519fa9=_[_0x990e('0x3a')]({},_0x519fa9,_0x125074['options']);var _0x292e34={'where':_0x519fa9[_0x990e('0x37')]};return db[_0x990e('0x29')][_0x990e('0x1d')](_0x292e34)[_0x990e('0x23')](function(_0x2b6ea8){_0x5cc3c1[_0x990e('0x1d')]=_0x2b6ea8;if(_0x125074['query']['includeAll']){_0x519fa9['include']=[{'all':!![]}];}return db[_0x990e('0x29')][_0x990e('0x3c')](_0x519fa9);})[_0x990e('0x23')](function(_0x4aa668){_0x5cc3c1[_0x990e('0x3d')]=_0x4aa668;return _0x5cc3c1;})[_0x990e('0x23')](respondWithFilteredResult(_0x33a80c,_0x519fa9))[_0x990e('0x3e')](handleError(_0x33a80c,null));};exports[_0x990e('0x3f')]=function(_0x152443,_0x57ac91){var _0x2e2018={'raw':!![],'where':{'id':_0x152443[_0x990e('0x40')]['id']}},_0x3eb030={};_0x3eb030[_0x990e('0x2f')]=_[_0x990e('0x41')](db[_0x990e('0x29')][_0x990e('0x2a')]);_0x3eb030[_0x990e('0x31')]=_['keys'](_0x152443[_0x990e('0x31')]);_0x3eb030['filters']=_[_0x990e('0x42')](_0x3eb030[_0x990e('0x2f')],_0x3eb030['query']);_0x2e2018[_0x990e('0x2e')]=_[_0x990e('0x42')](_0x3eb030['model'],qs[_0x990e('0x30')](_0x152443['query'][_0x990e('0x30')]));_0x2e2018[_0x990e('0x2e')]=_0x2e2018[_0x990e('0x2e')]['length']?_0x2e2018['attributes']:_0x3eb030[_0x990e('0x2f')];if(_0x152443[_0x990e('0x31')][_0x990e('0x43')]){_0x2e2018[_0x990e('0x44')]=[{'all':!![]}];}_0x2e2018=_['merge']({},_0x2e2018,_0x152443[_0x990e('0x45')]);return db[_0x990e('0x29')][_0x990e('0x46')](_0x2e2018)['then'](handleEntityNotFound(_0x57ac91,null))['then'](respondWithResult(_0x57ac91,null))['catch'](handleError(_0x57ac91,null));};exports[_0x990e('0x47')]=function(_0x5a901d,_0x548d9b){return db[_0x990e('0x29')][_0x990e('0x47')](_0x5a901d[_0x990e('0x48')],{})[_0x990e('0x23')](function(_0x48a1a2){var _0x34acf3=_0x5a901d[_0x990e('0x49')][_0x990e('0x25')]({'plain':!![]});if(!_0x34acf3)throw new Error(_0x990e('0x4a'));if(_0x34acf3[_0x990e('0x4b')]==='user'){var _0x1481e2=_0x48a1a2['get']({'plain':!![]});var _0x5534eb=_0x990e('0x26');return db[_0x990e('0x4c')][_0x990e('0x46')]({'where':{'name':_0x5534eb,'userProfileId':_0x34acf3[_0x990e('0x4d')]},'raw':!![]})['then'](function(_0xbaa9a9){if(_0xbaa9a9&&_0xbaa9a9['autoAssociation']===0x0){return db['UserProfileResource'][_0x990e('0x47')]({'name':_0x1481e2[_0x990e('0x27')],'resourceId':_0x1481e2['id'],'type':_0xbaa9a9['name'],'sectionId':_0xbaa9a9['id']},{})[_0x990e('0x23')](function(){return _0x48a1a2;});}else{return _0x48a1a2;}})[_0x990e('0x3e')](function(_0x1131d7){logger['error'](_0x990e('0x4e'),_0x1131d7);throw _0x1131d7;});}return _0x48a1a2;})[_0x990e('0x23')](respondWithResult(_0x548d9b,0xc9))[_0x990e('0x3e')](handleError(_0x548d9b,null));};exports['update']=function(_0x35d5b9,_0x39943e){if(_0x35d5b9[_0x990e('0x48')]['id']){delete _0x35d5b9[_0x990e('0x48')]['id'];}return db['Pause'][_0x990e('0x46')]({'where':{'id':_0x35d5b9[_0x990e('0x40')]['id']}})[_0x990e('0x23')](handleEntityNotFound(_0x39943e,null))[_0x990e('0x23')](saveUpdates(_0x35d5b9[_0x990e('0x48')],null))[_0x990e('0x23')](respondWithResult(_0x39943e,null))[_0x990e('0x3e')](handleError(_0x39943e,null));};exports[_0x990e('0x24')]=function(_0x416370,_0x850a23){return db[_0x990e('0x29')][_0x990e('0x46')]({'where':{'id':_0x416370[_0x990e('0x40')]['id']}})['then'](handleEntityNotFound(_0x850a23,null))[_0x990e('0x23')](removeEntity(_0x850a23,null))[_0x990e('0x3e')](handleError(_0x850a23,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0db87e3..b0f634d 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x593714,_0x4017a4){var _0x4446e2=function(_0x33b98b){while(--_0x33b98b){_0x593714['push'](_0x593714['shift']());}};_0x4446e2(++_0x4017a4);}(_0xe14b,0x93));var _0xbe14=function(_0xb66336,_0x513d65){_0xb66336=_0xb66336-0x0;var _0x253665=_0xe14b[_0xb66336];return _0x253665;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x25b738,_0x5c3de6){var _0x2c1051=function(_0x3f2548){while(--_0x3f2548){_0x25b738['push'](_0x25b738['shift']());}};_0x2c1051(++_0x5c3de6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4a55be,_0x5c0102){_0x4a55be=_0x4a55be-0x0;var _0x13150e=_0x8ef6[_0x4a55be];return _0x13150e;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'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 f19e826..2cd787c 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x251e40,_0xd01438){var _0x1cec34=function(_0x3977b7){while(--_0x3977b7){_0x251e40['push'](_0x251e40['shift']());}};_0x1cec34(++_0xd01438);}(_0x7a54,0x106));var _0x47a5=function(_0x2a8c75,_0x172a29){_0x2a8c75=_0x2a8c75-0x0;var _0xa746d0=_0x7a54[_0x2a8c75];return _0xa746d0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x156c5d,_0x583511){var _0x44c51b=function(_0x525da4){while(--_0x525da4){_0x156c5d['push'](_0x156c5d['shift']());}};_0x44c51b(++_0x583511);}(_0x7a54,0x106));var _0x47a5=function(_0xdf9163,_0x2ed956){_0xdf9163=_0xdf9163-0x0;var _0x61e964=_0x7a54[_0xdf9163];return _0x61e964;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index cd737b3..2d85dcf 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 _0xd0bb=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/webhook','/:id','show','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','webhookPost','put','update','delete','exports','multer','util','path','express','fs-extra'];(function(_0x368f87,_0x53eecb){var _0x4b503e=function(_0x313ce8){while(--_0x313ce8){_0x368f87['push'](_0x368f87['shift']());}};_0x4b503e(++_0x53eecb);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0xd0bb[_0x5c18ef];return _0x33789d;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./plugin.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),controller['webhookGet']);router[_0xbd0b('0x7')](_0xbd0b('0xb'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xc')]);router[_0xbd0b('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xbd0b('0xd')]);var upload=multer({'storage':multer[_0xbd0b('0xe')]({'destination':function(_0x4a69ff,_0x26b834,_0x196beb){_0x196beb(null,path['join'](config[_0xbd0b('0xf')],_0xbd0b('0x10')));},'filename':function(_0x3a4b28,_0x315ed9,_0x2621bf){_0x315ed9[_0xbd0b('0x11')]=_0x315ed9[_0xbd0b('0x11')][_0xbd0b('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2621bf(null,util[_0xbd0b('0x13')](_0xbd0b('0x14'),path[_0xbd0b('0x15')](_0x315ed9['originalname'],path[_0xbd0b('0x16')](_0x315ed9['originalname'])),Date['now'](),path[_0xbd0b('0x16')](_0x315ed9[_0xbd0b('0x11')])));}})});router[_0xbd0b('0x17')]('/',upload[_0xbd0b('0x18')](_0xbd0b('0x19')),controller['upload']);router['post'](_0xbd0b('0xa'),controller[_0xbd0b('0x1a')]);router[_0xbd0b('0x1b')](_0xbd0b('0xb'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x1c')]);router['delete'](_0xbd0b('0xb'),auth['isAuthenticated'](),controller[_0xbd0b('0x1d')]);module[_0xbd0b('0x1e')]=router; \ No newline at end of file +var _0xe13a=['./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','extname','now','single','upload','post','/webhook','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4645a1,_0x4c22eb){var _0x56ba7d=function(_0x16df90){while(--_0x16df90){_0x4645a1['push'](_0x4645a1['shift']());}};_0x56ba7d(++_0x4c22eb);}(_0xe13a,0x178));var _0xae13=function(_0x54e3ff,_0x1f02fd){_0x54e3ff=_0x54e3ff-0x0;var _0x4d9a9b=_0xe13a[_0x54e3ff];return _0x4d9a9b;};'use strict';var multer=require('multer');var util=require(_0xae13('0x0'));var path=require(_0xae13('0x1'));var timeout=require(_0xae13('0x2'));var express=require(_0xae13('0x3'));var router=express['Router']();var fs_extra=require(_0xae13('0x4'));var auth=require(_0xae13('0x5'));var interaction=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var controller=require(_0xae13('0x8'));router[_0xae13('0x9')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0xb')]);router[_0xae13('0x9')]('/webhook',controller[_0xae13('0xc')]);router[_0xae13('0x9')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0xe')]);router[_0xae13('0x9')](_0xae13('0xf'),auth[_0xae13('0xa')](),controller[_0xae13('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x404b0e,_0x83de98,_0x3d6a85){_0x3d6a85(null,path[_0xae13('0x11')](config[_0xae13('0x12')],_0xae13('0x13')));},'filename':function(_0x1505c5,_0x4dd599,_0x42d869){_0x4dd599[_0xae13('0x14')]=_0x4dd599['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42d869(null,util['format']('%s-%s%s',path['basename'](_0x4dd599[_0xae13('0x14')],path[_0xae13('0x15')](_0x4dd599[_0xae13('0x14')])),Date[_0xae13('0x16')](),path[_0xae13('0x15')](_0x4dd599[_0xae13('0x14')])));}})});router['post']('/',upload[_0xae13('0x17')]('file'),controller[_0xae13('0x18')]);router[_0xae13('0x19')](_0xae13('0x1a'),controller[_0xae13('0x1b')]);router[_0xae13('0x1c')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0x1d')]);router[_0xae13('0x1e')]('/:id',auth[_0xae13('0xa')](),controller['delete']);module[_0xae13('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index c6c3146..6517a0d 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 _0x8dbd=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x348ffe,_0x564a7d){var _0x19232c=function(_0x5d274d){while(--_0x5d274d){_0x348ffe['push'](_0x348ffe['shift']());}};_0x19232c(++_0x564a7d);}(_0x8dbd,0x165));var _0xd8db=function(_0x110c4a,_0x1866c8){_0x110c4a=_0x110c4a-0x0;var _0x244bbe=_0x8dbd[_0x110c4a];return _0x244bbe;};'use strict';var Sequelize=require('sequelize');module[_0xd8db('0x0')]={'name':{'type':Sequelize[_0xd8db('0x1')]},'type':{'type':Sequelize[_0xd8db('0x2')](_0xd8db('0x3'),_0xd8db('0x4'))},'description':{'type':Sequelize[_0xd8db('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xd8db('0x1')],'comment':_0xd8db('0x6')},'active':{'type':Sequelize[_0xd8db('0x7')],'defaultValue':0x0,'comment':_0xd8db('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xd8db('0x9'),_0xd8db('0xa'),_0xd8db('0xb'),_0xd8db('0xc')),'defaultValue':_0xd8db('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xd8db('0x1')]},'adminUrl':{'type':Sequelize[_0xd8db('0x1')]},'agentUrl':{'type':Sequelize[_0xd8db('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x83cf=['never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x169e79,_0x2b24ed){var _0x412b82=function(_0x575d3f){while(--_0x575d3f){_0x169e79['push'](_0x169e79['shift']());}};_0x412b82(++_0x2b24ed);}(_0x83cf,0x184));var _0xf83c=function(_0x2d9d42,_0x46bb08){_0x2d9d42=_0x2d9d42-0x0;var _0x325e9f=_0x83cf[_0x2d9d42];return _0x325e9f;};'use strict';var Sequelize=require('sequelize');module[_0xf83c('0x0')]={'name':{'type':Sequelize[_0xf83c('0x1')]},'type':{'type':Sequelize[_0xf83c('0x2')](_0xf83c('0x3'),'script')},'description':{'type':Sequelize[_0xf83c('0x4')]},'version':{'type':Sequelize[_0xf83c('0x4')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf83c('0x5')},'sidebar':{'type':Sequelize[_0xf83c('0x2')](_0xf83c('0x6'),_0xf83c('0x7'),'always',_0xf83c('0x8')),'defaultValue':_0xf83c('0x9'),'comment':_0xf83c('0xa')},'icon':{'type':Sequelize[_0xf83c('0x1')]},'adminUrl':{'type':Sequelize[_0xf83c('0x1')]},'agentUrl':{'type':Sequelize[_0xf83c('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf83c('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index fd1744c..0291e30 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 _0x1f4c=['../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','Plugins','UserProfileResource','then','end','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','find','catch','download','join','root','format','%s.zip','basename','zip','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','server/files/plugins','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f4c,0x98));var _0xc1f4=function(_0x2045f0,_0x15bf12){_0x2045f0=_0x2045f0-0x0;var _0x1d1bbf=_0x1f4c[_0x2045f0];return _0x1d1bbf;};'use strict';var emlformat=require(_0xc1f4('0x0'));var rimraf=require(_0xc1f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1f4('0x2'));var rp=require(_0xc1f4('0x3'));var moment=require(_0xc1f4('0x4'));var BPromise=require(_0xc1f4('0x5'));var Mustache=require(_0xc1f4('0x6'));var util=require(_0xc1f4('0x7'));var path=require(_0xc1f4('0x8'));var sox=require('sox');var csv=require(_0xc1f4('0x9'));var ejs=require(_0xc1f4('0xa'));var fs=require('fs');var fs_extra=require(_0xc1f4('0xb'));var _=require(_0xc1f4('0xc'));var squel=require(_0xc1f4('0xd'));var crypto=require(_0xc1f4('0xe'));var jsforce=require(_0xc1f4('0xf'));var deskjs=require(_0xc1f4('0x10'));var toCsv=require(_0xc1f4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xc1f4('0x11'));var rimraf=require(_0xc1f4('0x1'));var archiver=require(_0xc1f4('0x12'));var Redis=require(_0xc1f4('0x13'));var authService=require(_0xc1f4('0x14'));var qs=require(_0xc1f4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1f4('0x16'));var logger=require(_0xc1f4('0x17'))(_0xc1f4('0x18'));var utils=require(_0xc1f4('0x19'));var config=require(_0xc1f4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc1f4('0x1b')]=_[_0xc1f4('0x1c')](config[_0xc1f4('0x1b')],{'host':_0xc1f4('0x1d'),'port':0x18eb});var socket=require(_0xc1f4('0x1e'))(new Redis(config[_0xc1f4('0x1b')]));require(_0xc1f4('0x1f'))[_0xc1f4('0x20')](socket);function respondWithStatusCode(_0x550a38,_0x4f36db){_0x4f36db=_0x4f36db||0xcc;return function(_0xca3fc5){if(_0xca3fc5){return _0x550a38[_0xc1f4('0x21')](_0x4f36db);}return _0x550a38['status'](_0x4f36db)['end']();};}function respondWithResult(_0x44c0b0,_0x3ce7b3){_0x3ce7b3=_0x3ce7b3||0xc8;return function(_0x2a409b){if(_0x2a409b){return _0x44c0b0[_0xc1f4('0x22')](_0x3ce7b3)[_0xc1f4('0x23')](_0x2a409b);}};}function respondWithFilteredResult(_0x2a84d0,_0x4aa68d){return function(_0xe7124a){if(_0xe7124a){var _0x4f35af=typeof _0x4aa68d['offset']===_0xc1f4('0x24')&&typeof _0x4aa68d[_0xc1f4('0x25')]==='undefined';var _0x46cddb=_0xe7124a[_0xc1f4('0x26')];var _0x38d9c6=_0x4f35af?0x0:_0x4aa68d['offset'];var _0xbfeac9=_0x4f35af?_0xe7124a[_0xc1f4('0x26')]:_0x4aa68d['offset']+_0x4aa68d[_0xc1f4('0x25')];var _0x3bb5e3;if(_0xbfeac9>=_0x46cddb){_0xbfeac9=_0x46cddb;_0x3bb5e3=0xc8;}else{_0x3bb5e3=0xce;}_0x2a84d0[_0xc1f4('0x22')](_0x3bb5e3);return _0x2a84d0['set'](_0xc1f4('0x27'),_0x38d9c6+'-'+_0xbfeac9+'/'+_0x46cddb)[_0xc1f4('0x23')](_0xe7124a);}return null;};}function patchUpdates(_0x139526){return function(_0x56293a){try{jsonpatch[_0xc1f4('0x28')](_0x56293a,_0x139526,!![]);}catch(_0x28df01){return BPromise[_0xc1f4('0x29')](_0x28df01);}return _0x56293a[_0xc1f4('0x2a')]();};}function saveUpdates(_0x3a01b9,_0x283536){return function(_0x490079){if(_0x490079){return _0x490079[_0xc1f4('0x2b')](_0x3a01b9)['then'](function(_0x5206a7){return _0x5206a7;});}return null;};}function removeEntity(_0x1c2da5,_0x213a70){return function(_0x6b94d){if(_0x6b94d){return _0x6b94d[_0xc1f4('0x2c')]()['then'](function(){var _0x293a7f=_0x6b94d['get']({'plain':!![]});var _0x516a7b=_0xc1f4('0x2d');return db[_0xc1f4('0x2e')]['destroy']({'where':{'type':_0x516a7b,'resourceId':_0x293a7f['id']}})[_0xc1f4('0x2f')](function(){return _0x6b94d;});})['then'](function(){_0x1c2da5['status'](0xcc)[_0xc1f4('0x30')]();});}};}function handleEntityNotFound(_0x3f3d20,_0x208854){return function(_0x86703e){if(!_0x86703e){_0x3f3d20[_0xc1f4('0x21')](0x194);}return _0x86703e;};}function handleError(_0x407bb0,_0x3d56ec){_0x3d56ec=_0x3d56ec||0x1f4;return function(_0x4a127e){logger[_0xc1f4('0x31')](_0x4a127e[_0xc1f4('0x32')]);if(_0x4a127e[_0xc1f4('0x33')]){delete _0x4a127e[_0xc1f4('0x33')];}_0x407bb0['status'](_0x3d56ec)['send'](_0x4a127e);};}exports[_0xc1f4('0x34')]=function(_0x5569a0,_0x3c8012){var _0x50fc10={},_0x469dce={},_0x38b7c0={'count':0x0,'rows':[]};var _0x566cc1=_[_0xc1f4('0x35')](db[_0xc1f4('0x36')][_0xc1f4('0x37')],function(_0x546fd1){return{'name':_0x546fd1[_0xc1f4('0x38')],'type':_0x546fd1[_0xc1f4('0x39')][_0xc1f4('0x3a')]};});_0x469dce[_0xc1f4('0x3b')]=_['map'](_0x566cc1,_0xc1f4('0x33'));_0x469dce[_0xc1f4('0x3c')]=_[_0xc1f4('0x3d')](_0x5569a0[_0xc1f4('0x3c')]);_0x469dce[_0xc1f4('0x3e')]=_['intersection'](_0x469dce[_0xc1f4('0x3b')],_0x469dce[_0xc1f4('0x3c')]);_0x50fc10['attributes']=_[_0xc1f4('0x3f')](_0x469dce['model'],qs[_0xc1f4('0x40')](_0x5569a0['query'][_0xc1f4('0x40')]));_0x50fc10[_0xc1f4('0x41')]=_0x50fc10[_0xc1f4('0x41')][_0xc1f4('0x42')]?_0x50fc10[_0xc1f4('0x41')]:_0x469dce[_0xc1f4('0x3b')];if(!_0x5569a0['query'][_0xc1f4('0x43')](_0xc1f4('0x44'))){_0x50fc10['limit']=qs[_0xc1f4('0x25')](_0x5569a0[_0xc1f4('0x3c')][_0xc1f4('0x25')]);_0x50fc10['offset']=qs[_0xc1f4('0x45')](_0x5569a0[_0xc1f4('0x3c')][_0xc1f4('0x45')]);}_0x50fc10[_0xc1f4('0x46')]=qs[_0xc1f4('0x47')](_0x5569a0[_0xc1f4('0x3c')][_0xc1f4('0x47')]);_0x50fc10[_0xc1f4('0x48')]=qs['filters'](_[_0xc1f4('0x49')](_0x5569a0[_0xc1f4('0x3c')],_0x469dce[_0xc1f4('0x3e')]),_0x566cc1);if(_0x5569a0['query']['filter']){_0x50fc10['where']=_[_0xc1f4('0x4a')](_0x50fc10[_0xc1f4('0x48')],{'$or':_[_0xc1f4('0x35')](_0x566cc1,function(_0x56afd7){if(_0x56afd7[_0xc1f4('0x39')]!==_0xc1f4('0x4b')){var _0x488f07={};_0x488f07[_0x56afd7['name']]={'$like':'%'+_0x5569a0['query'][_0xc1f4('0x4c')]+'%'};return _0x488f07;}})});}_0x50fc10=_[_0xc1f4('0x4a')]({},_0x50fc10,_0x5569a0['options']);var _0x313505={'where':_0x50fc10[_0xc1f4('0x48')]};return db[_0xc1f4('0x36')][_0xc1f4('0x26')](_0x313505)[_0xc1f4('0x2f')](function(_0x3b6d3c){_0x38b7c0[_0xc1f4('0x26')]=_0x3b6d3c;if(_0x5569a0[_0xc1f4('0x3c')][_0xc1f4('0x4d')]){_0x50fc10[_0xc1f4('0x4e')]=[{'all':!![]}];}return db[_0xc1f4('0x36')][_0xc1f4('0x4f')](_0x50fc10);})[_0xc1f4('0x2f')](function(_0x266836){_0x38b7c0[_0xc1f4('0x50')]=_0x266836;return _0x38b7c0;})[_0xc1f4('0x2f')](respondWithFilteredResult(_0x3c8012,_0x50fc10))['catch'](handleError(_0x3c8012,null));};exports[_0xc1f4('0x51')]=function(_0x2768a2,_0x5e931e){var _0x900807={'raw':!![],'where':{'id':_0x2768a2[_0xc1f4('0x52')]['id']}},_0x2afecf={};_0x2afecf[_0xc1f4('0x3b')]=_[_0xc1f4('0x3d')](db[_0xc1f4('0x36')][_0xc1f4('0x37')]);_0x2afecf[_0xc1f4('0x3c')]=_[_0xc1f4('0x3d')](_0x2768a2[_0xc1f4('0x3c')]);_0x2afecf[_0xc1f4('0x3e')]=_[_0xc1f4('0x3f')](_0x2afecf[_0xc1f4('0x3b')],_0x2afecf[_0xc1f4('0x3c')]);_0x900807[_0xc1f4('0x41')]=_[_0xc1f4('0x3f')](_0x2afecf[_0xc1f4('0x3b')],qs[_0xc1f4('0x40')](_0x2768a2[_0xc1f4('0x3c')][_0xc1f4('0x40')]));_0x900807[_0xc1f4('0x41')]=_0x900807['attributes']['length']?_0x900807[_0xc1f4('0x41')]:_0x2afecf[_0xc1f4('0x3b')];if(_0x2768a2[_0xc1f4('0x3c')][_0xc1f4('0x4d')]){_0x900807[_0xc1f4('0x4e')]=[{'all':!![]}];}_0x900807=_['merge']({},_0x900807,_0x2768a2['options']);return db['Plugin'][_0xc1f4('0x53')](_0x900807)['then'](handleEntityNotFound(_0x5e931e,null))[_0xc1f4('0x2f')](respondWithResult(_0x5e931e,null))[_0xc1f4('0x54')](handleError(_0x5e931e,null));};exports[_0xc1f4('0x55')]=function(_0x33a64b,_0x39bcbf,_0x3a1eae){return db['Plugin'][_0xc1f4('0x53')]({'where':{'id':_0x33a64b[_0xc1f4('0x52')]['id']},'attributes':[_0xc1f4('0x33'),_0xc1f4('0x8')],'raw':!![]})[_0xc1f4('0x2f')](handleEntityNotFound(_0x39bcbf,null))[_0xc1f4('0x2f')](function(_0xdcf534){if(_0xdcf534){var _0xf2874e=path[_0xc1f4('0x56')](config[_0xc1f4('0x57')],'server/files/plugins',util[_0xc1f4('0x58')](_0xc1f4('0x59'),path[_0xc1f4('0x5a')](_0xdcf534[_0xc1f4('0x8')])));var _0x1a0593=fs['createWriteStream'](_0xf2874e);var _0xfda168=archiver(_0xc1f4('0x5b'),{'zlib':{'level':0x9}});_0xfda168['on'](_0xc1f4('0x5c'),function(_0x101d4a){if(_0x101d4a[_0xc1f4('0x5d')]==='ENOENT'){logger[_0xc1f4('0x31')](_0x101d4a);}else{throw new db['Sequelize'][(_0xc1f4('0x5e'))](_0xc1f4('0x5f'));}});_0xfda168['on'](_0xc1f4('0x31'),function(_0x39c369){throw new db[(_0xc1f4('0x60'))][(_0xc1f4('0x5e'))](_0xc1f4('0x5f'));});_0xfda168[_0xc1f4('0x61')](_0x1a0593);_0xfda168['glob']('**/*',{'cwd':path[_0xc1f4('0x56')](config[_0xc1f4('0x57')],_0xc1f4('0x62'),path[_0xc1f4('0x63')](_0xdcf534[_0xc1f4('0x8')])),'ignore':[path[_0xc1f4('0x56')](path[_0xc1f4('0x5a')](_0xdcf534[_0xc1f4('0x8')]),'node_modules/**/*'),path[_0xc1f4('0x56')](path[_0xc1f4('0x5a')](_0xdcf534[_0xc1f4('0x8')]),_0xc1f4('0x64'))],'nodir':!![]})[_0xc1f4('0x65')]();_0x1a0593['on'](_0xc1f4('0x66'),function(){if(!fs[_0xc1f4('0x67')](_0xf2874e)){throw new db[(_0xc1f4('0x60'))]['Error'](_0xc1f4('0x68'));}return _0x39bcbf[_0xc1f4('0x55')](_0xf2874e,util[_0xc1f4('0x58')](_0xc1f4('0x59'),path[_0xc1f4('0x5a')](_0xdcf534['path'])),function(_0x332e6f){if(_0x332e6f){throw new db[(_0xc1f4('0x60'))][(_0xc1f4('0x5e'))](_0xc1f4('0x69'));}fs[_0xc1f4('0x6a')](_0xf2874e);logger[_0xc1f4('0x6b')](_0xc1f4('0x6c'));logger[_0xc1f4('0x6b')](_0xc1f4('0x6d'));});});}return null;})['catch'](handleError(_0x39bcbf,null));};exports[_0xc1f4('0x6e')]=function(_0x6df9d3,_0x53f88e,_0x11dd0a){var _0x7705a2=path[_0xc1f4('0x5a')](_0x6df9d3[_0xc1f4('0x6f')][_0xc1f4('0x70')],path[_0xc1f4('0x71')](_0x6df9d3[_0xc1f4('0x6f')][_0xc1f4('0x70')]));var _0x572bf5=path['join'](config[_0xc1f4('0x57')],_0xc1f4('0x62'),_0x6df9d3['file'][_0xc1f4('0x70')]);var _0x41513b=path[_0xc1f4('0x56')](config[_0xc1f4('0x57')],'server/files/plugins',_0x7705a2);logger[_0xc1f4('0x6b')](_0xc1f4('0x72'),_0x572bf5);logger[_0xc1f4('0x6b')](_0xc1f4('0x73'),_0x41513b);try{fs[_0xc1f4('0x74')](_0x572bf5,parseInt(_0xc1f4('0x75'),0x8));extract(_0x572bf5,{'dir':_0x41513b},function(_0x190f47){if(_0x190f47){logger[_0xc1f4('0x31')](_0x190f47);handleError(_0x190f47,!![]);};var _0x5cb6d4=fs[_0xc1f4('0x76')](_0x41513b);if(_0x5cb6d4[_0xc1f4('0x42')]>0x1){removeReferences(_0x572bf5,_0x41513b);logger[_0xc1f4('0x31')](_0xc1f4('0x77'));return _0x11dd0a(new Error(_0xc1f4('0x77')));}var _0x23512f=fs[_0xc1f4('0x78')](path[_0xc1f4('0x56')](_0x41513b,_0x5cb6d4[0x0]));if(_0x23512f[_0xc1f4('0x79')]()){removeReferences(_0x572bf5,_0x41513b);logger[_0xc1f4('0x31')](_0xc1f4('0x77'));return _0x11dd0a(new Error(_0xc1f4('0x77')));}if(_0x23512f[_0xc1f4('0x7a')]()){var _0x39a043=fs['readdirSync'](path[_0xc1f4('0x56')](_0x41513b,_0x5cb6d4[0x0]));if(_0x39a043[_0xc1f4('0x42')]===0x0){removeReferences(_0x572bf5,_0x41513b);logger['error'](_0xc1f4('0x77'));return _0x11dd0a(new Error(_0xc1f4('0x77')));}var _0x484a20=_0x39a043['some'](function(_0x3c9313){return _0x3c9313===_0xc1f4('0x7b');});if(!_0x484a20){return _0x11dd0a(new Error(_0xc1f4('0x7c')));}var _0x130909=fs[_0xc1f4('0x7d')](path['join'](_0x41513b,_0x5cb6d4[0x0],_0xc1f4('0x7b')));var _0x5723a6=JSON[_0xc1f4('0x7e')](_0x130909);if('undefined'==typeof _0x5723a6[_0xc1f4('0x33')]){return _0x11dd0a(new Error(_0xc1f4('0x7f')));}if(_0xc1f4('0x24')==typeof _0x5723a6['type']){return _0x11dd0a(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xc1f4('0x24')==typeof _0x5723a6['version']){return _0x11dd0a(new Error(_0xc1f4('0x80')));}if('undefined'==typeof _0x5723a6[_0xc1f4('0x81')]){return _0x11dd0a(new Error(_0xc1f4('0x82')));}if(_0x5723a6[_0xc1f4('0x39')]===_0xc1f4('0x83')){if('undefined'==typeof _0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x84')]){return _0x11dd0a(new Error(_0xc1f4('0x85')));}if(_0xc1f4('0x24')==typeof _0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x84')][_0xc1f4('0x86')]&&_0xc1f4('0x24')==typeof _0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x84')]['agent']){return _0x11dd0a(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5723a6[_0xc1f4('0x39')]===_0xc1f4('0x87')){if('undefined'==typeof _0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x88')]){return _0x11dd0a(new Error(_0xc1f4('0x89')));}if('undefined'==typeof _0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x8a')]){return _0x11dd0a(new Error(_0xc1f4('0x8b')));}}else{return _0x11dd0a(new Error(_0xc1f4('0x8c')));}var _0x596391=_0x5723a6[_0xc1f4('0x33')];var _0x18895b=_0x5723a6[_0xc1f4('0x8d')];var _0x149910=_0x5723a6[_0xc1f4('0x39')];var _0x748b19=_0x5723a6['sidebar']?_0x5723a6[_0xc1f4('0x8e')]:'always';var _0x1ba0e9=_0x5723a6[_0xc1f4('0x8f')]?_0x5723a6[_0xc1f4('0x8f')]:_0xc1f4('0x90');var _0x3440fc='';var _0x25456a='';var _0x2181f4='';var _0x668b89='';var _0x3609c2=_0x5723a6['version'];if(_0x149910==='html'){if('undefined'!=typeof _0x5723a6[_0xc1f4('0x81')]['views']['admin']){var _0x5475dc=_0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x84')][_0xc1f4('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xc1f4('0x91')](_0x5475dc)){_0x3440fc=path[_0xc1f4('0x56')](_0xc1f4('0x92'),_0x7705a2,_0x5cb6d4[0x0],_0x5475dc);}else{_0x3440fc=_0x5475dc;}}else{logger['info'](_0xc1f4('0x93'));}if(_0xc1f4('0x24')!=typeof _0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x84')][_0xc1f4('0x94')]){var _0x46a238=_0x5723a6['parameters'][_0xc1f4('0x84')][_0xc1f4('0x94')];if(!/^(f|ht)tps?:\/\//i[_0xc1f4('0x91')](_0x46a238)){_0x25456a=path[_0xc1f4('0x56')]('plugins',_0x7705a2,_0x5cb6d4[0x0],_0x46a238);}else{_0x25456a=_0x46a238;}}else{logger[_0xc1f4('0x6b')](_0xc1f4('0x95'));}}else if(_0x149910===_0xc1f4('0x87')){_0x2181f4=_0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x88')];_0x668b89=_0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x8a')];if(_0xc1f4('0x24')!=typeof _0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x84')]){if(_0xc1f4('0x24')!=typeof _0x5723a6['parameters'][_0xc1f4('0x84')][_0xc1f4('0x86')]){var _0x5475dc=_0x5723a6['parameters'][_0xc1f4('0x84')][_0xc1f4('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xc1f4('0x91')](_0x5475dc)){_0x3440fc=path[_0xc1f4('0x56')](_0xc1f4('0x92'),_0x7705a2,_0x5cb6d4[0x0],_0x5475dc);}else{_0x3440fc=_0x5475dc;}}if(_0xc1f4('0x24')!=typeof _0x5723a6[_0xc1f4('0x81')][_0xc1f4('0x84')]['agent']){var _0x46a238=_0x5723a6['parameters'][_0xc1f4('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc1f4('0x91')](_0x46a238)){_0x25456a=path[_0xc1f4('0x56')](_0xc1f4('0x92'),_0x7705a2,_0x5cb6d4[0x0],_0x46a238);}else{_0x25456a=_0x46a238;}}}}var _0x42a458={'name':_0x596391,'description':_0x18895b,'path':path[_0xc1f4('0x56')](_0x7705a2,_0x5cb6d4[0x0]),'type':_0x149910,'sidebar':_0x748b19,'icon':_0x1ba0e9,'adminUrl':_0x3440fc,'agentUrl':_0x25456a,'scriptName':_0x2181f4,'scriptPath':_0x668b89,'version':_0x3609c2};removeReferences(_0x572bf5,null);return db['Plugin'][_0xc1f4('0x96')](_0x42a458)[_0xc1f4('0x2f')](function(_0x1915b8){var _0x34640b={'role':_0x6df9d3[_0xc1f4('0x97')]['role'],'userProfileId':_0x6df9d3[_0xc1f4('0x97')][_0xc1f4('0x98')]};if(!_0x34640b)throw new Error(_0xc1f4('0x99'));if(_0x34640b[_0xc1f4('0x9a')]===_0xc1f4('0x9b')){var _0x27b99b=_0x1915b8['get']({'plain':!![]});return db['UserProfileSection'][_0xc1f4('0x53')]({'where':{'name':_0xc1f4('0x2d'),'userProfileId':_0x34640b[_0xc1f4('0x98')]},'raw':!![]})[_0xc1f4('0x2f')](function(_0x384fb4){if(_0x384fb4&&_0x384fb4['autoAssociation']===0x0){return db[_0xc1f4('0x2e')][_0xc1f4('0x96')]({'name':_0x27b99b[_0xc1f4('0x33')],'resourceId':_0x27b99b['id'],'type':_0x384fb4['name'],'sectionId':_0x384fb4['id']},{})[_0xc1f4('0x2f')](function(){return _0x1915b8;});}else{return _0x1915b8;}})[_0xc1f4('0x54')](function(_0x3f60a1){logger['error'](_0xc1f4('0x9c'),_0x3f60a1);throw _0x3f60a1;});}return _0x1915b8;})[_0xc1f4('0x2f')](respondWithResult(_0x53f88e,null))[_0xc1f4('0x54')](handleError(_0x53f88e,null));}});}catch(_0x317d1b){_0x53f88e[_0xc1f4('0x22')](0x1f4)[_0xc1f4('0x9d')](_0x317d1b);}};function removeReferences(_0x5adf97,_0x56b006){try{if(_0x5adf97){fs['unlinkSync'](_0x5adf97);logger[_0xc1f4('0x6b')]('Zip\x20archive\x20removed');}if(_0x56b006){rimraf(_0x56b006,function(){});logger['info'](_0xc1f4('0x9e'));}}catch(_0x168185){logger[_0xc1f4('0x31')](_0x168185);}}exports[_0xc1f4('0x2b')]=function(_0x7eec6d,_0x259117,_0x413c2c){return db[_0xc1f4('0x36')][_0xc1f4('0x53')]({'where':{'id':_0x7eec6d[_0xc1f4('0x52')]['id']}})[_0xc1f4('0x2f')](handleEntityNotFound(_0x259117,null))[_0xc1f4('0x2f')](saveUpdates(_0x7eec6d[_0xc1f4('0x97')],null))['then'](respondWithResult(_0x259117,null))[_0xc1f4('0x54')](handleError(_0x259117,null));};exports[_0xc1f4('0x9f')]=function(_0x376f8d,_0x324626,_0x439070){return db[_0xc1f4('0x36')][_0xc1f4('0x53')]({'where':{'id':_0x376f8d[_0xc1f4('0x52')]['id']}})[_0xc1f4('0x2f')](function(_0x5f2911){if(_0x5f2911){return _0x5f2911[_0xc1f4('0x2c')]();}})['then'](function(_0x252f73){rimraf(path[_0xc1f4('0x56')](config['root'],'server/files/plugins',path[_0xc1f4('0x63')](_0x252f73[_0xc1f4('0x8')])),function(){});return _0x252f73;})[_0xc1f4('0x2f')](handleEntityNotFound(_0x324626,null))[_0xc1f4('0x2f')](respondWithStatusCode(_0x324626,null))[_0xc1f4('0x54')](handleError(_0x324626,null));};exports[_0xc1f4('0xa0')]=function(_0xc4d120,_0x49f985,_0xec71d9){return BPromise[_0xc1f4('0xa1')]()[_0xc1f4('0x2f')](function(){if(!_0xc4d120['query'][_0xc1f4('0x8')]){throw new Error(_0xc1f4('0xa2'));}if(!_0xc4d120[_0xc1f4('0x3c')][_0xc1f4('0xa3')]){throw new Error(_0xc1f4('0xa4'));}var _0xc0c59b=_0xc4d120[_0xc1f4('0x3c')][_0xc1f4('0xa5')]?_0xc4d120[_0xc1f4('0x3c')][_0xc1f4('0xa5')]+':'+_0xc4d120['query'][_0xc1f4('0xa3')]:_0xc1f4('0xa6')+_0xc4d120['query'][_0xc1f4('0xa3')];var _0x50b788=_0xc4d120[_0xc1f4('0x3c')][_0xc1f4('0x23')]?_0xc4d120[_0xc1f4('0x3c')][_0xc1f4('0x23')]:!![];var _0x1c52ee=_0xc4d120[_0xc1f4('0x3c')][_0xc1f4('0xa7')]?_0xc4d120[_0xc1f4('0x3c')][_0xc1f4('0xa7')]:null;var _0x1ac4ff={'method':_0xc4d120[_0xc1f4('0xa8')],'uri':util[_0xc1f4('0x58')](_0xc1f4('0xa9'),_0xc0c59b,_0xc4d120['query']['path']),'json':_0x50b788,'resolveWithFullResponse':!![],'encoding':_0x1c52ee,'qs':_0xc4d120[_0xc1f4('0x3c')]};if(_0xc4d120[_0xc1f4('0xaa')]){_0x1ac4ff[_0xc1f4('0xaa')]=_0xc4d120[_0xc1f4('0xaa')];if(_0x1ac4ff[_0xc1f4('0xaa')][_0xc1f4('0xab')]){delete _0x1ac4ff[_0xc1f4('0xaa')][_0xc1f4('0xab')];}}if(_0x1ac4ff[_0xc1f4('0xaa')][_0xc1f4('0xac')]){delete _0x1ac4ff[_0xc1f4('0xaa')][_0xc1f4('0xac')];}return rp(_0x1ac4ff);})[_0xc1f4('0x2f')](function(_0x2eab67){if(_0x2eab67){_0x49f985[_0xc1f4('0xad')](_0x2eab67[_0xc1f4('0xaa')]);logger[_0xc1f4('0x6b')](_0x2eab67[_0xc1f4('0x97')]);if(_[_0xc1f4('0xae')](_0xc4d120['query'][_0xc1f4('0x8')],_0xc1f4('0x55'))&&_0x2eab67[_0xc1f4('0xaf')]==0x1f4){return _0x49f985['sendStatus'](_0x2eab67[_0xc1f4('0xaf')]);}else{return _0x49f985['status'](_0x2eab67['statusCode'])['send'](_0x2eab67['body']);}}else{return _0x49f985[_0xc1f4('0x21')](0xc8);}})[_0xc1f4('0x54')](handleError(_0x49f985,null));};exports[_0xc1f4('0xb0')]=function(_0x36be69,_0xb2e69f,_0x3c4349){return BPromise['resolve']()['then'](function(){if(!_0x36be69[_0xc1f4('0x3c')][_0xc1f4('0x8')]){throw new Error(_0xc1f4('0xa2'));}if(!_0x36be69[_0xc1f4('0x3c')][_0xc1f4('0xa3')]){throw new Error(_0xc1f4('0xa4'));}var _0xfad7fb=_0x36be69[_0xc1f4('0x3c')][_0xc1f4('0xa5')]?_0x36be69[_0xc1f4('0x3c')][_0xc1f4('0xa5')]+':'+_0x36be69[_0xc1f4('0x3c')]['port']:_0xc1f4('0xa6')+_0x36be69['query'][_0xc1f4('0xa3')];var _0x588a07=_0x36be69[_0xc1f4('0x3c')][_0xc1f4('0x23')]?_0x36be69[_0xc1f4('0x3c')][_0xc1f4('0x23')]:!![];var _0x41eab5=_0x36be69['query'][_0xc1f4('0xa7')]?_0x36be69[_0xc1f4('0x3c')][_0xc1f4('0xa7')]:null;var _0x564b7c={'method':_0x36be69['method'],'uri':util[_0xc1f4('0x58')](_0xc1f4('0xa9'),_0xfad7fb,_0x36be69['query'][_0xc1f4('0x8')]),'json':_0x588a07,'resolveWithFullResponse':!![],'encoding':_0x41eab5,'body':_0x36be69[_0xc1f4('0x97')]};if(_0x36be69[_0xc1f4('0xaa')]){_0x564b7c[_0xc1f4('0xaa')]=_0x36be69[_0xc1f4('0xaa')];if(_0x564b7c[_0xc1f4('0xaa')][_0xc1f4('0xab')]){delete _0x564b7c[_0xc1f4('0xaa')][_0xc1f4('0xab')];}}if(_0x564b7c[_0xc1f4('0xaa')]['content-type']){delete _0x564b7c['headers']['content-type'];}return rp(_0x564b7c);})[_0xc1f4('0x2f')](function(_0x10ba76){if(_0x10ba76){_0xb2e69f['set'](_0x10ba76[_0xc1f4('0xaa')]);logger[_0xc1f4('0x6b')](_0x10ba76[_0xc1f4('0x97')]);return _0xb2e69f[_0xc1f4('0x22')](_0x10ba76[_0xc1f4('0xaf')])[_0xc1f4('0x9d')](_0x10ba76['body']);}else{return _0xb2e69f['sendStatus'](0xc8);}})['catch'](handleError(_0xb2e69f,null));}; \ No newline at end of file +var _0x2978=['pick','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','rawAttributes','include','download','find','join','format','%s.zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','glob','root','server/files/plugins','dirname','basename','node_modules/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','script','Invalid\x20manifest:\x20script\x20name\x20missing','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','agent','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','method','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','archiver','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','./plugin.socket','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','end','sendStatus','stack','name','send','index','map','Plugin','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x41528d,_0x1b446f){var _0x5778d1=function(_0x123ce8){while(--_0x123ce8){_0x41528d['push'](_0x41528d['shift']());}};_0x5778d1(++_0x1b446f);}(_0x2978,0x10c));var _0x8297=function(_0x54fb0d,_0x2ae314){_0x54fb0d=_0x54fb0d-0x0;var _0x593b0a=_0x2978[_0x54fb0d];return _0x593b0a;};'use strict';var emlformat=require(_0x8297('0x0'));var rimraf=require(_0x8297('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8297('0x2'));var moment=require(_0x8297('0x3'));var BPromise=require(_0x8297('0x4'));var Mustache=require(_0x8297('0x5'));var util=require(_0x8297('0x6'));var path=require(_0x8297('0x7'));var sox=require(_0x8297('0x8'));var csv=require(_0x8297('0x9'));var ejs=require(_0x8297('0xa'));var fs=require('fs');var fs_extra=require(_0x8297('0xb'));var _=require('lodash');var squel=require(_0x8297('0xc'));var crypto=require('crypto');var jsforce=require(_0x8297('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8297('0x9'));var querystring=require(_0x8297('0xe'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x8297('0x1'));var archiver=require(_0x8297('0xf'));var Redis=require(_0x8297('0x10'));var authService=require(_0x8297('0x11'));var qs=require(_0x8297('0x12'));var as=require(_0x8297('0x13'));var hardwareService=require(_0x8297('0x14'));var logger=require(_0x8297('0x15'))(_0x8297('0x16'));var utils=require(_0x8297('0x17'));var config=require(_0x8297('0x18'));var licenseUtil=require(_0x8297('0x19'));var db=require(_0x8297('0x1a'))['db'];config[_0x8297('0x1b')]=_[_0x8297('0x1c')](config[_0x8297('0x1b')],{'host':_0x8297('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8297('0x1b')]));require(_0x8297('0x1e'))['register'](socket);function respondWithStatusCode(_0xa20f35,_0x576011){_0x576011=_0x576011||0xcc;return function(_0x263217){if(_0x263217){return _0xa20f35['sendStatus'](_0x576011);}return _0xa20f35[_0x8297('0x1f')](_0x576011)['end']();};}function respondWithResult(_0x280aed,_0x4926a7){_0x4926a7=_0x4926a7||0xc8;return function(_0x414116){if(_0x414116){return _0x280aed[_0x8297('0x1f')](_0x4926a7)[_0x8297('0x20')](_0x414116);}};}function respondWithFilteredResult(_0x517931,_0x590d6c){return function(_0x29bb81){if(_0x29bb81){var _0x10eadd=typeof _0x590d6c[_0x8297('0x21')]===_0x8297('0x22')&&typeof _0x590d6c['limit']==='undefined';var _0x322fe4=_0x29bb81[_0x8297('0x23')];var _0x24abaf=_0x10eadd?0x0:_0x590d6c[_0x8297('0x21')];var _0x4dd7cc=_0x10eadd?_0x29bb81[_0x8297('0x23')]:_0x590d6c[_0x8297('0x21')]+_0x590d6c[_0x8297('0x24')];var _0x752202;if(_0x4dd7cc>=_0x322fe4){_0x4dd7cc=_0x322fe4;_0x752202=0xc8;}else{_0x752202=0xce;}_0x517931[_0x8297('0x1f')](_0x752202);return _0x517931[_0x8297('0x25')](_0x8297('0x26'),_0x24abaf+'-'+_0x4dd7cc+'/'+_0x322fe4)[_0x8297('0x20')](_0x29bb81);}return null;};}function patchUpdates(_0x288077){return function(_0x19f97d){try{jsonpatch['apply'](_0x19f97d,_0x288077,!![]);}catch(_0x65da8d){return BPromise[_0x8297('0x27')](_0x65da8d);}return _0x19f97d['save']();};}function saveUpdates(_0x218fb5,_0x5855c4){return function(_0x41e89e){if(_0x41e89e){return _0x41e89e[_0x8297('0x28')](_0x218fb5)[_0x8297('0x29')](function(_0x361b6f){return _0x361b6f;});}return null;};}function removeEntity(_0xe4bc94,_0x368a3f){return function(_0x1a0c74){if(_0x1a0c74){return _0x1a0c74['destroy']()[_0x8297('0x29')](function(){var _0x2a03c1=_0x1a0c74['get']({'plain':!![]});var _0x45d14f='Plugins';return db['UserProfileResource'][_0x8297('0x2a')]({'where':{'type':_0x45d14f,'resourceId':_0x2a03c1['id']}})[_0x8297('0x29')](function(){return _0x1a0c74;});})['then'](function(){_0xe4bc94[_0x8297('0x1f')](0xcc)[_0x8297('0x2b')]();});}};}function handleEntityNotFound(_0xdeb0d1,_0x6390a0){return function(_0x415f1b){if(!_0x415f1b){_0xdeb0d1[_0x8297('0x2c')](0x194);}return _0x415f1b;};}function handleError(_0xa14f3,_0x3451f9){_0x3451f9=_0x3451f9||0x1f4;return function(_0xf28c1b){logger['error'](_0xf28c1b[_0x8297('0x2d')]);if(_0xf28c1b['name']){delete _0xf28c1b[_0x8297('0x2e')];}_0xa14f3[_0x8297('0x1f')](_0x3451f9)[_0x8297('0x2f')](_0xf28c1b);};}exports[_0x8297('0x30')]=function(_0x580f36,_0x2a94de){var _0x3ef77f={},_0x5b7f01={},_0x11d7e3={'count':0x0,'rows':[]};var _0x1898e4=_[_0x8297('0x31')](db[_0x8297('0x32')]['rawAttributes'],function(_0x4851d0){return{'name':_0x4851d0[_0x8297('0x33')],'type':_0x4851d0[_0x8297('0x34')][_0x8297('0x35')]};});_0x5b7f01[_0x8297('0x36')]=_[_0x8297('0x31')](_0x1898e4,_0x8297('0x2e'));_0x5b7f01[_0x8297('0x37')]=_['keys'](_0x580f36[_0x8297('0x37')]);_0x5b7f01[_0x8297('0x38')]=_[_0x8297('0x39')](_0x5b7f01[_0x8297('0x36')],_0x5b7f01[_0x8297('0x37')]);_0x3ef77f[_0x8297('0x3a')]=_[_0x8297('0x39')](_0x5b7f01['model'],qs['fields'](_0x580f36['query'][_0x8297('0x3b')]));_0x3ef77f[_0x8297('0x3a')]=_0x3ef77f[_0x8297('0x3a')][_0x8297('0x3c')]?_0x3ef77f[_0x8297('0x3a')]:_0x5b7f01[_0x8297('0x36')];if(!_0x580f36[_0x8297('0x37')][_0x8297('0x3d')](_0x8297('0x3e'))){_0x3ef77f[_0x8297('0x24')]=qs[_0x8297('0x24')](_0x580f36[_0x8297('0x37')][_0x8297('0x24')]);_0x3ef77f[_0x8297('0x21')]=qs[_0x8297('0x21')](_0x580f36[_0x8297('0x37')][_0x8297('0x21')]);}_0x3ef77f[_0x8297('0x3f')]=qs[_0x8297('0x40')](_0x580f36['query']['sort']);_0x3ef77f[_0x8297('0x41')]=qs['filters'](_[_0x8297('0x42')](_0x580f36[_0x8297('0x37')],_0x5b7f01[_0x8297('0x38')]),_0x1898e4);if(_0x580f36[_0x8297('0x37')]['filter']){_0x3ef77f['where']=_[_0x8297('0x43')](_0x3ef77f['where'],{'$or':_[_0x8297('0x31')](_0x1898e4,function(_0x2d66e8){if(_0x2d66e8['type']!==_0x8297('0x44')){var _0x229c44={};_0x229c44[_0x2d66e8['name']]={'$like':'%'+_0x580f36[_0x8297('0x37')]['filter']+'%'};return _0x229c44;}})});}_0x3ef77f=_['merge']({},_0x3ef77f,_0x580f36[_0x8297('0x45')]);var _0x223184={'where':_0x3ef77f[_0x8297('0x41')]};return db['Plugin'][_0x8297('0x23')](_0x223184)[_0x8297('0x29')](function(_0x5901df){_0x11d7e3[_0x8297('0x23')]=_0x5901df;if(_0x580f36[_0x8297('0x37')][_0x8297('0x46')]){_0x3ef77f['include']=[{'all':!![]}];}return db['Plugin'][_0x8297('0x47')](_0x3ef77f);})[_0x8297('0x29')](function(_0x4082e0){_0x11d7e3['rows']=_0x4082e0;return _0x11d7e3;})[_0x8297('0x29')](respondWithFilteredResult(_0x2a94de,_0x3ef77f))[_0x8297('0x48')](handleError(_0x2a94de,null));};exports[_0x8297('0x49')]=function(_0x1e70f7,_0x53f60a){var _0x4595fb={'raw':!![],'where':{'id':_0x1e70f7[_0x8297('0x4a')]['id']}},_0x22f5ce={};_0x22f5ce['model']=_[_0x8297('0x4b')](db[_0x8297('0x32')][_0x8297('0x4c')]);_0x22f5ce[_0x8297('0x37')]=_[_0x8297('0x4b')](_0x1e70f7[_0x8297('0x37')]);_0x22f5ce[_0x8297('0x38')]=_[_0x8297('0x39')](_0x22f5ce[_0x8297('0x36')],_0x22f5ce[_0x8297('0x37')]);_0x4595fb[_0x8297('0x3a')]=_[_0x8297('0x39')](_0x22f5ce[_0x8297('0x36')],qs[_0x8297('0x3b')](_0x1e70f7[_0x8297('0x37')][_0x8297('0x3b')]));_0x4595fb[_0x8297('0x3a')]=_0x4595fb[_0x8297('0x3a')][_0x8297('0x3c')]?_0x4595fb[_0x8297('0x3a')]:_0x22f5ce[_0x8297('0x36')];if(_0x1e70f7['query'][_0x8297('0x46')]){_0x4595fb[_0x8297('0x4d')]=[{'all':!![]}];}_0x4595fb=_['merge']({},_0x4595fb,_0x1e70f7[_0x8297('0x45')]);return db[_0x8297('0x32')]['find'](_0x4595fb)[_0x8297('0x29')](handleEntityNotFound(_0x53f60a,null))[_0x8297('0x29')](respondWithResult(_0x53f60a,null))['catch'](handleError(_0x53f60a,null));};exports[_0x8297('0x4e')]=function(_0x454426,_0x450326,_0x29c354){return db[_0x8297('0x32')][_0x8297('0x4f')]({'where':{'id':_0x454426[_0x8297('0x4a')]['id']},'attributes':['name',_0x8297('0x7')],'raw':!![]})[_0x8297('0x29')](handleEntityNotFound(_0x450326,null))[_0x8297('0x29')](function(_0x2fa06a){if(_0x2fa06a){var _0x3653be=path[_0x8297('0x50')](config['root'],'server/files/plugins',util[_0x8297('0x51')](_0x8297('0x52'),path['basename'](_0x2fa06a[_0x8297('0x7')])));var _0x3d77bb=fs['createWriteStream'](_0x3653be);var _0x33338e=archiver('zip',{'zlib':{'level':0x9}});_0x33338e['on']('warning',function(_0x21145a){if(_0x21145a[_0x8297('0x53')]==='ENOENT'){logger['error'](_0x21145a);}else{throw new db[(_0x8297('0x54'))][(_0x8297('0x55'))](_0x8297('0x56'));}});_0x33338e['on'](_0x8297('0x57'),function(_0x33f6e6){throw new db[(_0x8297('0x54'))][(_0x8297('0x55'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x33338e['pipe'](_0x3d77bb);_0x33338e[_0x8297('0x58')]('**/*',{'cwd':path[_0x8297('0x50')](config[_0x8297('0x59')],_0x8297('0x5a'),path[_0x8297('0x5b')](_0x2fa06a[_0x8297('0x7')])),'ignore':[path['join'](path[_0x8297('0x5c')](_0x2fa06a[_0x8297('0x7')]),_0x8297('0x5d')),path[_0x8297('0x50')](path['basename'](_0x2fa06a[_0x8297('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x3d77bb['on'](_0x8297('0x5e'),function(){if(!fs[_0x8297('0x5f')](_0x3653be)){throw new db[(_0x8297('0x54'))][(_0x8297('0x55'))](_0x8297('0x60'));}return _0x450326[_0x8297('0x4e')](_0x3653be,util[_0x8297('0x51')](_0x8297('0x52'),path[_0x8297('0x5c')](_0x2fa06a[_0x8297('0x7')])),function(_0x373c5a){if(_0x373c5a){throw new db[(_0x8297('0x54'))]['Error'](_0x8297('0x61'));}fs['unlinkSync'](_0x3653be);logger[_0x8297('0x62')](_0x8297('0x63'));logger['info'](_0x8297('0x64'));});});}return null;})[_0x8297('0x48')](handleError(_0x450326,null));};exports[_0x8297('0x65')]=function(_0x256a6d,_0xb39d3f,_0x3432da){var _0xafeae=path[_0x8297('0x5c')](_0x256a6d['file']['filename'],path[_0x8297('0x66')](_0x256a6d[_0x8297('0x67')][_0x8297('0x68')]));var _0x35d867=path[_0x8297('0x50')](config[_0x8297('0x59')],'server/files/plugins',_0x256a6d[_0x8297('0x67')]['filename']);var _0x9f1a7f=path[_0x8297('0x50')](config[_0x8297('0x59')],'server/files/plugins',_0xafeae);logger[_0x8297('0x62')](_0x8297('0x69'),_0x35d867);logger[_0x8297('0x62')](_0x8297('0x6a'),_0x9f1a7f);try{fs[_0x8297('0x6b')](_0x35d867,parseInt(_0x8297('0x6c'),0x8));extract(_0x35d867,{'dir':_0x9f1a7f},function(_0x2a5124){if(_0x2a5124){logger['error'](_0x2a5124);handleError(_0x2a5124,!![]);};var _0x175f02=fs[_0x8297('0x6d')](_0x9f1a7f);if(_0x175f02['length']>0x1){removeReferences(_0x35d867,_0x9f1a7f);logger[_0x8297('0x57')](_0x8297('0x6e'));return _0x3432da(new Error(_0x8297('0x6e')));}var _0xcfe71d=fs[_0x8297('0x6f')](path['join'](_0x9f1a7f,_0x175f02[0x0]));if(_0xcfe71d[_0x8297('0x70')]()){removeReferences(_0x35d867,_0x9f1a7f);logger[_0x8297('0x57')](_0x8297('0x6e'));return _0x3432da(new Error(_0x8297('0x6e')));}if(_0xcfe71d[_0x8297('0x71')]()){var _0x1dcf44=fs['readdirSync'](path[_0x8297('0x50')](_0x9f1a7f,_0x175f02[0x0]));if(_0x1dcf44['length']===0x0){removeReferences(_0x35d867,_0x9f1a7f);logger[_0x8297('0x57')](_0x8297('0x6e'));return _0x3432da(new Error('Invalid\x20plugin\x20structure'));}var _0x12a34e=_0x1dcf44[_0x8297('0x72')](function(_0x3e04c2){return _0x3e04c2==='manifest.json';});if(!_0x12a34e){return _0x3432da(new Error(_0x8297('0x73')));}var _0x3b7231=fs[_0x8297('0x74')](path[_0x8297('0x50')](_0x9f1a7f,_0x175f02[0x0],_0x8297('0x75')));var _0x45d073=JSON[_0x8297('0x76')](_0x3b7231);if(_0x8297('0x22')==typeof _0x45d073['name']){return _0x3432da(new Error(_0x8297('0x77')));}if(_0x8297('0x22')==typeof _0x45d073['type']){return _0x3432da(new Error(_0x8297('0x78')));}if(_0x8297('0x22')==typeof _0x45d073[_0x8297('0x79')]){return _0x3432da(new Error(_0x8297('0x7a')));}if(_0x8297('0x22')==typeof _0x45d073[_0x8297('0x7b')]){return _0x3432da(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x45d073[_0x8297('0x34')]==='html'){if(_0x8297('0x22')==typeof _0x45d073['parameters']['views']){return _0x3432da(new Error(_0x8297('0x7c')));}if('undefined'==typeof _0x45d073['parameters'][_0x8297('0x7d')][_0x8297('0x7e')]&&_0x8297('0x22')==typeof _0x45d073[_0x8297('0x7b')][_0x8297('0x7d')]['agent']){return _0x3432da(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x45d073['type']===_0x8297('0x7f')){if(_0x8297('0x22')==typeof _0x45d073[_0x8297('0x7b')]['scriptName']){return _0x3432da(new Error(_0x8297('0x80')));}if(_0x8297('0x22')==typeof _0x45d073[_0x8297('0x7b')]['scriptPath']){return _0x3432da(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x3432da(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x169e49=_0x45d073['name'];var _0x14761b=_0x45d073['description'];var _0x2e9e79=_0x45d073[_0x8297('0x34')];var _0x2c89ac=_0x45d073[_0x8297('0x81')]?_0x45d073[_0x8297('0x81')]:_0x8297('0x82');var _0x134fdd=_0x45d073['icon']?_0x45d073[_0x8297('0x83')]:_0x8297('0x84');var _0x8d52da='';var _0x3dc551='';var _0x550562='';var _0x332e09='';var _0xb39074=_0x45d073['version'];if(_0x2e9e79===_0x8297('0x85')){if(_0x8297('0x22')!=typeof _0x45d073['parameters']['views'][_0x8297('0x7e')]){var _0x4f3ff1=_0x45d073[_0x8297('0x7b')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x8297('0x86')](_0x4f3ff1)){_0x8d52da=path[_0x8297('0x50')](_0x8297('0x87'),_0xafeae,_0x175f02[0x0],_0x4f3ff1);}else{_0x8d52da=_0x4f3ff1;}}else{logger[_0x8297('0x62')](_0x8297('0x88'));}if('undefined'!=typeof _0x45d073['parameters']['views']['agent']){var _0x1950f2=_0x45d073[_0x8297('0x7b')][_0x8297('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1950f2)){_0x3dc551=path['join']('plugins',_0xafeae,_0x175f02[0x0],_0x1950f2);}else{_0x3dc551=_0x1950f2;}}else{logger[_0x8297('0x62')](_0x8297('0x89'));}}else if(_0x2e9e79===_0x8297('0x7f')){_0x550562=_0x45d073[_0x8297('0x7b')]['scriptName'];_0x332e09=_0x45d073[_0x8297('0x7b')]['scriptPath'];if('undefined'!=typeof _0x45d073[_0x8297('0x7b')][_0x8297('0x7d')]){if(_0x8297('0x22')!=typeof _0x45d073[_0x8297('0x7b')][_0x8297('0x7d')]['admin']){var _0x4f3ff1=_0x45d073['parameters'][_0x8297('0x7d')][_0x8297('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x8297('0x86')](_0x4f3ff1)){_0x8d52da=path[_0x8297('0x50')](_0x8297('0x87'),_0xafeae,_0x175f02[0x0],_0x4f3ff1);}else{_0x8d52da=_0x4f3ff1;}}if(_0x8297('0x22')!=typeof _0x45d073[_0x8297('0x7b')][_0x8297('0x7d')][_0x8297('0x8a')]){var _0x1950f2=_0x45d073[_0x8297('0x7b')][_0x8297('0x7d')][_0x8297('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1950f2)){_0x3dc551=path[_0x8297('0x50')](_0x8297('0x87'),_0xafeae,_0x175f02[0x0],_0x1950f2);}else{_0x3dc551=_0x1950f2;}}}}var _0x4428a9={'name':_0x169e49,'description':_0x14761b,'path':path[_0x8297('0x50')](_0xafeae,_0x175f02[0x0]),'type':_0x2e9e79,'sidebar':_0x2c89ac,'icon':_0x134fdd,'adminUrl':_0x8d52da,'agentUrl':_0x3dc551,'scriptName':_0x550562,'scriptPath':_0x332e09,'version':_0xb39074};removeReferences(_0x35d867,null);return db[_0x8297('0x32')][_0x8297('0x8b')](_0x4428a9)[_0x8297('0x29')](function(_0x321a42){var _0x4453ab={'role':_0x256a6d[_0x8297('0x8c')][_0x8297('0x8d')],'userProfileId':_0x256a6d[_0x8297('0x8c')][_0x8297('0x8e')]};if(!_0x4453ab)throw new Error(_0x8297('0x8f'));if(_0x4453ab[_0x8297('0x8d')]===_0x8297('0x90')){var _0xc86174=_0x321a42[_0x8297('0x91')]({'plain':!![]});return db[_0x8297('0x92')][_0x8297('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x4453ab[_0x8297('0x8e')]},'raw':!![]})[_0x8297('0x29')](function(_0xea26eb){if(_0xea26eb&&_0xea26eb['autoAssociation']===0x0){return db['UserProfileResource'][_0x8297('0x8b')]({'name':_0xc86174[_0x8297('0x2e')],'resourceId':_0xc86174['id'],'type':_0xea26eb['name'],'sectionId':_0xea26eb['id']},{})['then'](function(){return _0x321a42;});}else{return _0x321a42;}})[_0x8297('0x48')](function(_0x2429bf){logger[_0x8297('0x57')](_0x8297('0x93'),_0x2429bf);throw _0x2429bf;});}return _0x321a42;})['then'](respondWithResult(_0xb39d3f,null))[_0x8297('0x48')](handleError(_0xb39d3f,null));}});}catch(_0x53acd9){_0xb39d3f['status'](0x1f4)[_0x8297('0x2f')](_0x53acd9);}};function removeReferences(_0x3ee9f6,_0x5ab867){try{if(_0x3ee9f6){fs[_0x8297('0x94')](_0x3ee9f6);logger[_0x8297('0x62')](_0x8297('0x95'));}if(_0x5ab867){rimraf(_0x5ab867,function(){});logger['info'](_0x8297('0x96'));}}catch(_0x1dc0e7){logger[_0x8297('0x57')](_0x1dc0e7);}}exports[_0x8297('0x28')]=function(_0x3c180f,_0x55ced2,_0x3a234d){return db['Plugin'][_0x8297('0x4f')]({'where':{'id':_0x3c180f[_0x8297('0x4a')]['id']}})[_0x8297('0x29')](handleEntityNotFound(_0x55ced2,null))[_0x8297('0x29')](saveUpdates(_0x3c180f[_0x8297('0x8c')],null))[_0x8297('0x29')](respondWithResult(_0x55ced2,null))['catch'](handleError(_0x55ced2,null));};exports[_0x8297('0x97')]=function(_0x2394b2,_0x1016b2,_0x3f5f62){return db['Plugin']['find']({'where':{'id':_0x2394b2['params']['id']}})['then'](function(_0x5a650d){if(_0x5a650d){return _0x5a650d['destroy']();}})['then'](function(_0x1f230d){rimraf(path[_0x8297('0x50')](config[_0x8297('0x59')],'server/files/plugins',path[_0x8297('0x5b')](_0x1f230d[_0x8297('0x7')])),function(){});return _0x1f230d;})[_0x8297('0x29')](handleEntityNotFound(_0x1016b2,null))['then'](respondWithStatusCode(_0x1016b2,null))['catch'](handleError(_0x1016b2,null));};exports[_0x8297('0x98')]=function(_0xd87a82,_0x465389,_0x430c69){return BPromise[_0x8297('0x99')]()[_0x8297('0x29')](function(){if(!_0xd87a82[_0x8297('0x37')][_0x8297('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xd87a82[_0x8297('0x37')][_0x8297('0x9a')]){throw new Error(_0x8297('0x9b'));}var _0x54bbc5=_0xd87a82['query'][_0x8297('0x9c')]?_0xd87a82['query'][_0x8297('0x9c')]+':'+_0xd87a82[_0x8297('0x37')]['port']:_0x8297('0x9d')+_0xd87a82[_0x8297('0x37')][_0x8297('0x9a')];var _0x2b91d6=_0xd87a82[_0x8297('0x37')][_0x8297('0x20')]?_0xd87a82[_0x8297('0x37')][_0x8297('0x20')]:!![];var _0x3debb4=_0xd87a82[_0x8297('0x37')][_0x8297('0x9e')]?_0xd87a82[_0x8297('0x37')][_0x8297('0x9e')]:null;var _0x4b1c7b={'method':_0xd87a82['method'],'uri':util[_0x8297('0x51')](_0x8297('0x9f'),_0x54bbc5,_0xd87a82[_0x8297('0x37')][_0x8297('0x7')]),'json':_0x2b91d6,'resolveWithFullResponse':!![],'encoding':_0x3debb4,'qs':_0xd87a82[_0x8297('0x37')]};if(_0xd87a82['headers']){_0x4b1c7b[_0x8297('0xa0')]=_0xd87a82['headers'];if(_0x4b1c7b[_0x8297('0xa0')][_0x8297('0xa1')]){delete _0x4b1c7b['headers']['content-length'];}}if(_0x4b1c7b['headers'][_0x8297('0xa2')]){delete _0x4b1c7b[_0x8297('0xa0')][_0x8297('0xa2')];}return rp(_0x4b1c7b);})[_0x8297('0x29')](function(_0xb20287){if(_0xb20287){_0x465389[_0x8297('0x25')](_0xb20287[_0x8297('0xa0')]);logger[_0x8297('0x62')](_0xb20287[_0x8297('0x8c')]);if(_[_0x8297('0xa3')](_0xd87a82[_0x8297('0x37')][_0x8297('0x7')],_0x8297('0x4e'))&&_0xb20287[_0x8297('0xa4')]==0x1f4){return _0x465389[_0x8297('0x2c')](_0xb20287[_0x8297('0xa4')]);}else{return _0x465389['status'](_0xb20287['statusCode'])[_0x8297('0x2f')](_0xb20287['body']);}}else{return _0x465389[_0x8297('0x2c')](0xc8);}})[_0x8297('0x48')](handleError(_0x465389,null));};exports['webhookPost']=function(_0x644286,_0x1c303c,_0x17ea71){return BPromise['resolve']()[_0x8297('0x29')](function(){if(!_0x644286[_0x8297('0x37')]['path']){throw new Error(_0x8297('0xa5'));}if(!_0x644286[_0x8297('0x37')][_0x8297('0x9a')]){throw new Error(_0x8297('0x9b'));}var _0x3e9a9b=_0x644286[_0x8297('0x37')][_0x8297('0x9c')]?_0x644286[_0x8297('0x37')]['hostname']+':'+_0x644286[_0x8297('0x37')][_0x8297('0x9a')]:_0x8297('0x9d')+_0x644286[_0x8297('0x37')]['port'];var _0x1eaedf=_0x644286[_0x8297('0x37')][_0x8297('0x20')]?_0x644286[_0x8297('0x37')][_0x8297('0x20')]:!![];var _0x567426=_0x644286[_0x8297('0x37')][_0x8297('0x9e')]?_0x644286[_0x8297('0x37')][_0x8297('0x9e')]:null;var _0x4d9107={'method':_0x644286[_0x8297('0xa6')],'uri':util[_0x8297('0x51')](_0x8297('0x9f'),_0x3e9a9b,_0x644286[_0x8297('0x37')][_0x8297('0x7')]),'json':_0x1eaedf,'resolveWithFullResponse':!![],'encoding':_0x567426,'body':_0x644286['body']};if(_0x644286[_0x8297('0xa0')]){_0x4d9107[_0x8297('0xa0')]=_0x644286[_0x8297('0xa0')];if(_0x4d9107[_0x8297('0xa0')][_0x8297('0xa1')]){delete _0x4d9107['headers'][_0x8297('0xa1')];}}if(_0x4d9107[_0x8297('0xa0')][_0x8297('0xa2')]){delete _0x4d9107['headers']['content-type'];}return rp(_0x4d9107);})[_0x8297('0x29')](function(_0x2fcb97){if(_0x2fcb97){_0x1c303c['set'](_0x2fcb97[_0x8297('0xa0')]);logger[_0x8297('0x62')](_0x2fcb97[_0x8297('0x8c')]);return _0x1c303c['status'](_0x2fcb97['statusCode'])['send'](_0x2fcb97[_0x8297('0x8c')]);}else{return _0x1c303c[_0x8297('0x2c')](0xc8);}})[_0x8297('0x48')](handleError(_0x1c303c,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 113875c..f3713e4 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 _0x86f4=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x86f4,0x18a));var _0x486f=function(_0x712be1,_0x1d34cb){_0x712be1=_0x712be1-0x0;var _0x3d0ff8=_0x86f4[_0x712be1];return _0x3d0ff8;};'use strict';var EventEmitter=require(_0x486f('0x0'));var Plugin=require(_0x486f('0x1'))['db'][_0x486f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x486f('0x3')](0x0);var events={'afterCreate':_0x486f('0x4'),'afterUpdate':_0x486f('0x5'),'afterDestroy':_0x486f('0x6')};function emitEvent(_0x53305d){return function(_0xf8d50f,_0x1539b1,_0x583729){PluginEvents[_0x486f('0x7')](_0x53305d+':'+_0xf8d50f['id'],_0xf8d50f);PluginEvents[_0x486f('0x7')](_0x53305d,_0xf8d50f);_0x583729(null);};}for(var e in events){if(events[_0x486f('0x8')](e)){var event=events[e];Plugin[_0x486f('0x9')](e,emitEvent(event));}}module[_0x486f('0xa')]=PluginEvents; \ No newline at end of file +var _0xf3fe=['save','update','emit','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x5c7e92,_0x2face4){var _0x1c43ef=function(_0x5560a3){while(--_0x5560a3){_0x5c7e92['push'](_0x5c7e92['shift']());}};_0x1c43ef(++_0x2face4);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x4b09c8,_0x442f24){_0x4b09c8=_0x4b09c8-0x0;var _0x37eb95=_0xf3fe[_0x4b09c8];return _0x37eb95;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xef3f('0x0'))['db'][_0xef3f('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xef3f('0x2')](0x0);var events={'afterCreate':_0xef3f('0x3'),'afterUpdate':_0xef3f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29b501){return function(_0x18a97c,_0x171ff9,_0x431bc5){PluginEvents[_0xef3f('0x5')](_0x29b501+':'+_0x18a97c['id'],_0x18a97c);PluginEvents['emit'](_0x29b501,_0x18a97c);_0x431bc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xef3f('0x6')](e,emitEvent(event));}}module[_0xef3f('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 c7750d5..1e03172 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 _0x819d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x819d,0xc2));var _0xd819=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x819d[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xd819('0x0'));var util=require('util');var logger=require(_0xd819('0x1'))(_0xd819('0x2'));var moment=require(_0xd819('0x3'));var BPromise=require(_0xd819('0x4'));var rp=require(_0xd819('0x5'));var fs=require('fs');var path=require(_0xd819('0x6'));var rimraf=require(_0xd819('0x7'));var config=require(_0xd819('0x8'));var attributes=require(_0xd819('0x9'));module[_0xd819('0xa')]=function(_0x563680,_0x38f11a){return _0x563680[_0xd819('0xb')](_0xd819('0xc'),attributes,{'tableName':_0xd819('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaf1=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','util'];(function(_0x5131a8,_0x3a3a6f){var _0x1fb0dd=function(_0x15abef){while(--_0x15abef){_0x5131a8['push'](_0x5131a8['shift']());}};_0x1fb0dd(++_0x3a3a6f);}(_0xaaf1,0x173));var _0x1aaf=function(_0x4543f5,_0x4b454f){_0x4543f5=_0x4543f5-0x0;var _0x3799b8=_0xaaf1[_0x4543f5];return _0x3799b8;};'use strict';var _=require('lodash');var util=require(_0x1aaf('0x0'));var logger=require(_0x1aaf('0x1'))(_0x1aaf('0x2'));var moment=require(_0x1aaf('0x3'));var BPromise=require(_0x1aaf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1aaf('0x5'));var rimraf=require(_0x1aaf('0x6'));var config=require(_0x1aaf('0x7'));var attributes=require(_0x1aaf('0x8'));module['exports']=function(_0x4f6273,_0x557cbe){return _0x4f6273[_0x1aaf('0x9')](_0x1aaf('0xa'),attributes,{'tableName':_0x1aaf('0xb'),'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 ccdb7db..5e2fb8d 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 _0xe0c0=['stringify','error','code','message','request\x20sent','result','catch','CreatePlugin','Plugin','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','debug'];(function(_0x4c2a9a,_0x101e7c){var _0x2dcc13=function(_0x5b70f5){while(--_0x5b70f5){_0x4c2a9a['push'](_0x4c2a9a['shift']());}};_0x2dcc13(++_0x101e7c);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x7d5645,_0x45b18d){_0x7d5645=_0x7d5645-0x0;var _0x1107f5=_0xe0c0[_0x7d5645];return _0x1107f5;};'use strict';var _=require(_0x0e0c('0x0'));var util=require('util');var moment=require(_0x0e0c('0x1'));var BPromise=require(_0x0e0c('0x2'));var rs=require(_0x0e0c('0x3'));var fs=require('fs');var Redis=require(_0x0e0c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e0c('0x5'));var logger=require(_0x0e0c('0x6'))(_0x0e0c('0x7'));var config=require('../../config/environment');var jayson=require(_0x0e0c('0x8'));var client=jayson[_0x0e0c('0x9')]['http']({'port':0x232a});config[_0x0e0c('0xa')]=_[_0x0e0c('0xb')](config[_0x0e0c('0xa')],{'host':_0x0e0c('0xc'),'port':0x18eb});var socket=require(_0x0e0c('0xd'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x2bd09c,_0x5b347b,_0xb2aa1d){return new BPromise(function(_0xe4469,_0x1ae848){return client[_0x0e0c('0xe')](_0x2bd09c,_0xb2aa1d)[_0x0e0c('0xf')](function(_0x1b14f2){logger[_0x0e0c('0x10')](_0x0e0c('0x11'),_0x5b347b,'request\x20sent');logger[_0x0e0c('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x5b347b,'request\x20sent',JSON[_0x0e0c('0x13')](_0x1b14f2));if(_0x1b14f2[_0x0e0c('0x14')]){if(_0x1b14f2[_0x0e0c('0x14')][_0x0e0c('0x15')]===0x1f4){logger[_0x0e0c('0x14')](_0x0e0c('0x11'),_0x5b347b,_0x1b14f2['error'][_0x0e0c('0x16')]);return _0x1ae848(_0x1b14f2[_0x0e0c('0x14')][_0x0e0c('0x16')]);}logger['error'](_0x0e0c('0x11'),_0x5b347b,_0x1b14f2[_0x0e0c('0x14')][_0x0e0c('0x16')]);return _0xe4469(_0x1b14f2[_0x0e0c('0x14')][_0x0e0c('0x16')]);}else{logger[_0x0e0c('0x10')](_0x0e0c('0x11'),_0x5b347b,_0x0e0c('0x17'));_0xe4469(_0x1b14f2[_0x0e0c('0x18')]['message']);}})[_0x0e0c('0x19')](function(_0x4dcc04){logger['error']('Plugin,\x20%s,\x20%s',_0x5b347b,_0x4dcc04);_0x1ae848(_0x4dcc04);});});}exports[_0x0e0c('0x1a')]=function(_0x20de7d){var _0x234373=this;return new Promise(function(_0x41cee2,_0x26ad69){return db[_0x0e0c('0x1b')]['create'](_0x20de7d[_0x0e0c('0x1c')],{'raw':_0x20de7d['options']?_0x20de7d[_0x0e0c('0x1d')][_0x0e0c('0x1e')]===undefined?!![]:![]:!![]})[_0x0e0c('0xf')](function(_0x2d01e5){logger[_0x0e0c('0x10')]('CreatePlugin',_0x20de7d);logger[_0x0e0c('0x12')](_0x0e0c('0x1a'),_0x20de7d,JSON[_0x0e0c('0x13')](_0x2d01e5));_0x41cee2(_0x2d01e5);})[_0x0e0c('0x19')](function(_0x3871b0){logger[_0x0e0c('0x14')](_0x0e0c('0x1a'),_0x3871b0[_0x0e0c('0x16')],_0x20de7d);_0x26ad69(_0x234373[_0x0e0c('0x14')](0x1f4,_0x3871b0[_0x0e0c('0x16')]));});});}; \ No newline at end of file +var _0x1d7c=['options','raw','debug','stringify','util','moment','randomstring','../../mysqldb','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreatePlugin','create','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1d7c,0x1b4));var _0xc1d7=function(_0xb5179e,_0x67e31d){_0xb5179e=_0xb5179e-0x0;var _0x423511=_0x1d7c[_0xb5179e];return _0x423511;};'use strict';var _=require('lodash');var util=require(_0xc1d7('0x0'));var moment=require(_0xc1d7('0x1'));var BPromise=require('bluebird');var rs=require(_0xc1d7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1d7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1d7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc1d7('0x5')]({'port':0x232a});config[_0xc1d7('0x6')]=_[_0xc1d7('0x7')](config[_0xc1d7('0x6')],{'host':_0xc1d7('0x8'),'port':0x18eb});var socket=require(_0xc1d7('0x9'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x909ad3,_0x31785b,_0x7e7474){return new BPromise(function(_0x38cca0,_0x2f78d8){return client[_0xc1d7('0xa')](_0x909ad3,_0x7e7474)[_0xc1d7('0xb')](function(_0x3a0994){logger[_0xc1d7('0xc')](_0xc1d7('0xd'),_0x31785b,'request\x20sent');logger['debug'](_0xc1d7('0xe'),_0x31785b,_0xc1d7('0xf'),JSON['stringify'](_0x3a0994));if(_0x3a0994[_0xc1d7('0x10')]){if(_0x3a0994['error'][_0xc1d7('0x11')]===0x1f4){logger[_0xc1d7('0x10')](_0xc1d7('0xd'),_0x31785b,_0x3a0994[_0xc1d7('0x10')]['message']);return _0x2f78d8(_0x3a0994['error'][_0xc1d7('0x12')]);}logger[_0xc1d7('0x10')]('Plugin,\x20%s,\x20%s',_0x31785b,_0x3a0994[_0xc1d7('0x10')][_0xc1d7('0x12')]);return _0x38cca0(_0x3a0994['error'][_0xc1d7('0x12')]);}else{logger[_0xc1d7('0xc')]('Plugin,\x20%s,\x20%s',_0x31785b,_0xc1d7('0xf'));_0x38cca0(_0x3a0994['result'][_0xc1d7('0x12')]);}})[_0xc1d7('0x13')](function(_0x5e5884){logger[_0xc1d7('0x10')](_0xc1d7('0xd'),_0x31785b,_0x5e5884);_0x2f78d8(_0x5e5884);});});}exports[_0xc1d7('0x14')]=function(_0x4717b1){var _0x15e734=this;return new Promise(function(_0x275e07,_0x52a9d8){return db['Plugin'][_0xc1d7('0x15')](_0x4717b1[_0xc1d7('0x16')],{'raw':_0x4717b1[_0xc1d7('0x17')]?_0x4717b1[_0xc1d7('0x17')][_0xc1d7('0x18')]===undefined?!![]:![]:!![]})[_0xc1d7('0xb')](function(_0x52d026){logger[_0xc1d7('0xc')](_0xc1d7('0x14'),_0x4717b1);logger[_0xc1d7('0x19')](_0xc1d7('0x14'),_0x4717b1,JSON[_0xc1d7('0x1a')](_0x52d026));_0x275e07(_0x52d026);})['catch'](function(_0x58bd08){logger[_0xc1d7('0x10')](_0xc1d7('0x14'),_0x58bd08[_0xc1d7('0x12')],_0x4717b1);_0x52a9d8(_0x15e734[_0xc1d7('0x10')](0x1f4,_0x58bd08[_0xc1d7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f75f048..8c4e97f 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 _0x7fd6=['./plugin.events','save','update','emit','removeListener','plugin:'];(function(_0x54655f,_0x8ca841){var _0x4887b4=function(_0x233ea6){while(--_0x233ea6){_0x54655f['push'](_0x54655f['shift']());}};_0x4887b4(++_0x8ca841);}(_0x7fd6,0x14a));var _0x67fd=function(_0x2e8487,_0x2f412e){_0x2e8487=_0x2e8487-0x0;var _0x3d0715=_0x7fd6[_0x2e8487];return _0x3d0715;};'use strict';var PluginEvents=require(_0x67fd('0x0'));var events=[_0x67fd('0x1'),'remove',_0x67fd('0x2')];function createListener(_0x3b0e14,_0x1e06f7){return function(_0x433619){_0x1e06f7[_0x67fd('0x3')](_0x3b0e14,_0x433619);};}function removeListener(_0x45d966,_0x5b9f58){return function(){PluginEvents[_0x67fd('0x4')](_0x45d966,_0x5b9f58);};}exports['register']=function(_0x272872){for(var _0x100623=0x0,_0x24a252=events['length'];_0x100623<_0x24a252;_0x100623++){var _0x4acda5=events[_0x100623];var _0x3a3c22=createListener(_0x67fd('0x5')+_0x4acda5,_0x272872);PluginEvents['on'](_0x4acda5,_0x3a3c22);}}; \ No newline at end of file +var _0xf1b4=['remove','update','emit','register','plugin:','./plugin.events','save'];(function(_0x35c04a,_0x1b02e6){var _0x597229=function(_0x4e04a0){while(--_0x4e04a0){_0x35c04a['push'](_0x35c04a['shift']());}};_0x597229(++_0x1b02e6);}(_0xf1b4,0x8a));var _0x4f1b=function(_0x6e5a7,_0x48c04b){_0x6e5a7=_0x6e5a7-0x0;var _0xc424d7=_0xf1b4[_0x6e5a7];return _0xc424d7;};'use strict';var PluginEvents=require(_0x4f1b('0x0'));var events=[_0x4f1b('0x1'),_0x4f1b('0x2'),_0x4f1b('0x3')];function createListener(_0x577091,_0x1e2015){return function(_0xf95d1b){_0x1e2015[_0x4f1b('0x4')](_0x577091,_0xf95d1b);};}function removeListener(_0x44c216,_0x93602e){return function(){PluginEvents['removeListener'](_0x44c216,_0x93602e);};}exports[_0x4f1b('0x5')]=function(_0x4c0f56){for(var _0x59782e=0x0,_0x88ce46=events['length'];_0x59782e<_0x88ce46;_0x59782e++){var _0x2a00d7=events[_0x59782e];var _0x4d5614=createListener(_0x4f1b('0x6')+_0x2a00d7,_0x4c0f56);PluginEvents['on'](_0x2a00d7,_0x4d5614);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 3548534..a170689 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x1c6ed2,_0x2e8930){var _0x2ff441=function(_0x595616){while(--_0x595616){_0x1c6ed2['push'](_0x1c6ed2['shift']());}};_0x2ff441(++_0x2e8930);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x5c1a7e,_0x301721){var _0x507e43=function(_0x2ad452){while(--_0x2ad452){_0x5c1a7e['push'](_0x5c1a7e['shift']());}};_0x507e43(++_0x301721);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 52be2d7..45480d6 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 _0x1d2d=['reject','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','list','then'];(function(_0x4dc608,_0x130941){var _0x3a2e73=function(_0x2a2672){while(--_0x2a2672){_0x4dc608['push'](_0x4dc608['shift']());}};_0x3a2e73(++_0x130941);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x39285f,_0xc5b4ab){_0x39285f=_0x39285f-0x0;var _0x3be071=_0x1d2d[_0x39285f];return _0x3be071;};'use strict';var _=require(_0xd1d2('0x0'));var pm2=require(_0xd1d2('0x1'));var logger=require(_0xd1d2('0x2'))(_0xd1d2('0x3'));var path=require(_0xd1d2('0x4'));var exec=require('child_process')[_0xd1d2('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5d3fac,_0x3caa72){return function(_0x2bfabc){if(!_0x2bfabc){_0x5d3fac[_0xd1d2('0x6')](0x194);;}return _0x2bfabc;};}function respondWithResult(_0x269613,_0x2f930d){_0x2f930d=_0x2f930d||0xc8;return function(_0x353dbd){if(_0x353dbd){return _0x269613['status'](_0x2f930d)[_0xd1d2('0x7')](_0x353dbd);}return null;};}function handleError(_0x21bc28,_0x35735f){_0x35735f=_0x35735f||0x1f4;return function(_0x37ff2a){logger[_0xd1d2('0x8')](_0x37ff2a[_0xd1d2('0x9')]);if(_0x37ff2a[_0xd1d2('0xa')]){delete _0x37ff2a[_0xd1d2('0xa')];}_0x21bc28[_0xd1d2('0xb')](_0x35735f)[_0xd1d2('0xc')](_0x37ff2a);};}function execChildProcess(){return new BPromise(function(_0x900ec,_0x227d7f){exec(_0xd1d2('0xd'),function(_0x5b21f4,_0x41fcb5,_0x1f49ed){logger[_0xd1d2('0xe')](_0x41fcb5);logger[_0xd1d2('0xe')](_0x1f49ed);if(_0x5b21f4){logger[_0xd1d2('0x8')](_0x5b21f4);return _0x227d7f(_0x5b21f4);}return _0x900ec(_0x41fcb5);});});}exports[_0xd1d2('0xf')]=function(_0x2df8a5,_0x31dc84){return pm2[_0xd1d2('0x10')]()[_0xd1d2('0x11')](function(_0x4cf702){if(_0x4cf702){var _0x2e7fec=_[_0xd1d2('0x12')](_0x4cf702,function(_0x3476f8){return _0x3476f8['name']===_0xd1d2('0x13')||_0x3476f8[_0xd1d2('0xa')]===_0xd1d2('0x14');});return{'rows':_0x2e7fec,'count':_0x2e7fec[_0xd1d2('0x15')]};}return null;})[_0xd1d2('0x11')](respondWithResult(_0x31dc84,null))[_0xd1d2('0x16')](handleError(_0x31dc84,null));};exports[_0xd1d2('0x17')]=function(_0x57f2f9,_0x539d5a){return pm2[_0xd1d2('0x18')](_0x57f2f9['params']['id'])[_0xd1d2('0x11')](respondWithResult(_0x539d5a,null))[_0xd1d2('0x11')](handleEntityNotFound(_0x539d5a,null))[_0xd1d2('0x16')](handleError(_0x539d5a,null));};exports[_0xd1d2('0x19')]=function(_0x4ab386,_0x4f1201){if(_0x4ab386[_0xd1d2('0x1a')]['name']&&_0x4ab386['body'][_0xd1d2('0x1b')]){var _0x27e26b=path[_0xd1d2('0x1c')](__dirname,_0xd1d2('0x1d'),_0x4ab386['body'][_0xd1d2('0x1b')]);var _0xbb4d27=process[_0xd1d2('0x1e')]();process['chdir'](path['dirname'](_0x27e26b));return execChildProcess()[_0xd1d2('0x11')](function(_0x3a1078){process[_0xd1d2('0x1f')](_0xbb4d27);return pm2[_0xd1d2('0x20')]({'name':_0x4ab386[_0xd1d2('0x1a')][_0xd1d2('0xa')],'script':_0x27e26b});})[_0xd1d2('0x11')](function(_0x5df4af){pm2[_0xd1d2('0x21')]();return _0x5df4af[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x4f1201,0xc9))[_0xd1d2('0x16')](handleError(_0x4f1201,null));}else{return _0x4f1201[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x22')});}};exports[_0xd1d2('0x23')]=function(_0x34faf7,_0xe6ef3c){if(_0x34faf7[_0xd1d2('0x1a')]['id']){delete _0x34faf7[_0xd1d2('0x1a')]['id'];}var _0x4e1bc2={'online':'restart','stopped':_0xd1d2('0x24')};if(_0x4e1bc2[_0xd1d2('0x25')](_0x34faf7[_0xd1d2('0x1a')][_0xd1d2('0xb')])){return pm2[_0x4e1bc2[_0x34faf7[_0xd1d2('0x1a')]['status']]](_0x34faf7[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](respondWithResult(_0xe6ef3c,0xc8))[_0xd1d2('0x16')](handleError(_0xe6ef3c,null));}else{return _0xe6ef3c['status'](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x27')});}};exports[_0xd1d2('0x28')]=function(_0x56557d,_0x419db7){if(_0x56557d[_0xd1d2('0x1a')]['id']){delete _0x56557d[_0xd1d2('0x1a')]['id'];}if(_0x56557d[_0xd1d2('0x26')]['id']){return pm2[_0xd1d2('0x29')](_0x56557d[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](function(_0x322f50){pm2[_0xd1d2('0x21')]();return _0x322f50[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x419db7,null))[_0xd1d2('0x16')](handleError(_0x419db7,null));}else{return _0x419db7[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x2a')});}}; \ No newline at end of file +var _0xa8a8=['dirname','start','dump','update','restart','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','length','catch','show','describe','params','create','script','join','../../files/plugins','body','cwd','chdir'];(function(_0xf1402a,_0x187f5c){var _0x4f7ead=function(_0x57dfd9){while(--_0x57dfd9){_0xf1402a['push'](_0xf1402a['shift']());}};_0x4f7ead(++_0x187f5c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3255a2,_0x38c561){_0x3255a2=_0x3255a2-0x0;var _0x239f61=_0xa8a8[_0x3255a2];return _0x239f61;};'use strict';var _=require(_0x8a8a('0x0'));var pm2=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var path=require('path');var exec=require(_0x8a8a('0x4'))[_0x8a8a('0x5')];var BPromise=require(_0x8a8a('0x6'));function handleEntityNotFound(_0x3ed1de,_0x45515d){return function(_0x1cecd4){if(!_0x1cecd4){_0x3ed1de[_0x8a8a('0x7')](0x194);;}return _0x1cecd4;};}function respondWithResult(_0x12db82,_0x2e8193){_0x2e8193=_0x2e8193||0xc8;return function(_0x315fe9){if(_0x315fe9){return _0x12db82[_0x8a8a('0x8')](_0x2e8193)[_0x8a8a('0x9')](_0x315fe9);}return null;};}function handleError(_0x4225b9,_0xecaa6f){_0xecaa6f=_0xecaa6f||0x1f4;return function(_0x3287f5){logger['error'](_0x3287f5['stack']);if(_0x3287f5[_0x8a8a('0xa')]){delete _0x3287f5['name'];}_0x4225b9[_0x8a8a('0x8')](_0xecaa6f)[_0x8a8a('0xb')](_0x3287f5);};}function execChildProcess(){return new BPromise(function(_0x532621,_0x118380){exec(_0x8a8a('0xc'),function(_0xb13fca,_0x5e448d,_0x679da2){logger[_0x8a8a('0xd')](_0x5e448d);logger[_0x8a8a('0xd')](_0x679da2);if(_0xb13fca){logger[_0x8a8a('0xe')](_0xb13fca);return _0x118380(_0xb13fca);}return _0x532621(_0x5e448d);});});}exports['index']=function(_0x23febf,_0x4e5d74){return pm2[_0x8a8a('0xf')]()[_0x8a8a('0x10')](function(_0x787eec){if(_0x787eec){var _0x2f6e33=_[_0x8a8a('0x11')](_0x787eec,function(_0x78b0f0){return _0x78b0f0[_0x8a8a('0xa')]==='express'||_0x78b0f0[_0x8a8a('0xa')]==='motion2';});return{'rows':_0x2f6e33,'count':_0x2f6e33[_0x8a8a('0x12')]};}return null;})[_0x8a8a('0x10')](respondWithResult(_0x4e5d74,null))[_0x8a8a('0x13')](handleError(_0x4e5d74,null));};exports[_0x8a8a('0x14')]=function(_0x42e8b6,_0x5dd616){return pm2[_0x8a8a('0x15')](_0x42e8b6[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](respondWithResult(_0x5dd616,null))[_0x8a8a('0x10')](handleEntityNotFound(_0x5dd616,null))[_0x8a8a('0x13')](handleError(_0x5dd616,null));};exports[_0x8a8a('0x17')]=function(_0x4d7a45,_0x5dc5ae){if(_0x4d7a45['body']['name']&&_0x4d7a45['body'][_0x8a8a('0x18')]){var _0x45095b=path[_0x8a8a('0x19')](__dirname,_0x8a8a('0x1a'),_0x4d7a45[_0x8a8a('0x1b')][_0x8a8a('0x18')]);var _0x242bac=process[_0x8a8a('0x1c')]();process[_0x8a8a('0x1d')](path[_0x8a8a('0x1e')](_0x45095b));return execChildProcess()[_0x8a8a('0x10')](function(_0x3aa2bb){process[_0x8a8a('0x1d')](_0x242bac);return pm2[_0x8a8a('0x1f')]({'name':_0x4d7a45[_0x8a8a('0x1b')]['name'],'script':_0x45095b});})[_0x8a8a('0x10')](function(_0x16c55b){pm2[_0x8a8a('0x20')]();return _0x16c55b[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x5dc5ae,0xc9))[_0x8a8a('0x13')](handleError(_0x5dc5ae,null));}else{return _0x5dc5ae[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8a8a('0x21')]=function(_0x38c1e0,_0x2e217a){if(_0x38c1e0['body']['id']){delete _0x38c1e0['body']['id'];}var _0x2dafcd={'online':_0x8a8a('0x22'),'stopped':'stop'};if(_0x2dafcd['hasOwnProperty'](_0x38c1e0['body'][_0x8a8a('0x8')])){return pm2[_0x2dafcd[_0x38c1e0['body'][_0x8a8a('0x8')]]](_0x38c1e0[_0x8a8a('0x16')]['id'])['then'](respondWithResult(_0x2e217a,0xc8))[_0x8a8a('0x13')](handleError(_0x2e217a,null));}else{return _0x2e217a[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x23')});}};exports[_0x8a8a('0x24')]=function(_0x3d6594,_0x3e73b1){if(_0x3d6594[_0x8a8a('0x1b')]['id']){delete _0x3d6594['body']['id'];}if(_0x3d6594['params']['id']){return pm2['delete'](_0x3d6594[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](function(_0x5f301e){pm2[_0x8a8a('0x20')]();return _0x5f301e[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x3e73b1,null))['catch'](handleError(_0x3e73b1,null));}else{return _0x3e73b1[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 1e81dac..e8f2546 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf40b=['exports','Router','../../components/auth/service','./realtime.controller','get','isAuthenticated','getQueues'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xf40b,0xb0));var _0xbf40=function(_0x2e9c6d,_0xbecdb4){_0x2e9c6d=_0x2e9c6d-0x0;var _0x139a4f=_0xf40b[_0x2e9c6d];return _0x139a4f;};'use strict';var express=require('express');var router=express[_0xbf40('0x0')]();var auth=require(_0xbf40('0x1'));var controller=require(_0xbf40('0x2'));router[_0xbf40('0x3')]('/queues',auth[_0xbf40('0x4')](),controller[_0xbf40('0x5')]);module[_0xbf40('0x6')]=router; \ No newline at end of file +var _0x720b=['/queues','getQueues','exports','express','Router','../../components/auth/service','get'];(function(_0x57fcc0,_0x585004){var _0x5270df=function(_0x5f2db0){while(--_0x5f2db0){_0x57fcc0['push'](_0x57fcc0['shift']());}};_0x5270df(++_0x585004);}(_0x720b,0x1d8));var _0xb720=function(_0x5a037f,_0x36980c){_0x5a037f=_0x5a037f-0x0;var _0x35a5eb=_0x720b[_0x5a037f];return _0x35a5eb;};'use strict';var express=require(_0xb720('0x0'));var router=express[_0xb720('0x1')]();var auth=require(_0xb720('0x2'));var controller=require('./realtime.controller');router[_0xb720('0x3')](_0xb720('0x4'),auth['isAuthenticated'](),controller[_0xb720('0x5')]);module[_0xb720('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index a319450..52b9fa8 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','limit','status','Content-Range','json','error','send','mail','openchannel','whatsapp','resolve','then','query','includes','channel','toLowerCase','startCase','Queue','map','fieldName','key','getOptions','user','role','userProfileId','voice','outbound','Queues','name','filter','UserProfile','getResources','findAndCountAll','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','available','waiting','talking','paused','type','push','pTalking','originated','dialActive','Trunk','startPredictive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','loggedInDb','loggedIn','online','getMembers','find','UserId','agents','User','Pause','findAll','QueueId','agent','length','all','catch','util','lodash','jayson/promise','../../components/parsers/qs'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var util=require(_0x7413('0x0'));var _=require(_0x7413('0x1'));var jayson=require(_0x7413('0x2'));var qs=require(_0x7413('0x3'));var logger=require(_0x7413('0x4'))(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var client=jayson[_0x7413('0x7')][_0x7413('0x8')]({'port':0x232a});var routingClient=jayson[_0x7413('0x7')][_0x7413('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x3bb181,_0x4fbade){return function(_0xc808cd){if(_0xc808cd){var _0x188d89=typeof _0x4fbade[_0x7413('0x9')]===_0x7413('0xa')&&typeof _0x4fbade['limit']===_0x7413('0xa');var _0x120dc2=_0xc808cd['count'];var _0x422bf5=_0x188d89?0x0:_0x4fbade[_0x7413('0x9')];var _0x50fde0=_0x188d89?_0xc808cd[_0x7413('0xb')]:_0x4fbade[_0x7413('0x9')]+_0x4fbade[_0x7413('0xc')];var _0x3e026b;if(_0x50fde0>=_0x120dc2){_0x50fde0=_0x120dc2;_0x3e026b=0xc8;}else{_0x3e026b=0xce;}_0x3bb181[_0x7413('0xd')](_0x3e026b);return _0x3bb181['set'](_0x7413('0xe'),_0x422bf5+'-'+_0x50fde0+'/'+_0x120dc2)[_0x7413('0xf')](_0xc808cd);}return null;};}function handleError(_0x4bf07d,_0x18a874){_0x18a874=_0x18a874||0x1f4;return function(_0xa26ca4){logger[_0x7413('0x10')](_0xa26ca4['stack']);if(_0xa26ca4['name']){delete _0xa26ca4['name'];}_0x4bf07d[_0x7413('0xd')](_0x18a874)[_0x7413('0x11')](_0xa26ca4);};}exports['getQueues']=function(_0x1a42aa,_0x45bef0){var _0x4955d3=[_0x7413('0x12'),'chat','sms',_0x7413('0x13'),'fax',_0x7413('0x14'),'voice'];var _0x2036b6={'count':0x0,'rows':[]},_0x3230d8={},_0x19157f;Promise[_0x7413('0x15')]()[_0x7413('0x16')](function(){if(_0x1a42aa[_0x7413('0x17')]['channel']){if(!_[_0x7413('0x18')](_0x4955d3,_0x1a42aa[_0x7413('0x17')][_0x7413('0x19')][_0x7413('0x1a')]()))throw new Error('Invalid\x20channel');_0x19157f=_0x1a42aa[_0x7413('0x17')][_0x7413('0x19')][_0x7413('0x1a')]();}var _0x20d3d2=_[_0x7413('0x1b')](_0x19157f)+_0x7413('0x1c');var _0x4886e3=_[_0x7413('0x1d')](db[_0x20d3d2]['rawAttributes'],function(_0x5f12a2){return{'name':_0x5f12a2[_0x7413('0x1e')],'type':_0x5f12a2['type'][_0x7413('0x1f')]};});_0x3230d8=qs[_0x7413('0x20')](_0x4886e3,_0x1a42aa);if(_0x1a42aa[_0x7413('0x21')][_0x7413('0x22')]===_0x7413('0x21')){var _0x346ce8={'params':{'id':_0x1a42aa[_0x7413('0x21')][_0x7413('0x23')]},'query':{'section':_0x19157f===_0x7413('0x24')&&_0x1a42aa['query']['type']===_0x7413('0x25')?'QueueCampaigns':_[_0x7413('0x1b')](_0x19157f)+_0x7413('0x26'),'type':_0x1a42aa[_0x7413('0x17')]['type'],'nolimit':!![],'sort':_0x7413('0x27'),'filter':_0x1a42aa[_0x7413('0x17')][_0x7413('0x28')]}};return db[_0x7413('0x29')][_0x7413('0x2a')](_0x346ce8);}return db[_0x20d3d2][_0x7413('0x2b')](_0x3230d8);})['then'](function(_0x24dce7){_0x2036b6['count']=_0x24dce7[_0x7413('0xb')];var _0x23e682=_0x19157f===_0x7413('0x24')?client:routingClient;return _0x23e682[_0x7413('0x2c')](_[_0x7413('0x1b')](_0x19157f)+_0x7413('0x26'),_0x1a42aa)['then'](function(_0x1ffb6f){if(_0x1ffb6f[_0x7413('0x10')])throw new Error(util[_0x7413('0x2d')](_0x7413('0x2e'),_0x19157f));var _0x291268=_0x1ffb6f[_0x7413('0x2f')];var _0x185cfe=['loggedIn',_0x7413('0x30'),_0x7413('0x31'),_0x7413('0x32'),_0x7413('0x33')];if(_0x19157f===_0x7413('0x24')&&_0x1a42aa['query'][_0x7413('0x34')]==='outbound'){_0x185cfe[_0x7413('0x35')](_0x7413('0x36'),_0x7413('0x37'),'message',_0x7413('0x38'),'dialMethod',_0x7413('0x39'),_0x7413('0x3a'),'startProgressive','erlangCalls',_0x7413('0x3b'),_0x7413('0x3c'),_0x7413('0x3d'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x7413('0x3e'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0x7413('0x3f'),'predictiveIntervalDroppedCallsTimeout',_0x7413('0x40'),_0x7413('0x41'),_0x7413('0x42'));}var _0x2b178c=_0x24dce7[_0x7413('0x43')]['map'](function(_0xa58bd2){var _0x8dc047=_0xa58bd2[_0x7413('0x44')]({'plain':!![]});_0x8dc047[_0x7413('0x33')]=0x0;_0x8dc047[_0x7413('0x45')]=0x0;_0x8dc047[_0x7413('0x46')]=0x0;_0x8dc047[_0x7413('0x30')]=0x0;_0x8dc047[_0x7413('0x33')]=0x0;_0x8dc047[_0x7413('0x31')]=0x0;if(_0x19157f===_0x7413('0x24')){_0x8dc047[_0x7413('0x32')]=0x0;if(_0x1a42aa[_0x7413('0x17')]['type']===_0x7413('0x25')){_0x8dc047['pTalking']=0x0;_0x8dc047['originated']=0x0;}}_0x8dc047['agents']=[];var _0x53c47c=_['find'](_0x291268[_0x7413('0x43')],['id',_0x8dc047['id']]);if(_0x53c47c)_['merge'](_0x8dc047,_['pick'](_0x53c47c,_0x185cfe));if(_0x19157f===_0x7413('0x24')){return _0xa58bd2['getAgents']({'attributes':['id','name',_0x7413('0x47')],'joinTableAttributes':[],'raw':!![]})[_0x7413('0x16')](function(_0x18674c){return _0xa58bd2[_0x7413('0x48')]({'raw':!![]})[_0x7413('0x16')](function(_0x57cb9e){for(var _0x3f421c=0x0;_0x3f421c<_0x18674c['length'];_0x3f421c++){var _0x2e9e18=_[_0x7413('0x49')](_0x57cb9e,[_0x7413('0x4a'),_0x18674c[_0x3f421c]['id']]);var _0xfe0daa={'id':_0x18674c[_0x3f421c]['id'],'name':_0x18674c[_0x3f421c][_0x7413('0x27')],'online':Boolean(_0x18674c[_0x3f421c][_0x7413('0x47')]),'paused':_0x2e9e18?Boolean(_0x2e9e18[_0x7413('0x33')]):![]};if(_0xfe0daa[_0x7413('0x47')])_0x8dc047[_0x7413('0x45')]++;if(_0xfe0daa[_0x7413('0x33')])_0x8dc047[_0x7413('0x33')]++;_0x8dc047[_0x7413('0x4b')][_0x7413('0x35')](_0xfe0daa);}return _0x8dc047;});});}else{var _0x58ab17=_0x7413('0x4c')+_[_0x7413('0x1b')](_0x19157f)+_0x7413('0x1c');var _0x1fbbd5=_0x19157f+_0x7413('0x4d');return db[_0x58ab17][_0x7413('0x4e')]({'where':{[_[_0x7413('0x1b')](_0x19157f)+_0x7413('0x4f')]:_0xa58bd2['id']},'raw':!![]})[_0x7413('0x16')](function(_0x1c3af5){return db[_0x7413('0x4c')]['findAll']({'attributes':['id',_0x7413('0x27'),'online',_0x1fbbd5],'where':{'id':_[_0x7413('0x1d')](_0x1c3af5,_0x7413('0x4a')),'role':_0x7413('0x50')},'raw':!![]});})[_0x7413('0x16')](function(_0x479049){for(var _0x148b69=0x0;_0x148b69<_0x479049[_0x7413('0x51')];_0x148b69++){var _0x7de9d8={'id':_0x479049[_0x148b69]['id'],'name':_0x479049[_0x148b69][_0x7413('0x27')],'online':Boolean(_0x479049[_0x148b69][_0x7413('0x47')]),'paused':Boolean(_0x479049[_0x148b69][_0x1fbbd5])};if(_0x7de9d8['online'])_0x8dc047['loggedInDb']++;if(_0x7de9d8[_0x7413('0x33')])_0x8dc047['paused']++;_0x8dc047['agents'][_0x7413('0x35')](_0x7de9d8);}return _0x8dc047;});}});return Promise[_0x7413('0x52')](_0x2b178c);});})['then'](function(_0x2aa12c){_0x2036b6['rows']=_0x2aa12c;return _0x2036b6;})['then'](respondWithFilteredResult(_0x45bef0,_0x3230d8))[_0x7413('0x53')](handleError(_0x45bef0,null));}; \ No newline at end of file +var _0x323f=['Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','originated','dialActive','dialMethod','startPredictive','erlangCalls','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','loggedInDb','pTalking','agents','find','rows','merge','pick','getAgents','online','getMembers','length','UserId','Pause','findAll','QueueId','User','agent','all','catch','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','stack','name','send','getQueues','mail','chat','sms','openchannel','whatsapp','voice','resolve','then','query','channel','Invalid\x20channel','toLowerCase','startCase','Queue','rawAttributes','fieldName','type','key','getOptions','user','role','userProfileId','outbound','filter','UserProfile','getResources','findAndCountAll','request'];(function(_0x4e3c02,_0x2a00dc){var _0x5f47d2=function(_0x3b45dd){while(--_0x3b45dd){_0x4e3c02['push'](_0x4e3c02['shift']());}};_0x5f47d2(++_0x2a00dc);}(_0x323f,0x1ee));var _0xf323=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x323f[_0x46aff0];return _0x9d78cf;};'use strict';var util=require('util');var _=require(_0xf323('0x0'));var jayson=require('jayson/promise');var qs=require(_0xf323('0x1'));var logger=require(_0xf323('0x2'))(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var client=jayson[_0xf323('0x5')][_0xf323('0x6')]({'port':0x232a});var routingClient=jayson[_0xf323('0x5')][_0xf323('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x3cfee3,_0x371707){return function(_0x5d7d60){if(_0x5d7d60){var _0xb9a667=typeof _0x371707[_0xf323('0x7')]===_0xf323('0x8')&&typeof _0x371707[_0xf323('0x9')]===_0xf323('0x8');var _0x3c416a=_0x5d7d60[_0xf323('0xa')];var _0x2b24a2=_0xb9a667?0x0:_0x371707[_0xf323('0x7')];var _0x21e82e=_0xb9a667?_0x5d7d60[_0xf323('0xa')]:_0x371707[_0xf323('0x7')]+_0x371707[_0xf323('0x9')];var _0x20c013;if(_0x21e82e>=_0x3c416a){_0x21e82e=_0x3c416a;_0x20c013=0xc8;}else{_0x20c013=0xce;}_0x3cfee3[_0xf323('0xb')](_0x20c013);return _0x3cfee3[_0xf323('0xc')](_0xf323('0xd'),_0x2b24a2+'-'+_0x21e82e+'/'+_0x3c416a)['json'](_0x5d7d60);}return null;};}function handleError(_0x1b6a09,_0x7dbd26){_0x7dbd26=_0x7dbd26||0x1f4;return function(_0x26eddb){logger['error'](_0x26eddb[_0xf323('0xe')]);if(_0x26eddb[_0xf323('0xf')]){delete _0x26eddb[_0xf323('0xf')];}_0x1b6a09[_0xf323('0xb')](_0x7dbd26)[_0xf323('0x10')](_0x26eddb);};}exports[_0xf323('0x11')]=function(_0x59ffbc,_0x4cc3ce){var _0x874219=[_0xf323('0x12'),_0xf323('0x13'),_0xf323('0x14'),_0xf323('0x15'),'fax',_0xf323('0x16'),_0xf323('0x17')];var _0xb9859f={'count':0x0,'rows':[]},_0x44671c={},_0x49b115;Promise[_0xf323('0x18')]()[_0xf323('0x19')](function(){if(_0x59ffbc[_0xf323('0x1a')][_0xf323('0x1b')]){if(!_['includes'](_0x874219,_0x59ffbc[_0xf323('0x1a')][_0xf323('0x1b')]['toLowerCase']()))throw new Error(_0xf323('0x1c'));_0x49b115=_0x59ffbc[_0xf323('0x1a')][_0xf323('0x1b')][_0xf323('0x1d')]();}var _0x58e22b=_[_0xf323('0x1e')](_0x49b115)+_0xf323('0x1f');var _0x1c29d9=_['map'](db[_0x58e22b][_0xf323('0x20')],function(_0x375473){return{'name':_0x375473[_0xf323('0x21')],'type':_0x375473[_0xf323('0x22')][_0xf323('0x23')]};});_0x44671c=qs[_0xf323('0x24')](_0x1c29d9,_0x59ffbc);if(_0x59ffbc[_0xf323('0x25')][_0xf323('0x26')]===_0xf323('0x25')){var _0x47fb15={'params':{'id':_0x59ffbc[_0xf323('0x25')][_0xf323('0x27')]},'query':{'section':_0x49b115===_0xf323('0x17')&&_0x59ffbc[_0xf323('0x1a')][_0xf323('0x22')]===_0xf323('0x28')?'QueueCampaigns':_[_0xf323('0x1e')](_0x49b115)+'Queues','type':_0x59ffbc[_0xf323('0x1a')][_0xf323('0x22')],'nolimit':!![],'sort':'name','filter':_0x59ffbc[_0xf323('0x1a')][_0xf323('0x29')]}};return db[_0xf323('0x2a')][_0xf323('0x2b')](_0x47fb15);}return db[_0x58e22b][_0xf323('0x2c')](_0x44671c);})['then'](function(_0x44c944){_0xb9859f[_0xf323('0xa')]=_0x44c944[_0xf323('0xa')];var _0x30a5d7=_0x49b115===_0xf323('0x17')?client:routingClient;return _0x30a5d7[_0xf323('0x2d')](_[_0xf323('0x1e')](_0x49b115)+_0xf323('0x2e'),_0x59ffbc)[_0xf323('0x19')](function(_0x52300b){if(_0x52300b[_0xf323('0x2f')])throw new Error(util[_0xf323('0x30')](_0xf323('0x31'),_0x49b115));var _0x3d09d8=_0x52300b[_0xf323('0x32')];var _0x5cd5c0=[_0xf323('0x33'),_0xf323('0x34'),_0xf323('0x35'),_0xf323('0x36'),_0xf323('0x37')];if(_0x49b115==='voice'&&_0x59ffbc[_0xf323('0x1a')][_0xf323('0x22')]===_0xf323('0x28')){_0x5cd5c0[_0xf323('0x38')]('pTalking',_0xf323('0x39'),'message',_0xf323('0x3a'),_0xf323('0x3b'),'Trunk',_0xf323('0x3c'),'startProgressive',_0xf323('0x3d'),'erlangCallToSecond',_0xf323('0x3e'),'erlangBusyFactor',_0xf323('0x3f'),_0xf323('0x40'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0xf323('0x41'),_0xf323('0x42'),_0xf323('0x43'),_0xf323('0x44'),_0xf323('0x45'));}var _0x49e458=_0x44c944['rows']['map'](function(_0x365297){var _0x59fee2=_0x365297[_0xf323('0x46')]({'plain':!![]});_0x59fee2['paused']=0x0;_0x59fee2[_0xf323('0x47')]=0x0;_0x59fee2[_0xf323('0x33')]=0x0;_0x59fee2[_0xf323('0x34')]=0x0;_0x59fee2[_0xf323('0x37')]=0x0;_0x59fee2[_0xf323('0x35')]=0x0;if(_0x49b115==='voice'){_0x59fee2[_0xf323('0x36')]=0x0;if(_0x59ffbc[_0xf323('0x1a')][_0xf323('0x22')]===_0xf323('0x28')){_0x59fee2[_0xf323('0x48')]=0x0;_0x59fee2[_0xf323('0x39')]=0x0;}}_0x59fee2[_0xf323('0x49')]=[];var _0x2dcb00=_[_0xf323('0x4a')](_0x3d09d8[_0xf323('0x4b')],['id',_0x59fee2['id']]);if(_0x2dcb00)_[_0xf323('0x4c')](_0x59fee2,_[_0xf323('0x4d')](_0x2dcb00,_0x5cd5c0));if(_0x49b115===_0xf323('0x17')){return _0x365297[_0xf323('0x4e')]({'attributes':['id',_0xf323('0xf'),_0xf323('0x4f')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x502114){return _0x365297[_0xf323('0x50')]({'raw':!![]})[_0xf323('0x19')](function(_0x2864f7){for(var _0xb21a85=0x0;_0xb21a85<_0x502114[_0xf323('0x51')];_0xb21a85++){var _0xcdbb9a=_[_0xf323('0x4a')](_0x2864f7,[_0xf323('0x52'),_0x502114[_0xb21a85]['id']]);var _0x1c0136={'id':_0x502114[_0xb21a85]['id'],'name':_0x502114[_0xb21a85][_0xf323('0xf')],'online':Boolean(_0x502114[_0xb21a85][_0xf323('0x4f')]),'paused':_0xcdbb9a?Boolean(_0xcdbb9a[_0xf323('0x37')]):![]};if(_0x1c0136[_0xf323('0x4f')])_0x59fee2['loggedInDb']++;if(_0x1c0136[_0xf323('0x37')])_0x59fee2['paused']++;_0x59fee2['agents'][_0xf323('0x38')](_0x1c0136);}return _0x59fee2;});});}else{var _0x5926ad='User'+_[_0xf323('0x1e')](_0x49b115)+_0xf323('0x1f');var _0x370d87=_0x49b115+_0xf323('0x53');return db[_0x5926ad][_0xf323('0x54')]({'where':{[_[_0xf323('0x1e')](_0x49b115)+_0xf323('0x55')]:_0x365297['id']},'raw':!![]})[_0xf323('0x19')](function(_0x2ade7d){return db[_0xf323('0x56')][_0xf323('0x54')]({'attributes':['id','name',_0xf323('0x4f'),_0x370d87],'where':{'id':_['map'](_0x2ade7d,_0xf323('0x52')),'role':_0xf323('0x57')},'raw':!![]});})[_0xf323('0x19')](function(_0x9c525e){for(var _0x542205=0x0;_0x542205<_0x9c525e['length'];_0x542205++){var _0x36b688={'id':_0x9c525e[_0x542205]['id'],'name':_0x9c525e[_0x542205]['name'],'online':Boolean(_0x9c525e[_0x542205][_0xf323('0x4f')]),'paused':Boolean(_0x9c525e[_0x542205][_0x370d87])};if(_0x36b688['online'])_0x59fee2[_0xf323('0x47')]++;if(_0x36b688[_0xf323('0x37')])_0x59fee2['paused']++;_0x59fee2[_0xf323('0x49')][_0xf323('0x38')](_0x36b688);}return _0x59fee2;});}});return Promise[_0xf323('0x58')](_0x49e458);});})[_0xf323('0x19')](function(_0x1e50b3){_0xb9859f[_0xf323('0x4b')]=_0x1e50b3;return _0xb9859f;})[_0xf323('0x19')](respondWithFilteredResult(_0x4cc3ce,_0x44671c))[_0xf323('0x59')](handleError(_0x4cc3ce,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 8eaae52..48a445f 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xa97e74,_0x17c03a){var _0x399b97=function(_0x136846){while(--_0x136846){_0xa97e74['push'](_0xa97e74['shift']());}};_0x399b97(++_0x17c03a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4fa108,_0x1fb98e){var _0x3dd249=function(_0x4c0d17){while(--_0x4c0d17){_0x4fa108['push'](_0x4fa108['shift']());}};_0x3dd249(++_0x1fb98e);}(_0xedd9,0xfc));var _0x9edd=function(_0xe0ba74,_0x5dcbac){_0xe0ba74=_0xe0ba74-0x0;var _0x5efbef=_0xedd9[_0xe0ba74];return _0x5efbef;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5a0ff9f..813b03d 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 _0x7dfd=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x1f1fa4,_0x58629){var _0x2b2f89=function(_0x1515b9){while(--_0x1515b9){_0x1f1fa4['push'](_0x1f1fa4['shift']());}};_0x2b2f89(++_0x58629);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'state':{'type':Sequelize[_0xd7df('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd7df('0x3')]},'scheduledat':{'type':Sequelize[_0xd7df('0x4')]},'uniqueid':{'type':Sequelize[_0xd7df('0x3')]},'starttime':{'type':Sequelize[_0xd7df('0x4')]},'responsetime':{'type':Sequelize[_0xd7df('0x4')]},'ringtime':{'type':Sequelize[_0xd7df('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd7df('0x3')]},'campaigntype':{'type':Sequelize[_0xd7df('0x3')]},'membername':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0xd43e=['sequelize','INTEGER','STRING','DATE'];(function(_0x4fdd3a,_0x19ce14){var _0x47c3d0=function(_0x633ed){while(--_0x633ed){_0x4fdd3a['push'](_0x4fdd3a['shift']());}};_0x47c3d0(++_0x19ce14);}(_0xd43e,0x88));var _0xed43=function(_0x43e977,_0x11a735){_0x43e977=_0x43e977-0x0;var _0x4fa35c=_0xd43e[_0x43e977];return _0x4fa35c;};'use strict';var Sequelize=require(_0xed43('0x0'));module['exports']={'state':{'type':Sequelize[_0xed43('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xed43('0x2')]},'scheduledat':{'type':Sequelize[_0xed43('0x3')]},'uniqueid':{'type':Sequelize[_0xed43('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xed43('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xed43('0x2')]},'campaigntype':{'type':Sequelize[_0xed43('0x2')]},'membername':{'type':Sequelize[_0xed43('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 92660ab..c58e081 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 _0xcdef=['bluebird','request-promise','path','./reportAgentPreview.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x2fefaa,_0x337139){var _0x874c0e=function(_0x382a3b){while(--_0x382a3b){_0x2fefaa['push'](_0x2fefaa['shift']());}};_0x874c0e(++_0x337139);}(_0xcdef,0xc4));var _0xfcde=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcdef[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xfcde('0x0'));var util=require(_0xfcde('0x1'));var logger=require(_0xfcde('0x2'))(_0xfcde('0x3'));var moment=require('moment');var BPromise=require(_0xfcde('0x4'));var rp=require(_0xfcde('0x5'));var fs=require('fs');var path=require(_0xfcde('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfcde('0x7'));module[_0xfcde('0x8')]=function(_0x495281,_0x3aaa7d){return _0x495281[_0xfcde('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc57a=['util','../../config/logger','moment','bluebird','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x422afa,_0x1ea712){var _0x14344c=function(_0x2c88bf){while(--_0x2c88bf){_0x422afa['push'](_0x422afa['shift']());}};_0x14344c(++_0x1ea712);}(_0xc57a,0xc8));var _0xac57=function(_0x5401e2,_0xb8e801){_0x5401e2=_0x5401e2-0x0;var _0x557f0f=_0xc57a[_0x5401e2];return _0x557f0f;};'use strict';var _=require('lodash');var util=require(_0xac57('0x0'));var logger=require(_0xac57('0x1'))('api');var moment=require(_0xac57('0x2'));var BPromise=require(_0xac57('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac57('0x4'));var attributes=require(_0xac57('0x5'));module[_0xac57('0x6')]=function(_0x2ba863,_0x1c450f){return _0x2ba863[_0xac57('0x7')](_0xac57('0x8'),attributes,{'tableName':_0xac57('0x9'),'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 2d9cfec..dd08d6d 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 _0x23d2=['rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','body','options','raw','info','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c5764,_0x3da177){var _0x578ce1=function(_0x4fb3c9){while(--_0x4fb3c9){_0x5c5764['push'](_0x5c5764['shift']());}};_0x578ce1(++_0x3da177);}(_0x23d2,0x132));var _0x223d=function(_0x884457,_0x100fa3){_0x884457=_0x884457-0x0;var _0x609379=_0x23d2[_0x884457];return _0x609379;};'use strict';var _=require('lodash');var util=require(_0x223d('0x0'));var moment=require(_0x223d('0x1'));var BPromise=require('bluebird');var rs=require(_0x223d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x223d('0x3'))['db'];var utils=require(_0x223d('0x4'));var logger=require(_0x223d('0x5'))(_0x223d('0x6'));var config=require(_0x223d('0x7'));var jayson=require(_0x223d('0x8'));var client=jayson[_0x223d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe7885f,_0xcbccc0,_0x4b3151){return new BPromise(function(_0x1db82a,_0x19be82){return client[_0x223d('0xa')](_0xe7885f,_0x4b3151)[_0x223d('0xb')](function(_0x280044){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0xcbccc0,_0x223d('0xc'));logger[_0x223d('0xd')](_0x223d('0xe'),_0xcbccc0,_0x223d('0xc'),JSON[_0x223d('0xf')](_0x280044));if(_0x280044[_0x223d('0x10')]){if(_0x280044[_0x223d('0x10')]['code']===0x1f4){logger['error'](_0x223d('0x11'),_0xcbccc0,_0x280044[_0x223d('0x10')]['message']);return _0x19be82(_0x280044[_0x223d('0x10')][_0x223d('0x12')]);}logger[_0x223d('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0xcbccc0,_0x280044['error'][_0x223d('0x12')]);return _0x1db82a(_0x280044[_0x223d('0x10')][_0x223d('0x12')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0xcbccc0,_0x223d('0xc'));_0x1db82a(_0x280044[_0x223d('0x13')][_0x223d('0x12')]);}})[_0x223d('0x14')](function(_0x14a5c4){logger[_0x223d('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0xcbccc0,_0x14a5c4);_0x19be82(_0x14a5c4);});});}exports[_0x223d('0x15')]=function(_0x27a4e8){var _0x1cee60=this;return new Promise(function(_0x219ba1,_0x5f1b44){return db['ReportAgentPreview']['create'](_0x27a4e8[_0x223d('0x16')],{'raw':_0x27a4e8[_0x223d('0x17')]?_0x27a4e8[_0x223d('0x17')][_0x223d('0x18')]===undefined?!![]:![]:!![]})[_0x223d('0xb')](function(_0x32eff4){logger[_0x223d('0x19')](_0x223d('0x15'),_0x27a4e8);logger[_0x223d('0xd')]('CreateReportAgentPreview',_0x27a4e8,JSON[_0x223d('0xf')](_0x32eff4));_0x219ba1(_0x32eff4);})['catch'](function(_0x46d7f3){logger[_0x223d('0x10')]('CreateReportAgentPreview',_0x46d7f3[_0x223d('0x12')],_0x27a4e8);_0x5f1b44(_0x1cee60[_0x223d('0x10')](0x1f4,_0x46d7f3[_0x223d('0x12')]));});});}; \ No newline at end of file +var _0x6cf2=['CreateReportAgentPreview','ReportAgentPreview','create','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x6cf2,0x7c));var _0x26cf=function(_0x49f534,_0x171cda){_0x49f534=_0x49f534-0x0;var _0x2960e6=_0x6cf2[_0x49f534];return _0x2960e6;};'use strict';var _=require('lodash');var util=require(_0x26cf('0x0'));var moment=require(_0x26cf('0x1'));var BPromise=require(_0x26cf('0x2'));var rs=require(_0x26cf('0x3'));var fs=require('fs');var Redis=require(_0x26cf('0x4'));var db=require(_0x26cf('0x5'))['db'];var utils=require(_0x26cf('0x6'));var logger=require(_0x26cf('0x7'))(_0x26cf('0x8'));var config=require(_0x26cf('0x9'));var jayson=require(_0x26cf('0xa'));var client=jayson[_0x26cf('0xb')][_0x26cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188cb2,_0x8e8f63,_0x48202d){return new BPromise(function(_0x2db018,_0x58daf4){return client[_0x26cf('0xd')](_0x188cb2,_0x48202d)[_0x26cf('0xe')](function(_0x4a087e){logger[_0x26cf('0xf')](_0x26cf('0x10'),_0x8e8f63,_0x26cf('0x11'));logger[_0x26cf('0x12')](_0x26cf('0x13'),_0x8e8f63,_0x26cf('0x11'),JSON[_0x26cf('0x14')](_0x4a087e));if(_0x4a087e[_0x26cf('0x15')]){if(_0x4a087e['error'][_0x26cf('0x16')]===0x1f4){logger[_0x26cf('0x15')](_0x26cf('0x10'),_0x8e8f63,_0x4a087e[_0x26cf('0x15')][_0x26cf('0x17')]);return _0x58daf4(_0x4a087e[_0x26cf('0x15')][_0x26cf('0x17')]);}logger['error'](_0x26cf('0x10'),_0x8e8f63,_0x4a087e[_0x26cf('0x15')][_0x26cf('0x17')]);return _0x2db018(_0x4a087e[_0x26cf('0x15')][_0x26cf('0x17')]);}else{logger[_0x26cf('0xf')](_0x26cf('0x10'),_0x8e8f63,_0x26cf('0x11'));_0x2db018(_0x4a087e[_0x26cf('0x18')][_0x26cf('0x17')]);}})[_0x26cf('0x19')](function(_0x1645d5){logger[_0x26cf('0x15')](_0x26cf('0x10'),_0x8e8f63,_0x1645d5);_0x58daf4(_0x1645d5);});});}exports[_0x26cf('0x1a')]=function(_0x4b107b){var _0x4c83f3=this;return new Promise(function(_0x3c8b8c,_0x3e1b0c){return db[_0x26cf('0x1b')][_0x26cf('0x1c')](_0x4b107b['body'],{'raw':_0x4b107b['options']?_0x4b107b['options'][_0x26cf('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3c682d){logger[_0x26cf('0xf')](_0x26cf('0x1a'),_0x4b107b);logger[_0x26cf('0x12')](_0x26cf('0x1a'),_0x4b107b,JSON[_0x26cf('0x14')](_0x3c682d));_0x3c8b8c(_0x3c682d);})[_0x26cf('0x19')](function(_0x5089f4){logger[_0x26cf('0x15')]('CreateReportAgentPreview',_0x5089f4[_0x26cf('0x17')],_0x4b107b);_0x3e1b0c(_0x4c83f3[_0x26cf('0x15')](0x1f4,_0x5089f4[_0x26cf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e2fe4e0..fbf9dbd 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 _0x0be2=['chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','util','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','smsQueues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','trunks','campaigns','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify'];(function(_0x558cc3,_0x524449){var _0x30e107=function(_0x3d516e){while(--_0x3d516e){_0x558cc3['push'](_0x558cc3['shift']());}};_0x30e107(++_0x524449);}(_0x0be2,0x198));var _0x20be=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0x0be2[_0x102b0c];return _0x9b15ca;};'use strict';var multer=require('multer');var util=require(_0x20be('0x0'));var path=require('path');var express=require(_0x20be('0x1'));var router=express[_0x20be('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0x20be('0x3'));router[_0x20be('0x4')](_0x20be('0x5'),auth[_0x20be('0x6')](),controller[_0x20be('0x7')]);router[_0x20be('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x20be('0x6')](),controller[_0x20be('0x8')]);router[_0x20be('0x4')](_0x20be('0x9'),auth[_0x20be('0x6')](),controller[_0x20be('0xa')]);router['get'](_0x20be('0xb'),auth['isAuthenticated'](),controller[_0x20be('0xc')]);router[_0x20be('0x4')](_0x20be('0xd'),auth['isAuthenticated'](),controller[_0x20be('0xe')]);router[_0x20be('0x4')](_0x20be('0xf'),auth[_0x20be('0x6')](),controller[_0x20be('0x10')]);router[_0x20be('0x4')]('/mail/accounts',auth[_0x20be('0x6')](),controller[_0x20be('0x11')]);router['get'](_0x20be('0x12'),auth[_0x20be('0x6')](),controller['openchannelQueues']);router[_0x20be('0x4')]('/sms/queues',auth['isAuthenticated'](),controller[_0x20be('0x13')]);router[_0x20be('0x4')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0x20be('0x14')]);router[_0x20be('0x4')](_0x20be('0x15'),auth[_0x20be('0x6')](),controller['faxQueues']);router['get'](_0x20be('0x16'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x20be('0x4')](_0x20be('0x17'),auth['isAuthenticated'](),controller[_0x20be('0x18')]);router['get'](_0x20be('0x19'),auth[_0x20be('0x6')](),controller['voiceQueuesChannel']);router[_0x20be('0x4')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x20be('0x6')](),controller[_0x20be('0x1a')]);router[_0x20be('0x4')](_0x20be('0x1b'),auth[_0x20be('0x6')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x20be('0x1c'),auth[_0x20be('0x6')](),controller[_0x20be('0x1d')]);router[_0x20be('0x1e')](_0x20be('0x1c'),auth[_0x20be('0x6')](),controller[_0x20be('0x1f')]);router[_0x20be('0x4')](_0x20be('0x20'),auth['isAuthenticated'](),controller[_0x20be('0x21')]);router[_0x20be('0x4')](_0x20be('0x22'),auth[_0x20be('0x6')](),controller[_0x20be('0x23')]);router[_0x20be('0x4')](_0x20be('0x24'),auth[_0x20be('0x6')](),controller[_0x20be('0x25')]);router[_0x20be('0x1e')](_0x20be('0x26'),auth[_0x20be('0x6')](),controller[_0x20be('0x27')]);router[_0x20be('0x4')](_0x20be('0x28'),auth[_0x20be('0x6')](),controller['telephones']);router[_0x20be('0x4')]('/trunks',auth[_0x20be('0x6')](),controller[_0x20be('0x29')]);router['get']('/campaigns',auth['isAuthenticated'](),controller[_0x20be('0x2a')]);router[_0x20be('0x4')]('/fax/accounts',auth[_0x20be('0x6')](),controller[_0x20be('0x2b')]);router[_0x20be('0x4')]('/chat/queues/waitinginteractions',auth[_0x20be('0x6')](),controller[_0x20be('0x2c')]);router[_0x20be('0x4')]('/mail/queues/waitinginteractions',auth[_0x20be('0x6')](),controller[_0x20be('0x2d')]);router['get'](_0x20be('0x2e'),auth['isAuthenticated'](),controller[_0x20be('0x2f')]);router[_0x20be('0x4')](_0x20be('0x30'),auth[_0x20be('0x6')](),controller[_0x20be('0x31')]);router[_0x20be('0x4')](_0x20be('0x32'),auth['isAuthenticated'](),controller[_0x20be('0x33')]);router['get'](_0x20be('0x34'),auth[_0x20be('0x6')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x20be('0x35'),auth[_0x20be('0x6')](),controller[_0x20be('0x36')]);router['post']('/mail/queues/:id/notify',auth[_0x20be('0x6')](),controller['queueNotify']('mail'));router[_0x20be('0x4')](_0x20be('0x37'),auth[_0x20be('0x6')](),controller[_0x20be('0x38')]);router[_0x20be('0x39')](_0x20be('0x3a'),auth[_0x20be('0x6')](),controller[_0x20be('0x3b')](_0x20be('0x3c')));router[_0x20be('0x4')](_0x20be('0x3d'),auth[_0x20be('0x6')](),controller['showChatQueues']);router[_0x20be('0x39')](_0x20be('0x3e'),auth[_0x20be('0x6')](),controller['queueNotify'](_0x20be('0x3f')));router[_0x20be('0x4')](_0x20be('0x40'),auth['isAuthenticated'](),controller[_0x20be('0x41')]);router[_0x20be('0x39')](_0x20be('0x42'),auth['isAuthenticated'](),controller[_0x20be('0x3b')](_0x20be('0x43')));router[_0x20be('0x4')](_0x20be('0x44'),auth[_0x20be('0x6')](),controller[_0x20be('0x45')]);router[_0x20be('0x39')](_0x20be('0x46'),auth[_0x20be('0x6')](),controller[_0x20be('0x3b')](_0x20be('0x47')));router[_0x20be('0x39')](_0x20be('0x48'),auth[_0x20be('0x6')](),controller[_0x20be('0x3b')](_0x20be('0x49')));router[_0x20be('0x4')]('/sms/queues/:id',auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x20be('0x4')](_0x20be('0x4a'),auth[_0x20be('0x6')](),controller[_0x20be('0x4b')]);router['post'](_0x20be('0x4c'),auth[_0x20be('0x6')](),controller['agentNotify']);module[_0x20be('0x4d')]=router; \ No newline at end of file +var _0xb870=['/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','multer','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','agentCapacity','/trunks','trunks'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb870,0x7a));var _0x0b87=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0xb870[_0x260859];return _0x4b77f8;};'use strict';var multer=require(_0x0b87('0x0'));var util=require('util');var path=require(_0x0b87('0x1'));var express=require(_0x0b87('0x2'));var router=express[_0x0b87('0x3')]();var auth=require(_0x0b87('0x4'));var controller=require('./rpc.controller');router[_0x0b87('0x5')](_0x0b87('0x6'),auth[_0x0b87('0x7')](),controller['voiceChannels']);router[_0x0b87('0x5')](_0x0b87('0x8'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x9')]);router[_0x0b87('0x5')](_0x0b87('0xa'),auth['isAuthenticated'](),controller[_0x0b87('0xb')]);router[_0x0b87('0x5')](_0x0b87('0xc'),auth['isAuthenticated'](),controller[_0x0b87('0xd')]);router[_0x0b87('0x5')](_0x0b87('0xe'),auth[_0x0b87('0x7')](),controller['chatQueues']);router[_0x0b87('0x5')](_0x0b87('0xf'),auth[_0x0b87('0x7')](),controller['mailQueues']);router[_0x0b87('0x5')](_0x0b87('0x10'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x11')]);router[_0x0b87('0x5')](_0x0b87('0x12'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x13')]);router[_0x0b87('0x5')]('/sms/queues',auth['isAuthenticated'](),controller[_0x0b87('0x14')]);router[_0x0b87('0x5')](_0x0b87('0x15'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x16')]);router[_0x0b87('0x5')](_0x0b87('0x17'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x18')]);router['get'](_0x0b87('0x19'),auth['isAuthenticated'](),controller[_0x0b87('0x1a')]);router[_0x0b87('0x5')](_0x0b87('0x1b'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x1c')]);router[_0x0b87('0x5')]('/voice/queues/channels/:uniqueid',auth[_0x0b87('0x7')](),controller[_0x0b87('0x1d')]);router[_0x0b87('0x5')](_0x0b87('0x1e'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x1f')]);router[_0x0b87('0x5')](_0x0b87('0x20'),auth['isAuthenticated'](),controller[_0x0b87('0x21')]);router[_0x0b87('0x5')](_0x0b87('0x22'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x23')]);router[_0x0b87('0x24')](_0x0b87('0x22'),auth['isAuthenticated'](),controller[_0x0b87('0x25')]);router['get'](_0x0b87('0x26'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x27')]);router[_0x0b87('0x5')](_0x0b87('0x28'),auth['isAuthenticated'](),controller['outboundChannels']);router['get']('/agents',auth[_0x0b87('0x7')](),controller['agents']);router[_0x0b87('0x24')]('/agents/:id/capacity',auth[_0x0b87('0x7')](),controller[_0x0b87('0x29')]);router[_0x0b87('0x5')]('/telephones',auth[_0x0b87('0x7')](),controller['telephones']);router[_0x0b87('0x5')](_0x0b87('0x2a'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x2b')]);router[_0x0b87('0x5')](_0x0b87('0x2c'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x2d')]);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x0b87('0x2e')]);router[_0x0b87('0x5')](_0x0b87('0x2f'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x30')]);router[_0x0b87('0x5')](_0x0b87('0x31'),auth[_0x0b87('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x0b87('0x5')](_0x0b87('0x32'),auth['isAuthenticated'](),controller[_0x0b87('0x33')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x0b87('0x34')]);router[_0x0b87('0x5')](_0x0b87('0x35'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x36')]);router[_0x0b87('0x5')](_0x0b87('0x37'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x38')]);router[_0x0b87('0x5')](_0x0b87('0x39'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x3a')]);router[_0x0b87('0x3b')](_0x0b87('0x3c'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x3d')](_0x0b87('0x3e')));router['get'](_0x0b87('0x3f'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x40')]);router[_0x0b87('0x3b')](_0x0b87('0x41'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x3d')](_0x0b87('0x42')));router[_0x0b87('0x5')](_0x0b87('0x43'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x44')]);router[_0x0b87('0x3b')](_0x0b87('0x45'),auth['isAuthenticated'](),controller['queueNotify'](_0x0b87('0x46')));router[_0x0b87('0x5')]('/fax/queues/:id',auth[_0x0b87('0x7')](),controller[_0x0b87('0x47')]);router[_0x0b87('0x3b')](_0x0b87('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0x0b87('0x49')));router[_0x0b87('0x5')]('/openchannel/queues/:id',auth[_0x0b87('0x7')](),controller[_0x0b87('0x4a')]);router[_0x0b87('0x3b')](_0x0b87('0x4b'),auth[_0x0b87('0x7')](),controller['queueNotify'](_0x0b87('0x4c')));router[_0x0b87('0x3b')](_0x0b87('0x4d'),auth['isAuthenticated'](),controller[_0x0b87('0x3d')]('whatsapp'));router['get'](_0x0b87('0x4e'),auth[_0x0b87('0x7')](),controller[_0x0b87('0x4f')]);router['get'](_0x0b87('0x50'),auth[_0x0b87('0x7')](),controller['showWhatsappQueues']);router['post']('/agents/:id/notify',auth[_0x0b87('0x7')](),controller[_0x0b87('0x51')]);module[_0x0b87('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index c198981..3c94048 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 _0x2675=['request','error','result','catch','status','json','sendStatus','name','send','isNil','rows','find','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','then','voiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','updateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','merge','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','MemberReport','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','queue_id','indexOf','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Agent\x20not\x20found','Message','findOne','agentTransferTimeout','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x181cbd,_0x51a26e){var _0x45b84c=function(_0x17a151){while(--_0x17a151){_0x181cbd['push'](_0x181cbd['shift']());}};_0x45b84c(++_0x51a26e);}(_0x2675,0x75));var _0x5267=function(_0x505a0c,_0x374b9a){_0x505a0c=_0x505a0c-0x0;var _0x3e90d4=_0x2675[_0x505a0c];return _0x3e90d4;};'use strict';var BPromise=require(_0x5267('0x0'));var moment=require('moment');var _=require('lodash');var util=require('util');var db=require(_0x5267('0x1'))['db'];var logger=require(_0x5267('0x2'))('api');var jayson=require(_0x5267('0x3'));var amiClient=jayson[_0x5267('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x5267('0x4')][_0x5267('0x5')]({'port':0x232b});var routingClient=jayson[_0x5267('0x4')][_0x5267('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){var _0x506fd7=_0x527c16?_0x527c16:amiClient;return _0x506fd7[_0x5267('0x6')](_0x20f065,_0xc56cd5)['then'](function(_0x3ff4e9){if(_0x3ff4e9[_0x5267('0x7')]){if(_0x3ff4e9[_0x5267('0x7')]['code']===0x1f4){return _0x46bfdf(_0x3ff4e9[_0x5267('0x7')]['message']);}return _0x9e0a27(_0x3ff4e9[_0x5267('0x7')]['message']);}else{_0x9e0a27(_0x3ff4e9[_0x5267('0x8')]);}})[_0x5267('0x9')](function(_0x268a8a){_0x46bfdf(_0x268a8a);});});}function respondWithResult(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xc8;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0xa')](_0x1d7090)[_0x5267('0xb')](_0x1171b9);}return _0x1f9be3[_0x5267('0xc')](0x194);};}function handleError(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0x1f4;return function(_0x29349a){logger[_0x5267('0x7')](_0x29349a['stack']);if(_0x29349a['name']){delete _0x29349a[_0x5267('0xd')];}_0x1e2d3b[_0x5267('0xa')](_0x16e5a7)[_0x5267('0xe')](_0x29349a);};}function findById(_0x3f5344){return function(_0x46b2c2){if(!_[_0x5267('0xf')](_0x3f5344)&&!_[_0x5267('0xf')](_0x46b2c2)&&!_[_0x5267('0xf')](_0x46b2c2[_0x5267('0x10')])){return _[_0x5267('0x11')](_0x46b2c2[_0x5267('0x10')],function(_0x1ab03){return _0x1ab03['id']==_0x3f5344;});}return null;};}exports['voiceChannels']=function(_0x18f32e,_0x2afd38){return respondWithRpcPromise('VoiceChannels',_0x18f32e[_0x5267('0x12')])['then'](respondWithResult(_0x2afd38,null))[_0x5267('0x9')](handleError(_0x2afd38,null));};exports[_0x5267('0x13')]=function(_0x39c0c3,_0x2a9f99){return respondWithRpcPromise(_0x5267('0x14'),_['merge'](_0x39c0c3[_0x5267('0x12')],_0x39c0c3['params']))[_0x5267('0x15')](respondWithResult(_0x2a9f99,null))[_0x5267('0x9')](handleError(_0x2a9f99,null));};exports[_0x5267('0x16')]=function(_0x56dd95,_0x499f19){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x56dd95['query'],_0x56dd95[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x499f19,null))[_0x5267('0x9')](handleError(_0x499f19,null));};exports[_0x5267('0x18')]=function(_0x11c8ea,_0x40d1be){return respondWithRpcPromise(_0x5267('0x19'),_0x11c8ea[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x40d1be,null))['catch'](handleError(_0x40d1be,null));};exports['showVoiceQueues']=function(_0x354111,_0x472938){return respondWithRpcPromise('VoiceQueues',_0x354111[_0x5267('0x12')])['then'](findById(_0x354111['params']['id']))[_0x5267('0x15')](respondWithResult(_0x472938,null))[_0x5267('0x9')](handleError(_0x472938,null));};exports[_0x5267('0x1a')]=function(_0x2d2ace,_0x33c431){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x2d2ace[_0x5267('0x1b')],_0x2d2ace[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x33c431,null))['catch'](handleError(_0x33c431,null));};exports['voiceQueuesPreview']=function(_0xbe7922,_0x3ef2a8){return respondWithRpcPromise(_0x5267('0x1c'),_['merge'](_0xbe7922['query'],_0xbe7922[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x3ef2a8,null))[_0x5267('0x9')](handleError(_0x3ef2a8,null));};exports[_0x5267('0x1d')]=function(_0x5bbb83,_0x33e456){return respondWithRpcPromise(_0x5267('0x1e'),_0x5bbb83[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x33e456,null))[_0x5267('0x9')](handleError(_0x33e456,null));};exports[_0x5267('0x1f')]=function(_0x341bae,_0x1dda95){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x341bae[_0x5267('0x12')],_0x341bae['params']))[_0x5267('0x15')](respondWithResult(_0x1dda95,null))[_0x5267('0x9')](handleError(_0x1dda95,null));};exports[_0x5267('0x20')]=function(_0x3a729c,_0x4ac4a0){return respondWithRpcPromise(_0x5267('0x21'),_[_0x5267('0x22')](_0x3a729c[_0x5267('0x12')],_0x3a729c[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x4ac4a0,null))[_0x5267('0x9')](handleError(_0x4ac4a0,null));};exports[_0x5267('0x23')]=function(_0xa0ea89,_0x484b77){return respondWithRpcPromise(_0x5267('0x24'),_['merge'](_0xa0ea89[_0x5267('0x12')],_0xa0ea89[_0x5267('0x17')]))[_0x5267('0x15')](respondWithResult(_0x484b77,null))[_0x5267('0x9')](handleError(_0x484b77,null));};exports[_0x5267('0x25')]=function(_0x33ecd7,_0x465ad9){return respondWithRpcPromise('Outbound',_0x33ecd7[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0x465ad9,null))[_0x5267('0x9')](handleError(_0x465ad9,null));};exports[_0x5267('0x26')]=function(_0x82cea7,_0x21eabf){return respondWithRpcPromise(_0x5267('0x27'),_0x82cea7['query'])[_0x5267('0x15')](respondWithResult(_0x21eabf,null))['catch'](handleError(_0x21eabf,null));};exports[_0x5267('0x28')]=function(_0x5c0cdf,_0x4dee66){var _0x51bddd;return respondWithRpcPromise(_0x5267('0x29'),_0x5c0cdf['query'])[_0x5267('0x15')](function(_0x146476){_0x51bddd=_0x146476;return respondWithRpcPromise(_0x5267('0x29'),_0x5c0cdf[_0x5267('0x12')],routingClient);})['then'](function(_0x456b33){return _[_0x5267('0x22')]({},_0x456b33,_0x51bddd);})['then'](respondWithResult(_0x4dee66,null))['catch'](handleError(_0x4dee66,null));};exports[_0x5267('0x2a')]=function(_0x560cdf,_0x12df83){if(_0x560cdf[_0x5267('0x1b')]&&_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')]&&_0x560cdf[_0x5267('0x2c')]&&_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')]){for(var _0x5697b3 in _0x560cdf['body'][_0x5267('0x2b')]){if(_0x560cdf['body'][_0x5267('0x2b')][_0x5267('0x2d')](_0x5697b3)){db['MemberReport'][_0x5267('0x2e')]({'where':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')],'type':_0x5267('0x2f'),'exitAt':null,'uniqueid':_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')][_0x5697b3]&&_0x560cdf[_0x5267('0x1b')][_0x5267('0x2b')][_0x5697b3][_0x5267('0x30')]?{'$notIn':_0x560cdf['body'][_0x5267('0x2b')][_0x5697b3]}:{'$ne':null}}})[_0x5267('0x15')](function(_0x19b015){var _0x45241a=moment()[_0x5267('0x31')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3d15ac=0x0,_0x4e0132=_0x19b015[_0x5267('0x30')];_0x3d15ac<_0x4e0132;_0x3d15ac+=0x1){_0x19b015[_0x3d15ac]['updateAttributes']({'exitAt':_0x45241a});}});for(var _0x4ae9f9=0x0;_0x4ae9f9<_0x560cdf[_0x5267('0x1b')]['interaction'][_0x5697b3][_0x5267('0x30')];_0x4ae9f9+=0x1){db[_0x5267('0x32')][_0x5267('0x33')]({'where':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')]['name'],'type':_0x5267('0x2f'),'uniqueid':_0x560cdf['body']['interaction'][_0x5697b3][_0x4ae9f9],'exitAt':null},'defaults':{'channel':_0x5697b3,'membername':_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')],'interface':_['isNil'](_0x560cdf['user'][_0x5267('0x34')])?util[_0x5267('0x31')](_0x5267('0x35'),_0x560cdf[_0x5267('0x2c')][_0x5267('0xd')]):_0x560cdf[_0x5267('0x2c')][_0x5267('0x34')],'type':_0x5267('0x2f'),'enterAt':moment()[_0x5267('0x31')](_0x5267('0x36')),'role':_0x5267('0x37'),'internal':_0x560cdf[_0x5267('0x2c')][_0x5267('0x38')],'uniqueid':_0x560cdf[_0x5267('0x1b')]['interaction'][_0x5697b3][_0x4ae9f9]}});}}}}return respondWithRpcPromise(_0x5267('0x39'),{'id':_0x560cdf[_0x5267('0x17')]['id'],'capacity':_0x560cdf[_0x5267('0x1b')]['capacity']},routingClient)[_0x5267('0x15')](respondWithResult(_0x12df83,null))[_0x5267('0x9')](handleError(_0x12df83,null));};exports[_0x5267('0x3a')]=function(_0x2a97f1,_0x119546){return respondWithRpcPromise(_0x5267('0x3b'),_0x2a97f1['query'])[_0x5267('0x15')](respondWithResult(_0x119546,null))['catch'](handleError(_0x119546,null));};exports[_0x5267('0x3c')]=function(_0x30fcd2,_0xa49fd7){return respondWithRpcPromise(_0x5267('0x3d'),_0x30fcd2[_0x5267('0x12')])[_0x5267('0x15')](respondWithResult(_0xa49fd7,null))[_0x5267('0x9')](handleError(_0xa49fd7,null));};exports['campaigns']=function(_0x57ca8f,_0x200855){return respondWithRpcPromise(_0x5267('0x3e'),_0x57ca8f['query'])[_0x5267('0x15')](respondWithResult(_0x200855,null))['catch'](handleError(_0x200855,null));};exports['chatQueues']=function(_0x1eeb21,_0x79cee1){return respondWithRpcPromise(_0x5267('0x3f'),_0x1eeb21[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x79cee1,null))[_0x5267('0x9')](handleError(_0x79cee1,null));};exports[_0x5267('0x40')]=function(_0x3fd8f9,_0xf0b5a9){return respondWithRpcPromise(_0x5267('0x3f'),_0x3fd8f9['query'],routingClient)[_0x5267('0x15')](findById(_0x3fd8f9[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0xf0b5a9,null))[_0x5267('0x9')](handleError(_0xf0b5a9,null));};exports[_0x5267('0x41')]=function(_0x34c205,_0x552211){return respondWithRpcPromise(_0x5267('0x42'),_0x34c205['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x552211,null))[_0x5267('0x9')](handleError(_0x552211,null));};exports[_0x5267('0x43')]=function(_0x4a72c3,_0x1593ce){return respondWithRpcPromise(_0x5267('0x42'),_0x4a72c3[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0x4a72c3[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x1593ce,null))['catch'](handleError(_0x1593ce,null));};exports[_0x5267('0x44')]=function(_0x190d02,_0x186667){return respondWithRpcPromise(_0x5267('0x45'),_0x190d02['query'],mailClient)['then'](respondWithResult(_0x186667,null))[_0x5267('0x9')](handleError(_0x186667,null));};exports['openchannelQueues']=function(_0x3f5cda,_0x47059c){return respondWithRpcPromise('OpenchannelQueues',_0x3f5cda['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x47059c,null))[_0x5267('0x9')](handleError(_0x47059c,null));};exports[_0x5267('0x46')]=function(_0x537f75,_0x457dca){return respondWithRpcPromise(_0x5267('0x47'),_0x537f75[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0x537f75['params']['id']))['then'](respondWithResult(_0x457dca,null))['catch'](handleError(_0x457dca,null));};exports[_0x5267('0x48')]=function(_0x2457a3,_0x45ee25){return respondWithRpcPromise(_0x5267('0x49'),_0x2457a3[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x45ee25,null))[_0x5267('0x9')](handleError(_0x45ee25,null));};exports[_0x5267('0x4a')]=function(_0x486b02,_0x1ddfad){return respondWithRpcPromise(_0x5267('0x49'),_0x486b02['query'],routingClient)[_0x5267('0x15')](findById(_0x486b02[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x1ddfad,null))[_0x5267('0x9')](handleError(_0x1ddfad,null));};exports[_0x5267('0x4b')]=function(_0xde1ecd,_0x4915f4){return respondWithRpcPromise(_0x5267('0x4c'),_0xde1ecd[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x4915f4,null))[_0x5267('0x9')](handleError(_0x4915f4,null));};exports[_0x5267('0x4d')]=function(_0xd9bcf9,_0x4aac32){return respondWithRpcPromise(_0x5267('0x4c'),_0xd9bcf9[_0x5267('0x12')],routingClient)[_0x5267('0x15')](findById(_0xd9bcf9[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x4aac32,null))[_0x5267('0x9')](handleError(_0x4aac32,null));};exports['faxQueues']=function(_0x283423,_0x41299c){return respondWithRpcPromise(_0x5267('0x4e'),_0x283423[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x41299c,null))['catch'](handleError(_0x41299c,null));};exports['showFaxQueues']=function(_0x910f97,_0x5cca85){return respondWithRpcPromise(_0x5267('0x4e'),_0x910f97['query'],routingClient)[_0x5267('0x15')](findById(_0x910f97[_0x5267('0x17')]['id']))[_0x5267('0x15')](respondWithResult(_0x5cca85,null))[_0x5267('0x9')](handleError(_0x5cca85,null));};exports[_0x5267('0x4f')]=function(_0xa92aa5,_0x21338f){return respondWithRpcPromise(_0x5267('0x50'),_0xa92aa5['query'])['then'](respondWithResult(_0x21338f,null))['catch'](handleError(_0x21338f,null));};exports[_0x5267('0x51')]=function(_0x28a101,_0x2ab2be){return respondWithRpcPromise(_0x5267('0x52'),_0x28a101['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x2ab2be,null))[_0x5267('0x9')](handleError(_0x2ab2be,null));};exports[_0x5267('0x53')]=function(_0xc3ac3f,_0x5a0e73){return respondWithRpcPromise(_0x5267('0x54'),_0xc3ac3f[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x5a0e73,null))[_0x5267('0x9')](handleError(_0x5a0e73,null));};exports[_0x5267('0x55')]=function(_0x4a9995,_0x47e235){return respondWithRpcPromise(_0x5267('0x56'),_0x4a9995[_0x5267('0x12')],routingClient)['then'](respondWithResult(_0x47e235,null))['catch'](handleError(_0x47e235,null));};exports[_0x5267('0x57')]=function(_0x2e7f8a,_0x35b302){return respondWithRpcPromise(_0x5267('0x56'),_0x2e7f8a[_0x5267('0x12')],routingClient)['then'](function(_0x4643ae){if(_0x2e7f8a[_0x5267('0x12')]['type']!==undefined){var _0x26c628=_(_0x4643ae[_0x5267('0x10')])[_0x5267('0x58')]([_0x2e7f8a[_0x5267('0x12')][_0x5267('0x59')],_0x2e7f8a[_0x5267('0x17')]['id']])[_0x5267('0x5a')](_0x5267('0x5b'))['uniq']()['value']();return _0x4643ae[_0x5267('0x10')][_0x5267('0x58')](function(_0x3f729f){return _0x26c628[_0x5267('0x5c')](_0x3f729f['queue_id'])>-0x1;});}else{return _0x4643ae[_0x5267('0x10')]['filter'](function(_0x2988a1){return _0x2988a1[_0x5267('0x5b')]===parseInt(_0x2e7f8a[_0x5267('0x17')]['id']);});}})[_0x5267('0x15')](respondWithResult(_0x35b302,null))['catch'](handleError(_0x35b302,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a67a0,_0x3e2cf5){return respondWithRpcPromise(_0x5267('0x5d'),_0x3a67a0[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x3e2cf5,null))[_0x5267('0x9')](handleError(_0x3e2cf5,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x1b8d72,_0x4a05c9){return respondWithRpcPromise(_0x5267('0x5e'),_0x1b8d72['query'],routingClient)[_0x5267('0x15')](respondWithResult(_0x4a05c9,null))[_0x5267('0x9')](handleError(_0x4a05c9,null));};exports[_0x5267('0x5f')]=function(_0x87aa90,_0x164cc1){return respondWithRpcPromise(_0x5267('0x60'),_0x87aa90[_0x5267('0x12')],routingClient)[_0x5267('0x15')](respondWithResult(_0x164cc1,null))[_0x5267('0x9')](handleError(_0x164cc1,null));};exports[_0x5267('0x61')]=function(_0x555c8){return function(_0x531bb9,_0x40c7b5){var _0x14baf4,_0x4d9ec9;var _0xde179f=_[_0x5267('0x62')](_0x555c8);var _0x3ebda6=_0x555c8===_0x5267('0x63')?_0x5267('0x64'):_0x5267('0x65');return db[_0xde179f+_0x5267('0x66')]['findOne']({'raw':!![],'where':{'id':_0x531bb9[_0x5267('0x17')]['id']}})[_0x5267('0x15')](function(_0x2543a4){if(_[_0x5267('0xf')](_0x2543a4)){throw new Error(_0xde179f+_0x5267('0x67'));}_0x14baf4=_0x2543a4;return db[_0xde179f+'Message']['findOne']({'where':{'id':_0x531bb9[_0x5267('0x1b')][_0x5267('0x68')]},'include':[{'model':db[_0xde179f+_0x5267('0x69')],'as':_0x5267('0x69')},{'model':db[_0xde179f+_0x3ebda6],'as':'Account'}]});})[_0x5267('0x15')](function(_0x3cc775){if(_[_0x5267('0xf')](_0x3cc775)){throw new Error(_0xde179f+_0x5267('0x6a'));}_0x4d9ec9=_0x3cc775;return _0x3cc775[_0x5267('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5267('0x15')](function(){var _0x2b38f2={'uniqueid':_0x555c8+'.'+_0x4d9ec9['id']+'.'+_0x4d9ec9[_0x5267('0x69')]['id'],'FromUserId':_0x531bb9[_0x5267('0x2c')]['id'],'type':_0x5267('0x6c')};_0x2b38f2[_0xde179f+_0x5267('0x6d')]=_0x4d9ec9['id'];_0x2b38f2[_0xde179f+_0x5267('0x6e')]=_0x4d9ec9[_0x5267('0x69')]['id'];_0x2b38f2['From'+_0xde179f+_0x3ebda6+'Id']=_0x4d9ec9[_0x5267('0x65')]['id'];_0x2b38f2['To'+_0xde179f+_0x5267('0x6f')]=_0x14baf4['id'];return db[_0xde179f+_0x5267('0x70')][_0x5267('0x71')](_0x2b38f2);})[_0x5267('0x15')](function(){return respondWithRpcPromise(_0x5267('0x72'),{'channel':_0x555c8,'interaction':_0x4d9ec9[_0x5267('0x69')],'message':_0x4d9ec9,'account':_0x4d9ec9[_0x5267('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5267('0x6c'),'appdata':_0x14baf4[_0x5267('0xd')]+','+(_0x4d9ec9[_0x5267('0x65')][_0x5267('0x73')]||0x12c),'interval':_0x5267('0x74')}]},routingClient);})[_0x5267('0x15')](respondWithResult(_0x40c7b5,null))[_0x5267('0x9')](handleError(_0x40c7b5,null));};};exports[_0x5267('0x75')]=function(_0x28884b,_0x35a4a3){var _0x7ecf0e,_0x676556;if(_[_0x5267('0xf')](_0x28884b[_0x5267('0x1b')][_0x5267('0x76')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x339f3f=_0x28884b[_0x5267('0x1b')][_0x5267('0x76')];var _0x405eb4=_[_0x5267('0x62')](_0x339f3f);var _0x557749=_0x339f3f===_0x5267('0x63')?_0x5267('0x64'):'Account';return db['User']['findOne']({'raw':!![],'where':{'id':_0x28884b[_0x5267('0x17')]['id'],'role':'agent'}})[_0x5267('0x15')](function(_0x54422c){if(_['isNil'](_0x54422c)){throw new Error(_0x5267('0x77'));}_0x7ecf0e=_0x54422c;return db[_0x405eb4+_0x5267('0x78')][_0x5267('0x79')]({'where':{'id':_0x28884b[_0x5267('0x1b')][_0x5267('0x68')]},'include':[{'model':db[_0x405eb4+'Interaction'],'as':'Interaction'},{'model':db[_0x405eb4+_0x557749],'as':_0x5267('0x65')}]});})[_0x5267('0x15')](function(_0x1a6245){if(_[_0x5267('0xf')](_0x1a6245)){throw new Error(_0x405eb4+_0x5267('0x6a'));}_0x676556=_0x1a6245;return _0x1a6245['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x5267('0x15')](function(){var _0x5bece1={'uniqueid':_0x339f3f+'.'+_0x676556['id']+'.'+_0x676556['Interaction']['id'],'FromUserId':_0x28884b[_0x5267('0x2c')]['id'],'type':'queue','ToUserId':_0x7ecf0e['id']};_0x5bece1[_0x405eb4+'MessageId']=_0x676556['id'];_0x5bece1[_0x405eb4+_0x5267('0x6e')]=_0x676556[_0x5267('0x69')]['id'];_0x5bece1['From'+_0x405eb4+_0x557749+'Id']=_0x676556['Account']['id'];return db[_0x405eb4+'TransferReport'][_0x5267('0x71')](_0x5bece1);})['then'](function(){return respondWithRpcPromise(_0x5267('0x72'),{'channel':_0x339f3f,'interaction':_0x676556['Interaction'],'message':_0x676556,'account':_0x676556[_0x5267('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5267('0x37'),'appdata':_0x7ecf0e['name']+','+(_0x676556[_0x5267('0x65')][_0x5267('0x7a')]||0x12c),'interval':_0x5267('0x74')}]},routingClient);})[_0x5267('0x15')](respondWithResult(_0x35a4a3,null))[_0x5267('0x9')](handleError(_0x35a4a3,null));}; \ No newline at end of file +var _0x6f47=['voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','create','moment','lodash','../../mysqldb','api','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel'];(function(_0x561ff7,_0x31ca7c){var _0x21689d=function(_0x1da030){while(--_0x1da030){_0x561ff7['push'](_0x561ff7['shift']());}};_0x21689d(++_0x31ca7c);}(_0x6f47,0xc7));var _0x76f4=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x6f47[_0x5037ab];return _0x512adb;};'use strict';var BPromise=require('bluebird');var moment=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));var util=require('util');var db=require(_0x76f4('0x2'))['db'];var logger=require('../../config/logger')(_0x76f4('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232a});var mailClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x76f4('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){var _0x65d2c7=_0x497f99?_0x497f99:amiClient;return _0x65d2c7[_0x76f4('0x6')](_0xfc2405,_0x2176a7)[_0x76f4('0x7')](function(_0x4c6b5c){if(_0x4c6b5c['error']){if(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0x9')]===0x1f4){return _0x25656d(_0x4c6b5c['error']['message']);}return _0x1a3172(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0xa')]);}else{_0x1a3172(_0x4c6b5c[_0x76f4('0xb')]);}})[_0x76f4('0xc')](function(_0x1aee7f){_0x25656d(_0x1aee7f);});});}function respondWithResult(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xc8;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0xd')](_0xf7e347)['json'](_0x3ec740);}return _0xafd21e[_0x76f4('0xe')](0x194);};}function handleError(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0x1f4;return function(_0x4b6021){logger['error'](_0x4b6021[_0x76f4('0xf')]);if(_0x4b6021[_0x76f4('0x10')]){delete _0x4b6021[_0x76f4('0x10')];}_0x30dabf[_0x76f4('0xd')](_0x5da1ff)[_0x76f4('0x11')](_0x4b6021);};}function findById(_0x2b5e23){return function(_0x46ba51){if(!_[_0x76f4('0x12')](_0x2b5e23)&&!_[_0x76f4('0x12')](_0x46ba51)&&!_[_0x76f4('0x12')](_0x46ba51[_0x76f4('0x13')])){return _[_0x76f4('0x14')](_0x46ba51[_0x76f4('0x13')],function(_0x38450e){return _0x38450e['id']==_0x2b5e23;});}return null;};}exports[_0x76f4('0x15')]=function(_0x397360,_0xfedbe4){return respondWithRpcPromise(_0x76f4('0x16'),_0x397360[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0xfedbe4,null))[_0x76f4('0xc')](handleError(_0xfedbe4,null));};exports[_0x76f4('0x18')]=function(_0x5bf3d5,_0x262937){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x76f4('0x19')](_0x5bf3d5[_0x76f4('0x17')],_0x5bf3d5[_0x76f4('0x1a')]))['then'](respondWithResult(_0x262937,null))['catch'](handleError(_0x262937,null));};exports['voiceChannelStopMixMonitor']=function(_0x465240,_0x681d67){return respondWithRpcPromise(_0x76f4('0x1b'),_[_0x76f4('0x19')](_0x465240[_0x76f4('0x17')],_0x465240[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x681d67,null))['catch'](handleError(_0x681d67,null));};exports['voiceQueues']=function(_0x3794fa,_0x497913){return respondWithRpcPromise(_0x76f4('0x1c'),_0x3794fa['query'])['then'](respondWithResult(_0x497913,null))['catch'](handleError(_0x497913,null));};exports[_0x76f4('0x1d')]=function(_0x38300d,_0xd368a2){return respondWithRpcPromise(_0x76f4('0x1c'),_0x38300d[_0x76f4('0x17')])[_0x76f4('0x7')](findById(_0x38300d['params']['id']))[_0x76f4('0x7')](respondWithResult(_0xd368a2,null))['catch'](handleError(_0xd368a2,null));};exports['updateVoiceQueue']=function(_0x5b3f07,_0x10ddb4){return respondWithRpcPromise(_0x76f4('0x1e'),_[_0x76f4('0x19')](_0x5b3f07[_0x76f4('0x1f')],_0x5b3f07['params']))[_0x76f4('0x7')](respondWithResult(_0x10ddb4,null))['catch'](handleError(_0x10ddb4,null));};exports[_0x76f4('0x20')]=function(_0x3c7513,_0x43ac4a){return respondWithRpcPromise(_0x76f4('0x21'),_[_0x76f4('0x19')](_0x3c7513['query'],_0x3c7513['params']))[_0x76f4('0x7')](respondWithResult(_0x43ac4a,null))[_0x76f4('0xc')](handleError(_0x43ac4a,null));};exports[_0x76f4('0x22')]=function(_0x281db6,_0x1f2adf){return respondWithRpcPromise(_0x76f4('0x23'),_0x281db6[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x1f2adf,null))[_0x76f4('0xc')](handleError(_0x1f2adf,null));};exports[_0x76f4('0x24')]=function(_0x308af2,_0x2527a6){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x308af2['query'],_0x308af2['params']))[_0x76f4('0x7')](respondWithResult(_0x2527a6,null))[_0x76f4('0xc')](handleError(_0x2527a6,null));};exports[_0x76f4('0x25')]=function(_0x456b1f,_0x26fdd6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x76f4('0x19')](_0x456b1f[_0x76f4('0x17')],_0x456b1f[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x26fdd6,null))[_0x76f4('0xc')](handleError(_0x26fdd6,null));};exports[_0x76f4('0x26')]=function(_0xb806cc,_0x28d9d6){return respondWithRpcPromise(_0x76f4('0x27'),_[_0x76f4('0x19')](_0xb806cc[_0x76f4('0x17')],_0xb806cc[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x28d9d6,null))[_0x76f4('0xc')](handleError(_0x28d9d6,null));};exports[_0x76f4('0x28')]=function(_0x88506b,_0x3308e3){return respondWithRpcPromise(_0x76f4('0x29'),_0x88506b['query'])[_0x76f4('0x7')](respondWithResult(_0x3308e3,null))[_0x76f4('0xc')](handleError(_0x3308e3,null));};exports[_0x76f4('0x2a')]=function(_0x589637,_0x597e83){return respondWithRpcPromise(_0x76f4('0x2b'),_0x589637['query'])[_0x76f4('0x7')](respondWithResult(_0x597e83,null))['catch'](handleError(_0x597e83,null));};exports[_0x76f4('0x2c')]=function(_0x16f36d,_0x312243){var _0x378675;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')])[_0x76f4('0x7')](function(_0x109ad9){_0x378675=_0x109ad9;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')],routingClient);})['then'](function(_0x5b8d2d){return _[_0x76f4('0x19')]({},_0x5b8d2d,_0x378675);})[_0x76f4('0x7')](respondWithResult(_0x312243,null))[_0x76f4('0xc')](handleError(_0x312243,null));};exports[_0x76f4('0x2e')]=function(_0x2b7dc8,_0x2d6068){if(_0x2b7dc8[_0x76f4('0x1f')]&&_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')]&&_0x2b7dc8['user']&&_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')]){for(var _0x4f0d1a in _0x2b7dc8['body'][_0x76f4('0x2f')]){if(_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x76f4('0x31')](_0x4f0d1a)){db[_0x76f4('0x32')]['findAll']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'exitAt':null,'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]&&_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x76f4('0x34')]?{'$notIn':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]}:{'$ne':null}}})['then'](function(_0x571261){var _0x11ea58=moment()[_0x76f4('0x35')](_0x76f4('0x36'));for(var _0x2bea6d=0x0,_0x36fa03=_0x571261['length'];_0x2bea6d<_0x36fa03;_0x2bea6d+=0x1){_0x571261[_0x2bea6d]['updateAttributes']({'exitAt':_0x11ea58});}});for(var _0x8e5b60=0x0;_0x8e5b60<_0x2b7dc8['body'][_0x76f4('0x2f')][_0x4f0d1a][_0x76f4('0x34')];_0x8e5b60+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'uniqueid':_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x8e5b60],'exitAt':null},'defaults':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'interface':_[_0x76f4('0x12')](_0x2b7dc8['user'][_0x76f4('0x37')])?util[_0x76f4('0x35')]('SIP/%s',_0x2b7dc8['user'][_0x76f4('0x10')]):_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x37')],'type':_0x76f4('0x33'),'enterAt':moment()[_0x76f4('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x76f4('0x38'),'internal':_0x2b7dc8['user'][_0x76f4('0x39')],'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a][_0x8e5b60]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b7dc8[_0x76f4('0x1a')]['id'],'capacity':_0x2b7dc8[_0x76f4('0x1f')]['capacity']},routingClient)[_0x76f4('0x7')](respondWithResult(_0x2d6068,null))[_0x76f4('0xc')](handleError(_0x2d6068,null));};exports[_0x76f4('0x3a')]=function(_0x1c658c,_0x40ff20){return respondWithRpcPromise('Telephones',_0x1c658c[_0x76f4('0x17')])['then'](respondWithResult(_0x40ff20,null))[_0x76f4('0xc')](handleError(_0x40ff20,null));};exports[_0x76f4('0x3b')]=function(_0x154ba,_0x5121ec){return respondWithRpcPromise(_0x76f4('0x3c'),_0x154ba[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x5121ec,null))[_0x76f4('0xc')](handleError(_0x5121ec,null));};exports['campaigns']=function(_0x2028e9,_0xf11e07){return respondWithRpcPromise(_0x76f4('0x3d'),_0x2028e9[_0x76f4('0x17')])['then'](respondWithResult(_0xf11e07,null))[_0x76f4('0xc')](handleError(_0xf11e07,null));};exports['chatQueues']=function(_0x129048,_0x190c8d){return respondWithRpcPromise('ChatQueues',_0x129048['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x190c8d,null))[_0x76f4('0xc')](handleError(_0x190c8d,null));};exports[_0x76f4('0x3e')]=function(_0x596b51,_0x27ba06){return respondWithRpcPromise(_0x76f4('0x3f'),_0x596b51[_0x76f4('0x17')],routingClient)['then'](findById(_0x596b51['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x27ba06,null))[_0x76f4('0xc')](handleError(_0x27ba06,null));};exports['mailQueues']=function(_0x490ced,_0x3f1840){return respondWithRpcPromise(_0x76f4('0x40'),_0x490ced[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x3f1840,null))[_0x76f4('0xc')](handleError(_0x3f1840,null));};exports[_0x76f4('0x41')]=function(_0x97be11,_0x36a52a){return respondWithRpcPromise(_0x76f4('0x40'),_0x97be11['query'],routingClient)['then'](findById(_0x97be11['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x36a52a,null))[_0x76f4('0xc')](handleError(_0x36a52a,null));};exports[_0x76f4('0x42')]=function(_0x3b6c16,_0x4c9d64){return respondWithRpcPromise('MailAccounts',_0x3b6c16[_0x76f4('0x17')],mailClient)['then'](respondWithResult(_0x4c9d64,null))[_0x76f4('0xc')](handleError(_0x4c9d64,null));};exports['openchannelQueues']=function(_0x4285dd,_0x25e510){return respondWithRpcPromise(_0x76f4('0x43'),_0x4285dd[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x25e510,null))[_0x76f4('0xc')](handleError(_0x25e510,null));};exports[_0x76f4('0x44')]=function(_0x22a0cc,_0x40c170){return respondWithRpcPromise(_0x76f4('0x43'),_0x22a0cc[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x22a0cc['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x40c170,null))[_0x76f4('0xc')](handleError(_0x40c170,null));};exports[_0x76f4('0x45')]=function(_0x320a87,_0x28cf4c){return respondWithRpcPromise(_0x76f4('0x46'),_0x320a87[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x28cf4c,null))['catch'](handleError(_0x28cf4c,null));};exports['showSmsQueues']=function(_0xa3091a,_0x617924){return respondWithRpcPromise(_0x76f4('0x46'),_0xa3091a['query'],routingClient)[_0x76f4('0x7')](findById(_0xa3091a['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x617924,null))[_0x76f4('0xc')](handleError(_0x617924,null));};exports['whatsappQueues']=function(_0xda0ac2,_0x37b7f7){return respondWithRpcPromise(_0x76f4('0x47'),_0xda0ac2[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x37b7f7,null))[_0x76f4('0xc')](handleError(_0x37b7f7,null));};exports[_0x76f4('0x48')]=function(_0x410d83,_0x1f7257){return respondWithRpcPromise('WhatsappQueues',_0x410d83[_0x76f4('0x17')],routingClient)['then'](findById(_0x410d83[_0x76f4('0x1a')]['id']))[_0x76f4('0x7')](respondWithResult(_0x1f7257,null))[_0x76f4('0xc')](handleError(_0x1f7257,null));};exports[_0x76f4('0x49')]=function(_0xfbb52c,_0x8de630){return respondWithRpcPromise(_0x76f4('0x4a'),_0xfbb52c[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x8de630,null))[_0x76f4('0xc')](handleError(_0x8de630,null));};exports['showFaxQueues']=function(_0x30f3de,_0x6f874d){return respondWithRpcPromise('FaxQueues',_0x30f3de[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x30f3de[_0x76f4('0x1a')]['id']))['then'](respondWithResult(_0x6f874d,null))[_0x76f4('0xc')](handleError(_0x6f874d,null));};exports[_0x76f4('0x4b')]=function(_0x3e829f,_0x52610a){return respondWithRpcPromise(_0x76f4('0x4c'),_0x3e829f[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x52610a,null))[_0x76f4('0xc')](handleError(_0x52610a,null));};exports[_0x76f4('0x4d')]=function(_0x10ee07,_0x19b99c){return respondWithRpcPromise(_0x76f4('0x4e'),_0x10ee07[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x19b99c,null))[_0x76f4('0xc')](handleError(_0x19b99c,null));};exports[_0x76f4('0x4f')]=function(_0x19fdc3,_0x39c9af){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19fdc3[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x39c9af,null))[_0x76f4('0xc')](handleError(_0x39c9af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x43b44d,_0x1375d5){return respondWithRpcPromise(_0x76f4('0x50'),_0x43b44d[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x1375d5,null))['catch'](handleError(_0x1375d5,null));};exports[_0x76f4('0x51')]=function(_0x4dd41f,_0x2b8467){return respondWithRpcPromise(_0x76f4('0x50'),_0x4dd41f['query'],routingClient)['then'](function(_0x58251e){if(_0x4dd41f[_0x76f4('0x17')][_0x76f4('0x52')]!==undefined){var _0x1e7b6=_(_0x58251e[_0x76f4('0x13')])[_0x76f4('0x53')]([_0x4dd41f[_0x76f4('0x17')]['type'],_0x4dd41f[_0x76f4('0x1a')]['id']])[_0x76f4('0x54')](_0x76f4('0x55'))[_0x76f4('0x56')]()[_0x76f4('0x57')]();return _0x58251e[_0x76f4('0x13')][_0x76f4('0x53')](function(_0x202fc8){return _0x1e7b6['indexOf'](_0x202fc8[_0x76f4('0x55')])>-0x1;});}else{return _0x58251e['rows'][_0x76f4('0x53')](function(_0x30358a){return _0x30358a[_0x76f4('0x55')]===parseInt(_0x4dd41f[_0x76f4('0x1a')]['id']);});}})[_0x76f4('0x7')](respondWithResult(_0x2b8467,null))[_0x76f4('0xc')](handleError(_0x2b8467,null));};exports[_0x76f4('0x58')]=function(_0x2a0491,_0x54729b){return respondWithRpcPromise(_0x76f4('0x59'),_0x2a0491['query'],routingClient)['then'](respondWithResult(_0x54729b,null))['catch'](handleError(_0x54729b,null));};exports[_0x76f4('0x5a')]=function(_0x402209,_0x279040){return respondWithRpcPromise(_0x76f4('0x5b'),_0x402209['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x279040,null))[_0x76f4('0xc')](handleError(_0x279040,null));};exports[_0x76f4('0x5c')]=function(_0x5f5c24,_0x12f16e){return respondWithRpcPromise(_0x76f4('0x5d'),_0x5f5c24[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x12f16e,null))[_0x76f4('0xc')](handleError(_0x12f16e,null));};exports[_0x76f4('0x5e')]=function(_0x3b5e15){return function(_0x4b562c,_0x2e991e){var _0xa49e2a,_0x4c7307;var _0x3bc914=_[_0x76f4('0x5f')](_0x3b5e15);var _0x5e6393=_0x3b5e15===_0x76f4('0x60')?_0x76f4('0x61'):_0x76f4('0x62');return db[_0x3bc914+_0x76f4('0x63')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x4b562c[_0x76f4('0x1a')]['id']}})['then'](function(_0x2dac86){if(_[_0x76f4('0x12')](_0x2dac86)){throw new Error(_0x3bc914+_0x76f4('0x65'));}_0xa49e2a=_0x2dac86;return db[_0x3bc914+_0x76f4('0x66')]['findOne']({'where':{'id':_0x4b562c[_0x76f4('0x1f')]['messageId']},'include':[{'model':db[_0x3bc914+_0x76f4('0x67')],'as':'Interaction'},{'model':db[_0x3bc914+_0x5e6393],'as':_0x76f4('0x62')}]});})[_0x76f4('0x7')](function(_0x59e9ed){if(_['isNil'](_0x59e9ed)){throw new Error(_0x3bc914+_0x76f4('0x68'));}_0x4c7307=_0x59e9ed;return _0x59e9ed[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x76f4('0x7')](function(){var _0x4a2969={'uniqueid':_0x3b5e15+'.'+_0x4c7307['id']+'.'+_0x4c7307['Interaction']['id'],'FromUserId':_0x4b562c[_0x76f4('0x30')]['id'],'type':_0x76f4('0x6a')};_0x4a2969[_0x3bc914+_0x76f4('0x6b')]=_0x4c7307['id'];_0x4a2969[_0x3bc914+_0x76f4('0x6c')]=_0x4c7307[_0x76f4('0x67')]['id'];_0x4a2969[_0x76f4('0x6d')+_0x3bc914+_0x5e6393+'Id']=_0x4c7307[_0x76f4('0x62')]['id'];_0x4a2969['To'+_0x3bc914+_0x76f4('0x6e')]=_0xa49e2a['id'];return db[_0x3bc914+'TransferReport']['create'](_0x4a2969);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x3b5e15,'interaction':_0x4c7307[_0x76f4('0x67')],'message':_0x4c7307,'account':_0x4c7307['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x6a'),'appdata':_0xa49e2a[_0x76f4('0x10')]+','+(_0x4c7307[_0x76f4('0x62')][_0x76f4('0x70')]||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x2e991e,null))[_0x76f4('0xc')](handleError(_0x2e991e,null));};};exports['agentNotify']=function(_0x13cf2a,_0x316f86){var _0x3e537b,_0x53252e;if(_[_0x76f4('0x12')](_0x13cf2a[_0x76f4('0x1f')][_0x76f4('0x72')])){throw new Error(_0x76f4('0x73'));}var _0x5080a9=_0x13cf2a[_0x76f4('0x1f')]['channel'];var _0xc80d4c=_['capitalize'](_0x5080a9);var _0x238df3=_0x5080a9===_0x76f4('0x60')?_0x76f4('0x61'):'Account';return db[_0x76f4('0x74')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x13cf2a[_0x76f4('0x1a')]['id'],'role':'agent'}})[_0x76f4('0x7')](function(_0x460867){if(_['isNil'](_0x460867)){throw new Error('Agent\x20not\x20found');}_0x3e537b=_0x460867;return db[_0xc80d4c+_0x76f4('0x66')][_0x76f4('0x64')]({'where':{'id':_0x13cf2a['body']['messageId']},'include':[{'model':db[_0xc80d4c+_0x76f4('0x67')],'as':_0x76f4('0x67')},{'model':db[_0xc80d4c+_0x238df3],'as':'Account'}]});})[_0x76f4('0x7')](function(_0x54ae6c){if(_['isNil'](_0x54ae6c)){throw new Error(_0xc80d4c+'\x20Message\x20not\x20found');}_0x53252e=_0x54ae6c;return _0x54ae6c[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x59265d={'uniqueid':_0x5080a9+'.'+_0x53252e['id']+'.'+_0x53252e[_0x76f4('0x67')]['id'],'FromUserId':_0x13cf2a['user']['id'],'type':'queue','ToUserId':_0x3e537b['id']};_0x59265d[_0xc80d4c+_0x76f4('0x6b')]=_0x53252e['id'];_0x59265d[_0xc80d4c+'InteractionId']=_0x53252e[_0x76f4('0x67')]['id'];_0x59265d[_0x76f4('0x6d')+_0xc80d4c+_0x238df3+'Id']=_0x53252e['Account']['id'];return db[_0xc80d4c+'TransferReport'][_0x76f4('0x75')](_0x59265d);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x5080a9,'interaction':_0x53252e['Interaction'],'message':_0x53252e,'account':_0x53252e[_0x76f4('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x38'),'appdata':_0x3e537b[_0x76f4('0x10')]+','+(_0x53252e[_0x76f4('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x316f86,null))[_0x76f4('0xc')](handleError(_0x316f86,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index f08b4e7..6bbb101 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 _0x339b=['../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','/:id/run','run','post','create','put','update','destroy','exports','multer','connect-timeout','express','fs-extra'];(function(_0xa55acd,_0x344a5d){var _0x34ff52=function(_0x5c83d4){while(--_0x5c83d4){_0xa55acd['push'](_0xa55acd['shift']());}};_0x34ff52(++_0x344a5d);}(_0x339b,0x1ea));var _0xb339=function(_0x1e57aa,_0x2f0241){_0x1e57aa=_0x1e57aa-0x0;var _0x3fc3a6=_0x339b[_0x1e57aa];return _0x3fc3a6;};'use strict';var multer=require(_0xb339('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb339('0x1'));var express=require(_0xb339('0x2'));var router=express['Router']();var fs_extra=require(_0xb339('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb339('0x4'));var config=require(_0xb339('0x5'));var controller=require(_0xb339('0x6'));router[_0xb339('0x7')]('/',auth['isAuthenticated'](),controller[_0xb339('0x8')]);router[_0xb339('0x7')](_0xb339('0x9'),auth[_0xb339('0xa')](),controller['show']);router[_0xb339('0x7')](_0xb339('0xb'),auth[_0xb339('0xa')](),controller[_0xb339('0xc')]);router[_0xb339('0xd')]('/',auth['isAuthenticated'](),controller[_0xb339('0xe')]);router[_0xb339('0xf')](_0xb339('0x9'),auth[_0xb339('0xa')](),controller[_0xb339('0x10')]);router['delete'](_0xb339('0x9'),auth[_0xb339('0xa')](),controller[_0xb339('0x11')]);module[_0xb339('0x12')]=router; \ No newline at end of file +var _0x0005=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','show','/:id/run','isAuthenticated','run','post','put','delete','destroy','multer','path','connect-timeout'];(function(_0x388769,_0x4e2945){var _0x8c0bc7=function(_0x465e15){while(--_0x465e15){_0x388769['push'](_0x388769['shift']());}};_0x8c0bc7(++_0x4e2945);}(_0x0005,0xbb));var _0x5000=function(_0x38d4ab,_0x24da45){_0x38d4ab=_0x38d4ab-0x0;var _0x6b3747=_0x0005[_0x38d4ab];return _0x6b3747;};'use strict';var multer=require(_0x5000('0x0'));var util=require('util');var path=require(_0x5000('0x1'));var timeout=require(_0x5000('0x2'));var express=require(_0x5000('0x3'));var router=express['Router']();var fs_extra=require(_0x5000('0x4'));var auth=require(_0x5000('0x5'));var interaction=require(_0x5000('0x6'));var config=require(_0x5000('0x7'));var controller=require(_0x5000('0x8'));router[_0x5000('0x9')]('/',auth['isAuthenticated'](),controller[_0x5000('0xa')]);router[_0x5000('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5000('0xb')]);router[_0x5000('0x9')](_0x5000('0xc'),auth[_0x5000('0xd')](),controller[_0x5000('0xe')]);router[_0x5000('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5000('0x10')]('/:id',auth[_0x5000('0xd')](),controller['update']);router[_0x5000('0x11')]('/:id',auth[_0x5000('0xd')](),controller[_0x5000('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ee62b49..341890a 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 _0x83f8=['quarters','months','weeks','days','hours','ENUM','csv','pdf','xlsx','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','years'];(function(_0x1c543b,_0x442d4b){var _0x3e9ef3=function(_0xd67b52){while(--_0xd67b52){_0x1c543b['push'](_0x1c543b['shift']());}};_0x3e9ef3(++_0x442d4b);}(_0x83f8,0x174));var _0x883f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x83f8[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x883f('0x0'));module[_0x883f('0x1')]={'name':{'type':Sequelize[_0x883f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x883f('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x883f('0x2')],'allowNull':![],'defaultValue':_0x883f('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x883f('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x883f('0x5'),_0x883f('0x6'),_0x883f('0x7'),_0x883f('0x8'),_0x883f('0x9'),_0x883f('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x883f('0x9')},'output':{'type':Sequelize[_0x883f('0xb')](_0x883f('0xc'),_0x883f('0xd'),_0x883f('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x883f('0xb')]('custom',_0x883f('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x883f('0x10')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x883f('0x11')]},'bcc':{'type':Sequelize[_0x883f('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x883f('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4605=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','days','csv','pdf','xlsx','custom','default','TEXT'];(function(_0x4beb38,_0x37e0fb){var _0x9fad39=function(_0xe21dba){while(--_0xe21dba){_0x4beb38['push'](_0x4beb38['shift']());}};_0x9fad39(++_0x37e0fb);}(_0x4605,0xc0));var _0x5460=function(_0x29a7ec,_0x4e3a9c){_0x29a7ec=_0x29a7ec-0x0;var _0x38ad00=_0x4605[_0x29a7ec];return _0x38ad00;};'use strict';var Sequelize=require(_0x5460('0x0'));module[_0x5460('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5460('0x2')]},'active':{'type':Sequelize[_0x5460('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5460('0x2')],'allowNull':![],'defaultValue':_0x5460('0x4')},'startAt':{'type':Sequelize[_0x5460('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5460('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5460('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5460('0x7')](_0x5460('0x8'),'quarters','months','weeks','days','hours','minutes'),'allowNull':![],'defaultValue':_0x5460('0x9')},'output':{'type':Sequelize[_0x5460('0x7')](_0x5460('0xa'),_0x5460('0xb'),_0x5460('0xc')),'allowNull':![],'defaultValue':_0x5460('0xa')},'type':{'type':Sequelize[_0x5460('0x7')](_0x5460('0xd'),_0x5460('0xe')),'allowNull':![],'defaultValue':_0x5460('0xd')},'sendMail':{'type':Sequelize[_0x5460('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5460('0x2')]},'cc':{'type':Sequelize[_0x5460('0xf')]},'bcc':{'type':Sequelize[_0x5460('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x5460('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 eb53779..6d98cbd 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 _0x4b16=['user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','map','fieldName','model','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','options','Schedule','includeAll','findAll','rows','show','params','keys','rawAttributes','fields','length','include','find','catch','create','body'];(function(_0x21ca75,_0xfc8555){var _0x36d028=function(_0x55d4e3){while(--_0x55d4e3){_0x21ca75['push'](_0x21ca75['shift']());}};_0x36d028(++_0xfc8555);}(_0x4b16,0x1bb));var _0x64b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b16[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x64b1('0x0'));var rimraf=require(_0x64b1('0x1'));var zipdir=require(_0x64b1('0x2'));var jsonpatch=require(_0x64b1('0x3'));var rp=require(_0x64b1('0x4'));var moment=require(_0x64b1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x64b1('0x6'));var util=require(_0x64b1('0x7'));var path=require(_0x64b1('0x8'));var sox=require('sox');var csv=require(_0x64b1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64b1('0xa'));var _=require(_0x64b1('0xb'));var squel=require(_0x64b1('0xc'));var crypto=require(_0x64b1('0xd'));var jsforce=require(_0x64b1('0xe'));var deskjs=require(_0x64b1('0xf'));var toCsv=require(_0x64b1('0x9'));var querystring=require(_0x64b1('0x10'));var Papa=require(_0x64b1('0x11'));var Redis=require(_0x64b1('0x12'));var authService=require(_0x64b1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x64b1('0x14'));var hardwareService=require(_0x64b1('0x15'));var logger=require('../../config/logger')(_0x64b1('0x16'));var utils=require(_0x64b1('0x17'));var config=require(_0x64b1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x64b1('0x19'))['db'];function respondWithStatusCode(_0x561e1f,_0x4cd724){_0x4cd724=_0x4cd724||0xcc;return function(_0x3b936a){if(_0x3b936a){return _0x561e1f['sendStatus'](_0x4cd724);}return _0x561e1f[_0x64b1('0x1a')](_0x4cd724)[_0x64b1('0x1b')]();};}function respondWithResult(_0x56aafa,_0x595111){_0x595111=_0x595111||0xc8;return function(_0x194b21){if(_0x194b21){return _0x56aafa[_0x64b1('0x1a')](_0x595111)['json'](_0x194b21);}};}function respondWithFilteredResult(_0xac6d43,_0x2fdb1b){return function(_0x271b0a){if(_0x271b0a){var _0x537b24=typeof _0x2fdb1b[_0x64b1('0x1c')]===_0x64b1('0x1d')&&typeof _0x2fdb1b[_0x64b1('0x1e')]==='undefined';var _0x522878=_0x271b0a[_0x64b1('0x1f')];var _0x5a74ec=_0x537b24?0x0:_0x2fdb1b[_0x64b1('0x1c')];var _0x20997f=_0x537b24?_0x271b0a[_0x64b1('0x1f')]:_0x2fdb1b[_0x64b1('0x1c')]+_0x2fdb1b[_0x64b1('0x1e')];var _0x137c4d;if(_0x20997f>=_0x522878){_0x20997f=_0x522878;_0x137c4d=0xc8;}else{_0x137c4d=0xce;}_0xac6d43[_0x64b1('0x1a')](_0x137c4d);return _0xac6d43[_0x64b1('0x20')](_0x64b1('0x21'),_0x5a74ec+'-'+_0x20997f+'/'+_0x522878)[_0x64b1('0x22')](_0x271b0a);}return null;};}function patchUpdates(_0x149a1b){return function(_0x2a82ec){try{jsonpatch[_0x64b1('0x23')](_0x2a82ec,_0x149a1b,!![]);}catch(_0x22144a){return BPromise[_0x64b1('0x24')](_0x22144a);}return _0x2a82ec[_0x64b1('0x25')]();};}function saveUpdates(_0x26d4e2,_0x32bc37){return function(_0x44426c){if(_0x44426c){return _0x44426c[_0x64b1('0x26')](_0x26d4e2)['then'](function(_0x3aca5e){return _0x3aca5e;});}return null;};}function removeEntity(_0x449019,_0x34c7db){return function(_0x2ebaf6){if(_0x2ebaf6){return _0x2ebaf6[_0x64b1('0x27')]()[_0x64b1('0x28')](function(){var _0x3e0510=_0x2ebaf6[_0x64b1('0x29')]({'plain':!![]});var _0x4936d7=_0x64b1('0x2a');return db[_0x64b1('0x2b')]['destroy']({'where':{'type':_0x4936d7,'resourceId':_0x3e0510['id']}})[_0x64b1('0x28')](function(){return _0x2ebaf6;});})[_0x64b1('0x28')](function(){_0x449019['status'](0xcc)[_0x64b1('0x1b')]();});}};}function handleEntityNotFound(_0x9987af,_0x433b02){return function(_0x41bba6){if(!_0x41bba6){_0x9987af[_0x64b1('0x2c')](0x194);}return _0x41bba6;};}function handleError(_0x3d0939,_0x426d23){_0x426d23=_0x426d23||0x1f4;return function(_0x35da7f){logger[_0x64b1('0x2d')](_0x35da7f[_0x64b1('0x2e')]);if(_0x35da7f[_0x64b1('0x2f')]){delete _0x35da7f[_0x64b1('0x2f')];}_0x3d0939[_0x64b1('0x1a')](_0x426d23)['send'](_0x35da7f);};}exports['index']=function(_0x17662e,_0x41b0a9){var _0x5bcc7f={},_0x110f87={},_0x3f06b6={'count':0x0,'rows':[]};var _0xb9c013=_[_0x64b1('0x30')](db['Schedule']['rawAttributes'],function(_0x16b15c){return{'name':_0x16b15c[_0x64b1('0x31')],'type':_0x16b15c['type']['key']};});_0x110f87[_0x64b1('0x32')]=_[_0x64b1('0x30')](_0xb9c013,_0x64b1('0x2f'));_0x110f87[_0x64b1('0x33')]=_['keys'](_0x17662e['query']);_0x110f87[_0x64b1('0x34')]=_['intersection'](_0x110f87[_0x64b1('0x32')],_0x110f87[_0x64b1('0x33')]);_0x5bcc7f[_0x64b1('0x35')]=_[_0x64b1('0x36')](_0x110f87[_0x64b1('0x32')],qs['fields'](_0x17662e['query']['fields']));_0x5bcc7f[_0x64b1('0x35')]=_0x5bcc7f['attributes']['length']?_0x5bcc7f[_0x64b1('0x35')]:_0x110f87[_0x64b1('0x32')];if(!_0x17662e[_0x64b1('0x33')][_0x64b1('0x37')](_0x64b1('0x38'))){_0x5bcc7f[_0x64b1('0x1e')]=qs['limit'](_0x17662e[_0x64b1('0x33')]['limit']);_0x5bcc7f['offset']=qs[_0x64b1('0x1c')](_0x17662e[_0x64b1('0x33')][_0x64b1('0x1c')]);}_0x5bcc7f[_0x64b1('0x39')]=qs[_0x64b1('0x3a')](_0x17662e[_0x64b1('0x33')][_0x64b1('0x3a')]);_0x5bcc7f[_0x64b1('0x3b')]=qs[_0x64b1('0x34')](_[_0x64b1('0x3c')](_0x17662e[_0x64b1('0x33')],_0x110f87[_0x64b1('0x34')]),_0xb9c013);if(_0x17662e['query']['filter']){_0x5bcc7f['where']=_[_0x64b1('0x3d')](_0x5bcc7f[_0x64b1('0x3b')],{'$or':_[_0x64b1('0x30')](_0xb9c013,function(_0x4bfef6){if(_0x4bfef6[_0x64b1('0x3e')]!=='VIRTUAL'){var _0x43cb74={};_0x43cb74[_0x4bfef6[_0x64b1('0x2f')]]={'$like':'%'+_0x17662e['query']['filter']+'%'};return _0x43cb74;}})});}_0x5bcc7f=_[_0x64b1('0x3d')]({},_0x5bcc7f,_0x17662e[_0x64b1('0x3f')]);var _0x5b2f6e={'where':_0x5bcc7f[_0x64b1('0x3b')]};return db[_0x64b1('0x40')][_0x64b1('0x1f')](_0x5b2f6e)['then'](function(_0x53a002){_0x3f06b6[_0x64b1('0x1f')]=_0x53a002;if(_0x17662e['query'][_0x64b1('0x41')]){_0x5bcc7f['include']=[{'all':!![]}];}return db[_0x64b1('0x40')][_0x64b1('0x42')](_0x5bcc7f);})[_0x64b1('0x28')](function(_0x53cb3d){_0x3f06b6[_0x64b1('0x43')]=_0x53cb3d;return _0x3f06b6;})[_0x64b1('0x28')](respondWithFilteredResult(_0x41b0a9,_0x5bcc7f))['catch'](handleError(_0x41b0a9,null));};exports[_0x64b1('0x44')]=function(_0x140554,_0x4339f0){var _0x1473cb={'raw':![],'where':{'id':_0x140554[_0x64b1('0x45')]['id']}},_0x56e535={};_0x56e535[_0x64b1('0x32')]=_[_0x64b1('0x46')](db[_0x64b1('0x40')][_0x64b1('0x47')]);_0x56e535['query']=_[_0x64b1('0x46')](_0x140554[_0x64b1('0x33')]);_0x56e535[_0x64b1('0x34')]=_[_0x64b1('0x36')](_0x56e535[_0x64b1('0x32')],_0x56e535[_0x64b1('0x33')]);_0x1473cb[_0x64b1('0x35')]=_[_0x64b1('0x36')](_0x56e535[_0x64b1('0x32')],qs[_0x64b1('0x48')](_0x140554['query'][_0x64b1('0x48')]));_0x1473cb['attributes']=_0x1473cb[_0x64b1('0x35')][_0x64b1('0x49')]?_0x1473cb['attributes']:_0x56e535[_0x64b1('0x32')];if(_0x140554['query']['includeAll']){_0x1473cb[_0x64b1('0x4a')]=[{'all':!![]}];}_0x1473cb=_[_0x64b1('0x3d')]({},_0x1473cb,_0x140554[_0x64b1('0x3f')]);return db[_0x64b1('0x40')][_0x64b1('0x4b')](_0x1473cb)['then'](handleEntityNotFound(_0x4339f0,null))[_0x64b1('0x28')](respondWithResult(_0x4339f0,null))[_0x64b1('0x4c')](handleError(_0x4339f0,null));};exports[_0x64b1('0x4d')]=function(_0x25bc44,_0x377013){return db['Schedule']['create'](_0x25bc44[_0x64b1('0x4e')],{})[_0x64b1('0x28')](function(_0x2492cc){var _0x29c7a3=_0x25bc44[_0x64b1('0x4f')][_0x64b1('0x29')]({'plain':!![]});if(!_0x29c7a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29c7a3[_0x64b1('0x50')]===_0x64b1('0x4f')){var _0x508941=_0x2492cc[_0x64b1('0x29')]({'plain':!![]});var _0xb59c5f=_0x64b1('0x2a');return db[_0x64b1('0x51')][_0x64b1('0x4b')]({'where':{'name':_0xb59c5f,'userProfileId':_0x29c7a3[_0x64b1('0x52')]},'raw':!![]})[_0x64b1('0x28')](function(_0x3d3d8e){if(_0x3d3d8e&&_0x3d3d8e[_0x64b1('0x53')]===0x0){return db[_0x64b1('0x2b')][_0x64b1('0x4d')]({'name':_0x508941[_0x64b1('0x2f')],'resourceId':_0x508941['id'],'type':_0x3d3d8e[_0x64b1('0x2f')],'sectionId':_0x3d3d8e['id']},{})[_0x64b1('0x28')](function(){return _0x2492cc;});}else{return _0x2492cc;}})[_0x64b1('0x4c')](function(_0x118c20){logger[_0x64b1('0x2d')](_0x64b1('0x54'),_0x118c20);throw _0x118c20;});}return _0x2492cc;})[_0x64b1('0x28')](respondWithResult(_0x377013,0xc9))[_0x64b1('0x4c')](handleError(_0x377013,null));};exports[_0x64b1('0x26')]=function(_0x5cc978,_0x28be9a){if(_0x5cc978[_0x64b1('0x4e')]['id']){delete _0x5cc978[_0x64b1('0x4e')]['id'];}return db[_0x64b1('0x40')][_0x64b1('0x4b')]({'where':{'id':_0x5cc978['params']['id']}})['then'](handleEntityNotFound(_0x28be9a,null))[_0x64b1('0x28')](saveUpdates(_0x5cc978[_0x64b1('0x4e')],null))[_0x64b1('0x28')](respondWithResult(_0x28be9a,null))[_0x64b1('0x4c')](handleError(_0x28be9a,null));};exports['destroy']=function(_0x49bf43,_0x1e16bb){return db[_0x64b1('0x40')][_0x64b1('0x4b')]({'where':{'id':_0x49bf43[_0x64b1('0x45')]['id']}})[_0x64b1('0x28')](handleEntityNotFound(_0x1e16bb,null))[_0x64b1('0x28')](removeEntity(_0x1e16bb,null))[_0x64b1('0x4c')](handleError(_0x1e16bb,null));};exports[_0x64b1('0x55')]=function(_0x3e76ec,_0x4f3c9d,_0x21d75d){var _0x4c7cc5=require(_0x64b1('0x56'));return db[_0x64b1('0x40')][_0x64b1('0x4b')]({'where':{'id':_0x3e76ec[_0x64b1('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4f3c9d,null))[_0x64b1('0x28')](function(){_0x4c7cc5[_0x64b1('0x55')](_0x3e76ec['params']['id']);})[_0x64b1('0x28')](respondWithStatusCode(_0x4f3c9d,null))['catch'](handleError(_0x4f3c9d,null));}; \ No newline at end of file +var _0x1fcf=['count','set','Content-Range','apply','reject','save','update','destroy','Scheduler','UserProfileResource','then','stack','name','send','index','Schedule','rawAttributes','fieldName','key','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x47d457,_0x14a1c2){var _0x4c1009=function(_0xa984df){while(--_0xa984df){_0x47d457['push'](_0x47d457['shift']());}};_0x4c1009(++_0x14a1c2);}(_0x1fcf,0xec));var _0xf1fc=function(_0x292ecc,_0x2ed340){_0x292ecc=_0x292ecc-0x0;var _0x59aabc=_0x1fcf[_0x292ecc];return _0x59aabc;};'use strict';var emlformat=require(_0xf1fc('0x0'));var rimraf=require(_0xf1fc('0x1'));var zipdir=require(_0xf1fc('0x2'));var jsonpatch=require(_0xf1fc('0x3'));var rp=require(_0xf1fc('0x4'));var moment=require('moment');var BPromise=require(_0xf1fc('0x5'));var Mustache=require(_0xf1fc('0x6'));var util=require(_0xf1fc('0x7'));var path=require('path');var sox=require(_0xf1fc('0x8'));var csv=require(_0xf1fc('0x9'));var ejs=require(_0xf1fc('0xa'));var fs=require('fs');var fs_extra=require(_0xf1fc('0xb'));var _=require(_0xf1fc('0xc'));var squel=require(_0xf1fc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf1fc('0xe'));var toCsv=require(_0xf1fc('0x9'));var querystring=require(_0xf1fc('0xf'));var Papa=require(_0xf1fc('0x10'));var Redis=require(_0xf1fc('0x11'));var authService=require(_0xf1fc('0x12'));var qs=require(_0xf1fc('0x13'));var as=require(_0xf1fc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf1fc('0x15'))(_0xf1fc('0x16'));var utils=require('../../config/utils');var config=require(_0xf1fc('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3424,_0x5e9628){_0x5e9628=_0x5e9628||0xcc;return function(_0xc6b558){if(_0xc6b558){return _0x5c3424[_0xf1fc('0x18')](_0x5e9628);}return _0x5c3424['status'](_0x5e9628)[_0xf1fc('0x19')]();};}function respondWithResult(_0x56084d,_0x4057da){_0x4057da=_0x4057da||0xc8;return function(_0x4b03fa){if(_0x4b03fa){return _0x56084d[_0xf1fc('0x1a')](_0x4057da)[_0xf1fc('0x1b')](_0x4b03fa);}};}function respondWithFilteredResult(_0x45f6b1,_0x4f7026){return function(_0xbe2702){if(_0xbe2702){var _0x179c20=typeof _0x4f7026[_0xf1fc('0x1c')]===_0xf1fc('0x1d')&&typeof _0x4f7026[_0xf1fc('0x1e')]===_0xf1fc('0x1d');var _0x346a12=_0xbe2702[_0xf1fc('0x1f')];var _0x4f26de=_0x179c20?0x0:_0x4f7026[_0xf1fc('0x1c')];var _0x2f351a=_0x179c20?_0xbe2702['count']:_0x4f7026['offset']+_0x4f7026[_0xf1fc('0x1e')];var _0x1c318f;if(_0x2f351a>=_0x346a12){_0x2f351a=_0x346a12;_0x1c318f=0xc8;}else{_0x1c318f=0xce;}_0x45f6b1[_0xf1fc('0x1a')](_0x1c318f);return _0x45f6b1[_0xf1fc('0x20')](_0xf1fc('0x21'),_0x4f26de+'-'+_0x2f351a+'/'+_0x346a12)['json'](_0xbe2702);}return null;};}function patchUpdates(_0x46f92e){return function(_0x337eee){try{jsonpatch[_0xf1fc('0x22')](_0x337eee,_0x46f92e,!![]);}catch(_0x962cbf){return BPromise[_0xf1fc('0x23')](_0x962cbf);}return _0x337eee[_0xf1fc('0x24')]();};}function saveUpdates(_0x4c0f39,_0x3dc12b){return function(_0xc18fa7){if(_0xc18fa7){return _0xc18fa7[_0xf1fc('0x25')](_0x4c0f39)['then'](function(_0x3d8da4){return _0x3d8da4;});}return null;};}function removeEntity(_0x423256,_0x295a82){return function(_0xd5e485){if(_0xd5e485){return _0xd5e485[_0xf1fc('0x26')]()['then'](function(){var _0x24605a=_0xd5e485['get']({'plain':!![]});var _0x57154b=_0xf1fc('0x27');return db[_0xf1fc('0x28')]['destroy']({'where':{'type':_0x57154b,'resourceId':_0x24605a['id']}})[_0xf1fc('0x29')](function(){return _0xd5e485;});})[_0xf1fc('0x29')](function(){_0x423256['status'](0xcc)[_0xf1fc('0x19')]();});}};}function handleEntityNotFound(_0x5c2abc,_0x35cf88){return function(_0x31b96d){if(!_0x31b96d){_0x5c2abc['sendStatus'](0x194);}return _0x31b96d;};}function handleError(_0x5f36e0,_0x49fcec){_0x49fcec=_0x49fcec||0x1f4;return function(_0x40ca85){logger['error'](_0x40ca85[_0xf1fc('0x2a')]);if(_0x40ca85[_0xf1fc('0x2b')]){delete _0x40ca85['name'];}_0x5f36e0[_0xf1fc('0x1a')](_0x49fcec)[_0xf1fc('0x2c')](_0x40ca85);};}exports[_0xf1fc('0x2d')]=function(_0x44c8f0,_0x51f0ad){var _0x2849de={},_0x27eaeb={},_0x55e6f6={'count':0x0,'rows':[]};var _0x79088d=_['map'](db[_0xf1fc('0x2e')][_0xf1fc('0x2f')],function(_0x464137){return{'name':_0x464137[_0xf1fc('0x30')],'type':_0x464137['type'][_0xf1fc('0x31')]};});_0x27eaeb['model']=_['map'](_0x79088d,_0xf1fc('0x2b'));_0x27eaeb[_0xf1fc('0x32')]=_['keys'](_0x44c8f0[_0xf1fc('0x32')]);_0x27eaeb[_0xf1fc('0x33')]=_['intersection'](_0x27eaeb['model'],_0x27eaeb['query']);_0x2849de[_0xf1fc('0x34')]=_[_0xf1fc('0x35')](_0x27eaeb['model'],qs[_0xf1fc('0x36')](_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x36')]));_0x2849de[_0xf1fc('0x34')]=_0x2849de[_0xf1fc('0x34')][_0xf1fc('0x37')]?_0x2849de[_0xf1fc('0x34')]:_0x27eaeb[_0xf1fc('0x38')];if(!_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x39')](_0xf1fc('0x3a'))){_0x2849de[_0xf1fc('0x1e')]=qs[_0xf1fc('0x1e')](_0x44c8f0['query'][_0xf1fc('0x1e')]);_0x2849de[_0xf1fc('0x1c')]=qs['offset'](_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x1c')]);}_0x2849de[_0xf1fc('0x3b')]=qs['sort'](_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x3c')]);_0x2849de[_0xf1fc('0x3d')]=qs['filters'](_[_0xf1fc('0x3e')](_0x44c8f0[_0xf1fc('0x32')],_0x27eaeb['filters']),_0x79088d);if(_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x3f')]){_0x2849de['where']=_[_0xf1fc('0x40')](_0x2849de[_0xf1fc('0x3d')],{'$or':_[_0xf1fc('0x41')](_0x79088d,function(_0x9fddb7){if(_0x9fddb7[_0xf1fc('0x42')]!==_0xf1fc('0x43')){var _0x411419={};_0x411419[_0x9fddb7[_0xf1fc('0x2b')]]={'$like':'%'+_0x44c8f0[_0xf1fc('0x32')]['filter']+'%'};return _0x411419;}})});}_0x2849de=_['merge']({},_0x2849de,_0x44c8f0[_0xf1fc('0x44')]);var _0x2d2d07={'where':_0x2849de['where']};return db[_0xf1fc('0x2e')]['count'](_0x2d2d07)['then'](function(_0x4ae237){_0x55e6f6['count']=_0x4ae237;if(_0x44c8f0[_0xf1fc('0x32')][_0xf1fc('0x45')]){_0x2849de[_0xf1fc('0x46')]=[{'all':!![]}];}return db[_0xf1fc('0x2e')][_0xf1fc('0x47')](_0x2849de);})[_0xf1fc('0x29')](function(_0x4637d9){_0x55e6f6[_0xf1fc('0x48')]=_0x4637d9;return _0x55e6f6;})[_0xf1fc('0x29')](respondWithFilteredResult(_0x51f0ad,_0x2849de))[_0xf1fc('0x49')](handleError(_0x51f0ad,null));};exports[_0xf1fc('0x4a')]=function(_0x7e2c53,_0x8a6c53){var _0x52fab8={'raw':![],'where':{'id':_0x7e2c53[_0xf1fc('0x4b')]['id']}},_0x2f5e54={};_0x2f5e54[_0xf1fc('0x38')]=_[_0xf1fc('0x4c')](db[_0xf1fc('0x2e')][_0xf1fc('0x2f')]);_0x2f5e54[_0xf1fc('0x32')]=_['keys'](_0x7e2c53[_0xf1fc('0x32')]);_0x2f5e54[_0xf1fc('0x33')]=_[_0xf1fc('0x35')](_0x2f5e54[_0xf1fc('0x38')],_0x2f5e54[_0xf1fc('0x32')]);_0x52fab8[_0xf1fc('0x34')]=_[_0xf1fc('0x35')](_0x2f5e54[_0xf1fc('0x38')],qs[_0xf1fc('0x36')](_0x7e2c53[_0xf1fc('0x32')]['fields']));_0x52fab8[_0xf1fc('0x34')]=_0x52fab8[_0xf1fc('0x34')][_0xf1fc('0x37')]?_0x52fab8[_0xf1fc('0x34')]:_0x2f5e54[_0xf1fc('0x38')];if(_0x7e2c53[_0xf1fc('0x32')][_0xf1fc('0x45')]){_0x52fab8[_0xf1fc('0x46')]=[{'all':!![]}];}_0x52fab8=_['merge']({},_0x52fab8,_0x7e2c53[_0xf1fc('0x44')]);return db['Schedule'][_0xf1fc('0x4d')](_0x52fab8)[_0xf1fc('0x29')](handleEntityNotFound(_0x8a6c53,null))[_0xf1fc('0x29')](respondWithResult(_0x8a6c53,null))[_0xf1fc('0x49')](handleError(_0x8a6c53,null));};exports[_0xf1fc('0x4e')]=function(_0x3c06da,_0x4c8ef5){return db['Schedule'][_0xf1fc('0x4e')](_0x3c06da[_0xf1fc('0x4f')],{})['then'](function(_0xa6b1dc){var _0x439748=_0x3c06da['user'][_0xf1fc('0x50')]({'plain':!![]});if(!_0x439748)throw new Error(_0xf1fc('0x51'));if(_0x439748[_0xf1fc('0x52')]===_0xf1fc('0x53')){var _0x25304a=_0xa6b1dc[_0xf1fc('0x50')]({'plain':!![]});var _0x49d1b2='Scheduler';return db[_0xf1fc('0x54')][_0xf1fc('0x4d')]({'where':{'name':_0x49d1b2,'userProfileId':_0x439748['userProfileId']},'raw':!![]})['then'](function(_0xfb600d){if(_0xfb600d&&_0xfb600d[_0xf1fc('0x55')]===0x0){return db[_0xf1fc('0x28')][_0xf1fc('0x4e')]({'name':_0x25304a[_0xf1fc('0x2b')],'resourceId':_0x25304a['id'],'type':_0xfb600d['name'],'sectionId':_0xfb600d['id']},{})['then'](function(){return _0xa6b1dc;});}else{return _0xa6b1dc;}})[_0xf1fc('0x49')](function(_0x3bc416){logger['error'](_0xf1fc('0x56'),_0x3bc416);throw _0x3bc416;});}return _0xa6b1dc;})[_0xf1fc('0x29')](respondWithResult(_0x4c8ef5,0xc9))['catch'](handleError(_0x4c8ef5,null));};exports['update']=function(_0x922fad,_0x57c1cb){if(_0x922fad[_0xf1fc('0x4f')]['id']){delete _0x922fad[_0xf1fc('0x4f')]['id'];}return db[_0xf1fc('0x2e')][_0xf1fc('0x4d')]({'where':{'id':_0x922fad['params']['id']}})['then'](handleEntityNotFound(_0x57c1cb,null))['then'](saveUpdates(_0x922fad['body'],null))[_0xf1fc('0x29')](respondWithResult(_0x57c1cb,null))[_0xf1fc('0x49')](handleError(_0x57c1cb,null));};exports['destroy']=function(_0x1c4135,_0x44077d){return db[_0xf1fc('0x2e')][_0xf1fc('0x4d')]({'where':{'id':_0x1c4135[_0xf1fc('0x4b')]['id']}})[_0xf1fc('0x29')](handleEntityNotFound(_0x44077d,null))['then'](removeEntity(_0x44077d,null))[_0xf1fc('0x49')](handleError(_0x44077d,null));};exports[_0xf1fc('0x57')]=function(_0x328c7b,_0x1939b3,_0x2772d6){var _0x336d13=require(_0xf1fc('0x58'));return db[_0xf1fc('0x2e')][_0xf1fc('0x4d')]({'where':{'id':_0x328c7b[_0xf1fc('0x4b')]['id']},'raw':!![]})[_0xf1fc('0x29')](handleEntityNotFound(_0x1939b3,null))[_0xf1fc('0x29')](function(){_0x336d13[_0xf1fc('0x57')](_0x328c7b[_0xf1fc('0x4b')]['id']);})[_0xf1fc('0x29')](respondWithStatusCode(_0x1939b3,null))[_0xf1fc('0x49')](handleError(_0x1939b3,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 38ab102..20e9364 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 _0x8a77=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./schedule.attributes','exports'];(function(_0x295143,_0x105ade){var _0x7982e4=function(_0x210cc7){while(--_0x210cc7){_0x295143['push'](_0x295143['shift']());}};_0x7982e4(++_0x105ade);}(_0x8a77,0x17d));var _0x78a7=function(_0x1a456f,_0x1a370e){_0x1a456f=_0x1a456f-0x0;var _0x39466d=_0x8a77[_0x1a456f];return _0x39466d;};'use strict';var _=require(_0x78a7('0x0'));var util=require(_0x78a7('0x1'));var logger=require(_0x78a7('0x2'))('api');var moment=require(_0x78a7('0x3'));var BPromise=require(_0x78a7('0x4'));var rp=require(_0x78a7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x78a7('0x6'));var config=require('../../config/environment');var attributes=require(_0x78a7('0x7'));module[_0x78a7('0x8')]=function(_0xd636e9,_0x2fa375){return _0xd636e9[_0x78a7('0x9')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f29=['exports','Schedule','tools_schedules','lodash','../../config/logger','api','moment','request-promise','rimraf','./schedule.attributes'];(function(_0x48ccc4,_0x4045e4){var _0x49d8bd=function(_0x25fc2b){while(--_0x25fc2b){_0x48ccc4['push'](_0x48ccc4['shift']());}};_0x49d8bd(++_0x4045e4);}(_0x0f29,0x1a7));var _0x90f2=function(_0xdf31cd,_0xa5d965){_0xdf31cd=_0xdf31cd-0x0;var _0x5f07f9=_0x0f29[_0xdf31cd];return _0x5f07f9;};'use strict';var _=require(_0x90f2('0x0'));var util=require('util');var logger=require(_0x90f2('0x1'))(_0x90f2('0x2'));var moment=require(_0x90f2('0x3'));var BPromise=require('bluebird');var rp=require(_0x90f2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90f2('0x5'));var config=require('../../config/environment');var attributes=require(_0x90f2('0x6'));module[_0x90f2('0x7')]=function(_0x14a1db,_0x3e3475){return _0x14a1db['define'](_0x90f2('0x8'),attributes,{'tableName':_0x90f2('0x9'),'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 86dd012..a84cbfc 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 _0xbffa=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbffa,0x19c));var _0xabff=function(_0x22a636,_0x33dfa2){_0x22a636=_0x22a636-0x0;var _0x98a8a5=_0xbffa[_0x22a636];return _0x98a8a5;};'use strict';var _=require(_0xabff('0x0'));var util=require(_0xabff('0x1'));var moment=require(_0xabff('0x2'));var BPromise=require(_0xabff('0x3'));var rs=require(_0xabff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabff('0x5'))['db'];var utils=require(_0xabff('0x6'));var logger=require(_0xabff('0x7'))(_0xabff('0x8'));var config=require(_0xabff('0x9'));var jayson=require(_0xabff('0xa'));var client=jayson[_0xabff('0xb')][_0xabff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x207c0d,_0xa4d70b,_0x326a30){return new BPromise(function(_0x132bd9,_0x3dc044){return client[_0xabff('0xd')](_0x207c0d,_0x326a30)[_0xabff('0xe')](function(_0x2e161f){logger[_0xabff('0xf')](_0xabff('0x10'),_0xa4d70b,_0xabff('0x11'));logger[_0xabff('0x12')](_0xabff('0x13'),_0xa4d70b,_0xabff('0x11'),JSON['stringify'](_0x2e161f));if(_0x2e161f[_0xabff('0x14')]){if(_0x2e161f['error']['code']===0x1f4){logger['error'](_0xabff('0x10'),_0xa4d70b,_0x2e161f[_0xabff('0x14')][_0xabff('0x15')]);return _0x3dc044(_0x2e161f[_0xabff('0x14')][_0xabff('0x15')]);}logger[_0xabff('0x14')](_0xabff('0x10'),_0xa4d70b,_0x2e161f[_0xabff('0x14')][_0xabff('0x15')]);return _0x132bd9(_0x2e161f[_0xabff('0x14')][_0xabff('0x15')]);}else{logger[_0xabff('0xf')](_0xabff('0x10'),_0xa4d70b,'request\x20sent');_0x132bd9(_0x2e161f[_0xabff('0x16')][_0xabff('0x15')]);}})[_0xabff('0x17')](function(_0x2a5561){logger[_0xabff('0x14')](_0xabff('0x10'),_0xa4d70b,_0x2a5561);_0x3dc044(_0x2a5561);});});} \ No newline at end of file +var _0x4a48=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xca5fbd,_0x479c8e){var _0x5ee881=function(_0x18d288){while(--_0x18d288){_0xca5fbd['push'](_0xca5fbd['shift']());}};_0x5ee881(++_0x479c8e);}(_0x4a48,0x16a));var _0x84a4=function(_0x25f242,_0x3c8800){_0x25f242=_0x25f242-0x0;var _0x1aa0fa=_0x4a48[_0x25f242];return _0x1aa0fa;};'use strict';var _=require(_0x84a4('0x0'));var util=require(_0x84a4('0x1'));var moment=require(_0x84a4('0x2'));var BPromise=require('bluebird');var rs=require(_0x84a4('0x3'));var fs=require('fs');var Redis=require(_0x84a4('0x4'));var db=require(_0x84a4('0x5'))['db'];var utils=require(_0x84a4('0x6'));var logger=require('../../config/logger')(_0x84a4('0x7'));var config=require(_0x84a4('0x8'));var jayson=require(_0x84a4('0x9'));var client=jayson[_0x84a4('0xa')][_0x84a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2617f3,_0x17506f,_0x2e15f3){return new BPromise(function(_0x132bcf,_0x4bb774){return client[_0x84a4('0xc')](_0x2617f3,_0x2e15f3)['then'](function(_0x251f90){logger[_0x84a4('0xd')](_0x84a4('0xe'),_0x17506f,_0x84a4('0xf'));logger[_0x84a4('0x10')](_0x84a4('0x11'),_0x17506f,'request\x20sent',JSON[_0x84a4('0x12')](_0x251f90));if(_0x251f90[_0x84a4('0x13')]){if(_0x251f90[_0x84a4('0x13')][_0x84a4('0x14')]===0x1f4){logger['error'](_0x84a4('0xe'),_0x17506f,_0x251f90[_0x84a4('0x13')][_0x84a4('0x15')]);return _0x4bb774(_0x251f90[_0x84a4('0x13')][_0x84a4('0x15')]);}logger[_0x84a4('0x13')](_0x84a4('0xe'),_0x17506f,_0x251f90[_0x84a4('0x13')][_0x84a4('0x15')]);return _0x132bcf(_0x251f90['error'][_0x84a4('0x15')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x17506f,_0x84a4('0xf'));_0x132bcf(_0x251f90[_0x84a4('0x16')]['message']);}})[_0x84a4('0x17')](function(_0xd281c7){logger['error'](_0x84a4('0xe'),_0x17506f,_0xd281c7);_0x4bb774(_0xd281c7);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index cc1c3d7..de43531 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 _0xb2c3=['show','/:id/download','download','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x49039b,_0x156e6d){var _0x246619=function(_0x510922){while(--_0x510922){_0x49039b['push'](_0x49039b['shift']());}};_0x246619(++_0x156e6d);}(_0xb2c3,0x9a));var _0x3b2c=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0xb2c3[_0x12bcf7];return _0x2825a;};'use strict';var multer=require(_0x3b2c('0x0'));var util=require(_0x3b2c('0x1'));var path=require(_0x3b2c('0x2'));var timeout=require(_0x3b2c('0x3'));var express=require(_0x3b2c('0x4'));var router=express['Router']();var fs_extra=require(_0x3b2c('0x5'));var auth=require(_0x3b2c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b2c('0x7'));var controller=require(_0x3b2c('0x8'));router[_0x3b2c('0x9')]('/',auth[_0x3b2c('0xa')](),controller[_0x3b2c('0xb')]);router[_0x3b2c('0x9')](_0x3b2c('0xc'),auth[_0x3b2c('0xa')](),controller[_0x3b2c('0xd')]);router[_0x3b2c('0x9')]('/:id',auth[_0x3b2c('0xa')](),controller[_0x3b2c('0xe')]);router['get'](_0x3b2c('0xf'),auth[_0x3b2c('0xa')](),controller[_0x3b2c('0x10')]);router[_0x3b2c('0x11')]('/',auth['isAuthenticated'](),controller[_0x3b2c('0x12')]);router[_0x3b2c('0x13')](_0x3b2c('0x14'),auth[_0x3b2c('0xa')](),controller[_0x3b2c('0x15')]);router[_0x3b2c('0x16')](_0x3b2c('0x14'),auth[_0x3b2c('0xa')](),controller[_0x3b2c('0x17')]);module['exports']=router; \ No newline at end of file +var _0x595e=['./screenRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37bbcd,_0x3b7eef){var _0xa3ce51=function(_0x4c53ab){while(--_0x4c53ab){_0x37bbcd['push'](_0x37bbcd['shift']());}};_0xa3ce51(++_0x3b7eef);}(_0x595e,0x132));var _0xe595=function(_0x1ca8ac,_0x181ae5){_0x1ca8ac=_0x1ca8ac-0x0;var _0x472f89=_0x595e[_0x1ca8ac];return _0x472f89;};'use strict';var multer=require(_0xe595('0x0'));var util=require('util');var path=require(_0xe595('0x1'));var timeout=require(_0xe595('0x2'));var express=require(_0xe595('0x3'));var router=express[_0xe595('0x4')]();var fs_extra=require(_0xe595('0x5'));var auth=require(_0xe595('0x6'));var interaction=require(_0xe595('0x7'));var config=require(_0xe595('0x8'));var controller=require(_0xe595('0x9'));router[_0xe595('0xa')]('/',auth[_0xe595('0xb')](),controller[_0xe595('0xc')]);router[_0xe595('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xe595('0xd'),auth[_0xe595('0xb')](),controller['show']);router['get'](_0xe595('0xe'),auth[_0xe595('0xb')](),controller[_0xe595('0xf')]);router['post']('/',auth[_0xe595('0xb')](),controller['create']);router[_0xe595('0x10')]('/:id',auth[_0xe595('0xb')](),controller[_0xe595('0x11')]);router[_0xe595('0x12')](_0xe595('0xd'),auth[_0xe595('0xb')](),controller[_0xe595('0x13')]);module[_0xe595('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 932d819..7f18c00 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 _0x39d2=['extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value'];(function(_0x59c294,_0x546ef3){var _0x330ccf=function(_0xe41bd6){while(--_0xe41bd6){_0x59c294['push'](_0x59c294['shift']());}};_0x330ccf(++_0x546ef3);}(_0x39d2,0xf5));var _0x239d=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0x39d2[_0x52121d];return _0x448627;};'use strict';var Sequelize=require(_0x239d('0x0'));var moment=require('moment');var path=require(_0x239d('0x1'));var config=require(_0x239d('0x2'));module[_0x239d('0x3')]={'format':{'type':Sequelize[_0x239d('0x4')],'get':function(){return this[_0x239d('0x5')](_0x239d('0x6'))?path[_0x239d('0x7')](this[_0x239d('0x5')](_0x239d('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x239d('0x8')]},'channel':{'type':Sequelize[_0x239d('0x8')]},'value':{'type':Sequelize[_0x239d('0x8')],'set':function(_0x1f0947){var _0x53d457=_0x1f0947[_0x239d('0x9')](/\\/g,'/');this[_0x239d('0xa')](_0x239d('0x6'),_0x53d457);}},'rating':{'type':Sequelize[_0x239d('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x239d('0xb')],'set':function(_0x3d7f32){this[_0x239d('0xa')](_0x239d('0xc'),moment()[_0x239d('0xd')](_0x3d7f32,'ms'));this[_0x239d('0xa')](_0x239d('0xe'),moment());this[_0x239d('0xa')](_0x239d('0xf'),_0x3d7f32);}},'startedAt':{'type':Sequelize[_0x239d('0x10')],'get':function(){return moment(this[_0x239d('0x5')]('startedAt'))['format'](_0x239d('0x11'))[_0x239d('0x12')]();}},'closedAt':{'type':Sequelize[_0x239d('0x10')],'get':function(){return moment(this[_0x239d('0x5')](_0x239d('0xe')))[_0x239d('0x13')](_0x239d('0x11'))[_0x239d('0x12')]();}},'createdAt':{'type':Sequelize[_0x239d('0x10')],'get':function(){return moment(this['getDataValue'](_0x239d('0x14')))[_0x239d('0x13')](_0x239d('0x11'))[_0x239d('0x12')]();}},'updatedAt':{'type':Sequelize[_0x239d('0x10')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x239d('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x239d('0x12')]();}}}; \ No newline at end of file +var _0x1f75=['updatedAt','moment','path','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','MM-DD-YYYY\x20HH:mm','toString','DATE','format','createdAt'];(function(_0x1dd1cf,_0x439f45){var _0x1725ae=function(_0x59b9f9){while(--_0x59b9f9){_0x1dd1cf['push'](_0x1dd1cf['shift']());}};_0x1725ae(++_0x439f45);}(_0x1f75,0x13c));var _0x51f7=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1f75[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x51f7('0x0'));var path=require(_0x51f7('0x1'));var config=require(_0x51f7('0x2'));module[_0x51f7('0x3')]={'format':{'type':Sequelize[_0x51f7('0x4')],'get':function(){return this['getDataValue'](_0x51f7('0x5'))?path[_0x51f7('0x6')](this[_0x51f7('0x7')](_0x51f7('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x51f7('0x8')]},'channel':{'type':Sequelize[_0x51f7('0x8')]},'value':{'type':Sequelize[_0x51f7('0x8')],'set':function(_0xb4e621){var _0x3d2a15=_0xb4e621[_0x51f7('0x9')](/\\/g,'/');this[_0x51f7('0xa')](_0x51f7('0x5'),_0x3d2a15);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x51f7('0xb')],'set':function(_0x450767){this['setDataValue'](_0x51f7('0xc'),moment()[_0x51f7('0xd')](_0x450767,'ms'));this['setDataValue']('closedAt',moment());this[_0x51f7('0xa')](_0x51f7('0xe'),_0x450767);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x51f7('0x7')](_0x51f7('0xc')))['format'](_0x51f7('0xf'))[_0x51f7('0x10')]();}},'closedAt':{'type':Sequelize[_0x51f7('0x11')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x51f7('0x12')](_0x51f7('0xf'))[_0x51f7('0x10')]();}},'createdAt':{'type':Sequelize[_0x51f7('0x11')],'get':function(){return moment(this[_0x51f7('0x7')](_0x51f7('0x13')))['format'](_0x51f7('0xf'))[_0x51f7('0x10')]();}},'updatedAt':{'type':Sequelize[_0x51f7('0x11')],'get':function(){return moment(this[_0x51f7('0x7')](_0x51f7('0x14')))[_0x51f7('0x12')](_0x51f7('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index f41dbf3..0b346f8 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 _0x6f47=['zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ScreenRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','duration','createdAt','closedAt','value','find','describe','uniqueid','join','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','root','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','rimraf'];(function(_0x11754f,_0x48ef15){var _0x57c168=function(_0x3452a9){while(--_0x3452a9){_0x11754f['push'](_0x11754f['shift']());}};_0x57c168(++_0x48ef15);}(_0x6f47,0xc7));var _0x76f4=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x6f47[_0x55abd9];return _0x3e5669;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['differenceBy'](_['map'](_0x1dea0e,_0x76f4('0x27')),[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0x5346be[_0x76f4('0x2f')]);_0x30f02e[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2f')]);_0x10ddb4[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],qs['fields'](_0x5346be['query']['fields']));_0x10ddb4['attributes']=_0x10ddb4[_0x76f4('0x33')][_0x76f4('0x34')]?_0x10ddb4[_0x76f4('0x33')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2f')]['hasOwnProperty'](_0x76f4('0x35'))){_0x10ddb4[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x31')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2f')],_0x30f02e[_0x76f4('0x31')]),_0x1dea0e);if(_0x5346be['query'][_0x76f4('0x3a')]){_0x10ddb4[_0x76f4('0x38')]=_[_0x76f4('0x3b')](_0x10ddb4['where'],{'$or':_['map'](_0x1dea0e,function(_0x237fba){if(_0x237fba['type']!==_0x76f4('0x3c')){var _0x5ac18f={};_0x5ac18f[_0x237fba[_0x76f4('0x27')]]={'$like':'%'+_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3a')]+'%'};return _0x5ac18f;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3d')]);var _0x2d99e3={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x2d99e3)[_0x76f4('0x23')](function(_0x5340a9){_0x41dea4['count']=_0x5340a9;if(_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3e')]){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x42754d){_0x41dea4[_0x76f4('0x41')]=_0x42754d;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))['catch'](handleError(_0x5b3f07,null));};exports[_0x76f4('0x42')]=function(_0xe744af,_0x4f0d1a){var _0x5ad90a={'raw':![],'where':{'id':_0xe744af[_0x76f4('0x43')]['id']}},_0x26c411={};_0x26c411[_0x76f4('0x2d')]=_[_0x76f4('0x30')](db[_0x76f4('0x29')]['rawAttributes']);_0x26c411[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0xe744af[_0x76f4('0x2f')]);_0x26c411[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],_0x26c411['query']);_0x5ad90a[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],qs['fields'](_0xe744af['query'][_0x76f4('0x44')]));_0x5ad90a[_0x76f4('0x33')]=_0x5ad90a[_0x76f4('0x33')][_0x76f4('0x34')]?_0x5ad90a[_0x76f4('0x33')]:_0x26c411['model'];if(_0xe744af['query'][_0x76f4('0x3e')]){_0x5ad90a['include']=[{'all':!![]}];}_0x5ad90a=_[_0x76f4('0x3b')]({},_0x5ad90a,_0xe744af[_0x76f4('0x3d')]);return db['ScreenRecording']['find'](_0x5ad90a)[_0x76f4('0x23')](handleEntityNotFound(_0x4f0d1a,null))[_0x76f4('0x23')](respondWithResult(_0x4f0d1a,null))[_0x76f4('0x45')](handleError(_0x4f0d1a,null));};exports[_0x76f4('0x46')]=function(_0x55e4cc,_0x9baa0f){return db[_0x76f4('0x29')][_0x76f4('0x46')](_0x55e4cc['body'],{})[_0x76f4('0x23')](respondWithResult(_0x9baa0f,0xc9))[_0x76f4('0x45')](handleError(_0x9baa0f,null));};exports['update']=function(_0x56d905,_0x4ab620){if(_0x56d905[_0x76f4('0x47')]['id']){delete _0x56d905[_0x76f4('0x47')]['id'];}delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x48')];delete _0x56d905['body'][_0x76f4('0x49')];delete _0x56d905['body'][_0x76f4('0x4a')];delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x4b')];return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x56d905[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ab620,null))[_0x76f4('0x23')](saveUpdates(_0x56d905[_0x76f4('0x47')],null))[_0x76f4('0x23')](respondWithResult(_0x4ab620,null))[_0x76f4('0x45')](handleError(_0x4ab620,null));};exports[_0x76f4('0x4d')]=function(_0x479c4b,_0x1041da){return db['ScreenRecording'][_0x76f4('0x4d')]()[_0x76f4('0x23')](respondWithResult(_0x1041da,null))[_0x76f4('0x45')](handleError(_0x1041da,null));};exports['download']=function(_0x141b1c,_0x46c944,_0x3fc794){var _0x3bec16=require('../../components/encryptor');var _0x2028e9=![];var _0xf11e07={};if(_0x141b1c[_0x76f4('0x2f')][_0x76f4('0x2b')]&&_0x141b1c['query'][_0x76f4('0x2b')]==='uniqueid'){_0xf11e07[_0x76f4('0x4e')]=_0x141b1c[_0x76f4('0x43')]['id'];}else{_0xf11e07['id']=_0x141b1c['params']['id'];}return db['ScreenRecording'][_0x76f4('0x4c')]({'where':_0xf11e07,'attributes':['id',_0x76f4('0x4b')],'raw':!![]})[_0x76f4('0x23')](handleEntityNotFound(_0x46c944,null))['then'](function(_0x27ba06){if(_0x27ba06){var _0x15ec0f=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x27ba06[_0x76f4('0x4b')]);var _0x367238=util['format']('%s.cypher',_0x15ec0f);if(fs[_0x76f4('0x50')](_0x367238)){_0x2028e9=!![];return _0x3bec16[_0x76f4('0x51')](_0x367238,_0x15ec0f,config[_0x76f4('0x52')][_0x76f4('0x53')])[_0x76f4('0x23')](function(){return _0x27ba06;});}return _0x27ba06;}})[_0x76f4('0x23')](function(_0x97be11){if(_0x97be11){var _0x36a52a=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x97be11['value']);if(!fs[_0x76f4('0x50')](_0x36a52a)){throw new db[(_0x76f4('0x54'))][(_0x76f4('0x55'))](_0x76f4('0x56'));}if(_0x97be11['filename']){return _0x46c944['download'](_0x36a52a,_0x97be11[_0x76f4('0x57')]+path['extname'](_0x36a52a),function(){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}else{return _0x46c944['download'](_0x36a52a,function(_0x4285dd){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}}})[_0x76f4('0x45')](function(_0x3317a4){if(_0x3317a4['message']===_0x76f4('0x56')){_0x46c944[_0x76f4('0x1d')](0x194)[_0x76f4('0x28')](_0x76f4('0x59'));}else{return handleError(_0x46c944,null);}});};exports[_0x76f4('0x24')]=function(_0x2a6f19,_0x46245f){return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x2a6f19[_0x76f4('0x43')]['id']}})[_0x76f4('0x23')](function(_0x320a87){if(_[_0x76f4('0x5a')](_0x320a87)){throw new ReferenceError(_0x76f4('0x5b'));}return _0x320a87;})[_0x76f4('0x23')](function(_0x551d38){var _0x5724c3=path['join'](config[_0x76f4('0x5c')],_0x76f4('0x5d'),_0x551d38[_0x76f4('0x4b')]);logger['info'](_0x76f4('0x5e'),_0x5724c3);if(!_['isNil'](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger['info'](_0x76f4('0x5f')+_0x5724c3+_0x76f4('0x60'));fs[_0x76f4('0x61')](_0x5724c3);}_0x5724c3=_0x5724c3+_0x76f4('0x62');if(!_[_0x76f4('0x5a')](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger[_0x76f4('0x63')](_0x76f4('0x5f')+_0x5724c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76f4('0x61')](_0x5724c3);}return _0x551d38;})['then'](function(_0x318fcb){if(!_0x318fcb)throw new InternalError();return _0x318fcb[_0x76f4('0x24')]();})[_0x76f4('0x23')](function(){_0x46245f[_0x76f4('0x1d')](0xcc)[_0x76f4('0x17')]();})[_0x76f4('0x45')](handleError(_0x46245f,null));}; \ No newline at end of file +var _0x8958=['pick','merge','VIRTUAL','filter','options','ScreenRecording','include','findAll','params','rawAttributes','includeAll','create','catch','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x482f12,_0x253849){var _0x2bd90b=function(_0x4632cb){while(--_0x4632cb){_0x482f12['push'](_0x482f12['shift']());}};_0x2bd90b(++_0x253849);}(_0x8958,0x93));var _0x8895=function(_0x1c1156,_0x4ccef2){_0x1c1156=_0x1c1156-0x0;var _0x888ef8=_0x8958[_0x1c1156];return _0x888ef8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['differenceBy'](_[_0x8895('0x29')](_0x16b65b,'name'),[_0x8895('0x2e')]);_0x37ac3a['query']=_[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x30')]);_0x37ac3a[_0x8895('0x31')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a['query']);_0x6e449d[_0x8895('0x33')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x5c03ea[_0x8895('0x30')]['fields']));_0x6e449d[_0x8895('0x33')]=_0x6e449d['attributes'][_0x8895('0x35')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea[_0x8895('0x30')][_0x8895('0x36')](_0x8895('0x37'))){_0x6e449d[_0x8895('0x1d')]=qs['limit'](_0x5c03ea[_0x8895('0x30')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs[_0x8895('0x1f')](_0x5c03ea[_0x8895('0x30')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x38')]=qs[_0x8895('0x39')](_0x5c03ea['query'][_0x8895('0x39')]);_0x6e449d[_0x8895('0x3a')]=qs['filters'](_[_0x8895('0x3b')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x31')]),_0x16b65b);if(_0x5c03ea[_0x8895('0x30')]['filter']){_0x6e449d[_0x8895('0x3a')]=_[_0x8895('0x3c')](_0x6e449d['where'],{'$or':_['map'](_0x16b65b,function(_0x202130){if(_0x202130[_0x8895('0x2b')]!==_0x8895('0x3d')){var _0x331a9e={};_0x331a9e[_0x202130[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea['query'][_0x8895('0x3e')]+'%'};return _0x331a9e;}})});}_0x6e449d=_[_0x8895('0x3c')]({},_0x6e449d,_0x5c03ea[_0x8895('0x3f')]);var _0x10005f={'where':_0x6e449d[_0x8895('0x3a')]};return db[_0x8895('0x40')]['count'](_0x10005f)[_0x8895('0x24')](function(_0x5ebfc4){_0x3fc4cc[_0x8895('0x1e')]=_0x5ebfc4;if(_0x5c03ea[_0x8895('0x30')]['includeAll']){_0x6e449d[_0x8895('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8895('0x42')](_0x6e449d);})['then'](function(_0x4af3b1){_0x3fc4cc['rows']=_0x4af3b1;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x447ed6,_0x206f57){var _0x596531={'raw':![],'where':{'id':_0x447ed6[_0x8895('0x43')]['id']}},_0x4835d7={};_0x4835d7[_0x8895('0x2d')]=_['keys'](db[_0x8895('0x40')][_0x8895('0x44')]);_0x4835d7[_0x8895('0x30')]=_[_0x8895('0x2f')](_0x447ed6[_0x8895('0x30')]);_0x4835d7['filters']=_['intersection'](_0x4835d7['model'],_0x4835d7[_0x8895('0x30')]);_0x596531['attributes']=_[_0x8895('0x32')](_0x4835d7[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x447ed6[_0x8895('0x30')]['fields']));_0x596531[_0x8895('0x33')]=_0x596531[_0x8895('0x33')][_0x8895('0x35')]?_0x596531[_0x8895('0x33')]:_0x4835d7[_0x8895('0x2d')];if(_0x447ed6[_0x8895('0x30')][_0x8895('0x45')]){_0x596531[_0x8895('0x41')]=[{'all':!![]}];}_0x596531=_['merge']({},_0x596531,_0x447ed6[_0x8895('0x3f')]);return db[_0x8895('0x40')]['find'](_0x596531)[_0x8895('0x24')](handleEntityNotFound(_0x206f57,null))['then'](respondWithResult(_0x206f57,null))['catch'](handleError(_0x206f57,null));};exports[_0x8895('0x46')]=function(_0x337a9f,_0x130018){return db['ScreenRecording'][_0x8895('0x46')](_0x337a9f['body'],{})[_0x8895('0x24')](respondWithResult(_0x130018,0xc9))[_0x8895('0x47')](handleError(_0x130018,null));};exports[_0x8895('0x23')]=function(_0x1ca539,_0x2f3bf1){if(_0x1ca539[_0x8895('0x48')]['id']){delete _0x1ca539[_0x8895('0x48')]['id'];}delete _0x1ca539['body']['duration'];delete _0x1ca539[_0x8895('0x48')][_0x8895('0x49')];delete _0x1ca539['body'][_0x8895('0x4a')];delete _0x1ca539['body']['value'];return db[_0x8895('0x40')]['find']({'where':{'id':_0x1ca539[_0x8895('0x43')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2f3bf1,null))[_0x8895('0x24')](saveUpdates(_0x1ca539[_0x8895('0x48')],null))[_0x8895('0x24')](respondWithResult(_0x2f3bf1,null))[_0x8895('0x47')](handleError(_0x2f3bf1,null));};exports[_0x8895('0x4b')]=function(_0x38d6ae,_0x583419){return db[_0x8895('0x40')][_0x8895('0x4b')]()[_0x8895('0x24')](respondWithResult(_0x583419,null))['catch'](handleError(_0x583419,null));};exports[_0x8895('0x4c')]=function(_0x3935fd,_0xd7ffeb,_0x14e769){var _0x1e264a=require(_0x8895('0x4d'));var _0x434ab8=![];var _0x216e6e={};if(_0x3935fd[_0x8895('0x30')][_0x8895('0x2b')]&&_0x3935fd['query'][_0x8895('0x2b')]===_0x8895('0x4e')){_0x216e6e[_0x8895('0x4e')]=_0x3935fd[_0x8895('0x43')]['id'];}else{_0x216e6e['id']=_0x3935fd[_0x8895('0x43')]['id'];}return db['ScreenRecording'][_0x8895('0x4f')]({'where':_0x216e6e,'attributes':['id',_0x8895('0x50')],'raw':!![]})[_0x8895('0x24')](handleEntityNotFound(_0xd7ffeb,null))[_0x8895('0x24')](function(_0x37a7b4){if(_0x37a7b4){var _0x58dd6c=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x37a7b4['value']);var _0x20422f=util[_0x8895('0x2e')](_0x8895('0x54'),_0x58dd6c);if(fs['existsSync'](_0x20422f)){_0x434ab8=!![];return _0x1e264a[_0x8895('0x55')](_0x20422f,_0x58dd6c,config[_0x8895('0x56')]['recording'])[_0x8895('0x24')](function(){return _0x37a7b4;});}return _0x37a7b4;}})[_0x8895('0x24')](function(_0x5198f8){if(_0x5198f8){var _0x2f990a=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x5198f8['value']);if(!fs['existsSync'](_0x2f990a)){throw new db[(_0x8895('0x57'))][(_0x8895('0x58'))](_0x8895('0x59'));}if(_0x5198f8['filename']){return _0xd7ffeb[_0x8895('0x4c')](_0x2f990a,_0x5198f8[_0x8895('0x5a')]+path['extname'](_0x2f990a),function(){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}else{return _0xd7ffeb['download'](_0x2f990a,function(_0x435e36){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}}})[_0x8895('0x47')](function(_0x14f8a4){if(_0x14f8a4[_0x8895('0x5c')]==='ScreenRecording\x20not\x20found'){_0xd7ffeb['status'](0x194)[_0x8895('0x27')](_0x8895('0x5d'));}else{return handleError(_0xd7ffeb,null);}});};exports['destroy']=function(_0x46f8ae,_0x131476){return db[_0x8895('0x40')][_0x8895('0x4f')]({'where':{'id':_0x46f8ae['params']['id']}})[_0x8895('0x24')](function(_0x2d2bf9){if(_[_0x8895('0x5e')](_0x2d2bf9)){throw new ReferenceError(_0x8895('0x5f'));}return _0x2d2bf9;})[_0x8895('0x24')](function(_0x41a2fe){var _0x261d4b=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x41a2fe[_0x8895('0x50')]);logger[_0x8895('0x60')](_0x8895('0x61'),_0x261d4b);if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger['info']('File:\x20\x22'+_0x261d4b+_0x8895('0x62'));fs[_0x8895('0x63')](_0x261d4b);}_0x261d4b=_0x261d4b+_0x8895('0x64');if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger[_0x8895('0x60')](_0x8895('0x65')+_0x261d4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8895('0x63')](_0x261d4b);}return _0x41a2fe;})[_0x8895('0x24')](function(_0xf51f48){if(!_0xf51f48)throw new InternalError();return _0xf51f48[_0x8895('0x66')]();})[_0x8895('0x24')](function(){_0x131476['status'](0xcc)[_0x8895('0x1a')]();})[_0x8895('0x47')](handleError(_0x131476,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 84717e1..b3b9c7c 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 _0xcbc5=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x58a199,_0x282610){var _0x208bd1=function(_0x5d693d){while(--_0x5d693d){_0x58a199['push'](_0x58a199['shift']());}};_0x208bd1(++_0x282610);}(_0xcbc5,0xaf));var _0x5cbc=function(_0x42764d,_0x332a27){_0x42764d=_0x42764d-0x0;var _0x2a643c=_0xcbc5[_0x42764d];return _0x2a643c;};'use strict';var _=require(_0x5cbc('0x0'));var util=require(_0x5cbc('0x1'));var logger=require('../../config/logger')(_0x5cbc('0x2'));var moment=require('moment');var BPromise=require(_0x5cbc('0x3'));var rp=require(_0x5cbc('0x4'));var fs=require('fs');var path=require(_0x5cbc('0x5'));var rimraf=require(_0x5cbc('0x6'));var config=require(_0x5cbc('0x7'));var attributes=require(_0x5cbc('0x8'));module[_0x5cbc('0x9')]=function(_0x111550,_0x13fb7a){return _0x111550[_0x5cbc('0xa')](_0x5cbc('0xb'),attributes,{'tableName':_0x5cbc('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x5cbc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda28=['lodash','../../config/logger','api','bluebird','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x1733ec,_0x3f64b0){var _0x461f6d=function(_0x5a2e1d){while(--_0x5a2e1d){_0x1733ec['push'](_0x1733ec['shift']());}};_0x461f6d(++_0x3f64b0);}(_0xda28,0xb4));var _0x8da2=function(_0x3ddb93,_0x4e79d8){_0x3ddb93=_0x3ddb93-0x0;var _0x3cd537=_0xda28[_0x3ddb93];return _0x3cd537;};'use strict';var _=require(_0x8da2('0x0'));var util=require('util');var logger=require(_0x8da2('0x1'))(_0x8da2('0x2'));var moment=require('moment');var BPromise=require(_0x8da2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8da2('0x4'));var rimraf=require('rimraf');var config=require(_0x8da2('0x5'));var attributes=require(_0x8da2('0x6'));module[_0x8da2('0x7')]=function(_0x31b900,_0x158fd1){return _0x31b900[_0x8da2('0x8')](_0x8da2('0x9'),attributes,{'tableName':_0x8da2('0xa'),'paranoid':![],'indexes':[{'name':_0x8da2('0xb'),'fields':[_0x8da2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 62d893f..6ccd64b 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 _0x5c9a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x603eab,_0x5dce4b){var _0x27e8e5=function(_0x6d015a){while(--_0x6d015a){_0x603eab['push'](_0x603eab['shift']());}};_0x27e8e5(++_0x5dce4b);}(_0x5c9a,0x104));var _0xa5c9=function(_0x557f77,_0x2ff13f){_0x557f77=_0x557f77-0x0;var _0x166ce5=_0x5c9a[_0x557f77];return _0x166ce5;};'use strict';var _=require(_0xa5c9('0x0'));var util=require(_0xa5c9('0x1'));var moment=require(_0xa5c9('0x2'));var BPromise=require(_0xa5c9('0x3'));var rs=require(_0xa5c9('0x4'));var fs=require('fs');var Redis=require(_0xa5c9('0x5'));var db=require(_0xa5c9('0x6'))['db'];var utils=require(_0xa5c9('0x7'));var logger=require(_0xa5c9('0x8'))(_0xa5c9('0x9'));var config=require(_0xa5c9('0xa'));var jayson=require(_0xa5c9('0xb'));var client=jayson['client'][_0xa5c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4521e8,_0x2d25e9,_0x10ed56){return new BPromise(function(_0x49d98e,_0x4097f1){return client[_0xa5c9('0xd')](_0x4521e8,_0x10ed56)[_0xa5c9('0xe')](function(_0x27df60){logger[_0xa5c9('0xf')](_0xa5c9('0x10'),_0x2d25e9,_0xa5c9('0x11'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x2d25e9,_0xa5c9('0x11'),JSON[_0xa5c9('0x12')](_0x27df60));if(_0x27df60[_0xa5c9('0x13')]){if(_0x27df60[_0xa5c9('0x13')][_0xa5c9('0x14')]===0x1f4){logger[_0xa5c9('0x13')](_0xa5c9('0x10'),_0x2d25e9,_0x27df60[_0xa5c9('0x13')][_0xa5c9('0x15')]);return _0x4097f1(_0x27df60[_0xa5c9('0x13')]['message']);}logger[_0xa5c9('0x13')](_0xa5c9('0x10'),_0x2d25e9,_0x27df60[_0xa5c9('0x13')][_0xa5c9('0x15')]);return _0x49d98e(_0x27df60[_0xa5c9('0x13')][_0xa5c9('0x15')]);}else{logger[_0xa5c9('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x2d25e9,_0xa5c9('0x11'));_0x49d98e(_0x27df60[_0xa5c9('0x16')][_0xa5c9('0x15')]);}})[_0xa5c9('0x17')](function(_0x49ce17){logger[_0xa5c9('0x13')](_0xa5c9('0x10'),_0x2d25e9,_0x49ce17);_0x4097f1(_0x49ce17);});});} \ No newline at end of file +var _0xa9c2=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xa9c2,0x1a3));var _0x2a9c=function(_0x3933b8,_0x1c1498){_0x3933b8=_0x3933b8-0x0;var _0x26086d=_0xa9c2[_0x3933b8];return _0x26086d;};'use strict';var _=require('lodash');var util=require(_0x2a9c('0x0'));var moment=require(_0x2a9c('0x1'));var BPromise=require(_0x2a9c('0x2'));var rs=require(_0x2a9c('0x3'));var fs=require('fs');var Redis=require(_0x2a9c('0x4'));var db=require(_0x2a9c('0x5'))['db'];var utils=require(_0x2a9c('0x6'));var logger=require(_0x2a9c('0x7'))('rpc');var config=require(_0x2a9c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfcbd,_0x46f3d1,_0x5c1be3){return new BPromise(function(_0x120cf4,_0x197ff0){return client['request'](_0x5bfcbd,_0x5c1be3)['then'](function(_0x1a6de8){logger[_0x2a9c('0x9')](_0x2a9c('0xa'),_0x46f3d1,_0x2a9c('0xb'));logger[_0x2a9c('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x46f3d1,_0x2a9c('0xb'),JSON[_0x2a9c('0xd')](_0x1a6de8));if(_0x1a6de8[_0x2a9c('0xe')]){if(_0x1a6de8[_0x2a9c('0xe')][_0x2a9c('0xf')]===0x1f4){logger['error'](_0x2a9c('0xa'),_0x46f3d1,_0x1a6de8['error'][_0x2a9c('0x10')]);return _0x197ff0(_0x1a6de8[_0x2a9c('0xe')][_0x2a9c('0x10')]);}logger[_0x2a9c('0xe')](_0x2a9c('0xa'),_0x46f3d1,_0x1a6de8[_0x2a9c('0xe')]['message']);return _0x120cf4(_0x1a6de8[_0x2a9c('0xe')][_0x2a9c('0x10')]);}else{logger['info'](_0x2a9c('0xa'),_0x46f3d1,_0x2a9c('0xb'));_0x120cf4(_0x1a6de8[_0x2a9c('0x11')][_0x2a9c('0x10')]);}})[_0x2a9c('0x12')](function(_0x4f6464){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x46f3d1,_0x4f6464);_0x197ff0(_0x4f6464);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a4da469..d7f91cb 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 _0xfd08=['addLogo','logologin','addLogoLogin','preferred','addPreferred','%s%s','favicon','addFavicon','put','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','/now','get','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','post','single','file'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xfd08,0x1a9));var _0x8fd0=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xfd08[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x8fd0('0x0'));var util=require(_0x8fd0('0x1'));var path=require(_0x8fd0('0x2'));var timeout=require(_0x8fd0('0x3'));var express=require(_0x8fd0('0x4'));var router=express[_0x8fd0('0x5')]();var fs_extra=require(_0x8fd0('0x6'));var auth=require(_0x8fd0('0x7'));var interaction=require(_0x8fd0('0x8'));var config=require(_0x8fd0('0x9'));var controller=require(_0x8fd0('0xa'));router['get']('/',auth[_0x8fd0('0xb')](),controller[_0x8fd0('0xc')]);router['get'](_0x8fd0('0xd'),controller['getDate']);router[_0x8fd0('0xe')]('/:id',controller['show']);router[_0x8fd0('0xe')](_0x8fd0('0xf'),controller[_0x8fd0('0x10')]);router[_0x8fd0('0xe')](_0x8fd0('0x11'),controller[_0x8fd0('0x12')]);router['get'](_0x8fd0('0x13'),controller[_0x8fd0('0x14')]);router['get'](_0x8fd0('0x15'),controller[_0x8fd0('0x16')]);router[_0x8fd0('0xe')]('/:id/favicon',controller[_0x8fd0('0x17')]);var upload=multer({'storage':multer[_0x8fd0('0x18')]({'destination':function(_0x1ad327,_0x54a782,_0x55816a){_0x55816a(null,path[_0x8fd0('0x19')](config[_0x8fd0('0x1a')],_0x8fd0('0x1b')));},'filename':function(_0x4a4a07,_0x1d339f,_0x985438){_0x985438(null,util[_0x8fd0('0x1c')]('%s%s',_0x8fd0('0x1d'),path[_0x8fd0('0x1e')](_0x1d339f[_0x8fd0('0x1f')])));}})});router[_0x8fd0('0x20')](_0x8fd0('0xf'),upload[_0x8fd0('0x21')](_0x8fd0('0x22')),controller[_0x8fd0('0x23')]);var upload=multer({'storage':multer[_0x8fd0('0x18')]({'destination':function(_0x1ca54b,_0x2539b9,_0x3d15c5){_0x3d15c5(null,path[_0x8fd0('0x19')](config[_0x8fd0('0x1a')],_0x8fd0('0x1b')));},'filename':function(_0x5652d6,_0x1bcda8,_0x11ad78){_0x11ad78(null,util['format']('%s%s',_0x8fd0('0x24'),path[_0x8fd0('0x1e')](_0x1bcda8[_0x8fd0('0x1f')])));}})});router['post'](_0x8fd0('0x11'),upload[_0x8fd0('0x21')](_0x8fd0('0x22')),controller[_0x8fd0('0x25')]);var upload=multer({'storage':multer[_0x8fd0('0x18')]({'destination':function(_0x457055,_0x53067e,_0x1e70d0){_0x1e70d0(null,path['join'](config['root'],_0x8fd0('0x1b')));},'filename':function(_0x4e3154,_0x185d75,_0xa10d52){_0xa10d52(null,util['format']('%s%s',_0x8fd0('0x26'),path[_0x8fd0('0x1e')](_0x185d75[_0x8fd0('0x1f')])));}})});router[_0x8fd0('0x20')](_0x8fd0('0x15'),upload['single'](_0x8fd0('0x22')),controller[_0x8fd0('0x27')]);var upload=multer({'storage':multer[_0x8fd0('0x18')]({'destination':function(_0x2017d8,_0x46cda2,_0x14be34){_0x14be34(null,path[_0x8fd0('0x19')](config[_0x8fd0('0x1a')],_0x8fd0('0x1b')));},'filename':function(_0x2907e0,_0x2acbec,_0x56531d){_0x56531d(null,util[_0x8fd0('0x1c')](_0x8fd0('0x28'),_0x8fd0('0x29'),path['extname'](_0x2acbec[_0x8fd0('0x1f')])));}})});router[_0x8fd0('0x20')]('/:id/favicon',upload[_0x8fd0('0x21')](_0x8fd0('0x22')),controller[_0x8fd0('0x2a')]);router[_0x8fd0('0x2b')](_0x8fd0('0x2c'),auth[_0x8fd0('0xb')](),controller[_0x8fd0('0x2d')]);module['exports']=router; \ No newline at end of file +var _0x7d83=['/now','getDate','/:id','show','get','/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','getPreferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','logologin','addLogoLogin','preferred','/:id/preferred','/:id/favicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated'];(function(_0x45f945,_0x2c5a50){var _0x2866b8=function(_0xdd0398){while(--_0xdd0398){_0x45f945['push'](_0x45f945['shift']());}};_0x2866b8(++_0x2c5a50);}(_0x7d83,0x18f));var _0x37d8=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x7d83[_0x1030ce];return _0x3367fd;};'use strict';var multer=require(_0x37d8('0x0'));var util=require(_0x37d8('0x1'));var path=require(_0x37d8('0x2'));var timeout=require(_0x37d8('0x3'));var express=require(_0x37d8('0x4'));var router=express[_0x37d8('0x5')]();var fs_extra=require(_0x37d8('0x6'));var auth=require(_0x37d8('0x7'));var interaction=require(_0x37d8('0x8'));var config=require('../../config/environment');var controller=require(_0x37d8('0x9'));router['get']('/',auth[_0x37d8('0xa')](),controller['index']);router['get'](_0x37d8('0xb'),controller[_0x37d8('0xc')]);router['get'](_0x37d8('0xd'),controller[_0x37d8('0xe')]);router[_0x37d8('0xf')](_0x37d8('0x10'),controller['getLogo']);router['get'](_0x37d8('0x11'),controller['getLogoLogin']);router[_0x37d8('0xf')](_0x37d8('0x12'),controller[_0x37d8('0x13')]);router[_0x37d8('0xf')]('/:id/preferred',controller[_0x37d8('0x14')]);router[_0x37d8('0xf')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x37d8('0x15')]({'destination':function(_0x282e8d,_0x7c29b0,_0x9fbd6d){_0x9fbd6d(null,path[_0x37d8('0x16')](config[_0x37d8('0x17')],_0x37d8('0x18')));},'filename':function(_0x3e057c,_0x134e08,_0x5eac40){_0x5eac40(null,util[_0x37d8('0x19')](_0x37d8('0x1a'),'logo',path[_0x37d8('0x1b')](_0x134e08[_0x37d8('0x1c')])));}})});router[_0x37d8('0x1d')](_0x37d8('0x10'),upload[_0x37d8('0x1e')](_0x37d8('0x1f')),controller[_0x37d8('0x20')]);var upload=multer({'storage':multer[_0x37d8('0x15')]({'destination':function(_0x3c4267,_0x2e0d44,_0x1a6736){_0x1a6736(null,path[_0x37d8('0x16')](config[_0x37d8('0x17')],_0x37d8('0x18')));},'filename':function(_0x358826,_0x1f2aee,_0x18337d){_0x18337d(null,util[_0x37d8('0x19')]('%s%s',_0x37d8('0x21'),path[_0x37d8('0x1b')](_0x1f2aee[_0x37d8('0x1c')])));}})});router[_0x37d8('0x1d')](_0x37d8('0x11'),upload[_0x37d8('0x1e')]('file'),controller[_0x37d8('0x22')]);var upload=multer({'storage':multer[_0x37d8('0x15')]({'destination':function(_0x530367,_0x354bd0,_0x1bded1){_0x1bded1(null,path[_0x37d8('0x16')](config[_0x37d8('0x17')],'server/files/images/logos/'));},'filename':function(_0x3f56d7,_0x380fd4,_0x2bd7e1){_0x2bd7e1(null,util[_0x37d8('0x19')](_0x37d8('0x1a'),_0x37d8('0x23'),path['extname'](_0x380fd4[_0x37d8('0x1c')])));}})});router[_0x37d8('0x1d')](_0x37d8('0x24'),upload['single'](_0x37d8('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0x37d8('0x15')]({'destination':function(_0x25969b,_0x32d8e5,_0x479f8f){_0x479f8f(null,path['join'](config[_0x37d8('0x17')],_0x37d8('0x18')));},'filename':function(_0x2325a8,_0x114a5c,_0x1f7c8d){_0x1f7c8d(null,util[_0x37d8('0x19')](_0x37d8('0x1a'),'favicon',path['extname'](_0x114a5c[_0x37d8('0x1c')])));}})});router['post'](_0x37d8('0x25'),upload[_0x37d8('0x1e')]('file'),controller['addFavicon']);router[_0x37d8('0x26')]('/:id',auth[_0x37d8('0xa')](),controller[_0x37d8('0x27')]);module[_0x37d8('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 77932af..9516aec 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 _0x7a54=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x40033d,_0x111a6e){var _0x456de3=function(_0x429cda){while(--_0x429cda){_0x40033d['push'](_0x40033d['shift']());}};_0x456de3(++_0x111a6e);}(_0x7a54,0x106));var _0x47a5=function(_0x413deb,_0x5c7d84){_0x413deb=_0x413deb-0x0;var _0x3058a3=_0x7a54[_0x413deb];return _0x3058a3;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'min_internal':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':_0x47a5('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x5')},'logo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLogo':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x47a5('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x47a5('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x47a5('0x4')]},'defaultPreferred':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x47a5('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x47a5('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x47a5('0x2')]},'transcribeRegion':{'type':Sequelize[_0x47a5('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x47a5('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x47a5('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x5f2f=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports'];(function(_0x19d46c,_0x199ccf){var _0x51816e=function(_0x2d3fcd){while(--_0x2d3fcd){_0x19d46c['push'](_0x19d46c['shift']());}};_0x51816e(++_0x199ccf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d0412,_0x1a3d7c){_0x1d0412=_0x1d0412-0x0;var _0x5c0420=_0x5f2f[_0x1d0412];return _0x5c0420;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'min_internal':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf5f2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf5f2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf5f2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnusername':{'type':Sequelize[_0xf5f2('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xf5f2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':_0xf5f2('0x7')},'chatTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf5f2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'transcribeRegion':{'type':Sequelize[_0xf5f2('0x5')]},'sentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'sentimentRegion':{'type':Sequelize[_0xf5f2('0x5')]},'language':{'type':Sequelize[_0xf5f2('0x5')]},'bucket':{'type':Sequelize[_0xf5f2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf5f2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9954d2e..994db3f 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 _0xca54=['server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','Sequelize','\x20not\x20found','download','getLogoLogin','getLicense','default_loginLogo.svg','custom','ValidationError','gdpr','securePassword','addPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Setting,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','includeAll','find','update','body','params','file','filename','logo','addLogoLogin','getLogo'];(function(_0x46b54e,_0x1a976a){var _0x193b01=function(_0x30417d){while(--_0x30417d){_0x46b54e['push'](_0x46b54e['shift']());}};_0x193b01(++_0x1a976a);}(_0xca54,0x9c));var _0x4ca5=function(_0x2a85c8,_0x2d9403){_0x2a85c8=_0x2a85c8-0x0;var _0x3251d1=_0xca54[_0x2a85c8];return _0x3251d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ca5('0x0'));var zipdir=require(_0x4ca5('0x1'));var jsonpatch=require(_0x4ca5('0x2'));var rp=require(_0x4ca5('0x3'));var moment=require(_0x4ca5('0x4'));var BPromise=require(_0x4ca5('0x5'));var Mustache=require(_0x4ca5('0x6'));var util=require('util');var path=require(_0x4ca5('0x7'));var sox=require('sox');var csv=require(_0x4ca5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ca5('0x9'));var _=require(_0x4ca5('0xa'));var squel=require(_0x4ca5('0xb'));var crypto=require('crypto');var jsforce=require(_0x4ca5('0xc'));var deskjs=require(_0x4ca5('0xd'));var toCsv=require(_0x4ca5('0x8'));var querystring=require(_0x4ca5('0xe'));var Papa=require(_0x4ca5('0xf'));var Redis=require(_0x4ca5('0x10'));var authService=require(_0x4ca5('0x11'));var qs=require(_0x4ca5('0x12'));var as=require(_0x4ca5('0x13'));var hardwareService=require(_0x4ca5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4ca5('0x15'));var config=require(_0x4ca5('0x16'));var licenseUtil=require(_0x4ca5('0x17'));var db=require(_0x4ca5('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4ca5('0x19')][_0x4ca5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x38cafa,_0x2eee37,_0x285377,_0x1148e5){return new BPromise(function(_0x1fd2a2,_0x1287aa){var _0x5628c0=_0x1148e5||client;return _0x5628c0[_0x4ca5('0x1b')](_0x38cafa,_0x285377)[_0x4ca5('0x1c')](function(_0x33ae14){logger['info'](_0x4ca5('0x1d'),_0x2eee37,'request\x20sent');logger[_0x4ca5('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x2eee37,_0x4ca5('0x1f'),JSON['stringify'](_0x33ae14));if(_0x33ae14[_0x4ca5('0x20')]){if(_0x33ae14[_0x4ca5('0x20')]['code']===0x1f4){logger[_0x4ca5('0x20')]('Setting,\x20%s,\x20%s',_0x2eee37,_0x33ae14[_0x4ca5('0x20')][_0x4ca5('0x21')]);return _0x1287aa(_0x33ae14[_0x4ca5('0x20')][_0x4ca5('0x21')]);}logger['error'](_0x4ca5('0x1d'),_0x2eee37,_0x33ae14[_0x4ca5('0x20')][_0x4ca5('0x21')]);return _0x1fd2a2(_0x33ae14[_0x4ca5('0x20')]['message']);}else{logger[_0x4ca5('0x22')](_0x4ca5('0x1d'),_0x2eee37,_0x4ca5('0x1f'));_0x1fd2a2(_0x33ae14[_0x4ca5('0x23')][_0x4ca5('0x21')]);}})[_0x4ca5('0x24')](function(_0x29b6a8){logger['error'](_0x4ca5('0x1d'),_0x2eee37,_0x29b6a8);_0x1287aa(_0x29b6a8);});});}function respondWithStatusCode(_0xbac90a,_0x5931a0){_0x5931a0=_0x5931a0||0xcc;return function(_0xbb239d){if(_0xbb239d){return _0xbac90a[_0x4ca5('0x25')](_0x5931a0);}return _0xbac90a[_0x4ca5('0x26')](_0x5931a0)[_0x4ca5('0x27')]();};}function respondWithResult(_0x11ecff,_0x11e0df){_0x11e0df=_0x11e0df||0xc8;return function(_0xc84945){if(_0xc84945){return _0x11ecff['status'](_0x11e0df)[_0x4ca5('0x28')](_0xc84945);}};}function respondWithFilteredResult(_0x1a464f,_0x2a0ed5){return function(_0x5629e4){if(_0x5629e4){var _0x494bca=typeof _0x2a0ed5[_0x4ca5('0x29')]===_0x4ca5('0x2a')&&typeof _0x2a0ed5[_0x4ca5('0x2b')]==='undefined';var _0x1dc1c6=_0x5629e4['count'];var _0x18b8e6=_0x494bca?0x0:_0x2a0ed5[_0x4ca5('0x29')];var _0x4cd427=_0x494bca?_0x5629e4[_0x4ca5('0x2c')]:_0x2a0ed5[_0x4ca5('0x29')]+_0x2a0ed5['limit'];var _0x112a55;if(_0x4cd427>=_0x1dc1c6){_0x4cd427=_0x1dc1c6;_0x112a55=0xc8;}else{_0x112a55=0xce;}_0x1a464f[_0x4ca5('0x26')](_0x112a55);return _0x1a464f[_0x4ca5('0x2d')](_0x4ca5('0x2e'),_0x18b8e6+'-'+_0x4cd427+'/'+_0x1dc1c6)[_0x4ca5('0x28')](_0x5629e4);}return null;};}function patchUpdates(_0x3bd008){return function(_0x21c6d3){try{jsonpatch[_0x4ca5('0x2f')](_0x21c6d3,_0x3bd008,!![]);}catch(_0x2871aa){return BPromise['reject'](_0x2871aa);}return _0x21c6d3[_0x4ca5('0x30')]();};}function saveUpdates(_0x284e42,_0x2009e8){return function(_0x4ea707){if(_0x4ea707){return _0x4ea707['update'](_0x284e42)[_0x4ca5('0x1c')](function(_0xc8457f){return _0xc8457f;});}return null;};}function removeEntity(_0x1c84c5,_0x647ce8){return function(_0x34a1a1){if(_0x34a1a1){return _0x34a1a1[_0x4ca5('0x31')]()[_0x4ca5('0x1c')](function(){_0x1c84c5[_0x4ca5('0x26')](0xcc)[_0x4ca5('0x27')]();});}};}function handleEntityNotFound(_0x4967d0,_0x31dbe2){return function(_0x1d8dea){if(!_0x1d8dea){_0x4967d0[_0x4ca5('0x25')](0x194);}return _0x1d8dea;};}function handleError(_0xbbfa9b,_0x1df56e){_0x1df56e=_0x1df56e||0x1f4;return function(_0x24e53c){logger[_0x4ca5('0x20')](_0x24e53c[_0x4ca5('0x32')]);if(_0x24e53c[_0x4ca5('0x33')]){delete _0x24e53c[_0x4ca5('0x33')];}_0xbbfa9b[_0x4ca5('0x26')](_0x1df56e)[_0x4ca5('0x34')](_0x24e53c);};}exports['index']=function(_0x3c8e4a,_0x237d1a){var _0x2c0f3a={},_0x2b8ab7={},_0x5a3812={'count':0x0,'rows':[]};var _0x5ee7e3=_[_0x4ca5('0x35')](db[_0x4ca5('0x36')][_0x4ca5('0x37')],function(_0x44c1c7){return{'name':_0x44c1c7[_0x4ca5('0x38')],'type':_0x44c1c7[_0x4ca5('0x39')][_0x4ca5('0x3a')]};});_0x2b8ab7[_0x4ca5('0x3b')]=_['map'](_0x5ee7e3,'name');_0x2b8ab7[_0x4ca5('0x3c')]=_['keys'](_0x3c8e4a['query']);_0x2b8ab7[_0x4ca5('0x3d')]=_[_0x4ca5('0x3e')](_0x2b8ab7[_0x4ca5('0x3b')],_0x2b8ab7[_0x4ca5('0x3c')]);_0x2c0f3a[_0x4ca5('0x3f')]=_[_0x4ca5('0x3e')](_0x2b8ab7['model'],qs[_0x4ca5('0x40')](_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x40')]));_0x2c0f3a[_0x4ca5('0x3f')]=_0x2c0f3a[_0x4ca5('0x3f')][_0x4ca5('0x41')]?_0x2c0f3a[_0x4ca5('0x3f')]:_0x2b8ab7[_0x4ca5('0x3b')];if(!_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x42')](_0x4ca5('0x43'))){_0x2c0f3a[_0x4ca5('0x2b')]=qs[_0x4ca5('0x2b')](_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x2b')]);_0x2c0f3a[_0x4ca5('0x29')]=qs[_0x4ca5('0x29')](_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x29')]);}_0x2c0f3a['order']=qs[_0x4ca5('0x44')](_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x44')]);_0x2c0f3a[_0x4ca5('0x45')]=qs[_0x4ca5('0x3d')](_[_0x4ca5('0x46')](_0x3c8e4a[_0x4ca5('0x3c')],_0x2b8ab7['filters']),_0x5ee7e3);if(_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x47')]){_0x2c0f3a[_0x4ca5('0x45')]=_[_0x4ca5('0x48')](_0x2c0f3a[_0x4ca5('0x45')],{'$or':_[_0x4ca5('0x35')](_0x5ee7e3,function(_0x13d569){if(_0x13d569[_0x4ca5('0x39')]!==_0x4ca5('0x49')){var _0x362efb={};_0x362efb[_0x13d569['name']]={'$like':'%'+_0x3c8e4a['query'][_0x4ca5('0x47')]+'%'};return _0x362efb;}})});}_0x2c0f3a=_['merge']({},_0x2c0f3a,_0x3c8e4a[_0x4ca5('0x4a')]);var _0x412f16={'where':_0x2c0f3a[_0x4ca5('0x45')]};return db[_0x4ca5('0x36')][_0x4ca5('0x2c')](_0x412f16)['then'](function(_0x27daf1){_0x5a3812[_0x4ca5('0x2c')]=_0x27daf1;if(_0x3c8e4a['query']['includeAll']){_0x2c0f3a[_0x4ca5('0x4b')]=[{'all':!![]}];}return db['Setting'][_0x4ca5('0x4c')](_0x2c0f3a);})[_0x4ca5('0x1c')](function(_0x1b7304){_0x5a3812[_0x4ca5('0x4d')]=_0x1b7304;return _0x5a3812;})[_0x4ca5('0x1c')](respondWithFilteredResult(_0x237d1a,_0x2c0f3a))['catch'](handleError(_0x237d1a,null));};exports[_0x4ca5('0x4e')]=function(_0xbb137c,_0x56b647){var _0x321a8e={'raw':![],'where':{'id':_0xbb137c['params']['id']}},_0xda4478={};_0xda4478[_0x4ca5('0x3b')]=_[_0x4ca5('0x4f')](db['Setting'][_0x4ca5('0x37')]);_0xda4478[_0x4ca5('0x3c')]=_[_0x4ca5('0x4f')](_0xbb137c[_0x4ca5('0x3c')]);_0xda4478[_0x4ca5('0x3d')]=_['intersection'](_0xda4478[_0x4ca5('0x3b')],_0xda4478[_0x4ca5('0x3c')]);_0x321a8e['attributes']=_[_0x4ca5('0x3e')](_0xda4478['model'],qs[_0x4ca5('0x40')](_0xbb137c[_0x4ca5('0x3c')][_0x4ca5('0x40')]));_0x321a8e[_0x4ca5('0x3f')]=_0x321a8e[_0x4ca5('0x3f')][_0x4ca5('0x41')]?_0x321a8e[_0x4ca5('0x3f')]:_0xda4478[_0x4ca5('0x3b')];if(_0xbb137c[_0x4ca5('0x3c')][_0x4ca5('0x50')]){_0x321a8e[_0x4ca5('0x4b')]=[{'all':!![]}];}_0x321a8e=_[_0x4ca5('0x48')]({},_0x321a8e,_0xbb137c['options']);return db[_0x4ca5('0x36')][_0x4ca5('0x51')](_0x321a8e)['then'](handleEntityNotFound(_0x56b647,null))[_0x4ca5('0x1c')](respondWithResult(_0x56b647,null))[_0x4ca5('0x24')](handleError(_0x56b647,null));};exports[_0x4ca5('0x52')]=function(_0x4dfa08,_0x5d994a){if(_0x4dfa08['body']['id']){delete _0x4dfa08[_0x4ca5('0x53')]['id'];}return db['Setting'][_0x4ca5('0x51')]({'where':{'id':_0x4dfa08[_0x4ca5('0x54')]['id']}})[_0x4ca5('0x1c')](handleEntityNotFound(_0x5d994a,null))[_0x4ca5('0x1c')](saveUpdates(_0x4dfa08[_0x4ca5('0x53')],null))[_0x4ca5('0x1c')](respondWithResult(_0x5d994a,null))[_0x4ca5('0x24')](handleError(_0x5d994a,null));};exports['addLogo']=function(_0x157356,_0x5c136a,_0x235977){if(_0x157356[_0x4ca5('0x55')]&&_0x157356[_0x4ca5('0x55')][_0x4ca5('0x56')]){_0x157356['body'][_0x4ca5('0x57')]=_0x157356[_0x4ca5('0x55')][_0x4ca5('0x56')];}return db[_0x4ca5('0x36')][_0x4ca5('0x51')]({'where':{'id':_0x157356[_0x4ca5('0x54')]['id']}})['then'](handleEntityNotFound(_0x5c136a,null))[_0x4ca5('0x1c')](saveUpdates(_0x157356['body'],null))[_0x4ca5('0x1c')](respondWithResult(_0x5c136a,null))['catch'](handleError(_0x5c136a,null));};exports[_0x4ca5('0x58')]=function(_0xed2a7a,_0x3aa3b8,_0x4af2a4){if(_0xed2a7a[_0x4ca5('0x55')]&&_0xed2a7a['file'][_0x4ca5('0x56')]){_0xed2a7a[_0x4ca5('0x53')]['loginLogo']=_0xed2a7a[_0x4ca5('0x55')]['filename'];}return db[_0x4ca5('0x36')][_0x4ca5('0x51')]({'where':{'id':_0xed2a7a[_0x4ca5('0x54')]['id']}})[_0x4ca5('0x1c')](handleEntityNotFound(_0x3aa3b8,null))['then'](saveUpdates(_0xed2a7a[_0x4ca5('0x53')],null))[_0x4ca5('0x1c')](respondWithResult(_0x3aa3b8,null))[_0x4ca5('0x24')](handleError(_0x3aa3b8,null));};var utilLicense=require(_0x4ca5('0x17'));exports[_0x4ca5('0x59')]=function(_0x3fb73a,_0x2addcb,_0x58cbca){var _0x505349=_0x4ca5('0x5a');var _0x5d2b18={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xcccf70){if(_0xcccf70){_0x5d2b18=_0xcccf70;}return db[_0x4ca5('0x36')][_0x4ca5('0x51')]({'where':{'id':_0x3fb73a[_0x4ca5('0x54')]['id']},'attributes':[_0x4ca5('0x57'),_0x4ca5('0x5b'),_0x4ca5('0x5c'),_0x4ca5('0x5d'),_0x4ca5('0x5e'),_0x4ca5('0x5f'),_0x4ca5('0x60'),_0x4ca5('0x61')],'raw':!![]});})[_0x4ca5('0x1c')](handleEntityNotFound(_0x2addcb,null))[_0x4ca5('0x1c')](function(_0x34b8db){if(_0x34b8db){var _0xc0e4c8=_0x34b8db['logo']&&fs[_0x4ca5('0x62')](path[_0x4ca5('0x63')](config['root'],_0x505349,_[_0x4ca5('0x64')](_0x34b8db['logo'])))?path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x505349,_[_0x4ca5('0x64')](_0x34b8db[_0x4ca5('0x57')])):path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x505349,_[_0x4ca5('0x64')](_0x4ca5('0x66')));var _0x3f9b3d=_0x4ca5('0x67')+_[_0x4ca5('0x68')](_0x4ca5('0x57'));if(_0x34b8db[_0x3f9b3d]||!_0x5d2b18['custom']){_0xc0e4c8=path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x505349,_[_0x4ca5('0x64')](_0x4ca5('0x66')));}if(!fs[_0x4ca5('0x62')](_0xc0e4c8)){throw new db[(_0x4ca5('0x69'))]['ValidationError'](_['upperFirst'](_0x4ca5('0x57'))+_0x4ca5('0x6a'));}return _0x2addcb[_0x4ca5('0x6b')](_0xc0e4c8);}})[_0x4ca5('0x24')](handleError(_0x2addcb,null));};var utilLicense=require(_0x4ca5('0x17'));exports[_0x4ca5('0x6c')]=function(_0xc60c34,_0x52a540,_0x490000){var _0x1048af=_0x4ca5('0x5a');var _0x391d3b={'custom':![]};return utilLicense[_0x4ca5('0x6d')]()[_0x4ca5('0x1c')](function(_0x238961){if(_0x238961){_0x391d3b=_0x238961;}return db[_0x4ca5('0x36')][_0x4ca5('0x51')]({'where':{'id':_0xc60c34['params']['id']},'attributes':[_0x4ca5('0x57'),_0x4ca5('0x5b'),'preferred',_0x4ca5('0x5d'),_0x4ca5('0x5e'),_0x4ca5('0x5f'),_0x4ca5('0x60'),'defaultFavicon'],'raw':!![]});})[_0x4ca5('0x1c')](handleEntityNotFound(_0x52a540,null))['then'](function(_0xcd192){if(_0xcd192){var _0x38868f=_0xcd192[_0x4ca5('0x5b')]&&fs['existsSync'](path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x1048af,_[_0x4ca5('0x64')](_0xcd192['loginLogo'])))?path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x1048af,_[_0x4ca5('0x64')](_0xcd192[_0x4ca5('0x5b')])):path['join'](config[_0x4ca5('0x65')],_0x1048af,_['toLower'](_0x4ca5('0x6e')));var _0x3b9f25=_0x4ca5('0x67')+_[_0x4ca5('0x68')](_0x4ca5('0x5b'));if(_0xcd192[_0x3b9f25]||!_0x391d3b[_0x4ca5('0x6f')]){_0x38868f=path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x1048af,_[_0x4ca5('0x64')]('default_loginLogo.svg'));}if(!fs[_0x4ca5('0x62')](_0x38868f)){throw new db[(_0x4ca5('0x69'))][(_0x4ca5('0x70'))](_[_0x4ca5('0x68')](_0x4ca5('0x5b'))+_0x4ca5('0x6a'));}return _0x52a540[_0x4ca5('0x6b')](_0x38868f);}})[_0x4ca5('0x24')](handleError(_0x52a540,null));};exports[_0x4ca5('0x71')]=function(_0x7951ac,_0x5b3efe){return db['Setting'][_0x4ca5('0x51')]({'where':{'id':_0x7951ac[_0x4ca5('0x54')]['id']},'attributes':[_0x4ca5('0x72')]})['then'](respondWithResult(_0x5b3efe,null))[_0x4ca5('0x24')](handleError(_0x5b3efe,null));};exports[_0x4ca5('0x73')]=function(_0x489064,_0x3a67a5,_0x52bb09){if(_0x489064['file']&&_0x489064['file']['filename']){_0x489064[_0x4ca5('0x53')]['preferred']=_0x489064['file'][_0x4ca5('0x56')];}return db[_0x4ca5('0x36')]['find']({'where':{'id':_0x489064[_0x4ca5('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a67a5,null))[_0x4ca5('0x1c')](saveUpdates(_0x489064[_0x4ca5('0x53')],null))[_0x4ca5('0x1c')](respondWithResult(_0x3a67a5,null))['catch'](handleError(_0x3a67a5,null));};var utilLicense=require(_0x4ca5('0x17'));exports['getPreferred']=function(_0x36e9f4,_0x57531b,_0x1aa7ac){var _0x13acf8=_0x4ca5('0x5a');var _0x28e7e6={'custom':![]};return utilLicense[_0x4ca5('0x6d')]()[_0x4ca5('0x1c')](function(_0x2d8470){if(_0x2d8470){_0x28e7e6=_0x2d8470;}return db[_0x4ca5('0x36')]['find']({'where':{'id':_0x36e9f4[_0x4ca5('0x54')]['id']},'attributes':[_0x4ca5('0x57'),'loginLogo',_0x4ca5('0x5c'),_0x4ca5('0x5d'),_0x4ca5('0x5e'),'defaultLoginLogo',_0x4ca5('0x60'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x57531b,null))[_0x4ca5('0x1c')](function(_0x2ab8bc){if(_0x2ab8bc){var _0x2b0150=_0x2ab8bc[_0x4ca5('0x5c')]&&fs[_0x4ca5('0x62')](path['join'](config[_0x4ca5('0x65')],_0x13acf8,_[_0x4ca5('0x64')](_0x2ab8bc[_0x4ca5('0x5c')])))?path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x13acf8,_['toLower'](_0x2ab8bc[_0x4ca5('0x5c')])):path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x13acf8,_['toLower'](_0x4ca5('0x74')));var _0x3afefd=_0x4ca5('0x67')+_[_0x4ca5('0x68')]('preferred');if(_0x2ab8bc[_0x3afefd]||!_0x28e7e6[_0x4ca5('0x6f')]||!_0x28e7e6[_0x4ca5('0x5c')]){_0x2b0150=path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x13acf8,_[_0x4ca5('0x64')](_0x4ca5('0x74')));}if(!fs[_0x4ca5('0x62')](_0x2b0150)){throw new db['Sequelize']['ValidationError'](_[_0x4ca5('0x68')](_0x4ca5('0x5c'))+_0x4ca5('0x6a'));}return _0x57531b[_0x4ca5('0x6b')](_0x2b0150);}})['catch'](handleError(_0x57531b,null));};exports['addFavicon']=function(_0xa1c748,_0x34c79d,_0x22c4d0){if(_0xa1c748[_0x4ca5('0x55')]&&_0xa1c748[_0x4ca5('0x55')]['filename']){_0xa1c748[_0x4ca5('0x53')][_0x4ca5('0x5d')]=_0xa1c748[_0x4ca5('0x55')][_0x4ca5('0x56')];}return db[_0x4ca5('0x36')]['find']({'where':{'id':_0xa1c748[_0x4ca5('0x54')]['id']}})[_0x4ca5('0x1c')](handleEntityNotFound(_0x34c79d,null))[_0x4ca5('0x1c')](saveUpdates(_0xa1c748[_0x4ca5('0x53')],null))[_0x4ca5('0x1c')](respondWithResult(_0x34c79d,null))[_0x4ca5('0x24')](handleError(_0x34c79d,null));};var utilLicense=require(_0x4ca5('0x17'));exports[_0x4ca5('0x75')]=function(_0x142770,_0xcb4753,_0x84ef31){var _0x289fcd=_0x4ca5('0x5a');var _0x59a8aa={'custom':![]};return utilLicense['getLicense']()[_0x4ca5('0x1c')](function(_0x4726c0){if(_0x4726c0){_0x59a8aa=_0x4726c0;}return db[_0x4ca5('0x36')][_0x4ca5('0x51')]({'where':{'id':_0x142770[_0x4ca5('0x54')]['id']},'attributes':[_0x4ca5('0x57'),'loginLogo',_0x4ca5('0x5c'),'favicon',_0x4ca5('0x5e'),_0x4ca5('0x5f'),'defaultPreferred',_0x4ca5('0x61')],'raw':!![]});})[_0x4ca5('0x1c')](handleEntityNotFound(_0xcb4753,null))[_0x4ca5('0x1c')](function(_0x3acb6f){if(_0x3acb6f){var _0x5891f6=_0x3acb6f['favicon']&&fs[_0x4ca5('0x62')](path[_0x4ca5('0x63')](config[_0x4ca5('0x65')],_0x289fcd,_[_0x4ca5('0x64')](_0x3acb6f[_0x4ca5('0x5d')])))?path['join'](config['root'],_0x289fcd,_[_0x4ca5('0x64')](_0x3acb6f[_0x4ca5('0x5d')])):path['join'](config[_0x4ca5('0x65')],_0x289fcd,_['toLower'](_0x4ca5('0x76')));var _0x2659d7='default'+_[_0x4ca5('0x68')](_0x4ca5('0x5d'));if(_0x3acb6f[_0x2659d7]||!_0x59a8aa['custom']){_0x5891f6=path[_0x4ca5('0x63')](config['root'],_0x289fcd,_[_0x4ca5('0x64')](_0x4ca5('0x76')));}if(!fs['existsSync'](_0x5891f6)){throw new db['Sequelize'][(_0x4ca5('0x70'))](_[_0x4ca5('0x68')](_0x4ca5('0x5d'))+_0x4ca5('0x6a'));}return _0xcb4753[_0x4ca5('0x6b')](_0x5891f6);}})[_0x4ca5('0x24')](handleError(_0xcb4753,null));};exports[_0x4ca5('0x77')]=function(_0xee5145,_0x448892){var _0x4faca3={'offset':moment()['utcOffset']()};_0x4faca3[_0x4ca5('0x78')]=moment()['utcOffset'](_0x4faca3[_0x4ca5('0x29')])[_0x4ca5('0x79')](_0x4ca5('0x7a'));return _0x448892[_0x4ca5('0x26')](0xc8)[_0x4ca5('0x34')](_0x4faca3);}; \ No newline at end of file +var _0x60eb=['rows','params','keys','rawAttributes','length','find','body','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','root','toLower','join','default_logo.svg','default','upperFirst','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','custom','default_loginLogo.svg','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','send','index','map','Setting','fieldName','key','name','query','filters','intersection','model','fields','attributes','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include'];(function(_0x2d4b62,_0xb69b4d){var _0x136154=function(_0x1e1266){while(--_0x1e1266){_0x2d4b62['push'](_0x2d4b62['shift']());}};_0x136154(++_0xb69b4d);}(_0x60eb,0x192));var _0xb60e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x60eb[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb60e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb60e('0x1'));var jsonpatch=require(_0xb60e('0x2'));var rp=require(_0xb60e('0x3'));var moment=require(_0xb60e('0x4'));var BPromise=require(_0xb60e('0x5'));var Mustache=require(_0xb60e('0x6'));var util=require(_0xb60e('0x7'));var path=require('path');var sox=require(_0xb60e('0x8'));var csv=require(_0xb60e('0x9'));var ejs=require(_0xb60e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb60e('0xb'));var squel=require(_0xb60e('0xc'));var crypto=require(_0xb60e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb60e('0xe'));var toCsv=require(_0xb60e('0x9'));var querystring=require(_0xb60e('0xf'));var Papa=require(_0xb60e('0x10'));var Redis=require(_0xb60e('0x11'));var authService=require(_0xb60e('0x12'));var qs=require(_0xb60e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb60e('0x14'));var db=require(_0xb60e('0x15'))['db'];var jayson=require(_0xb60e('0x16'));var client=jayson[_0xb60e('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a30c3,_0x2881ed,_0x34855d,_0x5a9254){return new BPromise(function(_0x22ba7c,_0x27d744){var _0x3a6f2c=_0x5a9254||client;return _0x3a6f2c['request'](_0x4a30c3,_0x34855d)[_0xb60e('0x18')](function(_0x38a379){logger[_0xb60e('0x19')](_0xb60e('0x1a'),_0x2881ed,_0xb60e('0x1b'));logger[_0xb60e('0x1c')](_0xb60e('0x1d'),_0x2881ed,'request\x20sent',JSON['stringify'](_0x38a379));if(_0x38a379[_0xb60e('0x1e')]){if(_0x38a379[_0xb60e('0x1e')]['code']===0x1f4){logger[_0xb60e('0x1e')](_0xb60e('0x1a'),_0x2881ed,_0x38a379[_0xb60e('0x1e')]['message']);return _0x27d744(_0x38a379[_0xb60e('0x1e')][_0xb60e('0x1f')]);}logger['error']('Setting,\x20%s,\x20%s',_0x2881ed,_0x38a379[_0xb60e('0x1e')][_0xb60e('0x1f')]);return _0x22ba7c(_0x38a379[_0xb60e('0x1e')][_0xb60e('0x1f')]);}else{logger['info'](_0xb60e('0x1a'),_0x2881ed,_0xb60e('0x1b'));_0x22ba7c(_0x38a379[_0xb60e('0x20')][_0xb60e('0x1f')]);}})[_0xb60e('0x21')](function(_0xa11363){logger['error'](_0xb60e('0x1a'),_0x2881ed,_0xa11363);_0x27d744(_0xa11363);});});}function respondWithStatusCode(_0x386d99,_0x40563b){_0x40563b=_0x40563b||0xcc;return function(_0x5af817){if(_0x5af817){return _0x386d99['sendStatus'](_0x40563b);}return _0x386d99[_0xb60e('0x22')](_0x40563b)[_0xb60e('0x23')]();};}function respondWithResult(_0x5829b6,_0x233b7f){_0x233b7f=_0x233b7f||0xc8;return function(_0x3cbc35){if(_0x3cbc35){return _0x5829b6[_0xb60e('0x22')](_0x233b7f)['json'](_0x3cbc35);}};}function respondWithFilteredResult(_0x431eba,_0x54a3c1){return function(_0x509ff7){if(_0x509ff7){var _0x2bcc4c=typeof _0x54a3c1[_0xb60e('0x24')]===_0xb60e('0x25')&&typeof _0x54a3c1[_0xb60e('0x26')]===_0xb60e('0x25');var _0x1030f3=_0x509ff7[_0xb60e('0x27')];var _0x2e1d0c=_0x2bcc4c?0x0:_0x54a3c1['offset'];var _0x2cfab2=_0x2bcc4c?_0x509ff7[_0xb60e('0x27')]:_0x54a3c1['offset']+_0x54a3c1['limit'];var _0x3fba1a;if(_0x2cfab2>=_0x1030f3){_0x2cfab2=_0x1030f3;_0x3fba1a=0xc8;}else{_0x3fba1a=0xce;}_0x431eba[_0xb60e('0x22')](_0x3fba1a);return _0x431eba[_0xb60e('0x28')](_0xb60e('0x29'),_0x2e1d0c+'-'+_0x2cfab2+'/'+_0x1030f3)[_0xb60e('0x2a')](_0x509ff7);}return null;};}function patchUpdates(_0x146a75){return function(_0x2a29be){try{jsonpatch[_0xb60e('0x2b')](_0x2a29be,_0x146a75,!![]);}catch(_0x5bec9e){return BPromise[_0xb60e('0x2c')](_0x5bec9e);}return _0x2a29be[_0xb60e('0x2d')]();};}function saveUpdates(_0x21e001,_0x3854ea){return function(_0x2ada27){if(_0x2ada27){return _0x2ada27[_0xb60e('0x2e')](_0x21e001)['then'](function(_0x3a9dba){return _0x3a9dba;});}return null;};}function removeEntity(_0x159d92,_0xb00c80){return function(_0x54a49c){if(_0x54a49c){return _0x54a49c[_0xb60e('0x2f')]()[_0xb60e('0x18')](function(){_0x159d92[_0xb60e('0x22')](0xcc)[_0xb60e('0x23')]();});}};}function handleEntityNotFound(_0x4c46d8,_0x2ba711){return function(_0x494f6e){if(!_0x494f6e){_0x4c46d8[_0xb60e('0x30')](0x194);}return _0x494f6e;};}function handleError(_0x4451cb,_0x2f9893){_0x2f9893=_0x2f9893||0x1f4;return function(_0x7f2d58){logger[_0xb60e('0x1e')](_0x7f2d58[_0xb60e('0x31')]);if(_0x7f2d58['name']){delete _0x7f2d58['name'];}_0x4451cb[_0xb60e('0x22')](_0x2f9893)[_0xb60e('0x32')](_0x7f2d58);};}exports[_0xb60e('0x33')]=function(_0x36dc28,_0x5a1ff4){var _0xbbf7f2={},_0x3b0cf6={},_0x31402f={'count':0x0,'rows':[]};var _0x1327c8=_[_0xb60e('0x34')](db[_0xb60e('0x35')]['rawAttributes'],function(_0x2bde7a){return{'name':_0x2bde7a[_0xb60e('0x36')],'type':_0x2bde7a['type'][_0xb60e('0x37')]};});_0x3b0cf6['model']=_['map'](_0x1327c8,_0xb60e('0x38'));_0x3b0cf6[_0xb60e('0x39')]=_['keys'](_0x36dc28[_0xb60e('0x39')]);_0x3b0cf6[_0xb60e('0x3a')]=_[_0xb60e('0x3b')](_0x3b0cf6[_0xb60e('0x3c')],_0x3b0cf6['query']);_0xbbf7f2['attributes']=_['intersection'](_0x3b0cf6[_0xb60e('0x3c')],qs[_0xb60e('0x3d')](_0x36dc28[_0xb60e('0x39')][_0xb60e('0x3d')]));_0xbbf7f2['attributes']=_0xbbf7f2[_0xb60e('0x3e')]['length']?_0xbbf7f2[_0xb60e('0x3e')]:_0x3b0cf6['model'];if(!_0x36dc28['query']['hasOwnProperty']('nolimit')){_0xbbf7f2[_0xb60e('0x26')]=qs['limit'](_0x36dc28[_0xb60e('0x39')]['limit']);_0xbbf7f2['offset']=qs[_0xb60e('0x24')](_0x36dc28[_0xb60e('0x39')][_0xb60e('0x24')]);}_0xbbf7f2[_0xb60e('0x3f')]=qs[_0xb60e('0x40')](_0x36dc28['query'][_0xb60e('0x40')]);_0xbbf7f2[_0xb60e('0x41')]=qs[_0xb60e('0x3a')](_[_0xb60e('0x42')](_0x36dc28[_0xb60e('0x39')],_0x3b0cf6[_0xb60e('0x3a')]),_0x1327c8);if(_0x36dc28[_0xb60e('0x39')]['filter']){_0xbbf7f2[_0xb60e('0x41')]=_['merge'](_0xbbf7f2[_0xb60e('0x41')],{'$or':_[_0xb60e('0x34')](_0x1327c8,function(_0x2c3b93){if(_0x2c3b93[_0xb60e('0x43')]!==_0xb60e('0x44')){var _0x52daa7={};_0x52daa7[_0x2c3b93['name']]={'$like':'%'+_0x36dc28[_0xb60e('0x39')][_0xb60e('0x45')]+'%'};return _0x52daa7;}})});}_0xbbf7f2=_[_0xb60e('0x46')]({},_0xbbf7f2,_0x36dc28[_0xb60e('0x47')]);var _0x11abba={'where':_0xbbf7f2[_0xb60e('0x41')]};return db['Setting']['count'](_0x11abba)[_0xb60e('0x18')](function(_0x2b534a){_0x31402f[_0xb60e('0x27')]=_0x2b534a;if(_0x36dc28['query'][_0xb60e('0x48')]){_0xbbf7f2[_0xb60e('0x49')]=[{'all':!![]}];}return db[_0xb60e('0x35')]['findAll'](_0xbbf7f2);})[_0xb60e('0x18')](function(_0x119aba){_0x31402f[_0xb60e('0x4a')]=_0x119aba;return _0x31402f;})[_0xb60e('0x18')](respondWithFilteredResult(_0x5a1ff4,_0xbbf7f2))[_0xb60e('0x21')](handleError(_0x5a1ff4,null));};exports['show']=function(_0x2afc03,_0x413c6b){var _0x428a2b={'raw':![],'where':{'id':_0x2afc03[_0xb60e('0x4b')]['id']}},_0x473edb={};_0x473edb['model']=_[_0xb60e('0x4c')](db[_0xb60e('0x35')][_0xb60e('0x4d')]);_0x473edb[_0xb60e('0x39')]=_[_0xb60e('0x4c')](_0x2afc03[_0xb60e('0x39')]);_0x473edb[_0xb60e('0x3a')]=_['intersection'](_0x473edb[_0xb60e('0x3c')],_0x473edb[_0xb60e('0x39')]);_0x428a2b[_0xb60e('0x3e')]=_['intersection'](_0x473edb[_0xb60e('0x3c')],qs[_0xb60e('0x3d')](_0x2afc03[_0xb60e('0x39')][_0xb60e('0x3d')]));_0x428a2b[_0xb60e('0x3e')]=_0x428a2b['attributes'][_0xb60e('0x4e')]?_0x428a2b[_0xb60e('0x3e')]:_0x473edb[_0xb60e('0x3c')];if(_0x2afc03[_0xb60e('0x39')][_0xb60e('0x48')]){_0x428a2b['include']=[{'all':!![]}];}_0x428a2b=_[_0xb60e('0x46')]({},_0x428a2b,_0x2afc03[_0xb60e('0x47')]);return db['Setting'][_0xb60e('0x4f')](_0x428a2b)['then'](handleEntityNotFound(_0x413c6b,null))[_0xb60e('0x18')](respondWithResult(_0x413c6b,null))[_0xb60e('0x21')](handleError(_0x413c6b,null));};exports[_0xb60e('0x2e')]=function(_0x387449,_0x577027){if(_0x387449[_0xb60e('0x50')]['id']){delete _0x387449[_0xb60e('0x50')]['id'];}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x387449[_0xb60e('0x4b')]['id']}})[_0xb60e('0x18')](handleEntityNotFound(_0x577027,null))[_0xb60e('0x18')](saveUpdates(_0x387449['body'],null))[_0xb60e('0x18')](respondWithResult(_0x577027,null))['catch'](handleError(_0x577027,null));};exports[_0xb60e('0x51')]=function(_0x1f7502,_0x9aca59,_0x39d7a0){if(_0x1f7502['file']&&_0x1f7502[_0xb60e('0x52')]['filename']){_0x1f7502['body']['logo']=_0x1f7502['file']['filename'];}return db['Setting'][_0xb60e('0x4f')]({'where':{'id':_0x1f7502['params']['id']}})['then'](handleEntityNotFound(_0x9aca59,null))[_0xb60e('0x18')](saveUpdates(_0x1f7502['body'],null))['then'](respondWithResult(_0x9aca59,null))[_0xb60e('0x21')](handleError(_0x9aca59,null));};exports['addLogoLogin']=function(_0x3e3cc3,_0x14803c,_0x46d0ce){if(_0x3e3cc3[_0xb60e('0x52')]&&_0x3e3cc3[_0xb60e('0x52')][_0xb60e('0x53')]){_0x3e3cc3['body'][_0xb60e('0x54')]=_0x3e3cc3[_0xb60e('0x52')][_0xb60e('0x53')];}return db['Setting'][_0xb60e('0x4f')]({'where':{'id':_0x3e3cc3[_0xb60e('0x4b')]['id']}})[_0xb60e('0x18')](handleEntityNotFound(_0x14803c,null))[_0xb60e('0x18')](saveUpdates(_0x3e3cc3[_0xb60e('0x50')],null))[_0xb60e('0x18')](respondWithResult(_0x14803c,null))[_0xb60e('0x21')](handleError(_0x14803c,null));};var utilLicense=require(_0xb60e('0x14'));exports[_0xb60e('0x55')]=function(_0x13aab6,_0x31ccac,_0x233b61){var _0xc8c4df=_0xb60e('0x56');var _0x38f7be={'custom':![]};return utilLicense['getLicense']()[_0xb60e('0x18')](function(_0x5605db){if(_0x5605db){_0x38f7be=_0x5605db;}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x13aab6['params']['id']},'attributes':['logo',_0xb60e('0x54'),_0xb60e('0x57'),_0xb60e('0x58'),_0xb60e('0x59'),_0xb60e('0x5a'),_0xb60e('0x5b'),_0xb60e('0x5c')],'raw':!![]});})[_0xb60e('0x18')](handleEntityNotFound(_0x31ccac,null))[_0xb60e('0x18')](function(_0x26248f){if(_0x26248f){var _0x371b9=_0x26248f[_0xb60e('0x5d')]&&fs['existsSync'](path['join'](config[_0xb60e('0x5e')],_0xc8c4df,_[_0xb60e('0x5f')](_0x26248f['logo'])))?path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0xc8c4df,_[_0xb60e('0x5f')](_0x26248f[_0xb60e('0x5d')])):path['join'](config[_0xb60e('0x5e')],_0xc8c4df,_['toLower'](_0xb60e('0x61')));var _0x2f89d2=_0xb60e('0x62')+_[_0xb60e('0x63')]('logo');if(_0x26248f[_0x2f89d2]||!_0x38f7be['custom']){_0x371b9=path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0xc8c4df,_['toLower'](_0xb60e('0x61')));}if(!fs[_0xb60e('0x64')](_0x371b9)){throw new db[(_0xb60e('0x65'))][(_0xb60e('0x66'))](_[_0xb60e('0x63')]('logo')+_0xb60e('0x67'));}return _0x31ccac[_0xb60e('0x68')](_0x371b9);}})[_0xb60e('0x21')](handleError(_0x31ccac,null));};var utilLicense=require(_0xb60e('0x14'));exports[_0xb60e('0x69')]=function(_0x33f582,_0x182614,_0x7ac590){var _0x56fc71='server/files/images/logos';var _0x4a9311={'custom':![]};return utilLicense[_0xb60e('0x6a')]()[_0xb60e('0x18')](function(_0x10c4c6){if(_0x10c4c6){_0x4a9311=_0x10c4c6;}return db['Setting'][_0xb60e('0x4f')]({'where':{'id':_0x33f582[_0xb60e('0x4b')]['id']},'attributes':['logo',_0xb60e('0x54'),'preferred',_0xb60e('0x58'),_0xb60e('0x59'),_0xb60e('0x5a'),_0xb60e('0x5b'),_0xb60e('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x182614,null))[_0xb60e('0x18')](function(_0x197558){if(_0x197558){var _0x5219ad=_0x197558[_0xb60e('0x54')]&&fs[_0xb60e('0x64')](path['join'](config[_0xb60e('0x5e')],_0x56fc71,_['toLower'](_0x197558['loginLogo'])))?path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x56fc71,_['toLower'](_0x197558[_0xb60e('0x54')])):path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x56fc71,_[_0xb60e('0x5f')]('default_loginLogo.svg'));var _0xf19cc6=_0xb60e('0x62')+_[_0xb60e('0x63')](_0xb60e('0x54'));if(_0x197558[_0xf19cc6]||!_0x4a9311[_0xb60e('0x6b')]){_0x5219ad=path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x56fc71,_['toLower'](_0xb60e('0x6c')));}if(!fs['existsSync'](_0x5219ad)){throw new db['Sequelize'][(_0xb60e('0x66'))](_['upperFirst'](_0xb60e('0x54'))+_0xb60e('0x67'));}return _0x182614['download'](_0x5219ad);}})[_0xb60e('0x21')](handleError(_0x182614,null));};exports[_0xb60e('0x6d')]=function(_0x504a7b,_0x39430f){return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x504a7b[_0xb60e('0x4b')]['id']},'attributes':[_0xb60e('0x6e')]})[_0xb60e('0x18')](respondWithResult(_0x39430f,null))['catch'](handleError(_0x39430f,null));};exports['addPreferred']=function(_0x17c04f,_0x221258,_0x5a3b1b){if(_0x17c04f['file']&&_0x17c04f['file']['filename']){_0x17c04f['body'][_0xb60e('0x57')]=_0x17c04f[_0xb60e('0x52')][_0xb60e('0x53')];}return db['Setting'][_0xb60e('0x4f')]({'where':{'id':_0x17c04f[_0xb60e('0x4b')]['id']}})[_0xb60e('0x18')](handleEntityNotFound(_0x221258,null))[_0xb60e('0x18')](saveUpdates(_0x17c04f[_0xb60e('0x50')],null))[_0xb60e('0x18')](respondWithResult(_0x221258,null))[_0xb60e('0x21')](handleError(_0x221258,null));};var utilLicense=require(_0xb60e('0x14'));exports['getPreferred']=function(_0x40e0e6,_0x15f3c7,_0x2b9b21){var _0x4c3d92='server/files/images/logos';var _0x499d20={'custom':![]};return utilLicense[_0xb60e('0x6a')]()[_0xb60e('0x18')](function(_0x38167a){if(_0x38167a){_0x499d20=_0x38167a;}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x40e0e6[_0xb60e('0x4b')]['id']},'attributes':[_0xb60e('0x5d'),_0xb60e('0x54'),'preferred',_0xb60e('0x58'),_0xb60e('0x59'),_0xb60e('0x5a'),_0xb60e('0x5b'),_0xb60e('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x15f3c7,null))[_0xb60e('0x18')](function(_0x22cce9){if(_0x22cce9){var _0x5508e0=_0x22cce9[_0xb60e('0x57')]&&fs[_0xb60e('0x64')](path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x4c3d92,_['toLower'](_0x22cce9[_0xb60e('0x57')])))?path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x4c3d92,_[_0xb60e('0x5f')](_0x22cce9[_0xb60e('0x57')])):path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x4c3d92,_[_0xb60e('0x5f')](_0xb60e('0x6f')));var _0x204e6c=_0xb60e('0x62')+_[_0xb60e('0x63')](_0xb60e('0x57'));if(_0x22cce9[_0x204e6c]||!_0x499d20['custom']||!_0x499d20['preferred']){_0x5508e0=path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x4c3d92,_[_0xb60e('0x5f')](_0xb60e('0x6f')));}if(!fs[_0xb60e('0x64')](_0x5508e0)){throw new db[(_0xb60e('0x65'))][(_0xb60e('0x66'))](_['upperFirst']('preferred')+_0xb60e('0x67'));}return _0x15f3c7['download'](_0x5508e0);}})['catch'](handleError(_0x15f3c7,null));};exports[_0xb60e('0x70')]=function(_0x4db7ad,_0x107bfc,_0x1b653a){if(_0x4db7ad['file']&&_0x4db7ad[_0xb60e('0x52')]['filename']){_0x4db7ad[_0xb60e('0x50')][_0xb60e('0x58')]=_0x4db7ad['file'][_0xb60e('0x53')];}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x4db7ad[_0xb60e('0x4b')]['id']}})[_0xb60e('0x18')](handleEntityNotFound(_0x107bfc,null))[_0xb60e('0x18')](saveUpdates(_0x4db7ad['body'],null))[_0xb60e('0x18')](respondWithResult(_0x107bfc,null))[_0xb60e('0x21')](handleError(_0x107bfc,null));};var utilLicense=require(_0xb60e('0x14'));exports[_0xb60e('0x71')]=function(_0x451b41,_0x3fbaba,_0x14b7f1){var _0x24497a=_0xb60e('0x56');var _0x1a38b9={'custom':![]};return utilLicense['getLicense']()[_0xb60e('0x18')](function(_0x1cca86){if(_0x1cca86){_0x1a38b9=_0x1cca86;}return db[_0xb60e('0x35')][_0xb60e('0x4f')]({'where':{'id':_0x451b41[_0xb60e('0x4b')]['id']},'attributes':['logo',_0xb60e('0x54'),_0xb60e('0x57'),_0xb60e('0x58'),_0xb60e('0x59'),_0xb60e('0x5a'),'defaultPreferred',_0xb60e('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x3fbaba,null))['then'](function(_0x4ca4db){if(_0x4ca4db){var _0x48e455=_0x4ca4db['favicon']&&fs[_0xb60e('0x64')](path['join'](config['root'],_0x24497a,_[_0xb60e('0x5f')](_0x4ca4db[_0xb60e('0x58')])))?path[_0xb60e('0x60')](config[_0xb60e('0x5e')],_0x24497a,_[_0xb60e('0x5f')](_0x4ca4db['favicon'])):path['join'](config['root'],_0x24497a,_[_0xb60e('0x5f')](_0xb60e('0x72')));var _0x2d64bb=_0xb60e('0x62')+_[_0xb60e('0x63')](_0xb60e('0x58'));if(_0x4ca4db[_0x2d64bb]||!_0x1a38b9[_0xb60e('0x6b')]){_0x48e455=path[_0xb60e('0x60')](config['root'],_0x24497a,_[_0xb60e('0x5f')](_0xb60e('0x72')));}if(!fs[_0xb60e('0x64')](_0x48e455)){throw new db[(_0xb60e('0x65'))]['ValidationError'](_[_0xb60e('0x63')](_0xb60e('0x58'))+_0xb60e('0x67'));}return _0x3fbaba[_0xb60e('0x68')](_0x48e455);}})[_0xb60e('0x21')](handleError(_0x3fbaba,null));};exports['getDate']=function(_0x5d2c8c,_0x540d08){var _0x1005c1={'offset':moment()[_0xb60e('0x73')]()};_0x1005c1[_0xb60e('0x74')]=moment()[_0xb60e('0x73')](_0x1005c1[_0xb60e('0x24')])[_0xb60e('0x75')](_0xb60e('0x76'));return _0x540d08[_0xb60e('0x22')](0xc8)['send'](_0x1005c1);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index adc4bab..07a0e85 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x26d5aa,_0x3df31d){var _0x130e08=function(_0x4e2f9f){while(--_0x4e2f9f){_0x26d5aa['push'](_0x26d5aa['shift']());}};_0x130e08(++_0x3df31d);}(_0x34e8,0x12c));var _0x834e=function(_0x50ecf8,_0x15b9f0){_0x50ecf8=_0x50ecf8-0x0;var _0x3ace73=_0x34e8[_0x50ecf8];return _0x3ace73;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x40e071,_0x46e70d){var _0x445750=function(_0x34d471){while(--_0x34d471){_0x40e071['push'](_0x40e071['shift']());}};_0x445750(++_0x46e70d);}(_0xe14b,0x93));var _0xbe14=function(_0x1bb26e,_0x2de2e9){_0x1bb26e=_0x1bb26e-0x0;var _0x1866d0=_0xe14b[_0x1bb26e];return _0x1866d0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f7b8d7a..69b97b9 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 _0xf660=['map','model','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ShowSetting','Setting','options','raw','where','attributes','include'];(function(_0x1cfba6,_0x519f79){var _0x5390d1=function(_0x3b40f8){while(--_0x3b40f8){_0x1cfba6['push'](_0x1cfba6['shift']());}};_0x5390d1(++_0x519f79);}(_0xf660,0x83));var _0x0f66=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0xf660[_0x3b7b8a];return _0x441206;};'use strict';var _=require(_0x0f66('0x0'));var util=require('util');var moment=require(_0x0f66('0x1'));var BPromise=require(_0x0f66('0x2'));var rs=require(_0x0f66('0x3'));var fs=require('fs');var Redis=require(_0x0f66('0x4'));var db=require(_0x0f66('0x5'))['db'];var utils=require(_0x0f66('0x6'));var logger=require(_0x0f66('0x7'))(_0x0f66('0x8'));var config=require(_0x0f66('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0f66('0xa')][_0x0f66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dc803,_0x19971f,_0x158800){return new BPromise(function(_0x3e7282,_0xc793fc){return client[_0x0f66('0xc')](_0x1dc803,_0x158800)[_0x0f66('0xd')](function(_0x30ca3c){logger['info'](_0x0f66('0xe'),_0x19971f,'request\x20sent');logger[_0x0f66('0xf')](_0x0f66('0x10'),_0x19971f,_0x0f66('0x11'),JSON[_0x0f66('0x12')](_0x30ca3c));if(_0x30ca3c[_0x0f66('0x13')]){if(_0x30ca3c[_0x0f66('0x13')][_0x0f66('0x14')]===0x1f4){logger[_0x0f66('0x13')]('Setting,\x20%s,\x20%s',_0x19971f,_0x30ca3c[_0x0f66('0x13')][_0x0f66('0x15')]);return _0xc793fc(_0x30ca3c[_0x0f66('0x13')][_0x0f66('0x15')]);}logger[_0x0f66('0x13')](_0x0f66('0xe'),_0x19971f,_0x30ca3c[_0x0f66('0x13')][_0x0f66('0x15')]);return _0x3e7282(_0x30ca3c[_0x0f66('0x13')][_0x0f66('0x15')]);}else{logger['info'](_0x0f66('0xe'),_0x19971f,_0x0f66('0x11'));_0x3e7282(_0x30ca3c['result'][_0x0f66('0x15')]);}})['catch'](function(_0x4810bb){logger[_0x0f66('0x13')](_0x0f66('0xe'),_0x19971f,_0x4810bb);_0xc793fc(_0x4810bb);});});}exports[_0x0f66('0x16')]=function(_0x4e4af9){var _0x596353=this;return new Promise(function(_0x3e1dd3,_0x559f07){return db[_0x0f66('0x17')]['find']({'raw':_0x4e4af9['options']?_0x4e4af9[_0x0f66('0x18')][_0x0f66('0x19')]===undefined?!![]:![]:!![],'where':_0x4e4af9[_0x0f66('0x18')]?_0x4e4af9[_0x0f66('0x18')][_0x0f66('0x1a')]||null:null,'attributes':_0x4e4af9[_0x0f66('0x18')]?_0x4e4af9['options'][_0x0f66('0x1b')]||null:null,'include':_0x4e4af9[_0x0f66('0x18')]?_0x4e4af9['options'][_0x0f66('0x1c')]?_[_0x0f66('0x1d')](_0x4e4af9[_0x0f66('0x18')][_0x0f66('0x1c')],function(_0x1b51e3){return{'model':db[_0x1b51e3[_0x0f66('0x1e')]],'as':_0x1b51e3['as'],'attributes':_0x1b51e3['attributes'],'include':_0x1b51e3[_0x0f66('0x1c')]?_['map'](_0x1b51e3['include'],function(_0x1f0a58){return{'model':db[_0x1f0a58[_0x0f66('0x1e')]],'as':_0x1f0a58['as'],'attributes':_0x1f0a58[_0x0f66('0x1b')],'include':_0x1f0a58[_0x0f66('0x1c')]?_[_0x0f66('0x1d')](_0x1f0a58['include'],function(_0xaa90c2){return{'model':db[_0xaa90c2[_0x0f66('0x1e')]],'as':_0xaa90c2['as'],'attributes':_0xaa90c2[_0x0f66('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0f66('0xd')](function(_0x5bcf06){logger[_0x0f66('0x1f')](_0x0f66('0x16'),_0x4e4af9);logger[_0x0f66('0xf')](_0x0f66('0x16'),_0x4e4af9,JSON['stringify'](_0x5bcf06));_0x3e1dd3(_0x5bcf06);})['catch'](function(_0x2d2dae){logger[_0x0f66('0x13')]('ShowSetting',_0x2d2dae['message'],_0x4e4af9);_0x559f07(_0x596353[_0x0f66('0x13')](0x1f4,_0x2d2dae['message']));});});}; \ No newline at end of file +var _0x5be3=['Setting','options','raw','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting'];(function(_0x3e6370,_0x72cdbe){var _0x349dd7=function(_0x223971){while(--_0x223971){_0x3e6370['push'](_0x3e6370['shift']());}};_0x349dd7(++_0x72cdbe);}(_0x5be3,0xe7));var _0x35be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5be3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x35be('0x0'));var util=require(_0x35be('0x1'));var moment=require(_0x35be('0x2'));var BPromise=require(_0x35be('0x3'));var rs=require(_0x35be('0x4'));var fs=require('fs');var Redis=require(_0x35be('0x5'));var db=require(_0x35be('0x6'))['db'];var utils=require(_0x35be('0x7'));var logger=require(_0x35be('0x8'))(_0x35be('0x9'));var config=require(_0x35be('0xa'));var jayson=require(_0x35be('0xb'));var client=jayson['client'][_0x35be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1af29f,_0x5174ad,_0x209038){return new BPromise(function(_0xa4240d,_0x2ece68){return client[_0x35be('0xd')](_0x1af29f,_0x209038)['then'](function(_0x113481){logger[_0x35be('0xe')](_0x35be('0xf'),_0x5174ad,_0x35be('0x10'));logger[_0x35be('0x11')](_0x35be('0x12'),_0x5174ad,_0x35be('0x10'),JSON[_0x35be('0x13')](_0x113481));if(_0x113481[_0x35be('0x14')]){if(_0x113481[_0x35be('0x14')]['code']===0x1f4){logger[_0x35be('0x14')](_0x35be('0xf'),_0x5174ad,_0x113481[_0x35be('0x14')][_0x35be('0x15')]);return _0x2ece68(_0x113481[_0x35be('0x14')]['message']);}logger[_0x35be('0x14')](_0x35be('0xf'),_0x5174ad,_0x113481[_0x35be('0x14')][_0x35be('0x15')]);return _0xa4240d(_0x113481[_0x35be('0x14')][_0x35be('0x15')]);}else{logger[_0x35be('0xe')](_0x35be('0xf'),_0x5174ad,'request\x20sent');_0xa4240d(_0x113481[_0x35be('0x16')]['message']);}})[_0x35be('0x17')](function(_0x5bd96a){logger[_0x35be('0x14')](_0x35be('0xf'),_0x5174ad,_0x5bd96a);_0x2ece68(_0x5bd96a);});});}exports[_0x35be('0x18')]=function(_0xd270e4){var _0x45a883=this;return new Promise(function(_0x2048e2,_0x48b309){return db[_0x35be('0x19')]['find']({'raw':_0xd270e4[_0x35be('0x1a')]?_0xd270e4[_0x35be('0x1a')][_0x35be('0x1b')]===undefined?!![]:![]:!![],'where':_0xd270e4[_0x35be('0x1a')]?_0xd270e4[_0x35be('0x1a')]['where']||null:null,'attributes':_0xd270e4[_0x35be('0x1a')]?_0xd270e4[_0x35be('0x1a')]['attributes']||null:null,'include':_0xd270e4[_0x35be('0x1a')]?_0xd270e4[_0x35be('0x1a')][_0x35be('0x1c')]?_[_0x35be('0x1d')](_0xd270e4['options'][_0x35be('0x1c')],function(_0x2af771){return{'model':db[_0x2af771[_0x35be('0x1e')]],'as':_0x2af771['as'],'attributes':_0x2af771['attributes'],'include':_0x2af771[_0x35be('0x1c')]?_['map'](_0x2af771[_0x35be('0x1c')],function(_0x332bd9){return{'model':db[_0x332bd9[_0x35be('0x1e')]],'as':_0x332bd9['as'],'attributes':_0x332bd9[_0x35be('0x1f')],'include':_0x332bd9[_0x35be('0x1c')]?_[_0x35be('0x1d')](_0x332bd9['include'],function(_0xb56b45){return{'model':db[_0xb56b45[_0x35be('0x1e')]],'as':_0xb56b45['as'],'attributes':_0xb56b45[_0x35be('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x501fdc){logger['info'](_0x35be('0x18'),_0xd270e4);logger[_0x35be('0x11')](_0x35be('0x18'),_0xd270e4,JSON[_0x35be('0x13')](_0x501fdc));_0x2048e2(_0x501fdc);})['catch'](function(_0x3e07d8){logger['error']('ShowSetting',_0x3e07d8[_0x35be('0x15')],_0xd270e4);_0x48b309(_0x45a883['error'](0x1f4,_0x3e07d8[_0x35be('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d5521bd..599faba 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 _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x30b52d,_0xad2490){var _0x4cb968=function(_0xac0624){while(--_0xac0624){_0x30b52d['push'](_0x30b52d['shift']());}};_0x4cb968(++_0xad2490);}(_0x53ec,0x192));var _0xc53e=function(_0x178b23,_0x1ab486){_0x178b23=_0x178b23-0x0;var _0x199850=_0x53ec[_0x178b23];return _0x199850;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x36dd93,_0x369285){var _0x365304=function(_0x39d5ee){while(--_0x39d5ee){_0x36dd93['push'](_0x36dd93['shift']());}};_0x365304(++_0x369285);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index be2760f..d3a016e 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 _0x8094=['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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc'];(function(_0x5e708b,_0x3f186f){var _0xc993e0=function(_0x2ebf0c){while(--_0x2ebf0c){_0x5e708b['push'](_0x5e708b['shift']());}};_0xc993e0(++_0x3f186f);}(_0x8094,0x13e));var _0x4809=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x8094[_0x888385];return _0x22d5c2;};'use strict';var Sequelize=require(_0x4809('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x4809('0x1')],'unique':_0x4809('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x4809('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x4809('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4809('0x3')]();}},'phone':{'type':Sequelize[_0x4809('0x1')]},'type':{'type':Sequelize[_0x4809('0x4')](_0x4809('0x5'),'skebby',_0x4809('0x6'),_0x4809('0x7'),_0x4809('0x8'),_0x4809('0x9'),_0x4809('0xa'),_0x4809('0xb'),'infobip',_0x4809('0xc'))},'accountSid':{'type':Sequelize[_0x4809('0x1')]},'authId':{'type':Sequelize[_0x4809('0x1')]},'authToken':{'type':Sequelize[_0x4809('0x1')]},'smsMethod':{'type':Sequelize[_0x4809('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x4809('0x1')]},'accountId':{'type':Sequelize[_0x4809('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x4809('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x4809('0x1')]},'notificationTemplate':{'type':Sequelize[_0x4809('0xe')],'defaultValue':function(){return _0x4809('0xf');}},'notificationSound':{'type':Sequelize[_0x4809('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4809('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4809('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4809('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4809('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4809('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4809('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x4809('0xd')],'defaultValue':![],'comment':_0x4809('0x12'),'set':function(_0x25203c){if(!_0x25203c)this[_0x4809('0x13')](_0x4809('0x14'),null);this[_0x4809('0x13')](_0x4809('0x15'),_0x25203c);}}}; \ No newline at end of file +var _0x7c27=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x466aeb,_0x3a35bf){var _0x57818e=function(_0x28ac49){while(--_0x28ac49){_0x466aeb['push'](_0x466aeb['shift']());}};_0x57818e(++_0x3a35bf);}(_0x7c27,0x18f));var _0x77c2=function(_0x38b899,_0x569bf6){_0x38b899=_0x38b899-0x0;var _0x363231=_0x7c27[_0x38b899];return _0x363231;};'use strict';var Sequelize=require(_0x77c2('0x0'));var rs=require(_0x77c2('0x1'));module['exports']={'name':{'type':Sequelize[_0x77c2('0x2')],'unique':_0x77c2('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x77c2('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x77c2('0x2')],'defaultValue':function(){return rs[_0x77c2('0x4')]();}},'phone':{'type':Sequelize[_0x77c2('0x2')]},'type':{'type':Sequelize[_0x77c2('0x5')](_0x77c2('0x6'),_0x77c2('0x7'),'connectel',_0x77c2('0x8'),_0x77c2('0x9'),_0x77c2('0xa'),_0x77c2('0xb'),_0x77c2('0xc'),'infobip',_0x77c2('0xd'))},'accountSid':{'type':Sequelize[_0x77c2('0x2')]},'authId':{'type':Sequelize[_0x77c2('0x2')]},'authToken':{'type':Sequelize[_0x77c2('0x2')]},'smsMethod':{'type':Sequelize[_0x77c2('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x77c2('0x2')]},'applicationId':{'type':Sequelize[_0x77c2('0x2')]},'accountId':{'type':Sequelize[_0x77c2('0x2')]},'senderString':{'type':Sequelize[_0x77c2('0x2')]},'deliveryReport':{'type':Sequelize[_0x77c2('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x77c2('0xf')],'defaultValue':function(){return _0x77c2('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x77c2('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x77c2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x77c2('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x77c2('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x77c2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x77c2('0x11')],'comment':_0x77c2('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x503a15){if(!_0x503a15)this[_0x77c2('0x13')](_0x77c2('0x14'),null);this[_0x77c2('0x13')](_0x77c2('0x15'),_0x503a15);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a1bbf51..93fe7b4 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 _0xbcb7=['destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','includeAll','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','account','applications','orderBy','Applications','priority','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','Body','messageId','sender','connectel','clicksend','message_id','plivo','Text','infobip','results','text','originatingAddress','segmentedMessage','replyMessageId','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','SmsMessage','ContactId','User','UserId','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','addApplications','sequelize','SmsApplication','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','List','DESC','out','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','clickatell','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','bandwidth','DELIVRD','ACCEPTD','statusGet','csc','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update'];(function(_0x14fe6f,_0x1821d9){var _0x2e395d=function(_0x3f735c){while(--_0x3f735c){_0x14fe6f['push'](_0x14fe6f['shift']());}};_0x2e395d(++_0x1821d9);}(_0xbcb7,0x18c));var _0x7bcb=function(_0x45e8e4,_0x56c8c1){_0x45e8e4=_0x45e8e4-0x0;var _0x4fcfb8=_0xbcb7[_0x45e8e4];return _0x4fcfb8;};'use strict';var emlformat=require(_0x7bcb('0x0'));var rimraf=require(_0x7bcb('0x1'));var zipdir=require(_0x7bcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7bcb('0x3'));var BPromise=require(_0x7bcb('0x4'));var Mustache=require(_0x7bcb('0x5'));var util=require(_0x7bcb('0x6'));var path=require(_0x7bcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bcb('0x8'));var _=require(_0x7bcb('0x9'));var squel=require(_0x7bcb('0xa'));var crypto=require(_0x7bcb('0xb'));var jsforce=require(_0x7bcb('0xc'));var deskjs=require(_0x7bcb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7bcb('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7bcb('0xf'));var qs=require(_0x7bcb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bcb('0x11'))(_0x7bcb('0x12'));var utils=require(_0x7bcb('0x13'));var config=require(_0x7bcb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bcb('0x15'))['db'];config[_0x7bcb('0x16')]=_[_0x7bcb('0x17')](config[_0x7bcb('0x16')],{'host':_0x7bcb('0x18'),'port':0x18eb});var socket=require(_0x7bcb('0x19'))(new Redis(config[_0x7bcb('0x16')]));require(_0x7bcb('0x1a'))[_0x7bcb('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7bcb('0x1c')][_0x7bcb('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5cb53f,_0x11e783,_0x1afa56,_0x23fa72){return new BPromise(function(_0xe20e01,_0x351aad){var _0x3f9e14=_0x23fa72||client;return _0x3f9e14[_0x7bcb('0x1e')](_0x5cb53f,_0x1afa56)[_0x7bcb('0x1f')](function(_0x1fcb94){logger[_0x7bcb('0x20')](_0x7bcb('0x21'),_0x11e783,_0x7bcb('0x22'));logger[_0x7bcb('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x11e783,_0x7bcb('0x22'),JSON[_0x7bcb('0x24')](_0x1fcb94));if(_0x1fcb94[_0x7bcb('0x25')]){if(_0x1fcb94[_0x7bcb('0x25')][_0x7bcb('0x26')]===0x1f4){logger['error'](_0x7bcb('0x21'),_0x11e783,_0x1fcb94[_0x7bcb('0x25')][_0x7bcb('0x27')]);return _0x351aad(_0x1fcb94[_0x7bcb('0x25')]['message']);}logger[_0x7bcb('0x25')](_0x7bcb('0x21'),_0x11e783,_0x1fcb94[_0x7bcb('0x25')]['message']);return _0xe20e01(_0x1fcb94[_0x7bcb('0x25')][_0x7bcb('0x27')]);}else{logger['info'](_0x7bcb('0x21'),_0x11e783,_0x7bcb('0x22'));_0xe20e01(_0x1fcb94[_0x7bcb('0x28')][_0x7bcb('0x27')]);}})[_0x7bcb('0x29')](function(_0x57fec7){logger[_0x7bcb('0x25')]('SmsAccount,\x20%s,\x20%s',_0x11e783,_0x57fec7);_0x351aad(_0x57fec7);});});}function respondWithStatusCode(_0x818bb2,_0x5b1aa5){_0x5b1aa5=_0x5b1aa5||0xcc;return function(_0x4ca0b8){if(_0x4ca0b8){return _0x818bb2[_0x7bcb('0x2a')](_0x5b1aa5);}return _0x818bb2[_0x7bcb('0x2b')](_0x5b1aa5)[_0x7bcb('0x2c')]();};}function respondWithResult(_0x3a3bc1,_0x51dd0c){_0x51dd0c=_0x51dd0c||0xc8;return function(_0x1aa842){if(_0x1aa842){return _0x3a3bc1[_0x7bcb('0x2b')](_0x51dd0c)[_0x7bcb('0x2d')](_0x1aa842);}};}function respondWithFilteredResult(_0xe596fa,_0x2fb940){return function(_0x4643e3){if(_0x4643e3){var _0x123bc6=typeof _0x2fb940['offset']===_0x7bcb('0x2e')&&typeof _0x2fb940[_0x7bcb('0x2f')]===_0x7bcb('0x2e');var _0x7e1bf9=_0x4643e3[_0x7bcb('0x30')];var _0x2e22fb=_0x123bc6?0x0:_0x2fb940['offset'];var _0x3c5b25=_0x123bc6?_0x4643e3[_0x7bcb('0x30')]:_0x2fb940[_0x7bcb('0x31')]+_0x2fb940['limit'];var _0x1b9bd2;if(_0x3c5b25>=_0x7e1bf9){_0x3c5b25=_0x7e1bf9;_0x1b9bd2=0xc8;}else{_0x1b9bd2=0xce;}_0xe596fa[_0x7bcb('0x2b')](_0x1b9bd2);return _0xe596fa['set']('Content-Range',_0x2e22fb+'-'+_0x3c5b25+'/'+_0x7e1bf9)[_0x7bcb('0x2d')](_0x4643e3);}return null;};}function patchUpdates(_0x24b53b){return function(_0x38f27b){try{jsonpatch[_0x7bcb('0x32')](_0x38f27b,_0x24b53b,!![]);}catch(_0x86b69e){return BPromise[_0x7bcb('0x33')](_0x86b69e);}return _0x38f27b[_0x7bcb('0x34')]();};}function saveUpdates(_0x328439,_0x151280){return function(_0x1580c8){if(_0x1580c8){return _0x1580c8[_0x7bcb('0x35')](_0x328439)[_0x7bcb('0x1f')](function(_0x22be46){return _0x22be46;});}return null;};}function removeEntity(_0x5aa254,_0x213b9d){return function(_0x199a34){if(_0x199a34){return _0x199a34[_0x7bcb('0x36')]()['then'](function(){var _0x49e3ff=_0x199a34[_0x7bcb('0x37')]({'plain':!![]});var _0x4933c0='SmsAccounts';return db[_0x7bcb('0x38')][_0x7bcb('0x36')]({'where':{'type':_0x4933c0,'resourceId':_0x49e3ff['id']}})[_0x7bcb('0x1f')](function(){return _0x199a34;});})[_0x7bcb('0x1f')](function(){_0x5aa254[_0x7bcb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dca62,_0x5a8f89){return function(_0x15f437){if(!_0x15f437){_0x5dca62[_0x7bcb('0x2a')](0x194);}return _0x15f437;};}function handleError(_0x22ef3a,_0x223d82){_0x223d82=_0x223d82||0x1f4;return function(_0x442465){logger[_0x7bcb('0x25')](_0x442465[_0x7bcb('0x39')]);if(_0x442465[_0x7bcb('0x3a')]){delete _0x442465[_0x7bcb('0x3a')];}_0x22ef3a[_0x7bcb('0x2b')](_0x223d82)[_0x7bcb('0x3b')](_0x442465);};}exports[_0x7bcb('0x3c')]=function(_0x3a579f,_0x1935cd){var _0x56bf8f={'include':[{'model':db[_0x7bcb('0x3d')],'as':_0x7bcb('0x3e')}]},_0x1f46d6={},_0x359b56={'count':0x0,'rows':[]};var _0x49dc1f=_[_0x7bcb('0x3f')](db[_0x7bcb('0x40')][_0x7bcb('0x41')],function(_0x24f811){return{'name':_0x24f811[_0x7bcb('0x42')],'type':_0x24f811[_0x7bcb('0x43')]['key']};});_0x1f46d6['model']=_['map'](_0x49dc1f,_0x7bcb('0x3a'));_0x1f46d6[_0x7bcb('0x44')]=_[_0x7bcb('0x45')](_0x3a579f[_0x7bcb('0x44')]);_0x1f46d6[_0x7bcb('0x46')]=_[_0x7bcb('0x47')](_0x1f46d6['model'],_0x1f46d6[_0x7bcb('0x44')]);_0x56bf8f[_0x7bcb('0x48')]=_['intersection'](_0x1f46d6[_0x7bcb('0x49')],qs['fields'](_0x3a579f[_0x7bcb('0x44')][_0x7bcb('0x4a')]));_0x56bf8f['attributes']=_0x56bf8f[_0x7bcb('0x48')][_0x7bcb('0x4b')]?_0x56bf8f['attributes']:_0x1f46d6['model'];if(!_0x3a579f['query'][_0x7bcb('0x4c')](_0x7bcb('0x4d'))){_0x56bf8f[_0x7bcb('0x2f')]=qs[_0x7bcb('0x2f')](_0x3a579f[_0x7bcb('0x44')]['limit']);_0x56bf8f['offset']=qs[_0x7bcb('0x31')](_0x3a579f[_0x7bcb('0x44')][_0x7bcb('0x31')]);}_0x56bf8f[_0x7bcb('0x4e')]=qs[_0x7bcb('0x4f')](_0x3a579f[_0x7bcb('0x44')][_0x7bcb('0x4f')]);_0x56bf8f['where']=qs['filters'](_[_0x7bcb('0x50')](_0x3a579f[_0x7bcb('0x44')],_0x1f46d6[_0x7bcb('0x46')]),_0x49dc1f);if(_0x3a579f[_0x7bcb('0x44')][_0x7bcb('0x51')]){_0x56bf8f[_0x7bcb('0x52')]=_[_0x7bcb('0x53')](_0x56bf8f[_0x7bcb('0x52')],{'$or':_[_0x7bcb('0x3f')](_0x49dc1f,function(_0x4763c8){if(_0x4763c8[_0x7bcb('0x43')]!==_0x7bcb('0x54')){var _0x4d6225={};_0x4d6225[_0x4763c8['name']]={'$like':'%'+_0x3a579f['query'][_0x7bcb('0x51')]+'%'};return _0x4d6225;}})});}_0x56bf8f=_[_0x7bcb('0x53')]({},_0x56bf8f,_0x3a579f[_0x7bcb('0x55')]);var _0x4d3826={'where':_0x56bf8f[_0x7bcb('0x52')]};return db['SmsAccount'][_0x7bcb('0x30')](_0x4d3826)['then'](function(_0x482a55){_0x359b56[_0x7bcb('0x30')]=_0x482a55;if(_0x3a579f['query']['includeAll']){_0x56bf8f[_0x7bcb('0x56')]=[{'all':!![]}];}return db[_0x7bcb('0x40')]['findAll'](_0x56bf8f);})[_0x7bcb('0x1f')](function(_0x911ab){_0x359b56[_0x7bcb('0x57')]=_0x911ab;return _0x359b56;})[_0x7bcb('0x1f')](respondWithFilteredResult(_0x1935cd,_0x56bf8f))[_0x7bcb('0x29')](handleError(_0x1935cd,null));};exports[_0x7bcb('0x58')]=function(_0x5e3f71,_0xe2d7b6){var _0x179fc0={'raw':![],'where':{'id':_0x5e3f71[_0x7bcb('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x7bcb('0x3e')}]},_0x3ccfad={};_0x3ccfad['model']=_['keys'](db[_0x7bcb('0x40')][_0x7bcb('0x41')]);_0x3ccfad['query']=_[_0x7bcb('0x45')](_0x5e3f71['query']);_0x3ccfad[_0x7bcb('0x46')]=_[_0x7bcb('0x47')](_0x3ccfad[_0x7bcb('0x49')],_0x3ccfad[_0x7bcb('0x44')]);_0x179fc0['attributes']=_[_0x7bcb('0x47')](_0x3ccfad[_0x7bcb('0x49')],qs[_0x7bcb('0x4a')](_0x5e3f71[_0x7bcb('0x44')]['fields']));_0x179fc0['attributes']=_0x179fc0[_0x7bcb('0x48')][_0x7bcb('0x4b')]?_0x179fc0[_0x7bcb('0x48')]:_0x3ccfad[_0x7bcb('0x49')];if(_0x5e3f71[_0x7bcb('0x44')]['includeAll']){_0x179fc0[_0x7bcb('0x56')]=[{'all':!![]}];}_0x179fc0=_[_0x7bcb('0x53')]({},_0x179fc0,_0x5e3f71[_0x7bcb('0x55')]);return db['SmsAccount'][_0x7bcb('0x5a')](_0x179fc0)[_0x7bcb('0x1f')](handleEntityNotFound(_0xe2d7b6,null))[_0x7bcb('0x1f')](respondWithResult(_0xe2d7b6,null))[_0x7bcb('0x29')](handleError(_0xe2d7b6,null));};exports['create']=function(_0x34ffc8,_0xe955bd){return db[_0x7bcb('0x40')][_0x7bcb('0x5b')](_0x34ffc8[_0x7bcb('0x5c')],{})[_0x7bcb('0x1f')](function(_0x1501e5){var _0x14ed43=_0x34ffc8['user'][_0x7bcb('0x37')]({'plain':!![]});if(!_0x14ed43)throw new Error(_0x7bcb('0x5d'));if(_0x14ed43[_0x7bcb('0x5e')]===_0x7bcb('0x5f')){var _0x381207=_0x1501e5['get']({'plain':!![]});var _0x327d90=_0x7bcb('0x60');return db['UserProfileSection']['find']({'where':{'name':_0x327d90,'userProfileId':_0x14ed43[_0x7bcb('0x61')]},'raw':!![]})['then'](function(_0x155e6e){if(_0x155e6e&&_0x155e6e['autoAssociation']===0x0){return db[_0x7bcb('0x38')]['create']({'name':_0x381207[_0x7bcb('0x3a')],'resourceId':_0x381207['id'],'type':_0x155e6e[_0x7bcb('0x3a')],'sectionId':_0x155e6e['id']},{})[_0x7bcb('0x1f')](function(){return _0x1501e5;});}else{return _0x1501e5;}})[_0x7bcb('0x29')](function(_0x2c7f7b){logger[_0x7bcb('0x25')](_0x7bcb('0x62'),_0x2c7f7b);throw _0x2c7f7b;});}return _0x1501e5;})[_0x7bcb('0x1f')](respondWithResult(_0xe955bd,0xc9))['catch'](handleError(_0xe955bd,null));};exports['update']=function(_0x344502,_0x397992){if(_0x344502['body']['id']){delete _0x344502[_0x7bcb('0x5c')]['id'];}return db['SmsAccount'][_0x7bcb('0x5a')]({'where':{'id':_0x344502[_0x7bcb('0x59')]['id']},'include':[{'model':db[_0x7bcb('0x3d')],'as':_0x7bcb('0x3e')}]})['then'](handleEntityNotFound(_0x397992,null))[_0x7bcb('0x1f')](saveUpdates(_0x344502[_0x7bcb('0x5c')],null))[_0x7bcb('0x1f')](respondWithResult(_0x397992,null))[_0x7bcb('0x29')](handleError(_0x397992,null));};exports[_0x7bcb('0x36')]=function(_0x5367ad,_0x1ac301){return db['SmsAccount'][_0x7bcb('0x5a')]({'where':{'id':_0x5367ad[_0x7bcb('0x59')]['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x1ac301,null))[_0x7bcb('0x1f')](removeEntity(_0x1ac301,null))[_0x7bcb('0x29')](handleError(_0x1ac301,null));};exports[_0x7bcb('0x63')]=function(_0x171142,_0x5c1ab5){return db[_0x7bcb('0x40')][_0x7bcb('0x63')]()['then'](respondWithResult(_0x5c1ab5,null))['catch'](handleError(_0x5c1ab5,null));};exports[_0x7bcb('0x64')]=function(_0x1effd3,_0xe03089,_0x539645){if(_0x1effd3[_0x7bcb('0x5c')]['id']){delete _0x1effd3[_0x7bcb('0x5c')]['id'];}return db[_0x7bcb('0x40')][_0x7bcb('0x5a')]({'where':{'id':_0x1effd3['params']['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0xe03089,null))[_0x7bcb('0x1f')](function(_0x183849){if(_0x183849){_0x1effd3['body'][_0x7bcb('0x65')]=_0x183849['id'];return db[_0x7bcb('0x66')][_0x7bcb('0x5b')](_0x1effd3[_0x7bcb('0x5c')]);}})[_0x7bcb('0x1f')](respondWithResult(_0xe03089,null))[_0x7bcb('0x29')](handleError(_0xe03089,null));};exports[_0x7bcb('0x67')]=function(_0x395e9c,_0x5ee0c9,_0x195168){var _0x4cf06d={'raw':![],'where':{}};var _0x59c7ca={};var _0x4527a2={'count':0x0,'rows':[]};return db[_0x7bcb('0x40')][_0x7bcb('0x68')]({'where':{'id':_0x395e9c['params']['id']}})['then'](handleEntityNotFound(_0x5ee0c9,null))[_0x7bcb('0x1f')](function(_0x2a9734){if(_0x2a9734){_0x59c7ca['model']=_['keys'](db[_0x7bcb('0x66')][_0x7bcb('0x41')]);_0x59c7ca[_0x7bcb('0x44')]=_['keys'](_0x395e9c[_0x7bcb('0x44')]);_0x59c7ca['filters']=_[_0x7bcb('0x47')](_0x59c7ca[_0x7bcb('0x49')],_0x59c7ca[_0x7bcb('0x44')]);_0x4cf06d[_0x7bcb('0x48')]=_[_0x7bcb('0x47')](_0x59c7ca['model'],qs['fields'](_0x395e9c[_0x7bcb('0x44')][_0x7bcb('0x4a')]));_0x4cf06d[_0x7bcb('0x48')]=_0x4cf06d[_0x7bcb('0x48')][_0x7bcb('0x4b')]?_0x4cf06d[_0x7bcb('0x48')]:_0x59c7ca[_0x7bcb('0x49')];if(!_0x395e9c[_0x7bcb('0x44')]['hasOwnProperty']('nolimit')){_0x4cf06d['limit']=qs[_0x7bcb('0x2f')](_0x395e9c[_0x7bcb('0x44')][_0x7bcb('0x2f')]);_0x4cf06d[_0x7bcb('0x31')]=qs[_0x7bcb('0x31')](_0x395e9c[_0x7bcb('0x44')]['offset']);}_0x4cf06d[_0x7bcb('0x4e')]=qs['sort'](_0x395e9c[_0x7bcb('0x44')]['sort']);_0x4cf06d['where']=qs[_0x7bcb('0x46')](_[_0x7bcb('0x50')](_0x395e9c[_0x7bcb('0x44')],_0x59c7ca[_0x7bcb('0x46')]));_0x4cf06d['where'][_0x7bcb('0x65')]=_0x2a9734['id'];if(_0x395e9c[_0x7bcb('0x44')]['filter']){_0x4cf06d[_0x7bcb('0x52')]=_[_0x7bcb('0x53')](_0x4cf06d[_0x7bcb('0x52')],{'$or':_[_0x7bcb('0x3f')](_0x4cf06d[_0x7bcb('0x48')],function(_0x3a64cb){var _0xb38263={};_0xb38263[_0x3a64cb]={'$like':'%'+_0x395e9c[_0x7bcb('0x44')][_0x7bcb('0x51')]+'%'};return _0xb38263;})});}_0x4cf06d=_[_0x7bcb('0x53')]({},_0x4cf06d,_0x395e9c['options']);return db[_0x7bcb('0x66')]['count']({'where':_0x4cf06d[_0x7bcb('0x52')]})[_0x7bcb('0x1f')](function(_0x226d6f){_0x4527a2[_0x7bcb('0x30')]=_0x226d6f;if(_0x395e9c[_0x7bcb('0x44')][_0x7bcb('0x69')]){_0x4cf06d['include']=[{'all':!![]}];}return db[_0x7bcb('0x66')][_0x7bcb('0x6a')](_0x4cf06d);})[_0x7bcb('0x1f')](function(_0x2f4207){_0x4527a2['rows']=_0x2f4207;return _0x4527a2;});}})[_0x7bcb('0x1f')](respondWithFilteredResult(_0x5ee0c9,_0x4cf06d))['catch'](handleError(_0x5ee0c9,null));};exports[_0x7bcb('0x6b')]=function(_0x3cbd94,_0x3ba6c9,_0x5257ac){return db['SmsAccount'][_0x7bcb('0x5a')]({'where':{'id':_0x3cbd94[_0x7bcb('0x59')]['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x3ba6c9,null))[_0x7bcb('0x1f')](function(_0x1a1b5b){if(_0x1a1b5b){return _0x1a1b5b[_0x7bcb('0x6b')](_0x3cbd94[_0x7bcb('0x44')][_0x7bcb('0x6c')]);}})['then'](respondWithStatusCode(_0x3ba6c9,null))[_0x7bcb('0x29')](handleError(_0x3ba6c9,null));};exports[_0x7bcb('0x6d')]=function(_0x2ee85a,_0x596ada,_0x33496f){if(_0x2ee85a[_0x7bcb('0x5c')]['id']){delete _0x2ee85a['body']['id'];}return db[_0x7bcb('0x40')][_0x7bcb('0x5a')]({'where':{'id':_0x2ee85a[_0x7bcb('0x59')]['id']}})['then'](handleEntityNotFound(_0x596ada,null))[_0x7bcb('0x1f')](function(_0x1a4b1f){if(_0x1a4b1f){_0x2ee85a['body'][_0x7bcb('0x65')]=_0x1a4b1f['id'];return db[_0x7bcb('0x6e')][_0x7bcb('0x5b')](_0x2ee85a[_0x7bcb('0x5c')]);}})[_0x7bcb('0x1f')](respondWithResult(_0x596ada,null))[_0x7bcb('0x29')](handleError(_0x596ada,null));};exports[_0x7bcb('0x6f')]=function(_0xc25237,_0x577042,_0x27ed72){var _0x28daf9={'raw':![],'where':{}};var _0x1f832a={};var _0x3a644e={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xc25237[_0x7bcb('0x59')]['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x577042,null))[_0x7bcb('0x1f')](function(_0x4dbf2c){if(_0x4dbf2c){_0x1f832a['model']=_['keys'](db[_0x7bcb('0x6e')][_0x7bcb('0x41')]);_0x1f832a[_0x7bcb('0x44')]=_[_0x7bcb('0x45')](_0xc25237[_0x7bcb('0x44')]);_0x1f832a[_0x7bcb('0x46')]=_['intersection'](_0x1f832a[_0x7bcb('0x49')],_0x1f832a[_0x7bcb('0x44')]);_0x28daf9[_0x7bcb('0x48')]=_[_0x7bcb('0x47')](_0x1f832a[_0x7bcb('0x49')],qs['fields'](_0xc25237[_0x7bcb('0x44')][_0x7bcb('0x4a')]));_0x28daf9[_0x7bcb('0x48')]=_0x28daf9[_0x7bcb('0x48')]['length']?_0x28daf9[_0x7bcb('0x48')]:_0x1f832a['model'];if(!_0xc25237[_0x7bcb('0x44')][_0x7bcb('0x4c')](_0x7bcb('0x4d'))){_0x28daf9['limit']=qs[_0x7bcb('0x2f')](_0xc25237[_0x7bcb('0x44')][_0x7bcb('0x2f')]);_0x28daf9[_0x7bcb('0x31')]=qs[_0x7bcb('0x31')](_0xc25237[_0x7bcb('0x44')][_0x7bcb('0x31')]);}_0x28daf9[_0x7bcb('0x4e')]=qs['sort'](_0xc25237['query'][_0x7bcb('0x4f')]);_0x28daf9[_0x7bcb('0x52')]=qs[_0x7bcb('0x46')](_['pick'](_0xc25237[_0x7bcb('0x44')],_0x1f832a[_0x7bcb('0x46')]));_0x28daf9[_0x7bcb('0x52')][_0x7bcb('0x65')]=_0x4dbf2c['id'];if(_0xc25237[_0x7bcb('0x44')][_0x7bcb('0x51')]){_0x28daf9[_0x7bcb('0x52')]=_['merge'](_0x28daf9[_0x7bcb('0x52')],{'$or':_[_0x7bcb('0x3f')](_0x28daf9['attributes'],function(_0x105aad){var _0x28ac0b={};_0x28ac0b[_0x105aad]={'$like':'%'+_0xc25237[_0x7bcb('0x44')][_0x7bcb('0x51')]+'%'};return _0x28ac0b;})});}_0x28daf9=_[_0x7bcb('0x53')]({},_0x28daf9,_0xc25237[_0x7bcb('0x55')]);return db[_0x7bcb('0x6e')]['count']({'where':_0x28daf9[_0x7bcb('0x52')]})['then'](function(_0x31d9c8){_0x3a644e['count']=_0x31d9c8;if(_0xc25237[_0x7bcb('0x44')][_0x7bcb('0x69')]){_0x28daf9['include']=[{'all':!![]}];}return db[_0x7bcb('0x6e')][_0x7bcb('0x6a')](_0x28daf9);})[_0x7bcb('0x1f')](function(_0x402b5e){_0x3a644e[_0x7bcb('0x57')]=_0x402b5e;return _0x3a644e;});}})[_0x7bcb('0x1f')](respondWithFilteredResult(_0x577042,_0x28daf9))['catch'](handleError(_0x577042,null));};exports[_0x7bcb('0x70')]=function(_0x17ed95,_0x3b4017,_0xb63bbb){return db['SmsAccount'][_0x7bcb('0x5a')]({'where':{'id':_0x17ed95['params']['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x3b4017,null))[_0x7bcb('0x1f')](function(_0x39bd81){if(_0x39bd81){return _0x39bd81[_0x7bcb('0x70')](_0x17ed95[_0x7bcb('0x44')]['ids']);}})[_0x7bcb('0x1f')](respondWithStatusCode(_0x3b4017,null))['catch'](handleError(_0x3b4017,null));};exports[_0x7bcb('0x71')]=function(_0xb43cf3,_0x15550e,_0xcc4ecb){var _0x258bad={'channel':_0x7bcb('0x72')};var _0x1e4ccc=[];var _0x2df807=[];var _0x1b0361={};return db[_0x7bcb('0x40')][_0x7bcb('0x5a')]({'where':{'id':_0xb43cf3[_0x7bcb('0x59')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0x7bcb('0x1f')](handleEntityNotFound(_0x15550e,null))['then'](function(_0x58648d){_0x258bad[_0x7bcb('0x73')]=_0x58648d;_0x258bad[_0x7bcb('0x74')]=_[_0x7bcb('0x75')](_0x58648d[_0x7bcb('0x76')],[_0x7bcb('0x77')],['asc']);if(_0x258bad[_0x7bcb('0x73')][_0x7bcb('0x76')]){delete _0x258bad[_0x7bcb('0x73')][_0x7bcb('0x76')];}return db[_0x7bcb('0x78')][_0x7bcb('0x63')]();})[_0x7bcb('0x1f')](function(_0x5bb270){if(!_0x5bb270){throw new db['Sequelize'][(_0x7bcb('0x79'))](_0x7bcb('0x7a'));}_0x1e4ccc=_[_0x7bcb('0x7b')](_['keys'](_0x5bb270),[_0x7bcb('0x7c'),_0x7bcb('0x7d')]);_0x2df807=_[_0x7bcb('0x7b')](_[_0x7bcb('0x45')](_0x5bb270),[_0x7bcb('0x7c'),_0x7bcb('0x7d'),'CompanyId',_0x7bcb('0x7e')]);_0x258bad['body']={'mapKey':_0x7bcb('0x7f')};if(_0x258bad[_0x7bcb('0x73')][_0x7bcb('0x43')]){switch(_0x258bad[_0x7bcb('0x73')][_0x7bcb('0x43')]){case'twilio':_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x80')]=_0xb43cf3[_0x7bcb('0x5c')]['From'];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x5c')]=_0xb43cf3['body'][_0x7bcb('0x81')];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x82')]=_0xb43cf3[_0x7bcb('0x5c')]['MessageSid'];break;case'skebby':_0x258bad['body'][_0x7bcb('0x80')]='+'+_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x83')];_0x258bad['body'][_0x7bcb('0x5c')]=_0xb43cf3[_0x7bcb('0x5c')]['text'];break;case _0x7bcb('0x84'):_0x258bad[_0x7bcb('0x5c')]['from']=_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x80')];_0x258bad[_0x7bcb('0x5c')]['body']=_0xb43cf3['body'][_0x7bcb('0x27')];break;case _0x7bcb('0x85'):_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x80')]=_0xb43cf3['body'][_0x7bcb('0x80')];_0x258bad[_0x7bcb('0x5c')]['body']=_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x5c')];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x82')]=_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x86')];break;case _0x7bcb('0x87'):_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x80')]=_0xb43cf3[_0x7bcb('0x5c')]['From'];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x5c')]=_0xb43cf3['body'][_0x7bcb('0x88')];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x82')]=_0xb43cf3[_0x7bcb('0x5c')]['MessageUUID'];break;case _0x7bcb('0x89'):_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x80')]='+'+_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x8a')][0x0][_0x7bcb('0x80')];_0x258bad['body'][_0x7bcb('0x5c')]=_0xb43cf3[_0x7bcb('0x5c')]['results'][0x0][_0x7bcb('0x8b')];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x82')]=_0xb43cf3['body'][_0x7bcb('0x8a')][0x0][_0x7bcb('0x82')];break;case'csc':_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x80')]=_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x8c')];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x5c')]=_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x8d')][_0x7bcb('0x27')];break;case'clickatell':_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x80')]=_0xb43cf3['body']['fromNumber'];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x5c')]=_0xb43cf3['body'][_0x7bcb('0x8b')];_0x258bad['body'][_0x7bcb('0x82')]=_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x8e')];break;case'bandwidth':_0x258bad['body'][_0x7bcb('0x82')]=_0xb43cf3[_0x7bcb('0x5c')][0x0][_0x7bcb('0x27')]['id'];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x80')]=_0xb43cf3[_0x7bcb('0x5c')][0x0][_0x7bcb('0x27')][_0x7bcb('0x80')];_0x258bad['body'][_0x7bcb('0x5c')]=_0xb43cf3[_0x7bcb('0x5c')][0x0]['message']['text'];break;case _0x7bcb('0x8f'):_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x80')]=_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x80')];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x5c')]=_0xb43cf3[_0x7bcb('0x5c')]['message'];_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x82')]=_0xb43cf3[_0x7bcb('0x5c')][_0x7bcb('0x90')];break;}}if(_0x258bad[_0x7bcb('0x5c')]['id']){delete _0x258bad[_0x7bcb('0x5c')]['id'];}if(_[_0x7bcb('0x91')](_0x258bad[_0x7bcb('0x5c')]['from'])){throw new db[(_0x7bcb('0x92'))]['ValidationError'](_0x7bcb('0x93'));}if(_[_0x7bcb('0x91')](_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x5c')])||_0x258bad[_0x7bcb('0x5c')]['body']===''){throw new db[(_0x7bcb('0x92'))][(_0x7bcb('0x79'))](_0x7bcb('0x94'));}if(_[_0x7bcb('0x91')](_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x95')])){throw new db[(_0x7bcb('0x92'))][(_0x7bcb('0x79'))](_0x7bcb('0x96')+_0x2df807);}if(!_[_0x7bcb('0x97')](_0x2df807,_0x258bad['body']['mapKey'])){throw new db[(_0x7bcb('0x92'))][(_0x7bcb('0x79'))](_0x7bcb('0x98')+_0x2df807);}_0x1b0361[_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x95')]]=_0x258bad[_0x7bcb('0x5c')]['from'];return db[_0x7bcb('0x99')]['find']({'where':{'id':_0x258bad[_0x7bcb('0x73')][_0x7bcb('0x7e')]},'include':[{'model':db[_0x7bcb('0x78')],'as':_0x7bcb('0x9a'),'where':_0x1b0361,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x7bcb('0x1f')](handleEntityNotFound(_0x15550e,null))[_0x7bcb('0x1f')](function(_0x534f17){if(_0x534f17){_0x258bad[_0x7bcb('0x9b')]=_[_0x7bcb('0x9c')](_0x534f17,['Contacts']);if(_0x534f17[_0x7bcb('0x9a')][_0x7bcb('0x4b')]){return _0x534f17['Contacts'][0x0];}var _0x296182=_['defaults'](_0x258bad[_0x7bcb('0x5c')],{'firstName':_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x80')],'ListId':_0x534f17['id']});_0x296182[_0x258bad[_0x7bcb('0x5c')]['mapKey']]=_0x258bad['body'][_0x7bcb('0x80')];return db[_0x7bcb('0x78')][_0x7bcb('0x5b')](_0x296182,{'fields':_0x1e4ccc,'raw':!![]});}})['then'](handleEntityNotFound(_0x15550e,null))[_0x7bcb('0x1f')](function(_0x18cd7f){if(_0x18cd7f){_0x258bad[_0x7bcb('0x9d')]=_0x18cd7f;var _0x925880={'ContactId':_0x18cd7f['id'],'phone':_0x258bad[_0x7bcb('0x5c')]['from'],'SmsAccountId':_0xb43cf3[_0x7bcb('0x59')]['id']};var _0x2d0c8d={'ContactId':_0x18cd7f['id'],'SmsAccountId':_0xb43cf3[_0x7bcb('0x59')]['id'],'closed':![]};return db[_0x7bcb('0x9e')][_0x7bcb('0x5a')]({'where':_0x2d0c8d})['then'](function(_0x23fb90){if(_0x23fb90){return[_0x23fb90,![]];}return db['SmsInteraction'][_0x7bcb('0x5b')](_0x925880)[_0x7bcb('0x1f')](function(_0x2321de){return[_0x2321de,!![]];});});}})[_0x7bcb('0x9f')](function(_0x6134f4,_0x565523){_0x258bad[_0x7bcb('0xa0')]=_0x6134f4[_0x7bcb('0x37')]({'plain':!![]});_0x258bad[_0x7bcb('0xa0')]['created']=![];if(_0x565523){if(_0x258bad[_0x7bcb('0x73')][_0x7bcb('0xa1')]){_0x258bad[_0x7bcb('0x74')][_0x7bcb('0xa2')]({'id':0x0,'priority':_0x258bad[_0x7bcb('0x74')][_0x7bcb('0x4b')]+0x1,'app':_0x7bcb('0xa3'),'appdata':'unmanaged','interval':_0x7bcb('0xa4')});}_0x258bad['interaction'][_0x7bcb('0xa5')]=!![];}return db[_0x7bcb('0xa6')][_0x7bcb('0x5b')]({'phone':_0x258bad['body'][_0x7bcb('0x80')],'messageId':_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x82')],'body':_0x258bad[_0x7bcb('0x5c')][_0x7bcb('0x5c')],'SmsAccountId':_0xb43cf3[_0x7bcb('0x59')]['id'],'SmsInteractionId':_0x6134f4['id'],'direction':'in','ContactId':_0x6134f4[_0x7bcb('0xa7')],'AttachmentId':_0x258bad[_0x7bcb('0x5c')]['AttachmentId']});})[_0x7bcb('0x1f')](function(_0xfe986f){_0x258bad[_0x7bcb('0x27')]=_0xfe986f;if(_0x258bad[_0x7bcb('0xa0')]['UserId']){return db[_0x7bcb('0xa8')][_0x7bcb('0x5a')]({'attributes':['id',_0x7bcb('0x3a')],'where':{'id':_0x258bad['interaction'][_0x7bcb('0xa9')]}})[_0x7bcb('0x1f')](function(_0x5c7ab7){if(_0x5c7ab7){_0x258bad[_0x7bcb('0x74')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7bcb('0xaa'),'appdata':_0x5c7ab7[_0x7bcb('0x3a')]+','+(_0x258bad[_0x7bcb('0x73')][_0x7bcb('0xab')]||0xa),'interval':_0x7bcb('0xa4')});}return respondWithRpcPromise('Start',_0x7bcb('0xac'),_0x258bad);});}return respondWithRpcPromise('Start',_0x7bcb('0xac'),_0x258bad);})[_0x7bcb('0x1f')](function(_0x2dc835){if(_0x2dc835){var _0x534f0b=0xc8;var _0x201b00=_0x7bcb('0xad');logger[_0x7bcb('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x201b00,_0x534f0b,_0x7bcb('0xae'));logger[_0x7bcb('0x23')](_0x7bcb('0xaf'),_0x201b00,_0x534f0b,_0x7bcb('0xae'),JSON['stringify'](_0x2dc835));if(_0x258bad[_0x7bcb('0x73')][_0x7bcb('0x43')]==='twilio'){return _0x15550e[_0x7bcb('0x2b')](_0x534f0b)[_0x7bcb('0xb0')](_0x7bcb('0xb1'),_0x7bcb('0xb2'))[_0x7bcb('0x3b')](_0x7bcb('0xb3'));}else{return _0x15550e[_0x7bcb('0x2b')](_0x534f0b)[_0x7bcb('0x2d')](_0x2dc835);}}})[_0x7bcb('0x29')](handleError(_0x15550e,null));};exports[_0x7bcb('0xb4')]=function(_0x8b65d4,_0x2495bd,_0x17b087){return db['SmsAccount'][_0x7bcb('0x68')]({'where':{'id':_0x8b65d4['params']['id']}})['then'](handleEntityNotFound(_0x2495bd,null))[_0x7bcb('0x1f')](function(_0x535f76){if(_0x535f76){return db[_0x7bcb('0xb5')]['transaction'](function(_0x5ca3f4){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x8b65d4[_0x7bcb('0x59')]['id']},'transaction':_0x5ca3f4})['then'](function(_0x4c3e26){var _0xf4d9fe=_[_0x7bcb('0x3f')](_0x8b65d4[_0x7bcb('0x5c')],function(_0x5e09ae){_0x5e09ae[_0x7bcb('0x65')]=_0x8b65d4[_0x7bcb('0x59')]['id'];return _0x5e09ae;});return db[_0x7bcb('0xb6')]['bulkCreate'](_0xf4d9fe,{'transaction':_0x5ca3f4});});})[_0x7bcb('0x1f')](function(){return db[_0x7bcb('0xb6')][_0x7bcb('0xb7')]({'where':{'SmsAccountId':_0x8b65d4[_0x7bcb('0x59')]['id']},'order':'priority'});});}})[_0x7bcb('0x1f')](respondWithResult(_0x2495bd,null))[_0x7bcb('0x29')](handleError(_0x2495bd,null));};exports['getApplications']=function(_0x11fcb6,_0x89e93f,_0x3956d5){var _0x4da4ec={};var _0x44b089={};var _0x29629f;var _0x5a04de;return db[_0x7bcb('0x40')][_0x7bcb('0x68')]({'where':{'id':_0x11fcb6[_0x7bcb('0x59')]['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x89e93f,null))[_0x7bcb('0x1f')](function(_0x2b3ea7){if(_0x2b3ea7){_0x29629f=_0x2b3ea7;_0x44b089[_0x7bcb('0x49')]=_[_0x7bcb('0x45')](db[_0x7bcb('0xb6')][_0x7bcb('0x41')]);_0x44b089['query']=_[_0x7bcb('0x45')](_0x11fcb6[_0x7bcb('0x44')]);_0x44b089[_0x7bcb('0x46')]=_[_0x7bcb('0x47')](_0x44b089[_0x7bcb('0x49')],_0x44b089['query']);_0x4da4ec[_0x7bcb('0x48')]=_[_0x7bcb('0x47')](_0x44b089['model'],qs[_0x7bcb('0x4a')](_0x11fcb6[_0x7bcb('0x44')][_0x7bcb('0x4a')]));_0x4da4ec['attributes']=_0x4da4ec['attributes'][_0x7bcb('0x4b')]?_0x4da4ec['attributes']:_0x44b089[_0x7bcb('0x49')];_0x4da4ec['order']=qs['sort'](_0x11fcb6[_0x7bcb('0x44')][_0x7bcb('0x4f')]);_0x4da4ec[_0x7bcb('0x52')]=qs['filters'](_[_0x7bcb('0x50')](_0x11fcb6[_0x7bcb('0x44')],_0x44b089[_0x7bcb('0x46')]));if(_0x11fcb6[_0x7bcb('0x44')]['filter']){_0x4da4ec[_0x7bcb('0x52')]=_[_0x7bcb('0x53')](_0x4da4ec[_0x7bcb('0x52')],{'$or':_[_0x7bcb('0x3f')](_0x4da4ec[_0x7bcb('0x48')],function(_0x231c22){var _0xad42d8={};_0xad42d8[_0x231c22]={'$like':'%'+_0x11fcb6[_0x7bcb('0x44')][_0x7bcb('0x51')]+'%'};return _0xad42d8;})});}_0x4da4ec=_[_0x7bcb('0x53')]({},_0x4da4ec,_0x11fcb6[_0x7bcb('0x55')]);return _0x29629f['getApplications'](_0x4da4ec);}})['then'](function(_0x265a4a){if(_0x265a4a){_0x5a04de=_0x265a4a[_0x7bcb('0x4b')];if(!_0x11fcb6[_0x7bcb('0x44')]['hasOwnProperty'](_0x7bcb('0x4d'))){_0x4da4ec[_0x7bcb('0x2f')]=qs['limit'](_0x11fcb6[_0x7bcb('0x44')]['limit']);_0x4da4ec[_0x7bcb('0x31')]=qs[_0x7bcb('0x31')](_0x11fcb6[_0x7bcb('0x44')][_0x7bcb('0x31')]);}return _0x29629f[_0x7bcb('0xb8')](_0x4da4ec);}})[_0x7bcb('0x1f')](function(_0x2c98ae){if(_0x2c98ae){return _0x2c98ae?{'count':_0x5a04de,'rows':_0x2c98ae}:null;}})[_0x7bcb('0x1f')](respondWithResult(_0x89e93f,null))[_0x7bcb('0x29')](handleError(_0x89e93f,null));};exports[_0x7bcb('0xb9')]=function(_0x39abfa,_0x342e4a,_0x28454c){var _0xefa4fc={'raw':![],'where':{}};var _0x5b10db={};var _0x3b1789={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7bcb('0x68')]({'where':{'id':_0x39abfa['params']['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x342e4a,null))[_0x7bcb('0x1f')](function(_0x5b99aa){if(_0x5b99aa){_0x5b10db[_0x7bcb('0x49')]=_['keys'](db[_0x7bcb('0x9e')]['rawAttributes']);_0x5b10db[_0x7bcb('0x44')]=_[_0x7bcb('0x45')](_0x39abfa['query']);_0x5b10db['filters']=_[_0x7bcb('0x47')](_0x5b10db[_0x7bcb('0x49')],_0x5b10db[_0x7bcb('0x44')]);_0xefa4fc[_0x7bcb('0x48')]=_[_0x7bcb('0x47')](_0x5b10db[_0x7bcb('0x49')],qs[_0x7bcb('0x4a')](_0x39abfa[_0x7bcb('0x44')][_0x7bcb('0x4a')]));_0xefa4fc[_0x7bcb('0x48')]=_0xefa4fc[_0x7bcb('0x48')][_0x7bcb('0x4b')]?_0xefa4fc[_0x7bcb('0x48')]:_0x5b10db['model'];if(!_0x39abfa[_0x7bcb('0x44')][_0x7bcb('0x4c')](_0x7bcb('0x4d'))){_0xefa4fc['limit']=qs[_0x7bcb('0x2f')](_0x39abfa['query']['limit']);_0xefa4fc[_0x7bcb('0x31')]=qs['offset'](_0x39abfa[_0x7bcb('0x44')][_0x7bcb('0x31')]);}_0xefa4fc[_0x7bcb('0x4e')]=qs[_0x7bcb('0x4f')](_0x39abfa[_0x7bcb('0x44')][_0x7bcb('0x4f')]);_0xefa4fc[_0x7bcb('0x52')]=qs[_0x7bcb('0x46')](_[_0x7bcb('0x50')](_0x39abfa[_0x7bcb('0x44')],_0x5b10db[_0x7bcb('0x46')]));_0xefa4fc[_0x7bcb('0x52')]['SmsAccountId']=_0x5b99aa['id'];if(_0x39abfa['query']['filter']){_0xefa4fc['where']=_[_0x7bcb('0x53')](_0xefa4fc['where'],{'$or':_['map'](_0xefa4fc['attributes'],function(_0x4db110){var _0x36575d={};_0x36575d[_0x4db110]={'$like':'%'+_0x39abfa[_0x7bcb('0x44')][_0x7bcb('0x51')]+'%'};return _0x36575d;})});}_0xefa4fc=_[_0x7bcb('0x53')]({},_0xefa4fc,_0x39abfa['options']);return db[_0x7bcb('0x9e')][_0x7bcb('0x30')]({'where':_0xefa4fc[_0x7bcb('0x52')]})[_0x7bcb('0x1f')](function(_0x1ef9ba){_0x3b1789[_0x7bcb('0x30')]=_0x1ef9ba;if(_0x39abfa[_0x7bcb('0x44')]['includeAll']){_0xefa4fc['include']=[{'model':db[_0x7bcb('0x78')],'as':_0x7bcb('0xba'),'required':![]},{'model':db[_0x7bcb('0xa8')],'as':_0x7bcb('0xbb'),'attributes':[_0x7bcb('0x3a'),_0x7bcb('0xbc'),'internal'],'required':![]},{'model':db[_0x7bcb('0xbd')],'as':_0x7bcb('0xbe'),'attributes':['id','name',_0x7bcb('0xbf')],'where':_0x39abfa[_0x7bcb('0x44')][_0x7bcb('0xc0')]?{'id':_0x39abfa[_0x7bcb('0x44')][_0x7bcb('0xc0')]}:undefined,'required':_0x39abfa['query']['tag']?!![]:![]}];}return db[_0x7bcb('0x9e')][_0x7bcb('0x6a')](_0xefa4fc);})[_0x7bcb('0x1f')](function(_0x14971d){_0x3b1789[_0x7bcb('0x57')]=_0x14971d;return _0x3b1789;});}})['then'](respondWithFilteredResult(_0x342e4a,_0xefa4fc))[_0x7bcb('0x29')](handleError(_0x342e4a,null));};exports['send']=function(_0x20adcb,_0x28c71b,_0x2502e5){var _0x3746e7,_0x2ebcd9,_0x21a8fe;if(_[_0x7bcb('0x91')](_0x20adcb[_0x7bcb('0x5c')]['body'])||_0x20adcb['body']['body']===''){throw new db[(_0x7bcb('0x92'))][(_0x7bcb('0x79'))](_0x7bcb('0x94'));}if(_['isNil'](_0x20adcb['body']['to'])){throw new db[(_0x7bcb('0x92'))][(_0x7bcb('0x79'))]('to\x20is\x20mandatory');}_0x3746e7=_0x20adcb[_0x7bcb('0x5c')]['to'];return db[_0x7bcb('0x40')][_0x7bcb('0x5a')]({'where':{'id':_0x20adcb[_0x7bcb('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x7bcb('0xc1'),'include':[{'model':db[_0x7bcb('0x78')],'as':_0x7bcb('0x9a'),'where':{'mobile':_0x3746e7},'limit':0x1,'order':[['updatedAt',_0x7bcb('0xc2')]]}]}]})[_0x7bcb('0x1f')](handleEntityNotFound(_0x28c71b,null))['then'](function(_0x38c494){if(_0x38c494&&_0x38c494[_0x7bcb('0xc1')]){_0x2ebcd9=_0x38c494[_0x7bcb('0x37')]({'plain':!![]});if(_0x2ebcd9[_0x7bcb('0xc1')]&&_0x2ebcd9[_0x7bcb('0xc1')]['Contacts']['length']){return _0x2ebcd9[_0x7bcb('0xc1')][_0x7bcb('0x9a')][0x0];}return db[_0x7bcb('0x78')]['create'](_[_0x7bcb('0x17')](_0x20adcb[_0x7bcb('0x5c')],{'firstName':_0x3746e7,'mobile':_0x3746e7,'phone':_0x3746e7,'ListId':_0x2ebcd9[_0x7bcb('0x7e')]}));}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x28c71b,null))['then'](function(_0x385222){if(_0x385222){_0x21a8fe=_0x385222;return db[_0x7bcb('0x9e')][_0x7bcb('0x5a')]({'where':{'ContactId':_0x21a8fe['id'],'closed':![],'SmsAccountId':_0x2ebcd9['id']}})[_0x7bcb('0x1f')](function(_0x15e9ec){if(_0x15e9ec){return[_0x15e9ec,![]];}return db[_0x7bcb('0x9e')][_0x7bcb('0x5b')]({'UserId':_0x20adcb[_0x7bcb('0x5f')]['id'],'ContactId':_0x21a8fe['id'],'SmsAccountId':_0x2ebcd9['id'],'phone':_0x3746e7,'firstMsgDirection':_0x7bcb('0xc3'),'Messages':[_[_0x7bcb('0x53')](_0x20adcb[_0x7bcb('0x5c')],{'read':![],'body':_0x20adcb[_0x7bcb('0x5c')][_0x7bcb('0x5c')],'phone':_0x3746e7,'SmsAccountId':_0x2ebcd9['id'],'UserId':_0x20adcb[_0x7bcb('0x5f')]['id'],'ContactId':_0x21a8fe['id']})]},{'include':[{'model':db[_0x7bcb('0xa6')],'as':_0x7bcb('0xc4')}]})['then'](function(_0x556e26){return[_0x556e26,!![]];});});}})['spread'](function(_0x3fcb4b,_0x38763a){if(_0x38763a){return _0x3fcb4b;}return db[_0x7bcb('0xa6')]['create'](_[_0x7bcb('0x53')](_0x20adcb[_0x7bcb('0x5c')],{'read':![],'body':_0x20adcb[_0x7bcb('0x5c')][_0x7bcb('0x5c')],'phone':_0x3746e7,'SmsAccountId':_0x2ebcd9['id'],'SmsInteractionId':_0x3fcb4b['id'],'UserId':_0x20adcb[_0x7bcb('0x5f')]['id'],'ContactId':_0x21a8fe['id']}))[_0x7bcb('0x1f')](function(_0x3892d4){_0x3fcb4b[_0x7bcb('0xc5')]['Messages']=[];_0x3fcb4b[_0x7bcb('0xc5')][_0x7bcb('0xc4')][_0x7bcb('0xa2')](_0x3892d4[_0x7bcb('0xc5')]);return _0x3fcb4b;});})['then'](respondWithResult(_0x28c71b,null))[_0x7bcb('0x29')](handleError(_0x28c71b,null));};exports[_0x7bcb('0x2b')]=function(_0x1ae458,_0x632957,_0x4c9c8c){if(_0x1ae458[_0x7bcb('0x5c')]['id']){delete _0x1ae458[_0x7bcb('0x5c')]['id'];}var _0x2364f1,_0x1b4c97,_0x115196;return db[_0x7bcb('0x40')][_0x7bcb('0x5a')]({'where':{'id':_0x1ae458[_0x7bcb('0x59')]['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x632957,null))[_0x7bcb('0x1f')](function(_0x1e3e6b){if(_0x1e3e6b){_0x115196=_0x1e3e6b;logger[_0x7bcb('0x23')](_0x7bcb('0xc6'),_0x7bcb('0x2b'),_0x7bcb('0xc7'),_0x1e3e6b[_0x7bcb('0x43')],util[_0x7bcb('0xc8')](_0x1ae458[_0x7bcb('0x5c')],{'showHidden':![],'depth':null}));switch(_0x1e3e6b[_0x7bcb('0x43')]){case _0x7bcb('0xc9'):if(_0x1ae458[_0x7bcb('0x5c')]['skebby_dispatch_id']&&_0x1ae458[_0x7bcb('0x5c')]['status']){_0x1b4c97=_0x1ae458['body'][_0x7bcb('0x2b')];return db[_0x7bcb('0xa6')][_0x7bcb('0x5a')]({'where':{'messageId':_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0xca')]}});}break;case'connectel':if(_0x1ae458['body'][_0x7bcb('0xcb')]&&_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0xcc')]){_0x1b4c97=_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0xcc')];return db[_0x7bcb('0xa6')][_0x7bcb('0x5a')]({'where':{'messageId':_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0xcb')]}});}break;case'clicksend':if(_0x1ae458[_0x7bcb('0x5c')]['message_id']&&_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0xcd')]){_0x1b4c97=_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0xcd')];return db[_0x7bcb('0xa6')][_0x7bcb('0x5a')]({'where':{'messageId':_0x1ae458['body'][_0x7bcb('0x86')]}});}break;case _0x7bcb('0x89'):var _0x11bce3=_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0x8a')][0x0];if(_0x11bce3[_0x7bcb('0x82')]&&_0x11bce3[_0x7bcb('0x2b')]['groupName']==='DELIVERED'){_0x1b4c97=_0x11bce3[_0x7bcb('0x2b')][_0x7bcb('0xce')];return db[_0x7bcb('0xa6')]['find']({'where':{'messageId':_0x11bce3['messageId']}});}break;case _0x7bcb('0xcf'):if(_0x1ae458[_0x7bcb('0x5c')]['messageId']&&_0x1ae458['body'][_0x7bcb('0x2b')]){_0x1b4c97=_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0x2b')];return db['SmsMessage'][_0x7bcb('0x5a')]({'where':{'messageId':_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0x82')]}});}break;case'bandwidth':if(_0x1ae458['body'][0x0][_0x7bcb('0x27')]['id']){_0x1b4c97=_0x1ae458[_0x7bcb('0x5c')][0x0][_0x7bcb('0x43')];return db[_0x7bcb('0xa6')]['find']({'where':{'messageId':_0x1ae458[_0x7bcb('0x5c')][0x0][_0x7bcb('0x27')]['id']}});}break;case'intelepeer':if(_0x1ae458['body'][_0x7bcb('0xd0')]&&_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0x2b')]){_0x1b4c97=_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0x2b')];return db['SmsMessage'][_0x7bcb('0x5a')]({'where':{'messageId':_0x1ae458['body'][_0x7bcb('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x632957,null))[_0x7bcb('0x1f')](function(_0x4e2e51){if(_0x4e2e51){_0x2364f1=_0x4e2e51;switch(_0x115196['type']){case _0x7bcb('0xc9'):if(_0x1b4c97===_0x7bcb('0xd1')){return _0x2364f1[_0x7bcb('0x35')]({'read':!![]});}else{logger[_0x7bcb('0x25')](_0x7bcb('0xc6'),_0x7bcb('0x2b'),_0x7bcb('0xc9'),util[_0x7bcb('0xc8')](_0x1ae458[_0x7bcb('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x7bcb('0x84'):if(_0x1b4c97==='1'){return _0x2364f1[_0x7bcb('0x35')]({'read':!![]});}else{logger['error'](_0x7bcb('0xc6'),'status',_0x7bcb('0xc9'),util[_0x7bcb('0xc8')](_0x1ae458['body'],{'showHidden':![],'depth':null}));}break;case _0x7bcb('0x85'):if(!_0x1ae458[_0x7bcb('0x5c')][_0x7bcb('0xd2')]&&_0x1b4c97>=0xc8&&_0x1b4c97<=0xce){return _0x2364f1[_0x7bcb('0x35')]({'read':!![]});}else{logger[_0x7bcb('0x25')](_0x7bcb('0xc6'),_0x7bcb('0x2b'),'clicksend',util[_0x7bcb('0xc8')](_0x1ae458[_0x7bcb('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x7bcb('0x89'):var _0x3b5713=_0x1ae458['body'][_0x7bcb('0x8a')][0x0];if(_0x3b5713[_0x7bcb('0x2b')]['groupName']==='DELIVERED'){return _0x2364f1['update']({'read':!![]});}else{logger[_0x7bcb('0x25')](_0x7bcb('0xc6'),_0x7bcb('0x2b'),_0x7bcb('0x89'),util[_0x7bcb('0xc8')](_0x1ae458[_0x7bcb('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x7bcb('0xcf'):if(_0x1b4c97=='DELIVERED_TO_GATEWAY'||_0x1b4c97==_0x7bcb('0xd3')){return _0x2364f1[_0x7bcb('0x35')]({'read':!![]});}else{logger['error'](_0x7bcb('0xc6'),_0x7bcb('0x2b'),_0x7bcb('0xcf'),util[_0x7bcb('0xc8')](_0x1ae458['body'],{'showHidden':![],'depth':null}));}break;case _0x7bcb('0xd4'):if(_0x1b4c97=='message-delivered'){return _0x2364f1['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7bcb('0x2b'),_0x7bcb('0xd4'),util[_0x7bcb('0xc8')](_0x1ae458[_0x7bcb('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x7bcb('0x8f'):if(_0x1b4c97===_0x7bcb('0xd5')||_0x1b4c97===_0x7bcb('0xd6')){return _0x2364f1[_0x7bcb('0x35')]({'read':!![]});}else{logger['error'](_0x7bcb('0xc6'),'status',_0x7bcb('0x8f'),util[_0x7bcb('0xc8')](_0x1ae458[_0x7bcb('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x2364f1;}})[_0x7bcb('0x1f')](respondWithResult(_0x632957,null))[_0x7bcb('0x29')](handleError(_0x632957,null));};exports[_0x7bcb('0xd7')]=function(_0x5d10cf,_0x48cf29,_0x505bb4){var _0x24dce0,_0x2cfc96,_0x1399ea;return db[_0x7bcb('0x40')][_0x7bcb('0x5a')]({'where':{'id':_0x5d10cf[_0x7bcb('0x59')]['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x48cf29,null))[_0x7bcb('0x1f')](function(_0x2e0157){if(_0x2e0157){_0x1399ea=_0x2e0157;logger[_0x7bcb('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7bcb('0x2b'),_0x7bcb('0xc7'),_0x2e0157['type'],util[_0x7bcb('0xc8')](_0x5d10cf['query'],{'showHidden':![],'depth':null}));switch(_0x2e0157[_0x7bcb('0x43')]){case _0x7bcb('0xd8'):if(_0x5d10cf[_0x7bcb('0x44')]['message-id']&&_0x5d10cf['query']['state']){_0x2cfc96=_0x5d10cf[_0x7bcb('0x44')][_0x7bcb('0xd9')];return db[_0x7bcb('0xa6')][_0x7bcb('0x5a')]({'where':{'messageId':_0x5d10cf[_0x7bcb('0x44')]['message-id']}});}break;}}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x48cf29,null))[_0x7bcb('0x1f')](function(_0x3bb4f4){if(_0x3bb4f4){_0x24dce0=_0x3bb4f4;switch(_0x1399ea[_0x7bcb('0x43')]){case _0x7bcb('0xd8'):if(_0x2cfc96==='2'||_0x2cfc96==='6'){return _0x24dce0[_0x7bcb('0x35')]({'read':!![]});}else{logger[_0x7bcb('0x25')](_0x7bcb('0xc6'),'status','csc',util[_0x7bcb('0xc8')](_0x5d10cf[_0x7bcb('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x24dce0;}})[_0x7bcb('0x1f')](respondWithResult(_0x48cf29,null))[_0x7bcb('0x29')](handleError(_0x48cf29,null));};exports[_0x7bcb('0xda')]=function(_0x40de8e,_0x291855,_0x542e65){return db[_0x7bcb('0x40')][_0x7bcb('0x5a')]({'where':{'id':_0x40de8e[_0x7bcb('0x59')]['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x291855,null))[_0x7bcb('0x1f')](function(_0x258f58){if(_0x258f58){return _0x258f58[_0x7bcb('0xda')](_0x40de8e['body']['ids'],_[_0x7bcb('0x9c')](_0x40de8e[_0x7bcb('0x5c')],['ids','id'])||{})[_0x7bcb('0x9f')](function(_0x3b58f7){for(var _0x321a59=0x0;_0x321a59<_0x40de8e[_0x7bcb('0x5c')][_0x7bcb('0x6c')][_0x7bcb('0x4b')];_0x321a59+=0x1){socket['emit'](_0x7bcb('0xdb'),{'UserId':Number(_0x40de8e[_0x7bcb('0x5c')][_0x7bcb('0x6c')][_0x321a59]),'SmsAccountId':Number(_0x40de8e[_0x7bcb('0x59')]['id'])});}return _0x3b58f7;});}})[_0x7bcb('0x1f')](respondWithResult(_0x291855,null))[_0x7bcb('0x29')](handleError(_0x291855,null));};exports[_0x7bcb('0xdc')]=function(_0xf7425d,_0x8e26a1,_0x367779){return db[_0x7bcb('0x40')][_0x7bcb('0x5a')]({'where':{'id':_0xf7425d['params']['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x8e26a1,null))[_0x7bcb('0x1f')](function(_0x4cdf6a){if(_0x4cdf6a){return _0x4cdf6a['removeAgents'](_0xf7425d[_0x7bcb('0x44')]['ids'])[_0x7bcb('0x1f')](function(){if(_[_0x7bcb('0xdd')](_0xf7425d[_0x7bcb('0x44')][_0x7bcb('0x6c')])){for(var _0x4cdb4a=0x0;_0x4cdb4a<_0xf7425d[_0x7bcb('0x44')][_0x7bcb('0x6c')][_0x7bcb('0x4b')];_0x4cdb4a+=0x1){socket[_0x7bcb('0xde')]('userSmsAccount:remove',{'UserId':Number(_0xf7425d[_0x7bcb('0x44')][_0x7bcb('0x6c')][_0x4cdb4a]),'SmsAccountId':Number(_0xf7425d[_0x7bcb('0x59')]['id'])});}}else{socket[_0x7bcb('0xde')](_0x7bcb('0xdf'),{'UserId':Number(_0xf7425d[_0x7bcb('0x44')][_0x7bcb('0x6c')]),'SmsAccountId':Number(_0xf7425d['params']['id'])});}});}})[_0x7bcb('0x1f')](respondWithStatusCode(_0x8e26a1,null))[_0x7bcb('0x29')](handleError(_0x8e26a1,null));};exports[_0x7bcb('0xe0')]=function(_0x3e15a3,_0x43543e,_0x514a97){var _0x2c3570={};var _0x54f35b={};var _0x8f077a;var _0x3373b6;return db[_0x7bcb('0x40')][_0x7bcb('0x68')]({'where':{'id':_0x3e15a3[_0x7bcb('0x59')]['id']}})[_0x7bcb('0x1f')](handleEntityNotFound(_0x43543e,null))[_0x7bcb('0x1f')](function(_0x2df551){if(_0x2df551){_0x8f077a=_0x2df551;_0x54f35b[_0x7bcb('0x49')]=_[_0x7bcb('0x45')](db[_0x7bcb('0xa8')][_0x7bcb('0x41')]);_0x54f35b['query']=_['keys'](_0x3e15a3[_0x7bcb('0x44')]);_0x54f35b['filters']=_[_0x7bcb('0x47')](_0x54f35b['model'],_0x54f35b[_0x7bcb('0x44')]);_0x2c3570[_0x7bcb('0x48')]=_[_0x7bcb('0x47')](_0x54f35b[_0x7bcb('0x49')],qs[_0x7bcb('0x4a')](_0x3e15a3[_0x7bcb('0x44')]['fields']));_0x2c3570[_0x7bcb('0x48')]=_0x2c3570[_0x7bcb('0x48')][_0x7bcb('0x4b')]?_0x2c3570[_0x7bcb('0x48')]:_0x54f35b['model'];_0x2c3570['order']=qs[_0x7bcb('0x4f')](_0x3e15a3[_0x7bcb('0x44')]['sort']);_0x2c3570[_0x7bcb('0x52')]=qs[_0x7bcb('0x46')](_['pick'](_0x3e15a3['query'],_0x54f35b[_0x7bcb('0x46')]));if(_0x3e15a3[_0x7bcb('0x44')][_0x7bcb('0x51')]){_0x2c3570['where']=_['merge'](_0x2c3570['where'],{'$or':_[_0x7bcb('0x3f')](_0x2c3570['attributes'],function(_0x3a8585){var _0x4d6078={};_0x4d6078[_0x3a8585]={'$like':'%'+_0x3e15a3[_0x7bcb('0x44')][_0x7bcb('0x51')]+'%'};return _0x4d6078;})});}_0x2c3570=_[_0x7bcb('0x53')]({},_0x2c3570,_0x3e15a3[_0x7bcb('0x55')]);return _0x8f077a[_0x7bcb('0xe0')](_0x2c3570);}})[_0x7bcb('0x1f')](function(_0x5873a2){if(_0x5873a2){_0x3373b6=_0x5873a2[_0x7bcb('0x4b')];if(!_0x3e15a3[_0x7bcb('0x44')][_0x7bcb('0x4c')]('nolimit')){_0x2c3570['limit']=qs['limit'](_0x3e15a3[_0x7bcb('0x44')]['limit']);_0x2c3570[_0x7bcb('0x31')]=qs[_0x7bcb('0x31')](_0x3e15a3[_0x7bcb('0x44')][_0x7bcb('0x31')]);}return _0x8f077a['getAgents'](_0x2c3570);}})['then'](function(_0x17ff0d){if(_0x17ff0d){return _0x17ff0d?{'count':_0x3373b6,'rows':_0x17ff0d}:null;}})['then'](respondWithResult(_0x43543e,null))[_0x7bcb('0x29')](handleError(_0x43543e,null));}; \ No newline at end of file +var _0x5e4a=['color','tag','List','out','user','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','groupName','bandwidth','redif','inspect','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','csc','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','destroy','get','SmsAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','rows','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','SmsAccountId','Disposition','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','pick','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','type','twilio','From','messageId','MessageSid','skebby','from','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','clickatell','fromNumber','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','defaults','contact','spread','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','text/xml','\x0a','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','User','Owner','internal','Tag','Tags'];(function(_0x19719c,_0x50fc6f){var _0x243084=function(_0x4fb6f3){while(--_0x4fb6f3){_0x19719c['push'](_0x19719c['shift']());}};_0x243084(++_0x50fc6f);}(_0x5e4a,0x100));var _0xa5e4=function(_0x55e6f5,_0x56849e){_0x55e6f5=_0x55e6f5-0x0;var _0x2f63d9=_0x5e4a[_0x55e6f5];return _0x2f63d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5e4('0x0'));var zipdir=require(_0xa5e4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5e4('0x2'));var moment=require('moment');var BPromise=require(_0xa5e4('0x3'));var Mustache=require('mustache');var util=require(_0xa5e4('0x4'));var path=require(_0xa5e4('0x5'));var sox=require(_0xa5e4('0x6'));var csv=require(_0xa5e4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa5e4('0x8'));var _=require('lodash');var squel=require(_0xa5e4('0x9'));var crypto=require(_0xa5e4('0xa'));var jsforce=require(_0xa5e4('0xb'));var deskjs=require(_0xa5e4('0xc'));var toCsv=require(_0xa5e4('0x7'));var querystring=require(_0xa5e4('0xd'));var Papa=require(_0xa5e4('0xe'));var Redis=require(_0xa5e4('0xf'));var authService=require(_0xa5e4('0x10'));var qs=require(_0xa5e4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5e4('0x12'));var logger=require(_0xa5e4('0x13'))(_0xa5e4('0x14'));var utils=require(_0xa5e4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa5e4('0x16'));var db=require(_0xa5e4('0x17'))['db'];config[_0xa5e4('0x18')]=_['defaults'](config[_0xa5e4('0x18')],{'host':_0xa5e4('0x19'),'port':0x18eb});var socket=require(_0xa5e4('0x1a'))(new Redis(config[_0xa5e4('0x18')]));require(_0xa5e4('0x1b'))[_0xa5e4('0x1c')](socket);var jayson=require(_0xa5e4('0x1d'));var client=jayson[_0xa5e4('0x1e')][_0xa5e4('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4aabea,_0x51446a,_0x56692c,_0x21f33c){return new BPromise(function(_0x5c8f7b,_0x39bc37){var _0x1658df=_0x21f33c||client;return _0x1658df[_0xa5e4('0x20')](_0x4aabea,_0x56692c)[_0xa5e4('0x21')](function(_0x3f60aa){logger[_0xa5e4('0x22')](_0xa5e4('0x23'),_0x51446a,'request\x20sent');logger[_0xa5e4('0x24')](_0xa5e4('0x25'),_0x51446a,_0xa5e4('0x26'),JSON[_0xa5e4('0x27')](_0x3f60aa));if(_0x3f60aa[_0xa5e4('0x28')]){if(_0x3f60aa[_0xa5e4('0x28')][_0xa5e4('0x29')]===0x1f4){logger[_0xa5e4('0x28')](_0xa5e4('0x23'),_0x51446a,_0x3f60aa['error']['message']);return _0x39bc37(_0x3f60aa[_0xa5e4('0x28')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x51446a,_0x3f60aa[_0xa5e4('0x28')][_0xa5e4('0x2a')]);return _0x5c8f7b(_0x3f60aa['error'][_0xa5e4('0x2a')]);}else{logger[_0xa5e4('0x22')](_0xa5e4('0x23'),_0x51446a,'request\x20sent');_0x5c8f7b(_0x3f60aa[_0xa5e4('0x2b')][_0xa5e4('0x2a')]);}})[_0xa5e4('0x2c')](function(_0x525892){logger['error'](_0xa5e4('0x23'),_0x51446a,_0x525892);_0x39bc37(_0x525892);});});}function respondWithStatusCode(_0x41be59,_0x519d74){_0x519d74=_0x519d74||0xcc;return function(_0x514d35){if(_0x514d35){return _0x41be59[_0xa5e4('0x2d')](_0x519d74);}return _0x41be59[_0xa5e4('0x2e')](_0x519d74)[_0xa5e4('0x2f')]();};}function respondWithResult(_0x599e35,_0x9c107){_0x9c107=_0x9c107||0xc8;return function(_0x403ba7){if(_0x403ba7){return _0x599e35[_0xa5e4('0x2e')](_0x9c107)[_0xa5e4('0x30')](_0x403ba7);}};}function respondWithFilteredResult(_0x2176b7,_0x240cc3){return function(_0x1397c){if(_0x1397c){var _0x1c3e65=typeof _0x240cc3[_0xa5e4('0x31')]==='undefined'&&typeof _0x240cc3[_0xa5e4('0x32')]===_0xa5e4('0x33');var _0x494778=_0x1397c[_0xa5e4('0x34')];var _0x42e97b=_0x1c3e65?0x0:_0x240cc3[_0xa5e4('0x31')];var _0x318a20=_0x1c3e65?_0x1397c[_0xa5e4('0x34')]:_0x240cc3[_0xa5e4('0x31')]+_0x240cc3[_0xa5e4('0x32')];var _0x3c22a7;if(_0x318a20>=_0x494778){_0x318a20=_0x494778;_0x3c22a7=0xc8;}else{_0x3c22a7=0xce;}_0x2176b7[_0xa5e4('0x2e')](_0x3c22a7);return _0x2176b7['set'](_0xa5e4('0x35'),_0x42e97b+'-'+_0x318a20+'/'+_0x494778)[_0xa5e4('0x30')](_0x1397c);}return null;};}function patchUpdates(_0x463400){return function(_0x1194db){try{jsonpatch[_0xa5e4('0x36')](_0x1194db,_0x463400,!![]);}catch(_0x119704){return BPromise['reject'](_0x119704);}return _0x1194db['save']();};}function saveUpdates(_0x1c854a,_0x462c3e){return function(_0x1e0131){if(_0x1e0131){return _0x1e0131[_0xa5e4('0x37')](_0x1c854a)[_0xa5e4('0x21')](function(_0x4e0fd4){return _0x4e0fd4;});}return null;};}function removeEntity(_0x5b23f3,_0x49047e){return function(_0x51d18d){if(_0x51d18d){return _0x51d18d[_0xa5e4('0x38')]()[_0xa5e4('0x21')](function(){var _0x58bd68=_0x51d18d[_0xa5e4('0x39')]({'plain':!![]});var _0x3ad82d=_0xa5e4('0x3a');return db[_0xa5e4('0x3b')][_0xa5e4('0x38')]({'where':{'type':_0x3ad82d,'resourceId':_0x58bd68['id']}})[_0xa5e4('0x21')](function(){return _0x51d18d;});})[_0xa5e4('0x21')](function(){_0x5b23f3[_0xa5e4('0x2e')](0xcc)[_0xa5e4('0x2f')]();});}};}function handleEntityNotFound(_0x58c793,_0x64aebb){return function(_0xb70be9){if(!_0xb70be9){_0x58c793[_0xa5e4('0x2d')](0x194);}return _0xb70be9;};}function handleError(_0x30fb74,_0x4100a5){_0x4100a5=_0x4100a5||0x1f4;return function(_0x2a2540){logger['error'](_0x2a2540['stack']);if(_0x2a2540[_0xa5e4('0x3c')]){delete _0x2a2540['name'];}_0x30fb74[_0xa5e4('0x2e')](_0x4100a5)[_0xa5e4('0x3d')](_0x2a2540);};}exports[_0xa5e4('0x3e')]=function(_0x53461c,_0xc7e16e){var _0x31801f={'include':[{'model':db['Pause'],'as':_0xa5e4('0x3f')}]},_0x1dfced={},_0x411807={'count':0x0,'rows':[]};var _0xfaa408=_[_0xa5e4('0x40')](db[_0xa5e4('0x41')][_0xa5e4('0x42')],function(_0x597baf){return{'name':_0x597baf[_0xa5e4('0x43')],'type':_0x597baf['type'][_0xa5e4('0x44')]};});_0x1dfced[_0xa5e4('0x45')]=_[_0xa5e4('0x40')](_0xfaa408,_0xa5e4('0x3c'));_0x1dfced[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x53461c[_0xa5e4('0x46')]);_0x1dfced['filters']=_['intersection'](_0x1dfced[_0xa5e4('0x45')],_0x1dfced[_0xa5e4('0x46')]);_0x31801f[_0xa5e4('0x48')]=_[_0xa5e4('0x49')](_0x1dfced[_0xa5e4('0x45')],qs[_0xa5e4('0x4a')](_0x53461c[_0xa5e4('0x46')]['fields']));_0x31801f[_0xa5e4('0x48')]=_0x31801f[_0xa5e4('0x48')][_0xa5e4('0x4b')]?_0x31801f[_0xa5e4('0x48')]:_0x1dfced[_0xa5e4('0x45')];if(!_0x53461c['query'][_0xa5e4('0x4c')](_0xa5e4('0x4d'))){_0x31801f[_0xa5e4('0x32')]=qs[_0xa5e4('0x32')](_0x53461c['query'][_0xa5e4('0x32')]);_0x31801f[_0xa5e4('0x31')]=qs[_0xa5e4('0x31')](_0x53461c[_0xa5e4('0x46')][_0xa5e4('0x31')]);}_0x31801f[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x53461c[_0xa5e4('0x46')][_0xa5e4('0x4f')]);_0x31801f['where']=qs[_0xa5e4('0x50')](_['pick'](_0x53461c['query'],_0x1dfced[_0xa5e4('0x50')]),_0xfaa408);if(_0x53461c['query'][_0xa5e4('0x51')]){_0x31801f[_0xa5e4('0x52')]=_['merge'](_0x31801f['where'],{'$or':_['map'](_0xfaa408,function(_0x290250){if(_0x290250['type']!==_0xa5e4('0x53')){var _0x6c5fcd={};_0x6c5fcd[_0x290250[_0xa5e4('0x3c')]]={'$like':'%'+_0x53461c['query'][_0xa5e4('0x51')]+'%'};return _0x6c5fcd;}})});}_0x31801f=_[_0xa5e4('0x54')]({},_0x31801f,_0x53461c[_0xa5e4('0x55')]);var _0x3b0749={'where':_0x31801f[_0xa5e4('0x52')]};return db['SmsAccount'][_0xa5e4('0x34')](_0x3b0749)['then'](function(_0x38f46d){_0x411807['count']=_0x38f46d;if(_0x53461c[_0xa5e4('0x46')][_0xa5e4('0x56')]){_0x31801f['include']=[{'all':!![]}];}return db[_0xa5e4('0x41')]['findAll'](_0x31801f);})[_0xa5e4('0x21')](function(_0xec1285){_0x411807[_0xa5e4('0x57')]=_0xec1285;return _0x411807;})[_0xa5e4('0x21')](respondWithFilteredResult(_0xc7e16e,_0x31801f))[_0xa5e4('0x2c')](handleError(_0xc7e16e,null));};exports['show']=function(_0x55f004,_0x1c718e){var _0x26ba1c={'raw':![],'where':{'id':_0x55f004[_0xa5e4('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xa5e4('0x3f')}]},_0xf692bb={};_0xf692bb[_0xa5e4('0x45')]=_[_0xa5e4('0x47')](db[_0xa5e4('0x41')][_0xa5e4('0x42')]);_0xf692bb[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x55f004[_0xa5e4('0x46')]);_0xf692bb[_0xa5e4('0x50')]=_['intersection'](_0xf692bb[_0xa5e4('0x45')],_0xf692bb[_0xa5e4('0x46')]);_0x26ba1c[_0xa5e4('0x48')]=_['intersection'](_0xf692bb[_0xa5e4('0x45')],qs[_0xa5e4('0x4a')](_0x55f004['query'][_0xa5e4('0x4a')]));_0x26ba1c[_0xa5e4('0x48')]=_0x26ba1c[_0xa5e4('0x48')]['length']?_0x26ba1c[_0xa5e4('0x48')]:_0xf692bb['model'];if(_0x55f004[_0xa5e4('0x46')][_0xa5e4('0x56')]){_0x26ba1c['include']=[{'all':!![]}];}_0x26ba1c=_['merge']({},_0x26ba1c,_0x55f004[_0xa5e4('0x55')]);return db[_0xa5e4('0x41')][_0xa5e4('0x59')](_0x26ba1c)[_0xa5e4('0x21')](handleEntityNotFound(_0x1c718e,null))[_0xa5e4('0x21')](respondWithResult(_0x1c718e,null))[_0xa5e4('0x2c')](handleError(_0x1c718e,null));};exports[_0xa5e4('0x5a')]=function(_0x5292d5,_0x52a0d5){return db[_0xa5e4('0x41')][_0xa5e4('0x5a')](_0x5292d5[_0xa5e4('0x5b')],{})[_0xa5e4('0x21')](function(_0x2db0e8){var _0x52011b=_0x5292d5['user'][_0xa5e4('0x39')]({'plain':!![]});if(!_0x52011b)throw new Error(_0xa5e4('0x5c'));if(_0x52011b[_0xa5e4('0x5d')]==='user'){var _0x37c2b4=_0x2db0e8[_0xa5e4('0x39')]({'plain':!![]});var _0xeefbf0=_0xa5e4('0x3a');return db[_0xa5e4('0x5e')][_0xa5e4('0x59')]({'where':{'name':_0xeefbf0,'userProfileId':_0x52011b[_0xa5e4('0x5f')]},'raw':!![]})[_0xa5e4('0x21')](function(_0x26f378){if(_0x26f378&&_0x26f378[_0xa5e4('0x60')]===0x0){return db[_0xa5e4('0x3b')]['create']({'name':_0x37c2b4[_0xa5e4('0x3c')],'resourceId':_0x37c2b4['id'],'type':_0x26f378[_0xa5e4('0x3c')],'sectionId':_0x26f378['id']},{})[_0xa5e4('0x21')](function(){return _0x2db0e8;});}else{return _0x2db0e8;}})[_0xa5e4('0x2c')](function(_0x2c5599){logger[_0xa5e4('0x28')](_0xa5e4('0x61'),_0x2c5599);throw _0x2c5599;});}return _0x2db0e8;})['then'](respondWithResult(_0x52a0d5,0xc9))[_0xa5e4('0x2c')](handleError(_0x52a0d5,null));};exports[_0xa5e4('0x37')]=function(_0x1e6834,_0x7fe0c9){if(_0x1e6834['body']['id']){delete _0x1e6834[_0xa5e4('0x5b')]['id'];}return db[_0xa5e4('0x41')]['find']({'where':{'id':_0x1e6834[_0xa5e4('0x58')]['id']},'include':[{'model':db[_0xa5e4('0x62')],'as':'mandatoryDispositionPause'}]})[_0xa5e4('0x21')](handleEntityNotFound(_0x7fe0c9,null))[_0xa5e4('0x21')](saveUpdates(_0x1e6834[_0xa5e4('0x5b')],null))[_0xa5e4('0x21')](respondWithResult(_0x7fe0c9,null))[_0xa5e4('0x2c')](handleError(_0x7fe0c9,null));};exports[_0xa5e4('0x38')]=function(_0xd180a,_0x560a24){return db[_0xa5e4('0x41')]['find']({'where':{'id':_0xd180a[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x560a24,null))[_0xa5e4('0x21')](removeEntity(_0x560a24,null))[_0xa5e4('0x2c')](handleError(_0x560a24,null));};exports['describe']=function(_0x3be6c3,_0x3e3993){return db[_0xa5e4('0x41')][_0xa5e4('0x63')]()[_0xa5e4('0x21')](respondWithResult(_0x3e3993,null))[_0xa5e4('0x2c')](handleError(_0x3e3993,null));};exports[_0xa5e4('0x64')]=function(_0x54d971,_0x2e3dbc,_0x5b2f1e){if(_0x54d971[_0xa5e4('0x5b')]['id']){delete _0x54d971[_0xa5e4('0x5b')]['id'];}return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x54d971[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x2e3dbc,null))['then'](function(_0x2183f3){if(_0x2183f3){_0x54d971[_0xa5e4('0x5b')][_0xa5e4('0x65')]=_0x2183f3['id'];return db[_0xa5e4('0x66')][_0xa5e4('0x5a')](_0x54d971[_0xa5e4('0x5b')]);}})[_0xa5e4('0x21')](respondWithResult(_0x2e3dbc,null))['catch'](handleError(_0x2e3dbc,null));};exports['getDispositions']=function(_0x519036,_0x21aa76,_0x2c9591){var _0x3097d4={'raw':![],'where':{}};var _0x107505={};var _0xe5762c={'count':0x0,'rows':[]};return db[_0xa5e4('0x41')]['findOne']({'where':{'id':_0x519036[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x21aa76,null))[_0xa5e4('0x21')](function(_0x1b2c32){if(_0x1b2c32){_0x107505[_0xa5e4('0x45')]=_[_0xa5e4('0x47')](db['Disposition'][_0xa5e4('0x42')]);_0x107505[_0xa5e4('0x46')]=_['keys'](_0x519036[_0xa5e4('0x46')]);_0x107505['filters']=_[_0xa5e4('0x49')](_0x107505[_0xa5e4('0x45')],_0x107505[_0xa5e4('0x46')]);_0x3097d4['attributes']=_['intersection'](_0x107505[_0xa5e4('0x45')],qs[_0xa5e4('0x4a')](_0x519036[_0xa5e4('0x46')][_0xa5e4('0x4a')]));_0x3097d4['attributes']=_0x3097d4['attributes'][_0xa5e4('0x4b')]?_0x3097d4[_0xa5e4('0x48')]:_0x107505[_0xa5e4('0x45')];if(!_0x519036[_0xa5e4('0x46')][_0xa5e4('0x4c')]('nolimit')){_0x3097d4[_0xa5e4('0x32')]=qs[_0xa5e4('0x32')](_0x519036[_0xa5e4('0x46')]['limit']);_0x3097d4[_0xa5e4('0x31')]=qs['offset'](_0x519036[_0xa5e4('0x46')][_0xa5e4('0x31')]);}_0x3097d4[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x519036[_0xa5e4('0x46')][_0xa5e4('0x4f')]);_0x3097d4[_0xa5e4('0x52')]=qs[_0xa5e4('0x50')](_['pick'](_0x519036[_0xa5e4('0x46')],_0x107505[_0xa5e4('0x50')]));_0x3097d4[_0xa5e4('0x52')]['SmsAccountId']=_0x1b2c32['id'];if(_0x519036[_0xa5e4('0x46')][_0xa5e4('0x51')]){_0x3097d4[_0xa5e4('0x52')]=_['merge'](_0x3097d4[_0xa5e4('0x52')],{'$or':_[_0xa5e4('0x40')](_0x3097d4[_0xa5e4('0x48')],function(_0x4c535c){var _0x1a3593={};_0x1a3593[_0x4c535c]={'$like':'%'+_0x519036['query'][_0xa5e4('0x51')]+'%'};return _0x1a3593;})});}_0x3097d4=_['merge']({},_0x3097d4,_0x519036[_0xa5e4('0x55')]);return db[_0xa5e4('0x66')][_0xa5e4('0x34')]({'where':_0x3097d4[_0xa5e4('0x52')]})[_0xa5e4('0x21')](function(_0x16d7d1){_0xe5762c['count']=_0x16d7d1;if(_0x519036[_0xa5e4('0x46')][_0xa5e4('0x56')]){_0x3097d4[_0xa5e4('0x67')]=[{'all':!![]}];}return db[_0xa5e4('0x66')][_0xa5e4('0x68')](_0x3097d4);})[_0xa5e4('0x21')](function(_0x1b6c93){_0xe5762c[_0xa5e4('0x57')]=_0x1b6c93;return _0xe5762c;});}})['then'](respondWithFilteredResult(_0x21aa76,_0x3097d4))[_0xa5e4('0x2c')](handleError(_0x21aa76,null));};exports['removeDispositions']=function(_0x5e205d,_0x45aae9,_0x5756c3){return db[_0xa5e4('0x41')][_0xa5e4('0x59')]({'where':{'id':_0x5e205d[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x45aae9,null))[_0xa5e4('0x21')](function(_0x2282dd){if(_0x2282dd){return _0x2282dd[_0xa5e4('0x69')](_0x5e205d['query'][_0xa5e4('0x6a')]);}})['then'](respondWithStatusCode(_0x45aae9,null))[_0xa5e4('0x2c')](handleError(_0x45aae9,null));};exports[_0xa5e4('0x6b')]=function(_0x27d89c,_0x22d7cb,_0x303856){if(_0x27d89c['body']['id']){delete _0x27d89c['body']['id'];}return db[_0xa5e4('0x41')][_0xa5e4('0x59')]({'where':{'id':_0x27d89c[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x22d7cb,null))[_0xa5e4('0x21')](function(_0x4208d4){if(_0x4208d4){_0x27d89c[_0xa5e4('0x5b')][_0xa5e4('0x65')]=_0x4208d4['id'];return db[_0xa5e4('0x6c')][_0xa5e4('0x5a')](_0x27d89c[_0xa5e4('0x5b')]);}})[_0xa5e4('0x21')](respondWithResult(_0x22d7cb,null))[_0xa5e4('0x2c')](handleError(_0x22d7cb,null));};exports[_0xa5e4('0x6d')]=function(_0x39a97b,_0x48145e,_0x9a45ba){var _0x5360ed={'raw':![],'where':{}};var _0x5407f3={};var _0x3d16d9={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa5e4('0x6e')]({'where':{'id':_0x39a97b[_0xa5e4('0x58')]['id']}})['then'](handleEntityNotFound(_0x48145e,null))[_0xa5e4('0x21')](function(_0x25706c){if(_0x25706c){_0x5407f3[_0xa5e4('0x45')]=_['keys'](db[_0xa5e4('0x6c')][_0xa5e4('0x42')]);_0x5407f3['query']=_[_0xa5e4('0x47')](_0x39a97b[_0xa5e4('0x46')]);_0x5407f3[_0xa5e4('0x50')]=_['intersection'](_0x5407f3[_0xa5e4('0x45')],_0x5407f3[_0xa5e4('0x46')]);_0x5360ed[_0xa5e4('0x48')]=_['intersection'](_0x5407f3[_0xa5e4('0x45')],qs[_0xa5e4('0x4a')](_0x39a97b['query'][_0xa5e4('0x4a')]));_0x5360ed[_0xa5e4('0x48')]=_0x5360ed[_0xa5e4('0x48')][_0xa5e4('0x4b')]?_0x5360ed['attributes']:_0x5407f3[_0xa5e4('0x45')];if(!_0x39a97b[_0xa5e4('0x46')]['hasOwnProperty'](_0xa5e4('0x4d'))){_0x5360ed['limit']=qs[_0xa5e4('0x32')](_0x39a97b[_0xa5e4('0x46')][_0xa5e4('0x32')]);_0x5360ed[_0xa5e4('0x31')]=qs['offset'](_0x39a97b[_0xa5e4('0x46')][_0xa5e4('0x31')]);}_0x5360ed[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x39a97b[_0xa5e4('0x46')][_0xa5e4('0x4f')]);_0x5360ed[_0xa5e4('0x52')]=qs[_0xa5e4('0x50')](_[_0xa5e4('0x6f')](_0x39a97b['query'],_0x5407f3[_0xa5e4('0x50')]));_0x5360ed[_0xa5e4('0x52')][_0xa5e4('0x65')]=_0x25706c['id'];if(_0x39a97b[_0xa5e4('0x46')][_0xa5e4('0x51')]){_0x5360ed[_0xa5e4('0x52')]=_[_0xa5e4('0x54')](_0x5360ed[_0xa5e4('0x52')],{'$or':_[_0xa5e4('0x40')](_0x5360ed[_0xa5e4('0x48')],function(_0x9c574a){var _0x6c193c={};_0x6c193c[_0x9c574a]={'$like':'%'+_0x39a97b['query']['filter']+'%'};return _0x6c193c;})});}_0x5360ed=_['merge']({},_0x5360ed,_0x39a97b[_0xa5e4('0x55')]);return db[_0xa5e4('0x6c')]['count']({'where':_0x5360ed[_0xa5e4('0x52')]})['then'](function(_0x3da621){_0x3d16d9[_0xa5e4('0x34')]=_0x3da621;if(_0x39a97b['query'][_0xa5e4('0x56')]){_0x5360ed[_0xa5e4('0x67')]=[{'all':!![]}];}return db[_0xa5e4('0x6c')][_0xa5e4('0x68')](_0x5360ed);})[_0xa5e4('0x21')](function(_0x29be2b){_0x3d16d9[_0xa5e4('0x57')]=_0x29be2b;return _0x3d16d9;});}})[_0xa5e4('0x21')](respondWithFilteredResult(_0x48145e,_0x5360ed))['catch'](handleError(_0x48145e,null));};exports[_0xa5e4('0x70')]=function(_0x3fdc7d,_0x188106,_0xd0bd6e){return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x3fdc7d[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x188106,null))['then'](function(_0x274d27){if(_0x274d27){return _0x274d27[_0xa5e4('0x70')](_0x3fdc7d[_0xa5e4('0x46')][_0xa5e4('0x6a')]);}})[_0xa5e4('0x21')](respondWithStatusCode(_0x188106,null))[_0xa5e4('0x2c')](handleError(_0x188106,null));};exports[_0xa5e4('0x71')]=function(_0x403dcd,_0x43c91f,_0x1a4427){var _0x2a57be={'channel':_0xa5e4('0x72')};var _0x4aafeb=[];var _0x7fc4fe=[];var _0x1dd0ca={};return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x403dcd[_0xa5e4('0x58')]['id']},'include':[{'model':db[_0xa5e4('0x73')],'as':_0xa5e4('0x74')}]})[_0xa5e4('0x21')](handleEntityNotFound(_0x43c91f,null))[_0xa5e4('0x21')](function(_0x4ffc73){_0x2a57be['account']=_0x4ffc73;_0x2a57be[_0xa5e4('0x75')]=_[_0xa5e4('0x76')](_0x4ffc73[_0xa5e4('0x74')],[_0xa5e4('0x77')],['asc']);if(_0x2a57be[_0xa5e4('0x78')][_0xa5e4('0x74')]){delete _0x2a57be['account']['Applications'];}return db[_0xa5e4('0x79')]['describe']();})[_0xa5e4('0x21')](function(_0x39472e){if(!_0x39472e){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))](_0xa5e4('0x7c'));}_0x4aafeb=_[_0xa5e4('0x7d')](_[_0xa5e4('0x47')](_0x39472e),[_0xa5e4('0x7e'),_0xa5e4('0x7f')]);_0x7fc4fe=_[_0xa5e4('0x7d')](_[_0xa5e4('0x47')](_0x39472e),[_0xa5e4('0x7e'),_0xa5e4('0x7f'),_0xa5e4('0x80'),'ListId']);_0x2a57be[_0xa5e4('0x5b')]={'mapKey':_0xa5e4('0x81')};if(_0x2a57be[_0xa5e4('0x78')]['type']){switch(_0x2a57be[_0xa5e4('0x78')][_0xa5e4('0x82')]){case _0xa5e4('0x83'):_0x2a57be[_0xa5e4('0x5b')]['from']=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x84')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')]['Body'];_0x2a57be['body'][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x86')];break;case _0xa5e4('0x87'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]='+'+_0x403dcd[_0xa5e4('0x5b')]['sender'];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd['body'][_0xa5e4('0x89')];break;case'connectel':_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x88')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x2a')];break;case _0xa5e4('0x8a'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')]['from'];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x5b')];_0x2a57be['body'][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x8b')];break;case _0xa5e4('0x8c'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x84')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd['body'][_0xa5e4('0x8d')];_0x2a57be[_0xa5e4('0x5b')]['messageId']=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x8e')];break;case _0xa5e4('0x8f'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]='+'+_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x90')][0x0]['from'];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd['body'][_0xa5e4('0x90')][0x0][_0xa5e4('0x89')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x90')][0x0][_0xa5e4('0x85')];break;case'csc':_0x2a57be['body'][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x91')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')]['segmentedMessage']['message'];break;case _0xa5e4('0x92'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x93')];_0x2a57be[_0xa5e4('0x5b')]['body']=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x89')];_0x2a57be[_0xa5e4('0x5b')]['messageId']=_0x403dcd[_0xa5e4('0x5b')]['replyMessageId'];break;case'bandwidth':_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][0x0]['message']['id'];_0x2a57be['body'][_0xa5e4('0x88')]=_0x403dcd[_0xa5e4('0x5b')][0x0][_0xa5e4('0x2a')][_0xa5e4('0x88')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')][0x0][_0xa5e4('0x2a')][_0xa5e4('0x89')];break;case _0xa5e4('0x94'):_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')]=_0x403dcd['body'][_0xa5e4('0x88')];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]=_0x403dcd[_0xa5e4('0x5b')]['message'];_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x85')]=_0x403dcd[_0xa5e4('0x5b')][_0xa5e4('0x95')];break;}}if(_0x2a57be[_0xa5e4('0x5b')]['id']){delete _0x2a57be['body']['id'];}if(_[_0xa5e4('0x96')](_0x2a57be[_0xa5e4('0x5b')]['from'])){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2a57be['body'][_0xa5e4('0x5b')])||_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x5b')]===''){throw new db[(_0xa5e4('0x7a'))]['ValidationError'](_0xa5e4('0x97'));}if(_['isNil'](_0x2a57be['body'][_0xa5e4('0x98')])){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7fc4fe);}if(!_[_0xa5e4('0x99')](_0x7fc4fe,_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x98')])){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))](_0xa5e4('0x9a')+_0x7fc4fe);}_0x1dd0ca[_0x2a57be[_0xa5e4('0x5b')]['mapKey']]=_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x88')];return db[_0xa5e4('0x9b')][_0xa5e4('0x59')]({'where':{'id':_0x2a57be['account'][_0xa5e4('0x9c')]},'include':[{'model':db[_0xa5e4('0x79')],'as':_0xa5e4('0x9d'),'where':_0x1dd0ca,'limit':0x1,'order':[[_0xa5e4('0x7f'),_0xa5e4('0x9e')]]}]});})[_0xa5e4('0x21')](handleEntityNotFound(_0x43c91f,null))[_0xa5e4('0x21')](function(_0x4233aa){if(_0x4233aa){_0x2a57be[_0xa5e4('0x9f')]=_[_0xa5e4('0xa0')](_0x4233aa,[_0xa5e4('0x9d')]);if(_0x4233aa[_0xa5e4('0x9d')][_0xa5e4('0x4b')]){return _0x4233aa[_0xa5e4('0x9d')][0x0];}var _0x48557c=_[_0xa5e4('0xa1')](_0x2a57be[_0xa5e4('0x5b')],{'firstName':_0x2a57be[_0xa5e4('0x5b')]['from'],'ListId':_0x4233aa['id']});_0x48557c[_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x98')]]=_0x2a57be['body'][_0xa5e4('0x88')];return db['CmContact'][_0xa5e4('0x5a')](_0x48557c,{'fields':_0x4aafeb,'raw':!![]});}})[_0xa5e4('0x21')](handleEntityNotFound(_0x43c91f,null))['then'](function(_0x44662a){if(_0x44662a){_0x2a57be[_0xa5e4('0xa2')]=_0x44662a;var _0x32b998={'ContactId':_0x44662a['id'],'phone':_0x2a57be[_0xa5e4('0x5b')]['from'],'SmsAccountId':_0x403dcd[_0xa5e4('0x58')]['id']};var _0x325756={'ContactId':_0x44662a['id'],'SmsAccountId':_0x403dcd[_0xa5e4('0x58')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x325756})[_0xa5e4('0x21')](function(_0x953c45){if(_0x953c45){return[_0x953c45,![]];}return db['SmsInteraction'][_0xa5e4('0x5a')](_0x32b998)[_0xa5e4('0x21')](function(_0x26a5cd){return[_0x26a5cd,!![]];});});}})[_0xa5e4('0xa3')](function(_0x1626fb,_0x34c134){_0x2a57be[_0xa5e4('0xa4')]=_0x1626fb[_0xa5e4('0x39')]({'plain':!![]});_0x2a57be[_0xa5e4('0xa4')][_0xa5e4('0xa5')]=![];if(_0x34c134){if(_0x2a57be['account'][_0xa5e4('0xa6')]){_0x2a57be['applications'][_0xa5e4('0xa7')]({'id':0x0,'priority':_0x2a57be[_0xa5e4('0x75')][_0xa5e4('0x4b')]+0x1,'app':_0xa5e4('0xa8'),'appdata':_0xa5e4('0xa9'),'interval':'*,*,*,*'});}_0x2a57be['interaction'][_0xa5e4('0xa5')]=!![];}return db['SmsMessage']['create']({'phone':_0x2a57be['body'][_0xa5e4('0x88')],'messageId':_0x2a57be[_0xa5e4('0x5b')][_0xa5e4('0x85')],'body':_0x2a57be['body']['body'],'SmsAccountId':_0x403dcd['params']['id'],'SmsInteractionId':_0x1626fb['id'],'direction':'in','ContactId':_0x1626fb['ContactId'],'AttachmentId':_0x2a57be['body'][_0xa5e4('0xaa')]});})[_0xa5e4('0x21')](function(_0x273e09){_0x2a57be[_0xa5e4('0x2a')]=_0x273e09;if(_0x2a57be[_0xa5e4('0xa4')][_0xa5e4('0xab')]){return db['User'][_0xa5e4('0x59')]({'attributes':['id',_0xa5e4('0x3c')],'where':{'id':_0x2a57be[_0xa5e4('0xa4')][_0xa5e4('0xab')]}})[_0xa5e4('0x21')](function(_0x4e712a){if(_0x4e712a){_0x2a57be[_0xa5e4('0x75')][_0xa5e4('0xac')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4e712a[_0xa5e4('0x3c')]+','+(_0x2a57be[_0xa5e4('0x78')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa5e4('0xad'),_0xa5e4('0xae'),_0x2a57be);});}return respondWithRpcPromise('Start',_0xa5e4('0xae'),_0x2a57be);})[_0xa5e4('0x21')](function(_0x1239aa){if(_0x1239aa){var _0x4d4e3a=0xc8;var _0x5b2b0e=_0xa5e4('0xaf');logger[_0xa5e4('0x22')](_0xa5e4('0x25'),_0x5b2b0e,_0x4d4e3a,'entity\x20found');logger[_0xa5e4('0x24')](_0xa5e4('0xb0'),_0x5b2b0e,_0x4d4e3a,_0xa5e4('0xb1'),JSON[_0xa5e4('0x27')](_0x1239aa));if(_0x2a57be[_0xa5e4('0x78')][_0xa5e4('0x82')]===_0xa5e4('0x83')){return _0x43c91f[_0xa5e4('0x2e')](_0x4d4e3a)[_0xa5e4('0xb2')](_0xa5e4('0xb3'),_0xa5e4('0xb4'))[_0xa5e4('0x3d')](_0xa5e4('0xb5'));}else{return _0x43c91f[_0xa5e4('0x2e')](_0x4d4e3a)[_0xa5e4('0x30')](_0x1239aa);}}})[_0xa5e4('0x2c')](handleError(_0x43c91f,null));};exports['addApplications']=function(_0x111158,_0xdd8d3,_0x44c09f){return db['SmsAccount']['findOne']({'where':{'id':_0x111158[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0xdd8d3,null))[_0xa5e4('0x21')](function(_0x431164){if(_0x431164){return db['sequelize']['transaction'](function(_0x1403a2){return db[_0xa5e4('0x73')]['destroy']({'where':{'SmsAccountId':_0x111158[_0xa5e4('0x58')]['id']},'transaction':_0x1403a2})[_0xa5e4('0x21')](function(_0x52b963){var _0xfe042b=_[_0xa5e4('0x40')](_0x111158[_0xa5e4('0x5b')],function(_0x280e23){_0x280e23[_0xa5e4('0x65')]=_0x111158[_0xa5e4('0x58')]['id'];return _0x280e23;});return db[_0xa5e4('0x73')][_0xa5e4('0xb6')](_0xfe042b,{'transaction':_0x1403a2});});})['then'](function(){return db[_0xa5e4('0x73')][_0xa5e4('0xb7')]({'where':{'SmsAccountId':_0x111158[_0xa5e4('0x58')]['id']},'order':_0xa5e4('0x77')});});}})[_0xa5e4('0x21')](respondWithResult(_0xdd8d3,null))[_0xa5e4('0x2c')](handleError(_0xdd8d3,null));};exports[_0xa5e4('0xb8')]=function(_0x3c00ff,_0x121163,_0x2d18c9){var _0x4ac5e1={};var _0x2ebb4c={};var _0x459034;var _0x27e90b;return db[_0xa5e4('0x41')][_0xa5e4('0x6e')]({'where':{'id':_0x3c00ff[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x121163,null))['then'](function(_0x591cf9){if(_0x591cf9){_0x459034=_0x591cf9;_0x2ebb4c[_0xa5e4('0x45')]=_[_0xa5e4('0x47')](db[_0xa5e4('0x73')][_0xa5e4('0x42')]);_0x2ebb4c[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x3c00ff[_0xa5e4('0x46')]);_0x2ebb4c['filters']=_[_0xa5e4('0x49')](_0x2ebb4c[_0xa5e4('0x45')],_0x2ebb4c[_0xa5e4('0x46')]);_0x4ac5e1[_0xa5e4('0x48')]=_[_0xa5e4('0x49')](_0x2ebb4c[_0xa5e4('0x45')],qs['fields'](_0x3c00ff[_0xa5e4('0x46')][_0xa5e4('0x4a')]));_0x4ac5e1[_0xa5e4('0x48')]=_0x4ac5e1['attributes'][_0xa5e4('0x4b')]?_0x4ac5e1[_0xa5e4('0x48')]:_0x2ebb4c[_0xa5e4('0x45')];_0x4ac5e1[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x3c00ff[_0xa5e4('0x46')]['sort']);_0x4ac5e1[_0xa5e4('0x52')]=qs[_0xa5e4('0x50')](_[_0xa5e4('0x6f')](_0x3c00ff[_0xa5e4('0x46')],_0x2ebb4c[_0xa5e4('0x50')]));if(_0x3c00ff['query'][_0xa5e4('0x51')]){_0x4ac5e1[_0xa5e4('0x52')]=_[_0xa5e4('0x54')](_0x4ac5e1['where'],{'$or':_[_0xa5e4('0x40')](_0x4ac5e1[_0xa5e4('0x48')],function(_0x71c847){var _0x12e55f={};_0x12e55f[_0x71c847]={'$like':'%'+_0x3c00ff[_0xa5e4('0x46')]['filter']+'%'};return _0x12e55f;})});}_0x4ac5e1=_[_0xa5e4('0x54')]({},_0x4ac5e1,_0x3c00ff['options']);return _0x459034[_0xa5e4('0xb8')](_0x4ac5e1);}})[_0xa5e4('0x21')](function(_0x1a1b7a){if(_0x1a1b7a){_0x27e90b=_0x1a1b7a['length'];if(!_0x3c00ff[_0xa5e4('0x46')][_0xa5e4('0x4c')]('nolimit')){_0x4ac5e1['limit']=qs[_0xa5e4('0x32')](_0x3c00ff[_0xa5e4('0x46')][_0xa5e4('0x32')]);_0x4ac5e1[_0xa5e4('0x31')]=qs[_0xa5e4('0x31')](_0x3c00ff[_0xa5e4('0x46')][_0xa5e4('0x31')]);}return _0x459034[_0xa5e4('0xb8')](_0x4ac5e1);}})[_0xa5e4('0x21')](function(_0x5943af){if(_0x5943af){return _0x5943af?{'count':_0x27e90b,'rows':_0x5943af}:null;}})['then'](respondWithResult(_0x121163,null))[_0xa5e4('0x2c')](handleError(_0x121163,null));};exports[_0xa5e4('0xb9')]=function(_0x21afd4,_0x5c638d,_0x2cc737){var _0x2f1a86={'raw':![],'where':{}};var _0x1b2fcd={};var _0x431fc8={'count':0x0,'rows':[]};return db[_0xa5e4('0x41')]['findOne']({'where':{'id':_0x21afd4[_0xa5e4('0x58')]['id']}})['then'](handleEntityNotFound(_0x5c638d,null))[_0xa5e4('0x21')](function(_0x2f5271){if(_0x2f5271){_0x1b2fcd['model']=_[_0xa5e4('0x47')](db['SmsInteraction'][_0xa5e4('0x42')]);_0x1b2fcd[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x21afd4[_0xa5e4('0x46')]);_0x1b2fcd[_0xa5e4('0x50')]=_[_0xa5e4('0x49')](_0x1b2fcd[_0xa5e4('0x45')],_0x1b2fcd[_0xa5e4('0x46')]);_0x2f1a86[_0xa5e4('0x48')]=_['intersection'](_0x1b2fcd[_0xa5e4('0x45')],qs['fields'](_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x4a')]));_0x2f1a86['attributes']=_0x2f1a86[_0xa5e4('0x48')]['length']?_0x2f1a86[_0xa5e4('0x48')]:_0x1b2fcd[_0xa5e4('0x45')];if(!_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x4c')](_0xa5e4('0x4d'))){_0x2f1a86['limit']=qs[_0xa5e4('0x32')](_0x21afd4[_0xa5e4('0x46')]['limit']);_0x2f1a86[_0xa5e4('0x31')]=qs['offset'](_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x31')]);}_0x2f1a86['order']=qs['sort'](_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x4f')]);_0x2f1a86[_0xa5e4('0x52')]=qs['filters'](_[_0xa5e4('0x6f')](_0x21afd4['query'],_0x1b2fcd['filters']));_0x2f1a86['where'][_0xa5e4('0x65')]=_0x2f5271['id'];if(_0x21afd4[_0xa5e4('0x46')]['filter']){_0x2f1a86['where']=_[_0xa5e4('0x54')](_0x2f1a86[_0xa5e4('0x52')],{'$or':_['map'](_0x2f1a86[_0xa5e4('0x48')],function(_0x53bbe6){var _0x20853c={};_0x20853c[_0x53bbe6]={'$like':'%'+_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x51')]+'%'};return _0x20853c;})});}_0x2f1a86=_['merge']({},_0x2f1a86,_0x21afd4['options']);return db[_0xa5e4('0xba')][_0xa5e4('0x34')]({'where':_0x2f1a86['where']})[_0xa5e4('0x21')](function(_0x27eb5f){_0x431fc8[_0xa5e4('0x34')]=_0x27eb5f;if(_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0x56')]){_0x2f1a86[_0xa5e4('0x67')]=[{'model':db[_0xa5e4('0x79')],'as':'Contact','required':![]},{'model':db[_0xa5e4('0xbb')],'as':_0xa5e4('0xbc'),'attributes':[_0xa5e4('0x3c'),'fullname',_0xa5e4('0xbd')],'required':![]},{'model':db[_0xa5e4('0xbe')],'as':_0xa5e4('0xbf'),'attributes':['id',_0xa5e4('0x3c'),_0xa5e4('0xc0')],'where':_0x21afd4[_0xa5e4('0x46')]['tag']?{'id':_0x21afd4[_0xa5e4('0x46')]['tag']}:undefined,'required':_0x21afd4[_0xa5e4('0x46')][_0xa5e4('0xc1')]?!![]:![]}];}return db[_0xa5e4('0xba')][_0xa5e4('0x68')](_0x2f1a86);})[_0xa5e4('0x21')](function(_0x52d0b7){_0x431fc8['rows']=_0x52d0b7;return _0x431fc8;});}})[_0xa5e4('0x21')](respondWithFilteredResult(_0x5c638d,_0x2f1a86))[_0xa5e4('0x2c')](handleError(_0x5c638d,null));};exports[_0xa5e4('0x3d')]=function(_0x88fa8a,_0x4d0020,_0x1f3e6d){var _0x347ec2,_0x557488,_0x4e28ae;if(_[_0xa5e4('0x96')](_0x88fa8a[_0xa5e4('0x5b')][_0xa5e4('0x5b')])||_0x88fa8a[_0xa5e4('0x5b')][_0xa5e4('0x5b')]===''){throw new db[(_0xa5e4('0x7a'))]['ValidationError'](_0xa5e4('0x97'));}if(_[_0xa5e4('0x96')](_0x88fa8a[_0xa5e4('0x5b')]['to'])){throw new db[(_0xa5e4('0x7a'))][(_0xa5e4('0x7b'))]('to\x20is\x20mandatory');}_0x347ec2=_0x88fa8a[_0xa5e4('0x5b')]['to'];return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x88fa8a[_0xa5e4('0x58')]['id']},'include':[{'model':db[_0xa5e4('0x9b')],'as':_0xa5e4('0xc2'),'include':[{'model':db[_0xa5e4('0x79')],'as':_0xa5e4('0x9d'),'where':{'mobile':_0x347ec2},'limit':0x1,'order':[[_0xa5e4('0x7f'),_0xa5e4('0x9e')]]}]}]})[_0xa5e4('0x21')](handleEntityNotFound(_0x4d0020,null))[_0xa5e4('0x21')](function(_0x44ab92){if(_0x44ab92&&_0x44ab92[_0xa5e4('0xc2')]){_0x557488=_0x44ab92[_0xa5e4('0x39')]({'plain':!![]});if(_0x557488[_0xa5e4('0xc2')]&&_0x557488['List']['Contacts'][_0xa5e4('0x4b')]){return _0x557488[_0xa5e4('0xc2')][_0xa5e4('0x9d')][0x0];}return db['CmContact'][_0xa5e4('0x5a')](_['defaults'](_0x88fa8a[_0xa5e4('0x5b')],{'firstName':_0x347ec2,'mobile':_0x347ec2,'phone':_0x347ec2,'ListId':_0x557488[_0xa5e4('0x9c')]}));}})['then'](handleEntityNotFound(_0x4d0020,null))['then'](function(_0x57182c){if(_0x57182c){_0x4e28ae=_0x57182c;return db['SmsInteraction']['find']({'where':{'ContactId':_0x4e28ae['id'],'closed':![],'SmsAccountId':_0x557488['id']}})['then'](function(_0x5c017f){if(_0x5c017f){return[_0x5c017f,![]];}return db[_0xa5e4('0xba')]['create']({'UserId':_0x88fa8a['user']['id'],'ContactId':_0x4e28ae['id'],'SmsAccountId':_0x557488['id'],'phone':_0x347ec2,'firstMsgDirection':_0xa5e4('0xc3'),'Messages':[_['merge'](_0x88fa8a[_0xa5e4('0x5b')],{'read':![],'body':_0x88fa8a[_0xa5e4('0x5b')][_0xa5e4('0x5b')],'phone':_0x347ec2,'SmsAccountId':_0x557488['id'],'UserId':_0x88fa8a[_0xa5e4('0xc4')]['id'],'ContactId':_0x4e28ae['id']})]},{'include':[{'model':db[_0xa5e4('0xc5')],'as':_0xa5e4('0xc6')}]})[_0xa5e4('0x21')](function(_0x4821df){return[_0x4821df,!![]];});});}})[_0xa5e4('0xa3')](function(_0x4aaf9e,_0x10f261){if(_0x10f261){return _0x4aaf9e;}return db['SmsMessage'][_0xa5e4('0x5a')](_[_0xa5e4('0x54')](_0x88fa8a[_0xa5e4('0x5b')],{'read':![],'body':_0x88fa8a[_0xa5e4('0x5b')][_0xa5e4('0x5b')],'phone':_0x347ec2,'SmsAccountId':_0x557488['id'],'SmsInteractionId':_0x4aaf9e['id'],'UserId':_0x88fa8a['user']['id'],'ContactId':_0x4e28ae['id']}))[_0xa5e4('0x21')](function(_0x433b09){_0x4aaf9e[_0xa5e4('0xc7')]['Messages']=[];_0x4aaf9e[_0xa5e4('0xc7')][_0xa5e4('0xc6')]['push'](_0x433b09[_0xa5e4('0xc7')]);return _0x4aaf9e;});})[_0xa5e4('0x21')](respondWithResult(_0x4d0020,null))[_0xa5e4('0x2c')](handleError(_0x4d0020,null));};exports['status']=function(_0x84cfaa,_0x48a26c,_0x4f1b2b){if(_0x84cfaa['body']['id']){delete _0x84cfaa['body']['id'];}var _0x162e29,_0x5088f5,_0x3e0f6e;return db[_0xa5e4('0x41')]['find']({'where':{'id':_0x84cfaa[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x48a26c,null))[_0xa5e4('0x21')](function(_0x2569e0){if(_0x2569e0){_0x3e0f6e=_0x2569e0;logger[_0xa5e4('0x24')](_0xa5e4('0x25'),_0xa5e4('0x2e'),_0xa5e4('0xc8'),_0x2569e0[_0xa5e4('0x82')],util['inspect'](_0x84cfaa['body'],{'showHidden':![],'depth':null}));switch(_0x2569e0[_0xa5e4('0x82')]){case'skebby':if(_0x84cfaa[_0xa5e4('0x5b')]['skebby_dispatch_id']&&_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x2e')]){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x2e')];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xc9')]}});}break;case _0xa5e4('0xca'):if(_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xcb')]&&_0x84cfaa['body']['statusInt']){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xcc')];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa['body'][_0xa5e4('0xcb')]}});}break;case _0xa5e4('0x8a'):if(_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x8b')]&&_0x84cfaa['body'][_0xa5e4('0xcd')]){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')]['status_code'];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa['body'][_0xa5e4('0x8b')]}});}break;case _0xa5e4('0x8f'):var _0x48c17f=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x90')][0x0];if(_0x48c17f[_0xa5e4('0x85')]&&_0x48c17f['status']['groupName']===_0xa5e4('0xce')){_0x5088f5=_0x48c17f[_0xa5e4('0x2e')][_0xa5e4('0xcf')];return db[_0xa5e4('0xc5')]['find']({'where':{'messageId':_0x48c17f[_0xa5e4('0x85')]}});}break;case'clickatell':if(_0x84cfaa[_0xa5e4('0x5b')]['messageId']&&_0x84cfaa['body'][_0xa5e4('0x2e')]){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x2e')];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa[_0xa5e4('0x5b')]['messageId']}});}break;case _0xa5e4('0xd0'):if(_0x84cfaa['body'][0x0][_0xa5e4('0x2a')]['id']){_0x5088f5=_0x84cfaa[_0xa5e4('0x5b')][0x0][_0xa5e4('0x82')];return db['SmsMessage'][_0xa5e4('0x59')]({'where':{'messageId':_0x84cfaa[_0xa5e4('0x5b')][0x0][_0xa5e4('0x2a')]['id']}});}break;case _0xa5e4('0x94'):if(_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xd1')]&&_0x84cfaa['body'][_0xa5e4('0x2e')]){_0x5088f5=_0x84cfaa['body'][_0xa5e4('0x2e')];return db[_0xa5e4('0xc5')]['find']({'where':{'messageId':_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0xd1')]}});}break;}}})['then'](handleEntityNotFound(_0x48a26c,null))['then'](function(_0x5511cc){if(_0x5511cc){_0x162e29=_0x5511cc;switch(_0x3e0f6e[_0xa5e4('0x82')]){case'skebby':if(_0x5088f5===_0xa5e4('0xce')){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),_0xa5e4('0x2e'),_0xa5e4('0x87'),util['inspect'](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0xca'):if(_0x5088f5==='1'){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger[_0xa5e4('0x28')](_0xa5e4('0x25'),_0xa5e4('0x2e'),_0xa5e4('0x87'),util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x84cfaa[_0xa5e4('0x5b')]['error_code']&&_0x5088f5>=0xc8&&_0x5088f5<=0xce){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger[_0xa5e4('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa5e4('0x2e'),'clicksend',util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0x8f'):var _0x3083d9=_0x84cfaa[_0xa5e4('0x5b')][_0xa5e4('0x90')][0x0];if(_0x3083d9[_0xa5e4('0x2e')][_0xa5e4('0xcf')]===_0xa5e4('0xce')){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger[_0xa5e4('0x28')](_0xa5e4('0x25'),'status',_0xa5e4('0x8f'),util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0x92'):if(_0x5088f5=='DELIVERED_TO_GATEWAY'||_0x5088f5==_0xa5e4('0xd3')){return _0x162e29['update']({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),_0xa5e4('0x2e'),'clickatell',util[_0xa5e4('0xd2')](_0x84cfaa['body'],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0xd0'):if(_0x5088f5==_0xa5e4('0xd4')){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),'status',_0xa5e4('0xd0'),util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xa5e4('0x94'):if(_0x5088f5==='DELIVRD'||_0x5088f5===_0xa5e4('0xd5')){return _0x162e29[_0xa5e4('0x37')]({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),_0xa5e4('0x2e'),_0xa5e4('0x94'),util[_0xa5e4('0xd2')](_0x84cfaa[_0xa5e4('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x162e29;}})[_0xa5e4('0x21')](respondWithResult(_0x48a26c,null))[_0xa5e4('0x2c')](handleError(_0x48a26c,null));};exports[_0xa5e4('0xd6')]=function(_0x1c22bf,_0x355b00,_0x32a7a0){var _0xb81932,_0x11e06a,_0x483c1c;return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x1c22bf['params']['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x355b00,null))[_0xa5e4('0x21')](function(_0x315ad6){if(_0x315ad6){_0x483c1c=_0x315ad6;logger['debug'](_0xa5e4('0x25'),'status',_0xa5e4('0xc8'),_0x315ad6[_0xa5e4('0x82')],util[_0xa5e4('0xd2')](_0x1c22bf[_0xa5e4('0x46')],{'showHidden':![],'depth':null}));switch(_0x315ad6[_0xa5e4('0x82')]){case'csc':if(_0x1c22bf[_0xa5e4('0x46')][_0xa5e4('0xd7')]&&_0x1c22bf[_0xa5e4('0x46')][_0xa5e4('0xd8')]){_0x11e06a=_0x1c22bf[_0xa5e4('0x46')][_0xa5e4('0xd8')];return db[_0xa5e4('0xc5')][_0xa5e4('0x59')]({'where':{'messageId':_0x1c22bf[_0xa5e4('0x46')][_0xa5e4('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x355b00,null))[_0xa5e4('0x21')](function(_0xf828d5){if(_0xf828d5){_0xb81932=_0xf828d5;switch(_0x483c1c[_0xa5e4('0x82')]){case _0xa5e4('0xd9'):if(_0x11e06a==='2'||_0x11e06a==='6'){return _0xb81932[_0xa5e4('0x37')]({'read':!![]});}else{logger['error'](_0xa5e4('0x25'),'status',_0xa5e4('0xd9'),util[_0xa5e4('0xd2')](_0x1c22bf[_0xa5e4('0x46')],{'showHidden':![],'depth':null}));};break;}return _0xb81932;}})['then'](respondWithResult(_0x355b00,null))[_0xa5e4('0x2c')](handleError(_0x355b00,null));};exports['addAgents']=function(_0x3c1db2,_0x3c1a39,_0x2bff2e){return db[_0xa5e4('0x41')][_0xa5e4('0x59')]({'where':{'id':_0x3c1db2[_0xa5e4('0x58')]['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x3c1a39,null))[_0xa5e4('0x21')](function(_0x4785b0){if(_0x4785b0){return _0x4785b0[_0xa5e4('0xda')](_0x3c1db2[_0xa5e4('0x5b')][_0xa5e4('0x6a')],_[_0xa5e4('0xa0')](_0x3c1db2[_0xa5e4('0x5b')],['ids','id'])||{})['spread'](function(_0x7fae9){for(var _0x157e97=0x0;_0x157e97<_0x3c1db2[_0xa5e4('0x5b')]['ids'][_0xa5e4('0x4b')];_0x157e97+=0x1){socket[_0xa5e4('0xdb')](_0xa5e4('0xdc'),{'UserId':Number(_0x3c1db2[_0xa5e4('0x5b')][_0xa5e4('0x6a')][_0x157e97]),'SmsAccountId':Number(_0x3c1db2[_0xa5e4('0x58')]['id'])});}return _0x7fae9;});}})[_0xa5e4('0x21')](respondWithResult(_0x3c1a39,null))['catch'](handleError(_0x3c1a39,null));};exports['removeAgents']=function(_0x27cc2d,_0x1e4cd6,_0x134f73){return db['SmsAccount'][_0xa5e4('0x59')]({'where':{'id':_0x27cc2d[_0xa5e4('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e4cd6,null))[_0xa5e4('0x21')](function(_0x23e27c){if(_0x23e27c){return _0x23e27c[_0xa5e4('0xdd')](_0x27cc2d[_0xa5e4('0x46')][_0xa5e4('0x6a')])['then'](function(){if(_[_0xa5e4('0xde')](_0x27cc2d[_0xa5e4('0x46')][_0xa5e4('0x6a')])){for(var _0x1394f6=0x0;_0x1394f6<_0x27cc2d[_0xa5e4('0x46')][_0xa5e4('0x6a')][_0xa5e4('0x4b')];_0x1394f6+=0x1){socket[_0xa5e4('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x27cc2d[_0xa5e4('0x46')]['ids'][_0x1394f6]),'SmsAccountId':Number(_0x27cc2d[_0xa5e4('0x58')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x27cc2d['query'][_0xa5e4('0x6a')]),'SmsAccountId':Number(_0x27cc2d[_0xa5e4('0x58')]['id'])});}});}})[_0xa5e4('0x21')](respondWithStatusCode(_0x1e4cd6,null))[_0xa5e4('0x2c')](handleError(_0x1e4cd6,null));};exports[_0xa5e4('0xdf')]=function(_0x22bc25,_0x2c27e0,_0x8b29e4){var _0x27a49a={};var _0x405884={};var _0x43f44f;var _0x15166f;return db[_0xa5e4('0x41')][_0xa5e4('0x6e')]({'where':{'id':_0x22bc25['params']['id']}})[_0xa5e4('0x21')](handleEntityNotFound(_0x2c27e0,null))[_0xa5e4('0x21')](function(_0x3ee028){if(_0x3ee028){_0x43f44f=_0x3ee028;_0x405884[_0xa5e4('0x45')]=_['keys'](db[_0xa5e4('0xbb')][_0xa5e4('0x42')]);_0x405884[_0xa5e4('0x46')]=_[_0xa5e4('0x47')](_0x22bc25[_0xa5e4('0x46')]);_0x405884[_0xa5e4('0x50')]=_['intersection'](_0x405884[_0xa5e4('0x45')],_0x405884[_0xa5e4('0x46')]);_0x27a49a[_0xa5e4('0x48')]=_[_0xa5e4('0x49')](_0x405884[_0xa5e4('0x45')],qs['fields'](_0x22bc25[_0xa5e4('0x46')][_0xa5e4('0x4a')]));_0x27a49a['attributes']=_0x27a49a['attributes'][_0xa5e4('0x4b')]?_0x27a49a[_0xa5e4('0x48')]:_0x405884['model'];_0x27a49a[_0xa5e4('0x4e')]=qs[_0xa5e4('0x4f')](_0x22bc25[_0xa5e4('0x46')]['sort']);_0x27a49a['where']=qs[_0xa5e4('0x50')](_[_0xa5e4('0x6f')](_0x22bc25[_0xa5e4('0x46')],_0x405884['filters']));if(_0x22bc25['query']['filter']){_0x27a49a['where']=_[_0xa5e4('0x54')](_0x27a49a['where'],{'$or':_['map'](_0x27a49a[_0xa5e4('0x48')],function(_0x302e5f){var _0x5176f2={};_0x5176f2[_0x302e5f]={'$like':'%'+_0x22bc25[_0xa5e4('0x46')][_0xa5e4('0x51')]+'%'};return _0x5176f2;})});}_0x27a49a=_['merge']({},_0x27a49a,_0x22bc25[_0xa5e4('0x55')]);return _0x43f44f[_0xa5e4('0xdf')](_0x27a49a);}})[_0xa5e4('0x21')](function(_0xe1ffe4){if(_0xe1ffe4){_0x15166f=_0xe1ffe4[_0xa5e4('0x4b')];if(!_0x22bc25['query'][_0xa5e4('0x4c')](_0xa5e4('0x4d'))){_0x27a49a[_0xa5e4('0x32')]=qs[_0xa5e4('0x32')](_0x22bc25[_0xa5e4('0x46')][_0xa5e4('0x32')]);_0x27a49a[_0xa5e4('0x31')]=qs[_0xa5e4('0x31')](_0x22bc25[_0xa5e4('0x46')][_0xa5e4('0x31')]);}return _0x43f44f[_0xa5e4('0xdf')](_0x27a49a);}})[_0xa5e4('0x21')](function(_0x227246){if(_0x227246){return _0x227246?{'count':_0x15166f,'rows':_0x227246}:null;}})[_0xa5e4('0x21')](respondWithResult(_0x2c27e0,null))['catch'](handleError(_0x2c27e0,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 41e9e6e..d1a057e 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 _0x3e65=['hook','exports','events','setMaxListeners','update','remove','emit'];(function(_0x3c63b3,_0x5668c2){var _0x27236d=function(_0x3c2cec){while(--_0x3c2cec){_0x3c63b3['push'](_0x3c63b3['shift']());}};_0x27236d(++_0x5668c2);}(_0x3e65,0xd4));var _0x53e6=function(_0x3331b5,_0x285533){_0x3331b5=_0x3331b5-0x0;var _0x3c1a5b=_0x3e65[_0x3331b5];return _0x3c1a5b;};'use strict';var EventEmitter=require(_0x53e6('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x53e6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x53e6('0x2'),'afterDestroy':_0x53e6('0x3')};function emitEvent(_0x5653a6){return function(_0x5e842c,_0x167385,_0x589498){SmsAccountEvents[_0x53e6('0x4')](_0x5653a6+':'+_0x5e842c['id'],_0x5e842c);SmsAccountEvents[_0x53e6('0x4')](_0x5653a6,_0x5e842c);_0x589498(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x53e6('0x5')](e,emitEvent(event));}}module[_0x53e6('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xe12f=['../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4951d0,_0x5cad88){var _0x164fe3=function(_0x4dea28){while(--_0x4dea28){_0x4951d0['push'](_0x4951d0['shift']());}};_0x164fe3(++_0x5cad88);}(_0xe12f,0x99));var _0xfe12=function(_0x275251,_0x3f0c78){_0x275251=_0x275251-0x0;var _0x195d5e=_0xe12f[_0x275251];return _0x195d5e;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xfe12('0x0'))['db'][_0xfe12('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfe12('0x2')](0x0);var events={'afterCreate':_0xfe12('0x3'),'afterUpdate':_0xfe12('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c70b7){return function(_0x1abb08,_0x4ad402,_0xa99418){SmsAccountEvents[_0xfe12('0x5')](_0x1c70b7+':'+_0x1abb08['id'],_0x1abb08);SmsAccountEvents[_0xfe12('0x5')](_0x1c70b7,_0x1abb08);_0xa99418(null);};}for(var e in events){if(events[_0xfe12('0x6')](e)){var event=events[e];SmsAccount[_0xfe12('0x7')](e,emitEvent(event));}}module[_0xfe12('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f0242d8..34880ae 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 _0x5af7=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x5af7,0x6b));var _0x75af=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x5af7[_0x172747];return _0x509692;};'use strict';var _=require(_0x75af('0x0'));var util=require('util');var logger=require(_0x75af('0x1'))(_0x75af('0x2'));var moment=require(_0x75af('0x3'));var BPromise=require(_0x75af('0x4'));var rp=require(_0x75af('0x5'));var fs=require('fs');var path=require(_0x75af('0x6'));var rimraf=require('rimraf');var config=require(_0x75af('0x7'));var attributes=require(_0x75af('0x8'));module['exports']=function(_0x423e25,_0x46edb8){return _0x423e25[_0x75af('0x9')](_0x75af('0xa'),attributes,{'tableName':_0x75af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','moment','bluebird','path','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','util'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xdace,0x9f));var _0xedac=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xdace[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require('lodash');var util=require(_0xedac('0x0'));var logger=require(_0xedac('0x1'))('api');var moment=require(_0xedac('0x2'));var BPromise=require(_0xedac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedac('0x4'));var rimraf=require('rimraf');var config=require(_0xedac('0x5'));var attributes=require(_0xedac('0x6'));module[_0xedac('0x7')]=function(_0x1bab6d,_0x4a2296){return _0x1bab6d[_0xedac('0x8')]('SmsAccount',attributes,{'tableName':_0xedac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index ff36257..f47d008 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 _0xa0e2=['error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5578a3,_0x304ac0){var _0x331ec3=function(_0x22c7be){while(--_0x22c7be){_0x5578a3['push'](_0x5578a3['shift']());}};_0x331ec3(++_0x304ac0);}(_0xa0e2,0xc9));var _0x2a0e=function(_0x4b6e95,_0x50a4e9){_0x4b6e95=_0x4b6e95-0x0;var _0x1962f2=_0xa0e2[_0x4b6e95];return _0x1962f2;};'use strict';var _=require(_0x2a0e('0x0'));var util=require('util');var moment=require(_0x2a0e('0x1'));var BPromise=require(_0x2a0e('0x2'));var rs=require(_0x2a0e('0x3'));var fs=require('fs');var Redis=require(_0x2a0e('0x4'));var db=require(_0x2a0e('0x5'))['db'];var utils=require(_0x2a0e('0x6'));var logger=require(_0x2a0e('0x7'))(_0x2a0e('0x8'));var config=require(_0x2a0e('0x9'));var jayson=require(_0x2a0e('0xa'));var client=jayson[_0x2a0e('0xb')]['http']({'port':0x232a});config[_0x2a0e('0xc')]=_['defaults'](config[_0x2a0e('0xc')],{'host':_0x2a0e('0xd'),'port':0x18eb});var socket=require(_0x2a0e('0xe'))(new Redis(config['redis']));require(_0x2a0e('0xf'))[_0x2a0e('0x10')](socket);function respondWithRpcPromise(_0x4eb755,_0x202282,_0x3fc7c9){return new BPromise(function(_0x5b38fd,_0x15f6ba){return client['request'](_0x4eb755,_0x3fc7c9)[_0x2a0e('0x11')](function(_0x1a880a){logger['info'](_0x2a0e('0x12'),_0x202282,_0x2a0e('0x13'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x202282,_0x2a0e('0x13'),JSON[_0x2a0e('0x14')](_0x1a880a));if(_0x1a880a['error']){if(_0x1a880a[_0x2a0e('0x15')][_0x2a0e('0x16')]===0x1f4){logger[_0x2a0e('0x15')](_0x2a0e('0x12'),_0x202282,_0x1a880a[_0x2a0e('0x15')][_0x2a0e('0x17')]);return _0x15f6ba(_0x1a880a[_0x2a0e('0x15')]['message']);}logger[_0x2a0e('0x15')]('SmsAccount,\x20%s,\x20%s',_0x202282,_0x1a880a[_0x2a0e('0x15')][_0x2a0e('0x17')]);return _0x5b38fd(_0x1a880a[_0x2a0e('0x15')][_0x2a0e('0x17')]);}else{logger['info'](_0x2a0e('0x12'),_0x202282,_0x2a0e('0x13'));_0x5b38fd(_0x1a880a[_0x2a0e('0x18')][_0x2a0e('0x17')]);}})[_0x2a0e('0x19')](function(_0x32de89){logger[_0x2a0e('0x15')](_0x2a0e('0x12'),_0x202282,_0x32de89);_0x15f6ba(_0x32de89);});});}exports[_0x2a0e('0x1a')]=function(_0x535a2a){var _0x479cc1=this;return new Promise(function(_0x18fdb5,_0x4d7518){return db[_0x2a0e('0x1b')][_0x2a0e('0x1c')]({'raw':_0x535a2a[_0x2a0e('0x1d')]?_0x535a2a[_0x2a0e('0x1d')][_0x2a0e('0x1e')]===undefined?!![]:![]:!![],'where':_0x535a2a[_0x2a0e('0x1d')]?_0x535a2a[_0x2a0e('0x1d')][_0x2a0e('0x1f')]||null:null,'attributes':_0x535a2a['options']?_0x535a2a[_0x2a0e('0x1d')][_0x2a0e('0x20')]||null:null,'include':_0x535a2a['options']?_0x535a2a[_0x2a0e('0x1d')][_0x2a0e('0x21')]?_[_0x2a0e('0x22')](_0x535a2a[_0x2a0e('0x1d')]['include'],function(_0x5caa03){return{'model':db[_0x5caa03['model']],'as':_0x5caa03['as'],'attributes':_0x5caa03[_0x2a0e('0x20')],'include':_0x5caa03[_0x2a0e('0x21')]?_[_0x2a0e('0x22')](_0x5caa03[_0x2a0e('0x21')],function(_0x4c75f8){return{'model':db[_0x4c75f8[_0x2a0e('0x23')]],'as':_0x4c75f8['as'],'attributes':_0x4c75f8[_0x2a0e('0x20')],'include':_0x4c75f8[_0x2a0e('0x21')]?_[_0x2a0e('0x22')](_0x4c75f8[_0x2a0e('0x21')],function(_0x27dce5){return{'model':db[_0x27dce5[_0x2a0e('0x23')]],'as':_0x27dce5['as'],'attributes':_0x27dce5[_0x2a0e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ae780){logger[_0x2a0e('0x24')](_0x2a0e('0x1a'),_0x535a2a);logger['debug'](_0x2a0e('0x1a'),_0x535a2a,JSON['stringify'](_0x1ae780));_0x18fdb5(_0x1ae780);})[_0x2a0e('0x19')](function(_0x4cc9dd){logger[_0x2a0e('0x15')](_0x2a0e('0x1a'),_0x4cc9dd[_0x2a0e('0x17')],_0x535a2a);_0x4d7518(_0x479cc1[_0x2a0e('0x15')](0x1f4,_0x4cc9dd[_0x2a0e('0x17')]));});});}; \ No newline at end of file +var _0x9ba4=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','then'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9ba4,0x170));var _0x49ba=function(_0x5a0074,_0x2d589){_0x5a0074=_0x5a0074-0x0;var _0x22efb4=_0x9ba4[_0x5a0074];return _0x22efb4;};'use strict';var _=require(_0x49ba('0x0'));var util=require(_0x49ba('0x1'));var moment=require('moment');var BPromise=require(_0x49ba('0x2'));var rs=require(_0x49ba('0x3'));var fs=require('fs');var Redis=require(_0x49ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x49ba('0x5'));var logger=require('../../config/logger')(_0x49ba('0x6'));var config=require(_0x49ba('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x49ba('0x8')][_0x49ba('0x9')]({'port':0x232a});config['redis']=_[_0x49ba('0xa')](config['redis'],{'host':_0x49ba('0xb'),'port':0x18eb});var socket=require(_0x49ba('0xc'))(new Redis(config[_0x49ba('0xd')]));require(_0x49ba('0xe'))[_0x49ba('0xf')](socket);function respondWithRpcPromise(_0x1e5b14,_0x3c2f31,_0x43b4af){return new BPromise(function(_0x499d6b,_0x71db7c){return client['request'](_0x1e5b14,_0x43b4af)[_0x49ba('0x10')](function(_0x4d5fc6){logger[_0x49ba('0x11')](_0x49ba('0x12'),_0x3c2f31,_0x49ba('0x13'));logger[_0x49ba('0x14')](_0x49ba('0x15'),_0x3c2f31,_0x49ba('0x13'),JSON[_0x49ba('0x16')](_0x4d5fc6));if(_0x4d5fc6['error']){if(_0x4d5fc6[_0x49ba('0x17')][_0x49ba('0x18')]===0x1f4){logger[_0x49ba('0x17')](_0x49ba('0x12'),_0x3c2f31,_0x4d5fc6[_0x49ba('0x17')][_0x49ba('0x19')]);return _0x71db7c(_0x4d5fc6[_0x49ba('0x17')][_0x49ba('0x19')]);}logger[_0x49ba('0x17')](_0x49ba('0x12'),_0x3c2f31,_0x4d5fc6['error'][_0x49ba('0x19')]);return _0x499d6b(_0x4d5fc6['error'][_0x49ba('0x19')]);}else{logger[_0x49ba('0x11')](_0x49ba('0x12'),_0x3c2f31,'request\x20sent');_0x499d6b(_0x4d5fc6[_0x49ba('0x1a')][_0x49ba('0x19')]);}})['catch'](function(_0x21c7d5){logger[_0x49ba('0x17')](_0x49ba('0x12'),_0x3c2f31,_0x21c7d5);_0x71db7c(_0x21c7d5);});});}exports[_0x49ba('0x1b')]=function(_0x1df15b){var _0x2651c4=this;return new Promise(function(_0x437915,_0x353d0d){return db[_0x49ba('0x1c')][_0x49ba('0x1d')]({'raw':_0x1df15b[_0x49ba('0x1e')]?_0x1df15b[_0x49ba('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1df15b['options']?_0x1df15b[_0x49ba('0x1e')]['where']||null:null,'attributes':_0x1df15b[_0x49ba('0x1e')]?_0x1df15b[_0x49ba('0x1e')]['attributes']||null:null,'include':_0x1df15b[_0x49ba('0x1e')]?_0x1df15b['options'][_0x49ba('0x1f')]?_[_0x49ba('0x20')](_0x1df15b['options'][_0x49ba('0x1f')],function(_0x49d94c){return{'model':db[_0x49d94c[_0x49ba('0x21')]],'as':_0x49d94c['as'],'attributes':_0x49d94c[_0x49ba('0x22')],'include':_0x49d94c[_0x49ba('0x1f')]?_['map'](_0x49d94c['include'],function(_0x2be8f8){return{'model':db[_0x2be8f8['model']],'as':_0x2be8f8['as'],'attributes':_0x2be8f8[_0x49ba('0x22')],'include':_0x2be8f8[_0x49ba('0x1f')]?_[_0x49ba('0x20')](_0x2be8f8[_0x49ba('0x1f')],function(_0xa94bb1){return{'model':db[_0xa94bb1[_0x49ba('0x21')]],'as':_0xa94bb1['as'],'attributes':_0xa94bb1[_0x49ba('0x22')]};}):[]};}):[]};}):[]:[]})[_0x49ba('0x10')](function(_0x3f1b3b){logger[_0x49ba('0x11')](_0x49ba('0x1b'),_0x1df15b);logger[_0x49ba('0x14')](_0x49ba('0x1b'),_0x1df15b,JSON['stringify'](_0x3f1b3b));_0x437915(_0x3f1b3b);})['catch'](function(_0x2448c1){logger[_0x49ba('0x17')](_0x49ba('0x1b'),_0x2448c1[_0x49ba('0x19')],_0x1df15b);_0x353d0d(_0x2651c4[_0x49ba('0x17')](0x1f4,_0x2448c1[_0x49ba('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 88f8b7d..982b212 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 42a3c8a..631d167 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index e90cc73..0c5bb38 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 _0x4316=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x46679c,_0x103fae){var _0x401125=function(_0x2d5206){while(--_0x2d5206){_0x46679c['push'](_0x46679c['shift']());}};_0x401125(++_0x103fae);}(_0x4316,0x125));var _0x6431=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4316[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6431('0x0'));module[_0x6431('0x1')]={'priority':{'type':Sequelize[_0x6431('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6431('0x3')},'appdata':{'type':Sequelize[_0x6431('0x4')]()},'description':{'type':Sequelize[_0x6431('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6431('0x6')}}; \ No newline at end of file +var _0x55b5=['INTEGER','noop','STRING','exports'];(function(_0x52284f,_0xb0b798){var _0x2a5563=function(_0x364aac){while(--_0x364aac){_0x52284f['push'](_0x52284f['shift']());}};_0x2a5563(++_0xb0b798);}(_0x55b5,0x1c7));var _0x555b=function(_0x20034c,_0x20e668){_0x20034c=_0x20034c-0x0;var _0x45a0dc=_0x55b5[_0x20034c];return _0x45a0dc;};'use strict';var Sequelize=require('sequelize');module[_0x555b('0x0')]={'priority':{'type':Sequelize[_0x555b('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x555b('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x555b('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index f85b2c3..85872bd 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 _0xb04b=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsApplication','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update','eml-format','request-promise','moment','bluebird','mustache','fs-extra','lodash','squel'];(function(_0x25693b,_0x2dbff5){var _0x201337=function(_0x5a1d85){while(--_0x5a1d85){_0x25693b['push'](_0x25693b['shift']());}};_0x201337(++_0x2dbff5);}(_0xb04b,0x16a));var _0xbb04=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb04b[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xbb04('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb04('0x1'));var moment=require(_0xbb04('0x2'));var BPromise=require(_0xbb04('0x3'));var Mustache=require(_0xbb04('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb04('0x5'));var _=require(_0xbb04('0x6'));var squel=require(_0xbb04('0x7'));var crypto=require(_0xbb04('0x8'));var jsforce=require(_0xbb04('0x9'));var deskjs=require(_0xbb04('0xa'));var toCsv=require(_0xbb04('0xb'));var querystring=require(_0xbb04('0xc'));var Papa=require(_0xbb04('0xd'));var Redis=require(_0xbb04('0xe'));var authService=require(_0xbb04('0xf'));var qs=require(_0xbb04('0x10'));var as=require(_0xbb04('0x11'));var hardwareService=require(_0xbb04('0x12'));var logger=require('../../config/logger')(_0xbb04('0x13'));var utils=require(_0xbb04('0x14'));var config=require(_0xbb04('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb04('0x16'))['db'];function respondWithStatusCode(_0x5b975f,_0x409818){_0x409818=_0x409818||0xcc;return function(_0x3f7c31){if(_0x3f7c31){return _0x5b975f[_0xbb04('0x17')](_0x409818);}return _0x5b975f[_0xbb04('0x18')](_0x409818)[_0xbb04('0x19')]();};}function respondWithResult(_0x2362be,_0x58f480){_0x58f480=_0x58f480||0xc8;return function(_0x5c701b){if(_0x5c701b){return _0x2362be[_0xbb04('0x18')](_0x58f480)[_0xbb04('0x1a')](_0x5c701b);}};}function respondWithFilteredResult(_0x16468d,_0x2b7e8a){return function(_0x3b7b93){if(_0x3b7b93){var _0x55826b=typeof _0x2b7e8a[_0xbb04('0x1b')]===_0xbb04('0x1c')&&typeof _0x2b7e8a['limit']===_0xbb04('0x1c');var _0x3af821=_0x3b7b93['count'];var _0x21d3af=_0x55826b?0x0:_0x2b7e8a[_0xbb04('0x1b')];var _0x330c0e=_0x55826b?_0x3b7b93[_0xbb04('0x1d')]:_0x2b7e8a[_0xbb04('0x1b')]+_0x2b7e8a[_0xbb04('0x1e')];var _0x528156;if(_0x330c0e>=_0x3af821){_0x330c0e=_0x3af821;_0x528156=0xc8;}else{_0x528156=0xce;}_0x16468d[_0xbb04('0x18')](_0x528156);return _0x16468d['set']('Content-Range',_0x21d3af+'-'+_0x330c0e+'/'+_0x3af821)[_0xbb04('0x1a')](_0x3b7b93);}return null;};}function patchUpdates(_0x234d2c){return function(_0x4fdd6c){try{jsonpatch[_0xbb04('0x1f')](_0x4fdd6c,_0x234d2c,!![]);}catch(_0x290bdd){return BPromise[_0xbb04('0x20')](_0x290bdd);}return _0x4fdd6c[_0xbb04('0x21')]();};}function saveUpdates(_0x122cc9,_0x533531){return function(_0x333edd){if(_0x333edd){return _0x333edd['update'](_0x122cc9)[_0xbb04('0x22')](function(_0x593b5c){return _0x593b5c;});}return null;};}function removeEntity(_0x232cc0,_0x2dc96e){return function(_0x53d9ac){if(_0x53d9ac){return _0x53d9ac[_0xbb04('0x23')]()[_0xbb04('0x22')](function(){_0x232cc0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32046c,_0x5e5227){return function(_0x34ddd9){if(!_0x34ddd9){_0x32046c[_0xbb04('0x17')](0x194);}return _0x34ddd9;};}function handleError(_0xe9ee38,_0x2b03cc){_0x2b03cc=_0x2b03cc||0x1f4;return function(_0x32c027){logger[_0xbb04('0x24')](_0x32c027[_0xbb04('0x25')]);if(_0x32c027[_0xbb04('0x26')]){delete _0x32c027[_0xbb04('0x26')];}_0xe9ee38[_0xbb04('0x18')](_0x2b03cc)[_0xbb04('0x27')](_0x32c027);};}exports[_0xbb04('0x28')]=function(_0x3f1105,_0x5c5f21){var _0x108d16={},_0x325353={},_0x590a06={'count':0x0,'rows':[]};var _0x10d8ff=_[_0xbb04('0x29')](db[_0xbb04('0x2a')]['rawAttributes'],function(_0x35a826){return{'name':_0x35a826[_0xbb04('0x2b')],'type':_0x35a826[_0xbb04('0x2c')][_0xbb04('0x2d')]};});_0x325353['model']=_['map'](_0x10d8ff,_0xbb04('0x26'));_0x325353[_0xbb04('0x2e')]=_[_0xbb04('0x2f')](_0x3f1105[_0xbb04('0x2e')]);_0x325353['filters']=_[_0xbb04('0x30')](_0x325353[_0xbb04('0x31')],_0x325353['query']);_0x108d16['attributes']=_[_0xbb04('0x30')](_0x325353[_0xbb04('0x31')],qs[_0xbb04('0x32')](_0x3f1105[_0xbb04('0x2e')][_0xbb04('0x32')]));_0x108d16[_0xbb04('0x33')]=_0x108d16[_0xbb04('0x33')][_0xbb04('0x34')]?_0x108d16[_0xbb04('0x33')]:_0x325353[_0xbb04('0x31')];if(!_0x3f1105[_0xbb04('0x2e')][_0xbb04('0x35')](_0xbb04('0x36'))){_0x108d16['limit']=qs[_0xbb04('0x1e')](_0x3f1105[_0xbb04('0x2e')]['limit']);_0x108d16[_0xbb04('0x1b')]=qs[_0xbb04('0x1b')](_0x3f1105[_0xbb04('0x2e')][_0xbb04('0x1b')]);}_0x108d16[_0xbb04('0x37')]=qs[_0xbb04('0x38')](_0x3f1105[_0xbb04('0x2e')]['sort']);_0x108d16['where']=qs[_0xbb04('0x39')](_['pick'](_0x3f1105['query'],_0x325353[_0xbb04('0x39')]),_0x10d8ff);if(_0x3f1105[_0xbb04('0x2e')][_0xbb04('0x3a')]){_0x108d16[_0xbb04('0x3b')]=_[_0xbb04('0x3c')](_0x108d16['where'],{'$or':_[_0xbb04('0x29')](_0x10d8ff,function(_0x73c1b7){if(_0x73c1b7['type']!==_0xbb04('0x3d')){var _0x156914={};_0x156914[_0x73c1b7[_0xbb04('0x26')]]={'$like':'%'+_0x3f1105[_0xbb04('0x2e')][_0xbb04('0x3a')]+'%'};return _0x156914;}})});}_0x108d16=_[_0xbb04('0x3c')]({},_0x108d16,_0x3f1105[_0xbb04('0x3e')]);var _0x423502={'where':_0x108d16[_0xbb04('0x3b')]};return db[_0xbb04('0x2a')]['count'](_0x423502)[_0xbb04('0x22')](function(_0x155cd9){_0x590a06[_0xbb04('0x1d')]=_0x155cd9;if(_0x3f1105[_0xbb04('0x2e')][_0xbb04('0x3f')]){_0x108d16[_0xbb04('0x40')]=[{'all':!![]}];}return db[_0xbb04('0x2a')][_0xbb04('0x41')](_0x108d16);})['then'](function(_0x33ff14){_0x590a06[_0xbb04('0x42')]=_0x33ff14;return _0x590a06;})[_0xbb04('0x22')](respondWithFilteredResult(_0x5c5f21,_0x108d16))[_0xbb04('0x43')](handleError(_0x5c5f21,null));};exports['show']=function(_0x26cfac,_0x43aea8){var _0x2b1767={'raw':!![],'where':{'id':_0x26cfac[_0xbb04('0x44')]['id']}},_0x3d5c40={};_0x3d5c40['model']=_[_0xbb04('0x2f')](db[_0xbb04('0x2a')][_0xbb04('0x45')]);_0x3d5c40[_0xbb04('0x2e')]=_[_0xbb04('0x2f')](_0x26cfac[_0xbb04('0x2e')]);_0x3d5c40['filters']=_[_0xbb04('0x30')](_0x3d5c40[_0xbb04('0x31')],_0x3d5c40[_0xbb04('0x2e')]);_0x2b1767[_0xbb04('0x33')]=_[_0xbb04('0x30')](_0x3d5c40[_0xbb04('0x31')],qs[_0xbb04('0x32')](_0x26cfac['query'][_0xbb04('0x32')]));_0x2b1767[_0xbb04('0x33')]=_0x2b1767[_0xbb04('0x33')][_0xbb04('0x34')]?_0x2b1767[_0xbb04('0x33')]:_0x3d5c40[_0xbb04('0x31')];if(_0x26cfac['query'][_0xbb04('0x3f')]){_0x2b1767[_0xbb04('0x40')]=[{'all':!![]}];}_0x2b1767=_[_0xbb04('0x3c')]({},_0x2b1767,_0x26cfac[_0xbb04('0x3e')]);return db[_0xbb04('0x2a')][_0xbb04('0x46')](_0x2b1767)[_0xbb04('0x22')](handleEntityNotFound(_0x43aea8,null))[_0xbb04('0x22')](respondWithResult(_0x43aea8,null))[_0xbb04('0x43')](handleError(_0x43aea8,null));};exports[_0xbb04('0x47')]=function(_0x1074c2,_0x169967){return db[_0xbb04('0x2a')]['create'](_0x1074c2[_0xbb04('0x48')],{})[_0xbb04('0x22')](respondWithResult(_0x169967,0xc9))[_0xbb04('0x43')](handleError(_0x169967,null));};exports[_0xbb04('0x49')]=function(_0x2812a8,_0xb0e8ec){if(_0x2812a8[_0xbb04('0x48')]['id']){delete _0x2812a8['body']['id'];}return db[_0xbb04('0x2a')][_0xbb04('0x46')]({'where':{'id':_0x2812a8[_0xbb04('0x44')]['id']}})[_0xbb04('0x22')](handleEntityNotFound(_0xb0e8ec,null))[_0xbb04('0x22')](saveUpdates(_0x2812a8['body'],null))[_0xbb04('0x22')](respondWithResult(_0xb0e8ec,null))[_0xbb04('0x43')](handleError(_0xb0e8ec,null));};exports[_0xbb04('0x23')]=function(_0x20e70d,_0xdaccbb){return db[_0xbb04('0x2a')][_0xbb04('0x46')]({'where':{'id':_0x20e70d['params']['id']}})[_0xbb04('0x22')](handleEntityNotFound(_0xdaccbb,null))[_0xbb04('0x22')](removeEntity(_0xdaccbb,null))['catch'](handleError(_0xdaccbb,null));}; \ No newline at end of file +var _0xae7b=['include','findAll','rows','show','params','length','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','SmsApplication','includeAll'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0xae7b,0x15a));var _0xbae7=function(_0x3bb46a,_0x4d3a51){_0x3bb46a=_0x3bb46a-0x0;var _0xf30f8f=_0xae7b[_0x3bb46a];return _0xf30f8f;};'use strict';var emlformat=require(_0xbae7('0x0'));var rimraf=require(_0xbae7('0x1'));var zipdir=require(_0xbae7('0x2'));var jsonpatch=require(_0xbae7('0x3'));var rp=require('request-promise');var moment=require(_0xbae7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbae7('0x5'));var sox=require(_0xbae7('0x6'));var csv=require(_0xbae7('0x7'));var ejs=require(_0xbae7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbae7('0x9'));var squel=require(_0xbae7('0xa'));var crypto=require(_0xbae7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbae7('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbae7('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbae7('0xd'));var as=require(_0xbae7('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbae7('0xf'))(_0xbae7('0x10'));var utils=require(_0xbae7('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50b9e6,_0x35a1c9){_0x35a1c9=_0x35a1c9||0xcc;return function(_0x2d7dfe){if(_0x2d7dfe){return _0x50b9e6[_0xbae7('0x12')](_0x35a1c9);}return _0x50b9e6[_0xbae7('0x13')](_0x35a1c9)[_0xbae7('0x14')]();};}function respondWithResult(_0xe92fbb,_0x302178){_0x302178=_0x302178||0xc8;return function(_0x2c2eef){if(_0x2c2eef){return _0xe92fbb['status'](_0x302178)[_0xbae7('0x15')](_0x2c2eef);}};}function respondWithFilteredResult(_0x170284,_0x155082){return function(_0xa8476a){if(_0xa8476a){var _0x1d1765=typeof _0x155082[_0xbae7('0x16')]===_0xbae7('0x17')&&typeof _0x155082['limit']===_0xbae7('0x17');var _0x250730=_0xa8476a[_0xbae7('0x18')];var _0x52aa69=_0x1d1765?0x0:_0x155082[_0xbae7('0x16')];var _0x59dc93=_0x1d1765?_0xa8476a[_0xbae7('0x18')]:_0x155082[_0xbae7('0x16')]+_0x155082[_0xbae7('0x19')];var _0x4900da;if(_0x59dc93>=_0x250730){_0x59dc93=_0x250730;_0x4900da=0xc8;}else{_0x4900da=0xce;}_0x170284[_0xbae7('0x13')](_0x4900da);return _0x170284[_0xbae7('0x1a')](_0xbae7('0x1b'),_0x52aa69+'-'+_0x59dc93+'/'+_0x250730)[_0xbae7('0x15')](_0xa8476a);}return null;};}function patchUpdates(_0x27cd0e){return function(_0x409886){try{jsonpatch[_0xbae7('0x1c')](_0x409886,_0x27cd0e,!![]);}catch(_0x130173){return BPromise[_0xbae7('0x1d')](_0x130173);}return _0x409886['save']();};}function saveUpdates(_0x870230,_0x32f97c){return function(_0x250bde){if(_0x250bde){return _0x250bde['update'](_0x870230)[_0xbae7('0x1e')](function(_0x3840f9){return _0x3840f9;});}return null;};}function removeEntity(_0x3431b5,_0x5b0a9f){return function(_0x2a5bee){if(_0x2a5bee){return _0x2a5bee[_0xbae7('0x1f')]()['then'](function(){_0x3431b5[_0xbae7('0x13')](0xcc)[_0xbae7('0x14')]();});}};}function handleEntityNotFound(_0x5745ed,_0x19c453){return function(_0x5ee528){if(!_0x5ee528){_0x5745ed[_0xbae7('0x12')](0x194);}return _0x5ee528;};}function handleError(_0x4d0f10,_0x35f6d9){_0x35f6d9=_0x35f6d9||0x1f4;return function(_0x41ffda){logger[_0xbae7('0x20')](_0x41ffda[_0xbae7('0x21')]);if(_0x41ffda['name']){delete _0x41ffda[_0xbae7('0x22')];}_0x4d0f10['status'](_0x35f6d9)[_0xbae7('0x23')](_0x41ffda);};}exports['index']=function(_0x3f77c7,_0x4471c9){var _0x4617dd={},_0x59197e={},_0x37b51e={'count':0x0,'rows':[]};var _0xec2053=_[_0xbae7('0x24')](db['SmsApplication'][_0xbae7('0x25')],function(_0x41930a){return{'name':_0x41930a[_0xbae7('0x26')],'type':_0x41930a['type'][_0xbae7('0x27')]};});_0x59197e[_0xbae7('0x28')]=_[_0xbae7('0x24')](_0xec2053,_0xbae7('0x22'));_0x59197e[_0xbae7('0x29')]=_[_0xbae7('0x2a')](_0x3f77c7[_0xbae7('0x29')]);_0x59197e[_0xbae7('0x2b')]=_[_0xbae7('0x2c')](_0x59197e[_0xbae7('0x28')],_0x59197e[_0xbae7('0x29')]);_0x4617dd[_0xbae7('0x2d')]=_[_0xbae7('0x2c')](_0x59197e['model'],qs[_0xbae7('0x2e')](_0x3f77c7['query'][_0xbae7('0x2e')]));_0x4617dd[_0xbae7('0x2d')]=_0x4617dd[_0xbae7('0x2d')]['length']?_0x4617dd['attributes']:_0x59197e['model'];if(!_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x2f')]('nolimit')){_0x4617dd[_0xbae7('0x19')]=qs[_0xbae7('0x19')](_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x19')]);_0x4617dd[_0xbae7('0x16')]=qs[_0xbae7('0x16')](_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x16')]);}_0x4617dd['order']=qs['sort'](_0x3f77c7[_0xbae7('0x29')]['sort']);_0x4617dd[_0xbae7('0x30')]=qs[_0xbae7('0x2b')](_[_0xbae7('0x31')](_0x3f77c7[_0xbae7('0x29')],_0x59197e[_0xbae7('0x2b')]),_0xec2053);if(_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x32')]){_0x4617dd['where']=_[_0xbae7('0x33')](_0x4617dd[_0xbae7('0x30')],{'$or':_[_0xbae7('0x24')](_0xec2053,function(_0x58ef2e){if(_0x58ef2e[_0xbae7('0x34')]!==_0xbae7('0x35')){var _0x106e09={};_0x106e09[_0x58ef2e['name']]={'$like':'%'+_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x32')]+'%'};return _0x106e09;}})});}_0x4617dd=_[_0xbae7('0x33')]({},_0x4617dd,_0x3f77c7['options']);var _0x4e7e89={'where':_0x4617dd['where']};return db[_0xbae7('0x36')]['count'](_0x4e7e89)[_0xbae7('0x1e')](function(_0x2667de){_0x37b51e['count']=_0x2667de;if(_0x3f77c7[_0xbae7('0x29')][_0xbae7('0x37')]){_0x4617dd[_0xbae7('0x38')]=[{'all':!![]}];}return db[_0xbae7('0x36')][_0xbae7('0x39')](_0x4617dd);})[_0xbae7('0x1e')](function(_0x29050d){_0x37b51e[_0xbae7('0x3a')]=_0x29050d;return _0x37b51e;})[_0xbae7('0x1e')](respondWithFilteredResult(_0x4471c9,_0x4617dd))['catch'](handleError(_0x4471c9,null));};exports[_0xbae7('0x3b')]=function(_0x208009,_0x5a11b6){var _0x12d270={'raw':!![],'where':{'id':_0x208009[_0xbae7('0x3c')]['id']}},_0x2e04bf={};_0x2e04bf['model']=_[_0xbae7('0x2a')](db[_0xbae7('0x36')]['rawAttributes']);_0x2e04bf['query']=_[_0xbae7('0x2a')](_0x208009[_0xbae7('0x29')]);_0x2e04bf[_0xbae7('0x2b')]=_[_0xbae7('0x2c')](_0x2e04bf['model'],_0x2e04bf[_0xbae7('0x29')]);_0x12d270[_0xbae7('0x2d')]=_['intersection'](_0x2e04bf['model'],qs[_0xbae7('0x2e')](_0x208009[_0xbae7('0x29')][_0xbae7('0x2e')]));_0x12d270[_0xbae7('0x2d')]=_0x12d270['attributes'][_0xbae7('0x3d')]?_0x12d270[_0xbae7('0x2d')]:_0x2e04bf[_0xbae7('0x28')];if(_0x208009[_0xbae7('0x29')]['includeAll']){_0x12d270[_0xbae7('0x38')]=[{'all':!![]}];}_0x12d270=_[_0xbae7('0x33')]({},_0x12d270,_0x208009[_0xbae7('0x3e')]);return db['SmsApplication'][_0xbae7('0x3f')](_0x12d270)[_0xbae7('0x1e')](handleEntityNotFound(_0x5a11b6,null))['then'](respondWithResult(_0x5a11b6,null))[_0xbae7('0x40')](handleError(_0x5a11b6,null));};exports[_0xbae7('0x41')]=function(_0x2bb799,_0x369bca){return db[_0xbae7('0x36')][_0xbae7('0x41')](_0x2bb799[_0xbae7('0x42')],{})[_0xbae7('0x1e')](respondWithResult(_0x369bca,0xc9))['catch'](handleError(_0x369bca,null));};exports['update']=function(_0x54d2fc,_0x542805){if(_0x54d2fc[_0xbae7('0x42')]['id']){delete _0x54d2fc['body']['id'];}return db[_0xbae7('0x36')]['find']({'where':{'id':_0x54d2fc[_0xbae7('0x3c')]['id']}})['then'](handleEntityNotFound(_0x542805,null))['then'](saveUpdates(_0x54d2fc[_0xbae7('0x42')],null))['then'](respondWithResult(_0x542805,null))['catch'](handleError(_0x542805,null));};exports[_0xbae7('0x1f')]=function(_0x464848,_0x5b7c4f){return db[_0xbae7('0x36')][_0xbae7('0x3f')]({'where':{'id':_0x464848[_0xbae7('0x3c')]['id']}})[_0xbae7('0x1e')](handleEntityNotFound(_0x5b7c4f,null))[_0xbae7('0x1e')](removeEntity(_0x5b7c4f,null))[_0xbae7('0x40')](handleError(_0x5b7c4f,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 00bd8ed..7e2babc 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 _0xf2cf=['api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x24ba87,_0x243064){var _0x3988ed=function(_0x41a504){while(--_0x41a504){_0x24ba87['push'](_0x24ba87['shift']());}};_0x3988ed(++_0x243064);}(_0xf2cf,0xf5));var _0xff2c=function(_0x359f07,_0x266fe4){_0x359f07=_0x359f07-0x0;var _0x42b602=_0xf2cf[_0x359f07];return _0x42b602;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))(_0xff2c('0x2'));var moment=require('moment');var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module['exports']=function(_0x8f0f4,_0x68b356){return _0x8f0f4['define'](_0xff2c('0x9'),attributes,{'tableName':_0xff2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff2c('0xb'),'collate':_0xff2c('0xc')});}; \ No newline at end of file +var _0x52fa=['../../config/logger','bluebird','request-promise','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','lodash','util'];(function(_0x51f7c0,_0x2a542d){var _0x1fe075=function(_0x69f5bf){while(--_0x69f5bf){_0x51f7c0['push'](_0x51f7c0['shift']());}};_0x1fe075(++_0x2a542d);}(_0x52fa,0x82));var _0xa52f=function(_0x3c7697,_0x414b70){_0x3c7697=_0x3c7697-0x0;var _0x4fd6c0=_0x52fa[_0x3c7697];return _0x4fd6c0;};'use strict';var _=require(_0xa52f('0x0'));var util=require(_0xa52f('0x1'));var logger=require(_0xa52f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa52f('0x3'));var rp=require(_0xa52f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa52f('0x5'));var attributes=require(_0xa52f('0x6'));module['exports']=function(_0x4aed0a,_0x16aa5a){return _0x4aed0a[_0xa52f('0x7')](_0xa52f('0x8'),attributes,{'tableName':_0xa52f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa52f('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 22e108e..09860e1 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 _0xa5d7=['info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','then'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x4c6c3f,_0x54c1ee){_0x4c6c3f=_0x4c6c3f-0x0;var _0x3f0d7c=_0xa5d7[_0x4c6c3f];return _0x3f0d7c;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var moment=require(_0x7a5d('0x2'));var BPromise=require(_0x7a5d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a5d('0x5'));var logger=require('../../config/logger')(_0x7a5d('0x6'));var config=require('../../config/environment');var jayson=require(_0x7a5d('0x7'));var client=jayson[_0x7a5d('0x8')][_0x7a5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cb015,_0x2092de,_0xc34a6a){return new BPromise(function(_0x5e6442,_0x33aeaa){return client['request'](_0x4cb015,_0xc34a6a)[_0x7a5d('0xa')](function(_0x1057e5){logger[_0x7a5d('0xb')]('SmsApplication,\x20%s,\x20%s',_0x2092de,_0x7a5d('0xc'));logger[_0x7a5d('0xd')](_0x7a5d('0xe'),_0x2092de,_0x7a5d('0xc'),JSON[_0x7a5d('0xf')](_0x1057e5));if(_0x1057e5[_0x7a5d('0x10')]){if(_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x11')]===0x1f4){logger[_0x7a5d('0x10')](_0x7a5d('0x12'),_0x2092de,_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x13')]);return _0x33aeaa(_0x1057e5['error']['message']);}logger[_0x7a5d('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2092de,_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x13')]);return _0x5e6442(_0x1057e5[_0x7a5d('0x10')][_0x7a5d('0x13')]);}else{logger[_0x7a5d('0xb')](_0x7a5d('0x12'),_0x2092de,'request\x20sent');_0x5e6442(_0x1057e5[_0x7a5d('0x14')][_0x7a5d('0x13')]);}})[_0x7a5d('0x15')](function(_0xc57403){logger[_0x7a5d('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2092de,_0xc57403);_0x33aeaa(_0xc57403);});});} \ No newline at end of file +var _0x352e=['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','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0x352e,0x1a6));var _0xe352=function(_0x224deb,_0x1b1f44){_0x224deb=_0x224deb-0x0;var _0x4058fa=_0x352e[_0x224deb];return _0x4058fa;};'use strict';var _=require(_0xe352('0x0'));var util=require(_0xe352('0x1'));var moment=require(_0xe352('0x2'));var BPromise=require(_0xe352('0x3'));var rs=require(_0xe352('0x4'));var fs=require('fs');var Redis=require(_0xe352('0x5'));var db=require(_0xe352('0x6'))['db'];var utils=require(_0xe352('0x7'));var logger=require('../../config/logger')(_0xe352('0x8'));var config=require(_0xe352('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe352('0xa')][_0xe352('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32d7c6,_0x6549bb,_0x5b9266){return new BPromise(function(_0x2bd5e5,_0x3cfd5b){return client[_0xe352('0xc')](_0x32d7c6,_0x5b9266)[_0xe352('0xd')](function(_0x5b1b22){logger[_0xe352('0xe')](_0xe352('0xf'),_0x6549bb,_0xe352('0x10'));logger[_0xe352('0x11')](_0xe352('0x12'),_0x6549bb,_0xe352('0x10'),JSON['stringify'](_0x5b1b22));if(_0x5b1b22['error']){if(_0x5b1b22[_0xe352('0x13')][_0xe352('0x14')]===0x1f4){logger[_0xe352('0x13')](_0xe352('0xf'),_0x6549bb,_0x5b1b22[_0xe352('0x13')][_0xe352('0x15')]);return _0x3cfd5b(_0x5b1b22['error'][_0xe352('0x15')]);}logger[_0xe352('0x13')]('SmsApplication,\x20%s,\x20%s',_0x6549bb,_0x5b1b22[_0xe352('0x13')][_0xe352('0x15')]);return _0x2bd5e5(_0x5b1b22['error'][_0xe352('0x15')]);}else{logger[_0xe352('0xe')](_0xe352('0xf'),_0x6549bb,_0xe352('0x10'));_0x2bd5e5(_0x5b1b22[_0xe352('0x16')][_0xe352('0x15')]);}})[_0xe352('0x17')](function(_0x1fede5){logger['error'](_0xe352('0xf'),_0x6549bb,_0x1fede5);_0x3cfd5b(_0x1fede5);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6c44965..c121ebc 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 _0x93e9=['update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update'];(function(_0x1b35b3,_0x416bb7){var _0x329473=function(_0x4ad917){while(--_0x4ad917){_0x1b35b3['push'](_0x1b35b3['shift']());}};_0x329473(++_0x416bb7);}(_0x93e9,0xcc));var _0x993e=function(_0x1eebe4,_0x27f7b4){_0x1eebe4=_0x1eebe4-0x0;var _0x46f639=_0x93e9[_0x1eebe4];return _0x46f639;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getMessages']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x993e('0x11')]('/',auth['isAuthenticated'](),controller[_0x993e('0x12')]);router['post']('/:id/messages',auth[_0x993e('0xa')](),controller[_0x993e('0x13')]);router[_0x993e('0x11')](_0x993e('0x14'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x17')),controller[_0x993e('0x18')]);router[_0x993e('0x19')](_0x993e('0xd'),auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1a')),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')]('/:id',auth[_0x993e('0xa')](),interaction[_0x993e('0x15')](_0x993e('0x16'),_0x993e('0x1d')),controller[_0x993e('0x1e')]);router[_0x993e('0x1c')]('/:id/tags',auth[_0x993e('0xa')](),controller[_0x993e('0x1f')]);module[_0x993e('0x20')]=router; \ No newline at end of file +var _0xe511=['addTags','put','update','smsinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe511,0x16f));var _0x1e51=function(_0x59ff01,_0x295452){_0x59ff01=_0x59ff01-0x0;var _0x16cf73=_0xe511[_0x59ff01];return _0x16cf73;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/download',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x10')]('/:id/messages',auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x10')](_0x1e51('0x13'),auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x16')),controller[_0x1e51('0x17')]);router[_0x1e51('0x18')]('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),'smsinteraction:update'),controller[_0x1e51('0x19')]);router['delete']('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x1a')),controller[_0x1e51('0x1b')]);router[_0x1e51('0x1c')]('/:id/tags',auth[_0x1e51('0xd')](),controller['removeTags']);module[_0x1e51('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e52a70d..8fc34d1 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 _0x35d0=['DATE','STRING','ENUM','out','sequelize','moment','BOOLEAN'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x35d0,0xf9));var _0x035d=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x35d0[_0x296754];return _0x1d9f1d;};'use strict';var Sequelize=require(_0x035d('0x0'));var moment=require(_0x035d('0x1'));module['exports']={'closed':{'type':Sequelize[_0x035d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x035d('0x3')]},'disposition':{'type':Sequelize[_0x035d('0x4')]},'secondDisposition':{'type':Sequelize[_0x035d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x035d('0x4')]},'note':{'type':Sequelize[_0x035d('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x035d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x035d('0x5')]('in',_0x035d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x035d('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x035d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x035d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x23ea=['STRING','out','ENUM','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x40fa00,_0x1fbb3f){var _0x2f2426=function(_0x18e6ee){while(--_0x18e6ee){_0x40fa00['push'](_0x40fa00['shift']());}};_0x2f2426(++_0x1fbb3f);}(_0x23ea,0xc3));var _0xa23e=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x23ea[_0x3cf4d3];return _0x4e547b;};'use strict';var Sequelize=require(_0xa23e('0x0'));var moment=require(_0xa23e('0x1'));module[_0xa23e('0x2')]={'closed':{'type':Sequelize[_0xa23e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa23e('0x4')]},'disposition':{'type':Sequelize[_0xa23e('0x5')]},'secondDisposition':{'type':Sequelize[_0xa23e('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa23e('0x5')]},'note':{'type':Sequelize[_0xa23e('0x5')]},'phone':{'type':Sequelize[_0xa23e('0x5')]},'read1stAt':{'type':Sequelize[_0xa23e('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa23e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa23e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa23e('0x7')]('in',_0xa23e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa23e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 7894447..91ce6d7 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 _0xc932=['Tags','split','forEach','push','catch','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','field','from','tools_tags','select','u.id','ui.SmsInteractionId','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','SmsAccountId','sequelize','toString','keyBy','merge','SmsInteraction','a.key','Account.key','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.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','show','params','includeAll','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','include','addTags','spread','findAll','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','disposition','direction','System','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds'];(function(_0x4f36ed,_0x3e6c23){var _0xdc9da6=function(_0x719e97){while(--_0x719e97){_0x4f36ed['push'](_0x4f36ed['shift']());}};_0xdc9da6(++_0x3e6c23);}(_0xc932,0x18f));var _0x2c93=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0xc932[_0xfc0976];return _0x23579f;};'use strict';var emlformat=require(_0x2c93('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2c93('0x1'));var rp=require(_0x2c93('0x2'));var moment=require('moment');var BPromise=require(_0x2c93('0x3'));var Mustache=require('mustache');var util=require(_0x2c93('0x4'));var path=require(_0x2c93('0x5'));var sox=require(_0x2c93('0x6'));var csv=require(_0x2c93('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c93('0x8'));var jsforce=require(_0x2c93('0x9'));var deskjs=require(_0x2c93('0xa'));var toCsv=require(_0x2c93('0x7'));var querystring=require('querystring');var Papa=require(_0x2c93('0xb'));var Redis=require(_0x2c93('0xc'));var authService=require(_0x2c93('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x2c93('0xe'));var pdf=require(_0x2c93('0xf'));var hardwareService=require(_0x2c93('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x2c93('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c93('0x12'))['db'];config[_0x2c93('0x13')]=_[_0x2c93('0x14')](config[_0x2c93('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c93('0x15'))(new Redis(config[_0x2c93('0x13')]));require(_0x2c93('0x16'))[_0x2c93('0x17')](socket);function respondWithStatusCode(_0xe3e870,_0x48b55b){_0x48b55b=_0x48b55b||0xcc;return function(_0xd3679c){if(_0xd3679c){return _0xe3e870[_0x2c93('0x18')](_0x48b55b);}return _0xe3e870[_0x2c93('0x19')](_0x48b55b)[_0x2c93('0x1a')]();};}function respondWithResult(_0xfa2540,_0x28268f){_0x28268f=_0x28268f||0xc8;return function(_0x527207){if(_0x527207){return _0xfa2540[_0x2c93('0x19')](_0x28268f)[_0x2c93('0x1b')](_0x527207);}};}function respondWithFilteredResult(_0x2b6b3e,_0x477a1f){return function(_0x32fcdf){if(_0x32fcdf){var _0x20fcea=typeof _0x477a1f[_0x2c93('0x1c')]===_0x2c93('0x1d')&&typeof _0x477a1f[_0x2c93('0x1e')]===_0x2c93('0x1d');var _0x4be1f6=_0x32fcdf[_0x2c93('0x1f')];var _0x3cc712=_0x20fcea?0x0:_0x477a1f['offset'];var _0x1d4fdb=_0x20fcea?_0x32fcdf[_0x2c93('0x1f')]:_0x477a1f[_0x2c93('0x1c')]+_0x477a1f['limit'];var _0x254a2b;if(_0x1d4fdb>=_0x4be1f6){_0x1d4fdb=_0x4be1f6;_0x254a2b=0xc8;}else{_0x254a2b=0xce;}_0x2b6b3e['status'](_0x254a2b);return _0x2b6b3e[_0x2c93('0x20')](_0x2c93('0x21'),_0x3cc712+'-'+_0x1d4fdb+'/'+_0x4be1f6)[_0x2c93('0x1b')](_0x32fcdf);}return null;};}function patchUpdates(_0x10b9ce){return function(_0x185e85){try{jsonpatch[_0x2c93('0x22')](_0x185e85,_0x10b9ce,!![]);}catch(_0x231452){return BPromise[_0x2c93('0x23')](_0x231452);}return _0x185e85[_0x2c93('0x24')]();};}function saveUpdates(_0x2dd127,_0x298518){return function(_0x3ac3ab){if(_0x3ac3ab){return _0x3ac3ab[_0x2c93('0x25')](_0x2dd127)[_0x2c93('0x26')](function(_0x57da72){return _0x57da72;});}return null;};}function removeEntity(_0x5a51b8,_0xf49c09){return function(_0x53bd61){if(_0x53bd61){return _0x53bd61[_0x2c93('0x27')]()[_0x2c93('0x26')](function(){_0x5a51b8[_0x2c93('0x19')](0xcc)[_0x2c93('0x1a')]();});}};}function handleEntityNotFound(_0x2408a6,_0x91511c){return function(_0x53a71){if(!_0x53a71){_0x2408a6[_0x2c93('0x18')](0x194);}return _0x53a71;};}function handleError(_0x1dd7ab,_0x25887f){_0x25887f=_0x25887f||0x1f4;return function(_0x1177e9){logger[_0x2c93('0x28')](_0x1177e9[_0x2c93('0x29')]);if(_0x1177e9[_0x2c93('0x2a')]){delete _0x1177e9[_0x2c93('0x2a')];}_0x1dd7ab['status'](_0x25887f)['send'](_0x1177e9);};}function getInteractionUsers(_0x1399af,_0x191555){return new BPromise(function(_0x2904bb,_0x324885){try{if(_0x191555[_0x1399af['id']]){_0x1399af[_0x2c93('0x2b')]=_[_0x2c93('0x2c')](_0x191555[_0x1399af['id']],function(_0x542eab){return{'id':_0x542eab['id'],'fullname':_0x542eab[_0x2c93('0x2d')]};});}}catch(_0xb1a7b5){_0x324885(_0xb1a7b5);}_0x2904bb(_0x1399af);});}function getInteractionTags(_0x173c3d,_0x2b48e7){return new BPromise(function(_0x2c6f53,_0x5e57cc){try{if(_0x173c3d[_0x2c93('0x2e')]){_0x173c3d[_0x2c93('0x2f')]=[];_0x173c3d['TagIds'][_0x2c93('0x30')](',')[_0x2c93('0x31')](function(_0x15a361){_0x173c3d[_0x2c93('0x2f')][_0x2c93('0x32')](_0x2b48e7[_0x15a361]);});}delete _0x173c3d[_0x2c93('0x2e')];}catch(_0x32fcfa){_0x5e57cc(_0x32fcfa);}_0x2c6f53(_0x173c3d);});}function updateSmsInteraction(_0x12ec64,_0x1e7991,_0x47dae2){return new BPromise(function(_0x183988,_0x5d028a){return getInteractionUsers(_0x12ec64,_0x47dae2)[_0x2c93('0x26')](function(_0x20b1c5){return getInteractionTags(_0x20b1c5,_0x1e7991);})['then'](function(_0x3c3c7e){_0x183988(_0x3c3c7e);})[_0x2c93('0x33')](function(_0x50cada){_0x5d028a(_0x50cada);});});}exports['index']=function(_0x365703,_0x405e70){var _0x31aae0={},_0x309e10={},_0x23cada={'count':0x0,'rows':[]};var _0x300db9=_[_0x2c93('0x2c')](db['SmsInteraction'][_0x2c93('0x34')],function(_0x2d63bf){return{'name':_0x2d63bf[_0x2c93('0x35')],'type':_0x2d63bf[_0x2c93('0x36')][_0x2c93('0x37')]};});_0x309e10['model']=_[_0x2c93('0x2c')](_0x300db9,_0x2c93('0x2a'));_0x309e10[_0x2c93('0x38')]=_[_0x2c93('0x39')](_0x365703[_0x2c93('0x38')]);_0x309e10[_0x2c93('0x3a')]=_[_0x2c93('0x3b')](_0x309e10[_0x2c93('0x3c')],_0x309e10[_0x2c93('0x38')]);_0x31aae0[_0x2c93('0x3d')]=_[_0x2c93('0x3b')](_0x309e10[_0x2c93('0x3c')],qs[_0x2c93('0x3e')](_0x365703['query'][_0x2c93('0x3e')]));_0x31aae0[_0x2c93('0x3d')]=_0x31aae0['attributes']['length']?_0x31aae0[_0x2c93('0x3d')]:_0x309e10[_0x2c93('0x3c')];if(!_0x365703[_0x2c93('0x38')]['hasOwnProperty']('nolimit')){_0x31aae0['limit']=qs[_0x2c93('0x1e')](_0x365703[_0x2c93('0x38')]['limit']);_0x31aae0[_0x2c93('0x1c')]=qs[_0x2c93('0x1c')](_0x365703['query'][_0x2c93('0x1c')]);}_0x31aae0[_0x2c93('0x3f')]=qs[_0x2c93('0x40')](_0x365703[_0x2c93('0x38')][_0x2c93('0x40')]);_0x31aae0[_0x2c93('0x41')]=qs[_0x2c93('0x3a')](_[_0x2c93('0x42')](_0x365703[_0x2c93('0x38')],_0x309e10[_0x2c93('0x3a')]),_0x300db9);var _0x139729=[];var _0x5c8f20=squel['select']()[_0x2c93('0x43')]('id')[_0x2c93('0x43')](_0x2c93('0x2a'))[_0x2c93('0x43')]('color')[_0x2c93('0x44')](_0x2c93('0x45'));var _0x2b99ef=squel[_0x2c93('0x46')]()[_0x2c93('0x43')](_0x2c93('0x47'))[_0x2c93('0x43')]('u.fullname')[_0x2c93('0x43')](_0x2c93('0x48'))[_0x2c93('0x44')]('user_has_sms_interactions','ui')['left_join'](_0x2c93('0x49'),'u',_0x2c93('0x4a'));var _0x46c8bb=squel[_0x2c93('0x46')]()[_0x2c93('0x44')](_0x2c93('0x4b'),'i')[_0x2c93('0x4c')](_0x2c93('0x4d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x2c93('0x4c')](_0x2c93('0x49'),'o',_0x2c93('0x4e'))[_0x2c93('0x4c')](_0x2c93('0x4f'),'a',_0x2c93('0x50'))[_0x2c93('0x4c')](_0x2c93('0x51'),'me',_0x2c93('0x52'))['left_join'](_0x2c93('0x53'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x2c93('0x4c')](_0x2c93('0x45'),'t',_0x2c93('0x54'));var _0x2cd38d=squel[_0x2c93('0x55')]();var _0x1c46e9=[];var _0x107931=squel[_0x2c93('0x55')]();var _0x5c344d;if(_0x365703[_0x2c93('0x38')][_0x2c93('0x56')]){_0x5c344d=as[_0x2c93('0x57')](_0x365703[_0x2c93('0x38')][_0x2c93('0x56')]);var _0x1ab7a9=_0x5c344d[_0x2c93('0x58')];for(var _0x3993d2=0x0;_0x3993d2<_0x5c344d['conditions'][_0x2c93('0x59')];_0x3993d2++){var _0xff706=_0x5c344d[_0x2c93('0x5a')][_0x3993d2];var _0x4bee2e='i';var _0x4ef2c9=_[_0x2c93('0x5b')](_0x300db9,['name',_0xff706[_0x2c93('0x43')]]);if(!_0x4ef2c9){switch(_0xff706[_0x2c93('0x43')]){case _0x2c93('0x5c'):if(_0xff706[_0x2c93('0x5d')]==0x1){_0x46c8bb[_0x2c93('0x5e')]('`'+_0xff706[_0x2c93('0x43')]+'`\x20=\x200');}else{_0x46c8bb['having']('`'+_0xff706[_0x2c93('0x43')]+_0x2c93('0x5f'));}break;case _0x2c93('0x60'):if(_0xff706['operator']===_0x2c93('0x61')){if(_0xff706[_0x2c93('0x5d')]['split']('\x20')[_0x2c93('0x59')]>0x1){_0x2cd38d[_0x1ab7a9](_0x2c93('0x62'),qs['getFullTextValue'](_0xff706[_0x2c93('0x5d')]),null);}else{var _0x29107b='%'+_0xff706[_0x2c93('0x5d')]+'%';_0x2cd38d[_0x1ab7a9](_0x2c93('0x63'),_0x29107b,_0x29107b,_0x29107b);}}else{_0x4ef2c9=_[_0x2c93('0x5b')](_0x300db9,[_0x2c93('0x2a'),_0x2c93('0x64')]);_0xff706[_0x2c93('0x43')]=_0x2c93('0x64');_0xf72067=as[_0x2c93('0x65')](_0x4bee2e,_0x4ef2c9[_0x2c93('0x36')],_0xff706);_0x2cd38d[_0x1ab7a9](_0xf72067[_0x2c93('0x66')],_0xf72067['value'][_0x2c93('0x67')],_0xf72067[_0x2c93('0x5d')][_0x2c93('0x1a')]);}break;case _0x2c93('0x68'):var _0x1b7562=_0xff706[_0x2c93('0x5d')][_0x2c93('0x30')](',')[_0x2c93('0x2c')](function(_0x80c807){return Number(_0x80c807);});_0x1b7562[_0x2c93('0x31')](function(_0x3e9c5d){_0x107931['or'](_0x2c93('0x69'),'%,'+_0x3e9c5d+',%');});_0x1c46e9=_[_0x2c93('0x6a')](_0x1c46e9,_0x1b7562);break;case _0x2c93('0x6b'):if(_0xff706[_0x2c93('0x6c')]===_0x2c93('0x61')){_0x2cd38d[_0x1ab7a9](_0x2c93('0x6d'),'%'+_0xff706[_0x2c93('0x5d')]+'%',null);}else{_0x4ef2c9=_[_0x2c93('0x5b')](_0x300db9,[_0x2c93('0x2a'),_0x2c93('0x6e')]);_0xff706['field']=_0x2c93('0x6e');_0xf72067=as[_0x2c93('0x65')](_0x4bee2e,_0x4ef2c9[_0x2c93('0x36')],_0xff706);_0x2cd38d[_0x1ab7a9](_0xf72067[_0x2c93('0x66')],_0xf72067['value'][_0x2c93('0x67')],_0xf72067['value'][_0x2c93('0x1a')]);}break;case _0x2c93('0x6f'):_0xf72067=as[_0x2c93('0x65')]('me',null,_0xff706);_0x2cd38d[_0x1ab7a9](_0xf72067[_0x2c93('0x66')],_0xf72067[_0x2c93('0x5d')][_0x2c93('0x67')],_0xf72067[_0x2c93('0x5d')]['end']);break;}}else{var _0xf72067=as[_0x2c93('0x65')](_0x4bee2e,_0x4ef2c9[_0x2c93('0x36')],_0xff706);_0x2cd38d[_0x1ab7a9](_0xf72067[_0x2c93('0x66')],_0xf72067[_0x2c93('0x5d')][_0x2c93('0x67')],_0xf72067[_0x2c93('0x5d')][_0x2c93('0x1a')]);}}}else{var _0x4ba21c=_(_0x365703['query'])[_0x2c93('0x39')]()[_0x2c93('0x2c')](function(_0xa1d5af){return _[_0x2c93('0x70')](_0x300db9,[_0x2c93('0x2a'),_0xa1d5af])?_0xa1d5af:undefined;})[_0x2c93('0x71')]()[_0x2c93('0x5d')]();if(!_[_0x2c93('0x72')](_0x4ba21c)){_0x4ba21c[_0x2c93('0x31')](function(_0x302b2d){if(_0x302b2d==='SmsAccountId'){_0x46c8bb[_0x2c93('0x41')]('i.SmsAccountId\x20IN\x20?',[][_0x2c93('0x73')](_0x365703[_0x2c93('0x38')][_0x302b2d]));}else if(_0x302b2d===_0x2c93('0x74')){var _0x4f7642=JSON[_0x2c93('0x75')](_0x365703[_0x2c93('0x38')][_0x302b2d])[_0x2c93('0x76')];var _0xc19209=JSON['parse'](_0x365703[_0x2c93('0x38')][_0x302b2d])[_0x2c93('0x77')];_0x46c8bb[_0x2c93('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f7642,_0xc19209);}else{if(_0x365703[_0x2c93('0x38')][_0x302b2d]===_0x2c93('0x78')){_0x46c8bb['where']('i.'+_0x302b2d+_0x2c93('0x79'));}else{_0x46c8bb[_0x2c93('0x41')]('i.'+_0x302b2d+_0x2c93('0x7a'),_0x365703[_0x2c93('0x38')][_0x302b2d]);}}});}if(_0x365703[_0x2c93('0x38')]['read']){if(_0x365703['query'][_0x2c93('0x7b')]==0x1){_0x46c8bb[_0x2c93('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x46c8bb['having']('`unreadMessages`\x20>\x200');}}if(_0x365703['query'][_0x2c93('0x7c')]){_0x1c46e9=_[_0x2c93('0x7d')](_0x365703[_0x2c93('0x38')][_0x2c93('0x7c')])?_0x365703[_0x2c93('0x38')][_0x2c93('0x7c')]:new Array(_0x365703['query'][_0x2c93('0x7c')]);_0x1c46e9[_0x2c93('0x31')](function(_0x58c29a){_0x107931['or'](_0x2c93('0x69'),'%,'+_0x58c29a+',%');});}if(_0x365703[_0x2c93('0x38')][_0x2c93('0x7e')]){var _0x154daf=_0x365703[_0x2c93('0x38')][_0x2c93('0x7e')][_0x2c93('0x7f')]('\x5c','\x5c\x5c')[_0x2c93('0x7f')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x154daf)){_0x2cd38d['or'](_0x2c93('0x80'),_0x154daf+'%')['or'](_0x2c93('0x81'),_0x154daf+'%');}else{_0x2cd38d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x154daf))['or'](_0x2c93('0x82'),_0x154daf+'%');}}}_0x46c8bb[_0x2c93('0x41')](_0x2cd38d);_0x46c8bb[_0x2c93('0x83')](_0x2c93('0x84'));var _0xb17c6a={'type':db[_0x2c93('0x85')][_0x2c93('0x86')][_0x2c93('0x87')],'raw':!![]};var _0x3f27c5=_0x46c8bb['clone']();_0x3f27c5[_0x2c93('0x43')](_0x2c93('0x84'));_0x3f27c5[_0x2c93('0x43')](_0x2c93('0x88'),'unreadMessages');if(_0x31aae0[_0x2c93('0x3f')]){_0x31aae0[_0x2c93('0x3f')]['forEach'](function(_0x3b8afe){var _0x31084c=_0x3b8afe[0x0]===_0x2c93('0x89')?_0x3b8afe[0x0]:'i.'+_0x3b8afe[0x0];_0x46c8bb[_0x2c93('0x3f')](_0x31084c,_0x3b8afe[0x1]===_0x2c93('0x8a')?![]:!![]);});}if(!_[_0x2c93('0x72')](_0x1c46e9)){_0x46c8bb['having'](_0x107931);_0x3f27c5[_0x2c93('0x41')](_0x2c93('0x8b'),_0x1c46e9);}BPromise['resolve']()[_0x2c93('0x26')](function(){if(!_0x5c344d){if(_0x365703[_0x2c93('0x38')]['SmsAccountId'])return;_0x3f27c5['where'](_0x2c93('0x8c'));_0x46c8bb[_0x2c93('0x41')](_0x2c93('0x8c'));return;}if(_0x365703[_0x2c93('0x8d')][_0x2c93('0x8e')]!==_0x2c93('0x8f'))return;return _0x365703['user'][_0x2c93('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3ebb63){if(_[_0x2c93('0x72')](_0x3ebb63)){_0x3f27c5['where'](_0x2c93('0x91'));_0x46c8bb[_0x2c93('0x41')](_0x2c93('0x91'));}else{_0x3f27c5['where'](_0x2c93('0x92'),_['map'](_0x3ebb63,'id'));_0x46c8bb['where']('i.SmsAccountId\x20IN\x20?',_[_0x2c93('0x2c')](_0x3ebb63,'id'));}});})[_0x2c93('0x26')](function(){if(_0x365703[_0x2c93('0x8d')][_0x2c93('0x8e')]===_0x2c93('0x8f')&&!_0x5c344d&&!_0x365703[_0x2c93('0x38')][_0x2c93('0x93')])return[];return db[_0x2c93('0x94')][_0x2c93('0x38')](_0x3f27c5[_0x2c93('0x95')](),_0xb17c6a);})[_0x2c93('0x26')](function(_0x12a1b3){_0x23cada[_0x2c93('0x1f')]=_0x12a1b3[_0x2c93('0x59')];if(_0x23cada[_0x2c93('0x1f')]===0x0)return[];return db[_0x2c93('0x94')][_0x2c93('0x38')](_0x5c8f20[_0x2c93('0x95')](),_0xb17c6a)[_0x2c93('0x26')](function(_0x54ff29){_0x139729=_[_0x2c93('0x96')](_0x54ff29,'id');_0xb17c6a=_[_0x2c93('0x97')](_0xb17c6a,{'model':db[_0x2c93('0x98')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x365703[_0x2c93('0x38')]['fields']){_0x31aae0[_0x2c93('0x3d')][_0x2c93('0x31')](function(_0x19bc0a){_0x46c8bb[_0x2c93('0x43')]('i.'+_0x19bc0a);});}else{_0x46c8bb['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x46c8bb[_0x2c93('0x43')](_0x2c93('0x99'),_0x2c93('0x9a'));_0x46c8bb[_0x2c93('0x43')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x46c8bb[_0x2c93('0x43')](_0x2c93('0x9b'),_0x2c93('0x89'));_0x46c8bb[_0x2c93('0x43')](_0x2c93('0x9c'));_0x46c8bb[_0x2c93('0x43')]('c.firstName','Contact.firstName');_0x46c8bb[_0x2c93('0x43')](_0x2c93('0x9d'),_0x2c93('0x9e'));_0x46c8bb[_0x2c93('0x43')]('c.email',_0x2c93('0x9f'));_0x46c8bb[_0x2c93('0x43')]('c.phone',_0x2c93('0xa0'));_0x46c8bb[_0x2c93('0x43')](_0x2c93('0xa1'),_0x2c93('0xa2'));_0x46c8bb['field']('c.fax',_0x2c93('0xa3'));_0x46c8bb['field'](_0x2c93('0xa4'),'Owner.fullname');_0x46c8bb[_0x2c93('0x43')](_0x2c93('0xa5'),_0x2c93('0xa6'));_0x46c8bb['field'](_0x2c93('0xa7'),_0x2c93('0x2e'));}if(_0x31aae0['limit'])_0x46c8bb[_0x2c93('0x1e')](_0x31aae0[_0x2c93('0x1e')]);if(_0x31aae0[_0x2c93('0x1c')])_0x46c8bb[_0x2c93('0x1c')](_0x31aae0['offset']);return db['sequelize'][_0x2c93('0x38')](_0x46c8bb['toString'](),_0xb17c6a);})[_0x2c93('0x26')](function(_0x5f45ae){if(_0x5f45ae[_0x2c93('0x59')]>0x0)_0x2b99ef[_0x2c93('0x41')](_0x2c93('0xa8'),_[_0x2c93('0x2c')](_0x5f45ae,'id'));return db['sequelize'][_0x2c93('0x38')](_0x2b99ef[_0x2c93('0x95')](),_0xb17c6a)[_0x2c93('0x26')](function(_0x3fd134){var _0x5605e9=_['groupBy'](_0x3fd134,_0x2c93('0xa9'));var _0x432042=[];_0x5f45ae['forEach'](function(_0x52c7d9){_0x432042[_0x2c93('0x32')](updateSmsInteraction(_0x52c7d9,_0x139729,_0x5605e9));});return BPromise[_0x2c93('0xaa')](_0x432042);});});})[_0x2c93('0x26')](function(_0x23debf){_0x23cada[_0x2c93('0xab')]=_0x23debf;return _0x23cada;})[_0x2c93('0x26')](respondWithFilteredResult(_0x405e70,_0x31aae0))[_0x2c93('0x33')](handleError(_0x405e70,null));};exports[_0x2c93('0xac')]=function(_0x65bfb9,_0x4ed74a){var _0x51dc45={'raw':![],'where':{'id':_0x65bfb9[_0x2c93('0xad')]['id']}},_0x9a6346={};_0x9a6346['model']=_[_0x2c93('0x39')](db['SmsInteraction'][_0x2c93('0x34')]);_0x9a6346[_0x2c93('0x38')]=_[_0x2c93('0x39')](_0x65bfb9[_0x2c93('0x38')]);_0x9a6346['filters']=_[_0x2c93('0x3b')](_0x9a6346[_0x2c93('0x3c')],_0x9a6346[_0x2c93('0x38')]);_0x51dc45[_0x2c93('0x3d')]=_[_0x2c93('0x3b')](_0x9a6346['model'],qs[_0x2c93('0x3e')](_0x65bfb9[_0x2c93('0x38')]['fields']));_0x51dc45[_0x2c93('0x3d')]=_0x51dc45[_0x2c93('0x3d')][_0x2c93('0x59')]?_0x51dc45[_0x2c93('0x3d')]:_0x9a6346['model'];if(_0x65bfb9[_0x2c93('0x38')][_0x2c93('0xae')]){_0x51dc45['include']=[{'all':!![]}];}_0x51dc45=_[_0x2c93('0x97')]({},_0x51dc45,_0x65bfb9[_0x2c93('0xaf')]);return db['SmsInteraction'][_0x2c93('0x5b')](_0x51dc45)[_0x2c93('0x26')](handleEntityNotFound(_0x4ed74a,null))[_0x2c93('0x26')](respondWithResult(_0x4ed74a,null))[_0x2c93('0x33')](handleError(_0x4ed74a,null));};exports[_0x2c93('0xb0')]=function(_0xad1999,_0x158e0c){return db[_0x2c93('0x98')]['create'](_0xad1999[_0x2c93('0x6f')],{})[_0x2c93('0x26')](respondWithResult(_0x158e0c,0xc9))[_0x2c93('0x33')](handleError(_0x158e0c,null));};exports[_0x2c93('0x25')]=function(_0x79414a,_0x6676c5){if(_0x79414a[_0x2c93('0x6f')]['id']){delete _0x79414a[_0x2c93('0x6f')]['id'];}return db[_0x2c93('0x98')][_0x2c93('0x5b')]({'where':{'id':_0x79414a['params']['id']}})[_0x2c93('0x26')](handleEntityNotFound(_0x6676c5,null))[_0x2c93('0x26')](saveUpdates(_0x79414a[_0x2c93('0x6f')],null))[_0x2c93('0x26')](respondWithResult(_0x6676c5,null))[_0x2c93('0x33')](handleError(_0x6676c5,null));};exports[_0x2c93('0x27')]=function(_0x1f9c29,_0xaa95f6){return db[_0x2c93('0x98')]['find']({'where':{'id':_0x1f9c29[_0x2c93('0xad')]['id']}})['then'](handleEntityNotFound(_0xaa95f6,null))[_0x2c93('0x26')](removeEntity(_0xaa95f6,null))[_0x2c93('0x33')](handleError(_0xaa95f6,null));};exports[_0x2c93('0xb1')]=function(_0x510f44,_0x5f47ec){return db[_0x2c93('0x98')][_0x2c93('0xb1')]()[_0x2c93('0x26')](respondWithResult(_0x5f47ec,null))['catch'](handleError(_0x5f47ec,null));};exports[_0x2c93('0xb2')]=function(_0x2af03a,_0x9bc9ea,_0xb5e46c){return db[_0x2c93('0xb3')][_0x2c93('0x5b')]({'where':{'id':_0x2af03a['params']['id']}})[_0x2c93('0x26')](handleEntityNotFound(_0x9bc9ea,null))[_0x2c93('0x26')](function(_0x23b7c2){if(_0x23b7c2){return _0x23b7c2[_0x2c93('0xb2')](_0x2af03a[_0x2c93('0x6f')][_0x2c93('0xb4')],_[_0x2c93('0xb5')](_0x2af03a['body'],[_0x2c93('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x9bc9ea,null))['catch'](handleError(_0x9bc9ea,null));};exports[_0x2c93('0xb6')]=function(_0x5a7708,_0x43a1d3,_0xe2d1c){var _0x57bc36={'raw':![],'where':{}};var _0x1b9153={};var _0x28e3b0={'count':0x0,'rows':[]};return db[_0x2c93('0x98')][_0x2c93('0xb7')]({'where':{'id':_0x5a7708[_0x2c93('0xad')]['id']}})[_0x2c93('0x26')](handleEntityNotFound(_0x43a1d3,null))[_0x2c93('0x26')](function(_0x3a4964){if(_0x3a4964){_0x1b9153[_0x2c93('0x3c')]=_[_0x2c93('0x39')](db['SmsMessage']['rawAttributes']);_0x1b9153[_0x2c93('0x38')]=_[_0x2c93('0x39')](_0x5a7708[_0x2c93('0x38')]);_0x1b9153['filters']=_['intersection'](_0x1b9153[_0x2c93('0x3c')],_0x1b9153[_0x2c93('0x38')]);_0x57bc36[_0x2c93('0x3d')]=_[_0x2c93('0x3b')](_0x1b9153['model'],qs['fields'](_0x5a7708[_0x2c93('0x38')]['fields']));_0x57bc36[_0x2c93('0x3d')]=_0x57bc36['attributes'][_0x2c93('0x59')]?_0x57bc36['attributes']:_0x1b9153[_0x2c93('0x3c')];if(!_0x5a7708[_0x2c93('0x38')]['hasOwnProperty']('nolimit')){_0x57bc36[_0x2c93('0x1e')]=qs[_0x2c93('0x1e')](_0x5a7708['query'][_0x2c93('0x1e')]);_0x57bc36[_0x2c93('0x1c')]=qs[_0x2c93('0x1c')](_0x5a7708[_0x2c93('0x38')][_0x2c93('0x1c')]);}_0x57bc36[_0x2c93('0x3f')]=qs['sort'](_0x5a7708['query']['sort']);_0x57bc36['where']=qs[_0x2c93('0x3a')](_[_0x2c93('0x42')](_0x5a7708[_0x2c93('0x38')],_0x1b9153[_0x2c93('0x3a')]));_0x57bc36[_0x2c93('0x41')][_0x2c93('0xa9')]=_0x3a4964['id'];if(_0x5a7708[_0x2c93('0x38')]['filter']){_0x57bc36['where']=_[_0x2c93('0x97')](_0x57bc36[_0x2c93('0x41')],{'$or':_[_0x2c93('0x2c')](_0x57bc36[_0x2c93('0x3d')],function(_0x15f824){var _0x1df613={};_0x1df613[_0x15f824]={'$like':'%'+_0x5a7708[_0x2c93('0x38')][_0x2c93('0x7e')]+'%'};return _0x1df613;})});}if(_0x5a7708[_0x2c93('0x38')][_0x2c93('0x76')]){var _0x1942cd=_0x5a7708[_0x2c93('0x38')][_0x2c93('0x76')]['split'](',');var _0x182bf3={};_0x182bf3[_0x1942cd[0x0]]={'$gte':moment(_0x1942cd[0x1])['format'](_0x2c93('0xb8'))};_0x57bc36[_0x2c93('0x41')]=_['merge'](_0x57bc36[_0x2c93('0x41')],_0x182bf3);}_0x57bc36=_[_0x2c93('0x97')]({},_0x57bc36,_0x5a7708[_0x2c93('0xaf')]);return db[_0x2c93('0xb3')][_0x2c93('0x1f')]({'where':_0x57bc36['where']})[_0x2c93('0x26')](function(_0x33a5c4){_0x28e3b0[_0x2c93('0x1f')]=_0x33a5c4;if(_0x5a7708['query'][_0x2c93('0xae')]){_0x57bc36[_0x2c93('0xb9')]=[{'all':!![]}];}return db[_0x2c93('0xb3')]['findAll'](_0x57bc36);})[_0x2c93('0x26')](function(_0x1a9df0){_0x28e3b0[_0x2c93('0xab')]=_0x1a9df0;return _0x28e3b0;});}})[_0x2c93('0x26')](respondWithFilteredResult(_0x43a1d3,_0x57bc36))[_0x2c93('0x33')](handleError(_0x43a1d3,null));};exports[_0x2c93('0xba')]=function(_0x3fb8b6,_0x12c73,_0x461d23){return db[_0x2c93('0x98')]['find']({'where':{'id':_0x3fb8b6['params']['id']}})['then'](handleEntityNotFound(_0x12c73,null))[_0x2c93('0x26')](function(_0x1bd3a4){if(_0x1bd3a4){return _0x1bd3a4['setTags'](_0x3fb8b6['body']['ids'],_[_0x2c93('0xb5')](_0x3fb8b6[_0x2c93('0x6f')],[_0x2c93('0xb4'),'id'])||{})[_0x2c93('0xbb')](function(){return db[_0x2c93('0x68')][_0x2c93('0xbc')]({'attributes':['id',_0x2c93('0x2a'),'color'],'where':{'id':_0x3fb8b6['body'][_0x2c93('0xb4')]}});})[_0x2c93('0x26')](function(_0x148b0b){socket['emit'](_0x2c93('0xbd'),{'id':Number(_0x3fb8b6[_0x2c93('0xad')]['id']),'tags':_0x148b0b||[]});return{'id':Number(_0x3fb8b6[_0x2c93('0xad')]['id']),'tags':_0x148b0b||[]};});}})['then'](respondWithResult(_0x12c73,null))[_0x2c93('0x33')](handleError(_0x12c73,null));};exports[_0x2c93('0xbe')]=function(_0x55a1de,_0x12a30d,_0x2f2997){return db[_0x2c93('0x98')]['find']({'where':{'id':_0x55a1de['params']['id']}})['then'](handleEntityNotFound(_0x12a30d,null))[_0x2c93('0x26')](function(_0x3e06bf){if(_0x3e06bf){return _0x3e06bf[_0x2c93('0xbe')](_0x55a1de[_0x2c93('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x12a30d,null))[_0x2c93('0x33')](handleError(_0x12a30d,null));};exports[_0x2c93('0xbf')]=function(_0x422f9d,_0x5aa21c){var _0x35dae8=moment()[_0x2c93('0xc0')]()[_0x2c93('0x95')]();var _0x44d2cc=path['join'](config[_0x2c93('0xc1')],_0x2c93('0xc2'),_0x2c93('0xc3'),_0x2c93('0xc4'));var _0x427065=path[_0x2c93('0xc5')](config[_0x2c93('0xc1')],_0x2c93('0xc2'),_0x2c93('0xc3'),_0x2c93('0xc6'));var _0xdf8a98=path['join'](_0x44d2cc,_0x35dae8);var _0x583cbd=util[_0x2c93('0xc7')](_0x2c93('0xc8'),_0x422f9d['params']['id'],_0x35dae8);var _0x32e23c=path['join'](_0x44d2cc,_0x583cbd);var _0x2a213b=[];_0x2a213b['push']({'model':db[_0x2c93('0x6b')],'as':_0x2c93('0x6b'),'attributes':['id',_0x2c93('0x2d')],'raw':!![]});_0x2a213b[_0x2c93('0x32')]({'model':db[_0x2c93('0xc9')],'as':_0x2c93('0x60'),'attributes':['id',_0x2c93('0xca'),_0x2c93('0xcb')],'raw':!![]});var _0x24798b=[{'model':db[_0x2c93('0xb3')],'as':'Messages','attributes':['id','body','createdAt','direction',_0x2c93('0xcc'),'read'],'include':_0x2a213b}];_0x24798b[_0x2c93('0x32')]({'model':db[_0x2c93('0xcd')],'as':_0x2c93('0xce'),'attributes':['id',_0x2c93('0x2a')]});_0x24798b['push']({'model':db[_0x2c93('0x6b')],'as':'Owner','attributes':['id',_0x2c93('0x2d')]});return db[_0x2c93('0x98')][_0x2c93('0x5b')]({'where':{'id':_0x422f9d['params']['id']},'include':_0x24798b})[_0x2c93('0x26')](handleEntityNotFound(_0x5aa21c,null))['then'](function(_0xc5de80){if(_0xc5de80){var _0x1d5c8e=_0xc5de80[_0x2c93('0xcf')]({'plain':!![]});fs[_0x2c93('0xd0')](_0xdf8a98);var _0x583750={'channel':_0x2c93('0xd1'),'account':_0x1d5c8e[_0x2c93('0xce')]['name'],'agent':_0x1d5c8e['Owner']?_0x1d5c8e[_0x2c93('0xd2')][_0x2c93('0x2d')]:_0x2c93('0xd3'),'createdAt':moment(_0x1d5c8e[_0x2c93('0x74')])[_0x2c93('0xc7')](_0x2c93('0xb8'))[_0x2c93('0x95')](),'closedAt':_0x1d5c8e['closed']?moment(_0x1d5c8e['closedAt'])[_0x2c93('0xc7')](_0x2c93('0xb8'))[_0x2c93('0x95')]():'','disposition':_0x1d5c8e[_0x2c93('0xd4')],'messages':_(_0x1d5c8e['Messages'])['filter']({'secret':![]})[_0x2c93('0x2c')](function(_0x1e4d5c){return{'date':moment(_0x1e4d5c[_0x2c93('0x74')])[_0x2c93('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2c93('0x95')](),'sender':_0x1e4d5c[_0x2c93('0xd5')]==='out'?_0x1e4d5c['User']?_0x1e4d5c['User']['fullname']:_0x2c93('0xd6'):_0x1e4d5c[_0x2c93('0x60')][_0x2c93('0xca')]+(_0x1e4d5c[_0x2c93('0x60')][_0x2c93('0xcb')]?'\x20'+_0x1e4d5c['Contact'][_0x2c93('0xcb')]:''),'body':_0x1e4d5c[_0x2c93('0x6f')],'direction':_0x1e4d5c[_0x2c93('0xd5')]==='out'?'A':'C','secret':_0x1e4d5c[_0x2c93('0xcc')],'read':_0x1e4d5c[_0x2c93('0x7b')]};})['value']()};return ejs[_0x2c93('0xd7')](path[_0x2c93('0xc5')](config[_0x2c93('0xc1')],'server',_0x2c93('0xd8'),_0x2c93('0xd9')),{'interaction':_0x583750})[_0x2c93('0x26')](function(_0x3059be){var _0x3d17e9=path[_0x2c93('0xc5')](_0xdf8a98,_0x2c93('0xda')+_0x1d5c8e['id']+'-'+_0x35dae8+'.pdf');var _0x1454fa={'path':_0x3d17e9,'channel':'Sms','interactionId':_0x1d5c8e['id']};return pdf[_0x2c93('0xdb')](_0x3059be,_0x1454fa);})[_0x2c93('0x26')](function(){return new BPromise(function(_0x5ee650,_0x199c3b){zipdir(_0xdf8a98,{'saveTo':_0x32e23c},function(_0xbbeeaf,_0x36fc21){if(_0xbbeeaf)return _0x199c3b(_0xbbeeaf);return _0x5ee650(_0x36fc21);});})[_0x2c93('0x26')](function(){return new BPromise(function(_0x5a4fc9,_0x33622f){rimraf(_0xdf8a98,function(_0x5a0527){if(_0x5a0527)_0x33622f(_0x5a0527);return _0x5a4fc9();});});})['then'](function(){return _0x5aa21c[_0x2c93('0xbf')](_0x32e23c,_0x583cbd,function(_0x46923c){if(_0x46923c){console[_0x2c93('0xdc')](_0x2c93('0xdd'),_0x46923c);}else{fs[_0x2c93('0xde')](_0x32e23c);}});});});}else{return _0x5aa21c[_0x2c93('0x18')](0xc8);}})[_0x2c93('0x33')](handleError(_0x5aa21c,null));}; \ No newline at end of file +var _0xc0e9=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','update','destroy','then','error','name','send','Users','fullname','TagIds','Tags','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','tools_tags','u.fullname','ui.SmsInteractionId','from','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','keys','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','forEach','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','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','isEmpty','i.SmsAccountId\x20IS\x20NULL','toString','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','include','merge','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','split','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','CmContact','lastName','Messages','direction','SmsAccount','mkdirSync','Sms','Account','Owner','N.A.','closed','closedAt','out','firstName','secret','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','eml-format'];(function(_0x5945c5,_0x2c5371){var _0x49364b=function(_0x54442a){while(--_0x54442a){_0x5945c5['push'](_0x5945c5['shift']());}};_0x49364b(++_0x2c5371);}(_0xc0e9,0xe5));var _0x9c0e=function(_0x4a2432,_0x13d42b){_0x4a2432=_0x4a2432-0x0;var _0x23a89a=_0xc0e9[_0x4a2432];return _0x23a89a;};'use strict';var emlformat=require(_0x9c0e('0x0'));var rimraf=require(_0x9c0e('0x1'));var zipdir=require(_0x9c0e('0x2'));var jsonpatch=require(_0x9c0e('0x3'));var rp=require(_0x9c0e('0x4'));var moment=require(_0x9c0e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9c0e('0x6'));var util=require(_0x9c0e('0x7'));var path=require(_0x9c0e('0x8'));var sox=require(_0x9c0e('0x9'));var csv=require(_0x9c0e('0xa'));var ejs=require(_0x9c0e('0xb'));var fs=require('fs');var fs_extra=require(_0x9c0e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c0e('0xd'));var Redis=require(_0x9c0e('0xe'));var authService=require(_0x9c0e('0xf'));var qs=require(_0x9c0e('0x10'));var as=require(_0x9c0e('0x11'));var pdf=require(_0x9c0e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c0e('0x13'));var utils=require(_0x9c0e('0x14'));var config=require(_0x9c0e('0x15'));var licenseUtil=require(_0x9c0e('0x16'));var db=require(_0x9c0e('0x17'))['db'];config[_0x9c0e('0x18')]=_[_0x9c0e('0x19')](config[_0x9c0e('0x18')],{'host':_0x9c0e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c0e('0x18')]));require(_0x9c0e('0x1b'))['register'](socket);function respondWithStatusCode(_0x12fe2c,_0x5d69a3){_0x5d69a3=_0x5d69a3||0xcc;return function(_0x12779b){if(_0x12779b){return _0x12fe2c[_0x9c0e('0x1c')](_0x5d69a3);}return _0x12fe2c['status'](_0x5d69a3)[_0x9c0e('0x1d')]();};}function respondWithResult(_0x58c76c,_0x288f2f){_0x288f2f=_0x288f2f||0xc8;return function(_0x2aab1b){if(_0x2aab1b){return _0x58c76c[_0x9c0e('0x1e')](_0x288f2f)[_0x9c0e('0x1f')](_0x2aab1b);}};}function respondWithFilteredResult(_0x183a00,_0x5ccc66){return function(_0x212ca8){if(_0x212ca8){var _0x1914e8=typeof _0x5ccc66['offset']===_0x9c0e('0x20')&&typeof _0x5ccc66['limit']==='undefined';var _0x506e7e=_0x212ca8[_0x9c0e('0x21')];var _0x5b75a5=_0x1914e8?0x0:_0x5ccc66[_0x9c0e('0x22')];var _0x416950=_0x1914e8?_0x212ca8[_0x9c0e('0x21')]:_0x5ccc66[_0x9c0e('0x22')]+_0x5ccc66[_0x9c0e('0x23')];var _0x672e89;if(_0x416950>=_0x506e7e){_0x416950=_0x506e7e;_0x672e89=0xc8;}else{_0x672e89=0xce;}_0x183a00['status'](_0x672e89);return _0x183a00[_0x9c0e('0x24')]('Content-Range',_0x5b75a5+'-'+_0x416950+'/'+_0x506e7e)[_0x9c0e('0x1f')](_0x212ca8);}return null;};}function patchUpdates(_0xde2e03){return function(_0x3e6de6){try{jsonpatch['apply'](_0x3e6de6,_0xde2e03,!![]);}catch(_0x54b14b){return BPromise[_0x9c0e('0x25')](_0x54b14b);}return _0x3e6de6['save']();};}function saveUpdates(_0x4c732f,_0x4a35c4){return function(_0x5e1c09){if(_0x5e1c09){return _0x5e1c09[_0x9c0e('0x26')](_0x4c732f)['then'](function(_0x4b62b5){return _0x4b62b5;});}return null;};}function removeEntity(_0x598afa,_0x2c79b5){return function(_0x25ac5f){if(_0x25ac5f){return _0x25ac5f[_0x9c0e('0x27')]()[_0x9c0e('0x28')](function(){_0x598afa[_0x9c0e('0x1e')](0xcc)[_0x9c0e('0x1d')]();});}};}function handleEntityNotFound(_0x38ecf7,_0x300a9d){return function(_0xac1d71){if(!_0xac1d71){_0x38ecf7['sendStatus'](0x194);}return _0xac1d71;};}function handleError(_0x266109,_0x5af60e){_0x5af60e=_0x5af60e||0x1f4;return function(_0x1e6dde){logger[_0x9c0e('0x29')](_0x1e6dde['stack']);if(_0x1e6dde[_0x9c0e('0x2a')]){delete _0x1e6dde[_0x9c0e('0x2a')];}_0x266109[_0x9c0e('0x1e')](_0x5af60e)[_0x9c0e('0x2b')](_0x1e6dde);};}function getInteractionUsers(_0x11e069,_0x5d0cbc){return new BPromise(function(_0xa675dc,_0x30a4be){try{if(_0x5d0cbc[_0x11e069['id']]){_0x11e069[_0x9c0e('0x2c')]=_['map'](_0x5d0cbc[_0x11e069['id']],function(_0x3829f1){return{'id':_0x3829f1['id'],'fullname':_0x3829f1[_0x9c0e('0x2d')]};});}}catch(_0x3174cb){_0x30a4be(_0x3174cb);}_0xa675dc(_0x11e069);});}function getInteractionTags(_0x1d40e6,_0x3f1206){return new BPromise(function(_0x23d3ea,_0x4da986){try{if(_0x1d40e6[_0x9c0e('0x2e')]){_0x1d40e6[_0x9c0e('0x2f')]=[];_0x1d40e6['TagIds']['split'](',')['forEach'](function(_0x5b5601){_0x1d40e6[_0x9c0e('0x2f')][_0x9c0e('0x30')](_0x3f1206[_0x5b5601]);});}delete _0x1d40e6[_0x9c0e('0x2e')];}catch(_0x501320){_0x4da986(_0x501320);}_0x23d3ea(_0x1d40e6);});}function updateSmsInteraction(_0x5e53fa,_0x2cda79,_0xcbe02f){return new BPromise(function(_0x865afb,_0x5bd939){return getInteractionUsers(_0x5e53fa,_0xcbe02f)['then'](function(_0x5cf2b4){return getInteractionTags(_0x5cf2b4,_0x2cda79);})['then'](function(_0x2d20b3){_0x865afb(_0x2d20b3);})[_0x9c0e('0x31')](function(_0x533dc8){_0x5bd939(_0x533dc8);});});}exports[_0x9c0e('0x32')]=function(_0x59be93,_0x5e936f){var _0x57817c={},_0x35e392={},_0xc8f233={'count':0x0,'rows':[]};var _0x10e020=_['map'](db[_0x9c0e('0x33')][_0x9c0e('0x34')],function(_0x8f3d90){return{'name':_0x8f3d90[_0x9c0e('0x35')],'type':_0x8f3d90[_0x9c0e('0x36')]['key']};});_0x35e392[_0x9c0e('0x37')]=_[_0x9c0e('0x38')](_0x10e020,'name');_0x35e392[_0x9c0e('0x39')]=_['keys'](_0x59be93[_0x9c0e('0x39')]);_0x35e392[_0x9c0e('0x3a')]=_[_0x9c0e('0x3b')](_0x35e392['model'],_0x35e392[_0x9c0e('0x39')]);_0x57817c[_0x9c0e('0x3c')]=_[_0x9c0e('0x3b')](_0x35e392[_0x9c0e('0x37')],qs['fields'](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x3d')]));_0x57817c['attributes']=_0x57817c[_0x9c0e('0x3c')][_0x9c0e('0x3e')]?_0x57817c[_0x9c0e('0x3c')]:_0x35e392['model'];if(!_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x3f')](_0x9c0e('0x40'))){_0x57817c['limit']=qs['limit'](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x23')]);_0x57817c['offset']=qs[_0x9c0e('0x22')](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x22')]);}_0x57817c[_0x9c0e('0x41')]=qs[_0x9c0e('0x42')](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x42')]);_0x57817c[_0x9c0e('0x43')]=qs[_0x9c0e('0x3a')](_['pick'](_0x59be93[_0x9c0e('0x39')],_0x35e392[_0x9c0e('0x3a')]),_0x10e020);var _0x3b8f65=[];var _0x22670a=squel[_0x9c0e('0x44')]()[_0x9c0e('0x45')]('id')[_0x9c0e('0x45')]('name')['field'](_0x9c0e('0x46'))['from'](_0x9c0e('0x47'));var _0x4ed77c=squel[_0x9c0e('0x44')]()[_0x9c0e('0x45')]('u.id')[_0x9c0e('0x45')](_0x9c0e('0x48'))[_0x9c0e('0x45')](_0x9c0e('0x49'))[_0x9c0e('0x4a')]('user_has_sms_interactions','ui')[_0x9c0e('0x4b')]('users','u',_0x9c0e('0x4c'));var _0x4afe27=squel[_0x9c0e('0x44')]()['from']('sms_interactions','i')[_0x9c0e('0x4b')](_0x9c0e('0x4d'),'c',_0x9c0e('0x4e'))[_0x9c0e('0x4b')]('users','o',_0x9c0e('0x4f'))[_0x9c0e('0x4b')](_0x9c0e('0x50'),'a','a.id\x20=\x20i.SmsAccountId')[_0x9c0e('0x4b')]('sms_messages','me',_0x9c0e('0x51'))[_0x9c0e('0x4b')](_0x9c0e('0x52'),'it',_0x9c0e('0x53'))[_0x9c0e('0x4b')]('tools_tags','t',_0x9c0e('0x54'));var _0x3ed8f6=squel[_0x9c0e('0x55')]();var _0x42e6b5=[];var _0x622eed=squel['expr']();var _0x830be5;if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x56')]){_0x830be5=as[_0x9c0e('0x57')](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x56')]);var _0x5ecae2=_0x830be5['sqlOperator'];for(var _0x5776b3=0x0;_0x5776b3<_0x830be5[_0x9c0e('0x58')][_0x9c0e('0x3e')];_0x5776b3++){var _0x30ec03=_0x830be5[_0x9c0e('0x58')][_0x5776b3];var _0x287d6a='i';var _0x26b8d7=_['find'](_0x10e020,[_0x9c0e('0x2a'),_0x30ec03['field']]);if(!_0x26b8d7){switch(_0x30ec03['field']){case _0x9c0e('0x59'):if(_0x30ec03[_0x9c0e('0x5a')]==0x1){_0x4afe27[_0x9c0e('0x5b')]('`'+_0x30ec03[_0x9c0e('0x45')]+_0x9c0e('0x5c'));}else{_0x4afe27['having']('`'+_0x30ec03['field']+_0x9c0e('0x5d'));}break;case _0x9c0e('0x5e'):if(_0x30ec03[_0x9c0e('0x5f')]===_0x9c0e('0x60')){if(_0x30ec03[_0x9c0e('0x5a')]['split']('\x20')[_0x9c0e('0x3e')]>0x1){_0x3ed8f6[_0x5ecae2](_0x9c0e('0x61'),qs[_0x9c0e('0x62')](_0x30ec03[_0x9c0e('0x5a')]),null);}else{var _0x25ad5e='%'+_0x30ec03[_0x9c0e('0x5a')]+'%';_0x3ed8f6[_0x5ecae2](_0x9c0e('0x63'),_0x25ad5e,_0x25ad5e,_0x25ad5e);}}else{_0x26b8d7=_[_0x9c0e('0x64')](_0x10e020,[_0x9c0e('0x2a'),_0x9c0e('0x65')]);_0x30ec03[_0x9c0e('0x45')]='ContactId';_0x1b8575=as[_0x9c0e('0x66')](_0x287d6a,_0x26b8d7[_0x9c0e('0x36')],_0x30ec03);_0x3ed8f6[_0x5ecae2](_0x1b8575['text'],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x67')],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x1d')]);}break;case _0x9c0e('0x68'):var _0x42fdfb=_0x30ec03[_0x9c0e('0x5a')]['split'](',')['map'](function(_0x46771c){return Number(_0x46771c);});_0x42fdfb['forEach'](function(_0x474475){_0x622eed['or'](_0x9c0e('0x69'),'%,'+_0x474475+',%');});_0x42e6b5=_[_0x9c0e('0x6a')](_0x42e6b5,_0x42fdfb);break;case _0x9c0e('0x6b'):if(_0x30ec03[_0x9c0e('0x5f')]===_0x9c0e('0x60')){_0x3ed8f6[_0x5ecae2](_0x9c0e('0x6c'),'%'+_0x30ec03[_0x9c0e('0x5a')]+'%',null);}else{_0x26b8d7=_[_0x9c0e('0x64')](_0x10e020,[_0x9c0e('0x2a'),_0x9c0e('0x6d')]);_0x30ec03['field']='UserId';_0x1b8575=as[_0x9c0e('0x66')](_0x287d6a,_0x26b8d7[_0x9c0e('0x36')],_0x30ec03);_0x3ed8f6[_0x5ecae2](_0x1b8575[_0x9c0e('0x6e')],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x67')],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x1d')]);}break;case _0x9c0e('0x6f'):_0x1b8575=as[_0x9c0e('0x66')]('me',null,_0x30ec03);_0x3ed8f6[_0x5ecae2](_0x1b8575[_0x9c0e('0x6e')],_0x1b8575['value'][_0x9c0e('0x67')],_0x1b8575[_0x9c0e('0x5a')][_0x9c0e('0x1d')]);break;}}else{var _0x1b8575=as[_0x9c0e('0x66')](_0x287d6a,_0x26b8d7[_0x9c0e('0x36')],_0x30ec03);_0x3ed8f6[_0x5ecae2](_0x1b8575['text'],_0x1b8575['value'][_0x9c0e('0x67')],_0x1b8575[_0x9c0e('0x5a')]['end']);}}}else{var _0x44aec8=_(_0x59be93['query'])[_0x9c0e('0x70')]()[_0x9c0e('0x38')](function(_0x162a47){return _[_0x9c0e('0x71')](_0x10e020,[_0x9c0e('0x2a'),_0x162a47])?_0x162a47:undefined;})[_0x9c0e('0x72')]()['value']();if(!_['isEmpty'](_0x44aec8)){_0x44aec8['forEach'](function(_0xa0561b){if(_0xa0561b===_0x9c0e('0x73')){_0x4afe27[_0x9c0e('0x43')](_0x9c0e('0x74'),[]['concat'](_0x59be93[_0x9c0e('0x39')][_0xa0561b]));}else if(_0xa0561b===_0x9c0e('0x75')){var _0x4a3ecf=JSON[_0x9c0e('0x76')](_0x59be93[_0x9c0e('0x39')][_0xa0561b])[_0x9c0e('0x77')];var _0xff28b1=JSON[_0x9c0e('0x76')](_0x59be93[_0x9c0e('0x39')][_0xa0561b])[_0x9c0e('0x78')];_0x4afe27[_0x9c0e('0x43')](_0x9c0e('0x79'),_0x4a3ecf,_0xff28b1);}else{if(_0x59be93['query'][_0xa0561b]===_0x9c0e('0x7a')){_0x4afe27['where']('i.'+_0xa0561b+'\x20IS\x20NULL');}else{_0x4afe27[_0x9c0e('0x43')]('i.'+_0xa0561b+_0x9c0e('0x7b'),_0x59be93[_0x9c0e('0x39')][_0xa0561b]);}}});}if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7c')]){if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7c')]==0x1){_0x4afe27[_0x9c0e('0x5b')]('`unreadMessages`\x20=\x200');}else{_0x4afe27[_0x9c0e('0x5b')](_0x9c0e('0x7d'));}}if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7e')]){_0x42e6b5=_[_0x9c0e('0x7f')](_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7e')])?_0x59be93[_0x9c0e('0x39')]['tag']:new Array(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x7e')]);_0x42e6b5[_0x9c0e('0x80')](function(_0x28a151){_0x622eed['or'](_0x9c0e('0x69'),'%,'+_0x28a151+',%');});}if(_0x59be93['query'][_0x9c0e('0x81')]){var _0x20f35a=_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x81')][_0x9c0e('0x82')]('\x5c','\x5c\x5c')[_0x9c0e('0x82')](/'/g,'\x27\x27');if(qs[_0x9c0e('0x83')](_0x20f35a)){_0x3ed8f6['or'](_0x9c0e('0x84'),_0x20f35a+'%')['or'](_0x9c0e('0x85'),_0x20f35a+'%');}else{_0x3ed8f6['or'](_0x9c0e('0x86'),qs[_0x9c0e('0x62')](_0x20f35a))['or'](_0x9c0e('0x87'),_0x20f35a+'%');}}}_0x4afe27['where'](_0x3ed8f6);_0x4afe27[_0x9c0e('0x88')](_0x9c0e('0x89'));var _0x52df12={'type':db['Sequelize']['QueryTypes'][_0x9c0e('0x8a')],'raw':!![]};var _0x424e0a=_0x4afe27[_0x9c0e('0x8b')]();_0x424e0a[_0x9c0e('0x45')]('i.id');_0x424e0a[_0x9c0e('0x45')](_0x9c0e('0x8c'),_0x9c0e('0x59'));if(_0x57817c[_0x9c0e('0x41')]){_0x57817c[_0x9c0e('0x41')][_0x9c0e('0x80')](function(_0x1b1a90){var _0x2cc243=_0x1b1a90[0x0]===_0x9c0e('0x8d')?_0x1b1a90[0x0]:'i.'+_0x1b1a90[0x0];_0x4afe27['order'](_0x2cc243,_0x1b1a90[0x1]===_0x9c0e('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x42e6b5)){_0x4afe27[_0x9c0e('0x5b')](_0x622eed);_0x424e0a['where'](_0x9c0e('0x8f'),_0x42e6b5);}BPromise['resolve']()[_0x9c0e('0x28')](function(){if(!_0x830be5){if(_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x73')])return;_0x424e0a[_0x9c0e('0x43')](_0x9c0e('0x90'));_0x4afe27[_0x9c0e('0x43')](_0x9c0e('0x90'));return;}if(_0x59be93[_0x9c0e('0x91')][_0x9c0e('0x92')]!==_0x9c0e('0x93'))return;return _0x59be93[_0x9c0e('0x91')][_0x9c0e('0x94')]({'attributes':['id'],'raw':!![]})[_0x9c0e('0x28')](function(_0x3c21a7){if(_[_0x9c0e('0x95')](_0x3c21a7)){_0x424e0a[_0x9c0e('0x43')](_0x9c0e('0x96'));_0x4afe27[_0x9c0e('0x43')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x424e0a[_0x9c0e('0x43')](_0x9c0e('0x74'),_[_0x9c0e('0x38')](_0x3c21a7,'id'));_0x4afe27[_0x9c0e('0x43')](_0x9c0e('0x74'),_[_0x9c0e('0x38')](_0x3c21a7,'id'));}});})[_0x9c0e('0x28')](function(){if(_0x59be93[_0x9c0e('0x91')]['role']==='agent'&&!_0x830be5&&!_0x59be93[_0x9c0e('0x39')][_0x9c0e('0x73')])return[];return db['sequelize'][_0x9c0e('0x39')](_0x424e0a['toString'](),_0x52df12);})[_0x9c0e('0x28')](function(_0x57b5f0){_0xc8f233[_0x9c0e('0x21')]=_0x57b5f0[_0x9c0e('0x3e')];if(_0xc8f233[_0x9c0e('0x21')]===0x0)return[];return db['sequelize']['query'](_0x22670a[_0x9c0e('0x97')](),_0x52df12)[_0x9c0e('0x28')](function(_0xb3e0c7){_0x3b8f65=_['keyBy'](_0xb3e0c7,'id');_0x52df12=_['merge'](_0x52df12,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59be93[_0x9c0e('0x39')]['fields']){_0x57817c[_0x9c0e('0x3c')][_0x9c0e('0x80')](function(_0x2204e5){_0x4afe27[_0x9c0e('0x45')]('i.'+_0x2204e5);});}else{_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x8c'),'unreadMessages');_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x98'),_0x9c0e('0x99'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x9a'),'Account.mandatoryDisposition');_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x9b'),'contactName');_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0x9c'));_0x4afe27['field'](_0x9c0e('0x9d'),_0x9c0e('0x9e'));_0x4afe27['field'](_0x9c0e('0x9f'),_0x9c0e('0xa0'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xa1'),_0x9c0e('0xa2'));_0x4afe27['field'](_0x9c0e('0xa3'),_0x9c0e('0xa4'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xa5'),_0x9c0e('0xa6'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xa7'),'Contact.fax');_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xa8'),_0x9c0e('0xa9'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xaa'),_0x9c0e('0xab'));_0x4afe27[_0x9c0e('0x45')](_0x9c0e('0xac'),_0x9c0e('0x2e'));}if(_0x57817c[_0x9c0e('0x23')])_0x4afe27['limit'](_0x57817c[_0x9c0e('0x23')]);if(_0x57817c[_0x9c0e('0x22')])_0x4afe27[_0x9c0e('0x22')](_0x57817c[_0x9c0e('0x22')]);return db[_0x9c0e('0xad')][_0x9c0e('0x39')](_0x4afe27[_0x9c0e('0x97')](),_0x52df12);})[_0x9c0e('0x28')](function(_0x241bf6){if(_0x241bf6['length']>0x0)_0x4ed77c['where'](_0x9c0e('0xae'),_[_0x9c0e('0x38')](_0x241bf6,'id'));return db[_0x9c0e('0xad')][_0x9c0e('0x39')](_0x4ed77c[_0x9c0e('0x97')](),_0x52df12)[_0x9c0e('0x28')](function(_0x4525e6){var _0x5e73cc=_[_0x9c0e('0xaf')](_0x4525e6,_0x9c0e('0xb0'));var _0x3c5ba5=[];_0x241bf6[_0x9c0e('0x80')](function(_0x54b6e0){_0x3c5ba5[_0x9c0e('0x30')](updateSmsInteraction(_0x54b6e0,_0x3b8f65,_0x5e73cc));});return BPromise[_0x9c0e('0xb1')](_0x3c5ba5);});});})[_0x9c0e('0x28')](function(_0x3f5ea6){_0xc8f233['rows']=_0x3f5ea6;return _0xc8f233;})[_0x9c0e('0x28')](respondWithFilteredResult(_0x5e936f,_0x57817c))[_0x9c0e('0x31')](handleError(_0x5e936f,null));};exports[_0x9c0e('0xb2')]=function(_0x3cd10e,_0x3d8793){var _0x4e5e2d={'raw':![],'where':{'id':_0x3cd10e[_0x9c0e('0xb3')]['id']}},_0x538e01={};_0x538e01[_0x9c0e('0x37')]=_['keys'](db[_0x9c0e('0x33')][_0x9c0e('0x34')]);_0x538e01[_0x9c0e('0x39')]=_[_0x9c0e('0x70')](_0x3cd10e[_0x9c0e('0x39')]);_0x538e01[_0x9c0e('0x3a')]=_[_0x9c0e('0x3b')](_0x538e01['model'],_0x538e01['query']);_0x4e5e2d[_0x9c0e('0x3c')]=_[_0x9c0e('0x3b')](_0x538e01['model'],qs[_0x9c0e('0x3d')](_0x3cd10e[_0x9c0e('0x39')][_0x9c0e('0x3d')]));_0x4e5e2d[_0x9c0e('0x3c')]=_0x4e5e2d[_0x9c0e('0x3c')][_0x9c0e('0x3e')]?_0x4e5e2d[_0x9c0e('0x3c')]:_0x538e01[_0x9c0e('0x37')];if(_0x3cd10e['query']['includeAll']){_0x4e5e2d[_0x9c0e('0xb4')]=[{'all':!![]}];}_0x4e5e2d=_[_0x9c0e('0xb5')]({},_0x4e5e2d,_0x3cd10e['options']);return db[_0x9c0e('0x33')][_0x9c0e('0x64')](_0x4e5e2d)[_0x9c0e('0x28')](handleEntityNotFound(_0x3d8793,null))[_0x9c0e('0x28')](respondWithResult(_0x3d8793,null))[_0x9c0e('0x31')](handleError(_0x3d8793,null));};exports['create']=function(_0x4e0925,_0xcbcedd){return db[_0x9c0e('0x33')][_0x9c0e('0xb6')](_0x4e0925['body'],{})[_0x9c0e('0x28')](respondWithResult(_0xcbcedd,0xc9))['catch'](handleError(_0xcbcedd,null));};exports['update']=function(_0x5c7f53,_0x3b29c5){if(_0x5c7f53[_0x9c0e('0x6f')]['id']){delete _0x5c7f53[_0x9c0e('0x6f')]['id'];}return db[_0x9c0e('0x33')][_0x9c0e('0x64')]({'where':{'id':_0x5c7f53[_0x9c0e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3b29c5,null))[_0x9c0e('0x28')](saveUpdates(_0x5c7f53[_0x9c0e('0x6f')],null))[_0x9c0e('0x28')](respondWithResult(_0x3b29c5,null))[_0x9c0e('0x31')](handleError(_0x3b29c5,null));};exports['destroy']=function(_0xa789c2,_0x3d7160){return db[_0x9c0e('0x33')]['find']({'where':{'id':_0xa789c2[_0x9c0e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3d7160,null))[_0x9c0e('0x28')](removeEntity(_0x3d7160,null))['catch'](handleError(_0x3d7160,null));};exports['describe']=function(_0x34d570,_0x1a135b){return db[_0x9c0e('0x33')][_0x9c0e('0xb7')]()[_0x9c0e('0x28')](respondWithResult(_0x1a135b,null))[_0x9c0e('0x31')](handleError(_0x1a135b,null));};exports[_0x9c0e('0xb8')]=function(_0x5679f4,_0x3fc1cf,_0x50dfe0){return db[_0x9c0e('0xb9')][_0x9c0e('0x64')]({'where':{'id':_0x5679f4[_0x9c0e('0xb3')]['id']}})[_0x9c0e('0x28')](handleEntityNotFound(_0x3fc1cf,null))['then'](function(_0x5635d0){if(_0x5635d0){return _0x5635d0[_0x9c0e('0xb8')](_0x5679f4[_0x9c0e('0x6f')][_0x9c0e('0xba')],_[_0x9c0e('0xbb')](_0x5679f4[_0x9c0e('0x6f')],[_0x9c0e('0xba'),'id'])||{});}})['then'](respondWithResult(_0x3fc1cf,null))['catch'](handleError(_0x3fc1cf,null));};exports[_0x9c0e('0xbc')]=function(_0x5cc9ab,_0x55016e,_0x12aacc){var _0xd2786b={'raw':![],'where':{}};var _0x5b91f8={};var _0x2ea5f2={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x9c0e('0xbd')]({'where':{'id':_0x5cc9ab[_0x9c0e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x55016e,null))[_0x9c0e('0x28')](function(_0x2a926c){if(_0x2a926c){_0x5b91f8[_0x9c0e('0x37')]=_[_0x9c0e('0x70')](db['SmsMessage']['rawAttributes']);_0x5b91f8['query']=_[_0x9c0e('0x70')](_0x5cc9ab[_0x9c0e('0x39')]);_0x5b91f8[_0x9c0e('0x3a')]=_[_0x9c0e('0x3b')](_0x5b91f8['model'],_0x5b91f8[_0x9c0e('0x39')]);_0xd2786b[_0x9c0e('0x3c')]=_[_0x9c0e('0x3b')](_0x5b91f8['model'],qs[_0x9c0e('0x3d')](_0x5cc9ab['query'][_0x9c0e('0x3d')]));_0xd2786b['attributes']=_0xd2786b['attributes'][_0x9c0e('0x3e')]?_0xd2786b[_0x9c0e('0x3c')]:_0x5b91f8[_0x9c0e('0x37')];if(!_0x5cc9ab[_0x9c0e('0x39')]['hasOwnProperty'](_0x9c0e('0x40'))){_0xd2786b[_0x9c0e('0x23')]=qs[_0x9c0e('0x23')](_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x23')]);_0xd2786b[_0x9c0e('0x22')]=qs[_0x9c0e('0x22')](_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x22')]);}_0xd2786b[_0x9c0e('0x41')]=qs['sort'](_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x42')]);_0xd2786b[_0x9c0e('0x43')]=qs[_0x9c0e('0x3a')](_['pick'](_0x5cc9ab[_0x9c0e('0x39')],_0x5b91f8['filters']));_0xd2786b[_0x9c0e('0x43')][_0x9c0e('0xb0')]=_0x2a926c['id'];if(_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x81')]){_0xd2786b[_0x9c0e('0x43')]=_[_0x9c0e('0xb5')](_0xd2786b[_0x9c0e('0x43')],{'$or':_['map'](_0xd2786b[_0x9c0e('0x3c')],function(_0x434acb){var _0x1d8d9b={};_0x1d8d9b[_0x434acb]={'$like':'%'+_0x5cc9ab['query'][_0x9c0e('0x81')]+'%'};return _0x1d8d9b;})});}if(_0x5cc9ab[_0x9c0e('0x39')][_0x9c0e('0x77')]){var _0x14fa0e=_0x5cc9ab[_0x9c0e('0x39')]['$gte'][_0x9c0e('0xbe')](',');var _0xa1dd80={};_0xa1dd80[_0x14fa0e[0x0]]={'$gte':moment(_0x14fa0e[0x1])[_0x9c0e('0xbf')](_0x9c0e('0xc0'))};_0xd2786b['where']=_[_0x9c0e('0xb5')](_0xd2786b[_0x9c0e('0x43')],_0xa1dd80);}_0xd2786b=_['merge']({},_0xd2786b,_0x5cc9ab[_0x9c0e('0xc1')]);return db['SmsMessage']['count']({'where':_0xd2786b[_0x9c0e('0x43')]})[_0x9c0e('0x28')](function(_0x57f1eb){_0x2ea5f2[_0x9c0e('0x21')]=_0x57f1eb;if(_0x5cc9ab['query']['includeAll']){_0xd2786b['include']=[{'all':!![]}];}return db[_0x9c0e('0xb9')][_0x9c0e('0xc2')](_0xd2786b);})[_0x9c0e('0x28')](function(_0x3216cb){_0x2ea5f2[_0x9c0e('0xc3')]=_0x3216cb;return _0x2ea5f2;});}})[_0x9c0e('0x28')](respondWithFilteredResult(_0x55016e,_0xd2786b))['catch'](handleError(_0x55016e,null));};exports['addTags']=function(_0x33739c,_0x5af20c,_0x38f776){return db['SmsInteraction'][_0x9c0e('0x64')]({'where':{'id':_0x33739c['params']['id']}})[_0x9c0e('0x28')](handleEntityNotFound(_0x5af20c,null))[_0x9c0e('0x28')](function(_0x1f0741){if(_0x1f0741){return _0x1f0741[_0x9c0e('0xc4')](_0x33739c[_0x9c0e('0x6f')]['ids'],_['omit'](_0x33739c['body'],[_0x9c0e('0xba'),'id'])||{})[_0x9c0e('0xc5')](function(){return db[_0x9c0e('0x68')][_0x9c0e('0xc2')]({'attributes':['id',_0x9c0e('0x2a'),_0x9c0e('0x46')],'where':{'id':_0x33739c[_0x9c0e('0x6f')]['ids']}});})['then'](function(_0x11b143){socket[_0x9c0e('0xc6')](_0x9c0e('0xc7'),{'id':Number(_0x33739c[_0x9c0e('0xb3')]['id']),'tags':_0x11b143||[]});return{'id':Number(_0x33739c[_0x9c0e('0xb3')]['id']),'tags':_0x11b143||[]};});}})[_0x9c0e('0x28')](respondWithResult(_0x5af20c,null))[_0x9c0e('0x31')](handleError(_0x5af20c,null));};exports[_0x9c0e('0xc8')]=function(_0x3c7c39,_0x3a8b97,_0x5b6ff7){return db[_0x9c0e('0x33')][_0x9c0e('0x64')]({'where':{'id':_0x3c7c39[_0x9c0e('0xb3')]['id']}})[_0x9c0e('0x28')](handleEntityNotFound(_0x3a8b97,null))['then'](function(_0x54f616){if(_0x54f616){return _0x54f616[_0x9c0e('0xc8')](_0x3c7c39[_0x9c0e('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x3a8b97,null))[_0x9c0e('0x31')](handleError(_0x3a8b97,null));};exports[_0x9c0e('0xc9')]=function(_0x7f1b25,_0x278229){var _0x16615a=moment()[_0x9c0e('0xca')]()[_0x9c0e('0x97')]();var _0x517ada=path['join'](config[_0x9c0e('0xcb')],_0x9c0e('0xcc'),_0x9c0e('0xcd'),'tmp');var _0x2e9fd5=path[_0x9c0e('0xce')](config[_0x9c0e('0xcb')],_0x9c0e('0xcc'),_0x9c0e('0xcd'),_0x9c0e('0xcf'));var _0x12b8d3=path[_0x9c0e('0xce')](_0x517ada,_0x16615a);var _0x2f20ea=util['format']('transcript-%d-%s.zip',_0x7f1b25[_0x9c0e('0xb3')]['id'],_0x16615a);var _0x503d62=path['join'](_0x517ada,_0x2f20ea);var _0x1a1594=[];_0x1a1594[_0x9c0e('0x30')]({'model':db[_0x9c0e('0x6b')],'as':'User','attributes':['id',_0x9c0e('0x2d')],'raw':!![]});_0x1a1594[_0x9c0e('0x30')]({'model':db[_0x9c0e('0xd0')],'as':_0x9c0e('0x5e'),'attributes':['id','firstName',_0x9c0e('0xd1')],'raw':!![]});var _0x175e0f=[{'model':db[_0x9c0e('0xb9')],'as':_0x9c0e('0xd2'),'attributes':['id','body',_0x9c0e('0x75'),_0x9c0e('0xd3'),'secret','read'],'include':_0x1a1594}];_0x175e0f[_0x9c0e('0x30')]({'model':db[_0x9c0e('0xd4')],'as':'Account','attributes':['id','name']});_0x175e0f[_0x9c0e('0x30')]({'model':db[_0x9c0e('0x6b')],'as':'Owner','attributes':['id',_0x9c0e('0x2d')]});return db[_0x9c0e('0x33')]['find']({'where':{'id':_0x7f1b25[_0x9c0e('0xb3')]['id']},'include':_0x175e0f})[_0x9c0e('0x28')](handleEntityNotFound(_0x278229,null))['then'](function(_0x1f4c7e){if(_0x1f4c7e){var _0x596cb1=_0x1f4c7e['get']({'plain':!![]});fs[_0x9c0e('0xd5')](_0x12b8d3);var _0x2a4b57={'channel':_0x9c0e('0xd6'),'account':_0x596cb1[_0x9c0e('0xd7')]['name'],'agent':_0x596cb1[_0x9c0e('0xd8')]?_0x596cb1[_0x9c0e('0xd8')][_0x9c0e('0x2d')]:_0x9c0e('0xd9'),'createdAt':moment(_0x596cb1[_0x9c0e('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x596cb1[_0x9c0e('0xda')]?moment(_0x596cb1[_0x9c0e('0xdb')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9c0e('0x97')]():'','disposition':_0x596cb1['disposition'],'messages':_(_0x596cb1['Messages'])[_0x9c0e('0x81')]({'secret':![]})[_0x9c0e('0x38')](function(_0xa107e8){return{'date':moment(_0xa107e8['createdAt'])[_0x9c0e('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9c0e('0x97')](),'sender':_0xa107e8['direction']===_0x9c0e('0xdc')?_0xa107e8['User']?_0xa107e8[_0x9c0e('0x6b')][_0x9c0e('0x2d')]:'System':_0xa107e8['Contact'][_0x9c0e('0xdd')]+(_0xa107e8[_0x9c0e('0x5e')][_0x9c0e('0xd1')]?'\x20'+_0xa107e8['Contact'][_0x9c0e('0xd1')]:''),'body':_0xa107e8[_0x9c0e('0x6f')],'direction':_0xa107e8[_0x9c0e('0xd3')]==='out'?'A':'C','secret':_0xa107e8[_0x9c0e('0xde')],'read':_0xa107e8[_0x9c0e('0x7c')]};})['value']()};return ejs[_0x9c0e('0xdf')](path[_0x9c0e('0xce')](config[_0x9c0e('0xcb')],_0x9c0e('0xcc'),_0x9c0e('0xe0'),_0x9c0e('0xe1')),{'interaction':_0x2a4b57})[_0x9c0e('0x28')](function(_0x38b5db){var _0x31451f=path[_0x9c0e('0xce')](_0x12b8d3,'transcript-'+_0x596cb1['id']+'-'+_0x16615a+_0x9c0e('0xe2'));var _0x330912={'path':_0x31451f,'channel':_0x9c0e('0xd6'),'interactionId':_0x596cb1['id']};return pdf[_0x9c0e('0xe3')](_0x38b5db,_0x330912);})[_0x9c0e('0x28')](function(){return new BPromise(function(_0x202458,_0x458581){zipdir(_0x12b8d3,{'saveTo':_0x503d62},function(_0x5886bd,_0x15c34d){if(_0x5886bd)return _0x458581(_0x5886bd);return _0x202458(_0x15c34d);});})[_0x9c0e('0x28')](function(){return new BPromise(function(_0x1b7872,_0x1f70af){rimraf(_0x12b8d3,function(_0x5a2a95){if(_0x5a2a95)_0x1f70af(_0x5a2a95);return _0x1b7872();});});})[_0x9c0e('0x28')](function(){return _0x278229[_0x9c0e('0xc9')](_0x503d62,_0x2f20ea,function(_0x6d22a8){if(_0x6d22a8){console['log'](_0x9c0e('0xe4'),_0x6d22a8);}else{fs[_0x9c0e('0xe5')](_0x503d62);}});});});}else{return _0x278229['sendStatus'](0xc8);}})['catch'](handleError(_0x278229,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index fd876e3..95d618f 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 _0x0120=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','then','unreadMessages','emit','catch'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x0120,0x6f));var _0x0012=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0120[_0x4154a6];return _0x3b2786;};'use strict';var EventEmitter=require(_0x0012('0x0'));var SmsInteraction=require(_0x0012('0x1'))['db'][_0x0012('0x2')];var SmsMessage=require(_0x0012('0x1'))['db'][_0x0012('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0012('0x4')](0x0);var events={'afterCreate':_0x0012('0x5'),'afterUpdate':_0x0012('0x6'),'afterDestroy':_0x0012('0x7')};function emitEvent(_0x302029){return function(_0x3505ab,_0x3fcfbc,_0x4eaa5b){_0x3505ab['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x95d441){_0x3505ab[_0x0012('0x8')](_0x0012('0x9'),_0x95d441[_0x0012('0xa')](function(_0x33c82f){return{'id':_0x33c82f['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3505ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0012('0xb')](function(_0x2d484c){_0x3505ab[_0x0012('0x8')](_0x0012('0xc'),_0x2d484c['length']);SmsInteractionEvents[_0x0012('0xd')](_0x302029+':'+_0x3505ab['id'],_0x3505ab);SmsInteractionEvents['emit'](_0x302029,_0x3505ab);_0x4eaa5b(null);})[_0x0012('0xe')](_0x4eaa5b(null));};}for(var e in events){if(events[_0x0012('0xf')](e)){var event=events[e];SmsInteraction[_0x0012('0x10')](e,emitEvent(event));}}module[_0x0012('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x5c3c=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x4ce612,_0x2da0ff){var _0x109457=function(_0x2ab698){while(--_0x2ab698){_0x4ce612['push'](_0x4ce612['shift']());}};_0x109457(++_0x2da0ff);}(_0x5c3c,0x132));var _0xc5c3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5c3c[_0x5d4607];return _0x5e4a86;};'use strict';var EventEmitter=require(_0xc5c3('0x0'));var SmsInteraction=require(_0xc5c3('0x1'))['db'][_0xc5c3('0x2')];var SmsMessage=require(_0xc5c3('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5c3('0x3')](0x0);var events={'afterCreate':_0xc5c3('0x4'),'afterUpdate':_0xc5c3('0x5'),'afterDestroy':_0xc5c3('0x6')};function emitEvent(_0x2535e0){return function(_0x36525d,_0xe85098,_0x23a6b5){_0x36525d[_0xc5c3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8404){_0x36525d['setDataValue'](_0xc5c3('0x8'),_0x4b8404[_0xc5c3('0x9')](function(_0x593b35){return{'id':_0x593b35['id']};}));return SmsMessage[_0xc5c3('0xa')]({'where':{'SmsInteractionId':_0x36525d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5c3('0xb')](function(_0x52f3eb){_0x36525d[_0xc5c3('0xc')](_0xc5c3('0xd'),_0x52f3eb['length']);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0+':'+_0x36525d['id'],_0x36525d);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0,_0x36525d);_0x23a6b5(null);})[_0xc5c3('0xf')](_0x23a6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc5c3('0x10')](e,emitEvent(event));}}module[_0xc5c3('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 46edb6f..f39fbb0 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 _0x8e18=['SmsInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x5a107c,_0x32a825){var _0x1db6e9=function(_0x1684e6){while(--_0x1684e6){_0x5a107c['push'](_0x5a107c['shift']());}};_0x1db6e9(++_0x32a825);}(_0x8e18,0x1f3));var _0x88e1=function(_0x870bbb,_0x150783){_0x870bbb=_0x870bbb-0x0;var _0x286d46=_0x8e18[_0x870bbb];return _0x286d46;};'use strict';var _=require(_0x88e1('0x0'));var util=require(_0x88e1('0x1'));var logger=require(_0x88e1('0x2'))(_0x88e1('0x3'));var moment=require(_0x88e1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x88e1('0x5'));var rimraf=require(_0x88e1('0x6'));var config=require(_0x88e1('0x7'));var attributes=require(_0x88e1('0x8'));module[_0x88e1('0x9')]=function(_0x9b821d,_0x834c3d){return _0x9b821d[_0x88e1('0xa')](_0x88e1('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f2c04,_0x29db20,_0x46b74f){if(_0x4f2c04['changed']('closed')){_0x4f2c04[_0x88e1('0xc')]=moment()[_0x88e1('0xd')](_0x88e1('0xe'));}_0x46b74f(null,_0x4f2c04);}}});}; \ No newline at end of file +var _0x77b8=['bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x20b4c9,_0x2afe53){var _0x5116d0=function(_0x5007af){while(--_0x5007af){_0x20b4c9['push'](_0x20b4c9['shift']());}};_0x5116d0(++_0x2afe53);}(_0x77b8,0x83));var _0x877b=function(_0x1e818b,_0x5b4d11){_0x1e818b=_0x1e818b-0x0;var _0x3fb087=_0x77b8[_0x1e818b];return _0x3fb087;};'use strict';var _=require('lodash');var util=require(_0x877b('0x0'));var logger=require(_0x877b('0x1'))(_0x877b('0x2'));var moment=require(_0x877b('0x3'));var BPromise=require(_0x877b('0x4'));var rp=require(_0x877b('0x5'));var fs=require('fs');var path=require(_0x877b('0x6'));var rimraf=require(_0x877b('0x7'));var config=require(_0x877b('0x8'));var attributes=require(_0x877b('0x9'));module[_0x877b('0xa')]=function(_0x399029,_0x582d21){return _0x399029['define']('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45b0d9,_0x546b31,_0x1e2bfa){if(_0x45b0d9[_0x877b('0xb')]('closed')){_0x45b0d9[_0x877b('0xc')]=moment()[_0x877b('0xd')](_0x877b('0xe'));}_0x1e2bfa(null,_0x45b0d9);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6fe3880..cf94575 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 _0x29b7=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToSmsInteraction','SmsInteraction','find','ids','omit','spread','AddTags','lodash'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x29b7,0x7a));var _0x729b=function(_0x2c6232,_0x365b53){_0x2c6232=_0x2c6232-0x0;var _0x55b668=_0x29b7[_0x2c6232];return _0x55b668;};'use strict';var _=require(_0x729b('0x0'));var util=require(_0x729b('0x1'));var moment=require(_0x729b('0x2'));var BPromise=require('bluebird');var rs=require(_0x729b('0x3'));var fs=require('fs');var Redis=require(_0x729b('0x4'));var db=require(_0x729b('0x5'))['db'];var utils=require(_0x729b('0x6'));var logger=require(_0x729b('0x7'))('rpc');var config=require(_0x729b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x729b('0x9')]({'port':0x232a});config[_0x729b('0xa')]=_['defaults'](config[_0x729b('0xa')],{'host':_0x729b('0xb'),'port':0x18eb});var socket=require(_0x729b('0xc'))(new Redis(config[_0x729b('0xa')]));require(_0x729b('0xd'))['register'](socket);function respondWithRpcPromise(_0x46c0fe,_0x14213c,_0x192a6a){return new BPromise(function(_0x35f2cb,_0x278195){return client[_0x729b('0xe')](_0x46c0fe,_0x192a6a)[_0x729b('0xf')](function(_0x4f7dfe){logger[_0x729b('0x10')](_0x729b('0x11'),_0x14213c,'request\x20sent');logger[_0x729b('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x14213c,'request\x20sent',JSON[_0x729b('0x13')](_0x4f7dfe));if(_0x4f7dfe[_0x729b('0x14')]){if(_0x4f7dfe[_0x729b('0x14')][_0x729b('0x15')]===0x1f4){logger[_0x729b('0x14')](_0x729b('0x11'),_0x14213c,_0x4f7dfe['error']['message']);return _0x278195(_0x4f7dfe[_0x729b('0x14')]['message']);}logger['error'](_0x729b('0x11'),_0x14213c,_0x4f7dfe[_0x729b('0x14')][_0x729b('0x16')]);return _0x35f2cb(_0x4f7dfe[_0x729b('0x14')][_0x729b('0x16')]);}else{logger[_0x729b('0x10')](_0x729b('0x11'),_0x14213c,_0x729b('0x17'));_0x35f2cb(_0x4f7dfe[_0x729b('0x18')]['message']);}})['catch'](function(_0x29de09){logger[_0x729b('0x14')](_0x729b('0x11'),_0x14213c,_0x29de09);_0x278195(_0x29de09);});});}exports[_0x729b('0x19')]=function(_0x9b71a6){var _0x1b8139=this;return new Promise(function(_0x1e7476,_0xeb550d){return db['SmsInteraction'][_0x729b('0x1a')](_0x9b71a6[_0x729b('0x1b')],{'raw':_0x9b71a6[_0x729b('0x1c')]?_0x9b71a6[_0x729b('0x1c')][_0x729b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9b71a6[_0x729b('0x1c')]?_0x9b71a6[_0x729b('0x1c')][_0x729b('0x1e')]||null:null,'attributes':_0x9b71a6[_0x729b('0x1c')]?_0x9b71a6[_0x729b('0x1c')][_0x729b('0x1f')]||null:null,'limit':_0x9b71a6[_0x729b('0x1c')]?_0x9b71a6[_0x729b('0x1c')][_0x729b('0x20')]||null:null})[_0x729b('0xf')](function(_0x1a2dbd){logger[_0x729b('0x10')](_0x729b('0x19'),_0x9b71a6);logger[_0x729b('0x12')](_0x729b('0x19'),_0x9b71a6,JSON['stringify'](_0x1a2dbd));_0x1e7476(_0x1a2dbd);})[_0x729b('0x21')](function(_0x56c964){logger[_0x729b('0x14')]('UpdateSmsInteraction',_0x56c964[_0x729b('0x16')],_0x9b71a6);_0xeb550d(_0x1b8139['error'](0x1f4,_0x56c964[_0x729b('0x16')]));});});};exports[_0x729b('0x22')]=function(_0x4d54e2){return new Promise(function(_0x4ea6a2,_0x2112ed){return db[_0x729b('0x23')][_0x729b('0x24')]({'where':_0x4d54e2['options']?_0x4d54e2[_0x729b('0x1c')][_0x729b('0x1e')]||null:null})[_0x729b('0xf')](function(_0x10a8b8){if(_0x10a8b8){return _0x10a8b8['addTags'](_0x4d54e2[_0x729b('0x1b')][_0x729b('0x25')],_[_0x729b('0x26')](_0x4d54e2[_0x729b('0x1b')],[_0x729b('0x25'),'id'])||{});}})[_0x729b('0x27')](function(_0xc7b2c8){logger[_0x729b('0x10')]('AddTags',_0x4d54e2);logger[_0x729b('0x12')](_0x729b('0x28'),_0x4d54e2,JSON['stringify'](_0xc7b2c8));_0x4ea6a2(_0xc7b2c8);})[_0x729b('0x21')](function(_0x2dd475){logger[_0x729b('0x14')](_0x729b('0x28'),_0x2dd475[_0x729b('0x16')],_0x4d54e2);_0x2112ed(_this['error'](0x1f4,_0x2dd475[_0x729b('0x16')]));});});}; \ No newline at end of file +var _0x57c4=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsInteraction','update','raw','options','where','attributes','UpdateSmsInteraction','debug','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash'];(function(_0x448d1f,_0x4d00aa){var _0x13cbdb=function(_0x2a1bd5){while(--_0x2a1bd5){_0x448d1f['push'](_0x448d1f['shift']());}};_0x13cbdb(++_0x4d00aa);}(_0x57c4,0x182));var _0x457c=function(_0x5695dd,_0x5ad219){_0x5695dd=_0x5695dd-0x0;var _0x37b684=_0x57c4[_0x5695dd];return _0x37b684;};'use strict';var _=require(_0x457c('0x0'));var util=require(_0x457c('0x1'));var moment=require(_0x457c('0x2'));var BPromise=require(_0x457c('0x3'));var rs=require(_0x457c('0x4'));var fs=require('fs');var Redis=require(_0x457c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x457c('0x6'));var logger=require(_0x457c('0x7'))('rpc');var config=require(_0x457c('0x8'));var jayson=require(_0x457c('0x9'));var client=jayson[_0x457c('0xa')][_0x457c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x457c('0xc')],{'host':_0x457c('0xd'),'port':0x18eb});var socket=require(_0x457c('0xe'))(new Redis(config[_0x457c('0xc')]));require('./smsInteraction.socket')[_0x457c('0xf')](socket);function respondWithRpcPromise(_0x26ebe9,_0x524eed,_0x304387){return new BPromise(function(_0x5bf57e,_0x11efa9){return client[_0x457c('0x10')](_0x26ebe9,_0x304387)[_0x457c('0x11')](function(_0x598717){logger[_0x457c('0x12')](_0x457c('0x13'),_0x524eed,'request\x20sent');logger['debug'](_0x457c('0x14'),_0x524eed,_0x457c('0x15'),JSON[_0x457c('0x16')](_0x598717));if(_0x598717[_0x457c('0x17')]){if(_0x598717[_0x457c('0x17')]['code']===0x1f4){logger[_0x457c('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x524eed,_0x598717[_0x457c('0x17')][_0x457c('0x18')]);return _0x11efa9(_0x598717[_0x457c('0x17')][_0x457c('0x18')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x524eed,_0x598717[_0x457c('0x17')][_0x457c('0x18')]);return _0x5bf57e(_0x598717[_0x457c('0x17')][_0x457c('0x18')]);}else{logger[_0x457c('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x524eed,_0x457c('0x15'));_0x5bf57e(_0x598717[_0x457c('0x19')]['message']);}})[_0x457c('0x1a')](function(_0x5ea97b){logger[_0x457c('0x17')](_0x457c('0x13'),_0x524eed,_0x5ea97b);_0x11efa9(_0x5ea97b);});});}exports['UpdateSmsInteraction']=function(_0x445636){var _0x3f22e3=this;return new Promise(function(_0x3baaab,_0x2a37dd){return db[_0x457c('0x1b')][_0x457c('0x1c')](_0x445636['body'],{'raw':_0x445636['options']?_0x445636['options'][_0x457c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x445636[_0x457c('0x1e')]?_0x445636[_0x457c('0x1e')][_0x457c('0x1f')]||null:null,'attributes':_0x445636[_0x457c('0x1e')]?_0x445636[_0x457c('0x1e')][_0x457c('0x20')]||null:null,'limit':_0x445636[_0x457c('0x1e')]?_0x445636[_0x457c('0x1e')]['limit']||null:null})[_0x457c('0x11')](function(_0x5dc65a){logger[_0x457c('0x12')](_0x457c('0x21'),_0x445636);logger[_0x457c('0x22')](_0x457c('0x21'),_0x445636,JSON[_0x457c('0x16')](_0x5dc65a));_0x3baaab(_0x5dc65a);})[_0x457c('0x1a')](function(_0x254fd5){logger[_0x457c('0x17')]('UpdateSmsInteraction',_0x254fd5[_0x457c('0x18')],_0x445636);_0x2a37dd(_0x3f22e3[_0x457c('0x17')](0x1f4,_0x254fd5[_0x457c('0x18')]));});});};exports[_0x457c('0x23')]=function(_0x25a352){return new Promise(function(_0x4dfb06,_0x1bcc6a){return db[_0x457c('0x1b')][_0x457c('0x24')]({'where':_0x25a352[_0x457c('0x1e')]?_0x25a352[_0x457c('0x1e')][_0x457c('0x1f')]||null:null})[_0x457c('0x11')](function(_0x41e645){if(_0x41e645){return _0x41e645[_0x457c('0x25')](_0x25a352[_0x457c('0x26')][_0x457c('0x27')],_[_0x457c('0x28')](_0x25a352['body'],[_0x457c('0x27'),'id'])||{});}})[_0x457c('0x29')](function(_0x5da587){logger[_0x457c('0x12')](_0x457c('0x2a'),_0x25a352);logger['debug'](_0x457c('0x2a'),_0x25a352,JSON[_0x457c('0x16')](_0x5da587));_0x4dfb06(_0x5da587);})[_0x457c('0x1a')](function(_0x447225){logger[_0x457c('0x17')](_0x457c('0x2a'),_0x447225[_0x457c('0x18')],_0x25a352);_0x1bcc6a(_this[_0x457c('0x17')](0x1f4,_0x447225[_0x457c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index cbd1f47..dfd2d4c 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 _0x4fee=['update','emit','removeListener','length','smsInteraction:','save','remove'];(function(_0x5b8330,_0x57059d){var _0x1ce363=function(_0x261c60){while(--_0x261c60){_0x5b8330['push'](_0x5b8330['shift']());}};_0x1ce363(++_0x57059d);}(_0x4fee,0x16a));var _0xe4fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fee[_0x3dd15e];return _0x231fd0;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xe4fe('0x0'),_0xe4fe('0x1'),_0xe4fe('0x2')];function createListener(_0x475049,_0xc01486){return function(_0x23ad8a){_0xc01486[_0xe4fe('0x3')](_0x475049,_0x23ad8a);};}function removeListener(_0x475e70,_0xe6e272){return function(){SmsInteractionEvents[_0xe4fe('0x4')](_0x475e70,_0xe6e272);};}exports['register']=function(_0x59f934){for(var _0x409504=0x0,_0x4b1f5c=events[_0xe4fe('0x5')];_0x409504<_0x4b1f5c;_0x409504++){var _0x2a0926=events[_0x409504];var _0x251c9e=createListener(_0xe4fe('0x6')+_0x2a0926,_0x59f934);SmsInteractionEvents['on'](_0x2a0926,_0x251c9e);}}; \ No newline at end of file +var _0xed62=['update','emit','removeListener','register','length','./smsInteraction.events','save'];(function(_0x15a4bc,_0x59bd7a){var _0x206fb6=function(_0x232372){while(--_0x232372){_0x15a4bc['push'](_0x15a4bc['shift']());}};_0x206fb6(++_0x59bd7a);}(_0xed62,0x8a));var _0x2ed6=function(_0x3314aa,_0x40cdb5){_0x3314aa=_0x3314aa-0x0;var _0x34ed53=_0xed62[_0x3314aa];return _0x34ed53;};'use strict';var SmsInteractionEvents=require(_0x2ed6('0x0'));var events=[_0x2ed6('0x1'),'remove',_0x2ed6('0x2')];function createListener(_0x125c01,_0x25bb12){return function(_0x8483f4){_0x25bb12[_0x2ed6('0x3')](_0x125c01,_0x8483f4);};}function removeListener(_0x44dc01,_0x3b9d54){return function(){SmsInteractionEvents[_0x2ed6('0x4')](_0x44dc01,_0x3b9d54);};}exports[_0x2ed6('0x5')]=function(_0x732702){for(var _0x4378f9=0x0,_0x9092ef=events[_0x2ed6('0x6')];_0x4378f9<_0x9092ef;_0x4378f9++){var _0x5871f9=events[_0x4378f9];var _0x220488=createListener('smsInteraction:'+_0x5871f9,_0x732702);SmsInteractionEvents['on'](_0x5871f9,_0x220488);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6424127..552f10f 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 _0x74f4=['/:id/status','status','put','/:id/accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create'];(function(_0x1f1feb,_0x5782e1){var _0x43ca65=function(_0x1a4c12){while(--_0x1a4c12){_0x1f1feb['push'](_0x1f1feb['shift']());}};_0x43ca65(++_0x5782e1);}(_0x74f4,0xaa));var _0x474f=function(_0x58b033,_0x1b0f7d){_0x58b033=_0x58b033-0x0;var _0x5d9f83=_0x74f4[_0x58b033];return _0x5d9f83;};'use strict';var multer=require(_0x474f('0x0'));var util=require(_0x474f('0x1'));var path=require('path');var timeout=require(_0x474f('0x2'));var express=require(_0x474f('0x3'));var router=express['Router']();var fs_extra=require(_0x474f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x474f('0x5'));var config=require(_0x474f('0x6'));var controller=require(_0x474f('0x7'));router['get']('/',auth[_0x474f('0x8')](),controller[_0x474f('0x9')]);router[_0x474f('0xa')](_0x474f('0xb'),auth[_0x474f('0x8')](),controller[_0x474f('0xc')]);router[_0x474f('0xa')](_0x474f('0xd'),auth[_0x474f('0x8')](),controller[_0x474f('0xe')]);router[_0x474f('0xf')]('/',auth['isAuthenticated'](),interaction[_0x474f('0x10')](_0x474f('0x11'),_0x474f('0x12')),controller['create']);router[_0x474f('0xf')](_0x474f('0x13'),controller[_0x474f('0x14')]);router['put'](_0x474f('0xd'),auth[_0x474f('0x8')](),controller['update']);router[_0x474f('0x15')](_0x474f('0x16'),auth[_0x474f('0x8')](),controller['accept']);router[_0x474f('0x15')](_0x474f('0x17'),auth[_0x474f('0x8')](),controller[_0x474f('0x18')]);router[_0x474f('0x19')](_0x474f('0xd'),auth[_0x474f('0x8')](),controller['destroy']);module[_0x474f('0x1a')]=router; \ No newline at end of file +var _0xf4d6=['index','get','/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xf4d6,0xc6));var _0x6f4d=function(_0x2becd6,_0x2f2736){_0x2becd6=_0x2becd6-0x0;var _0x441866=_0xf4d6[_0x2becd6];return _0x441866;};'use strict';var multer=require(_0x6f4d('0x0'));var util=require(_0x6f4d('0x1'));var path=require(_0x6f4d('0x2'));var timeout=require(_0x6f4d('0x3'));var express=require(_0x6f4d('0x4'));var router=express[_0x6f4d('0x5')]();var fs_extra=require(_0x6f4d('0x6'));var auth=require(_0x6f4d('0x7'));var interaction=require(_0x6f4d('0x8'));var config=require(_0x6f4d('0x9'));var controller=require(_0x6f4d('0xa'));router['get']('/',auth[_0x6f4d('0xb')](),controller[_0x6f4d('0xc')]);router[_0x6f4d('0xd')]('/describe',auth[_0x6f4d('0xb')](),controller['describe']);router[_0x6f4d('0xd')](_0x6f4d('0xe'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0xf')]);router[_0x6f4d('0x10')]('/',auth[_0x6f4d('0xb')](),interaction[_0x6f4d('0x11')]('sms',_0x6f4d('0x12')),controller[_0x6f4d('0x13')]);router[_0x6f4d('0x10')](_0x6f4d('0x14'),controller[_0x6f4d('0x15')]);router[_0x6f4d('0x16')]('/:id',auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x17')]);router[_0x6f4d('0x16')](_0x6f4d('0x18'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x19')]);router[_0x6f4d('0x16')](_0x6f4d('0x1a'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x1b')]);router['delete'](_0x6f4d('0xe'),auth[_0x6f4d('0xb')](),controller[_0x6f4d('0x1c')]);module[_0x6f4d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 3dfbfb5..47b5951 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 _0x3c70=['out','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c70,0x10c));var _0x03c7=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x3c70[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x03c7('0x0'));module[_0x03c7('0x1')]={'body':{'type':Sequelize[_0x03c7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x03c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x03c7('0x4')]('in',_0x03c7('0x5')),'defaultValue':_0x03c7('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x03c7('0x6')](0xbe)},'phone':{'type':Sequelize[_0x03c7('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x03c7('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x03c7('0x2')]}}; \ No newline at end of file +var _0x79e5=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4f096e,_0x30d3c3){var _0x4a33ce=function(_0x107ba6){while(--_0x107ba6){_0x4f096e['push'](_0x4f096e['shift']());}};_0x4a33ce(++_0x30d3c3);}(_0x79e5,0x170));var _0x579e=function(_0x497f2a,_0x563b7d){_0x497f2a=_0x497f2a-0x0;var _0x5359e4=_0x79e5[_0x497f2a];return _0x5359e4;};'use strict';var Sequelize=require(_0x579e('0x0'));module['exports']={'body':{'type':Sequelize[_0x579e('0x1')](_0x579e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x579e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x579e('0x4')]('in','out'),'defaultValue':_0x579e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x579e('0x6')](0xbe)},'phone':{'type':Sequelize[_0x579e('0x6')]},'readAt':{'type':Sequelize[_0x579e('0x7')]},'secret':{'type':Sequelize[_0x579e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x579e('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index c395ea0..d57130a 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 _0x820b=['describe','sms','readAt','format','UserId','user','agent','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','sms-interactions','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','User','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','results','DELIVERED','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','end','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','keys','options','find','create','body','destroy','params'];(function(_0xa18827,_0x42c1ea){var _0xd39df8=function(_0x211ce6){while(--_0x211ce6){_0xa18827['push'](_0xa18827['shift']());}};_0xd39df8(++_0x42c1ea);}(_0x820b,0x1ee));var _0xb820=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x820b[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xb820('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb820('0x1'));var rp=require(_0xb820('0x2'));var moment=require(_0xb820('0x3'));var BPromise=require(_0xb820('0x4'));var Mustache=require(_0xb820('0x5'));var util=require('util');var path=require(_0xb820('0x6'));var sox=require(_0xb820('0x7'));var csv=require(_0xb820('0x8'));var ejs=require(_0xb820('0x9'));var fs=require('fs');var fs_extra=require(_0xb820('0xa'));var _=require(_0xb820('0xb'));var squel=require(_0xb820('0xc'));var crypto=require(_0xb820('0xd'));var jsforce=require(_0xb820('0xe'));var deskjs=require(_0xb820('0xf'));var toCsv=require(_0xb820('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb820('0x10'));var authService=require(_0xb820('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb820('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb820('0x13'))('api');var utils=require(_0xb820('0x14'));var config=require(_0xb820('0x15'));var licenseUtil=require(_0xb820('0x16'));var db=require(_0xb820('0x17'))['db'];config[_0xb820('0x18')]=_[_0xb820('0x19')](config['redis'],{'host':_0xb820('0x1a'),'port':0x18eb});var socket=require(_0xb820('0x1b'))(new Redis(config[_0xb820('0x18')]));require(_0xb820('0x1c'))[_0xb820('0x1d')](socket);var jayson=require(_0xb820('0x1e'));var client=jayson[_0xb820('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xb820('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e6301,_0x1d4be7,_0x3f5175,_0xa9a61c){return new BPromise(function(_0x3c851f,_0x4b4c3f){var _0x30dd1b=_0xa9a61c||client;return _0x30dd1b[_0xb820('0x20')](_0x3e6301,_0x3f5175)[_0xb820('0x21')](function(_0x291812){logger[_0xb820('0x22')]('SmsMessage,\x20%s,\x20%s',_0x1d4be7,_0xb820('0x23'));logger[_0xb820('0x24')](_0xb820('0x25'),_0x1d4be7,_0xb820('0x23'),JSON['stringify'](_0x291812));if(_0x291812[_0xb820('0x26')]){if(_0x291812[_0xb820('0x26')]['code']===0x1f4){logger['error'](_0xb820('0x27'),_0x1d4be7,_0x291812[_0xb820('0x26')][_0xb820('0x28')]);return _0x4b4c3f(_0x291812[_0xb820('0x26')][_0xb820('0x28')]);}logger['error'](_0xb820('0x27'),_0x1d4be7,_0x291812[_0xb820('0x26')][_0xb820('0x28')]);return _0x3c851f(_0x291812['error'][_0xb820('0x28')]);}else{logger[_0xb820('0x22')](_0xb820('0x27'),_0x1d4be7,_0xb820('0x23'));_0x3c851f(_0x291812[_0xb820('0x29')][_0xb820('0x28')]);}})[_0xb820('0x2a')](function(_0x251921){logger[_0xb820('0x26')](_0xb820('0x27'),_0x1d4be7,_0x251921);_0x4b4c3f(_0x251921);});});}function respondWithStatusCode(_0x2e7dad,_0xb80a23){_0xb80a23=_0xb80a23||0xcc;return function(_0x6163a9){if(_0x6163a9){return _0x2e7dad[_0xb820('0x2b')](_0xb80a23);}return _0x2e7dad[_0xb820('0x2c')](_0xb80a23)['end']();};}function respondWithResult(_0x56cb60,_0x58e536){_0x58e536=_0x58e536||0xc8;return function(_0x4feb8b){if(_0x4feb8b){return _0x56cb60[_0xb820('0x2c')](_0x58e536)[_0xb820('0x2d')](_0x4feb8b);}};}function respondWithFilteredResult(_0x5b1f3c,_0x49a361){return function(_0x324e17){if(_0x324e17){var _0x497271=typeof _0x49a361[_0xb820('0x2e')]===_0xb820('0x2f')&&typeof _0x49a361[_0xb820('0x30')]===_0xb820('0x2f');var _0x46d09e=_0x324e17[_0xb820('0x31')];var _0x5ea16d=_0x497271?0x0:_0x49a361[_0xb820('0x2e')];var _0x112017=_0x497271?_0x324e17['count']:_0x49a361[_0xb820('0x2e')]+_0x49a361[_0xb820('0x30')];var _0x185549;if(_0x112017>=_0x46d09e){_0x112017=_0x46d09e;_0x185549=0xc8;}else{_0x185549=0xce;}_0x5b1f3c[_0xb820('0x2c')](_0x185549);return _0x5b1f3c[_0xb820('0x32')]('Content-Range',_0x5ea16d+'-'+_0x112017+'/'+_0x46d09e)['json'](_0x324e17);}return null;};}function patchUpdates(_0x5ac9d0){return function(_0x385342){try{jsonpatch[_0xb820('0x33')](_0x385342,_0x5ac9d0,!![]);}catch(_0x594d03){return BPromise[_0xb820('0x34')](_0x594d03);}return _0x385342[_0xb820('0x35')]();};}function saveUpdates(_0x502c45,_0x312321){return function(_0x1fd1cb){if(_0x1fd1cb){return _0x1fd1cb[_0xb820('0x36')](_0x502c45)[_0xb820('0x21')](function(_0x48e413){return _0x48e413;});}return null;};}function removeEntity(_0x2a0605,_0x358588){return function(_0x2c843e){if(_0x2c843e){return _0x2c843e['destroy']()[_0xb820('0x21')](function(){_0x2a0605['status'](0xcc)[_0xb820('0x37')]();});}};}function handleEntityNotFound(_0x3f72cd,_0x4b17e8){return function(_0x4f7dc4){if(!_0x4f7dc4){_0x3f72cd['sendStatus'](0x194);}return _0x4f7dc4;};}function handleError(_0x1369d5,_0x456879){_0x456879=_0x456879||0x1f4;return function(_0xa3066e){logger[_0xb820('0x26')](_0xa3066e[_0xb820('0x38')]);if(_0xa3066e[_0xb820('0x39')]){delete _0xa3066e[_0xb820('0x39')];}_0x1369d5[_0xb820('0x2c')](_0x456879)['send'](_0xa3066e);};}exports[_0xb820('0x3a')]=function(_0x15c146,_0x2302b6){var _0x2a442d={},_0x313465={},_0x493c5b={'count':0x0,'rows':[]};var _0x1fc597=_[_0xb820('0x3b')](db[_0xb820('0x3c')][_0xb820('0x3d')],function(_0x650d4a){return{'name':_0x650d4a[_0xb820('0x3e')],'type':_0x650d4a[_0xb820('0x3f')][_0xb820('0x40')]};});_0x313465[_0xb820('0x41')]=_[_0xb820('0x3b')](_0x1fc597,_0xb820('0x39'));_0x313465[_0xb820('0x42')]=_['keys'](_0x15c146[_0xb820('0x42')]);_0x313465[_0xb820('0x43')]=_['intersection'](_0x313465[_0xb820('0x41')],_0x313465[_0xb820('0x42')]);_0x2a442d[_0xb820('0x44')]=_[_0xb820('0x45')](_0x313465[_0xb820('0x41')],qs[_0xb820('0x46')](_0x15c146[_0xb820('0x42')][_0xb820('0x46')]));_0x2a442d['attributes']=_0x2a442d['attributes'][_0xb820('0x47')]?_0x2a442d[_0xb820('0x44')]:_0x313465[_0xb820('0x41')];if(!_0x15c146[_0xb820('0x42')][_0xb820('0x48')]('nolimit')){_0x2a442d[_0xb820('0x30')]=qs[_0xb820('0x30')](_0x15c146[_0xb820('0x42')][_0xb820('0x30')]);_0x2a442d[_0xb820('0x2e')]=qs['offset'](_0x15c146[_0xb820('0x42')][_0xb820('0x2e')]);}_0x2a442d[_0xb820('0x49')]=qs[_0xb820('0x4a')](_0x15c146[_0xb820('0x42')]['sort']);_0x2a442d[_0xb820('0x4b')]=qs[_0xb820('0x43')](_[_0xb820('0x4c')](_0x15c146['query'],_0x313465[_0xb820('0x43')]),_0x1fc597);if(_0x15c146[_0xb820('0x42')][_0xb820('0x4d')]){_0x2a442d[_0xb820('0x4b')]=_[_0xb820('0x4e')](_0x2a442d[_0xb820('0x4b')],{'$or':_[_0xb820('0x3b')](_0x1fc597,function(_0x48489c){if(_0x48489c['type']!==_0xb820('0x4f')){var _0x261acf={};_0x261acf[_0x48489c['name']]={'$like':'%'+_0x15c146[_0xb820('0x42')][_0xb820('0x4d')]+'%'};return _0x261acf;}})});}_0x2a442d=_[_0xb820('0x4e')]({},_0x2a442d,_0x15c146['options']);var _0x82c10a={'where':_0x2a442d[_0xb820('0x4b')]};return db['SmsMessage'][_0xb820('0x31')](_0x82c10a)[_0xb820('0x21')](function(_0x1c6be7){_0x493c5b[_0xb820('0x31')]=_0x1c6be7;if(_0x15c146[_0xb820('0x42')][_0xb820('0x50')]){_0x2a442d[_0xb820('0x51')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x2a442d);})[_0xb820('0x21')](function(_0x3157a1){_0x493c5b['rows']=_0x3157a1;return _0x493c5b;})[_0xb820('0x21')](respondWithFilteredResult(_0x2302b6,_0x2a442d))[_0xb820('0x2a')](handleError(_0x2302b6,null));};exports[_0xb820('0x52')]=function(_0x5b5565,_0x4edcf2){var _0x462291={'raw':!![],'where':{'id':_0x5b5565['params']['id']}},_0x119b05={};_0x119b05[_0xb820('0x41')]=_[_0xb820('0x53')](db[_0xb820('0x3c')]['rawAttributes']);_0x119b05[_0xb820('0x42')]=_[_0xb820('0x53')](_0x5b5565[_0xb820('0x42')]);_0x119b05['filters']=_[_0xb820('0x45')](_0x119b05[_0xb820('0x41')],_0x119b05[_0xb820('0x42')]);_0x462291[_0xb820('0x44')]=_[_0xb820('0x45')](_0x119b05[_0xb820('0x41')],qs['fields'](_0x5b5565[_0xb820('0x42')][_0xb820('0x46')]));_0x462291['attributes']=_0x462291[_0xb820('0x44')][_0xb820('0x47')]?_0x462291[_0xb820('0x44')]:_0x119b05[_0xb820('0x41')];if(_0x5b5565[_0xb820('0x42')][_0xb820('0x50')]){_0x462291['include']=[{'all':!![]}];}_0x462291=_['merge']({},_0x462291,_0x5b5565[_0xb820('0x54')]);return db[_0xb820('0x3c')][_0xb820('0x55')](_0x462291)['then'](handleEntityNotFound(_0x4edcf2,null))['then'](respondWithResult(_0x4edcf2,null))[_0xb820('0x2a')](handleError(_0x4edcf2,null));};exports['create']=function(_0x4bbc1f,_0x53ccd){return db[_0xb820('0x3c')][_0xb820('0x56')](_0x4bbc1f[_0xb820('0x57')],{})['then'](respondWithResult(_0x53ccd,0xc9))[_0xb820('0x2a')](handleError(_0x53ccd,null));};exports[_0xb820('0x36')]=function(_0x303e21,_0x47c2c7){if(_0x303e21[_0xb820('0x57')]['id']){delete _0x303e21[_0xb820('0x57')]['id'];}return db[_0xb820('0x3c')][_0xb820('0x55')]({'where':{'id':_0x303e21['params']['id']}})[_0xb820('0x21')](handleEntityNotFound(_0x47c2c7,null))[_0xb820('0x21')](saveUpdates(_0x303e21[_0xb820('0x57')],null))['then'](respondWithResult(_0x47c2c7,null))[_0xb820('0x2a')](handleError(_0x47c2c7,null));};exports[_0xb820('0x58')]=function(_0x5d41ac,_0x5dbef5){return db[_0xb820('0x3c')]['find']({'where':{'id':_0x5d41ac[_0xb820('0x59')]['id']}})[_0xb820('0x21')](handleEntityNotFound(_0x5dbef5,null))[_0xb820('0x21')](removeEntity(_0x5dbef5,null))[_0xb820('0x2a')](handleError(_0x5dbef5,null));};exports[_0xb820('0x5a')]=function(_0x4a1e99,_0x7b7541){return db['SmsMessage'][_0xb820('0x5a')]()[_0xb820('0x21')](respondWithResult(_0x7b7541,null))[_0xb820('0x2a')](handleError(_0x7b7541,null));};var interaction_log=require(_0xb820('0x13'))('sms-interactions');exports['accept']=function(_0x2338ae,_0x3d257c,_0x14fa66){var _0x28cca6={'agent':{},'channel':_0xb820('0x5b')};if(_0x2338ae[_0xb820('0x57')]['id']){delete _0x2338ae[_0xb820('0x57')]['id'];}_0x2338ae['body']['read']=!![];_0x2338ae[_0xb820('0x57')][_0xb820('0x5c')]=moment()[_0xb820('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2338ae[_0xb820('0x57')][_0xb820('0x5e')]=_0x2338ae[_0xb820('0x57')]['UserId']||_0x2338ae[_0xb820('0x5f')]['id'];_0x28cca6[_0xb820('0x60')]['id']=_0x2338ae[_0xb820('0x57')]['UserId'];return db[_0xb820('0x3c')][_0xb820('0x55')]({'where':{'id':_0x2338ae[_0xb820('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d257c,null))[_0xb820('0x21')](saveUpdates(_0x2338ae[_0xb820('0x57')],null))[_0xb820('0x21')](function(_0x5bd1fb){if(_0x5bd1fb){_0x28cca6[_0xb820('0x28')]=_0x5bd1fb['get']({'plain':!![]});return db['SmsInteraction'][_0xb820('0x55')]({'where':{'id':_0x5bd1fb[_0xb820('0x61')]}});}return null;})[_0xb820('0x21')](handleEntityNotFound(_0x3d257c,null))[_0xb820('0x21')](function(_0x36dd22){if(_0x36dd22){return _0x36dd22['update']({'UserId':_0x2338ae[_0xb820('0x57')][_0xb820('0x5e')],'read1stAt':_['isNil'](_0x36dd22[_0xb820('0x62')])?moment()[_0xb820('0x5d')](_0xb820('0x63')):undefined});}return null;})[_0xb820('0x21')](function(_0x3aee73){if(_0x3aee73){_0x28cca6[_0xb820('0x64')]=_0x3aee73[_0xb820('0x65')]({'plain':!![]});interaction_log[_0xb820('0x22')](_0xb820('0x66'),_0x2338ae[_0xb820('0x5f')]['id'],_0x2338ae['user'][_0xb820('0x39')],_0x2338ae[_0xb820('0x5f')][_0xb820('0x67')],_0x28cca6[_0xb820('0x64')]['id'],_0x2338ae[_0xb820('0x57')]?JSON[_0xb820('0x68')](_0x2338ae['body']):'null');return respondWithRpcPromise('AcceptMessage',_0xb820('0x69'),_0x28cca6);}return null;})[_0xb820('0x21')](function(_0x10d5b5){var _0x1e7a8f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x10d5b5[_0xb820('0x28')]['ContactId'];return db[_0xb820('0x6a')]['query'](_0x1e7a8f,{'type':db[_0xb820('0x6b')][_0xb820('0x6c')][_0xb820('0x6d')],'raw':!![]})['then'](function(_0x9a0142){return _0x9a0142;});})[_0xb820('0x21')](function(_0x572a35){if(_0x572a35){_0x28cca6[_0xb820('0x28')][_0xb820('0x6e')]=_0x572a35[0x0];if(!_0x2338ae[_0xb820('0x57')][_0xb820('0x5e')])return;return db['User']['find']({'where':{'id':_0x2338ae[_0xb820('0x57')][_0xb820('0x5e')],'role':'agent'},'attributes':['id',_0xb820('0x39'),_0xb820('0x6f'),_0xb820('0x70'),_0xb820('0x71')],'raw':!![]});}return null;})[_0xb820('0x21')](function(_0x3beb80){if(!_0x3beb80)return null;_0x28cca6[_0xb820('0x28')][_0xb820('0x60')]=_0x3beb80;return _0x28cca6;})[_0xb820('0x21')](function(_0x4e2af1){if(_0x4e2af1){if(_0x2338ae[_0xb820('0x57')][_0xb820('0x72')]){_0x28cca6[_0xb820('0x28')][_0xb820('0x73')]=util[_0xb820('0x5d')](_0xb820('0x74'),_0x2338ae['user'][_0xb820('0x39')]);_0x28cca6[_0xb820('0x28')][_0xb820('0x75')]=_0x28cca6[_0xb820('0x75')];_0x28cca6['message'][_0xb820('0x76')]='accept';return respondWithRpcPromise(_0xb820('0x77'),_0xb820('0x77'),{'event':'acceptmessage','message':_0x28cca6[_0xb820('0x28')]},client9002)['then'](function(){return _0x28cca6;});}return _0x28cca6;}return null;})[_0xb820('0x21')](respondWithResult(_0x3d257c,null))[_0xb820('0x2a')](handleError(_0x3d257c,null));};var interaction_log=require(_0xb820('0x13'))(_0xb820('0x78'));exports[_0xb820('0x34')]=function(_0x512617,_0x40023c,_0x133691){var _0x13502c={'agent':{},'channel':_0xb820('0x5b')};if(_0x512617['body']['id']){delete _0x512617[_0xb820('0x57')]['id'];}_0x512617['body'][_0xb820('0x5e')]=_0x512617[_0xb820('0x57')][_0xb820('0x5e')]||_0x512617[_0xb820('0x5f')]['id'];_0x13502c[_0xb820('0x60')]['id']=_0x512617[_0xb820('0x57')][_0xb820('0x5e')];return db[_0xb820('0x3c')]['find']({'where':{'id':_0x512617['params']['id'],'UserId':null}})[_0xb820('0x21')](handleEntityNotFound(_0x40023c,null))['then'](function(_0x54bba9){if(_0x54bba9){_0x13502c[_0xb820('0x28')]=_0x54bba9[_0xb820('0x65')]({'plain':!![]});return db[_0xb820('0x79')][_0xb820('0x55')]({'where':{'id':_0x54bba9[_0xb820('0x61')]}});}return null;})[_0xb820('0x21')](handleEntityNotFound(_0x40023c,null))[_0xb820('0x21')](function(_0x4c0cbc){if(_0x4c0cbc){_0x13502c[_0xb820('0x64')]=_0x4c0cbc[_0xb820('0x65')]({'plain':!![]});interaction_log[_0xb820('0x22')](_0xb820('0x7a'),_0x512617['user']['id'],_0x512617['user'][_0xb820('0x39')],_0x512617[_0xb820('0x5f')]['role'],_0x13502c['interaction']['id'],_0x512617[_0xb820('0x57')]?JSON['stringify'](_0x512617[_0xb820('0x57')]):_0xb820('0x7b'));return respondWithRpcPromise(_0xb820('0x7c'),_0xb820('0x7d'),_0x13502c);}return null;})[_0xb820('0x21')](function(_0x4be172){var _0x506933=_0xb820('0x7e')+_0x4be172[_0xb820('0x28')][_0xb820('0x7f')];return db[_0xb820('0x6a')][_0xb820('0x42')](_0x506933,{'type':db[_0xb820('0x6b')][_0xb820('0x6c')][_0xb820('0x6d')],'raw':!![]})[_0xb820('0x21')](function(_0xeab74c){return _0xeab74c;});})[_0xb820('0x21')](function(_0x3d1b4d){if(_0x3d1b4d){_0x13502c['message']['contact']=_0x3d1b4d[0x0];if(!_0x512617[_0xb820('0x57')]['UserId'])return;return db[_0xb820('0x80')][_0xb820('0x55')]({'where':{'id':_0x512617['body']['UserId'],'role':_0xb820('0x60')},'attributes':['id',_0xb820('0x39'),'fullname',_0xb820('0x70'),_0xb820('0x71')],'raw':!![]});}return null;})['then'](function(_0x2a4a3f){if(!_0x2a4a3f)return null;_0x13502c[_0xb820('0x28')][_0xb820('0x60')]=_0x2a4a3f;return _0x13502c;})[_0xb820('0x21')](function(_0x48ce68){if(_0x48ce68){_0x48ce68[_0xb820('0x28')]['interface']=util[_0xb820('0x5d')]('SIP/%s',_0x512617['user']['name']);_0x48ce68[_0xb820('0x28')]['channel']=_0x13502c[_0xb820('0x75')];_0x48ce68[_0xb820('0x28')][_0xb820('0x76')]='reject';respondWithRpcPromise(_0xb820('0x77'),_0xb820('0x77'),{'event':_0xb820('0x81'),'message':_0x48ce68[_0xb820('0x28')]},client9002);return _0x13502c;}return null;})[_0xb820('0x21')](respondWithResult(_0x40023c,null))[_0xb820('0x2a')](handleError(_0x40023c,null));};exports[_0xb820('0x2c')]=function(_0x21b1b0,_0x3897cf,_0xe3090a){if(_0x21b1b0['body']['id']){delete _0x21b1b0['body']['id'];}var _0x4938a7;return db[_0xb820('0x3c')][_0xb820('0x55')]({'where':{'id':_0x21b1b0[_0xb820('0x59')]['id']}})[_0xb820('0x21')](handleEntityNotFound(_0x3897cf,null))[_0xb820('0x21')](function(_0x47ef4d){if(_0x47ef4d){_0x4938a7=_0x47ef4d;return db[_0xb820('0x82')][_0xb820('0x55')]({'where':{'id':_0x47ef4d[_0xb820('0x83')]}});}})[_0xb820('0x21')](handleEntityNotFound(_0x3897cf,null))[_0xb820('0x21')](function(_0x1a1f3b){if(_0x1a1f3b){logger['debug'](_0xb820('0x25'),_0xb820('0x2c'),_0xb820('0x84'),_0x1a1f3b[_0xb820('0x3f')],util[_0xb820('0x85')](_0x21b1b0[_0xb820('0x57')],{'showHidden':![],'depth':null}));switch(_0x1a1f3b['type']){case _0xb820('0x86'):if(_0x21b1b0[_0xb820('0x57')]['MessageSid']&&_0x21b1b0[_0xb820('0x57')]['MessageSid']===_0x4938a7[_0xb820('0x87')]){return _0x4938a7[_0xb820('0x36')]({'read':!![]});}else{logger[_0xb820('0x26')](_0xb820('0x88'),'status',_0xb820('0x86'),util[_0xb820('0x85')](_0x21b1b0[_0xb820('0x57')],{'showHidden':![],'depth':null}));}break;case _0xb820('0x89'):if(_0x21b1b0[_0xb820('0x57')][_0xb820('0x8a')]&&_0x21b1b0[_0xb820('0x57')]['MessageUUID']===_0x4938a7['messageId']&&_[_0xb820('0x8b')](['sent',_0xb820('0x8c')],_0x21b1b0['body'][_0xb820('0x8d')])>=0x0){return _0x4938a7[_0xb820('0x36')]({'read':!![]});}else{logger[_0xb820('0x26')](_0xb820('0x88'),'status',_0xb820('0x8e'),util[_0xb820('0x85')](_0x21b1b0[_0xb820('0x57')],{'showHidden':![],'depth':null}));}break;case _0xb820('0x8f'):var _0x185590=_0x21b1b0[_0xb820('0x57')][_0xb820('0x90')][0x0];if(_0x185590[_0xb820('0x2c')]['groupName']===_0xb820('0x91')){return _0x4938a7[_0xb820('0x36')]({'read':!![]});}else{logger[_0xb820('0x26')](_0xb820('0x88'),_0xb820('0x2c'),_0xb820('0x8f'),util[_0xb820('0x85')](_0x21b1b0['body'],{'showHidden':![],'depth':null}));}break;}return _0x4938a7;}})['then'](respondWithResult(_0x3897cf,null))[_0xb820('0x2a')](handleError(_0x3897cf,null));}; \ No newline at end of file +var _0xa3be=['indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','eml-format','rimraf','zip-dir','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','limit','undefined','count','offset','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','SmsMessage','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','include','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','accept','EventManager','get','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xa3be,0x97));var _0xea3b=function(_0x24cf30,_0x3ecf9d){_0x24cf30=_0x24cf30-0x0;var _0x4f9168=_0xa3be[_0x24cf30];return _0x4f9168;};'use strict';var emlformat=require(_0xea3b('0x0'));var rimraf=require(_0xea3b('0x1'));var zipdir=require(_0xea3b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea3b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xea3b('0x4'));var util=require(_0xea3b('0x5'));var path=require('path');var sox=require(_0xea3b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea3b('0x7'));var _=require(_0xea3b('0x8'));var squel=require(_0xea3b('0x9'));var crypto=require(_0xea3b('0xa'));var jsforce=require(_0xea3b('0xb'));var deskjs=require(_0xea3b('0xc'));var toCsv=require(_0xea3b('0xd'));var querystring=require(_0xea3b('0xe'));var Papa=require(_0xea3b('0xf'));var Redis=require(_0xea3b('0x10'));var authService=require(_0xea3b('0x11'));var qs=require(_0xea3b('0x12'));var as=require(_0xea3b('0x13'));var hardwareService=require(_0xea3b('0x14'));var logger=require(_0xea3b('0x15'))(_0xea3b('0x16'));var utils=require(_0xea3b('0x17'));var config=require(_0xea3b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xea3b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xea3b('0x1a'))(new Redis(config[_0xea3b('0x19')]));require(_0xea3b('0x1b'))['register'](socket);var jayson=require(_0xea3b('0x1c'));var client=jayson[_0xea3b('0x1d')][_0xea3b('0x1e')]({'port':0x232c});var client9002=jayson[_0xea3b('0x1d')][_0xea3b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1e077f,_0x2f1454,_0x4a97eb,_0x53b974){return new BPromise(function(_0x2451fe,_0x5f1f65){var _0x4ed643=_0x53b974||client;return _0x4ed643['request'](_0x1e077f,_0x4a97eb)[_0xea3b('0x1f')](function(_0x2711c9){logger[_0xea3b('0x20')](_0xea3b('0x21'),_0x2f1454,_0xea3b('0x22'));logger[_0xea3b('0x23')](_0xea3b('0x24'),_0x2f1454,_0xea3b('0x22'),JSON[_0xea3b('0x25')](_0x2711c9));if(_0x2711c9['error']){if(_0x2711c9[_0xea3b('0x26')][_0xea3b('0x27')]===0x1f4){logger[_0xea3b('0x26')](_0xea3b('0x21'),_0x2f1454,_0x2711c9[_0xea3b('0x26')][_0xea3b('0x28')]);return _0x5f1f65(_0x2711c9['error'][_0xea3b('0x28')]);}logger['error'](_0xea3b('0x21'),_0x2f1454,_0x2711c9[_0xea3b('0x26')]['message']);return _0x2451fe(_0x2711c9[_0xea3b('0x26')][_0xea3b('0x28')]);}else{logger[_0xea3b('0x20')]('SmsMessage,\x20%s,\x20%s',_0x2f1454,_0xea3b('0x22'));_0x2451fe(_0x2711c9['result'][_0xea3b('0x28')]);}})['catch'](function(_0x2c0636){logger[_0xea3b('0x26')](_0xea3b('0x21'),_0x2f1454,_0x2c0636);_0x5f1f65(_0x2c0636);});});}function respondWithStatusCode(_0x10a1e2,_0x2452e2){_0x2452e2=_0x2452e2||0xcc;return function(_0x34f93a){if(_0x34f93a){return _0x10a1e2['sendStatus'](_0x2452e2);}return _0x10a1e2[_0xea3b('0x29')](_0x2452e2)[_0xea3b('0x2a')]();};}function respondWithResult(_0x3398de,_0x2aa263){_0x2aa263=_0x2aa263||0xc8;return function(_0x344292){if(_0x344292){return _0x3398de['status'](_0x2aa263)[_0xea3b('0x2b')](_0x344292);}};}function respondWithFilteredResult(_0x5cb762,_0x4551ad){return function(_0x35a837){if(_0x35a837){var _0x2ca480=typeof _0x4551ad['offset']==='undefined'&&typeof _0x4551ad[_0xea3b('0x2c')]===_0xea3b('0x2d');var _0x30e151=_0x35a837[_0xea3b('0x2e')];var _0x48e5f5=_0x2ca480?0x0:_0x4551ad[_0xea3b('0x2f')];var _0x4c154d=_0x2ca480?_0x35a837[_0xea3b('0x2e')]:_0x4551ad['offset']+_0x4551ad['limit'];var _0x3b6871;if(_0x4c154d>=_0x30e151){_0x4c154d=_0x30e151;_0x3b6871=0xc8;}else{_0x3b6871=0xce;}_0x5cb762[_0xea3b('0x29')](_0x3b6871);return _0x5cb762['set']('Content-Range',_0x48e5f5+'-'+_0x4c154d+'/'+_0x30e151)[_0xea3b('0x2b')](_0x35a837);}return null;};}function patchUpdates(_0x27e5fb){return function(_0x58c7e3){try{jsonpatch[_0xea3b('0x30')](_0x58c7e3,_0x27e5fb,!![]);}catch(_0x193a3a){return BPromise[_0xea3b('0x31')](_0x193a3a);}return _0x58c7e3[_0xea3b('0x32')]();};}function saveUpdates(_0x3fa321,_0x207f0c){return function(_0x354bb7){if(_0x354bb7){return _0x354bb7[_0xea3b('0x33')](_0x3fa321)[_0xea3b('0x1f')](function(_0x4b5673){return _0x4b5673;});}return null;};}function removeEntity(_0x49ee13,_0x24281b){return function(_0x2942d0){if(_0x2942d0){return _0x2942d0[_0xea3b('0x34')]()['then'](function(){_0x49ee13['status'](0xcc)[_0xea3b('0x2a')]();});}};}function handleEntityNotFound(_0x1c5520,_0x5e82ca){return function(_0xe410bf){if(!_0xe410bf){_0x1c5520[_0xea3b('0x35')](0x194);}return _0xe410bf;};}function handleError(_0x196187,_0x94e5cb){_0x94e5cb=_0x94e5cb||0x1f4;return function(_0x54132d){logger[_0xea3b('0x26')](_0x54132d[_0xea3b('0x36')]);if(_0x54132d[_0xea3b('0x37')]){delete _0x54132d[_0xea3b('0x37')];}_0x196187[_0xea3b('0x29')](_0x94e5cb)[_0xea3b('0x38')](_0x54132d);};}exports['index']=function(_0x4353c0,_0x1937e9){var _0x4dffe1={},_0x72de71={},_0x5e107a={'count':0x0,'rows':[]};var _0x1c4ba4=_[_0xea3b('0x39')](db[_0xea3b('0x3a')]['rawAttributes'],function(_0x1cc1ac){return{'name':_0x1cc1ac[_0xea3b('0x3b')],'type':_0x1cc1ac['type'][_0xea3b('0x3c')]};});_0x72de71[_0xea3b('0x3d')]=_['map'](_0x1c4ba4,'name');_0x72de71[_0xea3b('0x3e')]=_[_0xea3b('0x3f')](_0x4353c0[_0xea3b('0x3e')]);_0x72de71['filters']=_[_0xea3b('0x40')](_0x72de71[_0xea3b('0x3d')],_0x72de71[_0xea3b('0x3e')]);_0x4dffe1['attributes']=_[_0xea3b('0x40')](_0x72de71[_0xea3b('0x3d')],qs[_0xea3b('0x41')](_0x4353c0[_0xea3b('0x3e')][_0xea3b('0x41')]));_0x4dffe1[_0xea3b('0x42')]=_0x4dffe1[_0xea3b('0x42')][_0xea3b('0x43')]?_0x4dffe1[_0xea3b('0x42')]:_0x72de71[_0xea3b('0x3d')];if(!_0x4353c0[_0xea3b('0x3e')][_0xea3b('0x44')](_0xea3b('0x45'))){_0x4dffe1[_0xea3b('0x2c')]=qs[_0xea3b('0x2c')](_0x4353c0[_0xea3b('0x3e')][_0xea3b('0x2c')]);_0x4dffe1[_0xea3b('0x2f')]=qs['offset'](_0x4353c0[_0xea3b('0x3e')]['offset']);}_0x4dffe1[_0xea3b('0x46')]=qs[_0xea3b('0x47')](_0x4353c0[_0xea3b('0x3e')][_0xea3b('0x47')]);_0x4dffe1[_0xea3b('0x48')]=qs[_0xea3b('0x49')](_[_0xea3b('0x4a')](_0x4353c0[_0xea3b('0x3e')],_0x72de71['filters']),_0x1c4ba4);if(_0x4353c0[_0xea3b('0x3e')]['filter']){_0x4dffe1['where']=_[_0xea3b('0x4b')](_0x4dffe1['where'],{'$or':_[_0xea3b('0x39')](_0x1c4ba4,function(_0x3024ab){if(_0x3024ab[_0xea3b('0x4c')]!==_0xea3b('0x4d')){var _0x2e3eb0={};_0x2e3eb0[_0x3024ab[_0xea3b('0x37')]]={'$like':'%'+_0x4353c0[_0xea3b('0x3e')]['filter']+'%'};return _0x2e3eb0;}})});}_0x4dffe1=_[_0xea3b('0x4b')]({},_0x4dffe1,_0x4353c0['options']);var _0x5d72bc={'where':_0x4dffe1[_0xea3b('0x48')]};return db[_0xea3b('0x3a')]['count'](_0x5d72bc)[_0xea3b('0x1f')](function(_0x17703f){_0x5e107a[_0xea3b('0x2e')]=_0x17703f;if(_0x4353c0[_0xea3b('0x3e')]['includeAll']){_0x4dffe1[_0xea3b('0x4e')]=[{'all':!![]}];}return db[_0xea3b('0x3a')]['findAll'](_0x4dffe1);})[_0xea3b('0x1f')](function(_0x1a0b1b){_0x5e107a[_0xea3b('0x4f')]=_0x1a0b1b;return _0x5e107a;})[_0xea3b('0x1f')](respondWithFilteredResult(_0x1937e9,_0x4dffe1))[_0xea3b('0x50')](handleError(_0x1937e9,null));};exports[_0xea3b('0x51')]=function(_0x21a53f,_0x8dc462){var _0xe88787={'raw':!![],'where':{'id':_0x21a53f[_0xea3b('0x52')]['id']}},_0x379596={};_0x379596['model']=_[_0xea3b('0x3f')](db[_0xea3b('0x3a')][_0xea3b('0x53')]);_0x379596[_0xea3b('0x3e')]=_[_0xea3b('0x3f')](_0x21a53f['query']);_0x379596[_0xea3b('0x49')]=_[_0xea3b('0x40')](_0x379596['model'],_0x379596[_0xea3b('0x3e')]);_0xe88787['attributes']=_['intersection'](_0x379596[_0xea3b('0x3d')],qs[_0xea3b('0x41')](_0x21a53f[_0xea3b('0x3e')][_0xea3b('0x41')]));_0xe88787[_0xea3b('0x42')]=_0xe88787[_0xea3b('0x42')][_0xea3b('0x43')]?_0xe88787[_0xea3b('0x42')]:_0x379596[_0xea3b('0x3d')];if(_0x21a53f[_0xea3b('0x3e')][_0xea3b('0x54')]){_0xe88787[_0xea3b('0x4e')]=[{'all':!![]}];}_0xe88787=_[_0xea3b('0x4b')]({},_0xe88787,_0x21a53f[_0xea3b('0x55')]);return db[_0xea3b('0x3a')][_0xea3b('0x56')](_0xe88787)[_0xea3b('0x1f')](handleEntityNotFound(_0x8dc462,null))[_0xea3b('0x1f')](respondWithResult(_0x8dc462,null))[_0xea3b('0x50')](handleError(_0x8dc462,null));};exports[_0xea3b('0x57')]=function(_0x1c4fa4,_0xaf8b4b){return db[_0xea3b('0x3a')][_0xea3b('0x57')](_0x1c4fa4['body'],{})['then'](respondWithResult(_0xaf8b4b,0xc9))[_0xea3b('0x50')](handleError(_0xaf8b4b,null));};exports[_0xea3b('0x33')]=function(_0x5615f7,_0x5ac6c3){if(_0x5615f7[_0xea3b('0x58')]['id']){delete _0x5615f7[_0xea3b('0x58')]['id'];}return db['SmsMessage'][_0xea3b('0x56')]({'where':{'id':_0x5615f7[_0xea3b('0x52')]['id']}})[_0xea3b('0x1f')](handleEntityNotFound(_0x5ac6c3,null))[_0xea3b('0x1f')](saveUpdates(_0x5615f7[_0xea3b('0x58')],null))[_0xea3b('0x1f')](respondWithResult(_0x5ac6c3,null))[_0xea3b('0x50')](handleError(_0x5ac6c3,null));};exports[_0xea3b('0x34')]=function(_0x3dd5ff,_0x429cdd){return db[_0xea3b('0x3a')][_0xea3b('0x56')]({'where':{'id':_0x3dd5ff[_0xea3b('0x52')]['id']}})[_0xea3b('0x1f')](handleEntityNotFound(_0x429cdd,null))[_0xea3b('0x1f')](removeEntity(_0x429cdd,null))[_0xea3b('0x50')](handleError(_0x429cdd,null));};exports[_0xea3b('0x59')]=function(_0x3d604b,_0x4a159c){return db['SmsMessage']['describe']()[_0xea3b('0x1f')](respondWithResult(_0x4a159c,null))[_0xea3b('0x50')](handleError(_0x4a159c,null));};var interaction_log=require('../../config/logger')(_0xea3b('0x5a'));exports['accept']=function(_0x35e9bb,_0x44aa67,_0x27b8ef){var _0x8e6ce0={'agent':{},'channel':_0xea3b('0x5b')};if(_0x35e9bb['body']['id']){delete _0x35e9bb[_0xea3b('0x58')]['id'];}_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x5c')]=!![];_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x5d')]=moment()[_0xea3b('0x5e')](_0xea3b('0x5f'));_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')]=_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')]||_0x35e9bb[_0xea3b('0x61')]['id'];_0x8e6ce0[_0xea3b('0x62')]['id']=_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')];return db[_0xea3b('0x3a')][_0xea3b('0x56')]({'where':{'id':_0x35e9bb[_0xea3b('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44aa67,null))[_0xea3b('0x1f')](saveUpdates(_0x35e9bb['body'],null))[_0xea3b('0x1f')](function(_0x246527){if(_0x246527){_0x8e6ce0['message']=_0x246527['get']({'plain':!![]});return db[_0xea3b('0x63')][_0xea3b('0x56')]({'where':{'id':_0x246527['SmsInteractionId']}});}return null;})[_0xea3b('0x1f')](handleEntityNotFound(_0x44aa67,null))['then'](function(_0x524326){if(_0x524326){return _0x524326[_0xea3b('0x33')]({'UserId':_0x35e9bb[_0xea3b('0x58')]['UserId'],'read1stAt':_[_0xea3b('0x64')](_0x524326[_0xea3b('0x65')])?moment()[_0xea3b('0x5e')](_0xea3b('0x5f')):undefined});}return null;})[_0xea3b('0x1f')](function(_0x14b006){if(_0x14b006){_0x8e6ce0[_0xea3b('0x66')]=_0x14b006['get']({'plain':!![]});interaction_log['info'](_0xea3b('0x67'),_0x35e9bb[_0xea3b('0x61')]['id'],_0x35e9bb[_0xea3b('0x61')][_0xea3b('0x37')],_0x35e9bb[_0xea3b('0x61')][_0xea3b('0x68')],_0x8e6ce0[_0xea3b('0x66')]['id'],_0x35e9bb['body']?JSON[_0xea3b('0x25')](_0x35e9bb[_0xea3b('0x58')]):_0xea3b('0x69'));return respondWithRpcPromise(_0xea3b('0x6a'),_0xea3b('0x6b'),_0x8e6ce0);}return null;})['then'](function(_0xe7d2a3){var _0x4e28e7=_0xea3b('0x6c')+_0xe7d2a3[_0xea3b('0x28')][_0xea3b('0x6d')];return db[_0xea3b('0x6e')][_0xea3b('0x3e')](_0x4e28e7,{'type':db[_0xea3b('0x6f')][_0xea3b('0x70')]['SELECT'],'raw':!![]})[_0xea3b('0x1f')](function(_0x515fe9){return _0x515fe9;});})[_0xea3b('0x1f')](function(_0x47075b){if(_0x47075b){_0x8e6ce0[_0xea3b('0x28')][_0xea3b('0x71')]=_0x47075b[0x0];if(!_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')])return;return db[_0xea3b('0x72')][_0xea3b('0x56')]({'where':{'id':_0x35e9bb[_0xea3b('0x58')][_0xea3b('0x60')],'role':_0xea3b('0x62')},'attributes':['id','name',_0xea3b('0x73'),_0xea3b('0x74'),_0xea3b('0x75')],'raw':!![]});}return null;})[_0xea3b('0x1f')](function(_0x48157a){if(!_0x48157a)return null;_0x8e6ce0[_0xea3b('0x28')][_0xea3b('0x62')]=_0x48157a;return _0x8e6ce0;})['then'](function(_0x4d76f8){if(_0x4d76f8){if(_0x35e9bb['body'][_0xea3b('0x76')]){_0x8e6ce0[_0xea3b('0x28')][_0xea3b('0x77')]=util['format'](_0xea3b('0x78'),_0x35e9bb[_0xea3b('0x61')]['name']);_0x8e6ce0[_0xea3b('0x28')]['channel']=_0x8e6ce0[_0xea3b('0x79')];_0x8e6ce0['message']['event']=_0xea3b('0x7a');return respondWithRpcPromise(_0xea3b('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x8e6ce0['message']},client9002)[_0xea3b('0x1f')](function(){return _0x8e6ce0;});}return _0x8e6ce0;}return null;})['then'](respondWithResult(_0x44aa67,null))[_0xea3b('0x50')](handleError(_0x44aa67,null));};var interaction_log=require(_0xea3b('0x15'))(_0xea3b('0x5a'));exports[_0xea3b('0x31')]=function(_0x24d2c8,_0x4ffad3,_0x254bb8){var _0x4c79f6={'agent':{},'channel':_0xea3b('0x5b')};if(_0x24d2c8[_0xea3b('0x58')]['id']){delete _0x24d2c8[_0xea3b('0x58')]['id'];}_0x24d2c8[_0xea3b('0x58')][_0xea3b('0x60')]=_0x24d2c8[_0xea3b('0x58')]['UserId']||_0x24d2c8[_0xea3b('0x61')]['id'];_0x4c79f6['agent']['id']=_0x24d2c8[_0xea3b('0x58')]['UserId'];return db[_0xea3b('0x3a')][_0xea3b('0x56')]({'where':{'id':_0x24d2c8[_0xea3b('0x52')]['id'],'UserId':null}})[_0xea3b('0x1f')](handleEntityNotFound(_0x4ffad3,null))[_0xea3b('0x1f')](function(_0x4a4c03){if(_0x4a4c03){_0x4c79f6['message']=_0x4a4c03[_0xea3b('0x7c')]({'plain':!![]});return db[_0xea3b('0x63')][_0xea3b('0x56')]({'where':{'id':_0x4a4c03[_0xea3b('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x4ffad3,null))[_0xea3b('0x1f')](function(_0x186edb){if(_0x186edb){_0x4c79f6['interaction']=_0x186edb[_0xea3b('0x7c')]({'plain':!![]});interaction_log[_0xea3b('0x20')](_0xea3b('0x7e'),_0x24d2c8[_0xea3b('0x61')]['id'],_0x24d2c8[_0xea3b('0x61')]['name'],_0x24d2c8[_0xea3b('0x61')][_0xea3b('0x68')],_0x4c79f6[_0xea3b('0x66')]['id'],_0x24d2c8[_0xea3b('0x58')]?JSON[_0xea3b('0x25')](_0x24d2c8[_0xea3b('0x58')]):_0xea3b('0x69'));return respondWithRpcPromise(_0xea3b('0x7f'),_0xea3b('0x80'),_0x4c79f6);}return null;})['then'](function(_0x3ff38c){var _0x3cb581=_0xea3b('0x6c')+_0x3ff38c[_0xea3b('0x28')][_0xea3b('0x6d')];return db[_0xea3b('0x6e')][_0xea3b('0x3e')](_0x3cb581,{'type':db[_0xea3b('0x6f')][_0xea3b('0x70')][_0xea3b('0x81')],'raw':!![]})[_0xea3b('0x1f')](function(_0x264c11){return _0x264c11;});})[_0xea3b('0x1f')](function(_0x5b1c7d){if(_0x5b1c7d){_0x4c79f6[_0xea3b('0x28')][_0xea3b('0x71')]=_0x5b1c7d[0x0];if(!_0x24d2c8[_0xea3b('0x58')][_0xea3b('0x60')])return;return db[_0xea3b('0x72')][_0xea3b('0x56')]({'where':{'id':_0x24d2c8[_0xea3b('0x58')][_0xea3b('0x60')],'role':'agent'},'attributes':['id',_0xea3b('0x37'),_0xea3b('0x73'),_0xea3b('0x74'),_0xea3b('0x75')],'raw':!![]});}return null;})['then'](function(_0x127c24){if(!_0x127c24)return null;_0x4c79f6['message'][_0xea3b('0x62')]=_0x127c24;return _0x4c79f6;})['then'](function(_0xbc4925){if(_0xbc4925){_0xbc4925[_0xea3b('0x28')][_0xea3b('0x77')]=util[_0xea3b('0x5e')](_0xea3b('0x78'),_0x24d2c8[_0xea3b('0x61')][_0xea3b('0x37')]);_0xbc4925[_0xea3b('0x28')][_0xea3b('0x79')]=_0x4c79f6['channel'];_0xbc4925[_0xea3b('0x28')]['event']=_0xea3b('0x31');respondWithRpcPromise(_0xea3b('0x7b'),_0xea3b('0x7b'),{'event':_0xea3b('0x82'),'message':_0xbc4925[_0xea3b('0x28')]},client9002);return _0x4c79f6;}return null;})['then'](respondWithResult(_0x4ffad3,null))[_0xea3b('0x50')](handleError(_0x4ffad3,null));};exports['status']=function(_0x40e313,_0xd51666,_0x13683d){if(_0x40e313[_0xea3b('0x58')]['id']){delete _0x40e313[_0xea3b('0x58')]['id'];}var _0x4b5179;return db[_0xea3b('0x3a')][_0xea3b('0x56')]({'where':{'id':_0x40e313[_0xea3b('0x52')]['id']}})[_0xea3b('0x1f')](handleEntityNotFound(_0xd51666,null))[_0xea3b('0x1f')](function(_0x4c5a56){if(_0x4c5a56){_0x4b5179=_0x4c5a56;return db['SmsAccount'][_0xea3b('0x56')]({'where':{'id':_0x4c5a56[_0xea3b('0x83')]}});}})[_0xea3b('0x1f')](handleEntityNotFound(_0xd51666,null))['then'](function(_0xeded4a){if(_0xeded4a){logger[_0xea3b('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xea3b('0x84'),_0xeded4a[_0xea3b('0x4c')],util[_0xea3b('0x85')](_0x40e313[_0xea3b('0x58')],{'showHidden':![],'depth':null}));switch(_0xeded4a['type']){case _0xea3b('0x86'):if(_0x40e313['body']['MessageSid']&&_0x40e313['body'][_0xea3b('0x87')]===_0x4b5179[_0xea3b('0x88')]){return _0x4b5179[_0xea3b('0x33')]({'read':!![]});}else{logger[_0xea3b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea3b('0x29'),_0xea3b('0x86'),util[_0xea3b('0x85')](_0x40e313[_0xea3b('0x58')],{'showHidden':![],'depth':null}));}break;case _0xea3b('0x89'):if(_0x40e313[_0xea3b('0x58')][_0xea3b('0x8a')]&&_0x40e313[_0xea3b('0x58')][_0xea3b('0x8a')]===_0x4b5179[_0xea3b('0x88')]&&_[_0xea3b('0x8b')]([_0xea3b('0x8c'),_0xea3b('0x8d')],_0x40e313[_0xea3b('0x58')]['Status'])>=0x0){return _0x4b5179[_0xea3b('0x33')]({'read':!![]});}else{logger[_0xea3b('0x26')](_0xea3b('0x8e'),_0xea3b('0x29'),'plivio',util[_0xea3b('0x85')](_0x40e313[_0xea3b('0x58')],{'showHidden':![],'depth':null}));}break;case _0xea3b('0x8f'):var _0x44e58c=_0x40e313['body'][_0xea3b('0x90')][0x0];if(_0x44e58c['status']['groupName']==='DELIVERED'){return _0x4b5179['update']({'read':!![]});}else{logger[_0xea3b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea3b('0x29'),_0xea3b('0x8f'),util[_0xea3b('0x85')](_0x40e313[_0xea3b('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4b5179;}})['then'](respondWithResult(_0xd51666,null))['catch'](handleError(_0xd51666,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 42386d3..154c02c 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 _0xbcca=['remove','emit','hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','save','update'];(function(_0x507c7b,_0x527ebf){var _0x4ef753=function(_0x27c33b){while(--_0x27c33b){_0x507c7b['push'](_0x507c7b['shift']());}};_0x4ef753(++_0x527ebf);}(_0xbcca,0x1db));var _0xabcc=function(_0xf4022f,_0x193dd9){_0xf4022f=_0xf4022f-0x0;var _0x5bfcc5=_0xbcca[_0xf4022f];return _0x5bfcc5;};'use strict';var EventEmitter=require(_0xabcc('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xabcc('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xabcc('0x2')](0x0);var events={'afterCreate':_0xabcc('0x3'),'afterUpdate':_0xabcc('0x4'),'afterDestroy':_0xabcc('0x5')};function emitEvent(_0x5e82cb){return function(_0x4e8475,_0x4933c4,_0x67ddf3){SmsMessageEvents[_0xabcc('0x6')](_0x5e82cb+':'+_0x4e8475['id'],_0x4e8475);SmsMessageEvents[_0xabcc('0x6')](_0x5e82cb,_0x4e8475);_0x67ddf3(null);};}for(var e in events){if(events[_0xabcc('0x7')](e)){var event=events[e];SmsMessage[_0xabcc('0x8')](e,emitEvent(event));}}module[_0xabcc('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xff67=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x28ff26,_0x1b940a){var _0xb5bc15=function(_0x90b43){while(--_0x90b43){_0x28ff26['push'](_0x28ff26['shift']());}};_0xb5bc15(++_0x1b940a);}(_0xff67,0x16f));var _0x7ff6=function(_0x215caa,_0x4ea394){_0x215caa=_0x215caa-0x0;var _0x22a519=_0xff67[_0x215caa];return _0x22a519;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x7ff6('0x0'))['db'][_0x7ff6('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7ff6('0x2')](0x0);var events={'afterCreate':_0x7ff6('0x3'),'afterUpdate':_0x7ff6('0x4'),'afterDestroy':_0x7ff6('0x5')};function emitEvent(_0x9907df){return function(_0x2c6157,_0xd003e2,_0x1b8aa4){SmsMessageEvents[_0x7ff6('0x6')](_0x9907df+':'+_0x2c6157['id'],_0x2c6157);SmsMessageEvents[_0x7ff6('0x6')](_0x9907df,_0x2c6157);_0x1b8aa4(null);};}for(var e in events){if(events[_0x7ff6('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d54ca24..d2a35e1 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 _0xe9f9=['SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','findOne','update','createdAt','catch','error','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','message_id','clickSend','inspect','/status?token=','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','plivo','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','length','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports'];(function(_0x6d2f69,_0x38e106){var _0x10f930=function(_0x492f0c){while(--_0x492f0c){_0x6d2f69['push'](_0x6d2f69['shift']());}};_0x10f930(++_0x38e106);}(_0xe9f9,0x174));var _0x9e9f=function(_0xbcb7ba,_0x138ead){_0xbcb7ba=_0xbcb7ba-0x0;var _0x1100a4=_0xe9f9[_0xbcb7ba];return _0x1100a4;};'use strict';var _=require(_0x9e9f('0x0'));var util=require('util');var logger=require(_0x9e9f('0x1'))(_0x9e9f('0x2'));var moment=require(_0x9e9f('0x3'));var BPromise=require(_0x9e9f('0x4'));var rp=require(_0x9e9f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e9f('0x6'));var config=require('../../config/environment');var attributes=require(_0x9e9f('0x7'));module[_0x9e9f('0x8')]=function(_0x549ea5,_0x32da7a){return _0x549ea5['define'](_0x9e9f('0x9'),attributes,{'tableName':_0x9e9f('0xa'),'paranoid':![],'indexes':[{'name':_0x9e9f('0xb'),'fields':['messageId']},{'name':_0x9e9f('0xc'),'fields':[_0x9e9f('0xd')],'type':_0x9e9f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29aebc,_0xa837dd,_0x140b9b){var _0x54a20a=_0x549ea5[_0x9e9f('0xf')];var _0x408a12=_0x29aebc[_0x9e9f('0x10')]({'plain':!![]});if(_0x408a12['direction'][_0x9e9f('0x11')]()==='in'||_0x408a12[_0x9e9f('0x12')][_0x9e9f('0x11')]()===_0x9e9f('0x13')&&!_0x408a12[_0x9e9f('0x14')]&&!_[_0x9e9f('0x15')](_0x408a12[_0x9e9f('0x16')])){_0x54a20a[_0x9e9f('0x17')][_0x9e9f('0x18')]({'where':{'id':_0x408a12['SmsInteractionId']}})['then'](function(_0x788dbe){if(_0x788dbe){_0x788dbe[_0x9e9f('0x19')]({'lastMsgAt':_0x408a12[_0x9e9f('0x1a')],'lastMsgDirection':_0x408a12[_0x9e9f('0x12')][_0x9e9f('0x11')]()});}})[_0x9e9f('0x1b')](function(_0x4c5d54){console[_0x9e9f('0x1c')](_0x4c5d54);});}if(_0x408a12['direction']===_0x9e9f('0x13')&&!_0x408a12['secret']){var _0x5ba036;_0x54a20a['SmsAccount'][_0x9e9f('0x1d')]({'where':{'id':_0x408a12[_0x9e9f('0x1e')]},'raw':!![]})[_0x9e9f('0x1f')](function(_0x21f5b7){_0x5ba036=_0x21f5b7;if(_0x5ba036&&_0x5ba036['type']){switch(_0x5ba036[_0x9e9f('0x20')]){case _0x9e9f('0x21'):var _0x584168=require('twilio');if(_0x5ba036[_0x9e9f('0x22')]&&_0x5ba036[_0x9e9f('0x23')]&&_0x5ba036[_0x9e9f('0x24')]){var _0x106572=new _0x584168(_0x5ba036['accountSid'],_0x5ba036['authToken']);_0x106572[_0x9e9f('0x25')][_0x9e9f('0x26')]({'body':_0x408a12['body'],'to':_0x408a12[_0x9e9f('0x24')],'from':_0x5ba036[_0x9e9f('0x24')],'statusCallback':_0x5ba036[_0x9e9f('0x27')]+_0x9e9f('0x28')+_0x408a12['id']+'/status?token='+_0x5ba036[_0x9e9f('0x29')]})[_0x9e9f('0x1f')](function(_0x5937d9){if(_0x5937d9['sid']){return _0x29aebc[_0x9e9f('0x19')]({'messageId':_0x5937d9[_0x9e9f('0x2a')]});}})['catch'](function(_0x172dd1){logger[_0x9e9f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e9f('0x2b'),_0x9e9f('0x21'),util['inspect'](_0x172dd1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x21'),_0x9e9f('0x2d'));}break;case'skebby':var _0x139d63=_0x9e9f('0x2e');if(_0x5ba036[_0x9e9f('0x2f')]&&_0x5ba036['password']){var _0x9032f2={'recipient':[_0x408a12[_0x9e9f('0x24')]],'message':_0x408a12[_0x9e9f('0xd')],'message_type':_0x5ba036['smsMethod']};if(_0x5ba036[_0x9e9f('0x30')]&&_0x5ba036[_0x9e9f('0x30')]!=='SI'){_0x9032f2[_0x9e9f('0x31')]=_0x5ba036[_0x9e9f('0x24')];}var _0x3af39b={'url':_0x139d63+_0x9e9f('0x32')+_0x5ba036[_0x9e9f('0x2f')]+_0x9e9f('0x33')+_0x5ba036['password'],'method':_0x9e9f('0x34')};rp(_0x3af39b)[_0x9e9f('0x1f')](function(_0x2a5d5b){var _0x36e1b9=_0x2a5d5b['split'](';');var _0x31d875={'user_key':_0x36e1b9[0x0],'session_key':_0x36e1b9[0x1]};_0x3af39b={'url':_0x139d63+_0x9e9f('0x35'),'method':_0x9e9f('0x36'),'headers':{'user_key':_0x31d875[_0x9e9f('0x37')],'Session_key':_0x31d875[_0x9e9f('0x38')]},'json':!![],'body':_0x9032f2};return rp(_0x3af39b);})[_0x9e9f('0x1f')](function(_0x303cf3){if(_0x303cf3[_0x9e9f('0x39')]>=0x1){var _0x3e10e9={'messageId':_0x303cf3[_0x9e9f('0x3a')]};if(_0x5ba036[_0x9e9f('0x30')]!=='GP'||!_0x5ba036[_0x9e9f('0x3b')]){_0x3e10e9[_0x9e9f('0x3c')]=!![];}return _0x29aebc[_0x9e9f('0x19')](_0x3e10e9);}else{return logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),'skebby',util['inspect'](_0x303cf3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x567842){return logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),'afterCreate',_0x9e9f('0x3d'),util['inspect'](_0x567842,{'showHidden':![],'depth':null}));});}else{logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x3d'),_0x9e9f('0x3e'));}break;case _0x9e9f('0x3f'):if(_0x5ba036[_0x9e9f('0x23')]){var _0x3676d3={'recipient':_0x408a12[_0x9e9f('0x24')],'message':_0x408a12[_0x9e9f('0xd')],'sender':_0x5ba036[_0x9e9f('0x40')]||_0x5ba036[_0x9e9f('0x24')],'authorization':_0x5ba036[_0x9e9f('0x23')]};var _0xa837dd={'method':_0x9e9f('0x36'),'uri':_0x9e9f('0x41'),'body':_0x3676d3,'json':!![]};rp(_0xa837dd)[_0x9e9f('0x1f')](function(_0x213e30){var _0x34d6de={'messageId':_0x213e30[_0x9e9f('0x42')]};if(!_0x5ba036['deliveryReport']){_0x34d6de[_0x9e9f('0x3c')]=!![];}return _0x29aebc[_0x9e9f('0x19')](_0x34d6de);})['catch'](function(_0x3b26de){logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x3f'),util['inspect'](_0x3b26de,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9e9f('0x2c'),'afterCreate',_0x9e9f('0x3f'),_0x9e9f('0x43'));}break;case _0x9e9f('0x44'):if(_0x5ba036['username']&&_0x5ba036[_0x9e9f('0x45')]){var _0x3676d3={'messages':[{'source':_0x9e9f('0x46'),'to':_0x408a12[_0x9e9f('0x24')],'body':_0x408a12[_0x9e9f('0xd')],'from':_0x5ba036[_0x9e9f('0x40')]||_0x5ba036[_0x9e9f('0x24')]}]};var _0x529091=util[_0x9e9f('0x47')](_0x9e9f('0x48'),_0x5ba036[_0x9e9f('0x2f')],_0x5ba036['password']);var _0xa837dd={'method':_0x9e9f('0x36'),'uri':_0x9e9f('0x49'),'body':_0x3676d3,'headers':{'Authorization':util[_0x9e9f('0x47')]('Basic\x20%s',new Buffer(_0x529091)['toString'](_0x9e9f('0x4a')))},'json':!![]};rp(_0xa837dd)['then'](function(_0x4ef460){if(_0x4ef460[_0x9e9f('0x4b')]>=0xc8&&_0x4ef460['http_code']<=0xce){if(_0x4ef460[_0x9e9f('0x4c')]&&_0x4ef460[_0x9e9f('0x4c')]['queued_count']>0x0){var _0x4695c2=_['head'](_0x4ef460[_0x9e9f('0x4c')][_0x9e9f('0x25')]);var _0x2f3ef0={'messageId':_0x4695c2[_0x9e9f('0x4d')]};if(!_0x5ba036[_0x9e9f('0x3b')]){_0x2f3ef0['read']=!![];}return _0x29aebc[_0x9e9f('0x19')](_0x2f3ef0);}else{logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x4e'),util[_0x9e9f('0x4f')](_0x4ef460,{'showHidden':![],'depth':null}));}}else{logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),'clickSend',util['inspect'](_0x4ef460,{'showHidden':![],'depth':null}));}})[_0x9e9f('0x1b')](function(_0x1649a5){logger['error'](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x4e'),util[_0x9e9f('0x4f')](_0x1649a5,{'showHidden':![],'depth':null}));});}else{logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x4e'),_0x9e9f('0x3e'));}break;case'plivo':if(_0x5ba036['authId']&&_0x5ba036[_0x9e9f('0x23')]){var _0x3676d3={'dst':_0x408a12[_0x9e9f('0x24')],'text':_0x408a12[_0x9e9f('0xd')],'src':_0x5ba036[_0x9e9f('0x40')]||_0x5ba036['phone'],'url':_0x5ba036[_0x9e9f('0x27')]+_0x9e9f('0x28')+_0x408a12['id']+_0x9e9f('0x50')+_0x5ba036['token']};var _0x529091=util['format'](_0x9e9f('0x48'),_0x5ba036[_0x9e9f('0x51')],_0x5ba036['authToken']);var _0xa837dd={'method':'POST','uri':util['format'](_0x9e9f('0x52'),_0x5ba036['authId']),'body':_0x3676d3,'headers':{'Authorization':util[_0x9e9f('0x47')](_0x9e9f('0x53'),new Buffer(_0x529091)[_0x9e9f('0x54')](_0x9e9f('0x4a')))},'json':!![]};rp(_0xa837dd)['then'](function(_0x3c6d62){var _0x1665ce={'messageId':_0x3c6d62[_0x9e9f('0x55')][0x0]};return _0x29aebc['update'](_0x1665ce);})['catch'](function(_0xf4c3cb){logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x56'),util[_0x9e9f('0x4f')](_0xf4c3cb,{'showHidden':![],'depth':null}));});}else{logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x5ba036[_0x9e9f('0x2f')]&&_0x5ba036[_0x9e9f('0x45')]){if(_0x5ba036['baseUrl']){var _0x2b6ede={'method':_0x9e9f('0x36'),'uri':_0x5ba036[_0x9e9f('0x57')]+'/auth/1/session','body':{'username':_0x5ba036[_0x9e9f('0x2f')],'password':_0x5ba036[_0x9e9f('0x45')]},'json':!![]};return rp(_0x2b6ede)[_0x9e9f('0x1f')](function(_0x122510){var _0x3629d0={'method':_0x9e9f('0x36'),'uri':_0x5ba036[_0x9e9f('0x57')]+_0x9e9f('0x58'),'body':{'messages':[{'from':_0x5ba036['phone'],'destinations':[{'to':_0x408a12[_0x9e9f('0x24')]}],'text':_0x408a12[_0x9e9f('0xd')],'notifyUrl':_0x5ba036[_0x9e9f('0x27')]+_0x9e9f('0x28')+_0x408a12['id']+'/status?token='+_0x5ba036['token'],'notifyContentType':_0x9e9f('0x59'),'callbackData':_0x5ba036[_0x9e9f('0x24')]+';'+_0x408a12[_0x9e9f('0xd')]}]},'headers':{'Authorization':_0x9e9f('0x5a')+_0x122510['token']},'json':!![]};return rp(_0x3629d0)[_0x9e9f('0x1f')](function(_0x274bad){if(_0x274bad[_0x9e9f('0x25')]){var _0x4e0fd1={'messageId':_0x274bad[_0x9e9f('0x25')][0x0][_0x9e9f('0xb')]};if(!_0x5ba036[_0x9e9f('0x3b')]){_0x4e0fd1[_0x9e9f('0x3c')]=!![];}return _0x29aebc[_0x9e9f('0x19')](_0x4e0fd1);}else{return logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x5b'),util['inspect'](_0x274bad,{'showHidden':![],'depth':null}));}});})[_0x9e9f('0x1b')](function(_0x191aad){return logger['error'](_0x9e9f('0x2c'),_0x9e9f('0x2b'),'infobip',util[_0x9e9f('0x4f')](_0x191aad,{'showHidden':![],'depth':null}));});}else{logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),'infobip',_0x9e9f('0x5c'));}}else{logger['error'](_0x9e9f('0x2c'),'afterCreate',_0x9e9f('0x5b'),_0x9e9f('0x3e'));}break;case _0x9e9f('0x5d'):var _0x3db281=require(_0x9e9f('0x5e'));if(_0x5ba036[_0x9e9f('0x5f')]){var _0xb1418={};_0xb1418[_0x9e9f('0x60')]=_0x5ba036['username'];_0xb1418[_0x9e9f('0x24')]=_0x408a12[_0x9e9f('0x24')];_0xb1418[_0x9e9f('0x31')]=_0x5ba036[_0x9e9f('0x24')];_0xb1418[_0x9e9f('0x61')]=_0x408a12[_0x9e9f('0xd')];_0xb1418[_0x9e9f('0x62')]=+new Date();var _0x79e21e='';var _0x57ed7f='';var _0x596972=Object[_0x9e9f('0x63')](_0xb1418);_0x596972['sort']();for(var _0x488511=0x0;_0x488511<_0x596972[_0x9e9f('0x64')];_0x488511++){if(_0x79e21e!=''){_0x79e21e+='&';}_0x79e21e+=_0x596972[_0x488511]+'='+encodeURIComponent(_0xb1418[_0x596972[_0x488511]]);_0x57ed7f+=_0xb1418[_0x596972[_0x488511]];}_0x57ed7f+=_0x5ba036[_0x9e9f('0x5f')];_0x57ed7f=_0x3db281['createHash']('md5')[_0x9e9f('0x19')](_0x57ed7f)[_0x9e9f('0x65')]('hex');if(_0x79e21e!==''){_0x79e21e+='&';}_0x79e21e+=_0x9e9f('0x66')+_0x57ed7f;var _0x3af39b={'method':_0x9e9f('0x34'),'uri':_0x5ba036[_0x9e9f('0x57')]+_0x9e9f('0x67')+_0x79e21e,'json':!![]};return rp(_0x3af39b)[_0x9e9f('0x1f')](function(_0x487aea){var _0x3e9593=Object[_0x9e9f('0x63')](_0x487aea);if(_0x487aea[_0x3e9593[0x0]][_0x9e9f('0x1c')]&&parseInt(_0x487aea[_0x3e9593[0x0]][_0x9e9f('0x1c')])===0x0){var _0x517c2b={'messageId':_0x487aea[_0x3e9593[0x0]][_0x9e9f('0x68')]};if(!_0x5ba036[_0x9e9f('0x3b')]){_0x517c2b[_0x9e9f('0x3c')]=!![];}return _0x29aebc[_0x9e9f('0x19')](_0x517c2b);}else{return logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x5d'),util['inspect'](_0x487aea[_0x9e9f('0x1c')],{'showHidden':![],'depth':null}));}})[_0x9e9f('0x1b')](function(_0x2a64cd){return logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x5d'),util['inspect'](_0x2a64cd,{'showHidden':![],'depth':null}));});}else{logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x5d'),_0x9e9f('0x69'));}break;case'clickatell':if(_0x5ba036[_0x9e9f('0x5f')]){var _0x11c33e={'method':_0x9e9f('0x36'),'uri':_0x9e9f('0x6a'),'headers':{'Authorization':_0x5ba036[_0x9e9f('0x5f')]},'body':{'content':_0x408a12[_0x9e9f('0xd')],'to':[_0x408a12[_0x9e9f('0x24')]],'from':_0x5ba036[_0x9e9f('0x24')],'binary':![],'clientMessageId':_0x9e9f('0x6b'),'charset':_0x9e9f('0x6c')},'json':!![]};rp(_0x11c33e)[_0x9e9f('0x1f')](function(_0x9a4b2d){if(!_0x9a4b2d[_0x9e9f('0x1c')]){var _0x9e5335={'messageId':_0x9a4b2d[_0x9e9f('0x25')][0x0][_0x9e9f('0x6d')]};if(!_0x5ba036[_0x9e9f('0x3b')]){_0x9e5335[_0x9e9f('0x3c')]=!![];}return _0x29aebc['update'](_0x9e5335);}else{return logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x6e'),util[_0x9e9f('0x4f')](_0x9a4b2d[_0x9e9f('0x1c')],{'showHidden':![],'depth':null}));}})[_0x9e9f('0x1b')](function(_0x22007e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e9f('0x2b'),_0x9e9f('0x6e'),util[_0x9e9f('0x4f')](_0x22007e,{'showHidden':![],'depth':null}));});}else{logger[_0x9e9f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9e9f('0x6e'),_0x9e9f('0x69'));}break;case _0x9e9f('0x6f'):if(_0x5ba036['username']&&_0x5ba036[_0x9e9f('0x45')]){var _0x529091=util['format'](_0x9e9f('0x48'),_0x5ba036[_0x9e9f('0x2f')],_0x5ba036[_0x9e9f('0x45')]);var _0xa837dd={'method':_0x9e9f('0x36'),'uri':_0x9e9f('0x70')+_0x5ba036[_0x9e9f('0x71')]+_0x9e9f('0x72'),'body':{'to':[_0x408a12['phone']],'text':_0x408a12[_0x9e9f('0xd')],'from':_0x5ba036[_0x9e9f('0x24')],'applicationId':_0x5ba036[_0x9e9f('0x73')]},'headers':{'Authorization':util['format'](_0x9e9f('0x53'),new Buffer(_0x529091)[_0x9e9f('0x54')]('base64'))},'json':!![]};rp(_0xa837dd)[_0x9e9f('0x1f')](function(_0x541d34){if(_0x541d34['id']){var _0xc7c26a={'messageId':_0x541d34['id']};return _0x29aebc[_0x9e9f('0x19')](_0xc7c26a);}else{logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),'afterCreate',_0x9e9f('0x6f'),util[_0x9e9f('0x4f')](_0x541d34,{'showHidden':![],'depth':null}));}})['catch'](function(_0x376608){logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x6f'),util[_0x9e9f('0x4f')](_0x376608,{'showHidden':![],'depth':null}));});}else{logger[_0x9e9f('0x1c')](_0x9e9f('0x2c'),_0x9e9f('0x2b'),'bandwidth',_0x9e9f('0x3e'));}break;case _0x9e9f('0x74'):if(_0x5ba036[_0x9e9f('0x5f')]){var _0x8c7007={};var _0x3af39b={'method':_0x9e9f('0x36'),'uri':_0x9e9f('0x75'),'headers':{'Authorization':_0x9e9f('0x76')+_0x5ba036['apiKey'],'Content-Type':_0x9e9f('0x59')},'body':{'from':_0x5ba036[_0x9e9f('0x24')],'to':_0x408a12[_0x9e9f('0x24')],'text':_0x408a12[_0x9e9f('0xd')]},'json':!![]};return rp(_0x3af39b)['then'](function(_0x3e0448){if(_0x3e0448[_0x9e9f('0x77')]==0xca){_0x8c7007[_0x9e9f('0x78')]=_0x3e0448;var _0x459d6e={'method':_0x9e9f('0x36'),'uri':_0x9e9f('0x79'),'headers':{'Authorization':_0x9e9f('0x76')+_0x5ba036[_0x9e9f('0x5f')],'Content-Type':_0x9e9f('0x59')},'body':{'refid':_0x8c7007['message']['refid']},'json':!![]};return rp(_0x459d6e)[_0x9e9f('0x1f')](function(_0x5e48ac){_0x8c7007[_0x9e9f('0x7a')]=_0x5e48ac;var _0x4c24bf={'messageId':_0x8c7007['message']['refid'],'read':!![]};return _0x29aebc[_0x9e9f('0x19')](_0x4c24bf);});}else{return logger[_0x9e9f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e9f('0x2b'),'intelepeer',util[_0x9e9f('0x4f')](_0x3e0448,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4451b0){return logger['error'](_0x9e9f('0x2c'),_0x9e9f('0x2b'),_0x9e9f('0x74'),util[_0x9e9f('0x4f')](_0x4451b0,{'showHidden':![],'depth':null}));});}else{return logger[_0x9e9f('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e9f('0x2b'),'intelepeer',_0x9e9f('0x7b'));}break;}}})[_0x9e9f('0x7c')](function(){_0x140b9b();});}else{_0x140b9b();}}},'charset':_0x9e9f('0x7d'),'collate':_0x9e9f('0x7e')});}; \ No newline at end of file +var _0x6c50=['remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','timestamp','keys','sort','length','createHash','md5','digest','signature=','GET','/external/get/send.php?','id_sms','clickatell','apiMessageId','bandwidth','accountId','/messages','applicationId','toString','intelepeer','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','toLowerCase','out','secret','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','direction','catch','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','sid','inspect','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','password','sms','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','senderString','POST','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x6c50,0xa4));var _0x06c5=function(_0xf7a2ff,_0xe15d5c){_0xf7a2ff=_0xf7a2ff-0x0;var _0x536f45=_0x6c50[_0xf7a2ff];return _0x536f45;};'use strict';var _=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var logger=require(_0x06c5('0x2'))(_0x06c5('0x3'));var moment=require('moment');var BPromise=require(_0x06c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x06c5('0x5'));var rimraf=require(_0x06c5('0x6'));var config=require(_0x06c5('0x7'));var attributes=require(_0x06c5('0x8'));module[_0x06c5('0x9')]=function(_0x463f4f,_0x3f5b56){return _0x463f4f[_0x06c5('0xa')](_0x06c5('0xb'),attributes,{'tableName':_0x06c5('0xc'),'paranoid':![],'indexes':[{'name':_0x06c5('0xd'),'fields':['messageId']},{'name':_0x06c5('0xe'),'fields':[_0x06c5('0xf')],'type':_0x06c5('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18f1e9,_0x4e863c,_0x510444){var _0x5ea57c=_0x463f4f[_0x06c5('0x11')];var _0x4a31d1=_0x18f1e9['get']({'plain':!![]});if(_0x4a31d1['direction'][_0x06c5('0x12')]()==='in'||_0x4a31d1['direction'][_0x06c5('0x12')]()===_0x06c5('0x13')&&!_0x4a31d1[_0x06c5('0x14')]&&!_['isNil'](_0x4a31d1[_0x06c5('0x15')])){_0x5ea57c[_0x06c5('0x16')][_0x06c5('0x17')]({'where':{'id':_0x4a31d1[_0x06c5('0x18')]}})['then'](function(_0x4e8669){if(_0x4e8669){_0x4e8669[_0x06c5('0x19')]({'lastMsgAt':_0x4a31d1[_0x06c5('0x1a')],'lastMsgDirection':_0x4a31d1[_0x06c5('0x1b')]['toLowerCase']()});}})[_0x06c5('0x1c')](function(_0x117371){console['error'](_0x117371);});}if(_0x4a31d1[_0x06c5('0x1b')]===_0x06c5('0x13')&&!_0x4a31d1[_0x06c5('0x14')]){var _0xb48b48;_0x5ea57c[_0x06c5('0x1d')][_0x06c5('0x1e')]({'where':{'id':_0x4a31d1[_0x06c5('0x1f')]},'raw':!![]})[_0x06c5('0x20')](function(_0x1393f5){_0xb48b48=_0x1393f5;if(_0xb48b48&&_0xb48b48[_0x06c5('0x21')]){switch(_0xb48b48[_0x06c5('0x21')]){case _0x06c5('0x22'):var _0x359dbe=require(_0x06c5('0x22'));if(_0xb48b48[_0x06c5('0x23')]&&_0xb48b48[_0x06c5('0x24')]&&_0xb48b48[_0x06c5('0x25')]){var _0x4ba7e9=new _0x359dbe(_0xb48b48[_0x06c5('0x23')],_0xb48b48[_0x06c5('0x24')]);_0x4ba7e9[_0x06c5('0x26')][_0x06c5('0x27')]({'body':_0x4a31d1[_0x06c5('0xf')],'to':_0x4a31d1[_0x06c5('0x25')],'from':_0xb48b48[_0x06c5('0x25')],'statusCallback':_0xb48b48['remote']+_0x06c5('0x28')+_0x4a31d1['id']+_0x06c5('0x29')+_0xb48b48[_0x06c5('0x2a')]})[_0x06c5('0x20')](function(_0x368e2f){if(_0x368e2f[_0x06c5('0x2b')]){return _0x18f1e9[_0x06c5('0x19')]({'messageId':_0x368e2f['sid']});}})[_0x06c5('0x1c')](function(_0x5aeb6c){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x06c5('0x22'),util[_0x06c5('0x2c')](_0x5aeb6c,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),'twilio',_0x06c5('0x30'));}break;case _0x06c5('0x31'):var _0x2731c7=_0x06c5('0x32');if(_0xb48b48[_0x06c5('0x33')]&&_0xb48b48['password']){var _0x38f6a7={'recipient':[_0x4a31d1[_0x06c5('0x25')]],'message':_0x4a31d1[_0x06c5('0xf')],'message_type':_0xb48b48['smsMethod']};if(_0xb48b48[_0x06c5('0x34')]&&_0xb48b48[_0x06c5('0x34')]!=='SI'){_0x38f6a7[_0x06c5('0x35')]=_0xb48b48['phone'];}var _0x548bd1={'url':_0x2731c7+'login?username='+_0xb48b48[_0x06c5('0x33')]+'&password='+_0xb48b48[_0x06c5('0x36')],'method':'GET'};rp(_0x548bd1)[_0x06c5('0x20')](function(_0x573011){var _0x270003=_0x573011['split'](';');var _0x5311d8={'user_key':_0x270003[0x0],'session_key':_0x270003[0x1]};_0x548bd1={'url':_0x2731c7+_0x06c5('0x37'),'method':'POST','headers':{'user_key':_0x5311d8['user_key'],'Session_key':_0x5311d8[_0x06c5('0x38')]},'json':!![],'body':_0x38f6a7};return rp(_0x548bd1);})[_0x06c5('0x20')](function(_0x2e40a4){if(_0x2e40a4[_0x06c5('0x39')]>=0x1){var _0x347e02={'messageId':_0x2e40a4[_0x06c5('0x3a')]};if(_0xb48b48[_0x06c5('0x34')]!=='GP'||!_0xb48b48['deliveryReport']){_0x347e02[_0x06c5('0x3b')]=!![];}return _0x18f1e9['update'](_0x347e02);}else{return logger['error'](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x31'),util[_0x06c5('0x2c')](_0x2e40a4,{'showHidden':![],'depth':null}));}})[_0x06c5('0x1c')](function(_0x43ba11){return logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x06c5('0x31'),util[_0x06c5('0x2c')](_0x43ba11,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x31'),_0x06c5('0x3c'));}break;case'connectel':if(_0xb48b48[_0x06c5('0x24')]){var _0x4fedcd={'recipient':_0x4a31d1[_0x06c5('0x25')],'message':_0x4a31d1['body'],'sender':_0xb48b48[_0x06c5('0x3d')]||_0xb48b48[_0x06c5('0x25')],'authorization':_0xb48b48['authToken']};var _0x4e863c={'method':_0x06c5('0x3e'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4fedcd,'json':!![]};rp(_0x4e863c)[_0x06c5('0x20')](function(_0x5c090d){var _0xf276d3={'messageId':_0x5c090d[_0x06c5('0x3f')]};if(!_0xb48b48[_0x06c5('0x40')]){_0xf276d3[_0x06c5('0x3b')]=!![];}return _0x18f1e9[_0x06c5('0x19')](_0xf276d3);})[_0x06c5('0x1c')](function(_0xffcf3d){logger['error'](_0x06c5('0x2e'),'afterCreate','connectel',util[_0x06c5('0x2c')](_0xffcf3d,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x41'),_0x06c5('0x42'));}break;case _0x06c5('0x43'):if(_0xb48b48['username']&&_0xb48b48['password']){var _0x4fedcd={'messages':[{'source':_0x06c5('0x44'),'to':_0x4a31d1['phone'],'body':_0x4a31d1[_0x06c5('0xf')],'from':_0xb48b48[_0x06c5('0x3d')]||_0xb48b48[_0x06c5('0x25')]}]};var _0xbb5467=util[_0x06c5('0x45')](_0x06c5('0x46'),_0xb48b48[_0x06c5('0x33')],_0xb48b48[_0x06c5('0x36')]);var _0x4e863c={'method':'POST','uri':_0x06c5('0x47'),'body':_0x4fedcd,'headers':{'Authorization':util[_0x06c5('0x45')](_0x06c5('0x48'),new Buffer(_0xbb5467)['toString'](_0x06c5('0x49')))},'json':!![]};rp(_0x4e863c)[_0x06c5('0x20')](function(_0x560156){if(_0x560156[_0x06c5('0x4a')]>=0xc8&&_0x560156[_0x06c5('0x4a')]<=0xce){if(_0x560156[_0x06c5('0x4b')]&&_0x560156['data'][_0x06c5('0x4c')]>0x0){var _0xb07ec7=_[_0x06c5('0x4d')](_0x560156[_0x06c5('0x4b')][_0x06c5('0x26')]);var _0x51a807={'messageId':_0xb07ec7[_0x06c5('0x4e')]};if(!_0xb48b48[_0x06c5('0x40')]){_0x51a807[_0x06c5('0x3b')]=!![];}return _0x18f1e9[_0x06c5('0x19')](_0x51a807);}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x4f'),util['inspect'](_0x560156,{'showHidden':![],'depth':null}));}}else{logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x06c5('0x4f'),util[_0x06c5('0x2c')](_0x560156,{'showHidden':![],'depth':null}));}})['catch'](function(_0x129de6){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x4f'),util[_0x06c5('0x2c')](_0x129de6,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x4f'),_0x06c5('0x3c'));}break;case _0x06c5('0x50'):if(_0xb48b48[_0x06c5('0x51')]&&_0xb48b48[_0x06c5('0x24')]){var _0x4fedcd={'dst':_0x4a31d1[_0x06c5('0x25')],'text':_0x4a31d1[_0x06c5('0xf')],'src':_0xb48b48['senderString']||_0xb48b48[_0x06c5('0x25')],'url':_0xb48b48[_0x06c5('0x52')]+_0x06c5('0x28')+_0x4a31d1['id']+_0x06c5('0x29')+_0xb48b48['token']};var _0xbb5467=util['format'](_0x06c5('0x46'),_0xb48b48['authId'],_0xb48b48['authToken']);var _0x4e863c={'method':_0x06c5('0x3e'),'uri':util[_0x06c5('0x45')](_0x06c5('0x53'),_0xb48b48[_0x06c5('0x51')]),'body':_0x4fedcd,'headers':{'Authorization':util['format'](_0x06c5('0x48'),new Buffer(_0xbb5467)['toString']('base64'))},'json':!![]};rp(_0x4e863c)[_0x06c5('0x20')](function(_0x563931){var _0x105d09={'messageId':_0x563931[_0x06c5('0x54')][0x0]};return _0x18f1e9[_0x06c5('0x19')](_0x105d09);})['catch'](function(_0x42bc8b){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x50'),util[_0x06c5('0x2c')](_0x42bc8b,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x50'),_0x06c5('0x55'));}break;case _0x06c5('0x56'):if(_0xb48b48[_0x06c5('0x33')]&&_0xb48b48[_0x06c5('0x36')]){if(_0xb48b48[_0x06c5('0x57')]){var _0x4909b9={'method':_0x06c5('0x3e'),'uri':_0xb48b48[_0x06c5('0x57')]+'/auth/1/session','body':{'username':_0xb48b48[_0x06c5('0x33')],'password':_0xb48b48['password']},'json':!![]};return rp(_0x4909b9)[_0x06c5('0x20')](function(_0xa68091){var _0x537949={'method':_0x06c5('0x3e'),'uri':_0xb48b48['baseUrl']+_0x06c5('0x58'),'body':{'messages':[{'from':_0xb48b48[_0x06c5('0x25')],'destinations':[{'to':_0x4a31d1[_0x06c5('0x25')]}],'text':_0x4a31d1[_0x06c5('0xf')],'notifyUrl':_0xb48b48[_0x06c5('0x52')]+_0x06c5('0x28')+_0x4a31d1['id']+'/status?token='+_0xb48b48[_0x06c5('0x2a')],'notifyContentType':_0x06c5('0x59'),'callbackData':_0xb48b48['phone']+';'+_0x4a31d1['body']}]},'headers':{'Authorization':_0x06c5('0x5a')+_0xa68091[_0x06c5('0x2a')]},'json':!![]};return rp(_0x537949)['then'](function(_0x406661){if(_0x406661['messages']){var _0x5446c3={'messageId':_0x406661['messages'][0x0][_0x06c5('0xd')]};if(!_0xb48b48[_0x06c5('0x40')]){_0x5446c3[_0x06c5('0x3b')]=!![];}return _0x18f1e9['update'](_0x5446c3);}else{return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x56'),util['inspect'](_0x406661,{'showHidden':![],'depth':null}));}});})[_0x06c5('0x1c')](function(_0x435e18){return logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x06c5('0x2c')](_0x435e18,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x56'),_0x06c5('0x5b'));}}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x56'),_0x06c5('0x3c'));}break;case _0x06c5('0x5c'):var _0xa2265d=require(_0x06c5('0x5d'));if(_0xb48b48[_0x06c5('0x5e')]){var _0xb05b9f={};_0xb05b9f['login']=_0xb48b48[_0x06c5('0x33')];_0xb05b9f[_0x06c5('0x25')]=_0x4a31d1[_0x06c5('0x25')];_0xb05b9f[_0x06c5('0x35')]=_0xb48b48['phone'];_0xb05b9f['text']=_0x4a31d1['body'];_0xb05b9f[_0x06c5('0x5f')]=+new Date();var _0x12975b='';var _0x577f2e='';var _0x36f7a3=Object[_0x06c5('0x60')](_0xb05b9f);_0x36f7a3[_0x06c5('0x61')]();for(var _0x510ba2=0x0;_0x510ba2<_0x36f7a3[_0x06c5('0x62')];_0x510ba2++){if(_0x12975b!=''){_0x12975b+='&';}_0x12975b+=_0x36f7a3[_0x510ba2]+'='+encodeURIComponent(_0xb05b9f[_0x36f7a3[_0x510ba2]]);_0x577f2e+=_0xb05b9f[_0x36f7a3[_0x510ba2]];}_0x577f2e+=_0xb48b48[_0x06c5('0x5e')];_0x577f2e=_0xa2265d[_0x06c5('0x63')](_0x06c5('0x64'))[_0x06c5('0x19')](_0x577f2e)[_0x06c5('0x65')]('hex');if(_0x12975b!==''){_0x12975b+='&';}_0x12975b+=_0x06c5('0x66')+_0x577f2e;var _0x548bd1={'method':_0x06c5('0x67'),'uri':_0xb48b48['baseUrl']+_0x06c5('0x68')+_0x12975b,'json':!![]};return rp(_0x548bd1)['then'](function(_0x1e7383){var _0x367b59=Object[_0x06c5('0x60')](_0x1e7383);if(_0x1e7383[_0x367b59[0x0]][_0x06c5('0x2d')]&&parseInt(_0x1e7383[_0x367b59[0x0]]['error'])===0x0){var _0x33328c={'messageId':_0x1e7383[_0x367b59[0x0]][_0x06c5('0x69')]};if(!_0xb48b48['deliveryReport']){_0x33328c['read']=!![];}return _0x18f1e9[_0x06c5('0x19')](_0x33328c);}else{return logger['error'](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x5c'),util[_0x06c5('0x2c')](_0x1e7383[_0x06c5('0x2d')],{'showHidden':![],'depth':null}));}})[_0x06c5('0x1c')](function(_0x1a1daf){return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),'csc',util['inspect'](_0x1a1daf,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x5c'),'Missing\x20parameters:\x20apiKey');}break;case _0x06c5('0x6a'):if(_0xb48b48[_0x06c5('0x5e')]){var _0x5854f1={'method':_0x06c5('0x3e'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xb48b48[_0x06c5('0x5e')]},'body':{'content':_0x4a31d1[_0x06c5('0xf')],'to':[_0x4a31d1[_0x06c5('0x25')]],'from':_0xb48b48['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x5854f1)[_0x06c5('0x20')](function(_0x1e3e0e){if(!_0x1e3e0e[_0x06c5('0x2d')]){var _0x25cb9c={'messageId':_0x1e3e0e[_0x06c5('0x26')][0x0][_0x06c5('0x6b')]};if(!_0xb48b48[_0x06c5('0x40')]){_0x25cb9c[_0x06c5('0x3b')]=!![];}return _0x18f1e9['update'](_0x25cb9c);}else{return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x6a'),util[_0x06c5('0x2c')](_0x1e3e0e['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x360ebb){return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x6a'),util[_0x06c5('0x2c')](_0x360ebb,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x6a'),'Missing\x20parameters:\x20apiKey');}break;case _0x06c5('0x6c'):if(_0xb48b48[_0x06c5('0x33')]&&_0xb48b48[_0x06c5('0x36')]){var _0xbb5467=util[_0x06c5('0x45')]('%s:%s',_0xb48b48[_0x06c5('0x33')],_0xb48b48[_0x06c5('0x36')]);var _0x4e863c={'method':_0x06c5('0x3e'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xb48b48[_0x06c5('0x6d')]+_0x06c5('0x6e'),'body':{'to':[_0x4a31d1[_0x06c5('0x25')]],'text':_0x4a31d1['body'],'from':_0xb48b48[_0x06c5('0x25')],'applicationId':_0xb48b48[_0x06c5('0x6f')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xbb5467)[_0x06c5('0x70')](_0x06c5('0x49')))},'json':!![]};rp(_0x4e863c)[_0x06c5('0x20')](function(_0x52aeaf){if(_0x52aeaf['id']){var _0x222a84={'messageId':_0x52aeaf['id']};return _0x18f1e9[_0x06c5('0x19')](_0x222a84);}else{logger['error'](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x6c'),util[_0x06c5('0x2c')](_0x52aeaf,{'showHidden':![],'depth':null}));}})[_0x06c5('0x1c')](function(_0x3f3221){logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x6c'),util[_0x06c5('0x2c')](_0x3f3221,{'showHidden':![],'depth':null}));});}else{logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x06c5('0x2f'),_0x06c5('0x6c'),_0x06c5('0x3c'));}break;case _0x06c5('0x71'):if(_0xb48b48[_0x06c5('0x5e')]){var _0xa446de={};var _0x548bd1={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x06c5('0x72')+_0xb48b48[_0x06c5('0x5e')],'Content-Type':_0x06c5('0x59')},'body':{'from':_0xb48b48[_0x06c5('0x25')],'to':_0x4a31d1[_0x06c5('0x25')],'text':_0x4a31d1[_0x06c5('0xf')]},'json':!![]};return rp(_0x548bd1)[_0x06c5('0x20')](function(_0x265334){if(_0x265334[_0x06c5('0x73')]==0xca){_0xa446de[_0x06c5('0x74')]=_0x265334;var _0x5aec42={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x06c5('0x72')+_0xb48b48[_0x06c5('0x5e')],'Content-Type':_0x06c5('0x59')},'body':{'refid':_0xa446de[_0x06c5('0x74')][_0x06c5('0x75')]},'json':!![]};return rp(_0x5aec42)['then'](function(_0x1e7937){_0xa446de[_0x06c5('0x76')]=_0x1e7937;var _0x375cc5={'messageId':_0xa446de['message'][_0x06c5('0x75')],'read':!![]};return _0x18f1e9['update'](_0x375cc5);});}else{return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),'afterCreate',_0x06c5('0x71'),util[_0x06c5('0x2c')](_0x265334,{'showHidden':![],'depth':null}));}})[_0x06c5('0x1c')](function(_0x25b1b6){return logger[_0x06c5('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x06c5('0x71'),util[_0x06c5('0x2c')](_0x25b1b6,{'showHidden':![],'depth':null}));});}else{return logger[_0x06c5('0x2d')](_0x06c5('0x2e'),_0x06c5('0x2f'),_0x06c5('0x71'),_0x06c5('0x77'));}break;}}})[_0x06c5('0x78')](function(){_0x510444();});}else{_0x510444();}}},'charset':_0x06c5('0x79'),'collate':_0x06c5('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ae4d612..fa73dc9 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 _0x62c1=['stringify','error','code','message','result','SmsMessage,\x20%s,\x20%s','SmsMessage','create','body','options','raw','CreateSmsMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','request\x20sent','debug'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x62c1,0x1a5));var _0x162c=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x62c1[_0x50f392];return _0x5926f2;};'use strict';var _=require(_0x162c('0x0'));var util=require(_0x162c('0x1'));var moment=require(_0x162c('0x2'));var BPromise=require(_0x162c('0x3'));var rs=require(_0x162c('0x4'));var fs=require('fs');var Redis=require(_0x162c('0x5'));var db=require(_0x162c('0x6'))['db'];var utils=require(_0x162c('0x7'));var logger=require('../../config/logger')(_0x162c('0x8'));var config=require(_0x162c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x162c('0xa')][_0x162c('0xb')]({'port':0x232a});config[_0x162c('0xc')]=_['defaults'](config[_0x162c('0xc')],{'host':_0x162c('0xd'),'port':0x18eb});var socket=require(_0x162c('0xe'))(new Redis(config[_0x162c('0xc')]));require(_0x162c('0xf'))['register'](socket);function respondWithRpcPromise(_0x1c4ed6,_0x27f4d3,_0x5458bb){return new BPromise(function(_0x582579,_0x27aa99){return client[_0x162c('0x10')](_0x1c4ed6,_0x5458bb)[_0x162c('0x11')](function(_0x2a9d6d){logger[_0x162c('0x12')]('SmsMessage,\x20%s,\x20%s',_0x27f4d3,_0x162c('0x13'));logger[_0x162c('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27f4d3,_0x162c('0x13'),JSON[_0x162c('0x15')](_0x2a9d6d));if(_0x2a9d6d[_0x162c('0x16')]){if(_0x2a9d6d['error'][_0x162c('0x17')]===0x1f4){logger[_0x162c('0x16')]('SmsMessage,\x20%s,\x20%s',_0x27f4d3,_0x2a9d6d[_0x162c('0x16')][_0x162c('0x18')]);return _0x27aa99(_0x2a9d6d[_0x162c('0x16')]['message']);}logger[_0x162c('0x16')]('SmsMessage,\x20%s,\x20%s',_0x27f4d3,_0x2a9d6d['error'][_0x162c('0x18')]);return _0x582579(_0x2a9d6d['error'][_0x162c('0x18')]);}else{logger[_0x162c('0x12')]('SmsMessage,\x20%s,\x20%s',_0x27f4d3,'request\x20sent');_0x582579(_0x2a9d6d[_0x162c('0x19')][_0x162c('0x18')]);}})['catch'](function(_0x24b70b){logger[_0x162c('0x16')](_0x162c('0x1a'),_0x27f4d3,_0x24b70b);_0x27aa99(_0x24b70b);});});}exports['CreateSmsMessage']=function(_0x4b5224){var _0x3803ab=this;return new Promise(function(_0x29cfee,_0x4e3853){return db[_0x162c('0x1b')][_0x162c('0x1c')](_0x4b5224[_0x162c('0x1d')],{'raw':_0x4b5224[_0x162c('0x1e')]?_0x4b5224[_0x162c('0x1e')][_0x162c('0x1f')]===undefined?!![]:![]:!![]})[_0x162c('0x11')](function(_0x26c1d8){logger[_0x162c('0x12')](_0x162c('0x20'),_0x4b5224);logger[_0x162c('0x14')](_0x162c('0x20'),_0x4b5224,JSON[_0x162c('0x15')](_0x26c1d8));_0x29cfee(_0x26c1d8);})[_0x162c('0x21')](function(_0xa0b821){logger['error']('CreateSmsMessage',_0xa0b821[_0x162c('0x18')],_0x4b5224);_0x4e3853(_0x3803ab[_0x162c('0x16')](0x1f4,_0xa0b821[_0x162c('0x18')]));});});}; \ No newline at end of file +var _0x6dc9=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','body','options','raw','CreateSmsMessage','stringify','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6dc9,0x140));var _0x96dc=function(_0xf9cdbe,_0x1a692c){_0xf9cdbe=_0xf9cdbe-0x0;var _0x47b102=_0x6dc9[_0xf9cdbe];return _0x47b102;};'use strict';var _=require('lodash');var util=require(_0x96dc('0x0'));var moment=require(_0x96dc('0x1'));var BPromise=require(_0x96dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96dc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x96dc('0x4'))(_0x96dc('0x5'));var config=require(_0x96dc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x96dc('0x7')]({'port':0x232a});config[_0x96dc('0x8')]=_[_0x96dc('0x9')](config['redis'],{'host':_0x96dc('0xa'),'port':0x18eb});var socket=require(_0x96dc('0xb'))(new Redis(config[_0x96dc('0x8')]));require(_0x96dc('0xc'))[_0x96dc('0xd')](socket);function respondWithRpcPromise(_0x45b7d5,_0x2c76af,_0x3fb33f){return new BPromise(function(_0x2a325c,_0x1a2ad1){return client[_0x96dc('0xe')](_0x45b7d5,_0x3fb33f)[_0x96dc('0xf')](function(_0x1d5607){logger[_0x96dc('0x10')](_0x96dc('0x11'),_0x2c76af,_0x96dc('0x12'));logger[_0x96dc('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c76af,_0x96dc('0x12'),JSON['stringify'](_0x1d5607));if(_0x1d5607[_0x96dc('0x14')]){if(_0x1d5607[_0x96dc('0x14')]['code']===0x1f4){logger[_0x96dc('0x14')](_0x96dc('0x11'),_0x2c76af,_0x1d5607[_0x96dc('0x14')][_0x96dc('0x15')]);return _0x1a2ad1(_0x1d5607[_0x96dc('0x14')]['message']);}logger[_0x96dc('0x14')](_0x96dc('0x11'),_0x2c76af,_0x1d5607[_0x96dc('0x14')][_0x96dc('0x15')]);return _0x2a325c(_0x1d5607[_0x96dc('0x14')]['message']);}else{logger[_0x96dc('0x10')](_0x96dc('0x11'),_0x2c76af,'request\x20sent');_0x2a325c(_0x1d5607['result'][_0x96dc('0x15')]);}})[_0x96dc('0x16')](function(_0x2f2b18){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2c76af,_0x2f2b18);_0x1a2ad1(_0x2f2b18);});});}exports['CreateSmsMessage']=function(_0x52011c){var _0x388309=this;return new Promise(function(_0x46043d,_0x50d8b1){return db['SmsMessage']['create'](_0x52011c[_0x96dc('0x17')],{'raw':_0x52011c[_0x96dc('0x18')]?_0x52011c['options'][_0x96dc('0x19')]===undefined?!![]:![]:!![]})[_0x96dc('0xf')](function(_0x42b43b){logger[_0x96dc('0x10')](_0x96dc('0x1a'),_0x52011c);logger[_0x96dc('0x13')](_0x96dc('0x1a'),_0x52011c,JSON[_0x96dc('0x1b')](_0x42b43b));_0x46043d(_0x42b43b);})[_0x96dc('0x16')](function(_0xef097a){logger[_0x96dc('0x14')]('CreateSmsMessage',_0xef097a[_0x96dc('0x15')],_0x52011c);_0x50d8b1(_0x388309['error'](0x1f4,_0xef097a[_0x96dc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 00a7a85..7c65755 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 _0x57bb=['length','smsMessage:','./smsMessage.events','update','emit','register'];(function(_0x51d116,_0x3ca26a){var _0xf7d604=function(_0x9b4c65){while(--_0x9b4c65){_0x51d116['push'](_0x51d116['shift']());}};_0xf7d604(++_0x3ca26a);}(_0x57bb,0x8c));var _0xb57b=function(_0x187df4,_0x45b7a0){_0x187df4=_0x187df4-0x0;var _0x281455=_0x57bb[_0x187df4];return _0x281455;};'use strict';var SmsMessageEvents=require(_0xb57b('0x0'));var events=['save','remove',_0xb57b('0x1')];function createListener(_0x35ff0a,_0x43c2ee){return function(_0x4af1a4){_0x43c2ee[_0xb57b('0x2')](_0x35ff0a,_0x4af1a4);};}function removeListener(_0x3bdec3,_0x36fd09){return function(){SmsMessageEvents['removeListener'](_0x3bdec3,_0x36fd09);};}exports[_0xb57b('0x3')]=function(_0x6f6db){for(var _0x2c4780=0x0,_0x48d405=events[_0xb57b('0x4')];_0x2c4780<_0x48d405;_0x2c4780++){var _0x1285ca=events[_0x2c4780];var _0x123893=createListener(_0xb57b('0x5')+_0x1285ca,_0x6f6db);SmsMessageEvents['on'](_0x1285ca,_0x123893);}}; \ No newline at end of file +var _0xd7f8=['emit','removeListener','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x3e0a0e,_0x1ecf6d){var _0x8e0d0a=function(_0x521ce6){while(--_0x521ce6){_0x3e0a0e['push'](_0x3e0a0e['shift']());}};_0x8e0d0a(++_0x1ecf6d);}(_0xd7f8,0x13c));var _0x8d7f=function(_0x2d4686,_0x3d6dbb){_0x2d4686=_0x2d4686-0x0;var _0x16f68b=_0xd7f8[_0x2d4686];return _0x16f68b;};'use strict';var SmsMessageEvents=require(_0x8d7f('0x0'));var events=[_0x8d7f('0x1'),_0x8d7f('0x2'),_0x8d7f('0x3')];function createListener(_0x13008a,_0x575ae6){return function(_0x400b0a){_0x575ae6[_0x8d7f('0x4')](_0x13008a,_0x400b0a);};}function removeListener(_0x978c6d,_0x4ee446){return function(){SmsMessageEvents[_0x8d7f('0x5')](_0x978c6d,_0x4ee446);};}exports['register']=function(_0x2019f5){for(var _0x1cc9d9=0x0,_0x456795=events[_0x8d7f('0x6')];_0x1cc9d9<_0x456795;_0x1cc9d9++){var _0x47f80c=events[_0x1cc9d9];var _0x50fa95=createListener(_0x8d7f('0x7')+_0x47f80c,_0x2019f5);SmsMessageEvents['on'](_0x47f80c,_0x50fa95);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index fe77b48..12b273d 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 _0xaac9=['create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','index','describe','/:id','isAuthenticated','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x59a0d6,_0x403058){var _0x15351e=function(_0x213bc8){while(--_0x213bc8){_0x59a0d6['push'](_0x59a0d6['shift']());}};_0x15351e(++_0x403058);}(_0xaac9,0x9a));var _0x9aac=function(_0x5abb00,_0x342d70){_0x5abb00=_0x5abb00-0x0;var _0xf9b854=_0xaac9[_0x5abb00];return _0xf9b854;};'use strict';var multer=require(_0x9aac('0x0'));var util=require(_0x9aac('0x1'));var path=require('path');var timeout=require(_0x9aac('0x2'));var express=require('express');var router=express[_0x9aac('0x3')]();var fs_extra=require(_0x9aac('0x4'));var auth=require(_0x9aac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9aac('0x6'));var controller=require(_0x9aac('0x7'));router[_0x9aac('0x8')]('/',auth['isAuthenticated'](),controller[_0x9aac('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9aac('0xa')]);router['get'](_0x9aac('0xb'),auth[_0x9aac('0xc')](),controller[_0x9aac('0xd')]);router[_0x9aac('0x8')](_0x9aac('0xe'),auth[_0x9aac('0xc')](),controller['getMembers']);router[_0x9aac('0x8')](_0x9aac('0xf'),auth[_0x9aac('0xc')](),controller[_0x9aac('0x10')]);router[_0x9aac('0x8')](_0x9aac('0x11'),auth[_0x9aac('0xc')](),controller[_0x9aac('0x12')]);router[_0x9aac('0x13')]('/',auth['isAuthenticated'](),controller[_0x9aac('0x14')]);router[_0x9aac('0x13')](_0x9aac('0xf'),auth[_0x9aac('0xc')](),controller[_0x9aac('0x15')]);router[_0x9aac('0x13')]('/:id/users',auth[_0x9aac('0xc')](),controller[_0x9aac('0x16')]);router[_0x9aac('0x17')](_0x9aac('0xb'),auth[_0x9aac('0xc')](),controller[_0x9aac('0x18')]);router[_0x9aac('0x19')](_0x9aac('0xb'),auth[_0x9aac('0xc')](),controller[_0x9aac('0x1a')]);router[_0x9aac('0x19')](_0x9aac('0xf'),auth['isAuthenticated'](),controller[_0x9aac('0x1b')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x9aac('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x9dbc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','path'];(function(_0xd472f7,_0x4ccb2b){var _0x1a3dd7=function(_0x25665f){while(--_0x25665f){_0xd472f7['push'](_0xd472f7['shift']());}};_0x1a3dd7(++_0x4ccb2b);}(_0x9dbc,0xad));var _0xc9db=function(_0xcbeb21,_0x3901cf){_0xcbeb21=_0xcbeb21-0x0;var _0x258afd=_0x9dbc[_0xcbeb21];return _0x258afd;};'use strict';var multer=require(_0xc9db('0x0'));var util=require('util');var path=require(_0xc9db('0x1'));var timeout=require(_0xc9db('0x2'));var express=require(_0xc9db('0x3'));var router=express[_0xc9db('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc9db('0x5'));var interaction=require(_0xc9db('0x6'));var config=require(_0xc9db('0x7'));var controller=require(_0xc9db('0x8'));router[_0xc9db('0x9')]('/',auth[_0xc9db('0xa')](),controller['index']);router[_0xc9db('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc9db('0x9')](_0xc9db('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc9db('0x9')](_0xc9db('0xc'),auth[_0xc9db('0xa')](),controller['getMembers']);router[_0xc9db('0x9')]('/:id/teams',auth[_0xc9db('0xa')](),controller['getTeams']);router[_0xc9db('0x9')](_0xc9db('0xd'),auth['isAuthenticated'](),controller[_0xc9db('0xe')]);router[_0xc9db('0xf')]('/',auth[_0xc9db('0xa')](),controller[_0xc9db('0x10')]);router[_0xc9db('0xf')](_0xc9db('0x11'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x12')]);router['post'](_0xc9db('0xd'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x13')]);router[_0xc9db('0x14')](_0xc9db('0xb'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x15')]);router[_0xc9db('0x16')](_0xc9db('0xb'),auth[_0xc9db('0xa')](),controller[_0xc9db('0x17')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xc9db('0x16')]('/:id/users',auth[_0xc9db('0xa')](),controller[_0xc9db('0x18')]);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 652a54a..3b5496b 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 _0x8a6e=['roundrobin','STRING','name','ENUM','rrmemory','beepall'];(function(_0x23a045,_0x5b9e91){var _0x4b57ed=function(_0x30c33d){while(--_0x30c33d){_0x23a045['push'](_0x23a045['shift']());}};_0x4b57ed(++_0x5b9e91);}(_0x8a6e,0x103));var _0xe8a6=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x8a6e[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe8a6('0x0')],'unique':_0xe8a6('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe8a6('0x2')](_0xe8a6('0x3'),_0xe8a6('0x4'),_0xe8a6('0x5'))}}; \ No newline at end of file +var _0xe063=['STRING','INTEGER','rrmemory','beepall','sequelize','exports','name'];(function(_0x43305f,_0x320675){var _0x32a65f=function(_0x3497f9){while(--_0x3497f9){_0x43305f['push'](_0x43305f['shift']());}};_0x32a65f(++_0x320675);}(_0xe063,0x1af));var _0x3e06=function(_0x10c47c,_0x1cccf3){_0x10c47c=_0x10c47c-0x0;var _0x630c62=_0xe063[_0x10c47c];return _0x630c62;};'use strict';var Sequelize=require(_0x3e06('0x0'));module[_0x3e06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3e06('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3e06('0x3')]},'timeout':{'type':Sequelize[_0x3e06('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3e06('0x5'),_0x3e06('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 260ef14..cf64a4e 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 _0x855d=['removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','transaction','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','removeAgents','isArray','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','update','destroy','then','get','SmsQueues','UserProfileResource','error','stack','name','send','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAndCountAll','map','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','each','emit'];(function(_0x2df832,_0x745627){var _0x17b853=function(_0x3ffe5d){while(--_0x3ffe5d){_0x2df832['push'](_0x2df832['shift']());}};_0x17b853(++_0x745627);}(_0x855d,0x1d2));var _0xd855=function(_0x5de0c0,_0x16dfb7){_0x5de0c0=_0x5de0c0-0x0;var _0x598aa7=_0x855d[_0x5de0c0];return _0x598aa7;};'use strict';var emlformat=require(_0xd855('0x0'));var rimraf=require(_0xd855('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd855('0x2'));var rp=require(_0xd855('0x3'));var moment=require(_0xd855('0x4'));var BPromise=require(_0xd855('0x5'));var Mustache=require(_0xd855('0x6'));var util=require(_0xd855('0x7'));var path=require(_0xd855('0x8'));var sox=require(_0xd855('0x9'));var csv=require(_0xd855('0xa'));var ejs=require(_0xd855('0xb'));var fs=require('fs');var fs_extra=require(_0xd855('0xc'));var _=require('lodash');var squel=require(_0xd855('0xd'));var crypto=require(_0xd855('0xe'));var jsforce=require(_0xd855('0xf'));var deskjs=require(_0xd855('0x10'));var toCsv=require(_0xd855('0xa'));var querystring=require('querystring');var Papa=require(_0xd855('0x11'));var Redis=require('ioredis');var authService=require(_0xd855('0x12'));var qs=require(_0xd855('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd855('0x14'));var logger=require(_0xd855('0x15'))(_0xd855('0x16'));var utils=require(_0xd855('0x17'));var config=require(_0xd855('0x18'));var licenseUtil=require(_0xd855('0x19'));var db=require(_0xd855('0x1a'))['db'];config[_0xd855('0x1b')]=_['defaults'](config[_0xd855('0x1b')],{'host':_0xd855('0x1c'),'port':0x18eb});var socket=require(_0xd855('0x1d'))(new Redis(config[_0xd855('0x1b')]));require(_0xd855('0x1e'))[_0xd855('0x1f')](socket);function respondWithStatusCode(_0x177462,_0xcf72f5){_0xcf72f5=_0xcf72f5||0xcc;return function(_0x1536b2){if(_0x1536b2){return _0x177462[_0xd855('0x20')](_0xcf72f5);}return _0x177462['status'](_0xcf72f5)[_0xd855('0x21')]();};}function respondWithResult(_0x2a0929,_0x5e8f91){_0x5e8f91=_0x5e8f91||0xc8;return function(_0xafb6){if(_0xafb6){return _0x2a0929['status'](_0x5e8f91)['json'](_0xafb6);}};}function respondWithFilteredResult(_0x54d218,_0x34a5c1){return function(_0x950adb){if(_0x950adb){var _0x20f1ea=typeof _0x34a5c1[_0xd855('0x22')]===_0xd855('0x23')&&typeof _0x34a5c1[_0xd855('0x24')]===_0xd855('0x23');var _0x52c0a6=_0x950adb[_0xd855('0x25')];var _0x4d8770=_0x20f1ea?0x0:_0x34a5c1[_0xd855('0x22')];var _0x16713b=_0x20f1ea?_0x950adb[_0xd855('0x25')]:_0x34a5c1[_0xd855('0x22')]+_0x34a5c1[_0xd855('0x24')];var _0x5eb990;if(_0x16713b>=_0x52c0a6){_0x16713b=_0x52c0a6;_0x5eb990=0xc8;}else{_0x5eb990=0xce;}_0x54d218[_0xd855('0x26')](_0x5eb990);return _0x54d218[_0xd855('0x27')](_0xd855('0x28'),_0x4d8770+'-'+_0x16713b+'/'+_0x52c0a6)[_0xd855('0x29')](_0x950adb);}return null;};}function patchUpdates(_0x8ebef6){return function(_0x2809b2){try{jsonpatch[_0xd855('0x2a')](_0x2809b2,_0x8ebef6,!![]);}catch(_0x5945d7){return BPromise[_0xd855('0x2b')](_0x5945d7);}return _0x2809b2['save']();};}function saveUpdates(_0x1c30a9,_0x5492ea){return function(_0x2cf36a){if(_0x2cf36a){return _0x2cf36a[_0xd855('0x2c')](_0x1c30a9)['then'](function(_0x484d17){return _0x484d17;});}return null;};}function removeEntity(_0xeb548c,_0x1f741d){return function(_0x52f1a3){if(_0x52f1a3){return _0x52f1a3[_0xd855('0x2d')]()[_0xd855('0x2e')](function(){var _0x1b15df=_0x52f1a3[_0xd855('0x2f')]({'plain':!![]});var _0x310006=_0xd855('0x30');return db[_0xd855('0x31')][_0xd855('0x2d')]({'where':{'type':_0x310006,'resourceId':_0x1b15df['id']}})['then'](function(){return _0x52f1a3;});})[_0xd855('0x2e')](function(){_0xeb548c[_0xd855('0x26')](0xcc)[_0xd855('0x21')]();});}};}function handleEntityNotFound(_0x1a7a84,_0x1882f1){return function(_0x1a82f7){if(!_0x1a82f7){_0x1a7a84['sendStatus'](0x194);}return _0x1a82f7;};}function handleError(_0x35c929,_0x2fab1d){_0x2fab1d=_0x2fab1d||0x1f4;return function(_0x371f8a){logger[_0xd855('0x32')](_0x371f8a[_0xd855('0x33')]);if(_0x371f8a[_0xd855('0x34')]){delete _0x371f8a[_0xd855('0x34')];}_0x35c929[_0xd855('0x26')](_0x2fab1d)[_0xd855('0x35')](_0x371f8a);};}exports['index']=function(_0x1abcf8,_0x193aa0){var _0x3e4bb5={},_0x23cfed={},_0x374dbc={'count':0x0,'rows':[]};var _0x4d52a1=_['map'](db[_0xd855('0x36')][_0xd855('0x37')],function(_0x1b2fa1){return{'name':_0x1b2fa1[_0xd855('0x38')],'type':_0x1b2fa1[_0xd855('0x39')][_0xd855('0x3a')]};});_0x23cfed[_0xd855('0x3b')]=_['map'](_0x4d52a1,_0xd855('0x34'));_0x23cfed[_0xd855('0x3c')]=_[_0xd855('0x3d')](_0x1abcf8[_0xd855('0x3c')]);_0x23cfed['filters']=_[_0xd855('0x3e')](_0x23cfed['model'],_0x23cfed[_0xd855('0x3c')]);_0x3e4bb5['attributes']=_[_0xd855('0x3e')](_0x23cfed[_0xd855('0x3b')],qs['fields'](_0x1abcf8[_0xd855('0x3c')][_0xd855('0x3f')]));_0x3e4bb5[_0xd855('0x40')]=_0x3e4bb5['attributes'][_0xd855('0x41')]?_0x3e4bb5[_0xd855('0x40')]:_0x23cfed[_0xd855('0x3b')];if(!_0x1abcf8[_0xd855('0x3c')]['hasOwnProperty'](_0xd855('0x42'))){_0x3e4bb5[_0xd855('0x24')]=qs[_0xd855('0x24')](_0x1abcf8[_0xd855('0x3c')]['limit']);_0x3e4bb5[_0xd855('0x22')]=qs['offset'](_0x1abcf8[_0xd855('0x3c')]['offset']);}_0x3e4bb5[_0xd855('0x43')]=qs['sort'](_0x1abcf8[_0xd855('0x3c')][_0xd855('0x44')]);_0x3e4bb5[_0xd855('0x45')]=qs[_0xd855('0x46')](_[_0xd855('0x47')](_0x1abcf8[_0xd855('0x3c')],_0x23cfed[_0xd855('0x46')]),_0x4d52a1);if(_0x1abcf8[_0xd855('0x3c')]['filter']){_0x3e4bb5[_0xd855('0x45')]=_[_0xd855('0x48')](_0x3e4bb5[_0xd855('0x45')],{'$or':_['map'](_0x4d52a1,function(_0x5c57e5){if(_0x5c57e5[_0xd855('0x39')]!==_0xd855('0x49')){var _0x31e63a={};_0x31e63a[_0x5c57e5[_0xd855('0x34')]]={'$like':'%'+_0x1abcf8[_0xd855('0x3c')][_0xd855('0x4a')]+'%'};return _0x31e63a;}})});}_0x3e4bb5=_['merge']({},_0x3e4bb5,_0x1abcf8[_0xd855('0x4b')]);var _0x463c67={'where':_0x3e4bb5[_0xd855('0x45')]};return db[_0xd855('0x36')][_0xd855('0x25')](_0x463c67)['then'](function(_0x111e17){_0x374dbc[_0xd855('0x25')]=_0x111e17;if(_0x1abcf8[_0xd855('0x3c')][_0xd855('0x4c')]){_0x3e4bb5[_0xd855('0x4d')]=[{'all':!![]}];}return db[_0xd855('0x36')][_0xd855('0x4e')](_0x3e4bb5);})[_0xd855('0x2e')](function(_0x1d34a6){_0x374dbc[_0xd855('0x4f')]=_0x1d34a6;return _0x374dbc;})[_0xd855('0x2e')](respondWithFilteredResult(_0x193aa0,_0x3e4bb5))[_0xd855('0x50')](handleError(_0x193aa0,null));};exports['show']=function(_0x5d6f28,_0x3cdd11){var _0x5d543b={'raw':!![],'where':{'id':_0x5d6f28[_0xd855('0x51')]['id']}},_0x4703ce={};_0x4703ce[_0xd855('0x3b')]=_[_0xd855('0x3d')](db[_0xd855('0x36')][_0xd855('0x37')]);_0x4703ce[_0xd855('0x3c')]=_[_0xd855('0x3d')](_0x5d6f28[_0xd855('0x3c')]);_0x4703ce[_0xd855('0x46')]=_[_0xd855('0x3e')](_0x4703ce[_0xd855('0x3b')],_0x4703ce[_0xd855('0x3c')]);_0x5d543b[_0xd855('0x40')]=_['intersection'](_0x4703ce[_0xd855('0x3b')],qs[_0xd855('0x3f')](_0x5d6f28[_0xd855('0x3c')]['fields']));_0x5d543b[_0xd855('0x40')]=_0x5d543b[_0xd855('0x40')]['length']?_0x5d543b[_0xd855('0x40')]:_0x4703ce[_0xd855('0x3b')];if(_0x5d6f28[_0xd855('0x3c')][_0xd855('0x4c')]){_0x5d543b[_0xd855('0x4d')]=[{'all':!![]}];}_0x5d543b=_[_0xd855('0x48')]({},_0x5d543b,_0x5d6f28['options']);return db[_0xd855('0x36')][_0xd855('0x52')](_0x5d543b)[_0xd855('0x2e')](handleEntityNotFound(_0x3cdd11,null))[_0xd855('0x2e')](respondWithResult(_0x3cdd11,null))[_0xd855('0x50')](handleError(_0x3cdd11,null));};exports[_0xd855('0x53')]=function(_0x1c550b,_0x31b7c1){return db['SmsQueue'][_0xd855('0x53')](_0x1c550b['body'],{})[_0xd855('0x2e')](function(_0x24c116){var _0x94866f=_0x1c550b[_0xd855('0x54')]['get']({'plain':!![]});if(!_0x94866f)throw new Error(_0xd855('0x55'));if(_0x94866f['role']===_0xd855('0x54')){var _0x3a89f6=_0x24c116[_0xd855('0x2f')]({'plain':!![]});var _0x1b3a59=_0xd855('0x30');return db[_0xd855('0x56')][_0xd855('0x52')]({'where':{'name':_0x1b3a59,'userProfileId':_0x94866f[_0xd855('0x57')]},'raw':!![]})[_0xd855('0x2e')](function(_0xfc5c96){if(_0xfc5c96&&_0xfc5c96[_0xd855('0x58')]===0x0){return db[_0xd855('0x31')][_0xd855('0x53')]({'name':_0x3a89f6[_0xd855('0x34')],'resourceId':_0x3a89f6['id'],'type':_0xfc5c96[_0xd855('0x34')],'sectionId':_0xfc5c96['id']},{})[_0xd855('0x2e')](function(){return _0x24c116;});}else{return _0x24c116;}})[_0xd855('0x50')](function(_0x57cc62){logger[_0xd855('0x32')](_0xd855('0x59'),_0x57cc62);throw _0x57cc62;});}return _0x24c116;})[_0xd855('0x2e')](respondWithResult(_0x31b7c1,0xc9))[_0xd855('0x50')](handleError(_0x31b7c1,null));};exports[_0xd855('0x2c')]=function(_0x37cbc3,_0x2d3785){if(_0x37cbc3[_0xd855('0x5a')]['id']){delete _0x37cbc3['body']['id'];}return db[_0xd855('0x36')]['find']({'where':{'id':_0x37cbc3[_0xd855('0x51')]['id']}})[_0xd855('0x2e')](handleEntityNotFound(_0x2d3785,null))[_0xd855('0x2e')](saveUpdates(_0x37cbc3['body'],null))['then'](respondWithResult(_0x2d3785,null))[_0xd855('0x50')](handleError(_0x2d3785,null));};exports['destroy']=function(_0x5c726a,_0x2020ce){return db[_0xd855('0x36')][_0xd855('0x52')]({'where':{'id':_0x5c726a['params']['id']}})[_0xd855('0x2e')](handleEntityNotFound(_0x2020ce,null))[_0xd855('0x2e')](removeEntity(_0x2020ce,null))['catch'](handleError(_0x2020ce,null));};exports[_0xd855('0x5b')]=function(_0x27283a,_0x47803a){return db[_0xd855('0x36')][_0xd855('0x5b')]()[_0xd855('0x2e')](respondWithResult(_0x47803a,null))[_0xd855('0x50')](handleError(_0x47803a,null));};exports[_0xd855('0x5c')]=function(_0x5e2051,_0x2445e8,_0x13c617){var _0x2ff2cc={'raw':!![],'where':{}},_0x1586b3={},_0x66cd78;return db[_0xd855('0x36')][_0xd855('0x5d')]({'where':{'id':_0x5e2051['params']['id']}})[_0xd855('0x2e')](handleEntityNotFound(_0x2445e8,null))['then'](function(_0x57576f){if(_0x57576f){_0x66cd78=_0x57576f[_0xd855('0x2f')]({'plain':!![]});_0x1586b3[_0xd855('0x3b')]=_[_0xd855('0x3d')](db[_0xd855('0x5e')][_0xd855('0x37')]);_0x1586b3[_0xd855('0x3c')]=_[_0xd855('0x3d')](_0x5e2051[_0xd855('0x3c')]);_0x1586b3[_0xd855('0x46')]=_['intersection'](_0x1586b3[_0xd855('0x3b')],_0x1586b3['query']);_0x2ff2cc[_0xd855('0x40')]=_[_0xd855('0x3e')](_0x1586b3['model'],qs[_0xd855('0x3f')](_0x5e2051[_0xd855('0x3c')]['fields']));_0x2ff2cc[_0xd855('0x40')]=_0x2ff2cc[_0xd855('0x40')][_0xd855('0x41')]?_0x2ff2cc[_0xd855('0x40')]:_0x1586b3[_0xd855('0x3b')];if(!_0x5e2051['query']['hasOwnProperty'](_0xd855('0x42'))){_0x2ff2cc[_0xd855('0x24')]=qs[_0xd855('0x24')](_0x5e2051[_0xd855('0x3c')][_0xd855('0x24')]);_0x2ff2cc[_0xd855('0x22')]=qs['offset'](_0x5e2051['query']['offset']);}_0x2ff2cc['order']=qs['sort'](_0x5e2051[_0xd855('0x3c')][_0xd855('0x44')]);_0x2ff2cc[_0xd855('0x45')]=qs[_0xd855('0x46')](_[_0xd855('0x47')](_0x5e2051['query'],_0x1586b3[_0xd855('0x46')]));_0x2ff2cc[_0xd855('0x45')][_0xd855('0x5f')]=_0x57576f['id'];if(_0x5e2051[_0xd855('0x3c')][_0xd855('0x4a')]){_0x2ff2cc['where']=_[_0xd855('0x48')](_0x2ff2cc[_0xd855('0x45')],{'$or':_['map'](_0x2ff2cc[_0xd855('0x40')],function(_0x55398f){var _0x449fee={};_0x449fee[_0x55398f]={'$like':'%'+_0x5e2051['query'][_0xd855('0x4a')]+'%'};return _0x449fee;})});}_0x2ff2cc=_[_0xd855('0x48')]({},_0x2ff2cc,_0x5e2051[_0xd855('0x4b')]);return db[_0xd855('0x5e')][_0xd855('0x4e')](_0x2ff2cc);}})[_0xd855('0x2e')](function(_0xec2112){if(_0xec2112){return db['User'][_0xd855('0x60')]({'where':{'id':_[_0xd855('0x61')](_0xec2112,'UserId'),'role':_0xd855('0x62')},'attributes':['id',_0xd855('0x34'),_0xd855('0x63'),_0xd855('0x64'),_0xd855('0x65')]});}})[_0xd855('0x2e')](function(_0x536380){if(_0x536380){return{'count':_0x536380[_0xd855('0x25')],'rows':_[_0xd855('0x61')](_0x536380[_0xd855('0x4f')],function(_0x3b5852){return{'membername':_0x3b5852[_0xd855('0x34')],'UserId':_0x3b5852['id'],'queue_name':_0x66cd78[_0xd855('0x34')],'SmsQueueId':_0x66cd78['id'],'interface':util[_0xd855('0x66')](_0xd855('0x67'),_0xd855('0x68'),_0x3b5852[_0xd855('0x34')]),'penalty':0x0,'paused':_0x3b5852['smsPause'],'createdAt':_0x3b5852[_0xd855('0x65')],'updatedAt':_0x3b5852[_0xd855('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd855('0x2e')](respondWithFilteredResult(_0x2445e8,_0x2ff2cc))[_0xd855('0x50')](handleError(_0x2445e8,null));};exports[_0xd855('0x69')]=function(_0x42af2b,_0xffd35e,_0x4dd27f){var _0x1c215e={};var _0x1dab37={};var _0x14336b;var _0x42b4fa;return db[_0xd855('0x36')][_0xd855('0x5d')]({'where':{'id':_0x42af2b[_0xd855('0x51')]['id']}})[_0xd855('0x2e')](handleEntityNotFound(_0xffd35e,null))[_0xd855('0x2e')](function(_0x470fdc){if(_0x470fdc){_0x14336b=_0x470fdc;_0x1dab37[_0xd855('0x3b')]=_[_0xd855('0x3d')](db[_0xd855('0x6a')][_0xd855('0x37')]);_0x1dab37['query']=_['keys'](_0x42af2b['query']);_0x1dab37[_0xd855('0x46')]=_[_0xd855('0x3e')](_0x1dab37['model'],_0x1dab37[_0xd855('0x3c')]);_0x1c215e[_0xd855('0x40')]=_[_0xd855('0x3e')](_0x1dab37[_0xd855('0x3b')],qs[_0xd855('0x3f')](_0x42af2b[_0xd855('0x3c')][_0xd855('0x3f')]));_0x1c215e[_0xd855('0x40')]=_0x1c215e[_0xd855('0x40')][_0xd855('0x41')]?_0x1c215e['attributes']:_0x1dab37['model'];_0x1c215e[_0xd855('0x43')]=qs['sort'](_0x42af2b[_0xd855('0x3c')][_0xd855('0x44')]);_0x1c215e[_0xd855('0x45')]=qs[_0xd855('0x46')](_['pick'](_0x42af2b[_0xd855('0x3c')],_0x1dab37['filters']));if(_0x42af2b[_0xd855('0x3c')]['filter']){_0x1c215e[_0xd855('0x45')]=_['merge'](_0x1c215e[_0xd855('0x45')],{'$or':_[_0xd855('0x61')](_0x1c215e[_0xd855('0x40')],function(_0x187ee3){var _0x53158a={};_0x53158a[_0x187ee3]={'$like':'%'+_0x42af2b[_0xd855('0x3c')]['filter']+'%'};return _0x53158a;})});}_0x1c215e=_[_0xd855('0x48')]({},_0x1c215e,_0x42af2b[_0xd855('0x4b')]);return _0x14336b[_0xd855('0x69')](_0x1c215e);}})[_0xd855('0x2e')](function(_0x264991){if(_0x264991){_0x42b4fa=_0x264991[_0xd855('0x41')];if(!_0x42af2b[_0xd855('0x3c')][_0xd855('0x6b')]('nolimit')){_0x1c215e[_0xd855('0x24')]=qs[_0xd855('0x24')](_0x42af2b[_0xd855('0x3c')][_0xd855('0x24')]);_0x1c215e['offset']=qs[_0xd855('0x22')](_0x42af2b[_0xd855('0x3c')][_0xd855('0x22')]);}return _0x14336b[_0xd855('0x69')](_0x1c215e);}})[_0xd855('0x2e')](function(_0x2b1cca){if(_0x2b1cca){return _0x2b1cca?{'count':_0x42b4fa,'rows':_0x2b1cca}:null;}})[_0xd855('0x2e')](respondWithResult(_0xffd35e,null))[_0xd855('0x50')](handleError(_0xffd35e,null));};exports[_0xd855('0x6c')]=function(_0x542720,_0x367fc8,_0x1284bc){var _0x3df639=_0x542720[_0xd855('0x5a')][_0xd855('0x6d')];return db[_0xd855('0x6a')][_0xd855('0x4e')]({'where':{'id':_0x3df639},'attributes':['id'],'include':[{'model':db[_0xd855('0x6e')],'as':_0xd855('0x6f'),'attributes':['id',_0xd855('0x34'),_0xd855('0x70'),'voicePause',_0xd855('0x71')],'raw':!![]}]})[_0xd855('0x2e')](function(_0x31a1a8){if(_0x31a1a8){var _0x9c5051=_[_0xd855('0x72')](_0x31a1a8,function(_0x39b01a){var _0x1ea693=_0x39b01a['get']({'plain':!![]});return _0x1ea693[_0xd855('0x6f')];});return db[_0xd855('0x36')]['find']({'where':{'id':_0x542720[_0xd855('0x51')]['id']}})['then'](function(_0x2623c7){return db[_0xd855('0x73')]['transaction'](function(_0x515332){return _0x2623c7[_0xd855('0x6c')](_0x3df639,{'transaction':_0x515332})['then'](function(){return BPromise[_0xd855('0x74')](_0x9c5051,function(_0x1c7150){return db[_0xd855('0x5e')]['findOrCreate']({'where':{'UserId':_0x1c7150['id'],'SmsQueueId':_0x542720['params']['id']},'transaction':_0x515332});});})[_0xd855('0x2e')](function(){_0x9c5051['forEach'](function(_0x4741ae){socket[_0xd855('0x75')]('userSmsQueue:save',{'UserId':_0x4741ae['id'],'SmsQueueId':_0x2623c7['id']});});});});});}})[_0xd855('0x2e')](respondWithStatusCode(_0x367fc8,null))['catch'](handleError(_0x367fc8,null));};exports[_0xd855('0x76')]=function(_0x3f7dbc,_0x5338ed,_0x23aa87){return db[_0xd855('0x6a')][_0xd855('0x4e')]({'where':{'id':_0x3f7dbc[_0xd855('0x3c')][_0xd855('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd855('0x2e')](handleEntityNotFound(_0x5338ed,null))['then'](function(_0x5aa41b){var _0x46fd84=_[_0xd855('0x61')](_0x5aa41b,'id');var _0x47c0b4=[];var _0x5094e5=[];var _0x5b5140=squel['select']();_0x5b5140[_0xd855('0x77')](_0xd855('0x78'))[_0xd855('0x79')](_0xd855('0x7a'),'tq')[_0xd855('0x7b')](_0xd855('0x7c'),'ut',_0xd855('0x7d'))[_0xd855('0x45')]('SmsQueueId\x20=\x20?',_0x3f7dbc['params']['id']);for(var _0x2c4629=0x0;_0x2c4629<_0x5aa41b[_0xd855('0x41')];_0x2c4629+=0x1){let _0x2ebada=_0x5aa41b[_0x2c4629];for(var _0x38315d=0x0;_0x38315d<_0x2ebada['Agents'][_0xd855('0x41')];_0x38315d+=0x1){let _0x547eaf=_0x2ebada[_0xd855('0x6f')][_0x38315d];var _0x19f1e9=_0x5b5140[_0xd855('0x7e')]();_0x19f1e9[_0xd855('0x45')]('ut.UserId\x20=\x20?',_0x547eaf['id']);_0x5094e5[_0xd855('0x7f')](db[_0xd855('0x73')][_0xd855('0x3c')](_0x19f1e9[_0xd855('0x80')](),{'type':db[_0xd855('0x73')][_0xd855('0x81')][_0xd855('0x82')]})[_0xd855('0x2e')](function(_0x58e75f){if(_0x58e75f[_0xd855('0x41')]===0x1){return _0x547eaf['id'];}else{var _0x1c5f45=_[_0xd855('0x83')](_[_0xd855('0x61')](_0x58e75f,_0xd855('0x84')),function(_0x1f7615){return _['includes'](_0x46fd84,_0x1f7615);});if(_0x1c5f45){return _0x547eaf['id'];}}}));}}return BPromise[_0xd855('0x85')](_0x5094e5)[_0xd855('0x2e')](function(_0x154958){_0x47c0b4=_(_0x47c0b4)['union'](_0x154958)[_0xd855('0x86')]()[_0xd855('0x87')]();return db['SmsQueue']['find']({'where':{'id':_0x3f7dbc[_0xd855('0x51')]['id']}})[_0xd855('0x2e')](function(_0x13d023){return db[_0xd855('0x73')][_0xd855('0x88')](function(_0x18cc01){return _0x13d023[_0xd855('0x76')](_0x3f7dbc[_0xd855('0x3c')][_0xd855('0x6d')],{'transaction':_0x18cc01})[_0xd855('0x2e')](function(){if(!_[_0xd855('0x89')](_0x47c0b4)){return _0x13d023['removeAgents'](_0x47c0b4,{'transaction':_0x18cc01});}})['then'](function(){_0x47c0b4[_0xd855('0x8a')](function(_0x4a1f20){socket[_0xd855('0x75')](_0xd855('0x8b'),{'UserId':_0x4a1f20,'SmsQueueId':_0x13d023['id']});});});});});});})[_0xd855('0x2e')](respondWithStatusCode(_0x5338ed,null))[_0xd855('0x50')](handleError(_0x5338ed,null));};exports[_0xd855('0x8c')]=function(_0x58f568,_0x4a628c,_0x1ff8a0){return db[_0xd855('0x36')][_0xd855('0x52')]({'where':{'id':_0x58f568['params']['id']}})['then'](handleEntityNotFound(_0x4a628c,null))[_0xd855('0x2e')](function(_0x3a098e){if(_0x3a098e){return _0x3a098e[_0xd855('0x8c')](_0x58f568[_0xd855('0x5a')][_0xd855('0x6d')],_[_0xd855('0x8d')](_0x58f568[_0xd855('0x5a')],['ids','id'])||{})[_0xd855('0x8e')](function(_0x382275){for(var _0x360202=0x0;_0x360202<_0x58f568[_0xd855('0x5a')][_0xd855('0x6d')][_0xd855('0x41')];_0x360202+=0x1){socket[_0xd855('0x75')](_0xd855('0x8f'),{'UserId':Number(_0x58f568[_0xd855('0x5a')][_0xd855('0x6d')][_0x360202]),'SmsQueueId':Number(_0x58f568[_0xd855('0x51')]['id'])});}return _0x382275;});}})[_0xd855('0x2e')](respondWithResult(_0x4a628c,null))[_0xd855('0x50')](handleError(_0x4a628c,null));};exports[_0xd855('0x90')]=function(_0x3e87c8,_0x595624,_0x396c37){return db['SmsQueue'][_0xd855('0x52')]({'where':{'id':_0x3e87c8[_0xd855('0x51')]['id']}})[_0xd855('0x2e')](handleEntityNotFound(_0x595624,null))['then'](function(_0x32167c){if(_0x32167c){return _0x32167c['removeAgents'](_0x3e87c8['query'][_0xd855('0x6d')])[_0xd855('0x2e')](function(){if(_[_0xd855('0x91')](_0x3e87c8[_0xd855('0x3c')]['ids'])){for(var _0x1e6659=0x0;_0x1e6659<_0x3e87c8[_0xd855('0x3c')][_0xd855('0x6d')][_0xd855('0x41')];_0x1e6659+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x3e87c8[_0xd855('0x3c')][_0xd855('0x6d')][_0x1e6659]),'SmsQueueId':Number(_0x3e87c8[_0xd855('0x51')]['id'])});}}else{socket[_0xd855('0x75')]('userSmsQueue:remove',{'UserId':Number(_0x3e87c8[_0xd855('0x3c')]['ids']),'SmsQueueId':Number(_0x3e87c8[_0xd855('0x51')]['id'])});}});}})[_0xd855('0x2e')](respondWithStatusCode(_0x595624,null))[_0xd855('0x50')](handleError(_0x595624,null));};exports['getAgents']=function(_0x57169f,_0x573eef,_0x304389){var _0x5d0656={};var _0x4f671c={};var _0x27004b;var _0x31e854;return db['SmsQueue'][_0xd855('0x5d')]({'where':{'id':_0x57169f[_0xd855('0x51')]['id']}})[_0xd855('0x2e')](handleEntityNotFound(_0x573eef,null))['then'](function(_0x3eab06){if(_0x3eab06){_0x27004b=_0x3eab06;_0x4f671c[_0xd855('0x3b')]=_[_0xd855('0x3d')](db[_0xd855('0x6e')]['rawAttributes']);_0x4f671c['query']=_['keys'](_0x57169f[_0xd855('0x3c')]);_0x4f671c[_0xd855('0x46')]=_[_0xd855('0x3e')](_0x4f671c[_0xd855('0x3b')],_0x4f671c[_0xd855('0x3c')]);_0x5d0656['attributes']=_[_0xd855('0x3e')](_0x4f671c[_0xd855('0x3b')],qs[_0xd855('0x3f')](_0x57169f[_0xd855('0x3c')][_0xd855('0x3f')]));_0x5d0656[_0xd855('0x40')]=_0x5d0656[_0xd855('0x40')][_0xd855('0x41')]?_0x5d0656[_0xd855('0x40')]:_0x4f671c[_0xd855('0x3b')];_0x5d0656[_0xd855('0x43')]=qs[_0xd855('0x44')](_0x57169f[_0xd855('0x3c')][_0xd855('0x44')]);_0x5d0656[_0xd855('0x45')]=qs['filters'](_[_0xd855('0x47')](_0x57169f['query'],_0x4f671c[_0xd855('0x46')]));if(_0x57169f[_0xd855('0x3c')][_0xd855('0x4a')]){_0x5d0656['where']=_['merge'](_0x5d0656['where'],{'$or':_[_0xd855('0x61')](_0x5d0656['attributes'],function(_0x246048){var _0x3f3096={};_0x3f3096[_0x246048]={'$like':'%'+_0x57169f['query']['filter']+'%'};return _0x3f3096;})});}_0x5d0656=_[_0xd855('0x48')]({},_0x5d0656,_0x57169f['options']);return _0x27004b['getAgents'](_0x5d0656);}})[_0xd855('0x2e')](function(_0x46b275){if(_0x46b275){_0x31e854=_0x46b275[_0xd855('0x41')];if(!_0x57169f['query']['hasOwnProperty'](_0xd855('0x42'))){_0x5d0656['limit']=qs['limit'](_0x57169f[_0xd855('0x3c')][_0xd855('0x24')]);_0x5d0656[_0xd855('0x22')]=qs[_0xd855('0x22')](_0x57169f[_0xd855('0x3c')][_0xd855('0x22')]);}return _0x27004b['getAgents'](_0x5d0656);}})[_0xd855('0x2e')](function(_0x991cae){if(_0x991cae){return _0x991cae?{'count':_0x31e854,'rows':_0x991cae}:null;}})[_0xd855('0x2e')](respondWithResult(_0x573eef,null))[_0xd855('0x50')](handleError(_0x573eef,null));}; \ No newline at end of file +var _0x939a=['createdAt','updatedAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','findAll','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','omit','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','get','SmsQueues','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','SmsQueue','includeAll','include','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','pick','User','findAndCountAll','agent','format','%s/%s','SIP','smsPause'];(function(_0x400ed9,_0x3e4e67){var _0x384bed=function(_0x406e07){while(--_0x406e07){_0x400ed9['push'](_0x400ed9['shift']());}};_0x384bed(++_0x3e4e67);}(_0x939a,0x1d7));var _0xa939=function(_0x6593ce,_0x36b00e){_0x6593ce=_0x6593ce-0x0;var _0x406a4e=_0x939a[_0x6593ce];return _0x406a4e;};'use strict';var emlformat=require(_0xa939('0x0'));var rimraf=require(_0xa939('0x1'));var zipdir=require(_0xa939('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa939('0x3'));var moment=require(_0xa939('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa939('0x5'));var util=require(_0xa939('0x6'));var path=require(_0xa939('0x7'));var sox=require(_0xa939('0x8'));var csv=require(_0xa939('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa939('0xa'));var squel=require(_0xa939('0xb'));var crypto=require(_0xa939('0xc'));var jsforce=require(_0xa939('0xd'));var deskjs=require(_0xa939('0xe'));var toCsv=require(_0xa939('0x9'));var querystring=require(_0xa939('0xf'));var Papa=require(_0xa939('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa939('0x11'));var hardwareService=require(_0xa939('0x12'));var logger=require(_0xa939('0x13'))(_0xa939('0x14'));var utils=require('../../config/utils');var config=require(_0xa939('0x15'));var licenseUtil=require(_0xa939('0x16'));var db=require(_0xa939('0x17'))['db'];config['redis']=_[_0xa939('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa939('0x19'))(new Redis(config[_0xa939('0x1a')]));require(_0xa939('0x1b'))[_0xa939('0x1c')](socket);function respondWithStatusCode(_0x298189,_0x34f1e5){_0x34f1e5=_0x34f1e5||0xcc;return function(_0x1aadc3){if(_0x1aadc3){return _0x298189[_0xa939('0x1d')](_0x34f1e5);}return _0x298189[_0xa939('0x1e')](_0x34f1e5)['end']();};}function respondWithResult(_0x8412a8,_0xce4403){_0xce4403=_0xce4403||0xc8;return function(_0x1b3195){if(_0x1b3195){return _0x8412a8['status'](_0xce4403)[_0xa939('0x1f')](_0x1b3195);}};}function respondWithFilteredResult(_0x5a94d7,_0x2c5f5a){return function(_0x5ed0c3){if(_0x5ed0c3){var _0xdd98e3=typeof _0x2c5f5a['offset']===_0xa939('0x20')&&typeof _0x2c5f5a[_0xa939('0x21')]===_0xa939('0x20');var _0x45c5b1=_0x5ed0c3['count'];var _0x36d224=_0xdd98e3?0x0:_0x2c5f5a['offset'];var _0x2c57c4=_0xdd98e3?_0x5ed0c3[_0xa939('0x22')]:_0x2c5f5a[_0xa939('0x23')]+_0x2c5f5a[_0xa939('0x21')];var _0x4378ef;if(_0x2c57c4>=_0x45c5b1){_0x2c57c4=_0x45c5b1;_0x4378ef=0xc8;}else{_0x4378ef=0xce;}_0x5a94d7[_0xa939('0x1e')](_0x4378ef);return _0x5a94d7['set'](_0xa939('0x24'),_0x36d224+'-'+_0x2c57c4+'/'+_0x45c5b1)[_0xa939('0x1f')](_0x5ed0c3);}return null;};}function patchUpdates(_0x4a9b99){return function(_0x53842f){try{jsonpatch['apply'](_0x53842f,_0x4a9b99,!![]);}catch(_0x5956d5){return BPromise[_0xa939('0x25')](_0x5956d5);}return _0x53842f[_0xa939('0x26')]();};}function saveUpdates(_0x17923d,_0x4d2d53){return function(_0x12673e){if(_0x12673e){return _0x12673e[_0xa939('0x27')](_0x17923d)['then'](function(_0x19bcd0){return _0x19bcd0;});}return null;};}function removeEntity(_0x504bea,_0x419f50){return function(_0x5b0417){if(_0x5b0417){return _0x5b0417['destroy']()[_0xa939('0x28')](function(){var _0x3bcef8=_0x5b0417[_0xa939('0x29')]({'plain':!![]});var _0x2bd8d9=_0xa939('0x2a');return db['UserProfileResource'][_0xa939('0x2b')]({'where':{'type':_0x2bd8d9,'resourceId':_0x3bcef8['id']}})[_0xa939('0x28')](function(){return _0x5b0417;});})[_0xa939('0x28')](function(){_0x504bea[_0xa939('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3762d0,_0x241459){return function(_0x3b2860){if(!_0x3b2860){_0x3762d0[_0xa939('0x1d')](0x194);}return _0x3b2860;};}function handleError(_0x526544,_0x1573a3){_0x1573a3=_0x1573a3||0x1f4;return function(_0x52799c){logger[_0xa939('0x2c')](_0x52799c[_0xa939('0x2d')]);if(_0x52799c[_0xa939('0x2e')]){delete _0x52799c[_0xa939('0x2e')];}_0x526544[_0xa939('0x1e')](_0x1573a3)['send'](_0x52799c);};}exports[_0xa939('0x2f')]=function(_0x40c5c3,_0x446b9b){var _0x2e7cb4={},_0x446a57={},_0x5ad629={'count':0x0,'rows':[]};var _0x4b7333=_[_0xa939('0x30')](db['SmsQueue'][_0xa939('0x31')],function(_0x5acddc){return{'name':_0x5acddc[_0xa939('0x32')],'type':_0x5acddc[_0xa939('0x33')][_0xa939('0x34')]};});_0x446a57[_0xa939('0x35')]=_['map'](_0x4b7333,_0xa939('0x2e'));_0x446a57['query']=_[_0xa939('0x36')](_0x40c5c3[_0xa939('0x37')]);_0x446a57[_0xa939('0x38')]=_['intersection'](_0x446a57[_0xa939('0x35')],_0x446a57[_0xa939('0x37')]);_0x2e7cb4[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x446a57['model'],qs[_0xa939('0x3b')](_0x40c5c3[_0xa939('0x37')][_0xa939('0x3b')]));_0x2e7cb4[_0xa939('0x39')]=_0x2e7cb4[_0xa939('0x39')][_0xa939('0x3c')]?_0x2e7cb4[_0xa939('0x39')]:_0x446a57[_0xa939('0x35')];if(!_0x40c5c3[_0xa939('0x37')][_0xa939('0x3d')](_0xa939('0x3e'))){_0x2e7cb4[_0xa939('0x21')]=qs[_0xa939('0x21')](_0x40c5c3[_0xa939('0x37')][_0xa939('0x21')]);_0x2e7cb4[_0xa939('0x23')]=qs[_0xa939('0x23')](_0x40c5c3[_0xa939('0x37')]['offset']);}_0x2e7cb4[_0xa939('0x3f')]=qs[_0xa939('0x40')](_0x40c5c3['query'][_0xa939('0x40')]);_0x2e7cb4['where']=qs[_0xa939('0x38')](_['pick'](_0x40c5c3[_0xa939('0x37')],_0x446a57[_0xa939('0x38')]),_0x4b7333);if(_0x40c5c3['query']['filter']){_0x2e7cb4[_0xa939('0x41')]=_[_0xa939('0x42')](_0x2e7cb4[_0xa939('0x41')],{'$or':_[_0xa939('0x30')](_0x4b7333,function(_0x39febb){if(_0x39febb[_0xa939('0x33')]!=='VIRTUAL'){var _0x53e1f5={};_0x53e1f5[_0x39febb[_0xa939('0x2e')]]={'$like':'%'+_0x40c5c3[_0xa939('0x37')][_0xa939('0x43')]+'%'};return _0x53e1f5;}})});}_0x2e7cb4=_[_0xa939('0x42')]({},_0x2e7cb4,_0x40c5c3['options']);var _0x9255ae={'where':_0x2e7cb4['where']};return db[_0xa939('0x44')][_0xa939('0x22')](_0x9255ae)['then'](function(_0x401f15){_0x5ad629[_0xa939('0x22')]=_0x401f15;if(_0x40c5c3[_0xa939('0x37')][_0xa939('0x45')]){_0x2e7cb4[_0xa939('0x46')]=[{'all':!![]}];}return db[_0xa939('0x44')]['findAll'](_0x2e7cb4);})[_0xa939('0x28')](function(_0x4a2a87){_0x5ad629[_0xa939('0x47')]=_0x4a2a87;return _0x5ad629;})['then'](respondWithFilteredResult(_0x446b9b,_0x2e7cb4))['catch'](handleError(_0x446b9b,null));};exports[_0xa939('0x48')]=function(_0x259031,_0x30d3ea){var _0x4280f4={'raw':!![],'where':{'id':_0x259031[_0xa939('0x49')]['id']}},_0x452406={};_0x452406[_0xa939('0x35')]=_[_0xa939('0x36')](db[_0xa939('0x44')][_0xa939('0x31')]);_0x452406['query']=_[_0xa939('0x36')](_0x259031['query']);_0x452406[_0xa939('0x38')]=_[_0xa939('0x3a')](_0x452406[_0xa939('0x35')],_0x452406['query']);_0x4280f4[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x452406['model'],qs['fields'](_0x259031[_0xa939('0x37')][_0xa939('0x3b')]));_0x4280f4[_0xa939('0x39')]=_0x4280f4[_0xa939('0x39')][_0xa939('0x3c')]?_0x4280f4['attributes']:_0x452406[_0xa939('0x35')];if(_0x259031[_0xa939('0x37')][_0xa939('0x45')]){_0x4280f4[_0xa939('0x46')]=[{'all':!![]}];}_0x4280f4=_['merge']({},_0x4280f4,_0x259031[_0xa939('0x4a')]);return db[_0xa939('0x44')][_0xa939('0x4b')](_0x4280f4)[_0xa939('0x28')](handleEntityNotFound(_0x30d3ea,null))[_0xa939('0x28')](respondWithResult(_0x30d3ea,null))[_0xa939('0x4c')](handleError(_0x30d3ea,null));};exports[_0xa939('0x4d')]=function(_0xac6fc6,_0x178a95){return db[_0xa939('0x44')]['create'](_0xac6fc6[_0xa939('0x4e')],{})[_0xa939('0x28')](function(_0x80025b){var _0x5ca5e3=_0xac6fc6[_0xa939('0x4f')]['get']({'plain':!![]});if(!_0x5ca5e3)throw new Error(_0xa939('0x50'));if(_0x5ca5e3['role']===_0xa939('0x4f')){var _0x2154d5=_0x80025b[_0xa939('0x29')]({'plain':!![]});var _0x2de58d=_0xa939('0x2a');return db[_0xa939('0x51')][_0xa939('0x4b')]({'where':{'name':_0x2de58d,'userProfileId':_0x5ca5e3[_0xa939('0x52')]},'raw':!![]})[_0xa939('0x28')](function(_0x444fae){if(_0x444fae&&_0x444fae['autoAssociation']===0x0){return db[_0xa939('0x53')][_0xa939('0x4d')]({'name':_0x2154d5[_0xa939('0x2e')],'resourceId':_0x2154d5['id'],'type':_0x444fae[_0xa939('0x2e')],'sectionId':_0x444fae['id']},{})['then'](function(){return _0x80025b;});}else{return _0x80025b;}})[_0xa939('0x4c')](function(_0x21abe9){logger['error'](_0xa939('0x54'),_0x21abe9);throw _0x21abe9;});}return _0x80025b;})[_0xa939('0x28')](respondWithResult(_0x178a95,0xc9))[_0xa939('0x4c')](handleError(_0x178a95,null));};exports[_0xa939('0x27')]=function(_0x1fa044,_0x2298a4){if(_0x1fa044[_0xa939('0x4e')]['id']){delete _0x1fa044[_0xa939('0x4e')]['id'];}return db[_0xa939('0x44')]['find']({'where':{'id':_0x1fa044[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x2298a4,null))[_0xa939('0x28')](saveUpdates(_0x1fa044['body'],null))['then'](respondWithResult(_0x2298a4,null))[_0xa939('0x4c')](handleError(_0x2298a4,null));};exports[_0xa939('0x2b')]=function(_0x4a9b8c,_0x2b0c4c){return db[_0xa939('0x44')][_0xa939('0x4b')]({'where':{'id':_0x4a9b8c[_0xa939('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b0c4c,null))['then'](removeEntity(_0x2b0c4c,null))[_0xa939('0x4c')](handleError(_0x2b0c4c,null));};exports['describe']=function(_0x4f36bb,_0x77a29){return db[_0xa939('0x44')][_0xa939('0x55')]()[_0xa939('0x28')](respondWithResult(_0x77a29,null))[_0xa939('0x4c')](handleError(_0x77a29,null));};exports[_0xa939('0x56')]=function(_0x404b08,_0x1cf9ad,_0x14705f){var _0x59a72a={'raw':!![],'where':{}},_0x2f3d30={},_0x5be5d4;return db[_0xa939('0x44')][_0xa939('0x57')]({'where':{'id':_0x404b08[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x1cf9ad,null))[_0xa939('0x28')](function(_0x143a40){if(_0x143a40){_0x5be5d4=_0x143a40['get']({'plain':!![]});_0x2f3d30[_0xa939('0x35')]=_[_0xa939('0x36')](db[_0xa939('0x58')][_0xa939('0x31')]);_0x2f3d30['query']=_[_0xa939('0x36')](_0x404b08[_0xa939('0x37')]);_0x2f3d30[_0xa939('0x38')]=_[_0xa939('0x3a')](_0x2f3d30[_0xa939('0x35')],_0x2f3d30[_0xa939('0x37')]);_0x59a72a[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x2f3d30['model'],qs[_0xa939('0x3b')](_0x404b08['query'][_0xa939('0x3b')]));_0x59a72a[_0xa939('0x39')]=_0x59a72a[_0xa939('0x39')][_0xa939('0x3c')]?_0x59a72a['attributes']:_0x2f3d30[_0xa939('0x35')];if(!_0x404b08[_0xa939('0x37')][_0xa939('0x3d')](_0xa939('0x3e'))){_0x59a72a['limit']=qs[_0xa939('0x21')](_0x404b08['query']['limit']);_0x59a72a[_0xa939('0x23')]=qs['offset'](_0x404b08[_0xa939('0x37')][_0xa939('0x23')]);}_0x59a72a['order']=qs[_0xa939('0x40')](_0x404b08[_0xa939('0x37')][_0xa939('0x40')]);_0x59a72a['where']=qs[_0xa939('0x38')](_[_0xa939('0x59')](_0x404b08[_0xa939('0x37')],_0x2f3d30[_0xa939('0x38')]));_0x59a72a[_0xa939('0x41')]['SmsQueueId']=_0x143a40['id'];if(_0x404b08[_0xa939('0x37')][_0xa939('0x43')]){_0x59a72a[_0xa939('0x41')]=_[_0xa939('0x42')](_0x59a72a[_0xa939('0x41')],{'$or':_[_0xa939('0x30')](_0x59a72a[_0xa939('0x39')],function(_0x5284b9){var _0x5af73d={};_0x5af73d[_0x5284b9]={'$like':'%'+_0x404b08[_0xa939('0x37')]['filter']+'%'};return _0x5af73d;})});}_0x59a72a=_[_0xa939('0x42')]({},_0x59a72a,_0x404b08[_0xa939('0x4a')]);return db['UserSmsQueue']['findAll'](_0x59a72a);}})[_0xa939('0x28')](function(_0x4ff9e8){if(_0x4ff9e8){return db[_0xa939('0x5a')][_0xa939('0x5b')]({'where':{'id':_[_0xa939('0x30')](_0x4ff9e8,'UserId'),'role':_0xa939('0x5c')},'attributes':['id',_0xa939('0x2e'),'smsPause','updatedAt','createdAt']});}})[_0xa939('0x28')](function(_0x4ddcee){if(_0x4ddcee){return{'count':_0x4ddcee['count'],'rows':_[_0xa939('0x30')](_0x4ddcee[_0xa939('0x47')],function(_0x37732a){return{'membername':_0x37732a['name'],'UserId':_0x37732a['id'],'queue_name':_0x5be5d4[_0xa939('0x2e')],'SmsQueueId':_0x5be5d4['id'],'interface':util[_0xa939('0x5d')](_0xa939('0x5e'),_0xa939('0x5f'),_0x37732a['name']),'penalty':0x0,'paused':_0x37732a[_0xa939('0x60')],'createdAt':_0x37732a[_0xa939('0x61')],'updatedAt':_0x37732a[_0xa939('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa939('0x28')](respondWithFilteredResult(_0x1cf9ad,_0x59a72a))['catch'](handleError(_0x1cf9ad,null));};exports[_0xa939('0x63')]=function(_0x2f01d3,_0x2cc387,_0x141b02){var _0x417553={};var _0x572bce={};var _0xd841a3;var _0xd23544;return db[_0xa939('0x44')][_0xa939('0x57')]({'where':{'id':_0x2f01d3[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x2cc387,null))[_0xa939('0x28')](function(_0xf25a66){if(_0xf25a66){_0xd841a3=_0xf25a66;_0x572bce[_0xa939('0x35')]=_[_0xa939('0x36')](db[_0xa939('0x64')][_0xa939('0x31')]);_0x572bce['query']=_[_0xa939('0x36')](_0x2f01d3[_0xa939('0x37')]);_0x572bce[_0xa939('0x38')]=_['intersection'](_0x572bce[_0xa939('0x35')],_0x572bce['query']);_0x417553[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x572bce['model'],qs[_0xa939('0x3b')](_0x2f01d3[_0xa939('0x37')][_0xa939('0x3b')]));_0x417553[_0xa939('0x39')]=_0x417553[_0xa939('0x39')][_0xa939('0x3c')]?_0x417553[_0xa939('0x39')]:_0x572bce[_0xa939('0x35')];_0x417553['order']=qs['sort'](_0x2f01d3[_0xa939('0x37')][_0xa939('0x40')]);_0x417553['where']=qs[_0xa939('0x38')](_[_0xa939('0x59')](_0x2f01d3[_0xa939('0x37')],_0x572bce[_0xa939('0x38')]));if(_0x2f01d3['query'][_0xa939('0x43')]){_0x417553['where']=_[_0xa939('0x42')](_0x417553[_0xa939('0x41')],{'$or':_['map'](_0x417553[_0xa939('0x39')],function(_0x152f01){var _0x517912={};_0x517912[_0x152f01]={'$like':'%'+_0x2f01d3['query'][_0xa939('0x43')]+'%'};return _0x517912;})});}_0x417553=_[_0xa939('0x42')]({},_0x417553,_0x2f01d3[_0xa939('0x4a')]);return _0xd841a3[_0xa939('0x63')](_0x417553);}})[_0xa939('0x28')](function(_0x167ae6){if(_0x167ae6){_0xd23544=_0x167ae6[_0xa939('0x3c')];if(!_0x2f01d3[_0xa939('0x37')][_0xa939('0x3d')]('nolimit')){_0x417553[_0xa939('0x21')]=qs['limit'](_0x2f01d3['query'][_0xa939('0x21')]);_0x417553[_0xa939('0x23')]=qs['offset'](_0x2f01d3[_0xa939('0x37')][_0xa939('0x23')]);}return _0xd841a3['getTeams'](_0x417553);}})[_0xa939('0x28')](function(_0x1efc98){if(_0x1efc98){return _0x1efc98?{'count':_0xd23544,'rows':_0x1efc98}:null;}})['then'](respondWithResult(_0x2cc387,null))[_0xa939('0x4c')](handleError(_0x2cc387,null));};exports['addTeams']=function(_0x310a8e,_0x481f47,_0x303373){var _0x3df7ba=_0x310a8e['body'][_0xa939('0x65')];return db[_0xa939('0x64')]['findAll']({'where':{'id':_0x3df7ba},'attributes':['id'],'include':[{'model':db[_0xa939('0x5a')],'as':_0xa939('0x66'),'attributes':['id',_0xa939('0x2e'),_0xa939('0x67'),_0xa939('0x68'),_0xa939('0x69')],'raw':!![]}]})[_0xa939('0x28')](function(_0x1f124b){if(_0x1f124b){var _0x879995=_[_0xa939('0x6a')](_0x1f124b,function(_0x2cd3c6){var _0x5145b3=_0x2cd3c6[_0xa939('0x29')]({'plain':!![]});return _0x5145b3[_0xa939('0x66')];});return db[_0xa939('0x44')]['find']({'where':{'id':_0x310a8e[_0xa939('0x49')]['id']}})[_0xa939('0x28')](function(_0x277b28){return db[_0xa939('0x6b')][_0xa939('0x6c')](function(_0x4e7ca7){return _0x277b28[_0xa939('0x6d')](_0x3df7ba,{'transaction':_0x4e7ca7})['then'](function(){return BPromise[_0xa939('0x6e')](_0x879995,function(_0xc75844){return db['UserSmsQueue'][_0xa939('0x6f')]({'where':{'UserId':_0xc75844['id'],'SmsQueueId':_0x310a8e[_0xa939('0x49')]['id']},'transaction':_0x4e7ca7});});})[_0xa939('0x28')](function(){_0x879995[_0xa939('0x70')](function(_0x5d4996){socket[_0xa939('0x71')]('userSmsQueue:save',{'UserId':_0x5d4996['id'],'SmsQueueId':_0x277b28['id']});});});});});}})[_0xa939('0x28')](respondWithStatusCode(_0x481f47,null))['catch'](handleError(_0x481f47,null));};exports[_0xa939('0x72')]=function(_0x50a3f1,_0x4b996f,_0x3121f7){return db[_0xa939('0x64')][_0xa939('0x73')]({'where':{'id':_0x50a3f1[_0xa939('0x37')][_0xa939('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa939('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b996f,null))[_0xa939('0x28')](function(_0x30a856){var _0x312db3=_[_0xa939('0x30')](_0x30a856,'id');var _0x54d82b=[];var _0x3a0420=[];var _0x1d0ec4=squel[_0xa939('0x74')]();_0x1d0ec4[_0xa939('0x75')](_0xa939('0x76'))[_0xa939('0x77')](_0xa939('0x78'),'tq')[_0xa939('0x79')](_0xa939('0x7a'),'ut',_0xa939('0x7b'))[_0xa939('0x41')]('SmsQueueId\x20=\x20?',_0x50a3f1[_0xa939('0x49')]['id']);for(var _0x4a9853=0x0;_0x4a9853<_0x30a856[_0xa939('0x3c')];_0x4a9853+=0x1){let _0x3e52fa=_0x30a856[_0x4a9853];for(var _0x32ba0a=0x0;_0x32ba0a<_0x3e52fa[_0xa939('0x66')][_0xa939('0x3c')];_0x32ba0a+=0x1){let _0x4c3b13=_0x3e52fa[_0xa939('0x66')][_0x32ba0a];var _0x176f7a=_0x1d0ec4[_0xa939('0x7c')]();_0x176f7a[_0xa939('0x41')](_0xa939('0x7d'),_0x4c3b13['id']);_0x3a0420[_0xa939('0x7e')](db['sequelize'][_0xa939('0x37')](_0x176f7a[_0xa939('0x7f')](),{'type':db[_0xa939('0x6b')][_0xa939('0x80')][_0xa939('0x81')]})[_0xa939('0x28')](function(_0x2d1b97){if(_0x2d1b97[_0xa939('0x3c')]===0x1){return _0x4c3b13['id'];}else{var _0x1d1061=_[_0xa939('0x82')](_[_0xa939('0x30')](_0x2d1b97,'TeamId'),function(_0x305152){return _[_0xa939('0x83')](_0x312db3,_0x305152);});if(_0x1d1061){return _0x4c3b13['id'];}}}));}}return BPromise['all'](_0x3a0420)[_0xa939('0x28')](function(_0x17276d){_0x54d82b=_(_0x54d82b)[_0xa939('0x84')](_0x17276d)[_0xa939('0x85')]()[_0xa939('0x86')]();return db[_0xa939('0x44')][_0xa939('0x4b')]({'where':{'id':_0x50a3f1[_0xa939('0x49')]['id']}})['then'](function(_0x88ce94){return db[_0xa939('0x6b')][_0xa939('0x6c')](function(_0x4caea8){return _0x88ce94[_0xa939('0x72')](_0x50a3f1[_0xa939('0x37')][_0xa939('0x65')],{'transaction':_0x4caea8})[_0xa939('0x28')](function(){if(!_[_0xa939('0x87')](_0x54d82b)){return _0x88ce94[_0xa939('0x88')](_0x54d82b,{'transaction':_0x4caea8});}})[_0xa939('0x28')](function(){_0x54d82b[_0xa939('0x70')](function(_0x3de222){socket['emit']('userSmsQueue:remove',{'UserId':_0x3de222,'SmsQueueId':_0x88ce94['id']});});});});});});})[_0xa939('0x28')](respondWithStatusCode(_0x4b996f,null))[_0xa939('0x4c')](handleError(_0x4b996f,null));};exports['addAgents']=function(_0x258e0b,_0x43f5df,_0x56f94a){return db[_0xa939('0x44')][_0xa939('0x4b')]({'where':{'id':_0x258e0b[_0xa939('0x49')]['id']}})['then'](handleEntityNotFound(_0x43f5df,null))['then'](function(_0x884e60){if(_0x884e60){return _0x884e60['addAgents'](_0x258e0b[_0xa939('0x4e')][_0xa939('0x65')],_[_0xa939('0x89')](_0x258e0b['body'],[_0xa939('0x65'),'id'])||{})['spread'](function(_0x1717f5){for(var _0x38e599=0x0;_0x38e599<_0x258e0b[_0xa939('0x4e')]['ids'][_0xa939('0x3c')];_0x38e599+=0x1){socket['emit'](_0xa939('0x8a'),{'UserId':Number(_0x258e0b['body']['ids'][_0x38e599]),'SmsQueueId':Number(_0x258e0b['params']['id'])});}return _0x1717f5;});}})[_0xa939('0x28')](respondWithResult(_0x43f5df,null))[_0xa939('0x4c')](handleError(_0x43f5df,null));};exports[_0xa939('0x88')]=function(_0x1a3108,_0x1deeeb,_0xe2e604){return db[_0xa939('0x44')][_0xa939('0x4b')]({'where':{'id':_0x1a3108[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x1deeeb,null))['then'](function(_0x1077d5){if(_0x1077d5){return _0x1077d5['removeAgents'](_0x1a3108[_0xa939('0x37')][_0xa939('0x65')])['then'](function(){if(_[_0xa939('0x8b')](_0x1a3108['query'][_0xa939('0x65')])){for(var _0x1b80fe=0x0;_0x1b80fe<_0x1a3108['query'][_0xa939('0x65')][_0xa939('0x3c')];_0x1b80fe+=0x1){socket[_0xa939('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x1a3108[_0xa939('0x37')][_0xa939('0x65')][_0x1b80fe]),'SmsQueueId':Number(_0x1a3108['params']['id'])});}}else{socket['emit'](_0xa939('0x8c'),{'UserId':Number(_0x1a3108[_0xa939('0x37')][_0xa939('0x65')]),'SmsQueueId':Number(_0x1a3108['params']['id'])});}});}})[_0xa939('0x28')](respondWithStatusCode(_0x1deeeb,null))[_0xa939('0x4c')](handleError(_0x1deeeb,null));};exports['getAgents']=function(_0x3be816,_0x2ae52d,_0x69c14a){var _0x1783a1={};var _0x45e0f8={};var _0x159e3f;var _0x50f45c;return db[_0xa939('0x44')][_0xa939('0x57')]({'where':{'id':_0x3be816[_0xa939('0x49')]['id']}})[_0xa939('0x28')](handleEntityNotFound(_0x2ae52d,null))[_0xa939('0x28')](function(_0x450c03){if(_0x450c03){_0x159e3f=_0x450c03;_0x45e0f8[_0xa939('0x35')]=_['keys'](db['User']['rawAttributes']);_0x45e0f8[_0xa939('0x37')]=_[_0xa939('0x36')](_0x3be816['query']);_0x45e0f8[_0xa939('0x38')]=_[_0xa939('0x3a')](_0x45e0f8[_0xa939('0x35')],_0x45e0f8[_0xa939('0x37')]);_0x1783a1[_0xa939('0x39')]=_[_0xa939('0x3a')](_0x45e0f8[_0xa939('0x35')],qs[_0xa939('0x3b')](_0x3be816[_0xa939('0x37')][_0xa939('0x3b')]));_0x1783a1[_0xa939('0x39')]=_0x1783a1[_0xa939('0x39')][_0xa939('0x3c')]?_0x1783a1[_0xa939('0x39')]:_0x45e0f8['model'];_0x1783a1[_0xa939('0x3f')]=qs[_0xa939('0x40')](_0x3be816[_0xa939('0x37')][_0xa939('0x40')]);_0x1783a1[_0xa939('0x41')]=qs['filters'](_['pick'](_0x3be816[_0xa939('0x37')],_0x45e0f8[_0xa939('0x38')]));if(_0x3be816[_0xa939('0x37')][_0xa939('0x43')]){_0x1783a1[_0xa939('0x41')]=_['merge'](_0x1783a1[_0xa939('0x41')],{'$or':_[_0xa939('0x30')](_0x1783a1['attributes'],function(_0x3f6044){var _0x3cb5ae={};_0x3cb5ae[_0x3f6044]={'$like':'%'+_0x3be816[_0xa939('0x37')][_0xa939('0x43')]+'%'};return _0x3cb5ae;})});}_0x1783a1=_[_0xa939('0x42')]({},_0x1783a1,_0x3be816[_0xa939('0x4a')]);return _0x159e3f['getAgents'](_0x1783a1);}})['then'](function(_0x29bef8){if(_0x29bef8){_0x50f45c=_0x29bef8['length'];if(!_0x3be816[_0xa939('0x37')][_0xa939('0x3d')](_0xa939('0x3e'))){_0x1783a1[_0xa939('0x21')]=qs['limit'](_0x3be816[_0xa939('0x37')]['limit']);_0x1783a1[_0xa939('0x23')]=qs['offset'](_0x3be816[_0xa939('0x37')][_0xa939('0x23')]);}return _0x159e3f[_0xa939('0x8d')](_0x1783a1);}})[_0xa939('0x28')](function(_0x4f3a0c){if(_0x4f3a0c){return _0x4f3a0c?{'count':_0x50f45c,'rows':_0x4f3a0c}:null;}})[_0xa939('0x28')](respondWithResult(_0x2ae52d,null))[_0xa939('0x4c')](handleError(_0x2ae52d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 99200c7..0ba91e6 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 _0x3e85=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x11c1a1,_0x17ba8c){var _0x483746=function(_0x5253c3){while(--_0x5253c3){_0x11c1a1['push'](_0x11c1a1['shift']());}};_0x483746(++_0x17ba8c);}(_0x3e85,0x87));var _0x53e8=function(_0x481f54,_0x3d47d9){_0x481f54=_0x481f54-0x0;var _0x288091=_0x3e85[_0x481f54];return _0x288091;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x53e8('0x0'))['db'][_0x53e8('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x53e8('0x2')](0x0);var events={'afterCreate':_0x53e8('0x3'),'afterUpdate':_0x53e8('0x4'),'afterDestroy':_0x53e8('0x5')};function emitEvent(_0x3b2d32){return function(_0x25a5d4,_0x166057,_0x435c96){SmsQueueEvents[_0x53e8('0x6')](_0x3b2d32+':'+_0x25a5d4['id'],_0x25a5d4);SmsQueueEvents[_0x53e8('0x6')](_0x3b2d32,_0x25a5d4);_0x435c96(null);};}for(var e in events){if(events[_0x53e8('0x7')](e)){var event=events[e];SmsQueue[_0x53e8('0x8')](e,emitEvent(event));}}module[_0x53e8('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x60ce=['../../mysqldb','SmsQueue','setMaxListeners','save','update','emit'];(function(_0x5df100,_0x1e83ba){var _0x2d525d=function(_0x535c94){while(--_0x535c94){_0x5df100['push'](_0x5df100['shift']());}};_0x2d525d(++_0x1e83ba);}(_0x60ce,0xd8));var _0xe60c=function(_0x47b05a,_0x1c31d3){_0x47b05a=_0x47b05a-0x0;var _0x81470=_0x60ce[_0x47b05a];return _0x81470;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xe60c('0x0'))['db'][_0xe60c('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe60c('0x2')](0x0);var events={'afterCreate':_0xe60c('0x3'),'afterUpdate':_0xe60c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x318d8e){return function(_0x3343fe,_0x14c4d5,_0x4260d1){SmsQueueEvents[_0xe60c('0x5')](_0x318d8e+':'+_0x3343fe['id'],_0x3343fe);SmsQueueEvents[_0xe60c('0x5')](_0x318d8e,_0x3343fe);_0x4260d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index fb0124d..68c241d 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 _0x15f4=['path','rimraf','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x15f4,0x1aa));var _0x415f=function(_0x3a1e06,_0x33e0d3){_0x3a1e06=_0x3a1e06-0x0;var _0x1cf4bc=_0x15f4[_0x3a1e06];return _0x1cf4bc;};'use strict';var _=require(_0x415f('0x0'));var util=require(_0x415f('0x1'));var logger=require('../../config/logger')(_0x415f('0x2'));var moment=require(_0x415f('0x3'));var BPromise=require(_0x415f('0x4'));var rp=require(_0x415f('0x5'));var fs=require('fs');var path=require(_0x415f('0x6'));var rimraf=require(_0x415f('0x7'));var config=require('../../config/environment');var attributes=require(_0x415f('0x8'));module['exports']=function(_0x22c842,_0xfb9ed5){return _0x22c842[_0x415f('0x9')](_0x415f('0xa'),attributes,{'tableName':_0x415f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4db=['bluebird','request-promise','path','rimraf','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0xe4db,0x173));var _0xbe4d=function(_0x4e398e,_0x46fa97){_0x4e398e=_0x4e398e-0x0;var _0x52b090=_0xe4db[_0x4e398e];return _0x52b090;};'use strict';var _=require(_0xbe4d('0x0'));var util=require(_0xbe4d('0x1'));var logger=require(_0xbe4d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbe4d('0x3'));var rp=require(_0xbe4d('0x4'));var fs=require('fs');var path=require(_0xbe4d('0x5'));var rimraf=require(_0xbe4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe4d('0x7'));module[_0xbe4d('0x8')]=function(_0x1421d9,_0x315cc6){return _0x1421d9[_0xbe4d('0x9')](_0xbe4d('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 89d82ca..a7cd99b 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 _0x12d7=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','findAll','options','raw','attributes','limit','map','model','include','SmsQueue','where','ShowSmsQueue','catch','lodash','util','bluebird'];(function(_0x595388,_0x4cca4a){var _0x2588f9=function(_0x28da71){while(--_0x28da71){_0x595388['push'](_0x595388['shift']());}};_0x2588f9(++_0x4cca4a);}(_0x12d7,0x1c0));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var util=require(_0x712d('0x1'));var moment=require('moment');var BPromise=require(_0x712d('0x2'));var rs=require(_0x712d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x712d('0x4'))['db'];var utils=require(_0x712d('0x5'));var logger=require(_0x712d('0x6'))(_0x712d('0x7'));var config=require(_0x712d('0x8'));var jayson=require(_0x712d('0x9'));var client=jayson[_0x712d('0xa')][_0x712d('0xb')]({'port':0x232a});config['redis']=_[_0x712d('0xc')](config['redis'],{'host':_0x712d('0xd'),'port':0x18eb});var socket=require(_0x712d('0xe'))(new Redis(config['redis']));require(_0x712d('0xf'))['register'](socket);function respondWithRpcPromise(_0x19ece5,_0x2fb1ea,_0x389751){return new BPromise(function(_0x3e29c2,_0x2ed37f){return client[_0x712d('0x10')](_0x19ece5,_0x389751)[_0x712d('0x11')](function(_0x17018d){logger[_0x712d('0x12')]('SmsQueue,\x20%s,\x20%s',_0x2fb1ea,'request\x20sent');logger[_0x712d('0x13')](_0x712d('0x14'),_0x2fb1ea,_0x712d('0x15'),JSON[_0x712d('0x16')](_0x17018d));if(_0x17018d[_0x712d('0x17')]){if(_0x17018d['error'][_0x712d('0x18')]===0x1f4){logger[_0x712d('0x17')](_0x712d('0x19'),_0x2fb1ea,_0x17018d['error']['message']);return _0x2ed37f(_0x17018d['error'][_0x712d('0x1a')]);}logger[_0x712d('0x17')](_0x712d('0x19'),_0x2fb1ea,_0x17018d[_0x712d('0x17')][_0x712d('0x1a')]);return _0x3e29c2(_0x17018d[_0x712d('0x17')]['message']);}else{logger[_0x712d('0x12')]('SmsQueue,\x20%s,\x20%s',_0x2fb1ea,_0x712d('0x15'));_0x3e29c2(_0x17018d[_0x712d('0x1b')]['message']);}})['catch'](function(_0x5e4314){logger[_0x712d('0x17')](_0x712d('0x19'),_0x2fb1ea,_0x5e4314);_0x2ed37f(_0x5e4314);});});}exports[_0x712d('0x1c')]=function(_0x3c2442){var _0x561835=this;return new Promise(function(_0x375599,_0x4e06b9){return db['SmsQueue'][_0x712d('0x1d')]({'raw':_0x3c2442[_0x712d('0x1e')]?_0x3c2442['options'][_0x712d('0x1f')]===undefined?!![]:![]:!![],'where':_0x3c2442[_0x712d('0x1e')]?_0x3c2442[_0x712d('0x1e')]['where']||null:null,'attributes':_0x3c2442[_0x712d('0x1e')]?_0x3c2442[_0x712d('0x1e')][_0x712d('0x20')]||null:null,'limit':_0x3c2442[_0x712d('0x1e')]?_0x3c2442['options'][_0x712d('0x21')]||null:null,'include':_0x3c2442[_0x712d('0x1e')]?_0x3c2442[_0x712d('0x1e')]['include']?_[_0x712d('0x22')](_0x3c2442['options']['include'],function(_0x32be5a){return{'model':db[_0x32be5a[_0x712d('0x23')]],'as':_0x32be5a['as'],'attributes':_0x32be5a['attributes'],'include':_0x32be5a[_0x712d('0x24')]?_['map'](_0x32be5a[_0x712d('0x24')],function(_0x240d48){return{'model':db[_0x240d48[_0x712d('0x23')]],'as':_0x240d48['as'],'attributes':_0x240d48[_0x712d('0x20')],'include':_0x240d48[_0x712d('0x24')]?_[_0x712d('0x22')](_0x240d48[_0x712d('0x24')],function(_0x445f14){return{'model':db[_0x445f14[_0x712d('0x23')]],'as':_0x445f14['as'],'attributes':_0x445f14[_0x712d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x712d('0x11')](function(_0x4f856a){logger[_0x712d('0x12')]('GetSmsQueue',_0x3c2442);logger[_0x712d('0x13')](_0x712d('0x1c'),_0x3c2442,JSON['stringify'](_0x4f856a));_0x375599(_0x4f856a);})['catch'](function(_0x2d64fa){logger[_0x712d('0x17')]('GetSmsQueue',_0x2d64fa['message'],_0x3c2442);_0x4e06b9(_0x561835[_0x712d('0x17')](0x1f4,_0x2d64fa[_0x712d('0x1a')]));});});};exports['ShowSmsQueue']=function(_0x4cb59e){var _0x2d8e3a=this;return new Promise(function(_0x23e233,_0x734e85){return db[_0x712d('0x25')]['find']({'raw':_0x4cb59e[_0x712d('0x1e')]?_0x4cb59e[_0x712d('0x1e')][_0x712d('0x1f')]===undefined?!![]:![]:!![],'where':_0x4cb59e['options']?_0x4cb59e[_0x712d('0x1e')][_0x712d('0x26')]||null:null,'attributes':_0x4cb59e['options']?_0x4cb59e[_0x712d('0x1e')][_0x712d('0x20')]||null:null,'include':_0x4cb59e[_0x712d('0x1e')]?_0x4cb59e[_0x712d('0x1e')][_0x712d('0x24')]?_[_0x712d('0x22')](_0x4cb59e['options'][_0x712d('0x24')],function(_0x4e0f45){return{'model':db[_0x4e0f45['model']],'as':_0x4e0f45['as'],'attributes':_0x4e0f45[_0x712d('0x20')],'include':_0x4e0f45[_0x712d('0x24')]?_[_0x712d('0x22')](_0x4e0f45[_0x712d('0x24')],function(_0x533706){return{'model':db[_0x533706[_0x712d('0x23')]],'as':_0x533706['as'],'attributes':_0x533706[_0x712d('0x20')],'include':_0x533706[_0x712d('0x24')]?_['map'](_0x533706[_0x712d('0x24')],function(_0x17f88b){return{'model':db[_0x17f88b['model']],'as':_0x17f88b['as'],'attributes':_0x17f88b[_0x712d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x712d('0x11')](function(_0x13749d){logger['info'](_0x712d('0x27'),_0x4cb59e);logger['debug'](_0x712d('0x27'),_0x4cb59e,JSON['stringify'](_0x13749d));_0x23e233(_0x13749d);})[_0x712d('0x28')](function(_0x2a8f1d){logger[_0x712d('0x17')]('ShowSmsQueue',_0x2a8f1d[_0x712d('0x1a')],_0x4cb59e);_0x734e85(_0x2d8e3a[_0x712d('0x17')](0x1f4,_0x2a8f1d['message']));});});}; \ No newline at end of file +var _0xde78=['attributes','limit','include','map','model','ShowSmsQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','options','raw','where'];(function(_0x3e8a3d,_0x1d14c0){var _0xd88795=function(_0x45d2e5){while(--_0x45d2e5){_0x3e8a3d['push'](_0x3e8a3d['shift']());}};_0xd88795(++_0x1d14c0);}(_0xde78,0x13e));var _0x8de7=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xde78[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0x8de7('0x0'));var util=require(_0x8de7('0x1'));var moment=require(_0x8de7('0x2'));var BPromise=require(_0x8de7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8de7('0x4'))['db'];var utils=require(_0x8de7('0x5'));var logger=require(_0x8de7('0x6'))(_0x8de7('0x7'));var config=require('../../config/environment');var jayson=require(_0x8de7('0x8'));var client=jayson[_0x8de7('0x9')][_0x8de7('0xa')]({'port':0x232a});config[_0x8de7('0xb')]=_['defaults'](config[_0x8de7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8de7('0xc'))(new Redis(config['redis']));require(_0x8de7('0xd'))[_0x8de7('0xe')](socket);function respondWithRpcPromise(_0x51c20b,_0x27ddd6,_0x53bb62){return new BPromise(function(_0x22c306,_0x18c299){return client[_0x8de7('0xf')](_0x51c20b,_0x53bb62)[_0x8de7('0x10')](function(_0x166d68){logger['info'](_0x8de7('0x11'),_0x27ddd6,_0x8de7('0x12'));logger[_0x8de7('0x13')](_0x8de7('0x14'),_0x27ddd6,_0x8de7('0x12'),JSON[_0x8de7('0x15')](_0x166d68));if(_0x166d68[_0x8de7('0x16')]){if(_0x166d68[_0x8de7('0x16')][_0x8de7('0x17')]===0x1f4){logger['error'](_0x8de7('0x11'),_0x27ddd6,_0x166d68[_0x8de7('0x16')][_0x8de7('0x18')]);return _0x18c299(_0x166d68[_0x8de7('0x16')][_0x8de7('0x18')]);}logger[_0x8de7('0x16')](_0x8de7('0x11'),_0x27ddd6,_0x166d68[_0x8de7('0x16')][_0x8de7('0x18')]);return _0x22c306(_0x166d68[_0x8de7('0x16')][_0x8de7('0x18')]);}else{logger[_0x8de7('0x19')]('SmsQueue,\x20%s,\x20%s',_0x27ddd6,_0x8de7('0x12'));_0x22c306(_0x166d68[_0x8de7('0x1a')][_0x8de7('0x18')]);}})[_0x8de7('0x1b')](function(_0x37c32e){logger[_0x8de7('0x16')](_0x8de7('0x11'),_0x27ddd6,_0x37c32e);_0x18c299(_0x37c32e);});});}exports[_0x8de7('0x1c')]=function(_0x1aa58e){var _0x444f8e=this;return new Promise(function(_0x453a95,_0x1d8c87){return db[_0x8de7('0x1d')]['findAll']({'raw':_0x1aa58e[_0x8de7('0x1e')]?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x1f')]===undefined?!![]:![]:!![],'where':_0x1aa58e[_0x8de7('0x1e')]?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x20')]||null:null,'attributes':_0x1aa58e[_0x8de7('0x1e')]?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x21')]||null:null,'limit':_0x1aa58e['options']?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x22')]||null:null,'include':_0x1aa58e[_0x8de7('0x1e')]?_0x1aa58e[_0x8de7('0x1e')][_0x8de7('0x23')]?_[_0x8de7('0x24')](_0x1aa58e[_0x8de7('0x1e')]['include'],function(_0x388539){return{'model':db[_0x388539['model']],'as':_0x388539['as'],'attributes':_0x388539['attributes'],'include':_0x388539[_0x8de7('0x23')]?_['map'](_0x388539[_0x8de7('0x23')],function(_0xd85839){return{'model':db[_0xd85839[_0x8de7('0x25')]],'as':_0xd85839['as'],'attributes':_0xd85839[_0x8de7('0x21')],'include':_0xd85839['include']?_[_0x8de7('0x24')](_0xd85839[_0x8de7('0x23')],function(_0x9c33e7){return{'model':db[_0x9c33e7[_0x8de7('0x25')]],'as':_0x9c33e7['as'],'attributes':_0x9c33e7[_0x8de7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x337409){logger[_0x8de7('0x19')](_0x8de7('0x1c'),_0x1aa58e);logger[_0x8de7('0x13')](_0x8de7('0x1c'),_0x1aa58e,JSON[_0x8de7('0x15')](_0x337409));_0x453a95(_0x337409);})[_0x8de7('0x1b')](function(_0x3bd8ca){logger['error'](_0x8de7('0x1c'),_0x3bd8ca[_0x8de7('0x18')],_0x1aa58e);_0x1d8c87(_0x444f8e[_0x8de7('0x16')](0x1f4,_0x3bd8ca['message']));});});};exports[_0x8de7('0x26')]=function(_0x3ac6ce){var _0x51656d=this;return new Promise(function(_0x2f39eb,_0x2ab372){return db[_0x8de7('0x1d')]['find']({'raw':_0x3ac6ce[_0x8de7('0x1e')]?_0x3ac6ce[_0x8de7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3ac6ce['options']?_0x3ac6ce[_0x8de7('0x1e')][_0x8de7('0x20')]||null:null,'attributes':_0x3ac6ce[_0x8de7('0x1e')]?_0x3ac6ce['options'][_0x8de7('0x21')]||null:null,'include':_0x3ac6ce[_0x8de7('0x1e')]?_0x3ac6ce['options'][_0x8de7('0x23')]?_[_0x8de7('0x24')](_0x3ac6ce[_0x8de7('0x1e')]['include'],function(_0x3903a6){return{'model':db[_0x3903a6[_0x8de7('0x25')]],'as':_0x3903a6['as'],'attributes':_0x3903a6[_0x8de7('0x21')],'include':_0x3903a6[_0x8de7('0x23')]?_[_0x8de7('0x24')](_0x3903a6[_0x8de7('0x23')],function(_0x38d464){return{'model':db[_0x38d464[_0x8de7('0x25')]],'as':_0x38d464['as'],'attributes':_0x38d464[_0x8de7('0x21')],'include':_0x38d464[_0x8de7('0x23')]?_[_0x8de7('0x24')](_0x38d464['include'],function(_0x3cafeb){return{'model':db[_0x3cafeb['model']],'as':_0x3cafeb['as'],'attributes':_0x3cafeb[_0x8de7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8de7('0x10')](function(_0x566ab6){logger['info'](_0x8de7('0x26'),_0x3ac6ce);logger[_0x8de7('0x13')](_0x8de7('0x26'),_0x3ac6ce,JSON['stringify'](_0x566ab6));_0x2f39eb(_0x566ab6);})[_0x8de7('0x1b')](function(_0x5d7932){logger['error'](_0x8de7('0x26'),_0x5d7932['message'],_0x3ac6ce);_0x2ab372(_0x51656d[_0x8de7('0x16')](0x1f4,_0x5d7932['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index c21462c..ece7251 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 _0x78ed=['remove','update','removeListener','register','length','smsQueue:','save'];(function(_0x179a51,_0x4ad95d){var _0x32062f=function(_0x118d42){while(--_0x118d42){_0x179a51['push'](_0x179a51['shift']());}};_0x32062f(++_0x4ad95d);}(_0x78ed,0x92));var _0xd78e=function(_0x79e9b5,_0x5c731a){_0x79e9b5=_0x79e9b5-0x0;var _0x2d87b2=_0x78ed[_0x79e9b5];return _0x2d87b2;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xd78e('0x0'),_0xd78e('0x1'),_0xd78e('0x2')];function createListener(_0x2b471a,_0x3d51b5){return function(_0x569adc){_0x3d51b5['emit'](_0x2b471a,_0x569adc);};}function removeListener(_0x43d841,_0x155ecb){return function(){SmsQueueEvents[_0xd78e('0x3')](_0x43d841,_0x155ecb);};}exports[_0xd78e('0x4')]=function(_0x124a63){for(var _0x515200=0x0,_0x1480d9=events[_0xd78e('0x5')];_0x515200<_0x1480d9;_0x515200++){var _0x807204=events[_0x515200];var _0x1b7d02=createListener(_0xd78e('0x6')+_0x807204,_0x124a63);SmsQueueEvents['on'](_0x807204,_0x1b7d02);}}; \ No newline at end of file +var _0x8ad9=['emit','removeListener','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x8ad9,0x96));var _0x98ad=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8ad9[_0x4a53d];return _0x27410e;};'use strict';var SmsQueueEvents=require(_0x98ad('0x0'));var events=[_0x98ad('0x1'),_0x98ad('0x2'),_0x98ad('0x3')];function createListener(_0x473c6e,_0x580ab6){return function(_0x3ce47c){_0x580ab6[_0x98ad('0x4')](_0x473c6e,_0x3ce47c);};}function removeListener(_0x540bb8,_0x1e7b04){return function(){SmsQueueEvents[_0x98ad('0x5')](_0x540bb8,_0x1e7b04);};}exports['register']=function(_0x1b8b77){for(var _0x4b8663=0x0,_0x25fb2b=events['length'];_0x4b8663<_0x25fb2b;_0x4b8663++){var _0x4046e0=events[_0x4b8663];var _0x45f288=createListener(_0x98ad('0x6')+_0x4046e0,_0x1b8b77);SmsQueueEvents['on'](_0x4046e0,_0x45f288);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2f59d82..6a3310e 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 _0x12b7=['post','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x19a5da,_0x1fdf02){var _0x171530=function(_0x3e4947){while(--_0x3e4947){_0x19a5da['push'](_0x19a5da['shift']());}};_0x171530(++_0x1fdf02);}(_0x12b7,0x194));var _0x712b=function(_0x4b1fe0,_0x5d061c){_0x4b1fe0=_0x4b1fe0-0x0;var _0x6e1460=_0x12b7[_0x4b1fe0];return _0x6e1460;};'use strict';var multer=require(_0x712b('0x0'));var util=require(_0x712b('0x1'));var path=require(_0x712b('0x2'));var timeout=require(_0x712b('0x3'));var express=require(_0x712b('0x4'));var router=express['Router']();var fs_extra=require(_0x712b('0x5'));var auth=require(_0x712b('0x6'));var interaction=require(_0x712b('0x7'));var config=require(_0x712b('0x8'));var controller=require(_0x712b('0x9'));router[_0x712b('0xa')]('/',auth['isAuthenticated'](),controller[_0x712b('0xb')]);router[_0x712b('0xa')]('/describe',auth[_0x712b('0xc')](),controller[_0x712b('0xd')]);router[_0x712b('0xa')](_0x712b('0xe'),auth[_0x712b('0xc')](),controller[_0x712b('0xf')]);router[_0x712b('0x10')]('/',auth[_0x712b('0xc')](),controller[_0x712b('0x11')]);router['put'](_0x712b('0xe'),auth[_0x712b('0xc')](),controller[_0x712b('0x12')]);router['delete'](_0x712b('0xe'),auth['isAuthenticated'](),controller[_0x712b('0x13')]);module[_0x712b('0x14')]=router; \ No newline at end of file +var _0xb934=['post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show'];(function(_0x161281,_0x4478bf){var _0xc1e094=function(_0x4e2c24){while(--_0x4e2c24){_0x161281['push'](_0x161281['shift']());}};_0xc1e094(++_0x4478bf);}(_0xb934,0x92));var _0x4b93=function(_0x5866a3,_0x51a743){_0x5866a3=_0x5866a3-0x0;var _0x343140=_0xb934[_0x5866a3];return _0x343140;};'use strict';var multer=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var path=require(_0x4b93('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b93('0x3'));var router=express[_0x4b93('0x4')]();var fs_extra=require(_0x4b93('0x5'));var auth=require(_0x4b93('0x6'));var interaction=require(_0x4b93('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x4b93('0x8')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0xa')]);router[_0x4b93('0x8')]('/describe',auth[_0x4b93('0x9')](),controller[_0x4b93('0xb')]);router[_0x4b93('0x8')](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0xd')]);router[_0x4b93('0xe')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0xf')]);router['put'](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x10')]);router[_0x4b93('0x11')](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x12')]);module[_0x4b93('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3279295..263e1e2 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 _0x5b68=['DATE','moment','sequelize','STRING'];(function(_0x178739,_0x4d32e8){var _0xbf2918=function(_0x9c8e60){while(--_0x9c8e60){_0x178739['push'](_0x178739['shift']());}};_0xbf2918(++_0x4d32e8);}(_0x5b68,0x151));var _0x85b6=function(_0x2c022d,_0x53e9c5){_0x2c022d=_0x2c022d-0x0;var _0x1b835f=_0x5b68[_0x2c022d];return _0x1b835f;};'use strict';var moment=require(_0x85b6('0x0'));var Sequelize=require(_0x85b6('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x85b6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x85b6('0x2')]},'joinAt':{'type':Sequelize[_0x85b6('0x3')]},'leaveAt':{'type':Sequelize[_0x85b6('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x85b6('0x3')]},'reason':{'type':Sequelize[_0x85b6('0x2')]}}; \ No newline at end of file +var _0xab8f=['moment','sequelize','exports','STRING','DATE'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xab8f,0x7d));var _0xfab8=function(_0x50e267,_0x3c4d1d){_0x50e267=_0x50e267-0x0;var _0x2c203c=_0xab8f[_0x50e267];return _0x2c203c;};'use strict';var moment=require(_0xfab8('0x0'));var Sequelize=require(_0xfab8('0x1'));module[_0xfab8('0x2')]={'uniqueid':{'type':Sequelize[_0xfab8('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfab8('0x4')]},'leaveAt':{'type':Sequelize[_0xfab8('0x4')]},'acceptAt':{'type':Sequelize[_0xfab8('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d0aabdc..1d02467 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 _0x83d7=['order','sort','where','pick','filter','merge','type','options','SmsQueueReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x344bd2,_0x580b3b){var _0x23fbc6=function(_0x4e31ad){while(--_0x4e31ad){_0x344bd2['push'](_0x344bd2['shift']());}};_0x23fbc6(++_0x580b3b);}(_0x83d7,0x64));var _0x783d=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x83d7[_0x55c1f0];return _0x1530fa;};'use strict';var emlformat=require(_0x783d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x783d('0x1'));var jsonpatch=require(_0x783d('0x2'));var rp=require(_0x783d('0x3'));var moment=require(_0x783d('0x4'));var BPromise=require(_0x783d('0x5'));var Mustache=require(_0x783d('0x6'));var util=require(_0x783d('0x7'));var path=require(_0x783d('0x8'));var sox=require(_0x783d('0x9'));var csv=require(_0x783d('0xa'));var ejs=require(_0x783d('0xb'));var fs=require('fs');var fs_extra=require(_0x783d('0xc'));var _=require(_0x783d('0xd'));var squel=require('squel');var crypto=require(_0x783d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x783d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x783d('0x10'));var Papa=require(_0x783d('0x11'));var Redis=require(_0x783d('0x12'));var authService=require(_0x783d('0x13'));var qs=require(_0x783d('0x14'));var as=require(_0x783d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x783d('0x16'));var utils=require(_0x783d('0x17'));var config=require(_0x783d('0x18'));var licenseUtil=require(_0x783d('0x19'));var db=require(_0x783d('0x1a'))['db'];function respondWithStatusCode(_0x5ecd6f,_0x48c58b){_0x48c58b=_0x48c58b||0xcc;return function(_0x4e98bc){if(_0x4e98bc){return _0x5ecd6f['sendStatus'](_0x48c58b);}return _0x5ecd6f[_0x783d('0x1b')](_0x48c58b)[_0x783d('0x1c')]();};}function respondWithResult(_0x1ae291,_0x1fcdd9){_0x1fcdd9=_0x1fcdd9||0xc8;return function(_0x139672){if(_0x139672){return _0x1ae291[_0x783d('0x1b')](_0x1fcdd9)[_0x783d('0x1d')](_0x139672);}};}function respondWithFilteredResult(_0x65051b,_0x4beeee){return function(_0x4f1230){if(_0x4f1230){var _0x3690e8=typeof _0x4beeee[_0x783d('0x1e')]===_0x783d('0x1f')&&typeof _0x4beeee[_0x783d('0x20')]==='undefined';var _0x3edde6=_0x4f1230[_0x783d('0x21')];var _0x4b8640=_0x3690e8?0x0:_0x4beeee[_0x783d('0x1e')];var _0xfca162=_0x3690e8?_0x4f1230[_0x783d('0x21')]:_0x4beeee[_0x783d('0x1e')]+_0x4beeee[_0x783d('0x20')];var _0x14c6ba;if(_0xfca162>=_0x3edde6){_0xfca162=_0x3edde6;_0x14c6ba=0xc8;}else{_0x14c6ba=0xce;}_0x65051b[_0x783d('0x1b')](_0x14c6ba);return _0x65051b[_0x783d('0x22')]('Content-Range',_0x4b8640+'-'+_0xfca162+'/'+_0x3edde6)[_0x783d('0x1d')](_0x4f1230);}return null;};}function patchUpdates(_0x433234){return function(_0x5acfbd){try{jsonpatch[_0x783d('0x23')](_0x5acfbd,_0x433234,!![]);}catch(_0x51cab5){return BPromise[_0x783d('0x24')](_0x51cab5);}return _0x5acfbd[_0x783d('0x25')]();};}function saveUpdates(_0x35a11b,_0x306c87){return function(_0x4e0e35){if(_0x4e0e35){return _0x4e0e35[_0x783d('0x26')](_0x35a11b)['then'](function(_0x523c4a){return _0x523c4a;});}return null;};}function removeEntity(_0x56d467,_0x2732d5){return function(_0x534472){if(_0x534472){return _0x534472[_0x783d('0x27')]()[_0x783d('0x28')](function(){_0x56d467[_0x783d('0x1b')](0xcc)[_0x783d('0x1c')]();});}};}function handleEntityNotFound(_0x4895ed,_0x15971e){return function(_0x157fc9){if(!_0x157fc9){_0x4895ed[_0x783d('0x29')](0x194);}return _0x157fc9;};}function handleError(_0x67286b,_0x4adfde){_0x4adfde=_0x4adfde||0x1f4;return function(_0x5db84e){logger['error'](_0x5db84e[_0x783d('0x2a')]);if(_0x5db84e[_0x783d('0x2b')]){delete _0x5db84e[_0x783d('0x2b')];}_0x67286b[_0x783d('0x1b')](_0x4adfde)[_0x783d('0x2c')](_0x5db84e);};}exports[_0x783d('0x2d')]=function(_0x220f24,_0x191a5b){var _0x235672={},_0x389db3={},_0x328429={'count':0x0,'rows':[]};var _0x4b05fa=_[_0x783d('0x2e')](db['SmsQueueReport'][_0x783d('0x2f')],function(_0x3c074e){return{'name':_0x3c074e[_0x783d('0x30')],'type':_0x3c074e['type'][_0x783d('0x31')]};});_0x389db3['model']=_[_0x783d('0x2e')](_0x4b05fa,_0x783d('0x2b'));_0x389db3['query']=_[_0x783d('0x32')](_0x220f24[_0x783d('0x33')]);_0x389db3[_0x783d('0x34')]=_[_0x783d('0x35')](_0x389db3[_0x783d('0x36')],_0x389db3[_0x783d('0x33')]);_0x235672[_0x783d('0x37')]=_['intersection'](_0x389db3[_0x783d('0x36')],qs[_0x783d('0x38')](_0x220f24[_0x783d('0x33')][_0x783d('0x38')]));_0x235672[_0x783d('0x37')]=_0x235672[_0x783d('0x37')][_0x783d('0x39')]?_0x235672[_0x783d('0x37')]:_0x389db3[_0x783d('0x36')];if(!_0x220f24['query'][_0x783d('0x3a')](_0x783d('0x3b'))){_0x235672[_0x783d('0x20')]=qs[_0x783d('0x20')](_0x220f24[_0x783d('0x33')][_0x783d('0x20')]);_0x235672[_0x783d('0x1e')]=qs[_0x783d('0x1e')](_0x220f24[_0x783d('0x33')][_0x783d('0x1e')]);}_0x235672[_0x783d('0x3c')]=qs[_0x783d('0x3d')](_0x220f24[_0x783d('0x33')][_0x783d('0x3d')]);_0x235672[_0x783d('0x3e')]=qs[_0x783d('0x34')](_[_0x783d('0x3f')](_0x220f24['query'],_0x389db3[_0x783d('0x34')]),_0x4b05fa);if(_0x220f24[_0x783d('0x33')][_0x783d('0x40')]){_0x235672[_0x783d('0x3e')]=_[_0x783d('0x41')](_0x235672[_0x783d('0x3e')],{'$or':_[_0x783d('0x2e')](_0x4b05fa,function(_0xb3545d){if(_0xb3545d[_0x783d('0x42')]!=='VIRTUAL'){var _0x314766={};_0x314766[_0xb3545d[_0x783d('0x2b')]]={'$like':'%'+_0x220f24[_0x783d('0x33')][_0x783d('0x40')]+'%'};return _0x314766;}})});}_0x235672=_[_0x783d('0x41')]({},_0x235672,_0x220f24[_0x783d('0x43')]);var _0x5dcc84={'where':_0x235672[_0x783d('0x3e')]};return db[_0x783d('0x44')]['count'](_0x5dcc84)[_0x783d('0x28')](function(_0x581bb8){_0x328429['count']=_0x581bb8;if(_0x220f24[_0x783d('0x33')]['includeAll']){_0x235672[_0x783d('0x45')]=[{'all':!![]}];}return db[_0x783d('0x44')][_0x783d('0x46')](_0x235672);})[_0x783d('0x28')](function(_0x4477b5){_0x328429[_0x783d('0x47')]=_0x4477b5;return _0x328429;})['then'](respondWithFilteredResult(_0x191a5b,_0x235672))[_0x783d('0x48')](handleError(_0x191a5b,null));};exports[_0x783d('0x49')]=function(_0xebbcf4,_0x51bb82){var _0xa8cc63={'raw':!![],'where':{'id':_0xebbcf4[_0x783d('0x4a')]['id']}},_0xfb833c={};_0xfb833c['model']=_[_0x783d('0x32')](db[_0x783d('0x44')][_0x783d('0x2f')]);_0xfb833c[_0x783d('0x33')]=_[_0x783d('0x32')](_0xebbcf4['query']);_0xfb833c[_0x783d('0x34')]=_[_0x783d('0x35')](_0xfb833c['model'],_0xfb833c[_0x783d('0x33')]);_0xa8cc63[_0x783d('0x37')]=_[_0x783d('0x35')](_0xfb833c['model'],qs[_0x783d('0x38')](_0xebbcf4['query'][_0x783d('0x38')]));_0xa8cc63[_0x783d('0x37')]=_0xa8cc63[_0x783d('0x37')][_0x783d('0x39')]?_0xa8cc63[_0x783d('0x37')]:_0xfb833c[_0x783d('0x36')];if(_0xebbcf4[_0x783d('0x33')][_0x783d('0x4b')]){_0xa8cc63[_0x783d('0x45')]=[{'all':!![]}];}_0xa8cc63=_[_0x783d('0x41')]({},_0xa8cc63,_0xebbcf4[_0x783d('0x43')]);return db[_0x783d('0x44')][_0x783d('0x4c')](_0xa8cc63)['then'](handleEntityNotFound(_0x51bb82,null))[_0x783d('0x28')](respondWithResult(_0x51bb82,null))[_0x783d('0x48')](handleError(_0x51bb82,null));};exports[_0x783d('0x4d')]=function(_0x1a37f9,_0x12907f){return db[_0x783d('0x44')][_0x783d('0x4d')](_0x1a37f9[_0x783d('0x4e')],{})[_0x783d('0x28')](respondWithResult(_0x12907f,0xc9))[_0x783d('0x48')](handleError(_0x12907f,null));};exports['update']=function(_0x30dfb3,_0x257616){if(_0x30dfb3[_0x783d('0x4e')]['id']){delete _0x30dfb3[_0x783d('0x4e')]['id'];}return db[_0x783d('0x44')][_0x783d('0x4c')]({'where':{'id':_0x30dfb3['params']['id']}})[_0x783d('0x28')](handleEntityNotFound(_0x257616,null))['then'](saveUpdates(_0x30dfb3[_0x783d('0x4e')],null))[_0x783d('0x28')](respondWithResult(_0x257616,null))['catch'](handleError(_0x257616,null));};exports[_0x783d('0x27')]=function(_0x4b52f9,_0x4d4ad2){return db[_0x783d('0x44')][_0x783d('0x4c')]({'where':{'id':_0x4b52f9['params']['id']}})[_0x783d('0x28')](handleEntityNotFound(_0x4d4ad2,null))['then'](removeEntity(_0x4d4ad2,null))[_0x783d('0x48')](handleError(_0x4d4ad2,null));};exports['describe']=function(_0x5e618c,_0x3b9b40){return db[_0x783d('0x44')][_0x783d('0x4f')]()[_0x783d('0x28')](respondWithResult(_0x3b9b40,null))[_0x783d('0x48')](handleError(_0x3b9b40,null));}; \ No newline at end of file +var _0x844b=['nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x844b,0x1cd));var _0xb844=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x844b[_0xeff2c3];return _0x2cade6;};'use strict';var emlformat=require(_0xb844('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb844('0x1'));var jsonpatch=require(_0xb844('0x2'));var rp=require(_0xb844('0x3'));var moment=require(_0xb844('0x4'));var BPromise=require(_0xb844('0x5'));var Mustache=require(_0xb844('0x6'));var util=require('util');var path=require(_0xb844('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb844('0x8'));var fs=require('fs');var fs_extra=require(_0xb844('0x9'));var _=require(_0xb844('0xa'));var squel=require('squel');var crypto=require(_0xb844('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb844('0xc'));var querystring=require(_0xb844('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb844('0xe'));var qs=require(_0xb844('0xf'));var as=require(_0xb844('0x10'));var hardwareService=require(_0xb844('0x11'));var logger=require(_0xb844('0x12'))(_0xb844('0x13'));var utils=require(_0xb844('0x14'));var config=require(_0xb844('0x15'));var licenseUtil=require(_0xb844('0x16'));var db=require(_0xb844('0x17'))['db'];function respondWithStatusCode(_0x21d966,_0x4e84bc){_0x4e84bc=_0x4e84bc||0xcc;return function(_0x2d8549){if(_0x2d8549){return _0x21d966[_0xb844('0x18')](_0x4e84bc);}return _0x21d966[_0xb844('0x19')](_0x4e84bc)[_0xb844('0x1a')]();};}function respondWithResult(_0x172d85,_0xac2dab){_0xac2dab=_0xac2dab||0xc8;return function(_0x4f7eac){if(_0x4f7eac){return _0x172d85['status'](_0xac2dab)[_0xb844('0x1b')](_0x4f7eac);}};}function respondWithFilteredResult(_0x1be386,_0x243dc5){return function(_0x166c48){if(_0x166c48){var _0x3d0d87=typeof _0x243dc5[_0xb844('0x1c')]===_0xb844('0x1d')&&typeof _0x243dc5[_0xb844('0x1e')]===_0xb844('0x1d');var _0x17b76c=_0x166c48['count'];var _0x3b4118=_0x3d0d87?0x0:_0x243dc5[_0xb844('0x1c')];var _0x4a2e3e=_0x3d0d87?_0x166c48[_0xb844('0x1f')]:_0x243dc5[_0xb844('0x1c')]+_0x243dc5['limit'];var _0x587917;if(_0x4a2e3e>=_0x17b76c){_0x4a2e3e=_0x17b76c;_0x587917=0xc8;}else{_0x587917=0xce;}_0x1be386['status'](_0x587917);return _0x1be386['set']('Content-Range',_0x3b4118+'-'+_0x4a2e3e+'/'+_0x17b76c)[_0xb844('0x1b')](_0x166c48);}return null;};}function patchUpdates(_0x51fc6e){return function(_0x2e21b7){try{jsonpatch[_0xb844('0x20')](_0x2e21b7,_0x51fc6e,!![]);}catch(_0x46d1fe){return BPromise[_0xb844('0x21')](_0x46d1fe);}return _0x2e21b7[_0xb844('0x22')]();};}function saveUpdates(_0x54a28c,_0x11c211){return function(_0x4576b5){if(_0x4576b5){return _0x4576b5[_0xb844('0x23')](_0x54a28c)[_0xb844('0x24')](function(_0x47c516){return _0x47c516;});}return null;};}function removeEntity(_0x4f5573,_0x4d8253){return function(_0x3e12d0){if(_0x3e12d0){return _0x3e12d0[_0xb844('0x25')]()[_0xb844('0x24')](function(){_0x4f5573[_0xb844('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x529861,_0xdb6d3b){return function(_0x309374){if(!_0x309374){_0x529861[_0xb844('0x18')](0x194);}return _0x309374;};}function handleError(_0x414e99,_0x5ba4da){_0x5ba4da=_0x5ba4da||0x1f4;return function(_0x452aac){logger[_0xb844('0x26')](_0x452aac[_0xb844('0x27')]);if(_0x452aac[_0xb844('0x28')]){delete _0x452aac[_0xb844('0x28')];}_0x414e99[_0xb844('0x19')](_0x5ba4da)[_0xb844('0x29')](_0x452aac);};}exports[_0xb844('0x2a')]=function(_0x27d2b1,_0x2554ad){var _0x2f997e={},_0x1a71bb={},_0x1530ee={'count':0x0,'rows':[]};var _0x58dffd=_[_0xb844('0x2b')](db[_0xb844('0x2c')][_0xb844('0x2d')],function(_0x396bbf){return{'name':_0x396bbf[_0xb844('0x2e')],'type':_0x396bbf[_0xb844('0x2f')][_0xb844('0x30')]};});_0x1a71bb[_0xb844('0x31')]=_[_0xb844('0x2b')](_0x58dffd,_0xb844('0x28'));_0x1a71bb[_0xb844('0x32')]=_[_0xb844('0x33')](_0x27d2b1[_0xb844('0x32')]);_0x1a71bb[_0xb844('0x34')]=_[_0xb844('0x35')](_0x1a71bb[_0xb844('0x31')],_0x1a71bb[_0xb844('0x32')]);_0x2f997e[_0xb844('0x36')]=_[_0xb844('0x35')](_0x1a71bb['model'],qs[_0xb844('0x37')](_0x27d2b1[_0xb844('0x32')][_0xb844('0x37')]));_0x2f997e[_0xb844('0x36')]=_0x2f997e['attributes'][_0xb844('0x38')]?_0x2f997e['attributes']:_0x1a71bb[_0xb844('0x31')];if(!_0x27d2b1[_0xb844('0x32')]['hasOwnProperty'](_0xb844('0x39'))){_0x2f997e['limit']=qs[_0xb844('0x1e')](_0x27d2b1[_0xb844('0x32')][_0xb844('0x1e')]);_0x2f997e['offset']=qs[_0xb844('0x1c')](_0x27d2b1[_0xb844('0x32')][_0xb844('0x1c')]);}_0x2f997e[_0xb844('0x3a')]=qs['sort'](_0x27d2b1[_0xb844('0x32')]['sort']);_0x2f997e[_0xb844('0x3b')]=qs[_0xb844('0x34')](_[_0xb844('0x3c')](_0x27d2b1[_0xb844('0x32')],_0x1a71bb[_0xb844('0x34')]),_0x58dffd);if(_0x27d2b1['query']['filter']){_0x2f997e['where']=_[_0xb844('0x3d')](_0x2f997e['where'],{'$or':_[_0xb844('0x2b')](_0x58dffd,function(_0x4f1f78){if(_0x4f1f78[_0xb844('0x2f')]!==_0xb844('0x3e')){var _0x622f24={};_0x622f24[_0x4f1f78[_0xb844('0x28')]]={'$like':'%'+_0x27d2b1[_0xb844('0x32')][_0xb844('0x3f')]+'%'};return _0x622f24;}})});}_0x2f997e=_[_0xb844('0x3d')]({},_0x2f997e,_0x27d2b1['options']);var _0xde0cd9={'where':_0x2f997e['where']};return db['SmsQueueReport'][_0xb844('0x1f')](_0xde0cd9)['then'](function(_0x237215){_0x1530ee[_0xb844('0x1f')]=_0x237215;if(_0x27d2b1[_0xb844('0x32')][_0xb844('0x40')]){_0x2f997e[_0xb844('0x41')]=[{'all':!![]}];}return db[_0xb844('0x2c')]['findAll'](_0x2f997e);})[_0xb844('0x24')](function(_0x20034){_0x1530ee['rows']=_0x20034;return _0x1530ee;})[_0xb844('0x24')](respondWithFilteredResult(_0x2554ad,_0x2f997e))[_0xb844('0x42')](handleError(_0x2554ad,null));};exports[_0xb844('0x43')]=function(_0x1a66db,_0x2cffa7){var _0x4a295f={'raw':!![],'where':{'id':_0x1a66db['params']['id']}},_0x258444={};_0x258444['model']=_[_0xb844('0x33')](db['SmsQueueReport'][_0xb844('0x2d')]);_0x258444[_0xb844('0x32')]=_[_0xb844('0x33')](_0x1a66db[_0xb844('0x32')]);_0x258444[_0xb844('0x34')]=_['intersection'](_0x258444[_0xb844('0x31')],_0x258444[_0xb844('0x32')]);_0x4a295f[_0xb844('0x36')]=_[_0xb844('0x35')](_0x258444[_0xb844('0x31')],qs[_0xb844('0x37')](_0x1a66db[_0xb844('0x32')][_0xb844('0x37')]));_0x4a295f[_0xb844('0x36')]=_0x4a295f['attributes'][_0xb844('0x38')]?_0x4a295f[_0xb844('0x36')]:_0x258444[_0xb844('0x31')];if(_0x1a66db[_0xb844('0x32')][_0xb844('0x40')]){_0x4a295f[_0xb844('0x41')]=[{'all':!![]}];}_0x4a295f=_['merge']({},_0x4a295f,_0x1a66db[_0xb844('0x44')]);return db[_0xb844('0x2c')][_0xb844('0x45')](_0x4a295f)[_0xb844('0x24')](handleEntityNotFound(_0x2cffa7,null))['then'](respondWithResult(_0x2cffa7,null))[_0xb844('0x42')](handleError(_0x2cffa7,null));};exports['create']=function(_0x4abaf7,_0x1181c6){return db[_0xb844('0x2c')][_0xb844('0x46')](_0x4abaf7[_0xb844('0x47')],{})['then'](respondWithResult(_0x1181c6,0xc9))['catch'](handleError(_0x1181c6,null));};exports[_0xb844('0x23')]=function(_0x39c726,_0x179018){if(_0x39c726[_0xb844('0x47')]['id']){delete _0x39c726[_0xb844('0x47')]['id'];}return db[_0xb844('0x2c')][_0xb844('0x45')]({'where':{'id':_0x39c726[_0xb844('0x48')]['id']}})['then'](handleEntityNotFound(_0x179018,null))['then'](saveUpdates(_0x39c726[_0xb844('0x47')],null))[_0xb844('0x24')](respondWithResult(_0x179018,null))['catch'](handleError(_0x179018,null));};exports[_0xb844('0x25')]=function(_0x532d2a,_0x2f5ece){return db[_0xb844('0x2c')]['find']({'where':{'id':_0x532d2a['params']['id']}})['then'](handleEntityNotFound(_0x2f5ece,null))[_0xb844('0x24')](removeEntity(_0x2f5ece,null))[_0xb844('0x42')](handleError(_0x2f5ece,null));};exports['describe']=function(_0x4aff31,_0x561121){return db[_0xb844('0x2c')][_0xb844('0x49')]()[_0xb844('0x24')](respondWithResult(_0x561121,null))['catch'](handleError(_0x561121,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 44b3c67..077cf83 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xce2338,_0x40abfe){var _0x432efd=function(_0x444074){while(--_0x444074){_0xce2338['push'](_0xce2338['shift']());}};_0x432efd(++_0x40abfe);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 135f64f..ae3a17b 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 _0xa69c=['result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','debug','stringify','update','where','attributes','limit','UpdateSmsQueueReport','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0xa69c,0x1e0));var _0xca69=function(_0x3a60b8,_0x47caab){_0x3a60b8=_0x3a60b8-0x0;var _0x4eb583=_0xa69c[_0x3a60b8];return _0x4eb583;};'use strict';var _=require('lodash');var util=require(_0xca69('0x0'));var moment=require(_0xca69('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca69('0x2'))['db'];var utils=require(_0xca69('0x3'));var logger=require(_0xca69('0x4'))(_0xca69('0x5'));var config=require(_0xca69('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xca69('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9ac658,_0xad7ab5,_0x109667){return new BPromise(function(_0x3427db,_0xc622f2){return client['request'](_0x9ac658,_0x109667)[_0xca69('0x8')](function(_0x55faba){logger[_0xca69('0x9')](_0xca69('0xa'),_0xad7ab5,_0xca69('0xb'));logger['debug'](_0xca69('0xc'),_0xad7ab5,_0xca69('0xb'),JSON['stringify'](_0x55faba));if(_0x55faba[_0xca69('0xd')]){if(_0x55faba[_0xca69('0xd')][_0xca69('0xe')]===0x1f4){logger[_0xca69('0xd')](_0xca69('0xa'),_0xad7ab5,_0x55faba[_0xca69('0xd')][_0xca69('0xf')]);return _0xc622f2(_0x55faba[_0xca69('0xd')][_0xca69('0xf')]);}logger[_0xca69('0xd')](_0xca69('0xa'),_0xad7ab5,_0x55faba[_0xca69('0xd')]['message']);return _0x3427db(_0x55faba[_0xca69('0xd')][_0xca69('0xf')]);}else{logger[_0xca69('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0xad7ab5,_0xca69('0xb'));_0x3427db(_0x55faba[_0xca69('0x10')]['message']);}})[_0xca69('0x11')](function(_0x459498){logger['error'](_0xca69('0xa'),_0xad7ab5,_0x459498);_0xc622f2(_0x459498);});});}exports['CreateSmsQueueReport']=function(_0x19131f){var _0x431bec=this;return new Promise(function(_0x139313,_0x4bd391){return db[_0xca69('0x12')][_0xca69('0x13')](_0x19131f[_0xca69('0x14')],{'raw':_0x19131f[_0xca69('0x15')]?_0x19131f[_0xca69('0x15')][_0xca69('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2a917e){logger[_0xca69('0x9')](_0xca69('0x17'),_0x19131f);logger[_0xca69('0x18')](_0xca69('0x17'),_0x19131f,JSON[_0xca69('0x19')](_0x2a917e));_0x139313(_0x2a917e);})['catch'](function(_0x192b17){logger[_0xca69('0xd')](_0xca69('0x17'),_0x192b17[_0xca69('0xf')],_0x19131f);_0x4bd391(_0x431bec['error'](0x1f4,_0x192b17[_0xca69('0xf')]));});});};exports['UpdateSmsQueueReport']=function(_0x4b355e){var _0x301955=this;return new Promise(function(_0x5be0c2,_0x41220b){return db[_0xca69('0x12')][_0xca69('0x1a')](_0x4b355e[_0xca69('0x14')],{'raw':_0x4b355e['options']?_0x4b355e[_0xca69('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b355e['options']?_0x4b355e[_0xca69('0x15')][_0xca69('0x1b')]||null:null,'attributes':_0x4b355e[_0xca69('0x15')]?_0x4b355e[_0xca69('0x15')][_0xca69('0x1c')]||null:null,'limit':_0x4b355e[_0xca69('0x15')]?_0x4b355e[_0xca69('0x15')][_0xca69('0x1d')]||null:null})[_0xca69('0x8')](function(_0x5814a4){logger[_0xca69('0x9')](_0xca69('0x1e'),_0x4b355e);logger[_0xca69('0x18')]('UpdateSmsQueueReport',_0x4b355e,JSON[_0xca69('0x19')](_0x5814a4));_0x5be0c2(_0x5814a4);})['catch'](function(_0x5c630e){logger[_0xca69('0xd')](_0xca69('0x1e'),_0x5c630e[_0xca69('0xf')],_0x4b355e);_0x41220b(_0x301955[_0xca69('0xd')](0x1f4,_0x5c630e['message']));});});}; \ No newline at end of file +var _0xe19f=['catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','where','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x5621a9,_0x23e516){var _0x59712c=function(_0x3fb391){while(--_0x3fb391){_0x5621a9['push'](_0x5621a9['shift']());}};_0x59712c(++_0x23e516);}(_0xe19f,0x1d9));var _0xfe19=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe19f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xfe19('0x0'));var util=require(_0xfe19('0x1'));var moment=require(_0xfe19('0x2'));var BPromise=require(_0xfe19('0x3'));var rs=require(_0xfe19('0x4'));var fs=require('fs');var Redis=require(_0xfe19('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe19('0x6'))(_0xfe19('0x7'));var config=require('../../config/environment');var jayson=require(_0xfe19('0x8'));var client=jayson[_0xfe19('0x9')][_0xfe19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c664a,_0x1a2535,_0x4ed041){return new BPromise(function(_0x1510f9,_0x4b5b83){return client['request'](_0x1c664a,_0x4ed041)[_0xfe19('0xb')](function(_0x336603){logger[_0xfe19('0xc')](_0xfe19('0xd'),_0x1a2535,'request\x20sent');logger[_0xfe19('0xe')](_0xfe19('0xf'),_0x1a2535,'request\x20sent',JSON[_0xfe19('0x10')](_0x336603));if(_0x336603['error']){if(_0x336603[_0xfe19('0x11')][_0xfe19('0x12')]===0x1f4){logger[_0xfe19('0x11')](_0xfe19('0xd'),_0x1a2535,_0x336603[_0xfe19('0x11')][_0xfe19('0x13')]);return _0x4b5b83(_0x336603[_0xfe19('0x11')]['message']);}logger[_0xfe19('0x11')](_0xfe19('0xd'),_0x1a2535,_0x336603[_0xfe19('0x11')]['message']);return _0x1510f9(_0x336603[_0xfe19('0x11')][_0xfe19('0x13')]);}else{logger[_0xfe19('0xc')](_0xfe19('0xd'),_0x1a2535,_0xfe19('0x14'));_0x1510f9(_0x336603[_0xfe19('0x15')][_0xfe19('0x13')]);}})[_0xfe19('0x16')](function(_0x447c11){logger[_0xfe19('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1a2535,_0x447c11);_0x4b5b83(_0x447c11);});});}exports[_0xfe19('0x17')]=function(_0x4a3137){var _0x377915=this;return new Promise(function(_0x18d9c0,_0x5403a5){return db[_0xfe19('0x18')][_0xfe19('0x19')](_0x4a3137[_0xfe19('0x1a')],{'raw':_0x4a3137[_0xfe19('0x1b')]?_0x4a3137[_0xfe19('0x1b')][_0xfe19('0x1c')]===undefined?!![]:![]:!![]})[_0xfe19('0xb')](function(_0x29dee9){logger[_0xfe19('0xc')](_0xfe19('0x17'),_0x4a3137);logger[_0xfe19('0xe')](_0xfe19('0x17'),_0x4a3137,JSON[_0xfe19('0x10')](_0x29dee9));_0x18d9c0(_0x29dee9);})['catch'](function(_0x3c53d1){logger[_0xfe19('0x11')]('CreateSmsQueueReport',_0x3c53d1[_0xfe19('0x13')],_0x4a3137);_0x5403a5(_0x377915[_0xfe19('0x11')](0x1f4,_0x3c53d1['message']));});});};exports['UpdateSmsQueueReport']=function(_0x32277){var _0x55a336=this;return new Promise(function(_0xf7f598,_0x366d43){return db[_0xfe19('0x18')][_0xfe19('0x1d')](_0x32277[_0xfe19('0x1a')],{'raw':_0x32277['options']?_0x32277[_0xfe19('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32277[_0xfe19('0x1b')]?_0x32277[_0xfe19('0x1b')][_0xfe19('0x1e')]||null:null,'attributes':_0x32277[_0xfe19('0x1b')]?_0x32277['options']['attributes']||null:null,'limit':_0x32277[_0xfe19('0x1b')]?_0x32277[_0xfe19('0x1b')][_0xfe19('0x1f')]||null:null})['then'](function(_0x53bd1f){logger[_0xfe19('0xc')](_0xfe19('0x20'),_0x32277);logger[_0xfe19('0xe')]('UpdateSmsQueueReport',_0x32277,JSON['stringify'](_0x53bd1f));_0xf7f598(_0x53bd1f);})[_0xfe19('0x16')](function(_0x1b5b78){logger[_0xfe19('0x11')]('UpdateSmsQueueReport',_0x1b5b78['message'],_0x32277);_0x366d43(_0x55a336['error'](0x1f4,_0x1b5b78[_0xfe19('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 59da6a9..474153f 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 _0x90b5=['/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xc2124e,_0x1c651a){var _0x4d19c4=function(_0x4057ef){while(--_0x4057ef){_0xc2124e['push'](_0xc2124e['shift']());}};_0x4d19c4(++_0x1c651a);}(_0x90b5,0x139));var _0x590b=function(_0x110cd2,_0x37d44d){_0x110cd2=_0x110cd2-0x0;var _0x5efea1=_0x90b5[_0x110cd2];return _0x5efea1;};'use strict';var multer=require(_0x590b('0x0'));var util=require('util');var path=require(_0x590b('0x1'));var timeout=require(_0x590b('0x2'));var express=require(_0x590b('0x3'));var router=express[_0x590b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var controller=require('./smsTransferReport.controller');router[_0x590b('0x7')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0x9')]);router['get'](_0x590b('0xa'),auth[_0x590b('0x8')](),controller[_0x590b('0xb')]);router[_0x590b('0x7')](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0xd')]);router[_0x590b('0xe')]('/',auth[_0x590b('0x8')](),controller['create']);router[_0x590b('0xf')](_0x590b('0xc'),auth['isAuthenticated'](),controller[_0x590b('0x10')]);router['delete'](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0x11')]);module[_0x590b('0x12')]=router; \ No newline at end of file +var _0xe181=['/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe181,0x68));var _0x1e18=function(_0x2a8b5c,_0x429c22){_0x2a8b5c=_0x2a8b5c-0x0;var _0x3bbefe=_0xe181[_0x2a8b5c];return _0x3bbefe;};'use strict';var multer=require(_0x1e18('0x0'));var util=require('util');var path=require(_0x1e18('0x1'));var timeout=require(_0x1e18('0x2'));var express=require(_0x1e18('0x3'));var router=express[_0x1e18('0x4')]();var fs_extra=require(_0x1e18('0x5'));var auth=require(_0x1e18('0x6'));var interaction=require(_0x1e18('0x7'));var config=require('../../config/environment');var controller=require(_0x1e18('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1e18('0x9')]);router[_0x1e18('0xa')](_0x1e18('0xb'),auth[_0x1e18('0xc')](),controller[_0x1e18('0xd')]);router[_0x1e18('0xa')]('/:id',auth[_0x1e18('0xc')](),controller[_0x1e18('0xe')]);router[_0x1e18('0xf')]('/',auth[_0x1e18('0xc')](),controller[_0x1e18('0x10')]);router[_0x1e18('0x11')]('/:id',auth[_0x1e18('0xc')](),controller[_0x1e18('0x12')]);router[_0x1e18('0x13')](_0x1e18('0x14'),auth[_0x1e18('0xc')](),controller[_0x1e18('0x15')]);module[_0x1e18('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5503707..dab96b7 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x4464e5,_0x5aff8e){var _0x39e742=function(_0x30abf7){while(--_0x30abf7){_0x4464e5['push'](_0x4464e5['shift']());}};_0x39e742(++_0x5aff8e);}(_0xedd9,0xfc));var _0x9edd=function(_0x4fb472,_0x281c55){_0x4fb472=_0x4fb472-0x0;var _0x52a4df=_0xedd9[_0x4fb472];return _0x52a4df;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x54ef,0x112));var _0xf54e=function(_0x3ec4bf,_0x5deddf){_0x3ec4bf=_0x3ec4bf-0x0;var _0xb83919=_0x54ef[_0x3ec4bf];return _0xb83919;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 20bb5ab..51bb91f 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 _0x03a5=['set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x03a5,0x1e8));var _0x503a=function(_0x400ad4,_0x25ab92){_0x400ad4=_0x400ad4-0x0;var _0x48f28c=_0x03a5[_0x400ad4];return _0x48f28c;};'use strict';var emlformat=require(_0x503a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x503a('0x1'));var jsonpatch=require(_0x503a('0x2'));var rp=require(_0x503a('0x3'));var moment=require(_0x503a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x503a('0x5'));var util=require(_0x503a('0x6'));var path=require(_0x503a('0x7'));var sox=require(_0x503a('0x8'));var csv=require('to-csv');var ejs=require(_0x503a('0x9'));var fs=require('fs');var fs_extra=require(_0x503a('0xa'));var _=require('lodash');var squel=require(_0x503a('0xb'));var crypto=require('crypto');var jsforce=require(_0x503a('0xc'));var deskjs=require(_0x503a('0xd'));var toCsv=require(_0x503a('0xe'));var querystring=require(_0x503a('0xf'));var Papa=require(_0x503a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x503a('0x11'))(_0x503a('0x12'));var utils=require(_0x503a('0x13'));var config=require(_0x503a('0x14'));var licenseUtil=require(_0x503a('0x15'));var db=require(_0x503a('0x16'))['db'];function respondWithStatusCode(_0x176f1c,_0x16fbd1){_0x16fbd1=_0x16fbd1||0xcc;return function(_0x175faa){if(_0x175faa){return _0x176f1c[_0x503a('0x17')](_0x16fbd1);}return _0x176f1c[_0x503a('0x18')](_0x16fbd1)[_0x503a('0x19')]();};}function respondWithResult(_0x456d7c,_0x328de4){_0x328de4=_0x328de4||0xc8;return function(_0x24eb4d){if(_0x24eb4d){return _0x456d7c['status'](_0x328de4)[_0x503a('0x1a')](_0x24eb4d);}};}function respondWithFilteredResult(_0x349eb2,_0x6e1e79){return function(_0x12309c){if(_0x12309c){var _0x1f4b6b=typeof _0x6e1e79[_0x503a('0x1b')]===_0x503a('0x1c')&&typeof _0x6e1e79[_0x503a('0x1d')]===_0x503a('0x1c');var _0x168630=_0x12309c['count'];var _0x1b7670=_0x1f4b6b?0x0:_0x6e1e79['offset'];var _0x477af0=_0x1f4b6b?_0x12309c['count']:_0x6e1e79[_0x503a('0x1b')]+_0x6e1e79[_0x503a('0x1d')];var _0x301d45;if(_0x477af0>=_0x168630){_0x477af0=_0x168630;_0x301d45=0xc8;}else{_0x301d45=0xce;}_0x349eb2[_0x503a('0x18')](_0x301d45);return _0x349eb2[_0x503a('0x1e')](_0x503a('0x1f'),_0x1b7670+'-'+_0x477af0+'/'+_0x168630)['json'](_0x12309c);}return null;};}function patchUpdates(_0x28a6ea){return function(_0x554234){try{jsonpatch[_0x503a('0x20')](_0x554234,_0x28a6ea,!![]);}catch(_0x30161e){return BPromise[_0x503a('0x21')](_0x30161e);}return _0x554234[_0x503a('0x22')]();};}function saveUpdates(_0x4367fc,_0x5650d2){return function(_0x56f892){if(_0x56f892){return _0x56f892['update'](_0x4367fc)[_0x503a('0x23')](function(_0x2c5312){return _0x2c5312;});}return null;};}function removeEntity(_0x1e8e9e,_0x5bc46b){return function(_0x183a35){if(_0x183a35){return _0x183a35[_0x503a('0x24')]()[_0x503a('0x23')](function(){_0x1e8e9e['status'](0xcc)[_0x503a('0x19')]();});}};}function handleEntityNotFound(_0x2b38d7,_0x5ac9c3){return function(_0x38da90){if(!_0x38da90){_0x2b38d7[_0x503a('0x17')](0x194);}return _0x38da90;};}function handleError(_0x15befb,_0x43dcdf){_0x43dcdf=_0x43dcdf||0x1f4;return function(_0x12f8e4){logger[_0x503a('0x25')](_0x12f8e4[_0x503a('0x26')]);if(_0x12f8e4[_0x503a('0x27')]){delete _0x12f8e4[_0x503a('0x27')];}_0x15befb['status'](_0x43dcdf)['send'](_0x12f8e4);};}exports['index']=function(_0x16ff52,_0x58520b){var _0xb19c40={},_0x114f7c={},_0x32f703={'count':0x0,'rows':[]};var _0x2406c0=_[_0x503a('0x28')](db[_0x503a('0x29')]['rawAttributes'],function(_0x54a567){return{'name':_0x54a567[_0x503a('0x2a')],'type':_0x54a567[_0x503a('0x2b')][_0x503a('0x2c')]};});_0x114f7c[_0x503a('0x2d')]=_['map'](_0x2406c0,_0x503a('0x27'));_0x114f7c[_0x503a('0x2e')]=_[_0x503a('0x2f')](_0x16ff52[_0x503a('0x2e')]);_0x114f7c[_0x503a('0x30')]=_[_0x503a('0x31')](_0x114f7c[_0x503a('0x2d')],_0x114f7c[_0x503a('0x2e')]);_0xb19c40['attributes']=_[_0x503a('0x31')](_0x114f7c[_0x503a('0x2d')],qs[_0x503a('0x32')](_0x16ff52[_0x503a('0x2e')]['fields']));_0xb19c40[_0x503a('0x33')]=_0xb19c40[_0x503a('0x33')]['length']?_0xb19c40[_0x503a('0x33')]:_0x114f7c[_0x503a('0x2d')];if(!_0x16ff52['query'][_0x503a('0x34')]('nolimit')){_0xb19c40[_0x503a('0x1d')]=qs[_0x503a('0x1d')](_0x16ff52[_0x503a('0x2e')][_0x503a('0x1d')]);_0xb19c40['offset']=qs[_0x503a('0x1b')](_0x16ff52[_0x503a('0x2e')][_0x503a('0x1b')]);}_0xb19c40[_0x503a('0x35')]=qs[_0x503a('0x36')](_0x16ff52[_0x503a('0x2e')][_0x503a('0x36')]);_0xb19c40[_0x503a('0x37')]=qs[_0x503a('0x30')](_[_0x503a('0x38')](_0x16ff52[_0x503a('0x2e')],_0x114f7c['filters']),_0x2406c0);if(_0x16ff52[_0x503a('0x2e')][_0x503a('0x39')]){_0xb19c40[_0x503a('0x37')]=_[_0x503a('0x3a')](_0xb19c40[_0x503a('0x37')],{'$or':_[_0x503a('0x28')](_0x2406c0,function(_0x459652){if(_0x459652['type']!==_0x503a('0x3b')){var _0x39eeaa={};_0x39eeaa[_0x459652[_0x503a('0x27')]]={'$like':'%'+_0x16ff52[_0x503a('0x2e')][_0x503a('0x39')]+'%'};return _0x39eeaa;}})});}_0xb19c40=_['merge']({},_0xb19c40,_0x16ff52[_0x503a('0x3c')]);var _0x5271a8={'where':_0xb19c40['where']};return db[_0x503a('0x29')]['count'](_0x5271a8)[_0x503a('0x23')](function(_0x590ccc){_0x32f703['count']=_0x590ccc;if(_0x16ff52[_0x503a('0x2e')][_0x503a('0x3d')]){_0xb19c40[_0x503a('0x3e')]=[{'all':!![]}];}return db[_0x503a('0x29')]['findAll'](_0xb19c40);})[_0x503a('0x23')](function(_0xb8dc3e){_0x32f703[_0x503a('0x3f')]=_0xb8dc3e;return _0x32f703;})[_0x503a('0x23')](respondWithFilteredResult(_0x58520b,_0xb19c40))[_0x503a('0x40')](handleError(_0x58520b,null));};exports[_0x503a('0x41')]=function(_0x2b7496,_0x13ee36){var _0x45e885={'raw':!![],'where':{'id':_0x2b7496[_0x503a('0x42')]['id']}},_0xd2625={};_0xd2625[_0x503a('0x2d')]=_['keys'](db['SmsTransferReport'][_0x503a('0x43')]);_0xd2625[_0x503a('0x2e')]=_['keys'](_0x2b7496['query']);_0xd2625[_0x503a('0x30')]=_['intersection'](_0xd2625['model'],_0xd2625[_0x503a('0x2e')]);_0x45e885[_0x503a('0x33')]=_[_0x503a('0x31')](_0xd2625[_0x503a('0x2d')],qs[_0x503a('0x32')](_0x2b7496['query'][_0x503a('0x32')]));_0x45e885[_0x503a('0x33')]=_0x45e885[_0x503a('0x33')][_0x503a('0x44')]?_0x45e885['attributes']:_0xd2625[_0x503a('0x2d')];if(_0x2b7496[_0x503a('0x2e')][_0x503a('0x3d')]){_0x45e885[_0x503a('0x3e')]=[{'all':!![]}];}_0x45e885=_[_0x503a('0x3a')]({},_0x45e885,_0x2b7496[_0x503a('0x3c')]);return db[_0x503a('0x29')][_0x503a('0x45')](_0x45e885)['then'](handleEntityNotFound(_0x13ee36,null))[_0x503a('0x23')](respondWithResult(_0x13ee36,null))[_0x503a('0x40')](handleError(_0x13ee36,null));};exports[_0x503a('0x46')]=function(_0x1208cf,_0x574804){return db['SmsTransferReport'][_0x503a('0x46')](_0x1208cf['body'],{})[_0x503a('0x23')](respondWithResult(_0x574804,0xc9))[_0x503a('0x40')](handleError(_0x574804,null));};exports[_0x503a('0x47')]=function(_0x18d336,_0x27decd){if(_0x18d336[_0x503a('0x48')]['id']){delete _0x18d336[_0x503a('0x48')]['id'];}return db[_0x503a('0x29')][_0x503a('0x45')]({'where':{'id':_0x18d336[_0x503a('0x42')]['id']}})[_0x503a('0x23')](handleEntityNotFound(_0x27decd,null))['then'](saveUpdates(_0x18d336[_0x503a('0x48')],null))['then'](respondWithResult(_0x27decd,null))[_0x503a('0x40')](handleError(_0x27decd,null));};exports['destroy']=function(_0x29cf89,_0x470e8a){return db[_0x503a('0x29')][_0x503a('0x45')]({'where':{'id':_0x29cf89['params']['id']}})['then'](handleEntityNotFound(_0x470e8a,null))[_0x503a('0x23')](removeEntity(_0x470e8a,null))[_0x503a('0x40')](handleError(_0x470e8a,null));};exports[_0x503a('0x49')]=function(_0x39941d,_0x120bda){return db[_0x503a('0x29')][_0x503a('0x49')]()[_0x503a('0x23')](respondWithResult(_0x120bda,null))[_0x503a('0x40')](handleError(_0x120bda,null));}; \ No newline at end of file +var _0x058b=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','destroy','describe','rimraf','zip-dir','moment'];(function(_0x3232cd,_0x584ba4){var _0x1398cf=function(_0x64cc05){while(--_0x64cc05){_0x3232cd['push'](_0x3232cd['shift']());}};_0x1398cf(++_0x584ba4);}(_0x058b,0x1d1));var _0xb058=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x058b[_0x3e6b2f];return _0x323215;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb058('0x0'));var zipdir=require(_0xb058('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb058('0x2'));var BPromise=require(_0xb058('0x3'));var Mustache=require(_0xb058('0x4'));var util=require(_0xb058('0x5'));var path=require(_0xb058('0x6'));var sox=require(_0xb058('0x7'));var csv=require(_0xb058('0x8'));var ejs=require(_0xb058('0x9'));var fs=require('fs');var fs_extra=require(_0xb058('0xa'));var _=require(_0xb058('0xb'));var squel=require('squel');var crypto=require(_0xb058('0xc'));var jsforce=require(_0xb058('0xd'));var deskjs=require(_0xb058('0xe'));var toCsv=require(_0xb058('0x8'));var querystring=require(_0xb058('0xf'));var Papa=require(_0xb058('0x10'));var Redis=require(_0xb058('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb058('0x12'));var as=require(_0xb058('0x13'));var hardwareService=require(_0xb058('0x14'));var logger=require(_0xb058('0x15'))('api');var utils=require(_0xb058('0x16'));var config=require(_0xb058('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb058('0x18'))['db'];function respondWithStatusCode(_0x22a48f,_0x5dedd8){_0x5dedd8=_0x5dedd8||0xcc;return function(_0x5d5487){if(_0x5d5487){return _0x22a48f[_0xb058('0x19')](_0x5dedd8);}return _0x22a48f[_0xb058('0x1a')](_0x5dedd8)['end']();};}function respondWithResult(_0x5733d6,_0x21a1ce){_0x21a1ce=_0x21a1ce||0xc8;return function(_0x5341c9){if(_0x5341c9){return _0x5733d6[_0xb058('0x1a')](_0x21a1ce)[_0xb058('0x1b')](_0x5341c9);}};}function respondWithFilteredResult(_0x267cb8,_0x405d93){return function(_0x432a4b){if(_0x432a4b){var _0x372cca=typeof _0x405d93['offset']===_0xb058('0x1c')&&typeof _0x405d93[_0xb058('0x1d')]===_0xb058('0x1c');var _0x5609c5=_0x432a4b[_0xb058('0x1e')];var _0x526d73=_0x372cca?0x0:_0x405d93[_0xb058('0x1f')];var _0x3502f7=_0x372cca?_0x432a4b[_0xb058('0x1e')]:_0x405d93[_0xb058('0x1f')]+_0x405d93[_0xb058('0x1d')];var _0x16bb47;if(_0x3502f7>=_0x5609c5){_0x3502f7=_0x5609c5;_0x16bb47=0xc8;}else{_0x16bb47=0xce;}_0x267cb8[_0xb058('0x1a')](_0x16bb47);return _0x267cb8['set'](_0xb058('0x20'),_0x526d73+'-'+_0x3502f7+'/'+_0x5609c5)[_0xb058('0x1b')](_0x432a4b);}return null;};}function patchUpdates(_0x11c1a7){return function(_0x37b2af){try{jsonpatch[_0xb058('0x21')](_0x37b2af,_0x11c1a7,!![]);}catch(_0x59cbe2){return BPromise['reject'](_0x59cbe2);}return _0x37b2af[_0xb058('0x22')]();};}function saveUpdates(_0x1bd81a,_0x4b0c5f){return function(_0x34c0f6){if(_0x34c0f6){return _0x34c0f6[_0xb058('0x23')](_0x1bd81a)[_0xb058('0x24')](function(_0x2f4289){return _0x2f4289;});}return null;};}function removeEntity(_0x375700,_0x481f68){return function(_0x1aa76c){if(_0x1aa76c){return _0x1aa76c['destroy']()[_0xb058('0x24')](function(){_0x375700[_0xb058('0x1a')](0xcc)[_0xb058('0x25')]();});}};}function handleEntityNotFound(_0x28c744,_0x10823c){return function(_0x1e54db){if(!_0x1e54db){_0x28c744['sendStatus'](0x194);}return _0x1e54db;};}function handleError(_0x503c48,_0x21a512){_0x21a512=_0x21a512||0x1f4;return function(_0x87ada0){logger[_0xb058('0x26')](_0x87ada0[_0xb058('0x27')]);if(_0x87ada0[_0xb058('0x28')]){delete _0x87ada0[_0xb058('0x28')];}_0x503c48['status'](_0x21a512)['send'](_0x87ada0);};}exports[_0xb058('0x29')]=function(_0x53f39b,_0x206386){var _0x19fe25={},_0x1dfaee={},_0x5273d0={'count':0x0,'rows':[]};var _0x4f8181=_[_0xb058('0x2a')](db[_0xb058('0x2b')][_0xb058('0x2c')],function(_0xe74df4){return{'name':_0xe74df4[_0xb058('0x2d')],'type':_0xe74df4[_0xb058('0x2e')][_0xb058('0x2f')]};});_0x1dfaee[_0xb058('0x30')]=_[_0xb058('0x2a')](_0x4f8181,_0xb058('0x28'));_0x1dfaee[_0xb058('0x31')]=_[_0xb058('0x32')](_0x53f39b[_0xb058('0x31')]);_0x1dfaee[_0xb058('0x33')]=_[_0xb058('0x34')](_0x1dfaee[_0xb058('0x30')],_0x1dfaee[_0xb058('0x31')]);_0x19fe25['attributes']=_[_0xb058('0x34')](_0x1dfaee['model'],qs[_0xb058('0x35')](_0x53f39b[_0xb058('0x31')][_0xb058('0x35')]));_0x19fe25['attributes']=_0x19fe25[_0xb058('0x36')][_0xb058('0x37')]?_0x19fe25['attributes']:_0x1dfaee[_0xb058('0x30')];if(!_0x53f39b[_0xb058('0x31')][_0xb058('0x38')](_0xb058('0x39'))){_0x19fe25[_0xb058('0x1d')]=qs[_0xb058('0x1d')](_0x53f39b[_0xb058('0x31')][_0xb058('0x1d')]);_0x19fe25[_0xb058('0x1f')]=qs[_0xb058('0x1f')](_0x53f39b[_0xb058('0x31')][_0xb058('0x1f')]);}_0x19fe25[_0xb058('0x3a')]=qs[_0xb058('0x3b')](_0x53f39b[_0xb058('0x31')][_0xb058('0x3b')]);_0x19fe25[_0xb058('0x3c')]=qs[_0xb058('0x33')](_[_0xb058('0x3d')](_0x53f39b[_0xb058('0x31')],_0x1dfaee[_0xb058('0x33')]),_0x4f8181);if(_0x53f39b[_0xb058('0x31')][_0xb058('0x3e')]){_0x19fe25[_0xb058('0x3c')]=_[_0xb058('0x3f')](_0x19fe25[_0xb058('0x3c')],{'$or':_[_0xb058('0x2a')](_0x4f8181,function(_0x49e1b5){if(_0x49e1b5['type']!==_0xb058('0x40')){var _0x137381={};_0x137381[_0x49e1b5['name']]={'$like':'%'+_0x53f39b[_0xb058('0x31')]['filter']+'%'};return _0x137381;}})});}_0x19fe25=_[_0xb058('0x3f')]({},_0x19fe25,_0x53f39b[_0xb058('0x41')]);var _0x5b11bb={'where':_0x19fe25[_0xb058('0x3c')]};return db['SmsTransferReport'][_0xb058('0x1e')](_0x5b11bb)[_0xb058('0x24')](function(_0x11ea29){_0x5273d0[_0xb058('0x1e')]=_0x11ea29;if(_0x53f39b[_0xb058('0x31')][_0xb058('0x42')]){_0x19fe25[_0xb058('0x43')]=[{'all':!![]}];}return db[_0xb058('0x2b')][_0xb058('0x44')](_0x19fe25);})[_0xb058('0x24')](function(_0x41e69d){_0x5273d0[_0xb058('0x45')]=_0x41e69d;return _0x5273d0;})['then'](respondWithFilteredResult(_0x206386,_0x19fe25))['catch'](handleError(_0x206386,null));};exports[_0xb058('0x46')]=function(_0x486659,_0x17fb78){var _0x20f7d9={'raw':!![],'where':{'id':_0x486659['params']['id']}},_0x175e7d={};_0x175e7d[_0xb058('0x30')]=_['keys'](db[_0xb058('0x2b')][_0xb058('0x2c')]);_0x175e7d[_0xb058('0x31')]=_['keys'](_0x486659['query']);_0x175e7d[_0xb058('0x33')]=_[_0xb058('0x34')](_0x175e7d[_0xb058('0x30')],_0x175e7d['query']);_0x20f7d9['attributes']=_['intersection'](_0x175e7d['model'],qs[_0xb058('0x35')](_0x486659[_0xb058('0x31')][_0xb058('0x35')]));_0x20f7d9[_0xb058('0x36')]=_0x20f7d9['attributes'][_0xb058('0x37')]?_0x20f7d9[_0xb058('0x36')]:_0x175e7d['model'];if(_0x486659[_0xb058('0x31')][_0xb058('0x42')]){_0x20f7d9['include']=[{'all':!![]}];}_0x20f7d9=_[_0xb058('0x3f')]({},_0x20f7d9,_0x486659['options']);return db['SmsTransferReport'][_0xb058('0x47')](_0x20f7d9)[_0xb058('0x24')](handleEntityNotFound(_0x17fb78,null))[_0xb058('0x24')](respondWithResult(_0x17fb78,null))[_0xb058('0x48')](handleError(_0x17fb78,null));};exports['create']=function(_0x593bf1,_0x4edd8c){return db[_0xb058('0x2b')][_0xb058('0x49')](_0x593bf1[_0xb058('0x4a')],{})[_0xb058('0x24')](respondWithResult(_0x4edd8c,0xc9))['catch'](handleError(_0x4edd8c,null));};exports['update']=function(_0x29ae35,_0x21e3d2){if(_0x29ae35[_0xb058('0x4a')]['id']){delete _0x29ae35[_0xb058('0x4a')]['id'];}return db[_0xb058('0x2b')][_0xb058('0x47')]({'where':{'id':_0x29ae35[_0xb058('0x4b')]['id']}})[_0xb058('0x24')](handleEntityNotFound(_0x21e3d2,null))[_0xb058('0x24')](saveUpdates(_0x29ae35[_0xb058('0x4a')],null))[_0xb058('0x24')](respondWithResult(_0x21e3d2,null))[_0xb058('0x48')](handleError(_0x21e3d2,null));};exports[_0xb058('0x4c')]=function(_0x367ae6,_0x181838){return db[_0xb058('0x2b')][_0xb058('0x47')]({'where':{'id':_0x367ae6[_0xb058('0x4b')]['id']}})[_0xb058('0x24')](handleEntityNotFound(_0x181838,null))[_0xb058('0x24')](removeEntity(_0x181838,null))['catch'](handleError(_0x181838,null));};exports[_0xb058('0x4d')]=function(_0x587b17,_0x4fc4f7){return db[_0xb058('0x2b')]['describe']()[_0xb058('0x24')](respondWithResult(_0x4fc4f7,null))[_0xb058('0x48')](handleError(_0x4fc4f7,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index a64470a..42e33e5 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 _0xbc17=['api','moment','path','rimraf','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0x377a1d,_0x10c457){var _0x486ea4=function(_0x3fad03){while(--_0x3fad03){_0x377a1d['push'](_0x377a1d['shift']());}};_0x486ea4(++_0x10c457);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x1e48b3,_0x3150bc){_0x1e48b3=_0x1e48b3-0x0;var _0x295fae=_0xbc17[_0x1e48b3];return _0x295fae;};'use strict';var _=require(_0x7bc1('0x0'));var util=require(_0x7bc1('0x1'));var logger=require('../../config/logger')(_0x7bc1('0x2'));var moment=require(_0x7bc1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bc1('0x4'));var rimraf=require(_0x7bc1('0x5'));var config=require('../../config/environment');var attributes=require(_0x7bc1('0x6'));module['exports']=function(_0xba4fa8,_0xcecb62){return _0xba4fa8[_0x7bc1('0x7')](_0x7bc1('0x8'),attributes,{'tableName':_0x7bc1('0x9'),'paranoid':![],'indexes':[{'name':_0x7bc1('0xa'),'fields':[_0x7bc1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84e6=['exports','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','request-promise','../../config/environment','./smsTransferReport.attributes'];(function(_0x4d2a06,_0x540d6e){var _0x139f1b=function(_0x253c39){while(--_0x253c39){_0x4d2a06['push'](_0x4d2a06['shift']());}};_0x139f1b(++_0x540d6e);}(_0x84e6,0x8f));var _0x684e=function(_0x5b2028,_0x1105d4){_0x5b2028=_0x5b2028-0x0;var _0x347c35=_0x84e6[_0x5b2028];return _0x347c35;};'use strict';var _=require(_0x684e('0x0'));var util=require(_0x684e('0x1'));var logger=require(_0x684e('0x2'))(_0x684e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x684e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x684e('0x5'));var attributes=require(_0x684e('0x6'));module[_0x684e('0x7')]=function(_0x58d742,_0x1dfb0b){return _0x58d742['define'](_0x684e('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x684e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8126c95..01b8eb3 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 _0x6bac=['message','info','result','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','then','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsTransferReport,\x20%s,\x20%s'];(function(_0x42ebbf,_0x566bc2){var _0x2078f3=function(_0x7433b6){while(--_0x7433b6){_0x42ebbf['push'](_0x42ebbf['shift']());}};_0x2078f3(++_0x566bc2);}(_0x6bac,0xa5));var _0xc6ba=function(_0x58ae26,_0x6435ee){_0x58ae26=_0x58ae26-0x0;var _0x3db04c=_0x6bac[_0x58ae26];return _0x3db04c;};'use strict';var _=require(_0xc6ba('0x0'));var util=require('util');var moment=require(_0xc6ba('0x1'));var BPromise=require(_0xc6ba('0x2'));var rs=require(_0xc6ba('0x3'));var fs=require('fs');var Redis=require(_0xc6ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6ba('0x5'));var config=require(_0xc6ba('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc6ba('0x7')][_0xc6ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33167e,_0x42858b,_0x12d6e9){return new BPromise(function(_0x1fa2a8,_0x5b98f9){return client['request'](_0x33167e,_0x12d6e9)[_0xc6ba('0x9')](function(_0x481755){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x42858b,'request\x20sent');logger['debug'](_0xc6ba('0xa'),_0x42858b,_0xc6ba('0xb'),JSON[_0xc6ba('0xc')](_0x481755));if(_0x481755[_0xc6ba('0xd')]){if(_0x481755[_0xc6ba('0xd')]['code']===0x1f4){logger['error'](_0xc6ba('0xe'),_0x42858b,_0x481755[_0xc6ba('0xd')][_0xc6ba('0xf')]);return _0x5b98f9(_0x481755[_0xc6ba('0xd')][_0xc6ba('0xf')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x42858b,_0x481755['error'][_0xc6ba('0xf')]);return _0x1fa2a8(_0x481755[_0xc6ba('0xd')][_0xc6ba('0xf')]);}else{logger[_0xc6ba('0x10')](_0xc6ba('0xe'),_0x42858b,_0xc6ba('0xb'));_0x1fa2a8(_0x481755[_0xc6ba('0x11')][_0xc6ba('0xf')]);}})['catch'](function(_0x52c811){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x42858b,_0x52c811);_0x5b98f9(_0x52c811);});});} \ No newline at end of file +var _0x212b=['jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x52cb1d,_0x51820a){var _0x153b2e=function(_0x11a82f){while(--_0x11a82f){_0x52cb1d['push'](_0x52cb1d['shift']());}};_0x153b2e(++_0x51820a);}(_0x212b,0x148));var _0xb212=function(_0x5614fa,_0x3fa655){_0x5614fa=_0x5614fa-0x0;var _0x46c174=_0x212b[_0x5614fa];return _0x46c174;};'use strict';var _=require(_0xb212('0x0'));var util=require('util');var moment=require(_0xb212('0x1'));var BPromise=require(_0xb212('0x2'));var rs=require(_0xb212('0x3'));var fs=require('fs');var Redis=require(_0xb212('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb212('0x5'));var logger=require(_0xb212('0x6'))(_0xb212('0x7'));var config=require('../../config/environment');var jayson=require(_0xb212('0x8'));var client=jayson[_0xb212('0x9')][_0xb212('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f604,_0x15a5a5,_0x3839e0){return new BPromise(function(_0x5c1000,_0x4cf8f7){return client[_0xb212('0xb')](_0x51f604,_0x3839e0)[_0xb212('0xc')](function(_0x5b6886){logger[_0xb212('0xd')](_0xb212('0xe'),_0x15a5a5,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x15a5a5,_0xb212('0xf'),JSON['stringify'](_0x5b6886));if(_0x5b6886[_0xb212('0x10')]){if(_0x5b6886[_0xb212('0x10')][_0xb212('0x11')]===0x1f4){logger[_0xb212('0x10')](_0xb212('0xe'),_0x15a5a5,_0x5b6886[_0xb212('0x10')][_0xb212('0x12')]);return _0x4cf8f7(_0x5b6886[_0xb212('0x10')][_0xb212('0x12')]);}logger[_0xb212('0x10')](_0xb212('0xe'),_0x15a5a5,_0x5b6886[_0xb212('0x10')]['message']);return _0x5c1000(_0x5b6886['error']['message']);}else{logger['info'](_0xb212('0xe'),_0x15a5a5,_0xb212('0xf'));_0x5c1000(_0x5b6886[_0xb212('0x13')]['message']);}})[_0xb212('0x14')](function(_0x285ef6){logger[_0xb212('0x10')](_0xb212('0xe'),_0x15a5a5,_0x285ef6);_0x4cf8f7(_0x285ef6);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 5f5a9c5..97bf7cb 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 _0xe458=['isAuthenticated','/:id','show','diskStorage','root','server/files/sounds/original/','originalname','replace','format','extname','now','post','single','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x5ae187,_0x8afd5c){var _0x211069=function(_0x5a56b6){while(--_0x5a56b6){_0x5ae187['push'](_0x5ae187['shift']());}};_0x211069(++_0x8afd5c);}(_0xe458,0x155));var _0x8e45=function(_0x2c1403,_0x595df9){_0x2c1403=_0x2c1403-0x0;var _0x177c99=_0xe458[_0x2c1403];return _0x177c99;};'use strict';var multer=require('multer');var util=require(_0x8e45('0x0'));var path=require(_0x8e45('0x1'));var timeout=require(_0x8e45('0x2'));var express=require(_0x8e45('0x3'));var router=express[_0x8e45('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e45('0x5'));var interaction=require(_0x8e45('0x6'));var config=require(_0x8e45('0x7'));var controller=require(_0x8e45('0x8'));router[_0x8e45('0x9')]('/',auth[_0x8e45('0xa')](),controller['index']);router[_0x8e45('0x9')](_0x8e45('0xb'),auth[_0x8e45('0xa')](),controller[_0x8e45('0xc')]);router[_0x8e45('0x9')]('/:id/download',auth[_0x8e45('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x8e45('0xd')]({'destination':function(_0x3d7ff8,_0x5bf2a9,_0x4a773b){_0x4a773b(null,path['join'](config[_0x8e45('0xe')],_0x8e45('0xf')));},'filename':function(_0x39363e,_0x3a899b,_0x528b98){_0x3a899b[_0x8e45('0x10')]=_0x3a899b[_0x8e45('0x10')][_0x8e45('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x528b98(null,util[_0x8e45('0x12')]('%s-%s%s',path['basename'](_0x3a899b['originalname'],path[_0x8e45('0x13')](_0x3a899b[_0x8e45('0x10')])),Date[_0x8e45('0x14')](),path[_0x8e45('0x13')](_0x3a899b[_0x8e45('0x10')])));}})});router[_0x8e45('0x15')]('/',upload[_0x8e45('0x16')]('file'),controller[_0x8e45('0x17')]);router[_0x8e45('0x18')](_0x8e45('0xb'),auth['isAuthenticated'](),controller[_0x8e45('0x19')]);router[_0x8e45('0x1a')](_0x8e45('0xb'),auth[_0x8e45('0xa')](),controller[_0x8e45('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb9b6=['delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','file','create','put','isAuthenticated','update'];(function(_0x4127cd,_0x29beaf){var _0x3b8888=function(_0x4ab864){while(--_0x4ab864){_0x4127cd['push'](_0x4127cd['shift']());}};_0x3b8888(++_0x29beaf);}(_0xb9b6,0xbc));var _0x6b9b=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0xb9b6[_0xf26d40];return _0x50b68c;};'use strict';var multer=require('multer');var util=require(_0x6b9b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b9b('0x1'));var router=express[_0x6b9b('0x2')]();var fs_extra=require(_0x6b9b('0x3'));var auth=require(_0x6b9b('0x4'));var interaction=require(_0x6b9b('0x5'));var config=require(_0x6b9b('0x6'));var controller=require(_0x6b9b('0x7'));router[_0x6b9b('0x8')]('/',auth['isAuthenticated'](),controller[_0x6b9b('0x9')]);router[_0x6b9b('0x8')](_0x6b9b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6b9b('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x6b9b('0xb')]);var upload=multer({'storage':multer[_0x6b9b('0xc')]({'destination':function(_0x43cf42,_0x2fb448,_0x3c5403){_0x3c5403(null,path[_0x6b9b('0xd')](config[_0x6b9b('0xe')],_0x6b9b('0xf')));},'filename':function(_0x28c110,_0x313768,_0x56421d){_0x313768[_0x6b9b('0x10')]=_0x313768[_0x6b9b('0x10')][_0x6b9b('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56421d(null,util[_0x6b9b('0x12')](_0x6b9b('0x13'),path[_0x6b9b('0x14')](_0x313768['originalname'],path['extname'](_0x313768[_0x6b9b('0x10')])),Date[_0x6b9b('0x15')](),path[_0x6b9b('0x16')](_0x313768['originalname'])));}})});router[_0x6b9b('0x17')]('/',upload['single'](_0x6b9b('0x18')),controller[_0x6b9b('0x19')]);router[_0x6b9b('0x1a')](_0x6b9b('0xa'),auth[_0x6b9b('0x1b')](),controller[_0x6b9b('0x1c')]);router[_0x6b9b('0x1d')](_0x6b9b('0xa'),auth['isAuthenticated'](),controller['delete']);module[_0x6b9b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 94ede5b..36407c0 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 _0x542d=['BIGINT','sequelize','exports','STRING','name','FLOAT','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x542d,0x71));var _0xd542=function(_0x2ed2c5,_0x43b67e){_0x2ed2c5=_0x2ed2c5-0x0;var _0xd92a07=_0x542d[_0x2ed2c5];return _0xd92a07;};'use strict';var Sequelize=require(_0xd542('0x0'));module[_0xd542('0x1')]={'name':{'type':Sequelize[_0xd542('0x2')],'unique':_0xd542('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd542('0x2')]},'display_name':{'type':Sequelize[_0xd542('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xd542('0x2')]},'original_format':{'type':Sequelize[_0xd542('0x2')]},'original_duration':{'type':Sequelize[_0xd542('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xd542('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xd542('0x5')]},'converted_format':{'type':Sequelize[_0xd542('0x2')]},'converted_duration':{'type':Sequelize[_0xd542('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xd542('0x6')]},'converted_channelCount':{'type':Sequelize[_0xd542('0x5')]},'converted_bitRate':{'type':Sequelize[_0xd542('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xd542('0x5')]}}; \ No newline at end of file +var _0x2df8=['INTEGER','exports','STRING','name','FLOAT','BIGINT'];(function(_0x1b563d,_0x51bf87){var _0x4a31a0=function(_0x579b06){while(--_0x579b06){_0x1b563d['push'](_0x1b563d['shift']());}};_0x4a31a0(++_0x51bf87);}(_0x2df8,0x15d));var _0x82df=function(_0x1144cf,_0x18f0d1){_0x1144cf=_0x1144cf-0x0;var _0x564dcb=_0x2df8[_0x1144cf];return _0x564dcb;};'use strict';var Sequelize=require('sequelize');module[_0x82df('0x0')]={'name':{'type':Sequelize[_0x82df('0x1')],'unique':_0x82df('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x82df('0x1')]},'display_name':{'type':Sequelize[_0x82df('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x82df('0x1')]},'original_format':{'type':Sequelize[_0x82df('0x1')]},'original_duration':{'type':Sequelize[_0x82df('0x3')]},'original_sampleCount':{'type':Sequelize[_0x82df('0x4')]},'original_channelCount':{'type':Sequelize[_0x82df('0x5')]},'original_bitRate':{'type':Sequelize[_0x82df('0x4')]},'original_sampleRate':{'type':Sequelize[_0x82df('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x82df('0x4')]},'converted_channelCount':{'type':Sequelize[_0x82df('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 0f4f576..07684af 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 _0xe533=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','save','update','destroy','UserProfileResource','then','sendStatus','error','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','VIRTUAL','merge','include','Sound','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','options','find','download','save_name','existsSync','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','converted_format','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','userProfileId','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','pick','description','delete','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x3cbf12,_0x4b9dd0){var _0x507ae7=function(_0x41e907){while(--_0x41e907){_0x3cbf12['push'](_0x3cbf12['shift']());}};_0x507ae7(++_0x4b9dd0);}(_0xe533,0x1e4));var _0x3e53=function(_0x85a1fc,_0x4cc6c5){_0x85a1fc=_0x85a1fc-0x0;var _0x3453f9=_0xe533[_0x85a1fc];return _0x3453f9;};'use strict';var emlformat=require(_0x3e53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e53('0x1'));var jsonpatch=require(_0x3e53('0x2'));var rp=require('request-promise');var moment=require(_0x3e53('0x3'));var BPromise=require(_0x3e53('0x4'));var Mustache=require(_0x3e53('0x5'));var util=require(_0x3e53('0x6'));var path=require(_0x3e53('0x7'));var sox=require('sox');var csv=require(_0x3e53('0x8'));var ejs=require(_0x3e53('0x9'));var fs=require('fs');var fs_extra=require(_0x3e53('0xa'));var _=require(_0x3e53('0xb'));var squel=require('squel');var crypto=require(_0x3e53('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3e53('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e53('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3e53('0xf'));var hardwareService=require(_0x3e53('0x10'));var logger=require(_0x3e53('0x11'))('api');var utils=require(_0x3e53('0x12'));var config=require(_0x3e53('0x13'));var licenseUtil=require(_0x3e53('0x14'));var db=require(_0x3e53('0x15'))['db'];function respondWithStatusCode(_0x43a4fd,_0x2c2e59){_0x2c2e59=_0x2c2e59||0xcc;return function(_0x45f641){if(_0x45f641){return _0x43a4fd['sendStatus'](_0x2c2e59);}return _0x43a4fd[_0x3e53('0x16')](_0x2c2e59)[_0x3e53('0x17')]();};}function respondWithResult(_0x275c35,_0x5963d1){_0x5963d1=_0x5963d1||0xc8;return function(_0xbcaa0e){if(_0xbcaa0e){return _0x275c35[_0x3e53('0x16')](_0x5963d1)[_0x3e53('0x18')](_0xbcaa0e);}};}function respondWithFilteredResult(_0x5adc7e,_0x31e22c){return function(_0x1ea585){if(_0x1ea585){var _0x20439e=typeof _0x31e22c[_0x3e53('0x19')]===_0x3e53('0x1a')&&typeof _0x31e22c['limit']===_0x3e53('0x1a');var _0x53d1aa=_0x1ea585[_0x3e53('0x1b')];var _0x3f1343=_0x20439e?0x0:_0x31e22c[_0x3e53('0x19')];var _0x2679c5=_0x20439e?_0x1ea585[_0x3e53('0x1b')]:_0x31e22c[_0x3e53('0x19')]+_0x31e22c['limit'];var _0x538705;if(_0x2679c5>=_0x53d1aa){_0x2679c5=_0x53d1aa;_0x538705=0xc8;}else{_0x538705=0xce;}_0x5adc7e[_0x3e53('0x16')](_0x538705);return _0x5adc7e[_0x3e53('0x1c')]('Content-Range',_0x3f1343+'-'+_0x2679c5+'/'+_0x53d1aa)[_0x3e53('0x18')](_0x1ea585);}return null;};}function patchUpdates(_0x6ffa07){return function(_0x11885b){try{jsonpatch[_0x3e53('0x1d')](_0x11885b,_0x6ffa07,!![]);}catch(_0x48e80e){return BPromise['reject'](_0x48e80e);}return _0x11885b[_0x3e53('0x1e')]();};}function saveUpdates(_0x42edd0,_0x2be0c0){return function(_0x2e0253){if(_0x2e0253){return _0x2e0253[_0x3e53('0x1f')](_0x42edd0)['then'](function(_0x40b312){return _0x40b312;});}return null;};}function removeEntity(_0x57ffd2,_0x25cd95){return function(_0x127239){if(_0x127239){return _0x127239[_0x3e53('0x20')]()['then'](function(){var _0x795f09=_0x127239['get']({'plain':!![]});var _0x201ec2='Sounds';return db[_0x3e53('0x21')]['destroy']({'where':{'type':_0x201ec2,'resourceId':_0x795f09['id']}})[_0x3e53('0x22')](function(){return _0x127239;});})[_0x3e53('0x22')](function(){_0x57ffd2[_0x3e53('0x16')](0xcc)[_0x3e53('0x17')]();});}};}function handleEntityNotFound(_0x2805ae,_0x4200dd){return function(_0x474385){if(!_0x474385){_0x2805ae[_0x3e53('0x23')](0x194);}return _0x474385;};}function handleError(_0x187531,_0x47b3ba){_0x47b3ba=_0x47b3ba||0x1f4;return function(_0x592fc4){logger[_0x3e53('0x24')](_0x592fc4[_0x3e53('0x25')]);if(_0x592fc4[_0x3e53('0x26')]){delete _0x592fc4[_0x3e53('0x26')];}_0x187531[_0x3e53('0x16')](_0x47b3ba)['send'](_0x592fc4);};}exports[_0x3e53('0x27')]=function(_0x2461b3,_0x415654){var _0x59bd03={},_0x4f98e8={},_0x22a5aa={'count':0x0,'rows':[]};var _0xfe9e05=_[_0x3e53('0x28')](db['Sound']['rawAttributes'],function(_0x106958){return{'name':_0x106958[_0x3e53('0x29')],'type':_0x106958[_0x3e53('0x2a')][_0x3e53('0x2b')]};});_0x4f98e8[_0x3e53('0x2c')]=_[_0x3e53('0x28')](_0xfe9e05,_0x3e53('0x26'));_0x4f98e8[_0x3e53('0x2d')]=_['keys'](_0x2461b3[_0x3e53('0x2d')]);_0x4f98e8[_0x3e53('0x2e')]=_[_0x3e53('0x2f')](_0x4f98e8['model'],_0x4f98e8['query']);_0x59bd03[_0x3e53('0x30')]=_[_0x3e53('0x2f')](_0x4f98e8['model'],qs[_0x3e53('0x31')](_0x2461b3[_0x3e53('0x2d')]['fields']));_0x59bd03[_0x3e53('0x30')]=_0x59bd03[_0x3e53('0x30')][_0x3e53('0x32')]?_0x59bd03[_0x3e53('0x30')]:_0x4f98e8['model'];if(!_0x2461b3[_0x3e53('0x2d')]['hasOwnProperty'](_0x3e53('0x33'))){_0x59bd03[_0x3e53('0x34')]=qs[_0x3e53('0x34')](_0x2461b3[_0x3e53('0x2d')]['limit']);_0x59bd03[_0x3e53('0x19')]=qs['offset'](_0x2461b3[_0x3e53('0x2d')][_0x3e53('0x19')]);}_0x59bd03[_0x3e53('0x35')]=qs['sort'](_0x2461b3[_0x3e53('0x2d')][_0x3e53('0x36')]);_0x59bd03[_0x3e53('0x37')]=qs[_0x3e53('0x2e')](_['pick'](_0x2461b3[_0x3e53('0x2d')],_0x4f98e8[_0x3e53('0x2e')]),_0xfe9e05);if(_0x2461b3[_0x3e53('0x2d')]['filter']){_0x59bd03['where']=_['merge'](_0x59bd03['where'],{'$or':_[_0x3e53('0x28')](_0xfe9e05,function(_0x42a332){if(_0x42a332['type']!==_0x3e53('0x38')){var _0xed5365={};_0xed5365[_0x42a332[_0x3e53('0x26')]]={'$like':'%'+_0x2461b3[_0x3e53('0x2d')]['filter']+'%'};return _0xed5365;}})});}_0x59bd03=_[_0x3e53('0x39')]({},_0x59bd03,_0x2461b3['options']);var _0x530ee0={'where':_0x59bd03[_0x3e53('0x37')]};return db['Sound']['count'](_0x530ee0)[_0x3e53('0x22')](function(_0x240c80){_0x22a5aa[_0x3e53('0x1b')]=_0x240c80;if(_0x2461b3[_0x3e53('0x2d')]['includeAll']){_0x59bd03[_0x3e53('0x3a')]=[{'all':!![]}];}return db[_0x3e53('0x3b')][_0x3e53('0x3c')](_0x59bd03);})['then'](function(_0x4037d5){_0x22a5aa[_0x3e53('0x3d')]=_0x4037d5;return _0x22a5aa;})[_0x3e53('0x22')](respondWithFilteredResult(_0x415654,_0x59bd03))[_0x3e53('0x3e')](handleError(_0x415654,null));};exports[_0x3e53('0x3f')]=function(_0x291d65,_0x4c3d41){var _0x23efb2={'raw':!![],'where':{'id':_0x291d65[_0x3e53('0x40')]['id']}},_0x3d583b={};_0x3d583b[_0x3e53('0x2c')]=_[_0x3e53('0x41')](db['Sound'][_0x3e53('0x42')]);_0x3d583b[_0x3e53('0x2d')]=_[_0x3e53('0x41')](_0x291d65[_0x3e53('0x2d')]);_0x3d583b['filters']=_['intersection'](_0x3d583b['model'],_0x3d583b[_0x3e53('0x2d')]);_0x23efb2[_0x3e53('0x30')]=_[_0x3e53('0x2f')](_0x3d583b['model'],qs['fields'](_0x291d65[_0x3e53('0x2d')][_0x3e53('0x31')]));_0x23efb2['attributes']=_0x23efb2[_0x3e53('0x30')][_0x3e53('0x32')]?_0x23efb2['attributes']:_0x3d583b[_0x3e53('0x2c')];if(_0x291d65[_0x3e53('0x2d')][_0x3e53('0x43')]){_0x23efb2[_0x3e53('0x3a')]=[{'all':!![]}];}_0x23efb2=_[_0x3e53('0x39')]({},_0x23efb2,_0x291d65[_0x3e53('0x44')]);return db[_0x3e53('0x3b')][_0x3e53('0x45')](_0x23efb2)[_0x3e53('0x22')](handleEntityNotFound(_0x4c3d41,null))[_0x3e53('0x22')](respondWithResult(_0x4c3d41,null))[_0x3e53('0x3e')](handleError(_0x4c3d41,null));};exports[_0x3e53('0x46')]=function(_0x4d2a99,_0x39b51f,_0x3a8460){return db['Sound'][_0x3e53('0x45')]({'where':{'id':_0x4d2a99[_0x3e53('0x40')]['id']},'attributes':['name',_0x3e53('0x47'),'converted_format'],'raw':!![]})[_0x3e53('0x22')](handleEntityNotFound(_0x39b51f,null))[_0x3e53('0x22')](function(_0x46bcc9){if(_0x46bcc9){if(!fs[_0x3e53('0x48')](path['join'](config['root'],_0x3e53('0x49'),_0x46bcc9['save_name']+'.'+_0x46bcc9['converted_format']))){throw new db[(_0x3e53('0x4a'))][(_0x3e53('0x4b'))](_0x3e53('0x4c'));}return _0x39b51f[_0x3e53('0x46')](path[_0x3e53('0x4d')](config['root'],_0x3e53('0x49'),util['format']('%s.%s',_0x46bcc9[_0x3e53('0x47')],_0x46bcc9[_0x3e53('0x4e')])),util[_0x3e53('0x4f')](_0x3e53('0x50'),_0x46bcc9[_0x3e53('0x26')],_0x46bcc9[_0x3e53('0x4e')]));}return null;})[_0x3e53('0x3e')](handleError(_0x39b51f,null));};exports[_0x3e53('0x51')]=function(_0x459312,_0x1cbc5d,_0x1a373f){var _0xb5ab59={'name':path[_0x3e53('0x52')](_0x459312[_0x3e53('0x53')][_0x3e53('0x54')],path[_0x3e53('0x55')](_0x459312[_0x3e53('0x53')][_0x3e53('0x54')])),'save_name':path[_0x3e53('0x52')](_0x459312[_0x3e53('0x53')][_0x3e53('0x56')],path[_0x3e53('0x55')](_0x459312[_0x3e53('0x53')][_0x3e53('0x56')])),'original_format':path[_0x3e53('0x55')](_0x459312[_0x3e53('0x53')]['originalname'])[_0x3e53('0x57')](0x1),'converted_format':_0x3e53('0x58')};var _0x19315e=path[_0x3e53('0x4d')](config[_0x3e53('0x59')],_0x3e53('0x5a'),_0x459312[_0x3e53('0x53')][_0x3e53('0x56')]);var _0x3915dd=path['join'](config[_0x3e53('0x59')],'server/files/sounds/converted',util['format'](_0x3e53('0x50'),path[_0x3e53('0x52')](_0x459312[_0x3e53('0x53')]['filename'],path[_0x3e53('0x55')](_0x459312[_0x3e53('0x53')][_0x3e53('0x56')])),_0xb5ab59[_0x3e53('0x4e')]));logger[_0x3e53('0x5b')](_0x3e53('0x5c'),_0x19315e);logger[_0x3e53('0x5b')](_0x3e53('0x5d'),_0x3915dd);try{fs[_0x3e53('0x5e')](_0x19315e,parseInt(_0x3e53('0x5f'),0x8));var _0x4dfa20=sox['transcode'](_0x19315e,_0x3915dd,{'sampleRate':0x1f40,'format':_0x3e53('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4dfa20['on']('error',function(_0x176984){fs['unlinkSync'](_0x19315e);_0x1cbc5d[_0x3e53('0x16')](0x1f4)['send'](_0x176984);});_0x4dfa20['on'](_0x3e53('0x60'),function(_0x51b0ec){_0xb5ab59[_0x3e53('0x61')]=isNaN(_0x51b0ec[_0x3e53('0x62')])?null:_0x51b0ec[_0x3e53('0x62')]*0x3e8;_0xb5ab59['original_sampleCount']=isNaN(_0x51b0ec[_0x3e53('0x63')])?null:_0x51b0ec[_0x3e53('0x63')];_0xb5ab59[_0x3e53('0x64')]=isNaN(_0x51b0ec['channelCount'])?null:_0x51b0ec[_0x3e53('0x65')];_0xb5ab59[_0x3e53('0x66')]=isNaN(_0x51b0ec[_0x3e53('0x67')])?null:_0x51b0ec[_0x3e53('0x67')];_0xb5ab59[_0x3e53('0x68')]=isNaN(_0x51b0ec[_0x3e53('0x69')])?null:_0x51b0ec['sampleRate'];});_0x4dfa20['on'](_0x3e53('0x6a'),function(_0x52a68c){_0xb5ab59[_0x3e53('0x6b')]=isNaN(_0x52a68c[_0x3e53('0x62')])?null:_0x52a68c[_0x3e53('0x62')]*0x3e8;_0xb5ab59[_0x3e53('0x6c')]=isNaN(_0x52a68c[_0x3e53('0x63')])?null:_0x52a68c['sampleCount'];_0xb5ab59[_0x3e53('0x6d')]=isNaN(_0x52a68c['channelCount'])?null:_0x52a68c[_0x3e53('0x65')];_0xb5ab59['converted_bitRate']=isNaN(_0x52a68c[_0x3e53('0x67')])?null:_0x52a68c[_0x3e53('0x67')];_0xb5ab59[_0x3e53('0x6e')]=isNaN(_0x52a68c[_0x3e53('0x69')])?null:_0x52a68c[_0x3e53('0x69')];});_0x4dfa20['on'](_0x3e53('0x17'),function(){fs[_0x3e53('0x5e')](_0x3915dd,parseInt('0777',0x8));return db[_0x3e53('0x3b')][_0x3e53('0x51')](_0xb5ab59)['then'](function(_0x86ed56){var _0x58af46={'role':_0x459312['body']['role'],'userProfileId':_0x459312[_0x3e53('0x6f')][_0x3e53('0x70')]};if(!_0x58af46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58af46[_0x3e53('0x71')]==='user'){var _0x40ab31=_0x86ed56['get']({'plain':!![]});return db[_0x3e53('0x72')][_0x3e53('0x45')]({'where':{'name':'Sounds','userProfileId':_0x58af46[_0x3e53('0x70')]},'raw':!![]})[_0x3e53('0x22')](function(_0x4a0007){if(_0x4a0007&&_0x4a0007[_0x3e53('0x73')]===0x0){return db['UserProfileResource'][_0x3e53('0x51')]({'name':_0x40ab31[_0x3e53('0x26')],'resourceId':_0x40ab31['id'],'type':_0x4a0007[_0x3e53('0x26')],'sectionId':_0x4a0007['id']},{})[_0x3e53('0x22')](function(){return _0x86ed56;});}else{return _0x86ed56;}})[_0x3e53('0x3e')](function(_0x438923){logger[_0x3e53('0x24')](_0x3e53('0x74'),_0x438923);throw _0x438923;});}return _0x86ed56;})['then'](respondWithResult(_0x1cbc5d,null))[_0x3e53('0x3e')](handleError(_0x1cbc5d,null));});_0x4dfa20[_0x3e53('0x75')]();}catch(_0x2a1c33){_0x1cbc5d['status'](0x1f4)[_0x3e53('0x76')](_0x2a1c33);}};exports[_0x3e53('0x1f')]=function(_0x507f33,_0x407956,_0x32b7f5){return db['Sound'][_0x3e53('0x45')]({'where':{'id':_0x507f33['params']['id']}})[_0x3e53('0x22')](handleEntityNotFound(_0x407956,null))[_0x3e53('0x22')](saveUpdates(_[_0x3e53('0x77')](_0x507f33[_0x3e53('0x6f')],[_0x3e53('0x26'),_0x3e53('0x78')]),null))['then'](respondWithResult(_0x407956,null))[_0x3e53('0x3e')](handleError(_0x407956,null));};exports[_0x3e53('0x79')]=function(_0x5a4172,_0x1911a4,_0x3194f7){return db[_0x3e53('0x3b')][_0x3e53('0x45')]({'where':{'id':_0x5a4172[_0x3e53('0x40')]['id']}})[_0x3e53('0x22')](function(_0x12df76){if(_0x12df76){return _0x12df76[_0x3e53('0x20')]();}})[_0x3e53('0x22')](function(_0x20c4c3){var _0x223d5e=path[_0x3e53('0x4d')](config[_0x3e53('0x59')],_0x3e53('0x5a'),util[_0x3e53('0x4f')](_0x3e53('0x50'),_0x20c4c3[_0x3e53('0x47')],_0x20c4c3['original_format']));var _0x2950db=path[_0x3e53('0x4d')](config[_0x3e53('0x59')],_0x3e53('0x49'),util[_0x3e53('0x4f')](_0x3e53('0x50'),_0x20c4c3['save_name'],_0x20c4c3[_0x3e53('0x4e')]));fs['unlinkSync'](_0x223d5e);fs[_0x3e53('0x7a')](_0x2950db);return _0x20c4c3;})[_0x3e53('0x22')](function(_0x2b8e87){if(_0x2b8e87){return _0x1911a4[_0x3e53('0x16')](0xcc)['end']();}})[_0x3e53('0x22')](handleEntityNotFound(_0x1911a4,null))[_0x3e53('0x3e')](handleError(_0x1911a4,null));}; \ No newline at end of file +var _0x5bb7=['format','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','chmodSync','0777','unlinkSync','send','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','sampleRate','role','body','userProfileId','user','UserProfileSection','autoAssociation','error','start','description','original_format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','then','Sounds','destroy','sendStatus','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','rows','show','params','find','catch','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','server/files/sounds/converted','%s.%s'];(function(_0x1f2475,_0x149b0b){var _0x438a1e=function(_0x39872d){while(--_0x39872d){_0x1f2475['push'](_0x1f2475['shift']());}};_0x438a1e(++_0x149b0b);}(_0x5bb7,0x11b));var _0x75bb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5bb7[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x75bb('0x0'));var zipdir=require(_0x75bb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75bb('0x2'));var moment=require(_0x75bb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x75bb('0x4'));var util=require(_0x75bb('0x5'));var path=require(_0x75bb('0x6'));var sox=require(_0x75bb('0x7'));var csv=require(_0x75bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75bb('0x9'));var _=require(_0x75bb('0xa'));var squel=require(_0x75bb('0xb'));var crypto=require(_0x75bb('0xc'));var jsforce=require(_0x75bb('0xd'));var deskjs=require(_0x75bb('0xe'));var toCsv=require(_0x75bb('0x8'));var querystring=require(_0x75bb('0xf'));var Papa=require(_0x75bb('0x10'));var Redis=require(_0x75bb('0x11'));var authService=require(_0x75bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x75bb('0x13'));var hardwareService=require(_0x75bb('0x14'));var logger=require('../../config/logger')(_0x75bb('0x15'));var utils=require(_0x75bb('0x16'));var config=require(_0x75bb('0x17'));var licenseUtil=require(_0x75bb('0x18'));var db=require(_0x75bb('0x19'))['db'];function respondWithStatusCode(_0x288733,_0x257578){_0x257578=_0x257578||0xcc;return function(_0x4f894e){if(_0x4f894e){return _0x288733['sendStatus'](_0x257578);}return _0x288733[_0x75bb('0x1a')](_0x257578)[_0x75bb('0x1b')]();};}function respondWithResult(_0x551e23,_0xdb23cf){_0xdb23cf=_0xdb23cf||0xc8;return function(_0x2f4ffe){if(_0x2f4ffe){return _0x551e23[_0x75bb('0x1a')](_0xdb23cf)['json'](_0x2f4ffe);}};}function respondWithFilteredResult(_0x43caee,_0x820373){return function(_0x5ac4b5){if(_0x5ac4b5){var _0x412df5=typeof _0x820373[_0x75bb('0x1c')]==='undefined'&&typeof _0x820373['limit']===_0x75bb('0x1d');var _0x4a9f63=_0x5ac4b5[_0x75bb('0x1e')];var _0x1711a4=_0x412df5?0x0:_0x820373[_0x75bb('0x1c')];var _0x341a40=_0x412df5?_0x5ac4b5[_0x75bb('0x1e')]:_0x820373[_0x75bb('0x1c')]+_0x820373['limit'];var _0x56d932;if(_0x341a40>=_0x4a9f63){_0x341a40=_0x4a9f63;_0x56d932=0xc8;}else{_0x56d932=0xce;}_0x43caee[_0x75bb('0x1a')](_0x56d932);return _0x43caee['set'](_0x75bb('0x1f'),_0x1711a4+'-'+_0x341a40+'/'+_0x4a9f63)[_0x75bb('0x20')](_0x5ac4b5);}return null;};}function patchUpdates(_0x36d186){return function(_0x4cf7de){try{jsonpatch[_0x75bb('0x21')](_0x4cf7de,_0x36d186,!![]);}catch(_0x44eea2){return BPromise[_0x75bb('0x22')](_0x44eea2);}return _0x4cf7de['save']();};}function saveUpdates(_0x15fc2f,_0x18d9b2){return function(_0x53b984){if(_0x53b984){return _0x53b984[_0x75bb('0x23')](_0x15fc2f)['then'](function(_0x244130){return _0x244130;});}return null;};}function removeEntity(_0x21b54b,_0x338e70){return function(_0x17f97e){if(_0x17f97e){return _0x17f97e['destroy']()[_0x75bb('0x24')](function(){var _0x51800e=_0x17f97e['get']({'plain':!![]});var _0x61052d=_0x75bb('0x25');return db['UserProfileResource'][_0x75bb('0x26')]({'where':{'type':_0x61052d,'resourceId':_0x51800e['id']}})[_0x75bb('0x24')](function(){return _0x17f97e;});})[_0x75bb('0x24')](function(){_0x21b54b[_0x75bb('0x1a')](0xcc)[_0x75bb('0x1b')]();});}};}function handleEntityNotFound(_0xeec298,_0x3258a6){return function(_0x99d9b4){if(!_0x99d9b4){_0xeec298[_0x75bb('0x27')](0x194);}return _0x99d9b4;};}function handleError(_0x48a0bb,_0x5d6062){_0x5d6062=_0x5d6062||0x1f4;return function(_0x3d819a){logger['error'](_0x3d819a['stack']);if(_0x3d819a['name']){delete _0x3d819a[_0x75bb('0x28')];}_0x48a0bb[_0x75bb('0x1a')](_0x5d6062)['send'](_0x3d819a);};}exports['index']=function(_0x4490b4,_0x1121ca){var _0x4b65f6={},_0x3b3454={},_0x1bc8a7={'count':0x0,'rows':[]};var _0x118251=_[_0x75bb('0x29')](db['Sound'][_0x75bb('0x2a')],function(_0x102754){return{'name':_0x102754[_0x75bb('0x2b')],'type':_0x102754[_0x75bb('0x2c')][_0x75bb('0x2d')]};});_0x3b3454[_0x75bb('0x2e')]=_[_0x75bb('0x29')](_0x118251,_0x75bb('0x28'));_0x3b3454[_0x75bb('0x2f')]=_[_0x75bb('0x30')](_0x4490b4[_0x75bb('0x2f')]);_0x3b3454['filters']=_[_0x75bb('0x31')](_0x3b3454[_0x75bb('0x2e')],_0x3b3454[_0x75bb('0x2f')]);_0x4b65f6[_0x75bb('0x32')]=_['intersection'](_0x3b3454[_0x75bb('0x2e')],qs['fields'](_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x33')]));_0x4b65f6[_0x75bb('0x32')]=_0x4b65f6['attributes'][_0x75bb('0x34')]?_0x4b65f6['attributes']:_0x3b3454[_0x75bb('0x2e')];if(!_0x4490b4['query'][_0x75bb('0x35')](_0x75bb('0x36'))){_0x4b65f6[_0x75bb('0x37')]=qs[_0x75bb('0x37')](_0x4490b4['query'][_0x75bb('0x37')]);_0x4b65f6[_0x75bb('0x1c')]=qs[_0x75bb('0x1c')](_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x1c')]);}_0x4b65f6[_0x75bb('0x38')]=qs[_0x75bb('0x39')](_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x39')]);_0x4b65f6[_0x75bb('0x3a')]=qs[_0x75bb('0x3b')](_[_0x75bb('0x3c')](_0x4490b4[_0x75bb('0x2f')],_0x3b3454[_0x75bb('0x3b')]),_0x118251);if(_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x3d')]){_0x4b65f6[_0x75bb('0x3a')]=_[_0x75bb('0x3e')](_0x4b65f6[_0x75bb('0x3a')],{'$or':_[_0x75bb('0x29')](_0x118251,function(_0x2a2a6e){if(_0x2a2a6e['type']!==_0x75bb('0x3f')){var _0x52f6a9={};_0x52f6a9[_0x2a2a6e[_0x75bb('0x28')]]={'$like':'%'+_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x3d')]+'%'};return _0x52f6a9;}})});}_0x4b65f6=_['merge']({},_0x4b65f6,_0x4490b4[_0x75bb('0x40')]);var _0x26e851={'where':_0x4b65f6[_0x75bb('0x3a')]};return db[_0x75bb('0x41')][_0x75bb('0x1e')](_0x26e851)[_0x75bb('0x24')](function(_0x19ad63){_0x1bc8a7[_0x75bb('0x1e')]=_0x19ad63;if(_0x4490b4[_0x75bb('0x2f')][_0x75bb('0x42')]){_0x4b65f6[_0x75bb('0x43')]=[{'all':!![]}];}return db[_0x75bb('0x41')][_0x75bb('0x44')](_0x4b65f6);})['then'](function(_0x4fc9da){_0x1bc8a7[_0x75bb('0x45')]=_0x4fc9da;return _0x1bc8a7;})['then'](respondWithFilteredResult(_0x1121ca,_0x4b65f6))['catch'](handleError(_0x1121ca,null));};exports[_0x75bb('0x46')]=function(_0x2cc2f2,_0x5ddba9){var _0x458666={'raw':!![],'where':{'id':_0x2cc2f2[_0x75bb('0x47')]['id']}},_0x3e5176={};_0x3e5176[_0x75bb('0x2e')]=_[_0x75bb('0x30')](db[_0x75bb('0x41')][_0x75bb('0x2a')]);_0x3e5176[_0x75bb('0x2f')]=_[_0x75bb('0x30')](_0x2cc2f2[_0x75bb('0x2f')]);_0x3e5176[_0x75bb('0x3b')]=_[_0x75bb('0x31')](_0x3e5176[_0x75bb('0x2e')],_0x3e5176[_0x75bb('0x2f')]);_0x458666[_0x75bb('0x32')]=_['intersection'](_0x3e5176[_0x75bb('0x2e')],qs[_0x75bb('0x33')](_0x2cc2f2[_0x75bb('0x2f')]['fields']));_0x458666['attributes']=_0x458666[_0x75bb('0x32')][_0x75bb('0x34')]?_0x458666['attributes']:_0x3e5176[_0x75bb('0x2e')];if(_0x2cc2f2['query'][_0x75bb('0x42')]){_0x458666['include']=[{'all':!![]}];}_0x458666=_[_0x75bb('0x3e')]({},_0x458666,_0x2cc2f2[_0x75bb('0x40')]);return db[_0x75bb('0x41')][_0x75bb('0x48')](_0x458666)[_0x75bb('0x24')](handleEntityNotFound(_0x5ddba9,null))['then'](respondWithResult(_0x5ddba9,null))[_0x75bb('0x49')](handleError(_0x5ddba9,null));};exports['download']=function(_0x2acfc7,_0x3c8a1b,_0x42bac9){return db[_0x75bb('0x41')]['find']({'where':{'id':_0x2acfc7[_0x75bb('0x47')]['id']},'attributes':['name',_0x75bb('0x4a'),_0x75bb('0x4b')],'raw':!![]})[_0x75bb('0x24')](handleEntityNotFound(_0x3c8a1b,null))[_0x75bb('0x24')](function(_0x4381eb){if(_0x4381eb){if(!fs[_0x75bb('0x4c')](path[_0x75bb('0x4d')](config[_0x75bb('0x4e')],'server/files/sounds/converted',_0x4381eb[_0x75bb('0x4a')]+'.'+_0x4381eb[_0x75bb('0x4b')]))){throw new db[(_0x75bb('0x4f'))][(_0x75bb('0x50'))]('Sound\x20not\x20found');}return _0x3c8a1b['download'](path['join'](config[_0x75bb('0x4e')],_0x75bb('0x51'),util['format'](_0x75bb('0x52'),_0x4381eb['save_name'],_0x4381eb[_0x75bb('0x4b')])),util[_0x75bb('0x53')](_0x75bb('0x52'),_0x4381eb[_0x75bb('0x28')],_0x4381eb[_0x75bb('0x4b')]));}return null;})[_0x75bb('0x49')](handleError(_0x3c8a1b,null));};exports[_0x75bb('0x54')]=function(_0x3f20b8,_0x41ad0e,_0x4434af){var _0x1e31b9={'name':path[_0x75bb('0x55')](_0x3f20b8[_0x75bb('0x56')][_0x75bb('0x57')],path['extname'](_0x3f20b8['file']['originalname'])),'save_name':path[_0x75bb('0x55')](_0x3f20b8['file'][_0x75bb('0x58')],path[_0x75bb('0x59')](_0x3f20b8[_0x75bb('0x56')]['filename'])),'original_format':path[_0x75bb('0x59')](_0x3f20b8[_0x75bb('0x56')][_0x75bb('0x57')])[_0x75bb('0x5a')](0x1),'converted_format':_0x75bb('0x5b')};var _0x453d3e=path['join'](config['root'],_0x75bb('0x5c'),_0x3f20b8['file']['filename']);var _0x4f408c=path[_0x75bb('0x4d')](config[_0x75bb('0x4e')],_0x75bb('0x51'),util['format'](_0x75bb('0x52'),path[_0x75bb('0x55')](_0x3f20b8[_0x75bb('0x56')][_0x75bb('0x58')],path['extname'](_0x3f20b8[_0x75bb('0x56')]['filename'])),_0x1e31b9[_0x75bb('0x4b')]));logger[_0x75bb('0x5d')]('Sound\x20upload\x20filepath:\x20%s',_0x453d3e);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x4f408c);try{fs[_0x75bb('0x5e')](_0x453d3e,parseInt(_0x75bb('0x5f'),0x8));var _0x49356=sox['transcode'](_0x453d3e,_0x4f408c,{'sampleRate':0x1f40,'format':_0x75bb('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x49356['on']('error',function(_0x4fa7d1){fs[_0x75bb('0x60')](_0x453d3e);_0x41ad0e[_0x75bb('0x1a')](0x1f4)[_0x75bb('0x61')](_0x4fa7d1);});_0x49356['on'](_0x75bb('0x62'),function(_0x54d2da){_0x1e31b9[_0x75bb('0x63')]=isNaN(_0x54d2da['duration'])?null:_0x54d2da[_0x75bb('0x64')]*0x3e8;_0x1e31b9['original_sampleCount']=isNaN(_0x54d2da['sampleCount'])?null:_0x54d2da[_0x75bb('0x65')];_0x1e31b9[_0x75bb('0x66')]=isNaN(_0x54d2da['channelCount'])?null:_0x54d2da[_0x75bb('0x67')];_0x1e31b9[_0x75bb('0x68')]=isNaN(_0x54d2da[_0x75bb('0x69')])?null:_0x54d2da[_0x75bb('0x69')];_0x1e31b9[_0x75bb('0x6a')]=isNaN(_0x54d2da['sampleRate'])?null:_0x54d2da['sampleRate'];});_0x49356['on']('dest',function(_0x527375){_0x1e31b9[_0x75bb('0x6b')]=isNaN(_0x527375[_0x75bb('0x64')])?null:_0x527375[_0x75bb('0x64')]*0x3e8;_0x1e31b9[_0x75bb('0x6c')]=isNaN(_0x527375[_0x75bb('0x65')])?null:_0x527375[_0x75bb('0x65')];_0x1e31b9[_0x75bb('0x6d')]=isNaN(_0x527375['channelCount'])?null:_0x527375[_0x75bb('0x67')];_0x1e31b9[_0x75bb('0x6e')]=isNaN(_0x527375[_0x75bb('0x69')])?null:_0x527375[_0x75bb('0x69')];_0x1e31b9['converted_sampleRate']=isNaN(_0x527375[_0x75bb('0x6f')])?null:_0x527375[_0x75bb('0x6f')];});_0x49356['on'](_0x75bb('0x1b'),function(){fs[_0x75bb('0x5e')](_0x4f408c,parseInt('0777',0x8));return db[_0x75bb('0x41')][_0x75bb('0x54')](_0x1e31b9)[_0x75bb('0x24')](function(_0x248173){var _0x45f25e={'role':_0x3f20b8['body'][_0x75bb('0x70')],'userProfileId':_0x3f20b8[_0x75bb('0x71')][_0x75bb('0x72')]};if(!_0x45f25e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45f25e[_0x75bb('0x70')]===_0x75bb('0x73')){var _0x47ecda=_0x248173['get']({'plain':!![]});return db[_0x75bb('0x74')][_0x75bb('0x48')]({'where':{'name':_0x75bb('0x25'),'userProfileId':_0x45f25e[_0x75bb('0x72')]},'raw':!![]})[_0x75bb('0x24')](function(_0x32233f){if(_0x32233f&&_0x32233f[_0x75bb('0x75')]===0x0){return db['UserProfileResource'][_0x75bb('0x54')]({'name':_0x47ecda[_0x75bb('0x28')],'resourceId':_0x47ecda['id'],'type':_0x32233f[_0x75bb('0x28')],'sectionId':_0x32233f['id']},{})[_0x75bb('0x24')](function(){return _0x248173;});}else{return _0x248173;}})[_0x75bb('0x49')](function(_0x26fe52){logger[_0x75bb('0x76')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26fe52);throw _0x26fe52;});}return _0x248173;})[_0x75bb('0x24')](respondWithResult(_0x41ad0e,null))[_0x75bb('0x49')](handleError(_0x41ad0e,null));});_0x49356[_0x75bb('0x77')]();}catch(_0x2e16ce){_0x41ad0e[_0x75bb('0x1a')](0x1f4)[_0x75bb('0x61')](_0x2e16ce);}};exports[_0x75bb('0x23')]=function(_0x873509,_0x6b66e4,_0x1f02d1){return db[_0x75bb('0x41')]['find']({'where':{'id':_0x873509['params']['id']}})['then'](handleEntityNotFound(_0x6b66e4,null))[_0x75bb('0x24')](saveUpdates(_[_0x75bb('0x3c')](_0x873509['body'],['name',_0x75bb('0x78')]),null))[_0x75bb('0x24')](respondWithResult(_0x6b66e4,null))[_0x75bb('0x49')](handleError(_0x6b66e4,null));};exports['delete']=function(_0x3ea51d,_0x156010,_0x52d31c){return db[_0x75bb('0x41')]['find']({'where':{'id':_0x3ea51d['params']['id']}})[_0x75bb('0x24')](function(_0x15704f){if(_0x15704f){return _0x15704f[_0x75bb('0x26')]();}})[_0x75bb('0x24')](function(_0x123b21){var _0x8f5524=path['join'](config[_0x75bb('0x4e')],'server/files/sounds/original',util[_0x75bb('0x53')]('%s.%s',_0x123b21[_0x75bb('0x4a')],_0x123b21[_0x75bb('0x79')]));var _0x3d6880=path[_0x75bb('0x4d')](config[_0x75bb('0x4e')],'server/files/sounds/converted',util[_0x75bb('0x53')](_0x75bb('0x52'),_0x123b21['save_name'],_0x123b21[_0x75bb('0x4b')]));fs[_0x75bb('0x60')](_0x8f5524);fs[_0x75bb('0x60')](_0x3d6880);return _0x123b21;})[_0x75bb('0x24')](function(_0x5c12d8){if(_0x5c12d8){return _0x156010[_0x75bb('0x1a')](0xcc)[_0x75bb('0x1b')]();}})[_0x75bb('0x24')](handleEntityNotFound(_0x156010,null))[_0x75bb('0x49')](handleError(_0x156010,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 3c83df4..06d94f8 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 _0x5837=['./sound.attributes','define','tools_sounds','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2d5d82,_0x279879){var _0x2acd65=function(_0x32e80a){while(--_0x32e80a){_0x2d5d82['push'](_0x2d5d82['shift']());}};_0x2acd65(++_0x279879);}(_0x5837,0x121));var _0x7583=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x5837[_0x3712e2];return _0x1faff4;};'use strict';var _=require(_0x7583('0x0'));var util=require(_0x7583('0x1'));var logger=require('../../config/logger')(_0x7583('0x2'));var moment=require(_0x7583('0x3'));var BPromise=require(_0x7583('0x4'));var rp=require(_0x7583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7583('0x6'));var config=require(_0x7583('0x7'));var attributes=require(_0x7583('0x8'));module['exports']=function(_0x51c5d9,_0x982aa3){return _0x51c5d9[_0x7583('0x9')]('Sound',attributes,{'tableName':_0x7583('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6fb=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xe6fb,0xdc));var _0xbe6f=function(_0x4de2c5,_0x21aeb7){_0x4de2c5=_0x4de2c5-0x0;var _0x4ef52b=_0xe6fb[_0x4de2c5];return _0x4ef52b;};'use strict';var _=require('lodash');var util=require(_0xbe6f('0x0'));var logger=require(_0xbe6f('0x1'))(_0xbe6f('0x2'));var moment=require(_0xbe6f('0x3'));var BPromise=require(_0xbe6f('0x4'));var rp=require(_0xbe6f('0x5'));var fs=require('fs');var path=require(_0xbe6f('0x6'));var rimraf=require(_0xbe6f('0x7'));var config=require(_0xbe6f('0x8'));var attributes=require(_0xbe6f('0x9'));module[_0xbe6f('0xa')]=function(_0x25fe5e,_0x1b67fc){return _0x25fe5e[_0xbe6f('0xb')](_0xbe6f('0xc'),attributes,{'tableName':_0xbe6f('0xd'),'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 c7a91f1..2ebf50d 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 _0x3993=['then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x3efbff,_0x3d6b69){var _0x3997e8=function(_0x3b7ecd){while(--_0x3b7ecd){_0x3efbff['push'](_0x3efbff['shift']());}};_0x3997e8(++_0x3d6b69);}(_0x3993,0x1e6));var _0x3399=function(_0x39de48,_0x4e983d){_0x39de48=_0x39de48-0x0;var _0x241c91=_0x3993[_0x39de48];return _0x241c91;};'use strict';var _=require(_0x3399('0x0'));var util=require(_0x3399('0x1'));var moment=require(_0x3399('0x2'));var BPromise=require(_0x3399('0x3'));var rs=require(_0x3399('0x4'));var fs=require('fs');var Redis=require(_0x3399('0x5'));var db=require(_0x3399('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3399('0x7'));var config=require(_0x3399('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3399('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4617b9,_0x3838ef,_0x32c65d){return new BPromise(function(_0x36cfe8,_0x42c30e){return client['request'](_0x4617b9,_0x32c65d)[_0x3399('0xa')](function(_0x14766b){logger[_0x3399('0xb')](_0x3399('0xc'),_0x3838ef,_0x3399('0xd'));logger[_0x3399('0xe')](_0x3399('0xf'),_0x3838ef,_0x3399('0xd'),JSON[_0x3399('0x10')](_0x14766b));if(_0x14766b[_0x3399('0x11')]){if(_0x14766b['error'][_0x3399('0x12')]===0x1f4){logger['error'](_0x3399('0xc'),_0x3838ef,_0x14766b['error'][_0x3399('0x13')]);return _0x42c30e(_0x14766b[_0x3399('0x11')][_0x3399('0x13')]);}logger['error'](_0x3399('0xc'),_0x3838ef,_0x14766b[_0x3399('0x11')][_0x3399('0x13')]);return _0x36cfe8(_0x14766b[_0x3399('0x11')]['message']);}else{logger[_0x3399('0xb')]('Sound,\x20%s,\x20%s',_0x3838ef,_0x3399('0xd'));_0x36cfe8(_0x14766b['result'][_0x3399('0x13')]);}})[_0x3399('0x14')](function(_0x4569c4){logger[_0x3399('0x11')](_0x3399('0xc'),_0x3838ef,_0x4569c4);_0x42c30e(_0x4569c4);});});}exports['ShowSound']=function(_0x4ed3a7){var _0x4045c7=this;return new Promise(function(_0x43782d,_0x24ba07){return db[_0x3399('0x15')][_0x3399('0x16')]({'raw':_0x4ed3a7[_0x3399('0x17')]?_0x4ed3a7[_0x3399('0x17')][_0x3399('0x18')]===undefined?!![]:![]:!![],'where':_0x4ed3a7[_0x3399('0x17')]?_0x4ed3a7[_0x3399('0x17')][_0x3399('0x19')]||null:null,'attributes':_0x4ed3a7[_0x3399('0x17')]?_0x4ed3a7['options'][_0x3399('0x1a')]||null:null,'include':_0x4ed3a7[_0x3399('0x17')]?_0x4ed3a7['options'][_0x3399('0x1b')]?_['map'](_0x4ed3a7[_0x3399('0x17')][_0x3399('0x1b')],function(_0x266ead){return{'model':db[_0x266ead['model']],'as':_0x266ead['as'],'attributes':_0x266ead[_0x3399('0x1a')],'include':_0x266ead[_0x3399('0x1b')]?_[_0x3399('0x1c')](_0x266ead['include'],function(_0x2eff6f){return{'model':db[_0x2eff6f[_0x3399('0x1d')]],'as':_0x2eff6f['as'],'attributes':_0x2eff6f[_0x3399('0x1a')],'include':_0x2eff6f[_0x3399('0x1b')]?_[_0x3399('0x1c')](_0x2eff6f[_0x3399('0x1b')],function(_0x255b48){return{'model':db[_0x255b48[_0x3399('0x1d')]],'as':_0x255b48['as'],'attributes':_0x255b48['attributes']};}):[]};}):[]};}):[]:[]})[_0x3399('0xa')](function(_0x219c66){logger[_0x3399('0xb')](_0x3399('0x1e'),_0x4ed3a7);logger['debug']('ShowSound',_0x4ed3a7,JSON['stringify'](_0x219c66));_0x43782d(_0x219c66);})[_0x3399('0x14')](function(_0x597fcd){logger[_0x3399('0x11')](_0x3399('0x1e'),_0x597fcd[_0x3399('0x13')],_0x4ed3a7);_0x24ba07(_0x4045c7[_0x3399('0x11')](0x1f4,_0x597fcd[_0x3399('0x13')]));});});}; \ No newline at end of file +var _0x9329=['../../config/logger','../../config/environment','jayson/promise','client','http','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','where','include','model','map','attributes','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x498889,_0x547993){var _0xd6cb2d=function(_0x50b51a){while(--_0x50b51a){_0x498889['push'](_0x498889['shift']());}};_0xd6cb2d(++_0x547993);}(_0x9329,0x111));var _0x9932=function(_0x435630,_0x271b45){_0x435630=_0x435630-0x0;var _0x486a0e=_0x9329[_0x435630];return _0x486a0e;};'use strict';var _=require(_0x9932('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9932('0x1'));var rs=require(_0x9932('0x2'));var fs=require('fs');var Redis=require(_0x9932('0x3'));var db=require(_0x9932('0x4'))['db'];var utils=require(_0x9932('0x5'));var logger=require(_0x9932('0x6'))('rpc');var config=require(_0x9932('0x7'));var jayson=require(_0x9932('0x8'));var client=jayson[_0x9932('0x9')][_0x9932('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d47b3,_0x50dd10,_0x27a1a4){return new BPromise(function(_0x33df65,_0x1ee1c5){return client['request'](_0x4d47b3,_0x27a1a4)['then'](function(_0x1b608a){logger[_0x9932('0xb')](_0x9932('0xc'),_0x50dd10,_0x9932('0xd'));logger[_0x9932('0xe')](_0x9932('0xf'),_0x50dd10,_0x9932('0xd'),JSON[_0x9932('0x10')](_0x1b608a));if(_0x1b608a[_0x9932('0x11')]){if(_0x1b608a[_0x9932('0x11')][_0x9932('0x12')]===0x1f4){logger['error'](_0x9932('0xc'),_0x50dd10,_0x1b608a['error'][_0x9932('0x13')]);return _0x1ee1c5(_0x1b608a['error'][_0x9932('0x13')]);}logger[_0x9932('0x11')](_0x9932('0xc'),_0x50dd10,_0x1b608a[_0x9932('0x11')][_0x9932('0x13')]);return _0x33df65(_0x1b608a[_0x9932('0x11')][_0x9932('0x13')]);}else{logger[_0x9932('0xb')]('Sound,\x20%s,\x20%s',_0x50dd10,_0x9932('0xd'));_0x33df65(_0x1b608a[_0x9932('0x14')][_0x9932('0x13')]);}})[_0x9932('0x15')](function(_0x130a6f){logger[_0x9932('0x11')](_0x9932('0xc'),_0x50dd10,_0x130a6f);_0x1ee1c5(_0x130a6f);});});}exports[_0x9932('0x16')]=function(_0x18cf69){var _0x1a9155=this;return new Promise(function(_0x1d95b3,_0x1ccc91){return db[_0x9932('0x17')]['find']({'raw':_0x18cf69[_0x9932('0x18')]?_0x18cf69[_0x9932('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x18cf69[_0x9932('0x18')]?_0x18cf69[_0x9932('0x18')][_0x9932('0x19')]||null:null,'attributes':_0x18cf69[_0x9932('0x18')]?_0x18cf69['options']['attributes']||null:null,'include':_0x18cf69['options']?_0x18cf69[_0x9932('0x18')]['include']?_['map'](_0x18cf69['options'][_0x9932('0x1a')],function(_0xe65124){return{'model':db[_0xe65124[_0x9932('0x1b')]],'as':_0xe65124['as'],'attributes':_0xe65124['attributes'],'include':_0xe65124['include']?_[_0x9932('0x1c')](_0xe65124[_0x9932('0x1a')],function(_0x1e119d){return{'model':db[_0x1e119d[_0x9932('0x1b')]],'as':_0x1e119d['as'],'attributes':_0x1e119d[_0x9932('0x1d')],'include':_0x1e119d['include']?_[_0x9932('0x1c')](_0x1e119d[_0x9932('0x1a')],function(_0x316bd1){return{'model':db[_0x316bd1['model']],'as':_0x316bd1['as'],'attributes':_0x316bd1[_0x9932('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9932('0x1e')](function(_0x2ff4fc){logger[_0x9932('0xb')](_0x9932('0x16'),_0x18cf69);logger['debug'](_0x9932('0x16'),_0x18cf69,JSON[_0x9932('0x10')](_0x2ff4fc));_0x1d95b3(_0x2ff4fc);})['catch'](function(_0x81d12e){logger[_0x9932('0x11')](_0x9932('0x16'),_0x81d12e[_0x9932('0x13')],_0x18cf69);_0x1ccc91(_0x1a9155['error'](0x1f4,_0x81d12e[_0x9932('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7a49fed..ff4dcd9 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x3cbb71,_0x4a1cb1){var _0x45124e=function(_0x1af58b){while(--_0x1af58b){_0x3cbb71['push'](_0x3cbb71['shift']());}};_0x45124e(++_0x4a1cb1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./squareMessage.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0xb')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router['put']('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0x9'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a5df2,_0x2b5517){var _0x3a65b6=function(_0x4e14db){while(--_0x4e14db){_0x3a5df2['push'](_0x3a5df2['shift']());}};_0x3a65b6(++_0x2b5517);}(_0x0b0e,0x187));var _0xe0b0=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x0b0e[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e9ae9d9..45897ae 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 _0xd956=['TEXT','ENUM','exports','STRING'];(function(_0x563533,_0x250ba8){var _0x18996b=function(_0x1120d7){while(--_0x1120d7){_0x563533['push'](_0x563533['shift']());}};_0x18996b(++_0x250ba8);}(_0xd956,0x1d2));var _0x6d95=function(_0x37f41f,_0x537e54){_0x37f41f=_0x37f41f-0x0;var _0x5e0748=_0xd956[_0x37f41f];return _0x5e0748;};'use strict';var Sequelize=require('sequelize');module[_0x6d95('0x0')]={'uniqueid':{'type':Sequelize[_0x6d95('0x1')]},'body':{'type':Sequelize[_0x6d95('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x6d95('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6d95('0x2')]}}; \ No newline at end of file +var _0x1148=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x12c54f,_0x1fac47){var _0x313f50=function(_0x19aa67){while(--_0x19aa67){_0x12c54f['push'](_0x12c54f['shift']());}};_0x313f50(++_0x1fac47);}(_0x1148,0x1ae));var _0x8114=function(_0x290748,_0x26ba2d){_0x290748=_0x290748-0x0;var _0x2df13a=_0x1148[_0x290748];return _0x2df13a;};'use strict';var Sequelize=require(_0x8114('0x0'));module[_0x8114('0x1')]={'uniqueid':{'type':Sequelize[_0x8114('0x2')]},'body':{'type':Sequelize[_0x8114('0x3')](_0x8114('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x8114('0x5')]('in',_0x8114('0x6')),'defaultValue':_0x8114('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x8114('0x2')]},'providerResponse':{'type':Sequelize[_0x8114('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 8a162ef..eb4820e 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 _0xfbfb=['rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareMessage'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xfbfb,0xfa));var _0xbfbf=function(_0xbe4336,_0x8aa100){_0xbe4336=_0xbe4336-0x0;var _0x2c742a=_0xfbfb[_0xbe4336];return _0x2c742a;};'use strict';var emlformat=require(_0xbfbf('0x0'));var rimraf=require(_0xbfbf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbfbf('0x2'));var moment=require(_0xbfbf('0x3'));var BPromise=require(_0xbfbf('0x4'));var Mustache=require(_0xbfbf('0x5'));var util=require(_0xbfbf('0x6'));var path=require('path');var sox=require(_0xbfbf('0x7'));var csv=require(_0xbfbf('0x8'));var ejs=require(_0xbfbf('0x9'));var fs=require('fs');var fs_extra=require(_0xbfbf('0xa'));var _=require(_0xbfbf('0xb'));var squel=require(_0xbfbf('0xc'));var crypto=require(_0xbfbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbfbf('0xe'));var toCsv=require(_0xbfbf('0x8'));var querystring=require('querystring');var Papa=require(_0xbfbf('0xf'));var Redis=require(_0xbfbf('0x10'));var authService=require(_0xbfbf('0x11'));var qs=require(_0xbfbf('0x12'));var as=require(_0xbfbf('0x13'));var hardwareService=require(_0xbfbf('0x14'));var logger=require('../../config/logger')(_0xbfbf('0x15'));var utils=require('../../config/utils');var config=require(_0xbfbf('0x16'));var licenseUtil=require(_0xbfbf('0x17'));var db=require(_0xbfbf('0x18'))['db'];function respondWithStatusCode(_0x7aa045,_0x14c5e5){_0x14c5e5=_0x14c5e5||0xcc;return function(_0x11473c){if(_0x11473c){return _0x7aa045[_0xbfbf('0x19')](_0x14c5e5);}return _0x7aa045[_0xbfbf('0x1a')](_0x14c5e5)[_0xbfbf('0x1b')]();};}function respondWithResult(_0x2c4b0e,_0x3b1145){_0x3b1145=_0x3b1145||0xc8;return function(_0x1ee173){if(_0x1ee173){return _0x2c4b0e[_0xbfbf('0x1a')](_0x3b1145)[_0xbfbf('0x1c')](_0x1ee173);}};}function respondWithFilteredResult(_0x373495,_0xacb15b){return function(_0x161b9c){if(_0x161b9c){var _0xb54ddc=typeof _0xacb15b[_0xbfbf('0x1d')]===_0xbfbf('0x1e')&&typeof _0xacb15b[_0xbfbf('0x1f')]===_0xbfbf('0x1e');var _0x198c53=_0x161b9c[_0xbfbf('0x20')];var _0x48d37c=_0xb54ddc?0x0:_0xacb15b[_0xbfbf('0x1d')];var _0x896a44=_0xb54ddc?_0x161b9c[_0xbfbf('0x20')]:_0xacb15b[_0xbfbf('0x1d')]+_0xacb15b[_0xbfbf('0x1f')];var _0xd06ef3;if(_0x896a44>=_0x198c53){_0x896a44=_0x198c53;_0xd06ef3=0xc8;}else{_0xd06ef3=0xce;}_0x373495[_0xbfbf('0x1a')](_0xd06ef3);return _0x373495[_0xbfbf('0x21')](_0xbfbf('0x22'),_0x48d37c+'-'+_0x896a44+'/'+_0x198c53)[_0xbfbf('0x1c')](_0x161b9c);}return null;};}function patchUpdates(_0x583d32){return function(_0x1ee373){try{jsonpatch['apply'](_0x1ee373,_0x583d32,!![]);}catch(_0x5a42fd){return BPromise[_0xbfbf('0x23')](_0x5a42fd);}return _0x1ee373[_0xbfbf('0x24')]();};}function saveUpdates(_0x596bbd,_0x3126c6){return function(_0x3d07f0){if(_0x3d07f0){return _0x3d07f0[_0xbfbf('0x25')](_0x596bbd)[_0xbfbf('0x26')](function(_0x48b9a5){return _0x48b9a5;});}return null;};}function removeEntity(_0xb9b155,_0x4ec2d3){return function(_0x2bebc7){if(_0x2bebc7){return _0x2bebc7['destroy']()[_0xbfbf('0x26')](function(){_0xb9b155['status'](0xcc)[_0xbfbf('0x1b')]();});}};}function handleEntityNotFound(_0x1721e2,_0x14cfb4){return function(_0x498b6a){if(!_0x498b6a){_0x1721e2[_0xbfbf('0x19')](0x194);}return _0x498b6a;};}function handleError(_0x4c4875,_0x31812d){_0x31812d=_0x31812d||0x1f4;return function(_0x4ccd35){logger[_0xbfbf('0x27')](_0x4ccd35[_0xbfbf('0x28')]);if(_0x4ccd35[_0xbfbf('0x29')]){delete _0x4ccd35[_0xbfbf('0x29')];}_0x4c4875['status'](_0x31812d)[_0xbfbf('0x2a')](_0x4ccd35);};}exports[_0xbfbf('0x2b')]=function(_0xe71a68,_0x3a676e){var _0x9cb7fe={},_0x19d17d={},_0x20f916={'count':0x0,'rows':[]};var _0x529014=_[_0xbfbf('0x2c')](db[_0xbfbf('0x2d')][_0xbfbf('0x2e')],function(_0x1cbca6){return{'name':_0x1cbca6[_0xbfbf('0x2f')],'type':_0x1cbca6[_0xbfbf('0x30')][_0xbfbf('0x31')]};});_0x19d17d[_0xbfbf('0x32')]=_[_0xbfbf('0x2c')](_0x529014,'name');_0x19d17d['query']=_[_0xbfbf('0x33')](_0xe71a68['query']);_0x19d17d[_0xbfbf('0x34')]=_[_0xbfbf('0x35')](_0x19d17d[_0xbfbf('0x32')],_0x19d17d['query']);_0x9cb7fe[_0xbfbf('0x36')]=_['intersection'](_0x19d17d[_0xbfbf('0x32')],qs[_0xbfbf('0x37')](_0xe71a68[_0xbfbf('0x38')][_0xbfbf('0x37')]));_0x9cb7fe['attributes']=_0x9cb7fe[_0xbfbf('0x36')]['length']?_0x9cb7fe[_0xbfbf('0x36')]:_0x19d17d[_0xbfbf('0x32')];if(!_0xe71a68['query']['hasOwnProperty']('nolimit')){_0x9cb7fe[_0xbfbf('0x1f')]=qs[_0xbfbf('0x1f')](_0xe71a68['query']['limit']);_0x9cb7fe[_0xbfbf('0x1d')]=qs[_0xbfbf('0x1d')](_0xe71a68[_0xbfbf('0x38')][_0xbfbf('0x1d')]);}_0x9cb7fe[_0xbfbf('0x39')]=qs[_0xbfbf('0x3a')](_0xe71a68[_0xbfbf('0x38')][_0xbfbf('0x3a')]);_0x9cb7fe[_0xbfbf('0x3b')]=qs[_0xbfbf('0x34')](_[_0xbfbf('0x3c')](_0xe71a68['query'],_0x19d17d[_0xbfbf('0x34')]),_0x529014);if(_0xe71a68[_0xbfbf('0x38')][_0xbfbf('0x3d')]){_0x9cb7fe[_0xbfbf('0x3b')]=_['merge'](_0x9cb7fe[_0xbfbf('0x3b')],{'$or':_[_0xbfbf('0x2c')](_0x529014,function(_0x1e7870){if(_0x1e7870[_0xbfbf('0x30')]!=='VIRTUAL'){var _0x126498={};_0x126498[_0x1e7870['name']]={'$like':'%'+_0xe71a68[_0xbfbf('0x38')]['filter']+'%'};return _0x126498;}})});}_0x9cb7fe=_[_0xbfbf('0x3e')]({},_0x9cb7fe,_0xe71a68[_0xbfbf('0x3f')]);var _0x138159={'where':_0x9cb7fe['where']};return db['SquareMessage'][_0xbfbf('0x20')](_0x138159)[_0xbfbf('0x26')](function(_0x307ada){_0x20f916['count']=_0x307ada;if(_0xe71a68[_0xbfbf('0x38')][_0xbfbf('0x40')]){_0x9cb7fe[_0xbfbf('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0xbfbf('0x42')](_0x9cb7fe);})[_0xbfbf('0x26')](function(_0x5a74c0){_0x20f916[_0xbfbf('0x43')]=_0x5a74c0;return _0x20f916;})[_0xbfbf('0x26')](respondWithFilteredResult(_0x3a676e,_0x9cb7fe))[_0xbfbf('0x44')](handleError(_0x3a676e,null));};exports[_0xbfbf('0x45')]=function(_0xb86003,_0x2ff4ea){var _0x398a80={'raw':!![],'where':{'id':_0xb86003[_0xbfbf('0x46')]['id']}},_0x87f1c={};_0x87f1c[_0xbfbf('0x32')]=_[_0xbfbf('0x33')](db['SquareMessage'][_0xbfbf('0x2e')]);_0x87f1c[_0xbfbf('0x38')]=_['keys'](_0xb86003[_0xbfbf('0x38')]);_0x87f1c[_0xbfbf('0x34')]=_[_0xbfbf('0x35')](_0x87f1c[_0xbfbf('0x32')],_0x87f1c[_0xbfbf('0x38')]);_0x398a80[_0xbfbf('0x36')]=_[_0xbfbf('0x35')](_0x87f1c[_0xbfbf('0x32')],qs['fields'](_0xb86003[_0xbfbf('0x38')]['fields']));_0x398a80['attributes']=_0x398a80['attributes']['length']?_0x398a80[_0xbfbf('0x36')]:_0x87f1c[_0xbfbf('0x32')];if(_0xb86003[_0xbfbf('0x38')]['includeAll']){_0x398a80[_0xbfbf('0x41')]=[{'all':!![]}];}_0x398a80=_[_0xbfbf('0x3e')]({},_0x398a80,_0xb86003[_0xbfbf('0x3f')]);return db[_0xbfbf('0x2d')][_0xbfbf('0x47')](_0x398a80)[_0xbfbf('0x26')](handleEntityNotFound(_0x2ff4ea,null))[_0xbfbf('0x26')](respondWithResult(_0x2ff4ea,null))[_0xbfbf('0x44')](handleError(_0x2ff4ea,null));};exports[_0xbfbf('0x48')]=function(_0x2bfc44,_0x2e5b9e){return db['SquareMessage'][_0xbfbf('0x48')](_0x2bfc44['body'],{})[_0xbfbf('0x26')](respondWithResult(_0x2e5b9e,0xc9))['catch'](handleError(_0x2e5b9e,null));};exports[_0xbfbf('0x25')]=function(_0x15e496,_0x1eb77d){if(_0x15e496['body']['id']){delete _0x15e496[_0xbfbf('0x49')]['id'];}return db[_0xbfbf('0x2d')][_0xbfbf('0x47')]({'where':{'id':_0x15e496[_0xbfbf('0x46')]['id']}})[_0xbfbf('0x26')](handleEntityNotFound(_0x1eb77d,null))['then'](saveUpdates(_0x15e496[_0xbfbf('0x49')],null))['then'](respondWithResult(_0x1eb77d,null))[_0xbfbf('0x44')](handleError(_0x1eb77d,null));};exports['destroy']=function(_0xda1f1f,_0x4a5dc8){return db[_0xbfbf('0x2d')]['find']({'where':{'id':_0xda1f1f[_0xbfbf('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a5dc8,null))['then'](removeEntity(_0x4a5dc8,null))['catch'](handleError(_0x4a5dc8,null));}; \ No newline at end of file +var _0x9666=['zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareMessage','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x9666,0x17a));var _0x6966=function(_0x124474,_0x3a3892){_0x124474=_0x124474-0x0;var _0x34cb84=_0x9666[_0x124474];return _0x34cb84;};'use strict';var emlformat=require(_0x6966('0x0'));var rimraf=require(_0x6966('0x1'));var zipdir=require(_0x6966('0x2'));var jsonpatch=require(_0x6966('0x3'));var rp=require('request-promise');var moment=require(_0x6966('0x4'));var BPromise=require(_0x6966('0x5'));var Mustache=require(_0x6966('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6966('0x7'));var csv=require(_0x6966('0x8'));var ejs=require(_0x6966('0x9'));var fs=require('fs');var fs_extra=require(_0x6966('0xa'));var _=require(_0x6966('0xb'));var squel=require(_0x6966('0xc'));var crypto=require('crypto');var jsforce=require(_0x6966('0xd'));var deskjs=require(_0x6966('0xe'));var toCsv=require(_0x6966('0x8'));var querystring=require('querystring');var Papa=require(_0x6966('0xf'));var Redis=require(_0x6966('0x10'));var authService=require(_0x6966('0x11'));var qs=require(_0x6966('0x12'));var as=require(_0x6966('0x13'));var hardwareService=require(_0x6966('0x14'));var logger=require(_0x6966('0x15'))(_0x6966('0x16'));var utils=require(_0x6966('0x17'));var config=require(_0x6966('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c5272,_0x154c15){_0x154c15=_0x154c15||0xcc;return function(_0x2ce913){if(_0x2ce913){return _0x4c5272[_0x6966('0x19')](_0x154c15);}return _0x4c5272['status'](_0x154c15)['end']();};}function respondWithResult(_0x584bf2,_0x235ba3){_0x235ba3=_0x235ba3||0xc8;return function(_0xbd4ea2){if(_0xbd4ea2){return _0x584bf2[_0x6966('0x1a')](_0x235ba3)[_0x6966('0x1b')](_0xbd4ea2);}};}function respondWithFilteredResult(_0x19428c,_0x48d414){return function(_0x204200){if(_0x204200){var _0x1bf59d=typeof _0x48d414['offset']===_0x6966('0x1c')&&typeof _0x48d414[_0x6966('0x1d')]===_0x6966('0x1c');var _0x529dbd=_0x204200[_0x6966('0x1e')];var _0x4bf5b8=_0x1bf59d?0x0:_0x48d414[_0x6966('0x1f')];var _0x519049=_0x1bf59d?_0x204200['count']:_0x48d414['offset']+_0x48d414[_0x6966('0x1d')];var _0x5eef44;if(_0x519049>=_0x529dbd){_0x519049=_0x529dbd;_0x5eef44=0xc8;}else{_0x5eef44=0xce;}_0x19428c['status'](_0x5eef44);return _0x19428c['set']('Content-Range',_0x4bf5b8+'-'+_0x519049+'/'+_0x529dbd)['json'](_0x204200);}return null;};}function patchUpdates(_0x197c2c){return function(_0x247570){try{jsonpatch[_0x6966('0x20')](_0x247570,_0x197c2c,!![]);}catch(_0x4e8342){return BPromise[_0x6966('0x21')](_0x4e8342);}return _0x247570[_0x6966('0x22')]();};}function saveUpdates(_0x43349b,_0x8c7833){return function(_0x33fc7f){if(_0x33fc7f){return _0x33fc7f[_0x6966('0x23')](_0x43349b)[_0x6966('0x24')](function(_0x2af0b7){return _0x2af0b7;});}return null;};}function removeEntity(_0x3772d7,_0x509631){return function(_0x24af6a){if(_0x24af6a){return _0x24af6a[_0x6966('0x25')]()[_0x6966('0x24')](function(){_0x3772d7[_0x6966('0x1a')](0xcc)[_0x6966('0x26')]();});}};}function handleEntityNotFound(_0x27db0e,_0x44a5df){return function(_0x4e4c30){if(!_0x4e4c30){_0x27db0e[_0x6966('0x19')](0x194);}return _0x4e4c30;};}function handleError(_0x5a7f85,_0x433601){_0x433601=_0x433601||0x1f4;return function(_0x4f7aa2){logger[_0x6966('0x27')](_0x4f7aa2[_0x6966('0x28')]);if(_0x4f7aa2[_0x6966('0x29')]){delete _0x4f7aa2[_0x6966('0x29')];}_0x5a7f85[_0x6966('0x1a')](_0x433601)[_0x6966('0x2a')](_0x4f7aa2);};}exports[_0x6966('0x2b')]=function(_0x1b86a7,_0x2c9fbb){var _0x4a85c7={},_0x270919={},_0x35fdb4={'count':0x0,'rows':[]};var _0x59a8d6=_[_0x6966('0x2c')](db['SquareMessage'][_0x6966('0x2d')],function(_0x297c21){return{'name':_0x297c21[_0x6966('0x2e')],'type':_0x297c21[_0x6966('0x2f')][_0x6966('0x30')]};});_0x270919[_0x6966('0x31')]=_[_0x6966('0x2c')](_0x59a8d6,_0x6966('0x29'));_0x270919[_0x6966('0x32')]=_[_0x6966('0x33')](_0x1b86a7[_0x6966('0x32')]);_0x270919[_0x6966('0x34')]=_[_0x6966('0x35')](_0x270919[_0x6966('0x31')],_0x270919[_0x6966('0x32')]);_0x4a85c7[_0x6966('0x36')]=_['intersection'](_0x270919[_0x6966('0x31')],qs['fields'](_0x1b86a7[_0x6966('0x32')][_0x6966('0x37')]));_0x4a85c7[_0x6966('0x36')]=_0x4a85c7[_0x6966('0x36')][_0x6966('0x38')]?_0x4a85c7[_0x6966('0x36')]:_0x270919[_0x6966('0x31')];if(!_0x1b86a7[_0x6966('0x32')][_0x6966('0x39')](_0x6966('0x3a'))){_0x4a85c7['limit']=qs[_0x6966('0x1d')](_0x1b86a7[_0x6966('0x32')][_0x6966('0x1d')]);_0x4a85c7['offset']=qs['offset'](_0x1b86a7[_0x6966('0x32')][_0x6966('0x1f')]);}_0x4a85c7['order']=qs[_0x6966('0x3b')](_0x1b86a7['query']['sort']);_0x4a85c7[_0x6966('0x3c')]=qs[_0x6966('0x34')](_[_0x6966('0x3d')](_0x1b86a7[_0x6966('0x32')],_0x270919['filters']),_0x59a8d6);if(_0x1b86a7[_0x6966('0x32')][_0x6966('0x3e')]){_0x4a85c7[_0x6966('0x3c')]=_[_0x6966('0x3f')](_0x4a85c7[_0x6966('0x3c')],{'$or':_[_0x6966('0x2c')](_0x59a8d6,function(_0x3cb629){if(_0x3cb629[_0x6966('0x2f')]!==_0x6966('0x40')){var _0x112bff={};_0x112bff[_0x3cb629[_0x6966('0x29')]]={'$like':'%'+_0x1b86a7[_0x6966('0x32')][_0x6966('0x3e')]+'%'};return _0x112bff;}})});}_0x4a85c7=_['merge']({},_0x4a85c7,_0x1b86a7[_0x6966('0x41')]);var _0x5c9590={'where':_0x4a85c7['where']};return db[_0x6966('0x42')][_0x6966('0x1e')](_0x5c9590)['then'](function(_0x57949e){_0x35fdb4[_0x6966('0x1e')]=_0x57949e;if(_0x1b86a7[_0x6966('0x32')][_0x6966('0x43')]){_0x4a85c7['include']=[{'all':!![]}];}return db[_0x6966('0x42')][_0x6966('0x44')](_0x4a85c7);})[_0x6966('0x24')](function(_0x6af6a8){_0x35fdb4[_0x6966('0x45')]=_0x6af6a8;return _0x35fdb4;})[_0x6966('0x24')](respondWithFilteredResult(_0x2c9fbb,_0x4a85c7))[_0x6966('0x46')](handleError(_0x2c9fbb,null));};exports[_0x6966('0x47')]=function(_0x1df2cb,_0x5356fc){var _0x49be81={'raw':!![],'where':{'id':_0x1df2cb[_0x6966('0x48')]['id']}},_0x50ec04={};_0x50ec04['model']=_[_0x6966('0x33')](db[_0x6966('0x42')]['rawAttributes']);_0x50ec04[_0x6966('0x32')]=_['keys'](_0x1df2cb[_0x6966('0x32')]);_0x50ec04[_0x6966('0x34')]=_[_0x6966('0x35')](_0x50ec04[_0x6966('0x31')],_0x50ec04[_0x6966('0x32')]);_0x49be81[_0x6966('0x36')]=_[_0x6966('0x35')](_0x50ec04[_0x6966('0x31')],qs[_0x6966('0x37')](_0x1df2cb[_0x6966('0x32')][_0x6966('0x37')]));_0x49be81['attributes']=_0x49be81[_0x6966('0x36')][_0x6966('0x38')]?_0x49be81[_0x6966('0x36')]:_0x50ec04['model'];if(_0x1df2cb[_0x6966('0x32')][_0x6966('0x43')]){_0x49be81['include']=[{'all':!![]}];}_0x49be81=_[_0x6966('0x3f')]({},_0x49be81,_0x1df2cb[_0x6966('0x41')]);return db[_0x6966('0x42')][_0x6966('0x49')](_0x49be81)[_0x6966('0x24')](handleEntityNotFound(_0x5356fc,null))[_0x6966('0x24')](respondWithResult(_0x5356fc,null))[_0x6966('0x46')](handleError(_0x5356fc,null));};exports[_0x6966('0x4a')]=function(_0x3635b8,_0x154d3e){return db['SquareMessage'][_0x6966('0x4a')](_0x3635b8['body'],{})[_0x6966('0x24')](respondWithResult(_0x154d3e,0xc9))[_0x6966('0x46')](handleError(_0x154d3e,null));};exports['update']=function(_0x301555,_0x4955b8){if(_0x301555[_0x6966('0x4b')]['id']){delete _0x301555[_0x6966('0x4b')]['id'];}return db[_0x6966('0x42')]['find']({'where':{'id':_0x301555[_0x6966('0x48')]['id']}})['then'](handleEntityNotFound(_0x4955b8,null))[_0x6966('0x24')](saveUpdates(_0x301555[_0x6966('0x4b')],null))[_0x6966('0x24')](respondWithResult(_0x4955b8,null))['catch'](handleError(_0x4955b8,null));};exports['destroy']=function(_0x3422fe,_0x40175c){return db[_0x6966('0x42')][_0x6966('0x49')]({'where':{'id':_0x3422fe[_0x6966('0x48')]['id']}})['then'](handleEntityNotFound(_0x40175c,null))[_0x6966('0x24')](removeEntity(_0x40175c,null))[_0x6966('0x46')](handleError(_0x40175c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 0e24f44..de0f818 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 _0x4b99=['../../config/logger','api','bluebird','request-promise','rimraf','exports','define','square_messages','lodash'];(function(_0xbc4659,_0x578fba){var _0x5831f9=function(_0x5eb0eb){while(--_0x5eb0eb){_0xbc4659['push'](_0xbc4659['shift']());}};_0x5831f9(++_0x578fba);}(_0x4b99,0xa1));var _0x94b9=function(_0x350d69,_0x2acb67){_0x350d69=_0x350d69-0x0;var _0x51dc47=_0x4b99[_0x350d69];return _0x51dc47;};'use strict';var _=require(_0x94b9('0x0'));var util=require('util');var logger=require(_0x94b9('0x1'))(_0x94b9('0x2'));var moment=require('moment');var BPromise=require(_0x94b9('0x3'));var rp=require(_0x94b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94b9('0x5'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x94b9('0x6')]=function(_0x593461,_0x2fab67){return _0x593461[_0x94b9('0x7')]('SquareMessage',attributes,{'tableName':_0x94b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc524=['../../config/environment','./squareMessage.attributes','exports','define','square_messages','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57ab79,_0x4ecf82){var _0x3498a9=function(_0xb099c7){while(--_0xb099c7){_0x57ab79['push'](_0x57ab79['shift']());}};_0x3498a9(++_0x4ecf82);}(_0xc524,0x73));var _0x4c52=function(_0x596c42,_0x4478c5){_0x596c42=_0x596c42-0x0;var _0x460752=_0xc524[_0x596c42];return _0x460752;};'use strict';var _=require(_0x4c52('0x0'));var util=require('util');var logger=require(_0x4c52('0x1'))(_0x4c52('0x2'));var moment=require(_0x4c52('0x3'));var BPromise=require(_0x4c52('0x4'));var rp=require(_0x4c52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4c52('0x6'));var attributes=require(_0x4c52('0x7'));module[_0x4c52('0x8')]=function(_0x9d4232,_0x60f1ab){return _0x9d4232[_0x4c52('0x9')]('SquareMessage',attributes,{'tableName':_0x4c52('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index fe9a58f..e0c40e8 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 _0xb171=['message','CreateSquareMessage','SquareMessage','create','body','options','raw','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0xb171,0x1ad));var _0x1b17=function(_0x30ca7b,_0x5d9190){_0x30ca7b=_0x30ca7b-0x0;var _0x51c546=_0xb171[_0x30ca7b];return _0x51c546;};'use strict';var _=require(_0x1b17('0x0'));var util=require(_0x1b17('0x1'));var moment=require(_0x1b17('0x2'));var BPromise=require(_0x1b17('0x3'));var rs=require(_0x1b17('0x4'));var fs=require('fs');var Redis=require(_0x1b17('0x5'));var db=require(_0x1b17('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b17('0x7'))(_0x1b17('0x8'));var config=require(_0x1b17('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1b17('0xa')][_0x1b17('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ee800,_0x203ae6,_0x27799a){return new BPromise(function(_0x2157a2,_0x4f57a8){return client[_0x1b17('0xc')](_0x4ee800,_0x27799a)[_0x1b17('0xd')](function(_0x4516ed){logger['info'](_0x1b17('0xe'),_0x203ae6,_0x1b17('0xf'));logger[_0x1b17('0x10')](_0x1b17('0x11'),_0x203ae6,'request\x20sent',JSON[_0x1b17('0x12')](_0x4516ed));if(_0x4516ed[_0x1b17('0x13')]){if(_0x4516ed[_0x1b17('0x13')][_0x1b17('0x14')]===0x1f4){logger['error'](_0x1b17('0xe'),_0x203ae6,_0x4516ed[_0x1b17('0x13')][_0x1b17('0x15')]);return _0x4f57a8(_0x4516ed[_0x1b17('0x13')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x203ae6,_0x4516ed[_0x1b17('0x13')][_0x1b17('0x15')]);return _0x2157a2(_0x4516ed[_0x1b17('0x13')][_0x1b17('0x15')]);}else{logger['info'](_0x1b17('0xe'),_0x203ae6,'request\x20sent');_0x2157a2(_0x4516ed['result'][_0x1b17('0x15')]);}})['catch'](function(_0x103abe){logger[_0x1b17('0x13')](_0x1b17('0xe'),_0x203ae6,_0x103abe);_0x4f57a8(_0x103abe);});});}exports[_0x1b17('0x16')]=function(_0x562cd2){var _0x503457=this;return new Promise(function(_0x4d0428,_0x4d374e){return db[_0x1b17('0x17')][_0x1b17('0x18')](_0x562cd2[_0x1b17('0x19')],{'raw':_0x562cd2[_0x1b17('0x1a')]?_0x562cd2[_0x1b17('0x1a')][_0x1b17('0x1b')]===undefined?!![]:![]:!![]})[_0x1b17('0xd')](function(_0x5cfebd){logger[_0x1b17('0x1c')]('CreateSquareMessage',_0x562cd2);logger['debug'](_0x1b17('0x16'),_0x562cd2,JSON[_0x1b17('0x12')](_0x5cfebd));_0x4d0428(_0x5cfebd);})[_0x1b17('0x1d')](function(_0x108969){logger['error'](_0x1b17('0x16'),_0x108969['message'],_0x562cd2);_0x4d374e(_0x503457[_0x1b17('0x13')](0x1f4,_0x108969[_0x1b17('0x15')]));});});}; \ No newline at end of file +var _0xd835=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','util'];(function(_0x12af72,_0x16c27e){var _0x393472=function(_0x2009c3){while(--_0x2009c3){_0x12af72['push'](_0x12af72['shift']());}};_0x393472(++_0x16c27e);}(_0xd835,0x1ed));var _0x5d83=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xd835[_0x31bab3];return _0x4fd382;};'use strict';var _=require('lodash');var util=require(_0x5d83('0x0'));var moment=require(_0x5d83('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d83('0x2'));var fs=require('fs');var Redis=require(_0x5d83('0x3'));var db=require(_0x5d83('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d83('0x5'))(_0x5d83('0x6'));var config=require('../../config/environment');var jayson=require(_0x5d83('0x7'));var client=jayson[_0x5d83('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49603e,_0x3ea6bb,_0x211882){return new BPromise(function(_0x51370b,_0x39c1eb){return client[_0x5d83('0x9')](_0x49603e,_0x211882)['then'](function(_0x2c98b3){logger[_0x5d83('0xa')](_0x5d83('0xb'),_0x3ea6bb,_0x5d83('0xc'));logger[_0x5d83('0xd')](_0x5d83('0xe'),_0x3ea6bb,_0x5d83('0xc'),JSON[_0x5d83('0xf')](_0x2c98b3));if(_0x2c98b3['error']){if(_0x2c98b3[_0x5d83('0x10')]['code']===0x1f4){logger[_0x5d83('0x10')](_0x5d83('0xb'),_0x3ea6bb,_0x2c98b3['error']['message']);return _0x39c1eb(_0x2c98b3[_0x5d83('0x10')][_0x5d83('0x11')]);}logger[_0x5d83('0x10')](_0x5d83('0xb'),_0x3ea6bb,_0x2c98b3[_0x5d83('0x10')][_0x5d83('0x11')]);return _0x51370b(_0x2c98b3[_0x5d83('0x10')]['message']);}else{logger[_0x5d83('0xa')]('SquareMessage,\x20%s,\x20%s',_0x3ea6bb,'request\x20sent');_0x51370b(_0x2c98b3[_0x5d83('0x12')]['message']);}})[_0x5d83('0x13')](function(_0x4fc2d7){logger[_0x5d83('0x10')](_0x5d83('0xb'),_0x3ea6bb,_0x4fc2d7);_0x39c1eb(_0x4fc2d7);});});}exports[_0x5d83('0x14')]=function(_0x20ca75){var _0x2e2477=this;return new Promise(function(_0x58fabd,_0x127074){return db[_0x5d83('0x15')][_0x5d83('0x16')](_0x20ca75[_0x5d83('0x17')],{'raw':_0x20ca75[_0x5d83('0x18')]?_0x20ca75[_0x5d83('0x18')][_0x5d83('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3aa486){logger[_0x5d83('0xa')](_0x5d83('0x14'),_0x20ca75);logger[_0x5d83('0xd')]('CreateSquareMessage',_0x20ca75,JSON['stringify'](_0x3aa486));_0x58fabd(_0x3aa486);})[_0x5d83('0x13')](function(_0x229dc9){logger[_0x5d83('0x10')](_0x5d83('0x14'),_0x229dc9[_0x5d83('0x11')],_0x20ca75);_0x127074(_0x2e2477[_0x5d83('0x10')](0x1f4,_0x229dc9[_0x5d83('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7906669..c1d4c0b 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 _0x6cac=['update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','show','15s','test','post','isAuthenticated','create','put'];(function(_0x3ea0de,_0x1e65fe){var _0x3cf2d9=function(_0x8e7bec){while(--_0x8e7bec){_0x3ea0de['push'](_0x3ea0de['shift']());}};_0x3cf2d9(++_0x1e65fe);}(_0x6cac,0x17d));var _0xc6ca=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6cac[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xc6ca('0x0'));var util=require(_0xc6ca('0x1'));var path=require(_0xc6ca('0x2'));var timeout=require(_0xc6ca('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc6ca('0x4'));var auth=require(_0xc6ca('0x5'));var interaction=require(_0xc6ca('0x6'));var config=require(_0xc6ca('0x7'));var controller=require(_0xc6ca('0x8'));router[_0xc6ca('0x9')]('/',auth['isAuthenticated'](),controller[_0xc6ca('0xa')]);router[_0xc6ca('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc6ca('0xb')]);router[_0xc6ca('0x9')]('/:id/test',auth['isAuthenticated'](),timeout(_0xc6ca('0xc')),controller[_0xc6ca('0xd')]);router[_0xc6ca('0xe')]('/',auth[_0xc6ca('0xf')](),controller[_0xc6ca('0x10')]);router[_0xc6ca('0x11')]('/:id',auth[_0xc6ca('0xf')](),controller[_0xc6ca('0x12')]);router[_0xc6ca('0x13')]('/:id',auth[_0xc6ca('0xf')](),controller[_0xc6ca('0x14')]);module['exports']=router; \ No newline at end of file +var _0xef0a=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','put','destroy'];(function(_0x1e0bfe,_0x19a453){var _0xb3a289=function(_0x541221){while(--_0x541221){_0x1e0bfe['push'](_0x1e0bfe['shift']());}};_0xb3a289(++_0x19a453);}(_0xef0a,0xe8));var _0xaef0=function(_0x4b0b08,_0x3944c8){_0x4b0b08=_0x4b0b08-0x0;var _0x4ecb99=_0xef0a[_0x4b0b08];return _0x4ecb99;};'use strict';var multer=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var path=require(_0xaef0('0x2'));var timeout=require('connect-timeout');var express=require(_0xaef0('0x3'));var router=express[_0xaef0('0x4')]();var fs_extra=require(_0xaef0('0x5'));var auth=require(_0xaef0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaef0('0x7'));var controller=require(_0xaef0('0x8'));router[_0xaef0('0x9')]('/',auth[_0xaef0('0xa')](),controller[_0xaef0('0xb')]);router[_0xaef0('0x9')](_0xaef0('0xc'),auth[_0xaef0('0xa')](),controller['show']);router['get'](_0xaef0('0xd'),auth[_0xaef0('0xa')](),timeout(_0xaef0('0xe')),controller[_0xaef0('0xf')]);router[_0xaef0('0x10')]('/',auth[_0xaef0('0xa')](),controller[_0xaef0('0x11')]);router[_0xaef0('0x12')]('/:id',auth[_0xaef0('0xa')](),controller['update']);router['delete']('/:id',auth[_0xaef0('0xa')](),controller[_0xaef0('0x13')]);module[_0xaef0('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 19aed5c..326841a 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 _0x6cfa=['name','STRING','sequelize','exports'];(function(_0x3d3fbf,_0x22db8d){var _0x3f3326=function(_0x3c9683){while(--_0x3c9683){_0x3d3fbf['push'](_0x3d3fbf['shift']());}};_0x3f3326(++_0x22db8d);}(_0x6cfa,0xa6));var _0xa6cf=function(_0x3c0cd6,_0x5ba428){_0x3c0cd6=_0x3c0cd6-0x0;var _0x4381ec=_0x6cfa[_0x3c0cd6];return _0x4381ec;};'use strict';var Sequelize=require(_0xa6cf('0x0'));module[_0xa6cf('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa6cf('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa6cf('0x3')]}}; \ No newline at end of file +var _0x18ce=['STRING','exports'];(function(_0x208622,_0x39bc78){var _0x17e1e4=function(_0x187e16){while(--_0x187e16){_0x208622['push'](_0x208622['shift']());}};_0x17e1e4(++_0x39bc78);}(_0x18ce,0x85));var _0xe18c=function(_0x5afd67,_0x7d5c97){_0x5afd67=_0x5afd67-0x0;var _0x4f89e0=_0x18ce[_0x5afd67];return _0x4f89e0;};'use strict';var Sequelize=require('sequelize');module[_0xe18c('0x0')]={'name':{'type':Sequelize[_0xe18c('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xe18c('0x1')]},'description':{'type':Sequelize[_0xe18c('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f69a285..89e9d35 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 _0x7325=['catch','show','params','intersection','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows'];(function(_0x42f097,_0xfbfad4){var _0x5cc92c=function(_0x1acb5d){while(--_0x1acb5d){_0x42f097['push'](_0x42f097['shift']());}};_0x5cc92c(++_0xfbfad4);}(_0x7325,0x6c));var _0x5732=function(_0x5f0ce9,_0x5e0d79){_0x5f0ce9=_0x5f0ce9-0x0;var _0x45260b=_0x7325[_0x5f0ce9];return _0x45260b;};'use strict';var emlformat=require(_0x5732('0x0'));var rimraf=require(_0x5732('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5732('0x2'));var rp=require('request-promise');var moment=require(_0x5732('0x3'));var BPromise=require(_0x5732('0x4'));var Mustache=require(_0x5732('0x5'));var util=require('util');var path=require(_0x5732('0x6'));var sox=require(_0x5732('0x7'));var csv=require('to-csv');var ejs=require(_0x5732('0x8'));var fs=require('fs');var fs_extra=require(_0x5732('0x9'));var _=require(_0x5732('0xa'));var squel=require(_0x5732('0xb'));var crypto=require(_0x5732('0xc'));var jsforce=require(_0x5732('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5732('0xe'));var querystring=require(_0x5732('0xf'));var Papa=require(_0x5732('0x10'));var Redis=require(_0x5732('0x11'));var authService=require(_0x5732('0x12'));var qs=require(_0x5732('0x13'));var as=require(_0x5732('0x14'));var hardwareService=require(_0x5732('0x15'));var logger=require(_0x5732('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5732('0x17'));var licenseUtil=require(_0x5732('0x18'));var db=require(_0x5732('0x19'))['db'];function respondWithStatusCode(_0x5cd889,_0x2e2199){_0x2e2199=_0x2e2199||0xcc;return function(_0x3015d4){if(_0x3015d4){return _0x5cd889[_0x5732('0x1a')](_0x2e2199);}return _0x5cd889[_0x5732('0x1b')](_0x2e2199)[_0x5732('0x1c')]();};}function respondWithResult(_0x343743,_0x1381fb){_0x1381fb=_0x1381fb||0xc8;return function(_0x55bfbd){if(_0x55bfbd){return _0x343743[_0x5732('0x1b')](_0x1381fb)['json'](_0x55bfbd);}};}function respondWithFilteredResult(_0x52d1ae,_0x34d6de){return function(_0x536398){if(_0x536398){var _0x48f486=typeof _0x34d6de[_0x5732('0x1d')]==='undefined'&&typeof _0x34d6de[_0x5732('0x1e')]===_0x5732('0x1f');var _0x32d84c=_0x536398[_0x5732('0x20')];var _0x37c17e=_0x48f486?0x0:_0x34d6de[_0x5732('0x1d')];var _0x4c3685=_0x48f486?_0x536398[_0x5732('0x20')]:_0x34d6de[_0x5732('0x1d')]+_0x34d6de[_0x5732('0x1e')];var _0x5d040b;if(_0x4c3685>=_0x32d84c){_0x4c3685=_0x32d84c;_0x5d040b=0xc8;}else{_0x5d040b=0xce;}_0x52d1ae['status'](_0x5d040b);return _0x52d1ae[_0x5732('0x21')](_0x5732('0x22'),_0x37c17e+'-'+_0x4c3685+'/'+_0x32d84c)[_0x5732('0x23')](_0x536398);}return null;};}function patchUpdates(_0x224f7e){return function(_0x53d75a){try{jsonpatch[_0x5732('0x24')](_0x53d75a,_0x224f7e,!![]);}catch(_0x49fd2e){return BPromise[_0x5732('0x25')](_0x49fd2e);}return _0x53d75a['save']();};}function saveUpdates(_0x24d245,_0x55a26a){return function(_0x4bbb9e){if(_0x4bbb9e){return _0x4bbb9e[_0x5732('0x26')](_0x24d245)[_0x5732('0x27')](function(_0x59c3d2){return _0x59c3d2;});}return null;};}function removeEntity(_0x12678f,_0x39e115){return function(_0x30fdf7){if(_0x30fdf7){return _0x30fdf7[_0x5732('0x28')]()[_0x5732('0x27')](function(){var _0xbeb760=_0x30fdf7[_0x5732('0x29')]({'plain':!![]});var _0x2a2e31='ODBC';return db[_0x5732('0x2a')][_0x5732('0x28')]({'where':{'type':_0x2a2e31,'resourceId':_0xbeb760['id']}})[_0x5732('0x27')](function(){return _0x30fdf7;});})[_0x5732('0x27')](function(){_0x12678f['status'](0xcc)[_0x5732('0x1c')]();});}};}function handleEntityNotFound(_0x4abfb0,_0x32859e){return function(_0x2cd297){if(!_0x2cd297){_0x4abfb0['sendStatus'](0x194);}return _0x2cd297;};}function handleError(_0x52edf2,_0x50fc7a){_0x50fc7a=_0x50fc7a||0x1f4;return function(_0x154f09){logger[_0x5732('0x2b')](_0x154f09[_0x5732('0x2c')]);if(_0x154f09[_0x5732('0x2d')]){delete _0x154f09[_0x5732('0x2d')];}_0x52edf2[_0x5732('0x1b')](_0x50fc7a)[_0x5732('0x2e')](_0x154f09);};}exports['index']=function(_0x356860,_0x5589fc){var _0x4c102f={},_0x4d471f={},_0x4842c8={'count':0x0,'rows':[]};var _0xa702b2=_[_0x5732('0x2f')](db[_0x5732('0x30')][_0x5732('0x31')],function(_0x423a91){return{'name':_0x423a91[_0x5732('0x32')],'type':_0x423a91[_0x5732('0x33')]['key']};});_0x4d471f[_0x5732('0x34')]=_[_0x5732('0x2f')](_0xa702b2,_0x5732('0x2d'));_0x4d471f[_0x5732('0x35')]=_[_0x5732('0x36')](_0x356860[_0x5732('0x35')]);_0x4d471f[_0x5732('0x37')]=_['intersection'](_0x4d471f[_0x5732('0x34')],_0x4d471f[_0x5732('0x35')]);_0x4c102f['attributes']=_['intersection'](_0x4d471f['model'],qs[_0x5732('0x38')](_0x356860[_0x5732('0x35')][_0x5732('0x38')]));_0x4c102f[_0x5732('0x39')]=_0x4c102f[_0x5732('0x39')]['length']?_0x4c102f['attributes']:_0x4d471f[_0x5732('0x34')];if(!_0x356860[_0x5732('0x35')][_0x5732('0x3a')]('nolimit')){_0x4c102f[_0x5732('0x1e')]=qs[_0x5732('0x1e')](_0x356860[_0x5732('0x35')][_0x5732('0x1e')]);_0x4c102f[_0x5732('0x1d')]=qs[_0x5732('0x1d')](_0x356860[_0x5732('0x35')]['offset']);}_0x4c102f[_0x5732('0x3b')]=qs[_0x5732('0x3c')](_0x356860['query'][_0x5732('0x3c')]);_0x4c102f[_0x5732('0x3d')]=qs[_0x5732('0x37')](_['pick'](_0x356860[_0x5732('0x35')],_0x4d471f[_0x5732('0x37')]),_0xa702b2);if(_0x356860['query'][_0x5732('0x3e')]){_0x4c102f[_0x5732('0x3d')]=_[_0x5732('0x3f')](_0x4c102f[_0x5732('0x3d')],{'$or':_['map'](_0xa702b2,function(_0x4e73e8){if(_0x4e73e8[_0x5732('0x33')]!=='VIRTUAL'){var _0xace565={};_0xace565[_0x4e73e8[_0x5732('0x2d')]]={'$like':'%'+_0x356860[_0x5732('0x35')][_0x5732('0x3e')]+'%'};return _0xace565;}})});}_0x4c102f=_['merge']({},_0x4c102f,_0x356860['options']);var _0x29c542={'where':_0x4c102f[_0x5732('0x3d')]};return db[_0x5732('0x30')][_0x5732('0x20')](_0x29c542)['then'](function(_0x5165a5){_0x4842c8[_0x5732('0x20')]=_0x5165a5;if(_0x356860[_0x5732('0x35')][_0x5732('0x40')]){_0x4c102f[_0x5732('0x41')]=[{'all':!![]}];}return db['SquareOdbc'][_0x5732('0x42')](_0x4c102f);})[_0x5732('0x27')](function(_0x155322){_0x4842c8[_0x5732('0x43')]=_0x155322;return _0x4842c8;})['then'](respondWithFilteredResult(_0x5589fc,_0x4c102f))[_0x5732('0x44')](handleError(_0x5589fc,null));};exports[_0x5732('0x45')]=function(_0x54084f,_0x55e95c){var _0x3d7d04={'raw':!![],'where':{'id':_0x54084f[_0x5732('0x46')]['id']}},_0x13df6a={};_0x13df6a[_0x5732('0x34')]=_[_0x5732('0x36')](db[_0x5732('0x30')][_0x5732('0x31')]);_0x13df6a['query']=_[_0x5732('0x36')](_0x54084f['query']);_0x13df6a[_0x5732('0x37')]=_[_0x5732('0x47')](_0x13df6a[_0x5732('0x34')],_0x13df6a['query']);_0x3d7d04[_0x5732('0x39')]=_['intersection'](_0x13df6a[_0x5732('0x34')],qs[_0x5732('0x38')](_0x54084f[_0x5732('0x35')][_0x5732('0x38')]));_0x3d7d04[_0x5732('0x39')]=_0x3d7d04[_0x5732('0x39')][_0x5732('0x48')]?_0x3d7d04[_0x5732('0x39')]:_0x13df6a[_0x5732('0x34')];if(_0x54084f['query']['includeAll']){_0x3d7d04['include']=[{'all':!![]}];}_0x3d7d04=_[_0x5732('0x3f')]({},_0x3d7d04,_0x54084f[_0x5732('0x49')]);return db[_0x5732('0x30')]['find'](_0x3d7d04)['then'](handleEntityNotFound(_0x55e95c,null))['then'](respondWithResult(_0x55e95c,null))[_0x5732('0x44')](handleError(_0x55e95c,null));};exports[_0x5732('0x4a')]=function(_0xc9ff0e,_0x1402ea){return db[_0x5732('0x30')][_0x5732('0x4a')](_0xc9ff0e[_0x5732('0x4b')],{})[_0x5732('0x27')](function(_0x475a12){var _0x4fcd59=_0xc9ff0e[_0x5732('0x4c')][_0x5732('0x29')]({'plain':!![]});if(!_0x4fcd59)throw new Error(_0x5732('0x4d'));if(_0x4fcd59[_0x5732('0x4e')]===_0x5732('0x4c')){var _0x4eb61d=_0x475a12[_0x5732('0x29')]({'plain':!![]});var _0x298ef7=_0x5732('0x4f');return db['UserProfileSection'][_0x5732('0x50')]({'where':{'name':_0x298ef7,'userProfileId':_0x4fcd59['userProfileId']},'raw':!![]})['then'](function(_0x3e1e99){if(_0x3e1e99&&_0x3e1e99[_0x5732('0x51')]===0x0){return db[_0x5732('0x2a')][_0x5732('0x4a')]({'name':_0x4eb61d[_0x5732('0x2d')],'resourceId':_0x4eb61d['id'],'type':_0x3e1e99[_0x5732('0x2d')],'sectionId':_0x3e1e99['id']},{})[_0x5732('0x27')](function(){return _0x475a12;});}else{return _0x475a12;}})['catch'](function(_0x2e5643){logger[_0x5732('0x2b')](_0x5732('0x52'),_0x2e5643);throw _0x2e5643;});}return _0x475a12;})[_0x5732('0x27')](respondWithResult(_0x1402ea,0xc9))[_0x5732('0x44')](handleError(_0x1402ea,null));};exports[_0x5732('0x26')]=function(_0x4160e1,_0x5b2831){if(_0x4160e1[_0x5732('0x4b')]['id']){delete _0x4160e1['body']['id'];}return db[_0x5732('0x30')][_0x5732('0x50')]({'where':{'id':_0x4160e1['params']['id']}})[_0x5732('0x27')](handleEntityNotFound(_0x5b2831,null))[_0x5732('0x27')](saveUpdates(_0x4160e1[_0x5732('0x4b')],null))['then'](respondWithResult(_0x5b2831,null))[_0x5732('0x44')](handleError(_0x5b2831,null));};exports[_0x5732('0x28')]=function(_0x4c861c,_0x35261e){return db['SquareOdbc']['find']({'where':{'id':_0x4c861c[_0x5732('0x46')]['id']}})[_0x5732('0x27')](handleEntityNotFound(_0x35261e,null))[_0x5732('0x27')](removeEntity(_0x35261e,null))[_0x5732('0x44')](handleError(_0x35261e,null));};exports[_0x5732('0x53')]=function(_0x64b27b,_0x4a77ac,_0x501f61){var _0x561100;return db[_0x5732('0x30')][_0x5732('0x50')]({'where':{'id':_0x64b27b[_0x5732('0x46')]['id']},'attributes':['id',_0x5732('0x54')]})[_0x5732('0x27')](handleEntityNotFound(_0x4a77ac,null))[_0x5732('0x27')](function(_0x6205ff){if(_0x6205ff){var _0x180682=require(_0x5732('0x55'))();_0x180682[_0x5732('0x56')](_0x6205ff[_0x5732('0x54')]);_0x180682[_0x5732('0x57')]();return _0x6205ff;}})['then'](respondWithResult(_0x4a77ac,null))['catch'](handleError(_0x4a77ac,null));}; \ No newline at end of file +var _0x2ecb=['test','dsn','odbc','openSync','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','Content-Range','json','apply','reject','update','destroy','ODBC','UserProfileResource','then','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','SquareOdbc','findAll','rows','catch','show','params','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x27277a,_0x253e71){var _0x20d964=function(_0x1415d4){while(--_0x1415d4){_0x27277a['push'](_0x27277a['shift']());}};_0x20d964(++_0x253e71);}(_0x2ecb,0xb2));var _0xb2ec=function(_0x2197c3,_0x310b38){_0x2197c3=_0x2197c3-0x0;var _0x120c87=_0x2ecb[_0x2197c3];return _0x120c87;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb2ec('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2ec('0x1'));var moment=require(_0xb2ec('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb2ec('0x3'));var util=require('util');var path=require(_0xb2ec('0x4'));var sox=require(_0xb2ec('0x5'));var csv=require(_0xb2ec('0x6'));var ejs=require(_0xb2ec('0x7'));var fs=require('fs');var fs_extra=require(_0xb2ec('0x8'));var _=require(_0xb2ec('0x9'));var squel=require(_0xb2ec('0xa'));var crypto=require(_0xb2ec('0xb'));var jsforce=require(_0xb2ec('0xc'));var deskjs=require(_0xb2ec('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb2ec('0xe'));var Papa=require(_0xb2ec('0xf'));var Redis=require(_0xb2ec('0x10'));var authService=require(_0xb2ec('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb2ec('0x12'));var hardwareService=require(_0xb2ec('0x13'));var logger=require(_0xb2ec('0x14'))(_0xb2ec('0x15'));var utils=require(_0xb2ec('0x16'));var config=require(_0xb2ec('0x17'));var licenseUtil=require(_0xb2ec('0x18'));var db=require(_0xb2ec('0x19'))['db'];function respondWithStatusCode(_0x2ba21f,_0x463a3f){_0x463a3f=_0x463a3f||0xcc;return function(_0x3e8aa9){if(_0x3e8aa9){return _0x2ba21f[_0xb2ec('0x1a')](_0x463a3f);}return _0x2ba21f['status'](_0x463a3f)['end']();};}function respondWithResult(_0x4bdbc9,_0x23f8e3){_0x23f8e3=_0x23f8e3||0xc8;return function(_0x4cfa37){if(_0x4cfa37){return _0x4bdbc9['status'](_0x23f8e3)['json'](_0x4cfa37);}};}function respondWithFilteredResult(_0x5100bd,_0x29e92d){return function(_0x3b2762){if(_0x3b2762){var _0x50a3a7=typeof _0x29e92d[_0xb2ec('0x1b')]===_0xb2ec('0x1c')&&typeof _0x29e92d[_0xb2ec('0x1d')]===_0xb2ec('0x1c');var _0x587f7b=_0x3b2762[_0xb2ec('0x1e')];var _0x3c618a=_0x50a3a7?0x0:_0x29e92d[_0xb2ec('0x1b')];var _0x10a6b6=_0x50a3a7?_0x3b2762[_0xb2ec('0x1e')]:_0x29e92d[_0xb2ec('0x1b')]+_0x29e92d['limit'];var _0x39dc50;if(_0x10a6b6>=_0x587f7b){_0x10a6b6=_0x587f7b;_0x39dc50=0xc8;}else{_0x39dc50=0xce;}_0x5100bd[_0xb2ec('0x1f')](_0x39dc50);return _0x5100bd['set'](_0xb2ec('0x20'),_0x3c618a+'-'+_0x10a6b6+'/'+_0x587f7b)[_0xb2ec('0x21')](_0x3b2762);}return null;};}function patchUpdates(_0x47a639){return function(_0x40c0be){try{jsonpatch[_0xb2ec('0x22')](_0x40c0be,_0x47a639,!![]);}catch(_0x2cb439){return BPromise[_0xb2ec('0x23')](_0x2cb439);}return _0x40c0be['save']();};}function saveUpdates(_0x6e49c2,_0x88dca9){return function(_0x4a1480){if(_0x4a1480){return _0x4a1480[_0xb2ec('0x24')](_0x6e49c2)['then'](function(_0x224d2a){return _0x224d2a;});}return null;};}function removeEntity(_0x4b25e7,_0x1aeff4){return function(_0x9237f3){if(_0x9237f3){return _0x9237f3[_0xb2ec('0x25')]()['then'](function(){var _0x387ac2=_0x9237f3['get']({'plain':!![]});var _0x58c0ae=_0xb2ec('0x26');return db[_0xb2ec('0x27')][_0xb2ec('0x25')]({'where':{'type':_0x58c0ae,'resourceId':_0x387ac2['id']}})[_0xb2ec('0x28')](function(){return _0x9237f3;});})[_0xb2ec('0x28')](function(){_0x4b25e7[_0xb2ec('0x1f')](0xcc)[_0xb2ec('0x29')]();});}};}function handleEntityNotFound(_0x428606,_0xce97da){return function(_0x14cb2b){if(!_0x14cb2b){_0x428606['sendStatus'](0x194);}return _0x14cb2b;};}function handleError(_0x297ea7,_0x336255){_0x336255=_0x336255||0x1f4;return function(_0x4d09ae){logger[_0xb2ec('0x2a')](_0x4d09ae[_0xb2ec('0x2b')]);if(_0x4d09ae['name']){delete _0x4d09ae[_0xb2ec('0x2c')];}_0x297ea7[_0xb2ec('0x1f')](_0x336255)['send'](_0x4d09ae);};}exports[_0xb2ec('0x2d')]=function(_0x5822d4,_0x137059){var _0x129d1c={},_0xc44be4={},_0xfbbf2a={'count':0x0,'rows':[]};var _0x4f081b=_['map'](db['SquareOdbc'][_0xb2ec('0x2e')],function(_0x21b8b0){return{'name':_0x21b8b0[_0xb2ec('0x2f')],'type':_0x21b8b0[_0xb2ec('0x30')][_0xb2ec('0x31')]};});_0xc44be4[_0xb2ec('0x32')]=_[_0xb2ec('0x33')](_0x4f081b,_0xb2ec('0x2c'));_0xc44be4[_0xb2ec('0x34')]=_[_0xb2ec('0x35')](_0x5822d4[_0xb2ec('0x34')]);_0xc44be4[_0xb2ec('0x36')]=_[_0xb2ec('0x37')](_0xc44be4[_0xb2ec('0x32')],_0xc44be4['query']);_0x129d1c[_0xb2ec('0x38')]=_[_0xb2ec('0x37')](_0xc44be4[_0xb2ec('0x32')],qs['fields'](_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x39')]));_0x129d1c['attributes']=_0x129d1c[_0xb2ec('0x38')][_0xb2ec('0x3a')]?_0x129d1c[_0xb2ec('0x38')]:_0xc44be4[_0xb2ec('0x32')];if(!_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x3b')]('nolimit')){_0x129d1c['limit']=qs['limit'](_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x1d')]);_0x129d1c[_0xb2ec('0x1b')]=qs[_0xb2ec('0x1b')](_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x1b')]);}_0x129d1c[_0xb2ec('0x3c')]=qs[_0xb2ec('0x3d')](_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x3d')]);_0x129d1c[_0xb2ec('0x3e')]=qs[_0xb2ec('0x36')](_[_0xb2ec('0x3f')](_0x5822d4['query'],_0xc44be4[_0xb2ec('0x36')]),_0x4f081b);if(_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x40')]){_0x129d1c[_0xb2ec('0x3e')]=_[_0xb2ec('0x41')](_0x129d1c['where'],{'$or':_[_0xb2ec('0x33')](_0x4f081b,function(_0x11a8b7){if(_0x11a8b7['type']!==_0xb2ec('0x42')){var _0x5681c1={};_0x5681c1[_0x11a8b7[_0xb2ec('0x2c')]]={'$like':'%'+_0x5822d4[_0xb2ec('0x34')][_0xb2ec('0x40')]+'%'};return _0x5681c1;}})});}_0x129d1c=_[_0xb2ec('0x41')]({},_0x129d1c,_0x5822d4['options']);var _0x57eb6a={'where':_0x129d1c[_0xb2ec('0x3e')]};return db['SquareOdbc']['count'](_0x57eb6a)[_0xb2ec('0x28')](function(_0x5552dc){_0xfbbf2a[_0xb2ec('0x1e')]=_0x5552dc;if(_0x5822d4['query']['includeAll']){_0x129d1c[_0xb2ec('0x43')]=[{'all':!![]}];}return db[_0xb2ec('0x44')][_0xb2ec('0x45')](_0x129d1c);})[_0xb2ec('0x28')](function(_0x1476e2){_0xfbbf2a[_0xb2ec('0x46')]=_0x1476e2;return _0xfbbf2a;})[_0xb2ec('0x28')](respondWithFilteredResult(_0x137059,_0x129d1c))[_0xb2ec('0x47')](handleError(_0x137059,null));};exports[_0xb2ec('0x48')]=function(_0x9d092f,_0x23a3a1){var _0xc63aba={'raw':!![],'where':{'id':_0x9d092f[_0xb2ec('0x49')]['id']}},_0x58dfec={};_0x58dfec['model']=_['keys'](db[_0xb2ec('0x44')][_0xb2ec('0x2e')]);_0x58dfec[_0xb2ec('0x34')]=_[_0xb2ec('0x35')](_0x9d092f[_0xb2ec('0x34')]);_0x58dfec['filters']=_[_0xb2ec('0x37')](_0x58dfec[_0xb2ec('0x32')],_0x58dfec[_0xb2ec('0x34')]);_0xc63aba[_0xb2ec('0x38')]=_[_0xb2ec('0x37')](_0x58dfec[_0xb2ec('0x32')],qs[_0xb2ec('0x39')](_0x9d092f[_0xb2ec('0x34')][_0xb2ec('0x39')]));_0xc63aba[_0xb2ec('0x38')]=_0xc63aba['attributes']['length']?_0xc63aba[_0xb2ec('0x38')]:_0x58dfec[_0xb2ec('0x32')];if(_0x9d092f['query'][_0xb2ec('0x4a')]){_0xc63aba['include']=[{'all':!![]}];}_0xc63aba=_[_0xb2ec('0x41')]({},_0xc63aba,_0x9d092f['options']);return db[_0xb2ec('0x44')]['find'](_0xc63aba)[_0xb2ec('0x28')](handleEntityNotFound(_0x23a3a1,null))[_0xb2ec('0x28')](respondWithResult(_0x23a3a1,null))[_0xb2ec('0x47')](handleError(_0x23a3a1,null));};exports[_0xb2ec('0x4b')]=function(_0x104ba9,_0x1dcd3d){return db['SquareOdbc']['create'](_0x104ba9[_0xb2ec('0x4c')],{})['then'](function(_0x28fc66){var _0x4da594=_0x104ba9['user'][_0xb2ec('0x4d')]({'plain':!![]});if(!_0x4da594)throw new Error(_0xb2ec('0x4e'));if(_0x4da594[_0xb2ec('0x4f')]==='user'){var _0x59f2a4=_0x28fc66[_0xb2ec('0x4d')]({'plain':!![]});var _0x2c53dd=_0xb2ec('0x26');return db['UserProfileSection'][_0xb2ec('0x50')]({'where':{'name':_0x2c53dd,'userProfileId':_0x4da594[_0xb2ec('0x51')]},'raw':!![]})[_0xb2ec('0x28')](function(_0x19cfdc){if(_0x19cfdc&&_0x19cfdc['autoAssociation']===0x0){return db[_0xb2ec('0x27')][_0xb2ec('0x4b')]({'name':_0x59f2a4[_0xb2ec('0x2c')],'resourceId':_0x59f2a4['id'],'type':_0x19cfdc[_0xb2ec('0x2c')],'sectionId':_0x19cfdc['id']},{})['then'](function(){return _0x28fc66;});}else{return _0x28fc66;}})[_0xb2ec('0x47')](function(_0x31ac59){logger[_0xb2ec('0x2a')](_0xb2ec('0x52'),_0x31ac59);throw _0x31ac59;});}return _0x28fc66;})[_0xb2ec('0x28')](respondWithResult(_0x1dcd3d,0xc9))[_0xb2ec('0x47')](handleError(_0x1dcd3d,null));};exports[_0xb2ec('0x24')]=function(_0x5df76e,_0x4891c5){if(_0x5df76e[_0xb2ec('0x4c')]['id']){delete _0x5df76e[_0xb2ec('0x4c')]['id'];}return db[_0xb2ec('0x44')][_0xb2ec('0x50')]({'where':{'id':_0x5df76e[_0xb2ec('0x49')]['id']}})[_0xb2ec('0x28')](handleEntityNotFound(_0x4891c5,null))['then'](saveUpdates(_0x5df76e[_0xb2ec('0x4c')],null))[_0xb2ec('0x28')](respondWithResult(_0x4891c5,null))[_0xb2ec('0x47')](handleError(_0x4891c5,null));};exports[_0xb2ec('0x25')]=function(_0x5021d1,_0x32d09b){return db['SquareOdbc'][_0xb2ec('0x50')]({'where':{'id':_0x5021d1[_0xb2ec('0x49')]['id']}})[_0xb2ec('0x28')](handleEntityNotFound(_0x32d09b,null))['then'](removeEntity(_0x32d09b,null))[_0xb2ec('0x47')](handleError(_0x32d09b,null));};exports[_0xb2ec('0x53')]=function(_0x32ebf2,_0x15d8d1,_0x5b46a3){var _0xa50c3b;return db['SquareOdbc'][_0xb2ec('0x50')]({'where':{'id':_0x32ebf2['params']['id']},'attributes':['id',_0xb2ec('0x54')]})[_0xb2ec('0x28')](handleEntityNotFound(_0x15d8d1,null))[_0xb2ec('0x28')](function(_0x1dedb1){if(_0x1dedb1){var _0x4c373f=require(_0xb2ec('0x55'))();_0x4c373f[_0xb2ec('0x56')](_0x1dedb1[_0xb2ec('0x54')]);_0x4c373f['closeSync']();return _0x1dedb1;}})['then'](respondWithResult(_0x15d8d1,null))['catch'](handleError(_0x15d8d1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f883cd5..0d19896 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 _0xaf98=['rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f52d9,_0x1d748c){var _0x21e01f=function(_0x22e584){while(--_0x22e584){_0x3f52d9['push'](_0x3f52d9['shift']());}};_0x21e01f(++_0x1d748c);}(_0xaf98,0xc0));var _0x8af9=function(_0x53a7d2,_0x30e104){_0x53a7d2=_0x53a7d2-0x0;var _0x701d8d=_0xaf98[_0x53a7d2];return _0x701d8d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8af9('0x0'))(_0x8af9('0x1'));var moment=require(_0x8af9('0x2'));var BPromise=require(_0x8af9('0x3'));var rp=require(_0x8af9('0x4'));var fs=require('fs');var path=require(_0x8af9('0x5'));var rimraf=require(_0x8af9('0x6'));var config=require('../../config/environment');var attributes=require(_0x8af9('0x7'));module[_0x8af9('0x8')]=function(_0x3b497c,_0x21d776){return _0x3b497c[_0x8af9('0x9')](_0x8af9('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce88=['lodash','util','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce88,0x17a));var _0x8ce8=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xce88[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x8ce8('0x0'));var util=require(_0x8ce8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ce8('0x2'));var rimraf=require(_0x8ce8('0x3'));var config=require(_0x8ce8('0x4'));var attributes=require('./squareOdbc.attributes');module[_0x8ce8('0x5')]=function(_0x2e64a8,_0x531b4c){return _0x2e64a8[_0x8ce8('0x6')](_0x8ce8('0x7'),attributes,{'tableName':_0x8ce8('0x8'),'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 32cc7a3..235781f 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 _0xf7ce=['code','message','result','catch','SquareOdbc','find','options','raw','where','map','include','model','attributes','ShowSquareOdbc','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x44d9f5,_0x3e3589){var _0xe3703f=function(_0x391925){while(--_0x391925){_0x44d9f5['push'](_0x44d9f5['shift']());}};_0xe3703f(++_0x3e3589);}(_0xf7ce,0x184));var _0xef7c=function(_0x3d3b05,_0x334c57){_0x3d3b05=_0x3d3b05-0x0;var _0x2c6ca3=_0xf7ce[_0x3d3b05];return _0x2c6ca3;};'use strict';var _=require(_0xef7c('0x0'));var util=require(_0xef7c('0x1'));var moment=require(_0xef7c('0x2'));var BPromise=require('bluebird');var rs=require(_0xef7c('0x3'));var fs=require('fs');var Redis=require(_0xef7c('0x4'));var db=require(_0xef7c('0x5'))['db'];var utils=require(_0xef7c('0x6'));var logger=require(_0xef7c('0x7'))(_0xef7c('0x8'));var config=require('../../config/environment');var jayson=require(_0xef7c('0x9'));var client=jayson[_0xef7c('0xa')][_0xef7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c1a51,_0x49120d,_0x51a1ac){return new BPromise(function(_0x2c99b1,_0x1a4caa){return client['request'](_0x1c1a51,_0x51a1ac)[_0xef7c('0xc')](function(_0x524542){logger[_0xef7c('0xd')](_0xef7c('0xe'),_0x49120d,_0xef7c('0xf'));logger[_0xef7c('0x10')](_0xef7c('0x11'),_0x49120d,_0xef7c('0xf'),JSON[_0xef7c('0x12')](_0x524542));if(_0x524542[_0xef7c('0x13')]){if(_0x524542[_0xef7c('0x13')][_0xef7c('0x14')]===0x1f4){logger[_0xef7c('0x13')](_0xef7c('0xe'),_0x49120d,_0x524542[_0xef7c('0x13')]['message']);return _0x1a4caa(_0x524542[_0xef7c('0x13')][_0xef7c('0x15')]);}logger['error'](_0xef7c('0xe'),_0x49120d,_0x524542[_0xef7c('0x13')][_0xef7c('0x15')]);return _0x2c99b1(_0x524542['error'][_0xef7c('0x15')]);}else{logger[_0xef7c('0xd')](_0xef7c('0xe'),_0x49120d,'request\x20sent');_0x2c99b1(_0x524542[_0xef7c('0x16')][_0xef7c('0x15')]);}})[_0xef7c('0x17')](function(_0x14940c){logger[_0xef7c('0x13')](_0xef7c('0xe'),_0x49120d,_0x14940c);_0x1a4caa(_0x14940c);});});}exports['ShowSquareOdbc']=function(_0x2b3960){var _0x671433=this;return new Promise(function(_0x402dcb,_0x1ef531){return db[_0xef7c('0x18')][_0xef7c('0x19')]({'raw':_0x2b3960[_0xef7c('0x1a')]?_0x2b3960[_0xef7c('0x1a')][_0xef7c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b3960[_0xef7c('0x1a')]?_0x2b3960[_0xef7c('0x1a')][_0xef7c('0x1c')]||null:null,'attributes':_0x2b3960[_0xef7c('0x1a')]?_0x2b3960[_0xef7c('0x1a')]['attributes']||null:null,'include':_0x2b3960[_0xef7c('0x1a')]?_0x2b3960[_0xef7c('0x1a')]['include']?_[_0xef7c('0x1d')](_0x2b3960[_0xef7c('0x1a')][_0xef7c('0x1e')],function(_0x39163f){return{'model':db[_0x39163f[_0xef7c('0x1f')]],'as':_0x39163f['as'],'attributes':_0x39163f['attributes'],'include':_0x39163f[_0xef7c('0x1e')]?_[_0xef7c('0x1d')](_0x39163f[_0xef7c('0x1e')],function(_0x381eca){return{'model':db[_0x381eca[_0xef7c('0x1f')]],'as':_0x381eca['as'],'attributes':_0x381eca[_0xef7c('0x20')],'include':_0x381eca[_0xef7c('0x1e')]?_[_0xef7c('0x1d')](_0x381eca['include'],function(_0x4cbc00){return{'model':db[_0x4cbc00[_0xef7c('0x1f')]],'as':_0x4cbc00['as'],'attributes':_0x4cbc00[_0xef7c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xef7c('0xc')](function(_0x168e43){logger['info']('ShowSquareOdbc',_0x2b3960);logger[_0xef7c('0x10')](_0xef7c('0x21'),_0x2b3960,JSON[_0xef7c('0x12')](_0x168e43));_0x402dcb(_0x168e43);})[_0xef7c('0x17')](function(_0x480a32){logger['error']('ShowSquareOdbc',_0x480a32[_0xef7c('0x15')],_0x2b3960);_0x1ef531(_0x671433[_0xef7c('0x13')](0x1f4,_0x480a32[_0xef7c('0x15')]));});});}; \ No newline at end of file +var _0xac25=['error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','model','map','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x359433,_0x2398b0){var _0x2db8ab=function(_0xefac8f){while(--_0xefac8f){_0x359433['push'](_0x359433['shift']());}};_0x2db8ab(++_0x2398b0);}(_0xac25,0x107));var _0x5ac2=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xac25[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x5ac2('0x0'));var util=require('util');var moment=require(_0x5ac2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac2('0x2'));var db=require(_0x5ac2('0x3'))['db'];var utils=require(_0x5ac2('0x4'));var logger=require(_0x5ac2('0x5'))(_0x5ac2('0x6'));var config=require('../../config/environment');var jayson=require(_0x5ac2('0x7'));var client=jayson['client'][_0x5ac2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18f10c,_0x564e63,_0x4201b2){return new BPromise(function(_0x5376a3,_0x202bc2){return client[_0x5ac2('0x9')](_0x18f10c,_0x4201b2)[_0x5ac2('0xa')](function(_0x2eb30d){logger[_0x5ac2('0xb')](_0x5ac2('0xc'),_0x564e63,_0x5ac2('0xd'));logger[_0x5ac2('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x564e63,_0x5ac2('0xd'),JSON[_0x5ac2('0xf')](_0x2eb30d));if(_0x2eb30d[_0x5ac2('0x10')]){if(_0x2eb30d['error'][_0x5ac2('0x11')]===0x1f4){logger[_0x5ac2('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x564e63,_0x2eb30d[_0x5ac2('0x10')]['message']);return _0x202bc2(_0x2eb30d[_0x5ac2('0x10')][_0x5ac2('0x12')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x564e63,_0x2eb30d[_0x5ac2('0x10')]['message']);return _0x5376a3(_0x2eb30d[_0x5ac2('0x10')][_0x5ac2('0x12')]);}else{logger[_0x5ac2('0xb')](_0x5ac2('0xc'),_0x564e63,_0x5ac2('0xd'));_0x5376a3(_0x2eb30d[_0x5ac2('0x13')][_0x5ac2('0x12')]);}})[_0x5ac2('0x14')](function(_0x5017d2){logger[_0x5ac2('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x564e63,_0x5017d2);_0x202bc2(_0x5017d2);});});}exports[_0x5ac2('0x15')]=function(_0x3ae29f){var _0x3501fb=this;return new Promise(function(_0x95057d,_0x6b9cf1){return db[_0x5ac2('0x16')][_0x5ac2('0x17')]({'raw':_0x3ae29f[_0x5ac2('0x18')]?_0x3ae29f[_0x5ac2('0x18')][_0x5ac2('0x19')]===undefined?!![]:![]:!![],'where':_0x3ae29f['options']?_0x3ae29f[_0x5ac2('0x18')][_0x5ac2('0x1a')]||null:null,'attributes':_0x3ae29f[_0x5ac2('0x18')]?_0x3ae29f[_0x5ac2('0x18')][_0x5ac2('0x1b')]||null:null,'include':_0x3ae29f[_0x5ac2('0x18')]?_0x3ae29f[_0x5ac2('0x18')][_0x5ac2('0x1c')]?_['map'](_0x3ae29f['options'][_0x5ac2('0x1c')],function(_0x10a59c){return{'model':db[_0x10a59c[_0x5ac2('0x1d')]],'as':_0x10a59c['as'],'attributes':_0x10a59c[_0x5ac2('0x1b')],'include':_0x10a59c[_0x5ac2('0x1c')]?_[_0x5ac2('0x1e')](_0x10a59c['include'],function(_0x127be7){return{'model':db[_0x127be7[_0x5ac2('0x1d')]],'as':_0x127be7['as'],'attributes':_0x127be7[_0x5ac2('0x1b')],'include':_0x127be7[_0x5ac2('0x1c')]?_[_0x5ac2('0x1e')](_0x127be7[_0x5ac2('0x1c')],function(_0x5c6071){return{'model':db[_0x5c6071['model']],'as':_0x5c6071['as'],'attributes':_0x5c6071['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ac2('0xa')](function(_0x52610a){logger[_0x5ac2('0xb')](_0x5ac2('0x15'),_0x3ae29f);logger[_0x5ac2('0xe')]('ShowSquareOdbc',_0x3ae29f,JSON['stringify'](_0x52610a));_0x95057d(_0x52610a);})['catch'](function(_0x5a6e74){logger[_0x5ac2('0x10')](_0x5ac2('0x15'),_0x5a6e74['message'],_0x3ae29f);_0x6b9cf1(_0x3501fb['error'](0x1f4,_0x5a6e74[_0x5ac2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4fdf046..15b7da4 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 _0xd6cb=['post','create','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xd6cb,0x1cb));var _0xbd6c=function(_0x8686c9,_0x305a8f){_0x8686c9=_0x8686c9-0x0;var _0x1dc90c=_0xd6cb[_0x8686c9];return _0x1dc90c;};'use strict';var multer=require(_0xbd6c('0x0'));var util=require(_0xbd6c('0x1'));var path=require(_0xbd6c('0x2'));var timeout=require(_0xbd6c('0x3'));var express=require(_0xbd6c('0x4'));var router=express[_0xbd6c('0x5')]();var fs_extra=require(_0xbd6c('0x6'));var auth=require(_0xbd6c('0x7'));var interaction=require(_0xbd6c('0x8'));var config=require('../../config/environment');var controller=require(_0xbd6c('0x9'));router[_0xbd6c('0xa')]('/',auth[_0xbd6c('0xb')](),controller[_0xbd6c('0xc')]);router[_0xbd6c('0xa')](_0xbd6c('0xd'),auth['isAuthenticated'](),controller[_0xbd6c('0xe')]);router['get'](_0xbd6c('0xf'),auth['isAuthenticated'](),controller['getUsers']);router[_0xbd6c('0x10')]('/',auth['isAuthenticated'](),controller[_0xbd6c('0x11')]);router[_0xbd6c('0x10')](_0xbd6c('0xf'),auth['isAuthenticated'](),controller[_0xbd6c('0x12')]);router[_0xbd6c('0x13')](_0xbd6c('0xd'),auth['isAuthenticated'](),controller[_0xbd6c('0x14')]);router[_0xbd6c('0x15')](_0xbd6c('0xd'),auth['isAuthenticated'](),controller[_0xbd6c('0x16')]);router['delete'](_0xbd6c('0xf'),auth[_0xbd6c('0xb')](),controller[_0xbd6c('0x17')]);module[_0xbd6c('0x18')]=router; \ No newline at end of file +var _0x95c3=['destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','post','addUsers','delete'];(function(_0x20f13a,_0x466089){var _0x437a36=function(_0x392e1f){while(--_0x392e1f){_0x20f13a['push'](_0x20f13a['shift']());}};_0x437a36(++_0x466089);}(_0x95c3,0x6d));var _0x395c=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x95c3[_0x565c49];return _0x20ca34;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x395c('0x0'));var timeout=require(_0x395c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x395c('0x2'));var auth=require(_0x395c('0x3'));var interaction=require(_0x395c('0x4'));var config=require(_0x395c('0x5'));var controller=require(_0x395c('0x6'));router['get']('/',auth[_0x395c('0x7')](),controller[_0x395c('0x8')]);router[_0x395c('0x9')](_0x395c('0xa'),auth[_0x395c('0x7')](),controller[_0x395c('0xb')]);router[_0x395c('0x9')](_0x395c('0xc'),auth[_0x395c('0x7')](),controller[_0x395c('0xd')]);router[_0x395c('0xe')]('/',auth[_0x395c('0x7')](),controller['create']);router[_0x395c('0xe')](_0x395c('0xc'),auth[_0x395c('0x7')](),controller[_0x395c('0xf')]);router['put'](_0x395c('0xa'),auth[_0x395c('0x7')](),controller['update']);router[_0x395c('0x10')](_0x395c('0xa'),auth[_0x395c('0x7')](),controller[_0x395c('0x11')]);router['delete'](_0x395c('0xc'),auth['isAuthenticated'](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 566e068..fa59be5 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 _0x5d91=['TEXT','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x5d91,0xf8));var _0x15d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d91[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x15d9('0x0'));module[_0x15d9('0x1')]={'name':{'type':Sequelize[_0x15d9('0x2')],'unique':_0x15d9('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x15d9('0x2')]},'notes':{'type':Sequelize[_0x15d9('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x15d9('0x5')),'get':function(){if(this[_0x15d9('0x6')](_0x15d9('0x7'))){return this[_0x15d9('0x6')]('preproduction')[_0x15d9('0x8')](_0x15d9('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x15d9('0x5')),'get':function(){if(this[_0x15d9('0x6')](_0x15d9('0xa'))){return this[_0x15d9('0x6')](_0x15d9('0xa'))[_0x15d9('0x8')](_0x15d9('0x9'));}}},'savedAt':{'type':Sequelize[_0x15d9('0xb')]},'publishedAt':{'type':Sequelize[_0x15d9('0xb')]}}; \ No newline at end of file +var _0x28a0=['getDataValue','utf8','production','toString','DATE','sequelize','STRING','name','TEXT','BLOB','long','preproduction'];(function(_0x305681,_0x2230c8){var _0xfcf133=function(_0x266e3f){while(--_0x266e3f){_0x305681['push'](_0x305681['shift']());}};_0xfcf133(++_0x2230c8);}(_0x28a0,0x155));var _0x028a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x28a0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x028a('0x0'));module['exports']={'name':{'type':Sequelize[_0x028a('0x1')],'unique':_0x028a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x028a('0x1')]},'notes':{'type':Sequelize[_0x028a('0x3')]},'preproduction':{'type':Sequelize[_0x028a('0x4')](_0x028a('0x5')),'get':function(){if(this['getDataValue'](_0x028a('0x6'))){return this[_0x028a('0x7')]('preproduction')['toString'](_0x028a('0x8'));}}},'production':{'type':Sequelize[_0x028a('0x4')]('long'),'get':function(){if(this[_0x028a('0x7')]('production')){return this[_0x028a('0x7')](_0x028a('0x9'))[_0x028a('0xa')](_0x028a('0x8'));}}},'savedAt':{'type':Sequelize[_0x028a('0xb')]},'publishedAt':{'type':Sequelize[_0x028a('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 37bf116..5479f3b 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 _0xc80d=['reject','save','update','destroy','then','get','SquareProjects','error','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','getUsers','User','order','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./squareProject.socket','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply'];(function(_0x568b0e,_0x49eae6){var _0x2fcd1e=function(_0x385bae){while(--_0x385bae){_0x568b0e['push'](_0x568b0e['shift']());}};_0x2fcd1e(++_0x49eae6);}(_0xc80d,0x98));var _0xdc80=function(_0x5bea29,_0x30842f){_0x5bea29=_0x5bea29-0x0;var _0x4dbc51=_0xc80d[_0x5bea29];return _0x4dbc51;};'use strict';var emlformat=require(_0xdc80('0x0'));var rimraf=require(_0xdc80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc80('0x2'));var rp=require(_0xdc80('0x3'));var moment=require(_0xdc80('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdc80('0x5'));var util=require(_0xdc80('0x6'));var path=require(_0xdc80('0x7'));var sox=require(_0xdc80('0x8'));var csv=require(_0xdc80('0x9'));var ejs=require(_0xdc80('0xa'));var fs=require('fs');var fs_extra=require(_0xdc80('0xb'));var _=require('lodash');var squel=require(_0xdc80('0xc'));var crypto=require(_0xdc80('0xd'));var jsforce=require(_0xdc80('0xe'));var deskjs=require(_0xdc80('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdc80('0x10'));var Papa=require(_0xdc80('0x11'));var Redis=require(_0xdc80('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdc80('0x13'));var hardwareService=require(_0xdc80('0x14'));var logger=require(_0xdc80('0x15'))(_0xdc80('0x16'));var utils=require(_0xdc80('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc80('0x18'))['db'];config[_0xdc80('0x19')]=_[_0xdc80('0x1a')](config[_0xdc80('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc80('0x19')]));require(_0xdc80('0x1b'))['register'](socket);function respondWithStatusCode(_0x26c125,_0x484c83){_0x484c83=_0x484c83||0xcc;return function(_0x10a27d){if(_0x10a27d){return _0x26c125[_0xdc80('0x1c')](_0x484c83);}return _0x26c125['status'](_0x484c83)[_0xdc80('0x1d')]();};}function respondWithResult(_0x4be963,_0x592032){_0x592032=_0x592032||0xc8;return function(_0x745bc5){if(_0x745bc5){return _0x4be963[_0xdc80('0x1e')](_0x592032)[_0xdc80('0x1f')](_0x745bc5);}};}function respondWithFilteredResult(_0x52a1d7,_0x175d3d){return function(_0x2ca071){if(_0x2ca071){var _0x353dcf=typeof _0x175d3d[_0xdc80('0x20')]===_0xdc80('0x21')&&typeof _0x175d3d[_0xdc80('0x22')]===_0xdc80('0x21');var _0x232482=_0x2ca071['count'];var _0x3e5af4=_0x353dcf?0x0:_0x175d3d[_0xdc80('0x20')];var _0x2c7ef5=_0x353dcf?_0x2ca071['count']:_0x175d3d['offset']+_0x175d3d[_0xdc80('0x22')];var _0x3f3a99;if(_0x2c7ef5>=_0x232482){_0x2c7ef5=_0x232482;_0x3f3a99=0xc8;}else{_0x3f3a99=0xce;}_0x52a1d7[_0xdc80('0x1e')](_0x3f3a99);return _0x52a1d7[_0xdc80('0x23')](_0xdc80('0x24'),_0x3e5af4+'-'+_0x2c7ef5+'/'+_0x232482)[_0xdc80('0x1f')](_0x2ca071);}return null;};}function patchUpdates(_0x321fe3){return function(_0x650c13){try{jsonpatch[_0xdc80('0x25')](_0x650c13,_0x321fe3,!![]);}catch(_0x45c217){return BPromise[_0xdc80('0x26')](_0x45c217);}return _0x650c13[_0xdc80('0x27')]();};}function saveUpdates(_0x1ded52,_0x26d5e5){return function(_0xf42009){if(_0xf42009){return _0xf42009[_0xdc80('0x28')](_0x1ded52)['then'](function(_0x1ae7e0){return _0x1ae7e0;});}return null;};}function removeEntity(_0xc59772,_0x49b037){return function(_0x1e6829){if(_0x1e6829){return _0x1e6829[_0xdc80('0x29')]()[_0xdc80('0x2a')](function(){var _0x2179da=_0x1e6829[_0xdc80('0x2b')]({'plain':!![]});var _0x340091=_0xdc80('0x2c');return db['UserProfileResource'][_0xdc80('0x29')]({'where':{'type':_0x340091,'resourceId':_0x2179da['id']}})[_0xdc80('0x2a')](function(){return _0x1e6829;});})['then'](function(){_0xc59772[_0xdc80('0x1e')](0xcc)[_0xdc80('0x1d')]();});}};}function handleEntityNotFound(_0x5212c1,_0x397d2d){return function(_0x4328e4){if(!_0x4328e4){_0x5212c1[_0xdc80('0x1c')](0x194);}return _0x4328e4;};}function handleError(_0x35cafb,_0x5f34df){_0x5f34df=_0x5f34df||0x1f4;return function(_0x4e34c0){logger[_0xdc80('0x2d')](_0x4e34c0['stack']);if(_0x4e34c0['name']){delete _0x4e34c0[_0xdc80('0x2e')];}_0x35cafb[_0xdc80('0x1e')](_0x5f34df)[_0xdc80('0x2f')](_0x4e34c0);};}exports['index']=function(_0x199cb0,_0x108590){var _0x20040c={},_0x3bc9e9={},_0x1892da={'count':0x0,'rows':[]};var _0x5c9940=_[_0xdc80('0x30')](db[_0xdc80('0x31')][_0xdc80('0x32')],function(_0x2362d7){return{'name':_0x2362d7[_0xdc80('0x33')],'type':_0x2362d7[_0xdc80('0x34')][_0xdc80('0x35')]};});_0x3bc9e9[_0xdc80('0x36')]=_[_0xdc80('0x30')](_0x5c9940,_0xdc80('0x2e'));_0x3bc9e9[_0xdc80('0x37')]=_[_0xdc80('0x38')](_0x199cb0['query']);_0x3bc9e9[_0xdc80('0x39')]=_[_0xdc80('0x3a')](_0x3bc9e9[_0xdc80('0x36')],_0x3bc9e9[_0xdc80('0x37')]);_0x20040c[_0xdc80('0x3b')]=_[_0xdc80('0x3a')](_0x3bc9e9[_0xdc80('0x36')],qs[_0xdc80('0x3c')](_0x199cb0[_0xdc80('0x37')][_0xdc80('0x3c')]));_0x20040c[_0xdc80('0x3b')]=_0x20040c['attributes']['length']?_0x20040c['attributes']:_0x3bc9e9[_0xdc80('0x36')];if(!_0x199cb0[_0xdc80('0x37')][_0xdc80('0x3d')](_0xdc80('0x3e'))){_0x20040c[_0xdc80('0x22')]=qs[_0xdc80('0x22')](_0x199cb0['query'][_0xdc80('0x22')]);_0x20040c[_0xdc80('0x20')]=qs[_0xdc80('0x20')](_0x199cb0[_0xdc80('0x37')][_0xdc80('0x20')]);}_0x20040c['order']=qs['sort'](_0x199cb0[_0xdc80('0x37')][_0xdc80('0x3f')]);_0x20040c[_0xdc80('0x40')]=qs[_0xdc80('0x39')](_[_0xdc80('0x41')](_0x199cb0[_0xdc80('0x37')],_0x3bc9e9[_0xdc80('0x39')]),_0x5c9940);if(_0x199cb0[_0xdc80('0x37')][_0xdc80('0x42')]){_0x20040c['where']=_[_0xdc80('0x43')](_0x20040c[_0xdc80('0x40')],{'$or':_[_0xdc80('0x30')](_0x5c9940,function(_0x4b3c08){if(_0x4b3c08[_0xdc80('0x34')]!==_0xdc80('0x44')){var _0x5237db={};_0x5237db[_0x4b3c08[_0xdc80('0x2e')]]={'$like':'%'+_0x199cb0[_0xdc80('0x37')][_0xdc80('0x42')]+'%'};return _0x5237db;}})});}_0x20040c=_['merge']({},_0x20040c,_0x199cb0['options']);var _0x207877={'where':_0x20040c[_0xdc80('0x40')]};return db['SquareProject']['count'](_0x207877)[_0xdc80('0x2a')](function(_0x9652fc){_0x1892da['count']=_0x9652fc;if(_0x199cb0['query'][_0xdc80('0x45')]){_0x20040c[_0xdc80('0x46')]=[{'all':!![]}];}return db['SquareProject'][_0xdc80('0x47')](_0x20040c);})[_0xdc80('0x2a')](function(_0x31043f){_0x1892da['rows']=_0x31043f;return _0x1892da;})[_0xdc80('0x2a')](respondWithFilteredResult(_0x108590,_0x20040c))[_0xdc80('0x48')](handleError(_0x108590,null));};exports[_0xdc80('0x49')]=function(_0x4eaff6,_0x290f31){var _0x107be2={'raw':![],'where':{'id':_0x4eaff6[_0xdc80('0x4a')]['id']}},_0x56e4d5={};_0x56e4d5[_0xdc80('0x36')]=_[_0xdc80('0x38')](db[_0xdc80('0x31')]['rawAttributes']);_0x56e4d5[_0xdc80('0x37')]=_[_0xdc80('0x38')](_0x4eaff6[_0xdc80('0x37')]);_0x56e4d5[_0xdc80('0x39')]=_[_0xdc80('0x3a')](_0x56e4d5['model'],_0x56e4d5[_0xdc80('0x37')]);_0x107be2[_0xdc80('0x3b')]=_[_0xdc80('0x3a')](_0x56e4d5[_0xdc80('0x36')],qs[_0xdc80('0x3c')](_0x4eaff6[_0xdc80('0x37')][_0xdc80('0x3c')]));_0x107be2[_0xdc80('0x3b')]=_0x107be2[_0xdc80('0x3b')][_0xdc80('0x4b')]?_0x107be2['attributes']:_0x56e4d5['model'];if(_0x4eaff6[_0xdc80('0x37')][_0xdc80('0x45')]){_0x107be2['include']=[{'all':!![]}];}_0x107be2=_['merge']({},_0x107be2,_0x4eaff6[_0xdc80('0x4c')]);return db[_0xdc80('0x31')]['find'](_0x107be2)[_0xdc80('0x2a')](handleEntityNotFound(_0x290f31,null))[_0xdc80('0x2a')](respondWithResult(_0x290f31,null))['catch'](handleError(_0x290f31,null));};exports[_0xdc80('0x4d')]=function(_0x44f921,_0x50596c){return db['SquareProject'][_0xdc80('0x4d')](_0x44f921['body'],{})[_0xdc80('0x2a')](function(_0x4ce7c6){var _0x1dcf14=_0x44f921['user'][_0xdc80('0x2b')]({'plain':!![]});if(!_0x1dcf14)throw new Error(_0xdc80('0x4e'));if(_0x1dcf14[_0xdc80('0x4f')]===_0xdc80('0x50')){var _0x290311=_0x4ce7c6['get']({'plain':!![]});var _0x4caaef=_0xdc80('0x2c');return db['UserProfileSection'][_0xdc80('0x51')]({'where':{'name':_0x4caaef,'userProfileId':_0x1dcf14['userProfileId']},'raw':!![]})['then'](function(_0xdf3148){if(_0xdf3148&&_0xdf3148[_0xdc80('0x52')]===0x0){return db[_0xdc80('0x53')]['create']({'name':_0x290311[_0xdc80('0x2e')],'resourceId':_0x290311['id'],'type':_0xdf3148[_0xdc80('0x2e')],'sectionId':_0xdf3148['id']},{})['then'](function(){return _0x4ce7c6;});}else{return _0x4ce7c6;}})[_0xdc80('0x48')](function(_0x40c000){logger[_0xdc80('0x2d')](_0xdc80('0x54'),_0x40c000);throw _0x40c000;});}return _0x4ce7c6;})[_0xdc80('0x2a')](respondWithResult(_0x50596c,0xc9))['catch'](handleError(_0x50596c,null));};exports[_0xdc80('0x28')]=function(_0x2793f3,_0x2d79f7){if(_0x2793f3[_0xdc80('0x55')]['id']){delete _0x2793f3['body']['id'];}return db[_0xdc80('0x31')][_0xdc80('0x51')]({'where':{'id':_0x2793f3[_0xdc80('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2d79f7,null))[_0xdc80('0x2a')](saveUpdates(_0x2793f3[_0xdc80('0x55')],null))[_0xdc80('0x2a')](respondWithResult(_0x2d79f7,null))[_0xdc80('0x48')](handleError(_0x2d79f7,null));};exports['destroy']=function(_0x458356,_0x3939fe){return db['SquareProject'][_0xdc80('0x51')]({'where':{'id':_0x458356[_0xdc80('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3939fe,null))['then'](removeEntity(_0x3939fe,null))['catch'](handleError(_0x3939fe,null));};exports[_0xdc80('0x56')]=function(_0x422131,_0x26b21f,_0x16ff4b){return db['SquareProject'][_0xdc80('0x51')]({'where':{'id':_0x422131[_0xdc80('0x4a')]['id']}})[_0xdc80('0x2a')](handleEntityNotFound(_0x26b21f,null))['then'](function(_0x2f1c3b){if(_0x2f1c3b){return _0x2f1c3b[_0xdc80('0x56')](_0x422131[_0xdc80('0x55')]['ids'],_[_0xdc80('0x57')](_0x422131[_0xdc80('0x55')],[_0xdc80('0x58'),'id'])||{});}})[_0xdc80('0x2a')](respondWithResult(_0x26b21f,null))['catch'](handleError(_0x26b21f,null));};exports[_0xdc80('0x59')]=function(_0x4a6bb8,_0x32c32d,_0x587380){return db[_0xdc80('0x31')][_0xdc80('0x51')]({'where':{'id':_0x4a6bb8[_0xdc80('0x4a')]['id']}})[_0xdc80('0x2a')](handleEntityNotFound(_0x32c32d,null))['then'](function(_0x4747eb){if(_0x4747eb){return _0x4747eb[_0xdc80('0x59')](_0x4a6bb8[_0xdc80('0x37')][_0xdc80('0x58')])[_0xdc80('0x2a')](function(){if(_[_0xdc80('0x5a')](_0x4a6bb8[_0xdc80('0x37')][_0xdc80('0x58')])){for(var _0x574531=0x0;_0x574531<_0x4a6bb8[_0xdc80('0x37')][_0xdc80('0x58')][_0xdc80('0x4b')];_0x574531+=0x1){socket['emit'](_0xdc80('0x5b'),{'UserId':Number(_0x4a6bb8[_0xdc80('0x37')]['ids'][_0x574531]),'SquareProjectId':Number(_0x4a6bb8[_0xdc80('0x4a')]['id'])});}}else{socket['emit'](_0xdc80('0x5b'),{'UserId':Number(_0x4a6bb8[_0xdc80('0x37')][_0xdc80('0x58')]),'SquareProjectId':Number(_0x4a6bb8[_0xdc80('0x4a')]['id'])});}});}})[_0xdc80('0x2a')](respondWithStatusCode(_0x32c32d,null))[_0xdc80('0x48')](handleError(_0x32c32d,null));};exports[_0xdc80('0x5c')]=function(_0x5adf48,_0x3ccff8,_0x1f561b){var _0x51c8cc={};var _0x10f7e8={};var _0x43d4d5;var _0x342590;return db[_0xdc80('0x31')]['findOne']({'where':{'id':_0x5adf48[_0xdc80('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ccff8,null))[_0xdc80('0x2a')](function(_0x52c2ed){if(_0x52c2ed){_0x43d4d5=_0x52c2ed;_0x10f7e8['model']=_[_0xdc80('0x38')](db[_0xdc80('0x5d')][_0xdc80('0x32')]);_0x10f7e8[_0xdc80('0x37')]=_[_0xdc80('0x38')](_0x5adf48[_0xdc80('0x37')]);_0x10f7e8[_0xdc80('0x39')]=_[_0xdc80('0x3a')](_0x10f7e8[_0xdc80('0x36')],_0x10f7e8[_0xdc80('0x37')]);_0x51c8cc[_0xdc80('0x3b')]=_[_0xdc80('0x3a')](_0x10f7e8[_0xdc80('0x36')],qs[_0xdc80('0x3c')](_0x5adf48[_0xdc80('0x37')][_0xdc80('0x3c')]));_0x51c8cc['attributes']=_0x51c8cc[_0xdc80('0x3b')]['length']?_0x51c8cc[_0xdc80('0x3b')]:_0x10f7e8[_0xdc80('0x36')];_0x51c8cc[_0xdc80('0x5e')]=qs[_0xdc80('0x3f')](_0x5adf48['query'][_0xdc80('0x3f')]);_0x51c8cc[_0xdc80('0x40')]=qs[_0xdc80('0x39')](_[_0xdc80('0x41')](_0x5adf48['query'],_0x10f7e8[_0xdc80('0x39')]));if(_0x5adf48[_0xdc80('0x37')][_0xdc80('0x42')]){_0x51c8cc[_0xdc80('0x40')]=_[_0xdc80('0x43')](_0x51c8cc[_0xdc80('0x40')],{'$or':_[_0xdc80('0x30')](_0x51c8cc['attributes'],function(_0x7f712c){var _0x2ff49b={};_0x2ff49b[_0x7f712c]={'$like':'%'+_0x5adf48[_0xdc80('0x37')][_0xdc80('0x42')]+'%'};return _0x2ff49b;})});}_0x51c8cc=_['merge']({},_0x51c8cc,_0x5adf48['options']);return _0x43d4d5[_0xdc80('0x5c')](_0x51c8cc);}})['then'](function(_0x4fb707){if(_0x4fb707){_0x342590=_0x4fb707['length'];if(!_0x5adf48['query'][_0xdc80('0x3d')](_0xdc80('0x3e'))){_0x51c8cc[_0xdc80('0x22')]=qs['limit'](_0x5adf48[_0xdc80('0x37')]['limit']);_0x51c8cc[_0xdc80('0x20')]=qs[_0xdc80('0x20')](_0x5adf48['query'][_0xdc80('0x20')]);}return _0x43d4d5[_0xdc80('0x5c')](_0x51c8cc);}})[_0xdc80('0x2a')](function(_0x29dee6){if(_0x29dee6){return _0x29dee6?{'count':_0x342590,'rows':_0x29dee6}:null;}})[_0xdc80('0x2a')](respondWithResult(_0x3ccff8,null))[_0xdc80('0x48')](handleError(_0x3ccff8,null));}; \ No newline at end of file +var _0xbc17=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','SquareProject','includeAll','rows','catch','params','keys','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','ids','omit','removeUsers','length','emit','userSquareProject:remove','getUsers','findOne','User','eml-format'];(function(_0x31c451,_0x266a84){var _0x2fe415=function(_0x5d3fde){while(--_0x5d3fde){_0x31c451['push'](_0x31c451['shift']());}};_0x2fe415(++_0x266a84);}(_0xbc17,0x122));var _0x7bc1=function(_0x3f0d76,_0x378fed){_0x3f0d76=_0x3f0d76-0x0;var _0x12c12e=_0xbc17[_0x3f0d76];return _0x12c12e;};'use strict';var emlformat=require(_0x7bc1('0x0'));var rimraf=require(_0x7bc1('0x1'));var zipdir=require(_0x7bc1('0x2'));var jsonpatch=require(_0x7bc1('0x3'));var rp=require(_0x7bc1('0x4'));var moment=require(_0x7bc1('0x5'));var BPromise=require(_0x7bc1('0x6'));var Mustache=require(_0x7bc1('0x7'));var util=require(_0x7bc1('0x8'));var path=require(_0x7bc1('0x9'));var sox=require(_0x7bc1('0xa'));var csv=require('to-csv');var ejs=require(_0x7bc1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bc1('0xc'));var squel=require('squel');var crypto=require(_0x7bc1('0xd'));var jsforce=require(_0x7bc1('0xe'));var deskjs=require(_0x7bc1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7bc1('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7bc1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7bc1('0x12'));var hardwareService=require(_0x7bc1('0x13'));var logger=require(_0x7bc1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7bc1('0x15'));var licenseUtil=require(_0x7bc1('0x16'));var db=require(_0x7bc1('0x17'))['db'];config[_0x7bc1('0x18')]=_[_0x7bc1('0x19')](config[_0x7bc1('0x18')],{'host':_0x7bc1('0x1a'),'port':0x18eb});var socket=require(_0x7bc1('0x1b'))(new Redis(config[_0x7bc1('0x18')]));require(_0x7bc1('0x1c'))['register'](socket);function respondWithStatusCode(_0x31dbb0,_0x4cc8bb){_0x4cc8bb=_0x4cc8bb||0xcc;return function(_0x5ded01){if(_0x5ded01){return _0x31dbb0[_0x7bc1('0x1d')](_0x4cc8bb);}return _0x31dbb0[_0x7bc1('0x1e')](_0x4cc8bb)[_0x7bc1('0x1f')]();};}function respondWithResult(_0xe8f0b2,_0x2a33a0){_0x2a33a0=_0x2a33a0||0xc8;return function(_0xfa1307){if(_0xfa1307){return _0xe8f0b2[_0x7bc1('0x1e')](_0x2a33a0)[_0x7bc1('0x20')](_0xfa1307);}};}function respondWithFilteredResult(_0x1badd3,_0x43616b){return function(_0x1f4ea9){if(_0x1f4ea9){var _0x590586=typeof _0x43616b['offset']===_0x7bc1('0x21')&&typeof _0x43616b[_0x7bc1('0x22')]===_0x7bc1('0x21');var _0x56dda1=_0x1f4ea9[_0x7bc1('0x23')];var _0x44f96b=_0x590586?0x0:_0x43616b[_0x7bc1('0x24')];var _0x4423cd=_0x590586?_0x1f4ea9['count']:_0x43616b[_0x7bc1('0x24')]+_0x43616b['limit'];var _0x507c6b;if(_0x4423cd>=_0x56dda1){_0x4423cd=_0x56dda1;_0x507c6b=0xc8;}else{_0x507c6b=0xce;}_0x1badd3['status'](_0x507c6b);return _0x1badd3['set'](_0x7bc1('0x25'),_0x44f96b+'-'+_0x4423cd+'/'+_0x56dda1)[_0x7bc1('0x20')](_0x1f4ea9);}return null;};}function patchUpdates(_0x1c11c4){return function(_0x186119){try{jsonpatch[_0x7bc1('0x26')](_0x186119,_0x1c11c4,!![]);}catch(_0x34b1b4){return BPromise[_0x7bc1('0x27')](_0x34b1b4);}return _0x186119[_0x7bc1('0x28')]();};}function saveUpdates(_0xd2a66b,_0x17f69a){return function(_0x42d856){if(_0x42d856){return _0x42d856[_0x7bc1('0x29')](_0xd2a66b)['then'](function(_0x2c150c){return _0x2c150c;});}return null;};}function removeEntity(_0x1a7a86,_0x148aa8){return function(_0x46f060){if(_0x46f060){return _0x46f060[_0x7bc1('0x2a')]()[_0x7bc1('0x2b')](function(){var _0x27643f=_0x46f060['get']({'plain':!![]});var _0xa1b822=_0x7bc1('0x2c');return db[_0x7bc1('0x2d')]['destroy']({'where':{'type':_0xa1b822,'resourceId':_0x27643f['id']}})[_0x7bc1('0x2b')](function(){return _0x46f060;});})[_0x7bc1('0x2b')](function(){_0x1a7a86['status'](0xcc)[_0x7bc1('0x1f')]();});}};}function handleEntityNotFound(_0x20948a,_0x54bd1a){return function(_0x1ff457){if(!_0x1ff457){_0x20948a[_0x7bc1('0x1d')](0x194);}return _0x1ff457;};}function handleError(_0x504134,_0x25c6bc){_0x25c6bc=_0x25c6bc||0x1f4;return function(_0x5263aa){logger[_0x7bc1('0x2e')](_0x5263aa[_0x7bc1('0x2f')]);if(_0x5263aa['name']){delete _0x5263aa[_0x7bc1('0x30')];}_0x504134['status'](_0x25c6bc)[_0x7bc1('0x31')](_0x5263aa);};}exports[_0x7bc1('0x32')]=function(_0x1907ca,_0x3b00be){var _0x21e1d2={},_0x31c8f1={},_0x24942f={'count':0x0,'rows':[]};var _0xd99367=_[_0x7bc1('0x33')](db['SquareProject'][_0x7bc1('0x34')],function(_0x2ddb70){return{'name':_0x2ddb70[_0x7bc1('0x35')],'type':_0x2ddb70['type'][_0x7bc1('0x36')]};});_0x31c8f1[_0x7bc1('0x37')]=_[_0x7bc1('0x33')](_0xd99367,'name');_0x31c8f1[_0x7bc1('0x38')]=_['keys'](_0x1907ca[_0x7bc1('0x38')]);_0x31c8f1['filters']=_[_0x7bc1('0x39')](_0x31c8f1[_0x7bc1('0x37')],_0x31c8f1['query']);_0x21e1d2[_0x7bc1('0x3a')]=_['intersection'](_0x31c8f1['model'],qs[_0x7bc1('0x3b')](_0x1907ca['query'][_0x7bc1('0x3b')]));_0x21e1d2[_0x7bc1('0x3a')]=_0x21e1d2['attributes']['length']?_0x21e1d2[_0x7bc1('0x3a')]:_0x31c8f1[_0x7bc1('0x37')];if(!_0x1907ca[_0x7bc1('0x38')][_0x7bc1('0x3c')](_0x7bc1('0x3d'))){_0x21e1d2[_0x7bc1('0x22')]=qs[_0x7bc1('0x22')](_0x1907ca[_0x7bc1('0x38')][_0x7bc1('0x22')]);_0x21e1d2['offset']=qs['offset'](_0x1907ca[_0x7bc1('0x38')]['offset']);}_0x21e1d2[_0x7bc1('0x3e')]=qs[_0x7bc1('0x3f')](_0x1907ca[_0x7bc1('0x38')]['sort']);_0x21e1d2[_0x7bc1('0x40')]=qs[_0x7bc1('0x41')](_[_0x7bc1('0x42')](_0x1907ca[_0x7bc1('0x38')],_0x31c8f1[_0x7bc1('0x41')]),_0xd99367);if(_0x1907ca[_0x7bc1('0x38')][_0x7bc1('0x43')]){_0x21e1d2[_0x7bc1('0x40')]=_[_0x7bc1('0x44')](_0x21e1d2[_0x7bc1('0x40')],{'$or':_[_0x7bc1('0x33')](_0xd99367,function(_0x341265){if(_0x341265[_0x7bc1('0x45')]!==_0x7bc1('0x46')){var _0x563e56={};_0x563e56[_0x341265[_0x7bc1('0x30')]]={'$like':'%'+_0x1907ca[_0x7bc1('0x38')]['filter']+'%'};return _0x563e56;}})});}_0x21e1d2=_[_0x7bc1('0x44')]({},_0x21e1d2,_0x1907ca[_0x7bc1('0x47')]);var _0x105cb3={'where':_0x21e1d2[_0x7bc1('0x40')]};return db[_0x7bc1('0x48')][_0x7bc1('0x23')](_0x105cb3)[_0x7bc1('0x2b')](function(_0x9e25e0){_0x24942f['count']=_0x9e25e0;if(_0x1907ca[_0x7bc1('0x38')][_0x7bc1('0x49')]){_0x21e1d2['include']=[{'all':!![]}];}return db[_0x7bc1('0x48')]['findAll'](_0x21e1d2);})['then'](function(_0x28ab12){_0x24942f[_0x7bc1('0x4a')]=_0x28ab12;return _0x24942f;})[_0x7bc1('0x2b')](respondWithFilteredResult(_0x3b00be,_0x21e1d2))[_0x7bc1('0x4b')](handleError(_0x3b00be,null));};exports['show']=function(_0x298e86,_0x5633de){var _0x2b3634={'raw':![],'where':{'id':_0x298e86[_0x7bc1('0x4c')]['id']}},_0x18b6a0={};_0x18b6a0[_0x7bc1('0x37')]=_[_0x7bc1('0x4d')](db[_0x7bc1('0x48')][_0x7bc1('0x34')]);_0x18b6a0['query']=_['keys'](_0x298e86['query']);_0x18b6a0[_0x7bc1('0x41')]=_['intersection'](_0x18b6a0[_0x7bc1('0x37')],_0x18b6a0[_0x7bc1('0x38')]);_0x2b3634['attributes']=_[_0x7bc1('0x39')](_0x18b6a0[_0x7bc1('0x37')],qs[_0x7bc1('0x3b')](_0x298e86[_0x7bc1('0x38')][_0x7bc1('0x3b')]));_0x2b3634[_0x7bc1('0x3a')]=_0x2b3634[_0x7bc1('0x3a')]['length']?_0x2b3634[_0x7bc1('0x3a')]:_0x18b6a0[_0x7bc1('0x37')];if(_0x298e86['query'][_0x7bc1('0x49')]){_0x2b3634[_0x7bc1('0x4e')]=[{'all':!![]}];}_0x2b3634=_[_0x7bc1('0x44')]({},_0x2b3634,_0x298e86[_0x7bc1('0x47')]);return db[_0x7bc1('0x48')]['find'](_0x2b3634)['then'](handleEntityNotFound(_0x5633de,null))[_0x7bc1('0x2b')](respondWithResult(_0x5633de,null))[_0x7bc1('0x4b')](handleError(_0x5633de,null));};exports[_0x7bc1('0x4f')]=function(_0xfc2db6,_0x23d071){return db[_0x7bc1('0x48')]['create'](_0xfc2db6[_0x7bc1('0x50')],{})['then'](function(_0x36483a){var _0x415137=_0xfc2db6[_0x7bc1('0x51')][_0x7bc1('0x52')]({'plain':!![]});if(!_0x415137)throw new Error(_0x7bc1('0x53'));if(_0x415137[_0x7bc1('0x54')]===_0x7bc1('0x51')){var _0x4ff0bf=_0x36483a[_0x7bc1('0x52')]({'plain':!![]});var _0x3d6ed9='SquareProjects';return db[_0x7bc1('0x55')][_0x7bc1('0x56')]({'where':{'name':_0x3d6ed9,'userProfileId':_0x415137['userProfileId']},'raw':!![]})[_0x7bc1('0x2b')](function(_0x58ef8b){if(_0x58ef8b&&_0x58ef8b[_0x7bc1('0x57')]===0x0){return db[_0x7bc1('0x2d')][_0x7bc1('0x4f')]({'name':_0x4ff0bf[_0x7bc1('0x30')],'resourceId':_0x4ff0bf['id'],'type':_0x58ef8b['name'],'sectionId':_0x58ef8b['id']},{})[_0x7bc1('0x2b')](function(){return _0x36483a;});}else{return _0x36483a;}})[_0x7bc1('0x4b')](function(_0x5aca4e){logger[_0x7bc1('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5aca4e);throw _0x5aca4e;});}return _0x36483a;})[_0x7bc1('0x2b')](respondWithResult(_0x23d071,0xc9))[_0x7bc1('0x4b')](handleError(_0x23d071,null));};exports[_0x7bc1('0x29')]=function(_0x5abedf,_0x3fc3bf){if(_0x5abedf[_0x7bc1('0x50')]['id']){delete _0x5abedf[_0x7bc1('0x50')]['id'];}return db[_0x7bc1('0x48')][_0x7bc1('0x56')]({'where':{'id':_0x5abedf['params']['id']}})['then'](handleEntityNotFound(_0x3fc3bf,null))[_0x7bc1('0x2b')](saveUpdates(_0x5abedf[_0x7bc1('0x50')],null))[_0x7bc1('0x2b')](respondWithResult(_0x3fc3bf,null))[_0x7bc1('0x4b')](handleError(_0x3fc3bf,null));};exports[_0x7bc1('0x2a')]=function(_0x35fddb,_0x4c0c15){return db[_0x7bc1('0x48')]['find']({'where':{'id':_0x35fddb[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c0c15,null))[_0x7bc1('0x2b')](removeEntity(_0x4c0c15,null))[_0x7bc1('0x4b')](handleError(_0x4c0c15,null));};exports['addUsers']=function(_0x157a4e,_0x3f828f,_0x54cced){return db['SquareProject']['find']({'where':{'id':_0x157a4e[_0x7bc1('0x4c')]['id']}})[_0x7bc1('0x2b')](handleEntityNotFound(_0x3f828f,null))[_0x7bc1('0x2b')](function(_0x3e7f6f){if(_0x3e7f6f){return _0x3e7f6f['addUsers'](_0x157a4e['body'][_0x7bc1('0x58')],_[_0x7bc1('0x59')](_0x157a4e['body'],[_0x7bc1('0x58'),'id'])||{});}})[_0x7bc1('0x2b')](respondWithResult(_0x3f828f,null))[_0x7bc1('0x4b')](handleError(_0x3f828f,null));};exports['removeUsers']=function(_0x447a03,_0x3eebfd,_0x19234d){return db[_0x7bc1('0x48')]['find']({'where':{'id':_0x447a03[_0x7bc1('0x4c')]['id']}})[_0x7bc1('0x2b')](handleEntityNotFound(_0x3eebfd,null))[_0x7bc1('0x2b')](function(_0x57057e){if(_0x57057e){return _0x57057e[_0x7bc1('0x5a')](_0x447a03['query'][_0x7bc1('0x58')])[_0x7bc1('0x2b')](function(){if(_['isArray'](_0x447a03['query'][_0x7bc1('0x58')])){for(var _0x3a0be0=0x0;_0x3a0be0<_0x447a03[_0x7bc1('0x38')][_0x7bc1('0x58')][_0x7bc1('0x5b')];_0x3a0be0+=0x1){socket[_0x7bc1('0x5c')](_0x7bc1('0x5d'),{'UserId':Number(_0x447a03[_0x7bc1('0x38')][_0x7bc1('0x58')][_0x3a0be0]),'SquareProjectId':Number(_0x447a03['params']['id'])});}}else{socket[_0x7bc1('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x447a03[_0x7bc1('0x38')][_0x7bc1('0x58')]),'SquareProjectId':Number(_0x447a03[_0x7bc1('0x4c')]['id'])});}});}})[_0x7bc1('0x2b')](respondWithStatusCode(_0x3eebfd,null))[_0x7bc1('0x4b')](handleError(_0x3eebfd,null));};exports[_0x7bc1('0x5e')]=function(_0x377152,_0x56374b,_0x56c392){var _0x462d91={};var _0x3b9319={};var _0x576268;var _0x2291aa;return db[_0x7bc1('0x48')][_0x7bc1('0x5f')]({'where':{'id':_0x377152[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x56374b,null))[_0x7bc1('0x2b')](function(_0x55dd43){if(_0x55dd43){_0x576268=_0x55dd43;_0x3b9319[_0x7bc1('0x37')]=_[_0x7bc1('0x4d')](db[_0x7bc1('0x60')]['rawAttributes']);_0x3b9319['query']=_[_0x7bc1('0x4d')](_0x377152[_0x7bc1('0x38')]);_0x3b9319[_0x7bc1('0x41')]=_['intersection'](_0x3b9319[_0x7bc1('0x37')],_0x3b9319[_0x7bc1('0x38')]);_0x462d91[_0x7bc1('0x3a')]=_['intersection'](_0x3b9319[_0x7bc1('0x37')],qs['fields'](_0x377152['query'][_0x7bc1('0x3b')]));_0x462d91[_0x7bc1('0x3a')]=_0x462d91[_0x7bc1('0x3a')]['length']?_0x462d91[_0x7bc1('0x3a')]:_0x3b9319['model'];_0x462d91[_0x7bc1('0x3e')]=qs['sort'](_0x377152[_0x7bc1('0x38')][_0x7bc1('0x3f')]);_0x462d91[_0x7bc1('0x40')]=qs[_0x7bc1('0x41')](_[_0x7bc1('0x42')](_0x377152[_0x7bc1('0x38')],_0x3b9319[_0x7bc1('0x41')]));if(_0x377152[_0x7bc1('0x38')]['filter']){_0x462d91['where']=_[_0x7bc1('0x44')](_0x462d91[_0x7bc1('0x40')],{'$or':_[_0x7bc1('0x33')](_0x462d91[_0x7bc1('0x3a')],function(_0xa60bfa){var _0x57615e={};_0x57615e[_0xa60bfa]={'$like':'%'+_0x377152[_0x7bc1('0x38')]['filter']+'%'};return _0x57615e;})});}_0x462d91=_[_0x7bc1('0x44')]({},_0x462d91,_0x377152['options']);return _0x576268[_0x7bc1('0x5e')](_0x462d91);}})[_0x7bc1('0x2b')](function(_0x674854){if(_0x674854){_0x2291aa=_0x674854[_0x7bc1('0x5b')];if(!_0x377152[_0x7bc1('0x38')][_0x7bc1('0x3c')](_0x7bc1('0x3d'))){_0x462d91[_0x7bc1('0x22')]=qs[_0x7bc1('0x22')](_0x377152[_0x7bc1('0x38')][_0x7bc1('0x22')]);_0x462d91['offset']=qs[_0x7bc1('0x24')](_0x377152['query']['offset']);}return _0x576268[_0x7bc1('0x5e')](_0x462d91);}})['then'](function(_0x125df5){if(_0x125df5){return _0x125df5?{'count':_0x2291aa,'rows':_0x125df5}:null;}})['then'](respondWithResult(_0x56374b,null))['catch'](handleError(_0x56374b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e9184d7..a18e76a 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 _0xf4ca=['save','update','emit','exports','events','SquareProject','setMaxListeners'];(function(_0x1c996b,_0x107f9b){var _0x5789ce=function(_0x19c3f0){while(--_0x19c3f0){_0x1c996b['push'](_0x1c996b['shift']());}};_0x5789ce(++_0x107f9b);}(_0xf4ca,0x177));var _0xaf4c=function(_0x3c1f15,_0x5c4902){_0x3c1f15=_0x3c1f15-0x0;var _0x555fd4=_0xf4ca[_0x3c1f15];return _0x555fd4;};'use strict';var EventEmitter=require(_0xaf4c('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xaf4c('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xaf4c('0x2')](0x0);var events={'afterCreate':_0xaf4c('0x3'),'afterUpdate':_0xaf4c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x280029){return function(_0x23f03d,_0x4119de,_0x2a3874){SquareProjectEvents['emit'](_0x280029+':'+_0x23f03d['id'],_0x23f03d);SquareProjectEvents[_0xaf4c('0x5')](_0x280029,_0x23f03d);_0x2a3874(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xaf4c('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x205b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','update'];(function(_0x46b1ce,_0x2f0c93){var _0x23524b=function(_0x38e2d8){while(--_0x38e2d8){_0x46b1ce['push'](_0x46b1ce['shift']());}};_0x23524b(++_0x2f0c93);}(_0x205b,0x82));var _0xb205=function(_0x29b17e,_0x45fac6){_0x29b17e=_0x29b17e-0x0;var _0x3452e9=_0x205b[_0x29b17e];return _0x3452e9;};'use strict';var EventEmitter=require(_0xb205('0x0'));var SquareProject=require(_0xb205('0x1'))['db'][_0xb205('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb205('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb205('0x4'),'afterDestroy':'remove'};function emitEvent(_0x180b6c){return function(_0x25a07c,_0x334baa,_0x3fd73b){SquareProjectEvents['emit'](_0x180b6c+':'+_0x25a07c['id'],_0x25a07c);SquareProjectEvents[_0xb205('0x5')](_0x180b6c,_0x25a07c);_0x3fd73b(null);};}for(var e in events){if(events[_0xb205('0x6')](e)){var event=events[e];SquareProject[_0xb205('0x7')](e,emitEvent(event));}}module[_0xb205('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 79ff1cb..179a77c 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 _0x5c8c=['define','square_projects','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x5c8c,0x1c7));var _0xc5c8=function(_0x5e4836,_0x5ecd7b){_0x5e4836=_0x5e4836-0x0;var _0x51e10a=_0x5c8c[_0x5e4836];return _0x51e10a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc5c8('0x0'))(_0xc5c8('0x1'));var moment=require(_0xc5c8('0x2'));var BPromise=require(_0xc5c8('0x3'));var rp=require(_0xc5c8('0x4'));var fs=require('fs');var path=require(_0xc5c8('0x5'));var rimraf=require('rimraf');var config=require(_0xc5c8('0x6'));var attributes=require(_0xc5c8('0x7'));module[_0xc5c8('0x8')]=function(_0x15a149,_0x43a745){return _0x15a149[_0xc5c8('0x9')]('SquareProject',attributes,{'tableName':_0xc5c8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd569e9,_0x52a322,_0xd3d8bc){if(_0xd569e9['changed']('preproduction')){_0xd569e9['savedAt']=moment()[_0xc5c8('0xb')](_0xc5c8('0xc'));}if(_0xd569e9[_0xc5c8('0xd')](_0xc5c8('0xe'))){_0xd569e9[_0xc5c8('0xf')]=moment()['format'](_0xc5c8('0xc'));}_0xd3d8bc(null,_0xd569e9);}}});}; \ No newline at end of file +var _0x3e05=['request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38a9f7,_0x247c7a){var _0x1e6840=function(_0x32b4d1){while(--_0x32b4d1){_0x38a9f7['push'](_0x38a9f7['shift']());}};_0x1e6840(++_0x247c7a);}(_0x3e05,0x1b3));var _0x53e0=function(_0x2ce26c,_0xb2e54c){_0x2ce26c=_0x2ce26c-0x0;var _0x28155f=_0x3e05[_0x2ce26c];return _0x28155f;};'use strict';var _=require(_0x53e0('0x0'));var util=require(_0x53e0('0x1'));var logger=require(_0x53e0('0x2'))(_0x53e0('0x3'));var moment=require(_0x53e0('0x4'));var BPromise=require(_0x53e0('0x5'));var rp=require(_0x53e0('0x6'));var fs=require('fs');var path=require(_0x53e0('0x7'));var rimraf=require(_0x53e0('0x8'));var config=require(_0x53e0('0x9'));var attributes=require(_0x53e0('0xa'));module[_0x53e0('0xb')]=function(_0x535610,_0x106646){return _0x535610[_0x53e0('0xc')](_0x53e0('0xd'),attributes,{'tableName':_0x53e0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8d7e3e,_0x47d36c,_0x1b3d11){if(_0x8d7e3e[_0x53e0('0xf')](_0x53e0('0x10'))){_0x8d7e3e[_0x53e0('0x11')]=moment()[_0x53e0('0x12')](_0x53e0('0x13'));}if(_0x8d7e3e[_0x53e0('0xf')]('production')){_0x8d7e3e[_0x53e0('0x14')]=moment()[_0x53e0('0x12')](_0x53e0('0x13'));}_0x1b3d11(null,_0x8d7e3e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7309cc6..c3cef3e 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 _0x1fbe=['./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','localhost','redis'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1fbe,0xef));var _0xe1fb=function(_0x2b37aa,_0x1d40dc){_0x2b37aa=_0x2b37aa-0x0;var _0x52b73d=_0x1fbe[_0x2b37aa];return _0x52b73d;};'use strict';var _=require(_0xe1fb('0x0'));var util=require(_0xe1fb('0x1'));var moment=require(_0xe1fb('0x2'));var BPromise=require(_0xe1fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1fb('0x4'));var db=require(_0xe1fb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1fb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe1fb('0x7'));var client=jayson[_0xe1fb('0x8')][_0xe1fb('0x9')]({'port':0x232a});config['redis']=_[_0xe1fb('0xa')](config['redis'],{'host':_0xe1fb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1fb('0xc')]));require(_0xe1fb('0xd'))[_0xe1fb('0xe')](socket);function respondWithRpcPromise(_0xf4fa58,_0x2e4a3f,_0x2e18b7){return new BPromise(function(_0x249e74,_0x22846f){return client[_0xe1fb('0xf')](_0xf4fa58,_0x2e18b7)[_0xe1fb('0x10')](function(_0x5be882){logger[_0xe1fb('0x11')](_0xe1fb('0x12'),_0x2e4a3f,_0xe1fb('0x13'));logger[_0xe1fb('0x14')](_0xe1fb('0x15'),_0x2e4a3f,_0xe1fb('0x13'),JSON[_0xe1fb('0x16')](_0x5be882));if(_0x5be882[_0xe1fb('0x17')]){if(_0x5be882[_0xe1fb('0x17')][_0xe1fb('0x18')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x2e4a3f,_0x5be882[_0xe1fb('0x17')][_0xe1fb('0x19')]);return _0x22846f(_0x5be882[_0xe1fb('0x17')][_0xe1fb('0x19')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x2e4a3f,_0x5be882[_0xe1fb('0x17')][_0xe1fb('0x19')]);return _0x249e74(_0x5be882[_0xe1fb('0x17')][_0xe1fb('0x19')]);}else{logger[_0xe1fb('0x11')]('SquareProject,\x20%s,\x20%s',_0x2e4a3f,_0xe1fb('0x13'));_0x249e74(_0x5be882['result'][_0xe1fb('0x19')]);}})[_0xe1fb('0x1a')](function(_0x52272e){logger[_0xe1fb('0x17')](_0xe1fb('0x12'),_0x2e4a3f,_0x52272e);_0x22846f(_0x52272e);});});}exports[_0xe1fb('0x1b')]=function(_0x5ac97a){var _0x3291e0=this;return new Promise(function(_0x4691b7,_0x4a413c){return db['SquareProject'][_0xe1fb('0x1c')]({'raw':_0x5ac97a[_0xe1fb('0x1d')]?_0x5ac97a[_0xe1fb('0x1d')][_0xe1fb('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ac97a[_0xe1fb('0x1d')]?_0x5ac97a[_0xe1fb('0x1d')][_0xe1fb('0x1f')]||null:null,'attributes':_0x5ac97a['options']?_0x5ac97a[_0xe1fb('0x1d')][_0xe1fb('0x20')]||null:null,'include':_0x5ac97a['options']?_0x5ac97a[_0xe1fb('0x1d')][_0xe1fb('0x21')]?_[_0xe1fb('0x22')](_0x5ac97a[_0xe1fb('0x1d')][_0xe1fb('0x21')],function(_0x346fbb){return{'model':db[_0x346fbb[_0xe1fb('0x23')]],'as':_0x346fbb['as'],'attributes':_0x346fbb['attributes'],'include':_0x346fbb['include']?_['map'](_0x346fbb[_0xe1fb('0x21')],function(_0x5aab71){return{'model':db[_0x5aab71['model']],'as':_0x5aab71['as'],'attributes':_0x5aab71[_0xe1fb('0x20')],'include':_0x5aab71['include']?_[_0xe1fb('0x22')](_0x5aab71[_0xe1fb('0x21')],function(_0x2e2c51){return{'model':db[_0x2e2c51[_0xe1fb('0x23')]],'as':_0x2e2c51['as'],'attributes':_0x2e2c51[_0xe1fb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe1fb('0x10')](function(_0x335594){logger['info'](_0xe1fb('0x1b'),_0x5ac97a);logger[_0xe1fb('0x14')]('ShowSquareProject',_0x5ac97a,JSON[_0xe1fb('0x16')](_0x335594));_0x4691b7(_0x335594);})['catch'](function(_0x4f51dc){logger[_0xe1fb('0x17')](_0xe1fb('0x1b'),_0x4f51dc[_0xe1fb('0x19')],_0x5ac97a);_0x4a413c(_0x3291e0[_0xe1fb('0x17')](0x1f4,_0x4f51dc[_0xe1fb('0x19')]));});});}; \ No newline at end of file +var _0x3728=['code','message','catch','ShowSquareProject','options','raw','where','attributes','include','map','model','then','debug','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3728,0x125));var _0x8372=function(_0x55737d,_0x51e0d9){_0x55737d=_0x55737d-0x0;var _0x103b90=_0x3728[_0x55737d];return _0x103b90;};'use strict';var _=require('lodash');var util=require(_0x8372('0x0'));var moment=require('moment');var BPromise=require(_0x8372('0x1'));var rs=require(_0x8372('0x2'));var fs=require('fs');var Redis=require(_0x8372('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8372('0x4'));var logger=require(_0x8372('0x5'))('rpc');var config=require(_0x8372('0x6'));var jayson=require(_0x8372('0x7'));var client=jayson[_0x8372('0x8')][_0x8372('0x9')]({'port':0x232a});config[_0x8372('0xa')]=_[_0x8372('0xb')](config[_0x8372('0xa')],{'host':_0x8372('0xc'),'port':0x18eb});var socket=require(_0x8372('0xd'))(new Redis(config[_0x8372('0xa')]));require(_0x8372('0xe'))[_0x8372('0xf')](socket);function respondWithRpcPromise(_0x5cc26e,_0x1cbd43,_0x2cd0a1){return new BPromise(function(_0x1e71de,_0x10793e){return client['request'](_0x5cc26e,_0x2cd0a1)['then'](function(_0x5dd976){logger[_0x8372('0x10')](_0x8372('0x11'),_0x1cbd43,_0x8372('0x12'));logger['debug'](_0x8372('0x13'),_0x1cbd43,_0x8372('0x12'),JSON[_0x8372('0x14')](_0x5dd976));if(_0x5dd976[_0x8372('0x15')]){if(_0x5dd976[_0x8372('0x15')][_0x8372('0x16')]===0x1f4){logger['error'](_0x8372('0x11'),_0x1cbd43,_0x5dd976[_0x8372('0x15')][_0x8372('0x17')]);return _0x10793e(_0x5dd976[_0x8372('0x15')][_0x8372('0x17')]);}logger[_0x8372('0x15')]('SquareProject,\x20%s,\x20%s',_0x1cbd43,_0x5dd976['error']['message']);return _0x1e71de(_0x5dd976['error'][_0x8372('0x17')]);}else{logger[_0x8372('0x10')](_0x8372('0x11'),_0x1cbd43,_0x8372('0x12'));_0x1e71de(_0x5dd976['result'][_0x8372('0x17')]);}})[_0x8372('0x18')](function(_0x458d45){logger[_0x8372('0x15')](_0x8372('0x11'),_0x1cbd43,_0x458d45);_0x10793e(_0x458d45);});});}exports[_0x8372('0x19')]=function(_0x111aad){var _0x2b5724=this;return new Promise(function(_0x1fcc3d,_0xa8589e){return db['SquareProject']['find']({'raw':_0x111aad[_0x8372('0x1a')]?_0x111aad[_0x8372('0x1a')][_0x8372('0x1b')]===undefined?!![]:![]:!![],'where':_0x111aad[_0x8372('0x1a')]?_0x111aad[_0x8372('0x1a')][_0x8372('0x1c')]||null:null,'attributes':_0x111aad[_0x8372('0x1a')]?_0x111aad[_0x8372('0x1a')][_0x8372('0x1d')]||null:null,'include':_0x111aad[_0x8372('0x1a')]?_0x111aad[_0x8372('0x1a')][_0x8372('0x1e')]?_['map'](_0x111aad['options']['include'],function(_0x23167b){return{'model':db[_0x23167b['model']],'as':_0x23167b['as'],'attributes':_0x23167b[_0x8372('0x1d')],'include':_0x23167b[_0x8372('0x1e')]?_[_0x8372('0x1f')](_0x23167b['include'],function(_0x1b665d){return{'model':db[_0x1b665d[_0x8372('0x20')]],'as':_0x1b665d['as'],'attributes':_0x1b665d[_0x8372('0x1d')],'include':_0x1b665d[_0x8372('0x1e')]?_[_0x8372('0x1f')](_0x1b665d[_0x8372('0x1e')],function(_0x4c4943){return{'model':db[_0x4c4943[_0x8372('0x20')]],'as':_0x4c4943['as'],'attributes':_0x4c4943[_0x8372('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8372('0x21')](function(_0x7f3e){logger[_0x8372('0x10')]('ShowSquareProject',_0x111aad);logger[_0x8372('0x22')](_0x8372('0x19'),_0x111aad,JSON[_0x8372('0x14')](_0x7f3e));_0x1fcc3d(_0x7f3e);})[_0x8372('0x18')](function(_0x4300e6){logger[_0x8372('0x15')](_0x8372('0x19'),_0x4300e6[_0x8372('0x17')],_0x111aad);_0xa8589e(_0x2b5724[_0x8372('0x15')](0x1f4,_0x4300e6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 519896f..3be6a48 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 _0x63e0=['save','update','emit','removeListener','register','length','./squareProject.events'];(function(_0x87239,_0x38c793){var _0x53af1e=function(_0x11eb5f){while(--_0x11eb5f){_0x87239['push'](_0x87239['shift']());}};_0x53af1e(++_0x38c793);}(_0x63e0,0xa0));var _0x063e=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x63e0[_0x476c7];return _0x47ae56;};'use strict';var SquareProjectEvents=require(_0x063e('0x0'));var events=[_0x063e('0x1'),'remove',_0x063e('0x2')];function createListener(_0x13038e,_0x20752f){return function(_0x498d06){_0x20752f[_0x063e('0x3')](_0x13038e,_0x498d06);};}function removeListener(_0x5a31d2,_0x5a1da9){return function(){SquareProjectEvents[_0x063e('0x4')](_0x5a31d2,_0x5a1da9);};}exports[_0x063e('0x5')]=function(_0x31835d){for(var _0x93cf61=0x0,_0x257f92=events[_0x063e('0x6')];_0x93cf61<_0x257f92;_0x93cf61++){var _0x2e9246=events[_0x93cf61];var _0xda24ff=createListener('squareProject:'+_0x2e9246,_0x31835d);SquareProjectEvents['on'](_0x2e9246,_0xda24ff);}}; \ No newline at end of file +var _0xeca3=['remove','update','emit','length','./squareProject.events','save'];(function(_0xd2f4f5,_0x341930){var _0x41fc10=function(_0x496824){while(--_0x496824){_0xd2f4f5['push'](_0xd2f4f5['shift']());}};_0x41fc10(++_0x341930);}(_0xeca3,0x112));var _0x3eca=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xeca3[_0xfae23b];return _0x200640;};'use strict';var SquareProjectEvents=require(_0x3eca('0x0'));var events=[_0x3eca('0x1'),_0x3eca('0x2'),_0x3eca('0x3')];function createListener(_0x2ff8a9,_0x3d890b){return function(_0x123144){_0x3d890b[_0x3eca('0x4')](_0x2ff8a9,_0x123144);};}function removeListener(_0x244d2b,_0x39b271){return function(){SquareProjectEvents['removeListener'](_0x244d2b,_0x39b271);};}exports['register']=function(_0x5f313c){for(var _0x26482d=0x0,_0x5c6d7b=events[_0x3eca('0x5')];_0x26482d<_0x5c6d7b;_0x26482d++){var _0x575209=events[_0x26482d];var _0x3046bc=createListener('squareProject:'+_0x575209,_0x5f313c);SquareProjectEvents['on'](_0x575209,_0x3046bc);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f7a9be8..be33189 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x16444d,_0x1e8369){var _0x39145b=function(_0x592c00){while(--_0x592c00){_0x16444d['push'](_0x16444d['shift']());}};_0x39145b(++_0x1e8369);}(_0x814b,0x1a2));var _0xb814=function(_0xa8f776,_0x420cbf){_0xa8f776=_0xa8f776-0x0;var _0x435961=_0x814b[_0xa8f776];return _0x435961;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x0295,0x1f0));var _0x5029=function(_0x33c663,_0x4416ed){_0x33c663=_0x33c663-0x0;var _0x4c6299=_0x0295[_0x33c663];return _0x4c6299;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9d69659..07732b2 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 _0x5fc3=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x5fc3,0xa8));var _0x35fc=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x5fc3[_0x39cd3c];return _0x47a0ae;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x35fc('0x2')]},'calleridname':{'type':Sequelize[_0x35fc('0x2')]},'context':{'type':Sequelize[_0x35fc('0x2')]},'extension':{'type':Sequelize[_0x35fc('0x2')]},'priority':{'type':Sequelize[_0x35fc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x35fc('0x2')]},'projectName':{'type':Sequelize[_0x35fc('0x2')]},'saveName':{'type':Sequelize[_0x35fc('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x35fc('0x3')],'get':function(){var _0x508b32='';var _0x16e153=this[_0x35fc('0x4')](_0x35fc('0x5'));if(_0x16e153){_0x508b32=_0x16e153[_0x35fc('0x6')](_0x16e153[_0x35fc('0x7')]('.'));}return _0x508b32;}}}; \ No newline at end of file +var _0x8d0e=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x15747a,_0x2214b5){var _0x10f075=function(_0x1fa068){while(--_0x1fa068){_0x15747a['push'](_0x15747a['shift']());}};_0x10f075(++_0x2214b5);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x4f03f1,_0x10b972){_0x4f03f1=_0x4f03f1-0x0;var _0x378797=_0x8d0e[_0x4f03f1];return _0x378797;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'callerid':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'context':{'type':Sequelize[_0xe8d0('0x2')]},'extension':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize[_0xe8d0('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xe8d0('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xe8d0('0x2')]},'format':{'type':Sequelize[_0xe8d0('0x3')],'get':function(){var _0x469d37='';var _0xcc03d0=this[_0xe8d0('0x4')](_0xe8d0('0x5'));if(_0xcc03d0){_0x469d37=_0xcc03d0[_0xe8d0('0x6')](_0xcc03d0[_0xe8d0('0x7')]('.'));}return _0x469d37;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f9292b0..68674ab 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 _0x6cb2=['then','destroy','error','name','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','update','body','download','../../components/encryptor','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','unlink','message','send','Not\x20found','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','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','end','json','offset','undefined','count','limit','status','set','Content-Range','reject','save'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x6cb2,0x164));var _0x26cb=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x6cb2[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0x26cb('0x0'));var rimraf=require(_0x26cb('0x1'));var zipdir=require(_0x26cb('0x2'));var jsonpatch=require(_0x26cb('0x3'));var rp=require(_0x26cb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x26cb('0x5'));var util=require(_0x26cb('0x6'));var path=require(_0x26cb('0x7'));var sox=require(_0x26cb('0x8'));var csv=require('to-csv');var ejs=require(_0x26cb('0x9'));var fs=require('fs');var fs_extra=require(_0x26cb('0xa'));var _=require(_0x26cb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x26cb('0xc'));var deskjs=require(_0x26cb('0xd'));var toCsv=require(_0x26cb('0xe'));var querystring=require(_0x26cb('0xf'));var Papa=require(_0x26cb('0x10'));var Redis=require(_0x26cb('0x11'));var authService=require(_0x26cb('0x12'));var qs=require(_0x26cb('0x13'));var as=require(_0x26cb('0x14'));var hardwareService=require(_0x26cb('0x15'));var logger=require(_0x26cb('0x16'))(_0x26cb('0x17'));var utils=require(_0x26cb('0x18'));var config=require(_0x26cb('0x19'));var licenseUtil=require(_0x26cb('0x1a'));var db=require(_0x26cb('0x1b'))['db'];function respondWithStatusCode(_0x3c40b4,_0x5c68b6){_0x5c68b6=_0x5c68b6||0xcc;return function(_0x4cb7bd){if(_0x4cb7bd){return _0x3c40b4[_0x26cb('0x1c')](_0x5c68b6);}return _0x3c40b4['status'](_0x5c68b6)[_0x26cb('0x1d')]();};}function respondWithResult(_0x25c432,_0x997fd9){_0x997fd9=_0x997fd9||0xc8;return function(_0x487c6d){if(_0x487c6d){return _0x25c432['status'](_0x997fd9)[_0x26cb('0x1e')](_0x487c6d);}};}function respondWithFilteredResult(_0x3a1b12,_0x52a11d){return function(_0x4db4d5){if(_0x4db4d5){var _0x570957=typeof _0x52a11d[_0x26cb('0x1f')]===_0x26cb('0x20')&&typeof _0x52a11d['limit']==='undefined';var _0x398789=_0x4db4d5[_0x26cb('0x21')];var _0x30119d=_0x570957?0x0:_0x52a11d[_0x26cb('0x1f')];var _0x31c20b=_0x570957?_0x4db4d5['count']:_0x52a11d[_0x26cb('0x1f')]+_0x52a11d[_0x26cb('0x22')];var _0x58153;if(_0x31c20b>=_0x398789){_0x31c20b=_0x398789;_0x58153=0xc8;}else{_0x58153=0xce;}_0x3a1b12[_0x26cb('0x23')](_0x58153);return _0x3a1b12[_0x26cb('0x24')](_0x26cb('0x25'),_0x30119d+'-'+_0x31c20b+'/'+_0x398789)['json'](_0x4db4d5);}return null;};}function patchUpdates(_0x5a8bf5){return function(_0x2e8cfe){try{jsonpatch['apply'](_0x2e8cfe,_0x5a8bf5,!![]);}catch(_0x13566e){return BPromise[_0x26cb('0x26')](_0x13566e);}return _0x2e8cfe[_0x26cb('0x27')]();};}function saveUpdates(_0x173c91,_0x539700){return function(_0x467385){if(_0x467385){return _0x467385['update'](_0x173c91)[_0x26cb('0x28')](function(_0x96481){return _0x96481;});}return null;};}function removeEntity(_0x2087dc,_0x2fcf26){return function(_0x2d8031){if(_0x2d8031){return _0x2d8031[_0x26cb('0x29')]()[_0x26cb('0x28')](function(){_0x2087dc[_0x26cb('0x23')](0xcc)[_0x26cb('0x1d')]();});}};}function handleEntityNotFound(_0x3e4736,_0x410a2d){return function(_0x2abceb){if(!_0x2abceb){_0x3e4736[_0x26cb('0x1c')](0x194);}return _0x2abceb;};}function handleError(_0x22b6fc,_0x57e706){_0x57e706=_0x57e706||0x1f4;return function(_0x4a5ddf){logger[_0x26cb('0x2a')](_0x4a5ddf['stack']);if(_0x4a5ddf[_0x26cb('0x2b')]){delete _0x4a5ddf[_0x26cb('0x2b')];}_0x22b6fc['status'](_0x57e706)['send'](_0x4a5ddf);};}exports[_0x26cb('0x2c')]=function(_0xe90744,_0x3b4d37){var _0xd68225={},_0x4acb3c={},_0xc14a9a={'count':0x0,'rows':[]};var _0xb67488=_[_0x26cb('0x2d')](db[_0x26cb('0x2e')][_0x26cb('0x2f')],function(_0x133f2){return{'name':_0x133f2['fieldName'],'type':_0x133f2[_0x26cb('0x30')][_0x26cb('0x31')]};});_0x4acb3c[_0x26cb('0x32')]=_[_0x26cb('0x2d')](_0xb67488,'name');_0x4acb3c[_0x26cb('0x33')]=_[_0x26cb('0x34')](_0xe90744[_0x26cb('0x33')]);_0x4acb3c['filters']=_['intersection'](_0x4acb3c[_0x26cb('0x32')],_0x4acb3c[_0x26cb('0x33')]);_0xd68225[_0x26cb('0x35')]=_['intersection'](_0x4acb3c[_0x26cb('0x32')],qs[_0x26cb('0x36')](_0xe90744[_0x26cb('0x33')][_0x26cb('0x36')]));_0xd68225[_0x26cb('0x35')]=_0xd68225[_0x26cb('0x35')][_0x26cb('0x37')]?_0xd68225[_0x26cb('0x35')]:_0x4acb3c[_0x26cb('0x32')];if(!_0xe90744[_0x26cb('0x33')][_0x26cb('0x38')]('nolimit')){_0xd68225[_0x26cb('0x22')]=qs['limit'](_0xe90744[_0x26cb('0x33')]['limit']);_0xd68225[_0x26cb('0x1f')]=qs[_0x26cb('0x1f')](_0xe90744[_0x26cb('0x33')]['offset']);}_0xd68225[_0x26cb('0x39')]=qs['sort'](_0xe90744[_0x26cb('0x33')]['sort']);_0xd68225['where']=qs[_0x26cb('0x3a')](_[_0x26cb('0x3b')](_0xe90744[_0x26cb('0x33')],_0x4acb3c[_0x26cb('0x3a')]),_0xb67488);if(_0xe90744[_0x26cb('0x33')][_0x26cb('0x3c')]){_0xd68225[_0x26cb('0x3d')]=_['merge'](_0xd68225[_0x26cb('0x3d')],{'$or':_[_0x26cb('0x2d')](_0xb67488,function(_0x5c0540){if(_0x5c0540[_0x26cb('0x30')]!==_0x26cb('0x3e')){var _0xbd8177={};_0xbd8177[_0x5c0540[_0x26cb('0x2b')]]={'$like':'%'+_0xe90744[_0x26cb('0x33')]['filter']+'%'};return _0xbd8177;}})});}_0xd68225=_[_0x26cb('0x3f')]({},_0xd68225,_0xe90744[_0x26cb('0x40')]);var _0x498e46={'where':_0xd68225[_0x26cb('0x3d')]};return db['SquareRecording']['count'](_0x498e46)[_0x26cb('0x28')](function(_0x5eda54){_0xc14a9a['count']=_0x5eda54;if(_0xe90744[_0x26cb('0x33')][_0x26cb('0x41')]){_0xd68225['include']=[{'all':!![]}];}return db[_0x26cb('0x2e')][_0x26cb('0x42')](_0xd68225);})['then'](function(_0x119314){_0xc14a9a[_0x26cb('0x43')]=_0x119314;return _0xc14a9a;})[_0x26cb('0x28')](respondWithFilteredResult(_0x3b4d37,_0xd68225))[_0x26cb('0x44')](handleError(_0x3b4d37,null));};exports[_0x26cb('0x45')]=function(_0x5b589c,_0x440ef8){var _0x1ccfef={'raw':!![],'where':{'id':_0x5b589c[_0x26cb('0x46')]['id']}},_0x18d72d={};_0x18d72d['model']=_[_0x26cb('0x34')](db['SquareRecording'][_0x26cb('0x2f')]);_0x18d72d[_0x26cb('0x33')]=_[_0x26cb('0x34')](_0x5b589c['query']);_0x18d72d[_0x26cb('0x3a')]=_[_0x26cb('0x47')](_0x18d72d[_0x26cb('0x32')],_0x18d72d[_0x26cb('0x33')]);_0x1ccfef[_0x26cb('0x35')]=_[_0x26cb('0x47')](_0x18d72d[_0x26cb('0x32')],qs[_0x26cb('0x36')](_0x5b589c[_0x26cb('0x33')][_0x26cb('0x36')]));_0x1ccfef['attributes']=_0x1ccfef['attributes'][_0x26cb('0x37')]?_0x1ccfef[_0x26cb('0x35')]:_0x18d72d[_0x26cb('0x32')];if(_0x5b589c['query']['includeAll']){_0x1ccfef[_0x26cb('0x48')]=[{'all':!![]}];}_0x1ccfef=_[_0x26cb('0x3f')]({},_0x1ccfef,_0x5b589c[_0x26cb('0x40')]);return db[_0x26cb('0x2e')][_0x26cb('0x49')](_0x1ccfef)[_0x26cb('0x28')](handleEntityNotFound(_0x440ef8,null))[_0x26cb('0x28')](respondWithResult(_0x440ef8,null))['catch'](handleError(_0x440ef8,null));};exports['create']=function(_0x18957b,_0x2208d4){return db[_0x26cb('0x2e')][_0x26cb('0x4a')](_0x18957b['body'],{})[_0x26cb('0x28')](respondWithResult(_0x2208d4,0xc9))[_0x26cb('0x44')](handleError(_0x2208d4,null));};exports[_0x26cb('0x4b')]=function(_0x4f14a4,_0x3f800e){if(_0x4f14a4[_0x26cb('0x4c')]['id']){delete _0x4f14a4[_0x26cb('0x4c')]['id'];}return db['SquareRecording'][_0x26cb('0x49')]({'where':{'id':_0x4f14a4[_0x26cb('0x46')]['id']}})[_0x26cb('0x28')](handleEntityNotFound(_0x3f800e,null))['then'](saveUpdates(_0x4f14a4['body'],null))[_0x26cb('0x28')](respondWithResult(_0x3f800e,null))[_0x26cb('0x44')](handleError(_0x3f800e,null));};exports[_0x26cb('0x4d')]=function(_0x37c3bb,_0x1ac217,_0x54faa8){var _0x1004a2=require(_0x26cb('0x4e'));var _0x397847=![];var _0x45b563={};if(_0x37c3bb[_0x26cb('0x33')][_0x26cb('0x30')]&&_0x37c3bb[_0x26cb('0x33')][_0x26cb('0x30')]==='uniqueid'){_0x45b563['uniqueid']=_0x37c3bb['params']['id'];}else{_0x45b563['id']=_0x37c3bb[_0x26cb('0x46')]['id'];}return db[_0x26cb('0x2e')][_0x26cb('0x49')]({'where':_0x45b563,'attributes':['id',_0x26cb('0x4f'),_0x26cb('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x1ac217,null))[_0x26cb('0x28')](function(_0x22a378){if(_0x22a378){var _0xc9f922=_0x22a378[_0x26cb('0x4f')];var _0x3b896d=util[_0x26cb('0x51')](_0x26cb('0x52'),_0xc9f922);if(fs[_0x26cb('0x53')](_0x3b896d)){_0x397847=!![];return _0x1004a2[_0x26cb('0x54')](_0x3b896d,_0xc9f922,config[_0x26cb('0x55')][_0x26cb('0x56')])[_0x26cb('0x28')](function(){return _0x22a378;});}return _0x22a378;}})[_0x26cb('0x28')](function(_0x555628){if(_0x555628){var _0xb5f482=_0x555628[_0x26cb('0x4f')];if(!fs[_0x26cb('0x53')](_0xb5f482)){throw new db[(_0x26cb('0x57'))][(_0x26cb('0x58'))]('SquareRecording\x20not\x20found');}if(_0x555628[_0x26cb('0x50')]){return _0x1ac217[_0x26cb('0x4d')](_0xb5f482,_0x555628['filename']+path['extname'](_0xb5f482),function(){if(_0x397847){fs[_0x26cb('0x59')](_0xb5f482);}});}else{return _0x1ac217['download'](_0xb5f482,function(_0x52b685){if(_0x397847){fs[_0x26cb('0x59')](_0xb5f482);}});}}})[_0x26cb('0x44')](function(_0x469e92){if(_0x469e92[_0x26cb('0x5a')]==='SquareRecording\x20not\x20found'){_0x1ac217[_0x26cb('0x23')](0x194)[_0x26cb('0x5b')](_0x26cb('0x5c'));}else{return handleError(_0x1ac217,null);}});};exports[_0x26cb('0x29')]=function(_0x5187e5,_0x5c2842){return db[_0x26cb('0x2e')][_0x26cb('0x49')]({'where':{'id':_0x5187e5[_0x26cb('0x46')]['id']}})[_0x26cb('0x28')](function(_0x4b3f5b){if(_['isNil'](_0x4b3f5b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4b3f5b;})['then'](function(_0x1a7450){var _0x311524=_0x1a7450['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x311524);if(!_[_0x26cb('0x5d')](_0x1a7450[_0x26cb('0x4f')])&&fs[_0x26cb('0x53')](_0x311524)){logger['info'](_0x26cb('0x5e')+_0x311524+_0x26cb('0x5f'));fs[_0x26cb('0x60')](_0x311524);}_0x311524=_0x311524+_0x26cb('0x61');if(!_[_0x26cb('0x5d')](_0x1a7450[_0x26cb('0x4f')])&&fs[_0x26cb('0x53')](_0x311524)){logger[_0x26cb('0x62')](_0x26cb('0x5e')+_0x311524+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x311524);}return _0x1a7450;})[_0x26cb('0x28')](function(_0x31805b){if(!_0x31805b)throw new InternalError();return _0x31805b[_0x26cb('0x29')]();})[_0x26cb('0x28')](function(){_0x5c2842[_0x26cb('0x23')](0xcc)[_0x26cb('0x1d')]();})[_0x26cb('0x44')](handleError(_0x5c2842,null));}; \ No newline at end of file +var _0xcbc7=['File:\x20\x22','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','SquareRecording','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','catch','show','params','rawAttributes','keys','includeAll','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xcbc7,0x1e6));var _0x7cbc=function(_0x579175,_0x1ef0f0){_0x579175=_0x579175-0x0;var _0x3b8135=_0xcbc7[_0x579175];return _0x3b8135;};'use strict';var emlformat=require(_0x7cbc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7cbc('0x1'));var rp=require(_0x7cbc('0x2'));var moment=require(_0x7cbc('0x3'));var BPromise=require(_0x7cbc('0x4'));var Mustache=require('mustache');var util=require(_0x7cbc('0x5'));var path=require(_0x7cbc('0x6'));var sox=require(_0x7cbc('0x7'));var csv=require(_0x7cbc('0x8'));var ejs=require(_0x7cbc('0x9'));var fs=require('fs');var fs_extra=require(_0x7cbc('0xa'));var _=require('lodash');var squel=require(_0x7cbc('0xb'));var crypto=require('crypto');var jsforce=require(_0x7cbc('0xc'));var deskjs=require(_0x7cbc('0xd'));var toCsv=require(_0x7cbc('0x8'));var querystring=require('querystring');var Papa=require(_0x7cbc('0xe'));var Redis=require('ioredis');var authService=require(_0x7cbc('0xf'));var qs=require(_0x7cbc('0x10'));var as=require(_0x7cbc('0x11'));var hardwareService=require(_0x7cbc('0x12'));var logger=require(_0x7cbc('0x13'))(_0x7cbc('0x14'));var utils=require(_0x7cbc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7cbc('0x16'));var db=require(_0x7cbc('0x17'))['db'];function respondWithStatusCode(_0x52aece,_0x27d9fd){_0x27d9fd=_0x27d9fd||0xcc;return function(_0x49d0d4){if(_0x49d0d4){return _0x52aece['sendStatus'](_0x27d9fd);}return _0x52aece[_0x7cbc('0x18')](_0x27d9fd)[_0x7cbc('0x19')]();};}function respondWithResult(_0xbeca3a,_0x13fdb1){_0x13fdb1=_0x13fdb1||0xc8;return function(_0x53f791){if(_0x53f791){return _0xbeca3a[_0x7cbc('0x18')](_0x13fdb1)[_0x7cbc('0x1a')](_0x53f791);}};}function respondWithFilteredResult(_0x26cfe1,_0x13aec8){return function(_0x3e5844){if(_0x3e5844){var _0x466980=typeof _0x13aec8[_0x7cbc('0x1b')]===_0x7cbc('0x1c')&&typeof _0x13aec8['limit']===_0x7cbc('0x1c');var _0x5b0a4f=_0x3e5844[_0x7cbc('0x1d')];var _0x225475=_0x466980?0x0:_0x13aec8[_0x7cbc('0x1b')];var _0x46c480=_0x466980?_0x3e5844['count']:_0x13aec8[_0x7cbc('0x1b')]+_0x13aec8[_0x7cbc('0x1e')];var _0x1c3e97;if(_0x46c480>=_0x5b0a4f){_0x46c480=_0x5b0a4f;_0x1c3e97=0xc8;}else{_0x1c3e97=0xce;}_0x26cfe1['status'](_0x1c3e97);return _0x26cfe1[_0x7cbc('0x1f')](_0x7cbc('0x20'),_0x225475+'-'+_0x46c480+'/'+_0x5b0a4f)[_0x7cbc('0x1a')](_0x3e5844);}return null;};}function patchUpdates(_0x557764){return function(_0x1bb498){try{jsonpatch[_0x7cbc('0x21')](_0x1bb498,_0x557764,!![]);}catch(_0x133c98){return BPromise[_0x7cbc('0x22')](_0x133c98);}return _0x1bb498[_0x7cbc('0x23')]();};}function saveUpdates(_0x289956,_0x485ce6){return function(_0x3d094f){if(_0x3d094f){return _0x3d094f[_0x7cbc('0x24')](_0x289956)[_0x7cbc('0x25')](function(_0x3a0d80){return _0x3a0d80;});}return null;};}function removeEntity(_0x90aaf7,_0x6e6b82){return function(_0x4ba166){if(_0x4ba166){return _0x4ba166[_0x7cbc('0x26')]()[_0x7cbc('0x25')](function(){_0x90aaf7[_0x7cbc('0x18')](0xcc)[_0x7cbc('0x19')]();});}};}function handleEntityNotFound(_0x3b32e5,_0x13db96){return function(_0xb71342){if(!_0xb71342){_0x3b32e5[_0x7cbc('0x27')](0x194);}return _0xb71342;};}function handleError(_0x3a63b6,_0x4c53a3){_0x4c53a3=_0x4c53a3||0x1f4;return function(_0x37537a){logger['error'](_0x37537a[_0x7cbc('0x28')]);if(_0x37537a[_0x7cbc('0x29')]){delete _0x37537a[_0x7cbc('0x29')];}_0x3a63b6[_0x7cbc('0x18')](_0x4c53a3)['send'](_0x37537a);};}exports['index']=function(_0x12fc88,_0x4929eb){var _0x2a9059={},_0x8e1109={},_0x47eac0={'count':0x0,'rows':[]};var _0x3271d7=_['map'](db[_0x7cbc('0x2a')]['rawAttributes'],function(_0xb0ccfa){return{'name':_0xb0ccfa['fieldName'],'type':_0xb0ccfa[_0x7cbc('0x2b')][_0x7cbc('0x2c')]};});_0x8e1109['model']=_[_0x7cbc('0x2d')](_0x3271d7,'name');_0x8e1109['query']=_['keys'](_0x12fc88[_0x7cbc('0x2e')]);_0x8e1109[_0x7cbc('0x2f')]=_[_0x7cbc('0x30')](_0x8e1109['model'],_0x8e1109['query']);_0x2a9059[_0x7cbc('0x31')]=_[_0x7cbc('0x30')](_0x8e1109[_0x7cbc('0x32')],qs[_0x7cbc('0x33')](_0x12fc88['query'][_0x7cbc('0x33')]));_0x2a9059['attributes']=_0x2a9059['attributes'][_0x7cbc('0x34')]?_0x2a9059[_0x7cbc('0x31')]:_0x8e1109['model'];if(!_0x12fc88[_0x7cbc('0x2e')][_0x7cbc('0x35')](_0x7cbc('0x36'))){_0x2a9059[_0x7cbc('0x1e')]=qs[_0x7cbc('0x1e')](_0x12fc88['query'][_0x7cbc('0x1e')]);_0x2a9059['offset']=qs['offset'](_0x12fc88[_0x7cbc('0x2e')][_0x7cbc('0x1b')]);}_0x2a9059[_0x7cbc('0x37')]=qs[_0x7cbc('0x38')](_0x12fc88[_0x7cbc('0x2e')][_0x7cbc('0x38')]);_0x2a9059[_0x7cbc('0x39')]=qs[_0x7cbc('0x2f')](_[_0x7cbc('0x3a')](_0x12fc88[_0x7cbc('0x2e')],_0x8e1109['filters']),_0x3271d7);if(_0x12fc88[_0x7cbc('0x2e')]['filter']){_0x2a9059[_0x7cbc('0x39')]=_[_0x7cbc('0x3b')](_0x2a9059[_0x7cbc('0x39')],{'$or':_[_0x7cbc('0x2d')](_0x3271d7,function(_0x205409){if(_0x205409[_0x7cbc('0x2b')]!==_0x7cbc('0x3c')){var _0x61aa43={};_0x61aa43[_0x205409[_0x7cbc('0x29')]]={'$like':'%'+_0x12fc88[_0x7cbc('0x2e')][_0x7cbc('0x3d')]+'%'};return _0x61aa43;}})});}_0x2a9059=_[_0x7cbc('0x3b')]({},_0x2a9059,_0x12fc88['options']);var _0x3f1d12={'where':_0x2a9059[_0x7cbc('0x39')]};return db[_0x7cbc('0x2a')][_0x7cbc('0x1d')](_0x3f1d12)['then'](function(_0x5d824e){_0x47eac0[_0x7cbc('0x1d')]=_0x5d824e;if(_0x12fc88[_0x7cbc('0x2e')]['includeAll']){_0x2a9059[_0x7cbc('0x3e')]=[{'all':!![]}];}return db[_0x7cbc('0x2a')]['findAll'](_0x2a9059);})['then'](function(_0x469017){_0x47eac0[_0x7cbc('0x3f')]=_0x469017;return _0x47eac0;})[_0x7cbc('0x25')](respondWithFilteredResult(_0x4929eb,_0x2a9059))[_0x7cbc('0x40')](handleError(_0x4929eb,null));};exports[_0x7cbc('0x41')]=function(_0x2acff4,_0x890671){var _0x4d8cd7={'raw':!![],'where':{'id':_0x2acff4[_0x7cbc('0x42')]['id']}},_0x44209a={};_0x44209a[_0x7cbc('0x32')]=_['keys'](db[_0x7cbc('0x2a')][_0x7cbc('0x43')]);_0x44209a[_0x7cbc('0x2e')]=_[_0x7cbc('0x44')](_0x2acff4[_0x7cbc('0x2e')]);_0x44209a[_0x7cbc('0x2f')]=_[_0x7cbc('0x30')](_0x44209a[_0x7cbc('0x32')],_0x44209a[_0x7cbc('0x2e')]);_0x4d8cd7['attributes']=_[_0x7cbc('0x30')](_0x44209a[_0x7cbc('0x32')],qs[_0x7cbc('0x33')](_0x2acff4[_0x7cbc('0x2e')]['fields']));_0x4d8cd7[_0x7cbc('0x31')]=_0x4d8cd7['attributes'][_0x7cbc('0x34')]?_0x4d8cd7[_0x7cbc('0x31')]:_0x44209a['model'];if(_0x2acff4[_0x7cbc('0x2e')][_0x7cbc('0x45')]){_0x4d8cd7[_0x7cbc('0x3e')]=[{'all':!![]}];}_0x4d8cd7=_[_0x7cbc('0x3b')]({},_0x4d8cd7,_0x2acff4[_0x7cbc('0x46')]);return db[_0x7cbc('0x2a')][_0x7cbc('0x47')](_0x4d8cd7)[_0x7cbc('0x25')](handleEntityNotFound(_0x890671,null))['then'](respondWithResult(_0x890671,null))['catch'](handleError(_0x890671,null));};exports[_0x7cbc('0x48')]=function(_0x21d5f2,_0x120016){return db[_0x7cbc('0x2a')][_0x7cbc('0x48')](_0x21d5f2[_0x7cbc('0x49')],{})['then'](respondWithResult(_0x120016,0xc9))[_0x7cbc('0x40')](handleError(_0x120016,null));};exports['update']=function(_0x510eeb,_0x320608){if(_0x510eeb['body']['id']){delete _0x510eeb[_0x7cbc('0x49')]['id'];}return db[_0x7cbc('0x2a')]['find']({'where':{'id':_0x510eeb[_0x7cbc('0x42')]['id']}})[_0x7cbc('0x25')](handleEntityNotFound(_0x320608,null))[_0x7cbc('0x25')](saveUpdates(_0x510eeb[_0x7cbc('0x49')],null))['then'](respondWithResult(_0x320608,null))['catch'](handleError(_0x320608,null));};exports[_0x7cbc('0x4a')]=function(_0x3e9e48,_0x3bdcb9,_0x54b529){var _0x358e0c=require(_0x7cbc('0x4b'));var _0x341d19=![];var _0x4f70d4={};if(_0x3e9e48[_0x7cbc('0x2e')][_0x7cbc('0x2b')]&&_0x3e9e48[_0x7cbc('0x2e')][_0x7cbc('0x2b')]===_0x7cbc('0x4c')){_0x4f70d4[_0x7cbc('0x4c')]=_0x3e9e48[_0x7cbc('0x42')]['id'];}else{_0x4f70d4['id']=_0x3e9e48[_0x7cbc('0x42')]['id'];}return db[_0x7cbc('0x2a')][_0x7cbc('0x47')]({'where':_0x4f70d4,'attributes':['id','savePath','filename'],'raw':!![]})[_0x7cbc('0x25')](handleEntityNotFound(_0x3bdcb9,null))[_0x7cbc('0x25')](function(_0x166dda){if(_0x166dda){var _0x469c07=_0x166dda[_0x7cbc('0x4d')];var _0x1b62a7=util[_0x7cbc('0x4e')]('%s.cypher',_0x469c07);if(fs['existsSync'](_0x1b62a7)){_0x341d19=!![];return _0x358e0c['decryptFile'](_0x1b62a7,_0x469c07,config[_0x7cbc('0x4f')][_0x7cbc('0x50')])[_0x7cbc('0x25')](function(){return _0x166dda;});}return _0x166dda;}})[_0x7cbc('0x25')](function(_0x5a2f96){if(_0x5a2f96){var _0x28668c=_0x5a2f96[_0x7cbc('0x4d')];if(!fs['existsSync'](_0x28668c)){throw new db[(_0x7cbc('0x51'))][(_0x7cbc('0x52'))](_0x7cbc('0x53'));}if(_0x5a2f96[_0x7cbc('0x54')]){return _0x3bdcb9[_0x7cbc('0x4a')](_0x28668c,_0x5a2f96[_0x7cbc('0x54')]+path[_0x7cbc('0x55')](_0x28668c),function(){if(_0x341d19){fs['unlink'](_0x28668c);}});}else{return _0x3bdcb9[_0x7cbc('0x4a')](_0x28668c,function(_0x8de560){if(_0x341d19){fs['unlink'](_0x28668c);}});}}})['catch'](function(_0x3c11e0){if(_0x3c11e0['message']===_0x7cbc('0x53')){_0x3bdcb9[_0x7cbc('0x18')](0x194)[_0x7cbc('0x56')](_0x7cbc('0x57'));}else{return handleError(_0x3bdcb9,null);}});};exports['destroy']=function(_0x57c28d,_0x20724f){return db[_0x7cbc('0x2a')][_0x7cbc('0x47')]({'where':{'id':_0x57c28d[_0x7cbc('0x42')]['id']}})[_0x7cbc('0x25')](function(_0x55c801){if(_['isNil'](_0x55c801)){throw new ReferenceError(_0x7cbc('0x58'));}return _0x55c801;})['then'](function(_0x197143){var _0x317fbe=_0x197143['savePath'];logger[_0x7cbc('0x59')](_0x7cbc('0x5a'),_0x317fbe);if(!_[_0x7cbc('0x5b')](_0x197143[_0x7cbc('0x4d')])&&fs[_0x7cbc('0x5c')](_0x317fbe)){logger[_0x7cbc('0x59')]('File:\x20\x22'+_0x317fbe+_0x7cbc('0x5d'));fs[_0x7cbc('0x5e')](_0x317fbe);}_0x317fbe=_0x317fbe+_0x7cbc('0x5f');if(!_[_0x7cbc('0x5b')](_0x197143['savePath'])&&fs['existsSync'](_0x317fbe)){logger[_0x7cbc('0x59')](_0x7cbc('0x60')+_0x317fbe+_0x7cbc('0x5d'));fs[_0x7cbc('0x5e')](_0x317fbe);}return _0x197143;})[_0x7cbc('0x25')](function(_0x21ff57){if(!_0x21ff57)throw new InternalError();return _0x21ff57[_0x7cbc('0x26')]();})[_0x7cbc('0x25')](function(){_0x20724f[_0x7cbc('0x18')](0xcc)['end']();})[_0x7cbc('0x40')](handleError(_0x20724f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1359cb5..70eedb2 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 _0x2178=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings'];(function(_0x1d0194,_0x852128){var _0x41ae29=function(_0x2bdd2e){while(--_0x2bdd2e){_0x1d0194['push'](_0x1d0194['shift']());}};_0x41ae29(++_0x852128);}(_0x2178,0x1b0));var _0x8217=function(_0x526786,_0x105cbf){_0x526786=_0x526786-0x0;var _0x3a512d=_0x2178[_0x526786];return _0x3a512d;};'use strict';var _=require(_0x8217('0x0'));var util=require('util');var logger=require(_0x8217('0x1'))(_0x8217('0x2'));var moment=require(_0x8217('0x3'));var BPromise=require('bluebird');var rp=require(_0x8217('0x4'));var fs=require('fs');var path=require(_0x8217('0x5'));var rimraf=require('rimraf');var config=require(_0x8217('0x6'));var attributes=require(_0x8217('0x7'));module[_0x8217('0x8')]=function(_0x16da6e,_0x18f4bd){return _0x16da6e[_0x8217('0x9')](_0x8217('0xa'),attributes,{'tableName':_0x8217('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x084b=['path','rimraf','../../config/environment','exports','define','SquareRecording','lodash','moment','bluebird'];(function(_0x295849,_0x42b3eb){var _0x27d8d4=function(_0x375ae0){while(--_0x375ae0){_0x295849['push'](_0x295849['shift']());}};_0x27d8d4(++_0x42b3eb);}(_0x084b,0xd5));var _0xb084=function(_0x2175a3,_0x426e08){_0x2175a3=_0x2175a3-0x0;var _0x3d308b=_0x084b[_0x2175a3];return _0x3d308b;};'use strict';var _=require(_0xb084('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb084('0x1'));var BPromise=require(_0xb084('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb084('0x3'));var rimraf=require(_0xb084('0x4'));var config=require(_0xb084('0x5'));var attributes=require('./squareRecording.attributes');module[_0xb084('0x6')]=function(_0x50f465,_0x33728d){return _0x50f465[_0xb084('0x7')](_0xb084('0x8'),attributes,{'tableName':'square_recordings','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 83a8c2f..36c7a45 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 _0x061d=['error','code','message','info','result','catch','SquareRecording,\x20%s,\x20%s','CreateSquareRecording','create','options','raw','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x061d,0x19b));var _0xd061=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x061d[_0x481bf7];return _0x461787;};'use strict';var _=require(_0xd061('0x0'));var util=require(_0xd061('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd061('0x2'));var db=require(_0xd061('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd061('0x4'))(_0xd061('0x5'));var config=require(_0xd061('0x6'));var jayson=require(_0xd061('0x7'));var client=jayson[_0xd061('0x8')][_0xd061('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x467ff5,_0x4b58cf,_0x7479e9){return new BPromise(function(_0x4e0669,_0x2ed006){return client['request'](_0x467ff5,_0x7479e9)[_0xd061('0xa')](function(_0x2aaf51){logger['info']('SquareRecording,\x20%s,\x20%s',_0x4b58cf,_0xd061('0xb'));logger['debug'](_0xd061('0xc'),_0x4b58cf,_0xd061('0xb'),JSON[_0xd061('0xd')](_0x2aaf51));if(_0x2aaf51[_0xd061('0xe')]){if(_0x2aaf51[_0xd061('0xe')][_0xd061('0xf')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x4b58cf,_0x2aaf51[_0xd061('0xe')][_0xd061('0x10')]);return _0x2ed006(_0x2aaf51[_0xd061('0xe')][_0xd061('0x10')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x4b58cf,_0x2aaf51[_0xd061('0xe')][_0xd061('0x10')]);return _0x4e0669(_0x2aaf51['error'][_0xd061('0x10')]);}else{logger[_0xd061('0x11')]('SquareRecording,\x20%s,\x20%s',_0x4b58cf,_0xd061('0xb'));_0x4e0669(_0x2aaf51[_0xd061('0x12')][_0xd061('0x10')]);}})[_0xd061('0x13')](function(_0xa8d6eb){logger['error'](_0xd061('0x14'),_0x4b58cf,_0xa8d6eb);_0x2ed006(_0xa8d6eb);});});}exports[_0xd061('0x15')]=function(_0x5d1c53){var _0x6d0103=this;return new Promise(function(_0x44f580,_0x2c860c){return db['SquareRecording'][_0xd061('0x16')](_0x5d1c53['body'],{'raw':_0x5d1c53[_0xd061('0x17')]?_0x5d1c53['options'][_0xd061('0x18')]===undefined?!![]:![]:!![]})[_0xd061('0xa')](function(_0x41f11f){logger['info']('CreateSquareRecording',_0x5d1c53);logger['debug']('CreateSquareRecording',_0x5d1c53,JSON[_0xd061('0xd')](_0x41f11f));_0x44f580(_0x41f11f);})[_0xd061('0x13')](function(_0x338029){logger[_0xd061('0xe')]('CreateSquareRecording',_0x338029[_0xd061('0x10')],_0x5d1c53);_0x2c860c(_0x6d0103['error'](0x1f4,_0x338029[_0xd061('0x10')]));});});}; \ No newline at end of file +var _0x0ad0=['SquareRecording','create','options','raw','info','CreateSquareRecording','stringify','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5b2e19,_0xcb6e08){var _0x1d949e=function(_0x45842a){while(--_0x45842a){_0x5b2e19['push'](_0x5b2e19['shift']());}};_0x1d949e(++_0xcb6e08);}(_0x0ad0,0xa4));var _0x00ad=function(_0x2c5032,_0x466e24){_0x2c5032=_0x2c5032-0x0;var _0x1bc2ba=_0x0ad0[_0x2c5032];return _0x1bc2ba;};'use strict';var _=require(_0x00ad('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x00ad('0x1'));var rs=require(_0x00ad('0x2'));var fs=require('fs');var Redis=require(_0x00ad('0x3'));var db=require(_0x00ad('0x4'))['db'];var utils=require(_0x00ad('0x5'));var logger=require(_0x00ad('0x6'))(_0x00ad('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x00ad('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23c8eb,_0x14085b,_0x524f51){return new BPromise(function(_0x264e07,_0x182adf){return client[_0x00ad('0x9')](_0x23c8eb,_0x524f51)[_0x00ad('0xa')](function(_0xc9c03e){logger['info'](_0x00ad('0xb'),_0x14085b,'request\x20sent');logger[_0x00ad('0xc')](_0x00ad('0xd'),_0x14085b,_0x00ad('0xe'),JSON['stringify'](_0xc9c03e));if(_0xc9c03e[_0x00ad('0xf')]){if(_0xc9c03e[_0x00ad('0xf')][_0x00ad('0x10')]===0x1f4){logger[_0x00ad('0xf')](_0x00ad('0xb'),_0x14085b,_0xc9c03e[_0x00ad('0xf')]['message']);return _0x182adf(_0xc9c03e['error'][_0x00ad('0x11')]);}logger['error'](_0x00ad('0xb'),_0x14085b,_0xc9c03e[_0x00ad('0xf')][_0x00ad('0x11')]);return _0x264e07(_0xc9c03e[_0x00ad('0xf')][_0x00ad('0x11')]);}else{logger['info'](_0x00ad('0xb'),_0x14085b,_0x00ad('0xe'));_0x264e07(_0xc9c03e['result'][_0x00ad('0x11')]);}})['catch'](function(_0x3edd5d){logger[_0x00ad('0xf')]('SquareRecording,\x20%s,\x20%s',_0x14085b,_0x3edd5d);_0x182adf(_0x3edd5d);});});}exports['CreateSquareRecording']=function(_0x391f56){var _0x5a7c5f=this;return new Promise(function(_0x1c05bb,_0x104e9e){return db[_0x00ad('0x12')][_0x00ad('0x13')](_0x391f56['body'],{'raw':_0x391f56[_0x00ad('0x14')]?_0x391f56['options'][_0x00ad('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x4c888b){logger[_0x00ad('0x16')](_0x00ad('0x17'),_0x391f56);logger[_0x00ad('0xc')](_0x00ad('0x17'),_0x391f56,JSON[_0x00ad('0x18')](_0x4c888b));_0x1c05bb(_0x4c888b);})[_0x00ad('0x19')](function(_0xf53e62){logger[_0x00ad('0xf')](_0x00ad('0x17'),_0xf53e62[_0x00ad('0x11')],_0x391f56);_0x104e9e(_0x5a7c5f[_0x00ad('0xf')](0x1f4,_0xf53e62[_0x00ad('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 961fb51..a4d8aad 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 _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x619d4b,_0x29a1ca){var _0x93fb06=function(_0x4f214a){while(--_0x4f214a){_0x619d4b['push'](_0x619d4b['shift']());}};_0x93fb06(++_0x29a1ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x46e182,_0x1046a8){_0x46e182=_0x46e182-0x0;var _0x42ade0=_0xb10b[_0x46e182];return _0x42ade0;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x523267,_0xb2e276){var _0x290a95=function(_0x16fe9b){while(--_0x16fe9b){_0x523267['push'](_0x523267['shift']());}};_0x290a95(++_0xb2e276);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index be3cee0..1dff2c4 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 _0xd1f3=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x3b59d5,_0x1e23f2){var _0x30cc91=function(_0x54815d){while(--_0x54815d){_0x3b59d5['push'](_0x3b59d5['shift']());}};_0x30cc91(++_0x1e23f2);}(_0xd1f3,0x14c));var _0x3d1f=function(_0x4894b9,_0x1a3923){_0x4894b9=_0x4894b9-0x0;var _0x36ef89=_0xd1f3[_0x4894b9];return _0x36ef89;};'use strict';var Sequelize=require(_0x3d1f('0x0'));module[_0x3d1f('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3d1f('0x2')]},'request':{'type':Sequelize[_0x3d1f('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3d1f('0x2')]},'uniqueid':{'type':Sequelize[_0x3d1f('0x2')]},'version':{'type':Sequelize[_0x3d1f('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3d1f('0x2')]},'callingpres':{'type':Sequelize[_0x3d1f('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x3d1f('0x2')]},'dnid':{'type':Sequelize[_0x3d1f('0x2')]},'rdnis':{'type':Sequelize[_0x3d1f('0x2')]},'context':{'type':Sequelize[_0x3d1f('0x2')]},'extension':{'type':Sequelize[_0x3d1f('0x2')]},'priority':{'type':Sequelize[_0x3d1f('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3d1f('0x2')]},'threadid':{'type':Sequelize[_0x3d1f('0x2')]},'project_name':{'type':Sequelize[_0x3d1f('0x2')]},'joinAt':{'type':Sequelize[_0x3d1f('0x3')]},'leaveAt':{'type':Sequelize[_0x3d1f('0x3')]},'bot':{'type':Sequelize[_0x3d1f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6344=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3d6b76,_0x17d6d3){var _0x15fa9a=function(_0x4c2933){while(--_0x4c2933){_0x3d6b76['push'](_0x3d6b76['shift']());}};_0x15fa9a(++_0x17d6d3);}(_0x6344,0x196));var _0x4634=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x6344[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x4634('0x0'));module[_0x4634('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x4634('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4634('0x2')]},'language':{'type':Sequelize[_0x4634('0x2')]},'type':{'type':Sequelize[_0x4634('0x2')]},'uniqueid':{'type':Sequelize[_0x4634('0x2')]},'version':{'type':Sequelize[_0x4634('0x2')]},'callerid':{'type':Sequelize[_0x4634('0x2')]},'calleridname':{'type':Sequelize[_0x4634('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4634('0x2')]},'callington':{'type':Sequelize[_0x4634('0x2')]},'callingtns':{'type':Sequelize[_0x4634('0x2')]},'dnid':{'type':Sequelize[_0x4634('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4634('0x2')]},'extension':{'type':Sequelize[_0x4634('0x2')]},'priority':{'type':Sequelize[_0x4634('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4634('0x2')]},'threadid':{'type':Sequelize[_0x4634('0x2')]},'project_name':{'type':Sequelize[_0x4634('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x4634('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 3980da8..4829a5a 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 _0xc891=['ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','SquareReport','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv'];(function(_0x4f952c,_0x450ad0){var _0x39450a=function(_0x578e7c){while(--_0x578e7c){_0x4f952c['push'](_0x4f952c['shift']());}};_0x39450a(++_0x450ad0);}(_0xc891,0xd3));var _0x1c89=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xc891[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0x1c89('0x0'));var rimraf=require(_0x1c89('0x1'));var zipdir=require(_0x1c89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c89('0x3'));var moment=require('moment');var BPromise=require(_0x1c89('0x4'));var Mustache=require('mustache');var util=require(_0x1c89('0x5'));var path=require('path');var sox=require(_0x1c89('0x6'));var csv=require(_0x1c89('0x7'));var ejs=require(_0x1c89('0x8'));var fs=require('fs');var fs_extra=require(_0x1c89('0x9'));var _=require(_0x1c89('0xa'));var squel=require(_0x1c89('0xb'));var crypto=require(_0x1c89('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1c89('0x7'));var querystring=require(_0x1c89('0xd'));var Papa=require(_0x1c89('0xe'));var Redis=require(_0x1c89('0xf'));var authService=require(_0x1c89('0x10'));var qs=require(_0x1c89('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c89('0x12'));var logger=require(_0x1c89('0x13'))(_0x1c89('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1c89('0x15'));var db=require(_0x1c89('0x16'))['db'];function respondWithStatusCode(_0x4d18b7,_0x417769){_0x417769=_0x417769||0xcc;return function(_0x1b9a06){if(_0x1b9a06){return _0x4d18b7['sendStatus'](_0x417769);}return _0x4d18b7['status'](_0x417769)['end']();};}function respondWithResult(_0x46078e,_0x2cbbf6){_0x2cbbf6=_0x2cbbf6||0xc8;return function(_0x4df9ed){if(_0x4df9ed){return _0x46078e[_0x1c89('0x17')](_0x2cbbf6)[_0x1c89('0x18')](_0x4df9ed);}};}function respondWithFilteredResult(_0x2e362,_0x3813fb){return function(_0x3c6786){if(_0x3c6786){var _0x272069=typeof _0x3813fb[_0x1c89('0x19')]===_0x1c89('0x1a')&&typeof _0x3813fb[_0x1c89('0x1b')]==='undefined';var _0x53bbfe=_0x3c6786[_0x1c89('0x1c')];var _0x1aaf3=_0x272069?0x0:_0x3813fb[_0x1c89('0x19')];var _0x2cdf38=_0x272069?_0x3c6786[_0x1c89('0x1c')]:_0x3813fb[_0x1c89('0x19')]+_0x3813fb[_0x1c89('0x1b')];var _0x4b8f2b;if(_0x2cdf38>=_0x53bbfe){_0x2cdf38=_0x53bbfe;_0x4b8f2b=0xc8;}else{_0x4b8f2b=0xce;}_0x2e362[_0x1c89('0x17')](_0x4b8f2b);return _0x2e362[_0x1c89('0x1d')](_0x1c89('0x1e'),_0x1aaf3+'-'+_0x2cdf38+'/'+_0x53bbfe)[_0x1c89('0x18')](_0x3c6786);}return null;};}function patchUpdates(_0x226591){return function(_0x270ce5){try{jsonpatch[_0x1c89('0x1f')](_0x270ce5,_0x226591,!![]);}catch(_0x557df4){return BPromise[_0x1c89('0x20')](_0x557df4);}return _0x270ce5['save']();};}function saveUpdates(_0x591eeb,_0x3a458f){return function(_0x3795e0){if(_0x3795e0){return _0x3795e0[_0x1c89('0x21')](_0x591eeb)[_0x1c89('0x22')](function(_0x592a56){return _0x592a56;});}return null;};}function removeEntity(_0xf39f32,_0x1b6323){return function(_0x2b7469){if(_0x2b7469){return _0x2b7469[_0x1c89('0x23')]()['then'](function(){_0xf39f32[_0x1c89('0x17')](0xcc)[_0x1c89('0x24')]();});}};}function handleEntityNotFound(_0x50a9b7,_0x3799a4){return function(_0x52739b){if(!_0x52739b){_0x50a9b7[_0x1c89('0x25')](0x194);}return _0x52739b;};}function handleError(_0x101c11,_0x4ee6a0){_0x4ee6a0=_0x4ee6a0||0x1f4;return function(_0x308b99){logger[_0x1c89('0x26')](_0x308b99[_0x1c89('0x27')]);if(_0x308b99[_0x1c89('0x28')]){delete _0x308b99['name'];}_0x101c11[_0x1c89('0x17')](_0x4ee6a0)['send'](_0x308b99);};}exports[_0x1c89('0x29')]=function(_0x5a52be,_0x5ecd58){var _0x1be148={},_0x59cc00={},_0x40a513={'count':0x0,'rows':[]};var _0x4f5db4=_[_0x1c89('0x2a')](db['SquareReport']['rawAttributes'],function(_0x1e020d){return{'name':_0x1e020d['fieldName'],'type':_0x1e020d[_0x1c89('0x2b')][_0x1c89('0x2c')]};});_0x59cc00[_0x1c89('0x2d')]=_[_0x1c89('0x2a')](_0x4f5db4,_0x1c89('0x28'));_0x59cc00[_0x1c89('0x2e')]=_['keys'](_0x5a52be[_0x1c89('0x2e')]);_0x59cc00[_0x1c89('0x2f')]=_[_0x1c89('0x30')](_0x59cc00[_0x1c89('0x2d')],_0x59cc00['query']);_0x1be148[_0x1c89('0x31')]=_[_0x1c89('0x30')](_0x59cc00[_0x1c89('0x2d')],qs[_0x1c89('0x32')](_0x5a52be['query']['fields']));_0x1be148[_0x1c89('0x31')]=_0x1be148['attributes'][_0x1c89('0x33')]?_0x1be148[_0x1c89('0x31')]:_0x59cc00[_0x1c89('0x2d')];if(!_0x5a52be[_0x1c89('0x2e')][_0x1c89('0x34')](_0x1c89('0x35'))){_0x1be148[_0x1c89('0x1b')]=qs[_0x1c89('0x1b')](_0x5a52be[_0x1c89('0x2e')]['limit']);_0x1be148[_0x1c89('0x19')]=qs['offset'](_0x5a52be[_0x1c89('0x2e')][_0x1c89('0x19')]);}_0x1be148['order']=qs[_0x1c89('0x36')](_0x5a52be['query'][_0x1c89('0x36')]);_0x1be148['where']=qs[_0x1c89('0x2f')](_[_0x1c89('0x37')](_0x5a52be[_0x1c89('0x2e')],_0x59cc00[_0x1c89('0x2f')]),_0x4f5db4);if(_0x5a52be[_0x1c89('0x2e')][_0x1c89('0x38')]){_0x1be148[_0x1c89('0x39')]=_[_0x1c89('0x3a')](_0x1be148[_0x1c89('0x39')],{'$or':_[_0x1c89('0x2a')](_0x4f5db4,function(_0x2618cd){if(_0x2618cd['type']!==_0x1c89('0x3b')){var _0x214191={};_0x214191[_0x2618cd[_0x1c89('0x28')]]={'$like':'%'+_0x5a52be['query'][_0x1c89('0x38')]+'%'};return _0x214191;}})});}_0x1be148=_[_0x1c89('0x3a')]({},_0x1be148,_0x5a52be[_0x1c89('0x3c')]);var _0x12e580={'where':_0x1be148[_0x1c89('0x39')]};return db['SquareReport'][_0x1c89('0x1c')](_0x12e580)[_0x1c89('0x22')](function(_0x4def83){_0x40a513[_0x1c89('0x1c')]=_0x4def83;if(_0x5a52be[_0x1c89('0x2e')][_0x1c89('0x3d')]){_0x1be148['include']=[{'all':!![]}];}return db[_0x1c89('0x3e')][_0x1c89('0x3f')](_0x1be148);})[_0x1c89('0x22')](function(_0x717320){_0x40a513[_0x1c89('0x40')]=_0x717320;return _0x40a513;})['then'](respondWithFilteredResult(_0x5ecd58,_0x1be148))[_0x1c89('0x41')](handleError(_0x5ecd58,null));};exports[_0x1c89('0x42')]=function(_0x5c5ed5,_0x3d8c78){var _0xe5b56f={'raw':!![],'where':{'id':_0x5c5ed5[_0x1c89('0x43')]['id']}},_0x4b973b={};_0x4b973b[_0x1c89('0x2d')]=_['keys'](db[_0x1c89('0x3e')]['rawAttributes']);_0x4b973b[_0x1c89('0x2e')]=_['keys'](_0x5c5ed5[_0x1c89('0x2e')]);_0x4b973b['filters']=_[_0x1c89('0x30')](_0x4b973b[_0x1c89('0x2d')],_0x4b973b[_0x1c89('0x2e')]);_0xe5b56f['attributes']=_['intersection'](_0x4b973b[_0x1c89('0x2d')],qs[_0x1c89('0x32')](_0x5c5ed5[_0x1c89('0x2e')][_0x1c89('0x32')]));_0xe5b56f['attributes']=_0xe5b56f['attributes']['length']?_0xe5b56f[_0x1c89('0x31')]:_0x4b973b[_0x1c89('0x2d')];if(_0x5c5ed5[_0x1c89('0x2e')][_0x1c89('0x3d')]){_0xe5b56f[_0x1c89('0x44')]=[{'all':!![]}];}_0xe5b56f=_[_0x1c89('0x3a')]({},_0xe5b56f,_0x5c5ed5[_0x1c89('0x3c')]);return db[_0x1c89('0x3e')][_0x1c89('0x45')](_0xe5b56f)[_0x1c89('0x22')](handleEntityNotFound(_0x3d8c78,null))[_0x1c89('0x22')](respondWithResult(_0x3d8c78,null))[_0x1c89('0x41')](handleError(_0x3d8c78,null));};exports[_0x1c89('0x46')]=function(_0x50c3d2,_0x43f6fe){return db[_0x1c89('0x3e')]['create'](_0x50c3d2[_0x1c89('0x47')],{})[_0x1c89('0x22')](respondWithResult(_0x43f6fe,0xc9))[_0x1c89('0x41')](handleError(_0x43f6fe,null));};exports[_0x1c89('0x21')]=function(_0xebe056,_0x195eb7){if(_0xebe056[_0x1c89('0x47')]['id']){delete _0xebe056[_0x1c89('0x47')]['id'];}return db[_0x1c89('0x3e')][_0x1c89('0x45')]({'where':{'id':_0xebe056[_0x1c89('0x43')]['id']}})[_0x1c89('0x22')](handleEntityNotFound(_0x195eb7,null))[_0x1c89('0x22')](saveUpdates(_0xebe056[_0x1c89('0x47')],null))[_0x1c89('0x22')](respondWithResult(_0x195eb7,null))[_0x1c89('0x41')](handleError(_0x195eb7,null));};exports[_0x1c89('0x23')]=function(_0x592645,_0x42f486){return db[_0x1c89('0x3e')]['find']({'where':{'id':_0x592645['params']['id']}})[_0x1c89('0x22')](handleEntityNotFound(_0x42f486,null))[_0x1c89('0x22')](removeEntity(_0x42f486,null))[_0x1c89('0x41')](handleError(_0x42f486,null));};exports['describe']=function(_0x472358,_0x1747ea){return db['SquareReport'][_0x1c89('0x48')]()['then'](respondWithResult(_0x1747ea,null))[_0x1c89('0x41')](handleError(_0x1747ea,null));}; \ No newline at end of file +var _0x466b=['order','pick','filters','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5f348b,_0x3f2048){var _0x3623e1=function(_0x6cea66){while(--_0x6cea66){_0x5f348b['push'](_0x5f348b['shift']());}};_0x3623e1(++_0x3f2048);}(_0x466b,0x100));var _0xb466=function(_0x2a1f84,_0x2e9cf5){_0x2a1f84=_0x2a1f84-0x0;var _0x5aa4a4=_0x466b[_0x2a1f84];return _0x5aa4a4;};'use strict';var emlformat=require(_0xb466('0x0'));var rimraf=require(_0xb466('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb466('0x2'));var rp=require(_0xb466('0x3'));var moment=require(_0xb466('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb466('0x5'));var util=require('util');var path=require(_0xb466('0x6'));var sox=require('sox');var csv=require(_0xb466('0x7'));var ejs=require(_0xb466('0x8'));var fs=require('fs');var fs_extra=require(_0xb466('0x9'));var _=require(_0xb466('0xa'));var squel=require(_0xb466('0xb'));var crypto=require(_0xb466('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb466('0xd'));var toCsv=require(_0xb466('0x7'));var querystring=require(_0xb466('0xe'));var Papa=require(_0xb466('0xf'));var Redis=require(_0xb466('0x10'));var authService=require(_0xb466('0x11'));var qs=require(_0xb466('0x12'));var as=require(_0xb466('0x13'));var hardwareService=require(_0xb466('0x14'));var logger=require(_0xb466('0x15'))(_0xb466('0x16'));var utils=require(_0xb466('0x17'));var config=require(_0xb466('0x18'));var licenseUtil=require(_0xb466('0x19'));var db=require(_0xb466('0x1a'))['db'];function respondWithStatusCode(_0x2b0a0d,_0x5b5656){_0x5b5656=_0x5b5656||0xcc;return function(_0x3a1c5c){if(_0x3a1c5c){return _0x2b0a0d[_0xb466('0x1b')](_0x5b5656);}return _0x2b0a0d[_0xb466('0x1c')](_0x5b5656)['end']();};}function respondWithResult(_0x518a28,_0xa7a867){_0xa7a867=_0xa7a867||0xc8;return function(_0x51b155){if(_0x51b155){return _0x518a28[_0xb466('0x1c')](_0xa7a867)[_0xb466('0x1d')](_0x51b155);}};}function respondWithFilteredResult(_0x5723ec,_0x34fcb5){return function(_0x2bf1d8){if(_0x2bf1d8){var _0x5e2446=typeof _0x34fcb5[_0xb466('0x1e')]===_0xb466('0x1f')&&typeof _0x34fcb5['limit']===_0xb466('0x1f');var _0x329731=_0x2bf1d8[_0xb466('0x20')];var _0x224e55=_0x5e2446?0x0:_0x34fcb5['offset'];var _0x4b73cf=_0x5e2446?_0x2bf1d8['count']:_0x34fcb5['offset']+_0x34fcb5[_0xb466('0x21')];var _0x19f807;if(_0x4b73cf>=_0x329731){_0x4b73cf=_0x329731;_0x19f807=0xc8;}else{_0x19f807=0xce;}_0x5723ec[_0xb466('0x1c')](_0x19f807);return _0x5723ec[_0xb466('0x22')]('Content-Range',_0x224e55+'-'+_0x4b73cf+'/'+_0x329731)[_0xb466('0x1d')](_0x2bf1d8);}return null;};}function patchUpdates(_0x1753fb){return function(_0x50fc82){try{jsonpatch[_0xb466('0x23')](_0x50fc82,_0x1753fb,!![]);}catch(_0x1a69fa){return BPromise[_0xb466('0x24')](_0x1a69fa);}return _0x50fc82['save']();};}function saveUpdates(_0x355f84,_0x5afece){return function(_0x127b02){if(_0x127b02){return _0x127b02[_0xb466('0x25')](_0x355f84)[_0xb466('0x26')](function(_0x57e3b7){return _0x57e3b7;});}return null;};}function removeEntity(_0x5a85a3,_0x24f688){return function(_0x15d522){if(_0x15d522){return _0x15d522[_0xb466('0x27')]()[_0xb466('0x26')](function(){_0x5a85a3[_0xb466('0x1c')](0xcc)[_0xb466('0x28')]();});}};}function handleEntityNotFound(_0x3ce683,_0x4d7940){return function(_0x16625e){if(!_0x16625e){_0x3ce683[_0xb466('0x1b')](0x194);}return _0x16625e;};}function handleError(_0xb79e70,_0x5972fd){_0x5972fd=_0x5972fd||0x1f4;return function(_0x4cb31e){logger[_0xb466('0x29')](_0x4cb31e[_0xb466('0x2a')]);if(_0x4cb31e[_0xb466('0x2b')]){delete _0x4cb31e[_0xb466('0x2b')];}_0xb79e70[_0xb466('0x1c')](_0x5972fd)[_0xb466('0x2c')](_0x4cb31e);};}exports[_0xb466('0x2d')]=function(_0x38bac9,_0x12ef67){var _0x5e2079={},_0xb7af93={},_0x34ebf0={'count':0x0,'rows':[]};var _0x368fe9=_[_0xb466('0x2e')](db[_0xb466('0x2f')][_0xb466('0x30')],function(_0x3507e2){return{'name':_0x3507e2[_0xb466('0x31')],'type':_0x3507e2['type'][_0xb466('0x32')]};});_0xb7af93[_0xb466('0x33')]=_[_0xb466('0x2e')](_0x368fe9,_0xb466('0x2b'));_0xb7af93[_0xb466('0x34')]=_[_0xb466('0x35')](_0x38bac9[_0xb466('0x34')]);_0xb7af93['filters']=_[_0xb466('0x36')](_0xb7af93[_0xb466('0x33')],_0xb7af93[_0xb466('0x34')]);_0x5e2079[_0xb466('0x37')]=_[_0xb466('0x36')](_0xb7af93[_0xb466('0x33')],qs['fields'](_0x38bac9[_0xb466('0x34')][_0xb466('0x38')]));_0x5e2079[_0xb466('0x37')]=_0x5e2079[_0xb466('0x37')][_0xb466('0x39')]?_0x5e2079[_0xb466('0x37')]:_0xb7af93[_0xb466('0x33')];if(!_0x38bac9['query'][_0xb466('0x3a')](_0xb466('0x3b'))){_0x5e2079[_0xb466('0x21')]=qs[_0xb466('0x21')](_0x38bac9[_0xb466('0x34')][_0xb466('0x21')]);_0x5e2079[_0xb466('0x1e')]=qs[_0xb466('0x1e')](_0x38bac9['query']['offset']);}_0x5e2079[_0xb466('0x3c')]=qs['sort'](_0x38bac9[_0xb466('0x34')]['sort']);_0x5e2079['where']=qs['filters'](_[_0xb466('0x3d')](_0x38bac9[_0xb466('0x34')],_0xb7af93[_0xb466('0x3e')]),_0x368fe9);if(_0x38bac9[_0xb466('0x34')]['filter']){_0x5e2079[_0xb466('0x3f')]=_[_0xb466('0x40')](_0x5e2079[_0xb466('0x3f')],{'$or':_['map'](_0x368fe9,function(_0x4bbbe4){if(_0x4bbbe4[_0xb466('0x41')]!==_0xb466('0x42')){var _0x2dfa3={};_0x2dfa3[_0x4bbbe4[_0xb466('0x2b')]]={'$like':'%'+_0x38bac9[_0xb466('0x34')][_0xb466('0x43')]+'%'};return _0x2dfa3;}})});}_0x5e2079=_['merge']({},_0x5e2079,_0x38bac9[_0xb466('0x44')]);var _0x24c9cd={'where':_0x5e2079[_0xb466('0x3f')]};return db[_0xb466('0x2f')]['count'](_0x24c9cd)[_0xb466('0x26')](function(_0x202a04){_0x34ebf0[_0xb466('0x20')]=_0x202a04;if(_0x38bac9[_0xb466('0x34')][_0xb466('0x45')]){_0x5e2079['include']=[{'all':!![]}];}return db[_0xb466('0x2f')][_0xb466('0x46')](_0x5e2079);})['then'](function(_0x7e614b){_0x34ebf0['rows']=_0x7e614b;return _0x34ebf0;})[_0xb466('0x26')](respondWithFilteredResult(_0x12ef67,_0x5e2079))[_0xb466('0x47')](handleError(_0x12ef67,null));};exports[_0xb466('0x48')]=function(_0x1e9189,_0x4b8491){var _0x9262b9={'raw':!![],'where':{'id':_0x1e9189[_0xb466('0x49')]['id']}},_0x179de7={};_0x179de7[_0xb466('0x33')]=_[_0xb466('0x35')](db[_0xb466('0x2f')][_0xb466('0x30')]);_0x179de7[_0xb466('0x34')]=_[_0xb466('0x35')](_0x1e9189[_0xb466('0x34')]);_0x179de7[_0xb466('0x3e')]=_[_0xb466('0x36')](_0x179de7[_0xb466('0x33')],_0x179de7['query']);_0x9262b9['attributes']=_['intersection'](_0x179de7[_0xb466('0x33')],qs['fields'](_0x1e9189['query'][_0xb466('0x38')]));_0x9262b9[_0xb466('0x37')]=_0x9262b9[_0xb466('0x37')]['length']?_0x9262b9['attributes']:_0x179de7[_0xb466('0x33')];if(_0x1e9189['query']['includeAll']){_0x9262b9[_0xb466('0x4a')]=[{'all':!![]}];}_0x9262b9=_[_0xb466('0x40')]({},_0x9262b9,_0x1e9189[_0xb466('0x44')]);return db['SquareReport'][_0xb466('0x4b')](_0x9262b9)['then'](handleEntityNotFound(_0x4b8491,null))['then'](respondWithResult(_0x4b8491,null))[_0xb466('0x47')](handleError(_0x4b8491,null));};exports[_0xb466('0x4c')]=function(_0xd34ab6,_0x6be2e4){return db[_0xb466('0x2f')][_0xb466('0x4c')](_0xd34ab6[_0xb466('0x4d')],{})[_0xb466('0x26')](respondWithResult(_0x6be2e4,0xc9))[_0xb466('0x47')](handleError(_0x6be2e4,null));};exports[_0xb466('0x25')]=function(_0x1629d8,_0x28be86){if(_0x1629d8[_0xb466('0x4d')]['id']){delete _0x1629d8['body']['id'];}return db[_0xb466('0x2f')][_0xb466('0x4b')]({'where':{'id':_0x1629d8[_0xb466('0x49')]['id']}})[_0xb466('0x26')](handleEntityNotFound(_0x28be86,null))[_0xb466('0x26')](saveUpdates(_0x1629d8[_0xb466('0x4d')],null))['then'](respondWithResult(_0x28be86,null))['catch'](handleError(_0x28be86,null));};exports[_0xb466('0x27')]=function(_0x3602ec,_0x50508e){return db[_0xb466('0x2f')][_0xb466('0x4b')]({'where':{'id':_0x3602ec[_0xb466('0x49')]['id']}})[_0xb466('0x26')](handleEntityNotFound(_0x50508e,null))[_0xb466('0x26')](removeEntity(_0x50508e,null))[_0xb466('0x47')](handleError(_0x50508e,null));};exports[_0xb466('0x4e')]=function(_0xf748a5,_0x38b6ea){return db['SquareReport'][_0xb466('0x4e')]()[_0xb466('0x26')](respondWithResult(_0x38b6ea,null))[_0xb466('0x47')](handleError(_0x38b6ea,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 236b899..f9233e7 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 _0xd57c=['exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x4e1e1f,_0x11a516){var _0x227f71=function(_0x23100a){while(--_0x23100a){_0x4e1e1f['push'](_0x4e1e1f['shift']());}};_0x227f71(++_0x11a516);}(_0xd57c,0x18e));var _0xcd57=function(_0x169a8a,_0x3526b1){_0x169a8a=_0x169a8a-0x0;var _0x2e8502=_0xd57c[_0x169a8a];return _0x2e8502;};'use strict';var _=require(_0xcd57('0x0'));var util=require(_0xcd57('0x1'));var logger=require(_0xcd57('0x2'))(_0xcd57('0x3'));var moment=require('moment');var BPromise=require(_0xcd57('0x4'));var rp=require(_0xcd57('0x5'));var fs=require('fs');var path=require(_0xcd57('0x6'));var rimraf=require(_0xcd57('0x7'));var config=require(_0xcd57('0x8'));var attributes=require(_0xcd57('0x9'));module[_0xcd57('0xa')]=function(_0x37dec3,_0x55fce8){return _0x37dec3['define'](_0xcd57('0xb'),attributes,{'tableName':_0xcd57('0xc'),'paranoid':![],'indexes':[{'name':_0xcd57('0xd'),'fields':[_0xcd57('0xe'),_0xcd57('0xf')]},{'name':'leaveAt','fields':[_0xcd57('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0695=['rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0x0695,0x12a));var _0x5069=function(_0x5876de,_0xacce42){_0x5876de=_0x5876de-0x0;var _0x232bf8=_0x0695[_0x5876de];return _0x232bf8;};'use strict';var _=require(_0x5069('0x0'));var util=require(_0x5069('0x1'));var logger=require('../../config/logger')(_0x5069('0x2'));var moment=require(_0x5069('0x3'));var BPromise=require(_0x5069('0x4'));var rp=require(_0x5069('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5069('0x6'));var config=require(_0x5069('0x7'));var attributes=require(_0x5069('0x8'));module[_0x5069('0x9')]=function(_0x419588,_0x1be77b){return _0x419588['define'](_0x5069('0xa'),attributes,{'tableName':_0x5069('0xb'),'paranoid':![],'indexes':[{'name':_0x5069('0xc'),'fields':[_0x5069('0xd'),_0x5069('0xe')]},{'name':_0x5069('0xf'),'fields':[_0x5069('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 144bd50..a31dfd4 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 _0x7e80=['attributes','limit','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','info','result','CreateSquareReport','SquareReport','body','options','raw','then','stringify','UpdateSquareReport','where'];(function(_0x183cab,_0x191c3c){var _0x33538a=function(_0x20ee82){while(--_0x20ee82){_0x183cab['push'](_0x183cab['shift']());}};_0x33538a(++_0x191c3c);}(_0x7e80,0x111));var _0x07e8=function(_0x25764f,_0x1db05e){_0x25764f=_0x25764f-0x0;var _0x217e84=_0x7e80[_0x25764f];return _0x217e84;};'use strict';var _=require(_0x07e8('0x0'));var util=require(_0x07e8('0x1'));var moment=require(_0x07e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07e8('0x3'))['db'];var utils=require(_0x07e8('0x4'));var logger=require(_0x07e8('0x5'))(_0x07e8('0x6'));var config=require('../../config/environment');var jayson=require(_0x07e8('0x7'));var client=jayson[_0x07e8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2efb5b,_0x1738d9,_0x1b6bb0){return new BPromise(function(_0x6d5330,_0x6590ba){return client[_0x07e8('0x9')](_0x2efb5b,_0x1b6bb0)['then'](function(_0x236871){logger['info'](_0x07e8('0xa'),_0x1738d9,_0x07e8('0xb'));logger[_0x07e8('0xc')](_0x07e8('0xd'),_0x1738d9,_0x07e8('0xb'),JSON['stringify'](_0x236871));if(_0x236871[_0x07e8('0xe')]){if(_0x236871['error']['code']===0x1f4){logger[_0x07e8('0xe')](_0x07e8('0xa'),_0x1738d9,_0x236871[_0x07e8('0xe')][_0x07e8('0xf')]);return _0x6590ba(_0x236871[_0x07e8('0xe')][_0x07e8('0xf')]);}logger[_0x07e8('0xe')]('SquareReport,\x20%s,\x20%s',_0x1738d9,_0x236871[_0x07e8('0xe')][_0x07e8('0xf')]);return _0x6d5330(_0x236871[_0x07e8('0xe')][_0x07e8('0xf')]);}else{logger[_0x07e8('0x10')](_0x07e8('0xa'),_0x1738d9,_0x07e8('0xb'));_0x6d5330(_0x236871[_0x07e8('0x11')][_0x07e8('0xf')]);}})['catch'](function(_0x13c19c){logger[_0x07e8('0xe')](_0x07e8('0xa'),_0x1738d9,_0x13c19c);_0x6590ba(_0x13c19c);});});}exports[_0x07e8('0x12')]=function(_0x1e3da4){var _0x3c5060=this;return new Promise(function(_0x2d396a,_0x5b150c){return db[_0x07e8('0x13')]['create'](_0x1e3da4[_0x07e8('0x14')],{'raw':_0x1e3da4[_0x07e8('0x15')]?_0x1e3da4[_0x07e8('0x15')][_0x07e8('0x16')]===undefined?!![]:![]:!![]})[_0x07e8('0x17')](function(_0x2eec34){logger[_0x07e8('0x10')](_0x07e8('0x12'),_0x1e3da4);logger['debug'](_0x07e8('0x12'),_0x1e3da4,JSON[_0x07e8('0x18')](_0x2eec34));_0x2d396a(_0x2eec34);})['catch'](function(_0xa1f71d){logger[_0x07e8('0xe')](_0x07e8('0x12'),_0xa1f71d[_0x07e8('0xf')],_0x1e3da4);_0x5b150c(_0x3c5060[_0x07e8('0xe')](0x1f4,_0xa1f71d[_0x07e8('0xf')]));});});};exports[_0x07e8('0x19')]=function(_0x5795b4){var _0x2016d3=this;return new Promise(function(_0xde5f6e,_0x305e62){return db['SquareReport']['update'](_0x5795b4[_0x07e8('0x14')],{'raw':_0x5795b4[_0x07e8('0x15')]?_0x5795b4['options'][_0x07e8('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5795b4['options']?_0x5795b4[_0x07e8('0x15')][_0x07e8('0x1a')]||null:null,'attributes':_0x5795b4['options']?_0x5795b4[_0x07e8('0x15')][_0x07e8('0x1b')]||null:null,'limit':_0x5795b4[_0x07e8('0x15')]?_0x5795b4['options'][_0x07e8('0x1c')]||null:null})[_0x07e8('0x17')](function(_0x46f981){logger['info'](_0x07e8('0x19'),_0x5795b4);logger[_0x07e8('0xc')](_0x07e8('0x19'),_0x5795b4,JSON[_0x07e8('0x18')](_0x46f981));_0xde5f6e(_0x46f981);})[_0x07e8('0x1d')](function(_0x5ed261){logger['error'](_0x07e8('0x19'),_0x5ed261[_0x07e8('0xf')],_0x5795b4);_0x305e62(_0x2016d3[_0x07e8('0xe')](0x1f4,_0x5ed261[_0x07e8('0xf')]));});});}; \ No newline at end of file +var _0xf399=['error','message','result','catch','CreateSquareReport','options','UpdateSquareReport','SquareReport','update','body','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x522302,_0x6cf3d1){var _0x1248b7=function(_0xa5e55){while(--_0xa5e55){_0x522302['push'](_0x522302['shift']());}};_0x1248b7(++_0x6cf3d1);}(_0xf399,0x18d));var _0x9f39=function(_0x53d8ad,_0x416a34){_0x53d8ad=_0x53d8ad-0x0;var _0x555e62=_0xf399[_0x53d8ad];return _0x555e62;};'use strict';var _=require(_0x9f39('0x0'));var util=require(_0x9f39('0x1'));var moment=require(_0x9f39('0x2'));var BPromise=require(_0x9f39('0x3'));var rs=require(_0x9f39('0x4'));var fs=require('fs');var Redis=require(_0x9f39('0x5'));var db=require(_0x9f39('0x6'))['db'];var utils=require(_0x9f39('0x7'));var logger=require(_0x9f39('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f39('0x9'));var client=jayson[_0x9f39('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2845d2,_0x138893,_0x304b50){return new BPromise(function(_0x4ec7ae,_0x4eedb2){return client[_0x9f39('0xb')](_0x2845d2,_0x304b50)[_0x9f39('0xc')](function(_0xe10591){logger[_0x9f39('0xd')](_0x9f39('0xe'),_0x138893,'request\x20sent');logger[_0x9f39('0xf')](_0x9f39('0x10'),_0x138893,_0x9f39('0x11'),JSON[_0x9f39('0x12')](_0xe10591));if(_0xe10591['error']){if(_0xe10591['error']['code']===0x1f4){logger[_0x9f39('0x13')](_0x9f39('0xe'),_0x138893,_0xe10591[_0x9f39('0x13')][_0x9f39('0x14')]);return _0x4eedb2(_0xe10591[_0x9f39('0x13')][_0x9f39('0x14')]);}logger[_0x9f39('0x13')](_0x9f39('0xe'),_0x138893,_0xe10591[_0x9f39('0x13')]['message']);return _0x4ec7ae(_0xe10591[_0x9f39('0x13')]['message']);}else{logger[_0x9f39('0xd')](_0x9f39('0xe'),_0x138893,_0x9f39('0x11'));_0x4ec7ae(_0xe10591[_0x9f39('0x15')][_0x9f39('0x14')]);}})[_0x9f39('0x16')](function(_0xe5821b){logger['error']('SquareReport,\x20%s,\x20%s',_0x138893,_0xe5821b);_0x4eedb2(_0xe5821b);});});}exports[_0x9f39('0x17')]=function(_0x32ebcd){var _0x5cf567=this;return new Promise(function(_0x4c2e9b,_0x598e0f){return db['SquareReport']['create'](_0x32ebcd['body'],{'raw':_0x32ebcd[_0x9f39('0x18')]?_0x32ebcd[_0x9f39('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9f39('0xc')](function(_0x119232){logger[_0x9f39('0xd')]('CreateSquareReport',_0x32ebcd);logger['debug'](_0x9f39('0x17'),_0x32ebcd,JSON['stringify'](_0x119232));_0x4c2e9b(_0x119232);})[_0x9f39('0x16')](function(_0x50f66a){logger[_0x9f39('0x13')](_0x9f39('0x17'),_0x50f66a['message'],_0x32ebcd);_0x598e0f(_0x5cf567[_0x9f39('0x13')](0x1f4,_0x50f66a[_0x9f39('0x14')]));});});};exports[_0x9f39('0x19')]=function(_0x2d20d7){var _0x32fde4=this;return new Promise(function(_0x1082a4,_0x47f67e){return db[_0x9f39('0x1a')][_0x9f39('0x1b')](_0x2d20d7[_0x9f39('0x1c')],{'raw':_0x2d20d7['options']?_0x2d20d7[_0x9f39('0x18')][_0x9f39('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d20d7[_0x9f39('0x18')]?_0x2d20d7[_0x9f39('0x18')][_0x9f39('0x1e')]||null:null,'attributes':_0x2d20d7['options']?_0x2d20d7[_0x9f39('0x18')][_0x9f39('0x1f')]||null:null,'limit':_0x2d20d7[_0x9f39('0x18')]?_0x2d20d7[_0x9f39('0x18')]['limit']||null:null})[_0x9f39('0xc')](function(_0x5000ce){logger['info'](_0x9f39('0x19'),_0x2d20d7);logger[_0x9f39('0xf')](_0x9f39('0x19'),_0x2d20d7,JSON[_0x9f39('0x12')](_0x5000ce));_0x1082a4(_0x5000ce);})['catch'](function(_0x5cc5fc){logger[_0x9f39('0x13')](_0x9f39('0x19'),_0x5cc5fc[_0x9f39('0x14')],_0x2d20d7);_0x47f67e(_0x32fde4[_0x9f39('0x13')](0x1f4,_0x5cc5fc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 38a58e1..58608f1 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 _0xd5c1=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xd5c1,0x1ef));var _0x1d5c=function(_0x4d93a5,_0x32bde7){_0x4d93a5=_0x4d93a5-0x0;var _0x476e69=_0xd5c1[_0x4d93a5];return _0x476e69;};'use strict';var multer=require('multer');var util=require(_0x1d5c('0x0'));var path=require('path');var timeout=require(_0x1d5c('0x1'));var express=require('express');var router=express[_0x1d5c('0x2')]();var fs_extra=require(_0x1d5c('0x3'));var auth=require(_0x1d5c('0x4'));var interaction=require(_0x1d5c('0x5'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0x1d5c('0x6')]('/',auth[_0x1d5c('0x7')](),controller[_0x1d5c('0x8')]);router[_0x1d5c('0x6')](_0x1d5c('0x9'),auth[_0x1d5c('0x7')](),controller[_0x1d5c('0xa')]);router[_0x1d5c('0x6')](_0x1d5c('0xb'),auth[_0x1d5c('0x7')](),controller[_0x1d5c('0xc')]);router[_0x1d5c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1d5c('0xe')](_0x1d5c('0xb'),auth[_0x1d5c('0x7')](),controller['update']);router['delete']('/:id',auth[_0x1d5c('0x7')](),controller[_0x1d5c('0xf')]);module[_0x1d5c('0x10')]=router; \ No newline at end of file +var _0xde16=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4f7519,_0x457a82){var _0x1d66be=function(_0x463058){while(--_0x463058){_0x4f7519['push'](_0x4f7519['shift']());}};_0x1d66be(++_0x457a82);}(_0xde16,0x106));var _0x6de1=function(_0x423fae,_0x4db1ed){_0x423fae=_0x423fae-0x0;var _0x915f4d=_0xde16[_0x423fae];return _0x915f4d;};'use strict';var multer=require(_0x6de1('0x0'));var util=require(_0x6de1('0x1'));var path=require(_0x6de1('0x2'));var timeout=require(_0x6de1('0x3'));var express=require('express');var router=express[_0x6de1('0x4')]();var fs_extra=require(_0x6de1('0x5'));var auth=require(_0x6de1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6de1('0x7'));var controller=require(_0x6de1('0x8'));router[_0x6de1('0x9')]('/',auth['isAuthenticated'](),controller[_0x6de1('0xa')]);router[_0x6de1('0x9')](_0x6de1('0xb'),auth[_0x6de1('0xc')](),controller[_0x6de1('0xd')]);router[_0x6de1('0x9')](_0x6de1('0xe'),auth[_0x6de1('0xc')](),controller[_0x6de1('0xf')]);router[_0x6de1('0x10')]('/',auth[_0x6de1('0xc')](),controller[_0x6de1('0x11')]);router[_0x6de1('0x12')]('/:id',auth[_0x6de1('0xc')](),controller['update']);router[_0x6de1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6de1('0x14')]);module[_0x6de1('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7095de0..064c79b 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 _0xdc6d=['STRING','TEXT','sequelize'];(function(_0x2e8215,_0x35cd2e){var _0x52803e=function(_0x4271a0){while(--_0x4271a0){_0x2e8215['push'](_0x2e8215['shift']());}};_0x52803e(++_0x35cd2e);}(_0xdc6d,0x13a));var _0xddc6=function(_0x41fedd,_0x8cda97){_0x41fedd=_0x41fedd-0x0;var _0x4b62ba=_0xdc6d[_0x41fedd];return _0x4b62ba;};'use strict';var Sequelize=require(_0xddc6('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xddc6('0x1')]},'node':{'type':Sequelize[_0xddc6('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xddc6('0x2')]},'project_name':{'type':Sequelize[_0xddc6('0x1')]},'callerid':{'type':Sequelize[_0xddc6('0x1')]}}; \ No newline at end of file +var _0x9935=['exports','STRING','TEXT','sequelize'];(function(_0x459ebb,_0x1515a0){var _0x20a740=function(_0x5d7c79){while(--_0x5d7c79){_0x459ebb['push'](_0x459ebb['shift']());}};_0x20a740(++_0x1515a0);}(_0x9935,0xd7));var _0x5993=function(_0x7ffcc7,_0x42df63){_0x7ffcc7=_0x7ffcc7-0x0;var _0x3bda64=_0x9935[_0x7ffcc7];return _0x3bda64;};'use strict';var Sequelize=require(_0x5993('0x0'));module[_0x5993('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x5993('0x2')]},'application':{'type':Sequelize[_0x5993('0x2')]},'data':{'type':Sequelize[_0x5993('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5993('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index ba9af18..6341e88 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 _0xd1b0=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','SquareDetailsReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe'];(function(_0x158ab3,_0x4b5908){var _0x302830=function(_0x19fa14){while(--_0x19fa14){_0x158ab3['push'](_0x158ab3['shift']());}};_0x302830(++_0x4b5908);}(_0xd1b0,0x8e));var _0x0d1b=function(_0x45cc3c,_0x132658){_0x45cc3c=_0x45cc3c-0x0;var _0x132b5b=_0xd1b0[_0x45cc3c];return _0x132b5b;};'use strict';var emlformat=require(_0x0d1b('0x0'));var rimraf=require(_0x0d1b('0x1'));var zipdir=require(_0x0d1b('0x2'));var jsonpatch=require(_0x0d1b('0x3'));var rp=require(_0x0d1b('0x4'));var moment=require(_0x0d1b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d1b('0x6'));var path=require(_0x0d1b('0x7'));var sox=require('sox');var csv=require(_0x0d1b('0x8'));var ejs=require(_0x0d1b('0x9'));var fs=require('fs');var fs_extra=require(_0x0d1b('0xa'));var _=require('lodash');var squel=require(_0x0d1b('0xb'));var crypto=require(_0x0d1b('0xc'));var jsforce=require(_0x0d1b('0xd'));var deskjs=require(_0x0d1b('0xe'));var toCsv=require(_0x0d1b('0x8'));var querystring=require(_0x0d1b('0xf'));var Papa=require(_0x0d1b('0x10'));var Redis=require(_0x0d1b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0d1b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d1b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0d1b('0x14'));var licenseUtil=require(_0x0d1b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d335c,_0x50c7ec){_0x50c7ec=_0x50c7ec||0xcc;return function(_0x415190){if(_0x415190){return _0x4d335c['sendStatus'](_0x50c7ec);}return _0x4d335c[_0x0d1b('0x16')](_0x50c7ec)[_0x0d1b('0x17')]();};}function respondWithResult(_0x5882e4,_0x2eff86){_0x2eff86=_0x2eff86||0xc8;return function(_0x3c7258){if(_0x3c7258){return _0x5882e4[_0x0d1b('0x16')](_0x2eff86)[_0x0d1b('0x18')](_0x3c7258);}};}function respondWithFilteredResult(_0x9c81ae,_0x2ee585){return function(_0x223676){if(_0x223676){var _0x337fd7=typeof _0x2ee585['offset']==='undefined'&&typeof _0x2ee585[_0x0d1b('0x19')]===_0x0d1b('0x1a');var _0x3a903f=_0x223676['count'];var _0x315088=_0x337fd7?0x0:_0x2ee585[_0x0d1b('0x1b')];var _0x30e5fe=_0x337fd7?_0x223676[_0x0d1b('0x1c')]:_0x2ee585[_0x0d1b('0x1b')]+_0x2ee585[_0x0d1b('0x19')];var _0x1e1282;if(_0x30e5fe>=_0x3a903f){_0x30e5fe=_0x3a903f;_0x1e1282=0xc8;}else{_0x1e1282=0xce;}_0x9c81ae[_0x0d1b('0x16')](_0x1e1282);return _0x9c81ae[_0x0d1b('0x1d')](_0x0d1b('0x1e'),_0x315088+'-'+_0x30e5fe+'/'+_0x3a903f)[_0x0d1b('0x18')](_0x223676);}return null;};}function patchUpdates(_0x499995){return function(_0xf5f704){try{jsonpatch[_0x0d1b('0x1f')](_0xf5f704,_0x499995,!![]);}catch(_0x422585){return BPromise[_0x0d1b('0x20')](_0x422585);}return _0xf5f704[_0x0d1b('0x21')]();};}function saveUpdates(_0x2cd956,_0x19930e){return function(_0x3dffee){if(_0x3dffee){return _0x3dffee[_0x0d1b('0x22')](_0x2cd956)[_0x0d1b('0x23')](function(_0x37554c){return _0x37554c;});}return null;};}function removeEntity(_0xee29e7,_0x14d002){return function(_0x2d2cb1){if(_0x2d2cb1){return _0x2d2cb1[_0x0d1b('0x24')]()['then'](function(){_0xee29e7['status'](0xcc)[_0x0d1b('0x17')]();});}};}function handleEntityNotFound(_0x15f153,_0x388df4){return function(_0x177336){if(!_0x177336){_0x15f153[_0x0d1b('0x25')](0x194);}return _0x177336;};}function handleError(_0x122f72,_0x33f4ac){_0x33f4ac=_0x33f4ac||0x1f4;return function(_0x3f921f){logger[_0x0d1b('0x26')](_0x3f921f['stack']);if(_0x3f921f[_0x0d1b('0x27')]){delete _0x3f921f['name'];}_0x122f72['status'](_0x33f4ac)[_0x0d1b('0x28')](_0x3f921f);};}exports['index']=function(_0x1f8c24,_0x56a489){var _0x34ee1={},_0x2f4eba={},_0x1cb125={'count':0x0,'rows':[]};var _0x571a8a=_[_0x0d1b('0x29')](db[_0x0d1b('0x2a')][_0x0d1b('0x2b')],function(_0x35b840){return{'name':_0x35b840['fieldName'],'type':_0x35b840['type']['key']};});_0x2f4eba[_0x0d1b('0x2c')]=_['map'](_0x571a8a,'name');_0x2f4eba[_0x0d1b('0x2d')]=_[_0x0d1b('0x2e')](_0x1f8c24[_0x0d1b('0x2d')]);_0x2f4eba[_0x0d1b('0x2f')]=_[_0x0d1b('0x30')](_0x2f4eba[_0x0d1b('0x2c')],_0x2f4eba[_0x0d1b('0x2d')]);_0x34ee1[_0x0d1b('0x31')]=_['intersection'](_0x2f4eba[_0x0d1b('0x2c')],qs[_0x0d1b('0x32')](_0x1f8c24[_0x0d1b('0x2d')]['fields']));_0x34ee1[_0x0d1b('0x31')]=_0x34ee1[_0x0d1b('0x31')][_0x0d1b('0x33')]?_0x34ee1[_0x0d1b('0x31')]:_0x2f4eba[_0x0d1b('0x2c')];if(!_0x1f8c24[_0x0d1b('0x2d')][_0x0d1b('0x34')]('nolimit')){_0x34ee1['limit']=qs[_0x0d1b('0x19')](_0x1f8c24['query'][_0x0d1b('0x19')]);_0x34ee1[_0x0d1b('0x1b')]=qs['offset'](_0x1f8c24[_0x0d1b('0x2d')][_0x0d1b('0x1b')]);}_0x34ee1['order']=qs[_0x0d1b('0x35')](_0x1f8c24[_0x0d1b('0x2d')][_0x0d1b('0x35')]);_0x34ee1[_0x0d1b('0x36')]=qs[_0x0d1b('0x2f')](_['pick'](_0x1f8c24['query'],_0x2f4eba[_0x0d1b('0x2f')]),_0x571a8a);if(_0x1f8c24[_0x0d1b('0x2d')][_0x0d1b('0x37')]){_0x34ee1[_0x0d1b('0x36')]=_['merge'](_0x34ee1[_0x0d1b('0x36')],{'$or':_[_0x0d1b('0x29')](_0x571a8a,function(_0x343e30){if(_0x343e30[_0x0d1b('0x38')]!==_0x0d1b('0x39')){var _0x39c1c0={};_0x39c1c0[_0x343e30[_0x0d1b('0x27')]]={'$like':'%'+_0x1f8c24[_0x0d1b('0x2d')][_0x0d1b('0x37')]+'%'};return _0x39c1c0;}})});}_0x34ee1=_[_0x0d1b('0x3a')]({},_0x34ee1,_0x1f8c24[_0x0d1b('0x3b')]);var _0x37bb64={'where':_0x34ee1[_0x0d1b('0x36')]};return db[_0x0d1b('0x2a')][_0x0d1b('0x1c')](_0x37bb64)['then'](function(_0x284c00){_0x1cb125['count']=_0x284c00;if(_0x1f8c24[_0x0d1b('0x2d')][_0x0d1b('0x3c')]){_0x34ee1[_0x0d1b('0x3d')]=[{'all':!![]}];}return db[_0x0d1b('0x2a')][_0x0d1b('0x3e')](_0x34ee1);})[_0x0d1b('0x23')](function(_0x198cb8){_0x1cb125[_0x0d1b('0x3f')]=_0x198cb8;return _0x1cb125;})[_0x0d1b('0x23')](respondWithFilteredResult(_0x56a489,_0x34ee1))[_0x0d1b('0x40')](handleError(_0x56a489,null));};exports[_0x0d1b('0x41')]=function(_0x450207,_0x422982){var _0x48def2={'raw':!![],'where':{'id':_0x450207[_0x0d1b('0x42')]['id']}},_0x4be58c={};_0x4be58c['model']=_['keys'](db[_0x0d1b('0x2a')][_0x0d1b('0x2b')]);_0x4be58c[_0x0d1b('0x2d')]=_['keys'](_0x450207[_0x0d1b('0x2d')]);_0x4be58c[_0x0d1b('0x2f')]=_[_0x0d1b('0x30')](_0x4be58c['model'],_0x4be58c['query']);_0x48def2[_0x0d1b('0x31')]=_[_0x0d1b('0x30')](_0x4be58c[_0x0d1b('0x2c')],qs[_0x0d1b('0x32')](_0x450207[_0x0d1b('0x2d')]['fields']));_0x48def2[_0x0d1b('0x31')]=_0x48def2[_0x0d1b('0x31')][_0x0d1b('0x33')]?_0x48def2[_0x0d1b('0x31')]:_0x4be58c['model'];if(_0x450207['query']['includeAll']){_0x48def2[_0x0d1b('0x3d')]=[{'all':!![]}];}_0x48def2=_[_0x0d1b('0x3a')]({},_0x48def2,_0x450207['options']);return db[_0x0d1b('0x2a')][_0x0d1b('0x43')](_0x48def2)[_0x0d1b('0x23')](handleEntityNotFound(_0x422982,null))[_0x0d1b('0x23')](respondWithResult(_0x422982,null))['catch'](handleError(_0x422982,null));};exports[_0x0d1b('0x44')]=function(_0x2bac97,_0xe9578e){return db[_0x0d1b('0x2a')][_0x0d1b('0x44')](_0x2bac97[_0x0d1b('0x45')],{})[_0x0d1b('0x23')](respondWithResult(_0xe9578e,0xc9))[_0x0d1b('0x40')](handleError(_0xe9578e,null));};exports[_0x0d1b('0x22')]=function(_0x5e39c3,_0x33f772){if(_0x5e39c3[_0x0d1b('0x45')]['id']){delete _0x5e39c3[_0x0d1b('0x45')]['id'];}return db[_0x0d1b('0x2a')][_0x0d1b('0x43')]({'where':{'id':_0x5e39c3[_0x0d1b('0x42')]['id']}})[_0x0d1b('0x23')](handleEntityNotFound(_0x33f772,null))[_0x0d1b('0x23')](saveUpdates(_0x5e39c3[_0x0d1b('0x45')],null))[_0x0d1b('0x23')](respondWithResult(_0x33f772,null))[_0x0d1b('0x40')](handleError(_0x33f772,null));};exports[_0x0d1b('0x24')]=function(_0x5ddbd5,_0x4573b7){return db[_0x0d1b('0x2a')]['find']({'where':{'id':_0x5ddbd5['params']['id']}})[_0x0d1b('0x23')](handleEntityNotFound(_0x4573b7,null))[_0x0d1b('0x23')](removeEntity(_0x4573b7,null))[_0x0d1b('0x40')](handleError(_0x4573b7,null));};exports[_0x0d1b('0x46')]=function(_0x1c31ed,_0x3733ab){return db[_0x0d1b('0x2a')]['describe']()[_0x0d1b('0x23')](respondWithResult(_0x3733ab,null))[_0x0d1b('0x40')](handleError(_0x3733ab,null));}; \ No newline at end of file +var _0x6eb6=['save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','findAll','rows','catch','show','keys','includeAll','include','find','create','body','params','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6eb6,0x115));var _0x66eb=function(_0x1283b5,_0x2dfae3){_0x1283b5=_0x1283b5-0x0;var _0x176d03=_0x6eb6[_0x1283b5];return _0x176d03;};'use strict';var emlformat=require(_0x66eb('0x0'));var rimraf=require(_0x66eb('0x1'));var zipdir=require(_0x66eb('0x2'));var jsonpatch=require(_0x66eb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66eb('0x4'));var util=require(_0x66eb('0x5'));var path=require(_0x66eb('0x6'));var sox=require(_0x66eb('0x7'));var csv=require(_0x66eb('0x8'));var ejs=require(_0x66eb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x66eb('0xa'));var jsforce=require(_0x66eb('0xb'));var deskjs=require(_0x66eb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x66eb('0xd'));var Papa=require(_0x66eb('0xe'));var Redis=require(_0x66eb('0xf'));var authService=require(_0x66eb('0x10'));var qs=require(_0x66eb('0x11'));var as=require(_0x66eb('0x12'));var hardwareService=require(_0x66eb('0x13'));var logger=require('../../config/logger')(_0x66eb('0x14'));var utils=require(_0x66eb('0x15'));var config=require(_0x66eb('0x16'));var licenseUtil=require(_0x66eb('0x17'));var db=require(_0x66eb('0x18'))['db'];function respondWithStatusCode(_0x4b1be7,_0x146e30){_0x146e30=_0x146e30||0xcc;return function(_0x4188af){if(_0x4188af){return _0x4b1be7['sendStatus'](_0x146e30);}return _0x4b1be7[_0x66eb('0x19')](_0x146e30)[_0x66eb('0x1a')]();};}function respondWithResult(_0x53feb6,_0x1dcdf4){_0x1dcdf4=_0x1dcdf4||0xc8;return function(_0x2e9f18){if(_0x2e9f18){return _0x53feb6[_0x66eb('0x19')](_0x1dcdf4)[_0x66eb('0x1b')](_0x2e9f18);}};}function respondWithFilteredResult(_0x529de3,_0x5eb5a3){return function(_0x123fa9){if(_0x123fa9){var _0x4e4b56=typeof _0x5eb5a3['offset']===_0x66eb('0x1c')&&typeof _0x5eb5a3[_0x66eb('0x1d')]===_0x66eb('0x1c');var _0x41a0fe=_0x123fa9[_0x66eb('0x1e')];var _0x51fd63=_0x4e4b56?0x0:_0x5eb5a3[_0x66eb('0x1f')];var _0x49ff63=_0x4e4b56?_0x123fa9[_0x66eb('0x1e')]:_0x5eb5a3[_0x66eb('0x1f')]+_0x5eb5a3[_0x66eb('0x1d')];var _0xe8db5f;if(_0x49ff63>=_0x41a0fe){_0x49ff63=_0x41a0fe;_0xe8db5f=0xc8;}else{_0xe8db5f=0xce;}_0x529de3[_0x66eb('0x19')](_0xe8db5f);return _0x529de3['set'](_0x66eb('0x20'),_0x51fd63+'-'+_0x49ff63+'/'+_0x41a0fe)[_0x66eb('0x1b')](_0x123fa9);}return null;};}function patchUpdates(_0x44dc11){return function(_0x4951bf){try{jsonpatch[_0x66eb('0x21')](_0x4951bf,_0x44dc11,!![]);}catch(_0x37355b){return BPromise[_0x66eb('0x22')](_0x37355b);}return _0x4951bf[_0x66eb('0x23')]();};}function saveUpdates(_0x574eb5,_0x5a247c){return function(_0x1f0f44){if(_0x1f0f44){return _0x1f0f44[_0x66eb('0x24')](_0x574eb5)['then'](function(_0x127670){return _0x127670;});}return null;};}function removeEntity(_0x3f1a5a,_0x3e5fc7){return function(_0xa57861){if(_0xa57861){return _0xa57861[_0x66eb('0x25')]()[_0x66eb('0x26')](function(){_0x3f1a5a[_0x66eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8b50,_0x2cc089){return function(_0x3eb863){if(!_0x3eb863){_0x1f8b50[_0x66eb('0x27')](0x194);}return _0x3eb863;};}function handleError(_0x571674,_0xd2dfc0){_0xd2dfc0=_0xd2dfc0||0x1f4;return function(_0x303f51){logger[_0x66eb('0x28')](_0x303f51[_0x66eb('0x29')]);if(_0x303f51[_0x66eb('0x2a')]){delete _0x303f51[_0x66eb('0x2a')];}_0x571674[_0x66eb('0x19')](_0xd2dfc0)[_0x66eb('0x2b')](_0x303f51);};}exports[_0x66eb('0x2c')]=function(_0x44f31a,_0x41e20a){var _0x3309d4={},_0x41e529={},_0x1eaf17={'count':0x0,'rows':[]};var _0x596d23=_[_0x66eb('0x2d')](db[_0x66eb('0x2e')][_0x66eb('0x2f')],function(_0x3e8a90){return{'name':_0x3e8a90[_0x66eb('0x30')],'type':_0x3e8a90[_0x66eb('0x31')][_0x66eb('0x32')]};});_0x41e529[_0x66eb('0x33')]=_['map'](_0x596d23,_0x66eb('0x2a'));_0x41e529['query']=_['keys'](_0x44f31a[_0x66eb('0x34')]);_0x41e529[_0x66eb('0x35')]=_[_0x66eb('0x36')](_0x41e529['model'],_0x41e529[_0x66eb('0x34')]);_0x3309d4[_0x66eb('0x37')]=_[_0x66eb('0x36')](_0x41e529[_0x66eb('0x33')],qs[_0x66eb('0x38')](_0x44f31a[_0x66eb('0x34')][_0x66eb('0x38')]));_0x3309d4[_0x66eb('0x37')]=_0x3309d4[_0x66eb('0x37')][_0x66eb('0x39')]?_0x3309d4[_0x66eb('0x37')]:_0x41e529[_0x66eb('0x33')];if(!_0x44f31a[_0x66eb('0x34')][_0x66eb('0x3a')](_0x66eb('0x3b'))){_0x3309d4[_0x66eb('0x1d')]=qs[_0x66eb('0x1d')](_0x44f31a[_0x66eb('0x34')]['limit']);_0x3309d4[_0x66eb('0x1f')]=qs[_0x66eb('0x1f')](_0x44f31a[_0x66eb('0x34')][_0x66eb('0x1f')]);}_0x3309d4[_0x66eb('0x3c')]=qs[_0x66eb('0x3d')](_0x44f31a[_0x66eb('0x34')][_0x66eb('0x3d')]);_0x3309d4['where']=qs['filters'](_['pick'](_0x44f31a[_0x66eb('0x34')],_0x41e529[_0x66eb('0x35')]),_0x596d23);if(_0x44f31a[_0x66eb('0x34')][_0x66eb('0x3e')]){_0x3309d4[_0x66eb('0x3f')]=_[_0x66eb('0x40')](_0x3309d4[_0x66eb('0x3f')],{'$or':_[_0x66eb('0x2d')](_0x596d23,function(_0x484c8a){if(_0x484c8a[_0x66eb('0x31')]!=='VIRTUAL'){var _0x122fb4={};_0x122fb4[_0x484c8a['name']]={'$like':'%'+_0x44f31a[_0x66eb('0x34')][_0x66eb('0x3e')]+'%'};return _0x122fb4;}})});}_0x3309d4=_[_0x66eb('0x40')]({},_0x3309d4,_0x44f31a[_0x66eb('0x41')]);var _0x100091={'where':_0x3309d4[_0x66eb('0x3f')]};return db[_0x66eb('0x2e')][_0x66eb('0x1e')](_0x100091)[_0x66eb('0x26')](function(_0x4e5719){_0x1eaf17[_0x66eb('0x1e')]=_0x4e5719;if(_0x44f31a['query']['includeAll']){_0x3309d4['include']=[{'all':!![]}];}return db[_0x66eb('0x2e')][_0x66eb('0x42')](_0x3309d4);})[_0x66eb('0x26')](function(_0x12866a){_0x1eaf17[_0x66eb('0x43')]=_0x12866a;return _0x1eaf17;})[_0x66eb('0x26')](respondWithFilteredResult(_0x41e20a,_0x3309d4))[_0x66eb('0x44')](handleError(_0x41e20a,null));};exports[_0x66eb('0x45')]=function(_0x5e5eb8,_0x5b297e){var _0x43d9a6={'raw':!![],'where':{'id':_0x5e5eb8['params']['id']}},_0x3d6964={};_0x3d6964[_0x66eb('0x33')]=_[_0x66eb('0x46')](db['SquareDetailsReport'][_0x66eb('0x2f')]);_0x3d6964[_0x66eb('0x34')]=_[_0x66eb('0x46')](_0x5e5eb8[_0x66eb('0x34')]);_0x3d6964[_0x66eb('0x35')]=_[_0x66eb('0x36')](_0x3d6964['model'],_0x3d6964['query']);_0x43d9a6['attributes']=_[_0x66eb('0x36')](_0x3d6964[_0x66eb('0x33')],qs[_0x66eb('0x38')](_0x5e5eb8[_0x66eb('0x34')]['fields']));_0x43d9a6[_0x66eb('0x37')]=_0x43d9a6[_0x66eb('0x37')][_0x66eb('0x39')]?_0x43d9a6[_0x66eb('0x37')]:_0x3d6964[_0x66eb('0x33')];if(_0x5e5eb8[_0x66eb('0x34')][_0x66eb('0x47')]){_0x43d9a6[_0x66eb('0x48')]=[{'all':!![]}];}_0x43d9a6=_[_0x66eb('0x40')]({},_0x43d9a6,_0x5e5eb8[_0x66eb('0x41')]);return db['SquareDetailsReport'][_0x66eb('0x49')](_0x43d9a6)[_0x66eb('0x26')](handleEntityNotFound(_0x5b297e,null))[_0x66eb('0x26')](respondWithResult(_0x5b297e,null))['catch'](handleError(_0x5b297e,null));};exports[_0x66eb('0x4a')]=function(_0x12140c,_0x5ae2a2){return db[_0x66eb('0x2e')][_0x66eb('0x4a')](_0x12140c[_0x66eb('0x4b')],{})[_0x66eb('0x26')](respondWithResult(_0x5ae2a2,0xc9))[_0x66eb('0x44')](handleError(_0x5ae2a2,null));};exports['update']=function(_0x2cce1d,_0x3798ef){if(_0x2cce1d[_0x66eb('0x4b')]['id']){delete _0x2cce1d[_0x66eb('0x4b')]['id'];}return db['SquareDetailsReport'][_0x66eb('0x49')]({'where':{'id':_0x2cce1d[_0x66eb('0x4c')]['id']}})[_0x66eb('0x26')](handleEntityNotFound(_0x3798ef,null))[_0x66eb('0x26')](saveUpdates(_0x2cce1d['body'],null))['then'](respondWithResult(_0x3798ef,null))[_0x66eb('0x44')](handleError(_0x3798ef,null));};exports[_0x66eb('0x25')]=function(_0x58efe6,_0x3723dc){return db[_0x66eb('0x2e')][_0x66eb('0x49')]({'where':{'id':_0x58efe6[_0x66eb('0x4c')]['id']}})[_0x66eb('0x26')](handleEntityNotFound(_0x3723dc,null))[_0x66eb('0x26')](removeEntity(_0x3723dc,null))[_0x66eb('0x44')](handleError(_0x3723dc,null));};exports[_0x66eb('0x4d')]=function(_0x45ea3b,_0x40fc04){return db[_0x66eb('0x2e')]['describe']()[_0x66eb('0x26')](respondWithResult(_0x40fc04,null))[_0x66eb('0x44')](handleError(_0x40fc04,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 6c3e1ac..23f50d7 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 _0x3ed9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0x56956d,_0x11d25b){var _0x554ca3=function(_0x1d7b94){while(--_0x1d7b94){_0x56956d['push'](_0x56956d['shift']());}};_0x554ca3(++_0x11d25b);}(_0x3ed9,0x8c));var _0x93ed=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x3ed9[_0x2e6c19];return _0x52885d;};'use strict';var _=require(_0x93ed('0x0'));var util=require(_0x93ed('0x1'));var logger=require(_0x93ed('0x2'))('api');var moment=require(_0x93ed('0x3'));var BPromise=require(_0x93ed('0x4'));var rp=require(_0x93ed('0x5'));var fs=require('fs');var path=require(_0x93ed('0x6'));var rimraf=require(_0x93ed('0x7'));var config=require(_0x93ed('0x8'));var attributes=require(_0x93ed('0x9'));module[_0x93ed('0xa')]=function(_0x2d698c,_0x1c1054){return _0x2d698c['define'](_0x93ed('0xb'),attributes,{'tableName':_0x93ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x142b=['exports','define','report_square_details','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x243cdc,_0x5e20dc){var _0x44af44=function(_0x3cf27e){while(--_0x3cf27e){_0x243cdc['push'](_0x243cdc['shift']());}};_0x44af44(++_0x5e20dc);}(_0x142b,0xbe));var _0xb142=function(_0x2dc063,_0x368d5f){_0x2dc063=_0x2dc063-0x0;var _0x435a29=_0x142b[_0x2dc063];return _0x435a29;};'use strict';var _=require(_0xb142('0x0'));var util=require('util');var logger=require(_0xb142('0x1'))('api');var moment=require(_0xb142('0x2'));var BPromise=require(_0xb142('0x3'));var rp=require(_0xb142('0x4'));var fs=require('fs');var path=require(_0xb142('0x5'));var rimraf=require(_0xb142('0x6'));var config=require('../../config/environment');var attributes=require(_0xb142('0x7'));module[_0xb142('0x8')]=function(_0x47d4a4,_0x4c30ce){return _0x47d4a4[_0xb142('0x9')]('SquareDetailsReport',attributes,{'tableName':_0xb142('0xa'),'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 170bdc5..1b225ad 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 _0x51c5=['options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','info','catch','CreateSquareDetailsReport','create'];(function(_0x1cca28,_0x405423){var _0x4721a7=function(_0x2d797b){while(--_0x2d797b){_0x1cca28['push'](_0x1cca28['shift']());}};_0x4721a7(++_0x405423);}(_0x51c5,0x8f));var _0x551c=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x51c5[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var moment=require(_0x551c('0x2'));var BPromise=require(_0x551c('0x3'));var rs=require(_0x551c('0x4'));var fs=require('fs');var Redis=require(_0x551c('0x5'));var db=require(_0x551c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x551c('0x7'))(_0x551c('0x8'));var config=require(_0x551c('0x9'));var jayson=require(_0x551c('0xa'));var client=jayson[_0x551c('0xb')][_0x551c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21dfa1,_0x196955,_0x4f3a0a){return new BPromise(function(_0x414edb,_0x15f4f8){return client[_0x551c('0xd')](_0x21dfa1,_0x4f3a0a)['then'](function(_0x17683c){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x196955,'request\x20sent');logger[_0x551c('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x196955,_0x551c('0xf'),JSON[_0x551c('0x10')](_0x17683c));if(_0x17683c[_0x551c('0x11')]){if(_0x17683c[_0x551c('0x11')][_0x551c('0x12')]===0x1f4){logger[_0x551c('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x196955,_0x17683c[_0x551c('0x11')][_0x551c('0x13')]);return _0x15f4f8(_0x17683c[_0x551c('0x11')]['message']);}logger[_0x551c('0x11')](_0x551c('0x14'),_0x196955,_0x17683c['error'][_0x551c('0x13')]);return _0x414edb(_0x17683c['error'][_0x551c('0x13')]);}else{logger[_0x551c('0x15')](_0x551c('0x14'),_0x196955,_0x551c('0xf'));_0x414edb(_0x17683c['result']['message']);}})[_0x551c('0x16')](function(_0xcdf011){logger['error'](_0x551c('0x14'),_0x196955,_0xcdf011);_0x15f4f8(_0xcdf011);});});}exports[_0x551c('0x17')]=function(_0x274432){var _0x2a0b55=this;return new Promise(function(_0x4c8dba,_0x4fcaf3){return db['SquareDetailsReport'][_0x551c('0x18')](_0x274432['body'],{'raw':_0x274432['options']?_0x274432[_0x551c('0x19')][_0x551c('0x1a')]===undefined?!![]:![]:!![]})[_0x551c('0x1b')](function(_0x1927e7){logger[_0x551c('0x15')](_0x551c('0x17'),_0x274432);logger['debug']('CreateSquareDetailsReport',_0x274432,JSON[_0x551c('0x10')](_0x1927e7));_0x4c8dba(_0x1927e7);})['catch'](function(_0x330160){logger[_0x551c('0x11')](_0x551c('0x17'),_0x330160[_0x551c('0x13')],_0x274432);_0x4fcaf3(_0x2a0b55[_0x551c('0x11')](0x1f4,_0x330160['message']));});});}; \ No newline at end of file +var _0xa7fa=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa7f('0x1'));var rs=require(_0xaa7f('0x2'));var fs=require('fs');var Redis=require(_0xaa7f('0x3'));var db=require(_0xaa7f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa7f('0x5'))(_0xaa7f('0x6'));var config=require(_0xaa7f('0x7'));var jayson=require(_0xaa7f('0x8'));var client=jayson['client'][_0xaa7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48105b,_0x50bab6,_0x3898a3){return new BPromise(function(_0x506a91,_0x3ac236){return client[_0xaa7f('0xa')](_0x48105b,_0x3898a3)[_0xaa7f('0xb')](function(_0x2dbcb6){logger['info'](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));logger['debug'](_0xaa7f('0xe'),_0x50bab6,_0xaa7f('0xd'),JSON[_0xaa7f('0xf')](_0x2dbcb6));if(_0x2dbcb6[_0xaa7f('0x10')]){if(_0x2dbcb6['error']['code']===0x1f4){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);return _0x3ac236(_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);}logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')]['message']);return _0x506a91(_0x2dbcb6[_0xaa7f('0x10')]['message']);}else{logger[_0xaa7f('0x12')](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));_0x506a91(_0x2dbcb6['result'][_0xaa7f('0x11')]);}})[_0xaa7f('0x13')](function(_0x1bd3f9){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x1bd3f9);_0x3ac236(_0x1bd3f9);});});}exports[_0xaa7f('0x14')]=function(_0x2c17c4){var _0x4fbd09=this;return new Promise(function(_0x90863a,_0x1e18a6){return db[_0xaa7f('0x15')][_0xaa7f('0x16')](_0x2c17c4['body'],{'raw':_0x2c17c4['options']?_0x2c17c4[_0xaa7f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaa7f('0xb')](function(_0x21e870){logger['info'](_0xaa7f('0x14'),_0x2c17c4);logger['debug'](_0xaa7f('0x14'),_0x2c17c4,JSON[_0xaa7f('0xf')](_0x21e870));_0x90863a(_0x21e870);})[_0xaa7f('0x13')](function(_0x516d7e){logger[_0xaa7f('0x10')](_0xaa7f('0x14'),_0x516d7e[_0xaa7f('0x11')],_0x2c17c4);_0x1e18a6(_0x4fbd09[_0xaa7f('0x10')](0x1f4,_0x516d7e['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 4d996e2..7b5a5c5 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 _0xdb0b=['get','/process/:pid/kill','exports','express','../../components/auth/service','./system.controller','isAuthenticated','index'];(function(_0xee653f,_0x1e2251){var _0x589bbf=function(_0x41b3e){while(--_0x41b3e){_0xee653f['push'](_0xee653f['shift']());}};_0x589bbf(++_0x1e2251);}(_0xdb0b,0xfb));var _0xbdb0=function(_0x2392b5,_0x2a414e){_0x2392b5=_0x2392b5-0x0;var _0x54b625=_0xdb0b[_0x2392b5];return _0x54b625;};'use strict';var express=require(_0xbdb0('0x0'));var router=express['Router']();var auth=require(_0xbdb0('0x1'));var controller=require(_0xbdb0('0x2'));router['get']('/',auth[_0xbdb0('0x3')](),controller[_0xbdb0('0x4')]);router[_0xbdb0('0x5')](_0xbdb0('0x6'),auth['isAuthenticated'](),controller['killProcess']);module[_0xbdb0('0x7')]=router; \ No newline at end of file +var _0x06bf=['get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','../../components/auth/service','./system.controller'];(function(_0x316a1f,_0x329415){var _0x6495eb=function(_0x235c3c){while(--_0x235c3c){_0x316a1f['push'](_0x316a1f['shift']());}};_0x6495eb(++_0x329415);}(_0x06bf,0xa6));var _0xf06b=function(_0x1fe57a,_0x47effd){_0x1fe57a=_0x1fe57a-0x0;var _0x2d510b=_0x06bf[_0x1fe57a];return _0x2d510b;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf06b('0x0'));var controller=require(_0xf06b('0x1'));router[_0xf06b('0x2')]('/',auth[_0xf06b('0x3')](),controller[_0xf06b('0x4')]);router[_0xf06b('0x2')](_0xf06b('0x5'),auth['isAuthenticated'](),controller[_0xf06b('0x6')]);module[_0xf06b('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 73d75c1..54a3971 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 _0x25e1=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid'];(function(_0x336227,_0x3bb726){var _0x9e5a81=function(_0x7eb2c4){while(--_0x7eb2c4){_0x336227['push'](_0x336227['shift']());}};_0x9e5a81(++_0x3bb726);}(_0x25e1,0xd4));var _0x125e=function(_0xf89ad3,_0x4a4a05){_0xf89ad3=_0xf89ad3-0x0;var _0x324449=_0x25e1[_0xf89ad3];return _0x324449;};'use strict';var info=require(_0x125e('0x0'));var exec=require(_0x125e('0x1'))[_0x125e('0x2')];var logger=require(_0x125e('0x3'))(_0x125e('0x4'));var util=require(_0x125e('0x5'));var BPromise=require(_0x125e('0x6'));var _=require(_0x125e('0x7'));function handleError(_0xa5dcc3,_0x428074,_0x44b42e){_0x428074=_0x428074||0x1f4;return function(_0xc3f704){logger[_0x125e('0x8')](_0x125e('0x9'),_0x44b42e,_0x428074,util['inspect'](_0xc3f704,{'showHidden':![],'depth':null}));delete _0xc3f704[_0x125e('0xa')];_0xa5dcc3[_0x125e('0xb')](_0x428074)[_0x125e('0xc')](_0xc3f704);};}exports[_0x125e('0xd')]=function(_0x54f276,_0x86d027){return info[_0x125e('0xe')]()[_0x125e('0xf')](function(_0x568d52){return _0x86d027[_0x125e('0xb')](0xc8)[_0x125e('0x10')](_0x568d52);})[_0x125e('0x11')](function(_0x27c45e){return _0x86d027[_0x125e('0xb')](0x1f4)['json'](_0x27c45e);});};exports[_0x125e('0x12')]=function(_0x15e7ae,_0x137b81){var _0x9fb138=[_0x125e('0x13')];return new BPromise(function(_0x50e3ce,_0x31c66a){return exec(util['format'](_0x125e('0x14'),_0x15e7ae[_0x125e('0x15')]['pid']),function(_0x3996a5,_0x5e0cbf,_0xffb87c){if(_0x3996a5){return _0x31c66a(_0x3996a5);}return _0x50e3ce(_0x5e0cbf);});})[_0x125e('0xf')](function(_0xca8bc1){var _0xedd034=![];var _0x2f1ade=_0xca8bc1[_0x125e('0x16')](/\n/);for(var _0x5bc5a3=0x0,_0x513efb=_0x9fb138[_0x125e('0x17')];_0x5bc5a3<_0x513efb,_0xedd034===![];_0x5bc5a3+=0x1){if(_0xca8bc1[_0x125e('0x18')](_0x9fb138[_0x5bc5a3])>=0x0){_0xedd034=!![];}}if(!_0xedd034){throw new Error(util[_0x125e('0x19')](_0x125e('0x1a'),_0x15e7ae[_0x125e('0x15')][_0x125e('0x1b')]));}process['kill'](_0x15e7ae[_0x125e('0x15')][_0x125e('0x1b')],_0x125e('0x1c'));return _0x137b81['status'](0xc8)['json']({'message':util[_0x125e('0x19')](_0x125e('0x1d'),_0x15e7ae[_0x125e('0x15')][_0x125e('0x1b')])});})[_0x125e('0x11')](handleError(_0x137b81,null,_0x125e('0x12')));}; \ No newline at end of file +var _0xfffb=['send','index','getAllData','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','format','kill','SIGINT','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0xb1167f,_0x2772ba){var _0xfa37a1=function(_0xb6e24d){while(--_0xb6e24d){_0xb1167f['push'](_0xb1167f['shift']());}};_0xfa37a1(++_0x2772ba);}(_0xfffb,0x85));var _0xbfff=function(_0x27ca04,_0x49e29e){_0x27ca04=_0x27ca04-0x0;var _0x241f0f=_0xfffb[_0x27ca04];return _0x241f0f;};'use strict';var info=require(_0xbfff('0x0'));var exec=require(_0xbfff('0x1'))[_0xbfff('0x2')];var logger=require(_0xbfff('0x3'))(_0xbfff('0x4'));var util=require(_0xbfff('0x5'));var BPromise=require(_0xbfff('0x6'));var _=require('lodash');function handleError(_0x527ec7,_0x1e0c3a,_0x46ccec){_0x1e0c3a=_0x1e0c3a||0x1f4;return function(_0x4f51d8){logger[_0xbfff('0x7')](_0xbfff('0x8'),_0x46ccec,_0x1e0c3a,util[_0xbfff('0x9')](_0x4f51d8,{'showHidden':![],'depth':null}));delete _0x4f51d8[_0xbfff('0xa')];_0x527ec7[_0xbfff('0xb')](_0x1e0c3a)[_0xbfff('0xc')](_0x4f51d8);};}exports[_0xbfff('0xd')]=function(_0x570750,_0x517f79){return info[_0xbfff('0xe')]()[_0xbfff('0xf')](function(_0x324dba){return _0x517f79['status'](0xc8)[_0xbfff('0x10')](_0x324dba);})[_0xbfff('0x11')](function(_0x81635e){return _0x517f79[_0xbfff('0xb')](0x1f4)[_0xbfff('0x10')](_0x81635e);});};exports[_0xbfff('0x12')]=function(_0x4666cc,_0x20784c){var _0x4ac1e9=[_0xbfff('0x13')];return new BPromise(function(_0x25bee9,_0x3dffb9){return exec(util['format'](_0xbfff('0x14'),_0x4666cc[_0xbfff('0x15')][_0xbfff('0x16')]),function(_0x359c04,_0x48f056,_0x500c05){if(_0x359c04){return _0x3dffb9(_0x359c04);}return _0x25bee9(_0x48f056);});})[_0xbfff('0xf')](function(_0x24b658){var _0x2b3f74=![];var _0x1ff725=_0x24b658[_0xbfff('0x17')](/\n/);for(var _0x637c48=0x0,_0x1c3c93=_0x4ac1e9[_0xbfff('0x18')];_0x637c48<_0x1c3c93,_0x2b3f74===![];_0x637c48+=0x1){if(_0x24b658[_0xbfff('0x19')](_0x4ac1e9[_0x637c48])>=0x0){_0x2b3f74=!![];}}if(!_0x2b3f74){throw new Error(util[_0xbfff('0x1a')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4666cc['params'][_0xbfff('0x16')]));}process[_0xbfff('0x1b')](_0x4666cc[_0xbfff('0x15')][_0xbfff('0x16')],_0xbfff('0x1c'));return _0x20784c['status'](0xc8)[_0xbfff('0x10')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4666cc[_0xbfff('0x15')][_0xbfff('0x16')])});})['catch'](handleError(_0x20784c,null,_0xbfff('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d15f466..c44b2c2 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 _0x6741=['index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x41ab55,_0x512958){var _0x1613fa=function(_0x130b7c){while(--_0x130b7c){_0x41ab55['push'](_0x41ab55['shift']());}};_0x1613fa(++_0x512958);}(_0x6741,0x1d6));var _0x1674=function(_0xac0627,_0x2c202a){_0xac0627=_0xac0627-0x0;var _0x407a8f=_0x6741[_0xac0627];return _0x407a8f;};'use strict';var multer=require(_0x1674('0x0'));var util=require(_0x1674('0x1'));var path=require(_0x1674('0x2'));var timeout=require(_0x1674('0x3'));var express=require(_0x1674('0x4'));var router=express[_0x1674('0x5')]();var fs_extra=require(_0x1674('0x6'));var auth=require(_0x1674('0x7'));var interaction=require(_0x1674('0x8'));var config=require(_0x1674('0x9'));var controller=require(_0x1674('0xa'));router[_0x1674('0xb')]('/',auth[_0x1674('0xc')](),controller[_0x1674('0xd')]);router[_0x1674('0xb')](_0x1674('0xe'),auth[_0x1674('0xc')](),controller['show']);router[_0x1674('0xf')]('/',auth[_0x1674('0xc')](),controller[_0x1674('0x10')]);router[_0x1674('0x11')]('/:id',auth[_0x1674('0xc')](),controller[_0x1674('0x12')]);router[_0x1674('0x13')](_0x1674('0xe'),auth[_0x1674('0xc')](),controller[_0x1674('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0ad2=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','put','update','delete'];(function(_0x1f3570,_0x561ca6){var _0x2bcd0a=function(_0xa7ac87){while(--_0xa7ac87){_0x1f3570['push'](_0x1f3570['shift']());}};_0x2bcd0a(++_0x561ca6);}(_0x0ad2,0xa1));var _0x20ad=function(_0x3212b5,_0xe27e38){_0x3212b5=_0x3212b5-0x0;var _0x1130fd=_0x0ad2[_0x3212b5];return _0x1130fd;};'use strict';var multer=require(_0x20ad('0x0'));var util=require(_0x20ad('0x1'));var path=require(_0x20ad('0x2'));var timeout=require(_0x20ad('0x3'));var express=require(_0x20ad('0x4'));var router=express[_0x20ad('0x5')]();var fs_extra=require(_0x20ad('0x6'));var auth=require(_0x20ad('0x7'));var interaction=require(_0x20ad('0x8'));var config=require(_0x20ad('0x9'));var controller=require(_0x20ad('0xa'));router[_0x20ad('0xb')]('/',auth[_0x20ad('0xc')](),controller[_0x20ad('0xd')]);router[_0x20ad('0xb')](_0x20ad('0xe'),auth[_0x20ad('0xc')](),controller['show']);router[_0x20ad('0xf')]('/',auth[_0x20ad('0xc')](),controller['create']);router[_0x20ad('0x10')](_0x20ad('0xe'),auth[_0x20ad('0xc')](),controller[_0x20ad('0x11')]);router[_0x20ad('0x12')](_0x20ad('0xe'),auth[_0x20ad('0xc')](),controller['destroy']);module[_0x20ad('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 825cb9c..a6a22f0 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 _0x4b07=['STRING','#0091EA','exports'];(function(_0x3f35f7,_0x5c778d){var _0x450f3f=function(_0x19fc6a){while(--_0x19fc6a){_0x3f35f7['push'](_0x3f35f7['shift']());}};_0x450f3f(++_0x5c778d);}(_0x4b07,0x1d6));var _0x74b0=function(_0x3fc476,_0x7deee8){_0x3fc476=_0x3fc476-0x0;var _0x2d73df=_0x4b07[_0x3fc476];return _0x2d73df;};'use strict';var Sequelize=require('sequelize');module[_0x74b0('0x0')]={'name':{'type':Sequelize[_0x74b0('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x74b0('0x1')],'defaultValue':_0x74b0('0x2')},'description':{'type':Sequelize[_0x74b0('0x1')]}}; \ No newline at end of file +var _0x4d6e=['exports','STRING','name','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4d6e,0x77));var _0xe4d6=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0x4d6e[_0x24f326];return _0x488e2d;};'use strict';var Sequelize=require(_0xe4d6('0x0'));module[_0xe4d6('0x1')]={'name':{'type':Sequelize[_0xe4d6('0x2')],'unique':_0xe4d6('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe4d6('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xe4d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index b0bf34a..0f5104c 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 _0x2356=['sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','moment','bluebird','path','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','json','reject','save','destroy','then','Tags','UserProfileResource','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x2356,0x14f));var _0x6235=function(_0x18c9ab,_0x6ba7e7){_0x18c9ab=_0x18c9ab-0x0;var _0x17fc37=_0x2356[_0x18c9ab];return _0x17fc37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6235('0x0'));var zipdir=require(_0x6235('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6235('0x2'));var BPromise=require(_0x6235('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6235('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6235('0x5'));var fs=require('fs');var fs_extra=require(_0x6235('0x6'));var _=require(_0x6235('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6235('0x8'));var toCsv=require('to-csv');var querystring=require(_0x6235('0x9'));var Papa=require(_0x6235('0xa'));var Redis=require(_0x6235('0xb'));var authService=require(_0x6235('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x6235('0xd'));var hardwareService=require(_0x6235('0xe'));var logger=require(_0x6235('0xf'))(_0x6235('0x10'));var utils=require(_0x6235('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6235('0x12'));var db=require(_0x6235('0x13'))['db'];function respondWithStatusCode(_0x1303e7,_0x6c422b){_0x6c422b=_0x6c422b||0xcc;return function(_0x48df2d){if(_0x48df2d){return _0x1303e7[_0x6235('0x14')](_0x6c422b);}return _0x1303e7[_0x6235('0x15')](_0x6c422b)['end']();};}function respondWithResult(_0x3f5b7d,_0x48e3a7){_0x48e3a7=_0x48e3a7||0xc8;return function(_0x35156f){if(_0x35156f){return _0x3f5b7d[_0x6235('0x15')](_0x48e3a7)['json'](_0x35156f);}};}function respondWithFilteredResult(_0x1cfd0b,_0x1f1c54){return function(_0x3f619b){if(_0x3f619b){var _0x3f32af=typeof _0x1f1c54['offset']===_0x6235('0x16')&&typeof _0x1f1c54[_0x6235('0x17')]===_0x6235('0x16');var _0x2e5a84=_0x3f619b[_0x6235('0x18')];var _0x2a3554=_0x3f32af?0x0:_0x1f1c54[_0x6235('0x19')];var _0x22f090=_0x3f32af?_0x3f619b[_0x6235('0x18')]:_0x1f1c54[_0x6235('0x19')]+_0x1f1c54['limit'];var _0x35103a;if(_0x22f090>=_0x2e5a84){_0x22f090=_0x2e5a84;_0x35103a=0xc8;}else{_0x35103a=0xce;}_0x1cfd0b[_0x6235('0x15')](_0x35103a);return _0x1cfd0b['set']('Content-Range',_0x2a3554+'-'+_0x22f090+'/'+_0x2e5a84)[_0x6235('0x1a')](_0x3f619b);}return null;};}function patchUpdates(_0x4f0aa2){return function(_0x5d3872){try{jsonpatch['apply'](_0x5d3872,_0x4f0aa2,!![]);}catch(_0x367207){return BPromise[_0x6235('0x1b')](_0x367207);}return _0x5d3872[_0x6235('0x1c')]();};}function saveUpdates(_0x1c60c7,_0x24c057){return function(_0x270c49){if(_0x270c49){return _0x270c49['update'](_0x1c60c7)['then'](function(_0x4663b3){return _0x4663b3;});}return null;};}function removeEntity(_0x5ac43d,_0x2189d0){return function(_0x1bed65){if(_0x1bed65){return _0x1bed65[_0x6235('0x1d')]()[_0x6235('0x1e')](function(){var _0x3eea59=_0x1bed65['get']({'plain':!![]});var _0x1e3d90=_0x6235('0x1f');return db[_0x6235('0x20')][_0x6235('0x1d')]({'where':{'type':_0x1e3d90,'resourceId':_0x3eea59['id']}})[_0x6235('0x1e')](function(){return _0x1bed65;});})['then'](function(){_0x5ac43d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f28f2,_0x5aa9fa){return function(_0x404e30){if(!_0x404e30){_0x4f28f2[_0x6235('0x14')](0x194);}return _0x404e30;};}function handleError(_0x20c633,_0x3e7cc8){_0x3e7cc8=_0x3e7cc8||0x1f4;return function(_0x2acc8c){logger['error'](_0x2acc8c['stack']);if(_0x2acc8c['name']){delete _0x2acc8c[_0x6235('0x21')];}_0x20c633['status'](_0x3e7cc8)[_0x6235('0x22')](_0x2acc8c);};}exports[_0x6235('0x23')]=function(_0x570d16,_0x37580b){var _0x3a9439={},_0x5bb691={},_0x3e3162={'count':0x0,'rows':[]};var _0x1dd384=_[_0x6235('0x24')](db[_0x6235('0x25')][_0x6235('0x26')],function(_0x452f60){return{'name':_0x452f60[_0x6235('0x27')],'type':_0x452f60[_0x6235('0x28')][_0x6235('0x29')]};});_0x5bb691[_0x6235('0x2a')]=_['map'](_0x1dd384,_0x6235('0x21'));_0x5bb691['query']=_['keys'](_0x570d16[_0x6235('0x2b')]);_0x5bb691['filters']=_['intersection'](_0x5bb691[_0x6235('0x2a')],_0x5bb691['query']);_0x3a9439['attributes']=_[_0x6235('0x2c')](_0x5bb691[_0x6235('0x2a')],qs[_0x6235('0x2d')](_0x570d16['query'][_0x6235('0x2d')]));_0x3a9439[_0x6235('0x2e')]=_0x3a9439[_0x6235('0x2e')]['length']?_0x3a9439[_0x6235('0x2e')]:_0x5bb691['model'];if(!_0x570d16[_0x6235('0x2b')][_0x6235('0x2f')](_0x6235('0x30'))){_0x3a9439[_0x6235('0x17')]=qs[_0x6235('0x17')](_0x570d16['query'][_0x6235('0x17')]);_0x3a9439['offset']=qs[_0x6235('0x19')](_0x570d16[_0x6235('0x2b')][_0x6235('0x19')]);}_0x3a9439[_0x6235('0x31')]=qs[_0x6235('0x32')](_0x570d16['query']['sort']);_0x3a9439[_0x6235('0x33')]=qs[_0x6235('0x34')](_[_0x6235('0x35')](_0x570d16[_0x6235('0x2b')],_0x5bb691[_0x6235('0x34')]),_0x1dd384);if(_0x570d16[_0x6235('0x2b')][_0x6235('0x36')]){_0x3a9439[_0x6235('0x33')]=_[_0x6235('0x37')](_0x3a9439[_0x6235('0x33')],{'$or':_['map'](_0x1dd384,function(_0x5529c1){if(_0x5529c1[_0x6235('0x28')]!=='VIRTUAL'){var _0x585744={};_0x585744[_0x5529c1[_0x6235('0x21')]]={'$like':'%'+_0x570d16[_0x6235('0x2b')][_0x6235('0x36')]+'%'};return _0x585744;}})});}_0x3a9439=_['merge']({},_0x3a9439,_0x570d16[_0x6235('0x38')]);var _0x535d80={'where':_0x3a9439[_0x6235('0x33')]};return db[_0x6235('0x25')][_0x6235('0x18')](_0x535d80)[_0x6235('0x1e')](function(_0x36abb1){_0x3e3162[_0x6235('0x18')]=_0x36abb1;if(_0x570d16[_0x6235('0x2b')][_0x6235('0x39')]){_0x3a9439['include']=[{'all':!![]}];}return db['Tag'][_0x6235('0x3a')](_0x3a9439);})['then'](function(_0x173c62){_0x3e3162[_0x6235('0x3b')]=_0x173c62;return _0x3e3162;})[_0x6235('0x1e')](respondWithFilteredResult(_0x37580b,_0x3a9439))[_0x6235('0x3c')](handleError(_0x37580b,null));};exports[_0x6235('0x3d')]=function(_0x38092e,_0x3c1ce7){var _0x4a5f6f={'raw':!![],'where':{'id':_0x38092e[_0x6235('0x3e')]['id']}},_0x3a99c4={};_0x3a99c4[_0x6235('0x2a')]=_['keys'](db[_0x6235('0x25')][_0x6235('0x26')]);_0x3a99c4[_0x6235('0x2b')]=_[_0x6235('0x3f')](_0x38092e[_0x6235('0x2b')]);_0x3a99c4[_0x6235('0x34')]=_[_0x6235('0x2c')](_0x3a99c4[_0x6235('0x2a')],_0x3a99c4['query']);_0x4a5f6f[_0x6235('0x2e')]=_[_0x6235('0x2c')](_0x3a99c4[_0x6235('0x2a')],qs['fields'](_0x38092e[_0x6235('0x2b')][_0x6235('0x2d')]));_0x4a5f6f[_0x6235('0x2e')]=_0x4a5f6f[_0x6235('0x2e')][_0x6235('0x40')]?_0x4a5f6f[_0x6235('0x2e')]:_0x3a99c4[_0x6235('0x2a')];if(_0x38092e[_0x6235('0x2b')][_0x6235('0x39')]){_0x4a5f6f['include']=[{'all':!![]}];}_0x4a5f6f=_[_0x6235('0x37')]({},_0x4a5f6f,_0x38092e['options']);return db[_0x6235('0x25')][_0x6235('0x41')](_0x4a5f6f)[_0x6235('0x1e')](handleEntityNotFound(_0x3c1ce7,null))['then'](respondWithResult(_0x3c1ce7,null))['catch'](handleError(_0x3c1ce7,null));};exports[_0x6235('0x42')]=function(_0x433263,_0x4468d4){return db[_0x6235('0x25')]['create'](_0x433263[_0x6235('0x43')],{})[_0x6235('0x1e')](function(_0x568aee){var _0x7e27cd=_0x433263['user'][_0x6235('0x44')]({'plain':!![]});if(!_0x7e27cd)throw new Error(_0x6235('0x45'));if(_0x7e27cd[_0x6235('0x46')]==='user'){var _0x2aa5f9=_0x568aee['get']({'plain':!![]});var _0x5b78db='Tags';return db[_0x6235('0x47')][_0x6235('0x41')]({'where':{'name':_0x5b78db,'userProfileId':_0x7e27cd[_0x6235('0x48')]},'raw':!![]})[_0x6235('0x1e')](function(_0x405e76){if(_0x405e76&&_0x405e76[_0x6235('0x49')]===0x0){return db[_0x6235('0x20')]['create']({'name':_0x2aa5f9[_0x6235('0x21')],'resourceId':_0x2aa5f9['id'],'type':_0x405e76[_0x6235('0x21')],'sectionId':_0x405e76['id']},{})[_0x6235('0x1e')](function(){return _0x568aee;});}else{return _0x568aee;}})[_0x6235('0x3c')](function(_0x589747){logger[_0x6235('0x4a')](_0x6235('0x4b'),_0x589747);throw _0x589747;});}return _0x568aee;})[_0x6235('0x1e')](respondWithResult(_0x4468d4,0xc9))['catch'](handleError(_0x4468d4,null));};exports[_0x6235('0x4c')]=function(_0x5c73ea,_0x4a4ad3){if(_0x5c73ea['body']['id']){delete _0x5c73ea[_0x6235('0x43')]['id'];}return db['Tag'][_0x6235('0x41')]({'where':{'id':_0x5c73ea[_0x6235('0x3e')]['id']}})[_0x6235('0x1e')](handleEntityNotFound(_0x4a4ad3,null))['then'](saveUpdates(_0x5c73ea[_0x6235('0x43')],null))['then'](respondWithResult(_0x4a4ad3,null))[_0x6235('0x3c')](handleError(_0x4a4ad3,null));};exports[_0x6235('0x1d')]=function(_0x3bc3ce,_0x457af6){return db[_0x6235('0x25')][_0x6235('0x41')]({'where':{'id':_0x3bc3ce[_0x6235('0x3e')]['id']}})[_0x6235('0x1e')](handleEntityNotFound(_0x457af6,null))['then'](removeEntity(_0x457af6,null))[_0x6235('0x3c')](handleError(_0x457af6,null));}; \ No newline at end of file +var _0xedd9=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','get','Tags','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x5667b6,_0x491737){var _0x35a034=function(_0x443e42){while(--_0x443e42){_0x5667b6['push'](_0x5667b6['shift']());}};_0x35a034(++_0x491737);}(_0xedd9,0xfc));var _0x9edd=function(_0x291956,_0xee9f9d){_0x291956=_0x291956-0x0;var _0x4b874a=_0xedd9[_0x291956];return _0x4b874a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){var _0xeaf55a=_0x339a0d[_0x9edd('0x22')]({'plain':!![]});var _0x2f9f86=_0x9edd('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f9f86,'resourceId':_0xeaf55a['id']}})[_0x9edd('0x21')](function(){return _0x339a0d;});})[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x3c2227,_0x4fe471){return function(_0x57a2cc){if(!_0x57a2cc){_0x3c2227[_0x9edd('0x18')](0x194);}return _0x57a2cc;};}function handleError(_0x257a26,_0x1c762c){_0x1c762c=_0x1c762c||0x1f4;return function(_0x52746a){logger[_0x9edd('0x25')](_0x52746a[_0x9edd('0x26')]);if(_0x52746a[_0x9edd('0x27')]){delete _0x52746a[_0x9edd('0x27')];}_0x257a26['status'](_0x1c762c)[_0x9edd('0x28')](_0x52746a);};}exports[_0x9edd('0x29')]=function(_0xbe87e1,_0x12c1bc){var _0xbbf08f={},_0x42e664={},_0x209aba={'count':0x0,'rows':[]};var _0x1fba7b=_[_0x9edd('0x2a')](db[_0x9edd('0x2b')][_0x9edd('0x2c')],function(_0x138002){return{'name':_0x138002[_0x9edd('0x2d')],'type':_0x138002[_0x9edd('0x2e')][_0x9edd('0x2f')]};});_0x42e664['model']=_[_0x9edd('0x2a')](_0x1fba7b,_0x9edd('0x27'));_0x42e664[_0x9edd('0x30')]=_['keys'](_0xbe87e1[_0x9edd('0x30')]);_0x42e664[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],_0x42e664[_0x9edd('0x30')]);_0xbbf08f[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],qs[_0x9edd('0x35')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x35')]));_0xbbf08f[_0x9edd('0x34')]=_0xbbf08f[_0x9edd('0x34')][_0x9edd('0x36')]?_0xbbf08f['attributes']:_0x42e664[_0x9edd('0x33')];if(!_0xbe87e1['query'][_0x9edd('0x37')](_0x9edd('0x38'))){_0xbbf08f[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0xbe87e1[_0x9edd('0x30')]['limit']);_0xbbf08f[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x1b')]);}_0xbbf08f[_0x9edd('0x39')]=qs[_0x9edd('0x3a')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3a')]);_0xbbf08f[_0x9edd('0x3b')]=qs[_0x9edd('0x31')](_['pick'](_0xbe87e1[_0x9edd('0x30')],_0x42e664['filters']),_0x1fba7b);if(_0xbe87e1[_0x9edd('0x30')]['filter']){_0xbbf08f[_0x9edd('0x3b')]=_[_0x9edd('0x3c')](_0xbbf08f[_0x9edd('0x3b')],{'$or':_['map'](_0x1fba7b,function(_0x2e85aa){if(_0x2e85aa[_0x9edd('0x2e')]!==_0x9edd('0x3d')){var _0x48958a={};_0x48958a[_0x2e85aa[_0x9edd('0x27')]]={'$like':'%'+_0xbe87e1['query'][_0x9edd('0x3e')]+'%'};return _0x48958a;}})});}_0xbbf08f=_[_0x9edd('0x3c')]({},_0xbbf08f,_0xbe87e1['options']);var _0x315f52={'where':_0xbbf08f[_0x9edd('0x3b')]};return db[_0x9edd('0x2b')][_0x9edd('0x1e')](_0x315f52)['then'](function(_0x449f01){_0x209aba['count']=_0x449f01;if(_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3f')]){_0xbbf08f['include']=[{'all':!![]}];}return db[_0x9edd('0x2b')]['findAll'](_0xbbf08f);})['then'](function(_0x369b69){_0x209aba[_0x9edd('0x40')]=_0x369b69;return _0x209aba;})[_0x9edd('0x21')](respondWithFilteredResult(_0x12c1bc,_0xbbf08f))[_0x9edd('0x41')](handleError(_0x12c1bc,null));};exports[_0x9edd('0x42')]=function(_0x4737ae,_0x3ff512){var _0x75efbe={'raw':!![],'where':{'id':_0x4737ae[_0x9edd('0x43')]['id']}},_0x18c149={};_0x18c149[_0x9edd('0x33')]=_[_0x9edd('0x44')](db[_0x9edd('0x2b')][_0x9edd('0x2c')]);_0x18c149[_0x9edd('0x30')]=_['keys'](_0x4737ae[_0x9edd('0x30')]);_0x18c149[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x18c149[_0x9edd('0x33')],_0x18c149[_0x9edd('0x30')]);_0x75efbe[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x18c149['model'],qs['fields'](_0x4737ae['query'][_0x9edd('0x35')]));_0x75efbe['attributes']=_0x75efbe[_0x9edd('0x34')][_0x9edd('0x36')]?_0x75efbe[_0x9edd('0x34')]:_0x18c149[_0x9edd('0x33')];if(_0x4737ae[_0x9edd('0x30')]['includeAll']){_0x75efbe[_0x9edd('0x45')]=[{'all':!![]}];}_0x75efbe=_[_0x9edd('0x3c')]({},_0x75efbe,_0x4737ae[_0x9edd('0x46')]);return db['Tag'][_0x9edd('0x47')](_0x75efbe)[_0x9edd('0x21')](handleEntityNotFound(_0x3ff512,null))[_0x9edd('0x21')](respondWithResult(_0x3ff512,null))[_0x9edd('0x41')](handleError(_0x3ff512,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){return db[_0x9edd('0x2b')][_0x9edd('0x48')](_0x35bdec['body'],{})[_0x9edd('0x21')](function(_0x8d8701){var _0x4bb324=_0x35bdec[_0x9edd('0x49')][_0x9edd('0x22')]({'plain':!![]});if(!_0x4bb324)throw new Error(_0x9edd('0x4a'));if(_0x4bb324['role']===_0x9edd('0x49')){var _0x151157=_0x8d8701[_0x9edd('0x22')]({'plain':!![]});var _0x28c7bd='Tags';return db[_0x9edd('0x4b')][_0x9edd('0x47')]({'where':{'name':_0x28c7bd,'userProfileId':_0x4bb324[_0x9edd('0x4c')]},'raw':!![]})['then'](function(_0x16951a){if(_0x16951a&&_0x16951a[_0x9edd('0x4d')]===0x0){return db['UserProfileResource'][_0x9edd('0x48')]({'name':_0x151157['name'],'resourceId':_0x151157['id'],'type':_0x16951a[_0x9edd('0x27')],'sectionId':_0x16951a['id']},{})[_0x9edd('0x21')](function(){return _0x8d8701;});}else{return _0x8d8701;}})[_0x9edd('0x41')](function(_0x3fcdf5){logger[_0x9edd('0x25')](_0x9edd('0x4e'),_0x3fcdf5);throw _0x3fcdf5;});}return _0x8d8701;})[_0x9edd('0x21')](respondWithResult(_0x4d4f33,0xc9))[_0x9edd('0x41')](handleError(_0x4d4f33,null));};exports[_0x9edd('0x4f')]=function(_0x25d9cc,_0x31272d){if(_0x25d9cc['body']['id']){delete _0x25d9cc[_0x9edd('0x50')]['id'];}return db[_0x9edd('0x2b')][_0x9edd('0x47')]({'where':{'id':_0x25d9cc['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x31272d,null))['then'](saveUpdates(_0x25d9cc['body'],null))['then'](respondWithResult(_0x31272d,null))[_0x9edd('0x41')](handleError(_0x31272d,null));};exports[_0x9edd('0x51')]=function(_0x366316,_0x35ddb3){return db['Tag']['find']({'where':{'id':_0x366316['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x35ddb3,null))[_0x9edd('0x21')](removeEntity(_0x35ddb3,null))[_0x9edd('0x41')](handleError(_0x35ddb3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 8296c31..d493c07 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 _0xd960=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','tools_tags','lodash','util'];(function(_0x63cc7b,_0x3b06ed){var _0x4cf2a5=function(_0x5e9cb5){while(--_0x5e9cb5){_0x63cc7b['push'](_0x63cc7b['shift']());}};_0x4cf2a5(++_0x3b06ed);}(_0xd960,0x170));var _0x0d96=function(_0x52bf53,_0xebd534){_0x52bf53=_0x52bf53-0x0;var _0x43917c=_0xd960[_0x52bf53];return _0x43917c;};'use strict';var _=require(_0x0d96('0x0'));var util=require(_0x0d96('0x1'));var logger=require('../../config/logger')(_0x0d96('0x2'));var moment=require('moment');var BPromise=require(_0x0d96('0x3'));var rp=require(_0x0d96('0x4'));var fs=require('fs');var path=require(_0x0d96('0x5'));var rimraf=require(_0x0d96('0x6'));var config=require(_0x0d96('0x7'));var attributes=require('./tag.attributes');module[_0x0d96('0x8')]=function(_0x5d9085,_0x4b70d5){return _0x5d9085['define']('Tag',attributes,{'tableName':_0x0d96('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x502a=['path','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','api','moment'];(function(_0xe6066,_0x346433){var _0x32c48a=function(_0x4cbc37){while(--_0x4cbc37){_0xe6066['push'](_0xe6066['shift']());}};_0x32c48a(++_0x346433);}(_0x502a,0xd8));var _0xa502=function(_0x574fc4,_0x53dbd1){_0x574fc4=_0x574fc4-0x0;var _0x12195e=_0x502a[_0x574fc4];return _0x12195e;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var logger=require('../../config/logger')(_0xa502('0x2'));var moment=require(_0xa502('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa502('0x4'));var rimraf=require('rimraf');var config=require(_0xa502('0x5'));var attributes=require(_0xa502('0x6'));module[_0xa502('0x7')]=function(_0x1cb2e4,_0x136d51){return _0x1cb2e4['define'](_0xa502('0x8'),attributes,{'tableName':_0xa502('0x9'),'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 3683aab..e6b51ad 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 _0xe13a=['code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x39f5e8,_0x22f279){var _0x249230=function(_0x1f1b45){while(--_0x1f1b45){_0x39f5e8['push'](_0x39f5e8['shift']());}};_0x249230(++_0x22f279);}(_0xe13a,0x178));var _0xae13=function(_0x3329c3,_0x29bc79){_0x3329c3=_0x3329c3-0x0;var _0x312f93=_0xe13a[_0x3329c3];return _0x312f93;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae13('0x4'))['db'];var utils=require(_0xae13('0x5'));var logger=require(_0xae13('0x6'))(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341ba4,_0x4ae51f,_0x2f6d10){return new BPromise(function(_0x2b2e1f,_0x27fefd){return client[_0xae13('0xc')](_0x341ba4,_0x2f6d10)[_0xae13('0xd')](function(_0x41bf44){logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));logger['debug'](_0xae13('0x11'),_0x4ae51f,_0xae13('0x10'),JSON[_0xae13('0x12')](_0x41bf44));if(_0x41bf44[_0xae13('0x13')]){if(_0x41bf44[_0xae13('0x13')][_0xae13('0x14')]===0x1f4){logger[_0xae13('0x13')]('Tag,\x20%s,\x20%s',_0x4ae51f,_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);return _0x27fefd(_0x41bf44['error']['message']);}logger['error']('Tag,\x20%s,\x20%s',_0x4ae51f,_0x41bf44['error'][_0xae13('0x15')]);return _0x2b2e1f(_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);}else{logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));_0x2b2e1f(_0x41bf44['result'][_0xae13('0x15')]);}})['catch'](function(_0xe10aab){logger[_0xae13('0x13')](_0xae13('0xf'),_0x4ae51f,_0xe10aab);_0x27fefd(_0xe10aab);});});} \ No newline at end of file +var _0x0207=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','util','randomstring','ioredis'];(function(_0x3e37c0,_0x549673){var _0xaa21a=function(_0x312a31){while(--_0x312a31){_0x3e37c0['push'](_0x3e37c0['shift']());}};_0xaa21a(++_0x549673);}(_0x0207,0x162));var _0x7020=function(_0x4b2975,_0x2be462){_0x4b2975=_0x4b2975-0x0;var _0x3bc9e8=_0x0207[_0x4b2975];return _0x3bc9e8;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7020('0x1'));var fs=require('fs');var Redis=require(_0x7020('0x2'));var db=require(_0x7020('0x3'))['db'];var utils=require(_0x7020('0x4'));var logger=require(_0x7020('0x5'))(_0x7020('0x6'));var config=require(_0x7020('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7020('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39263c,_0x3c6c11,_0x17deac){return new BPromise(function(_0x42bc79,_0x22ba3e){return client[_0x7020('0x9')](_0x39263c,_0x17deac)['then'](function(_0x5e86b5){logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));logger['debug'](_0x7020('0xd'),_0x3c6c11,_0x7020('0xc'),JSON['stringify'](_0x5e86b5));if(_0x5e86b5[_0x7020('0xe')]){if(_0x5e86b5[_0x7020('0xe')][_0x7020('0xf')]===0x1f4){logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);return _0x22ba3e(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5['error'][_0x7020('0x10')]);return _0x42bc79(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}else{logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));_0x42bc79(_0x5e86b5['result'][_0x7020('0x10')]);}})['catch'](function(_0x2f4db5){logger[_0x7020('0xe')](_0x7020('0xb'),_0x3c6c11,_0x2f4db5);_0x22ba3e(_0x2f4db5);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index a6c40c9..79e9a3d 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index d53cfd6..49d5ca1 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 _0xbaf0=['name','exports','STRING'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_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')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x2c775a,_0x45664d){var _0x53f71d=function(_0x4cae6c){while(--_0x4cae6c){_0x2c775a['push'](_0x2c775a['shift']());}};_0x53f71d(++_0x45664d);}(_0xb10b,0x12a));var _0xbb10=function(_0x27e2bc,_0x1f5bb1){_0x27e2bc=_0x27e2bc-0x0;var _0x303eed=_0xb10b[_0x27e2bc];return _0x303eed;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 3575ede..23bef8c 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 _0xa3c4=['autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getQueues','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','order','addQueues','ValidationError','ids','removeQueues','remove','Queues','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','through','penalty','User','Queue','findOrCreate','emit','Queue:save','Voice','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','addAgents','spread','Chat','transaction','removeAgents','Queue:remove','QueueId','getAgents','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','UserProfileResource','stack','index','map','Team','fieldName','key','name','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','include','findAll','rows','show','rawAttributes','length','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId'];(function(_0x32e6fa,_0x441695){var _0x6a995f=function(_0x3a3d88){while(--_0x3a3d88){_0x32e6fa['push'](_0x32e6fa['shift']());}};_0x6a995f(++_0x441695);}(_0xa3c4,0xba));var _0x4a3c=function(_0x3f0ac1,_0x54a4b3){_0x3f0ac1=_0x3f0ac1-0x0;var _0x598133=_0xa3c4[_0x3f0ac1];return _0x598133;};'use strict';var emlformat=require(_0x4a3c('0x0'));var rimraf=require(_0x4a3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a3c('0x2'));var rp=require(_0x4a3c('0x3'));var moment=require(_0x4a3c('0x4'));var BPromise=require(_0x4a3c('0x5'));var Mustache=require(_0x4a3c('0x6'));var util=require(_0x4a3c('0x7'));var path=require(_0x4a3c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a3c('0x9'));var _=require(_0x4a3c('0xa'));var squel=require(_0x4a3c('0xb'));var crypto=require(_0x4a3c('0xc'));var jsforce=require(_0x4a3c('0xd'));var deskjs=require(_0x4a3c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4a3c('0xf'));var Papa=require(_0x4a3c('0x10'));var Redis=require(_0x4a3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4a3c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a3c('0x13'));var logger=require(_0x4a3c('0x14'))('api');var utils=require(_0x4a3c('0x15'));var config=require(_0x4a3c('0x16'));var licenseUtil=require(_0x4a3c('0x17'));var db=require(_0x4a3c('0x18'))['db'];config['redis']=_[_0x4a3c('0x19')](config['redis'],{'host':_0x4a3c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a3c('0x1b')]));require('./team.socket')[_0x4a3c('0x1c')](socket);function respondWithStatusCode(_0x1c36c5,_0x289c5d){_0x289c5d=_0x289c5d||0xcc;return function(_0x50527c){if(_0x50527c){return _0x1c36c5[_0x4a3c('0x1d')](_0x289c5d);}return _0x1c36c5[_0x4a3c('0x1e')](_0x289c5d)[_0x4a3c('0x1f')]();};}function respondWithResult(_0x999a13,_0x123ef9){_0x123ef9=_0x123ef9||0xc8;return function(_0x4aa600){if(_0x4aa600){return _0x999a13['status'](_0x123ef9)[_0x4a3c('0x20')](_0x4aa600);}};}function respondWithFilteredResult(_0x1613ca,_0x5e47a4){return function(_0x4681da){if(_0x4681da){var _0x1e71b1=typeof _0x5e47a4[_0x4a3c('0x21')]===_0x4a3c('0x22')&&typeof _0x5e47a4[_0x4a3c('0x23')]===_0x4a3c('0x22');var _0x1ce9ce=_0x4681da[_0x4a3c('0x24')];var _0x198a23=_0x1e71b1?0x0:_0x5e47a4[_0x4a3c('0x21')];var _0x3c836a=_0x1e71b1?_0x4681da[_0x4a3c('0x24')]:_0x5e47a4[_0x4a3c('0x21')]+_0x5e47a4[_0x4a3c('0x23')];var _0x8da471;if(_0x3c836a>=_0x1ce9ce){_0x3c836a=_0x1ce9ce;_0x8da471=0xc8;}else{_0x8da471=0xce;}_0x1613ca[_0x4a3c('0x1e')](_0x8da471);return _0x1613ca[_0x4a3c('0x25')]('Content-Range',_0x198a23+'-'+_0x3c836a+'/'+_0x1ce9ce)[_0x4a3c('0x20')](_0x4681da);}return null;};}function patchUpdates(_0x9365d1){return function(_0x366f5b){try{jsonpatch[_0x4a3c('0x26')](_0x366f5b,_0x9365d1,!![]);}catch(_0x5c4b75){return BPromise[_0x4a3c('0x27')](_0x5c4b75);}return _0x366f5b[_0x4a3c('0x28')]();};}function saveUpdates(_0x3ab687,_0x32fefc){return function(_0x8a9d0f){if(_0x8a9d0f){return _0x8a9d0f['update'](_0x3ab687)[_0x4a3c('0x29')](function(_0x325864){return _0x325864;});}return null;};}function removeEntity(_0x2971ef,_0x5ca506){return function(_0x34ae97){if(_0x34ae97){return _0x34ae97[_0x4a3c('0x2a')]()[_0x4a3c('0x29')](function(){var _0x2822c5=_0x34ae97[_0x4a3c('0x2b')]({'plain':!![]});var _0x22d880='Teams';return db[_0x4a3c('0x2c')][_0x4a3c('0x2a')]({'where':{'type':_0x22d880,'resourceId':_0x2822c5['id']}})[_0x4a3c('0x29')](function(){return _0x34ae97;});})[_0x4a3c('0x29')](function(){_0x2971ef[_0x4a3c('0x1e')](0xcc)[_0x4a3c('0x1f')]();});}};}function handleEntityNotFound(_0x5d3ff5,_0xd2a0b6){return function(_0x512857){if(!_0x512857){_0x5d3ff5[_0x4a3c('0x1d')](0x194);}return _0x512857;};}function handleError(_0x190cac,_0x33f36c){_0x33f36c=_0x33f36c||0x1f4;return function(_0xac7c9c){logger['error'](_0xac7c9c[_0x4a3c('0x2d')]);if(_0xac7c9c['name']){delete _0xac7c9c['name'];}_0x190cac[_0x4a3c('0x1e')](_0x33f36c)['send'](_0xac7c9c);};}exports[_0x4a3c('0x2e')]=function(_0x1a4d34,_0x3923d5){var _0x1b8230={},_0x512018={},_0x1c176c={'count':0x0,'rows':[]};var _0x1dab45=_[_0x4a3c('0x2f')](db[_0x4a3c('0x30')]['rawAttributes'],function(_0x574853){return{'name':_0x574853[_0x4a3c('0x31')],'type':_0x574853['type'][_0x4a3c('0x32')]};});_0x512018['model']=_[_0x4a3c('0x2f')](_0x1dab45,_0x4a3c('0x33'));_0x512018[_0x4a3c('0x34')]=_[_0x4a3c('0x35')](_0x1a4d34[_0x4a3c('0x34')]);_0x512018['filters']=_[_0x4a3c('0x36')](_0x512018[_0x4a3c('0x37')],_0x512018[_0x4a3c('0x34')]);_0x1b8230[_0x4a3c('0x38')]=_[_0x4a3c('0x36')](_0x512018[_0x4a3c('0x37')],qs[_0x4a3c('0x39')](_0x1a4d34[_0x4a3c('0x34')]['fields']));_0x1b8230[_0x4a3c('0x38')]=_0x1b8230[_0x4a3c('0x38')]['length']?_0x1b8230['attributes']:_0x512018[_0x4a3c('0x37')];if(!_0x1a4d34['query'][_0x4a3c('0x3a')](_0x4a3c('0x3b'))){_0x1b8230[_0x4a3c('0x23')]=qs[_0x4a3c('0x23')](_0x1a4d34[_0x4a3c('0x34')][_0x4a3c('0x23')]);_0x1b8230[_0x4a3c('0x21')]=qs[_0x4a3c('0x21')](_0x1a4d34[_0x4a3c('0x34')][_0x4a3c('0x21')]);}_0x1b8230['order']=qs[_0x4a3c('0x3c')](_0x1a4d34[_0x4a3c('0x34')][_0x4a3c('0x3c')]);_0x1b8230['where']=qs[_0x4a3c('0x3d')](_['pick'](_0x1a4d34[_0x4a3c('0x34')],_0x512018[_0x4a3c('0x3d')]),_0x1dab45);if(_0x1a4d34['query'][_0x4a3c('0x3e')]){_0x1b8230[_0x4a3c('0x3f')]=_[_0x4a3c('0x40')](_0x1b8230[_0x4a3c('0x3f')],{'$or':_[_0x4a3c('0x2f')](_0x1dab45,function(_0x2686b1){if(_0x2686b1[_0x4a3c('0x41')]!==_0x4a3c('0x42')){var _0x200d6a={};_0x200d6a[_0x2686b1[_0x4a3c('0x33')]]={'$like':'%'+_0x1a4d34[_0x4a3c('0x34')][_0x4a3c('0x3e')]+'%'};return _0x200d6a;}})});}_0x1b8230=_['merge']({},_0x1b8230,_0x1a4d34['options']);var _0x2b243f={'where':_0x1b8230[_0x4a3c('0x3f')]};return db[_0x4a3c('0x30')][_0x4a3c('0x24')](_0x2b243f)['then'](function(_0x4c1d36){_0x1c176c['count']=_0x4c1d36;if(_0x1a4d34[_0x4a3c('0x34')]['includeAll']){_0x1b8230[_0x4a3c('0x43')]=[{'all':!![]}];}return db[_0x4a3c('0x30')][_0x4a3c('0x44')](_0x1b8230);})[_0x4a3c('0x29')](function(_0x12fff5){_0x1c176c[_0x4a3c('0x45')]=_0x12fff5;return _0x1c176c;})[_0x4a3c('0x29')](respondWithFilteredResult(_0x3923d5,_0x1b8230))['catch'](handleError(_0x3923d5,null));};exports[_0x4a3c('0x46')]=function(_0x5267ce,_0x4cf152){var _0x5edeb3={'raw':![],'where':{'id':_0x5267ce['params']['id']}},_0x31893e={};_0x31893e[_0x4a3c('0x37')]=_[_0x4a3c('0x35')](db[_0x4a3c('0x30')][_0x4a3c('0x47')]);_0x31893e[_0x4a3c('0x34')]=_['keys'](_0x5267ce[_0x4a3c('0x34')]);_0x31893e[_0x4a3c('0x3d')]=_['intersection'](_0x31893e[_0x4a3c('0x37')],_0x31893e['query']);_0x5edeb3['attributes']=_[_0x4a3c('0x36')](_0x31893e[_0x4a3c('0x37')],qs[_0x4a3c('0x39')](_0x5267ce[_0x4a3c('0x34')][_0x4a3c('0x39')]));_0x5edeb3['attributes']=_0x5edeb3[_0x4a3c('0x38')][_0x4a3c('0x48')]?_0x5edeb3[_0x4a3c('0x38')]:_0x31893e['model'];if(_0x5267ce['query'][_0x4a3c('0x49')]){_0x5edeb3[_0x4a3c('0x43')]=[{'all':!![]}];}_0x5edeb3=_[_0x4a3c('0x40')]({},_0x5edeb3,_0x5267ce[_0x4a3c('0x4a')]);return db[_0x4a3c('0x30')][_0x4a3c('0x4b')](_0x5edeb3)[_0x4a3c('0x29')](handleEntityNotFound(_0x4cf152,null))[_0x4a3c('0x29')](respondWithResult(_0x4cf152,null))['catch'](handleError(_0x4cf152,null));};exports[_0x4a3c('0x4c')]=function(_0x10c131,_0x3aedfc){return db[_0x4a3c('0x30')][_0x4a3c('0x4c')](_0x10c131['body'],{})['then'](function(_0x39b9ac){var _0x3a3d5d=_0x10c131[_0x4a3c('0x4d')]['get']({'plain':!![]});if(!_0x3a3d5d)throw new Error(_0x4a3c('0x4e'));if(_0x3a3d5d[_0x4a3c('0x4f')]===_0x4a3c('0x4d')){var _0x4b66d2=_0x39b9ac[_0x4a3c('0x2b')]({'plain':!![]});var _0x692a91=_0x4a3c('0x50');return db['UserProfileSection'][_0x4a3c('0x4b')]({'where':{'name':_0x692a91,'userProfileId':_0x3a3d5d[_0x4a3c('0x51')]},'raw':!![]})['then'](function(_0x5c2958){if(_0x5c2958&&_0x5c2958[_0x4a3c('0x52')]===0x0){return db[_0x4a3c('0x2c')][_0x4a3c('0x4c')]({'name':_0x4b66d2['name'],'resourceId':_0x4b66d2['id'],'type':_0x5c2958[_0x4a3c('0x33')],'sectionId':_0x5c2958['id']},{})['then'](function(){return _0x39b9ac;});}else{return _0x39b9ac;}})[_0x4a3c('0x53')](function(_0x3e75d9){logger[_0x4a3c('0x54')](_0x4a3c('0x55'),_0x3e75d9);throw _0x3e75d9;});}return _0x39b9ac;})[_0x4a3c('0x29')](respondWithResult(_0x3aedfc,0xc9))[_0x4a3c('0x53')](handleError(_0x3aedfc,null));};exports['update']=function(_0x39d696,_0x57f146){if(_0x39d696[_0x4a3c('0x56')]['id']){delete _0x39d696[_0x4a3c('0x56')]['id'];}return db[_0x4a3c('0x30')][_0x4a3c('0x4b')]({'where':{'id':_0x39d696[_0x4a3c('0x57')]['id']}})[_0x4a3c('0x29')](handleEntityNotFound(_0x57f146,null))[_0x4a3c('0x29')](saveUpdates(_0x39d696[_0x4a3c('0x56')],null))[_0x4a3c('0x29')](respondWithResult(_0x57f146,null))[_0x4a3c('0x53')](handleError(_0x57f146,null));};exports[_0x4a3c('0x2a')]=function(_0x2c7daa,_0x1d5e7b){return db[_0x4a3c('0x30')][_0x4a3c('0x4b')]({'where':{'id':_0x2c7daa[_0x4a3c('0x57')]['id']}})[_0x4a3c('0x29')](handleEntityNotFound(_0x1d5e7b,null))[_0x4a3c('0x29')](removeEntity(_0x1d5e7b,null))[_0x4a3c('0x53')](handleError(_0x1d5e7b,null));};exports[_0x4a3c('0x58')]=function(_0x1537f0,_0x31288b,_0x592784){return db[_0x4a3c('0x30')][_0x4a3c('0x59')]({'where':{'id':_0x1537f0[_0x4a3c('0x57')]['id']}})[_0x4a3c('0x29')](handleEntityNotFound(_0x31288b,null))[_0x4a3c('0x29')](function(_0x24f53d){if(!_0x1537f0['query'][_0x4a3c('0x5a')]||!utils[_0x4a3c('0x5b')](_0x1537f0[_0x4a3c('0x34')][_0x4a3c('0x5a')])){throw new db[(_0x4a3c('0x5c'))]['ValidationError'](_0x4a3c('0x5d'));}var _0x43da3f={};var _0x4125bc={};_0x4125bc[_0x4a3c('0x37')]=_['keys'](db[_[_0x4a3c('0x5e')](_0x1537f0[_0x4a3c('0x34')]['channel'][_0x4a3c('0x5f')]())+'Queue'][_0x4a3c('0x47')]);_0x4125bc[_0x4a3c('0x34')]=_[_0x4a3c('0x35')](_0x1537f0[_0x4a3c('0x34')]);_0x4125bc['filters']=_[_0x4a3c('0x36')](_0x4125bc[_0x4a3c('0x37')],_0x4125bc[_0x4a3c('0x34')]);_0x43da3f[_0x4a3c('0x38')]=_[_0x4a3c('0x36')](_0x4125bc[_0x4a3c('0x37')],qs[_0x4a3c('0x39')](_0x1537f0[_0x4a3c('0x34')][_0x4a3c('0x39')]));_0x43da3f[_0x4a3c('0x38')]=_0x43da3f['attributes']['length']?_0x43da3f['attributes']:_0x4125bc[_0x4a3c('0x37')];_0x43da3f['limit']=qs['limit'](_0x1537f0[_0x4a3c('0x34')]['limit']);_0x43da3f[_0x4a3c('0x21')]=qs[_0x4a3c('0x21')](_0x1537f0[_0x4a3c('0x34')][_0x4a3c('0x21')]);_0x43da3f[_0x4a3c('0x60')]=qs[_0x4a3c('0x3c')](_0x1537f0[_0x4a3c('0x34')][_0x4a3c('0x3c')]);_0x43da3f['where']=qs[_0x4a3c('0x3d')](_['pick'](_0x1537f0[_0x4a3c('0x34')],_0x4125bc[_0x4a3c('0x3d')]));_0x43da3f=_[_0x4a3c('0x40')]({},_0x43da3f,_0x1537f0['options']);return _0x24f53d[_0x4a3c('0x2b')+_[_0x4a3c('0x5e')](_0x1537f0[_0x4a3c('0x34')][_0x4a3c('0x5a')][_0x4a3c('0x5f')]())+'Queues'](_0x43da3f);})[_0x4a3c('0x29')](respondWithResult(_0x31288b,null))['catch'](handleError(_0x31288b,null));};exports[_0x4a3c('0x61')]=function(_0xb9333d,_0x258b88,_0x26c2f0){return db[_0x4a3c('0x30')]['findOne']({'where':{'id':_0xb9333d['params']['id']}})['then'](function(_0x2b4dc4){if(_0x2b4dc4){if(!_0xb9333d[_0x4a3c('0x56')]['channel']||!utils[_0x4a3c('0x5b')](_0xb9333d[_0x4a3c('0x56')][_0x4a3c('0x5a')])){throw new db[(_0x4a3c('0x5c'))][(_0x4a3c('0x62'))](_0x4a3c('0x5d'));}return _0x2b4dc4['add'+_[_0x4a3c('0x5e')](_0xb9333d[_0x4a3c('0x56')][_0x4a3c('0x5a')]['toLowerCase']())+'Queues'](_0xb9333d[_0x4a3c('0x56')][_0x4a3c('0x63')]);}return null;})[_0x4a3c('0x29')](handleEntityNotFound(_0x258b88,null))['then'](respondWithStatusCode(_0x258b88,null))[_0x4a3c('0x53')](handleError(_0x258b88,null));};exports[_0x4a3c('0x64')]=function(_0x2a5e2,_0x2fb968,_0x37acbd){return db['Team'][_0x4a3c('0x59')]({'where':{'id':_0x2a5e2[_0x4a3c('0x57')]['id']}})['then'](function(_0x3826b0){if(_0x3826b0){if(!_0x2a5e2[_0x4a3c('0x34')][_0x4a3c('0x5a')]||!utils[_0x4a3c('0x5b')](_0x2a5e2[_0x4a3c('0x34')]['channel'])){throw new db[(_0x4a3c('0x5c'))]['ValidationError'](_0x4a3c('0x5d'));}return _0x3826b0[_0x4a3c('0x65')+_[_0x4a3c('0x5e')](_0x2a5e2[_0x4a3c('0x34')]['channel']['toLowerCase']())+_0x4a3c('0x66')](_0x2a5e2[_0x4a3c('0x34')][_0x4a3c('0x63')]);}return null;})[_0x4a3c('0x29')](handleEntityNotFound(_0x2fb968,null))['then'](respondWithStatusCode(_0x2fb968,null))['catch'](handleError(_0x2fb968,null));};exports['addAgents']=function(_0x3b43c7,_0x573595){return db[_0x4a3c('0x30')][_0x4a3c('0x4b')]({'where':{'id':_0x3b43c7[_0x4a3c('0x57')]['id']}})[_0x4a3c('0x29')](handleEntityNotFound(_0x573595,null))[_0x4a3c('0x29')](function(_0x560900){if(_0x560900){var _0x396d9a=['Voice','Chat',_0x4a3c('0x67'),_0x4a3c('0x68'),_0x4a3c('0x69'),_0x4a3c('0x6a'),_0x4a3c('0x6b')];return db[_0x4a3c('0x6c')]['transaction'](function(_0x91f80c){var _0x427765=_['map'](_0x396d9a,function(_0x1008aa){var _0x4a0ef9={'attributes':['id','name']};if(_0x1008aa==='Voice'){_0x4a0ef9[_0x4a3c('0x6d')]={'attributes':[_0x4a3c('0x6e')]};}return _0x560900[_0x4a3c('0x2b')+_0x1008aa+_0x4a3c('0x66')](_0x4a0ef9)[_0x4a3c('0x29')](function(_0x841736){var _0x1398d9=_[_0x4a3c('0x2f')](_0x841736,function(_0x3326cf){var _0x2c198f=_[_0x4a3c('0x2f')](_0x3b43c7[_0x4a3c('0x56')][_0x4a3c('0x63')],function(_0x5c41a0){var _0x1c02ed={'where':{'UserId':_0x5c41a0,[_0x1008aa+'QueueId']:_0x3326cf['id']},'transaction':_0x91f80c};if(_0x1008aa==='Voice'){_0x1c02ed[_0x4a3c('0x19')]={'penalty':_0x3326cf['TeamVoiceQueue'][_0x4a3c('0x6e')]};}return db[_0x4a3c('0x6f')+_0x1008aa+_0x4a3c('0x70')][_0x4a3c('0x71')](_0x1c02ed)[_0x4a3c('0x29')](function(){socket[_0x4a3c('0x72')]('user'+_0x1008aa+_0x4a3c('0x73'),{'UserId':_0x5c41a0,[_0x1008aa+'QueueId']:_0x3326cf['id']});if(_0x1008aa!==_0x4a3c('0x74'))return;return db[_0x4a3c('0x6f')][_0x4a3c('0x44')]({'where':{'id':_0x3b43c7[_0x4a3c('0x56')][_0x4a3c('0x63')],'online':0x1},'attributes':['id','name',_0x4a3c('0x75'),_0x4a3c('0x76'),_0x4a3c('0x77')],'raw':!![]})[_0x4a3c('0x29')](function(_0x400fc6){var _0x288a80=_[_0x4a3c('0x2f')](_0x400fc6,function(_0x2cb8a9){return db[_0x4a3c('0x78')][_0x4a3c('0x79')]({'membername':_0x2cb8a9[_0x4a3c('0x33')],'UserId':_0x2cb8a9['id'],'queue_name':_0x3326cf[_0x4a3c('0x33')],'VoiceQueueId':_0x3326cf['id'],'interface':_['isNil'](_0x2cb8a9[_0x4a3c('0x77')])?util[_0x4a3c('0x7a')](_0x4a3c('0x7b'),_0x2cb8a9[_0x4a3c('0x33')]):_0x2cb8a9['interface'],'paused':_0x2cb8a9[_0x4a3c('0x76')]||![],'penalty':_0x3326cf['TeamVoiceQueue'][_0x4a3c('0x6e')]},{'transaction':_0x91f80c});});return Promise[_0x4a3c('0x7c')](_0x288a80);});});});return Promise['all'](_0x2c198f);});return Promise[_0x4a3c('0x7c')](_0x1398d9);});});return Promise[_0x4a3c('0x7c')](_0x427765)['then'](function(){return _0x560900[_0x4a3c('0x7d')](_0x3b43c7[_0x4a3c('0x56')][_0x4a3c('0x63')],{'transaction':_0x91f80c})[_0x4a3c('0x7e')](function(_0x4fc2d2){return _0x4fc2d2;});});});}})[_0x4a3c('0x29')](respondWithResult(_0x573595,null))[_0x4a3c('0x53')](handleError(_0x573595,null));};exports['removeAgents']=function(_0x2f9548,_0xd3ff07){return db[_0x4a3c('0x30')][_0x4a3c('0x4b')]({'where':{'id':_0x2f9548[_0x4a3c('0x57')]['id']}})[_0x4a3c('0x29')](handleEntityNotFound(_0xd3ff07,null))[_0x4a3c('0x29')](function(_0x4e3793){if(_0x4e3793){var _0x2fb768=[_0x4a3c('0x74'),_0x4a3c('0x7f'),'Mail',_0x4a3c('0x68'),_0x4a3c('0x69'),_0x4a3c('0x6a'),_0x4a3c('0x6b')];return db['sequelize'][_0x4a3c('0x80')](function(_0x3cadea){var _0x8361d9=_[_0x4a3c('0x2f')](_0x2fb768,function(_0x4394c5){var _0x2a2180={'attributes':['id',_0x4a3c('0x33')]};return _0x4e3793[_0x4a3c('0x2b')+_0x4394c5+_0x4a3c('0x66')](_0x2a2180)[_0x4a3c('0x29')](function(_0x553413){var _0x144a52=_['map'](_0x553413,function(_0x581bad){return _0x581bad[_0x4a3c('0x81')](_0x2f9548[_0x4a3c('0x34')]['ids'],{'transaction':_0x3cadea})['then'](function(){var _0x4b4be6=JSON['parse']('['+_0x2f9548[_0x4a3c('0x34')][_0x4a3c('0x63')]+']');var _0x16e8cc=_[_0x4a3c('0x2f')](_0x4b4be6,function(_0x35ad3d){socket[_0x4a3c('0x72')](_0x4a3c('0x4d')+_0x4394c5+_0x4a3c('0x82'),{'UserId':Number(_0x35ad3d),[_0x4394c5+_0x4a3c('0x83')]:_0x581bad['id']});if(_0x4394c5!==_0x4a3c('0x74'))return;return db['UserVoiceQueueRt'][_0x4a3c('0x2a')]({'where':{'VoiceQueueId':_0x581bad['id'],'UserId':_0x35ad3d},'transaction':_0x3cadea});});return Promise['all'](_0x16e8cc);});});return Promise[_0x4a3c('0x7c')](_0x144a52);});});return Promise[_0x4a3c('0x7c')](_0x8361d9)[_0x4a3c('0x29')](function(){return _0x4e3793[_0x4a3c('0x81')](_0x2f9548[_0x4a3c('0x34')]['ids'],{'transaction':_0x3cadea});});});}})['then'](respondWithStatusCode(_0xd3ff07,null))[_0x4a3c('0x53')](handleError(_0xd3ff07,null));};exports[_0x4a3c('0x84')]=function(_0x1c2eaf,_0x349cda,_0x4d271b){var _0x158d83={};var _0x361819={};var _0x340d56;var _0x5b508e;return db[_0x4a3c('0x30')][_0x4a3c('0x59')]({'where':{'id':_0x1c2eaf['params']['id']}})[_0x4a3c('0x29')](handleEntityNotFound(_0x349cda,null))[_0x4a3c('0x29')](function(_0x3d0492){if(_0x3d0492){_0x340d56=_0x3d0492;_0x361819[_0x4a3c('0x37')]=_['keys'](db['User'][_0x4a3c('0x47')]);_0x361819['query']=_['keys'](_0x1c2eaf['query']);_0x361819[_0x4a3c('0x3d')]=_[_0x4a3c('0x36')](_0x361819[_0x4a3c('0x37')],_0x361819['query']);_0x158d83[_0x4a3c('0x38')]=_[_0x4a3c('0x36')](_0x361819[_0x4a3c('0x37')],qs['fields'](_0x1c2eaf['query'][_0x4a3c('0x39')]));_0x158d83['attributes']=_0x158d83[_0x4a3c('0x38')][_0x4a3c('0x48')]?_0x158d83[_0x4a3c('0x38')]:_0x361819['model'];_0x158d83[_0x4a3c('0x60')]=qs[_0x4a3c('0x3c')](_0x1c2eaf['query'][_0x4a3c('0x3c')]);_0x158d83[_0x4a3c('0x3f')]=qs[_0x4a3c('0x3d')](_[_0x4a3c('0x85')](_0x1c2eaf[_0x4a3c('0x34')],_0x361819[_0x4a3c('0x3d')]));if(_0x1c2eaf[_0x4a3c('0x34')]['filter']){_0x158d83[_0x4a3c('0x3f')]=_[_0x4a3c('0x40')](_0x158d83['where'],{'$or':_['map'](_0x158d83[_0x4a3c('0x38')],function(_0xb8700){var _0x21a549={};_0x21a549[_0xb8700]={'$like':'%'+_0x1c2eaf['query'][_0x4a3c('0x3e')]+'%'};return _0x21a549;})});}_0x158d83=_[_0x4a3c('0x40')]({},_0x158d83,_0x1c2eaf[_0x4a3c('0x4a')]);return _0x340d56[_0x4a3c('0x84')](_0x158d83);}})['then'](function(_0x516a31){if(_0x516a31){_0x5b508e=_0x516a31[_0x4a3c('0x48')];if(!_0x1c2eaf['query'][_0x4a3c('0x3a')](_0x4a3c('0x3b'))){_0x158d83['limit']=qs[_0x4a3c('0x23')](_0x1c2eaf[_0x4a3c('0x34')][_0x4a3c('0x23')]);_0x158d83[_0x4a3c('0x21')]=qs['offset'](_0x1c2eaf[_0x4a3c('0x34')][_0x4a3c('0x21')]);}return _0x340d56[_0x4a3c('0x84')](_0x158d83);}})[_0x4a3c('0x29')](function(_0x289ace){if(_0x289ace){return _0x289ace?{'count':_0x5b508e,'rows':_0x289ace}:null;}})[_0x4a3c('0x29')](respondWithResult(_0x349cda,null))[_0x4a3c('0x53')](handleError(_0x349cda,null));}; \ No newline at end of file +var _0x471a=['penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','user','Queue:save','User','online','interface','upsert','format','SIP/%s','all','removeAgents','Openchannel','parse','Queue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./team.socket','register','status','end','json','offset','limit','count','set','Content-Range','apply','save','destroy','then','get','Teams','UserProfileResource','stack','name','send','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','Queue','capitalize','Queues','addQueues','add','toLowerCase','ids','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Whatsapp','sequelize','transaction'];(function(_0x142bf3,_0xfd3b05){var _0x1663ae=function(_0x667e0f){while(--_0x667e0f){_0x142bf3['push'](_0x142bf3['shift']());}};_0x1663ae(++_0xfd3b05);}(_0x471a,0x18d));var _0xa471=function(_0x57d6b6,_0x57af69){_0x57d6b6=_0x57d6b6-0x0;var _0x4f18e0=_0x471a[_0x57d6b6];return _0x4f18e0;};'use strict';var emlformat=require(_0xa471('0x0'));var rimraf=require(_0xa471('0x1'));var zipdir=require(_0xa471('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa471('0x3'));var moment=require(_0xa471('0x4'));var BPromise=require(_0xa471('0x5'));var Mustache=require(_0xa471('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa471('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa471('0x8'));var crypto=require(_0xa471('0x9'));var jsforce=require(_0xa471('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa471('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa471('0xb'));var authService=require(_0xa471('0xc'));var qs=require(_0xa471('0xd'));var as=require(_0xa471('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa471('0xf'))(_0xa471('0x10'));var utils=require(_0xa471('0x11'));var config=require(_0xa471('0x12'));var licenseUtil=require(_0xa471('0x13'));var db=require(_0xa471('0x14'))['db'];config['redis']=_[_0xa471('0x15')](config['redis'],{'host':_0xa471('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa471('0x17')]));require(_0xa471('0x18'))[_0xa471('0x19')](socket);function respondWithStatusCode(_0x39c025,_0x45ef67){_0x45ef67=_0x45ef67||0xcc;return function(_0x25f5f5){if(_0x25f5f5){return _0x39c025['sendStatus'](_0x45ef67);}return _0x39c025[_0xa471('0x1a')](_0x45ef67)[_0xa471('0x1b')]();};}function respondWithResult(_0x16e5bf,_0x4297a7){_0x4297a7=_0x4297a7||0xc8;return function(_0x74b90e){if(_0x74b90e){return _0x16e5bf['status'](_0x4297a7)[_0xa471('0x1c')](_0x74b90e);}};}function respondWithFilteredResult(_0x35f2f3,_0x3ff7be){return function(_0x5e5225){if(_0x5e5225){var _0x57a8a2=typeof _0x3ff7be[_0xa471('0x1d')]==='undefined'&&typeof _0x3ff7be[_0xa471('0x1e')]==='undefined';var _0x5e56dc=_0x5e5225[_0xa471('0x1f')];var _0x3172d3=_0x57a8a2?0x0:_0x3ff7be[_0xa471('0x1d')];var _0x1952a0=_0x57a8a2?_0x5e5225[_0xa471('0x1f')]:_0x3ff7be[_0xa471('0x1d')]+_0x3ff7be[_0xa471('0x1e')];var _0x554610;if(_0x1952a0>=_0x5e56dc){_0x1952a0=_0x5e56dc;_0x554610=0xc8;}else{_0x554610=0xce;}_0x35f2f3[_0xa471('0x1a')](_0x554610);return _0x35f2f3[_0xa471('0x20')](_0xa471('0x21'),_0x3172d3+'-'+_0x1952a0+'/'+_0x5e56dc)['json'](_0x5e5225);}return null;};}function patchUpdates(_0x3e0972){return function(_0x5568c9){try{jsonpatch[_0xa471('0x22')](_0x5568c9,_0x3e0972,!![]);}catch(_0x2b7755){return BPromise['reject'](_0x2b7755);}return _0x5568c9[_0xa471('0x23')]();};}function saveUpdates(_0x41a855,_0x4debbe){return function(_0x109135){if(_0x109135){return _0x109135['update'](_0x41a855)['then'](function(_0x188d6a){return _0x188d6a;});}return null;};}function removeEntity(_0x2b1d3c,_0x56682a){return function(_0x5378d0){if(_0x5378d0){return _0x5378d0[_0xa471('0x24')]()[_0xa471('0x25')](function(){var _0x5009cf=_0x5378d0[_0xa471('0x26')]({'plain':!![]});var _0x1c6d6e=_0xa471('0x27');return db[_0xa471('0x28')]['destroy']({'where':{'type':_0x1c6d6e,'resourceId':_0x5009cf['id']}})[_0xa471('0x25')](function(){return _0x5378d0;});})[_0xa471('0x25')](function(){_0x2b1d3c['status'](0xcc)[_0xa471('0x1b')]();});}};}function handleEntityNotFound(_0x3bb318,_0x469b08){return function(_0x3961b5){if(!_0x3961b5){_0x3bb318['sendStatus'](0x194);}return _0x3961b5;};}function handleError(_0x1f309b,_0x82a9f6){_0x82a9f6=_0x82a9f6||0x1f4;return function(_0x58dbb3){logger['error'](_0x58dbb3[_0xa471('0x29')]);if(_0x58dbb3[_0xa471('0x2a')]){delete _0x58dbb3[_0xa471('0x2a')];}_0x1f309b[_0xa471('0x1a')](_0x82a9f6)[_0xa471('0x2b')](_0x58dbb3);};}exports['index']=function(_0x246db2,_0x12c68e){var _0x1bfb14={},_0x1343e9={},_0x2a9203={'count':0x0,'rows':[]};var _0xd7e5d9=_[_0xa471('0x2c')](db[_0xa471('0x2d')][_0xa471('0x2e')],function(_0x556888){return{'name':_0x556888[_0xa471('0x2f')],'type':_0x556888[_0xa471('0x30')][_0xa471('0x31')]};});_0x1343e9[_0xa471('0x32')]=_[_0xa471('0x2c')](_0xd7e5d9,'name');_0x1343e9[_0xa471('0x33')]=_[_0xa471('0x34')](_0x246db2[_0xa471('0x33')]);_0x1343e9[_0xa471('0x35')]=_[_0xa471('0x36')](_0x1343e9[_0xa471('0x32')],_0x1343e9['query']);_0x1bfb14[_0xa471('0x37')]=_[_0xa471('0x36')](_0x1343e9[_0xa471('0x32')],qs[_0xa471('0x38')](_0x246db2[_0xa471('0x33')][_0xa471('0x38')]));_0x1bfb14['attributes']=_0x1bfb14[_0xa471('0x37')]['length']?_0x1bfb14['attributes']:_0x1343e9[_0xa471('0x32')];if(!_0x246db2[_0xa471('0x33')][_0xa471('0x39')](_0xa471('0x3a'))){_0x1bfb14[_0xa471('0x1e')]=qs['limit'](_0x246db2[_0xa471('0x33')][_0xa471('0x1e')]);_0x1bfb14[_0xa471('0x1d')]=qs[_0xa471('0x1d')](_0x246db2[_0xa471('0x33')][_0xa471('0x1d')]);}_0x1bfb14[_0xa471('0x3b')]=qs['sort'](_0x246db2[_0xa471('0x33')][_0xa471('0x3c')]);_0x1bfb14['where']=qs['filters'](_[_0xa471('0x3d')](_0x246db2[_0xa471('0x33')],_0x1343e9[_0xa471('0x35')]),_0xd7e5d9);if(_0x246db2[_0xa471('0x33')][_0xa471('0x3e')]){_0x1bfb14[_0xa471('0x3f')]=_[_0xa471('0x40')](_0x1bfb14[_0xa471('0x3f')],{'$or':_[_0xa471('0x2c')](_0xd7e5d9,function(_0x5230a7){if(_0x5230a7[_0xa471('0x30')]!=='VIRTUAL'){var _0x29dd78={};_0x29dd78[_0x5230a7[_0xa471('0x2a')]]={'$like':'%'+_0x246db2[_0xa471('0x33')][_0xa471('0x3e')]+'%'};return _0x29dd78;}})});}_0x1bfb14=_[_0xa471('0x40')]({},_0x1bfb14,_0x246db2[_0xa471('0x41')]);var _0x2a1a78={'where':_0x1bfb14['where']};return db[_0xa471('0x2d')][_0xa471('0x1f')](_0x2a1a78)['then'](function(_0x38ec90){_0x2a9203[_0xa471('0x1f')]=_0x38ec90;if(_0x246db2['query']['includeAll']){_0x1bfb14[_0xa471('0x42')]=[{'all':!![]}];}return db[_0xa471('0x2d')][_0xa471('0x43')](_0x1bfb14);})[_0xa471('0x25')](function(_0x109411){_0x2a9203[_0xa471('0x44')]=_0x109411;return _0x2a9203;})[_0xa471('0x25')](respondWithFilteredResult(_0x12c68e,_0x1bfb14))[_0xa471('0x45')](handleError(_0x12c68e,null));};exports[_0xa471('0x46')]=function(_0x2798e7,_0x134d23){var _0x14affb={'raw':![],'where':{'id':_0x2798e7[_0xa471('0x47')]['id']}},_0x5c6c6c={};_0x5c6c6c[_0xa471('0x32')]=_[_0xa471('0x34')](db[_0xa471('0x2d')][_0xa471('0x2e')]);_0x5c6c6c['query']=_[_0xa471('0x34')](_0x2798e7['query']);_0x5c6c6c[_0xa471('0x35')]=_['intersection'](_0x5c6c6c[_0xa471('0x32')],_0x5c6c6c[_0xa471('0x33')]);_0x14affb[_0xa471('0x37')]=_[_0xa471('0x36')](_0x5c6c6c[_0xa471('0x32')],qs['fields'](_0x2798e7[_0xa471('0x33')]['fields']));_0x14affb[_0xa471('0x37')]=_0x14affb[_0xa471('0x37')][_0xa471('0x48')]?_0x14affb[_0xa471('0x37')]:_0x5c6c6c[_0xa471('0x32')];if(_0x2798e7['query'][_0xa471('0x49')]){_0x14affb['include']=[{'all':!![]}];}_0x14affb=_[_0xa471('0x40')]({},_0x14affb,_0x2798e7[_0xa471('0x41')]);return db['Team']['find'](_0x14affb)[_0xa471('0x25')](handleEntityNotFound(_0x134d23,null))['then'](respondWithResult(_0x134d23,null))[_0xa471('0x45')](handleError(_0x134d23,null));};exports[_0xa471('0x4a')]=function(_0x47b623,_0x44a15c){return db[_0xa471('0x2d')][_0xa471('0x4a')](_0x47b623[_0xa471('0x4b')],{})[_0xa471('0x25')](function(_0x21323b){var _0x33af2f=_0x47b623['user'][_0xa471('0x26')]({'plain':!![]});if(!_0x33af2f)throw new Error(_0xa471('0x4c'));if(_0x33af2f[_0xa471('0x4d')]==='user'){var _0x1ec159=_0x21323b[_0xa471('0x26')]({'plain':!![]});var _0x537b58=_0xa471('0x27');return db[_0xa471('0x4e')][_0xa471('0x4f')]({'where':{'name':_0x537b58,'userProfileId':_0x33af2f['userProfileId']},'raw':!![]})[_0xa471('0x25')](function(_0x10707a){if(_0x10707a&&_0x10707a[_0xa471('0x50')]===0x0){return db[_0xa471('0x28')][_0xa471('0x4a')]({'name':_0x1ec159['name'],'resourceId':_0x1ec159['id'],'type':_0x10707a[_0xa471('0x2a')],'sectionId':_0x10707a['id']},{})[_0xa471('0x25')](function(){return _0x21323b;});}else{return _0x21323b;}})['catch'](function(_0x3ca38b){logger[_0xa471('0x51')](_0xa471('0x52'),_0x3ca38b);throw _0x3ca38b;});}return _0x21323b;})[_0xa471('0x25')](respondWithResult(_0x44a15c,0xc9))[_0xa471('0x45')](handleError(_0x44a15c,null));};exports[_0xa471('0x53')]=function(_0x2aa1c7,_0xeb3bf5){if(_0x2aa1c7[_0xa471('0x4b')]['id']){delete _0x2aa1c7[_0xa471('0x4b')]['id'];}return db[_0xa471('0x2d')][_0xa471('0x4f')]({'where':{'id':_0x2aa1c7['params']['id']}})[_0xa471('0x25')](handleEntityNotFound(_0xeb3bf5,null))['then'](saveUpdates(_0x2aa1c7[_0xa471('0x4b')],null))['then'](respondWithResult(_0xeb3bf5,null))[_0xa471('0x45')](handleError(_0xeb3bf5,null));};exports[_0xa471('0x24')]=function(_0x5c4ce6,_0x5e4fb2){return db[_0xa471('0x2d')][_0xa471('0x4f')]({'where':{'id':_0x5c4ce6[_0xa471('0x47')]['id']}})[_0xa471('0x25')](handleEntityNotFound(_0x5e4fb2,null))[_0xa471('0x25')](removeEntity(_0x5e4fb2,null))['catch'](handleError(_0x5e4fb2,null));};exports['getQueues']=function(_0x1496fd,_0x4492cb,_0x177412){return db[_0xa471('0x2d')][_0xa471('0x54')]({'where':{'id':_0x1496fd[_0xa471('0x47')]['id']}})[_0xa471('0x25')](handleEntityNotFound(_0x4492cb,null))[_0xa471('0x25')](function(_0x1decb5){if(!_0x1496fd[_0xa471('0x33')][_0xa471('0x55')]||!utils[_0xa471('0x56')](_0x1496fd[_0xa471('0x33')][_0xa471('0x55')])){throw new db[(_0xa471('0x57'))][(_0xa471('0x58'))](_0xa471('0x59'));}var _0xaba23={};var _0x28856f={};_0x28856f[_0xa471('0x32')]=_[_0xa471('0x34')](db[_['capitalize'](_0x1496fd[_0xa471('0x33')]['channel']['toLowerCase']())+_0xa471('0x5a')]['rawAttributes']);_0x28856f[_0xa471('0x33')]=_[_0xa471('0x34')](_0x1496fd[_0xa471('0x33')]);_0x28856f[_0xa471('0x35')]=_[_0xa471('0x36')](_0x28856f[_0xa471('0x32')],_0x28856f[_0xa471('0x33')]);_0xaba23[_0xa471('0x37')]=_[_0xa471('0x36')](_0x28856f['model'],qs['fields'](_0x1496fd[_0xa471('0x33')][_0xa471('0x38')]));_0xaba23[_0xa471('0x37')]=_0xaba23[_0xa471('0x37')]['length']?_0xaba23[_0xa471('0x37')]:_0x28856f[_0xa471('0x32')];_0xaba23[_0xa471('0x1e')]=qs[_0xa471('0x1e')](_0x1496fd[_0xa471('0x33')][_0xa471('0x1e')]);_0xaba23[_0xa471('0x1d')]=qs[_0xa471('0x1d')](_0x1496fd[_0xa471('0x33')][_0xa471('0x1d')]);_0xaba23[_0xa471('0x3b')]=qs['sort'](_0x1496fd['query'][_0xa471('0x3c')]);_0xaba23[_0xa471('0x3f')]=qs['filters'](_[_0xa471('0x3d')](_0x1496fd[_0xa471('0x33')],_0x28856f['filters']));_0xaba23=_[_0xa471('0x40')]({},_0xaba23,_0x1496fd[_0xa471('0x41')]);return _0x1decb5[_0xa471('0x26')+_[_0xa471('0x5b')](_0x1496fd['query'][_0xa471('0x55')]['toLowerCase']())+_0xa471('0x5c')](_0xaba23);})[_0xa471('0x25')](respondWithResult(_0x4492cb,null))['catch'](handleError(_0x4492cb,null));};exports[_0xa471('0x5d')]=function(_0x1bd397,_0x54e10d,_0x6fe8b9){return db[_0xa471('0x2d')][_0xa471('0x54')]({'where':{'id':_0x1bd397[_0xa471('0x47')]['id']}})[_0xa471('0x25')](function(_0x5bad1d){if(_0x5bad1d){if(!_0x1bd397[_0xa471('0x4b')][_0xa471('0x55')]||!utils[_0xa471('0x56')](_0x1bd397['body'][_0xa471('0x55')])){throw new db[(_0xa471('0x57'))]['ValidationError'](_0xa471('0x59'));}return _0x5bad1d[_0xa471('0x5e')+_[_0xa471('0x5b')](_0x1bd397[_0xa471('0x4b')][_0xa471('0x55')][_0xa471('0x5f')]())+'Queues'](_0x1bd397[_0xa471('0x4b')][_0xa471('0x60')]);}return null;})[_0xa471('0x25')](handleEntityNotFound(_0x54e10d,null))[_0xa471('0x25')](respondWithStatusCode(_0x54e10d,null))[_0xa471('0x45')](handleError(_0x54e10d,null));};exports['removeQueues']=function(_0x2edd6a,_0x5a1be3,_0x108186){return db[_0xa471('0x2d')][_0xa471('0x54')]({'where':{'id':_0x2edd6a[_0xa471('0x47')]['id']}})['then'](function(_0x300df1){if(_0x300df1){if(!_0x2edd6a[_0xa471('0x33')][_0xa471('0x55')]||!utils['isValidChannel'](_0x2edd6a['query'][_0xa471('0x55')])){throw new db[(_0xa471('0x57'))][(_0xa471('0x58'))](_0xa471('0x59'));}return _0x300df1[_0xa471('0x61')+_[_0xa471('0x5b')](_0x2edd6a[_0xa471('0x33')][_0xa471('0x55')][_0xa471('0x5f')]())+_0xa471('0x5c')](_0x2edd6a[_0xa471('0x33')][_0xa471('0x60')]);}return null;})['then'](handleEntityNotFound(_0x5a1be3,null))[_0xa471('0x25')](respondWithStatusCode(_0x5a1be3,null))[_0xa471('0x45')](handleError(_0x5a1be3,null));};exports[_0xa471('0x62')]=function(_0x2c9df1,_0x16eb50){return db[_0xa471('0x2d')][_0xa471('0x4f')]({'where':{'id':_0x2c9df1['params']['id']}})[_0xa471('0x25')](handleEntityNotFound(_0x16eb50,null))[_0xa471('0x25')](function(_0x581a2a){if(_0x581a2a){var _0x120556=[_0xa471('0x63'),_0xa471('0x64'),_0xa471('0x65'),_0xa471('0x66'),_0xa471('0x67'),'Openchannel',_0xa471('0x68')];return db[_0xa471('0x69')][_0xa471('0x6a')](function(_0xb0d451){var _0xe2fa35=_['map'](_0x120556,function(_0x250748){var _0x4da330={'attributes':['id',_0xa471('0x2a')]};if(_0x250748==='Voice'){_0x4da330['through']={'attributes':[_0xa471('0x6b')]};}return _0x581a2a[_0xa471('0x26')+_0x250748+'Queues'](_0x4da330)[_0xa471('0x25')](function(_0x125ef8){var _0x5d607f=_[_0xa471('0x2c')](_0x125ef8,function(_0x441bd4){var _0x181af0=_[_0xa471('0x2c')](_0x2c9df1[_0xa471('0x4b')][_0xa471('0x60')],function(_0x35e32b){var _0x2c83a6={'where':{'UserId':_0x35e32b,[_0x250748+_0xa471('0x6c')]:_0x441bd4['id']},'transaction':_0xb0d451};if(_0x250748===_0xa471('0x63')){_0x2c83a6['defaults']={'penalty':_0x441bd4[_0xa471('0x6d')][_0xa471('0x6b')]};}return db['User'+_0x250748+'Queue'][_0xa471('0x6e')](_0x2c83a6)[_0xa471('0x25')](function(){socket[_0xa471('0x6f')](_0xa471('0x70')+_0x250748+_0xa471('0x71'),{'UserId':_0x35e32b,[_0x250748+'QueueId']:_0x441bd4['id']});if(_0x250748!==_0xa471('0x63'))return;return db[_0xa471('0x72')]['findAll']({'where':{'id':_0x2c9df1['body'][_0xa471('0x60')],'online':0x1},'attributes':['id','name',_0xa471('0x73'),'voicePause',_0xa471('0x74')],'raw':!![]})[_0xa471('0x25')](function(_0x56d7ff){var _0x152e0a=_[_0xa471('0x2c')](_0x56d7ff,function(_0xcdd7a4){return db['UserVoiceQueueRt'][_0xa471('0x75')]({'membername':_0xcdd7a4['name'],'UserId':_0xcdd7a4['id'],'queue_name':_0x441bd4[_0xa471('0x2a')],'VoiceQueueId':_0x441bd4['id'],'interface':_['isNil'](_0xcdd7a4[_0xa471('0x74')])?util[_0xa471('0x76')](_0xa471('0x77'),_0xcdd7a4[_0xa471('0x2a')]):_0xcdd7a4[_0xa471('0x74')],'paused':_0xcdd7a4['voicePause']||![],'penalty':_0x441bd4[_0xa471('0x6d')][_0xa471('0x6b')]},{'transaction':_0xb0d451});});return Promise[_0xa471('0x78')](_0x152e0a);});});});return Promise[_0xa471('0x78')](_0x181af0);});return Promise['all'](_0x5d607f);});});return Promise[_0xa471('0x78')](_0xe2fa35)[_0xa471('0x25')](function(){return _0x581a2a[_0xa471('0x62')](_0x2c9df1['body'][_0xa471('0x60')],{'transaction':_0xb0d451})['spread'](function(_0x1521ca){return _0x1521ca;});});});}})[_0xa471('0x25')](respondWithResult(_0x16eb50,null))[_0xa471('0x45')](handleError(_0x16eb50,null));};exports[_0xa471('0x79')]=function(_0x2d5fe1,_0x37d4fc){return db[_0xa471('0x2d')][_0xa471('0x4f')]({'where':{'id':_0x2d5fe1[_0xa471('0x47')]['id']}})['then'](handleEntityNotFound(_0x37d4fc,null))[_0xa471('0x25')](function(_0x53d18e){if(_0x53d18e){var _0x1eb97c=[_0xa471('0x63'),_0xa471('0x64'),_0xa471('0x65'),_0xa471('0x66'),'Fax',_0xa471('0x7a'),_0xa471('0x68')];return db[_0xa471('0x69')][_0xa471('0x6a')](function(_0x1a967f){var _0x330f69=_[_0xa471('0x2c')](_0x1eb97c,function(_0x49bbc8){var _0x645a78={'attributes':['id','name']};return _0x53d18e[_0xa471('0x26')+_0x49bbc8+_0xa471('0x5c')](_0x645a78)[_0xa471('0x25')](function(_0x5e5603){var _0x2db7f5=_[_0xa471('0x2c')](_0x5e5603,function(_0x712e0f){return _0x712e0f[_0xa471('0x79')](_0x2d5fe1[_0xa471('0x33')][_0xa471('0x60')],{'transaction':_0x1a967f})['then'](function(){var _0x4e452e=JSON[_0xa471('0x7b')]('['+_0x2d5fe1[_0xa471('0x33')][_0xa471('0x60')]+']');var _0x2e0818=_['map'](_0x4e452e,function(_0x3b0811){socket[_0xa471('0x6f')](_0xa471('0x70')+_0x49bbc8+_0xa471('0x7c'),{'UserId':Number(_0x3b0811),[_0x49bbc8+_0xa471('0x6c')]:_0x712e0f['id']});if(_0x49bbc8!==_0xa471('0x63'))return;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x712e0f['id'],'UserId':_0x3b0811},'transaction':_0x1a967f});});return Promise['all'](_0x2e0818);});});return Promise[_0xa471('0x78')](_0x2db7f5);});});return Promise[_0xa471('0x78')](_0x330f69)[_0xa471('0x25')](function(){return _0x53d18e[_0xa471('0x79')](_0x2d5fe1[_0xa471('0x33')]['ids'],{'transaction':_0x1a967f});});});}})[_0xa471('0x25')](respondWithStatusCode(_0x37d4fc,null))['catch'](handleError(_0x37d4fc,null));};exports[_0xa471('0x7d')]=function(_0x251a69,_0x3b8032,_0x4a6a04){var _0x253f8a={};var _0x4f1d35={};var _0x54e6be;var _0x2e5551;return db[_0xa471('0x2d')][_0xa471('0x54')]({'where':{'id':_0x251a69[_0xa471('0x47')]['id']}})[_0xa471('0x25')](handleEntityNotFound(_0x3b8032,null))[_0xa471('0x25')](function(_0x156333){if(_0x156333){_0x54e6be=_0x156333;_0x4f1d35[_0xa471('0x32')]=_[_0xa471('0x34')](db[_0xa471('0x72')][_0xa471('0x2e')]);_0x4f1d35[_0xa471('0x33')]=_[_0xa471('0x34')](_0x251a69[_0xa471('0x33')]);_0x4f1d35[_0xa471('0x35')]=_[_0xa471('0x36')](_0x4f1d35[_0xa471('0x32')],_0x4f1d35[_0xa471('0x33')]);_0x253f8a[_0xa471('0x37')]=_[_0xa471('0x36')](_0x4f1d35[_0xa471('0x32')],qs[_0xa471('0x38')](_0x251a69['query'][_0xa471('0x38')]));_0x253f8a[_0xa471('0x37')]=_0x253f8a[_0xa471('0x37')]['length']?_0x253f8a[_0xa471('0x37')]:_0x4f1d35['model'];_0x253f8a[_0xa471('0x3b')]=qs[_0xa471('0x3c')](_0x251a69['query']['sort']);_0x253f8a[_0xa471('0x3f')]=qs[_0xa471('0x35')](_[_0xa471('0x3d')](_0x251a69['query'],_0x4f1d35[_0xa471('0x35')]));if(_0x251a69['query'][_0xa471('0x3e')]){_0x253f8a[_0xa471('0x3f')]=_[_0xa471('0x40')](_0x253f8a[_0xa471('0x3f')],{'$or':_[_0xa471('0x2c')](_0x253f8a[_0xa471('0x37')],function(_0x34b67a){var _0x4d62df={};_0x4d62df[_0x34b67a]={'$like':'%'+_0x251a69['query'][_0xa471('0x3e')]+'%'};return _0x4d62df;})});}_0x253f8a=_[_0xa471('0x40')]({},_0x253f8a,_0x251a69[_0xa471('0x41')]);return _0x54e6be[_0xa471('0x7d')](_0x253f8a);}})[_0xa471('0x25')](function(_0x358bce){if(_0x358bce){_0x2e5551=_0x358bce['length'];if(!_0x251a69[_0xa471('0x33')][_0xa471('0x39')](_0xa471('0x3a'))){_0x253f8a[_0xa471('0x1e')]=qs['limit'](_0x251a69['query'][_0xa471('0x1e')]);_0x253f8a['offset']=qs[_0xa471('0x1d')](_0x251a69[_0xa471('0x33')][_0xa471('0x1d')]);}return _0x54e6be[_0xa471('0x7d')](_0x253f8a);}})[_0xa471('0x25')](function(_0x204bde){if(_0x204bde){return _0x204bde?{'count':_0x2e5551,'rows':_0x204bde}:null;}})[_0xa471('0x25')](respondWithResult(_0x3b8032,null))[_0xa471('0x45')](handleError(_0x3b8032,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f354e34..e552b4b 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 _0x3255=['hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove'];(function(_0x2e6f0c,_0x5cfde1){var _0x34ba20=function(_0x4720b3){while(--_0x4720b3){_0x2e6f0c['push'](_0x2e6f0c['shift']());}};_0x34ba20(++_0x5cfde1);}(_0x3255,0x139));var _0x5325=function(_0x1cc97f,_0x5ec5b1){_0x1cc97f=_0x1cc97f-0x0;var _0x492c2a=_0x3255[_0x1cc97f];return _0x492c2a;};'use strict';var EventEmitter=require(_0x5325('0x0'));var Team=require(_0x5325('0x1'))['db'][_0x5325('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x5325('0x3')](0x0);var events={'afterCreate':_0x5325('0x4'),'afterUpdate':_0x5325('0x5'),'afterDestroy':_0x5325('0x6')};function emitEvent(_0x3b448b){return function(_0x2f286f,_0x798279,_0x372c22){TeamEvents['emit'](_0x3b448b+':'+_0x2f286f['id'],_0x2f286f);TeamEvents['emit'](_0x3b448b,_0x2f286f);_0x372c22(null);};}for(var e in events){if(events[_0x5325('0x7')](e)){var event=events[e];Team[_0x5325('0x8')](e,emitEvent(event));}}module[_0x5325('0x9')]=TeamEvents; \ No newline at end of file +var _0xd8d1=['hook','exports','events','../../mysqldb','Team','save','update','emit','hasOwnProperty'];(function(_0x102efd,_0x58d7ed){var _0x216daa=function(_0x1bdfb1){while(--_0x1bdfb1){_0x102efd['push'](_0x102efd['shift']());}};_0x216daa(++_0x58d7ed);}(_0xd8d1,0xc8));var _0x1d8d=function(_0x354173,_0x496194){_0x354173=_0x354173-0x0;var _0x25675f=_0xd8d1[_0x354173];return _0x25675f;};'use strict';var EventEmitter=require(_0x1d8d('0x0'));var Team=require(_0x1d8d('0x1'))['db'][_0x1d8d('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1d8d('0x3'),'afterUpdate':_0x1d8d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x233e04){return function(_0x988cca,_0xe409e7,_0x481efd){TeamEvents[_0x1d8d('0x5')](_0x233e04+':'+_0x988cca['id'],_0x988cca);TeamEvents[_0x1d8d('0x5')](_0x233e04,_0x988cca);_0x481efd(null);};}for(var e in events){if(events[_0x1d8d('0x6')](e)){var event=events[e];Team[_0x1d8d('0x7')](e,emitEvent(event));}}module[_0x1d8d('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 9e88cfc..8e3ce6d 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 _0xf277=['../../config/environment','./team.attributes','exports','define','Team','teams','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20e60a,_0xfbf3b1){var _0x50ff1c=function(_0x54c766){while(--_0x54c766){_0x20e60a['push'](_0x20e60a['shift']());}};_0x50ff1c(++_0xfbf3b1);}(_0xf277,0x124));var _0x7f27=function(_0x1835b6,_0x4149c0){_0x1835b6=_0x1835b6-0x0;var _0x1f7267=_0xf277[_0x1835b6];return _0x1f7267;};'use strict';var _=require(_0x7f27('0x0'));var util=require('util');var logger=require(_0x7f27('0x1'))(_0x7f27('0x2'));var moment=require(_0x7f27('0x3'));var BPromise=require(_0x7f27('0x4'));var rp=require(_0x7f27('0x5'));var fs=require('fs');var path=require(_0x7f27('0x6'));var rimraf=require('rimraf');var config=require(_0x7f27('0x7'));var attributes=require(_0x7f27('0x8'));module[_0x7f27('0x9')]=function(_0x50a24e,_0x304595){return _0x50a24e[_0x7f27('0xa')](_0x7f27('0xb'),attributes,{'tableName':_0x7f27('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf441=['../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf441,0x1f4));var _0x1f44=function(_0x34342a,_0x3e16f5){_0x34342a=_0x34342a-0x0;var _0x427cdf=_0xf441[_0x34342a];return _0x427cdf;};'use strict';var _=require(_0x1f44('0x0'));var util=require(_0x1f44('0x1'));var logger=require(_0x1f44('0x2'))(_0x1f44('0x3'));var moment=require('moment');var BPromise=require(_0x1f44('0x4'));var rp=require(_0x1f44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f44('0x6'));var config=require(_0x1f44('0x7'));var attributes=require(_0x1f44('0x8'));module[_0x1f44('0x9')]=function(_0x5d6375,_0x3d2bcf){return _0x5d6375[_0x1f44('0xa')](_0x1f44('0xb'),attributes,{'tableName':_0x1f44('0xc'),'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 4d291d3..d74be78 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 _0x1e91=['defaults','register','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e91,0x8f));var _0x11e9=function(_0x4324e3,_0x17d826){_0x4324e3=_0x4324e3-0x0;var _0x114577=_0x1e91[_0x4324e3];return _0x114577;};'use strict';var _=require(_0x11e9('0x0'));var util=require('util');var moment=require(_0x11e9('0x1'));var BPromise=require(_0x11e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x11e9('0x4'));var logger=require(_0x11e9('0x5'))(_0x11e9('0x6'));var config=require(_0x11e9('0x7'));var jayson=require(_0x11e9('0x8'));var client=jayson[_0x11e9('0x9')]['http']({'port':0x232a});config[_0x11e9('0xa')]=_[_0x11e9('0xb')](config[_0x11e9('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11e9('0xa')]));require('./team.socket')[_0x11e9('0xc')](socket);function respondWithRpcPromise(_0x1e5fce,_0x513e95,_0x8cb071){return new BPromise(function(_0x4b7555,_0x2115b2){return client['request'](_0x1e5fce,_0x8cb071)['then'](function(_0x5b1017){logger[_0x11e9('0xd')](_0x11e9('0xe'),_0x513e95,_0x11e9('0xf'));logger['debug'](_0x11e9('0x10'),_0x513e95,_0x11e9('0xf'),JSON[_0x11e9('0x11')](_0x5b1017));if(_0x5b1017[_0x11e9('0x12')]){if(_0x5b1017[_0x11e9('0x12')][_0x11e9('0x13')]===0x1f4){logger['error'](_0x11e9('0xe'),_0x513e95,_0x5b1017[_0x11e9('0x12')][_0x11e9('0x14')]);return _0x2115b2(_0x5b1017['error'][_0x11e9('0x14')]);}logger[_0x11e9('0x12')]('Team,\x20%s,\x20%s',_0x513e95,_0x5b1017['error'][_0x11e9('0x14')]);return _0x4b7555(_0x5b1017[_0x11e9('0x12')][_0x11e9('0x14')]);}else{logger[_0x11e9('0xd')](_0x11e9('0xe'),_0x513e95,_0x11e9('0xf'));_0x4b7555(_0x5b1017[_0x11e9('0x15')]['message']);}})['catch'](function(_0x433ec6){logger['error'](_0x11e9('0xe'),_0x513e95,_0x433ec6);_0x2115b2(_0x433ec6);});});} \ No newline at end of file +var _0xf2e2=['then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','Team,\x20%s,\x20%s','message','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xf2e2,0x1cb));var _0x2f2e=function(_0x201b6b,_0x5b8fba){_0x201b6b=_0x201b6b-0x0;var _0x516c5b=_0xf2e2[_0x201b6b];return _0x516c5b;};'use strict';var _=require(_0x2f2e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f2e('0x1'));var rs=require(_0x2f2e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2f2e('0x3'))(_0x2f2e('0x4'));var config=require(_0x2f2e('0x5'));var jayson=require(_0x2f2e('0x6'));var client=jayson[_0x2f2e('0x7')][_0x2f2e('0x8')]({'port':0x232a});config['redis']=_[_0x2f2e('0x9')](config[_0x2f2e('0xa')],{'host':_0x2f2e('0xb'),'port':0x18eb});var socket=require(_0x2f2e('0xc'))(new Redis(config[_0x2f2e('0xa')]));require(_0x2f2e('0xd'))[_0x2f2e('0xe')](socket);function respondWithRpcPromise(_0x3892f2,_0x393cc7,_0x45efb4){return new BPromise(function(_0x1d5fe5,_0x2fcc7d){return client[_0x2f2e('0xf')](_0x3892f2,_0x45efb4)[_0x2f2e('0x10')](function(_0x32ecc3){logger[_0x2f2e('0x11')]('Team,\x20%s,\x20%s',_0x393cc7,_0x2f2e('0x12'));logger[_0x2f2e('0x13')](_0x2f2e('0x14'),_0x393cc7,_0x2f2e('0x12'),JSON[_0x2f2e('0x15')](_0x32ecc3));if(_0x32ecc3[_0x2f2e('0x16')]){if(_0x32ecc3[_0x2f2e('0x16')]['code']===0x1f4){logger[_0x2f2e('0x16')](_0x2f2e('0x17'),_0x393cc7,_0x32ecc3[_0x2f2e('0x16')][_0x2f2e('0x18')]);return _0x2fcc7d(_0x32ecc3['error'][_0x2f2e('0x18')]);}logger[_0x2f2e('0x16')]('Team,\x20%s,\x20%s',_0x393cc7,_0x32ecc3[_0x2f2e('0x16')]['message']);return _0x1d5fe5(_0x32ecc3[_0x2f2e('0x16')][_0x2f2e('0x18')]);}else{logger[_0x2f2e('0x11')](_0x2f2e('0x17'),_0x393cc7,_0x2f2e('0x12'));_0x1d5fe5(_0x32ecc3['result'][_0x2f2e('0x18')]);}})['catch'](function(_0x13c6c2){logger[_0x2f2e('0x16')](_0x2f2e('0x17'),_0x393cc7,_0x13c6c2);_0x2fcc7d(_0x13c6c2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 29b3865..b2a3f0a 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 _0xd131=['team:','./team.events','save','remove','emit','removeListener','register','length'];(function(_0x25643d,_0x495039){var _0x36cfb6=function(_0x20dc0f){while(--_0x20dc0f){_0x25643d['push'](_0x25643d['shift']());}};_0x36cfb6(++_0x495039);}(_0xd131,0x191));var _0x1d13=function(_0xda3f86,_0x32c86c){_0xda3f86=_0xda3f86-0x0;var _0x1bcc40=_0xd131[_0xda3f86];return _0x1bcc40;};'use strict';var TeamEvents=require(_0x1d13('0x0'));var events=[_0x1d13('0x1'),_0x1d13('0x2'),'update'];function createListener(_0x7a22d5,_0x44643b){return function(_0x568504){_0x44643b[_0x1d13('0x3')](_0x7a22d5,_0x568504);};}function removeListener(_0x93506d,_0x1861f3){return function(){TeamEvents[_0x1d13('0x4')](_0x93506d,_0x1861f3);};}exports[_0x1d13('0x5')]=function(_0x314faf){for(var _0x30fa76=0x0,_0x5a7092=events[_0x1d13('0x6')];_0x30fa76<_0x5a7092;_0x30fa76++){var _0x3b3c7e=events[_0x30fa76];var _0x3029e8=createListener(_0x1d13('0x7')+_0x3b3c7e,_0x314faf);TeamEvents['on'](_0x3b3c7e,_0x3029e8);}}; \ No newline at end of file +var _0x20b4=['update','register','length','team:','./team.events','save','remove'];(function(_0x1d3d4b,_0x28dba1){var _0xbfb523=function(_0x2d3131){while(--_0x2d3131){_0x1d3d4b['push'](_0x1d3d4b['shift']());}};_0xbfb523(++_0x28dba1);}(_0x20b4,0x146));var _0x420b=function(_0x499ae7,_0x11541d){_0x499ae7=_0x499ae7-0x0;var _0xdfdd0f=_0x20b4[_0x499ae7];return _0xdfdd0f;};'use strict';var TeamEvents=require(_0x420b('0x0'));var events=[_0x420b('0x1'),_0x420b('0x2'),_0x420b('0x3')];function createListener(_0x4b27f5,_0x4427d0){return function(_0x27c87d){_0x4427d0['emit'](_0x4b27f5,_0x27c87d);};}function removeListener(_0x2f444e,_0x40162d){return function(){TeamEvents['removeListener'](_0x2f444e,_0x40162d);};}exports[_0x420b('0x4')]=function(_0x338bf6){for(var _0x30fe9c=0x0,_0x226510=events[_0x420b('0x5')];_0x30fe9c<_0x226510;_0x30fe9c++){var _0x2fe151=events[_0x30fe9c];var _0x5e7b0d=createListener(_0x420b('0x6')+_0x2fe151,_0x338bf6);TeamEvents['on'](_0x2fe151,_0x5e7b0d);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index c47be74..1f3c499 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xe51964,_0x433b90){var _0x2c2366=function(_0x1bc95c){while(--_0x1bc95c){_0xe51964['push'](_0xe51964['shift']());}};_0x2c2366(++_0x433b90);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x80540e,_0x19674c){var _0x43dc23=function(_0x48240d){while(--_0x48240d){_0x80540e['push'](_0x80540e['shift']());}};_0x43dc23(++_0x19674c);}(_0x70e0,0x17b));var _0x070e=function(_0x1565d6,_0x1c87ff){_0x1565d6=_0x1565d6-0x0;var _0x10db8f=_0x70e0[_0x1565d6];return _0x10db8f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9d417a4..69a2f3e 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 _0x9891=['INTEGER'];(function(_0x5e6cea,_0x24b02a){var _0x55a315=function(_0x395b80){while(--_0x395b80){_0x5e6cea['push'](_0x5e6cea['shift']());}};_0x55a315(++_0x24b02a);}(_0x9891,0x1ee));var _0x1989=function(_0x915de9,_0xabf9e5){_0x915de9=_0x915de9-0x0;var _0x274129=_0x9891[_0x915de9];return _0x274129;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x1989('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1f6a=['sequelize'];(function(_0x50c9ef,_0x3c41b9){var _0x15ae09=function(_0x465045){while(--_0x465045){_0x50c9ef['push'](_0x50c9ef['shift']());}};_0x15ae09(++_0x3c41b9);}(_0x1f6a,0xd7));var _0xa1f6=function(_0x58a9dd,_0x58d549){_0x58a9dd=_0x58a9dd-0x0;var _0x5a01ce=_0x1f6a[_0x58a9dd];return _0x5a01ce;};'use strict';var Sequelize=require(_0xa1f6('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 0ecb9cb..752df88 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 _0xf725=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf725,0x7e));var _0x5f72=function(_0x1f50de,_0xde3061){_0x1f50de=_0x1f50de-0x0;var _0x5941d0=_0xf725[_0x1f50de];return _0x5941d0;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var logger=require(_0x5f72('0x2'))(_0x5f72('0x3'));var moment=require(_0x5f72('0x4'));var BPromise=require(_0x5f72('0x5'));var rp=require(_0x5f72('0x6'));var fs=require('fs');var path=require(_0x5f72('0x7'));var rimraf=require(_0x5f72('0x8'));var config=require(_0x5f72('0x9'));var attributes=require('./teamVoiceQueue.attributes');module[_0x5f72('0xa')]=function(_0x14a92d,_0x3f2ca7){return _0x14a92d[_0x5f72('0xb')](_0x5f72('0xc'),attributes,{'tableName':_0x5f72('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ef=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util'];(function(_0x764d94,_0x15512b){var _0x43e9a3=function(_0x3641c2){while(--_0x3641c2){_0x764d94['push'](_0x764d94['shift']());}};_0x43e9a3(++_0x15512b);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x3f49ff,_0x5146b8){_0x3f49ff=_0x3f49ff-0x0;var _0x348838=_0xb2ef[_0x3f49ff];return _0x348838;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))('api');var moment=require(_0xfb2e('0x3'));var BPromise=require(_0xfb2e('0x4'));var rp=require(_0xfb2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb2e('0x6'));var config=require(_0xfb2e('0x7'));var attributes=require(_0xfb2e('0x8'));module[_0xfb2e('0x9')]=function(_0x3069a,_0x2a1c23){return _0x3069a[_0xfb2e('0xa')](_0xfb2e('0xb'),attributes,{'tableName':_0xfb2e('0xc'),'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 d0da4b6..b4b9cf3 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 _0xfa68=['../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x9148ba,_0x2cb1b5){var _0x355e3b=function(_0x134846){while(--_0x134846){_0x9148ba['push'](_0x9148ba['shift']());}};_0x355e3b(++_0x2cb1b5);}(_0xfa68,0x86));var _0x8fa6=function(_0x29970d,_0x273a87){_0x29970d=_0x29970d-0x0;var _0x2a018d=_0xfa68[_0x29970d];return _0x2a018d;};'use strict';var _=require(_0x8fa6('0x0'));var util=require(_0x8fa6('0x1'));var moment=require(_0x8fa6('0x2'));var BPromise=require('bluebird');var rs=require(_0x8fa6('0x3'));var fs=require('fs');var Redis=require(_0x8fa6('0x4'));var db=require(_0x8fa6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fa6('0x6'))(_0x8fa6('0x7'));var config=require(_0x8fa6('0x8'));var jayson=require(_0x8fa6('0x9'));var client=jayson[_0x8fa6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ab645,_0x42b044,_0x523f62){return new BPromise(function(_0x1cdf94,_0x269bda){return client['request'](_0x1ab645,_0x523f62)['then'](function(_0x1f3a90){logger[_0x8fa6('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x42b044,_0x8fa6('0xc'));logger[_0x8fa6('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x42b044,'request\x20sent',JSON[_0x8fa6('0xe')](_0x1f3a90));if(_0x1f3a90[_0x8fa6('0xf')]){if(_0x1f3a90['error'][_0x8fa6('0x10')]===0x1f4){logger[_0x8fa6('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x42b044,_0x1f3a90[_0x8fa6('0xf')][_0x8fa6('0x11')]);return _0x269bda(_0x1f3a90['error'][_0x8fa6('0x11')]);}logger[_0x8fa6('0xf')](_0x8fa6('0x12'),_0x42b044,_0x1f3a90[_0x8fa6('0xf')][_0x8fa6('0x11')]);return _0x1cdf94(_0x1f3a90['error']['message']);}else{logger[_0x8fa6('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x42b044,_0x8fa6('0xc'));_0x1cdf94(_0x1f3a90[_0x8fa6('0x13')][_0x8fa6('0x11')]);}})['catch'](function(_0x210bfe){logger[_0x8fa6('0xf')](_0x8fa6('0x12'),_0x42b044,_0x210bfe);_0x269bda(_0x210bfe);});});} \ No newline at end of file +var _0x6315=['../../config/environment','jayson/promise','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x6315,0x65));var _0x5631=function(_0x1e3b16,_0x248dd2){_0x1e3b16=_0x1e3b16-0x0;var _0x13a781=_0x6315[_0x1e3b16];return _0x13a781;};'use strict';var _=require('lodash');var util=require(_0x5631('0x0'));var moment=require(_0x5631('0x1'));var BPromise=require(_0x5631('0x2'));var rs=require(_0x5631('0x3'));var fs=require('fs');var Redis=require(_0x5631('0x4'));var db=require(_0x5631('0x5'))['db'];var utils=require(_0x5631('0x6'));var logger=require(_0x5631('0x7'))(_0x5631('0x8'));var config=require(_0x5631('0x9'));var jayson=require(_0x5631('0xa'));var client=jayson['client'][_0x5631('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56b458,_0x501f1e,_0xd54c88){return new BPromise(function(_0x27fac0,_0x1d5b4b){return client[_0x5631('0xc')](_0x56b458,_0xd54c88)[_0x5631('0xd')](function(_0x441002){logger['info'](_0x5631('0xe'),_0x501f1e,'request\x20sent');logger[_0x5631('0xf')](_0x5631('0x10'),_0x501f1e,_0x5631('0x11'),JSON[_0x5631('0x12')](_0x441002));if(_0x441002['error']){if(_0x441002[_0x5631('0x13')]['code']===0x1f4){logger['error'](_0x5631('0xe'),_0x501f1e,_0x441002[_0x5631('0x13')][_0x5631('0x14')]);return _0x1d5b4b(_0x441002[_0x5631('0x13')][_0x5631('0x14')]);}logger[_0x5631('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x501f1e,_0x441002[_0x5631('0x13')][_0x5631('0x14')]);return _0x27fac0(_0x441002[_0x5631('0x13')][_0x5631('0x14')]);}else{logger[_0x5631('0x15')](_0x5631('0xe'),_0x501f1e,_0x5631('0x11'));_0x27fac0(_0x441002['result'][_0x5631('0x14')]);}})['catch'](function(_0x623980){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x501f1e,_0x623980);_0x1d5b4b(_0x623980);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f4e34b9..f6a4654 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 _0x81b7=['/:id','destroy','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','index','show','post','isAuthenticated','create'];(function(_0x581f8e,_0x5617cb){var _0x18aec=function(_0x4536c7){while(--_0x4536c7){_0x581f8e['push'](_0x581f8e['shift']());}};_0x18aec(++_0x5617cb);}(_0x81b7,0x1f2));var _0x781b=function(_0x1d447c,_0x20237c){_0x1d447c=_0x1d447c-0x0;var _0x2b9940=_0x81b7[_0x1d447c];return _0x2b9940;};'use strict';var multer=require('multer');var util=require(_0x781b('0x0'));var path=require(_0x781b('0x1'));var timeout=require(_0x781b('0x2'));var express=require(_0x781b('0x3'));var router=express['Router']();var fs_extra=require(_0x781b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x781b('0x5'));var config=require(_0x781b('0x6'));var controller=require(_0x781b('0x7'));router[_0x781b('0x8')]('/',auth['isAuthenticated'](),controller[_0x781b('0x9')]);router[_0x781b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x781b('0xa')]);router[_0x781b('0xb')]('/',auth[_0x781b('0xc')](),controller[_0x781b('0xd')]);router['put'](_0x781b('0xe'),auth[_0x781b('0xc')](),controller['update']);router['delete'](_0x781b('0xe'),auth['isAuthenticated'](),controller[_0x781b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3c8e=['./template.controller','get','index','/:id','isAuthenticated','show','put','update','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x327766,_0x48e99a){var _0x30cf8b=function(_0x1f693e){while(--_0x1f693e){_0x327766['push'](_0x327766['shift']());}};_0x30cf8b(++_0x48e99a);}(_0x3c8e,0x89));var _0xe3c8=function(_0x5e34ab,_0x3af553){_0x5e34ab=_0x5e34ab-0x0;var _0x25bf6b=_0x3c8e[_0x5e34ab];return _0x25bf6b;};'use strict';var multer=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3c8('0x2'));var router=express[_0xe3c8('0x3')]();var fs_extra=require(_0xe3c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe3c8('0x5'));var config=require(_0xe3c8('0x6'));var controller=require(_0xe3c8('0x7'));router[_0xe3c8('0x8')]('/',auth['isAuthenticated'](),controller[_0xe3c8('0x9')]);router[_0xe3c8('0x8')](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xc')]);router['post']('/',auth[_0xe3c8('0xb')](),controller['create']);router[_0xe3c8('0xd')](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xe')]);router['delete'](_0xe3c8('0xa'),auth[_0xe3c8('0xb')](),controller[_0xe3c8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index bba5318..182ea0d 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 _0x005b=['STRING','sequelize','exports'];(function(_0x324152,_0x5597e5){var _0x5cd2e4=function(_0x1023e6){while(--_0x1023e6){_0x324152['push'](_0x324152['shift']());}};_0x5cd2e4(++_0x5597e5);}(_0x005b,0xac));var _0xb005=function(_0x2b2c80,_0x47492a){_0x2b2c80=_0x2b2c80-0x0;var _0x3e6535=_0x005b[_0x2b2c80];return _0x3e6535;};'use strict';var Sequelize=require(_0xb005('0x0'));module[_0xb005('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb005('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2433=['sequelize','exports','STRING','TEXT'];(function(_0x4f75b5,_0x4db76d){var _0x5c263b=function(_0x31e622){while(--_0x31e622){_0x4f75b5['push'](_0x4f75b5['shift']());}};_0x5c263b(++_0x4db76d);}(_0x2433,0xf4));var _0x3243=function(_0x22c826,_0x34b056){_0x22c826=_0x22c826-0x0;var _0x5cd35a=_0x2433[_0x22c826];return _0x5cd35a;};'use strict';var Sequelize=require(_0x3243('0x0'));module[_0x3243('0x1')]={'name':{'type':Sequelize[_0x3243('0x2')]},'description':{'type':Sequelize[_0x3243('0x2')]},'html':{'type':Sequelize[_0x3243('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 39560b6..600fdba 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 _0x5690=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Templates','error','stack','name','send','index','map','Template','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x5690,0x102));var _0x0569=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x5690[_0x1fd675];return _0x16b554;};'use strict';var emlformat=require(_0x0569('0x0'));var rimraf=require(_0x0569('0x1'));var zipdir=require(_0x0569('0x2'));var jsonpatch=require(_0x0569('0x3'));var rp=require(_0x0569('0x4'));var moment=require('moment');var BPromise=require(_0x0569('0x5'));var Mustache=require(_0x0569('0x6'));var util=require(_0x0569('0x7'));var path=require('path');var sox=require(_0x0569('0x8'));var csv=require(_0x0569('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0569('0xa'));var squel=require(_0x0569('0xb'));var crypto=require(_0x0569('0xc'));var jsforce=require(_0x0569('0xd'));var deskjs=require(_0x0569('0xe'));var toCsv=require(_0x0569('0x9'));var querystring=require(_0x0569('0xf'));var Papa=require(_0x0569('0x10'));var Redis=require(_0x0569('0x11'));var authService=require(_0x0569('0x12'));var qs=require(_0x0569('0x13'));var as=require(_0x0569('0x14'));var hardwareService=require(_0x0569('0x15'));var logger=require(_0x0569('0x16'))(_0x0569('0x17'));var utils=require(_0x0569('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0569('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d586a,_0x2721b0){_0x2721b0=_0x2721b0||0xcc;return function(_0x485a3b){if(_0x485a3b){return _0x4d586a[_0x0569('0x1a')](_0x2721b0);}return _0x4d586a['status'](_0x2721b0)[_0x0569('0x1b')]();};}function respondWithResult(_0x45876d,_0x242730){_0x242730=_0x242730||0xc8;return function(_0x165db0){if(_0x165db0){return _0x45876d[_0x0569('0x1c')](_0x242730)['json'](_0x165db0);}};}function respondWithFilteredResult(_0x2a30ae,_0x5ef4ef){return function(_0x4922df){if(_0x4922df){var _0x3b8f7e=typeof _0x5ef4ef[_0x0569('0x1d')]===_0x0569('0x1e')&&typeof _0x5ef4ef['limit']===_0x0569('0x1e');var _0x176094=_0x4922df[_0x0569('0x1f')];var _0x2707ab=_0x3b8f7e?0x0:_0x5ef4ef[_0x0569('0x1d')];var _0x12cf44=_0x3b8f7e?_0x4922df[_0x0569('0x1f')]:_0x5ef4ef['offset']+_0x5ef4ef[_0x0569('0x20')];var _0x453071;if(_0x12cf44>=_0x176094){_0x12cf44=_0x176094;_0x453071=0xc8;}else{_0x453071=0xce;}_0x2a30ae[_0x0569('0x1c')](_0x453071);return _0x2a30ae[_0x0569('0x21')](_0x0569('0x22'),_0x2707ab+'-'+_0x12cf44+'/'+_0x176094)[_0x0569('0x23')](_0x4922df);}return null;};}function patchUpdates(_0x277a82){return function(_0x152e76){try{jsonpatch[_0x0569('0x24')](_0x152e76,_0x277a82,!![]);}catch(_0x42938c){return BPromise[_0x0569('0x25')](_0x42938c);}return _0x152e76[_0x0569('0x26')]();};}function saveUpdates(_0x412c1a,_0x2a5d21){return function(_0x4a38e6){if(_0x4a38e6){return _0x4a38e6['update'](_0x412c1a)[_0x0569('0x27')](function(_0x3df378){return _0x3df378;});}return null;};}function removeEntity(_0x53eabd,_0x528b76){return function(_0x51bd5a){if(_0x51bd5a){return _0x51bd5a[_0x0569('0x28')]()[_0x0569('0x27')](function(){var _0x3982c7=_0x51bd5a[_0x0569('0x29')]({'plain':!![]});var _0x1c7ea3=_0x0569('0x2a');return db['UserProfileResource'][_0x0569('0x28')]({'where':{'type':_0x1c7ea3,'resourceId':_0x3982c7['id']}})['then'](function(){return _0x51bd5a;});})[_0x0569('0x27')](function(){_0x53eabd['status'](0xcc)[_0x0569('0x1b')]();});}};}function handleEntityNotFound(_0x28a296,_0x5e41fa){return function(_0x55cd27){if(!_0x55cd27){_0x28a296[_0x0569('0x1a')](0x194);}return _0x55cd27;};}function handleError(_0x1b23bd,_0x1c2452){_0x1c2452=_0x1c2452||0x1f4;return function(_0x5a36e4){logger[_0x0569('0x2b')](_0x5a36e4[_0x0569('0x2c')]);if(_0x5a36e4[_0x0569('0x2d')]){delete _0x5a36e4[_0x0569('0x2d')];}_0x1b23bd[_0x0569('0x1c')](_0x1c2452)[_0x0569('0x2e')](_0x5a36e4);};}exports[_0x0569('0x2f')]=function(_0xdf40bd,_0x250333){var _0x44c95c={},_0x4b8e69={},_0x29c760={'count':0x0,'rows':[]};var _0x3c6a9c=_[_0x0569('0x30')](db[_0x0569('0x31')][_0x0569('0x32')],function(_0x2db004){return{'name':_0x2db004['fieldName'],'type':_0x2db004['type']['key']};});_0x4b8e69[_0x0569('0x33')]=_['map'](_0x3c6a9c,_0x0569('0x2d'));_0x4b8e69['query']=_['keys'](_0xdf40bd[_0x0569('0x34')]);_0x4b8e69[_0x0569('0x35')]=_['intersection'](_0x4b8e69['model'],_0x4b8e69[_0x0569('0x34')]);_0x44c95c[_0x0569('0x36')]=_[_0x0569('0x37')](_0x4b8e69[_0x0569('0x33')],qs[_0x0569('0x38')](_0xdf40bd['query']['fields']));_0x44c95c[_0x0569('0x36')]=_0x44c95c[_0x0569('0x36')][_0x0569('0x39')]?_0x44c95c[_0x0569('0x36')]:_0x4b8e69['model'];if(!_0xdf40bd[_0x0569('0x34')][_0x0569('0x3a')]('nolimit')){_0x44c95c[_0x0569('0x20')]=qs['limit'](_0xdf40bd[_0x0569('0x34')][_0x0569('0x20')]);_0x44c95c[_0x0569('0x1d')]=qs['offset'](_0xdf40bd[_0x0569('0x34')]['offset']);}_0x44c95c[_0x0569('0x3b')]=qs[_0x0569('0x3c')](_0xdf40bd[_0x0569('0x34')]['sort']);_0x44c95c[_0x0569('0x3d')]=qs[_0x0569('0x35')](_[_0x0569('0x3e')](_0xdf40bd[_0x0569('0x34')],_0x4b8e69['filters']),_0x3c6a9c);if(_0xdf40bd[_0x0569('0x34')][_0x0569('0x3f')]){_0x44c95c['where']=_[_0x0569('0x40')](_0x44c95c[_0x0569('0x3d')],{'$or':_[_0x0569('0x30')](_0x3c6a9c,function(_0x411feb){if(_0x411feb[_0x0569('0x41')]!==_0x0569('0x42')){var _0x41f6e5={};_0x41f6e5[_0x411feb[_0x0569('0x2d')]]={'$like':'%'+_0xdf40bd[_0x0569('0x34')][_0x0569('0x3f')]+'%'};return _0x41f6e5;}})});}_0x44c95c=_[_0x0569('0x40')]({},_0x44c95c,_0xdf40bd[_0x0569('0x43')]);var _0x2acf9b={'where':_0x44c95c['where']};return db[_0x0569('0x31')]['count'](_0x2acf9b)[_0x0569('0x27')](function(_0x4a9b82){_0x29c760[_0x0569('0x1f')]=_0x4a9b82;if(_0xdf40bd[_0x0569('0x34')][_0x0569('0x44')]){_0x44c95c[_0x0569('0x45')]=[{'all':!![]}];}return db[_0x0569('0x31')][_0x0569('0x46')](_0x44c95c);})[_0x0569('0x27')](function(_0x11f401){_0x29c760[_0x0569('0x47')]=_0x11f401;return _0x29c760;})[_0x0569('0x27')](respondWithFilteredResult(_0x250333,_0x44c95c))[_0x0569('0x48')](handleError(_0x250333,null));};exports[_0x0569('0x49')]=function(_0x4879dc,_0x1c3818){var _0x37a6c7={'raw':!![],'where':{'id':_0x4879dc[_0x0569('0x4a')]['id']}},_0x246257={};_0x246257[_0x0569('0x33')]=_['keys'](db[_0x0569('0x31')]['rawAttributes']);_0x246257[_0x0569('0x34')]=_[_0x0569('0x4b')](_0x4879dc[_0x0569('0x34')]);_0x246257['filters']=_['intersection'](_0x246257['model'],_0x246257['query']);_0x37a6c7[_0x0569('0x36')]=_[_0x0569('0x37')](_0x246257[_0x0569('0x33')],qs['fields'](_0x4879dc['query']['fields']));_0x37a6c7[_0x0569('0x36')]=_0x37a6c7[_0x0569('0x36')][_0x0569('0x39')]?_0x37a6c7['attributes']:_0x246257[_0x0569('0x33')];if(_0x4879dc[_0x0569('0x34')][_0x0569('0x44')]){_0x37a6c7['include']=[{'all':!![]}];}_0x37a6c7=_[_0x0569('0x40')]({},_0x37a6c7,_0x4879dc[_0x0569('0x43')]);return db[_0x0569('0x31')][_0x0569('0x4c')](_0x37a6c7)[_0x0569('0x27')](handleEntityNotFound(_0x1c3818,null))[_0x0569('0x27')](respondWithResult(_0x1c3818,null))[_0x0569('0x48')](handleError(_0x1c3818,null));};exports[_0x0569('0x4d')]=function(_0x1fc55e,_0x5c8bed){return db[_0x0569('0x31')][_0x0569('0x4d')](_0x1fc55e[_0x0569('0x4e')],{})[_0x0569('0x27')](function(_0x509c12){var _0x546404=_0x1fc55e[_0x0569('0x4f')]['get']({'plain':!![]});if(!_0x546404)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x546404[_0x0569('0x50')]===_0x0569('0x4f')){var _0x2e3c60=_0x509c12['get']({'plain':!![]});var _0x30a2ef='Templates';return db[_0x0569('0x51')][_0x0569('0x4c')]({'where':{'name':_0x30a2ef,'userProfileId':_0x546404['userProfileId']},'raw':!![]})[_0x0569('0x27')](function(_0x145a60){if(_0x145a60&&_0x145a60[_0x0569('0x52')]===0x0){return db[_0x0569('0x53')][_0x0569('0x4d')]({'name':_0x2e3c60[_0x0569('0x2d')],'resourceId':_0x2e3c60['id'],'type':_0x145a60[_0x0569('0x2d')],'sectionId':_0x145a60['id']},{})[_0x0569('0x27')](function(){return _0x509c12;});}else{return _0x509c12;}})[_0x0569('0x48')](function(_0x1e1abf){logger[_0x0569('0x2b')](_0x0569('0x54'),_0x1e1abf);throw _0x1e1abf;});}return _0x509c12;})[_0x0569('0x27')](respondWithResult(_0x5c8bed,0xc9))['catch'](handleError(_0x5c8bed,null));};exports[_0x0569('0x55')]=function(_0xbc8bba,_0xb51009){if(_0xbc8bba[_0x0569('0x4e')]['id']){delete _0xbc8bba[_0x0569('0x4e')]['id'];}return db[_0x0569('0x31')]['find']({'where':{'id':_0xbc8bba[_0x0569('0x4a')]['id']}})[_0x0569('0x27')](handleEntityNotFound(_0xb51009,null))[_0x0569('0x27')](saveUpdates(_0xbc8bba[_0x0569('0x4e')],null))[_0x0569('0x27')](respondWithResult(_0xb51009,null))[_0x0569('0x48')](handleError(_0xb51009,null));};exports['destroy']=function(_0x2d31a4,_0x56b31a){return db['Template']['find']({'where':{'id':_0x2d31a4[_0x0569('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56b31a,null))[_0x0569('0x27')](removeEntity(_0x56b31a,null))[_0x0569('0x48')](handleError(_0x56b31a,null));}; \ No newline at end of file +var _0x672d=['merge','type','VIRTUAL','options','Template','includeAll','rows','catch','keys','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x672d,0xc0));var _0xd672=function(_0x281ad3,_0x1602e0){_0x281ad3=_0x281ad3-0x0;var _0x30a754=_0x672d[_0x281ad3];return _0x30a754;};'use strict';var emlformat=require(_0xd672('0x0'));var rimraf=require(_0xd672('0x1'));var zipdir=require(_0xd672('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd672('0x3'));var moment=require(_0xd672('0x4'));var BPromise=require(_0xd672('0x5'));var Mustache=require(_0xd672('0x6'));var util=require(_0xd672('0x7'));var path=require(_0xd672('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd672('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd672('0xa'));var squel=require('squel');var crypto=require(_0xd672('0xb'));var jsforce=require(_0xd672('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd672('0xd'));var querystring=require(_0xd672('0xe'));var Papa=require(_0xd672('0xf'));var Redis=require(_0xd672('0x10'));var authService=require(_0xd672('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd672('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd672('0x13'))(_0xd672('0x14'));var utils=require(_0xd672('0x15'));var config=require(_0xd672('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd672('0x17'))['db'];function respondWithStatusCode(_0x3803ac,_0x376528){_0x376528=_0x376528||0xcc;return function(_0x35741e){if(_0x35741e){return _0x3803ac[_0xd672('0x18')](_0x376528);}return _0x3803ac[_0xd672('0x19')](_0x376528)[_0xd672('0x1a')]();};}function respondWithResult(_0x4a8066,_0x23482f){_0x23482f=_0x23482f||0xc8;return function(_0x453945){if(_0x453945){return _0x4a8066[_0xd672('0x19')](_0x23482f)[_0xd672('0x1b')](_0x453945);}};}function respondWithFilteredResult(_0x1dee83,_0x4fdd87){return function(_0x4ece71){if(_0x4ece71){var _0x28cc2d=typeof _0x4fdd87[_0xd672('0x1c')]===_0xd672('0x1d')&&typeof _0x4fdd87['limit']===_0xd672('0x1d');var _0x10202b=_0x4ece71[_0xd672('0x1e')];var _0x42a789=_0x28cc2d?0x0:_0x4fdd87[_0xd672('0x1c')];var _0x25e679=_0x28cc2d?_0x4ece71['count']:_0x4fdd87['offset']+_0x4fdd87['limit'];var _0x9a8b70;if(_0x25e679>=_0x10202b){_0x25e679=_0x10202b;_0x9a8b70=0xc8;}else{_0x9a8b70=0xce;}_0x1dee83[_0xd672('0x19')](_0x9a8b70);return _0x1dee83[_0xd672('0x1f')](_0xd672('0x20'),_0x42a789+'-'+_0x25e679+'/'+_0x10202b)[_0xd672('0x1b')](_0x4ece71);}return null;};}function patchUpdates(_0x2bc028){return function(_0x326b90){try{jsonpatch[_0xd672('0x21')](_0x326b90,_0x2bc028,!![]);}catch(_0x41f0b4){return BPromise[_0xd672('0x22')](_0x41f0b4);}return _0x326b90[_0xd672('0x23')]();};}function saveUpdates(_0x23d2e4,_0x5487e9){return function(_0x516826){if(_0x516826){return _0x516826[_0xd672('0x24')](_0x23d2e4)['then'](function(_0x294465){return _0x294465;});}return null;};}function removeEntity(_0xe0abf5,_0x16b0ef){return function(_0x30c4b0){if(_0x30c4b0){return _0x30c4b0[_0xd672('0x25')]()[_0xd672('0x26')](function(){var _0x3cde94=_0x30c4b0[_0xd672('0x27')]({'plain':!![]});var _0x4cbf1f=_0xd672('0x28');return db[_0xd672('0x29')][_0xd672('0x25')]({'where':{'type':_0x4cbf1f,'resourceId':_0x3cde94['id']}})[_0xd672('0x26')](function(){return _0x30c4b0;});})['then'](function(){_0xe0abf5[_0xd672('0x19')](0xcc)[_0xd672('0x1a')]();});}};}function handleEntityNotFound(_0x319869,_0x2d72f5){return function(_0x789699){if(!_0x789699){_0x319869['sendStatus'](0x194);}return _0x789699;};}function handleError(_0x21dece,_0x403b14){_0x403b14=_0x403b14||0x1f4;return function(_0x373ace){logger[_0xd672('0x2a')](_0x373ace[_0xd672('0x2b')]);if(_0x373ace[_0xd672('0x2c')]){delete _0x373ace['name'];}_0x21dece['status'](_0x403b14)[_0xd672('0x2d')](_0x373ace);};}exports[_0xd672('0x2e')]=function(_0x43cbcb,_0x57fa80){var _0x1f9f2a={},_0x1c0474={},_0x5a7da2={'count':0x0,'rows':[]};var _0x256126=_[_0xd672('0x2f')](db['Template'][_0xd672('0x30')],function(_0x23249c){return{'name':_0x23249c[_0xd672('0x31')],'type':_0x23249c['type'][_0xd672('0x32')]};});_0x1c0474[_0xd672('0x33')]=_[_0xd672('0x2f')](_0x256126,'name');_0x1c0474['query']=_['keys'](_0x43cbcb['query']);_0x1c0474[_0xd672('0x34')]=_[_0xd672('0x35')](_0x1c0474[_0xd672('0x33')],_0x1c0474[_0xd672('0x36')]);_0x1f9f2a[_0xd672('0x37')]=_[_0xd672('0x35')](_0x1c0474['model'],qs[_0xd672('0x38')](_0x43cbcb[_0xd672('0x36')][_0xd672('0x38')]));_0x1f9f2a[_0xd672('0x37')]=_0x1f9f2a[_0xd672('0x37')][_0xd672('0x39')]?_0x1f9f2a['attributes']:_0x1c0474[_0xd672('0x33')];if(!_0x43cbcb[_0xd672('0x36')][_0xd672('0x3a')](_0xd672('0x3b'))){_0x1f9f2a[_0xd672('0x3c')]=qs[_0xd672('0x3c')](_0x43cbcb[_0xd672('0x36')][_0xd672('0x3c')]);_0x1f9f2a[_0xd672('0x1c')]=qs[_0xd672('0x1c')](_0x43cbcb[_0xd672('0x36')][_0xd672('0x1c')]);}_0x1f9f2a[_0xd672('0x3d')]=qs[_0xd672('0x3e')](_0x43cbcb[_0xd672('0x36')][_0xd672('0x3e')]);_0x1f9f2a[_0xd672('0x3f')]=qs[_0xd672('0x34')](_[_0xd672('0x40')](_0x43cbcb[_0xd672('0x36')],_0x1c0474[_0xd672('0x34')]),_0x256126);if(_0x43cbcb[_0xd672('0x36')][_0xd672('0x41')]){_0x1f9f2a[_0xd672('0x3f')]=_[_0xd672('0x42')](_0x1f9f2a[_0xd672('0x3f')],{'$or':_[_0xd672('0x2f')](_0x256126,function(_0x74821c){if(_0x74821c[_0xd672('0x43')]!==_0xd672('0x44')){var _0x1bc916={};_0x1bc916[_0x74821c['name']]={'$like':'%'+_0x43cbcb[_0xd672('0x36')][_0xd672('0x41')]+'%'};return _0x1bc916;}})});}_0x1f9f2a=_[_0xd672('0x42')]({},_0x1f9f2a,_0x43cbcb[_0xd672('0x45')]);var _0x4d2992={'where':_0x1f9f2a[_0xd672('0x3f')]};return db[_0xd672('0x46')]['count'](_0x4d2992)[_0xd672('0x26')](function(_0x513487){_0x5a7da2[_0xd672('0x1e')]=_0x513487;if(_0x43cbcb[_0xd672('0x36')][_0xd672('0x47')]){_0x1f9f2a['include']=[{'all':!![]}];}return db[_0xd672('0x46')]['findAll'](_0x1f9f2a);})['then'](function(_0x381c3f){_0x5a7da2[_0xd672('0x48')]=_0x381c3f;return _0x5a7da2;})[_0xd672('0x26')](respondWithFilteredResult(_0x57fa80,_0x1f9f2a))[_0xd672('0x49')](handleError(_0x57fa80,null));};exports['show']=function(_0x40df58,_0x413b26){var _0x51a99a={'raw':!![],'where':{'id':_0x40df58['params']['id']}},_0x59b9c6={};_0x59b9c6[_0xd672('0x33')]=_[_0xd672('0x4a')](db[_0xd672('0x46')][_0xd672('0x30')]);_0x59b9c6['query']=_[_0xd672('0x4a')](_0x40df58[_0xd672('0x36')]);_0x59b9c6[_0xd672('0x34')]=_[_0xd672('0x35')](_0x59b9c6[_0xd672('0x33')],_0x59b9c6[_0xd672('0x36')]);_0x51a99a[_0xd672('0x37')]=_[_0xd672('0x35')](_0x59b9c6[_0xd672('0x33')],qs[_0xd672('0x38')](_0x40df58[_0xd672('0x36')][_0xd672('0x38')]));_0x51a99a[_0xd672('0x37')]=_0x51a99a[_0xd672('0x37')][_0xd672('0x39')]?_0x51a99a[_0xd672('0x37')]:_0x59b9c6['model'];if(_0x40df58[_0xd672('0x36')][_0xd672('0x47')]){_0x51a99a[_0xd672('0x4b')]=[{'all':!![]}];}_0x51a99a=_['merge']({},_0x51a99a,_0x40df58[_0xd672('0x45')]);return db[_0xd672('0x46')][_0xd672('0x4c')](_0x51a99a)[_0xd672('0x26')](handleEntityNotFound(_0x413b26,null))[_0xd672('0x26')](respondWithResult(_0x413b26,null))['catch'](handleError(_0x413b26,null));};exports[_0xd672('0x4d')]=function(_0x44f370,_0x4f0ca9){return db[_0xd672('0x46')]['create'](_0x44f370['body'],{})[_0xd672('0x26')](function(_0x15f327){var _0x422510=_0x44f370['user'][_0xd672('0x27')]({'plain':!![]});if(!_0x422510)throw new Error(_0xd672('0x4e'));if(_0x422510[_0xd672('0x4f')]===_0xd672('0x50')){var _0x164c22=_0x15f327[_0xd672('0x27')]({'plain':!![]});var _0x2f60dd=_0xd672('0x28');return db['UserProfileSection'][_0xd672('0x4c')]({'where':{'name':_0x2f60dd,'userProfileId':_0x422510[_0xd672('0x51')]},'raw':!![]})[_0xd672('0x26')](function(_0x266169){if(_0x266169&&_0x266169[_0xd672('0x52')]===0x0){return db[_0xd672('0x29')][_0xd672('0x4d')]({'name':_0x164c22[_0xd672('0x2c')],'resourceId':_0x164c22['id'],'type':_0x266169[_0xd672('0x2c')],'sectionId':_0x266169['id']},{})['then'](function(){return _0x15f327;});}else{return _0x15f327;}})[_0xd672('0x49')](function(_0x50688d){logger[_0xd672('0x2a')](_0xd672('0x53'),_0x50688d);throw _0x50688d;});}return _0x15f327;})[_0xd672('0x26')](respondWithResult(_0x4f0ca9,0xc9))[_0xd672('0x49')](handleError(_0x4f0ca9,null));};exports[_0xd672('0x24')]=function(_0x49e694,_0x3011dd){if(_0x49e694['body']['id']){delete _0x49e694[_0xd672('0x54')]['id'];}return db['Template'][_0xd672('0x4c')]({'where':{'id':_0x49e694[_0xd672('0x55')]['id']}})[_0xd672('0x26')](handleEntityNotFound(_0x3011dd,null))[_0xd672('0x26')](saveUpdates(_0x49e694[_0xd672('0x54')],null))[_0xd672('0x26')](respondWithResult(_0x3011dd,null))[_0xd672('0x49')](handleError(_0x3011dd,null));};exports[_0xd672('0x25')]=function(_0x14ab02,_0x149469){return db[_0xd672('0x46')][_0xd672('0x4c')]({'where':{'id':_0x14ab02[_0xd672('0x55')]['id']}})['then'](handleEntityNotFound(_0x149469,null))[_0xd672('0x26')](removeEntity(_0x149469,null))[_0xd672('0x49')](handleError(_0x149469,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7b4f0c3..226e2f3 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 _0x9d3f=['Template','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./template.attributes','exports','define'];(function(_0x5b0969,_0x33beb1){var _0x5b92a0=function(_0xef1de7){while(--_0xef1de7){_0x5b0969['push'](_0x5b0969['shift']());}};_0x5b92a0(++_0x33beb1);}(_0x9d3f,0x151));var _0xf9d3=function(_0x1b2a2b,_0xd6a0fb){_0x1b2a2b=_0x1b2a2b-0x0;var _0x1fc19b=_0x9d3f[_0x1b2a2b];return _0x1fc19b;};'use strict';var _=require(_0xf9d3('0x0'));var util=require(_0xf9d3('0x1'));var logger=require(_0xf9d3('0x2'))(_0xf9d3('0x3'));var moment=require(_0xf9d3('0x4'));var BPromise=require(_0xf9d3('0x5'));var rp=require(_0xf9d3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9d3('0x7'));var config=require('../../config/environment');var attributes=require(_0xf9d3('0x8'));module[_0xf9d3('0x9')]=function(_0x53a37b,_0x40dd7d){return _0x53a37b[_0xf9d3('0xa')](_0xf9d3('0xb'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef2e=['request-promise','rimraf','../../config/environment','exports','define','tools_templates','util','../../config/logger','api','moment','bluebird'];(function(_0x52325d,_0x422089){var _0x5325c4=function(_0x4c1c3d){while(--_0x4c1c3d){_0x52325d['push'](_0x52325d['shift']());}};_0x5325c4(++_0x422089);}(_0xef2e,0x74));var _0xeef2=function(_0x25d4e5,_0x30b67f){_0x25d4e5=_0x25d4e5-0x0;var _0x44d116=_0xef2e[_0x25d4e5];return _0x44d116;};'use strict';var _=require('lodash');var util=require(_0xeef2('0x0'));var logger=require(_0xeef2('0x1'))(_0xeef2('0x2'));var moment=require(_0xeef2('0x3'));var BPromise=require(_0xeef2('0x4'));var rp=require(_0xeef2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeef2('0x6'));var config=require(_0xeef2('0x7'));var attributes=require('./template.attributes');module[_0xeef2('0x8')]=function(_0x2e482d,_0x20a827){return _0x2e482d[_0xeef2('0x9')]('Template',attributes,{'tableName':_0xeef2('0xa'),'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 0c74a81..776d723 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 _0xc97e=['then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','raw','options','where','attributes','limit','include','map','model','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0xc97e,0x148));var _0xec97=function(_0x2d0d28,_0x3bb917){_0x2d0d28=_0x2d0d28-0x0;var _0x22c9eb=_0xc97e[_0x2d0d28];return _0x22c9eb;};'use strict';var _=require(_0xec97('0x0'));var util=require('util');var moment=require(_0xec97('0x1'));var BPromise=require(_0xec97('0x2'));var rs=require(_0xec97('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec97('0x4'))['db'];var utils=require(_0xec97('0x5'));var logger=require(_0xec97('0x6'))('rpc');var config=require(_0xec97('0x7'));var jayson=require(_0xec97('0x8'));var client=jayson[_0xec97('0x9')][_0xec97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a66f8,_0x4d8e00,_0x342dcc){return new BPromise(function(_0x4a1e5b,_0xaf6352){return client[_0xec97('0xb')](_0x2a66f8,_0x342dcc)[_0xec97('0xc')](function(_0x1c6216){logger['info'](_0xec97('0xd'),_0x4d8e00,_0xec97('0xe'));logger['debug'](_0xec97('0xf'),_0x4d8e00,'request\x20sent',JSON[_0xec97('0x10')](_0x1c6216));if(_0x1c6216[_0xec97('0x11')]){if(_0x1c6216[_0xec97('0x11')][_0xec97('0x12')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x4d8e00,_0x1c6216['error'][_0xec97('0x13')]);return _0xaf6352(_0x1c6216[_0xec97('0x11')][_0xec97('0x13')]);}logger['error'](_0xec97('0xd'),_0x4d8e00,_0x1c6216[_0xec97('0x11')][_0xec97('0x13')]);return _0x4a1e5b(_0x1c6216[_0xec97('0x11')]['message']);}else{logger['info'](_0xec97('0xd'),_0x4d8e00,_0xec97('0xe'));_0x4a1e5b(_0x1c6216[_0xec97('0x14')][_0xec97('0x13')]);}})[_0xec97('0x15')](function(_0x3708dc){logger[_0xec97('0x11')](_0xec97('0xd'),_0x4d8e00,_0x3708dc);_0xaf6352(_0x3708dc);});});}exports[_0xec97('0x16')]=function(_0x44ed00){var _0x4aabdd=this;return new Promise(function(_0x1c2f7c,_0x56988e){return db[_0xec97('0x17')][_0xec97('0x18')]({'raw':_0x44ed00['options']?_0x44ed00['options'][_0xec97('0x19')]===undefined?!![]:![]:!![],'where':_0x44ed00[_0xec97('0x1a')]?_0x44ed00[_0xec97('0x1a')][_0xec97('0x1b')]||null:null,'attributes':_0x44ed00[_0xec97('0x1a')]?_0x44ed00[_0xec97('0x1a')][_0xec97('0x1c')]||null:null,'limit':_0x44ed00[_0xec97('0x1a')]?_0x44ed00['options'][_0xec97('0x1d')]||null:null,'include':_0x44ed00['options']?_0x44ed00[_0xec97('0x1a')][_0xec97('0x1e')]?_[_0xec97('0x1f')](_0x44ed00[_0xec97('0x1a')][_0xec97('0x1e')],function(_0x253c46){return{'model':db[_0x253c46[_0xec97('0x20')]],'as':_0x253c46['as'],'attributes':_0x253c46[_0xec97('0x1c')],'include':_0x253c46[_0xec97('0x1e')]?_[_0xec97('0x1f')](_0x253c46[_0xec97('0x1e')],function(_0x2bdd00){return{'model':db[_0x2bdd00[_0xec97('0x20')]],'as':_0x2bdd00['as'],'attributes':_0x2bdd00[_0xec97('0x1c')],'include':_0x2bdd00[_0xec97('0x1e')]?_[_0xec97('0x1f')](_0x2bdd00[_0xec97('0x1e')],function(_0x3ca1fb){return{'model':db[_0x3ca1fb[_0xec97('0x20')]],'as':_0x3ca1fb['as'],'attributes':_0x3ca1fb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x439080){logger['info'](_0xec97('0x16'),_0x44ed00);logger[_0xec97('0x21')]('GetTemplate',_0x44ed00,JSON['stringify'](_0x439080));_0x1c2f7c(_0x439080);})['catch'](function(_0x1c10e0){logger[_0xec97('0x11')](_0xec97('0x16'),_0x1c10e0[_0xec97('0x13')],_0x44ed00);_0x56988e(_0x4aabdd['error'](0x1f4,_0x1c10e0['message']));});});}; \ No newline at end of file +var _0x101a=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a29f5,_0x2fc3e6){var _0x50d2d6=function(_0x500516){while(--_0x500516){_0x4a29f5['push'](_0x4a29f5['shift']());}};_0x50d2d6(++_0x2fc3e6);}(_0x101a,0x9e));var _0xa101=function(_0x269334,_0x3fde5b){_0x269334=_0x269334-0x0;var _0x12f7d4=_0x101a[_0x269334];return _0x12f7d4;};'use strict';var _=require('lodash');var util=require(_0xa101('0x0'));var moment=require(_0xa101('0x1'));var BPromise=require('bluebird');var rs=require(_0xa101('0x2'));var fs=require('fs');var Redis=require(_0xa101('0x3'));var db=require(_0xa101('0x4'))['db'];var utils=require(_0xa101('0x5'));var logger=require(_0xa101('0x6'))(_0xa101('0x7'));var config=require(_0xa101('0x8'));var jayson=require(_0xa101('0x9'));var client=jayson[_0xa101('0xa')][_0xa101('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b4c2c,_0x2226cf,_0xe728d6){return new BPromise(function(_0x52beb4,_0x15127e){return client[_0xa101('0xc')](_0x2b4c2c,_0xe728d6)['then'](function(_0x1cc717){logger[_0xa101('0xd')]('Template,\x20%s,\x20%s',_0x2226cf,_0xa101('0xe'));logger[_0xa101('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x2226cf,_0xa101('0xe'),JSON[_0xa101('0x10')](_0x1cc717));if(_0x1cc717[_0xa101('0x11')]){if(_0x1cc717[_0xa101('0x11')][_0xa101('0x12')]===0x1f4){logger[_0xa101('0x11')](_0xa101('0x13'),_0x2226cf,_0x1cc717['error'][_0xa101('0x14')]);return _0x15127e(_0x1cc717[_0xa101('0x11')][_0xa101('0x14')]);}logger[_0xa101('0x11')](_0xa101('0x13'),_0x2226cf,_0x1cc717[_0xa101('0x11')]['message']);return _0x52beb4(_0x1cc717[_0xa101('0x11')][_0xa101('0x14')]);}else{logger[_0xa101('0xd')](_0xa101('0x13'),_0x2226cf,_0xa101('0xe'));_0x52beb4(_0x1cc717['result']['message']);}})[_0xa101('0x15')](function(_0x72e42f){logger[_0xa101('0x11')](_0xa101('0x13'),_0x2226cf,_0x72e42f);_0x15127e(_0x72e42f);});});}exports[_0xa101('0x16')]=function(_0x380498){var _0x474956=this;return new Promise(function(_0x4977a0,_0x32ad66){return db[_0xa101('0x17')]['findAll']({'raw':_0x380498[_0xa101('0x18')]?_0x380498['options'][_0xa101('0x19')]===undefined?!![]:![]:!![],'where':_0x380498[_0xa101('0x18')]?_0x380498[_0xa101('0x18')][_0xa101('0x1a')]||null:null,'attributes':_0x380498[_0xa101('0x18')]?_0x380498[_0xa101('0x18')][_0xa101('0x1b')]||null:null,'limit':_0x380498['options']?_0x380498['options'][_0xa101('0x1c')]||null:null,'include':_0x380498[_0xa101('0x18')]?_0x380498['options'][_0xa101('0x1d')]?_[_0xa101('0x1e')](_0x380498[_0xa101('0x18')][_0xa101('0x1d')],function(_0x256831){return{'model':db[_0x256831['model']],'as':_0x256831['as'],'attributes':_0x256831[_0xa101('0x1b')],'include':_0x256831['include']?_[_0xa101('0x1e')](_0x256831['include'],function(_0x5a6cda){return{'model':db[_0x5a6cda[_0xa101('0x1f')]],'as':_0x5a6cda['as'],'attributes':_0x5a6cda[_0xa101('0x1b')],'include':_0x5a6cda[_0xa101('0x1d')]?_[_0xa101('0x1e')](_0x5a6cda[_0xa101('0x1d')],function(_0x376814){return{'model':db[_0x376814[_0xa101('0x1f')]],'as':_0x376814['as'],'attributes':_0x376814[_0xa101('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa101('0x20')](function(_0x6dc371){logger[_0xa101('0xd')]('GetTemplate',_0x380498);logger[_0xa101('0xf')](_0xa101('0x16'),_0x380498,JSON[_0xa101('0x10')](_0x6dc371));_0x4977a0(_0x6dc371);})[_0xa101('0x15')](function(_0x4abdaa){logger[_0xa101('0x11')](_0xa101('0x16'),_0x4abdaa[_0xa101('0x14')],_0x380498);_0x32ad66(_0x474956['error'](0x1f4,_0x4abdaa[_0xa101('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index bd74dbe..1af788f 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 _0x500c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','/:id','show','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0x500c,0x1ed));var _0xc500=function(_0x33e6bb,_0x29e234){_0x33e6bb=_0x33e6bb-0x0;var _0x26daf0=_0x500c[_0x33e6bb];return _0x26daf0;};'use strict';var multer=require(_0xc500('0x0'));var util=require(_0xc500('0x1'));var path=require(_0xc500('0x2'));var timeout=require(_0xc500('0x3'));var express=require(_0xc500('0x4'));var router=express[_0xc500('0x5')]();var fs_extra=require(_0xc500('0x6'));var auth=require(_0xc500('0x7'));var interaction=require(_0xc500('0x8'));var config=require('../../config/environment');var controller=require(_0xc500('0x9'));router[_0xc500('0xa')]('/',auth[_0xc500('0xb')](),controller['index']);router[_0xc500('0xa')](_0xc500('0xc'),auth[_0xc500('0xb')](),controller[_0xc500('0xd')]);router[_0xc500('0xa')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xc500('0xe')]);router[_0xc500('0xa')](_0xc500('0xf'),auth[_0xc500('0xb')](),controller['getAnyConditions']);router[_0xc500('0xa')](_0xc500('0x10'),auth['isAuthenticated'](),controller[_0xc500('0x11')]);router[_0xc500('0x12')]('/',auth['isAuthenticated'](),controller[_0xc500('0x13')]);router[_0xc500('0x12')](_0xc500('0x14'),auth[_0xc500('0xb')](),controller[_0xc500('0x15')]);router['post'](_0xc500('0xf'),auth[_0xc500('0xb')](),controller[_0xc500('0x16')]);router[_0xc500('0x12')](_0xc500('0x10'),auth[_0xc500('0xb')](),controller[_0xc500('0x17')]);router[_0xc500('0x18')](_0xc500('0xc'),auth['isAuthenticated'](),controller[_0xc500('0x19')]);router[_0xc500('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xc500('0x1b')]);module[_0xc500('0x1c')]=router; \ No newline at end of file +var _0x9a69=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put'];(function(_0x453e45,_0x526dce){var _0x5c9031=function(_0x84506){while(--_0x84506){_0x453e45['push'](_0x453e45['shift']());}};_0x5c9031(++_0x526dce);}(_0x9a69,0x9e));var _0x99a6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9a69[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x99a6('0x0'));var util=require(_0x99a6('0x1'));var path=require(_0x99a6('0x2'));var timeout=require(_0x99a6('0x3'));var express=require(_0x99a6('0x4'));var router=express[_0x99a6('0x5')]();var fs_extra=require(_0x99a6('0x6'));var auth=require(_0x99a6('0x7'));var interaction=require(_0x99a6('0x8'));var config=require(_0x99a6('0x9'));var controller=require('./trigger.controller');router[_0x99a6('0xa')]('/',auth[_0x99a6('0xb')](),controller['index']);router['get'](_0x99a6('0xc'),auth[_0x99a6('0xb')](),controller[_0x99a6('0xd')]);router[_0x99a6('0xa')](_0x99a6('0xe'),auth[_0x99a6('0xb')](),controller['getAllConditions']);router['get'](_0x99a6('0xf'),auth[_0x99a6('0xb')](),controller[_0x99a6('0x10')]);router[_0x99a6('0xa')](_0x99a6('0x11'),auth[_0x99a6('0xb')](),controller['getActions']);router[_0x99a6('0x12')]('/',auth['isAuthenticated'](),controller[_0x99a6('0x13')]);router[_0x99a6('0x12')](_0x99a6('0xe'),auth[_0x99a6('0xb')](),controller[_0x99a6('0x14')]);router['post']('/:id/any_conditions',auth[_0x99a6('0xb')](),controller[_0x99a6('0x15')]);router[_0x99a6('0x12')](_0x99a6('0x11'),auth[_0x99a6('0xb')](),controller[_0x99a6('0x16')]);router[_0x99a6('0x17')](_0x99a6('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x99a6('0xc'),auth[_0x99a6('0xb')](),controller[_0x99a6('0x18')]);module[_0x99a6('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ae531fb..191de8b 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 _0xb99c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x381ec0,_0x374714){var _0x25604c=function(_0x1922c6){while(--_0x1922c6){_0x381ec0['push'](_0x381ec0['shift']());}};_0x25604c(++_0x374714);}(_0xb99c,0x1a9));var _0xcb99=function(_0x306be8,_0x45cadf){_0x306be8=_0x306be8-0x0;var _0x315422=_0xb99c[_0x306be8];return _0x315422;};'use strict';var Sequelize=require(_0xcb99('0x0'));module[_0xcb99('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcb99('0x2')]},'description':{'type':Sequelize[_0xcb99('0x2')]},'status':{'type':Sequelize[_0xcb99('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0b24=['STRING','exports'];(function(_0x436adc,_0x5c9ae1){var _0x421a87=function(_0x29c7b9){while(--_0x29c7b9){_0x436adc['push'](_0x436adc['shift']());}};_0x421a87(++_0x5c9ae1);}(_0x0b24,0x19b));var _0x40b2=function(_0x17012b,_0x38c627){_0x17012b=_0x17012b-0x0;var _0x4735a9=_0x0b24[_0x17012b];return _0x4735a9;};'use strict';var Sequelize=require('sequelize');module[_0x40b2('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x40b2('0x1')]},'description':{'type':Sequelize[_0x40b2('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5143d64..56813e6 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 _0x012b=['filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','Trigger','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filters'];(function(_0x3def72,_0x218642){var _0x366424=function(_0x1598dc){while(--_0x1598dc){_0x3def72['push'](_0x3def72['shift']());}};_0x366424(++_0x218642);}(_0x012b,0x14b));var _0xb012=function(_0x574352,_0x54b63e){_0x574352=_0x574352-0x0;var _0x11f777=_0x012b[_0x574352];return _0x11f777;};'use strict';var emlformat=require(_0xb012('0x0'));var rimraf=require(_0xb012('0x1'));var zipdir=require(_0xb012('0x2'));var jsonpatch=require(_0xb012('0x3'));var rp=require(_0xb012('0x4'));var moment=require('moment');var BPromise=require(_0xb012('0x5'));var Mustache=require(_0xb012('0x6'));var util=require(_0xb012('0x7'));var path=require(_0xb012('0x8'));var sox=require(_0xb012('0x9'));var csv=require(_0xb012('0xa'));var ejs=require(_0xb012('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb012('0xc'));var squel=require(_0xb012('0xd'));var crypto=require(_0xb012('0xe'));var jsforce=require(_0xb012('0xf'));var deskjs=require(_0xb012('0x10'));var toCsv=require(_0xb012('0xa'));var querystring=require(_0xb012('0x11'));var Papa=require(_0xb012('0x12'));var Redis=require(_0xb012('0x13'));var authService=require(_0xb012('0x14'));var qs=require(_0xb012('0x15'));var as=require(_0xb012('0x16'));var hardwareService=require(_0xb012('0x17'));var logger=require('../../config/logger')(_0xb012('0x18'));var utils=require('../../config/utils');var config=require(_0xb012('0x19'));var licenseUtil=require(_0xb012('0x1a'));var db=require(_0xb012('0x1b'))['db'];function respondWithStatusCode(_0xf1297,_0x636a4e){_0x636a4e=_0x636a4e||0xcc;return function(_0x3f944a){if(_0x3f944a){return _0xf1297[_0xb012('0x1c')](_0x636a4e);}return _0xf1297[_0xb012('0x1d')](_0x636a4e)['end']();};}function respondWithResult(_0x35044c,_0x4f515e){_0x4f515e=_0x4f515e||0xc8;return function(_0x51cc55){if(_0x51cc55){return _0x35044c[_0xb012('0x1d')](_0x4f515e)['json'](_0x51cc55);}};}function respondWithFilteredResult(_0x21c9c3,_0x4d1300){return function(_0x2b134c){if(_0x2b134c){var _0x5304d6=typeof _0x4d1300[_0xb012('0x1e')]===_0xb012('0x1f')&&typeof _0x4d1300['limit']===_0xb012('0x1f');var _0x79a10f=_0x2b134c[_0xb012('0x20')];var _0x341e76=_0x5304d6?0x0:_0x4d1300['offset'];var _0x26337c=_0x5304d6?_0x2b134c['count']:_0x4d1300['offset']+_0x4d1300[_0xb012('0x21')];var _0x4eeacb;if(_0x26337c>=_0x79a10f){_0x26337c=_0x79a10f;_0x4eeacb=0xc8;}else{_0x4eeacb=0xce;}_0x21c9c3[_0xb012('0x1d')](_0x4eeacb);return _0x21c9c3['set']('Content-Range',_0x341e76+'-'+_0x26337c+'/'+_0x79a10f)['json'](_0x2b134c);}return null;};}function patchUpdates(_0xf1f2ee){return function(_0x580254){try{jsonpatch[_0xb012('0x22')](_0x580254,_0xf1f2ee,!![]);}catch(_0x13e605){return BPromise[_0xb012('0x23')](_0x13e605);}return _0x580254[_0xb012('0x24')]();};}function saveUpdates(_0x2970de,_0x18ced7){return function(_0x13f30a){if(_0x13f30a){return _0x13f30a[_0xb012('0x25')](_0x2970de)[_0xb012('0x26')](function(_0x4c18db){return _0x4c18db;});}return null;};}function removeEntity(_0x55bb95,_0x1a5c0a){return function(_0x2f83e7){if(_0x2f83e7){return _0x2f83e7[_0xb012('0x27')]()[_0xb012('0x26')](function(){var _0x35c469=_0x2f83e7[_0xb012('0x28')]({'plain':!![]});var _0x3a3cd4='Triggers';return db[_0xb012('0x29')]['destroy']({'where':{'type':_0x3a3cd4,'resourceId':_0x35c469['id']}})['then'](function(){return _0x2f83e7;});})[_0xb012('0x26')](function(){_0x55bb95[_0xb012('0x1d')](0xcc)[_0xb012('0x2a')]();});}};}function handleEntityNotFound(_0x37e4d1,_0x40dd8a){return function(_0x387c01){if(!_0x387c01){_0x37e4d1['sendStatus'](0x194);}return _0x387c01;};}function handleError(_0x1bf934,_0xa73cef){_0xa73cef=_0xa73cef||0x1f4;return function(_0x3f2987){logger[_0xb012('0x2b')](_0x3f2987['stack']);if(_0x3f2987[_0xb012('0x2c')]){delete _0x3f2987[_0xb012('0x2c')];}_0x1bf934['status'](_0xa73cef)[_0xb012('0x2d')](_0x3f2987);};}exports[_0xb012('0x2e')]=function(_0x5807dd,_0x577551){var _0x2c6770={},_0x405d6d={},_0x4e993d={'count':0x0,'rows':[]};var _0x5dedbb=_['map'](db[_0xb012('0x2f')][_0xb012('0x30')],function(_0x61253e){return{'name':_0x61253e[_0xb012('0x31')],'type':_0x61253e[_0xb012('0x32')][_0xb012('0x33')]};});_0x405d6d[_0xb012('0x34')]=_[_0xb012('0x35')](_0x5dedbb,_0xb012('0x2c'));_0x405d6d[_0xb012('0x36')]=_[_0xb012('0x37')](_0x5807dd[_0xb012('0x36')]);_0x405d6d['filters']=_[_0xb012('0x38')](_0x405d6d[_0xb012('0x34')],_0x405d6d[_0xb012('0x36')]);_0x2c6770[_0xb012('0x39')]=_[_0xb012('0x38')](_0x405d6d[_0xb012('0x34')],qs[_0xb012('0x3a')](_0x5807dd[_0xb012('0x36')][_0xb012('0x3a')]));_0x2c6770['attributes']=_0x2c6770[_0xb012('0x39')][_0xb012('0x3b')]?_0x2c6770[_0xb012('0x39')]:_0x405d6d['model'];if(!_0x5807dd[_0xb012('0x36')]['hasOwnProperty'](_0xb012('0x3c'))){_0x2c6770[_0xb012('0x21')]=qs['limit'](_0x5807dd['query'][_0xb012('0x21')]);_0x2c6770[_0xb012('0x1e')]=qs['offset'](_0x5807dd['query'][_0xb012('0x1e')]);}_0x2c6770[_0xb012('0x3d')]=qs[_0xb012('0x3e')](_0x5807dd[_0xb012('0x36')][_0xb012('0x3e')]);_0x2c6770['where']=qs['filters'](_[_0xb012('0x3f')](_0x5807dd[_0xb012('0x36')],_0x405d6d[_0xb012('0x40')]),_0x5dedbb);if(_0x5807dd[_0xb012('0x36')][_0xb012('0x41')]){_0x2c6770[_0xb012('0x42')]=_[_0xb012('0x43')](_0x2c6770[_0xb012('0x42')],{'$or':_[_0xb012('0x35')](_0x5dedbb,function(_0x8e46cd){if(_0x8e46cd[_0xb012('0x32')]!==_0xb012('0x44')){var _0x422e11={};_0x422e11[_0x8e46cd[_0xb012('0x2c')]]={'$like':'%'+_0x5807dd['query']['filter']+'%'};return _0x422e11;}})});}_0x2c6770=_[_0xb012('0x43')]({},_0x2c6770,_0x5807dd[_0xb012('0x45')]);var _0x1ab551={'where':_0x2c6770[_0xb012('0x42')]};return db[_0xb012('0x2f')][_0xb012('0x20')](_0x1ab551)[_0xb012('0x26')](function(_0x92d2e1){_0x4e993d['count']=_0x92d2e1;if(_0x5807dd[_0xb012('0x36')][_0xb012('0x46')]){_0x2c6770['include']=[{'all':!![]}];}return db[_0xb012('0x2f')]['findAll'](_0x2c6770);})[_0xb012('0x26')](function(_0x1b2f6a){_0x4e993d[_0xb012('0x47')]=_0x1b2f6a;return _0x4e993d;})['then'](respondWithFilteredResult(_0x577551,_0x2c6770))[_0xb012('0x48')](handleError(_0x577551,null));};exports[_0xb012('0x49')]=function(_0x218b65,_0x158adb){var _0x3b4d09={'raw':![],'where':{'id':_0x218b65[_0xb012('0x4a')]['id']}},_0x599adc={};_0x599adc[_0xb012('0x34')]=_[_0xb012('0x37')](db[_0xb012('0x2f')][_0xb012('0x30')]);_0x599adc[_0xb012('0x36')]=_[_0xb012('0x37')](_0x218b65[_0xb012('0x36')]);_0x599adc[_0xb012('0x40')]=_[_0xb012('0x38')](_0x599adc[_0xb012('0x34')],_0x599adc['query']);_0x3b4d09['attributes']=_['intersection'](_0x599adc[_0xb012('0x34')],qs[_0xb012('0x3a')](_0x218b65[_0xb012('0x36')][_0xb012('0x3a')]));_0x3b4d09[_0xb012('0x39')]=_0x3b4d09[_0xb012('0x39')][_0xb012('0x3b')]?_0x3b4d09[_0xb012('0x39')]:_0x599adc[_0xb012('0x34')];if(_0x218b65['query']['includeAll']){_0x3b4d09[_0xb012('0x4b')]=[{'all':!![]}];}_0x3b4d09=_[_0xb012('0x43')]({},_0x3b4d09,_0x218b65['options']);return db[_0xb012('0x2f')][_0xb012('0x4c')](_0x3b4d09)[_0xb012('0x26')](handleEntityNotFound(_0x158adb,null))['then'](respondWithResult(_0x158adb,null))['catch'](handleError(_0x158adb,null));};exports['create']=function(_0x211ad1,_0x5c8a43){return db[_0xb012('0x2f')][_0xb012('0x4d')](_0x211ad1[_0xb012('0x4e')],{})['then'](function(_0x353c9a){var _0x56be04=_0x211ad1['user'][_0xb012('0x28')]({'plain':!![]});if(!_0x56be04)throw new Error(_0xb012('0x4f'));if(_0x56be04[_0xb012('0x50')]===_0xb012('0x51')){var _0x4f03ac=_0x353c9a[_0xb012('0x28')]({'plain':!![]});var _0x41cee7='Triggers';return db[_0xb012('0x52')]['find']({'where':{'name':_0x41cee7,'userProfileId':_0x56be04[_0xb012('0x53')]},'raw':!![]})[_0xb012('0x26')](function(_0x766f74){if(_0x766f74&&_0x766f74[_0xb012('0x54')]===0x0){return db[_0xb012('0x29')]['create']({'name':_0x4f03ac[_0xb012('0x2c')],'resourceId':_0x4f03ac['id'],'type':_0x766f74[_0xb012('0x2c')],'sectionId':_0x766f74['id']},{})[_0xb012('0x26')](function(){return _0x353c9a;});}else{return _0x353c9a;}})[_0xb012('0x48')](function(_0x42abf8){logger['error'](_0xb012('0x55'),_0x42abf8);throw _0x42abf8;});}return _0x353c9a;})[_0xb012('0x26')](respondWithResult(_0x5c8a43,0xc9))[_0xb012('0x48')](handleError(_0x5c8a43,null));};exports[_0xb012('0x25')]=function(_0x1d7040,_0x30a3db){if(_0x1d7040[_0xb012('0x4e')]['id']){delete _0x1d7040['body']['id'];}return db[_0xb012('0x2f')]['find']({'where':{'id':_0x1d7040[_0xb012('0x4a')]['id']}})[_0xb012('0x26')](handleEntityNotFound(_0x30a3db,null))[_0xb012('0x26')](saveUpdates(_0x1d7040[_0xb012('0x4e')],null))['then'](respondWithResult(_0x30a3db,null))[_0xb012('0x48')](handleError(_0x30a3db,null));};exports[_0xb012('0x27')]=function(_0x333770,_0x8945e2){return db[_0xb012('0x2f')][_0xb012('0x4c')]({'where':{'id':_0x333770[_0xb012('0x4a')]['id']}})[_0xb012('0x26')](handleEntityNotFound(_0x8945e2,null))[_0xb012('0x26')](removeEntity(_0x8945e2,null))[_0xb012('0x48')](handleError(_0x8945e2,null));};exports[_0xb012('0x56')]=function(_0x176e2d,_0x3485ee,_0x1b392d){if(_0x176e2d[_0xb012('0x4e')]['id']){delete _0x176e2d['body']['id'];}return db[_0xb012('0x2f')][_0xb012('0x4c')]({'where':{'id':_0x176e2d['params']['id']}})[_0xb012('0x26')](handleEntityNotFound(_0x3485ee,null))[_0xb012('0x26')](function(_0xb17f44){if(_0xb17f44){_0x176e2d['body'][_0xb012('0x57')]=_0xb17f44['id'];return db['Condition'][_0xb012('0x4d')](_0x176e2d['body']);}})[_0xb012('0x26')](respondWithResult(_0x3485ee,null))['catch'](handleError(_0x3485ee,null));};exports[_0xb012('0x58')]=function(_0x40a157,_0x32890e,_0x508097){if(_0x40a157[_0xb012('0x4e')]['id']){delete _0x40a157[_0xb012('0x4e')]['id'];}return db['Trigger'][_0xb012('0x4c')]({'where':{'id':_0x40a157[_0xb012('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32890e,null))[_0xb012('0x26')](function(_0x21377b){if(_0x21377b){_0x40a157[_0xb012('0x4e')][_0xb012('0x59')]=_0x21377b['id'];return db[_0xb012('0x5a')][_0xb012('0x4d')](_0x40a157['body']);}})['then'](respondWithResult(_0x32890e,null))[_0xb012('0x48')](handleError(_0x32890e,null));};exports[_0xb012('0x5b')]=function(_0x3c39b5,_0x313521,_0x5a05b2){var _0x4f0fc0={};var _0x5e1fa0={};var _0x5769f0;var _0x5a628c;return db[_0xb012('0x2f')]['findOne']({'where':{'id':_0x3c39b5['params']['id']}})[_0xb012('0x26')](handleEntityNotFound(_0x313521,null))[_0xb012('0x26')](function(_0x23bf17){if(_0x23bf17){_0x5769f0=_0x23bf17;_0x5e1fa0[_0xb012('0x34')]=_[_0xb012('0x37')](db[_0xb012('0x5a')][_0xb012('0x30')]);_0x5e1fa0[_0xb012('0x36')]=_['keys'](_0x3c39b5[_0xb012('0x36')]);_0x5e1fa0[_0xb012('0x40')]=_[_0xb012('0x38')](_0x5e1fa0[_0xb012('0x34')],_0x5e1fa0['query']);_0x4f0fc0[_0xb012('0x39')]=_['intersection'](_0x5e1fa0[_0xb012('0x34')],qs[_0xb012('0x3a')](_0x3c39b5[_0xb012('0x36')][_0xb012('0x3a')]));_0x4f0fc0[_0xb012('0x39')]=_0x4f0fc0[_0xb012('0x39')][_0xb012('0x3b')]?_0x4f0fc0[_0xb012('0x39')]:_0x5e1fa0[_0xb012('0x34')];_0x4f0fc0[_0xb012('0x3d')]=qs['sort'](_0x3c39b5[_0xb012('0x36')][_0xb012('0x3e')]);_0x4f0fc0[_0xb012('0x42')]=qs[_0xb012('0x40')](_[_0xb012('0x3f')](_0x3c39b5[_0xb012('0x36')],_0x5e1fa0[_0xb012('0x40')]));if(_0x3c39b5[_0xb012('0x36')][_0xb012('0x41')]){_0x4f0fc0[_0xb012('0x42')]=_[_0xb012('0x43')](_0x4f0fc0[_0xb012('0x42')],{'$or':_[_0xb012('0x35')](_0x4f0fc0[_0xb012('0x39')],function(_0x2ecbbc){var _0x44d90c={};_0x44d90c[_0x2ecbbc]={'$like':'%'+_0x3c39b5['query'][_0xb012('0x41')]+'%'};return _0x44d90c;})});}_0x4f0fc0=_[_0xb012('0x43')]({},_0x4f0fc0,_0x3c39b5[_0xb012('0x45')]);return _0x5769f0['getAllConditions'](_0x4f0fc0);}})[_0xb012('0x26')](function(_0x4b74ad){if(_0x4b74ad){_0x5a628c=_0x4b74ad[_0xb012('0x3b')];if(!_0x3c39b5[_0xb012('0x36')]['hasOwnProperty'](_0xb012('0x3c'))){_0x4f0fc0[_0xb012('0x21')]=qs[_0xb012('0x21')](_0x3c39b5[_0xb012('0x36')][_0xb012('0x21')]);_0x4f0fc0[_0xb012('0x1e')]=qs[_0xb012('0x1e')](_0x3c39b5[_0xb012('0x36')][_0xb012('0x1e')]);}return _0x5769f0[_0xb012('0x5b')](_0x4f0fc0);}})[_0xb012('0x26')](function(_0x5111fe){if(_0x5111fe){return _0x5111fe?{'count':_0x5a628c,'rows':_0x5111fe}:null;}})[_0xb012('0x26')](respondWithResult(_0x313521,null))['catch'](handleError(_0x313521,null));};exports['getAnyConditions']=function(_0x396c73,_0x10b3ff,_0x5026ca){var _0x20f398={};var _0x538ac5={};var _0x1ddbfe;var _0x4a8bde;return db[_0xb012('0x2f')]['findOne']({'where':{'id':_0x396c73[_0xb012('0x4a')]['id']}})[_0xb012('0x26')](handleEntityNotFound(_0x10b3ff,null))[_0xb012('0x26')](function(_0x4f6d63){if(_0x4f6d63){_0x1ddbfe=_0x4f6d63;_0x538ac5[_0xb012('0x34')]=_['keys'](db['Condition'][_0xb012('0x30')]);_0x538ac5[_0xb012('0x36')]=_[_0xb012('0x37')](_0x396c73[_0xb012('0x36')]);_0x538ac5['filters']=_[_0xb012('0x38')](_0x538ac5[_0xb012('0x34')],_0x538ac5['query']);_0x20f398['attributes']=_['intersection'](_0x538ac5[_0xb012('0x34')],qs[_0xb012('0x3a')](_0x396c73[_0xb012('0x36')][_0xb012('0x3a')]));_0x20f398[_0xb012('0x39')]=_0x20f398[_0xb012('0x39')][_0xb012('0x3b')]?_0x20f398[_0xb012('0x39')]:_0x538ac5[_0xb012('0x34')];_0x20f398[_0xb012('0x3d')]=qs[_0xb012('0x3e')](_0x396c73[_0xb012('0x36')][_0xb012('0x3e')]);_0x20f398[_0xb012('0x42')]=qs['filters'](_[_0xb012('0x3f')](_0x396c73['query'],_0x538ac5[_0xb012('0x40')]));if(_0x396c73['query'][_0xb012('0x41')]){_0x20f398[_0xb012('0x42')]=_[_0xb012('0x43')](_0x20f398[_0xb012('0x42')],{'$or':_[_0xb012('0x35')](_0x20f398[_0xb012('0x39')],function(_0x44e97f){var _0x3c4fe8={};_0x3c4fe8[_0x44e97f]={'$like':'%'+_0x396c73[_0xb012('0x36')][_0xb012('0x41')]+'%'};return _0x3c4fe8;})});}_0x20f398=_['merge']({},_0x20f398,_0x396c73[_0xb012('0x45')]);return _0x1ddbfe[_0xb012('0x5c')](_0x20f398);}})['then'](function(_0x4bfb51){if(_0x4bfb51){_0x4a8bde=_0x4bfb51[_0xb012('0x3b')];if(!_0x396c73[_0xb012('0x36')]['hasOwnProperty'](_0xb012('0x3c'))){_0x20f398[_0xb012('0x21')]=qs[_0xb012('0x21')](_0x396c73['query']['limit']);_0x20f398['offset']=qs[_0xb012('0x1e')](_0x396c73[_0xb012('0x36')][_0xb012('0x1e')]);}return _0x1ddbfe['getAnyConditions'](_0x20f398);}})['then'](function(_0xf25512){if(_0xf25512){return _0xf25512?{'count':_0x4a8bde,'rows':_0xf25512}:null;}})[_0xb012('0x26')](respondWithResult(_0x10b3ff,null))['catch'](handleError(_0x10b3ff,null));};exports[_0xb012('0x5d')]=function(_0x145cf3,_0x9aa11f,_0x2a24c5){if(_0x145cf3['body']['id']){delete _0x145cf3[_0xb012('0x4e')]['id'];}return db[_0xb012('0x2f')][_0xb012('0x4c')]({'where':{'id':_0x145cf3[_0xb012('0x4a')]['id']}})[_0xb012('0x26')](handleEntityNotFound(_0x9aa11f,null))[_0xb012('0x26')](function(_0x3d490c){if(_0x3d490c){_0x145cf3[_0xb012('0x4e')][_0xb012('0x5e')]=_0x3d490c['id'];return db[_0xb012('0x5f')]['create'](_0x145cf3['body']);}})[_0xb012('0x26')](respondWithResult(_0x9aa11f,null))['catch'](handleError(_0x9aa11f,null));};exports[_0xb012('0x60')]=function(_0x3818e0,_0x531aaf,_0x1a38a2){var _0x5cf483={};var _0x180c06={};var _0x4217e0;var _0x1b9a3d;return db[_0xb012('0x2f')][_0xb012('0x61')]({'where':{'id':_0x3818e0[_0xb012('0x4a')]['id']}})[_0xb012('0x26')](handleEntityNotFound(_0x531aaf,null))[_0xb012('0x26')](function(_0x2dff59){if(_0x2dff59){_0x4217e0=_0x2dff59;_0x180c06[_0xb012('0x34')]=_['keys'](db[_0xb012('0x5f')][_0xb012('0x30')]);_0x180c06[_0xb012('0x36')]=_[_0xb012('0x37')](_0x3818e0[_0xb012('0x36')]);_0x180c06[_0xb012('0x40')]=_[_0xb012('0x38')](_0x180c06['model'],_0x180c06[_0xb012('0x36')]);_0x5cf483[_0xb012('0x39')]=_[_0xb012('0x38')](_0x180c06['model'],qs[_0xb012('0x3a')](_0x3818e0[_0xb012('0x36')][_0xb012('0x3a')]));_0x5cf483['attributes']=_0x5cf483[_0xb012('0x39')][_0xb012('0x3b')]?_0x5cf483[_0xb012('0x39')]:_0x180c06[_0xb012('0x34')];_0x5cf483[_0xb012('0x3d')]=qs[_0xb012('0x3e')](_0x3818e0[_0xb012('0x36')][_0xb012('0x3e')]);_0x5cf483[_0xb012('0x42')]=qs[_0xb012('0x40')](_[_0xb012('0x3f')](_0x3818e0['query'],_0x180c06[_0xb012('0x40')]));if(_0x3818e0[_0xb012('0x36')]['filter']){_0x5cf483[_0xb012('0x42')]=_[_0xb012('0x43')](_0x5cf483[_0xb012('0x42')],{'$or':_[_0xb012('0x35')](_0x5cf483[_0xb012('0x39')],function(_0x21ef74){var _0x2d91d3={};_0x2d91d3[_0x21ef74]={'$like':'%'+_0x3818e0[_0xb012('0x36')]['filter']+'%'};return _0x2d91d3;})});}_0x5cf483=_[_0xb012('0x43')]({},_0x5cf483,_0x3818e0['options']);return _0x4217e0[_0xb012('0x60')](_0x5cf483);}})[_0xb012('0x26')](function(_0x4607fd){if(_0x4607fd){_0x1b9a3d=_0x4607fd['length'];if(!_0x3818e0[_0xb012('0x36')][_0xb012('0x62')](_0xb012('0x3c'))){_0x5cf483[_0xb012('0x21')]=qs[_0xb012('0x21')](_0x3818e0[_0xb012('0x36')]['limit']);_0x5cf483['offset']=qs['offset'](_0x3818e0[_0xb012('0x36')][_0xb012('0x1e')]);}return _0x4217e0['getActions'](_0x5cf483);}})[_0xb012('0x26')](function(_0xb72454){if(_0xb72454){return _0xb72454?{'count':_0x1b9a3d,'rows':_0xb72454}:null;}})[_0xb012('0x26')](respondWithResult(_0x531aaf,null))['catch'](handleError(_0x531aaf,null));}; \ No newline at end of file +var _0xf755=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','error','stack','send','map','Trigger','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','sort','filter','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce'];(function(_0x532828,_0x5d68b1){var _0x42021a=function(_0x370933){while(--_0x370933){_0x532828['push'](_0x532828['shift']());}};_0x42021a(++_0x5d68b1);}(_0xf755,0xb3));var _0x5f75=function(_0x5979f5,_0x3167e5){_0x5979f5=_0x5979f5-0x0;var _0x42699e=_0xf755[_0x5979f5];return _0x42699e;};'use strict';var emlformat=require(_0x5f75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5f75('0x2'));var Mustache=require('mustache');var util=require(_0x5f75('0x3'));var path=require(_0x5f75('0x4'));var sox=require(_0x5f75('0x5'));var csv=require(_0x5f75('0x6'));var ejs=require(_0x5f75('0x7'));var fs=require('fs');var fs_extra=require(_0x5f75('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5f75('0x9'));var jsforce=require(_0x5f75('0xa'));var deskjs=require(_0x5f75('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5f75('0xc'));var Papa=require(_0x5f75('0xd'));var Redis=require(_0x5f75('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5f75('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f75('0x10'));var logger=require(_0x5f75('0x11'))(_0x5f75('0x12'));var utils=require(_0x5f75('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5f75('0x14'));var db=require(_0x5f75('0x15'))['db'];function respondWithStatusCode(_0x481bf9,_0x5d8689){_0x5d8689=_0x5d8689||0xcc;return function(_0x47965a){if(_0x47965a){return _0x481bf9[_0x5f75('0x16')](_0x5d8689);}return _0x481bf9['status'](_0x5d8689)[_0x5f75('0x17')]();};}function respondWithResult(_0x4a5681,_0x355398){_0x355398=_0x355398||0xc8;return function(_0x2efffd){if(_0x2efffd){return _0x4a5681['status'](_0x355398)[_0x5f75('0x18')](_0x2efffd);}};}function respondWithFilteredResult(_0x301445,_0x1f9bd2){return function(_0x466b52){if(_0x466b52){var _0x264b22=typeof _0x1f9bd2['offset']===_0x5f75('0x19')&&typeof _0x1f9bd2[_0x5f75('0x1a')]===_0x5f75('0x19');var _0x434eb2=_0x466b52[_0x5f75('0x1b')];var _0x1506a7=_0x264b22?0x0:_0x1f9bd2['offset'];var _0x144a80=_0x264b22?_0x466b52[_0x5f75('0x1b')]:_0x1f9bd2[_0x5f75('0x1c')]+_0x1f9bd2[_0x5f75('0x1a')];var _0x15a2f1;if(_0x144a80>=_0x434eb2){_0x144a80=_0x434eb2;_0x15a2f1=0xc8;}else{_0x15a2f1=0xce;}_0x301445[_0x5f75('0x1d')](_0x15a2f1);return _0x301445[_0x5f75('0x1e')]('Content-Range',_0x1506a7+'-'+_0x144a80+'/'+_0x434eb2)['json'](_0x466b52);}return null;};}function patchUpdates(_0x1c418d){return function(_0x26d948){try{jsonpatch[_0x5f75('0x1f')](_0x26d948,_0x1c418d,!![]);}catch(_0x3eeb65){return BPromise[_0x5f75('0x20')](_0x3eeb65);}return _0x26d948[_0x5f75('0x21')]();};}function saveUpdates(_0x51428e,_0x23eacf){return function(_0x1f242c){if(_0x1f242c){return _0x1f242c[_0x5f75('0x22')](_0x51428e)['then'](function(_0x375649){return _0x375649;});}return null;};}function removeEntity(_0x5b8373,_0x3662ae){return function(_0x3b5302){if(_0x3b5302){return _0x3b5302[_0x5f75('0x23')]()[_0x5f75('0x24')](function(){var _0x7a819a=_0x3b5302[_0x5f75('0x25')]({'plain':!![]});var _0x2e0cb6=_0x5f75('0x26');return db[_0x5f75('0x27')][_0x5f75('0x23')]({'where':{'type':_0x2e0cb6,'resourceId':_0x7a819a['id']}})[_0x5f75('0x24')](function(){return _0x3b5302;});})[_0x5f75('0x24')](function(){_0x5b8373[_0x5f75('0x1d')](0xcc)[_0x5f75('0x17')]();});}};}function handleEntityNotFound(_0x4f2f41,_0x10aad5){return function(_0x4a2159){if(!_0x4a2159){_0x4f2f41[_0x5f75('0x16')](0x194);}return _0x4a2159;};}function handleError(_0x5cc387,_0x518ded){_0x518ded=_0x518ded||0x1f4;return function(_0x45f25f){logger[_0x5f75('0x28')](_0x45f25f[_0x5f75('0x29')]);if(_0x45f25f['name']){delete _0x45f25f['name'];}_0x5cc387[_0x5f75('0x1d')](_0x518ded)[_0x5f75('0x2a')](_0x45f25f);};}exports['index']=function(_0x77dc76,_0x15915b){var _0x2a9ce6={},_0x1db9f7={},_0x5f1d92={'count':0x0,'rows':[]};var _0x26d35c=_[_0x5f75('0x2b')](db[_0x5f75('0x2c')][_0x5f75('0x2d')],function(_0x5d52e1){return{'name':_0x5d52e1['fieldName'],'type':_0x5d52e1[_0x5f75('0x2e')][_0x5f75('0x2f')]};});_0x1db9f7[_0x5f75('0x30')]=_[_0x5f75('0x2b')](_0x26d35c,'name');_0x1db9f7[_0x5f75('0x31')]=_['keys'](_0x77dc76[_0x5f75('0x31')]);_0x1db9f7['filters']=_['intersection'](_0x1db9f7[_0x5f75('0x30')],_0x1db9f7[_0x5f75('0x31')]);_0x2a9ce6['attributes']=_[_0x5f75('0x32')](_0x1db9f7[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0x77dc76[_0x5f75('0x31')][_0x5f75('0x33')]));_0x2a9ce6[_0x5f75('0x34')]=_0x2a9ce6[_0x5f75('0x34')][_0x5f75('0x35')]?_0x2a9ce6[_0x5f75('0x34')]:_0x1db9f7[_0x5f75('0x30')];if(!_0x77dc76['query'][_0x5f75('0x36')]('nolimit')){_0x2a9ce6['limit']=qs[_0x5f75('0x1a')](_0x77dc76[_0x5f75('0x31')][_0x5f75('0x1a')]);_0x2a9ce6[_0x5f75('0x1c')]=qs[_0x5f75('0x1c')](_0x77dc76[_0x5f75('0x31')]['offset']);}_0x2a9ce6[_0x5f75('0x37')]=qs['sort'](_0x77dc76[_0x5f75('0x31')]['sort']);_0x2a9ce6[_0x5f75('0x38')]=qs[_0x5f75('0x39')](_[_0x5f75('0x3a')](_0x77dc76[_0x5f75('0x31')],_0x1db9f7[_0x5f75('0x39')]),_0x26d35c);if(_0x77dc76['query']['filter']){_0x2a9ce6[_0x5f75('0x38')]=_[_0x5f75('0x3b')](_0x2a9ce6[_0x5f75('0x38')],{'$or':_[_0x5f75('0x2b')](_0x26d35c,function(_0x3eda8a){if(_0x3eda8a[_0x5f75('0x2e')]!==_0x5f75('0x3c')){var _0x279462={};_0x279462[_0x3eda8a['name']]={'$like':'%'+_0x77dc76[_0x5f75('0x31')]['filter']+'%'};return _0x279462;}})});}_0x2a9ce6=_[_0x5f75('0x3b')]({},_0x2a9ce6,_0x77dc76[_0x5f75('0x3d')]);var _0x453e77={'where':_0x2a9ce6['where']};return db[_0x5f75('0x2c')][_0x5f75('0x1b')](_0x453e77)[_0x5f75('0x24')](function(_0x21b1c2){_0x5f1d92['count']=_0x21b1c2;if(_0x77dc76[_0x5f75('0x31')][_0x5f75('0x3e')]){_0x2a9ce6[_0x5f75('0x3f')]=[{'all':!![]}];}return db['Trigger'][_0x5f75('0x40')](_0x2a9ce6);})[_0x5f75('0x24')](function(_0x541455){_0x5f1d92[_0x5f75('0x41')]=_0x541455;return _0x5f1d92;})[_0x5f75('0x24')](respondWithFilteredResult(_0x15915b,_0x2a9ce6))[_0x5f75('0x42')](handleError(_0x15915b,null));};exports[_0x5f75('0x43')]=function(_0x50ce59,_0x5828b3){var _0x3ae2e3={'raw':![],'where':{'id':_0x50ce59[_0x5f75('0x44')]['id']}},_0x53611e={};_0x53611e[_0x5f75('0x30')]=_['keys'](db['Trigger'][_0x5f75('0x2d')]);_0x53611e[_0x5f75('0x31')]=_[_0x5f75('0x45')](_0x50ce59[_0x5f75('0x31')]);_0x53611e[_0x5f75('0x39')]=_[_0x5f75('0x32')](_0x53611e['model'],_0x53611e['query']);_0x3ae2e3['attributes']=_['intersection'](_0x53611e[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0x50ce59[_0x5f75('0x31')][_0x5f75('0x33')]));_0x3ae2e3['attributes']=_0x3ae2e3[_0x5f75('0x34')][_0x5f75('0x35')]?_0x3ae2e3[_0x5f75('0x34')]:_0x53611e[_0x5f75('0x30')];if(_0x50ce59['query'][_0x5f75('0x3e')]){_0x3ae2e3[_0x5f75('0x3f')]=[{'all':!![]}];}_0x3ae2e3=_[_0x5f75('0x3b')]({},_0x3ae2e3,_0x50ce59[_0x5f75('0x3d')]);return db[_0x5f75('0x2c')]['find'](_0x3ae2e3)[_0x5f75('0x24')](handleEntityNotFound(_0x5828b3,null))[_0x5f75('0x24')](respondWithResult(_0x5828b3,null))['catch'](handleError(_0x5828b3,null));};exports[_0x5f75('0x46')]=function(_0x405d55,_0xa2597){return db['Trigger']['create'](_0x405d55[_0x5f75('0x47')],{})[_0x5f75('0x24')](function(_0x447160){var _0x2de60f=_0x405d55[_0x5f75('0x48')][_0x5f75('0x25')]({'plain':!![]});if(!_0x2de60f)throw new Error(_0x5f75('0x49'));if(_0x2de60f[_0x5f75('0x4a')]==='user'){var _0x34b9ff=_0x447160['get']({'plain':!![]});var _0x3001a3=_0x5f75('0x26');return db[_0x5f75('0x4b')][_0x5f75('0x4c')]({'where':{'name':_0x3001a3,'userProfileId':_0x2de60f[_0x5f75('0x4d')]},'raw':!![]})[_0x5f75('0x24')](function(_0x24e5f8){if(_0x24e5f8&&_0x24e5f8[_0x5f75('0x4e')]===0x0){return db[_0x5f75('0x27')][_0x5f75('0x46')]({'name':_0x34b9ff[_0x5f75('0x4f')],'resourceId':_0x34b9ff['id'],'type':_0x24e5f8[_0x5f75('0x4f')],'sectionId':_0x24e5f8['id']},{})[_0x5f75('0x24')](function(){return _0x447160;});}else{return _0x447160;}})[_0x5f75('0x42')](function(_0xdd5edb){logger[_0x5f75('0x28')](_0x5f75('0x50'),_0xdd5edb);throw _0xdd5edb;});}return _0x447160;})[_0x5f75('0x24')](respondWithResult(_0xa2597,0xc9))['catch'](handleError(_0xa2597,null));};exports['update']=function(_0x173e7a,_0x4661b6){if(_0x173e7a[_0x5f75('0x47')]['id']){delete _0x173e7a[_0x5f75('0x47')]['id'];}return db['Trigger']['find']({'where':{'id':_0x173e7a[_0x5f75('0x44')]['id']}})['then'](handleEntityNotFound(_0x4661b6,null))['then'](saveUpdates(_0x173e7a[_0x5f75('0x47')],null))[_0x5f75('0x24')](respondWithResult(_0x4661b6,null))[_0x5f75('0x42')](handleError(_0x4661b6,null));};exports[_0x5f75('0x23')]=function(_0x25c523,_0x3a10fd){return db[_0x5f75('0x2c')]['find']({'where':{'id':_0x25c523[_0x5f75('0x44')]['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x3a10fd,null))[_0x5f75('0x24')](removeEntity(_0x3a10fd,null))['catch'](handleError(_0x3a10fd,null));};exports[_0x5f75('0x51')]=function(_0x59e57b,_0x536769,_0x20e864){if(_0x59e57b[_0x5f75('0x47')]['id']){delete _0x59e57b[_0x5f75('0x47')]['id'];}return db[_0x5f75('0x2c')]['find']({'where':{'id':_0x59e57b[_0x5f75('0x44')]['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x536769,null))['then'](function(_0x6b32e6){if(_0x6b32e6){_0x59e57b[_0x5f75('0x47')][_0x5f75('0x52')]=_0x6b32e6['id'];return db[_0x5f75('0x53')]['create'](_0x59e57b[_0x5f75('0x47')]);}})[_0x5f75('0x24')](respondWithResult(_0x536769,null))[_0x5f75('0x42')](handleError(_0x536769,null));};exports[_0x5f75('0x54')]=function(_0x4c623a,_0x16bebd,_0xd09446){if(_0x4c623a[_0x5f75('0x47')]['id']){delete _0x4c623a[_0x5f75('0x47')]['id'];}return db['Trigger'][_0x5f75('0x4c')]({'where':{'id':_0x4c623a['params']['id']}})['then'](handleEntityNotFound(_0x16bebd,null))[_0x5f75('0x24')](function(_0x5754a8){if(_0x5754a8){_0x4c623a[_0x5f75('0x47')][_0x5f75('0x55')]=_0x5754a8['id'];return db['Condition']['create'](_0x4c623a[_0x5f75('0x47')]);}})[_0x5f75('0x24')](respondWithResult(_0x16bebd,null))[_0x5f75('0x42')](handleError(_0x16bebd,null));};exports['getAllConditions']=function(_0xd97033,_0x17548b,_0x2599f3){var _0x1238bb={};var _0x3fa85d={};var _0x3654f9;var _0xcdf07;return db['Trigger'][_0x5f75('0x56')]({'where':{'id':_0xd97033[_0x5f75('0x44')]['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x17548b,null))[_0x5f75('0x24')](function(_0x50f0f5){if(_0x50f0f5){_0x3654f9=_0x50f0f5;_0x3fa85d[_0x5f75('0x30')]=_[_0x5f75('0x45')](db[_0x5f75('0x53')]['rawAttributes']);_0x3fa85d[_0x5f75('0x31')]=_[_0x5f75('0x45')](_0xd97033['query']);_0x3fa85d[_0x5f75('0x39')]=_[_0x5f75('0x32')](_0x3fa85d[_0x5f75('0x30')],_0x3fa85d[_0x5f75('0x31')]);_0x1238bb['attributes']=_['intersection'](_0x3fa85d[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0xd97033['query']['fields']));_0x1238bb[_0x5f75('0x34')]=_0x1238bb[_0x5f75('0x34')][_0x5f75('0x35')]?_0x1238bb[_0x5f75('0x34')]:_0x3fa85d[_0x5f75('0x30')];_0x1238bb[_0x5f75('0x37')]=qs[_0x5f75('0x57')](_0xd97033['query'][_0x5f75('0x57')]);_0x1238bb[_0x5f75('0x38')]=qs[_0x5f75('0x39')](_[_0x5f75('0x3a')](_0xd97033[_0x5f75('0x31')],_0x3fa85d[_0x5f75('0x39')]));if(_0xd97033[_0x5f75('0x31')][_0x5f75('0x58')]){_0x1238bb['where']=_['merge'](_0x1238bb[_0x5f75('0x38')],{'$or':_[_0x5f75('0x2b')](_0x1238bb[_0x5f75('0x34')],function(_0x49f25d){var _0x37d7b0={};_0x37d7b0[_0x49f25d]={'$like':'%'+_0xd97033[_0x5f75('0x31')][_0x5f75('0x58')]+'%'};return _0x37d7b0;})});}_0x1238bb=_['merge']({},_0x1238bb,_0xd97033[_0x5f75('0x3d')]);return _0x3654f9['getAllConditions'](_0x1238bb);}})[_0x5f75('0x24')](function(_0x308edd){if(_0x308edd){_0xcdf07=_0x308edd['length'];if(!_0xd97033['query'][_0x5f75('0x36')](_0x5f75('0x59'))){_0x1238bb[_0x5f75('0x1a')]=qs[_0x5f75('0x1a')](_0xd97033[_0x5f75('0x31')]['limit']);_0x1238bb['offset']=qs['offset'](_0xd97033[_0x5f75('0x31')][_0x5f75('0x1c')]);}return _0x3654f9['getAllConditions'](_0x1238bb);}})[_0x5f75('0x24')](function(_0x552822){if(_0x552822){return _0x552822?{'count':_0xcdf07,'rows':_0x552822}:null;}})['then'](respondWithResult(_0x17548b,null))[_0x5f75('0x42')](handleError(_0x17548b,null));};exports['getAnyConditions']=function(_0xab9198,_0x23e36c,_0x2f1e0b){var _0x542dd7={};var _0x43ed53={};var _0x2e5f42;var _0x3efed6;return db[_0x5f75('0x2c')]['findOne']({'where':{'id':_0xab9198[_0x5f75('0x44')]['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x23e36c,null))[_0x5f75('0x24')](function(_0x2d869a){if(_0x2d869a){_0x2e5f42=_0x2d869a;_0x43ed53[_0x5f75('0x30')]=_[_0x5f75('0x45')](db['Condition'][_0x5f75('0x2d')]);_0x43ed53[_0x5f75('0x31')]=_[_0x5f75('0x45')](_0xab9198[_0x5f75('0x31')]);_0x43ed53[_0x5f75('0x39')]=_[_0x5f75('0x32')](_0x43ed53[_0x5f75('0x30')],_0x43ed53[_0x5f75('0x31')]);_0x542dd7[_0x5f75('0x34')]=_['intersection'](_0x43ed53[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0xab9198[_0x5f75('0x31')][_0x5f75('0x33')]));_0x542dd7[_0x5f75('0x34')]=_0x542dd7[_0x5f75('0x34')][_0x5f75('0x35')]?_0x542dd7[_0x5f75('0x34')]:_0x43ed53[_0x5f75('0x30')];_0x542dd7[_0x5f75('0x37')]=qs[_0x5f75('0x57')](_0xab9198['query'][_0x5f75('0x57')]);_0x542dd7[_0x5f75('0x38')]=qs[_0x5f75('0x39')](_['pick'](_0xab9198['query'],_0x43ed53[_0x5f75('0x39')]));if(_0xab9198[_0x5f75('0x31')][_0x5f75('0x58')]){_0x542dd7[_0x5f75('0x38')]=_[_0x5f75('0x3b')](_0x542dd7[_0x5f75('0x38')],{'$or':_[_0x5f75('0x2b')](_0x542dd7['attributes'],function(_0x15e18e){var _0x1023e5={};_0x1023e5[_0x15e18e]={'$like':'%'+_0xab9198[_0x5f75('0x31')][_0x5f75('0x58')]+'%'};return _0x1023e5;})});}_0x542dd7=_[_0x5f75('0x3b')]({},_0x542dd7,_0xab9198[_0x5f75('0x3d')]);return _0x2e5f42[_0x5f75('0x5a')](_0x542dd7);}})['then'](function(_0x42ca06){if(_0x42ca06){_0x3efed6=_0x42ca06[_0x5f75('0x35')];if(!_0xab9198[_0x5f75('0x31')][_0x5f75('0x36')](_0x5f75('0x59'))){_0x542dd7[_0x5f75('0x1a')]=qs['limit'](_0xab9198['query']['limit']);_0x542dd7[_0x5f75('0x1c')]=qs['offset'](_0xab9198[_0x5f75('0x31')]['offset']);}return _0x2e5f42[_0x5f75('0x5a')](_0x542dd7);}})['then'](function(_0x4782cd){if(_0x4782cd){return _0x4782cd?{'count':_0x3efed6,'rows':_0x4782cd}:null;}})['then'](respondWithResult(_0x23e36c,null))['catch'](handleError(_0x23e36c,null));};exports[_0x5f75('0x5b')]=function(_0x3b5b34,_0x301606,_0x1adc2f){if(_0x3b5b34[_0x5f75('0x47')]['id']){delete _0x3b5b34[_0x5f75('0x47')]['id'];}return db[_0x5f75('0x2c')]['find']({'where':{'id':_0x3b5b34['params']['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x301606,null))[_0x5f75('0x24')](function(_0x5e6c9f){if(_0x5e6c9f){_0x3b5b34[_0x5f75('0x47')][_0x5f75('0x5c')]=_0x5e6c9f['id'];return db[_0x5f75('0x5d')]['create'](_0x3b5b34[_0x5f75('0x47')]);}})[_0x5f75('0x24')](respondWithResult(_0x301606,null))[_0x5f75('0x42')](handleError(_0x301606,null));};exports[_0x5f75('0x5e')]=function(_0x34a47e,_0x54dcf9,_0xac9c7){var _0x2d1be3={};var _0x35bc52={};var _0x15499b;var _0x19439d;return db[_0x5f75('0x2c')][_0x5f75('0x56')]({'where':{'id':_0x34a47e['params']['id']}})[_0x5f75('0x24')](handleEntityNotFound(_0x54dcf9,null))[_0x5f75('0x24')](function(_0x25c621){if(_0x25c621){_0x15499b=_0x25c621;_0x35bc52[_0x5f75('0x30')]=_['keys'](db['Action'][_0x5f75('0x2d')]);_0x35bc52[_0x5f75('0x31')]=_[_0x5f75('0x45')](_0x34a47e[_0x5f75('0x31')]);_0x35bc52[_0x5f75('0x39')]=_['intersection'](_0x35bc52[_0x5f75('0x30')],_0x35bc52[_0x5f75('0x31')]);_0x2d1be3[_0x5f75('0x34')]=_['intersection'](_0x35bc52[_0x5f75('0x30')],qs[_0x5f75('0x33')](_0x34a47e[_0x5f75('0x31')][_0x5f75('0x33')]));_0x2d1be3[_0x5f75('0x34')]=_0x2d1be3['attributes'][_0x5f75('0x35')]?_0x2d1be3[_0x5f75('0x34')]:_0x35bc52[_0x5f75('0x30')];_0x2d1be3[_0x5f75('0x37')]=qs['sort'](_0x34a47e['query'][_0x5f75('0x57')]);_0x2d1be3[_0x5f75('0x38')]=qs[_0x5f75('0x39')](_['pick'](_0x34a47e[_0x5f75('0x31')],_0x35bc52[_0x5f75('0x39')]));if(_0x34a47e[_0x5f75('0x31')][_0x5f75('0x58')]){_0x2d1be3[_0x5f75('0x38')]=_[_0x5f75('0x3b')](_0x2d1be3[_0x5f75('0x38')],{'$or':_['map'](_0x2d1be3[_0x5f75('0x34')],function(_0x28f2ba){var _0x152e8f={};_0x152e8f[_0x28f2ba]={'$like':'%'+_0x34a47e['query'][_0x5f75('0x58')]+'%'};return _0x152e8f;})});}_0x2d1be3=_[_0x5f75('0x3b')]({},_0x2d1be3,_0x34a47e[_0x5f75('0x3d')]);return _0x15499b[_0x5f75('0x5e')](_0x2d1be3);}})[_0x5f75('0x24')](function(_0x5490a4){if(_0x5490a4){_0x19439d=_0x5490a4['length'];if(!_0x34a47e[_0x5f75('0x31')][_0x5f75('0x36')]('nolimit')){_0x2d1be3[_0x5f75('0x1a')]=qs[_0x5f75('0x1a')](_0x34a47e[_0x5f75('0x31')][_0x5f75('0x1a')]);_0x2d1be3['offset']=qs[_0x5f75('0x1c')](_0x34a47e[_0x5f75('0x31')][_0x5f75('0x1c')]);}return _0x15499b[_0x5f75('0x5e')](_0x2d1be3);}})[_0x5f75('0x24')](function(_0x1a2803){if(_0x1a2803){return _0x1a2803?{'count':_0x19439d,'rows':_0x1a2803}:null;}})[_0x5f75('0x24')](respondWithResult(_0x54dcf9,null))['catch'](handleError(_0x54dcf9,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8ceac5e..2d927fc 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 _0x1fdc=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','lodash','util','api','moment'];(function(_0x383ac6,_0x458d03){var _0x4bc0d0=function(_0x235180){while(--_0x235180){_0x383ac6['push'](_0x383ac6['shift']());}};_0x4bc0d0(++_0x458d03);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1fdc[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xc1fd('0x0'));var util=require(_0xc1fd('0x1'));var logger=require('../../config/logger')(_0xc1fd('0x2'));var moment=require(_0xc1fd('0x3'));var BPromise=require(_0xc1fd('0x4'));var rp=require(_0xc1fd('0x5'));var fs=require('fs');var path=require(_0xc1fd('0x6'));var rimraf=require(_0xc1fd('0x7'));var config=require(_0xc1fd('0x8'));var attributes=require('./trigger.attributes');module[_0xc1fd('0x9')]=function(_0x141dab,_0x43cd02){return _0x141dab[_0xc1fd('0xa')](_0xc1fd('0xb'),attributes,{'tableName':_0xc1fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde9d=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./trigger.attributes'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xde9d,0x156));var _0xdde9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xde9d[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var logger=require(_0xdde9('0x2'))(_0xdde9('0x3'));var moment=require(_0xdde9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdde9('0x5'));var fs=require('fs');var path=require(_0xdde9('0x6'));var rimraf=require(_0xdde9('0x7'));var config=require('../../config/environment');var attributes=require(_0xdde9('0x8'));module[_0xdde9('0x9')]=function(_0x1ea43e,_0x4c10e9){return _0x1ea43e[_0xdde9('0xa')](_0xdde9('0xb'),attributes,{'tableName':_0xdde9('0xc'),'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 b3434bb..b153956 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 _0x9034=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetTrigger','Trigger','ShowTrigger','stringify'];(function(_0x46fb8a,_0x25c3b8){var _0x5b10d7=function(_0x169554){while(--_0x169554){_0x46fb8a['push'](_0x46fb8a['shift']());}};_0x5b10d7(++_0x25c3b8);}(_0x9034,0xaa));var _0x4903=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9034[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x4903('0x0'));var util=require(_0x4903('0x1'));var moment=require(_0x4903('0x2'));var BPromise=require('bluebird');var rs=require(_0x4903('0x3'));var fs=require('fs');var Redis=require(_0x4903('0x4'));var db=require(_0x4903('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4903('0x6'))(_0x4903('0x7'));var config=require(_0x4903('0x8'));var jayson=require(_0x4903('0x9'));var client=jayson['client'][_0x4903('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12290a,_0xc9667a,_0x1c2933){return new BPromise(function(_0x241a03,_0x483c7d){return client[_0x4903('0xb')](_0x12290a,_0x1c2933)[_0x4903('0xc')](function(_0x4f6509){logger[_0x4903('0xd')](_0x4903('0xe'),_0xc9667a,_0x4903('0xf'));logger[_0x4903('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0xc9667a,_0x4903('0xf'),JSON['stringify'](_0x4f6509));if(_0x4f6509[_0x4903('0x11')]){if(_0x4f6509['error'][_0x4903('0x12')]===0x1f4){logger[_0x4903('0x11')](_0x4903('0xe'),_0xc9667a,_0x4f6509['error'][_0x4903('0x13')]);return _0x483c7d(_0x4f6509[_0x4903('0x11')]['message']);}logger[_0x4903('0x11')](_0x4903('0xe'),_0xc9667a,_0x4f6509['error'][_0x4903('0x13')]);return _0x241a03(_0x4f6509['error'][_0x4903('0x13')]);}else{logger['info'](_0x4903('0xe'),_0xc9667a,_0x4903('0xf'));_0x241a03(_0x4f6509['result'][_0x4903('0x13')]);}})[_0x4903('0x14')](function(_0x2b9d29){logger[_0x4903('0x11')](_0x4903('0xe'),_0xc9667a,_0x2b9d29);_0x483c7d(_0x2b9d29);});});}exports['GetTrigger']=function(_0xd39784){var _0x3f60fd=this;return new Promise(function(_0x36f085,_0x35a7ac){return db['Trigger'][_0x4903('0x15')]({'raw':_0xd39784[_0x4903('0x16')]?_0xd39784[_0x4903('0x16')][_0x4903('0x17')]===undefined?!![]:![]:!![],'where':_0xd39784['options']?_0xd39784[_0x4903('0x16')][_0x4903('0x18')]||null:null,'attributes':_0xd39784[_0x4903('0x16')]?_0xd39784[_0x4903('0x16')]['attributes']||null:null,'limit':_0xd39784[_0x4903('0x16')]?_0xd39784['options'][_0x4903('0x19')]||null:null,'include':_0xd39784[_0x4903('0x16')]?_0xd39784[_0x4903('0x16')][_0x4903('0x1a')]?_[_0x4903('0x1b')](_0xd39784[_0x4903('0x16')]['include'],function(_0x1db90c){return{'model':db[_0x1db90c[_0x4903('0x1c')]],'as':_0x1db90c['as'],'attributes':_0x1db90c[_0x4903('0x1d')],'include':_0x1db90c[_0x4903('0x1a')]?_['map'](_0x1db90c[_0x4903('0x1a')],function(_0x3437c5){return{'model':db[_0x3437c5[_0x4903('0x1c')]],'as':_0x3437c5['as'],'attributes':_0x3437c5[_0x4903('0x1d')],'include':_0x3437c5['include']?_[_0x4903('0x1b')](_0x3437c5['include'],function(_0x4adb13){return{'model':db[_0x4adb13['model']],'as':_0x4adb13['as'],'attributes':_0x4adb13[_0x4903('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4903('0xc')](function(_0x33ffe3){logger[_0x4903('0xd')](_0x4903('0x1e'),_0xd39784);logger[_0x4903('0x10')](_0x4903('0x1e'),_0xd39784,JSON['stringify'](_0x33ffe3));_0x36f085(_0x33ffe3);})[_0x4903('0x14')](function(_0x1b1a21){logger[_0x4903('0x11')]('GetTrigger',_0x1b1a21[_0x4903('0x13')],_0xd39784);_0x35a7ac(_0x3f60fd[_0x4903('0x11')](0x1f4,_0x1b1a21[_0x4903('0x13')]));});});};exports['ShowTrigger']=function(_0x3df97c){var _0x152628=this;return new Promise(function(_0x2af1a3,_0x34f3c3){return db[_0x4903('0x1f')]['find']({'raw':_0x3df97c[_0x4903('0x16')]?_0x3df97c[_0x4903('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3df97c['options']?_0x3df97c[_0x4903('0x16')][_0x4903('0x18')]||null:null,'attributes':_0x3df97c[_0x4903('0x16')]?_0x3df97c[_0x4903('0x16')][_0x4903('0x1d')]||null:null,'include':_0x3df97c[_0x4903('0x16')]?_0x3df97c['options'][_0x4903('0x1a')]?_[_0x4903('0x1b')](_0x3df97c[_0x4903('0x16')]['include'],function(_0x3e32a9){return{'model':db[_0x3e32a9['model']],'as':_0x3e32a9['as'],'attributes':_0x3e32a9['attributes'],'include':_0x3e32a9[_0x4903('0x1a')]?_[_0x4903('0x1b')](_0x3e32a9[_0x4903('0x1a')],function(_0x3b0530){return{'model':db[_0x3b0530[_0x4903('0x1c')]],'as':_0x3b0530['as'],'attributes':_0x3b0530[_0x4903('0x1d')],'include':_0x3b0530['include']?_[_0x4903('0x1b')](_0x3b0530[_0x4903('0x1a')],function(_0x1a86ae){return{'model':db[_0x1a86ae[_0x4903('0x1c')]],'as':_0x1a86ae['as'],'attributes':_0x1a86ae[_0x4903('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4903('0xc')](function(_0x723932){logger[_0x4903('0xd')](_0x4903('0x20'),_0x3df97c);logger[_0x4903('0x10')](_0x4903('0x20'),_0x3df97c,JSON[_0x4903('0x21')](_0x723932));_0x2af1a3(_0x723932);})[_0x4903('0x14')](function(_0x233b0c){logger[_0x4903('0x11')](_0x4903('0x20'),_0x233b0c[_0x4903('0x13')],_0x3df97c);_0x34f3c3(_0x152628[_0x4903('0x11')](0x1f4,_0x233b0c[_0x4903('0x13')]));});});}; \ No newline at end of file +var _0x0cdc=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','Trigger,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','map','include','model','then','GetTrigger','find','ShowTrigger','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xf89d06,_0x54c9dd){var _0x332333=function(_0x410806){while(--_0x410806){_0xf89d06['push'](_0xf89d06['shift']());}};_0x332333(++_0x54c9dd);}(_0x0cdc,0x113));var _0xc0cd=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x0cdc[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0xc0cd('0x0'));var util=require('util');var moment=require(_0xc0cd('0x1'));var BPromise=require(_0xc0cd('0x2'));var rs=require(_0xc0cd('0x3'));var fs=require('fs');var Redis=require(_0xc0cd('0x4'));var db=require(_0xc0cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0cd('0x6'))('rpc');var config=require(_0xc0cd('0x7'));var jayson=require(_0xc0cd('0x8'));var client=jayson[_0xc0cd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53bf3e,_0x538713,_0x3a6ff1){return new BPromise(function(_0x2b0f78,_0x2a21bd){return client[_0xc0cd('0xa')](_0x53bf3e,_0x3a6ff1)['then'](function(_0x3b369a){logger[_0xc0cd('0xb')](_0xc0cd('0xc'),_0x538713,'request\x20sent');logger[_0xc0cd('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x538713,_0xc0cd('0xe'),JSON[_0xc0cd('0xf')](_0x3b369a));if(_0x3b369a['error']){if(_0x3b369a[_0xc0cd('0x10')][_0xc0cd('0x11')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x538713,_0x3b369a[_0xc0cd('0x10')][_0xc0cd('0x12')]);return _0x2a21bd(_0x3b369a[_0xc0cd('0x10')][_0xc0cd('0x12')]);}logger[_0xc0cd('0x10')]('Trigger,\x20%s,\x20%s',_0x538713,_0x3b369a[_0xc0cd('0x10')]['message']);return _0x2b0f78(_0x3b369a[_0xc0cd('0x10')]['message']);}else{logger['info'](_0xc0cd('0xc'),_0x538713,_0xc0cd('0xe'));_0x2b0f78(_0x3b369a[_0xc0cd('0x13')][_0xc0cd('0x12')]);}})[_0xc0cd('0x14')](function(_0x3e56e9){logger['error']('Trigger,\x20%s,\x20%s',_0x538713,_0x3e56e9);_0x2a21bd(_0x3e56e9);});});}exports['GetTrigger']=function(_0x12c87c){var _0x2bf902=this;return new Promise(function(_0x15236b,_0x2ebd25){return db[_0xc0cd('0x15')][_0xc0cd('0x16')]({'raw':_0x12c87c[_0xc0cd('0x17')]?_0x12c87c['options'][_0xc0cd('0x18')]===undefined?!![]:![]:!![],'where':_0x12c87c['options']?_0x12c87c['options'][_0xc0cd('0x19')]||null:null,'attributes':_0x12c87c[_0xc0cd('0x17')]?_0x12c87c[_0xc0cd('0x17')][_0xc0cd('0x1a')]||null:null,'limit':_0x12c87c[_0xc0cd('0x17')]?_0x12c87c[_0xc0cd('0x17')][_0xc0cd('0x1b')]||null:null,'include':_0x12c87c[_0xc0cd('0x17')]?_0x12c87c[_0xc0cd('0x17')]['include']?_[_0xc0cd('0x1c')](_0x12c87c[_0xc0cd('0x17')][_0xc0cd('0x1d')],function(_0x167b89){return{'model':db[_0x167b89['model']],'as':_0x167b89['as'],'attributes':_0x167b89['attributes'],'include':_0x167b89[_0xc0cd('0x1d')]?_['map'](_0x167b89[_0xc0cd('0x1d')],function(_0x4ffd6d){return{'model':db[_0x4ffd6d[_0xc0cd('0x1e')]],'as':_0x4ffd6d['as'],'attributes':_0x4ffd6d['attributes'],'include':_0x4ffd6d[_0xc0cd('0x1d')]?_[_0xc0cd('0x1c')](_0x4ffd6d['include'],function(_0x37ab98){return{'model':db[_0x37ab98['model']],'as':_0x37ab98['as'],'attributes':_0x37ab98[_0xc0cd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc0cd('0x1f')](function(_0x320ea8){logger[_0xc0cd('0xb')](_0xc0cd('0x20'),_0x12c87c);logger[_0xc0cd('0xd')](_0xc0cd('0x20'),_0x12c87c,JSON[_0xc0cd('0xf')](_0x320ea8));_0x15236b(_0x320ea8);})['catch'](function(_0x87cb4b){logger[_0xc0cd('0x10')]('GetTrigger',_0x87cb4b[_0xc0cd('0x12')],_0x12c87c);_0x2ebd25(_0x2bf902[_0xc0cd('0x10')](0x1f4,_0x87cb4b['message']));});});};exports['ShowTrigger']=function(_0x22d308){var _0x199d6c=this;return new Promise(function(_0x2c9131,_0x1adfe0){return db[_0xc0cd('0x15')][_0xc0cd('0x21')]({'raw':_0x22d308[_0xc0cd('0x17')]?_0x22d308[_0xc0cd('0x17')][_0xc0cd('0x18')]===undefined?!![]:![]:!![],'where':_0x22d308['options']?_0x22d308[_0xc0cd('0x17')][_0xc0cd('0x19')]||null:null,'attributes':_0x22d308[_0xc0cd('0x17')]?_0x22d308[_0xc0cd('0x17')][_0xc0cd('0x1a')]||null:null,'include':_0x22d308[_0xc0cd('0x17')]?_0x22d308[_0xc0cd('0x17')][_0xc0cd('0x1d')]?_[_0xc0cd('0x1c')](_0x22d308['options'][_0xc0cd('0x1d')],function(_0x2523b3){return{'model':db[_0x2523b3['model']],'as':_0x2523b3['as'],'attributes':_0x2523b3['attributes'],'include':_0x2523b3[_0xc0cd('0x1d')]?_['map'](_0x2523b3['include'],function(_0x5cc42e){return{'model':db[_0x5cc42e[_0xc0cd('0x1e')]],'as':_0x5cc42e['as'],'attributes':_0x5cc42e[_0xc0cd('0x1a')],'include':_0x5cc42e[_0xc0cd('0x1d')]?_['map'](_0x5cc42e[_0xc0cd('0x1d')],function(_0x4e8571){return{'model':db[_0x4e8571[_0xc0cd('0x1e')]],'as':_0x4e8571['as'],'attributes':_0x4e8571[_0xc0cd('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x581553){logger[_0xc0cd('0xb')](_0xc0cd('0x22'),_0x22d308);logger[_0xc0cd('0xd')](_0xc0cd('0x22'),_0x22d308,JSON[_0xc0cd('0xf')](_0x581553));_0x2c9131(_0x581553);})[_0xc0cd('0x14')](function(_0x44c04e){logger[_0xc0cd('0x10')](_0xc0cd('0x22'),_0x44c04e[_0xc0cd('0x12')],_0x22d308);_0x1adfe0(_0x199d6c[_0xc0cd('0x10')](0x1f4,_0x44c04e['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3f062f9..33dab65 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 _0x5a20=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create'];(function(_0x58ecb4,_0x2c03c4){var _0x4b2adc=function(_0x1f4ac0){while(--_0x1f4ac0){_0x58ecb4['push'](_0x58ecb4['shift']());}};_0x4b2adc(++_0x2c03c4);}(_0x5a20,0x1a5));var _0x05a2=function(_0xd4a743,_0x2d70ea){_0xd4a743=_0xd4a743-0x0;var _0x5e564c=_0x5a20[_0xd4a743];return _0x5e564c;};'use strict';var multer=require(_0x05a2('0x0'));var util=require(_0x05a2('0x1'));var path=require(_0x05a2('0x2'));var timeout=require(_0x05a2('0x3'));var express=require(_0x05a2('0x4'));var router=express[_0x05a2('0x5')]();var fs_extra=require(_0x05a2('0x6'));var auth=require(_0x05a2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x05a2('0x8'));var controller=require(_0x05a2('0x9'));router[_0x05a2('0xa')]('/',auth[_0x05a2('0xb')](),controller[_0x05a2('0xc')]);router['get'](_0x05a2('0xd'),auth[_0x05a2('0xb')](),controller[_0x05a2('0xe')]);router[_0x05a2('0xf')](_0x05a2('0x10'),auth[_0x05a2('0xb')](),controller[_0x05a2('0x11')]);router[_0x05a2('0xf')]('/',auth[_0x05a2('0xb')](),controller[_0x05a2('0x12')]);router['put'](_0x05a2('0xd'),auth[_0x05a2('0xb')](),controller[_0x05a2('0x13')]);router[_0x05a2('0x14')](_0x05a2('0xd'),auth[_0x05a2('0xb')](),controller['destroy']);module[_0x05a2('0x15')]=router; \ No newline at end of file +var _0xae4d=['/:id','isAuthenticated','show','/:id/clone','clone','post','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x23cfae,_0x2ee6b3){var _0x2c8e9b=function(_0xa1e65c){while(--_0xa1e65c){_0x23cfae['push'](_0x23cfae['shift']());}};_0x2c8e9b(++_0x2ee6b3);}(_0xae4d,0x195));var _0xdae4=function(_0x3d89dc,_0x5afe5f){_0x3d89dc=_0x3d89dc-0x0;var _0x20eb03=_0xae4d[_0x3d89dc];return _0x20eb03;};'use strict';var multer=require(_0xdae4('0x0'));var util=require('util');var path=require(_0xdae4('0x1'));var timeout=require('connect-timeout');var express=require(_0xdae4('0x2'));var router=express[_0xdae4('0x3')]();var fs_extra=require(_0xdae4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdae4('0x5'));var config=require(_0xdae4('0x6'));var controller=require(_0xdae4('0x7'));router[_0xdae4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdae4('0x8')](_0xdae4('0x9'),auth[_0xdae4('0xa')](),controller[_0xdae4('0xb')]);router['post'](_0xdae4('0xc'),auth['isAuthenticated'](),controller[_0xdae4('0xd')]);router[_0xdae4('0xe')]('/',auth[_0xdae4('0xa')](),controller['create']);router['put']('/:id',auth[_0xdae4('0xa')](),controller['update']);router[_0xdae4('0xf')](_0xdae4('0x9'),auth['isAuthenticated'](),controller[_0xdae4('0x10')]);module[_0xdae4('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index bc7e683..e631a61 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 _0x1c71=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','pai','fingerprint','active','actpass','dynamic','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','join'];(function(_0x36e137,_0x39e47d){var _0x528d6d=function(_0x28c983){while(--_0x28c983){_0x36e137['push'](_0x36e137['shift']());}};_0x528d6d(++_0x39e47d);}(_0x1c71,0x118));var _0x11c7=function(_0x16a254,_0x1dabec){_0x16a254=_0x16a254-0x0;var _0x108d9e=_0x1c71[_0x16a254];return _0x108d9e;};'use strict';var Sequelize=require(_0x11c7('0x0'));module[_0x11c7('0x1')]={'name':{'type':Sequelize[_0x11c7('0x2')],'allowNull':![],'unique':_0x11c7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x5'),'user',_0x11c7('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x11c7('0x2')],'allowNull':![],'defaultValue':_0x11c7('0x7')},'callingpres':{'type':Sequelize[_0x11c7('0x4')]('ALLOWED_NOT_SCREENED',_0x11c7('0x8'),_0x11c7('0x9'),_0x11c7('0xa'),_0x11c7('0xb'),_0x11c7('0xc'),_0x11c7('0xd'),_0x11c7('0xe'))},'deny':{'type':Sequelize[_0x11c7('0x2')]},'permit':{'type':Sequelize[_0x11c7('0x2')]},'secret':{'type':Sequelize[_0x11c7('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x11c7('0x2')],'defaultValue':_0x11c7('0xf'),'set':function(_0x10de21){this[_0x11c7('0x10')]('transport',_0x10de21?_0x10de21['join'](','):null);},'get':function(){return this[_0x11c7('0x11')]('transport')?this[_0x11c7('0x11')](_0x11c7('0x12'))[_0x11c7('0x13')](','):null;},'comment':_0x11c7('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0x11c7('0x15'),_0x11c7('0x16'),_0x11c7('0x17'),_0x11c7('0x18'),_0x11c7('0x19')),'defaultValue':_0x11c7('0x15')},'directmedia':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no',_0x11c7('0x1b'),_0x11c7('0x1c'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x11c7('0x2')]},'directmediadeny':{'type':Sequelize[_0x11c7('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x11c7('0x1d'),'set':function(_0xbcbf87){this[_0x11c7('0x10')](_0x11c7('0x1e'),_0xbcbf87?_0xbcbf87[_0x11c7('0x1f')](','):null);},'get':function(){return this[_0x11c7('0x11')]('nat')?this[_0x11c7('0x11')](_0x11c7('0x1e'))['split'](','):null;},'comment':_0x11c7('0x20')},'callgroup':{'type':Sequelize[_0x11c7('0x2')]},'namedcallgroup':{'type':Sequelize[_0x11c7('0x2')]},'pickupgroup':{'type':Sequelize[_0x11c7('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x11c7('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x11c7('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x11c7('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5ded4d){this[_0x11c7('0x10')]('allow',_0x5ded4d?_0x5ded4d[_0x11c7('0x1f')](';'):_0x11c7('0x21'));},'get':function(){return this[_0x11c7('0x11')](_0x11c7('0x22'))?this[_0x11c7('0x11')]('allow')[_0x11c7('0x13')](';'):null;},'comment':_0x11c7('0x23')},'autoframing':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no')},'insecure':{'type':Sequelize[_0x11c7('0x2')],'defaultValue':_0x11c7('0x24'),'set':function(_0x159a0f){this[_0x11c7('0x10')](_0x11c7('0x25'),_0x159a0f?_0x159a0f[_0x11c7('0x1f')](','):null);},'get':function(){return this[_0x11c7('0x11')]('insecure')?this['getDataValue'](_0x11c7('0x25'))[_0x11c7('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no',_0x11c7('0x26'))},'promiscredir':{'type':Sequelize[_0x11c7('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x11c7('0x2')]},'callerid':{'type':Sequelize[_0x11c7('0x2')],'defaultValue':_0x11c7('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x11c7('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0x11c7('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x11c7('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x11c7('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x11c7('0x1a'),'no',_0x11c7('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x11c7('0x4')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x2a'),_0x11c7('0x2b'),_0x11c7('0x2c'))},'session_expires':{'type':Sequelize[_0x11c7('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x11c7('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x2d'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x11c7('0x2')]},'fromdomain':{'type':Sequelize[_0x11c7('0x2')]},'fromuser':{'type':Sequelize[_0x11c7('0x2')]},'port':{'type':Sequelize[_0x11c7('0x28')](0x5)},'qualify':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no'),'defaultValue':_0x11c7('0x1a')},'keepalive':{'type':Sequelize[_0x11c7('0x28')](0xb)},'defaultip':{'type':Sequelize[_0x11c7('0x2')]},'defaultuser':{'type':Sequelize[_0x11c7('0x2')]},'rtptimeout':{'type':Sequelize[_0x11c7('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x11c7('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x11c7('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no',_0x11c7('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x11c7('0x2')]},'timert1':{'type':Sequelize[_0x11c7('0x28')](0xb)},'timerb':{'type':Sequelize[_0x11c7('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x11c7('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0x11c7('0x2')]},'contactdeny':{'type':Sequelize[_0x11c7('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x11c7('0x2')]},'use_q850_reason':{'type':Sequelize[_0x11c7('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x11c7('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x11c7('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no',_0x11c7('0x2f'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x11c7('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x11c7('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x11c7('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x11c7('0x2')]},'dtlscapath':{'type':Sequelize[_0x11c7('0x2')]},'dtlssetup':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x30'),'passive',_0x11c7('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x11c7('0x2')]},'usereqphone':{'type':Sequelize[_0x11c7('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x11c7('0x2')]},'recordofffeature':{'type':Sequelize[_0x11c7('0x2')]},'call_limit':{'type':Sequelize[_0x11c7('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x11c7('0x4')](_0x11c7('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x11c7('0x2')]},'mohinterpret':{'type':Sequelize[_0x11c7('0x2')]},'mohsuggest':{'type':Sequelize[_0x11c7('0x2')]},'parkinglot':{'type':Sequelize[_0x11c7('0x2')]},'description':{'type':Sequelize[_0x11c7('0x2')]},'host':{'type':Sequelize[_0x11c7('0x2')],'defaultValue':_0x11c7('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0x11c7('0x1a'),'no',_0x11c7('0x1b'),_0x11c7('0x1c'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x11c7('0x2')]},'otherFields':{'type':Sequelize[_0x11c7('0x2')]},'active':{'type':Sequelize[_0x11c7('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x7e14=['ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','always','originate','uac','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x2ddef5,_0x4f54da){var _0xd2eb5b=function(_0x2a5ab8){while(--_0x2a5ab8){_0x2ddef5['push'](_0x2ddef5['shift']());}};_0xd2eb5b(++_0x4f54da);}(_0x7e14,0x18b));var _0x47e1=function(_0x2bc375,_0x1fb66d){_0x2bc375=_0x2bc375-0x0;var _0x516311=_0x7e14[_0x2bc375];return _0x516311;};'use strict';var Sequelize=require(_0x47e1('0x0'));module[_0x47e1('0x1')]={'name':{'type':Sequelize[_0x47e1('0x2')],'allowNull':![],'unique':_0x47e1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x5'),'user','peer'),'allowNull':![],'defaultValue':_0x47e1('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47e1('0x6')},'callingpres':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x7'),'ALLOWED_PASSED_SCREEN',_0x47e1('0x8'),_0x47e1('0x9'),_0x47e1('0xa'),_0x47e1('0xb'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x47e1('0x2')]},'permit':{'type':Sequelize[_0x47e1('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x47e1('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':'udp','set':function(_0x8af426){this[_0x47e1('0xc')](_0x47e1('0xd'),_0x8af426?_0x8af426[_0x47e1('0xe')](','):null);},'get':function(){return this[_0x47e1('0xf')](_0x47e1('0xd'))?this['getDataValue'](_0x47e1('0xd'))[_0x47e1('0x10')](','):null;},'comment':_0x47e1('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0x47e1('0x12'),_0x47e1('0x13'),_0x47e1('0x14'),'inband','auto'),'defaultValue':_0x47e1('0x12')},'directmedia':{'type':Sequelize[_0x47e1('0x4')]('yes','no',_0x47e1('0x15'),_0x47e1('0x16'),_0x47e1('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x47e1('0x2')]},'directmediadeny':{'type':Sequelize[_0x47e1('0x2')]},'nat':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':_0x47e1('0x19'),'set':function(_0x85a6ea){this[_0x47e1('0xc')](_0x47e1('0x1a'),_0x85a6ea?_0x85a6ea['join'](','):null);},'get':function(){return this[_0x47e1('0xf')](_0x47e1('0x1a'))?this[_0x47e1('0xf')](_0x47e1('0x1a'))['split'](','):null;},'comment':_0x47e1('0x1b')},'callgroup':{'type':Sequelize[_0x47e1('0x2')]},'namedcallgroup':{'type':Sequelize[_0x47e1('0x2')]},'pickupgroup':{'type':Sequelize[_0x47e1('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x47e1('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x47e1('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x47e1('0x2')],'allowNull':![],'defaultValue':_0x47e1('0x1c'),'set':function(_0x210825){this[_0x47e1('0xc')](_0x47e1('0x1d'),_0x210825?_0x210825[_0x47e1('0xe')](';'):_0x47e1('0x1c'));},'get':function(){return this['getDataValue']('allow')?this[_0x47e1('0xf')](_0x47e1('0x1d'))['split'](';'):null;},'comment':_0x47e1('0x1e')},'autoframing':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'insecure':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':_0x47e1('0x1f'),'set':function(_0x3976a4){this['setDataValue'](_0x47e1('0x20'),_0x3976a4?_0x3976a4['join'](','):null);},'get':function(){return this[_0x47e1('0xf')](_0x47e1('0x20'))?this['getDataValue'](_0x47e1('0x20'))[_0x47e1('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x47e1('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no',_0x47e1('0x21'))},'promiscredir':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':_0x47e1('0x22')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x47e1('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x47e1('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x47e1('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no',_0x47e1('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x47e1('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'mailbox':{'type':Sequelize[_0x47e1('0x2')]},'session_timers':{'type':Sequelize[_0x47e1('0x4')]('accept','refuse',_0x47e1('0x25'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x26'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x47e1('0x2')]},'port':{'type':Sequelize[_0x47e1('0x23')](0x5)},'qualify':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no'),'defaultValue':_0x47e1('0x18')},'keepalive':{'type':Sequelize[_0x47e1('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x47e1('0x2')]},'defaultuser':{'type':Sequelize[_0x47e1('0x2')]},'rtptimeout':{'type':Sequelize[_0x47e1('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x47e1('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no',_0x47e1('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x47e1('0x2')]},'callbackextension':{'type':Sequelize[_0x47e1('0x2')]},'timert1':{'type':Sequelize[_0x47e1('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x47e1('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x47e1('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x47e1('0x2')]},'maxforwards':{'type':Sequelize[_0x47e1('0x23')](0xb)},'encryption':{'type':Sequelize[_0x47e1('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'force_avp':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'icesupport':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x47e1('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no',_0x47e1('0x28'),_0x47e1('0x29'))},'dtlsrekey':{'type':Sequelize[_0x47e1('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x47e1('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x47e1('0x2')]},'dtlscipher':{'type':Sequelize[_0x47e1('0x2')]},'dtlscafile':{'type':Sequelize[_0x47e1('0x2')]},'dtlscapath':{'type':Sequelize[_0x47e1('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x47e1('0x2a'),_0x47e1('0x2b'),_0x47e1('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x47e1('0x2')]},'recordofffeature':{'type':Sequelize[_0x47e1('0x2')]},'call_limit':{'type':Sequelize[_0x47e1('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x47e1('0x18'),'no')},'vmexten':{'type':Sequelize[_0x47e1('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x47e1('0x2')],'defaultValue':_0x47e1('0x2d')},'canreinvite':{'type':Sequelize[_0x47e1('0x4')](_0x47e1('0x18'),'no',_0x47e1('0x15'),_0x47e1('0x16'),_0x47e1('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x47e1('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x47e1('0x2')],'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 e016913..cb30f11 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 _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x5d014c,_0x229613){var _0x3dc38c=function(_0x143ca0){while(--_0x143ca0){_0x5d014c['push'](_0x5d014c['shift']());}};_0x3dc38c(++_0x229613);}(_0x8ef6,0xf2));var _0x68ef=function(_0x256872,_0x127ff1){_0x256872=_0x256872-0x0;var _0x251086=_0x8ef6[_0x256872];return _0x251086;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x30e550,_0x5a7d0b){var _0x107db3=function(_0x28a0af){while(--_0x28a0af){_0x30e550['push'](_0x30e550['shift']());}};_0x107db3(++_0x5a7d0b);}(_0x98a8,0x12c));var _0x898a=function(_0x55e6b,_0x4f48ed){_0x55e6b=_0x55e6b-0x0;var _0x179ed9=_0x98a8[_0x55e6b];return _0x179ed9;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 85ba222..c4eb7dd 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 _0xaea9=['./trunk.attributes','util','api','moment','bluebird','path','rimraf'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0xaea9,0x158));var _0x9aea=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xaea9[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0x9aea('0x0'));var logger=require('../../config/logger')(_0x9aea('0x1'));var moment=require(_0x9aea('0x2'));var BPromise=require(_0x9aea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9aea('0x4'));var rimraf=require(_0x9aea('0x5'));var config=require('../../config/environment');var attributes=require(_0x9aea('0x6'));module['exports']=function(_0x435f55,_0x5af1e1){return _0x435f55['define']('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14ce=['request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','moment','bluebird'];(function(_0x36784c,_0x2e8bb7){var _0x61181e=function(_0x294ce8){while(--_0x294ce8){_0x36784c['push'](_0x36784c['shift']());}};_0x61181e(++_0x2e8bb7);}(_0x14ce,0x194));var _0xe14c=function(_0x1fadb7,_0x414d9c){_0x1fadb7=_0x1fadb7-0x0;var _0x2a0e56=_0x14ce[_0x1fadb7];return _0x2a0e56;};'use strict';var _=require(_0xe14c('0x0'));var util=require('util');var logger=require(_0xe14c('0x1'))('api');var moment=require(_0xe14c('0x2'));var BPromise=require(_0xe14c('0x3'));var rp=require(_0xe14c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe14c('0x5'));var config=require(_0xe14c('0x6'));var attributes=require(_0xe14c('0x7'));module[_0xe14c('0x8')]=function(_0x34812a,_0x1febb3){return _0x34812a[_0xe14c('0x9')](_0xe14c('0xa'),attributes,{'tableName':_0xe14c('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 3871915..ec06708 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 _0xd930=['GetTrunk','Trunk','findAll','options','raw','attributes','limit','map','include','model','ShowTrunk','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x6189f9,_0x4dcac5){var _0x5a14d0=function(_0x30574d){while(--_0x30574d){_0x6189f9['push'](_0x6189f9['shift']());}};_0x5a14d0(++_0x4dcac5);}(_0xd930,0xa1));var _0x0d93=function(_0x31435b,_0x184522){_0x31435b=_0x31435b-0x0;var _0x51892a=_0xd930[_0x31435b];return _0x51892a;};'use strict';var _=require(_0x0d93('0x0'));var util=require(_0x0d93('0x1'));var moment=require(_0x0d93('0x2'));var BPromise=require(_0x0d93('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d93('0x4'));var db=require(_0x0d93('0x5'))['db'];var utils=require(_0x0d93('0x6'));var logger=require('../../config/logger')(_0x0d93('0x7'));var config=require(_0x0d93('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d93('0x9')][_0x0d93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x202155,_0x4bd65d,_0x71a3d3){return new BPromise(function(_0x1e23bc,_0x3e1a04){return client[_0x0d93('0xb')](_0x202155,_0x71a3d3)[_0x0d93('0xc')](function(_0x3af0c9){logger[_0x0d93('0xd')](_0x0d93('0xe'),_0x4bd65d,_0x0d93('0xf'));logger[_0x0d93('0x10')](_0x0d93('0x11'),_0x4bd65d,_0x0d93('0xf'),JSON[_0x0d93('0x12')](_0x3af0c9));if(_0x3af0c9['error']){if(_0x3af0c9['error'][_0x0d93('0x13')]===0x1f4){logger[_0x0d93('0x14')](_0x0d93('0xe'),_0x4bd65d,_0x3af0c9[_0x0d93('0x14')][_0x0d93('0x15')]);return _0x3e1a04(_0x3af0c9[_0x0d93('0x14')][_0x0d93('0x15')]);}logger[_0x0d93('0x14')](_0x0d93('0xe'),_0x4bd65d,_0x3af0c9[_0x0d93('0x14')][_0x0d93('0x15')]);return _0x1e23bc(_0x3af0c9[_0x0d93('0x14')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x4bd65d,'request\x20sent');_0x1e23bc(_0x3af0c9[_0x0d93('0x16')][_0x0d93('0x15')]);}})[_0x0d93('0x17')](function(_0x28d730){logger[_0x0d93('0x14')](_0x0d93('0xe'),_0x4bd65d,_0x28d730);_0x3e1a04(_0x28d730);});});}exports[_0x0d93('0x18')]=function(_0xeb9b02){var _0x4dccfc=this;return new Promise(function(_0x5e2cf1,_0x423b41){return db[_0x0d93('0x19')][_0x0d93('0x1a')]({'raw':_0xeb9b02['options']?_0xeb9b02[_0x0d93('0x1b')][_0x0d93('0x1c')]===undefined?!![]:![]:!![],'where':_0xeb9b02[_0x0d93('0x1b')]?_0xeb9b02[_0x0d93('0x1b')]['where']||null:null,'attributes':_0xeb9b02[_0x0d93('0x1b')]?_0xeb9b02[_0x0d93('0x1b')][_0x0d93('0x1d')]||null:null,'limit':_0xeb9b02[_0x0d93('0x1b')]?_0xeb9b02['options'][_0x0d93('0x1e')]||null:null,'include':_0xeb9b02[_0x0d93('0x1b')]?_0xeb9b02[_0x0d93('0x1b')]['include']?_[_0x0d93('0x1f')](_0xeb9b02[_0x0d93('0x1b')][_0x0d93('0x20')],function(_0x422c93){return{'model':db[_0x422c93['model']],'as':_0x422c93['as'],'attributes':_0x422c93[_0x0d93('0x1d')],'include':_0x422c93[_0x0d93('0x20')]?_[_0x0d93('0x1f')](_0x422c93[_0x0d93('0x20')],function(_0x41232f){return{'model':db[_0x41232f[_0x0d93('0x21')]],'as':_0x41232f['as'],'attributes':_0x41232f[_0x0d93('0x1d')],'include':_0x41232f[_0x0d93('0x20')]?_[_0x0d93('0x1f')](_0x41232f[_0x0d93('0x20')],function(_0x431dbb){return{'model':db[_0x431dbb['model']],'as':_0x431dbb['as'],'attributes':_0x431dbb[_0x0d93('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x110551){logger[_0x0d93('0xd')](_0x0d93('0x18'),_0xeb9b02);logger[_0x0d93('0x10')](_0x0d93('0x18'),_0xeb9b02,JSON[_0x0d93('0x12')](_0x110551));_0x5e2cf1(_0x110551);})[_0x0d93('0x17')](function(_0x213e17){logger[_0x0d93('0x14')](_0x0d93('0x18'),_0x213e17[_0x0d93('0x15')],_0xeb9b02);_0x423b41(_0x4dccfc['error'](0x1f4,_0x213e17[_0x0d93('0x15')]));});});};exports[_0x0d93('0x22')]=function(_0x19ab71){var _0x31073b=this;return new Promise(function(_0xab28e,_0x7b66e1){return db[_0x0d93('0x19')][_0x0d93('0x23')]({'raw':_0x19ab71[_0x0d93('0x1b')]?_0x19ab71['options'][_0x0d93('0x1c')]===undefined?!![]:![]:!![],'where':_0x19ab71[_0x0d93('0x1b')]?_0x19ab71[_0x0d93('0x1b')][_0x0d93('0x24')]||null:null,'attributes':_0x19ab71[_0x0d93('0x1b')]?_0x19ab71[_0x0d93('0x1b')]['attributes']||null:null,'include':_0x19ab71[_0x0d93('0x1b')]?_0x19ab71[_0x0d93('0x1b')]['include']?_['map'](_0x19ab71[_0x0d93('0x1b')][_0x0d93('0x20')],function(_0x9ebc78){return{'model':db[_0x9ebc78['model']],'as':_0x9ebc78['as'],'attributes':_0x9ebc78[_0x0d93('0x1d')],'include':_0x9ebc78[_0x0d93('0x20')]?_['map'](_0x9ebc78[_0x0d93('0x20')],function(_0x2f8105){return{'model':db[_0x2f8105['model']],'as':_0x2f8105['as'],'attributes':_0x2f8105[_0x0d93('0x1d')],'include':_0x2f8105[_0x0d93('0x20')]?_['map'](_0x2f8105[_0x0d93('0x20')],function(_0x13f205){return{'model':db[_0x13f205[_0x0d93('0x21')]],'as':_0x13f205['as'],'attributes':_0x13f205[_0x0d93('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d93('0xc')](function(_0x27e38f){logger[_0x0d93('0xd')]('ShowTrunk',_0x19ab71);logger['debug'](_0x0d93('0x22'),_0x19ab71,JSON[_0x0d93('0x12')](_0x27e38f));_0xab28e(_0x27e38f);})[_0x0d93('0x17')](function(_0x5a0f21){logger[_0x0d93('0x14')](_0x0d93('0x22'),_0x5a0f21[_0x0d93('0x15')],_0x19ab71);_0x7b66e1(_0x31073b[_0x0d93('0x14')](0x1f4,_0x5a0f21['message']));});});}; \ No newline at end of file +var _0xe2fa=['ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetTrunk','Trunk','where','options','attributes','limit','include','map','model'];(function(_0xe67b1a,_0x4e64c9){var _0x1492ff=function(_0x435613){while(--_0x435613){_0xe67b1a['push'](_0xe67b1a['shift']());}};_0x1492ff(++_0x4e64c9);}(_0xe2fa,0x123));var _0xae2f=function(_0x3d2a82,_0x596850){_0x3d2a82=_0x3d2a82-0x0;var _0x35730b=_0xe2fa[_0x3d2a82];return _0x35730b;};'use strict';var _=require(_0xae2f('0x0'));var util=require(_0xae2f('0x1'));var moment=require(_0xae2f('0x2'));var BPromise=require(_0xae2f('0x3'));var rs=require(_0xae2f('0x4'));var fs=require('fs');var Redis=require(_0xae2f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae2f('0x6'));var logger=require(_0xae2f('0x7'))('rpc');var config=require(_0xae2f('0x8'));var jayson=require(_0xae2f('0x9'));var client=jayson[_0xae2f('0xa')][_0xae2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42393b,_0x594f7b,_0x54e2b5){return new BPromise(function(_0x4ab145,_0x5977b4){return client[_0xae2f('0xc')](_0x42393b,_0x54e2b5)[_0xae2f('0xd')](function(_0x3afc96){logger['info'](_0xae2f('0xe'),_0x594f7b,'request\x20sent');logger[_0xae2f('0xf')](_0xae2f('0x10'),_0x594f7b,'request\x20sent',JSON[_0xae2f('0x11')](_0x3afc96));if(_0x3afc96[_0xae2f('0x12')]){if(_0x3afc96['error']['code']===0x1f4){logger[_0xae2f('0x12')](_0xae2f('0xe'),_0x594f7b,_0x3afc96['error'][_0xae2f('0x13')]);return _0x5977b4(_0x3afc96[_0xae2f('0x12')][_0xae2f('0x13')]);}logger[_0xae2f('0x12')]('Trunk,\x20%s,\x20%s',_0x594f7b,_0x3afc96[_0xae2f('0x12')][_0xae2f('0x13')]);return _0x4ab145(_0x3afc96['error'][_0xae2f('0x13')]);}else{logger[_0xae2f('0x14')](_0xae2f('0xe'),_0x594f7b,_0xae2f('0x15'));_0x4ab145(_0x3afc96[_0xae2f('0x16')][_0xae2f('0x13')]);}})[_0xae2f('0x17')](function(_0x20deca){logger['error'](_0xae2f('0xe'),_0x594f7b,_0x20deca);_0x5977b4(_0x20deca);});});}exports[_0xae2f('0x18')]=function(_0x327c1f){var _0x218103=this;return new Promise(function(_0x558eaa,_0x18c5d4){return db[_0xae2f('0x19')]['findAll']({'raw':_0x327c1f['options']?_0x327c1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x327c1f['options']?_0x327c1f['options'][_0xae2f('0x1a')]||null:null,'attributes':_0x327c1f[_0xae2f('0x1b')]?_0x327c1f['options'][_0xae2f('0x1c')]||null:null,'limit':_0x327c1f[_0xae2f('0x1b')]?_0x327c1f[_0xae2f('0x1b')][_0xae2f('0x1d')]||null:null,'include':_0x327c1f[_0xae2f('0x1b')]?_0x327c1f['options'][_0xae2f('0x1e')]?_[_0xae2f('0x1f')](_0x327c1f[_0xae2f('0x1b')]['include'],function(_0x575bb5){return{'model':db[_0x575bb5[_0xae2f('0x20')]],'as':_0x575bb5['as'],'attributes':_0x575bb5[_0xae2f('0x1c')],'include':_0x575bb5[_0xae2f('0x1e')]?_[_0xae2f('0x1f')](_0x575bb5[_0xae2f('0x1e')],function(_0x343efd){return{'model':db[_0x343efd['model']],'as':_0x343efd['as'],'attributes':_0x343efd[_0xae2f('0x1c')],'include':_0x343efd['include']?_[_0xae2f('0x1f')](_0x343efd[_0xae2f('0x1e')],function(_0x1d3b34){return{'model':db[_0x1d3b34[_0xae2f('0x20')]],'as':_0x1d3b34['as'],'attributes':_0x1d3b34[_0xae2f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b7666){logger[_0xae2f('0x14')](_0xae2f('0x18'),_0x327c1f);logger[_0xae2f('0xf')](_0xae2f('0x18'),_0x327c1f,JSON['stringify'](_0x2b7666));_0x558eaa(_0x2b7666);})[_0xae2f('0x17')](function(_0x4b22c0){logger[_0xae2f('0x12')](_0xae2f('0x18'),_0x4b22c0[_0xae2f('0x13')],_0x327c1f);_0x18c5d4(_0x218103[_0xae2f('0x12')](0x1f4,_0x4b22c0[_0xae2f('0x13')]));});});};exports[_0xae2f('0x21')]=function(_0x316b7e){var _0x5dd3a9=this;return new Promise(function(_0x27bc96,_0x516132){return db[_0xae2f('0x19')][_0xae2f('0x22')]({'raw':_0x316b7e[_0xae2f('0x1b')]?_0x316b7e['options'][_0xae2f('0x23')]===undefined?!![]:![]:!![],'where':_0x316b7e['options']?_0x316b7e[_0xae2f('0x1b')][_0xae2f('0x1a')]||null:null,'attributes':_0x316b7e['options']?_0x316b7e[_0xae2f('0x1b')]['attributes']||null:null,'include':_0x316b7e[_0xae2f('0x1b')]?_0x316b7e[_0xae2f('0x1b')][_0xae2f('0x1e')]?_[_0xae2f('0x1f')](_0x316b7e[_0xae2f('0x1b')]['include'],function(_0x3ce4fb){return{'model':db[_0x3ce4fb[_0xae2f('0x20')]],'as':_0x3ce4fb['as'],'attributes':_0x3ce4fb['attributes'],'include':_0x3ce4fb[_0xae2f('0x1e')]?_[_0xae2f('0x1f')](_0x3ce4fb[_0xae2f('0x1e')],function(_0x3a1c02){return{'model':db[_0x3a1c02[_0xae2f('0x20')]],'as':_0x3a1c02['as'],'attributes':_0x3a1c02[_0xae2f('0x1c')],'include':_0x3a1c02['include']?_[_0xae2f('0x1f')](_0x3a1c02[_0xae2f('0x1e')],function(_0x43dda9){return{'model':db[_0x43dda9[_0xae2f('0x20')]],'as':_0x43dda9['as'],'attributes':_0x43dda9['attributes']};}):[]};}):[]};}):[]:[]})[_0xae2f('0xd')](function(_0x3cf309){logger[_0xae2f('0x14')](_0xae2f('0x21'),_0x316b7e);logger[_0xae2f('0xf')](_0xae2f('0x21'),_0x316b7e,JSON[_0xae2f('0x11')](_0x3cf309));_0x27bc96(_0x3cf309);})[_0xae2f('0x17')](function(_0x5a523e){logger[_0xae2f('0x12')]('ShowTrunk',_0x5a523e[_0xae2f('0x13')],_0x316b7e);_0x516132(_0x5dd3a9['error'](0x1f4,_0x5a523e['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 4ed2ca6..03e8e88 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 _0x0648=['getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','getLists','/:id/agents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','/:id','destroy','/:id/mail_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','describe','get','/whoami','whoami','/presence','getPresence','show','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt'];(function(_0x545672,_0x589128){var _0x57920d=function(_0x3dfc70){while(--_0x3dfc70){_0x545672['push'](_0x545672['shift']());}};_0x57920d(++_0x589128);}(_0x0648,0xcd));var _0x8064=function(_0xb24a7d,_0x9735af){_0xb24a7d=_0xb24a7d-0x0;var _0x543c98=_0x0648[_0xb24a7d];return _0x543c98;};'use strict';var multer=require(_0x8064('0x0'));var util=require(_0x8064('0x1'));var path=require(_0x8064('0x2'));var timeout=require(_0x8064('0x3'));var express=require(_0x8064('0x4'));var router=express[_0x8064('0x5')]();var fs_extra=require(_0x8064('0x6'));var auth=require(_0x8064('0x7'));var interaction=require(_0x8064('0x8'));var config=require(_0x8064('0x9'));var controller=require(_0x8064('0xa'));router['get']('/',auth[_0x8064('0xb')](),controller['index']);router['get']('/describe',auth[_0x8064('0xb')](),controller[_0x8064('0xc')]);router[_0x8064('0xd')](_0x8064('0xe'),auth[_0x8064('0xb')](),controller[_0x8064('0xf')]);router[_0x8064('0xd')](_0x8064('0x10'),auth['isAuthenticated'](),controller[_0x8064('0x11')]);router['get']('/:id',auth[_0x8064('0xb')](),controller[_0x8064('0x12')]);router[_0x8064('0xd')]('/:id/avatar',controller[_0x8064('0x13')]);router[_0x8064('0xd')](_0x8064('0x14'),auth[_0x8064('0xb')](),controller['getOpenTabs']);router[_0x8064('0xd')](_0x8064('0x15'),auth['isAuthenticated'](),controller[_0x8064('0x16')]);router[_0x8064('0xd')](_0x8064('0x17'),auth[_0x8064('0xb')](),controller[_0x8064('0x18')]);router[_0x8064('0xd')](_0x8064('0x19'),auth[_0x8064('0xb')](),controller[_0x8064('0x1a')]);router['get']('/:id/groups',auth[_0x8064('0xb')](),controller[_0x8064('0x1b')]);router[_0x8064('0xd')](_0x8064('0x1c'),auth[_0x8064('0xb')](),controller['getRecordings']);router[_0x8064('0xd')](_0x8064('0x1d'),auth['isAuthenticated'](),controller[_0x8064('0x1e')]);router[_0x8064('0xd')](_0x8064('0x1f'),auth[_0x8064('0xb')](),controller[_0x8064('0x20')]);router[_0x8064('0xd')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x8064('0x21')]);router['get']('/:id/mail/interactions',auth[_0x8064('0xb')](),controller[_0x8064('0x22')]);router[_0x8064('0xd')](_0x8064('0x23'),auth[_0x8064('0xb')](),controller[_0x8064('0x24')]);router[_0x8064('0xd')]('/:id/fax/interactions',auth[_0x8064('0xb')](),controller[_0x8064('0x25')]);router[_0x8064('0xd')](_0x8064('0x26'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x8064('0xd')]('/:id/teams',auth[_0x8064('0xb')](),controller[_0x8064('0x27')]);router[_0x8064('0xd')](_0x8064('0x28'),auth['isAuthenticated'](),controller[_0x8064('0x29')]);router[_0x8064('0xd')](_0x8064('0x2a'),auth[_0x8064('0xb')](),controller['getAgents']);router[_0x8064('0xd')]('/:id/prefixes',auth[_0x8064('0xb')](),controller[_0x8064('0x2b')]);router[_0x8064('0xd')](_0x8064('0x2c'),auth[_0x8064('0xb')](),controller[_0x8064('0x2d')]);router[_0x8064('0xd')](_0x8064('0x2e'),auth[_0x8064('0xb')](),controller[_0x8064('0x2f')]);router[_0x8064('0xd')](_0x8064('0x30'),auth[_0x8064('0xb')](),controller[_0x8064('0x31')]);router[_0x8064('0xd')](_0x8064('0x32'),auth[_0x8064('0xb')](),controller[_0x8064('0x33')]);router[_0x8064('0xd')]('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x8064('0xd')](_0x8064('0x34'),auth[_0x8064('0xb')](),controller['getWhatsappAccounts']);router[_0x8064('0xd')]('/:id/square_projects',auth[_0x8064('0xb')](),controller[_0x8064('0x35')]);router['get'](_0x8064('0x36'),auth[_0x8064('0xb')](),controller['getScheduledCalls']);router['get'](_0x8064('0x37'),auth[_0x8064('0xb')](),controller[_0x8064('0x38')]);router[_0x8064('0x39')](_0x8064('0x15'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0x8064('0xb')](),controller[_0x8064('0x3a')]);router[_0x8064('0x39')](_0x8064('0x3b'),auth[_0x8064('0xb')](),controller[_0x8064('0x3c')]);router['post'](_0x8064('0x17'),auth[_0x8064('0xb')](),controller['addQueues']);var upload=multer({'storage':multer[_0x8064('0x3d')]({'destination':function(_0x596de1,_0x28926d,_0x29a9d7){_0x29a9d7(null,path[_0x8064('0x3e')](config[_0x8064('0x3f')],_0x8064('0x40')));},'filename':function(_0x78368e,_0x83a618,_0x189e0d){_0x189e0d(null,util[_0x8064('0x41')](_0x8064('0x42'),Date[_0x8064('0x43')](),_0x83a618[_0x8064('0x44')]));}})});router[_0x8064('0x39')]('/:id/avatar',upload[_0x8064('0x45')](_0x8064('0x46')),controller[_0x8064('0x47')]);router[_0x8064('0x39')]('/:id/login',auth[_0x8064('0xb')](),controller[_0x8064('0x48')]);router[_0x8064('0x39')]('/:id/logout',auth['isAuthenticated'](),controller[_0x8064('0x49')]);router[_0x8064('0x39')](_0x8064('0x4a'),auth[_0x8064('0xb')](),controller['pause']);router[_0x8064('0x39')](_0x8064('0x4b'),auth[_0x8064('0xb')](),controller[_0x8064('0x4c')]);router['post'](_0x8064('0x4d'),auth[_0x8064('0xb')](),controller['addTeams']);router[_0x8064('0x39')](_0x8064('0x4e'),auth['isAuthenticated'](),controller[_0x8064('0x4f')]);router['post']('/:id/mail_interactions',auth[_0x8064('0xb')](),controller[_0x8064('0x50')]);router[_0x8064('0x39')](_0x8064('0x51'),auth[_0x8064('0xb')](),controller[_0x8064('0x52')]);router[_0x8064('0x39')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x8064('0x53')]);router['post'](_0x8064('0x54'),auth[_0x8064('0xb')](),controller[_0x8064('0x55')]);router[_0x8064('0x39')](_0x8064('0x56'),auth[_0x8064('0xb')](),controller['addWhatsappInteractions']);router[_0x8064('0x39')](_0x8064('0x2c'),auth[_0x8064('0xb')](),controller[_0x8064('0x57')]);router['post']('/:id/mail_accounts',auth[_0x8064('0xb')](),controller[_0x8064('0x58')]);router[_0x8064('0x39')](_0x8064('0x30'),auth[_0x8064('0xb')](),controller[_0x8064('0x59')]);router['post'](_0x8064('0x32'),auth['isAuthenticated'](),controller[_0x8064('0x5a')]);router[_0x8064('0x39')]('/:id/chat_websites',auth[_0x8064('0xb')](),controller[_0x8064('0x5b')]);router[_0x8064('0x39')](_0x8064('0x34'),auth[_0x8064('0xb')](),controller['addWhatsappAccounts']);router[_0x8064('0x39')](_0x8064('0x5c'),auth[_0x8064('0xb')](),controller[_0x8064('0x5d')]);router['post'](_0x8064('0x37'),auth[_0x8064('0xb')](),controller[_0x8064('0x5e')]);router[_0x8064('0x5f')]('/:id',auth[_0x8064('0xb')](),controller[_0x8064('0x60')]);router[_0x8064('0x5f')](_0x8064('0x61'),auth[_0x8064('0xb')](),controller[_0x8064('0x62')]);router[_0x8064('0x63')](_0x8064('0x17'),auth['isAuthenticated'](),controller[_0x8064('0x64')]);router[_0x8064('0x63')](_0x8064('0x4d'),auth[_0x8064('0xb')](),controller[_0x8064('0x65')]);router['delete'](_0x8064('0x66'),auth[_0x8064('0xb')](),controller[_0x8064('0x67')]);router[_0x8064('0x63')](_0x8064('0x4e'),auth[_0x8064('0xb')](),controller['removeChatInteractions']);router['delete'](_0x8064('0x68'),auth[_0x8064('0xb')](),controller['removeMailInteractions']);router[_0x8064('0x63')](_0x8064('0x51'),auth[_0x8064('0xb')](),controller[_0x8064('0x69')]);router[_0x8064('0x63')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x8064('0x63')](_0x8064('0x54'),auth['isAuthenticated'](),controller[_0x8064('0x6a')]);router['delete']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x8064('0x6b')]);router[_0x8064('0x63')](_0x8064('0x2c'),auth[_0x8064('0xb')](),controller[_0x8064('0x6c')]);router[_0x8064('0x63')]('/:id/mail_accounts',auth[_0x8064('0xb')](),controller[_0x8064('0x6d')]);router[_0x8064('0x63')](_0x8064('0x30'),auth['isAuthenticated'](),controller[_0x8064('0x6e')]);router[_0x8064('0x63')](_0x8064('0x32'),auth[_0x8064('0xb')](),controller[_0x8064('0x6f')]);router['delete']('/:id/chat_websites',auth[_0x8064('0xb')](),controller[_0x8064('0x70')]);router['delete']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x8064('0x63')](_0x8064('0x5c'),auth['isAuthenticated'](),controller[_0x8064('0x71')]);router[_0x8064('0x63')](_0x8064('0x37'),auth[_0x8064('0xb')](),controller[_0x8064('0x72')]);module[_0x8064('0x73')]=router; \ No newline at end of file +var _0xbe33=['/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','bulkCreate','addQueues','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe33,0x1dc));var _0x3be3=function(_0x13ae66,_0x2f8ada){_0x13ae66=_0x13ae66-0x0;var _0x2688b8=_0xbe33[_0x13ae66];return _0x2688b8;};'use strict';var multer=require(_0x3be3('0x0'));var util=require(_0x3be3('0x1'));var path=require(_0x3be3('0x2'));var timeout=require('connect-timeout');var express=require(_0x3be3('0x3'));var router=express[_0x3be3('0x4')]();var fs_extra=require(_0x3be3('0x5'));var auth=require(_0x3be3('0x6'));var interaction=require(_0x3be3('0x7'));var config=require(_0x3be3('0x8'));var controller=require(_0x3be3('0x9'));router[_0x3be3('0xa')]('/',auth[_0x3be3('0xb')](),controller['index']);router[_0x3be3('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x3be3('0xc')]);router['get']('/whoami',auth[_0x3be3('0xb')](),controller[_0x3be3('0xd')]);router[_0x3be3('0xa')](_0x3be3('0xe'),auth[_0x3be3('0xb')](),controller['getPresence']);router[_0x3be3('0xa')](_0x3be3('0xf'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x10')]);router[_0x3be3('0xa')](_0x3be3('0x11'),controller[_0x3be3('0x12')]);router['get'](_0x3be3('0x13'),auth[_0x3be3('0xb')](),controller['getOpenTabs']);router[_0x3be3('0xa')](_0x3be3('0x14'),auth[_0x3be3('0xb')](),controller['getContacts']);router[_0x3be3('0xa')](_0x3be3('0x15'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x16')]);router[_0x3be3('0xa')]('/:id/queues_rt',auth[_0x3be3('0xb')](),controller[_0x3be3('0x17')]);router[_0x3be3('0xa')]('/:id/groups',auth[_0x3be3('0xb')](),controller['getGroups']);router['get'](_0x3be3('0x18'),auth[_0x3be3('0xb')](),controller['getRecordings']);router[_0x3be3('0xa')](_0x3be3('0x19'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x1a')]);router[_0x3be3('0xa')](_0x3be3('0x1b'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x1c')]);router[_0x3be3('0xa')](_0x3be3('0x1d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x1e')]);router[_0x3be3('0xa')](_0x3be3('0x1f'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x20')]);router['get']('/:id/sms/interactions',auth[_0x3be3('0xb')](),controller['getSmsInteractions']);router['get'](_0x3be3('0x21'),auth[_0x3be3('0xb')](),controller['getFaxInteractions']);router[_0x3be3('0xa')](_0x3be3('0x22'),auth[_0x3be3('0xb')](),controller['getWhatsappInteractions']);router[_0x3be3('0xa')](_0x3be3('0x23'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x24')]);router[_0x3be3('0xa')](_0x3be3('0x25'),auth['isAuthenticated'](),controller[_0x3be3('0x26')]);router['get'](_0x3be3('0x27'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x28')]);router[_0x3be3('0xa')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x3be3('0x29')]);router[_0x3be3('0xa')](_0x3be3('0x2a'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x2b')]);router[_0x3be3('0xa')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x3be3('0x2c')]);router[_0x3be3('0xa')](_0x3be3('0x2d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x2e')]);router[_0x3be3('0xa')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x3be3('0x2f')]);router[_0x3be3('0xa')](_0x3be3('0x30'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x31')]);router['get'](_0x3be3('0x32'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x33')]);router['get'](_0x3be3('0x34'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x35')]);router[_0x3be3('0xa')]('/:id/scheduled_calls',auth[_0x3be3('0xb')](),controller[_0x3be3('0x36')]);router[_0x3be3('0xa')](_0x3be3('0x37'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x38')]);router[_0x3be3('0x39')](_0x3be3('0x14'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x3a')]);router[_0x3be3('0x39')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3be3('0x39')]('/create_many',auth[_0x3be3('0xb')](),controller[_0x3be3('0x3b')]);router['post'](_0x3be3('0x15'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x337c96,_0x207da9,_0xbe3464){_0xbe3464(null,path[_0x3be3('0x3d')](config[_0x3be3('0x3e')],'server/files/images/'));},'filename':function(_0x1e2349,_0x1795c8,_0x28a7d7){_0x28a7d7(null,util[_0x3be3('0x3f')](_0x3be3('0x40'),Date[_0x3be3('0x41')](),_0x1795c8[_0x3be3('0x42')]));}})});router['post'](_0x3be3('0x11'),upload[_0x3be3('0x43')](_0x3be3('0x44')),controller[_0x3be3('0x45')]);router[_0x3be3('0x39')](_0x3be3('0x46'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x47')]);router[_0x3be3('0x39')](_0x3be3('0x48'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x49')]);router[_0x3be3('0x39')](_0x3be3('0x4a'),auth['isAuthenticated'](),controller['pause']);router[_0x3be3('0x39')](_0x3be3('0x4b'),auth['isAuthenticated'](),controller[_0x3be3('0x4c')]);router['post'](_0x3be3('0x23'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x4d')]);router[_0x3be3('0x39')](_0x3be3('0x4e'),auth[_0x3be3('0xb')](),controller['addChatInteractions']);router[_0x3be3('0x39')](_0x3be3('0x4f'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x50')]);router['post'](_0x3be3('0x51'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x52')]);router[_0x3be3('0x39')](_0x3be3('0x53'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x54')]);router[_0x3be3('0x39')](_0x3be3('0x55'),auth['isAuthenticated'](),controller[_0x3be3('0x56')]);router[_0x3be3('0x39')](_0x3be3('0x57'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x58')]);router[_0x3be3('0x39')](_0x3be3('0x2a'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x59')]);router[_0x3be3('0x39')](_0x3be3('0x5a'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x5b')]);router[_0x3be3('0x39')](_0x3be3('0x2d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x5c')]);router[_0x3be3('0x39')](_0x3be3('0x5d'),auth[_0x3be3('0xb')](),controller['addSmsAccounts']);router[_0x3be3('0x39')](_0x3be3('0x30'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x5e')]);router[_0x3be3('0x39')](_0x3be3('0x32'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x5f')]);router[_0x3be3('0x39')](_0x3be3('0x34'),auth[_0x3be3('0xb')](),controller['addSquareProjects']);router[_0x3be3('0x39')](_0x3be3('0x37'),auth['isAuthenticated'](),controller[_0x3be3('0x60')]);router[_0x3be3('0x61')](_0x3be3('0xf'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x62')]);router[_0x3be3('0x61')](_0x3be3('0x63'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x64')]);router[_0x3be3('0x65')]('/:id/queues',auth[_0x3be3('0xb')](),controller[_0x3be3('0x66')]);router['delete'](_0x3be3('0x23'),auth['isAuthenticated'](),controller[_0x3be3('0x67')]);router[_0x3be3('0x65')](_0x3be3('0xf'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x68')]);router[_0x3be3('0x65')](_0x3be3('0x4e'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x69')]);router['delete'](_0x3be3('0x4f'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6a')]);router[_0x3be3('0x65')](_0x3be3('0x51'),auth[_0x3be3('0xb')](),controller['removeFaxInteractions']);router[_0x3be3('0x65')](_0x3be3('0x53'),auth['isAuthenticated'](),controller[_0x3be3('0x6b')]);router[_0x3be3('0x65')]('/:id/openchannel_interactions',auth[_0x3be3('0xb')](),controller['removeOpenchannelInteractions']);router['delete'](_0x3be3('0x57'),auth[_0x3be3('0xb')](),controller['removeWhatsappInteractions']);router[_0x3be3('0x65')](_0x3be3('0x2a'),auth[_0x3be3('0xb')](),controller['removeFaxAccounts']);router[_0x3be3('0x65')](_0x3be3('0x5a'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6c')]);router[_0x3be3('0x65')](_0x3be3('0x2d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6d')]);router[_0x3be3('0x65')](_0x3be3('0x5d'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6e')]);router[_0x3be3('0x65')](_0x3be3('0x30'),auth[_0x3be3('0xb')](),controller[_0x3be3('0x6f')]);router[_0x3be3('0x65')](_0x3be3('0x32'),auth['isAuthenticated'](),controller[_0x3be3('0x70')]);router['delete']('/:id/square_projects',auth[_0x3be3('0xb')](),controller[_0x3be3('0x71')]);router[_0x3be3('0x65')]('/:id/api_key',auth[_0x3be3('0xb')](),controller[_0x3be3('0x72')]);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 dd6de66..b56afa7 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 _0x5a5a=['moment','util','lodash','exports','STRING','setDataValue','name','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','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','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','update,nonat','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','actpass','/etc/pki/tls/certs/motion.crt','TEXT','map','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','loginAttempts','blockedAt','UNSIGNED'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x539236,_0x556604){_0x539236=_0x539236-0x0;var _0x154191=_0x5a5a[_0x539236];return _0x154191;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa5a5('0x0'));var util=require(_0xa5a5('0x1'));var _=require(_0xa5a5('0x2'));module[_0xa5a5('0x3')]={'name':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1e6eca){this[_0xa5a5('0x5')](_0xa5a5('0x6'),_0x1e6eca);this['setDataValue']('defaultuser',_0x1e6eca);},'comment':_0xa5a5('0x7')},'fullname':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':![],'set':function(_0x5691f1){this[_0xa5a5('0x5')](_0xa5a5('0x8'),_0x5691f1);this[_0xa5a5('0x5')](_0xa5a5('0x9'),util[_0xa5a5('0xa')]('\x22%s\x22\x20<%s>',_0x5691f1,this[_0xa5a5('0xb')](_0xa5a5('0xc'))));}},'alias':{'type':Sequelize[_0xa5a5('0x4')]},'email':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':![],'unique':_0xa5a5('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1b4247){if(_0x1b4247){this[_0xa5a5('0x5')](_0xa5a5('0xd'),_0x1b4247[_0xa5a5('0xe')]());}}},'role':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x10'),_0xa5a5('0x11'),'agent',_0xa5a5('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa5a5('0x4')],'defaultValue':_0xa5a5('0x13')},'internal':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':![],'unique':_0xa5a5('0xc'),'set':function(_0x5d71e4){this[_0xa5a5('0x5')](_0xa5a5('0xc'),_0x5d71e4);this[_0xa5a5('0x5')](_0xa5a5('0x15'),_0x5d71e4);this[_0xa5a5('0x5')](_0xa5a5('0x9'),util[_0xa5a5('0xa')](_0xa5a5('0x16'),this['getDataValue'](_0xa5a5('0x8')),_0x5d71e4));}},'salt':{'type':Sequelize[_0xa5a5('0x4')]},'phone':{'type':Sequelize[_0xa5a5('0x4')]},'mobile':{'type':Sequelize[_0xa5a5('0x4')]},'address':{'type':Sequelize[_0xa5a5('0x4')]},'zipcode':{'type':Sequelize[_0xa5a5('0x4')]},'userpic':{'type':Sequelize[_0xa5a5('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa5a5('0x4')]},'online':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa5a5('0x18')]},'voicePause':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa5a5('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xa5a5('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa5a5('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa5a5('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa5a5('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xa5a5('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa5a5('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![],'defaultValue':_0xa5a5('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x1a'),_0xa5a5('0x11'),_0xa5a5('0x1b')),'allowNull':!![],'defaultValue':_0xa5a5('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa5a5('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0xa5a5('0x1d'),'ALLOWED_PASSED_SCREEN',_0xa5a5('0x1e'),_0xa5a5('0x1f'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xa5a5('0x20')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2db22d){this[_0xa5a5('0x5')](_0xa5a5('0x21'),_0x2db22d?_0x2db22d[_0xa5a5('0x22')](','):null);},'get':function(){return this[_0xa5a5('0xb')](_0xa5a5('0x21'))?this[_0xa5a5('0xb')]('transport')[_0xa5a5('0x23')](','):null;},'comment':_0xa5a5('0x24')},'dtmfmode':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x25'),_0xa5a5('0x26'),_0xa5a5('0x27'),_0xa5a5('0x28'),_0xa5a5('0x29')),'allowNull':!![],'defaultValue':_0xa5a5('0x25')},'directmedia':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no',_0xa5a5('0x2b'),_0xa5a5('0x2c'),_0xa5a5('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x49c55d){this['setDataValue'](_0xa5a5('0x2e'),_0x49c55d?_0x49c55d['join'](','):null);},'get':function(){return this[_0xa5a5('0xb')](_0xa5a5('0x2e'))?this[_0xa5a5('0xb')]('nat')[_0xa5a5('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xa5a5('0x4')]},'pickupgroup':{'type':Sequelize[_0xa5a5('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa5a5('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa5a5('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa5a5('0x30'),'set':function(_0x53fe36){this[_0xa5a5('0x5')](_0xa5a5('0x31'),_0x53fe36?_0x53fe36[_0xa5a5('0x22')](';'):_0xa5a5('0x30'));},'get':function(){return this[_0xa5a5('0xb')](_0xa5a5('0x31'))?this[_0xa5a5('0xb')](_0xa5a5('0x31'))[_0xa5a5('0x23')](';'):null;},'comment':_0xa5a5('0x32')},'autoframing':{'type':Sequelize['ENUM'](_0xa5a5('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x1054f9){this[_0xa5a5('0x5')]('insecure',_0x1054f9?_0x1054f9[_0xa5a5('0x22')](','):null);},'get':function(){return this[_0xa5a5('0xb')](_0xa5a5('0x33'))?this[_0xa5a5('0xb')](_0xa5a5('0x33'))['split'](','):null;},'comment':_0xa5a5('0x34')},'trustrpid':{'type':Sequelize[_0xa5a5('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no',_0xa5a5('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xa5a5('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa5a5('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa5a5('0xf')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no',_0xa5a5('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xa5a5('0x37'),_0xa5a5('0x38'),_0xa5a5('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa5a5('0xf')]('uac',_0xa5a5('0x3a')),'allowNull':!![],'defaultValue':_0xa5a5('0x3a')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xa5a5('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xa5a5('0x2a')},'keepalive':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa5a5('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa5a5('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa5a5('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xa5a5('0x2a'),'no',_0xa5a5('0x3b'),_0xa5a5('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa5a5('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x3d'),_0xa5a5('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xa5a5('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa5a5('0xf')](_0xa5a5('0x2a'),'no',_0xa5a5('0x2b'),'update',_0xa5a5('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa5a5('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xa5a5('0x18')]},'passwordResetAt':{'type':Sequelize[_0xa5a5('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xa5a5('0x14')],'defaultValue':0x0,'set':function(_0x380dae){this['setDataValue'](_0xa5a5('0x40'),_0x380dae);var _0x3b6aff=this[_0xa5a5('0x41')]({'plain':!![]});switch(_0x380dae){case 0x0:case 0x1:var _0x19910c=_0x3b6aff[_0xa5a5('0x21')]?_[_0xa5a5('0x42')](_0x3b6aff[_0xa5a5('0x21')])?_0x3b6aff[_0xa5a5('0x21')][_0xa5a5('0x22')]():_0x3b6aff[_0xa5a5('0x21')]:'udp';if(_0x19910c===_0xa5a5('0x43')){_0x19910c=_0xa5a5('0x44');}this[_0xa5a5('0x5')]('transport',_0x19910c);this[_0xa5a5('0x5')](_0xa5a5('0x45'),'no');this[_0xa5a5('0x5')](_0xa5a5('0x46'),null);this[_0xa5a5('0x5')](_0xa5a5('0x47'),null);this[_0xa5a5('0x5')](_0xa5a5('0x48'),null);this[_0xa5a5('0x5')]('dtlsenable',null);this['setDataValue'](_0xa5a5('0x49'),null);this[_0xa5a5('0x5')](_0xa5a5('0x4a'),null);this['setDataValue'](_0xa5a5('0x4b'),null);this['setDataValue'](_0xa5a5('0x4c'),null);this[_0xa5a5('0x5')](_0xa5a5('0x4d'),'no');break;case 0x2:this[_0xa5a5('0x5')]('transport','wss');this[_0xa5a5('0x5')](_0xa5a5('0x45'),'yes');this[_0xa5a5('0x5')](_0xa5a5('0x46'),_0xa5a5('0x2a'));this[_0xa5a5('0x5')]('force_avp','yes');this[_0xa5a5('0x5')]('icesupport',_0xa5a5('0x2a'));this[_0xa5a5('0x5')](_0xa5a5('0x4e'),_0xa5a5('0x2a'));this['setDataValue'](_0xa5a5('0x49'),'no');this['setDataValue'](_0xa5a5('0x4a'),_0xa5a5('0x4f'));this[_0xa5a5('0x5')](_0xa5a5('0x4b'),_0x3b6aff[_0xa5a5('0x4b')]||_0xa5a5('0x50'));this[_0xa5a5('0x5')]('dtlsprivatekey',_0x3b6aff[_0xa5a5('0x4c')]||'/etc/pki/tls/private/motion.key');this[_0xa5a5('0x5')](_0xa5a5('0x4d'),_0xa5a5('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xa5a5('0x51')],'set':function(_0x20500c){this[_0xa5a5('0x5')]('permissions',_0x20500c?_0x20500c[_0xa5a5('0x22')](','):[]);},'get':function(){return this[_0xa5a5('0xb')]('permissions')?_[_0xa5a5('0x52')](this[_0xa5a5('0xb')](_0xa5a5('0x53'))[_0xa5a5('0x23')](','),function(_0x49e6c1){return parseInt(_0x49e6c1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa5a5('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa5a5('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa5a5('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa5a5('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa5a5('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa5a5('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa5a5('0x54')],'get':function(){return this[_0xa5a5('0xb')](_0xa5a5('0x55'))?this[_0xa5a5('0xb')](_0xa5a5('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xa5a5('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa5a5('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x84cf3e){if(typeof _0x84cf3e===_0xa5a5('0x56')){var _0x4da43e=_0x84cf3e==='1'?!![]:_0x84cf3e==='0'?![]:_0x84cf3e===_0xa5a5('0x57')?!![]:_0x84cf3e===_0xa5a5('0x58')?![]:![];this[_0xa5a5('0x5')](_0xa5a5('0x59'),_0x4da43e);}else{this[_0xa5a5('0x5')]('screenrecording',_0x84cf3e);}}},'blocked':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':![],'set':function(_0x104fe7){this['setDataValue']('blocked',_0x104fe7);if(_0x104fe7===!![]){this[_0xa5a5('0x5')]('blockedAt',moment());this[_0xa5a5('0x5')](_0xa5a5('0x5a'),0x0);}else{this[_0xa5a5('0x5')](_0xa5a5('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0xa5a5('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa5a5('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa5a5('0x14')](0x5)[_0xa5a5('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa5a5('0x17')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2f74=['originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','showWebBar','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','loginAttempts','blockedAt','sequelize','util','lodash','exports','STRING','name','setDataValue','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','getDataValue','BOOLEAN','DATE','INTEGER','dynamic','peer','friend','from-sip','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','rfc2833','info','shortinfo','inband','auto','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f74,0x7b));var _0x42f7=function(_0x2fb16e,_0x161667){_0x2fb16e=_0x2fb16e-0x0;var _0x5e0882=_0x2f74[_0x2fb16e];return _0x5e0882;};'use strict';var Sequelize=require(_0x42f7('0x0'));var moment=require('moment');var util=require(_0x42f7('0x1'));var _=require(_0x42f7('0x2'));module[_0x42f7('0x3')]={'name':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'unique':_0x42f7('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3fcf64){this[_0x42f7('0x6')](_0x42f7('0x5'),_0x3fcf64);this['setDataValue']('defaultuser',_0x3fcf64);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'set':function(_0x1cb6e0){this[_0x42f7('0x6')](_0x42f7('0x7'),_0x1cb6e0);this[_0x42f7('0x6')](_0x42f7('0x8'),util[_0x42f7('0x9')](_0x42f7('0xa'),_0x1cb6e0,this['getDataValue'](_0x42f7('0xb'))));}},'alias':{'type':Sequelize[_0x42f7('0x4')]},'email':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'unique':_0x42f7('0xc'),'validate':{'isEmail':!![]},'set':function(_0x1f56d2){if(_0x1f56d2){this[_0x42f7('0x6')]('email',_0x1f56d2[_0x42f7('0xd')]());}}},'role':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0xf'),_0x42f7('0x10'),_0x42f7('0x11'),_0x42f7('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x42f7('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x42f7('0xb'),'set':function(_0xc274ff){this[_0x42f7('0x6')](_0x42f7('0xb'),_0xc274ff);this[_0x42f7('0x6')]('accountcode',_0xc274ff);this[_0x42f7('0x6')]('callerid',util[_0x42f7('0x9')](_0x42f7('0xa'),this[_0x42f7('0x13')](_0x42f7('0x7')),_0xc274ff));}},'salt':{'type':Sequelize[_0x42f7('0x4')]},'phone':{'type':Sequelize[_0x42f7('0x4')]},'mobile':{'type':Sequelize[_0x42f7('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x42f7('0x4')]},'userpic':{'type':Sequelize[_0x42f7('0x4')]},'city':{'type':Sequelize[_0x42f7('0x4')]},'country':{'type':Sequelize[_0x42f7('0x4')]},'online':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x42f7('0x15')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x42f7('0x15')]},'chatCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x42f7('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x42f7('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![],'defaultValue':_0x42f7('0x17')},'ipaddr':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x42f7('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0x42f7('0x10'),_0x42f7('0x18')),'allowNull':!![],'defaultValue':_0x42f7('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x42f7('0x1a')},'callingpres':{'type':Sequelize[_0x42f7('0xe')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x42f7('0x1b'),_0x42f7('0x1c'),_0x42f7('0x1d'),_0x42f7('0x1e'),_0x42f7('0x1f'),_0x42f7('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![],'defaultValue':_0x42f7('0x21'),'set':function(_0xd26ccf){this[_0x42f7('0x6')]('transport',_0xd26ccf?_0xd26ccf[_0x42f7('0x22')](','):null);},'get':function(){return this[_0x42f7('0x13')](_0x42f7('0x23'))?this[_0x42f7('0x13')]('transport')[_0x42f7('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x25'),_0x42f7('0x26'),_0x42f7('0x27'),_0x42f7('0x28'),_0x42f7('0x29')),'allowNull':!![],'defaultValue':_0x42f7('0x25')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x42f7('0x2a'),_0x42f7('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x48b79e){this[_0x42f7('0x6')]('nat',_0x48b79e?_0x48b79e[_0x42f7('0x22')](','):null);},'get':function(){return this[_0x42f7('0x13')](_0x42f7('0x2c'))?this[_0x42f7('0x13')](_0x42f7('0x2c'))['split'](','):null;},'comment':_0x42f7('0x2d')},'callgroup':{'type':Sequelize[_0x42f7('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x42f7('0x4')]},'language':{'type':Sequelize[_0x42f7('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x42f7('0x4')]},'disallow':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'defaultValue':_0x42f7('0x2e')},'allow':{'type':Sequelize[_0x42f7('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3037f8){this['setDataValue'](_0x42f7('0x2f'),_0x3037f8?_0x3037f8[_0x42f7('0x22')](';'):_0x42f7('0x30'));},'get':function(){return this['getDataValue'](_0x42f7('0x2f'))?this['getDataValue'](_0x42f7('0x2f'))[_0x42f7('0x24')](';'):null;},'comment':_0x42f7('0x31')},'autoframing':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![],'set':function(_0x5f2365){this[_0x42f7('0x6')]('insecure',_0x5f2365?_0x5f2365[_0x42f7('0x22')](','):null);},'get':function(){return this['getDataValue'](_0x42f7('0x33'))?this[_0x42f7('0x13')]('insecure')[_0x42f7('0x24')](','):null;},'comment':_0x42f7('0x34')},'trustrpid':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x42f7('0x35')},'amaflags':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':_0x42f7('0x32')},'busylevel':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no',_0x42f7('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x37'),_0x42f7('0x38'),_0x42f7('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x42f7('0x3a'),_0x42f7('0x3b')),'allowNull':!![],'defaultValue':_0x42f7('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x42f7('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no',_0x42f7('0x3c'),_0x42f7('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x42f7('0x3e'),_0x42f7('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x42f7('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x42f7('0xe')](_0x42f7('0x32'),'no',_0x42f7('0x2a'),_0x42f7('0x2b'),_0x42f7('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x42f7('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x42f7('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x42f7('0x41')]},'showWebBar':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0,'set':function(_0x98a670){this[_0x42f7('0x6')](_0x42f7('0x42'),_0x98a670);var _0x3affa4=this['get']({'plain':!![]});switch(_0x98a670){case 0x0:case 0x1:var _0x419be3=_0x3affa4[_0x42f7('0x23')]?_['isArray'](_0x3affa4[_0x42f7('0x23')])?_0x3affa4[_0x42f7('0x23')][_0x42f7('0x22')]():_0x3affa4[_0x42f7('0x23')]:'udp';if(_0x419be3===_0x42f7('0x43')){_0x419be3='udp';}this[_0x42f7('0x6')](_0x42f7('0x23'),_0x419be3);this['setDataValue'](_0x42f7('0x44'),'no');this[_0x42f7('0x6')](_0x42f7('0x45'),null);this[_0x42f7('0x6')](_0x42f7('0x46'),null);this[_0x42f7('0x6')](_0x42f7('0x47'),null);this['setDataValue'](_0x42f7('0x48'),null);this[_0x42f7('0x6')](_0x42f7('0x49'),null);this['setDataValue'](_0x42f7('0x4a'),null);this['setDataValue'](_0x42f7('0x4b'),null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue'](_0x42f7('0x4c'),'no');break;case 0x2:this['setDataValue'](_0x42f7('0x23'),_0x42f7('0x43'));this['setDataValue']('encryption',_0x42f7('0x32'));this['setDataValue'](_0x42f7('0x45'),'yes');this[_0x42f7('0x6')]('force_avp',_0x42f7('0x32'));this[_0x42f7('0x6')](_0x42f7('0x47'),_0x42f7('0x32'));this[_0x42f7('0x6')](_0x42f7('0x48'),_0x42f7('0x32'));this['setDataValue'](_0x42f7('0x49'),'no');this[_0x42f7('0x6')](_0x42f7('0x4a'),_0x42f7('0x3f'));this['setDataValue'](_0x42f7('0x4b'),_0x3affa4[_0x42f7('0x4b')]||_0x42f7('0x4d'));this['setDataValue'](_0x42f7('0x4e'),_0x3affa4[_0x42f7('0x4e')]||_0x42f7('0x4f'));this['setDataValue'](_0x42f7('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x42f7('0x41')],'set':function(_0x390f27){this[_0x42f7('0x6')](_0x42f7('0x50'),_0x390f27?_0x390f27[_0x42f7('0x22')](','):[]);},'get':function(){return this[_0x42f7('0x13')](_0x42f7('0x50'))?_[_0x42f7('0x51')](this[_0x42f7('0x13')]('permissions')['split'](','),function(_0x42259e){return parseInt(_0x42259e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x42f7('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x42f7('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x42f7('0x32'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x42f7('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x42f7('0x52')],'get':function(){return this[_0x42f7('0x13')](_0x42f7('0x53'))?this['getDataValue'](_0x42f7('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x42f7('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![],'set':function(_0x28643d){if(typeof _0x28643d===_0x42f7('0x54')){var _0x53d029=_0x28643d==='1'?!![]:_0x28643d==='0'?![]:_0x28643d===_0x42f7('0x55')?!![]:_0x28643d===_0x42f7('0x56')?![]:![];this[_0x42f7('0x6')](_0x42f7('0x57'),_0x53d029);}else{this[_0x42f7('0x6')](_0x42f7('0x57'),_0x28643d);}}},'blocked':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![],'set':function(_0x3e3b1e){this[_0x42f7('0x6')]('blocked',_0x3e3b1e);if(_0x3e3b1e===!![]){this[_0x42f7('0x6')]('blockedAt',moment());this[_0x42f7('0x6')](_0x42f7('0x58'),0x0);}else{this[_0x42f7('0x6')](_0x42f7('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x42f7('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x42f7('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x42f7('0x16')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x42f7('0x14')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index b670d92..de8f497 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 _0xb8cb=['CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','sort','pick','hasOwnProperty','CmList','List','Tag','Tags','color','tag','nolimit','limit','getQueues','order','Queue','getVoiceQueuesRt','findOne','getGroups','ChatGroup','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','concat','isMiddleware','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','openchannelPause','smsPause','whatsapppause','pauseType','manual','%s%s','getTeams','addTeams','Team','Voice','getChatQueues','setDataValue','Chat','getMailQueues','Mail','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','Openchannel','flatten','getDataValue','removeTeams','transaction','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lt','$lte','$not','$between','$notBetween','$in','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','queues','teams','inbound','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','undefined','offset','count','Content-Range','update','then','destroy','get','role','Users','user','Agents','agent','Telephones','filter','ignore','map','value','includes','name','end','stack','index','User','rawAttributes','fieldName','type','password','where','query','includeAll','include','attributes','push','openTabs','true','rows','sms','dataValues','fax','mail','openchannel','whatsapp','all','catch','params','model','differenceBy','keys','salt','filters','intersection','fields','length','merge','options','find','chat','body','describe','addContacts','omit','Setting','findById','securePassword','validatePasswordPattern','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','103','113','110','104','105','106','107','108','109','100','111','115','create','Unauthorized','admin','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','UserProfileResource','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','telephone','findAll','isEmpty','oldPassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','ids','penalty','toLowerCase','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','isArray','emit','Queue:remove','addAvatar','userpic','file','join','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','root','getOpenTabs','ChatOpenTabs'];(function(_0x143e27,_0x461ab1){var _0x4e3972=function(_0x5ebd1a){while(--_0x5ebd1a){_0x143e27['push'](_0x143e27['shift']());}};_0x4e3972(++_0x461ab1);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x1c9c3f,_0x1a54c1){_0x1c9c3f=_0x1c9c3f-0x0;var _0x5ece9a=_0xb8cb[_0x1c9c3f];return _0x5ece9a;};'use strict';var moment=require(_0xbb8c('0x0'));var BPromise=require(_0xbb8c('0x1'));var util=require(_0xbb8c('0x2'));var path=require(_0xbb8c('0x3'));var fs=require('fs');var _=require(_0xbb8c('0x4'));var squel=require(_0xbb8c('0x5'));var jayson=require(_0xbb8c('0x6'));var Redis=require('ioredis');var authService=require(_0xbb8c('0x7'));var qs=require(_0xbb8c('0x8'));var logger=require('../../config/logger')('api');var utils=require(_0xbb8c('0x9'));var config=require(_0xbb8c('0xa'));var licenseUtil=require(_0xbb8c('0xb'));var db=require('../../mysqldb')['db'];var socket=require(_0xbb8c('0xc'))(new Redis(config[_0xbb8c('0xd')]));require(_0xbb8c('0xe'))[_0xbb8c('0xf')](socket);config[_0xbb8c('0xd')]=_[_0xbb8c('0x10')](config[_0xbb8c('0xd')],{'host':_0xbb8c('0x11'),'port':0x18eb});var client=jayson[_0xbb8c('0x12')][_0xbb8c('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0xacb9de,_0x2bd9a4,_0x4c76d6,_0x43367b){return new BPromise(function(_0x179a2f,_0x14eeab){var _0x316daa=_0x43367b||client;return _0x316daa[_0xbb8c('0x14')](_0xacb9de,_0x4c76d6)['then'](function(_0x275252){logger[_0xbb8c('0x15')](_0xbb8c('0x16'),_0x2bd9a4,_0xbb8c('0x17'));logger[_0xbb8c('0x18')](_0xbb8c('0x19'),_0x2bd9a4,_0xbb8c('0x17'),JSON['stringify'](_0x275252));if(_0x275252[_0xbb8c('0x1a')]){if(_0x275252[_0xbb8c('0x1a')][_0xbb8c('0x1b')]===0x1f4){logger[_0xbb8c('0x1a')](_0xbb8c('0x16'),_0x2bd9a4,_0x275252[_0xbb8c('0x1a')][_0xbb8c('0x1c')]);return _0x14eeab(_0x275252[_0xbb8c('0x1a')][_0xbb8c('0x1c')]);}logger[_0xbb8c('0x1a')]('User,\x20%s,\x20%s',_0x2bd9a4,_0x275252[_0xbb8c('0x1a')][_0xbb8c('0x1c')]);return _0x179a2f(_0x275252[_0xbb8c('0x1a')][_0xbb8c('0x1c')]);}else{logger[_0xbb8c('0x15')](_0xbb8c('0x16'),_0x2bd9a4,'request\x20sent');_0x179a2f(_0x275252[_0xbb8c('0x1d')][_0xbb8c('0x1c')]);}})['catch'](function(_0x1a1e92){logger['error'](_0xbb8c('0x16'),_0x2bd9a4,_0x1a1e92);_0x14eeab(_0x1a1e92);});});}function respondWithStatusCode(_0x570c0b,_0x32b961){_0x32b961=_0x32b961||0xcc;return function(_0x1d00db){if(_0x1d00db){return _0x570c0b[_0xbb8c('0x1e')](_0x32b961);}return _0x570c0b['status'](_0x32b961)['end']();};}function respondWithResult(_0x10f265,_0x54459d){_0x54459d=_0x54459d||0xc8;return function(_0x171530){if(_0x171530){return _0x10f265[_0xbb8c('0x1f')](_0x54459d)[_0xbb8c('0x20')](_0x171530);}};}function respondWithFilteredResult(_0xec7fb5,_0x362a2f){return function(_0x582c05){if(_0x582c05){var _0xf5a529=typeof _0x362a2f['offset']===_0xbb8c('0x21')&&typeof _0x362a2f['limit']==='undefined';var _0xe7475d=_0x582c05['count'];var _0x47fb37=_0xf5a529?0x0:_0x362a2f[_0xbb8c('0x22')];var _0x283ec3=_0xf5a529?_0x582c05[_0xbb8c('0x23')]:_0x362a2f['offset']+_0x362a2f['limit'];var _0x17576b;if(_0x283ec3>=_0xe7475d){_0x283ec3=_0xe7475d;_0x17576b=0xc8;}else{_0x17576b=0xce;}_0xec7fb5[_0xbb8c('0x1f')](_0x17576b);return _0xec7fb5['set'](_0xbb8c('0x24'),_0x47fb37+'-'+_0x283ec3+'/'+_0xe7475d)[_0xbb8c('0x20')](_0x582c05);}return null;};}function saveUpdates(_0x292f11){return function(_0x4f0f13){if(_0x4f0f13){return _0x4f0f13[_0xbb8c('0x25')](_0x292f11)[_0xbb8c('0x26')](function(_0x219976){return _0x219976;});}return null;};}function removeEntity(_0x3915de){return function(_0x260d7b){if(_0x260d7b){return _0x260d7b[_0xbb8c('0x27')]()[_0xbb8c('0x26')](function(){var _0xb8a3df=_0x260d7b[_0xbb8c('0x28')]({'plain':!![]});if(_0xb8a3df[_0xbb8c('0x29')]==='admin')return;var _0x5d465b=[{'name':_0xbb8c('0x2a'),'value':_0xbb8c('0x2b'),'ignore':!![]},{'name':_0xbb8c('0x2c'),'value':_0xbb8c('0x2d'),'ignore':![]},{'name':_0xbb8c('0x2e'),'value':'telephone','ignore':![]}];var _0x28745e=_(_0x5d465b)[_0xbb8c('0x2f')](_0xbb8c('0x30'))[_0xbb8c('0x31')](_0xbb8c('0x32'))[_0xbb8c('0x32')]();if(_[_0xbb8c('0x33')](_0x28745e,_0xb8a3df[_0xbb8c('0x29')])){return;}var _0x3793f7=_['find'](_0x5d465b,[_0xbb8c('0x32'),_0xb8a3df[_0xbb8c('0x29')]])[_0xbb8c('0x34')];return db['UserProfileResource']['destroy']({'where':{'type':_0x3793f7,'resourceId':_0xb8a3df['id']}})[_0xbb8c('0x26')](function(){return _0x260d7b;});})[_0xbb8c('0x26')](function(){_0x3915de[_0xbb8c('0x1f')](0xcc)[_0xbb8c('0x35')]();});}};}function handleEntityNotFound(_0x486539){return function(_0x28d11f){if(!_0x28d11f){_0x486539[_0xbb8c('0x1e')](0x194);}return _0x28d11f;};}function handleError(_0x328883,_0x1cfe96){_0x1cfe96=_0x1cfe96||0x1f4;return function(_0x16bc8c){logger['error'](_0x16bc8c[_0xbb8c('0x36')]);if(_0x16bc8c[_0xbb8c('0x34')]){delete _0x16bc8c[_0xbb8c('0x34')];}_0x328883[_0xbb8c('0x1f')](_0x1cfe96)['send'](_0x16bc8c);};}exports[_0xbb8c('0x37')]=function(_0x448986,_0x1f0e1a){var _0x31d8ab={},_0x34ad16={'count':0x0,'rows':[]};var _0x262205=_(db[_0xbb8c('0x38')][_0xbb8c('0x39')])[_0xbb8c('0x31')](function(_0x418e02){return{'name':_0x418e02[_0xbb8c('0x3a')],'type':_0x418e02[_0xbb8c('0x3b')]['key']};})[_0xbb8c('0x2f')](function(_0x387692){return!_[_0xbb8c('0x33')]([_0xbb8c('0x3c'),'salt'],_0x387692[_0xbb8c('0x34')]);})['value']();_0x31d8ab=qs['getOptions'](_0x262205,_0x448986);var _0x234f1f={'where':_0x31d8ab[_0xbb8c('0x3d')]};return db[_0xbb8c('0x38')]['count'](_0x234f1f)[_0xbb8c('0x26')](function(_0xdcf057){_0x34ad16['count']=_0xdcf057;if(_0x448986[_0xbb8c('0x3e')][_0xbb8c('0x3f')]){_0x31d8ab[_0xbb8c('0x40')]=[{'all':!![]}];}if(!_[_0xbb8c('0x33')](_0x31d8ab['attributes'],'id')){_0x31d8ab[_0xbb8c('0x41')][_0xbb8c('0x42')]('id');}return db[_0xbb8c('0x38')]['findAll'](_0x31d8ab);})[_0xbb8c('0x26')](function(_0xff11d5){_0x34ad16['rows']=_0xff11d5;if(_0x448986['query'][_0xbb8c('0x43')]===_0xbb8c('0x44')){var _0x532d6f=[];for(var _0x4ff666=0x0;_0x4ff666<_0x34ad16[_0xbb8c('0x45')]['length'];_0x4ff666++){_0x532d6f[_0xbb8c('0x42')](get_open_tabs('chat',_0x34ad16[_0xbb8c('0x45')][_0x4ff666]['dataValues']));_0x532d6f[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x46'),_0x34ad16[_0xbb8c('0x45')][_0x4ff666][_0xbb8c('0x47')]));_0x532d6f[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x48'),_0x34ad16['rows'][_0x4ff666][_0xbb8c('0x47')]));_0x532d6f['push'](get_open_tabs(_0xbb8c('0x49'),_0x34ad16[_0xbb8c('0x45')][_0x4ff666][_0xbb8c('0x47')]));_0x532d6f[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x4a'),_0x34ad16[_0xbb8c('0x45')][_0x4ff666]['dataValues']));_0x532d6f['push'](get_open_tabs(_0xbb8c('0x4b'),_0x34ad16[_0xbb8c('0x45')][_0x4ff666]['dataValues']));}return BPromise[_0xbb8c('0x4c')](_0x532d6f)[_0xbb8c('0x26')](function(_0x3f0a8b){return _0x34ad16;});}else{return _0x34ad16;}})['then'](respondWithFilteredResult(_0x1f0e1a,_0x31d8ab))[_0xbb8c('0x4d')](handleError(_0x1f0e1a,null));};exports['show']=function(_0x34b7ed,_0x279d6a){var _0x28eb3d={'raw':![],'where':{'id':_0x34b7ed[_0xbb8c('0x4e')]['id']}},_0x4d98f2={};_0x4d98f2[_0xbb8c('0x4f')]=_[_0xbb8c('0x50')](_[_0xbb8c('0x51')](db[_0xbb8c('0x38')][_0xbb8c('0x39')]),[_0xbb8c('0x3c'),_0xbb8c('0x52')]);_0x4d98f2[_0xbb8c('0x3e')]=_[_0xbb8c('0x51')](_0x34b7ed['query']);_0x4d98f2[_0xbb8c('0x53')]=_[_0xbb8c('0x54')](_0x4d98f2[_0xbb8c('0x4f')],_0x4d98f2['query']);_0x28eb3d[_0xbb8c('0x41')]=_[_0xbb8c('0x54')](_0x4d98f2[_0xbb8c('0x4f')],qs[_0xbb8c('0x55')](_0x34b7ed[_0xbb8c('0x3e')][_0xbb8c('0x55')]));_0x28eb3d[_0xbb8c('0x41')]=_0x28eb3d[_0xbb8c('0x41')][_0xbb8c('0x56')]?_0x28eb3d[_0xbb8c('0x41')]:_0x4d98f2['model'];if(_0x34b7ed[_0xbb8c('0x3e')]['includeAll']){_0x28eb3d[_0xbb8c('0x40')]=[{'all':!![]}];}_0x28eb3d=_[_0xbb8c('0x57')]({},_0x28eb3d,_0x34b7ed[_0xbb8c('0x58')]);if(!_[_0xbb8c('0x33')](_0x28eb3d[_0xbb8c('0x41')],'id')){_0x28eb3d['attributes'][_0xbb8c('0x42')]('id');}return db['User'][_0xbb8c('0x59')](_0x28eb3d)[_0xbb8c('0x26')](handleEntityNotFound(_0x279d6a,null))[_0xbb8c('0x26')](function(_0x4dd318){var _0x18435a=[];values=_0x4dd318;if(_0x34b7ed[_0xbb8c('0x3e')][_0xbb8c('0x43')]===_0xbb8c('0x44')){_0x18435a[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x5a'),_0x4dd318[_0xbb8c('0x47')]));_0x18435a[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x46'),_0x4dd318[_0xbb8c('0x47')]));_0x18435a[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x4a'),_0x4dd318[_0xbb8c('0x47')]));_0x18435a['push'](get_open_tabs('whatsapp',_0x4dd318[_0xbb8c('0x47')]));_0x18435a[_0xbb8c('0x42')](get_open_tabs('fax',_0x4dd318[_0xbb8c('0x47')]));_0x18435a[_0xbb8c('0x42')](get_open_tabs('mail',_0x4dd318[_0xbb8c('0x47')]));return BPromise['all'](_0x18435a);}else{return values;}})[_0xbb8c('0x26')](function(_0x310413){return values;})[_0xbb8c('0x26')](respondWithResult(_0x279d6a,null))[_0xbb8c('0x4d')](handleError(_0x279d6a,null));};exports['update']=function(_0x2cd38c,_0x5a2e76){if(_0x2cd38c[_0xbb8c('0x5b')]['id']){delete _0x2cd38c['body']['id'];}delete _0x2cd38c['body'][_0xbb8c('0x29')];return db['User'][_0xbb8c('0x59')]({'where':{'id':_0x2cd38c[_0xbb8c('0x4e')]['id']}})[_0xbb8c('0x26')](handleEntityNotFound(_0x5a2e76,null))[_0xbb8c('0x26')](saveUpdates(_0x2cd38c[_0xbb8c('0x5b')],null))[_0xbb8c('0x26')](respondWithResult(_0x5a2e76,null))[_0xbb8c('0x4d')](handleError(_0x5a2e76,null));};exports[_0xbb8c('0x5c')]=function(_0x2f2ab6,_0x406052){return db[_0xbb8c('0x38')][_0xbb8c('0x5c')]()[_0xbb8c('0x26')](respondWithResult(_0x406052,null))[_0xbb8c('0x4d')](handleError(_0x406052,null));};exports[_0xbb8c('0x5d')]=function(_0xc6e8a8,_0x58d0db){return db[_0xbb8c('0x38')]['find']({'where':{'id':_0xc6e8a8[_0xbb8c('0x4e')]['id']}})[_0xbb8c('0x26')](handleEntityNotFound(_0x58d0db,null))[_0xbb8c('0x26')](function(_0x4ab696){if(_0x4ab696){return _0x4ab696[_0xbb8c('0x5d')](_0xc6e8a8[_0xbb8c('0x5b')]['ids'],_[_0xbb8c('0x5e')](_0xc6e8a8['body'],['ids','id'])||{});}})[_0xbb8c('0x26')](respondWithResult(_0x58d0db,null))['catch'](handleError(_0x58d0db,null));};function validateUser(_0x295667){return new BPromise(function(_0x528db9,_0xa91487){if(_0x295667['internal'])return _0x528db9(_0x295667);return db[_0xbb8c('0x5f')][_0xbb8c('0x60')](0x1)['then'](function(_0x844fd7){if(_0x844fd7[_0xbb8c('0x61')])authService[_0xbb8c('0x62')](_0x295667[_0xbb8c('0x3c')]);db[_0xbb8c('0x38')]['max'](_0xbb8c('0x63'))[_0xbb8c('0x26')](function(_0x52114d){if(_[_0xbb8c('0x64')](_0x52114d)){_0x295667[_0xbb8c('0x63')]=_0x844fd7['min_internal']||0x1;return;}if(_[_0xbb8c('0x64')](_0x844fd7[_0xbb8c('0x65')])||_0x844fd7[_0xbb8c('0x65')]===_0x52114d){_0x295667['internal']=_0x52114d+0x1;return;}if(_0x844fd7[_0xbb8c('0x65')]>_0x52114d){_0x295667[_0xbb8c('0x63')]=_0x844fd7[_0xbb8c('0x65')];return;}return db[_0xbb8c('0x66')][_0xbb8c('0x3e')](_0xbb8c('0x67'),{'type':db[_0xbb8c('0x66')][_0xbb8c('0x68')][_0xbb8c('0x69')]})['then'](function(_0x3178e6){if(_0x3178e6&&_0x3178e6[_0xbb8c('0x56')]){for(var _0x5d64e3=0x0,_0x122140=_0x3178e6[_0xbb8c('0x56')];_0x5d64e3<_0x122140&&_[_0xbb8c('0x64')](_0x295667[_0xbb8c('0x63')]);_0x5d64e3++){if(_0x844fd7[_0xbb8c('0x65')]<=_0x3178e6[_0x5d64e3][_0xbb8c('0x6a')]){_0x295667[_0xbb8c('0x63')]=_0x3178e6[_0x5d64e3][_0xbb8c('0x6a')];}else if(_0x844fd7[_0xbb8c('0x65')]>_0x3178e6[_0x5d64e3]['from']&&_0x844fd7[_0xbb8c('0x65')]<=_0x3178e6[_0x5d64e3]['to']){_0x295667[_0xbb8c('0x63')]=_0x844fd7[_0xbb8c('0x65')];}}}if(_[_0xbb8c('0x64')](_0x295667[_0xbb8c('0x63')])){_0x295667['internal']=_0x52114d+0x1;}return _0x528db9(_0x295667);});});})['catch'](function(_0x32321b){_0xa91487(_0x32321b);});});}function updateUser(_0x24c8f7){return new BPromise(function(_0x39e83e,_0xb88bd8){try{if(_0x24c8f7[_0xbb8c('0x6b')]){_0x24c8f7[_0xbb8c('0x6c')]=_0x24c8f7[_0xbb8c('0x63')];_0x24c8f7[_0xbb8c('0x6d')]={'mailbox':_0x24c8f7['internal'],'password':_0x24c8f7[_0xbb8c('0x3c')],'fullname':_0x24c8f7['fullname'],'email':_0x24c8f7[_0xbb8c('0x6e')]};}if(_0x24c8f7[_0xbb8c('0x29')]==='agent'){if(!_0x24c8f7['permissions'])_0x24c8f7[_0xbb8c('0x6f')]=['101','102',_0xbb8c('0x70'),_0xbb8c('0x71'),_0xbb8c('0x72'),_0xbb8c('0x73'),_0xbb8c('0x74'),_0xbb8c('0x75'),_0xbb8c('0x76'),_0xbb8c('0x77'),_0xbb8c('0x78'),_0xbb8c('0x79'),_0xbb8c('0x7a'),'114',_0xbb8c('0x7b')];}_0x39e83e(_0x24c8f7);}catch(_0x1e72d8){_0xb88bd8(_0x1e72d8);}});}exports[_0xbb8c('0x7c')]=function(_0x487cb3,_0x489100){if(_0x487cb3['user'][_0xbb8c('0x29')]===_0xbb8c('0x2d'))throw new Error(_0xbb8c('0x7d'));if(_0x487cb3['body'][_0xbb8c('0x29')]===_0xbb8c('0x2b')&&_0x487cb3['user'][_0xbb8c('0x29')]!==_0xbb8c('0x7e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x487cb3[_0xbb8c('0x5b')][_0xbb8c('0x29')]===_0xbb8c('0x7e')&&_0x487cb3[_0xbb8c('0x2b')][_0xbb8c('0x29')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xbb8c('0x7f')]([_0x487cb3[_0xbb8c('0x5b')]])[_0xbb8c('0x26')](function(){return validateUser(_0x487cb3[_0xbb8c('0x5b')]);})[_0xbb8c('0x26')](function(_0x5d0e77){return updateUser(_0x5d0e77)[_0xbb8c('0x26')](function(_0x1cebba){if(_0x1cebba['role']===_0xbb8c('0x7e')){_0x1cebba[_0xbb8c('0x80')]=_0x487cb3[_0xbb8c('0x2b')][_0xbb8c('0x80')];delete _0x1cebba[_0xbb8c('0x81')];}return _0x1cebba;});})[_0xbb8c('0x26')](function(_0x23f823){return db[_0xbb8c('0x38')][_0xbb8c('0x7c')](_0x23f823,{'include':[{'model':db['VoiceMail'],'as':_0xbb8c('0x6d')}]});})[_0xbb8c('0x26')](function(_0x42b3a6){if(_0x487cb3['body'][_0xbb8c('0x29')]===_0xbb8c('0x2b'))return _0x42b3a6;if(_0x487cb3[_0xbb8c('0x2b')][_0xbb8c('0x29')]!==_0xbb8c('0x2b'))return _0x42b3a6;return db[_0xbb8c('0x82')][_0xbb8c('0x59')]({'where':{'name':_0x42b3a6[_0xbb8c('0x29')]===_0xbb8c('0x2d')?_0xbb8c('0x2c'):_0xbb8c('0x2e'),'userProfileId':_0x487cb3[_0xbb8c('0x2b')][_0xbb8c('0x81')]},'raw':!![]})[_0xbb8c('0x26')](function(_0x1634f2){if(!_0x1634f2||_0x1634f2[_0xbb8c('0x83')]!=0x0)return _0x42b3a6;return db[_0xbb8c('0x84')]['create']({'name':_0x42b3a6[_0xbb8c('0x34')],'resourceId':_0x42b3a6['id'],'type':_0x1634f2[_0xbb8c('0x34')],'sectionId':_0x1634f2['id']},{})[_0xbb8c('0x26')](function(){return _0x42b3a6;});})[_0xbb8c('0x4d')](function(_0x2f000c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f000c);throw _0x2f000c;});})[_0xbb8c('0x26')](respondWithResult(_0x489100,0xc9))[_0xbb8c('0x4d')](handleError(_0x489100,null));};exports['bulkCreate']=function(_0x2d6714,_0x268548){var _0x467d3a=_0x2d6714[_0xbb8c('0x5b')];var _0x4c1aac=[];if(_0x2d6714[_0xbb8c('0x2b')][_0xbb8c('0x29')]===_0xbb8c('0x2d'))throw new Error(_0xbb8c('0x7d'));if(_[_0xbb8c('0x85')](_0x467d3a,[_0xbb8c('0x29'),'user'])&&_0x2d6714[_0xbb8c('0x2b')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x467d3a,[_0xbb8c('0x29'),_0xbb8c('0x7e')])&&_0x2d6714[_0xbb8c('0x2b')][_0xbb8c('0x29')]!=='admin'){throw new Error(_0xbb8c('0x86'));}return licenseUtil['checkUserLimits'](_0x467d3a)[_0xbb8c('0x26')](function(){return validateUser(_0x467d3a[0x0]);})[_0xbb8c('0x26')](function(){for(var _0x377c21=0x1;_0x377c21<_0x467d3a[_0xbb8c('0x56')];_0x377c21++){var _0x2cadb9=_0x467d3a[_0x377c21-0x1][_0xbb8c('0x63')];if(!_0x467d3a[_0x377c21][_0xbb8c('0x63')])_0x467d3a[_0x377c21][_0xbb8c('0x63')]=_0x2cadb9+0x1;_0x4c1aac[_0xbb8c('0x42')](validateUser(_0x467d3a[_0x377c21]));}return BPromise[_0xbb8c('0x4c')](_0x4c1aac);})['then'](function(){_0x4c1aac=[];for(var _0x10af80=0x0;_0x10af80<_0x467d3a[_0xbb8c('0x56')];_0x10af80++){_0x4c1aac[_0xbb8c('0x42')](updateUser(_0x467d3a[_0x10af80]));}return BPromise[_0xbb8c('0x4c')](_0x4c1aac);})[_0xbb8c('0x26')](function(){return BPromise[_0xbb8c('0x87')](_0x467d3a,function(_0x2327df){return db[_0xbb8c('0x38')][_0xbb8c('0x7c')](_0x2327df,{'include':[{'model':db[_0xbb8c('0x6d')],'as':_0xbb8c('0x6d')}]})[_0xbb8c('0x26')](function(_0x327e75){_0x2327df['id']=_0x327e75['id'];return _0x2327df;});});})[_0xbb8c('0x26')](function(_0x1a595f){if(_0x2d6714[_0xbb8c('0x5b')]['role']===_0xbb8c('0x2b'))return _0x1a595f;if(_0x2d6714[_0xbb8c('0x2b')][_0xbb8c('0x29')]!==_0xbb8c('0x2b'))return _0x1a595f;var _0x275268=_[_0xbb8c('0x85')](_0x1a595f,function(_0x16b587){return _0x16b587['role']===_0xbb8c('0x2d')||_0x16b587[_0xbb8c('0x29')]===_0xbb8c('0x88');});if(!_0x275268)return _0x1a595f;return db['UserProfileSection'][_0xbb8c('0x89')]({'where':{'name':{'$or':[_0xbb8c('0x2c'),_0xbb8c('0x2e')]},'userProfileId':_0x2d6714['user'][_0xbb8c('0x81')]},'raw':!![]})['then'](function(_0x4fc299){if(_[_0xbb8c('0x8a')](_0x4fc299)||!_[_0xbb8c('0x85')](_0x4fc299,[_0xbb8c('0x83'),0x0]))return _0x1a595f;_0x4c1aac=[];var _0x3f01d4=_(_0x4fc299)[_0xbb8c('0x31')](function(_0x4ac9c9){if(_0x4ac9c9[_0xbb8c('0x83')]===0x1)return;return _0x4ac9c9[_0xbb8c('0x34')]===_0xbb8c('0x2c')?_0xbb8c('0x2d'):'telephone';})['compact']()[_0xbb8c('0x32')]();for(var _0xdeddce=0x0;_0xdeddce<_0x1a595f[_0xbb8c('0x56')];_0xdeddce++){if(!_[_0xbb8c('0x33')](_0x3f01d4,_0x1a595f[_0xdeddce][_0xbb8c('0x29')]))return;var _0x3358d8=_0x1a595f[_0xdeddce][_0xbb8c('0x29')]===_0xbb8c('0x2d')?_0xbb8c('0x2c'):_0xbb8c('0x2e');_0x4c1aac[_0xbb8c('0x42')](db['UserProfileResource'][_0xbb8c('0x7c')]({'name':_0x1a595f[_0xdeddce]['name'],'resourceId':_0x1a595f[_0xdeddce]['id'],'type':_0x3358d8,'sectionId':_['find'](_0x4fc299,[_0xbb8c('0x34'),_0x3358d8])['id']},{}));}return BPromise[_0xbb8c('0x4c')](_0x4c1aac);});})[_0xbb8c('0x26')](respondWithResult(_0x268548,0xc9))['catch'](handleError(_0x268548,null));};exports['changePassword']=function(_0x1cc713,_0x57ef31){if(_0x1cc713[_0xbb8c('0x5b')]['id']){delete _0x1cc713[_0xbb8c('0x5b')]['id'];}return db[_0xbb8c('0x38')][_0xbb8c('0x59')]({'where':{'id':_0x1cc713[_0xbb8c('0x4e')]['id']}})['then'](function(_0x286950){if(!_0x286950)return null;if(_0x286950['id']===_0x1cc713[_0xbb8c('0x2b')]['id']){if(!_0x1cc713[_0xbb8c('0x5b')][_0xbb8c('0x8b')]||!_0x1cc713[_0xbb8c('0x5b')][_0xbb8c('0x8c')]){throw new db[(_0xbb8c('0x8d'))][(_0xbb8c('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x286950['authenticate'](_0x1cc713['body'][_0xbb8c('0x8b')])){throw new db['Sequelize']['ValidationError'](_0xbb8c('0x8f'));}if(_0x1cc713[_0xbb8c('0x5b')][_0xbb8c('0x8b')]===_0x1cc713[_0xbb8c('0x5b')]['newPassword']){throw new db[(_0xbb8c('0x8d'))]['ValidationError'](_0xbb8c('0x90'));}}else if(_0x1cc713['user']['role']==='admin'){if(!_0x1cc713[_0xbb8c('0x5b')]['newPassword']){throw new db[(_0xbb8c('0x8d'))][(_0xbb8c('0x8e'))](_0xbb8c('0x91'));}}else if(_0x1cc713[_0xbb8c('0x2b')]['role']===_0xbb8c('0x2b')){if(!_0x1cc713['body'][_0xbb8c('0x8c')]){throw new db[(_0xbb8c('0x8d'))][(_0xbb8c('0x8e'))](_0xbb8c('0x91'));}if(_0x286950[_0xbb8c('0x29')]!==_0xbb8c('0x2d')){throw new db['Sequelize'][(_0xbb8c('0x8e'))](_0xbb8c('0x7d'));}}else{throw new db['Sequelize']['ValidationError'](_0xbb8c('0x7d'));}return _0x286950;})[_0xbb8c('0x26')](handleEntityNotFound(_0x57ef31,null))[_0xbb8c('0x26')](function(_0x42e22d){return db[_0xbb8c('0x5f')]['findOne']({'attributes':['id',_0xbb8c('0x61'),_0xbb8c('0x92'),'passwordHistoryLimit']})[_0xbb8c('0x26')](function(_0x1f37f1){if(_0x1f37f1[_0xbb8c('0x61')])authService[_0xbb8c('0x62')](_0x1cc713[_0xbb8c('0x5b')][_0xbb8c('0x8c')]);if(!_0x1f37f1[_0xbb8c('0x92')]||!_0x42e22d[_0xbb8c('0x93')])return _0x42e22d;authService[_0xbb8c('0x94')](_0x1cc713[_0xbb8c('0x5b')][_0xbb8c('0x8c')],_0x42e22d[_0xbb8c('0x93')],_0x1f37f1['passwordHistoryLimit']);return _0x42e22d;})[_0xbb8c('0x26')](saveUpdates({'password':_0x1cc713[_0xbb8c('0x5b')]['newPassword'],'passwordResetAt':_0x1cc713[_0xbb8c('0x2b')]['id']==_0x1cc713[_0xbb8c('0x4e')]['id']?moment():null,'previousPasswords':authService[_0xbb8c('0x95')](_0x1cc713[_0xbb8c('0x5b')]['newPassword'],_0x42e22d[_0xbb8c('0x93')])},null));})[_0xbb8c('0x26')](respondWithResult(_0x57ef31,null))[_0xbb8c('0x4d')](handleError(_0x57ef31,null));};exports[_0xbb8c('0x96')]=function(_0x473648,_0x354290){var _0x45a79e=_0x473648[_0xbb8c('0x5b')]['channel'];return db['User']['find']({'where':{'id':_0x473648[_0xbb8c('0x4e')]['id']},'attributes':['id','name',_0xbb8c('0x29'),_0xbb8c('0x97'),_0xbb8c('0x98'),_0xbb8c('0x99'),_0xbb8c('0x9a')]})[_0xbb8c('0x26')](handleEntityNotFound(_0x354290,null))[_0xbb8c('0x26')](function(_0x5339b3){if(_0x5339b3){if(!utils[_0xbb8c('0x9b')](_0x45a79e)){throw new db[(_0xbb8c('0x8d'))][(_0xbb8c('0x8e'))](_0xbb8c('0x9c'));}return _0x5339b3[_0xbb8c('0x9d')+_[_0xbb8c('0x9e')](_0x45a79e['toLowerCase']())+_0xbb8c('0x9f')](_0x473648['body'][_0xbb8c('0xa0')],{'penalty':_0x473648['body'][_0xbb8c('0xa1')]||0x0})['spread'](function(_0x2bd3f9){for(var _0x3a3fe4=0x0;_0x3a3fe4<_0x473648[_0xbb8c('0x5b')][_0xbb8c('0xa0')][_0xbb8c('0x56')];_0x3a3fe4+=0x1){var _0x37ff1d={'UserId':Number(_0x473648[_0xbb8c('0x4e')]['id'])};_0x37ff1d[_[_0xbb8c('0x9e')](_0x45a79e[_0xbb8c('0xa2')]())+_0xbb8c('0xa3')]=Number(_0x473648['body']['ids'][_0x3a3fe4]);socket['emit'](_0xbb8c('0x2b')+_[_0xbb8c('0x9e')](_0x45a79e[_0xbb8c('0xa2')]())+_0xbb8c('0xa4'),_0x37ff1d);}return _0x2bd3f9;})[_0xbb8c('0x26')](function(){if(_0x45a79e===_0xbb8c('0xa5')){return db[_0xbb8c('0xa6')][_0xbb8c('0x89')]({'where':{'id':_0x473648[_0xbb8c('0x5b')]['ids']||[]},'raw':!![],'attributes':['id',_0xbb8c('0x34')]});}})[_0xbb8c('0x26')](function(_0xb31dee){var _0x2585f7=_0x5339b3[_0xbb8c('0x28')]({'plain':!![]});var _0x37dac4=[];if(_0x45a79e===_0xbb8c('0xa5')&&_0x2585f7[_0xbb8c('0x29')]==='agent'&&_0x2585f7[_0xbb8c('0x97')]){for(var _0x1bcab2=0x0;_0x1bcab2<_0xb31dee[_0xbb8c('0x56')];_0x1bcab2+=0x1){_0x37dac4[_0xbb8c('0x42')]({'membername':_0x2585f7[_0xbb8c('0x34')],'UserId':_0x2585f7['id'],'queue_name':_0xb31dee[_0x1bcab2][_0xbb8c('0x34')],'VoiceQueueId':_0xb31dee[_0x1bcab2]['id'],'interface':_['isNil'](_0x2585f7['interface'])?util[_0xbb8c('0xa7')](_0xbb8c('0xa8'),_0x2585f7[_0xbb8c('0x34')]):_0x2585f7[_0xbb8c('0x9a')],'paused':_0x2585f7['voicePause']||![],'penalty':_0x473648[_0xbb8c('0x5b')][_0xbb8c('0xa1')]||0x0});}return BPromise[_0xbb8c('0x87')](_0x37dac4,function(_0x284522){return db[_0xbb8c('0xa9')][_0xbb8c('0xaa')](_0x284522);});}return _0x5339b3;});}})[_0xbb8c('0x26')](respondWithStatusCode(_0x354290,null))[_0xbb8c('0x4d')](handleError(_0x354290,null));};exports[_0xbb8c('0xab')]=function(_0x5554e3,_0x1f00cc){var _0x278d39;return db[_0xbb8c('0x38')]['find']({'where':{'id':_0x5554e3['params']['id']},'attributes':['id','name',_0xbb8c('0x29')]})[_0xbb8c('0x26')](handleEntityNotFound(_0x1f00cc,null))[_0xbb8c('0x26')](function(_0x1ccccc){if(_0x1ccccc){_0x278d39=_0x1ccccc;if(!_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xac')]||!utils[_0xbb8c('0x9b')](_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xac')])){throw new db[(_0xbb8c('0x8d'))][(_0xbb8c('0x8e'))](_0xbb8c('0x9c'));}return _0x1ccccc['remove'+_['capitalize'](_0x5554e3[_0xbb8c('0x3e')]['channel'][_0xbb8c('0xa2')]())+_0xbb8c('0x9f')](_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xa0')]);}})['then'](function(_0x225222){if(_[_0xbb8c('0xad')](_0x5554e3[_0xbb8c('0x3e')]['ids'])){for(var _0x28f62c=0x0;_0x28f62c<_0x5554e3[_0xbb8c('0x3e')]['ids'][_0xbb8c('0x56')];_0x28f62c+=0x1){var _0x29937f={'UserId':Number(_0x5554e3['params']['id'])};_0x29937f[_[_0xbb8c('0x9e')](_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xac')][_0xbb8c('0xa2')]())+_0xbb8c('0xa3')]=Number(_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xa0')][_0x28f62c]);socket[_0xbb8c('0xae')](_0xbb8c('0x2b')+_[_0xbb8c('0x9e')](_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xac')][_0xbb8c('0xa2')]())+_0xbb8c('0xaf'),_0x29937f);}}else{var _0x29937f={'UserId':Number(_0x5554e3['params']['id'])};_0x29937f[_[_0xbb8c('0x9e')](_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xac')][_0xbb8c('0xa2')]())+_0xbb8c('0xa3')]=Number(_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xa0')]);socket[_0xbb8c('0xae')](_0xbb8c('0x2b')+_['capitalize'](_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xac')][_0xbb8c('0xa2')]())+_0xbb8c('0xaf'),_0x29937f);}return _0x225222;})[_0xbb8c('0x26')](function(){if(_0x5554e3[_0xbb8c('0x3e')][_0xbb8c('0xac')]===_0xbb8c('0xa5')){return db[_0xbb8c('0xa9')]['destroy']({'where':{'UserId':_0x5554e3[_0xbb8c('0x4e')]['id'],'VoiceQueueId':_0x5554e3['query'][_0xbb8c('0xa0')]},'individualHooks':!![]})[_0xbb8c('0x26')](function(){return _0x278d39;});}return _0x278d39;})[_0xbb8c('0x26')](respondWithStatusCode(_0x1f00cc,null))['catch'](handleError(_0x1f00cc,null));};exports[_0xbb8c('0xb0')]=function(_0x20155f,_0x10afd9){_0x20155f['body'][_0xbb8c('0xb1')]=_0x20155f[_0xbb8c('0xb2')]['filename'];return db[_0xbb8c('0x38')]['find']({'where':{'id':_0x20155f[_0xbb8c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10afd9,null))['then'](saveUpdates(_0x20155f[_0xbb8c('0x5b')],null))[_0xbb8c('0x26')](respondWithResult(_0x10afd9,null))[_0xbb8c('0x4d')](handleError(_0x10afd9,null));};exports['getAvatar']=function(_0x141e3c,_0x15f19b){var _0x12ffa7=path[_0xbb8c('0xb3')](config['root'],_0xbb8c('0xb4'));return db[_0xbb8c('0x38')][_0xbb8c('0x59')]({'where':{'id':_0x141e3c[_0xbb8c('0x4e')]['id']},'attributes':['id',_0xbb8c('0xb1')],'raw':!![]})[_0xbb8c('0x26')](handleEntityNotFound(_0x15f19b,null))[_0xbb8c('0x26')](function(_0x1c036){if(_0x1c036){if(_[_0xbb8c('0x64')](_0x1c036['userpic'])){return _0x15f19b[_0xbb8c('0xb5')](_0x12ffa7);}else{if(!fs[_0xbb8c('0xb6')](path[_0xbb8c('0xb3')](config['root'],_0xbb8c('0xb7'),_0x1c036[_0xbb8c('0xb1')]))){return _0x15f19b['download'](_0x12ffa7);}return _0x15f19b[_0xbb8c('0xb5')](path[_0xbb8c('0xb3')](config[_0xbb8c('0xb8')],_0xbb8c('0xb7'),_0x1c036[_0xbb8c('0xb1')]));}}})[_0xbb8c('0x4d')](handleError(_0x15f19b,null));};exports[_0xbb8c('0xb9')]=function(_0x257eb8,_0x4cd8b7){return db[_0xbb8c('0x38')]['find']({'where':{'id':_0x257eb8[_0xbb8c('0x4e')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4cd8b7,null))[_0xbb8c('0x26')](function(_0x2a33eb){var _0x3245ff=[];values=_0x2a33eb['dataValues'];_0x3245ff[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x5a'),_0x2a33eb[_0xbb8c('0x47')]));_0x3245ff[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x46'),_0x2a33eb[_0xbb8c('0x47')]));_0x3245ff[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x4a'),_0x2a33eb[_0xbb8c('0x47')]));_0x3245ff[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x4b'),_0x2a33eb[_0xbb8c('0x47')]));_0x3245ff[_0xbb8c('0x42')](get_open_tabs(_0xbb8c('0x48'),_0x2a33eb[_0xbb8c('0x47')]));_0x3245ff['push'](get_open_tabs(_0xbb8c('0x49'),_0x2a33eb['dataValues']));return BPromise[_0xbb8c('0x4c')](_0x3245ff);})[_0xbb8c('0x26')](function(_0x3580a9){var _0x5baa41=[];if(_0x3580a9){for(var _0x387935=0x0;_0x387935=_0x35f58a){_0x25043b=_0x35f58a;_0x493a65=0xc8;}else{_0x493a65=0xce;}_0x3092e1[_0x4d0e('0x1e')](_0x493a65);return _0x3092e1['set']('Content-Range',_0x1a237f+'-'+_0x25043b+'/'+_0x35f58a)[_0x4d0e('0x1f')](_0x370aab);}return null;};}function saveUpdates(_0x1073c6){return function(_0x427582){if(_0x427582){return _0x427582[_0x4d0e('0x24')](_0x1073c6)[_0x4d0e('0x12')](function(_0x7e551d){return _0x7e551d;});}return null;};}function removeEntity(_0x39cdb8){return function(_0x4f876a){if(_0x4f876a){return _0x4f876a[_0x4d0e('0x25')]()['then'](function(){var _0x487249=_0x4f876a[_0x4d0e('0x26')]({'plain':!![]});if(_0x487249[_0x4d0e('0x27')]===_0x4d0e('0x28'))return;var _0x3311c3=[{'name':_0x4d0e('0x29'),'value':_0x4d0e('0x2a'),'ignore':!![]},{'name':'Agents','value':_0x4d0e('0x2b'),'ignore':![]},{'name':_0x4d0e('0x2c'),'value':_0x4d0e('0x2d'),'ignore':![]}];var _0xff86c=_(_0x3311c3)['filter'](_0x4d0e('0x2e'))[_0x4d0e('0x2f')](_0x4d0e('0x30'))[_0x4d0e('0x30')]();if(_[_0x4d0e('0x31')](_0xff86c,_0x487249[_0x4d0e('0x27')])){return;}var _0x15c89b=_['find'](_0x3311c3,[_0x4d0e('0x30'),_0x487249[_0x4d0e('0x27')]])['name'];return db[_0x4d0e('0x32')][_0x4d0e('0x25')]({'where':{'type':_0x15c89b,'resourceId':_0x487249['id']}})[_0x4d0e('0x12')](function(){return _0x4f876a;});})[_0x4d0e('0x12')](function(){_0x39cdb8[_0x4d0e('0x1e')](0xcc)[_0x4d0e('0x1d')]();});}};}function handleEntityNotFound(_0x40ece3){return function(_0x3caa66){if(!_0x3caa66){_0x40ece3[_0x4d0e('0x33')](0x194);}return _0x3caa66;};}function handleError(_0x122d7f,_0x74305e){_0x74305e=_0x74305e||0x1f4;return function(_0x1cbcc7){logger[_0x4d0e('0x18')](_0x1cbcc7[_0x4d0e('0x34')]);if(_0x1cbcc7[_0x4d0e('0x35')]){delete _0x1cbcc7[_0x4d0e('0x35')];}_0x122d7f['status'](_0x74305e)['send'](_0x1cbcc7);};}exports[_0x4d0e('0x36')]=function(_0x2faaaf,_0xd21bfe){var _0x19774a={},_0x2c5b83={'count':0x0,'rows':[]};var _0x2cd14b=_(db[_0x4d0e('0x37')]['rawAttributes'])[_0x4d0e('0x2f')](function(_0x1fe040){return{'name':_0x1fe040[_0x4d0e('0x38')],'type':_0x1fe040['type'][_0x4d0e('0x39')]};})[_0x4d0e('0x3a')](function(_0x4a576b){return!_[_0x4d0e('0x31')](['password',_0x4d0e('0x3b')],_0x4a576b['name']);})[_0x4d0e('0x30')]();_0x19774a=qs[_0x4d0e('0x3c')](_0x2cd14b,_0x2faaaf);var _0x4fdfe0={'where':_0x19774a[_0x4d0e('0x3d')]};return db[_0x4d0e('0x37')][_0x4d0e('0x23')](_0x4fdfe0)['then'](function(_0x43819b){_0x2c5b83['count']=_0x43819b;if(_0x2faaaf[_0x4d0e('0x3e')][_0x4d0e('0x3f')]){_0x19774a[_0x4d0e('0x40')]=[{'all':!![]}];}if(!_['includes'](_0x19774a['attributes'],'id')){_0x19774a[_0x4d0e('0x41')][_0x4d0e('0x42')]('id');}return db[_0x4d0e('0x37')]['findAll'](_0x19774a);})[_0x4d0e('0x12')](function(_0x1a7b57){_0x2c5b83['rows']=_0x1a7b57;if(_0x2faaaf[_0x4d0e('0x3e')][_0x4d0e('0x43')]===_0x4d0e('0x44')){var _0x4ecb8f=[];for(var _0x36f453=0x0;_0x36f453<_0x2c5b83['rows'][_0x4d0e('0x45')];_0x36f453++){_0x4ecb8f['push'](get_open_tabs(_0x4d0e('0x46'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x49'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4a'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4b'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f['push'](get_open_tabs('openchannel',_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));_0x4ecb8f[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4c'),_0x2c5b83[_0x4d0e('0x47')][_0x36f453][_0x4d0e('0x48')]));}return BPromise[_0x4d0e('0x4d')](_0x4ecb8f)[_0x4d0e('0x12')](function(_0x2a8bd9){return _0x2c5b83;});}else{return _0x2c5b83;}})[_0x4d0e('0x12')](respondWithFilteredResult(_0xd21bfe,_0x19774a))[_0x4d0e('0x1c')](handleError(_0xd21bfe,null));};exports['show']=function(_0x28c5ba,_0x18da15){var _0x3a7ccb={'raw':![],'where':{'id':_0x28c5ba[_0x4d0e('0x4e')]['id']}},_0x1521bf={};_0x1521bf['model']=_[_0x4d0e('0x4f')](_[_0x4d0e('0x50')](db[_0x4d0e('0x37')][_0x4d0e('0x51')]),[_0x4d0e('0x52'),_0x4d0e('0x3b')]);_0x1521bf['query']=_[_0x4d0e('0x50')](_0x28c5ba['query']);_0x1521bf[_0x4d0e('0x53')]=_[_0x4d0e('0x54')](_0x1521bf[_0x4d0e('0x55')],_0x1521bf[_0x4d0e('0x3e')]);_0x3a7ccb['attributes']=_[_0x4d0e('0x54')](_0x1521bf[_0x4d0e('0x55')],qs[_0x4d0e('0x56')](_0x28c5ba[_0x4d0e('0x3e')][_0x4d0e('0x56')]));_0x3a7ccb[_0x4d0e('0x41')]=_0x3a7ccb['attributes'][_0x4d0e('0x45')]?_0x3a7ccb[_0x4d0e('0x41')]:_0x1521bf[_0x4d0e('0x55')];if(_0x28c5ba['query'][_0x4d0e('0x3f')]){_0x3a7ccb[_0x4d0e('0x40')]=[{'all':!![]}];}_0x3a7ccb=_['merge']({},_0x3a7ccb,_0x28c5ba[_0x4d0e('0x57')]);if(!_[_0x4d0e('0x31')](_0x3a7ccb[_0x4d0e('0x41')],'id')){_0x3a7ccb[_0x4d0e('0x41')][_0x4d0e('0x42')]('id');}return db[_0x4d0e('0x37')][_0x4d0e('0x58')](_0x3a7ccb)['then'](handleEntityNotFound(_0x18da15,null))[_0x4d0e('0x12')](function(_0x136bc){var _0x4b9839=[];values=_0x136bc;if(_0x28c5ba['query'][_0x4d0e('0x43')]==='true'){_0x4b9839['push'](get_open_tabs('chat',_0x136bc[_0x4d0e('0x48')]));_0x4b9839[_0x4d0e('0x42')](get_open_tabs('sms',_0x136bc[_0x4d0e('0x48')]));_0x4b9839[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x59'),_0x136bc[_0x4d0e('0x48')]));_0x4b9839['push'](get_open_tabs('whatsapp',_0x136bc[_0x4d0e('0x48')]));_0x4b9839[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4a'),_0x136bc[_0x4d0e('0x48')]));_0x4b9839[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4b'),_0x136bc[_0x4d0e('0x48')]));return BPromise[_0x4d0e('0x4d')](_0x4b9839);}else{return values;}})[_0x4d0e('0x12')](function(_0x2e26c9){return values;})[_0x4d0e('0x12')](respondWithResult(_0x18da15,null))[_0x4d0e('0x1c')](handleError(_0x18da15,null));};exports[_0x4d0e('0x24')]=function(_0x25e67e,_0x74b346){if(_0x25e67e[_0x4d0e('0x5a')]['id']){delete _0x25e67e[_0x4d0e('0x5a')]['id'];}delete _0x25e67e[_0x4d0e('0x5a')][_0x4d0e('0x27')];return db['User'][_0x4d0e('0x58')]({'where':{'id':_0x25e67e[_0x4d0e('0x4e')]['id']}})[_0x4d0e('0x12')](handleEntityNotFound(_0x74b346,null))[_0x4d0e('0x12')](saveUpdates(_0x25e67e[_0x4d0e('0x5a')],null))[_0x4d0e('0x12')](respondWithResult(_0x74b346,null))['catch'](handleError(_0x74b346,null));};exports['describe']=function(_0x2dace8,_0x43efc8){return db[_0x4d0e('0x37')][_0x4d0e('0x5b')]()['then'](respondWithResult(_0x43efc8,null))[_0x4d0e('0x1c')](handleError(_0x43efc8,null));};exports[_0x4d0e('0x5c')]=function(_0x1789ad,_0x14f8b1){return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x1789ad[_0x4d0e('0x4e')]['id']}})[_0x4d0e('0x12')](handleEntityNotFound(_0x14f8b1,null))['then'](function(_0x4aae9e){if(_0x4aae9e){return _0x4aae9e[_0x4d0e('0x5c')](_0x1789ad[_0x4d0e('0x5a')][_0x4d0e('0x5d')],_[_0x4d0e('0x5e')](_0x1789ad[_0x4d0e('0x5a')],['ids','id'])||{});}})[_0x4d0e('0x12')](respondWithResult(_0x14f8b1,null))[_0x4d0e('0x1c')](handleError(_0x14f8b1,null));};function validateUser(_0x34ea7c){return new BPromise(function(_0x3a06bd,_0x108e0d){if(_0x34ea7c[_0x4d0e('0x5f')])return _0x3a06bd(_0x34ea7c);return db[_0x4d0e('0x60')][_0x4d0e('0x61')](0x1)[_0x4d0e('0x12')](function(_0x68dc3c){if(_0x68dc3c[_0x4d0e('0x62')])authService[_0x4d0e('0x63')](_0x34ea7c[_0x4d0e('0x52')]);db[_0x4d0e('0x37')][_0x4d0e('0x64')](_0x4d0e('0x5f'))[_0x4d0e('0x12')](function(_0x32b920){if(_[_0x4d0e('0x65')](_0x32b920)){_0x34ea7c[_0x4d0e('0x5f')]=_0x68dc3c['min_internal']||0x1;return;}if(_[_0x4d0e('0x65')](_0x68dc3c[_0x4d0e('0x66')])||_0x68dc3c[_0x4d0e('0x66')]===_0x32b920){_0x34ea7c[_0x4d0e('0x5f')]=_0x32b920+0x1;return;}if(_0x68dc3c['min_internal']>_0x32b920){_0x34ea7c[_0x4d0e('0x5f')]=_0x68dc3c[_0x4d0e('0x66')];return;}return db[_0x4d0e('0x67')][_0x4d0e('0x3e')](_0x4d0e('0x68'),{'type':db['sequelize'][_0x4d0e('0x69')]['SELECT']})[_0x4d0e('0x12')](function(_0x16b7d7){if(_0x16b7d7&&_0x16b7d7['length']){for(var _0x45bc03=0x0,_0x48e62f=_0x16b7d7['length'];_0x45bc03<_0x48e62f&&_[_0x4d0e('0x65')](_0x34ea7c[_0x4d0e('0x5f')]);_0x45bc03++){if(_0x68dc3c[_0x4d0e('0x66')]<=_0x16b7d7[_0x45bc03][_0x4d0e('0x6a')]){_0x34ea7c[_0x4d0e('0x5f')]=_0x16b7d7[_0x45bc03][_0x4d0e('0x6a')];}else if(_0x68dc3c[_0x4d0e('0x66')]>_0x16b7d7[_0x45bc03][_0x4d0e('0x6a')]&&_0x68dc3c[_0x4d0e('0x66')]<=_0x16b7d7[_0x45bc03]['to']){_0x34ea7c[_0x4d0e('0x5f')]=_0x68dc3c['min_internal'];}}}if(_[_0x4d0e('0x65')](_0x34ea7c['internal'])){_0x34ea7c[_0x4d0e('0x5f')]=_0x32b920+0x1;}return _0x3a06bd(_0x34ea7c);});});})[_0x4d0e('0x1c')](function(_0xaaeb6a){_0x108e0d(_0xaaeb6a);});});}function updateUser(_0x491698){return new BPromise(function(_0x9502ba,_0x4a58b4){try{if(_0x491698[_0x4d0e('0x6b')]){_0x491698[_0x4d0e('0x6c')]=_0x491698[_0x4d0e('0x5f')];_0x491698['VoiceMail']={'mailbox':_0x491698[_0x4d0e('0x5f')],'password':_0x491698[_0x4d0e('0x52')],'fullname':_0x491698[_0x4d0e('0x6d')],'email':_0x491698['email']};}if(_0x491698[_0x4d0e('0x27')]===_0x4d0e('0x2b')){if(!_0x491698[_0x4d0e('0x6e')])_0x491698[_0x4d0e('0x6e')]=[_0x4d0e('0x6f'),_0x4d0e('0x70'),_0x4d0e('0x71'),_0x4d0e('0x72'),_0x4d0e('0x73'),_0x4d0e('0x74'),_0x4d0e('0x75'),_0x4d0e('0x76'),_0x4d0e('0x77'),_0x4d0e('0x78'),'109',_0x4d0e('0x79'),_0x4d0e('0x7a'),_0x4d0e('0x7b'),'115'];}_0x9502ba(_0x491698);}catch(_0x10017e){_0x4a58b4(_0x10017e);}});}exports[_0x4d0e('0x7c')]=function(_0x45d4b9,_0x5531cd){if(_0x45d4b9[_0x4d0e('0x2a')][_0x4d0e('0x27')]===_0x4d0e('0x2b'))throw new Error(_0x4d0e('0x7d'));if(_0x45d4b9['body'][_0x4d0e('0x27')]===_0x4d0e('0x2a')&&_0x45d4b9[_0x4d0e('0x2a')][_0x4d0e('0x27')]!==_0x4d0e('0x28')){throw new Error(_0x4d0e('0x7e'));}if(_0x45d4b9[_0x4d0e('0x5a')][_0x4d0e('0x27')]==='admin'&&_0x45d4b9['user'][_0x4d0e('0x27')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x4d0e('0x7f')]([_0x45d4b9['body']])[_0x4d0e('0x12')](function(){return validateUser(_0x45d4b9[_0x4d0e('0x5a')]);})[_0x4d0e('0x12')](function(_0x52242d){return updateUser(_0x52242d)['then'](function(_0x1e16ff){if(_0x1e16ff[_0x4d0e('0x27')]===_0x4d0e('0x28')){_0x1e16ff[_0x4d0e('0x80')]=_0x45d4b9['user']['settingsEnabled'];delete _0x1e16ff[_0x4d0e('0x81')];}return _0x1e16ff;});})[_0x4d0e('0x12')](function(_0x25536f){return db[_0x4d0e('0x37')]['create'](_0x25536f,{'include':[{'model':db[_0x4d0e('0x82')],'as':_0x4d0e('0x82')}]});})[_0x4d0e('0x12')](function(_0x207201){if(_0x45d4b9['body'][_0x4d0e('0x27')]===_0x4d0e('0x2a'))return _0x207201;if(_0x45d4b9[_0x4d0e('0x2a')][_0x4d0e('0x27')]!==_0x4d0e('0x2a'))return _0x207201;return db['UserProfileSection'][_0x4d0e('0x58')]({'where':{'name':_0x207201[_0x4d0e('0x27')]===_0x4d0e('0x2b')?_0x4d0e('0x83'):'Telephones','userProfileId':_0x45d4b9['user'][_0x4d0e('0x81')]},'raw':!![]})['then'](function(_0x34ad3b){if(!_0x34ad3b||_0x34ad3b[_0x4d0e('0x84')]!=0x0)return _0x207201;return db[_0x4d0e('0x32')][_0x4d0e('0x7c')]({'name':_0x207201[_0x4d0e('0x35')],'resourceId':_0x207201['id'],'type':_0x34ad3b[_0x4d0e('0x35')],'sectionId':_0x34ad3b['id']},{})[_0x4d0e('0x12')](function(){return _0x207201;});})['catch'](function(_0x5d58af){logger[_0x4d0e('0x18')](_0x4d0e('0x85'),_0x5d58af);throw _0x5d58af;});})[_0x4d0e('0x12')](respondWithResult(_0x5531cd,0xc9))[_0x4d0e('0x1c')](handleError(_0x5531cd,null));};exports[_0x4d0e('0x86')]=function(_0x52a42d,_0x42b673){var _0x1b46f3=_0x52a42d[_0x4d0e('0x5a')];var _0x114a79=[];if(_0x52a42d['user'][_0x4d0e('0x27')]==='agent')throw new Error(_0x4d0e('0x7d'));if(_[_0x4d0e('0x87')](_0x1b46f3,[_0x4d0e('0x27'),_0x4d0e('0x2a')])&&_0x52a42d[_0x4d0e('0x2a')][_0x4d0e('0x27')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x4d0e('0x87')](_0x1b46f3,[_0x4d0e('0x27'),_0x4d0e('0x28')])&&_0x52a42d[_0x4d0e('0x2a')][_0x4d0e('0x27')]!==_0x4d0e('0x28')){throw new Error(_0x4d0e('0x88'));}return licenseUtil[_0x4d0e('0x7f')](_0x1b46f3)[_0x4d0e('0x12')](function(){return validateUser(_0x1b46f3[0x0]);})[_0x4d0e('0x12')](function(){for(var _0x4f9da8=0x1;_0x4f9da8<_0x1b46f3[_0x4d0e('0x45')];_0x4f9da8++){var _0x4d482b=_0x1b46f3[_0x4f9da8-0x1][_0x4d0e('0x5f')];if(!_0x1b46f3[_0x4f9da8][_0x4d0e('0x5f')])_0x1b46f3[_0x4f9da8][_0x4d0e('0x5f')]=_0x4d482b+0x1;_0x114a79[_0x4d0e('0x42')](validateUser(_0x1b46f3[_0x4f9da8]));}return BPromise[_0x4d0e('0x4d')](_0x114a79);})[_0x4d0e('0x12')](function(){_0x114a79=[];for(var _0x3f2bf6=0x0;_0x3f2bf6<_0x1b46f3['length'];_0x3f2bf6++){_0x114a79[_0x4d0e('0x42')](updateUser(_0x1b46f3[_0x3f2bf6]));}return BPromise[_0x4d0e('0x4d')](_0x114a79);})[_0x4d0e('0x12')](function(){return BPromise[_0x4d0e('0x89')](_0x1b46f3,function(_0x4906c2){return db[_0x4d0e('0x37')][_0x4d0e('0x7c')](_0x4906c2,{'include':[{'model':db['VoiceMail'],'as':_0x4d0e('0x82')}]})[_0x4d0e('0x12')](function(_0x1837d5){_0x4906c2['id']=_0x1837d5['id'];return _0x4906c2;});});})['then'](function(_0x59f591){if(_0x52a42d[_0x4d0e('0x5a')][_0x4d0e('0x27')]===_0x4d0e('0x2a'))return _0x59f591;if(_0x52a42d[_0x4d0e('0x2a')]['role']!==_0x4d0e('0x2a'))return _0x59f591;var _0xc9537a=_[_0x4d0e('0x87')](_0x59f591,function(_0x3e5792){return _0x3e5792[_0x4d0e('0x27')]===_0x4d0e('0x2b')||_0x3e5792[_0x4d0e('0x27')]===_0x4d0e('0x2d');});if(!_0xc9537a)return _0x59f591;return db[_0x4d0e('0x8a')][_0x4d0e('0x8b')]({'where':{'name':{'$or':['Agents',_0x4d0e('0x2c')]},'userProfileId':_0x52a42d[_0x4d0e('0x2a')][_0x4d0e('0x81')]},'raw':!![]})[_0x4d0e('0x12')](function(_0x490f1c){if(_[_0x4d0e('0x8c')](_0x490f1c)||!_[_0x4d0e('0x87')](_0x490f1c,['autoAssociation',0x0]))return _0x59f591;_0x114a79=[];var _0x329e3b=_(_0x490f1c)[_0x4d0e('0x2f')](function(_0x3f6df7){if(_0x3f6df7['autoAssociation']===0x1)return;return _0x3f6df7[_0x4d0e('0x35')]===_0x4d0e('0x83')?_0x4d0e('0x2b'):'telephone';})[_0x4d0e('0x8d')]()['value']();for(var _0x373e1a=0x0;_0x373e1a<_0x59f591[_0x4d0e('0x45')];_0x373e1a++){if(!_[_0x4d0e('0x31')](_0x329e3b,_0x59f591[_0x373e1a][_0x4d0e('0x27')]))return;var _0x567e47=_0x59f591[_0x373e1a][_0x4d0e('0x27')]===_0x4d0e('0x2b')?_0x4d0e('0x83'):'Telephones';_0x114a79[_0x4d0e('0x42')](db[_0x4d0e('0x32')][_0x4d0e('0x7c')]({'name':_0x59f591[_0x373e1a][_0x4d0e('0x35')],'resourceId':_0x59f591[_0x373e1a]['id'],'type':_0x567e47,'sectionId':_['find'](_0x490f1c,[_0x4d0e('0x35'),_0x567e47])['id']},{}));}return BPromise[_0x4d0e('0x4d')](_0x114a79);});})[_0x4d0e('0x12')](respondWithResult(_0x42b673,0xc9))[_0x4d0e('0x1c')](handleError(_0x42b673,null));};exports[_0x4d0e('0x8e')]=function(_0x4fb73b,_0x528977){if(_0x4fb73b['body']['id']){delete _0x4fb73b['body']['id'];}return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x4fb73b[_0x4d0e('0x4e')]['id']}})[_0x4d0e('0x12')](function(_0x3b33b9){if(!_0x3b33b9)return null;if(_0x3b33b9['id']===_0x4fb73b[_0x4d0e('0x2a')]['id']){if(!_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x8f')]||!_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]){throw new db[(_0x4d0e('0x91'))]['ValidationError'](_0x4d0e('0x92'));}if(!_0x3b33b9[_0x4d0e('0x93')](_0x4fb73b['body'][_0x4d0e('0x8f')])){throw new db[(_0x4d0e('0x91'))][(_0x4d0e('0x94'))]('Wrong\x20credentials');}if(_0x4fb73b['body'][_0x4d0e('0x8f')]===_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]){throw new db[(_0x4d0e('0x91'))][(_0x4d0e('0x94'))](_0x4d0e('0x95'));}}else if(_0x4fb73b[_0x4d0e('0x2a')][_0x4d0e('0x27')]===_0x4d0e('0x28')){if(!_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]){throw new db['Sequelize'][(_0x4d0e('0x94'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4fb73b[_0x4d0e('0x2a')]['role']===_0x4d0e('0x2a')){if(!_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]){throw new db['Sequelize'][(_0x4d0e('0x94'))](_0x4d0e('0x96'));}if(_0x3b33b9[_0x4d0e('0x27')]!=='agent'){throw new db[(_0x4d0e('0x91'))]['ValidationError'](_0x4d0e('0x7d'));}}else{throw new db[(_0x4d0e('0x91'))]['ValidationError'](_0x4d0e('0x7d'));}return _0x3b33b9;})[_0x4d0e('0x12')](handleEntityNotFound(_0x528977,null))[_0x4d0e('0x12')](function(_0x1f43eb){return db[_0x4d0e('0x60')][_0x4d0e('0x97')]({'attributes':['id',_0x4d0e('0x62'),_0x4d0e('0x98'),_0x4d0e('0x99')]})[_0x4d0e('0x12')](function(_0x54585a){if(_0x54585a['securePassword'])authService[_0x4d0e('0x63')](_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')]);if(!_0x54585a[_0x4d0e('0x98')]||!_0x1f43eb['previousPasswords'])return _0x1f43eb;authService['validatePasswordHistory'](_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')],_0x1f43eb[_0x4d0e('0x9a')],_0x54585a['passwordHistoryLimit']);return _0x1f43eb;})[_0x4d0e('0x12')](saveUpdates({'password':_0x4fb73b[_0x4d0e('0x5a')]['newPassword'],'passwordResetAt':_0x4fb73b[_0x4d0e('0x2a')]['id']==_0x4fb73b['params']['id']?moment():null,'previousPasswords':authService[_0x4d0e('0x9b')](_0x4fb73b[_0x4d0e('0x5a')][_0x4d0e('0x90')],_0x1f43eb[_0x4d0e('0x9a')])},null));})['then'](respondWithResult(_0x528977,null))['catch'](handleError(_0x528977,null));};exports[_0x4d0e('0x9c')]=function(_0x5bbd42,_0x1c949c){var _0x494e10=_0x5bbd42[_0x4d0e('0x5a')][_0x4d0e('0x9d')];return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x5bbd42['params']['id']},'attributes':['id','name',_0x4d0e('0x27'),_0x4d0e('0x9e'),_0x4d0e('0x9f'),_0x4d0e('0xa0'),_0x4d0e('0xa1')]})[_0x4d0e('0x12')](handleEntityNotFound(_0x1c949c,null))[_0x4d0e('0x12')](function(_0x4f4c23){if(_0x4f4c23){if(!utils['isValidChannel'](_0x494e10)){throw new db[(_0x4d0e('0x91'))][(_0x4d0e('0x94'))]('Unknown\x20channel');}return _0x4f4c23[_0x4d0e('0xa2')+_[_0x4d0e('0xa3')](_0x494e10['toLowerCase']())+_0x4d0e('0xa4')](_0x5bbd42[_0x4d0e('0x5a')]['ids'],{'penalty':_0x5bbd42['body'][_0x4d0e('0xa5')]||0x0})[_0x4d0e('0xa6')](function(_0x5a0a87){for(var _0x538b89=0x0;_0x538b89<_0x5bbd42[_0x4d0e('0x5a')][_0x4d0e('0x5d')][_0x4d0e('0x45')];_0x538b89+=0x1){var _0x14f6fb={'UserId':Number(_0x5bbd42[_0x4d0e('0x4e')]['id'])};_0x14f6fb[_['capitalize'](_0x494e10['toLowerCase']())+_0x4d0e('0xa7')]=Number(_0x5bbd42['body'][_0x4d0e('0x5d')][_0x538b89]);socket['emit'](_0x4d0e('0x2a')+_[_0x4d0e('0xa3')](_0x494e10['toLowerCase']())+_0x4d0e('0xa8'),_0x14f6fb);}return _0x5a0a87;})[_0x4d0e('0x12')](function(){if(_0x494e10==='voice'){return db['VoiceQueue'][_0x4d0e('0x8b')]({'where':{'id':_0x5bbd42['body'][_0x4d0e('0x5d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x4d0e('0x12')](function(_0xa83856){var _0x5a1491=_0x4f4c23[_0x4d0e('0x26')]({'plain':!![]});var _0x47b20a=[];if(_0x494e10===_0x4d0e('0xa9')&&_0x5a1491[_0x4d0e('0x27')]===_0x4d0e('0x2b')&&_0x5a1491[_0x4d0e('0x9e')]){for(var _0x2b14c9=0x0;_0x2b14c9<_0xa83856[_0x4d0e('0x45')];_0x2b14c9+=0x1){_0x47b20a[_0x4d0e('0x42')]({'membername':_0x5a1491['name'],'UserId':_0x5a1491['id'],'queue_name':_0xa83856[_0x2b14c9][_0x4d0e('0x35')],'VoiceQueueId':_0xa83856[_0x2b14c9]['id'],'interface':_['isNil'](_0x5a1491[_0x4d0e('0xa1')])?util['format']('SIP/%s',_0x5a1491[_0x4d0e('0x35')]):_0x5a1491['interface'],'paused':_0x5a1491[_0x4d0e('0xa0')]||![],'penalty':_0x5bbd42[_0x4d0e('0x5a')]['penalty']||0x0});}return BPromise[_0x4d0e('0x89')](_0x47b20a,function(_0x14fa2c){return db[_0x4d0e('0xaa')][_0x4d0e('0xab')](_0x14fa2c);});}return _0x4f4c23;});}})['then'](respondWithStatusCode(_0x1c949c,null))[_0x4d0e('0x1c')](handleError(_0x1c949c,null));};exports['removeQueues']=function(_0x47e59e,_0x55cf54){var _0x422550;return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x47e59e['params']['id']},'attributes':['id','name','role']})[_0x4d0e('0x12')](handleEntityNotFound(_0x55cf54,null))[_0x4d0e('0x12')](function(_0x2d3eab){if(_0x2d3eab){_0x422550=_0x2d3eab;if(!_0x47e59e[_0x4d0e('0x3e')]['channel']||!utils[_0x4d0e('0xac')](_0x47e59e['query'][_0x4d0e('0x9d')])){throw new db['Sequelize'][(_0x4d0e('0x94'))](_0x4d0e('0xad'));}return _0x2d3eab['remove'+_[_0x4d0e('0xa3')](_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x9d')]['toLowerCase']())+'Queues'](_0x47e59e['query']['ids']);}})[_0x4d0e('0x12')](function(_0x457f98){if(_[_0x4d0e('0xae')](_0x47e59e[_0x4d0e('0x3e')]['ids'])){for(var _0x3dcc81=0x0;_0x3dcc81<_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x5d')]['length'];_0x3dcc81+=0x1){var _0x407cda={'UserId':Number(_0x47e59e['params']['id'])};_0x407cda[_[_0x4d0e('0xa3')](_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x9d')][_0x4d0e('0xaf')]())+_0x4d0e('0xa7')]=Number(_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x5d')][_0x3dcc81]);socket[_0x4d0e('0xb0')](_0x4d0e('0x2a')+_['capitalize'](_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x9d')][_0x4d0e('0xaf')]())+_0x4d0e('0xb1'),_0x407cda);}}else{var _0x407cda={'UserId':Number(_0x47e59e[_0x4d0e('0x4e')]['id'])};_0x407cda[_[_0x4d0e('0xa3')](_0x47e59e[_0x4d0e('0x3e')]['channel'][_0x4d0e('0xaf')]())+_0x4d0e('0xa7')]=Number(_0x47e59e[_0x4d0e('0x3e')]['ids']);socket[_0x4d0e('0xb0')](_0x4d0e('0x2a')+_['capitalize'](_0x47e59e[_0x4d0e('0x3e')]['channel'][_0x4d0e('0xaf')]())+_0x4d0e('0xb1'),_0x407cda);}return _0x457f98;})[_0x4d0e('0x12')](function(){if(_0x47e59e[_0x4d0e('0x3e')]['channel']==='voice'){return db[_0x4d0e('0xaa')][_0x4d0e('0x25')]({'where':{'UserId':_0x47e59e['params']['id'],'VoiceQueueId':_0x47e59e[_0x4d0e('0x3e')][_0x4d0e('0x5d')]},'individualHooks':!![]})['then'](function(){return _0x422550;});}return _0x422550;})['then'](respondWithStatusCode(_0x55cf54,null))[_0x4d0e('0x1c')](handleError(_0x55cf54,null));};exports['addAvatar']=function(_0x100c83,_0x236626){_0x100c83[_0x4d0e('0x5a')][_0x4d0e('0xb2')]=_0x100c83[_0x4d0e('0xb3')][_0x4d0e('0xb4')];return db[_0x4d0e('0x37')]['find']({'where':{'id':_0x100c83[_0x4d0e('0x4e')]['id']}})[_0x4d0e('0x12')](handleEntityNotFound(_0x236626,null))[_0x4d0e('0x12')](saveUpdates(_0x100c83[_0x4d0e('0x5a')],null))[_0x4d0e('0x12')](respondWithResult(_0x236626,null))['catch'](handleError(_0x236626,null));};exports[_0x4d0e('0xb5')]=function(_0x18bbd3,_0x1681b7){var _0x403acf=path[_0x4d0e('0xb6')](config['root'],_0x4d0e('0xb7'));return db[_0x4d0e('0x37')][_0x4d0e('0x58')]({'where':{'id':_0x18bbd3[_0x4d0e('0x4e')]['id']},'attributes':['id',_0x4d0e('0xb2')],'raw':!![]})[_0x4d0e('0x12')](handleEntityNotFound(_0x1681b7,null))[_0x4d0e('0x12')](function(_0x49d224){if(_0x49d224){if(_[_0x4d0e('0x65')](_0x49d224[_0x4d0e('0xb2')])){return _0x1681b7[_0x4d0e('0xb8')](_0x403acf);}else{if(!fs[_0x4d0e('0xb9')](path[_0x4d0e('0xb6')](config['root'],_0x4d0e('0xba'),_0x49d224[_0x4d0e('0xb2')]))){return _0x1681b7[_0x4d0e('0xb8')](_0x403acf);}return _0x1681b7[_0x4d0e('0xb8')](path['join'](config[_0x4d0e('0xbb')],_0x4d0e('0xba'),_0x49d224[_0x4d0e('0xb2')]));}}})[_0x4d0e('0x1c')](handleError(_0x1681b7,null));};exports[_0x4d0e('0xbc')]=function(_0x12b88f,_0x1e7bdd){return db['User'][_0x4d0e('0x58')]({'where':{'id':_0x12b88f['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1e7bdd,null))[_0x4d0e('0x12')](function(_0x57bfdd){var _0x2aa4e3=[];values=_0x57bfdd['dataValues'];_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x46'),_0x57bfdd[_0x4d0e('0x48')]));_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs('sms',_0x57bfdd[_0x4d0e('0x48')]));_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x59'),_0x57bfdd[_0x4d0e('0x48')]));_0x2aa4e3['push'](get_open_tabs(_0x4d0e('0x4c'),_0x57bfdd[_0x4d0e('0x48')]));_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4a'),_0x57bfdd['dataValues']));_0x2aa4e3[_0x4d0e('0x42')](get_open_tabs(_0x4d0e('0x4b'),_0x57bfdd[_0x4d0e('0x48')]));return BPromise[_0x4d0e('0x4d')](_0x2aa4e3);})['then'](function(_0x4cefe7){var _0x5df2a2=[];if(_0x4cefe7){for(var _0x336afa=0x0;_0x336afa=_0x1ba72c[_0x88a2('0x4e')]){throw new Error(_0x88a2('0x4f'));}})[_0x88a2('0x10')](function(){if(_0x2d0f88){return db[_0x88a2('0x2b')][_0x88a2('0x50')]({'where':{'membername':_0x2d0f88[_0x88a2('0x29')]},'individualHooks':!![]});}})[_0x88a2('0x10')](function(){if(_0x2d0f88){return _0x2d0f88[_0x88a2('0x51')]({'raw':!![]});}})[_0x88a2('0x10')](function(_0x129081){if(_0x2d0f88){if(_0x129081){var _0x2d5197=[];_0x5d1ade=_0x129081;if(_0x5d1ade[_0x88a2('0x2d')]){for(var _0x19b696=0x0;_0x19b696<_0x5d1ade[_0x88a2('0x2d')];_0x19b696++){_0x2d5197[_0x88a2('0x33')](db['UserVoiceQueueRt'][_0x88a2('0x52')]({'membername':_0x2d0f88[_0x88a2('0x29')],'UserId':_0x2d0f88['id'],'queue_name':_0x5d1ade[_0x19b696][_0x88a2('0x29')],'VoiceQueueId':_0x5d1ade[_0x19b696]['id'],'interface':_0x142e8c,'paused':_0x2d0f88[_0x88a2('0x4b')]||![],'penalty':_0x5d1ade[_0x19b696][_0x88a2('0x53')]||0x0}));}return BPromise[_0x88a2('0x47')](_0x2d5197);}}}})['then'](function(){if(_0x2d0f88){return db[_0x88a2('0x3c')]['findAll']({'where':{'membername':_0x2d0f88[_0x88a2('0x29')],'exitAt':null}});}})[_0x88a2('0x10')](function(_0x574485){if(_0x2d0f88){if(_0x574485&&_0x574485['length']){var _0x3268e0=[];_0x574485[_0x88a2('0x32')](function(_0x29a82d){_0x3268e0[_0x88a2('0x33')](_0x29a82d[_0x88a2('0x2c')]({'exitAt':moment()[_0x88a2('0x2e')](_0x88a2('0x2f'))}));});return BPromise[_0x88a2('0x47')](_0x3268e0);}}})[_0x88a2('0x10')](function(_0x635682){if(_0x2d0f88){var _0x138900=[];var _0x1edce8=[];var _0xe9cc81=utils[_0x88a2('0x31')]();var _0x232b9d={'membername':_0x2d0f88[_0x88a2('0x29')],'interface':_0x142e8c,'enterAt':moment()['format'](_0x88a2('0x2f')),'role':_0x2d0f88['role'],'internal':_0x2d0f88['internal']};_0xe9cc81[_0x88a2('0x32')](function(_0x4efb81){_0x138900[_0x88a2('0x33')](_[_0x88a2('0x54')]({'channel':_0x4efb81,'type':'LOGIN','data1':_0x88a2('0x55'),'data2':_0x142e8c},_0x232b9d));if(_0x2d0f88[_0x88a2('0x4b')]){_0x1edce8['push'](_['merge']({'channel':_0x4efb81,'type':_0x88a2('0x41'),'data1':_0x88a2('0x56')},_0x232b9d));}});return db[_0x88a2('0x3c')]['bulkCreate'](_0x138900[_0x88a2('0x57')](_0x1edce8),{'individualHooks':!![]});}})['then'](function(){if(_0x2d0f88){return _0x2d0f88['update']({'online':!![],'lastLoginAt':moment()[_0x88a2('0x2e')](_0x88a2('0x2f')),'voicePause':_0x2d0f88[_0x88a2('0x4b')]||![],'mailPause':_0x2d0f88[_0x88a2('0x4b')]||![],'chatPause':_0x2d0f88[_0x88a2('0x4b')]||![],'faxPause':_0x2d0f88[_0x88a2('0x4b')]||![],'smsPause':_0x2d0f88[_0x88a2('0x4b')]||![],'openchannelPause':_0x2d0f88[_0x88a2('0x4b')]||![],'pauseType':_0x2d0f88['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x142e8c});}})[_0x88a2('0x10')](function(_0x446ec5){_0x1d124c(_0x446ec5);})[_0x88a2('0x1a')](function(_0xfaf2bd){_0xca2346(_0x569a59[_0x88a2('0x16')](0x1f4,_0xfaf2bd[_0x88a2('0x18')]));});});}; \ No newline at end of file +var _0x3e92=['findAll','options','where','limit','include','model','map','attributes','ShowUser','raw','then','find','name','role','internal','interface','update','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','getChannels','forEach','isNil','SIP/%s','body','type','uniqueid','bulkCreate','DEFAULT\x20PAUSE','findOne','channel','Unknown\x20channel','voice','UserVoiceQueueRt','MemberReport','system','mail','chat','fax','sms','openchannel','whatsapp','set','%s%s','Pause','push','LogoutUser','destroy','all','LoginUser','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','concat','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','info','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetUser','User'];(function(_0x2558ee,_0x2a2574){var _0x431306=function(_0x32cb67){while(--_0x32cb67){_0x2558ee['push'](_0x2558ee['shift']());}};_0x431306(++_0x2a2574);}(_0x3e92,0x9e));var _0x23e9=function(_0x30a22b,_0x41951f){_0x30a22b=_0x30a22b-0x0;var _0x1cf807=_0x3e92[_0x30a22b];return _0x1cf807;};'use strict';var _=require('lodash');var util=require(_0x23e9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23e9('0x1'))['db'];var utils=require(_0x23e9('0x2'));var logger=require(_0x23e9('0x3'))(_0x23e9('0x4'));var config=require(_0x23e9('0x5'));var jayson=require(_0x23e9('0x6'));var client=jayson[_0x23e9('0x7')]['http']({'port':0x232a});config[_0x23e9('0x8')]=_[_0x23e9('0x9')](config[_0x23e9('0x8')],{'host':_0x23e9('0xa'),'port':0x18eb});var socket=require(_0x23e9('0xb'))(new Redis(config[_0x23e9('0x8')]));require(_0x23e9('0xc'))[_0x23e9('0xd')](socket);function respondWithRpcPromise(_0x3c9767,_0x550897,_0x1ebb6f){return new BPromise(function(_0x2147ed,_0xf0d05d){return client[_0x23e9('0xe')](_0x3c9767,_0x1ebb6f)['then'](function(_0x51f235){logger[_0x23e9('0xf')](_0x23e9('0x10'),_0x550897,'request\x20sent');logger[_0x23e9('0x11')]('User,\x20%s,\x20%s,\x20%s',_0x550897,_0x23e9('0x12'),JSON[_0x23e9('0x13')](_0x51f235));if(_0x51f235[_0x23e9('0x14')]){if(_0x51f235['error'][_0x23e9('0x15')]===0x1f4){logger[_0x23e9('0x14')](_0x23e9('0x10'),_0x550897,_0x51f235[_0x23e9('0x14')][_0x23e9('0x16')]);return _0xf0d05d(_0x51f235[_0x23e9('0x14')]['message']);}logger[_0x23e9('0x14')](_0x23e9('0x10'),_0x550897,_0x51f235[_0x23e9('0x14')][_0x23e9('0x16')]);return _0x2147ed(_0x51f235[_0x23e9('0x14')][_0x23e9('0x16')]);}else{logger[_0x23e9('0xf')](_0x23e9('0x10'),_0x550897,'request\x20sent');_0x2147ed(_0x51f235['result'][_0x23e9('0x16')]);}})[_0x23e9('0x17')](function(_0x4c461b){logger[_0x23e9('0x14')](_0x23e9('0x10'),_0x550897,_0x4c461b);_0xf0d05d(_0x4c461b);});});}exports[_0x23e9('0x18')]=function(_0x22c0f9){var _0x3fdaff=this;return new Promise(function(_0x417a25,_0x1b7dec){return db[_0x23e9('0x19')][_0x23e9('0x1a')]({'raw':_0x22c0f9[_0x23e9('0x1b')]?_0x22c0f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x22c0f9[_0x23e9('0x1b')]?_0x22c0f9[_0x23e9('0x1b')][_0x23e9('0x1c')]||null:null,'attributes':_0x22c0f9[_0x23e9('0x1b')]?_0x22c0f9['options']['attributes']||null:null,'limit':_0x22c0f9[_0x23e9('0x1b')]?_0x22c0f9[_0x23e9('0x1b')][_0x23e9('0x1d')]||null:null,'include':_0x22c0f9[_0x23e9('0x1b')]?_0x22c0f9[_0x23e9('0x1b')][_0x23e9('0x1e')]?_['map'](_0x22c0f9[_0x23e9('0x1b')][_0x23e9('0x1e')],function(_0x519119){return{'model':db[_0x519119[_0x23e9('0x1f')]],'as':_0x519119['as'],'attributes':_0x519119['attributes'],'include':_0x519119[_0x23e9('0x1e')]?_[_0x23e9('0x20')](_0x519119[_0x23e9('0x1e')],function(_0x3c8bb9){return{'model':db[_0x3c8bb9[_0x23e9('0x1f')]],'as':_0x3c8bb9['as'],'attributes':_0x3c8bb9[_0x23e9('0x21')],'include':_0x3c8bb9[_0x23e9('0x1e')]?_[_0x23e9('0x20')](_0x3c8bb9[_0x23e9('0x1e')],function(_0x1f43c0){return{'model':db[_0x1f43c0['model']],'as':_0x1f43c0['as'],'attributes':_0x1f43c0[_0x23e9('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e183b){logger[_0x23e9('0xf')](_0x23e9('0x18'),_0x22c0f9);logger[_0x23e9('0x11')](_0x23e9('0x18'),_0x22c0f9,JSON[_0x23e9('0x13')](_0x5e183b));_0x417a25(_0x5e183b);})[_0x23e9('0x17')](function(_0x15166a){logger[_0x23e9('0x14')](_0x23e9('0x18'),_0x15166a['message'],_0x22c0f9);_0x1b7dec(_0x3fdaff['error'](0x1f4,_0x15166a[_0x23e9('0x16')]));});});};exports[_0x23e9('0x22')]=function(_0x3a5260){var _0x98c558=this;return new Promise(function(_0x1c6bf9,_0x132da3){return db[_0x23e9('0x19')]['find']({'raw':_0x3a5260[_0x23e9('0x1b')]?_0x3a5260[_0x23e9('0x1b')][_0x23e9('0x23')]===undefined?!![]:![]:!![],'where':_0x3a5260['options']?_0x3a5260['options'][_0x23e9('0x1c')]||null:null,'attributes':_0x3a5260[_0x23e9('0x1b')]?_0x3a5260[_0x23e9('0x1b')][_0x23e9('0x21')]||null:null,'include':_0x3a5260[_0x23e9('0x1b')]?_0x3a5260[_0x23e9('0x1b')][_0x23e9('0x1e')]?_[_0x23e9('0x20')](_0x3a5260[_0x23e9('0x1b')][_0x23e9('0x1e')],function(_0x2f2257){return{'model':db[_0x2f2257['model']],'as':_0x2f2257['as'],'attributes':_0x2f2257[_0x23e9('0x21')],'include':_0x2f2257['include']?_['map'](_0x2f2257[_0x23e9('0x1e')],function(_0x547802){return{'model':db[_0x547802['model']],'as':_0x547802['as'],'attributes':_0x547802[_0x23e9('0x21')],'include':_0x547802['include']?_['map'](_0x547802[_0x23e9('0x1e')],function(_0x269263){return{'model':db[_0x269263['model']],'as':_0x269263['as'],'attributes':_0x269263['attributes']};}):[]};}):[]};}):[]:[]})[_0x23e9('0x24')](function(_0x100c96){logger[_0x23e9('0xf')](_0x23e9('0x22'),_0x3a5260);logger['debug'](_0x23e9('0x22'),_0x3a5260,JSON[_0x23e9('0x13')](_0x100c96));_0x1c6bf9(_0x100c96);})[_0x23e9('0x17')](function(_0x486df2){logger[_0x23e9('0x14')](_0x23e9('0x22'),_0x486df2[_0x23e9('0x16')],_0x3a5260);_0x132da3(_0x98c558[_0x23e9('0x14')](0x1f4,_0x486df2[_0x23e9('0x16')]));});});};exports['PauseUser']=function(_0x52e64f){var _0x564bff=this;return new Promise(function(_0x52ed0b,_0x11eddc){var _0x24446a;return db[_0x23e9('0x19')][_0x23e9('0x25')]({'where':_0x52e64f[_0x23e9('0x1b')][_0x23e9('0x1c')]||{},'attributes':['id',_0x23e9('0x26'),_0x23e9('0x27'),_0x23e9('0x28'),_0x23e9('0x29')]})[_0x23e9('0x24')](function(_0x38add2){if(_0x38add2){_0x24446a=_0x38add2;return db['UserVoiceQueueRt'][_0x23e9('0x2a')]({'paused':0x1},{'where':{'UserId':_0x24446a['id']},'individualHooks':!![]});}})[_0x23e9('0x24')](function(){if(_0x24446a){return db['MemberReport'][_0x23e9('0x1a')]({'where':{'membername':_0x24446a['name'],'type':_0x23e9('0x2b'),'exitAt':null}});}})[_0x23e9('0x24')](function(_0x2858ea){if(_0x24446a){if(_0x2858ea&&_0x2858ea['length']){var _0x460f94=moment()[_0x23e9('0x2c')](_0x23e9('0x2d'));for(var _0xefff39=0x0,_0x5ccf64=_0x2858ea[_0x23e9('0x2e')];_0xefff39<_0x5ccf64;_0xefff39++){_0x2858ea[_0xefff39]['updateAttributes']({'exitAt':_0x460f94});}}}})[_0x23e9('0x24')](function(){if(_0x24446a){var _0x240493=[];var _0x191d1d=utils[_0x23e9('0x2f')]();_0x191d1d[_0x23e9('0x30')](function(_0x1ceacb){_0x240493['push']({'channel':_0x1ceacb,'membername':_0x24446a[_0x23e9('0x26')],'interface':_[_0x23e9('0x31')](_0x24446a[_0x23e9('0x29')])?util[_0x23e9('0x2c')](_0x23e9('0x32'),_0x24446a['name']):_0x24446a[_0x23e9('0x29')],'type':_0x23e9('0x2b'),'enterAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d')),'data1':_0x52e64f[_0x23e9('0x33')][_0x23e9('0x34')]||'DEFAULT\x20PAUSE','role':_0x24446a[_0x23e9('0x27')],'internal':_0x24446a[_0x23e9('0x28')],'uniqueid':_0x52e64f[_0x23e9('0x33')][_0x23e9('0x35')]||null});});return db['MemberReport'][_0x23e9('0x36')](_0x240493,{'individualHooks':!![]});}})['then'](function(){if(_0x24446a){return _0x24446a[_0x23e9('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x52e64f[_0x23e9('0x33')]['type']||_0x23e9('0x37'),'lastPauseAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d'))});}})[_0x23e9('0x24')](function(_0x52dfde){_0x52ed0b(_0x52dfde);})[_0x23e9('0x17')](function(_0x3568cc){_0x11eddc(_0x564bff[_0x23e9('0x14')](0x1f4,_0x3568cc[_0x23e9('0x16')]));});});};exports['UnpauseUser']=function(_0x401b9a){var _0x5f2ebf=this;return new Promise(function(_0x23c992,_0x1da152){var _0x4057b2;return db[_0x23e9('0x19')][_0x23e9('0x38')]({'where':_0x401b9a[_0x23e9('0x1b')][_0x23e9('0x1c')]||{},'attributes':['id','name']})[_0x23e9('0x24')](function(_0x702e9c){if(_0x702e9c){_0x4057b2=_0x702e9c;if(_0x401b9a[_0x23e9('0x33')][_0x23e9('0x39')]&&!utils['isValidChannel'](_0x401b9a['body'][_0x23e9('0x39')])){throw new Error(_0x23e9('0x3a'));}switch(_0x401b9a[_0x23e9('0x33')][_0x23e9('0x39')]){case _0x23e9('0x3b'):return db[_0x23e9('0x3c')][_0x23e9('0x2a')]({'paused':0x0},{'where':{'UserId':_0x4057b2['id']}})['then'](function(){return db[_0x23e9('0x3d')][_0x23e9('0x25')]({'where':{'channel':_0x401b9a[_0x23e9('0x33')][_0x23e9('0x39')],'membername':_0x4057b2[_0x23e9('0x26')],'type':_0x23e9('0x2b'),'exitAt':null}});})[_0x23e9('0x24')](function(_0x86cfb5){if(_0x86cfb5){return _0x86cfb5['update']({'exitAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d')),'data2':_0x23e9('0x3e')},{'individualHooks':!![]});}return null;})[_0x23e9('0x24')](function(){return _0x4057b2[_0x23e9('0x2a')]({'voicePause':![]});});case _0x23e9('0x3f'):case _0x23e9('0x40'):case _0x23e9('0x41'):case _0x23e9('0x42'):case _0x23e9('0x43'):case _0x23e9('0x44'):return db['MemberReport']['find']({'where':{'channel':_0x401b9a[_0x23e9('0x33')]['channel'],'membername':_0x4057b2[_0x23e9('0x26')],'type':_0x23e9('0x2b'),'exitAt':null}})[_0x23e9('0x24')](function(_0x488684){return _0x488684[_0x23e9('0x2a')]({'exitAt':moment()['format'](_0x23e9('0x2d')),'data2':_0x23e9('0x3e')},{'individualHooks':!![]});})['then'](function(){var _0x5755ec={};_[_0x23e9('0x45')](_0x5755ec,util[_0x23e9('0x2c')](_0x23e9('0x46'),_0x401b9a[_0x23e9('0x33')]['channel'],_0x23e9('0x47')),![]);return _0x4057b2['update'](_0x5755ec);});default:return db[_0x23e9('0x3c')][_0x23e9('0x2a')]({'paused':0x0},{'where':{'UserId':_0x4057b2['id']}})[_0x23e9('0x24')](function(){return db[_0x23e9('0x3d')][_0x23e9('0x1a')]({'where':{'membername':_0x4057b2[_0x23e9('0x26')],'type':_0x23e9('0x2b'),'exitAt':null}});})['then'](function(_0x57cbec){var _0x5544a6=[];_0x57cbec[_0x23e9('0x30')](function(_0x445acc){_0x5544a6[_0x23e9('0x48')](_0x445acc[_0x23e9('0x2a')]({'exitAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d')),'data2':_0x23e9('0x3e')}));});return BPromise['all'](_0x5544a6);})['then'](function(){return _0x4057b2[_0x23e9('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x23e9('0x24')](function(_0x5c8ca1){_0x23c992(_0x5c8ca1);})[_0x23e9('0x17')](function(_0x21ab9d){_0x1da152(_0x5f2ebf[_0x23e9('0x14')](0x1f4,_0x21ab9d[_0x23e9('0x16')]));});});};exports[_0x23e9('0x49')]=function(_0x25aa95){var _0x551013=this;return new Promise(function(_0x364fb8,_0x4b0d94){var _0x2607bb;return db['User'][_0x23e9('0x38')]({'where':_0x25aa95[_0x23e9('0x1b')][_0x23e9('0x1c')]||{},'attributes':['id',_0x23e9('0x26')]})['then'](function(_0x2aedd1){if(_0x2aedd1){_0x2607bb=_0x2aedd1;return db[_0x23e9('0x3c')][_0x23e9('0x4a')]({'where':{'membername':_0x2607bb[_0x23e9('0x26')]},'individualHooks':!![]});}})[_0x23e9('0x24')](function(){if(_0x2607bb){return db[_0x23e9('0x3d')][_0x23e9('0x1a')]({'where':{'membername':_0x2607bb[_0x23e9('0x26')],'exitAt':null}});}})[_0x23e9('0x24')](function(_0x1f3a62){if(_0x2607bb){if(_0x1f3a62&&_0x1f3a62['length']){var _0x4d7f00=[];_0x1f3a62['forEach'](function(_0x3ce17c){_0x4d7f00[_0x23e9('0x48')](_0x3ce17c['update']({'exitAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d'))}));});return BPromise[_0x23e9('0x4b')](_0x4d7f00);}}})[_0x23e9('0x24')](function(){if(_0x2607bb){return _0x2607bb[_0x23e9('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x23e9('0x24')](function(_0x5f24ed){_0x364fb8(_0x5f24ed);})['catch'](function(_0x2d0c27){_0x4b0d94(_0x551013[_0x23e9('0x14')](0x1f4,_0x2d0c27[_0x23e9('0x16')]));});});};exports[_0x23e9('0x4c')]=function(_0x2209f6){var _0x11f236=this;return new Promise(function(_0x28b0ff,_0x545048){var _0x20ba98;var _0x2ebb46;var _0x303fea;var _0x3fbc79;return db[_0x23e9('0x19')][_0x23e9('0x38')]({'where':_0x2209f6[_0x23e9('0x1b')][_0x23e9('0x1c')]||{},'attributes':['id',_0x23e9('0x26'),_0x23e9('0x27'),_0x23e9('0x4d'),_0x23e9('0x4e'),'internal','loginInPause',_0x23e9('0x29')]})[_0x23e9('0x24')](function(_0x22dc7a){if(_0x22dc7a){_0x20ba98=_0x22dc7a;_0x3fbc79=_0x2209f6[_0x23e9('0x33')][_0x23e9('0x29')]?_0x2209f6['body'][_0x23e9('0x29')]:util['format']('SIP/%s',_0x20ba98[_0x23e9('0x26')]);return db[_0x23e9('0x19')][_0x23e9('0x4f')]({'where':{'role':_0x23e9('0x50'),'online':!![],'id':{'$ne':_0x20ba98['id']}}});}})[_0x23e9('0x24')](function(_0x3b8058){if(_0x3b8058){_0x303fea=_0x3b8058;return require(_0x23e9('0x51'))[_0x23e9('0x52')]();}})[_0x23e9('0x24')](function(_0x6175c0){if(_0x6175c0&&_0x6175c0[_0x23e9('0x53')]&&_0x303fea>=_0x6175c0[_0x23e9('0x53')]){throw new Error(_0x23e9('0x54'));}})[_0x23e9('0x24')](function(){if(_0x20ba98){return db[_0x23e9('0x3c')][_0x23e9('0x4a')]({'where':{'membername':_0x20ba98[_0x23e9('0x26')]},'individualHooks':!![]});}})[_0x23e9('0x24')](function(){if(_0x20ba98){return _0x20ba98['getVoiceQueues']({'raw':!![]});}})[_0x23e9('0x24')](function(_0x4e4799){if(_0x20ba98){if(_0x4e4799){var _0x16f68a=[];_0x2ebb46=_0x4e4799;if(_0x2ebb46['length']){for(var _0x2ab6f4=0x0;_0x2ab6f4<_0x2ebb46[_0x23e9('0x2e')];_0x2ab6f4++){_0x16f68a[_0x23e9('0x48')](db[_0x23e9('0x3c')][_0x23e9('0x55')]({'membername':_0x20ba98[_0x23e9('0x26')],'UserId':_0x20ba98['id'],'queue_name':_0x2ebb46[_0x2ab6f4]['name'],'VoiceQueueId':_0x2ebb46[_0x2ab6f4]['id'],'interface':_0x3fbc79,'paused':_0x20ba98[_0x23e9('0x56')]||![],'penalty':_0x2ebb46[_0x2ab6f4][_0x23e9('0x57')]||0x0}));}return BPromise[_0x23e9('0x4b')](_0x16f68a);}}}})[_0x23e9('0x24')](function(){if(_0x20ba98){return db[_0x23e9('0x3d')][_0x23e9('0x1a')]({'where':{'membername':_0x20ba98[_0x23e9('0x26')],'exitAt':null}});}})[_0x23e9('0x24')](function(_0x19c76e){if(_0x20ba98){if(_0x19c76e&&_0x19c76e[_0x23e9('0x2e')]){var _0x1adb79=[];_0x19c76e[_0x23e9('0x30')](function(_0x4656b3){_0x1adb79[_0x23e9('0x48')](_0x4656b3['update']({'exitAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d'))}));});return BPromise[_0x23e9('0x4b')](_0x1adb79);}}})[_0x23e9('0x24')](function(_0x12d917){if(_0x20ba98){var _0x2985b0=[];var _0x24f8c0=[];var _0x331f00=utils[_0x23e9('0x2f')]();var _0x5880ed={'membername':_0x20ba98[_0x23e9('0x26')],'interface':_0x3fbc79,'enterAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d')),'role':_0x20ba98[_0x23e9('0x27')],'internal':_0x20ba98[_0x23e9('0x28')]};_0x331f00[_0x23e9('0x30')](function(_0x48a94a){_0x2985b0[_0x23e9('0x48')](_[_0x23e9('0x58')]({'channel':_0x48a94a,'type':_0x23e9('0x59'),'data1':'callysquare','data2':_0x3fbc79},_0x5880ed));if(_0x20ba98[_0x23e9('0x56')]){_0x24f8c0[_0x23e9('0x48')](_[_0x23e9('0x58')]({'channel':_0x48a94a,'type':'PAUSE','data1':_0x23e9('0x5a')},_0x5880ed));}});return db['MemberReport'][_0x23e9('0x36')](_0x2985b0[_0x23e9('0x5b')](_0x24f8c0),{'individualHooks':!![]});}})[_0x23e9('0x24')](function(){if(_0x20ba98){return _0x20ba98[_0x23e9('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d')),'voicePause':_0x20ba98['loginInPause']||![],'mailPause':_0x20ba98[_0x23e9('0x56')]||![],'chatPause':_0x20ba98[_0x23e9('0x56')]||![],'faxPause':_0x20ba98[_0x23e9('0x56')]||![],'smsPause':_0x20ba98['loginInPause']||![],'openchannelPause':_0x20ba98[_0x23e9('0x56')]||![],'pauseType':_0x20ba98[_0x23e9('0x56')]?_0x23e9('0x5a'):null,'lastPauseAt':moment()[_0x23e9('0x2c')](_0x23e9('0x2d')),'interface':_0x3fbc79});}})[_0x23e9('0x24')](function(_0x5e7845){_0x28b0ff(_0x5e7845);})[_0x23e9('0x17')](function(_0x198d80){_0x545048(_0x11f236[_0x23e9('0x14')](0x1f4,_0x198d80[_0x23e9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f1dd4fa..b490c2f 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 _0x8de9=['update','emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x289312,_0x3d54ec){var _0x315e52=function(_0x4e54bb){while(--_0x4e54bb){_0x289312['push'](_0x289312['shift']());}};_0x315e52(++_0x3d54ec);}(_0x8de9,0x189));var _0x98de=function(_0x3c26e2,_0x18ee22){_0x3c26e2=_0x3c26e2-0x0;var _0x245eb5=_0x8de9[_0x3c26e2];return _0x245eb5;};'use strict';var UserEvents=require(_0x98de('0x0'));var events=[_0x98de('0x1'),_0x98de('0x2'),_0x98de('0x3')];function createListener(_0x5a6896,_0x18c2e1){return function(_0x39fa88){_0x18c2e1[_0x98de('0x4')](_0x5a6896,_0x39fa88);};}function removeListener(_0x2c99cf,_0x4a39a7){return function(){UserEvents[_0x98de('0x5')](_0x2c99cf,_0x4a39a7);};}exports[_0x98de('0x6')]=function(_0x36241f){for(var _0x544b2c=0x0,_0x5a5a71=events[_0x98de('0x7')];_0x544b2c<_0x5a5a71;_0x544b2c++){var _0x2a8d60=events[_0x544b2c];var _0x23c85b=createListener(_0x98de('0x8')+_0x2a8d60,_0x36241f);UserEvents['on'](_0x2a8d60,_0x23c85b);}}; \ No newline at end of file +var _0x4329=['user:','save','remove','update','removeListener','register'];(function(_0x34102a,_0x2e6ac0){var _0x847099=function(_0x3178de){while(--_0x3178de){_0x34102a['push'](_0x34102a['shift']());}};_0x847099(++_0x2e6ac0);}(_0x4329,0xfd));var _0x9432=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4329[_0x40ac5e];return _0x2839d6;};'use strict';var UserEvents=require('./user.events');var events=[_0x9432('0x0'),_0x9432('0x1'),_0x9432('0x2')];function createListener(_0x63f9fd,_0x1d096e){return function(_0x14dfb8){_0x1d096e['emit'](_0x63f9fd,_0x14dfb8);};}function removeListener(_0x2c5991,_0x581f81){return function(){UserEvents[_0x9432('0x3')](_0x2c5991,_0x581f81);};}exports[_0x9432('0x4')]=function(_0x25578b){for(var _0x21883c=0x0,_0x2fbe74=events['length'];_0x21883c<_0x2fbe74;_0x21883c++){var _0x39d112=events[_0x21883c];var _0x5480da=createListener(_0x9432('0x5')+_0x39d112,_0x25578b);UserEvents['on'](_0x39d112,_0x5480da);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b6a1607..8237f83 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xf3c79d,_0x9923bf){var _0x590af1=function(_0x2d10e5){while(--_0x2d10e5){_0xf3c79d['push'](_0xf3c79d['shift']());}};_0x590af1(++_0x9923bf);}(_0x70e0,0x17b));var _0x070e=function(_0x45aca0,_0x495254){_0x45aca0=_0x45aca0-0x0;var _0x4a5a37=_0x70e0[_0x45aca0];return _0x4a5a37;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1f16ea,_0x599779){var _0x479f21=function(_0x510bcc){while(--_0x510bcc){_0x1f16ea['push'](_0x1f16ea['shift']());}};_0x479f21(++_0x599779);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ba04cee..9006424 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 _0xbd5b=['exports','INTEGER','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbd5b,0x1e8));var _0xbbd5=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0xbd5b[_0x90a39a];return _0x2b62f7;};'use strict';var Sequelize=require(_0xbbd5('0x0'));module[_0xbbd5('0x1')]={'penalty':{'type':Sequelize[_0xbbd5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 34d5f78..b2943ed 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 _0xa59b=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues'];(function(_0x1f3d0d,_0x58053d){var _0xb4d4c7=function(_0x48d249){while(--_0x48d249){_0x1f3d0d['push'](_0x1f3d0d['shift']());}};_0xb4d4c7(++_0x58053d);}(_0xa59b,0x108));var _0xba59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa59b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba59('0x0'));var util=require(_0xba59('0x1'));var logger=require(_0xba59('0x2'))(_0xba59('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba59('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba59('0x5'));var config=require(_0xba59('0x6'));var attributes=require(_0xba59('0x7'));module['exports']=function(_0x30c3ca,_0x2179a0){return _0x30c3ca[_0xba59('0x8')](_0xba59('0x9'),attributes,{'tableName':_0xba59('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues'];(function(_0xa1d28a,_0x4a7680){var _0x4a2353=function(_0x454d39){while(--_0x454d39){_0xa1d28a['push'](_0xa1d28a['shift']());}};_0x4a2353(++_0x4a7680);}(_0x5fd5,0x1e1));var _0x55fd=function(_0x5e7832,_0xbd5e51){_0x5e7832=_0x5e7832-0x0;var _0x3abae7=_0x5fd5[_0x5e7832];return _0x3abae7;};'use strict';var _=require(_0x55fd('0x0'));var util=require(_0x55fd('0x1'));var logger=require(_0x55fd('0x2'))(_0x55fd('0x3'));var moment=require(_0x55fd('0x4'));var BPromise=require(_0x55fd('0x5'));var rp=require(_0x55fd('0x6'));var fs=require('fs');var path=require(_0x55fd('0x7'));var rimraf=require(_0x55fd('0x8'));var config=require(_0x55fd('0x9'));var attributes=require(_0x55fd('0xa'));module['exports']=function(_0xa25984,_0x4c2f39){return _0xa25984['define'](_0x55fd('0xb'),attributes,{'tableName':_0x55fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 2acdfa6..a16e4ad 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 _0x142a=['then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request'];(function(_0x131090,_0x4b5e43){var _0x1e10cf=function(_0x489085){while(--_0x489085){_0x131090['push'](_0x131090['shift']());}};_0x1e10cf(++_0x4b5e43);}(_0x142a,0xdb));var _0xa142=function(_0x5ae52f,_0x3541b6){_0x5ae52f=_0x5ae52f-0x0;var _0x5cbd81=_0x142a[_0x5ae52f];return _0x5cbd81;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa142('0x0'));var rs=require(_0xa142('0x1'));var fs=require('fs');var Redis=require(_0xa142('0x2'));var db=require(_0xa142('0x3'))['db'];var utils=require(_0xa142('0x4'));var logger=require(_0xa142('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa142('0x6'));var client=jayson[_0xa142('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xedcf5a,_0x50cbba,_0x54dec0){return new BPromise(function(_0xacef15,_0x9f521e){return client[_0xa142('0x8')](_0xedcf5a,_0x54dec0)[_0xa142('0x9')](function(_0x40efd3){logger[_0xa142('0xa')](_0xa142('0xb'),_0x50cbba,_0xa142('0xc'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x50cbba,_0xa142('0xc'),JSON[_0xa142('0xd')](_0x40efd3));if(_0x40efd3[_0xa142('0xe')]){if(_0x40efd3[_0xa142('0xe')][_0xa142('0xf')]===0x1f4){logger['error'](_0xa142('0xb'),_0x50cbba,_0x40efd3[_0xa142('0xe')][_0xa142('0x10')]);return _0x9f521e(_0x40efd3['error'][_0xa142('0x10')]);}logger[_0xa142('0xe')](_0xa142('0xb'),_0x50cbba,_0x40efd3[_0xa142('0xe')][_0xa142('0x10')]);return _0xacef15(_0x40efd3[_0xa142('0xe')][_0xa142('0x10')]);}else{logger['info'](_0xa142('0xb'),_0x50cbba,'request\x20sent');_0xacef15(_0x40efd3[_0xa142('0x11')][_0xa142('0x10')]);}})[_0xa142('0x12')](function(_0x23d56b){logger[_0xa142('0xe')](_0xa142('0xb'),_0x50cbba,_0x23d56b);_0x9f521e(_0x23d56b);});});} \ No newline at end of file +var _0x7f8d=['error','code','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5d4071,_0x226b8f){var _0x1e0f57=function(_0x38d286){while(--_0x38d286){_0x5d4071['push'](_0x5d4071['shift']());}};_0x1e0f57(++_0x226b8f);}(_0x7f8d,0x193));var _0xd7f8=function(_0x42109d,_0xb5c200){_0x42109d=_0x42109d-0x0;var _0x479dc3=_0x7f8d[_0x42109d];return _0x479dc3;};'use strict';var _=require('lodash');var util=require(_0xd7f8('0x0'));var moment=require('moment');var BPromise=require(_0xd7f8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7f8('0x2'));var db=require(_0xd7f8('0x3'))['db'];var utils=require(_0xd7f8('0x4'));var logger=require(_0xd7f8('0x5'))(_0xd7f8('0x6'));var config=require(_0xd7f8('0x7'));var jayson=require(_0xd7f8('0x8'));var client=jayson['client'][_0xd7f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2764f9,_0x48cb7e,_0x34ca8d){return new BPromise(function(_0x4b4fbb,_0x362b82){return client[_0xd7f8('0xa')](_0x2764f9,_0x34ca8d)[_0xd7f8('0xb')](function(_0x50a478){logger[_0xd7f8('0xc')](_0xd7f8('0xd'),_0x48cb7e,_0xd7f8('0xe'));logger[_0xd7f8('0xf')](_0xd7f8('0x10'),_0x48cb7e,'request\x20sent',JSON['stringify'](_0x50a478));if(_0x50a478['error']){if(_0x50a478[_0xd7f8('0x11')][_0xd7f8('0x12')]===0x1f4){logger[_0xd7f8('0x11')](_0xd7f8('0xd'),_0x48cb7e,_0x50a478['error'][_0xd7f8('0x13')]);return _0x362b82(_0x50a478[_0xd7f8('0x11')]['message']);}logger['error'](_0xd7f8('0xd'),_0x48cb7e,_0x50a478[_0xd7f8('0x11')][_0xd7f8('0x13')]);return _0x4b4fbb(_0x50a478[_0xd7f8('0x11')][_0xd7f8('0x13')]);}else{logger[_0xd7f8('0xc')](_0xd7f8('0xd'),_0x48cb7e,_0xd7f8('0xe'));_0x4b4fbb(_0x50a478['result'][_0xd7f8('0x13')]);}})['catch'](function(_0x765a98){logger[_0xd7f8('0x11')](_0xd7f8('0xd'),_0x48cb7e,_0x765a98);_0x362b82(_0x765a98);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1cf0c65..9bdf618 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3fee7e,_0xcaeb28){var _0x200ed5=function(_0x2cec13){while(--_0x2cec13){_0x3fee7e['push'](_0x3fee7e['shift']());}};_0x200ed5(++_0xcaeb28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 6a2ea63..d8af06b 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 _0xaa1a=['STRING','sequelize','INTEGER'];(function(_0x2eace6,_0x279861){var _0x21418a=function(_0x430aa4){while(--_0x430aa4){_0x2eace6['push'](_0x2eace6['shift']());}};_0x21418a(++_0x279861);}(_0xaa1a,0x175));var _0xaaa1=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0xaa1a[_0x5519a9];return _0x32f2cc;};'use strict';var Sequelize=require(_0xaaa1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xaaa1('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaaa1('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaaa1('0x2')]}}; \ No newline at end of file +var _0x9944=['INTEGER','STRING','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9944,0xb9));var _0x4994=function(_0x4f5495,_0x3fc61c){_0x4f5495=_0x4f5495-0x0;var _0x26f9bc=_0x9944[_0x4f5495];return _0x26f9bc;};'use strict';var Sequelize=require(_0x4994('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4994('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4994('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4994('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d4d9990..c6b7f2b 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 _0xc656=['user_has_fax_queues','lodash','util','moment','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0xc656,0xeb));var _0x6c65=function(_0x3b8c09,_0x16d046){_0x3b8c09=_0x3b8c09-0x0;var _0x40c768=_0xc656[_0x3b8c09];return _0x40c768;};'use strict';var _=require(_0x6c65('0x0'));var util=require(_0x6c65('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6c65('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6c65('0x3'));var config=require(_0x6c65('0x4'));var attributes=require(_0x6c65('0x5'));module[_0x6c65('0x6')]=function(_0x4b2cbe,_0x4cc0ce){return _0x4b2cbe[_0x6c65('0x7')]('UserFaxQueue',attributes,{'tableName':_0x6c65('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafbc=['request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','../../config/logger','moment'];(function(_0x31eca3,_0x1546d9){var _0x5e01cc=function(_0xbc6d8c){while(--_0xbc6d8c){_0x31eca3['push'](_0x31eca3['shift']());}};_0x5e01cc(++_0x1546d9);}(_0xafbc,0x1aa));var _0xcafb=function(_0x4bf8be,_0x559004){_0x4bf8be=_0x4bf8be-0x0;var _0x1219d8=_0xafbc[_0x4bf8be];return _0x1219d8;};'use strict';var _=require(_0xcafb('0x0'));var util=require(_0xcafb('0x1'));var logger=require(_0xcafb('0x2'))('api');var moment=require(_0xcafb('0x3'));var BPromise=require('bluebird');var rp=require(_0xcafb('0x4'));var fs=require('fs');var path=require(_0xcafb('0x5'));var rimraf=require(_0xcafb('0x6'));var config=require('../../config/environment');var attributes=require(_0xcafb('0x7'));module['exports']=function(_0x48c90d,_0x17909a){return _0x48c90d[_0xcafb('0x8')](_0xcafb('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 4b7c6bb..ddbda6d 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 _0x6d53=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x26a4ea,_0xa72fb8){var _0x1b669e=function(_0x4e8bba){while(--_0x4e8bba){_0x26a4ea['push'](_0x26a4ea['shift']());}};_0x1b669e(++_0xa72fb8);}(_0x6d53,0xef));var _0x36d5=function(_0xa5dc43,_0x5012af){_0xa5dc43=_0xa5dc43-0x0;var _0x27313d=_0x6d53[_0xa5dc43];return _0x27313d;};'use strict';var _=require(_0x36d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x36d5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36d5('0x2'))['db'];var utils=require(_0x36d5('0x3'));var logger=require(_0x36d5('0x4'))(_0x36d5('0x5'));var config=require(_0x36d5('0x6'));var jayson=require(_0x36d5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x81a682,_0x136606,_0x421b68){return new BPromise(function(_0x2d0397,_0x45e3ed){return client[_0x36d5('0x8')](_0x81a682,_0x421b68)[_0x36d5('0x9')](function(_0x5a8996){logger[_0x36d5('0xa')](_0x36d5('0xb'),_0x136606,_0x36d5('0xc'));logger[_0x36d5('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x136606,_0x36d5('0xc'),JSON[_0x36d5('0xe')](_0x5a8996));if(_0x5a8996['error']){if(_0x5a8996[_0x36d5('0xf')][_0x36d5('0x10')]===0x1f4){logger[_0x36d5('0xf')](_0x36d5('0xb'),_0x136606,_0x5a8996[_0x36d5('0xf')][_0x36d5('0x11')]);return _0x45e3ed(_0x5a8996[_0x36d5('0xf')][_0x36d5('0x11')]);}logger[_0x36d5('0xf')](_0x36d5('0xb'),_0x136606,_0x5a8996['error'][_0x36d5('0x11')]);return _0x2d0397(_0x5a8996['error'][_0x36d5('0x11')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x136606,_0x36d5('0xc'));_0x2d0397(_0x5a8996[_0x36d5('0x12')][_0x36d5('0x11')]);}})[_0x36d5('0x13')](function(_0x407c7e){logger[_0x36d5('0xf')](_0x36d5('0xb'),_0x136606,_0x407c7e);_0x45e3ed(_0x407c7e);});});} \ No newline at end of file +var _0xe06b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2f2632,_0x1e4404){var _0xadf4a7=function(_0x36c5e9){while(--_0x36c5e9){_0x2f2632['push'](_0x2f2632['shift']());}};_0xadf4a7(++_0x1e4404);}(_0xe06b,0x65));var _0xbe06=function(_0x9981c0,_0x38cae0){_0x9981c0=_0x9981c0-0x0;var _0xaad355=_0xe06b[_0x9981c0];return _0xaad355;};'use strict';var _=require(_0xbe06('0x0'));var util=require(_0xbe06('0x1'));var moment=require(_0xbe06('0x2'));var BPromise=require(_0xbe06('0x3'));var rs=require(_0xbe06('0x4'));var fs=require('fs');var Redis=require(_0xbe06('0x5'));var db=require(_0xbe06('0x6'))['db'];var utils=require(_0xbe06('0x7'));var logger=require(_0xbe06('0x8'))(_0xbe06('0x9'));var config=require(_0xbe06('0xa'));var jayson=require(_0xbe06('0xb'));var client=jayson[_0xbe06('0xc')][_0xbe06('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1ee655,_0x2902d4,_0x33515f){return new BPromise(function(_0x47a392,_0x511a76){return client[_0xbe06('0xe')](_0x1ee655,_0x33515f)[_0xbe06('0xf')](function(_0x53a1ca){logger[_0xbe06('0x10')](_0xbe06('0x11'),_0x2902d4,_0xbe06('0x12'));logger[_0xbe06('0x13')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2902d4,'request\x20sent',JSON[_0xbe06('0x14')](_0x53a1ca));if(_0x53a1ca['error']){if(_0x53a1ca[_0xbe06('0x15')][_0xbe06('0x16')]===0x1f4){logger[_0xbe06('0x15')](_0xbe06('0x11'),_0x2902d4,_0x53a1ca[_0xbe06('0x15')]['message']);return _0x511a76(_0x53a1ca[_0xbe06('0x15')][_0xbe06('0x17')]);}logger[_0xbe06('0x15')](_0xbe06('0x11'),_0x2902d4,_0x53a1ca['error'][_0xbe06('0x17')]);return _0x47a392(_0x53a1ca[_0xbe06('0x15')][_0xbe06('0x17')]);}else{logger[_0xbe06('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x2902d4,_0xbe06('0x12'));_0x47a392(_0x53a1ca[_0xbe06('0x18')][_0xbe06('0x17')]);}})[_0xbe06('0x19')](function(_0x413b95){logger[_0xbe06('0x15')](_0xbe06('0x11'),_0x2902d4,_0x413b95);_0x511a76(_0x413b95);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ad66c9c..95eb08e 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf831d6,_0x52c869){var _0xe86357=function(_0x1502fc){while(--_0x1502fc){_0xf831d6['push'](_0xf831d6['shift']());}};_0xe86357(++_0x52c869);}(_0xe706,0xa3));var _0x6e70=function(_0x2af946,_0x3d6088){_0x2af946=_0x2af946-0x0;var _0x3ae43d=_0xe706[_0x2af946];return _0x3ae43d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xce754,_0x597abb){var _0x53e1e1=function(_0x2fb554){while(--_0x2fb554){_0xce754['push'](_0xce754['shift']());}};_0x53e1e1(++_0x597abb);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0e8bec7..664d394 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 _0x60f0=['INTEGER','sequelize'];(function(_0x5a6b1f,_0x11c3c5){var _0x596c49=function(_0x23f398){while(--_0x23f398){_0x5a6b1f['push'](_0x5a6b1f['shift']());}};_0x596c49(++_0x11c3c5);}(_0x60f0,0x1ab));var _0x060f=function(_0x4095a7,_0x2f89f5){_0x4095a7=_0x4095a7-0x0;var _0x29f428=_0x60f0[_0x4095a7];return _0x29f428;};'use strict';var Sequelize=require(_0x060f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x060f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x531f=['exports','INTEGER','sequelize'];(function(_0x2acec0,_0x42a0f2){var _0x2ca97e=function(_0x522776){while(--_0x522776){_0x2acec0['push'](_0x2acec0['shift']());}};_0x2ca97e(++_0x42a0f2);}(_0x531f,0x16a));var _0xf531=function(_0x11f4b5,_0x279f0d){_0x11f4b5=_0x11f4b5-0x0;var _0x59d5e0=_0x531f[_0x11f4b5];return _0x59d5e0;};'use strict';var Sequelize=require(_0xf531('0x0'));module[_0xf531('0x1')]={'penalty':{'type':Sequelize[_0xf531('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 52b6720..143db48 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 _0xf907=['user_has_mail_queues','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0xf907,0x1c4));var _0x7f90=function(_0x500e16,_0x30ec9a){_0x500e16=_0x500e16-0x0;var _0x54f1d1=_0xf907[_0x500e16];return _0x54f1d1;};'use strict';var _=require(_0x7f90('0x0'));var util=require('util');var logger=require(_0x7f90('0x1'))(_0x7f90('0x2'));var moment=require('moment');var BPromise=require(_0x7f90('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7f90('0x4'));var config=require(_0x7f90('0x5'));var attributes=require(_0x7f90('0x6'));module[_0x7f90('0x7')]=function(_0xf4b374,_0x3bb84e){return _0xf4b374[_0x7f90('0x8')](_0x7f90('0x9'),attributes,{'tableName':_0x7f90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a85=['api','bluebird','path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0x0a85,0x1b9));var _0x50a8=function(_0x2a4218,_0x5adfdf){_0x2a4218=_0x2a4218-0x0;var _0x101111=_0x0a85[_0x2a4218];return _0x101111;};'use strict';var _=require(_0x50a8('0x0'));var util=require(_0x50a8('0x1'));var logger=require(_0x50a8('0x2'))(_0x50a8('0x3'));var moment=require('moment');var BPromise=require(_0x50a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50a8('0x5'));var rimraf=require('rimraf');var config=require(_0x50a8('0x6'));var attributes=require(_0x50a8('0x7'));module[_0x50a8('0x8')]=function(_0x54dd7e,_0x9a4956){return _0x54dd7e[_0x50a8('0x9')](_0x50a8('0xa'),attributes,{'tableName':_0x50a8('0xb'),'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 2a7692a..8797d47 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b7479,_0x58dddc){var _0x490a07=function(_0x1b198b){while(--_0x1b198b){_0x2b7479['push'](_0x2b7479['shift']());}};_0x490a07(++_0x58dddc);}(_0xa41a,0x6b));var _0xaa41=function(_0x1e593f,_0xded5fd){_0x1e593f=_0x1e593f-0x0;var _0x57963c=_0xa41a[_0x1e593f];return _0x57963c;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x300a1d,_0x362118){var _0x5e8b8a=function(_0x3dcc3b){while(--_0x3dcc3b){_0x300a1d['push'](_0x300a1d['shift']());}};_0x5e8b8a(++_0x362118);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 932d212..95d2c05 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 _0x20c9=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','post','isAuthenticated','exports','multer'];(function(_0x4559a7,_0x597010){var _0x2de007=function(_0x6737a){while(--_0x6737a){_0x4559a7['push'](_0x4559a7['shift']());}};_0x2de007(++_0x597010);}(_0x20c9,0x107));var _0x920c=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x20c9[_0x14fad0];return _0x5c665f;};'use strict';var multer=require(_0x920c('0x0'));var util=require(_0x920c('0x1'));var path=require(_0x920c('0x2'));var timeout=require(_0x920c('0x3'));var express=require(_0x920c('0x4'));var router=express[_0x920c('0x5')]();var fs_extra=require(_0x920c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x920c('0x7'));var config=require(_0x920c('0x8'));var controller=require('./userNotification.controller');router[_0x920c('0x9')]('/',auth[_0x920c('0xa')](),controller['sendUserNotification']);module[_0x920c('0xb')]=router; \ No newline at end of file +var _0x1320=['isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post'];(function(_0x32b2d9,_0x335b67){var _0x486078=function(_0x311fd8){while(--_0x311fd8){_0x32b2d9['push'](_0x32b2d9['shift']());}};_0x486078(++_0x335b67);}(_0x1320,0x1cb));var _0x0132=function(_0x1fe636,_0x4def4e){_0x1fe636=_0x1fe636-0x0;var _0xbd1ef0=_0x1320[_0x1fe636];return _0xbd1ef0;};'use strict';var multer=require(_0x0132('0x0'));var util=require(_0x0132('0x1'));var path=require(_0x0132('0x2'));var timeout=require(_0x0132('0x3'));var express=require('express');var router=express[_0x0132('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0132('0x5'));var interaction=require(_0x0132('0x6'));var config=require('../../config/environment');var controller=require(_0x0132('0x7'));router[_0x0132('0x8')]('/',auth[_0x0132('0x9')](),controller[_0x0132('0xa')]);module[_0x0132('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 034b925..81c138d 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 _0x4d2e=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0xd41ff1,_0x3ab2f8){var _0x5612d4=function(_0x161995){while(--_0x161995){_0xd41ff1['push'](_0xd41ff1['shift']());}};_0x5612d4(++_0x3ab2f8);}(_0x4d2e,0x116));var _0xe4d2=function(_0x45d125,_0x1afd45){_0x45d125=_0x45d125-0x0;var _0x2a2988=_0x4d2e[_0x45d125];return _0x2a2988;};'use strict';var Sequelize=require(_0xe4d2('0x0'));module['exports']={'body':{'type':Sequelize[_0xe4d2('0x1')]},'senderName':{'type':Sequelize[_0xe4d2('0x2')]},'recipientsId':{'type':Sequelize[_0xe4d2('0x1')]},'recipientsDescription':{'type':Sequelize[_0xe4d2('0x2')]},'beep':{'type':Sequelize[_0xe4d2('0x3')]}}; \ No newline at end of file +var _0x856e=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3be1e3,_0x56b8f9){var _0x1d7309=function(_0x15b170){while(--_0x15b170){_0x3be1e3['push'](_0x3be1e3['shift']());}};_0x1d7309(++_0x56b8f9);}(_0x856e,0xc0));var _0xe856=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x856e[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0xe856('0x0'));module[_0xe856('0x1')]={'body':{'type':Sequelize[_0xe856('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xe856('0x2')]},'recipientsDescription':{'type':Sequelize[_0xe856('0x3')]},'beep':{'type':Sequelize[_0xe856('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 6699871..d8f1573 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 _0x7d20=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','emit','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase','ids','includes','replace','queue','all','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv'];(function(_0x54321e,_0x399694){var _0x2a8027=function(_0x4c26a3){while(--_0x4c26a3){_0x54321e['push'](_0x54321e['shift']());}};_0x2a8027(++_0x399694);}(_0x7d20,0x111));var _0x07d2=function(_0x1b43fb,_0x169e3a){_0x1b43fb=_0x1b43fb-0x0;var _0x31f43e=_0x7d20[_0x1b43fb];return _0x31f43e;};'use strict';var emlformat=require(_0x07d2('0x0'));var rimraf=require(_0x07d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07d2('0x2'));var rp=require(_0x07d2('0x3'));var moment=require(_0x07d2('0x4'));var BPromise=require(_0x07d2('0x5'));var Mustache=require(_0x07d2('0x6'));var util=require('util');var path=require(_0x07d2('0x7'));var sox=require('sox');var csv=require(_0x07d2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07d2('0x9'));var _=require('lodash');var squel=require(_0x07d2('0xa'));var crypto=require(_0x07d2('0xb'));var jsforce=require(_0x07d2('0xc'));var deskjs=require(_0x07d2('0xd'));var toCsv=require(_0x07d2('0x8'));var querystring=require(_0x07d2('0xe'));var Papa=require(_0x07d2('0xf'));var Redis=require(_0x07d2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x07d2('0x11'));var as=require(_0x07d2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x07d2('0x13'));var utils=require(_0x07d2('0x14'));var config=require(_0x07d2('0x15'));var licenseUtil=require(_0x07d2('0x16'));var db=require('../../mysqldb')['db'];config[_0x07d2('0x17')]=_[_0x07d2('0x18')](config[_0x07d2('0x17')],{'host':_0x07d2('0x19'),'port':0x18eb});var socket=require(_0x07d2('0x1a'))(new Redis(config[_0x07d2('0x17')]));require(_0x07d2('0x1b'))[_0x07d2('0x1c')](socket);function respondWithStatusCode(_0x554f24,_0x1dec93){_0x1dec93=_0x1dec93||0xcc;return function(_0x522b69){if(_0x522b69){return _0x554f24[_0x07d2('0x1d')](_0x1dec93);}return _0x554f24[_0x07d2('0x1e')](_0x1dec93)[_0x07d2('0x1f')]();};}function respondWithResult(_0x529bf8,_0x227d1d){_0x227d1d=_0x227d1d||0xc8;return function(_0x3d04ff){if(_0x3d04ff){return _0x529bf8[_0x07d2('0x1e')](_0x227d1d)[_0x07d2('0x20')](_0x3d04ff);}};}function respondWithFilteredResult(_0x959538,_0x137f1a){return function(_0x3fd4a7){if(_0x3fd4a7){var _0x44976d=typeof _0x137f1a[_0x07d2('0x21')]===_0x07d2('0x22')&&typeof _0x137f1a[_0x07d2('0x23')]===_0x07d2('0x22');var _0x378468=_0x3fd4a7[_0x07d2('0x24')];var _0x232483=_0x44976d?0x0:_0x137f1a[_0x07d2('0x21')];var _0x2e47ca=_0x44976d?_0x3fd4a7[_0x07d2('0x24')]:_0x137f1a['offset']+_0x137f1a['limit'];var _0x1565a7;if(_0x2e47ca>=_0x378468){_0x2e47ca=_0x378468;_0x1565a7=0xc8;}else{_0x1565a7=0xce;}_0x959538[_0x07d2('0x1e')](_0x1565a7);return _0x959538[_0x07d2('0x25')]('Content-Range',_0x232483+'-'+_0x2e47ca+'/'+_0x378468)['json'](_0x3fd4a7);}return null;};}function patchUpdates(_0x4ae8e8){return function(_0x9bd77e){try{jsonpatch['apply'](_0x9bd77e,_0x4ae8e8,!![]);}catch(_0x41fd60){return BPromise[_0x07d2('0x26')](_0x41fd60);}return _0x9bd77e[_0x07d2('0x27')]();};}function saveUpdates(_0x186baf,_0x2c36f3){return function(_0x424895){if(_0x424895){return _0x424895[_0x07d2('0x28')](_0x186baf)['then'](function(_0x40122f){return _0x40122f;});}return null;};}function removeEntity(_0x22bb60,_0x5e3a84){return function(_0x5f0bcd){if(_0x5f0bcd){return _0x5f0bcd[_0x07d2('0x29')]()[_0x07d2('0x2a')](function(){_0x22bb60[_0x07d2('0x1e')](0xcc)[_0x07d2('0x1f')]();});}};}function handleEntityNotFound(_0x556f06,_0x54db40){return function(_0x5c4d3e){if(!_0x5c4d3e){_0x556f06[_0x07d2('0x1d')](0x194);}return _0x5c4d3e;};}function handleError(_0x5e23c8,_0x3bca18){_0x3bca18=_0x3bca18||0x1f4;return function(_0x270b54){logger[_0x07d2('0x2b')](_0x270b54[_0x07d2('0x2c')]);if(_0x270b54[_0x07d2('0x2d')]){delete _0x270b54[_0x07d2('0x2d')];}_0x5e23c8[_0x07d2('0x1e')](_0x3bca18)[_0x07d2('0x2e')](_0x270b54);};}exports[_0x07d2('0x2f')]=function(_0x4fa306,_0x38e14b,_0x3beb12){if(!_0x4fa306[_0x07d2('0x30')][_0x07d2('0x31')](_0x07d2('0x32'))&&!_0x4fa306[_0x07d2('0x30')][_0x07d2('0x31')](_0x07d2('0x33'))){throw new db[(_0x07d2('0x34'))][(_0x07d2('0x35'))](_0x07d2('0x36'));}else{if(_0x4fa306[_0x07d2('0x30')][_0x07d2('0x31')](_0x07d2('0x33'))&&!_0x4fa306[_0x07d2('0x30')][_0x07d2('0x31')](_0x07d2('0x37'))){throw new db['Sequelize']['ValidationError'](_0x07d2('0x38'));}if(!_0x4fa306[_0x07d2('0x30')][_0x07d2('0x31')](_0x07d2('0x39'))){throw new db[(_0x07d2('0x34'))][(_0x07d2('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x745835=JSON[_0x07d2('0x3a')](_0x4fa306[_0x07d2('0x30')][_0x07d2('0x39')]);}catch(_0x192be4){logger[_0x07d2('0x2b')](_0x192be4);throw new db[(_0x07d2('0x34'))][(_0x07d2('0x35'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x41c63d=[_0x07d2('0x3b'),_0x07d2('0x3c'),_0x07d2('0x3d'),'openchannelqueue',_0x07d2('0x3e'),_0x07d2('0x3f'),_0x07d2('0x40'),_0x07d2('0x41'),_0x07d2('0x42')];if(_['some'](_0x745835,function(_0x34d605){return!_['includes'](_0x41c63d,_0x34d605[_0x07d2('0x43')][_0x07d2('0x44')]());})){throw new db['Sequelize'][(_0x07d2('0x35'))](_0x07d2('0x45'));}}}var _0x4cfae2={};_0x4cfae2[_0x07d2('0x46')]=_0x4fa306[_0x07d2('0x30')]['hasOwnProperty']('senderName')?_0x4fa306[_0x07d2('0x30')]['senderName']:_0x4fa306[_0x07d2('0x42')]['fullname'];_0x4cfae2['recipientsDescription']=_[_0x07d2('0x47')](_0x4fa306[_0x07d2('0x30')][_0x07d2('0x48')])?null:_0x4fa306[_0x07d2('0x30')][_0x07d2('0x48')];_0x4cfae2[_0x07d2('0x49')]=_0x4fa306['body'][_0x07d2('0x49')]||![];_0x4cfae2[_0x07d2('0x4a')]=_0x4fa306[_0x07d2('0x42')]['id'];return getContent(_0x4fa306[_0x07d2('0x30')])[_0x07d2('0x2a')](function(_0x47dd1f){_0x4cfae2[_0x07d2('0x30')]=_0x47dd1f;return getRecipients(_0x745835);})[_0x07d2('0x2a')](function(_0x6e289){_0x4cfae2[_0x07d2('0x4b')]=_[_0x07d2('0x4c')](_0x6e289)[_0x07d2('0x4d')](',');return db['sequelize'][_0x07d2('0x4e')](function(_0x4da56d){return db[_0x07d2('0x4f')][_0x07d2('0x50')](_0x4cfae2,{'raw':!![],'transaction':_0x4da56d})[_0x07d2('0x2a')](function(_0x3144c1){var _0x2d7cfd={'sender':_0x4cfae2['senderName'],'description':_0x4cfae2[_0x07d2('0x48')],'content':_0x4cfae2[_0x07d2('0x30')],'beep':_0x4cfae2[_0x07d2('0x49')]};_0x6e289[_0x07d2('0x51')](function(_0x1e814c){_0x2d7cfd['recipient']=_0x1e814c;socket[_0x07d2('0x52')]('userNotification:send',_0x2d7cfd);});return _0x3144c1;});});})['then'](respondWithResult(_0x38e14b,0xc9))['catch'](handleError(_0x38e14b,null));};function getContent(_0x2b5b7e){return new BPromise(function(_0xd58a9f,_0x3102a4){if(_0x2b5b7e['text']){_0xd58a9f(_0x2b5b7e['text']);return;}return db[_0x07d2('0x53')][_0x07d2('0x54')]({'attributes':['html'],'where':{'id':_0x2b5b7e[_0x07d2('0x33')]},'raw':!![]})[_0x07d2('0x2a')](function(_0x567864){if(!_0x567864)throw new db[(_0x07d2('0x34'))]['ValidationError'](_0x07d2('0x55'));var _0x2adef6=Mustache['render'](_0x567864['html'],_0x2b5b7e[_0x07d2('0x37')]);_0xd58a9f(_0x2adef6);})[_0x07d2('0x56')](function(_0x291681){_0x3102a4(_0x291681);});});}function getRecipients(_0x10e0b1){return new BPromise(function(_0x398d37,_0x24e769){var _0x37f2ec=[];var _0x2fc38e=[];_0x10e0b1['forEach'](function(_0xbb1d87){var _0x3864ac=_[_0x07d2('0x57')](_0xbb1d87[_0x07d2('0x43')][_0x07d2('0x44')]());if(_0x3864ac==='User'){_0x37f2ec=_['union'](_0x37f2ec,_0xbb1d87[_0x07d2('0x58')]);}else{if(_[_0x07d2('0x59')](_0x3864ac,'queue'))_0x3864ac=_0x3864ac[_0x07d2('0x5a')](_0x07d2('0x5b'),'Queue');_0xbb1d87[_0x07d2('0x58')][_0x07d2('0x51')](function(_0x1ed081){_0x2fc38e['push'](getAgents(_0x3864ac,_0x1ed081));});}});return BPromise[_0x07d2('0x5c')](_0x2fc38e)[_0x07d2('0x2a')](function(_0x59b233){_0x37f2ec=_['union'](_0x37f2ec,_['flatten'](_0x59b233));_0x398d37(_0x37f2ec);})['catch'](function(_0x5daea1){_0x24e769(_0x5daea1);});});}function getAgents(_0x5de9a4,_0x510ca1){return new BPromise(function(_0x3989f2,_0x5c6c6a){return db[_0x5de9a4]['findOne']({'where':{'id':_0x510ca1}})[_0x07d2('0x2a')](function(_0x14f533){return _0x14f533['getAgents']({'attributes':['id'],'raw':!![]})[_0x07d2('0x2a')](function(_0x24059f){var _0x169258=_[_0x07d2('0x5d')](_0x24059f,'id');_0x3989f2(_0x169258);});})[_0x07d2('0x56')](function(_0x3d3fb8){_0x5c6c6a(_0x3d3fb8);});});} \ No newline at end of file +var _0x3f1b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','redis','defaults','./userNotification.socket','register','sendStatus','end','json','offset','limit','count','Content-Range','apply','save','then','error','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','ids','queue','push','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x29b28e,_0x5e6732){var _0x3ab6fc=function(_0x236d0e){while(--_0x236d0e){_0x29b28e['push'](_0x29b28e['shift']());}};_0x3ab6fc(++_0x5e6732);}(_0x3f1b,0xab));var _0xb3f1=function(_0x4e2004,_0x541c1e){_0x4e2004=_0x4e2004-0x0;var _0xfb32ad=_0x3f1b[_0x4e2004];return _0xfb32ad;};'use strict';var emlformat=require(_0xb3f1('0x0'));var rimraf=require(_0xb3f1('0x1'));var zipdir=require(_0xb3f1('0x2'));var jsonpatch=require(_0xb3f1('0x3'));var rp=require(_0xb3f1('0x4'));var moment=require(_0xb3f1('0x5'));var BPromise=require(_0xb3f1('0x6'));var Mustache=require(_0xb3f1('0x7'));var util=require(_0xb3f1('0x8'));var path=require(_0xb3f1('0x9'));var sox=require('sox');var csv=require(_0xb3f1('0xa'));var ejs=require(_0xb3f1('0xb'));var fs=require('fs');var fs_extra=require(_0xb3f1('0xc'));var _=require(_0xb3f1('0xd'));var squel=require(_0xb3f1('0xe'));var crypto=require(_0xb3f1('0xf'));var jsforce=require(_0xb3f1('0x10'));var deskjs=require(_0xb3f1('0x11'));var toCsv=require(_0xb3f1('0xa'));var querystring=require(_0xb3f1('0x12'));var Papa=require(_0xb3f1('0x13'));var Redis=require(_0xb3f1('0x14'));var authService=require(_0xb3f1('0x15'));var qs=require(_0xb3f1('0x16'));var as=require(_0xb3f1('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb3f1('0x18'));var config=require(_0xb3f1('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb3f1('0x1a')]=_[_0xb3f1('0x1b')](config[_0xb3f1('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3f1('0x1a')]));require(_0xb3f1('0x1c'))[_0xb3f1('0x1d')](socket);function respondWithStatusCode(_0x574d85,_0x39ebfc){_0x39ebfc=_0x39ebfc||0xcc;return function(_0x6b5959){if(_0x6b5959){return _0x574d85[_0xb3f1('0x1e')](_0x39ebfc);}return _0x574d85['status'](_0x39ebfc)[_0xb3f1('0x1f')]();};}function respondWithResult(_0x5553f1,_0x5a4587){_0x5a4587=_0x5a4587||0xc8;return function(_0x2a09c9){if(_0x2a09c9){return _0x5553f1['status'](_0x5a4587)[_0xb3f1('0x20')](_0x2a09c9);}};}function respondWithFilteredResult(_0xd1d300,_0x383c26){return function(_0x4027b2){if(_0x4027b2){var _0x16bc16=typeof _0x383c26[_0xb3f1('0x21')]==='undefined'&&typeof _0x383c26[_0xb3f1('0x22')]==='undefined';var _0x478000=_0x4027b2[_0xb3f1('0x23')];var _0x595509=_0x16bc16?0x0:_0x383c26['offset'];var _0x3562e7=_0x16bc16?_0x4027b2[_0xb3f1('0x23')]:_0x383c26[_0xb3f1('0x21')]+_0x383c26[_0xb3f1('0x22')];var _0x549c15;if(_0x3562e7>=_0x478000){_0x3562e7=_0x478000;_0x549c15=0xc8;}else{_0x549c15=0xce;}_0xd1d300['status'](_0x549c15);return _0xd1d300['set'](_0xb3f1('0x24'),_0x595509+'-'+_0x3562e7+'/'+_0x478000)[_0xb3f1('0x20')](_0x4027b2);}return null;};}function patchUpdates(_0x27c4c9){return function(_0x533dab){try{jsonpatch[_0xb3f1('0x25')](_0x533dab,_0x27c4c9,!![]);}catch(_0x324b60){return BPromise['reject'](_0x324b60);}return _0x533dab[_0xb3f1('0x26')]();};}function saveUpdates(_0x2caab4,_0xc917ce){return function(_0x151084){if(_0x151084){return _0x151084['update'](_0x2caab4)[_0xb3f1('0x27')](function(_0x549118){return _0x549118;});}return null;};}function removeEntity(_0x2da087,_0x3ef851){return function(_0x2c60ee){if(_0x2c60ee){return _0x2c60ee['destroy']()[_0xb3f1('0x27')](function(){_0x2da087['status'](0xcc)[_0xb3f1('0x1f')]();});}};}function handleEntityNotFound(_0x16b3dc,_0x475fd4){return function(_0x2f6887){if(!_0x2f6887){_0x16b3dc['sendStatus'](0x194);}return _0x2f6887;};}function handleError(_0x325462,_0x26533f){_0x26533f=_0x26533f||0x1f4;return function(_0x440bd1){logger[_0xb3f1('0x28')](_0x440bd1[_0xb3f1('0x29')]);if(_0x440bd1['name']){delete _0x440bd1[_0xb3f1('0x2a')];}_0x325462['status'](_0x26533f)[_0xb3f1('0x2b')](_0x440bd1);};}exports[_0xb3f1('0x2c')]=function(_0x1cec56,_0x558120,_0x53d737){if(!_0x1cec56[_0xb3f1('0x2d')]['hasOwnProperty'](_0xb3f1('0x2e'))&&!_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x2f')](_0xb3f1('0x30'))){throw new db['Sequelize'][(_0xb3f1('0x31'))](_0xb3f1('0x32'));}else{if(_0x1cec56[_0xb3f1('0x2d')]['hasOwnProperty'](_0xb3f1('0x30'))&&!_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x2f')]('view')){throw new db[(_0xb3f1('0x33'))]['ValidationError'](_0xb3f1('0x34'));}if(!_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x2f')]('recipients')){throw new db[(_0xb3f1('0x33'))][(_0xb3f1('0x31'))](_0xb3f1('0x35'));}else{try{var _0xb69913=JSON[_0xb3f1('0x36')](_0x1cec56[_0xb3f1('0x2d')]['recipients']);}catch(_0x5c0634){logger[_0xb3f1('0x28')](_0x5c0634);throw new db[(_0xb3f1('0x33'))][(_0xb3f1('0x31'))](_0xb3f1('0x37'));}var _0x3b8280=[_0xb3f1('0x38'),_0xb3f1('0x39'),_0xb3f1('0x3a'),_0xb3f1('0x3b'),'smsqueue',_0xb3f1('0x3c'),_0xb3f1('0x3d'),_0xb3f1('0x3e'),_0xb3f1('0x3f')];if(_[_0xb3f1('0x40')](_0xb69913,function(_0x31b2c9){return!_[_0xb3f1('0x41')](_0x3b8280,_0x31b2c9['model'][_0xb3f1('0x42')]());})){throw new db[(_0xb3f1('0x33'))][(_0xb3f1('0x31'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4d121a={};_0x4d121a[_0xb3f1('0x43')]=_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x2f')]('senderName')?_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x43')]:_0x1cec56[_0xb3f1('0x3f')][_0xb3f1('0x44')];_0x4d121a[_0xb3f1('0x45')]=_[_0xb3f1('0x46')](_0x1cec56['body'][_0xb3f1('0x45')])?null:_0x1cec56[_0xb3f1('0x2d')][_0xb3f1('0x45')];_0x4d121a[_0xb3f1('0x47')]=_0x1cec56[_0xb3f1('0x2d')]['beep']||![];_0x4d121a['SenderId']=_0x1cec56['user']['id'];return getContent(_0x1cec56[_0xb3f1('0x2d')])[_0xb3f1('0x27')](function(_0x4b7cf6){_0x4d121a[_0xb3f1('0x2d')]=_0x4b7cf6;return getRecipients(_0xb69913);})[_0xb3f1('0x27')](function(_0x5a3ba9){_0x4d121a['recipientsId']=_[_0xb3f1('0x48')](_0x5a3ba9)[_0xb3f1('0x49')](',');return db[_0xb3f1('0x4a')][_0xb3f1('0x4b')](function(_0xae341b){return db[_0xb3f1('0x4c')][_0xb3f1('0x4d')](_0x4d121a,{'raw':!![],'transaction':_0xae341b})[_0xb3f1('0x27')](function(_0x26846f){var _0x4be253={'sender':_0x4d121a[_0xb3f1('0x43')],'description':_0x4d121a['recipientsDescription'],'content':_0x4d121a[_0xb3f1('0x2d')],'beep':_0x4d121a[_0xb3f1('0x47')]};_0x5a3ba9['forEach'](function(_0x36d1a5){_0x4be253[_0xb3f1('0x4e')]=_0x36d1a5;socket[_0xb3f1('0x4f')](_0xb3f1('0x50'),_0x4be253);});return _0x26846f;});});})[_0xb3f1('0x27')](respondWithResult(_0x558120,0xc9))[_0xb3f1('0x51')](handleError(_0x558120,null));};function getContent(_0xc09050){return new BPromise(function(_0x2d3e21,_0x148e8f){if(_0xc09050[_0xb3f1('0x2e')]){_0x2d3e21(_0xc09050['text']);return;}return db[_0xb3f1('0x52')][_0xb3f1('0x53')]({'attributes':[_0xb3f1('0x54')],'where':{'id':_0xc09050[_0xb3f1('0x30')]},'raw':!![]})[_0xb3f1('0x27')](function(_0x2bdbbc){if(!_0x2bdbbc)throw new db[(_0xb3f1('0x33'))][(_0xb3f1('0x31'))](_0xb3f1('0x55'));var _0x1c9ef6=Mustache[_0xb3f1('0x56')](_0x2bdbbc[_0xb3f1('0x54')],_0xc09050['view']);_0x2d3e21(_0x1c9ef6);})[_0xb3f1('0x51')](function(_0x509457){_0x148e8f(_0x509457);});});}function getRecipients(_0x16ccee){return new BPromise(function(_0x24020c,_0x75b28e){var _0x5bb555=[];var _0x57cbc6=[];_0x16ccee['forEach'](function(_0x5d84f5){var _0x5696e6=_[_0xb3f1('0x57')](_0x5d84f5[_0xb3f1('0x58')]['toLowerCase']());if(_0x5696e6===_0xb3f1('0x59')){_0x5bb555=_['union'](_0x5bb555,_0x5d84f5[_0xb3f1('0x5a')]);}else{if(_['includes'](_0x5696e6,_0xb3f1('0x5b')))_0x5696e6=_0x5696e6['replace'](_0xb3f1('0x5b'),'Queue');_0x5d84f5['ids']['forEach'](function(_0x49ac1b){_0x57cbc6[_0xb3f1('0x5c')](getAgents(_0x5696e6,_0x49ac1b));});}});return BPromise['all'](_0x57cbc6)[_0xb3f1('0x27')](function(_0x41c5df){_0x5bb555=_['union'](_0x5bb555,_[_0xb3f1('0x5d')](_0x41c5df));_0x24020c(_0x5bb555);})[_0xb3f1('0x51')](function(_0x4a069d){_0x75b28e(_0x4a069d);});});}function getAgents(_0x19f616,_0x574fe3){return new BPromise(function(_0x5e1fc9,_0x42251d){return db[_0x19f616][_0xb3f1('0x53')]({'where':{'id':_0x574fe3}})['then'](function(_0x142d8f){return _0x142d8f[_0xb3f1('0x5e')]({'attributes':['id'],'raw':!![]})[_0xb3f1('0x27')](function(_0x17ac5e){var _0x475aec=_['map'](_0x17ac5e,'id');_0x5e1fc9(_0x475aec);});})[_0xb3f1('0x51')](function(_0x1ad360){_0x42251d(_0x1ad360);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index fb776a5..7cfccaa 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 _0x8a23=['remove','emit','hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners','save'];(function(_0x4c9cc4,_0x1b6528){var _0x4384fb=function(_0x512d47){while(--_0x512d47){_0x4c9cc4['push'](_0x4c9cc4['shift']());}};_0x4384fb(++_0x1b6528);}(_0x8a23,0x137));var _0x38a2=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0x8a23[_0x207d2f];return _0x3c3498;};'use strict';var EventEmitter=require(_0x38a2('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x38a2('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x38a2('0x2')](0x0);var events={'afterCreate':_0x38a2('0x3'),'afterUpdate':'update','afterDestroy':_0x38a2('0x4')};function emitEvent(_0x257897){return function(_0x5d2661,_0x366f15,_0x3044ac){UserNotificationEvents[_0x38a2('0x5')](_0x257897+':'+_0x5d2661['id'],_0x5d2661);UserNotificationEvents[_0x38a2('0x5')](_0x257897,_0x5d2661);_0x3044ac(null);};}for(var e in events){if(events[_0x38a2('0x6')](e)){var event=events[e];UserNotification[_0x38a2('0x7')](e,emitEvent(event));}}module[_0x38a2('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x4569=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x5992c9,_0x2a20a4){var _0x1e8945=function(_0x2aa57c){while(--_0x2aa57c){_0x5992c9['push'](_0x5992c9['shift']());}};_0x1e8945(++_0x2a20a4);}(_0x4569,0xdd));var _0x9456=function(_0x256995,_0xa90e79){_0x256995=_0x256995-0x0;var _0x49de4e=_0x4569[_0x256995];return _0x49de4e;};'use strict';var EventEmitter=require(_0x9456('0x0'));var UserNotification=require(_0x9456('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9456('0x2')](0x0);var events={'afterCreate':_0x9456('0x3'),'afterUpdate':_0x9456('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18be71){return function(_0x977e9d,_0x126892,_0x3887c8){UserNotificationEvents['emit'](_0x18be71+':'+_0x977e9d['id'],_0x977e9d);UserNotificationEvents[_0x9456('0x5')](_0x18be71,_0x977e9d);_0x3887c8(null);};}for(var e in events){if(events[_0x9456('0x6')](e)){var event=events[e];UserNotification[_0x9456('0x7')](e,emitEvent(event));}}module[_0x9456('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f614189..a32fe2e 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 _0x90ba=['utf8mb4_unicode_ci','lodash','api','request-promise','path','rimraf','exports','UserNotification','userNotifications'];(function(_0x356b7c,_0x50f764){var _0x308b0e=function(_0x31a065){while(--_0x31a065){_0x356b7c['push'](_0x356b7c['shift']());}};_0x308b0e(++_0x50f764);}(_0x90ba,0x1de));var _0xa90b=function(_0x33ec80,_0x2f867b){_0x33ec80=_0x33ec80-0x0;var _0x1877d9=_0x90ba[_0x33ec80];return _0x1877d9;};'use strict';var _=require(_0xa90b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa90b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa90b('0x2'));var fs=require('fs');var path=require(_0xa90b('0x3'));var rimraf=require(_0xa90b('0x4'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0xa90b('0x5')]=function(_0x132e87,_0x1ea740){return _0x132e87['define'](_0xa90b('0x6'),attributes,{'tableName':_0xa90b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa90b('0x8')});}; \ No newline at end of file +var _0x47ce=['exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x178ada,_0x24ccfa){var _0x337249=function(_0x41b79a){while(--_0x41b79a){_0x178ada['push'](_0x178ada['shift']());}};_0x337249(++_0x24ccfa);}(_0x47ce,0x165));var _0xe47c=function(_0x288d60,_0x297668){_0x288d60=_0x288d60-0x0;var _0x10999a=_0x47ce[_0x288d60];return _0x10999a;};'use strict';var _=require(_0xe47c('0x0'));var util=require(_0xe47c('0x1'));var logger=require(_0xe47c('0x2'))(_0xe47c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe47c('0x4'));var fs=require('fs');var path=require(_0xe47c('0x5'));var rimraf=require('rimraf');var config=require(_0xe47c('0x6'));var attributes=require('./userNotification.attributes');module[_0xe47c('0x7')]=function(_0x2c64ca,_0x499070){return _0x2c64ca[_0xe47c('0x8')](_0xe47c('0x9'),attributes,{'tableName':_0xe47c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe47c('0xb'),'collate':_0xe47c('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 2bcf924..de18397 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 _0x73ab=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x73ab,0x15a));var _0xb73a=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x73ab[_0xc40b9f];return _0x535b9c;};'use strict';var _=require(_0xb73a('0x0'));var util=require('util');var moment=require(_0xb73a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb73a('0x2'));var fs=require('fs');var Redis=require(_0xb73a('0x3'));var db=require(_0xb73a('0x4'))['db'];var utils=require(_0xb73a('0x5'));var logger=require(_0xb73a('0x6'))('rpc');var config=require(_0xb73a('0x7'));var jayson=require(_0xb73a('0x8'));var client=jayson[_0xb73a('0x9')][_0xb73a('0xa')]({'port':0x232a});config[_0xb73a('0xb')]=_[_0xb73a('0xc')](config[_0xb73a('0xb')],{'host':_0xb73a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb73a('0xb')]));require(_0xb73a('0xe'))[_0xb73a('0xf')](socket);function respondWithRpcPromise(_0x2e07f1,_0x1625e6,_0x1cd493){return new BPromise(function(_0xc99add,_0xe9db57){return client[_0xb73a('0x10')](_0x2e07f1,_0x1cd493)['then'](function(_0x39fa33){logger['info'](_0xb73a('0x11'),_0x1625e6,_0xb73a('0x12'));logger['debug'](_0xb73a('0x13'),_0x1625e6,_0xb73a('0x12'),JSON[_0xb73a('0x14')](_0x39fa33));if(_0x39fa33[_0xb73a('0x15')]){if(_0x39fa33[_0xb73a('0x15')][_0xb73a('0x16')]===0x1f4){logger[_0xb73a('0x15')](_0xb73a('0x11'),_0x1625e6,_0x39fa33['error'][_0xb73a('0x17')]);return _0xe9db57(_0x39fa33[_0xb73a('0x15')]['message']);}logger['error'](_0xb73a('0x11'),_0x1625e6,_0x39fa33['error'][_0xb73a('0x17')]);return _0xc99add(_0x39fa33[_0xb73a('0x15')]['message']);}else{logger[_0xb73a('0x18')](_0xb73a('0x11'),_0x1625e6,_0xb73a('0x12'));_0xc99add(_0x39fa33[_0xb73a('0x19')][_0xb73a('0x17')]);}})[_0xb73a('0x1a')](function(_0x1275d4){logger['error'](_0xb73a('0x11'),_0x1625e6,_0x1275d4);_0xe9db57(_0x1275d4);});});} \ No newline at end of file +var _0xa371=['jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xa371,0xbc));var _0x1a37=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xa371[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require(_0x1a37('0x0'));var moment=require(_0x1a37('0x1'));var BPromise=require(_0x1a37('0x2'));var rs=require(_0x1a37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a37('0x4'))['db'];var utils=require(_0x1a37('0x5'));var logger=require('../../config/logger')(_0x1a37('0x6'));var config=require(_0x1a37('0x7'));var jayson=require(_0x1a37('0x8'));var client=jayson[_0x1a37('0x9')][_0x1a37('0xa')]({'port':0x232a});config[_0x1a37('0xb')]=_[_0x1a37('0xc')](config['redis'],{'host':_0x1a37('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a37('0xb')]));require(_0x1a37('0xe'))[_0x1a37('0xf')](socket);function respondWithRpcPromise(_0x3f48d1,_0x541ffa,_0x5db644){return new BPromise(function(_0x55dd67,_0x5ea23b){return client[_0x1a37('0x10')](_0x3f48d1,_0x5db644)[_0x1a37('0x11')](function(_0x2d489f){logger[_0x1a37('0x12')](_0x1a37('0x13'),_0x541ffa,_0x1a37('0x14'));logger[_0x1a37('0x15')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x541ffa,_0x1a37('0x14'),JSON[_0x1a37('0x16')](_0x2d489f));if(_0x2d489f[_0x1a37('0x17')]){if(_0x2d489f[_0x1a37('0x17')][_0x1a37('0x18')]===0x1f4){logger[_0x1a37('0x17')]('UserNotification,\x20%s,\x20%s',_0x541ffa,_0x2d489f[_0x1a37('0x17')][_0x1a37('0x19')]);return _0x5ea23b(_0x2d489f[_0x1a37('0x17')]['message']);}logger[_0x1a37('0x17')](_0x1a37('0x13'),_0x541ffa,_0x2d489f[_0x1a37('0x17')][_0x1a37('0x19')]);return _0x55dd67(_0x2d489f['error'][_0x1a37('0x19')]);}else{logger['info'](_0x1a37('0x13'),_0x541ffa,_0x1a37('0x14'));_0x55dd67(_0x2d489f[_0x1a37('0x1a')]['message']);}})[_0x1a37('0x1b')](function(_0x553aca){logger[_0x1a37('0x17')]('UserNotification,\x20%s,\x20%s',_0x541ffa,_0x553aca);_0x5ea23b(_0x553aca);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 69696a4..508cb23 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 _0x034f=['register','userNotification:','./userNotification.events','save','remove','update','removeListener'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x034f,0x1ec));var _0xf034=function(_0x2f1929,_0x220a01){_0x2f1929=_0x2f1929-0x0;var _0x4b6fb1=_0x034f[_0x2f1929];return _0x4b6fb1;};'use strict';var UserNotificationEvents=require(_0xf034('0x0'));var events=[_0xf034('0x1'),_0xf034('0x2'),_0xf034('0x3')];function createListener(_0x905fa6,_0x510068){return function(_0x2a30e9){_0x510068['emit'](_0x905fa6,_0x2a30e9);};}function removeListener(_0x4266e0,_0x5efb58){return function(){UserNotificationEvents[_0xf034('0x4')](_0x4266e0,_0x5efb58);};}exports[_0xf034('0x5')]=function(_0x24cb0f){for(var _0x2feaf5=0x0,_0x38e424=events['length'];_0x2feaf5<_0x38e424;_0x2feaf5++){var _0x376c0a=events[_0x2feaf5];var _0x21d8ae=createListener(_0xf034('0x6')+_0x376c0a,_0x24cb0f);UserNotificationEvents['on'](_0x376c0a,_0x21d8ae);}}; \ No newline at end of file +var _0x8a5e=['length','userNotification:','save','remove','emit','register'];(function(_0x478829,_0x4ef2bb){var _0x59a14a=function(_0x11e88c){while(--_0x11e88c){_0x478829['push'](_0x478829['shift']());}};_0x59a14a(++_0x4ef2bb);}(_0x8a5e,0x1e8));var _0xe8a5=function(_0x4f72e5,_0x596b63){_0x4f72e5=_0x4f72e5-0x0;var _0x589a9d=_0x8a5e[_0x4f72e5];return _0x589a9d;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xe8a5('0x0'),_0xe8a5('0x1'),'update'];function createListener(_0x3a2c2a,_0x367f88){return function(_0x298394){_0x367f88[_0xe8a5('0x2')](_0x3a2c2a,_0x298394);};}function removeListener(_0xfcbfcf,_0xbc2498){return function(){UserNotificationEvents['removeListener'](_0xfcbfcf,_0xbc2498);};}exports[_0xe8a5('0x3')]=function(_0x953844){for(var _0x3018d8=0x0,_0x11b27b=events[_0xe8a5('0x4')];_0x3018d8<_0x11b27b;_0x3018d8++){var _0x4cd27f=events[_0x3018d8];var _0x393207=createListener(_0xe8a5('0x5')+_0x4cd27f,_0x953844);UserNotificationEvents['on'](_0x4cd27f,_0x393207);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index fc5c504..fddbeec 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d4d8a,_0x155e5e){var _0x3863ce=function(_0x5695fc){while(--_0x5695fc){_0x5d4d8a['push'](_0x5d4d8a['shift']());}};_0x3863ce(++_0x155e5e);}(_0xe706,0xa3));var _0x6e70=function(_0x42bda2,_0x4106ca){_0x42bda2=_0x42bda2-0x0;var _0x625d2d=_0xe706[_0x42bda2];return _0x625d2d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x51e5a1,_0x34f48b){var _0x105f97=function(_0x111524){while(--_0x111524){_0x51e5a1['push'](_0x51e5a1['shift']());}};_0x105f97(++_0x34f48b);}(_0x70e0,0x17b));var _0x070e=function(_0x34df4e,_0x2f8cfd){_0x34df4e=_0x34df4e-0x0;var _0x11dedd=_0x70e0[_0x34df4e];return _0x11dedd;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 4777e9f..2a96f6b 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 _0x7244=['sequelize','exports','INTEGER'];(function(_0x172b62,_0x277107){var _0x93d1d6=function(_0x457c2f){while(--_0x457c2f){_0x172b62['push'](_0x172b62['shift']());}};_0x93d1d6(++_0x277107);}(_0x7244,0xf6));var _0x4724=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7244[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x4724('0x0'));module[_0x4724('0x1')]={'penalty':{'type':Sequelize[_0x4724('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4310=['exports','INTEGER','sequelize'];(function(_0x547842,_0x1c61e8){var _0x540258=function(_0x5da6ae){while(--_0x5da6ae){_0x547842['push'](_0x547842['shift']());}};_0x540258(++_0x1c61e8);}(_0x4310,0x110));var _0x0431=function(_0x2b439e,_0x21ce5e){_0x2b439e=_0x2b439e-0x0;var _0x189dd0=_0x4310[_0x2b439e];return _0x189dd0;};'use strict';var Sequelize=require(_0x0431('0x0'));module[_0x0431('0x1')]={'penalty':{'type':Sequelize[_0x0431('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 10a9acf..c0540fc 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 _0xe51f=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbbd5cc,_0x5c72d5){var _0x1d7c29=function(_0x1ba8bc){while(--_0x1ba8bc){_0xbbd5cc['push'](_0xbbd5cc['shift']());}};_0x1d7c29(++_0x5c72d5);}(_0xe51f,0x1b6));var _0xfe51=function(_0x18dc15,_0x5f2438){_0x18dc15=_0x18dc15-0x0;var _0x371b94=_0xe51f[_0x18dc15];return _0x371b94;};'use strict';var _=require(_0xfe51('0x0'));var util=require(_0xfe51('0x1'));var logger=require(_0xfe51('0x2'))(_0xfe51('0x3'));var moment=require(_0xfe51('0x4'));var BPromise=require(_0xfe51('0x5'));var rp=require(_0xfe51('0x6'));var fs=require('fs');var path=require(_0xfe51('0x7'));var rimraf=require(_0xfe51('0x8'));var config=require(_0xfe51('0x9'));var attributes=require(_0xfe51('0xa'));module[_0xfe51('0xb')]=function(_0x17faf2,_0x53fb9c){return _0x17faf2[_0xfe51('0xc')](_0xfe51('0xd'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fd5=['UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x23ce99,_0x1602e0){var _0x40ef15=function(_0xf47b3d){while(--_0xf47b3d){_0x23ce99['push'](_0x23ce99['shift']());}};_0x40ef15(++_0x1602e0);}(_0x2fd5,0x157));var _0x52fd=function(_0x59fa74,_0x132dcd){_0x59fa74=_0x59fa74-0x0;var _0x4401cd=_0x2fd5[_0x59fa74];return _0x4401cd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x52fd('0x0'))(_0x52fd('0x1'));var moment=require(_0x52fd('0x2'));var BPromise=require(_0x52fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52fd('0x4'));var rimraf=require(_0x52fd('0x5'));var config=require(_0x52fd('0x6'));var attributes=require(_0x52fd('0x7'));module['exports']=function(_0x4eeaf3,_0x280f7b){return _0x4eeaf3[_0x52fd('0x8')](_0x52fd('0x9'),attributes,{'tableName':_0x52fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index c05273b..e1ec7a8 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 _0x6412=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x3acd60,_0x174e98){var _0x4fc8d2=function(_0x261db0){while(--_0x261db0){_0x3acd60['push'](_0x3acd60['shift']());}};_0x4fc8d2(++_0x174e98);}(_0x6412,0x64));var _0x2641=function(_0x363b9c,_0x175500){_0x363b9c=_0x363b9c-0x0;var _0x2a8edd=_0x6412[_0x363b9c];return _0x2a8edd;};'use strict';var _=require(_0x2641('0x0'));var util=require(_0x2641('0x1'));var moment=require(_0x2641('0x2'));var BPromise=require(_0x2641('0x3'));var rs=require(_0x2641('0x4'));var fs=require('fs');var Redis=require(_0x2641('0x5'));var db=require(_0x2641('0x6'))['db'];var utils=require(_0x2641('0x7'));var logger=require(_0x2641('0x8'))('rpc');var config=require(_0x2641('0x9'));var jayson=require(_0x2641('0xa'));var client=jayson[_0x2641('0xb')][_0x2641('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x306445,_0x14be0a,_0x54beb0){return new BPromise(function(_0x4a0ec4,_0x566d5d){return client[_0x2641('0xd')](_0x306445,_0x54beb0)[_0x2641('0xe')](function(_0x4a9974){logger['info'](_0x2641('0xf'),_0x14be0a,_0x2641('0x10'));logger[_0x2641('0x11')](_0x2641('0x12'),_0x14be0a,'request\x20sent',JSON[_0x2641('0x13')](_0x4a9974));if(_0x4a9974[_0x2641('0x14')]){if(_0x4a9974[_0x2641('0x14')][_0x2641('0x15')]===0x1f4){logger[_0x2641('0x14')](_0x2641('0xf'),_0x14be0a,_0x4a9974[_0x2641('0x14')][_0x2641('0x16')]);return _0x566d5d(_0x4a9974[_0x2641('0x14')][_0x2641('0x16')]);}logger[_0x2641('0x14')](_0x2641('0xf'),_0x14be0a,_0x4a9974['error'][_0x2641('0x16')]);return _0x4a0ec4(_0x4a9974['error']['message']);}else{logger[_0x2641('0x17')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x14be0a,_0x2641('0x10'));_0x4a0ec4(_0x4a9974[_0x2641('0x18')][_0x2641('0x16')]);}})[_0x2641('0x19')](function(_0x477b88){logger[_0x2641('0x14')](_0x2641('0xf'),_0x14be0a,_0x477b88);_0x566d5d(_0x477b88);});});} \ No newline at end of file +var _0xd73f=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug'];(function(_0x1c5bdb,_0x44bf0e){var _0x4988a1=function(_0x1db1da){while(--_0x1db1da){_0x1c5bdb['push'](_0x1c5bdb['shift']());}};_0x4988a1(++_0x44bf0e);}(_0xd73f,0x152));var _0xfd73=function(_0x3f0406,_0x3d338d){_0x3f0406=_0x3f0406-0x0;var _0x667f30=_0xd73f[_0x3f0406];return _0x667f30;};'use strict';var _=require(_0xfd73('0x0'));var util=require('util');var moment=require(_0xfd73('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd73('0x2'));var fs=require('fs');var Redis=require(_0xfd73('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd73('0x4'));var logger=require(_0xfd73('0x5'))(_0xfd73('0x6'));var config=require(_0xfd73('0x7'));var jayson=require(_0xfd73('0x8'));var client=jayson[_0xfd73('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe270,_0x46b9e3,_0x29bdaf){return new BPromise(function(_0x5fd33b,_0x475b1a){return client[_0xfd73('0xa')](_0x3fe270,_0x29bdaf)['then'](function(_0x34a413){logger[_0xfd73('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x46b9e3,_0xfd73('0xc'));logger[_0xfd73('0xd')](_0xfd73('0xe'),_0x46b9e3,_0xfd73('0xc'),JSON[_0xfd73('0xf')](_0x34a413));if(_0x34a413[_0xfd73('0x10')]){if(_0x34a413[_0xfd73('0x10')][_0xfd73('0x11')]===0x1f4){logger[_0xfd73('0x10')](_0xfd73('0x12'),_0x46b9e3,_0x34a413['error']['message']);return _0x475b1a(_0x34a413[_0xfd73('0x10')][_0xfd73('0x13')]);}logger[_0xfd73('0x10')](_0xfd73('0x12'),_0x46b9e3,_0x34a413['error'][_0xfd73('0x13')]);return _0x5fd33b(_0x34a413[_0xfd73('0x10')][_0xfd73('0x13')]);}else{logger['info'](_0xfd73('0x12'),_0x46b9e3,_0xfd73('0xc'));_0x5fd33b(_0x34a413[_0xfd73('0x14')][_0xfd73('0x13')]);}})[_0xfd73('0x15')](function(_0x2ec286){logger['error'](_0xfd73('0x12'),_0x46b9e3,_0x2ec286);_0x475b1a(_0x2ec286);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 61964b4..de6f2aa 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 _0x9143=['/:id/resources','getResources','post','create','clone','/:id/sections','addResources','put','update','delete','removeSections','removeResources','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x9143,0x107));var _0x3914=function(_0x59fd7d,_0x22de62){_0x59fd7d=_0x59fd7d-0x0;var _0x3abad4=_0x9143[_0x59fd7d];return _0x3abad4;};'use strict';var multer=require(_0x3914('0x0'));var util=require(_0x3914('0x1'));var path=require('path');var timeout=require(_0x3914('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3914('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3914('0x4'));var config=require('../../config/environment');var controller=require(_0x3914('0x5'));router[_0x3914('0x6')]('/',auth[_0x3914('0x7')](),controller[_0x3914('0x8')]);router['get'](_0x3914('0x9'),auth['isAuthenticated'](),controller[_0x3914('0xa')]);router[_0x3914('0x6')](_0x3914('0xb'),auth[_0x3914('0x7')](),controller['show']);router['get']('/:id/sections',auth[_0x3914('0x7')](),controller['getSections']);router[_0x3914('0x6')](_0x3914('0xc'),auth[_0x3914('0x7')](),controller[_0x3914('0xd')]);router[_0x3914('0xe')]('/',auth['isAuthenticated'](),controller[_0x3914('0xf')]);router[_0x3914('0xe')]('/:id/clone',auth[_0x3914('0x7')](),controller[_0x3914('0x10')]);router[_0x3914('0xe')](_0x3914('0x11'),auth[_0x3914('0x7')](),controller['addSections']);router['post'](_0x3914('0xc'),auth['isAuthenticated'](),controller[_0x3914('0x12')]);router[_0x3914('0x13')](_0x3914('0xb'),auth[_0x3914('0x7')](),controller[_0x3914('0x14')]);router[_0x3914('0x15')](_0x3914('0xb'),auth[_0x3914('0x7')](),controller['destroy']);router[_0x3914('0x15')](_0x3914('0x11'),auth[_0x3914('0x7')](),controller[_0x3914('0x16')]);router[_0x3914('0x15')](_0x3914('0xc'),auth[_0x3914('0x7')](),controller[_0x3914('0x17')]);module[_0x3914('0x18')]=router; \ No newline at end of file +var _0x1d32=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./userProfile.controller','get','index','isAuthenticated','describe','/:id','show','/:id/sections','getSections','getResources','post','create','clone','addResources','put','delete','destroy','/:id/resources','removeResources','exports','multer'];(function(_0x42bceb,_0x5a8dc7){var _0xf9143b=function(_0xc5afca){while(--_0xc5afca){_0x42bceb['push'](_0x42bceb['shift']());}};_0xf9143b(++_0x5a8dc7);}(_0x1d32,0x128));var _0x21d3=function(_0xba113,_0x104772){_0xba113=_0xba113-0x0;var _0x17e4b7=_0x1d32[_0xba113];return _0x17e4b7;};'use strict';var multer=require(_0x21d3('0x0'));var util=require('util');var path=require(_0x21d3('0x1'));var timeout=require(_0x21d3('0x2'));var express=require(_0x21d3('0x3'));var router=express[_0x21d3('0x4')]();var fs_extra=require(_0x21d3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x21d3('0x6'));var controller=require(_0x21d3('0x7'));router[_0x21d3('0x8')]('/',auth['isAuthenticated'](),controller[_0x21d3('0x9')]);router[_0x21d3('0x8')]('/describe',auth[_0x21d3('0xa')](),controller[_0x21d3('0xb')]);router['get'](_0x21d3('0xc'),auth[_0x21d3('0xa')](),controller[_0x21d3('0xd')]);router[_0x21d3('0x8')](_0x21d3('0xe'),auth[_0x21d3('0xa')](),controller[_0x21d3('0xf')]);router[_0x21d3('0x8')]('/:id/resources',auth[_0x21d3('0xa')](),controller[_0x21d3('0x10')]);router[_0x21d3('0x11')]('/',auth['isAuthenticated'](),controller[_0x21d3('0x12')]);router[_0x21d3('0x11')]('/:id/clone',auth[_0x21d3('0xa')](),controller[_0x21d3('0x13')]);router['post'](_0x21d3('0xe'),auth[_0x21d3('0xa')](),controller['addSections']);router[_0x21d3('0x11')]('/:id/resources',auth[_0x21d3('0xa')](),controller[_0x21d3('0x14')]);router[_0x21d3('0x15')](_0x21d3('0xc'),auth[_0x21d3('0xa')](),controller['update']);router[_0x21d3('0x16')]('/:id',auth[_0x21d3('0xa')](),controller[_0x21d3('0x17')]);router[_0x21d3('0x16')](_0x21d3('0xe'),auth[_0x21d3('0xa')](),controller['removeSections']);router[_0x21d3('0x16')](_0x21d3('0x18'),auth['isAuthenticated'](),controller[_0x21d3('0x19')]);module[_0x21d3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b6fdf82..83f9966 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 _0x7aed=['STRING','name','setDataValue','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports'];(function(_0x1bae8b,_0x87c842){var _0x33d115=function(_0x4dea4f){while(--_0x4dea4f){_0x1bae8b['push'](_0x1bae8b['shift']());}};_0x33d115(++_0x87c842);}(_0x7aed,0xdf));var _0xd7ae=function(_0xd36a51,_0x37b0d0){_0xd36a51=_0xd36a51-0x0;var _0x18295d=_0x7aed[_0xd36a51];return _0x18295d;};'use strict';var Sequelize=require(_0xd7ae('0x0'));module[_0xd7ae('0x1')]={'name':{'type':Sequelize[_0xd7ae('0x2')],'allowNull':![],'unique':_0xd7ae('0x3')},'crudPermissions':{'type':Sequelize[_0xd7ae('0x2')],'set':function(_0x393f15){this[_0xd7ae('0x4')]('crudPermissions',_0x393f15?_0x393f15['join'](''):[]);},'get':function(){return this[_0xd7ae('0x5')](_0xd7ae('0x6'))?this[_0xd7ae('0x5')](_0xd7ae('0x6'))[_0xd7ae('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd7ae('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xd7ae('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd7ae('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd7ae('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd7ae('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd7ae('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd7ae('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd7ae('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9032=['sequelize','exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x51f67a,_0x1b79a8){var _0x25f7c3=function(_0x442501){while(--_0x442501){_0x51f67a['push'](_0x51f67a['shift']());}};_0x25f7c3(++_0x1b79a8);}(_0x9032,0xe6));var _0x2903=function(_0x5afe2d,_0x3a9915){_0x5afe2d=_0x5afe2d-0x0;var _0x153e43=_0x9032[_0x5afe2d];return _0x153e43;};'use strict';var Sequelize=require(_0x2903('0x0'));module[_0x2903('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2903('0x2')},'crudPermissions':{'type':Sequelize[_0x2903('0x3')],'set':function(_0x1adfe4){this[_0x2903('0x4')](_0x2903('0x5'),_0x1adfe4?_0x1adfe4[_0x2903('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x2903('0x5'))?this[_0x2903('0x7')](_0x2903('0x5'))[_0x2903('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2903('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2903('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9b1a607..e6d314c 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 _0x3a6d=['localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','clone','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','update','describe','push','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis'];(function(_0x4b630c,_0x5da947){var _0x1be67a=function(_0x2da6ce){while(--_0x2da6ce){_0x4b630c['push'](_0x4b630c['shift']());}};_0x1be67a(++_0x5da947);}(_0x3a6d,0x143));var _0xd3a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3a6d[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xd3a6('0x0'));var rimraf=require(_0xd3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3a6('0x2'));var rp=require(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require(_0xd3a6('0x5'));var Mustache=require(_0xd3a6('0x6'));var util=require('util');var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require(_0xd3a6('0x9'));var ejs=require(_0xd3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a6('0xb'));var _=require(_0xd3a6('0xc'));var squel=require('squel');var crypto=require(_0xd3a6('0xd'));var jsforce=require(_0xd3a6('0xe'));var deskjs=require(_0xd3a6('0xf'));var toCsv=require(_0xd3a6('0x9'));var querystring=require(_0xd3a6('0x10'));var Papa=require(_0xd3a6('0x11'));var Redis=require(_0xd3a6('0x12'));var authService=require(_0xd3a6('0x13'));var qs=require(_0xd3a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3a6('0x15'));var logger=require(_0xd3a6('0x16'))(_0xd3a6('0x17'));var utils=require(_0xd3a6('0x18'));var config=require(_0xd3a6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xd3a6('0x1a')](config[_0xd3a6('0x1b')],{'host':_0xd3a6('0x1c'),'port':0x18eb});var socket=require(_0xd3a6('0x1d'))(new Redis(config[_0xd3a6('0x1b')]));require(_0xd3a6('0x1e'))[_0xd3a6('0x1f')](socket);function respondWithStatusCode(_0x4e67fb,_0x473a97){_0x473a97=_0x473a97||0xcc;return function(_0xf5ace5){if(_0xf5ace5){return _0x4e67fb[_0xd3a6('0x20')](_0x473a97);}return _0x4e67fb['status'](_0x473a97)[_0xd3a6('0x21')]();};}function respondWithResult(_0x305b61,_0x1781f6){_0x1781f6=_0x1781f6||0xc8;return function(_0x57d826){if(_0x57d826){return _0x305b61[_0xd3a6('0x22')](_0x1781f6)['json'](_0x57d826);}};}function respondWithFilteredResult(_0x518b6d,_0x28b63c){return function(_0x8d1286){if(_0x8d1286){var _0x32683f=typeof _0x28b63c[_0xd3a6('0x23')]===_0xd3a6('0x24')&&typeof _0x28b63c[_0xd3a6('0x25')]===_0xd3a6('0x24');var _0x4ec27c=_0x8d1286[_0xd3a6('0x26')];var _0x4e78ec=_0x32683f?0x0:_0x28b63c[_0xd3a6('0x23')];var _0x7fa2c0=_0x32683f?_0x8d1286[_0xd3a6('0x26')]:_0x28b63c[_0xd3a6('0x23')]+_0x28b63c[_0xd3a6('0x25')];var _0x6ecd88;if(_0x7fa2c0>=_0x4ec27c){_0x7fa2c0=_0x4ec27c;_0x6ecd88=0xc8;}else{_0x6ecd88=0xce;}_0x518b6d['status'](_0x6ecd88);return _0x518b6d[_0xd3a6('0x27')](_0xd3a6('0x28'),_0x4e78ec+'-'+_0x7fa2c0+'/'+_0x4ec27c)['json'](_0x8d1286);}return null;};}function patchUpdates(_0x543a6a){return function(_0x5846bc){try{jsonpatch['apply'](_0x5846bc,_0x543a6a,!![]);}catch(_0x5c9075){return BPromise[_0xd3a6('0x29')](_0x5c9075);}return _0x5846bc[_0xd3a6('0x2a')]();};}function saveUpdates(_0x3d0b28,_0x5abd33){return function(_0x456541){if(_0x456541){return _0x456541['update'](_0x3d0b28)[_0xd3a6('0x2b')](function(_0x16afc8){return _0x16afc8;});}return null;};}function removeEntity(_0x429079,_0x4f6130){return function(_0x14316b){if(_0x14316b){return _0x14316b[_0xd3a6('0x2c')]()[_0xd3a6('0x2b')](function(){_0x429079[_0xd3a6('0x22')](0xcc)[_0xd3a6('0x21')]();});}};}function handleEntityNotFound(_0x3106f1,_0x5650d1){return function(_0x30df90){if(!_0x30df90){_0x3106f1[_0xd3a6('0x20')](0x194);}return _0x30df90;};}function handleError(_0x24ff6d,_0x3f6d35){_0x3f6d35=_0x3f6d35||0x1f4;return function(_0x30abc2){logger[_0xd3a6('0x2d')](_0x30abc2['stack']);if(_0x30abc2['name']){delete _0x30abc2[_0xd3a6('0x2e')];}_0x24ff6d[_0xd3a6('0x22')](_0x3f6d35)[_0xd3a6('0x2f')](_0x30abc2);};}exports[_0xd3a6('0x30')]=function(_0x4c05a2,_0x3de3bb){var _0xa4efd={},_0x4d322a={},_0x14381c={'count':0x0,'rows':[]};var _0x5d9867=_[_0xd3a6('0x31')](db[_0xd3a6('0x32')][_0xd3a6('0x33')],function(_0x87b75a){return{'name':_0x87b75a[_0xd3a6('0x34')],'type':_0x87b75a[_0xd3a6('0x35')][_0xd3a6('0x36')]};});_0x4d322a['model']=_['map'](_0x5d9867,_0xd3a6('0x2e'));_0x4d322a[_0xd3a6('0x37')]=_[_0xd3a6('0x38')](_0x4c05a2['query']);_0x4d322a[_0xd3a6('0x39')]=_[_0xd3a6('0x3a')](_0x4d322a[_0xd3a6('0x3b')],_0x4d322a[_0xd3a6('0x37')]);_0xa4efd[_0xd3a6('0x3c')]=_[_0xd3a6('0x3a')](_0x4d322a[_0xd3a6('0x3b')],qs[_0xd3a6('0x3d')](_0x4c05a2['query'][_0xd3a6('0x3d')]));_0xa4efd[_0xd3a6('0x3c')]=_0xa4efd[_0xd3a6('0x3c')][_0xd3a6('0x3e')]?_0xa4efd[_0xd3a6('0x3c')]:_0x4d322a[_0xd3a6('0x3b')];if(!_0x4c05a2['query'][_0xd3a6('0x3f')]('nolimit')){_0xa4efd[_0xd3a6('0x25')]=qs[_0xd3a6('0x25')](_0x4c05a2[_0xd3a6('0x37')][_0xd3a6('0x25')]);_0xa4efd['offset']=qs['offset'](_0x4c05a2[_0xd3a6('0x37')][_0xd3a6('0x23')]);}_0xa4efd[_0xd3a6('0x40')]=qs['sort'](_0x4c05a2[_0xd3a6('0x37')][_0xd3a6('0x41')]);_0xa4efd['where']=qs[_0xd3a6('0x39')](_['pick'](_0x4c05a2[_0xd3a6('0x37')],_0x4d322a[_0xd3a6('0x39')]),_0x5d9867);if(_0x4c05a2['query'][_0xd3a6('0x42')]){_0xa4efd['where']=_[_0xd3a6('0x43')](_0xa4efd[_0xd3a6('0x44')],{'$or':_['map'](_0x5d9867,function(_0x2cba30){if(_0x2cba30[_0xd3a6('0x35')]!==_0xd3a6('0x45')){var _0x1fc06e={};_0x1fc06e[_0x2cba30['name']]={'$like':'%'+_0x4c05a2[_0xd3a6('0x37')][_0xd3a6('0x42')]+'%'};return _0x1fc06e;}})});}_0xa4efd=_[_0xd3a6('0x43')]({},_0xa4efd,_0x4c05a2[_0xd3a6('0x46')]);var _0x11fb78={'where':_0xa4efd['where']};return db[_0xd3a6('0x32')]['count'](_0x11fb78)[_0xd3a6('0x2b')](function(_0x1bc18a){_0x14381c[_0xd3a6('0x26')]=_0x1bc18a;if(_0x4c05a2['query'][_0xd3a6('0x47')]){_0xa4efd['include']=[{'all':!![]}];}return db[_0xd3a6('0x32')]['findAll'](_0xa4efd);})[_0xd3a6('0x2b')](function(_0x629153){_0x14381c[_0xd3a6('0x48')]=_0x629153;return _0x14381c;})[_0xd3a6('0x2b')](respondWithFilteredResult(_0x3de3bb,_0xa4efd))[_0xd3a6('0x49')](handleError(_0x3de3bb,null));};exports[_0xd3a6('0x4a')]=function(_0x2f2046,_0x54e220){var _0x3f7fdc={'raw':![],'where':{'id':_0x2f2046[_0xd3a6('0x4b')]['id']}},_0x102722={};_0x102722[_0xd3a6('0x3b')]=_['keys'](db[_0xd3a6('0x32')][_0xd3a6('0x33')]);_0x102722[_0xd3a6('0x37')]=_[_0xd3a6('0x38')](_0x2f2046[_0xd3a6('0x37')]);_0x102722[_0xd3a6('0x39')]=_[_0xd3a6('0x3a')](_0x102722[_0xd3a6('0x3b')],_0x102722['query']);_0x3f7fdc[_0xd3a6('0x3c')]=_[_0xd3a6('0x3a')](_0x102722[_0xd3a6('0x3b')],qs[_0xd3a6('0x3d')](_0x2f2046[_0xd3a6('0x37')]['fields']));_0x3f7fdc[_0xd3a6('0x3c')]=_0x3f7fdc[_0xd3a6('0x3c')][_0xd3a6('0x3e')]?_0x3f7fdc[_0xd3a6('0x3c')]:_0x102722[_0xd3a6('0x3b')];if(_0x2f2046[_0xd3a6('0x37')][_0xd3a6('0x47')]){_0x3f7fdc[_0xd3a6('0x4c')]=[{'all':!![]}];}_0x3f7fdc=_['merge']({},_0x3f7fdc,_0x2f2046[_0xd3a6('0x46')]);return db['UserProfile'][_0xd3a6('0x4d')](_0x3f7fdc)[_0xd3a6('0x2b')](handleEntityNotFound(_0x54e220,null))['then'](respondWithResult(_0x54e220,null))[_0xd3a6('0x49')](handleError(_0x54e220,null));};exports[_0xd3a6('0x4e')]=function(_0x3cf99a,_0x375067){return db[_0xd3a6('0x32')][_0xd3a6('0x4e')](_0x3cf99a[_0xd3a6('0x4f')],{})[_0xd3a6('0x2b')](respondWithResult(_0x375067,0xc9))[_0xd3a6('0x49')](handleError(_0x375067,null));};exports[_0xd3a6('0x50')]=function(_0x4a2ad8,_0x287a48){var _0x2e18b6={'where':{'id':_0x4a2ad8[_0xd3a6('0x4b')]['id']}},_0x470f5a={};_0x470f5a[_0xd3a6('0x3b')]=_[_0xd3a6('0x38')](db[_0xd3a6('0x32')][_0xd3a6('0x33')]);_0x2e18b6[_0xd3a6('0x3c')]=_[_0xd3a6('0x3a')](_0x470f5a['model'],qs[_0xd3a6('0x3d')](_0x4a2ad8[_0xd3a6('0x37')][_0xd3a6('0x3d')]));_0x2e18b6['attributes']=_0x2e18b6[_0xd3a6('0x3c')]['length']?_0x2e18b6['attributes']:_0x470f5a['model'];if(_0x4a2ad8['query'][_0xd3a6('0x47')]){_0x2e18b6[_0xd3a6('0x4c')]=[{'all':!![]}];}_0x2e18b6=_[_0xd3a6('0x43')]({},_0x2e18b6,_0x4a2ad8[_0xd3a6('0x46')]);return db[_0xd3a6('0x32')][_0xd3a6('0x4d')](_0x2e18b6)[_0xd3a6('0x2b')](handleEntityNotFound(_0x287a48,null))[_0xd3a6('0x2b')](function(_0x347e71){if(_0x347e71){var _0x1ecb5c=_0x347e71['get']({'plain':!![]});_0x1ecb5c=qs['omit'](_0x1ecb5c,['id',_0xd3a6('0x51'),_0xd3a6('0x52'),_0xd3a6('0x53')]);_0x4a2ad8[_0xd3a6('0x4f')]=_[_0xd3a6('0x54')](_0x4a2ad8['body'],['id',_0xd3a6('0x51'),_0xd3a6('0x52')]);return db[_0xd3a6('0x55')][_0xd3a6('0x56')](function(_0x54d121){return db['UserProfile'][_0xd3a6('0x4e')](_[_0xd3a6('0x43')](_0x1ecb5c,_0x4a2ad8['body']),{'include':_0x4a2ad8[_0xd3a6('0x37')][_0xd3a6('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x54d121})[_0xd3a6('0x2b')](function(_0x4b021d){var _0xfdfcad=_0x4b021d[_0xd3a6('0x57')]({'plain':!![]});return db['UserProfileSection'][_0xd3a6('0x58')]({'where':{'userProfileId':_0x4a2ad8[_0xd3a6('0x4b')]['id']},'raw':!![]})['then'](function(_0x4c315b){if(_0x4c315b){return BPromise[_0xd3a6('0x59')](_0x4c315b,function(_0xb76b22){return new BPromise(function(_0x4e02fb,_0x4f79b8){if(_0xb76b22[_0xd3a6('0x5a')]===null||_0xb76b22['autoAssociation']===0x1)_0x4e02fb(null);return db[_0xd3a6('0x5b')][_0xd3a6('0x58')]({'where':{'sectionId':_0xb76b22['id']},'raw':!![]})['then'](function(_0x130f5d){var _0x4b9a38=_['map'](_0x130f5d,function(_0x19bba0){return qs['omit'](_0x19bba0,['id',_0xd3a6('0x51'),_0xd3a6('0x52'),_0xd3a6('0x5c')]);});_0x4e02fb(_0x4b9a38);})[_0xd3a6('0x49')](function(_0x33e5ea){_0x4f79b8(_0x33e5ea);});})['then'](function(_0x25f53b){var _0x88476a=qs[_0xd3a6('0x54')](_0xb76b22,['id',_0xd3a6('0x51'),'updatedAt']);_0x88476a[_0xd3a6('0x5d')]=_0xfdfcad['id'];if(_0x25f53b)_0x88476a[_0xd3a6('0x5e')]=_0x25f53b;return _0x88476a;})[_0xd3a6('0x2b')](function(_0x2a3432){return db[_0xd3a6('0x5f')]['create'](_0x2a3432,{'include':[{'model':db['UserProfileResource'],'as':_0xd3a6('0x5e')}],'raw':!![],'transaction':_0x54d121});});})['then'](function(){return _0xfdfcad;});}});});});}})[_0xd3a6('0x2b')](respondWithResult(_0x287a48,0xc9))[_0xd3a6('0x49')](handleError(_0x287a48,null));};exports[_0xd3a6('0x60')]=function(_0x4286f2,_0x3c6b26){if(_0x4286f2['body']['id']){delete _0x4286f2['body']['id'];}return db[_0xd3a6('0x32')]['find']({'where':{'id':_0x4286f2['params']['id']}})[_0xd3a6('0x2b')](handleEntityNotFound(_0x3c6b26,null))[_0xd3a6('0x2b')](saveUpdates(_0x4286f2[_0xd3a6('0x4f')],null))[_0xd3a6('0x2b')](respondWithResult(_0x3c6b26,null))[_0xd3a6('0x49')](handleError(_0x3c6b26,null));};exports[_0xd3a6('0x2c')]=function(_0x4d54f4,_0x24cb61){return db[_0xd3a6('0x32')][_0xd3a6('0x4d')]({'where':{'id':_0x4d54f4['params']['id']}})[_0xd3a6('0x2b')](handleEntityNotFound(_0x24cb61,null))[_0xd3a6('0x2b')](removeEntity(_0x24cb61,null))['catch'](handleError(_0x24cb61,null));};exports[_0xd3a6('0x61')]=function(_0x5a7749,_0x37415f){return db[_0xd3a6('0x32')][_0xd3a6('0x61')]()['then'](respondWithResult(_0x37415f,null))[_0xd3a6('0x49')](handleError(_0x37415f,null));};exports['addSections']=function(_0x49e826,_0x3da7c0){var _0x3794cc=_0x49e826['body'];return db[_0xd3a6('0x32')][_0xd3a6('0x4d')]({'where':{'id':_0x49e826['params']['id']}})[_0xd3a6('0x2b')](handleEntityNotFound(_0x3da7c0,null))[_0xd3a6('0x2b')](function(_0x107066){if(_0x107066){return db[_0xd3a6('0x55')][_0xd3a6('0x56')](function(_0x2ca9e8){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x49e826[_0xd3a6('0x4b')]['id'],'sectionId':_[_0xd3a6('0x31')](_0x3794cc,function(_0x376fd6){return _0x376fd6[_0xd3a6('0x5c')];})},'transaction':_0x2ca9e8})['then'](function(){var _0x20e775=_[_0xd3a6('0x31')](_0x3794cc,function(_0x377f28){_0x377f28[_0xd3a6('0x5d')]=_0x49e826['params']['id'];return _0x377f28;});var _0x30815f=[];return BPromise['each'](_0x20e775,function(_0xef36aa){return db[_0xd3a6('0x5f')][_0xd3a6('0x4e')](_0xef36aa,{'include':[{'model':db[_0xd3a6('0x5b')],'as':_0xd3a6('0x5e')}],'raw':!![],'transaction':_0x2ca9e8})[_0xd3a6('0x2b')](function(_0x2d02ee){_0x30815f[_0xd3a6('0x62')](_0x2d02ee[_0xd3a6('0x57')]({'plain':!![]}));});})[_0xd3a6('0x2b')](function(){return _0x30815f;});});});}})[_0xd3a6('0x2b')](function(_0x1d0c53){return _0x1d0c53;})['then'](respondWithResult(_0x3da7c0,null))[_0xd3a6('0x49')](handleError(_0x3da7c0,null));};exports['removeSections']=function(_0x2939ba,_0x2cfaa6){var _0x2bf349;return db['UserProfile'][_0xd3a6('0x4d')]({'where':{'id':_0x2939ba[_0xd3a6('0x4b')]['id']},'attributes':['id','name']})[_0xd3a6('0x2b')](handleEntityNotFound(_0x2cfaa6,null))[_0xd3a6('0x2b')](function(_0x237235){if(_0x237235){_0x2bf349=_0x237235;return db[_0xd3a6('0x5f')][_0xd3a6('0x2c')]({'where':{'userProfileId':_0x2939ba[_0xd3a6('0x4b')]['id'],'sectionId':_0x2939ba[_0xd3a6('0x37')][_0xd3a6('0x63')]}});}})['then'](function(){return _0x2bf349;})[_0xd3a6('0x2b')](respondWithStatusCode(_0x2cfaa6,null))[_0xd3a6('0x49')](handleError(_0x2cfaa6,null));};exports[_0xd3a6('0x64')]=function(_0x472f53,_0x822b08){var _0x2b44e6=[];var _0xf77dfc=[];return db[_0xd3a6('0x5f')][_0xd3a6('0x58')]({'where':{'userProfileId':_0x472f53[_0xd3a6('0x4b')]['id']},'raw':!![]})[_0xd3a6('0x2b')](function(_0x4cecad){_0x2b44e6=_[_0xd3a6('0x42')](_0x4cecad,function(_0x59c35d){return _0x59c35d[_0xd3a6('0x65')]===0x1||_[_0xd3a6('0x66')]([0x3eb,0x709],_0x59c35d['sectionId']);});if(!_[_0xd3a6('0x67')](_0x2b44e6)){return _[_0xd3a6('0x31')](_0x2b44e6,function(_0x1d3d5e){return _0x1d3d5e[_0xd3a6('0x5c')];});}else{return;}})[_0xd3a6('0x2b')](function(_0x19f573){if(_0x19f573)_0xf77dfc=_0x19f573;if(_[_0xd3a6('0x66')](_0xf77dfc,0x64)){var _0x2bed51=_[_0xd3a6('0x4d')](_0x2b44e6,{'sectionId':0x64});return hasDefaultDashboard(_0x2bed51)[_0xd3a6('0x2b')](function(_0xd5f23e){return _['map'](_0x2b44e6,function(_0x2b0706){if(_0x2b0706[_0xd3a6('0x5c')]===0x64){_0x2b0706[_0xd3a6('0x68')]=_0xd5f23e;}return _0x2b0706;});});}else{return;}})[_0xd3a6('0x2b')](function(_0x1ec821){if(_0x1ec821)_0x2b44e6=_0x1ec821;if(_[_0xd3a6('0x66')](_0xf77dfc,0x3eb)){var _0x49b278=_[_0xd3a6('0x4d')](_0x2b44e6,{'sectionId':0x3eb});return getCustomDashboards(_0x49b278)[_0xd3a6('0x2b')](function(_0x5b2458){return _[_0xd3a6('0x31')](_0x2b44e6,function(_0x582533){if(_0x49b278[_0xd3a6('0x65')]){if(_0x582533[_0xd3a6('0x5c')]===0x3eb){_0x582533['subsections']=_0x5b2458;}}else{if(_0x582533[_0xd3a6('0x5c')]===0x64){_0x582533[_0xd3a6('0x68')]=_0x5b2458;}}return _0x582533;});});}else{return;}})[_0xd3a6('0x2b')](function(_0x3d1245){if(_0x3d1245)_0x2b44e6=_0x3d1245;if(_['includes'](_0xf77dfc,0x709)){var _0x487d26=_[_0xd3a6('0x4d')](_0x2b44e6,{'sectionId':0x709});return getPlugins(_0x487d26)[_0xd3a6('0x2b')](function(_0x326894){if(_0x487d26[_0xd3a6('0x65')]){return _[_0xd3a6('0x31')](_0x2b44e6,function(_0x5bed75){if(_0x5bed75[_0xd3a6('0x5c')]===0x709){_0x5bed75[_0xd3a6('0x68')]=_0x326894;}return _0x5bed75;});}else{var _0x36a10a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x326894};var _0x32cb36=_[_0xd3a6('0x31')](_0x2b44e6);_0x32cb36[_0xd3a6('0x62')](_0x36a10a);return _0x32cb36;}});}else{return;}})[_0xd3a6('0x2b')](function(_0x20ab7b){if(_0x20ab7b)_0x2b44e6=_0x20ab7b;return _[_0xd3a6('0x42')](_0x2b44e6,[_0xd3a6('0x65'),0x1]);})[_0xd3a6('0x2b')](respondWithResult(_0x822b08,null))[_0xd3a6('0x49')](handleError(_0x822b08,null));};function hasDefaultDashboard(_0x5179da){var _0x521a01=[0x65];return new BPromise(function(_0x5ba0d4,_0x3a5287){try{if(_0x5179da[_0xd3a6('0x5a')]){_0x5ba0d4(_0x521a01);}else{return db['UserProfileResource'][_0xd3a6('0x69')]({'where':{'sectionId':_0x5179da['id']},'raw':!![]})[_0xd3a6('0x2b')](function(_0x339f68){_0x339f68?_0x5ba0d4(_0x521a01):_0x5ba0d4();});}}catch(_0x580789){_0x3a5287(_0x580789);}});}function getCustomDashboards(_0x299798){var _0xd0786b=[];return new BPromise(function(_0xe59d57,_0x2b39cb){try{if(_0x299798['autoAssociation']){return db['Dashboard'][_0xd3a6('0x58')]({'raw':!![]})[_0xd3a6('0x2b')](function(_0x1ba192){_0x1ba192['forEach'](function(_0x4d95f5){_0xd0786b[_0xd3a6('0x62')](_0x4d95f5['id']+0x1869f);});_0xe59d57(_0xd0786b);});}else{return db[_0xd3a6('0x5b')][_0xd3a6('0x58')]({'where':{'sectionId':_0x299798['id']},'raw':!![]})['then'](function(_0x3e00f8){_0x3e00f8[_0xd3a6('0x6a')](function(_0x56cfe7){_0xd0786b[_0xd3a6('0x62')](_0x56cfe7['resourceId']+0x1869f);});_0xe59d57(_0xd0786b);});}}catch(_0x22dfd9){_0x2b39cb(_0x22dfd9);}});}function getPlugins(_0xa70467){var _0x3834ba=[];return new BPromise(function(_0x3be503,_0x56b8a8){try{if(_0xa70467['autoAssociation']){return db[_0xd3a6('0x6b')][_0xd3a6('0x58')]({'raw':!![]})[_0xd3a6('0x2b')](function(_0x4d6757){_0x4d6757['forEach'](function(_0x3955ba){_0x3834ba['push'](_0x3955ba['id']+0x15b38);});_0x3be503(_0x3834ba);});}else{return db[_0xd3a6('0x5b')]['findAll']({'where':{'sectionId':_0xa70467['id']},'raw':!![]})[_0xd3a6('0x2b')](function(_0xa99728){_0xa99728[_0xd3a6('0x6a')](function(_0x1a4438){_0x3834ba[_0xd3a6('0x62')](_0x1a4438[_0xd3a6('0x6c')]+0x15b38);});_0x3be503(_0x3834ba);});}}catch(_0x1cc2e1){_0x56b8a8(_0x1cc2e1);}});}exports[_0xd3a6('0x6d')]=function(_0x2ac21a,_0x4da99b){return db['UserProfile']['find']({'where':{'id':_0x2ac21a[_0xd3a6('0x4b')]['id']}})[_0xd3a6('0x2b')](handleEntityNotFound(_0x4da99b,null))[_0xd3a6('0x2b')](function(_0x23f76d){if(_0x23f76d){return db[_0xd3a6('0x55')][_0xd3a6('0x56')](function(_0x56c795){return db[_0xd3a6('0x5f')][_0xd3a6('0x58')]({'where':{'userProfileId':_0x2ac21a['params']['id']},'attributes':['id'],'raw':!![]})[_0xd3a6('0x2b')](function(_0x280faf){if(_0x280faf){return db[_0xd3a6('0x5f')][_0xd3a6('0x2c')]({'where':{'userProfileId':_0x2ac21a[_0xd3a6('0x4b')]['id'],'id':_[_0xd3a6('0x31')](_0x280faf,function(_0x2ee349){return _0x2ee349['id'];})},'transaction':_0x56c795});}})[_0xd3a6('0x2b')](function(_0x1a820f){var _0x143de8=_['map'](_0x2ac21a[_0xd3a6('0x4f')],function(_0x4b620f){_0x4b620f[_0xd3a6('0x5d')]=_0x2ac21a['params']['id'];return _0x4b620f;});return db['UserProfileSection'][_0xd3a6('0x6e')](_0x143de8,{'raw':!![],'transaction':_0x56c795});})[_0xd3a6('0x2b')](function(_0x502076){var _0x45ae7d=_['filter'](_[_0xd3a6('0x31')](_0x502076,function(_0x15fdad){return _0x15fdad[_0xd3a6('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x45ae7d){return db[_0xd3a6('0x5f')]['findAll']({'where':{'userProfileId':_0x2ac21a[_0xd3a6('0x4b')]['id'],'sectionId':_[_0xd3a6('0x31')](_0x45ae7d,function(_0x81e094){return _0x81e094[_0xd3a6('0x5c')];})},'attributes':['id',_0xd3a6('0x5c')],'raw':!![]})['then'](function(_0x2981fd){var _0x35fd6a=_[_0xd3a6('0x31')](_0x2ac21a[_0xd3a6('0x4f')],function(_0x54f502){_0x54f502[_0xd3a6('0x5d')]=_0x2ac21a[_0xd3a6('0x4b')]['id'];return _0x54f502;});return db[_0xd3a6('0x5b')][_0xd3a6('0x6e')](_0x35fd6a,{'raw':!![],'transaction':_0x56c795});});}})[_0xd3a6('0x49')](handleError(_0x4da99b,null));});}})[_0xd3a6('0x2b')](function(_0x540163){var _0x399332=_[_0xd3a6('0x31')](_0x540163,function(_0x4e54fa){return _0x4e54fa[_0xd3a6('0x57')]({'plain':!![]});});})['then'](respondWithResult(_0x4da99b,null))[_0xd3a6('0x49')](handleError(_0x4da99b,null));};exports[_0xd3a6('0x6f')]=function(_0x58b4cb,_0x25c0db,_0xabd04a){return db[_0xd3a6('0x32')][_0xd3a6('0x4d')]({'where':{'id':_0x58b4cb[_0xd3a6('0x4b')]['id']}})[_0xd3a6('0x2b')](handleEntityNotFound(_0x25c0db,null))[_0xd3a6('0x2b')](function(_0x5ca7e4){if(_0x5ca7e4){return _0x5ca7e4[_0xd3a6('0x6f')](_0x58b4cb[_0xd3a6('0x37')][_0xd3a6('0x63')]);}})[_0xd3a6('0x2b')](respondWithStatusCode(_0x25c0db,null))[_0xd3a6('0x49')](handleError(_0x25c0db,null));};exports[_0xd3a6('0x70')]=function(_0x38a322,_0x56d152){var _0x2708b6={};if(!_0x38a322[_0xd3a6('0x37')][_0xd3a6('0x71')])throw new Error(_0xd3a6('0x72'));if(!_0x38a322[_0xd3a6('0x37')]['hasOwnProperty'](_0xd3a6('0x73'))){_0x2708b6[_0xd3a6('0x25')]=qs['limit'](_0x38a322[_0xd3a6('0x37')]['limit']);_0x2708b6[_0xd3a6('0x23')]=qs[_0xd3a6('0x23')](_0x38a322[_0xd3a6('0x37')][_0xd3a6('0x23')]);}return db[_0xd3a6('0x32')][_0xd3a6('0x4d')]({'where':{'id':_0x38a322['params']['id']}})[_0xd3a6('0x2b')](function(_0x3e7ceb){if(!_0x3e7ceb)throw new Error(_0xd3a6('0x74')+_0x38a322[_0xd3a6('0x4b')]['id']);return db[_0xd3a6('0x32')][_0xd3a6('0x70')](_0x38a322);})[_0xd3a6('0x2b')](respondWithFilteredResult(_0x56d152,_0x2708b6))[_0xd3a6('0x49')](handleError(_0x56d152,null));}; \ No newline at end of file +var _0x6ac2=['findAll','rows','catch','params','options','find','create','clone','get','omit','createdAt','updatedAt','body','transaction','each','autoAssociation','userProfileId','UserProfileSection','UserProfileResource','Resources','describe','addSections','sequelize','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','count','includeAll','include'];(function(_0x68e76f,_0x54cc6e){var _0x405413=function(_0x4eda31){while(--_0x4eda31){_0x68e76f['push'](_0x68e76f['shift']());}};_0x405413(++_0x54cc6e);}(_0x6ac2,0x184));var _0x26ac=function(_0x3cb0d3,_0x46d530){_0x3cb0d3=_0x3cb0d3-0x0;var _0xae89da=_0x6ac2[_0x3cb0d3];return _0xae89da;};'use strict';var emlformat=require(_0x26ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26ac('0x1'));var jsonpatch=require(_0x26ac('0x2'));var rp=require(_0x26ac('0x3'));var moment=require(_0x26ac('0x4'));var BPromise=require(_0x26ac('0x5'));var Mustache=require(_0x26ac('0x6'));var util=require('util');var path=require(_0x26ac('0x7'));var sox=require('sox');var csv=require(_0x26ac('0x8'));var ejs=require(_0x26ac('0x9'));var fs=require('fs');var fs_extra=require(_0x26ac('0xa'));var _=require(_0x26ac('0xb'));var squel=require(_0x26ac('0xc'));var crypto=require(_0x26ac('0xd'));var jsforce=require(_0x26ac('0xe'));var deskjs=require(_0x26ac('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x26ac('0x10'));var Redis=require(_0x26ac('0x11'));var authService=require(_0x26ac('0x12'));var qs=require(_0x26ac('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26ac('0x14'));var logger=require(_0x26ac('0x15'))(_0x26ac('0x16'));var utils=require(_0x26ac('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26ac('0x18'))['db'];config[_0x26ac('0x19')]=_[_0x26ac('0x1a')](config[_0x26ac('0x19')],{'host':_0x26ac('0x1b'),'port':0x18eb});var socket=require(_0x26ac('0x1c'))(new Redis(config[_0x26ac('0x19')]));require('./userProfile.socket')[_0x26ac('0x1d')](socket);function respondWithStatusCode(_0x3ec6e6,_0x290cc8){_0x290cc8=_0x290cc8||0xcc;return function(_0x142596){if(_0x142596){return _0x3ec6e6['sendStatus'](_0x290cc8);}return _0x3ec6e6[_0x26ac('0x1e')](_0x290cc8)[_0x26ac('0x1f')]();};}function respondWithResult(_0x4b2d19,_0x3dca1f){_0x3dca1f=_0x3dca1f||0xc8;return function(_0x3b1300){if(_0x3b1300){return _0x4b2d19[_0x26ac('0x1e')](_0x3dca1f)[_0x26ac('0x20')](_0x3b1300);}};}function respondWithFilteredResult(_0x5642b7,_0xfb304b){return function(_0xb03bbc){if(_0xb03bbc){var _0x5cd737=typeof _0xfb304b['offset']===_0x26ac('0x21')&&typeof _0xfb304b[_0x26ac('0x22')]==='undefined';var _0x754fce=_0xb03bbc['count'];var _0x54e0dd=_0x5cd737?0x0:_0xfb304b['offset'];var _0x21e456=_0x5cd737?_0xb03bbc['count']:_0xfb304b[_0x26ac('0x23')]+_0xfb304b[_0x26ac('0x22')];var _0x3c75c1;if(_0x21e456>=_0x754fce){_0x21e456=_0x754fce;_0x3c75c1=0xc8;}else{_0x3c75c1=0xce;}_0x5642b7[_0x26ac('0x1e')](_0x3c75c1);return _0x5642b7[_0x26ac('0x24')](_0x26ac('0x25'),_0x54e0dd+'-'+_0x21e456+'/'+_0x754fce)[_0x26ac('0x20')](_0xb03bbc);}return null;};}function patchUpdates(_0x147721){return function(_0x27765e){try{jsonpatch['apply'](_0x27765e,_0x147721,!![]);}catch(_0x43bce8){return BPromise[_0x26ac('0x26')](_0x43bce8);}return _0x27765e[_0x26ac('0x27')]();};}function saveUpdates(_0x1885f7,_0x346001){return function(_0x268200){if(_0x268200){return _0x268200[_0x26ac('0x28')](_0x1885f7)[_0x26ac('0x29')](function(_0x4172c2){return _0x4172c2;});}return null;};}function removeEntity(_0x2a5ceb,_0x4f752c){return function(_0x4cb76e){if(_0x4cb76e){return _0x4cb76e[_0x26ac('0x2a')]()['then'](function(){_0x2a5ceb[_0x26ac('0x1e')](0xcc)[_0x26ac('0x1f')]();});}};}function handleEntityNotFound(_0xb09d8d,_0x591949){return function(_0x31cb17){if(!_0x31cb17){_0xb09d8d[_0x26ac('0x2b')](0x194);}return _0x31cb17;};}function handleError(_0x53b73f,_0x4d75e2){_0x4d75e2=_0x4d75e2||0x1f4;return function(_0x15bad7){logger[_0x26ac('0x2c')](_0x15bad7[_0x26ac('0x2d')]);if(_0x15bad7['name']){delete _0x15bad7['name'];}_0x53b73f[_0x26ac('0x1e')](_0x4d75e2)[_0x26ac('0x2e')](_0x15bad7);};}exports[_0x26ac('0x2f')]=function(_0x325818,_0x47b7c8){var _0x5e1cbc={},_0x3ea2f0={},_0x3e2148={'count':0x0,'rows':[]};var _0x17691a=_[_0x26ac('0x30')](db[_0x26ac('0x31')][_0x26ac('0x32')],function(_0x58ec04){return{'name':_0x58ec04[_0x26ac('0x33')],'type':_0x58ec04[_0x26ac('0x34')][_0x26ac('0x35')]};});_0x3ea2f0['model']=_[_0x26ac('0x30')](_0x17691a,_0x26ac('0x36'));_0x3ea2f0['query']=_[_0x26ac('0x37')](_0x325818[_0x26ac('0x38')]);_0x3ea2f0[_0x26ac('0x39')]=_[_0x26ac('0x3a')](_0x3ea2f0[_0x26ac('0x3b')],_0x3ea2f0[_0x26ac('0x38')]);_0x5e1cbc[_0x26ac('0x3c')]=_[_0x26ac('0x3a')](_0x3ea2f0[_0x26ac('0x3b')],qs[_0x26ac('0x3d')](_0x325818[_0x26ac('0x38')][_0x26ac('0x3d')]));_0x5e1cbc['attributes']=_0x5e1cbc[_0x26ac('0x3c')][_0x26ac('0x3e')]?_0x5e1cbc[_0x26ac('0x3c')]:_0x3ea2f0['model'];if(!_0x325818[_0x26ac('0x38')]['hasOwnProperty'](_0x26ac('0x3f'))){_0x5e1cbc[_0x26ac('0x22')]=qs['limit'](_0x325818[_0x26ac('0x38')][_0x26ac('0x22')]);_0x5e1cbc[_0x26ac('0x23')]=qs[_0x26ac('0x23')](_0x325818[_0x26ac('0x38')][_0x26ac('0x23')]);}_0x5e1cbc['order']=qs[_0x26ac('0x40')](_0x325818['query'][_0x26ac('0x40')]);_0x5e1cbc['where']=qs[_0x26ac('0x39')](_['pick'](_0x325818['query'],_0x3ea2f0[_0x26ac('0x39')]),_0x17691a);if(_0x325818[_0x26ac('0x38')][_0x26ac('0x41')]){_0x5e1cbc[_0x26ac('0x42')]=_[_0x26ac('0x43')](_0x5e1cbc[_0x26ac('0x42')],{'$or':_['map'](_0x17691a,function(_0x5c89bb){if(_0x5c89bb[_0x26ac('0x34')]!==_0x26ac('0x44')){var _0x2aafa5={};_0x2aafa5[_0x5c89bb['name']]={'$like':'%'+_0x325818['query'][_0x26ac('0x41')]+'%'};return _0x2aafa5;}})});}_0x5e1cbc=_[_0x26ac('0x43')]({},_0x5e1cbc,_0x325818['options']);var _0x5ae9fe={'where':_0x5e1cbc[_0x26ac('0x42')]};return db[_0x26ac('0x31')][_0x26ac('0x45')](_0x5ae9fe)['then'](function(_0x485258){_0x3e2148['count']=_0x485258;if(_0x325818['query'][_0x26ac('0x46')]){_0x5e1cbc[_0x26ac('0x47')]=[{'all':!![]}];}return db[_0x26ac('0x31')][_0x26ac('0x48')](_0x5e1cbc);})[_0x26ac('0x29')](function(_0x13b2af){_0x3e2148[_0x26ac('0x49')]=_0x13b2af;return _0x3e2148;})[_0x26ac('0x29')](respondWithFilteredResult(_0x47b7c8,_0x5e1cbc))[_0x26ac('0x4a')](handleError(_0x47b7c8,null));};exports['show']=function(_0x26a3b3,_0xc6aeb3){var _0xfb928b={'raw':![],'where':{'id':_0x26a3b3[_0x26ac('0x4b')]['id']}},_0x36f95f={};_0x36f95f[_0x26ac('0x3b')]=_[_0x26ac('0x37')](db[_0x26ac('0x31')][_0x26ac('0x32')]);_0x36f95f[_0x26ac('0x38')]=_[_0x26ac('0x37')](_0x26a3b3[_0x26ac('0x38')]);_0x36f95f[_0x26ac('0x39')]=_[_0x26ac('0x3a')](_0x36f95f['model'],_0x36f95f[_0x26ac('0x38')]);_0xfb928b[_0x26ac('0x3c')]=_[_0x26ac('0x3a')](_0x36f95f['model'],qs[_0x26ac('0x3d')](_0x26a3b3[_0x26ac('0x38')][_0x26ac('0x3d')]));_0xfb928b[_0x26ac('0x3c')]=_0xfb928b[_0x26ac('0x3c')][_0x26ac('0x3e')]?_0xfb928b['attributes']:_0x36f95f['model'];if(_0x26a3b3[_0x26ac('0x38')][_0x26ac('0x46')]){_0xfb928b[_0x26ac('0x47')]=[{'all':!![]}];}_0xfb928b=_[_0x26ac('0x43')]({},_0xfb928b,_0x26a3b3[_0x26ac('0x4c')]);return db[_0x26ac('0x31')][_0x26ac('0x4d')](_0xfb928b)[_0x26ac('0x29')](handleEntityNotFound(_0xc6aeb3,null))[_0x26ac('0x29')](respondWithResult(_0xc6aeb3,null))[_0x26ac('0x4a')](handleError(_0xc6aeb3,null));};exports['create']=function(_0x547ff1,_0x324a5f){return db[_0x26ac('0x31')][_0x26ac('0x4e')](_0x547ff1['body'],{})[_0x26ac('0x29')](respondWithResult(_0x324a5f,0xc9))[_0x26ac('0x4a')](handleError(_0x324a5f,null));};exports[_0x26ac('0x4f')]=function(_0x3cec09,_0x5d27b){var _0x3e8c97={'where':{'id':_0x3cec09[_0x26ac('0x4b')]['id']}},_0x1a9f0d={};_0x1a9f0d[_0x26ac('0x3b')]=_[_0x26ac('0x37')](db[_0x26ac('0x31')][_0x26ac('0x32')]);_0x3e8c97[_0x26ac('0x3c')]=_[_0x26ac('0x3a')](_0x1a9f0d['model'],qs['fields'](_0x3cec09[_0x26ac('0x38')][_0x26ac('0x3d')]));_0x3e8c97[_0x26ac('0x3c')]=_0x3e8c97['attributes'][_0x26ac('0x3e')]?_0x3e8c97[_0x26ac('0x3c')]:_0x1a9f0d[_0x26ac('0x3b')];if(_0x3cec09[_0x26ac('0x38')][_0x26ac('0x46')]){_0x3e8c97[_0x26ac('0x47')]=[{'all':!![]}];}_0x3e8c97=_[_0x26ac('0x43')]({},_0x3e8c97,_0x3cec09[_0x26ac('0x4c')]);return db[_0x26ac('0x31')][_0x26ac('0x4d')](_0x3e8c97)[_0x26ac('0x29')](handleEntityNotFound(_0x5d27b,null))[_0x26ac('0x29')](function(_0xe67cf1){if(_0xe67cf1){var _0x438e34=_0xe67cf1[_0x26ac('0x50')]({'plain':!![]});_0x438e34=qs[_0x26ac('0x51')](_0x438e34,['id',_0x26ac('0x52'),_0x26ac('0x53'),'crudPermissions']);_0x3cec09['body']=_[_0x26ac('0x51')](_0x3cec09[_0x26ac('0x54')],['id',_0x26ac('0x52'),_0x26ac('0x53')]);return db['sequelize'][_0x26ac('0x55')](function(_0x547a28){return db[_0x26ac('0x31')]['create'](_[_0x26ac('0x43')](_0x438e34,_0x3cec09[_0x26ac('0x54')]),{'include':_0x3cec09['query'][_0x26ac('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x547a28})['then'](function(_0x319418){var _0x3a16bc=_0x319418[_0x26ac('0x50')]({'plain':!![]});return db['UserProfileSection'][_0x26ac('0x48')]({'where':{'userProfileId':_0x3cec09[_0x26ac('0x4b')]['id']},'raw':!![]})[_0x26ac('0x29')](function(_0x4b4524){if(_0x4b4524){return BPromise[_0x26ac('0x56')](_0x4b4524,function(_0x51dbd0){return new BPromise(function(_0x472a89,_0x305dc4){if(_0x51dbd0['autoAssociation']===null||_0x51dbd0[_0x26ac('0x57')]===0x1)_0x472a89(null);return db['UserProfileResource'][_0x26ac('0x48')]({'where':{'sectionId':_0x51dbd0['id']},'raw':!![]})['then'](function(_0x25e314){var _0x56502c=_[_0x26ac('0x30')](_0x25e314,function(_0x5c8fbf){return qs[_0x26ac('0x51')](_0x5c8fbf,['id','createdAt',_0x26ac('0x53'),'sectionId']);});_0x472a89(_0x56502c);})[_0x26ac('0x4a')](function(_0x4f56f4){_0x305dc4(_0x4f56f4);});})[_0x26ac('0x29')](function(_0x322c03){var _0x812058=qs[_0x26ac('0x51')](_0x51dbd0,['id','createdAt',_0x26ac('0x53')]);_0x812058[_0x26ac('0x58')]=_0x3a16bc['id'];if(_0x322c03)_0x812058['Resources']=_0x322c03;return _0x812058;})['then'](function(_0x5900f1){return db[_0x26ac('0x59')][_0x26ac('0x4e')](_0x5900f1,{'include':[{'model':db[_0x26ac('0x5a')],'as':_0x26ac('0x5b')}],'raw':!![],'transaction':_0x547a28});});})[_0x26ac('0x29')](function(){return _0x3a16bc;});}});});});}})[_0x26ac('0x29')](respondWithResult(_0x5d27b,0xc9))['catch'](handleError(_0x5d27b,null));};exports[_0x26ac('0x28')]=function(_0x58a7ee,_0x5dd26c){if(_0x58a7ee['body']['id']){delete _0x58a7ee[_0x26ac('0x54')]['id'];}return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x58a7ee[_0x26ac('0x4b')]['id']}})[_0x26ac('0x29')](handleEntityNotFound(_0x5dd26c,null))[_0x26ac('0x29')](saveUpdates(_0x58a7ee[_0x26ac('0x54')],null))[_0x26ac('0x29')](respondWithResult(_0x5dd26c,null))[_0x26ac('0x4a')](handleError(_0x5dd26c,null));};exports[_0x26ac('0x2a')]=function(_0x5d76d2,_0x4d46ce){return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x5d76d2['params']['id']}})[_0x26ac('0x29')](handleEntityNotFound(_0x4d46ce,null))[_0x26ac('0x29')](removeEntity(_0x4d46ce,null))[_0x26ac('0x4a')](handleError(_0x4d46ce,null));};exports[_0x26ac('0x5c')]=function(_0x5ccc0c,_0x3d7718){return db[_0x26ac('0x31')][_0x26ac('0x5c')]()[_0x26ac('0x29')](respondWithResult(_0x3d7718,null))[_0x26ac('0x4a')](handleError(_0x3d7718,null));};exports[_0x26ac('0x5d')]=function(_0x1d6262,_0x384f03){var _0x436506=_0x1d6262[_0x26ac('0x54')];return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x1d6262['params']['id']}})[_0x26ac('0x29')](handleEntityNotFound(_0x384f03,null))[_0x26ac('0x29')](function(_0x56759d){if(_0x56759d){return db[_0x26ac('0x5e')][_0x26ac('0x55')](function(_0x440691){return db[_0x26ac('0x59')][_0x26ac('0x2a')]({'where':{'userProfileId':_0x1d6262[_0x26ac('0x4b')]['id'],'sectionId':_[_0x26ac('0x30')](_0x436506,function(_0x562cbe){return _0x562cbe[_0x26ac('0x5f')];})},'transaction':_0x440691})[_0x26ac('0x29')](function(){var _0x10f786=_[_0x26ac('0x30')](_0x436506,function(_0x497793){_0x497793[_0x26ac('0x58')]=_0x1d6262[_0x26ac('0x4b')]['id'];return _0x497793;});var _0x23d916=[];return BPromise['each'](_0x10f786,function(_0x20fcde){return db[_0x26ac('0x59')][_0x26ac('0x4e')](_0x20fcde,{'include':[{'model':db[_0x26ac('0x5a')],'as':_0x26ac('0x5b')}],'raw':!![],'transaction':_0x440691})[_0x26ac('0x29')](function(_0x48f5c0){_0x23d916[_0x26ac('0x60')](_0x48f5c0[_0x26ac('0x50')]({'plain':!![]}));});})[_0x26ac('0x29')](function(){return _0x23d916;});});});}})[_0x26ac('0x29')](function(_0x28ff63){return _0x28ff63;})[_0x26ac('0x29')](respondWithResult(_0x384f03,null))[_0x26ac('0x4a')](handleError(_0x384f03,null));};exports[_0x26ac('0x61')]=function(_0x1a727a,_0x168d75){var _0x417cf8;return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x1a727a['params']['id']},'attributes':['id','name']})[_0x26ac('0x29')](handleEntityNotFound(_0x168d75,null))[_0x26ac('0x29')](function(_0x597259){if(_0x597259){_0x417cf8=_0x597259;return db[_0x26ac('0x59')][_0x26ac('0x2a')]({'where':{'userProfileId':_0x1a727a[_0x26ac('0x4b')]['id'],'sectionId':_0x1a727a[_0x26ac('0x38')][_0x26ac('0x62')]}});}})[_0x26ac('0x29')](function(){return _0x417cf8;})[_0x26ac('0x29')](respondWithStatusCode(_0x168d75,null))[_0x26ac('0x4a')](handleError(_0x168d75,null));};exports[_0x26ac('0x63')]=function(_0x467ea3,_0x5d917c){var _0x502d48=[];var _0x4e0eba=[];return db[_0x26ac('0x59')][_0x26ac('0x48')]({'where':{'userProfileId':_0x467ea3[_0x26ac('0x4b')]['id']},'raw':!![]})[_0x26ac('0x29')](function(_0x3901f5){_0x502d48=_['filter'](_0x3901f5,function(_0x26efef){return _0x26efef[_0x26ac('0x64')]===0x1||_[_0x26ac('0x65')]([0x3eb,0x709],_0x26efef[_0x26ac('0x5f')]);});if(!_[_0x26ac('0x66')](_0x502d48)){return _[_0x26ac('0x30')](_0x502d48,function(_0x220b5f){return _0x220b5f[_0x26ac('0x5f')];});}else{return;}})[_0x26ac('0x29')](function(_0x4a8eb7){if(_0x4a8eb7)_0x4e0eba=_0x4a8eb7;if(_['includes'](_0x4e0eba,0x64)){var _0x4d2f09=_['find'](_0x502d48,{'sectionId':0x64});return hasDefaultDashboard(_0x4d2f09)[_0x26ac('0x29')](function(_0x1c9cb3){return _[_0x26ac('0x30')](_0x502d48,function(_0x125186){if(_0x125186[_0x26ac('0x5f')]===0x64){_0x125186['subsections']=_0x1c9cb3;}return _0x125186;});});}else{return;}})['then'](function(_0x3ccc10){if(_0x3ccc10)_0x502d48=_0x3ccc10;if(_[_0x26ac('0x65')](_0x4e0eba,0x3eb)){var _0x42a693=_[_0x26ac('0x4d')](_0x502d48,{'sectionId':0x3eb});return getCustomDashboards(_0x42a693)[_0x26ac('0x29')](function(_0x548ddf){return _[_0x26ac('0x30')](_0x502d48,function(_0xa54913){if(_0x42a693[_0x26ac('0x64')]){if(_0xa54913['sectionId']===0x3eb){_0xa54913[_0x26ac('0x67')]=_0x548ddf;}}else{if(_0xa54913[_0x26ac('0x5f')]===0x64){_0xa54913[_0x26ac('0x67')]=_0x548ddf;}}return _0xa54913;});});}else{return;}})[_0x26ac('0x29')](function(_0x65ebfd){if(_0x65ebfd)_0x502d48=_0x65ebfd;if(_[_0x26ac('0x65')](_0x4e0eba,0x709)){var _0x116ef1=_[_0x26ac('0x4d')](_0x502d48,{'sectionId':0x709});return getPlugins(_0x116ef1)[_0x26ac('0x29')](function(_0x51ec8c){if(_0x116ef1[_0x26ac('0x64')]){return _[_0x26ac('0x30')](_0x502d48,function(_0x4cd62b){if(_0x4cd62b[_0x26ac('0x5f')]===0x709){_0x4cd62b[_0x26ac('0x67')]=_0x51ec8c;}return _0x4cd62b;});}else{var _0x451185={'sectionId':0x76c,'enabled':0x1,'subsections':_0x51ec8c};var _0x309efa=_[_0x26ac('0x30')](_0x502d48);_0x309efa[_0x26ac('0x60')](_0x451185);return _0x309efa;}});}else{return;}})[_0x26ac('0x29')](function(_0x276ad0){if(_0x276ad0)_0x502d48=_0x276ad0;return _[_0x26ac('0x41')](_0x502d48,['enabled',0x1]);})['then'](respondWithResult(_0x5d917c,null))[_0x26ac('0x4a')](handleError(_0x5d917c,null));};function hasDefaultDashboard(_0x8f0e7d){var _0x41339d=[0x65];return new BPromise(function(_0x2a5f33,_0x495568){try{if(_0x8f0e7d['autoAssociation']){_0x2a5f33(_0x41339d);}else{return db[_0x26ac('0x5a')]['findOne']({'where':{'sectionId':_0x8f0e7d['id']},'raw':!![]})['then'](function(_0x5d7a48){_0x5d7a48?_0x2a5f33(_0x41339d):_0x2a5f33();});}}catch(_0x353e10){_0x495568(_0x353e10);}});}function getCustomDashboards(_0x1fa9b3){var _0x338ac1=[];return new BPromise(function(_0x2a3a46,_0x328710){try{if(_0x1fa9b3[_0x26ac('0x57')]){return db['Dashboard'][_0x26ac('0x48')]({'raw':!![]})['then'](function(_0x2ea336){_0x2ea336['forEach'](function(_0x5e3fbc){_0x338ac1[_0x26ac('0x60')](_0x5e3fbc['id']+0x1869f);});_0x2a3a46(_0x338ac1);});}else{return db[_0x26ac('0x5a')]['findAll']({'where':{'sectionId':_0x1fa9b3['id']},'raw':!![]})[_0x26ac('0x29')](function(_0x20f736){_0x20f736[_0x26ac('0x68')](function(_0x3ba1cc){_0x338ac1[_0x26ac('0x60')](_0x3ba1cc['resourceId']+0x1869f);});_0x2a3a46(_0x338ac1);});}}catch(_0x29684c){_0x328710(_0x29684c);}});}function getPlugins(_0x41144b){var _0x4d0c98=[];return new BPromise(function(_0x2c1239,_0x4bb7a9){try{if(_0x41144b[_0x26ac('0x57')]){return db[_0x26ac('0x69')]['findAll']({'raw':!![]})['then'](function(_0xc9296){_0xc9296['forEach'](function(_0x3dc1f4){_0x4d0c98[_0x26ac('0x60')](_0x3dc1f4['id']+0x15b38);});_0x2c1239(_0x4d0c98);});}else{return db[_0x26ac('0x5a')][_0x26ac('0x48')]({'where':{'sectionId':_0x41144b['id']},'raw':!![]})[_0x26ac('0x29')](function(_0x4e5918){_0x4e5918['forEach'](function(_0x594e79){_0x4d0c98[_0x26ac('0x60')](_0x594e79[_0x26ac('0x6a')]+0x15b38);});_0x2c1239(_0x4d0c98);});}}catch(_0x1538ec){_0x4bb7a9(_0x1538ec);}});}exports[_0x26ac('0x6b')]=function(_0x3309c0,_0x37c8e8){return db[_0x26ac('0x31')]['find']({'where':{'id':_0x3309c0[_0x26ac('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37c8e8,null))['then'](function(_0x3aff3a){if(_0x3aff3a){return db[_0x26ac('0x5e')][_0x26ac('0x55')](function(_0x2d26c3){return db[_0x26ac('0x59')][_0x26ac('0x48')]({'where':{'userProfileId':_0x3309c0[_0x26ac('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x26ac('0x29')](function(_0x1acc6a){if(_0x1acc6a){return db['UserProfileSection'][_0x26ac('0x2a')]({'where':{'userProfileId':_0x3309c0['params']['id'],'id':_[_0x26ac('0x30')](_0x1acc6a,function(_0x33c8f6){return _0x33c8f6['id'];})},'transaction':_0x2d26c3});}})[_0x26ac('0x29')](function(_0x2c06ef){var _0x1e9e74=_[_0x26ac('0x30')](_0x3309c0['body'],function(_0x2f1ecc){_0x2f1ecc['userProfileId']=_0x3309c0[_0x26ac('0x4b')]['id'];return _0x2f1ecc;});return db[_0x26ac('0x59')]['bulkCreate'](_0x1e9e74,{'raw':!![],'transaction':_0x2d26c3});})[_0x26ac('0x29')](function(_0x399ab4){var _0x2bdc08=_['filter'](_[_0x26ac('0x30')](_0x399ab4,function(_0x415559){return _0x415559[_0x26ac('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x2bdc08){return db[_0x26ac('0x59')][_0x26ac('0x48')]({'where':{'userProfileId':_0x3309c0[_0x26ac('0x4b')]['id'],'sectionId':_[_0x26ac('0x30')](_0x2bdc08,function(_0x382da4){return _0x382da4[_0x26ac('0x5f')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x26ac('0x29')](function(_0x317caf){var _0x1f0890=_['map'](_0x3309c0['body'],function(_0x32d4ae){_0x32d4ae[_0x26ac('0x58')]=_0x3309c0[_0x26ac('0x4b')]['id'];return _0x32d4ae;});return db[_0x26ac('0x5a')][_0x26ac('0x6c')](_0x1f0890,{'raw':!![],'transaction':_0x2d26c3});});}})[_0x26ac('0x4a')](handleError(_0x37c8e8,null));});}})[_0x26ac('0x29')](function(_0x3f3ec){var _0x497760=_[_0x26ac('0x30')](_0x3f3ec,function(_0x240b94){return _0x240b94[_0x26ac('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x37c8e8,null))[_0x26ac('0x4a')](handleError(_0x37c8e8,null));};exports[_0x26ac('0x6d')]=function(_0x49d6f3,_0x4d3028,_0x220ac0){return db[_0x26ac('0x31')][_0x26ac('0x4d')]({'where':{'id':_0x49d6f3['params']['id']}})['then'](handleEntityNotFound(_0x4d3028,null))[_0x26ac('0x29')](function(_0x4f6a59){if(_0x4f6a59){return _0x4f6a59[_0x26ac('0x6d')](_0x49d6f3[_0x26ac('0x38')][_0x26ac('0x62')]);}})[_0x26ac('0x29')](respondWithStatusCode(_0x4d3028,null))['catch'](handleError(_0x4d3028,null));};exports[_0x26ac('0x6e')]=function(_0x5f13d6,_0x240b3a){var _0x30a0d3={};if(!_0x5f13d6[_0x26ac('0x38')][_0x26ac('0x6f')])throw new Error(_0x26ac('0x70'));if(!_0x5f13d6[_0x26ac('0x38')][_0x26ac('0x71')](_0x26ac('0x3f'))){_0x30a0d3[_0x26ac('0x22')]=qs[_0x26ac('0x22')](_0x5f13d6['query'][_0x26ac('0x22')]);_0x30a0d3[_0x26ac('0x23')]=qs['offset'](_0x5f13d6['query']['offset']);}return db[_0x26ac('0x31')]['find']({'where':{'id':_0x5f13d6[_0x26ac('0x4b')]['id']}})[_0x26ac('0x29')](function(_0x47c8d9){if(!_0x47c8d9)throw new Error(_0x26ac('0x72')+_0x5f13d6[_0x26ac('0x4b')]['id']);return db['UserProfile']['getResources'](_0x5f13d6);})[_0x26ac('0x29')](respondWithFilteredResult(_0x240b3a,_0x30a0d3))[_0x26ac('0x4a')](handleError(_0x240b3a,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 3fa3392..1e35b50 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 _0x8921=['exports','events','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x57bf45,_0x57d6fd){var _0x565dfa=function(_0x45394a){while(--_0x45394a){_0x57bf45['push'](_0x57bf45['shift']());}};_0x565dfa(++_0x57d6fd);}(_0x8921,0x9a));var _0x1892=function(_0x3b0cdd,_0x43197e){_0x3b0cdd=_0x3b0cdd-0x0;var _0x505bcd=_0x8921[_0x3b0cdd];return _0x505bcd;};'use strict';var EventEmitter=require(_0x1892('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x1892('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1892('0x2')](0x0);var events={'afterCreate':_0x1892('0x3'),'afterUpdate':_0x1892('0x4'),'afterDestroy':_0x1892('0x5')};function emitEvent(_0x110b75){return function(_0x28a89b,_0x15aa1b,_0x2790a1){UserProfileEvents[_0x1892('0x6')](_0x110b75+':'+_0x28a89b['id'],_0x28a89b);UserProfileEvents[_0x1892('0x6')](_0x110b75,_0x28a89b);_0x2790a1(null);};}for(var e in events){if(events[_0x1892('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1892('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x7a12=['hasOwnProperty','hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x2a1e2d,_0x195473){var _0x32b8cc=function(_0x57582d){while(--_0x57582d){_0x2a1e2d['push'](_0x2a1e2d['shift']());}};_0x32b8cc(++_0x195473);}(_0x7a12,0xe8));var _0x27a1=function(_0x1cade2,_0x2982b8){_0x1cade2=_0x1cade2-0x0;var _0x30f248=_0x7a12[_0x1cade2];return _0x30f248;};'use strict';var EventEmitter=require(_0x27a1('0x0'));var UserProfile=require(_0x27a1('0x1'))['db'][_0x27a1('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x27a1('0x3')](0x0);var events={'afterCreate':_0x27a1('0x4'),'afterUpdate':_0x27a1('0x5'),'afterDestroy':_0x27a1('0x6')};function emitEvent(_0x3f44b6){return function(_0x516239,_0x8b00f8,_0x3872af){UserProfileEvents[_0x27a1('0x7')](_0x3f44b6+':'+_0x516239['id'],_0x516239);UserProfileEvents[_0x27a1('0x7')](_0x3f44b6,_0x516239);_0x3872af(null);};}for(var e in events){if(events[_0x27a1('0x8')](e)){var event=events[e];UserProfile[_0x27a1('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9b570f1..e748bed 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 _0x4c60=['rows','count','CmContact','tag','ThroughTags','color','openTabs','chat','dataValues','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','filter','field','value','findAll','then','model','associatedResources','map','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','contacts','Lists','ListId','lists','CmList','companies','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','VoiceQueues','queue','VoiceQueue','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','smsqueues','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','user','Telephones','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','Tag','templates','Template','triggers','Trigger','trunks','plugins','Plugin','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','sequelize','query','UserProfile','user_profiles','section','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','ignore','isEmpty','union','length','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','key','foreignKey','forEach','merge','includeAll','include','default','DefaultReports','custom','CustomReports'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x4c60,0xc1));var _0x04c6=function(_0x23a16a,_0x12b597){_0x23a16a=_0x23a16a-0x0;var _0x333a19=_0x4c60[_0x23a16a];return _0x333a19;};'use strict';var _=require(_0x04c6('0x0'));var attributes=require(_0x04c6('0x1'));var qs=require(_0x04c6('0x2'));var squel=require(_0x04c6('0x3'));module['exports']=function(_0x2a1d36){var _0x5d9fa3=_0x2a1d36['models'];function _0x4ad4f1(_0x53ca7a,_0x3a9493){return new Promise(function(_0xc6e772,_0x2054da){if(!_0x3a9493)return _0xc6e772(null);var _0x12bd5d=_0x3a9493[_0x04c6('0x4')]?{[_0x3a9493[_0x04c6('0x4')][_0x04c6('0x5')]]:_0x3a9493['filter'][_0x04c6('0x6')]}:undefined;return _0x5d9fa3[_0x53ca7a][_0x04c6('0x7')]({'where':_0x12bd5d,'raw':!![]})[_0x04c6('0x8')](function(_0x30b901){_0x3a9493['associatedResources']=_['map'](_0x30b901,'id');_0xc6e772(_0x3a9493);})['catch'](function(_0x376da8){_0x2054da(_0x376da8);});});}function _0x5584cd(_0x15d31a,_0x2772fa){return new Promise(function(_0x5236c8,_0x4316f8){var _0x19eb01=_0x15d31a[_0x04c6('0x4')]?{[_0x15d31a[_0x04c6('0x4')]['field']]:_0x15d31a[_0x04c6('0x4')][_0x04c6('0x6')]}:undefined;return _0x5d9fa3[_0x15d31a[_0x04c6('0x9')]]['findAll']({'where':_0x19eb01,'raw':!![]})[_0x04c6('0x8')](function(_0x15cbe0){_0x2772fa[_0x04c6('0xa')]=_[_0x04c6('0xb')](_0x15cbe0,function(_0x4760f8){return _0x4760f8[_0x04c6('0xc')];});_0x5236c8(_0x2772fa);})[_0x04c6('0xd')](function(_0x3d46a9){_0x4316f8(_0x3d46a9);});});}function _0x5a5a66(_0x31edf9,_0xa2bc92,_0x382e58){if(!_0xa2bc92)return Promise[_0x04c6('0xe')](null);return new Promise(function(_0x43596a,_0xfb4db5){return _0x5d9fa3[_0x04c6('0xf')][_0x04c6('0x7')]({'where':{'sectionId':_0xa2bc92['id']},'raw':!![]})['then'](function(_0x142065){if(_0x31edf9[_0x04c6('0x5')]&&_0x31edf9[_0x04c6('0x5')]!=='id'){_0xa2bc92['associatedResources']=_['map'](_0x142065,function(_0x53ac86){return _0x53ac86[_0x31edf9[_0x04c6('0x5')]];});}else{if(_0x382e58===_0x04c6('0x10')){_0xa2bc92['associatedResources']=_['map'](_0x142065,function(_0x1e6854){return{'id':_0x1e6854[_0x04c6('0x11')],'type':_0x1e6854[_0x04c6('0x12')]};});}else{_0xa2bc92['associatedResources']=_[_0x04c6('0xb')](_0x142065,function(_0x13f2dc){return _0x13f2dc[_0x04c6('0x11')];});}}_0x43596a(_0xa2bc92);})['catch'](function(_0x2d3277){_0xfb4db5(_0x2d3277);});});}function _0x41e29f(_0x562491,_0x54a8b0){var _0x4c8d72={'parentSections':[]};switch(_0x562491[_0x04c6('0x13')]()){case _0x04c6('0x14'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x16');break;case _0x04c6('0x17'):_0x4c8d72['childModel']='SquareOdbc';break;case _0x04c6('0x18'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x19');_0x4c8d72[_0x04c6('0x1a')]=[{'name':_0x04c6('0x1b'),'field':_0x04c6('0xc'),'foreignKey':'projectName'}];break;case _0x04c6('0x1c'):_0x4c8d72[_0x04c6('0x15')]='JscriptyProject';break;case _0x04c6('0x1d'):_0x4c8d72[_0x04c6('0x15')]='CmContact';_0x4c8d72['parentSections']=[{'name':_0x04c6('0x1e'),'field':'id','foreignKey':_0x04c6('0x1f')}];break;case _0x04c6('0x20'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x21');break;case _0x04c6('0x22'):_0x4c8d72['childModel']='CmCompany';break;case'globalcustomfields':_0x4c8d72[_0x04c6('0x15')]='CmCustomField';break;case _0x04c6('0x23'):_0x4c8d72[_0x04c6('0x15')]='ChatQueue';break;case _0x04c6('0x24'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x25');break;case _0x04c6('0x26'):_0x4c8d72['childModel']=_0x04c6('0x27');break;case _0x04c6('0x28'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x29');break;case _0x04c6('0x2a'):case _0x04c6('0x2b'):case _0x04c6('0x2c'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x2d');break;case _0x04c6('0x2e'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x2f');break;case _0x04c6('0x30'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x31');break;case'voicerecordings':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x32');_0x4c8d72[_0x04c6('0x1a')]=[{'name':_0x04c6('0x33'),'field':'name','foreignKey':_0x04c6('0x34'),'model':_0x04c6('0x35'),'filter':{'field':'role','value':['agent']}},{'name':'Telephones','field':_0x04c6('0xc'),'foreignKey':_0x04c6('0x34'),'model':'User','filter':{'field':_0x04c6('0x36'),'value':['telephone']}},{'name':_0x04c6('0x37'),'field':_0x04c6('0xc'),'foreignKey':_0x04c6('0x38'),'model':_0x04c6('0x39'),'filter':{'field':'type','value':['inbound']}},{'name':_0x04c6('0x3a'),'field':_0x04c6('0xc'),'foreignKey':'queue','model':_0x04c6('0x39'),'filter':{'field':'type','value':['outbound']}}];break;case _0x04c6('0x3b'):_0x4c8d72['childModel']=_0x04c6('0x3c');break;case _0x04c6('0x3d'):_0x4c8d72['childModel']=_0x04c6('0x3e');break;case'voiceprefixes':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x3f');break;case _0x04c6('0x40'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x41');break;case'mailqueues':_0x4c8d72[_0x04c6('0x15')]='MailQueue';break;case _0x04c6('0x42'):_0x4c8d72['childModel']=_0x04c6('0x43');break;case _0x04c6('0x44'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x45');break;case _0x04c6('0x46'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x47');break;case'openchannelaccounts':_0x4c8d72[_0x04c6('0x15')]='OpenchannelAccount';break;case _0x04c6('0x48'):_0x4c8d72['childModel']='SmsQueue';break;case _0x04c6('0x49'):_0x4c8d72['childModel']=_0x04c6('0x4a');break;case _0x04c6('0x4b'):_0x4c8d72[_0x04c6('0x15')]='WhatsappQueue';break;case _0x04c6('0x4c'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x4d');break;case _0x04c6('0x4e'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x4f');break;case _0x04c6('0x50'):case'queuecampaigns':_0x4c8d72['childModel']=_0x04c6('0x39');if(_0x54a8b0){_0x4c8d72[_0x04c6('0x1a')]=[{'name':_0x04c6('0x37')},{'name':'QueueCampaigns'}];}break;case _0x04c6('0x51'):case _0x04c6('0x52'):case _0x04c6('0x53'):_0x4c8d72['childModel']='User';if(_0x54a8b0){_0x4c8d72['parentSections']=[{'name':_0x04c6('0x54'),'filter':{'field':_0x04c6('0x36'),'value':['admin',_0x04c6('0x55')]},'ignore':!![]},{'name':_0x04c6('0x33')},{'name':_0x04c6('0x56')}];}break;case'zendeskaccounts':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x57');break;case'salesforceaccounts':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x58');break;case _0x04c6('0x59'):_0x4c8d72[_0x04c6('0x15')]='FreshdeskAccount';break;case _0x04c6('0x5a'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x5b');break;case _0x04c6('0x5c'):_0x4c8d72['childModel']=_0x04c6('0x5d');break;case _0x04c6('0x5e'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x5f');break;case'vtigeraccounts':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x35');break;case _0x04c6('0x60'):_0x4c8d72['childModel']=_0x04c6('0x61');break;case _0x04c6('0x62'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x63');break;case _0x04c6('0x64'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x65');break;case _0x04c6('0x66'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x67');break;case _0x04c6('0x68'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x69');break;case'scheduler':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x6a');break;case _0x04c6('0x6b'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x6c');break;case'tags':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x6d');break;case _0x04c6('0x6e'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x6f');break;case _0x04c6('0x70'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x71');break;case _0x04c6('0x72'):_0x4c8d72[_0x04c6('0x15')]='Trunk';break;case'variables':_0x4c8d72['childModel']='Variable';break;case _0x04c6('0x73'):_0x4c8d72['childModel']=_0x04c6('0x74');break;case'extractedreports':_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x10');_0x4c8d72['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x04c6('0x75')}];break;case _0x04c6('0x76'):_0x4c8d72[_0x04c6('0x15')]=_0x04c6('0x77');break;}return _0x4c8d72;}function _0x583b3c(_0x2fb324,_0xf4e9d6){var _0x216cb0=_0x2fb324[_0x04c6('0x78')](0x0)[_0x04c6('0x79')]()+_0x2fb324[_0x04c6('0x7a')](0x1);var _0x145854={'type':_0x5d9fa3['Sequelize'][_0x04c6('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x4336a3,_0x3bbd8b){var _0x4bcdab=squel[_0x04c6('0x7c')]()[_0x04c6('0x5')](_0x04c6('0x7d')+_0x216cb0+_0x04c6('0x7e'),'id')[_0x04c6('0x5')](_0x04c6('0x7f'))[_0x04c6('0x80')](_0x04c6('0x81')+_0x2fb324+'_interactions','ui')[_0x04c6('0x82')]('ui.UserId\x20=\x20?',_0xf4e9d6['id']);return _0x5d9fa3[_0x04c6('0x83')][_0x04c6('0x84')](_0x4bcdab['toString'](),_0x145854)['then'](function(_0x2e649d){_0xf4e9d6[_0x216cb0+'OpenTabs']=_0x2e649d;_0x4336a3(_0x2e649d);})[_0x04c6('0xd')](function(_0x4530de){_0x3bbd8b(_0x4530de);});});}return _0x2a1d36['define'](_0x04c6('0x85'),attributes,{'tableName':_0x04c6('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xae0006){var _0x1cc1a1={'raw':![],'where':{}};var _0x2be139={};var _0xd12535={'count':0x0,'rows':[]};var _0x3e5a53=_0xae0006[_0x04c6('0x84')][_0x04c6('0x87')];var _0x129731=_0xae0006[_0x04c6('0x84')]['mergeResources']||![];var _0x3aaa1e=_0x41e29f(_0x3e5a53,_0x129731);if(!_0x3aaa1e[_0x04c6('0x15')])throw new Error(_0x04c6('0x88')+_0x3e5a53+'\x27');var _0x12394f=[{'name':_0x3e5a53}];if(!_['isEmpty'](_0x3aaa1e[_0x04c6('0x1a')]))_0x12394f=_0x3aaa1e[_0x04c6('0x1a')];var _0x1b38d1=[];for(var _0x49be80=0x0;_0x49be80<_0x12394f['length'];_0x49be80++){_0x1b38d1[_0x04c6('0x89')](_0x5d9fa3[_0x04c6('0x8a')][_0x04c6('0x8b')]({'where':{'userProfileId':_0xae0006[_0x04c6('0x8c')]['id'],'name':_0x12394f[_0x49be80][_0x04c6('0xc')]},'raw':!![]}));}return Promise[_0x04c6('0x8d')](_0x1b38d1)['then'](function(_0x375159){var _0x173df7=_[_0x04c6('0x4')](_0x375159,function(_0x596ac0){return _0x596ac0?_0x596ac0:undefined;});var _0x4f0850=_[_0x04c6('0x4')](_0x12394f,[_0x04c6('0x8e'),!![]]);var _0x1c62da=_[_0x04c6('0x8f')](_0x173df7)&&_['isEmpty'](_0x4f0850)?null:_[_0x04c6('0x90')](_0x4f0850,_0x173df7);if(!_0x1c62da)return null;var _0x4d4e50=[];for(var _0x5b5b09=0x0;_0x5b5b09<_0x1c62da[_0x04c6('0x91')];_0x5b5b09++){var _0xe178dd=_[_0x04c6('0x8b')](_0x12394f,function(_0x1904d4){return _0x1c62da[_0x5b5b09]?_0x1904d4[_0x04c6('0xc')]===_0x1c62da[_0x5b5b09][_0x04c6('0xc')]:null;});if(_0xe178dd){if(_0x1c62da[_0x5b5b09][_0x04c6('0x8e')]){_0x4d4e50['push'](_0x4ad4f1(_0x3aaa1e[_0x04c6('0x15')],_0x1c62da[_0x5b5b09]));}else{if(!_0x1c62da[_0x5b5b09][_0x04c6('0x92')]){_0x4d4e50[_0x04c6('0x89')](_0x5a5a66(_0xe178dd,_0x1c62da[_0x5b5b09],_0x3aaa1e[_0x04c6('0x15')]));}else{if(_0xe178dd[_0x04c6('0x9')]){_0x4d4e50['push'](_0x5584cd(_0xe178dd,_0x1c62da[_0x5b5b09]));}}}}}return Promise['all'](_0x4d4e50);})[_0x04c6('0x8')](function(_0x598941){var _0x2df63b=_0x598941;var _0x518e4e=null;if(_0x2df63b){_0x518e4e=_0x2df63b[_0x04c6('0x91')]===0x1?_0x2df63b[0x0]:null;}if(!_0x518e4e&&!_0x2df63b)return _0xd12535;var _0x467f3b=_0x5d9fa3[_0x3aaa1e['childModel']][_0x04c6('0x93')];_0x2be139[_0x04c6('0x9')]=_[_0x04c6('0x94')](_0x467f3b);_0x2be139[_0x04c6('0x84')]=_[_0x04c6('0x94')](_0xae0006[_0x04c6('0x84')]);_0x2be139[_0x04c6('0x95')]=_[_0x04c6('0x96')](_0x2be139[_0x04c6('0x9')],_0x2be139[_0x04c6('0x84')]);_0x1cc1a1[_0x04c6('0x97')]=_[_0x04c6('0x96')](_0x2be139[_0x04c6('0x9')],qs['fields'](_0xae0006[_0x04c6('0x84')][_0x04c6('0x98')]));_0x1cc1a1['attributes']=_0x1cc1a1[_0x04c6('0x97')][_0x04c6('0x91')]?_0x1cc1a1[_0x04c6('0x97')]:_0x2be139[_0x04c6('0x9')];if(!_0xae0006[_0x04c6('0x84')]['hasOwnProperty'](_0x04c6('0x99'))){_0x1cc1a1['limit']=qs[_0x04c6('0x9a')](_0xae0006['query'][_0x04c6('0x9a')]);_0x1cc1a1[_0x04c6('0x9b')]=qs[_0x04c6('0x9b')](_0xae0006[_0x04c6('0x84')][_0x04c6('0x9b')]);}_0x1cc1a1[_0x04c6('0x9c')]=qs[_0x04c6('0x9d')](_0xae0006[_0x04c6('0x84')][_0x04c6('0x9d')]);_0x1cc1a1['where']=qs[_0x04c6('0x95')](_[_0x04c6('0x9e')](_0xae0006['query'],_0x2be139[_0x04c6('0x95')]));if(_0xae0006['query'][_0x04c6('0x4')]){_0x1cc1a1[_0x04c6('0x82')]=_['merge'](_0x1cc1a1[_0x04c6('0x82')],{'$or':_[_0x04c6('0xb')](_0x467f3b,function(_0x5bdad4){if(_0x5bdad4[_0x04c6('0x12')][_0x04c6('0x9f')]!=='VIRTUAL'){var _0x7b9132={};_0x7b9132[_0x5bdad4[_0x04c6('0x5')]]={'$like':'%'+_0xae0006['query'][_0x04c6('0x4')]+'%'};return _0x7b9132;}})});}var _0x186aa0=[];var _0x4f02d9=null;var _0x5314ee={};if(_0x518e4e){_0x4f02d9=_['find'](_0x12394f,[_0x04c6('0xc'),_0x518e4e[_0x04c6('0xc')]]);if(_0x4f02d9[_0x04c6('0x5')]){_0x5314ee={};if(_0x3aaa1e[_0x04c6('0x15')]===_0x04c6('0x10')){_0x5314ee[_0x4f02d9['foreignKey']]=_[_0x04c6('0xb')](_0x518e4e[_0x04c6('0xa')],'id');}else{_0x5314ee[_0x4f02d9[_0x04c6('0xa0')]]=_0x518e4e[_0x04c6('0xa')];}_0x186aa0[_0x04c6('0x89')](_0x5314ee);}else{_0x1cc1a1[_0x04c6('0x82')]['id']=_0x518e4e[_0x04c6('0xa')];}}else{for(var _0x51858a=0x0;_0x51858a<_0x2df63b[_0x04c6('0x91')];_0x51858a++){_0x4f02d9=_['find'](_0x12394f,[_0x04c6('0xc'),_0x2df63b[_0x51858a]['name']]);if(_0x4f02d9['field']){_0x5314ee={};_0x5314ee[_0x4f02d9[_0x04c6('0xa0')]]=_0x2df63b[_0x51858a]['associatedResources'];_0x186aa0[_0x04c6('0x89')](_0x5314ee);}else{if(!_0x1cc1a1[_0x04c6('0x82')]['id'])_0x1cc1a1[_0x04c6('0x82')]['id']=[];_0x2df63b[_0x51858a][_0x04c6('0xa')][_0x04c6('0xa1')](function(_0x48fbdd){_0x1cc1a1['where']['id'][_0x04c6('0x89')](_0x48fbdd);});}}}if(!_[_0x04c6('0x8f')](_0x186aa0)){_0x1cc1a1[_0x04c6('0x82')]=_[_0x04c6('0xa2')](_0x1cc1a1[_0x04c6('0x82')],{'$and':{'$or':_0x186aa0}});}_0x1cc1a1=_[_0x04c6('0xa2')]({},_0x1cc1a1,_0xae0006['options']);if(_0x518e4e&&!_0x518e4e[_0x04c6('0x92')]&&_0x3aaa1e['childModel']==='AnalyticExtractedReport'){if(_0xae0006[_0x04c6('0x84')][_0x04c6('0xa3')]){_0x1cc1a1[_0x04c6('0xa4')]=[{'all':!![]}];}return _0x5d9fa3[_0x3aaa1e[_0x04c6('0x15')]][_0x04c6('0x7')](_0x1cc1a1)[_0x04c6('0x8')](function(_0x2e65f0){var _0x243553=[];_0x2e65f0[_0x04c6('0xa1')](function(_0x3dd78e){var _0x21dc7c;switch(_0x3dd78e['reportType']){case _0x04c6('0xa5'):_0x21dc7c=_['find'](_0x518e4e['associatedResources'],function(_0x38164e){return _0x38164e['id']===_0x3dd78e[_0x04c6('0x75')]&&_0x38164e[_0x04c6('0x12')]===_0x04c6('0xa6');});break;case _0x04c6('0xa7'):_0x21dc7c=_[_0x04c6('0x8b')](_0x518e4e[_0x04c6('0xa')],function(_0x383437){return _0x383437['id']===_0x3dd78e[_0x04c6('0x75')]&&_0x383437[_0x04c6('0x12')]===_0x04c6('0xa8');});break;}if(_0x21dc7c)_0x243553['push'](_0x3dd78e);});_0xd12535['count']=_0x243553[_0x04c6('0x91')];_0xd12535[_0x04c6('0xa9')]=_0x243553;return _0xd12535;});}else{return _0x5d9fa3[_0x3aaa1e['childModel']][_0x04c6('0xaa')]({'where':_0x1cc1a1[_0x04c6('0x82')]})['then'](function(_0x4504fc){_0xd12535[_0x04c6('0xaa')]=_0x4504fc;if(_0xae0006[_0x04c6('0x84')][_0x04c6('0xa3')]){if(_0x3aaa1e[_0x04c6('0x15')]===_0x04c6('0xab')){_0x1cc1a1[_0x04c6('0xa4')]=[{'model':_0x5d9fa3[_0x04c6('0x6d')],'as':'Tags','attributes':['id',_0x04c6('0xc'),'color'],'required':_0xae0006[_0x04c6('0x84')][_0x04c6('0xac')]?!![]:![]},{'model':_0x5d9fa3[_0x04c6('0x6d')],'as':_0x04c6('0xad'),'attributes':['id',_0x04c6('0xc'),_0x04c6('0xae')],'through':_0xae0006['query'][_0x04c6('0xac')]?{'attributes':[],'where':{'TagId':_0xae0006[_0x04c6('0x84')][_0x04c6('0xac')]||undefined}}:{},'required':_0xae0006['query']['tag']?!![]:![]}];}else{_0x1cc1a1['include']=[{'all':!![]}];}}return _0x5d9fa3[_0x3aaa1e[_0x04c6('0x15')]][_0x04c6('0x7')](_0x1cc1a1);})['then'](function(_0xd17fa3){_0xd12535[_0x04c6('0xa9')]=_0xd17fa3;if(_0x3e5a53===_0x04c6('0x33')&&_0xae0006['query'][_0x04c6('0xaf')]==='true'){var _0x1c0c74=[];for(var _0x3a1b76=0x0;_0x3a1b76<_0xd12535[_0x04c6('0xa9')]['length'];_0x3a1b76++){_0x1c0c74['push'](_0x583b3c(_0x04c6('0xb0'),_0xd12535[_0x04c6('0xa9')][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c('sms',_0xd12535['rows'][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c(_0x04c6('0xb2'),_0xd12535['rows'][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c(_0x04c6('0xb3'),_0xd12535[_0x04c6('0xa9')][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c(_0x04c6('0xb4'),_0xd12535[_0x04c6('0xa9')][_0x3a1b76][_0x04c6('0xb1')]));_0x1c0c74[_0x04c6('0x89')](_0x583b3c('whatsapp',_0xd12535[_0x04c6('0xa9')][_0x3a1b76][_0x04c6('0xb1')]));}return Promise[_0x04c6('0x8d')](_0x1c0c74)[_0x04c6('0x8')](function(){return _0xd12535;});}return _0xd12535;});}});}}});}; \ No newline at end of file +var _0x2ef3=['squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','UserProfileResource','AnalyticExtractedReport','type','resourceId','catch','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','User','role','agent','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','variables','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','user_has_','_interactions','where','query','define','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','attributes','intersection','hasOwnProperty','limit','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','DefaultReports','custom','CustomReports','rows','count','include','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs'];(function(_0x5e2cf6,_0x25a693){var _0x39b25f=function(_0x1ad12){while(--_0x1ad12){_0x5e2cf6['push'](_0x5e2cf6['shift']());}};_0x39b25f(++_0x25a693);}(_0x2ef3,0xba));var _0x32ef=function(_0x1d1479,_0x27dbf2){_0x1d1479=_0x1d1479-0x0;var _0x30da3d=_0x2ef3[_0x1d1479];return _0x30da3d;};'use strict';var _=require(_0x32ef('0x0'));var attributes=require(_0x32ef('0x1'));var qs=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));module[_0x32ef('0x4')]=function(_0x38047b){var _0x48106c=_0x38047b[_0x32ef('0x5')];function _0x38b7f3(_0x524ab6,_0x402857){return new Promise(function(_0x37dd1d,_0x4c8104){if(!_0x402857)return _0x37dd1d(null);var _0x5dfa09=_0x402857[_0x32ef('0x6')]?{[_0x402857[_0x32ef('0x6')][_0x32ef('0x7')]]:_0x402857[_0x32ef('0x6')][_0x32ef('0x8')]}:undefined;return _0x48106c[_0x524ab6][_0x32ef('0x9')]({'where':_0x5dfa09,'raw':!![]})[_0x32ef('0xa')](function(_0x2bbb50){_0x402857[_0x32ef('0xb')]=_[_0x32ef('0xc')](_0x2bbb50,'id');_0x37dd1d(_0x402857);})['catch'](function(_0x5780e9){_0x4c8104(_0x5780e9);});});}function _0x401d0b(_0x33281d,_0x45bfd5){return new Promise(function(_0x1499c2,_0x5af651){var _0x193714=_0x33281d['filter']?{[_0x33281d[_0x32ef('0x6')]['field']]:_0x33281d[_0x32ef('0x6')][_0x32ef('0x8')]}:undefined;return _0x48106c[_0x33281d['model']]['findAll']({'where':_0x193714,'raw':!![]})[_0x32ef('0xa')](function(_0x4d8009){_0x45bfd5[_0x32ef('0xb')]=_[_0x32ef('0xc')](_0x4d8009,function(_0x93d492){return _0x93d492[_0x32ef('0xd')];});_0x1499c2(_0x45bfd5);})['catch'](function(_0x55bf0b){_0x5af651(_0x55bf0b);});});}function _0x531e30(_0x13db1a,_0x3950e6,_0xb5aed2){if(!_0x3950e6)return Promise['resolve'](null);return new Promise(function(_0x5d559b,_0x1eb468){return _0x48106c[_0x32ef('0xe')][_0x32ef('0x9')]({'where':{'sectionId':_0x3950e6['id']},'raw':!![]})['then'](function(_0xbe37f6){if(_0x13db1a[_0x32ef('0x7')]&&_0x13db1a['field']!=='id'){_0x3950e6[_0x32ef('0xb')]=_[_0x32ef('0xc')](_0xbe37f6,function(_0x26aff3){return _0x26aff3[_0x13db1a[_0x32ef('0x7')]];});}else{if(_0xb5aed2===_0x32ef('0xf')){_0x3950e6[_0x32ef('0xb')]=_['map'](_0xbe37f6,function(_0x3c5b78){return{'id':_0x3c5b78['resourceId'],'type':_0x3c5b78[_0x32ef('0x10')]};});}else{_0x3950e6[_0x32ef('0xb')]=_['map'](_0xbe37f6,function(_0x1af371){return _0x1af371[_0x32ef('0x11')];});}}_0x5d559b(_0x3950e6);})[_0x32ef('0x12')](function(_0x55f7f2){_0x1eb468(_0x55f7f2);});});}function _0x57f5e5(_0x22f2d7,_0xb30fab){var _0x225feb={'parentSections':[]};switch(_0x22f2d7['toLowerCase']()){case'squareprojects':_0x225feb[_0x32ef('0x13')]='SquareProject';break;case'odbc':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x14');break;case _0x32ef('0x15'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x16');_0x225feb[_0x32ef('0x17')]=[{'name':_0x32ef('0x18'),'field':_0x32ef('0xd'),'foreignKey':_0x32ef('0x19')}];break;case _0x32ef('0x1a'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x1b');break;case'contacts':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x1c');_0x225feb['parentSections']=[{'name':_0x32ef('0x1d'),'field':'id','foreignKey':_0x32ef('0x1e')}];break;case _0x32ef('0x1f'):_0x225feb[_0x32ef('0x13')]='CmList';break;case _0x32ef('0x20'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x21');break;case _0x32ef('0x22'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x23');break;case _0x32ef('0x24'):_0x225feb['childModel']=_0x32ef('0x25');break;case'chatwebsites':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x26');break;case'faxqueues':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x27');break;case _0x32ef('0x28'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x29');break;case'inboundroutes':case'internalroutes':case _0x32ef('0x2a'):_0x225feb['childModel']=_0x32ef('0x2b');break;case _0x32ef('0x2c'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x2d');break;case _0x32ef('0x2e'):_0x225feb[_0x32ef('0x13')]='VoiceMail';break;case'voicerecordings':_0x225feb['childModel']=_0x32ef('0x2f');_0x225feb[_0x32ef('0x17')]=[{'name':_0x32ef('0x30'),'field':'name','foreignKey':'membername','model':_0x32ef('0x31'),'filter':{'field':_0x32ef('0x32'),'value':[_0x32ef('0x33')]}},{'name':'Telephones','field':'name','foreignKey':_0x32ef('0x34'),'model':_0x32ef('0x31'),'filter':{'field':_0x32ef('0x32'),'value':[_0x32ef('0x35')]}},{'name':_0x32ef('0x36'),'field':_0x32ef('0xd'),'foreignKey':_0x32ef('0x37'),'model':_0x32ef('0x38'),'filter':{'field':_0x32ef('0x10'),'value':['inbound']}},{'name':_0x32ef('0x39'),'field':_0x32ef('0xd'),'foreignKey':_0x32ef('0x37'),'model':'VoiceQueue','filter':{'field':_0x32ef('0x10'),'value':[_0x32ef('0x3a')]}}];break;case _0x32ef('0x3b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x3c');break;case _0x32ef('0x3d'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x3e');break;case _0x32ef('0x3f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x40');break;case _0x32ef('0x41'):_0x225feb['childModel']=_0x32ef('0x42');break;case _0x32ef('0x43'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x44');break;case _0x32ef('0x45'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x46');break;case'mailsubstatuses':_0x225feb['childModel']=_0x32ef('0x47');break;case _0x32ef('0x48'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x49');break;case'openchannelaccounts':_0x225feb[_0x32ef('0x13')]=_0x32ef('0x4a');break;case'smsqueues':_0x225feb[_0x32ef('0x13')]='SmsQueue';break;case _0x32ef('0x4b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x4c');break;case _0x32ef('0x4d'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x4e');break;case _0x32ef('0x4f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x50');break;case _0x32ef('0x51'):_0x225feb['childModel']=_0x32ef('0x52');break;case'voicequeues':case _0x32ef('0x53'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x38');if(_0xb30fab){_0x225feb['parentSections']=[{'name':_0x32ef('0x36')},{'name':_0x32ef('0x39')}];}break;case _0x32ef('0x54'):case _0x32ef('0x55'):case _0x32ef('0x56'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x31');if(_0xb30fab){_0x225feb['parentSections']=[{'name':'Users','filter':{'field':_0x32ef('0x32'),'value':[_0x32ef('0x57'),_0x32ef('0x58')]},'ignore':!![]},{'name':_0x32ef('0x30')},{'name':_0x32ef('0x59')}];}break;case _0x32ef('0x5a'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x5b');break;case _0x32ef('0x5c'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x5d');break;case _0x32ef('0x5e'):_0x225feb[_0x32ef('0x13')]='FreshdeskAccount';break;case _0x32ef('0x5f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x60');break;case _0x32ef('0x61'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x62');break;case _0x32ef('0x63'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x64');break;case _0x32ef('0x65'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x31');break;case _0x32ef('0x66'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x67');break;case _0x32ef('0x68'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x69');break;case'customdashboards':_0x225feb['childModel']=_0x32ef('0x6a');break;case _0x32ef('0x6b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x6c');break;case _0x32ef('0x6d'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x6e');break;case _0x32ef('0x6f'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x70');break;case _0x32ef('0x71'):_0x225feb['childModel']=_0x32ef('0x72');break;case _0x32ef('0x73'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x74');break;case _0x32ef('0x75'):_0x225feb[_0x32ef('0x13')]='Template';break;case _0x32ef('0x76'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0x77');break;case'trunks':_0x225feb[_0x32ef('0x13')]='Trunk';break;case _0x32ef('0x78'):_0x225feb[_0x32ef('0x13')]='Variable';break;case _0x32ef('0x79'):_0x225feb['childModel']=_0x32ef('0x7a');break;case _0x32ef('0x7b'):_0x225feb[_0x32ef('0x13')]=_0x32ef('0xf');_0x225feb[_0x32ef('0x17')]=[{'name':_0x32ef('0x7c'),'field':'id','foreignKey':_0x32ef('0x7d')}];break;case'metrics':_0x225feb['childModel']=_0x32ef('0x7e');break;}return _0x225feb;}function _0x52232a(_0x4fbab6,_0xb519e9){var _0x89d0b3=_0x4fbab6[_0x32ef('0x7f')](0x0)[_0x32ef('0x80')]()+_0x4fbab6[_0x32ef('0x81')](0x1);var _0x356704={'type':_0x48106c[_0x32ef('0x82')][_0x32ef('0x83')][_0x32ef('0x84')],'raw':!![]};return new Promise(function(_0x123571,_0x4c125c){var _0x518ee1=squel[_0x32ef('0x85')]()[_0x32ef('0x7')]('ui.'+_0x89d0b3+_0x32ef('0x86'),'id')[_0x32ef('0x7')](_0x32ef('0x87'))['from'](_0x32ef('0x88')+_0x4fbab6+_0x32ef('0x89'),'ui')[_0x32ef('0x8a')]('ui.UserId\x20=\x20?',_0xb519e9['id']);return _0x48106c['sequelize'][_0x32ef('0x8b')](_0x518ee1['toString'](),_0x356704)[_0x32ef('0xa')](function(_0x5bb114){_0xb519e9[_0x89d0b3+'OpenTabs']=_0x5bb114;_0x123571(_0x5bb114);})[_0x32ef('0x12')](function(_0x208989){_0x4c125c(_0x208989);});});}return _0x38047b[_0x32ef('0x8c')]('UserProfile',attributes,{'tableName':_0x32ef('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x222b24){var _0x5f9da7={'raw':![],'where':{}};var _0x58ecbb={};var _0x4557ce={'count':0x0,'rows':[]};var _0x12b7f8=_0x222b24['query']['section'];var _0x2e20dc=_0x222b24[_0x32ef('0x8b')][_0x32ef('0x8e')]||![];var _0x339625=_0x57f5e5(_0x12b7f8,_0x2e20dc);if(!_0x339625[_0x32ef('0x13')])throw new Error(_0x32ef('0x8f')+_0x12b7f8+'\x27');var _0x4c89e8=[{'name':_0x12b7f8}];if(!_[_0x32ef('0x90')](_0x339625[_0x32ef('0x17')]))_0x4c89e8=_0x339625[_0x32ef('0x17')];var _0x36ed97=[];for(var _0x21e930=0x0;_0x21e930<_0x4c89e8[_0x32ef('0x91')];_0x21e930++){_0x36ed97[_0x32ef('0x92')](_0x48106c[_0x32ef('0x93')][_0x32ef('0x94')]({'where':{'userProfileId':_0x222b24['params']['id'],'name':_0x4c89e8[_0x21e930][_0x32ef('0xd')]},'raw':!![]}));}return Promise[_0x32ef('0x95')](_0x36ed97)[_0x32ef('0xa')](function(_0x1c629d){var _0x79ae28=_['filter'](_0x1c629d,function(_0x47c0ed){return _0x47c0ed?_0x47c0ed:undefined;});var _0x2125de=_[_0x32ef('0x6')](_0x4c89e8,[_0x32ef('0x96'),!![]]);var _0x334ca6=_[_0x32ef('0x90')](_0x79ae28)&&_['isEmpty'](_0x2125de)?null:_[_0x32ef('0x97')](_0x2125de,_0x79ae28);if(!_0x334ca6)return null;var _0x544045=[];for(var _0x216e2f=0x0;_0x216e2f<_0x334ca6[_0x32ef('0x91')];_0x216e2f++){var _0x48b6f4=_['find'](_0x4c89e8,function(_0x2c9f7a){return _0x334ca6[_0x216e2f]?_0x2c9f7a[_0x32ef('0xd')]===_0x334ca6[_0x216e2f][_0x32ef('0xd')]:null;});if(_0x48b6f4){if(_0x334ca6[_0x216e2f]['ignore']){_0x544045['push'](_0x38b7f3(_0x339625[_0x32ef('0x13')],_0x334ca6[_0x216e2f]));}else{if(!_0x334ca6[_0x216e2f][_0x32ef('0x98')]){_0x544045[_0x32ef('0x92')](_0x531e30(_0x48b6f4,_0x334ca6[_0x216e2f],_0x339625[_0x32ef('0x13')]));}else{if(_0x48b6f4['model']){_0x544045[_0x32ef('0x92')](_0x401d0b(_0x48b6f4,_0x334ca6[_0x216e2f]));}}}}}return Promise[_0x32ef('0x95')](_0x544045);})[_0x32ef('0xa')](function(_0xd7a78){var _0x9df27c=_0xd7a78;var _0x268dcd=null;if(_0x9df27c){_0x268dcd=_0x9df27c[_0x32ef('0x91')]===0x1?_0x9df27c[0x0]:null;}if(!_0x268dcd&&!_0x9df27c)return _0x4557ce;var _0x44e23e=_0x48106c[_0x339625[_0x32ef('0x13')]][_0x32ef('0x99')];_0x58ecbb[_0x32ef('0x9a')]=_[_0x32ef('0x9b')](_0x44e23e);_0x58ecbb['query']=_['keys'](_0x222b24[_0x32ef('0x8b')]);_0x58ecbb[_0x32ef('0x9c')]=_['intersection'](_0x58ecbb[_0x32ef('0x9a')],_0x58ecbb['query']);_0x5f9da7[_0x32ef('0x9d')]=_[_0x32ef('0x9e')](_0x58ecbb[_0x32ef('0x9a')],qs['fields'](_0x222b24[_0x32ef('0x8b')]['fields']));_0x5f9da7[_0x32ef('0x9d')]=_0x5f9da7[_0x32ef('0x9d')]['length']?_0x5f9da7['attributes']:_0x58ecbb[_0x32ef('0x9a')];if(!_0x222b24['query'][_0x32ef('0x9f')]('nolimit')){_0x5f9da7[_0x32ef('0xa0')]=qs[_0x32ef('0xa0')](_0x222b24[_0x32ef('0x8b')]['limit']);_0x5f9da7['offset']=qs['offset'](_0x222b24[_0x32ef('0x8b')]['offset']);}_0x5f9da7[_0x32ef('0xa1')]=qs[_0x32ef('0xa2')](_0x222b24[_0x32ef('0x8b')][_0x32ef('0xa2')]);_0x5f9da7[_0x32ef('0x8a')]=qs[_0x32ef('0x9c')](_['pick'](_0x222b24[_0x32ef('0x8b')],_0x58ecbb['filters']));if(_0x222b24['query'][_0x32ef('0x6')]){_0x5f9da7['where']=_[_0x32ef('0xa3')](_0x5f9da7[_0x32ef('0x8a')],{'$or':_['map'](_0x44e23e,function(_0x232b40){if(_0x232b40[_0x32ef('0x10')][_0x32ef('0xa4')]!==_0x32ef('0xa5')){var _0x1fa36d={};_0x1fa36d[_0x232b40[_0x32ef('0x7')]]={'$like':'%'+_0x222b24['query']['filter']+'%'};return _0x1fa36d;}})});}var _0x35b10d=[];var _0x5e0b55=null;var _0x41bbe1={};if(_0x268dcd){_0x5e0b55=_[_0x32ef('0x94')](_0x4c89e8,[_0x32ef('0xd'),_0x268dcd[_0x32ef('0xd')]]);if(_0x5e0b55[_0x32ef('0x7')]){_0x41bbe1={};if(_0x339625[_0x32ef('0x13')]==='AnalyticExtractedReport'){_0x41bbe1[_0x5e0b55[_0x32ef('0xa6')]]=_[_0x32ef('0xc')](_0x268dcd[_0x32ef('0xb')],'id');}else{_0x41bbe1[_0x5e0b55[_0x32ef('0xa6')]]=_0x268dcd[_0x32ef('0xb')];}_0x35b10d['push'](_0x41bbe1);}else{_0x5f9da7['where']['id']=_0x268dcd[_0x32ef('0xb')];}}else{for(var _0x904a4f=0x0;_0x904a4f<_0x9df27c['length'];_0x904a4f++){_0x5e0b55=_[_0x32ef('0x94')](_0x4c89e8,[_0x32ef('0xd'),_0x9df27c[_0x904a4f][_0x32ef('0xd')]]);if(_0x5e0b55[_0x32ef('0x7')]){_0x41bbe1={};_0x41bbe1[_0x5e0b55[_0x32ef('0xa6')]]=_0x9df27c[_0x904a4f][_0x32ef('0xb')];_0x35b10d[_0x32ef('0x92')](_0x41bbe1);}else{if(!_0x5f9da7[_0x32ef('0x8a')]['id'])_0x5f9da7[_0x32ef('0x8a')]['id']=[];_0x9df27c[_0x904a4f]['associatedResources'][_0x32ef('0xa7')](function(_0xefbbf2){_0x5f9da7['where']['id'][_0x32ef('0x92')](_0xefbbf2);});}}}if(!_['isEmpty'](_0x35b10d)){_0x5f9da7[_0x32ef('0x8a')]=_['merge'](_0x5f9da7[_0x32ef('0x8a')],{'$and':{'$or':_0x35b10d}});}_0x5f9da7=_[_0x32ef('0xa3')]({},_0x5f9da7,_0x222b24[_0x32ef('0xa8')]);if(_0x268dcd&&!_0x268dcd[_0x32ef('0x98')]&&_0x339625['childModel']===_0x32ef('0xf')){if(_0x222b24[_0x32ef('0x8b')][_0x32ef('0xa9')]){_0x5f9da7['include']=[{'all':!![]}];}return _0x48106c[_0x339625['childModel']]['findAll'](_0x5f9da7)[_0x32ef('0xa')](function(_0x12f5ef){var _0x1ec12d=[];_0x12f5ef[_0x32ef('0xa7')](function(_0x3cc90c){var _0x5a1696;switch(_0x3cc90c[_0x32ef('0xaa')]){case'default':_0x5a1696=_[_0x32ef('0x94')](_0x268dcd[_0x32ef('0xb')],function(_0xc43e1){return _0xc43e1['id']===_0x3cc90c['reportId']&&_0xc43e1[_0x32ef('0x10')]===_0x32ef('0xab');});break;case _0x32ef('0xac'):_0x5a1696=_[_0x32ef('0x94')](_0x268dcd[_0x32ef('0xb')],function(_0x4d4b5f){return _0x4d4b5f['id']===_0x3cc90c[_0x32ef('0x7d')]&&_0x4d4b5f['type']===_0x32ef('0xad');});break;}if(_0x5a1696)_0x1ec12d[_0x32ef('0x92')](_0x3cc90c);});_0x4557ce['count']=_0x1ec12d['length'];_0x4557ce[_0x32ef('0xae')]=_0x1ec12d;return _0x4557ce;});}else{return _0x48106c[_0x339625[_0x32ef('0x13')]][_0x32ef('0xaf')]({'where':_0x5f9da7[_0x32ef('0x8a')]})['then'](function(_0x356fd4){_0x4557ce['count']=_0x356fd4;if(_0x222b24['query'][_0x32ef('0xa9')]){if(_0x339625['childModel']===_0x32ef('0x1c')){_0x5f9da7[_0x32ef('0xb0')]=[{'model':_0x48106c[_0x32ef('0x74')],'as':'Tags','attributes':['id','name',_0x32ef('0xb1')],'required':_0x222b24[_0x32ef('0x8b')][_0x32ef('0xb2')]?!![]:![]},{'model':_0x48106c[_0x32ef('0x74')],'as':_0x32ef('0xb3'),'attributes':['id',_0x32ef('0xd'),_0x32ef('0xb1')],'through':_0x222b24['query'][_0x32ef('0xb2')]?{'attributes':[],'where':{'TagId':_0x222b24[_0x32ef('0x8b')][_0x32ef('0xb2')]||undefined}}:{},'required':_0x222b24[_0x32ef('0x8b')]['tag']?!![]:![]}];}else{_0x5f9da7['include']=[{'all':!![]}];}}return _0x48106c[_0x339625[_0x32ef('0x13')]]['findAll'](_0x5f9da7);})[_0x32ef('0xa')](function(_0x1d3a37){_0x4557ce['rows']=_0x1d3a37;if(_0x12b7f8==='Agents'&&_0x222b24['query'][_0x32ef('0xb4')]===_0x32ef('0xb5')){var _0xa53375=[];for(var _0x275995=0x0;_0x275995<_0x4557ce['rows'][_0x32ef('0x91')];_0x275995++){_0xa53375[_0x32ef('0x92')](_0x52232a(_0x32ef('0xb6'),_0x4557ce['rows'][_0x275995][_0x32ef('0xb7')]));_0xa53375['push'](_0x52232a(_0x32ef('0xb8'),_0x4557ce[_0x32ef('0xae')][_0x275995]['dataValues']));_0xa53375['push'](_0x52232a(_0x32ef('0xb9'),_0x4557ce[_0x32ef('0xae')][_0x275995][_0x32ef('0xb7')]));_0xa53375[_0x32ef('0x92')](_0x52232a(_0x32ef('0xba'),_0x4557ce[_0x32ef('0xae')][_0x275995][_0x32ef('0xb7')]));_0xa53375[_0x32ef('0x92')](_0x52232a(_0x32ef('0xbb'),_0x4557ce['rows'][_0x275995][_0x32ef('0xb7')]));_0xa53375['push'](_0x52232a(_0x32ef('0xbc'),_0x4557ce[_0x32ef('0xae')][_0x275995][_0x32ef('0xb7')]));}return Promise[_0x32ef('0x95')](_0xa53375)[_0x32ef('0xa')](function(){return _0x4557ce;});}return _0x4557ce;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 37fc5bb..db780d0 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 _0x5a4f=['UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug'];(function(_0x770c67,_0x1ea22b){var _0x2bdbbe=function(_0xbab638){while(--_0xbab638){_0x770c67['push'](_0x770c67['shift']());}};_0x2bdbbe(++_0x1ea22b);}(_0x5a4f,0x10d));var _0xf5a4=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x5a4f[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xf5a4('0x0'));var util=require('util');var moment=require(_0xf5a4('0x1'));var BPromise=require('bluebird');var rs=require(_0xf5a4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5a4('0x3'))['db'];var utils=require(_0xf5a4('0x4'));var logger=require(_0xf5a4('0x5'))(_0xf5a4('0x6'));var config=require(_0xf5a4('0x7'));var jayson=require(_0xf5a4('0x8'));var client=jayson[_0xf5a4('0x9')]['http']({'port':0x232a});config[_0xf5a4('0xa')]=_[_0xf5a4('0xb')](config[_0xf5a4('0xa')],{'host':_0xf5a4('0xc'),'port':0x18eb});var socket=require(_0xf5a4('0xd'))(new Redis(config[_0xf5a4('0xa')]));require(_0xf5a4('0xe'))[_0xf5a4('0xf')](socket);function respondWithRpcPromise(_0x63560e,_0xdb88b7,_0x3cdf31){return new BPromise(function(_0x548bc2,_0x1a9dc4){return client[_0xf5a4('0x10')](_0x63560e,_0x3cdf31)[_0xf5a4('0x11')](function(_0x410121){logger[_0xf5a4('0x12')](_0xf5a4('0x13'),_0xdb88b7,'request\x20sent');logger[_0xf5a4('0x14')](_0xf5a4('0x15'),_0xdb88b7,_0xf5a4('0x16'),JSON[_0xf5a4('0x17')](_0x410121));if(_0x410121[_0xf5a4('0x18')]){if(_0x410121[_0xf5a4('0x18')][_0xf5a4('0x19')]===0x1f4){logger['error'](_0xf5a4('0x13'),_0xdb88b7,_0x410121[_0xf5a4('0x18')][_0xf5a4('0x1a')]);return _0x1a9dc4(_0x410121[_0xf5a4('0x18')][_0xf5a4('0x1a')]);}logger[_0xf5a4('0x18')]('UserProfile,\x20%s,\x20%s',_0xdb88b7,_0x410121[_0xf5a4('0x18')][_0xf5a4('0x1a')]);return _0x548bc2(_0x410121['error'][_0xf5a4('0x1a')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0xdb88b7,_0xf5a4('0x16'));_0x548bc2(_0x410121[_0xf5a4('0x1b')][_0xf5a4('0x1a')]);}})[_0xf5a4('0x1c')](function(_0x3a7acf){logger[_0xf5a4('0x18')](_0xf5a4('0x13'),_0xdb88b7,_0x3a7acf);_0x1a9dc4(_0x3a7acf);});});} \ No newline at end of file +var _0x044a=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1ddd0,_0x15f9f4){var _0x4d86d0=function(_0x3173d7){while(--_0x3173d7){_0x1ddd0['push'](_0x1ddd0['shift']());}};_0x4d86d0(++_0x15f9f4);}(_0x044a,0x173));var _0xa044=function(_0x9b61a7,_0x440184){_0x9b61a7=_0x9b61a7-0x0;var _0xa5fdc1=_0x044a[_0x9b61a7];return _0xa5fdc1;};'use strict';var _=require(_0xa044('0x0'));var util=require(_0xa044('0x1'));var moment=require(_0xa044('0x2'));var BPromise=require(_0xa044('0x3'));var rs=require(_0xa044('0x4'));var fs=require('fs');var Redis=require(_0xa044('0x5'));var db=require(_0xa044('0x6'))['db'];var utils=require(_0xa044('0x7'));var logger=require(_0xa044('0x8'))(_0xa044('0x9'));var config=require('../../config/environment');var jayson=require(_0xa044('0xa'));var client=jayson[_0xa044('0xb')][_0xa044('0xc')]({'port':0x232a});config[_0xa044('0xd')]=_['defaults'](config[_0xa044('0xd')],{'host':_0xa044('0xe'),'port':0x18eb});var socket=require(_0xa044('0xf'))(new Redis(config[_0xa044('0xd')]));require('./userProfile.socket')[_0xa044('0x10')](socket);function respondWithRpcPromise(_0x9dec14,_0x3f170b,_0x47a9dc){return new BPromise(function(_0xdf14f6,_0xa3b07f){return client[_0xa044('0x11')](_0x9dec14,_0x47a9dc)[_0xa044('0x12')](function(_0x5e203d){logger[_0xa044('0x13')]('UserProfile,\x20%s,\x20%s',_0x3f170b,'request\x20sent');logger[_0xa044('0x14')](_0xa044('0x15'),_0x3f170b,_0xa044('0x16'),JSON[_0xa044('0x17')](_0x5e203d));if(_0x5e203d[_0xa044('0x18')]){if(_0x5e203d[_0xa044('0x18')][_0xa044('0x19')]===0x1f4){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error'][_0xa044('0x1b')]);return _0xa3b07f(_0x5e203d[_0xa044('0x18')][_0xa044('0x1b')]);}logger[_0xa044('0x18')](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error']['message']);return _0xdf14f6(_0x5e203d[_0xa044('0x18')]['message']);}else{logger[_0xa044('0x13')](_0xa044('0x1a'),_0x3f170b,_0xa044('0x16'));_0xdf14f6(_0x5e203d[_0xa044('0x1c')][_0xa044('0x1b')]);}})['catch'](function(_0x567124){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x567124);_0xa3b07f(_0x567124);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8a436a8..890569d 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 _0x0f17=['./userProfile.events','save','remove','update','emit','register','length','userProfile:'];(function(_0x3c2075,_0x46fe2a){var _0x297475=function(_0x26e1ec){while(--_0x26e1ec){_0x3c2075['push'](_0x3c2075['shift']());}};_0x297475(++_0x46fe2a);}(_0x0f17,0x150));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0x70f1('0x0'));var events=[_0x70f1('0x1'),_0x70f1('0x2'),_0x70f1('0x3')];function createListener(_0x5cd99f,_0x3b2c2e){return function(_0x3407b1){_0x3b2c2e[_0x70f1('0x4')](_0x5cd99f,_0x3407b1);};}function removeListener(_0xbf0eea,_0x177495){return function(){UserProfileEvents['removeListener'](_0xbf0eea,_0x177495);};}exports[_0x70f1('0x5')]=function(_0x569bd8){for(var _0x150dad=0x0,_0x2c226e=events[_0x70f1('0x6')];_0x150dad<_0x2c226e;_0x150dad++){var _0x4015da=events[_0x150dad];var _0x42910a=createListener(_0x70f1('0x7')+_0x4015da,_0x569bd8);UserProfileEvents['on'](_0x4015da,_0x42910a);}}; \ No newline at end of file +var _0x5f27=['userProfile:','./userProfile.events','save','update','emit','length'];(function(_0x339648,_0x3d19ab){var _0x300e96=function(_0x8c3d6d){while(--_0x8c3d6d){_0x339648['push'](_0x339648['shift']());}};_0x300e96(++_0x3d19ab);}(_0x5f27,0xb5));var _0x75f2=function(_0x4a951c,_0x128756){_0x4a951c=_0x4a951c-0x0;var _0x457882=_0x5f27[_0x4a951c];return _0x457882;};'use strict';var UserProfileEvents=require(_0x75f2('0x0'));var events=[_0x75f2('0x1'),'remove',_0x75f2('0x2')];function createListener(_0x1cd366,_0x832591){return function(_0x211cf4){_0x832591[_0x75f2('0x3')](_0x1cd366,_0x211cf4);};}function removeListener(_0x19870b,_0x9753fa){return function(){UserProfileEvents['removeListener'](_0x19870b,_0x9753fa);};}exports['register']=function(_0x522f9f){for(var _0x5a6dae=0x0,_0x33b027=events[_0x75f2('0x4')];_0x5a6dae<_0x33b027;_0x5a6dae++){var _0x297071=events[_0x5a6dae];var _0x4169c3=createListener(_0x75f2('0x5')+_0x297071,_0x522f9f);UserProfileEvents['on'](_0x297071,_0x4169c3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0bfb52a..cecf1e5 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 _0xff8e=['express','Router','../../components/auth/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x41b654,_0x39239c){var _0x55c219=function(_0x1f55c0){while(--_0x1f55c0){_0x41b654['push'](_0x41b654['shift']());}};_0x55c219(++_0x39239c);}(_0xff8e,0x1eb));var _0xeff8=function(_0xa188df,_0x50a87a){_0xa188df=_0xa188df-0x0;var _0x24ea72=_0xff8e[_0xa188df];return _0x24ea72;};'use strict';var multer=require(_0xeff8('0x0'));var util=require(_0xeff8('0x1'));var path=require(_0xeff8('0x2'));var timeout=require('connect-timeout');var express=require(_0xeff8('0x3'));var router=express[_0xeff8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xeff8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeff8('0x6'));router[_0xeff8('0x7')]('/',auth[_0xeff8('0x8')](),controller[_0xeff8('0x9')]);router[_0xeff8('0x7')](_0xeff8('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xeff8('0xb'),auth[_0xeff8('0x8')](),controller['show']);router[_0xeff8('0xc')]('/',auth[_0xeff8('0x8')](),controller[_0xeff8('0xd')]);router[_0xeff8('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xeff8('0xf')]);router[_0xeff8('0x10')](_0xeff8('0xb'),auth[_0xeff8('0x8')](),controller[_0xeff8('0x11')]);module[_0xeff8('0x12')]=router; \ No newline at end of file +var _0x8caf=['get','index','/describe','describe','show','post','isAuthenticated','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x8caf,0xdf));var _0xf8ca=function(_0x5d2f0c,_0x2d0172){_0x5d2f0c=_0x5d2f0c-0x0;var _0xa5f33f=_0x8caf[_0x5d2f0c];return _0xa5f33f;};'use strict';var multer=require('multer');var util=require(_0xf8ca('0x0'));var path=require(_0xf8ca('0x1'));var timeout=require(_0xf8ca('0x2'));var express=require(_0xf8ca('0x3'));var router=express[_0xf8ca('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf8ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8ca('0x6'));var controller=require(_0xf8ca('0x7'));router[_0xf8ca('0x8')]('/',auth['isAuthenticated'](),controller[_0xf8ca('0x9')]);router[_0xf8ca('0x8')](_0xf8ca('0xa'),auth['isAuthenticated'](),controller[_0xf8ca('0xb')]);router[_0xf8ca('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf8ca('0xc')]);router[_0xf8ca('0xd')]('/',auth[_0xf8ca('0xe')](),controller[_0xf8ca('0xf')]);router['put'](_0xf8ca('0x10'),auth[_0xf8ca('0xe')](),controller[_0xf8ca('0x11')]);router[_0xf8ca('0x12')](_0xf8ca('0x10'),auth['isAuthenticated'](),controller[_0xf8ca('0x13')]);module[_0xf8ca('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index de412bf..752d53d 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 _0x0704=['exports','STRING','INTEGER'];(function(_0x4d0b5b,_0xf881c4){var _0x521856=function(_0x2e5d01){while(--_0x2e5d01){_0x4d0b5b['push'](_0x4d0b5b['shift']());}};_0x521856(++_0xf881c4);}(_0x0704,0x1e0));var _0x4070=function(_0x3c2777,_0x17fa29){_0x3c2777=_0x3c2777-0x0;var _0x5b9e22=_0x0704[_0x3c2777];return _0x5b9e22;};'use strict';var Sequelize=require('sequelize');module[_0x4070('0x0')]={'name':{'type':Sequelize[_0x4070('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4070('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xeb54=['STRING','sequelize'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xeb54,0x97));var _0x4eb5=function(_0x447689,_0x3bb340){_0x447689=_0x447689-0x0;var _0x4faee1=_0xeb54[_0x447689];return _0x4faee1;};'use strict';var Sequelize=require(_0x4eb5('0x0'));module['exports']={'name':{'type':Sequelize[_0x4eb5('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 052d449..a417692 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 _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x6343,0x168));var _0x3634=function(_0x5b1131,_0x287c19){_0x5b1131=_0x5b1131-0x0;var _0x2e5c82=_0x6343[_0x5b1131];return _0x2e5c82;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file +var _0x9536=['rawAttributes','intersection','length','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','UserProfileResource','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9536,0x179));var _0x6953=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x9536[_0x4a599b];return _0x2d53d3;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));};exports[_0x6953('0x49')]=function(_0x50b962,_0x5f15b0){return db['UserProfileResource']['describe']()[_0x6953('0x3c')](respondWithResult(_0x5f15b0,null))[_0x6953('0x41')](handleError(_0x5f15b0,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 6319b39..50fffbb 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 _0x6ad2=['bluebird','request-promise','path','./userProfileResource.attributes','define','UserProfileResource','compositeIndex','sectionId','lodash','util','api','moment'];(function(_0x32190e,_0x96e30b){var _0x1bfe11=function(_0xc726ba){while(--_0xc726ba){_0x32190e['push'](_0x32190e['shift']());}};_0x1bfe11(++_0x96e30b);}(_0x6ad2,0x158));var _0x26ad=function(_0x42b7b3,_0x2e0015){_0x42b7b3=_0x42b7b3-0x0;var _0x4284e7=_0x6ad2[_0x42b7b3];return _0x4284e7;};'use strict';var _=require(_0x26ad('0x0'));var util=require(_0x26ad('0x1'));var logger=require('../../config/logger')(_0x26ad('0x2'));var moment=require(_0x26ad('0x3'));var BPromise=require(_0x26ad('0x4'));var rp=require(_0x26ad('0x5'));var fs=require('fs');var path=require(_0x26ad('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26ad('0x7'));module['exports']=function(_0x3a1f8e,_0x37bebf){return _0x3a1f8e[_0x26ad('0x8')](_0x26ad('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x26ad('0xa'),'fields':['resourceId',_0x26ad('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc00=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x3de218,_0x51b13){var _0x12f582=function(_0x2e4b7e){while(--_0x2e4b7e){_0x3de218['push'](_0x3de218['shift']());}};_0x12f582(++_0x51b13);}(_0xdc00,0xd7));var _0x0dc0=function(_0x5ae671,_0x53e18d){_0x5ae671=_0x5ae671-0x0;var _0x48c8df=_0xdc00[_0x5ae671];return _0x48c8df;};'use strict';var _=require(_0x0dc0('0x0'));var util=require(_0x0dc0('0x1'));var logger=require(_0x0dc0('0x2'))(_0x0dc0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0dc0('0x4'));var fs=require('fs');var path=require(_0x0dc0('0x5'));var rimraf=require(_0x0dc0('0x6'));var config=require(_0x0dc0('0x7'));var attributes=require(_0x0dc0('0x8'));module[_0x0dc0('0x9')]=function(_0x5f4ab4,_0x4e70f6){return _0x5f4ab4[_0x0dc0('0xa')](_0x0dc0('0xb'),attributes,{'tableName':_0x0dc0('0xc'),'paranoid':![],'indexes':[{'name':_0x0dc0('0xd'),'fields':[_0x0dc0('0xe'),_0x0dc0('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c3ba116..f82f222 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 _0xc555=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x56297d,_0x3f780d){var _0x498a17=function(_0x16a15e){while(--_0x16a15e){_0x56297d['push'](_0x56297d['shift']());}};_0x498a17(++_0x3f780d);}(_0xc555,0x1d6));var _0x5c55=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc555[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x5c55('0x0'));var util=require(_0x5c55('0x1'));var moment=require(_0x5c55('0x2'));var BPromise=require(_0x5c55('0x3'));var rs=require(_0x5c55('0x4'));var fs=require('fs');var Redis=require(_0x5c55('0x5'));var db=require(_0x5c55('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c55('0x7'))(_0x5c55('0x8'));var config=require(_0x5c55('0x9'));var jayson=require(_0x5c55('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x212a35,_0x34e0b4,_0x18705c){return new BPromise(function(_0x4c8a5d,_0x355a3d){return client[_0x5c55('0xb')](_0x212a35,_0x18705c)[_0x5c55('0xc')](function(_0x1cda4b){logger[_0x5c55('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x34e0b4,_0x5c55('0xe'));logger[_0x5c55('0xf')](_0x5c55('0x10'),_0x34e0b4,_0x5c55('0xe'),JSON[_0x5c55('0x11')](_0x1cda4b));if(_0x1cda4b[_0x5c55('0x12')]){if(_0x1cda4b[_0x5c55('0x12')][_0x5c55('0x13')]===0x1f4){logger['error'](_0x5c55('0x14'),_0x34e0b4,_0x1cda4b[_0x5c55('0x12')][_0x5c55('0x15')]);return _0x355a3d(_0x1cda4b['error'][_0x5c55('0x15')]);}logger[_0x5c55('0x12')](_0x5c55('0x14'),_0x34e0b4,_0x1cda4b[_0x5c55('0x12')]['message']);return _0x4c8a5d(_0x1cda4b[_0x5c55('0x12')][_0x5c55('0x15')]);}else{logger[_0x5c55('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x34e0b4,_0x5c55('0xe'));_0x4c8a5d(_0x1cda4b['result'][_0x5c55('0x15')]);}})['catch'](function(_0x144b57){logger[_0x5c55('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x34e0b4,_0x144b57);_0x355a3d(_0x144b57);});});} \ No newline at end of file +var _0x677d=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x457b96,_0x4d9f45){var _0x515215=function(_0x39e1be){while(--_0x39e1be){_0x457b96['push'](_0x457b96['shift']());}};_0x515215(++_0x4d9f45);}(_0x677d,0x9f));var _0xd677=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x677d[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0xd677('0x0'));var moment=require(_0xd677('0x1'));var BPromise=require(_0xd677('0x2'));var rs=require(_0xd677('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd677('0x4'))['db'];var utils=require(_0xd677('0x5'));var logger=require(_0xd677('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd677('0x7')][_0xd677('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdd06d,_0x9a982b,_0xdb4cba){return new BPromise(function(_0x350013,_0x3084d6){return client[_0xd677('0x9')](_0xdd06d,_0xdb4cba)[_0xd677('0xa')](function(_0x1adb6e){logger[_0xd677('0xb')](_0xd677('0xc'),_0x9a982b,_0xd677('0xd'));logger[_0xd677('0xe')](_0xd677('0xf'),_0x9a982b,_0xd677('0xd'),JSON[_0xd677('0x10')](_0x1adb6e));if(_0x1adb6e[_0xd677('0x11')]){if(_0x1adb6e[_0xd677('0x11')][_0xd677('0x12')]===0x1f4){logger[_0xd677('0x11')](_0xd677('0xc'),_0x9a982b,_0x1adb6e['error'][_0xd677('0x13')]);return _0x3084d6(_0x1adb6e[_0xd677('0x11')][_0xd677('0x13')]);}logger[_0xd677('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x9a982b,_0x1adb6e[_0xd677('0x11')][_0xd677('0x13')]);return _0x350013(_0x1adb6e['error'][_0xd677('0x13')]);}else{logger[_0xd677('0xb')](_0xd677('0xc'),_0x9a982b,'request\x20sent');_0x350013(_0x1adb6e[_0xd677('0x14')][_0xd677('0x13')]);}})['catch'](function(_0x1469b1){logger[_0xd677('0x11')](_0xd677('0xc'),_0x9a982b,_0x1469b1);_0x3084d6(_0x1469b1);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 969be37..d080283 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 _0x79b4=['Router','fs-extra','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','util','path','connect-timeout'];(function(_0x5a6b45,_0x48fea6){var _0x2ad452=function(_0x57381c){while(--_0x57381c){_0x5a6b45['push'](_0x5a6b45['shift']());}};_0x2ad452(++_0x48fea6);}(_0x79b4,0x1dd));var _0x479b=function(_0x24547f,_0x39853e){_0x24547f=_0x24547f-0x0;var _0x464bdc=_0x79b4[_0x24547f];return _0x464bdc;};'use strict';var multer=require('multer');var util=require(_0x479b('0x0'));var path=require(_0x479b('0x1'));var timeout=require(_0x479b('0x2'));var express=require('express');var router=express[_0x479b('0x3')]();var fs_extra=require(_0x479b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x479b('0x5'));var controller=require(_0x479b('0x6'));router[_0x479b('0x7')]('/',auth[_0x479b('0x8')](),controller[_0x479b('0x9')]);router[_0x479b('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x479b('0x7')](_0x479b('0xa'),auth[_0x479b('0x8')](),controller[_0x479b('0xb')]);router[_0x479b('0xc')]('/',auth[_0x479b('0x8')](),controller[_0x479b('0xd')]);router[_0x479b('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x479b('0xa'),auth[_0x479b('0x8')](),controller[_0x479b('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe43a=['put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileSection.controller','get','/describe','isAuthenticated','/:id','create'];(function(_0x66cc59,_0x3b06cc){var _0x1ab3f8=function(_0x5c6aa6){while(--_0x5c6aa6){_0x66cc59['push'](_0x66cc59['shift']());}};_0x1ab3f8(++_0x3b06cc);}(_0xe43a,0x193));var _0xae43=function(_0x1b6aab,_0x5683f0){_0x1b6aab=_0x1b6aab-0x0;var _0x181f68=_0xe43a[_0x1b6aab];return _0x181f68;};'use strict';var multer=require(_0xae43('0x0'));var util=require('util');var path=require(_0xae43('0x1'));var timeout=require(_0xae43('0x2'));var express=require(_0xae43('0x3'));var router=express[_0xae43('0x4')]();var fs_extra=require(_0xae43('0x5'));var auth=require(_0xae43('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae43('0x7'));router[_0xae43('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xae43('0x8')](_0xae43('0x9'),auth[_0xae43('0xa')](),controller['describe']);router[_0xae43('0x8')](_0xae43('0xb'),auth[_0xae43('0xa')](),controller['show']);router['post']('/',auth[_0xae43('0xa')](),controller[_0xae43('0xc')]);router[_0xae43('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xae43('0xe')](_0xae43('0xb'),auth[_0xae43('0xa')](),controller['destroy']);module[_0xae43('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 72e3757..76777ce 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 _0xd4a2=['join','getDataValue','split','sequelize','STRING','BOOLEAN','setDataValue','crudPermissions'];(function(_0x42a81e,_0x58f0dd){var _0x3013ee=function(_0x3c1342){while(--_0x3c1342){_0x42a81e['push'](_0x42a81e['shift']());}};_0x3013ee(++_0x58f0dd);}(_0xd4a2,0x173));var _0x2d4a=function(_0xec122e,_0x12d8d0){_0xec122e=_0xec122e-0x0;var _0x2feef5=_0xd4a2[_0xec122e];return _0x2feef5;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x2d4a('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x2d4a('0x1')],'set':function(_0x5d435a){this[_0x2d4a('0x3')](_0x2d4a('0x4'),_0x5d435a?_0x5d435a[_0x2d4a('0x5')](''):[]);},'get':function(){return this[_0x2d4a('0x6')](_0x2d4a('0x4'))?this['getDataValue'](_0x2d4a('0x4'))[_0x2d4a('0x7')](''):[];}}}; \ No newline at end of file +var _0xea28=['crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x496a1f,_0x5558b4){var _0x1a7452=function(_0xded5d9){while(--_0xded5d9){_0x496a1f['push'](_0x496a1f['shift']());}};_0x1a7452(++_0x5558b4);}(_0xea28,0x13a));var _0x8ea2=function(_0x46bb81,_0x3b5cf9){_0x46bb81=_0x46bb81-0x0;var _0x1fa099=_0xea28[_0x46bb81];return _0x1fa099;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'name':{'type':Sequelize[_0x8ea2('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x8ea2('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8ea2('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x8ea2('0x2')],'set':function(_0x4b7cda){this[_0x8ea2('0x5')](_0x8ea2('0x6'),_0x4b7cda?_0x4b7cda[_0x8ea2('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0x8ea2('0x6'))?this[_0x8ea2('0x8')](_0x8ea2('0x6'))[_0x8ea2('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c98ad9a..64846f2 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 _0x8cc0=['intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','options','includeAll','findAll','rows','show','params','include','merge','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','count','status','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x4f6d16,_0x21f3de){var _0x85f1f9=function(_0x200599){while(--_0x200599){_0x4f6d16['push'](_0x4f6d16['shift']());}};_0x85f1f9(++_0x21f3de);}(_0x8cc0,0x199));var _0x08cc=function(_0x3af571,_0x19ce52){_0x3af571=_0x3af571-0x0;var _0xd749a1=_0x8cc0[_0x3af571];return _0xd749a1;};'use strict';var emlformat=require(_0x08cc('0x0'));var rimraf=require(_0x08cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x08cc('0x2'));var rp=require(_0x08cc('0x3'));var moment=require(_0x08cc('0x4'));var BPromise=require(_0x08cc('0x5'));var Mustache=require('mustache');var util=require(_0x08cc('0x6'));var path=require(_0x08cc('0x7'));var sox=require(_0x08cc('0x8'));var csv=require(_0x08cc('0x9'));var ejs=require(_0x08cc('0xa'));var fs=require('fs');var fs_extra=require(_0x08cc('0xb'));var _=require('lodash');var squel=require(_0x08cc('0xc'));var crypto=require(_0x08cc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x08cc('0xe'));var toCsv=require(_0x08cc('0x9'));var querystring=require('querystring');var Papa=require(_0x08cc('0xf'));var Redis=require('ioredis');var authService=require(_0x08cc('0x10'));var qs=require(_0x08cc('0x11'));var as=require(_0x08cc('0x12'));var hardwareService=require(_0x08cc('0x13'));var logger=require(_0x08cc('0x14'))(_0x08cc('0x15'));var utils=require(_0x08cc('0x16'));var config=require(_0x08cc('0x17'));var licenseUtil=require(_0x08cc('0x18'));var db=require(_0x08cc('0x19'))['db'];function respondWithStatusCode(_0xb3503e,_0x5717f1){_0x5717f1=_0x5717f1||0xcc;return function(_0x572510){if(_0x572510){return _0xb3503e['sendStatus'](_0x5717f1);}return _0xb3503e['status'](_0x5717f1)[_0x08cc('0x1a')]();};}function respondWithResult(_0x427da3,_0x56032d){_0x56032d=_0x56032d||0xc8;return function(_0x56f710){if(_0x56f710){return _0x427da3['status'](_0x56032d)['json'](_0x56f710);}};}function respondWithFilteredResult(_0x117b1a,_0x396deb){return function(_0x44b693){if(_0x44b693){var _0x51e34f=typeof _0x396deb[_0x08cc('0x1b')]===_0x08cc('0x1c')&&typeof _0x396deb['limit']===_0x08cc('0x1c');var _0x57417d=_0x44b693['count'];var _0x3450a2=_0x51e34f?0x0:_0x396deb[_0x08cc('0x1b')];var _0x33cd29=_0x51e34f?_0x44b693[_0x08cc('0x1d')]:_0x396deb['offset']+_0x396deb['limit'];var _0x1a42cc;if(_0x33cd29>=_0x57417d){_0x33cd29=_0x57417d;_0x1a42cc=0xc8;}else{_0x1a42cc=0xce;}_0x117b1a[_0x08cc('0x1e')](_0x1a42cc);return _0x117b1a[_0x08cc('0x1f')](_0x08cc('0x20'),_0x3450a2+'-'+_0x33cd29+'/'+_0x57417d)['json'](_0x44b693);}return null;};}function patchUpdates(_0x75bf7f){return function(_0x275395){try{jsonpatch['apply'](_0x275395,_0x75bf7f,!![]);}catch(_0xd71b42){return BPromise[_0x08cc('0x21')](_0xd71b42);}return _0x275395[_0x08cc('0x22')]();};}function saveUpdates(_0x582efe,_0x2419d2){return function(_0x207677){if(_0x207677){return _0x207677[_0x08cc('0x23')](_0x582efe)[_0x08cc('0x24')](function(_0x30db59){return _0x30db59;});}return null;};}function removeEntity(_0x19224c,_0x3d8af0){return function(_0x283229){if(_0x283229){return _0x283229[_0x08cc('0x25')]()['then'](function(){_0x19224c['status'](0xcc)[_0x08cc('0x1a')]();});}};}function handleEntityNotFound(_0x379940,_0x576aa9){return function(_0x116009){if(!_0x116009){_0x379940[_0x08cc('0x26')](0x194);}return _0x116009;};}function handleError(_0x4286b8,_0x444b14){_0x444b14=_0x444b14||0x1f4;return function(_0x5d7199){logger[_0x08cc('0x27')](_0x5d7199[_0x08cc('0x28')]);if(_0x5d7199[_0x08cc('0x29')]){delete _0x5d7199[_0x08cc('0x29')];}_0x4286b8[_0x08cc('0x1e')](_0x444b14)['send'](_0x5d7199);};}exports[_0x08cc('0x2a')]=function(_0xdc9f18,_0x5429a3){var _0x370ec5={},_0x3f9c29={},_0xb4fb1b={'count':0x0,'rows':[]};var _0x101b6e=_[_0x08cc('0x2b')](db[_0x08cc('0x2c')][_0x08cc('0x2d')],function(_0x4b7318){return{'name':_0x4b7318[_0x08cc('0x2e')],'type':_0x4b7318[_0x08cc('0x2f')][_0x08cc('0x30')]};});_0x3f9c29[_0x08cc('0x31')]=_['map'](_0x101b6e,_0x08cc('0x29'));_0x3f9c29[_0x08cc('0x32')]=_[_0x08cc('0x33')](_0xdc9f18[_0x08cc('0x32')]);_0x3f9c29[_0x08cc('0x34')]=_[_0x08cc('0x35')](_0x3f9c29['model'],_0x3f9c29[_0x08cc('0x32')]);_0x370ec5[_0x08cc('0x36')]=_[_0x08cc('0x35')](_0x3f9c29[_0x08cc('0x31')],qs[_0x08cc('0x37')](_0xdc9f18[_0x08cc('0x32')]['fields']));_0x370ec5[_0x08cc('0x36')]=_0x370ec5['attributes'][_0x08cc('0x38')]?_0x370ec5[_0x08cc('0x36')]:_0x3f9c29[_0x08cc('0x31')];if(!_0xdc9f18[_0x08cc('0x32')][_0x08cc('0x39')](_0x08cc('0x3a'))){_0x370ec5[_0x08cc('0x3b')]=qs[_0x08cc('0x3b')](_0xdc9f18[_0x08cc('0x32')][_0x08cc('0x3b')]);_0x370ec5[_0x08cc('0x1b')]=qs[_0x08cc('0x1b')](_0xdc9f18[_0x08cc('0x32')][_0x08cc('0x1b')]);}_0x370ec5['order']=qs[_0x08cc('0x3c')](_0xdc9f18[_0x08cc('0x32')]['sort']);_0x370ec5[_0x08cc('0x3d')]=qs['filters'](_[_0x08cc('0x3e')](_0xdc9f18[_0x08cc('0x32')],_0x3f9c29[_0x08cc('0x34')]),_0x101b6e);if(_0xdc9f18['query']['filter']){_0x370ec5[_0x08cc('0x3d')]=_['merge'](_0x370ec5[_0x08cc('0x3d')],{'$or':_['map'](_0x101b6e,function(_0x48c81a){if(_0x48c81a[_0x08cc('0x2f')]!=='VIRTUAL'){var _0xea9e28={};_0xea9e28[_0x48c81a[_0x08cc('0x29')]]={'$like':'%'+_0xdc9f18[_0x08cc('0x32')][_0x08cc('0x3f')]+'%'};return _0xea9e28;}})});}_0x370ec5=_['merge']({},_0x370ec5,_0xdc9f18[_0x08cc('0x40')]);var _0x385ee5={'where':_0x370ec5[_0x08cc('0x3d')]};return db['UserProfileSection'][_0x08cc('0x1d')](_0x385ee5)['then'](function(_0x23b06c){_0xb4fb1b['count']=_0x23b06c;if(_0xdc9f18['query'][_0x08cc('0x41')]){_0x370ec5['include']=[{'all':!![]}];}return db[_0x08cc('0x2c')][_0x08cc('0x42')](_0x370ec5);})[_0x08cc('0x24')](function(_0x3188ad){_0xb4fb1b[_0x08cc('0x43')]=_0x3188ad;return _0xb4fb1b;})[_0x08cc('0x24')](respondWithFilteredResult(_0x5429a3,_0x370ec5))['catch'](handleError(_0x5429a3,null));};exports[_0x08cc('0x44')]=function(_0x15cf88,_0x2e9056){var _0x48977c={'raw':![],'where':{'id':_0x15cf88[_0x08cc('0x45')]['id']}},_0x5a1642={};_0x5a1642[_0x08cc('0x31')]=_[_0x08cc('0x33')](db[_0x08cc('0x2c')][_0x08cc('0x2d')]);_0x5a1642[_0x08cc('0x32')]=_['keys'](_0x15cf88[_0x08cc('0x32')]);_0x5a1642[_0x08cc('0x34')]=_[_0x08cc('0x35')](_0x5a1642[_0x08cc('0x31')],_0x5a1642[_0x08cc('0x32')]);_0x48977c[_0x08cc('0x36')]=_['intersection'](_0x5a1642['model'],qs[_0x08cc('0x37')](_0x15cf88[_0x08cc('0x32')]['fields']));_0x48977c[_0x08cc('0x36')]=_0x48977c['attributes'][_0x08cc('0x38')]?_0x48977c['attributes']:_0x5a1642['model'];if(_0x15cf88[_0x08cc('0x32')][_0x08cc('0x41')]){_0x48977c[_0x08cc('0x46')]=[{'all':!![]}];}_0x48977c=_[_0x08cc('0x47')]({},_0x48977c,_0x15cf88[_0x08cc('0x40')]);return db['UserProfileSection'][_0x08cc('0x48')](_0x48977c)[_0x08cc('0x24')](handleEntityNotFound(_0x2e9056,null))[_0x08cc('0x24')](respondWithResult(_0x2e9056,null))['catch'](handleError(_0x2e9056,null));};exports[_0x08cc('0x49')]=function(_0x2f3209,_0x534ce6){return db[_0x08cc('0x2c')]['create'](_0x2f3209[_0x08cc('0x4a')],{})['then'](respondWithResult(_0x534ce6,0xc9))[_0x08cc('0x4b')](handleError(_0x534ce6,null));};exports[_0x08cc('0x23')]=function(_0xe471f0,_0x4881c6){if(_0xe471f0[_0x08cc('0x4a')]['id']){delete _0xe471f0[_0x08cc('0x4a')]['id'];}return db[_0x08cc('0x2c')]['find']({'where':{'id':_0xe471f0[_0x08cc('0x45')]['id']}})[_0x08cc('0x24')](handleEntityNotFound(_0x4881c6,null))['then'](saveUpdates(_0xe471f0[_0x08cc('0x4a')],null))['then'](respondWithResult(_0x4881c6,null))[_0x08cc('0x4b')](handleError(_0x4881c6,null));};exports[_0x08cc('0x25')]=function(_0x6fbea3,_0x305739){return db[_0x08cc('0x2c')][_0x08cc('0x48')]({'where':{'id':_0x6fbea3[_0x08cc('0x45')]['id']}})[_0x08cc('0x24')](handleEntityNotFound(_0x305739,null))[_0x08cc('0x24')](removeEntity(_0x305739,null))[_0x08cc('0x4b')](handleError(_0x305739,null));};exports[_0x08cc('0x4c')]=function(_0x41501b,_0xce6a06){return db[_0x08cc('0x2c')]['describe']()[_0x08cc('0x24')](respondWithResult(_0xce6a06,null))['catch'](handleError(_0xce6a06,null));}; \ No newline at end of file +var _0xb081=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','type','options','includeAll','include','rows','catch','params','intersection','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb081,0x14a));var _0x1b08=function(_0x608e20,_0x2c546d){_0x608e20=_0x608e20-0x0;var _0x5f498a=_0xb081[_0x608e20];return _0x5f498a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b08('0x0'));var zipdir=require(_0x1b08('0x1'));var jsonpatch=require(_0x1b08('0x2'));var rp=require(_0x1b08('0x3'));var moment=require(_0x1b08('0x4'));var BPromise=require(_0x1b08('0x5'));var Mustache=require(_0x1b08('0x6'));var util=require(_0x1b08('0x7'));var path=require(_0x1b08('0x8'));var sox=require(_0x1b08('0x9'));var csv=require(_0x1b08('0xa'));var ejs=require(_0x1b08('0xb'));var fs=require('fs');var fs_extra=require(_0x1b08('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1b08('0xa'));var querystring=require('querystring');var Papa=require(_0x1b08('0xd'));var Redis=require('ioredis');var authService=require(_0x1b08('0xe'));var qs=require(_0x1b08('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b08('0x10'))(_0x1b08('0x11'));var utils=require(_0x1b08('0x12'));var config=require(_0x1b08('0x13'));var licenseUtil=require(_0x1b08('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e7c89,_0x49705c){_0x49705c=_0x49705c||0xcc;return function(_0x12d32a){if(_0x12d32a){return _0x3e7c89['sendStatus'](_0x49705c);}return _0x3e7c89[_0x1b08('0x15')](_0x49705c)['end']();};}function respondWithResult(_0x36faaf,_0x2f553e){_0x2f553e=_0x2f553e||0xc8;return function(_0x447e3b){if(_0x447e3b){return _0x36faaf['status'](_0x2f553e)[_0x1b08('0x16')](_0x447e3b);}};}function respondWithFilteredResult(_0x599b1f,_0x321a48){return function(_0x34decf){if(_0x34decf){var _0x22c971=typeof _0x321a48[_0x1b08('0x17')]==='undefined'&&typeof _0x321a48['limit']===_0x1b08('0x18');var _0x51b7ba=_0x34decf[_0x1b08('0x19')];var _0x51e178=_0x22c971?0x0:_0x321a48[_0x1b08('0x17')];var _0xfcb75c=_0x22c971?_0x34decf['count']:_0x321a48['offset']+_0x321a48[_0x1b08('0x1a')];var _0x187ef8;if(_0xfcb75c>=_0x51b7ba){_0xfcb75c=_0x51b7ba;_0x187ef8=0xc8;}else{_0x187ef8=0xce;}_0x599b1f[_0x1b08('0x15')](_0x187ef8);return _0x599b1f[_0x1b08('0x1b')]('Content-Range',_0x51e178+'-'+_0xfcb75c+'/'+_0x51b7ba)[_0x1b08('0x16')](_0x34decf);}return null;};}function patchUpdates(_0x263ba6){return function(_0x345dcb){try{jsonpatch[_0x1b08('0x1c')](_0x345dcb,_0x263ba6,!![]);}catch(_0x144222){return BPromise[_0x1b08('0x1d')](_0x144222);}return _0x345dcb['save']();};}function saveUpdates(_0x2d692c,_0x1fb91a){return function(_0x223e36){if(_0x223e36){return _0x223e36[_0x1b08('0x1e')](_0x2d692c)[_0x1b08('0x1f')](function(_0xec96f0){return _0xec96f0;});}return null;};}function removeEntity(_0x53650b,_0xb9e026){return function(_0x2101fe){if(_0x2101fe){return _0x2101fe['destroy']()[_0x1b08('0x1f')](function(){_0x53650b[_0x1b08('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x244c7c,_0x46f517){return function(_0x2edd9c){if(!_0x2edd9c){_0x244c7c[_0x1b08('0x20')](0x194);}return _0x2edd9c;};}function handleError(_0x393454,_0x55f370){_0x55f370=_0x55f370||0x1f4;return function(_0x318ded){logger[_0x1b08('0x21')](_0x318ded[_0x1b08('0x22')]);if(_0x318ded[_0x1b08('0x23')]){delete _0x318ded[_0x1b08('0x23')];}_0x393454[_0x1b08('0x15')](_0x55f370)[_0x1b08('0x24')](_0x318ded);};}exports[_0x1b08('0x25')]=function(_0x534301,_0x1a96f4){var _0x515456={},_0x2be5c9={},_0xa599f3={'count':0x0,'rows':[]};var _0x43f45f=_[_0x1b08('0x26')](db[_0x1b08('0x27')][_0x1b08('0x28')],function(_0xaeb8ce){return{'name':_0xaeb8ce[_0x1b08('0x29')],'type':_0xaeb8ce['type']['key']};});_0x2be5c9[_0x1b08('0x2a')]=_['map'](_0x43f45f,_0x1b08('0x23'));_0x2be5c9[_0x1b08('0x2b')]=_[_0x1b08('0x2c')](_0x534301[_0x1b08('0x2b')]);_0x2be5c9[_0x1b08('0x2d')]=_['intersection'](_0x2be5c9['model'],_0x2be5c9[_0x1b08('0x2b')]);_0x515456[_0x1b08('0x2e')]=_['intersection'](_0x2be5c9['model'],qs['fields'](_0x534301['query'][_0x1b08('0x2f')]));_0x515456['attributes']=_0x515456[_0x1b08('0x2e')]['length']?_0x515456[_0x1b08('0x2e')]:_0x2be5c9[_0x1b08('0x2a')];if(!_0x534301[_0x1b08('0x2b')][_0x1b08('0x30')]('nolimit')){_0x515456[_0x1b08('0x1a')]=qs[_0x1b08('0x1a')](_0x534301[_0x1b08('0x2b')]['limit']);_0x515456['offset']=qs['offset'](_0x534301[_0x1b08('0x2b')][_0x1b08('0x17')]);}_0x515456[_0x1b08('0x31')]=qs['sort'](_0x534301[_0x1b08('0x2b')]['sort']);_0x515456[_0x1b08('0x32')]=qs[_0x1b08('0x2d')](_[_0x1b08('0x33')](_0x534301['query'],_0x2be5c9[_0x1b08('0x2d')]),_0x43f45f);if(_0x534301[_0x1b08('0x2b')][_0x1b08('0x34')]){_0x515456[_0x1b08('0x32')]=_[_0x1b08('0x35')](_0x515456[_0x1b08('0x32')],{'$or':_[_0x1b08('0x26')](_0x43f45f,function(_0x5e06cb){if(_0x5e06cb[_0x1b08('0x36')]!=='VIRTUAL'){var _0x1658a6={};_0x1658a6[_0x5e06cb[_0x1b08('0x23')]]={'$like':'%'+_0x534301[_0x1b08('0x2b')][_0x1b08('0x34')]+'%'};return _0x1658a6;}})});}_0x515456=_[_0x1b08('0x35')]({},_0x515456,_0x534301[_0x1b08('0x37')]);var _0x380fc4={'where':_0x515456['where']};return db[_0x1b08('0x27')][_0x1b08('0x19')](_0x380fc4)[_0x1b08('0x1f')](function(_0xc46959){_0xa599f3['count']=_0xc46959;if(_0x534301['query'][_0x1b08('0x38')]){_0x515456[_0x1b08('0x39')]=[{'all':!![]}];}return db[_0x1b08('0x27')]['findAll'](_0x515456);})[_0x1b08('0x1f')](function(_0x24c52a){_0xa599f3[_0x1b08('0x3a')]=_0x24c52a;return _0xa599f3;})[_0x1b08('0x1f')](respondWithFilteredResult(_0x1a96f4,_0x515456))[_0x1b08('0x3b')](handleError(_0x1a96f4,null));};exports['show']=function(_0x5beeb0,_0x2ff577){var _0x220e24={'raw':![],'where':{'id':_0x5beeb0[_0x1b08('0x3c')]['id']}},_0x12cb24={};_0x12cb24['model']=_[_0x1b08('0x2c')](db[_0x1b08('0x27')][_0x1b08('0x28')]);_0x12cb24[_0x1b08('0x2b')]=_[_0x1b08('0x2c')](_0x5beeb0[_0x1b08('0x2b')]);_0x12cb24['filters']=_[_0x1b08('0x3d')](_0x12cb24[_0x1b08('0x2a')],_0x12cb24[_0x1b08('0x2b')]);_0x220e24[_0x1b08('0x2e')]=_[_0x1b08('0x3d')](_0x12cb24[_0x1b08('0x2a')],qs['fields'](_0x5beeb0['query'][_0x1b08('0x2f')]));_0x220e24[_0x1b08('0x2e')]=_0x220e24['attributes'][_0x1b08('0x3e')]?_0x220e24['attributes']:_0x12cb24[_0x1b08('0x2a')];if(_0x5beeb0[_0x1b08('0x2b')]['includeAll']){_0x220e24[_0x1b08('0x39')]=[{'all':!![]}];}_0x220e24=_[_0x1b08('0x35')]({},_0x220e24,_0x5beeb0['options']);return db[_0x1b08('0x27')][_0x1b08('0x3f')](_0x220e24)['then'](handleEntityNotFound(_0x2ff577,null))['then'](respondWithResult(_0x2ff577,null))[_0x1b08('0x3b')](handleError(_0x2ff577,null));};exports[_0x1b08('0x40')]=function(_0x3afa7b,_0x188896){return db[_0x1b08('0x27')][_0x1b08('0x40')](_0x3afa7b[_0x1b08('0x41')],{})['then'](respondWithResult(_0x188896,0xc9))[_0x1b08('0x3b')](handleError(_0x188896,null));};exports[_0x1b08('0x1e')]=function(_0x277854,_0x58367b){if(_0x277854[_0x1b08('0x41')]['id']){delete _0x277854[_0x1b08('0x41')]['id'];}return db['UserProfileSection'][_0x1b08('0x3f')]({'where':{'id':_0x277854[_0x1b08('0x3c')]['id']}})[_0x1b08('0x1f')](handleEntityNotFound(_0x58367b,null))[_0x1b08('0x1f')](saveUpdates(_0x277854['body'],null))[_0x1b08('0x1f')](respondWithResult(_0x58367b,null))[_0x1b08('0x3b')](handleError(_0x58367b,null));};exports['destroy']=function(_0x60f774,_0x5841e9){return db['UserProfileSection'][_0x1b08('0x3f')]({'where':{'id':_0x60f774[_0x1b08('0x3c')]['id']}})[_0x1b08('0x1f')](handleEntityNotFound(_0x5841e9,null))[_0x1b08('0x1f')](removeEntity(_0x5841e9,null))['catch'](handleError(_0x5841e9,null));};exports[_0x1b08('0x42')]=function(_0x7bd774,_0x2ecbe9){return db[_0x1b08('0x27')][_0x1b08('0x42')]()[_0x1b08('0x1f')](respondWithResult(_0x2ecbe9,null))['catch'](handleError(_0x2ecbe9,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a92f972..f78b485 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 _0x3a53=['rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','request-promise'];(function(_0x511c79,_0xcdfa8f){var _0x28dd31=function(_0x47e9f0){while(--_0x47e9f0){_0x511c79['push'](_0x511c79['shift']());}};_0x28dd31(++_0xcdfa8f);}(_0x3a53,0x79));var _0x33a5=function(_0x110924,_0x1374bb){_0x110924=_0x110924-0x0;var _0x12905b=_0x3a53[_0x110924];return _0x12905b;};'use strict';var _=require('lodash');var util=require(_0x33a5('0x0'));var logger=require(_0x33a5('0x1'))(_0x33a5('0x2'));var moment=require(_0x33a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x33a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33a5('0x5'));var config=require('../../config/environment');var attributes=require(_0x33a5('0x6'));module[_0x33a5('0x7')]=function(_0x345465,_0x5f06b1){return _0x345465[_0x33a5('0x8')](_0x33a5('0x9'),attributes,{'tableName':_0x33a5('0xa'),'paranoid':![],'indexes':[{'name':_0x33a5('0xb'),'fields':[_0x33a5('0xc'),_0x33a5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f57=['moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger'];(function(_0xa37354,_0x2561c9){var _0x4f1396=function(_0x2bb57b){while(--_0x2bb57b){_0xa37354['push'](_0xa37354['shift']());}};_0x4f1396(++_0x2561c9);}(_0x1f57,0x131));var _0x71f5=function(_0x1d6272,_0x544701){_0x1d6272=_0x1d6272-0x0;var _0x1d352c=_0x1f57[_0x1d6272];return _0x1d352c;};'use strict';var _=require(_0x71f5('0x0'));var util=require(_0x71f5('0x1'));var logger=require(_0x71f5('0x2'))('api');var moment=require(_0x71f5('0x3'));var BPromise=require(_0x71f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71f5('0x5'));var rimraf=require(_0x71f5('0x6'));var config=require(_0x71f5('0x7'));var attributes=require(_0x71f5('0x8'));module[_0x71f5('0x9')]=function(_0x243d80,_0x20575f){return _0x243d80['define'](_0x71f5('0xa'),attributes,{'tableName':_0x71f5('0xb'),'paranoid':![],'indexes':[{'name':_0x71f5('0xc'),'fields':['sectionId',_0x71f5('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 5792c33..f127e07 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 _0x3e3f=['../../config/logger','rpc','jayson/promise','client','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0x3e3f,0xa6));var _0xf3e3=function(_0x1ae9b8,_0x375264){_0x1ae9b8=_0x1ae9b8-0x0;var _0x30599d=_0x3e3f[_0x1ae9b8];return _0x30599d;};'use strict';var _=require(_0xf3e3('0x0'));var util=require(_0xf3e3('0x1'));var moment=require('moment');var BPromise=require(_0xf3e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3e3('0x3'));var db=require(_0xf3e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf3e3('0x5'))(_0xf3e3('0x6'));var config=require('../../config/environment');var jayson=require(_0xf3e3('0x7'));var client=jayson[_0xf3e3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cfc81,_0x45e81d,_0x583d9){return new BPromise(function(_0x1e8a3d,_0x86228){return client['request'](_0x2cfc81,_0x583d9)['then'](function(_0x4da3ff){logger[_0xf3e3('0x9')](_0xf3e3('0xa'),_0x45e81d,_0xf3e3('0xb'));logger[_0xf3e3('0xc')](_0xf3e3('0xd'),_0x45e81d,_0xf3e3('0xb'),JSON['stringify'](_0x4da3ff));if(_0x4da3ff[_0xf3e3('0xe')]){if(_0x4da3ff[_0xf3e3('0xe')][_0xf3e3('0xf')]===0x1f4){logger[_0xf3e3('0xe')](_0xf3e3('0xa'),_0x45e81d,_0x4da3ff[_0xf3e3('0xe')][_0xf3e3('0x10')]);return _0x86228(_0x4da3ff[_0xf3e3('0xe')][_0xf3e3('0x10')]);}logger['error'](_0xf3e3('0xa'),_0x45e81d,_0x4da3ff[_0xf3e3('0xe')][_0xf3e3('0x10')]);return _0x1e8a3d(_0x4da3ff[_0xf3e3('0xe')][_0xf3e3('0x10')]);}else{logger[_0xf3e3('0x9')](_0xf3e3('0xa'),_0x45e81d,_0xf3e3('0xb'));_0x1e8a3d(_0x4da3ff[_0xf3e3('0x11')][_0xf3e3('0x10')]);}})[_0xf3e3('0x12')](function(_0x32f414){logger[_0xf3e3('0xe')](_0xf3e3('0xa'),_0x45e81d,_0x32f414);_0x86228(_0x32f414);});});} \ No newline at end of file +var _0x446e=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x446e,0x1f0));var _0xe446=function(_0x56935e,_0x5051a1){_0x56935e=_0x56935e-0x0;var _0x4c25d2=_0x446e[_0x56935e];return _0x4c25d2;};'use strict';var _=require(_0xe446('0x0'));var util=require(_0xe446('0x1'));var moment=require('moment');var BPromise=require(_0xe446('0x2'));var rs=require(_0xe446('0x3'));var fs=require('fs');var Redis=require(_0xe446('0x4'));var db=require(_0xe446('0x5'))['db'];var utils=require(_0xe446('0x6'));var logger=require(_0xe446('0x7'))(_0xe446('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe446('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5db313,_0x2b73dc,_0x18ca2a){return new BPromise(function(_0x37455e,_0x1dad4a){return client[_0xe446('0xa')](_0x5db313,_0x18ca2a)['then'](function(_0x435e49){logger['info'](_0xe446('0xb'),_0x2b73dc,_0xe446('0xc'));logger['debug'](_0xe446('0xd'),_0x2b73dc,'request\x20sent',JSON[_0xe446('0xe')](_0x435e49));if(_0x435e49[_0xe446('0xf')]){if(_0x435e49['error']['code']===0x1f4){logger[_0xe446('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x2b73dc,_0x435e49[_0xe446('0xf')]['message']);return _0x1dad4a(_0x435e49[_0xe446('0xf')][_0xe446('0x10')]);}logger[_0xe446('0xf')](_0xe446('0xb'),_0x2b73dc,_0x435e49[_0xe446('0xf')]['message']);return _0x37455e(_0x435e49[_0xe446('0xf')][_0xe446('0x10')]);}else{logger['info'](_0xe446('0xb'),_0x2b73dc,'request\x20sent');_0x37455e(_0x435e49[_0xe446('0x11')][_0xe446('0x10')]);}})[_0xe446('0x12')](function(_0x213f36){logger[_0xe446('0xf')](_0xe446('0xb'),_0x2b73dc,_0x213f36);_0x1dad4a(_0x213f36);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index bd857c7..578906a 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4a7756,_0x97b450){var _0x26b489=function(_0x1147e9){while(--_0x1147e9){_0x4a7756['push'](_0x4a7756['shift']());}};_0x26b489(++_0x97b450);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x41c445,_0x3c8bd0){var _0x607bb6=function(_0x742ae4){while(--_0x742ae4){_0x41c445['push'](_0x41c445['shift']());}};_0x607bb6(++_0x3c8bd0);}(_0x70e0,0x17b));var _0x070e=function(_0x5b3530,_0x551156){_0x5b3530=_0x5b3530-0x0;var _0x2dcbfe=_0x70e0[_0x5b3530];return _0x2dcbfe;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 0979d2a..9006424 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc73e=['INTEGER','sequelize','exports'];(function(_0xb6c8fe,_0x502c27){var _0x368d55=function(_0x927b3d){while(--_0x927b3d){_0xb6c8fe['push'](_0xb6c8fe['shift']());}};_0x368d55(++_0x502c27);}(_0xc73e,0x1c3));var _0xec73=function(_0x154b05,_0x3188f3){_0x154b05=_0x154b05-0x0;var _0x4475f9=_0xc73e[_0x154b05];return _0x4475f9;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'penalty':{'type':Sequelize[_0xec73('0x2')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 2cc7671..64ffffe 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 _0xba34=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x329c21,_0x1d1548){var _0x353b8f=function(_0x33af04){while(--_0x33af04){_0x329c21['push'](_0x329c21['shift']());}};_0x353b8f(++_0x1d1548);}(_0xba34,0x119));var _0x4ba3=function(_0x5539b0,_0xbce1e3){_0x5539b0=_0x5539b0-0x0;var _0x3931ca=_0xba34[_0x5539b0];return _0x3931ca;};'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')]('UserSmsQueue',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x444e=['moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','../../config/logger'];(function(_0xa14d8c,_0x14759b){var _0x3facda=function(_0x13c866){while(--_0x13c866){_0xa14d8c['push'](_0xa14d8c['shift']());}};_0x3facda(++_0x14759b);}(_0x444e,0xe8));var _0xe444=function(_0x4cc8f4,_0x4ecf9b){_0x4cc8f4=_0x4cc8f4-0x0;var _0x232089=_0x444e[_0x4cc8f4];return _0x232089;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var logger=require(_0xe444('0x1'))('api');var moment=require(_0xe444('0x2'));var BPromise=require('bluebird');var rp=require(_0xe444('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var attributes=require(_0xe444('0x6'));module[_0xe444('0x7')]=function(_0x36ac3b,_0x1ddb27){return _0x36ac3b['define'](_0xe444('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 44ec10c..dd793d3 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 _0x4f0c=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3ed26c,_0xab6b81){var _0x20074a=function(_0xd2a4d5){while(--_0xd2a4d5){_0x3ed26c['push'](_0x3ed26c['shift']());}};_0x20074a(++_0xab6b81);}(_0x4f0c,0x165));var _0xc4f0=function(_0x42ccf3,_0x1f07d0){_0x42ccf3=_0x42ccf3-0x0;var _0x23acaf=_0x4f0c[_0x42ccf3];return _0x23acaf;};'use strict';var _=require(_0xc4f0('0x0'));var util=require('util');var moment=require(_0xc4f0('0x1'));var BPromise=require(_0xc4f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4f0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4f0('0x4'));var logger=require(_0xc4f0('0x5'))(_0xc4f0('0x6'));var config=require(_0xc4f0('0x7'));var jayson=require(_0xc4f0('0x8'));var client=jayson['client'][_0xc4f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x434169,_0x2db2da,_0x1a2c79){return new BPromise(function(_0x391072,_0x2f8c0b){return client[_0xc4f0('0xa')](_0x434169,_0x1a2c79)[_0xc4f0('0xb')](function(_0x555901){logger['info'](_0xc4f0('0xc'),_0x2db2da,'request\x20sent');logger[_0xc4f0('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2db2da,_0xc4f0('0xe'),JSON[_0xc4f0('0xf')](_0x555901));if(_0x555901[_0xc4f0('0x10')]){if(_0x555901[_0xc4f0('0x10')][_0xc4f0('0x11')]===0x1f4){logger[_0xc4f0('0x10')](_0xc4f0('0xc'),_0x2db2da,_0x555901['error'][_0xc4f0('0x12')]);return _0x2f8c0b(_0x555901[_0xc4f0('0x10')][_0xc4f0('0x12')]);}logger[_0xc4f0('0x10')](_0xc4f0('0xc'),_0x2db2da,_0x555901[_0xc4f0('0x10')]['message']);return _0x391072(_0x555901[_0xc4f0('0x10')][_0xc4f0('0x12')]);}else{logger['info'](_0xc4f0('0xc'),_0x2db2da,'request\x20sent');_0x391072(_0x555901[_0xc4f0('0x13')]['message']);}})[_0xc4f0('0x14')](function(_0x320aa5){logger[_0xc4f0('0x10')](_0xc4f0('0xc'),_0x2db2da,_0x320aa5);_0x2f8c0b(_0x320aa5);});});} \ No newline at end of file +var _0x8894=['../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x8894,0x17f));var _0x4889=function(_0x23e20b,_0xce166d){_0x23e20b=_0x23e20b-0x0;var _0x2c58ed=_0x8894[_0x23e20b];return _0x2c58ed;};'use strict';var _=require(_0x4889('0x0'));var util=require(_0x4889('0x1'));var moment=require('moment');var BPromise=require(_0x4889('0x2'));var rs=require(_0x4889('0x3'));var fs=require('fs');var Redis=require(_0x4889('0x4'));var db=require(_0x4889('0x5'))['db'];var utils=require(_0x4889('0x6'));var logger=require('../../config/logger')(_0x4889('0x7'));var config=require(_0x4889('0x8'));var jayson=require(_0x4889('0x9'));var client=jayson[_0x4889('0xa')][_0x4889('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34c08b,_0x25f55c,_0x4097fe){return new BPromise(function(_0x1c0664,_0x18246d){return client[_0x4889('0xc')](_0x34c08b,_0x4097fe)[_0x4889('0xd')](function(_0x3c6efd){logger[_0x4889('0xe')](_0x4889('0xf'),_0x25f55c,_0x4889('0x10'));logger[_0x4889('0x11')](_0x4889('0x12'),_0x25f55c,_0x4889('0x10'),JSON['stringify'](_0x3c6efd));if(_0x3c6efd[_0x4889('0x13')]){if(_0x3c6efd[_0x4889('0x13')]['code']===0x1f4){logger[_0x4889('0x13')](_0x4889('0xf'),_0x25f55c,_0x3c6efd[_0x4889('0x13')][_0x4889('0x14')]);return _0x18246d(_0x3c6efd[_0x4889('0x13')]['message']);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x25f55c,_0x3c6efd[_0x4889('0x13')][_0x4889('0x14')]);return _0x1c0664(_0x3c6efd[_0x4889('0x13')][_0x4889('0x14')]);}else{logger[_0x4889('0xe')](_0x4889('0xf'),_0x25f55c,_0x4889('0x10'));_0x1c0664(_0x3c6efd[_0x4889('0x15')][_0x4889('0x14')]);}})[_0x4889('0x16')](function(_0x2621dc){logger['error'](_0x4889('0xf'),_0x25f55c,_0x2621dc);_0x18246d(_0x2621dc);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 4539d5c..6b552a9 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x403f5f,_0x283f67){var _0x15b1cd=function(_0x238cab){while(--_0x238cab){_0x403f5f['push'](_0x403f5f['shift']());}};_0x15b1cd(++_0x283f67);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x98437e,_0xb36d0f){var _0x1c044c=function(_0x814fa4){while(--_0x814fa4){_0x98437e['push'](_0x98437e['shift']());}};_0x1c044c(++_0xb36d0f);}(_0xe706,0xa3));var _0x6e70=function(_0x32f845,_0x335cb9){_0x32f845=_0x32f845-0x0;var _0x3c0de4=_0xe706[_0x32f845];return _0x3c0de4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 7a3ebac..489fed9 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 _0xe351=['sequelize','exports','INTEGER'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xe351,0x10b));var _0x1e35=function(_0x2e4846,_0x13a3ca){_0x2e4846=_0x2e4846-0x0;var _0x3f04ec=_0xe351[_0x2e4846];return _0x3f04ec;};'use strict';var Sequelize=require(_0x1e35('0x0'));module[_0x1e35('0x1')]={'penalty':{'type':Sequelize[_0x1e35('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ca3=['INTEGER'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0x7ca3,0xa3));var _0x37ca=function(_0x3d6db1,_0x4358f8){_0x3d6db1=_0x3d6db1-0x0;var _0x5e1cc3=_0x7ca3[_0x3d6db1];return _0x5e1cc3;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x37ca('0x0')],'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 afb34d5..c076420 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 _0xc174=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x558b11,_0x5bae8a){var _0xbe442e=function(_0x292b06){while(--_0x292b06){_0x558b11['push'](_0x558b11['shift']());}};_0xbe442e(++_0x5bae8a);}(_0xc174,0x1c2));var _0x4c17=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0xc174[_0x2d6197];return _0x4d0e75;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c17('0x0'))(_0x4c17('0x1'));var moment=require(_0x4c17('0x2'));var BPromise=require(_0x4c17('0x3'));var rp=require(_0x4c17('0x4'));var fs=require('fs');var path=require(_0x4c17('0x5'));var rimraf=require(_0x4c17('0x6'));var config=require(_0x4c17('0x7'));var attributes=require(_0x4c17('0x8'));module[_0x4c17('0x9')]=function(_0x265af6,_0x4493e5){return _0x265af6[_0x4c17('0xa')](_0x4c17('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4542=['define','UserVoiceQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x7afdbb,_0x151626){var _0x307cb8=function(_0x42c612){while(--_0x42c612){_0x7afdbb['push'](_0x7afdbb['shift']());}};_0x307cb8(++_0x151626);}(_0x4542,0x1f0));var _0x2454=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4542[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2454('0x0'));var util=require(_0x2454('0x1'));var logger=require(_0x2454('0x2'))('api');var moment=require(_0x2454('0x3'));var BPromise=require(_0x2454('0x4'));var rp=require(_0x2454('0x5'));var fs=require('fs');var path=require(_0x2454('0x6'));var rimraf=require(_0x2454('0x7'));var config=require(_0x2454('0x8'));var attributes=require(_0x2454('0x9'));module[_0x2454('0xa')]=function(_0x554c0b,_0x49d22c){return _0x554c0b[_0x2454('0xb')](_0x2454('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 2e3f95c..e54cbb0 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 _0xcc3f=['http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x43bc2c,_0x2fee08){var _0x40b0f9=function(_0x173180){while(--_0x173180){_0x43bc2c['push'](_0x43bc2c['shift']());}};_0x40b0f9(++_0x2fee08);}(_0xcc3f,0x108));var _0xfcc3=function(_0x4a260b,_0x332190){_0x4a260b=_0x4a260b-0x0;var _0x4cb5ed=_0xcc3f[_0x4a260b];return _0x4cb5ed;};'use strict';var _=require(_0xfcc3('0x0'));var util=require('util');var moment=require(_0xfcc3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcc3('0x2'));var db=require(_0xfcc3('0x3'))['db'];var utils=require(_0xfcc3('0x4'));var logger=require('../../config/logger')(_0xfcc3('0x5'));var config=require(_0xfcc3('0x6'));var jayson=require(_0xfcc3('0x7'));var client=jayson[_0xfcc3('0x8')][_0xfcc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb73662,_0x23b2cc,_0x3f33f3){return new BPromise(function(_0x5d7d73,_0x48fa0b){return client[_0xfcc3('0xa')](_0xb73662,_0x3f33f3)[_0xfcc3('0xb')](function(_0x516205){logger[_0xfcc3('0xc')](_0xfcc3('0xd'),_0x23b2cc,'request\x20sent');logger[_0xfcc3('0xe')](_0xfcc3('0xf'),_0x23b2cc,_0xfcc3('0x10'),JSON[_0xfcc3('0x11')](_0x516205));if(_0x516205['error']){if(_0x516205[_0xfcc3('0x12')]['code']===0x1f4){logger[_0xfcc3('0x12')](_0xfcc3('0xd'),_0x23b2cc,_0x516205[_0xfcc3('0x12')]['message']);return _0x48fa0b(_0x516205[_0xfcc3('0x12')][_0xfcc3('0x13')]);}logger[_0xfcc3('0x12')](_0xfcc3('0xd'),_0x23b2cc,_0x516205[_0xfcc3('0x12')][_0xfcc3('0x13')]);return _0x5d7d73(_0x516205['error'][_0xfcc3('0x13')]);}else{logger[_0xfcc3('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x23b2cc,_0xfcc3('0x10'));_0x5d7d73(_0x516205[_0xfcc3('0x14')][_0xfcc3('0x13')]);}})['catch'](function(_0xf60c67){logger['error'](_0xfcc3('0xd'),_0x23b2cc,_0xf60c67);_0x48fa0b(_0xf60c67);});});} \ No newline at end of file +var _0x6481=['request','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0x6481,0x1c2));var _0x1648=function(_0x3a3125,_0x352202){_0x3a3125=_0x3a3125-0x0;var _0x2bb9e9=_0x6481[_0x3a3125];return _0x2bb9e9;};'use strict';var _=require(_0x1648('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1648('0x1'));var rs=require(_0x1648('0x2'));var fs=require('fs');var Redis=require(_0x1648('0x3'));var db=require(_0x1648('0x4'))['db'];var utils=require(_0x1648('0x5'));var logger=require(_0x1648('0x6'))(_0x1648('0x7'));var config=require(_0x1648('0x8'));var jayson=require(_0x1648('0x9'));var client=jayson[_0x1648('0xa')][_0x1648('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7ebc4d,_0x134d2c,_0x1c6ae5){return new BPromise(function(_0x30d33a,_0x487836){return client[_0x1648('0xc')](_0x7ebc4d,_0x1c6ae5)['then'](function(_0x5d87cb){logger[_0x1648('0xd')](_0x1648('0xe'),_0x134d2c,'request\x20sent');logger[_0x1648('0xf')](_0x1648('0x10'),_0x134d2c,_0x1648('0x11'),JSON['stringify'](_0x5d87cb));if(_0x5d87cb[_0x1648('0x12')]){if(_0x5d87cb[_0x1648('0x12')]['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x134d2c,_0x5d87cb[_0x1648('0x12')]['message']);return _0x487836(_0x5d87cb[_0x1648('0x12')]['message']);}logger['error'](_0x1648('0xe'),_0x134d2c,_0x5d87cb[_0x1648('0x12')][_0x1648('0x13')]);return _0x30d33a(_0x5d87cb['error'][_0x1648('0x13')]);}else{logger[_0x1648('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x134d2c,_0x1648('0x11'));_0x30d33a(_0x5d87cb[_0x1648('0x14')]['message']);}})['catch'](function(_0x5a4b80){logger['error'](_0x1648('0xe'),_0x134d2c,_0x5a4b80);_0x487836(_0x5a4b80);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f2dece0..1ea27f9 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x152241,_0x792b71){var _0x58851b=function(_0x26c629){while(--_0x26c629){_0x152241['push'](_0x152241['shift']());}};_0x58851b(++_0x792b71);}(_0xe706,0xa3));var _0x6e70=function(_0x2158a8,_0x335f85){_0x2158a8=_0x2158a8-0x0;var _0x4b1071=_0xe706[_0x2158a8];return _0x4b1071;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf868ee,_0x15368a){var _0x4d3c3d=function(_0x28c44c){while(--_0x28c44c){_0xf868ee['push'](_0xf868ee['shift']());}};_0x4d3c3d(++_0x15368a);}(_0xe706,0xa3));var _0x6e70=function(_0x41f02b,_0x2ca2f0){_0x41f02b=_0x41f02b-0x0;var _0x3411eb=_0xe706[_0x41f02b];return _0x3411eb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index aeb4139..8113fc3 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 _0xfe52=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xfe52,0x1c1));var _0x2fe5=function(_0x97ff02,_0x1d94f0){_0x97ff02=_0x97ff02-0x0;var _0x262ff0=_0xfe52[_0x97ff02];return _0x262ff0;};'use strict';var Sequelize=require(_0x2fe5('0x0'));module[_0x2fe5('0x1')]={'uniqueid':{'type':Sequelize[_0x2fe5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x2fe5('0x3')},'UserId':{'type':Sequelize[_0x2fe5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2fe5('0x4')],'allowNull':![],'unique':_0x2fe5('0x5'),'comment':_0x2fe5('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x2fe5('0x4')],'allowNull':![],'unique':_0x2fe5('0x5'),'comment':_0x2fe5('0x3')},'penalty':{'type':Sequelize[_0x2fe5('0x2')](0xb),'defaultValue':0x0,'comment':_0x2fe5('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x2fe5('0x3')}}; \ No newline at end of file +var _0xf34f=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf34f,0x16b));var _0xff34=function(_0x452e70,_0x1c452f){_0x452e70=_0x452e70-0x0;var _0x1ef15c=_0xf34f[_0x452e70];return _0x1ef15c;};'use strict';var Sequelize=require(_0xff34('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xff34('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xff34('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xff34('0x2')},'UserId':{'type':Sequelize[_0xff34('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xff34('0x3')],'allowNull':![],'unique':_0xff34('0x4'),'comment':_0xff34('0x2')},'VoiceQueueId':{'type':Sequelize[_0xff34('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xff34('0x3')],'allowNull':![],'unique':_0xff34('0x4'),'comment':_0xff34('0x2')},'penalty':{'type':Sequelize[_0xff34('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 61d1ae7..c8e6276 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 _0x65ec=['../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3d9b26,_0x10488e){var _0x29b59b=function(_0x182d8a){while(--_0x182d8a){_0x3d9b26['push'](_0x3d9b26['shift']());}};_0x29b59b(++_0x10488e);}(_0x65ec,0x171));var _0xc65e=function(_0x1d8a7a,_0x29c7a6){_0x1d8a7a=_0x1d8a7a-0x0;var _0x5968cb=_0x65ec[_0x1d8a7a];return _0x5968cb;};'use strict';var EventEmitter=require(_0xc65e('0x0'));var UserVoiceQueueRt=require(_0xc65e('0x1'))['db'][_0xc65e('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc65e('0x3'),'afterUpdate':_0xc65e('0x4'),'afterDestroy':_0xc65e('0x5')};function emitEvent(_0x5cc30a){return function(_0x288b83,_0xac6625,_0x5d8f2f){UserVoiceQueueRtEvents[_0xc65e('0x6')](_0x5cc30a+':'+_0x288b83['id'],_0x288b83);UserVoiceQueueRtEvents[_0xc65e('0x6')](_0x5cc30a,_0x288b83);_0x5d8f2f(null);};}for(var e in events){if(events[_0xc65e('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xc65e('0x8')](e,emitEvent(event));}}module[_0xc65e('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x435c=['exports','../../mysqldb','setMaxListeners','update','remove','hasOwnProperty','hook'];(function(_0x1ac3cf,_0x2fedab){var _0x411de8=function(_0x33ebf7){while(--_0x33ebf7){_0x1ac3cf['push'](_0x1ac3cf['shift']());}};_0x411de8(++_0x2fedab);}(_0x435c,0x8d));var _0xc435=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x435c[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xc435('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc435('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc435('0x2'),'afterDestroy':_0xc435('0x3')};function emitEvent(_0x5b2984){return function(_0x5b5c2c,_0x5020db,_0x59a915){UserVoiceQueueRtEvents['emit'](_0x5b2984+':'+_0x5b5c2c['id'],_0x5b5c2c);UserVoiceQueueRtEvents['emit'](_0x5b2984,_0x5b5c2c);_0x59a915(null);};}for(var e in events){if(events[_0xc435('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0xc435('0x5')](e,emitEvent(event));}}module[_0xc435('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ec32e21..d323460 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 _0xaeaa=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','lodash','util','../../config/logger','api','moment','path'];(function(_0x516e43,_0x5c4608){var _0x39ed15=function(_0x2fbe5c){while(--_0x2fbe5c){_0x516e43['push'](_0x516e43['shift']());}};_0x39ed15(++_0x5c4608);}(_0xaeaa,0x14f));var _0xaaea=function(_0x123ae9,_0x1fd8de){_0x123ae9=_0x123ae9-0x0;var _0x292b18=_0xaeaa[_0x123ae9];return _0x292b18;};'use strict';var _=require(_0xaaea('0x0'));var util=require(_0xaaea('0x1'));var logger=require(_0xaaea('0x2'))(_0xaaea('0x3'));var moment=require(_0xaaea('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaaea('0x5'));var rimraf=require(_0xaaea('0x6'));var config=require(_0xaaea('0x7'));var attributes=require(_0xaaea('0x8'));module['exports']=function(_0x816d72,_0x314241){return _0x816d72[_0xaaea('0x9')](_0xaaea('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a4e=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a4e,0x8c));var _0xe7a4=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x7a4e[_0x2ab76b];return _0x201126;};'use strict';var _=require('lodash');var util=require(_0xe7a4('0x0'));var logger=require(_0xe7a4('0x1'))('api');var moment=require(_0xe7a4('0x2'));var BPromise=require(_0xe7a4('0x3'));var rp=require(_0xe7a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe7a4('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xe7a4('0x6')]=function(_0xf46b59,_0x5062ec){return _0xf46b59[_0xe7a4('0x7')](_0xe7a4('0x8'),attributes,{'tableName':_0xe7a4('0x9'),'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 d28b216..5718bc1 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 _0x165f=['then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request'];(function(_0xa22151,_0x1d49ad){var _0x3b0131=function(_0x48d66c){while(--_0x48d66c){_0xa22151['push'](_0xa22151['shift']());}};_0x3b0131(++_0x1d49ad);}(_0x165f,0xaa));var _0xf165=function(_0x3910a2,_0x551446){_0x3910a2=_0x3910a2-0x0;var _0xc9d8cd=_0x165f[_0x3910a2];return _0xc9d8cd;};'use strict';var _=require('lodash');var util=require(_0xf165('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf165('0x1'));var fs=require('fs');var Redis=require(_0xf165('0x2'));var db=require(_0xf165('0x3'))['db'];var utils=require(_0xf165('0x4'));var logger=require(_0xf165('0x5'))(_0xf165('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf165('0x7')]['http']({'port':0x232a});config['redis']=_[_0xf165('0x8')](config[_0xf165('0x9')],{'host':_0xf165('0xa'),'port':0x18eb});var socket=require(_0xf165('0xb'))(new Redis(config[_0xf165('0x9')]));require(_0xf165('0xc'))[_0xf165('0xd')](socket);function respondWithRpcPromise(_0x59f59b,_0x648e3c,_0x356515){return new BPromise(function(_0x108830,_0x42482a){return client[_0xf165('0xe')](_0x59f59b,_0x356515)[_0xf165('0xf')](function(_0x46c6b5){logger[_0xf165('0x10')](_0xf165('0x11'),_0x648e3c,_0xf165('0x12'));logger[_0xf165('0x13')](_0xf165('0x14'),_0x648e3c,_0xf165('0x12'),JSON[_0xf165('0x15')](_0x46c6b5));if(_0x46c6b5['error']){if(_0x46c6b5[_0xf165('0x16')][_0xf165('0x17')]===0x1f4){logger[_0xf165('0x16')](_0xf165('0x11'),_0x648e3c,_0x46c6b5[_0xf165('0x16')][_0xf165('0x18')]);return _0x42482a(_0x46c6b5['error'][_0xf165('0x18')]);}logger[_0xf165('0x16')](_0xf165('0x11'),_0x648e3c,_0x46c6b5[_0xf165('0x16')][_0xf165('0x18')]);return _0x108830(_0x46c6b5['error'][_0xf165('0x18')]);}else{logger[_0xf165('0x10')](_0xf165('0x11'),_0x648e3c,'request\x20sent');_0x108830(_0x46c6b5['result']['message']);}})[_0xf165('0x19')](function(_0x31a0e7){logger[_0xf165('0x16')](_0xf165('0x11'),_0x648e3c,_0x31a0e7);_0x42482a(_0x31a0e7);});});}exports['GetVoiceQueueRtPauses']=function(_0x5952d0){var _0xcca677=this;return new Promise(function(_0x3dd327,_0x5462a0){return db[_0xf165('0x1a')][_0xf165('0x1b')]({'raw':_0x5952d0[_0xf165('0x1c')]?_0x5952d0[_0xf165('0x1c')][_0xf165('0x1d')]===undefined?!![]:![]:!![],'where':_0x5952d0[_0xf165('0x1c')]?_0x5952d0['options'][_0xf165('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf165('0x1f'),db[_0xf165('0x20')]['fn']('IF',db['sequelize'][_0xf165('0x21')](_0xf165('0x22')))),_0xf165('0x23')]]})['then'](function(_0x30fcd9){logger[_0xf165('0x10')](_0xf165('0x24'),_0x5952d0);logger[_0xf165('0x13')](_0xf165('0x24'),_0x5952d0,JSON[_0xf165('0x15')](_0x30fcd9));_0x3dd327(_0x30fcd9);})[_0xf165('0x19')](function(_0x400be1){logger[_0xf165('0x16')](_0xf165('0x24'),_0x400be1[_0xf165('0x18')],_0x5952d0);_0x5462a0(_0xcca677['error'](0x1f4,_0x400be1[_0xf165('0x18')]));});});}; \ No newline at end of file +var _0x20b0=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize'];(function(_0x15bbae,_0x5a2a74){var _0x3b1ee1=function(_0x1b36f8){while(--_0x1b36f8){_0x15bbae['push'](_0x15bbae['shift']());}};_0x3b1ee1(++_0x5a2a74);}(_0x20b0,0x150));var _0x020b=function(_0x3166bc,_0x5739bf){_0x3166bc=_0x3166bc-0x0;var _0x3f6778=_0x20b0[_0x3166bc];return _0x3f6778;};'use strict';var _=require(_0x020b('0x0'));var util=require(_0x020b('0x1'));var moment=require(_0x020b('0x2'));var BPromise=require(_0x020b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x020b('0x4'));var db=require(_0x020b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x020b('0x6'));var config=require(_0x020b('0x7'));var jayson=require(_0x020b('0x8'));var client=jayson[_0x020b('0x9')][_0x020b('0xa')]({'port':0x232a});config[_0x020b('0xb')]=_['defaults'](config[_0x020b('0xb')],{'host':_0x020b('0xc'),'port':0x18eb});var socket=require(_0x020b('0xd'))(new Redis(config[_0x020b('0xb')]));require(_0x020b('0xe'))[_0x020b('0xf')](socket);function respondWithRpcPromise(_0x2040db,_0x36a274,_0x510fd8){return new BPromise(function(_0xc7ed3b,_0x579b14){return client[_0x020b('0x10')](_0x2040db,_0x510fd8)[_0x020b('0x11')](function(_0x52190e){logger[_0x020b('0x12')](_0x020b('0x13'),_0x36a274,_0x020b('0x14'));logger[_0x020b('0x15')](_0x020b('0x16'),_0x36a274,_0x020b('0x14'),JSON[_0x020b('0x17')](_0x52190e));if(_0x52190e['error']){if(_0x52190e['error']['code']===0x1f4){logger[_0x020b('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x36a274,_0x52190e['error'][_0x020b('0x19')]);return _0x579b14(_0x52190e[_0x020b('0x18')]['message']);}logger[_0x020b('0x18')](_0x020b('0x13'),_0x36a274,_0x52190e[_0x020b('0x18')][_0x020b('0x19')]);return _0xc7ed3b(_0x52190e['error']['message']);}else{logger[_0x020b('0x12')](_0x020b('0x13'),_0x36a274,'request\x20sent');_0xc7ed3b(_0x52190e[_0x020b('0x1a')][_0x020b('0x19')]);}})['catch'](function(_0x15b68b){logger[_0x020b('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x36a274,_0x15b68b);_0x579b14(_0x15b68b);});});}exports[_0x020b('0x1b')]=function(_0x1054a9){var _0x3abddf=this;return new Promise(function(_0x26f28a,_0x14d6c1){return db[_0x020b('0x1c')][_0x020b('0x1d')]({'raw':_0x1054a9[_0x020b('0x1e')]?_0x1054a9['options'][_0x020b('0x1f')]===undefined?!![]:![]:!![],'where':_0x1054a9[_0x020b('0x1e')]?_0x1054a9[_0x020b('0x1e')][_0x020b('0x20')]||null:null,'attributes':[[db[_0x020b('0x21')]['fn'](_0x020b('0x22'),db[_0x020b('0x21')]['fn']('IF',db[_0x020b('0x21')][_0x020b('0x23')](_0x020b('0x24')))),'outboundQueuePauses']]})[_0x020b('0x11')](function(_0x3bb5d5){logger[_0x020b('0x12')]('GetVoiceQueueRtPauses',_0x1054a9);logger['debug'](_0x020b('0x1b'),_0x1054a9,JSON[_0x020b('0x17')](_0x3bb5d5));_0x26f28a(_0x3bb5d5);})['catch'](function(_0x1284fc){logger['error'](_0x020b('0x1b'),_0x1284fc[_0x020b('0x19')],_0x1054a9);_0x14d6c1(_0x3abddf[_0x020b('0x18')](0x1f4,_0x1284fc[_0x020b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index db9ed5a..cfb6c34 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 _0xbd3c=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','register'];(function(_0x156b75,_0x2778d7){var _0x472179=function(_0x4fddb7){while(--_0x4fddb7){_0x156b75['push'](_0x156b75['shift']());}};_0x472179(++_0x2778d7);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x2f5a99,_0x139add){_0x2f5a99=_0x2f5a99-0x0;var _0xa98877=_0xbd3c[_0x2f5a99];return _0xa98877;};'use strict';var UserVoiceQueueRtEvents=require(_0xcbd3('0x0'));var events=[_0xcbd3('0x1'),_0xcbd3('0x2'),'update'];function createListener(_0x24258c,_0x8e3cbe){return function(_0x45274b){_0x8e3cbe['emit'](_0x24258c,_0x45274b);};}function removeListener(_0x505967,_0x2b7178){return function(){UserVoiceQueueRtEvents['removeListener'](_0x505967,_0x2b7178);};}exports[_0xcbd3('0x3')]=function(_0x3e5103){for(var _0x5b27a3=0x0,_0x348468=events[_0xcbd3('0x4')];_0x5b27a3<_0x348468;_0x5b27a3++){var _0x13b4aa=events[_0x5b27a3];var _0x4b369b=createListener(_0xcbd3('0x5')+_0x13b4aa,_0x3e5103);UserVoiceQueueRtEvents['on'](_0x13b4aa,_0x4b369b);}}; \ No newline at end of file +var _0x0686=['update','removeListener','register','length','./userVoiceQueueRt.events','save','remove'];(function(_0x32800c,_0x1d8e18){var _0x672d72=function(_0x8de39f){while(--_0x8de39f){_0x32800c['push'](_0x32800c['shift']());}};_0x672d72(++_0x1d8e18);}(_0x0686,0x123));var _0x6068=function(_0x391e8e,_0x210711){_0x391e8e=_0x391e8e-0x0;var _0x22465d=_0x0686[_0x391e8e];return _0x22465d;};'use strict';var UserVoiceQueueRtEvents=require(_0x6068('0x0'));var events=[_0x6068('0x1'),_0x6068('0x2'),_0x6068('0x3')];function createListener(_0x199954,_0x408d70){return function(_0xe6eb70){_0x408d70['emit'](_0x199954,_0xe6eb70);};}function removeListener(_0x22449d,_0x4ccea4){return function(){UserVoiceQueueRtEvents[_0x6068('0x4')](_0x22449d,_0x4ccea4);};}exports[_0x6068('0x5')]=function(_0x2d4dd0){for(var _0x3e5dfd=0x0,_0x37489b=events[_0x6068('0x6')];_0x3e5dfd<_0x37489b;_0x3e5dfd++){var _0x3eb140=events[_0x3e5dfd];var _0x4e0ccf=createListener('userVoiceQueueRt:'+_0x3eb140,_0x2d4dd0);UserVoiceQueueRtEvents['on'](_0x3eb140,_0x4e0ccf);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index fe62e2d..505c4b9 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1828ee,_0x5db35c){var _0x26b4b8=function(_0x2b9065){while(--_0x2b9065){_0x1828ee['push'](_0x1828ee['shift']());}};_0x26b4b8(++_0x5db35c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2a2385,_0x483814){var _0x2c75=function(_0x1991da){while(--_0x1991da){_0x2a2385['push'](_0x2a2385['shift']());}};_0x2c75(++_0x483814);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 559a1c2..41705f4 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 _0x15ad=['sequelize','exports','INTEGER'];(function(_0x371148,_0x592e7a){var _0x4818b0=function(_0x256562){while(--_0x256562){_0x371148['push'](_0x371148['shift']());}};_0x4818b0(++_0x592e7a);}(_0x15ad,0x19b));var _0xd15a=function(_0x50e4a4,_0x349a88){_0x50e4a4=_0x50e4a4-0x0;var _0x206f04=_0x15ad[_0x50e4a4];return _0x206f04;};'use strict';var Sequelize=require(_0xd15a('0x0'));module[_0xd15a('0x1')]={'penalty':{'type':Sequelize[_0xd15a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9dc4=['exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9dc4,0x1e6));var _0x49dc=function(_0x2be66a,_0x4d9ae1){_0x2be66a=_0x2be66a-0x0;var _0x1691fa=_0x9dc4[_0x2be66a];return _0x1691fa;};'use strict';var Sequelize=require('sequelize');module[_0x49dc('0x0')]={'penalty':{'type':Sequelize[_0x49dc('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 de9751d..781d17e 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 _0xf8e3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0x576451,_0x62b2e){var _0x21fb5d=function(_0x567a92){while(--_0x567a92){_0x576451['push'](_0x576451['shift']());}};_0x21fb5d(++_0x62b2e);}(_0xf8e3,0x16a));var _0x3f8e=function(_0x9b01d9,_0x4802b0){_0x9b01d9=_0x9b01d9-0x0;var _0x401588=_0xf8e3[_0x9b01d9];return _0x401588;};'use strict';var _=require(_0x3f8e('0x0'));var util=require(_0x3f8e('0x1'));var logger=require(_0x3f8e('0x2'))(_0x3f8e('0x3'));var moment=require(_0x3f8e('0x4'));var BPromise=require(_0x3f8e('0x5'));var rp=require(_0x3f8e('0x6'));var fs=require('fs');var path=require(_0x3f8e('0x7'));var rimraf=require(_0x3f8e('0x8'));var config=require(_0x3f8e('0x9'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x4d699e,_0x41c521){return _0x4d699e[_0x3f8e('0xa')](_0x3f8e('0xb'),attributes,{'tableName':_0x3f8e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd49f=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x249aba,_0x3ee677){var _0x24e51d=function(_0x332b5c){while(--_0x332b5c){_0x249aba['push'](_0x249aba['shift']());}};_0x24e51d(++_0x3ee677);}(_0xd49f,0x1d4));var _0xfd49=function(_0x2a416a,_0x2f0660){_0x2a416a=_0x2a416a-0x0;var _0x52bb59=_0xd49f[_0x2a416a];return _0x52bb59;};'use strict';var _=require(_0xfd49('0x0'));var util=require(_0xfd49('0x1'));var logger=require(_0xfd49('0x2'))(_0xfd49('0x3'));var moment=require(_0xfd49('0x4'));var BPromise=require(_0xfd49('0x5'));var rp=require(_0xfd49('0x6'));var fs=require('fs');var path=require(_0xfd49('0x7'));var rimraf=require(_0xfd49('0x8'));var config=require(_0xfd49('0x9'));var attributes=require(_0xfd49('0xa'));module[_0xfd49('0xb')]=function(_0xe73b57,_0x1fb75b){return _0xe73b57[_0xfd49('0xc')](_0xfd49('0xd'),attributes,{'tableName':_0xfd49('0xe'),'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 4330df3..c3033a4 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 _0x285a=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','util'];(function(_0x4fd540,_0x4de6c7){var _0x735bb2=function(_0x12e12d){while(--_0x12e12d){_0x4fd540['push'](_0x4fd540['shift']());}};_0x735bb2(++_0x4de6c7);}(_0x285a,0xee));var _0xa285=function(_0xc66f98,_0x4aaa1f){_0xc66f98=_0xc66f98-0x0;var _0x5d411d=_0x285a[_0xc66f98];return _0x5d411d;};'use strict';var _=require(_0xa285('0x0'));var util=require(_0xa285('0x1'));var moment=require(_0xa285('0x2'));var BPromise=require(_0xa285('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa285('0x4'));var db=require(_0xa285('0x5'))['db'];var utils=require(_0xa285('0x6'));var logger=require(_0xa285('0x7'))('rpc');var config=require(_0xa285('0x8'));var jayson=require(_0xa285('0x9'));var client=jayson[_0xa285('0xa')][_0xa285('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58f38d,_0x4d7802,_0x3cdad1){return new BPromise(function(_0x49e845,_0x5717ed){return client['request'](_0x58f38d,_0x3cdad1)[_0xa285('0xc')](function(_0x34ef3d){logger['info'](_0xa285('0xd'),_0x4d7802,'request\x20sent');logger[_0xa285('0xe')](_0xa285('0xf'),_0x4d7802,_0xa285('0x10'),JSON[_0xa285('0x11')](_0x34ef3d));if(_0x34ef3d['error']){if(_0x34ef3d['error'][_0xa285('0x12')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x4d7802,_0x34ef3d[_0xa285('0x13')][_0xa285('0x14')]);return _0x5717ed(_0x34ef3d[_0xa285('0x13')][_0xa285('0x14')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x4d7802,_0x34ef3d['error'][_0xa285('0x14')]);return _0x49e845(_0x34ef3d[_0xa285('0x13')]['message']);}else{logger[_0xa285('0x15')](_0xa285('0xd'),_0x4d7802,_0xa285('0x10'));_0x49e845(_0x34ef3d[_0xa285('0x16')][_0xa285('0x14')]);}})[_0xa285('0x17')](function(_0x29dab1){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x4d7802,_0x29dab1);_0x5717ed(_0x29dab1);});});} \ No newline at end of file +var _0x2f31=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x57898a,_0x16b175){var _0x15998d=function(_0xb2aea3){while(--_0xb2aea3){_0x57898a['push'](_0x57898a['shift']());}};_0x15998d(++_0x16b175);}(_0x2f31,0x147));var _0x12f3=function(_0x2183e7,_0x48656f){_0x2183e7=_0x2183e7-0x0;var _0x11d5e6=_0x2f31[_0x2183e7];return _0x11d5e6;};'use strict';var _=require(_0x12f3('0x0'));var util=require(_0x12f3('0x1'));var moment=require(_0x12f3('0x2'));var BPromise=require(_0x12f3('0x3'));var rs=require(_0x12f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12f3('0x5'))['db'];var utils=require(_0x12f3('0x6'));var logger=require(_0x12f3('0x7'))(_0x12f3('0x8'));var config=require(_0x12f3('0x9'));var jayson=require(_0x12f3('0xa'));var client=jayson[_0x12f3('0xb')][_0x12f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22a528,_0x44aa12,_0x4b40fb){return new BPromise(function(_0x2bb7d4,_0x50efb1){return client['request'](_0x22a528,_0x4b40fb)[_0x12f3('0xd')](function(_0x1eab58){logger[_0x12f3('0xe')](_0x12f3('0xf'),_0x44aa12,_0x12f3('0x10'));logger['debug'](_0x12f3('0x11'),_0x44aa12,_0x12f3('0x10'),JSON['stringify'](_0x1eab58));if(_0x1eab58[_0x12f3('0x12')]){if(_0x1eab58[_0x12f3('0x12')][_0x12f3('0x13')]===0x1f4){logger[_0x12f3('0x12')](_0x12f3('0xf'),_0x44aa12,_0x1eab58[_0x12f3('0x12')][_0x12f3('0x14')]);return _0x50efb1(_0x1eab58['error'][_0x12f3('0x14')]);}logger[_0x12f3('0x12')](_0x12f3('0xf'),_0x44aa12,_0x1eab58[_0x12f3('0x12')][_0x12f3('0x14')]);return _0x2bb7d4(_0x1eab58[_0x12f3('0x12')][_0x12f3('0x14')]);}else{logger[_0x12f3('0xe')](_0x12f3('0xf'),_0x44aa12,'request\x20sent');_0x2bb7d4(_0x1eab58[_0x12f3('0x15')][_0x12f3('0x14')]);}})[_0x12f3('0x16')](function(_0x192561){logger[_0x12f3('0x12')](_0x12f3('0xf'),_0x44aa12,_0x192561);_0x50efb1(_0x192561);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 4134fac..18272df 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 _0xbd3b=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','isAuthenticated','get','/:id','post','create','put','update','delete'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x371187,_0xe7b303){_0x371187=_0x371187-0x0;var _0x37eaae=_0xbd3b[_0x371187];return _0x37eaae;};'use strict';var multer=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var path=require(_0xbbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbd3('0x3'));var router=express[_0xbbd3('0x4')]();var fs_extra=require(_0xbbd3('0x5'));var auth=require(_0xbbd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd3('0x7'));var controller=require(_0xbbd3('0x8'));router['get']('/',auth[_0xbbd3('0x9')](),controller['index']);router[_0xbbd3('0xa')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller['show']);router[_0xbbd3('0xc')]('/',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xd')]);router[_0xbbd3('0xe')]('/:id',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xf')]);router[_0xbbd3('0x10')](_0xbbd3('0xb'),auth['isAuthenticated'](),controller[_0xbbd3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8ece=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x1c16e9,_0x77ea3c){var _0xeba40c=function(_0x3458ce){while(--_0x3458ce){_0x1c16e9['push'](_0x1c16e9['shift']());}};_0xeba40c(++_0x77ea3c);}(_0x8ece,0x195));var _0xe8ec=function(_0xf0f7ba,_0x48be70){_0xf0f7ba=_0xf0f7ba-0x0;var _0x44382c=_0x8ece[_0xf0f7ba];return _0x44382c;};'use strict';var multer=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var path=require(_0xe8ec('0x2'));var timeout=require(_0xe8ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe8ec('0x4'));var auth=require(_0xe8ec('0x5'));var interaction=require(_0xe8ec('0x6'));var config=require(_0xe8ec('0x7'));var controller=require(_0xe8ec('0x8'));router['get']('/',auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xa')]);router[_0xe8ec('0xb')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xd')]);router[_0xe8ec('0xe')]('/',auth['isAuthenticated'](),controller[_0xe8ec('0xf')]);router['put'](_0xe8ec('0xc'),auth['isAuthenticated'](),controller[_0xe8ec('0x10')]);router[_0xe8ec('0x11')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x12')]);module[_0xe8ec('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 1ca9520..d66f6a8 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 _0xac2c=['name','STRING'];(function(_0x2667c8,_0x54b375){var _0x2a178b=function(_0x332160){while(--_0x332160){_0x2667c8['push'](_0x2667c8['shift']());}};_0x2a178b(++_0x54b375);}(_0xac2c,0x195));var _0xcac2=function(_0x364390,_0x46b408){_0x364390=_0x364390-0x0;var _0x3cf60d=_0xac2c[_0x364390];return _0x3cf60d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcac2('0x0')],'unique':_0xcac2('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcac2('0x0')]}}; \ No newline at end of file +var _0x4049=['exports','STRING','sequelize'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x4049,0x17c));var _0x9404=function(_0x3adc9f,_0x5d49d5){_0x3adc9f=_0x3adc9f-0x0;var _0x432a40=_0x4049[_0x3adc9f];return _0x432a40;};'use strict';var Sequelize=require(_0x9404('0x0'));module[_0x9404('0x1')]={'name':{'type':Sequelize[_0x9404('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9404('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 9562ed0..f35f3de 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 _0xc3bc=['stack','name','send','index','map','Variable','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','get','Variables','UserProfileResource','error'];(function(_0x531664,_0x723a7b){var _0x118f52=function(_0x5e7c73){while(--_0x5e7c73){_0x531664['push'](_0x531664['shift']());}};_0x118f52(++_0x723a7b);}(_0xc3bc,0x78));var _0xcc3b=function(_0x233640,_0x5ab7b8){_0x233640=_0x233640-0x0;var _0x2d31ac=_0xc3bc[_0x233640];return _0x2d31ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc3b('0x0'));var zipdir=require(_0xcc3b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc3b('0x2'));var moment=require('moment');var BPromise=require(_0xcc3b('0x3'));var Mustache=require(_0xcc3b('0x4'));var util=require(_0xcc3b('0x5'));var path=require('path');var sox=require(_0xcc3b('0x6'));var csv=require(_0xcc3b('0x7'));var ejs=require(_0xcc3b('0x8'));var fs=require('fs');var fs_extra=require(_0xcc3b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc3b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcc3b('0xb'));var Redis=require(_0xcc3b('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcc3b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc3b('0xe'))(_0xcc3b('0xf'));var utils=require(_0xcc3b('0x10'));var config=require(_0xcc3b('0x11'));var licenseUtil=require(_0xcc3b('0x12'));var db=require(_0xcc3b('0x13'))['db'];function respondWithStatusCode(_0x31e0e4,_0x5b48ee){_0x5b48ee=_0x5b48ee||0xcc;return function(_0x5d9393){if(_0x5d9393){return _0x31e0e4[_0xcc3b('0x14')](_0x5b48ee);}return _0x31e0e4[_0xcc3b('0x15')](_0x5b48ee)[_0xcc3b('0x16')]();};}function respondWithResult(_0x5c7b16,_0x5f4497){_0x5f4497=_0x5f4497||0xc8;return function(_0x42a375){if(_0x42a375){return _0x5c7b16[_0xcc3b('0x15')](_0x5f4497)['json'](_0x42a375);}};}function respondWithFilteredResult(_0x4f6424,_0x42e54a){return function(_0x13ab3b){if(_0x13ab3b){var _0xc5eb05=typeof _0x42e54a[_0xcc3b('0x17')]===_0xcc3b('0x18')&&typeof _0x42e54a[_0xcc3b('0x19')]===_0xcc3b('0x18');var _0x26373c=_0x13ab3b[_0xcc3b('0x1a')];var _0x24c872=_0xc5eb05?0x0:_0x42e54a[_0xcc3b('0x17')];var _0x3c50a7=_0xc5eb05?_0x13ab3b[_0xcc3b('0x1a')]:_0x42e54a[_0xcc3b('0x17')]+_0x42e54a['limit'];var _0x2875a6;if(_0x3c50a7>=_0x26373c){_0x3c50a7=_0x26373c;_0x2875a6=0xc8;}else{_0x2875a6=0xce;}_0x4f6424['status'](_0x2875a6);return _0x4f6424[_0xcc3b('0x1b')](_0xcc3b('0x1c'),_0x24c872+'-'+_0x3c50a7+'/'+_0x26373c)[_0xcc3b('0x1d')](_0x13ab3b);}return null;};}function patchUpdates(_0x1a3d2e){return function(_0x34f9e7){try{jsonpatch[_0xcc3b('0x1e')](_0x34f9e7,_0x1a3d2e,!![]);}catch(_0x356a30){return BPromise['reject'](_0x356a30);}return _0x34f9e7[_0xcc3b('0x1f')]();};}function saveUpdates(_0x15f11c,_0x3c2884){return function(_0x5b80f4){if(_0x5b80f4){return _0x5b80f4['update'](_0x15f11c)['then'](function(_0x157db6){return _0x157db6;});}return null;};}function removeEntity(_0x222449,_0x36cfaf){return function(_0x5273d4){if(_0x5273d4){return _0x5273d4[_0xcc3b('0x20')]()[_0xcc3b('0x21')](function(){var _0x159639=_0x5273d4[_0xcc3b('0x22')]({'plain':!![]});var _0x45e624=_0xcc3b('0x23');return db[_0xcc3b('0x24')][_0xcc3b('0x20')]({'where':{'type':_0x45e624,'resourceId':_0x159639['id']}})[_0xcc3b('0x21')](function(){return _0x5273d4;});})[_0xcc3b('0x21')](function(){_0x222449[_0xcc3b('0x15')](0xcc)[_0xcc3b('0x16')]();});}};}function handleEntityNotFound(_0x28a33d,_0x3508d5){return function(_0x51c077){if(!_0x51c077){_0x28a33d[_0xcc3b('0x14')](0x194);}return _0x51c077;};}function handleError(_0x3b6f9f,_0x41110a){_0x41110a=_0x41110a||0x1f4;return function(_0xbe4476){logger[_0xcc3b('0x25')](_0xbe4476[_0xcc3b('0x26')]);if(_0xbe4476[_0xcc3b('0x27')]){delete _0xbe4476[_0xcc3b('0x27')];}_0x3b6f9f[_0xcc3b('0x15')](_0x41110a)[_0xcc3b('0x28')](_0xbe4476);};}exports[_0xcc3b('0x29')]=function(_0x10327f,_0x3e1fb3){var _0x1154b7={},_0x387590={},_0x86d6e={'count':0x0,'rows':[]};var _0x10063c=_[_0xcc3b('0x2a')](db[_0xcc3b('0x2b')]['rawAttributes'],function(_0x1c9510){return{'name':_0x1c9510[_0xcc3b('0x2c')],'type':_0x1c9510[_0xcc3b('0x2d')]['key']};});_0x387590[_0xcc3b('0x2e')]=_['map'](_0x10063c,_0xcc3b('0x27'));_0x387590[_0xcc3b('0x2f')]=_[_0xcc3b('0x30')](_0x10327f['query']);_0x387590[_0xcc3b('0x31')]=_[_0xcc3b('0x32')](_0x387590['model'],_0x387590['query']);_0x1154b7[_0xcc3b('0x33')]=_[_0xcc3b('0x32')](_0x387590['model'],qs[_0xcc3b('0x34')](_0x10327f[_0xcc3b('0x2f')][_0xcc3b('0x34')]));_0x1154b7['attributes']=_0x1154b7[_0xcc3b('0x33')][_0xcc3b('0x35')]?_0x1154b7['attributes']:_0x387590[_0xcc3b('0x2e')];if(!_0x10327f[_0xcc3b('0x2f')][_0xcc3b('0x36')](_0xcc3b('0x37'))){_0x1154b7[_0xcc3b('0x19')]=qs[_0xcc3b('0x19')](_0x10327f[_0xcc3b('0x2f')]['limit']);_0x1154b7[_0xcc3b('0x17')]=qs['offset'](_0x10327f[_0xcc3b('0x2f')]['offset']);}_0x1154b7[_0xcc3b('0x38')]=qs[_0xcc3b('0x39')](_0x10327f[_0xcc3b('0x2f')][_0xcc3b('0x39')]);_0x1154b7[_0xcc3b('0x3a')]=qs[_0xcc3b('0x31')](_['pick'](_0x10327f[_0xcc3b('0x2f')],_0x387590['filters']),_0x10063c);if(_0x10327f[_0xcc3b('0x2f')]['filter']){_0x1154b7[_0xcc3b('0x3a')]=_['merge'](_0x1154b7[_0xcc3b('0x3a')],{'$or':_['map'](_0x10063c,function(_0x62bf9e){if(_0x62bf9e[_0xcc3b('0x2d')]!==_0xcc3b('0x3b')){var _0x35b92a={};_0x35b92a[_0x62bf9e[_0xcc3b('0x27')]]={'$like':'%'+_0x10327f[_0xcc3b('0x2f')][_0xcc3b('0x3c')]+'%'};return _0x35b92a;}})});}_0x1154b7=_[_0xcc3b('0x3d')]({},_0x1154b7,_0x10327f['options']);var _0x363cd3={'where':_0x1154b7[_0xcc3b('0x3a')]};return db[_0xcc3b('0x2b')]['count'](_0x363cd3)[_0xcc3b('0x21')](function(_0x41f51b){_0x86d6e[_0xcc3b('0x1a')]=_0x41f51b;if(_0x10327f[_0xcc3b('0x2f')][_0xcc3b('0x3e')]){_0x1154b7[_0xcc3b('0x3f')]=[{'all':!![]}];}return db[_0xcc3b('0x2b')]['findAll'](_0x1154b7);})['then'](function(_0x31584b){_0x86d6e[_0xcc3b('0x40')]=_0x31584b;return _0x86d6e;})[_0xcc3b('0x21')](respondWithFilteredResult(_0x3e1fb3,_0x1154b7))[_0xcc3b('0x41')](handleError(_0x3e1fb3,null));};exports['show']=function(_0x4cc194,_0x14b90b){var _0x286eb3={'raw':!![],'where':{'id':_0x4cc194['params']['id']}},_0x371008={};_0x371008['model']=_[_0xcc3b('0x30')](db['Variable'][_0xcc3b('0x42')]);_0x371008['query']=_[_0xcc3b('0x30')](_0x4cc194['query']);_0x371008[_0xcc3b('0x31')]=_['intersection'](_0x371008[_0xcc3b('0x2e')],_0x371008[_0xcc3b('0x2f')]);_0x286eb3[_0xcc3b('0x33')]=_[_0xcc3b('0x32')](_0x371008[_0xcc3b('0x2e')],qs[_0xcc3b('0x34')](_0x4cc194[_0xcc3b('0x2f')][_0xcc3b('0x34')]));_0x286eb3['attributes']=_0x286eb3[_0xcc3b('0x33')]['length']?_0x286eb3[_0xcc3b('0x33')]:_0x371008['model'];if(_0x4cc194[_0xcc3b('0x2f')]['includeAll']){_0x286eb3[_0xcc3b('0x3f')]=[{'all':!![]}];}_0x286eb3=_[_0xcc3b('0x3d')]({},_0x286eb3,_0x4cc194[_0xcc3b('0x43')]);return db['Variable'][_0xcc3b('0x44')](_0x286eb3)[_0xcc3b('0x21')](handleEntityNotFound(_0x14b90b,null))[_0xcc3b('0x21')](respondWithResult(_0x14b90b,null))['catch'](handleError(_0x14b90b,null));};exports[_0xcc3b('0x45')]=function(_0x51d966,_0x4ee94d){return db[_0xcc3b('0x2b')][_0xcc3b('0x45')](_0x51d966[_0xcc3b('0x46')],{})[_0xcc3b('0x21')](function(_0xcc9361){var _0x210dfd=_0x51d966[_0xcc3b('0x47')][_0xcc3b('0x22')]({'plain':!![]});if(!_0x210dfd)throw new Error(_0xcc3b('0x48'));if(_0x210dfd['role']===_0xcc3b('0x47')){var _0x182c9d=_0xcc9361[_0xcc3b('0x22')]({'plain':!![]});var _0x1bfac7=_0xcc3b('0x23');return db[_0xcc3b('0x49')]['find']({'where':{'name':_0x1bfac7,'userProfileId':_0x210dfd[_0xcc3b('0x4a')]},'raw':!![]})['then'](function(_0x3f94b1){if(_0x3f94b1&&_0x3f94b1[_0xcc3b('0x4b')]===0x0){return db['UserProfileResource'][_0xcc3b('0x45')]({'name':_0x182c9d['name'],'resourceId':_0x182c9d['id'],'type':_0x3f94b1[_0xcc3b('0x27')],'sectionId':_0x3f94b1['id']},{})['then'](function(){return _0xcc9361;});}else{return _0xcc9361;}})[_0xcc3b('0x41')](function(_0x396f2b){logger[_0xcc3b('0x25')](_0xcc3b('0x4c'),_0x396f2b);throw _0x396f2b;});}return _0xcc9361;})[_0xcc3b('0x21')](respondWithResult(_0x4ee94d,0xc9))['catch'](handleError(_0x4ee94d,null));};exports[_0xcc3b('0x4d')]=function(_0x270851,_0xe256ba){if(_0x270851[_0xcc3b('0x46')]['id']){delete _0x270851[_0xcc3b('0x46')]['id'];}return db[_0xcc3b('0x2b')]['find']({'where':{'id':_0x270851[_0xcc3b('0x4e')]['id']}})[_0xcc3b('0x21')](handleEntityNotFound(_0xe256ba,null))[_0xcc3b('0x21')](saveUpdates(_0x270851[_0xcc3b('0x46')],null))['then'](respondWithResult(_0xe256ba,null))[_0xcc3b('0x41')](handleError(_0xe256ba,null));};exports[_0xcc3b('0x20')]=function(_0x595a6a,_0x1302e9){return db[_0xcc3b('0x2b')]['find']({'where':{'id':_0x595a6a[_0xcc3b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1302e9,null))['then'](removeEntity(_0x1302e9,null))[_0xcc3b('0x41')](handleError(_0x1302e9,null));}; \ No newline at end of file +var _0x1830=['update','then','destroy','Variables','UserProfileResource','error','stack','send','index','map','Variable','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x55affd,_0xaa69f4){var _0x3cc6c5=function(_0x28bbc4){while(--_0x28bbc4){_0x55affd['push'](_0x55affd['shift']());}};_0x3cc6c5(++_0xaa69f4);}(_0x1830,0x129));var _0x0183=function(_0x111c47,_0x2c867b){_0x111c47=_0x111c47-0x0;var _0x30790f=_0x1830[_0x111c47];return _0x30790f;};'use strict';var emlformat=require(_0x0183('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0183('0x1'));var jsonpatch=require(_0x0183('0x2'));var rp=require(_0x0183('0x3'));var moment=require(_0x0183('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0183('0x5'));var util=require(_0x0183('0x6'));var path=require(_0x0183('0x7'));var sox=require(_0x0183('0x8'));var csv=require(_0x0183('0x9'));var ejs=require(_0x0183('0xa'));var fs=require('fs');var fs_extra=require(_0x0183('0xb'));var _=require(_0x0183('0xc'));var squel=require(_0x0183('0xd'));var crypto=require(_0x0183('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0183('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0183('0x10'));var Redis=require(_0x0183('0x11'));var authService=require(_0x0183('0x12'));var qs=require(_0x0183('0x13'));var as=require(_0x0183('0x14'));var hardwareService=require(_0x0183('0x15'));var logger=require('../../config/logger')(_0x0183('0x16'));var utils=require(_0x0183('0x17'));var config=require(_0x0183('0x18'));var licenseUtil=require(_0x0183('0x19'));var db=require(_0x0183('0x1a'))['db'];function respondWithStatusCode(_0x4cc7c0,_0x3ce73e){_0x3ce73e=_0x3ce73e||0xcc;return function(_0x248d55){if(_0x248d55){return _0x4cc7c0[_0x0183('0x1b')](_0x3ce73e);}return _0x4cc7c0[_0x0183('0x1c')](_0x3ce73e)[_0x0183('0x1d')]();};}function respondWithResult(_0x1f0429,_0x28afd6){_0x28afd6=_0x28afd6||0xc8;return function(_0x3596a9){if(_0x3596a9){return _0x1f0429[_0x0183('0x1c')](_0x28afd6)[_0x0183('0x1e')](_0x3596a9);}};}function respondWithFilteredResult(_0x11e4df,_0x312863){return function(_0xe17fc5){if(_0xe17fc5){var _0x5c191b=typeof _0x312863[_0x0183('0x1f')]===_0x0183('0x20')&&typeof _0x312863[_0x0183('0x21')]===_0x0183('0x20');var _0x488511=_0xe17fc5['count'];var _0x3a04df=_0x5c191b?0x0:_0x312863[_0x0183('0x1f')];var _0x7cc9ea=_0x5c191b?_0xe17fc5[_0x0183('0x22')]:_0x312863[_0x0183('0x1f')]+_0x312863[_0x0183('0x21')];var _0x1a29a3;if(_0x7cc9ea>=_0x488511){_0x7cc9ea=_0x488511;_0x1a29a3=0xc8;}else{_0x1a29a3=0xce;}_0x11e4df[_0x0183('0x1c')](_0x1a29a3);return _0x11e4df[_0x0183('0x23')](_0x0183('0x24'),_0x3a04df+'-'+_0x7cc9ea+'/'+_0x488511)[_0x0183('0x1e')](_0xe17fc5);}return null;};}function patchUpdates(_0xb76cf8){return function(_0xe54542){try{jsonpatch[_0x0183('0x25')](_0xe54542,_0xb76cf8,!![]);}catch(_0x7716d1){return BPromise['reject'](_0x7716d1);}return _0xe54542[_0x0183('0x26')]();};}function saveUpdates(_0x14ad6e,_0x17f91a){return function(_0x2bc03c){if(_0x2bc03c){return _0x2bc03c[_0x0183('0x27')](_0x14ad6e)[_0x0183('0x28')](function(_0x2752a3){return _0x2752a3;});}return null;};}function removeEntity(_0x495458,_0x14d6d7){return function(_0x1602d4){if(_0x1602d4){return _0x1602d4[_0x0183('0x29')]()[_0x0183('0x28')](function(){var _0x320591=_0x1602d4['get']({'plain':!![]});var _0x40d6a2=_0x0183('0x2a');return db[_0x0183('0x2b')]['destroy']({'where':{'type':_0x40d6a2,'resourceId':_0x320591['id']}})['then'](function(){return _0x1602d4;});})[_0x0183('0x28')](function(){_0x495458['status'](0xcc)[_0x0183('0x1d')]();});}};}function handleEntityNotFound(_0x41612d,_0x2dfc6e){return function(_0x2bbca8){if(!_0x2bbca8){_0x41612d[_0x0183('0x1b')](0x194);}return _0x2bbca8;};}function handleError(_0x4046b3,_0x562922){_0x562922=_0x562922||0x1f4;return function(_0x4d248e){logger[_0x0183('0x2c')](_0x4d248e[_0x0183('0x2d')]);if(_0x4d248e['name']){delete _0x4d248e['name'];}_0x4046b3[_0x0183('0x1c')](_0x562922)[_0x0183('0x2e')](_0x4d248e);};}exports[_0x0183('0x2f')]=function(_0x59ac02,_0x398276){var _0x259d71={},_0x578b15={},_0x5e2176={'count':0x0,'rows':[]};var _0x349d77=_[_0x0183('0x30')](db[_0x0183('0x31')][_0x0183('0x32')],function(_0x24acc1){return{'name':_0x24acc1[_0x0183('0x33')],'type':_0x24acc1[_0x0183('0x34')][_0x0183('0x35')]};});_0x578b15[_0x0183('0x36')]=_[_0x0183('0x30')](_0x349d77,_0x0183('0x37'));_0x578b15[_0x0183('0x38')]=_[_0x0183('0x39')](_0x59ac02[_0x0183('0x38')]);_0x578b15[_0x0183('0x3a')]=_[_0x0183('0x3b')](_0x578b15[_0x0183('0x36')],_0x578b15[_0x0183('0x38')]);_0x259d71[_0x0183('0x3c')]=_[_0x0183('0x3b')](_0x578b15[_0x0183('0x36')],qs[_0x0183('0x3d')](_0x59ac02[_0x0183('0x38')]['fields']));_0x259d71[_0x0183('0x3c')]=_0x259d71['attributes']['length']?_0x259d71[_0x0183('0x3c')]:_0x578b15[_0x0183('0x36')];if(!_0x59ac02[_0x0183('0x38')]['hasOwnProperty'](_0x0183('0x3e'))){_0x259d71[_0x0183('0x21')]=qs[_0x0183('0x21')](_0x59ac02[_0x0183('0x38')][_0x0183('0x21')]);_0x259d71['offset']=qs[_0x0183('0x1f')](_0x59ac02[_0x0183('0x38')][_0x0183('0x1f')]);}_0x259d71[_0x0183('0x3f')]=qs['sort'](_0x59ac02[_0x0183('0x38')][_0x0183('0x40')]);_0x259d71[_0x0183('0x41')]=qs[_0x0183('0x3a')](_[_0x0183('0x42')](_0x59ac02[_0x0183('0x38')],_0x578b15['filters']),_0x349d77);if(_0x59ac02['query'][_0x0183('0x43')]){_0x259d71[_0x0183('0x41')]=_[_0x0183('0x44')](_0x259d71['where'],{'$or':_[_0x0183('0x30')](_0x349d77,function(_0x2e5666){if(_0x2e5666['type']!==_0x0183('0x45')){var _0x5423b6={};_0x5423b6[_0x2e5666['name']]={'$like':'%'+_0x59ac02[_0x0183('0x38')]['filter']+'%'};return _0x5423b6;}})});}_0x259d71=_[_0x0183('0x44')]({},_0x259d71,_0x59ac02[_0x0183('0x46')]);var _0x38d10d={'where':_0x259d71['where']};return db['Variable'][_0x0183('0x22')](_0x38d10d)[_0x0183('0x28')](function(_0x6a5674){_0x5e2176[_0x0183('0x22')]=_0x6a5674;if(_0x59ac02[_0x0183('0x38')][_0x0183('0x47')]){_0x259d71[_0x0183('0x48')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x259d71);})[_0x0183('0x28')](function(_0xa3b39a){_0x5e2176['rows']=_0xa3b39a;return _0x5e2176;})['then'](respondWithFilteredResult(_0x398276,_0x259d71))[_0x0183('0x49')](handleError(_0x398276,null));};exports[_0x0183('0x4a')]=function(_0x135e0e,_0x4ba75f){var _0x3e9af4={'raw':!![],'where':{'id':_0x135e0e[_0x0183('0x4b')]['id']}},_0x477b3f={};_0x477b3f[_0x0183('0x36')]=_[_0x0183('0x39')](db[_0x0183('0x31')][_0x0183('0x32')]);_0x477b3f[_0x0183('0x38')]=_[_0x0183('0x39')](_0x135e0e[_0x0183('0x38')]);_0x477b3f['filters']=_[_0x0183('0x3b')](_0x477b3f[_0x0183('0x36')],_0x477b3f['query']);_0x3e9af4[_0x0183('0x3c')]=_[_0x0183('0x3b')](_0x477b3f[_0x0183('0x36')],qs[_0x0183('0x3d')](_0x135e0e['query']['fields']));_0x3e9af4[_0x0183('0x3c')]=_0x3e9af4[_0x0183('0x3c')]['length']?_0x3e9af4['attributes']:_0x477b3f[_0x0183('0x36')];if(_0x135e0e[_0x0183('0x38')][_0x0183('0x47')]){_0x3e9af4['include']=[{'all':!![]}];}_0x3e9af4=_[_0x0183('0x44')]({},_0x3e9af4,_0x135e0e[_0x0183('0x46')]);return db['Variable'][_0x0183('0x4c')](_0x3e9af4)[_0x0183('0x28')](handleEntityNotFound(_0x4ba75f,null))[_0x0183('0x28')](respondWithResult(_0x4ba75f,null))[_0x0183('0x49')](handleError(_0x4ba75f,null));};exports[_0x0183('0x4d')]=function(_0x39ae18,_0x3da104){return db['Variable'][_0x0183('0x4d')](_0x39ae18[_0x0183('0x4e')],{})[_0x0183('0x28')](function(_0x191fea){var _0x11e9a6=_0x39ae18[_0x0183('0x4f')][_0x0183('0x50')]({'plain':!![]});if(!_0x11e9a6)throw new Error(_0x0183('0x51'));if(_0x11e9a6['role']===_0x0183('0x4f')){var _0x2a485d=_0x191fea[_0x0183('0x50')]({'plain':!![]});var _0x3459af='Variables';return db[_0x0183('0x52')]['find']({'where':{'name':_0x3459af,'userProfileId':_0x11e9a6['userProfileId']},'raw':!![]})[_0x0183('0x28')](function(_0x158800){if(_0x158800&&_0x158800[_0x0183('0x53')]===0x0){return db[_0x0183('0x2b')][_0x0183('0x4d')]({'name':_0x2a485d[_0x0183('0x37')],'resourceId':_0x2a485d['id'],'type':_0x158800['name'],'sectionId':_0x158800['id']},{})['then'](function(){return _0x191fea;});}else{return _0x191fea;}})[_0x0183('0x49')](function(_0x546023){logger[_0x0183('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x546023);throw _0x546023;});}return _0x191fea;})[_0x0183('0x28')](respondWithResult(_0x3da104,0xc9))[_0x0183('0x49')](handleError(_0x3da104,null));};exports['update']=function(_0x5b1867,_0x2da506){if(_0x5b1867[_0x0183('0x4e')]['id']){delete _0x5b1867['body']['id'];}return db['Variable'][_0x0183('0x4c')]({'where':{'id':_0x5b1867[_0x0183('0x4b')]['id']}})[_0x0183('0x28')](handleEntityNotFound(_0x2da506,null))['then'](saveUpdates(_0x5b1867[_0x0183('0x4e')],null))[_0x0183('0x28')](respondWithResult(_0x2da506,null))['catch'](handleError(_0x2da506,null));};exports[_0x0183('0x29')]=function(_0x4c09ad,_0x34f28d){return db[_0x0183('0x31')]['find']({'where':{'id':_0x4c09ad[_0x0183('0x4b')]['id']}})[_0x0183('0x28')](handleEntityNotFound(_0x34f28d,null))[_0x0183('0x28')](removeEntity(_0x34f28d,null))['catch'](handleError(_0x34f28d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a74c966..58ebc14 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 _0x81e4=['request-promise','path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','util','../../config/logger','api','bluebird'];(function(_0x36f5b7,_0x1514ca){var _0x495dfb=function(_0xace77){while(--_0xace77){_0x36f5b7['push'](_0x36f5b7['shift']());}};_0x495dfb(++_0x1514ca);}(_0x81e4,0x164));var _0x481e=function(_0x1c490a,_0x217f34){_0x1c490a=_0x1c490a-0x0;var _0x1e0b1d=_0x81e4[_0x1c490a];return _0x1e0b1d;};'use strict';var _=require('lodash');var util=require(_0x481e('0x0'));var logger=require(_0x481e('0x1'))(_0x481e('0x2'));var moment=require('moment');var BPromise=require(_0x481e('0x3'));var rp=require(_0x481e('0x4'));var fs=require('fs');var path=require(_0x481e('0x5'));var rimraf=require(_0x481e('0x6'));var config=require('../../config/environment');var attributes=require(_0x481e('0x7'));module[_0x481e('0x8')]=function(_0x39a8e0,_0x3ff54b){return _0x39a8e0[_0x481e('0x9')](_0x481e('0xa'),attributes,{'tableName':_0x481e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa394=['rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','moment','bluebird','request-promise','path'];(function(_0x3d3f8b,_0x4b6a78){var _0xbeb143=function(_0x171734){while(--_0x171734){_0x3d3f8b['push'](_0x3d3f8b['shift']());}};_0xbeb143(++_0x4b6a78);}(_0xa394,0x1a9));var _0x4a39=function(_0x317a53,_0x1d9005){_0x317a53=_0x317a53-0x0;var _0x236159=_0xa394[_0x317a53];return _0x236159;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4a39('0x0'));var BPromise=require(_0x4a39('0x1'));var rp=require(_0x4a39('0x2'));var fs=require('fs');var path=require(_0x4a39('0x3'));var rimraf=require(_0x4a39('0x4'));var config=require(_0x4a39('0x5'));var attributes=require(_0x4a39('0x6'));module[_0x4a39('0x7')]=function(_0x26527b,_0x37bdb6){return _0x26527b[_0x4a39('0x8')](_0x4a39('0x9'),attributes,{'tableName':_0x4a39('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 697d13f..1927942 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 _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x4a7163,_0x573ac4){var _0x2e474f=function(_0x38c665){while(--_0x38c665){_0x4a7163['push'](_0x4a7163['shift']());}};_0x2e474f(++_0x573ac4);}(_0xf494,0x1c6));var _0x4f49=function(_0x298750,_0x42f014){_0x298750=_0x298750-0x0;var _0x1badb4=_0xf494[_0x298750];return _0x1badb4;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ 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','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0x55ca,0x126));var _0xa55c=function(_0xcfc88f,_0x239d01){_0xcfc88f=_0xcfc88f-0x0;var _0x20cfc0=_0x55ca[_0xcfc88f];return _0x20cfc0;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 1d8cac1..fd34311 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 _0x7697=['reset','/pull','pull','/restart','restart','/migrations','migrations','express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','/reset'];(function(_0x74895e,_0x298c35){var _0x40bc2a=function(_0x558c6d){while(--_0x558c6d){_0x74895e['push'](_0x74895e['shift']());}};_0x40bc2a(++_0x298c35);}(_0x7697,0xb7));var _0x7769=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x7697[_0x4733d3];return _0x1b9a44;};'use strict';var express=require(_0x7769('0x0'));var router=express[_0x7769('0x1')]();var auth=require(_0x7769('0x2'));var controller=require('./version.controller');router[_0x7769('0x3')]('/',controller[_0x7769('0x4')]);router[_0x7769('0x3')](_0x7769('0x5'),auth[_0x7769('0x6')](),auth[_0x7769('0x7')](),controller['fetch']);router[_0x7769('0x3')](_0x7769('0x8'),auth[_0x7769('0x6')](),auth['canUpdate'](),controller[_0x7769('0x9')]);router[_0x7769('0x3')](_0x7769('0xa'),auth[_0x7769('0x6')](),auth[_0x7769('0x7')](),controller[_0x7769('0xb')]);router['get'](_0x7769('0xc'),auth['isAuthenticated'](),controller[_0x7769('0xd')]);router['get'](_0x7769('0xe'),controller[_0x7769('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc51c=['../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','pull','/migrations','migrations','exports','express','Router'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0xc51c,0x8e));var _0xcc51=function(_0x8619b4,_0x341d2e){_0x8619b4=_0x8619b4-0x0;var _0x505ae6=_0xc51c[_0x8619b4];return _0x505ae6;};'use strict';var express=require(_0xcc51('0x0'));var router=express[_0xcc51('0x1')]();var auth=require(_0xcc51('0x2'));var controller=require(_0xcc51('0x3'));router['get']('/',controller[_0xcc51('0x4')]);router[_0xcc51('0x5')](_0xcc51('0x6'),auth[_0xcc51('0x7')](),auth['canUpdate'](),controller[_0xcc51('0x8')]);router['get'](_0xcc51('0x9'),auth[_0xcc51('0x7')](),auth[_0xcc51('0xa')](),controller[_0xcc51('0xb')]);router['get']('/pull',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xcc51('0xc')]);router[_0xcc51('0x5')]('/restart',auth[_0xcc51('0x7')](),controller['restart']);router[_0xcc51('0x5')](_0xcc51('0xd'),controller[_0xcc51('0xe')]);module[_0xcc51('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ca4d7b0..a5d4244 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 _0x66fe=['../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','info','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','push','length','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','version','child_process','exec','../../mysqldb'];(function(_0x2fefe6,_0xa069b){var _0x34ae15=function(_0x2b7939){while(--_0x2b7939){_0x2fefe6['push'](_0x2fefe6['shift']());}};_0x34ae15(++_0xa069b);}(_0x66fe,0x10d));var _0xe66f=function(_0x287125,_0x5150b7){_0x287125=_0x287125-0x0;var _0x38fdc1=_0x66fe[_0x287125];return _0x38fdc1;};'use strict';var Umzug=require('umzug');var path=require(_0xe66f('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xe66f('0x1'))(module,_0xe66f('0x2'));var compareVersions=require('compare-versions');var exec=require(_0xe66f('0x3'))[_0xe66f('0x4')];var db=require(_0xe66f('0x5'))['db'];var config=require(_0xe66f('0x6'));var pm2=require(_0xe66f('0x7'));var logger=require(_0xe66f('0x8'))(_0xe66f('0x9'));var git=require(_0xe66f('0xa'))(config[_0xe66f('0xb')]);exports[_0xe66f('0xc')]=function(_0x5b4e5d,_0x40383a){var _0x137138={'current':module[_0xe66f('0xd')]['version'],'phonebar':0x2};if(_0x5b4e5d[_0xe66f('0xe')]&&_0x5b4e5d['query'][_0xe66f('0xf')]){return git[_0xe66f('0x10')]()[_0xe66f('0x11')](function(_0x2bc816,_0x13002a){_0x137138[_0xe66f('0xf')]=(_0x2bc816?module['exports']['version']:_0x13002a[_0xe66f('0xf')])||_0xe66f('0x12');return _0x40383a[_0xe66f('0x13')](0xc8)[_0xe66f('0x14')](_0x137138);});}else{return _0x40383a['status'](0xc8)[_0xe66f('0x14')](_0x137138);}};exports[_0xe66f('0x10')]=function(_0x2c6a00,_0x247829){return git['fetch']([_0xe66f('0x15'),_0xe66f('0x16')],function(_0x28b9de){if(_0x28b9de){logger[_0xe66f('0x17')](_0x28b9de);return _0x247829[_0xe66f('0x13')](0x1f4)['json'](_0x28b9de);}logger['info'](_0xe66f('0x18'));return _0x247829[_0xe66f('0x13')](0xc8)[_0xe66f('0x14')]({'output':_0xe66f('0x19')});});};exports[_0xe66f('0x1a')]=function(_0x12b00d,_0x334f8b){return git[_0xe66f('0x1a')]([_0xe66f('0x1b'),'FETCH_HEAD'],function(_0x4ce227){if(_0x4ce227){logger[_0xe66f('0x17')](_0x4ce227);return _0x334f8b[_0xe66f('0x13')](0x1f4)[_0xe66f('0x14')](_0x4ce227);}logger['info'](_0xe66f('0x1c'));return _0x334f8b[_0xe66f('0x13')](0xc8)[_0xe66f('0x14')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x53bd89,_0x169c0e){exec(_0xe66f('0x1d'),function(_0x261dec,_0x2047ff,_0x1ae524){logger[_0xe66f('0x1e')](_0x2047ff);logger[_0xe66f('0x1e')](_0x1ae524);if(_0x261dec){logger['error'](_0x261dec);return _0x169c0e[_0xe66f('0x13')](0x1f4)['json'](_0x261dec);}return _0x169c0e[_0xe66f('0x13')](0xc8)[_0xe66f('0x14')]({'output':_0x2047ff});});};exports[_0xe66f('0x1f')]=function(_0x3e6893,_0x42c20f){return pm2[_0xe66f('0x1f')](_0xe66f('0x20'))[_0xe66f('0x21')](function(_0xf48cd4){logger[_0xe66f('0x1e')]('pm2\x20restart\x20motion\x20%s',_0xf48cd4);return _0x42c20f[_0xe66f('0x13')](0xc8)['json']({'output':_0xe66f('0x22')});})[_0xe66f('0x23')](function(_0x1f4342){logger['error'](_0x1f4342);return _0x42c20f['status'](0x1f4)[_0xe66f('0x14')](_0x1f4342);});};exports[_0xe66f('0x24')]=function(_0x5a9044,_0x408c7b){var _0x33e080=fs[_0xe66f('0x25')](path[_0xe66f('0x26')](config[_0xe66f('0xb')],_0xe66f('0x27'),_0xe66f('0x24')));var _0x977719=[];for(var _0xeabd85=0x0;_0xeabd85<_0x33e080['length'];_0xeabd85++){var _0x2ec64b=_0x33e080[_0xeabd85][_0xe66f('0x28')]('.js','');if(compareVersions(module[_0xe66f('0xd')][_0xe66f('0x2')],_0x2ec64b)===-0x1){_0x977719[_0xe66f('0x29')](_0x2ec64b);}}if(_0x977719[_0xe66f('0x2a')]){var _0x5856d9=_0x977719[_0xe66f('0x2b')](compareVersions);var _0x294298=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xe66f('0x2c')],'modelName':_0xe66f('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0xe66f('0x2d')][_0xe66f('0x2e')](),db[_0xe66f('0x2d')][_0xe66f('0x2f')],function(){throw new Error(_0xe66f('0x30'));}],'path':path[_0xe66f('0x26')](config[_0xe66f('0xb')],_0xe66f('0x27'),'migrations'),'pattern':/\.js$/}});_0x294298['up']({'migrations':_['map'](_0x5856d9,function(_0x220932){return _0x220932+_0xe66f('0x31');})})[_0xe66f('0x21')](function(){return _0x408c7b['status'](0xc8)[_0xe66f('0x14')]({'output':_0xe66f('0x32')+module[_0xe66f('0xd')]['version']+_0xe66f('0x33')+_[_0xe66f('0x34')](_0x5856d9),'migrations':_['join'](_0x5856d9)});})[_0xe66f('0x23')](function(_0x3cedbf){if(_0x3cedbf instanceof db[_0xe66f('0x2d')][_0xe66f('0x35')]){return _0x408c7b[_0xe66f('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x408c7b['status'](0x1f4)[_0xe66f('0x14')](_0x3cedbf);}});}else{return _0x408c7b[_0xe66f('0x13')](0xc8)[_0xe66f('0x14')]({'output':_0xe66f('0x36')});}}; \ No newline at end of file +var _0x5cd6=['git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','root','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','server','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','exports','query','latest','tags','2.0.0','json','status','fetch','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x2e6ea9,_0x1b9d9e){var _0x1f8081=function(_0xde1c8a){while(--_0xde1c8a){_0x2e6ea9['push'](_0x2e6ea9['shift']());}};_0x1f8081(++_0x1b9d9e);}(_0x5cd6,0x18e));var _0x65cd=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x5cd6[_0x20c9b2];return _0x2c6030;};'use strict';var Umzug=require(_0x65cd('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x65cd('0x1'))(module,_0x65cd('0x2'));var compareVersions=require(_0x65cd('0x3'));var exec=require('child_process')[_0x65cd('0x4')];var db=require(_0x65cd('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x65cd('0x6'));var logger=require(_0x65cd('0x7'))(_0x65cd('0x8'));var git=require(_0x65cd('0x9'))(config['root']);exports['index']=function(_0x4e5578,_0x4ef37d){var _0x342363={'current':module[_0x65cd('0xa')]['version'],'phonebar':0x2};if(_0x4e5578['query']&&_0x4e5578[_0x65cd('0xb')][_0x65cd('0xc')]){return git['fetch']()[_0x65cd('0xd')](function(_0x5e67a4,_0x4458f2){_0x342363['latest']=(_0x5e67a4?module['exports'][_0x65cd('0x2')]:_0x4458f2[_0x65cd('0xc')])||_0x65cd('0xe');return _0x4ef37d['status'](0xc8)[_0x65cd('0xf')](_0x342363);});}else{return _0x4ef37d[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')](_0x342363);}};exports[_0x65cd('0x11')]=function(_0x2d91a6,_0x14c836){return git['fetch']([_0x65cd('0x12'),_0x65cd('0x13')],function(_0x591d1e){if(_0x591d1e){logger[_0x65cd('0x14')](_0x591d1e);return _0x14c836['status'](0x1f4)[_0x65cd('0xf')](_0x591d1e);}logger['info'](_0x65cd('0x15'));return _0x14c836[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':_0x65cd('0x16')});});};exports['reset']=function(_0x288540,_0x214fb4){return git[_0x65cd('0x17')]([_0x65cd('0x18'),'FETCH_HEAD'],function(_0x173bb1){if(_0x173bb1){logger['error'](_0x173bb1);return _0x214fb4[_0x65cd('0x10')](0x1f4)[_0x65cd('0xf')](_0x173bb1);}logger['info'](_0x65cd('0x19'));return _0x214fb4['status'](0xc8)[_0x65cd('0xf')]({'output':_0x65cd('0x1a')});});};exports[_0x65cd('0x1b')]=function(_0x519b4e,_0x2fa56d){exec(_0x65cd('0x1c'),function(_0x9babb4,_0x29561f,_0x2d89be){logger[_0x65cd('0x1d')](_0x29561f);logger[_0x65cd('0x1d')](_0x2d89be);if(_0x9babb4){logger[_0x65cd('0x14')](_0x9babb4);return _0x2fa56d[_0x65cd('0x10')](0x1f4)[_0x65cd('0xf')](_0x9babb4);}return _0x2fa56d[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':_0x29561f});});};exports[_0x65cd('0x1e')]=function(_0x1418f9,_0x1c9575){return pm2[_0x65cd('0x1e')](_0x65cd('0x1f'))['then'](function(_0x4a585d){logger[_0x65cd('0x1d')](_0x65cd('0x20'),_0x4a585d);return _0x1c9575[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':_0x65cd('0x21')});})[_0x65cd('0x22')](function(_0x230b6a){logger[_0x65cd('0x14')](_0x230b6a);return _0x1c9575[_0x65cd('0x10')](0x1f4)[_0x65cd('0xf')](_0x230b6a);});};exports[_0x65cd('0x23')]=function(_0x4ad5b4,_0x4b99c9){var _0xd3e080=fs['readdirSync'](path[_0x65cd('0x24')](config[_0x65cd('0x25')],'server',_0x65cd('0x23')));var _0x57be8f=[];for(var _0x4c9efa=0x0;_0x4c9efa<_0xd3e080[_0x65cd('0x26')];_0x4c9efa++){var _0xd8a846=_0xd3e080[_0x4c9efa]['replace'](_0x65cd('0x27'),'');if(compareVersions(module['exports'][_0x65cd('0x2')],_0xd8a846)===-0x1){_0x57be8f[_0x65cd('0x28')](_0xd8a846);}}if(_0x57be8f['length']){var _0x58e804=_0x57be8f[_0x65cd('0x29')](compareVersions);var _0x551233=new Umzug({'storage':_0x65cd('0x2a'),'storageOptions':{'model':db[_0x65cd('0x2b')],'modelName':_0x65cd('0x2b'),'columnName':_0x65cd('0x2')},'migrations':{'params':[db['sequelize'][_0x65cd('0x2c')](),db[_0x65cd('0x2a')][_0x65cd('0x2d')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0x65cd('0x25')],_0x65cd('0x2e'),_0x65cd('0x23')),'pattern':/\.js$/}});_0x551233['up']({'migrations':_['map'](_0x58e804,function(_0x54bb50){return _0x54bb50+_0x65cd('0x27');})})[_0x65cd('0x2f')](function(){return _0x4b99c9[_0x65cd('0x10')](0xc8)['json']({'output':_0x65cd('0x30')+module[_0x65cd('0xa')][_0x65cd('0x2')]+_0x65cd('0x31')+_[_0x65cd('0x32')](_0x58e804),'migrations':_['join'](_0x58e804)});})[_0x65cd('0x22')](function(_0x325246){if(_0x325246 instanceof db[_0x65cd('0x2a')][_0x65cd('0x33')]){return _0x4b99c9[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4b99c9[_0x65cd('0x10')](0x1f4)['json'](_0x325246);}});}else{return _0x4b99c9[_0x65cd('0x10')](0xc8)[_0x65cd('0xf')]({'output':_0x65cd('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9f42b46..108f123 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 _0x0293=['describe','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe'];(function(_0x393438,_0x4883a6){var _0x2a0986=function(_0x15a93b){while(--_0x15a93b){_0x393438['push'](_0x393438['shift']());}};_0x2a0986(++_0x4883a6);}(_0x0293,0x134));var _0x3029=function(_0x1ae8bd,_0x5dd3cf){_0x1ae8bd=_0x1ae8bd-0x0;var _0x24aa8c=_0x0293[_0x1ae8bd];return _0x24aa8c;};'use strict';var multer=require(_0x3029('0x0'));var util=require(_0x3029('0x1'));var path=require(_0x3029('0x2'));var timeout=require(_0x3029('0x3'));var express=require(_0x3029('0x4'));var router=express['Router']();var fs_extra=require(_0x3029('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3029('0x6'));var config=require('../../config/environment');var controller=require(_0x3029('0x7'));router[_0x3029('0x8')]('/',auth[_0x3029('0x9')](),controller[_0x3029('0xa')]);router[_0x3029('0x8')](_0x3029('0xb'),auth[_0x3029('0x9')](),controller[_0x3029('0xc')]);router[_0x3029('0x8')](_0x3029('0xd'),auth[_0x3029('0x9')](),controller[_0x3029('0xe')]);router[_0x3029('0xf')]('/',auth['isAuthenticated'](),controller[_0x3029('0x10')]);router[_0x3029('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3029('0x12')]);router['delete'](_0x3029('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3029('0x13')]=router; \ No newline at end of file +var _0xa6f9=['index','get','/describe','describe','/:id','post','create','delete','destroy','exports','util','path','connect-timeout','Router','../../config/environment','isAuthenticated'];(function(_0x4b9781,_0x713b9f){var _0x1070f4=function(_0x158af4){while(--_0x158af4){_0x4b9781['push'](_0x4b9781['shift']());}};_0x1070f4(++_0x713b9f);}(_0xa6f9,0x11a));var _0x9a6f=function(_0x3cf338,_0x44e1a8){_0x3cf338=_0x3cf338-0x0;var _0x17653c=_0xa6f9[_0x3cf338];return _0x17653c;};'use strict';var multer=require('multer');var util=require(_0x9a6f('0x0'));var path=require(_0x9a6f('0x1'));var timeout=require(_0x9a6f('0x2'));var express=require('express');var router=express[_0x9a6f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a6f('0x4'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x9a6f('0x5')](),controller[_0x9a6f('0x6')]);router[_0x9a6f('0x7')](_0x9a6f('0x8'),auth[_0x9a6f('0x5')](),controller[_0x9a6f('0x9')]);router[_0x9a6f('0x7')](_0x9a6f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9a6f('0xb')]('/',auth[_0x9a6f('0x5')](),controller[_0x9a6f('0xc')]);router['put'](_0x9a6f('0xa'),auth[_0x9a6f('0x5')](),controller['update']);router[_0x9a6f('0xd')](_0x9a6f('0xa'),auth['isAuthenticated'](),controller[_0x9a6f('0xe')]);module[_0x9a6f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 2ce8b9d..1efc508 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 _0x1c77=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE'];(function(_0x1bf332,_0x5582f2){var _0x1de849=function(_0x4cfacb){while(--_0x4cfacb){_0x1bf332['push'](_0x1bf332['shift']());}};_0x1de849(++_0x5582f2);}(_0x1c77,0xed));var _0x71c7=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0x1c77[_0x45aa72];return _0x75adaa;};'use strict';var Sequelize=require('sequelize');module[_0x71c7('0x0')]={'type':{'type':Sequelize[_0x71c7('0x1')]},'uniqueid':{'type':Sequelize[_0x71c7('0x1')]},'calleridnum':{'type':Sequelize[_0x71c7('0x1')]},'calleridname':{'type':Sequelize[_0x71c7('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x71c7('0x1')]},'membername':{'type':Sequelize[_0x71c7('0x1')]},'agentcalledAt':{'type':Sequelize[_0x71c7('0x2')]},'agentconnectAt':{'type':Sequelize[_0x71c7('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x71c7('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x71c7('0x2')]},'agentdumpAt':{'type':Sequelize[_0x71c7('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x71c7('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x71c7('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x71c7('0x4')]},'agentacw':{'type':Sequelize[_0x71c7('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x71c7('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x71c7('0x4')]},'channelstatedesc':{'type':Sequelize[_0x71c7('0x1')]},'connectedlinenum':{'type':Sequelize[_0x71c7('0x1')]},'connectedlinename':{'type':Sequelize[_0x71c7('0x1')]},'language':{'type':Sequelize[_0x71c7('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x71c7('0x1')]},'exten':{'type':Sequelize[_0x71c7('0x1')]},'priority':{'type':Sequelize[_0x71c7('0x1')]},'destchannel':{'type':Sequelize[_0x71c7('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x71c7('0x1')]},'destcalleridnum':{'type':Sequelize[_0x71c7('0x1')]},'destcalleridname':{'type':Sequelize[_0x71c7('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x71c7('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x71c7('0x1')]},'destlanguage':{'type':Sequelize[_0x71c7('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x71c7('0x1')]},'destpriority':{'type':Sequelize[_0x71c7('0x1')]},'destuniqueid':{'type':Sequelize[_0x71c7('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x71c7('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x71c7('0x1')]},'transfer':{'type':Sequelize[_0x71c7('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x71c7('0x1')],'comment':_0x71c7('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x71c7('0x1')]},'agententerreason':{'type':Sequelize[_0x71c7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4f4=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x2f6d82,_0x4ddc85){_0x2f6d82=_0x2f6d82-0x0;var _0x1e6f2a=_0xd4f4[_0x2f6d82];return _0x1e6f2a;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'type':{'type':Sequelize[_0x4d4f('0x2')]},'uniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'calleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'calleridname':{'type':Sequelize[_0x4d4f('0x2')]},'queue':{'type':Sequelize[_0x4d4f('0x2')]},'interface':{'type':Sequelize[_0x4d4f('0x2')]},'membername':{'type':Sequelize[_0x4d4f('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4d4f('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4d4f('0x4')]},'agentcomplete':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4d4f('0x4')]},'agentacw':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4d4f('0x4')]},'reason':{'type':Sequelize[_0x4d4f('0x2')]},'lastevent':{'type':Sequelize[_0x4d4f('0x2')]},'channel':{'type':Sequelize[_0x4d4f('0x2')]},'channelstate':{'type':Sequelize[_0x4d4f('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'connectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'language':{'type':Sequelize[_0x4d4f('0x2')]},'accountcode':{'type':Sequelize[_0x4d4f('0x2')]},'context':{'type':Sequelize[_0x4d4f('0x2')]},'exten':{'type':Sequelize[_0x4d4f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4d4f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4d4f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4d4f('0x2')]},'destlanguage':{'type':Sequelize[_0x4d4f('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4d4f('0x2')]},'destexten':{'type':Sequelize[_0x4d4f('0x2')]},'destpriority':{'type':Sequelize[_0x4d4f('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4d4f('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4d4f('0x2')],'comment':_0x4d4f('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4d4f('0x2')]},'agententerreason':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index bdab258..a1c75e8 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index d3e3020..355e883 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 _0x16cc=['path','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43c842,_0x442f54){var _0x2e757=function(_0xf1313a){while(--_0xf1313a){_0x43c842['push'](_0x43c842['shift']());}};_0x2e757(++_0x442f54);}(_0x16cc,0x120));var _0xc16c=function(_0x599887,_0x4237b0){_0x599887=_0x599887-0x0;var _0x56e57e=_0x16cc[_0x599887];return _0x56e57e;};'use strict';var _=require('lodash');var util=require(_0xc16c('0x0'));var logger=require(_0xc16c('0x1'))(_0xc16c('0x2'));var moment=require(_0xc16c('0x3'));var BPromise=require(_0xc16c('0x4'));var rp=require(_0xc16c('0x5'));var fs=require('fs');var path=require(_0xc16c('0x6'));var rimraf=require('rimraf');var config=require(_0xc16c('0x7'));var attributes=require(_0xc16c('0x8'));module[_0xc16c('0x9')]=function(_0x1019ec,_0x5ea82b){return _0x1019ec[_0xc16c('0xa')]('VoiceAgentReport',attributes,{'tableName':_0xc16c('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc16c('0xc'),_0xc16c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe009=['bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xe009,0x122));var _0x9e00=function(_0x2ea296,_0x44e3e6){_0x2ea296=_0x2ea296-0x0;var _0x1a914e=_0xe009[_0x2ea296];return _0x1a914e;};'use strict';var _=require(_0x9e00('0x0'));var util=require(_0x9e00('0x1'));var logger=require(_0x9e00('0x2'))(_0x9e00('0x3'));var moment=require('moment');var BPromise=require(_0x9e00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e00('0x5'));var rimraf=require(_0x9e00('0x6'));var config=require(_0x9e00('0x7'));var attributes=require(_0x9e00('0x8'));module[_0x9e00('0x9')]=function(_0x467e35,_0x32b4ee){return _0x467e35[_0x9e00('0xa')](_0x9e00('0xb'),attributes,{'tableName':_0x9e00('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9e00('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 8c15c6b..70de91b 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 _0x0aa1=['update','where','attributes','limit','info','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug'];(function(_0x2a702a,_0x29508a){var _0x5563d4=function(_0x1bc14c){while(--_0x1bc14c){_0x2a702a['push'](_0x2a702a['shift']());}};_0x5563d4(++_0x29508a);}(_0x0aa1,0x69));var _0x10aa=function(_0xb230e0,_0x3b49f0){_0xb230e0=_0xb230e0-0x0;var _0x253c65=_0x0aa1[_0xb230e0];return _0x253c65;};'use strict';var _=require(_0x10aa('0x0'));var util=require(_0x10aa('0x1'));var moment=require('moment');var BPromise=require(_0x10aa('0x2'));var rs=require(_0x10aa('0x3'));var fs=require('fs');var Redis=require(_0x10aa('0x4'));var db=require(_0x10aa('0x5'))['db'];var utils=require(_0x10aa('0x6'));var logger=require(_0x10aa('0x7'))('rpc');var config=require(_0x10aa('0x8'));var jayson=require(_0x10aa('0x9'));var client=jayson['client'][_0x10aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51325d,_0x3e4ff1,_0x3a3a65){return new BPromise(function(_0xe48743,_0x1153c2){return client['request'](_0x51325d,_0x3a3a65)[_0x10aa('0xb')](function(_0x5f508a){logger['info'](_0x10aa('0xc'),_0x3e4ff1,_0x10aa('0xd'));logger['debug'](_0x10aa('0xe'),_0x3e4ff1,_0x10aa('0xd'),JSON[_0x10aa('0xf')](_0x5f508a));if(_0x5f508a[_0x10aa('0x10')]){if(_0x5f508a['error']['code']===0x1f4){logger[_0x10aa('0x10')](_0x10aa('0xc'),_0x3e4ff1,_0x5f508a['error'][_0x10aa('0x11')]);return _0x1153c2(_0x5f508a[_0x10aa('0x10')][_0x10aa('0x11')]);}logger[_0x10aa('0x10')](_0x10aa('0xc'),_0x3e4ff1,_0x5f508a[_0x10aa('0x10')]['message']);return _0xe48743(_0x5f508a[_0x10aa('0x10')][_0x10aa('0x11')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x3e4ff1,_0x10aa('0xd'));_0xe48743(_0x5f508a[_0x10aa('0x12')][_0x10aa('0x11')]);}})[_0x10aa('0x13')](function(_0x37d3c2){logger[_0x10aa('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x3e4ff1,_0x37d3c2);_0x1153c2(_0x37d3c2);});});}exports[_0x10aa('0x14')]=function(_0xffb614){var _0x30906c=this;return new Promise(function(_0x5a3932,_0x54d355){return db[_0x10aa('0x15')][_0x10aa('0x16')](_0xffb614[_0x10aa('0x17')],{'raw':_0xffb614[_0x10aa('0x18')]?_0xffb614[_0x10aa('0x18')][_0x10aa('0x19')]===undefined?!![]:![]:!![]})[_0x10aa('0xb')](function(_0x1bbb2d){logger['info']('CreateVoiceAgentReport',_0xffb614);logger[_0x10aa('0x1a')]('CreateVoiceAgentReport',_0xffb614,JSON[_0x10aa('0xf')](_0x1bbb2d));_0x5a3932(_0x1bbb2d);})[_0x10aa('0x13')](function(_0x4c73dc){logger['error'](_0x10aa('0x14'),_0x4c73dc[_0x10aa('0x11')],_0xffb614);_0x54d355(_0x30906c['error'](0x1f4,_0x4c73dc[_0x10aa('0x11')]));});});};exports['UpdateVoiceAgentReport']=function(_0x25a32b){var _0x1a0d1d=this;return new Promise(function(_0x1fedc5,_0x4976dc){return db['VoiceAgentReport'][_0x10aa('0x1b')](_0x25a32b['body'],{'raw':_0x25a32b[_0x10aa('0x18')]?_0x25a32b[_0x10aa('0x18')][_0x10aa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25a32b[_0x10aa('0x18')]?_0x25a32b[_0x10aa('0x18')][_0x10aa('0x1c')]||null:null,'attributes':_0x25a32b['options']?_0x25a32b['options'][_0x10aa('0x1d')]||null:null,'limit':_0x25a32b[_0x10aa('0x18')]?_0x25a32b[_0x10aa('0x18')][_0x10aa('0x1e')]||null:null})[_0x10aa('0xb')](function(_0x558ead){logger[_0x10aa('0x1f')](_0x10aa('0x20'),_0x25a32b);logger[_0x10aa('0x1a')]('UpdateVoiceAgentReport',_0x25a32b,JSON[_0x10aa('0xf')](_0x558ead));_0x1fedc5(_0x558ead);})['catch'](function(_0x57d16f){logger['error']('UpdateVoiceAgentReport',_0x57d16f['message'],_0x25a32b);_0x4976dc(_0x1a0d1d[_0x10aa('0x10')](0x1f4,_0x57d16f['message']));});});}; \ No newline at end of file +var _0x6fa9=['error','message','info','result','catch','CreateVoiceAgentReport','create','body','options','raw','VoiceAgentReport','where','attributes','limit','UpdateVoiceAgentReport','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x43a911,_0x30046e){var _0x46fbdb=function(_0x233731){while(--_0x233731){_0x43a911['push'](_0x43a911['shift']());}};_0x46fbdb(++_0x30046e);}(_0x6fa9,0x197));var _0x96fa=function(_0x26f72a,_0x1663a5){_0x26f72a=_0x26f72a-0x0;var _0xec9df1=_0x6fa9[_0x26f72a];return _0xec9df1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x96fa('0x0'));var BPromise=require(_0x96fa('0x1'));var rs=require(_0x96fa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x96fa('0x3'))('rpc');var config=require(_0x96fa('0x4'));var jayson=require(_0x96fa('0x5'));var client=jayson['client'][_0x96fa('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xf7631e,_0x73e8d5,_0x4c26f6){return new BPromise(function(_0x2ee5af,_0x5aca57){return client['request'](_0xf7631e,_0x4c26f6)[_0x96fa('0x7')](function(_0x54fdc1){logger['info'](_0x96fa('0x8'),_0x73e8d5,_0x96fa('0x9'));logger[_0x96fa('0xa')](_0x96fa('0xb'),_0x73e8d5,_0x96fa('0x9'),JSON[_0x96fa('0xc')](_0x54fdc1));if(_0x54fdc1[_0x96fa('0xd')]){if(_0x54fdc1['error']['code']===0x1f4){logger[_0x96fa('0xd')](_0x96fa('0x8'),_0x73e8d5,_0x54fdc1['error'][_0x96fa('0xe')]);return _0x5aca57(_0x54fdc1['error'][_0x96fa('0xe')]);}logger[_0x96fa('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x73e8d5,_0x54fdc1[_0x96fa('0xd')][_0x96fa('0xe')]);return _0x2ee5af(_0x54fdc1['error'][_0x96fa('0xe')]);}else{logger[_0x96fa('0xf')](_0x96fa('0x8'),_0x73e8d5,_0x96fa('0x9'));_0x2ee5af(_0x54fdc1[_0x96fa('0x10')][_0x96fa('0xe')]);}})[_0x96fa('0x11')](function(_0x5695d3){logger[_0x96fa('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x73e8d5,_0x5695d3);_0x5aca57(_0x5695d3);});});}exports[_0x96fa('0x12')]=function(_0x3a9ec1){var _0x1d370c=this;return new Promise(function(_0x3a37cb,_0x13c5e2){return db['VoiceAgentReport'][_0x96fa('0x13')](_0x3a9ec1[_0x96fa('0x14')],{'raw':_0x3a9ec1[_0x96fa('0x15')]?_0x3a9ec1['options'][_0x96fa('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3c23d7){logger['info']('CreateVoiceAgentReport',_0x3a9ec1);logger[_0x96fa('0xa')](_0x96fa('0x12'),_0x3a9ec1,JSON[_0x96fa('0xc')](_0x3c23d7));_0x3a37cb(_0x3c23d7);})[_0x96fa('0x11')](function(_0x1c877e){logger[_0x96fa('0xd')](_0x96fa('0x12'),_0x1c877e[_0x96fa('0xe')],_0x3a9ec1);_0x13c5e2(_0x1d370c[_0x96fa('0xd')](0x1f4,_0x1c877e[_0x96fa('0xe')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3d77c9){var _0x31a887=this;return new Promise(function(_0x4ddbde,_0x131030){return db[_0x96fa('0x17')]['update'](_0x3d77c9[_0x96fa('0x14')],{'raw':_0x3d77c9[_0x96fa('0x15')]?_0x3d77c9[_0x96fa('0x15')][_0x96fa('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d77c9[_0x96fa('0x15')]?_0x3d77c9[_0x96fa('0x15')][_0x96fa('0x18')]||null:null,'attributes':_0x3d77c9[_0x96fa('0x15')]?_0x3d77c9[_0x96fa('0x15')][_0x96fa('0x19')]||null:null,'limit':_0x3d77c9[_0x96fa('0x15')]?_0x3d77c9[_0x96fa('0x15')][_0x96fa('0x1a')]||null:null})[_0x96fa('0x7')](function(_0x4a2bdc){logger[_0x96fa('0xf')](_0x96fa('0x1b'),_0x3d77c9);logger[_0x96fa('0xa')](_0x96fa('0x1b'),_0x3d77c9,JSON[_0x96fa('0xc')](_0x4a2bdc));_0x4ddbde(_0x4a2bdc);})[_0x96fa('0x11')](function(_0x3afddd){logger[_0x96fa('0xd')]('UpdateVoiceAgentReport',_0x3afddd[_0x96fa('0xe')],_0x3d77c9);_0x131030(_0x31a887[_0x96fa('0xd')](0x1f4,_0x3afddd[_0x96fa('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c812a4c..ccb1c69 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 _0x9c5a=['fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','isAuthenticated','show','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x45d264,_0x2a5886){_0x45d264=_0x45d264-0x0;var _0x36af6e=_0x9c5a[_0x45d264];return _0x36af6e;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./voiceCallReport.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['post']('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xd')]);router['put']('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0xf')](_0xa9c5('0x10'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);module[_0xa9c5('0x12')]=router; \ No newline at end of file +var _0x9c5a=['fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','isAuthenticated','show','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1ea689,_0x388dfc){_0x1ea689=_0x1ea689-0x0;var _0x117d1c=_0x9c5a[_0x1ea689];return _0x117d1c;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./voiceCallReport.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['post']('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xd')]);router['put']('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0xf')](_0xa9c5('0x10'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);module[_0xa9c5('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 18b79d2..faaa54a 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 _0xbac6=['outbound','outbound-fax','dialer','DATE','sequelize','exports','STRING','inbound'];(function(_0x4e067e,_0x9bfd06){var _0x1e6c93=function(_0x50f659){while(--_0x50f659){_0x4e067e['push'](_0x4e067e['shift']());}};_0x1e6c93(++_0x9bfd06);}(_0xbac6,0x1ec));var _0x6bac=function(_0x3f510e,_0x4d2fd1){_0x3f510e=_0x3f510e-0x0;var _0x301cc4=_0xbac6[_0x3f510e];return _0x301cc4;};'use strict';var Sequelize=require(_0x6bac('0x0'));module[_0x6bac('0x1')]={'uniqueid':{'type':Sequelize[_0x6bac('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6bac('0x3'),'internal',_0x6bac('0x4'),'inbound-fax',_0x6bac('0x5'),_0x6bac('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6bac('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x6bac('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6bac('0x2')]},'channel':{'type':Sequelize[_0x6bac('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6bac('0x7')]},'endtime':{'type':Sequelize[_0x6bac('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6bac('0x2')]},'amaflags':{'type':Sequelize[_0x6bac('0x2')]},'userfield':{'type':Sequelize[_0x6bac('0x2')]},'userDisposition':{'type':Sequelize[_0x6bac('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x6bac('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6bac('0x2')]},'prefix':{'type':Sequelize[_0x6bac('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x6bac('0x2')]}}; \ No newline at end of file +var _0x3f9b=['internal','dialer','DATE','INTEGER','STRING','inbound'];(function(_0x32dc62,_0xb7f67c){var _0x307f88=function(_0x4ef903){while(--_0x4ef903){_0x32dc62['push'](_0x32dc62['shift']());}};_0x307f88(++_0xb7f67c);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x12de80,_0x2c6f81){_0x12de80=_0x12de80-0x0;var _0x3613d4=_0x3f9b[_0x12de80];return _0x3613d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb3f9('0x0')]},'type':{'type':Sequelize['ENUM'](_0xb3f9('0x1'),_0xb3f9('0x2'),'outbound','inbound-fax','outbound-fax',_0xb3f9('0x3'))},'tag':{'type':Sequelize[_0xb3f9('0x0')]},'accountcode':{'type':Sequelize[_0xb3f9('0x0')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xb3f9('0x0')]},'destinationcontext':{'type':Sequelize[_0xb3f9('0x0')]},'callerid':{'type':Sequelize[_0xb3f9('0x0')]},'channel':{'type':Sequelize[_0xb3f9('0x0')]},'destinationchannel':{'type':Sequelize[_0xb3f9('0x0')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xb3f9('0x4')]},'systemanswertime':{'type':Sequelize[_0xb3f9('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb3f9('0x4')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xb3f9('0x5')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb3f9('0x0')]},'amaflags':{'type':Sequelize[_0xb3f9('0x0')]},'userfield':{'type':Sequelize[_0xb3f9('0x0')]},'userDisposition':{'type':Sequelize[_0xb3f9('0x0')]},'userSecondDisposition':{'type':Sequelize[_0xb3f9('0x0')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb3f9('0x0')]},'prefix':{'type':Sequelize[_0xb3f9('0x0')]},'routeid':{'type':Sequelize[_0xb3f9('0x5')]},'sipcallid':{'type':Sequelize[_0xb3f9('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index d83ae82..86942d8 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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0xc63a6d,_0x194434){var _0x52ce2d=function(_0x3eff16){while(--_0x3eff16){_0xc63a6d['push'](_0xc63a6d['shift']());}};_0x52ce2d(++_0x194434);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x0b0e[_0x5cbf0e];return _0x1c76f8;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3e2ab10..9c8b06d 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 _0x472b=['VoiceCallReport','uniqueid','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x41f462,_0x1bd196){var _0x5b467f=function(_0x352c79){while(--_0x352c79){_0x41f462['push'](_0x41f462['shift']());}};_0x5b467f(++_0x1bd196);}(_0x472b,0xe8));var _0xb472=function(_0x4f0d81,_0x5f019a){_0x4f0d81=_0x4f0d81-0x0;var _0x2da067=_0x472b[_0x4f0d81];return _0x2da067;};'use strict';var _=require(_0xb472('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb472('0x1'));var BPromise=require(_0xb472('0x2'));var rp=require(_0xb472('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb472('0x4'));var config=require(_0xb472('0x5'));var attributes=require(_0xb472('0x6'));module[_0xb472('0x7')]=function(_0x1b3cc9,_0x11c7f4){return _0x1b3cc9['define'](_0xb472('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xb472('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d32=['./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x260149,_0x49b979){var _0x1b69a1=function(_0xdd2b7d){while(--_0xdd2b7d){_0x260149['push'](_0x260149['shift']());}};_0x1b69a1(++_0x49b979);}(_0x7d32,0x1c0));var _0x27d3=function(_0x2b51a8,_0x12ca08){_0x2b51a8=_0x2b51a8-0x0;var _0x369802=_0x7d32[_0x2b51a8];return _0x369802;};'use strict';var _=require(_0x27d3('0x0'));var util=require('util');var logger=require(_0x27d3('0x1'))(_0x27d3('0x2'));var moment=require('moment');var BPromise=require(_0x27d3('0x3'));var rp=require(_0x27d3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27d3('0x5'));var config=require(_0x27d3('0x6'));var attributes=require(_0x27d3('0x7'));module[_0x27d3('0x8')]=function(_0x4fc61d,_0x15da16){return _0x4fc61d[_0x27d3('0x9')](_0x27d3('0xa'),attributes,{'tableName':_0x27d3('0xb'),'paranoid':![],'indexes':[{'fields':[_0x27d3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b643379..d488b99 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 _0x1441=['include','model','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','info','result','message','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','map'];(function(_0x88ee14,_0xac6fbe){var _0x282f3a=function(_0x19af7c){while(--_0x19af7c){_0x88ee14['push'](_0x88ee14['shift']());}};_0x282f3a(++_0xac6fbe);}(_0x1441,0x1ab));var _0x1144=function(_0x5af709,_0x1481ca){_0x5af709=_0x5af709-0x0;var _0x190c50=_0x1441[_0x5af709];return _0x190c50;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1144('0x0'));var BPromise=require(_0x1144('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1144('0x2'));var db=require(_0x1144('0x3'))['db'];var utils=require(_0x1144('0x4'));var logger=require(_0x1144('0x5'))(_0x1144('0x6'));var config=require(_0x1144('0x7'));var jayson=require(_0x1144('0x8'));var client=jayson[_0x1144('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11faab,_0x1e8a75,_0xad00c3){return new BPromise(function(_0x2e5495,_0x4a0511){return client['request'](_0x11faab,_0xad00c3)[_0x1144('0xa')](function(_0x2dd7a7){logger['info'](_0x1144('0xb'),_0x1e8a75,_0x1144('0xc'));logger[_0x1144('0xd')](_0x1144('0xe'),_0x1e8a75,_0x1144('0xc'),JSON[_0x1144('0xf')](_0x2dd7a7));if(_0x2dd7a7[_0x1144('0x10')]){if(_0x2dd7a7[_0x1144('0x10')][_0x1144('0x11')]===0x1f4){logger[_0x1144('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x1e8a75,_0x2dd7a7[_0x1144('0x10')]['message']);return _0x4a0511(_0x2dd7a7[_0x1144('0x10')]['message']);}logger[_0x1144('0x10')](_0x1144('0xb'),_0x1e8a75,_0x2dd7a7[_0x1144('0x10')]['message']);return _0x2e5495(_0x2dd7a7[_0x1144('0x10')]['message']);}else{logger[_0x1144('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x1e8a75,_0x1144('0xc'));_0x2e5495(_0x2dd7a7[_0x1144('0x13')][_0x1144('0x14')]);}})[_0x1144('0x15')](function(_0xd87df4){logger[_0x1144('0x10')](_0x1144('0xb'),_0x1e8a75,_0xd87df4);_0x4a0511(_0xd87df4);});});}exports[_0x1144('0x16')]=function(_0xdf182d){var _0x1dc1a8=this;return new Promise(function(_0x157e26,_0x1aafc7){return db['VoiceCallReport'][_0x1144('0x17')]({'raw':_0xdf182d[_0x1144('0x18')]?_0xdf182d['options'][_0x1144('0x19')]===undefined?!![]:![]:!![],'where':_0xdf182d[_0x1144('0x18')]?_0xdf182d[_0x1144('0x18')][_0x1144('0x1a')]||null:null,'attributes':_0xdf182d[_0x1144('0x18')]?_0xdf182d[_0x1144('0x18')][_0x1144('0x1b')]||null:null,'limit':_0xdf182d[_0x1144('0x18')]?_0xdf182d[_0x1144('0x18')]['limit']||null:null,'include':_0xdf182d[_0x1144('0x18')]?_0xdf182d[_0x1144('0x18')]['include']?_[_0x1144('0x1c')](_0xdf182d[_0x1144('0x18')]['include'],function(_0xb7859b){return{'model':db[_0xb7859b['model']],'as':_0xb7859b['as'],'attributes':_0xb7859b[_0x1144('0x1b')],'include':_0xb7859b['include']?_[_0x1144('0x1c')](_0xb7859b[_0x1144('0x1d')],function(_0xd34844){return{'model':db[_0xd34844[_0x1144('0x1e')]],'as':_0xd34844['as'],'attributes':_0xd34844['attributes'],'include':_0xd34844[_0x1144('0x1d')]?_[_0x1144('0x1c')](_0xd34844[_0x1144('0x1d')],function(_0x75cd01){return{'model':db[_0x75cd01[_0x1144('0x1e')]],'as':_0x75cd01['as'],'attributes':_0x75cd01['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18a883){logger[_0x1144('0x12')](_0x1144('0x16'),_0xdf182d);logger[_0x1144('0xd')](_0x1144('0x16'),_0xdf182d,JSON[_0x1144('0xf')](_0x18a883));_0x157e26(_0x18a883);})[_0x1144('0x15')](function(_0x105495){logger[_0x1144('0x10')]('GetVoiceCallReport',_0x105495[_0x1144('0x14')],_0xdf182d);_0x1aafc7(_0x1dc1a8[_0x1144('0x10')](0x1f4,_0x105495[_0x1144('0x14')]));});});};exports[_0x1144('0x1f')]=function(_0xcd9ef3){var _0x151948=this;return new Promise(function(_0x49fd3a,_0x5aeac2){return db[_0x1144('0x20')][_0x1144('0x21')](_0xcd9ef3[_0x1144('0x22')],{'raw':_0xcd9ef3[_0x1144('0x18')]?_0xcd9ef3['options'][_0x1144('0x19')]===undefined?!![]:![]:!![]})[_0x1144('0xa')](function(_0xbe6d39){logger[_0x1144('0x12')](_0x1144('0x1f'),_0xcd9ef3);logger['debug'](_0x1144('0x1f'),_0xcd9ef3,JSON[_0x1144('0xf')](_0xbe6d39));_0x49fd3a(_0xbe6d39);})[_0x1144('0x15')](function(_0x2e6b9d){logger[_0x1144('0x10')](_0x1144('0x1f'),_0x2e6b9d[_0x1144('0x14')],_0xcd9ef3);_0x5aeac2(_0x151948[_0x1144('0x10')](0x1f4,_0x2e6b9d['message']));});});};exports[_0x1144('0x23')]=function(_0x154b59){var _0x26cac9=this;return new Promise(function(_0x51bcb4,_0x12efba){return db[_0x1144('0x20')][_0x1144('0x24')](_0x154b59['body'],{'raw':_0x154b59['options']?_0x154b59[_0x1144('0x18')][_0x1144('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x154b59[_0x1144('0x18')]?_0x154b59[_0x1144('0x18')][_0x1144('0x1a')]||null:null,'attributes':_0x154b59[_0x1144('0x18')]?_0x154b59[_0x1144('0x18')]['attributes']||null:null,'limit':_0x154b59[_0x1144('0x18')]?_0x154b59[_0x1144('0x18')][_0x1144('0x25')]||null:null})['then'](function(_0x4eeb5c){logger[_0x1144('0x12')](_0x1144('0x23'),_0x154b59);logger[_0x1144('0xd')]('UpdateVoiceCallReport',_0x154b59,JSON[_0x1144('0xf')](_0x4eeb5c));_0x51bcb4(_0x4eeb5c);})['catch'](function(_0x75ae2c){logger['error'](_0x1144('0x23'),_0x75ae2c['message'],_0x154b59);_0x12efba(_0x26cac9['error'](0x1f4,_0x75ae2c['message']));});});}; \ No newline at end of file +var _0x8aab=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetVoiceCallReport','findAll','options','attributes','limit','map','model','include','catch','CreateVoiceCallReport','VoiceCallReport','create','body','raw','update','where'];(function(_0xc7e482,_0x8ec72d){var _0x958069=function(_0x24bdf9){while(--_0x24bdf9){_0xc7e482['push'](_0xc7e482['shift']());}};_0x958069(++_0x8ec72d);}(_0x8aab,0x1c7));var _0xb8aa=function(_0x12a9be,_0x2ec872){_0x12a9be=_0x12a9be-0x0;var _0x55a9fd=_0x8aab[_0x12a9be];return _0x55a9fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb8aa('0x0'));var BPromise=require(_0xb8aa('0x1'));var rs=require(_0xb8aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8aa('0x3'))['db'];var utils=require(_0xb8aa('0x4'));var logger=require(_0xb8aa('0x5'))('rpc');var config=require(_0xb8aa('0x6'));var jayson=require(_0xb8aa('0x7'));var client=jayson[_0xb8aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe99c90,_0x217ef4,_0x45540b){return new BPromise(function(_0x499c52,_0x18295b){return client['request'](_0xe99c90,_0x45540b)[_0xb8aa('0x9')](function(_0x467ee2){logger[_0xb8aa('0xa')](_0xb8aa('0xb'),_0x217ef4,'request\x20sent');logger[_0xb8aa('0xc')](_0xb8aa('0xd'),_0x217ef4,_0xb8aa('0xe'),JSON[_0xb8aa('0xf')](_0x467ee2));if(_0x467ee2[_0xb8aa('0x10')]){if(_0x467ee2[_0xb8aa('0x10')]['code']===0x1f4){logger[_0xb8aa('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x217ef4,_0x467ee2['error']['message']);return _0x18295b(_0x467ee2[_0xb8aa('0x10')][_0xb8aa('0x11')]);}logger[_0xb8aa('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x217ef4,_0x467ee2[_0xb8aa('0x10')][_0xb8aa('0x11')]);return _0x499c52(_0x467ee2[_0xb8aa('0x10')]['message']);}else{logger[_0xb8aa('0xa')](_0xb8aa('0xb'),_0x217ef4,_0xb8aa('0xe'));_0x499c52(_0x467ee2[_0xb8aa('0x12')]['message']);}})['catch'](function(_0x2ba04a){logger[_0xb8aa('0x10')](_0xb8aa('0xb'),_0x217ef4,_0x2ba04a);_0x18295b(_0x2ba04a);});});}exports[_0xb8aa('0x13')]=function(_0x118d1c){var _0xbae7ba=this;return new Promise(function(_0x242261,_0x2e3bbf){return db['VoiceCallReport'][_0xb8aa('0x14')]({'raw':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c[_0xb8aa('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c['options']['where']||null:null,'attributes':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c[_0xb8aa('0x15')][_0xb8aa('0x16')]||null:null,'limit':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c[_0xb8aa('0x15')][_0xb8aa('0x17')]||null:null,'include':_0x118d1c[_0xb8aa('0x15')]?_0x118d1c[_0xb8aa('0x15')]['include']?_[_0xb8aa('0x18')](_0x118d1c[_0xb8aa('0x15')]['include'],function(_0x227b62){return{'model':db[_0x227b62[_0xb8aa('0x19')]],'as':_0x227b62['as'],'attributes':_0x227b62[_0xb8aa('0x16')],'include':_0x227b62['include']?_[_0xb8aa('0x18')](_0x227b62['include'],function(_0x4070e9){return{'model':db[_0x4070e9['model']],'as':_0x4070e9['as'],'attributes':_0x4070e9[_0xb8aa('0x16')],'include':_0x4070e9[_0xb8aa('0x1a')]?_[_0xb8aa('0x18')](_0x4070e9['include'],function(_0x5713fa){return{'model':db[_0x5713fa[_0xb8aa('0x19')]],'as':_0x5713fa['as'],'attributes':_0x5713fa['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8aa('0x9')](function(_0x32987e){logger[_0xb8aa('0xa')](_0xb8aa('0x13'),_0x118d1c);logger[_0xb8aa('0xc')](_0xb8aa('0x13'),_0x118d1c,JSON[_0xb8aa('0xf')](_0x32987e));_0x242261(_0x32987e);})[_0xb8aa('0x1b')](function(_0x3a1d42){logger[_0xb8aa('0x10')](_0xb8aa('0x13'),_0x3a1d42['message'],_0x118d1c);_0x2e3bbf(_0xbae7ba[_0xb8aa('0x10')](0x1f4,_0x3a1d42[_0xb8aa('0x11')]));});});};exports[_0xb8aa('0x1c')]=function(_0x353f2d){var _0x79f908=this;return new Promise(function(_0x3d5947,_0x3195f1){return db[_0xb8aa('0x1d')][_0xb8aa('0x1e')](_0x353f2d[_0xb8aa('0x1f')],{'raw':_0x353f2d['options']?_0x353f2d['options'][_0xb8aa('0x20')]===undefined?!![]:![]:!![]})[_0xb8aa('0x9')](function(_0x19c37b){logger[_0xb8aa('0xa')](_0xb8aa('0x1c'),_0x353f2d);logger['debug'](_0xb8aa('0x1c'),_0x353f2d,JSON[_0xb8aa('0xf')](_0x19c37b));_0x3d5947(_0x19c37b);})[_0xb8aa('0x1b')](function(_0x5c5504){logger['error'](_0xb8aa('0x1c'),_0x5c5504['message'],_0x353f2d);_0x3195f1(_0x79f908[_0xb8aa('0x10')](0x1f4,_0x5c5504[_0xb8aa('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x109c21){var _0xf7cc8a=this;return new Promise(function(_0x5b8cbe,_0x56954c){return db[_0xb8aa('0x1d')][_0xb8aa('0x21')](_0x109c21[_0xb8aa('0x1f')],{'raw':_0x109c21[_0xb8aa('0x15')]?_0x109c21[_0xb8aa('0x15')][_0xb8aa('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x109c21[_0xb8aa('0x15')]?_0x109c21[_0xb8aa('0x15')][_0xb8aa('0x22')]||null:null,'attributes':_0x109c21[_0xb8aa('0x15')]?_0x109c21[_0xb8aa('0x15')][_0xb8aa('0x16')]||null:null,'limit':_0x109c21[_0xb8aa('0x15')]?_0x109c21[_0xb8aa('0x15')][_0xb8aa('0x17')]||null:null})[_0xb8aa('0x9')](function(_0x18582b){logger[_0xb8aa('0xa')]('UpdateVoiceCallReport',_0x109c21);logger[_0xb8aa('0xc')]('UpdateVoiceCallReport',_0x109c21,JSON[_0xb8aa('0xf')](_0x18582b));_0x5b8cbe(_0x18582b);})[_0xb8aa('0x1b')](function(_0x2552b4){logger['error']('UpdateVoiceCallReport',_0x2552b4[_0xb8aa('0x11')],_0x109c21);_0x56954c(_0xf7cc8a['error'](0x1f4,_0x2552b4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6480a98..24bee0e 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 _0x41c9=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','connect-timeout'];(function(_0x1e050c,_0x48d28b){var _0x5fcffc=function(_0x2b656a){while(--_0x2b656a){_0x1e050c['push'](_0x1e050c['shift']());}};_0x5fcffc(++_0x48d28b);}(_0x41c9,0x98));var _0x941c=function(_0xc21219,_0x1d8337){_0xc21219=_0xc21219-0x0;var _0x171d4c=_0x41c9[_0xc21219];return _0x171d4c;};'use strict';var multer=require(_0x941c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x941c('0x1'));var express=require('express');var router=express[_0x941c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x941c('0x3'));var interaction=require(_0x941c('0x4'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x941c('0x5')]('/',auth[_0x941c('0x6')](),controller['index']);router[_0x941c('0x5')](_0x941c('0x7'),auth[_0x941c('0x6')](),controller[_0x941c('0x8')]);router[_0x941c('0x9')]('/',auth[_0x941c('0x6')](),controller[_0x941c('0xa')]);router[_0x941c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x941c('0xc')]);router['delete']('/:id',auth[_0x941c('0x6')](),controller['destroy']);module[_0x941c('0xd')]=router; \ No newline at end of file +var _0x7d2c=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','update','destroy'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7d2c,0x199));var _0xc7d2=function(_0x684ca2,_0x31e36a){_0x684ca2=_0x684ca2-0x0;var _0x5c5f67=_0x7d2c[_0x684ca2];return _0x5c5f67;};'use strict';var multer=require('multer');var util=require(_0xc7d2('0x0'));var path=require(_0xc7d2('0x1'));var timeout=require(_0xc7d2('0x2'));var express=require(_0xc7d2('0x3'));var router=express[_0xc7d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7d2('0x5'));var interaction=require(_0xc7d2('0x6'));var config=require('../../config/environment');var controller=require(_0xc7d2('0x7'));router[_0xc7d2('0x8')]('/',auth[_0xc7d2('0x9')](),controller[_0xc7d2('0xa')]);router[_0xc7d2('0x8')](_0xc7d2('0xb'),auth['isAuthenticated'](),controller[_0xc7d2('0xc')]);router[_0xc7d2('0xd')]('/',auth[_0xc7d2('0x9')](),controller['create']);router['put'](_0xc7d2('0xb'),auth[_0xc7d2('0x9')](),controller[_0xc7d2('0xe')]);router['delete']('/:id',auth[_0xc7d2('0x9')](),controller[_0xc7d2('0xf')]);module[_0xc7d2('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6a6df6c..a3afab6 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 _0x76a4=['getDataValue','BOOLEAN','sequelize','exports','STRING','options','join'];(function(_0x2f12a1,_0x2bac9a){var _0x4cebb9=function(_0x84268b){while(--_0x84268b){_0x2f12a1['push'](_0x2f12a1['shift']());}};_0x4cebb9(++_0x2bac9a);}(_0x76a4,0x13d));var _0x476a=function(_0x37a429,_0x518676){_0x37a429=_0x37a429-0x0;var _0x330a13=_0x76a4[_0x37a429];return _0x330a13;};'use strict';var Sequelize=require(_0x476a('0x0'));module[_0x476a('0x1')]={'name':{'type':Sequelize[_0x476a('0x2')]},'prefix':{'type':Sequelize[_0x476a('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x476a('0x2')],'set':function(_0x3acd3b){this['setDataValue'](_0x476a('0x3'),_0x3acd3b?_0x3acd3b[_0x476a('0x4')](''):[]);},'get':function(){return this[_0x476a('0x5')]('options')?this['getDataValue']('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x476a('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x476a('0x2')]},'record':{'type':Sequelize[_0x476a('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x476a('0x2')]}}; \ No newline at end of file +var _0xbe32=['join','getDataValue','split','sequelize','exports','STRING','name','options'];(function(_0x584283,_0x1032da){var _0x47beaf=function(_0x3c1365){while(--_0x3c1365){_0x584283['push'](_0x584283['shift']());}};_0x47beaf(++_0x1032da);}(_0xbe32,0x133));var _0x2be3=function(_0x3f50b5,_0x472ce8){_0x3f50b5=_0x3f50b5-0x0;var _0x2f7db1=_0xbe32[_0x3f50b5];return _0x2f7db1;};'use strict';var Sequelize=require(_0x2be3('0x0'));module[_0x2be3('0x1')]={'name':{'type':Sequelize[_0x2be3('0x2')]},'prefix':{'type':Sequelize[_0x2be3('0x2')],'unique':_0x2be3('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2be3('0x2')],'set':function(_0x11e993){this['setDataValue'](_0x2be3('0x4'),_0x11e993?_0x11e993[_0x2be3('0x5')](''):[]);},'get':function(){return this[_0x2be3('0x6')]('options')?this[_0x2be3('0x6')]('options')[_0x2be3('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x2be3('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2be3('0x2')]},'description':{'type':Sequelize[_0x2be3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index bbec46c..a220ec2 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 _0x45ea=['VoiceChanSpy','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','include','findAll','show','params','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','reject','update','then','destroy','get','ChanSpies','UserProfileResource','end','error','name','map'];(function(_0x4b1dac,_0x2e0da2){var _0x18092a=function(_0x1a7dbb){while(--_0x1a7dbb){_0x4b1dac['push'](_0x4b1dac['shift']());}};_0x18092a(++_0x2e0da2);}(_0x45ea,0x1f0));var _0xa45e=function(_0x7cdd69,_0x4a3acc){_0x7cdd69=_0x7cdd69-0x0;var _0x541803=_0x45ea[_0x7cdd69];return _0x541803;};'use strict';var emlformat=require(_0xa45e('0x0'));var rimraf=require(_0xa45e('0x1'));var zipdir=require(_0xa45e('0x2'));var jsonpatch=require(_0xa45e('0x3'));var rp=require(_0xa45e('0x4'));var moment=require(_0xa45e('0x5'));var BPromise=require(_0xa45e('0x6'));var Mustache=require(_0xa45e('0x7'));var util=require(_0xa45e('0x8'));var path=require(_0xa45e('0x9'));var sox=require(_0xa45e('0xa'));var csv=require('to-csv');var ejs=require(_0xa45e('0xb'));var fs=require('fs');var fs_extra=require(_0xa45e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa45e('0xd'));var deskjs=require(_0xa45e('0xe'));var toCsv=require(_0xa45e('0xf'));var querystring=require(_0xa45e('0x10'));var Papa=require(_0xa45e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa45e('0x12'));var as=require(_0xa45e('0x13'));var hardwareService=require(_0xa45e('0x14'));var logger=require(_0xa45e('0x15'))('api');var utils=require(_0xa45e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa45e('0x17'));var db=require(_0xa45e('0x18'))['db'];function respondWithStatusCode(_0x558a06,_0x4a1b17){_0x4a1b17=_0x4a1b17||0xcc;return function(_0x1f19f0){if(_0x1f19f0){return _0x558a06['sendStatus'](_0x4a1b17);}return _0x558a06[_0xa45e('0x19')](_0x4a1b17)['end']();};}function respondWithResult(_0x502c24,_0x4f36f8){_0x4f36f8=_0x4f36f8||0xc8;return function(_0x1d90ab){if(_0x1d90ab){return _0x502c24['status'](_0x4f36f8)[_0xa45e('0x1a')](_0x1d90ab);}};}function respondWithFilteredResult(_0x2fbd46,_0x3cfc97){return function(_0x330557){if(_0x330557){var _0x1201cd=typeof _0x3cfc97['offset']===_0xa45e('0x1b')&&typeof _0x3cfc97[_0xa45e('0x1c')]===_0xa45e('0x1b');var _0x326ed4=_0x330557[_0xa45e('0x1d')];var _0x534e87=_0x1201cd?0x0:_0x3cfc97[_0xa45e('0x1e')];var _0x8e85c1=_0x1201cd?_0x330557[_0xa45e('0x1d')]:_0x3cfc97[_0xa45e('0x1e')]+_0x3cfc97[_0xa45e('0x1c')];var _0x3901c9;if(_0x8e85c1>=_0x326ed4){_0x8e85c1=_0x326ed4;_0x3901c9=0xc8;}else{_0x3901c9=0xce;}_0x2fbd46[_0xa45e('0x19')](_0x3901c9);return _0x2fbd46[_0xa45e('0x1f')]('Content-Range',_0x534e87+'-'+_0x8e85c1+'/'+_0x326ed4)[_0xa45e('0x1a')](_0x330557);}return null;};}function patchUpdates(_0xcf43bd){return function(_0xc061d9){try{jsonpatch['apply'](_0xc061d9,_0xcf43bd,!![]);}catch(_0x50f7c4){return BPromise[_0xa45e('0x20')](_0x50f7c4);}return _0xc061d9['save']();};}function saveUpdates(_0x11fa08,_0x37907c){return function(_0x26c7b1){if(_0x26c7b1){return _0x26c7b1[_0xa45e('0x21')](_0x11fa08)[_0xa45e('0x22')](function(_0x57324c){return _0x57324c;});}return null;};}function removeEntity(_0x107d9c,_0x54f14d){return function(_0x2e4fed){if(_0x2e4fed){return _0x2e4fed[_0xa45e('0x23')]()['then'](function(){var _0x52e93d=_0x2e4fed[_0xa45e('0x24')]({'plain':!![]});var _0x5aec7d=_0xa45e('0x25');return db[_0xa45e('0x26')][_0xa45e('0x23')]({'where':{'type':_0x5aec7d,'resourceId':_0x52e93d['id']}})['then'](function(){return _0x2e4fed;});})['then'](function(){_0x107d9c[_0xa45e('0x19')](0xcc)[_0xa45e('0x27')]();});}};}function handleEntityNotFound(_0x228ec8,_0x22cd4d){return function(_0x78a762){if(!_0x78a762){_0x228ec8['sendStatus'](0x194);}return _0x78a762;};}function handleError(_0x1cf6c2,_0x3f42ec){_0x3f42ec=_0x3f42ec||0x1f4;return function(_0x5e2a58){logger[_0xa45e('0x28')](_0x5e2a58['stack']);if(_0x5e2a58['name']){delete _0x5e2a58[_0xa45e('0x29')];}_0x1cf6c2[_0xa45e('0x19')](_0x3f42ec)['send'](_0x5e2a58);};}exports['index']=function(_0x203687,_0x3bb0f6){var _0x1e860c={},_0x4867a4={},_0x118a82={'count':0x0,'rows':[]};var _0x4683a0=_[_0xa45e('0x2a')](db[_0xa45e('0x2b')]['rawAttributes'],function(_0x45248a){return{'name':_0x45248a[_0xa45e('0x2c')],'type':_0x45248a['type']['key']};});_0x4867a4[_0xa45e('0x2d')]=_[_0xa45e('0x2a')](_0x4683a0,'name');_0x4867a4[_0xa45e('0x2e')]=_[_0xa45e('0x2f')](_0x203687[_0xa45e('0x2e')]);_0x4867a4['filters']=_[_0xa45e('0x30')](_0x4867a4[_0xa45e('0x2d')],_0x4867a4[_0xa45e('0x2e')]);_0x1e860c['attributes']=_[_0xa45e('0x30')](_0x4867a4[_0xa45e('0x2d')],qs[_0xa45e('0x31')](_0x203687[_0xa45e('0x2e')][_0xa45e('0x31')]));_0x1e860c[_0xa45e('0x32')]=_0x1e860c[_0xa45e('0x32')][_0xa45e('0x33')]?_0x1e860c[_0xa45e('0x32')]:_0x4867a4[_0xa45e('0x2d')];if(!_0x203687[_0xa45e('0x2e')][_0xa45e('0x34')](_0xa45e('0x35'))){_0x1e860c['limit']=qs['limit'](_0x203687[_0xa45e('0x2e')][_0xa45e('0x1c')]);_0x1e860c[_0xa45e('0x1e')]=qs[_0xa45e('0x1e')](_0x203687[_0xa45e('0x2e')][_0xa45e('0x1e')]);}_0x1e860c['order']=qs[_0xa45e('0x36')](_0x203687[_0xa45e('0x2e')]['sort']);_0x1e860c[_0xa45e('0x37')]=qs['filters'](_[_0xa45e('0x38')](_0x203687['query'],_0x4867a4[_0xa45e('0x39')]),_0x4683a0);if(_0x203687[_0xa45e('0x2e')][_0xa45e('0x3a')]){_0x1e860c[_0xa45e('0x37')]=_[_0xa45e('0x3b')](_0x1e860c[_0xa45e('0x37')],{'$or':_[_0xa45e('0x2a')](_0x4683a0,function(_0x33b4ba){if(_0x33b4ba[_0xa45e('0x3c')]!==_0xa45e('0x3d')){var _0x424890={};_0x424890[_0x33b4ba[_0xa45e('0x29')]]={'$like':'%'+_0x203687[_0xa45e('0x2e')][_0xa45e('0x3a')]+'%'};return _0x424890;}})});}_0x1e860c=_[_0xa45e('0x3b')]({},_0x1e860c,_0x203687[_0xa45e('0x3e')]);var _0x217bbb={'where':_0x1e860c[_0xa45e('0x37')]};return db[_0xa45e('0x2b')][_0xa45e('0x1d')](_0x217bbb)[_0xa45e('0x22')](function(_0x44c752){_0x118a82[_0xa45e('0x1d')]=_0x44c752;if(_0x203687[_0xa45e('0x2e')]['includeAll']){_0x1e860c[_0xa45e('0x3f')]=[{'all':!![]}];}return db[_0xa45e('0x2b')][_0xa45e('0x40')](_0x1e860c);})['then'](function(_0x2aa63a){_0x118a82['rows']=_0x2aa63a;return _0x118a82;})[_0xa45e('0x22')](respondWithFilteredResult(_0x3bb0f6,_0x1e860c))['catch'](handleError(_0x3bb0f6,null));};exports[_0xa45e('0x41')]=function(_0x36c948,_0x199b9a){var _0x533620={'raw':![],'where':{'id':_0x36c948[_0xa45e('0x42')]['id']}},_0x5b4d99={};_0x5b4d99[_0xa45e('0x2d')]=_[_0xa45e('0x2f')](db[_0xa45e('0x2b')][_0xa45e('0x43')]);_0x5b4d99['query']=_[_0xa45e('0x2f')](_0x36c948[_0xa45e('0x2e')]);_0x5b4d99[_0xa45e('0x39')]=_[_0xa45e('0x30')](_0x5b4d99[_0xa45e('0x2d')],_0x5b4d99[_0xa45e('0x2e')]);_0x533620[_0xa45e('0x32')]=_['intersection'](_0x5b4d99[_0xa45e('0x2d')],qs[_0xa45e('0x31')](_0x36c948[_0xa45e('0x2e')][_0xa45e('0x31')]));_0x533620[_0xa45e('0x32')]=_0x533620['attributes'][_0xa45e('0x33')]?_0x533620['attributes']:_0x5b4d99[_0xa45e('0x2d')];if(_0x36c948[_0xa45e('0x2e')]['includeAll']){_0x533620[_0xa45e('0x3f')]=[{'all':!![]}];}_0x533620=_['merge']({},_0x533620,_0x36c948['options']);return db[_0xa45e('0x2b')][_0xa45e('0x44')](_0x533620)[_0xa45e('0x22')](handleEntityNotFound(_0x199b9a,null))[_0xa45e('0x22')](respondWithResult(_0x199b9a,null))[_0xa45e('0x45')](handleError(_0x199b9a,null));};exports[_0xa45e('0x46')]=function(_0x1b16ea,_0x4ffd22){return db[_0xa45e('0x2b')][_0xa45e('0x46')](_0x1b16ea['body'],{})['then'](function(_0x4d76a8){var _0x341855=_0x1b16ea[_0xa45e('0x47')][_0xa45e('0x24')]({'plain':!![]});if(!_0x341855)throw new Error(_0xa45e('0x48'));if(_0x341855[_0xa45e('0x49')]===_0xa45e('0x47')){var _0x45bc36=_0x4d76a8[_0xa45e('0x24')]({'plain':!![]});var _0xd2c5cf='ChanSpies';return db[_0xa45e('0x4a')][_0xa45e('0x44')]({'where':{'name':_0xd2c5cf,'userProfileId':_0x341855['userProfileId']},'raw':!![]})[_0xa45e('0x22')](function(_0x3339b2){if(_0x3339b2&&_0x3339b2['autoAssociation']===0x0){return db[_0xa45e('0x26')]['create']({'name':_0x45bc36[_0xa45e('0x29')],'resourceId':_0x45bc36['id'],'type':_0x3339b2[_0xa45e('0x29')],'sectionId':_0x3339b2['id']},{})[_0xa45e('0x22')](function(){return _0x4d76a8;});}else{return _0x4d76a8;}})[_0xa45e('0x45')](function(_0xa6b475){logger[_0xa45e('0x28')](_0xa45e('0x4b'),_0xa6b475);throw _0xa6b475;});}return _0x4d76a8;})[_0xa45e('0x22')](respondWithResult(_0x4ffd22,0xc9))['catch'](handleError(_0x4ffd22,null));};exports[_0xa45e('0x21')]=function(_0x2399bd,_0x270c4d){if(_0x2399bd[_0xa45e('0x4c')]['id']){delete _0x2399bd[_0xa45e('0x4c')]['id'];}return db[_0xa45e('0x2b')][_0xa45e('0x44')]({'where':{'id':_0x2399bd['params']['id']}})['then'](handleEntityNotFound(_0x270c4d,null))[_0xa45e('0x22')](saveUpdates(_0x2399bd[_0xa45e('0x4c')],null))[_0xa45e('0x22')](respondWithResult(_0x270c4d,null))[_0xa45e('0x45')](handleError(_0x270c4d,null));};exports[_0xa45e('0x23')]=function(_0x10902a,_0x2195a2){return db[_0xa45e('0x2b')]['find']({'where':{'id':_0x10902a['params']['id']}})[_0xa45e('0x22')](handleEntityNotFound(_0x2195a2,null))[_0xa45e('0x22')](removeEntity(_0x2195a2,null))['catch'](handleError(_0x2195a2,null));}; \ No newline at end of file +var _0x3451=['ChanSpies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','VoiceChanSpy','include','findAll','catch','show','params','rawAttributes','length','includeAll','find','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x6eed90,_0x2656f2){var _0x4196f0=function(_0x11bb28){while(--_0x11bb28){_0x6eed90['push'](_0x6eed90['shift']());}};_0x4196f0(++_0x2656f2);}(_0x3451,0x19a));var _0x1345=function(_0x21a425,_0x2f1b8d){_0x21a425=_0x21a425-0x0;var _0x1aae7c=_0x3451[_0x21a425];return _0x1aae7c;};'use strict';var emlformat=require(_0x1345('0x0'));var rimraf=require(_0x1345('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1345('0x2'));var rp=require(_0x1345('0x3'));var moment=require(_0x1345('0x4'));var BPromise=require(_0x1345('0x5'));var Mustache=require(_0x1345('0x6'));var util=require(_0x1345('0x7'));var path=require(_0x1345('0x8'));var sox=require(_0x1345('0x9'));var csv=require(_0x1345('0xa'));var ejs=require(_0x1345('0xb'));var fs=require('fs');var fs_extra=require(_0x1345('0xc'));var _=require(_0x1345('0xd'));var squel=require('squel');var crypto=require(_0x1345('0xe'));var jsforce=require(_0x1345('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1345('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1345('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1345('0x11'));var as=require(_0x1345('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1345('0x13'));var utils=require('../../config/utils');var config=require(_0x1345('0x14'));var licenseUtil=require(_0x1345('0x15'));var db=require(_0x1345('0x16'))['db'];function respondWithStatusCode(_0x3e1362,_0x528692){_0x528692=_0x528692||0xcc;return function(_0x3fdff0){if(_0x3fdff0){return _0x3e1362[_0x1345('0x17')](_0x528692);}return _0x3e1362[_0x1345('0x18')](_0x528692)[_0x1345('0x19')]();};}function respondWithResult(_0x4ea08a,_0x181a2b){_0x181a2b=_0x181a2b||0xc8;return function(_0x426e00){if(_0x426e00){return _0x4ea08a[_0x1345('0x18')](_0x181a2b)[_0x1345('0x1a')](_0x426e00);}};}function respondWithFilteredResult(_0x347591,_0x959544){return function(_0x3cd49e){if(_0x3cd49e){var _0x520e6c=typeof _0x959544[_0x1345('0x1b')]===_0x1345('0x1c')&&typeof _0x959544[_0x1345('0x1d')]==='undefined';var _0x5b4d04=_0x3cd49e[_0x1345('0x1e')];var _0x1afc89=_0x520e6c?0x0:_0x959544[_0x1345('0x1b')];var _0x1db636=_0x520e6c?_0x3cd49e['count']:_0x959544[_0x1345('0x1b')]+_0x959544[_0x1345('0x1d')];var _0x1f3746;if(_0x1db636>=_0x5b4d04){_0x1db636=_0x5b4d04;_0x1f3746=0xc8;}else{_0x1f3746=0xce;}_0x347591[_0x1345('0x18')](_0x1f3746);return _0x347591[_0x1345('0x1f')](_0x1345('0x20'),_0x1afc89+'-'+_0x1db636+'/'+_0x5b4d04)[_0x1345('0x1a')](_0x3cd49e);}return null;};}function patchUpdates(_0x43d209){return function(_0x3bc681){try{jsonpatch[_0x1345('0x21')](_0x3bc681,_0x43d209,!![]);}catch(_0x265ea8){return BPromise['reject'](_0x265ea8);}return _0x3bc681[_0x1345('0x22')]();};}function saveUpdates(_0x4855d7,_0xaf6ecc){return function(_0x217712){if(_0x217712){return _0x217712[_0x1345('0x23')](_0x4855d7)[_0x1345('0x24')](function(_0x422dd9){return _0x422dd9;});}return null;};}function removeEntity(_0x2fd7ca,_0x26c2a6){return function(_0x339ea9){if(_0x339ea9){return _0x339ea9[_0x1345('0x25')]()[_0x1345('0x24')](function(){var _0x39a950=_0x339ea9['get']({'plain':!![]});var _0x346054='ChanSpies';return db[_0x1345('0x26')][_0x1345('0x25')]({'where':{'type':_0x346054,'resourceId':_0x39a950['id']}})[_0x1345('0x24')](function(){return _0x339ea9;});})[_0x1345('0x24')](function(){_0x2fd7ca[_0x1345('0x18')](0xcc)[_0x1345('0x19')]();});}};}function handleEntityNotFound(_0x3b891c,_0x25b564){return function(_0x3dcf6c){if(!_0x3dcf6c){_0x3b891c[_0x1345('0x17')](0x194);}return _0x3dcf6c;};}function handleError(_0x3d06b5,_0x2817f0){_0x2817f0=_0x2817f0||0x1f4;return function(_0x483e75){logger[_0x1345('0x27')](_0x483e75['stack']);if(_0x483e75['name']){delete _0x483e75[_0x1345('0x28')];}_0x3d06b5[_0x1345('0x18')](_0x2817f0)[_0x1345('0x29')](_0x483e75);};}exports[_0x1345('0x2a')]=function(_0x44bbba,_0x51425d){var _0x389e94={},_0x2b2be4={},_0x96c944={'count':0x0,'rows':[]};var _0x49d8e8=_[_0x1345('0x2b')](db['VoiceChanSpy']['rawAttributes'],function(_0xee1b74){return{'name':_0xee1b74[_0x1345('0x2c')],'type':_0xee1b74[_0x1345('0x2d')][_0x1345('0x2e')]};});_0x2b2be4['model']=_[_0x1345('0x2b')](_0x49d8e8,_0x1345('0x28'));_0x2b2be4[_0x1345('0x2f')]=_[_0x1345('0x30')](_0x44bbba[_0x1345('0x2f')]);_0x2b2be4[_0x1345('0x31')]=_[_0x1345('0x32')](_0x2b2be4[_0x1345('0x33')],_0x2b2be4[_0x1345('0x2f')]);_0x389e94[_0x1345('0x34')]=_[_0x1345('0x32')](_0x2b2be4['model'],qs[_0x1345('0x35')](_0x44bbba[_0x1345('0x2f')][_0x1345('0x35')]));_0x389e94[_0x1345('0x34')]=_0x389e94[_0x1345('0x34')]['length']?_0x389e94[_0x1345('0x34')]:_0x2b2be4['model'];if(!_0x44bbba['query'][_0x1345('0x36')](_0x1345('0x37'))){_0x389e94[_0x1345('0x1d')]=qs['limit'](_0x44bbba[_0x1345('0x2f')][_0x1345('0x1d')]);_0x389e94[_0x1345('0x1b')]=qs[_0x1345('0x1b')](_0x44bbba[_0x1345('0x2f')][_0x1345('0x1b')]);}_0x389e94[_0x1345('0x38')]=qs['sort'](_0x44bbba['query']['sort']);_0x389e94['where']=qs['filters'](_[_0x1345('0x39')](_0x44bbba[_0x1345('0x2f')],_0x2b2be4[_0x1345('0x31')]),_0x49d8e8);if(_0x44bbba[_0x1345('0x2f')][_0x1345('0x3a')]){_0x389e94['where']=_['merge'](_0x389e94[_0x1345('0x3b')],{'$or':_[_0x1345('0x2b')](_0x49d8e8,function(_0x14ee7c){if(_0x14ee7c[_0x1345('0x2d')]!==_0x1345('0x3c')){var _0x1eae93={};_0x1eae93[_0x14ee7c['name']]={'$like':'%'+_0x44bbba[_0x1345('0x2f')][_0x1345('0x3a')]+'%'};return _0x1eae93;}})});}_0x389e94=_[_0x1345('0x3d')]({},_0x389e94,_0x44bbba[_0x1345('0x3e')]);var _0x521cdf={'where':_0x389e94[_0x1345('0x3b')]};return db[_0x1345('0x3f')][_0x1345('0x1e')](_0x521cdf)['then'](function(_0x10f67b){_0x96c944[_0x1345('0x1e')]=_0x10f67b;if(_0x44bbba[_0x1345('0x2f')]['includeAll']){_0x389e94[_0x1345('0x40')]=[{'all':!![]}];}return db[_0x1345('0x3f')][_0x1345('0x41')](_0x389e94);})[_0x1345('0x24')](function(_0x3bbc86){_0x96c944['rows']=_0x3bbc86;return _0x96c944;})[_0x1345('0x24')](respondWithFilteredResult(_0x51425d,_0x389e94))[_0x1345('0x42')](handleError(_0x51425d,null));};exports[_0x1345('0x43')]=function(_0x1c23df,_0x4f2d65){var _0x183132={'raw':![],'where':{'id':_0x1c23df[_0x1345('0x44')]['id']}},_0x2f128c={};_0x2f128c[_0x1345('0x33')]=_[_0x1345('0x30')](db[_0x1345('0x3f')][_0x1345('0x45')]);_0x2f128c[_0x1345('0x2f')]=_[_0x1345('0x30')](_0x1c23df[_0x1345('0x2f')]);_0x2f128c[_0x1345('0x31')]=_[_0x1345('0x32')](_0x2f128c[_0x1345('0x33')],_0x2f128c[_0x1345('0x2f')]);_0x183132[_0x1345('0x34')]=_[_0x1345('0x32')](_0x2f128c['model'],qs[_0x1345('0x35')](_0x1c23df[_0x1345('0x2f')][_0x1345('0x35')]));_0x183132[_0x1345('0x34')]=_0x183132[_0x1345('0x34')][_0x1345('0x46')]?_0x183132[_0x1345('0x34')]:_0x2f128c[_0x1345('0x33')];if(_0x1c23df[_0x1345('0x2f')][_0x1345('0x47')]){_0x183132[_0x1345('0x40')]=[{'all':!![]}];}_0x183132=_[_0x1345('0x3d')]({},_0x183132,_0x1c23df[_0x1345('0x3e')]);return db['VoiceChanSpy'][_0x1345('0x48')](_0x183132)['then'](handleEntityNotFound(_0x4f2d65,null))[_0x1345('0x24')](respondWithResult(_0x4f2d65,null))[_0x1345('0x42')](handleError(_0x4f2d65,null));};exports['create']=function(_0x49b8fc,_0x27fc27){return db[_0x1345('0x3f')]['create'](_0x49b8fc['body'],{})['then'](function(_0x379a98){var _0x3f336e=_0x49b8fc['user'][_0x1345('0x49')]({'plain':!![]});if(!_0x3f336e)throw new Error(_0x1345('0x4a'));if(_0x3f336e['role']===_0x1345('0x4b')){var _0x4ce41d=_0x379a98[_0x1345('0x49')]({'plain':!![]});var _0x5aab90=_0x1345('0x4c');return db[_0x1345('0x4d')]['find']({'where':{'name':_0x5aab90,'userProfileId':_0x3f336e[_0x1345('0x4e')]},'raw':!![]})[_0x1345('0x24')](function(_0x49fda2){if(_0x49fda2&&_0x49fda2['autoAssociation']===0x0){return db[_0x1345('0x26')]['create']({'name':_0x4ce41d[_0x1345('0x28')],'resourceId':_0x4ce41d['id'],'type':_0x49fda2[_0x1345('0x28')],'sectionId':_0x49fda2['id']},{})[_0x1345('0x24')](function(){return _0x379a98;});}else{return _0x379a98;}})['catch'](function(_0x5d6526){logger['error'](_0x1345('0x4f'),_0x5d6526);throw _0x5d6526;});}return _0x379a98;})[_0x1345('0x24')](respondWithResult(_0x27fc27,0xc9))[_0x1345('0x42')](handleError(_0x27fc27,null));};exports[_0x1345('0x23')]=function(_0x52db68,_0x257009){if(_0x52db68['body']['id']){delete _0x52db68[_0x1345('0x50')]['id'];}return db[_0x1345('0x3f')][_0x1345('0x48')]({'where':{'id':_0x52db68[_0x1345('0x44')]['id']}})[_0x1345('0x24')](handleEntityNotFound(_0x257009,null))[_0x1345('0x24')](saveUpdates(_0x52db68[_0x1345('0x50')],null))[_0x1345('0x24')](respondWithResult(_0x257009,null))[_0x1345('0x42')](handleError(_0x257009,null));};exports[_0x1345('0x25')]=function(_0x5e7b35,_0x37201e){return db[_0x1345('0x3f')][_0x1345('0x48')]({'where':{'id':_0x5e7b35[_0x1345('0x44')]['id']}})[_0x1345('0x24')](handleEntityNotFound(_0x37201e,null))[_0x1345('0x24')](removeEntity(_0x37201e,null))[_0x1345('0x42')](handleError(_0x37201e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1f55a0d..12606e5 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 _0xb71d=['StopMixMonitor','concat','internal','name','User','findAll','agent','then','catch','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','push','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','options','join'];(function(_0xfb590b,_0x4bd435){var _0x1cabfd=function(_0x35c7b9){while(--_0x35c7b9){_0xfb590b['push'](_0xfb590b['shift']());}};_0x1cabfd(++_0x4bd435);}(_0xb71d,0x1a7));var _0xdb71=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb71d[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xdb71('0x0'));var util=require('util');var BPromise=require(_0xdb71('0x1'));var attributes=require(_0xdb71('0x2'));var getUserApplications=function(_0x3adb47,_0x3ce0e6,_0x20cf4b){var _0x3f99a2=0x1;var _0x489816=[];var _0x399a81={'context':_0x3ce0e6[_0xdb71('0x3')]||_0xdb71('0x4'),'exten':util[_0xdb71('0x5')](_0xdb71('0x6'),_0x3adb47[_0xdb71('0x7')],_0x20cf4b),'type':_0xdb71('0x8'),'isApp':![],'ChanSpyId':_0x3adb47['id'],'UserId':_0x3ce0e6['id']};_0x489816['push'](_[_0xdb71('0x9')]({'app':_0xdb71('0xa'),'appdata':util[_0xdb71('0x5')](_0xdb71('0xb'),'chanspy'),'priority':_0x3f99a2++},_0x399a81));if(_0x3adb47['record']){_0x489816[_0xdb71('0xc')](_[_0xdb71('0x9')]({'app':'MixMonitor','appdata':util[_0xdb71('0x5')](_0xdb71('0xd'),_0x3adb47[_0xdb71('0xe')]),'priority':_0x3f99a2++},_0x399a81));}if(_0x3adb47['auth']){_0x489816['push'](_[_0xdb71('0x9')]({'app':_0xdb71('0xf'),'appdata':_0x3adb47[_0xdb71('0x10')],'priority':_0x3f99a2++},_0x399a81));}_0x489816[_0xdb71('0xc')](_[_0xdb71('0x9')]({'app':_0xdb71('0x11'),'appdata':util[_0xdb71('0x5')](_0xdb71('0x12'),_0x3ce0e6['name'],_0x3adb47[_0xdb71('0x13')]?_0x3adb47['options'][_0xdb71('0x14')](''):''),'priority':_0x3f99a2++},_0x399a81));if(_0x3adb47['record']){_0x489816[_0xdb71('0xc')](_[_0xdb71('0x9')]({'app':_0xdb71('0x15'),'priority':_0x3f99a2++},_0x399a81));}return _0x489816;};var getChanSpyApplications=function(_0x1ca355,_0x1c6d28){var _0x30a6d6=[];for(var _0x1c0676=0x0,_0x477ec9=0x1;_0x1c0676<_0x1c6d28['length'];_0x1c0676++,_0x477ec9=0x1){_0x30a6d6=_0x30a6d6[_0xdb71('0x16')](getUserApplications(_0x1ca355,_0x1c6d28[_0x1c0676],_0x1c6d28[_0x1c0676]['internal']));if(_0x1c6d28[_0x1c0676][_0xdb71('0x17')]!=_0x1c6d28[_0x1c0676]['name']){_0x30a6d6=_0x30a6d6[_0xdb71('0x16')](getUserApplications(_0x1ca355,_0x1c6d28[_0x1c0676],_0x1c6d28[_0x1c0676][_0xdb71('0x18')]));}}return _0x30a6d6;};var getChanSpyPromise=function(_0x287148,_0x4d6a70){return new BPromise(function(_0xdd313c,_0x59d40f){return _0x287148[_0xdb71('0x19')][_0xdb71('0x1a')]({'attributes':['id',_0xdb71('0x18'),'internal'],'where':{'role':_0xdb71('0x1b'),'chanspy':!![]},'raw':!![]})[_0xdb71('0x1c')](function(_0x2b4226){if(_0x2b4226){return _0xdd313c(getChanSpyApplications(_0x4d6a70,_0x2b4226));}return _0xdd313c([]);})[_0xdb71('0x1d')](function(_0x1b2eea){_0x59d40f(_0x1b2eea);});});};module['exports']=function(_0x6ea3cb,_0x14202a){var _0x55fdb0=_0x6ea3cb['models'];return _0x6ea3cb[_0xdb71('0x1e')](_0xdb71('0x1f'),attributes,{'tableName':_0xdb71('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x499a0a,_0x23b526,_0x499fcf){return getChanSpyPromise(_0x55fdb0,_0x499a0a)['then'](function(_0x537d88){if(_0x537d88&&_0x537d88[_0xdb71('0x21')]){return _0x55fdb0[_0xdb71('0x22')][_0xdb71('0x23')](_0x537d88);}})[_0xdb71('0x1c')](function(){_0x499fcf();})['catch'](function(_0x6c0f03){_0x499fcf(_0x6c0f03);});},'afterUpdate':function(_0x5ccbb7,_0x2a42f5,_0x10b826){return _0x55fdb0[_0xdb71('0x22')]['destroy']({'where':{'ChanSpyId':_0x5ccbb7['id']}})['then'](function(){return getChanSpyPromise(_0x55fdb0,_0x5ccbb7);})[_0xdb71('0x1c')](function(_0x2431e0){if(_0x2431e0&&_0x2431e0[_0xdb71('0x21')]){return _0x55fdb0[_0xdb71('0x22')][_0xdb71('0x23')](_0x2431e0);}})[_0xdb71('0x1c')](function(){_0x10b826();})[_0xdb71('0x1d')](function(_0x4f875a){_0x10b826(_0x4f875a);});},'afterDestroy':function(_0x22591f,_0x3517ab,_0x5939ea){return _0x55fdb0[_0xdb71('0x22')][_0xdb71('0x24')]({'where':{'ChanSpyId':_0x22591f['id']}})[_0xdb71('0x1c')](function(){_0x5939ea();})['catch'](function(_0x40b0b5){_0x5939ea(_0x40b0b5);});}}});}; \ No newline at end of file +var _0x4bbe=['destroy','./voiceChanSpy.attributes','context','from-sip','format','prefix','merge','Set','chanspy','push','MixMonitor','recordingFormat','auth','Authenticate','ChanSpy','name','join','record','StopMixMonitor','length','concat','internal','User','findAll','catch','exports','define','voice_chanspy','then','VoiceExtension','bulkCreate'];(function(_0x42b02c,_0x5c7b99){var _0x105518=function(_0x305734){while(--_0x305734){_0x42b02c['push'](_0x42b02c['shift']());}};_0x105518(++_0x5c7b99);}(_0x4bbe,0xbb));var _0xe4bb=function(_0x63908c,_0x16cbd3){_0x63908c=_0x63908c-0x0;var _0x16c9d8=_0x4bbe[_0x63908c];return _0x16c9d8;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xe4bb('0x0'));var getUserApplications=function(_0x631174,_0x120c34,_0x4879f0){var _0x4db1ae=0x1;var _0x156cb8=[];var _0x12b212={'context':_0x120c34[_0xe4bb('0x1')]||_0xe4bb('0x2'),'exten':util[_0xe4bb('0x3')]('%s%s',_0x631174[_0xe4bb('0x4')],_0x4879f0),'type':'system','isApp':![],'ChanSpyId':_0x631174['id'],'UserId':_0x120c34['id']};_0x156cb8['push'](_[_0xe4bb('0x5')]({'app':_0xe4bb('0x6'),'appdata':util[_0xe4bb('0x3')]('CDR(type)=%s',_0xe4bb('0x7')),'priority':_0x4db1ae++},_0x12b212));if(_0x631174['record']){_0x156cb8[_0xe4bb('0x8')](_[_0xe4bb('0x5')]({'app':_0xe4bb('0x9'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x631174[_0xe4bb('0xa')]),'priority':_0x4db1ae++},_0x12b212));}if(_0x631174[_0xe4bb('0xb')]){_0x156cb8[_0xe4bb('0x8')](_[_0xe4bb('0x5')]({'app':_0xe4bb('0xc'),'appdata':_0x631174['password'],'priority':_0x4db1ae++},_0x12b212));}_0x156cb8[_0xe4bb('0x8')](_[_0xe4bb('0x5')]({'app':_0xe4bb('0xd'),'appdata':util['format']('SIP/%s,%s',_0x120c34[_0xe4bb('0xe')],_0x631174['options']?_0x631174['options'][_0xe4bb('0xf')](''):''),'priority':_0x4db1ae++},_0x12b212));if(_0x631174[_0xe4bb('0x10')]){_0x156cb8[_0xe4bb('0x8')](_[_0xe4bb('0x5')]({'app':_0xe4bb('0x11'),'priority':_0x4db1ae++},_0x12b212));}return _0x156cb8;};var getChanSpyApplications=function(_0x79ef0e,_0x2b1397){var _0x263c83=[];for(var _0x365ca3=0x0,_0x1fa455=0x1;_0x365ca3<_0x2b1397[_0xe4bb('0x12')];_0x365ca3++,_0x1fa455=0x1){_0x263c83=_0x263c83[_0xe4bb('0x13')](getUserApplications(_0x79ef0e,_0x2b1397[_0x365ca3],_0x2b1397[_0x365ca3][_0xe4bb('0x14')]));if(_0x2b1397[_0x365ca3][_0xe4bb('0x14')]!=_0x2b1397[_0x365ca3][_0xe4bb('0xe')]){_0x263c83=_0x263c83[_0xe4bb('0x13')](getUserApplications(_0x79ef0e,_0x2b1397[_0x365ca3],_0x2b1397[_0x365ca3][_0xe4bb('0xe')]));}}return _0x263c83;};var getChanSpyPromise=function(_0x11dd17,_0x1a2c5c){return new BPromise(function(_0x249992,_0x1729d1){return _0x11dd17[_0xe4bb('0x15')][_0xe4bb('0x16')]({'attributes':['id',_0xe4bb('0xe'),_0xe4bb('0x14')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x4fdbdd){if(_0x4fdbdd){return _0x249992(getChanSpyApplications(_0x1a2c5c,_0x4fdbdd));}return _0x249992([]);})[_0xe4bb('0x17')](function(_0x3e757a){_0x1729d1(_0x3e757a);});});};module[_0xe4bb('0x18')]=function(_0x14b513,_0x1759c5){var _0x42b19b=_0x14b513['models'];return _0x14b513[_0xe4bb('0x19')]('VoiceChanSpy',attributes,{'tableName':_0xe4bb('0x1a'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x288c44,_0x357b9a,_0x45518f){return getChanSpyPromise(_0x42b19b,_0x288c44)[_0xe4bb('0x1b')](function(_0x24f9f8){if(_0x24f9f8&&_0x24f9f8[_0xe4bb('0x12')]){return _0x42b19b[_0xe4bb('0x1c')][_0xe4bb('0x1d')](_0x24f9f8);}})[_0xe4bb('0x1b')](function(){_0x45518f();})[_0xe4bb('0x17')](function(_0x26551f){_0x45518f(_0x26551f);});},'afterUpdate':function(_0x4393b5,_0x57b255,_0x2b261a){return _0x42b19b[_0xe4bb('0x1c')][_0xe4bb('0x1e')]({'where':{'ChanSpyId':_0x4393b5['id']}})[_0xe4bb('0x1b')](function(){return getChanSpyPromise(_0x42b19b,_0x4393b5);})[_0xe4bb('0x1b')](function(_0x390019){if(_0x390019&&_0x390019['length']){return _0x42b19b['VoiceExtension']['bulkCreate'](_0x390019);}})[_0xe4bb('0x1b')](function(){_0x2b261a();})[_0xe4bb('0x17')](function(_0x9e1df5){_0x2b261a(_0x9e1df5);});},'afterDestroy':function(_0x4d8db2,_0x16fac8,_0x298c9a){return _0x42b19b[_0xe4bb('0x1c')][_0xe4bb('0x1e')]({'where':{'ChanSpyId':_0x4d8db2['id']}})[_0xe4bb('0x1b')](function(){_0x298c9a();})['catch'](function(_0x434187){_0x298c9a(_0x434187);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e1e8283..5862ee3 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xf4eb=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4da1d1,_0x7e80bf){var _0x42b10c=function(_0x18ada4){while(--_0x18ada4){_0x4da1d1['push'](_0x4da1d1['shift']());}};_0x42b10c(++_0x7e80bf);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5cdb78,_0x8a9a7c){_0x5cdb78=_0x5cdb78-0x0;var _0x32805d=_0xf4eb[_0x5cdb78];return _0x32805d;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f6e2d08..49528de 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 _0x4583=['../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xd61bf8,_0x46fd73){var _0x153323=function(_0x2b266d){while(--_0x2b266d){_0xd61bf8['push'](_0xd61bf8['shift']());}};_0x153323(++_0x46fd73);}(_0x4583,0x128));var _0x3458=function(_0x2f5d3f,_0x311995){_0x2f5d3f=_0x2f5d3f-0x0;var _0x30d00a=_0x4583[_0x2f5d3f];return _0x30d00a;};'use strict';var multer=require(_0x3458('0x0'));var util=require(_0x3458('0x1'));var path=require(_0x3458('0x2'));var timeout=require('connect-timeout');var express=require(_0x3458('0x3'));var router=express[_0x3458('0x4')]();var fs_extra=require(_0x3458('0x5'));var auth=require(_0x3458('0x6'));var interaction=require(_0x3458('0x7'));var config=require(_0x3458('0x8'));var controller=require('./voiceContext.controller');router[_0x3458('0x9')]('/',auth[_0x3458('0xa')](),controller[_0x3458('0xb')]);router['get'](_0x3458('0xc'),auth['isAuthenticated'](),controller[_0x3458('0xd')]);router[_0x3458('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3458('0xf')](_0x3458('0xc'),auth[_0x3458('0xa')](),controller[_0x3458('0x10')]);router['delete']('/:id',auth[_0x3458('0xa')](),controller[_0x3458('0x11')]);module[_0x3458('0x12')]=router; \ No newline at end of file +var _0x453c=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x453c,0xd4));var _0xc453=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x453c[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require(_0xc453('0x0'));var util=require('util');var path=require(_0xc453('0x1'));var timeout=require(_0xc453('0x2'));var express=require(_0xc453('0x3'));var router=express['Router']();var fs_extra=require(_0xc453('0x4'));var auth=require(_0xc453('0x5'));var interaction=require(_0xc453('0x6'));var config=require('../../config/environment');var controller=require(_0xc453('0x7'));router[_0xc453('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc453('0x8')](_0xc453('0x9'),auth['isAuthenticated'](),controller[_0xc453('0xa')]);router[_0xc453('0xb')]('/',auth[_0xc453('0xc')](),controller[_0xc453('0xd')]);router[_0xc453('0xe')](_0xc453('0x9'),auth[_0xc453('0xc')](),controller[_0xc453('0xf')]);router[_0xc453('0x10')](_0xc453('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xc453('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index dce9659..8e3d8c7 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 _0x778f=['name','BOOLEAN','sequelize','STRING'];(function(_0x85a58f,_0x47562c){var _0x3cdd23=function(_0x2aa654){while(--_0x2aa654){_0x85a58f['push'](_0x85a58f['shift']());}};_0x3cdd23(++_0x47562c);}(_0x778f,0x11a));var _0xf778=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x778f[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xf778('0x0'));module['exports']={'name':{'type':Sequelize[_0xf778('0x1')],'unique':_0xf778('0x2')},'description':{'type':Sequelize[_0xf778('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf778('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb70=['name','STRING','sequelize'];(function(_0x2e8d11,_0x181aa8){var _0x5b7526=function(_0x4401bc){while(--_0x4401bc){_0x2e8d11['push'](_0x2e8d11['shift']());}};_0x5b7526(++_0x181aa8);}(_0xfb70,0x1f4));var _0x0fb7=function(_0xfd3ff4,_0x1e84d9){_0xfd3ff4=_0xfd3ff4-0x0;var _0xca5773=_0xfb70[_0xfd3ff4];return _0xca5773;};'use strict';var Sequelize=require(_0x0fb7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0fb7('0x1')},'description':{'type':Sequelize[_0x0fb7('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 94440b6..dd5b0f2 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 _0xd341=['update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','include','rows','show','params','includeAll','options','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x4dc924,_0x3006bc){var _0x24f904=function(_0x312000){while(--_0x312000){_0x4dc924['push'](_0x4dc924['shift']());}};_0x24f904(++_0x3006bc);}(_0xd341,0xa4));var _0x1d34=function(_0x2fbecd,_0x2a3acb){_0x2fbecd=_0x2fbecd-0x0;var _0x7e8b16=_0xd341[_0x2fbecd];return _0x7e8b16;};'use strict';var emlformat=require(_0x1d34('0x0'));var rimraf=require(_0x1d34('0x1'));var zipdir=require(_0x1d34('0x2'));var jsonpatch=require(_0x1d34('0x3'));var rp=require(_0x1d34('0x4'));var moment=require(_0x1d34('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1d34('0x6'));var util=require('util');var path=require(_0x1d34('0x7'));var sox=require(_0x1d34('0x8'));var csv=require(_0x1d34('0x9'));var ejs=require(_0x1d34('0xa'));var fs=require('fs');var fs_extra=require(_0x1d34('0xb'));var _=require(_0x1d34('0xc'));var squel=require(_0x1d34('0xd'));var crypto=require(_0x1d34('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1d34('0xf'));var toCsv=require(_0x1d34('0x9'));var querystring=require(_0x1d34('0x10'));var Papa=require(_0x1d34('0x11'));var Redis=require(_0x1d34('0x12'));var authService=require(_0x1d34('0x13'));var qs=require(_0x1d34('0x14'));var as=require(_0x1d34('0x15'));var hardwareService=require(_0x1d34('0x16'));var logger=require('../../config/logger')(_0x1d34('0x17'));var utils=require('../../config/utils');var config=require(_0x1d34('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1d34('0x19'))['db'];var jayson=require(_0x1d34('0x1a'));var client=jayson[_0x1d34('0x1b')][_0x1d34('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4896c7,_0x4e38ec,_0x3bfd8c,_0x3984d6){return new BPromise(function(_0x4dfc41,_0x3f9c59){var _0x23d6d8=_0x3984d6||client;return _0x23d6d8[_0x1d34('0x1d')](_0x4896c7,_0x3bfd8c)[_0x1d34('0x1e')](function(_0x37a1ac){logger[_0x1d34('0x1f')](_0x1d34('0x20'),_0x4e38ec,'request\x20sent');logger[_0x1d34('0x21')](_0x1d34('0x22'),_0x4e38ec,'request\x20sent',JSON[_0x1d34('0x23')](_0x37a1ac));if(_0x37a1ac['error']){if(_0x37a1ac['error'][_0x1d34('0x24')]===0x1f4){logger[_0x1d34('0x25')](_0x1d34('0x20'),_0x4e38ec,_0x37a1ac['error'][_0x1d34('0x26')]);return _0x3f9c59(_0x37a1ac[_0x1d34('0x25')][_0x1d34('0x26')]);}logger[_0x1d34('0x25')](_0x1d34('0x20'),_0x4e38ec,_0x37a1ac[_0x1d34('0x25')][_0x1d34('0x26')]);return _0x4dfc41(_0x37a1ac[_0x1d34('0x25')][_0x1d34('0x26')]);}else{logger[_0x1d34('0x1f')](_0x1d34('0x20'),_0x4e38ec,_0x1d34('0x27'));_0x4dfc41(_0x37a1ac[_0x1d34('0x28')][_0x1d34('0x26')]);}})[_0x1d34('0x29')](function(_0x2d8dc4){logger[_0x1d34('0x25')](_0x1d34('0x20'),_0x4e38ec,_0x2d8dc4);_0x3f9c59(_0x2d8dc4);});});}function respondWithStatusCode(_0x4f90a0,_0x1719b9){_0x1719b9=_0x1719b9||0xcc;return function(_0x1dc934){if(_0x1dc934){return _0x4f90a0[_0x1d34('0x2a')](_0x1719b9);}return _0x4f90a0[_0x1d34('0x2b')](_0x1719b9)[_0x1d34('0x2c')]();};}function respondWithResult(_0x24a493,_0x4b7ed2){_0x4b7ed2=_0x4b7ed2||0xc8;return function(_0x5ad5c5){if(_0x5ad5c5){return _0x24a493[_0x1d34('0x2b')](_0x4b7ed2)[_0x1d34('0x2d')](_0x5ad5c5);}};}function respondWithFilteredResult(_0x6c3062,_0x4b1591){return function(_0x78f846){if(_0x78f846){var _0x536c46=typeof _0x4b1591[_0x1d34('0x2e')]===_0x1d34('0x2f')&&typeof _0x4b1591['limit']===_0x1d34('0x2f');var _0x308011=_0x78f846[_0x1d34('0x30')];var _0x301fc8=_0x536c46?0x0:_0x4b1591[_0x1d34('0x2e')];var _0x2bfb35=_0x536c46?_0x78f846['count']:_0x4b1591[_0x1d34('0x2e')]+_0x4b1591[_0x1d34('0x31')];var _0x797239;if(_0x2bfb35>=_0x308011){_0x2bfb35=_0x308011;_0x797239=0xc8;}else{_0x797239=0xce;}_0x6c3062['status'](_0x797239);return _0x6c3062['set'](_0x1d34('0x32'),_0x301fc8+'-'+_0x2bfb35+'/'+_0x308011)[_0x1d34('0x2d')](_0x78f846);}return null;};}function patchUpdates(_0x190a51){return function(_0x274cf0){try{jsonpatch[_0x1d34('0x33')](_0x274cf0,_0x190a51,!![]);}catch(_0x89476){return BPromise[_0x1d34('0x34')](_0x89476);}return _0x274cf0[_0x1d34('0x35')]();};}function saveUpdates(_0x9a6aa7,_0x4815be){return function(_0x121ba6){if(_0x121ba6){return _0x121ba6[_0x1d34('0x36')](_0x9a6aa7)[_0x1d34('0x1e')](function(_0x376072){return _0x376072;});}return null;};}function removeEntity(_0x30d83c,_0xefab00){return function(_0x5039bf){if(_0x5039bf){return _0x5039bf[_0x1d34('0x37')]()[_0x1d34('0x1e')](function(){var _0x20b791=_0x5039bf[_0x1d34('0x38')]({'plain':!![]});var _0xc1b855=_0x1d34('0x39');return db[_0x1d34('0x3a')]['destroy']({'where':{'type':_0xc1b855,'resourceId':_0x20b791['id']}})[_0x1d34('0x1e')](function(){return _0x5039bf;});})[_0x1d34('0x1e')](function(){_0x30d83c[_0x1d34('0x2b')](0xcc)[_0x1d34('0x2c')]();});}};}function handleEntityNotFound(_0x52856d,_0x21f395){return function(_0x8e445d){if(!_0x8e445d){_0x52856d[_0x1d34('0x2a')](0x194);}return _0x8e445d;};}function handleError(_0x4f5f2b,_0x2c31f4){_0x2c31f4=_0x2c31f4||0x1f4;return function(_0x4211c2){logger[_0x1d34('0x25')](_0x4211c2[_0x1d34('0x3b')]);if(_0x4211c2[_0x1d34('0x3c')]){delete _0x4211c2['name'];}_0x4f5f2b['status'](_0x2c31f4)[_0x1d34('0x3d')](_0x4211c2);};}exports[_0x1d34('0x3e')]=function(_0x1447ea,_0x52457d){var _0x286a4b={},_0x13a4b2={},_0x2c9149={'count':0x0,'rows':[]};var _0x1f4b4f=_[_0x1d34('0x3f')](db[_0x1d34('0x40')]['rawAttributes'],function(_0x5dcf8d){return{'name':_0x5dcf8d['fieldName'],'type':_0x5dcf8d['type'][_0x1d34('0x41')]};});_0x13a4b2['model']=_['map'](_0x1f4b4f,_0x1d34('0x3c'));_0x13a4b2['query']=_[_0x1d34('0x42')](_0x1447ea[_0x1d34('0x43')]);_0x13a4b2[_0x1d34('0x44')]=_[_0x1d34('0x45')](_0x13a4b2[_0x1d34('0x46')],_0x13a4b2[_0x1d34('0x43')]);_0x286a4b[_0x1d34('0x47')]=_['intersection'](_0x13a4b2[_0x1d34('0x46')],qs[_0x1d34('0x48')](_0x1447ea['query']['fields']));_0x286a4b[_0x1d34('0x47')]=_0x286a4b['attributes'][_0x1d34('0x49')]?_0x286a4b[_0x1d34('0x47')]:_0x13a4b2[_0x1d34('0x46')];if(!_0x1447ea[_0x1d34('0x43')][_0x1d34('0x4a')]('nolimit')){_0x286a4b[_0x1d34('0x31')]=qs[_0x1d34('0x31')](_0x1447ea[_0x1d34('0x43')]['limit']);_0x286a4b[_0x1d34('0x2e')]=qs['offset'](_0x1447ea[_0x1d34('0x43')][_0x1d34('0x2e')]);}_0x286a4b[_0x1d34('0x4b')]=qs[_0x1d34('0x4c')](_0x1447ea['query']['sort']);_0x286a4b['where']=qs[_0x1d34('0x44')](_[_0x1d34('0x4d')](_0x1447ea[_0x1d34('0x43')],_0x13a4b2[_0x1d34('0x44')]),_0x1f4b4f);if(_0x1447ea[_0x1d34('0x43')]['filter']){_0x286a4b[_0x1d34('0x4e')]=_[_0x1d34('0x4f')](_0x286a4b['where'],{'$or':_['map'](_0x1f4b4f,function(_0x31d592){if(_0x31d592['type']!==_0x1d34('0x50')){var _0x114ea9={};_0x114ea9[_0x31d592[_0x1d34('0x3c')]]={'$like':'%'+_0x1447ea[_0x1d34('0x43')][_0x1d34('0x51')]+'%'};return _0x114ea9;}})});}_0x286a4b=_[_0x1d34('0x4f')]({},_0x286a4b,_0x1447ea['options']);var _0x21dd2f={'where':_0x286a4b[_0x1d34('0x4e')]};return db[_0x1d34('0x40')][_0x1d34('0x30')](_0x21dd2f)[_0x1d34('0x1e')](function(_0x45feb1){_0x2c9149[_0x1d34('0x30')]=_0x45feb1;if(_0x1447ea[_0x1d34('0x43')]['includeAll']){_0x286a4b[_0x1d34('0x52')]=[{'all':!![]}];}return db[_0x1d34('0x40')]['findAll'](_0x286a4b);})[_0x1d34('0x1e')](function(_0xb8ff7e){_0x2c9149[_0x1d34('0x53')]=_0xb8ff7e;return _0x2c9149;})[_0x1d34('0x1e')](respondWithFilteredResult(_0x52457d,_0x286a4b))[_0x1d34('0x29')](handleError(_0x52457d,null));};exports[_0x1d34('0x54')]=function(_0x1e648e,_0x1efa32){var _0x1eb9e4={'raw':![],'where':{'id':_0x1e648e[_0x1d34('0x55')]['id']}},_0x2fd338={};_0x2fd338[_0x1d34('0x46')]=_[_0x1d34('0x42')](db[_0x1d34('0x40')]['rawAttributes']);_0x2fd338[_0x1d34('0x43')]=_[_0x1d34('0x42')](_0x1e648e['query']);_0x2fd338['filters']=_[_0x1d34('0x45')](_0x2fd338[_0x1d34('0x46')],_0x2fd338[_0x1d34('0x43')]);_0x1eb9e4['attributes']=_['intersection'](_0x2fd338['model'],qs[_0x1d34('0x48')](_0x1e648e[_0x1d34('0x43')][_0x1d34('0x48')]));_0x1eb9e4['attributes']=_0x1eb9e4[_0x1d34('0x47')]['length']?_0x1eb9e4[_0x1d34('0x47')]:_0x2fd338[_0x1d34('0x46')];if(_0x1e648e[_0x1d34('0x43')][_0x1d34('0x56')]){_0x1eb9e4['include']=[{'all':!![]}];}_0x1eb9e4=_[_0x1d34('0x4f')]({},_0x1eb9e4,_0x1e648e[_0x1d34('0x57')]);return db['VoiceContext']['find'](_0x1eb9e4)[_0x1d34('0x1e')](handleEntityNotFound(_0x1efa32,null))['then'](respondWithResult(_0x1efa32,null))[_0x1d34('0x29')](handleError(_0x1efa32,null));};exports[_0x1d34('0x58')]=function(_0x10db91,_0x4953d8,_0x1f5799){var _0x348c81;return db['VoiceContext']['create'](_0x10db91[_0x1d34('0x59')],{'raw':!![]})['then'](function(_0x3d9dc2){_0x348c81=_0x3d9dc2;return db['VoiceContext'][_0x1d34('0x5a')]({'raw':!![]});})[_0x1d34('0x1e')](function(_0x1097db){var _0x4d7ef3=fs[_0x1d34('0x5b')](path[_0x1d34('0x5c')](config[_0x1d34('0x5d')],_0x1d34('0x5e')),_0x1d34('0x5f'));var _0x96ee15=ejs[_0x1d34('0x60')](_0x4d7ef3,{'contexts':_0x1097db||[]});fs[_0x1d34('0x61')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x96ee15);})[_0x1d34('0x1e')](function(){return respondWithRpcPromise(_0x1d34('0x62'),_0x1d34('0x58'),{'module':_0x1d34('0x63')});})[_0x1d34('0x1e')](function(){var _0x2e5181=_0x10db91[_0x1d34('0x64')][_0x1d34('0x38')]({'plain':!![]});if(!_0x2e5181)throw new Error(_0x1d34('0x65'));if(_0x2e5181[_0x1d34('0x66')]===_0x1d34('0x64')){var _0x46811b=_0x348c81[_0x1d34('0x38')]({'plain':!![]});return db[_0x1d34('0x67')][_0x1d34('0x68')]({'where':{'name':'Contexts','userProfileId':_0x2e5181[_0x1d34('0x69')]},'raw':!![]})['then'](function(_0xa52c82){if(_0xa52c82&&_0xa52c82[_0x1d34('0x6a')]===0x0){return db[_0x1d34('0x3a')][_0x1d34('0x58')]({'name':_0x46811b[_0x1d34('0x3c')],'resourceId':_0x46811b['id'],'type':_0xa52c82[_0x1d34('0x3c')],'sectionId':_0xa52c82['id']},{})[_0x1d34('0x1e')](function(){return _0x348c81;});}else{return _0x348c81;}})[_0x1d34('0x29')](function(_0x4c996a){logger['error'](_0x1d34('0x6b'),_0x4c996a);throw _0x4c996a;});}return _0x348c81;})[_0x1d34('0x1e')](respondWithResult(_0x4953d8,0xc9))[_0x1d34('0x29')](handleError(_0x4953d8,null));};exports['update']=function(_0x74acd7,_0xee9822,_0x3c9ad8){var _0x180bd2;return db[_0x1d34('0x40')][_0x1d34('0x68')]({'where':{'id':_0x74acd7[_0x1d34('0x55')]['id']}})[_0x1d34('0x1e')](handleEntityNotFound(_0xee9822,null))[_0x1d34('0x1e')](saveUpdates(_0x74acd7['body'],null))['then'](function(_0xe9835c){if(_0xe9835c){_0x180bd2=_0xe9835c;return db[_0x1d34('0x40')][_0x1d34('0x5a')]({'raw':!![]});}})[_0x1d34('0x1e')](function(_0x26e467){var _0x5f5ac5=fs['readFileSync'](path[_0x1d34('0x5c')](config[_0x1d34('0x5d')],'server/files/templates/context.ejs'),_0x1d34('0x5f'));var _0xb889b5=ejs[_0x1d34('0x60')](_0x5f5ac5,{'contexts':_0x26e467||[]});fs['writeFileSync'](_0x1d34('0x6c'),_0xb889b5);})['then'](function(){return respondWithRpcPromise(_0x1d34('0x62'),_0x1d34('0x36'),{'module':_0x1d34('0x63')});})[_0x1d34('0x1e')](function(){return _0x180bd2;})[_0x1d34('0x1e')](respondWithResult(_0xee9822,null))['catch'](handleError(_0xee9822,null));};exports[_0x1d34('0x37')]=function(_0x1ad2e7,_0x4fcf31,_0x1b8926){var _0x2b4f57;return db['VoiceContext']['find']({'where':{'id':_0x1ad2e7[_0x1d34('0x55')]['id']}})[_0x1d34('0x1e')](handleEntityNotFound(_0x4fcf31,null))[_0x1d34('0x1e')](removeEntity(_0x4fcf31,null))['then'](function(){return db[_0x1d34('0x40')][_0x1d34('0x5a')]({'raw':!![]});})[_0x1d34('0x1e')](function(_0x4c4105){var _0x3eb16d=fs[_0x1d34('0x5b')](path[_0x1d34('0x5c')](config['root'],'server/files/templates/context.ejs'),_0x1d34('0x5f'));var _0x4dc672=ejs['render'](_0x3eb16d,{'contexts':_0x4c4105});fs[_0x1d34('0x61')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4dc672);return respondWithRpcPromise('Reload',_0x1d34('0x37'),{'module':_0x1d34('0x63')});})[_0x1d34('0x29')](handleError(_0x4fcf31,null));}; \ No newline at end of file +var _0xe9f5=['findAll','show','params','find','create','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','/etc/asterisk/extensions_xcally_contexts.conf','readFileSync','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','get','Contexts','destroy','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x4bee78,_0x599cc3){var _0x310196=function(_0x26d56f){while(--_0x26d56f){_0x4bee78['push'](_0x4bee78['shift']());}};_0x310196(++_0x599cc3);}(_0xe9f5,0x140));var _0x5e9f=function(_0x414bb8,_0x17316c){_0x414bb8=_0x414bb8-0x0;var _0x5398d8=_0xe9f5[_0x414bb8];return _0x5398d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5e9f('0x0'));var rp=require(_0x5e9f('0x1'));var moment=require(_0x5e9f('0x2'));var BPromise=require(_0x5e9f('0x3'));var Mustache=require(_0x5e9f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5e9f('0x5'));var csv=require('to-csv');var ejs=require(_0x5e9f('0x6'));var fs=require('fs');var fs_extra=require(_0x5e9f('0x7'));var _=require(_0x5e9f('0x8'));var squel=require(_0x5e9f('0x9'));var crypto=require(_0x5e9f('0xa'));var jsforce=require(_0x5e9f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5e9f('0xc'));var querystring=require(_0x5e9f('0xd'));var Papa=require(_0x5e9f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e9f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5e9f('0x10'));var utils=require(_0x5e9f('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5e9f('0x12'))['db'];var jayson=require(_0x5e9f('0x13'));var client=jayson[_0x5e9f('0x14')][_0x5e9f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x3ecbd4,_0x5c216d,_0x1eaaed,_0x11b951){return new BPromise(function(_0x4ea5c3,_0x5bc3b7){var _0x3c0c72=_0x11b951||client;return _0x3c0c72[_0x5e9f('0x16')](_0x3ecbd4,_0x1eaaed)[_0x5e9f('0x17')](function(_0x1da0d6){logger[_0x5e9f('0x18')]('VoiceContext,\x20%s,\x20%s',_0x5c216d,_0x5e9f('0x19'));logger['debug'](_0x5e9f('0x1a'),_0x5c216d,'request\x20sent',JSON['stringify'](_0x1da0d6));if(_0x1da0d6[_0x5e9f('0x1b')]){if(_0x1da0d6[_0x5e9f('0x1b')]['code']===0x1f4){logger[_0x5e9f('0x1b')](_0x5e9f('0x1c'),_0x5c216d,_0x1da0d6[_0x5e9f('0x1b')]['message']);return _0x5bc3b7(_0x1da0d6['error']['message']);}logger[_0x5e9f('0x1b')](_0x5e9f('0x1c'),_0x5c216d,_0x1da0d6[_0x5e9f('0x1b')]['message']);return _0x4ea5c3(_0x1da0d6[_0x5e9f('0x1b')][_0x5e9f('0x1d')]);}else{logger[_0x5e9f('0x18')]('VoiceContext,\x20%s,\x20%s',_0x5c216d,_0x5e9f('0x19'));_0x4ea5c3(_0x1da0d6['result']['message']);}})[_0x5e9f('0x1e')](function(_0x5a274a){logger[_0x5e9f('0x1b')](_0x5e9f('0x1c'),_0x5c216d,_0x5a274a);_0x5bc3b7(_0x5a274a);});});}function respondWithStatusCode(_0x4de091,_0x1f1041){_0x1f1041=_0x1f1041||0xcc;return function(_0x1203cd){if(_0x1203cd){return _0x4de091[_0x5e9f('0x1f')](_0x1f1041);}return _0x4de091['status'](_0x1f1041)[_0x5e9f('0x20')]();};}function respondWithResult(_0x304a21,_0x342fdf){_0x342fdf=_0x342fdf||0xc8;return function(_0x199a9f){if(_0x199a9f){return _0x304a21['status'](_0x342fdf)[_0x5e9f('0x21')](_0x199a9f);}};}function respondWithFilteredResult(_0x33868d,_0xeed404){return function(_0x2bc265){if(_0x2bc265){var _0x12fae5=typeof _0xeed404[_0x5e9f('0x22')]===_0x5e9f('0x23')&&typeof _0xeed404[_0x5e9f('0x24')]===_0x5e9f('0x23');var _0x758387=_0x2bc265[_0x5e9f('0x25')];var _0x17a920=_0x12fae5?0x0:_0xeed404[_0x5e9f('0x22')];var _0x31b7cf=_0x12fae5?_0x2bc265[_0x5e9f('0x25')]:_0xeed404['offset']+_0xeed404[_0x5e9f('0x24')];var _0x724580;if(_0x31b7cf>=_0x758387){_0x31b7cf=_0x758387;_0x724580=0xc8;}else{_0x724580=0xce;}_0x33868d[_0x5e9f('0x26')](_0x724580);return _0x33868d[_0x5e9f('0x27')](_0x5e9f('0x28'),_0x17a920+'-'+_0x31b7cf+'/'+_0x758387)['json'](_0x2bc265);}return null;};}function patchUpdates(_0x168df0){return function(_0x3e00a2){try{jsonpatch[_0x5e9f('0x29')](_0x3e00a2,_0x168df0,!![]);}catch(_0x127e3e){return BPromise[_0x5e9f('0x2a')](_0x127e3e);}return _0x3e00a2[_0x5e9f('0x2b')]();};}function saveUpdates(_0x487538,_0x45fa75){return function(_0x12778c){if(_0x12778c){return _0x12778c[_0x5e9f('0x2c')](_0x487538)[_0x5e9f('0x17')](function(_0x51cd7c){return _0x51cd7c;});}return null;};}function removeEntity(_0xe4e700,_0x5867a8){return function(_0x284cd2){if(_0x284cd2){return _0x284cd2['destroy']()[_0x5e9f('0x17')](function(){var _0x3fe7a9=_0x284cd2[_0x5e9f('0x2d')]({'plain':!![]});var _0x397b70=_0x5e9f('0x2e');return db['UserProfileResource'][_0x5e9f('0x2f')]({'where':{'type':_0x397b70,'resourceId':_0x3fe7a9['id']}})[_0x5e9f('0x17')](function(){return _0x284cd2;});})['then'](function(){_0xe4e700[_0x5e9f('0x26')](0xcc)[_0x5e9f('0x20')]();});}};}function handleEntityNotFound(_0x5d7fe9,_0x320a94){return function(_0x42955b){if(!_0x42955b){_0x5d7fe9[_0x5e9f('0x1f')](0x194);}return _0x42955b;};}function handleError(_0x2633ab,_0x44cf51){_0x44cf51=_0x44cf51||0x1f4;return function(_0x22b02c){logger['error'](_0x22b02c[_0x5e9f('0x30')]);if(_0x22b02c[_0x5e9f('0x31')]){delete _0x22b02c['name'];}_0x2633ab[_0x5e9f('0x26')](_0x44cf51)['send'](_0x22b02c);};}exports[_0x5e9f('0x32')]=function(_0x1eb985,_0x5b1d5f){var _0xe6162d={},_0x201b00={},_0x100095={'count':0x0,'rows':[]};var _0x128707=_[_0x5e9f('0x33')](db[_0x5e9f('0x34')][_0x5e9f('0x35')],function(_0x33de7e){return{'name':_0x33de7e[_0x5e9f('0x36')],'type':_0x33de7e[_0x5e9f('0x37')][_0x5e9f('0x38')]};});_0x201b00['model']=_[_0x5e9f('0x33')](_0x128707,_0x5e9f('0x31'));_0x201b00['query']=_[_0x5e9f('0x39')](_0x1eb985[_0x5e9f('0x3a')]);_0x201b00[_0x5e9f('0x3b')]=_[_0x5e9f('0x3c')](_0x201b00['model'],_0x201b00['query']);_0xe6162d['attributes']=_[_0x5e9f('0x3c')](_0x201b00[_0x5e9f('0x3d')],qs[_0x5e9f('0x3e')](_0x1eb985['query'][_0x5e9f('0x3e')]));_0xe6162d[_0x5e9f('0x3f')]=_0xe6162d[_0x5e9f('0x3f')][_0x5e9f('0x40')]?_0xe6162d[_0x5e9f('0x3f')]:_0x201b00[_0x5e9f('0x3d')];if(!_0x1eb985[_0x5e9f('0x3a')][_0x5e9f('0x41')]('nolimit')){_0xe6162d[_0x5e9f('0x24')]=qs[_0x5e9f('0x24')](_0x1eb985[_0x5e9f('0x3a')]['limit']);_0xe6162d[_0x5e9f('0x22')]=qs['offset'](_0x1eb985['query'][_0x5e9f('0x22')]);}_0xe6162d[_0x5e9f('0x42')]=qs[_0x5e9f('0x43')](_0x1eb985[_0x5e9f('0x3a')]['sort']);_0xe6162d[_0x5e9f('0x44')]=qs['filters'](_[_0x5e9f('0x45')](_0x1eb985[_0x5e9f('0x3a')],_0x201b00[_0x5e9f('0x3b')]),_0x128707);if(_0x1eb985[_0x5e9f('0x3a')][_0x5e9f('0x46')]){_0xe6162d[_0x5e9f('0x44')]=_[_0x5e9f('0x47')](_0xe6162d[_0x5e9f('0x44')],{'$or':_['map'](_0x128707,function(_0x23b1f5){if(_0x23b1f5[_0x5e9f('0x37')]!==_0x5e9f('0x48')){var _0x243a22={};_0x243a22[_0x23b1f5['name']]={'$like':'%'+_0x1eb985[_0x5e9f('0x3a')][_0x5e9f('0x46')]+'%'};return _0x243a22;}})});}_0xe6162d=_[_0x5e9f('0x47')]({},_0xe6162d,_0x1eb985[_0x5e9f('0x49')]);var _0xa9a8bc={'where':_0xe6162d[_0x5e9f('0x44')]};return db[_0x5e9f('0x34')]['count'](_0xa9a8bc)[_0x5e9f('0x17')](function(_0x4e62a5){_0x100095[_0x5e9f('0x25')]=_0x4e62a5;if(_0x1eb985[_0x5e9f('0x3a')][_0x5e9f('0x4a')]){_0xe6162d[_0x5e9f('0x4b')]=[{'all':!![]}];}return db['VoiceContext'][_0x5e9f('0x4c')](_0xe6162d);})[_0x5e9f('0x17')](function(_0x3a8d4c){_0x100095['rows']=_0x3a8d4c;return _0x100095;})[_0x5e9f('0x17')](respondWithFilteredResult(_0x5b1d5f,_0xe6162d))['catch'](handleError(_0x5b1d5f,null));};exports[_0x5e9f('0x4d')]=function(_0x3ca7f7,_0x250584){var _0x1525d6={'raw':![],'where':{'id':_0x3ca7f7[_0x5e9f('0x4e')]['id']}},_0x428d29={};_0x428d29[_0x5e9f('0x3d')]=_['keys'](db[_0x5e9f('0x34')][_0x5e9f('0x35')]);_0x428d29[_0x5e9f('0x3a')]=_[_0x5e9f('0x39')](_0x3ca7f7[_0x5e9f('0x3a')]);_0x428d29[_0x5e9f('0x3b')]=_[_0x5e9f('0x3c')](_0x428d29[_0x5e9f('0x3d')],_0x428d29[_0x5e9f('0x3a')]);_0x1525d6[_0x5e9f('0x3f')]=_[_0x5e9f('0x3c')](_0x428d29[_0x5e9f('0x3d')],qs[_0x5e9f('0x3e')](_0x3ca7f7['query'][_0x5e9f('0x3e')]));_0x1525d6[_0x5e9f('0x3f')]=_0x1525d6['attributes']['length']?_0x1525d6['attributes']:_0x428d29['model'];if(_0x3ca7f7[_0x5e9f('0x3a')]['includeAll']){_0x1525d6[_0x5e9f('0x4b')]=[{'all':!![]}];}_0x1525d6=_[_0x5e9f('0x47')]({},_0x1525d6,_0x3ca7f7[_0x5e9f('0x49')]);return db[_0x5e9f('0x34')][_0x5e9f('0x4f')](_0x1525d6)['then'](handleEntityNotFound(_0x250584,null))[_0x5e9f('0x17')](respondWithResult(_0x250584,null))[_0x5e9f('0x1e')](handleError(_0x250584,null));};exports[_0x5e9f('0x50')]=function(_0x334291,_0x49e559,_0x2310ea){var _0x1801cd;return db[_0x5e9f('0x34')][_0x5e9f('0x50')](_0x334291['body'],{'raw':!![]})[_0x5e9f('0x17')](function(_0x3ff131){_0x1801cd=_0x3ff131;return db[_0x5e9f('0x34')][_0x5e9f('0x4c')]({'raw':!![]});})[_0x5e9f('0x17')](function(_0x57984d){var _0x3fa94b=fs['readFileSync'](path[_0x5e9f('0x51')](config[_0x5e9f('0x52')],_0x5e9f('0x53')),_0x5e9f('0x54'));var _0xb20d0=ejs[_0x5e9f('0x55')](_0x3fa94b,{'contexts':_0x57984d||[]});fs[_0x5e9f('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xb20d0);})['then'](function(){return respondWithRpcPromise(_0x5e9f('0x57'),_0x5e9f('0x50'),{'module':_0x5e9f('0x58')});})['then'](function(){var _0x4e82e3=_0x334291[_0x5e9f('0x59')][_0x5e9f('0x2d')]({'plain':!![]});if(!_0x4e82e3)throw new Error(_0x5e9f('0x5a'));if(_0x4e82e3[_0x5e9f('0x5b')]===_0x5e9f('0x59')){var _0x4af743=_0x1801cd[_0x5e9f('0x2d')]({'plain':!![]});return db[_0x5e9f('0x5c')][_0x5e9f('0x4f')]({'where':{'name':_0x5e9f('0x2e'),'userProfileId':_0x4e82e3[_0x5e9f('0x5d')]},'raw':!![]})[_0x5e9f('0x17')](function(_0x518c8b){if(_0x518c8b&&_0x518c8b[_0x5e9f('0x5e')]===0x0){return db[_0x5e9f('0x5f')]['create']({'name':_0x4af743[_0x5e9f('0x31')],'resourceId':_0x4af743['id'],'type':_0x518c8b[_0x5e9f('0x31')],'sectionId':_0x518c8b['id']},{})[_0x5e9f('0x17')](function(){return _0x1801cd;});}else{return _0x1801cd;}})[_0x5e9f('0x1e')](function(_0x981a61){logger[_0x5e9f('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x981a61);throw _0x981a61;});}return _0x1801cd;})[_0x5e9f('0x17')](respondWithResult(_0x49e559,0xc9))[_0x5e9f('0x1e')](handleError(_0x49e559,null));};exports[_0x5e9f('0x2c')]=function(_0x383b7e,_0xba6447,_0x598e02){var _0x2cd1bd;return db[_0x5e9f('0x34')][_0x5e9f('0x4f')]({'where':{'id':_0x383b7e[_0x5e9f('0x4e')]['id']}})['then'](handleEntityNotFound(_0xba6447,null))[_0x5e9f('0x17')](saveUpdates(_0x383b7e[_0x5e9f('0x60')],null))[_0x5e9f('0x17')](function(_0x493e77){if(_0x493e77){_0x2cd1bd=_0x493e77;return db[_0x5e9f('0x34')]['findAll']({'raw':!![]});}})[_0x5e9f('0x17')](function(_0x23eb4a){var _0x4232de=fs['readFileSync'](path['join'](config['root'],_0x5e9f('0x53')),_0x5e9f('0x54'));var _0x221064=ejs[_0x5e9f('0x55')](_0x4232de,{'contexts':_0x23eb4a||[]});fs[_0x5e9f('0x56')](_0x5e9f('0x61'),_0x221064);})[_0x5e9f('0x17')](function(){return respondWithRpcPromise(_0x5e9f('0x57'),_0x5e9f('0x2c'),{'module':_0x5e9f('0x58')});})['then'](function(){return _0x2cd1bd;})[_0x5e9f('0x17')](respondWithResult(_0xba6447,null))[_0x5e9f('0x1e')](handleError(_0xba6447,null));};exports[_0x5e9f('0x2f')]=function(_0x2248d0,_0xa6d37f,_0x2b1e73){var _0x46231c;return db[_0x5e9f('0x34')][_0x5e9f('0x4f')]({'where':{'id':_0x2248d0[_0x5e9f('0x4e')]['id']}})['then'](handleEntityNotFound(_0xa6d37f,null))[_0x5e9f('0x17')](removeEntity(_0xa6d37f,null))[_0x5e9f('0x17')](function(){return db[_0x5e9f('0x34')][_0x5e9f('0x4c')]({'raw':!![]});})[_0x5e9f('0x17')](function(_0x2db928){var _0x4dedfb=fs[_0x5e9f('0x62')](path[_0x5e9f('0x51')](config[_0x5e9f('0x52')],_0x5e9f('0x53')),'utf8');var _0x3fcd36=ejs[_0x5e9f('0x55')](_0x4dedfb,{'contexts':_0x2db928});fs[_0x5e9f('0x56')](_0x5e9f('0x61'),_0x3fcd36);return respondWithRpcPromise('Reload',_0x5e9f('0x2f'),{'module':_0x5e9f('0x58')});})['catch'](handleError(_0xa6d37f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 9898fc5..1c34b22 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 _0xa600=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceContext','lodash','util'];(function(_0x3256cc,_0x24f028){var _0x5e94c3=function(_0x167754){while(--_0x167754){_0x3256cc['push'](_0x3256cc['shift']());}};_0x5e94c3(++_0x24f028);}(_0xa600,0xa6));var _0x0a60=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0xa600[_0x368e09];return _0x14b7df;};'use strict';var _=require(_0x0a60('0x0'));var util=require(_0x0a60('0x1'));var logger=require(_0x0a60('0x2'))(_0x0a60('0x3'));var moment=require(_0x0a60('0x4'));var BPromise=require(_0x0a60('0x5'));var rp=require(_0x0a60('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a60('0x7'));var config=require(_0x0a60('0x8'));var attributes=require('./voiceContext.attributes');module[_0x0a60('0x9')]=function(_0x567613,_0x4109c5){return _0x567613[_0x0a60('0xa')](_0x0a60('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2884=['../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x68a0b0,_0x2bba91){var _0x4b4ee6=function(_0x36f6da){while(--_0x36f6da){_0x68a0b0['push'](_0x68a0b0['shift']());}};_0x4b4ee6(++_0x2bba91);}(_0x2884,0xb9));var _0x4288=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x2884[_0x3fb9dd];return _0x20136a;};'use strict';var _=require('lodash');var util=require(_0x4288('0x0'));var logger=require(_0x4288('0x1'))(_0x4288('0x2'));var moment=require('moment');var BPromise=require(_0x4288('0x3'));var rp=require(_0x4288('0x4'));var fs=require('fs');var path=require(_0x4288('0x5'));var rimraf=require(_0x4288('0x6'));var config=require(_0x4288('0x7'));var attributes=require(_0x4288('0x8'));module['exports']=function(_0x231984,_0x2d98e4){return _0x231984[_0x4288('0x9')](_0x4288('0xa'),attributes,{'tableName':_0x4288('0xb'),'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 df280a3..48dc26f 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 _0x51a1=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash'];(function(_0x58201f,_0x465608){var _0x1d1024=function(_0x170ee3){while(--_0x170ee3){_0x58201f['push'](_0x58201f['shift']());}};_0x1d1024(++_0x465608);}(_0x51a1,0x1b7));var _0x151a=function(_0x5f2c12,_0x5c5076){_0x5f2c12=_0x5f2c12-0x0;var _0x39199=_0x51a1[_0x5f2c12];return _0x39199;};'use strict';var _=require(_0x151a('0x0'));var util=require(_0x151a('0x1'));var moment=require('moment');var BPromise=require(_0x151a('0x2'));var rs=require(_0x151a('0x3'));var fs=require('fs');var Redis=require(_0x151a('0x4'));var db=require(_0x151a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x151a('0x6'))(_0x151a('0x7'));var config=require(_0x151a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x151a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a4c1d,_0x1fec5a,_0x19eda0){return new BPromise(function(_0x1ee8a9,_0x32c652){return client[_0x151a('0xa')](_0x4a4c1d,_0x19eda0)[_0x151a('0xb')](function(_0x1ae016){logger[_0x151a('0xc')](_0x151a('0xd'),_0x1fec5a,_0x151a('0xe'));logger['debug'](_0x151a('0xf'),_0x1fec5a,_0x151a('0xe'),JSON['stringify'](_0x1ae016));if(_0x1ae016['error']){if(_0x1ae016['error'][_0x151a('0x10')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1fec5a,_0x1ae016[_0x151a('0x11')][_0x151a('0x12')]);return _0x32c652(_0x1ae016[_0x151a('0x11')][_0x151a('0x12')]);}logger[_0x151a('0x11')]('VoiceContext,\x20%s,\x20%s',_0x1fec5a,_0x1ae016[_0x151a('0x11')]['message']);return _0x1ee8a9(_0x1ae016[_0x151a('0x11')]['message']);}else{logger[_0x151a('0xc')](_0x151a('0xd'),_0x1fec5a,'request\x20sent');_0x1ee8a9(_0x1ae016[_0x151a('0x13')][_0x151a('0x12')]);}})['catch'](function(_0x537078){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1fec5a,_0x537078);_0x32c652(_0x537078);});});} \ No newline at end of file +var _0x6257=['info','request\x20sent','debug','code','message','error','VoiceContext,\x20%s,\x20%s','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2670ac,_0x416f90){var _0x75b69e=function(_0x307fd2){while(--_0x307fd2){_0x2670ac['push'](_0x2670ac['shift']());}};_0x75b69e(++_0x416f90);}(_0x6257,0x1d4));var _0x7625=function(_0x1ca925,_0x11e098){_0x1ca925=_0x1ca925-0x0;var _0x19f311=_0x6257[_0x1ca925];return _0x19f311;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var moment=require(_0x7625('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7625('0x2'));var db=require(_0x7625('0x3'))['db'];var utils=require(_0x7625('0x4'));var logger=require(_0x7625('0x5'))(_0x7625('0x6'));var config=require(_0x7625('0x7'));var jayson=require(_0x7625('0x8'));var client=jayson[_0x7625('0x9')][_0x7625('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427050,_0x5cf7a8,_0x4b790d){return new BPromise(function(_0x287434,_0x1a02de){return client['request'](_0x427050,_0x4b790d)[_0x7625('0xb')](function(_0x2a2625){logger[_0x7625('0xc')]('VoiceContext,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'));logger[_0x7625('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'),JSON['stringify'](_0x2a2625));if(_0x2a2625['error']){if(_0x2a2625['error'][_0x7625('0xf')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x5cf7a8,_0x2a2625['error'][_0x7625('0x10')]);return _0x1a02de(_0x2a2625[_0x7625('0x11')][_0x7625('0x10')]);}logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x2a2625[_0x7625('0x11')]['message']);return _0x287434(_0x2a2625['error'][_0x7625('0x10')]);}else{logger['info'](_0x7625('0x12'),_0x5cf7a8,_0x7625('0xd'));_0x287434(_0x2a2625[_0x7625('0x13')]['message']);}})['catch'](function(_0x43206e){logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x43206e);_0x1a02de(_0x43206e);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 561a844..f8c65ef 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 _0x5b7c=['./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0x5b7c,0x107));var _0xc5b7=function(_0x46096d,_0x588765){_0x46096d=_0x46096d-0x0;var _0x3d90d4=_0x5b7c[_0x46096d];return _0x3d90d4;};'use strict';var multer=require('multer');var util=require(_0xc5b7('0x0'));var path=require(_0xc5b7('0x1'));var timeout=require(_0xc5b7('0x2'));var express=require(_0xc5b7('0x3'));var router=express[_0xc5b7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc5b7('0x5'));var config=require(_0xc5b7('0x6'));var controller=require(_0xc5b7('0x7'));router[_0xc5b7('0x8')]('/',auth[_0xc5b7('0x9')](),controller[_0xc5b7('0xa')]);router[_0xc5b7('0x8')](_0xc5b7('0xb'),auth[_0xc5b7('0x9')](),controller[_0xc5b7('0xc')]);router[_0xc5b7('0x8')](_0xc5b7('0xd'),auth[_0xc5b7('0x9')](),controller[_0xc5b7('0xe')]);router[_0xc5b7('0xf')]('/',auth[_0xc5b7('0x9')](),controller['create']);router['put'](_0xc5b7('0xd'),auth['isAuthenticated'](),controller[_0xc5b7('0x10')]);router[_0xc5b7('0x11')](_0xc5b7('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x47c0=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x588791,_0x35a42e){var _0x28937a=function(_0x8ca701){while(--_0x8ca701){_0x588791['push'](_0x588791['shift']());}};_0x28937a(++_0x35a42e);}(_0x47c0,0x1dc));var _0x047c=function(_0x3fc878,_0x19aec0){_0x3fc878=_0x3fc878-0x0;var _0x5b8b1c=_0x47c0[_0x3fc878];return _0x5b8b1c;};'use strict';var multer=require(_0x047c('0x0'));var util=require(_0x047c('0x1'));var path=require(_0x047c('0x2'));var timeout=require('connect-timeout');var express=require(_0x047c('0x3'));var router=express[_0x047c('0x4')]();var fs_extra=require(_0x047c('0x5'));var auth=require(_0x047c('0x6'));var interaction=require(_0x047c('0x7'));var config=require(_0x047c('0x8'));var controller=require('./voiceDialReport.controller');router[_0x047c('0x9')]('/',auth['isAuthenticated'](),controller[_0x047c('0xa')]);router[_0x047c('0x9')]('/describe',auth[_0x047c('0xb')](),controller[_0x047c('0xc')]);router[_0x047c('0x9')](_0x047c('0xd'),auth[_0x047c('0xb')](),controller['show']);router[_0x047c('0xe')]('/',auth['isAuthenticated'](),controller[_0x047c('0xf')]);router[_0x047c('0x10')](_0x047c('0xd'),auth['isAuthenticated'](),controller[_0x047c('0x11')]);router[_0x047c('0x12')](_0x047c('0xd'),auth[_0x047c('0xb')](),controller[_0x047c('0x13')]);module[_0x047c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3ad73de..b9f255d 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 _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x3dca5f,_0x3bf609){var _0x2ad290=function(_0x35ca60){while(--_0x35ca60){_0x3dca5f['push'](_0x3dca5f['shift']());}};_0x2ad290(++_0x3bf609);}(_0x84ab,0x12f));var _0xb84a=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x84ab[_0x1265ed];return _0x5ac459;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file +var _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x386797,_0x481726){var _0x5cc78f=function(_0x4668c8){while(--_0x4668c8){_0x386797['push'](_0x386797['shift']());}};_0x5cc78f(++_0x481726);}(_0xedd9,0xfc));var _0x9edd=function(_0xdb6f79,_0x566312){_0xdb6f79=_0xdb6f79-0x0;var _0x2d546d=_0xedd9[_0xdb6f79];return _0x2d546d;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 61d7618..f7c32fa 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 _0x2e1d=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x37c141,_0x511e5f){var _0x5ce2a2=function(_0x32ae6d){while(--_0x32ae6d){_0x37c141['push'](_0x37c141['shift']());}};_0x5ce2a2(++_0x511e5f);}(_0x2e1d,0x9d));var _0xd2e1=function(_0x5ef161,_0x27d16c){_0x5ef161=_0x5ef161-0x0;var _0x1c6e9e=_0x2e1d[_0x5ef161];return _0x1c6e9e;};'use strict';var emlformat=require(_0xd2e1('0x0'));var rimraf=require(_0xd2e1('0x1'));var zipdir=require(_0xd2e1('0x2'));var jsonpatch=require(_0xd2e1('0x3'));var rp=require(_0xd2e1('0x4'));var moment=require('moment');var BPromise=require(_0xd2e1('0x5'));var Mustache=require(_0xd2e1('0x6'));var util=require(_0xd2e1('0x7'));var path=require(_0xd2e1('0x8'));var sox=require(_0xd2e1('0x9'));var csv=require(_0xd2e1('0xa'));var ejs=require(_0xd2e1('0xb'));var fs=require('fs');var fs_extra=require(_0xd2e1('0xc'));var _=require(_0xd2e1('0xd'));var squel=require(_0xd2e1('0xe'));var crypto=require(_0xd2e1('0xf'));var jsforce=require(_0xd2e1('0x10'));var deskjs=require(_0xd2e1('0x11'));var toCsv=require(_0xd2e1('0xa'));var querystring=require(_0xd2e1('0x12'));var Papa=require(_0xd2e1('0x13'));var Redis=require(_0xd2e1('0x14'));var authService=require(_0xd2e1('0x15'));var qs=require(_0xd2e1('0x16'));var as=require(_0xd2e1('0x17'));var hardwareService=require(_0xd2e1('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0xd2e1('0x19'));var config=require(_0xd2e1('0x1a'));var licenseUtil=require(_0xd2e1('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9f5422,_0x3b2077){_0x3b2077=_0x3b2077||0xcc;return function(_0x539160){if(_0x539160){return _0x9f5422[_0xd2e1('0x1c')](_0x3b2077);}return _0x9f5422[_0xd2e1('0x1d')](_0x3b2077)[_0xd2e1('0x1e')]();};}function respondWithResult(_0x4d431e,_0x1f01a9){_0x1f01a9=_0x1f01a9||0xc8;return function(_0x5d289a){if(_0x5d289a){return _0x4d431e[_0xd2e1('0x1d')](_0x1f01a9)[_0xd2e1('0x1f')](_0x5d289a);}};}function respondWithFilteredResult(_0x571855,_0x316d02){return function(_0x32ff27){if(_0x32ff27){var _0x28456a=typeof _0x316d02['offset']==='undefined'&&typeof _0x316d02[_0xd2e1('0x20')]===_0xd2e1('0x21');var _0x4dae24=_0x32ff27[_0xd2e1('0x22')];var _0x24fc92=_0x28456a?0x0:_0x316d02[_0xd2e1('0x23')];var _0x3e509b=_0x28456a?_0x32ff27[_0xd2e1('0x22')]:_0x316d02[_0xd2e1('0x23')]+_0x316d02[_0xd2e1('0x20')];var _0x96a89a;if(_0x3e509b>=_0x4dae24){_0x3e509b=_0x4dae24;_0x96a89a=0xc8;}else{_0x96a89a=0xce;}_0x571855[_0xd2e1('0x1d')](_0x96a89a);return _0x571855[_0xd2e1('0x24')](_0xd2e1('0x25'),_0x24fc92+'-'+_0x3e509b+'/'+_0x4dae24)[_0xd2e1('0x1f')](_0x32ff27);}return null;};}function patchUpdates(_0x5613c5){return function(_0x4fec26){try{jsonpatch[_0xd2e1('0x26')](_0x4fec26,_0x5613c5,!![]);}catch(_0x484e56){return BPromise['reject'](_0x484e56);}return _0x4fec26[_0xd2e1('0x27')]();};}function saveUpdates(_0xdcc61a,_0x4ca508){return function(_0x21ca5c){if(_0x21ca5c){return _0x21ca5c[_0xd2e1('0x28')](_0xdcc61a)['then'](function(_0x506482){return _0x506482;});}return null;};}function removeEntity(_0x55da16,_0x3f1fbf){return function(_0x432b1d){if(_0x432b1d){return _0x432b1d[_0xd2e1('0x29')]()[_0xd2e1('0x2a')](function(){_0x55da16[_0xd2e1('0x1d')](0xcc)[_0xd2e1('0x1e')]();});}};}function handleEntityNotFound(_0x1ccaae,_0x7f7536){return function(_0x256732){if(!_0x256732){_0x1ccaae[_0xd2e1('0x1c')](0x194);}return _0x256732;};}function handleError(_0x319ede,_0x1ef2b1){_0x1ef2b1=_0x1ef2b1||0x1f4;return function(_0x24ad84){logger[_0xd2e1('0x2b')](_0x24ad84[_0xd2e1('0x2c')]);if(_0x24ad84[_0xd2e1('0x2d')]){delete _0x24ad84[_0xd2e1('0x2d')];}_0x319ede[_0xd2e1('0x1d')](_0x1ef2b1)[_0xd2e1('0x2e')](_0x24ad84);};}exports[_0xd2e1('0x2f')]=function(_0x413763,_0xe41a81){var _0x3f0402={},_0x3664f3={},_0x411aba={'count':0x0,'rows':[]};var _0x3d18b9=_[_0xd2e1('0x30')](db[_0xd2e1('0x31')][_0xd2e1('0x32')],function(_0x16be42){return{'name':_0x16be42['fieldName'],'type':_0x16be42[_0xd2e1('0x33')][_0xd2e1('0x34')]};});_0x3664f3[_0xd2e1('0x35')]=_[_0xd2e1('0x30')](_0x3d18b9,_0xd2e1('0x2d'));_0x3664f3[_0xd2e1('0x36')]=_[_0xd2e1('0x37')](_0x413763[_0xd2e1('0x36')]);_0x3664f3['filters']=_[_0xd2e1('0x38')](_0x3664f3['model'],_0x3664f3[_0xd2e1('0x36')]);_0x3f0402[_0xd2e1('0x39')]=_[_0xd2e1('0x38')](_0x3664f3[_0xd2e1('0x35')],qs['fields'](_0x413763[_0xd2e1('0x36')]['fields']));_0x3f0402['attributes']=_0x3f0402[_0xd2e1('0x39')][_0xd2e1('0x3a')]?_0x3f0402['attributes']:_0x3664f3['model'];if(!_0x413763[_0xd2e1('0x36')][_0xd2e1('0x3b')](_0xd2e1('0x3c'))){_0x3f0402[_0xd2e1('0x20')]=qs['limit'](_0x413763[_0xd2e1('0x36')][_0xd2e1('0x20')]);_0x3f0402['offset']=qs[_0xd2e1('0x23')](_0x413763[_0xd2e1('0x36')][_0xd2e1('0x23')]);}_0x3f0402[_0xd2e1('0x3d')]=qs[_0xd2e1('0x3e')](_0x413763['query'][_0xd2e1('0x3e')]);_0x3f0402[_0xd2e1('0x3f')]=qs[_0xd2e1('0x40')](_[_0xd2e1('0x41')](_0x413763[_0xd2e1('0x36')],_0x3664f3[_0xd2e1('0x40')]),_0x3d18b9);if(_0x413763[_0xd2e1('0x36')][_0xd2e1('0x42')]){_0x3f0402[_0xd2e1('0x3f')]=_[_0xd2e1('0x43')](_0x3f0402['where'],{'$or':_[_0xd2e1('0x30')](_0x3d18b9,function(_0x428cd){if(_0x428cd[_0xd2e1('0x33')]!==_0xd2e1('0x44')){var _0x2d2e84={};_0x2d2e84[_0x428cd[_0xd2e1('0x2d')]]={'$like':'%'+_0x413763[_0xd2e1('0x36')][_0xd2e1('0x42')]+'%'};return _0x2d2e84;}})});}_0x3f0402=_[_0xd2e1('0x43')]({},_0x3f0402,_0x413763[_0xd2e1('0x45')]);var _0x20676a={'where':_0x3f0402[_0xd2e1('0x3f')]};return db[_0xd2e1('0x31')][_0xd2e1('0x22')](_0x20676a)[_0xd2e1('0x2a')](function(_0x101b4c){_0x411aba[_0xd2e1('0x22')]=_0x101b4c;if(_0x413763[_0xd2e1('0x36')][_0xd2e1('0x46')]){_0x3f0402[_0xd2e1('0x47')]=[{'all':!![]}];}return db[_0xd2e1('0x31')]['findAll'](_0x3f0402);})[_0xd2e1('0x2a')](function(_0xf80b40){_0x411aba[_0xd2e1('0x48')]=_0xf80b40;return _0x411aba;})['then'](respondWithFilteredResult(_0xe41a81,_0x3f0402))[_0xd2e1('0x49')](handleError(_0xe41a81,null));};exports[_0xd2e1('0x4a')]=function(_0x3feee4,_0x23a07c){var _0x3b9e24={'raw':!![],'where':{'id':_0x3feee4[_0xd2e1('0x4b')]['id']}},_0x3c0058={};_0x3c0058[_0xd2e1('0x35')]=_[_0xd2e1('0x37')](db[_0xd2e1('0x31')][_0xd2e1('0x32')]);_0x3c0058[_0xd2e1('0x36')]=_['keys'](_0x3feee4[_0xd2e1('0x36')]);_0x3c0058[_0xd2e1('0x40')]=_[_0xd2e1('0x38')](_0x3c0058[_0xd2e1('0x35')],_0x3c0058[_0xd2e1('0x36')]);_0x3b9e24[_0xd2e1('0x39')]=_[_0xd2e1('0x38')](_0x3c0058[_0xd2e1('0x35')],qs[_0xd2e1('0x4c')](_0x3feee4[_0xd2e1('0x36')][_0xd2e1('0x4c')]));_0x3b9e24[_0xd2e1('0x39')]=_0x3b9e24[_0xd2e1('0x39')]['length']?_0x3b9e24[_0xd2e1('0x39')]:_0x3c0058[_0xd2e1('0x35')];if(_0x3feee4[_0xd2e1('0x36')][_0xd2e1('0x46')]){_0x3b9e24[_0xd2e1('0x47')]=[{'all':!![]}];}_0x3b9e24=_[_0xd2e1('0x43')]({},_0x3b9e24,_0x3feee4[_0xd2e1('0x45')]);return db[_0xd2e1('0x31')][_0xd2e1('0x4d')](_0x3b9e24)[_0xd2e1('0x2a')](handleEntityNotFound(_0x23a07c,null))['then'](respondWithResult(_0x23a07c,null))[_0xd2e1('0x49')](handleError(_0x23a07c,null));};exports[_0xd2e1('0x4e')]=function(_0x4c4ccd,_0xa4cbbe){return db[_0xd2e1('0x31')]['create'](_0x4c4ccd[_0xd2e1('0x4f')],{})[_0xd2e1('0x2a')](respondWithResult(_0xa4cbbe,0xc9))[_0xd2e1('0x49')](handleError(_0xa4cbbe,null));};exports[_0xd2e1('0x28')]=function(_0x35586c,_0x41af18){if(_0x35586c[_0xd2e1('0x4f')]['id']){delete _0x35586c[_0xd2e1('0x4f')]['id'];}return db[_0xd2e1('0x31')][_0xd2e1('0x4d')]({'where':{'id':_0x35586c[_0xd2e1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41af18,null))[_0xd2e1('0x2a')](saveUpdates(_0x35586c[_0xd2e1('0x4f')],null))[_0xd2e1('0x2a')](respondWithResult(_0x41af18,null))[_0xd2e1('0x49')](handleError(_0x41af18,null));};exports[_0xd2e1('0x29')]=function(_0x528cf3,_0x3ccbd8){return db[_0xd2e1('0x31')][_0xd2e1('0x4d')]({'where':{'id':_0x528cf3[_0xd2e1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ccbd8,null))['then'](removeEntity(_0x3ccbd8,null))[_0xd2e1('0x49')](handleError(_0x3ccbd8,null));};exports[_0xd2e1('0x50')]=function(_0x19e9bd,_0x412623){return db['VoiceDialReport'][_0xd2e1('0x50')]()[_0xd2e1('0x2a')](respondWithResult(_0x412623,null))[_0xd2e1('0x49')](handleError(_0x412623,null));}; \ No newline at end of file +var _0x6305=['map','VoiceDialReport','rawAttributes','fieldName','key','query','keys','filters','attributes','model','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','intersection','include','catch','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x544544,_0x3d1b7d){var _0x46b8d0=function(_0x4bcf80){while(--_0x4bcf80){_0x544544['push'](_0x544544['shift']());}};_0x46b8d0(++_0x3d1b7d);}(_0x6305,0x69));var _0x5630=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6305[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require(_0x5630('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5630('0x1'));var rp=require(_0x5630('0x2'));var moment=require(_0x5630('0x3'));var BPromise=require(_0x5630('0x4'));var Mustache=require(_0x5630('0x5'));var util=require(_0x5630('0x6'));var path=require(_0x5630('0x7'));var sox=require(_0x5630('0x8'));var csv=require(_0x5630('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5630('0xa'));var _=require('lodash');var squel=require(_0x5630('0xb'));var crypto=require(_0x5630('0xc'));var jsforce=require(_0x5630('0xd'));var deskjs=require(_0x5630('0xe'));var toCsv=require(_0x5630('0x9'));var querystring=require(_0x5630('0xf'));var Papa=require(_0x5630('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5630('0x11'));var as=require(_0x5630('0x12'));var hardwareService=require(_0x5630('0x13'));var logger=require('../../config/logger')(_0x5630('0x14'));var utils=require(_0x5630('0x15'));var config=require(_0x5630('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5630('0x17'))['db'];function respondWithStatusCode(_0x4bc170,_0xdbbbdb){_0xdbbbdb=_0xdbbbdb||0xcc;return function(_0x18180e){if(_0x18180e){return _0x4bc170[_0x5630('0x18')](_0xdbbbdb);}return _0x4bc170[_0x5630('0x19')](_0xdbbbdb)[_0x5630('0x1a')]();};}function respondWithResult(_0x54a1a1,_0x4ac4ba){_0x4ac4ba=_0x4ac4ba||0xc8;return function(_0x381d2e){if(_0x381d2e){return _0x54a1a1[_0x5630('0x19')](_0x4ac4ba)[_0x5630('0x1b')](_0x381d2e);}};}function respondWithFilteredResult(_0x61198c,_0x1ef12c){return function(_0x159a15){if(_0x159a15){var _0x37ef9c=typeof _0x1ef12c[_0x5630('0x1c')]===_0x5630('0x1d')&&typeof _0x1ef12c[_0x5630('0x1e')]===_0x5630('0x1d');var _0x5e574a=_0x159a15[_0x5630('0x1f')];var _0xd43ee=_0x37ef9c?0x0:_0x1ef12c['offset'];var _0x3bcb41=_0x37ef9c?_0x159a15[_0x5630('0x1f')]:_0x1ef12c['offset']+_0x1ef12c[_0x5630('0x1e')];var _0x44fede;if(_0x3bcb41>=_0x5e574a){_0x3bcb41=_0x5e574a;_0x44fede=0xc8;}else{_0x44fede=0xce;}_0x61198c[_0x5630('0x19')](_0x44fede);return _0x61198c['set']('Content-Range',_0xd43ee+'-'+_0x3bcb41+'/'+_0x5e574a)[_0x5630('0x1b')](_0x159a15);}return null;};}function patchUpdates(_0x2326dc){return function(_0x27146d){try{jsonpatch[_0x5630('0x20')](_0x27146d,_0x2326dc,!![]);}catch(_0x4a9d33){return BPromise[_0x5630('0x21')](_0x4a9d33);}return _0x27146d[_0x5630('0x22')]();};}function saveUpdates(_0x2b839a,_0x2389ee){return function(_0x370c8e){if(_0x370c8e){return _0x370c8e[_0x5630('0x23')](_0x2b839a)[_0x5630('0x24')](function(_0xd67ccc){return _0xd67ccc;});}return null;};}function removeEntity(_0x28f3e8,_0x1efa99){return function(_0x138e0e){if(_0x138e0e){return _0x138e0e[_0x5630('0x25')]()['then'](function(){_0x28f3e8[_0x5630('0x19')](0xcc)[_0x5630('0x1a')]();});}};}function handleEntityNotFound(_0x57c2ff,_0x9e8571){return function(_0x511607){if(!_0x511607){_0x57c2ff[_0x5630('0x18')](0x194);}return _0x511607;};}function handleError(_0x4b186b,_0x586907){_0x586907=_0x586907||0x1f4;return function(_0x3ad25e){logger[_0x5630('0x26')](_0x3ad25e[_0x5630('0x27')]);if(_0x3ad25e[_0x5630('0x28')]){delete _0x3ad25e[_0x5630('0x28')];}_0x4b186b[_0x5630('0x19')](_0x586907)[_0x5630('0x29')](_0x3ad25e);};}exports[_0x5630('0x2a')]=function(_0xe9c4c5,_0x1cc433){var _0x9d8543={},_0x8fb703={},_0x5d6635={'count':0x0,'rows':[]};var _0x1d05b9=_[_0x5630('0x2b')](db[_0x5630('0x2c')][_0x5630('0x2d')],function(_0x5d12e4){return{'name':_0x5d12e4[_0x5630('0x2e')],'type':_0x5d12e4['type'][_0x5630('0x2f')]};});_0x8fb703['model']=_[_0x5630('0x2b')](_0x1d05b9,_0x5630('0x28'));_0x8fb703[_0x5630('0x30')]=_[_0x5630('0x31')](_0xe9c4c5[_0x5630('0x30')]);_0x8fb703[_0x5630('0x32')]=_['intersection'](_0x8fb703['model'],_0x8fb703[_0x5630('0x30')]);_0x9d8543[_0x5630('0x33')]=_['intersection'](_0x8fb703[_0x5630('0x34')],qs[_0x5630('0x35')](_0xe9c4c5[_0x5630('0x30')][_0x5630('0x35')]));_0x9d8543[_0x5630('0x33')]=_0x9d8543['attributes'][_0x5630('0x36')]?_0x9d8543[_0x5630('0x33')]:_0x8fb703['model'];if(!_0xe9c4c5[_0x5630('0x30')]['hasOwnProperty']('nolimit')){_0x9d8543['limit']=qs[_0x5630('0x1e')](_0xe9c4c5[_0x5630('0x30')][_0x5630('0x1e')]);_0x9d8543[_0x5630('0x1c')]=qs[_0x5630('0x1c')](_0xe9c4c5['query'][_0x5630('0x1c')]);}_0x9d8543['order']=qs['sort'](_0xe9c4c5[_0x5630('0x30')][_0x5630('0x37')]);_0x9d8543[_0x5630('0x38')]=qs[_0x5630('0x32')](_[_0x5630('0x39')](_0xe9c4c5[_0x5630('0x30')],_0x8fb703['filters']),_0x1d05b9);if(_0xe9c4c5[_0x5630('0x30')][_0x5630('0x3a')]){_0x9d8543[_0x5630('0x38')]=_[_0x5630('0x3b')](_0x9d8543['where'],{'$or':_[_0x5630('0x2b')](_0x1d05b9,function(_0x2f2ade){if(_0x2f2ade[_0x5630('0x3c')]!==_0x5630('0x3d')){var _0x506607={};_0x506607[_0x2f2ade[_0x5630('0x28')]]={'$like':'%'+_0xe9c4c5[_0x5630('0x30')]['filter']+'%'};return _0x506607;}})});}_0x9d8543=_[_0x5630('0x3b')]({},_0x9d8543,_0xe9c4c5[_0x5630('0x3e')]);var _0x21b2e8={'where':_0x9d8543[_0x5630('0x38')]};return db[_0x5630('0x2c')]['count'](_0x21b2e8)[_0x5630('0x24')](function(_0x22959f){_0x5d6635[_0x5630('0x1f')]=_0x22959f;if(_0xe9c4c5['query'][_0x5630('0x3f')]){_0x9d8543['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x5630('0x40')](_0x9d8543);})['then'](function(_0x43d93a){_0x5d6635['rows']=_0x43d93a;return _0x5d6635;})[_0x5630('0x24')](respondWithFilteredResult(_0x1cc433,_0x9d8543))['catch'](handleError(_0x1cc433,null));};exports[_0x5630('0x41')]=function(_0x488e3c,_0x1ff1b4){var _0x154625={'raw':!![],'where':{'id':_0x488e3c[_0x5630('0x42')]['id']}},_0x304828={};_0x304828[_0x5630('0x34')]=_[_0x5630('0x31')](db[_0x5630('0x2c')]['rawAttributes']);_0x304828[_0x5630('0x30')]=_[_0x5630('0x31')](_0x488e3c[_0x5630('0x30')]);_0x304828[_0x5630('0x32')]=_[_0x5630('0x43')](_0x304828['model'],_0x304828[_0x5630('0x30')]);_0x154625['attributes']=_[_0x5630('0x43')](_0x304828['model'],qs['fields'](_0x488e3c[_0x5630('0x30')][_0x5630('0x35')]));_0x154625['attributes']=_0x154625[_0x5630('0x33')][_0x5630('0x36')]?_0x154625[_0x5630('0x33')]:_0x304828[_0x5630('0x34')];if(_0x488e3c[_0x5630('0x30')][_0x5630('0x3f')]){_0x154625[_0x5630('0x44')]=[{'all':!![]}];}_0x154625=_[_0x5630('0x3b')]({},_0x154625,_0x488e3c['options']);return db[_0x5630('0x2c')]['find'](_0x154625)[_0x5630('0x24')](handleEntityNotFound(_0x1ff1b4,null))['then'](respondWithResult(_0x1ff1b4,null))[_0x5630('0x45')](handleError(_0x1ff1b4,null));};exports[_0x5630('0x46')]=function(_0x497104,_0x93d919){return db[_0x5630('0x2c')][_0x5630('0x46')](_0x497104[_0x5630('0x47')],{})[_0x5630('0x24')](respondWithResult(_0x93d919,0xc9))[_0x5630('0x45')](handleError(_0x93d919,null));};exports[_0x5630('0x23')]=function(_0x1515f2,_0x59e8a6){if(_0x1515f2[_0x5630('0x47')]['id']){delete _0x1515f2[_0x5630('0x47')]['id'];}return db[_0x5630('0x2c')][_0x5630('0x48')]({'where':{'id':_0x1515f2[_0x5630('0x42')]['id']}})[_0x5630('0x24')](handleEntityNotFound(_0x59e8a6,null))[_0x5630('0x24')](saveUpdates(_0x1515f2[_0x5630('0x47')],null))['then'](respondWithResult(_0x59e8a6,null))[_0x5630('0x45')](handleError(_0x59e8a6,null));};exports[_0x5630('0x25')]=function(_0xab7a5f,_0x213fb6){return db['VoiceDialReport'][_0x5630('0x48')]({'where':{'id':_0xab7a5f[_0x5630('0x42')]['id']}})['then'](handleEntityNotFound(_0x213fb6,null))['then'](removeEntity(_0x213fb6,null))[_0x5630('0x45')](handleError(_0x213fb6,null));};exports[_0x5630('0x49')]=function(_0x3b3ea6,_0x3f2122){return db[_0x5630('0x2c')]['describe']()[_0x5630('0x24')](respondWithResult(_0x3f2122,null))['catch'](handleError(_0x3f2122,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 66519d1..ab7c4a7 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 _0x14d8=['../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3921a8,_0x5269ba){var _0x56260e=function(_0x922b42){while(--_0x922b42){_0x3921a8['push'](_0x3921a8['shift']());}};_0x56260e(++_0x5269ba);}(_0x14d8,0x9f));var _0x814d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x14d8[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var logger=require(_0x814d('0x2'))(_0x814d('0x3'));var moment=require(_0x814d('0x4'));var BPromise=require(_0x814d('0x5'));var rp=require(_0x814d('0x6'));var fs=require('fs');var path=require(_0x814d('0x7'));var rimraf=require(_0x814d('0x8'));var config=require(_0x814d('0x9'));var attributes=require(_0x814d('0xa'));module[_0x814d('0xb')]=function(_0x2ca1eb,_0x39fe1e){return _0x2ca1eb[_0x814d('0xc')](_0x814d('0xd'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x67b6=['VoiceDialReport','report_dial','uniqueid','util','bluebird','request-promise','path','../../config/environment','define'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x67b6,0x1d7));var _0x667b=function(_0x3188c2,_0x4e628d){_0x3188c2=_0x3188c2-0x0;var _0xbeba85=_0x67b6[_0x3188c2];return _0xbeba85;};'use strict';var _=require('lodash');var util=require(_0x667b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x667b('0x1'));var rp=require(_0x667b('0x2'));var fs=require('fs');var path=require(_0x667b('0x3'));var rimraf=require('rimraf');var config=require(_0x667b('0x4'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x18d138,_0x4d42de){return _0x18d138[_0x667b('0x5')](_0x667b('0x6'),attributes,{'tableName':_0x667b('0x7'),'paranoid':![],'indexes':[{'fields':[_0x667b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d71a34e..b02eb96 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 _0x2c24=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','update','limit','UpdateVoiceDialReport','lodash'];(function(_0x3c4016,_0x2e220f){var _0x3cebbd=function(_0x101bb1){while(--_0x101bb1){_0x3c4016['push'](_0x3c4016['shift']());}};_0x3cebbd(++_0x2e220f);}(_0x2c24,0x135));var _0x42c2=function(_0x5cf0d5,_0x16139d){_0x5cf0d5=_0x5cf0d5-0x0;var _0x4832d4=_0x2c24[_0x5cf0d5];return _0x4832d4;};'use strict';var _=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var moment=require('moment');var BPromise=require(_0x42c2('0x2'));var rs=require(_0x42c2('0x3'));var fs=require('fs');var Redis=require(_0x42c2('0x4'));var db=require(_0x42c2('0x5'))['db'];var utils=require(_0x42c2('0x6'));var logger=require('../../config/logger')(_0x42c2('0x7'));var config=require(_0x42c2('0x8'));var jayson=require(_0x42c2('0x9'));var client=jayson['client'][_0x42c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a4043,_0x277d50,_0x5457c5){return new BPromise(function(_0x3206b9,_0x321152){return client[_0x42c2('0xb')](_0x5a4043,_0x5457c5)[_0x42c2('0xc')](function(_0x9d981d){logger[_0x42c2('0xd')](_0x42c2('0xe'),_0x277d50,_0x42c2('0xf'));logger[_0x42c2('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x277d50,'request\x20sent',JSON[_0x42c2('0x11')](_0x9d981d));if(_0x9d981d['error']){if(_0x9d981d[_0x42c2('0x12')]['code']===0x1f4){logger[_0x42c2('0x12')](_0x42c2('0xe'),_0x277d50,_0x9d981d[_0x42c2('0x12')][_0x42c2('0x13')]);return _0x321152(_0x9d981d[_0x42c2('0x12')]['message']);}logger[_0x42c2('0x12')](_0x42c2('0xe'),_0x277d50,_0x9d981d[_0x42c2('0x12')][_0x42c2('0x13')]);return _0x3206b9(_0x9d981d['error'][_0x42c2('0x13')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x277d50,_0x42c2('0xf'));_0x3206b9(_0x9d981d[_0x42c2('0x14')]['message']);}})[_0x42c2('0x15')](function(_0x191b7d){logger[_0x42c2('0x12')](_0x42c2('0xe'),_0x277d50,_0x191b7d);_0x321152(_0x191b7d);});});}exports[_0x42c2('0x16')]=function(_0x15ab0e){var _0x85e60e=this;return new Promise(function(_0x145b43,_0x2dd895){return db[_0x42c2('0x17')][_0x42c2('0x18')](_0x15ab0e[_0x42c2('0x19')],{'raw':_0x15ab0e[_0x42c2('0x1a')]?_0x15ab0e['options'][_0x42c2('0x1b')]===undefined?!![]:![]:!![]})[_0x42c2('0xc')](function(_0x497693){logger['info'](_0x42c2('0x16'),_0x15ab0e);logger['debug'](_0x42c2('0x16'),_0x15ab0e,JSON[_0x42c2('0x11')](_0x497693));_0x145b43(_0x497693);})[_0x42c2('0x15')](function(_0x5e936a){logger['error']('CreateVoiceDialReport',_0x5e936a['message'],_0x15ab0e);_0x2dd895(_0x85e60e[_0x42c2('0x12')](0x1f4,_0x5e936a[_0x42c2('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x25cb7c){var _0x1cd0fe=this;return new Promise(function(_0xb4b124,_0x3b1284){return db['VoiceDialReport'][_0x42c2('0x1c')](_0x25cb7c[_0x42c2('0x19')],{'raw':_0x25cb7c['options']?_0x25cb7c[_0x42c2('0x1a')][_0x42c2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25cb7c[_0x42c2('0x1a')]?_0x25cb7c['options']['where']||null:null,'attributes':_0x25cb7c[_0x42c2('0x1a')]?_0x25cb7c[_0x42c2('0x1a')]['attributes']||null:null,'limit':_0x25cb7c[_0x42c2('0x1a')]?_0x25cb7c[_0x42c2('0x1a')][_0x42c2('0x1d')]||null:null})['then'](function(_0x49023a){logger['info'](_0x42c2('0x1e'),_0x25cb7c);logger[_0x42c2('0x10')](_0x42c2('0x1e'),_0x25cb7c,JSON['stringify'](_0x49023a));_0xb4b124(_0x49023a);})[_0x42c2('0x15')](function(_0x1583e3){logger[_0x42c2('0x12')](_0x42c2('0x1e'),_0x1583e3['message'],_0x25cb7c);_0x3b1284(_0x1cd0fe['error'](0x1f4,_0x1583e3[_0x42c2('0x13')]));});});}; \ No newline at end of file +var _0x3089=['options','debug','UpdateVoiceDialReport','update','raw','where','attributes','limit','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0x3089,0x181));var _0x9308=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x3089[_0x4fc9e6];return _0x551d28;};'use strict';var _=require('lodash');var util=require(_0x9308('0x0'));var moment=require('moment');var BPromise=require(_0x9308('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9308('0x2'))['db'];var utils=require(_0x9308('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x9308('0x4'));var jayson=require(_0x9308('0x5'));var client=jayson['client'][_0x9308('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xd39e25,_0x2e1744,_0xd2e53a){return new BPromise(function(_0x41e984,_0xef847a){return client['request'](_0xd39e25,_0xd2e53a)[_0x9308('0x7')](function(_0x4c7406){logger[_0x9308('0x8')](_0x9308('0x9'),_0x2e1744,_0x9308('0xa'));logger['debug'](_0x9308('0xb'),_0x2e1744,_0x9308('0xa'),JSON[_0x9308('0xc')](_0x4c7406));if(_0x4c7406[_0x9308('0xd')]){if(_0x4c7406[_0x9308('0xd')]['code']===0x1f4){logger[_0x9308('0xd')](_0x9308('0x9'),_0x2e1744,_0x4c7406[_0x9308('0xd')][_0x9308('0xe')]);return _0xef847a(_0x4c7406['error'][_0x9308('0xe')]);}logger['error'](_0x9308('0x9'),_0x2e1744,_0x4c7406[_0x9308('0xd')]['message']);return _0x41e984(_0x4c7406[_0x9308('0xd')]['message']);}else{logger[_0x9308('0x8')]('VoiceDialReport,\x20%s,\x20%s',_0x2e1744,_0x9308('0xa'));_0x41e984(_0x4c7406[_0x9308('0xf')][_0x9308('0xe')]);}})[_0x9308('0x10')](function(_0x40245f){logger[_0x9308('0xd')](_0x9308('0x9'),_0x2e1744,_0x40245f);_0xef847a(_0x40245f);});});}exports[_0x9308('0x11')]=function(_0x3a0bde){var _0x5185f8=this;return new Promise(function(_0x3b31a5,_0x5db80f){return db[_0x9308('0x12')][_0x9308('0x13')](_0x3a0bde[_0x9308('0x14')],{'raw':_0x3a0bde[_0x9308('0x15')]?_0x3a0bde['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1531d0){logger[_0x9308('0x8')](_0x9308('0x11'),_0x3a0bde);logger[_0x9308('0x16')]('CreateVoiceDialReport',_0x3a0bde,JSON[_0x9308('0xc')](_0x1531d0));_0x3b31a5(_0x1531d0);})['catch'](function(_0x17ba2e){logger['error'](_0x9308('0x11'),_0x17ba2e[_0x9308('0xe')],_0x3a0bde);_0x5db80f(_0x5185f8[_0x9308('0xd')](0x1f4,_0x17ba2e[_0x9308('0xe')]));});});};exports[_0x9308('0x17')]=function(_0xcfc7cb){var _0x147090=this;return new Promise(function(_0x5af296,_0x1e0100){return db['VoiceDialReport'][_0x9308('0x18')](_0xcfc7cb[_0x9308('0x14')],{'raw':_0xcfc7cb[_0x9308('0x15')]?_0xcfc7cb[_0x9308('0x15')][_0x9308('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcfc7cb['options']?_0xcfc7cb[_0x9308('0x15')][_0x9308('0x1a')]||null:null,'attributes':_0xcfc7cb['options']?_0xcfc7cb[_0x9308('0x15')][_0x9308('0x1b')]||null:null,'limit':_0xcfc7cb[_0x9308('0x15')]?_0xcfc7cb[_0x9308('0x15')][_0x9308('0x1c')]||null:null})[_0x9308('0x7')](function(_0x1140c8){logger[_0x9308('0x8')](_0x9308('0x17'),_0xcfc7cb);logger[_0x9308('0x16')](_0x9308('0x17'),_0xcfc7cb,JSON['stringify'](_0x1140c8));_0x5af296(_0x1140c8);})[_0x9308('0x10')](function(_0x26a9ef){logger[_0x9308('0xd')](_0x9308('0x17'),_0x26a9ef[_0x9308('0xe')],_0xcfc7cb);_0x1e0100(_0x147090[_0x9308('0xd')](0x1f4,_0x26a9ef[_0x9308('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f38e69b..95a10cf 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 _0x13fa=['put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','/:id/applications'];(function(_0x19d8c4,_0x29c96b){var _0x25dc47=function(_0x1e4f66){while(--_0x1e4f66){_0x19d8c4['push'](_0x19d8c4['shift']());}};_0x25dc47(++_0x29c96b);}(_0x13fa,0xb8));var _0xa13f=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x13fa[_0x240261];return _0x45c332;};'use strict';var multer=require(_0xa13f('0x0'));var util=require('util');var path=require(_0xa13f('0x1'));var timeout=require('connect-timeout');var express=require(_0xa13f('0x2'));var router=express[_0xa13f('0x3')]();var fs_extra=require(_0xa13f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa13f('0x5'));var config=require(_0xa13f('0x6'));var controller=require(_0xa13f('0x7'));router[_0xa13f('0x8')]('/',auth[_0xa13f('0x9')](),controller['index']);router[_0xa13f('0x8')](_0xa13f('0xa'),auth[_0xa13f('0x9')](),controller[_0xa13f('0xb')]);router[_0xa13f('0xc')]('/',auth[_0xa13f('0x9')](),controller['create']);router['post'](_0xa13f('0xd'),auth[_0xa13f('0x9')](),controller['addApplications']);router[_0xa13f('0xe')](_0xa13f('0xa'),auth['isAuthenticated'](),controller[_0xa13f('0xf')]);router['delete'](_0xa13f('0xa'),auth[_0xa13f('0x9')](),controller[_0xa13f('0x10')]);module[_0xa13f('0x11')]=router; \ No newline at end of file +var _0x1430=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','post','/:id/applications','addApplications','update','/:id','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5b10fc,_0x8c47be){var _0x126f3b=function(_0x4bcb8f){while(--_0x4bcb8f){_0x5b10fc['push'](_0x5b10fc['shift']());}};_0x126f3b(++_0x8c47be);}(_0x1430,0x1d5));var _0x0143=function(_0xaac610,_0x1f0e04){_0xaac610=_0xaac610-0x0;var _0x2980f1=_0x1430[_0xaac610];return _0x2980f1;};'use strict';var multer=require(_0x0143('0x0'));var util=require(_0x0143('0x1'));var path=require(_0x0143('0x2'));var timeout=require(_0x0143('0x3'));var express=require(_0x0143('0x4'));var router=express[_0x0143('0x5')]();var fs_extra=require(_0x0143('0x6'));var auth=require(_0x0143('0x7'));var interaction=require(_0x0143('0x8'));var config=require('../../config/environment');var controller=require(_0x0143('0x9'));router[_0x0143('0xa')]('/',auth[_0x0143('0xb')](),controller[_0x0143('0xc')]);router[_0x0143('0xa')]('/:id',auth[_0x0143('0xb')](),controller['show']);router[_0x0143('0xd')]('/',auth[_0x0143('0xb')](),controller['create']);router[_0x0143('0xd')](_0x0143('0xe'),auth[_0x0143('0xb')](),controller[_0x0143('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0143('0x10')]);router['delete'](_0x0143('0x11'),auth[_0x0143('0xb')](),controller[_0x0143('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index e5759a2..5e3213c 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 _0xea56=['any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xea56,0x184));var _0x6ea5=function(_0x392407,_0x3c283a){_0x392407=_0x392407-0x0;var _0x2b08a4=_0xea56[_0x392407];return _0x2b08a4;};'use strict';var Sequelize=require(_0x6ea5('0x0'));module[_0x6ea5('0x1')]={'context':{'type':Sequelize[_0x6ea5('0x2')],'allowNull':![],'unique':_0x6ea5('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6ea5('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x6ea5('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6ea5('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6ea5('0x2')],'allowNull':![],'defaultValue':_0x6ea5('0x4')},'appdata':{'type':Sequelize[_0x6ea5('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6ea5('0x5')](_0x6ea5('0x6'),_0x6ea5('0x7'),_0x6ea5('0x8'),_0x6ea5('0x9'),_0x6ea5('0xa'),'system',_0x6ea5('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x6ea5('0x2')]},'interval':{'type':Sequelize[_0x6ea5('0x2')],'allowNull':![],'defaultValue':_0x6ea5('0xc')},'IntervalId':{'type':Sequelize[_0x6ea5('0xd')]},'isApp':{'type':Sequelize[_0x6ea5('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x6ea5('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x6ea5('0xd')]},'recordingFormat':{'type':Sequelize[_0x6ea5('0x2')],'defaultValue':_0x6ea5('0xf')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x6ea5('0x10')],'get':function(_0xed76ae){return this[_0x6ea5('0x11')](_0x6ea5('0x12'));}},'alias':{'type':Sequelize[_0x6ea5('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x86e2=['system','any','INTEGER','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax'];(function(_0x4eab11,_0x420bfb){var _0x417a63=function(_0x35f378){while(--_0x35f378){_0x4eab11['push'](_0x4eab11['shift']());}};_0x417a63(++_0x420bfb);}(_0x86e2,0x1d7));var _0x286e=function(_0x4f16b2,_0x4b9908){_0x4f16b2=_0x4f16b2-0x0;var _0x44062c=_0x86e2[_0x4f16b2];return _0x44062c;};'use strict';var Sequelize=require(_0x286e('0x0'));module[_0x286e('0x1')]={'context':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'unique':_0x286e('0x3')},'priority':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x286e('0x3')},'tag':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'defaultValue':_0x286e('0x4')},'appdata':{'type':Sequelize[_0x286e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x286e('0x5')](_0x286e('0x6'),_0x286e('0x7'),'internal',_0x286e('0x8'),'outbound-fax',_0x286e('0x9'),_0x286e('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x286e('0x2')]},'interval':{'type':Sequelize[_0x286e('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x286e('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x286e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x286e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x286e('0x2')],'defaultValue':_0x286e('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2dcfad){return this[_0x286e('0xd')](_0x286e('0xe'));}},'alias':{'type':Sequelize[_0x286e('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 2007429..0a6a4be 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 _0x9277=['cutdigits','mandatoryDisposition','alias','context','addApplications','transaction','isApp','rewriteDial','true','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','./voiceExtension.socket','register','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','then','destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','filter','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','where','merge','options','VoiceExtension','includeAll','include','rows','show','params','catch','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','recordingFormat'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x9277,0x147));var _0x7927=function(_0x14a52c,_0x2adfba){_0x14a52c=_0x14a52c-0x0;var _0x19163b=_0x9277[_0x14a52c];return _0x19163b;};'use strict';var emlformat=require(_0x7927('0x0'));var rimraf=require(_0x7927('0x1'));var zipdir=require(_0x7927('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7927('0x3'));var BPromise=require(_0x7927('0x4'));var Mustache=require(_0x7927('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7927('0x6'));var csv=require(_0x7927('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7927('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7927('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7927('0xa'));var toCsv=require(_0x7927('0x7'));var querystring=require(_0x7927('0xb'));var Papa=require(_0x7927('0xc'));var Redis=require('ioredis');var authService=require(_0x7927('0xd'));var qs=require(_0x7927('0xe'));var as=require(_0x7927('0xf'));var hardwareService=require(_0x7927('0x10'));var logger=require(_0x7927('0x11'))(_0x7927('0x12'));var utils=require(_0x7927('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7927('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7927('0x15'))[_0x7927('0x16')](socket);function respondWithStatusCode(_0x5188c2,_0x4c356d){_0x4c356d=_0x4c356d||0xcc;return function(_0x1bab96){if(_0x1bab96){return _0x5188c2[_0x7927('0x17')](_0x4c356d);}return _0x5188c2[_0x7927('0x18')](_0x4c356d)[_0x7927('0x19')]();};}function respondWithResult(_0x1b0142,_0x10c4ec){_0x10c4ec=_0x10c4ec||0xc8;return function(_0x196c39){if(_0x196c39){return _0x1b0142['status'](_0x10c4ec)[_0x7927('0x1a')](_0x196c39);}};}function respondWithFilteredResult(_0x17cbb0,_0x966d90){return function(_0x3b4a0b){if(_0x3b4a0b){var _0x5b3d03=typeof _0x966d90['offset']===_0x7927('0x1b')&&typeof _0x966d90['limit']===_0x7927('0x1b');var _0xd86e6b=_0x3b4a0b[_0x7927('0x1c')];var _0x5115b=_0x5b3d03?0x0:_0x966d90[_0x7927('0x1d')];var _0x207d51=_0x5b3d03?_0x3b4a0b[_0x7927('0x1c')]:_0x966d90[_0x7927('0x1d')]+_0x966d90['limit'];var _0x24c245;if(_0x207d51>=_0xd86e6b){_0x207d51=_0xd86e6b;_0x24c245=0xc8;}else{_0x24c245=0xce;}_0x17cbb0[_0x7927('0x18')](_0x24c245);return _0x17cbb0[_0x7927('0x1e')](_0x7927('0x1f'),_0x5115b+'-'+_0x207d51+'/'+_0xd86e6b)['json'](_0x3b4a0b);}return null;};}function patchUpdates(_0x7e5fd){return function(_0x258bd4){try{jsonpatch['apply'](_0x258bd4,_0x7e5fd,!![]);}catch(_0x4a03c4){return BPromise[_0x7927('0x20')](_0x4a03c4);}return _0x258bd4['save']();};}function saveUpdates(_0x368495,_0x32153a){return function(_0x8f50c1){if(_0x8f50c1){return _0x8f50c1[_0x7927('0x21')](_0x368495)[_0x7927('0x22')](function(_0x2725d1){return _0x2725d1;});}return null;};}function removeEntity(_0x46702b,_0xf31ff1){return function(_0x30e491){if(_0x30e491){return _0x30e491[_0x7927('0x23')]()[_0x7927('0x22')](function(){var _0x174f6e=_0x30e491[_0x7927('0x24')]({'plain':!![]});var _0x344d42=[{'name':_0x7927('0x25'),'value':_0x7927('0x26'),'ignore':![]},{'name':'OutboundRoutes','value':_0x7927('0x27'),'ignore':![]},{'name':_0x7927('0x28'),'value':'internal','ignore':![]}];var _0x14d1e6=_(_0x344d42)[_0x7927('0x29')]('ignore')[_0x7927('0x2a')](_0x7927('0x2b'))['value']();if(_[_0x7927('0x2c')](_0x14d1e6,_0x174f6e[_0x7927('0x2d')])){return;}var _0x27f61c=_[_0x7927('0x2e')](_0x344d42,[_0x7927('0x2b'),_0x174f6e['type']])[_0x7927('0x2f')];return db[_0x7927('0x30')]['destroy']({'where':{'type':_0x27f61c,'resourceId':_0x174f6e['id']}})[_0x7927('0x22')](function(){return _0x30e491;});})[_0x7927('0x22')](function(){_0x46702b[_0x7927('0x18')](0xcc)[_0x7927('0x19')]();});}};}function handleEntityNotFound(_0x84d120,_0x3001d8){return function(_0x3029da){if(!_0x3029da){_0x84d120[_0x7927('0x17')](0x194);}return _0x3029da;};}function handleError(_0x450fb3,_0xaf2a26){_0xaf2a26=_0xaf2a26||0x1f4;return function(_0x1f0dde){logger[_0x7927('0x31')](_0x1f0dde[_0x7927('0x32')]);if(_0x1f0dde[_0x7927('0x2f')]){delete _0x1f0dde[_0x7927('0x2f')];}_0x450fb3['status'](_0xaf2a26)[_0x7927('0x33')](_0x1f0dde);};}exports[_0x7927('0x34')]=function(_0x18e600,_0x35e053){var _0x539400={},_0x472188={},_0x1b870d={'count':0x0,'rows':[]};var _0x2ae9ba=_[_0x7927('0x2a')](db['VoiceExtension'][_0x7927('0x35')],function(_0x20497d){return{'name':_0x20497d[_0x7927('0x36')],'type':_0x20497d[_0x7927('0x2d')][_0x7927('0x37')]};});_0x472188[_0x7927('0x38')]=_[_0x7927('0x2a')](_0x2ae9ba,_0x7927('0x2f'));_0x472188[_0x7927('0x39')]=_[_0x7927('0x3a')](_0x18e600['query']);_0x472188[_0x7927('0x3b')]=_[_0x7927('0x3c')](_0x472188[_0x7927('0x38')],_0x472188[_0x7927('0x39')]);_0x539400[_0x7927('0x3d')]=_[_0x7927('0x3c')](_0x472188[_0x7927('0x38')],qs[_0x7927('0x3e')](_0x18e600['query'][_0x7927('0x3e')]));_0x539400[_0x7927('0x3d')]=_0x539400[_0x7927('0x3d')][_0x7927('0x3f')]?_0x539400[_0x7927('0x3d')]:_0x472188[_0x7927('0x38')];if(!_0x18e600['query']['hasOwnProperty'](_0x7927('0x40'))){_0x539400[_0x7927('0x41')]=qs[_0x7927('0x41')](_0x18e600[_0x7927('0x39')][_0x7927('0x41')]);_0x539400[_0x7927('0x1d')]=qs[_0x7927('0x1d')](_0x18e600[_0x7927('0x39')][_0x7927('0x1d')]);}_0x539400[_0x7927('0x42')]=qs[_0x7927('0x43')](_0x18e600['query'][_0x7927('0x43')]);_0x539400['where']=qs[_0x7927('0x3b')](_[_0x7927('0x44')](_0x18e600[_0x7927('0x39')],_0x472188[_0x7927('0x3b')]),_0x2ae9ba);if(_0x18e600[_0x7927('0x39')][_0x7927('0x29')]){_0x539400[_0x7927('0x45')]=_[_0x7927('0x46')](_0x539400[_0x7927('0x45')],{'$or':_['map'](_0x2ae9ba,function(_0x5a6fc5){if(_0x5a6fc5[_0x7927('0x2d')]!=='VIRTUAL'){var _0x28786a={};_0x28786a[_0x5a6fc5[_0x7927('0x2f')]]={'$like':'%'+_0x18e600['query'][_0x7927('0x29')]+'%'};return _0x28786a;}})});}_0x539400=_[_0x7927('0x46')]({},_0x539400,_0x18e600[_0x7927('0x47')]);var _0x404c09={'where':_0x539400[_0x7927('0x45')]};return db[_0x7927('0x48')][_0x7927('0x1c')](_0x404c09)[_0x7927('0x22')](function(_0x34a5f1){_0x1b870d[_0x7927('0x1c')]=_0x34a5f1;if(_0x18e600[_0x7927('0x39')][_0x7927('0x49')]){_0x539400[_0x7927('0x4a')]=[{'all':!![]}];}return db[_0x7927('0x48')]['findAll'](_0x539400);})[_0x7927('0x22')](function(_0x197dfa){_0x1b870d[_0x7927('0x4b')]=_0x197dfa;return _0x1b870d;})['then'](respondWithFilteredResult(_0x35e053,_0x539400))['catch'](handleError(_0x35e053,null));};exports[_0x7927('0x4c')]=function(_0x402a59,_0x18b638){var _0x417056={'raw':![],'where':{'id':_0x402a59[_0x7927('0x4d')]['id']}},_0x513887={};_0x513887[_0x7927('0x38')]=_[_0x7927('0x3a')](db[_0x7927('0x48')][_0x7927('0x35')]);_0x513887['query']=_[_0x7927('0x3a')](_0x402a59[_0x7927('0x39')]);_0x513887[_0x7927('0x3b')]=_['intersection'](_0x513887[_0x7927('0x38')],_0x513887[_0x7927('0x39')]);_0x417056[_0x7927('0x3d')]=_['intersection'](_0x513887[_0x7927('0x38')],qs[_0x7927('0x3e')](_0x402a59[_0x7927('0x39')]['fields']));_0x417056['attributes']=_0x417056[_0x7927('0x3d')][_0x7927('0x3f')]?_0x417056[_0x7927('0x3d')]:_0x513887['model'];if(_0x402a59['query'][_0x7927('0x49')]){_0x417056['include']=[{'all':!![]}];}_0x417056=_[_0x7927('0x46')]({},_0x417056,_0x402a59[_0x7927('0x47')]);return db[_0x7927('0x48')]['find'](_0x417056)[_0x7927('0x22')](handleEntityNotFound(_0x18b638,null))[_0x7927('0x22')](respondWithResult(_0x18b638,null))[_0x7927('0x4e')](handleError(_0x18b638,null));};exports[_0x7927('0x23')]=function(_0x1579e7,_0x396e1e){return db[_0x7927('0x48')]['find']({'where':{'id':_0x1579e7[_0x7927('0x4d')]['id']}})[_0x7927('0x22')](handleEntityNotFound(_0x396e1e,null))[_0x7927('0x22')](removeEntity(_0x396e1e,null))[_0x7927('0x4e')](handleError(_0x396e1e,null));};exports[_0x7927('0x4f')]=function(_0x138266,_0x38f82c){if(_0x138266[_0x7927('0x50')][_0x7927('0x2d')]==='outbound'&&!_[_0x7927('0x51')](_0x138266[_0x7927('0x50')]['exten'],'_')){_0x138266[_0x7927('0x50')][_0x7927('0x52')]='_'[_0x7927('0x53')](_0x138266[_0x7927('0x50')]['exten']);}return db[_0x7927('0x48')][_0x7927('0x4f')](_0x138266[_0x7927('0x50')],{'raw':![]})['then'](function(_0x322d3e){var _0x22faed=_0x138266['user'][_0x7927('0x24')]({'plain':!![]});if(!_0x22faed)throw new Error(_0x7927('0x54'));if(_0x22faed[_0x7927('0x55')]===_0x7927('0x56')){var _0x5999b3=_0x322d3e[_0x7927('0x24')]({'plain':!![]});var _0xc84080=[{'name':_0x7927('0x25'),'value':_0x7927('0x26')},{'name':'OutboundRoutes','value':_0x7927('0x27')},{'name':_0x7927('0x28'),'value':_0x7927('0x57')}];var _0x1a6096=_[_0x7927('0x2e')](_0xc84080,[_0x7927('0x2b'),_0x5999b3[_0x7927('0x2d')]])['name'];return db[_0x7927('0x58')][_0x7927('0x2e')]({'where':{'name':_0x1a6096,'userProfileId':_0x22faed[_0x7927('0x59')]},'raw':!![]})[_0x7927('0x22')](function(_0x3bfe35){if(_0x3bfe35&&_0x3bfe35[_0x7927('0x5a')]===0x0){return db[_0x7927('0x30')][_0x7927('0x4f')]({'name':_0x5999b3[_0x7927('0x2f')],'resourceId':_0x5999b3['id'],'type':_0x3bfe35[_0x7927('0x2f')],'sectionId':_0x3bfe35['id']},{})[_0x7927('0x22')](function(){return _0x322d3e;});}else{return _0x322d3e;}})['catch'](function(_0x44943d){logger['error'](_0x7927('0x5b'),_0x44943d);throw _0x44943d;});}return _0x322d3e;})['then'](respondWithResult(_0x38f82c,0xc9))['catch'](handleError(_0x38f82c,null));};exports[_0x7927('0x21')]=function(_0x57cbc1,_0x2fb7c5){if(_0x57cbc1[_0x7927('0x50')]['id']){delete _0x57cbc1[_0x7927('0x50')]['id'];}return db['VoiceExtension'][_0x7927('0x2e')]({'where':{'id':_0x57cbc1[_0x7927('0x4d')]['id']}})[_0x7927('0x22')](handleEntityNotFound(_0x2fb7c5,null))['then'](function(_0x538c4a){if(_0x538c4a){return db[_0x7927('0x48')][_0x7927('0x21')](_['pick'](_0x57cbc1[_0x7927('0x50')],[_0x7927('0x52'),'context','description',_0x7927('0x5c'),_0x7927('0x5d'),_0x7927('0x5e'),_0x7927('0x5f')]),{'where':{'context':_0x538c4a[_0x7927('0x60')],'exten':_0x538c4a[_0x7927('0x52')]},'individualHooks':!![]})[_0x7927('0x22')](function(_0x55862c){return _0x55862c;});}return null;})['then'](respondWithStatusCode(_0x2fb7c5,null))[_0x7927('0x4e')](handleError(_0x2fb7c5,null));};exports[_0x7927('0x61')]=function(_0x167e36,_0x593df1){return db['VoiceExtension']['findOne']({'where':{'id':_0x167e36[_0x7927('0x4d')]['id']}})[_0x7927('0x22')](function(_0xcdfe19){if(_0xcdfe19){return db['sequelize'][_0x7927('0x62')](function(_0x3c311e){return db[_0x7927('0x48')][_0x7927('0x23')]({'where':{'VoiceExtensionId':_0x167e36[_0x7927('0x4d')]['id']},'transaction':_0x3c311e})[_0x7927('0x22')](function(){var _0x218414=_[_0x7927('0x2a')](_0x167e36[_0x7927('0x50')],function(_0x832d55){_0x832d55['VoiceExtensionId']=_0x167e36[_0x7927('0x4d')]['id'];_0x832d55[_0x7927('0x63')]=!![];return _0x832d55;});var _0x16d76f=_0x167e36['query'][_0x7927('0x64')]&&_0x167e36['query'][_0x7927('0x64')]['toLowerCase']()===_0x7927('0x65')?!![]:![];return _0xcdfe19['createRouting'](_0x218414,_0x16d76f);})[_0x7927('0x22')](function(_0xa1a0e0){return db[_0x7927('0x48')][_0x7927('0x66')](_0xa1a0e0,{'transaction':_0x3c311e});});})[_0x7927('0x22')](function(){return db[_0x7927('0x48')][_0x7927('0x67')]({'where':{'isApp':!![],'VoiceExtensionId':_0x167e36[_0x7927('0x4d')]['id']},'order':_0x7927('0x68')});});}})['then'](respondWithResult(_0x593df1,null))[_0x7927('0x4e')](handleError(_0x593df1,null));}; \ No newline at end of file +var _0xe438=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','get','InboundRoutes','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','body','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','OutboundRoutes','InternalRoutes','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','params','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x154f10,_0x5be025){var _0x5b5ddc=function(_0x3d8bbe){while(--_0x3d8bbe){_0x154f10['push'](_0x154f10['shift']());}};_0x5b5ddc(++_0x5be025);}(_0xe438,0xe7));var _0x8e43=function(_0x465aa4,_0x443041){_0x465aa4=_0x465aa4-0x0;var _0x56d34e=_0xe438[_0x465aa4];return _0x56d34e;};'use strict';var emlformat=require(_0x8e43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e43('0x1'));var jsonpatch=require(_0x8e43('0x2'));var rp=require(_0x8e43('0x3'));var moment=require(_0x8e43('0x4'));var BPromise=require(_0x8e43('0x5'));var Mustache=require(_0x8e43('0x6'));var util=require(_0x8e43('0x7'));var path=require(_0x8e43('0x8'));var sox=require(_0x8e43('0x9'));var csv=require(_0x8e43('0xa'));var ejs=require(_0x8e43('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e43('0xc'));var squel=require(_0x8e43('0xd'));var crypto=require(_0x8e43('0xe'));var jsforce=require(_0x8e43('0xf'));var deskjs=require(_0x8e43('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8e43('0x11'));var Papa=require(_0x8e43('0x12'));var Redis=require(_0x8e43('0x13'));var authService=require(_0x8e43('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8e43('0x15'));var hardwareService=require(_0x8e43('0x16'));var logger=require(_0x8e43('0x17'))(_0x8e43('0x18'));var utils=require('../../config/utils');var config=require(_0x8e43('0x19'));var licenseUtil=require(_0x8e43('0x1a'));var db=require(_0x8e43('0x1b'))['db'];config[_0x8e43('0x1c')]=_[_0x8e43('0x1d')](config[_0x8e43('0x1c')],{'host':_0x8e43('0x1e'),'port':0x18eb});var socket=require(_0x8e43('0x1f'))(new Redis(config[_0x8e43('0x1c')]));require('./voiceExtension.socket')[_0x8e43('0x20')](socket);function respondWithStatusCode(_0x4992a3,_0xc8983a){_0xc8983a=_0xc8983a||0xcc;return function(_0x559ea7){if(_0x559ea7){return _0x4992a3[_0x8e43('0x21')](_0xc8983a);}return _0x4992a3['status'](_0xc8983a)[_0x8e43('0x22')]();};}function respondWithResult(_0x24bb5d,_0x486a8b){_0x486a8b=_0x486a8b||0xc8;return function(_0x23ceb8){if(_0x23ceb8){return _0x24bb5d[_0x8e43('0x23')](_0x486a8b)['json'](_0x23ceb8);}};}function respondWithFilteredResult(_0x301684,_0x22e13c){return function(_0x3a5c07){if(_0x3a5c07){var _0x5ef7f2=typeof _0x22e13c['offset']===_0x8e43('0x24')&&typeof _0x22e13c[_0x8e43('0x25')]===_0x8e43('0x24');var _0x1d12bc=_0x3a5c07[_0x8e43('0x26')];var _0x5d1510=_0x5ef7f2?0x0:_0x22e13c[_0x8e43('0x27')];var _0x5ae848=_0x5ef7f2?_0x3a5c07['count']:_0x22e13c[_0x8e43('0x27')]+_0x22e13c[_0x8e43('0x25')];var _0xb21663;if(_0x5ae848>=_0x1d12bc){_0x5ae848=_0x1d12bc;_0xb21663=0xc8;}else{_0xb21663=0xce;}_0x301684[_0x8e43('0x23')](_0xb21663);return _0x301684[_0x8e43('0x28')](_0x8e43('0x29'),_0x5d1510+'-'+_0x5ae848+'/'+_0x1d12bc)[_0x8e43('0x2a')](_0x3a5c07);}return null;};}function patchUpdates(_0x52e246){return function(_0x4b8e02){try{jsonpatch['apply'](_0x4b8e02,_0x52e246,!![]);}catch(_0x54acf7){return BPromise[_0x8e43('0x2b')](_0x54acf7);}return _0x4b8e02['save']();};}function saveUpdates(_0x3bd862,_0x2aa2e3){return function(_0x5f5dea){if(_0x5f5dea){return _0x5f5dea[_0x8e43('0x2c')](_0x3bd862)[_0x8e43('0x2d')](function(_0x4468fe){return _0x4468fe;});}return null;};}function removeEntity(_0x4dba23,_0x509efd){return function(_0x3e5f29){if(_0x3e5f29){return _0x3e5f29[_0x8e43('0x2e')]()[_0x8e43('0x2d')](function(){var _0x32c56d=_0x3e5f29[_0x8e43('0x2f')]({'plain':!![]});var _0x44dab5=[{'name':_0x8e43('0x30'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x8e43('0x31'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x5deb49=_(_0x44dab5)[_0x8e43('0x32')](_0x8e43('0x33'))[_0x8e43('0x34')](_0x8e43('0x35'))['value']();if(_[_0x8e43('0x36')](_0x5deb49,_0x32c56d[_0x8e43('0x37')])){return;}var _0x266f20=_[_0x8e43('0x38')](_0x44dab5,[_0x8e43('0x35'),_0x32c56d[_0x8e43('0x37')]])[_0x8e43('0x39')];return db[_0x8e43('0x3a')][_0x8e43('0x2e')]({'where':{'type':_0x266f20,'resourceId':_0x32c56d['id']}})[_0x8e43('0x2d')](function(){return _0x3e5f29;});})[_0x8e43('0x2d')](function(){_0x4dba23[_0x8e43('0x23')](0xcc)[_0x8e43('0x22')]();});}};}function handleEntityNotFound(_0x2fc19c,_0x198a67){return function(_0x46022a){if(!_0x46022a){_0x2fc19c[_0x8e43('0x21')](0x194);}return _0x46022a;};}function handleError(_0x43a91d,_0x39f0ef){_0x39f0ef=_0x39f0ef||0x1f4;return function(_0x1ba61){logger[_0x8e43('0x3b')](_0x1ba61[_0x8e43('0x3c')]);if(_0x1ba61[_0x8e43('0x39')]){delete _0x1ba61['name'];}_0x43a91d[_0x8e43('0x23')](_0x39f0ef)[_0x8e43('0x3d')](_0x1ba61);};}exports[_0x8e43('0x3e')]=function(_0x1065a2,_0x58bf6c){var _0x220efb={},_0x2dbc6c={},_0x547338={'count':0x0,'rows':[]};var _0x4c61f4=_[_0x8e43('0x34')](db[_0x8e43('0x3f')]['rawAttributes'],function(_0x1de042){return{'name':_0x1de042[_0x8e43('0x40')],'type':_0x1de042['type'][_0x8e43('0x41')]};});_0x2dbc6c[_0x8e43('0x42')]=_[_0x8e43('0x34')](_0x4c61f4,_0x8e43('0x39'));_0x2dbc6c[_0x8e43('0x43')]=_[_0x8e43('0x44')](_0x1065a2[_0x8e43('0x43')]);_0x2dbc6c[_0x8e43('0x45')]=_['intersection'](_0x2dbc6c[_0x8e43('0x42')],_0x2dbc6c['query']);_0x220efb[_0x8e43('0x46')]=_[_0x8e43('0x47')](_0x2dbc6c['model'],qs[_0x8e43('0x48')](_0x1065a2['query'][_0x8e43('0x48')]));_0x220efb['attributes']=_0x220efb[_0x8e43('0x46')][_0x8e43('0x49')]?_0x220efb[_0x8e43('0x46')]:_0x2dbc6c[_0x8e43('0x42')];if(!_0x1065a2[_0x8e43('0x43')][_0x8e43('0x4a')]('nolimit')){_0x220efb['limit']=qs[_0x8e43('0x25')](_0x1065a2[_0x8e43('0x43')][_0x8e43('0x25')]);_0x220efb[_0x8e43('0x27')]=qs[_0x8e43('0x27')](_0x1065a2[_0x8e43('0x43')][_0x8e43('0x27')]);}_0x220efb[_0x8e43('0x4b')]=qs['sort'](_0x1065a2[_0x8e43('0x43')][_0x8e43('0x4c')]);_0x220efb['where']=qs[_0x8e43('0x45')](_['pick'](_0x1065a2['query'],_0x2dbc6c[_0x8e43('0x45')]),_0x4c61f4);if(_0x1065a2[_0x8e43('0x43')][_0x8e43('0x32')]){_0x220efb[_0x8e43('0x4d')]=_['merge'](_0x220efb[_0x8e43('0x4d')],{'$or':_[_0x8e43('0x34')](_0x4c61f4,function(_0x930ff7){if(_0x930ff7[_0x8e43('0x37')]!==_0x8e43('0x4e')){var _0x3e14c7={};_0x3e14c7[_0x930ff7[_0x8e43('0x39')]]={'$like':'%'+_0x1065a2[_0x8e43('0x43')][_0x8e43('0x32')]+'%'};return _0x3e14c7;}})});}_0x220efb=_[_0x8e43('0x4f')]({},_0x220efb,_0x1065a2[_0x8e43('0x50')]);var _0x4e05fe={'where':_0x220efb['where']};return db[_0x8e43('0x3f')]['count'](_0x4e05fe)[_0x8e43('0x2d')](function(_0xb2b152){_0x547338[_0x8e43('0x26')]=_0xb2b152;if(_0x1065a2[_0x8e43('0x43')][_0x8e43('0x51')]){_0x220efb[_0x8e43('0x52')]=[{'all':!![]}];}return db[_0x8e43('0x3f')][_0x8e43('0x53')](_0x220efb);})[_0x8e43('0x2d')](function(_0x3f1bfa){_0x547338['rows']=_0x3f1bfa;return _0x547338;})[_0x8e43('0x2d')](respondWithFilteredResult(_0x58bf6c,_0x220efb))[_0x8e43('0x54')](handleError(_0x58bf6c,null));};exports[_0x8e43('0x55')]=function(_0x41af69,_0x33854b){var _0x4ee545={'raw':![],'where':{'id':_0x41af69['params']['id']}},_0x89e56={};_0x89e56[_0x8e43('0x42')]=_[_0x8e43('0x44')](db[_0x8e43('0x3f')]['rawAttributes']);_0x89e56[_0x8e43('0x43')]=_['keys'](_0x41af69[_0x8e43('0x43')]);_0x89e56['filters']=_[_0x8e43('0x47')](_0x89e56[_0x8e43('0x42')],_0x89e56['query']);_0x4ee545['attributes']=_[_0x8e43('0x47')](_0x89e56[_0x8e43('0x42')],qs[_0x8e43('0x48')](_0x41af69[_0x8e43('0x43')]['fields']));_0x4ee545[_0x8e43('0x46')]=_0x4ee545[_0x8e43('0x46')][_0x8e43('0x49')]?_0x4ee545['attributes']:_0x89e56[_0x8e43('0x42')];if(_0x41af69['query']['includeAll']){_0x4ee545[_0x8e43('0x52')]=[{'all':!![]}];}_0x4ee545=_[_0x8e43('0x4f')]({},_0x4ee545,_0x41af69[_0x8e43('0x50')]);return db[_0x8e43('0x3f')][_0x8e43('0x38')](_0x4ee545)['then'](handleEntityNotFound(_0x33854b,null))[_0x8e43('0x2d')](respondWithResult(_0x33854b,null))[_0x8e43('0x54')](handleError(_0x33854b,null));};exports[_0x8e43('0x2e')]=function(_0x18b0a5,_0x1cb6c6){return db['VoiceExtension'][_0x8e43('0x38')]({'where':{'id':_0x18b0a5['params']['id']}})[_0x8e43('0x2d')](handleEntityNotFound(_0x1cb6c6,null))[_0x8e43('0x2d')](removeEntity(_0x1cb6c6,null))[_0x8e43('0x54')](handleError(_0x1cb6c6,null));};exports['create']=function(_0x596d45,_0x66087a){if(_0x596d45[_0x8e43('0x56')][_0x8e43('0x37')]===_0x8e43('0x31')&&!_['startsWith'](_0x596d45[_0x8e43('0x56')][_0x8e43('0x57')],'_')){_0x596d45[_0x8e43('0x56')][_0x8e43('0x57')]='_'[_0x8e43('0x58')](_0x596d45[_0x8e43('0x56')]['exten']);}return db[_0x8e43('0x3f')][_0x8e43('0x59')](_0x596d45[_0x8e43('0x56')],{'raw':![]})['then'](function(_0xcf99b1){var _0x491197=_0x596d45['user']['get']({'plain':!![]});if(!_0x491197)throw new Error(_0x8e43('0x5a'));if(_0x491197[_0x8e43('0x5b')]===_0x8e43('0x5c')){var _0x5bfc66=_0xcf99b1['get']({'plain':!![]});var _0x1db4a6=[{'name':_0x8e43('0x30'),'value':_0x8e43('0x5d')},{'name':_0x8e43('0x5e'),'value':'outbound'},{'name':_0x8e43('0x5f'),'value':_0x8e43('0x60')}];var _0x2a2a13=_[_0x8e43('0x38')](_0x1db4a6,[_0x8e43('0x35'),_0x5bfc66['type']])[_0x8e43('0x39')];return db[_0x8e43('0x61')]['find']({'where':{'name':_0x2a2a13,'userProfileId':_0x491197[_0x8e43('0x62')]},'raw':!![]})[_0x8e43('0x2d')](function(_0x418e66){if(_0x418e66&&_0x418e66[_0x8e43('0x63')]===0x0){return db['UserProfileResource'][_0x8e43('0x59')]({'name':_0x5bfc66[_0x8e43('0x39')],'resourceId':_0x5bfc66['id'],'type':_0x418e66[_0x8e43('0x39')],'sectionId':_0x418e66['id']},{})[_0x8e43('0x2d')](function(){return _0xcf99b1;});}else{return _0xcf99b1;}})[_0x8e43('0x54')](function(_0x1547a2){logger[_0x8e43('0x3b')](_0x8e43('0x64'),_0x1547a2);throw _0x1547a2;});}return _0xcf99b1;})[_0x8e43('0x2d')](respondWithResult(_0x66087a,0xc9))['catch'](handleError(_0x66087a,null));};exports[_0x8e43('0x2c')]=function(_0x30c973,_0x37ca29){if(_0x30c973[_0x8e43('0x56')]['id']){delete _0x30c973[_0x8e43('0x56')]['id'];}return db[_0x8e43('0x3f')][_0x8e43('0x38')]({'where':{'id':_0x30c973['params']['id']}})[_0x8e43('0x2d')](handleEntityNotFound(_0x37ca29,null))[_0x8e43('0x2d')](function(_0x1fe380){if(_0x1fe380){return db[_0x8e43('0x3f')][_0x8e43('0x2c')](_['pick'](_0x30c973[_0x8e43('0x56')],[_0x8e43('0x57'),_0x8e43('0x65'),_0x8e43('0x66'),_0x8e43('0x67'),_0x8e43('0x68'),_0x8e43('0x69'),_0x8e43('0x6a')]),{'where':{'context':_0x1fe380[_0x8e43('0x65')],'exten':_0x1fe380[_0x8e43('0x57')]},'individualHooks':!![]})['then'](function(_0x41a703){return _0x41a703;});}return null;})[_0x8e43('0x2d')](respondWithStatusCode(_0x37ca29,null))[_0x8e43('0x54')](handleError(_0x37ca29,null));};exports[_0x8e43('0x6b')]=function(_0x4865e1,_0x39445a){return db['VoiceExtension'][_0x8e43('0x6c')]({'where':{'id':_0x4865e1['params']['id']}})['then'](function(_0x10c196){if(_0x10c196){return db[_0x8e43('0x6d')][_0x8e43('0x6e')](function(_0x55de1f){return db[_0x8e43('0x3f')]['destroy']({'where':{'VoiceExtensionId':_0x4865e1[_0x8e43('0x6f')]['id']},'transaction':_0x55de1f})[_0x8e43('0x2d')](function(){var _0x5dba7a=_[_0x8e43('0x34')](_0x4865e1[_0x8e43('0x56')],function(_0x5ae102){_0x5ae102[_0x8e43('0x70')]=_0x4865e1[_0x8e43('0x6f')]['id'];_0x5ae102[_0x8e43('0x71')]=!![];return _0x5ae102;});var _0x44e3d0=_0x4865e1['query'][_0x8e43('0x72')]&&_0x4865e1[_0x8e43('0x43')]['rewriteDial'][_0x8e43('0x73')]()===_0x8e43('0x74')?!![]:![];return _0x10c196[_0x8e43('0x75')](_0x5dba7a,_0x44e3d0);})['then'](function(_0x4b7656){return db[_0x8e43('0x3f')][_0x8e43('0x76')](_0x4b7656,{'transaction':_0x55de1f});});})[_0x8e43('0x2d')](function(){return db[_0x8e43('0x3f')][_0x8e43('0x77')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4865e1[_0x8e43('0x6f')]['id']},'order':_0x8e43('0x78')});});}})['then'](respondWithResult(_0x39445a,null))[_0x8e43('0x54')](handleError(_0x39445a,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4207204..b0fcecb 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 _0x69dc=['remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners','save'];(function(_0x4532ea,_0x368395){var _0x130d42=function(_0x456620){while(--_0x456620){_0x4532ea['push'](_0x4532ea['shift']());}};_0x130d42(++_0x368395);}(_0x69dc,0x188));var _0xc69d=function(_0x216d38,_0x255d54){_0x216d38=_0x216d38-0x0;var _0x53cf11=_0x69dc[_0x216d38];return _0x53cf11;};'use strict';var EventEmitter=require(_0xc69d('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xc69d('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc69d('0x2')](0x0);var events={'afterCreate':_0xc69d('0x3'),'afterUpdate':'update','afterDestroy':_0xc69d('0x4')};function emitEvent(_0x914d7f){return function(_0x29a548,_0x3968dd,_0x5b99c4){VoiceExtensionEvents[_0xc69d('0x5')](_0x914d7f+':'+_0x29a548['id'],_0x29a548);VoiceExtensionEvents[_0xc69d('0x5')](_0x914d7f,_0x29a548);_0x5b99c4(null);};}for(var e in events){if(events[_0xc69d('0x6')](e)){var event=events[e];VoiceExtension[_0xc69d('0x7')](e,emitEvent(event));}}module[_0xc69d('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb2e7=['remove','VoiceExtension','setMaxListeners','save','update'];(function(_0x50a8ca,_0x43aa15){var _0x2ef4d4=function(_0x359a8a){while(--_0x359a8a){_0x50a8ca['push'](_0x50a8ca['shift']());}};_0x2ef4d4(++_0x43aa15);}(_0xb2e7,0xab));var _0x7b2e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb2e7[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x7b2e('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7b2e('0x1')](0x0);var events={'afterCreate':_0x7b2e('0x2'),'afterUpdate':_0x7b2e('0x3'),'afterDestroy':_0x7b2e('0x4')};function emitEvent(_0x20773c){return function(_0x1e1045,_0x3e2987,_0x3958b8){VoiceExtensionEvents['emit'](_0x20773c+':'+_0x1e1045['id'],_0x1e1045);VoiceExtensionEvents['emit'](_0x20773c,_0x1e1045);_0x3958b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index fd84b84..95e9210 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 _0x2cb5=['intervals','map','tag','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','priority','last','catch','define','VoiceExtension','voice_extensions','then','concat','Hangup','lodash','./voiceExtension.attributes','exports','type','CDR(type)=','context','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','length','name','param','split','phone','prefix','SIP','options','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','findAll','interval','IntervalId','*,*,*,*'];(function(_0x239376,_0x1b1948){var _0xa95e5e=function(_0x242e3f){while(--_0x242e3f){_0x239376['push'](_0x239376['shift']());}};_0xa95e5e(++_0x1b1948);}(_0x2cb5,0x15b));var _0x52cb=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x2cb5[_0x5c9307];return _0x373e29;};'use strict';var util=require('util');var _=require(_0x52cb('0x0'));var attributes=require(_0x52cb('0x1'));module[_0x52cb('0x2')]=function(_0x189df5){var _0x498888=_0x189df5['models'];function _0x335ed0(_0x5429bf){var _0x138d86=0x2;var _0x3c6729=[{'type':_0x5429bf[_0x52cb('0x3')],'app':'Set','appdata':_0x52cb('0x4')+_0x5429bf['type'],'context':_0x5429bf[_0x52cb('0x5')],'exten':_0x5429bf['exten'],'priority':_0x138d86++,'VoiceExtensionId':_0x5429bf['id']},{'type':_0x5429bf[_0x52cb('0x3')],'app':_0x5429bf[_0x52cb('0x6')]?'Set':'NoOp','appdata':_0x5429bf['alias']?_0x52cb('0x7')+_0x5429bf[_0x52cb('0x6')]:_0x52cb('0x8'),'context':_0x5429bf[_0x52cb('0x5')],'exten':_0x5429bf[_0x52cb('0x9')],'priority':_0x138d86++,'VoiceExtensionId':_0x5429bf['id']}];if(_0x5429bf[_0x52cb('0x3')]===_0x52cb('0xa')){_0x3c6729[_0x52cb('0xb')]({'type':'inbound','app':_0x52cb('0xc'),'appdata':_0x52cb('0xd')+_0x5429bf['id'],'context':_0x5429bf['context'],'exten':_0x5429bf[_0x52cb('0x9')],'priority':_0x138d86++,'VoiceExtensionId':_0x5429bf['id']});}_0x3c6729[_0x52cb('0xb')]({'type':_0x5429bf[_0x52cb('0x3')],'app':'Set','appdata':_0x52cb('0xe'),'context':_0x5429bf[_0x52cb('0x5')],'exten':_0x5429bf[_0x52cb('0x9')],'priority':_0x138d86++,'VoiceExtensionId':_0x5429bf['id']},{'type':_0x5429bf['type'],'app':_0x52cb('0xc'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5429bf[_0x52cb('0x5')],'exten':_0x5429bf[_0x52cb('0x9')],'priority':_0x138d86++,'VoiceExtensionId':_0x5429bf['id']},{'type':_0x5429bf['type'],'app':_0x52cb('0xc'),'appdata':_0x52cb('0xf'),'context':_0x5429bf[_0x52cb('0x5')],'exten':_0x5429bf['exten'],'priority':_0x138d86++,'VoiceExtensionId':_0x5429bf['id']});return _0x3c6729;}function _0x171c71(_0x14204d){var _0x278f78=0x2;var _0x4c3bd0=[{'type':_0x52cb('0x10'),'app':_0x52cb('0xc'),'appdata':_0x52cb('0x11'),'context':_0x14204d[_0x52cb('0x5')],'exten':_0x14204d['exten'],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':'outbound','app':_0x14204d[_0x52cb('0x6')]?_0x52cb('0xc'):_0x52cb('0x12'),'appdata':_0x14204d[_0x52cb('0x6')]?_0x52cb('0x7')+_0x14204d[_0x52cb('0x6')]:_0x52cb('0x8'),'context':_0x14204d['context'],'exten':_0x14204d[_0x52cb('0x9')],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':'outbound','app':_0x52cb('0xc'),'appdata':_0x52cb('0x13')+(_0x14204d[_0x52cb('0x14')]?_0x52cb('0x15')+_0x14204d[_0x52cb('0x14')]+'}':_0x52cb('0x16')),'context':_0x14204d[_0x52cb('0x5')],'exten':_0x14204d[_0x52cb('0x9')],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':_0x52cb('0x10'),'app':_0x52cb('0xc'),'appdata':_0x52cb('0xd')+_0x14204d['id'],'context':_0x14204d[_0x52cb('0x5')],'exten':_0x14204d['exten'],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':_0x52cb('0x10'),'app':_0x52cb('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x278f78+0x2)+_0x52cb('0x18')+(_0x278f78+0x1)+')','context':_0x14204d[_0x52cb('0x5')],'exten':_0x14204d[_0x52cb('0x9')],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':_0x52cb('0x10'),'app':_0x52cb('0xc'),'appdata':_0x14204d[_0x52cb('0x14')]?_0x52cb('0x19')+_0x14204d[_0x52cb('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x14204d['context'],'exten':_0x14204d['exten'],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':_0x52cb('0x10'),'app':_0x52cb('0xc'),'appdata':_0x52cb('0xe'),'context':_0x14204d[_0x52cb('0x5')],'exten':_0x14204d['exten'],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':_0x52cb('0x10'),'app':_0x52cb('0xc'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x14204d[_0x52cb('0x5')],'exten':_0x14204d['exten'],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':_0x52cb('0x10'),'app':'Set','appdata':_0x52cb('0xf'),'context':_0x14204d['context'],'exten':_0x14204d['exten'],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':_0x52cb('0x10'),'app':_0x52cb('0xc'),'appdata':_0x52cb('0x1a')+_0x14204d['id'],'context':_0x14204d['context'],'exten':_0x14204d[_0x52cb('0x9')],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']}];if(_0x14204d[_0x52cb('0x1b')](_0x52cb('0x1c'))&&_0x14204d[_0x52cb('0x1c')]!==_0x52cb('0x1d')){_0x4c3bd0[_0x52cb('0xb')]({'type':_0x52cb('0x10'),'app':'Set','appdata':_0x52cb('0x1e'),'context':_0x14204d[_0x52cb('0x5')],'exten':_0x14204d['exten'],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']},{'type':_0x52cb('0x10'),'app':_0x52cb('0xc'),'appdata':_0x52cb('0x1f')+_0x14204d[_0x52cb('0x1c')]||_0x52cb('0x20'),'context':_0x14204d[_0x52cb('0x5')],'exten':_0x14204d[_0x52cb('0x9')],'priority':_0x278f78++,'VoiceExtensionId':_0x14204d['id']});}return _0x4c3bd0;}function _0x5a186c(_0x384436){var _0x1e8d1b=[{'name':_0x52cb('0x21'),'param':0x0},{'name':_0x52cb('0x22'),'param':0x1},{'name':'options','param':0x2},{'name':_0x52cb('0x23'),'param':0x3}];var _0x476916={};var _0x179720=_0x384436['split'](',');var _0x1929db=[];for(var _0x5e946a=0x0;_0x5e946a<_0x1e8d1b[_0x52cb('0x24')];_0x5e946a++){switch(_0x1e8d1b[_0x5e946a][_0x52cb('0x25')]){case _0x52cb('0x21'):_0x476916[_0x52cb('0x21')]=_0x179720[_0x1e8d1b[_0x5e946a][_0x52cb('0x26')]][_0x52cb('0x27')]('/')[0x1];_0x476916[_0x52cb('0x28')]=_0x179720[_0x1e8d1b[_0x5e946a][_0x52cb('0x26')]][_0x52cb('0x27')]('/')[0x2];_0x476916[_0x52cb('0x29')]=_0x476916[_0x52cb('0x28')]?_0x476916['phone'][_0x52cb('0x27')]('$')[0x0]:undefined;_0x476916[_0x52cb('0x28')]=route[_0x52cb('0x14')]?(_0x476916[_0x52cb('0x29')]||'')+_0x52cb('0x15')+route[_0x52cb('0x14')]+'}':(_0x476916[_0x52cb('0x29')]||'')+_0x52cb('0x16');_0x1929db[_0x1e8d1b[_0x5e946a][_0x52cb('0x26')]]=[_0x52cb('0x2a'),_0x476916[_0x52cb('0x21')],_0x476916['phone']]['join']('/');break;case _0x52cb('0x2b'):_0x476916[_0x52cb('0x2b')]=_0x179720[_0x1e8d1b[_0x5e946a][_0x52cb('0x26')]];if(route[_0x52cb('0x1c')]!==_0x52cb('0x1d')){if(_0x476916[_0x52cb('0x2b')][_0x52cb('0x2c')](_0x52cb('0x2d'))<0x0){_0x476916[_0x52cb('0x2b')]+=_0x52cb('0x2d');}}else{_0x476916[_0x52cb('0x2b')]=_0x476916[_0x52cb('0x2b')][_0x52cb('0x2e')]('U(xcally-mixmonitor-context)','');}_0x1929db[_0x1e8d1b[_0x5e946a][_0x52cb('0x26')]]=_0x476916['options'];break;default:_0x1929db[_0x1e8d1b[_0x5e946a]['param']]=_0x179720[_0x1e8d1b[_0x5e946a][_0x52cb('0x26')]];}}return _0x1929db[_0x52cb('0x2f')](',');}function _0x13ce05(_0x54e655,_0x12559b,_0x3c8e77,_0xb47a06){return new Promise(function(_0x4cf178,_0xd20343){var _0x285179=[];if(_[_0x52cb('0x30')](_0x12559b))return _0x4cf178(_0x285179);_0x498888['Interval'][_0x52cb('0x31')]({'attributes':['id',_0x52cb('0x32'),_0x52cb('0x33')],'raw':!![]})['then'](function(_0x80a392){for(var _0x4b2245=0x0,_0x5a0d72=0x0;_0x4b2245<_0x12559b[_0x52cb('0x24')];_0x4b2245++,_0x5a0d72=0x0){var _0x2dcddd=_0x12559b[_0x4b2245];var _0x50c68c=[];var _0x49f92f=[];if(_0x2dcddd[_0x52cb('0x32')]!==_0x52cb('0x34')){_0x2dcddd['intervals']=[_0x2dcddd[_0x52cb('0x32')]];}else{_0x2dcddd[_0x52cb('0x35')]=_0x2dcddd[_0x52cb('0x33')]?_[_0x52cb('0x36')](_['filter'](_0x80a392,{'IntervalId':_0x2dcddd[_0x52cb('0x33')]}),_0x52cb('0x32')):[];}_0x2dcddd[_0x52cb('0x5')]=_0x54e655[_0x52cb('0x5')];_0x2dcddd[_0x52cb('0x9')]=_0x54e655[_0x52cb('0x9')];if(_0x2dcddd['type'])_0x2dcddd[_0x52cb('0x3')]=_0x2dcddd[_0x52cb('0x3')]['toLowerCase']();if(_0x54e655[_0x52cb('0x3')]==='outbound'){if(_0x2dcddd['hasOwnProperty'](_0x52cb('0x37'))&&_0x2dcddd['tag']&&_0x2dcddd[_0x52cb('0x37')]!=='--'){_0x50c68c[_0x52cb('0xb')]({'type':_0x2dcddd[_0x52cb('0x3')]['toLowerCase'](),'app':'Set','appdata':'CDR(tag)='+_0x2dcddd[_0x52cb('0x37')],'context':_0x54e655[_0x52cb('0x5')],'exten':_0x54e655[_0x52cb('0x9')],'priority':_0x2dcddd['intervals'][_0x52cb('0x24')]+_0x3c8e77+_0x5a0d72++,'VoiceExtensionId':_0x54e655['id']});}_0x50c68c['push']({'type':_0x2dcddd['type'][_0x52cb('0x38')](),'app':_0x52cb('0x17'),'appdata':_0x52cb('0x39')+(_0x2dcddd[_0x52cb('0x3a')]?'Set(CALLERID(all)='+_0x2dcddd[_0x52cb('0x3a')]+')':_0x52cb('0x3b')),'context':_0x54e655[_0x52cb('0x5')],'exten':_0x54e655[_0x52cb('0x9')],'priority':_0x2dcddd['intervals'][_0x52cb('0x24')]+_0x3c8e77+_0x5a0d72++,'VoiceExtensionId':_0x54e655['id']});}else{if(_0x2dcddd[_0x52cb('0x1b')](_0x52cb('0x3c'))){if([_0x52cb('0x3d'),_0x52cb('0x3e')][_0x52cb('0x3f')](_0x2dcddd[_0x52cb('0x40')]['toLowerCase']())&&_0x2dcddd[_0x52cb('0x41')]!==_0x52cb('0x42')){if(_0x2dcddd[_0x52cb('0x3c')]){_0x50c68c[_0x52cb('0xb')]({'type':_0x2dcddd[_0x52cb('0x3')][_0x52cb('0x38')](),'app':_0x52cb('0x17'),'appdata':_0x52cb('0x43'),'context':_0x54e655[_0x52cb('0x5')],'exten':_0x54e655[_0x52cb('0x9')],'priority':_0x2dcddd[_0x52cb('0x35')][_0x52cb('0x24')]+_0x3c8e77+_0x5a0d72++,'VoiceExtensionId':_0x54e655['id']});_0x50c68c[_0x52cb('0xb')]({'type':_0x2dcddd[_0x52cb('0x3')][_0x52cb('0x38')](),'app':_0x52cb('0xc'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x54e655['context'],'exten':_0x54e655[_0x52cb('0x9')],'priority':_0x2dcddd['intervals']['length']+_0x3c8e77+_0x5a0d72++,'VoiceExtensionId':_0x54e655['id']});}else{_0x50c68c[_0x52cb('0xb')]({'type':_0x2dcddd[_0x52cb('0x3')][_0x52cb('0x38')](),'app':_0x52cb('0x17'),'appdata':_0x52cb('0x44'),'context':_0x54e655[_0x52cb('0x5')],'exten':_0x54e655[_0x52cb('0x9')],'priority':_0x2dcddd[_0x52cb('0x35')][_0x52cb('0x24')]+_0x3c8e77+_0x5a0d72++,'VoiceExtensionId':_0x54e655['id']});_0x50c68c[_0x52cb('0xb')]({'type':_0x2dcddd[_0x52cb('0x3')][_0x52cb('0x38')](),'app':_0x52cb('0xc'),'appdata':_0x52cb('0x45'),'context':_0x54e655[_0x52cb('0x5')],'exten':_0x54e655[_0x52cb('0x9')],'priority':_0x2dcddd['intervals'][_0x52cb('0x24')]+_0x3c8e77+_0x5a0d72++,'VoiceExtensionId':_0x54e655['id']});}}}}for(var _0x1aca54=0x0;_0x1aca54<_0x2dcddd[_0x52cb('0x35')]['length'];_0x1aca54++){var _0x198c79=_0x3c8e77+_0x2dcddd[_0x52cb('0x35')][_0x52cb('0x24')];var _0x348db8=_0x1aca54===_0x2dcddd[_0x52cb('0x35')]['length']-0x1?_0x3c8e77+_0x50c68c['length']+_0x49f92f[_0x52cb('0x24')]+0x2:_0x3c8e77+_0x1aca54+0x1;_0x50c68c['splice'](_0x1aca54,0x0,{'type':_0x54e655['type'],'app':'GotoIfTime','appdata':_0x2dcddd[_0x52cb('0x35')][_0x1aca54]+'?'+_0x54e655['context']+_0x52cb('0x46')+_0x198c79+':'+_0x54e655[_0x52cb('0x5')]+_0x52cb('0x46')+_0x348db8,'exten':_0x54e655[_0x52cb('0x9')],'context':_0x54e655[_0x52cb('0x5')],'priority':_0x3c8e77+_0x1aca54,'VoiceExtensionId':_0x54e655['id']});}if(_0xb47a06&&_0x2dcddd['appType']==='outboundDial')_0x2dcddd['appdata']=_0x5a186c(_0x2dcddd['appdata']);_0x2dcddd[_0x52cb('0x47')]=_0x50c68c[_0x52cb('0x24')]?_['last'](_0x50c68c)[_0x52cb('0x47')]+0x1:_0x3c8e77;_0x285179=_['concat'](_0x285179,_0x50c68c,[_0x2dcddd],_0x49f92f);_0x3c8e77=_[_0x52cb('0x48')](_0x285179)['priority']+0x1;}return _0x4cf178(_0x285179);})[_0x52cb('0x49')](function(_0xdeff1e){_0xd20343(_0xdeff1e);});});}return _0x189df5[_0x52cb('0x4a')](_0x52cb('0x4b'),attributes,{'tableName':_0x52cb('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3469b3,_0x261a08){var _0x2f6983=this;var _0x396222=_0x2f6983[_0x52cb('0x3')]==='outbound'?_0x171c71(_0x2f6983):_0x335ed0(_0x2f6983);return _0x13ce05(_0x2f6983,_0x3469b3,_[_0x52cb('0x48')](_0x396222)[_0x52cb('0x47')]+0x1,_0x261a08)[_0x52cb('0x4d')](function(_0x3e9aef){var _0xc40776=_[_0x52cb('0x4e')](_0x396222,_0x3e9aef);_0xc40776[_0x52cb('0xb')]({'type':_0x2f6983[_0x52cb('0x3')],'app':_0x52cb('0x4f'),'exten':_0x2f6983[_0x52cb('0x9')],'context':_0x2f6983[_0x52cb('0x5')],'priority':_['last'](_0xc40776)[_0x52cb('0x47')]+0x1,'VoiceExtensionId':_0x2f6983['id']});return _0xc40776;});}}});}; \ No newline at end of file +var _0xd2ee=['context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','SIP','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','then','Hangup','util','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2ee,0x1df));var _0xed2e=function(_0x3c6827,_0x175507){_0x3c6827=_0x3c6827-0x0;var _0x95cf59=_0xd2ee[_0x3c6827];return _0x95cf59;};'use strict';var util=require(_0xed2e('0x0'));var _=require(_0xed2e('0x1'));var attributes=require(_0xed2e('0x2'));module[_0xed2e('0x3')]=function(_0x1054c1){var _0x49453c=_0x1054c1[_0xed2e('0x4')];function _0x1d6d86(_0x350eca){var _0x279061=0x2;var _0x376909=[{'type':_0x350eca[_0xed2e('0x5')],'app':_0xed2e('0x6'),'appdata':_0xed2e('0x7')+_0x350eca[_0xed2e('0x5')],'context':_0x350eca['context'],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']},{'type':_0x350eca[_0xed2e('0x5')],'app':_0x350eca[_0xed2e('0x9')]?_0xed2e('0x6'):_0xed2e('0xa'),'appdata':_0x350eca['alias']?_0xed2e('0xb')+_0x350eca['alias']:_0xed2e('0xc'),'context':_0x350eca[_0xed2e('0xd')],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']}];if(_0x350eca[_0xed2e('0x5')]===_0xed2e('0xe')){_0x376909[_0xed2e('0xf')]({'type':_0xed2e('0xe'),'app':'Set','appdata':_0xed2e('0x10')+_0x350eca['id'],'context':_0x350eca[_0xed2e('0xd')],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']});}_0x376909[_0xed2e('0xf')]({'type':_0x350eca[_0xed2e('0x5')],'app':'Set','appdata':_0xed2e('0x11'),'context':_0x350eca['context'],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']},{'type':_0x350eca[_0xed2e('0x5')],'app':'Set','appdata':_0xed2e('0x12'),'context':_0x350eca[_0xed2e('0xd')],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']},{'type':_0x350eca[_0xed2e('0x5')],'app':_0xed2e('0x6'),'appdata':_0xed2e('0x13'),'context':_0x350eca['context'],'exten':_0x350eca[_0xed2e('0x8')],'priority':_0x279061++,'VoiceExtensionId':_0x350eca['id']});return _0x376909;}function _0x381106(_0x147cba){var _0x3e99a3=0x2;var _0x32594f=[{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':'CDR(type)=outbound','context':_0x147cba['context'],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0x147cba['alias']?_0xed2e('0x6'):_0xed2e('0xa'),'appdata':_0x147cba['alias']?_0xed2e('0xb')+_0x147cba[_0xed2e('0x9')]:_0xed2e('0xc'),'context':_0x147cba['context'],'exten':_0x147cba['exten'],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':_0xed2e('0x15')+(_0x147cba[_0xed2e('0x16')]?'${EXTEN:'+_0x147cba['cutdigits']+'}':_0xed2e('0x17')),'context':_0x147cba['context'],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':'CDR(routeid)='+_0x147cba['id'],'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':'outbound','app':'ExecIf','appdata':_0xed2e('0x18')+(_0x3e99a3+0x2)+'):Goto('+(_0x3e99a3+0x1)+')','context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':'Set','appdata':_0x147cba[_0xed2e('0x16')]?_0xed2e('0x19')+_0x147cba[_0xed2e('0x16')]+'}':'CDR(prefix)=noprefix','context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':'Set','appdata':_0xed2e('0x11'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':'Set','appdata':_0xed2e('0x12'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':'Set','appdata':_0xed2e('0x13'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':_0xed2e('0x1a')+_0x147cba['id'],'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']}];if(_0x147cba[_0xed2e('0x1b')]('recordingFormat')&&_0x147cba[_0xed2e('0x1c')]!==_0xed2e('0x1d')){_0x32594f[_0xed2e('0xf')]({'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':_0xed2e('0x1e'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']},{'type':_0xed2e('0x14'),'app':_0xed2e('0x6'),'appdata':_0xed2e('0x1f')+_0x147cba[_0xed2e('0x1c')]||_0xed2e('0x20'),'context':_0x147cba[_0xed2e('0xd')],'exten':_0x147cba[_0xed2e('0x8')],'priority':_0x3e99a3++,'VoiceExtensionId':_0x147cba['id']});}return _0x32594f;}function _0x4b3d2d(_0xb93f42){var _0x41a0ac=[{'name':_0xed2e('0x21'),'param':0x0},{'name':_0xed2e('0x22'),'param':0x1},{'name':_0xed2e('0x23'),'param':0x2},{'name':'url','param':0x3}];var _0x45f7a8={};var _0x92826c=_0xb93f42[_0xed2e('0x24')](',');var _0x2cee8f=[];for(var _0xd5ca5b=0x0;_0xd5ca5b<_0x41a0ac[_0xed2e('0x25')];_0xd5ca5b++){switch(_0x41a0ac[_0xd5ca5b][_0xed2e('0x26')]){case _0xed2e('0x21'):_0x45f7a8[_0xed2e('0x21')]=_0x92826c[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]][_0xed2e('0x24')]('/')[0x1];_0x45f7a8[_0xed2e('0x28')]=_0x92826c[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]][_0xed2e('0x24')]('/')[0x2];_0x45f7a8[_0xed2e('0x29')]=_0x45f7a8['phone']?_0x45f7a8[_0xed2e('0x28')][_0xed2e('0x24')]('$')[0x0]:undefined;_0x45f7a8['phone']=route[_0xed2e('0x16')]?(_0x45f7a8['prefix']||'')+'${EXTEN:'+route[_0xed2e('0x16')]+'}':(_0x45f7a8['prefix']||'')+_0xed2e('0x17');_0x2cee8f[_0x41a0ac[_0xd5ca5b]['param']]=[_0xed2e('0x2a'),_0x45f7a8[_0xed2e('0x21')],_0x45f7a8[_0xed2e('0x28')]]['join']('/');break;case _0xed2e('0x23'):_0x45f7a8[_0xed2e('0x23')]=_0x92826c[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]];if(route[_0xed2e('0x1c')]!==_0xed2e('0x1d')){if(_0x45f7a8[_0xed2e('0x23')]['indexOf'](_0xed2e('0x2b'))<0x0){_0x45f7a8[_0xed2e('0x23')]+=_0xed2e('0x2b');}}else{_0x45f7a8[_0xed2e('0x23')]=_0x45f7a8['options'][_0xed2e('0x2c')](_0xed2e('0x2b'),'');}_0x2cee8f[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]]=_0x45f7a8[_0xed2e('0x23')];break;default:_0x2cee8f[_0x41a0ac[_0xd5ca5b][_0xed2e('0x27')]]=_0x92826c[_0x41a0ac[_0xd5ca5b]['param']];}}return _0x2cee8f['join'](',');}function _0xcc8579(_0x47ef28,_0x1c0f46,_0x273deb,_0x58a482){return new Promise(function(_0x1c17c0,_0x44e612){var _0x309293=[];if(_[_0xed2e('0x2d')](_0x1c0f46))return _0x1c17c0(_0x309293);_0x49453c[_0xed2e('0x2e')]['findAll']({'attributes':['id',_0xed2e('0x2f'),_0xed2e('0x30')],'raw':!![]})['then'](function(_0x1c3894){for(var _0x3da1d9=0x0,_0x3568b0=0x0;_0x3da1d9<_0x1c0f46[_0xed2e('0x25')];_0x3da1d9++,_0x3568b0=0x0){var _0xed8c22=_0x1c0f46[_0x3da1d9];var _0x5cda7b=[];var _0x1aee49=[];if(_0xed8c22[_0xed2e('0x2f')]!==_0xed2e('0x31')){_0xed8c22[_0xed2e('0x32')]=[_0xed8c22['interval']];}else{_0xed8c22[_0xed2e('0x32')]=_0xed8c22[_0xed2e('0x30')]?_[_0xed2e('0x33')](_['filter'](_0x1c3894,{'IntervalId':_0xed8c22[_0xed2e('0x30')]}),_0xed2e('0x2f')):[];}_0xed8c22[_0xed2e('0xd')]=_0x47ef28[_0xed2e('0xd')];_0xed8c22[_0xed2e('0x8')]=_0x47ef28['exten'];if(_0xed8c22[_0xed2e('0x5')])_0xed8c22['type']=_0xed8c22[_0xed2e('0x5')][_0xed2e('0x34')]();if(_0x47ef28[_0xed2e('0x5')]===_0xed2e('0x14')){if(_0xed8c22[_0xed2e('0x1b')](_0xed2e('0x35'))&&_0xed8c22[_0xed2e('0x35')]&&_0xed8c22[_0xed2e('0x35')]!=='--'){_0x5cda7b['push']({'type':_0xed8c22[_0xed2e('0x5')]['toLowerCase'](),'app':'Set','appdata':_0xed2e('0x36')+_0xed8c22[_0xed2e('0x35')],'context':_0x47ef28['context'],'exten':_0x47ef28['exten'],'priority':_0xed8c22[_0xed2e('0x32')]['length']+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});}_0x5cda7b['push']({'type':_0xed8c22[_0xed2e('0x5')][_0xed2e('0x34')](),'app':_0xed2e('0x37'),'appdata':_0xed2e('0x38')+(_0xed8c22[_0xed2e('0x39')]?_0xed2e('0x3a')+_0xed8c22[_0xed2e('0x39')]+')':_0xed2e('0x3b')),'context':_0x47ef28[_0xed2e('0xd')],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22['intervals']['length']+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});}else{if(_0xed8c22[_0xed2e('0x1b')](_0xed2e('0x3c'))){if([_0xed2e('0x3d'),_0xed2e('0x3e')]['includes'](_0xed8c22[_0xed2e('0x3f')][_0xed2e('0x34')]())&&_0xed8c22['appType']!==_0xed2e('0x40')){if(_0xed8c22[_0xed2e('0x3c')]){_0x5cda7b[_0xed2e('0xf')]({'type':_0xed8c22['type'][_0xed2e('0x34')](),'app':_0xed2e('0x37'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x47ef28[_0xed2e('0xd')],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22['intervals'][_0xed2e('0x25')]+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});_0x5cda7b[_0xed2e('0xf')]({'type':_0xed8c22[_0xed2e('0x5')]['toLowerCase'](),'app':'Set','appdata':_0xed2e('0x41'),'context':_0x47ef28[_0xed2e('0xd')],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22['intervals']['length']+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});}else{_0x5cda7b[_0xed2e('0xf')]({'type':_0xed8c22[_0xed2e('0x5')]['toLowerCase'](),'app':'ExecIf','appdata':_0xed2e('0x42'),'context':_0x47ef28['context'],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22[_0xed2e('0x32')][_0xed2e('0x25')]+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});_0x5cda7b['push']({'type':_0xed8c22[_0xed2e('0x5')]['toLowerCase'](),'app':'Set','appdata':_0xed2e('0x43'),'context':_0x47ef28['context'],'exten':_0x47ef28[_0xed2e('0x8')],'priority':_0xed8c22['intervals']['length']+_0x273deb+_0x3568b0++,'VoiceExtensionId':_0x47ef28['id']});}}}}for(var _0x3d9390=0x0;_0x3d9390<_0xed8c22[_0xed2e('0x32')][_0xed2e('0x25')];_0x3d9390++){var _0x2c055e=_0x273deb+_0xed8c22[_0xed2e('0x32')][_0xed2e('0x25')];var _0x32c74b=_0x3d9390===_0xed8c22[_0xed2e('0x32')][_0xed2e('0x25')]-0x1?_0x273deb+_0x5cda7b[_0xed2e('0x25')]+_0x1aee49[_0xed2e('0x25')]+0x2:_0x273deb+_0x3d9390+0x1;_0x5cda7b['splice'](_0x3d9390,0x0,{'type':_0x47ef28[_0xed2e('0x5')],'app':_0xed2e('0x44'),'appdata':_0xed8c22['intervals'][_0x3d9390]+'?'+_0x47ef28['context']+_0xed2e('0x45')+_0x2c055e+':'+_0x47ef28[_0xed2e('0xd')]+_0xed2e('0x45')+_0x32c74b,'exten':_0x47ef28[_0xed2e('0x8')],'context':_0x47ef28[_0xed2e('0xd')],'priority':_0x273deb+_0x3d9390,'VoiceExtensionId':_0x47ef28['id']});}if(_0x58a482&&_0xed8c22[_0xed2e('0x46')]===_0xed2e('0x47'))_0xed8c22['appdata']=_0x4b3d2d(_0xed8c22[_0xed2e('0x48')]);_0xed8c22[_0xed2e('0x49')]=_0x5cda7b['length']?_[_0xed2e('0x4a')](_0x5cda7b)[_0xed2e('0x49')]+0x1:_0x273deb;_0x309293=_[_0xed2e('0x4b')](_0x309293,_0x5cda7b,[_0xed8c22],_0x1aee49);_0x273deb=_['last'](_0x309293)[_0xed2e('0x49')]+0x1;}return _0x1c17c0(_0x309293);})[_0xed2e('0x4c')](function(_0x294a0b){_0x44e612(_0x294a0b);});});}return _0x1054c1[_0xed2e('0x4d')](_0xed2e('0x4e'),attributes,{'tableName':_0xed2e('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x693673,_0x3f47e6){var _0x540e71=this;var _0x36ceac=_0x540e71[_0xed2e('0x5')]==='outbound'?_0x381106(_0x540e71):_0x1d6d86(_0x540e71);return _0xcc8579(_0x540e71,_0x693673,_[_0xed2e('0x4a')](_0x36ceac)[_0xed2e('0x49')]+0x1,_0x3f47e6)[_0xed2e('0x50')](function(_0x1ff560){var _0x173700=_[_0xed2e('0x4b')](_0x36ceac,_0x1ff560);_0x173700[_0xed2e('0xf')]({'type':_0x540e71[_0xed2e('0x5')],'app':_0xed2e('0x51'),'exten':_0x540e71[_0xed2e('0x8')],'context':_0x540e71['context'],'priority':_[_0xed2e('0x4a')](_0x173700)[_0xed2e('0x49')]+0x1,'VoiceExtensionId':_0x540e71['id']});return _0x173700;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 169e7fe..34c87ea 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 _0x5a9e=['message','result','catch','GetVoiceExtension','options','raw','where','attributes','limit','map','include','model','then','stringify','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x5a9e[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var util=require(_0xe5a9('0x0'));var moment=require(_0xe5a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5a9('0x2'));var db=require(_0xe5a9('0x3'))['db'];var utils=require(_0xe5a9('0x4'));var logger=require(_0xe5a9('0x5'))(_0xe5a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xe5a9('0x7'));var client=jayson['client'][_0xe5a9('0x8')]({'port':0x232a});config[_0xe5a9('0x9')]=_['defaults'](config['redis'],{'host':_0xe5a9('0xa'),'port':0x18eb});var socket=require(_0xe5a9('0xb'))(new Redis(config[_0xe5a9('0x9')]));require(_0xe5a9('0xc'))[_0xe5a9('0xd')](socket);function respondWithRpcPromise(_0x530b67,_0x579b84,_0x7ab4a9){return new BPromise(function(_0x523fda,_0x7ec4cf){return client['request'](_0x530b67,_0x7ab4a9)['then'](function(_0x563625){logger[_0xe5a9('0xe')](_0xe5a9('0xf'),_0x579b84,_0xe5a9('0x10'));logger[_0xe5a9('0x11')](_0xe5a9('0x12'),_0x579b84,_0xe5a9('0x10'),JSON['stringify'](_0x563625));if(_0x563625[_0xe5a9('0x13')]){if(_0x563625[_0xe5a9('0x13')][_0xe5a9('0x14')]===0x1f4){logger[_0xe5a9('0x13')](_0xe5a9('0xf'),_0x579b84,_0x563625[_0xe5a9('0x13')][_0xe5a9('0x15')]);return _0x7ec4cf(_0x563625['error'][_0xe5a9('0x15')]);}logger[_0xe5a9('0x13')](_0xe5a9('0xf'),_0x579b84,_0x563625['error']['message']);return _0x523fda(_0x563625[_0xe5a9('0x13')][_0xe5a9('0x15')]);}else{logger[_0xe5a9('0xe')](_0xe5a9('0xf'),_0x579b84,_0xe5a9('0x10'));_0x523fda(_0x563625[_0xe5a9('0x16')]['message']);}})[_0xe5a9('0x17')](function(_0x4bff6e){logger['error'](_0xe5a9('0xf'),_0x579b84,_0x4bff6e);_0x7ec4cf(_0x4bff6e);});});}exports[_0xe5a9('0x18')]=function(_0x2a86e1){var _0x1142d2=this;return new Promise(function(_0x2fc629,_0x17479d){return db['VoiceExtension']['findAll']({'raw':_0x2a86e1[_0xe5a9('0x19')]?_0x2a86e1[_0xe5a9('0x19')][_0xe5a9('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a86e1[_0xe5a9('0x19')]?_0x2a86e1[_0xe5a9('0x19')][_0xe5a9('0x1b')]||null:null,'attributes':_0x2a86e1['options']?_0x2a86e1[_0xe5a9('0x19')][_0xe5a9('0x1c')]||null:null,'limit':_0x2a86e1['options']?_0x2a86e1[_0xe5a9('0x19')][_0xe5a9('0x1d')]||null:null,'include':_0x2a86e1['options']?_0x2a86e1[_0xe5a9('0x19')]['include']?_[_0xe5a9('0x1e')](_0x2a86e1[_0xe5a9('0x19')][_0xe5a9('0x1f')],function(_0x45a4c4){return{'model':db[_0x45a4c4['model']],'as':_0x45a4c4['as'],'attributes':_0x45a4c4[_0xe5a9('0x1c')],'include':_0x45a4c4[_0xe5a9('0x1f')]?_[_0xe5a9('0x1e')](_0x45a4c4[_0xe5a9('0x1f')],function(_0x3dd3da){return{'model':db[_0x3dd3da[_0xe5a9('0x20')]],'as':_0x3dd3da['as'],'attributes':_0x3dd3da[_0xe5a9('0x1c')],'include':_0x3dd3da[_0xe5a9('0x1f')]?_[_0xe5a9('0x1e')](_0x3dd3da['include'],function(_0x34c0db){return{'model':db[_0x34c0db[_0xe5a9('0x20')]],'as':_0x34c0db['as'],'attributes':_0x34c0db['attributes']};}):[]};}):[]};}):[]:[]})[_0xe5a9('0x21')](function(_0x5e4266){logger[_0xe5a9('0xe')](_0xe5a9('0x18'),_0x2a86e1);logger[_0xe5a9('0x11')](_0xe5a9('0x18'),_0x2a86e1,JSON[_0xe5a9('0x22')](_0x5e4266));_0x2fc629(_0x5e4266);})[_0xe5a9('0x17')](function(_0x34b288){logger[_0xe5a9('0x13')](_0xe5a9('0x18'),_0x34b288[_0xe5a9('0x15')],_0x2a86e1);_0x17479d(_0x1142d2['error'](0x1f4,_0x34b288[_0xe5a9('0x15')]));});});}; \ No newline at end of file +var _0xa23f=['VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','info'];(function(_0x1dee5c,_0x39a692){var _0x172e13=function(_0x278d91){while(--_0x278d91){_0x1dee5c['push'](_0x1dee5c['shift']());}};_0x172e13(++_0x39a692);}(_0xa23f,0x7c));var _0xfa23=function(_0x5c05a8,_0x6d9a4){_0x5c05a8=_0x5c05a8-0x0;var _0x2f7551=_0xa23f[_0x5c05a8];return _0x2f7551;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa23('0x2'));var fs=require('fs');var Redis=require(_0xfa23('0x3'));var db=require(_0xfa23('0x4'))['db'];var utils=require(_0xfa23('0x5'));var logger=require('../../config/logger')(_0xfa23('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa23('0x7'));var client=jayson[_0xfa23('0x8')][_0xfa23('0x9')]({'port':0x232a});config[_0xfa23('0xa')]=_['defaults'](config[_0xfa23('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa23('0xb'))(new Redis(config[_0xfa23('0xa')]));require(_0xfa23('0xc'))[_0xfa23('0xd')](socket);function respondWithRpcPromise(_0x798943,_0x539453,_0x4b59d1){return new BPromise(function(_0x20a9b6,_0x4ea7a8){return client[_0xfa23('0xe')](_0x798943,_0x4b59d1)['then'](function(_0x1b99b7){logger[_0xfa23('0xf')](_0xfa23('0x10'),_0x539453,'request\x20sent');logger[_0xfa23('0x11')](_0xfa23('0x12'),_0x539453,_0xfa23('0x13'),JSON['stringify'](_0x1b99b7));if(_0x1b99b7['error']){if(_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x15')]===0x1f4){logger[_0xfa23('0x14')](_0xfa23('0x10'),_0x539453,_0x1b99b7['error'][_0xfa23('0x16')]);return _0x4ea7a8(_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x16')]);}logger[_0xfa23('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x539453,_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x16')]);return _0x20a9b6(_0x1b99b7[_0xfa23('0x14')][_0xfa23('0x16')]);}else{logger[_0xfa23('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x539453,'request\x20sent');_0x20a9b6(_0x1b99b7['result'][_0xfa23('0x16')]);}})[_0xfa23('0x17')](function(_0x4bd0e0){logger[_0xfa23('0x14')](_0xfa23('0x10'),_0x539453,_0x4bd0e0);_0x4ea7a8(_0x4bd0e0);});});}exports[_0xfa23('0x18')]=function(_0x54bb04){var _0x1970ec=this;return new Promise(function(_0x452604,_0x47c323){return db[_0xfa23('0x19')][_0xfa23('0x1a')]({'raw':_0x54bb04[_0xfa23('0x1b')]?_0x54bb04[_0xfa23('0x1b')][_0xfa23('0x1c')]===undefined?!![]:![]:!![],'where':_0x54bb04[_0xfa23('0x1b')]?_0x54bb04[_0xfa23('0x1b')]['where']||null:null,'attributes':_0x54bb04[_0xfa23('0x1b')]?_0x54bb04[_0xfa23('0x1b')][_0xfa23('0x1d')]||null:null,'limit':_0x54bb04[_0xfa23('0x1b')]?_0x54bb04['options'][_0xfa23('0x1e')]||null:null,'include':_0x54bb04['options']?_0x54bb04[_0xfa23('0x1b')][_0xfa23('0x1f')]?_[_0xfa23('0x20')](_0x54bb04[_0xfa23('0x1b')][_0xfa23('0x1f')],function(_0x1340d9){return{'model':db[_0x1340d9[_0xfa23('0x21')]],'as':_0x1340d9['as'],'attributes':_0x1340d9[_0xfa23('0x1d')],'include':_0x1340d9['include']?_[_0xfa23('0x20')](_0x1340d9['include'],function(_0x1ae38a){return{'model':db[_0x1ae38a['model']],'as':_0x1ae38a['as'],'attributes':_0x1ae38a['attributes'],'include':_0x1ae38a[_0xfa23('0x1f')]?_[_0xfa23('0x20')](_0x1ae38a[_0xfa23('0x1f')],function(_0x3b00a8){return{'model':db[_0x3b00a8[_0xfa23('0x21')]],'as':_0x3b00a8['as'],'attributes':_0x3b00a8[_0xfa23('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfa23('0x22')](function(_0x4c1ab0){logger[_0xfa23('0xf')]('GetVoiceExtension',_0x54bb04);logger[_0xfa23('0x11')](_0xfa23('0x18'),_0x54bb04,JSON['stringify'](_0x4c1ab0));_0x452604(_0x4c1ab0);})[_0xfa23('0x17')](function(_0x3a6966){logger[_0xfa23('0x14')](_0xfa23('0x18'),_0x3a6966[_0xfa23('0x16')],_0x54bb04);_0x47c323(_0x1970ec[_0xfa23('0x14')](0x1f4,_0x3a6966[_0xfa23('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 121b871..fa4cea3 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 _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x3d380c,_0x36379f){var _0x5eba43=function(_0x1bf236){while(--_0x1bf236){_0x3d380c['push'](_0x3d380c['shift']());}};_0x5eba43(++_0x36379f);}(_0x326f,0xd1));var _0xf326=function(_0x56f0aa,_0x29a21e){_0x56f0aa=_0x56f0aa-0x0;var _0x4228da=_0x326f[_0x56f0aa];return _0x4228da;};'use strict';var VoiceExtensionEvents=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(){VoiceExtensionEvents[_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('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1fe9cd,_0x21562c){var _0x3780af=function(_0x496277){while(--_0x496277){_0x1fe9cd['push'](_0x1fe9cd['shift']());}};_0x3780af(++_0x21562c);}(_0x53ec,0x192));var _0xc53e=function(_0x29f31c,_0x46bbdf){_0x29f31c=_0x29f31c-0x0;var _0x3b6b8a=_0x53ec[_0x29f31c];return _0x3b6b8a;};'use strict';var VoiceExtensionEvents=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(){VoiceExtensionEvents[_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);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index a6e069f..ce61b77 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 _0xafc4=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/messages','getMessages','post','update'];(function(_0x1787cb,_0x3f01e9){var _0x5d5291=function(_0x5f0a75){while(--_0x5f0a75){_0x1787cb['push'](_0x1787cb['shift']());}};_0x5d5291(++_0x3f01e9);}(_0xafc4,0x69));var _0x4afc=function(_0x2fc63f,_0x59f76f){_0x2fc63f=_0x2fc63f-0x0;var _0x4cf957=_0xafc4[_0x2fc63f];return _0x4cf957;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['show']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')]('/',auth[_0x4afc('0x7')](),controller['create']);router['put'](_0x4afc('0x9'),auth['isAuthenticated'](),controller[_0x4afc('0xd')]);router[_0x4afc('0xe')]('/:id',auth[_0x4afc('0x7')](),controller[_0x4afc('0xf')]);module[_0x4afc('0x10')]=router; \ No newline at end of file +var _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x4da7d4,_0x1c7e7a){var _0x1e1e2e=function(_0x4387f3){while(--_0x4387f3){_0x4da7d4['push'](_0x4da7d4['shift']());}};_0x1e1e2e(++_0x1c7e7a);}(_0x32f4,0x154));var _0x432f=function(_0x268ed2,_0x48d285){_0x268ed2=_0x268ed2-0x0;var _0x3a6b83=_0x32f4[_0x268ed2];return _0x3a6b83;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index fd8d77a..bb476d5 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 _0x5106=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','\x20-\x20'];(function(_0xc8f0e5,_0x47dfdb){var _0x260a34=function(_0x33d99d){while(--_0x33d99d){_0xc8f0e5['push'](_0xc8f0e5['shift']());}};_0x260a34(++_0x47dfdb);}(_0x5106,0x143));var _0x6510=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5106[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x6510('0x0'));module[_0x6510('0x1')]={'customer_id':{'type':Sequelize[_0x6510('0x2')]},'context':{'type':Sequelize[_0x6510('0x2')],'defaultValue':_0x6510('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x6510('0x2')],'defaultValue':'','allowNull':![],'unique':_0x6510('0x4')},'password':{'type':Sequelize[_0x6510('0x2')]},'fullname':{'type':Sequelize[_0x6510('0x2')]},'email':{'type':Sequelize[_0x6510('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2d0456){this[_0x6510('0x5')]('email',typeof _0x2d0456===_0x6510('0x6')&&_0x2d0456[_0x6510('0x7')]()?_0x2d0456['trim']():null);}},'pager':{'type':Sequelize[_0x6510('0x2')]},'tz':{'type':Sequelize[_0x6510('0x2')],'defaultValue':_0x6510('0x8')},'attach':{'type':Sequelize[_0x6510('0x9')](_0x6510('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x6510('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x6510('0x2')]},'callback':{'type':Sequelize[_0x6510('0x2')]},'review':{'type':Sequelize['ENUM'](_0x6510('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x6510('0x9')](_0x6510('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x6510('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x6510('0x9')](_0x6510('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x6510('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x6510('0x9')](_0x6510('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x6510('0x9')](_0x6510('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x6510('0x9')](_0x6510('0xa'),'no'),'defaultValue':_0x6510('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x6510('0x9')](_0x6510('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x6510('0x9')](_0x6510('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x6510('0x9')](_0x6510('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x6510('0xc')},'emailsubject':{'type':Sequelize[_0x6510('0x2')]},'emailbody':{'type':Sequelize[_0x6510('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x6510('0xd')],'get':function(){return this[_0x6510('0xe')](_0x6510('0xf'))+_0x6510('0x10')+this[_0x6510('0xe')]('mailbox');}}}; \ No newline at end of file +var _0xeff9=['ENUM','yes','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','trim','central'];(function(_0x1d34ba,_0x2762d0){var _0x379c90=function(_0x4cdfee){while(--_0x4cdfee){_0x1d34ba['push'](_0x1d34ba['shift']());}};_0x379c90(++_0x2762d0);}(_0xeff9,0x1b5));var _0x9eff=function(_0x315429,_0x549e5b){_0x315429=_0x315429-0x0;var _0x37fe6b=_0xeff9[_0x315429];return _0x37fe6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x9eff('0x0')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x9eff('0x1'),'unique':_0x9eff('0x2')},'mailbox':{'type':Sequelize[_0x9eff('0x0')],'defaultValue':'','allowNull':![],'unique':_0x9eff('0x2')},'password':{'type':Sequelize[_0x9eff('0x0')]},'fullname':{'type':Sequelize[_0x9eff('0x0')]},'email':{'type':Sequelize[_0x9eff('0x0')],'validate':{'isEmail':!![]},'set':function(_0x236041){this['setDataValue']('email',typeof _0x236041==='string'&&_0x236041[_0x9eff('0x3')]()?_0x236041[_0x9eff('0x3')]():null);}},'pager':{'type':Sequelize[_0x9eff('0x0')]},'tz':{'type':Sequelize[_0x9eff('0x0')],'defaultValue':_0x9eff('0x4')},'attach':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':_0x9eff('0x6'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x9eff('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9eff('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':_0x9eff('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9eff('0x5')](_0x9eff('0x6'),'no'),'defaultValue':_0x9eff('0x6'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x9eff('0x0')]},'emailbody':{'type':Sequelize[_0x9eff('0x0')]},'maxsecs':{'type':Sequelize[_0x9eff('0x7')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9eff('0x7')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9eff('0x8')],'get':function(){return this[_0x9eff('0x9')](_0x9eff('0xa'))+_0x9eff('0xb')+this['getDataValue'](_0x9eff('0xc'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 434c063..68251e3 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 _0xbaf0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','Voicemails','UserProfileResource','then','error','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user'];(function(_0x4ded73,_0x363d3c){var _0x2f6f37=function(_0x37593a){while(--_0x37593a){_0x4ded73['push'](_0x4ded73['shift']());}};_0x2f6f37(++_0x363d3c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xcc;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0x1b')](_0xe4378c);}return _0x465dd7['status'](_0xe4378c)[_0x0baf('0x1c')]();};}function respondWithResult(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0xc8;return function(_0x1f50c3){if(_0x1f50c3){return _0x49e44b[_0x0baf('0x1d')](_0x1c76a8)[_0x0baf('0x1e')](_0x1f50c3);}};}function respondWithFilteredResult(_0xb8339e,_0x469599){return function(_0x4f80a8){if(_0x4f80a8){var _0x4cd79d=typeof _0x469599[_0x0baf('0x1f')]===_0x0baf('0x20')&&typeof _0x469599[_0x0baf('0x21')]===_0x0baf('0x20');var _0x2cf7da=_0x4f80a8[_0x0baf('0x22')];var _0x53c338=_0x4cd79d?0x0:_0x469599[_0x0baf('0x1f')];var _0xfbecec=_0x4cd79d?_0x4f80a8[_0x0baf('0x22')]:_0x469599[_0x0baf('0x1f')]+_0x469599[_0x0baf('0x21')];var _0x42b7f2;if(_0xfbecec>=_0x2cf7da){_0xfbecec=_0x2cf7da;_0x42b7f2=0xc8;}else{_0x42b7f2=0xce;}_0xb8339e['status'](_0x42b7f2);return _0xb8339e['set'](_0x0baf('0x23'),_0x53c338+'-'+_0xfbecec+'/'+_0x2cf7da)[_0x0baf('0x1e')](_0x4f80a8);}return null;};}function patchUpdates(_0x32e839){return function(_0x1848e8){try{jsonpatch[_0x0baf('0x24')](_0x1848e8,_0x32e839,!![]);}catch(_0x3e3e20){return BPromise[_0x0baf('0x25')](_0x3e3e20);}return _0x1848e8[_0x0baf('0x26')]();};}function saveUpdates(_0x2c42e2,_0x15a2c3){return function(_0x54f2fa){if(_0x54f2fa){return _0x54f2fa[_0x0baf('0x27')](_0x2c42e2)['then'](function(_0xf6c158){return _0xf6c158;});}return null;};}function removeEntity(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(_0x2ef0aa){return _0x2ef0aa['destroy']()['then'](function(){var _0x47c4b=_0x2ef0aa[_0x0baf('0x28')]({'plain':!![]});var _0x34e264=_0x0baf('0x29');return db[_0x0baf('0x2a')]['destroy']({'where':{'type':_0x34e264,'resourceId':_0x47c4b['id']}})[_0x0baf('0x2b')](function(){return _0x2ef0aa;});})[_0x0baf('0x2b')](function(){_0x5dbf00[_0x0baf('0x1d')](0xcc)[_0x0baf('0x1c')]();});}};}function handleEntityNotFound(_0x3843b8,_0x3b9b31){return function(_0x453525){if(!_0x453525){_0x3843b8['sendStatus'](0x194);}return _0x453525;};}function handleError(_0x1590b4,_0x393a5a){_0x393a5a=_0x393a5a||0x1f4;return function(_0xcaf13d){logger[_0x0baf('0x2c')](_0xcaf13d['stack']);if(_0xcaf13d[_0x0baf('0x2d')]){delete _0xcaf13d[_0x0baf('0x2d')];}_0x1590b4['status'](_0x393a5a)[_0x0baf('0x2e')](_0xcaf13d);};}exports[_0x0baf('0x2f')]=function(_0x478ce8,_0xb4dbb1){var _0xd14f0f={},_0x366924={},_0x213a6a={'count':0x0,'rows':[]};var _0x57476f=_[_0x0baf('0x30')](db[_0x0baf('0x31')][_0x0baf('0x32')],function(_0x3ed995){return{'name':_0x3ed995[_0x0baf('0x33')],'type':_0x3ed995[_0x0baf('0x34')][_0x0baf('0x35')]};});_0x366924[_0x0baf('0x36')]=_[_0x0baf('0x30')](_0x57476f,_0x0baf('0x2d'));_0x366924[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x478ce8[_0x0baf('0x37')]);_0x366924[_0x0baf('0x39')]=_['intersection'](_0x366924[_0x0baf('0x36')],_0x366924['query']);_0xd14f0f[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x366924[_0x0baf('0x36')],qs[_0x0baf('0x3c')](_0x478ce8['query'][_0x0baf('0x3c')]));_0xd14f0f[_0x0baf('0x3a')]=_0xd14f0f['attributes'][_0x0baf('0x3d')]?_0xd14f0f[_0x0baf('0x3a')]:_0x366924[_0x0baf('0x36')];if(!_0x478ce8[_0x0baf('0x37')][_0x0baf('0x3e')](_0x0baf('0x3f'))){_0xd14f0f[_0x0baf('0x21')]=qs[_0x0baf('0x21')](_0x478ce8['query'][_0x0baf('0x21')]);_0xd14f0f[_0x0baf('0x1f')]=qs['offset'](_0x478ce8[_0x0baf('0x37')]['offset']);}_0xd14f0f['order']=qs[_0x0baf('0x40')](_0x478ce8[_0x0baf('0x37')]['sort']);_0xd14f0f['where']=qs[_0x0baf('0x39')](_[_0x0baf('0x41')](_0x478ce8[_0x0baf('0x37')],_0x366924[_0x0baf('0x39')]),_0x57476f);if(_0x478ce8[_0x0baf('0x37')][_0x0baf('0x42')]){_0xd14f0f[_0x0baf('0x43')]=_[_0x0baf('0x44')](_0xd14f0f[_0x0baf('0x43')],{'$or':_[_0x0baf('0x30')](_0x57476f,function(_0x200864){if(_0x200864[_0x0baf('0x34')]!==_0x0baf('0x45')){var _0x229ea6={};_0x229ea6[_0x200864['name']]={'$like':'%'+_0x478ce8[_0x0baf('0x37')][_0x0baf('0x42')]+'%'};return _0x229ea6;}})});}_0xd14f0f=_['merge']({},_0xd14f0f,_0x478ce8[_0x0baf('0x46')]);var _0x324369={'where':_0xd14f0f[_0x0baf('0x43')]};return db[_0x0baf('0x31')][_0x0baf('0x22')](_0x324369)[_0x0baf('0x2b')](function(_0x57b581){_0x213a6a[_0x0baf('0x22')]=_0x57b581;if(_0x478ce8[_0x0baf('0x37')]['includeAll']){_0xd14f0f[_0x0baf('0x47')]=[{'all':!![]}];}return db[_0x0baf('0x31')][_0x0baf('0x48')](_0xd14f0f);})[_0x0baf('0x2b')](function(_0x504031){_0x213a6a[_0x0baf('0x49')]=_0x504031;return _0x213a6a;})[_0x0baf('0x2b')](respondWithFilteredResult(_0xb4dbb1,_0xd14f0f))[_0x0baf('0x4a')](handleError(_0xb4dbb1,null));};exports[_0x0baf('0x4b')]=function(_0x2b6d54,_0x385b24){var _0x33da34={'raw':!![],'where':{'id':_0x2b6d54[_0x0baf('0x4c')]['id']}},_0x1fa237={};_0x1fa237[_0x0baf('0x36')]=_['keys'](db[_0x0baf('0x31')][_0x0baf('0x32')]);_0x1fa237[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x2b6d54[_0x0baf('0x37')]);_0x1fa237['filters']=_[_0x0baf('0x3b')](_0x1fa237[_0x0baf('0x36')],_0x1fa237[_0x0baf('0x37')]);_0x33da34[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x1fa237['model'],qs[_0x0baf('0x3c')](_0x2b6d54[_0x0baf('0x37')][_0x0baf('0x3c')]));_0x33da34[_0x0baf('0x3a')]=_0x33da34[_0x0baf('0x3a')][_0x0baf('0x3d')]?_0x33da34[_0x0baf('0x3a')]:_0x1fa237['model'];if(_0x2b6d54[_0x0baf('0x37')][_0x0baf('0x4d')]){_0x33da34[_0x0baf('0x47')]=[{'all':!![]}];}_0x33da34=_['merge']({},_0x33da34,_0x2b6d54[_0x0baf('0x46')]);return db[_0x0baf('0x31')][_0x0baf('0x4e')](_0x33da34)[_0x0baf('0x2b')](handleEntityNotFound(_0x385b24,null))[_0x0baf('0x2b')](respondWithResult(_0x385b24,null))[_0x0baf('0x4a')](handleError(_0x385b24,null));};exports[_0x0baf('0x4f')]=function(_0x5a54bb,_0x22c451){return db[_0x0baf('0x31')][_0x0baf('0x4f')](_0x5a54bb[_0x0baf('0x50')],{})[_0x0baf('0x2b')](function(_0xc427b2){var _0x40d4a6=_0x5a54bb[_0x0baf('0x51')][_0x0baf('0x28')]({'plain':!![]});if(!_0x40d4a6)throw new Error(_0x0baf('0x52'));if(_0x40d4a6[_0x0baf('0x53')]==='user'){var _0x528ff6=_0xc427b2[_0x0baf('0x28')]({'plain':!![]});var _0x3d6b19=_0x0baf('0x29');return db[_0x0baf('0x54')][_0x0baf('0x4e')]({'where':{'name':_0x3d6b19,'userProfileId':_0x40d4a6[_0x0baf('0x55')]},'raw':!![]})[_0x0baf('0x2b')](function(_0x4b492c){if(_0x4b492c&&_0x4b492c[_0x0baf('0x56')]===0x0){return db[_0x0baf('0x2a')][_0x0baf('0x4f')]({'name':_0x528ff6[_0x0baf('0x2d')],'resourceId':_0x528ff6['id'],'type':_0x4b492c[_0x0baf('0x2d')],'sectionId':_0x4b492c['id']},{})[_0x0baf('0x2b')](function(){return _0xc427b2;});}else{return _0xc427b2;}})['catch'](function(_0x3eebe5){logger['error'](_0x0baf('0x57'),_0x3eebe5);throw _0x3eebe5;});}return _0xc427b2;})['then'](respondWithResult(_0x22c451,0xc9))[_0x0baf('0x4a')](handleError(_0x22c451,null));};exports['update']=function(_0x35b1a5,_0x4c035b){if(_0x35b1a5[_0x0baf('0x50')]['id']){delete _0x35b1a5[_0x0baf('0x50')]['id'];}return db[_0x0baf('0x31')][_0x0baf('0x4e')]({'where':{'id':_0x35b1a5[_0x0baf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c035b,null))[_0x0baf('0x2b')](saveUpdates(_0x35b1a5[_0x0baf('0x50')],null))[_0x0baf('0x2b')](respondWithResult(_0x4c035b,null))[_0x0baf('0x4a')](handleError(_0x4c035b,null));};exports[_0x0baf('0x58')]=function(_0xa19b21,_0x480834){return db[_0x0baf('0x31')][_0x0baf('0x4e')]({'where':{'id':_0xa19b21[_0x0baf('0x4c')]['id']}})[_0x0baf('0x2b')](handleEntityNotFound(_0x480834,null))[_0x0baf('0x2b')](removeEntity(_0x480834,null))[_0x0baf('0x4a')](handleError(_0x480834,null));};exports[_0x0baf('0x59')]=function(_0x565292,_0x48e855,_0x23f6ea){return db[_0x0baf('0x31')][_0x0baf('0x5a')]({'where':{'id':_0x565292[_0x0baf('0x4c')]['id']}})[_0x0baf('0x2b')](handleEntityNotFound(_0x48e855,null))[_0x0baf('0x2b')](function(_0xaa4293){var _0x14a667;var _0x3d9a32={},_0x585969={};_0x585969[_0x0baf('0x36')]=_[_0x0baf('0x38')](db[_0x0baf('0x5b')][_0x0baf('0x32')]);_0x585969[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x565292[_0x0baf('0x37')]);_0x585969['filters']=_[_0x0baf('0x3b')](_0x585969[_0x0baf('0x36')],_0x585969[_0x0baf('0x37')]);_0x3d9a32[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x585969[_0x0baf('0x36')],qs[_0x0baf('0x3c')](_0x565292[_0x0baf('0x37')]['fields']));_0x3d9a32[_0x0baf('0x3a')]=_0x3d9a32['attributes'][_0x0baf('0x3d')]?_0x3d9a32['attributes']:_0x585969['model'];if(!_0x565292[_0x0baf('0x37')]['hasOwnProperty'](_0x0baf('0x3f'))){_0x3d9a32[_0x0baf('0x21')]=qs['limit'](_0x565292[_0x0baf('0x37')][_0x0baf('0x21')]);_0x3d9a32[_0x0baf('0x1f')]=qs['offset'](_0x565292['query'][_0x0baf('0x1f')]);}_0x3d9a32[_0x0baf('0x5c')]=qs[_0x0baf('0x40')](_0x565292[_0x0baf('0x37')][_0x0baf('0x40')]);_0x3d9a32['where']=qs[_0x0baf('0x39')](_['pick'](_0x565292['query'],_0x585969['filters']));if(_0x565292[_0x0baf('0x37')]['filter']){_0x3d9a32['where']=_[_0x0baf('0x44')](_0x3d9a32[_0x0baf('0x43')],{'$or':_[_0x0baf('0x30')](_0x3d9a32[_0x0baf('0x3a')],function(_0x245967){var _0x27ddc7={};_0x27ddc7[_0x245967]={'$like':'%'+_0x565292['query'][_0x0baf('0x42')]+'%'};return _0x27ddc7;})});}_0x3d9a32[_0x0baf('0x43')]=_[_0x0baf('0x44')](_0x3d9a32[_0x0baf('0x43')],{'mailboxuser':_0xaa4293[_0x0baf('0x5d')]});_0x3d9a32=_[_0x0baf('0x44')]({},_0x3d9a32,_0x565292['options']);return db[_0x0baf('0x5b')][_0x0baf('0x5e')](_0x3d9a32)[_0x0baf('0x2b')](respondWithFilteredResult(_0x48e855,_0x3d9a32));})['catch'](handleError(_0x48e855,null));}; \ No newline at end of file +var _0x0bb5=['error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails'];(function(_0x3b5c38,_0x2c7022){var _0x442ebd=function(_0x738ed7){while(--_0x738ed7){_0x3b5c38['push'](_0x3b5c38['shift']());}};_0x442ebd(++_0x2c7022);}(_0x0bb5,0x148));var _0x50bb=function(_0x2fc0ef,_0xc8feb6){_0x2fc0ef=_0x2fc0ef-0x0;var _0x44c609=_0x0bb5[_0x2fc0ef];return _0x44c609;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){var _0xad17ac=_0x846311[_0x50bb('0x26')]({'plain':!![]});var _0x284a76=_0x50bb('0x27');return db['UserProfileResource'][_0x50bb('0x25')]({'where':{'type':_0x284a76,'resourceId':_0xad17ac['id']}})['then'](function(){return _0x846311;});})['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cfe4b,_0x41fd89){return function(_0x12ee2c){if(!_0x12ee2c){_0x5cfe4b[_0x50bb('0x19')](0x194);}return _0x12ee2c;};}function handleError(_0x1b74f9,_0x17c158){_0x17c158=_0x17c158||0x1f4;return function(_0x269479){logger[_0x50bb('0x28')](_0x269479[_0x50bb('0x29')]);if(_0x269479['name']){delete _0x269479[_0x50bb('0x2a')];}_0x1b74f9[_0x50bb('0x1a')](_0x17c158)[_0x50bb('0x2b')](_0x269479);};}exports[_0x50bb('0x2c')]=function(_0x560b07,_0x13dc3c){var _0x1a62fb={},_0xc38da5={},_0xb3c3ba={'count':0x0,'rows':[]};var _0x3fd5f6=_[_0x50bb('0x2d')](db[_0x50bb('0x2e')][_0x50bb('0x2f')],function(_0x5cfdd5){return{'name':_0x5cfdd5[_0x50bb('0x30')],'type':_0x5cfdd5[_0x50bb('0x31')][_0x50bb('0x32')]};});_0xc38da5['model']=_[_0x50bb('0x2d')](_0x3fd5f6,_0x50bb('0x2a'));_0xc38da5[_0x50bb('0x33')]=_[_0x50bb('0x34')](_0x560b07[_0x50bb('0x33')]);_0xc38da5[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0xc38da5[_0x50bb('0x37')],_0xc38da5[_0x50bb('0x33')]);_0x1a62fb[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0xc38da5['model'],qs[_0x50bb('0x39')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x39')]));_0x1a62fb[_0x50bb('0x38')]=_0x1a62fb[_0x50bb('0x38')][_0x50bb('0x3a')]?_0x1a62fb['attributes']:_0xc38da5['model'];if(!_0x560b07[_0x50bb('0x33')]['hasOwnProperty'](_0x50bb('0x3b'))){_0x1a62fb[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1a62fb['offset']=qs[_0x50bb('0x1c')](_0x560b07['query'][_0x50bb('0x1c')]);}_0x1a62fb[_0x50bb('0x3d')]=qs[_0x50bb('0x3e')](_0x560b07['query']['sort']);_0x1a62fb[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x560b07[_0x50bb('0x33')],_0xc38da5['filters']),_0x3fd5f6);if(_0x560b07[_0x50bb('0x33')]['filter']){_0x1a62fb['where']=_[_0x50bb('0x41')](_0x1a62fb['where'],{'$or':_[_0x50bb('0x2d')](_0x3fd5f6,function(_0x3d94b8){if(_0x3d94b8[_0x50bb('0x31')]!==_0x50bb('0x42')){var _0x3a9fe4={};_0x3a9fe4[_0x3d94b8[_0x50bb('0x2a')]]={'$like':'%'+_0x560b07[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0x3a9fe4;}})});}_0x1a62fb=_[_0x50bb('0x41')]({},_0x1a62fb,_0x560b07[_0x50bb('0x44')]);var _0x594f16={'where':_0x1a62fb['where']};return db[_0x50bb('0x2e')][_0x50bb('0x1e')](_0x594f16)[_0x50bb('0x24')](function(_0x1d929d){_0xb3c3ba['count']=_0x1d929d;if(_0x560b07[_0x50bb('0x33')]['includeAll']){_0x1a62fb[_0x50bb('0x45')]=[{'all':!![]}];}return db[_0x50bb('0x2e')][_0x50bb('0x46')](_0x1a62fb);})[_0x50bb('0x24')](function(_0x1c438b){_0xb3c3ba[_0x50bb('0x47')]=_0x1c438b;return _0xb3c3ba;})[_0x50bb('0x24')](respondWithFilteredResult(_0x13dc3c,_0x1a62fb))[_0x50bb('0x48')](handleError(_0x13dc3c,null));};exports[_0x50bb('0x49')]=function(_0x46c1c3,_0x349474){var _0x24e375={'raw':!![],'where':{'id':_0x46c1c3[_0x50bb('0x4a')]['id']}},_0x85b0ff={};_0x85b0ff[_0x50bb('0x37')]=_[_0x50bb('0x34')](db['VoiceMail'][_0x50bb('0x2f')]);_0x85b0ff['query']=_[_0x50bb('0x34')](_0x46c1c3[_0x50bb('0x33')]);_0x85b0ff[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],_0x85b0ff[_0x50bb('0x33')]);_0x24e375[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x39')]));_0x24e375[_0x50bb('0x38')]=_0x24e375[_0x50bb('0x38')]['length']?_0x24e375[_0x50bb('0x38')]:_0x85b0ff['model'];if(_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x4b')]){_0x24e375[_0x50bb('0x45')]=[{'all':!![]}];}_0x24e375=_[_0x50bb('0x41')]({},_0x24e375,_0x46c1c3[_0x50bb('0x44')]);return db[_0x50bb('0x2e')][_0x50bb('0x4c')](_0x24e375)[_0x50bb('0x24')](handleEntityNotFound(_0x349474,null))['then'](respondWithResult(_0x349474,null))[_0x50bb('0x48')](handleError(_0x349474,null));};exports[_0x50bb('0x4d')]=function(_0xf52a22,_0x13afe2){return db[_0x50bb('0x2e')]['create'](_0xf52a22[_0x50bb('0x4e')],{})[_0x50bb('0x24')](function(_0x2a411d){var _0x154ff8=_0xf52a22[_0x50bb('0x4f')]['get']({'plain':!![]});if(!_0x154ff8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154ff8[_0x50bb('0x50')]==='user'){var _0x357d08=_0x2a411d['get']({'plain':!![]});var _0x4316e4=_0x50bb('0x27');return db[_0x50bb('0x51')]['find']({'where':{'name':_0x4316e4,'userProfileId':_0x154ff8[_0x50bb('0x52')]},'raw':!![]})[_0x50bb('0x24')](function(_0x588dfe){if(_0x588dfe&&_0x588dfe[_0x50bb('0x53')]===0x0){return db[_0x50bb('0x54')][_0x50bb('0x4d')]({'name':_0x357d08[_0x50bb('0x2a')],'resourceId':_0x357d08['id'],'type':_0x588dfe['name'],'sectionId':_0x588dfe['id']},{})[_0x50bb('0x24')](function(){return _0x2a411d;});}else{return _0x2a411d;}})[_0x50bb('0x48')](function(_0x2e0032){logger[_0x50bb('0x28')](_0x50bb('0x55'),_0x2e0032);throw _0x2e0032;});}return _0x2a411d;})['then'](respondWithResult(_0x13afe2,0xc9))[_0x50bb('0x48')](handleError(_0x13afe2,null));};exports['update']=function(_0x38a775,_0x50216f){if(_0x38a775['body']['id']){delete _0x38a775[_0x50bb('0x4e')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x38a775[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x50216f,null))[_0x50bb('0x24')](saveUpdates(_0x38a775[_0x50bb('0x4e')],null))[_0x50bb('0x24')](respondWithResult(_0x50216f,null))[_0x50bb('0x48')](handleError(_0x50216f,null));};exports[_0x50bb('0x25')]=function(_0x1408fa,_0x57d749){return db['VoiceMail'][_0x50bb('0x4c')]({'where':{'id':_0x1408fa[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x57d749,null))[_0x50bb('0x24')](removeEntity(_0x57d749,null))[_0x50bb('0x48')](handleError(_0x57d749,null));};exports[_0x50bb('0x56')]=function(_0x287bc7,_0x4bf426,_0x3be83b){return db[_0x50bb('0x2e')][_0x50bb('0x57')]({'where':{'id':_0x287bc7[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x4bf426,null))['then'](function(_0x33ebe6){var _0x1d8b85;var _0x1da5cd={},_0x507f26={};_0x507f26[_0x50bb('0x37')]=_['keys'](db[_0x50bb('0x58')]['rawAttributes']);_0x507f26['query']=_[_0x50bb('0x34')](_0x287bc7[_0x50bb('0x33')]);_0x507f26[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x507f26[_0x50bb('0x37')],_0x507f26[_0x50bb('0x33')]);_0x1da5cd[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x507f26[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x287bc7[_0x50bb('0x33')]['fields']));_0x1da5cd[_0x50bb('0x38')]=_0x1da5cd['attributes'][_0x50bb('0x3a')]?_0x1da5cd[_0x50bb('0x38')]:_0x507f26['model'];if(!_0x287bc7[_0x50bb('0x33')][_0x50bb('0x59')](_0x50bb('0x3b'))){_0x1da5cd[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1da5cd[_0x50bb('0x1c')]=qs['offset'](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x1c')]);}_0x1da5cd[_0x50bb('0x3d')]=qs['sort'](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x3e')]);_0x1da5cd[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x287bc7[_0x50bb('0x33')],_0x507f26['filters']));if(_0x287bc7[_0x50bb('0x33')][_0x50bb('0x43')]){_0x1da5cd[_0x50bb('0x3f')]=_[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')],{'$or':_[_0x50bb('0x2d')](_0x1da5cd['attributes'],function(_0x40257b){var _0xa85833={};_0xa85833[_0x40257b]={'$like':'%'+_0x287bc7[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0xa85833;})});}_0x1da5cd[_0x50bb('0x3f')]=_[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')],{'mailboxuser':_0x33ebe6[_0x50bb('0x5a')]});_0x1da5cd=_[_0x50bb('0x41')]({},_0x1da5cd,_0x287bc7['options']);return db[_0x50bb('0x58')][_0x50bb('0x5b')](_0x1da5cd)[_0x50bb('0x24')](respondWithFilteredResult(_0x4bf426,_0x1da5cd));})[_0x50bb('0x48')](handleError(_0x4bf426,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 33b2932..edf1c0b 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 _0xc4b6=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x453d74,_0x2dd33b){var _0x2a641a=function(_0x21601c){while(--_0x21601c){_0x453d74['push'](_0x453d74['shift']());}};_0x2a641a(++_0x2dd33b);}(_0xc4b6,0x13d));var _0x6c4b=function(_0x25a0a5,_0x1e0fd2){_0x25a0a5=_0x25a0a5-0x0;var _0x1352a0=_0xc4b6[_0x25a0a5];return _0x1352a0;};'use strict';var _=require(_0x6c4b('0x0'));var util=require(_0x6c4b('0x1'));var logger=require(_0x6c4b('0x2'))(_0x6c4b('0x3'));var moment=require(_0x6c4b('0x4'));var BPromise=require(_0x6c4b('0x5'));var rp=require(_0x6c4b('0x6'));var fs=require('fs');var path=require(_0x6c4b('0x7'));var rimraf=require(_0x6c4b('0x8'));var config=require(_0x6c4b('0x9'));var attributes=require(_0x6c4b('0xa'));module[_0x6c4b('0xb')]=function(_0x34aebe,_0x3d5d9f){return _0x34aebe[_0x6c4b('0xc')](_0x6c4b('0xd'),attributes,{'tableName':_0x6c4b('0xe'),'paranoid':![],'indexes':[{'name':_0x6c4b('0xf'),'fields':[_0x6c4b('0x10'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6f3=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','voice_voicemail','mailbox','context','lodash','util','../../config/logger'];(function(_0x5dd9e1,_0x491fdb){var _0x44185b=function(_0x43e8b1){while(--_0x43e8b1){_0x5dd9e1['push'](_0x5dd9e1['shift']());}};_0x44185b(++_0x491fdb);}(_0xe6f3,0xeb));var _0x3e6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe6f3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3e6f('0x0'));var util=require(_0x3e6f('0x1'));var logger=require(_0x3e6f('0x2'))(_0x3e6f('0x3'));var moment=require(_0x3e6f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e6f('0x5'));var fs=require('fs');var path=require(_0x3e6f('0x6'));var rimraf=require(_0x3e6f('0x7'));var config=require(_0x3e6f('0x8'));var attributes=require('./voiceMail.attributes');module[_0x3e6f('0x9')]=function(_0x222085,_0x1b2524){return _0x222085[_0x3e6f('0xa')]('VoiceMail',attributes,{'tableName':_0x3e6f('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x3e6f('0xc'),_0x3e6f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index b656966..f348c31 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 _0xacba=['then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xacba,0xd0));var _0xaacb=function(_0x4b0883,_0x3fe601){_0x4b0883=_0x4b0883-0x0;var _0x35636d=_0xacba[_0x4b0883];return _0x35636d;};'use strict';var _=require(_0xaacb('0x0'));var util=require(_0xaacb('0x1'));var moment=require(_0xaacb('0x2'));var BPromise=require(_0xaacb('0x3'));var rs=require(_0xaacb('0x4'));var fs=require('fs');var Redis=require(_0xaacb('0x5'));var db=require(_0xaacb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaacb('0x7'))(_0xaacb('0x8'));var config=require(_0xaacb('0x9'));var jayson=require(_0xaacb('0xa'));var client=jayson[_0xaacb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38589b,_0x25d953,_0x496fa1){return new BPromise(function(_0x105de7,_0x145832){return client['request'](_0x38589b,_0x496fa1)[_0xaacb('0xc')](function(_0x1f6fe9){logger['info'](_0xaacb('0xd'),_0x25d953,_0xaacb('0xe'));logger[_0xaacb('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x25d953,'request\x20sent',JSON[_0xaacb('0x10')](_0x1f6fe9));if(_0x1f6fe9[_0xaacb('0x11')]){if(_0x1f6fe9[_0xaacb('0x11')][_0xaacb('0x12')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x25d953,_0x1f6fe9[_0xaacb('0x11')][_0xaacb('0x13')]);return _0x145832(_0x1f6fe9['error'][_0xaacb('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x25d953,_0x1f6fe9[_0xaacb('0x11')][_0xaacb('0x13')]);return _0x105de7(_0x1f6fe9[_0xaacb('0x11')][_0xaacb('0x13')]);}else{logger[_0xaacb('0x14')](_0xaacb('0xd'),_0x25d953,'request\x20sent');_0x105de7(_0x1f6fe9[_0xaacb('0x15')][_0xaacb('0x13')]);}})['catch'](function(_0x25e084){logger[_0xaacb('0x11')]('VoiceMail,\x20%s,\x20%s',_0x25d953,_0x25e084);_0x145832(_0x25e084);});});} \ No newline at end of file +var _0x18c9=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x213f1b,_0xddb2b){var _0x2ce6bc=function(_0x4781b4){while(--_0x4781b4){_0x213f1b['push'](_0x213f1b['shift']());}};_0x2ce6bc(++_0xddb2b);}(_0x18c9,0xaf));var _0x918c=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x18c9[_0x3a7a9c];return _0x59156e;};'use strict';var _=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var moment=require('moment');var BPromise=require(_0x918c('0x2'));var rs=require(_0x918c('0x3'));var fs=require('fs');var Redis=require(_0x918c('0x4'));var db=require(_0x918c('0x5'))['db'];var utils=require(_0x918c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x918c('0x7'));var jayson=require(_0x918c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39bd9f,_0xc8325e,_0x7580f6){return new BPromise(function(_0x24896a,_0x3e59b6){return client[_0x918c('0x9')](_0x39bd9f,_0x7580f6)[_0x918c('0xa')](function(_0x29f419){logger[_0x918c('0xb')](_0x918c('0xc'),_0xc8325e,_0x918c('0xd'));logger[_0x918c('0xe')](_0x918c('0xf'),_0xc8325e,_0x918c('0xd'),JSON['stringify'](_0x29f419));if(_0x29f419['error']){if(_0x29f419[_0x918c('0x10')][_0x918c('0x11')]===0x1f4){logger['error'](_0x918c('0xc'),_0xc8325e,_0x29f419[_0x918c('0x10')][_0x918c('0x12')]);return _0x3e59b6(_0x29f419[_0x918c('0x10')]['message']);}logger[_0x918c('0x10')]('VoiceMail,\x20%s,\x20%s',_0xc8325e,_0x29f419[_0x918c('0x10')][_0x918c('0x12')]);return _0x24896a(_0x29f419[_0x918c('0x10')][_0x918c('0x12')]);}else{logger['info'](_0x918c('0xc'),_0xc8325e,_0x918c('0xd'));_0x24896a(_0x29f419[_0x918c('0x13')][_0x918c('0x12')]);}})['catch'](function(_0x1c76dc){logger[_0x918c('0x10')](_0x918c('0xc'),_0xc8325e,_0x1c76dc);_0x3e59b6(_0x1c76dc);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d9967f5..6780c34 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 _0x3416=['./voiceMailMessage.controller','index','get','/:id','/:id/download','isAuthenticated','download','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x40f330,_0x3b8a1e){var _0x22896b=function(_0xaa2a6f){while(--_0xaa2a6f){_0x40f330['push'](_0x40f330['shift']());}};_0x22896b(++_0x3b8a1e);}(_0x3416,0xc0));var _0x6341=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x3416[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require('multer');var util=require(_0x6341('0x0'));var path=require(_0x6341('0x1'));var timeout=require(_0x6341('0x2'));var express=require(_0x6341('0x3'));var router=express[_0x6341('0x4')]();var fs_extra=require(_0x6341('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6341('0x6'));var config=require(_0x6341('0x7'));var controller=require(_0x6341('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6341('0x9')]);router[_0x6341('0xa')](_0x6341('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6341('0xa')](_0x6341('0xc'),auth[_0x6341('0xd')](),controller[_0x6341('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6341('0xf')](_0x6341('0xb'),auth[_0x6341('0xd')](),controller[_0x6341('0x10')]);router[_0x6341('0x11')]('/:id',auth[_0x6341('0xd')](),controller[_0x6341('0x12')]);module[_0x6341('0x13')]=router; \ No newline at end of file +var _0xf7a6=['put','update','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','post','create'];(function(_0x27c256,_0x32c0bd){var _0x22217a=function(_0x1e8bf4){while(--_0x1e8bf4){_0x27c256['push'](_0x27c256['shift']());}};_0x22217a(++_0x32c0bd);}(_0xf7a6,0xb6));var _0x6f7a=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xf7a6[_0x36ed48];return _0x51c63a;};'use strict';var multer=require('multer');var util=require(_0x6f7a('0x0'));var path=require('path');var timeout=require(_0x6f7a('0x1'));var express=require('express');var router=express[_0x6f7a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6f7a('0x3'));var config=require(_0x6f7a('0x4'));var controller=require('./voiceMailMessage.controller');router[_0x6f7a('0x5')]('/',auth[_0x6f7a('0x6')](),controller[_0x6f7a('0x7')]);router[_0x6f7a('0x5')](_0x6f7a('0x8'),auth[_0x6f7a('0x6')](),controller[_0x6f7a('0x9')]);router[_0x6f7a('0x5')]('/:id/download',auth[_0x6f7a('0x6')](),controller[_0x6f7a('0xa')]);router[_0x6f7a('0xb')]('/',auth[_0x6f7a('0x6')](),controller[_0x6f7a('0xc')]);router[_0x6f7a('0xd')](_0x6f7a('0x8'),auth[_0x6f7a('0x6')](),controller[_0x6f7a('0xe')]);router['delete'](_0x6f7a('0x8'),auth[_0x6f7a('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9b9dca0..7c745df 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 _0x1dcf=['STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x369c70,_0x5892f0){var _0xb7e463=function(_0x3822c8){while(--_0x3822c8){_0x369c70['push'](_0x369c70['shift']());}};_0xb7e463(++_0x5892f0);}(_0x1dcf,0xaf));var _0xf1dc=function(_0x38c137,_0xea8095){_0x38c137=_0x38c137-0x0;var _0x2d46be=_0x1dcf[_0x38c137];return _0x2d46be;};'use strict';var Sequelize=require(_0xf1dc('0x0'));module[_0xf1dc('0x1')]={'name':{'type':Sequelize[_0xf1dc('0x2')],'get':function(_0x363b2a){return this[_0xf1dc('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xf1dc('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf1dc('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf1dc('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf1dc('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf1dc('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xf1dc('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf1dc('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf1dc('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xf1dc('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xf1dc('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf1dc('0x5')],'defaultValue':''},'stamp':{'type':_0xf1dc('0x7'),'defaultValue':Sequelize[_0xf1dc('0x8')](_0xf1dc('0x9'))}}; \ No newline at end of file +var _0xb3fe=['getDataValue','STRING','BLOB','sequelize','VIRTUAL'];(function(_0x1a977e,_0x3045cf){var _0x4404b8=function(_0x50dcfb){while(--_0x50dcfb){_0x1a977e['push'](_0x1a977e['shift']());}};_0x4404b8(++_0x3045cf);}(_0xb3fe,0x99));var _0xeb3f=function(_0xe24ff7,_0x3f071b){_0xe24ff7=_0xe24ff7-0x0;var _0x30d497=_0xb3fe[_0xe24ff7];return _0x30d497;};'use strict';var Sequelize=require(_0xeb3f('0x0'));module['exports']={'name':{'type':Sequelize[_0xeb3f('0x1')],'get':function(_0x2d565d){return this[_0xeb3f('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xeb3f('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xeb3f('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal']('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 324cbd1..5677898 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 _0x842f=['differenceBy','map','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model'];(function(_0x472173,_0x140ece){var _0x5abc10=function(_0x248388){while(--_0x248388){_0x472173['push'](_0x472173['shift']());}};_0x5abc10(++_0x140ece);}(_0x842f,0x11e));var _0xf842=function(_0x550d2f,_0x367bea){_0x550d2f=_0x550d2f-0x0;var _0x28e111=_0x842f[_0x550d2f];return _0x28e111;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf842('0x0'));var jsonpatch=require(_0xf842('0x1'));var rp=require(_0xf842('0x2'));var moment=require(_0xf842('0x3'));var BPromise=require(_0xf842('0x4'));var Mustache=require(_0xf842('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf842('0x6'));var csv=require(_0xf842('0x7'));var ejs=require(_0xf842('0x8'));var fs=require('fs');var fs_extra=require(_0xf842('0x9'));var _=require(_0xf842('0xa'));var squel=require(_0xf842('0xb'));var crypto=require(_0xf842('0xc'));var jsforce=require(_0xf842('0xd'));var deskjs=require(_0xf842('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf842('0xf'));var Papa=require(_0xf842('0x10'));var Redis=require('ioredis');var authService=require(_0xf842('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf842('0x12'));var logger=require('../../config/logger')(_0xf842('0x13'));var utils=require(_0xf842('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf842('0x15'));var db=require(_0xf842('0x16'))['db'];function respondWithStatusCode(_0x3dbae1,_0x38aaf2){_0x38aaf2=_0x38aaf2||0xcc;return function(_0x8813a4){if(_0x8813a4){return _0x3dbae1['sendStatus'](_0x38aaf2);}return _0x3dbae1[_0xf842('0x17')](_0x38aaf2)[_0xf842('0x18')]();};}function respondWithResult(_0x55f65a,_0x45aba8){_0x45aba8=_0x45aba8||0xc8;return function(_0x426e7f){if(_0x426e7f){return _0x55f65a['status'](_0x45aba8)['json'](_0x426e7f);}};}function respondWithFilteredResult(_0x5e5d80,_0x357445){return function(_0x2e7bdd){if(_0x2e7bdd){var _0x3dc29d=typeof _0x357445[_0xf842('0x19')]==='undefined'&&typeof _0x357445[_0xf842('0x1a')]===_0xf842('0x1b');var _0x5ae54f=_0x2e7bdd[_0xf842('0x1c')];var _0x597da3=_0x3dc29d?0x0:_0x357445[_0xf842('0x19')];var _0x32b4a7=_0x3dc29d?_0x2e7bdd[_0xf842('0x1c')]:_0x357445['offset']+_0x357445['limit'];var _0x5e06d0;if(_0x32b4a7>=_0x5ae54f){_0x32b4a7=_0x5ae54f;_0x5e06d0=0xc8;}else{_0x5e06d0=0xce;}_0x5e5d80['status'](_0x5e06d0);return _0x5e5d80[_0xf842('0x1d')](_0xf842('0x1e'),_0x597da3+'-'+_0x32b4a7+'/'+_0x5ae54f)[_0xf842('0x1f')](_0x2e7bdd);}return null;};}function patchUpdates(_0x3ddbc7){return function(_0x38975e){try{jsonpatch['apply'](_0x38975e,_0x3ddbc7,!![]);}catch(_0x3ba26b){return BPromise[_0xf842('0x20')](_0x3ba26b);}return _0x38975e['save']();};}function saveUpdates(_0x10a2c6,_0xbb0905){return function(_0x28e138){if(_0x28e138){return _0x28e138[_0xf842('0x21')](_0x10a2c6)['then'](function(_0x28956a){return _0x28956a;});}return null;};}function removeEntity(_0x599134,_0x5d3006){return function(_0x35b4a4){if(_0x35b4a4){return _0x35b4a4['destroy']()[_0xf842('0x22')](function(){_0x599134[_0xf842('0x17')](0xcc)[_0xf842('0x18')]();});}};}function handleEntityNotFound(_0x3cfa95,_0x18307e){return function(_0x2ac168){if(!_0x2ac168){_0x3cfa95['sendStatus'](0x194);}return _0x2ac168;};}function handleError(_0x5467,_0x317b02){_0x317b02=_0x317b02||0x1f4;return function(_0x1be59f){logger[_0xf842('0x23')](_0x1be59f[_0xf842('0x24')]);if(_0x1be59f[_0xf842('0x25')]){delete _0x1be59f[_0xf842('0x25')];}_0x5467['status'](_0x317b02)[_0xf842('0x26')](_0x1be59f);};}exports[_0xf842('0x27')]=function(_0x19549d,_0x4d5e94){var _0x56ccc0={},_0x2da543={},_0x4f4807={'count':0x0,'rows':[]};var _0x195657=_['map'](db[_0xf842('0x28')][_0xf842('0x29')],function(_0x2c6233){return{'name':_0x2c6233[_0xf842('0x2a')],'type':_0x2c6233[_0xf842('0x2b')][_0xf842('0x2c')]};});_0x2da543[_0xf842('0x2d')]=_[_0xf842('0x2e')](_[_0xf842('0x2f')](_0x195657,_0xf842('0x25')),[_0xf842('0x25')]);_0x2da543['query']=_[_0xf842('0x30')](_0x19549d[_0xf842('0x31')]);_0x2da543['filters']=_[_0xf842('0x32')](_0x2da543[_0xf842('0x2d')],_0x2da543[_0xf842('0x31')]);_0x56ccc0['attributes']=_['intersection'](_0x2da543['model'],qs[_0xf842('0x33')](_0x19549d[_0xf842('0x31')]['fields']));_0x56ccc0[_0xf842('0x34')]=_0x56ccc0[_0xf842('0x34')][_0xf842('0x35')]?_0x56ccc0['attributes']:_0x2da543[_0xf842('0x2d')];if(!_0x19549d[_0xf842('0x31')]['hasOwnProperty'](_0xf842('0x36'))){_0x56ccc0['limit']=qs[_0xf842('0x1a')](_0x19549d['query']['limit']);_0x56ccc0[_0xf842('0x19')]=qs[_0xf842('0x19')](_0x19549d['query'][_0xf842('0x19')]);}_0x56ccc0[_0xf842('0x37')]=qs[_0xf842('0x38')](_0x19549d[_0xf842('0x31')][_0xf842('0x38')]);_0x56ccc0[_0xf842('0x39')]=qs[_0xf842('0x3a')](_[_0xf842('0x3b')](_0x19549d['query'],_0x2da543[_0xf842('0x3a')]),_0x195657);if(_0x19549d[_0xf842('0x31')][_0xf842('0x3c')]){_0x56ccc0[_0xf842('0x39')]=_[_0xf842('0x3d')](_0x56ccc0[_0xf842('0x39')],{'$or':_[_0xf842('0x2f')](_0x195657,function(_0x15e963){if(_0x15e963[_0xf842('0x2b')]!==_0xf842('0x3e')){var _0x2d4dd9={};_0x2d4dd9[_0x15e963[_0xf842('0x25')]]={'$like':'%'+_0x19549d[_0xf842('0x31')][_0xf842('0x3c')]+'%'};return _0x2d4dd9;}})});}_0x56ccc0=_['merge']({},_0x56ccc0,_0x19549d[_0xf842('0x3f')]);var _0x6d73fb={'where':_0x56ccc0['where']};return db['VoiceMailMessage']['count'](_0x6d73fb)[_0xf842('0x22')](function(_0x5d56d9){_0x4f4807[_0xf842('0x1c')]=_0x5d56d9;if(_0x19549d[_0xf842('0x31')][_0xf842('0x40')]){_0x56ccc0[_0xf842('0x41')]=[{'all':!![]}];}return db[_0xf842('0x28')]['findAll'](_0x56ccc0);})[_0xf842('0x22')](function(_0x2e847d){_0x4f4807[_0xf842('0x42')]=_0x2e847d;return _0x4f4807;})[_0xf842('0x22')](respondWithFilteredResult(_0x4d5e94,_0x56ccc0))[_0xf842('0x43')](handleError(_0x4d5e94,null));};exports['show']=function(_0x46489e,_0x32125c){var _0x3b6b01={'raw':!![],'where':{'id':_0x46489e[_0xf842('0x44')]['id']}},_0x51d448={};_0x51d448['model']=_[_0xf842('0x30')](db[_0xf842('0x28')][_0xf842('0x29')]);_0x51d448['query']=_['keys'](_0x46489e[_0xf842('0x31')]);_0x51d448['filters']=_[_0xf842('0x32')](_0x51d448[_0xf842('0x2d')],_0x51d448[_0xf842('0x31')]);_0x3b6b01[_0xf842('0x34')]=_['intersection'](_0x51d448[_0xf842('0x2d')],qs[_0xf842('0x33')](_0x46489e[_0xf842('0x31')][_0xf842('0x33')]));_0x3b6b01[_0xf842('0x34')]=_0x3b6b01['attributes'][_0xf842('0x35')]?_0x3b6b01['attributes']:_0x51d448[_0xf842('0x2d')];if(_0x46489e[_0xf842('0x31')][_0xf842('0x40')]){_0x3b6b01[_0xf842('0x41')]=[{'all':!![]}];}_0x3b6b01=_['merge']({},_0x3b6b01,_0x46489e[_0xf842('0x3f')]);return db[_0xf842('0x28')][_0xf842('0x45')](_0x3b6b01)[_0xf842('0x22')](handleEntityNotFound(_0x32125c,null))['then'](respondWithResult(_0x32125c,null))[_0xf842('0x43')](handleError(_0x32125c,null));};exports[_0xf842('0x46')]=function(_0x4e971b,_0xaff370){return db[_0xf842('0x28')][_0xf842('0x46')](_0x4e971b[_0xf842('0x47')],{})[_0xf842('0x22')](respondWithResult(_0xaff370,0xc9))['catch'](handleError(_0xaff370,null));};exports[_0xf842('0x21')]=function(_0x1daf46,_0x26d8e5){if(_0x1daf46[_0xf842('0x47')]['id']){delete _0x1daf46[_0xf842('0x47')]['id'];}return db[_0xf842('0x28')][_0xf842('0x45')]({'where':{'id':_0x1daf46['params']['id']}})[_0xf842('0x22')](handleEntityNotFound(_0x26d8e5,null))['then'](saveUpdates(_0x1daf46[_0xf842('0x47')],null))[_0xf842('0x22')](respondWithResult(_0x26d8e5,null))[_0xf842('0x43')](handleError(_0x26d8e5,null));};exports[_0xf842('0x48')]=function(_0x5366cb,_0x3e023f){return db[_0xf842('0x28')][_0xf842('0x45')]({'where':{'id':_0x5366cb[_0xf842('0x44')]['id']}})[_0xf842('0x22')](handleEntityNotFound(_0x3e023f,null))[_0xf842('0x22')](removeEntity(_0x3e023f,null))[_0xf842('0x43')](handleError(_0x3e023f,null));};exports[_0xf842('0x49')]=function(_0x11d3df,_0x17c1c7,_0x4ac215){return db[_0xf842('0x28')]['find']({'where':{'id':_0x11d3df[_0xf842('0x44')]['id']},'attributes':['id',_0xf842('0x4a'),_0xf842('0x4b')]})[_0xf842('0x22')](handleEntityNotFound(_0x17c1c7,null))[_0xf842('0x22')](function(_0x35404e){if(_0x35404e){if(!_0x35404e['recording']){throw new db[(_0xf842('0x4c'))][(_0xf842('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x1ded51={'Content-Type':_0xf842('0x4e'),'Content-Disposition':_0xf842('0x4f')};if(_0x35404e[_0xf842('0x4b')]){_0x1ded51[_0xf842('0x50')]=_0xf842('0x51')+_0x35404e[_0xf842('0x4b')]+_0xf842('0x52');}_0x17c1c7[_0xf842('0x1d')](_0x1ded51);return _0x17c1c7[_0xf842('0x26')](new Buffer(_0x35404e[_0xf842('0x4a')]));}})[_0xf842('0x43')](handleError(_0x17c1c7,null));}; \ No newline at end of file +var _0x81d6=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','findAll','rows','params','fields','include','find','catch','body','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','.wav\x22','send','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs'];(function(_0x365833,_0x65aaa4){var _0x437a67=function(_0x3ed4c8){while(--_0x3ed4c8){_0x365833['push'](_0x365833['shift']());}};_0x437a67(++_0x65aaa4);}(_0x81d6,0x192));var _0x681d=function(_0x5d5a7c,_0x1e2a8c){_0x5d5a7c=_0x5d5a7c-0x0;var _0x55141f=_0x81d6[_0x5d5a7c];return _0x55141f;};'use strict';var emlformat=require(_0x681d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x681d('0x1'));var jsonpatch=require(_0x681d('0x2'));var rp=require('request-promise');var moment=require(_0x681d('0x3'));var BPromise=require(_0x681d('0x4'));var Mustache=require('mustache');var util=require(_0x681d('0x5'));var path=require(_0x681d('0x6'));var sox=require(_0x681d('0x7'));var csv=require(_0x681d('0x8'));var ejs=require(_0x681d('0x9'));var fs=require('fs');var fs_extra=require(_0x681d('0xa'));var _=require(_0x681d('0xb'));var squel=require(_0x681d('0xc'));var crypto=require(_0x681d('0xd'));var jsforce=require(_0x681d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x681d('0xf'));var Papa=require(_0x681d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x681d('0x11'));var as=require(_0x681d('0x12'));var hardwareService=require(_0x681d('0x13'));var logger=require(_0x681d('0x14'))(_0x681d('0x15'));var utils=require(_0x681d('0x16'));var config=require(_0x681d('0x17'));var licenseUtil=require(_0x681d('0x18'));var db=require(_0x681d('0x19'))['db'];function respondWithStatusCode(_0x504324,_0x2f0ba4){_0x2f0ba4=_0x2f0ba4||0xcc;return function(_0x50ad1e){if(_0x50ad1e){return _0x504324[_0x681d('0x1a')](_0x2f0ba4);}return _0x504324[_0x681d('0x1b')](_0x2f0ba4)[_0x681d('0x1c')]();};}function respondWithResult(_0x5d7518,_0x26d27b){_0x26d27b=_0x26d27b||0xc8;return function(_0x341ad7){if(_0x341ad7){return _0x5d7518['status'](_0x26d27b)[_0x681d('0x1d')](_0x341ad7);}};}function respondWithFilteredResult(_0x2bd4f9,_0x1812d1){return function(_0xac88af){if(_0xac88af){var _0x2d9ee8=typeof _0x1812d1[_0x681d('0x1e')]==='undefined'&&typeof _0x1812d1[_0x681d('0x1f')]==='undefined';var _0x19b761=_0xac88af[_0x681d('0x20')];var _0x5dca9a=_0x2d9ee8?0x0:_0x1812d1[_0x681d('0x1e')];var _0x32a1af=_0x2d9ee8?_0xac88af[_0x681d('0x20')]:_0x1812d1[_0x681d('0x1e')]+_0x1812d1[_0x681d('0x1f')];var _0x1ac45e;if(_0x32a1af>=_0x19b761){_0x32a1af=_0x19b761;_0x1ac45e=0xc8;}else{_0x1ac45e=0xce;}_0x2bd4f9[_0x681d('0x1b')](_0x1ac45e);return _0x2bd4f9[_0x681d('0x21')](_0x681d('0x22'),_0x5dca9a+'-'+_0x32a1af+'/'+_0x19b761)[_0x681d('0x1d')](_0xac88af);}return null;};}function patchUpdates(_0x3b2857){return function(_0x21373c){try{jsonpatch[_0x681d('0x23')](_0x21373c,_0x3b2857,!![]);}catch(_0x304f14){return BPromise['reject'](_0x304f14);}return _0x21373c[_0x681d('0x24')]();};}function saveUpdates(_0x119d04,_0x1abe40){return function(_0x473220){if(_0x473220){return _0x473220[_0x681d('0x25')](_0x119d04)[_0x681d('0x26')](function(_0x161885){return _0x161885;});}return null;};}function removeEntity(_0x36631b,_0x5c7c96){return function(_0x1f265c){if(_0x1f265c){return _0x1f265c[_0x681d('0x27')]()[_0x681d('0x26')](function(){_0x36631b['status'](0xcc)[_0x681d('0x1c')]();});}};}function handleEntityNotFound(_0x5abc7e,_0x186276){return function(_0x3c9c45){if(!_0x3c9c45){_0x5abc7e['sendStatus'](0x194);}return _0x3c9c45;};}function handleError(_0x56eaef,_0x5b4c23){_0x5b4c23=_0x5b4c23||0x1f4;return function(_0x2beaf7){logger[_0x681d('0x28')](_0x2beaf7['stack']);if(_0x2beaf7[_0x681d('0x29')]){delete _0x2beaf7[_0x681d('0x29')];}_0x56eaef[_0x681d('0x1b')](_0x5b4c23)['send'](_0x2beaf7);};}exports[_0x681d('0x2a')]=function(_0xeef998,_0xe782a6){var _0x2ea89={},_0x34948e={},_0x48b553={'count':0x0,'rows':[]};var _0x113475=_[_0x681d('0x2b')](db['VoiceMailMessage'][_0x681d('0x2c')],function(_0xeb71d8){return{'name':_0xeb71d8[_0x681d('0x2d')],'type':_0xeb71d8[_0x681d('0x2e')][_0x681d('0x2f')]};});_0x34948e['model']=_[_0x681d('0x30')](_['map'](_0x113475,_0x681d('0x29')),[_0x681d('0x29')]);_0x34948e['query']=_[_0x681d('0x31')](_0xeef998[_0x681d('0x32')]);_0x34948e[_0x681d('0x33')]=_[_0x681d('0x34')](_0x34948e[_0x681d('0x35')],_0x34948e[_0x681d('0x32')]);_0x2ea89[_0x681d('0x36')]=_[_0x681d('0x34')](_0x34948e[_0x681d('0x35')],qs['fields'](_0xeef998['query']['fields']));_0x2ea89[_0x681d('0x36')]=_0x2ea89[_0x681d('0x36')][_0x681d('0x37')]?_0x2ea89['attributes']:_0x34948e[_0x681d('0x35')];if(!_0xeef998[_0x681d('0x32')][_0x681d('0x38')](_0x681d('0x39'))){_0x2ea89[_0x681d('0x1f')]=qs[_0x681d('0x1f')](_0xeef998[_0x681d('0x32')][_0x681d('0x1f')]);_0x2ea89[_0x681d('0x1e')]=qs[_0x681d('0x1e')](_0xeef998['query']['offset']);}_0x2ea89[_0x681d('0x3a')]=qs[_0x681d('0x3b')](_0xeef998[_0x681d('0x32')]['sort']);_0x2ea89[_0x681d('0x3c')]=qs['filters'](_[_0x681d('0x3d')](_0xeef998[_0x681d('0x32')],_0x34948e[_0x681d('0x33')]),_0x113475);if(_0xeef998[_0x681d('0x32')][_0x681d('0x3e')]){_0x2ea89[_0x681d('0x3c')]=_[_0x681d('0x3f')](_0x2ea89[_0x681d('0x3c')],{'$or':_[_0x681d('0x2b')](_0x113475,function(_0x596f74){if(_0x596f74[_0x681d('0x2e')]!==_0x681d('0x40')){var _0x567f74={};_0x567f74[_0x596f74['name']]={'$like':'%'+_0xeef998[_0x681d('0x32')][_0x681d('0x3e')]+'%'};return _0x567f74;}})});}_0x2ea89=_[_0x681d('0x3f')]({},_0x2ea89,_0xeef998[_0x681d('0x41')]);var _0x541633={'where':_0x2ea89[_0x681d('0x3c')]};return db[_0x681d('0x42')][_0x681d('0x20')](_0x541633)[_0x681d('0x26')](function(_0x24069f){_0x48b553['count']=_0x24069f;if(_0xeef998[_0x681d('0x32')][_0x681d('0x43')]){_0x2ea89['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x681d('0x44')](_0x2ea89);})[_0x681d('0x26')](function(_0x3863d3){_0x48b553[_0x681d('0x45')]=_0x3863d3;return _0x48b553;})[_0x681d('0x26')](respondWithFilteredResult(_0xe782a6,_0x2ea89))['catch'](handleError(_0xe782a6,null));};exports['show']=function(_0x229cbe,_0x1d0edc){var _0x531dcb={'raw':!![],'where':{'id':_0x229cbe[_0x681d('0x46')]['id']}},_0x527e10={};_0x527e10[_0x681d('0x35')]=_[_0x681d('0x31')](db[_0x681d('0x42')][_0x681d('0x2c')]);_0x527e10[_0x681d('0x32')]=_['keys'](_0x229cbe[_0x681d('0x32')]);_0x527e10[_0x681d('0x33')]=_[_0x681d('0x34')](_0x527e10['model'],_0x527e10[_0x681d('0x32')]);_0x531dcb['attributes']=_['intersection'](_0x527e10[_0x681d('0x35')],qs[_0x681d('0x47')](_0x229cbe[_0x681d('0x32')]['fields']));_0x531dcb[_0x681d('0x36')]=_0x531dcb[_0x681d('0x36')][_0x681d('0x37')]?_0x531dcb[_0x681d('0x36')]:_0x527e10[_0x681d('0x35')];if(_0x229cbe[_0x681d('0x32')][_0x681d('0x43')]){_0x531dcb[_0x681d('0x48')]=[{'all':!![]}];}_0x531dcb=_['merge']({},_0x531dcb,_0x229cbe[_0x681d('0x41')]);return db[_0x681d('0x42')][_0x681d('0x49')](_0x531dcb)[_0x681d('0x26')](handleEntityNotFound(_0x1d0edc,null))['then'](respondWithResult(_0x1d0edc,null))[_0x681d('0x4a')](handleError(_0x1d0edc,null));};exports['create']=function(_0x4d8554,_0x2ab992){return db[_0x681d('0x42')]['create'](_0x4d8554[_0x681d('0x4b')],{})['then'](respondWithResult(_0x2ab992,0xc9))[_0x681d('0x4a')](handleError(_0x2ab992,null));};exports[_0x681d('0x25')]=function(_0xf1dbef,_0x7a2cea){if(_0xf1dbef[_0x681d('0x4b')]['id']){delete _0xf1dbef['body']['id'];}return db[_0x681d('0x42')]['find']({'where':{'id':_0xf1dbef['params']['id']}})[_0x681d('0x26')](handleEntityNotFound(_0x7a2cea,null))[_0x681d('0x26')](saveUpdates(_0xf1dbef[_0x681d('0x4b')],null))['then'](respondWithResult(_0x7a2cea,null))['catch'](handleError(_0x7a2cea,null));};exports[_0x681d('0x27')]=function(_0x3d5ad2,_0x3b5e04){return db[_0x681d('0x42')][_0x681d('0x49')]({'where':{'id':_0x3d5ad2['params']['id']}})[_0x681d('0x26')](handleEntityNotFound(_0x3b5e04,null))[_0x681d('0x26')](removeEntity(_0x3b5e04,null))[_0x681d('0x4a')](handleError(_0x3b5e04,null));};exports[_0x681d('0x4c')]=function(_0xf5b21b,_0x23623c,_0x298857){return db[_0x681d('0x42')]['find']({'where':{'id':_0xf5b21b[_0x681d('0x46')]['id']},'attributes':['id',_0x681d('0x4d'),'msg_id']})[_0x681d('0x26')](handleEntityNotFound(_0x23623c,null))[_0x681d('0x26')](function(_0x831034){if(_0x831034){if(!_0x831034[_0x681d('0x4d')]){throw new db[(_0x681d('0x4e'))]['ValidationError'](_0x681d('0x4f'));}var _0x2b2d3d={'Content-Type':_0x681d('0x50'),'Content-Disposition':'attachment'};if(_0x831034[_0x681d('0x51')]){_0x2b2d3d['Content-Disposition']='attachment;\x20filename=\x22'+_0x831034[_0x681d('0x51')]+_0x681d('0x52');}_0x23623c['set'](_0x2b2d3d);return _0x23623c[_0x681d('0x53')](new Buffer(_0x831034[_0x681d('0x4d')]));}})[_0x681d('0x4a')](handleError(_0x23623c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e9a7671..e9631f5 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 _0xa7f2=['api','moment','bluebird','request-promise','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','dir','lodash','../../config/logger'];(function(_0x2f7dfc,_0x12119f){var _0x5d1bc3=function(_0x4fb487){while(--_0x4fb487){_0x2f7dfc['push'](_0x2f7dfc['shift']());}};_0x5d1bc3(++_0x12119f);}(_0xa7f2,0x153));var _0x2a7f=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0xa7f2[_0x1fb1c1];return _0x1622df;};'use strict';var _=require(_0x2a7f('0x0'));var util=require('util');var logger=require(_0x2a7f('0x1'))(_0x2a7f('0x2'));var moment=require(_0x2a7f('0x3'));var BPromise=require(_0x2a7f('0x4'));var rp=require(_0x2a7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a7f('0x6'));var attributes=require(_0x2a7f('0x7'));module[_0x2a7f('0x8')]=function(_0x2db6e4,_0x1c1e09){return _0x2db6e4['define'](_0x2a7f('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x2a7f('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x509c=['lodash','util','../../config/logger','api','bluebird','path','rimraf','./voiceMailMessage.attributes','define','VoiceMailMessage','dir'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x509c,0x14a));var _0xc509=function(_0x4769ff,_0x127733){_0x4769ff=_0x4769ff-0x0;var _0x2362ba=_0x509c[_0x4769ff];return _0x2362ba;};'use strict';var _=require(_0xc509('0x0'));var util=require(_0xc509('0x1'));var logger=require(_0xc509('0x2'))(_0xc509('0x3'));var moment=require('moment');var BPromise=require(_0xc509('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc509('0x5'));var rimraf=require(_0xc509('0x6'));var config=require('../../config/environment');var attributes=require(_0xc509('0x7'));module['exports']=function(_0x21c88c,_0x4611ed){return _0x21c88c[_0xc509('0x8')](_0xc509('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xc509('0xa'),'fields':[_0xc509('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index cc3a9d3..d12cf30 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 _0x00fd=['jayson/promise','client','then','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x603220,_0x3428a9){var _0x135f2e=function(_0x5afbb8){while(--_0x5afbb8){_0x603220['push'](_0x603220['shift']());}};_0x135f2e(++_0x3428a9);}(_0x00fd,0xf2));var _0xd00f=function(_0x269382,_0x26a51a){_0x269382=_0x269382-0x0;var _0x5a1796=_0x00fd[_0x269382];return _0x5a1796;};'use strict';var _=require(_0xd00f('0x0'));var util=require('util');var moment=require(_0xd00f('0x1'));var BPromise=require(_0xd00f('0x2'));var rs=require(_0xd00f('0x3'));var fs=require('fs');var Redis=require(_0xd00f('0x4'));var db=require(_0xd00f('0x5'))['db'];var utils=require(_0xd00f('0x6'));var logger=require(_0xd00f('0x7'))(_0xd00f('0x8'));var config=require(_0xd00f('0x9'));var jayson=require(_0xd00f('0xa'));var client=jayson[_0xd00f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x529ca2,_0x2bb6d9,_0x573517){return new BPromise(function(_0x57839e,_0x58ac13){return client['request'](_0x529ca2,_0x573517)[_0xd00f('0xc')](function(_0x9b737a){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x2bb6d9,_0xd00f('0xd'));logger[_0xd00f('0xe')](_0xd00f('0xf'),_0x2bb6d9,_0xd00f('0xd'),JSON[_0xd00f('0x10')](_0x9b737a));if(_0x9b737a['error']){if(_0x9b737a[_0xd00f('0x11')]['code']===0x1f4){logger[_0xd00f('0x11')](_0xd00f('0x12'),_0x2bb6d9,_0x9b737a[_0xd00f('0x11')][_0xd00f('0x13')]);return _0x58ac13(_0x9b737a[_0xd00f('0x11')][_0xd00f('0x13')]);}logger[_0xd00f('0x11')](_0xd00f('0x12'),_0x2bb6d9,_0x9b737a['error']['message']);return _0x57839e(_0x9b737a[_0xd00f('0x11')]['message']);}else{logger['info'](_0xd00f('0x12'),_0x2bb6d9,_0xd00f('0xd'));_0x57839e(_0x9b737a['result'][_0xd00f('0x13')]);}})[_0xd00f('0x14')](function(_0x1b508c){logger[_0xd00f('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x2bb6d9,_0x1b508c);_0x58ac13(_0x1b508c);});});} \ No newline at end of file +var _0xce62=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x213c52,_0x3de966){var _0x38a46f=function(_0x339813){while(--_0x339813){_0x213c52['push'](_0x213c52['shift']());}};_0x38a46f(++_0x3de966);}(_0xce62,0x143));var _0x2ce6=function(_0x1eaf23,_0x3cbfe1){_0x1eaf23=_0x1eaf23-0x0;var _0xf2cecd=_0xce62[_0x1eaf23];return _0xf2cecd;};'use strict';var _=require(_0x2ce6('0x0'));var util=require('util');var moment=require(_0x2ce6('0x1'));var BPromise=require(_0x2ce6('0x2'));var rs=require(_0x2ce6('0x3'));var fs=require('fs');var Redis=require(_0x2ce6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ce6('0x5'));var logger=require(_0x2ce6('0x6'))(_0x2ce6('0x7'));var config=require(_0x2ce6('0x8'));var jayson=require(_0x2ce6('0x9'));var client=jayson[_0x2ce6('0xa')][_0x2ce6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a0818,_0x4d2f13,_0x36df82){return new BPromise(function(_0x427660,_0x1a3d9d){return client[_0x2ce6('0xc')](_0x4a0818,_0x36df82)[_0x2ce6('0xd')](function(_0x14a1b7){logger[_0x2ce6('0xe')](_0x2ce6('0xf'),_0x4d2f13,_0x2ce6('0x10'));logger[_0x2ce6('0x11')](_0x2ce6('0x12'),_0x4d2f13,_0x2ce6('0x10'),JSON['stringify'](_0x14a1b7));if(_0x14a1b7[_0x2ce6('0x13')]){if(_0x14a1b7['error'][_0x2ce6('0x14')]===0x1f4){logger[_0x2ce6('0x13')](_0x2ce6('0xf'),_0x4d2f13,_0x14a1b7[_0x2ce6('0x13')]['message']);return _0x1a3d9d(_0x14a1b7[_0x2ce6('0x13')]['message']);}logger[_0x2ce6('0x13')](_0x2ce6('0xf'),_0x4d2f13,_0x14a1b7[_0x2ce6('0x13')]['message']);return _0x427660(_0x14a1b7[_0x2ce6('0x13')][_0x2ce6('0x15')]);}else{logger[_0x2ce6('0xe')](_0x2ce6('0xf'),_0x4d2f13,_0x2ce6('0x10'));_0x427660(_0x14a1b7['result']['message']);}})[_0x2ce6('0x16')](function(_0x100988){logger[_0x2ce6('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x4d2f13,_0x100988);_0x1a3d9d(_0x100988);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b612c5c..b0f3ca5 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 _0x694d=['addSound','put','/:id','destroy','delete','/:id/sounds/:id2','removeSound','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/sounds','post','create'];(function(_0x35c9fc,_0x70dd21){var _0x26b364=function(_0x485376){while(--_0x485376){_0x35c9fc['push'](_0x35c9fc['shift']());}};_0x26b364(++_0x70dd21);}(_0x694d,0xe4));var _0xd694=function(_0x18cf29,_0x5519fc){_0x18cf29=_0x18cf29-0x0;var _0x45bb98=_0x694d[_0x18cf29];return _0x45bb98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd694('0x0'));var timeout=require('connect-timeout');var express=require(_0xd694('0x1'));var router=express[_0xd694('0x2')]();var fs_extra=require(_0xd694('0x3'));var auth=require(_0xd694('0x4'));var interaction=require(_0xd694('0x5'));var config=require(_0xd694('0x6'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xd694('0x7')](),controller[_0xd694('0x8')]);router[_0xd694('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd694('0xa')]);router['get'](_0xd694('0xb'),auth[_0xd694('0x7')](),controller['getSounds']);router[_0xd694('0xc')]('/',auth[_0xd694('0x7')](),controller[_0xd694('0xd')]);router[_0xd694('0xc')]('/:id/sounds',auth[_0xd694('0x7')](),controller[_0xd694('0xe')]);router[_0xd694('0xf')](_0xd694('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd694('0x7')](),controller[_0xd694('0x11')]);router[_0xd694('0x12')](_0xd694('0x13'),auth[_0xd694('0x7')](),controller[_0xd694('0x14')]);module[_0xd694('0x15')]=router; \ No newline at end of file +var _0x7bde=['index','get','/:id','isAuthenticated','show','getSounds','post','create','/:id/sounds','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x1f4807,_0x1196bc){var _0x41fe63=function(_0x1ec529){while(--_0x1ec529){_0x1f4807['push'](_0x1f4807['shift']());}};_0x41fe63(++_0x1196bc);}(_0x7bde,0x190));var _0xe7bd=function(_0x4776ba,_0x250658){_0x4776ba=_0x4776ba-0x0;var _0x354c17=_0x7bde[_0x4776ba];return _0x354c17;};'use strict';var multer=require('multer');var util=require(_0xe7bd('0x0'));var path=require('path');var timeout=require(_0xe7bd('0x1'));var express=require(_0xe7bd('0x2'));var router=express[_0xe7bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe7bd('0x4'));var interaction=require(_0xe7bd('0x5'));var config=require(_0xe7bd('0x6'));var controller=require(_0xe7bd('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe7bd('0x8')]);router[_0xe7bd('0x9')](_0xe7bd('0xa'),auth[_0xe7bd('0xb')](),controller[_0xe7bd('0xc')]);router[_0xe7bd('0x9')]('/:id/sounds',auth[_0xe7bd('0xb')](),controller[_0xe7bd('0xd')]);router[_0xe7bd('0xe')]('/',auth[_0xe7bd('0xb')](),controller[_0xe7bd('0xf')]);router[_0xe7bd('0xe')](_0xe7bd('0x10'),auth[_0xe7bd('0xb')](),controller['addSound']);router[_0xe7bd('0x11')](_0xe7bd('0xa'),auth[_0xe7bd('0xb')](),controller[_0xe7bd('0x12')]);router[_0xe7bd('0x13')](_0xe7bd('0xa'),auth[_0xe7bd('0xb')](),controller[_0xe7bd('0x14')]);router[_0xe7bd('0x13')](_0xe7bd('0x15'),auth[_0xe7bd('0xb')](),controller[_0xe7bd('0x16')]);module[_0xe7bd('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 3feee1d..f12edf4 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 _0xc1aa=['alpha','BOOLEAN','sequelize','exports','STRING','name','ENUM','files','quietmp3nb','quietmp3','mp3'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xc1aa,0x1f1));var _0xac1a=function(_0x2097f6,_0x58e112){_0x2097f6=_0x2097f6-0x0;var _0x29f00f=_0xc1aa[_0x2097f6];return _0x29f00f;};'use strict';var Sequelize=require(_0xac1a('0x0'));module[_0xac1a('0x1')]={'name':{'type':Sequelize[_0xac1a('0x2')],'allowNull':![],'unique':_0xac1a('0x3')},'mode':{'type':Sequelize[_0xac1a('0x4')]('custom',_0xac1a('0x5'),'mp3nb',_0xac1a('0x6'),_0xac1a('0x7'),_0xac1a('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xac1a('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xac1a('0x2')],'allowNull':!![],'defaultValue':_0xac1a('0x9')},'format':{'type':Sequelize[_0xac1a('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xac1a('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x21ea=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP'];(function(_0x38d27f,_0x413200){var _0x149891=function(_0x41b104){while(--_0x41b104){_0x38d27f['push'](_0x38d27f['shift']());}};_0x149891(++_0x413200);}(_0x21ea,0x139));var _0xa21e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x21ea[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xa21e('0x0'));module[_0xa21e('0x1')]={'name':{'type':Sequelize[_0xa21e('0x2')],'allowNull':![],'unique':_0xa21e('0x3')},'mode':{'type':Sequelize[_0xa21e('0x4')](_0xa21e('0x5'),_0xa21e('0x6'),_0xa21e('0x7'),_0xa21e('0x8'),'quietmp3',_0xa21e('0x9')),'allowNull':!![],'defaultValue':_0xa21e('0x6')},'directory':{'type':Sequelize[_0xa21e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa21e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa21e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa21e('0xa')},'format':{'type':Sequelize[_0xa21e('0x2')],'allowNull':!![]},'stamp':{'type':_0xa21e('0xb')},'defaultEntry':{'type':Sequelize[_0xa21e('0xc')],'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 bdb21ad..1d93ab5 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 _0x83c9=['include','findAll','rows','catch','show','params','keys','length','body','find','sequelize','transaction','directory','join','root','server/files/moh','create','mode','files','mkdirSync','0777','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','extname','%s.%s','removeSound','id2','Sound','nolimit','getSounds','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','end','stack','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x2845be,_0x52a939){var _0x8ff693=function(_0x5a0adc){while(--_0x5a0adc){_0x2845be['push'](_0x2845be['shift']());}};_0x8ff693(++_0x52a939);}(_0x83c9,0xa3));var _0x983c=function(_0x13dd37,_0x1a62d7){_0x13dd37=_0x13dd37-0x0;var _0x4018ef=_0x83c9[_0x13dd37];return _0x4018ef;};'use strict';var emlformat=require(_0x983c('0x0'));var rimraf=require(_0x983c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x983c('0x2'));var rp=require(_0x983c('0x3'));var moment=require(_0x983c('0x4'));var BPromise=require(_0x983c('0x5'));var Mustache=require(_0x983c('0x6'));var util=require(_0x983c('0x7'));var path=require('path');var sox=require(_0x983c('0x8'));var csv=require(_0x983c('0x9'));var ejs=require(_0x983c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x983c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x983c('0xc'));var deskjs=require(_0x983c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x983c('0xe'));var Papa=require('papaparse');var Redis=require(_0x983c('0xf'));var authService=require(_0x983c('0x10'));var qs=require(_0x983c('0x11'));var as=require(_0x983c('0x12'));var hardwareService=require(_0x983c('0x13'));var logger=require(_0x983c('0x14'))(_0x983c('0x15'));var utils=require(_0x983c('0x16'));var config=require(_0x983c('0x17'));var licenseUtil=require(_0x983c('0x18'));var db=require(_0x983c('0x19'))['db'];function respondWithStatusCode(_0x3b2f12,_0x372524){_0x372524=_0x372524||0xcc;return function(_0x5b2827){if(_0x5b2827){return _0x3b2f12[_0x983c('0x1a')](_0x372524);}return _0x3b2f12['status'](_0x372524)['end']();};}function respondWithResult(_0x2bef78,_0x105970){_0x105970=_0x105970||0xc8;return function(_0x3aa9fa){if(_0x3aa9fa){return _0x2bef78[_0x983c('0x1b')](_0x105970)[_0x983c('0x1c')](_0x3aa9fa);}};}function respondWithFilteredResult(_0x1819d1,_0x4c809e){return function(_0xbc5270){if(_0xbc5270){var _0x1bd660=typeof _0x4c809e[_0x983c('0x1d')]===_0x983c('0x1e')&&typeof _0x4c809e[_0x983c('0x1f')]===_0x983c('0x1e');var _0x5ab0c2=_0xbc5270[_0x983c('0x20')];var _0x3df50b=_0x1bd660?0x0:_0x4c809e['offset'];var _0x5dfe78=_0x1bd660?_0xbc5270[_0x983c('0x20')]:_0x4c809e[_0x983c('0x1d')]+_0x4c809e[_0x983c('0x1f')];var _0x3f90da;if(_0x5dfe78>=_0x5ab0c2){_0x5dfe78=_0x5ab0c2;_0x3f90da=0xc8;}else{_0x3f90da=0xce;}_0x1819d1[_0x983c('0x1b')](_0x3f90da);return _0x1819d1[_0x983c('0x21')](_0x983c('0x22'),_0x3df50b+'-'+_0x5dfe78+'/'+_0x5ab0c2)[_0x983c('0x1c')](_0xbc5270);}return null;};}function patchUpdates(_0x218f87){return function(_0x5851bf){try{jsonpatch[_0x983c('0x23')](_0x5851bf,_0x218f87,!![]);}catch(_0x13607c){return BPromise['reject'](_0x13607c);}return _0x5851bf[_0x983c('0x24')]();};}function saveUpdates(_0x20febf,_0x1c6df9){return function(_0x2381fd){if(_0x2381fd){return _0x2381fd[_0x983c('0x25')](_0x20febf)['then'](function(_0x434372){return _0x434372;});}return null;};}function removeEntity(_0x188641,_0xdd3573){return function(_0x4bd91b){if(_0x4bd91b){return _0x4bd91b[_0x983c('0x26')]()[_0x983c('0x27')](function(){var _0x45812c=_0x4bd91b[_0x983c('0x28')]({'plain':!![]});var _0x1debfb='MusicOnHolds';return db['UserProfileResource'][_0x983c('0x26')]({'where':{'type':_0x1debfb,'resourceId':_0x45812c['id']}})['then'](function(){return _0x4bd91b;});})[_0x983c('0x27')](function(){_0x188641[_0x983c('0x1b')](0xcc)[_0x983c('0x29')]();});}};}function handleEntityNotFound(_0x3cd8b8,_0x909c27){return function(_0x127401){if(!_0x127401){_0x3cd8b8['sendStatus'](0x194);}return _0x127401;};}function handleError(_0x510f4f,_0x141550){_0x141550=_0x141550||0x1f4;return function(_0x27694f){logger['error'](_0x27694f[_0x983c('0x2a')]);if(_0x27694f['name']){delete _0x27694f['name'];}_0x510f4f[_0x983c('0x1b')](_0x141550)['send'](_0x27694f);};}exports[_0x983c('0x2b')]=function(_0x2a1cfc,_0x373b89){var _0x584aa1={},_0x3d6788={},_0x332758={'count':0x0,'rows':[]};var _0x2aad9e=_[_0x983c('0x2c')](db[_0x983c('0x2d')][_0x983c('0x2e')],function(_0x1ad24d){return{'name':_0x1ad24d['fieldName'],'type':_0x1ad24d[_0x983c('0x2f')][_0x983c('0x30')]};});_0x3d6788[_0x983c('0x31')]=_[_0x983c('0x2c')](_0x2aad9e,_0x983c('0x32'));_0x3d6788['query']=_['keys'](_0x2a1cfc['query']);_0x3d6788[_0x983c('0x33')]=_[_0x983c('0x34')](_0x3d6788['model'],_0x3d6788[_0x983c('0x35')]);_0x584aa1[_0x983c('0x36')]=_['intersection'](_0x3d6788[_0x983c('0x31')],qs[_0x983c('0x37')](_0x2a1cfc['query'][_0x983c('0x37')]));_0x584aa1[_0x983c('0x36')]=_0x584aa1[_0x983c('0x36')]['length']?_0x584aa1['attributes']:_0x3d6788[_0x983c('0x31')];if(!_0x2a1cfc['query']['hasOwnProperty']('nolimit')){_0x584aa1[_0x983c('0x1f')]=qs[_0x983c('0x1f')](_0x2a1cfc[_0x983c('0x35')][_0x983c('0x1f')]);_0x584aa1[_0x983c('0x1d')]=qs[_0x983c('0x1d')](_0x2a1cfc[_0x983c('0x35')][_0x983c('0x1d')]);}_0x584aa1[_0x983c('0x38')]=qs[_0x983c('0x39')](_0x2a1cfc[_0x983c('0x35')][_0x983c('0x39')]);delete _0x2a1cfc[_0x983c('0x35')][_0x983c('0x39')];_0x584aa1[_0x983c('0x3a')]=qs[_0x983c('0x33')](_[_0x983c('0x3b')](_0x2a1cfc[_0x983c('0x35')],_0x3d6788[_0x983c('0x33')]),_0x2aad9e);if(_0x2a1cfc[_0x983c('0x35')][_0x983c('0x3c')]){_0x584aa1[_0x983c('0x3a')]=_[_0x983c('0x3d')](_0x584aa1['where'],{'$or':_[_0x983c('0x2c')](_0x2aad9e,function(_0x7b41c8){if(_0x7b41c8[_0x983c('0x2f')]!==_0x983c('0x3e')){var _0x11eb3b={};_0x11eb3b[_0x7b41c8[_0x983c('0x32')]]={'$like':'%'+_0x2a1cfc[_0x983c('0x35')][_0x983c('0x3c')]+'%'};return _0x11eb3b;}})});}_0x584aa1=_[_0x983c('0x3d')]({},_0x584aa1,_0x2a1cfc[_0x983c('0x3f')]);var _0x4f10a6={'where':_0x584aa1['where']};return db[_0x983c('0x2d')][_0x983c('0x20')](_0x4f10a6)[_0x983c('0x27')](function(_0xe3d84c){_0x332758[_0x983c('0x20')]=_0xe3d84c;if(_0x2a1cfc['query'][_0x983c('0x40')]){_0x584aa1[_0x983c('0x41')]=[{'all':!![]}];}return db[_0x983c('0x2d')][_0x983c('0x42')](_0x584aa1);})[_0x983c('0x27')](function(_0x4b714f){_0x332758[_0x983c('0x43')]=_0x4b714f;return _0x332758;})['then'](respondWithFilteredResult(_0x373b89,_0x584aa1))[_0x983c('0x44')](handleError(_0x373b89,null));};exports[_0x983c('0x45')]=function(_0x242a8d,_0x222aa2){var _0x33d3da={'raw':![],'where':{'id':_0x242a8d[_0x983c('0x46')]['id']}},_0x4b5b1d={};_0x4b5b1d[_0x983c('0x31')]=_[_0x983c('0x47')](db[_0x983c('0x2d')][_0x983c('0x2e')]);_0x4b5b1d['query']=_[_0x983c('0x47')](_0x242a8d[_0x983c('0x35')]);_0x4b5b1d[_0x983c('0x33')]=_[_0x983c('0x34')](_0x4b5b1d['model'],_0x4b5b1d['query']);_0x33d3da[_0x983c('0x36')]=_[_0x983c('0x34')](_0x4b5b1d[_0x983c('0x31')],qs[_0x983c('0x37')](_0x242a8d['query'][_0x983c('0x37')]));_0x33d3da[_0x983c('0x36')]=_0x33d3da[_0x983c('0x36')][_0x983c('0x48')]?_0x33d3da[_0x983c('0x36')]:_0x4b5b1d[_0x983c('0x31')];if(_0x242a8d[_0x983c('0x35')][_0x983c('0x40')]){_0x33d3da[_0x983c('0x41')]=[{'all':!![]}];}_0x33d3da=_['merge']({},_0x33d3da,_0x242a8d[_0x983c('0x3f')]);return db[_0x983c('0x2d')]['find'](_0x33d3da)['then'](handleEntityNotFound(_0x222aa2,null))['then'](respondWithResult(_0x222aa2,null))[_0x983c('0x44')](handleError(_0x222aa2,null));};exports[_0x983c('0x25')]=function(_0x3e27f1,_0x587795){if(_0x3e27f1[_0x983c('0x49')]['id']){delete _0x3e27f1[_0x983c('0x49')]['id'];}return db[_0x983c('0x2d')][_0x983c('0x4a')]({'where':{'id':_0x3e27f1[_0x983c('0x46')]['id']}})[_0x983c('0x27')](handleEntityNotFound(_0x587795,null))[_0x983c('0x27')](saveUpdates(_0x3e27f1[_0x983c('0x49')],null))[_0x983c('0x27')](respondWithResult(_0x587795,null))['catch'](handleError(_0x587795,null));};exports['create']=function(_0x13f31f,_0x274214,_0x59d2ef){return db[_0x983c('0x4b')][_0x983c('0x4c')](function(_0x530e0e){if(_0x13f31f[_0x983c('0x49')]['mode']==='files'){_0x13f31f['body'][_0x983c('0x4d')]=path[_0x983c('0x4e')](config[_0x983c('0x4f')],_0x983c('0x50'),_0x13f31f[_0x983c('0x49')]['name']);}return db[_0x983c('0x2d')][_0x983c('0x51')](_0x13f31f[_0x983c('0x49')],{'transaction':_0x530e0e})[_0x983c('0x27')](function(_0x16bfbb){if(_0x13f31f[_0x983c('0x49')][_0x983c('0x52')]===_0x983c('0x53')){fs[_0x983c('0x54')](_0x16bfbb[_0x983c('0x4d')],parseInt(_0x983c('0x55'),0x8));}var _0x4ca345=_0x13f31f['user']['get']({'plain':!![]});if(!_0x4ca345)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ca345['role']===_0x983c('0x56')){var _0x5a5b99=_0x16bfbb['get']({'plain':!![]});return db[_0x983c('0x57')][_0x983c('0x4a')]({'where':{'name':_0x983c('0x58'),'userProfileId':_0x4ca345[_0x983c('0x59')]},'raw':!![]})[_0x983c('0x27')](function(_0x19f50d){if(_0x19f50d&&_0x19f50d[_0x983c('0x5a')]===0x0){return db[_0x983c('0x5b')][_0x983c('0x51')]({'name':_0x5a5b99[_0x983c('0x32')],'resourceId':_0x5a5b99['id'],'type':_0x19f50d[_0x983c('0x32')],'sectionId':_0x19f50d['id']},{})[_0x983c('0x27')](function(){return _0x16bfbb;});}else{return _0x16bfbb;}})[_0x983c('0x44')](function(_0xe2e95f){logger['error'](_0x983c('0x5c'),_0xe2e95f);});}return _0x16bfbb;});})[_0x983c('0x27')](respondWithResult(_0x274214,0xc9))[_0x983c('0x44')](handleError(_0x274214,null));};exports['destroy']=function(_0xafe7a0,_0x451d5c,_0x59e98a){var _0x25468e;return db[_0x983c('0x2d')][_0x983c('0x4a')]({'where':{'id':_0xafe7a0['params']['id']}})['then'](function(_0x570ea5){if(_0x570ea5){return db[_0x983c('0x4b')]['transaction'](function(_0x28997e){return _0x570ea5[_0x983c('0x26')]({'transaction':_0x28997e,'raw':!![]})[_0x983c('0x27')](function(_0x34d1fe){if(_0x34d1fe[_0x983c('0x4d')]){fs[_0x983c('0x5d')](_0x34d1fe['directory'])[_0x983c('0x5e')](function(_0x3d72b6){fs['unlinkSync'](path[_0x983c('0x4e')](_0x34d1fe[_0x983c('0x4d')],_0x3d72b6));});fs[_0x983c('0x5f')](_0x34d1fe[_0x983c('0x4d')]);}return _0x34d1fe;});})[_0x983c('0x44')](function(_0x25343f){throw new db[(_0x983c('0x60'))][(_0x983c('0x61'))](_0x25343f[_0x983c('0x62')]);});}})[_0x983c('0x27')](handleEntityNotFound(_0x451d5c,null))['then'](removeEntity(_0x451d5c,null))['catch'](handleError(_0x451d5c,null));};exports[_0x983c('0x63')]=function(_0xd76921,_0x19360a,_0xf1bf6){return db[_0x983c('0x4b')][_0x983c('0x4c')](function(_0xe5623e){var _0x3674fe;return db[_0x983c('0x2d')][_0x983c('0x4a')]({'where':{'id':_0xd76921[_0x983c('0x46')]['id']}})['then'](function(_0x15e88c){if(_0x15e88c){_0x3674fe=_0x15e88c;return _0x15e88c[_0x983c('0x63')](_0xd76921[_0x983c('0x49')]['id'],{'transaction':_0xe5623e});}})[_0x983c('0x27')](function(_0x861138){if(_0x861138){return db['Sound'][_0x983c('0x64')]({'where':{'id':_0xd76921['body']['id']},'attributes':['id','name',_0x983c('0x65'),_0x983c('0x66'),_0x983c('0x67')],'raw':!![]});}})[_0x983c('0x27')](function(_0x325536){if(_0x325536){var _0x114a2e=path['join'](config[_0x983c('0x4f')],_0x983c('0x68'),util[_0x983c('0x69')]('%s.%s',path[_0x983c('0x6a')](_0x325536[_0x983c('0x65')],path[_0x983c('0x6b')](_0x325536[_0x983c('0x65')])),_0x325536[_0x983c('0x66')]));var _0x3d9860=path[_0x983c('0x4e')](config[_0x983c('0x4f')],_0x983c('0x50'),_0x3674fe['name'],util['format'](_0x983c('0x6c'),_0x325536[_0x983c('0x32')],_0x325536[_0x983c('0x66')]));fs['symlinkSync'](_0x114a2e,_0x3d9860);return _0x325536;}})['catch'](function(_0x11980b){throw new db['Sequelize'][(_0x983c('0x61'))](_0x11980b[_0x983c('0x62')]);});})['then'](handleEntityNotFound(_0x19360a,null))[_0x983c('0x27')](respondWithResult(_0x19360a,0xc9))[_0x983c('0x44')](handleError(_0x19360a,null));};exports[_0x983c('0x6d')]=function(_0x1edbb9,_0x37bec8,_0x12864b){return db[_0x983c('0x4b')][_0x983c('0x4c')](function(_0x550260){var _0x150e7a;return db[_0x983c('0x2d')][_0x983c('0x64')]({'where':{'id':_0x1edbb9[_0x983c('0x46')]['id']}})['then'](handleEntityNotFound(_0x37bec8,null))[_0x983c('0x27')](function(_0x4ddfee){if(_0x4ddfee){_0x150e7a=_0x4ddfee;return _0x4ddfee[_0x983c('0x6d')](_0x1edbb9[_0x983c('0x46')][_0x983c('0x6e')]);}})[_0x983c('0x27')](function(_0x261c44){if(_0x261c44){return db[_0x983c('0x6f')]['findOne']({'where':{'id':_0x1edbb9['params'][_0x983c('0x6e')]},'attributes':['id','name',_0x983c('0x65'),_0x983c('0x66'),_0x983c('0x67')],'raw':!![]});}})['then'](function(_0x32be9a){if(_0x32be9a){fs['unlinkSync'](path[_0x983c('0x4e')](_0x150e7a[_0x983c('0x4d')],util[_0x983c('0x69')](_0x983c('0x6c'),_0x32be9a[_0x983c('0x32')],_0x32be9a['converted_format'])));return _0x32be9a;}})[_0x983c('0x44')](function(_0x13d777){throw new db[(_0x983c('0x60'))][(_0x983c('0x61'))](_0x13d777[_0x983c('0x62')]);});})[_0x983c('0x27')](handleEntityNotFound(_0x37bec8,null))[_0x983c('0x27')](respondWithStatusCode(_0x37bec8,0xcc))['catch'](handleError(_0x37bec8,null));};exports['getSounds']=function(_0x1e6102,_0xd6b14f,_0x1c807d){var _0x45cd74={};var _0x2e44b1={};var _0x5f2ca5;var _0xe05776;return db[_0x983c('0x2d')][_0x983c('0x64')]({'where':{'id':_0x1e6102['params']['id']}})[_0x983c('0x27')](handleEntityNotFound(_0xd6b14f,null))[_0x983c('0x27')](function(_0x40914a){if(_0x40914a){_0x5f2ca5=_0x40914a;_0x2e44b1[_0x983c('0x31')]=_[_0x983c('0x47')](db[_0x983c('0x6f')]['rawAttributes']);_0x2e44b1[_0x983c('0x35')]=_[_0x983c('0x47')](_0x1e6102['query']);_0x2e44b1['filters']=_[_0x983c('0x34')](_0x2e44b1[_0x983c('0x31')],_0x2e44b1[_0x983c('0x35')]);_0x45cd74[_0x983c('0x36')]=_[_0x983c('0x34')](_0x2e44b1[_0x983c('0x31')],qs['fields'](_0x1e6102[_0x983c('0x35')]['fields']));_0x45cd74[_0x983c('0x36')]=_0x45cd74[_0x983c('0x36')][_0x983c('0x48')]?_0x45cd74[_0x983c('0x36')]:_0x2e44b1[_0x983c('0x31')];_0x45cd74['order']=qs[_0x983c('0x39')](_0x1e6102[_0x983c('0x35')]['sort']);_0x45cd74[_0x983c('0x3a')]=qs[_0x983c('0x33')](_[_0x983c('0x3b')](_0x1e6102[_0x983c('0x35')],_0x2e44b1[_0x983c('0x33')]));if(_0x1e6102[_0x983c('0x35')][_0x983c('0x3c')]){_0x45cd74[_0x983c('0x3a')]=_['merge'](_0x45cd74[_0x983c('0x3a')],{'$or':_[_0x983c('0x2c')](_0x45cd74[_0x983c('0x36')],function(_0x5e0da4){var _0x524604={};_0x524604[_0x5e0da4]={'$like':'%'+_0x1e6102[_0x983c('0x35')][_0x983c('0x3c')]+'%'};return _0x524604;})});}_0x45cd74=_[_0x983c('0x3d')]({},_0x45cd74,_0x1e6102[_0x983c('0x3f')]);return _0x5f2ca5['getSounds'](_0x45cd74);}})['then'](function(_0x429add){if(_0x429add){_0xe05776=_0x429add['length'];if(!_0x1e6102[_0x983c('0x35')]['hasOwnProperty'](_0x983c('0x70'))){_0x45cd74['limit']=qs[_0x983c('0x1f')](_0x1e6102[_0x983c('0x35')][_0x983c('0x1f')]);_0x45cd74[_0x983c('0x1d')]=qs['offset'](_0x1e6102[_0x983c('0x35')]['offset']);}return _0x5f2ca5[_0x983c('0x71')](_0x45cd74);}})[_0x983c('0x27')](function(_0x354f5e){if(_0x354f5e){return _0x354f5e?{'count':_0xe05776,'rows':_0x354f5e}:null;}})[_0x983c('0x27')](respondWithResult(_0xd6b14f,null))[_0x983c('0x44')](handleError(_0xd6b14f,null));}; \ No newline at end of file +var _0xb062=['format','extname','%s.%s','removeSound','id2','unlinkSync','getSounds','nolimit','eml-format','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','intersection','length','body','params','create','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize','transaction','Sound','findOne','save_name','converted_format','createdAt'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xb062,0x14c));var _0x2b06=function(_0x156653,_0x36f82c){_0x156653=_0x156653-0x0;var _0x1ce075=_0xb062[_0x156653];return _0x1ce075;};'use strict';var emlformat=require(_0x2b06('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b06('0x1'));var jsonpatch=require(_0x2b06('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2b06('0x3'));var path=require(_0x2b06('0x4'));var sox=require('sox');var csv=require(_0x2b06('0x5'));var ejs=require(_0x2b06('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b06('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b06('0x8'));var deskjs=require(_0x2b06('0x9'));var toCsv=require('to-csv');var querystring=require(_0x2b06('0xa'));var Papa=require(_0x2b06('0xb'));var Redis=require(_0x2b06('0xc'));var authService=require(_0x2b06('0xd'));var qs=require(_0x2b06('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b06('0xf'));var logger=require('../../config/logger')(_0x2b06('0x10'));var utils=require(_0x2b06('0x11'));var config=require(_0x2b06('0x12'));var licenseUtil=require(_0x2b06('0x13'));var db=require(_0x2b06('0x14'))['db'];function respondWithStatusCode(_0x48b8ea,_0x437de2){_0x437de2=_0x437de2||0xcc;return function(_0x1f8bc0){if(_0x1f8bc0){return _0x48b8ea['sendStatus'](_0x437de2);}return _0x48b8ea['status'](_0x437de2)[_0x2b06('0x15')]();};}function respondWithResult(_0x100b57,_0x39fe6d){_0x39fe6d=_0x39fe6d||0xc8;return function(_0x3b149a){if(_0x3b149a){return _0x100b57[_0x2b06('0x16')](_0x39fe6d)[_0x2b06('0x17')](_0x3b149a);}};}function respondWithFilteredResult(_0x385672,_0x497011){return function(_0x563517){if(_0x563517){var _0x238127=typeof _0x497011[_0x2b06('0x18')]===_0x2b06('0x19')&&typeof _0x497011[_0x2b06('0x1a')]===_0x2b06('0x19');var _0x5c41fe=_0x563517['count'];var _0x32de32=_0x238127?0x0:_0x497011[_0x2b06('0x18')];var _0x393f5f=_0x238127?_0x563517[_0x2b06('0x1b')]:_0x497011['offset']+_0x497011[_0x2b06('0x1a')];var _0x54f62;if(_0x393f5f>=_0x5c41fe){_0x393f5f=_0x5c41fe;_0x54f62=0xc8;}else{_0x54f62=0xce;}_0x385672['status'](_0x54f62);return _0x385672[_0x2b06('0x1c')](_0x2b06('0x1d'),_0x32de32+'-'+_0x393f5f+'/'+_0x5c41fe)[_0x2b06('0x17')](_0x563517);}return null;};}function patchUpdates(_0x292ffe){return function(_0x1cc4e0){try{jsonpatch['apply'](_0x1cc4e0,_0x292ffe,!![]);}catch(_0x1d01e1){return BPromise['reject'](_0x1d01e1);}return _0x1cc4e0[_0x2b06('0x1e')]();};}function saveUpdates(_0x3cc154,_0x5df13d){return function(_0x55602f){if(_0x55602f){return _0x55602f[_0x2b06('0x1f')](_0x3cc154)['then'](function(_0x5863ed){return _0x5863ed;});}return null;};}function removeEntity(_0x5b56c3,_0x18894e){return function(_0x504d28){if(_0x504d28){return _0x504d28['destroy']()[_0x2b06('0x20')](function(){var _0x309b49=_0x504d28[_0x2b06('0x21')]({'plain':!![]});var _0x5ca8e2=_0x2b06('0x22');return db[_0x2b06('0x23')][_0x2b06('0x24')]({'where':{'type':_0x5ca8e2,'resourceId':_0x309b49['id']}})[_0x2b06('0x20')](function(){return _0x504d28;});})[_0x2b06('0x20')](function(){_0x5b56c3[_0x2b06('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44660d,_0x118808){return function(_0x50b2db){if(!_0x50b2db){_0x44660d['sendStatus'](0x194);}return _0x50b2db;};}function handleError(_0x2b6cff,_0x977a77){_0x977a77=_0x977a77||0x1f4;return function(_0x5e2a1f){logger[_0x2b06('0x25')](_0x5e2a1f['stack']);if(_0x5e2a1f[_0x2b06('0x26')]){delete _0x5e2a1f[_0x2b06('0x26')];}_0x2b6cff['status'](_0x977a77)[_0x2b06('0x27')](_0x5e2a1f);};}exports[_0x2b06('0x28')]=function(_0x10649c,_0x28acaa){var _0x4db73e={},_0x49e2ad={},_0x4671cd={'count':0x0,'rows':[]};var _0xb09ca7=_[_0x2b06('0x29')](db[_0x2b06('0x2a')][_0x2b06('0x2b')],function(_0x1465bb){return{'name':_0x1465bb[_0x2b06('0x2c')],'type':_0x1465bb[_0x2b06('0x2d')]['key']};});_0x49e2ad[_0x2b06('0x2e')]=_[_0x2b06('0x29')](_0xb09ca7,_0x2b06('0x26'));_0x49e2ad[_0x2b06('0x2f')]=_['keys'](_0x10649c['query']);_0x49e2ad[_0x2b06('0x30')]=_['intersection'](_0x49e2ad[_0x2b06('0x2e')],_0x49e2ad[_0x2b06('0x2f')]);_0x4db73e[_0x2b06('0x31')]=_['intersection'](_0x49e2ad[_0x2b06('0x2e')],qs['fields'](_0x10649c[_0x2b06('0x2f')][_0x2b06('0x32')]));_0x4db73e[_0x2b06('0x31')]=_0x4db73e[_0x2b06('0x31')]['length']?_0x4db73e[_0x2b06('0x31')]:_0x49e2ad[_0x2b06('0x2e')];if(!_0x10649c[_0x2b06('0x2f')][_0x2b06('0x33')]('nolimit')){_0x4db73e[_0x2b06('0x1a')]=qs[_0x2b06('0x1a')](_0x10649c[_0x2b06('0x2f')]['limit']);_0x4db73e[_0x2b06('0x18')]=qs[_0x2b06('0x18')](_0x10649c['query'][_0x2b06('0x18')]);}_0x4db73e[_0x2b06('0x34')]=qs[_0x2b06('0x35')](_0x10649c[_0x2b06('0x2f')][_0x2b06('0x35')]);delete _0x10649c[_0x2b06('0x2f')]['sort'];_0x4db73e[_0x2b06('0x36')]=qs[_0x2b06('0x30')](_[_0x2b06('0x37')](_0x10649c[_0x2b06('0x2f')],_0x49e2ad[_0x2b06('0x30')]),_0xb09ca7);if(_0x10649c[_0x2b06('0x2f')][_0x2b06('0x38')]){_0x4db73e[_0x2b06('0x36')]=_[_0x2b06('0x39')](_0x4db73e[_0x2b06('0x36')],{'$or':_[_0x2b06('0x29')](_0xb09ca7,function(_0x19c479){if(_0x19c479[_0x2b06('0x2d')]!=='VIRTUAL'){var _0x2c5517={};_0x2c5517[_0x19c479['name']]={'$like':'%'+_0x10649c['query']['filter']+'%'};return _0x2c5517;}})});}_0x4db73e=_['merge']({},_0x4db73e,_0x10649c[_0x2b06('0x3a')]);var _0x40a7a7={'where':_0x4db73e['where']};return db[_0x2b06('0x2a')][_0x2b06('0x1b')](_0x40a7a7)[_0x2b06('0x20')](function(_0x4ca9cb){_0x4671cd[_0x2b06('0x1b')]=_0x4ca9cb;if(_0x10649c[_0x2b06('0x2f')][_0x2b06('0x3b')]){_0x4db73e[_0x2b06('0x3c')]=[{'all':!![]}];}return db[_0x2b06('0x2a')][_0x2b06('0x3d')](_0x4db73e);})[_0x2b06('0x20')](function(_0x3ab0ae){_0x4671cd[_0x2b06('0x3e')]=_0x3ab0ae;return _0x4671cd;})[_0x2b06('0x20')](respondWithFilteredResult(_0x28acaa,_0x4db73e))[_0x2b06('0x3f')](handleError(_0x28acaa,null));};exports[_0x2b06('0x40')]=function(_0x217271,_0x31af25){var _0x35eb94={'raw':![],'where':{'id':_0x217271['params']['id']}},_0x589b78={};_0x589b78[_0x2b06('0x2e')]=_[_0x2b06('0x41')](db[_0x2b06('0x2a')]['rawAttributes']);_0x589b78[_0x2b06('0x2f')]=_[_0x2b06('0x41')](_0x217271['query']);_0x589b78[_0x2b06('0x30')]=_[_0x2b06('0x42')](_0x589b78[_0x2b06('0x2e')],_0x589b78['query']);_0x35eb94[_0x2b06('0x31')]=_[_0x2b06('0x42')](_0x589b78['model'],qs['fields'](_0x217271[_0x2b06('0x2f')]['fields']));_0x35eb94[_0x2b06('0x31')]=_0x35eb94[_0x2b06('0x31')][_0x2b06('0x43')]?_0x35eb94[_0x2b06('0x31')]:_0x589b78[_0x2b06('0x2e')];if(_0x217271[_0x2b06('0x2f')]['includeAll']){_0x35eb94['include']=[{'all':!![]}];}_0x35eb94=_[_0x2b06('0x39')]({},_0x35eb94,_0x217271['options']);return db[_0x2b06('0x2a')]['find'](_0x35eb94)[_0x2b06('0x20')](handleEntityNotFound(_0x31af25,null))[_0x2b06('0x20')](respondWithResult(_0x31af25,null))[_0x2b06('0x3f')](handleError(_0x31af25,null));};exports[_0x2b06('0x1f')]=function(_0x554b90,_0x5f1c60){if(_0x554b90[_0x2b06('0x44')]['id']){delete _0x554b90[_0x2b06('0x44')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x554b90[_0x2b06('0x45')]['id']}})[_0x2b06('0x20')](handleEntityNotFound(_0x5f1c60,null))['then'](saveUpdates(_0x554b90[_0x2b06('0x44')],null))[_0x2b06('0x20')](respondWithResult(_0x5f1c60,null))[_0x2b06('0x3f')](handleError(_0x5f1c60,null));};exports[_0x2b06('0x46')]=function(_0x4c60f5,_0xb6303,_0x9e1d2b){return db['sequelize']['transaction'](function(_0x5b47cf){if(_0x4c60f5['body']['mode']===_0x2b06('0x47')){_0x4c60f5['body']['directory']=path[_0x2b06('0x48')](config[_0x2b06('0x49')],_0x2b06('0x4a'),_0x4c60f5['body'][_0x2b06('0x26')]);}return db[_0x2b06('0x2a')][_0x2b06('0x46')](_0x4c60f5[_0x2b06('0x44')],{'transaction':_0x5b47cf})[_0x2b06('0x20')](function(_0x21c11f){if(_0x4c60f5['body'][_0x2b06('0x4b')]===_0x2b06('0x47')){fs[_0x2b06('0x4c')](_0x21c11f[_0x2b06('0x4d')],parseInt(_0x2b06('0x4e'),0x8));}var _0x560df8=_0x4c60f5[_0x2b06('0x4f')][_0x2b06('0x21')]({'plain':!![]});if(!_0x560df8)throw new Error(_0x2b06('0x50'));if(_0x560df8[_0x2b06('0x51')]==='user'){var _0x32fea3=_0x21c11f[_0x2b06('0x21')]({'plain':!![]});return db[_0x2b06('0x52')][_0x2b06('0x53')]({'where':{'name':'MusicOnHolds','userProfileId':_0x560df8[_0x2b06('0x54')]},'raw':!![]})['then'](function(_0x4a107e){if(_0x4a107e&&_0x4a107e[_0x2b06('0x55')]===0x0){return db[_0x2b06('0x23')]['create']({'name':_0x32fea3[_0x2b06('0x26')],'resourceId':_0x32fea3['id'],'type':_0x4a107e[_0x2b06('0x26')],'sectionId':_0x4a107e['id']},{})[_0x2b06('0x20')](function(){return _0x21c11f;});}else{return _0x21c11f;}})[_0x2b06('0x3f')](function(_0x265b76){logger[_0x2b06('0x25')](_0x2b06('0x56'),_0x265b76);});}return _0x21c11f;});})['then'](respondWithResult(_0xb6303,0xc9))[_0x2b06('0x3f')](handleError(_0xb6303,null));};exports[_0x2b06('0x24')]=function(_0x5c63e3,_0x5e7f96,_0x54803f){var _0x1f5fae;return db[_0x2b06('0x2a')]['find']({'where':{'id':_0x5c63e3[_0x2b06('0x45')]['id']}})['then'](function(_0xfdef0b){if(_0xfdef0b){return db['sequelize']['transaction'](function(_0x120652){return _0xfdef0b[_0x2b06('0x24')]({'transaction':_0x120652,'raw':!![]})[_0x2b06('0x20')](function(_0x57a73c){if(_0x57a73c['directory']){fs['readdirSync'](_0x57a73c[_0x2b06('0x4d')])[_0x2b06('0x57')](function(_0x4a36cc){fs['unlinkSync'](path[_0x2b06('0x48')](_0x57a73c[_0x2b06('0x4d')],_0x4a36cc));});fs[_0x2b06('0x58')](_0x57a73c['directory']);}return _0x57a73c;});})[_0x2b06('0x3f')](function(_0x425eb5){throw new db[(_0x2b06('0x59'))][(_0x2b06('0x5a'))](_0x425eb5[_0x2b06('0x5b')]);});}})[_0x2b06('0x20')](handleEntityNotFound(_0x5e7f96,null))['then'](removeEntity(_0x5e7f96,null))[_0x2b06('0x3f')](handleError(_0x5e7f96,null));};exports[_0x2b06('0x5c')]=function(_0x5412bc,_0x2e9f5d,_0x3264d5){return db[_0x2b06('0x5d')][_0x2b06('0x5e')](function(_0x40ec35){var _0x574c2b;return db[_0x2b06('0x2a')][_0x2b06('0x53')]({'where':{'id':_0x5412bc['params']['id']}})['then'](function(_0x306616){if(_0x306616){_0x574c2b=_0x306616;return _0x306616[_0x2b06('0x5c')](_0x5412bc[_0x2b06('0x44')]['id'],{'transaction':_0x40ec35});}})[_0x2b06('0x20')](function(_0xe7d37){if(_0xe7d37){return db[_0x2b06('0x5f')][_0x2b06('0x60')]({'where':{'id':_0x5412bc[_0x2b06('0x44')]['id']},'attributes':['id',_0x2b06('0x26'),_0x2b06('0x61'),_0x2b06('0x62'),_0x2b06('0x63')],'raw':!![]});}})['then'](function(_0x2b70f6){if(_0x2b70f6){var _0x1e0cfc=path[_0x2b06('0x48')](config[_0x2b06('0x49')],'server/files/sounds/converted',util[_0x2b06('0x64')]('%s.%s',path['basename'](_0x2b70f6[_0x2b06('0x61')],path[_0x2b06('0x65')](_0x2b70f6[_0x2b06('0x61')])),_0x2b70f6[_0x2b06('0x62')]));var _0x2fc9a1=path[_0x2b06('0x48')](config[_0x2b06('0x49')],_0x2b06('0x4a'),_0x574c2b[_0x2b06('0x26')],util[_0x2b06('0x64')](_0x2b06('0x66'),_0x2b70f6[_0x2b06('0x26')],_0x2b70f6['converted_format']));fs['symlinkSync'](_0x1e0cfc,_0x2fc9a1);return _0x2b70f6;}})['catch'](function(_0x47a5ae){throw new db[(_0x2b06('0x59'))][(_0x2b06('0x5a'))](_0x47a5ae[_0x2b06('0x5b')]);});})[_0x2b06('0x20')](handleEntityNotFound(_0x2e9f5d,null))[_0x2b06('0x20')](respondWithResult(_0x2e9f5d,0xc9))[_0x2b06('0x3f')](handleError(_0x2e9f5d,null));};exports[_0x2b06('0x67')]=function(_0x16cad7,_0x8a2371,_0x22e0d3){return db[_0x2b06('0x5d')][_0x2b06('0x5e')](function(_0x5d9e88){var _0x1a879c;return db[_0x2b06('0x2a')][_0x2b06('0x60')]({'where':{'id':_0x16cad7[_0x2b06('0x45')]['id']}})[_0x2b06('0x20')](handleEntityNotFound(_0x8a2371,null))[_0x2b06('0x20')](function(_0x1d2a1d){if(_0x1d2a1d){_0x1a879c=_0x1d2a1d;return _0x1d2a1d['removeSound'](_0x16cad7[_0x2b06('0x45')]['id2']);}})[_0x2b06('0x20')](function(_0x5622bd){if(_0x5622bd){return db[_0x2b06('0x5f')]['findOne']({'where':{'id':_0x16cad7[_0x2b06('0x45')][_0x2b06('0x68')]},'attributes':['id',_0x2b06('0x26'),_0x2b06('0x61'),_0x2b06('0x62'),_0x2b06('0x63')],'raw':!![]});}})['then'](function(_0x283a34){if(_0x283a34){fs[_0x2b06('0x69')](path[_0x2b06('0x48')](_0x1a879c['directory'],util[_0x2b06('0x64')](_0x2b06('0x66'),_0x283a34[_0x2b06('0x26')],_0x283a34[_0x2b06('0x62')])));return _0x283a34;}})[_0x2b06('0x3f')](function(_0x29f710){throw new db[(_0x2b06('0x59'))][(_0x2b06('0x5a'))](_0x29f710[_0x2b06('0x5b')]);});})[_0x2b06('0x20')](handleEntityNotFound(_0x8a2371,null))[_0x2b06('0x20')](respondWithStatusCode(_0x8a2371,0xcc))['catch'](handleError(_0x8a2371,null));};exports['getSounds']=function(_0xfba2fa,_0xfcfcbf,_0x264584){var _0x38e569={};var _0x1cf1f8={};var _0x334bf7;var _0x4e618d;return db[_0x2b06('0x2a')]['findOne']({'where':{'id':_0xfba2fa[_0x2b06('0x45')]['id']}})[_0x2b06('0x20')](handleEntityNotFound(_0xfcfcbf,null))[_0x2b06('0x20')](function(_0x4e3908){if(_0x4e3908){_0x334bf7=_0x4e3908;_0x1cf1f8[_0x2b06('0x2e')]=_[_0x2b06('0x41')](db[_0x2b06('0x5f')][_0x2b06('0x2b')]);_0x1cf1f8[_0x2b06('0x2f')]=_[_0x2b06('0x41')](_0xfba2fa[_0x2b06('0x2f')]);_0x1cf1f8[_0x2b06('0x30')]=_[_0x2b06('0x42')](_0x1cf1f8[_0x2b06('0x2e')],_0x1cf1f8[_0x2b06('0x2f')]);_0x38e569[_0x2b06('0x31')]=_[_0x2b06('0x42')](_0x1cf1f8['model'],qs['fields'](_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x32')]));_0x38e569[_0x2b06('0x31')]=_0x38e569[_0x2b06('0x31')][_0x2b06('0x43')]?_0x38e569[_0x2b06('0x31')]:_0x1cf1f8[_0x2b06('0x2e')];_0x38e569[_0x2b06('0x34')]=qs[_0x2b06('0x35')](_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x35')]);_0x38e569[_0x2b06('0x36')]=qs[_0x2b06('0x30')](_['pick'](_0xfba2fa['query'],_0x1cf1f8[_0x2b06('0x30')]));if(_0xfba2fa['query'][_0x2b06('0x38')]){_0x38e569[_0x2b06('0x36')]=_['merge'](_0x38e569[_0x2b06('0x36')],{'$or':_['map'](_0x38e569[_0x2b06('0x31')],function(_0x3cd756){var _0x213ea5={};_0x213ea5[_0x3cd756]={'$like':'%'+_0xfba2fa['query'][_0x2b06('0x38')]+'%'};return _0x213ea5;})});}_0x38e569=_['merge']({},_0x38e569,_0xfba2fa[_0x2b06('0x3a')]);return _0x334bf7[_0x2b06('0x6a')](_0x38e569);}})[_0x2b06('0x20')](function(_0xaf1f0c){if(_0xaf1f0c){_0x4e618d=_0xaf1f0c[_0x2b06('0x43')];if(!_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x33')](_0x2b06('0x6b'))){_0x38e569[_0x2b06('0x1a')]=qs[_0x2b06('0x1a')](_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x1a')]);_0x38e569[_0x2b06('0x18')]=qs[_0x2b06('0x18')](_0xfba2fa[_0x2b06('0x2f')][_0x2b06('0x18')]);}return _0x334bf7[_0x2b06('0x6a')](_0x38e569);}})[_0x2b06('0x20')](function(_0x4379f3){if(_0x4379f3){return _0x4379f3?{'count':_0x4e618d,'rows':_0x4379f3}:null;}})[_0x2b06('0x20')](respondWithResult(_0xfcfcbf,null))[_0x2b06('0x3f')](handleError(_0xfcfcbf,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 99dc40d..328f57a 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 _0xcabc=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0xcabc,0x18b));var _0xccab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcabc[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xccab('0x0'))(_0xccab('0x1'));var moment=require(_0xccab('0x2'));var BPromise=require(_0xccab('0x3'));var rp=require(_0xccab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccab('0x5'));var config=require(_0xccab('0x6'));var attributes=require(_0xccab('0x7'));module[_0xccab('0x8')]=function(_0x3211ef,_0x40068c){return _0x3211ef['define'](_0xccab('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4726=['voice_musiconhold','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x4726,0xa1));var _0x6472=function(_0x4f59b3,_0x4857f3){_0x4f59b3=_0x4f59b3-0x0;var _0x344cbc=_0x4726[_0x4f59b3];return _0x344cbc;};'use strict';var _=require(_0x6472('0x0'));var util=require(_0x6472('0x1'));var logger=require('../../config/logger')(_0x6472('0x2'));var moment=require('moment');var BPromise=require(_0x6472('0x3'));var rp=require(_0x6472('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6472('0x5'));var config=require(_0x6472('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x6472('0x7')]=function(_0x39c2b8,_0x21c8f5){return _0x39c2b8[_0x6472('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x6472('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 3f5939b..f0bad34 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x28c7ac,_0x3c38b3){var _0x9c3972=function(_0x4ea4fe){while(--_0x4ea4fe){_0x28c7ac['push'](_0x28c7ac['shift']());}};_0x9c3972(++_0x3c38b3);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x58909e,_0x50785f){var _0x13a989=function(_0x68e8d5){while(--_0x68e8d5){_0x58909e['push'](_0x58909e['shift']());}};_0x13a989(++_0x50785f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 77790bb..952abda 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 _0xfb85=['isAuthenticated','index','get','/:id','/:id/users','post','put','update','destroy','delete','removeAgents','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller'];(function(_0x200af4,_0x8416e8){var _0x3831b6=function(_0xf139c0){while(--_0xf139c0){_0x200af4['push'](_0x200af4['shift']());}};_0x3831b6(++_0x8416e8);}(_0xfb85,0x12c));var _0x5fb8=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xfb85[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x5fb8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5fb8('0x1'));var express=require('express');var router=express[_0x5fb8('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5fb8('0x3'));var interaction=require(_0x5fb8('0x4'));var config=require('../../config/environment');var controller=require(_0x5fb8('0x5'));router['get']('/',auth[_0x5fb8('0x6')](),controller[_0x5fb8('0x7')]);router[_0x5fb8('0x8')]('/describe',auth[_0x5fb8('0x6')](),controller['describe']);router[_0x5fb8('0x8')](_0x5fb8('0x9'),auth[_0x5fb8('0x6')](),controller['show']);router[_0x5fb8('0x8')](_0x5fb8('0xa'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5fb8('0xb')](_0x5fb8('0xa'),auth[_0x5fb8('0x6')](),controller['addAgents']);router[_0x5fb8('0xc')]('/:id',auth[_0x5fb8('0x6')](),controller[_0x5fb8('0xd')]);router['delete'](_0x5fb8('0x9'),auth['isAuthenticated'](),controller[_0x5fb8('0xe')]);router[_0x5fb8('0xf')](_0x5fb8('0xa'),auth[_0x5fb8('0x6')](),controller[_0x5fb8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6ce5=['/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5b6744,_0x49c9c2){var _0x43d97a=function(_0x55633e){while(--_0x55633e){_0x5b6744['push'](_0x5b6744['shift']());}};_0x43d97a(++_0x49c9c2);}(_0x6ce5,0x136));var _0x56ce=function(_0x30de36,_0x579533){_0x30de36=_0x30de36-0x0;var _0x359e7d=_0x6ce5[_0x30de36];return _0x359e7d;};'use strict';var multer=require(_0x56ce('0x0'));var util=require(_0x56ce('0x1'));var path=require('path');var timeout=require(_0x56ce('0x2'));var express=require(_0x56ce('0x3'));var router=express[_0x56ce('0x4')]();var fs_extra=require(_0x56ce('0x5'));var auth=require(_0x56ce('0x6'));var interaction=require(_0x56ce('0x7'));var config=require(_0x56ce('0x8'));var controller=require('./voicePrefix.controller');router[_0x56ce('0x9')]('/',auth[_0x56ce('0xa')](),controller[_0x56ce('0xb')]);router[_0x56ce('0x9')](_0x56ce('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x56ce('0xd'),auth[_0x56ce('0xa')](),controller[_0x56ce('0xe')]);router[_0x56ce('0x9')](_0x56ce('0xf'),auth['isAuthenticated'](),controller[_0x56ce('0x10')]);router[_0x56ce('0x11')]('/',auth['isAuthenticated'](),controller[_0x56ce('0x12')]);router[_0x56ce('0x11')](_0x56ce('0xf'),auth['isAuthenticated'](),controller[_0x56ce('0x13')]);router[_0x56ce('0x14')]('/:id',auth[_0x56ce('0xa')](),controller[_0x56ce('0x15')]);router[_0x56ce('0x16')](_0x56ce('0xd'),auth['isAuthenticated'](),controller[_0x56ce('0x17')]);router[_0x56ce('0x16')](_0x56ce('0xf'),auth['isAuthenticated'](),controller[_0x56ce('0x18')]);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 8d3345e..7f793db 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 _0x6645=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x6645,0x1d1));var _0x5664=function(_0x221880,_0x57785f){_0x221880=_0x221880-0x0;var _0x3fb91b=_0x6645[_0x221880];return _0x3fb91b;};'use strict';var Sequelize=require(_0x5664('0x0'));module[_0x5664('0x1')]={'name':{'type':Sequelize[_0x5664('0x2')],'allowNull':![],'unique':_0x5664('0x3')},'prefix':{'type':Sequelize[_0x5664('0x4')],'get':function(_0x3187c8){return _0x5664('0x5')+this[_0x5664('0x6')](_0x5664('0x3'))+'-';}},'description':{'type':Sequelize[_0x5664('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x5664('0x7')]}}; \ No newline at end of file +var _0x4e6e=['sequelize','exports','STRING','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x4e6e,0x1ea));var _0xe4e6=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x4e6e[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require(_0xe4e6('0x0'));module[_0xe4e6('0x1')]={'name':{'type':Sequelize[_0xe4e6('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xe4e6('0x3')],'get':function(_0x48a998){return _0xe4e6('0x4')+this[_0xe4e6('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0xe4e6('0x2')]},'callerIdAll':{'type':Sequelize[_0xe4e6('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xe4e6('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9d25ff6..96a8c07 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 _0x62ba=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','send','map','VoicePrefix','rawAttributes','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','intersection','find','catch','describe','create','sequelize','transaction','user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','context','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','body','VoiceExtension','addAgents','ids','omit','spread','length','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox'];(function(_0x5c1d83,_0x485ab5){var _0x344f43=function(_0x405826){while(--_0x405826){_0x5c1d83['push'](_0x5c1d83['shift']());}};_0x344f43(++_0x485ab5);}(_0x62ba,0x1cd));var _0xa62b=function(_0x5d0704,_0x296f48){_0x5d0704=_0x5d0704-0x0;var _0x38e07c=_0x62ba[_0x5d0704];return _0x38e07c;};'use strict';var emlformat=require(_0xa62b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa62b('0x1'));var jsonpatch=require(_0xa62b('0x2'));var rp=require(_0xa62b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa62b('0x4'));var util=require(_0xa62b('0x5'));var path=require('path');var sox=require(_0xa62b('0x6'));var csv=require(_0xa62b('0x7'));var ejs=require(_0xa62b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa62b('0x9'));var squel=require(_0xa62b('0xa'));var crypto=require(_0xa62b('0xb'));var jsforce=require(_0xa62b('0xc'));var deskjs=require(_0xa62b('0xd'));var toCsv=require(_0xa62b('0x7'));var querystring=require(_0xa62b('0xe'));var Papa=require('papaparse');var Redis=require(_0xa62b('0xf'));var authService=require(_0xa62b('0x10'));var qs=require(_0xa62b('0x11'));var as=require(_0xa62b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa62b('0x13'))('api');var utils=require(_0xa62b('0x14'));var config=require(_0xa62b('0x15'));var licenseUtil=require(_0xa62b('0x16'));var db=require('../../mysqldb')['db'];config[_0xa62b('0x17')]=_['defaults'](config[_0xa62b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa62b('0x18'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xa62b('0x19')](socket);function respondWithStatusCode(_0x580c87,_0x57ea7f){_0x57ea7f=_0x57ea7f||0xcc;return function(_0x3c61b5){if(_0x3c61b5){return _0x580c87['sendStatus'](_0x57ea7f);}return _0x580c87[_0xa62b('0x1a')](_0x57ea7f)['end']();};}function respondWithResult(_0x5e2c98,_0x40adcf){_0x40adcf=_0x40adcf||0xc8;return function(_0x529405){if(_0x529405){return _0x5e2c98[_0xa62b('0x1a')](_0x40adcf)[_0xa62b('0x1b')](_0x529405);}};}function respondWithFilteredResult(_0x152676,_0x5a8a9d){return function(_0xe01f06){if(_0xe01f06){var _0x274cac=typeof _0x5a8a9d[_0xa62b('0x1c')]===_0xa62b('0x1d')&&typeof _0x5a8a9d[_0xa62b('0x1e')]===_0xa62b('0x1d');var _0x2b1792=_0xe01f06[_0xa62b('0x1f')];var _0x5cc198=_0x274cac?0x0:_0x5a8a9d[_0xa62b('0x1c')];var _0x1ee83c=_0x274cac?_0xe01f06[_0xa62b('0x1f')]:_0x5a8a9d['offset']+_0x5a8a9d[_0xa62b('0x1e')];var _0x5c47c9;if(_0x1ee83c>=_0x2b1792){_0x1ee83c=_0x2b1792;_0x5c47c9=0xc8;}else{_0x5c47c9=0xce;}_0x152676['status'](_0x5c47c9);return _0x152676[_0xa62b('0x20')]('Content-Range',_0x5cc198+'-'+_0x1ee83c+'/'+_0x2b1792)['json'](_0xe01f06);}return null;};}function patchUpdates(_0x327851){return function(_0x169ca3){try{jsonpatch[_0xa62b('0x21')](_0x169ca3,_0x327851,!![]);}catch(_0x13be24){return BPromise[_0xa62b('0x22')](_0x13be24);}return _0x169ca3[_0xa62b('0x23')]();};}function saveUpdates(_0x6aa24a,_0x42a4b4){return function(_0x3e263b){if(_0x3e263b){return _0x3e263b[_0xa62b('0x24')](_0x6aa24a)['then'](function(_0x4d57a5){return _0x4d57a5;});}return null;};}function removeEntity(_0x407d70,_0x20a323){return function(_0x4f02a7){if(_0x4f02a7){return _0x4f02a7[_0xa62b('0x25')]()['then'](function(){var _0xe17bf0=_0x4f02a7[_0xa62b('0x26')]({'plain':!![]});var _0x1c3f0e='VoicePrefixes';return db[_0xa62b('0x27')][_0xa62b('0x25')]({'where':{'type':_0x1c3f0e,'resourceId':_0xe17bf0['id']}})[_0xa62b('0x28')](function(){return _0x4f02a7;});})[_0xa62b('0x28')](function(){_0x407d70['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c1915,_0x339b6e){return function(_0x5089a2){if(!_0x5089a2){_0x2c1915[_0xa62b('0x29')](0x194);}return _0x5089a2;};}function handleError(_0x293f14,_0x3ee3bb){_0x3ee3bb=_0x3ee3bb||0x1f4;return function(_0x1bb7a7){logger[_0xa62b('0x2a')](_0x1bb7a7[_0xa62b('0x2b')]);if(_0x1bb7a7[_0xa62b('0x2c')]){delete _0x1bb7a7['name'];}_0x293f14[_0xa62b('0x1a')](_0x3ee3bb)[_0xa62b('0x2d')](_0x1bb7a7);};}exports['index']=function(_0x43bff8,_0x176e2c){var _0x2b07c5={},_0x39ee64={},_0x1db5f1={'count':0x0,'rows':[]};var _0x157e66=_[_0xa62b('0x2e')](db[_0xa62b('0x2f')][_0xa62b('0x30')],function(_0x47f8f8){return{'name':_0x47f8f8['fieldName'],'type':_0x47f8f8[_0xa62b('0x31')]['key']};});_0x39ee64[_0xa62b('0x32')]=_[_0xa62b('0x2e')](_0x157e66,_0xa62b('0x2c'));_0x39ee64[_0xa62b('0x33')]=_[_0xa62b('0x34')](_0x43bff8[_0xa62b('0x33')]);_0x39ee64[_0xa62b('0x35')]=_['intersection'](_0x39ee64[_0xa62b('0x32')],_0x39ee64['query']);_0x2b07c5[_0xa62b('0x36')]=_['intersection'](_0x39ee64[_0xa62b('0x32')],qs[_0xa62b('0x37')](_0x43bff8[_0xa62b('0x33')][_0xa62b('0x37')]));_0x2b07c5['attributes']=_0x2b07c5[_0xa62b('0x36')]['length']?_0x2b07c5[_0xa62b('0x36')]:_0x39ee64[_0xa62b('0x32')];if(!_0x43bff8['query'][_0xa62b('0x38')](_0xa62b('0x39'))){_0x2b07c5[_0xa62b('0x1e')]=qs[_0xa62b('0x1e')](_0x43bff8[_0xa62b('0x33')][_0xa62b('0x1e')]);_0x2b07c5[_0xa62b('0x1c')]=qs['offset'](_0x43bff8['query'][_0xa62b('0x1c')]);}_0x2b07c5[_0xa62b('0x3a')]=qs[_0xa62b('0x3b')](_0x43bff8[_0xa62b('0x33')][_0xa62b('0x3b')]);_0x2b07c5['where']=qs[_0xa62b('0x35')](_[_0xa62b('0x3c')](_0x43bff8[_0xa62b('0x33')],_0x39ee64[_0xa62b('0x35')]),_0x157e66);if(_0x43bff8['query'][_0xa62b('0x3d')]){_0x2b07c5[_0xa62b('0x3e')]=_[_0xa62b('0x3f')](_0x2b07c5[_0xa62b('0x3e')],{'$or':_[_0xa62b('0x2e')](_0x157e66,function(_0x35564a){if(_0x35564a[_0xa62b('0x31')]!==_0xa62b('0x40')){var _0x23b99f={};_0x23b99f[_0x35564a[_0xa62b('0x2c')]]={'$like':'%'+_0x43bff8['query'][_0xa62b('0x3d')]+'%'};return _0x23b99f;}})});}_0x2b07c5=_[_0xa62b('0x3f')]({},_0x2b07c5,_0x43bff8[_0xa62b('0x41')]);var _0x4b6815={'where':_0x2b07c5[_0xa62b('0x3e')]};return db[_0xa62b('0x2f')][_0xa62b('0x1f')](_0x4b6815)[_0xa62b('0x28')](function(_0x10098e){_0x1db5f1[_0xa62b('0x1f')]=_0x10098e;if(_0x43bff8[_0xa62b('0x33')][_0xa62b('0x42')]){_0x2b07c5[_0xa62b('0x43')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x2b07c5);})[_0xa62b('0x28')](function(_0x32ddd6){_0x1db5f1[_0xa62b('0x44')]=_0x32ddd6;return _0x1db5f1;})[_0xa62b('0x28')](respondWithFilteredResult(_0x176e2c,_0x2b07c5))['catch'](handleError(_0x176e2c,null));};exports[_0xa62b('0x45')]=function(_0x2cc28e,_0x4eb851){var _0xf70ec5={'raw':![],'where':{'id':_0x2cc28e[_0xa62b('0x46')]['id']}},_0x5c1a71={};_0x5c1a71[_0xa62b('0x32')]=_[_0xa62b('0x34')](db[_0xa62b('0x2f')][_0xa62b('0x30')]);_0x5c1a71['query']=_[_0xa62b('0x34')](_0x2cc28e[_0xa62b('0x33')]);_0x5c1a71['filters']=_[_0xa62b('0x47')](_0x5c1a71[_0xa62b('0x32')],_0x5c1a71[_0xa62b('0x33')]);_0xf70ec5[_0xa62b('0x36')]=_[_0xa62b('0x47')](_0x5c1a71['model'],qs[_0xa62b('0x37')](_0x2cc28e['query'][_0xa62b('0x37')]));_0xf70ec5['attributes']=_0xf70ec5[_0xa62b('0x36')]['length']?_0xf70ec5[_0xa62b('0x36')]:_0x5c1a71[_0xa62b('0x32')];if(_0x2cc28e['query']['includeAll']){_0xf70ec5['include']=[{'all':!![]}];}_0xf70ec5=_[_0xa62b('0x3f')]({},_0xf70ec5,_0x2cc28e[_0xa62b('0x41')]);return db[_0xa62b('0x2f')][_0xa62b('0x48')](_0xf70ec5)[_0xa62b('0x28')](handleEntityNotFound(_0x4eb851,null))[_0xa62b('0x28')](respondWithResult(_0x4eb851,null))['catch'](handleError(_0x4eb851,null));};exports[_0xa62b('0x25')]=function(_0x27e8e0,_0xfe364f){return db['VoicePrefix'][_0xa62b('0x48')]({'where':{'id':_0x27e8e0[_0xa62b('0x46')]['id']}})['then'](handleEntityNotFound(_0xfe364f,null))[_0xa62b('0x28')](removeEntity(_0xfe364f,null))[_0xa62b('0x49')](handleError(_0xfe364f,null));};exports[_0xa62b('0x4a')]=function(_0x1d1481,_0x212c52){return db[_0xa62b('0x2f')]['describe']()[_0xa62b('0x28')](respondWithResult(_0x212c52,null))[_0xa62b('0x49')](handleError(_0x212c52,null));};exports[_0xa62b('0x4b')]=function(_0x22cf7e,_0x44b728){var _0x18c8a1;return db[_0xa62b('0x4c')][_0xa62b('0x4d')](function(_0x29b72a){return db[_0xa62b('0x2f')][_0xa62b('0x4b')](_0x22cf7e['body'],{'transaction':_0x29b72a})[_0xa62b('0x28')](function(_0xfef8c4){_0x18c8a1=_0xfef8c4[_0xa62b('0x26')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x18c8a1['VoiceExtensionId']},'raw':!![]})[_0xa62b('0x28')](function(_0x321e81){return createVoicePrefixExtensions(_0x18c8a1,_0x321e81,_0x29b72a);});});})[_0xa62b('0x28')](function(){var _0x22e782=_0x22cf7e[_0xa62b('0x4e')][_0xa62b('0x26')]({'plain':!![]});if(!_0x22e782)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22e782[_0xa62b('0x4f')]===_0xa62b('0x4e')){var _0x1a9073=_0x18c8a1;return db[_0xa62b('0x50')][_0xa62b('0x48')]({'where':{'name':_0xa62b('0x51'),'userProfileId':_0x22e782[_0xa62b('0x52')]},'raw':!![]})[_0xa62b('0x28')](function(_0x517b1d){if(_0x517b1d&&_0x517b1d[_0xa62b('0x53')]===0x0){return db[_0xa62b('0x27')][_0xa62b('0x4b')]({'name':_0x1a9073['name'],'resourceId':_0x1a9073['id'],'type':_0x517b1d[_0xa62b('0x2c')],'sectionId':_0x517b1d['id']},{})[_0xa62b('0x28')](function(){return _0x18c8a1;});}else{return _0x18c8a1;}})[_0xa62b('0x49')](function(_0x58fd69){logger[_0xa62b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58fd69);throw _0x58fd69;});}return _0x18c8a1;})[_0xa62b('0x28')](respondWithResult(_0x44b728,null))[_0xa62b('0x49')](handleError(_0x44b728,null));};function Extension(_0x38dbda,_0x1020a2,_0x19c8fd,_0x2e3dcf){this[_0xa62b('0x54')]='from-sip';this['exten']=_0x38dbda;this[_0xa62b('0x55')]=_0x19c8fd;this[_0xa62b('0x31')]=_0xa62b('0x56');this[_0xa62b('0x57')]=_0xa62b('0x58');this[_0xa62b('0x59')]=_0x1020a2;this[_0xa62b('0x5a')]=_0x2e3dcf;}function createVoicePrefixExtensions(_0x4e9fd3,_0x11e3a4,_0xa347ea){return new BPromise(function(_0x33a181,_0x5122d3){var _0x3e8eba=new Extension(formatPrefixName(_0x4e9fd3[_0xa62b('0x5b')]),0x1,_0xa62b('0x5c'),'Voice\x20Prefix');_0x3e8eba[_0xa62b('0x5d')]=_0x4e9fd3['id'];return db['VoiceExtension']['create'](_0x3e8eba,{'transaction':_0xa347ea})[_0xa62b('0x28')](function(_0x31f14c){var _0x4c1658=_0x31f14c[_0xa62b('0x26')]({'plain':!![]});var _0x3f3cde=_['map'](addVoicePrefixExtensions(_0x4e9fd3,_0x11e3a4),function(_0x285d37){_0x285d37[_0xa62b('0x5e')]=_0x4c1658['id'];_0x285d37[_0xa62b('0x5d')]=_0x4e9fd3['id'];return _0x285d37;});return db['VoiceExtension'][_0xa62b('0x5f')](_0x3f3cde,{'transaction':_0xa347ea})[_0xa62b('0x28')](function(_0x2bd6b7){if(!_0x2bd6b7){return _0x5122d3(_0xa62b('0x60'));}else{return _0x33a181(_0x2bd6b7);}})[_0xa62b('0x49')](function(_0x2fedf0){return _0x5122d3(_0x2fedf0);});});;});};function addVoicePrefixExtensions(_0x2bab53,_0x45fc14){var _0x13fc8b=[];var _0x59555d=formatPrefixName(_0x2bab53[_0xa62b('0x5b')]);_0x13fc8b['push'](new Extension(_0x59555d,0x2,_0xa62b('0x61'),_0xa62b('0x62')+_0x2bab53[_0xa62b('0x2c')]));if(_0x2bab53[_0xa62b('0x63')]){_0x13fc8b[_0xa62b('0x64')](new Extension(_0x59555d,0x3,'Set',_0xa62b('0x65')+_0x2bab53[_0xa62b('0x63')]));}else{_0x13fc8b[_0xa62b('0x64')](new Extension(_0x59555d,0x3,_0xa62b('0x5c'),_0xa62b('0x66')));}_0x13fc8b[_0xa62b('0x64')](new Extension(_0x59555d,0x4,'goto',_0x45fc14[_0xa62b('0x54')]+','+_0xa62b('0x67')+(0x8+_0x2bab53[_0xa62b('0x2c')]['length'])+'}'+','+0x1));return _0x13fc8b;}function formatPrefixName(_0x45fd9e){var _0x277d5e='_';for(var _0x282934=0x0;_0x282934<_0x45fd9e['length'];_0x282934++){if(_0x45fd9e[_0xa62b('0x68')](_0x282934)=='-'){_0x277d5e+=_0x45fd9e['charAt'](_0x282934);}else{_0x277d5e+='['+_0x45fd9e[_0xa62b('0x68')](_0x282934)+']';}}_0x277d5e+='.';return _0x277d5e;}exports[_0xa62b('0x24')]=function(_0x42247d,_0x2c60af,_0x1af0d7){var _0x5ccbed=_0x42247d[_0xa62b('0x69')];_0x5ccbed[_0xa62b('0x5b')]='system-'+_0x5ccbed['name']+'-';return db['sequelize'][_0xa62b('0x4d')](function(_0x38dfcc){return db[_0xa62b('0x2f')]['update'](_0x5ccbed,{'where':{'id':_0x5ccbed['id']},'transaction':_0x38dfcc})[_0xa62b('0x28')](function(){return db[_0xa62b('0x6a')][_0xa62b('0x25')]({'where':{'VoicePrefixId':_0x5ccbed['id']},'transaction':_0x38dfcc})[_0xa62b('0x28')](function(){return db[_0xa62b('0x6a')]['find']({'where':{'id':_0x5ccbed[_0xa62b('0x5e')]},'raw':!![]})['then'](function(_0x5e6c8b){return createVoicePrefixExtensions(_0x5ccbed,_0x5e6c8b,_0x38dfcc);});});});})[_0xa62b('0x28')](function(){return db['VoicePrefix']['findById'](_0x5ccbed['id']);})[_0xa62b('0x28')](respondWithResult(_0x2c60af,null))[_0xa62b('0x49')](handleError(_0x2c60af,null));};exports[_0xa62b('0x6b')]=function(_0x2a7d03,_0x4b0e69,_0x1513ee){return db['VoicePrefix']['find']({'where':{'id':_0x2a7d03[_0xa62b('0x46')]['id']}})[_0xa62b('0x28')](handleEntityNotFound(_0x4b0e69,null))[_0xa62b('0x28')](function(_0x592b12){if(_0x592b12){return _0x592b12[_0xa62b('0x6b')](_0x2a7d03[_0xa62b('0x69')][_0xa62b('0x6c')],_[_0xa62b('0x6d')](_0x2a7d03[_0xa62b('0x69')],[_0xa62b('0x6c'),'id'])||{})[_0xa62b('0x6e')](function(_0x5cdf77){for(var _0xe162fa=0x0;_0xe162fa<_0x2a7d03[_0xa62b('0x69')][_0xa62b('0x6c')][_0xa62b('0x6f')];_0xe162fa+=0x1){socket['emit'](_0xa62b('0x70'),{'UserId':Number(_0x2a7d03['body']['ids'][_0xe162fa]),'VoicePrefixId':Number(_0x2a7d03['params']['id'])});}return _0x5cdf77;});}})[_0xa62b('0x28')](respondWithResult(_0x4b0e69,null))['catch'](handleError(_0x4b0e69,null));};exports[_0xa62b('0x71')]=function(_0x5c08d6,_0x397c19,_0x275df4){return db['VoicePrefix']['find']({'where':{'id':_0x5c08d6[_0xa62b('0x46')]['id']}})['then'](handleEntityNotFound(_0x397c19,null))['then'](function(_0x3812cd){if(_0x3812cd){return _0x3812cd[_0xa62b('0x71')](_0x5c08d6[_0xa62b('0x33')][_0xa62b('0x6c')])[_0xa62b('0x28')](function(){if(_['isArray'](_0x5c08d6['query'][_0xa62b('0x6c')])){for(var _0x53f0a8=0x0;_0x53f0a8<_0x5c08d6[_0xa62b('0x33')]['ids'][_0xa62b('0x6f')];_0x53f0a8+=0x1){socket[_0xa62b('0x72')](_0xa62b('0x73'),{'UserId':Number(_0x5c08d6['query'][_0xa62b('0x6c')][_0x53f0a8]),'VoicePrefixId':Number(_0x5c08d6['params']['id'])});}}else{socket[_0xa62b('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x5c08d6[_0xa62b('0x33')]['ids']),'VoicePrefixId':Number(_0x5c08d6[_0xa62b('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x397c19,null))[_0xa62b('0x49')](handleError(_0x397c19,null));};exports[_0xa62b('0x74')]=function(_0x1772f4,_0x5aa0fd,_0x51b64c){var _0x4d4722={};var _0x162d31={};var _0x9df21e;var _0x3e3979;return db[_0xa62b('0x2f')]['findOne']({'where':{'id':_0x1772f4['params']['id']}})['then'](handleEntityNotFound(_0x5aa0fd,null))['then'](function(_0xda419c){if(_0xda419c){_0x9df21e=_0xda419c;_0x162d31[_0xa62b('0x32')]=_[_0xa62b('0x34')](db['User'][_0xa62b('0x30')]);_0x162d31['query']=_['keys'](_0x1772f4[_0xa62b('0x33')]);_0x162d31[_0xa62b('0x35')]=_[_0xa62b('0x47')](_0x162d31['model'],_0x162d31[_0xa62b('0x33')]);_0x4d4722[_0xa62b('0x36')]=_[_0xa62b('0x47')](_0x162d31[_0xa62b('0x32')],qs[_0xa62b('0x37')](_0x1772f4['query'][_0xa62b('0x37')]));_0x4d4722[_0xa62b('0x36')]=_0x4d4722['attributes'][_0xa62b('0x6f')]?_0x4d4722['attributes']:_0x162d31[_0xa62b('0x32')];_0x4d4722[_0xa62b('0x3a')]=qs['sort'](_0x1772f4[_0xa62b('0x33')][_0xa62b('0x3b')]);_0x4d4722[_0xa62b('0x3e')]=qs[_0xa62b('0x35')](_['pick'](_0x1772f4[_0xa62b('0x33')],_0x162d31[_0xa62b('0x35')]));if(_0x1772f4[_0xa62b('0x33')][_0xa62b('0x3d')]){_0x4d4722[_0xa62b('0x3e')]=_[_0xa62b('0x3f')](_0x4d4722['where'],{'$or':_[_0xa62b('0x2e')](_0x4d4722[_0xa62b('0x36')],function(_0x570291){var _0x521ff5={};_0x521ff5[_0x570291]={'$like':'%'+_0x1772f4[_0xa62b('0x33')][_0xa62b('0x3d')]+'%'};return _0x521ff5;})});}_0x4d4722=_['merge']({},_0x4d4722,_0x1772f4[_0xa62b('0x41')]);return _0x9df21e[_0xa62b('0x74')](_0x4d4722);}})['then'](function(_0x61f3ee){if(_0x61f3ee){_0x3e3979=_0x61f3ee['length'];if(!_0x1772f4[_0xa62b('0x33')]['hasOwnProperty'](_0xa62b('0x39'))){_0x4d4722[_0xa62b('0x1e')]=qs[_0xa62b('0x1e')](_0x1772f4[_0xa62b('0x33')][_0xa62b('0x1e')]);_0x4d4722[_0xa62b('0x1c')]=qs[_0xa62b('0x1c')](_0x1772f4[_0xa62b('0x33')]['offset']);}return _0x9df21e[_0xa62b('0x74')](_0x4d4722);}})[_0xa62b('0x28')](function(_0x47cdc5){if(_0x47cdc5){return _0x47cdc5?{'count':_0x3e3979,'rows':_0x47cdc5}:null;}})[_0xa62b('0x28')](respondWithResult(_0x5aa0fd,null))[_0xa62b('0x49')](handleError(_0x5aa0fd,null));}; \ No newline at end of file +var _0x0767=['destroy','VoicePrefixes','error','stack','name','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','intersection','length','options','find','describe','create','get','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','${EXTEN:','charAt','sequelize','findById','addAgents','body','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x5d00e8,_0x5d9d7f){var _0x232cef=function(_0x2e5f0e){while(--_0x2e5f0e){_0x5d00e8['push'](_0x5d00e8['shift']());}};_0x232cef(++_0x5d9d7f);}(_0x0767,0x1bf));var _0x7076=function(_0x496984,_0x45c35d){_0x496984=_0x496984-0x0;var _0x170bc9=_0x0767[_0x496984];return _0x170bc9;};'use strict';var emlformat=require(_0x7076('0x0'));var rimraf=require(_0x7076('0x1'));var zipdir=require(_0x7076('0x2'));var jsonpatch=require(_0x7076('0x3'));var rp=require(_0x7076('0x4'));var moment=require(_0x7076('0x5'));var BPromise=require(_0x7076('0x6'));var Mustache=require(_0x7076('0x7'));var util=require(_0x7076('0x8'));var path=require(_0x7076('0x9'));var sox=require('sox');var csv=require(_0x7076('0xa'));var ejs=require(_0x7076('0xb'));var fs=require('fs');var fs_extra=require(_0x7076('0xc'));var _=require(_0x7076('0xd'));var squel=require('squel');var crypto=require(_0x7076('0xe'));var jsforce=require(_0x7076('0xf'));var deskjs=require(_0x7076('0x10'));var toCsv=require(_0x7076('0xa'));var querystring=require(_0x7076('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7076('0x12'));var as=require(_0x7076('0x13'));var hardwareService=require(_0x7076('0x14'));var logger=require(_0x7076('0x15'))('api');var utils=require(_0x7076('0x16'));var config=require(_0x7076('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7076('0x18'))['db'];config[_0x7076('0x19')]=_['defaults'](config[_0x7076('0x19')],{'host':_0x7076('0x1a'),'port':0x18eb});var socket=require(_0x7076('0x1b'))(new Redis(config['redis']));require(_0x7076('0x1c'))[_0x7076('0x1d')](socket);function respondWithStatusCode(_0x57bc48,_0x1aebd6){_0x1aebd6=_0x1aebd6||0xcc;return function(_0x5c92ca){if(_0x5c92ca){return _0x57bc48[_0x7076('0x1e')](_0x1aebd6);}return _0x57bc48['status'](_0x1aebd6)[_0x7076('0x1f')]();};}function respondWithResult(_0x37583f,_0x5b9ca3){_0x5b9ca3=_0x5b9ca3||0xc8;return function(_0x21c1d7){if(_0x21c1d7){return _0x37583f[_0x7076('0x20')](_0x5b9ca3)[_0x7076('0x21')](_0x21c1d7);}};}function respondWithFilteredResult(_0x2663d7,_0x4cb422){return function(_0x56bc02){if(_0x56bc02){var _0x5a2b0a=typeof _0x4cb422[_0x7076('0x22')]===_0x7076('0x23')&&typeof _0x4cb422[_0x7076('0x24')]===_0x7076('0x23');var _0x26e147=_0x56bc02[_0x7076('0x25')];var _0x4bc64a=_0x5a2b0a?0x0:_0x4cb422[_0x7076('0x22')];var _0x1ba8d7=_0x5a2b0a?_0x56bc02[_0x7076('0x25')]:_0x4cb422['offset']+_0x4cb422[_0x7076('0x24')];var _0x2a8775;if(_0x1ba8d7>=_0x26e147){_0x1ba8d7=_0x26e147;_0x2a8775=0xc8;}else{_0x2a8775=0xce;}_0x2663d7[_0x7076('0x20')](_0x2a8775);return _0x2663d7[_0x7076('0x26')](_0x7076('0x27'),_0x4bc64a+'-'+_0x1ba8d7+'/'+_0x26e147)[_0x7076('0x21')](_0x56bc02);}return null;};}function patchUpdates(_0x40d76c){return function(_0x380b88){try{jsonpatch[_0x7076('0x28')](_0x380b88,_0x40d76c,!![]);}catch(_0x54a7bf){return BPromise[_0x7076('0x29')](_0x54a7bf);}return _0x380b88[_0x7076('0x2a')]();};}function saveUpdates(_0x29e301,_0x22527d){return function(_0x4a5fbc){if(_0x4a5fbc){return _0x4a5fbc[_0x7076('0x2b')](_0x29e301)[_0x7076('0x2c')](function(_0x556c06){return _0x556c06;});}return null;};}function removeEntity(_0x4634df,_0x19181f){return function(_0x718870){if(_0x718870){return _0x718870[_0x7076('0x2d')]()[_0x7076('0x2c')](function(){var _0x12deb3=_0x718870['get']({'plain':!![]});var _0x1c0a7e=_0x7076('0x2e');return db['UserProfileResource'][_0x7076('0x2d')]({'where':{'type':_0x1c0a7e,'resourceId':_0x12deb3['id']}})[_0x7076('0x2c')](function(){return _0x718870;});})[_0x7076('0x2c')](function(){_0x4634df[_0x7076('0x20')](0xcc)[_0x7076('0x1f')]();});}};}function handleEntityNotFound(_0x457d60,_0xfca185){return function(_0xd6ae1f){if(!_0xd6ae1f){_0x457d60[_0x7076('0x1e')](0x194);}return _0xd6ae1f;};}function handleError(_0x3e1430,_0x1194ee){_0x1194ee=_0x1194ee||0x1f4;return function(_0x1f80e9){logger[_0x7076('0x2f')](_0x1f80e9[_0x7076('0x30')]);if(_0x1f80e9[_0x7076('0x31')]){delete _0x1f80e9['name'];}_0x3e1430[_0x7076('0x20')](_0x1194ee)['send'](_0x1f80e9);};}exports['index']=function(_0x10789b,_0x1702bd){var _0x33f0a4={},_0x10f9fc={},_0x8018e6={'count':0x0,'rows':[]};var _0x40d311=_[_0x7076('0x32')](db[_0x7076('0x33')][_0x7076('0x34')],function(_0x625c7e){return{'name':_0x625c7e[_0x7076('0x35')],'type':_0x625c7e[_0x7076('0x36')][_0x7076('0x37')]};});_0x10f9fc[_0x7076('0x38')]=_[_0x7076('0x32')](_0x40d311,_0x7076('0x31'));_0x10f9fc[_0x7076('0x39')]=_[_0x7076('0x3a')](_0x10789b[_0x7076('0x39')]);_0x10f9fc['filters']=_['intersection'](_0x10f9fc['model'],_0x10f9fc[_0x7076('0x39')]);_0x33f0a4[_0x7076('0x3b')]=_['intersection'](_0x10f9fc[_0x7076('0x38')],qs[_0x7076('0x3c')](_0x10789b[_0x7076('0x39')][_0x7076('0x3c')]));_0x33f0a4[_0x7076('0x3b')]=_0x33f0a4[_0x7076('0x3b')]['length']?_0x33f0a4[_0x7076('0x3b')]:_0x10f9fc[_0x7076('0x38')];if(!_0x10789b[_0x7076('0x39')][_0x7076('0x3d')](_0x7076('0x3e'))){_0x33f0a4[_0x7076('0x24')]=qs[_0x7076('0x24')](_0x10789b[_0x7076('0x39')][_0x7076('0x24')]);_0x33f0a4[_0x7076('0x22')]=qs['offset'](_0x10789b[_0x7076('0x39')]['offset']);}_0x33f0a4[_0x7076('0x3f')]=qs[_0x7076('0x40')](_0x10789b[_0x7076('0x39')]['sort']);_0x33f0a4[_0x7076('0x41')]=qs['filters'](_['pick'](_0x10789b[_0x7076('0x39')],_0x10f9fc[_0x7076('0x42')]),_0x40d311);if(_0x10789b['query'][_0x7076('0x43')]){_0x33f0a4[_0x7076('0x41')]=_['merge'](_0x33f0a4['where'],{'$or':_['map'](_0x40d311,function(_0x6efe60){if(_0x6efe60[_0x7076('0x36')]!==_0x7076('0x44')){var _0x41e3b2={};_0x41e3b2[_0x6efe60[_0x7076('0x31')]]={'$like':'%'+_0x10789b['query'][_0x7076('0x43')]+'%'};return _0x41e3b2;}})});}_0x33f0a4=_[_0x7076('0x45')]({},_0x33f0a4,_0x10789b['options']);var _0x3870a3={'where':_0x33f0a4['where']};return db['VoicePrefix']['count'](_0x3870a3)['then'](function(_0x52cbcc){_0x8018e6['count']=_0x52cbcc;if(_0x10789b[_0x7076('0x39')][_0x7076('0x46')]){_0x33f0a4[_0x7076('0x47')]=[{'all':!![]}];}return db[_0x7076('0x33')]['findAll'](_0x33f0a4);})[_0x7076('0x2c')](function(_0x494e81){_0x8018e6[_0x7076('0x48')]=_0x494e81;return _0x8018e6;})['then'](respondWithFilteredResult(_0x1702bd,_0x33f0a4))[_0x7076('0x49')](handleError(_0x1702bd,null));};exports[_0x7076('0x4a')]=function(_0x45b611,_0x2a224e){var _0x4ab3f3={'raw':![],'where':{'id':_0x45b611[_0x7076('0x4b')]['id']}},_0xd9a41a={};_0xd9a41a[_0x7076('0x38')]=_[_0x7076('0x3a')](db[_0x7076('0x33')]['rawAttributes']);_0xd9a41a['query']=_[_0x7076('0x3a')](_0x45b611[_0x7076('0x39')]);_0xd9a41a[_0x7076('0x42')]=_[_0x7076('0x4c')](_0xd9a41a[_0x7076('0x38')],_0xd9a41a[_0x7076('0x39')]);_0x4ab3f3[_0x7076('0x3b')]=_[_0x7076('0x4c')](_0xd9a41a[_0x7076('0x38')],qs[_0x7076('0x3c')](_0x45b611[_0x7076('0x39')][_0x7076('0x3c')]));_0x4ab3f3[_0x7076('0x3b')]=_0x4ab3f3['attributes'][_0x7076('0x4d')]?_0x4ab3f3[_0x7076('0x3b')]:_0xd9a41a[_0x7076('0x38')];if(_0x45b611['query'][_0x7076('0x46')]){_0x4ab3f3[_0x7076('0x47')]=[{'all':!![]}];}_0x4ab3f3=_['merge']({},_0x4ab3f3,_0x45b611[_0x7076('0x4e')]);return db[_0x7076('0x33')][_0x7076('0x4f')](_0x4ab3f3)[_0x7076('0x2c')](handleEntityNotFound(_0x2a224e,null))[_0x7076('0x2c')](respondWithResult(_0x2a224e,null))['catch'](handleError(_0x2a224e,null));};exports['destroy']=function(_0x2b78f1,_0x3e9314){return db[_0x7076('0x33')][_0x7076('0x4f')]({'where':{'id':_0x2b78f1[_0x7076('0x4b')]['id']}})[_0x7076('0x2c')](handleEntityNotFound(_0x3e9314,null))[_0x7076('0x2c')](removeEntity(_0x3e9314,null))[_0x7076('0x49')](handleError(_0x3e9314,null));};exports[_0x7076('0x50')]=function(_0x19119a,_0x371da8){return db['VoicePrefix']['describe']()['then'](respondWithResult(_0x371da8,null))[_0x7076('0x49')](handleError(_0x371da8,null));};exports['create']=function(_0x25c333,_0x5524ca){var _0x5ae5b8;return db['sequelize']['transaction'](function(_0x2e69d4){return db[_0x7076('0x33')][_0x7076('0x51')](_0x25c333['body'],{'transaction':_0x2e69d4})[_0x7076('0x2c')](function(_0x465823){_0x5ae5b8=_0x465823[_0x7076('0x52')]({'plain':!![]});return db[_0x7076('0x53')]['find']({'where':{'id':_0x5ae5b8[_0x7076('0x54')]},'raw':!![]})[_0x7076('0x2c')](function(_0x4f29bf){return createVoicePrefixExtensions(_0x5ae5b8,_0x4f29bf,_0x2e69d4);});});})['then'](function(){var _0x29193c=_0x25c333[_0x7076('0x55')]['get']({'plain':!![]});if(!_0x29193c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29193c[_0x7076('0x56')]===_0x7076('0x55')){var _0x3933fd=_0x5ae5b8;return db[_0x7076('0x57')]['find']({'where':{'name':_0x7076('0x2e'),'userProfileId':_0x29193c[_0x7076('0x58')]},'raw':!![]})[_0x7076('0x2c')](function(_0x520c11){if(_0x520c11&&_0x520c11['autoAssociation']===0x0){return db[_0x7076('0x59')][_0x7076('0x51')]({'name':_0x3933fd[_0x7076('0x31')],'resourceId':_0x3933fd['id'],'type':_0x520c11['name'],'sectionId':_0x520c11['id']},{})[_0x7076('0x2c')](function(){return _0x5ae5b8;});}else{return _0x5ae5b8;}})[_0x7076('0x49')](function(_0x3bae03){logger['error'](_0x7076('0x5a'),_0x3bae03);throw _0x3bae03;});}return _0x5ae5b8;})[_0x7076('0x2c')](respondWithResult(_0x5524ca,null))[_0x7076('0x49')](handleError(_0x5524ca,null));};function Extension(_0x4a2fb0,_0x457616,_0x1cd6d3,_0x30738a){this[_0x7076('0x5b')]=_0x7076('0x5c');this['exten']=_0x4a2fb0;this[_0x7076('0x5d')]=_0x1cd6d3;this['type']=_0x7076('0x5e');this['description']=_0x7076('0x5f');this[_0x7076('0x60')]=_0x457616;this[_0x7076('0x61')]=_0x30738a;}function createVoicePrefixExtensions(_0xd9f27e,_0x3d918e,_0x48b207){return new BPromise(function(_0x266bb3,_0x44f7b){var _0x47c7a8=new Extension(formatPrefixName(_0xd9f27e[_0x7076('0x62')]),0x1,_0x7076('0x63'),_0x7076('0x64'));_0x47c7a8[_0x7076('0x65')]=_0xd9f27e['id'];return db[_0x7076('0x53')][_0x7076('0x51')](_0x47c7a8,{'transaction':_0x48b207})['then'](function(_0x4c1f45){var _0x248a7a=_0x4c1f45[_0x7076('0x52')]({'plain':!![]});var _0x45dc7b=_[_0x7076('0x32')](addVoicePrefixExtensions(_0xd9f27e,_0x3d918e),function(_0x5d1e3d){_0x5d1e3d[_0x7076('0x54')]=_0x248a7a['id'];_0x5d1e3d[_0x7076('0x65')]=_0xd9f27e['id'];return _0x5d1e3d;});return db[_0x7076('0x53')][_0x7076('0x66')](_0x45dc7b,{'transaction':_0x48b207})[_0x7076('0x2c')](function(_0x273af9){if(!_0x273af9){return _0x44f7b(_0x7076('0x67'));}else{return _0x266bb3(_0x273af9);}})[_0x7076('0x49')](function(_0xbb3e98){return _0x44f7b(_0xbb3e98);});});;});};function addVoicePrefixExtensions(_0x2547f7,_0x3582b3){var _0x317ea9=[];var _0x14017d=formatPrefixName(_0x2547f7[_0x7076('0x62')]);_0x317ea9[_0x7076('0x68')](new Extension(_0x14017d,0x2,_0x7076('0x69'),_0x7076('0x6a')+_0x2547f7[_0x7076('0x31')]));if(_0x2547f7[_0x7076('0x6b')]){_0x317ea9['push'](new Extension(_0x14017d,0x3,_0x7076('0x69'),'PREFIX-CALLERIDALL='+_0x2547f7[_0x7076('0x6b')]));}else{_0x317ea9[_0x7076('0x68')](new Extension(_0x14017d,0x3,_0x7076('0x63'),'No\x20callerid\x20available'));}_0x317ea9['push'](new Extension(_0x14017d,0x4,'goto',_0x3582b3[_0x7076('0x5b')]+','+_0x7076('0x6c')+(0x8+_0x2547f7['name'][_0x7076('0x4d')])+'}'+','+0x1));return _0x317ea9;}function formatPrefixName(_0x27de48){var _0xabd361='_';for(var _0x2ee846=0x0;_0x2ee846<_0x27de48['length'];_0x2ee846++){if(_0x27de48[_0x7076('0x6d')](_0x2ee846)=='-'){_0xabd361+=_0x27de48[_0x7076('0x6d')](_0x2ee846);}else{_0xabd361+='['+_0x27de48['charAt'](_0x2ee846)+']';}}_0xabd361+='.';return _0xabd361;}exports[_0x7076('0x2b')]=function(_0x4e32d2,_0x29f024,_0xb4febe){var _0x1a964a=_0x4e32d2['body'];_0x1a964a['prefix']='system-'+_0x1a964a[_0x7076('0x31')]+'-';return db[_0x7076('0x6e')]['transaction'](function(_0x5eae40){return db[_0x7076('0x33')][_0x7076('0x2b')](_0x1a964a,{'where':{'id':_0x1a964a['id']},'transaction':_0x5eae40})[_0x7076('0x2c')](function(){return db[_0x7076('0x53')][_0x7076('0x2d')]({'where':{'VoicePrefixId':_0x1a964a['id']},'transaction':_0x5eae40})[_0x7076('0x2c')](function(){return db['VoiceExtension'][_0x7076('0x4f')]({'where':{'id':_0x1a964a[_0x7076('0x54')]},'raw':!![]})[_0x7076('0x2c')](function(_0xebde9d){return createVoicePrefixExtensions(_0x1a964a,_0xebde9d,_0x5eae40);});});});})[_0x7076('0x2c')](function(){return db[_0x7076('0x33')][_0x7076('0x6f')](_0x1a964a['id']);})[_0x7076('0x2c')](respondWithResult(_0x29f024,null))[_0x7076('0x49')](handleError(_0x29f024,null));};exports[_0x7076('0x70')]=function(_0x412a02,_0x48caea,_0x748a3a){return db[_0x7076('0x33')][_0x7076('0x4f')]({'where':{'id':_0x412a02[_0x7076('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48caea,null))[_0x7076('0x2c')](function(_0x15e912){if(_0x15e912){return _0x15e912['addAgents'](_0x412a02[_0x7076('0x71')]['ids'],_['omit'](_0x412a02[_0x7076('0x71')],[_0x7076('0x72'),'id'])||{})['spread'](function(_0x277237){for(var _0x146cc9=0x0;_0x146cc9<_0x412a02['body'][_0x7076('0x72')][_0x7076('0x4d')];_0x146cc9+=0x1){socket[_0x7076('0x73')](_0x7076('0x74'),{'UserId':Number(_0x412a02[_0x7076('0x71')]['ids'][_0x146cc9]),'VoicePrefixId':Number(_0x412a02['params']['id'])});}return _0x277237;});}})[_0x7076('0x2c')](respondWithResult(_0x48caea,null))[_0x7076('0x49')](handleError(_0x48caea,null));};exports[_0x7076('0x75')]=function(_0x5210a9,_0x187972,_0x1be3b6){return db[_0x7076('0x33')][_0x7076('0x4f')]({'where':{'id':_0x5210a9[_0x7076('0x4b')]['id']}})[_0x7076('0x2c')](handleEntityNotFound(_0x187972,null))['then'](function(_0x2741a8){if(_0x2741a8){return _0x2741a8[_0x7076('0x75')](_0x5210a9[_0x7076('0x39')][_0x7076('0x72')])[_0x7076('0x2c')](function(){if(_[_0x7076('0x76')](_0x5210a9[_0x7076('0x39')][_0x7076('0x72')])){for(var _0x400e8f=0x0;_0x400e8f<_0x5210a9[_0x7076('0x39')][_0x7076('0x72')][_0x7076('0x4d')];_0x400e8f+=0x1){socket['emit'](_0x7076('0x77'),{'UserId':Number(_0x5210a9[_0x7076('0x39')][_0x7076('0x72')][_0x400e8f]),'VoicePrefixId':Number(_0x5210a9[_0x7076('0x4b')]['id'])});}}else{socket[_0x7076('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x5210a9[_0x7076('0x39')][_0x7076('0x72')]),'VoicePrefixId':Number(_0x5210a9[_0x7076('0x4b')]['id'])});}});}})[_0x7076('0x2c')](respondWithStatusCode(_0x187972,null))[_0x7076('0x49')](handleError(_0x187972,null));};exports['getAgents']=function(_0x171d5d,_0x2d0e85,_0x1428e2){var _0x339236={};var _0x551e0c={};var _0x37fbce;var _0x5a861c;return db[_0x7076('0x33')][_0x7076('0x78')]({'where':{'id':_0x171d5d[_0x7076('0x4b')]['id']}})[_0x7076('0x2c')](handleEntityNotFound(_0x2d0e85,null))[_0x7076('0x2c')](function(_0x160d86){if(_0x160d86){_0x37fbce=_0x160d86;_0x551e0c[_0x7076('0x38')]=_[_0x7076('0x3a')](db[_0x7076('0x79')]['rawAttributes']);_0x551e0c[_0x7076('0x39')]=_['keys'](_0x171d5d[_0x7076('0x39')]);_0x551e0c[_0x7076('0x42')]=_[_0x7076('0x4c')](_0x551e0c[_0x7076('0x38')],_0x551e0c['query']);_0x339236['attributes']=_[_0x7076('0x4c')](_0x551e0c['model'],qs[_0x7076('0x3c')](_0x171d5d[_0x7076('0x39')]['fields']));_0x339236[_0x7076('0x3b')]=_0x339236['attributes'][_0x7076('0x4d')]?_0x339236[_0x7076('0x3b')]:_0x551e0c[_0x7076('0x38')];_0x339236['order']=qs[_0x7076('0x40')](_0x171d5d['query'][_0x7076('0x40')]);_0x339236[_0x7076('0x41')]=qs[_0x7076('0x42')](_['pick'](_0x171d5d[_0x7076('0x39')],_0x551e0c[_0x7076('0x42')]));if(_0x171d5d[_0x7076('0x39')][_0x7076('0x43')]){_0x339236['where']=_[_0x7076('0x45')](_0x339236[_0x7076('0x41')],{'$or':_[_0x7076('0x32')](_0x339236[_0x7076('0x3b')],function(_0x49071b){var _0x373c48={};_0x373c48[_0x49071b]={'$like':'%'+_0x171d5d[_0x7076('0x39')][_0x7076('0x43')]+'%'};return _0x373c48;})});}_0x339236=_[_0x7076('0x45')]({},_0x339236,_0x171d5d[_0x7076('0x4e')]);return _0x37fbce[_0x7076('0x7a')](_0x339236);}})[_0x7076('0x2c')](function(_0x4c1c6c){if(_0x4c1c6c){_0x5a861c=_0x4c1c6c['length'];if(!_0x171d5d[_0x7076('0x39')]['hasOwnProperty']('nolimit')){_0x339236[_0x7076('0x24')]=qs[_0x7076('0x24')](_0x171d5d[_0x7076('0x39')][_0x7076('0x24')]);_0x339236[_0x7076('0x22')]=qs[_0x7076('0x22')](_0x171d5d['query'][_0x7076('0x22')]);}return _0x37fbce['getAgents'](_0x339236);}})[_0x7076('0x2c')](function(_0x294d58){if(_0x294d58){return _0x294d58?{'count':_0x5a861c,'rows':_0x294d58}:null;}})[_0x7076('0x2c')](respondWithResult(_0x2d0e85,null))[_0x7076('0x49')](handleError(_0x2d0e85,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ecc2793..b0eeeb7 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 _0xa987=['exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x31892c,_0x53c36a){var _0x5ead51=function(_0x1b4802){while(--_0x1b4802){_0x31892c['push'](_0x31892c['shift']());}};_0x5ead51(++_0x53c36a);}(_0xa987,0x17b));var _0x7a98=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xa987[_0x2c7618];return _0x5ce3f0;};'use strict';var EventEmitter=require(_0x7a98('0x0'));var VoicePrefix=require(_0x7a98('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7a98('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a98('0x3'),'afterDestroy':_0x7a98('0x4')};function emitEvent(_0x2b8eb7){return function(_0x430cd8,_0xa97f6f,_0x7c8e1){VoicePrefixEvents[_0x7a98('0x5')](_0x2b8eb7+':'+_0x430cd8['id'],_0x430cd8);VoicePrefixEvents[_0x7a98('0x5')](_0x2b8eb7,_0x430cd8);_0x7c8e1(null);};}for(var e in events){if(events[_0x7a98('0x6')](e)){var event=events[e];VoicePrefix[_0x7a98('0x7')](e,emitEvent(event));}}module[_0x7a98('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x3ba6=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','hasOwnProperty','hook','events'];(function(_0x1a3ee3,_0x1c0f51){var _0x213bc8=function(_0x297c4e){while(--_0x297c4e){_0x1a3ee3['push'](_0x1a3ee3['shift']());}};_0x213bc8(++_0x1c0f51);}(_0x3ba6,0x13f));var _0x63ba=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0x3ba6[_0x118653];return _0xc11fa6;};'use strict';var EventEmitter=require(_0x63ba('0x0'));var VoicePrefix=require(_0x63ba('0x1'))['db'][_0x63ba('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x63ba('0x3')](0x0);var events={'afterCreate':_0x63ba('0x4'),'afterUpdate':_0x63ba('0x5'),'afterDestroy':'remove'};function emitEvent(_0x7026fa){return function(_0x57b531,_0x561020,_0x3ad29a){VoicePrefixEvents['emit'](_0x7026fa+':'+_0x57b531['id'],_0x57b531);VoicePrefixEvents['emit'](_0x7026fa,_0x57b531);_0x3ad29a(null);};}for(var e in events){if(events[_0x63ba('0x6')](e)){var event=events[e];VoicePrefix[_0x63ba('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index be0970b..3d5ee18 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 _0xa2ee=['path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4c2a73,_0x2835cd){var _0x121267=function(_0x30e8ad){while(--_0x30e8ad){_0x4c2a73['push'](_0x4c2a73['shift']());}};_0x121267(++_0x2835cd);}(_0xa2ee,0x132));var _0xea2e=function(_0x30bb30,_0x564af1){_0x30bb30=_0x30bb30-0x0;var _0xce44e7=_0xa2ee[_0x30bb30];return _0xce44e7;};'use strict';var _=require(_0xea2e('0x0'));var util=require(_0xea2e('0x1'));var logger=require('../../config/logger')(_0xea2e('0x2'));var moment=require(_0xea2e('0x3'));var BPromise=require(_0xea2e('0x4'));var rp=require(_0xea2e('0x5'));var fs=require('fs');var path=require(_0xea2e('0x6'));var rimraf=require(_0xea2e('0x7'));var config=require(_0xea2e('0x8'));var attributes=require(_0xea2e('0x9'));module['exports']=function(_0x2b2af1,_0xe7bdea){return _0x2b2af1[_0xea2e('0xa')](_0xea2e('0xb'),attributes,{'tableName':_0xea2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x098e=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','voice_prefixes','util'];(function(_0x4e1fbf,_0x58f9ad){var _0x58734c=function(_0x1cee34){while(--_0x1cee34){_0x4e1fbf['push'](_0x4e1fbf['shift']());}};_0x58734c(++_0x58f9ad);}(_0x098e,0x1ca));var _0xe098=function(_0x334a81,_0x5ec823){_0x334a81=_0x334a81-0x0;var _0x28f7f6=_0x098e[_0x334a81];return _0x28f7f6;};'use strict';var _=require('lodash');var util=require(_0xe098('0x0'));var logger=require(_0xe098('0x1'))(_0xe098('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe098('0x3'));var fs=require('fs');var path=require(_0xe098('0x4'));var rimraf=require(_0xe098('0x5'));var config=require(_0xe098('0x6'));var attributes=require(_0xe098('0x7'));module['exports']=function(_0x468c04,_0x157f6e){return _0x468c04['define']('VoicePrefix',attributes,{'tableName':_0xe098('0x8'),'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 38240aa..9fbde03 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 _0x8f1a=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4db8de,_0x468741){var _0x2b6e37=function(_0x5b9730){while(--_0x5b9730){_0x4db8de['push'](_0x4db8de['shift']());}};_0x2b6e37(++_0x468741);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x2871e6,_0x353bd4){_0x2871e6=_0x2871e6-0x0;var _0x581d37=_0x8f1a[_0x2871e6];return _0x581d37;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var moment=require(_0xa8f1('0x2'));var BPromise=require(_0xa8f1('0x3'));var rs=require(_0xa8f1('0x4'));var fs=require('fs');var Redis=require(_0xa8f1('0x5'));var db=require(_0xa8f1('0x6'))['db'];var utils=require(_0xa8f1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8f1('0x9')][_0xa8f1('0xa')]({'port':0x232a});config['redis']=_[_0xa8f1('0xb')](config[_0xa8f1('0xc')],{'host':_0xa8f1('0xd'),'port':0x18eb});var socket=require(_0xa8f1('0xe'))(new Redis(config[_0xa8f1('0xc')]));require(_0xa8f1('0xf'))[_0xa8f1('0x10')](socket);function respondWithRpcPromise(_0x394911,_0x587220,_0x20cc24){return new BPromise(function(_0x4403a8,_0x52c874){return client[_0xa8f1('0x11')](_0x394911,_0x20cc24)['then'](function(_0x261a32){logger[_0xa8f1('0x12')](_0xa8f1('0x13'),_0x587220,'request\x20sent');logger[_0xa8f1('0x14')](_0xa8f1('0x15'),_0x587220,_0xa8f1('0x16'),JSON[_0xa8f1('0x17')](_0x261a32));if(_0x261a32[_0xa8f1('0x18')]){if(_0x261a32['error'][_0xa8f1('0x19')]===0x1f4){logger['error'](_0xa8f1('0x13'),_0x587220,_0x261a32[_0xa8f1('0x18')]['message']);return _0x52c874(_0x261a32['error'][_0xa8f1('0x1a')]);}logger[_0xa8f1('0x18')](_0xa8f1('0x13'),_0x587220,_0x261a32[_0xa8f1('0x18')][_0xa8f1('0x1a')]);return _0x4403a8(_0x261a32[_0xa8f1('0x18')][_0xa8f1('0x1a')]);}else{logger[_0xa8f1('0x12')](_0xa8f1('0x13'),_0x587220,_0xa8f1('0x16'));_0x4403a8(_0x261a32[_0xa8f1('0x1b')][_0xa8f1('0x1a')]);}})[_0xa8f1('0x1c')](function(_0x437035){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x587220,_0x437035);_0x52c874(_0x437035);});});} \ No newline at end of file +var _0x9f37=['./voicePrefix.socket','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f37,0xd1));var _0x79f3=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x9f37[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var moment=require('moment');var BPromise=require(_0x79f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79f3('0x3'))['db'];var utils=require(_0x79f3('0x4'));var logger=require(_0x79f3('0x5'))('rpc');var config=require(_0x79f3('0x6'));var jayson=require(_0x79f3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x79f3('0x8')]=_[_0x79f3('0x9')](config[_0x79f3('0x8')],{'host':_0x79f3('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79f3('0x8')]));require(_0x79f3('0xb'))['register'](socket);function respondWithRpcPromise(_0x3f30ce,_0x897ff1,_0xebcce4){return new BPromise(function(_0xa2f557,_0x3efa9b){return client['request'](_0x3f30ce,_0xebcce4)[_0x79f3('0xc')](function(_0x33e502){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x897ff1,_0x79f3('0xd'));logger[_0x79f3('0xe')](_0x79f3('0xf'),_0x897ff1,_0x79f3('0xd'),JSON['stringify'](_0x33e502));if(_0x33e502[_0x79f3('0x10')]){if(_0x33e502[_0x79f3('0x10')][_0x79f3('0x11')]===0x1f4){logger[_0x79f3('0x10')](_0x79f3('0x12'),_0x897ff1,_0x33e502[_0x79f3('0x10')]['message']);return _0x3efa9b(_0x33e502['error'][_0x79f3('0x13')]);}logger[_0x79f3('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x897ff1,_0x33e502[_0x79f3('0x10')][_0x79f3('0x13')]);return _0xa2f557(_0x33e502[_0x79f3('0x10')][_0x79f3('0x13')]);}else{logger['info'](_0x79f3('0x12'),_0x897ff1,_0x79f3('0xd'));_0xa2f557(_0x33e502[_0x79f3('0x14')][_0x79f3('0x13')]);}})[_0x79f3('0x15')](function(_0x1d1f3d){logger[_0x79f3('0x10')](_0x79f3('0x12'),_0x897ff1,_0x1d1f3d);_0x3efa9b(_0x1d1f3d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1b47e0d..3e1134e 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 _0x1d2d=['register','voicePrefix:','./voicePrefix.events','save','remove','update','removeListener'];(function(_0x299b84,_0x5c2a71){var _0x1983d2=function(_0x5a906b){while(--_0x5a906b){_0x299b84['push'](_0x299b84['shift']());}};_0x1983d2(++_0x5c2a71);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x305b0f,_0x33346c){_0x305b0f=_0x305b0f-0x0;var _0x306f45=_0x1d2d[_0x305b0f];return _0x306f45;};'use strict';var VoicePrefixEvents=require(_0xd1d2('0x0'));var events=[_0xd1d2('0x1'),_0xd1d2('0x2'),_0xd1d2('0x3')];function createListener(_0x3401a9,_0x4f5f7f){return function(_0x32d884){_0x4f5f7f['emit'](_0x3401a9,_0x32d884);};}function removeListener(_0x5d3fac,_0x3caa72){return function(){VoicePrefixEvents[_0xd1d2('0x4')](_0x5d3fac,_0x3caa72);};}exports[_0xd1d2('0x5')]=function(_0x269613){for(var _0x2f930d=0x0,_0x353dbd=events['length'];_0x2f930d<_0x353dbd;_0x2f930d++){var _0x1eaf41=events[_0x2f930d];var _0x21bc28=createListener(_0xd1d2('0x6')+_0x1eaf41,_0x269613);VoicePrefixEvents['on'](_0x1eaf41,_0x21bc28);}}; \ No newline at end of file +var _0x1020=['./voicePrefix.events','remove','update','emit','removeListener','register','length'];(function(_0x488e20,_0x2d61b0){var _0x4099a3=function(_0x16816d){while(--_0x16816d){_0x488e20['push'](_0x488e20['shift']());}};_0x4099a3(++_0x2d61b0);}(_0x1020,0x1a4));var _0x0102=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1020[_0x397e5f];return _0x5302b8;};'use strict';var VoicePrefixEvents=require(_0x0102('0x0'));var events=['save',_0x0102('0x1'),_0x0102('0x2')];function createListener(_0x35fd2b,_0x15aee5){return function(_0x1240be){_0x15aee5[_0x0102('0x3')](_0x35fd2b,_0x1240be);};}function removeListener(_0x2fea82,_0x3d59aa){return function(){VoicePrefixEvents[_0x0102('0x4')](_0x2fea82,_0x3d59aa);};}exports[_0x0102('0x5')]=function(_0x27dd86){for(var _0x3afe31=0x0,_0x55229f=events[_0x0102('0x6')];_0x3afe31<_0x55229f;_0x3afe31++){var _0x1aa60e=events[_0x3afe31];var _0x43df9f=createListener('voicePrefix:'+_0x1aa60e,_0x27dd86);VoicePrefixEvents['on'](_0x1aa60e,_0x43df9f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 74d382f..e59a5bb 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 _0x1314=['post','clone','addTeams','addAgents','/:id/lists','addLists','put','update','delete','destroy','removeTeams','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','getLists','/:id/blacklists','getBlackLists'];(function(_0x165236,_0x48637a){var _0x7ea443=function(_0x465809){while(--_0x465809){_0x165236['push'](_0x165236['shift']());}};_0x7ea443(++_0x48637a);}(_0x1314,0x88));var _0x4131=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0x1314[_0x2c1114];return _0x2b877c;};'use strict';var multer=require(_0x4131('0x0'));var util=require(_0x4131('0x1'));var path=require(_0x4131('0x2'));var timeout=require(_0x4131('0x3'));var express=require(_0x4131('0x4'));var router=express[_0x4131('0x5')]();var fs_extra=require(_0x4131('0x6'));var auth=require(_0x4131('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4131('0x8'));router[_0x4131('0x9')]('/',auth[_0x4131('0xa')](),controller[_0x4131('0xb')]);router[_0x4131('0x9')](_0x4131('0xc'),auth[_0x4131('0xa')](),controller['show']);router[_0x4131('0x9')](_0x4131('0xd'),auth[_0x4131('0xa')](),controller[_0x4131('0xe')]);router[_0x4131('0x9')](_0x4131('0xf'),auth[_0x4131('0xa')](),controller[_0x4131('0x10')]);router[_0x4131('0x9')](_0x4131('0x11'),auth[_0x4131('0xa')](),controller['getHopperFinals']);router[_0x4131('0x9')](_0x4131('0x12'),auth[_0x4131('0xa')](),controller[_0x4131('0x13')]);router[_0x4131('0x9')](_0x4131('0x14'),auth['isAuthenticated'](),controller['getTeams']);router[_0x4131('0x9')](_0x4131('0x15'),auth['isAuthenticated'](),controller[_0x4131('0x16')]);router['get'](_0x4131('0x17'),auth[_0x4131('0xa')](),controller[_0x4131('0x18')]);router[_0x4131('0x9')]('/:id/lists',auth[_0x4131('0xa')](),controller[_0x4131('0x19')]);router[_0x4131('0x9')](_0x4131('0x1a'),auth[_0x4131('0xa')](),controller[_0x4131('0x1b')]);router[_0x4131('0x1c')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4131('0x1c')]('/:id/clone',auth['isAuthenticated'](),controller[_0x4131('0x1d')]);router[_0x4131('0x1c')](_0x4131('0x14'),auth['isAuthenticated'](),controller[_0x4131('0x1e')]);router[_0x4131('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0x4131('0x1f')]);router['post'](_0x4131('0x20'),auth['isAuthenticated'](),controller[_0x4131('0x21')]);router['post']('/:id/blacklists',auth[_0x4131('0xa')](),controller['addBlackLists']);router[_0x4131('0x22')](_0x4131('0xc'),auth[_0x4131('0xa')](),controller[_0x4131('0x23')]);router[_0x4131('0x24')]('/:id',auth[_0x4131('0xa')](),controller[_0x4131('0x25')]);router[_0x4131('0x24')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4131('0x26')]);router[_0x4131('0x24')](_0x4131('0x15'),auth[_0x4131('0xa')](),controller['removeAgents']);router[_0x4131('0x24')](_0x4131('0x20'),auth[_0x4131('0xa')](),controller[_0x4131('0x27')]);router[_0x4131('0x24')](_0x4131('0x1a'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x4131('0x28')]=router; \ No newline at end of file +var _0x7447=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addAgents','addLists','put','update','destroy','delete','removeTeams','removeAgents','removeLists','exports','multer'];(function(_0x4f386e,_0x56ffdd){var _0x4694e2=function(_0x3d16e4){while(--_0x3d16e4){_0x4f386e['push'](_0x4f386e['shift']());}};_0x4694e2(++_0x56ffdd);}(_0x7447,0x12c));var _0x7744=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x7447[_0x27bd2c];return _0x3784ea;};'use strict';var multer=require(_0x7744('0x0'));var util=require(_0x7744('0x1'));var path=require(_0x7744('0x2'));var timeout=require(_0x7744('0x3'));var express=require('express');var router=express[_0x7744('0x4')]();var fs_extra=require(_0x7744('0x5'));var auth=require(_0x7744('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7744('0x7'));var controller=require(_0x7744('0x8'));router[_0x7744('0x9')]('/',auth[_0x7744('0xa')](),controller[_0x7744('0xb')]);router['get'](_0x7744('0xc'),auth['isAuthenticated'](),controller[_0x7744('0xd')]);router[_0x7744('0x9')](_0x7744('0xe'),auth[_0x7744('0xa')](),controller[_0x7744('0xf')]);router[_0x7744('0x9')](_0x7744('0x10'),auth['isAuthenticated'](),controller[_0x7744('0x11')]);router[_0x7744('0x9')](_0x7744('0x12'),auth[_0x7744('0xa')](),controller['getHopperFinals']);router[_0x7744('0x9')](_0x7744('0x13'),auth[_0x7744('0xa')](),controller[_0x7744('0x14')]);router[_0x7744('0x9')](_0x7744('0x15'),auth[_0x7744('0xa')](),controller[_0x7744('0x16')]);router[_0x7744('0x9')](_0x7744('0x17'),auth['isAuthenticated'](),controller[_0x7744('0x18')]);router[_0x7744('0x9')]('/:id/members',auth[_0x7744('0xa')](),controller['getMembers']);router[_0x7744('0x9')](_0x7744('0x19'),auth[_0x7744('0xa')](),controller[_0x7744('0x1a')]);router[_0x7744('0x9')](_0x7744('0x1b'),auth[_0x7744('0xa')](),controller[_0x7744('0x1c')]);router[_0x7744('0x1d')]('/',auth[_0x7744('0xa')](),controller[_0x7744('0x1e')]);router[_0x7744('0x1d')](_0x7744('0x1f'),auth[_0x7744('0xa')](),controller[_0x7744('0x20')]);router[_0x7744('0x1d')]('/:id/teams',auth[_0x7744('0xa')](),controller['addTeams']);router[_0x7744('0x1d')](_0x7744('0x17'),auth[_0x7744('0xa')](),controller[_0x7744('0x21')]);router[_0x7744('0x1d')](_0x7744('0x19'),auth[_0x7744('0xa')](),controller[_0x7744('0x22')]);router[_0x7744('0x1d')](_0x7744('0x1b'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x7744('0x23')](_0x7744('0xc'),auth[_0x7744('0xa')](),controller[_0x7744('0x24')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7744('0x25')]);router[_0x7744('0x26')](_0x7744('0x15'),auth[_0x7744('0xa')](),controller[_0x7744('0x27')]);router['delete']('/:id/users',auth[_0x7744('0xa')](),controller[_0x7744('0x28')]);router[_0x7744('0x26')](_0x7744('0x19'),auth[_0x7744('0xa')](),controller[_0x7744('0x29')]);router[_0x7744('0x26')](_0x7744('0x1b'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x7744('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 24b2d60..e3fa16a 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 _0xdad2=['ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','linear','wrandom','rrordered','setDataValue','rrmemory','getDataValue','type','dialMethod','strategy','booked','roundrobin','progressive','power','INTEGER','yes','all','once','periodic_announce','joinempty','split','leavewhenempty','join','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC'];(function(_0x4e2397,_0xe956cb){var _0x41e53f=function(_0x4c3d40){while(--_0x4c3d40){_0x4e2397['push'](_0x4e2397['shift']());}};_0x41e53f(++_0xe956cb);}(_0xdad2,0x14c));var _0x2dad=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xdad2[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module[_0x2dad('0x0')]={'name':{'type':Sequelize[_0x2dad('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2dad('0x2')](_0x2dad('0x3'),_0x2dad('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':_0x2dad('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x2dad('0x2')]('rr',_0x2dad('0x6'),_0x2dad('0x7'),_0x2dad('0x8'),'random','rrmemory',_0x2dad('0x9'),_0x2dad('0xa'),_0x2dad('0xb')),'allowNull':![],'defaultValue':_0x2dad('0x6'),'set':function(_0x24bb74){this[_0x2dad('0xc')]('strategy',_0x24bb74?_0x24bb74:_0x2dad('0xd'));},'get':function(){var _0x57d1a2=this[_0x2dad('0xe')](_0x2dad('0xf'));var _0x51e961=this[_0x2dad('0xe')](_0x2dad('0x10'));var _0x25ae40=this['getDataValue'](_0x2dad('0x11'));if(_0x57d1a2===_0x2dad('0x3')){return _0x25ae40;}if(_0x51e961==='booked'&&_0x25ae40===_0x2dad('0xd')||_0x51e961===_0x2dad('0x12')&&_0x25ae40===_0x2dad('0x13')){return _0x25ae40;}if(_0x51e961===_0x2dad('0x14')||_0x51e961==='predictive'||_0x51e961===_0x2dad('0x15')){return _0x25ae40;}return null;}},'servicelevel':{'type':Sequelize[_0x2dad('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2dad('0x16')](0xb)},'timeout':{'type':Sequelize[_0x2dad('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x2dad('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x2dad('0x17')},'autopause':{'type':Sequelize[_0x2dad('0x2')](_0x2dad('0x17'),'no',_0x2dad('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x2dad('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x2dad('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2dad('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2dad('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2dad('0x2')](_0x2dad('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2dad('0x2')](_0x2dad('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2dad('0x2')](_0x2dad('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2dad('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2dad('0x2')](_0x2dad('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2dad('0x2')]('yes','no'),'defaultValue':_0x2dad('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x2dad('0x17'),'no',_0x2dad('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x2dad('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x2dad('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2dad('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2dad('0x1')]},'queue_youarenext':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2dad('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x2dad('0x1')]},'queue_quantity1':{'type':Sequelize[_0x2dad('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x2dad('0x1')]},'queue_less_than':{'type':Sequelize[_0x2dad('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x5d4d37){this[_0x2dad('0xc')](_0x2dad('0x1a'),_0x5d4d37?_0x5d4d37['join'](','):[]);},'get':function(){return this[_0x2dad('0xe')](_0x2dad('0x1a'))?this[_0x2dad('0xe')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':_0x2dad('0x17'),'set':function(_0x353370){this[_0x2dad('0xc')](_0x2dad('0x1b'),_0x353370?_0x353370['join'](','):undefined);},'get':function(){return this[_0x2dad('0xe')]('joinempty')?this[_0x2dad('0xe')](_0x2dad('0x1b'))[_0x2dad('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':'no','set':function(_0x35cf62){this[_0x2dad('0xc')](_0x2dad('0x1d'),_0x35cf62?_0x35cf62[_0x2dad('0x1e')](','):undefined);},'get':function(){return this[_0x2dad('0xe')](_0x2dad('0x1d'))?this[_0x2dad('0xe')](_0x2dad('0x1d'))[_0x2dad('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2dad('0x2')](_0x2dad('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2dad('0x2')](_0x2dad('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2dad('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x2dad('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2dad('0x1')]},'acw':{'type':Sequelize[_0x2dad('0x1f')],'defaultValue':0x0,'set':function(_0x4abb32){this[_0x2dad('0xc')](_0x2dad('0x20'),_0x4abb32);if(_0x4abb32){if(this[_0x2dad('0xe')](_0x2dad('0x21'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2dad('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2dad('0x1f')],'defaultValue':0x0,'comment':_0x2dad('0x22')},'dialMethod':{'type':Sequelize[_0x2dad('0x2')](_0x2dad('0x23'),_0x2dad('0x14'),'power',_0x2dad('0x24'),_0x2dad('0x12')),'defaultValue':_0x2dad('0x14'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x2dad('0x16')](0x4)[_0x2dad('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x2dad('0x16')](0x4)[_0x2dad('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2dad('0x26')},'dialPowerLevel':{'type':Sequelize[_0x2dad('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2dad('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x2dad('0x2')]('agentBusyFactor','dropRate'),'defaultValue':_0x2dad('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2dad('0x27')](0x2)[_0x2dad('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x2dad('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2dad('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2dad('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2dad('0x16')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2dad('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x2dad('0x2c'),'comment':_0x2dad('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x2dad('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2dad('0x2e')},'dialQueueProject':{'type':Sequelize[_0x2dad('0x1')],'comment':_0x2dad('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2dad('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2dad('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2dad('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2dad('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2dad('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2dad('0x16')](0x5)[_0x2dad('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2dad('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2dad('0x16')](0x3)[_0x2dad('0x25')],'defaultValue':0x3,'comment':_0x2dad('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2dad('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2dad('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2dad('0x16')](0x3)[_0x2dad('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':_0x2dad('0x36')},'dialPrefix':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2dad('0x2')]('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x2dad('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2dad('0x16')](0x9)[_0x2dad('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2dad('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x2dad('0x16')](0x9)[_0x2dad('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2dad('0x16')](0x9)[_0x2dad('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2dad('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2dad('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2dad('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2dad('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2dad('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2dad('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2dad('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x2dad('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2dad('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2dad('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2dad('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x2dad('0x16')](0x5)[_0x2dad('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2dad('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x2dad('0x3e'),_0x2dad('0x3f')),'defaultValue':_0x2dad('0x3e')},'dialQueueProject2':{'type':Sequelize[_0x2dad('0x1')],'comment':_0x2dad('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2dad('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2dad('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2dad('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2dad('0x40')},'dialCutDigit':{'type':Sequelize[_0x2dad('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2dad('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2dad('0x16')](0x3)[_0x2dad('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2dad('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2dad('0x16')](0x5)[_0x2dad('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2dad('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x2dad('0x16')](0x3)[_0x2dad('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2dad('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x2dad('0x16')](0x5)[_0x2dad('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2dad('0x16')](0x3)[_0x2dad('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2dad('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2dad('0x16')](0x5)[_0x2dad('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2dad('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x2dad('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2dad('0x47')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2dad('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2dad('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2dad('0x16')](0x3)[_0x2dad('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2dad('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2dad('0x16')](0x5)[_0x2dad('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2dad('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2dad('0x16')],'allowNull':!![],'comment':_0x2dad('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x2dad('0x1f')],'defaultValue':![],'comment':_0x2dad('0x4c'),'set':function(_0x4c2ff1){if(!_0x4c2ff1)this[_0x2dad('0xc')](_0x2dad('0x4d'),null);this[_0x2dad('0xc')](_0x2dad('0x4e'),_0x4c2ff1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x2dad('0x16')](0x3)[_0x2dad('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2dad('0x16')](0x3)[_0x2dad('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x0a9f=['Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','inbound','ringall','leastrecent','random','linear','wrandom','setDataValue','rrmemory','getDataValue','type','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','ENUM','all','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x2980d9,_0xef7ff){var _0x37994e=function(_0x555936){while(--_0x555936){_0x2980d9['push'](_0x2980d9['shift']());}};_0x37994e(++_0xef7ff);}(_0x0a9f,0x64));var _0xf0a9=function(_0x2b608e,_0x2b9d76){_0x2b608e=_0x2b608e-0x0;var _0x2aca67=_0x0a9f[_0x2b608e];return _0x2aca67;};'use strict';var Sequelize=require('sequelize');module[_0xf0a9('0x0')]={'name':{'type':Sequelize[_0xf0a9('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf0a9('0x2'),'outbound'),'allowNull':![],'defaultValue':_0xf0a9('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xf0a9('0x3'),_0xf0a9('0x4'),'fewestcalls',_0xf0a9('0x5'),'rrmemory',_0xf0a9('0x6'),_0xf0a9('0x7'),'rrordered'),'allowNull':![],'defaultValue':_0xf0a9('0x3'),'set':function(_0x27c500){this[_0xf0a9('0x8')]('strategy',_0x27c500?_0x27c500:_0xf0a9('0x9'));},'get':function(){var _0x4be957=this[_0xf0a9('0xa')](_0xf0a9('0xb'));var _0x430a1b=this[_0xf0a9('0xa')]('dialMethod');var _0x1b9d6a=this[_0xf0a9('0xa')](_0xf0a9('0xc'));if(_0x4be957===_0xf0a9('0x2')){return _0x1b9d6a;}if(_0x430a1b==='booked'&&_0x1b9d6a==='rrmemory'||_0x430a1b===_0xf0a9('0xd')&&_0x1b9d6a===_0xf0a9('0xe')){return _0x1b9d6a;}if(_0x430a1b===_0xf0a9('0xf')||_0x430a1b===_0xf0a9('0x10')||_0x430a1b===_0xf0a9('0x11')){return _0x1b9d6a;}return null;}},'servicelevel':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf0a9('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xf0a9('0x13'),'no'),'defaultValue':_0xf0a9('0x13')},'autopause':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no',_0xf0a9('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf0a9('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf0a9('0x14')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xf0a9('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf0a9('0x14')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf0a9('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xf0a9('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':_0xf0a9('0x13')},'announce_holdtime':{'type':Sequelize[_0xf0a9('0x14')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0xf0a9('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf0a9('0x1')]},'queue_youarenext':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf0a9('0x1')]},'queue_quantity1':{'type':Sequelize[_0xf0a9('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xf0a9('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4a569c){this['setDataValue'](_0xf0a9('0x16'),_0x4a569c?_0x4a569c[_0xf0a9('0x17')](','):[]);},'get':function(){return this[_0xf0a9('0xa')]('periodic_announce')?this[_0xf0a9('0xa')]('periodic_announce')[_0xf0a9('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':'yes','set':function(_0x18ac98){this[_0xf0a9('0x8')](_0xf0a9('0x19'),_0x18ac98?_0x18ac98[_0xf0a9('0x17')](','):undefined);},'get':function(){return this[_0xf0a9('0xa')](_0xf0a9('0x19'))?this['getDataValue']('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x41888d){this['setDataValue'](_0xf0a9('0x1a'),_0x41888d?_0x41888d[_0xf0a9('0x17')](','):undefined);},'get':function(){return this[_0xf0a9('0xa')](_0xf0a9('0x1a'))?this[_0xf0a9('0xa')]('leavewhenempty')[_0xf0a9('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf0a9('0x1')]},'description':{'type':Sequelize[_0xf0a9('0x1')]},'acw':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':0x0,'set':function(_0x12e4ba){this['setDataValue'](_0xf0a9('0x1c'),_0x12e4ba);if(_0x12e4ba){if(this['getDataValue'](_0xf0a9('0x1d'))<0x2){this[_0xf0a9('0x8')](_0xf0a9('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf0a9('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':0x0,'comment':_0xf0a9('0x1e')},'dialMethod':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x1f'),'progressive','power',_0xf0a9('0x10'),'booked'),'defaultValue':_0xf0a9('0xf'),'comment':_0xf0a9('0x20')},'dialLimitChannel':{'type':Sequelize[_0xf0a9('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf0a9('0x21')},'dialLimitQueue':{'type':Sequelize[_0xf0a9('0x12')](0x4)[_0xf0a9('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf0a9('0x23')},'dialPowerLevel':{'type':Sequelize[_0xf0a9('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xf0a9('0x14')]('agentBusyFactor',_0xf0a9('0x25')),'defaultValue':_0xf0a9('0x25'),'comment':_0xf0a9('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf0a9('0x24')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf0a9('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf0a9('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf0a9('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf0a9('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x29')},'dialQueueOptions':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x2a')},'dialQueueProject':{'type':Sequelize[_0xf0a9('0x1')],'comment':_0xf0a9('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf0a9('0x30')},'dialTimezone':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf0a9('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xf0a9('0x14')](_0xf0a9('0x31'),_0xf0a9('0x32'),_0xf0a9('0x33')),'defaultValue':_0xf0a9('0x31')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf0a9('0x34')},'dialAMDGreeting':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf0a9('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf0a9('0x12')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf0a9('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf0a9('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0xf0a9('0x12')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf0a9('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf0a9('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf0a9('0x12')](0x9)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf0a9('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf0a9('0x3a')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf0a9('0x3b')},'dialRecallInQueue':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':0x0,'comment':_0xf0a9('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xf0a9('0x3d'),_0xf0a9('0x3e')),'defaultValue':_0xf0a9('0x3d')},'dialQueueProject2':{'type':Sequelize[_0xf0a9('0x1')],'comment':_0xf0a9('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xf0a9('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf0a9('0x3f')},'dialCutDigit':{'type':Sequelize[_0xf0a9('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf0a9('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x41')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x42')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf0a9('0x43')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf0a9('0x12')](0x5)[_0xf0a9('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf0a9('0x44')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf0a9('0x12')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf0a9('0x1b')],'defaultValue':![],'comment':_0xf0a9('0x45'),'set':function(_0x3c3c9e){if(!_0x3c3c9e)this[_0xf0a9('0x8')](_0xf0a9('0x46'),null);this[_0xf0a9('0x8')]('mandatoryDisposition',_0x3c3c9e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf0a9('0x12')](0x3)[_0xf0a9('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf0a9('0x12')](0x3)['UNSIGNED'],'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 e217396..f5bc71b 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 _0x5b6a=['addAgents','spread','isEmpty','isNil','getAgents','getLists','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','cm_hopper','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','UserProfileResource','error','stack','name','send','index','VoiceQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','keys','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','body','omit','UserProfileSection','autoAssociation','getHoppers','CmHopper','VoiceQueueId','findAll','findOne','CmHopperHistory','rawAttributes','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','removeAgents','userVoiceQueue:remove'];(function(_0x5d865a,_0x547f71){var _0x199ac6=function(_0x4ba78b){while(--_0x4ba78b){_0x5d865a['push'](_0x5d865a['shift']());}};_0x199ac6(++_0x547f71);}(_0x5b6a,0xda));var _0xa5b6=function(_0x55e099,_0x9fa64a){_0x55e099=_0x55e099-0x0;var _0x551a58=_0x5b6a[_0x55e099];return _0x551a58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5b6('0x0'));var zipdir=require(_0xa5b6('0x1'));var jsonpatch=require(_0xa5b6('0x2'));var rp=require(_0xa5b6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa5b6('0x4'));var util=require(_0xa5b6('0x5'));var path=require(_0xa5b6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa5b6('0x7'));var fs=require('fs');var fs_extra=require(_0xa5b6('0x8'));var _=require(_0xa5b6('0x9'));var squel=require(_0xa5b6('0xa'));var crypto=require(_0xa5b6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa5b6('0xc'));var toCsv=require(_0xa5b6('0xd'));var querystring=require(_0xa5b6('0xe'));var Papa=require(_0xa5b6('0xf'));var Redis=require('ioredis');var authService=require(_0xa5b6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa5b6('0x11'));var hardwareService=require(_0xa5b6('0x12'));var logger=require('../../config/logger')(_0xa5b6('0x13'));var utils=require('../../config/utils');var config=require(_0xa5b6('0x14'));var licenseUtil=require(_0xa5b6('0x15'));var db=require(_0xa5b6('0x16'))['db'];config[_0xa5b6('0x17')]=_[_0xa5b6('0x18')](config[_0xa5b6('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa5b6('0x19'))(new Redis(config['redis']));require(_0xa5b6('0x1a'))[_0xa5b6('0x1b')](socket);function respondWithStatusCode(_0x27c216,_0x13ba78){_0x13ba78=_0x13ba78||0xcc;return function(_0x98cf9e){if(_0x98cf9e){return _0x27c216[_0xa5b6('0x1c')](_0x13ba78);}return _0x27c216[_0xa5b6('0x1d')](_0x13ba78)[_0xa5b6('0x1e')]();};}function respondWithResult(_0x2b8497,_0xdaa29e){_0xdaa29e=_0xdaa29e||0xc8;return function(_0xfca7ee){if(_0xfca7ee){return _0x2b8497[_0xa5b6('0x1d')](_0xdaa29e)['json'](_0xfca7ee);}};}function respondWithFilteredResult(_0x1bd7c1,_0x5bf2f6){return function(_0x59f4ba){if(_0x59f4ba){var _0xf47966=typeof _0x5bf2f6['offset']===_0xa5b6('0x1f')&&typeof _0x5bf2f6['limit']===_0xa5b6('0x1f');var _0x9b4e54=_0x59f4ba[_0xa5b6('0x20')];var _0x1256e1=_0xf47966?0x0:_0x5bf2f6[_0xa5b6('0x21')];var _0x292a7a=_0xf47966?_0x59f4ba[_0xa5b6('0x20')]:_0x5bf2f6[_0xa5b6('0x21')]+_0x5bf2f6[_0xa5b6('0x22')];var _0x2c511d;if(_0x292a7a>=_0x9b4e54){_0x292a7a=_0x9b4e54;_0x2c511d=0xc8;}else{_0x2c511d=0xce;}_0x1bd7c1['status'](_0x2c511d);return _0x1bd7c1[_0xa5b6('0x23')]('Content-Range',_0x1256e1+'-'+_0x292a7a+'/'+_0x9b4e54)[_0xa5b6('0x24')](_0x59f4ba);}return null;};}function patchUpdates(_0x796656){return function(_0x5c78e8){try{jsonpatch[_0xa5b6('0x25')](_0x5c78e8,_0x796656,!![]);}catch(_0x1076ff){return BPromise['reject'](_0x1076ff);}return _0x5c78e8[_0xa5b6('0x26')]();};}function saveUpdates(_0x3ceb00,_0x4a930b){return function(_0x288f06){if(_0x288f06){return _0x288f06[_0xa5b6('0x27')](_0x3ceb00)[_0xa5b6('0x28')](function(_0x54b239){return _0x54b239;});}return null;};}function removeEntity(_0x32e1d1,_0x22daed){return function(_0x492800){if(_0x492800){return _0x492800[_0xa5b6('0x29')]()[_0xa5b6('0x28')](function(){var _0x2e9d2d=_0x492800[_0xa5b6('0x2a')]({'plain':!![]});var _0xba8115=[{'name':_0xa5b6('0x2b'),'value':_0xa5b6('0x2c'),'ignore':![]},{'name':_0xa5b6('0x2d'),'value':_0xa5b6('0x2e'),'ignore':![]}];var _0x5a8f4f=_(_0xba8115)[_0xa5b6('0x2f')]('ignore')[_0xa5b6('0x30')]('value')[_0xa5b6('0x31')]();if(_[_0xa5b6('0x32')](_0x5a8f4f,_0x2e9d2d[_0xa5b6('0x33')])){return;}var _0x503812=_[_0xa5b6('0x34')](_0xba8115,['value',_0x2e9d2d[_0xa5b6('0x33')]])['name'];return db[_0xa5b6('0x35')][_0xa5b6('0x29')]({'where':{'type':_0x503812,'resourceId':_0x2e9d2d['id']}})[_0xa5b6('0x28')](function(){return _0x492800;});})['then'](function(){_0x32e1d1[_0xa5b6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x254a1a,_0x2222de){return function(_0x52fc8c){if(!_0x52fc8c){_0x254a1a['sendStatus'](0x194);}return _0x52fc8c;};}function handleError(_0xf0281f,_0x4e86de){_0x4e86de=_0x4e86de||0x1f4;return function(_0x22303c){logger[_0xa5b6('0x36')](_0x22303c[_0xa5b6('0x37')]);if(_0x22303c[_0xa5b6('0x38')]){delete _0x22303c[_0xa5b6('0x38')];}_0xf0281f['status'](_0x4e86de)[_0xa5b6('0x39')](_0x22303c);};}exports[_0xa5b6('0x3a')]=function(_0x22ae76,_0x1f8042){var _0x285f97={},_0x2ab5b0={},_0x2e4f66={'count':0x0,'rows':[]};var _0x24d677=_[_0xa5b6('0x30')](db[_0xa5b6('0x3b')]['rawAttributes'],function(_0x58dbe1){return{'name':_0x58dbe1[_0xa5b6('0x3c')],'type':_0x58dbe1['type'][_0xa5b6('0x3d')]};});_0x2ab5b0[_0xa5b6('0x3e')]=_['map'](_0x24d677,'name');_0x2ab5b0[_0xa5b6('0x3f')]=_['keys'](_0x22ae76['query']);_0x2ab5b0[_0xa5b6('0x40')]=_[_0xa5b6('0x41')](_0x2ab5b0[_0xa5b6('0x3e')],_0x2ab5b0[_0xa5b6('0x3f')]);_0x285f97[_0xa5b6('0x42')]=_[_0xa5b6('0x41')](_0x2ab5b0[_0xa5b6('0x3e')],qs[_0xa5b6('0x43')](_0x22ae76[_0xa5b6('0x3f')][_0xa5b6('0x43')]));_0x285f97[_0xa5b6('0x42')]=_0x285f97[_0xa5b6('0x42')][_0xa5b6('0x44')]?_0x285f97[_0xa5b6('0x42')]:_0x2ab5b0[_0xa5b6('0x3e')];if(!_0x22ae76[_0xa5b6('0x3f')][_0xa5b6('0x45')](_0xa5b6('0x46'))){_0x285f97[_0xa5b6('0x22')]=qs[_0xa5b6('0x22')](_0x22ae76[_0xa5b6('0x3f')][_0xa5b6('0x22')]);_0x285f97[_0xa5b6('0x21')]=qs[_0xa5b6('0x21')](_0x22ae76[_0xa5b6('0x3f')][_0xa5b6('0x21')]);}_0x285f97[_0xa5b6('0x47')]=qs['sort'](_0x22ae76[_0xa5b6('0x3f')][_0xa5b6('0x48')]);_0x285f97[_0xa5b6('0x49')]=qs['filters'](_[_0xa5b6('0x4a')](_0x22ae76['query'],_0x2ab5b0['filters']),_0x24d677);if(_0x22ae76[_0xa5b6('0x3f')][_0xa5b6('0x2f')]){_0x285f97[_0xa5b6('0x49')]=_[_0xa5b6('0x4b')](_0x285f97[_0xa5b6('0x49')],{'$or':_[_0xa5b6('0x30')](_0x24d677,function(_0x204e22){if(_0x204e22[_0xa5b6('0x33')]!==_0xa5b6('0x4c')){var _0x58e5b6={};_0x58e5b6[_0x204e22[_0xa5b6('0x38')]]={'$like':'%'+_0x22ae76[_0xa5b6('0x3f')][_0xa5b6('0x2f')]+'%'};return _0x58e5b6;}})});}_0x285f97=_[_0xa5b6('0x4b')]({},_0x285f97,_0x22ae76[_0xa5b6('0x4d')]);var _0x19d0dc={'where':_0x285f97['where']};return db['VoiceQueue'][_0xa5b6('0x20')](_0x19d0dc)[_0xa5b6('0x28')](function(_0xd187ea){_0x2e4f66[_0xa5b6('0x20')]=_0xd187ea;if(_0x22ae76[_0xa5b6('0x3f')][_0xa5b6('0x4e')]){_0x285f97['include']=[{'all':!![]}];}return db[_0xa5b6('0x3b')]['findAll'](_0x285f97);})[_0xa5b6('0x28')](function(_0x1e8079){_0x2e4f66[_0xa5b6('0x4f')]=_0x1e8079;return _0x2e4f66;})[_0xa5b6('0x28')](respondWithFilteredResult(_0x1f8042,_0x285f97))['catch'](handleError(_0x1f8042,null));};exports['show']=function(_0x5027a6,_0x5dba04){var _0x3b1169={'raw':![],'where':{'id':_0x5027a6['params']['id']}},_0x56b489={};_0x56b489[_0xa5b6('0x3e')]=_[_0xa5b6('0x50')](db[_0xa5b6('0x3b')]['rawAttributes']);_0x56b489[_0xa5b6('0x3f')]=_[_0xa5b6('0x50')](_0x5027a6[_0xa5b6('0x3f')]);_0x56b489[_0xa5b6('0x40')]=_[_0xa5b6('0x41')](_0x56b489[_0xa5b6('0x3e')],_0x56b489[_0xa5b6('0x3f')]);_0x3b1169['attributes']=_[_0xa5b6('0x41')](_0x56b489[_0xa5b6('0x3e')],qs[_0xa5b6('0x43')](_0x5027a6['query'][_0xa5b6('0x43')]));_0x3b1169[_0xa5b6('0x42')]=_0x3b1169[_0xa5b6('0x42')][_0xa5b6('0x44')]?_0x3b1169[_0xa5b6('0x42')]:_0x56b489['model'];if(_0x5027a6[_0xa5b6('0x3f')]['includeAll']){_0x3b1169[_0xa5b6('0x51')]=[{'all':!![]}];}_0x3b1169=_[_0xa5b6('0x4b')]({},_0x3b1169,_0x5027a6[_0xa5b6('0x4d')]);return db['VoiceQueue'][_0xa5b6('0x34')](_0x3b1169)[_0xa5b6('0x28')](handleEntityNotFound(_0x5dba04,null))[_0xa5b6('0x28')](respondWithResult(_0x5dba04,null))[_0xa5b6('0x52')](handleError(_0x5dba04,null));};exports[_0xa5b6('0x53')]=function(_0xf4271,_0x159e87){return db[_0xa5b6('0x3b')][_0xa5b6('0x53')](_0xf4271['body'],{})[_0xa5b6('0x28')](function(_0x529b26){var _0x27ab23=_0xf4271[_0xa5b6('0x54')][_0xa5b6('0x2a')]({'plain':!![]});if(!_0x27ab23)throw new Error(_0xa5b6('0x55'));if(_0x27ab23[_0xa5b6('0x56')]==='user'){var _0x3a04b4=_0x529b26['get']({'plain':!![]});var _0x45f879=[{'name':'VoiceQueues','value':_0xa5b6('0x2c')},{'name':'QueueCampaigns','value':_0xa5b6('0x2e')}];var _0x1b4bb4=_[_0xa5b6('0x34')](_0x45f879,['value',_0x3a04b4[_0xa5b6('0x33')]])[_0xa5b6('0x38')];return db['UserProfileSection']['find']({'where':{'name':_0x1b4bb4,'userProfileId':_0x27ab23[_0xa5b6('0x57')]},'raw':!![]})['then'](function(_0x344c6d){if(_0x344c6d&&_0x344c6d['autoAssociation']===0x0){return db[_0xa5b6('0x35')][_0xa5b6('0x53')]({'name':_0x3a04b4[_0xa5b6('0x38')],'resourceId':_0x3a04b4['id'],'type':_0x344c6d[_0xa5b6('0x38')],'sectionId':_0x344c6d['id']},{})[_0xa5b6('0x28')](function(){return _0x529b26;});}else{return _0x529b26;}})[_0xa5b6('0x52')](function(_0x2dfb46){logger[_0xa5b6('0x36')](_0xa5b6('0x58'),_0x2dfb46);throw _0x2dfb46;});}return _0x529b26;})[_0xa5b6('0x28')](respondWithResult(_0x159e87,0xc9))[_0xa5b6('0x52')](handleError(_0x159e87,null));};exports[_0xa5b6('0x59')]=function(_0xfe747a,_0x236eb1){var _0x140df6={'where':{'id':_0xfe747a[_0xa5b6('0x5a')]['id']}},_0x3aad9b={};_0x3aad9b[_0xa5b6('0x3e')]=_['keys'](db[_0xa5b6('0x3b')]['rawAttributes']);_0x140df6[_0xa5b6('0x42')]=_[_0xa5b6('0x41')](_0x3aad9b[_0xa5b6('0x3e')],qs['fields'](_0xfe747a['query']['fields']));_0x140df6[_0xa5b6('0x42')]=_0x140df6['attributes']['length']?_0x140df6['attributes']:_0x3aad9b['model'];if(_0xfe747a[_0xa5b6('0x3f')][_0xa5b6('0x4e')]){_0x140df6[_0xa5b6('0x51')]=[{'all':!![]}];}_0x140df6=_[_0xa5b6('0x4b')]({},_0x140df6,_0xfe747a[_0xa5b6('0x4d')]);return db[_0xa5b6('0x3b')][_0xa5b6('0x34')](_0x140df6)['then'](handleEntityNotFound(_0x236eb1,null))[_0xa5b6('0x28')](function(_0xa11e2f){if(_0xa11e2f){var _0x3b82f3=_0xa11e2f[_0xa5b6('0x2a')]({'plain':!![]});_0x3b82f3=qs['omit'](_0x3b82f3,['id',_0xa5b6('0x5b'),'updatedAt']);_0xfe747a[_0xa5b6('0x5c')]=_[_0xa5b6('0x5d')](_0xfe747a[_0xa5b6('0x5c')],['id',_0xa5b6('0x5b'),'updatedAt']);return db[_0xa5b6('0x3b')][_0xa5b6('0x53')](_[_0xa5b6('0x4b')](_0x3b82f3,_0xfe747a['body']),{'include':_0xfe747a[_0xa5b6('0x3f')][_0xa5b6('0x4e')]?[{'all':!![]}]:undefined})[_0xa5b6('0x28')](function(_0x5330ef){var _0x597369=_0xfe747a['user'][_0xa5b6('0x2a')]({'plain':!![]});if(!_0x597369)throw new Error(_0xa5b6('0x55'));if(_0x597369['role']===_0xa5b6('0x54')){var _0xfd4af=_0x5330ef[_0xa5b6('0x2a')]({'plain':!![]});var _0x2b5dee=[{'name':'VoiceQueues','value':_0xa5b6('0x2c')},{'name':_0xa5b6('0x2d'),'value':_0xa5b6('0x2e')}];var _0x306e42=_[_0xa5b6('0x34')](_0x2b5dee,['value',_0xfd4af[_0xa5b6('0x33')]])[_0xa5b6('0x38')];return db[_0xa5b6('0x5e')]['find']({'where':{'name':_0x306e42,'userProfileId':_0x597369['userProfileId']},'raw':!![]})[_0xa5b6('0x28')](function(_0x1bad00){if(_0x1bad00&&_0x1bad00[_0xa5b6('0x5f')]===0x0){return db['UserProfileResource'][_0xa5b6('0x53')]({'name':_0xfd4af[_0xa5b6('0x38')],'resourceId':_0xfd4af['id'],'type':_0x1bad00[_0xa5b6('0x38')],'sectionId':_0x1bad00['id']},{})[_0xa5b6('0x28')](function(){return _0x5330ef;});}else{return _0x5330ef;}})['catch'](function(_0x421cd3){logger[_0xa5b6('0x36')](_0xa5b6('0x58'),_0x421cd3);throw _0x421cd3;});}return _0x5330ef;});}})['then'](respondWithResult(_0x236eb1,0xc9))[_0xa5b6('0x52')](handleError(_0x236eb1,null));};exports[_0xa5b6('0x27')]=function(_0x5c6efb,_0x3b33a4){if(_0x5c6efb[_0xa5b6('0x5c')]['id']){delete _0x5c6efb[_0xa5b6('0x5c')]['id'];}return db[_0xa5b6('0x3b')][_0xa5b6('0x34')]({'where':{'id':_0x5c6efb[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x3b33a4,null))['then'](saveUpdates(_0x5c6efb[_0xa5b6('0x5c')],null))[_0xa5b6('0x28')](respondWithResult(_0x3b33a4,null))[_0xa5b6('0x52')](handleError(_0x3b33a4,null));};exports[_0xa5b6('0x29')]=function(_0x52fe36,_0x58e5b0){return db['VoiceQueue']['find']({'where':{'id':_0x52fe36[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x58e5b0,null))[_0xa5b6('0x28')](removeEntity(_0x58e5b0,null))[_0xa5b6('0x52')](handleError(_0x58e5b0,null));};exports[_0xa5b6('0x60')]=function(_0x42e539,_0x4bc5ae,_0x2d651f){var _0x165594={'raw':![],'where':{}};var _0x4ff30c={};var _0x42a454={'count':0x0,'rows':[]};return db[_0xa5b6('0x3b')]['findOne']({'where':{'id':_0x42e539[_0xa5b6('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4bc5ae,null))[_0xa5b6('0x28')](function(_0x1803f3){if(_0x1803f3){_0x4ff30c[_0xa5b6('0x3e')]=_[_0xa5b6('0x50')](db[_0xa5b6('0x61')]['rawAttributes']);_0x4ff30c[_0xa5b6('0x3f')]=_[_0xa5b6('0x50')](_0x42e539[_0xa5b6('0x3f')]);_0x4ff30c[_0xa5b6('0x40')]=_['intersection'](_0x4ff30c['model'],_0x4ff30c[_0xa5b6('0x3f')]);_0x165594['attributes']=_[_0xa5b6('0x41')](_0x4ff30c['model'],qs[_0xa5b6('0x43')](_0x42e539['query'][_0xa5b6('0x43')]));_0x165594[_0xa5b6('0x42')]=_0x165594[_0xa5b6('0x42')][_0xa5b6('0x44')]?_0x165594[_0xa5b6('0x42')]:_0x4ff30c[_0xa5b6('0x3e')];if(!_0x42e539['query'][_0xa5b6('0x45')]('nolimit')){_0x165594[_0xa5b6('0x22')]=qs[_0xa5b6('0x22')](_0x42e539[_0xa5b6('0x3f')][_0xa5b6('0x22')]);_0x165594[_0xa5b6('0x21')]=qs['offset'](_0x42e539['query'][_0xa5b6('0x21')]);}_0x165594[_0xa5b6('0x47')]=qs[_0xa5b6('0x48')](_0x42e539[_0xa5b6('0x3f')][_0xa5b6('0x48')]);_0x165594[_0xa5b6('0x49')]=qs[_0xa5b6('0x40')](_[_0xa5b6('0x4a')](_0x42e539[_0xa5b6('0x3f')],_0x4ff30c[_0xa5b6('0x40')]));_0x165594[_0xa5b6('0x49')][_0xa5b6('0x62')]=_0x1803f3['id'];if(_0x42e539[_0xa5b6('0x3f')]['filter']){_0x165594['where']=_[_0xa5b6('0x4b')](_0x165594['where'],{'$or':_[_0xa5b6('0x30')](_0x165594[_0xa5b6('0x42')],function(_0x4b69d2){var _0x489cd6={};_0x489cd6[_0x4b69d2]={'$like':'%'+_0x42e539[_0xa5b6('0x3f')][_0xa5b6('0x2f')]+'%'};return _0x489cd6;})});}_0x165594=_['merge']({},_0x165594,_0x42e539[_0xa5b6('0x4d')]);return db[_0xa5b6('0x61')][_0xa5b6('0x20')]({'where':_0x165594[_0xa5b6('0x49')]})[_0xa5b6('0x28')](function(_0x2d9dfd){_0x42a454['count']=_0x2d9dfd;if(_0x42e539[_0xa5b6('0x3f')][_0xa5b6('0x4e')]){_0x165594['include']=[{'all':!![]}];}return db[_0xa5b6('0x61')][_0xa5b6('0x63')](_0x165594);})[_0xa5b6('0x28')](function(_0x307f47){_0x42a454[_0xa5b6('0x4f')]=_0x307f47;return _0x42a454;});}})[_0xa5b6('0x28')](respondWithFilteredResult(_0x4bc5ae,_0x165594))[_0xa5b6('0x52')](handleError(_0x4bc5ae,null));};exports['getHopperHistories']=function(_0x9d2403,_0x51069f,_0x321e8b){var _0x4dc8aa={'raw':!![],'where':{}};var _0x71a606={};var _0x22fced={'count':0x0,'rows':[]};return db[_0xa5b6('0x3b')][_0xa5b6('0x64')]({'where':{'id':_0x9d2403['params']['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x51069f,null))[_0xa5b6('0x28')](function(_0x481a50){if(_0x481a50){_0x71a606['model']=_[_0xa5b6('0x50')](db[_0xa5b6('0x65')][_0xa5b6('0x66')]);_0x71a606[_0xa5b6('0x3f')]=_[_0xa5b6('0x50')](_0x9d2403['query']);_0x71a606['filters']=_[_0xa5b6('0x41')](_0x71a606['model'],_0x71a606[_0xa5b6('0x3f')]);_0x4dc8aa[_0xa5b6('0x42')]=_['intersection'](_0x71a606[_0xa5b6('0x3e')],qs[_0xa5b6('0x43')](_0x9d2403[_0xa5b6('0x3f')][_0xa5b6('0x43')]));_0x4dc8aa[_0xa5b6('0x42')]=_0x4dc8aa[_0xa5b6('0x42')][_0xa5b6('0x44')]?_0x4dc8aa['attributes']:_0x71a606[_0xa5b6('0x3e')];if(!_0x9d2403[_0xa5b6('0x3f')]['hasOwnProperty']('nolimit')){_0x4dc8aa[_0xa5b6('0x22')]=qs[_0xa5b6('0x22')](_0x9d2403[_0xa5b6('0x3f')][_0xa5b6('0x22')]);_0x4dc8aa[_0xa5b6('0x21')]=qs['offset'](_0x9d2403[_0xa5b6('0x3f')][_0xa5b6('0x21')]);}_0x4dc8aa[_0xa5b6('0x47')]=qs['sort'](_0x9d2403['query']['sort']);_0x4dc8aa[_0xa5b6('0x49')]=qs['filters'](_[_0xa5b6('0x4a')](_0x9d2403[_0xa5b6('0x3f')],_0x71a606[_0xa5b6('0x40')]));_0x4dc8aa[_0xa5b6('0x49')][_0xa5b6('0x62')]=_0x481a50['id'];if(_0x9d2403[_0xa5b6('0x3f')][_0xa5b6('0x2f')]){_0x4dc8aa[_0xa5b6('0x49')]=_[_0xa5b6('0x4b')](_0x4dc8aa['where'],{'$or':_[_0xa5b6('0x30')](_0x4dc8aa[_0xa5b6('0x42')],function(_0x2134a0){var _0x375ae1={};_0x375ae1[_0x2134a0]={'$like':'%'+_0x9d2403[_0xa5b6('0x3f')][_0xa5b6('0x2f')]+'%'};return _0x375ae1;})});}_0x4dc8aa=_[_0xa5b6('0x4b')]({},_0x4dc8aa,_0x9d2403[_0xa5b6('0x4d')]);return db['CmHopperHistory'][_0xa5b6('0x20')]({'where':_0x4dc8aa[_0xa5b6('0x49')]})['then'](function(_0x3964ed){_0x22fced[_0xa5b6('0x20')]=_0x3964ed;if(_0x9d2403[_0xa5b6('0x3f')][_0xa5b6('0x4e')]){_0x4dc8aa[_0xa5b6('0x51')]=[{'all':!![]}];}return db[_0xa5b6('0x65')][_0xa5b6('0x63')](_0x4dc8aa);})[_0xa5b6('0x28')](function(_0x4207a5){_0x22fced[_0xa5b6('0x4f')]=_0x4207a5;return _0x22fced;});}})[_0xa5b6('0x28')](respondWithFilteredResult(_0x51069f,_0x4dc8aa))[_0xa5b6('0x52')](handleError(_0x51069f,null));};exports[_0xa5b6('0x67')]=function(_0x3516b4,_0x5b47b3,_0x3d70bc){var _0x57a2e5={'raw':!![],'where':{}};var _0x189744={};var _0x592945={'count':0x0,'rows':[]};return db[_0xa5b6('0x3b')][_0xa5b6('0x64')]({'where':{'id':_0x3516b4['params']['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x5b47b3,null))[_0xa5b6('0x28')](function(_0x193f6b){if(_0x193f6b){_0x189744[_0xa5b6('0x3e')]=_[_0xa5b6('0x50')](db[_0xa5b6('0x68')][_0xa5b6('0x66')]);_0x189744[_0xa5b6('0x3f')]=_[_0xa5b6('0x50')](_0x3516b4[_0xa5b6('0x3f')]);_0x189744[_0xa5b6('0x40')]=_[_0xa5b6('0x41')](_0x189744[_0xa5b6('0x3e')],_0x189744['query']);_0x57a2e5[_0xa5b6('0x42')]=_[_0xa5b6('0x41')](_0x189744[_0xa5b6('0x3e')],qs[_0xa5b6('0x43')](_0x3516b4[_0xa5b6('0x3f')][_0xa5b6('0x43')]));_0x57a2e5[_0xa5b6('0x42')]=_0x57a2e5[_0xa5b6('0x42')]['length']?_0x57a2e5[_0xa5b6('0x42')]:_0x189744[_0xa5b6('0x3e')];if(!_0x3516b4['query'][_0xa5b6('0x45')](_0xa5b6('0x46'))){_0x57a2e5[_0xa5b6('0x22')]=qs[_0xa5b6('0x22')](_0x3516b4[_0xa5b6('0x3f')][_0xa5b6('0x22')]);_0x57a2e5[_0xa5b6('0x21')]=qs[_0xa5b6('0x21')](_0x3516b4['query']['offset']);}_0x57a2e5[_0xa5b6('0x47')]=qs['sort'](_0x3516b4[_0xa5b6('0x3f')][_0xa5b6('0x48')]);_0x57a2e5['where']=qs[_0xa5b6('0x40')](_['pick'](_0x3516b4[_0xa5b6('0x3f')],_0x189744[_0xa5b6('0x40')]));_0x57a2e5[_0xa5b6('0x49')][_0xa5b6('0x62')]=_0x193f6b['id'];if(_0x3516b4[_0xa5b6('0x3f')]['filter']){_0x57a2e5[_0xa5b6('0x49')]=_[_0xa5b6('0x4b')](_0x57a2e5['where'],{'$or':_[_0xa5b6('0x30')](_0x57a2e5['attributes'],function(_0x3cf518){var _0x159f29={};_0x159f29[_0x3cf518]={'$like':'%'+_0x3516b4[_0xa5b6('0x3f')][_0xa5b6('0x2f')]+'%'};return _0x159f29;})});}_0x57a2e5=_[_0xa5b6('0x4b')]({},_0x57a2e5,_0x3516b4[_0xa5b6('0x4d')]);return db[_0xa5b6('0x68')]['count']({'where':_0x57a2e5[_0xa5b6('0x49')]})[_0xa5b6('0x28')](function(_0x306613){_0x592945[_0xa5b6('0x20')]=_0x306613;if(_0x3516b4['query']['includeAll']){_0x57a2e5[_0xa5b6('0x51')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xa5b6('0x63')](_0x57a2e5);})[_0xa5b6('0x28')](function(_0x4f85f7){_0x592945[_0xa5b6('0x4f')]=_0x4f85f7;return _0x592945;});}})['then'](respondWithFilteredResult(_0x5b47b3,_0x57a2e5))['catch'](handleError(_0x5b47b3,null));};exports[_0xa5b6('0x69')]=function(_0x542d1f,_0x1821d9,_0x26482e){var _0x26f778={'raw':!![],'where':{}};var _0x3e7464={};var _0x2246c3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa5b6('0x64')]({'where':{'id':_0x542d1f[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x1821d9,null))['then'](function(_0x1ae8e3){if(_0x1ae8e3){_0x3e7464[_0xa5b6('0x3e')]=_[_0xa5b6('0x50')](db[_0xa5b6('0x6a')][_0xa5b6('0x66')]);_0x3e7464[_0xa5b6('0x3f')]=_[_0xa5b6('0x50')](_0x542d1f[_0xa5b6('0x3f')]);_0x3e7464[_0xa5b6('0x40')]=_['intersection'](_0x3e7464['model'],_0x3e7464[_0xa5b6('0x3f')]);_0x26f778[_0xa5b6('0x42')]=_[_0xa5b6('0x41')](_0x3e7464['model'],qs[_0xa5b6('0x43')](_0x542d1f[_0xa5b6('0x3f')][_0xa5b6('0x43')]));_0x26f778['attributes']=_0x26f778[_0xa5b6('0x42')][_0xa5b6('0x44')]?_0x26f778[_0xa5b6('0x42')]:_0x3e7464[_0xa5b6('0x3e')];if(!_0x542d1f['query'][_0xa5b6('0x45')](_0xa5b6('0x46'))){_0x26f778['limit']=qs[_0xa5b6('0x22')](_0x542d1f[_0xa5b6('0x3f')][_0xa5b6('0x22')]);_0x26f778[_0xa5b6('0x21')]=qs[_0xa5b6('0x21')](_0x542d1f[_0xa5b6('0x3f')][_0xa5b6('0x21')]);}_0x26f778[_0xa5b6('0x47')]=qs[_0xa5b6('0x48')](_0x542d1f[_0xa5b6('0x3f')][_0xa5b6('0x48')]);_0x26f778[_0xa5b6('0x49')]=qs[_0xa5b6('0x40')](_[_0xa5b6('0x4a')](_0x542d1f[_0xa5b6('0x3f')],_0x3e7464[_0xa5b6('0x40')]));_0x26f778[_0xa5b6('0x49')][_0xa5b6('0x62')]=_0x1ae8e3['id'];if(_0x542d1f[_0xa5b6('0x3f')]['filter']){_0x26f778[_0xa5b6('0x49')]=_['merge'](_0x26f778[_0xa5b6('0x49')],{'$or':_[_0xa5b6('0x30')](_0x26f778['attributes'],function(_0x4716e0){var _0x51a2c6={};_0x51a2c6[_0x4716e0]={'$like':'%'+_0x542d1f['query'][_0xa5b6('0x2f')]+'%'};return _0x51a2c6;})});}_0x26f778=_['merge']({},_0x26f778,_0x542d1f['options']);return db[_0xa5b6('0x6a')][_0xa5b6('0x20')]({'where':_0x26f778['where']})[_0xa5b6('0x28')](function(_0x377001){_0x2246c3[_0xa5b6('0x20')]=_0x377001;if(_0x542d1f[_0xa5b6('0x3f')]['includeAll']){_0x26f778[_0xa5b6('0x51')]=[{'all':!![]}];}return db[_0xa5b6('0x6a')]['findAll'](_0x26f778);})[_0xa5b6('0x28')](function(_0x33b1ef){_0x2246c3[_0xa5b6('0x4f')]=_0x33b1ef;return _0x2246c3;});}})['then'](respondWithFilteredResult(_0x1821d9,_0x26f778))['catch'](handleError(_0x1821d9,null));};exports[_0xa5b6('0x6b')]=function(_0x52761b,_0xe0bfa1,_0x10466e){var _0x3dd9c4={};var _0x4ec78c={};var _0x43e267;var _0x3df669;return db[_0xa5b6('0x3b')][_0xa5b6('0x64')]({'where':{'id':_0x52761b['params']['id']}})['then'](handleEntityNotFound(_0xe0bfa1,null))[_0xa5b6('0x28')](function(_0x135d07){if(_0x135d07){_0x43e267=_0x135d07;_0x4ec78c[_0xa5b6('0x3e')]=_[_0xa5b6('0x50')](db[_0xa5b6('0x6c')][_0xa5b6('0x66')]);_0x4ec78c[_0xa5b6('0x3f')]=_[_0xa5b6('0x50')](_0x52761b[_0xa5b6('0x3f')]);_0x4ec78c[_0xa5b6('0x40')]=_[_0xa5b6('0x41')](_0x4ec78c[_0xa5b6('0x3e')],_0x4ec78c[_0xa5b6('0x3f')]);_0x3dd9c4[_0xa5b6('0x42')]=_['intersection'](_0x4ec78c[_0xa5b6('0x3e')],qs['fields'](_0x52761b[_0xa5b6('0x3f')]['fields']));_0x3dd9c4[_0xa5b6('0x42')]=_0x3dd9c4[_0xa5b6('0x42')][_0xa5b6('0x44')]?_0x3dd9c4[_0xa5b6('0x42')]:_0x4ec78c[_0xa5b6('0x3e')];_0x3dd9c4[_0xa5b6('0x47')]=qs[_0xa5b6('0x48')](_0x52761b[_0xa5b6('0x3f')][_0xa5b6('0x48')]);_0x3dd9c4[_0xa5b6('0x49')]=qs[_0xa5b6('0x40')](_['pick'](_0x52761b[_0xa5b6('0x3f')],_0x4ec78c[_0xa5b6('0x40')]));if(_0x52761b[_0xa5b6('0x3f')][_0xa5b6('0x2f')]){_0x3dd9c4[_0xa5b6('0x49')]=_['merge'](_0x3dd9c4['where'],{'$or':_[_0xa5b6('0x30')](_0x3dd9c4['attributes'],function(_0x1d354b){var _0x23b212={};_0x23b212[_0x1d354b]={'$like':'%'+_0x52761b['query'][_0xa5b6('0x2f')]+'%'};return _0x23b212;})});}_0x3dd9c4=_['merge']({},_0x3dd9c4,_0x52761b[_0xa5b6('0x4d')]);return _0x43e267['getTeams'](_0x3dd9c4);}})['then'](function(_0xa302d6){if(_0xa302d6){_0x3df669=_0xa302d6[_0xa5b6('0x44')];if(!_0x52761b['query'][_0xa5b6('0x45')]('nolimit')){_0x3dd9c4[_0xa5b6('0x22')]=qs[_0xa5b6('0x22')](_0x52761b[_0xa5b6('0x3f')][_0xa5b6('0x22')]);_0x3dd9c4[_0xa5b6('0x21')]=qs[_0xa5b6('0x21')](_0x52761b['query'][_0xa5b6('0x21')]);}return _0x43e267['getTeams'](_0x3dd9c4);}})['then'](function(_0x5f2a59){if(_0x5f2a59){return _0x5f2a59?{'count':_0x3df669,'rows':_0x5f2a59}:null;}})[_0xa5b6('0x28')](respondWithResult(_0xe0bfa1,null))[_0xa5b6('0x52')](handleError(_0xe0bfa1,null));};exports['addTeams']=function(_0x3edc72,_0x5bd1c8,_0x5203a8){var _0x432268=_0x3edc72['body']['teams'];var _0x3a8c71=_[_0xa5b6('0x30')](_0x432268,'id');return db['Team'][_0xa5b6('0x63')]({'where':{'id':_0x3a8c71},'attributes':['id'],'include':[{'model':db[_0xa5b6('0x6d')],'as':_0xa5b6('0x6e'),'attributes':['id',_0xa5b6('0x38'),_0xa5b6('0x6f'),_0xa5b6('0x70'),_0xa5b6('0x71')],'raw':!![]}]})[_0xa5b6('0x28')](function(_0x2444f1){if(_0x2444f1){var _0x340974=_[_0xa5b6('0x72')](_0x2444f1,function(_0x3764c9){var _0x45c17a=_0x3764c9['get']({'plain':!![]});_0x45c17a[_0xa5b6('0x6e')][_0xa5b6('0x73')](function(_0x5657c4){_0x5657c4[_0xa5b6('0x74')]=_[_0xa5b6('0x34')](_0x432268,{'id':_0x45c17a['id']})['penalty'];});return _0x45c17a[_0xa5b6('0x6e')];});return db[_0xa5b6('0x3b')][_0xa5b6('0x34')]({'where':{'id':_0x3edc72[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](function(_0x2f7981){return db[_0xa5b6('0x75')][_0xa5b6('0x76')](function(_0x21a46c){return _0x2f7981[_0xa5b6('0x77')](_0x3a8c71,{'transaction':_0x21a46c})[_0xa5b6('0x28')](function(){return BPromise[_0xa5b6('0x78')](_0x432268,function(_0x20bf53){return db[_0xa5b6('0x79')][_0xa5b6('0x7a')]({'TeamId':_0x20bf53['id'],'VoiceQueueId':_0x3edc72[_0xa5b6('0x5a')]['id'],'penalty':_0x20bf53['penalty']},{'transaction':_0x21a46c});});})['then'](function(){return BPromise['each'](_0x340974,function(_0x5d5c2d){return db[_0xa5b6('0x7b')][_0xa5b6('0x7c')]({'where':{'UserId':_0x5d5c2d['id'],'VoiceQueueId':_0x3edc72[_0xa5b6('0x5a')]['id']},'defaults':{'penalty':_0x5d5c2d[_0xa5b6('0x74')]},'transaction':_0x21a46c});});})['then'](function(){return BPromise[_0xa5b6('0x78')](_['filter'](_0x340974,{'online':!![]}),function(_0x50b447){return db[_0xa5b6('0x7d')]['upsert']({'membername':_0x50b447['name'],'UserId':_0x50b447['id'],'queue_name':_0x2f7981[_0xa5b6('0x38')],'VoiceQueueId':_0x2f7981['id'],'interface':_['isNil'](_0x50b447[_0xa5b6('0x71')])?util[_0xa5b6('0x7e')](_0xa5b6('0x7f'),_0x50b447['name']):_0x50b447[_0xa5b6('0x71')],'paused':_0x50b447[_0xa5b6('0x70')]||![],'penalty':_0x50b447[_0xa5b6('0x74')]},{'transaction':_0x21a46c});});})[_0xa5b6('0x28')](function(){_0x340974[_0xa5b6('0x73')](function(_0x5c0462){socket[_0xa5b6('0x80')](_0xa5b6('0x81'),{'UserId':_0x5c0462['id'],'VoiceQueueId':_0x2f7981['id']});});});});});}})[_0xa5b6('0x28')](respondWithStatusCode(_0x5bd1c8,null))[_0xa5b6('0x52')](handleError(_0x5bd1c8,null));};exports[_0xa5b6('0x82')]=function(_0x1aca85,_0x2541c1,_0x3e29f7){return db['Team'][_0xa5b6('0x63')]({'where':{'id':_0x1aca85[_0xa5b6('0x3f')][_0xa5b6('0x83')]},'attributes':['id'],'include':[{'model':db[_0xa5b6('0x6d')],'as':_0xa5b6('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xa5b6('0x28')](handleEntityNotFound(_0x2541c1,null))[_0xa5b6('0x28')](function(_0x455b4d){var _0x347a96=_[_0xa5b6('0x30')](_0x455b4d,'id');var _0x57d553=[];var _0x5f37d6=[];var _0x4c2f2b=squel[_0xa5b6('0x84')]();_0x4c2f2b[_0xa5b6('0x85')](_0xa5b6('0x86'))[_0xa5b6('0x87')](_0xa5b6('0x88'),'tq')[_0xa5b6('0x89')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa5b6('0x49')](_0xa5b6('0x8a'),_0x1aca85[_0xa5b6('0x5a')]['id']);for(var _0x11717e=0x0;_0x11717e<_0x455b4d[_0xa5b6('0x44')];_0x11717e+=0x1){let _0x5790c3=_0x455b4d[_0x11717e];for(var _0x1ddfed=0x0;_0x1ddfed<_0x5790c3[_0xa5b6('0x6e')][_0xa5b6('0x44')];_0x1ddfed+=0x1){let _0x5dd934=_0x5790c3[_0xa5b6('0x6e')][_0x1ddfed];var _0x23a860=_0x4c2f2b[_0xa5b6('0x59')]();_0x23a860[_0xa5b6('0x49')](_0xa5b6('0x8b'),_0x5dd934['id']);_0x5f37d6[_0xa5b6('0x8c')](db[_0xa5b6('0x75')][_0xa5b6('0x3f')](_0x23a860[_0xa5b6('0x8d')](),{'type':db['sequelize'][_0xa5b6('0x8e')][_0xa5b6('0x8f')]})[_0xa5b6('0x28')](function(_0x3c598e){if(_0x3c598e['length']===0x1){return _0x5dd934['id'];}else{var _0x22b716=_[_0xa5b6('0x90')](_[_0xa5b6('0x30')](_0x3c598e,'TeamId'),function(_0x5479a3){return _[_0xa5b6('0x32')](_0x347a96,_0x5479a3);});if(_0x22b716){return _0x5dd934['id'];}}}));}}return BPromise[_0xa5b6('0x91')](_0x5f37d6)[_0xa5b6('0x28')](function(_0x25fb3c){_0x57d553=_(_0x57d553)[_0xa5b6('0x92')](_0x25fb3c)[_0xa5b6('0x93')]()[_0xa5b6('0x31')]();return db['VoiceQueue'][_0xa5b6('0x34')]({'where':{'id':_0x1aca85[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](function(_0x1a21b9){return db[_0xa5b6('0x75')][_0xa5b6('0x76')](function(_0x1d1606){return _0x1a21b9[_0xa5b6('0x82')](_0x1aca85[_0xa5b6('0x3f')][_0xa5b6('0x83')],{'transaction':_0x1d1606})[_0xa5b6('0x28')](function(){if(!_['isEmpty'](_0x57d553)){return _0x1a21b9[_0xa5b6('0x94')](_0x57d553,{'transaction':_0x1d1606})[_0xa5b6('0x28')](function(){return db['UserVoiceQueueRt'][_0xa5b6('0x29')]({'where':{'VoiceQueueId':_0x1aca85[_0xa5b6('0x5a')]['id'],'UserId':_0x57d553},'transaction':_0x1d1606});});}})['then'](function(){_0x57d553[_0xa5b6('0x73')](function(_0x4c3f27){socket[_0xa5b6('0x80')](_0xa5b6('0x95'),{'UserId':_0x4c3f27,'VoiceQueueId':_0x1a21b9['id']});});});});});});})[_0xa5b6('0x28')](respondWithStatusCode(_0x2541c1,null))['catch'](handleError(_0x2541c1,null));};exports[_0xa5b6('0x96')]=function(_0x23e007,_0x27afd4,_0x436de3){var _0x143efe,_0x2445dd;return db['VoiceQueue'][_0xa5b6('0x34')]({'where':{'id':_0x23e007[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x27afd4,null))[_0xa5b6('0x28')](function(_0x2e323e){if(_0x2e323e){_0x2445dd=_0x2e323e;return _0x2e323e['addAgents'](_0x23e007[_0xa5b6('0x5c')][_0xa5b6('0x83')],_[_0xa5b6('0x5d')](_0x23e007[_0xa5b6('0x5c')],['ids','id'])||{})[_0xa5b6('0x97')](function(_0x57eaca){for(var _0x1b6357=0x0;_0x1b6357<_0x23e007[_0xa5b6('0x5c')][_0xa5b6('0x83')][_0xa5b6('0x44')];_0x1b6357+=0x1){socket[_0xa5b6('0x80')](_0xa5b6('0x81'),{'UserId':Number(_0x23e007[_0xa5b6('0x5c')]['ids'][_0x1b6357]),'VoiceQueueId':Number(_0x23e007[_0xa5b6('0x5a')]['id'])});}return _0x57eaca;});}})[_0xa5b6('0x28')](function(_0x2a2ba2){_0x143efe=_0x2a2ba2||[];if(_0x2445dd){return db['User']['findAll']({'where':{'id':_0x23e007['body'][_0xa5b6('0x83')]},'attributes':['id',_0xa5b6('0x38'),_0xa5b6('0x6f'),'voicePause',_0xa5b6('0x71')],'raw':!![]});}})['then'](function(_0x3a39ad){if(!_[_0xa5b6('0x98')](_0x3a39ad)){var _0x449ebc=[];for(var _0x5b0957=0x0;_0x5b0957<_0x3a39ad[_0xa5b6('0x44')];_0x5b0957++){if(_0x3a39ad[_0x5b0957]['online']){_0x449ebc[_0xa5b6('0x8c')](db['UserVoiceQueueRt'][_0xa5b6('0x7a')]({'membername':_0x3a39ad[_0x5b0957][_0xa5b6('0x38')],'UserId':_0x3a39ad[_0x5b0957]['id'],'queue_name':_0x2445dd['name'],'VoiceQueueId':_0x2445dd['id'],'interface':_[_0xa5b6('0x99')](_0x3a39ad[_0x5b0957][_0xa5b6('0x71')])?util[_0xa5b6('0x7e')](_0xa5b6('0x7f'),_0x3a39ad[_0x5b0957][_0xa5b6('0x38')]):_0x3a39ad[_0x5b0957][_0xa5b6('0x71')],'paused':_0x3a39ad[_0x5b0957][_0xa5b6('0x70')]||![],'penalty':_0x23e007[_0xa5b6('0x5c')]['penalty']||0x0}));}}return BPromise[_0xa5b6('0x91')](_0x449ebc);}})[_0xa5b6('0x28')](function(){return _0x143efe;})[_0xa5b6('0x28')](respondWithResult(_0x27afd4,null))[_0xa5b6('0x52')](handleError(_0x27afd4,null));};exports[_0xa5b6('0x94')]=function(_0x3f6f6d,_0x4f99ea,_0x82b90b){return db[_0xa5b6('0x3b')][_0xa5b6('0x34')]({'where':{'id':_0x3f6f6d['params']['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x4f99ea,null))[_0xa5b6('0x28')](function(_0x449d8b){if(_0x449d8b){return _0x449d8b[_0xa5b6('0x94')](_0x3f6f6d['query'][_0xa5b6('0x83')])[_0xa5b6('0x28')](function(){if(_['isArray'](_0x3f6f6d[_0xa5b6('0x3f')]['ids'])){for(var _0x54ac5d=0x0;_0x54ac5d<_0x3f6f6d[_0xa5b6('0x3f')][_0xa5b6('0x83')][_0xa5b6('0x44')];_0x54ac5d+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x3f6f6d[_0xa5b6('0x3f')][_0xa5b6('0x83')][_0x54ac5d]),'VoiceQueueId':Number(_0x3f6f6d[_0xa5b6('0x5a')]['id'])});}}else{socket['emit'](_0xa5b6('0x95'),{'UserId':Number(_0x3f6f6d[_0xa5b6('0x3f')][_0xa5b6('0x83')]),'VoiceQueueId':Number(_0x3f6f6d['params']['id'])});}});}})[_0xa5b6('0x28')](function(_0x612873){return db['UserVoiceQueueRt'][_0xa5b6('0x29')]({'where':{'VoiceQueueId':_0x3f6f6d[_0xa5b6('0x5a')]['id'],'UserId':_0x3f6f6d[_0xa5b6('0x3f')][_0xa5b6('0x83')]}})[_0xa5b6('0x28')](function(){return _0x612873;});})[_0xa5b6('0x28')](respondWithStatusCode(_0x4f99ea,null))['catch'](handleError(_0x4f99ea,null));};exports[_0xa5b6('0x9a')]=function(_0x1b063b,_0x56d941,_0xfdb50d){var _0xc9d61d={};var _0x402c81={};var _0x5a62d3;var _0x48f475;return db[_0xa5b6('0x3b')][_0xa5b6('0x64')]({'where':{'id':_0x1b063b[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x56d941,null))[_0xa5b6('0x28')](function(_0x198c00){if(_0x198c00){_0x5a62d3=_0x198c00;_0x402c81[_0xa5b6('0x3e')]=_['keys'](db['User'][_0xa5b6('0x66')]);_0x402c81['query']=_[_0xa5b6('0x50')](_0x1b063b[_0xa5b6('0x3f')]);_0x402c81[_0xa5b6('0x40')]=_[_0xa5b6('0x41')](_0x402c81['model'],_0x402c81[_0xa5b6('0x3f')]);_0xc9d61d[_0xa5b6('0x42')]=_[_0xa5b6('0x41')](_0x402c81['model'],qs[_0xa5b6('0x43')](_0x1b063b[_0xa5b6('0x3f')][_0xa5b6('0x43')]));_0xc9d61d['attributes']=_0xc9d61d[_0xa5b6('0x42')][_0xa5b6('0x44')]?_0xc9d61d[_0xa5b6('0x42')]:_0x402c81[_0xa5b6('0x3e')];_0xc9d61d[_0xa5b6('0x47')]=qs[_0xa5b6('0x48')](_0x1b063b['query']['sort']);_0xc9d61d['where']=qs[_0xa5b6('0x40')](_[_0xa5b6('0x4a')](_0x1b063b[_0xa5b6('0x3f')],_0x402c81[_0xa5b6('0x40')]));if(_0x1b063b[_0xa5b6('0x3f')][_0xa5b6('0x2f')]){_0xc9d61d['where']=_[_0xa5b6('0x4b')](_0xc9d61d['where'],{'$or':_['map'](_0xc9d61d[_0xa5b6('0x42')],function(_0x3f78eb){var _0x4b23f0={};_0x4b23f0[_0x3f78eb]={'$like':'%'+_0x1b063b[_0xa5b6('0x3f')][_0xa5b6('0x2f')]+'%'};return _0x4b23f0;})});}_0xc9d61d=_['merge']({},_0xc9d61d,_0x1b063b[_0xa5b6('0x4d')]);return _0x5a62d3[_0xa5b6('0x9a')](_0xc9d61d);}})[_0xa5b6('0x28')](function(_0x2beece){if(_0x2beece){_0x48f475=_0x2beece['length'];if(!_0x1b063b['query'][_0xa5b6('0x45')](_0xa5b6('0x46'))){_0xc9d61d[_0xa5b6('0x22')]=qs[_0xa5b6('0x22')](_0x1b063b[_0xa5b6('0x3f')][_0xa5b6('0x22')]);_0xc9d61d['offset']=qs[_0xa5b6('0x21')](_0x1b063b[_0xa5b6('0x3f')][_0xa5b6('0x21')]);}return _0x5a62d3[_0xa5b6('0x9a')](_0xc9d61d);}})['then'](function(_0x22af2f){if(_0x22af2f){return _0x22af2f?{'count':_0x48f475,'rows':_0x22af2f}:null;}})[_0xa5b6('0x28')](respondWithResult(_0x56d941,null))[_0xa5b6('0x52')](handleError(_0x56d941,null));};exports['getMembers']=function(_0x2a2464,_0x20178c,_0x3d5e0e){var _0x2183a1={};var _0x3c6112={};var _0x53d4f4;var _0x42a291;return db[_0xa5b6('0x3b')][_0xa5b6('0x64')]({'where':{'id':_0x2a2464[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x20178c,null))[_0xa5b6('0x28')](function(_0x2c7d78){if(_0x2c7d78){_0x53d4f4=_0x2c7d78;_0x3c6112['model']=_[_0xa5b6('0x50')](db['UserVoiceQueueRt'][_0xa5b6('0x66')]);_0x3c6112[_0xa5b6('0x3f')]=_[_0xa5b6('0x50')](_0x2a2464['query']);_0x3c6112[_0xa5b6('0x40')]=_[_0xa5b6('0x41')](_0x3c6112[_0xa5b6('0x3e')],_0x3c6112[_0xa5b6('0x3f')]);_0x2183a1[_0xa5b6('0x42')]=_['intersection'](_0x3c6112['model'],qs['fields'](_0x2a2464['query']['fields']));_0x2183a1[_0xa5b6('0x42')]=_0x2183a1[_0xa5b6('0x42')][_0xa5b6('0x44')]?_0x2183a1[_0xa5b6('0x42')]:_0x3c6112[_0xa5b6('0x3e')];_0x2183a1['order']=qs[_0xa5b6('0x48')](_0x2a2464[_0xa5b6('0x3f')][_0xa5b6('0x48')]);_0x2183a1[_0xa5b6('0x49')]=qs[_0xa5b6('0x40')](_[_0xa5b6('0x4a')](_0x2a2464[_0xa5b6('0x3f')],_0x3c6112['filters']));if(_0x2a2464[_0xa5b6('0x3f')][_0xa5b6('0x2f')]){_0x2183a1['where']=_[_0xa5b6('0x4b')](_0x2183a1[_0xa5b6('0x49')],{'$or':_[_0xa5b6('0x30')](_0x2183a1[_0xa5b6('0x42')],function(_0x1a968f){var _0x44558b={};_0x44558b[_0x1a968f]={'$like':'%'+_0x2a2464['query']['filter']+'%'};return _0x44558b;})});}_0x2183a1=_['merge']({},_0x2183a1,_0x2a2464[_0xa5b6('0x4d')]);return _0x53d4f4['getMembers'](_0x2183a1);}})['then'](function(_0x511cc0){if(_0x511cc0){_0x42a291=_0x511cc0[_0xa5b6('0x44')];if(!_0x2a2464[_0xa5b6('0x3f')][_0xa5b6('0x45')](_0xa5b6('0x46'))){_0x2183a1[_0xa5b6('0x22')]=qs['limit'](_0x2a2464['query'][_0xa5b6('0x22')]);_0x2183a1[_0xa5b6('0x21')]=qs[_0xa5b6('0x21')](_0x2a2464[_0xa5b6('0x3f')][_0xa5b6('0x21')]);}return _0x53d4f4['getMembers'](_0x2183a1);}})[_0xa5b6('0x28')](function(_0x34b071){return _0x34b071?{'count':_0x42a291,'rows':_0x34b071}:null;})['then'](respondWithResult(_0x20178c,null))[_0xa5b6('0x52')](handleError(_0x20178c,null));};exports[_0xa5b6('0x9b')]=function(_0x3a3f65,_0x372816,_0x329353){var _0x3ea754={};var _0x1f882e={};var _0x5ba882;var _0x53301d;return db['VoiceQueue']['findOne']({'where':{'id':_0x3a3f65[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x372816,null))[_0xa5b6('0x28')](function(_0x54d807){if(_0x54d807){_0x5ba882=_0x54d807;_0x1f882e[_0xa5b6('0x3e')]=_[_0xa5b6('0x50')](db['CmList'][_0xa5b6('0x66')]);_0x1f882e[_0xa5b6('0x3f')]=_[_0xa5b6('0x50')](_0x3a3f65['query']);_0x1f882e[_0xa5b6('0x40')]=_[_0xa5b6('0x41')](_0x1f882e[_0xa5b6('0x3e')],_0x1f882e['query']);_0x3ea754[_0xa5b6('0x42')]=_['intersection'](_0x1f882e['model'],qs[_0xa5b6('0x43')](_0x3a3f65[_0xa5b6('0x3f')][_0xa5b6('0x43')]));_0x3ea754[_0xa5b6('0x42')]=_0x3ea754['attributes'][_0xa5b6('0x44')]?_0x3ea754[_0xa5b6('0x42')]:_0x1f882e['model'];_0x3ea754[_0xa5b6('0x47')]=qs['sort'](_0x3a3f65[_0xa5b6('0x3f')][_0xa5b6('0x48')]);_0x3ea754[_0xa5b6('0x49')]=qs[_0xa5b6('0x40')](_[_0xa5b6('0x4a')](_0x3a3f65['query'],_0x1f882e[_0xa5b6('0x40')]));if(_0x3a3f65['query'][_0xa5b6('0x2f')]){_0x3ea754[_0xa5b6('0x49')]=_[_0xa5b6('0x4b')](_0x3ea754[_0xa5b6('0x49')],{'$or':_[_0xa5b6('0x30')](_0x3ea754[_0xa5b6('0x42')],function(_0x451ac5){var _0x595f2c={};_0x595f2c[_0x451ac5]={'$like':'%'+_0x3a3f65['query'][_0xa5b6('0x2f')]+'%'};return _0x595f2c;})});}_0x3ea754=_[_0xa5b6('0x4b')]({},_0x3ea754,_0x3a3f65[_0xa5b6('0x4d')]);return _0x5ba882[_0xa5b6('0x9b')](_0x3ea754);}})[_0xa5b6('0x28')](function(_0x4c1223){if(_0x4c1223){_0x53301d=_0x4c1223[_0xa5b6('0x44')];if(!_0x3a3f65[_0xa5b6('0x3f')]['hasOwnProperty'](_0xa5b6('0x46'))){_0x3ea754[_0xa5b6('0x22')]=qs[_0xa5b6('0x22')](_0x3a3f65[_0xa5b6('0x3f')][_0xa5b6('0x22')]);_0x3ea754['offset']=qs[_0xa5b6('0x21')](_0x3a3f65[_0xa5b6('0x3f')][_0xa5b6('0x21')]);}return _0x5ba882[_0xa5b6('0x9b')](_0x3ea754);}})[_0xa5b6('0x28')](function(_0x58ee0c){if(_0x58ee0c){return _0x58ee0c?{'count':_0x53301d,'rows':_0x58ee0c}:null;}})[_0xa5b6('0x28')](respondWithResult(_0x372816,null))['catch'](handleError(_0x372816,null));};exports['addLists']=function(_0x492adb,_0x56c74a,_0x47533f){var _0x5ea3aa,_0x5c7e93;return db[_0xa5b6('0x3b')][_0xa5b6('0x34')]({'where':{'id':_0x492adb[_0xa5b6('0x5a')]['id']}})['then'](handleEntityNotFound(_0x56c74a,null))[_0xa5b6('0x28')](function(_0x583b1c){if(_0x583b1c){_0x5c7e93=_0x583b1c;return _0x583b1c[_0xa5b6('0x9c')](_0x492adb[_0xa5b6('0x5c')]['ids'],_[_0xa5b6('0x5d')](_0x492adb['body'],[_0xa5b6('0x83'),'id'])||{});}return null;})[_0xa5b6('0x97')](function(_0x224b02){var _0x45b80f;_0x5ea3aa=_0x224b02||[];var _0x4663b9=[];if(_0x224b02){for(var _0x3753b2=0x0;_0x3753b2<_0x224b02[_0xa5b6('0x44')];_0x3753b2+=0x1){var _0x20111b=_0x224b02[_0x3753b2][_0xa5b6('0x2a')]({'plain':!![]});_0x5c7e93['dialCheckDuplicateType']=_0x492adb[_0xa5b6('0x5c')][_0xa5b6('0x9d')]?_0x492adb[_0xa5b6('0x5c')]['dialCheckDuplicateType']:_0x5c7e93[_0xa5b6('0x9d')];switch(_0x5c7e93[_0xa5b6('0x9d')]){case _0xa5b6('0x9e'):_0x45b80f=squel[_0xa5b6('0x9f')]()[_0xa5b6('0xa0')]('cm_hopper')[_0xa5b6('0xa1')]([_0xa5b6('0xa2'),_0xa5b6('0xa3'),_0xa5b6('0xa4'),_0xa5b6('0xa5'),'VoiceQueueId','createdAt',_0xa5b6('0xa6')],squel[_0xa5b6('0x84')]()[_0xa5b6('0x85')]('phone',_0xa5b6('0xa2'))['field'](_0xa5b6('0xa7'),_0xa5b6('0xa3'))[_0xa5b6('0x85')]('id',_0xa5b6('0xa4'))[_0xa5b6('0x85')](_0x20111b['CmListId'][_0xa5b6('0x8d')](),'ListId')[_0xa5b6('0x85')](_0x492adb[_0xa5b6('0x5a')]['id'][_0xa5b6('0x8d')](),_0xa5b6('0x62'))[_0xa5b6('0x85')](_0xa5b6('0xa7'),_0xa5b6('0x5b'))[_0xa5b6('0x85')]('NOW()',_0xa5b6('0xa6'))[_0xa5b6('0x87')](_0xa5b6('0xa8'))[_0xa5b6('0x49')](_0xa5b6('0xa9'))['where']('ListId\x20=\x20?',_0x20111b[_0xa5b6('0xaa')][_0xa5b6('0x8d')]())[_0xa5b6('0x49')](_0xa5b6('0xab'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa5b6('0x84')]()[_0xa5b6('0x85')]('COALESCE(calleridnum,\x27\x27)')[_0xa5b6('0x87')](_0xa5b6('0xac'))[_0xa5b6('0x49')](_0xa5b6('0x8a'),_0x492adb[_0xa5b6('0x5a')]['id'][_0xa5b6('0x8d')]()))[_0xa5b6('0x49')](_0xa5b6('0xad'),squel[_0xa5b6('0x84')]()[_0xa5b6('0x85')]('COALESCE(phone,\x27\x27)')[_0xa5b6('0x87')]('cm_hopper')[_0xa5b6('0x49')](_0xa5b6('0x8a'),_0x492adb[_0xa5b6('0x5a')]['id'][_0xa5b6('0x8d')]())))[_0xa5b6('0x8d')]();break;case _0xa5b6('0xae'):_0x45b80f=squel[_0xa5b6('0x9f')]()[_0xa5b6('0xa0')](_0xa5b6('0xaf'))[_0xa5b6('0xa1')]([_0xa5b6('0xa2'),_0xa5b6('0xa3'),'ContactId',_0xa5b6('0xa5'),'VoiceQueueId',_0xa5b6('0x5b'),_0xa5b6('0xa6')],squel[_0xa5b6('0x84')]()['field'](_0xa5b6('0xa2'),_0xa5b6('0xa2'))[_0xa5b6('0x85')](_0xa5b6('0xa7'),_0xa5b6('0xa3'))[_0xa5b6('0x85')]('id',_0xa5b6('0xa4'))[_0xa5b6('0x85')](_0x20111b[_0xa5b6('0xaa')]['toString'](),_0xa5b6('0xa5'))['field'](_0x492adb['params']['id']['toString'](),'VoiceQueueId')[_0xa5b6('0x85')](_0xa5b6('0xa7'),_0xa5b6('0x5b'))[_0xa5b6('0x85')]('NOW()',_0xa5b6('0xa6'))[_0xa5b6('0x87')](_0xa5b6('0xa8'))[_0xa5b6('0x49')](_0xa5b6('0xa9'))[_0xa5b6('0x49')](_0xa5b6('0xb0'),_0x20111b['CmListId'][_0xa5b6('0x8d')]())['where'](_0xa5b6('0xab'))[_0xa5b6('0x49')](_0xa5b6('0xad'),squel[_0xa5b6('0x84')]()[_0xa5b6('0x85')](_0xa5b6('0xb1'))[_0xa5b6('0x87')]('cm_hopper')[_0xa5b6('0x49')]('VoiceQueueId\x20=\x20?',_0x492adb[_0xa5b6('0x5a')]['id'][_0xa5b6('0x8d')]())))[_0xa5b6('0x8d')]();break;default:_0x45b80f=squel[_0xa5b6('0x9f')]()['into'](_0xa5b6('0xaf'))['fromQuery']([_0xa5b6('0xa2'),'scheduledAt',_0xa5b6('0xa4'),_0xa5b6('0xa5'),_0xa5b6('0x62'),_0xa5b6('0x5b'),_0xa5b6('0xa6')],squel[_0xa5b6('0x84')]()[_0xa5b6('0x85')]('phone',_0xa5b6('0xa2'))[_0xa5b6('0x85')](_0xa5b6('0xa7'),'scheduledAt')['field']('id',_0xa5b6('0xa4'))[_0xa5b6('0x85')](_0x20111b['CmListId'][_0xa5b6('0x8d')](),_0xa5b6('0xa5'))[_0xa5b6('0x85')](_0x492adb[_0xa5b6('0x5a')]['id'][_0xa5b6('0x8d')](),'VoiceQueueId')['field'](_0xa5b6('0xa7'),'createdAt')['field']('NOW()',_0xa5b6('0xa6'))[_0xa5b6('0x87')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0xa5b6('0xb0'),_0x20111b[_0xa5b6('0xaa')][_0xa5b6('0x8d')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xa5b6('0x8d')]();}_0x4663b9['push'](db[_0xa5b6('0x75')]['query'](_0x45b80f));}return BPromise['all'](_0x4663b9);}})[_0xa5b6('0x28')](function(){return _0x5ea3aa;})[_0xa5b6('0x28')](respondWithResult(_0x56c74a,null))[_0xa5b6('0x52')](handleError(_0x56c74a,null));};exports['removeLists']=function(_0x1eb740,_0x477782,_0x1f4570){return db['VoiceQueue']['find']({'where':{'id':_0x1eb740['params']['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x477782,null))['then'](function(_0x5bf5f1){if(_0x5bf5f1){return _0x5bf5f1[_0xa5b6('0xb2')](_0x1eb740[_0xa5b6('0x3f')][_0xa5b6('0x83')]);}})['then'](function(_0x1ff8e4){if(_0x1ff8e4){return db['CmHopper'][_0xa5b6('0x29')]({'where':{'ListId':_0x1eb740['query'][_0xa5b6('0x83')],'VoiceQueueId':_0x1eb740[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](function(){return _0x1ff8e4;});}})[_0xa5b6('0x28')](respondWithStatusCode(_0x477782,null))[_0xa5b6('0x52')](handleError(_0x477782,null));};exports['getBlackLists']=function(_0x21c2cb,_0x105e8b,_0x4bdaa7){var _0x11236b={};var _0x41851e={};var _0x1a86be;var _0x59ee53;return db[_0xa5b6('0x3b')][_0xa5b6('0x64')]({'where':{'id':_0x21c2cb[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x105e8b,null))[_0xa5b6('0x28')](function(_0xdbfb35){if(_0xdbfb35){_0x1a86be=_0xdbfb35;_0x41851e[_0xa5b6('0x3e')]=_[_0xa5b6('0x50')](db[_0xa5b6('0xb3')][_0xa5b6('0x66')]);_0x41851e['query']=_[_0xa5b6('0x50')](_0x21c2cb[_0xa5b6('0x3f')]);_0x41851e[_0xa5b6('0x40')]=_[_0xa5b6('0x41')](_0x41851e[_0xa5b6('0x3e')],_0x41851e['query']);_0x11236b[_0xa5b6('0x42')]=_[_0xa5b6('0x41')](_0x41851e['model'],qs[_0xa5b6('0x43')](_0x21c2cb[_0xa5b6('0x3f')]['fields']));_0x11236b[_0xa5b6('0x42')]=_0x11236b[_0xa5b6('0x42')][_0xa5b6('0x44')]?_0x11236b['attributes']:_0x41851e['model'];_0x11236b[_0xa5b6('0x47')]=qs[_0xa5b6('0x48')](_0x21c2cb[_0xa5b6('0x3f')]['sort']);_0x11236b['where']=qs[_0xa5b6('0x40')](_[_0xa5b6('0x4a')](_0x21c2cb[_0xa5b6('0x3f')],_0x41851e[_0xa5b6('0x40')]));if(_0x21c2cb[_0xa5b6('0x3f')]['filter']){_0x11236b['where']=_[_0xa5b6('0x4b')](_0x11236b[_0xa5b6('0x49')],{'$or':_[_0xa5b6('0x30')](_0x11236b['attributes'],function(_0x14eec7){var _0x2abe4f={};_0x2abe4f[_0x14eec7]={'$like':'%'+_0x21c2cb[_0xa5b6('0x3f')][_0xa5b6('0x2f')]+'%'};return _0x2abe4f;})});}_0x11236b=_[_0xa5b6('0x4b')]({},_0x11236b,_0x21c2cb[_0xa5b6('0x4d')]);return _0x1a86be['getBlackLists'](_0x11236b);}})[_0xa5b6('0x28')](function(_0x430a67){if(_0x430a67){_0x59ee53=_0x430a67[_0xa5b6('0x44')];if(!_0x21c2cb[_0xa5b6('0x3f')]['hasOwnProperty'](_0xa5b6('0x46'))){_0x11236b[_0xa5b6('0x22')]=qs['limit'](_0x21c2cb[_0xa5b6('0x3f')][_0xa5b6('0x22')]);_0x11236b[_0xa5b6('0x21')]=qs[_0xa5b6('0x21')](_0x21c2cb['query'][_0xa5b6('0x21')]);}return _0x1a86be[_0xa5b6('0xb4')](_0x11236b);}})['then'](function(_0x2b1ab4){if(_0x2b1ab4){return _0x2b1ab4?{'count':_0x59ee53,'rows':_0x2b1ab4}:null;}})[_0xa5b6('0x28')](respondWithResult(_0x105e8b,null))[_0xa5b6('0x52')](handleError(_0x105e8b,null));};exports[_0xa5b6('0xb5')]=function(_0xc186cf,_0x43725d,_0x15fee4){var _0x802244,_0x4f9a9f;return db[_0xa5b6('0x3b')][_0xa5b6('0x34')]({'where':{'id':_0xc186cf[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x43725d,null))['then'](function(_0x2ce1e2){if(_0x2ce1e2){_0x4f9a9f=_0x2ce1e2;return _0x2ce1e2[_0xa5b6('0xb5')](_0xc186cf[_0xa5b6('0x5c')][_0xa5b6('0x83')],_[_0xa5b6('0x5d')](_0xc186cf[_0xa5b6('0x5c')],[_0xa5b6('0x83'),'id'])||{});}return null;})[_0xa5b6('0x97')](function(_0x30d26a){var _0x3ff2b4;_0x802244=_0x30d26a||[];var _0x17ae0d=[];if(_0x30d26a){for(var _0x118247=0x0;_0x118247<_0x30d26a[_0xa5b6('0x44')];_0x118247+=0x1){var _0x45c5bb=_0x30d26a[_0x118247][_0xa5b6('0x2a')]({'plain':!![]});_0x3ff2b4=squel[_0xa5b6('0x9f')]()['into'](_0xa5b6('0xb6'))[_0xa5b6('0xa1')]([_0xa5b6('0xa2'),_0xa5b6('0xa4'),_0xa5b6('0xa5'),'VoiceQueueId',_0xa5b6('0x5b'),_0xa5b6('0xa6')],squel[_0xa5b6('0x84')]()[_0xa5b6('0x85')]('phone','phone')['field']('id',_0xa5b6('0xa4'))[_0xa5b6('0x85')](_0x45c5bb[_0xa5b6('0xaa')][_0xa5b6('0x8d')](),_0xa5b6('0xa5'))[_0xa5b6('0x85')](_0xc186cf[_0xa5b6('0x5a')]['id']['toString'](),_0xa5b6('0x62'))[_0xa5b6('0x85')]('NOW()',_0xa5b6('0x5b'))[_0xa5b6('0x85')](_0xa5b6('0xa7'),_0xa5b6('0xa6'))[_0xa5b6('0x87')](_0xa5b6('0xa8'))[_0xa5b6('0x49')](_0xa5b6('0xa9'))[_0xa5b6('0x49')](_0xa5b6('0xb0'),_0x45c5bb[_0xa5b6('0xaa')][_0xa5b6('0x8d')]())['where'](_0xa5b6('0xab')))[_0xa5b6('0x8d')]();_0x17ae0d[_0xa5b6('0x8c')](db[_0xa5b6('0x75')][_0xa5b6('0x3f')](_0x3ff2b4));}return BPromise[_0xa5b6('0x91')](_0x17ae0d);}})[_0xa5b6('0x28')](function(){return _0x802244;})[_0xa5b6('0x28')](respondWithResult(_0x43725d,null))[_0xa5b6('0x52')](handleError(_0x43725d,null));};exports[_0xa5b6('0xb7')]=function(_0x11aaaa,_0x4d1f33,_0x396235){return db[_0xa5b6('0x3b')][_0xa5b6('0x34')]({'where':{'id':_0x11aaaa[_0xa5b6('0x5a')]['id']}})[_0xa5b6('0x28')](handleEntityNotFound(_0x4d1f33,null))[_0xa5b6('0x28')](function(_0x56198b){if(_0x56198b){return _0x56198b[_0xa5b6('0xb7')](_0x11aaaa[_0xa5b6('0x3f')][_0xa5b6('0x83')]);}})[_0xa5b6('0x28')](function(_0x591038){if(_0x591038){return db[_0xa5b6('0x6a')][_0xa5b6('0x29')]({'where':{'ListId':_0x11aaaa[_0xa5b6('0x3f')][_0xa5b6('0x83')],'VoiceQueueId':_0x11aaaa[_0xa5b6('0x5a')]['id']}})['then'](function(){return _0x591038;});}})[_0xa5b6('0x28')](respondWithStatusCode(_0x4d1f33,null))[_0xa5b6('0x52')](handleError(_0x4d1f33,null));}; \ No newline at end of file +var _0x589d=['phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoiceQueues','inbound','outbound','filter','ignore','value','includes','type','name','UserProfileResource','destroy','send','index','VoiceQueue','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','QueueCampaigns','VoiceQueueId','CmHopper','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','teams','Team','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','select','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','online','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x589d,0x17d));var _0xd589=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x589d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd589('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd589('0x1'));var jsonpatch=require(_0xd589('0x2'));var rp=require('request-promise');var moment=require(_0xd589('0x3'));var BPromise=require(_0xd589('0x4'));var Mustache=require('mustache');var util=require(_0xd589('0x5'));var path=require(_0xd589('0x6'));var sox=require(_0xd589('0x7'));var csv=require('to-csv');var ejs=require(_0xd589('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd589('0x9'));var crypto=require(_0xd589('0xa'));var jsforce=require(_0xd589('0xb'));var deskjs=require(_0xd589('0xc'));var toCsv=require(_0xd589('0xd'));var querystring=require(_0xd589('0xe'));var Papa=require(_0xd589('0xf'));var Redis=require(_0xd589('0x10'));var authService=require(_0xd589('0x11'));var qs=require(_0xd589('0x12'));var as=require(_0xd589('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd589('0x14'))('api');var utils=require(_0xd589('0x15'));var config=require(_0xd589('0x16'));var licenseUtil=require(_0xd589('0x17'));var db=require('../../mysqldb')['db'];config[_0xd589('0x18')]=_['defaults'](config[_0xd589('0x18')],{'host':_0xd589('0x19'),'port':0x18eb});var socket=require(_0xd589('0x1a'))(new Redis(config[_0xd589('0x18')]));require(_0xd589('0x1b'))[_0xd589('0x1c')](socket);function respondWithStatusCode(_0x4290cb,_0x48490f){_0x48490f=_0x48490f||0xcc;return function(_0x53595f){if(_0x53595f){return _0x4290cb[_0xd589('0x1d')](_0x48490f);}return _0x4290cb['status'](_0x48490f)[_0xd589('0x1e')]();};}function respondWithResult(_0x25d14c,_0x241776){_0x241776=_0x241776||0xc8;return function(_0x270bdb){if(_0x270bdb){return _0x25d14c[_0xd589('0x1f')](_0x241776)[_0xd589('0x20')](_0x270bdb);}};}function respondWithFilteredResult(_0x454fe1,_0x35d0f2){return function(_0x3a88ce){if(_0x3a88ce){var _0x595906=typeof _0x35d0f2[_0xd589('0x21')]===_0xd589('0x22')&&typeof _0x35d0f2[_0xd589('0x23')]===_0xd589('0x22');var _0x5927c3=_0x3a88ce[_0xd589('0x24')];var _0x278e77=_0x595906?0x0:_0x35d0f2[_0xd589('0x21')];var _0x2861e7=_0x595906?_0x3a88ce['count']:_0x35d0f2[_0xd589('0x21')]+_0x35d0f2[_0xd589('0x23')];var _0x48acf3;if(_0x2861e7>=_0x5927c3){_0x2861e7=_0x5927c3;_0x48acf3=0xc8;}else{_0x48acf3=0xce;}_0x454fe1[_0xd589('0x1f')](_0x48acf3);return _0x454fe1[_0xd589('0x25')](_0xd589('0x26'),_0x278e77+'-'+_0x2861e7+'/'+_0x5927c3)[_0xd589('0x20')](_0x3a88ce);}return null;};}function patchUpdates(_0x53db30){return function(_0x3de80c){try{jsonpatch[_0xd589('0x27')](_0x3de80c,_0x53db30,!![]);}catch(_0x1a1b06){return BPromise[_0xd589('0x28')](_0x1a1b06);}return _0x3de80c[_0xd589('0x29')]();};}function saveUpdates(_0x56b66c,_0x3ecf5a){return function(_0x14f9ae){if(_0x14f9ae){return _0x14f9ae[_0xd589('0x2a')](_0x56b66c)[_0xd589('0x2b')](function(_0x4acfa5){return _0x4acfa5;});}return null;};}function removeEntity(_0x235a2c,_0x5ad5d5){return function(_0x41a395){if(_0x41a395){return _0x41a395['destroy']()[_0xd589('0x2b')](function(){var _0x3765cf=_0x41a395[_0xd589('0x2c')]({'plain':!![]});var _0x19183a=[{'name':_0xd589('0x2d'),'value':_0xd589('0x2e'),'ignore':![]},{'name':'QueueCampaigns','value':_0xd589('0x2f'),'ignore':![]}];var _0x26cc89=_(_0x19183a)[_0xd589('0x30')](_0xd589('0x31'))['map'](_0xd589('0x32'))[_0xd589('0x32')]();if(_[_0xd589('0x33')](_0x26cc89,_0x3765cf[_0xd589('0x34')])){return;}var _0x556f77=_['find'](_0x19183a,[_0xd589('0x32'),_0x3765cf[_0xd589('0x34')]])[_0xd589('0x35')];return db[_0xd589('0x36')][_0xd589('0x37')]({'where':{'type':_0x556f77,'resourceId':_0x3765cf['id']}})[_0xd589('0x2b')](function(){return _0x41a395;});})[_0xd589('0x2b')](function(){_0x235a2c[_0xd589('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14623f,_0x22e956){return function(_0x1cf8a5){if(!_0x1cf8a5){_0x14623f[_0xd589('0x1d')](0x194);}return _0x1cf8a5;};}function handleError(_0x197075,_0x331d24){_0x331d24=_0x331d24||0x1f4;return function(_0x9c6ffa){logger['error'](_0x9c6ffa['stack']);if(_0x9c6ffa['name']){delete _0x9c6ffa[_0xd589('0x35')];}_0x197075[_0xd589('0x1f')](_0x331d24)[_0xd589('0x38')](_0x9c6ffa);};}exports[_0xd589('0x39')]=function(_0x2aca10,_0x31fc5f){var _0xc74b94={},_0x549569={},_0x4b33f3={'count':0x0,'rows':[]};var _0x139f18=_['map'](db[_0xd589('0x3a')][_0xd589('0x3b')],function(_0x18d39c){return{'name':_0x18d39c['fieldName'],'type':_0x18d39c['type'][_0xd589('0x3c')]};});_0x549569[_0xd589('0x3d')]=_[_0xd589('0x3e')](_0x139f18,'name');_0x549569[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x2aca10['query']);_0x549569[_0xd589('0x41')]=_[_0xd589('0x42')](_0x549569[_0xd589('0x3d')],_0x549569['query']);_0xc74b94[_0xd589('0x43')]=_[_0xd589('0x42')](_0x549569['model'],qs[_0xd589('0x44')](_0x2aca10['query'][_0xd589('0x44')]));_0xc74b94[_0xd589('0x43')]=_0xc74b94['attributes'][_0xd589('0x45')]?_0xc74b94[_0xd589('0x43')]:_0x549569[_0xd589('0x3d')];if(!_0x2aca10[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0xc74b94[_0xd589('0x23')]=qs[_0xd589('0x23')](_0x2aca10[_0xd589('0x3f')]['limit']);_0xc74b94[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x2aca10[_0xd589('0x3f')][_0xd589('0x21')]);}_0xc74b94[_0xd589('0x48')]=qs['sort'](_0x2aca10[_0xd589('0x3f')][_0xd589('0x49')]);_0xc74b94[_0xd589('0x4a')]=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x2aca10[_0xd589('0x3f')],_0x549569[_0xd589('0x41')]),_0x139f18);if(_0x2aca10['query'][_0xd589('0x30')]){_0xc74b94[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0xc74b94['where'],{'$or':_['map'](_0x139f18,function(_0x9a911f){if(_0x9a911f[_0xd589('0x34')]!==_0xd589('0x4d')){var _0x2821fd={};_0x2821fd[_0x9a911f[_0xd589('0x35')]]={'$like':'%'+_0x2aca10[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x2821fd;}})});}_0xc74b94=_[_0xd589('0x4c')]({},_0xc74b94,_0x2aca10[_0xd589('0x4e')]);var _0xb7575a={'where':_0xc74b94['where']};return db[_0xd589('0x3a')][_0xd589('0x24')](_0xb7575a)[_0xd589('0x2b')](function(_0x3a26dd){_0x4b33f3[_0xd589('0x24')]=_0x3a26dd;if(_0x2aca10[_0xd589('0x3f')]['includeAll']){_0xc74b94[_0xd589('0x4f')]=[{'all':!![]}];}return db[_0xd589('0x3a')][_0xd589('0x50')](_0xc74b94);})[_0xd589('0x2b')](function(_0x505273){_0x4b33f3[_0xd589('0x51')]=_0x505273;return _0x4b33f3;})['then'](respondWithFilteredResult(_0x31fc5f,_0xc74b94))[_0xd589('0x52')](handleError(_0x31fc5f,null));};exports[_0xd589('0x53')]=function(_0x28eac4,_0x1ca768){var _0x2cbbc7={'raw':![],'where':{'id':_0x28eac4['params']['id']}},_0x132699={};_0x132699[_0xd589('0x3d')]=_[_0xd589('0x40')](db['VoiceQueue'][_0xd589('0x3b')]);_0x132699[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x28eac4[_0xd589('0x3f')]);_0x132699[_0xd589('0x41')]=_[_0xd589('0x42')](_0x132699[_0xd589('0x3d')],_0x132699[_0xd589('0x3f')]);_0x2cbbc7[_0xd589('0x43')]=_[_0xd589('0x42')](_0x132699[_0xd589('0x3d')],qs['fields'](_0x28eac4[_0xd589('0x3f')][_0xd589('0x44')]));_0x2cbbc7['attributes']=_0x2cbbc7['attributes'][_0xd589('0x45')]?_0x2cbbc7[_0xd589('0x43')]:_0x132699[_0xd589('0x3d')];if(_0x28eac4[_0xd589('0x3f')][_0xd589('0x54')]){_0x2cbbc7['include']=[{'all':!![]}];}_0x2cbbc7=_['merge']({},_0x2cbbc7,_0x28eac4[_0xd589('0x4e')]);return db['VoiceQueue'][_0xd589('0x55')](_0x2cbbc7)[_0xd589('0x2b')](handleEntityNotFound(_0x1ca768,null))[_0xd589('0x2b')](respondWithResult(_0x1ca768,null))['catch'](handleError(_0x1ca768,null));};exports[_0xd589('0x56')]=function(_0xd19626,_0x486dae){return db[_0xd589('0x3a')]['create'](_0xd19626[_0xd589('0x57')],{})['then'](function(_0x39abd1){var _0x59790c=_0xd19626[_0xd589('0x58')][_0xd589('0x2c')]({'plain':!![]});if(!_0x59790c)throw new Error(_0xd589('0x59'));if(_0x59790c[_0xd589('0x5a')]==='user'){var _0x122e8f=_0x39abd1[_0xd589('0x2c')]({'plain':!![]});var _0x38daf2=[{'name':_0xd589('0x2d'),'value':_0xd589('0x2e')},{'name':'QueueCampaigns','value':_0xd589('0x2f')}];var _0x31e138=_['find'](_0x38daf2,[_0xd589('0x32'),_0x122e8f[_0xd589('0x34')]])[_0xd589('0x35')];return db[_0xd589('0x5b')][_0xd589('0x55')]({'where':{'name':_0x31e138,'userProfileId':_0x59790c[_0xd589('0x5c')]},'raw':!![]})[_0xd589('0x2b')](function(_0x3991da){if(_0x3991da&&_0x3991da[_0xd589('0x5d')]===0x0){return db[_0xd589('0x36')][_0xd589('0x56')]({'name':_0x122e8f['name'],'resourceId':_0x122e8f['id'],'type':_0x3991da[_0xd589('0x35')],'sectionId':_0x3991da['id']},{})[_0xd589('0x2b')](function(){return _0x39abd1;});}else{return _0x39abd1;}})['catch'](function(_0x5da123){logger[_0xd589('0x5e')](_0xd589('0x5f'),_0x5da123);throw _0x5da123;});}return _0x39abd1;})[_0xd589('0x2b')](respondWithResult(_0x486dae,0xc9))['catch'](handleError(_0x486dae,null));};exports[_0xd589('0x60')]=function(_0x25dff2,_0x37cf8a){var _0xc45dbc={'where':{'id':_0x25dff2[_0xd589('0x61')]['id']}},_0xbfe960={};_0xbfe960[_0xd589('0x3d')]=_['keys'](db[_0xd589('0x3a')][_0xd589('0x3b')]);_0xc45dbc[_0xd589('0x43')]=_['intersection'](_0xbfe960['model'],qs[_0xd589('0x44')](_0x25dff2['query'][_0xd589('0x44')]));_0xc45dbc[_0xd589('0x43')]=_0xc45dbc[_0xd589('0x43')][_0xd589('0x45')]?_0xc45dbc[_0xd589('0x43')]:_0xbfe960[_0xd589('0x3d')];if(_0x25dff2[_0xd589('0x3f')][_0xd589('0x54')]){_0xc45dbc[_0xd589('0x4f')]=[{'all':!![]}];}_0xc45dbc=_['merge']({},_0xc45dbc,_0x25dff2[_0xd589('0x4e')]);return db['VoiceQueue'][_0xd589('0x55')](_0xc45dbc)['then'](handleEntityNotFound(_0x37cf8a,null))[_0xd589('0x2b')](function(_0x5ce55c){if(_0x5ce55c){var _0x26f699=_0x5ce55c[_0xd589('0x2c')]({'plain':!![]});_0x26f699=qs[_0xd589('0x62')](_0x26f699,['id',_0xd589('0x63'),_0xd589('0x64')]);_0x25dff2[_0xd589('0x57')]=_[_0xd589('0x62')](_0x25dff2[_0xd589('0x57')],['id','createdAt',_0xd589('0x64')]);return db[_0xd589('0x3a')][_0xd589('0x56')](_[_0xd589('0x4c')](_0x26f699,_0x25dff2[_0xd589('0x57')]),{'include':_0x25dff2[_0xd589('0x3f')][_0xd589('0x54')]?[{'all':!![]}]:undefined})[_0xd589('0x2b')](function(_0x4d868a){var _0x1cbce3=_0x25dff2[_0xd589('0x58')]['get']({'plain':!![]});if(!_0x1cbce3)throw new Error(_0xd589('0x59'));if(_0x1cbce3[_0xd589('0x5a')]===_0xd589('0x58')){var _0x3caa01=_0x4d868a[_0xd589('0x2c')]({'plain':!![]});var _0x287eb4=[{'name':_0xd589('0x2d'),'value':'inbound'},{'name':_0xd589('0x65'),'value':_0xd589('0x2f')}];var _0x7193d0=_[_0xd589('0x55')](_0x287eb4,['value',_0x3caa01[_0xd589('0x34')]])['name'];return db[_0xd589('0x5b')]['find']({'where':{'name':_0x7193d0,'userProfileId':_0x1cbce3[_0xd589('0x5c')]},'raw':!![]})[_0xd589('0x2b')](function(_0x47c2ba){if(_0x47c2ba&&_0x47c2ba[_0xd589('0x5d')]===0x0){return db[_0xd589('0x36')][_0xd589('0x56')]({'name':_0x3caa01[_0xd589('0x35')],'resourceId':_0x3caa01['id'],'type':_0x47c2ba[_0xd589('0x35')],'sectionId':_0x47c2ba['id']},{})[_0xd589('0x2b')](function(){return _0x4d868a;});}else{return _0x4d868a;}})[_0xd589('0x52')](function(_0x6ace71){logger[_0xd589('0x5e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6ace71);throw _0x6ace71;});}return _0x4d868a;});}})[_0xd589('0x2b')](respondWithResult(_0x37cf8a,0xc9))[_0xd589('0x52')](handleError(_0x37cf8a,null));};exports[_0xd589('0x2a')]=function(_0xb3038d,_0x3bd2e9){if(_0xb3038d[_0xd589('0x57')]['id']){delete _0xb3038d[_0xd589('0x57')]['id'];}return db['VoiceQueue'][_0xd589('0x55')]({'where':{'id':_0xb3038d[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x3bd2e9,null))['then'](saveUpdates(_0xb3038d[_0xd589('0x57')],null))[_0xd589('0x2b')](respondWithResult(_0x3bd2e9,null))[_0xd589('0x52')](handleError(_0x3bd2e9,null));};exports[_0xd589('0x37')]=function(_0x4f0269,_0x547691){return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x4f0269[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x547691,null))[_0xd589('0x2b')](removeEntity(_0x547691,null))[_0xd589('0x52')](handleError(_0x547691,null));};exports['getHoppers']=function(_0x31c401,_0x526e0c,_0x242cb8){var _0x2fa449={'raw':![],'where':{}};var _0x176e84={};var _0x4304d9={'count':0x0,'rows':[]};return db[_0xd589('0x3a')]['findOne']({'where':{'id':_0x31c401[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x526e0c,null))[_0xd589('0x2b')](function(_0x39d0c5){if(_0x39d0c5){_0x176e84[_0xd589('0x3d')]=_['keys'](db['CmHopper']['rawAttributes']);_0x176e84['query']=_[_0xd589('0x40')](_0x31c401[_0xd589('0x3f')]);_0x176e84[_0xd589('0x41')]=_[_0xd589('0x42')](_0x176e84['model'],_0x176e84[_0xd589('0x3f')]);_0x2fa449[_0xd589('0x43')]=_[_0xd589('0x42')](_0x176e84[_0xd589('0x3d')],qs['fields'](_0x31c401['query'][_0xd589('0x44')]));_0x2fa449[_0xd589('0x43')]=_0x2fa449[_0xd589('0x43')]['length']?_0x2fa449[_0xd589('0x43')]:_0x176e84[_0xd589('0x3d')];if(!_0x31c401[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x2fa449[_0xd589('0x23')]=qs['limit'](_0x31c401['query']['limit']);_0x2fa449[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x31c401[_0xd589('0x3f')]['offset']);}_0x2fa449[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x31c401[_0xd589('0x3f')]['sort']);_0x2fa449[_0xd589('0x4a')]=qs[_0xd589('0x41')](_['pick'](_0x31c401['query'],_0x176e84[_0xd589('0x41')]));_0x2fa449['where'][_0xd589('0x66')]=_0x39d0c5['id'];if(_0x31c401[_0xd589('0x3f')][_0xd589('0x30')]){_0x2fa449[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x2fa449['where'],{'$or':_['map'](_0x2fa449['attributes'],function(_0x51e337){var _0x5045dd={};_0x5045dd[_0x51e337]={'$like':'%'+_0x31c401[_0xd589('0x3f')]['filter']+'%'};return _0x5045dd;})});}_0x2fa449=_[_0xd589('0x4c')]({},_0x2fa449,_0x31c401[_0xd589('0x4e')]);return db['CmHopper']['count']({'where':_0x2fa449['where']})[_0xd589('0x2b')](function(_0x5c1051){_0x4304d9['count']=_0x5c1051;if(_0x31c401[_0xd589('0x3f')][_0xd589('0x54')]){_0x2fa449['include']=[{'all':!![]}];}return db[_0xd589('0x67')][_0xd589('0x50')](_0x2fa449);})[_0xd589('0x2b')](function(_0x4b7e23){_0x4304d9['rows']=_0x4b7e23;return _0x4304d9;});}})['then'](respondWithFilteredResult(_0x526e0c,_0x2fa449))[_0xd589('0x52')](handleError(_0x526e0c,null));};exports[_0xd589('0x68')]=function(_0x43483a,_0x3e0ca0,_0x4ab3e2){var _0x159d0a={'raw':!![],'where':{}};var _0x4473d9={};var _0xbea50f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd589('0x69')]({'where':{'id':_0x43483a[_0xd589('0x61')]['id']}})['then'](handleEntityNotFound(_0x3e0ca0,null))[_0xd589('0x2b')](function(_0x43319b){if(_0x43319b){_0x4473d9['model']=_['keys'](db[_0xd589('0x6a')][_0xd589('0x3b')]);_0x4473d9[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x43483a[_0xd589('0x3f')]);_0x4473d9['filters']=_['intersection'](_0x4473d9[_0xd589('0x3d')],_0x4473d9[_0xd589('0x3f')]);_0x159d0a[_0xd589('0x43')]=_[_0xd589('0x42')](_0x4473d9[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x43483a[_0xd589('0x3f')][_0xd589('0x44')]));_0x159d0a[_0xd589('0x43')]=_0x159d0a[_0xd589('0x43')]['length']?_0x159d0a[_0xd589('0x43')]:_0x4473d9[_0xd589('0x3d')];if(!_0x43483a[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x159d0a['limit']=qs['limit'](_0x43483a[_0xd589('0x3f')][_0xd589('0x23')]);_0x159d0a[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x43483a[_0xd589('0x3f')][_0xd589('0x21')]);}_0x159d0a[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x43483a[_0xd589('0x3f')][_0xd589('0x49')]);_0x159d0a['where']=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x43483a[_0xd589('0x3f')],_0x4473d9[_0xd589('0x41')]));_0x159d0a[_0xd589('0x4a')][_0xd589('0x66')]=_0x43319b['id'];if(_0x43483a[_0xd589('0x3f')][_0xd589('0x30')]){_0x159d0a[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x159d0a[_0xd589('0x4a')],{'$or':_['map'](_0x159d0a[_0xd589('0x43')],function(_0x4d7f7a){var _0x300747={};_0x300747[_0x4d7f7a]={'$like':'%'+_0x43483a[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x300747;})});}_0x159d0a=_['merge']({},_0x159d0a,_0x43483a[_0xd589('0x4e')]);return db[_0xd589('0x6a')][_0xd589('0x24')]({'where':_0x159d0a[_0xd589('0x4a')]})[_0xd589('0x2b')](function(_0xd48a44){_0xbea50f[_0xd589('0x24')]=_0xd48a44;if(_0x43483a[_0xd589('0x3f')][_0xd589('0x54')]){_0x159d0a['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xd589('0x50')](_0x159d0a);})['then'](function(_0x37fcb9){_0xbea50f[_0xd589('0x51')]=_0x37fcb9;return _0xbea50f;});}})[_0xd589('0x2b')](respondWithFilteredResult(_0x3e0ca0,_0x159d0a))['catch'](handleError(_0x3e0ca0,null));};exports[_0xd589('0x6b')]=function(_0x3e44b0,_0x131c1b,_0x9933ec){var _0x7cca0c={'raw':!![],'where':{}};var _0x4d1c9e={};var _0xc58941={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd589('0x69')]({'where':{'id':_0x3e44b0[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x131c1b,null))['then'](function(_0x5c1d83){if(_0x5c1d83){_0x4d1c9e[_0xd589('0x3d')]=_[_0xd589('0x40')](db[_0xd589('0x6c')][_0xd589('0x3b')]);_0x4d1c9e[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x3e44b0['query']);_0x4d1c9e[_0xd589('0x41')]=_[_0xd589('0x42')](_0x4d1c9e['model'],_0x4d1c9e[_0xd589('0x3f')]);_0x7cca0c[_0xd589('0x43')]=_[_0xd589('0x42')](_0x4d1c9e[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x3e44b0['query'][_0xd589('0x44')]));_0x7cca0c[_0xd589('0x43')]=_0x7cca0c[_0xd589('0x43')][_0xd589('0x45')]?_0x7cca0c['attributes']:_0x4d1c9e['model'];if(!_0x3e44b0[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x7cca0c[_0xd589('0x23')]=qs['limit'](_0x3e44b0[_0xd589('0x3f')][_0xd589('0x23')]);_0x7cca0c[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x3e44b0[_0xd589('0x3f')][_0xd589('0x21')]);}_0x7cca0c[_0xd589('0x48')]=qs['sort'](_0x3e44b0[_0xd589('0x3f')][_0xd589('0x49')]);_0x7cca0c[_0xd589('0x4a')]=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x3e44b0[_0xd589('0x3f')],_0x4d1c9e[_0xd589('0x41')]));_0x7cca0c[_0xd589('0x4a')][_0xd589('0x66')]=_0x5c1d83['id'];if(_0x3e44b0[_0xd589('0x3f')][_0xd589('0x30')]){_0x7cca0c[_0xd589('0x4a')]=_['merge'](_0x7cca0c[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0x7cca0c['attributes'],function(_0x315e3b){var _0x56270a={};_0x56270a[_0x315e3b]={'$like':'%'+_0x3e44b0['query'][_0xd589('0x30')]+'%'};return _0x56270a;})});}_0x7cca0c=_[_0xd589('0x4c')]({},_0x7cca0c,_0x3e44b0[_0xd589('0x4e')]);return db[_0xd589('0x6c')][_0xd589('0x24')]({'where':_0x7cca0c[_0xd589('0x4a')]})['then'](function(_0x3ca137){_0xc58941[_0xd589('0x24')]=_0x3ca137;if(_0x3e44b0[_0xd589('0x3f')][_0xd589('0x54')]){_0x7cca0c['include']=[{'all':!![]}];}return db[_0xd589('0x6c')][_0xd589('0x50')](_0x7cca0c);})[_0xd589('0x2b')](function(_0xf94ea1){_0xc58941['rows']=_0xf94ea1;return _0xc58941;});}})[_0xd589('0x2b')](respondWithFilteredResult(_0x131c1b,_0x7cca0c))['catch'](handleError(_0x131c1b,null));};exports['getHopperBlacks']=function(_0x50d47a,_0x484950,_0x47be8b){var _0xed05ce={'raw':!![],'where':{}};var _0x43b0f0={};var _0x2a0557={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd589('0x69')]({'where':{'id':_0x50d47a[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x484950,null))[_0xd589('0x2b')](function(_0x2f77c7){if(_0x2f77c7){_0x43b0f0[_0xd589('0x3d')]=_['keys'](db[_0xd589('0x6d')]['rawAttributes']);_0x43b0f0[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x50d47a['query']);_0x43b0f0[_0xd589('0x41')]=_[_0xd589('0x42')](_0x43b0f0['model'],_0x43b0f0[_0xd589('0x3f')]);_0xed05ce['attributes']=_['intersection'](_0x43b0f0['model'],qs['fields'](_0x50d47a['query'][_0xd589('0x44')]));_0xed05ce[_0xd589('0x43')]=_0xed05ce[_0xd589('0x43')][_0xd589('0x45')]?_0xed05ce[_0xd589('0x43')]:_0x43b0f0[_0xd589('0x3d')];if(!_0x50d47a[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0xed05ce[_0xd589('0x23')]=qs[_0xd589('0x23')](_0x50d47a[_0xd589('0x3f')][_0xd589('0x23')]);_0xed05ce[_0xd589('0x21')]=qs['offset'](_0x50d47a[_0xd589('0x3f')][_0xd589('0x21')]);}_0xed05ce['order']=qs[_0xd589('0x49')](_0x50d47a[_0xd589('0x3f')][_0xd589('0x49')]);_0xed05ce['where']=qs[_0xd589('0x41')](_['pick'](_0x50d47a[_0xd589('0x3f')],_0x43b0f0['filters']));_0xed05ce[_0xd589('0x4a')][_0xd589('0x66')]=_0x2f77c7['id'];if(_0x50d47a['query'][_0xd589('0x30')]){_0xed05ce[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0xed05ce[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0xed05ce['attributes'],function(_0xd0bc08){var _0x2859e9={};_0x2859e9[_0xd0bc08]={'$like':'%'+_0x50d47a['query'][_0xd589('0x30')]+'%'};return _0x2859e9;})});}_0xed05ce=_[_0xd589('0x4c')]({},_0xed05ce,_0x50d47a[_0xd589('0x4e')]);return db[_0xd589('0x6d')][_0xd589('0x24')]({'where':_0xed05ce[_0xd589('0x4a')]})[_0xd589('0x2b')](function(_0x17ba65){_0x2a0557[_0xd589('0x24')]=_0x17ba65;if(_0x50d47a[_0xd589('0x3f')][_0xd589('0x54')]){_0xed05ce[_0xd589('0x4f')]=[{'all':!![]}];}return db[_0xd589('0x6d')]['findAll'](_0xed05ce);})[_0xd589('0x2b')](function(_0x163222){_0x2a0557['rows']=_0x163222;return _0x2a0557;});}})['then'](respondWithFilteredResult(_0x484950,_0xed05ce))['catch'](handleError(_0x484950,null));};exports[_0xd589('0x6e')]=function(_0x35a849,_0x32454c,_0x9ea485){var _0x1ceec3={};var _0x24b001={};var _0x562eb8;var _0x32abfe;return db[_0xd589('0x3a')][_0xd589('0x69')]({'where':{'id':_0x35a849[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x32454c,null))['then'](function(_0xcaa1fe){if(_0xcaa1fe){_0x562eb8=_0xcaa1fe;_0x24b001[_0xd589('0x3d')]=_['keys'](db['Team'][_0xd589('0x3b')]);_0x24b001[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x35a849[_0xd589('0x3f')]);_0x24b001['filters']=_[_0xd589('0x42')](_0x24b001[_0xd589('0x3d')],_0x24b001[_0xd589('0x3f')]);_0x1ceec3['attributes']=_[_0xd589('0x42')](_0x24b001[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x35a849[_0xd589('0x3f')]['fields']));_0x1ceec3[_0xd589('0x43')]=_0x1ceec3['attributes']['length']?_0x1ceec3[_0xd589('0x43')]:_0x24b001['model'];_0x1ceec3[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x35a849[_0xd589('0x3f')][_0xd589('0x49')]);_0x1ceec3['where']=qs[_0xd589('0x41')](_['pick'](_0x35a849[_0xd589('0x3f')],_0x24b001[_0xd589('0x41')]));if(_0x35a849[_0xd589('0x3f')]['filter']){_0x1ceec3[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x1ceec3['where'],{'$or':_[_0xd589('0x3e')](_0x1ceec3[_0xd589('0x43')],function(_0x37a910){var _0x3c007d={};_0x3c007d[_0x37a910]={'$like':'%'+_0x35a849[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x3c007d;})});}_0x1ceec3=_[_0xd589('0x4c')]({},_0x1ceec3,_0x35a849[_0xd589('0x4e')]);return _0x562eb8[_0xd589('0x6e')](_0x1ceec3);}})[_0xd589('0x2b')](function(_0x3d5eee){if(_0x3d5eee){_0x32abfe=_0x3d5eee[_0xd589('0x45')];if(!_0x35a849['query'][_0xd589('0x46')](_0xd589('0x47'))){_0x1ceec3[_0xd589('0x23')]=qs[_0xd589('0x23')](_0x35a849['query'][_0xd589('0x23')]);_0x1ceec3[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x35a849[_0xd589('0x3f')][_0xd589('0x21')]);}return _0x562eb8[_0xd589('0x6e')](_0x1ceec3);}})['then'](function(_0x374d70){if(_0x374d70){return _0x374d70?{'count':_0x32abfe,'rows':_0x374d70}:null;}})[_0xd589('0x2b')](respondWithResult(_0x32454c,null))[_0xd589('0x52')](handleError(_0x32454c,null));};exports['addTeams']=function(_0x1c4a3e,_0x501792,_0x386670){var _0x48b9a2=_0x1c4a3e[_0xd589('0x57')][_0xd589('0x6f')];var _0x4a330c=_[_0xd589('0x3e')](_0x48b9a2,'id');return db[_0xd589('0x70')][_0xd589('0x50')]({'where':{'id':_0x4a330c},'attributes':['id'],'include':[{'model':db[_0xd589('0x71')],'as':_0xd589('0x72'),'attributes':['id',_0xd589('0x35'),'online',_0xd589('0x73'),_0xd589('0x74')],'raw':!![]}]})[_0xd589('0x2b')](function(_0x32c562){if(_0x32c562){var _0x15578a=_[_0xd589('0x75')](_0x32c562,function(_0x3e0b32){var _0x36bb43=_0x3e0b32[_0xd589('0x2c')]({'plain':!![]});_0x36bb43[_0xd589('0x72')][_0xd589('0x76')](function(_0x5e0263){_0x5e0263['penalty']=_['find'](_0x48b9a2,{'id':_0x36bb43['id']})[_0xd589('0x77')];});return _0x36bb43['Agents'];});return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x1c4a3e[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](function(_0x1e67b8){return db[_0xd589('0x78')][_0xd589('0x79')](function(_0x3ac456){return _0x1e67b8[_0xd589('0x7a')](_0x4a330c,{'transaction':_0x3ac456})[_0xd589('0x2b')](function(){return BPromise[_0xd589('0x7b')](_0x48b9a2,function(_0x1ef8a9){return db[_0xd589('0x7c')][_0xd589('0x7d')]({'TeamId':_0x1ef8a9['id'],'VoiceQueueId':_0x1c4a3e[_0xd589('0x61')]['id'],'penalty':_0x1ef8a9[_0xd589('0x77')]},{'transaction':_0x3ac456});});})['then'](function(){return BPromise[_0xd589('0x7b')](_0x15578a,function(_0xb3854){return db['UserVoiceQueue'][_0xd589('0x7e')]({'where':{'UserId':_0xb3854['id'],'VoiceQueueId':_0x1c4a3e[_0xd589('0x61')]['id']},'defaults':{'penalty':_0xb3854[_0xd589('0x77')]},'transaction':_0x3ac456});});})[_0xd589('0x2b')](function(){return BPromise['each'](_[_0xd589('0x30')](_0x15578a,{'online':!![]}),function(_0x1f88f9){return db[_0xd589('0x7f')][_0xd589('0x7d')]({'membername':_0x1f88f9[_0xd589('0x35')],'UserId':_0x1f88f9['id'],'queue_name':_0x1e67b8[_0xd589('0x35')],'VoiceQueueId':_0x1e67b8['id'],'interface':_[_0xd589('0x80')](_0x1f88f9[_0xd589('0x74')])?util[_0xd589('0x81')](_0xd589('0x82'),_0x1f88f9[_0xd589('0x35')]):_0x1f88f9[_0xd589('0x74')],'paused':_0x1f88f9[_0xd589('0x73')]||![],'penalty':_0x1f88f9[_0xd589('0x77')]},{'transaction':_0x3ac456});});})[_0xd589('0x2b')](function(){_0x15578a['forEach'](function(_0x5b6308){socket[_0xd589('0x83')]('userVoiceQueue:save',{'UserId':_0x5b6308['id'],'VoiceQueueId':_0x1e67b8['id']});});});});});}})[_0xd589('0x2b')](respondWithStatusCode(_0x501792,null))['catch'](handleError(_0x501792,null));};exports['removeTeams']=function(_0x16e923,_0x4fc054,_0x27d12f){return db['Team'][_0xd589('0x50')]({'where':{'id':_0x16e923['query'][_0xd589('0x84')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd589('0x2b')](handleEntityNotFound(_0x4fc054,null))[_0xd589('0x2b')](function(_0x296ced){var _0x99433e=_[_0xd589('0x3e')](_0x296ced,'id');var _0x20e872=[];var _0xe90c09=[];var _0x1ce33b=squel[_0xd589('0x85')]();_0x1ce33b['field']('tq.TeamId')[_0xd589('0x86')](_0xd589('0x87'),'tq')[_0xd589('0x88')](_0xd589('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd589('0x8a'),_0x16e923['params']['id']);for(var _0x4c24f1=0x0;_0x4c24f1<_0x296ced[_0xd589('0x45')];_0x4c24f1+=0x1){let _0x24d408=_0x296ced[_0x4c24f1];for(var _0xb312e1=0x0;_0xb312e1<_0x24d408[_0xd589('0x72')]['length'];_0xb312e1+=0x1){let _0x4df4c4=_0x24d408[_0xd589('0x72')][_0xb312e1];var _0x5a97b8=_0x1ce33b[_0xd589('0x60')]();_0x5a97b8['where']('ut.UserId\x20=\x20?',_0x4df4c4['id']);_0xe90c09['push'](db[_0xd589('0x78')][_0xd589('0x3f')](_0x5a97b8['toString'](),{'type':db['sequelize'][_0xd589('0x8b')][_0xd589('0x8c')]})[_0xd589('0x2b')](function(_0x26f7de){if(_0x26f7de[_0xd589('0x45')]===0x1){return _0x4df4c4['id'];}else{var _0x40f380=_[_0xd589('0x8d')](_[_0xd589('0x3e')](_0x26f7de,_0xd589('0x8e')),function(_0x2ae673){return _[_0xd589('0x33')](_0x99433e,_0x2ae673);});if(_0x40f380){return _0x4df4c4['id'];}}}));}}return BPromise[_0xd589('0x8f')](_0xe90c09)[_0xd589('0x2b')](function(_0x31a2cb){_0x20e872=_(_0x20e872)[_0xd589('0x90')](_0x31a2cb)[_0xd589('0x91')]()[_0xd589('0x32')]();return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x16e923[_0xd589('0x61')]['id']}})['then'](function(_0x8299f7){return db[_0xd589('0x78')]['transaction'](function(_0x337276){return _0x8299f7[_0xd589('0x92')](_0x16e923[_0xd589('0x3f')][_0xd589('0x84')],{'transaction':_0x337276})['then'](function(){if(!_[_0xd589('0x93')](_0x20e872)){return _0x8299f7[_0xd589('0x94')](_0x20e872,{'transaction':_0x337276})[_0xd589('0x2b')](function(){return db[_0xd589('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x16e923[_0xd589('0x61')]['id'],'UserId':_0x20e872},'transaction':_0x337276});});}})[_0xd589('0x2b')](function(){_0x20e872['forEach'](function(_0x5a8b32){socket[_0xd589('0x83')]('userVoiceQueue:remove',{'UserId':_0x5a8b32,'VoiceQueueId':_0x8299f7['id']});});});});});});})['then'](respondWithStatusCode(_0x4fc054,null))['catch'](handleError(_0x4fc054,null));};exports[_0xd589('0x95')]=function(_0x5aa953,_0x4d8767,_0x4468e7){var _0x186365,_0x214300;return db['VoiceQueue'][_0xd589('0x55')]({'where':{'id':_0x5aa953[_0xd589('0x61')]['id']}})['then'](handleEntityNotFound(_0x4d8767,null))['then'](function(_0x56a1ed){if(_0x56a1ed){_0x214300=_0x56a1ed;return _0x56a1ed['addAgents'](_0x5aa953[_0xd589('0x57')][_0xd589('0x84')],_[_0xd589('0x62')](_0x5aa953[_0xd589('0x57')],[_0xd589('0x84'),'id'])||{})[_0xd589('0x96')](function(_0x53b2e5){for(var _0x36f2e6=0x0;_0x36f2e6<_0x5aa953[_0xd589('0x57')]['ids']['length'];_0x36f2e6+=0x1){socket[_0xd589('0x83')]('userVoiceQueue:save',{'UserId':Number(_0x5aa953[_0xd589('0x57')][_0xd589('0x84')][_0x36f2e6]),'VoiceQueueId':Number(_0x5aa953[_0xd589('0x61')]['id'])});}return _0x53b2e5;});}})[_0xd589('0x2b')](function(_0x25d110){_0x186365=_0x25d110||[];if(_0x214300){return db[_0xd589('0x71')]['findAll']({'where':{'id':_0x5aa953[_0xd589('0x57')][_0xd589('0x84')]},'attributes':['id','name',_0xd589('0x97'),_0xd589('0x73'),_0xd589('0x74')],'raw':!![]});}})[_0xd589('0x2b')](function(_0x51d7f7){if(!_[_0xd589('0x93')](_0x51d7f7)){var _0x3478b7=[];for(var _0x1f4e4e=0x0;_0x1f4e4e<_0x51d7f7[_0xd589('0x45')];_0x1f4e4e++){if(_0x51d7f7[_0x1f4e4e][_0xd589('0x97')]){_0x3478b7[_0xd589('0x98')](db[_0xd589('0x7f')][_0xd589('0x7d')]({'membername':_0x51d7f7[_0x1f4e4e][_0xd589('0x35')],'UserId':_0x51d7f7[_0x1f4e4e]['id'],'queue_name':_0x214300['name'],'VoiceQueueId':_0x214300['id'],'interface':_[_0xd589('0x80')](_0x51d7f7[_0x1f4e4e][_0xd589('0x74')])?util[_0xd589('0x81')](_0xd589('0x82'),_0x51d7f7[_0x1f4e4e]['name']):_0x51d7f7[_0x1f4e4e][_0xd589('0x74')],'paused':_0x51d7f7[_0x1f4e4e][_0xd589('0x73')]||![],'penalty':_0x5aa953[_0xd589('0x57')]['penalty']||0x0}));}}return BPromise[_0xd589('0x8f')](_0x3478b7);}})[_0xd589('0x2b')](function(){return _0x186365;})[_0xd589('0x2b')](respondWithResult(_0x4d8767,null))[_0xd589('0x52')](handleError(_0x4d8767,null));};exports[_0xd589('0x94')]=function(_0x2a4b01,_0x17c0ad,_0x256943){return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x2a4b01[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x17c0ad,null))[_0xd589('0x2b')](function(_0x40f938){if(_0x40f938){return _0x40f938[_0xd589('0x94')](_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')])[_0xd589('0x2b')](function(){if(_[_0xd589('0x99')](_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')])){for(var _0x2aa19e=0x0;_0x2aa19e<_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')][_0xd589('0x45')];_0x2aa19e+=0x1){socket[_0xd589('0x83')](_0xd589('0x9a'),{'UserId':Number(_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')][_0x2aa19e]),'VoiceQueueId':Number(_0x2a4b01[_0xd589('0x61')]['id'])});}}else{socket[_0xd589('0x83')]('userVoiceQueue:remove',{'UserId':Number(_0x2a4b01[_0xd589('0x3f')][_0xd589('0x84')]),'VoiceQueueId':Number(_0x2a4b01[_0xd589('0x61')]['id'])});}});}})[_0xd589('0x2b')](function(_0x28c524){return db[_0xd589('0x7f')][_0xd589('0x37')]({'where':{'VoiceQueueId':_0x2a4b01['params']['id'],'UserId':_0x2a4b01[_0xd589('0x3f')]['ids']}})[_0xd589('0x2b')](function(){return _0x28c524;});})[_0xd589('0x2b')](respondWithStatusCode(_0x17c0ad,null))[_0xd589('0x52')](handleError(_0x17c0ad,null));};exports[_0xd589('0x9b')]=function(_0x5d1098,_0x49a5f6,_0x5d393b){var _0x9c83ca={};var _0x4f7445={};var _0x2d1584;var _0x5c96b8;return db['VoiceQueue'][_0xd589('0x69')]({'where':{'id':_0x5d1098[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x49a5f6,null))['then'](function(_0x180d3f){if(_0x180d3f){_0x2d1584=_0x180d3f;_0x4f7445[_0xd589('0x3d')]=_[_0xd589('0x40')](db[_0xd589('0x71')][_0xd589('0x3b')]);_0x4f7445[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x5d1098['query']);_0x4f7445[_0xd589('0x41')]=_[_0xd589('0x42')](_0x4f7445[_0xd589('0x3d')],_0x4f7445[_0xd589('0x3f')]);_0x9c83ca[_0xd589('0x43')]=_['intersection'](_0x4f7445['model'],qs[_0xd589('0x44')](_0x5d1098['query']['fields']));_0x9c83ca[_0xd589('0x43')]=_0x9c83ca[_0xd589('0x43')][_0xd589('0x45')]?_0x9c83ca[_0xd589('0x43')]:_0x4f7445[_0xd589('0x3d')];_0x9c83ca[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x5d1098[_0xd589('0x3f')][_0xd589('0x49')]);_0x9c83ca['where']=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x5d1098[_0xd589('0x3f')],_0x4f7445['filters']));if(_0x5d1098[_0xd589('0x3f')][_0xd589('0x30')]){_0x9c83ca[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x9c83ca[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0x9c83ca[_0xd589('0x43')],function(_0x4b2e83){var _0x37c002={};_0x37c002[_0x4b2e83]={'$like':'%'+_0x5d1098[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x37c002;})});}_0x9c83ca=_[_0xd589('0x4c')]({},_0x9c83ca,_0x5d1098['options']);return _0x2d1584['getAgents'](_0x9c83ca);}})['then'](function(_0x346922){if(_0x346922){_0x5c96b8=_0x346922[_0xd589('0x45')];if(!_0x5d1098['query'][_0xd589('0x46')](_0xd589('0x47'))){_0x9c83ca[_0xd589('0x23')]=qs['limit'](_0x5d1098['query'][_0xd589('0x23')]);_0x9c83ca[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x5d1098[_0xd589('0x3f')][_0xd589('0x21')]);}return _0x2d1584['getAgents'](_0x9c83ca);}})['then'](function(_0xdf01ce){if(_0xdf01ce){return _0xdf01ce?{'count':_0x5c96b8,'rows':_0xdf01ce}:null;}})[_0xd589('0x2b')](respondWithResult(_0x49a5f6,null))['catch'](handleError(_0x49a5f6,null));};exports['getMembers']=function(_0x4e85e0,_0x31233e,_0x5e1528){var _0x3f3650={};var _0x318f34={};var _0x9dd424;var _0x3dcd3a;return db[_0xd589('0x3a')][_0xd589('0x69')]({'where':{'id':_0x4e85e0[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x31233e,null))[_0xd589('0x2b')](function(_0x5ade51){if(_0x5ade51){_0x9dd424=_0x5ade51;_0x318f34['model']=_['keys'](db['UserVoiceQueueRt'][_0xd589('0x3b')]);_0x318f34[_0xd589('0x3f')]=_['keys'](_0x4e85e0['query']);_0x318f34[_0xd589('0x41')]=_[_0xd589('0x42')](_0x318f34[_0xd589('0x3d')],_0x318f34[_0xd589('0x3f')]);_0x3f3650['attributes']=_[_0xd589('0x42')](_0x318f34['model'],qs[_0xd589('0x44')](_0x4e85e0[_0xd589('0x3f')]['fields']));_0x3f3650[_0xd589('0x43')]=_0x3f3650[_0xd589('0x43')]['length']?_0x3f3650['attributes']:_0x318f34['model'];_0x3f3650['order']=qs[_0xd589('0x49')](_0x4e85e0[_0xd589('0x3f')][_0xd589('0x49')]);_0x3f3650['where']=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x4e85e0[_0xd589('0x3f')],_0x318f34[_0xd589('0x41')]));if(_0x4e85e0[_0xd589('0x3f')]['filter']){_0x3f3650[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x3f3650[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0x3f3650[_0xd589('0x43')],function(_0x45551c){var _0x170880={};_0x170880[_0x45551c]={'$like':'%'+_0x4e85e0[_0xd589('0x3f')]['filter']+'%'};return _0x170880;})});}_0x3f3650=_['merge']({},_0x3f3650,_0x4e85e0['options']);return _0x9dd424[_0xd589('0x9c')](_0x3f3650);}})['then'](function(_0x5f14ce){if(_0x5f14ce){_0x3dcd3a=_0x5f14ce['length'];if(!_0x4e85e0[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x3f3650[_0xd589('0x23')]=qs[_0xd589('0x23')](_0x4e85e0[_0xd589('0x3f')][_0xd589('0x23')]);_0x3f3650[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x4e85e0['query'][_0xd589('0x21')]);}return _0x9dd424[_0xd589('0x9c')](_0x3f3650);}})[_0xd589('0x2b')](function(_0x166bd2){return _0x166bd2?{'count':_0x3dcd3a,'rows':_0x166bd2}:null;})[_0xd589('0x2b')](respondWithResult(_0x31233e,null))[_0xd589('0x52')](handleError(_0x31233e,null));};exports[_0xd589('0x9d')]=function(_0x232c3e,_0x3419fa,_0xceeb92){var _0x3f43cd={};var _0xcf3e78={};var _0x52b01b;var _0xa945f5;return db[_0xd589('0x3a')]['findOne']({'where':{'id':_0x232c3e['params']['id']}})['then'](handleEntityNotFound(_0x3419fa,null))[_0xd589('0x2b')](function(_0x5ce418){if(_0x5ce418){_0x52b01b=_0x5ce418;_0xcf3e78[_0xd589('0x3d')]=_[_0xd589('0x40')](db[_0xd589('0x9e')][_0xd589('0x3b')]);_0xcf3e78[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x232c3e[_0xd589('0x3f')]);_0xcf3e78[_0xd589('0x41')]=_['intersection'](_0xcf3e78[_0xd589('0x3d')],_0xcf3e78[_0xd589('0x3f')]);_0x3f43cd[_0xd589('0x43')]=_['intersection'](_0xcf3e78[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x232c3e[_0xd589('0x3f')][_0xd589('0x44')]));_0x3f43cd[_0xd589('0x43')]=_0x3f43cd[_0xd589('0x43')][_0xd589('0x45')]?_0x3f43cd['attributes']:_0xcf3e78[_0xd589('0x3d')];_0x3f43cd[_0xd589('0x48')]=qs['sort'](_0x232c3e[_0xd589('0x3f')][_0xd589('0x49')]);_0x3f43cd[_0xd589('0x4a')]=qs[_0xd589('0x41')](_[_0xd589('0x4b')](_0x232c3e['query'],_0xcf3e78[_0xd589('0x41')]));if(_0x232c3e[_0xd589('0x3f')][_0xd589('0x30')]){_0x3f43cd[_0xd589('0x4a')]=_[_0xd589('0x4c')](_0x3f43cd[_0xd589('0x4a')],{'$or':_[_0xd589('0x3e')](_0x3f43cd[_0xd589('0x43')],function(_0x1835d5){var _0x394279={};_0x394279[_0x1835d5]={'$like':'%'+_0x232c3e[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x394279;})});}_0x3f43cd=_[_0xd589('0x4c')]({},_0x3f43cd,_0x232c3e[_0xd589('0x4e')]);return _0x52b01b[_0xd589('0x9d')](_0x3f43cd);}})['then'](function(_0x51d8bf){if(_0x51d8bf){_0xa945f5=_0x51d8bf[_0xd589('0x45')];if(!_0x232c3e['query'][_0xd589('0x46')](_0xd589('0x47'))){_0x3f43cd[_0xd589('0x23')]=qs['limit'](_0x232c3e[_0xd589('0x3f')][_0xd589('0x23')]);_0x3f43cd[_0xd589('0x21')]=qs['offset'](_0x232c3e[_0xd589('0x3f')][_0xd589('0x21')]);}return _0x52b01b[_0xd589('0x9d')](_0x3f43cd);}})[_0xd589('0x2b')](function(_0x299bd3){if(_0x299bd3){return _0x299bd3?{'count':_0xa945f5,'rows':_0x299bd3}:null;}})[_0xd589('0x2b')](respondWithResult(_0x3419fa,null))[_0xd589('0x52')](handleError(_0x3419fa,null));};exports[_0xd589('0x9f')]=function(_0x1cdcc3,_0x2f23a0,_0xa483be){var _0x435955,_0x3bdbd8;return db[_0xd589('0x3a')][_0xd589('0x55')]({'where':{'id':_0x1cdcc3[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x2f23a0,null))[_0xd589('0x2b')](function(_0x58b55c){if(_0x58b55c){_0x3bdbd8=_0x58b55c;return _0x58b55c[_0xd589('0x9f')](_0x1cdcc3[_0xd589('0x57')]['ids'],_[_0xd589('0x62')](_0x1cdcc3[_0xd589('0x57')],['ids','id'])||{});}return null;})[_0xd589('0x96')](function(_0x57a7d9){var _0x5f3936;_0x435955=_0x57a7d9||[];var _0x3441bd=[];if(_0x57a7d9){for(var _0x28bb0e=0x0;_0x28bb0e<_0x57a7d9[_0xd589('0x45')];_0x28bb0e+=0x1){var _0x2d51ed=_0x57a7d9[_0x28bb0e][_0xd589('0x2c')]({'plain':!![]});_0x3bdbd8['dialCheckDuplicateType']=_0x1cdcc3[_0xd589('0x57')][_0xd589('0xa0')]?_0x1cdcc3['body'][_0xd589('0xa0')]:_0x3bdbd8['dialCheckDuplicateType'];switch(_0x3bdbd8[_0xd589('0xa0')]){case'always':_0x5f3936=squel[_0xd589('0xa1')]()[_0xd589('0xa2')](_0xd589('0xa3'))[_0xd589('0xa4')]([_0xd589('0xa5'),_0xd589('0xa6'),_0xd589('0xa7'),_0xd589('0xa8'),_0xd589('0x66'),_0xd589('0x63'),_0xd589('0x64')],squel[_0xd589('0x85')]()[_0xd589('0xa9')](_0xd589('0xa5'),_0xd589('0xa5'))[_0xd589('0xa9')](_0xd589('0xaa'),_0xd589('0xa6'))[_0xd589('0xa9')]('id',_0xd589('0xa7'))[_0xd589('0xa9')](_0x2d51ed[_0xd589('0xab')][_0xd589('0xac')](),_0xd589('0xa8'))[_0xd589('0xa9')](_0x1cdcc3[_0xd589('0x61')]['id']['toString'](),_0xd589('0x66'))['field'](_0xd589('0xaa'),_0xd589('0x63'))['field']('NOW()',_0xd589('0x64'))[_0xd589('0x86')](_0xd589('0xad'))[_0xd589('0x4a')](_0xd589('0xae'))[_0xd589('0x4a')](_0xd589('0xaf'),_0x2d51ed['CmListId'][_0xd589('0xac')]())[_0xd589('0x4a')](_0xd589('0xb0'))[_0xd589('0x4a')](_0xd589('0xb1'),squel['select']()[_0xd589('0xa9')]('COALESCE(calleridnum,\x27\x27)')[_0xd589('0x86')](_0xd589('0xb2'))[_0xd589('0x4a')](_0xd589('0x8a'),_0x1cdcc3[_0xd589('0x61')]['id']['toString']()))[_0xd589('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd589('0x85')]()['field'](_0xd589('0xb3'))[_0xd589('0x86')](_0xd589('0xa3'))['where'](_0xd589('0x8a'),_0x1cdcc3[_0xd589('0x61')]['id'][_0xd589('0xac')]())))['toString']();break;case _0xd589('0xb4'):_0x5f3936=squel[_0xd589('0xa1')]()['into'](_0xd589('0xa3'))['fromQuery']([_0xd589('0xa5'),_0xd589('0xa6'),_0xd589('0xa7'),_0xd589('0xa8'),'VoiceQueueId',_0xd589('0x63'),_0xd589('0x64')],squel[_0xd589('0x85')]()['field'](_0xd589('0xa5'),_0xd589('0xa5'))[_0xd589('0xa9')](_0xd589('0xaa'),_0xd589('0xa6'))[_0xd589('0xa9')]('id',_0xd589('0xa7'))[_0xd589('0xa9')](_0x2d51ed[_0xd589('0xab')]['toString'](),'ListId')[_0xd589('0xa9')](_0x1cdcc3[_0xd589('0x61')]['id'][_0xd589('0xac')](),_0xd589('0x66'))[_0xd589('0xa9')]('NOW()',_0xd589('0x63'))['field'](_0xd589('0xaa'),_0xd589('0x64'))[_0xd589('0x86')](_0xd589('0xad'))[_0xd589('0x4a')]('deletedAt\x20IS\x20NULL')[_0xd589('0x4a')](_0xd589('0xaf'),_0x2d51ed[_0xd589('0xab')][_0xd589('0xac')]())[_0xd589('0x4a')]('phone\x20IS\x20NOT\x20NULL')[_0xd589('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd589('0x85')]()['field']('COALESCE(phone,\x27\x27)')[_0xd589('0x86')]('cm_hopper')[_0xd589('0x4a')]('VoiceQueueId\x20=\x20?',_0x1cdcc3[_0xd589('0x61')]['id'][_0xd589('0xac')]())))[_0xd589('0xac')]();break;default:_0x5f3936=squel[_0xd589('0xa1')]()['into'](_0xd589('0xa3'))['fromQuery']([_0xd589('0xa5'),'scheduledAt',_0xd589('0xa7'),_0xd589('0xa8'),_0xd589('0x66'),_0xd589('0x63'),_0xd589('0x64')],squel['select']()[_0xd589('0xa9')](_0xd589('0xa5'),_0xd589('0xa5'))[_0xd589('0xa9')](_0xd589('0xaa'),_0xd589('0xa6'))['field']('id','ContactId')[_0xd589('0xa9')](_0x2d51ed[_0xd589('0xab')][_0xd589('0xac')](),_0xd589('0xa8'))[_0xd589('0xa9')](_0x1cdcc3[_0xd589('0x61')]['id']['toString'](),_0xd589('0x66'))[_0xd589('0xa9')]('NOW()',_0xd589('0x63'))[_0xd589('0xa9')](_0xd589('0xaa'),_0xd589('0x64'))['from']('cm_contacts')['where'](_0xd589('0xae'))['where']('ListId\x20=\x20?',_0x2d51ed[_0xd589('0xab')][_0xd589('0xac')]())['where'](_0xd589('0xb0')))[_0xd589('0xac')]();}_0x3441bd[_0xd589('0x98')](db[_0xd589('0x78')][_0xd589('0x3f')](_0x5f3936));}return BPromise[_0xd589('0x8f')](_0x3441bd);}})['then'](function(){return _0x435955;})['then'](respondWithResult(_0x2f23a0,null))['catch'](handleError(_0x2f23a0,null));};exports[_0xd589('0xb5')]=function(_0x1f8a43,_0x1ce41f,_0x3e0077){return db['VoiceQueue'][_0xd589('0x55')]({'where':{'id':_0x1f8a43[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x1ce41f,null))[_0xd589('0x2b')](function(_0x44e5d9){if(_0x44e5d9){return _0x44e5d9[_0xd589('0xb5')](_0x1f8a43[_0xd589('0x3f')][_0xd589('0x84')]);}})['then'](function(_0xbc411d){if(_0xbc411d){return db['CmHopper'][_0xd589('0x37')]({'where':{'ListId':_0x1f8a43[_0xd589('0x3f')][_0xd589('0x84')],'VoiceQueueId':_0x1f8a43[_0xd589('0x61')]['id']}})['then'](function(){return _0xbc411d;});}})['then'](respondWithStatusCode(_0x1ce41f,null))[_0xd589('0x52')](handleError(_0x1ce41f,null));};exports[_0xd589('0xb6')]=function(_0x49cff2,_0x5008d7,_0x337fab){var _0x18c7c9={};var _0x4b5bed={};var _0xc20fff;var _0x4fea97;return db[_0xd589('0x3a')][_0xd589('0x69')]({'where':{'id':_0x49cff2[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x5008d7,null))[_0xd589('0x2b')](function(_0x20677f){if(_0x20677f){_0xc20fff=_0x20677f;_0x4b5bed[_0xd589('0x3d')]=_[_0xd589('0x40')](db[_0xd589('0x9e')][_0xd589('0x3b')]);_0x4b5bed[_0xd589('0x3f')]=_[_0xd589('0x40')](_0x49cff2[_0xd589('0x3f')]);_0x4b5bed[_0xd589('0x41')]=_[_0xd589('0x42')](_0x4b5bed[_0xd589('0x3d')],_0x4b5bed[_0xd589('0x3f')]);_0x18c7c9[_0xd589('0x43')]=_[_0xd589('0x42')](_0x4b5bed[_0xd589('0x3d')],qs[_0xd589('0x44')](_0x49cff2[_0xd589('0x3f')]['fields']));_0x18c7c9[_0xd589('0x43')]=_0x18c7c9['attributes'][_0xd589('0x45')]?_0x18c7c9[_0xd589('0x43')]:_0x4b5bed[_0xd589('0x3d')];_0x18c7c9[_0xd589('0x48')]=qs[_0xd589('0x49')](_0x49cff2[_0xd589('0x3f')][_0xd589('0x49')]);_0x18c7c9[_0xd589('0x4a')]=qs['filters'](_[_0xd589('0x4b')](_0x49cff2[_0xd589('0x3f')],_0x4b5bed[_0xd589('0x41')]));if(_0x49cff2[_0xd589('0x3f')]['filter']){_0x18c7c9['where']=_[_0xd589('0x4c')](_0x18c7c9['where'],{'$or':_[_0xd589('0x3e')](_0x18c7c9[_0xd589('0x43')],function(_0x288372){var _0x255d47={};_0x255d47[_0x288372]={'$like':'%'+_0x49cff2[_0xd589('0x3f')][_0xd589('0x30')]+'%'};return _0x255d47;})});}_0x18c7c9=_[_0xd589('0x4c')]({},_0x18c7c9,_0x49cff2[_0xd589('0x4e')]);return _0xc20fff[_0xd589('0xb6')](_0x18c7c9);}})[_0xd589('0x2b')](function(_0x11d72f){if(_0x11d72f){_0x4fea97=_0x11d72f['length'];if(!_0x49cff2[_0xd589('0x3f')][_0xd589('0x46')](_0xd589('0x47'))){_0x18c7c9[_0xd589('0x23')]=qs['limit'](_0x49cff2[_0xd589('0x3f')][_0xd589('0x23')]);_0x18c7c9[_0xd589('0x21')]=qs[_0xd589('0x21')](_0x49cff2[_0xd589('0x3f')][_0xd589('0x21')]);}return _0xc20fff['getBlackLists'](_0x18c7c9);}})[_0xd589('0x2b')](function(_0x14f759){if(_0x14f759){return _0x14f759?{'count':_0x4fea97,'rows':_0x14f759}:null;}})[_0xd589('0x2b')](respondWithResult(_0x5008d7,null))[_0xd589('0x52')](handleError(_0x5008d7,null));};exports[_0xd589('0xb7')]=function(_0x4957a9,_0x263b41,_0x37b356){var _0x44a633,_0x190e4c;return db[_0xd589('0x3a')]['find']({'where':{'id':_0x4957a9[_0xd589('0x61')]['id']}})['then'](handleEntityNotFound(_0x263b41,null))[_0xd589('0x2b')](function(_0x4e2681){if(_0x4e2681){_0x190e4c=_0x4e2681;return _0x4e2681[_0xd589('0xb7')](_0x4957a9[_0xd589('0x57')][_0xd589('0x84')],_[_0xd589('0x62')](_0x4957a9[_0xd589('0x57')],[_0xd589('0x84'),'id'])||{});}return null;})[_0xd589('0x96')](function(_0x1405a4){var _0x52afeb;_0x44a633=_0x1405a4||[];var _0x52d7df=[];if(_0x1405a4){for(var _0x46039d=0x0;_0x46039d<_0x1405a4['length'];_0x46039d+=0x1){var _0x444e4a=_0x1405a4[_0x46039d]['get']({'plain':!![]});_0x52afeb=squel['insert']()[_0xd589('0xa2')](_0xd589('0xb8'))['fromQuery']([_0xd589('0xa5'),'ContactId',_0xd589('0xa8'),_0xd589('0x66'),_0xd589('0x63'),'updatedAt'],squel[_0xd589('0x85')]()['field'](_0xd589('0xa5'),_0xd589('0xa5'))[_0xd589('0xa9')]('id',_0xd589('0xa7'))[_0xd589('0xa9')](_0x444e4a[_0xd589('0xab')][_0xd589('0xac')](),_0xd589('0xa8'))[_0xd589('0xa9')](_0x4957a9[_0xd589('0x61')]['id'][_0xd589('0xac')](),_0xd589('0x66'))['field'](_0xd589('0xaa'),_0xd589('0x63'))[_0xd589('0xa9')]('NOW()',_0xd589('0x64'))[_0xd589('0x86')](_0xd589('0xad'))['where']('deletedAt\x20IS\x20NULL')[_0xd589('0x4a')](_0xd589('0xaf'),_0x444e4a[_0xd589('0xab')]['toString']())['where'](_0xd589('0xb0')))['toString']();_0x52d7df['push'](db[_0xd589('0x78')]['query'](_0x52afeb));}return BPromise['all'](_0x52d7df);}})[_0xd589('0x2b')](function(){return _0x44a633;})[_0xd589('0x2b')](respondWithResult(_0x263b41,null))[_0xd589('0x52')](handleError(_0x263b41,null));};exports[_0xd589('0xb9')]=function(_0x40c5da,_0x20756c,_0x3abf2b){return db[_0xd589('0x3a')]['find']({'where':{'id':_0x40c5da[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](handleEntityNotFound(_0x20756c,null))['then'](function(_0x4e0c18){if(_0x4e0c18){return _0x4e0c18[_0xd589('0xb9')](_0x40c5da[_0xd589('0x3f')][_0xd589('0x84')]);}})['then'](function(_0x5ad4c0){if(_0x5ad4c0){return db[_0xd589('0x6d')]['destroy']({'where':{'ListId':_0x40c5da[_0xd589('0x3f')][_0xd589('0x84')],'VoiceQueueId':_0x40c5da[_0xd589('0x61')]['id']}})[_0xd589('0x2b')](function(){return _0x5ad4c0;});}})[_0xd589('0x2b')](respondWithStatusCode(_0x20756c,null))[_0xd589('0x52')](handleError(_0x20756c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1647d53..a6f4f0f 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 _0x596b=['update','emit','hasOwnProperty','hook','exports','events','VoiceQueue'];(function(_0x50a569,_0x2aee66){var _0x537c02=function(_0x2e3219){while(--_0x2e3219){_0x50a569['push'](_0x50a569['shift']());}};_0x537c02(++_0x2aee66);}(_0x596b,0x140));var _0xb596=function(_0x3513e2,_0x26f645){_0x3513e2=_0x3513e2-0x0;var _0x186e8f=_0x596b[_0x3513e2];return _0x186e8f;};'use strict';var EventEmitter=require(_0xb596('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xb596('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb596('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2cf4a8){return function(_0x1f1cb1,_0x731709,_0x4b5cec){VoiceQueueEvents[_0xb596('0x3')](_0x2cf4a8+':'+_0x1f1cb1['id'],_0x1f1cb1);VoiceQueueEvents[_0xb596('0x3')](_0x2cf4a8,_0x1f1cb1);_0x4b5cec(null);};}for(var e in events){if(events[_0xb596('0x4')](e)){var event=events[e];VoiceQueue[_0xb596('0x5')](e,emitEvent(event));}}module[_0xb596('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x1bf3=['hook','exports','events','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5bbea7,_0x572ed6){var _0x5334a9=function(_0x4082dc){while(--_0x4082dc){_0x5bbea7['push'](_0x5bbea7['shift']());}};_0x5334a9(++_0x572ed6);}(_0x1bf3,0x124));var _0x31bf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bf3[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x31bf('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x31bf('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x31bf('0x2')](0x0);var events={'afterCreate':_0x31bf('0x3'),'afterUpdate':_0x31bf('0x4'),'afterDestroy':_0x31bf('0x5')};function emitEvent(_0x15438c){return function(_0x30f5bc,_0x24b483,_0x5d0152){VoiceQueueEvents[_0x31bf('0x6')](_0x15438c+':'+_0x30f5bc['id'],_0x30f5bc);VoiceQueueEvents[_0x31bf('0x6')](_0x15438c,_0x30f5bc);_0x5d0152(null);};}for(var e in events){if(events[_0x31bf('0x7')](e)){var event=events[e];VoiceQueue[_0x31bf('0x8')](e,emitEvent(event));}}module[_0x31bf('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index fbb5309..0d41cf9 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x4e52b9,_0x3b39b2){var _0xca4e2a=function(_0x11515d){while(--_0x11515d){_0x4e52b9['push'](_0x4e52b9['shift']());}};_0xca4e2a(++_0x3b39b2);}(_0x70e0,0x17b));var _0x070e=function(_0x26d36e,_0x45f52e){_0x26d36e=_0x26d36e-0x0;var _0x220191=_0x70e0[_0x26d36e];return _0x220191;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x465845,_0x15007c){var _0x314825=function(_0x4f24b8){while(--_0x4f24b8){_0x465845['push'](_0x465845['shift']());}};_0x314825(++_0x15007c);}(_0x70e0,0x17b));var _0x070e=function(_0x52bdc0,_0x581de4){_0x52bdc0=_0x52bdc0-0x0;var _0x3d8a9e=_0x70e0[_0x52bdc0];return _0x3d8a9e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'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 d70ed35..216120e 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 _0xa9f0=['options','raw','where','attributes','limit','map','include','model','stringify','then','ShowVoiceQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','debug','code','error','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll'];(function(_0x580d91,_0x1cff7f){var _0x1c837c=function(_0x3d14e1){while(--_0x3d14e1){_0x580d91['push'](_0x580d91['shift']());}};_0x1c837c(++_0x1cff7f);}(_0xa9f0,0x158));var _0x0a9f=function(_0x361878,_0xb5d7c8){_0x361878=_0x361878-0x0;var _0x371bfb=_0xa9f0[_0x361878];return _0x371bfb;};'use strict';var _=require(_0x0a9f('0x0'));var util=require('util');var moment=require(_0x0a9f('0x1'));var BPromise=require('bluebird');var rs=require(_0x0a9f('0x2'));var fs=require('fs');var Redis=require(_0x0a9f('0x3'));var db=require(_0x0a9f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9f('0x5'))('rpc');var config=require(_0x0a9f('0x6'));var jayson=require(_0x0a9f('0x7'));var client=jayson['client'][_0x0a9f('0x8')]({'port':0x232a});config[_0x0a9f('0x9')]=_['defaults'](config[_0x0a9f('0x9')],{'host':_0x0a9f('0xa'),'port':0x18eb});var socket=require(_0x0a9f('0xb'))(new Redis(config[_0x0a9f('0x9')]));require(_0x0a9f('0xc'))[_0x0a9f('0xd')](socket);function respondWithRpcPromise(_0x2b8ce7,_0x5cb7fb,_0x26acfe){return new BPromise(function(_0x12f0b3,_0x40cfdd){return client[_0x0a9f('0xe')](_0x2b8ce7,_0x26acfe)['then'](function(_0x31abe0){logger['info'](_0x0a9f('0xf'),_0x5cb7fb,'request\x20sent');logger[_0x0a9f('0x10')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5cb7fb,'request\x20sent',JSON['stringify'](_0x31abe0));if(_0x31abe0['error']){if(_0x31abe0['error'][_0x0a9f('0x11')]===0x1f4){logger[_0x0a9f('0x12')](_0x0a9f('0xf'),_0x5cb7fb,_0x31abe0[_0x0a9f('0x12')]['message']);return _0x40cfdd(_0x31abe0[_0x0a9f('0x12')]['message']);}logger['error'](_0x0a9f('0xf'),_0x5cb7fb,_0x31abe0[_0x0a9f('0x12')]['message']);return _0x12f0b3(_0x31abe0[_0x0a9f('0x12')][_0x0a9f('0x13')]);}else{logger[_0x0a9f('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x5cb7fb,'request\x20sent');_0x12f0b3(_0x31abe0[_0x0a9f('0x15')]['message']);}})[_0x0a9f('0x16')](function(_0x2e4b4a){logger[_0x0a9f('0x12')](_0x0a9f('0xf'),_0x5cb7fb,_0x2e4b4a);_0x40cfdd(_0x2e4b4a);});});}exports[_0x0a9f('0x17')]=function(_0x5e5f1d){var _0xff2b2=this;return new Promise(function(_0x3377a6,_0xb653f5){return db[_0x0a9f('0x18')][_0x0a9f('0x19')]({'raw':_0x5e5f1d[_0x0a9f('0x1a')]?_0x5e5f1d[_0x0a9f('0x1a')][_0x0a9f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e5f1d[_0x0a9f('0x1a')]?_0x5e5f1d[_0x0a9f('0x1a')][_0x0a9f('0x1c')]||null:null,'attributes':_0x5e5f1d[_0x0a9f('0x1a')]?_0x5e5f1d[_0x0a9f('0x1a')][_0x0a9f('0x1d')]||null:null,'limit':_0x5e5f1d['options']?_0x5e5f1d[_0x0a9f('0x1a')][_0x0a9f('0x1e')]||null:null,'include':_0x5e5f1d[_0x0a9f('0x1a')]?_0x5e5f1d[_0x0a9f('0x1a')]['include']?_[_0x0a9f('0x1f')](_0x5e5f1d[_0x0a9f('0x1a')][_0x0a9f('0x20')],function(_0x1294c2){return{'model':db[_0x1294c2[_0x0a9f('0x21')]],'as':_0x1294c2['as'],'attributes':_0x1294c2[_0x0a9f('0x1d')],'include':_0x1294c2['include']?_[_0x0a9f('0x1f')](_0x1294c2[_0x0a9f('0x20')],function(_0x55eb01){return{'model':db[_0x55eb01[_0x0a9f('0x21')]],'as':_0x55eb01['as'],'attributes':_0x55eb01['attributes'],'include':_0x55eb01[_0x0a9f('0x20')]?_[_0x0a9f('0x1f')](_0x55eb01[_0x0a9f('0x20')],function(_0x4db2cf){return{'model':db[_0x4db2cf['model']],'as':_0x4db2cf['as'],'attributes':_0x4db2cf[_0x0a9f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36d2b9){logger[_0x0a9f('0x14')]('GetVoiceQueue',_0x5e5f1d);logger['debug'](_0x0a9f('0x17'),_0x5e5f1d,JSON[_0x0a9f('0x22')](_0x36d2b9));_0x3377a6(_0x36d2b9);})[_0x0a9f('0x16')](function(_0x239e12){logger[_0x0a9f('0x12')]('GetVoiceQueue',_0x239e12[_0x0a9f('0x13')],_0x5e5f1d);_0xb653f5(_0xff2b2[_0x0a9f('0x12')](0x1f4,_0x239e12[_0x0a9f('0x13')]));});});};exports['ShowVoiceQueue']=function(_0x237a8e){var _0x2e2f63=this;return new Promise(function(_0x44da1a,_0x1009e9){return db[_0x0a9f('0x18')]['find']({'raw':_0x237a8e[_0x0a9f('0x1a')]?_0x237a8e[_0x0a9f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x237a8e[_0x0a9f('0x1a')]?_0x237a8e[_0x0a9f('0x1a')][_0x0a9f('0x1c')]||null:null,'attributes':_0x237a8e[_0x0a9f('0x1a')]?_0x237a8e[_0x0a9f('0x1a')][_0x0a9f('0x1d')]||null:null,'include':_0x237a8e['options']?_0x237a8e[_0x0a9f('0x1a')][_0x0a9f('0x20')]?_['map'](_0x237a8e['options'][_0x0a9f('0x20')],function(_0x339549){return{'model':db[_0x339549[_0x0a9f('0x21')]],'as':_0x339549['as'],'attributes':_0x339549[_0x0a9f('0x1d')],'include':_0x339549[_0x0a9f('0x20')]?_['map'](_0x339549[_0x0a9f('0x20')],function(_0x55cb4c){return{'model':db[_0x55cb4c[_0x0a9f('0x21')]],'as':_0x55cb4c['as'],'attributes':_0x55cb4c[_0x0a9f('0x1d')],'include':_0x55cb4c[_0x0a9f('0x20')]?_[_0x0a9f('0x1f')](_0x55cb4c[_0x0a9f('0x20')],function(_0x59d464){return{'model':db[_0x59d464[_0x0a9f('0x21')]],'as':_0x59d464['as'],'attributes':_0x59d464[_0x0a9f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0a9f('0x23')](function(_0x47a231){logger['info'](_0x0a9f('0x24'),_0x237a8e);logger['debug'](_0x0a9f('0x24'),_0x237a8e,JSON[_0x0a9f('0x22')](_0x47a231));_0x44da1a(_0x47a231);})[_0x0a9f('0x16')](function(_0x2e128c){logger[_0x0a9f('0x12')]('ShowVoiceQueue',_0x2e128c[_0x0a9f('0x13')],_0x237a8e);_0x1009e9(_0x2e2f63[_0x0a9f('0x12')](0x1f4,_0x2e128c[_0x0a9f('0x13')]));});});}; \ No newline at end of file +var _0x856e=['where','limit','include','model','attributes','map','ShowVoiceQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','debug','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw'];(function(_0x5c0f34,_0x886be2){var _0x576e65=function(_0xb84d31){while(--_0xb84d31){_0x5c0f34['push'](_0x5c0f34['shift']());}};_0x576e65(++_0x886be2);}(_0x856e,0xdf));var _0xe856=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x856e[_0x383356];return _0x32ee5a;};'use strict';var _=require('lodash');var util=require(_0xe856('0x0'));var moment=require(_0xe856('0x1'));var BPromise=require(_0xe856('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe856('0x3'));var db=require(_0xe856('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe856('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe856('0x6'));var client=jayson[_0xe856('0x7')][_0xe856('0x8')]({'port':0x232a});config[_0xe856('0x9')]=_['defaults'](config[_0xe856('0x9')],{'host':_0xe856('0xa'),'port':0x18eb});var socket=require(_0xe856('0xb'))(new Redis(config[_0xe856('0x9')]));require('./voiceQueue.socket')[_0xe856('0xc')](socket);function respondWithRpcPromise(_0x218d52,_0x6f885c,_0x4f4c9a){return new BPromise(function(_0x24b1ea,_0x1f8716){return client['request'](_0x218d52,_0x4f4c9a)[_0xe856('0xd')](function(_0x4caecf){logger[_0xe856('0xe')]('VoiceQueue,\x20%s,\x20%s',_0x6f885c,'request\x20sent');logger[_0xe856('0xf')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x6f885c,_0xe856('0x10'),JSON[_0xe856('0x11')](_0x4caecf));if(_0x4caecf['error']){if(_0x4caecf[_0xe856('0x12')][_0xe856('0x13')]===0x1f4){logger[_0xe856('0x12')](_0xe856('0x14'),_0x6f885c,_0x4caecf[_0xe856('0x12')][_0xe856('0x15')]);return _0x1f8716(_0x4caecf[_0xe856('0x12')][_0xe856('0x15')]);}logger[_0xe856('0x12')](_0xe856('0x14'),_0x6f885c,_0x4caecf['error']['message']);return _0x24b1ea(_0x4caecf['error']['message']);}else{logger[_0xe856('0xe')](_0xe856('0x14'),_0x6f885c,_0xe856('0x10'));_0x24b1ea(_0x4caecf[_0xe856('0x16')][_0xe856('0x15')]);}})[_0xe856('0x17')](function(_0x3f53fd){logger[_0xe856('0x12')](_0xe856('0x14'),_0x6f885c,_0x3f53fd);_0x1f8716(_0x3f53fd);});});}exports[_0xe856('0x18')]=function(_0x39fd89){var _0x1c268d=this;return new Promise(function(_0xe49eb8,_0x2f4824){return db[_0xe856('0x19')][_0xe856('0x1a')]({'raw':_0x39fd89[_0xe856('0x1b')]?_0x39fd89[_0xe856('0x1b')][_0xe856('0x1c')]===undefined?!![]:![]:!![],'where':_0x39fd89[_0xe856('0x1b')]?_0x39fd89[_0xe856('0x1b')][_0xe856('0x1d')]||null:null,'attributes':_0x39fd89[_0xe856('0x1b')]?_0x39fd89['options']['attributes']||null:null,'limit':_0x39fd89['options']?_0x39fd89[_0xe856('0x1b')][_0xe856('0x1e')]||null:null,'include':_0x39fd89[_0xe856('0x1b')]?_0x39fd89[_0xe856('0x1b')][_0xe856('0x1f')]?_['map'](_0x39fd89['options']['include'],function(_0x30321d){return{'model':db[_0x30321d[_0xe856('0x20')]],'as':_0x30321d['as'],'attributes':_0x30321d[_0xe856('0x21')],'include':_0x30321d[_0xe856('0x1f')]?_[_0xe856('0x22')](_0x30321d[_0xe856('0x1f')],function(_0x58e8a0){return{'model':db[_0x58e8a0[_0xe856('0x20')]],'as':_0x58e8a0['as'],'attributes':_0x58e8a0[_0xe856('0x21')],'include':_0x58e8a0['include']?_['map'](_0x58e8a0[_0xe856('0x1f')],function(_0x4bd97c){return{'model':db[_0x4bd97c[_0xe856('0x20')]],'as':_0x4bd97c['as'],'attributes':_0x4bd97c[_0xe856('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x219316){logger[_0xe856('0xe')]('GetVoiceQueue',_0x39fd89);logger[_0xe856('0xf')](_0xe856('0x18'),_0x39fd89,JSON['stringify'](_0x219316));_0xe49eb8(_0x219316);})['catch'](function(_0x3e0a62){logger[_0xe856('0x12')]('GetVoiceQueue',_0x3e0a62['message'],_0x39fd89);_0x2f4824(_0x1c268d[_0xe856('0x12')](0x1f4,_0x3e0a62[_0xe856('0x15')]));});});};exports[_0xe856('0x23')]=function(_0x4035b0){var _0x44bc82=this;return new Promise(function(_0xe17e9b,_0x122011){return db[_0xe856('0x19')]['find']({'raw':_0x4035b0[_0xe856('0x1b')]?_0x4035b0[_0xe856('0x1b')][_0xe856('0x1c')]===undefined?!![]:![]:!![],'where':_0x4035b0['options']?_0x4035b0['options']['where']||null:null,'attributes':_0x4035b0['options']?_0x4035b0['options']['attributes']||null:null,'include':_0x4035b0[_0xe856('0x1b')]?_0x4035b0[_0xe856('0x1b')][_0xe856('0x1f')]?_['map'](_0x4035b0[_0xe856('0x1b')][_0xe856('0x1f')],function(_0x320ea7){return{'model':db[_0x320ea7['model']],'as':_0x320ea7['as'],'attributes':_0x320ea7[_0xe856('0x21')],'include':_0x320ea7['include']?_['map'](_0x320ea7['include'],function(_0x459609){return{'model':db[_0x459609[_0xe856('0x20')]],'as':_0x459609['as'],'attributes':_0x459609[_0xe856('0x21')],'include':_0x459609[_0xe856('0x1f')]?_['map'](_0x459609[_0xe856('0x1f')],function(_0x37c39e){return{'model':db[_0x37c39e['model']],'as':_0x37c39e['as'],'attributes':_0x37c39e[_0xe856('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe856('0xd')](function(_0x43ec78){logger[_0xe856('0xe')](_0xe856('0x23'),_0x4035b0);logger['debug'](_0xe856('0x23'),_0x4035b0,JSON[_0xe856('0x11')](_0x43ec78));_0xe17e9b(_0x43ec78);})['catch'](function(_0x254d2d){logger[_0xe856('0x12')]('ShowVoiceQueue',_0x254d2d[_0xe856('0x15')],_0x4035b0);_0x122011(_0x44bc82[_0xe856('0x12')](0x1f4,_0x254d2d[_0xe856('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 0e0989a..25c07ca 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 _0x10eb=['length','./voiceQueue.events','update','emit'];(function(_0x67f67d,_0x2a0d8a){var _0x2c1653=function(_0x28a2fe){while(--_0x28a2fe){_0x67f67d['push'](_0x67f67d['shift']());}};_0x2c1653(++_0x2a0d8a);}(_0x10eb,0x185));var _0xb10e=function(_0x589512,_0xa16e3e){_0x589512=_0x589512-0x0;var _0x3403ee=_0x10eb[_0x589512];return _0x3403ee;};'use strict';var VoiceQueueEvents=require(_0xb10e('0x0'));var events=['save','remove',_0xb10e('0x1')];function createListener(_0x15b351,_0x3f3adb){return function(_0x4d9dd2){_0x3f3adb[_0xb10e('0x2')](_0x15b351,_0x4d9dd2);};}function removeListener(_0x24957c,_0x55af53){return function(){VoiceQueueEvents['removeListener'](_0x24957c,_0x55af53);};}exports['register']=function(_0x7f15c6){for(var _0x1d0b13=0x0,_0x3c8e52=events[_0xb10e('0x3')];_0x1d0b13<_0x3c8e52;_0x1d0b13++){var _0x102184=events[_0x1d0b13];var _0x30abd4=createListener('voiceQueue:'+_0x102184,_0x7f15c6);VoiceQueueEvents['on'](_0x102184,_0x30abd4);}}; \ No newline at end of file +var _0x68f1=['save','remove','update','emit','removeListener','length','voiceQueue:'];(function(_0x10461e,_0x7eab6c){var _0x4567d7=function(_0x8c65c0){while(--_0x8c65c0){_0x10461e['push'](_0x10461e['shift']());}};_0x4567d7(++_0x7eab6c);}(_0x68f1,0x126));var _0x168f=function(_0x512c6d,_0x5009ff){_0x512c6d=_0x512c6d-0x0;var _0x2ae871=_0x68f1[_0x512c6d];return _0x2ae871;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x168f('0x0'),_0x168f('0x1'),_0x168f('0x2')];function createListener(_0x24cf32,_0xb9e909){return function(_0x18b4f3){_0xb9e909[_0x168f('0x3')](_0x24cf32,_0x18b4f3);};}function removeListener(_0x25c025,_0x5ad2c1){return function(){VoiceQueueEvents[_0x168f('0x4')](_0x25c025,_0x5ad2c1);};}exports['register']=function(_0xd1ac78){for(var _0x502c94=0x0,_0x3ee76f=events[_0x168f('0x5')];_0x502c94<_0x3ee76f;_0x502c94++){var _0x4d702d=events[_0x502c94];var _0x5d48dc=createListener(_0x168f('0x6')+_0x4d702d,_0xd1ac78);VoiceQueueEvents['on'](_0x4d702d,_0x5d48dc);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 03bea69..c6098ba 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 _0xf9a3=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','show','post','put','/:id','update','delete','multer'];(function(_0x471c08,_0xadc31c){var _0x362acd=function(_0xfe7fde){while(--_0xfe7fde){_0x471c08['push'](_0x471c08['shift']());}};_0x362acd(++_0xadc31c);}(_0xf9a3,0xaa));var _0x3f9a=function(_0x430be6,_0x4e424b){_0x430be6=_0x430be6-0x0;var _0x5ac9a2=_0xf9a3[_0x430be6];return _0x5ac9a2;};'use strict';var multer=require(_0x3f9a('0x0'));var util=require(_0x3f9a('0x1'));var path=require(_0x3f9a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f9a('0x3')]();var fs_extra=require(_0x3f9a('0x4'));var auth=require(_0x3f9a('0x5'));var interaction=require(_0x3f9a('0x6'));var config=require(_0x3f9a('0x7'));var controller=require(_0x3f9a('0x8'));router[_0x3f9a('0x9')]('/',auth[_0x3f9a('0xa')](),controller[_0x3f9a('0xb')]);router[_0x3f9a('0x9')]('/describe',auth[_0x3f9a('0xa')](),controller[_0x3f9a('0xc')]);router[_0x3f9a('0x9')]('/index',auth[_0x3f9a('0xa')](),controller['getVoiceQueuesReport']);router[_0x3f9a('0x9')]('/:id',auth[_0x3f9a('0xa')](),controller[_0x3f9a('0xd')]);router[_0x3f9a('0xe')]('/',auth[_0x3f9a('0xa')](),controller['create']);router[_0x3f9a('0xf')](_0x3f9a('0x10'),auth['isAuthenticated'](),controller[_0x3f9a('0x11')]);router[_0x3f9a('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe02a=['/describe','/index','getVoiceQueuesReport','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x2936f5,_0x23a7a3){var _0x5e2920=function(_0x50f904){while(--_0x50f904){_0x2936f5['push'](_0x2936f5['shift']());}};_0x5e2920(++_0x23a7a3);}(_0xe02a,0xb9));var _0xae02=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe02a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xae02('0x0'));var util=require(_0xae02('0x1'));var path=require(_0xae02('0x2'));var timeout=require(_0xae02('0x3'));var express=require(_0xae02('0x4'));var router=express[_0xae02('0x5')]();var fs_extra=require(_0xae02('0x6'));var auth=require(_0xae02('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae02('0x8'));var controller=require(_0xae02('0x9'));router[_0xae02('0xa')]('/',auth[_0xae02('0xb')](),controller[_0xae02('0xc')]);router[_0xae02('0xa')](_0xae02('0xd'),auth[_0xae02('0xb')](),controller['describe']);router[_0xae02('0xa')](_0xae02('0xe'),auth['isAuthenticated'](),controller[_0xae02('0xf')]);router[_0xae02('0xa')](_0xae02('0x10'),auth[_0xae02('0xb')](),controller[_0xae02('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xae02('0x12')]);router['put'](_0xae02('0x10'),auth[_0xae02('0xb')](),controller[_0xae02('0x13')]);router[_0xae02('0x14')]('/:id',auth[_0xae02('0xb')](),controller['destroy']);module[_0xae02('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 6b90fb4..0f0c894 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 _0x5fd5=['queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','format','diff','seconds','setDataValue'];(function(_0x1c74d2,_0x5b1c47){var _0x1187b7=function(_0x5043c7){while(--_0x5043c7){_0x1c74d2['push'](_0x1c74d2['shift']());}};_0x1187b7(++_0x5b1c47);}(_0x5fd5,0xe5));var _0x55fd=function(_0x381ac4,_0x521252){_0x381ac4=_0x381ac4-0x0;var _0x2b11a5=_0x5fd5[_0x381ac4];return _0x2b11a5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x55fd('0x0'));module[_0x55fd('0x1')]={'type':{'type':Sequelize[_0x55fd('0x2')]},'uniqueid':{'type':Sequelize[_0x55fd('0x2')]},'calleridnum':{'type':Sequelize[_0x55fd('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x55fd('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x55fd('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x55fd('0x3')],'set':function(_0xbdabeb){var _0x44388a=moment(_0xbdabeb);var _0x48e1ec=moment(this[_0x55fd('0x4')]('queuecallerjoinAt'))[_0x55fd('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3c4e2d=_0x44388a[_0x55fd('0x6')](_0x48e1ec,_0x55fd('0x7'));this[_0x55fd('0x8')](_0x55fd('0x9'),_0xbdabeb);this[_0x55fd('0x8')]('holdtime',_0x3c4e2d||null);}},'position':{'type':Sequelize[_0x55fd('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x55fd('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x55fd('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x55fd('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x55fd('0x3')]},'queuecallerexit':{'type':Sequelize[_0x55fd('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x55fd('0x2')],'comment':_0x55fd('0xc')},'originalposition':{'type':Sequelize[_0x55fd('0xa')]},'channel':{'type':Sequelize[_0x55fd('0x2')]},'connectedlinenum':{'type':Sequelize[_0x55fd('0x2')]},'connectedlinename':{'type':Sequelize[_0x55fd('0x2')]},'accountcode':{'type':Sequelize[_0x55fd('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x55fd('0x2')]},'holdtime':{'type':Sequelize[_0x55fd('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x55fd('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x55fd('0x2')]},'transfer':{'type':Sequelize[_0x55fd('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x55fd('0x2')],'comment':_0x55fd('0xd')},'transferexten':{'type':Sequelize[_0x55fd('0x2')]},'transferuniqueid':{'type':Sequelize[_0x55fd('0x2')]},'disposition':{'type':Sequelize[_0x55fd('0x2')]},'secondDisposition':{'type':Sequelize[_0x55fd('0x2')]},'thirdDisposition':{'type':Sequelize[_0x55fd('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x55fd('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc715=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','format','seconds','setDataValue','holdtime','INTEGER','BOOLEAN'];(function(_0xff2177,_0x4f3fe8){var _0x1e8711=function(_0x3f8f8b){while(--_0x3f8f8b){_0xff2177['push'](_0xff2177['shift']());}};_0x1e8711(++_0x4f3fe8);}(_0xc715,0x1a6));var _0x5c71=function(_0x3f9d5d,_0x4ee8dd){_0x3f9d5d=_0x3f9d5d-0x0;var _0x1b2cd7=_0xc715[_0x3f9d5d];return _0x1b2cd7;};'use strict';var Sequelize=require(_0x5c71('0x0'));var moment=require(_0x5c71('0x1'));module[_0x5c71('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5c71('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5c71('0x3')]},'queue':{'type':Sequelize[_0x5c71('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x5c71('0x4')],'set':function(_0x2808e6){var _0x45ed7d=moment(_0x2808e6);var _0x4f3b28=moment(this[_0x5c71('0x5')]('queuecallerjoinAt'))[_0x5c71('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x21bae8=_0x45ed7d['diff'](_0x4f3b28,_0x5c71('0x7'));this['setDataValue']('queuecallerleaveAt',_0x2808e6);this[_0x5c71('0x8')](_0x5c71('0x9'),_0x21bae8||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x5c71('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5c71('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5c71('0x4')]},'queuecallerexit':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5c71('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5c71('0x3')],'comment':_0x5c71('0xc')},'originalposition':{'type':Sequelize[_0x5c71('0xa')]},'channel':{'type':Sequelize[_0x5c71('0x3')]},'connectedlinenum':{'type':Sequelize[_0x5c71('0x3')]},'connectedlinename':{'type':Sequelize[_0x5c71('0x3')]},'accountcode':{'type':Sequelize[_0x5c71('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5c71('0x3')]},'holdtime':{'type':Sequelize[_0x5c71('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5c71('0x3')]},'transfer':{'type':Sequelize[_0x5c71('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5c71('0x3')],'comment':_0x5c71('0xd')},'transferexten':{'type':Sequelize[_0x5c71('0x3')]},'transferuniqueid':{'type':Sequelize[_0x5c71('0x3')]},'disposition':{'type':Sequelize[_0x5c71('0x3')]},'secondDisposition':{'type':Sequelize[_0x5c71('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x5c71('0xa')],'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 f605f54..63f1451 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 _0xef0e=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','order','pick','getVoiceQueuesReport','zip-dir','request-promise','moment','mustache','util'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xef0e,0x18b));var _0xeef0=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xef0e[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeef0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeef0('0x1'));var moment=require(_0xeef0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xeef0('0x3'));var util=require(_0xeef0('0x4'));var path=require('path');var sox=require(_0xeef0('0x5'));var csv=require(_0xeef0('0x6'));var ejs=require(_0xeef0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeef0('0x8'));var squel=require(_0xeef0('0x9'));var crypto=require(_0xeef0('0xa'));var jsforce=require(_0xeef0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xeef0('0x6'));var querystring=require(_0xeef0('0xc'));var Papa=require(_0xeef0('0xd'));var Redis=require(_0xeef0('0xe'));var authService=require(_0xeef0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeef0('0x10'));var hardwareService=require(_0xeef0('0x11'));var logger=require(_0xeef0('0x12'))('api');var utils=require(_0xeef0('0x13'));var config=require(_0xeef0('0x14'));var licenseUtil=require(_0xeef0('0x15'));var db=require(_0xeef0('0x16'))['db'];config['redis']=_['defaults'](config[_0xeef0('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xeef0('0x18'))(new Redis(config[_0xeef0('0x17')]));require('./voiceQueueReport.socket')[_0xeef0('0x19')](socket);function respondWithStatusCode(_0x22bb4d,_0x452e50){_0x452e50=_0x452e50||0xcc;return function(_0x53fb9f){if(_0x53fb9f){return _0x22bb4d[_0xeef0('0x1a')](_0x452e50);}return _0x22bb4d[_0xeef0('0x1b')](_0x452e50)[_0xeef0('0x1c')]();};}function respondWithResult(_0x8ea10c,_0x2c3d21){_0x2c3d21=_0x2c3d21||0xc8;return function(_0xb171a0){if(_0xb171a0){return _0x8ea10c[_0xeef0('0x1b')](_0x2c3d21)['json'](_0xb171a0);}};}function respondWithFilteredResult(_0x1a17b2,_0x5e006c){return function(_0x4aac21){if(_0x4aac21){var _0x5b7a40=typeof _0x5e006c[_0xeef0('0x1d')]===_0xeef0('0x1e')&&typeof _0x5e006c[_0xeef0('0x1f')]===_0xeef0('0x1e');var _0x499237=_0x4aac21[_0xeef0('0x20')];var _0x41aca9=_0x5b7a40?0x0:_0x5e006c[_0xeef0('0x1d')];var _0x15d397=_0x5b7a40?_0x4aac21['count']:_0x5e006c['offset']+_0x5e006c[_0xeef0('0x1f')];var _0x1776db;if(_0x15d397>=_0x499237){_0x15d397=_0x499237;_0x1776db=0xc8;}else{_0x1776db=0xce;}_0x1a17b2[_0xeef0('0x1b')](_0x1776db);return _0x1a17b2['set'](_0xeef0('0x21'),_0x41aca9+'-'+_0x15d397+'/'+_0x499237)[_0xeef0('0x22')](_0x4aac21);}return null;};}function patchUpdates(_0x283ec0){return function(_0x10a439){try{jsonpatch[_0xeef0('0x23')](_0x10a439,_0x283ec0,!![]);}catch(_0x1c3d61){return BPromise['reject'](_0x1c3d61);}return _0x10a439[_0xeef0('0x24')]();};}function saveUpdates(_0x39eff7,_0x13a883){return function(_0xf7bdf6){if(_0xf7bdf6){return _0xf7bdf6[_0xeef0('0x25')](_0x39eff7)[_0xeef0('0x26')](function(_0x41d8ef){return _0x41d8ef;});}return null;};}function removeEntity(_0x3424a4,_0x180f36){return function(_0x2fe34b){if(_0x2fe34b){return _0x2fe34b[_0xeef0('0x27')]()['then'](function(){_0x3424a4['status'](0xcc)[_0xeef0('0x1c')]();});}};}function handleEntityNotFound(_0x2a8634,_0x1aeefe){return function(_0x33940e){if(!_0x33940e){_0x2a8634[_0xeef0('0x1a')](0x194);}return _0x33940e;};}function handleError(_0x2b0425,_0x39f414){_0x39f414=_0x39f414||0x1f4;return function(_0x5f4ff4){logger[_0xeef0('0x28')](_0x5f4ff4[_0xeef0('0x29')]);if(_0x5f4ff4[_0xeef0('0x2a')]){delete _0x5f4ff4[_0xeef0('0x2a')];}_0x2b0425[_0xeef0('0x1b')](_0x39f414)[_0xeef0('0x2b')](_0x5f4ff4);};}exports[_0xeef0('0x2c')]=function(_0x31fec0,_0x826cac){var _0x4194b7={},_0x58505c={},_0x37f1bc={'count':0x0,'rows':[]};var _0x58d552=_[_0xeef0('0x2d')](db[_0xeef0('0x2e')]['rawAttributes'],function(_0x5613e6){return{'name':_0x5613e6[_0xeef0('0x2f')],'type':_0x5613e6['type'][_0xeef0('0x30')]};});_0x58505c[_0xeef0('0x31')]=_[_0xeef0('0x2d')](_0x58d552,_0xeef0('0x2a'));_0x58505c[_0xeef0('0x32')]=_[_0xeef0('0x33')](_0x31fec0[_0xeef0('0x32')]);_0x58505c[_0xeef0('0x34')]=_[_0xeef0('0x35')](_0x58505c[_0xeef0('0x31')],_0x58505c[_0xeef0('0x32')]);_0x4194b7['attributes']=_[_0xeef0('0x35')](_0x58505c[_0xeef0('0x31')],qs['fields'](_0x31fec0['query'][_0xeef0('0x36')]));_0x4194b7[_0xeef0('0x37')]=_0x4194b7[_0xeef0('0x37')][_0xeef0('0x38')]?_0x4194b7[_0xeef0('0x37')]:_0x58505c[_0xeef0('0x31')];if(!_0x31fec0[_0xeef0('0x32')][_0xeef0('0x39')](_0xeef0('0x3a'))){_0x4194b7[_0xeef0('0x1f')]=qs[_0xeef0('0x1f')](_0x31fec0['query'][_0xeef0('0x1f')]);_0x4194b7[_0xeef0('0x1d')]=qs[_0xeef0('0x1d')](_0x31fec0[_0xeef0('0x32')][_0xeef0('0x1d')]);}_0x4194b7['order']=qs['sort'](_0x31fec0[_0xeef0('0x32')][_0xeef0('0x3b')]);_0x4194b7[_0xeef0('0x3c')]=qs[_0xeef0('0x34')](_['pick'](_0x31fec0[_0xeef0('0x32')],_0x58505c[_0xeef0('0x34')]),_0x58d552);if(_0x31fec0['query'][_0xeef0('0x3d')]){_0x4194b7[_0xeef0('0x3c')]=_[_0xeef0('0x3e')](_0x4194b7['where'],{'$or':_[_0xeef0('0x2d')](_0x58d552,function(_0x55f89f){if(_0x55f89f['type']!==_0xeef0('0x3f')){var _0x58be8b={};_0x58be8b[_0x55f89f[_0xeef0('0x2a')]]={'$like':'%'+_0x31fec0['query']['filter']+'%'};return _0x58be8b;}})});}_0x4194b7=_[_0xeef0('0x3e')]({},_0x4194b7,_0x31fec0['options']);var _0x2121bf={'where':_0x4194b7[_0xeef0('0x3c')]};return db['VoiceQueueReport'][_0xeef0('0x20')](_0x2121bf)[_0xeef0('0x26')](function(_0x4a0307){_0x37f1bc[_0xeef0('0x20')]=_0x4a0307;if(_0x31fec0[_0xeef0('0x32')][_0xeef0('0x40')]){_0x4194b7['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xeef0('0x41')](_0x4194b7);})[_0xeef0('0x26')](function(_0x53bc20){_0x37f1bc[_0xeef0('0x42')]=_0x53bc20;return _0x37f1bc;})[_0xeef0('0x26')](respondWithFilteredResult(_0x826cac,_0x4194b7))[_0xeef0('0x43')](handleError(_0x826cac,null));};exports[_0xeef0('0x44')]=function(_0x1bf374,_0x551e3c){var _0x33a5d5={'raw':![],'where':{'id':_0x1bf374[_0xeef0('0x45')]['id']}},_0x10eb7d={};_0x10eb7d[_0xeef0('0x31')]=_['keys'](db[_0xeef0('0x2e')][_0xeef0('0x46')]);_0x10eb7d[_0xeef0('0x32')]=_[_0xeef0('0x33')](_0x1bf374[_0xeef0('0x32')]);_0x10eb7d[_0xeef0('0x34')]=_['intersection'](_0x10eb7d[_0xeef0('0x31')],_0x10eb7d[_0xeef0('0x32')]);_0x33a5d5['attributes']=_[_0xeef0('0x35')](_0x10eb7d[_0xeef0('0x31')],qs[_0xeef0('0x36')](_0x1bf374['query'][_0xeef0('0x36')]));_0x33a5d5[_0xeef0('0x37')]=_0x33a5d5[_0xeef0('0x37')][_0xeef0('0x38')]?_0x33a5d5[_0xeef0('0x37')]:_0x10eb7d['model'];if(_0x1bf374[_0xeef0('0x32')][_0xeef0('0x40')]){_0x33a5d5[_0xeef0('0x47')]=[{'all':!![]}];}_0x33a5d5=_[_0xeef0('0x3e')]({},_0x33a5d5,_0x1bf374[_0xeef0('0x48')]);return db['VoiceQueueReport'][_0xeef0('0x49')](_0x33a5d5)[_0xeef0('0x26')](handleEntityNotFound(_0x551e3c,null))[_0xeef0('0x26')](respondWithResult(_0x551e3c,null))[_0xeef0('0x43')](handleError(_0x551e3c,null));};exports[_0xeef0('0x4a')]=function(_0x5c4dc6,_0x2c8a97){return db[_0xeef0('0x2e')][_0xeef0('0x4a')](_0x5c4dc6[_0xeef0('0x4b')],{})[_0xeef0('0x26')](respondWithResult(_0x2c8a97,0xc9))['catch'](handleError(_0x2c8a97,null));};exports[_0xeef0('0x25')]=function(_0x704839,_0xc4c2cd){if(_0x704839[_0xeef0('0x4b')]['id']){delete _0x704839['body']['id'];}return db[_0xeef0('0x2e')][_0xeef0('0x49')]({'where':{'id':_0x704839[_0xeef0('0x45')]['id']}})[_0xeef0('0x26')](handleEntityNotFound(_0xc4c2cd,null))[_0xeef0('0x26')](saveUpdates(_0x704839[_0xeef0('0x4b')],null))['then'](respondWithResult(_0xc4c2cd,null))[_0xeef0('0x43')](handleError(_0xc4c2cd,null));};exports['destroy']=function(_0xe834b4,_0x37f556){return db['VoiceQueueReport'][_0xeef0('0x49')]({'where':{'id':_0xe834b4[_0xeef0('0x45')]['id']}})[_0xeef0('0x26')](handleEntityNotFound(_0x37f556,null))[_0xeef0('0x26')](removeEntity(_0x37f556,null))[_0xeef0('0x43')](handleError(_0x37f556,null));};exports[_0xeef0('0x4c')]=function(_0x29b048,_0x11f642){return db[_0xeef0('0x2e')][_0xeef0('0x4c')]()[_0xeef0('0x26')](respondWithResult(_0x11f642,null))[_0xeef0('0x43')](handleError(_0x11f642,null));};exports['getVoiceQueuesReport']=function(_0x48674e,_0x5dec8c){var _0x19838f={},_0x2e27e3={},_0x179cb1={'count':0x0,'rows':[]};_0x2e27e3['model']=_[_0xeef0('0x33')](db[_0xeef0('0x2e')][_0xeef0('0x46')]);_0x2e27e3[_0xeef0('0x32')]=_[_0xeef0('0x33')](_0x48674e[_0xeef0('0x32')]);_0x2e27e3[_0xeef0('0x34')]=_['intersection'](_0x2e27e3[_0xeef0('0x31')],_0x2e27e3['query']);_0x19838f[_0xeef0('0x37')]=_[_0xeef0('0x35')](_0x2e27e3[_0xeef0('0x31')],qs[_0xeef0('0x36')](_0x48674e['query'][_0xeef0('0x36')]));_0x19838f['attributes']=_0x19838f[_0xeef0('0x37')][_0xeef0('0x38')]?_0x19838f[_0xeef0('0x37')]:_0x2e27e3['model'];if(!_0x48674e[_0xeef0('0x32')]['hasOwnProperty'](_0xeef0('0x3a'))){_0x19838f[_0xeef0('0x1f')]=qs[_0xeef0('0x1f')](_0x48674e[_0xeef0('0x32')][_0xeef0('0x1f')]);_0x19838f[_0xeef0('0x1d')]=qs[_0xeef0('0x1d')](_0x48674e[_0xeef0('0x32')]['offset']);}_0x19838f[_0xeef0('0x4d')]=qs[_0xeef0('0x3b')](_0x48674e[_0xeef0('0x32')]['sort']);_0x19838f[_0xeef0('0x3c')]=qs[_0xeef0('0x34')](_[_0xeef0('0x4e')](_0x48674e[_0xeef0('0x32')],_0x2e27e3['filters']));if(_0x48674e[_0xeef0('0x32')][_0xeef0('0x3d')]){_0x19838f[_0xeef0('0x3c')]=_['merge'](_0x19838f[_0xeef0('0x3c')],{'$or':_[_0xeef0('0x2d')](_0x19838f[_0xeef0('0x37')],function(_0xed392d){var _0x295d4d={};_0x295d4d[_0xed392d]={'$like':'%'+_0x48674e[_0xeef0('0x32')][_0xeef0('0x3d')]+'%'};return _0x295d4d;})});}_0x19838f=_[_0xeef0('0x3e')]({},_0x19838f,_0x48674e[_0xeef0('0x48')]);var _0x6b2e88={'where':_0x19838f[_0xeef0('0x3c')]};return db[_0xeef0('0x2e')][_0xeef0('0x20')](_0x6b2e88)[_0xeef0('0x26')](function(_0x427f56){_0x179cb1[_0xeef0('0x20')]=_0x427f56;if(_0x48674e['query'][_0xeef0('0x40')]){_0x19838f[_0xeef0('0x47')]=[{'all':!![]}];}return db[_0xeef0('0x2e')][_0xeef0('0x41')](_0x19838f);})['then'](function(_0x3d7d78){_0x179cb1['rows']=_0x3d7d78;return _0x179cb1;})[_0xeef0('0x26')](respondWithFilteredResult(_0x5dec8c,_0x19838f,'getVoiceQueuesReport'))[_0xeef0('0x43')](handleError(_0x5dec8c,null,_0xeef0('0x4f')));}; \ No newline at end of file +var _0x1d14=['stack','name','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','getVoiceQueuesReport','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','limit','undefined','count','offset','status','set','apply','reject','save','update','then','error'];(function(_0x10103a,_0x5458d1){var _0x274b47=function(_0x252fa0){while(--_0x252fa0){_0x10103a['push'](_0x10103a['shift']());}};_0x274b47(++_0x5458d1);}(_0x1d14,0xc2));var _0x41d1=function(_0x133532,_0x366962){_0x133532=_0x133532-0x0;var _0x44c8ea=_0x1d14[_0x133532];return _0x44c8ea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x41d1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41d1('0x1'));var moment=require(_0x41d1('0x2'));var BPromise=require(_0x41d1('0x3'));var Mustache=require('mustache');var util=require(_0x41d1('0x4'));var path=require(_0x41d1('0x5'));var sox=require('sox');var csv=require(_0x41d1('0x6'));var ejs=require(_0x41d1('0x7'));var fs=require('fs');var fs_extra=require(_0x41d1('0x8'));var _=require(_0x41d1('0x9'));var squel=require(_0x41d1('0xa'));var crypto=require(_0x41d1('0xb'));var jsforce=require(_0x41d1('0xc'));var deskjs=require(_0x41d1('0xd'));var toCsv=require(_0x41d1('0x6'));var querystring=require(_0x41d1('0xe'));var Papa=require(_0x41d1('0xf'));var Redis=require(_0x41d1('0x10'));var authService=require(_0x41d1('0x11'));var qs=require(_0x41d1('0x12'));var as=require(_0x41d1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x41d1('0x14'));var config=require(_0x41d1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x41d1('0x16'))['db'];config[_0x41d1('0x17')]=_[_0x41d1('0x18')](config[_0x41d1('0x17')],{'host':_0x41d1('0x19'),'port':0x18eb});var socket=require(_0x41d1('0x1a'))(new Redis(config['redis']));require(_0x41d1('0x1b'))[_0x41d1('0x1c')](socket);function respondWithStatusCode(_0x28c9fd,_0x46c49b){_0x46c49b=_0x46c49b||0xcc;return function(_0x237e3a){if(_0x237e3a){return _0x28c9fd[_0x41d1('0x1d')](_0x46c49b);}return _0x28c9fd['status'](_0x46c49b)[_0x41d1('0x1e')]();};}function respondWithResult(_0xd8b5d6,_0x28f7cc){_0x28f7cc=_0x28f7cc||0xc8;return function(_0x5bb8f2){if(_0x5bb8f2){return _0xd8b5d6['status'](_0x28f7cc)['json'](_0x5bb8f2);}};}function respondWithFilteredResult(_0x2a968b,_0x30bbb2){return function(_0x4752ac){if(_0x4752ac){var _0x4e0710=typeof _0x30bbb2['offset']==='undefined'&&typeof _0x30bbb2[_0x41d1('0x1f')]===_0x41d1('0x20');var _0x3c50ae=_0x4752ac[_0x41d1('0x21')];var _0x4a4e24=_0x4e0710?0x0:_0x30bbb2[_0x41d1('0x22')];var _0x3e3ae5=_0x4e0710?_0x4752ac[_0x41d1('0x21')]:_0x30bbb2['offset']+_0x30bbb2['limit'];var _0x4c2cf6;if(_0x3e3ae5>=_0x3c50ae){_0x3e3ae5=_0x3c50ae;_0x4c2cf6=0xc8;}else{_0x4c2cf6=0xce;}_0x2a968b[_0x41d1('0x23')](_0x4c2cf6);return _0x2a968b[_0x41d1('0x24')]('Content-Range',_0x4a4e24+'-'+_0x3e3ae5+'/'+_0x3c50ae)['json'](_0x4752ac);}return null;};}function patchUpdates(_0xf76ad3){return function(_0x25f106){try{jsonpatch[_0x41d1('0x25')](_0x25f106,_0xf76ad3,!![]);}catch(_0x230107){return BPromise[_0x41d1('0x26')](_0x230107);}return _0x25f106[_0x41d1('0x27')]();};}function saveUpdates(_0x52b90f,_0x1cc811){return function(_0x45358e){if(_0x45358e){return _0x45358e[_0x41d1('0x28')](_0x52b90f)[_0x41d1('0x29')](function(_0x3185ad){return _0x3185ad;});}return null;};}function removeEntity(_0x463789,_0x2b1ae8){return function(_0x3668ab){if(_0x3668ab){return _0x3668ab['destroy']()[_0x41d1('0x29')](function(){_0x463789['status'](0xcc)[_0x41d1('0x1e')]();});}};}function handleEntityNotFound(_0x5708cf,_0x3008c8){return function(_0x234da9){if(!_0x234da9){_0x5708cf['sendStatus'](0x194);}return _0x234da9;};}function handleError(_0x30a248,_0x1618b0){_0x1618b0=_0x1618b0||0x1f4;return function(_0x3af50b){logger[_0x41d1('0x2a')](_0x3af50b[_0x41d1('0x2b')]);if(_0x3af50b['name']){delete _0x3af50b[_0x41d1('0x2c')];}_0x30a248[_0x41d1('0x23')](_0x1618b0)['send'](_0x3af50b);};}exports['index']=function(_0x10dabf,_0x3ddeea){var _0x3d6148={},_0x1df319={},_0x1c5e37={'count':0x0,'rows':[]};var _0x45697b=_[_0x41d1('0x2d')](db['VoiceQueueReport'][_0x41d1('0x2e')],function(_0x120d0c){return{'name':_0x120d0c[_0x41d1('0x2f')],'type':_0x120d0c[_0x41d1('0x30')][_0x41d1('0x31')]};});_0x1df319['model']=_[_0x41d1('0x2d')](_0x45697b,'name');_0x1df319[_0x41d1('0x32')]=_[_0x41d1('0x33')](_0x10dabf[_0x41d1('0x32')]);_0x1df319['filters']=_[_0x41d1('0x34')](_0x1df319[_0x41d1('0x35')],_0x1df319['query']);_0x3d6148[_0x41d1('0x36')]=_[_0x41d1('0x34')](_0x1df319[_0x41d1('0x35')],qs[_0x41d1('0x37')](_0x10dabf[_0x41d1('0x32')][_0x41d1('0x37')]));_0x3d6148[_0x41d1('0x36')]=_0x3d6148[_0x41d1('0x36')][_0x41d1('0x38')]?_0x3d6148['attributes']:_0x1df319['model'];if(!_0x10dabf[_0x41d1('0x32')]['hasOwnProperty'](_0x41d1('0x39'))){_0x3d6148[_0x41d1('0x1f')]=qs['limit'](_0x10dabf['query']['limit']);_0x3d6148['offset']=qs[_0x41d1('0x22')](_0x10dabf[_0x41d1('0x32')][_0x41d1('0x22')]);}_0x3d6148[_0x41d1('0x3a')]=qs[_0x41d1('0x3b')](_0x10dabf['query'][_0x41d1('0x3b')]);_0x3d6148[_0x41d1('0x3c')]=qs[_0x41d1('0x3d')](_[_0x41d1('0x3e')](_0x10dabf[_0x41d1('0x32')],_0x1df319['filters']),_0x45697b);if(_0x10dabf[_0x41d1('0x32')][_0x41d1('0x3f')]){_0x3d6148['where']=_['merge'](_0x3d6148[_0x41d1('0x3c')],{'$or':_[_0x41d1('0x2d')](_0x45697b,function(_0x3fab7b){if(_0x3fab7b[_0x41d1('0x30')]!=='VIRTUAL'){var _0x3d3aec={};_0x3d3aec[_0x3fab7b[_0x41d1('0x2c')]]={'$like':'%'+_0x10dabf[_0x41d1('0x32')][_0x41d1('0x3f')]+'%'};return _0x3d3aec;}})});}_0x3d6148=_[_0x41d1('0x40')]({},_0x3d6148,_0x10dabf[_0x41d1('0x41')]);var _0x409b3b={'where':_0x3d6148[_0x41d1('0x3c')]};return db[_0x41d1('0x42')]['count'](_0x409b3b)['then'](function(_0x327548){_0x1c5e37[_0x41d1('0x21')]=_0x327548;if(_0x10dabf[_0x41d1('0x32')][_0x41d1('0x43')]){_0x3d6148[_0x41d1('0x44')]=[{'all':!![]}];}return db[_0x41d1('0x42')][_0x41d1('0x45')](_0x3d6148);})[_0x41d1('0x29')](function(_0x19adfc){_0x1c5e37[_0x41d1('0x46')]=_0x19adfc;return _0x1c5e37;})[_0x41d1('0x29')](respondWithFilteredResult(_0x3ddeea,_0x3d6148))[_0x41d1('0x47')](handleError(_0x3ddeea,null));};exports['show']=function(_0x5cef84,_0x415fd1){var _0x2f0456={'raw':![],'where':{'id':_0x5cef84[_0x41d1('0x48')]['id']}},_0x23c447={};_0x23c447['model']=_[_0x41d1('0x33')](db[_0x41d1('0x42')][_0x41d1('0x2e')]);_0x23c447[_0x41d1('0x32')]=_[_0x41d1('0x33')](_0x5cef84[_0x41d1('0x32')]);_0x23c447[_0x41d1('0x3d')]=_[_0x41d1('0x34')](_0x23c447[_0x41d1('0x35')],_0x23c447['query']);_0x2f0456[_0x41d1('0x36')]=_[_0x41d1('0x34')](_0x23c447[_0x41d1('0x35')],qs[_0x41d1('0x37')](_0x5cef84[_0x41d1('0x32')]['fields']));_0x2f0456[_0x41d1('0x36')]=_0x2f0456[_0x41d1('0x36')][_0x41d1('0x38')]?_0x2f0456[_0x41d1('0x36')]:_0x23c447[_0x41d1('0x35')];if(_0x5cef84[_0x41d1('0x32')]['includeAll']){_0x2f0456[_0x41d1('0x44')]=[{'all':!![]}];}_0x2f0456=_[_0x41d1('0x40')]({},_0x2f0456,_0x5cef84[_0x41d1('0x41')]);return db['VoiceQueueReport'][_0x41d1('0x49')](_0x2f0456)['then'](handleEntityNotFound(_0x415fd1,null))['then'](respondWithResult(_0x415fd1,null))[_0x41d1('0x47')](handleError(_0x415fd1,null));};exports['create']=function(_0x38e042,_0x3a096d){return db[_0x41d1('0x42')][_0x41d1('0x4a')](_0x38e042[_0x41d1('0x4b')],{})[_0x41d1('0x29')](respondWithResult(_0x3a096d,0xc9))[_0x41d1('0x47')](handleError(_0x3a096d,null));};exports[_0x41d1('0x28')]=function(_0x336cf2,_0x38bea6){if(_0x336cf2['body']['id']){delete _0x336cf2[_0x41d1('0x4b')]['id'];}return db[_0x41d1('0x42')][_0x41d1('0x49')]({'where':{'id':_0x336cf2[_0x41d1('0x48')]['id']}})[_0x41d1('0x29')](handleEntityNotFound(_0x38bea6,null))[_0x41d1('0x29')](saveUpdates(_0x336cf2['body'],null))[_0x41d1('0x29')](respondWithResult(_0x38bea6,null))[_0x41d1('0x47')](handleError(_0x38bea6,null));};exports[_0x41d1('0x4c')]=function(_0x1f1a85,_0x1955a1){return db[_0x41d1('0x42')][_0x41d1('0x49')]({'where':{'id':_0x1f1a85[_0x41d1('0x48')]['id']}})[_0x41d1('0x29')](handleEntityNotFound(_0x1955a1,null))[_0x41d1('0x29')](removeEntity(_0x1955a1,null))[_0x41d1('0x47')](handleError(_0x1955a1,null));};exports[_0x41d1('0x4d')]=function(_0x4b9355,_0x57830c){return db[_0x41d1('0x42')][_0x41d1('0x4d')]()[_0x41d1('0x29')](respondWithResult(_0x57830c,null))['catch'](handleError(_0x57830c,null));};exports[_0x41d1('0x4e')]=function(_0x4be387,_0x53bf81){var _0x38a9bc={},_0x486037={},_0x3a16ee={'count':0x0,'rows':[]};_0x486037[_0x41d1('0x35')]=_[_0x41d1('0x33')](db[_0x41d1('0x42')]['rawAttributes']);_0x486037[_0x41d1('0x32')]=_[_0x41d1('0x33')](_0x4be387[_0x41d1('0x32')]);_0x486037[_0x41d1('0x3d')]=_[_0x41d1('0x34')](_0x486037[_0x41d1('0x35')],_0x486037[_0x41d1('0x32')]);_0x38a9bc[_0x41d1('0x36')]=_[_0x41d1('0x34')](_0x486037[_0x41d1('0x35')],qs[_0x41d1('0x37')](_0x4be387[_0x41d1('0x32')][_0x41d1('0x37')]));_0x38a9bc[_0x41d1('0x36')]=_0x38a9bc['attributes']['length']?_0x38a9bc[_0x41d1('0x36')]:_0x486037[_0x41d1('0x35')];if(!_0x4be387[_0x41d1('0x32')]['hasOwnProperty'](_0x41d1('0x39'))){_0x38a9bc['limit']=qs[_0x41d1('0x1f')](_0x4be387[_0x41d1('0x32')][_0x41d1('0x1f')]);_0x38a9bc[_0x41d1('0x22')]=qs[_0x41d1('0x22')](_0x4be387['query'][_0x41d1('0x22')]);}_0x38a9bc[_0x41d1('0x3a')]=qs[_0x41d1('0x3b')](_0x4be387[_0x41d1('0x32')][_0x41d1('0x3b')]);_0x38a9bc['where']=qs['filters'](_[_0x41d1('0x3e')](_0x4be387[_0x41d1('0x32')],_0x486037['filters']));if(_0x4be387['query'][_0x41d1('0x3f')]){_0x38a9bc[_0x41d1('0x3c')]=_[_0x41d1('0x40')](_0x38a9bc[_0x41d1('0x3c')],{'$or':_['map'](_0x38a9bc[_0x41d1('0x36')],function(_0x1ad7f4){var _0x41b5cd={};_0x41b5cd[_0x1ad7f4]={'$like':'%'+_0x4be387[_0x41d1('0x32')]['filter']+'%'};return _0x41b5cd;})});}_0x38a9bc=_['merge']({},_0x38a9bc,_0x4be387[_0x41d1('0x41')]);var _0x47a2a1={'where':_0x38a9bc[_0x41d1('0x3c')]};return db[_0x41d1('0x42')][_0x41d1('0x21')](_0x47a2a1)['then'](function(_0x2d4493){_0x3a16ee[_0x41d1('0x21')]=_0x2d4493;if(_0x4be387[_0x41d1('0x32')][_0x41d1('0x43')]){_0x38a9bc['include']=[{'all':!![]}];}return db[_0x41d1('0x42')]['findAll'](_0x38a9bc);})[_0x41d1('0x29')](function(_0x194af5){_0x3a16ee[_0x41d1('0x46')]=_0x194af5;return _0x3a16ee;})[_0x41d1('0x29')](respondWithFilteredResult(_0x53bf81,_0x38a9bc,'getVoiceQueuesReport'))['catch'](handleError(_0x53bf81,null,_0x41d1('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 683d2a2..eb1474f 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 _0x734d=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x2adf81,_0x451f3a){var _0x31a21a=function(_0x585ab5){while(--_0x585ab5){_0x2adf81['push'](_0x2adf81['shift']());}};_0x31a21a(++_0x451f3a);}(_0x734d,0x14a));var _0xd734=function(_0x574ac1,_0x1f6ace){_0x574ac1=_0x574ac1-0x0;var _0x2805b5=_0x734d[_0x574ac1];return _0x2805b5;};'use strict';var EventEmitter=require(_0xd734('0x0'));var VoiceQueueReport=require(_0xd734('0x1'))['db'][_0xd734('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd734('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd734('0x4'),'afterDestroy':_0xd734('0x5')};function emitEvent(_0x2e5df7){return function(_0x398fe4,_0x189caa,_0x5548fd){VoiceQueueReportEvents[_0xd734('0x6')](_0x2e5df7+':'+_0x398fe4['id'],_0x398fe4);VoiceQueueReportEvents[_0xd734('0x6')](_0x2e5df7,_0x398fe4);_0x5548fd(null);};}for(var e in events){if(events[_0xd734('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xd734('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xcad2=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xcad2,0xfe));var _0x2cad=function(_0x2040d4,_0x39fb5a){_0x2040d4=_0x2040d4-0x0;var _0x2a1c0c=_0xcad2[_0x2040d4];return _0x2a1c0c;};'use strict';var EventEmitter=require(_0x2cad('0x0'));var VoiceQueueReport=require(_0x2cad('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2cad('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2cad('0x3'),'afterDestroy':_0x2cad('0x4')};function emitEvent(_0x465252){return function(_0x2e8978,_0x5a70ca,_0x3be963){VoiceQueueReportEvents['emit'](_0x465252+':'+_0x2e8978['id'],_0x2e8978);VoiceQueueReportEvents['emit'](_0x465252,_0x2e8978);_0x3be963(null);};}for(var e in events){if(events[_0x2cad('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x2cad('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 2f4a5dd..f79b62c 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 _0x69bc=['moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','util','../../config/logger','api'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x69bc,0xb3));var _0xc69b=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x69bc[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0xc69b('0x0'));var logger=require(_0xc69b('0x1'))(_0xc69b('0x2'));var moment=require(_0xc69b('0x3'));var BPromise=require(_0xc69b('0x4'));var rp=require(_0xc69b('0x5'));var fs=require('fs');var path=require(_0xc69b('0x6'));var rimraf=require(_0xc69b('0x7'));var config=require('../../config/environment');var attributes=require(_0xc69b('0x8'));module['exports']=function(_0x25751e,_0x3d1882){return _0x25751e[_0xc69b('0x9')](_0xc69b('0xa'),attributes,{'tableName':_0xc69b('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc69b('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5582=['report_queue','calleridnum','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x187dbd,_0x2ecf58){var _0x45d1e9=function(_0x2364c0){while(--_0x2364c0){_0x187dbd['push'](_0x187dbd['shift']());}};_0x45d1e9(++_0x2ecf58);}(_0x5582,0x136));var _0x2558=function(_0xe532f2,_0x18dffb){_0xe532f2=_0xe532f2-0x0;var _0xdd0cc5=_0x5582[_0xe532f2];return _0xdd0cc5;};'use strict';var _=require(_0x2558('0x0'));var util=require(_0x2558('0x1'));var logger=require('../../config/logger')(_0x2558('0x2'));var moment=require(_0x2558('0x3'));var BPromise=require(_0x2558('0x4'));var rp=require(_0x2558('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2558('0x6'));var config=require(_0x2558('0x7'));var attributes=require(_0x2558('0x8'));module[_0x2558('0x9')]=function(_0x75f269,_0x520276){return _0x75f269[_0x2558('0xa')](_0x2558('0xb'),attributes,{'tableName':_0x2558('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x2558('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 771660a..3533446 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 _0x01b4=['debug','CreateVoiceQueueReport','body','raw','info','catch','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','limit','include','map','model','attributes'];(function(_0x456b77,_0x4fed12){var _0x118bb6=function(_0x2ea238){while(--_0x2ea238){_0x456b77['push'](_0x456b77['shift']());}};_0x118bb6(++_0x4fed12);}(_0x01b4,0x1c0));var _0x401b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x401b('0x0'));var util=require(_0x401b('0x1'));var moment=require(_0x401b('0x2'));var BPromise=require(_0x401b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x401b('0x4'));var db=require(_0x401b('0x5'))['db'];var utils=require(_0x401b('0x6'));var logger=require('../../config/logger')(_0x401b('0x7'));var config=require(_0x401b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x401b('0x9')][_0x401b('0xa')]({'port':0x232a});config['redis']=_[_0x401b('0xb')](config['redis'],{'host':_0x401b('0xc'),'port':0x18eb});var socket=require(_0x401b('0xd'))(new Redis(config[_0x401b('0xe')]));require(_0x401b('0xf'))[_0x401b('0x10')](socket);function respondWithRpcPromise(_0x49eff1,_0x342d8d,_0x2d7b2b){return new BPromise(function(_0x4a5f52,_0x4312c1){return client[_0x401b('0x11')](_0x49eff1,_0x2d7b2b)[_0x401b('0x12')](function(_0x3b7828){logger['info'](_0x401b('0x13'),_0x342d8d,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x342d8d,_0x401b('0x14'),JSON[_0x401b('0x15')](_0x3b7828));if(_0x3b7828[_0x401b('0x16')]){if(_0x3b7828[_0x401b('0x16')][_0x401b('0x17')]===0x1f4){logger[_0x401b('0x16')](_0x401b('0x13'),_0x342d8d,_0x3b7828['error'][_0x401b('0x18')]);return _0x4312c1(_0x3b7828[_0x401b('0x16')][_0x401b('0x18')]);}logger['error'](_0x401b('0x13'),_0x342d8d,_0x3b7828[_0x401b('0x16')][_0x401b('0x18')]);return _0x4a5f52(_0x3b7828['error'][_0x401b('0x18')]);}else{logger['info'](_0x401b('0x13'),_0x342d8d,_0x401b('0x14'));_0x4a5f52(_0x3b7828[_0x401b('0x19')][_0x401b('0x18')]);}})['catch'](function(_0x5c060f){logger['error'](_0x401b('0x13'),_0x342d8d,_0x5c060f);_0x4312c1(_0x5c060f);});});}exports[_0x401b('0x1a')]=function(_0x5e20ae){var _0x2454b9=this;return new Promise(function(_0x48a6ff,_0x36831d){return db[_0x401b('0x1b')][_0x401b('0x1c')]({'raw':_0x5e20ae[_0x401b('0x1d')]?_0x5e20ae[_0x401b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5e20ae[_0x401b('0x1d')]?_0x5e20ae[_0x401b('0x1d')][_0x401b('0x1e')]||null:null,'attributes':_0x5e20ae[_0x401b('0x1d')]?_0x5e20ae[_0x401b('0x1d')]['attributes']||null:null,'limit':_0x5e20ae[_0x401b('0x1d')]?_0x5e20ae['options'][_0x401b('0x1f')]||null:null,'include':_0x5e20ae['options']?_0x5e20ae[_0x401b('0x1d')][_0x401b('0x20')]?_[_0x401b('0x21')](_0x5e20ae[_0x401b('0x1d')][_0x401b('0x20')],function(_0x3a2591){return{'model':db[_0x3a2591[_0x401b('0x22')]],'as':_0x3a2591['as'],'attributes':_0x3a2591[_0x401b('0x23')],'include':_0x3a2591[_0x401b('0x20')]?_[_0x401b('0x21')](_0x3a2591[_0x401b('0x20')],function(_0x2e45db){return{'model':db[_0x2e45db['model']],'as':_0x2e45db['as'],'attributes':_0x2e45db['attributes'],'include':_0x2e45db['include']?_[_0x401b('0x21')](_0x2e45db[_0x401b('0x20')],function(_0x26110d){return{'model':db[_0x26110d[_0x401b('0x22')]],'as':_0x26110d['as'],'attributes':_0x26110d[_0x401b('0x23')]};}):[]};}):[]};}):[]:[]})[_0x401b('0x12')](function(_0x5b8d39){logger['info'](_0x401b('0x1a'),_0x5e20ae);logger[_0x401b('0x24')](_0x401b('0x1a'),_0x5e20ae,JSON[_0x401b('0x15')](_0x5b8d39));_0x48a6ff(_0x5b8d39);})['catch'](function(_0x3e2701){logger[_0x401b('0x16')]('GetVoiceQueueReport',_0x3e2701[_0x401b('0x18')],_0x5e20ae);_0x36831d(_0x2454b9['error'](0x1f4,_0x3e2701[_0x401b('0x18')]));});});};exports[_0x401b('0x25')]=function(_0x42b6b4){var _0x42485c=this;return new Promise(function(_0x54f9e8,_0x572da4){return db['VoiceQueueReport']['create'](_0x42b6b4[_0x401b('0x26')],{'raw':_0x42b6b4['options']?_0x42b6b4[_0x401b('0x1d')][_0x401b('0x27')]===undefined?!![]:![]:!![]})[_0x401b('0x12')](function(_0x26ef1a){logger[_0x401b('0x28')]('CreateVoiceQueueReport',_0x42b6b4);logger['debug'](_0x401b('0x25'),_0x42b6b4,JSON[_0x401b('0x15')](_0x26ef1a));_0x54f9e8(_0x26ef1a);})[_0x401b('0x29')](function(_0x21bad3){logger[_0x401b('0x16')](_0x401b('0x25'),_0x21bad3[_0x401b('0x18')],_0x42b6b4);_0x572da4(_0x42485c[_0x401b('0x16')](0x1f4,_0x21bad3[_0x401b('0x18')]));});});};exports[_0x401b('0x2a')]=function(_0x210e45){var _0x3bbe46=this;return new Promise(function(_0x126b85,_0x7f43c6){return db[_0x401b('0x1b')][_0x401b('0x2b')](_0x210e45['body'],{'raw':_0x210e45['options']?_0x210e45[_0x401b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x210e45['options']?_0x210e45[_0x401b('0x1d')][_0x401b('0x1e')]||null:null,'attributes':_0x210e45['options']?_0x210e45['options'][_0x401b('0x23')]||null:null,'limit':_0x210e45['options']?_0x210e45[_0x401b('0x1d')]['limit']||null:null})[_0x401b('0x12')](function(_0x45c9e){logger[_0x401b('0x28')](_0x401b('0x2a'),_0x210e45);logger[_0x401b('0x24')]('UpdateVoiceQueueReport',_0x210e45,JSON[_0x401b('0x15')](_0x45c9e));_0x126b85(_0x45c9e);})['catch'](function(_0xc209de){logger[_0x401b('0x16')](_0x401b('0x2a'),_0xc209de[_0x401b('0x18')],_0x210e45);_0x7f43c6(_0x3bbe46[_0x401b('0x16')](0x1f4,_0xc209de[_0x401b('0x18')]));});});}; \ No newline at end of file +var _0x981e=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','VoiceQueueReport','body'];(function(_0x15913f,_0x1bfd7d){var _0x59d888=function(_0x670a2d){while(--_0x670a2d){_0x15913f['push'](_0x15913f['shift']());}};_0x59d888(++_0x1bfd7d);}(_0x981e,0x1b8));var _0xe981=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x981e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe981('0x0'));var util=require(_0xe981('0x1'));var moment=require(_0xe981('0x2'));var BPromise=require('bluebird');var rs=require(_0xe981('0x3'));var fs=require('fs');var Redis=require(_0xe981('0x4'));var db=require(_0xe981('0x5'))['db'];var utils=require(_0xe981('0x6'));var logger=require('../../config/logger')(_0xe981('0x7'));var config=require(_0xe981('0x8'));var jayson=require(_0xe981('0x9'));var client=jayson[_0xe981('0xa')]['http']({'port':0x232a});config[_0xe981('0xb')]=_[_0xe981('0xc')](config[_0xe981('0xb')],{'host':_0xe981('0xd'),'port':0x18eb});var socket=require(_0xe981('0xe'))(new Redis(config['redis']));require(_0xe981('0xf'))[_0xe981('0x10')](socket);function respondWithRpcPromise(_0x372627,_0x3174d4,_0x1b8f66){return new BPromise(function(_0x52ccf6,_0x9b2c37){return client[_0xe981('0x11')](_0x372627,_0x1b8f66)[_0xe981('0x12')](function(_0x267672){logger['info'](_0xe981('0x13'),_0x3174d4,'request\x20sent');logger[_0xe981('0x14')](_0xe981('0x15'),_0x3174d4,'request\x20sent',JSON[_0xe981('0x16')](_0x267672));if(_0x267672[_0xe981('0x17')]){if(_0x267672[_0xe981('0x17')]['code']===0x1f4){logger[_0xe981('0x17')](_0xe981('0x13'),_0x3174d4,_0x267672[_0xe981('0x17')][_0xe981('0x18')]);return _0x9b2c37(_0x267672['error'][_0xe981('0x18')]);}logger['error'](_0xe981('0x13'),_0x3174d4,_0x267672[_0xe981('0x17')]['message']);return _0x52ccf6(_0x267672[_0xe981('0x17')][_0xe981('0x18')]);}else{logger[_0xe981('0x19')](_0xe981('0x13'),_0x3174d4,_0xe981('0x1a'));_0x52ccf6(_0x267672[_0xe981('0x1b')]['message']);}})[_0xe981('0x1c')](function(_0x13f810){logger['error'](_0xe981('0x13'),_0x3174d4,_0x13f810);_0x9b2c37(_0x13f810);});});}exports[_0xe981('0x1d')]=function(_0x34b579){var _0x2cd6b5=this;return new Promise(function(_0x1d2671,_0x3e77df){return db['VoiceQueueReport'][_0xe981('0x1e')]({'raw':_0x34b579['options']?_0x34b579[_0xe981('0x1f')][_0xe981('0x20')]===undefined?!![]:![]:!![],'where':_0x34b579[_0xe981('0x1f')]?_0x34b579[_0xe981('0x1f')][_0xe981('0x21')]||null:null,'attributes':_0x34b579[_0xe981('0x1f')]?_0x34b579[_0xe981('0x1f')][_0xe981('0x22')]||null:null,'limit':_0x34b579[_0xe981('0x1f')]?_0x34b579[_0xe981('0x1f')][_0xe981('0x23')]||null:null,'include':_0x34b579[_0xe981('0x1f')]?_0x34b579[_0xe981('0x1f')][_0xe981('0x24')]?_[_0xe981('0x25')](_0x34b579[_0xe981('0x1f')][_0xe981('0x24')],function(_0x550fe1){return{'model':db[_0x550fe1[_0xe981('0x26')]],'as':_0x550fe1['as'],'attributes':_0x550fe1[_0xe981('0x22')],'include':_0x550fe1['include']?_[_0xe981('0x25')](_0x550fe1[_0xe981('0x24')],function(_0x42b06e){return{'model':db[_0x42b06e[_0xe981('0x26')]],'as':_0x42b06e['as'],'attributes':_0x42b06e[_0xe981('0x22')],'include':_0x42b06e['include']?_[_0xe981('0x25')](_0x42b06e[_0xe981('0x24')],function(_0x210eb7){return{'model':db[_0x210eb7[_0xe981('0x26')]],'as':_0x210eb7['as'],'attributes':_0x210eb7[_0xe981('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcfb1e7){logger[_0xe981('0x19')](_0xe981('0x1d'),_0x34b579);logger[_0xe981('0x14')](_0xe981('0x1d'),_0x34b579,JSON[_0xe981('0x16')](_0xcfb1e7));_0x1d2671(_0xcfb1e7);})['catch'](function(_0x1e224d){logger[_0xe981('0x17')](_0xe981('0x1d'),_0x1e224d[_0xe981('0x18')],_0x34b579);_0x3e77df(_0x2cd6b5[_0xe981('0x17')](0x1f4,_0x1e224d[_0xe981('0x18')]));});});};exports[_0xe981('0x27')]=function(_0x178bdc){var _0x118151=this;return new Promise(function(_0x30a294,_0x79a809){return db['VoiceQueueReport'][_0xe981('0x28')](_0x178bdc['body'],{'raw':_0x178bdc[_0xe981('0x1f')]?_0x178bdc[_0xe981('0x1f')][_0xe981('0x20')]===undefined?!![]:![]:!![]})[_0xe981('0x12')](function(_0x479f84){logger[_0xe981('0x19')](_0xe981('0x27'),_0x178bdc);logger['debug'](_0xe981('0x27'),_0x178bdc,JSON[_0xe981('0x16')](_0x479f84));_0x30a294(_0x479f84);})[_0xe981('0x1c')](function(_0x5e423f){logger[_0xe981('0x17')](_0xe981('0x27'),_0x5e423f['message'],_0x178bdc);_0x79a809(_0x118151[_0xe981('0x17')](0x1f4,_0x5e423f[_0xe981('0x18')]));});});};exports[_0xe981('0x29')]=function(_0x28d15a){var _0x35bd62=this;return new Promise(function(_0x4365ca,_0x288a7a){return db[_0xe981('0x2a')]['update'](_0x28d15a[_0xe981('0x2b')],{'raw':_0x28d15a[_0xe981('0x1f')]?_0x28d15a[_0xe981('0x1f')][_0xe981('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28d15a[_0xe981('0x1f')]?_0x28d15a['options']['where']||null:null,'attributes':_0x28d15a[_0xe981('0x1f')]?_0x28d15a['options']['attributes']||null:null,'limit':_0x28d15a[_0xe981('0x1f')]?_0x28d15a['options']['limit']||null:null})['then'](function(_0x3106f8){logger[_0xe981('0x19')](_0xe981('0x29'),_0x28d15a);logger[_0xe981('0x14')](_0xe981('0x29'),_0x28d15a,JSON[_0xe981('0x16')](_0x3106f8));_0x4365ca(_0x3106f8);})[_0xe981('0x1c')](function(_0xe4ca17){logger[_0xe981('0x17')]('UpdateVoiceQueueReport',_0xe4ca17[_0xe981('0x18')],_0x28d15a);_0x288a7a(_0x35bd62[_0xe981('0x17')](0x1f4,_0xe4ca17[_0xe981('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 12a8179..ca8be15 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 _0xfbaf=['./voiceQueueReport.events','save','update','removeListener','register','length','voiceQueueReport:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbaf,0xcb));var _0xffba=function(_0x3d0b52,_0xcf3e5e){_0x3d0b52=_0x3d0b52-0x0;var _0x342aa8=_0xfbaf[_0x3d0b52];return _0x342aa8;};'use strict';var VoiceQueueReportEvents=require(_0xffba('0x0'));var events=[_0xffba('0x1'),'remove',_0xffba('0x2')];function createListener(_0x252f10,_0x5c4032){return function(_0xedf28a){_0x5c4032['emit'](_0x252f10,_0xedf28a);};}function removeListener(_0xa7fdd1,_0x35270e){return function(){VoiceQueueReportEvents[_0xffba('0x3')](_0xa7fdd1,_0x35270e);};}exports[_0xffba('0x4')]=function(_0x11d8fc){for(var _0x3f2801=0x0,_0xd49577=events[_0xffba('0x5')];_0x3f2801<_0xd49577;_0x3f2801++){var _0x2377bf=events[_0x3f2801];var _0x1d7839=createListener(_0xffba('0x6')+_0x2377bf,_0x11d8fc);VoiceQueueReportEvents['on'](_0x2377bf,_0x1d7839);}}; \ No newline at end of file +var _0x142c=['removeListener','length','./voiceQueueReport.events','remove','update','emit'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x142c,0x86));var _0xc142=function(_0x2f69cf,_0x4bce8d){_0x2f69cf=_0x2f69cf-0x0;var _0x5f472a=_0x142c[_0x2f69cf];return _0x5f472a;};'use strict';var VoiceQueueReportEvents=require(_0xc142('0x0'));var events=['save',_0xc142('0x1'),_0xc142('0x2')];function createListener(_0x10367,_0x4e9d02){return function(_0x30e881){_0x4e9d02[_0xc142('0x3')](_0x10367,_0x30e881);};}function removeListener(_0x4fa56e,_0x47e43a){return function(){VoiceQueueReportEvents[_0xc142('0x4')](_0x4fa56e,_0x47e43a);};}exports['register']=function(_0x4033e9){for(var _0x53b32f=0x0,_0x2d6796=events[_0xc142('0x5')];_0x53b32f<_0x2d6796;_0x53b32f++){var _0x30bf01=events[_0x53b32f];var _0x4ba28e=createListener('voiceQueueReport:'+_0x30bf01,_0x4033e9);VoiceQueueReportEvents['on'](_0x30bf01,_0x4ba28e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 49c64ce..b129415 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 _0x78cc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','create','put','update','delete','isAuthenticated','exports','multer','path','connect-timeout','express','Router'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x78cc,0x11c));var _0xc78c=function(_0x3cec9d,_0x165efb){_0x3cec9d=_0x3cec9d-0x0;var _0xe4433c=_0x78cc[_0x3cec9d];return _0xe4433c;};'use strict';var multer=require(_0xc78c('0x0'));var util=require('util');var path=require(_0xc78c('0x1'));var timeout=require(_0xc78c('0x2'));var express=require(_0xc78c('0x3'));var router=express[_0xc78c('0x4')]();var fs_extra=require(_0xc78c('0x5'));var auth=require(_0xc78c('0x6'));var interaction=require(_0xc78c('0x7'));var config=require(_0xc78c('0x8'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc78c('0x9')]);router['get'](_0xc78c('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc78c('0xb')]);router[_0xc78c('0xc')](_0xc78c('0xa'),auth['isAuthenticated'](),controller[_0xc78c('0xd')]);router[_0xc78c('0xe')](_0xc78c('0xa'),auth[_0xc78c('0xf')](),controller['destroy']);module[_0xc78c('0x10')]=router; \ No newline at end of file +var _0x1e88=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','multer'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x1e88,0x1d3));var _0x81e8=function(_0x22f88c,_0x5b4524){_0x22f88c=_0x22f88c-0x0;var _0xbe2586=_0x1e88[_0x22f88c];return _0xbe2586;};'use strict';var multer=require(_0x81e8('0x0'));var util=require(_0x81e8('0x1'));var path=require(_0x81e8('0x2'));var timeout=require(_0x81e8('0x3'));var express=require(_0x81e8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x81e8('0x5'));var interaction=require(_0x81e8('0x6'));var config=require(_0x81e8('0x7'));var controller=require(_0x81e8('0x8'));router[_0x81e8('0x9')]('/',auth[_0x81e8('0xa')](),controller['index']);router[_0x81e8('0x9')](_0x81e8('0xb'),auth[_0x81e8('0xa')](),controller[_0x81e8('0xc')]);router[_0x81e8('0xd')]('/',auth[_0x81e8('0xa')](),controller[_0x81e8('0xe')]);router[_0x81e8('0xf')](_0x81e8('0xb'),auth[_0x81e8('0xa')](),controller['update']);router[_0x81e8('0x10')](_0x81e8('0xb'),auth['isAuthenticated'](),controller[_0x81e8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 78f463f..3857d9a 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 _0x5c46=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING'];(function(_0x66c857,_0x2a5b85){var _0x5aa0b3=function(_0x5154a7){while(--_0x5154a7){_0x66c857['push'](_0x66c857['shift']());}};_0x5aa0b3(++_0x2a5b85);}(_0x5c46,0x1ef));var _0x65c4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5c46[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x65c4('0x0'));var moment=require('moment');module[_0x65c4('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x65c4('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x65c4('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x65c4('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x65c4('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x65c4('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x65c4('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x65c4('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x65c4('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x65c4('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x65c4('0x3')],'allowNull':![],'defaultValue':moment()[_0x65c4('0x4')](_0x65c4('0x5'))}}; \ No newline at end of file +var _0x6ced=['STRING','YYYY-MM-DD\x20HH:mm:ss','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ced,0x116));var _0xd6ce=function(_0x4bce64,_0x58b704){_0x4bce64=_0x4bce64-0x0;var _0x57bc4b=_0x6ced[_0x4bce64];return _0x57bc4b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd6ce('0x0')]={'time':{'type':Sequelize[_0xd6ce('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd6ce('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0xd6ce('0x2'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 938708b..2242150 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 _0xbf6c=['attributes','fields','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0x520a8d,_0x563b7a){var _0x1a5d5f=function(_0x5a7371){while(--_0x5a7371){_0x520a8d['push'](_0x520a8d['shift']());}};_0x1a5d5f(++_0x563b7a);}(_0xbf6c,0x1e8));var _0xcbf6=function(_0x5d06ba,_0x1b5079){_0x5d06ba=_0x5d06ba-0x0;var _0x61de78=_0xbf6c[_0x5d06ba];return _0x61de78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcbf6('0x0'));var zipdir=require(_0xcbf6('0x1'));var jsonpatch=require(_0xcbf6('0x2'));var rp=require(_0xcbf6('0x3'));var moment=require(_0xcbf6('0x4'));var BPromise=require(_0xcbf6('0x5'));var Mustache=require(_0xcbf6('0x6'));var util=require(_0xcbf6('0x7'));var path=require(_0xcbf6('0x8'));var sox=require(_0xcbf6('0x9'));var csv=require('to-csv');var ejs=require(_0xcbf6('0xa'));var fs=require('fs');var fs_extra=require(_0xcbf6('0xb'));var _=require(_0xcbf6('0xc'));var squel=require('squel');var crypto=require(_0xcbf6('0xd'));var jsforce=require(_0xcbf6('0xe'));var deskjs=require(_0xcbf6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcbf6('0x10'));var Papa=require(_0xcbf6('0x11'));var Redis=require(_0xcbf6('0x12'));var authService=require(_0xcbf6('0x13'));var qs=require(_0xcbf6('0x14'));var as=require(_0xcbf6('0x15'));var hardwareService=require(_0xcbf6('0x16'));var logger=require(_0xcbf6('0x17'))('api');var utils=require(_0xcbf6('0x18'));var config=require(_0xcbf6('0x19'));var licenseUtil=require(_0xcbf6('0x1a'));var db=require(_0xcbf6('0x1b'))['db'];function respondWithStatusCode(_0x46c2a4,_0xf67e58){_0xf67e58=_0xf67e58||0xcc;return function(_0x8d4a4c){if(_0x8d4a4c){return _0x46c2a4[_0xcbf6('0x1c')](_0xf67e58);}return _0x46c2a4[_0xcbf6('0x1d')](_0xf67e58)[_0xcbf6('0x1e')]();};}function respondWithResult(_0x86c185,_0x3b8039){_0x3b8039=_0x3b8039||0xc8;return function(_0x54941b){if(_0x54941b){return _0x86c185['status'](_0x3b8039)[_0xcbf6('0x1f')](_0x54941b);}};}function respondWithFilteredResult(_0xeb26f8,_0x5c4ba3){return function(_0x1a9c8a){if(_0x1a9c8a){var _0x3a16b6=typeof _0x5c4ba3[_0xcbf6('0x20')]===_0xcbf6('0x21')&&typeof _0x5c4ba3['limit']===_0xcbf6('0x21');var _0x5e6c76=_0x1a9c8a['count'];var _0x237b9b=_0x3a16b6?0x0:_0x5c4ba3[_0xcbf6('0x20')];var _0x2fdab1=_0x3a16b6?_0x1a9c8a[_0xcbf6('0x22')]:_0x5c4ba3[_0xcbf6('0x20')]+_0x5c4ba3[_0xcbf6('0x23')];var _0x5bb1a1;if(_0x2fdab1>=_0x5e6c76){_0x2fdab1=_0x5e6c76;_0x5bb1a1=0xc8;}else{_0x5bb1a1=0xce;}_0xeb26f8[_0xcbf6('0x1d')](_0x5bb1a1);return _0xeb26f8[_0xcbf6('0x24')](_0xcbf6('0x25'),_0x237b9b+'-'+_0x2fdab1+'/'+_0x5e6c76)[_0xcbf6('0x1f')](_0x1a9c8a);}return null;};}function patchUpdates(_0x167783){return function(_0x2365fb){try{jsonpatch['apply'](_0x2365fb,_0x167783,!![]);}catch(_0x244bb0){return BPromise[_0xcbf6('0x26')](_0x244bb0);}return _0x2365fb[_0xcbf6('0x27')]();};}function saveUpdates(_0x3fa3cd,_0x519b50){return function(_0x70938b){if(_0x70938b){return _0x70938b[_0xcbf6('0x28')](_0x3fa3cd)[_0xcbf6('0x29')](function(_0x53d9f8){return _0x53d9f8;});}return null;};}function removeEntity(_0x5753f2,_0x117086){return function(_0xc2f746){if(_0xc2f746){return _0xc2f746[_0xcbf6('0x2a')]()[_0xcbf6('0x29')](function(){_0x5753f2[_0xcbf6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x200eaf,_0x153929){return function(_0x1b5c0c){if(!_0x1b5c0c){_0x200eaf['sendStatus'](0x194);}return _0x1b5c0c;};}function handleError(_0x3e2c22,_0x3b0167){_0x3b0167=_0x3b0167||0x1f4;return function(_0x18ec2b){logger[_0xcbf6('0x2b')](_0x18ec2b[_0xcbf6('0x2c')]);if(_0x18ec2b[_0xcbf6('0x2d')]){delete _0x18ec2b['name'];}_0x3e2c22[_0xcbf6('0x1d')](_0x3b0167)[_0xcbf6('0x2e')](_0x18ec2b);};}exports[_0xcbf6('0x2f')]=function(_0x14e621,_0x197ce5){var _0xd14371={},_0x298689={},_0x515d64={'count':0x0,'rows':[]};var _0x13f126=_[_0xcbf6('0x30')](db[_0xcbf6('0x31')][_0xcbf6('0x32')],function(_0x3a907f){return{'name':_0x3a907f[_0xcbf6('0x33')],'type':_0x3a907f[_0xcbf6('0x34')][_0xcbf6('0x35')]};});_0x298689[_0xcbf6('0x36')]=_[_0xcbf6('0x30')](_0x13f126,_0xcbf6('0x2d'));_0x298689[_0xcbf6('0x37')]=_['keys'](_0x14e621[_0xcbf6('0x37')]);_0x298689[_0xcbf6('0x38')]=_[_0xcbf6('0x39')](_0x298689[_0xcbf6('0x36')],_0x298689[_0xcbf6('0x37')]);_0xd14371[_0xcbf6('0x3a')]=_[_0xcbf6('0x39')](_0x298689['model'],qs['fields'](_0x14e621[_0xcbf6('0x37')][_0xcbf6('0x3b')]));_0xd14371[_0xcbf6('0x3a')]=_0xd14371['attributes']['length']?_0xd14371[_0xcbf6('0x3a')]:_0x298689['model'];if(!_0x14e621[_0xcbf6('0x37')]['hasOwnProperty']('nolimit')){_0xd14371[_0xcbf6('0x23')]=qs[_0xcbf6('0x23')](_0x14e621[_0xcbf6('0x37')][_0xcbf6('0x23')]);_0xd14371[_0xcbf6('0x20')]=qs[_0xcbf6('0x20')](_0x14e621[_0xcbf6('0x37')][_0xcbf6('0x20')]);}_0xd14371[_0xcbf6('0x3c')]=qs[_0xcbf6('0x3d')](_0x14e621[_0xcbf6('0x37')]['sort']);_0xd14371[_0xcbf6('0x3e')]=qs[_0xcbf6('0x38')](_['pick'](_0x14e621['query'],_0x298689[_0xcbf6('0x38')]),_0x13f126);if(_0x14e621[_0xcbf6('0x37')][_0xcbf6('0x3f')]){_0xd14371['where']=_['merge'](_0xd14371[_0xcbf6('0x3e')],{'$or':_[_0xcbf6('0x30')](_0x13f126,function(_0x1c2671){if(_0x1c2671[_0xcbf6('0x34')]!==_0xcbf6('0x40')){var _0x7f4427={};_0x7f4427[_0x1c2671[_0xcbf6('0x2d')]]={'$like':'%'+_0x14e621[_0xcbf6('0x37')]['filter']+'%'};return _0x7f4427;}})});}_0xd14371=_[_0xcbf6('0x41')]({},_0xd14371,_0x14e621[_0xcbf6('0x42')]);var _0x32cf11={'where':_0xd14371[_0xcbf6('0x3e')]};return db[_0xcbf6('0x31')][_0xcbf6('0x22')](_0x32cf11)[_0xcbf6('0x29')](function(_0x357cd1){_0x515d64[_0xcbf6('0x22')]=_0x357cd1;if(_0x14e621[_0xcbf6('0x37')][_0xcbf6('0x43')]){_0xd14371[_0xcbf6('0x44')]=[{'all':!![]}];}return db[_0xcbf6('0x31')][_0xcbf6('0x45')](_0xd14371);})[_0xcbf6('0x29')](function(_0x1e7c2e){_0x515d64[_0xcbf6('0x46')]=_0x1e7c2e;return _0x515d64;})[_0xcbf6('0x29')](respondWithFilteredResult(_0x197ce5,_0xd14371))[_0xcbf6('0x47')](handleError(_0x197ce5,null));};exports[_0xcbf6('0x48')]=function(_0x4eca65,_0x1b261e){var _0x312079={'raw':!![],'where':{'id':_0x4eca65['params']['id']}},_0x25e877={};_0x25e877[_0xcbf6('0x36')]=_[_0xcbf6('0x49')](db['VoiceQueuesLog'][_0xcbf6('0x32')]);_0x25e877[_0xcbf6('0x37')]=_['keys'](_0x4eca65[_0xcbf6('0x37')]);_0x25e877['filters']=_['intersection'](_0x25e877[_0xcbf6('0x36')],_0x25e877[_0xcbf6('0x37')]);_0x312079['attributes']=_['intersection'](_0x25e877[_0xcbf6('0x36')],qs['fields'](_0x4eca65[_0xcbf6('0x37')]['fields']));_0x312079[_0xcbf6('0x3a')]=_0x312079['attributes'][_0xcbf6('0x4a')]?_0x312079['attributes']:_0x25e877[_0xcbf6('0x36')];if(_0x4eca65[_0xcbf6('0x37')][_0xcbf6('0x43')]){_0x312079[_0xcbf6('0x44')]=[{'all':!![]}];}_0x312079=_[_0xcbf6('0x41')]({},_0x312079,_0x4eca65[_0xcbf6('0x42')]);return db[_0xcbf6('0x31')][_0xcbf6('0x4b')](_0x312079)[_0xcbf6('0x29')](handleEntityNotFound(_0x1b261e,null))[_0xcbf6('0x29')](respondWithResult(_0x1b261e,null))[_0xcbf6('0x47')](handleError(_0x1b261e,null));};exports[_0xcbf6('0x4c')]=function(_0x4a460c,_0x42ceb2){return db[_0xcbf6('0x31')][_0xcbf6('0x4c')](_0x4a460c[_0xcbf6('0x4d')],{})[_0xcbf6('0x29')](respondWithResult(_0x42ceb2,0xc9))[_0xcbf6('0x47')](handleError(_0x42ceb2,null));};exports[_0xcbf6('0x28')]=function(_0xe7ee90,_0x5f8f0f){if(_0xe7ee90[_0xcbf6('0x4d')]['id']){delete _0xe7ee90[_0xcbf6('0x4d')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0xe7ee90['params']['id']}})['then'](handleEntityNotFound(_0x5f8f0f,null))[_0xcbf6('0x29')](saveUpdates(_0xe7ee90[_0xcbf6('0x4d')],null))[_0xcbf6('0x29')](respondWithResult(_0x5f8f0f,null))[_0xcbf6('0x47')](handleError(_0x5f8f0f,null));};exports['destroy']=function(_0x1b2c29,_0x351c51){return db[_0xcbf6('0x31')]['find']({'where':{'id':_0x1b2c29['params']['id']}})[_0xcbf6('0x29')](handleEntityNotFound(_0x351c51,null))[_0xcbf6('0x29')](removeEntity(_0x351c51,null))[_0xcbf6('0x47')](handleError(_0x351c51,null));}; \ No newline at end of file +var _0xa4d4=['reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','options','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa4d4,0x164));var _0x4a4d=function(_0x9ec2d5,_0x44b498){_0x9ec2d5=_0x9ec2d5-0x0;var _0x2ad8f9=_0xa4d4[_0x9ec2d5];return _0x2ad8f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a4d('0x0'));var zipdir=require(_0x4a4d('0x1'));var jsonpatch=require(_0x4a4d('0x2'));var rp=require(_0x4a4d('0x3'));var moment=require(_0x4a4d('0x4'));var BPromise=require(_0x4a4d('0x5'));var Mustache=require(_0x4a4d('0x6'));var util=require(_0x4a4d('0x7'));var path=require(_0x4a4d('0x8'));var sox=require(_0x4a4d('0x9'));var csv=require(_0x4a4d('0xa'));var ejs=require(_0x4a4d('0xb'));var fs=require('fs');var fs_extra=require(_0x4a4d('0xc'));var _=require('lodash');var squel=require(_0x4a4d('0xd'));var crypto=require('crypto');var jsforce=require(_0x4a4d('0xe'));var deskjs=require(_0x4a4d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4a4d('0x10'));var Papa=require(_0x4a4d('0x11'));var Redis=require(_0x4a4d('0x12'));var authService=require(_0x4a4d('0x13'));var qs=require(_0x4a4d('0x14'));var as=require(_0x4a4d('0x15'));var hardwareService=require(_0x4a4d('0x16'));var logger=require(_0x4a4d('0x17'))(_0x4a4d('0x18'));var utils=require(_0x4a4d('0x19'));var config=require(_0x4a4d('0x1a'));var licenseUtil=require(_0x4a4d('0x1b'));var db=require(_0x4a4d('0x1c'))['db'];function respondWithStatusCode(_0x4fcd99,_0x5b00eb){_0x5b00eb=_0x5b00eb||0xcc;return function(_0x464c1b){if(_0x464c1b){return _0x4fcd99[_0x4a4d('0x1d')](_0x5b00eb);}return _0x4fcd99[_0x4a4d('0x1e')](_0x5b00eb)[_0x4a4d('0x1f')]();};}function respondWithResult(_0x4397a5,_0x13f231){_0x13f231=_0x13f231||0xc8;return function(_0x390288){if(_0x390288){return _0x4397a5[_0x4a4d('0x1e')](_0x13f231)[_0x4a4d('0x20')](_0x390288);}};}function respondWithFilteredResult(_0x9104b3,_0x2b1379){return function(_0x4934d0){if(_0x4934d0){var _0x253ffc=typeof _0x2b1379['offset']===_0x4a4d('0x21')&&typeof _0x2b1379[_0x4a4d('0x22')]===_0x4a4d('0x21');var _0x311a89=_0x4934d0[_0x4a4d('0x23')];var _0x409ad0=_0x253ffc?0x0:_0x2b1379[_0x4a4d('0x24')];var _0x52dd1b=_0x253ffc?_0x4934d0['count']:_0x2b1379[_0x4a4d('0x24')]+_0x2b1379['limit'];var _0x29eb6b;if(_0x52dd1b>=_0x311a89){_0x52dd1b=_0x311a89;_0x29eb6b=0xc8;}else{_0x29eb6b=0xce;}_0x9104b3['status'](_0x29eb6b);return _0x9104b3[_0x4a4d('0x25')]('Content-Range',_0x409ad0+'-'+_0x52dd1b+'/'+_0x311a89)['json'](_0x4934d0);}return null;};}function patchUpdates(_0xea64e3){return function(_0x28ec0c){try{jsonpatch[_0x4a4d('0x26')](_0x28ec0c,_0xea64e3,!![]);}catch(_0x104e0c){return BPromise[_0x4a4d('0x27')](_0x104e0c);}return _0x28ec0c[_0x4a4d('0x28')]();};}function saveUpdates(_0x117f53,_0x26e974){return function(_0x27b570){if(_0x27b570){return _0x27b570[_0x4a4d('0x29')](_0x117f53)['then'](function(_0x59cdf1){return _0x59cdf1;});}return null;};}function removeEntity(_0x4411d6,_0x439579){return function(_0x2e8c3d){if(_0x2e8c3d){return _0x2e8c3d[_0x4a4d('0x2a')]()[_0x4a4d('0x2b')](function(){_0x4411d6['status'](0xcc)[_0x4a4d('0x1f')]();});}};}function handleEntityNotFound(_0x39646c,_0x2aaebf){return function(_0x4e40f6){if(!_0x4e40f6){_0x39646c[_0x4a4d('0x1d')](0x194);}return _0x4e40f6;};}function handleError(_0x427753,_0x242d7e){_0x242d7e=_0x242d7e||0x1f4;return function(_0x24ffeb){logger[_0x4a4d('0x2c')](_0x24ffeb[_0x4a4d('0x2d')]);if(_0x24ffeb[_0x4a4d('0x2e')]){delete _0x24ffeb['name'];}_0x427753[_0x4a4d('0x1e')](_0x242d7e)[_0x4a4d('0x2f')](_0x24ffeb);};}exports[_0x4a4d('0x30')]=function(_0x5c0061,_0x2a2aaf){var _0x3a64ee={},_0x18a9bc={},_0x49b8ab={'count':0x0,'rows':[]};var _0x49cbac=_[_0x4a4d('0x31')](db[_0x4a4d('0x32')][_0x4a4d('0x33')],function(_0xff69b4){return{'name':_0xff69b4[_0x4a4d('0x34')],'type':_0xff69b4[_0x4a4d('0x35')]['key']};});_0x18a9bc['model']=_[_0x4a4d('0x31')](_0x49cbac,_0x4a4d('0x2e'));_0x18a9bc[_0x4a4d('0x36')]=_[_0x4a4d('0x37')](_0x5c0061[_0x4a4d('0x36')]);_0x18a9bc[_0x4a4d('0x38')]=_[_0x4a4d('0x39')](_0x18a9bc[_0x4a4d('0x3a')],_0x18a9bc['query']);_0x3a64ee[_0x4a4d('0x3b')]=_['intersection'](_0x18a9bc[_0x4a4d('0x3a')],qs[_0x4a4d('0x3c')](_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x3c')]));_0x3a64ee[_0x4a4d('0x3b')]=_0x3a64ee[_0x4a4d('0x3b')][_0x4a4d('0x3d')]?_0x3a64ee[_0x4a4d('0x3b')]:_0x18a9bc['model'];if(!_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x3e')](_0x4a4d('0x3f'))){_0x3a64ee[_0x4a4d('0x22')]=qs['limit'](_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x22')]);_0x3a64ee[_0x4a4d('0x24')]=qs[_0x4a4d('0x24')](_0x5c0061[_0x4a4d('0x36')]['offset']);}_0x3a64ee['order']=qs[_0x4a4d('0x40')](_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x40')]);_0x3a64ee[_0x4a4d('0x41')]=qs[_0x4a4d('0x38')](_['pick'](_0x5c0061['query'],_0x18a9bc[_0x4a4d('0x38')]),_0x49cbac);if(_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x42')]){_0x3a64ee['where']=_[_0x4a4d('0x43')](_0x3a64ee['where'],{'$or':_['map'](_0x49cbac,function(_0x3c0975){if(_0x3c0975[_0x4a4d('0x35')]!==_0x4a4d('0x44')){var _0x2d421b={};_0x2d421b[_0x3c0975['name']]={'$like':'%'+_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x42')]+'%'};return _0x2d421b;}})});}_0x3a64ee=_[_0x4a4d('0x43')]({},_0x3a64ee,_0x5c0061['options']);var _0x98d0de={'where':_0x3a64ee[_0x4a4d('0x41')]};return db['VoiceQueuesLog']['count'](_0x98d0de)[_0x4a4d('0x2b')](function(_0x1f2e9b){_0x49b8ab['count']=_0x1f2e9b;if(_0x5c0061[_0x4a4d('0x36')][_0x4a4d('0x45')]){_0x3a64ee['include']=[{'all':!![]}];}return db[_0x4a4d('0x32')][_0x4a4d('0x46')](_0x3a64ee);})[_0x4a4d('0x2b')](function(_0x371fb7){_0x49b8ab[_0x4a4d('0x47')]=_0x371fb7;return _0x49b8ab;})['then'](respondWithFilteredResult(_0x2a2aaf,_0x3a64ee))[_0x4a4d('0x48')](handleError(_0x2a2aaf,null));};exports[_0x4a4d('0x49')]=function(_0x3ced23,_0x3d3c4b){var _0x5afbc9={'raw':!![],'where':{'id':_0x3ced23['params']['id']}},_0x5f2670={};_0x5f2670['model']=_[_0x4a4d('0x37')](db['VoiceQueuesLog']['rawAttributes']);_0x5f2670['query']=_[_0x4a4d('0x37')](_0x3ced23[_0x4a4d('0x36')]);_0x5f2670['filters']=_[_0x4a4d('0x39')](_0x5f2670['model'],_0x5f2670[_0x4a4d('0x36')]);_0x5afbc9[_0x4a4d('0x3b')]=_[_0x4a4d('0x39')](_0x5f2670['model'],qs[_0x4a4d('0x3c')](_0x3ced23[_0x4a4d('0x36')][_0x4a4d('0x3c')]));_0x5afbc9[_0x4a4d('0x3b')]=_0x5afbc9[_0x4a4d('0x3b')][_0x4a4d('0x3d')]?_0x5afbc9[_0x4a4d('0x3b')]:_0x5f2670[_0x4a4d('0x3a')];if(_0x3ced23[_0x4a4d('0x36')]['includeAll']){_0x5afbc9['include']=[{'all':!![]}];}_0x5afbc9=_[_0x4a4d('0x43')]({},_0x5afbc9,_0x3ced23[_0x4a4d('0x4a')]);return db[_0x4a4d('0x32')]['find'](_0x5afbc9)['then'](handleEntityNotFound(_0x3d3c4b,null))[_0x4a4d('0x2b')](respondWithResult(_0x3d3c4b,null))['catch'](handleError(_0x3d3c4b,null));};exports[_0x4a4d('0x4b')]=function(_0xcb5620,_0xb8bb69){return db['VoiceQueuesLog'][_0x4a4d('0x4b')](_0xcb5620[_0x4a4d('0x4c')],{})[_0x4a4d('0x2b')](respondWithResult(_0xb8bb69,0xc9))[_0x4a4d('0x48')](handleError(_0xb8bb69,null));};exports[_0x4a4d('0x29')]=function(_0x5914ac,_0x8e1d93){if(_0x5914ac[_0x4a4d('0x4c')]['id']){delete _0x5914ac[_0x4a4d('0x4c')]['id'];}return db[_0x4a4d('0x32')][_0x4a4d('0x4d')]({'where':{'id':_0x5914ac[_0x4a4d('0x4e')]['id']}})[_0x4a4d('0x2b')](handleEntityNotFound(_0x8e1d93,null))[_0x4a4d('0x2b')](saveUpdates(_0x5914ac[_0x4a4d('0x4c')],null))[_0x4a4d('0x2b')](respondWithResult(_0x8e1d93,null))['catch'](handleError(_0x8e1d93,null));};exports[_0x4a4d('0x2a')]=function(_0x285bc2,_0x2c8b95){return db[_0x4a4d('0x32')]['find']({'where':{'id':_0x285bc2[_0x4a4d('0x4e')]['id']}})[_0x4a4d('0x2b')](handleEntityNotFound(_0x2c8b95,null))[_0x4a4d('0x2b')](removeEntity(_0x2c8b95,null))[_0x4a4d('0x48')](handleError(_0x2c8b95,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index dfc1069..066ee09 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 _0x07f4=['request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','moment'];(function(_0x2cdb61,_0x56e8e3){var _0x11499d=function(_0x4135d0){while(--_0x4135d0){_0x2cdb61['push'](_0x2cdb61['shift']());}};_0x11499d(++_0x56e8e3);}(_0x07f4,0xe7));var _0x407f=function(_0x9bdb30,_0x4ebf71){_0x9bdb30=_0x9bdb30-0x0;var _0x53ee60=_0x07f4[_0x9bdb30];return _0x53ee60;};'use strict';var _=require(_0x407f('0x0'));var util=require('util');var logger=require(_0x407f('0x1'))('api');var moment=require(_0x407f('0x2'));var BPromise=require('bluebird');var rp=require(_0x407f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x407f('0x4'));var config=require(_0x407f('0x5'));var attributes=require(_0x407f('0x6'));module['exports']=function(_0x2e26cf,_0x22006e){return _0x2e26cf[_0x407f('0x7')](_0x407f('0x8'),attributes,{'tableName':_0x407f('0x9'),'paranoid':![],'indexes':[{'name':_0x407f('0xa'),'fields':[_0x407f('0xb'),_0x407f('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb634=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event','dtm'];(function(_0xb7b722,_0xe95ba7){var _0x217177=function(_0x463ab4){while(--_0x463ab4){_0xb7b722['push'](_0xb7b722['shift']());}};_0x217177(++_0xe95ba7);}(_0xb634,0x1c0));var _0x4b63=function(_0xf6f731,_0x5b870f){_0xf6f731=_0xf6f731-0x0;var _0x132490=_0xb634[_0xf6f731];return _0x132490;};'use strict';var _=require(_0x4b63('0x0'));var util=require('util');var logger=require(_0x4b63('0x1'))(_0x4b63('0x2'));var moment=require(_0x4b63('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b63('0x4'));var fs=require('fs');var path=require(_0x4b63('0x5'));var rimraf=require(_0x4b63('0x6'));var config=require(_0x4b63('0x7'));var attributes=require(_0x4b63('0x8'));module[_0x4b63('0x9')]=function(_0x47abe1,_0x57fba1){return _0x47abe1[_0x4b63('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x4b63('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x4b63('0xc'),_0x4b63('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 4489b9d..c2f375b 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 _0x38e7=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b397c,_0x3b8e00){var _0x4daa1f=function(_0x500e59){while(--_0x500e59){_0x5b397c['push'](_0x5b397c['shift']());}};_0x4daa1f(++_0x3b8e00);}(_0x38e7,0x1b3));var _0x738e=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0x38e7[_0x412342];return _0x3e62cb;};'use strict';var _=require('lodash');var util=require(_0x738e('0x0'));var moment=require(_0x738e('0x1'));var BPromise=require(_0x738e('0x2'));var rs=require(_0x738e('0x3'));var fs=require('fs');var Redis=require(_0x738e('0x4'));var db=require(_0x738e('0x5'))['db'];var utils=require(_0x738e('0x6'));var logger=require(_0x738e('0x7'))('rpc');var config=require(_0x738e('0x8'));var jayson=require(_0x738e('0x9'));var client=jayson[_0x738e('0xa')][_0x738e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20184f,_0x4d83bf,_0xad92ba){return new BPromise(function(_0x84cf69,_0xc3001d){return client['request'](_0x20184f,_0xad92ba)[_0x738e('0xc')](function(_0x1c3cb7){logger[_0x738e('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4d83bf,_0x738e('0xe'));logger[_0x738e('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4d83bf,_0x738e('0xe'),JSON[_0x738e('0x10')](_0x1c3cb7));if(_0x1c3cb7[_0x738e('0x11')]){if(_0x1c3cb7[_0x738e('0x11')][_0x738e('0x12')]===0x1f4){logger[_0x738e('0x11')](_0x738e('0x13'),_0x4d83bf,_0x1c3cb7[_0x738e('0x11')][_0x738e('0x14')]);return _0xc3001d(_0x1c3cb7[_0x738e('0x11')][_0x738e('0x14')]);}logger['error'](_0x738e('0x13'),_0x4d83bf,_0x1c3cb7[_0x738e('0x11')][_0x738e('0x14')]);return _0x84cf69(_0x1c3cb7['error']['message']);}else{logger['info'](_0x738e('0x13'),_0x4d83bf,_0x738e('0xe'));_0x84cf69(_0x1c3cb7['result'][_0x738e('0x14')]);}})['catch'](function(_0x27a956){logger[_0x738e('0x11')](_0x738e('0x13'),_0x4d83bf,_0x27a956);_0xc3001d(_0x27a956);});});} \ No newline at end of file +var _0xb910=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x2cc409,_0x5199ec){var _0xdfe8a2=function(_0x3d7e72){while(--_0x3d7e72){_0x2cc409['push'](_0x2cc409['shift']());}};_0xdfe8a2(++_0x5199ec);}(_0xb910,0x12b));var _0x0b91=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb910[_0x369151];return _0x4292d5;};'use strict';var _=require(_0x0b91('0x0'));var util=require(_0x0b91('0x1'));var moment=require(_0x0b91('0x2'));var BPromise=require(_0x0b91('0x3'));var rs=require(_0x0b91('0x4'));var fs=require('fs');var Redis=require(_0x0b91('0x5'));var db=require(_0x0b91('0x6'))['db'];var utils=require(_0x0b91('0x7'));var logger=require(_0x0b91('0x8'))(_0x0b91('0x9'));var config=require(_0x0b91('0xa'));var jayson=require(_0x0b91('0xb'));var client=jayson[_0x0b91('0xc')][_0x0b91('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5a22b6,_0x156fd1,_0xc65d86){return new BPromise(function(_0x3e8800,_0x41cc32){return client[_0x0b91('0xe')](_0x5a22b6,_0xc65d86)[_0x0b91('0xf')](function(_0x4118b8){logger[_0x0b91('0x10')](_0x0b91('0x11'),_0x156fd1,'request\x20sent');logger[_0x0b91('0x12')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x156fd1,_0x0b91('0x13'),JSON['stringify'](_0x4118b8));if(_0x4118b8['error']){if(_0x4118b8[_0x0b91('0x14')][_0x0b91('0x15')]===0x1f4){logger[_0x0b91('0x14')](_0x0b91('0x11'),_0x156fd1,_0x4118b8['error'][_0x0b91('0x16')]);return _0x41cc32(_0x4118b8[_0x0b91('0x14')][_0x0b91('0x16')]);}logger[_0x0b91('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x156fd1,_0x4118b8[_0x0b91('0x14')][_0x0b91('0x16')]);return _0x3e8800(_0x4118b8[_0x0b91('0x14')][_0x0b91('0x16')]);}else{logger[_0x0b91('0x10')](_0x0b91('0x11'),_0x156fd1,'request\x20sent');_0x3e8800(_0x4118b8[_0x0b91('0x17')][_0x0b91('0x16')]);}})[_0x0b91('0x18')](function(_0x17d6fd){logger[_0x0b91('0x14')](_0x0b91('0x11'),_0x156fd1,_0x17d6fd);_0x41cc32(_0x17d6fd);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 6142351..4b16ae0 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 _0xa0c7=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0c7,0x81));var _0x7a0c=function(_0x134131,_0x518de6){_0x134131=_0x134131-0x0;var _0x48ce5a=_0xa0c7[_0x134131];return _0x48ce5a;};'use strict';var multer=require(_0x7a0c('0x0'));var util=require(_0x7a0c('0x1'));var path=require('path');var timeout=require(_0x7a0c('0x2'));var express=require(_0x7a0c('0x3'));var router=express[_0x7a0c('0x4')]();var fs_extra=require(_0x7a0c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7a0c('0x6'));var controller=require(_0x7a0c('0x7'));router[_0x7a0c('0x8')]('/',auth[_0x7a0c('0x9')](),controller[_0x7a0c('0xa')]);router[_0x7a0c('0x8')](_0x7a0c('0xb'),auth[_0x7a0c('0x9')](),controller[_0x7a0c('0xc')]);router[_0x7a0c('0x8')]('/:id',auth[_0x7a0c('0x9')](),controller[_0x7a0c('0xd')]);router['get'](_0x7a0c('0xe'),auth[_0x7a0c('0x9')](),controller[_0x7a0c('0xf')]);router[_0x7a0c('0x8')](_0x7a0c('0x10'),controller[_0x7a0c('0x11')]);router[_0x7a0c('0x8')](_0x7a0c('0x12'),auth[_0x7a0c('0x9')](),controller[_0x7a0c('0x13')]);router[_0x7a0c('0x14')]('/',auth[_0x7a0c('0x9')](),controller[_0x7a0c('0x15')]);router['post'](_0x7a0c('0x12'),auth[_0x7a0c('0x9')](),controller[_0x7a0c('0x16')]);router[_0x7a0c('0x17')](_0x7a0c('0x18'),auth[_0x7a0c('0x9')](),controller[_0x7a0c('0x19')]);router[_0x7a0c('0x1a')](_0x7a0c('0x18'),auth[_0x7a0c('0x9')](),controller[_0x7a0c('0x1b')]);module[_0x7a0c('0x1c')]=router; \ No newline at end of file +var _0x34d0=['exports','multer','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','show','/:id/download','download','/:id/downloads','post','/:id/transcribe','runTranscribe','put','/:id','update','delete','destroy'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x34d0,0xf3));var _0x034d=function(_0x34b18a,_0x564767){_0x34b18a=_0x34b18a-0x0;var _0x503369=_0x34d0[_0x34b18a];return _0x503369;};'use strict';var multer=require(_0x034d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x034d('0x1'));var router=express[_0x034d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x034d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x034d('0x4'));var controller=require(_0x034d('0x5'));router[_0x034d('0x6')]('/',auth[_0x034d('0x7')](),controller['index']);router[_0x034d('0x6')]('/describe',auth[_0x034d('0x7')](),controller[_0x034d('0x8')]);router['get']('/:id',auth[_0x034d('0x7')](),controller[_0x034d('0x9')]);router[_0x034d('0x6')](_0x034d('0xa'),auth[_0x034d('0x7')](),controller[_0x034d('0xb')]);router[_0x034d('0x6')](_0x034d('0xc'),controller['downloads']);router[_0x034d('0x6')]('/:id/transcribe',auth[_0x034d('0x7')](),controller['downloadTranscribe']);router[_0x034d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x034d('0xd')](_0x034d('0xe'),auth[_0x034d('0x7')](),controller[_0x034d('0xf')]);router[_0x034d('0x10')](_0x034d('0x11'),auth[_0x034d('0x7')](),controller[_0x034d('0x12')]);router[_0x034d('0x13')]('/:id',auth[_0x034d('0x7')](),controller[_0x034d('0x14')]);module[_0x034d('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e7d4d88..2542ad3 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 9624bed..e5375b0 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 _0xb2e4=['ejs','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','name','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','length','catch','create','body','update','describe','../../components/encryptor','uniqueid','params','find','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','unlink','download','message','downloads','sequelize','MD5','token','$and','push','filename','extname','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','bucket','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0xb2e4,0x130));var _0x4b2e=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xb2e4[_0x2aecb2];return _0x3ebb80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b2e('0x0'));var zipdir=require(_0x4b2e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4b2e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4b2e('0x3'));var util=require(_0x4b2e('0x4'));var path=require(_0x4b2e('0x5'));var sox=require(_0x4b2e('0x6'));var csv=require(_0x4b2e('0x7'));var ejs=require(_0x4b2e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4b2e('0x9'));var crypto=require(_0x4b2e('0xa'));var jsforce=require(_0x4b2e('0xb'));var deskjs=require(_0x4b2e('0xc'));var toCsv=require(_0x4b2e('0x7'));var querystring=require('querystring');var Papa=require(_0x4b2e('0xd'));var AWS=require(_0x4b2e('0xe'));var uuidv4=require(_0x4b2e('0xf'));var Redis=require(_0x4b2e('0x10'));var authService=require(_0x4b2e('0x11'));var qs=require(_0x4b2e('0x12'));var as=require(_0x4b2e('0x13'));var hardwareService=require(_0x4b2e('0x14'));var logger=require(_0x4b2e('0x15'))(_0x4b2e('0x16'));var utils=require(_0x4b2e('0x17'));var config=require(_0x4b2e('0x18'));var licenseUtil=require(_0x4b2e('0x19'));var db=require(_0x4b2e('0x1a'))['db'];function respondWithStatusCode(_0x1821bb,_0x567d84){_0x567d84=_0x567d84||0xcc;return function(_0x257485){if(_0x257485){return _0x1821bb[_0x4b2e('0x1b')](_0x567d84);}return _0x1821bb['status'](_0x567d84)[_0x4b2e('0x1c')]();};}function respondWithResult(_0x3526f7,_0x4e7f26){_0x4e7f26=_0x4e7f26||0xc8;return function(_0x1883ad){if(_0x1883ad){return _0x3526f7[_0x4b2e('0x1d')](_0x4e7f26)[_0x4b2e('0x1e')](_0x1883ad);}};}function respondWithFilteredResult(_0x1db399,_0x48f490){return function(_0x5234fe){if(_0x5234fe){var _0x106bb1=typeof _0x48f490[_0x4b2e('0x1f')]===_0x4b2e('0x20')&&typeof _0x48f490[_0x4b2e('0x21')]===_0x4b2e('0x20');var _0x32d543=_0x5234fe[_0x4b2e('0x22')];var _0x5e24fa=_0x106bb1?0x0:_0x48f490['offset'];var _0x5d27e7=_0x106bb1?_0x5234fe[_0x4b2e('0x22')]:_0x48f490[_0x4b2e('0x1f')]+_0x48f490[_0x4b2e('0x21')];var _0x5e2084;if(_0x5d27e7>=_0x32d543){_0x5d27e7=_0x32d543;_0x5e2084=0xc8;}else{_0x5e2084=0xce;}_0x1db399[_0x4b2e('0x1d')](_0x5e2084);return _0x1db399[_0x4b2e('0x23')](_0x4b2e('0x24'),_0x5e24fa+'-'+_0x5d27e7+'/'+_0x32d543)['json'](_0x5234fe);}return null;};}function patchUpdates(_0x3508b1){return function(_0x2bb23a){try{jsonpatch['apply'](_0x2bb23a,_0x3508b1,!![]);}catch(_0x52358d){return BPromise[_0x4b2e('0x25')](_0x52358d);}return _0x2bb23a['save']();};}function saveUpdates(_0x95b6e5,_0x51554e){return function(_0xa077a9){if(_0xa077a9){return _0xa077a9['update'](_0x95b6e5)[_0x4b2e('0x26')](function(_0x2ce67c){return _0x2ce67c;});}return null;};}function removeEntity(_0x1fe178,_0x2bfe46){return function(_0x2a7df4){if(_0x2a7df4){return _0x2a7df4[_0x4b2e('0x27')]()[_0x4b2e('0x26')](function(){_0x1fe178[_0x4b2e('0x1d')](0xcc)[_0x4b2e('0x1c')]();});}};}function handleEntityNotFound(_0x164b8a,_0x6c2d63){return function(_0x126d1e){if(!_0x126d1e){_0x164b8a[_0x4b2e('0x1b')](0x194);}return _0x126d1e;};}function handleError(_0x10cb54,_0x147550){_0x147550=_0x147550||0x1f4;return function(_0x4213ed){logger[_0x4b2e('0x28')](_0x4213ed['stack']);if(_0x4213ed['name']){delete _0x4213ed['name'];}_0x10cb54[_0x4b2e('0x1d')](_0x147550)[_0x4b2e('0x29')](_0x4213ed);};}exports[_0x4b2e('0x2a')]=function(_0x264dee,_0x5602ed){var _0x3859fb={},_0x9d5ac7={},_0x3c400f={'count':0x0,'rows':[]};var _0x24e8a5=_[_0x4b2e('0x2b')](db[_0x4b2e('0x2c')][_0x4b2e('0x2d')],function(_0x33bee1){return{'name':_0x33bee1[_0x4b2e('0x2e')],'type':_0x33bee1[_0x4b2e('0x2f')][_0x4b2e('0x30')]};});_0x9d5ac7[_0x4b2e('0x31')]=_[_0x4b2e('0x32')](_[_0x4b2e('0x2b')](_0x24e8a5,_0x4b2e('0x33')),[_0x4b2e('0x34')]);_0x9d5ac7[_0x4b2e('0x35')]=_[_0x4b2e('0x36')](_0x264dee[_0x4b2e('0x35')]);_0x9d5ac7['filters']=_[_0x4b2e('0x37')](_0x9d5ac7['model'],_0x9d5ac7[_0x4b2e('0x35')]);_0x3859fb[_0x4b2e('0x38')]=_[_0x4b2e('0x37')](_0x9d5ac7[_0x4b2e('0x31')],qs[_0x4b2e('0x39')](_0x264dee[_0x4b2e('0x35')][_0x4b2e('0x39')]));_0x3859fb[_0x4b2e('0x38')]=_0x3859fb[_0x4b2e('0x38')]['length']?_0x3859fb[_0x4b2e('0x38')]:_0x9d5ac7[_0x4b2e('0x31')];if(!_0x264dee[_0x4b2e('0x35')][_0x4b2e('0x3a')](_0x4b2e('0x3b'))){_0x3859fb[_0x4b2e('0x21')]=qs['limit'](_0x264dee[_0x4b2e('0x35')][_0x4b2e('0x21')]);_0x3859fb['offset']=qs['offset'](_0x264dee[_0x4b2e('0x35')][_0x4b2e('0x1f')]);}_0x3859fb[_0x4b2e('0x3c')]=qs['sort'](_0x264dee[_0x4b2e('0x35')][_0x4b2e('0x3d')]);_0x3859fb[_0x4b2e('0x3e')]=qs[_0x4b2e('0x3f')](_[_0x4b2e('0x40')](_0x264dee[_0x4b2e('0x35')],_0x9d5ac7[_0x4b2e('0x3f')]),_0x24e8a5);if(_0x264dee['query'][_0x4b2e('0x41')]){_0x3859fb['where']=_[_0x4b2e('0x42')](_0x3859fb['where'],{'$or':_['map'](_0x24e8a5,function(_0xb88f06){if(_0xb88f06[_0x4b2e('0x2f')]!==_0x4b2e('0x43')){var _0x55e711={};_0x55e711[_0xb88f06['name']]={'$like':'%'+_0x264dee['query'][_0x4b2e('0x41')]+'%'};return _0x55e711;}})});}_0x3859fb=_['merge']({},_0x3859fb,_0x264dee[_0x4b2e('0x44')]);var _0x4e77c8={'where':_0x3859fb[_0x4b2e('0x3e')]};return db[_0x4b2e('0x2c')]['count'](_0x4e77c8)[_0x4b2e('0x26')](function(_0x560a00){_0x3c400f['count']=_0x560a00;if(_0x264dee[_0x4b2e('0x35')][_0x4b2e('0x45')]){_0x3859fb[_0x4b2e('0x46')]=[{'all':!![]}];}return db[_0x4b2e('0x2c')][_0x4b2e('0x47')](_0x3859fb);})[_0x4b2e('0x26')](function(_0xf2623f){_0x3c400f['rows']=_0xf2623f;return _0x3c400f;})['then'](respondWithFilteredResult(_0x5602ed,_0x3859fb))['catch'](handleError(_0x5602ed,null));};exports[_0x4b2e('0x48')]=function(_0x2cf02d,_0x5af9f5){var _0x596fcc={'raw':![],'where':{'id':_0x2cf02d['params']['id']}},_0x3d3a82={};_0x3d3a82[_0x4b2e('0x31')]=_[_0x4b2e('0x36')](db[_0x4b2e('0x2c')][_0x4b2e('0x2d')]);_0x3d3a82[_0x4b2e('0x35')]=_['keys'](_0x2cf02d[_0x4b2e('0x35')]);_0x3d3a82[_0x4b2e('0x3f')]=_[_0x4b2e('0x37')](_0x3d3a82[_0x4b2e('0x31')],_0x3d3a82[_0x4b2e('0x35')]);_0x596fcc[_0x4b2e('0x38')]=_[_0x4b2e('0x37')](_0x3d3a82['model'],qs[_0x4b2e('0x39')](_0x2cf02d[_0x4b2e('0x35')][_0x4b2e('0x39')]));_0x596fcc[_0x4b2e('0x38')]=_0x596fcc['attributes'][_0x4b2e('0x49')]?_0x596fcc['attributes']:_0x3d3a82[_0x4b2e('0x31')];if(_0x2cf02d[_0x4b2e('0x35')][_0x4b2e('0x45')]){_0x596fcc[_0x4b2e('0x46')]=[{'all':!![]}];}_0x596fcc=_[_0x4b2e('0x42')]({},_0x596fcc,_0x2cf02d[_0x4b2e('0x44')]);return db[_0x4b2e('0x2c')]['find'](_0x596fcc)[_0x4b2e('0x26')](handleEntityNotFound(_0x5af9f5,null))[_0x4b2e('0x26')](respondWithResult(_0x5af9f5,null))[_0x4b2e('0x4a')](handleError(_0x5af9f5,null));};exports[_0x4b2e('0x4b')]=function(_0x49fe82,_0x4c5998){return db[_0x4b2e('0x2c')]['create'](_0x49fe82[_0x4b2e('0x4c')],{})['then'](respondWithResult(_0x4c5998,0xc9))['catch'](handleError(_0x4c5998,null));};exports[_0x4b2e('0x4d')]=function(_0x9f7277,_0x16d777){if(_0x9f7277[_0x4b2e('0x4c')]['id']){delete _0x9f7277[_0x4b2e('0x4c')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x9f7277['params']['id']}})[_0x4b2e('0x26')](handleEntityNotFound(_0x16d777,null))[_0x4b2e('0x26')](saveUpdates(_0x9f7277['body'],null))[_0x4b2e('0x26')](respondWithResult(_0x16d777,null))[_0x4b2e('0x4a')](handleError(_0x16d777,null));};exports[_0x4b2e('0x4e')]=function(_0x45e8e1,_0x3043fa){return db[_0x4b2e('0x2c')][_0x4b2e('0x4e')]()[_0x4b2e('0x26')](respondWithResult(_0x3043fa,null))[_0x4b2e('0x4a')](handleError(_0x3043fa,null));};exports['download']=function(_0x1c217e,_0x1ae52d,_0x834fd6){var _0x15a954=require(_0x4b2e('0x4f'));var _0x5eb77a=![];var _0xc26324={};if(_0x1c217e[_0x4b2e('0x35')][_0x4b2e('0x2f')]&&_0x1c217e['query']['type']==='uniqueid'){_0xc26324[_0x4b2e('0x50')]=_0x1c217e['params']['id'];}else{_0xc26324['id']=_0x1c217e[_0x4b2e('0x51')]['id'];}return db[_0x4b2e('0x2c')][_0x4b2e('0x52')]({'where':_0xc26324,'attributes':['id',_0x4b2e('0x53')],'raw':!![]})[_0x4b2e('0x26')](handleEntityNotFound(_0x1ae52d,null))[_0x4b2e('0x26')](function(_0x3c3bbd){if(_0x3c3bbd){var _0x2b137e=_0x3c3bbd[_0x4b2e('0x53')];var _0x37b5d9=util[_0x4b2e('0x34')](_0x4b2e('0x54'),_0x2b137e);if(fs['existsSync'](_0x37b5d9)){_0x5eb77a=!![];return _0x15a954[_0x4b2e('0x55')](_0x37b5d9,_0x2b137e,config[_0x4b2e('0x56')][_0x4b2e('0x57')])[_0x4b2e('0x26')](function(){return _0x3c3bbd;});}return _0x3c3bbd;}})[_0x4b2e('0x26')](function(_0x2bbaea){if(_0x2bbaea){var _0x382711=_0x2bbaea[_0x4b2e('0x53')];if(!fs[_0x4b2e('0x58')](_0x382711)){throw new db[(_0x4b2e('0x59'))][(_0x4b2e('0x5a'))](_0x4b2e('0x5b'));}if(_0x2bbaea['filename']){return _0x1ae52d['download'](_0x382711,_0x2bbaea['filename']+path['extname'](_0x382711),function(){if(_0x5eb77a){fs[_0x4b2e('0x5c')](_0x382711);}});}else{return _0x1ae52d[_0x4b2e('0x5d')](_0x382711,function(_0x2e5988){if(_0x5eb77a){fs[_0x4b2e('0x5c')](_0x382711);}});}}})['catch'](function(_0x1f9a71){if(_0x1f9a71[_0x4b2e('0x5e')]===_0x4b2e('0x5b')){_0x1ae52d[_0x4b2e('0x1d')](0x194)[_0x4b2e('0x29')]('Not\x20found');}else{return handleError(_0x1ae52d,null);}});};exports[_0x4b2e('0x5f')]=function(_0x10477f,_0x2a3728,_0x57c363){var _0x5df69e=require(_0x4b2e('0x4f'));var _0x402647=![];var _0x4a7bfd={'$and':[db['sequelize'][_0x4b2e('0x3e')](db[_0x4b2e('0x60')]['fn'](_0x4b2e('0x61'),db[_0x4b2e('0x60')]['col'](_0x4b2e('0x50'))),_0x10477f[_0x4b2e('0x35')][_0x4b2e('0x62')])]};if(_0x10477f[_0x4b2e('0x35')]['type']&&_0x10477f[_0x4b2e('0x35')][_0x4b2e('0x2f')]===_0x4b2e('0x50')){_0x4a7bfd[_0x4b2e('0x63')][_0x4b2e('0x64')]({'uniqueid':_0x10477f[_0x4b2e('0x51')]['id']});}else{_0x4a7bfd[_0x4b2e('0x63')][_0x4b2e('0x64')]({'id':_0x10477f['params']['id']});}return db[_0x4b2e('0x2c')]['find']({'where':_0x4a7bfd,'attributes':['id',_0x4b2e('0x53')],'raw':!![]})[_0x4b2e('0x26')](handleEntityNotFound(_0x2a3728,null))['then'](function(_0x4cd70e){if(_0x4cd70e){var _0xceb165=util[_0x4b2e('0x34')](_0x4b2e('0x54'),_0x4cd70e[_0x4b2e('0x53')]);if(fs[_0x4b2e('0x58')](_0xceb165)){_0x402647=!![];return _0x5df69e[_0x4b2e('0x55')](_0xceb165,_0x4cd70e[_0x4b2e('0x53')],config[_0x4b2e('0x56')]['recording'])['then'](function(){return _0x4cd70e;});}return _0x4cd70e;}})[_0x4b2e('0x26')](function(_0x111cd8){if(_0x111cd8){if(!fs[_0x4b2e('0x58')](_0x111cd8[_0x4b2e('0x53')])){throw new db['Sequelize'][(_0x4b2e('0x5a'))](_0x4b2e('0x5b'));}if(_0x111cd8[_0x4b2e('0x65')]){return _0x2a3728['download'](_0x111cd8[_0x4b2e('0x53')],_0x111cd8['filename']+path[_0x4b2e('0x66')](_0x111cd8['value']),function(){if(_0x402647){fs[_0x4b2e('0x5c')](_0x111cd8[_0x4b2e('0x53')]);}});}else{return _0x2a3728[_0x4b2e('0x5d')](_0x111cd8[_0x4b2e('0x53')],function(_0x3ffb7d){if(_0x402647){fs['unlink'](_0x111cd8[_0x4b2e('0x53')]);}});}}})['catch'](handleError(_0x2a3728,null));};exports['destroy']=function(_0x23c915,_0x159203){return db['VoiceRecording']['find']({'where':{'id':_0x23c915[_0x4b2e('0x51')]['id']}})[_0x4b2e('0x26')](function(_0x599919){if(_[_0x4b2e('0x67')](_0x599919)){throw new ReferenceError(_0x4b2e('0x68'));}return _0x599919;})[_0x4b2e('0x26')](function(_0x49fce5){var _0x5f165c=_0x49fce5['value'];logger[_0x4b2e('0x69')]('cancellazione\x20fisica\x20documento\x20%s',_0x5f165c);if(!_[_0x4b2e('0x67')](_0x49fce5[_0x4b2e('0x53')])&&fs['existsSync'](_0x5f165c)){logger[_0x4b2e('0x69')](_0x4b2e('0x6a')+_0x5f165c+_0x4b2e('0x6b'));fs[_0x4b2e('0x6c')](_0x5f165c);}_0x5f165c=_0x5f165c+'.cypher';if(!_[_0x4b2e('0x67')](_0x49fce5['value'])&&fs[_0x4b2e('0x58')](_0x5f165c)){logger[_0x4b2e('0x69')](_0x4b2e('0x6a')+_0x5f165c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4b2e('0x6c')](_0x5f165c);}return _0x49fce5;})[_0x4b2e('0x26')](function(_0x3c0af5){if(!_0x3c0af5)throw new InternalError();return _0x3c0af5[_0x4b2e('0x27')]();})[_0x4b2e('0x26')](function(){_0x159203[_0x4b2e('0x1d')](0xcc)[_0x4b2e('0x1c')]();})[_0x4b2e('0x4a')](handleError(_0x159203,null));};function getBucketslist(_0x30949d,_0x48d0c1,_0x11f369){return new Promise(function(_0x3903ee,_0x171e36){var _0x4f20d1=new AWS['S3']({'accessKeyId':_0x48d0c1,'secretAccessKey':_0x30949d,'region':_0x11f369});_0x4f20d1[_0x4b2e('0x6d')]({},function(_0x370539,_0xeb28ec){if(_0x370539){return _0x171e36(_0x370539);}else{return _0x3903ee(_0xeb28ec);}});});}function createBucket(_0x74bc18,_0x5a2a00,_0xa13ba9,_0x475519){return new Promise(function(_0x3c578d,_0x1a2dff){var _0xb1405=new AWS['S3']({'accessKeyId':_0x5a2a00,'secretAccessKey':_0x74bc18,'region':_0xa13ba9});_0xb1405[_0x4b2e('0x6e')]({'Bucket':_0x475519},function(_0x1c1184,_0x1d66dd){if(_0x1c1184){return _0x1a2dff(_0x1c1184);}else{return _0x3c578d(_0x1d66dd);}});});}function uploadFile(_0x24feb5,_0x2e8054,_0x75ae9e,_0x435d91,_0x173c0f,_0x293a0b){return new Promise(function(_0x201633,_0x4a32b9){var _0x25ec58=new AWS['S3']({'accessKeyId':_0x2e8054,'secretAccessKey':_0x24feb5,'region':_0x75ae9e});_0x25ec58[_0x4b2e('0x6f')]({'Bucket':_0x435d91,'Key':_0x173c0f,'Body':_0x293a0b},function(_0x28c4fe,_0x1e63a4){if(_0x28c4fe){return _0x4a32b9(_0x28c4fe);}else{return _0x201633(_0x1e63a4);}});});}function startTranscribe(_0x53a182,_0x507eae,_0x50dc90,_0x35a157,_0x208981,_0x251b0f){return new Promise(function(_0x4050fb,_0x2f737f){var _0x17b7e9=new AWS['TranscribeService']({'accessKeyId':_0x507eae,'secretAccessKey':_0x53a182,'region':_0x50dc90});_0x17b7e9[_0x4b2e('0x70')]({'TranscriptionJobName':_0x35a157,'LanguageCode':_0x208981,'Media':{'MediaFileUri':_0x251b0f}},function(_0x2e4d5d,_0x4b59ba){if(_0x2e4d5d){return _0x2f737f(_0x2e4d5d);}else{return _0x4050fb(_0x4b59ba);}});});}function transcribe(_0x959dd9,_0x39acba,_0x3de9a6,_0x122ca5,_0x3139bd,_0x503925,_0x7feea2){return new Promise(function(_0x559c80,_0x93eb1){var _0x2b0b6b={};logger[_0x4b2e('0x69')](util['format'](_0x4b2e('0x71'),_0x959dd9,_0x3139bd));return uploadFile(_0x39acba,_0x3de9a6,_0x122ca5,_0x3139bd,path['basename'](_0x503925),fs['readFileSync'](_0x503925))[_0x4b2e('0x26')](function(_0x1ed44e){logger[_0x4b2e('0x69')](util['format'](_0x4b2e('0x72'),_0x959dd9,_0x3139bd,_0x1ed44e[_0x4b2e('0x73')]));_0x2b0b6b['bucket']=_0x1ed44e[_0x4b2e('0x74')];_0x2b0b6b[_0x4b2e('0x75')]=_0x1ed44e[_0x4b2e('0x73')];logger[_0x4b2e('0x69')](util[_0x4b2e('0x34')](_0x4b2e('0x76'),_0x959dd9));return startTranscribe(_0x39acba,_0x3de9a6,_0x122ca5,uuidv4(),_0x7feea2,_0x1ed44e[_0x4b2e('0x73')]);})[_0x4b2e('0x26')](function(_0x391e39){logger['info'](util[_0x4b2e('0x34')](_0x4b2e('0x77'),_0x959dd9,_0x391e39[_0x4b2e('0x78')][_0x4b2e('0x79')]));_0x2b0b6b[_0x4b2e('0x7a')]=_0x391e39[_0x4b2e('0x78')][_0x4b2e('0x79')];_0x2b0b6b[_0x4b2e('0x7b')]=_0x391e39['TranscriptionJob'][_0x4b2e('0x7c')];return _0x559c80(_0x2b0b6b);})[_0x4b2e('0x4a')](function(_0xd9ac97){return _0x93eb1(_0xd9ac97);});});}exports[_0x4b2e('0x7d')]=function(_0x44c581,_0x3c9b54,_0x55c8e8){var _0x2c1840;var _0x451937;var _0x410d46;var _0x8614f7=require(_0x4b2e('0x4f'));return db[_0x4b2e('0x2c')][_0x4b2e('0x7e')]({'where':{'id':_0x44c581[_0x4b2e('0x51')]['id']}})[_0x4b2e('0x26')](function(_0x4d5916){if(_0x4d5916){var _0x1dd257=util[_0x4b2e('0x34')]('%s.cypher',_0x4d5916[_0x4b2e('0x53')]);if(fs[_0x4b2e('0x58')](_0x1dd257)){cypher=!![];return _0x8614f7[_0x4b2e('0x55')](_0x1dd257,_0x4d5916[_0x4b2e('0x53')],config['secrets'][_0x4b2e('0x57')])[_0x4b2e('0x26')](function(){return _0x4d5916;});}return _0x4d5916;}})[_0x4b2e('0x26')](function(_0x465528){if(!_0x465528){throw new db['Sequelize'][(_0x4b2e('0x5a'))]('Voice\x20Recording\x20not\x20found');}_0x451937=_0x465528;return db[_0x4b2e('0x7f')][_0x4b2e('0x7e')]({'where':{'id':0x1}});})[_0x4b2e('0x26')](handleEntityNotFound(_0x3c9b54,null))['then'](function(_0x402fb0){if(_0x402fb0){_0x2c1840=_0x402fb0;if(!_0x2c1840[_0x4b2e('0x80')]||!_0x2c1840[_0x4b2e('0x81')]||!_0x2c1840[_0x4b2e('0x82')]||!_0x2c1840[_0x4b2e('0x83')]||!_0x2c1840['bucket']){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x44c581[_0x4b2e('0x4c')][_0x4b2e('0x84')]&&(!_0x2c1840[_0x4b2e('0x85')]||!_0x2c1840[_0x4b2e('0x86')]||!_0x2c1840['sentimentRegion']||!_0x2c1840['language']||!_0x2c1840[_0x4b2e('0x87')])){throw new db[(_0x4b2e('0x59'))][(_0x4b2e('0x5a'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x4b2e('0x88')][_0x4b2e('0x7e')]({'where':{'id':_0x2c1840['transcribeAccountId']}});}})[_0x4b2e('0x26')](function(_0x353880){if(!_0x353880){throw new db['Sequelize'][(_0x4b2e('0x5a'))](_0x4b2e('0x89'));}if(!_0x353880[_0x4b2e('0x8a')]||!_0x353880[_0x4b2e('0x8b')]){throw new db[(_0x4b2e('0x59'))][(_0x4b2e('0x5a'))](_0x4b2e('0x8c'));}_0x410d46=_0x353880;return getBucketslist(_0x410d46[_0x4b2e('0x8a')],_0x410d46[_0x4b2e('0x8b')],_0x2c1840['transcribeRegion']);})[_0x4b2e('0x26')](function(_0x21f017){if(_0x21f017&&_0x21f017[_0x4b2e('0x8d')]){var _0x36b1f3=_['find'](_0x21f017[_0x4b2e('0x8d')],function(_0x375635){return _0x375635[_0x4b2e('0x8e')]===_0x2c1840['bucket'];});if(!_0x36b1f3){logger[_0x4b2e('0x69')](util['format'](_0x4b2e('0x8f'),_0x44c581[_0x4b2e('0x51')]['id'],_0x2c1840[_0x4b2e('0x87')]));return createBucket(_0x410d46['data1'],_0x410d46[_0x4b2e('0x8b')],_0x2c1840[_0x4b2e('0x82')],_0x2c1840[_0x4b2e('0x87')]);}logger['info'](util[_0x4b2e('0x34')](_0x4b2e('0x90'),_0x44c581[_0x4b2e('0x51')]['id'],_0x2c1840['bucket']));return;}})[_0x4b2e('0x26')](function(_0x225bb7){if(_0x451937[_0x4b2e('0x7b')]===_0x4b2e('0x91')){return transcribe(_0x44c581[_0x4b2e('0x51')]['id'],_0x410d46['data1'],_0x410d46[_0x4b2e('0x8b')],_0x2c1840[_0x4b2e('0x82')],_0x2c1840[_0x4b2e('0x87')],_0x451937[_0x4b2e('0x53')],_0x2c1840[_0x4b2e('0x83')]);}else{logger[_0x4b2e('0x69')](util[_0x4b2e('0x34')](_0x4b2e('0x92'),_0x44c581[_0x4b2e('0x51')]['id']));return{'transcribeStatus':_0x4b2e('0x93')};}})[_0x4b2e('0x26')](function(_0x31d52f){if(_0x31d52f){_0x31d52f[_0x4b2e('0x94')]=_0x44c581['body']['runSentiment'];return _0x451937[_0x4b2e('0x95')](_0x31d52f);}})[_0x4b2e('0x26')](respondWithResult(_0x3c9b54,null))[_0x4b2e('0x4a')](handleError(_0x3c9b54,null));};function writeFile(_0xe19cd8,_0x1936be){return new Promise(function(_0xd53c3a,_0x59c069){fs[_0x4b2e('0x96')](_0x1936be,_0xe19cd8,function(_0x502b8a,_0x3f0c7b){if(_0x502b8a){return _0x59c069(_0x502b8a);}else{return _0xd53c3a(_0x3f0c7b);}});});}exports[_0x4b2e('0x97')]=function(_0x340b82,_0xd1259d,_0x462a49){return db[_0x4b2e('0x2c')][_0x4b2e('0x7e')]({'where':{'id':_0x340b82[_0x4b2e('0x51')]['id']}})['then'](handleEntityNotFound(_0xd1259d))[_0x4b2e('0x26')](function(_0x5c3ad2){if(_0x5c3ad2&&_0x5c3ad2['fileText']){var _0x52ad64=_0x5c3ad2[_0x4b2e('0x98')];var _0x21ccea=config['root']+_0x4b2e('0x99')+_0x5c3ad2['id']+_0x4b2e('0x9a');if(fs['existsSync'](_0x21ccea)){return _0x21ccea;}return writeFile(_0x52ad64,_0x21ccea)[_0x4b2e('0x26')](function(){return _0x21ccea;});}else{throw new db[(_0x4b2e('0x59'))][(_0x4b2e('0x5a'))](_0x4b2e('0x9b'));}})['then'](function(_0x2902ef){return _0xd1259d[_0x4b2e('0x5d')](_0x2902ef);})[_0x4b2e('0x4a')](handleError(_0xd1259d));}; \ No newline at end of file +var _0x0337=['root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','show','length','find','create','body','update','params','describe','download','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','sequelize','MD5','col','token','push','$and','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','tempSentiment','updateAttributes','downloadTranscribe','fileText'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x0337,0x1d2));var _0x7033=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x0337[_0x4c0622];return _0x1799d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7033('0x0'));var jsonpatch=require(_0x7033('0x1'));var rp=require(_0x7033('0x2'));var moment=require(_0x7033('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7033('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7033('0x5'));var fs=require('fs');var fs_extra=require(_0x7033('0x6'));var _=require(_0x7033('0x7'));var squel=require(_0x7033('0x8'));var crypto=require(_0x7033('0x9'));var jsforce=require(_0x7033('0xa'));var deskjs=require(_0x7033('0xb'));var toCsv=require(_0x7033('0xc'));var querystring=require(_0x7033('0xd'));var Papa=require(_0x7033('0xe'));var AWS=require(_0x7033('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0x7033('0x10'));var authService=require(_0x7033('0x11'));var qs=require(_0x7033('0x12'));var as=require(_0x7033('0x13'));var hardwareService=require(_0x7033('0x14'));var logger=require(_0x7033('0x15'))(_0x7033('0x16'));var utils=require(_0x7033('0x17'));var config=require(_0x7033('0x18'));var licenseUtil=require(_0x7033('0x19'));var db=require(_0x7033('0x1a'))['db'];function respondWithStatusCode(_0x3e06ba,_0x1454ac){_0x1454ac=_0x1454ac||0xcc;return function(_0x2f286d){if(_0x2f286d){return _0x3e06ba[_0x7033('0x1b')](_0x1454ac);}return _0x3e06ba[_0x7033('0x1c')](_0x1454ac)[_0x7033('0x1d')]();};}function respondWithResult(_0x6732e,_0x63fad2){_0x63fad2=_0x63fad2||0xc8;return function(_0xdc44b2){if(_0xdc44b2){return _0x6732e[_0x7033('0x1c')](_0x63fad2)[_0x7033('0x1e')](_0xdc44b2);}};}function respondWithFilteredResult(_0x27dc57,_0x1f7b2f){return function(_0x3682f2){if(_0x3682f2){var _0x1e60b2=typeof _0x1f7b2f['offset']===_0x7033('0x1f')&&typeof _0x1f7b2f[_0x7033('0x20')]==='undefined';var _0x1f4e02=_0x3682f2['count'];var _0x5debdd=_0x1e60b2?0x0:_0x1f7b2f[_0x7033('0x21')];var _0x15a715=_0x1e60b2?_0x3682f2[_0x7033('0x22')]:_0x1f7b2f[_0x7033('0x21')]+_0x1f7b2f[_0x7033('0x20')];var _0x7316b1;if(_0x15a715>=_0x1f4e02){_0x15a715=_0x1f4e02;_0x7316b1=0xc8;}else{_0x7316b1=0xce;}_0x27dc57[_0x7033('0x1c')](_0x7316b1);return _0x27dc57[_0x7033('0x23')](_0x7033('0x24'),_0x5debdd+'-'+_0x15a715+'/'+_0x1f4e02)[_0x7033('0x1e')](_0x3682f2);}return null;};}function patchUpdates(_0x1d2865){return function(_0x45f4ab){try{jsonpatch['apply'](_0x45f4ab,_0x1d2865,!![]);}catch(_0x3ea472){return BPromise[_0x7033('0x25')](_0x3ea472);}return _0x45f4ab[_0x7033('0x26')]();};}function saveUpdates(_0x4d0357,_0xed3d08){return function(_0x5e2098){if(_0x5e2098){return _0x5e2098['update'](_0x4d0357)['then'](function(_0x5ed42f){return _0x5ed42f;});}return null;};}function removeEntity(_0x476ea3,_0x1f7b8f){return function(_0x3ee2f8){if(_0x3ee2f8){return _0x3ee2f8[_0x7033('0x27')]()['then'](function(){_0x476ea3[_0x7033('0x1c')](0xcc)[_0x7033('0x1d')]();});}};}function handleEntityNotFound(_0x18810f,_0x379f0e){return function(_0x2036a2){if(!_0x2036a2){_0x18810f[_0x7033('0x1b')](0x194);}return _0x2036a2;};}function handleError(_0x557691,_0x382d47){_0x382d47=_0x382d47||0x1f4;return function(_0x511e6f){logger[_0x7033('0x28')](_0x511e6f['stack']);if(_0x511e6f[_0x7033('0x29')]){delete _0x511e6f[_0x7033('0x29')];}_0x557691[_0x7033('0x1c')](_0x382d47)[_0x7033('0x2a')](_0x511e6f);};}exports[_0x7033('0x2b')]=function(_0x1fccda,_0x5bfcab){var _0x38f19e={},_0xfd931b={},_0x26d7dc={'count':0x0,'rows':[]};var _0x5cf0e9=_[_0x7033('0x2c')](db[_0x7033('0x2d')][_0x7033('0x2e')],function(_0x5ed39e){return{'name':_0x5ed39e[_0x7033('0x2f')],'type':_0x5ed39e[_0x7033('0x30')][_0x7033('0x31')]};});_0xfd931b['model']=_[_0x7033('0x32')](_[_0x7033('0x2c')](_0x5cf0e9,'name'),[_0x7033('0x33')]);_0xfd931b[_0x7033('0x34')]=_[_0x7033('0x35')](_0x1fccda[_0x7033('0x34')]);_0xfd931b[_0x7033('0x36')]=_[_0x7033('0x37')](_0xfd931b[_0x7033('0x38')],_0xfd931b[_0x7033('0x34')]);_0x38f19e[_0x7033('0x39')]=_[_0x7033('0x37')](_0xfd931b[_0x7033('0x38')],qs['fields'](_0x1fccda[_0x7033('0x34')][_0x7033('0x3a')]));_0x38f19e[_0x7033('0x39')]=_0x38f19e['attributes']['length']?_0x38f19e[_0x7033('0x39')]:_0xfd931b['model'];if(!_0x1fccda['query'][_0x7033('0x3b')]('nolimit')){_0x38f19e[_0x7033('0x20')]=qs[_0x7033('0x20')](_0x1fccda[_0x7033('0x34')][_0x7033('0x20')]);_0x38f19e[_0x7033('0x21')]=qs[_0x7033('0x21')](_0x1fccda['query'][_0x7033('0x21')]);}_0x38f19e['order']=qs[_0x7033('0x3c')](_0x1fccda[_0x7033('0x34')][_0x7033('0x3c')]);_0x38f19e[_0x7033('0x3d')]=qs['filters'](_[_0x7033('0x3e')](_0x1fccda[_0x7033('0x34')],_0xfd931b[_0x7033('0x36')]),_0x5cf0e9);if(_0x1fccda[_0x7033('0x34')]['filter']){_0x38f19e['where']=_[_0x7033('0x3f')](_0x38f19e[_0x7033('0x3d')],{'$or':_['map'](_0x5cf0e9,function(_0x231f10){if(_0x231f10[_0x7033('0x30')]!==_0x7033('0x40')){var _0x51a393={};_0x51a393[_0x231f10[_0x7033('0x29')]]={'$like':'%'+_0x1fccda[_0x7033('0x34')][_0x7033('0x41')]+'%'};return _0x51a393;}})});}_0x38f19e=_['merge']({},_0x38f19e,_0x1fccda[_0x7033('0x42')]);var _0x4cc075={'where':_0x38f19e[_0x7033('0x3d')]};return db[_0x7033('0x2d')][_0x7033('0x22')](_0x4cc075)[_0x7033('0x43')](function(_0x3e02b0){_0x26d7dc['count']=_0x3e02b0;if(_0x1fccda[_0x7033('0x34')][_0x7033('0x44')]){_0x38f19e[_0x7033('0x45')]=[{'all':!![]}];}return db[_0x7033('0x2d')][_0x7033('0x46')](_0x38f19e);})[_0x7033('0x43')](function(_0x21b209){_0x26d7dc['rows']=_0x21b209;return _0x26d7dc;})['then'](respondWithFilteredResult(_0x5bfcab,_0x38f19e))[_0x7033('0x47')](handleError(_0x5bfcab,null));};exports[_0x7033('0x48')]=function(_0x3c164a,_0x4a2343){var _0x3b0516={'raw':![],'where':{'id':_0x3c164a['params']['id']}},_0xda36fa={};_0xda36fa[_0x7033('0x38')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0xda36fa[_0x7033('0x34')]=_[_0x7033('0x35')](_0x3c164a[_0x7033('0x34')]);_0xda36fa[_0x7033('0x36')]=_[_0x7033('0x37')](_0xda36fa[_0x7033('0x38')],_0xda36fa[_0x7033('0x34')]);_0x3b0516[_0x7033('0x39')]=_[_0x7033('0x37')](_0xda36fa['model'],qs[_0x7033('0x3a')](_0x3c164a[_0x7033('0x34')][_0x7033('0x3a')]));_0x3b0516[_0x7033('0x39')]=_0x3b0516[_0x7033('0x39')][_0x7033('0x49')]?_0x3b0516['attributes']:_0xda36fa[_0x7033('0x38')];if(_0x3c164a[_0x7033('0x34')][_0x7033('0x44')]){_0x3b0516['include']=[{'all':!![]}];}_0x3b0516=_['merge']({},_0x3b0516,_0x3c164a[_0x7033('0x42')]);return db['VoiceRecording'][_0x7033('0x4a')](_0x3b0516)[_0x7033('0x43')](handleEntityNotFound(_0x4a2343,null))[_0x7033('0x43')](respondWithResult(_0x4a2343,null))[_0x7033('0x47')](handleError(_0x4a2343,null));};exports[_0x7033('0x4b')]=function(_0xd80032,_0xd2ea08){return db[_0x7033('0x2d')][_0x7033('0x4b')](_0xd80032[_0x7033('0x4c')],{})['then'](respondWithResult(_0xd2ea08,0xc9))[_0x7033('0x47')](handleError(_0xd2ea08,null));};exports[_0x7033('0x4d')]=function(_0x455c21,_0x20e13c){if(_0x455c21[_0x7033('0x4c')]['id']){delete _0x455c21[_0x7033('0x4c')]['id'];}return db[_0x7033('0x2d')][_0x7033('0x4a')]({'where':{'id':_0x455c21[_0x7033('0x4e')]['id']}})[_0x7033('0x43')](handleEntityNotFound(_0x20e13c,null))[_0x7033('0x43')](saveUpdates(_0x455c21[_0x7033('0x4c')],null))['then'](respondWithResult(_0x20e13c,null))[_0x7033('0x47')](handleError(_0x20e13c,null));};exports[_0x7033('0x4f')]=function(_0x392bab,_0x148bbb){return db[_0x7033('0x2d')][_0x7033('0x4f')]()[_0x7033('0x43')](respondWithResult(_0x148bbb,null))[_0x7033('0x47')](handleError(_0x148bbb,null));};exports[_0x7033('0x50')]=function(_0x4f541f,_0x12e7f0,_0x4a04b8){var _0x17adcc=require('../../components/encryptor');var _0xdfc494=![];var _0x475adc={};if(_0x4f541f[_0x7033('0x34')][_0x7033('0x30')]&&_0x4f541f['query'][_0x7033('0x30')]===_0x7033('0x51')){_0x475adc[_0x7033('0x51')]=_0x4f541f[_0x7033('0x4e')]['id'];}else{_0x475adc['id']=_0x4f541f['params']['id'];}return db[_0x7033('0x2d')][_0x7033('0x4a')]({'where':_0x475adc,'attributes':['id',_0x7033('0x52')],'raw':!![]})[_0x7033('0x43')](handleEntityNotFound(_0x12e7f0,null))[_0x7033('0x43')](function(_0x56a1d4){if(_0x56a1d4){var _0x59fb92=_0x56a1d4['value'];var _0x378f7d=util['format'](_0x7033('0x53'),_0x59fb92);if(fs['existsSync'](_0x378f7d)){_0xdfc494=!![];return _0x17adcc[_0x7033('0x54')](_0x378f7d,_0x59fb92,config[_0x7033('0x55')][_0x7033('0x56')])[_0x7033('0x43')](function(){return _0x56a1d4;});}return _0x56a1d4;}})[_0x7033('0x43')](function(_0xd00592){if(_0xd00592){var _0x2631e7=_0xd00592[_0x7033('0x52')];if(!fs[_0x7033('0x57')](_0x2631e7)){throw new db[(_0x7033('0x58'))][(_0x7033('0x59'))](_0x7033('0x5a'));}if(_0xd00592[_0x7033('0x5b')]){return _0x12e7f0[_0x7033('0x50')](_0x2631e7,_0xd00592['filename']+path['extname'](_0x2631e7),function(){if(_0xdfc494){fs[_0x7033('0x5c')](_0x2631e7);}});}else{return _0x12e7f0['download'](_0x2631e7,function(_0x8a47ec){if(_0xdfc494){fs[_0x7033('0x5c')](_0x2631e7);}});}}})[_0x7033('0x47')](function(_0x5614a2){if(_0x5614a2['message']===_0x7033('0x5a')){_0x12e7f0[_0x7033('0x1c')](0x194)[_0x7033('0x2a')]('Not\x20found');}else{return handleError(_0x12e7f0,null);}});};exports['downloads']=function(_0x32a1b2,_0x26328a,_0x5566c3){var _0x68a3ad=require('../../components/encryptor');var _0x4d3a69=![];var _0xddf833={'$and':[db['sequelize'][_0x7033('0x3d')](db[_0x7033('0x5d')]['fn'](_0x7033('0x5e'),db['sequelize'][_0x7033('0x5f')](_0x7033('0x51'))),_0x32a1b2['query'][_0x7033('0x60')])]};if(_0x32a1b2[_0x7033('0x34')][_0x7033('0x30')]&&_0x32a1b2[_0x7033('0x34')][_0x7033('0x30')]===_0x7033('0x51')){_0xddf833['$and'][_0x7033('0x61')]({'uniqueid':_0x32a1b2[_0x7033('0x4e')]['id']});}else{_0xddf833[_0x7033('0x62')][_0x7033('0x61')]({'id':_0x32a1b2[_0x7033('0x4e')]['id']});}return db['VoiceRecording'][_0x7033('0x4a')]({'where':_0xddf833,'attributes':['id',_0x7033('0x52')],'raw':!![]})[_0x7033('0x43')](handleEntityNotFound(_0x26328a,null))['then'](function(_0xadcdda){if(_0xadcdda){var _0x5439a2=util['format'](_0x7033('0x53'),_0xadcdda[_0x7033('0x52')]);if(fs[_0x7033('0x57')](_0x5439a2)){_0x4d3a69=!![];return _0x68a3ad[_0x7033('0x54')](_0x5439a2,_0xadcdda[_0x7033('0x52')],config[_0x7033('0x55')][_0x7033('0x56')])['then'](function(){return _0xadcdda;});}return _0xadcdda;}})[_0x7033('0x43')](function(_0xedb116){if(_0xedb116){if(!fs[_0x7033('0x57')](_0xedb116[_0x7033('0x52')])){throw new db['Sequelize'][(_0x7033('0x59'))](_0x7033('0x5a'));}if(_0xedb116[_0x7033('0x5b')]){return _0x26328a[_0x7033('0x50')](_0xedb116[_0x7033('0x52')],_0xedb116[_0x7033('0x5b')]+path[_0x7033('0x63')](_0xedb116[_0x7033('0x52')]),function(){if(_0x4d3a69){fs[_0x7033('0x5c')](_0xedb116['value']);}});}else{return _0x26328a[_0x7033('0x50')](_0xedb116[_0x7033('0x52')],function(_0x14f080){if(_0x4d3a69){fs[_0x7033('0x5c')](_0xedb116[_0x7033('0x52')]);}});}}})['catch'](handleError(_0x26328a,null));};exports[_0x7033('0x27')]=function(_0x31e04e,_0x1ce926){return db['VoiceRecording']['find']({'where':{'id':_0x31e04e[_0x7033('0x4e')]['id']}})[_0x7033('0x43')](function(_0x20c570){if(_[_0x7033('0x64')](_0x20c570)){throw new ReferenceError(_0x7033('0x65'));}return _0x20c570;})[_0x7033('0x43')](function(_0x583b92){var _0x2ca672=_0x583b92[_0x7033('0x52')];logger[_0x7033('0x66')](_0x7033('0x67'),_0x2ca672);if(!_[_0x7033('0x64')](_0x583b92[_0x7033('0x52')])&&fs[_0x7033('0x57')](_0x2ca672)){logger[_0x7033('0x66')]('File:\x20\x22'+_0x2ca672+_0x7033('0x68'));fs[_0x7033('0x69')](_0x2ca672);}_0x2ca672=_0x2ca672+_0x7033('0x6a');if(!_[_0x7033('0x64')](_0x583b92[_0x7033('0x52')])&&fs[_0x7033('0x57')](_0x2ca672)){logger[_0x7033('0x66')](_0x7033('0x6b')+_0x2ca672+_0x7033('0x68'));fs['unlinkSync'](_0x2ca672);}return _0x583b92;})['then'](function(_0x4c6e49){if(!_0x4c6e49)throw new InternalError();return _0x4c6e49[_0x7033('0x27')]();})['then'](function(){_0x1ce926['status'](0xcc)[_0x7033('0x1d')]();})[_0x7033('0x47')](handleError(_0x1ce926,null));};function getBucketslist(_0xff6674,_0x3d6738,_0x21a94c){return new Promise(function(_0xd75e47,_0x3f16c3){var _0xcd5ad3=new AWS['S3']({'accessKeyId':_0x3d6738,'secretAccessKey':_0xff6674,'region':_0x21a94c});_0xcd5ad3[_0x7033('0x6c')]({},function(_0x3130a6,_0xe70520){if(_0x3130a6){return _0x3f16c3(_0x3130a6);}else{return _0xd75e47(_0xe70520);}});});}function createBucket(_0x1b492f,_0x1fe9ef,_0x2dd1c9,_0x2de766){return new Promise(function(_0x4f0d51,_0x113162){var _0x4cdd9d=new AWS['S3']({'accessKeyId':_0x1fe9ef,'secretAccessKey':_0x1b492f,'region':_0x2dd1c9});_0x4cdd9d[_0x7033('0x6d')]({'Bucket':_0x2de766},function(_0xb2e355,_0x1827fe){if(_0xb2e355){return _0x113162(_0xb2e355);}else{return _0x4f0d51(_0x1827fe);}});});}function uploadFile(_0xf3fd28,_0x23212f,_0x23ac6b,_0x5d8289,_0x7aabda,_0x5c96d4){return new Promise(function(_0x200670,_0x4abb4e){var _0x19bace=new AWS['S3']({'accessKeyId':_0x23212f,'secretAccessKey':_0xf3fd28,'region':_0x23ac6b});_0x19bace[_0x7033('0x6e')]({'Bucket':_0x5d8289,'Key':_0x7aabda,'Body':_0x5c96d4},function(_0x495a20,_0x5582f1){if(_0x495a20){return _0x4abb4e(_0x495a20);}else{return _0x200670(_0x5582f1);}});});}function startTranscribe(_0xf163f1,_0x40a85e,_0x124c4d,_0x732376,_0x539142,_0x85e118){return new Promise(function(_0x1bf389,_0x345604){var _0x54237e=new AWS[(_0x7033('0x6f'))]({'accessKeyId':_0x40a85e,'secretAccessKey':_0xf163f1,'region':_0x124c4d});_0x54237e['startTranscriptionJob']({'TranscriptionJobName':_0x732376,'LanguageCode':_0x539142,'Media':{'MediaFileUri':_0x85e118}},function(_0x2b8d39,_0x5cacb5){if(_0x2b8d39){return _0x345604(_0x2b8d39);}else{return _0x1bf389(_0x5cacb5);}});});}function transcribe(_0x31ac89,_0x2101b9,_0x21f67d,_0x233da5,_0x2d4432,_0x3dc1de,_0xa4a56b){return new Promise(function(_0x85e637,_0x50ed26){var _0x2bd710={};logger[_0x7033('0x66')](util['format'](_0x7033('0x70'),_0x31ac89,_0x2d4432));return uploadFile(_0x2101b9,_0x21f67d,_0x233da5,_0x2d4432,path[_0x7033('0x71')](_0x3dc1de),fs[_0x7033('0x72')](_0x3dc1de))[_0x7033('0x43')](function(_0xc50f09){logger[_0x7033('0x66')](util[_0x7033('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x31ac89,_0x2d4432,_0xc50f09[_0x7033('0x73')]));_0x2bd710[_0x7033('0x74')]=_0xc50f09['Bucket'];_0x2bd710['location']=_0xc50f09[_0x7033('0x73')];logger[_0x7033('0x66')](util[_0x7033('0x33')](_0x7033('0x75'),_0x31ac89));return startTranscribe(_0x2101b9,_0x21f67d,_0x233da5,uuidv4(),_0xa4a56b,_0xc50f09[_0x7033('0x73')]);})[_0x7033('0x43')](function(_0x45acd3){logger[_0x7033('0x66')](util[_0x7033('0x33')](_0x7033('0x76'),_0x31ac89,_0x45acd3[_0x7033('0x77')][_0x7033('0x78')]));_0x2bd710[_0x7033('0x79')]=_0x45acd3[_0x7033('0x77')]['TranscriptionJobName'];_0x2bd710[_0x7033('0x7a')]=_0x45acd3[_0x7033('0x77')]['TranscriptionJobStatus'];return _0x85e637(_0x2bd710);})[_0x7033('0x47')](function(_0x4158aa){return _0x50ed26(_0x4158aa);});});}exports[_0x7033('0x7b')]=function(_0x1d60da,_0x5c46ac,_0x2c8240){var _0x773141;var _0x2160ba;var _0x1de3d7;var _0x55f0b5=require('../../components/encryptor');return db[_0x7033('0x2d')]['findOne']({'where':{'id':_0x1d60da['params']['id']}})[_0x7033('0x43')](function(_0x16b58c){if(_0x16b58c){var _0x331437=util[_0x7033('0x33')](_0x7033('0x53'),_0x16b58c[_0x7033('0x52')]);if(fs[_0x7033('0x57')](_0x331437)){cypher=!![];return _0x55f0b5['decryptFile'](_0x331437,_0x16b58c[_0x7033('0x52')],config[_0x7033('0x55')][_0x7033('0x56')])[_0x7033('0x43')](function(){return _0x16b58c;});}return _0x16b58c;}})[_0x7033('0x43')](function(_0x27eefd){if(!_0x27eefd){throw new db[(_0x7033('0x58'))]['ValidationError'](_0x7033('0x7c'));}_0x2160ba=_0x27eefd;return db[_0x7033('0x7d')][_0x7033('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x5c46ac,null))[_0x7033('0x43')](function(_0x466c0b){if(_0x466c0b){_0x773141=_0x466c0b;if(!_0x773141[_0x7033('0x7f')]||!_0x773141['transcribeAccountId']||!_0x773141['transcribeRegion']||!_0x773141[_0x7033('0x80')]||!_0x773141[_0x7033('0x74')]){throw new db['Sequelize']['ValidationError'](_0x7033('0x81'));}if(_0x1d60da['body'][_0x7033('0x82')]&&(!_0x773141[_0x7033('0x83')]||!_0x773141['sentimentAccountId']||!_0x773141[_0x7033('0x84')]||!_0x773141[_0x7033('0x80')]||!_0x773141[_0x7033('0x74')])){throw new db[(_0x7033('0x58'))]['ValidationError'](_0x7033('0x85'));}return db[_0x7033('0x86')][_0x7033('0x7e')]({'where':{'id':_0x773141[_0x7033('0x87')]}});}})[_0x7033('0x43')](function(_0x1b83c9){if(!_0x1b83c9){throw new db[(_0x7033('0x58'))]['ValidationError'](_0x7033('0x88'));}if(!_0x1b83c9[_0x7033('0x89')]||!_0x1b83c9[_0x7033('0x8a')]){throw new db[(_0x7033('0x58'))][(_0x7033('0x59'))](_0x7033('0x8b'));}_0x1de3d7=_0x1b83c9;return getBucketslist(_0x1de3d7['data1'],_0x1de3d7[_0x7033('0x8a')],_0x773141['transcribeRegion']);})[_0x7033('0x43')](function(_0x141204){if(_0x141204&&_0x141204[_0x7033('0x8c')]){var _0x493781=_['find'](_0x141204[_0x7033('0x8c')],function(_0x2b26ff){return _0x2b26ff[_0x7033('0x8d')]===_0x773141[_0x7033('0x74')];});if(!_0x493781){logger[_0x7033('0x66')](util[_0x7033('0x33')](_0x7033('0x8e'),_0x1d60da[_0x7033('0x4e')]['id'],_0x773141['bucket']));return createBucket(_0x1de3d7['data1'],_0x1de3d7[_0x7033('0x8a')],_0x773141[_0x7033('0x8f')],_0x773141[_0x7033('0x74')]);}logger[_0x7033('0x66')](util[_0x7033('0x33')](_0x7033('0x90'),_0x1d60da[_0x7033('0x4e')]['id'],_0x773141[_0x7033('0x74')]));return;}})['then'](function(_0x383ce9){if(_0x2160ba[_0x7033('0x7a')]===_0x7033('0x91')){return transcribe(_0x1d60da[_0x7033('0x4e')]['id'],_0x1de3d7[_0x7033('0x89')],_0x1de3d7[_0x7033('0x8a')],_0x773141['transcribeRegion'],_0x773141[_0x7033('0x74')],_0x2160ba['value'],_0x773141[_0x7033('0x80')]);}else{logger[_0x7033('0x66')](util[_0x7033('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1d60da[_0x7033('0x4e')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x7033('0x43')](function(_0xce18a8){if(_0xce18a8){_0xce18a8[_0x7033('0x92')]=_0x1d60da[_0x7033('0x4c')][_0x7033('0x82')];return _0x2160ba[_0x7033('0x93')](_0xce18a8);}})['then'](respondWithResult(_0x5c46ac,null))[_0x7033('0x47')](handleError(_0x5c46ac,null));};function writeFile(_0x49b734,_0x508f04){return new Promise(function(_0x40f72b,_0xe4c14d){fs['writeFile'](_0x508f04,_0x49b734,function(_0x383457,_0x501224){if(_0x383457){return _0xe4c14d(_0x383457);}else{return _0x40f72b(_0x501224);}});});}exports[_0x7033('0x94')]=function(_0x566278,_0x4fc5b7,_0x1dee56){return db['VoiceRecording'][_0x7033('0x7e')]({'where':{'id':_0x566278['params']['id']}})[_0x7033('0x43')](handleEntityNotFound(_0x4fc5b7))[_0x7033('0x43')](function(_0x57b46e){if(_0x57b46e&&_0x57b46e[_0x7033('0x95')]){var _0x5b732b=_0x57b46e['fileText'];var _0x5c3483=config[_0x7033('0x96')]+_0x7033('0x97')+_0x57b46e['id']+_0x7033('0x98');if(fs[_0x7033('0x57')](_0x5c3483)){return _0x5c3483;}return writeFile(_0x5b732b,_0x5c3483)['then'](function(){return _0x5c3483;});}else{throw new db['Sequelize'][(_0x7033('0x59'))](_0x7033('0x99'));}})['then'](function(_0x35c6b6){return _0x4fc5b7['download'](_0x35c6b6);})[_0x7033('0x47')](handleError(_0x4fc5b7));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 4bb3425..06644b1 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 _0x2e25=['bluebird','path','./voiceRecording.attributes','VoiceRecording','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x139a4f,_0x5c6d66){var _0x46ed1c=function(_0x1190e4){while(--_0x1190e4){_0x139a4f['push'](_0x139a4f['shift']());}};_0x46ed1c(++_0x5c6d66);}(_0x2e25,0x8c));var _0x52e2=function(_0x5f0ee0,_0x53a226){_0x5f0ee0=_0x5f0ee0-0x0;var _0x428dd0=_0x2e25[_0x5f0ee0];return _0x428dd0;};'use strict';var _=require(_0x52e2('0x0'));var util=require(_0x52e2('0x1'));var logger=require(_0x52e2('0x2'))('api');var moment=require(_0x52e2('0x3'));var BPromise=require(_0x52e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52e2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x52e2('0x6'));module['exports']=function(_0x3a3ec0,_0x48b956){return _0x3a3ec0['define'](_0x52e2('0x7'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x52e2('0x8'),'fields':[_0x52e2('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9db=['request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','voice_recordings','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x23c888,_0x1a2425){var _0x3448d8=function(_0x1e6bf3){while(--_0x1e6bf3){_0x23c888['push'](_0x23c888['shift']());}};_0x3448d8(++_0x1a2425);}(_0xd9db,0x8a));var _0xbd9d=function(_0x3045ab,_0x2eb79e){_0x3045ab=_0x3045ab-0x0;var _0x3143d6=_0xd9db[_0x3045ab];return _0x3143d6;};'use strict';var _=require(_0xbd9d('0x0'));var util=require(_0xbd9d('0x1'));var logger=require('../../config/logger')(_0xbd9d('0x2'));var moment=require(_0xbd9d('0x3'));var BPromise=require(_0xbd9d('0x4'));var rp=require(_0xbd9d('0x5'));var fs=require('fs');var path=require(_0xbd9d('0x6'));var rimraf=require(_0xbd9d('0x7'));var config=require(_0xbd9d('0x8'));var attributes=require(_0xbd9d('0x9'));module[_0xbd9d('0xa')]=function(_0xdbad26,_0x326406){return _0xdbad26['define']('VoiceRecording',attributes,{'tableName':_0xbd9d('0xb'),'paranoid':![],'indexes':[{'name':_0xbd9d('0xc'),'fields':[_0xbd9d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 3fea116..2365c40 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 _0xe2fe=['options','raw','where','attributes','limit','debug','catch','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','recording','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','UpdateVoiceRecording','VoiceRecording','update','body'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});}exports[_0xee2f('0x12')]=function(_0x502eb6){var _0x550da7=this;return new Promise(function(_0x40b5bc,_0x5a5078){return db[_0xee2f('0x13')][_0xee2f('0x14')](_0x502eb6[_0xee2f('0x15')],{'raw':_0x502eb6['options']?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502eb6[_0xee2f('0x16')]?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x18')]||null:null,'attributes':_0x502eb6['options']?_0x502eb6['options'][_0xee2f('0x19')]||null:null,'limit':_0x502eb6[_0xee2f('0x16')]?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x1a')]||null:null})[_0xee2f('0xa')](function(_0xf278cc){logger[_0xee2f('0xb')]('UpdateVoiceRecording',_0x502eb6);logger[_0xee2f('0x1b')](_0xee2f('0x12'),_0x502eb6,JSON[_0xee2f('0xd')](_0xf278cc));_0x40b5bc(_0xf278cc);})[_0xee2f('0x1c')](function(_0x820101){logger[_0xee2f('0xe')](_0xee2f('0x12'),_0x820101[_0xee2f('0xf')],_0x502eb6);_0x5a5078(_0x550da7[_0xee2f('0xe')](0x1f4,_0x820101[_0xee2f('0xf')]));});});};exports[_0xee2f('0x1d')]=function(_0x168adc){var _0x1c8454=this;return new Promise(function(_0x45c4a0,_0x53f6ed){var _0x4ef690=require('../../components/encryptor');var _0x18bdbb;return db[_0xee2f('0x1e')][_0xee2f('0x1f')]({'attributes':['id',_0xee2f('0x20')],'where':{'id':0x1},'raw':!![]})[_0xee2f('0xa')](function(_0x3737fd){_0x18bdbb=_0x3737fd;return db['VoiceRecording'][_0xee2f('0x21')](_0x168adc['body']);})[_0xee2f('0xa')](function(_0x180429){if(_0x18bdbb[_0xee2f('0x20')]&&fs[_0xee2f('0x22')](_0x180429[_0xee2f('0x23')])){var _0x47d5a6=util[_0xee2f('0x24')](_0xee2f('0x25'),_0x180429['value']);return _0x4ef690['encryptFile'](_0x180429[_0xee2f('0x23')],_0x47d5a6,config['secrets'][_0xee2f('0x26')])[_0xee2f('0xa')](function(){fs['unlink'](_0x180429[_0xee2f('0x23')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x180429;});}return _0x180429;})['then'](function(_0x3f1fe8){logger[_0xee2f('0xb')]('CreateVoiceRecording',_0x168adc);logger[_0xee2f('0x1b')](_0xee2f('0x1d'),_0x168adc,JSON[_0xee2f('0xd')](_0x3f1fe8));_0x45c4a0(_0x3f1fe8);})[_0xee2f('0x1c')](function(_0x1c3a01){logger['error'](_0xee2f('0x1d'),_0x1c3a01['message'],_0x168adc);_0x53f6ed(_0x1c8454[_0xee2f('0xe')](0x1f4,_0x1c3a01[_0xee2f('0xf')]));});});}; \ No newline at end of file +var _0x90b1=['request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','limit','then','../../components/encryptor','findOne','callRecordingEncryption','create','existsSync','%s.cypher','encryptFile','value','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0x90b1,0x1bb));var _0x190b=function(_0x58fc2b,_0x368286){_0x58fc2b=_0x58fc2b-0x0;var _0x3937ce=_0x90b1[_0x58fc2b];return _0x3937ce;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});}exports[_0x190b('0x14')]=function(_0x21e458){var _0x56d07a=this;return new Promise(function(_0x16c009,_0x50a3c4){return db[_0x190b('0x15')][_0x190b('0x16')](_0x21e458[_0x190b('0x17')],{'raw':_0x21e458[_0x190b('0x18')]?_0x21e458[_0x190b('0x18')][_0x190b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21e458['options']?_0x21e458[_0x190b('0x18')][_0x190b('0x1a')]||null:null,'attributes':_0x21e458['options']?_0x21e458[_0x190b('0x18')]['attributes']||null:null,'limit':_0x21e458['options']?_0x21e458[_0x190b('0x18')][_0x190b('0x1b')]||null:null})[_0x190b('0x1c')](function(_0x4c0b6e){logger[_0x190b('0x9')](_0x190b('0x14'),_0x21e458);logger[_0x190b('0xc')](_0x190b('0x14'),_0x21e458,JSON[_0x190b('0xe')](_0x4c0b6e));_0x16c009(_0x4c0b6e);})[_0x190b('0x13')](function(_0x1bce97){logger['error']('UpdateVoiceRecording',_0x1bce97[_0x190b('0x11')],_0x21e458);_0x50a3c4(_0x56d07a[_0x190b('0xf')](0x1f4,_0x1bce97['message']));});});};exports['CreateVoiceRecording']=function(_0x3260d5){var _0x4e2a93=this;return new Promise(function(_0x328e5e,_0x3b6aaf){var _0x51f8b4=require(_0x190b('0x1d'));var _0x1deea6;return db['Setting'][_0x190b('0x1e')]({'attributes':['id',_0x190b('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x190b('0x1c')](function(_0x494f3f){_0x1deea6=_0x494f3f;return db['VoiceRecording'][_0x190b('0x20')](_0x3260d5['body']);})[_0x190b('0x1c')](function(_0x19e421){if(_0x1deea6['callRecordingEncryption']&&fs[_0x190b('0x21')](_0x19e421['value'])){var _0x40d060=util['format'](_0x190b('0x22'),_0x19e421['value']);return _0x51f8b4[_0x190b('0x23')](_0x19e421[_0x190b('0x24')],_0x40d060,config['secrets'][_0x190b('0x25')])[_0x190b('0x1c')](function(){fs[_0x190b('0x26')](_0x19e421[_0x190b('0x24')]);logger[_0x190b('0x9')](_0x190b('0x27'));return _0x19e421;});}return _0x19e421;})[_0x190b('0x1c')](function(_0x248919){logger['info']('CreateVoiceRecording',_0x3260d5);logger[_0x190b('0xc')](_0x190b('0x28'),_0x3260d5,JSON['stringify'](_0x248919));_0x328e5e(_0x248919);})[_0x190b('0x13')](function(_0x2dcd39){logger[_0x190b('0xf')](_0x190b('0x28'),_0x2dcd39[_0x190b('0x11')],_0x3260d5);_0x3b6aaf(_0x4e2a93[_0x190b('0xf')](0x1f4,_0x2dcd39[_0x190b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c945f96..8d38de0 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 _0x4747=['/:id','show','create','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x4747,0x132));var _0x7474=function(_0x3a841d,_0x151ba7){_0x3a841d=_0x3a841d-0x0;var _0x55ef7d=_0x4747[_0x3a841d];return _0x55ef7d;};'use strict';var multer=require('multer');var util=require(_0x7474('0x0'));var path=require(_0x7474('0x1'));var timeout=require(_0x7474('0x2'));var express=require(_0x7474('0x3'));var router=express[_0x7474('0x4')]();var fs_extra=require(_0x7474('0x5'));var auth=require(_0x7474('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7474('0x7'));var controller=require(_0x7474('0x8'));router[_0x7474('0x9')]('/',auth[_0x7474('0xa')](),controller[_0x7474('0xb')]);router[_0x7474('0x9')](_0x7474('0xc'),auth[_0x7474('0xa')](),controller[_0x7474('0xd')]);router['get'](_0x7474('0xe'),auth[_0x7474('0xa')](),controller[_0x7474('0xf')]);router['post']('/',auth[_0x7474('0xa')](),controller[_0x7474('0x10')]);router[_0x7474('0x11')](_0x7474('0xe'),auth['isAuthenticated'](),controller[_0x7474('0x12')]);router['delete'](_0x7474('0xe'),auth[_0x7474('0xa')](),controller[_0x7474('0x13')]);module['exports']=router; \ No newline at end of file +var _0xddaf=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','index','get','/describe','describe','isAuthenticated','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x5a9756,_0x2a94c7){var _0x40e0f6=function(_0x45464b){while(--_0x45464b){_0x5a9756['push'](_0x5a9756['shift']());}};_0x40e0f6(++_0x2a94c7);}(_0xddaf,0x13e));var _0xfdda=function(_0x55d5c9,_0x11781b){_0x55d5c9=_0x55d5c9-0x0;var _0x2332b7=_0xddaf[_0x55d5c9];return _0x2332b7;};'use strict';var multer=require(_0xfdda('0x0'));var util=require(_0xfdda('0x1'));var path=require(_0xfdda('0x2'));var timeout=require('connect-timeout');var express=require(_0xfdda('0x3'));var router=express[_0xfdda('0x4')]();var fs_extra=require(_0xfdda('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfdda('0x6'));var config=require(_0xfdda('0x7'));var controller=require(_0xfdda('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfdda('0x9')]);router[_0xfdda('0xa')](_0xfdda('0xb'),auth['isAuthenticated'](),controller[_0xfdda('0xc')]);router[_0xfdda('0xa')]('/:id',auth[_0xfdda('0xd')](),controller['show']);router['post']('/',auth[_0xfdda('0xd')](),controller['create']);router['put'](_0xfdda('0xe'),auth[_0xfdda('0xd')](),controller[_0xfdda('0xf')]);router[_0xfdda('0x10')]('/:id',auth[_0xfdda('0xd')](),controller[_0xfdda('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 0f2a63c..b099b66 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 _0x4ea9=['Yes','sequelize','exports','ENUM','blind','attended','STRING'];(function(_0x4cea31,_0x54ef05){var _0x30bf16=function(_0x1530a7){while(--_0x1530a7){_0x4cea31['push'](_0x4cea31['shift']());}};_0x30bf16(++_0x54ef05);}(_0x4ea9,0x166));var _0x94ea=function(_0x467bc2,_0x327c0c){_0x467bc2=_0x467bc2-0x0;var _0x410429=_0x4ea9[_0x467bc2];return _0x410429;};'use strict';var Sequelize=require(_0x94ea('0x0'));var moment=require('moment');module[_0x94ea('0x1')]={'type':{'type':Sequelize[_0x94ea('0x2')](_0x94ea('0x3'),_0x94ea('0x4'))},'result':{'type':Sequelize[_0x94ea('0x5')]},'transfererchannel':{'type':Sequelize[_0x94ea('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x94ea('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x94ea('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x94ea('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x94ea('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x94ea('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x94ea('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x94ea('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x94ea('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x94ea('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x94ea('0x5')]},'transfereeexten':{'type':Sequelize[_0x94ea('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x94ea('0x5')]},'isexternal':{'type':Sequelize[_0x94ea('0x2')](_0x94ea('0x6'),'No')},'context':{'type':Sequelize[_0x94ea('0x5')]},'extension':{'type':Sequelize[_0x94ea('0x5')]}}; \ No newline at end of file +var _0x0e72=['attended','STRING','sequelize','moment','exports','ENUM','blind'];(function(_0x5270a6,_0x1a157c){var _0x3e1a14=function(_0x3c9e02){while(--_0x3c9e02){_0x5270a6['push'](_0x5270a6['shift']());}};_0x3e1a14(++_0x1a157c);}(_0x0e72,0x121));var _0x20e7=function(_0x353310,_0x426be5){_0x353310=_0x353310-0x0;var _0x571b19=_0x0e72[_0x353310];return _0x571b19;};'use strict';var Sequelize=require(_0x20e7('0x0'));var moment=require(_0x20e7('0x1'));module[_0x20e7('0x2')]={'type':{'type':Sequelize[_0x20e7('0x3')](_0x20e7('0x4'),_0x20e7('0x5'))},'result':{'type':Sequelize[_0x20e7('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x20e7('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x20e7('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x20e7('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x20e7('0x6')]},'transferercontext':{'type':Sequelize[_0x20e7('0x6')]},'transfererexten':{'type':Sequelize[_0x20e7('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x20e7('0x6')]},'transfereechannel':{'type':Sequelize[_0x20e7('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x20e7('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x20e7('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x20e7('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x20e7('0x6')]},'transfereecontext':{'type':Sequelize[_0x20e7('0x6')]},'transfereeexten':{'type':Sequelize[_0x20e7('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x20e7('0x6')]},'isexternal':{'type':Sequelize[_0x20e7('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x20e7('0x6')]},'extension':{'type':Sequelize[_0x20e7('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index a908055..ed6bc43 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 _0xfac7=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VoiceTransferReport','includeAll','include','rows','show','catch','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','ioredis'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xfac7,0x1b9));var _0x7fac=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0xfac7[_0x46428c];return _0x16a677;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fac('0x0'));var zipdir=require(_0x7fac('0x1'));var jsonpatch=require(_0x7fac('0x2'));var rp=require(_0x7fac('0x3'));var moment=require(_0x7fac('0x4'));var BPromise=require(_0x7fac('0x5'));var Mustache=require('mustache');var util=require(_0x7fac('0x6'));var path=require(_0x7fac('0x7'));var sox=require(_0x7fac('0x8'));var csv=require(_0x7fac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fac('0xa'));var _=require('lodash');var squel=require(_0x7fac('0xb'));var crypto=require('crypto');var jsforce=require(_0x7fac('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7fac('0x9'));var querystring=require(_0x7fac('0xd'));var Papa=require('papaparse');var Redis=require(_0x7fac('0xe'));var authService=require(_0x7fac('0xf'));var qs=require(_0x7fac('0x10'));var as=require(_0x7fac('0x11'));var hardwareService=require(_0x7fac('0x12'));var logger=require(_0x7fac('0x13'))(_0x7fac('0x14'));var utils=require(_0x7fac('0x15'));var config=require(_0x7fac('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fac('0x17'))['db'];function respondWithStatusCode(_0x2cd252,_0x187187){_0x187187=_0x187187||0xcc;return function(_0x46058c){if(_0x46058c){return _0x2cd252[_0x7fac('0x18')](_0x187187);}return _0x2cd252[_0x7fac('0x19')](_0x187187)[_0x7fac('0x1a')]();};}function respondWithResult(_0x5697f0,_0x37f497){_0x37f497=_0x37f497||0xc8;return function(_0x2058d){if(_0x2058d){return _0x5697f0['status'](_0x37f497)[_0x7fac('0x1b')](_0x2058d);}};}function respondWithFilteredResult(_0x241f4b,_0x3afd7e){return function(_0x2042d5){if(_0x2042d5){var _0x28bded=typeof _0x3afd7e[_0x7fac('0x1c')]===_0x7fac('0x1d')&&typeof _0x3afd7e[_0x7fac('0x1e')]==='undefined';var _0x10d643=_0x2042d5[_0x7fac('0x1f')];var _0x1747b5=_0x28bded?0x0:_0x3afd7e[_0x7fac('0x1c')];var _0x559fa5=_0x28bded?_0x2042d5['count']:_0x3afd7e[_0x7fac('0x1c')]+_0x3afd7e['limit'];var _0x437952;if(_0x559fa5>=_0x10d643){_0x559fa5=_0x10d643;_0x437952=0xc8;}else{_0x437952=0xce;}_0x241f4b[_0x7fac('0x19')](_0x437952);return _0x241f4b[_0x7fac('0x20')](_0x7fac('0x21'),_0x1747b5+'-'+_0x559fa5+'/'+_0x10d643)[_0x7fac('0x1b')](_0x2042d5);}return null;};}function patchUpdates(_0x3c4cd2){return function(_0x25a0c1){try{jsonpatch[_0x7fac('0x22')](_0x25a0c1,_0x3c4cd2,!![]);}catch(_0x193c17){return BPromise[_0x7fac('0x23')](_0x193c17);}return _0x25a0c1['save']();};}function saveUpdates(_0x37b097,_0x13f745){return function(_0x4dcdf1){if(_0x4dcdf1){return _0x4dcdf1[_0x7fac('0x24')](_0x37b097)[_0x7fac('0x25')](function(_0x2caf2f){return _0x2caf2f;});}return null;};}function removeEntity(_0x2fa433,_0x52eeb8){return function(_0x56fa60){if(_0x56fa60){return _0x56fa60[_0x7fac('0x26')]()['then'](function(){_0x2fa433[_0x7fac('0x19')](0xcc)[_0x7fac('0x1a')]();});}};}function handleEntityNotFound(_0x2de7ee,_0x5e9e6d){return function(_0x341218){if(!_0x341218){_0x2de7ee[_0x7fac('0x18')](0x194);}return _0x341218;};}function handleError(_0x4e579e,_0x55e053){_0x55e053=_0x55e053||0x1f4;return function(_0x275eb5){logger[_0x7fac('0x27')](_0x275eb5[_0x7fac('0x28')]);if(_0x275eb5[_0x7fac('0x29')]){delete _0x275eb5[_0x7fac('0x29')];}_0x4e579e[_0x7fac('0x19')](_0x55e053)[_0x7fac('0x2a')](_0x275eb5);};}exports[_0x7fac('0x2b')]=function(_0x41f365,_0x3b66a3){var _0x18f64e={},_0x474378={},_0xac0316={'count':0x0,'rows':[]};var _0x40c3ac=_[_0x7fac('0x2c')](db['VoiceTransferReport'][_0x7fac('0x2d')],function(_0x9caacb){return{'name':_0x9caacb[_0x7fac('0x2e')],'type':_0x9caacb[_0x7fac('0x2f')][_0x7fac('0x30')]};});_0x474378[_0x7fac('0x31')]=_[_0x7fac('0x2c')](_0x40c3ac,'name');_0x474378['query']=_[_0x7fac('0x32')](_0x41f365[_0x7fac('0x33')]);_0x474378[_0x7fac('0x34')]=_[_0x7fac('0x35')](_0x474378['model'],_0x474378[_0x7fac('0x33')]);_0x18f64e[_0x7fac('0x36')]=_[_0x7fac('0x35')](_0x474378['model'],qs[_0x7fac('0x37')](_0x41f365[_0x7fac('0x33')][_0x7fac('0x37')]));_0x18f64e[_0x7fac('0x36')]=_0x18f64e[_0x7fac('0x36')][_0x7fac('0x38')]?_0x18f64e[_0x7fac('0x36')]:_0x474378['model'];if(!_0x41f365[_0x7fac('0x33')][_0x7fac('0x39')](_0x7fac('0x3a'))){_0x18f64e[_0x7fac('0x1e')]=qs['limit'](_0x41f365[_0x7fac('0x33')]['limit']);_0x18f64e[_0x7fac('0x1c')]=qs[_0x7fac('0x1c')](_0x41f365[_0x7fac('0x33')][_0x7fac('0x1c')]);}_0x18f64e[_0x7fac('0x3b')]=qs[_0x7fac('0x3c')](_0x41f365[_0x7fac('0x33')][_0x7fac('0x3c')]);_0x18f64e[_0x7fac('0x3d')]=qs['filters'](_['pick'](_0x41f365[_0x7fac('0x33')],_0x474378[_0x7fac('0x34')]),_0x40c3ac);if(_0x41f365[_0x7fac('0x33')][_0x7fac('0x3e')]){_0x18f64e[_0x7fac('0x3d')]=_[_0x7fac('0x3f')](_0x18f64e[_0x7fac('0x3d')],{'$or':_['map'](_0x40c3ac,function(_0x40ae61){if(_0x40ae61[_0x7fac('0x2f')]!=='VIRTUAL'){var _0x374fdb={};_0x374fdb[_0x40ae61[_0x7fac('0x29')]]={'$like':'%'+_0x41f365[_0x7fac('0x33')][_0x7fac('0x3e')]+'%'};return _0x374fdb;}})});}_0x18f64e=_[_0x7fac('0x3f')]({},_0x18f64e,_0x41f365[_0x7fac('0x40')]);var _0x2ff6a4={'where':_0x18f64e[_0x7fac('0x3d')]};return db[_0x7fac('0x41')]['count'](_0x2ff6a4)[_0x7fac('0x25')](function(_0x242cbb){_0xac0316['count']=_0x242cbb;if(_0x41f365[_0x7fac('0x33')][_0x7fac('0x42')]){_0x18f64e[_0x7fac('0x43')]=[{'all':!![]}];}return db[_0x7fac('0x41')]['findAll'](_0x18f64e);})[_0x7fac('0x25')](function(_0x1dcce7){_0xac0316[_0x7fac('0x44')]=_0x1dcce7;return _0xac0316;})['then'](respondWithFilteredResult(_0x3b66a3,_0x18f64e))['catch'](handleError(_0x3b66a3,null));};exports[_0x7fac('0x45')]=function(_0x599715,_0x33aa38){var _0x5e9b7e={'raw':!![],'where':{'id':_0x599715['params']['id']}},_0x423cc7={};_0x423cc7[_0x7fac('0x31')]=_[_0x7fac('0x32')](db[_0x7fac('0x41')][_0x7fac('0x2d')]);_0x423cc7['query']=_['keys'](_0x599715[_0x7fac('0x33')]);_0x423cc7['filters']=_[_0x7fac('0x35')](_0x423cc7[_0x7fac('0x31')],_0x423cc7[_0x7fac('0x33')]);_0x5e9b7e[_0x7fac('0x36')]=_[_0x7fac('0x35')](_0x423cc7['model'],qs[_0x7fac('0x37')](_0x599715[_0x7fac('0x33')][_0x7fac('0x37')]));_0x5e9b7e[_0x7fac('0x36')]=_0x5e9b7e[_0x7fac('0x36')][_0x7fac('0x38')]?_0x5e9b7e[_0x7fac('0x36')]:_0x423cc7['model'];if(_0x599715[_0x7fac('0x33')][_0x7fac('0x42')]){_0x5e9b7e['include']=[{'all':!![]}];}_0x5e9b7e=_[_0x7fac('0x3f')]({},_0x5e9b7e,_0x599715[_0x7fac('0x40')]);return db['VoiceTransferReport']['find'](_0x5e9b7e)[_0x7fac('0x25')](handleEntityNotFound(_0x33aa38,null))['then'](respondWithResult(_0x33aa38,null))[_0x7fac('0x46')](handleError(_0x33aa38,null));};exports[_0x7fac('0x47')]=function(_0x4c77ca,_0x4fc04c){return db['VoiceTransferReport'][_0x7fac('0x47')](_0x4c77ca[_0x7fac('0x48')],{})[_0x7fac('0x25')](respondWithResult(_0x4fc04c,0xc9))[_0x7fac('0x46')](handleError(_0x4fc04c,null));};exports[_0x7fac('0x24')]=function(_0x157123,_0x39c21f){if(_0x157123[_0x7fac('0x48')]['id']){delete _0x157123[_0x7fac('0x48')]['id'];}return db[_0x7fac('0x41')][_0x7fac('0x49')]({'where':{'id':_0x157123[_0x7fac('0x4a')]['id']}})[_0x7fac('0x25')](handleEntityNotFound(_0x39c21f,null))[_0x7fac('0x25')](saveUpdates(_0x157123['body'],null))[_0x7fac('0x25')](respondWithResult(_0x39c21f,null))[_0x7fac('0x46')](handleError(_0x39c21f,null));};exports[_0x7fac('0x26')]=function(_0x4a644e,_0x4ee769){return db[_0x7fac('0x41')]['find']({'where':{'id':_0x4a644e['params']['id']}})[_0x7fac('0x25')](handleEntityNotFound(_0x4ee769,null))[_0x7fac('0x25')](removeEntity(_0x4ee769,null))[_0x7fac('0x46')](handleError(_0x4ee769,null));};exports[_0x7fac('0x4b')]=function(_0x1b2a7e,_0x20ed34){return db[_0x7fac('0x41')][_0x7fac('0x4b')]()['then'](respondWithResult(_0x20ed34,null))['catch'](handleError(_0x20ed34,null));}; \ No newline at end of file +var _0xb523=['where','filters','pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','find','create','update','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','model','map','query','attributes','intersection','fields','length','nolimit','order','sort'];(function(_0x285a67,_0x13833d){var _0x1947c3=function(_0x4f8b77){while(--_0x4f8b77){_0x285a67['push'](_0x285a67['shift']());}};_0x1947c3(++_0x13833d);}(_0xb523,0x14e));var _0x3b52=function(_0x2368bb,_0x3fc8ad){_0x2368bb=_0x2368bb-0x0;var _0x36d247=_0xb523[_0x2368bb];return _0x36d247;};'use strict';var emlformat=require(_0x3b52('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3b52('0x1'));var rp=require(_0x3b52('0x2'));var moment=require(_0x3b52('0x3'));var BPromise=require(_0x3b52('0x4'));var Mustache=require(_0x3b52('0x5'));var util=require(_0x3b52('0x6'));var path=require(_0x3b52('0x7'));var sox=require('sox');var csv=require(_0x3b52('0x8'));var ejs=require(_0x3b52('0x9'));var fs=require('fs');var fs_extra=require(_0x3b52('0xa'));var _=require(_0x3b52('0xb'));var squel=require(_0x3b52('0xc'));var crypto=require('crypto');var jsforce=require(_0x3b52('0xd'));var deskjs=require(_0x3b52('0xe'));var toCsv=require(_0x3b52('0x8'));var querystring=require(_0x3b52('0xf'));var Papa=require(_0x3b52('0x10'));var Redis=require(_0x3b52('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3b52('0x12'));var as=require(_0x3b52('0x13'));var hardwareService=require(_0x3b52('0x14'));var logger=require(_0x3b52('0x15'))(_0x3b52('0x16'));var utils=require(_0x3b52('0x17'));var config=require(_0x3b52('0x18'));var licenseUtil=require(_0x3b52('0x19'));var db=require(_0x3b52('0x1a'))['db'];function respondWithStatusCode(_0x4b515e,_0x354398){_0x354398=_0x354398||0xcc;return function(_0x501c4c){if(_0x501c4c){return _0x4b515e[_0x3b52('0x1b')](_0x354398);}return _0x4b515e['status'](_0x354398)[_0x3b52('0x1c')]();};}function respondWithResult(_0x1ce7b5,_0x3d5a43){_0x3d5a43=_0x3d5a43||0xc8;return function(_0x3427a6){if(_0x3427a6){return _0x1ce7b5[_0x3b52('0x1d')](_0x3d5a43)[_0x3b52('0x1e')](_0x3427a6);}};}function respondWithFilteredResult(_0x5b80a7,_0x100fcb){return function(_0x3d11ce){if(_0x3d11ce){var _0x3a8a18=typeof _0x100fcb[_0x3b52('0x1f')]===_0x3b52('0x20')&&typeof _0x100fcb[_0x3b52('0x21')]==='undefined';var _0x209ba3=_0x3d11ce[_0x3b52('0x22')];var _0x3d6b3a=_0x3a8a18?0x0:_0x100fcb[_0x3b52('0x1f')];var _0x23ca54=_0x3a8a18?_0x3d11ce[_0x3b52('0x22')]:_0x100fcb[_0x3b52('0x1f')]+_0x100fcb[_0x3b52('0x21')];var _0x317a20;if(_0x23ca54>=_0x209ba3){_0x23ca54=_0x209ba3;_0x317a20=0xc8;}else{_0x317a20=0xce;}_0x5b80a7['status'](_0x317a20);return _0x5b80a7['set']('Content-Range',_0x3d6b3a+'-'+_0x23ca54+'/'+_0x209ba3)['json'](_0x3d11ce);}return null;};}function patchUpdates(_0x24b6a4){return function(_0x1c300f){try{jsonpatch['apply'](_0x1c300f,_0x24b6a4,!![]);}catch(_0x2cbe63){return BPromise[_0x3b52('0x23')](_0x2cbe63);}return _0x1c300f[_0x3b52('0x24')]();};}function saveUpdates(_0x4b4242,_0x5a3602){return function(_0x86dfe1){if(_0x86dfe1){return _0x86dfe1['update'](_0x4b4242)['then'](function(_0x17d2ba){return _0x17d2ba;});}return null;};}function removeEntity(_0x173531,_0xd0777){return function(_0x339ed3){if(_0x339ed3){return _0x339ed3[_0x3b52('0x25')]()['then'](function(){_0x173531['status'](0xcc)[_0x3b52('0x1c')]();});}};}function handleEntityNotFound(_0x3eedda,_0x56369f){return function(_0x9094cb){if(!_0x9094cb){_0x3eedda['sendStatus'](0x194);}return _0x9094cb;};}function handleError(_0x4b4b25,_0x5674aa){_0x5674aa=_0x5674aa||0x1f4;return function(_0x16a8d5){logger[_0x3b52('0x26')](_0x16a8d5[_0x3b52('0x27')]);if(_0x16a8d5[_0x3b52('0x28')]){delete _0x16a8d5[_0x3b52('0x28')];}_0x4b4b25[_0x3b52('0x1d')](_0x5674aa)[_0x3b52('0x29')](_0x16a8d5);};}exports[_0x3b52('0x2a')]=function(_0x4296b0,_0x44cf00){var _0x1f4c63={},_0x238220={},_0x218c95={'count':0x0,'rows':[]};var _0x399ceb=_['map'](db[_0x3b52('0x2b')]['rawAttributes'],function(_0x137f2d){return{'name':_0x137f2d[_0x3b52('0x2c')],'type':_0x137f2d[_0x3b52('0x2d')]['key']};});_0x238220[_0x3b52('0x2e')]=_[_0x3b52('0x2f')](_0x399ceb,'name');_0x238220[_0x3b52('0x30')]=_['keys'](_0x4296b0[_0x3b52('0x30')]);_0x238220['filters']=_['intersection'](_0x238220[_0x3b52('0x2e')],_0x238220[_0x3b52('0x30')]);_0x1f4c63[_0x3b52('0x31')]=_[_0x3b52('0x32')](_0x238220[_0x3b52('0x2e')],qs[_0x3b52('0x33')](_0x4296b0[_0x3b52('0x30')][_0x3b52('0x33')]));_0x1f4c63[_0x3b52('0x31')]=_0x1f4c63[_0x3b52('0x31')][_0x3b52('0x34')]?_0x1f4c63[_0x3b52('0x31')]:_0x238220[_0x3b52('0x2e')];if(!_0x4296b0[_0x3b52('0x30')]['hasOwnProperty'](_0x3b52('0x35'))){_0x1f4c63['limit']=qs[_0x3b52('0x21')](_0x4296b0[_0x3b52('0x30')][_0x3b52('0x21')]);_0x1f4c63['offset']=qs['offset'](_0x4296b0['query'][_0x3b52('0x1f')]);}_0x1f4c63[_0x3b52('0x36')]=qs['sort'](_0x4296b0[_0x3b52('0x30')][_0x3b52('0x37')]);_0x1f4c63[_0x3b52('0x38')]=qs[_0x3b52('0x39')](_[_0x3b52('0x3a')](_0x4296b0[_0x3b52('0x30')],_0x238220[_0x3b52('0x39')]),_0x399ceb);if(_0x4296b0[_0x3b52('0x30')][_0x3b52('0x3b')]){_0x1f4c63['where']=_['merge'](_0x1f4c63[_0x3b52('0x38')],{'$or':_['map'](_0x399ceb,function(_0x14649){if(_0x14649[_0x3b52('0x2d')]!==_0x3b52('0x3c')){var _0x250a48={};_0x250a48[_0x14649[_0x3b52('0x28')]]={'$like':'%'+_0x4296b0[_0x3b52('0x30')][_0x3b52('0x3b')]+'%'};return _0x250a48;}})});}_0x1f4c63=_[_0x3b52('0x3d')]({},_0x1f4c63,_0x4296b0[_0x3b52('0x3e')]);var _0x224b20={'where':_0x1f4c63[_0x3b52('0x38')]};return db[_0x3b52('0x2b')][_0x3b52('0x22')](_0x224b20)[_0x3b52('0x3f')](function(_0x574eba){_0x218c95['count']=_0x574eba;if(_0x4296b0['query']['includeAll']){_0x1f4c63[_0x3b52('0x40')]=[{'all':!![]}];}return db[_0x3b52('0x2b')][_0x3b52('0x41')](_0x1f4c63);})[_0x3b52('0x3f')](function(_0x5bfbc3){_0x218c95[_0x3b52('0x42')]=_0x5bfbc3;return _0x218c95;})[_0x3b52('0x3f')](respondWithFilteredResult(_0x44cf00,_0x1f4c63))[_0x3b52('0x43')](handleError(_0x44cf00,null));};exports[_0x3b52('0x44')]=function(_0x648907,_0x27c613){var _0x2cd08d={'raw':!![],'where':{'id':_0x648907['params']['id']}},_0x1b44df={};_0x1b44df[_0x3b52('0x2e')]=_[_0x3b52('0x45')](db['VoiceTransferReport'][_0x3b52('0x46')]);_0x1b44df['query']=_[_0x3b52('0x45')](_0x648907[_0x3b52('0x30')]);_0x1b44df['filters']=_['intersection'](_0x1b44df[_0x3b52('0x2e')],_0x1b44df[_0x3b52('0x30')]);_0x2cd08d[_0x3b52('0x31')]=_['intersection'](_0x1b44df[_0x3b52('0x2e')],qs['fields'](_0x648907[_0x3b52('0x30')][_0x3b52('0x33')]));_0x2cd08d[_0x3b52('0x31')]=_0x2cd08d[_0x3b52('0x31')]['length']?_0x2cd08d[_0x3b52('0x31')]:_0x1b44df['model'];if(_0x648907[_0x3b52('0x30')][_0x3b52('0x47')]){_0x2cd08d[_0x3b52('0x40')]=[{'all':!![]}];}_0x2cd08d=_[_0x3b52('0x3d')]({},_0x2cd08d,_0x648907['options']);return db[_0x3b52('0x2b')][_0x3b52('0x48')](_0x2cd08d)[_0x3b52('0x3f')](handleEntityNotFound(_0x27c613,null))[_0x3b52('0x3f')](respondWithResult(_0x27c613,null))[_0x3b52('0x43')](handleError(_0x27c613,null));};exports[_0x3b52('0x49')]=function(_0x3a9e5b,_0x5084ed){return db[_0x3b52('0x2b')][_0x3b52('0x49')](_0x3a9e5b['body'],{})[_0x3b52('0x3f')](respondWithResult(_0x5084ed,0xc9))['catch'](handleError(_0x5084ed,null));};exports[_0x3b52('0x4a')]=function(_0x5a9320,_0x241f32){if(_0x5a9320[_0x3b52('0x4b')]['id']){delete _0x5a9320[_0x3b52('0x4b')]['id'];}return db[_0x3b52('0x2b')][_0x3b52('0x48')]({'where':{'id':_0x5a9320[_0x3b52('0x4c')]['id']}})[_0x3b52('0x3f')](handleEntityNotFound(_0x241f32,null))[_0x3b52('0x3f')](saveUpdates(_0x5a9320[_0x3b52('0x4b')],null))[_0x3b52('0x3f')](respondWithResult(_0x241f32,null))[_0x3b52('0x43')](handleError(_0x241f32,null));};exports['destroy']=function(_0x255ddb,_0x221ca8){return db[_0x3b52('0x2b')][_0x3b52('0x48')]({'where':{'id':_0x255ddb['params']['id']}})[_0x3b52('0x3f')](handleEntityNotFound(_0x221ca8,null))[_0x3b52('0x3f')](removeEntity(_0x221ca8,null))[_0x3b52('0x43')](handleError(_0x221ca8,null));};exports['describe']=function(_0x17d867,_0xfd4024){return db[_0x3b52('0x2b')][_0x3b52('0x4d')]()['then'](respondWithResult(_0xfd4024,null))[_0x3b52('0x43')](handleError(_0xfd4024,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1f1da1e..f8d98a9 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 _0x8ad3=['../../config/logger','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x120d46,_0x11a679){var _0x52d025=function(_0x1e49fc){while(--_0x1e49fc){_0x120d46['push'](_0x120d46['shift']());}};_0x52d025(++_0x11a679);}(_0x8ad3,0x1c6));var _0x38ad=function(_0x10abe2,_0x43c1c2){_0x10abe2=_0x10abe2-0x0;var _0x4bad1f=_0x8ad3[_0x10abe2];return _0x4bad1f;};'use strict';var _=require(_0x38ad('0x0'));var util=require(_0x38ad('0x1'));var logger=require(_0x38ad('0x2'))('api');var moment=require('moment');var BPromise=require(_0x38ad('0x3'));var rp=require(_0x38ad('0x4'));var fs=require('fs');var path=require(_0x38ad('0x5'));var rimraf=require(_0x38ad('0x6'));var config=require('../../config/environment');var attributes=require(_0x38ad('0x7'));module[_0x38ad('0x8')]=function(_0x8cbea9,_0x410f6f){return _0x8cbea9[_0x38ad('0x9')](_0x38ad('0xa'),attributes,{'tableName':_0x38ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc7b=['request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','moment','bluebird'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xfc7b,0x74));var _0xbfc7=function(_0x3557f2,_0x2d5a90){_0x3557f2=_0x3557f2-0x0;var _0x29169a=_0xfc7b[_0x3557f2];return _0x29169a;};'use strict';var _=require(_0xbfc7('0x0'));var util=require('util');var logger=require(_0xbfc7('0x1'))('api');var moment=require(_0xbfc7('0x2'));var BPromise=require(_0xbfc7('0x3'));var rp=require(_0xbfc7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfc7('0x5'));var config=require(_0xbfc7('0x6'));var attributes=require(_0xbfc7('0x7'));module[_0xbfc7('0x8')]=function(_0x49af64,_0x4b0d6b){return _0x49af64[_0xbfc7('0x9')](_0xbfc7('0xa'),attributes,{'tableName':_0xbfc7('0xb'),'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 5d55ef1..13ceba1 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 _0x2a22=['create','body','options','raw','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','CreateVoiceTransferReport'];(function(_0x3cacc2,_0xb9dba9){var _0x33ed1f=function(_0x26dbca){while(--_0x26dbca){_0x3cacc2['push'](_0x3cacc2['shift']());}};_0x33ed1f(++_0xb9dba9);}(_0x2a22,0x7d));var _0x22a2=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x2a22[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require(_0x22a2('0x0'));var moment=require(_0x22a2('0x1'));var BPromise=require(_0x22a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22a2('0x3'));var db=require(_0x22a2('0x4'))['db'];var utils=require(_0x22a2('0x5'));var logger=require('../../config/logger')(_0x22a2('0x6'));var config=require(_0x22a2('0x7'));var jayson=require(_0x22a2('0x8'));var client=jayson['client'][_0x22a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bb026,_0x2e3ae7,_0x5cebfc){return new BPromise(function(_0x53bbc5,_0x5d8d04){return client[_0x22a2('0xa')](_0x5bb026,_0x5cebfc)[_0x22a2('0xb')](function(_0x2a3821){logger[_0x22a2('0xc')](_0x22a2('0xd'),_0x2e3ae7,_0x22a2('0xe'));logger['debug'](_0x22a2('0xf'),_0x2e3ae7,_0x22a2('0xe'),JSON['stringify'](_0x2a3821));if(_0x2a3821[_0x22a2('0x10')]){if(_0x2a3821[_0x22a2('0x10')]['code']===0x1f4){logger[_0x22a2('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e3ae7,_0x2a3821['error'][_0x22a2('0x11')]);return _0x5d8d04(_0x2a3821['error'][_0x22a2('0x11')]);}logger[_0x22a2('0x10')](_0x22a2('0xd'),_0x2e3ae7,_0x2a3821[_0x22a2('0x10')][_0x22a2('0x11')]);return _0x53bbc5(_0x2a3821[_0x22a2('0x10')][_0x22a2('0x11')]);}else{logger[_0x22a2('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e3ae7,_0x22a2('0xe'));_0x53bbc5(_0x2a3821['result']['message']);}})['catch'](function(_0x3cd678){logger[_0x22a2('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e3ae7,_0x3cd678);_0x5d8d04(_0x3cd678);});});}exports[_0x22a2('0x12')]=function(_0x350cea){var _0x277409=this;return new Promise(function(_0x429e83,_0x47c031){return db['VoiceTransferReport'][_0x22a2('0x13')](_0x350cea[_0x22a2('0x14')],{'raw':_0x350cea[_0x22a2('0x15')]?_0x350cea[_0x22a2('0x15')][_0x22a2('0x16')]===undefined?!![]:![]:!![]})[_0x22a2('0xb')](function(_0x13b9e2){logger[_0x22a2('0xc')](_0x22a2('0x12'),_0x350cea);logger['debug'](_0x22a2('0x12'),_0x350cea,JSON['stringify'](_0x13b9e2));_0x429e83(_0x13b9e2);})[_0x22a2('0x17')](function(_0x1458ed){logger[_0x22a2('0x10')](_0x22a2('0x12'),_0x1458ed[_0x22a2('0x11')],_0x350cea);_0x47c031(_0x277409[_0x22a2('0x10')](0x1f4,_0x1458ed[_0x22a2('0x11')]));});});}; \ No newline at end of file +var _0x47b8=['VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceTransferReport','body','options','CreateVoiceTransferReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x5710c9,_0x44780c){var _0x5dd2d5=function(_0x51213d){while(--_0x51213d){_0x5710c9['push'](_0x5710c9['shift']());}};_0x5dd2d5(++_0x44780c);}(_0x47b8,0x94));var _0x847b=function(_0x4a9e1a,_0x501dff){_0x4a9e1a=_0x4a9e1a-0x0;var _0x48d73f=_0x47b8[_0x4a9e1a];return _0x48d73f;};'use strict';var _=require('lodash');var util=require(_0x847b('0x0'));var moment=require('moment');var BPromise=require(_0x847b('0x1'));var rs=require(_0x847b('0x2'));var fs=require('fs');var Redis=require(_0x847b('0x3'));var db=require(_0x847b('0x4'))['db'];var utils=require(_0x847b('0x5'));var logger=require(_0x847b('0x6'))(_0x847b('0x7'));var config=require(_0x847b('0x8'));var jayson=require(_0x847b('0x9'));var client=jayson[_0x847b('0xa')][_0x847b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x195c87,_0x4c84ca,_0x3ef957){return new BPromise(function(_0x4a67f1,_0x1fb408){return client['request'](_0x195c87,_0x3ef957)[_0x847b('0xc')](function(_0x39d273){logger[_0x847b('0xd')](_0x847b('0xe'),_0x4c84ca,'request\x20sent');logger[_0x847b('0xf')](_0x847b('0x10'),_0x4c84ca,_0x847b('0x11'),JSON[_0x847b('0x12')](_0x39d273));if(_0x39d273[_0x847b('0x13')]){if(_0x39d273[_0x847b('0x13')][_0x847b('0x14')]===0x1f4){logger[_0x847b('0x13')](_0x847b('0xe'),_0x4c84ca,_0x39d273['error'][_0x847b('0x15')]);return _0x1fb408(_0x39d273[_0x847b('0x13')][_0x847b('0x15')]);}logger[_0x847b('0x13')](_0x847b('0xe'),_0x4c84ca,_0x39d273[_0x847b('0x13')][_0x847b('0x15')]);return _0x4a67f1(_0x39d273['error']['message']);}else{logger[_0x847b('0xd')](_0x847b('0xe'),_0x4c84ca,'request\x20sent');_0x4a67f1(_0x39d273['result'][_0x847b('0x15')]);}})[_0x847b('0x16')](function(_0x35b265){logger[_0x847b('0x13')](_0x847b('0xe'),_0x4c84ca,_0x35b265);_0x1fb408(_0x35b265);});});}exports['CreateVoiceTransferReport']=function(_0x58fe0d){var _0x36b4d1=this;return new Promise(function(_0x4f9dac,_0x2dd893){return db[_0x847b('0x17')]['create'](_0x58fe0d[_0x847b('0x18')],{'raw':_0x58fe0d[_0x847b('0x19')]?_0x58fe0d[_0x847b('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x847b('0xc')](function(_0x32e905){logger[_0x847b('0xd')](_0x847b('0x1a'),_0x58fe0d);logger[_0x847b('0xf')](_0x847b('0x1a'),_0x58fe0d,JSON[_0x847b('0x12')](_0x32e905));_0x4f9dac(_0x32e905);})['catch'](function(_0x627e52){logger[_0x847b('0x13')](_0x847b('0x1a'),_0x627e52['message'],_0x58fe0d);_0x2dd893(_0x36b4d1[_0x847b('0x13')](0x1f4,_0x627e52[_0x847b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 98d517c..c07ee0e 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 _0x792e=['answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','exports','express','Router','../../components/auth/service','/originate','isAuthenticated','canUpdate','post','/answer'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x792e,0x15d));var _0xe792=function(_0xf81435,_0x1a1f00){_0xf81435=_0xf81435-0x0;var _0x2c1b13=_0x792e[_0xf81435];return _0x2c1b13;};'use strict';var express=require(_0xe792('0x0'));var router=express[_0xe792('0x1')]();var auth=require(_0xe792('0x2'));var controller=require('./webbar.controller');router['post'](_0xe792('0x3'),auth[_0xe792('0x4')](),auth[_0xe792('0x5')](),controller['originate']);router[_0xe792('0x6')]('/hangup',auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router[_0xe792('0x6')](_0xe792('0x7'),auth[_0xe792('0x4')](),auth[_0xe792('0x5')](),controller[_0xe792('0x8')]);router[_0xe792('0x6')](_0xe792('0x9'),auth[_0xe792('0x4')](),auth[_0xe792('0x5')](),controller[_0xe792('0xa')]);router[_0xe792('0x6')](_0xe792('0xb'),auth[_0xe792('0x4')](),auth[_0xe792('0x5')](),controller[_0xe792('0xc')]);router[_0xe792('0x6')](_0xe792('0xd'),auth[_0xe792('0x4')](),auth[_0xe792('0x5')](),controller[_0xe792('0xe')]);router['post'](_0xe792('0xf'),auth[_0xe792('0x4')](),auth['canUpdate'](),controller['transfer']);module[_0xe792('0x10')]=router; \ No newline at end of file +var _0x9e04=['/hangup','answer','hold','/unhold','unhold','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate'];(function(_0x363876,_0x1359e2){var _0x3cb88e=function(_0x510281){while(--_0x510281){_0x363876['push'](_0x363876['shift']());}};_0x3cb88e(++_0x1359e2);}(_0x9e04,0x1e7));var _0x49e0=function(_0x568408,_0x34f526){_0x568408=_0x568408-0x0;var _0x105f84=_0x9e04[_0x568408];return _0x105f84;};'use strict';var express=require(_0x49e0('0x0'));var router=express[_0x49e0('0x1')]();var auth=require(_0x49e0('0x2'));var controller=require('./webbar.controller');router[_0x49e0('0x3')](_0x49e0('0x4'),auth[_0x49e0('0x5')](),auth[_0x49e0('0x6')](),controller[_0x49e0('0x7')]);router['post'](_0x49e0('0x8'),auth['isAuthenticated'](),auth[_0x49e0('0x6')](),controller['hangup']);router[_0x49e0('0x3')]('/answer',auth[_0x49e0('0x5')](),auth[_0x49e0('0x6')](),controller[_0x49e0('0x9')]);router[_0x49e0('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x49e0('0x6')](),controller[_0x49e0('0xa')]);router[_0x49e0('0x3')](_0x49e0('0xb'),auth[_0x49e0('0x5')](),auth[_0x49e0('0x6')](),controller[_0x49e0('0xc')]);router['post']('/calls',auth[_0x49e0('0x5')](),auth['canUpdate'](),controller['calls']);router['post']('/transfer',auth[_0x49e0('0x5')](),auth[_0x49e0('0x6')](),controller[_0x49e0('0xd')]);module[_0x49e0('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index fc11530..aaf2dea 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 _0x76dc=['agent','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','originate','info','body','length','json','userId','callerId','format','user:%s','webbar:originate','originate\x20executed!','hangup','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','filter','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','ioredis','redis','defaults','socket.io-emitter','validate','string','callNumber\x20is\x20required','userId\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','catch','User','findOne'];(function(_0x4c4327,_0x2653b0){var _0x3f77e8=function(_0x37c709){while(--_0x37c709){_0x4c4327['push'](_0x4c4327['shift']());}};_0x3f77e8(++_0x2653b0);}(_0x76dc,0x1f2));var _0xc76d=function(_0x31bc4c,_0x168ed6){_0x31bc4c=_0x31bc4c-0x0;var _0x2b11c8=_0x76dc[_0x31bc4c];return _0x2b11c8;};'use strict';var path=require(_0xc76d('0x0'));var fs=require('fs');var _=require(_0xc76d('0x1'));var db=require(_0xc76d('0x2'))['db'];var config=require(_0xc76d('0x3'));var util=require('util');var BPromise=require(_0xc76d('0x4'));var jayson=require(_0xc76d('0x5'));var amiClient=jayson['client'][_0xc76d('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xc76d('0x7'));config[_0xc76d('0x8')]=_[_0xc76d('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc76d('0xa'))(new Redis(config[_0xc76d('0x8')]));var Schema=require(_0xc76d('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xc76d('0xc'),'required':[!![],_0xc76d('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xc76d('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':[!![],_0xc76d('0x10')]},'transferNumber':{'type':_0xc76d('0xc'),'required':[!![],_0xc76d('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc76d('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]}});function emit(_0x6f94e,_0x5c680c,_0x32e0a8){logger['info'](_0x6f94e,_0x5c680c,JSON['stringify'](_0x32e0a8));io['to'](_0x6f94e)[_0xc76d('0x12')](_0x5c680c,_0x32e0a8);}function handleError(_0x31b032){return function(_0x339623){console[_0xc76d('0x13')](_0xc76d('0x14'),_0x339623,_0x339623 instanceof RangeError);logger['error'](_0x339623[_0xc76d('0x15')]);if(_0x339623 instanceof RangeError){if(_0x339623[_0xc76d('0x16')]){delete _0x339623[_0xc76d('0x16')];}_0x31b032[_0xc76d('0x17')](0x194)[_0xc76d('0x18')](_0x339623);}else{if(_0x339623['name']){delete _0x339623[_0xc76d('0x16')];}_0x31b032[_0xc76d('0x17')](0x1f4)['send'](_0x339623);}};}function checkError(){return function(_0x455371){if(!_0x455371){throw new RangeError(_0xc76d('0x19'));}return _0x455371;};}function respondWithRpcPromise(_0x191e97,_0xb89876){return new BPromise(function(_0x18f546,_0x3d357b){var _0x42b89c=amiClient;return _0x42b89c[_0xc76d('0x1a')](_0x191e97,_0xb89876)[_0xc76d('0x1b')](function(_0x20e09c){if(_0x20e09c[_0xc76d('0x1c')]){if(_0x20e09c['error'][_0xc76d('0x1d')]===0x1f4){return _0x3d357b(_0x20e09c[_0xc76d('0x1c')]['message']);}return _0x18f546(_0x20e09c[_0xc76d('0x1c')][_0xc76d('0x1e')]);}else{_0x18f546(_0x20e09c['result']);}})[_0xc76d('0x1f')](function(_0x476aee){_0x3d357b(_0x476aee);});});}function getAgent(_0x2cd06e){return db[_0xc76d('0x20')][_0xc76d('0x21')]({'where':{'id':_0x2cd06e,'role':_0xc76d('0x22')}})[_0xc76d('0x1b')](checkError());}function getAgentCheckSession(_0x59ebd1,_0x59dabf){return new BPromise(function(_0x285430,_0x287ae4){var _0x5069ea=respondWithRpcPromise(_0xc76d('0x23'));var _0x52a79a=getAgent(_0x59ebd1);Promise[_0xc76d('0x24')]([_0x5069ea,_0x52a79a])['then'](function(_0x2039f4){var _0x5cf2e4=_0x2039f4[0x0];var _0x13b468=_0x2039f4[0x1];var _0x18a7fa=_['filter'](_0x5cf2e4[_0xc76d('0x25')],function(_0x1c68f3){return _0x1c68f3[_0xc76d('0x26')]==_0x13b468['id']&&_0x1c68f3[_0xc76d('0x27')]==_0x59dabf;});if(_0x18a7fa['length']==0x1){_0x285430(_0x13b468);}else{_0x287ae4(new RangeError(_0xc76d('0x28')+_0x59dabf+'\x20not\x20found!'));}});});}exports[_0xc76d('0x29')]=function(_0x5e9233,_0x30769f){logger[_0xc76d('0x2a')]('originate\x20fired:',_0x5e9233['body']);var _0x5eca19=originateValidation['validate'](_0x5e9233[_0xc76d('0x2b')]);if(_0x5eca19[_0xc76d('0x2c')]>0x0){return _0x30769f[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x5eca19);}var _0x1b2ed1=_0x5e9233['body'][_0xc76d('0x2e')];var _0x55e825=_0x5e9233[_0xc76d('0x2b')]['callNumber'];var _0x1bef44=_0x5e9233[_0xc76d('0x2b')][_0xc76d('0x2f')];var _0x20fe33=_0x5e9233[_0xc76d('0x2b')]['callbackUrl'];return getAgent(_0x1b2ed1)[_0xc76d('0x1b')](function(_0x371306){logger[_0xc76d('0x2a')]('entityFound:',_0x371306[_0xc76d('0x16')]);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x371306['name']),_0xc76d('0x32'),{'callNumber':_0x55e825,'callerId':_0x1bef44,'callbackUrl':_0x20fe33});return _0x30769f[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x33')});})[_0xc76d('0x1f')](handleError(_0x30769f));};exports[_0xc76d('0x34')]=function(_0x579d93,_0x518945){logger[_0xc76d('0x2a')]('hangup\x20fired:',_0x579d93[_0xc76d('0x2b')]);var _0x359f38=hangupValidation[_0xc76d('0xb')](_0x579d93[_0xc76d('0x2b')]);if(_0x359f38['length']>0x0){return _0x518945['status'](0x190)[_0xc76d('0x2d')](_0x359f38);}var _0x20a456=_0x579d93[_0xc76d('0x2b')][_0xc76d('0x2e')];var _0x410029=_0x579d93['body'][_0xc76d('0x27')];return getAgent(_0x20a456)[_0xc76d('0x1b')](function(_0x321989){logger[_0xc76d('0x2a')](_0xc76d('0x35'),_0x321989[_0xc76d('0x16')]);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x321989[_0xc76d('0x16')]),_0xc76d('0x36'),{'sessionId':_0x410029});return _0x518945['status'](0xc8)['json']({'error':![],'message':_0xc76d('0x37')});})[_0xc76d('0x1f')](handleError(_0x518945));};exports[_0xc76d('0x38')]=function(_0x27bdff,_0x4ae994){logger['info'](_0xc76d('0x39'),_0x27bdff[_0xc76d('0x2b')]);var _0x3e471e=answerValidation[_0xc76d('0xb')](_0x27bdff[_0xc76d('0x2b')]);if(_0x3e471e[_0xc76d('0x2c')]>0x0){return _0x4ae994[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x3e471e);}var _0x50e922=_0x27bdff[_0xc76d('0x2b')][_0xc76d('0x2e')];var _0x1bf8a0=_0x27bdff[_0xc76d('0x2b')]['sessionId'];return getAgent(_0x50e922)['then'](function(_0x4bf591){logger['info']('entityFound:',_0x4bf591['name']);emit(util['format'](_0xc76d('0x31'),_0x4bf591[_0xc76d('0x16')]),_0xc76d('0x3a'),{'sessionId':_0x1bf8a0});return _0x4ae994[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x3b')});})[_0xc76d('0x1f')](handleError(_0x4ae994));};exports[_0xc76d('0x3c')]=function(_0x555f14,_0x462214){logger[_0xc76d('0x2a')](_0xc76d('0x3d'),_0x555f14[_0xc76d('0x2b')]);var _0xb9cca2=holdValidation[_0xc76d('0xb')](_0x555f14[_0xc76d('0x2b')]);if(_0xb9cca2[_0xc76d('0x2c')]>0x0){return _0x462214[_0xc76d('0x17')](0x190)['json'](_0xb9cca2);}var _0x5b41d3=_0x555f14[_0xc76d('0x2b')][_0xc76d('0x2e')];var _0x2fa905=_0x555f14[_0xc76d('0x2b')][_0xc76d('0x27')];return getAgent(_0x5b41d3)['then'](function(_0x25fc9d){logger[_0xc76d('0x2a')]('entityFound:',_0x25fc9d['name']);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x25fc9d['name']),_0xc76d('0x3e'),{'sessionId':_0x2fa905});return _0x462214[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x3f')});})[_0xc76d('0x1f')](handleError(_0x462214));};exports[_0xc76d('0x40')]=function(_0x25a549,_0x10b1b0){logger[_0xc76d('0x2a')](_0xc76d('0x41'),_0x25a549['body']);var _0x4efd83=unholdValidation[_0xc76d('0xb')](_0x25a549[_0xc76d('0x2b')]);if(_0x4efd83['length']>0x0){return _0x10b1b0[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x4efd83);}var _0x506b03=_0x25a549[_0xc76d('0x2b')]['userId'];var _0xe90d83=_0x25a549[_0xc76d('0x2b')][_0xc76d('0x27')];return getAgent(_0x506b03)[_0xc76d('0x1b')](function(_0x14ef42){logger['info']('entityFound:',_0x14ef42['name']);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x14ef42[_0xc76d('0x16')]),_0xc76d('0x42'),{'sessionId':_0xe90d83});return _0x10b1b0[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0xc76d('0x1f')](handleError(_0x10b1b0));};exports[_0xc76d('0x43')]=function(_0x5e66d9,_0x1a49d5){logger[_0xc76d('0x2a')]('calls\x20fired:',_0x1a49d5[_0xc76d('0x2b')]);var _0x463cbe=callsValidation[_0xc76d('0xb')](_0x5e66d9[_0xc76d('0x2b')]);if(_0x463cbe[_0xc76d('0x2c')]>0x0){return _0x1a49d5[_0xc76d('0x17')](0x190)['json'](_0x463cbe);}var _0x91b25b=_0x5e66d9[_0xc76d('0x2b')]['userId'];var _0x5f3973=respondWithRpcPromise(_0xc76d('0x23'));var _0x5ddcc6=getAgent(_0x91b25b);return Promise[_0xc76d('0x24')]([_0x5f3973,_0x5ddcc6])[_0xc76d('0x1b')](function(_0x12b287){var _0xfe2be1=_0x12b287[0x0];var _0x254128=_0x12b287[0x1];var _0x4746a5=_[_0xc76d('0x44')](_0xfe2be1[_0xc76d('0x25')],function(_0x3ada89){return _0x3ada89[_0xc76d('0x26')]==_0x254128['id'];});return _0x1a49d5[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'count':_0x4746a5[_0xc76d('0x2c')],'rows':_0x4746a5});})[_0xc76d('0x1f')](handleError(_0x1a49d5));};exports['conference']=function(_0x3054e0,_0xa0aa45){logger[_0xc76d('0x2a')](_0xc76d('0x45'),_0x3054e0[_0xc76d('0x2b')]);var _0x5ce99d=conferenceValidation[_0xc76d('0xb')](_0x3054e0[_0xc76d('0x2b')]);if(_0x5ce99d['length']>0x0){return _0xa0aa45['status'](0x190)['json'](_0x5ce99d);}var _0x382db6=_0x3054e0[_0xc76d('0x2b')][_0xc76d('0x2e')];return getAgent(_0x382db6)[_0xc76d('0x1b')](function(_0x2ba812){logger[_0xc76d('0x2a')](_0xc76d('0x35'),_0x2ba812[_0xc76d('0x16')]);emit(util['format'](_0xc76d('0x31'),_0x2ba812['name']),'webbar:conference');return _0xa0aa45[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x46')});})['catch'](handleError(_0xa0aa45));};exports[_0xc76d('0x47')]=function(_0x57068d,_0x48ccf7){logger['info'](_0xc76d('0x48'),_0x57068d[_0xc76d('0x2b')]);var _0x513623=transferValidation[_0xc76d('0xb')](_0x57068d[_0xc76d('0x2b')]);if(_0x513623[_0xc76d('0x2c')]>0x0){return _0x48ccf7[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x513623);}var _0xa81af6=_0x57068d[_0xc76d('0x2b')]['userId'];var _0x5035fd=_0x57068d['body'][_0xc76d('0x27')];var _0x2e742f=_0x57068d[_0xc76d('0x2b')][_0xc76d('0x49')];return getAgent(_0xa81af6)[_0xc76d('0x1b')](function(_0x49f876){logger[_0xc76d('0x2a')](_0xc76d('0x35'),_0x49f876[_0xc76d('0x16')]);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x49f876[_0xc76d('0x16')]),_0xc76d('0x4a'),{'sessionId':_0x5035fd,'transferNumber':_0x2e742f});return _0x48ccf7[_0xc76d('0x17')](0xc8)['json']({'error':![],'message':_0xc76d('0x4b')});})['catch'](handleError(_0x48ccf7));}; \ No newline at end of file +var _0xe600=['redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound','request','then','code','message','result','User','VoiceChannels','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','json','callNumber','callerId','callbackUrl','format','user:%s','catch','hangup\x20fired:','userId','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','all','conference','conference\x20fired:','transfer','transfer\x20fired:','webbar:transfer','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x0e60('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x0e60('0x1'));var util=require(_0x0e60('0x2'));var BPromise=require(_0x0e60('0x3'));var jayson=require(_0x0e60('0x4'));var amiClient=jayson[_0x0e60('0x5')][_0x0e60('0x6')]({'port':0x232a});var logger=require(_0x0e60('0x7'))(_0x0e60('0x8'));var Redis=require(_0x0e60('0x9'));config[_0x0e60('0xa')]=_['defaults'](config[_0x0e60('0xa')],{'host':_0x0e60('0xb'),'port':0x18eb});var io=require(_0x0e60('0xc'))(new Redis(config[_0x0e60('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'callNumber':{'type':_0x0e60('0xf'),'required':[!![],_0x0e60('0x10')]},'callerId':{'type':_0x0e60('0xf')},'callbackUrl':{'type':_0x0e60('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x0e60('0xf'),'required':[!![],_0x0e60('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0e60('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0e60('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0e60('0xd'),'required':[!![],_0x0e60('0xe')]}});function emit(_0x5ab4ba,_0x2a8b5a,_0x3f2d13){logger[_0x0e60('0x12')](_0x5ab4ba,_0x2a8b5a,JSON[_0x0e60('0x13')](_0x3f2d13));io['to'](_0x5ab4ba)[_0x0e60('0x14')](_0x2a8b5a,_0x3f2d13);}function handleError(_0x4ed292){return function(_0x992490){console[_0x0e60('0x15')]('handleError:',_0x992490,_0x992490 instanceof RangeError);logger[_0x0e60('0x16')](_0x992490[_0x0e60('0x17')]);if(_0x992490 instanceof RangeError){if(_0x992490[_0x0e60('0x18')]){delete _0x992490['name'];}_0x4ed292[_0x0e60('0x19')](0x194)['send'](_0x992490);}else{if(_0x992490[_0x0e60('0x18')]){delete _0x992490[_0x0e60('0x18')];}_0x4ed292[_0x0e60('0x19')](0x1f4)[_0x0e60('0x1a')](_0x992490);}};}function checkError(){return function(_0x329620){if(!_0x329620){throw new RangeError(_0x0e60('0x1b'));}return _0x329620;};}function respondWithRpcPromise(_0x38f677,_0x2ed72f){return new BPromise(function(_0x352633,_0x10f875){var _0x22c0e0=amiClient;return _0x22c0e0[_0x0e60('0x1c')](_0x38f677,_0x2ed72f)[_0x0e60('0x1d')](function(_0x16985f){if(_0x16985f[_0x0e60('0x16')]){if(_0x16985f[_0x0e60('0x16')][_0x0e60('0x1e')]===0x1f4){return _0x10f875(_0x16985f[_0x0e60('0x16')][_0x0e60('0x1f')]);}return _0x352633(_0x16985f['error'][_0x0e60('0x1f')]);}else{_0x352633(_0x16985f[_0x0e60('0x20')]);}})['catch'](function(_0x10451f){_0x10f875(_0x10451f);});});}function getAgent(_0x5ddd18){return db[_0x0e60('0x21')]['findOne']({'where':{'id':_0x5ddd18,'role':'agent'}})[_0x0e60('0x1d')](checkError());}function getAgentCheckSession(_0x39dae2,_0x526aaa){return new BPromise(function(_0x4eb9b8,_0x3ca649){var _0x54d7ce=respondWithRpcPromise(_0x0e60('0x22'));var _0x548919=getAgent(_0x39dae2);Promise['all']([_0x54d7ce,_0x548919])[_0x0e60('0x1d')](function(_0x3d3c13){var _0x2a282d=_0x3d3c13[0x0];var _0x4d9b18=_0x3d3c13[0x1];var _0x473813=_['filter'](_0x2a282d[_0x0e60('0x23')],function(_0x1d54c0){return _0x1d54c0[_0x0e60('0x24')]==_0x4d9b18['id']&&_0x1d54c0['sessionId']==_0x526aaa;});if(_0x473813[_0x0e60('0x25')]==0x1){_0x4eb9b8(_0x4d9b18);}else{_0x3ca649(new RangeError(_0x0e60('0x26')+_0x526aaa+_0x0e60('0x27')));}});});}exports['originate']=function(_0x17e210,_0x3ea4ac){logger[_0x0e60('0x12')](_0x0e60('0x28'),_0x17e210[_0x0e60('0x29')]);var _0x588e9d=originateValidation[_0x0e60('0x2a')](_0x17e210['body']);if(_0x588e9d[_0x0e60('0x25')]>0x0){return _0x3ea4ac['status'](0x190)[_0x0e60('0x2b')](_0x588e9d);}var _0x2388a7=_0x17e210[_0x0e60('0x29')]['userId'];var _0xf29971=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2c')];var _0x81a892=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2d')];var _0x9302fe=_0x17e210[_0x0e60('0x29')][_0x0e60('0x2e')];return getAgent(_0x2388a7)[_0x0e60('0x1d')](function(_0x2533a9){logger[_0x0e60('0x12')]('entityFound:',_0x2533a9[_0x0e60('0x18')]);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x2533a9[_0x0e60('0x18')]),'webbar:originate',{'callNumber':_0xf29971,'callerId':_0x81a892,'callbackUrl':_0x9302fe});return _0x3ea4ac['status'](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'originate\x20executed!'});})[_0x0e60('0x31')](handleError(_0x3ea4ac));};exports['hangup']=function(_0x4582b8,_0x44db32){logger[_0x0e60('0x12')](_0x0e60('0x32'),_0x4582b8[_0x0e60('0x29')]);var _0x25761d=hangupValidation[_0x0e60('0x2a')](_0x4582b8[_0x0e60('0x29')]);if(_0x25761d[_0x0e60('0x25')]>0x0){return _0x44db32[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x25761d);}var _0x3becf9=_0x4582b8['body'][_0x0e60('0x33')];var _0x56ce38=_0x4582b8[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x3becf9)['then'](function(_0x482583){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x482583['name']);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x482583['name']),_0x0e60('0x36'),{'sessionId':_0x56ce38});return _0x44db32[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':_0x0e60('0x37')});})[_0x0e60('0x31')](handleError(_0x44db32));};exports[_0x0e60('0x38')]=function(_0x8244f,_0x233743){logger[_0x0e60('0x12')]('answer\x20fired:',_0x8244f['body']);var _0x535c06=answerValidation[_0x0e60('0x2a')](_0x8244f['body']);if(_0x535c06[_0x0e60('0x25')]>0x0){return _0x233743[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x535c06);}var _0x4bfebf=_0x8244f[_0x0e60('0x29')][_0x0e60('0x33')];var _0x4ce029=_0x8244f['body'][_0x0e60('0x34')];return getAgent(_0x4bfebf)[_0x0e60('0x1d')](function(_0xd4f785){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0xd4f785[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0xd4f785[_0x0e60('0x18')]),_0x0e60('0x39'),{'sessionId':_0x4ce029});return _0x233743[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x233743));};exports['hold']=function(_0x36f90e,_0x449f38){logger[_0x0e60('0x12')](_0x0e60('0x3a'),_0x36f90e['body']);var _0x5b9cf6=holdValidation['validate'](_0x36f90e[_0x0e60('0x29')]);if(_0x5b9cf6[_0x0e60('0x25')]>0x0){return _0x449f38[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x5b9cf6);}var _0x8777f4=_0x36f90e['body']['userId'];var _0x3c3ab7=_0x36f90e[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x8777f4)[_0x0e60('0x1d')](function(_0x4ad156){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x4ad156[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x4ad156[_0x0e60('0x18')]),'webbar:hold',{'sessionId':_0x3c3ab7});return _0x449f38[_0x0e60('0x19')](0xc8)['json']({'error':![],'message':_0x0e60('0x3b')});})[_0x0e60('0x31')](handleError(_0x449f38));};exports[_0x0e60('0x3c')]=function(_0x2e887c,_0x477a99){logger['info'](_0x0e60('0x3d'),_0x2e887c[_0x0e60('0x29')]);var _0x103c30=unholdValidation[_0x0e60('0x2a')](_0x2e887c['body']);if(_0x103c30[_0x0e60('0x25')]>0x0){return _0x477a99[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x103c30);}var _0x2d7403=_0x2e887c['body'][_0x0e60('0x33')];var _0x4c6f07=_0x2e887c[_0x0e60('0x29')][_0x0e60('0x34')];return getAgent(_0x2d7403)[_0x0e60('0x1d')](function(_0x9e4340){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x9e4340[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x9e4340['name']),_0x0e60('0x3e'),{'sessionId':_0x4c6f07});return _0x477a99[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':_0x0e60('0x3f')});})['catch'](handleError(_0x477a99));};exports['calls']=function(_0x3282b8,_0x5a6c01){logger[_0x0e60('0x12')](_0x0e60('0x40'),_0x5a6c01[_0x0e60('0x29')]);var _0x24ada9=callsValidation[_0x0e60('0x2a')](_0x3282b8[_0x0e60('0x29')]);if(_0x24ada9[_0x0e60('0x25')]>0x0){return _0x5a6c01[_0x0e60('0x19')](0x190)['json'](_0x24ada9);}var _0x33b560=_0x3282b8[_0x0e60('0x29')][_0x0e60('0x33')];var _0x1249b2=respondWithRpcPromise(_0x0e60('0x22'));var _0x52ac12=getAgent(_0x33b560);return Promise[_0x0e60('0x41')]([_0x1249b2,_0x52ac12])[_0x0e60('0x1d')](function(_0x3ee5e2){var _0x221608=_0x3ee5e2[0x0];var _0x565eab=_0x3ee5e2[0x1];var _0x88b035=_['filter'](_0x221608[_0x0e60('0x23')],function(_0x37c13c){return _0x37c13c[_0x0e60('0x24')]==_0x565eab['id'];});return _0x5a6c01[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'count':_0x88b035['length'],'rows':_0x88b035});})[_0x0e60('0x31')](handleError(_0x5a6c01));};exports[_0x0e60('0x42')]=function(_0x55d4e7,_0x472ebe){logger['info'](_0x0e60('0x43'),_0x55d4e7[_0x0e60('0x29')]);var _0x5e50ad=conferenceValidation['validate'](_0x55d4e7[_0x0e60('0x29')]);if(_0x5e50ad[_0x0e60('0x25')]>0x0){return _0x472ebe['status'](0x190)['json'](_0x5e50ad);}var _0x33bc63=_0x55d4e7[_0x0e60('0x29')][_0x0e60('0x33')];return getAgent(_0x33bc63)[_0x0e60('0x1d')](function(_0x58fa48){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x58fa48[_0x0e60('0x18')]);emit(util['format'](_0x0e60('0x30'),_0x58fa48[_0x0e60('0x18')]),'webbar:conference');return _0x472ebe[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'conference\x20executed!'});})[_0x0e60('0x31')](handleError(_0x472ebe));};exports[_0x0e60('0x44')]=function(_0x5f383e,_0x5cc420){logger[_0x0e60('0x12')](_0x0e60('0x45'),_0x5f383e[_0x0e60('0x29')]);var _0x234cc5=transferValidation[_0x0e60('0x2a')](_0x5f383e[_0x0e60('0x29')]);if(_0x234cc5[_0x0e60('0x25')]>0x0){return _0x5cc420[_0x0e60('0x19')](0x190)[_0x0e60('0x2b')](_0x234cc5);}var _0x2d0c5d=_0x5f383e[_0x0e60('0x29')][_0x0e60('0x33')];var _0x2546f8=_0x5f383e[_0x0e60('0x29')][_0x0e60('0x34')];var _0x200d81=_0x5f383e[_0x0e60('0x29')]['transferNumber'];return getAgent(_0x2d0c5d)['then'](function(_0x1a8efe){logger[_0x0e60('0x12')](_0x0e60('0x35'),_0x1a8efe['name']);emit(util[_0x0e60('0x2f')](_0x0e60('0x30'),_0x1a8efe['name']),_0x0e60('0x46'),{'sessionId':_0x2546f8,'transferNumber':_0x200d81});return _0x5cc420[_0x0e60('0x19')](0xc8)[_0x0e60('0x2b')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x5cc420));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 237fc1f..bf4b8d7 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 _0x955f=['addApplications','notify','/:id/send','send','update','destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getAnswers','getApplications','post','create','addDisposition','/:id/users','addAgents'];(function(_0x25d870,_0x16b9ed){var _0x392e5f=function(_0x7841cf){while(--_0x7841cf){_0x25d870['push'](_0x25d870['shift']());}};_0x392e5f(++_0x16b9ed);}(_0x955f,0x1eb));var _0xf955=function(_0x940b05,_0x470368){_0x940b05=_0x940b05-0x0;var _0x39d983=_0x955f[_0x940b05];return _0x39d983;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./whatsappAccount.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0x7')](_0xf955('0xd'),auth[_0xf955('0x8')](),controller['getDispositions']);router[_0xf955('0x7')]('/:id/canned_answers',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router[_0xf955('0x7')]('/:id/users',auth[_0xf955('0x8')](),controller['getAgents']);router[_0xf955('0x7')]('/:id/applications',auth[_0xf955('0x8')](),controller[_0xf955('0xf')]);router[_0xf955('0x10')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x11')]);router[_0xf955('0x10')](_0xf955('0xd'),auth[_0xf955('0x8')](),controller[_0xf955('0x12')]);router[_0xf955('0x10')]('/:id/canned_answers',auth[_0xf955('0x8')](),controller['addAnswer']);router[_0xf955('0x10')](_0xf955('0x13'),auth[_0xf955('0x8')](),controller[_0xf955('0x14')]);router['post']('/:id/applications',auth[_0xf955('0x8')](),controller[_0xf955('0x15')]);router[_0xf955('0x10')]('/:id/notify',controller[_0xf955('0x16')]);router[_0xf955('0x10')](_0xf955('0x17'),auth[_0xf955('0x8')](),controller[_0xf955('0x18')]);router['put'](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0x19')]);router['delete'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x1a')]);router[_0xf955('0x1b')](_0xf955('0xd'),auth[_0xf955('0x8')](),controller[_0xf955('0x1c')]);router['delete'](_0xf955('0x1d'),auth[_0xf955('0x8')](),controller[_0xf955('0x1e')]);router[_0xf955('0x1b')](_0xf955('0x13'),auth[_0xf955('0x8')](),controller[_0xf955('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x131d27,_0x5ba5c8){var _0x23f54a=function(_0x5541fd){while(--_0x5541fd){_0x131d27['push'](_0x131d27['shift']());}};_0x23f54a(++_0x5ba5c8);}(_0x5c3c,0x132));var _0xc5c3=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x5c3c[_0x369151];return _0x4292d5;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2016af5..91dbc56 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 _0x227b=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','generate'];(function(_0x30d348,_0x49cdb8){var _0x3c10b4=function(_0x24ab8d){while(--_0x24ab8d){_0x30d348['push'](_0x30d348['shift']());}};_0x3c10b4(++_0x49cdb8);}(_0x227b,0x19f));var _0xb227=function(_0x184b30,_0xbca3a){_0x184b30=_0x184b30-0x0;var _0x377f05=_0x227b[_0x184b30];return _0x377f05;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb227('0x0'));module['exports']={'name':{'type':Sequelize[_0xb227('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb227('0x1')],'defaultValue':function(){return rs[_0xb227('0x2')]();}},'phone':{'type':Sequelize[_0xb227('0x1')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0xb227('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb227('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb227('0x4')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb227('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb227('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb227('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb227('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb227('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xb227('0x4')],'defaultValue':![],'comment':_0xb227('0x7'),'set':function(_0x2f7146){if(!_0x2f7146){this[_0xb227('0x8')](_0xb227('0x9'),null);}this[_0xb227('0x8')](_0xb227('0xa'),_0x2f7146);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41c1=['generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name'];(function(_0x469436,_0x75a5b){var _0x524f38=function(_0x2aa0cd){while(--_0x2aa0cd){_0x469436['push'](_0x469436['shift']());}};_0x524f38(++_0x75a5b);}(_0x41c1,0x7b));var _0x141c=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0x41c1[_0x38ff1e];return _0x3755d4;};'use strict';var Sequelize=require(_0x141c('0x0'));var rs=require(_0x141c('0x1'));module[_0x141c('0x2')]={'name':{'type':Sequelize[_0x141c('0x3')],'unique':_0x141c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x141c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x141c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x141c('0x3')],'defaultValue':function(){return rs[_0x141c('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x141c('0x6')](_0x141c('0x7'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x141c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x141c('0x8')],'defaultValue':function(){return _0x141c('0x9');}},'notificationSound':{'type':Sequelize[_0x141c('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x141c('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x141c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x141c('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x141c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x141c('0xb')],'comment':_0x141c('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x141c('0xa')],'defaultValue':![],'comment':_0x141c('0xd'),'set':function(_0x3b1d40){if(!_0x3b1d40){this[_0x141c('0xe')](_0x141c('0xf'),null);}this[_0x141c('0xe')]('mandatoryDisposition',_0x3b1d40);}},'description':{'type':Sequelize[_0x141c('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index bb8ee0b..eed0b46 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 _0x6c05=['../../mysqldb','defaults','redis','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','get','UserProfileResource','destroy','end','sendStatus','name','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','describe','Disposition','getDispositions','findOne','WhatsappAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','length','hasOwnProperty','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','applications','orderBy','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','twilio','from','From','whatsapp:','Body','MessageSid','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','autoclose','push','unmanaged','*,*,*,*','created','messageId','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/utils','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c05,0xa2));var _0x56c0=function(_0x16c296,_0x39d2a0){_0x16c296=_0x16c296-0x0;var _0x135bc5=_0x6c05[_0x16c296];return _0x135bc5;};'use strict';var emlformat=require(_0x56c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56c0('0x1'));var jsonpatch=require(_0x56c0('0x2'));var rp=require(_0x56c0('0x3'));var moment=require('moment');var BPromise=require(_0x56c0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56c0('0x5'));var sox=require('sox');var csv=require(_0x56c0('0x6'));var ejs=require(_0x56c0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56c0('0x8'));var squel=require(_0x56c0('0x9'));var crypto=require(_0x56c0('0xa'));var jsforce=require(_0x56c0('0xb'));var deskjs=require(_0x56c0('0xc'));var toCsv=require(_0x56c0('0x6'));var querystring=require(_0x56c0('0xd'));var Papa=require(_0x56c0('0xe'));var Redis=require(_0x56c0('0xf'));var authService=require(_0x56c0('0x10'));var qs=require(_0x56c0('0x11'));var as=require(_0x56c0('0x12'));var hardwareService=require(_0x56c0('0x13'));var logger=require(_0x56c0('0x14'))('api');var utils=require(_0x56c0('0x15'));var config=require(_0x56c0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x56c0('0x17'))['db'];config['redis']=_[_0x56c0('0x18')](config[_0x56c0('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56c0('0x19')]));require(_0x56c0('0x1a'))[_0x56c0('0x1b')](socket);var jayson=require(_0x56c0('0x1c'));var client=jayson[_0x56c0('0x1d')][_0x56c0('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0xf4d9a2,_0x174dbb,_0x1da469,_0x1bf79c){return new BPromise(function(_0x2ca378,_0x412717){var _0x3d82a8=_0x1bf79c||client;return _0x3d82a8[_0x56c0('0x1f')](_0xf4d9a2,_0x1da469)[_0x56c0('0x20')](function(_0x20e0a1){logger[_0x56c0('0x21')](_0x56c0('0x22'),_0x174dbb,_0x56c0('0x23'));logger[_0x56c0('0x24')](_0x56c0('0x25'),_0x174dbb,_0x56c0('0x23'),JSON[_0x56c0('0x26')](_0x20e0a1));if(_0x20e0a1[_0x56c0('0x27')]){if(_0x20e0a1[_0x56c0('0x27')][_0x56c0('0x28')]===0x1f4){logger[_0x56c0('0x27')](_0x56c0('0x22'),_0x174dbb,_0x20e0a1['error'][_0x56c0('0x29')]);return _0x412717(_0x20e0a1['error'][_0x56c0('0x29')]);}logger['error'](_0x56c0('0x22'),_0x174dbb,_0x20e0a1[_0x56c0('0x27')][_0x56c0('0x29')]);return _0x2ca378(_0x20e0a1[_0x56c0('0x27')][_0x56c0('0x29')]);}else{logger[_0x56c0('0x21')](_0x56c0('0x22'),_0x174dbb,'request\x20sent');_0x2ca378(_0x20e0a1[_0x56c0('0x2a')][_0x56c0('0x29')]);}})[_0x56c0('0x2b')](function(_0x161a0c){logger[_0x56c0('0x27')](_0x56c0('0x22'),_0x174dbb,_0x161a0c);_0x412717(_0x161a0c);});});}function respondWithStatusCode(_0x1d5665,_0x229738){_0x229738=_0x229738||0xcc;return function(_0x12093e){if(_0x12093e){return _0x1d5665['sendStatus'](_0x229738);}return _0x1d5665[_0x56c0('0x2c')](_0x229738)['end']();};}function respondWithResult(_0x34223e,_0x1cd866){_0x1cd866=_0x1cd866||0xc8;return function(_0x49e0d0){if(_0x49e0d0){return _0x34223e['status'](_0x1cd866)[_0x56c0('0x2d')](_0x49e0d0);}};}function respondWithFilteredResult(_0x3483e5,_0x51a123){return function(_0x4049d0){if(_0x4049d0){var _0x4018ab=typeof _0x51a123[_0x56c0('0x2e')]==='undefined'&&typeof _0x51a123[_0x56c0('0x2f')]===_0x56c0('0x30');var _0x1b9167=_0x4049d0[_0x56c0('0x31')];var _0x3c4354=_0x4018ab?0x0:_0x51a123[_0x56c0('0x2e')];var _0x543e5d=_0x4018ab?_0x4049d0[_0x56c0('0x31')]:_0x51a123[_0x56c0('0x2e')]+_0x51a123['limit'];var _0x12adda;if(_0x543e5d>=_0x1b9167){_0x543e5d=_0x1b9167;_0x12adda=0xc8;}else{_0x12adda=0xce;}_0x3483e5[_0x56c0('0x2c')](_0x12adda);return _0x3483e5[_0x56c0('0x32')](_0x56c0('0x33'),_0x3c4354+'-'+_0x543e5d+'/'+_0x1b9167)[_0x56c0('0x2d')](_0x4049d0);}return null;};}function patchUpdates(_0x42dd8e){return function(_0x1d4c23){try{jsonpatch[_0x56c0('0x34')](_0x1d4c23,_0x42dd8e,!![]);}catch(_0x3b6373){return BPromise[_0x56c0('0x35')](_0x3b6373);}return _0x1d4c23['save']();};}function saveUpdates(_0x4e663a,_0x42af7c){return function(_0x2ab5eb){if(_0x2ab5eb){return _0x2ab5eb[_0x56c0('0x36')](_0x4e663a)[_0x56c0('0x20')](function(_0x1d17fd){return _0x1d17fd;});}return null;};}function removeEntity(_0x1f9394,_0xaf56e0){return function(_0x48fb11){if(_0x48fb11){return _0x48fb11['destroy']()[_0x56c0('0x20')](function(){var _0x49a334=_0x48fb11[_0x56c0('0x37')]({'plain':!![]});var _0x1b4c8d='WhatsappAccounts';return db[_0x56c0('0x38')][_0x56c0('0x39')]({'where':{'type':_0x1b4c8d,'resourceId':_0x49a334['id']}})['then'](function(){return _0x48fb11;});})[_0x56c0('0x20')](function(){_0x1f9394['status'](0xcc)[_0x56c0('0x3a')]();});}};}function handleEntityNotFound(_0x34e3e9,_0x85b893){return function(_0x290185){if(!_0x290185){_0x34e3e9[_0x56c0('0x3b')](0x194);}return _0x290185;};}function handleError(_0x5b99c9,_0x3b6904){_0x3b6904=_0x3b6904||0x1f4;return function(_0x11fe09){logger['error'](_0x11fe09['stack']);if(_0x11fe09[_0x56c0('0x3c')]){delete _0x11fe09[_0x56c0('0x3c')];}_0x5b99c9['status'](_0x3b6904)['send'](_0x11fe09);};}exports['index']=function(_0x467641,_0x3abc6f){var _0x25080b={'include':[{'model':db[_0x56c0('0x3d')],'as':_0x56c0('0x3e')}]},_0x3dea86={},_0xfcbfac={'count':0x0,'rows':[]};var _0x4471d5=_[_0x56c0('0x3f')](db[_0x56c0('0x40')][_0x56c0('0x41')],function(_0x52c62c){return{'name':_0x52c62c['fieldName'],'type':_0x52c62c[_0x56c0('0x42')]['key']};});_0x3dea86[_0x56c0('0x43')]=_[_0x56c0('0x3f')](_0x4471d5,'name');_0x3dea86['query']=_[_0x56c0('0x44')](_0x467641[_0x56c0('0x45')]);_0x3dea86[_0x56c0('0x46')]=_[_0x56c0('0x47')](_0x3dea86['model'],_0x3dea86['query']);_0x25080b[_0x56c0('0x48')]=_['intersection'](_0x3dea86[_0x56c0('0x43')],qs[_0x56c0('0x49')](_0x467641['query']['fields']));_0x25080b[_0x56c0('0x48')]=_0x25080b[_0x56c0('0x48')]['length']?_0x25080b['attributes']:_0x3dea86[_0x56c0('0x43')];if(!_0x467641[_0x56c0('0x45')]['hasOwnProperty'](_0x56c0('0x4a'))){_0x25080b[_0x56c0('0x2f')]=qs['limit'](_0x467641['query'][_0x56c0('0x2f')]);_0x25080b['offset']=qs['offset'](_0x467641[_0x56c0('0x45')]['offset']);}_0x25080b[_0x56c0('0x4b')]=qs[_0x56c0('0x4c')](_0x467641[_0x56c0('0x45')][_0x56c0('0x4c')]);_0x25080b[_0x56c0('0x4d')]=qs['filters'](_[_0x56c0('0x4e')](_0x467641[_0x56c0('0x45')],_0x3dea86[_0x56c0('0x46')]),_0x4471d5);if(_0x467641[_0x56c0('0x45')][_0x56c0('0x4f')]){_0x25080b[_0x56c0('0x4d')]=_[_0x56c0('0x50')](_0x25080b[_0x56c0('0x4d')],{'$or':_['map'](_0x4471d5,function(_0x4ce7b6){if(_0x4ce7b6[_0x56c0('0x42')]!==_0x56c0('0x51')){var _0x159036={};_0x159036[_0x4ce7b6[_0x56c0('0x3c')]]={'$like':'%'+_0x467641[_0x56c0('0x45')]['filter']+'%'};return _0x159036;}})});}_0x25080b=_[_0x56c0('0x50')]({},_0x25080b,_0x467641['options']);var _0x3a9bb4={'where':_0x25080b['where']};return db[_0x56c0('0x40')][_0x56c0('0x31')](_0x3a9bb4)['then'](function(_0x3b90fa){_0xfcbfac[_0x56c0('0x31')]=_0x3b90fa;if(_0x467641[_0x56c0('0x45')][_0x56c0('0x52')]){_0x25080b[_0x56c0('0x53')]=[{'all':!![]}];}return db[_0x56c0('0x40')][_0x56c0('0x54')](_0x25080b);})['then'](function(_0x113cfb){_0xfcbfac['rows']=_0x113cfb;return _0xfcbfac;})[_0x56c0('0x20')](respondWithFilteredResult(_0x3abc6f,_0x25080b))[_0x56c0('0x2b')](handleError(_0x3abc6f,null));};exports[_0x56c0('0x55')]=function(_0x43cd58,_0xd3855a){var _0x3c282c={'raw':![],'where':{'id':_0x43cd58[_0x56c0('0x56')]['id']},'include':[{'model':db[_0x56c0('0x3d')],'as':_0x56c0('0x3e')}]},_0x44c20d={};_0x44c20d[_0x56c0('0x43')]=_[_0x56c0('0x44')](db[_0x56c0('0x40')][_0x56c0('0x41')]);_0x44c20d['query']=_[_0x56c0('0x44')](_0x43cd58[_0x56c0('0x45')]);_0x44c20d['filters']=_[_0x56c0('0x47')](_0x44c20d[_0x56c0('0x43')],_0x44c20d['query']);_0x3c282c['attributes']=_[_0x56c0('0x47')](_0x44c20d[_0x56c0('0x43')],qs[_0x56c0('0x49')](_0x43cd58[_0x56c0('0x45')][_0x56c0('0x49')]));_0x3c282c[_0x56c0('0x48')]=_0x3c282c['attributes']['length']?_0x3c282c[_0x56c0('0x48')]:_0x44c20d['model'];if(_0x43cd58['query'][_0x56c0('0x52')]){_0x3c282c[_0x56c0('0x53')]=[{'all':!![]}];}_0x3c282c=_[_0x56c0('0x50')]({},_0x3c282c,_0x43cd58[_0x56c0('0x57')]);return db[_0x56c0('0x40')][_0x56c0('0x58')](_0x3c282c)['then'](handleEntityNotFound(_0xd3855a,null))[_0x56c0('0x20')](respondWithResult(_0xd3855a,null))[_0x56c0('0x2b')](handleError(_0xd3855a,null));};exports[_0x56c0('0x59')]=function(_0x1356b1,_0x197113){return db[_0x56c0('0x40')][_0x56c0('0x59')](_0x1356b1[_0x56c0('0x5a')],{})['then'](function(_0x548264){var _0x47c4c4=_0x1356b1[_0x56c0('0x5b')][_0x56c0('0x37')]({'plain':!![]});if(!_0x47c4c4)throw new Error(_0x56c0('0x5c'));if(_0x47c4c4[_0x56c0('0x5d')]===_0x56c0('0x5b')){var _0x39c606=_0x548264[_0x56c0('0x37')]({'plain':!![]});var _0x5ab486=_0x56c0('0x5e');return db[_0x56c0('0x5f')]['find']({'where':{'name':_0x5ab486,'userProfileId':_0x47c4c4[_0x56c0('0x60')]},'raw':!![]})[_0x56c0('0x20')](function(_0x1d54c7){if(_0x1d54c7&&_0x1d54c7[_0x56c0('0x61')]===0x0){return db[_0x56c0('0x38')][_0x56c0('0x59')]({'name':_0x39c606[_0x56c0('0x3c')],'resourceId':_0x39c606['id'],'type':_0x1d54c7[_0x56c0('0x3c')],'sectionId':_0x1d54c7['id']},{})['then'](function(){return _0x548264;});}else{return _0x548264;}})['catch'](function(_0x2aeba8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aeba8);throw _0x2aeba8;});}return _0x548264;})[_0x56c0('0x20')](respondWithResult(_0x197113,0xc9))[_0x56c0('0x2b')](handleError(_0x197113,null));};exports[_0x56c0('0x36')]=function(_0xbec80f,_0x343b96){if(_0xbec80f[_0x56c0('0x5a')]['id']){delete _0xbec80f[_0x56c0('0x5a')]['id'];}return db[_0x56c0('0x40')][_0x56c0('0x58')]({'where':{'id':_0xbec80f[_0x56c0('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x343b96,null))['then'](saveUpdates(_0xbec80f[_0x56c0('0x5a')],null))[_0x56c0('0x20')](respondWithResult(_0x343b96,null))[_0x56c0('0x2b')](handleError(_0x343b96,null));};exports[_0x56c0('0x39')]=function(_0x40d1fa,_0x43c8f6){return db[_0x56c0('0x40')][_0x56c0('0x58')]({'where':{'id':_0x40d1fa[_0x56c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x43c8f6,null))['then'](removeEntity(_0x43c8f6,null))[_0x56c0('0x2b')](handleError(_0x43c8f6,null));};exports[_0x56c0('0x62')]=function(_0x7fd124,_0x304734){return db[_0x56c0('0x40')][_0x56c0('0x62')]()[_0x56c0('0x20')](respondWithResult(_0x304734,null))[_0x56c0('0x2b')](handleError(_0x304734,null));};exports['addDisposition']=function(_0xc46735,_0x5cb39a,_0x3b8941){if(_0xc46735['body']['id']){delete _0xc46735[_0x56c0('0x5a')]['id'];}return db[_0x56c0('0x40')][_0x56c0('0x58')]({'where':{'id':_0xc46735['params']['id']}})[_0x56c0('0x20')](handleEntityNotFound(_0x5cb39a,null))[_0x56c0('0x20')](function(_0x4fecaa){if(_0x4fecaa){_0xc46735[_0x56c0('0x5a')]['WhatsappAccountId']=_0x4fecaa['id'];return db[_0x56c0('0x63')][_0x56c0('0x59')](_0xc46735[_0x56c0('0x5a')]);}})['then'](respondWithResult(_0x5cb39a,null))[_0x56c0('0x2b')](handleError(_0x5cb39a,null));};exports[_0x56c0('0x64')]=function(_0x224f9c,_0x2c8aba,_0x42c777){var _0x5a7d01={'raw':![],'where':{}};var _0x19e9ba={};var _0x3dd39d={'count':0x0,'rows':[]};return db[_0x56c0('0x40')][_0x56c0('0x65')]({'where':{'id':_0x224f9c[_0x56c0('0x56')]['id']}})[_0x56c0('0x20')](handleEntityNotFound(_0x2c8aba,null))[_0x56c0('0x20')](function(_0x1a1ad1){if(_0x1a1ad1){_0x19e9ba['model']=_[_0x56c0('0x44')](db[_0x56c0('0x63')][_0x56c0('0x41')]);_0x19e9ba[_0x56c0('0x45')]=_[_0x56c0('0x44')](_0x224f9c[_0x56c0('0x45')]);_0x19e9ba['filters']=_[_0x56c0('0x47')](_0x19e9ba[_0x56c0('0x43')],_0x19e9ba[_0x56c0('0x45')]);_0x5a7d01[_0x56c0('0x48')]=_[_0x56c0('0x47')](_0x19e9ba[_0x56c0('0x43')],qs[_0x56c0('0x49')](_0x224f9c[_0x56c0('0x45')][_0x56c0('0x49')]));_0x5a7d01[_0x56c0('0x48')]=_0x5a7d01[_0x56c0('0x48')]['length']?_0x5a7d01[_0x56c0('0x48')]:_0x19e9ba[_0x56c0('0x43')];if(!_0x224f9c[_0x56c0('0x45')]['hasOwnProperty']('nolimit')){_0x5a7d01[_0x56c0('0x2f')]=qs[_0x56c0('0x2f')](_0x224f9c[_0x56c0('0x45')][_0x56c0('0x2f')]);_0x5a7d01[_0x56c0('0x2e')]=qs[_0x56c0('0x2e')](_0x224f9c[_0x56c0('0x45')][_0x56c0('0x2e')]);}_0x5a7d01[_0x56c0('0x4b')]=qs[_0x56c0('0x4c')](_0x224f9c[_0x56c0('0x45')][_0x56c0('0x4c')]);_0x5a7d01[_0x56c0('0x4d')]=qs['filters'](_[_0x56c0('0x4e')](_0x224f9c[_0x56c0('0x45')],_0x19e9ba['filters']));_0x5a7d01[_0x56c0('0x4d')][_0x56c0('0x66')]=_0x1a1ad1['id'];if(_0x224f9c[_0x56c0('0x45')][_0x56c0('0x4f')]){_0x5a7d01[_0x56c0('0x4d')]=_[_0x56c0('0x50')](_0x5a7d01['where'],{'$or':_[_0x56c0('0x3f')](_0x5a7d01['attributes'],function(_0x24de50){var _0x257e8f={};_0x257e8f[_0x24de50]={'$like':'%'+_0x224f9c[_0x56c0('0x45')][_0x56c0('0x4f')]+'%'};return _0x257e8f;})});}_0x5a7d01=_[_0x56c0('0x50')]({},_0x5a7d01,_0x224f9c[_0x56c0('0x57')]);return db[_0x56c0('0x63')][_0x56c0('0x31')]({'where':_0x5a7d01[_0x56c0('0x4d')]})[_0x56c0('0x20')](function(_0x10e9b4){_0x3dd39d[_0x56c0('0x31')]=_0x10e9b4;if(_0x224f9c[_0x56c0('0x45')][_0x56c0('0x52')]){_0x5a7d01[_0x56c0('0x53')]=[{'all':!![]}];}return db[_0x56c0('0x63')][_0x56c0('0x54')](_0x5a7d01);})[_0x56c0('0x20')](function(_0x1bc09f){_0x3dd39d[_0x56c0('0x67')]=_0x1bc09f;return _0x3dd39d;});}})[_0x56c0('0x20')](respondWithFilteredResult(_0x2c8aba,_0x5a7d01))['catch'](handleError(_0x2c8aba,null));};exports[_0x56c0('0x68')]=function(_0x128181,_0x4d65bb,_0x3cad37){return db[_0x56c0('0x40')][_0x56c0('0x58')]({'where':{'id':_0x128181['params']['id']}})[_0x56c0('0x20')](handleEntityNotFound(_0x4d65bb,null))[_0x56c0('0x20')](function(_0x3fddc7){if(_0x3fddc7){return _0x3fddc7[_0x56c0('0x68')](_0x128181[_0x56c0('0x45')][_0x56c0('0x69')]);}})[_0x56c0('0x20')](respondWithStatusCode(_0x4d65bb,null))[_0x56c0('0x2b')](handleError(_0x4d65bb,null));};exports[_0x56c0('0x6a')]=function(_0x1378ad,_0x922618,_0x3f1649){if(_0x1378ad[_0x56c0('0x5a')]['id']){delete _0x1378ad[_0x56c0('0x5a')]['id'];}return db[_0x56c0('0x40')][_0x56c0('0x58')]({'where':{'id':_0x1378ad[_0x56c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x922618,null))[_0x56c0('0x20')](function(_0x501840){if(_0x501840){_0x1378ad['body'][_0x56c0('0x66')]=_0x501840['id'];return db[_0x56c0('0x6b')][_0x56c0('0x59')](_0x1378ad[_0x56c0('0x5a')]);}})[_0x56c0('0x20')](respondWithResult(_0x922618,null))[_0x56c0('0x2b')](handleError(_0x922618,null));};exports['getAnswers']=function(_0x37cca0,_0x5b89df,_0x2b7870){var _0x50bae7={'raw':![],'where':{}};var _0x1fe0a9={};var _0x11ed9d={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x37cca0['params']['id']}})[_0x56c0('0x20')](handleEntityNotFound(_0x5b89df,null))[_0x56c0('0x20')](function(_0x54dc8b){if(_0x54dc8b){_0x1fe0a9[_0x56c0('0x43')]=_['keys'](db[_0x56c0('0x6b')][_0x56c0('0x41')]);_0x1fe0a9[_0x56c0('0x45')]=_[_0x56c0('0x44')](_0x37cca0['query']);_0x1fe0a9['filters']=_[_0x56c0('0x47')](_0x1fe0a9[_0x56c0('0x43')],_0x1fe0a9[_0x56c0('0x45')]);_0x50bae7[_0x56c0('0x48')]=_['intersection'](_0x1fe0a9['model'],qs[_0x56c0('0x49')](_0x37cca0['query'][_0x56c0('0x49')]));_0x50bae7[_0x56c0('0x48')]=_0x50bae7['attributes'][_0x56c0('0x6c')]?_0x50bae7[_0x56c0('0x48')]:_0x1fe0a9[_0x56c0('0x43')];if(!_0x37cca0['query'][_0x56c0('0x6d')](_0x56c0('0x4a'))){_0x50bae7[_0x56c0('0x2f')]=qs['limit'](_0x37cca0['query'][_0x56c0('0x2f')]);_0x50bae7[_0x56c0('0x2e')]=qs[_0x56c0('0x2e')](_0x37cca0[_0x56c0('0x45')]['offset']);}_0x50bae7[_0x56c0('0x4b')]=qs['sort'](_0x37cca0[_0x56c0('0x45')][_0x56c0('0x4c')]);_0x50bae7[_0x56c0('0x4d')]=qs[_0x56c0('0x46')](_[_0x56c0('0x4e')](_0x37cca0['query'],_0x1fe0a9[_0x56c0('0x46')]));_0x50bae7['where'][_0x56c0('0x66')]=_0x54dc8b['id'];if(_0x37cca0['query']['filter']){_0x50bae7['where']=_[_0x56c0('0x50')](_0x50bae7[_0x56c0('0x4d')],{'$or':_[_0x56c0('0x3f')](_0x50bae7[_0x56c0('0x48')],function(_0xa61db){var _0x15108e={};_0x15108e[_0xa61db]={'$like':'%'+_0x37cca0[_0x56c0('0x45')]['filter']+'%'};return _0x15108e;})});}_0x50bae7=_[_0x56c0('0x50')]({},_0x50bae7,_0x37cca0[_0x56c0('0x57')]);return db[_0x56c0('0x6b')][_0x56c0('0x31')]({'where':_0x50bae7[_0x56c0('0x4d')]})[_0x56c0('0x20')](function(_0x3d8472){_0x11ed9d[_0x56c0('0x31')]=_0x3d8472;if(_0x37cca0[_0x56c0('0x45')]['includeAll']){_0x50bae7[_0x56c0('0x53')]=[{'all':!![]}];}return db[_0x56c0('0x6b')][_0x56c0('0x54')](_0x50bae7);})[_0x56c0('0x20')](function(_0xd7f18a){_0x11ed9d[_0x56c0('0x67')]=_0xd7f18a;return _0x11ed9d;});}})['then'](respondWithFilteredResult(_0x5b89df,_0x50bae7))[_0x56c0('0x2b')](handleError(_0x5b89df,null));};exports[_0x56c0('0x6e')]=function(_0x587125,_0x3ce298,_0x4fa3a8){return db[_0x56c0('0x40')][_0x56c0('0x58')]({'where':{'id':_0x587125['params']['id']}})[_0x56c0('0x20')](handleEntityNotFound(_0x3ce298,null))[_0x56c0('0x20')](function(_0x582069){if(_0x582069){return _0x582069['removeAnswers'](_0x587125[_0x56c0('0x45')][_0x56c0('0x69')]);}})['then'](respondWithStatusCode(_0x3ce298,null))[_0x56c0('0x2b')](handleError(_0x3ce298,null));};exports[_0x56c0('0x6f')]=function(_0x55edfb,_0x129b7a,_0x9571){return db['WhatsappAccount'][_0x56c0('0x58')]({'where':{'id':_0x55edfb[_0x56c0('0x56')]['id']}})[_0x56c0('0x20')](handleEntityNotFound(_0x129b7a,null))[_0x56c0('0x20')](function(_0x26735b){if(_0x26735b){return _0x26735b[_0x56c0('0x6f')](_0x55edfb[_0x56c0('0x5a')][_0x56c0('0x69')],_[_0x56c0('0x70')](_0x55edfb[_0x56c0('0x5a')],['ids','id'])||{})[_0x56c0('0x71')](function(_0x5e30f0){for(var _0x5b6db5=0x0;_0x5b6db5<_0x55edfb[_0x56c0('0x5a')][_0x56c0('0x69')]['length'];_0x5b6db5+=0x1){socket[_0x56c0('0x72')](_0x56c0('0x73'),{'UserId':Number(_0x55edfb[_0x56c0('0x5a')][_0x56c0('0x69')][_0x5b6db5]),'WhatsappAccountId':Number(_0x55edfb[_0x56c0('0x56')]['id'])});}return _0x5e30f0;});}})['then'](respondWithResult(_0x129b7a,null))[_0x56c0('0x2b')](handleError(_0x129b7a,null));};exports[_0x56c0('0x74')]=function(_0x49bd4e,_0x5bf493,_0x51730a){return db['WhatsappAccount'][_0x56c0('0x58')]({'where':{'id':_0x49bd4e[_0x56c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x5bf493,null))[_0x56c0('0x20')](function(_0x1933a4){if(_0x1933a4){return _0x1933a4[_0x56c0('0x74')](_0x49bd4e[_0x56c0('0x45')]['ids'])[_0x56c0('0x20')](function(){if(_['isArray'](_0x49bd4e[_0x56c0('0x45')][_0x56c0('0x69')])){for(var _0x7b8854=0x0;_0x7b8854<_0x49bd4e[_0x56c0('0x45')]['ids'][_0x56c0('0x6c')];_0x7b8854+=0x1){socket[_0x56c0('0x72')](_0x56c0('0x75'),{'UserId':Number(_0x49bd4e[_0x56c0('0x45')][_0x56c0('0x69')][_0x7b8854]),'WhatsappAccountId':Number(_0x49bd4e[_0x56c0('0x56')]['id'])});}}else{socket[_0x56c0('0x72')](_0x56c0('0x75'),{'UserId':Number(_0x49bd4e[_0x56c0('0x45')][_0x56c0('0x69')]),'WhatsappAccountId':Number(_0x49bd4e['params']['id'])});}});}})[_0x56c0('0x20')](respondWithStatusCode(_0x5bf493,null))[_0x56c0('0x2b')](handleError(_0x5bf493,null));};exports[_0x56c0('0x76')]=function(_0x2d2dfb,_0x1c2c20,_0x232e35){var _0x6defeb={};var _0x3922a8={};var _0x589e86;var _0x498f9d;return db['WhatsappAccount'][_0x56c0('0x65')]({'where':{'id':_0x2d2dfb[_0x56c0('0x56')]['id']}})[_0x56c0('0x20')](handleEntityNotFound(_0x1c2c20,null))['then'](function(_0x438f46){if(_0x438f46){_0x589e86=_0x438f46;_0x3922a8[_0x56c0('0x43')]=_['keys'](db[_0x56c0('0x77')][_0x56c0('0x41')]);_0x3922a8['query']=_['keys'](_0x2d2dfb['query']);_0x3922a8[_0x56c0('0x46')]=_[_0x56c0('0x47')](_0x3922a8[_0x56c0('0x43')],_0x3922a8[_0x56c0('0x45')]);_0x6defeb[_0x56c0('0x48')]=_['intersection'](_0x3922a8[_0x56c0('0x43')],qs[_0x56c0('0x49')](_0x2d2dfb[_0x56c0('0x45')][_0x56c0('0x49')]));_0x6defeb['attributes']=_0x6defeb[_0x56c0('0x48')][_0x56c0('0x6c')]?_0x6defeb[_0x56c0('0x48')]:_0x3922a8[_0x56c0('0x43')];_0x6defeb[_0x56c0('0x4b')]=qs[_0x56c0('0x4c')](_0x2d2dfb[_0x56c0('0x45')][_0x56c0('0x4c')]);_0x6defeb[_0x56c0('0x4d')]=qs[_0x56c0('0x46')](_[_0x56c0('0x4e')](_0x2d2dfb[_0x56c0('0x45')],_0x3922a8[_0x56c0('0x46')]));if(_0x2d2dfb[_0x56c0('0x45')][_0x56c0('0x4f')]){_0x6defeb[_0x56c0('0x4d')]=_[_0x56c0('0x50')](_0x6defeb[_0x56c0('0x4d')],{'$or':_[_0x56c0('0x3f')](_0x6defeb[_0x56c0('0x48')],function(_0x5f5082){var _0x48e09f={};_0x48e09f[_0x5f5082]={'$like':'%'+_0x2d2dfb[_0x56c0('0x45')][_0x56c0('0x4f')]+'%'};return _0x48e09f;})});}_0x6defeb=_[_0x56c0('0x50')]({},_0x6defeb,_0x2d2dfb[_0x56c0('0x57')]);return _0x589e86[_0x56c0('0x76')](_0x6defeb);}})[_0x56c0('0x20')](function(_0x296319){if(_0x296319){_0x498f9d=_0x296319[_0x56c0('0x6c')];if(!_0x2d2dfb['query'][_0x56c0('0x6d')](_0x56c0('0x4a'))){_0x6defeb[_0x56c0('0x2f')]=qs['limit'](_0x2d2dfb[_0x56c0('0x45')]['limit']);_0x6defeb[_0x56c0('0x2e')]=qs['offset'](_0x2d2dfb[_0x56c0('0x45')][_0x56c0('0x2e')]);}return _0x589e86[_0x56c0('0x76')](_0x6defeb);}})[_0x56c0('0x20')](function(_0xe584ec){if(_0xe584ec){return _0xe584ec?{'count':_0x498f9d,'rows':_0xe584ec}:null;}})['then'](respondWithResult(_0x1c2c20,null))[_0x56c0('0x2b')](handleError(_0x1c2c20,null));};exports[_0x56c0('0x78')]=function(_0x5168df,_0x1a81cc,_0x473cd5){return db[_0x56c0('0x40')][_0x56c0('0x65')]({'where':{'id':_0x5168df[_0x56c0('0x56')]['id']}})[_0x56c0('0x20')](handleEntityNotFound(_0x1a81cc,null))['then'](function(_0x71af7e){if(_0x71af7e){return db[_0x56c0('0x79')]['transaction'](function(_0x3f2786){return db[_0x56c0('0x7a')][_0x56c0('0x39')]({'where':{'WhatsappAccountId':_0x5168df[_0x56c0('0x56')]['id']},'transaction':_0x3f2786})[_0x56c0('0x20')](function(_0x4abf1){var _0x5b6b91=_[_0x56c0('0x3f')](_0x5168df['body'],function(_0x25174c){_0x25174c[_0x56c0('0x66')]=_0x5168df[_0x56c0('0x56')]['id'];return _0x25174c;});return db[_0x56c0('0x7a')][_0x56c0('0x7b')](_0x5b6b91,{'transaction':_0x3f2786});});})[_0x56c0('0x20')](function(){return db[_0x56c0('0x7a')][_0x56c0('0x7c')]({'where':{'WhatsappAccountId':_0x5168df[_0x56c0('0x56')]['id']},'order':_0x56c0('0x7d')});});}})[_0x56c0('0x20')](respondWithResult(_0x1a81cc,null))[_0x56c0('0x2b')](handleError(_0x1a81cc,null));};exports[_0x56c0('0x7e')]=function(_0x1d9dc7,_0x42fb39,_0x933f06){var _0x301eaf={};var _0x4b9b98={};var _0x233611;var _0x898c4e;return db['WhatsappAccount'][_0x56c0('0x65')]({'where':{'id':_0x1d9dc7['params']['id']}})['then'](handleEntityNotFound(_0x42fb39,null))[_0x56c0('0x20')](function(_0x577ca8){if(_0x577ca8){_0x233611=_0x577ca8;_0x4b9b98[_0x56c0('0x43')]=_[_0x56c0('0x44')](db['WhatsappApplication'][_0x56c0('0x41')]);_0x4b9b98[_0x56c0('0x45')]=_[_0x56c0('0x44')](_0x1d9dc7[_0x56c0('0x45')]);_0x4b9b98[_0x56c0('0x46')]=_['intersection'](_0x4b9b98['model'],_0x4b9b98['query']);_0x301eaf[_0x56c0('0x48')]=_[_0x56c0('0x47')](_0x4b9b98[_0x56c0('0x43')],qs[_0x56c0('0x49')](_0x1d9dc7['query'][_0x56c0('0x49')]));_0x301eaf[_0x56c0('0x48')]=_0x301eaf['attributes']['length']?_0x301eaf[_0x56c0('0x48')]:_0x4b9b98[_0x56c0('0x43')];_0x301eaf['order']=qs[_0x56c0('0x4c')](_0x1d9dc7['query']['sort']);_0x301eaf[_0x56c0('0x4d')]=qs['filters'](_[_0x56c0('0x4e')](_0x1d9dc7[_0x56c0('0x45')],_0x4b9b98[_0x56c0('0x46')]));if(_0x1d9dc7[_0x56c0('0x45')][_0x56c0('0x4f')]){_0x301eaf[_0x56c0('0x4d')]=_[_0x56c0('0x50')](_0x301eaf[_0x56c0('0x4d')],{'$or':_[_0x56c0('0x3f')](_0x301eaf[_0x56c0('0x48')],function(_0x577d89){var _0xd3bf4c={};_0xd3bf4c[_0x577d89]={'$like':'%'+_0x1d9dc7[_0x56c0('0x45')][_0x56c0('0x4f')]+'%'};return _0xd3bf4c;})});}_0x301eaf=_[_0x56c0('0x50')]({},_0x301eaf,_0x1d9dc7[_0x56c0('0x57')]);return _0x233611[_0x56c0('0x7e')](_0x301eaf);}})[_0x56c0('0x20')](function(_0x4ce7b7){if(_0x4ce7b7){_0x898c4e=_0x4ce7b7[_0x56c0('0x6c')];if(!_0x1d9dc7['query'][_0x56c0('0x6d')](_0x56c0('0x4a'))){_0x301eaf[_0x56c0('0x2f')]=qs['limit'](_0x1d9dc7[_0x56c0('0x45')][_0x56c0('0x2f')]);_0x301eaf[_0x56c0('0x2e')]=qs[_0x56c0('0x2e')](_0x1d9dc7[_0x56c0('0x45')][_0x56c0('0x2e')]);}return _0x233611['getApplications'](_0x301eaf);}})['then'](function(_0x58160f){if(_0x58160f){return _0x58160f?{'count':_0x898c4e,'rows':_0x58160f}:null;}})['then'](respondWithResult(_0x42fb39,null))[_0x56c0('0x2b')](handleError(_0x42fb39,null));};exports[_0x56c0('0x7f')]=function(_0x4a1d84,_0x27ca7a,_0x2aeb8b){var _0x4f396c={'channel':_0x56c0('0x80')};var _0x1dcd72=[];var _0x348e48=[];var _0x3ab63f={};return db[_0x56c0('0x40')]['find']({'where':{'id':_0x4a1d84[_0x56c0('0x56')]['id']},'include':[{'model':db[_0x56c0('0x7a')],'as':'Applications'}]})[_0x56c0('0x20')](handleEntityNotFound(_0x27ca7a,null))[_0x56c0('0x20')](function(_0x3d1096){_0x4f396c[_0x56c0('0x81')]=_0x3d1096;_0x4f396c[_0x56c0('0x82')]=_[_0x56c0('0x83')](_0x3d1096[_0x56c0('0x84')],[_0x56c0('0x7d')],['asc']);if(_0x4f396c[_0x56c0('0x81')]['Applications']){delete _0x4f396c[_0x56c0('0x81')][_0x56c0('0x84')];}return db[_0x56c0('0x85')][_0x56c0('0x62')]();})[_0x56c0('0x20')](function(_0x2f53cb){if(!_0x2f53cb){throw new db[(_0x56c0('0x86'))][(_0x56c0('0x87'))](_0x56c0('0x88'));}_0x1dcd72=_['difference'](_[_0x56c0('0x44')](_0x2f53cb),[_0x56c0('0x89'),_0x56c0('0x8a')]);_0x348e48=_[_0x56c0('0x8b')](_['keys'](_0x2f53cb),['createdAt',_0x56c0('0x8a'),_0x56c0('0x8c'),_0x56c0('0x8d')]);_0x4f396c[_0x56c0('0x5a')]={'mapKey':'mobile'};if(_0x4f396c[_0x56c0('0x81')][_0x56c0('0x42')]&&_0x4f396c[_0x56c0('0x81')]['type']===_0x56c0('0x8e')){_0x4f396c[_0x56c0('0x5a')][_0x56c0('0x8f')]=_0x4a1d84['body'][_0x56c0('0x90')]['replace'](_0x56c0('0x91'),'');_0x4f396c[_0x56c0('0x5a')][_0x56c0('0x5a')]=_0x4a1d84[_0x56c0('0x5a')][_0x56c0('0x92')];_0x4f396c['body']['messageId']=_0x4a1d84[_0x56c0('0x5a')][_0x56c0('0x93')];}if(_0x4f396c[_0x56c0('0x5a')]['id']){delete _0x4f396c[_0x56c0('0x5a')]['id'];}if(_[_0x56c0('0x94')](_0x4f396c[_0x56c0('0x5a')]['from'])){throw new db[(_0x56c0('0x86'))][(_0x56c0('0x87'))]('from\x20is\x20mandatory');}if(_[_0x56c0('0x94')](_0x4f396c['body'][_0x56c0('0x5a')])||_0x4f396c[_0x56c0('0x5a')][_0x56c0('0x5a')]===''){throw new db[(_0x56c0('0x86'))][(_0x56c0('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4f396c[_0x56c0('0x5a')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x56c0('0x95')+_0x348e48);}if(!_[_0x56c0('0x96')](_0x348e48,_0x4f396c[_0x56c0('0x5a')][_0x56c0('0x97')])){throw new db[(_0x56c0('0x86'))]['ValidationError'](_0x56c0('0x98')+_0x348e48);}_0x3ab63f[_0x4f396c[_0x56c0('0x5a')][_0x56c0('0x97')]]=_0x4f396c[_0x56c0('0x5a')]['from'];return db[_0x56c0('0x99')][_0x56c0('0x58')]({'where':{'id':_0x4f396c['account']['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3ab63f,'limit':0x1,'order':[[_0x56c0('0x8a'),_0x56c0('0x9a')]]}]});})[_0x56c0('0x20')](handleEntityNotFound(_0x27ca7a,null))[_0x56c0('0x20')](function(_0x448bcb){if(_0x448bcb){_0x4f396c[_0x56c0('0x9b')]=_[_0x56c0('0x70')](_0x448bcb,[_0x56c0('0x9c')]);if(_0x448bcb[_0x56c0('0x9c')]['length']){return _0x448bcb[_0x56c0('0x9c')][0x0];}var _0xf58f5d=_[_0x56c0('0x18')](_0x4f396c[_0x56c0('0x5a')],{'firstName':_0x4f396c['body'][_0x56c0('0x8f')],'ListId':_0x448bcb['id']});_0xf58f5d[_0x4f396c['body']['mapKey']]=_0x4f396c['body'][_0x56c0('0x8f')];return db[_0x56c0('0x85')]['create'](_0xf58f5d,{'fields':_0x1dcd72,'raw':!![]});}})['then'](handleEntityNotFound(_0x27ca7a,null))[_0x56c0('0x20')](function(_0x1f6b21){if(_0x1f6b21){_0x4f396c[_0x56c0('0x9d')]=_0x1f6b21;var _0x1d72bb={'ContactId':_0x1f6b21['id'],'phone':_0x4f396c[_0x56c0('0x5a')][_0x56c0('0x8f')],'WhatsappAccountId':_0x4a1d84[_0x56c0('0x56')]['id']};var _0x4589cb={'ContactId':_0x1f6b21['id'],'WhatsappAccountId':_0x4a1d84[_0x56c0('0x56')]['id'],'closed':![]};return db[_0x56c0('0x9e')][_0x56c0('0x58')]({'where':_0x4589cb})[_0x56c0('0x20')](function(_0x55c5a9){if(_0x55c5a9){return[_0x55c5a9,![]];}return db[_0x56c0('0x9e')][_0x56c0('0x59')](_0x1d72bb)[_0x56c0('0x20')](function(_0x365bfb){return[_0x365bfb,!![]];});});}})[_0x56c0('0x71')](function(_0x31509a,_0x56d485){_0x4f396c[_0x56c0('0x9f')]=_0x31509a['get']({'plain':!![]});_0x4f396c[_0x56c0('0x9f')]['created']=![];if(_0x56d485){if(_0x4f396c['account'][_0x56c0('0xa0')]){_0x4f396c[_0x56c0('0x82')][_0x56c0('0xa1')]({'id':0x0,'priority':_0x4f396c[_0x56c0('0x82')]['length']+0x1,'app':'close','appdata':_0x56c0('0xa2'),'interval':_0x56c0('0xa3')});}_0x4f396c['interaction'][_0x56c0('0xa4')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x4f396c['body'][_0x56c0('0x8f')],'messageId':_0x4f396c[_0x56c0('0x5a')][_0x56c0('0xa5')],'body':_0x4f396c[_0x56c0('0x5a')][_0x56c0('0x5a')],'WhatsappAccountId':_0x4a1d84[_0x56c0('0x56')]['id'],'WhatsappInteractionId':_0x31509a['id'],'direction':'in','ContactId':_0x31509a[_0x56c0('0xa6')],'AttachmentId':_0x4f396c[_0x56c0('0x5a')][_0x56c0('0xa7')]});})['then'](function(_0x4152af){_0x4f396c[_0x56c0('0x29')]=_0x4152af;if(_0x4f396c[_0x56c0('0x9f')][_0x56c0('0xa8')]){return db[_0x56c0('0x77')][_0x56c0('0x58')]({'attributes':['id',_0x56c0('0x3c')],'where':{'id':_0x4f396c[_0x56c0('0x9f')][_0x56c0('0xa8')]}})[_0x56c0('0x20')](function(_0x5dff0f){if(_0x5dff0f){_0x4f396c[_0x56c0('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0x56c0('0xa9'),'appdata':_0x5dff0f[_0x56c0('0x3c')]+','+(_0x4f396c[_0x56c0('0x81')][_0x56c0('0xaa')]||0xa),'interval':_0x56c0('0xa3')});}return respondWithRpcPromise('Start',_0x56c0('0xab'),_0x4f396c);});}return respondWithRpcPromise('Start',_0x56c0('0xab'),_0x4f396c);})[_0x56c0('0x20')](function(_0x1dac0d){if(_0x1dac0d){var _0x2d74ef=0xc8;var _0x4558d8=_0x56c0('0xac');logger['info'](_0x56c0('0x25'),_0x4558d8,_0x2d74ef,_0x56c0('0xad'));logger[_0x56c0('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4558d8,_0x2d74ef,'entity\x20found',JSON[_0x56c0('0x26')](_0x1dac0d));if(_0x4f396c[_0x56c0('0x81')][_0x56c0('0x42')]===_0x56c0('0x8e')){return _0x27ca7a['status'](_0x2d74ef)[_0x56c0('0x32')](_0x56c0('0xae'),_0x56c0('0xaf'))[_0x56c0('0xb0')](_0x56c0('0xb1'));}else{return _0x27ca7a[_0x56c0('0x2c')](_0x2d74ef)[_0x56c0('0x2d')](_0x1dac0d);}}})[_0x56c0('0x2b')](handleError(_0x27ca7a,null));};exports[_0x56c0('0xb0')]=function(_0xd85bd9,_0x49c15e,_0x48a321){var _0xeb8447,_0x19124b,_0x3982e1;if(_[_0x56c0('0x94')](_0xd85bd9[_0x56c0('0x5a')]['body'])||_0xd85bd9[_0x56c0('0x5a')][_0x56c0('0x5a')]===''){throw new db[(_0x56c0('0x86'))][(_0x56c0('0x87'))](_0x56c0('0xb2'));}if(_['isNil'](_0xd85bd9[_0x56c0('0x5a')]['to'])){throw new db['Sequelize']['ValidationError'](_0x56c0('0xb3'));}_0xeb8447=_0xd85bd9[_0x56c0('0x5a')]['to'];return db[_0x56c0('0x40')][_0x56c0('0x58')]({'where':{'id':_0xd85bd9[_0x56c0('0x56')]['id']},'include':[{'model':db[_0x56c0('0x99')],'as':_0x56c0('0xb4'),'include':[{'model':db[_0x56c0('0x85')],'as':_0x56c0('0x9c'),'where':{'mobile':_0xeb8447},'limit':0x1,'order':[[_0x56c0('0x8a'),_0x56c0('0x9a')]]}]}]})[_0x56c0('0x20')](handleEntityNotFound(_0x49c15e,null))[_0x56c0('0x20')](function(_0x4b657e){if(_0x4b657e&&_0x4b657e['List']){_0x19124b=_0x4b657e[_0x56c0('0x37')]({'plain':!![]});if(_0x19124b['List']&&_0x19124b[_0x56c0('0xb4')][_0x56c0('0x9c')][_0x56c0('0x6c')]){return _0x19124b[_0x56c0('0xb4')][_0x56c0('0x9c')][0x0];}return db[_0x56c0('0x85')][_0x56c0('0x59')](_['defaults'](_0xd85bd9[_0x56c0('0x5a')],{'firstName':_0xeb8447,'mobile':_0xeb8447,'phone':_0xeb8447,'ListId':_0x19124b[_0x56c0('0x8d')]}));}})[_0x56c0('0x20')](handleEntityNotFound(_0x49c15e,null))[_0x56c0('0x20')](function(_0x13a1e7){if(_0x13a1e7){_0x3982e1=_0x13a1e7;return db['WhatsappInteraction'][_0x56c0('0x58')]({'where':{'ContactId':_0x3982e1['id'],'closed':![],'WhatsappAccountId':_0x19124b['id']}})[_0x56c0('0x20')](function(_0x19bc4d){if(_0x19bc4d){return[_0x19bc4d,![]];}return db[_0x56c0('0x9e')][_0x56c0('0x59')]({'UserId':_0xd85bd9[_0x56c0('0x5b')]['id'],'ContactId':_0x3982e1['id'],'WhatsappAccountId':_0x19124b['id'],'phone':_0xeb8447,'firstMsgDirection':_0x56c0('0xb5'),'Messages':[_[_0x56c0('0x50')](_0xd85bd9[_0x56c0('0x5a')],{'read':![],'body':_0xd85bd9[_0x56c0('0x5a')][_0x56c0('0x5a')],'phone':_0xeb8447,'WhatsappAccountId':_0x19124b['id'],'UserId':_0xd85bd9[_0x56c0('0x5b')]['id'],'ContactId':_0x3982e1['id']})]},{'include':[{'model':db[_0x56c0('0xb6')],'as':_0x56c0('0xb7')}]})[_0x56c0('0x20')](function(_0x20cfa5){return[_0x20cfa5,!![]];});});}})[_0x56c0('0x71')](function(_0x1296f4,_0x18b507){if(_0x18b507){return _0x1296f4;}return db[_0x56c0('0xb6')][_0x56c0('0x59')](_[_0x56c0('0x50')](_0xd85bd9[_0x56c0('0x5a')],{'read':![],'body':_0xd85bd9[_0x56c0('0x5a')]['body'],'phone':_0xeb8447,'WhatsappAccountId':_0x19124b['id'],'WhatsappInteractionId':_0x1296f4['id'],'UserId':_0xd85bd9[_0x56c0('0x5b')]['id'],'ContactId':_0x3982e1['id']}))[_0x56c0('0x20')](function(_0xd64aaf){_0x1296f4['dataValues'][_0x56c0('0xb7')]=[];_0x1296f4[_0x56c0('0xb8')][_0x56c0('0xb7')][_0x56c0('0xa1')](_0xd64aaf[_0x56c0('0xb8')]);return _0x1296f4;});})[_0x56c0('0x20')](respondWithResult(_0x49c15e,null))[_0x56c0('0x2b')](handleError(_0x49c15e,null));}; \ No newline at end of file +var _0x7d35=['options','includeAll','findAll','catch','show','keys','rawAttributes','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','findOne','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','rows','removeAnswers','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','order','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','whatsapp','Applications','applications','orderBy','asc','account','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','twilio','From','replace','whatsapp:','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','Contacts','defaults','WhatsappInteraction','spread','created','autoclose','close','unmanaged','interaction','UserId','unshift','agent','*,*,*,*','startRouting','Start','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','WhatsappMessage','dataValues','Messages','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','limit','sort','pick','filters','where','VIRTUAL','filter','merge'];(function(_0x331b08,_0x2c5937){var _0x5034d9=function(_0x2c916a){while(--_0x2c916a){_0x331b08['push'](_0x331b08['shift']());}};_0x5034d9(++_0x2c5937);}(_0x7d35,0x11a));var _0x57d3=function(_0x1988f1,_0x290a23){_0x1988f1=_0x1988f1-0x0;var _0x3c848e=_0x7d35[_0x1988f1];return _0x3c848e;};'use strict';var emlformat=require(_0x57d3('0x0'));var rimraf=require(_0x57d3('0x1'));var zipdir=require(_0x57d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57d3('0x3'));var moment=require(_0x57d3('0x4'));var BPromise=require(_0x57d3('0x5'));var Mustache=require(_0x57d3('0x6'));var util=require(_0x57d3('0x7'));var path=require(_0x57d3('0x8'));var sox=require(_0x57d3('0x9'));var csv=require('to-csv');var ejs=require(_0x57d3('0xa'));var fs=require('fs');var fs_extra=require(_0x57d3('0xb'));var _=require(_0x57d3('0xc'));var squel=require(_0x57d3('0xd'));var crypto=require(_0x57d3('0xe'));var jsforce=require(_0x57d3('0xf'));var deskjs=require(_0x57d3('0x10'));var toCsv=require(_0x57d3('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x57d3('0x12'));var authService=require(_0x57d3('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57d3('0x14'));var logger=require(_0x57d3('0x15'))(_0x57d3('0x16'));var utils=require(_0x57d3('0x17'));var config=require(_0x57d3('0x18'));var licenseUtil=require(_0x57d3('0x19'));var db=require('../../mysqldb')['db'];config[_0x57d3('0x1a')]=_['defaults'](config[_0x57d3('0x1a')],{'host':_0x57d3('0x1b'),'port':0x18eb});var socket=require(_0x57d3('0x1c'))(new Redis(config[_0x57d3('0x1a')]));require('./whatsappAccount.socket')[_0x57d3('0x1d')](socket);var jayson=require(_0x57d3('0x1e'));var client=jayson[_0x57d3('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x325ef6,_0x55e284,_0x3f12b3,_0x338f13){return new BPromise(function(_0x1f81a8,_0x296f46){var _0x1b66e0=_0x338f13||client;return _0x1b66e0[_0x57d3('0x20')](_0x325ef6,_0x3f12b3)[_0x57d3('0x21')](function(_0x1eebc4){logger[_0x57d3('0x22')](_0x57d3('0x23'),_0x55e284,_0x57d3('0x24'));logger['debug'](_0x57d3('0x25'),_0x55e284,'request\x20sent',JSON[_0x57d3('0x26')](_0x1eebc4));if(_0x1eebc4[_0x57d3('0x27')]){if(_0x1eebc4[_0x57d3('0x27')][_0x57d3('0x28')]===0x1f4){logger[_0x57d3('0x27')](_0x57d3('0x23'),_0x55e284,_0x1eebc4[_0x57d3('0x27')][_0x57d3('0x29')]);return _0x296f46(_0x1eebc4['error'][_0x57d3('0x29')]);}logger[_0x57d3('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x55e284,_0x1eebc4[_0x57d3('0x27')]['message']);return _0x1f81a8(_0x1eebc4['error'][_0x57d3('0x29')]);}else{logger[_0x57d3('0x22')](_0x57d3('0x23'),_0x55e284,'request\x20sent');_0x1f81a8(_0x1eebc4['result'][_0x57d3('0x29')]);}})['catch'](function(_0x1c8c23){logger['error'](_0x57d3('0x23'),_0x55e284,_0x1c8c23);_0x296f46(_0x1c8c23);});});}function respondWithStatusCode(_0x20f31d,_0x4dcb20){_0x4dcb20=_0x4dcb20||0xcc;return function(_0x467475){if(_0x467475){return _0x20f31d['sendStatus'](_0x4dcb20);}return _0x20f31d[_0x57d3('0x2a')](_0x4dcb20)[_0x57d3('0x2b')]();};}function respondWithResult(_0xf8d36a,_0x16bb37){_0x16bb37=_0x16bb37||0xc8;return function(_0x487ea4){if(_0x487ea4){return _0xf8d36a[_0x57d3('0x2a')](_0x16bb37)[_0x57d3('0x2c')](_0x487ea4);}};}function respondWithFilteredResult(_0x2687cc,_0x583768){return function(_0x67cd66){if(_0x67cd66){var _0x5f5214=typeof _0x583768[_0x57d3('0x2d')]===_0x57d3('0x2e')&&typeof _0x583768['limit']===_0x57d3('0x2e');var _0x1d64ef=_0x67cd66[_0x57d3('0x2f')];var _0x58a98c=_0x5f5214?0x0:_0x583768[_0x57d3('0x2d')];var _0x2badbc=_0x5f5214?_0x67cd66['count']:_0x583768[_0x57d3('0x2d')]+_0x583768['limit'];var _0x1b8011;if(_0x2badbc>=_0x1d64ef){_0x2badbc=_0x1d64ef;_0x1b8011=0xc8;}else{_0x1b8011=0xce;}_0x2687cc['status'](_0x1b8011);return _0x2687cc[_0x57d3('0x30')](_0x57d3('0x31'),_0x58a98c+'-'+_0x2badbc+'/'+_0x1d64ef)[_0x57d3('0x2c')](_0x67cd66);}return null;};}function patchUpdates(_0xae9f57){return function(_0x5157f0){try{jsonpatch[_0x57d3('0x32')](_0x5157f0,_0xae9f57,!![]);}catch(_0x4299b3){return BPromise[_0x57d3('0x33')](_0x4299b3);}return _0x5157f0[_0x57d3('0x34')]();};}function saveUpdates(_0x39294f,_0x4003ba){return function(_0x1e234d){if(_0x1e234d){return _0x1e234d[_0x57d3('0x35')](_0x39294f)[_0x57d3('0x21')](function(_0x57a007){return _0x57a007;});}return null;};}function removeEntity(_0x2b422d,_0x214538){return function(_0xd09c75){if(_0xd09c75){return _0xd09c75['destroy']()[_0x57d3('0x21')](function(){var _0x155934=_0xd09c75[_0x57d3('0x36')]({'plain':!![]});var _0x53b159=_0x57d3('0x37');return db[_0x57d3('0x38')][_0x57d3('0x39')]({'where':{'type':_0x53b159,'resourceId':_0x155934['id']}})['then'](function(){return _0xd09c75;});})['then'](function(){_0x2b422d[_0x57d3('0x2a')](0xcc)[_0x57d3('0x2b')]();});}};}function handleEntityNotFound(_0x36c0d9,_0x189cff){return function(_0x36fe09){if(!_0x36fe09){_0x36c0d9['sendStatus'](0x194);}return _0x36fe09;};}function handleError(_0x175911,_0xa28c78){_0xa28c78=_0xa28c78||0x1f4;return function(_0x318c52){logger[_0x57d3('0x27')](_0x318c52[_0x57d3('0x3a')]);if(_0x318c52[_0x57d3('0x3b')]){delete _0x318c52[_0x57d3('0x3b')];}_0x175911[_0x57d3('0x2a')](_0xa28c78)[_0x57d3('0x3c')](_0x318c52);};}exports['index']=function(_0x4199a7,_0x49e794){var _0xa0f32d={'include':[{'model':db[_0x57d3('0x3d')],'as':_0x57d3('0x3e')}]},_0x3df046={},_0x5377f3={'count':0x0,'rows':[]};var _0x347dfc=_[_0x57d3('0x3f')](db[_0x57d3('0x40')]['rawAttributes'],function(_0x3d75db){return{'name':_0x3d75db[_0x57d3('0x41')],'type':_0x3d75db[_0x57d3('0x42')][_0x57d3('0x43')]};});_0x3df046[_0x57d3('0x44')]=_['map'](_0x347dfc,_0x57d3('0x3b'));_0x3df046[_0x57d3('0x45')]=_['keys'](_0x4199a7[_0x57d3('0x45')]);_0x3df046['filters']=_[_0x57d3('0x46')](_0x3df046['model'],_0x3df046['query']);_0xa0f32d[_0x57d3('0x47')]=_[_0x57d3('0x46')](_0x3df046[_0x57d3('0x44')],qs[_0x57d3('0x48')](_0x4199a7[_0x57d3('0x45')]['fields']));_0xa0f32d['attributes']=_0xa0f32d['attributes']['length']?_0xa0f32d['attributes']:_0x3df046[_0x57d3('0x44')];if(!_0x4199a7[_0x57d3('0x45')]['hasOwnProperty'](_0x57d3('0x49'))){_0xa0f32d[_0x57d3('0x4a')]=qs[_0x57d3('0x4a')](_0x4199a7[_0x57d3('0x45')]['limit']);_0xa0f32d[_0x57d3('0x2d')]=qs['offset'](_0x4199a7[_0x57d3('0x45')][_0x57d3('0x2d')]);}_0xa0f32d['order']=qs[_0x57d3('0x4b')](_0x4199a7['query'][_0x57d3('0x4b')]);_0xa0f32d['where']=qs['filters'](_[_0x57d3('0x4c')](_0x4199a7[_0x57d3('0x45')],_0x3df046[_0x57d3('0x4d')]),_0x347dfc);if(_0x4199a7[_0x57d3('0x45')]['filter']){_0xa0f32d[_0x57d3('0x4e')]=_['merge'](_0xa0f32d[_0x57d3('0x4e')],{'$or':_[_0x57d3('0x3f')](_0x347dfc,function(_0x4f965d){if(_0x4f965d[_0x57d3('0x42')]!==_0x57d3('0x4f')){var _0x54a72e={};_0x54a72e[_0x4f965d[_0x57d3('0x3b')]]={'$like':'%'+_0x4199a7['query'][_0x57d3('0x50')]+'%'};return _0x54a72e;}})});}_0xa0f32d=_[_0x57d3('0x51')]({},_0xa0f32d,_0x4199a7[_0x57d3('0x52')]);var _0x47afe2={'where':_0xa0f32d[_0x57d3('0x4e')]};return db[_0x57d3('0x40')][_0x57d3('0x2f')](_0x47afe2)[_0x57d3('0x21')](function(_0x66415a){_0x5377f3['count']=_0x66415a;if(_0x4199a7[_0x57d3('0x45')][_0x57d3('0x53')]){_0xa0f32d['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x57d3('0x54')](_0xa0f32d);})['then'](function(_0x1d26e6){_0x5377f3['rows']=_0x1d26e6;return _0x5377f3;})[_0x57d3('0x21')](respondWithFilteredResult(_0x49e794,_0xa0f32d))[_0x57d3('0x55')](handleError(_0x49e794,null));};exports[_0x57d3('0x56')]=function(_0x5ed102,_0x4cc137){var _0x631b58={'raw':![],'where':{'id':_0x5ed102['params']['id']},'include':[{'model':db[_0x57d3('0x3d')],'as':_0x57d3('0x3e')}]},_0x49397b={};_0x49397b[_0x57d3('0x44')]=_[_0x57d3('0x57')](db[_0x57d3('0x40')][_0x57d3('0x58')]);_0x49397b['query']=_[_0x57d3('0x57')](_0x5ed102[_0x57d3('0x45')]);_0x49397b[_0x57d3('0x4d')]=_[_0x57d3('0x46')](_0x49397b[_0x57d3('0x44')],_0x49397b['query']);_0x631b58['attributes']=_[_0x57d3('0x46')](_0x49397b[_0x57d3('0x44')],qs[_0x57d3('0x48')](_0x5ed102[_0x57d3('0x45')][_0x57d3('0x48')]));_0x631b58[_0x57d3('0x47')]=_0x631b58[_0x57d3('0x47')][_0x57d3('0x59')]?_0x631b58[_0x57d3('0x47')]:_0x49397b[_0x57d3('0x44')];if(_0x5ed102['query'][_0x57d3('0x53')]){_0x631b58[_0x57d3('0x5a')]=[{'all':!![]}];}_0x631b58=_[_0x57d3('0x51')]({},_0x631b58,_0x5ed102[_0x57d3('0x52')]);return db['WhatsappAccount']['find'](_0x631b58)[_0x57d3('0x21')](handleEntityNotFound(_0x4cc137,null))[_0x57d3('0x21')](respondWithResult(_0x4cc137,null))[_0x57d3('0x55')](handleError(_0x4cc137,null));};exports[_0x57d3('0x5b')]=function(_0x1be283,_0x27b71c){return db[_0x57d3('0x40')][_0x57d3('0x5b')](_0x1be283[_0x57d3('0x5c')],{})[_0x57d3('0x21')](function(_0x243fec){var _0x1bd57d=_0x1be283[_0x57d3('0x5d')][_0x57d3('0x36')]({'plain':!![]});if(!_0x1bd57d)throw new Error(_0x57d3('0x5e'));if(_0x1bd57d[_0x57d3('0x5f')]===_0x57d3('0x5d')){var _0x421832=_0x243fec['get']({'plain':!![]});var _0x17a240='WhatsappAccounts';return db[_0x57d3('0x60')][_0x57d3('0x61')]({'where':{'name':_0x17a240,'userProfileId':_0x1bd57d['userProfileId']},'raw':!![]})[_0x57d3('0x21')](function(_0x2b19f2){if(_0x2b19f2&&_0x2b19f2[_0x57d3('0x62')]===0x0){return db[_0x57d3('0x38')]['create']({'name':_0x421832[_0x57d3('0x3b')],'resourceId':_0x421832['id'],'type':_0x2b19f2[_0x57d3('0x3b')],'sectionId':_0x2b19f2['id']},{})[_0x57d3('0x21')](function(){return _0x243fec;});}else{return _0x243fec;}})[_0x57d3('0x55')](function(_0x36f235){logger[_0x57d3('0x27')](_0x57d3('0x63'),_0x36f235);throw _0x36f235;});}return _0x243fec;})['then'](respondWithResult(_0x27b71c,0xc9))[_0x57d3('0x55')](handleError(_0x27b71c,null));};exports[_0x57d3('0x35')]=function(_0x3b0c6e,_0x3b0ef8){if(_0x3b0c6e[_0x57d3('0x5c')]['id']){delete _0x3b0c6e[_0x57d3('0x5c')]['id'];}return db['WhatsappAccount'][_0x57d3('0x61')]({'where':{'id':_0x3b0c6e[_0x57d3('0x64')]['id']},'include':[{'model':db[_0x57d3('0x3d')],'as':_0x57d3('0x3e')}]})['then'](handleEntityNotFound(_0x3b0ef8,null))[_0x57d3('0x21')](saveUpdates(_0x3b0c6e[_0x57d3('0x5c')],null))[_0x57d3('0x21')](respondWithResult(_0x3b0ef8,null))[_0x57d3('0x55')](handleError(_0x3b0ef8,null));};exports['destroy']=function(_0x1234c9,_0x26de51){return db[_0x57d3('0x40')]['find']({'where':{'id':_0x1234c9[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x26de51,null))[_0x57d3('0x21')](removeEntity(_0x26de51,null))[_0x57d3('0x55')](handleError(_0x26de51,null));};exports[_0x57d3('0x65')]=function(_0xaa9fd5,_0x353082){return db['WhatsappAccount'][_0x57d3('0x65')]()[_0x57d3('0x21')](respondWithResult(_0x353082,null))[_0x57d3('0x55')](handleError(_0x353082,null));};exports['addDisposition']=function(_0x260ecb,_0x4302bd,_0x1574d3){if(_0x260ecb['body']['id']){delete _0x260ecb[_0x57d3('0x5c')]['id'];}return db[_0x57d3('0x40')][_0x57d3('0x61')]({'where':{'id':_0x260ecb[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x4302bd,null))[_0x57d3('0x21')](function(_0x3968e4){if(_0x3968e4){_0x260ecb['body'][_0x57d3('0x66')]=_0x3968e4['id'];return db['Disposition'][_0x57d3('0x5b')](_0x260ecb['body']);}})[_0x57d3('0x21')](respondWithResult(_0x4302bd,null))[_0x57d3('0x55')](handleError(_0x4302bd,null));};exports['getDispositions']=function(_0x5c4d1c,_0x2538d8,_0x3cb8f9){var _0x42bf64={'raw':![],'where':{}};var _0x2cddfc={};var _0x536fc6={'count':0x0,'rows':[]};return db[_0x57d3('0x40')][_0x57d3('0x67')]({'where':{'id':_0x5c4d1c[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x2538d8,null))[_0x57d3('0x21')](function(_0x5d12c7){if(_0x5d12c7){_0x2cddfc[_0x57d3('0x44')]=_['keys'](db[_0x57d3('0x68')]['rawAttributes']);_0x2cddfc[_0x57d3('0x45')]=_['keys'](_0x5c4d1c[_0x57d3('0x45')]);_0x2cddfc[_0x57d3('0x4d')]=_['intersection'](_0x2cddfc[_0x57d3('0x44')],_0x2cddfc['query']);_0x42bf64[_0x57d3('0x47')]=_[_0x57d3('0x46')](_0x2cddfc[_0x57d3('0x44')],qs['fields'](_0x5c4d1c[_0x57d3('0x45')][_0x57d3('0x48')]));_0x42bf64[_0x57d3('0x47')]=_0x42bf64[_0x57d3('0x47')][_0x57d3('0x59')]?_0x42bf64[_0x57d3('0x47')]:_0x2cddfc['model'];if(!_0x5c4d1c[_0x57d3('0x45')]['hasOwnProperty'](_0x57d3('0x49'))){_0x42bf64['limit']=qs[_0x57d3('0x4a')](_0x5c4d1c['query'][_0x57d3('0x4a')]);_0x42bf64[_0x57d3('0x2d')]=qs[_0x57d3('0x2d')](_0x5c4d1c['query'][_0x57d3('0x2d')]);}_0x42bf64['order']=qs['sort'](_0x5c4d1c[_0x57d3('0x45')]['sort']);_0x42bf64[_0x57d3('0x4e')]=qs[_0x57d3('0x4d')](_[_0x57d3('0x4c')](_0x5c4d1c[_0x57d3('0x45')],_0x2cddfc[_0x57d3('0x4d')]));_0x42bf64[_0x57d3('0x4e')][_0x57d3('0x66')]=_0x5d12c7['id'];if(_0x5c4d1c['query']['filter']){_0x42bf64[_0x57d3('0x4e')]=_[_0x57d3('0x51')](_0x42bf64[_0x57d3('0x4e')],{'$or':_[_0x57d3('0x3f')](_0x42bf64[_0x57d3('0x47')],function(_0x574e7e){var _0x3f4c40={};_0x3f4c40[_0x574e7e]={'$like':'%'+_0x5c4d1c[_0x57d3('0x45')][_0x57d3('0x50')]+'%'};return _0x3f4c40;})});}_0x42bf64=_['merge']({},_0x42bf64,_0x5c4d1c[_0x57d3('0x52')]);return db[_0x57d3('0x68')][_0x57d3('0x2f')]({'where':_0x42bf64[_0x57d3('0x4e')]})[_0x57d3('0x21')](function(_0x5077e0){_0x536fc6[_0x57d3('0x2f')]=_0x5077e0;if(_0x5c4d1c[_0x57d3('0x45')][_0x57d3('0x53')]){_0x42bf64[_0x57d3('0x5a')]=[{'all':!![]}];}return db[_0x57d3('0x68')][_0x57d3('0x54')](_0x42bf64);})[_0x57d3('0x21')](function(_0x469f50){_0x536fc6['rows']=_0x469f50;return _0x536fc6;});}})[_0x57d3('0x21')](respondWithFilteredResult(_0x2538d8,_0x42bf64))[_0x57d3('0x55')](handleError(_0x2538d8,null));};exports[_0x57d3('0x69')]=function(_0x5854a5,_0x33ad07,_0x4a19c7){return db[_0x57d3('0x40')]['find']({'where':{'id':_0x5854a5['params']['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x33ad07,null))['then'](function(_0x4dec0f){if(_0x4dec0f){return _0x4dec0f[_0x57d3('0x69')](_0x5854a5[_0x57d3('0x45')][_0x57d3('0x6a')]);}})[_0x57d3('0x21')](respondWithStatusCode(_0x33ad07,null))['catch'](handleError(_0x33ad07,null));};exports['addAnswer']=function(_0xee0dcd,_0x130071,_0x4f8264){if(_0xee0dcd[_0x57d3('0x5c')]['id']){delete _0xee0dcd['body']['id'];}return db[_0x57d3('0x40')][_0x57d3('0x61')]({'where':{'id':_0xee0dcd[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x130071,null))['then'](function(_0x22b3bb){if(_0x22b3bb){_0xee0dcd[_0x57d3('0x5c')]['WhatsappAccountId']=_0x22b3bb['id'];return db[_0x57d3('0x6b')]['create'](_0xee0dcd[_0x57d3('0x5c')]);}})[_0x57d3('0x21')](respondWithResult(_0x130071,null))[_0x57d3('0x55')](handleError(_0x130071,null));};exports[_0x57d3('0x6c')]=function(_0x3eb3bc,_0x5b5ccb,_0x33144e){var _0x29124a={'raw':![],'where':{}};var _0x21b851={};var _0x3ad915={'count':0x0,'rows':[]};return db[_0x57d3('0x40')]['findOne']({'where':{'id':_0x3eb3bc['params']['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x5b5ccb,null))[_0x57d3('0x21')](function(_0x14600c){if(_0x14600c){_0x21b851['model']=_['keys'](db[_0x57d3('0x6b')][_0x57d3('0x58')]);_0x21b851[_0x57d3('0x45')]=_[_0x57d3('0x57')](_0x3eb3bc[_0x57d3('0x45')]);_0x21b851['filters']=_[_0x57d3('0x46')](_0x21b851['model'],_0x21b851[_0x57d3('0x45')]);_0x29124a['attributes']=_[_0x57d3('0x46')](_0x21b851[_0x57d3('0x44')],qs[_0x57d3('0x48')](_0x3eb3bc[_0x57d3('0x45')]['fields']));_0x29124a['attributes']=_0x29124a[_0x57d3('0x47')][_0x57d3('0x59')]?_0x29124a['attributes']:_0x21b851[_0x57d3('0x44')];if(!_0x3eb3bc[_0x57d3('0x45')][_0x57d3('0x6d')](_0x57d3('0x49'))){_0x29124a[_0x57d3('0x4a')]=qs[_0x57d3('0x4a')](_0x3eb3bc['query']['limit']);_0x29124a[_0x57d3('0x2d')]=qs[_0x57d3('0x2d')](_0x3eb3bc[_0x57d3('0x45')][_0x57d3('0x2d')]);}_0x29124a['order']=qs[_0x57d3('0x4b')](_0x3eb3bc[_0x57d3('0x45')]['sort']);_0x29124a[_0x57d3('0x4e')]=qs[_0x57d3('0x4d')](_['pick'](_0x3eb3bc[_0x57d3('0x45')],_0x21b851[_0x57d3('0x4d')]));_0x29124a['where'][_0x57d3('0x66')]=_0x14600c['id'];if(_0x3eb3bc[_0x57d3('0x45')][_0x57d3('0x50')]){_0x29124a[_0x57d3('0x4e')]=_[_0x57d3('0x51')](_0x29124a['where'],{'$or':_['map'](_0x29124a[_0x57d3('0x47')],function(_0x3bd289){var _0x1783d8={};_0x1783d8[_0x3bd289]={'$like':'%'+_0x3eb3bc['query']['filter']+'%'};return _0x1783d8;})});}_0x29124a=_[_0x57d3('0x51')]({},_0x29124a,_0x3eb3bc[_0x57d3('0x52')]);return db[_0x57d3('0x6b')][_0x57d3('0x2f')]({'where':_0x29124a[_0x57d3('0x4e')]})[_0x57d3('0x21')](function(_0x195c33){_0x3ad915[_0x57d3('0x2f')]=_0x195c33;if(_0x3eb3bc[_0x57d3('0x45')][_0x57d3('0x53')]){_0x29124a[_0x57d3('0x5a')]=[{'all':!![]}];}return db[_0x57d3('0x6b')]['findAll'](_0x29124a);})['then'](function(_0x38e708){_0x3ad915[_0x57d3('0x6e')]=_0x38e708;return _0x3ad915;});}})['then'](respondWithFilteredResult(_0x5b5ccb,_0x29124a))['catch'](handleError(_0x5b5ccb,null));};exports[_0x57d3('0x6f')]=function(_0x4dcaa7,_0x43faef,_0x456757){return db['WhatsappAccount'][_0x57d3('0x61')]({'where':{'id':_0x4dcaa7['params']['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x43faef,null))[_0x57d3('0x21')](function(_0x168555){if(_0x168555){return _0x168555[_0x57d3('0x6f')](_0x4dcaa7[_0x57d3('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x43faef,null))[_0x57d3('0x55')](handleError(_0x43faef,null));};exports['addAgents']=function(_0x17c7bc,_0x38577c,_0x4fc5be){return db[_0x57d3('0x40')][_0x57d3('0x61')]({'where':{'id':_0x17c7bc[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x38577c,null))[_0x57d3('0x21')](function(_0xf09f4){if(_0xf09f4){return _0xf09f4['addAgents'](_0x17c7bc[_0x57d3('0x5c')]['ids'],_[_0x57d3('0x70')](_0x17c7bc[_0x57d3('0x5c')],[_0x57d3('0x6a'),'id'])||{})['spread'](function(_0x3b4a08){for(var _0xaad633=0x0;_0xaad633<_0x17c7bc[_0x57d3('0x5c')][_0x57d3('0x6a')]['length'];_0xaad633+=0x1){socket[_0x57d3('0x71')](_0x57d3('0x72'),{'UserId':Number(_0x17c7bc['body'][_0x57d3('0x6a')][_0xaad633]),'WhatsappAccountId':Number(_0x17c7bc['params']['id'])});}return _0x3b4a08;});}})[_0x57d3('0x21')](respondWithResult(_0x38577c,null))[_0x57d3('0x55')](handleError(_0x38577c,null));};exports[_0x57d3('0x73')]=function(_0x534f7b,_0x404436,_0x473d7a){return db['WhatsappAccount'][_0x57d3('0x61')]({'where':{'id':_0x534f7b[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x404436,null))[_0x57d3('0x21')](function(_0x328f5b){if(_0x328f5b){return _0x328f5b[_0x57d3('0x73')](_0x534f7b['query'][_0x57d3('0x6a')])['then'](function(){if(_['isArray'](_0x534f7b['query'][_0x57d3('0x6a')])){for(var _0x10ff46=0x0;_0x10ff46<_0x534f7b['query']['ids'][_0x57d3('0x59')];_0x10ff46+=0x1){socket[_0x57d3('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x534f7b[_0x57d3('0x45')]['ids'][_0x10ff46]),'WhatsappAccountId':Number(_0x534f7b['params']['id'])});}}else{socket[_0x57d3('0x71')](_0x57d3('0x74'),{'UserId':Number(_0x534f7b[_0x57d3('0x45')][_0x57d3('0x6a')]),'WhatsappAccountId':Number(_0x534f7b[_0x57d3('0x64')]['id'])});}});}})[_0x57d3('0x21')](respondWithStatusCode(_0x404436,null))['catch'](handleError(_0x404436,null));};exports[_0x57d3('0x75')]=function(_0x4461be,_0x55f5b9,_0x82c124){var _0x5d4dd6={};var _0x400f49={};var _0x501d82;var _0x1d530e;return db[_0x57d3('0x40')][_0x57d3('0x67')]({'where':{'id':_0x4461be[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x55f5b9,null))['then'](function(_0x9e93cb){if(_0x9e93cb){_0x501d82=_0x9e93cb;_0x400f49[_0x57d3('0x44')]=_['keys'](db[_0x57d3('0x76')][_0x57d3('0x58')]);_0x400f49[_0x57d3('0x45')]=_[_0x57d3('0x57')](_0x4461be['query']);_0x400f49[_0x57d3('0x4d')]=_['intersection'](_0x400f49[_0x57d3('0x44')],_0x400f49['query']);_0x5d4dd6[_0x57d3('0x47')]=_[_0x57d3('0x46')](_0x400f49[_0x57d3('0x44')],qs['fields'](_0x4461be['query'][_0x57d3('0x48')]));_0x5d4dd6['attributes']=_0x5d4dd6[_0x57d3('0x47')][_0x57d3('0x59')]?_0x5d4dd6['attributes']:_0x400f49['model'];_0x5d4dd6[_0x57d3('0x77')]=qs[_0x57d3('0x4b')](_0x4461be[_0x57d3('0x45')]['sort']);_0x5d4dd6[_0x57d3('0x4e')]=qs['filters'](_[_0x57d3('0x4c')](_0x4461be[_0x57d3('0x45')],_0x400f49[_0x57d3('0x4d')]));if(_0x4461be[_0x57d3('0x45')]['filter']){_0x5d4dd6['where']=_['merge'](_0x5d4dd6[_0x57d3('0x4e')],{'$or':_[_0x57d3('0x3f')](_0x5d4dd6[_0x57d3('0x47')],function(_0x30246a){var _0x27afef={};_0x27afef[_0x30246a]={'$like':'%'+_0x4461be[_0x57d3('0x45')]['filter']+'%'};return _0x27afef;})});}_0x5d4dd6=_[_0x57d3('0x51')]({},_0x5d4dd6,_0x4461be[_0x57d3('0x52')]);return _0x501d82[_0x57d3('0x75')](_0x5d4dd6);}})['then'](function(_0x2ef7f7){if(_0x2ef7f7){_0x1d530e=_0x2ef7f7[_0x57d3('0x59')];if(!_0x4461be[_0x57d3('0x45')][_0x57d3('0x6d')](_0x57d3('0x49'))){_0x5d4dd6[_0x57d3('0x4a')]=qs[_0x57d3('0x4a')](_0x4461be[_0x57d3('0x45')][_0x57d3('0x4a')]);_0x5d4dd6[_0x57d3('0x2d')]=qs['offset'](_0x4461be['query'][_0x57d3('0x2d')]);}return _0x501d82[_0x57d3('0x75')](_0x5d4dd6);}})[_0x57d3('0x21')](function(_0x128574){if(_0x128574){return _0x128574?{'count':_0x1d530e,'rows':_0x128574}:null;}})['then'](respondWithResult(_0x55f5b9,null))['catch'](handleError(_0x55f5b9,null));};exports[_0x57d3('0x78')]=function(_0x536b05,_0x3d6e6e,_0x5b273f){return db['WhatsappAccount'][_0x57d3('0x67')]({'where':{'id':_0x536b05[_0x57d3('0x64')]['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x3d6e6e,null))[_0x57d3('0x21')](function(_0x4567d1){if(_0x4567d1){return db[_0x57d3('0x79')][_0x57d3('0x7a')](function(_0x113e7d){return db[_0x57d3('0x7b')][_0x57d3('0x39')]({'where':{'WhatsappAccountId':_0x536b05[_0x57d3('0x64')]['id']},'transaction':_0x113e7d})[_0x57d3('0x21')](function(_0x3b3bba){var _0x483eff=_['map'](_0x536b05[_0x57d3('0x5c')],function(_0x3e658c){_0x3e658c[_0x57d3('0x66')]=_0x536b05['params']['id'];return _0x3e658c;});return db[_0x57d3('0x7b')][_0x57d3('0x7c')](_0x483eff,{'transaction':_0x113e7d});});})[_0x57d3('0x21')](function(){return db[_0x57d3('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x536b05[_0x57d3('0x64')]['id']},'order':_0x57d3('0x7d')});});}})[_0x57d3('0x21')](respondWithResult(_0x3d6e6e,null))[_0x57d3('0x55')](handleError(_0x3d6e6e,null));};exports[_0x57d3('0x7e')]=function(_0x19f1f4,_0x418199,_0x2cc61b){var _0x71e61e={};var _0x2baba1={};var _0x338e3f;var _0x3512ee;return db[_0x57d3('0x40')][_0x57d3('0x67')]({'where':{'id':_0x19f1f4['params']['id']}})[_0x57d3('0x21')](handleEntityNotFound(_0x418199,null))['then'](function(_0x395803){if(_0x395803){_0x338e3f=_0x395803;_0x2baba1[_0x57d3('0x44')]=_[_0x57d3('0x57')](db['WhatsappApplication'][_0x57d3('0x58')]);_0x2baba1[_0x57d3('0x45')]=_[_0x57d3('0x57')](_0x19f1f4[_0x57d3('0x45')]);_0x2baba1[_0x57d3('0x4d')]=_[_0x57d3('0x46')](_0x2baba1[_0x57d3('0x44')],_0x2baba1[_0x57d3('0x45')]);_0x71e61e[_0x57d3('0x47')]=_[_0x57d3('0x46')](_0x2baba1[_0x57d3('0x44')],qs['fields'](_0x19f1f4[_0x57d3('0x45')][_0x57d3('0x48')]));_0x71e61e[_0x57d3('0x47')]=_0x71e61e[_0x57d3('0x47')]['length']?_0x71e61e['attributes']:_0x2baba1['model'];_0x71e61e['order']=qs[_0x57d3('0x4b')](_0x19f1f4[_0x57d3('0x45')][_0x57d3('0x4b')]);_0x71e61e['where']=qs[_0x57d3('0x4d')](_[_0x57d3('0x4c')](_0x19f1f4['query'],_0x2baba1[_0x57d3('0x4d')]));if(_0x19f1f4[_0x57d3('0x45')][_0x57d3('0x50')]){_0x71e61e[_0x57d3('0x4e')]=_[_0x57d3('0x51')](_0x71e61e['where'],{'$or':_[_0x57d3('0x3f')](_0x71e61e['attributes'],function(_0x5cc162){var _0x35853d={};_0x35853d[_0x5cc162]={'$like':'%'+_0x19f1f4[_0x57d3('0x45')][_0x57d3('0x50')]+'%'};return _0x35853d;})});}_0x71e61e=_[_0x57d3('0x51')]({},_0x71e61e,_0x19f1f4[_0x57d3('0x52')]);return _0x338e3f[_0x57d3('0x7e')](_0x71e61e);}})['then'](function(_0x4f6767){if(_0x4f6767){_0x3512ee=_0x4f6767['length'];if(!_0x19f1f4['query'][_0x57d3('0x6d')](_0x57d3('0x49'))){_0x71e61e[_0x57d3('0x4a')]=qs[_0x57d3('0x4a')](_0x19f1f4[_0x57d3('0x45')]['limit']);_0x71e61e[_0x57d3('0x2d')]=qs[_0x57d3('0x2d')](_0x19f1f4['query'][_0x57d3('0x2d')]);}return _0x338e3f[_0x57d3('0x7e')](_0x71e61e);}})[_0x57d3('0x21')](function(_0x5b6ab7){if(_0x5b6ab7){return _0x5b6ab7?{'count':_0x3512ee,'rows':_0x5b6ab7}:null;}})[_0x57d3('0x21')](respondWithResult(_0x418199,null))[_0x57d3('0x55')](handleError(_0x418199,null));};exports['notify']=function(_0x543ba2,_0x427b73,_0x27a7f9){var _0x6ce185={'channel':_0x57d3('0x7f')};var _0x586c79=[];var _0x38ea04=[];var _0x4260ae={};return db[_0x57d3('0x40')][_0x57d3('0x61')]({'where':{'id':_0x543ba2[_0x57d3('0x64')]['id']},'include':[{'model':db[_0x57d3('0x7b')],'as':_0x57d3('0x80')}]})[_0x57d3('0x21')](handleEntityNotFound(_0x427b73,null))[_0x57d3('0x21')](function(_0x2b4191){_0x6ce185['account']=_0x2b4191;_0x6ce185[_0x57d3('0x81')]=_[_0x57d3('0x82')](_0x2b4191[_0x57d3('0x80')],[_0x57d3('0x7d')],[_0x57d3('0x83')]);if(_0x6ce185[_0x57d3('0x84')][_0x57d3('0x80')]){delete _0x6ce185[_0x57d3('0x84')]['Applications'];}return db[_0x57d3('0x85')][_0x57d3('0x65')]();})[_0x57d3('0x21')](function(_0x91366f){if(!_0x91366f){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))]('no\x20available\x20attributes');}_0x586c79=_[_0x57d3('0x88')](_[_0x57d3('0x57')](_0x91366f),[_0x57d3('0x89'),_0x57d3('0x8a')]);_0x38ea04=_[_0x57d3('0x88')](_[_0x57d3('0x57')](_0x91366f),['createdAt',_0x57d3('0x8a'),'CompanyId',_0x57d3('0x8b')]);_0x6ce185[_0x57d3('0x5c')]={'mapKey':'mobile'};if(_0x6ce185[_0x57d3('0x84')][_0x57d3('0x42')]&&_0x6ce185['account'][_0x57d3('0x42')]===_0x57d3('0x8c')){_0x6ce185['body']['from']=_0x543ba2[_0x57d3('0x5c')][_0x57d3('0x8d')][_0x57d3('0x8e')](_0x57d3('0x8f'),'');_0x6ce185[_0x57d3('0x5c')]['body']=_0x543ba2['body']['Body'];_0x6ce185[_0x57d3('0x5c')]['messageId']=_0x543ba2['body']['MessageSid'];}if(_0x6ce185['body']['id']){delete _0x6ce185[_0x57d3('0x5c')]['id'];}if(_[_0x57d3('0x90')](_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')])){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))]('from\x20is\x20mandatory');}if(_[_0x57d3('0x90')](_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x5c')])||_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x5c')]===''){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x92')])){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))](_0x57d3('0x93')+_0x38ea04);}if(!_[_0x57d3('0x94')](_0x38ea04,_0x6ce185[_0x57d3('0x5c')]['mapKey'])){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))](_0x57d3('0x95')+_0x38ea04);}_0x4260ae[_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x92')]]=_0x6ce185[_0x57d3('0x5c')]['from'];return db['CmList'][_0x57d3('0x61')]({'where':{'id':_0x6ce185[_0x57d3('0x84')]['ListId']},'include':[{'model':db[_0x57d3('0x85')],'as':'Contacts','where':_0x4260ae,'limit':0x1,'order':[[_0x57d3('0x8a'),_0x57d3('0x96')]]}]});})[_0x57d3('0x21')](handleEntityNotFound(_0x427b73,null))['then'](function(_0x53d81a){if(_0x53d81a){_0x6ce185[_0x57d3('0x97')]=_['omit'](_0x53d81a,[_0x57d3('0x98')]);if(_0x53d81a[_0x57d3('0x98')][_0x57d3('0x59')]){return _0x53d81a[_0x57d3('0x98')][0x0];}var _0x52e9f7=_[_0x57d3('0x99')](_0x6ce185[_0x57d3('0x5c')],{'firstName':_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')],'ListId':_0x53d81a['id']});_0x52e9f7[_0x6ce185['body'][_0x57d3('0x92')]]=_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')];return db[_0x57d3('0x85')][_0x57d3('0x5b')](_0x52e9f7,{'fields':_0x586c79,'raw':!![]});}})[_0x57d3('0x21')](handleEntityNotFound(_0x427b73,null))[_0x57d3('0x21')](function(_0x5653cc){if(_0x5653cc){_0x6ce185['contact']=_0x5653cc;var _0x56ece7={'ContactId':_0x5653cc['id'],'phone':_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')],'WhatsappAccountId':_0x543ba2[_0x57d3('0x64')]['id']};var _0xd05388={'ContactId':_0x5653cc['id'],'WhatsappAccountId':_0x543ba2[_0x57d3('0x64')]['id'],'closed':![]};return db[_0x57d3('0x9a')][_0x57d3('0x61')]({'where':_0xd05388})[_0x57d3('0x21')](function(_0x2af941){if(_0x2af941){return[_0x2af941,![]];}return db[_0x57d3('0x9a')][_0x57d3('0x5b')](_0x56ece7)[_0x57d3('0x21')](function(_0x38d877){return[_0x38d877,!![]];});});}})[_0x57d3('0x9b')](function(_0x261ec5,_0x5b52f6){_0x6ce185['interaction']=_0x261ec5[_0x57d3('0x36')]({'plain':!![]});_0x6ce185['interaction'][_0x57d3('0x9c')]=![];if(_0x5b52f6){if(_0x6ce185[_0x57d3('0x84')][_0x57d3('0x9d')]){_0x6ce185[_0x57d3('0x81')]['push']({'id':0x0,'priority':_0x6ce185[_0x57d3('0x81')][_0x57d3('0x59')]+0x1,'app':_0x57d3('0x9e'),'appdata':_0x57d3('0x9f'),'interval':'*,*,*,*'});}_0x6ce185[_0x57d3('0xa0')][_0x57d3('0x9c')]=!![];}return db['WhatsappMessage'][_0x57d3('0x5b')]({'phone':_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x91')],'messageId':_0x6ce185[_0x57d3('0x5c')]['messageId'],'body':_0x6ce185[_0x57d3('0x5c')][_0x57d3('0x5c')],'WhatsappAccountId':_0x543ba2[_0x57d3('0x64')]['id'],'WhatsappInteractionId':_0x261ec5['id'],'direction':'in','ContactId':_0x261ec5['ContactId'],'AttachmentId':_0x6ce185[_0x57d3('0x5c')]['AttachmentId']});})[_0x57d3('0x21')](function(_0x49a455){_0x6ce185[_0x57d3('0x29')]=_0x49a455;if(_0x6ce185['interaction'][_0x57d3('0xa1')]){return db[_0x57d3('0x76')][_0x57d3('0x61')]({'attributes':['id','name'],'where':{'id':_0x6ce185['interaction'][_0x57d3('0xa1')]}})[_0x57d3('0x21')](function(_0x58f8ef){if(_0x58f8ef){_0x6ce185[_0x57d3('0x81')][_0x57d3('0xa2')]({'id':0x0,'priority':0x0,'app':_0x57d3('0xa3'),'appdata':_0x58f8ef[_0x57d3('0x3b')]+','+(_0x6ce185[_0x57d3('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0x57d3('0xa4')});}return respondWithRpcPromise('Start',_0x57d3('0xa5'),_0x6ce185);});}return respondWithRpcPromise(_0x57d3('0xa6'),_0x57d3('0xa5'),_0x6ce185);})[_0x57d3('0x21')](function(_0x2a8475){if(_0x2a8475){var _0x11c680=0xc8;var _0x3d0032=_0x57d3('0xa7');logger[_0x57d3('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3d0032,_0x11c680,'entity\x20found');logger[_0x57d3('0xa8')](_0x57d3('0xa9'),_0x3d0032,_0x11c680,_0x57d3('0xaa'),JSON[_0x57d3('0x26')](_0x2a8475));if(_0x6ce185[_0x57d3('0x84')]['type']===_0x57d3('0x8c')){return _0x427b73['status'](_0x11c680)[_0x57d3('0x30')](_0x57d3('0xab'),'text/xml')[_0x57d3('0x3c')](_0x57d3('0xac'));}else{return _0x427b73[_0x57d3('0x2a')](_0x11c680)[_0x57d3('0x2c')](_0x2a8475);}}})['catch'](handleError(_0x427b73,null));};exports[_0x57d3('0x3c')]=function(_0x50130c,_0x64a329,_0x5af246){var _0x1b1330,_0x38c4ae,_0x72b5b3;if(_[_0x57d3('0x90')](_0x50130c[_0x57d3('0x5c')][_0x57d3('0x5c')])||_0x50130c[_0x57d3('0x5c')][_0x57d3('0x5c')]===''){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))](_0x57d3('0xad'));}if(_['isNil'](_0x50130c[_0x57d3('0x5c')]['to'])){throw new db[(_0x57d3('0x86'))][(_0x57d3('0x87'))](_0x57d3('0xae'));}_0x1b1330=_0x50130c[_0x57d3('0x5c')]['to'];return db[_0x57d3('0x40')]['find']({'where':{'id':_0x50130c['params']['id']},'include':[{'model':db[_0x57d3('0xaf')],'as':_0x57d3('0xb0'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x1b1330},'limit':0x1,'order':[['updatedAt',_0x57d3('0x96')]]}]}]})[_0x57d3('0x21')](handleEntityNotFound(_0x64a329,null))[_0x57d3('0x21')](function(_0x4c1eef){if(_0x4c1eef&&_0x4c1eef['List']){_0x38c4ae=_0x4c1eef[_0x57d3('0x36')]({'plain':!![]});if(_0x38c4ae[_0x57d3('0xb0')]&&_0x38c4ae[_0x57d3('0xb0')][_0x57d3('0x98')][_0x57d3('0x59')]){return _0x38c4ae[_0x57d3('0xb0')][_0x57d3('0x98')][0x0];}return db['CmContact'][_0x57d3('0x5b')](_[_0x57d3('0x99')](_0x50130c[_0x57d3('0x5c')],{'firstName':_0x1b1330,'mobile':_0x1b1330,'phone':_0x1b1330,'ListId':_0x38c4ae[_0x57d3('0x8b')]}));}})[_0x57d3('0x21')](handleEntityNotFound(_0x64a329,null))['then'](function(_0x475195){if(_0x475195){_0x72b5b3=_0x475195;return db[_0x57d3('0x9a')][_0x57d3('0x61')]({'where':{'ContactId':_0x72b5b3['id'],'closed':![],'WhatsappAccountId':_0x38c4ae['id']}})[_0x57d3('0x21')](function(_0x224dfa){if(_0x224dfa){return[_0x224dfa,![]];}return db[_0x57d3('0x9a')][_0x57d3('0x5b')]({'UserId':_0x50130c['user']['id'],'ContactId':_0x72b5b3['id'],'WhatsappAccountId':_0x38c4ae['id'],'phone':_0x1b1330,'firstMsgDirection':_0x57d3('0xb1'),'Messages':[_['merge'](_0x50130c[_0x57d3('0x5c')],{'read':![],'body':_0x50130c['body'][_0x57d3('0x5c')],'phone':_0x1b1330,'WhatsappAccountId':_0x38c4ae['id'],'UserId':_0x50130c[_0x57d3('0x5d')]['id'],'ContactId':_0x72b5b3['id']})]},{'include':[{'model':db[_0x57d3('0xb2')],'as':'Messages'}]})['then'](function(_0x1c72b6){return[_0x1c72b6,!![]];});});}})[_0x57d3('0x9b')](function(_0x31f2ea,_0x521f49){if(_0x521f49){return _0x31f2ea;}return db['WhatsappMessage'][_0x57d3('0x5b')](_['merge'](_0x50130c['body'],{'read':![],'body':_0x50130c[_0x57d3('0x5c')][_0x57d3('0x5c')],'phone':_0x1b1330,'WhatsappAccountId':_0x38c4ae['id'],'WhatsappInteractionId':_0x31f2ea['id'],'UserId':_0x50130c[_0x57d3('0x5d')]['id'],'ContactId':_0x72b5b3['id']}))[_0x57d3('0x21')](function(_0x15162c){_0x31f2ea[_0x57d3('0xb3')][_0x57d3('0xb4')]=[];_0x31f2ea['dataValues'][_0x57d3('0xb4')][_0x57d3('0xb5')](_0x15162c['dataValues']);return _0x31f2ea;});})[_0x57d3('0x21')](respondWithResult(_0x64a329,null))[_0x57d3('0x55')](handleError(_0x64a329,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ea7b3a1..720c36f 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 _0x63b0=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x564fa1,_0x4eea1c){var _0x3206bc=function(_0x3ec8a0){while(--_0x3ec8a0){_0x564fa1['push'](_0x564fa1['shift']());}};_0x3206bc(++_0x4eea1c);}(_0x63b0,0x1af));var _0x063b=function(_0x50e2da,_0xd3b121){_0x50e2da=_0x50e2da-0x0;var _0x5a7ee1=_0x63b0[_0x50e2da];return _0x5a7ee1;};'use strict';var EventEmitter=require(_0x063b('0x0'));var WhatsappAccount=require(_0x063b('0x1'))['db'][_0x063b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x063b('0x3')](0x0);var events={'afterCreate':_0x063b('0x4'),'afterUpdate':'update','afterDestroy':_0x063b('0x5')};function emitEvent(_0x37eb1e){return function(_0x5b587e,_0x52e421,_0x4ea501){WhatsappAccountEvents['emit'](_0x37eb1e+':'+_0x5b587e['id'],_0x5b587e);WhatsappAccountEvents[_0x063b('0x6')](_0x37eb1e,_0x5b587e);_0x4ea501(null);};}for(var e in events){if(events[_0x063b('0x7')](e)){var event=events[e];WhatsappAccount[_0x063b('0x8')](e,emitEvent(event));}}module[_0x063b('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd19a=['hook','exports','../../mysqldb','WhatsappAccount','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd19a,0x112));var _0xad19=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd19a[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xad19('0x0'))['db'][_0xad19('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xad19('0x2'),'afterDestroy':_0xad19('0x3')};function emitEvent(_0x4140e2){return function(_0x4a32c9,_0x553f8c,_0x4cc19a){WhatsappAccountEvents[_0xad19('0x4')](_0x4140e2+':'+_0x4a32c9['id'],_0x4a32c9);WhatsappAccountEvents[_0xad19('0x4')](_0x4140e2,_0x4a32c9);_0x4cc19a(null);};}for(var e in events){if(events[_0xad19('0x5')](e)){var event=events[e];WhatsappAccount[_0xad19('0x6')](e,emitEvent(event));}}module[_0xad19('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 8f452c6..d012f37 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 _0xddc4=['define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x732d54,_0x5708f4){var _0x55e766=function(_0x1e9b2f){while(--_0x1e9b2f){_0x732d54['push'](_0x732d54['shift']());}};_0x55e766(++_0x5708f4);}(_0xddc4,0x10d));var _0x4ddc=function(_0x1c0e0d,_0x5e2291){_0x1c0e0d=_0x1c0e0d-0x0;var _0x310efe=_0xddc4[_0x1c0e0d];return _0x310efe;};'use strict';var _=require(_0x4ddc('0x0'));var util=require('util');var logger=require(_0x4ddc('0x1'))(_0x4ddc('0x2'));var moment=require(_0x4ddc('0x3'));var BPromise=require(_0x4ddc('0x4'));var rp=require(_0x4ddc('0x5'));var fs=require('fs');var path=require(_0x4ddc('0x6'));var rimraf=require(_0x4ddc('0x7'));var config=require(_0x4ddc('0x8'));var attributes=require(_0x4ddc('0x9'));module[_0x4ddc('0xa')]=function(_0x1a1826,_0x12ded4){return _0x1a1826[_0x4ddc('0xb')](_0x4ddc('0xc'),attributes,{'tableName':_0x4ddc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e9e=['whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x10b631,_0x94b61b){var _0x76f91f=function(_0x1f57fd){while(--_0x1f57fd){_0x10b631['push'](_0x10b631['shift']());}};_0x76f91f(++_0x94b61b);}(_0x0e9e,0xfd));var _0xe0e9=function(_0x5780d5,_0x42eb48){_0x5780d5=_0x5780d5-0x0;var _0x1e6a02=_0x0e9e[_0x5780d5];return _0x1e6a02;};'use strict';var _=require(_0xe0e9('0x0'));var util=require(_0xe0e9('0x1'));var logger=require(_0xe0e9('0x2'))(_0xe0e9('0x3'));var moment=require(_0xe0e9('0x4'));var BPromise=require(_0xe0e9('0x5'));var rp=require(_0xe0e9('0x6'));var fs=require('fs');var path=require(_0xe0e9('0x7'));var rimraf=require(_0xe0e9('0x8'));var config=require(_0xe0e9('0x9'));var attributes=require(_0xe0e9('0xa'));module[_0xe0e9('0xb')]=function(_0x2a68df,_0x2bfef6){return _0x2a68df[_0xe0e9('0xc')]('WhatsappAccount',attributes,{'tableName':_0xe0e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 2eaf1bf..41d12b6 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 _0x8be3=['ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','stringify','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./whatsappAccount.socket','register','request','info','request\x20sent','code','error','message','WhatsappAccount,\x20%s,\x20%s','catch'];(function(_0x184871,_0x16c740){var _0x3ef197=function(_0x5dfec5){while(--_0x5dfec5){_0x184871['push'](_0x184871['shift']());}};_0x3ef197(++_0x16c740);}(_0x8be3,0xd1));var _0x38be=function(_0x436afe,_0x3baf73){_0x436afe=_0x436afe-0x0;var _0x450b50=_0x8be3[_0x436afe];return _0x450b50;};'use strict';var _=require('lodash');var util=require(_0x38be('0x0'));var moment=require(_0x38be('0x1'));var BPromise=require(_0x38be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38be('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x38be('0x4'));var logger=require(_0x38be('0x5'))(_0x38be('0x6'));var config=require(_0x38be('0x7'));var jayson=require(_0x38be('0x8'));var client=jayson['client'][_0x38be('0x9')]({'port':0x232a});config[_0x38be('0xa')]=_[_0x38be('0xb')](config[_0x38be('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38be('0xa')]));require(_0x38be('0xc'))[_0x38be('0xd')](socket);function respondWithRpcPromise(_0xfb522f,_0x38d5d6,_0xb9afe){return new BPromise(function(_0x5c1a1a,_0x2f25e5){return client[_0x38be('0xe')](_0xfb522f,_0xb9afe)['then'](function(_0x93603){logger[_0x38be('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x38d5d6,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x38d5d6,_0x38be('0x10'),JSON['stringify'](_0x93603));if(_0x93603['error']){if(_0x93603['error'][_0x38be('0x11')]===0x1f4){logger[_0x38be('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x38d5d6,_0x93603[_0x38be('0x12')][_0x38be('0x13')]);return _0x2f25e5(_0x93603[_0x38be('0x12')]['message']);}logger[_0x38be('0x12')](_0x38be('0x14'),_0x38d5d6,_0x93603['error'][_0x38be('0x13')]);return _0x5c1a1a(_0x93603[_0x38be('0x12')][_0x38be('0x13')]);}else{logger[_0x38be('0xf')](_0x38be('0x14'),_0x38d5d6,_0x38be('0x10'));_0x5c1a1a(_0x93603['result'][_0x38be('0x13')]);}})[_0x38be('0x15')](function(_0x20af47){logger['error'](_0x38be('0x14'),_0x38d5d6,_0x20af47);_0x2f25e5(_0x20af47);});});}exports[_0x38be('0x16')]=function(_0x12f654){var _0x9bc9b0=this;return new Promise(function(_0x6450a7,_0x7aa28){return db[_0x38be('0x17')][_0x38be('0x18')]({'raw':_0x12f654[_0x38be('0x19')]?_0x12f654[_0x38be('0x19')][_0x38be('0x1a')]===undefined?!![]:![]:!![],'where':_0x12f654[_0x38be('0x19')]?_0x12f654['options'][_0x38be('0x1b')]||null:null,'attributes':_0x12f654[_0x38be('0x19')]?_0x12f654[_0x38be('0x19')][_0x38be('0x1c')]||null:null,'include':_0x12f654[_0x38be('0x19')]?_0x12f654[_0x38be('0x19')]['include']?_['map'](_0x12f654['options'][_0x38be('0x1d')],function(_0x59cab3){return{'model':db[_0x59cab3[_0x38be('0x1e')]],'as':_0x59cab3['as'],'attributes':_0x59cab3[_0x38be('0x1c')],'include':_0x59cab3[_0x38be('0x1d')]?_[_0x38be('0x1f')](_0x59cab3[_0x38be('0x1d')],function(_0x16f75f){return{'model':db[_0x16f75f['model']],'as':_0x16f75f['as'],'attributes':_0x16f75f[_0x38be('0x1c')],'include':_0x16f75f[_0x38be('0x1d')]?_[_0x38be('0x1f')](_0x16f75f[_0x38be('0x1d')],function(_0x2663c2){return{'model':db[_0x2663c2[_0x38be('0x1e')]],'as':_0x2663c2['as'],'attributes':_0x2663c2[_0x38be('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f8da1){logger['info'](_0x38be('0x16'),_0x12f654);logger['debug'](_0x38be('0x16'),_0x12f654,JSON[_0x38be('0x20')](_0x1f8da1));_0x6450a7(_0x1f8da1);})[_0x38be('0x15')](function(_0x57502d){logger[_0x38be('0x12')](_0x38be('0x16'),_0x57502d[_0x38be('0x13')],_0x12f654);_0x7aa28(_0x9bc9b0['error'](0x1f4,_0x57502d['message']));});});}; \ No newline at end of file +var _0xd987=['options','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','find','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd987,0x15d));var _0x7d98=function(_0x167439,_0x51ae2c){_0x167439=_0x167439-0x0;var _0xde9c27=_0xd987[_0x167439];return _0xde9c27;};'use strict';var _=require(_0x7d98('0x0'));var util=require(_0x7d98('0x1'));var moment=require(_0x7d98('0x2'));var BPromise=require(_0x7d98('0x3'));var rs=require(_0x7d98('0x4'));var fs=require('fs');var Redis=require(_0x7d98('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d98('0x6'));var logger=require(_0x7d98('0x7'))(_0x7d98('0x8'));var config=require(_0x7d98('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d98('0xa')][_0x7d98('0xb')]({'port':0x232a});config[_0x7d98('0xc')]=_['defaults'](config[_0x7d98('0xc')],{'host':_0x7d98('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7d98('0xe'))['register'](socket);function respondWithRpcPromise(_0x36fb51,_0x27754f,_0x2af556){return new BPromise(function(_0x2fb481,_0x1e1376){return client[_0x7d98('0xf')](_0x36fb51,_0x2af556)[_0x7d98('0x10')](function(_0x3acc3c){logger[_0x7d98('0x11')](_0x7d98('0x12'),_0x27754f,_0x7d98('0x13'));logger[_0x7d98('0x14')](_0x7d98('0x15'),_0x27754f,_0x7d98('0x13'),JSON[_0x7d98('0x16')](_0x3acc3c));if(_0x3acc3c[_0x7d98('0x17')]){if(_0x3acc3c[_0x7d98('0x17')][_0x7d98('0x18')]===0x1f4){logger[_0x7d98('0x17')](_0x7d98('0x12'),_0x27754f,_0x3acc3c[_0x7d98('0x17')][_0x7d98('0x19')]);return _0x1e1376(_0x3acc3c[_0x7d98('0x17')]['message']);}logger['error'](_0x7d98('0x12'),_0x27754f,_0x3acc3c[_0x7d98('0x17')][_0x7d98('0x19')]);return _0x2fb481(_0x3acc3c[_0x7d98('0x17')][_0x7d98('0x19')]);}else{logger[_0x7d98('0x11')](_0x7d98('0x12'),_0x27754f,_0x7d98('0x13'));_0x2fb481(_0x3acc3c[_0x7d98('0x1a')][_0x7d98('0x19')]);}})[_0x7d98('0x1b')](function(_0x42c2af){logger[_0x7d98('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x27754f,_0x42c2af);_0x1e1376(_0x42c2af);});});}exports['ShowWhatsappAccount']=function(_0x1407d1){var _0x39d193=this;return new Promise(function(_0x3e7c66,_0x43d590){return db[_0x7d98('0x1c')][_0x7d98('0x1d')]({'raw':_0x1407d1['options']?_0x1407d1['options'][_0x7d98('0x1e')]===undefined?!![]:![]:!![],'where':_0x1407d1[_0x7d98('0x1f')]?_0x1407d1['options'][_0x7d98('0x20')]||null:null,'attributes':_0x1407d1['options']?_0x1407d1[_0x7d98('0x1f')][_0x7d98('0x21')]||null:null,'include':_0x1407d1[_0x7d98('0x1f')]?_0x1407d1[_0x7d98('0x1f')][_0x7d98('0x22')]?_[_0x7d98('0x23')](_0x1407d1[_0x7d98('0x1f')][_0x7d98('0x22')],function(_0x3426d7){return{'model':db[_0x3426d7['model']],'as':_0x3426d7['as'],'attributes':_0x3426d7['attributes'],'include':_0x3426d7['include']?_[_0x7d98('0x23')](_0x3426d7[_0x7d98('0x22')],function(_0x5e1b2e){return{'model':db[_0x5e1b2e[_0x7d98('0x24')]],'as':_0x5e1b2e['as'],'attributes':_0x5e1b2e[_0x7d98('0x21')],'include':_0x5e1b2e[_0x7d98('0x22')]?_['map'](_0x5e1b2e[_0x7d98('0x22')],function(_0x465ea2){return{'model':db[_0x465ea2[_0x7d98('0x24')]],'as':_0x465ea2['as'],'attributes':_0x465ea2[_0x7d98('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7d98('0x10')](function(_0x7ddc9f){logger['info']('ShowWhatsappAccount',_0x1407d1);logger[_0x7d98('0x14')](_0x7d98('0x25'),_0x1407d1,JSON[_0x7d98('0x16')](_0x7ddc9f));_0x3e7c66(_0x7ddc9f);})[_0x7d98('0x1b')](function(_0x26256c){logger['error'](_0x7d98('0x25'),_0x26256c[_0x7d98('0x19')],_0x1407d1);_0x43d590(_0x39d193[_0x7d98('0x17')](0x1f4,_0x26256c[_0x7d98('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index be9b0e7..fecf720 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 _0xbc71=['length','whatsappAccount:','save','remove','emit','register'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xbc71,0x11c));var _0x1bc7=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xbc71[_0x550d12];return _0x12103d;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x1bc7('0x0'),_0x1bc7('0x1'),'update'];function createListener(_0x43c616,_0x101203){return function(_0x38fc6a){_0x101203[_0x1bc7('0x2')](_0x43c616,_0x38fc6a);};}function removeListener(_0x27a1f9,_0x3421cd){return function(){WhatsappAccountEvents['removeListener'](_0x27a1f9,_0x3421cd);};}exports[_0x1bc7('0x3')]=function(_0x3cdbdf){for(var _0x18c55e=0x0,_0x5cfb90=events[_0x1bc7('0x4')];_0x18c55e<_0x5cfb90;_0x18c55e++){var _0x5e2703=events[_0x18c55e];var _0x43ce11=createListener(_0x1bc7('0x5')+_0x5e2703,_0x3cdbdf);WhatsappAccountEvents['on'](_0x5e2703,_0x43ce11);}}; \ No newline at end of file +var _0xd603=['save','update','emit','removeListener','length','./whatsappAccount.events'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xd603,0x1f1));var _0x3d60=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xd603[_0x648163];return _0x199d4d;};'use strict';var WhatsappAccountEvents=require(_0x3d60('0x0'));var events=[_0x3d60('0x1'),'remove',_0x3d60('0x2')];function createListener(_0x244224,_0x211f03){return function(_0x519ff1){_0x211f03[_0x3d60('0x3')](_0x244224,_0x519ff1);};}function removeListener(_0x113f46,_0x17ad79){return function(){WhatsappAccountEvents[_0x3d60('0x4')](_0x113f46,_0x17ad79);};}exports['register']=function(_0x927770){for(var _0x11b2b7=0x0,_0x5e6efb=events[_0x3d60('0x5')];_0x11b2b7<_0x5e6efb;_0x11b2b7++){var _0x536d77=events[_0x11b2b7];var _0x415bd0=createListener('whatsappAccount:'+_0x536d77,_0x927770);WhatsappAccountEvents['on'](_0x536d77,_0x415bd0);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e6a6e8d..64c3d0a 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 _0xeb20=['isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x18442a,_0x57143d){var _0x2bb33e=function(_0x358b7f){while(--_0x358b7f){_0x18442a['push'](_0x18442a['shift']());}};_0x2bb33e(++_0x57143d);}(_0xeb20,0x1b9));var _0x0eb2=function(_0x28bc71,_0x781c76){_0x28bc71=_0x28bc71-0x0;var _0x216ae5=_0xeb20[_0x28bc71];return _0x216ae5;};'use strict';var multer=require(_0x0eb2('0x0'));var util=require(_0x0eb2('0x1'));var path=require('path');var timeout=require(_0x0eb2('0x2'));var express=require(_0x0eb2('0x3'));var router=express['Router']();var fs_extra=require(_0x0eb2('0x4'));var auth=require(_0x0eb2('0x5'));var interaction=require(_0x0eb2('0x6'));var config=require(_0x0eb2('0x7'));var controller=require('./whatsappApplication.controller');router[_0x0eb2('0x8')]('/',auth[_0x0eb2('0x9')](),controller['index']);router['get']('/:id',auth[_0x0eb2('0x9')](),controller[_0x0eb2('0xa')]);router[_0x0eb2('0xb')]('/',auth[_0x0eb2('0x9')](),controller[_0x0eb2('0xc')]);router['put'](_0x0eb2('0xd'),auth[_0x0eb2('0x9')](),controller[_0x0eb2('0xe')]);router[_0x0eb2('0xf')](_0x0eb2('0xd'),auth[_0x0eb2('0x9')](),controller[_0x0eb2('0x10')]);module[_0x0eb2('0x11')]=router; \ No newline at end of file +var _0x1e8f=['put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1460c9,_0x2edcea){var _0x2d48db=function(_0x16c808){while(--_0x16c808){_0x1460c9['push'](_0x1460c9['shift']());}};_0x2d48db(++_0x2edcea);}(_0x1e8f,0x1f1));var _0xf1e8=function(_0x11afd1,_0x4d62ff){_0x11afd1=_0x11afd1-0x0;var _0x5e8b34=_0x1e8f[_0x11afd1];return _0x5e8b34;};'use strict';var multer=require('multer');var util=require(_0xf1e8('0x0'));var path=require(_0xf1e8('0x1'));var timeout=require(_0xf1e8('0x2'));var express=require(_0xf1e8('0x3'));var router=express[_0xf1e8('0x4')]();var fs_extra=require(_0xf1e8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf1e8('0x6'));var controller=require(_0xf1e8('0x7'));router[_0xf1e8('0x8')]('/',auth[_0xf1e8('0x9')](),controller[_0xf1e8('0xa')]);router[_0xf1e8('0x8')](_0xf1e8('0xb'),auth[_0xf1e8('0x9')](),controller[_0xf1e8('0xc')]);router['post']('/',auth[_0xf1e8('0x9')](),controller['create']);router[_0xf1e8('0xd')](_0xf1e8('0xb'),auth[_0xf1e8('0x9')](),controller[_0xf1e8('0xe')]);router[_0xf1e8('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf1e8('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 13a68af..3c228c4 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 _0x3a36=['TEXT','exports','INTEGER','STRING','noop'];(function(_0x231b6b,_0x523b7c){var _0x29765b=function(_0x42f18a){while(--_0x42f18a){_0x231b6b['push'](_0x231b6b['shift']());}};_0x29765b(++_0x523b7c);}(_0x3a36,0x7e));var _0x63a3=function(_0xdbaed2,_0x827161){_0xdbaed2=_0xdbaed2-0x0;var _0x14cdd1=_0x3a36[_0xdbaed2];return _0x14cdd1;};'use strict';var Sequelize=require('sequelize');module[_0x63a3('0x0')]={'priority':{'type':Sequelize[_0x63a3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x63a3('0x2')],'allowNull':![],'defaultValue':_0x63a3('0x3')},'appdata':{'type':Sequelize[_0x63a3('0x4')]()},'description':{'type':Sequelize[_0x63a3('0x2')]},'interval':{'type':Sequelize[_0x63a3('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x072a=['sequelize','exports','STRING','TEXT'];(function(_0x27c1e7,_0x78ade7){var _0x1b30a7=function(_0x474133){while(--_0x474133){_0x27c1e7['push'](_0x27c1e7['shift']());}};_0x1b30a7(++_0x78ade7);}(_0x072a,0x194));var _0xa072=function(_0x2e062d,_0x30bb39){_0x2e062d=_0x2e062d-0x0;var _0x45ee8c=_0x072a[_0x2e062d];return _0x45ee8c;};'use strict';var Sequelize=require(_0xa072('0x0'));module[_0xa072('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa072('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa072('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa072('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index f0d2405..50038d3 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 _0x5532=['rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','WhatsappApplication'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5532,0x19a));var _0x2553=function(_0x39ac63,_0x5ccdf9){_0x39ac63=_0x39ac63-0x0;var _0x536ab5=_0x5532[_0x39ac63];return _0x536ab5;};'use strict';var emlformat=require(_0x2553('0x0'));var rimraf=require(_0x2553('0x1'));var zipdir=require(_0x2553('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2553('0x3'));var moment=require('moment');var BPromise=require(_0x2553('0x4'));var Mustache=require(_0x2553('0x5'));var util=require(_0x2553('0x6'));var path=require('path');var sox=require(_0x2553('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2553('0x8'));var _=require(_0x2553('0x9'));var squel=require('squel');var crypto=require(_0x2553('0xa'));var jsforce=require(_0x2553('0xb'));var deskjs=require(_0x2553('0xc'));var toCsv=require(_0x2553('0xd'));var querystring=require(_0x2553('0xe'));var Papa=require(_0x2553('0xf'));var Redis=require(_0x2553('0x10'));var authService=require(_0x2553('0x11'));var qs=require(_0x2553('0x12'));var as=require(_0x2553('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2553('0x14'))(_0x2553('0x15'));var utils=require(_0x2553('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2553('0x17'));var db=require(_0x2553('0x18'))['db'];function respondWithStatusCode(_0x509539,_0x5d24fb){_0x5d24fb=_0x5d24fb||0xcc;return function(_0x4394af){if(_0x4394af){return _0x509539['sendStatus'](_0x5d24fb);}return _0x509539[_0x2553('0x19')](_0x5d24fb)[_0x2553('0x1a')]();};}function respondWithResult(_0x426ebb,_0x587ab5){_0x587ab5=_0x587ab5||0xc8;return function(_0x59b800){if(_0x59b800){return _0x426ebb[_0x2553('0x19')](_0x587ab5)[_0x2553('0x1b')](_0x59b800);}};}function respondWithFilteredResult(_0x2e2555,_0x77477d){return function(_0x241dfe){if(_0x241dfe){var _0x31ae8f=typeof _0x77477d['offset']===_0x2553('0x1c')&&typeof _0x77477d[_0x2553('0x1d')]==='undefined';var _0x2d7a8b=_0x241dfe[_0x2553('0x1e')];var _0x5bf6d4=_0x31ae8f?0x0:_0x77477d[_0x2553('0x1f')];var _0x191e12=_0x31ae8f?_0x241dfe[_0x2553('0x1e')]:_0x77477d[_0x2553('0x1f')]+_0x77477d['limit'];var _0x4abc05;if(_0x191e12>=_0x2d7a8b){_0x191e12=_0x2d7a8b;_0x4abc05=0xc8;}else{_0x4abc05=0xce;}_0x2e2555[_0x2553('0x19')](_0x4abc05);return _0x2e2555[_0x2553('0x20')](_0x2553('0x21'),_0x5bf6d4+'-'+_0x191e12+'/'+_0x2d7a8b)['json'](_0x241dfe);}return null;};}function patchUpdates(_0x55ceba){return function(_0x26698c){try{jsonpatch[_0x2553('0x22')](_0x26698c,_0x55ceba,!![]);}catch(_0x36f27c){return BPromise['reject'](_0x36f27c);}return _0x26698c[_0x2553('0x23')]();};}function saveUpdates(_0x2c7d16,_0x3b4110){return function(_0x5682dd){if(_0x5682dd){return _0x5682dd[_0x2553('0x24')](_0x2c7d16)[_0x2553('0x25')](function(_0xe152e1){return _0xe152e1;});}return null;};}function removeEntity(_0xc91f02,_0x49d4d1){return function(_0x1b6d14){if(_0x1b6d14){return _0x1b6d14[_0x2553('0x26')]()['then'](function(){_0xc91f02[_0x2553('0x19')](0xcc)[_0x2553('0x1a')]();});}};}function handleEntityNotFound(_0x57516e,_0x4180c1){return function(_0x3d5ea2){if(!_0x3d5ea2){_0x57516e[_0x2553('0x27')](0x194);}return _0x3d5ea2;};}function handleError(_0x4aa3fa,_0x3fdfb1){_0x3fdfb1=_0x3fdfb1||0x1f4;return function(_0x581946){logger[_0x2553('0x28')](_0x581946['stack']);if(_0x581946['name']){delete _0x581946[_0x2553('0x29')];}_0x4aa3fa['status'](_0x3fdfb1)[_0x2553('0x2a')](_0x581946);};}exports[_0x2553('0x2b')]=function(_0x17ee14,_0x369bfc){var _0x54691d={},_0x19fec3={},_0xf630cd={'count':0x0,'rows':[]};var _0x442a0d=_[_0x2553('0x2c')](db[_0x2553('0x2d')][_0x2553('0x2e')],function(_0xcef42e){return{'name':_0xcef42e[_0x2553('0x2f')],'type':_0xcef42e[_0x2553('0x30')][_0x2553('0x31')]};});_0x19fec3[_0x2553('0x32')]=_[_0x2553('0x2c')](_0x442a0d,_0x2553('0x29'));_0x19fec3[_0x2553('0x33')]=_['keys'](_0x17ee14[_0x2553('0x33')]);_0x19fec3[_0x2553('0x34')]=_['intersection'](_0x19fec3[_0x2553('0x32')],_0x19fec3[_0x2553('0x33')]);_0x54691d['attributes']=_[_0x2553('0x35')](_0x19fec3[_0x2553('0x32')],qs[_0x2553('0x36')](_0x17ee14[_0x2553('0x33')]['fields']));_0x54691d[_0x2553('0x37')]=_0x54691d[_0x2553('0x37')][_0x2553('0x38')]?_0x54691d[_0x2553('0x37')]:_0x19fec3[_0x2553('0x32')];if(!_0x17ee14[_0x2553('0x33')][_0x2553('0x39')](_0x2553('0x3a'))){_0x54691d[_0x2553('0x1d')]=qs['limit'](_0x17ee14[_0x2553('0x33')]['limit']);_0x54691d[_0x2553('0x1f')]=qs[_0x2553('0x1f')](_0x17ee14[_0x2553('0x33')]['offset']);}_0x54691d[_0x2553('0x3b')]=qs['sort'](_0x17ee14['query']['sort']);_0x54691d[_0x2553('0x3c')]=qs[_0x2553('0x34')](_[_0x2553('0x3d')](_0x17ee14[_0x2553('0x33')],_0x19fec3['filters']),_0x442a0d);if(_0x17ee14[_0x2553('0x33')][_0x2553('0x3e')]){_0x54691d[_0x2553('0x3c')]=_['merge'](_0x54691d[_0x2553('0x3c')],{'$or':_[_0x2553('0x2c')](_0x442a0d,function(_0x4a13c8){if(_0x4a13c8[_0x2553('0x30')]!==_0x2553('0x3f')){var _0x2d16a4={};_0x2d16a4[_0x4a13c8['name']]={'$like':'%'+_0x17ee14[_0x2553('0x33')][_0x2553('0x3e')]+'%'};return _0x2d16a4;}})});}_0x54691d=_[_0x2553('0x40')]({},_0x54691d,_0x17ee14[_0x2553('0x41')]);var _0x2abf13={'where':_0x54691d[_0x2553('0x3c')]};return db['WhatsappApplication']['count'](_0x2abf13)[_0x2553('0x25')](function(_0x3d634c){_0xf630cd[_0x2553('0x1e')]=_0x3d634c;if(_0x17ee14[_0x2553('0x33')]['includeAll']){_0x54691d[_0x2553('0x42')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2553('0x43')](_0x54691d);})[_0x2553('0x25')](function(_0x441a30){_0xf630cd[_0x2553('0x44')]=_0x441a30;return _0xf630cd;})[_0x2553('0x25')](respondWithFilteredResult(_0x369bfc,_0x54691d))['catch'](handleError(_0x369bfc,null));};exports[_0x2553('0x45')]=function(_0x156196,_0x3a7f7b){var _0x3802a0={'raw':!![],'where':{'id':_0x156196[_0x2553('0x46')]['id']}},_0x49ade1={};_0x49ade1['model']=_['keys'](db[_0x2553('0x2d')]['rawAttributes']);_0x49ade1[_0x2553('0x33')]=_[_0x2553('0x47')](_0x156196[_0x2553('0x33')]);_0x49ade1[_0x2553('0x34')]=_['intersection'](_0x49ade1['model'],_0x49ade1[_0x2553('0x33')]);_0x3802a0[_0x2553('0x37')]=_['intersection'](_0x49ade1['model'],qs['fields'](_0x156196['query']['fields']));_0x3802a0[_0x2553('0x37')]=_0x3802a0[_0x2553('0x37')][_0x2553('0x38')]?_0x3802a0[_0x2553('0x37')]:_0x49ade1['model'];if(_0x156196['query']['includeAll']){_0x3802a0[_0x2553('0x42')]=[{'all':!![]}];}_0x3802a0=_[_0x2553('0x40')]({},_0x3802a0,_0x156196[_0x2553('0x41')]);return db[_0x2553('0x2d')][_0x2553('0x48')](_0x3802a0)[_0x2553('0x25')](handleEntityNotFound(_0x3a7f7b,null))['then'](respondWithResult(_0x3a7f7b,null))[_0x2553('0x49')](handleError(_0x3a7f7b,null));};exports[_0x2553('0x4a')]=function(_0x2c062a,_0x29ad08){return db[_0x2553('0x2d')][_0x2553('0x4a')](_0x2c062a[_0x2553('0x4b')],{})[_0x2553('0x25')](respondWithResult(_0x29ad08,0xc9))['catch'](handleError(_0x29ad08,null));};exports[_0x2553('0x24')]=function(_0x144ac3,_0x557185){if(_0x144ac3[_0x2553('0x4b')]['id']){delete _0x144ac3[_0x2553('0x4b')]['id'];}return db['WhatsappApplication'][_0x2553('0x48')]({'where':{'id':_0x144ac3['params']['id']}})[_0x2553('0x25')](handleEntityNotFound(_0x557185,null))['then'](saveUpdates(_0x144ac3['body'],null))['then'](respondWithResult(_0x557185,null))[_0x2553('0x49')](handleError(_0x557185,null));};exports[_0x2553('0x26')]=function(_0x1cbba9,_0x1e022c){return db['WhatsappApplication']['find']({'where':{'id':_0x1cbba9['params']['id']}})[_0x2553('0x25')](handleEntityNotFound(_0x1e022c,null))['then'](removeEntity(_0x1e022c,null))[_0x2553('0x49')](handleError(_0x1e022c,null));}; \ No newline at end of file +var _0xef4d=['map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','name','send','index'];(function(_0x305cb0,_0x124dbf){var _0x5b4133=function(_0x3af47d){while(--_0x3af47d){_0x305cb0['push'](_0x305cb0['shift']());}};_0x5b4133(++_0x124dbf);}(_0xef4d,0x165));var _0xdef4=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xef4d[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require(_0xdef4('0x0'));var rimraf=require(_0xdef4('0x1'));var zipdir=require(_0xdef4('0x2'));var jsonpatch=require(_0xdef4('0x3'));var rp=require(_0xdef4('0x4'));var moment=require(_0xdef4('0x5'));var BPromise=require(_0xdef4('0x6'));var Mustache=require(_0xdef4('0x7'));var util=require(_0xdef4('0x8'));var path=require(_0xdef4('0x9'));var sox=require(_0xdef4('0xa'));var csv=require(_0xdef4('0xb'));var ejs=require(_0xdef4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdef4('0xd'));var squel=require(_0xdef4('0xe'));var crypto=require(_0xdef4('0xf'));var jsforce=require(_0xdef4('0x10'));var deskjs=require(_0xdef4('0x11'));var toCsv=require(_0xdef4('0xb'));var querystring=require(_0xdef4('0x12'));var Papa=require(_0xdef4('0x13'));var Redis=require(_0xdef4('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdef4('0x15'));var as=require(_0xdef4('0x16'));var hardwareService=require(_0xdef4('0x17'));var logger=require(_0xdef4('0x18'))(_0xdef4('0x19'));var utils=require(_0xdef4('0x1a'));var config=require(_0xdef4('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xdef4('0x1c'))['db'];function respondWithStatusCode(_0x52e079,_0x4e72a9){_0x4e72a9=_0x4e72a9||0xcc;return function(_0x17db7a){if(_0x17db7a){return _0x52e079['sendStatus'](_0x4e72a9);}return _0x52e079[_0xdef4('0x1d')](_0x4e72a9)['end']();};}function respondWithResult(_0x3133fb,_0x41e6cf){_0x41e6cf=_0x41e6cf||0xc8;return function(_0x20effa){if(_0x20effa){return _0x3133fb[_0xdef4('0x1d')](_0x41e6cf)['json'](_0x20effa);}};}function respondWithFilteredResult(_0x2359fb,_0x5c528a){return function(_0x19e623){if(_0x19e623){var _0x29951c=typeof _0x5c528a['offset']===_0xdef4('0x1e')&&typeof _0x5c528a[_0xdef4('0x1f')]===_0xdef4('0x1e');var _0x4414e0=_0x19e623['count'];var _0x377beb=_0x29951c?0x0:_0x5c528a[_0xdef4('0x20')];var _0x469178=_0x29951c?_0x19e623[_0xdef4('0x21')]:_0x5c528a[_0xdef4('0x20')]+_0x5c528a['limit'];var _0x3c60dc;if(_0x469178>=_0x4414e0){_0x469178=_0x4414e0;_0x3c60dc=0xc8;}else{_0x3c60dc=0xce;}_0x2359fb[_0xdef4('0x1d')](_0x3c60dc);return _0x2359fb[_0xdef4('0x22')](_0xdef4('0x23'),_0x377beb+'-'+_0x469178+'/'+_0x4414e0)[_0xdef4('0x24')](_0x19e623);}return null;};}function patchUpdates(_0x451826){return function(_0x5f358f){try{jsonpatch[_0xdef4('0x25')](_0x5f358f,_0x451826,!![]);}catch(_0x36124a){return BPromise[_0xdef4('0x26')](_0x36124a);}return _0x5f358f[_0xdef4('0x27')]();};}function saveUpdates(_0x1b668e,_0x60c932){return function(_0x4e65e6){if(_0x4e65e6){return _0x4e65e6[_0xdef4('0x28')](_0x1b668e)['then'](function(_0x58e4a1){return _0x58e4a1;});}return null;};}function removeEntity(_0x209801,_0x35c401){return function(_0x3728e8){if(_0x3728e8){return _0x3728e8['destroy']()[_0xdef4('0x29')](function(){_0x209801[_0xdef4('0x1d')](0xcc)[_0xdef4('0x2a')]();});}};}function handleEntityNotFound(_0xf43627,_0x1dab9a){return function(_0x34ff25){if(!_0x34ff25){_0xf43627[_0xdef4('0x2b')](0x194);}return _0x34ff25;};}function handleError(_0x91199e,_0x4dd320){_0x4dd320=_0x4dd320||0x1f4;return function(_0x3e770f){logger[_0xdef4('0x2c')](_0x3e770f['stack']);if(_0x3e770f[_0xdef4('0x2d')]){delete _0x3e770f[_0xdef4('0x2d')];}_0x91199e[_0xdef4('0x1d')](_0x4dd320)[_0xdef4('0x2e')](_0x3e770f);};}exports[_0xdef4('0x2f')]=function(_0x287608,_0x50ae94){var _0x438376={},_0x256165={},_0x4bd517={'count':0x0,'rows':[]};var _0x25d6f1=_[_0xdef4('0x30')](db[_0xdef4('0x31')][_0xdef4('0x32')],function(_0x321bb6){return{'name':_0x321bb6[_0xdef4('0x33')],'type':_0x321bb6[_0xdef4('0x34')][_0xdef4('0x35')]};});_0x256165[_0xdef4('0x36')]=_[_0xdef4('0x30')](_0x25d6f1,_0xdef4('0x2d'));_0x256165['query']=_['keys'](_0x287608[_0xdef4('0x37')]);_0x256165[_0xdef4('0x38')]=_[_0xdef4('0x39')](_0x256165['model'],_0x256165[_0xdef4('0x37')]);_0x438376[_0xdef4('0x3a')]=_[_0xdef4('0x39')](_0x256165[_0xdef4('0x36')],qs['fields'](_0x287608['query']['fields']));_0x438376[_0xdef4('0x3a')]=_0x438376[_0xdef4('0x3a')][_0xdef4('0x3b')]?_0x438376[_0xdef4('0x3a')]:_0x256165[_0xdef4('0x36')];if(!_0x287608['query'][_0xdef4('0x3c')](_0xdef4('0x3d'))){_0x438376[_0xdef4('0x1f')]=qs[_0xdef4('0x1f')](_0x287608[_0xdef4('0x37')]['limit']);_0x438376[_0xdef4('0x20')]=qs[_0xdef4('0x20')](_0x287608[_0xdef4('0x37')]['offset']);}_0x438376[_0xdef4('0x3e')]=qs['sort'](_0x287608['query'][_0xdef4('0x3f')]);_0x438376['where']=qs[_0xdef4('0x38')](_[_0xdef4('0x40')](_0x287608[_0xdef4('0x37')],_0x256165[_0xdef4('0x38')]),_0x25d6f1);if(_0x287608[_0xdef4('0x37')][_0xdef4('0x41')]){_0x438376[_0xdef4('0x42')]=_[_0xdef4('0x43')](_0x438376['where'],{'$or':_['map'](_0x25d6f1,function(_0x1604b4){if(_0x1604b4[_0xdef4('0x34')]!=='VIRTUAL'){var _0x586ffc={};_0x586ffc[_0x1604b4[_0xdef4('0x2d')]]={'$like':'%'+_0x287608[_0xdef4('0x37')][_0xdef4('0x41')]+'%'};return _0x586ffc;}})});}_0x438376=_[_0xdef4('0x43')]({},_0x438376,_0x287608[_0xdef4('0x44')]);var _0xaa75d6={'where':_0x438376[_0xdef4('0x42')]};return db[_0xdef4('0x31')][_0xdef4('0x21')](_0xaa75d6)[_0xdef4('0x29')](function(_0x26c14e){_0x4bd517['count']=_0x26c14e;if(_0x287608[_0xdef4('0x37')][_0xdef4('0x45')]){_0x438376[_0xdef4('0x46')]=[{'all':!![]}];}return db[_0xdef4('0x31')][_0xdef4('0x47')](_0x438376);})['then'](function(_0x5dfd15){_0x4bd517[_0xdef4('0x48')]=_0x5dfd15;return _0x4bd517;})[_0xdef4('0x29')](respondWithFilteredResult(_0x50ae94,_0x438376))[_0xdef4('0x49')](handleError(_0x50ae94,null));};exports[_0xdef4('0x4a')]=function(_0x370cfe,_0x13f472){var _0x5a4d64={'raw':!![],'where':{'id':_0x370cfe[_0xdef4('0x4b')]['id']}},_0xbdfd50={};_0xbdfd50[_0xdef4('0x36')]=_[_0xdef4('0x4c')](db['WhatsappApplication']['rawAttributes']);_0xbdfd50[_0xdef4('0x37')]=_['keys'](_0x370cfe[_0xdef4('0x37')]);_0xbdfd50[_0xdef4('0x38')]=_['intersection'](_0xbdfd50[_0xdef4('0x36')],_0xbdfd50[_0xdef4('0x37')]);_0x5a4d64[_0xdef4('0x3a')]=_[_0xdef4('0x39')](_0xbdfd50[_0xdef4('0x36')],qs['fields'](_0x370cfe[_0xdef4('0x37')][_0xdef4('0x4d')]));_0x5a4d64[_0xdef4('0x3a')]=_0x5a4d64[_0xdef4('0x3a')][_0xdef4('0x3b')]?_0x5a4d64[_0xdef4('0x3a')]:_0xbdfd50[_0xdef4('0x36')];if(_0x370cfe[_0xdef4('0x37')][_0xdef4('0x45')]){_0x5a4d64[_0xdef4('0x46')]=[{'all':!![]}];}_0x5a4d64=_[_0xdef4('0x43')]({},_0x5a4d64,_0x370cfe['options']);return db['WhatsappApplication'][_0xdef4('0x4e')](_0x5a4d64)[_0xdef4('0x29')](handleEntityNotFound(_0x13f472,null))[_0xdef4('0x29')](respondWithResult(_0x13f472,null))[_0xdef4('0x49')](handleError(_0x13f472,null));};exports[_0xdef4('0x4f')]=function(_0x113e15,_0x6c0f3f){return db[_0xdef4('0x31')]['create'](_0x113e15['body'],{})[_0xdef4('0x29')](respondWithResult(_0x6c0f3f,0xc9))[_0xdef4('0x49')](handleError(_0x6c0f3f,null));};exports[_0xdef4('0x28')]=function(_0x250061,_0x3c2233){if(_0x250061[_0xdef4('0x50')]['id']){delete _0x250061[_0xdef4('0x50')]['id'];}return db[_0xdef4('0x31')][_0xdef4('0x4e')]({'where':{'id':_0x250061['params']['id']}})[_0xdef4('0x29')](handleEntityNotFound(_0x3c2233,null))[_0xdef4('0x29')](saveUpdates(_0x250061[_0xdef4('0x50')],null))['then'](respondWithResult(_0x3c2233,null))[_0xdef4('0x49')](handleError(_0x3c2233,null));};exports['destroy']=function(_0x227841,_0x1c579d){return db['WhatsappApplication']['find']({'where':{'id':_0x227841[_0xdef4('0x4b')]['id']}})[_0xdef4('0x29')](handleEntityNotFound(_0x1c579d,null))[_0xdef4('0x29')](removeEntity(_0x1c579d,null))[_0xdef4('0x49')](handleError(_0x1c579d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index cdb4b9c..4f4ba53 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 _0x7d55=['./whatsappApplication.attributes','exports','define','WhatsappApplication','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3a3e30,_0x5996b5){var _0x19f849=function(_0xc6e736){while(--_0xc6e736){_0x3a3e30['push'](_0x3a3e30['shift']());}};_0x19f849(++_0x5996b5);}(_0x7d55,0x1bc));var _0x57d5=function(_0x4eb703,_0x56c5d0){_0x4eb703=_0x4eb703-0x0;var _0x3f45a0=_0x7d55[_0x4eb703];return _0x3f45a0;};'use strict';var _=require(_0x57d5('0x0'));var util=require(_0x57d5('0x1'));var logger=require(_0x57d5('0x2'))(_0x57d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x57d5('0x4'));var fs=require('fs');var path=require(_0x57d5('0x5'));var rimraf=require(_0x57d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x57d5('0x7'));module[_0x57d5('0x8')]=function(_0x15c349,_0x30fcfe){return _0x15c349[_0x57d5('0x9')](_0x57d5('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb18e=['./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x2dbc58,_0x2ab1c6){var _0x151f8e=function(_0x147266){while(--_0x147266){_0x2dbc58['push'](_0x2dbc58['shift']());}};_0x151f8e(++_0x2ab1c6);}(_0xb18e,0x181));var _0xeb18=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0xb18e[_0x4a6cf8];return _0x22205e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb18('0x0'))('api');var moment=require(_0xeb18('0x1'));var BPromise=require('bluebird');var rp=require(_0xeb18('0x2'));var fs=require('fs');var path=require(_0xeb18('0x3'));var rimraf=require('rimraf');var config=require(_0xeb18('0x4'));var attributes=require(_0xeb18('0x5'));module[_0xeb18('0x6')]=function(_0x409efb,_0x46d281){return _0x409efb[_0xeb18('0x7')]('WhatsappApplication',attributes,{'tableName':_0xeb18('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb18('0x9'),'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 34462bf..b712a87 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','util'];(function(_0x2ad228,_0x3a77c8){var _0x13010c=function(_0x1b87cf){while(--_0x1b87cf){_0x2ad228['push'](_0x2ad228['shift']());}};_0x13010c(++_0x3a77c8);}(_0xedd9,0xfc));var _0x9edd=function(_0x2cd8b0,_0x20b66a){_0x2cd8b0=_0x2cd8b0-0x0;var _0xd5fbcf=_0xedd9[_0x2cd8b0];return _0xd5fbcf;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x0a9a=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x0a9a,0x183));var _0xa0a9=function(_0x3aa2e5,_0x2a7977){_0x3aa2e5=_0x3aa2e5-0x0;var _0x4a4b19=_0x0a9a[_0x3aa2e5];return _0x4a4b19;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c80097c..223f804 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 _0x31af=['addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','destroy','delete','removeTags','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','download','post'];(function(_0x1352f0,_0x4cd565){var _0x1c2a82=function(_0x2a9b63){while(--_0x2a9b63){_0x1352f0['push'](_0x1352f0['shift']());}};_0x1c2a82(++_0x4cd565);}(_0x31af,0xde));var _0xf31a=function(_0x4bbff2,_0x571a89){_0x4bbff2=_0x4bbff2-0x0;var _0x4b6595=_0x31af[_0x4bbff2];return _0x4b6595;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf31a('0x4'));var interaction=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var controller=require(_0xf31a('0x7'));router['get']('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0x9')]);router[_0xf31a('0xa')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0xc')]);router[_0xf31a('0xa')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['show']);router[_0xf31a('0xa')](_0xf31a('0xe'),auth[_0xf31a('0x8')](),controller[_0xf31a('0xf')]);router[_0xf31a('0xa')]('/:id/download',auth[_0xf31a('0x8')](),controller[_0xf31a('0x10')]);router[_0xf31a('0x11')]('/',auth[_0xf31a('0x8')](),controller['create']);router[_0xf31a('0x11')](_0xf31a('0xe'),auth['isAuthenticated'](),controller[_0xf31a('0x12')]);router[_0xf31a('0x11')](_0xf31a('0x13'),auth[_0xf31a('0x8')](),interaction[_0xf31a('0x14')](_0xf31a('0x15'),_0xf31a('0x16')),controller[_0xf31a('0x17')]);router[_0xf31a('0x18')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),interaction[_0xf31a('0x14')](_0xf31a('0x15'),_0xf31a('0x19')),controller[_0xf31a('0x1a')]);router['delete'](_0xf31a('0xd'),auth[_0xf31a('0x8')](),interaction[_0xf31a('0x14')](_0xf31a('0x15'),'whatsappinteraction:destroy'),controller[_0xf31a('0x1b')]);router[_0xf31a('0x1c')](_0xf31a('0x13'),auth[_0xf31a('0x8')](),controller[_0xf31a('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xc1c6=['/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x1d9c73,_0x593097){var _0x5a3eff=function(_0x1665cd){while(--_0x1665cd){_0x1d9c73['push'](_0x1d9c73['shift']());}};_0x5a3eff(++_0x593097);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x577193,_0x382e37){_0x577193=_0x577193-0x0;var _0x585e11=_0xc1c6[_0x577193];return _0x585e11;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/download',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x10')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x11')]);router[_0x6c1c('0x10')](_0x6c1c('0xd'),auth['isAuthenticated'](),controller[_0x6c1c('0x12')]);router['post'](_0x6c1c('0x13'),auth[_0x6c1c('0xa')](),interaction[_0x6c1c('0x14')](_0x6c1c('0x15'),_0x6c1c('0x16')),controller[_0x6c1c('0x17')]);router[_0x6c1c('0x18')](_0x6c1c('0x19'),auth[_0x6c1c('0xa')](),interaction['tracked'](_0x6c1c('0x15'),_0x6c1c('0x1a')),controller['update']);router[_0x6c1c('0x1b')](_0x6c1c('0x19'),auth['isAuthenticated'](),interaction[_0x6c1c('0x14')]('whatsapp',_0x6c1c('0x1c')),controller[_0x6c1c('0x1d')]);router['delete'](_0x6c1c('0x13'),auth['isAuthenticated'](),controller[_0x6c1c('0x1e')]);module[_0x6c1c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index ef4943b..6a6b8ef 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 _0xbc8d=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x26c448,_0x4c4861){var _0x293e4a=function(_0x4af00e){while(--_0x4af00e){_0x26c448['push'](_0x26c448['shift']());}};_0x293e4a(++_0x4c4861);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdbc8('0x0'));var moment=require('moment');module[_0xdbc8('0x1')]={'closed':{'type':Sequelize[_0xdbc8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdbc8('0x3')]},'disposition':{'type':Sequelize[_0xdbc8('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xdbc8('0x4')]},'note':{'type':Sequelize[_0xdbc8('0x4')]},'phone':{'type':Sequelize[_0xdbc8('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xdbc8('0x5')]('in',_0xdbc8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdbc8('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xdbc8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xac4f=['ENUM','out','BOOLEAN','sequelize','exports','DATE','STRING'];(function(_0x4748a2,_0x5d04bd){var _0x16c342=function(_0x26237e){while(--_0x26237e){_0x4748a2['push'](_0x4748a2['shift']());}};_0x16c342(++_0x5d04bd);}(_0xac4f,0x122));var _0xfac4=function(_0x24a188,_0x4efd77){_0x24a188=_0x24a188-0x0;var _0x493a78=_0xac4f[_0x24a188];return _0x493a78;};'use strict';var Sequelize=require(_0xfac4('0x0'));var moment=require('moment');module[_0xfac4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfac4('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfac4('0x3')]},'note':{'type':Sequelize[_0xfac4('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xfac4('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfac4('0x4')]('in',_0xfac4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfac4('0x4')]('in',_0xfac4('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfac4('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 0f94d5c..65c279f 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 _0xff96=['parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`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','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','WhatsappAccountId','toString','sequelize','merge','fields','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','push','rows','show','params','include','options','create','addMessage','WhatsappMessage','ids','omit','getMessages','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','unix','join','root','server','files','tmp','attachments','User','CmContact','firstName','lastName','Attachment','Messages','createdAt','secret','WhatsappAccount','Account','Owner','get','N.A.','closed','closedAt','disposition','existsSync','createReadStream','pipe','basename','direction','System','out','renderFile','views','transcript-','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','update','destroy','then','end','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','WhatsappInteraction','rawAttributes','fieldName','type','keys','model','query','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr'];(function(_0x27f5de,_0x577080){var _0x484149=function(_0x7e9adb){while(--_0x7e9adb){_0x27f5de['push'](_0x27f5de['shift']());}};_0x484149(++_0x577080);}(_0xff96,0x179));var _0x6ff9=function(_0x4c3593,_0x4ea381){_0x4c3593=_0x4c3593-0x0;var _0x1172d1=_0xff96[_0x4c3593];return _0x1172d1;};'use strict';var emlformat=require(_0x6ff9('0x0'));var rimraf=require(_0x6ff9('0x1'));var zipdir=require(_0x6ff9('0x2'));var jsonpatch=require(_0x6ff9('0x3'));var rp=require(_0x6ff9('0x4'));var moment=require(_0x6ff9('0x5'));var BPromise=require(_0x6ff9('0x6'));var Mustache=require(_0x6ff9('0x7'));var util=require(_0x6ff9('0x8'));var path=require(_0x6ff9('0x9'));var sox=require(_0x6ff9('0xa'));var csv=require(_0x6ff9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ff9('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6ff9('0xd'));var deskjs=require(_0x6ff9('0xe'));var toCsv=require(_0x6ff9('0xb'));var querystring=require(_0x6ff9('0xf'));var Papa=require(_0x6ff9('0x10'));var Redis=require(_0x6ff9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ff9('0x12'));var as=require(_0x6ff9('0x13'));var pdf=require(_0x6ff9('0x14'));var hardwareService=require(_0x6ff9('0x15'));var logger=require(_0x6ff9('0x16'))(_0x6ff9('0x17'));var utils=require(_0x6ff9('0x18'));var config=require(_0x6ff9('0x19'));var licenseUtil=require(_0x6ff9('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6ff9('0x1b')](config['redis'],{'host':_0x6ff9('0x1c'),'port':0x18eb});var socket=require(_0x6ff9('0x1d'))(new Redis(config[_0x6ff9('0x1e')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x30c5b2,_0x2278d0){_0x2278d0=_0x2278d0||0xcc;return function(_0x2d0475){if(_0x2d0475){return _0x30c5b2[_0x6ff9('0x1f')](_0x2278d0);}return _0x30c5b2['status'](_0x2278d0)['end']();};}function respondWithResult(_0x17b0c7,_0x16772){_0x16772=_0x16772||0xc8;return function(_0x3d4268){if(_0x3d4268){return _0x17b0c7[_0x6ff9('0x20')](_0x16772)[_0x6ff9('0x21')](_0x3d4268);}};}function respondWithFilteredResult(_0x54d5ff,_0xc00da6){return function(_0x4756be){if(_0x4756be){var _0xc7724f=typeof _0xc00da6['offset']==='undefined'&&typeof _0xc00da6['limit']===_0x6ff9('0x22');var _0x1b4753=_0x4756be[_0x6ff9('0x23')];var _0x1c29f8=_0xc7724f?0x0:_0xc00da6[_0x6ff9('0x24')];var _0x4e926e=_0xc7724f?_0x4756be[_0x6ff9('0x23')]:_0xc00da6[_0x6ff9('0x24')]+_0xc00da6[_0x6ff9('0x25')];var _0x3ead33;if(_0x4e926e>=_0x1b4753){_0x4e926e=_0x1b4753;_0x3ead33=0xc8;}else{_0x3ead33=0xce;}_0x54d5ff[_0x6ff9('0x20')](_0x3ead33);return _0x54d5ff[_0x6ff9('0x26')]('Content-Range',_0x1c29f8+'-'+_0x4e926e+'/'+_0x1b4753)[_0x6ff9('0x21')](_0x4756be);}return null;};}function patchUpdates(_0x87d0d0){return function(_0x4eddd7){try{jsonpatch[_0x6ff9('0x27')](_0x4eddd7,_0x87d0d0,!![]);}catch(_0xfc1c6b){return BPromise[_0x6ff9('0x28')](_0xfc1c6b);}return _0x4eddd7['save']();};}function saveUpdates(_0x5a977c,_0x53bcfd){return function(_0x13edf1){if(_0x13edf1){return _0x13edf1[_0x6ff9('0x29')](_0x5a977c)['then'](function(_0x4f6b0f){return _0x4f6b0f;});}return null;};}function removeEntity(_0x12cbd8,_0x5c84a9){return function(_0x4cd175){if(_0x4cd175){return _0x4cd175[_0x6ff9('0x2a')]()[_0x6ff9('0x2b')](function(){_0x12cbd8[_0x6ff9('0x20')](0xcc)[_0x6ff9('0x2c')]();});}};}function handleEntityNotFound(_0x187a01,_0x3a8236){return function(_0x1bbbdd){if(!_0x1bbbdd){_0x187a01[_0x6ff9('0x1f')](0x194);}return _0x1bbbdd;};}function handleError(_0x233b14,_0x154a2e){_0x154a2e=_0x154a2e||0x1f4;return function(_0x380b15){logger[_0x6ff9('0x2d')](_0x380b15[_0x6ff9('0x2e')]);if(_0x380b15[_0x6ff9('0x2f')]){delete _0x380b15[_0x6ff9('0x2f')];}_0x233b14[_0x6ff9('0x20')](_0x154a2e)[_0x6ff9('0x30')](_0x380b15);};}function getInteractionUsers(_0x40e075,_0x1d7fc0){return new BPromise(function(_0x1dbcc8,_0x430520){try{if(_0x1d7fc0[_0x40e075['id']]){_0x40e075[_0x6ff9('0x31')]=_['map'](_0x1d7fc0[_0x40e075['id']],function(_0x44eea2){return{'id':_0x44eea2['id'],'fullname':_0x44eea2[_0x6ff9('0x32')]};});}}catch(_0x2a404b){_0x430520(_0x2a404b);}_0x1dbcc8(_0x40e075);});}function getInteractionTags(_0x2fac0,_0x50c0aa){return new BPromise(function(_0x3e832f,_0x3e8ced){try{if(_0x2fac0[_0x6ff9('0x33')]){_0x2fac0[_0x6ff9('0x34')]=[];_0x2fac0[_0x6ff9('0x33')][_0x6ff9('0x35')](',')[_0x6ff9('0x36')](function(_0x427991){_0x2fac0[_0x6ff9('0x34')]['push'](_0x50c0aa[_0x427991]);});}delete _0x2fac0[_0x6ff9('0x33')];}catch(_0x382c43){_0x3e8ced(_0x382c43);}_0x3e832f(_0x2fac0);});}function updateWhatsappInteraction(_0x2710f0,_0x360e89,_0x768613){return new BPromise(function(_0x1b5882,_0x5b229c){return getInteractionUsers(_0x2710f0,_0x768613)[_0x6ff9('0x2b')](function(_0x4de6dd){return getInteractionTags(_0x4de6dd,_0x360e89);})[_0x6ff9('0x2b')](function(_0x4e7005){_0x1b5882(_0x4e7005);})[_0x6ff9('0x37')](function(_0x1fe5e6){_0x5b229c(_0x1fe5e6);});});}exports[_0x6ff9('0x38')]=function(_0xa7de19,_0x34f775){var _0x71051a={},_0x52e7fd={},_0x31d661={'count':0x0,'rows':[]};var _0x16db53=_[_0x6ff9('0x39')](db[_0x6ff9('0x3a')][_0x6ff9('0x3b')],function(_0x5ba988){return{'name':_0x5ba988[_0x6ff9('0x3c')],'type':_0x5ba988[_0x6ff9('0x3d')]['key']};});_0x52e7fd['model']=_['map'](_0x16db53,'name');_0x52e7fd['query']=_[_0x6ff9('0x3e')](_0xa7de19['query']);_0x52e7fd['filters']=_['intersection'](_0x52e7fd[_0x6ff9('0x3f')],_0x52e7fd[_0x6ff9('0x40')]);_0x71051a[_0x6ff9('0x41')]=_[_0x6ff9('0x42')](_0x52e7fd[_0x6ff9('0x3f')],qs['fields'](_0xa7de19[_0x6ff9('0x40')]['fields']));_0x71051a['attributes']=_0x71051a[_0x6ff9('0x41')]['length']?_0x71051a['attributes']:_0x52e7fd[_0x6ff9('0x3f')];if(!_0xa7de19['query'][_0x6ff9('0x43')](_0x6ff9('0x44'))){_0x71051a[_0x6ff9('0x25')]=qs[_0x6ff9('0x25')](_0xa7de19['query'][_0x6ff9('0x25')]);_0x71051a[_0x6ff9('0x24')]=qs[_0x6ff9('0x24')](_0xa7de19[_0x6ff9('0x40')]['offset']);}_0x71051a[_0x6ff9('0x45')]=qs['sort'](_0xa7de19[_0x6ff9('0x40')][_0x6ff9('0x46')]);_0x71051a[_0x6ff9('0x47')]=qs[_0x6ff9('0x48')](_[_0x6ff9('0x49')](_0xa7de19['query'],_0x52e7fd[_0x6ff9('0x48')]),_0x16db53);var _0x1a0de8=[];var _0x5d3169=squel[_0x6ff9('0x4a')]()[_0x6ff9('0x4b')]('id')[_0x6ff9('0x4b')](_0x6ff9('0x2f'))[_0x6ff9('0x4b')](_0x6ff9('0x4c'))[_0x6ff9('0x4d')](_0x6ff9('0x4e'));var _0x62637=squel[_0x6ff9('0x4a')]()[_0x6ff9('0x4b')](_0x6ff9('0x4f'))[_0x6ff9('0x4b')](_0x6ff9('0x50'))[_0x6ff9('0x4b')]('ui.WhatsappInteractionId')[_0x6ff9('0x4d')](_0x6ff9('0x51'),'ui')[_0x6ff9('0x52')]('users','u',_0x6ff9('0x53'));var _0x11a587=squel['select']()[_0x6ff9('0x4d')]('whatsapp_interactions','i')[_0x6ff9('0x52')](_0x6ff9('0x54'),'c',_0x6ff9('0x55'))[_0x6ff9('0x52')](_0x6ff9('0x56'),'o',_0x6ff9('0x57'))[_0x6ff9('0x52')](_0x6ff9('0x58'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x6ff9('0x52')](_0x6ff9('0x59'),'me',_0x6ff9('0x5a'))[_0x6ff9('0x52')](_0x6ff9('0x5b'),'it',_0x6ff9('0x5c'))[_0x6ff9('0x52')](_0x6ff9('0x4e'),'t',_0x6ff9('0x5d'));var _0x41a506=squel[_0x6ff9('0x5e')]();var _0x478271=[];var _0x233bf8=squel[_0x6ff9('0x5e')]();var _0x213c77;if(_0xa7de19['query']['search']){_0x213c77=as[_0x6ff9('0x5f')](_0xa7de19[_0x6ff9('0x40')][_0x6ff9('0x60')]);var _0x977d4c=_0x213c77[_0x6ff9('0x61')];for(var _0x527f92=0x0;_0x527f92<_0x213c77[_0x6ff9('0x62')]['length'];_0x527f92++){var _0x1164bb=_0x213c77[_0x6ff9('0x62')][_0x527f92];var _0x553f27='i';var _0x354fb5=_[_0x6ff9('0x63')](_0x16db53,[_0x6ff9('0x2f'),_0x1164bb[_0x6ff9('0x4b')]]);if(!_0x354fb5){switch(_0x1164bb[_0x6ff9('0x4b')]){case _0x6ff9('0x64'):if(_0x1164bb[_0x6ff9('0x65')]==0x1){_0x11a587[_0x6ff9('0x66')]('`'+_0x1164bb[_0x6ff9('0x4b')]+_0x6ff9('0x67'));}else{_0x11a587[_0x6ff9('0x66')]('`'+_0x1164bb['field']+'`\x20>\x200');}break;case _0x6ff9('0x68'):if(_0x1164bb[_0x6ff9('0x69')]==='$substring'){if(_0x1164bb['value']['split']('\x20')[_0x6ff9('0x6a')]>0x1){_0x41a506[_0x977d4c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6ff9('0x6b')](_0x1164bb[_0x6ff9('0x65')]),null);}else{var _0x3c8af8='%'+_0x1164bb['value']+'%';_0x41a506[_0x977d4c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c8af8,_0x3c8af8,_0x3c8af8);}}else{_0x354fb5=_[_0x6ff9('0x63')](_0x16db53,[_0x6ff9('0x2f'),_0x6ff9('0x6c')]);_0x1164bb[_0x6ff9('0x4b')]=_0x6ff9('0x6c');_0x436642=as[_0x6ff9('0x6d')](_0x553f27,_0x354fb5[_0x6ff9('0x3d')],_0x1164bb);_0x41a506[_0x977d4c](_0x436642[_0x6ff9('0x6e')],_0x436642[_0x6ff9('0x65')][_0x6ff9('0x6f')],_0x436642[_0x6ff9('0x65')][_0x6ff9('0x2c')]);}break;case _0x6ff9('0x70'):var _0x1b8989=_0x1164bb[_0x6ff9('0x65')]['split'](',')[_0x6ff9('0x39')](function(_0x260f83){return Number(_0x260f83);});_0x1b8989[_0x6ff9('0x36')](function(_0x531781){_0x233bf8['or'](_0x6ff9('0x71'),'%,'+_0x531781+',%');});_0x478271=_[_0x6ff9('0x72')](_0x478271,_0x1b8989);break;case'User':if(_0x1164bb[_0x6ff9('0x69')]===_0x6ff9('0x73')){_0x41a506[_0x977d4c](_0x6ff9('0x74'),'%'+_0x1164bb[_0x6ff9('0x65')]+'%',null);}else{_0x354fb5=_[_0x6ff9('0x63')](_0x16db53,[_0x6ff9('0x2f'),_0x6ff9('0x75')]);_0x1164bb[_0x6ff9('0x4b')]=_0x6ff9('0x75');_0x436642=as['buildExpression'](_0x553f27,_0x354fb5[_0x6ff9('0x3d')],_0x1164bb);_0x41a506[_0x977d4c](_0x436642[_0x6ff9('0x6e')],_0x436642[_0x6ff9('0x65')][_0x6ff9('0x6f')],_0x436642[_0x6ff9('0x65')][_0x6ff9('0x2c')]);}break;case _0x6ff9('0x76'):_0x436642=as[_0x6ff9('0x6d')]('me',null,_0x1164bb);_0x41a506[_0x977d4c](_0x436642[_0x6ff9('0x6e')],_0x436642['value'][_0x6ff9('0x6f')],_0x436642[_0x6ff9('0x65')][_0x6ff9('0x2c')]);break;}}else{var _0x436642=as['buildExpression'](_0x553f27,_0x354fb5[_0x6ff9('0x3d')],_0x1164bb);_0x41a506[_0x977d4c](_0x436642[_0x6ff9('0x6e')],_0x436642['value'][_0x6ff9('0x6f')],_0x436642[_0x6ff9('0x65')][_0x6ff9('0x2c')]);}}}else{var _0x9ab8bf=_(_0xa7de19[_0x6ff9('0x40')])[_0x6ff9('0x3e')]()['map'](function(_0x3098e3){return _['some'](_0x16db53,[_0x6ff9('0x2f'),_0x3098e3])?_0x3098e3:undefined;})[_0x6ff9('0x77')]()[_0x6ff9('0x65')]();if(!_[_0x6ff9('0x78')](_0x9ab8bf)){_0x9ab8bf[_0x6ff9('0x36')](function(_0xcbfa4f){if(_0xcbfa4f==='WhatsappAccountId'){_0x11a587[_0x6ff9('0x47')](_0x6ff9('0x79'),[][_0x6ff9('0x7a')](_0xa7de19[_0x6ff9('0x40')][_0xcbfa4f]));}else if(_0xcbfa4f==='createdAt'){var _0x66ceab=JSON['parse'](_0xa7de19[_0x6ff9('0x40')][_0xcbfa4f])[_0x6ff9('0x7b')];var _0x458139=JSON[_0x6ff9('0x7c')](_0xa7de19[_0x6ff9('0x40')][_0xcbfa4f])[_0x6ff9('0x7d')];_0x11a587[_0x6ff9('0x47')](_0x6ff9('0x7e'),_0x66ceab,_0x458139);}else{if(_0xa7de19['query'][_0xcbfa4f]===_0x6ff9('0x7f')){_0x11a587[_0x6ff9('0x47')]('i.'+_0xcbfa4f+'\x20IS\x20NULL');}else{_0x11a587[_0x6ff9('0x47')]('i.'+_0xcbfa4f+_0x6ff9('0x80'),_0xa7de19[_0x6ff9('0x40')][_0xcbfa4f]);}}});}if(_0xa7de19['query'][_0x6ff9('0x81')]){if(_0xa7de19[_0x6ff9('0x40')]['read']==0x1){_0x11a587[_0x6ff9('0x66')](_0x6ff9('0x82'));}else{_0x11a587[_0x6ff9('0x66')](_0x6ff9('0x83'));}}if(_0xa7de19[_0x6ff9('0x40')]['tag']){_0x478271=_['isArray'](_0xa7de19[_0x6ff9('0x40')][_0x6ff9('0x84')])?_0xa7de19[_0x6ff9('0x40')][_0x6ff9('0x84')]:new Array(_0xa7de19['query'][_0x6ff9('0x84')]);_0x478271[_0x6ff9('0x36')](function(_0x40bd19){_0x233bf8['or'](_0x6ff9('0x71'),'%,'+_0x40bd19+',%');});}if(_0xa7de19[_0x6ff9('0x40')]['filter']){var _0x15ac80=_0xa7de19[_0x6ff9('0x40')][_0x6ff9('0x85')][_0x6ff9('0x86')]('\x5c','\x5c\x5c')[_0x6ff9('0x86')](/'/g,'\x27\x27');if(qs[_0x6ff9('0x87')](_0x15ac80)){_0x41a506['or'](_0x6ff9('0x88'),_0x15ac80+'%')['or']('i.phone\x20LIKE\x20?',_0x15ac80+'%');}else{_0x41a506['or'](_0x6ff9('0x89'),qs[_0x6ff9('0x6b')](_0x15ac80))['or'](_0x6ff9('0x8a'),_0x15ac80+'%');}}}_0x11a587[_0x6ff9('0x47')](_0x41a506);_0x11a587[_0x6ff9('0x8b')](_0x6ff9('0x8c'));var _0x3e9757={'type':db[_0x6ff9('0x8d')][_0x6ff9('0x8e')]['SELECT'],'raw':!![]};var _0x4e6074=_0x11a587[_0x6ff9('0x8f')]();_0x4e6074[_0x6ff9('0x4b')](_0x6ff9('0x8c'));_0x4e6074[_0x6ff9('0x4b')](_0x6ff9('0x90'),_0x6ff9('0x64'));if(_0x71051a[_0x6ff9('0x45')]){_0x71051a[_0x6ff9('0x45')]['forEach'](function(_0x4ed627){var _0x52f85b=_0x4ed627[0x0]===_0x6ff9('0x91')?_0x4ed627[0x0]:'i.'+_0x4ed627[0x0];_0x11a587[_0x6ff9('0x45')](_0x52f85b,_0x4ed627[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x478271)){_0x11a587[_0x6ff9('0x66')](_0x233bf8);_0x4e6074[_0x6ff9('0x47')](_0x6ff9('0x92'),_0x478271);}BPromise[_0x6ff9('0x93')]()[_0x6ff9('0x2b')](function(){if(!_0x213c77){if(_0xa7de19[_0x6ff9('0x40')]['WhatsappAccountId'])return;_0x4e6074['where'](_0x6ff9('0x94'));_0x11a587[_0x6ff9('0x47')](_0x6ff9('0x94'));return;}if(_0xa7de19[_0x6ff9('0x95')]['role']!==_0x6ff9('0x96'))return;return _0xa7de19[_0x6ff9('0x95')][_0x6ff9('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x34e51d){if(_[_0x6ff9('0x78')](_0x34e51d)){_0x4e6074[_0x6ff9('0x47')](_0x6ff9('0x98'));_0x11a587[_0x6ff9('0x47')](_0x6ff9('0x98'));}else{_0x4e6074[_0x6ff9('0x47')](_0x6ff9('0x79'),_[_0x6ff9('0x39')](_0x34e51d,'id'));_0x11a587[_0x6ff9('0x47')](_0x6ff9('0x79'),_['map'](_0x34e51d,'id'));}});})[_0x6ff9('0x2b')](function(){if(_0xa7de19[_0x6ff9('0x95')][_0x6ff9('0x99')]==='agent'&&!_0x213c77&&!_0xa7de19['query'][_0x6ff9('0x9a')])return[];return db['sequelize'][_0x6ff9('0x40')](_0x4e6074[_0x6ff9('0x9b')](),_0x3e9757);})['then'](function(_0x5d0c84){_0x31d661[_0x6ff9('0x23')]=_0x5d0c84[_0x6ff9('0x6a')];if(_0x31d661[_0x6ff9('0x23')]===0x0)return[];return db[_0x6ff9('0x9c')][_0x6ff9('0x40')](_0x5d3169[_0x6ff9('0x9b')](),_0x3e9757)['then'](function(_0x195bf7){_0x1a0de8=_['keyBy'](_0x195bf7,'id');_0x3e9757=_[_0x6ff9('0x9d')](_0x3e9757,{'model':db[_0x6ff9('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa7de19[_0x6ff9('0x40')][_0x6ff9('0x9e')]){_0x71051a['attributes']['forEach'](function(_0x4255e9){_0x11a587['field']('i.'+_0x4255e9);});}else{_0x11a587[_0x6ff9('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6ff9('0x64'));_0x11a587['field']('a.key',_0x6ff9('0x9f'));_0x11a587['field'](_0x6ff9('0xa0'),_0x6ff9('0xa1'));_0x11a587[_0x6ff9('0x4b')](_0x6ff9('0xa2'),_0x6ff9('0x91'));_0x11a587[_0x6ff9('0x4b')](_0x6ff9('0xa3'));_0x11a587['field'](_0x6ff9('0xa4'),_0x6ff9('0xa5'));_0x11a587[_0x6ff9('0x4b')](_0x6ff9('0xa6'),_0x6ff9('0xa7'));_0x11a587['field']('c.email',_0x6ff9('0xa8'));_0x11a587[_0x6ff9('0x4b')](_0x6ff9('0xa9'),_0x6ff9('0xaa'));_0x11a587['field'](_0x6ff9('0xab'),_0x6ff9('0xac'));_0x11a587[_0x6ff9('0x4b')]('c.fax',_0x6ff9('0xad'));_0x11a587[_0x6ff9('0x4b')](_0x6ff9('0xae'),'Owner.fullname');_0x11a587['field'](_0x6ff9('0xaf'),'Owner.internal');_0x11a587[_0x6ff9('0x4b')](_0x6ff9('0xb0'),_0x6ff9('0x33'));}if(_0x71051a['limit'])_0x11a587[_0x6ff9('0x25')](_0x71051a[_0x6ff9('0x25')]);if(_0x71051a[_0x6ff9('0x24')])_0x11a587[_0x6ff9('0x24')](_0x71051a[_0x6ff9('0x24')]);return db[_0x6ff9('0x9c')][_0x6ff9('0x40')](_0x11a587[_0x6ff9('0x9b')](),_0x3e9757);})[_0x6ff9('0x2b')](function(_0x36881e){if(_0x36881e[_0x6ff9('0x6a')]>0x0)_0x62637[_0x6ff9('0x47')](_0x6ff9('0xb1'),_['map'](_0x36881e,'id'));return db[_0x6ff9('0x9c')][_0x6ff9('0x40')](_0x62637[_0x6ff9('0x9b')](),_0x3e9757)['then'](function(_0x389ca4){var _0x19acf3=_[_0x6ff9('0xb2')](_0x389ca4,'WhatsappInteractionId');var _0xcef864=[];_0x36881e[_0x6ff9('0x36')](function(_0x5b5e27){_0xcef864[_0x6ff9('0xb3')](updateWhatsappInteraction(_0x5b5e27,_0x1a0de8,_0x19acf3));});return BPromise['all'](_0xcef864);});});})[_0x6ff9('0x2b')](function(_0x3ef640){_0x31d661[_0x6ff9('0xb4')]=_0x3ef640;return _0x31d661;})[_0x6ff9('0x2b')](respondWithFilteredResult(_0x34f775,_0x71051a))[_0x6ff9('0x37')](handleError(_0x34f775,null));};exports[_0x6ff9('0xb5')]=function(_0x17d749,_0x3f53cc){var _0x541552={'raw':![],'where':{'id':_0x17d749[_0x6ff9('0xb6')]['id']}},_0x25487c={};_0x25487c[_0x6ff9('0x3f')]=_[_0x6ff9('0x3e')](db[_0x6ff9('0x3a')][_0x6ff9('0x3b')]);_0x25487c['query']=_[_0x6ff9('0x3e')](_0x17d749[_0x6ff9('0x40')]);_0x25487c[_0x6ff9('0x48')]=_[_0x6ff9('0x42')](_0x25487c[_0x6ff9('0x3f')],_0x25487c[_0x6ff9('0x40')]);_0x541552[_0x6ff9('0x41')]=_[_0x6ff9('0x42')](_0x25487c[_0x6ff9('0x3f')],qs[_0x6ff9('0x9e')](_0x17d749[_0x6ff9('0x40')][_0x6ff9('0x9e')]));_0x541552['attributes']=_0x541552[_0x6ff9('0x41')][_0x6ff9('0x6a')]?_0x541552[_0x6ff9('0x41')]:_0x25487c[_0x6ff9('0x3f')];if(_0x17d749[_0x6ff9('0x40')]['includeAll']){_0x541552[_0x6ff9('0xb7')]=[{'all':!![]}];}_0x541552=_['merge']({},_0x541552,_0x17d749[_0x6ff9('0xb8')]);return db[_0x6ff9('0x3a')]['find'](_0x541552)[_0x6ff9('0x2b')](handleEntityNotFound(_0x3f53cc,null))[_0x6ff9('0x2b')](respondWithResult(_0x3f53cc,null))[_0x6ff9('0x37')](handleError(_0x3f53cc,null));};exports['create']=function(_0x2dc756,_0x11ab97){return db[_0x6ff9('0x3a')][_0x6ff9('0xb9')](_0x2dc756['body'],{})[_0x6ff9('0x2b')](respondWithResult(_0x11ab97,0xc9))[_0x6ff9('0x37')](handleError(_0x11ab97,null));};exports[_0x6ff9('0x29')]=function(_0x6a5033,_0x5296de){if(_0x6a5033[_0x6ff9('0x76')]['id']){delete _0x6a5033[_0x6ff9('0x76')]['id'];}return db['WhatsappInteraction'][_0x6ff9('0x63')]({'where':{'id':_0x6a5033[_0x6ff9('0xb6')]['id']}})[_0x6ff9('0x2b')](handleEntityNotFound(_0x5296de,null))[_0x6ff9('0x2b')](saveUpdates(_0x6a5033[_0x6ff9('0x76')],null))['then'](respondWithResult(_0x5296de,null))[_0x6ff9('0x37')](handleError(_0x5296de,null));};exports[_0x6ff9('0x2a')]=function(_0x1edf5e,_0x52ea85){return db[_0x6ff9('0x3a')][_0x6ff9('0x63')]({'where':{'id':_0x1edf5e['params']['id']}})['then'](handleEntityNotFound(_0x52ea85,null))['then'](removeEntity(_0x52ea85,null))[_0x6ff9('0x37')](handleError(_0x52ea85,null));};exports['describe']=function(_0x5f1b85,_0xe5fa59){return db[_0x6ff9('0x3a')]['describe']()[_0x6ff9('0x2b')](respondWithResult(_0xe5fa59,null))[_0x6ff9('0x37')](handleError(_0xe5fa59,null));};exports[_0x6ff9('0xba')]=function(_0x23f7cf,_0x58c48e,_0x2a9e3b){return db[_0x6ff9('0xbb')][_0x6ff9('0x63')]({'where':{'id':_0x23f7cf[_0x6ff9('0xb6')]['id']}})['then'](handleEntityNotFound(_0x58c48e,null))[_0x6ff9('0x2b')](function(_0x4132ae){if(_0x4132ae){return _0x4132ae[_0x6ff9('0xba')](_0x23f7cf['body'][_0x6ff9('0xbc')],_[_0x6ff9('0xbd')](_0x23f7cf[_0x6ff9('0x76')],['ids','id'])||{});}})['then'](respondWithResult(_0x58c48e,null))['catch'](handleError(_0x58c48e,null));};exports[_0x6ff9('0xbe')]=function(_0x48eefe,_0x4eb41c,_0x4c33df){var _0x263fcd={'raw':![],'where':{}};var _0x4a62bc={};var _0x52e6ae={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x48eefe[_0x6ff9('0xb6')]['id']}})['then'](handleEntityNotFound(_0x4eb41c,null))['then'](function(_0x1547d){if(_0x1547d){_0x4a62bc['model']=_['keys'](db['WhatsappMessage'][_0x6ff9('0x3b')]);_0x4a62bc[_0x6ff9('0x40')]=_[_0x6ff9('0x3e')](_0x48eefe[_0x6ff9('0x40')]);_0x4a62bc[_0x6ff9('0x48')]=_['intersection'](_0x4a62bc[_0x6ff9('0x3f')],_0x4a62bc[_0x6ff9('0x40')]);_0x263fcd['attributes']=_[_0x6ff9('0x42')](_0x4a62bc['model'],qs[_0x6ff9('0x9e')](_0x48eefe[_0x6ff9('0x40')][_0x6ff9('0x9e')]));_0x263fcd[_0x6ff9('0x41')]=_0x263fcd['attributes'][_0x6ff9('0x6a')]?_0x263fcd['attributes']:_0x4a62bc[_0x6ff9('0x3f')];if(!_0x48eefe['query']['hasOwnProperty'](_0x6ff9('0x44'))){_0x263fcd[_0x6ff9('0x25')]=qs[_0x6ff9('0x25')](_0x48eefe[_0x6ff9('0x40')][_0x6ff9('0x25')]);_0x263fcd[_0x6ff9('0x24')]=qs['offset'](_0x48eefe['query']['offset']);}_0x263fcd[_0x6ff9('0x45')]=qs[_0x6ff9('0x46')](_0x48eefe[_0x6ff9('0x40')][_0x6ff9('0x46')]);_0x263fcd[_0x6ff9('0x47')]=qs[_0x6ff9('0x48')](_[_0x6ff9('0x49')](_0x48eefe['query'],_0x4a62bc[_0x6ff9('0x48')]));_0x263fcd[_0x6ff9('0x47')][_0x6ff9('0xbf')]=_0x1547d['id'];if(_0x48eefe[_0x6ff9('0x40')][_0x6ff9('0x85')]){_0x263fcd['where']=_[_0x6ff9('0x9d')](_0x263fcd[_0x6ff9('0x47')],{'$or':_['map'](_0x263fcd['attributes'],function(_0x601982){var _0x36f0e6={};_0x36f0e6[_0x601982]={'$like':'%'+_0x48eefe['query'][_0x6ff9('0x85')]+'%'};return _0x36f0e6;})});}if(_0x48eefe['query'][_0x6ff9('0x7b')]){var _0x34aab7=_0x48eefe['query'][_0x6ff9('0x7b')]['split'](',');var _0x159245={};_0x159245[_0x34aab7[0x0]]={'$gte':moment(_0x34aab7[0x1])[_0x6ff9('0xc0')](_0x6ff9('0xc1'))};_0x263fcd['where']=_['merge'](_0x263fcd['where'],_0x159245);}_0x263fcd=_['merge']({},_0x263fcd,_0x48eefe[_0x6ff9('0xb8')]);return db[_0x6ff9('0xbb')]['count']({'where':_0x263fcd[_0x6ff9('0x47')]})['then'](function(_0x176435){_0x52e6ae[_0x6ff9('0x23')]=_0x176435;if(_0x48eefe[_0x6ff9('0x40')][_0x6ff9('0xc2')]){_0x263fcd[_0x6ff9('0xb7')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x6ff9('0xc3')](_0x263fcd);})[_0x6ff9('0x2b')](function(_0x22ae8e){_0x52e6ae[_0x6ff9('0xb4')]=_0x22ae8e;return _0x52e6ae;});}})[_0x6ff9('0x2b')](respondWithFilteredResult(_0x4eb41c,_0x263fcd))['catch'](handleError(_0x4eb41c,null));};exports[_0x6ff9('0xc4')]=function(_0xb65cb4,_0x288d8c,_0x3e464d){return db[_0x6ff9('0x3a')][_0x6ff9('0x63')]({'where':{'id':_0xb65cb4[_0x6ff9('0xb6')]['id']}})[_0x6ff9('0x2b')](handleEntityNotFound(_0x288d8c,null))[_0x6ff9('0x2b')](function(_0x276498){if(_0x276498){return _0x276498[_0x6ff9('0xc5')](_0xb65cb4['body'][_0x6ff9('0xbc')],_[_0x6ff9('0xbd')](_0xb65cb4['body'],[_0x6ff9('0xbc'),'id'])||{})['spread'](function(){return db[_0x6ff9('0x70')]['findAll']({'attributes':['id',_0x6ff9('0x2f'),'color'],'where':{'id':_0xb65cb4[_0x6ff9('0x76')][_0x6ff9('0xbc')]}});})['then'](function(_0x2716b7){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0xb65cb4[_0x6ff9('0xb6')]['id']),'tags':_0x2716b7||[]});return{'id':Number(_0xb65cb4[_0x6ff9('0xb6')]['id']),'tags':_0x2716b7||[]};});}})['then'](respondWithResult(_0x288d8c,null))[_0x6ff9('0x37')](handleError(_0x288d8c,null));};exports['removeTags']=function(_0x1eaf2d,_0xde0f2c,_0x1b42ad){return db[_0x6ff9('0x3a')][_0x6ff9('0x63')]({'where':{'id':_0x1eaf2d[_0x6ff9('0xb6')]['id']}})[_0x6ff9('0x2b')](handleEntityNotFound(_0xde0f2c,null))[_0x6ff9('0x2b')](function(_0x27b56a){if(_0x27b56a){return _0x27b56a['removeTags'](_0x1eaf2d[_0x6ff9('0x40')][_0x6ff9('0xbc')]);}})[_0x6ff9('0x2b')](respondWithStatusCode(_0xde0f2c,null))[_0x6ff9('0x37')](handleError(_0xde0f2c,null));};exports['download']=function(_0x32f71f,_0x24d8f3){var _0x2a2c4e=moment()[_0x6ff9('0xc6')]()[_0x6ff9('0x9b')]();var _0x5ccceb=path[_0x6ff9('0xc7')](config[_0x6ff9('0xc8')],_0x6ff9('0xc9'),_0x6ff9('0xca'),_0x6ff9('0xcb'));var _0x116865=path['join'](config[_0x6ff9('0xc8')],'server',_0x6ff9('0xca'),_0x6ff9('0xcc'));var _0x574c57=path[_0x6ff9('0xc7')](_0x5ccceb,_0x2a2c4e);var _0x3a1e2c=util['format']('transcript-%d-%s.zip',_0x32f71f['params']['id'],_0x2a2c4e);var _0x30e6b7=path[_0x6ff9('0xc7')](_0x5ccceb,_0x3a1e2c);var _0x1da5cd=[];_0x1da5cd[_0x6ff9('0xb3')]({'model':db[_0x6ff9('0xcd')],'as':_0x6ff9('0xcd'),'attributes':['id',_0x6ff9('0x32')],'raw':!![]});_0x1da5cd[_0x6ff9('0xb3')]({'model':db[_0x6ff9('0xce')],'as':_0x6ff9('0x68'),'attributes':['id',_0x6ff9('0xcf'),_0x6ff9('0xd0')],'raw':!![]});if(_0x32f71f[_0x6ff9('0x40')]['attachments']){_0x1da5cd[_0x6ff9('0xb3')]({'model':db[_0x6ff9('0xd1')],'as':_0x6ff9('0xd1'),'raw':!![]});}var _0x35bea7=[{'model':db['WhatsappMessage'],'as':_0x6ff9('0xd2'),'attributes':['id','body',_0x6ff9('0xd3'),'direction',_0x6ff9('0xd4'),_0x6ff9('0x81')],'include':_0x1da5cd}];_0x35bea7['push']({'model':db[_0x6ff9('0xd5')],'as':_0x6ff9('0xd6'),'attributes':['id','name']});_0x35bea7['push']({'model':db[_0x6ff9('0xcd')],'as':_0x6ff9('0xd7'),'attributes':['id',_0x6ff9('0x32')]});return db[_0x6ff9('0x3a')][_0x6ff9('0x63')]({'where':{'id':_0x32f71f[_0x6ff9('0xb6')]['id']},'include':_0x35bea7})[_0x6ff9('0x2b')](handleEntityNotFound(_0x24d8f3,null))['then'](function(_0x56282b){if(_0x56282b){var _0x535c3a=_0x56282b[_0x6ff9('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x574c57);var _0x2265ac={'channel':'Whatsapp','account':_0x535c3a[_0x6ff9('0xd6')][_0x6ff9('0x2f')],'agent':_0x535c3a['Owner']?_0x535c3a[_0x6ff9('0xd7')][_0x6ff9('0x32')]:_0x6ff9('0xd9'),'createdAt':moment(_0x535c3a[_0x6ff9('0xd3')])[_0x6ff9('0xc0')](_0x6ff9('0xc1'))[_0x6ff9('0x9b')](),'closedAt':_0x535c3a[_0x6ff9('0xda')]?moment(_0x535c3a[_0x6ff9('0xdb')])[_0x6ff9('0xc0')](_0x6ff9('0xc1'))[_0x6ff9('0x9b')]():'','disposition':_0x535c3a[_0x6ff9('0xdc')],'messages':_(_0x535c3a[_0x6ff9('0xd2')])[_0x6ff9('0x85')]({'secret':![]})[_0x6ff9('0x39')](function(_0x45fa51){if(_0x45fa51[_0x6ff9('0xd1')]){var _0x36f717=path[_0x6ff9('0xc7')](_0x116865,_0x45fa51[_0x6ff9('0xd1')]['basename']);if(fs[_0x6ff9('0xdd')](_0x36f717)){fs[_0x6ff9('0xde')](_0x36f717)[_0x6ff9('0xdf')](fs['createWriteStream'](path[_0x6ff9('0xc7')](_0x574c57,_0x45fa51[_0x6ff9('0xd1')][_0x6ff9('0xe0')])));}}return{'date':moment(_0x45fa51['createdAt'])['format'](_0x6ff9('0xc1'))[_0x6ff9('0x9b')](),'sender':_0x45fa51[_0x6ff9('0xe1')]==='out'?_0x45fa51[_0x6ff9('0xcd')]?_0x45fa51[_0x6ff9('0xcd')][_0x6ff9('0x32')]:_0x6ff9('0xe2'):_0x45fa51[_0x6ff9('0x68')][_0x6ff9('0xcf')]+(_0x45fa51[_0x6ff9('0x68')]['lastName']?'\x20'+_0x45fa51[_0x6ff9('0x68')][_0x6ff9('0xd0')]:''),'body':_0x45fa51[_0x6ff9('0xd1')]?_0x45fa51[_0x6ff9('0xd1')][_0x6ff9('0xe0')]:_0x45fa51[_0x6ff9('0x76')],'direction':_0x45fa51[_0x6ff9('0xe1')]===_0x6ff9('0xe3')?'A':'C','secret':_0x45fa51[_0x6ff9('0xd4')],'read':_0x45fa51['read'],'attachment':_0x45fa51['Attachment']};})[_0x6ff9('0x65')]()};return ejs[_0x6ff9('0xe4')](path[_0x6ff9('0xc7')](config['root'],_0x6ff9('0xc9'),_0x6ff9('0xe5'),'downloadInteraction.ejs'),{'interaction':_0x2265ac})[_0x6ff9('0x2b')](function(_0x112f65){var _0x1f14d0=path['join'](_0x574c57,_0x6ff9('0xe6')+_0x535c3a['id']+'-'+_0x2a2c4e+'.pdf');var _0x5778f3={'path':_0x1f14d0,'channel':'Whatsapp','interactionId':_0x535c3a['id']};return pdf[_0x6ff9('0xe7')](_0x112f65,_0x5778f3);})[_0x6ff9('0x2b')](function(){return new BPromise(function(_0xcdad37,_0x2c4778){zipdir(_0x574c57,{'saveTo':_0x30e6b7},function(_0x352cf5,_0x3bc4d1){if(_0x352cf5)return _0x2c4778(_0x352cf5);return _0xcdad37(_0x3bc4d1);});})['then'](function(){return new BPromise(function(_0x2f7f49,_0xb269d0){rimraf(_0x574c57,function(_0x3ab3df){if(_0x3ab3df)_0xb269d0(_0x3ab3df);return _0x2f7f49();});});})[_0x6ff9('0x2b')](function(){return _0x24d8f3[_0x6ff9('0xe8')](_0x30e6b7,_0x3a1e2c,function(_0x156043){if(_0x156043){console[_0x6ff9('0xe9')](_0x6ff9('0xea'),_0x156043);}else{fs[_0x6ff9('0xeb')](_0x30e6b7);}});});});}else{return _0x24d8f3['sendStatus'](0xc8);}})[_0x6ff9('0x37')](handleError(_0x24d8f3,null));}; \ No newline at end of file +var _0x7ee1=['attributes','fields','length','nolimit','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','$substring','value','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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','UserId','body','keys','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','options','findAll','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','join','files','attachments','format','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','fullname','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','existsSync','pipe','out','System','Contact','firstName','direction','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','Tags','TagIds','split','forEach','push','catch','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0x33f153,_0x39d65d){var _0x12ac15=function(_0x1603c1){while(--_0x1603c1){_0x33f153['push'](_0x33f153['shift']());}};_0x12ac15(++_0x39d65d);}(_0x7ee1,0xab));var _0x17ee=function(_0x276c51,_0x309c86){_0x276c51=_0x276c51-0x0;var _0x15487f=_0x7ee1[_0x276c51];return _0x15487f;};'use strict';var emlformat=require(_0x17ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17ee('0x1'));var jsonpatch=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var moment=require(_0x17ee('0x4'));var BPromise=require(_0x17ee('0x5'));var Mustache=require('mustache');var util=require(_0x17ee('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x17ee('0x7'));var ejs=require(_0x17ee('0x8'));var fs=require('fs');var fs_extra=require(_0x17ee('0x9'));var _=require(_0x17ee('0xa'));var squel=require(_0x17ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x17ee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x17ee('0x7'));var querystring=require(_0x17ee('0xd'));var Papa=require('papaparse');var Redis=require(_0x17ee('0xe'));var authService=require(_0x17ee('0xf'));var qs=require(_0x17ee('0x10'));var as=require(_0x17ee('0x11'));var pdf=require(_0x17ee('0x12'));var hardwareService=require(_0x17ee('0x13'));var logger=require(_0x17ee('0x14'))(_0x17ee('0x15'));var utils=require(_0x17ee('0x16'));var config=require(_0x17ee('0x17'));var licenseUtil=require(_0x17ee('0x18'));var db=require(_0x17ee('0x19'))['db'];config['redis']=_[_0x17ee('0x1a')](config[_0x17ee('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x17ee('0x1c'))(new Redis(config['redis']));require(_0x17ee('0x1d'))[_0x17ee('0x1e')](socket);function respondWithStatusCode(_0x16a1b5,_0x206f85){_0x206f85=_0x206f85||0xcc;return function(_0x5eebbc){if(_0x5eebbc){return _0x16a1b5[_0x17ee('0x1f')](_0x206f85);}return _0x16a1b5[_0x17ee('0x20')](_0x206f85)[_0x17ee('0x21')]();};}function respondWithResult(_0x4bfb6d,_0x138507){_0x138507=_0x138507||0xc8;return function(_0x47c346){if(_0x47c346){return _0x4bfb6d[_0x17ee('0x20')](_0x138507)[_0x17ee('0x22')](_0x47c346);}};}function respondWithFilteredResult(_0x42b403,_0x3785ed){return function(_0x15d245){if(_0x15d245){var _0x5506a3=typeof _0x3785ed['offset']===_0x17ee('0x23')&&typeof _0x3785ed[_0x17ee('0x24')]===_0x17ee('0x23');var _0x2f908f=_0x15d245['count'];var _0x29a874=_0x5506a3?0x0:_0x3785ed[_0x17ee('0x25')];var _0x25782c=_0x5506a3?_0x15d245[_0x17ee('0x26')]:_0x3785ed['offset']+_0x3785ed[_0x17ee('0x24')];var _0x3d9120;if(_0x25782c>=_0x2f908f){_0x25782c=_0x2f908f;_0x3d9120=0xc8;}else{_0x3d9120=0xce;}_0x42b403[_0x17ee('0x20')](_0x3d9120);return _0x42b403['set'](_0x17ee('0x27'),_0x29a874+'-'+_0x25782c+'/'+_0x2f908f)[_0x17ee('0x22')](_0x15d245);}return null;};}function patchUpdates(_0x27f056){return function(_0x199311){try{jsonpatch[_0x17ee('0x28')](_0x199311,_0x27f056,!![]);}catch(_0x4804ea){return BPromise[_0x17ee('0x29')](_0x4804ea);}return _0x199311[_0x17ee('0x2a')]();};}function saveUpdates(_0xf20fe0,_0x1ce8c7){return function(_0x88a4af){if(_0x88a4af){return _0x88a4af[_0x17ee('0x2b')](_0xf20fe0)[_0x17ee('0x2c')](function(_0x51a282){return _0x51a282;});}return null;};}function removeEntity(_0x4f24a8,_0x284fbc){return function(_0x1e24bf){if(_0x1e24bf){return _0x1e24bf[_0x17ee('0x2d')]()[_0x17ee('0x2c')](function(){_0x4f24a8[_0x17ee('0x20')](0xcc)[_0x17ee('0x21')]();});}};}function handleEntityNotFound(_0x5b11c5,_0x4ba675){return function(_0x32548e){if(!_0x32548e){_0x5b11c5[_0x17ee('0x1f')](0x194);}return _0x32548e;};}function handleError(_0x390c04,_0x5ea202){_0x5ea202=_0x5ea202||0x1f4;return function(_0x393231){logger[_0x17ee('0x2e')](_0x393231[_0x17ee('0x2f')]);if(_0x393231['name']){delete _0x393231[_0x17ee('0x30')];}_0x390c04[_0x17ee('0x20')](_0x5ea202)[_0x17ee('0x31')](_0x393231);};}function getInteractionUsers(_0x1e5727,_0x4dfb63){return new BPromise(function(_0x3aa7fe,_0x3e7b9b){try{if(_0x4dfb63[_0x1e5727['id']]){_0x1e5727[_0x17ee('0x32')]=_['map'](_0x4dfb63[_0x1e5727['id']],function(_0x6f8327){return{'id':_0x6f8327['id'],'fullname':_0x6f8327['fullname']};});}}catch(_0x9e6424){_0x3e7b9b(_0x9e6424);}_0x3aa7fe(_0x1e5727);});}function getInteractionTags(_0x1cf8b9,_0x126f3a){return new BPromise(function(_0x5d0171,_0x2356fd){try{if(_0x1cf8b9['TagIds']){_0x1cf8b9[_0x17ee('0x33')]=[];_0x1cf8b9[_0x17ee('0x34')][_0x17ee('0x35')](',')[_0x17ee('0x36')](function(_0x514114){_0x1cf8b9[_0x17ee('0x33')][_0x17ee('0x37')](_0x126f3a[_0x514114]);});}delete _0x1cf8b9[_0x17ee('0x34')];}catch(_0x57096e){_0x2356fd(_0x57096e);}_0x5d0171(_0x1cf8b9);});}function updateWhatsappInteraction(_0x64ca53,_0x3d91a2,_0x4284cc){return new BPromise(function(_0x5b338e,_0x12a758){return getInteractionUsers(_0x64ca53,_0x4284cc)[_0x17ee('0x2c')](function(_0x2177ef){return getInteractionTags(_0x2177ef,_0x3d91a2);})[_0x17ee('0x2c')](function(_0x1e3c2f){_0x5b338e(_0x1e3c2f);})[_0x17ee('0x38')](function(_0x219384){_0x12a758(_0x219384);});});}exports[_0x17ee('0x39')]=function(_0x219db4,_0x466787){var _0x51e304={},_0x3c2846={},_0xe8f55c={'count':0x0,'rows':[]};var _0x1614fd=_[_0x17ee('0x3a')](db[_0x17ee('0x3b')][_0x17ee('0x3c')],function(_0x2d6afc){return{'name':_0x2d6afc[_0x17ee('0x3d')],'type':_0x2d6afc[_0x17ee('0x3e')][_0x17ee('0x3f')]};});_0x3c2846[_0x17ee('0x40')]=_['map'](_0x1614fd,_0x17ee('0x30'));_0x3c2846[_0x17ee('0x41')]=_['keys'](_0x219db4[_0x17ee('0x41')]);_0x3c2846[_0x17ee('0x42')]=_[_0x17ee('0x43')](_0x3c2846[_0x17ee('0x40')],_0x3c2846[_0x17ee('0x41')]);_0x51e304[_0x17ee('0x44')]=_['intersection'](_0x3c2846['model'],qs[_0x17ee('0x45')](_0x219db4[_0x17ee('0x41')][_0x17ee('0x45')]));_0x51e304[_0x17ee('0x44')]=_0x51e304[_0x17ee('0x44')][_0x17ee('0x46')]?_0x51e304['attributes']:_0x3c2846[_0x17ee('0x40')];if(!_0x219db4[_0x17ee('0x41')]['hasOwnProperty'](_0x17ee('0x47'))){_0x51e304['limit']=qs[_0x17ee('0x24')](_0x219db4['query'][_0x17ee('0x24')]);_0x51e304[_0x17ee('0x25')]=qs[_0x17ee('0x25')](_0x219db4[_0x17ee('0x41')]['offset']);}_0x51e304['order']=qs['sort'](_0x219db4['query'][_0x17ee('0x48')]);_0x51e304[_0x17ee('0x49')]=qs['filters'](_[_0x17ee('0x4a')](_0x219db4[_0x17ee('0x41')],_0x3c2846[_0x17ee('0x42')]),_0x1614fd);var _0xcf486=[];var _0x31e4f1=squel[_0x17ee('0x4b')]()[_0x17ee('0x4c')]('id')[_0x17ee('0x4c')]('name')[_0x17ee('0x4c')](_0x17ee('0x4d'))['from'](_0x17ee('0x4e'));var _0x1a8bc5=squel[_0x17ee('0x4b')]()['field']('u.id')['field'](_0x17ee('0x4f'))[_0x17ee('0x4c')](_0x17ee('0x50'))[_0x17ee('0x51')](_0x17ee('0x52'),'ui')[_0x17ee('0x53')](_0x17ee('0x54'),'u',_0x17ee('0x55'));var _0x5d2e69=squel[_0x17ee('0x4b')]()[_0x17ee('0x51')](_0x17ee('0x56'),'i')[_0x17ee('0x53')](_0x17ee('0x57'),'c',_0x17ee('0x58'))[_0x17ee('0x53')]('users','o',_0x17ee('0x59'))[_0x17ee('0x53')](_0x17ee('0x5a'),'a',_0x17ee('0x5b'))['left_join'](_0x17ee('0x5c'),'me',_0x17ee('0x5d'))[_0x17ee('0x53')](_0x17ee('0x5e'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x17ee('0x53')](_0x17ee('0x4e'),'t',_0x17ee('0x5f'));var _0x3d399b=squel[_0x17ee('0x60')]();var _0x3e588a=[];var _0x153b50=squel[_0x17ee('0x60')]();var _0x4b913a;if(_0x219db4['query'][_0x17ee('0x61')]){_0x4b913a=as[_0x17ee('0x62')](_0x219db4['query'][_0x17ee('0x61')]);var _0x144bab=_0x4b913a[_0x17ee('0x63')];for(var _0x1d9bc2=0x0;_0x1d9bc2<_0x4b913a['conditions']['length'];_0x1d9bc2++){var _0x3046b0=_0x4b913a[_0x17ee('0x64')][_0x1d9bc2];var _0x4fcb6d='i';var _0x5f316a=_[_0x17ee('0x65')](_0x1614fd,['name',_0x3046b0[_0x17ee('0x4c')]]);if(!_0x5f316a){switch(_0x3046b0['field']){case _0x17ee('0x66'):if(_0x3046b0['value']==0x1){_0x5d2e69[_0x17ee('0x67')]('`'+_0x3046b0[_0x17ee('0x4c')]+_0x17ee('0x68'));}else{_0x5d2e69['having']('`'+_0x3046b0[_0x17ee('0x4c')]+'`\x20>\x200');}break;case'Contact':if(_0x3046b0['operator']===_0x17ee('0x69')){if(_0x3046b0[_0x17ee('0x6a')]['split']('\x20')[_0x17ee('0x46')]>0x1){_0x3d399b[_0x144bab](_0x17ee('0x6b'),qs[_0x17ee('0x6c')](_0x3046b0[_0x17ee('0x6a')]),null);}else{var _0x6f45ec='%'+_0x3046b0['value']+'%';_0x3d399b[_0x144bab](_0x17ee('0x6d'),_0x6f45ec,_0x6f45ec,_0x6f45ec);}}else{_0x5f316a=_[_0x17ee('0x65')](_0x1614fd,['name',_0x17ee('0x6e')]);_0x3046b0['field']=_0x17ee('0x6e');_0x4d67ed=as[_0x17ee('0x6f')](_0x4fcb6d,_0x5f316a['type'],_0x3046b0);_0x3d399b[_0x144bab](_0x4d67ed[_0x17ee('0x70')],_0x4d67ed[_0x17ee('0x6a')][_0x17ee('0x71')],_0x4d67ed[_0x17ee('0x6a')]['end']);}break;case'Tag':var _0x47ca5f=_0x3046b0[_0x17ee('0x6a')]['split'](',')[_0x17ee('0x3a')](function(_0x33572c){return Number(_0x33572c);});_0x47ca5f['forEach'](function(_0x272ec3){_0x153b50['or'](_0x17ee('0x72'),'%,'+_0x272ec3+',%');});_0x3e588a=_[_0x17ee('0x73')](_0x3e588a,_0x47ca5f);break;case'User':if(_0x3046b0[_0x17ee('0x74')]===_0x17ee('0x69')){_0x3d399b[_0x144bab]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3046b0[_0x17ee('0x6a')]+'%',null);}else{_0x5f316a=_[_0x17ee('0x65')](_0x1614fd,[_0x17ee('0x30'),_0x17ee('0x75')]);_0x3046b0[_0x17ee('0x4c')]=_0x17ee('0x75');_0x4d67ed=as['buildExpression'](_0x4fcb6d,_0x5f316a['type'],_0x3046b0);_0x3d399b[_0x144bab](_0x4d67ed[_0x17ee('0x70')],_0x4d67ed['value']['start'],_0x4d67ed[_0x17ee('0x6a')][_0x17ee('0x21')]);}break;case _0x17ee('0x76'):_0x4d67ed=as['buildExpression']('me',null,_0x3046b0);_0x3d399b[_0x144bab](_0x4d67ed['text'],_0x4d67ed[_0x17ee('0x6a')][_0x17ee('0x71')],_0x4d67ed[_0x17ee('0x6a')][_0x17ee('0x21')]);break;}}else{var _0x4d67ed=as['buildExpression'](_0x4fcb6d,_0x5f316a[_0x17ee('0x3e')],_0x3046b0);_0x3d399b[_0x144bab](_0x4d67ed['text'],_0x4d67ed['value'][_0x17ee('0x71')],_0x4d67ed[_0x17ee('0x6a')]['end']);}}}else{var _0x7c0c8e=_(_0x219db4['query'])[_0x17ee('0x77')]()[_0x17ee('0x3a')](function(_0x14921e){return _[_0x17ee('0x78')](_0x1614fd,['name',_0x14921e])?_0x14921e:undefined;})[_0x17ee('0x79')]()[_0x17ee('0x6a')]();if(!_[_0x17ee('0x7a')](_0x7c0c8e)){_0x7c0c8e[_0x17ee('0x36')](function(_0xa490e2){if(_0xa490e2==='WhatsappAccountId'){_0x5d2e69['where'](_0x17ee('0x7b'),[][_0x17ee('0x7c')](_0x219db4[_0x17ee('0x41')][_0xa490e2]));}else if(_0xa490e2===_0x17ee('0x7d')){var _0x38f3ec=JSON[_0x17ee('0x7e')](_0x219db4[_0x17ee('0x41')][_0xa490e2])[_0x17ee('0x7f')];var _0x46a3c1=JSON[_0x17ee('0x7e')](_0x219db4[_0x17ee('0x41')][_0xa490e2])[_0x17ee('0x80')];_0x5d2e69[_0x17ee('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x38f3ec,_0x46a3c1);}else{if(_0x219db4[_0x17ee('0x41')][_0xa490e2]===_0x17ee('0x81')){_0x5d2e69[_0x17ee('0x49')]('i.'+_0xa490e2+'\x20IS\x20NULL');}else{_0x5d2e69['where']('i.'+_0xa490e2+_0x17ee('0x82'),_0x219db4['query'][_0xa490e2]);}}});}if(_0x219db4[_0x17ee('0x41')][_0x17ee('0x83')]){if(_0x219db4[_0x17ee('0x41')][_0x17ee('0x83')]==0x1){_0x5d2e69['having']('`unreadMessages`\x20=\x200');}else{_0x5d2e69[_0x17ee('0x67')](_0x17ee('0x84'));}}if(_0x219db4['query'][_0x17ee('0x85')]){_0x3e588a=_[_0x17ee('0x86')](_0x219db4[_0x17ee('0x41')]['tag'])?_0x219db4[_0x17ee('0x41')]['tag']:new Array(_0x219db4[_0x17ee('0x41')][_0x17ee('0x85')]);_0x3e588a['forEach'](function(_0x5dd9a3){_0x153b50['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5dd9a3+',%');});}if(_0x219db4[_0x17ee('0x41')][_0x17ee('0x87')]){var _0x15f5b4=_0x219db4['query']['filter'][_0x17ee('0x88')]('\x5c','\x5c\x5c')[_0x17ee('0x88')](/'/g,'\x27\x27');if(qs[_0x17ee('0x89')](_0x15f5b4)){_0x3d399b['or'](_0x17ee('0x8a'),_0x15f5b4+'%')['or']('i.phone\x20LIKE\x20?',_0x15f5b4+'%');}else{_0x3d399b['or'](_0x17ee('0x8b'),qs[_0x17ee('0x6c')](_0x15f5b4))['or'](_0x17ee('0x8c'),_0x15f5b4+'%');}}}_0x5d2e69[_0x17ee('0x49')](_0x3d399b);_0x5d2e69[_0x17ee('0x8d')](_0x17ee('0x8e'));var _0x457479={'type':db['Sequelize']['QueryTypes'][_0x17ee('0x8f')],'raw':!![]};var _0x555302=_0x5d2e69['clone']();_0x555302['field']('i.id');_0x555302['field'](_0x17ee('0x90'),_0x17ee('0x66'));if(_0x51e304[_0x17ee('0x91')]){_0x51e304['order']['forEach'](function(_0x416afe){var _0x5e43a6=_0x416afe[0x0]===_0x17ee('0x92')?_0x416afe[0x0]:'i.'+_0x416afe[0x0];_0x5d2e69['order'](_0x5e43a6,_0x416afe[0x1]==='DESC'?![]:!![]);});}if(!_[_0x17ee('0x7a')](_0x3e588a)){_0x5d2e69[_0x17ee('0x67')](_0x153b50);_0x555302[_0x17ee('0x49')]('t.id\x20IN\x20?',_0x3e588a);}BPromise[_0x17ee('0x93')]()[_0x17ee('0x2c')](function(){if(!_0x4b913a){if(_0x219db4[_0x17ee('0x41')][_0x17ee('0x94')])return;_0x555302[_0x17ee('0x49')](_0x17ee('0x95'));_0x5d2e69[_0x17ee('0x49')](_0x17ee('0x95'));return;}if(_0x219db4[_0x17ee('0x96')][_0x17ee('0x97')]!=='agent')return;return _0x219db4[_0x17ee('0x96')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0xf7f178){if(_['isEmpty'](_0xf7f178)){_0x555302[_0x17ee('0x49')]('i.WhatsappAccountId\x20IS\x20NULL');_0x5d2e69[_0x17ee('0x49')](_0x17ee('0x98'));}else{_0x555302[_0x17ee('0x49')](_0x17ee('0x7b'),_[_0x17ee('0x3a')](_0xf7f178,'id'));_0x5d2e69['where'](_0x17ee('0x7b'),_['map'](_0xf7f178,'id'));}});})[_0x17ee('0x2c')](function(){if(_0x219db4[_0x17ee('0x96')][_0x17ee('0x97')]===_0x17ee('0x99')&&!_0x4b913a&&!_0x219db4[_0x17ee('0x41')][_0x17ee('0x94')])return[];return db[_0x17ee('0x9a')][_0x17ee('0x41')](_0x555302['toString'](),_0x457479);})[_0x17ee('0x2c')](function(_0x580e18){_0xe8f55c[_0x17ee('0x26')]=_0x580e18[_0x17ee('0x46')];if(_0xe8f55c[_0x17ee('0x26')]===0x0)return[];return db[_0x17ee('0x9a')]['query'](_0x31e4f1[_0x17ee('0x9b')](),_0x457479)[_0x17ee('0x2c')](function(_0xc049ff){_0xcf486=_[_0x17ee('0x9c')](_0xc049ff,'id');_0x457479=_[_0x17ee('0x9d')](_0x457479,{'model':db[_0x17ee('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x219db4[_0x17ee('0x41')]['fields']){_0x51e304[_0x17ee('0x44')][_0x17ee('0x36')](function(_0x49e8b7){_0x5d2e69[_0x17ee('0x4c')]('i.'+_0x49e8b7);});}else{_0x5d2e69['field'](_0x17ee('0x90'),'unreadMessages');_0x5d2e69[_0x17ee('0x4c')]('a.key',_0x17ee('0x9e'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0x9f'),_0x17ee('0xa0'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa1'),_0x17ee('0x92'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa2'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa3'),_0x17ee('0xa4'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa5'),_0x17ee('0xa6'));_0x5d2e69['field']('c.email','Contact.email');_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa7'),_0x17ee('0xa8'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xa9'),'Contact.mobile');_0x5d2e69['field']('c.fax','Contact.fax');_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xaa'),_0x17ee('0xab'));_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xac'),'Owner.internal');_0x5d2e69[_0x17ee('0x4c')](_0x17ee('0xad'),_0x17ee('0x34'));}if(_0x51e304[_0x17ee('0x24')])_0x5d2e69['limit'](_0x51e304[_0x17ee('0x24')]);if(_0x51e304['offset'])_0x5d2e69[_0x17ee('0x25')](_0x51e304['offset']);return db[_0x17ee('0x9a')]['query'](_0x5d2e69[_0x17ee('0x9b')](),_0x457479);})[_0x17ee('0x2c')](function(_0x1e72d6){if(_0x1e72d6[_0x17ee('0x46')]>0x0)_0x1a8bc5[_0x17ee('0x49')](_0x17ee('0xae'),_['map'](_0x1e72d6,'id'));return db[_0x17ee('0x9a')][_0x17ee('0x41')](_0x1a8bc5[_0x17ee('0x9b')](),_0x457479)[_0x17ee('0x2c')](function(_0x20089b){var _0x399f72=_[_0x17ee('0xaf')](_0x20089b,_0x17ee('0xb0'));var _0xf5177b=[];_0x1e72d6['forEach'](function(_0x6608fa){_0xf5177b[_0x17ee('0x37')](updateWhatsappInteraction(_0x6608fa,_0xcf486,_0x399f72));});return BPromise[_0x17ee('0xb1')](_0xf5177b);});});})['then'](function(_0x18ad73){_0xe8f55c[_0x17ee('0xb2')]=_0x18ad73;return _0xe8f55c;})[_0x17ee('0x2c')](respondWithFilteredResult(_0x466787,_0x51e304))[_0x17ee('0x38')](handleError(_0x466787,null));};exports[_0x17ee('0xb3')]=function(_0x1836ce,_0x304ff5){var _0x2ac69c={'raw':![],'where':{'id':_0x1836ce[_0x17ee('0xb4')]['id']}},_0x1cdf79={};_0x1cdf79[_0x17ee('0x40')]=_[_0x17ee('0x77')](db[_0x17ee('0x3b')][_0x17ee('0x3c')]);_0x1cdf79[_0x17ee('0x41')]=_['keys'](_0x1836ce[_0x17ee('0x41')]);_0x1cdf79['filters']=_[_0x17ee('0x43')](_0x1cdf79[_0x17ee('0x40')],_0x1cdf79['query']);_0x2ac69c['attributes']=_[_0x17ee('0x43')](_0x1cdf79[_0x17ee('0x40')],qs[_0x17ee('0x45')](_0x1836ce[_0x17ee('0x41')][_0x17ee('0x45')]));_0x2ac69c[_0x17ee('0x44')]=_0x2ac69c[_0x17ee('0x44')][_0x17ee('0x46')]?_0x2ac69c[_0x17ee('0x44')]:_0x1cdf79[_0x17ee('0x40')];if(_0x1836ce['query'][_0x17ee('0xb5')]){_0x2ac69c[_0x17ee('0xb6')]=[{'all':!![]}];}_0x2ac69c=_[_0x17ee('0x9d')]({},_0x2ac69c,_0x1836ce['options']);return db[_0x17ee('0x3b')]['find'](_0x2ac69c)[_0x17ee('0x2c')](handleEntityNotFound(_0x304ff5,null))[_0x17ee('0x2c')](respondWithResult(_0x304ff5,null))[_0x17ee('0x38')](handleError(_0x304ff5,null));};exports[_0x17ee('0xb7')]=function(_0x85c590,_0xa6b624){return db[_0x17ee('0x3b')]['create'](_0x85c590[_0x17ee('0x76')],{})[_0x17ee('0x2c')](respondWithResult(_0xa6b624,0xc9))[_0x17ee('0x38')](handleError(_0xa6b624,null));};exports[_0x17ee('0x2b')]=function(_0x34ff0d,_0x393277){if(_0x34ff0d[_0x17ee('0x76')]['id']){delete _0x34ff0d[_0x17ee('0x76')]['id'];}return db[_0x17ee('0x3b')][_0x17ee('0x65')]({'where':{'id':_0x34ff0d[_0x17ee('0xb4')]['id']}})[_0x17ee('0x2c')](handleEntityNotFound(_0x393277,null))[_0x17ee('0x2c')](saveUpdates(_0x34ff0d['body'],null))[_0x17ee('0x2c')](respondWithResult(_0x393277,null))[_0x17ee('0x38')](handleError(_0x393277,null));};exports[_0x17ee('0x2d')]=function(_0x4d8595,_0x4a0b0c){return db['WhatsappInteraction'][_0x17ee('0x65')]({'where':{'id':_0x4d8595[_0x17ee('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4a0b0c,null))['then'](removeEntity(_0x4a0b0c,null))[_0x17ee('0x38')](handleError(_0x4a0b0c,null));};exports[_0x17ee('0xb8')]=function(_0x5ccec3,_0x302b61){return db[_0x17ee('0x3b')][_0x17ee('0xb8')]()['then'](respondWithResult(_0x302b61,null))[_0x17ee('0x38')](handleError(_0x302b61,null));};exports[_0x17ee('0xb9')]=function(_0x36cc83,_0x5f214f,_0x5c1bf3){return db[_0x17ee('0xba')][_0x17ee('0x65')]({'where':{'id':_0x36cc83[_0x17ee('0xb4')]['id']}})[_0x17ee('0x2c')](handleEntityNotFound(_0x5f214f,null))[_0x17ee('0x2c')](function(_0x1a8018){if(_0x1a8018){return _0x1a8018['addMessage'](_0x36cc83[_0x17ee('0x76')][_0x17ee('0xbb')],_['omit'](_0x36cc83['body'],[_0x17ee('0xbb'),'id'])||{});}})[_0x17ee('0x2c')](respondWithResult(_0x5f214f,null))[_0x17ee('0x38')](handleError(_0x5f214f,null));};exports[_0x17ee('0xbc')]=function(_0x2a5199,_0x50f520,_0x572386){var _0x58901d={'raw':![],'where':{}};var _0x30c0de={};var _0x504a27={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x17ee('0xbd')]({'where':{'id':_0x2a5199['params']['id']}})[_0x17ee('0x2c')](handleEntityNotFound(_0x50f520,null))[_0x17ee('0x2c')](function(_0x2298ef){if(_0x2298ef){_0x30c0de[_0x17ee('0x40')]=_['keys'](db[_0x17ee('0xba')][_0x17ee('0x3c')]);_0x30c0de[_0x17ee('0x41')]=_['keys'](_0x2a5199[_0x17ee('0x41')]);_0x30c0de['filters']=_[_0x17ee('0x43')](_0x30c0de[_0x17ee('0x40')],_0x30c0de[_0x17ee('0x41')]);_0x58901d[_0x17ee('0x44')]=_[_0x17ee('0x43')](_0x30c0de[_0x17ee('0x40')],qs[_0x17ee('0x45')](_0x2a5199['query'][_0x17ee('0x45')]));_0x58901d[_0x17ee('0x44')]=_0x58901d[_0x17ee('0x44')][_0x17ee('0x46')]?_0x58901d[_0x17ee('0x44')]:_0x30c0de[_0x17ee('0x40')];if(!_0x2a5199[_0x17ee('0x41')][_0x17ee('0xbe')](_0x17ee('0x47'))){_0x58901d['limit']=qs[_0x17ee('0x24')](_0x2a5199['query']['limit']);_0x58901d[_0x17ee('0x25')]=qs[_0x17ee('0x25')](_0x2a5199[_0x17ee('0x41')][_0x17ee('0x25')]);}_0x58901d['order']=qs[_0x17ee('0x48')](_0x2a5199[_0x17ee('0x41')][_0x17ee('0x48')]);_0x58901d['where']=qs[_0x17ee('0x42')](_[_0x17ee('0x4a')](_0x2a5199['query'],_0x30c0de[_0x17ee('0x42')]));_0x58901d[_0x17ee('0x49')][_0x17ee('0xb0')]=_0x2298ef['id'];if(_0x2a5199['query'][_0x17ee('0x87')]){_0x58901d[_0x17ee('0x49')]=_[_0x17ee('0x9d')](_0x58901d[_0x17ee('0x49')],{'$or':_[_0x17ee('0x3a')](_0x58901d[_0x17ee('0x44')],function(_0x192178){var _0x3f9b13={};_0x3f9b13[_0x192178]={'$like':'%'+_0x2a5199[_0x17ee('0x41')]['filter']+'%'};return _0x3f9b13;})});}if(_0x2a5199[_0x17ee('0x41')][_0x17ee('0x7f')]){var _0x5b1d20=_0x2a5199[_0x17ee('0x41')][_0x17ee('0x7f')]['split'](',');var _0x3e5a95={};_0x3e5a95[_0x5b1d20[0x0]]={'$gte':moment(_0x5b1d20[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x58901d[_0x17ee('0x49')]=_[_0x17ee('0x9d')](_0x58901d[_0x17ee('0x49')],_0x3e5a95);}_0x58901d=_[_0x17ee('0x9d')]({},_0x58901d,_0x2a5199[_0x17ee('0xbf')]);return db[_0x17ee('0xba')][_0x17ee('0x26')]({'where':_0x58901d[_0x17ee('0x49')]})[_0x17ee('0x2c')](function(_0x29c9f1){_0x504a27[_0x17ee('0x26')]=_0x29c9f1;if(_0x2a5199[_0x17ee('0x41')][_0x17ee('0xb5')]){_0x58901d['include']=[{'all':!![]}];}return db[_0x17ee('0xba')][_0x17ee('0xc0')](_0x58901d);})[_0x17ee('0x2c')](function(_0x4c9954){_0x504a27[_0x17ee('0xb2')]=_0x4c9954;return _0x504a27;});}})[_0x17ee('0x2c')](respondWithFilteredResult(_0x50f520,_0x58901d))[_0x17ee('0x38')](handleError(_0x50f520,null));};exports['addTags']=function(_0x546adb,_0x4a468a,_0x56a22a){return db[_0x17ee('0x3b')]['find']({'where':{'id':_0x546adb[_0x17ee('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4a468a,null))['then'](function(_0x4ef8f9){if(_0x4ef8f9){return _0x4ef8f9[_0x17ee('0xc1')](_0x546adb['body'][_0x17ee('0xbb')],_['omit'](_0x546adb[_0x17ee('0x76')],['ids','id'])||{})['spread'](function(){return db[_0x17ee('0xc2')][_0x17ee('0xc0')]({'attributes':['id',_0x17ee('0x30'),_0x17ee('0x4d')],'where':{'id':_0x546adb['body'][_0x17ee('0xbb')]}});})[_0x17ee('0x2c')](function(_0x2c6b84){socket[_0x17ee('0xc3')](_0x17ee('0xc4'),{'id':Number(_0x546adb[_0x17ee('0xb4')]['id']),'tags':_0x2c6b84||[]});return{'id':Number(_0x546adb[_0x17ee('0xb4')]['id']),'tags':_0x2c6b84||[]};});}})['then'](respondWithResult(_0x4a468a,null))[_0x17ee('0x38')](handleError(_0x4a468a,null));};exports[_0x17ee('0xc5')]=function(_0x2795b1,_0xb1af47,_0x5030c1){return db[_0x17ee('0x3b')]['find']({'where':{'id':_0x2795b1['params']['id']}})[_0x17ee('0x2c')](handleEntityNotFound(_0xb1af47,null))[_0x17ee('0x2c')](function(_0x5b033e){if(_0x5b033e){return _0x5b033e[_0x17ee('0xc5')](_0x2795b1[_0x17ee('0x41')][_0x17ee('0xbb')]);}})[_0x17ee('0x2c')](respondWithStatusCode(_0xb1af47,null))[_0x17ee('0x38')](handleError(_0xb1af47,null));};exports[_0x17ee('0xc6')]=function(_0xe8b45c,_0x3111b5){var _0x42e8a0=moment()[_0x17ee('0xc7')]()[_0x17ee('0x9b')]();var _0x49b745=path['join'](config[_0x17ee('0xc8')],_0x17ee('0xc9'),'files','tmp');var _0x3d379b=path[_0x17ee('0xca')](config['root'],'server',_0x17ee('0xcb'),_0x17ee('0xcc'));var _0xecdd2=path[_0x17ee('0xca')](_0x49b745,_0x42e8a0);var _0x111584=util[_0x17ee('0xcd')](_0x17ee('0xce'),_0xe8b45c['params']['id'],_0x42e8a0);var _0x4acaeb=path[_0x17ee('0xca')](_0x49b745,_0x111584);var _0x12a32f=[];_0x12a32f[_0x17ee('0x37')]({'model':db[_0x17ee('0xcf')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x12a32f[_0x17ee('0x37')]({'model':db[_0x17ee('0xd0')],'as':'Contact','attributes':['id','firstName',_0x17ee('0xd1')],'raw':!![]});if(_0xe8b45c['query'][_0x17ee('0xcc')]){_0x12a32f[_0x17ee('0x37')]({'model':db[_0x17ee('0xd2')],'as':'Attachment','raw':!![]});}var _0x5174a9=[{'model':db['WhatsappMessage'],'as':_0x17ee('0xd3'),'attributes':['id',_0x17ee('0x76'),_0x17ee('0x7d'),'direction',_0x17ee('0xd4'),'read'],'include':_0x12a32f}];_0x5174a9[_0x17ee('0x37')]({'model':db[_0x17ee('0xd5')],'as':_0x17ee('0xd6'),'attributes':['id','name']});_0x5174a9[_0x17ee('0x37')]({'model':db[_0x17ee('0xcf')],'as':'Owner','attributes':['id','fullname']});return db[_0x17ee('0x3b')][_0x17ee('0x65')]({'where':{'id':_0xe8b45c[_0x17ee('0xb4')]['id']},'include':_0x5174a9})['then'](handleEntityNotFound(_0x3111b5,null))[_0x17ee('0x2c')](function(_0x3125af){if(_0x3125af){var _0x476053=_0x3125af[_0x17ee('0xd7')]({'plain':!![]});fs[_0x17ee('0xd8')](_0xecdd2);var _0x327e12={'channel':_0x17ee('0xd9'),'account':_0x476053['Account'][_0x17ee('0x30')],'agent':_0x476053[_0x17ee('0xda')]?_0x476053[_0x17ee('0xda')][_0x17ee('0xdb')]:_0x17ee('0xdc'),'createdAt':moment(_0x476053[_0x17ee('0x7d')])[_0x17ee('0xcd')](_0x17ee('0xdd'))[_0x17ee('0x9b')](),'closedAt':_0x476053[_0x17ee('0xde')]?moment(_0x476053[_0x17ee('0xdf')])[_0x17ee('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x17ee('0x9b')]():'','disposition':_0x476053[_0x17ee('0xe0')],'messages':_(_0x476053['Messages'])[_0x17ee('0x87')]({'secret':![]})[_0x17ee('0x3a')](function(_0x433074){if(_0x433074['Attachment']){var _0x424174=path['join'](_0x3d379b,_0x433074[_0x17ee('0xd2')]['basename']);if(fs[_0x17ee('0xe1')](_0x424174)){fs['createReadStream'](_0x424174)[_0x17ee('0xe2')](fs['createWriteStream'](path[_0x17ee('0xca')](_0xecdd2,_0x433074['Attachment']['basename'])));}}return{'date':moment(_0x433074[_0x17ee('0x7d')])[_0x17ee('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x433074['direction']===_0x17ee('0xe3')?_0x433074[_0x17ee('0xcf')]?_0x433074['User'][_0x17ee('0xdb')]:_0x17ee('0xe4'):_0x433074[_0x17ee('0xe5')][_0x17ee('0xe6')]+(_0x433074['Contact']['lastName']?'\x20'+_0x433074[_0x17ee('0xe5')]['lastName']:''),'body':_0x433074[_0x17ee('0xd2')]?_0x433074['Attachment']['basename']:_0x433074[_0x17ee('0x76')],'direction':_0x433074[_0x17ee('0xe7')]==='out'?'A':'C','secret':_0x433074[_0x17ee('0xd4')],'read':_0x433074[_0x17ee('0x83')],'attachment':_0x433074[_0x17ee('0xd2')]};})[_0x17ee('0x6a')]()};return ejs['renderFile'](path[_0x17ee('0xca')](config['root'],_0x17ee('0xc9'),_0x17ee('0xe8'),'downloadInteraction.ejs'),{'interaction':_0x327e12})['then'](function(_0x43d33b){var _0x46f382=path['join'](_0xecdd2,_0x17ee('0xe9')+_0x476053['id']+'-'+_0x42e8a0+_0x17ee('0xea'));var _0x53c0ff={'path':_0x46f382,'channel':'Whatsapp','interactionId':_0x476053['id']};return pdf[_0x17ee('0xeb')](_0x43d33b,_0x53c0ff);})[_0x17ee('0x2c')](function(){return new BPromise(function(_0x5277d9,_0x2d2ebe){zipdir(_0xecdd2,{'saveTo':_0x4acaeb},function(_0x2d6f75,_0x24a917){if(_0x2d6f75)return _0x2d2ebe(_0x2d6f75);return _0x5277d9(_0x24a917);});})[_0x17ee('0x2c')](function(){return new BPromise(function(_0x4c4d18,_0x3b59c8){rimraf(_0xecdd2,function(_0x564871){if(_0x564871)_0x3b59c8(_0x564871);return _0x4c4d18();});});})[_0x17ee('0x2c')](function(){return _0x3111b5[_0x17ee('0xc6')](_0x4acaeb,_0x111584,function(_0x6e8e96){if(_0x6e8e96){console[_0x17ee('0xec')](_0x17ee('0xed'),_0x6e8e96);}else{fs[_0x17ee('0xee')](_0x4acaeb);}});});});}else{return _0x3111b5[_0x17ee('0x1f')](0xc8);}})[_0x17ee('0x38')](handleError(_0x3111b5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 04919de..60df650 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 _0xf9bc=['WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hook','../../mysqldb','WhatsappInteraction'];(function(_0x4b119e,_0x19233f){var _0xcc403b=function(_0x3a11a0){while(--_0x3a11a0){_0x4b119e['push'](_0x4b119e['shift']());}};_0xcc403b(++_0x19233f);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x371335,_0x5823aa){_0x371335=_0x371335-0x0;var _0x579db5=_0xf9bc[_0x371335];return _0x579db5;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xcf9b('0x0'))['db'][_0xcf9b('0x1')];var WhatsappMessage=require(_0xcf9b('0x0'))['db'][_0xcf9b('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xcf9b('0x3')](0x0);var events={'afterCreate':_0xcf9b('0x4'),'afterUpdate':_0xcf9b('0x5'),'afterDestroy':_0xcf9b('0x6')};function emitEvent(_0x6d522){return function(_0x1d5164,_0x4a50fa,_0x48a202){_0x1d5164[_0xcf9b('0x7')]({'attributes':['id'],'raw':!![]})[_0xcf9b('0x8')](function(_0xbf765c){_0x1d5164[_0xcf9b('0x9')](_0xcf9b('0xa'),_0xbf765c[_0xcf9b('0xb')](function(_0x182df7){return{'id':_0x182df7['id']};}));return WhatsappMessage[_0xcf9b('0xc')]({'where':{'WhatsappInteractionId':_0x1d5164['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcf9b('0x8')](function(_0x5aec9b){_0x1d5164[_0xcf9b('0x9')](_0xcf9b('0xd'),_0x5aec9b['length']);WhatsappInteractionEvents[_0xcf9b('0xe')](_0x6d522+':'+_0x1d5164['id'],_0x1d5164);WhatsappInteractionEvents['emit'](_0x6d522,_0x1d5164);_0x48a202(null);})['catch'](_0x48a202(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xcf9b('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xa788=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x516e3c,_0x589b74){var _0x14d474=function(_0x1d6ab5){while(--_0x1d6ab5){_0x516e3c['push'](_0x516e3c['shift']());}};_0x14d474(++_0x589b74);}(_0xa788,0x70));var _0x8a78=function(_0x32c473,_0x3ac5aa){_0x32c473=_0x32c473-0x0;var _0x3a7b40=_0xa788[_0x32c473];return _0x3a7b40;};'use strict';var EventEmitter=require(_0x8a78('0x0'));var WhatsappInteraction=require(_0x8a78('0x1'))['db'][_0x8a78('0x2')];var WhatsappMessage=require(_0x8a78('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8a78('0x3')](0x0);var events={'afterCreate':_0x8a78('0x4'),'afterUpdate':'update','afterDestroy':_0x8a78('0x5')};function emitEvent(_0x12ce72){return function(_0x5af5af,_0x47be20,_0x506edf){_0x5af5af[_0x8a78('0x6')]({'attributes':['id'],'raw':!![]})[_0x8a78('0x7')](function(_0x539774){_0x5af5af['setDataValue'](_0x8a78('0x8'),_0x539774['map'](function(_0x5e655c){return{'id':_0x5e655c['id']};}));return WhatsappMessage[_0x8a78('0x9')]({'where':{'WhatsappInteractionId':_0x5af5af['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8a78('0x7')](function(_0x4e2918){_0x5af5af[_0x8a78('0xa')](_0x8a78('0xb'),_0x4e2918[_0x8a78('0xc')]);WhatsappInteractionEvents[_0x8a78('0xd')](_0x12ce72+':'+_0x5af5af['id'],_0x5af5af);WhatsappInteractionEvents[_0x8a78('0xd')](_0x12ce72,_0x5af5af);_0x506edf(null);})[_0x8a78('0xe')](_0x506edf(null));};}for(var e in events){if(events[_0x8a78('0xf')](e)){var event=events[e];WhatsappInteraction[_0x8a78('0x10')](e,emitEvent(event));}}module[_0x8a78('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index dc1d304..9811324 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 _0x2d7b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x5c7e53,_0x174ce5){var _0x1c9af9=function(_0x38895d){while(--_0x38895d){_0x5c7e53['push'](_0x5c7e53['shift']());}};_0x1c9af9(++_0x174ce5);}(_0x2d7b,0x1ee));var _0xb2d7=function(_0x525f1f,_0x5e9a5f){_0x525f1f=_0x525f1f-0x0;var _0x1c4ad1=_0x2d7b[_0x525f1f];return _0x1c4ad1;};'use strict';var _=require(_0xb2d7('0x0'));var util=require('util');var logger=require(_0xb2d7('0x1'))(_0xb2d7('0x2'));var moment=require(_0xb2d7('0x3'));var BPromise=require(_0xb2d7('0x4'));var rp=require(_0xb2d7('0x5'));var fs=require('fs');var path=require(_0xb2d7('0x6'));var rimraf=require(_0xb2d7('0x7'));var config=require(_0xb2d7('0x8'));var attributes=require(_0xb2d7('0x9'));module[_0xb2d7('0xa')]=function(_0x1daaac,_0x137b0f){return _0x1daaac[_0xb2d7('0xb')](_0xb2d7('0xc'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xdd5daf,_0x3b7c9a,_0x5ec9f9){if(_0xdd5daf['changed']('closed')){_0xdd5daf[_0xb2d7('0xd')]=moment()[_0xb2d7('0xe')](_0xb2d7('0xf'));}_0x5ec9f9(null,_0xdd5daf);}}});}; \ No newline at end of file +var _0xc8f7=['./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xf26f0d,_0x1671e9){var _0x2ab3c4=function(_0x172fe0){while(--_0x172fe0){_0xf26f0d['push'](_0xf26f0d['shift']());}};_0x2ab3c4(++_0x1671e9);}(_0xc8f7,0x99));var _0x7c8f=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0xc8f7[_0x5cbd7b];return _0x3fdfb8;};'use strict';var _=require(_0x7c8f('0x0'));var util=require(_0x7c8f('0x1'));var logger=require(_0x7c8f('0x2'))(_0x7c8f('0x3'));var moment=require(_0x7c8f('0x4'));var BPromise=require('bluebird');var rp=require(_0x7c8f('0x5'));var fs=require('fs');var path=require(_0x7c8f('0x6'));var rimraf=require(_0x7c8f('0x7'));var config=require(_0x7c8f('0x8'));var attributes=require(_0x7c8f('0x9'));module['exports']=function(_0x5c917e,_0x48dc49){return _0x5c917e[_0x7c8f('0xa')](_0x7c8f('0xb'),attributes,{'tableName':_0x7c8f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4fb01c,_0x43952f,_0x22c377){if(_0x4fb01c[_0x7c8f('0xd')](_0x7c8f('0xe'))){_0x4fb01c[_0x7c8f('0xf')]=moment()[_0x7c8f('0x10')](_0x7c8f('0x11'));}_0x22c377(null,_0x4fb01c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index a2a9bba..04bc9e9 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 _0xcde6=['message','info','result','catch','UpdateWhatsappInteraction','update','body','options','raw','attributes','debug','AddTagsToWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s'];(function(_0x592933,_0x389583){var _0x262483=function(_0x2b8f7c){while(--_0x2b8f7c){_0x592933['push'](_0x592933['shift']());}};_0x262483(++_0x389583);}(_0xcde6,0x9a));var _0x6cde=function(_0x38f200,_0x408dea){_0x38f200=_0x38f200-0x0;var _0x3c6770=_0xcde6[_0x38f200];return _0x3c6770;};'use strict';var _=require(_0x6cde('0x0'));var util=require(_0x6cde('0x1'));var moment=require(_0x6cde('0x2'));var BPromise=require(_0x6cde('0x3'));var rs=require(_0x6cde('0x4'));var fs=require('fs');var Redis=require(_0x6cde('0x5'));var db=require(_0x6cde('0x6'))['db'];var utils=require(_0x6cde('0x7'));var logger=require(_0x6cde('0x8'))(_0x6cde('0x9'));var config=require(_0x6cde('0xa'));var jayson=require(_0x6cde('0xb'));var client=jayson[_0x6cde('0xc')]['http']({'port':0x232a});config[_0x6cde('0xd')]=_['defaults'](config[_0x6cde('0xd')],{'host':_0x6cde('0xe'),'port':0x18eb});var socket=require(_0x6cde('0xf'))(new Redis(config[_0x6cde('0xd')]));require(_0x6cde('0x10'))[_0x6cde('0x11')](socket);function respondWithRpcPromise(_0x229c66,_0xb4f4b,_0x5eaaca){return new BPromise(function(_0x26b676,_0x192a86){return client[_0x6cde('0x12')](_0x229c66,_0x5eaaca)[_0x6cde('0x13')](function(_0x293258){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0xb4f4b,_0x6cde('0x14'));logger['debug'](_0x6cde('0x15'),_0xb4f4b,_0x6cde('0x14'),JSON[_0x6cde('0x16')](_0x293258));if(_0x293258['error']){if(_0x293258[_0x6cde('0x17')][_0x6cde('0x18')]===0x1f4){logger[_0x6cde('0x17')](_0x6cde('0x19'),_0xb4f4b,_0x293258['error']['message']);return _0x192a86(_0x293258['error']['message']);}logger[_0x6cde('0x17')](_0x6cde('0x19'),_0xb4f4b,_0x293258[_0x6cde('0x17')][_0x6cde('0x1a')]);return _0x26b676(_0x293258[_0x6cde('0x17')][_0x6cde('0x1a')]);}else{logger[_0x6cde('0x1b')](_0x6cde('0x19'),_0xb4f4b,'request\x20sent');_0x26b676(_0x293258[_0x6cde('0x1c')][_0x6cde('0x1a')]);}})[_0x6cde('0x1d')](function(_0x40cbc1){logger['error'](_0x6cde('0x19'),_0xb4f4b,_0x40cbc1);_0x192a86(_0x40cbc1);});});}exports[_0x6cde('0x1e')]=function(_0x2e9236){var _0x3a64cb=this;return new Promise(function(_0x250f6f,_0x21f299){return db['WhatsappInteraction'][_0x6cde('0x1f')](_0x2e9236[_0x6cde('0x20')],{'raw':_0x2e9236[_0x6cde('0x21')]?_0x2e9236[_0x6cde('0x21')][_0x6cde('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9236['options']?_0x2e9236[_0x6cde('0x21')]['where']||null:null,'attributes':_0x2e9236[_0x6cde('0x21')]?_0x2e9236['options'][_0x6cde('0x23')]||null:null,'limit':_0x2e9236[_0x6cde('0x21')]?_0x2e9236[_0x6cde('0x21')]['limit']||null:null})[_0x6cde('0x13')](function(_0x1527e5){logger['info'](_0x6cde('0x1e'),_0x2e9236);logger[_0x6cde('0x24')](_0x6cde('0x1e'),_0x2e9236,JSON['stringify'](_0x1527e5));_0x250f6f(_0x1527e5);})[_0x6cde('0x1d')](function(_0x43d4dc){logger[_0x6cde('0x17')](_0x6cde('0x1e'),_0x43d4dc[_0x6cde('0x1a')],_0x2e9236);_0x21f299(_0x3a64cb[_0x6cde('0x17')](0x1f4,_0x43d4dc[_0x6cde('0x1a')]));});});};exports[_0x6cde('0x25')]=function(_0x2f1812){return new Promise(function(_0x1e4385,_0xb14eae){return db['WhatsappInteraction'][_0x6cde('0x26')]({'where':_0x2f1812[_0x6cde('0x21')]?_0x2f1812[_0x6cde('0x21')][_0x6cde('0x27')]||null:null})[_0x6cde('0x13')](function(_0x2abb9c){if(_0x2abb9c){return _0x2abb9c[_0x6cde('0x28')](_0x2f1812[_0x6cde('0x20')][_0x6cde('0x29')],_[_0x6cde('0x2a')](_0x2f1812[_0x6cde('0x20')],[_0x6cde('0x29'),'id'])||{});}})[_0x6cde('0x2b')](function(_0x385862){logger[_0x6cde('0x1b')](_0x6cde('0x2c'),_0x2f1812);logger['debug'](_0x6cde('0x2c'),_0x2f1812,JSON['stringify'](_0x385862));_0x1e4385(_0x385862);})[_0x6cde('0x1d')](function(_0x2562ed){logger[_0x6cde('0x17')](_0x6cde('0x2c'),_0x2562ed['message'],_0x2f1812);_0xb14eae(_this[_0x6cde('0x17')](0x1f4,_0x2562ed[_0x6cde('0x1a')]));});});}; \ No newline at end of file +var _0x90c8=['options','raw','where','attributes','limit','debug','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x90c8,0x69));var _0x890c=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x90c8[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0x890c('0x0'));var util=require(_0x890c('0x1'));var moment=require(_0x890c('0x2'));var BPromise=require(_0x890c('0x3'));var rs=require(_0x890c('0x4'));var fs=require('fs');var Redis=require(_0x890c('0x5'));var db=require(_0x890c('0x6'))['db'];var utils=require(_0x890c('0x7'));var logger=require(_0x890c('0x8'))(_0x890c('0x9'));var config=require(_0x890c('0xa'));var jayson=require(_0x890c('0xb'));var client=jayson['client'][_0x890c('0xc')]({'port':0x232a});config[_0x890c('0xd')]=_[_0x890c('0xe')](config[_0x890c('0xd')],{'host':_0x890c('0xf'),'port':0x18eb});var socket=require(_0x890c('0x10'))(new Redis(config[_0x890c('0xd')]));require(_0x890c('0x11'))[_0x890c('0x12')](socket);function respondWithRpcPromise(_0x322640,_0x571455,_0x530779){return new BPromise(function(_0x793d04,_0x7f638e){return client[_0x890c('0x13')](_0x322640,_0x530779)[_0x890c('0x14')](function(_0x3bbcc8){logger[_0x890c('0x15')](_0x890c('0x16'),_0x571455,_0x890c('0x17'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x571455,_0x890c('0x17'),JSON[_0x890c('0x18')](_0x3bbcc8));if(_0x3bbcc8[_0x890c('0x19')]){if(_0x3bbcc8[_0x890c('0x19')][_0x890c('0x1a')]===0x1f4){logger[_0x890c('0x19')](_0x890c('0x16'),_0x571455,_0x3bbcc8[_0x890c('0x19')][_0x890c('0x1b')]);return _0x7f638e(_0x3bbcc8[_0x890c('0x19')][_0x890c('0x1b')]);}logger[_0x890c('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x571455,_0x3bbcc8['error'][_0x890c('0x1b')]);return _0x793d04(_0x3bbcc8['error']['message']);}else{logger[_0x890c('0x15')](_0x890c('0x16'),_0x571455,_0x890c('0x17'));_0x793d04(_0x3bbcc8[_0x890c('0x1c')][_0x890c('0x1b')]);}})[_0x890c('0x1d')](function(_0x52966b){logger[_0x890c('0x19')](_0x890c('0x16'),_0x571455,_0x52966b);_0x7f638e(_0x52966b);});});}exports[_0x890c('0x1e')]=function(_0x293703){var _0x363424=this;return new Promise(function(_0x488211,_0x3c38b7){return db[_0x890c('0x1f')][_0x890c('0x20')](_0x293703['body'],{'raw':_0x293703[_0x890c('0x21')]?_0x293703[_0x890c('0x21')][_0x890c('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x293703['options']?_0x293703['options'][_0x890c('0x23')]||null:null,'attributes':_0x293703['options']?_0x293703[_0x890c('0x21')][_0x890c('0x24')]||null:null,'limit':_0x293703[_0x890c('0x21')]?_0x293703[_0x890c('0x21')][_0x890c('0x25')]||null:null})[_0x890c('0x14')](function(_0x249c79){logger[_0x890c('0x15')](_0x890c('0x1e'),_0x293703);logger[_0x890c('0x26')](_0x890c('0x1e'),_0x293703,JSON[_0x890c('0x18')](_0x249c79));_0x488211(_0x249c79);})[_0x890c('0x1d')](function(_0x4d803c){logger[_0x890c('0x19')]('UpdateWhatsappInteraction',_0x4d803c[_0x890c('0x1b')],_0x293703);_0x3c38b7(_0x363424['error'](0x1f4,_0x4d803c[_0x890c('0x1b')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x112271){return new Promise(function(_0x5e049f,_0xcf5276){return db[_0x890c('0x1f')][_0x890c('0x27')]({'where':_0x112271[_0x890c('0x21')]?_0x112271[_0x890c('0x21')][_0x890c('0x23')]||null:null})[_0x890c('0x14')](function(_0x313db0){if(_0x313db0){return _0x313db0[_0x890c('0x28')](_0x112271[_0x890c('0x29')][_0x890c('0x2a')],_[_0x890c('0x2b')](_0x112271['body'],[_0x890c('0x2a'),'id'])||{});}})[_0x890c('0x2c')](function(_0x11ffdc){logger[_0x890c('0x15')]('AddTags',_0x112271);logger[_0x890c('0x26')](_0x890c('0x2d'),_0x112271,JSON[_0x890c('0x18')](_0x11ffdc));_0x5e049f(_0x11ffdc);})['catch'](function(_0x299440){logger[_0x890c('0x19')]('AddTags',_0x299440[_0x890c('0x1b')],_0x112271);_0xcf5276(_this[_0x890c('0x19')](0x1f4,_0x299440[_0x890c('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 9aeb459..32898dd 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 _0xd2ee=['save','update','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x12ff4c,_0xd992d6){var _0x27cbc7=function(_0x465b07){while(--_0x465b07){_0x12ff4c['push'](_0x12ff4c['shift']());}};_0x27cbc7(++_0xd992d6);}(_0xd2ee,0x191));var _0xed2e=function(_0x5acf6b,_0x35364b){_0x5acf6b=_0x5acf6b-0x0;var _0x595b92=_0xd2ee[_0x5acf6b];return _0x595b92;};'use strict';var WhatsappInteractionEvents=require(_0xed2e('0x0'));var events=[_0xed2e('0x1'),'remove',_0xed2e('0x2')];function createListener(_0x4eaf0c,_0x55ee8d){return function(_0x2c61ee){_0x55ee8d['emit'](_0x4eaf0c,_0x2c61ee);};}function removeListener(_0x1e48b4,_0x1acfd0){return function(){WhatsappInteractionEvents['removeListener'](_0x1e48b4,_0x1acfd0);};}exports[_0xed2e('0x3')]=function(_0x241356){for(var _0x37f793=0x0,_0x4aa658=events[_0xed2e('0x4')];_0x37f793<_0x4aa658;_0x37f793++){var _0x316b70=events[_0x37f793];var _0x533936=createListener(_0xed2e('0x5')+_0x316b70,_0x241356);WhatsappInteractionEvents['on'](_0x316b70,_0x533936);}}; \ No newline at end of file +var _0x53ad=['register','length','whatsappInteraction:','save','remove','emit','removeListener'];(function(_0x10e5f5,_0x37574d){var _0x42a98b=function(_0x580a92){while(--_0x580a92){_0x10e5f5['push'](_0x10e5f5['shift']());}};_0x42a98b(++_0x37574d);}(_0x53ad,0x13e));var _0xd53a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x53ad[_0x397e5f];return _0x5302b8;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xd53a('0x0'),_0xd53a('0x1'),'update'];function createListener(_0x5d456e,_0x164399){return function(_0x117002){_0x164399[_0xd53a('0x2')](_0x5d456e,_0x117002);};}function removeListener(_0x1debc9,_0x43d2bf){return function(){WhatsappInteractionEvents[_0xd53a('0x3')](_0x1debc9,_0x43d2bf);};}exports[_0xd53a('0x4')]=function(_0x205e78){for(var _0x166edd=0x0,_0x3b0e74=events[_0xd53a('0x5')];_0x166edd<_0x3b0e74;_0x166edd++){var _0x5a011e=events[_0x166edd];var _0x19a746=createListener(_0xd53a('0x6')+_0x5a011e,_0x205e78);WhatsappInteractionEvents['on'](_0x5a011e,_0x19a746);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index e6097eb..d81287b 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 _0x44f0=['../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','show','create','post','/:id/status','status','put','/:id','update','/:id/accept','/:id/reject','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4a0dae,_0x5b4fbf){var _0x57a9b0=function(_0x19b097){while(--_0x19b097){_0x4a0dae['push'](_0x4a0dae['shift']());}};_0x57a9b0(++_0x5b4fbf);}(_0x44f0,0x192));var _0x044f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x44f0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x044f('0x0'));var util=require(_0x044f('0x1'));var path=require('path');var timeout=require(_0x044f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x044f('0x3'));var auth=require(_0x044f('0x4'));var interaction=require(_0x044f('0x5'));var config=require(_0x044f('0x6'));var controller=require(_0x044f('0x7'));router[_0x044f('0x8')]('/',auth[_0x044f('0x9')](),controller[_0x044f('0xa')]);router[_0x044f('0x8')](_0x044f('0xb'),auth[_0x044f('0x9')](),controller['describe']);router[_0x044f('0x8')]('/:id',auth[_0x044f('0x9')](),controller[_0x044f('0xc')]);router['post']('/',auth[_0x044f('0x9')](),interaction['tracked']('whatsapp','whatsappmessage:create'),controller[_0x044f('0xd')]);router[_0x044f('0xe')](_0x044f('0xf'),controller[_0x044f('0x10')]);router[_0x044f('0x11')](_0x044f('0x12'),auth[_0x044f('0x9')](),controller[_0x044f('0x13')]);router[_0x044f('0x11')](_0x044f('0x14'),auth[_0x044f('0x9')](),controller['accept']);router[_0x044f('0x11')](_0x044f('0x15'),auth[_0x044f('0x9')](),controller['reject']);router['delete'](_0x044f('0x12'),auth['isAuthenticated'](),controller[_0x044f('0x16')]);module[_0x044f('0x17')]=router; \ No newline at end of file +var _0xd238=['create','update','put','/:id/reject','reject','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','whatsapp','whatsappmessage:create'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xd238,0xa8));var _0x8d23=function(_0x247f1a,_0xb1d3a0){_0x247f1a=_0x247f1a-0x0;var _0xa5ed2=_0xd238[_0x247f1a];return _0xa5ed2;};'use strict';var multer=require(_0x8d23('0x0'));var util=require(_0x8d23('0x1'));var path=require('path');var timeout=require(_0x8d23('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8d23('0x3'));var auth=require(_0x8d23('0x4'));var interaction=require(_0x8d23('0x5'));var config=require(_0x8d23('0x6'));var controller=require(_0x8d23('0x7'));router[_0x8d23('0x8')]('/',auth[_0x8d23('0x9')](),controller['index']);router[_0x8d23('0x8')](_0x8d23('0xa'),auth[_0x8d23('0x9')](),controller[_0x8d23('0xb')]);router[_0x8d23('0x8')](_0x8d23('0xc'),auth['isAuthenticated'](),controller[_0x8d23('0xd')]);router['post']('/',auth[_0x8d23('0x9')](),interaction['tracked'](_0x8d23('0xe'),_0x8d23('0xf')),controller[_0x8d23('0x10')]);router['post']('/:id/status',controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8d23('0x11')]);router[_0x8d23('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x8d23('0x12')](_0x8d23('0x13'),auth[_0x8d23('0x9')](),controller[_0x8d23('0x14')]);router[_0x8d23('0x15')](_0x8d23('0xc'),auth[_0x8d23('0x9')](),controller['destroy']);module[_0x8d23('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index ae52267..caccabc 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 _0x5c71=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x53b47f,_0x245d21){var _0x23ded8=function(_0x2c6db3){while(--_0x2c6db3){_0x53b47f['push'](_0x53b47f['shift']());}};_0x23ded8(++_0x245d21);}(_0x5c71,0x1e5));var _0x15c7=function(_0x2b400c,_0x3eb1b0){_0x2b400c=_0x2b400c-0x0;var _0x3ec13b=_0x5c71[_0x2b400c];return _0x3ec13b;};'use strict';var Sequelize=require(_0x15c7('0x0'));module[_0x15c7('0x1')]={'body':{'type':Sequelize[_0x15c7('0x2')](_0x15c7('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x15c7('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x15c7('0x5')]('in',_0x15c7('0x6')),'defaultValue':_0x15c7('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x15c7('0x7')](0xbe)},'phone':{'type':Sequelize[_0x15c7('0x7')]},'readAt':{'type':Sequelize[_0x15c7('0x8')]},'secret':{'type':Sequelize[_0x15c7('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x15c7('0x7')]},'providerResponse':{'type':Sequelize[_0x15c7('0x2')]}}; \ No newline at end of file +var _0x793c=['medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT'];(function(_0x5d60d1,_0x325ad0){var _0x5e94a7=function(_0x40fb9c){while(--_0x40fb9c){_0x5d60d1['push'](_0x5d60d1['shift']());}};_0x5e94a7(++_0x325ad0);}(_0x793c,0x99));var _0xc793=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x793c[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xc793('0x0')](_0xc793('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc793('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc793('0x3')]('in',_0xc793('0x4')),'defaultValue':_0xc793('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc793('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xc793('0x6')]},'secret':{'type':Sequelize[_0xc793('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc793('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 655a25c..2c470d5 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 _0x0d91=['../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','sendStatus','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','show','params','include','find','body','destroy','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','sequelize','Sequelize','contact','User','fullname','email','manual','channel','event','EventManager','acceptmessage','whatsapp','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','internal','interface','SIP/%s','reject','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x0d91,0x76));var _0x10d9=function(_0x30edd9,_0x3a66f8){_0x30edd9=_0x30edd9-0x0;var _0x35a7ee=_0x0d91[_0x30edd9];return _0x35a7ee;};'use strict';var emlformat=require(_0x10d9('0x0'));var rimraf=require(_0x10d9('0x1'));var zipdir=require(_0x10d9('0x2'));var jsonpatch=require(_0x10d9('0x3'));var rp=require('request-promise');var moment=require(_0x10d9('0x4'));var BPromise=require(_0x10d9('0x5'));var Mustache=require(_0x10d9('0x6'));var util=require('util');var path=require(_0x10d9('0x7'));var sox=require(_0x10d9('0x8'));var csv=require(_0x10d9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10d9('0xa'));var _=require(_0x10d9('0xb'));var squel=require(_0x10d9('0xc'));var crypto=require(_0x10d9('0xd'));var jsforce=require(_0x10d9('0xe'));var deskjs=require(_0x10d9('0xf'));var toCsv=require(_0x10d9('0x9'));var querystring=require(_0x10d9('0x10'));var Papa=require(_0x10d9('0x11'));var Redis=require(_0x10d9('0x12'));var authService=require(_0x10d9('0x13'));var qs=require(_0x10d9('0x14'));var as=require(_0x10d9('0x15'));var hardwareService=require(_0x10d9('0x16'));var logger=require(_0x10d9('0x17'))(_0x10d9('0x18'));var utils=require(_0x10d9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x10d9('0x1a'));var db=require(_0x10d9('0x1b'))['db'];config[_0x10d9('0x1c')]=_[_0x10d9('0x1d')](config[_0x10d9('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x10d9('0x1e'))(new Redis(config['redis']));require(_0x10d9('0x1f'))[_0x10d9('0x20')](socket);var jayson=require(_0x10d9('0x21'));var client=jayson[_0x10d9('0x22')][_0x10d9('0x23')]({'port':0x232c});var client9002=jayson[_0x10d9('0x22')][_0x10d9('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2a6587,_0x453d22,_0xb5d3ec,_0x4c6792){return new BPromise(function(_0x5658b5,_0x379754){var _0x21b1ac=_0x4c6792||client;return _0x21b1ac[_0x10d9('0x24')](_0x2a6587,_0xb5d3ec)[_0x10d9('0x25')](function(_0x4fdea6){logger[_0x10d9('0x26')](_0x10d9('0x27'),_0x453d22,_0x10d9('0x28'));logger[_0x10d9('0x29')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x453d22,_0x10d9('0x28'),JSON[_0x10d9('0x2a')](_0x4fdea6));if(_0x4fdea6['error']){if(_0x4fdea6['error'][_0x10d9('0x2b')]===0x1f4){logger['error'](_0x10d9('0x27'),_0x453d22,_0x4fdea6[_0x10d9('0x2c')]['message']);return _0x379754(_0x4fdea6[_0x10d9('0x2c')][_0x10d9('0x2d')]);}logger[_0x10d9('0x2c')](_0x10d9('0x27'),_0x453d22,_0x4fdea6[_0x10d9('0x2c')][_0x10d9('0x2d')]);return _0x5658b5(_0x4fdea6[_0x10d9('0x2c')][_0x10d9('0x2d')]);}else{logger[_0x10d9('0x26')](_0x10d9('0x27'),_0x453d22,_0x10d9('0x28'));_0x5658b5(_0x4fdea6[_0x10d9('0x2e')][_0x10d9('0x2d')]);}})[_0x10d9('0x2f')](function(_0x76e43d){logger['error'](_0x10d9('0x27'),_0x453d22,_0x76e43d);_0x379754(_0x76e43d);});});}function respondWithStatusCode(_0x295489,_0xce87ca){_0xce87ca=_0xce87ca||0xcc;return function(_0x96a5c){if(_0x96a5c){return _0x295489['sendStatus'](_0xce87ca);}return _0x295489[_0x10d9('0x30')](_0xce87ca)[_0x10d9('0x31')]();};}function respondWithResult(_0x18e73a,_0x96655f){_0x96655f=_0x96655f||0xc8;return function(_0x40000b){if(_0x40000b){return _0x18e73a[_0x10d9('0x30')](_0x96655f)['json'](_0x40000b);}};}function respondWithFilteredResult(_0x3bc593,_0x4cfc1c){return function(_0x26850c){if(_0x26850c){var _0x3ec714=typeof _0x4cfc1c[_0x10d9('0x32')]===_0x10d9('0x33')&&typeof _0x4cfc1c[_0x10d9('0x34')]==='undefined';var _0x524eab=_0x26850c[_0x10d9('0x35')];var _0x108bd5=_0x3ec714?0x0:_0x4cfc1c['offset'];var _0x53ae15=_0x3ec714?_0x26850c[_0x10d9('0x35')]:_0x4cfc1c[_0x10d9('0x32')]+_0x4cfc1c[_0x10d9('0x34')];var _0x545643;if(_0x53ae15>=_0x524eab){_0x53ae15=_0x524eab;_0x545643=0xc8;}else{_0x545643=0xce;}_0x3bc593[_0x10d9('0x30')](_0x545643);return _0x3bc593['set'](_0x10d9('0x36'),_0x108bd5+'-'+_0x53ae15+'/'+_0x524eab)[_0x10d9('0x37')](_0x26850c);}return null;};}function patchUpdates(_0x547dc2){return function(_0x547060){try{jsonpatch[_0x10d9('0x38')](_0x547060,_0x547dc2,!![]);}catch(_0x389179){return BPromise['reject'](_0x389179);}return _0x547060[_0x10d9('0x39')]();};}function saveUpdates(_0x42df3d,_0x5846bc){return function(_0x2a13cc){if(_0x2a13cc){return _0x2a13cc[_0x10d9('0x3a')](_0x42df3d)[_0x10d9('0x25')](function(_0x53df21){return _0x53df21;});}return null;};}function removeEntity(_0x32ebd4,_0x5f6383){return function(_0x9ddff){if(_0x9ddff){return _0x9ddff['destroy']()[_0x10d9('0x25')](function(){_0x32ebd4[_0x10d9('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x476296,_0x35094b){return function(_0x6efe7b){if(!_0x6efe7b){_0x476296[_0x10d9('0x3b')](0x194);}return _0x6efe7b;};}function handleError(_0x1d79a2,_0x1ebe6d){_0x1ebe6d=_0x1ebe6d||0x1f4;return function(_0x5ea7d7){logger['error'](_0x5ea7d7['stack']);if(_0x5ea7d7[_0x10d9('0x3c')]){delete _0x5ea7d7[_0x10d9('0x3c')];}_0x1d79a2[_0x10d9('0x30')](_0x1ebe6d)[_0x10d9('0x3d')](_0x5ea7d7);};}exports[_0x10d9('0x3e')]=function(_0x5aa203,_0x3e1c4e){var _0x2e7eae={},_0x24e998={},_0x1eb754={'count':0x0,'rows':[]};var _0x538c41=_[_0x10d9('0x3f')](db[_0x10d9('0x40')][_0x10d9('0x41')],function(_0x36a13f){return{'name':_0x36a13f[_0x10d9('0x42')],'type':_0x36a13f[_0x10d9('0x43')]['key']};});_0x24e998[_0x10d9('0x44')]=_[_0x10d9('0x3f')](_0x538c41,_0x10d9('0x3c'));_0x24e998[_0x10d9('0x45')]=_[_0x10d9('0x46')](_0x5aa203[_0x10d9('0x45')]);_0x24e998[_0x10d9('0x47')]=_[_0x10d9('0x48')](_0x24e998[_0x10d9('0x44')],_0x24e998['query']);_0x2e7eae[_0x10d9('0x49')]=_[_0x10d9('0x48')](_0x24e998[_0x10d9('0x44')],qs['fields'](_0x5aa203[_0x10d9('0x45')][_0x10d9('0x4a')]));_0x2e7eae['attributes']=_0x2e7eae[_0x10d9('0x49')][_0x10d9('0x4b')]?_0x2e7eae[_0x10d9('0x49')]:_0x24e998[_0x10d9('0x44')];if(!_0x5aa203[_0x10d9('0x45')][_0x10d9('0x4c')](_0x10d9('0x4d'))){_0x2e7eae[_0x10d9('0x34')]=qs[_0x10d9('0x34')](_0x5aa203[_0x10d9('0x45')]['limit']);_0x2e7eae[_0x10d9('0x32')]=qs[_0x10d9('0x32')](_0x5aa203[_0x10d9('0x45')][_0x10d9('0x32')]);}_0x2e7eae[_0x10d9('0x4e')]=qs[_0x10d9('0x4f')](_0x5aa203[_0x10d9('0x45')][_0x10d9('0x4f')]);_0x2e7eae[_0x10d9('0x50')]=qs[_0x10d9('0x47')](_[_0x10d9('0x51')](_0x5aa203[_0x10d9('0x45')],_0x24e998[_0x10d9('0x47')]),_0x538c41);if(_0x5aa203['query']['filter']){_0x2e7eae[_0x10d9('0x50')]=_[_0x10d9('0x52')](_0x2e7eae[_0x10d9('0x50')],{'$or':_[_0x10d9('0x3f')](_0x538c41,function(_0x390b00){if(_0x390b00[_0x10d9('0x43')]!=='VIRTUAL'){var _0x4fca03={};_0x4fca03[_0x390b00[_0x10d9('0x3c')]]={'$like':'%'+_0x5aa203[_0x10d9('0x45')]['filter']+'%'};return _0x4fca03;}})});}_0x2e7eae=_[_0x10d9('0x52')]({},_0x2e7eae,_0x5aa203[_0x10d9('0x53')]);var _0x20451a={'where':_0x2e7eae[_0x10d9('0x50')]};return db[_0x10d9('0x40')]['count'](_0x20451a)[_0x10d9('0x25')](function(_0x1f8252){_0x1eb754[_0x10d9('0x35')]=_0x1f8252;if(_0x5aa203[_0x10d9('0x45')][_0x10d9('0x54')]){_0x2e7eae['include']=[{'all':!![]}];}return db[_0x10d9('0x40')][_0x10d9('0x55')](_0x2e7eae);})[_0x10d9('0x25')](function(_0x558c98){_0x1eb754['rows']=_0x558c98;return _0x1eb754;})[_0x10d9('0x25')](respondWithFilteredResult(_0x3e1c4e,_0x2e7eae))[_0x10d9('0x2f')](handleError(_0x3e1c4e,null));};exports[_0x10d9('0x56')]=function(_0x430947,_0x42f357){var _0x445a25={'raw':!![],'where':{'id':_0x430947[_0x10d9('0x57')]['id']}},_0x17e506={};_0x17e506[_0x10d9('0x44')]=_['keys'](db[_0x10d9('0x40')][_0x10d9('0x41')]);_0x17e506[_0x10d9('0x45')]=_[_0x10d9('0x46')](_0x430947[_0x10d9('0x45')]);_0x17e506[_0x10d9('0x47')]=_[_0x10d9('0x48')](_0x17e506[_0x10d9('0x44')],_0x17e506[_0x10d9('0x45')]);_0x445a25[_0x10d9('0x49')]=_[_0x10d9('0x48')](_0x17e506[_0x10d9('0x44')],qs['fields'](_0x430947[_0x10d9('0x45')][_0x10d9('0x4a')]));_0x445a25[_0x10d9('0x49')]=_0x445a25['attributes'][_0x10d9('0x4b')]?_0x445a25[_0x10d9('0x49')]:_0x17e506[_0x10d9('0x44')];if(_0x430947[_0x10d9('0x45')]['includeAll']){_0x445a25[_0x10d9('0x58')]=[{'all':!![]}];}_0x445a25=_[_0x10d9('0x52')]({},_0x445a25,_0x430947[_0x10d9('0x53')]);return db[_0x10d9('0x40')][_0x10d9('0x59')](_0x445a25)[_0x10d9('0x25')](handleEntityNotFound(_0x42f357,null))['then'](respondWithResult(_0x42f357,null))['catch'](handleError(_0x42f357,null));};exports['create']=function(_0x56cc26,_0x3b5d58){return db[_0x10d9('0x40')]['create'](_0x56cc26[_0x10d9('0x5a')],{})[_0x10d9('0x25')](respondWithResult(_0x3b5d58,0xc9))[_0x10d9('0x2f')](handleError(_0x3b5d58,null));};exports[_0x10d9('0x3a')]=function(_0xd600b9,_0x3c381a){if(_0xd600b9[_0x10d9('0x5a')]['id']){delete _0xd600b9[_0x10d9('0x5a')]['id'];}return db[_0x10d9('0x40')][_0x10d9('0x59')]({'where':{'id':_0xd600b9['params']['id']}})[_0x10d9('0x25')](handleEntityNotFound(_0x3c381a,null))[_0x10d9('0x25')](saveUpdates(_0xd600b9[_0x10d9('0x5a')],null))['then'](respondWithResult(_0x3c381a,null))[_0x10d9('0x2f')](handleError(_0x3c381a,null));};exports[_0x10d9('0x5b')]=function(_0x931104,_0x5cb112){return db[_0x10d9('0x40')][_0x10d9('0x59')]({'where':{'id':_0x931104['params']['id']}})[_0x10d9('0x25')](handleEntityNotFound(_0x5cb112,null))[_0x10d9('0x25')](removeEntity(_0x5cb112,null))[_0x10d9('0x2f')](handleError(_0x5cb112,null));};exports[_0x10d9('0x5c')]=function(_0x49da8b,_0x5dd8fe){return db[_0x10d9('0x40')][_0x10d9('0x5c')]()[_0x10d9('0x25')](respondWithResult(_0x5dd8fe,null))[_0x10d9('0x2f')](handleError(_0x5dd8fe,null));};var interaction_log=require(_0x10d9('0x17'))(_0x10d9('0x5d'));exports[_0x10d9('0x5e')]=function(_0x4298e3,_0x404cbb,_0x147749){var _0xc1ea65={'agent':{},'channel':'whatsapp'};if(_0x4298e3['body']['id']){delete _0x4298e3[_0x10d9('0x5a')]['id'];}_0x4298e3[_0x10d9('0x5a')][_0x10d9('0x5f')]=!![];_0x4298e3[_0x10d9('0x5a')][_0x10d9('0x60')]=moment()[_0x10d9('0x61')](_0x10d9('0x62'));_0x4298e3[_0x10d9('0x5a')][_0x10d9('0x63')]=_0x4298e3['body'][_0x10d9('0x63')]||_0x4298e3[_0x10d9('0x64')]['id'];_0xc1ea65[_0x10d9('0x65')]['id']=_0x4298e3['body'][_0x10d9('0x63')];return db[_0x10d9('0x40')][_0x10d9('0x59')]({'where':{'id':_0x4298e3['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x404cbb,null))[_0x10d9('0x25')](saveUpdates(_0x4298e3['body'],null))[_0x10d9('0x25')](function(_0x20b28d){if(_0x20b28d){_0xc1ea65[_0x10d9('0x2d')]=_0x20b28d[_0x10d9('0x66')]({'plain':!![]});return db['WhatsappInteraction'][_0x10d9('0x59')]({'where':{'id':_0x20b28d['WhatsappInteractionId']}});}return null;})[_0x10d9('0x25')](handleEntityNotFound(_0x404cbb,null))[_0x10d9('0x25')](function(_0x532194){if(_0x532194){return _0x532194[_0x10d9('0x3a')]({'UserId':_0x4298e3[_0x10d9('0x5a')][_0x10d9('0x63')],'read1stAt':_['isNil'](_0x532194[_0x10d9('0x67')])?moment()[_0x10d9('0x61')](_0x10d9('0x62')):undefined});}return null;})[_0x10d9('0x25')](function(_0x2ba403){if(_0x2ba403){_0xc1ea65['interaction']=_0x2ba403[_0x10d9('0x66')]({'plain':!![]});interaction_log[_0x10d9('0x26')](_0x10d9('0x68'),_0x4298e3['user']['id'],_0x4298e3[_0x10d9('0x64')][_0x10d9('0x3c')],_0x4298e3[_0x10d9('0x64')][_0x10d9('0x69')],_0xc1ea65[_0x10d9('0x6a')]['id'],_0x4298e3[_0x10d9('0x5a')]?JSON[_0x10d9('0x2a')](_0x4298e3[_0x10d9('0x5a')]):_0x10d9('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x10d9('0x6c'),_0xc1ea65);}return null;})[_0x10d9('0x25')](function(_0x39fdfa){var _0x371d9d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x39fdfa[_0x10d9('0x2d')]['ContactId'];return db[_0x10d9('0x6d')][_0x10d9('0x45')](_0x371d9d,{'type':db[_0x10d9('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x10d9('0x25')](function(_0x245e3d){return _0x245e3d;});})[_0x10d9('0x25')](function(_0x32656b){if(_0x32656b){_0xc1ea65[_0x10d9('0x2d')][_0x10d9('0x6f')]=_0x32656b[0x0];if(!_0x4298e3[_0x10d9('0x5a')][_0x10d9('0x63')])return;return db[_0x10d9('0x70')][_0x10d9('0x59')]({'where':{'id':_0x4298e3[_0x10d9('0x5a')]['UserId'],'role':_0x10d9('0x65')},'attributes':['id','name',_0x10d9('0x71'),_0x10d9('0x72'),'internal'],'raw':!![]});}return null;})[_0x10d9('0x25')](function(_0x3045dd){if(!_0x3045dd)return null;_0xc1ea65[_0x10d9('0x2d')]['agent']=_0x3045dd;return _0xc1ea65;})['then'](function(_0x8faf0b){if(_0x8faf0b){if(_0x4298e3[_0x10d9('0x5a')][_0x10d9('0x73')]){_0xc1ea65[_0x10d9('0x2d')]['interface']=util['format']('SIP/%s',_0x4298e3['user'][_0x10d9('0x3c')]);_0xc1ea65['message'][_0x10d9('0x74')]=_0xc1ea65[_0x10d9('0x74')];_0xc1ea65[_0x10d9('0x2d')][_0x10d9('0x75')]=_0x10d9('0x5e');return respondWithRpcPromise('EventManager',_0x10d9('0x76'),{'event':_0x10d9('0x77'),'message':_0xc1ea65[_0x10d9('0x2d')]},client9002)[_0x10d9('0x25')](function(){return _0xc1ea65;});}return _0xc1ea65;}return null;})[_0x10d9('0x25')](respondWithResult(_0x404cbb,null))[_0x10d9('0x2f')](handleError(_0x404cbb,null));};var interaction_log=require('../../config/logger')(_0x10d9('0x5d'));exports['reject']=function(_0x4f7f51,_0x3d8c33,_0x31922e){var _0x43180e={'agent':{},'channel':_0x10d9('0x78')};if(_0x4f7f51[_0x10d9('0x5a')]['id']){delete _0x4f7f51['body']['id'];}_0x4f7f51[_0x10d9('0x5a')]['UserId']=_0x4f7f51[_0x10d9('0x5a')][_0x10d9('0x63')]||_0x4f7f51[_0x10d9('0x64')]['id'];_0x43180e[_0x10d9('0x65')]['id']=_0x4f7f51['body']['UserId'];return db[_0x10d9('0x40')][_0x10d9('0x59')]({'where':{'id':_0x4f7f51['params']['id'],'UserId':null}})[_0x10d9('0x25')](handleEntityNotFound(_0x3d8c33,null))[_0x10d9('0x25')](function(_0xe509fa){if(_0xe509fa){_0x43180e['message']=_0xe509fa[_0x10d9('0x66')]({'plain':!![]});return db[_0x10d9('0x79')][_0x10d9('0x59')]({'where':{'id':_0xe509fa[_0x10d9('0x7a')]}});}return null;})[_0x10d9('0x25')](handleEntityNotFound(_0x3d8c33,null))[_0x10d9('0x25')](function(_0x36adf8){if(_0x36adf8){_0x43180e[_0x10d9('0x6a')]=_0x36adf8['get']({'plain':!![]});interaction_log[_0x10d9('0x26')](_0x10d9('0x7b'),_0x4f7f51[_0x10d9('0x64')]['id'],_0x4f7f51[_0x10d9('0x64')][_0x10d9('0x3c')],_0x4f7f51['user'][_0x10d9('0x69')],_0x43180e[_0x10d9('0x6a')]['id'],_0x4f7f51['body']?JSON[_0x10d9('0x2a')](_0x4f7f51[_0x10d9('0x5a')]):_0x10d9('0x6b'));return respondWithRpcPromise(_0x10d9('0x7c'),_0x10d9('0x7d'),_0x43180e);}return null;})[_0x10d9('0x25')](function(_0x5b65b6){var _0x203566=_0x10d9('0x7e')+_0x5b65b6[_0x10d9('0x2d')][_0x10d9('0x7f')];return db[_0x10d9('0x6d')][_0x10d9('0x45')](_0x203566,{'type':db[_0x10d9('0x6e')][_0x10d9('0x80')][_0x10d9('0x81')],'raw':!![]})[_0x10d9('0x25')](function(_0x1f9385){return _0x1f9385;});})[_0x10d9('0x25')](function(_0x3c3194){if(_0x3c3194){_0x43180e[_0x10d9('0x2d')][_0x10d9('0x6f')]=_0x3c3194[0x0];if(!_0x4f7f51[_0x10d9('0x5a')][_0x10d9('0x63')])return;return db[_0x10d9('0x70')][_0x10d9('0x59')]({'where':{'id':_0x4f7f51[_0x10d9('0x5a')][_0x10d9('0x63')],'role':_0x10d9('0x65')},'attributes':['id',_0x10d9('0x3c'),_0x10d9('0x71'),'email',_0x10d9('0x82')],'raw':!![]});}return null;})['then'](function(_0x45b12b){if(!_0x45b12b)return null;_0x43180e[_0x10d9('0x2d')][_0x10d9('0x65')]=_0x45b12b;return _0x43180e;})['then'](function(_0x1d7aaa){if(_0x1d7aaa){_0x1d7aaa[_0x10d9('0x2d')][_0x10d9('0x83')]=util[_0x10d9('0x61')](_0x10d9('0x84'),_0x4f7f51[_0x10d9('0x64')][_0x10d9('0x3c')]);_0x1d7aaa[_0x10d9('0x2d')][_0x10d9('0x74')]=_0x43180e[_0x10d9('0x74')];_0x1d7aaa[_0x10d9('0x2d')][_0x10d9('0x75')]=_0x10d9('0x85');respondWithRpcPromise('EventManager',_0x10d9('0x76'),{'event':_0x10d9('0x86'),'message':_0x1d7aaa[_0x10d9('0x2d')]},client9002);return _0x43180e;}return null;})[_0x10d9('0x25')](respondWithResult(_0x3d8c33,null))[_0x10d9('0x2f')](handleError(_0x3d8c33,null));};exports['status']=function(_0xcf5fff,_0x161099,_0x571ca0){if(_0xcf5fff[_0x10d9('0x5a')]['id']){delete _0xcf5fff[_0x10d9('0x5a')]['id'];}var _0x35d93d;return db[_0x10d9('0x40')]['find']({'where':{'id':_0xcf5fff[_0x10d9('0x57')]['id']}})['then'](handleEntityNotFound(_0x161099,null))[_0x10d9('0x25')](function(_0x5c7d71){if(_0x5c7d71){_0x35d93d=_0x5c7d71;return db[_0x10d9('0x87')]['find']({'where':{'id':_0x5c7d71[_0x10d9('0x88')]}});}})['then'](handleEntityNotFound(_0x161099,null))[_0x10d9('0x25')](function(_0x14e74b){if(_0x14e74b){logger[_0x10d9('0x29')](_0x10d9('0x89'),_0x10d9('0x30'),'received\x20delivery\x20report\x20from',_0x14e74b[_0x10d9('0x43')],util[_0x10d9('0x8a')](_0xcf5fff[_0x10d9('0x5a')],{'showHidden':![],'depth':null}));switch(_0x14e74b[_0x10d9('0x43')]){case _0x10d9('0x8b'):if(_0xcf5fff[_0x10d9('0x5a')][_0x10d9('0x8c')]&&_0xcf5fff['body'][_0x10d9('0x8c')]===_0x35d93d[_0x10d9('0x8d')]&&_0xcf5fff[_0x10d9('0x5a')][_0x10d9('0x8e')]&&_0xcf5fff[_0x10d9('0x5a')][_0x10d9('0x8e')]===_0x10d9('0x5f')){return _0x35d93d['update']({'read':!![]});}else{logger[_0x10d9('0x2c')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x10d9('0x8b'),util[_0x10d9('0x8a')](_0xcf5fff[_0x10d9('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x35d93d;}})[_0x10d9('0x25')](respondWithResult(_0x161099,null))[_0x10d9('0x2f')](handleError(_0x161099,null));}; \ No newline at end of file +var _0x5d17=['WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','status','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','end','sendStatus','stack','name','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','show','rawAttributes','merge','find','create','body','params','describe','../../config/logger','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','accept','EventManager','acceptmessage','whatsapp-interactions','whatsapp','WhatsappInteraction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','format','event','rejectmessage','WhatsappAccount','WhatsappAccountId'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x5d17,0x114));var _0x75d1=function(_0x5dcb2f,_0x402ca3){_0x5dcb2f=_0x5dcb2f-0x0;var _0x2cf625=_0x5d17[_0x5dcb2f];return _0x2cf625;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];config[_0x75d1('0x17')]=_['defaults'](config[_0x75d1('0x17')],{'host':_0x75d1('0x18'),'port':0x18eb});var socket=require(_0x75d1('0x19'))(new Redis(config[_0x75d1('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x75d1('0x1a')][_0x75d1('0x1b')]({'port':0x232c});var client9002=jayson[_0x75d1('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9620,_0x3fff9b,_0x1d30f3,_0x269e82){return new BPromise(function(_0x1160ca,_0x39a26b){var _0x2845bc=_0x269e82||client;return _0x2845bc[_0x75d1('0x1c')](_0x1f9620,_0x1d30f3)[_0x75d1('0x1d')](function(_0x3d0717){logger[_0x75d1('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x3fff9b,'request\x20sent');logger[_0x75d1('0x1f')](_0x75d1('0x20'),_0x3fff9b,'request\x20sent',JSON[_0x75d1('0x21')](_0x3d0717));if(_0x3d0717[_0x75d1('0x22')]){if(_0x3d0717[_0x75d1('0x22')][_0x75d1('0x23')]===0x1f4){logger[_0x75d1('0x22')](_0x75d1('0x24'),_0x3fff9b,_0x3d0717['error'][_0x75d1('0x25')]);return _0x39a26b(_0x3d0717[_0x75d1('0x22')]['message']);}logger[_0x75d1('0x22')](_0x75d1('0x24'),_0x3fff9b,_0x3d0717['error'][_0x75d1('0x25')]);return _0x1160ca(_0x3d0717['error'][_0x75d1('0x25')]);}else{logger[_0x75d1('0x1e')](_0x75d1('0x24'),_0x3fff9b,'request\x20sent');_0x1160ca(_0x3d0717['result'][_0x75d1('0x25')]);}})[_0x75d1('0x26')](function(_0x315ce5){logger[_0x75d1('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x3fff9b,_0x315ce5);_0x39a26b(_0x315ce5);});});}function respondWithStatusCode(_0x280498,_0x2b5848){_0x2b5848=_0x2b5848||0xcc;return function(_0x367238){if(_0x367238){return _0x280498['sendStatus'](_0x2b5848);}return _0x280498['status'](_0x2b5848)['end']();};}function respondWithResult(_0x364dc9,_0x30d9f3){_0x30d9f3=_0x30d9f3||0xc8;return function(_0x45c182){if(_0x45c182){return _0x364dc9[_0x75d1('0x27')](_0x30d9f3)[_0x75d1('0x28')](_0x45c182);}};}function respondWithFilteredResult(_0x519ceb,_0x4d292e){return function(_0x410e16){if(_0x410e16){var _0x197f52=typeof _0x4d292e['offset']===_0x75d1('0x29')&&typeof _0x4d292e['limit']===_0x75d1('0x29');var _0x244da6=_0x410e16[_0x75d1('0x2a')];var _0x3fb7b9=_0x197f52?0x0:_0x4d292e[_0x75d1('0x2b')];var _0x506b93=_0x197f52?_0x410e16[_0x75d1('0x2a')]:_0x4d292e[_0x75d1('0x2b')]+_0x4d292e[_0x75d1('0x2c')];var _0x84d9ae;if(_0x506b93>=_0x244da6){_0x506b93=_0x244da6;_0x84d9ae=0xc8;}else{_0x84d9ae=0xce;}_0x519ceb['status'](_0x84d9ae);return _0x519ceb[_0x75d1('0x2d')]('Content-Range',_0x3fb7b9+'-'+_0x506b93+'/'+_0x244da6)[_0x75d1('0x28')](_0x410e16);}return null;};}function patchUpdates(_0x31e072){return function(_0x4c449d){try{jsonpatch[_0x75d1('0x2e')](_0x4c449d,_0x31e072,!![]);}catch(_0x39d0ff){return BPromise[_0x75d1('0x2f')](_0x39d0ff);}return _0x4c449d[_0x75d1('0x30')]();};}function saveUpdates(_0x22b190,_0x495aa4){return function(_0x23f94a){if(_0x23f94a){return _0x23f94a[_0x75d1('0x31')](_0x22b190)[_0x75d1('0x1d')](function(_0xa0f4c9){return _0xa0f4c9;});}return null;};}function removeEntity(_0x4b936c,_0x5bd3d7){return function(_0x551723){if(_0x551723){return _0x551723[_0x75d1('0x32')]()[_0x75d1('0x1d')](function(){_0x4b936c[_0x75d1('0x27')](0xcc)[_0x75d1('0x33')]();});}};}function handleEntityNotFound(_0x38972c,_0x372e23){return function(_0x3effda){if(!_0x3effda){_0x38972c[_0x75d1('0x34')](0x194);}return _0x3effda;};}function handleError(_0x433092,_0x534511){_0x534511=_0x534511||0x1f4;return function(_0x1dd3b5){logger[_0x75d1('0x22')](_0x1dd3b5[_0x75d1('0x35')]);if(_0x1dd3b5[_0x75d1('0x36')]){delete _0x1dd3b5[_0x75d1('0x36')];}_0x433092['status'](_0x534511)['send'](_0x1dd3b5);};}exports['index']=function(_0x1058b7,_0x17c0f6){var _0x7c9dc3={},_0x29d72f={},_0x460b92={'count':0x0,'rows':[]};var _0x734a47=_['map'](db['WhatsappMessage']['rawAttributes'],function(_0x3f2569){return{'name':_0x3f2569['fieldName'],'type':_0x3f2569['type'][_0x75d1('0x37')]};});_0x29d72f[_0x75d1('0x38')]=_[_0x75d1('0x39')](_0x734a47,_0x75d1('0x36'));_0x29d72f['query']=_[_0x75d1('0x3a')](_0x1058b7[_0x75d1('0x3b')]);_0x29d72f[_0x75d1('0x3c')]=_[_0x75d1('0x3d')](_0x29d72f[_0x75d1('0x38')],_0x29d72f[_0x75d1('0x3b')]);_0x7c9dc3[_0x75d1('0x3e')]=_[_0x75d1('0x3d')](_0x29d72f[_0x75d1('0x38')],qs[_0x75d1('0x3f')](_0x1058b7[_0x75d1('0x3b')][_0x75d1('0x3f')]));_0x7c9dc3[_0x75d1('0x3e')]=_0x7c9dc3[_0x75d1('0x3e')][_0x75d1('0x40')]?_0x7c9dc3[_0x75d1('0x3e')]:_0x29d72f[_0x75d1('0x38')];if(!_0x1058b7[_0x75d1('0x3b')][_0x75d1('0x41')](_0x75d1('0x42'))){_0x7c9dc3[_0x75d1('0x2c')]=qs[_0x75d1('0x2c')](_0x1058b7['query']['limit']);_0x7c9dc3[_0x75d1('0x2b')]=qs[_0x75d1('0x2b')](_0x1058b7[_0x75d1('0x3b')][_0x75d1('0x2b')]);}_0x7c9dc3['order']=qs[_0x75d1('0x43')](_0x1058b7[_0x75d1('0x3b')][_0x75d1('0x43')]);_0x7c9dc3[_0x75d1('0x44')]=qs['filters'](_[_0x75d1('0x45')](_0x1058b7[_0x75d1('0x3b')],_0x29d72f[_0x75d1('0x3c')]),_0x734a47);if(_0x1058b7[_0x75d1('0x3b')]['filter']){_0x7c9dc3[_0x75d1('0x44')]=_['merge'](_0x7c9dc3[_0x75d1('0x44')],{'$or':_[_0x75d1('0x39')](_0x734a47,function(_0x9bc1ed){if(_0x9bc1ed[_0x75d1('0x46')]!==_0x75d1('0x47')){var _0x2137e1={};_0x2137e1[_0x9bc1ed['name']]={'$like':'%'+_0x1058b7[_0x75d1('0x3b')]['filter']+'%'};return _0x2137e1;}})});}_0x7c9dc3=_['merge']({},_0x7c9dc3,_0x1058b7[_0x75d1('0x48')]);var _0x125c9d={'where':_0x7c9dc3[_0x75d1('0x44')]};return db[_0x75d1('0x49')][_0x75d1('0x2a')](_0x125c9d)[_0x75d1('0x1d')](function(_0x18f96a){_0x460b92['count']=_0x18f96a;if(_0x1058b7['query'][_0x75d1('0x4a')]){_0x7c9dc3[_0x75d1('0x4b')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x75d1('0x4c')](_0x7c9dc3);})[_0x75d1('0x1d')](function(_0x2066c8){_0x460b92['rows']=_0x2066c8;return _0x460b92;})[_0x75d1('0x1d')](respondWithFilteredResult(_0x17c0f6,_0x7c9dc3))[_0x75d1('0x26')](handleError(_0x17c0f6,null));};exports[_0x75d1('0x4d')]=function(_0x3be4b5,_0x352208){var _0x41869d={'raw':!![],'where':{'id':_0x3be4b5['params']['id']}},_0x2eec9d={};_0x2eec9d[_0x75d1('0x38')]=_[_0x75d1('0x3a')](db[_0x75d1('0x49')][_0x75d1('0x4e')]);_0x2eec9d[_0x75d1('0x3b')]=_[_0x75d1('0x3a')](_0x3be4b5[_0x75d1('0x3b')]);_0x2eec9d['filters']=_[_0x75d1('0x3d')](_0x2eec9d[_0x75d1('0x38')],_0x2eec9d[_0x75d1('0x3b')]);_0x41869d['attributes']=_[_0x75d1('0x3d')](_0x2eec9d[_0x75d1('0x38')],qs[_0x75d1('0x3f')](_0x3be4b5[_0x75d1('0x3b')][_0x75d1('0x3f')]));_0x41869d[_0x75d1('0x3e')]=_0x41869d['attributes'][_0x75d1('0x40')]?_0x41869d[_0x75d1('0x3e')]:_0x2eec9d[_0x75d1('0x38')];if(_0x3be4b5[_0x75d1('0x3b')][_0x75d1('0x4a')]){_0x41869d[_0x75d1('0x4b')]=[{'all':!![]}];}_0x41869d=_[_0x75d1('0x4f')]({},_0x41869d,_0x3be4b5[_0x75d1('0x48')]);return db[_0x75d1('0x49')][_0x75d1('0x50')](_0x41869d)[_0x75d1('0x1d')](handleEntityNotFound(_0x352208,null))[_0x75d1('0x1d')](respondWithResult(_0x352208,null))['catch'](handleError(_0x352208,null));};exports['create']=function(_0x41d54f,_0x4c1f5e){return db[_0x75d1('0x49')][_0x75d1('0x51')](_0x41d54f['body'],{})[_0x75d1('0x1d')](respondWithResult(_0x4c1f5e,0xc9))[_0x75d1('0x26')](handleError(_0x4c1f5e,null));};exports[_0x75d1('0x31')]=function(_0x209857,_0x35722d){if(_0x209857[_0x75d1('0x52')]['id']){delete _0x209857[_0x75d1('0x52')]['id'];}return db['WhatsappMessage'][_0x75d1('0x50')]({'where':{'id':_0x209857[_0x75d1('0x53')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x35722d,null))[_0x75d1('0x1d')](saveUpdates(_0x209857[_0x75d1('0x52')],null))[_0x75d1('0x1d')](respondWithResult(_0x35722d,null))[_0x75d1('0x26')](handleError(_0x35722d,null));};exports[_0x75d1('0x32')]=function(_0x22c75a,_0x349134){return db['WhatsappMessage']['find']({'where':{'id':_0x22c75a[_0x75d1('0x53')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x349134,null))[_0x75d1('0x1d')](removeEntity(_0x349134,null))['catch'](handleError(_0x349134,null));};exports[_0x75d1('0x54')]=function(_0x586acb,_0x2005d1){return db[_0x75d1('0x49')][_0x75d1('0x54')]()[_0x75d1('0x1d')](respondWithResult(_0x2005d1,null))['catch'](handleError(_0x2005d1,null));};var interaction_log=require(_0x75d1('0x55'))('whatsapp-interactions');exports['accept']=function(_0x18d8f3,_0x91d298,_0x286658){var _0x3c8119={'agent':{},'channel':'whatsapp'};if(_0x18d8f3['body']['id']){delete _0x18d8f3[_0x75d1('0x52')]['id'];}_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x56')]=!![];_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x57')]=moment()['format'](_0x75d1('0x58'));_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x59')]=_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x59')]||_0x18d8f3[_0x75d1('0x5a')]['id'];_0x3c8119[_0x75d1('0x5b')]['id']=_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x59')];return db[_0x75d1('0x49')][_0x75d1('0x50')]({'where':{'id':_0x18d8f3['params']['id'],'UserId':null}})[_0x75d1('0x1d')](handleEntityNotFound(_0x91d298,null))[_0x75d1('0x1d')](saveUpdates(_0x18d8f3[_0x75d1('0x52')],null))[_0x75d1('0x1d')](function(_0x3754b1){if(_0x3754b1){_0x3c8119[_0x75d1('0x25')]=_0x3754b1[_0x75d1('0x5c')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x3754b1[_0x75d1('0x5d')]}});}return null;})[_0x75d1('0x1d')](handleEntityNotFound(_0x91d298,null))[_0x75d1('0x1d')](function(_0x13ddbb){if(_0x13ddbb){return _0x13ddbb[_0x75d1('0x31')]({'UserId':_0x18d8f3['body']['UserId'],'read1stAt':_[_0x75d1('0x5e')](_0x13ddbb[_0x75d1('0x5f')])?moment()['format'](_0x75d1('0x58')):undefined});}return null;})[_0x75d1('0x1d')](function(_0x25dfa1){if(_0x25dfa1){_0x3c8119[_0x75d1('0x60')]=_0x25dfa1[_0x75d1('0x5c')]({'plain':!![]});interaction_log[_0x75d1('0x1e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18d8f3['user']['id'],_0x18d8f3[_0x75d1('0x5a')][_0x75d1('0x36')],_0x18d8f3['user'][_0x75d1('0x61')],_0x3c8119['interaction']['id'],_0x18d8f3[_0x75d1('0x52')]?JSON[_0x75d1('0x21')](_0x18d8f3[_0x75d1('0x52')]):'null');return respondWithRpcPromise(_0x75d1('0x62'),_0x75d1('0x63'),_0x3c8119);}return null;})[_0x75d1('0x1d')](function(_0x1baaca){var _0x4553ff='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1baaca['message'][_0x75d1('0x64')];return db['sequelize'][_0x75d1('0x3b')](_0x4553ff,{'type':db[_0x75d1('0x65')][_0x75d1('0x66')]['SELECT'],'raw':!![]})['then'](function(_0x2e6849){return _0x2e6849;});})['then'](function(_0x419983){if(_0x419983){_0x3c8119[_0x75d1('0x25')][_0x75d1('0x67')]=_0x419983[0x0];if(!_0x18d8f3['body'][_0x75d1('0x59')])return;return db[_0x75d1('0x68')][_0x75d1('0x50')]({'where':{'id':_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x59')],'role':_0x75d1('0x5b')},'attributes':['id',_0x75d1('0x36'),_0x75d1('0x69'),_0x75d1('0x6a'),_0x75d1('0x6b')],'raw':!![]});}return null;})[_0x75d1('0x1d')](function(_0x3549f2){if(!_0x3549f2)return null;_0x3c8119[_0x75d1('0x25')][_0x75d1('0x5b')]=_0x3549f2;return _0x3c8119;})['then'](function(_0x574cb0){if(_0x574cb0){if(_0x18d8f3[_0x75d1('0x52')][_0x75d1('0x6c')]){_0x3c8119['message'][_0x75d1('0x6d')]=util['format']('SIP/%s',_0x18d8f3['user'][_0x75d1('0x36')]);_0x3c8119[_0x75d1('0x25')][_0x75d1('0x6e')]=_0x3c8119[_0x75d1('0x6e')];_0x3c8119[_0x75d1('0x25')]['event']=_0x75d1('0x6f');return respondWithRpcPromise(_0x75d1('0x70'),_0x75d1('0x70'),{'event':_0x75d1('0x71'),'message':_0x3c8119[_0x75d1('0x25')]},client9002)['then'](function(){return _0x3c8119;});}return _0x3c8119;}return null;})[_0x75d1('0x1d')](respondWithResult(_0x91d298,null))['catch'](handleError(_0x91d298,null));};var interaction_log=require(_0x75d1('0x55'))(_0x75d1('0x72'));exports[_0x75d1('0x2f')]=function(_0x526d98,_0x506e05,_0x4e88e9){var _0x7846f2={'agent':{},'channel':_0x75d1('0x73')};if(_0x526d98[_0x75d1('0x52')]['id']){delete _0x526d98[_0x75d1('0x52')]['id'];}_0x526d98[_0x75d1('0x52')][_0x75d1('0x59')]=_0x526d98['body'][_0x75d1('0x59')]||_0x526d98[_0x75d1('0x5a')]['id'];_0x7846f2['agent']['id']=_0x526d98[_0x75d1('0x52')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x526d98[_0x75d1('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x506e05,null))['then'](function(_0x3f582c){if(_0x3f582c){_0x7846f2['message']=_0x3f582c[_0x75d1('0x5c')]({'plain':!![]});return db[_0x75d1('0x74')][_0x75d1('0x50')]({'where':{'id':_0x3f582c[_0x75d1('0x5d')]}});}return null;})[_0x75d1('0x1d')](handleEntityNotFound(_0x506e05,null))[_0x75d1('0x1d')](function(_0x388210){if(_0x388210){_0x7846f2[_0x75d1('0x60')]=_0x388210['get']({'plain':!![]});interaction_log[_0x75d1('0x1e')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x526d98[_0x75d1('0x5a')]['id'],_0x526d98[_0x75d1('0x5a')][_0x75d1('0x36')],_0x526d98['user'][_0x75d1('0x61')],_0x7846f2[_0x75d1('0x60')]['id'],_0x526d98[_0x75d1('0x52')]?JSON[_0x75d1('0x21')](_0x526d98[_0x75d1('0x52')]):_0x75d1('0x75'));return respondWithRpcPromise(_0x75d1('0x76'),'rejectMessage',_0x7846f2);}return null;})[_0x75d1('0x1d')](function(_0x21932b){var _0x339321=_0x75d1('0x77')+_0x21932b[_0x75d1('0x25')]['ContactId'];return db['sequelize'][_0x75d1('0x3b')](_0x339321,{'type':db['Sequelize'][_0x75d1('0x66')][_0x75d1('0x78')],'raw':!![]})[_0x75d1('0x1d')](function(_0x3cc03d){return _0x3cc03d;});})['then'](function(_0x576ff0){if(_0x576ff0){_0x7846f2[_0x75d1('0x25')][_0x75d1('0x67')]=_0x576ff0[0x0];if(!_0x526d98[_0x75d1('0x52')][_0x75d1('0x59')])return;return db[_0x75d1('0x68')]['find']({'where':{'id':_0x526d98[_0x75d1('0x52')][_0x75d1('0x59')],'role':'agent'},'attributes':['id',_0x75d1('0x36'),_0x75d1('0x69'),_0x75d1('0x6a'),_0x75d1('0x6b')],'raw':!![]});}return null;})[_0x75d1('0x1d')](function(_0x6eccd8){if(!_0x6eccd8)return null;_0x7846f2['message'][_0x75d1('0x5b')]=_0x6eccd8;return _0x7846f2;})[_0x75d1('0x1d')](function(_0x39084f){if(_0x39084f){_0x39084f[_0x75d1('0x25')][_0x75d1('0x6d')]=util[_0x75d1('0x79')]('SIP/%s',_0x526d98[_0x75d1('0x5a')]['name']);_0x39084f[_0x75d1('0x25')][_0x75d1('0x6e')]=_0x7846f2[_0x75d1('0x6e')];_0x39084f[_0x75d1('0x25')][_0x75d1('0x7a')]=_0x75d1('0x2f');respondWithRpcPromise('EventManager',_0x75d1('0x70'),{'event':_0x75d1('0x7b'),'message':_0x39084f[_0x75d1('0x25')]},client9002);return _0x7846f2;}return null;})['then'](respondWithResult(_0x506e05,null))[_0x75d1('0x26')](handleError(_0x506e05,null));};exports[_0x75d1('0x27')]=function(_0x5882fe,_0x5767f4,_0xbd3b74){if(_0x5882fe[_0x75d1('0x52')]['id']){delete _0x5882fe[_0x75d1('0x52')]['id'];}var _0x2bacfe;return db[_0x75d1('0x49')][_0x75d1('0x50')]({'where':{'id':_0x5882fe[_0x75d1('0x53')]['id']}})[_0x75d1('0x1d')](handleEntityNotFound(_0x5767f4,null))['then'](function(_0x24280b){if(_0x24280b){_0x2bacfe=_0x24280b;return db[_0x75d1('0x7c')]['find']({'where':{'id':_0x24280b[_0x75d1('0x7d')]}});}})[_0x75d1('0x1d')](handleEntityNotFound(_0x5767f4,null))['then'](function(_0x4ec00a){if(_0x4ec00a){logger[_0x75d1('0x1f')](_0x75d1('0x7e'),_0x75d1('0x27'),_0x75d1('0x7f'),_0x4ec00a['type'],util[_0x75d1('0x80')](_0x5882fe['body'],{'showHidden':![],'depth':null}));switch(_0x4ec00a[_0x75d1('0x46')]){case _0x75d1('0x81'):if(_0x5882fe[_0x75d1('0x52')][_0x75d1('0x82')]&&_0x5882fe[_0x75d1('0x52')][_0x75d1('0x82')]===_0x2bacfe[_0x75d1('0x83')]&&_0x5882fe[_0x75d1('0x52')][_0x75d1('0x84')]&&_0x5882fe[_0x75d1('0x52')][_0x75d1('0x84')]===_0x75d1('0x56')){return _0x2bacfe[_0x75d1('0x31')]({'read':!![]});}else{logger[_0x75d1('0x22')](_0x75d1('0x85'),_0x75d1('0x27'),_0x75d1('0x81'),util['inspect'](_0x5882fe[_0x75d1('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x2bacfe;}})[_0x75d1('0x1d')](respondWithResult(_0x5767f4,null))[_0x75d1('0x26')](handleError(_0x5767f4,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 6644d7c..c70c8d9 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 _0x80ed=['remove','emit','hasOwnProperty','exports','events','WhatsappMessage','setMaxListeners','save'];(function(_0x57c48f,_0x1f27f3){var _0x932bb5=function(_0x5ccf42){while(--_0x5ccf42){_0x57c48f['push'](_0x57c48f['shift']());}};_0x932bb5(++_0x1f27f3);}(_0x80ed,0x11c));var _0xd80e=function(_0x1c4fb1,_0x5a6d9b){_0x1c4fb1=_0x1c4fb1-0x0;var _0x4c52d7=_0x80ed[_0x1c4fb1];return _0x4c52d7;};'use strict';var EventEmitter=require(_0xd80e('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xd80e('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd80e('0x2')](0x0);var events={'afterCreate':_0xd80e('0x3'),'afterUpdate':'update','afterDestroy':_0xd80e('0x4')};function emitEvent(_0x46876f){return function(_0x2b742b,_0x3413d4,_0x5ae6c6){WhatsappMessageEvents[_0xd80e('0x5')](_0x46876f+':'+_0x2b742b['id'],_0x2b742b);WhatsappMessageEvents[_0xd80e('0x5')](_0x46876f,_0x2b742b);_0x5ae6c6(null);};}for(var e in events){if(events[_0xd80e('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xd80e('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x63a5=['WhatsappMessage','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x301d99,_0x4b455a){var _0x17ccf6=function(_0x39f935){while(--_0x39f935){_0x301d99['push'](_0x301d99['shift']());}};_0x17ccf6(++_0x4b455a);}(_0x63a5,0x18e));var _0x563a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x63a5[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x563a('0x0'));var WhatsappMessage=require(_0x563a('0x1'))['db'][_0x563a('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x563a('0x3'),'afterUpdate':'update','afterDestroy':_0x563a('0x4')};function emitEvent(_0x13195e){return function(_0x386400,_0x37e617,_0x5c2a8d){WhatsappMessageEvents['emit'](_0x13195e+':'+_0x386400['id'],_0x386400);WhatsappMessageEvents[_0x563a('0x5')](_0x13195e,_0x386400);_0x5c2a8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x563a('0x6')](e,emitEvent(event));}}module[_0x563a('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 727af6a..e273edd 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 _0x2f9e=['WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','direction','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','token','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get','toLowerCase','out','secret','UserId'];(function(_0x230652,_0x1b76ec){var _0x479613=function(_0x2433db){while(--_0x2433db){_0x230652['push'](_0x230652['shift']());}};_0x479613(++_0x1b76ec);}(_0x2f9e,0x117));var _0xe2f9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2f9e[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xe2f9('0x0'));var util=require(_0xe2f9('0x1'));var logger=require('../../config/logger')(_0xe2f9('0x2'));var moment=require(_0xe2f9('0x3'));var BPromise=require(_0xe2f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2f9('0x5'));var rimraf=require(_0xe2f9('0x6'));var config=require(_0xe2f9('0x7'));var attributes=require(_0xe2f9('0x8'));module[_0xe2f9('0x9')]=function(_0x1727ff,_0x523290){return _0x1727ff[_0xe2f9('0xa')](_0xe2f9('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xe2f9('0xc'),'fields':[_0xe2f9('0xc')]},{'name':_0xe2f9('0xd'),'fields':['body'],'type':_0xe2f9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b70f2,_0x134f79,_0x137a34){var _0x47620e=_0x1727ff[_0xe2f9('0xf')];var _0x1df6d8=_0x3b70f2[_0xe2f9('0x10')]({'plain':!![]});if(_0x1df6d8['direction'][_0xe2f9('0x11')]()==='in'||_0x1df6d8['direction'][_0xe2f9('0x11')]()===_0xe2f9('0x12')&&!_0x1df6d8[_0xe2f9('0x13')]&&!_['isNil'](_0x1df6d8[_0xe2f9('0x14')])){_0x47620e[_0xe2f9('0x15')][_0xe2f9('0x16')]({'where':{'id':_0x1df6d8[_0xe2f9('0x17')]}})[_0xe2f9('0x18')](function(_0x5e1402){if(_0x5e1402){_0x5e1402['update']({'lastMsgAt':_0x1df6d8[_0xe2f9('0x19')],'lastMsgDirection':_0x1df6d8[_0xe2f9('0x1a')][_0xe2f9('0x11')]()});}})[_0xe2f9('0x1b')](function(_0x2db23e){console[_0xe2f9('0x1c')](_0x2db23e);});}if(_0x1df6d8[_0xe2f9('0x1a')]===_0xe2f9('0x12')&&!_0x1df6d8[_0xe2f9('0x13')]){var _0x3d677b;_0x47620e[_0xe2f9('0x1d')][_0xe2f9('0x1e')]({'where':{'id':_0x1df6d8[_0xe2f9('0x1f')]},'raw':!![]})[_0xe2f9('0x18')](function(_0x197f0c){_0x3d677b=_0x197f0c;if(_0x3d677b&&_0x3d677b[_0xe2f9('0x20')]){switch(_0x3d677b['type']){case _0xe2f9('0x21'):var _0x4b41eb=require('twilio');if(_0x3d677b[_0xe2f9('0x22')]&&_0x3d677b[_0xe2f9('0x23')]&&_0x3d677b[_0xe2f9('0x24')]){var _0x49c0fc=new _0x4b41eb(_0x3d677b['accountSid'],_0x3d677b[_0xe2f9('0x23')]);_0x49c0fc[_0xe2f9('0x25')][_0xe2f9('0x26')]({'body':_0x1df6d8[_0xe2f9('0x27')],'to':_0xe2f9('0x28')+_0x1df6d8['phone'],'from':_0xe2f9('0x28')+_0x3d677b['phone'],'statusCallback':_0x3d677b[_0xe2f9('0x29')]+'/api/whatsapp/messages/'+_0x1df6d8['id']+'/status?token='+_0x3d677b[_0xe2f9('0x2a')]})[_0xe2f9('0x18')](function(_0x74f63e){if(_0x74f63e['sid']){return _0x3b70f2[_0xe2f9('0x2b')]({'messageId':_0x74f63e[_0xe2f9('0x2c')]});}})[_0xe2f9('0x1b')](function(_0x41d46a){logger[_0xe2f9('0x1c')](_0xe2f9('0x2d'),_0xe2f9('0x2e'),'twilio',util['inspect'](_0x41d46a,{'showHidden':![],'depth':null}));});}else{logger[_0xe2f9('0x1c')](_0xe2f9('0x2d'),_0xe2f9('0x2e'),_0xe2f9('0x21'),_0xe2f9('0x2f'));}break;}}})[_0xe2f9('0x30')](function(){_0x137a34();});}else{_0x137a34();}}},'charset':_0xe2f9('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc951=['request-promise','path','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x54a8be,_0x586c4e){var _0x5a2dc1=function(_0x4c07b2){while(--_0x4c07b2){_0x54a8be['push'](_0x54a8be['shift']());}};_0x5a2dc1(++_0x586c4e);}(_0xc951,0x1a3));var _0x1c95=function(_0x262cee,_0x34e3df){_0x262cee=_0x262cee-0x0;var _0x5324a1=_0xc951[_0x262cee];return _0x5324a1;};'use strict';var _=require('lodash');var util=require(_0x1c95('0x0'));var logger=require(_0x1c95('0x1'))(_0x1c95('0x2'));var moment=require(_0x1c95('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c95('0x4'));var fs=require('fs');var path=require(_0x1c95('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x1c95('0x6')]=function(_0x1c2648,_0x4cc66b){return _0x1c2648[_0x1c95('0x7')](_0x1c95('0x8'),attributes,{'tableName':_0x1c95('0x9'),'paranoid':![],'indexes':[{'name':_0x1c95('0xa'),'fields':[_0x1c95('0xa')]},{'name':_0x1c95('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2aa215,_0x9b6c4c,_0x2e128a){var _0x197a5e=_0x1c2648[_0x1c95('0xc')];var _0x3cf942=_0x2aa215[_0x1c95('0xd')]({'plain':!![]});if(_0x3cf942[_0x1c95('0xe')][_0x1c95('0xf')]()==='in'||_0x3cf942[_0x1c95('0xe')][_0x1c95('0xf')]()===_0x1c95('0x10')&&!_0x3cf942[_0x1c95('0x11')]&&!_[_0x1c95('0x12')](_0x3cf942[_0x1c95('0x13')])){_0x197a5e[_0x1c95('0x14')][_0x1c95('0x15')]({'where':{'id':_0x3cf942['WhatsappInteractionId']}})[_0x1c95('0x16')](function(_0xb3a944){if(_0xb3a944){_0xb3a944[_0x1c95('0x17')]({'lastMsgAt':_0x3cf942[_0x1c95('0x18')],'lastMsgDirection':_0x3cf942['direction']['toLowerCase']()});}})[_0x1c95('0x19')](function(_0x145e66){console[_0x1c95('0x1a')](_0x145e66);});}if(_0x3cf942[_0x1c95('0xe')]===_0x1c95('0x10')&&!_0x3cf942['secret']){var _0x5438bd;_0x197a5e['WhatsappAccount']['find']({'where':{'id':_0x3cf942[_0x1c95('0x1b')]},'raw':!![]})[_0x1c95('0x16')](function(_0x1ca178){_0x5438bd=_0x1ca178;if(_0x5438bd&&_0x5438bd[_0x1c95('0x1c')]){switch(_0x5438bd[_0x1c95('0x1c')]){case _0x1c95('0x1d'):var _0x5e2a59=require(_0x1c95('0x1d'));if(_0x5438bd['accountSid']&&_0x5438bd[_0x1c95('0x1e')]&&_0x5438bd[_0x1c95('0x1f')]){var _0x53a587=new _0x5e2a59(_0x5438bd[_0x1c95('0x20')],_0x5438bd[_0x1c95('0x1e')]);_0x53a587[_0x1c95('0x21')][_0x1c95('0x22')]({'body':_0x3cf942['body'],'to':_0x1c95('0x23')+_0x3cf942[_0x1c95('0x1f')],'from':'whatsapp:'+_0x5438bd[_0x1c95('0x1f')],'statusCallback':_0x5438bd[_0x1c95('0x24')]+'/api/whatsapp/messages/'+_0x3cf942['id']+_0x1c95('0x25')+_0x5438bd[_0x1c95('0x26')]})[_0x1c95('0x16')](function(_0x48fc60){if(_0x48fc60['sid']){return _0x2aa215[_0x1c95('0x17')]({'messageId':_0x48fc60[_0x1c95('0x27')]});}})[_0x1c95('0x19')](function(_0x4233a8){logger[_0x1c95('0x1a')](_0x1c95('0x28'),_0x1c95('0x29'),_0x1c95('0x1d'),util[_0x1c95('0x2a')](_0x4233a8,{'showHidden':![],'depth':null}));});}else{logger[_0x1c95('0x1a')](_0x1c95('0x28'),_0x1c95('0x29'),_0x1c95('0x1d'),_0x1c95('0x2b'));}break;}}})[_0x1c95('0x2c')](function(){_0x2e128a();});}else{_0x2e128a();}}},'charset':_0x1c95('0x2d'),'collate':_0x1c95('0x2e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f4a4e06..ccb58c8 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 _0x84f1=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2a6f73,_0xfadf2a){var _0x2d8899=function(_0x1f0887){while(--_0x1f0887){_0x2a6f73['push'](_0x2a6f73['shift']());}};_0x2d8899(++_0xfadf2a);}(_0x84f1,0x85));var _0x184f=function(_0x452da9,_0x265ba8){_0x452da9=_0x452da9-0x0;var _0x386fcb=_0x84f1[_0x452da9];return _0x386fcb;};'use strict';var _=require(_0x184f('0x0'));var util=require(_0x184f('0x1'));var moment=require(_0x184f('0x2'));var BPromise=require(_0x184f('0x3'));var rs=require(_0x184f('0x4'));var fs=require('fs');var Redis=require(_0x184f('0x5'));var db=require(_0x184f('0x6'))['db'];var utils=require(_0x184f('0x7'));var logger=require(_0x184f('0x8'))(_0x184f('0x9'));var config=require(_0x184f('0xa'));var jayson=require(_0x184f('0xb'));var client=jayson[_0x184f('0xc')][_0x184f('0xd')]({'port':0x232a});config[_0x184f('0xe')]=_['defaults'](config[_0x184f('0xe')],{'host':_0x184f('0xf'),'port':0x18eb});var socket=require(_0x184f('0x10'))(new Redis(config['redis']));require(_0x184f('0x11'))[_0x184f('0x12')](socket);function respondWithRpcPromise(_0x53976e,_0x1d1d7e,_0x110607){return new BPromise(function(_0x55a700,_0x213aa1){return client[_0x184f('0x13')](_0x53976e,_0x110607)[_0x184f('0x14')](function(_0xcfe555){logger['info'](_0x184f('0x15'),_0x1d1d7e,_0x184f('0x16'));logger[_0x184f('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1d1d7e,_0x184f('0x16'),JSON[_0x184f('0x18')](_0xcfe555));if(_0xcfe555[_0x184f('0x19')]){if(_0xcfe555['error'][_0x184f('0x1a')]===0x1f4){logger[_0x184f('0x19')](_0x184f('0x15'),_0x1d1d7e,_0xcfe555[_0x184f('0x19')]['message']);return _0x213aa1(_0xcfe555['error'][_0x184f('0x1b')]);}logger['error'](_0x184f('0x15'),_0x1d1d7e,_0xcfe555['error'][_0x184f('0x1b')]);return _0x55a700(_0xcfe555[_0x184f('0x19')][_0x184f('0x1b')]);}else{logger['info'](_0x184f('0x15'),_0x1d1d7e,'request\x20sent');_0x55a700(_0xcfe555[_0x184f('0x1c')][_0x184f('0x1b')]);}})[_0x184f('0x1d')](function(_0x301cf8){logger[_0x184f('0x19')](_0x184f('0x15'),_0x1d1d7e,_0x301cf8);_0x213aa1(_0x301cf8);});});}exports[_0x184f('0x1e')]=function(_0x5a9896){var _0x4c9305=this;return new Promise(function(_0x38b30f,_0x461209){return db[_0x184f('0x1f')][_0x184f('0x20')](_0x5a9896[_0x184f('0x21')],{'raw':_0x5a9896[_0x184f('0x22')]?_0x5a9896[_0x184f('0x22')]['raw']===undefined?!![]:![]:!![]})[_0x184f('0x14')](function(_0x5a28f4){logger[_0x184f('0x23')](_0x184f('0x1e'),_0x5a9896);logger[_0x184f('0x17')]('CreateWhatsappMessage',_0x5a9896,JSON[_0x184f('0x18')](_0x5a28f4));_0x38b30f(_0x5a28f4);})[_0x184f('0x1d')](function(_0x546d4a){logger[_0x184f('0x19')]('CreateWhatsappMessage',_0x546d4a['message'],_0x5a9896);_0x461209(_0x4c9305[_0x184f('0x19')](0x1f4,_0x546d4a[_0x184f('0x1b')]));});});}; \ No newline at end of file +var _0x36e7=['CreateWhatsappMessage','create','body','options','then','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','debug','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x31e142,_0x41d7af){var _0x199fd6=function(_0x269d2f){while(--_0x269d2f){_0x31e142['push'](_0x31e142['shift']());}};_0x199fd6(++_0x41d7af);}(_0x36e7,0x17e));var _0x736e=function(_0xe943c6,_0x547fe6){_0xe943c6=_0xe943c6-0x0;var _0x46aa75=_0x36e7[_0xe943c6];return _0x46aa75;};'use strict';var _=require(_0x736e('0x0'));var util=require(_0x736e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x736e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x736e('0x3'))['db'];var utils=require(_0x736e('0x4'));var logger=require(_0x736e('0x5'))('rpc');var config=require(_0x736e('0x6'));var jayson=require(_0x736e('0x7'));var client=jayson[_0x736e('0x8')]['http']({'port':0x232a});config[_0x736e('0x9')]=_[_0x736e('0xa')](config[_0x736e('0x9')],{'host':_0x736e('0xb'),'port':0x18eb});var socket=require(_0x736e('0xc'))(new Redis(config['redis']));require(_0x736e('0xd'))[_0x736e('0xe')](socket);function respondWithRpcPromise(_0x440718,_0x393f0b,_0x1e1aa9){return new BPromise(function(_0x240dfd,_0x54669c){return client['request'](_0x440718,_0x1e1aa9)['then'](function(_0x5aab26){logger[_0x736e('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x393f0b,'request\x20sent');logger[_0x736e('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x393f0b,_0x736e('0x11'),JSON[_0x736e('0x12')](_0x5aab26));if(_0x5aab26[_0x736e('0x13')]){if(_0x5aab26[_0x736e('0x13')]['code']===0x1f4){logger[_0x736e('0x13')](_0x736e('0x14'),_0x393f0b,_0x5aab26[_0x736e('0x13')]['message']);return _0x54669c(_0x5aab26[_0x736e('0x13')][_0x736e('0x15')]);}logger[_0x736e('0x13')](_0x736e('0x14'),_0x393f0b,_0x5aab26[_0x736e('0x13')][_0x736e('0x15')]);return _0x240dfd(_0x5aab26[_0x736e('0x13')][_0x736e('0x15')]);}else{logger[_0x736e('0xf')](_0x736e('0x14'),_0x393f0b,_0x736e('0x11'));_0x240dfd(_0x5aab26[_0x736e('0x16')]['message']);}})[_0x736e('0x17')](function(_0x1897e3){logger[_0x736e('0x13')](_0x736e('0x14'),_0x393f0b,_0x1897e3);_0x54669c(_0x1897e3);});});}exports[_0x736e('0x18')]=function(_0x2b04aa){var _0x5167cd=this;return new Promise(function(_0x20e7b4,_0x53bf07){return db['WhatsappMessage'][_0x736e('0x19')](_0x2b04aa[_0x736e('0x1a')],{'raw':_0x2b04aa[_0x736e('0x1b')]?_0x2b04aa['options']['raw']===undefined?!![]:![]:!![]})[_0x736e('0x1c')](function(_0x44ba46){logger[_0x736e('0xf')](_0x736e('0x18'),_0x2b04aa);logger[_0x736e('0x10')]('CreateWhatsappMessage',_0x2b04aa,JSON[_0x736e('0x12')](_0x44ba46));_0x20e7b4(_0x44ba46);})[_0x736e('0x17')](function(_0x18c028){logger['error'](_0x736e('0x18'),_0x18c028[_0x736e('0x15')],_0x2b04aa);_0x53bf07(_0x5167cd[_0x736e('0x13')](0x1f4,_0x18c028['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 34f0407..7488a9c 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 _0xd078=['remove','removeListener','register','length','whatsappMessage:','save'];(function(_0x573d22,_0x1e3099){var _0x57d890=function(_0x33713c){while(--_0x33713c){_0x573d22['push'](_0x573d22['shift']());}};_0x57d890(++_0x1e3099);}(_0xd078,0x1cd));var _0x8d07=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0xd078[_0x485f35];return _0x2ad118;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x8d07('0x0'),_0x8d07('0x1'),'update'];function createListener(_0xee6691,_0x3e31ef){return function(_0x369ceb){_0x3e31ef['emit'](_0xee6691,_0x369ceb);};}function removeListener(_0xb57879,_0x1bec3c){return function(){WhatsappMessageEvents[_0x8d07('0x2')](_0xb57879,_0x1bec3c);};}exports[_0x8d07('0x3')]=function(_0x4ea721){for(var _0x1b4502=0x0,_0x3083b5=events[_0x8d07('0x4')];_0x1b4502<_0x3083b5;_0x1b4502++){var _0x54d947=events[_0x1b4502];var _0x1735f9=createListener(_0x8d07('0x5')+_0x54d947,_0x4ea721);WhatsappMessageEvents['on'](_0x54d947,_0x1735f9);}}; \ No newline at end of file +var _0x8947=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x33bef4,_0x11be16){var _0x318bea=function(_0x50bcef){while(--_0x50bcef){_0x33bef4['push'](_0x33bef4['shift']());}};_0x318bea(++_0x11be16);}(_0x8947,0xcc));var _0x7894=function(_0x1cb74c,_0x248486){_0x1cb74c=_0x1cb74c-0x0;var _0x511253=_0x8947[_0x1cb74c];return _0x511253;};'use strict';var WhatsappMessageEvents=require(_0x7894('0x0'));var events=[_0x7894('0x1'),'remove',_0x7894('0x2')];function createListener(_0x176f6b,_0x9805a4){return function(_0x1da098){_0x9805a4[_0x7894('0x3')](_0x176f6b,_0x1da098);};}function removeListener(_0x16f4ce,_0x412c30){return function(){WhatsappMessageEvents[_0x7894('0x4')](_0x16f4ce,_0x412c30);};}exports[_0x7894('0x5')]=function(_0x554a99){for(var _0x563075=0x0,_0x28664c=events[_0x7894('0x6')];_0x563075<_0x28664c;_0x563075++){var _0x2b1e94=events[_0x563075];var _0x3919c8=createListener(_0x7894('0x7')+_0x2b1e94,_0x554a99);WhatsappMessageEvents['on'](_0x2b1e94,_0x3919c8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 1039f48..aeb14ce 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 _0x7da6=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x35de8a,_0x7acd4b){var _0x9c759d=function(_0x1fc3d3){while(--_0x1fc3d3){_0x35de8a['push'](_0x35de8a['shift']());}};_0x9c759d(++_0x7acd4b);}(_0x7da6,0x127));var _0x67da=function(_0x41886e,_0x2f9b3e){_0x41886e=_0x41886e-0x0;var _0x10e7f4=_0x7da6[_0x41886e];return _0x10e7f4;};'use strict';var multer=require(_0x67da('0x0'));var util=require('util');var path=require(_0x67da('0x1'));var timeout=require('connect-timeout');var express=require(_0x67da('0x2'));var router=express[_0x67da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x67da('0x4'));var interaction=require(_0x67da('0x5'));var config=require('../../config/environment');var controller=require(_0x67da('0x6'));router[_0x67da('0x7')]('/',auth[_0x67da('0x8')](),controller[_0x67da('0x9')]);router[_0x67da('0x7')](_0x67da('0xa'),auth[_0x67da('0x8')](),controller[_0x67da('0xb')]);router['get'](_0x67da('0xc'),auth[_0x67da('0x8')](),controller['show']);router[_0x67da('0x7')](_0x67da('0xd'),auth[_0x67da('0x8')](),controller[_0x67da('0xe')]);router[_0x67da('0x7')](_0x67da('0xf'),auth['isAuthenticated'](),controller[_0x67da('0x10')]);router['get'](_0x67da('0x11'),auth['isAuthenticated'](),controller[_0x67da('0x12')]);router[_0x67da('0x13')]('/',auth[_0x67da('0x8')](),controller[_0x67da('0x14')]);router['post'](_0x67da('0xf'),auth[_0x67da('0x8')](),controller[_0x67da('0x15')]);router[_0x67da('0x13')](_0x67da('0x11'),auth[_0x67da('0x8')](),controller[_0x67da('0x16')]);router[_0x67da('0x17')](_0x67da('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x67da('0x18')](_0x67da('0xf'),auth['isAuthenticated'](),controller[_0x67da('0x19')]);router[_0x67da('0x18')](_0x67da('0x11'),auth['isAuthenticated'](),controller[_0x67da('0x1a')]);module[_0x67da('0x1b')]=router; \ No newline at end of file +var _0xdeac=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','/:id','delete','destroy'];(function(_0x4ee7b1,_0x20d16b){var _0x53d343=function(_0x3d0c72){while(--_0x3d0c72){_0x4ee7b1['push'](_0x4ee7b1['shift']());}};_0x53d343(++_0x20d16b);}(_0xdeac,0xfa));var _0xcdea=function(_0x3a10c8,_0x2c31be){_0x3a10c8=_0x3a10c8-0x0;var _0x375d0b=_0xdeac[_0x3a10c8];return _0x375d0b;};'use strict';var multer=require(_0xcdea('0x0'));var util=require(_0xcdea('0x1'));var path=require(_0xcdea('0x2'));var timeout=require(_0xcdea('0x3'));var express=require(_0xcdea('0x4'));var router=express[_0xcdea('0x5')]();var fs_extra=require(_0xcdea('0x6'));var auth=require(_0xcdea('0x7'));var interaction=require(_0xcdea('0x8'));var config=require(_0xcdea('0x9'));var controller=require('./whatsappQueue.controller');router[_0xcdea('0xa')]('/',auth[_0xcdea('0xb')](),controller[_0xcdea('0xc')]);router['get'](_0xcdea('0xd'),auth['isAuthenticated'](),controller[_0xcdea('0xe')]);router[_0xcdea('0xa')]('/:id',auth[_0xcdea('0xb')](),controller[_0xcdea('0xf')]);router[_0xcdea('0xa')](_0xcdea('0x10'),auth['isAuthenticated'](),controller[_0xcdea('0x11')]);router[_0xcdea('0xa')]('/:id/teams',auth[_0xcdea('0xb')](),controller[_0xcdea('0x12')]);router[_0xcdea('0xa')](_0xcdea('0x13'),auth[_0xcdea('0xb')](),controller[_0xcdea('0x14')]);router[_0xcdea('0x15')]('/',auth['isAuthenticated'](),controller[_0xcdea('0x16')]);router[_0xcdea('0x15')](_0xcdea('0x17'),auth[_0xcdea('0xb')](),controller[_0xcdea('0x18')]);router[_0xcdea('0x15')](_0xcdea('0x13'),auth[_0xcdea('0xb')](),controller['addAgents']);router[_0xcdea('0x19')](_0xcdea('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0xcdea('0x1b')]('/:id',auth[_0xcdea('0xb')](),controller[_0xcdea('0x1c')]);router[_0xcdea('0x1b')]('/:id/teams',auth[_0xcdea('0xb')](),controller['removeTeams']);router[_0xcdea('0x1b')](_0xcdea('0x13'),auth[_0xcdea('0xb')](),controller[_0xcdea('0x1d')]);module[_0xcdea('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 20287e9..3248aff 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 _0xe600=['STRING','exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x5b94b1,_0x394d69){var _0x5d5d1f=function(_0x5ce4ae){while(--_0x5ce4ae){_0x5b94b1['push'](_0x5b94b1['shift']());}};_0x5d5d1f(++_0x394d69);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x0e60('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0e60('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x0e60('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0e60('0x3')](_0x0e60('0x4'),_0x0e60('0x5'),_0x0e60('0x6'))},'description':{'type':Sequelize[_0x0e60('0x7')]}}; \ No newline at end of file +var _0xf81a=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xf81a,0x16b));var _0xaf81=function(_0x125c54,_0x156158){_0x125c54=_0x125c54-0x0;var _0x5006c1=_0xf81a[_0x125c54];return _0x5006c1;};'use strict';var Sequelize=require(_0xaf81('0x0'));module[_0xaf81('0x1')]={'name':{'type':Sequelize[_0xaf81('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xaf81('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaf81('0x4')](_0xaf81('0x5'),'beepall',_0xaf81('0x6'))},'description':{'type':Sequelize[_0xaf81('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 35431fc..e36ed83 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 _0x4888=['every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','order','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','stack','name','send','index','map','WhatsappQueue','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','ids','voicePause','interface','flatMap','Agents','sequelize','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT'];(function(_0x3d467b,_0x54bd44){var _0x98bbcb=function(_0x418d80){while(--_0x418d80){_0x3d467b['push'](_0x3d467b['shift']());}};_0x98bbcb(++_0x54bd44);}(_0x4888,0x1c3));var _0x8488=function(_0x1cfacc,_0x167cca){_0x1cfacc=_0x1cfacc-0x0;var _0x5e8766=_0x4888[_0x1cfacc];return _0x5e8766;};'use strict';var emlformat=require(_0x8488('0x0'));var rimraf=require(_0x8488('0x1'));var zipdir=require(_0x8488('0x2'));var jsonpatch=require(_0x8488('0x3'));var rp=require(_0x8488('0x4'));var moment=require(_0x8488('0x5'));var BPromise=require(_0x8488('0x6'));var Mustache=require(_0x8488('0x7'));var util=require('util');var path=require(_0x8488('0x8'));var sox=require(_0x8488('0x9'));var csv=require(_0x8488('0xa'));var ejs=require(_0x8488('0xb'));var fs=require('fs');var fs_extra=require(_0x8488('0xc'));var _=require(_0x8488('0xd'));var squel=require(_0x8488('0xe'));var crypto=require(_0x8488('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8488('0x10'));var Papa=require(_0x8488('0x11'));var Redis=require(_0x8488('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8488('0x13'));var hardwareService=require(_0x8488('0x14'));var logger=require(_0x8488('0x15'))('api');var utils=require(_0x8488('0x16'));var config=require(_0x8488('0x17'));var licenseUtil=require(_0x8488('0x18'));var db=require(_0x8488('0x19'))['db'];config[_0x8488('0x1a')]=_[_0x8488('0x1b')](config[_0x8488('0x1a')],{'host':_0x8488('0x1c'),'port':0x18eb});var socket=require(_0x8488('0x1d'))(new Redis(config[_0x8488('0x1a')]));require(_0x8488('0x1e'))[_0x8488('0x1f')](socket);function respondWithStatusCode(_0x148512,_0x497282){_0x497282=_0x497282||0xcc;return function(_0x312c20){if(_0x312c20){return _0x148512[_0x8488('0x20')](_0x497282);}return _0x148512[_0x8488('0x21')](_0x497282)[_0x8488('0x22')]();};}function respondWithResult(_0x3c15ff,_0x3f4d61){_0x3f4d61=_0x3f4d61||0xc8;return function(_0x2052a7){if(_0x2052a7){return _0x3c15ff['status'](_0x3f4d61)[_0x8488('0x23')](_0x2052a7);}};}function respondWithFilteredResult(_0x1bb244,_0x524321){return function(_0x29b7c4){if(_0x29b7c4){var _0x346201=typeof _0x524321[_0x8488('0x24')]==='undefined'&&typeof _0x524321['limit']===_0x8488('0x25');var _0xaf98a7=_0x29b7c4[_0x8488('0x26')];var _0x28a172=_0x346201?0x0:_0x524321['offset'];var _0x3de9db=_0x346201?_0x29b7c4['count']:_0x524321[_0x8488('0x24')]+_0x524321['limit'];var _0x3a2880;if(_0x3de9db>=_0xaf98a7){_0x3de9db=_0xaf98a7;_0x3a2880=0xc8;}else{_0x3a2880=0xce;}_0x1bb244[_0x8488('0x21')](_0x3a2880);return _0x1bb244[_0x8488('0x27')](_0x8488('0x28'),_0x28a172+'-'+_0x3de9db+'/'+_0xaf98a7)[_0x8488('0x23')](_0x29b7c4);}return null;};}function patchUpdates(_0x4bb5ec){return function(_0x10be18){try{jsonpatch[_0x8488('0x29')](_0x10be18,_0x4bb5ec,!![]);}catch(_0x362d8c){return BPromise[_0x8488('0x2a')](_0x362d8c);}return _0x10be18['save']();};}function saveUpdates(_0xecf629,_0x24176d){return function(_0x4a823a){if(_0x4a823a){return _0x4a823a[_0x8488('0x2b')](_0xecf629)['then'](function(_0x86638e){return _0x86638e;});}return null;};}function removeEntity(_0x45129d,_0x48872a){return function(_0x1252ac){if(_0x1252ac){return _0x1252ac['destroy']()[_0x8488('0x2c')](function(){var _0x41af67=_0x1252ac[_0x8488('0x2d')]({'plain':!![]});var _0x1e0ca0=_0x8488('0x2e');return db[_0x8488('0x2f')][_0x8488('0x30')]({'where':{'type':_0x1e0ca0,'resourceId':_0x41af67['id']}})['then'](function(){return _0x1252ac;});})['then'](function(){_0x45129d[_0x8488('0x21')](0xcc)[_0x8488('0x22')]();});}};}function handleEntityNotFound(_0x3f8ab8,_0x18a959){return function(_0x4c0e98){if(!_0x4c0e98){_0x3f8ab8[_0x8488('0x20')](0x194);}return _0x4c0e98;};}function handleError(_0x39fb02,_0x23f011){_0x23f011=_0x23f011||0x1f4;return function(_0x50443c){logger['error'](_0x50443c[_0x8488('0x31')]);if(_0x50443c[_0x8488('0x32')]){delete _0x50443c[_0x8488('0x32')];}_0x39fb02['status'](_0x23f011)[_0x8488('0x33')](_0x50443c);};}exports[_0x8488('0x34')]=function(_0x35c6ce,_0x944411){var _0x3d8987={},_0x585c88={},_0x5e799c={'count':0x0,'rows':[]};var _0x4c0eac=_[_0x8488('0x35')](db[_0x8488('0x36')]['rawAttributes'],function(_0x3cb00e){return{'name':_0x3cb00e[_0x8488('0x37')],'type':_0x3cb00e['type']['key']};});_0x585c88[_0x8488('0x38')]=_[_0x8488('0x35')](_0x4c0eac,_0x8488('0x32'));_0x585c88[_0x8488('0x39')]=_[_0x8488('0x3a')](_0x35c6ce[_0x8488('0x39')]);_0x585c88[_0x8488('0x3b')]=_[_0x8488('0x3c')](_0x585c88['model'],_0x585c88[_0x8488('0x39')]);_0x3d8987['attributes']=_[_0x8488('0x3c')](_0x585c88[_0x8488('0x38')],qs[_0x8488('0x3d')](_0x35c6ce[_0x8488('0x39')][_0x8488('0x3d')]));_0x3d8987[_0x8488('0x3e')]=_0x3d8987[_0x8488('0x3e')][_0x8488('0x3f')]?_0x3d8987[_0x8488('0x3e')]:_0x585c88['model'];if(!_0x35c6ce['query'][_0x8488('0x40')](_0x8488('0x41'))){_0x3d8987[_0x8488('0x42')]=qs[_0x8488('0x42')](_0x35c6ce['query']['limit']);_0x3d8987[_0x8488('0x24')]=qs[_0x8488('0x24')](_0x35c6ce[_0x8488('0x39')][_0x8488('0x24')]);}_0x3d8987['order']=qs[_0x8488('0x43')](_0x35c6ce[_0x8488('0x39')][_0x8488('0x43')]);_0x3d8987[_0x8488('0x44')]=qs[_0x8488('0x3b')](_[_0x8488('0x45')](_0x35c6ce[_0x8488('0x39')],_0x585c88[_0x8488('0x3b')]),_0x4c0eac);if(_0x35c6ce[_0x8488('0x39')][_0x8488('0x46')]){_0x3d8987['where']=_[_0x8488('0x47')](_0x3d8987[_0x8488('0x44')],{'$or':_[_0x8488('0x35')](_0x4c0eac,function(_0x51304d){if(_0x51304d[_0x8488('0x48')]!==_0x8488('0x49')){var _0x154b11={};_0x154b11[_0x51304d[_0x8488('0x32')]]={'$like':'%'+_0x35c6ce[_0x8488('0x39')][_0x8488('0x46')]+'%'};return _0x154b11;}})});}_0x3d8987=_[_0x8488('0x47')]({},_0x3d8987,_0x35c6ce[_0x8488('0x4a')]);var _0x233ee1={'where':_0x3d8987['where']};return db['WhatsappQueue'][_0x8488('0x26')](_0x233ee1)[_0x8488('0x2c')](function(_0x2a6494){_0x5e799c[_0x8488('0x26')]=_0x2a6494;if(_0x35c6ce['query'][_0x8488('0x4b')]){_0x3d8987[_0x8488('0x4c')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x8488('0x4d')](_0x3d8987);})[_0x8488('0x2c')](function(_0x9c07a0){_0x5e799c[_0x8488('0x4e')]=_0x9c07a0;return _0x5e799c;})[_0x8488('0x2c')](respondWithFilteredResult(_0x944411,_0x3d8987))[_0x8488('0x4f')](handleError(_0x944411,null));};exports[_0x8488('0x50')]=function(_0x29a681,_0xd04d6d){var _0x6aab91={'raw':!![],'where':{'id':_0x29a681[_0x8488('0x51')]['id']}},_0x4f4b15={};_0x4f4b15[_0x8488('0x38')]=_[_0x8488('0x3a')](db[_0x8488('0x36')][_0x8488('0x52')]);_0x4f4b15['query']=_[_0x8488('0x3a')](_0x29a681['query']);_0x4f4b15['filters']=_[_0x8488('0x3c')](_0x4f4b15[_0x8488('0x38')],_0x4f4b15['query']);_0x6aab91[_0x8488('0x3e')]=_[_0x8488('0x3c')](_0x4f4b15[_0x8488('0x38')],qs[_0x8488('0x3d')](_0x29a681[_0x8488('0x39')][_0x8488('0x3d')]));_0x6aab91[_0x8488('0x3e')]=_0x6aab91[_0x8488('0x3e')][_0x8488('0x3f')]?_0x6aab91['attributes']:_0x4f4b15[_0x8488('0x38')];if(_0x29a681[_0x8488('0x39')][_0x8488('0x4b')]){_0x6aab91[_0x8488('0x4c')]=[{'all':!![]}];}_0x6aab91=_[_0x8488('0x47')]({},_0x6aab91,_0x29a681['options']);return db[_0x8488('0x36')]['find'](_0x6aab91)[_0x8488('0x2c')](handleEntityNotFound(_0xd04d6d,null))['then'](respondWithResult(_0xd04d6d,null))['catch'](handleError(_0xd04d6d,null));};exports[_0x8488('0x53')]=function(_0x1fc3f6,_0x594630){return db[_0x8488('0x36')][_0x8488('0x53')](_0x1fc3f6['body'],{})['then'](function(_0x20e95f){var _0x16bc4b=_0x1fc3f6['user'][_0x8488('0x2d')]({'plain':!![]});if(!_0x16bc4b)throw new Error(_0x8488('0x54'));if(_0x16bc4b[_0x8488('0x55')]===_0x8488('0x56')){var _0x12a548=_0x20e95f[_0x8488('0x2d')]({'plain':!![]});var _0x4b2e4c='WhatsappQueues';return db['UserProfileSection'][_0x8488('0x57')]({'where':{'name':_0x4b2e4c,'userProfileId':_0x16bc4b['userProfileId']},'raw':!![]})[_0x8488('0x2c')](function(_0x51edd3){if(_0x51edd3&&_0x51edd3[_0x8488('0x58')]===0x0){return db[_0x8488('0x2f')][_0x8488('0x53')]({'name':_0x12a548[_0x8488('0x32')],'resourceId':_0x12a548['id'],'type':_0x51edd3[_0x8488('0x32')],'sectionId':_0x51edd3['id']},{})[_0x8488('0x2c')](function(){return _0x20e95f;});}else{return _0x20e95f;}})[_0x8488('0x4f')](function(_0x1d01c0){logger[_0x8488('0x59')](_0x8488('0x5a'),_0x1d01c0);throw _0x1d01c0;});}return _0x20e95f;})[_0x8488('0x2c')](respondWithResult(_0x594630,0xc9))[_0x8488('0x4f')](handleError(_0x594630,null));};exports[_0x8488('0x2b')]=function(_0x3b2b99,_0x3d90b8){if(_0x3b2b99[_0x8488('0x5b')]['id']){delete _0x3b2b99[_0x8488('0x5b')]['id'];}return db[_0x8488('0x36')][_0x8488('0x57')]({'where':{'id':_0x3b2b99[_0x8488('0x51')]['id']}})[_0x8488('0x2c')](handleEntityNotFound(_0x3d90b8,null))['then'](saveUpdates(_0x3b2b99[_0x8488('0x5b')],null))[_0x8488('0x2c')](respondWithResult(_0x3d90b8,null))['catch'](handleError(_0x3d90b8,null));};exports['destroy']=function(_0x33430e,_0x3be701){return db[_0x8488('0x36')][_0x8488('0x57')]({'where':{'id':_0x33430e[_0x8488('0x51')]['id']}})[_0x8488('0x2c')](handleEntityNotFound(_0x3be701,null))[_0x8488('0x2c')](removeEntity(_0x3be701,null))[_0x8488('0x4f')](handleError(_0x3be701,null));};exports[_0x8488('0x5c')]=function(_0x155d4d,_0x4cbe3a){return db[_0x8488('0x36')][_0x8488('0x5c')]()[_0x8488('0x2c')](respondWithResult(_0x4cbe3a,null))[_0x8488('0x4f')](handleError(_0x4cbe3a,null));};exports[_0x8488('0x5d')]=function(_0x5056ee,_0x4af2b3,_0x351680){var _0x192c93={'raw':!![],'where':{}},_0x14f955={},_0x1af39d;return db[_0x8488('0x36')][_0x8488('0x5e')]({'where':{'id':_0x5056ee[_0x8488('0x51')]['id']}})['then'](handleEntityNotFound(_0x4af2b3,null))[_0x8488('0x2c')](function(_0x2d6ed2){if(_0x2d6ed2){_0x1af39d=_0x2d6ed2[_0x8488('0x2d')]({'plain':!![]});_0x14f955[_0x8488('0x38')]=_[_0x8488('0x3a')](db[_0x8488('0x5f')][_0x8488('0x52')]);_0x14f955[_0x8488('0x39')]=_['keys'](_0x5056ee[_0x8488('0x39')]);_0x14f955['filters']=_['intersection'](_0x14f955[_0x8488('0x38')],_0x14f955[_0x8488('0x39')]);_0x192c93[_0x8488('0x3e')]=_[_0x8488('0x3c')](_0x14f955[_0x8488('0x38')],qs[_0x8488('0x3d')](_0x5056ee[_0x8488('0x39')][_0x8488('0x3d')]));_0x192c93['attributes']=_0x192c93[_0x8488('0x3e')]['length']?_0x192c93[_0x8488('0x3e')]:_0x14f955[_0x8488('0x38')];if(!_0x5056ee['query'][_0x8488('0x40')]('nolimit')){_0x192c93[_0x8488('0x42')]=qs[_0x8488('0x42')](_0x5056ee[_0x8488('0x39')][_0x8488('0x42')]);_0x192c93['offset']=qs[_0x8488('0x24')](_0x5056ee[_0x8488('0x39')]['offset']);}_0x192c93['order']=qs[_0x8488('0x43')](_0x5056ee['query']['sort']);_0x192c93[_0x8488('0x44')]=qs['filters'](_['pick'](_0x5056ee['query'],_0x14f955[_0x8488('0x3b')]));_0x192c93[_0x8488('0x44')][_0x8488('0x60')]=_0x2d6ed2['id'];if(_0x5056ee['query']['filter']){_0x192c93[_0x8488('0x44')]=_['merge'](_0x192c93['where'],{'$or':_[_0x8488('0x35')](_0x192c93[_0x8488('0x3e')],function(_0x1a4a4b){var _0x841e58={};_0x841e58[_0x1a4a4b]={'$like':'%'+_0x5056ee[_0x8488('0x39')][_0x8488('0x46')]+'%'};return _0x841e58;})});}_0x192c93=_[_0x8488('0x47')]({},_0x192c93,_0x5056ee[_0x8488('0x4a')]);return db[_0x8488('0x5f')][_0x8488('0x4d')](_0x192c93);}})['then'](function(_0x274fe9){if(_0x274fe9){return db[_0x8488('0x61')][_0x8488('0x62')]({'where':{'id':_['map'](_0x274fe9,'UserId'),'role':'agent'},'attributes':['id',_0x8488('0x32'),_0x8488('0x63'),'updatedAt',_0x8488('0x64')]});}})['then'](function(_0x4586fb){if(_0x4586fb){return{'count':_0x4586fb[_0x8488('0x26')],'rows':_['map'](_0x4586fb['rows'],function(_0x598867){return{'membername':_0x598867[_0x8488('0x32')],'UserId':_0x598867['id'],'queue_name':_0x1af39d[_0x8488('0x32')],'WhatsappQueueId':_0x1af39d['id'],'interface':util[_0x8488('0x65')](_0x8488('0x66'),_0x8488('0x67'),_0x598867[_0x8488('0x32')]),'penalty':0x0,'paused':_0x598867[_0x8488('0x63')],'createdAt':_0x598867['createdAt'],'updatedAt':_0x598867[_0x8488('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8488('0x2c')](respondWithFilteredResult(_0x4af2b3,_0x192c93))[_0x8488('0x4f')](handleError(_0x4af2b3,null));};exports[_0x8488('0x69')]=function(_0x53ccfe,_0x311c0e,_0x18b53a){var _0x35e352={};var _0x23201a={};var _0x20506b;var _0x4ebb63;return db['WhatsappQueue'][_0x8488('0x5e')]({'where':{'id':_0x53ccfe[_0x8488('0x51')]['id']}})[_0x8488('0x2c')](handleEntityNotFound(_0x311c0e,null))[_0x8488('0x2c')](function(_0x4a523a){if(_0x4a523a){_0x20506b=_0x4a523a;_0x23201a[_0x8488('0x38')]=_['keys'](db[_0x8488('0x6a')]['rawAttributes']);_0x23201a[_0x8488('0x39')]=_[_0x8488('0x3a')](_0x53ccfe[_0x8488('0x39')]);_0x23201a['filters']=_[_0x8488('0x3c')](_0x23201a[_0x8488('0x38')],_0x23201a[_0x8488('0x39')]);_0x35e352[_0x8488('0x3e')]=_[_0x8488('0x3c')](_0x23201a['model'],qs[_0x8488('0x3d')](_0x53ccfe[_0x8488('0x39')][_0x8488('0x3d')]));_0x35e352['attributes']=_0x35e352['attributes']['length']?_0x35e352[_0x8488('0x3e')]:_0x23201a[_0x8488('0x38')];_0x35e352['order']=qs[_0x8488('0x43')](_0x53ccfe['query']['sort']);_0x35e352[_0x8488('0x44')]=qs[_0x8488('0x3b')](_['pick'](_0x53ccfe[_0x8488('0x39')],_0x23201a[_0x8488('0x3b')]));if(_0x53ccfe[_0x8488('0x39')][_0x8488('0x46')]){_0x35e352[_0x8488('0x44')]=_[_0x8488('0x47')](_0x35e352[_0x8488('0x44')],{'$or':_[_0x8488('0x35')](_0x35e352[_0x8488('0x3e')],function(_0xabc724){var _0x5528b0={};_0x5528b0[_0xabc724]={'$like':'%'+_0x53ccfe[_0x8488('0x39')][_0x8488('0x46')]+'%'};return _0x5528b0;})});}_0x35e352=_[_0x8488('0x47')]({},_0x35e352,_0x53ccfe['options']);return _0x20506b['getTeams'](_0x35e352);}})[_0x8488('0x2c')](function(_0x7e42a){if(_0x7e42a){_0x4ebb63=_0x7e42a[_0x8488('0x3f')];if(!_0x53ccfe[_0x8488('0x39')]['hasOwnProperty'](_0x8488('0x41'))){_0x35e352[_0x8488('0x42')]=qs[_0x8488('0x42')](_0x53ccfe[_0x8488('0x39')][_0x8488('0x42')]);_0x35e352[_0x8488('0x24')]=qs[_0x8488('0x24')](_0x53ccfe[_0x8488('0x39')]['offset']);}return _0x20506b['getTeams'](_0x35e352);}})['then'](function(_0x52057e){if(_0x52057e){return _0x52057e?{'count':_0x4ebb63,'rows':_0x52057e}:null;}})[_0x8488('0x2c')](respondWithResult(_0x311c0e,null))[_0x8488('0x4f')](handleError(_0x311c0e,null));};exports['addTeams']=function(_0x5d8f22,_0x34466e,_0x230f06){var _0x8f30b7=_0x5d8f22[_0x8488('0x5b')][_0x8488('0x6b')];return db[_0x8488('0x6a')][_0x8488('0x4d')]({'where':{'id':_0x8f30b7},'attributes':['id'],'include':[{'model':db[_0x8488('0x61')],'as':'Agents','attributes':['id',_0x8488('0x32'),'online',_0x8488('0x6c'),_0x8488('0x6d')],'raw':!![]}]})[_0x8488('0x2c')](function(_0x4cf749){if(_0x4cf749){var _0x1ce7ec=_[_0x8488('0x6e')](_0x4cf749,function(_0x4d14a6){var _0x4182b0=_0x4d14a6[_0x8488('0x2d')]({'plain':!![]});return _0x4182b0[_0x8488('0x6f')];});return db['WhatsappQueue'][_0x8488('0x57')]({'where':{'id':_0x5d8f22[_0x8488('0x51')]['id']}})[_0x8488('0x2c')](function(_0x447004){return db[_0x8488('0x70')]['transaction'](function(_0x4a74c2){return _0x447004[_0x8488('0x71')](_0x8f30b7,{'transaction':_0x4a74c2})[_0x8488('0x2c')](function(){return BPromise['each'](_0x1ce7ec,function(_0x84c4bc){return db[_0x8488('0x5f')][_0x8488('0x72')]({'where':{'UserId':_0x84c4bc['id'],'WhatsappQueueId':_0x5d8f22['params']['id']},'transaction':_0x4a74c2});});})['then'](function(){_0x1ce7ec[_0x8488('0x73')](function(_0x114dd0){socket[_0x8488('0x74')](_0x8488('0x75'),{'UserId':_0x114dd0['id'],'WhatsappQueueId':_0x447004['id']});});});});});}})[_0x8488('0x2c')](respondWithStatusCode(_0x34466e,null))[_0x8488('0x4f')](handleError(_0x34466e,null));};exports[_0x8488('0x76')]=function(_0x1f49b3,_0x37d6b7,_0x49aee9){return db['Team'][_0x8488('0x4d')]({'where':{'id':_0x1f49b3[_0x8488('0x39')][_0x8488('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x8488('0x61')],'as':_0x8488('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x8488('0x2c')](handleEntityNotFound(_0x37d6b7,null))[_0x8488('0x2c')](function(_0x3fecc){var _0x315521=_[_0x8488('0x35')](_0x3fecc,'id');var _0xa7c56c=[];var _0x464e05=[];var _0x4ee9a7=squel[_0x8488('0x77')]();_0x4ee9a7[_0x8488('0x78')]('tq.TeamId')[_0x8488('0x79')]('team_has_whatsapp_queues','tq')['join'](_0x8488('0x7a'),'ut',_0x8488('0x7b'))[_0x8488('0x44')](_0x8488('0x7c'),_0x1f49b3[_0x8488('0x51')]['id']);for(var _0x1228c3=0x0;_0x1228c3<_0x3fecc['length'];_0x1228c3+=0x1){let _0x580578=_0x3fecc[_0x1228c3];for(var _0x15c17a=0x0;_0x15c17a<_0x580578[_0x8488('0x6f')][_0x8488('0x3f')];_0x15c17a+=0x1){let _0x3e586e=_0x580578[_0x8488('0x6f')][_0x15c17a];var _0x527305=_0x4ee9a7[_0x8488('0x7d')]();_0x527305['where'](_0x8488('0x7e'),_0x3e586e['id']);_0x464e05[_0x8488('0x7f')](db[_0x8488('0x70')][_0x8488('0x39')](_0x527305['toString'](),{'type':db[_0x8488('0x70')]['QueryTypes'][_0x8488('0x80')]})['then'](function(_0x6f4f97){if(_0x6f4f97[_0x8488('0x3f')]===0x1){return _0x3e586e['id'];}else{var _0x138bb2=_[_0x8488('0x81')](_[_0x8488('0x35')](_0x6f4f97,_0x8488('0x82')),function(_0x38caa9){return _['includes'](_0x315521,_0x38caa9);});if(_0x138bb2){return _0x3e586e['id'];}}}));}}return BPromise[_0x8488('0x83')](_0x464e05)['then'](function(_0x4f92d9){_0xa7c56c=_(_0xa7c56c)[_0x8488('0x84')](_0x4f92d9)[_0x8488('0x85')]()[_0x8488('0x86')]();return db[_0x8488('0x36')][_0x8488('0x57')]({'where':{'id':_0x1f49b3[_0x8488('0x51')]['id']}})[_0x8488('0x2c')](function(_0x560752){return db[_0x8488('0x70')][_0x8488('0x87')](function(_0x6df055){return _0x560752[_0x8488('0x76')](_0x1f49b3['query'][_0x8488('0x6b')],{'transaction':_0x6df055})[_0x8488('0x2c')](function(){if(!_[_0x8488('0x88')](_0xa7c56c)){return _0x560752[_0x8488('0x89')](_0xa7c56c,{'transaction':_0x6df055});}})[_0x8488('0x2c')](function(){_0xa7c56c[_0x8488('0x73')](function(_0x11fddd){socket[_0x8488('0x74')](_0x8488('0x8a'),{'UserId':_0x11fddd,'WhatsappQueueId':_0x560752['id']});});});});});});})[_0x8488('0x2c')](respondWithStatusCode(_0x37d6b7,null))[_0x8488('0x4f')](handleError(_0x37d6b7,null));};exports[_0x8488('0x8b')]=function(_0x2f1f98,_0x4f3945,_0x2cc0e5){return db[_0x8488('0x36')][_0x8488('0x57')]({'where':{'id':_0x2f1f98['params']['id']}})[_0x8488('0x2c')](handleEntityNotFound(_0x4f3945,null))[_0x8488('0x2c')](function(_0x4204b4){if(_0x4204b4){return _0x4204b4[_0x8488('0x8b')](_0x2f1f98[_0x8488('0x5b')][_0x8488('0x6b')],_[_0x8488('0x8c')](_0x2f1f98[_0x8488('0x5b')],[_0x8488('0x6b'),'id'])||{})[_0x8488('0x8d')](function(_0x2c637a){for(var _0x5ad597=0x0;_0x5ad597<_0x2f1f98['body'][_0x8488('0x6b')][_0x8488('0x3f')];_0x5ad597+=0x1){socket[_0x8488('0x74')]('userWhatsappQueue:save',{'UserId':Number(_0x2f1f98[_0x8488('0x5b')]['ids'][_0x5ad597]),'WhatsappQueueId':Number(_0x2f1f98[_0x8488('0x51')]['id'])});}return _0x2c637a;});}})[_0x8488('0x2c')](respondWithResult(_0x4f3945,null))['catch'](handleError(_0x4f3945,null));};exports[_0x8488('0x89')]=function(_0xe34151,_0xd2cd64,_0x2b99bc){return db['WhatsappQueue'][_0x8488('0x57')]({'where':{'id':_0xe34151[_0x8488('0x51')]['id']}})['then'](handleEntityNotFound(_0xd2cd64,null))[_0x8488('0x2c')](function(_0x4ba295){if(_0x4ba295){return _0x4ba295[_0x8488('0x89')](_0xe34151['query'][_0x8488('0x6b')])[_0x8488('0x2c')](function(){if(_[_0x8488('0x8e')](_0xe34151['query']['ids'])){for(var _0x3b1115=0x0;_0x3b1115<_0xe34151['query'][_0x8488('0x6b')][_0x8488('0x3f')];_0x3b1115+=0x1){socket[_0x8488('0x74')]('userWhatsappQueue:remove',{'UserId':Number(_0xe34151[_0x8488('0x39')][_0x8488('0x6b')][_0x3b1115]),'WhatsappQueueId':Number(_0xe34151[_0x8488('0x51')]['id'])});}}else{socket[_0x8488('0x74')](_0x8488('0x8a'),{'UserId':Number(_0xe34151['query'][_0x8488('0x6b')]),'WhatsappQueueId':Number(_0xe34151[_0x8488('0x51')]['id'])});}});}})[_0x8488('0x2c')](respondWithStatusCode(_0xd2cd64,null))[_0x8488('0x4f')](handleError(_0xd2cd64,null));};exports['getAgents']=function(_0x5ea4b8,_0x118d5f,_0x11763e){var _0x12a5c3={};var _0x3bc80c={};var _0x25d67c;var _0x3d576b;return db[_0x8488('0x36')][_0x8488('0x5e')]({'where':{'id':_0x5ea4b8[_0x8488('0x51')]['id']}})[_0x8488('0x2c')](handleEntityNotFound(_0x118d5f,null))[_0x8488('0x2c')](function(_0x21c9d0){if(_0x21c9d0){_0x25d67c=_0x21c9d0;_0x3bc80c['model']=_['keys'](db['User'][_0x8488('0x52')]);_0x3bc80c[_0x8488('0x39')]=_[_0x8488('0x3a')](_0x5ea4b8['query']);_0x3bc80c[_0x8488('0x3b')]=_[_0x8488('0x3c')](_0x3bc80c[_0x8488('0x38')],_0x3bc80c[_0x8488('0x39')]);_0x12a5c3[_0x8488('0x3e')]=_['intersection'](_0x3bc80c[_0x8488('0x38')],qs[_0x8488('0x3d')](_0x5ea4b8[_0x8488('0x39')][_0x8488('0x3d')]));_0x12a5c3[_0x8488('0x3e')]=_0x12a5c3[_0x8488('0x3e')][_0x8488('0x3f')]?_0x12a5c3[_0x8488('0x3e')]:_0x3bc80c[_0x8488('0x38')];_0x12a5c3[_0x8488('0x8f')]=qs[_0x8488('0x43')](_0x5ea4b8[_0x8488('0x39')][_0x8488('0x43')]);_0x12a5c3[_0x8488('0x44')]=qs[_0x8488('0x3b')](_['pick'](_0x5ea4b8[_0x8488('0x39')],_0x3bc80c[_0x8488('0x3b')]));if(_0x5ea4b8[_0x8488('0x39')]['filter']){_0x12a5c3[_0x8488('0x44')]=_[_0x8488('0x47')](_0x12a5c3[_0x8488('0x44')],{'$or':_[_0x8488('0x35')](_0x12a5c3[_0x8488('0x3e')],function(_0x5cabca){var _0x3d0fd9={};_0x3d0fd9[_0x5cabca]={'$like':'%'+_0x5ea4b8[_0x8488('0x39')]['filter']+'%'};return _0x3d0fd9;})});}_0x12a5c3=_['merge']({},_0x12a5c3,_0x5ea4b8[_0x8488('0x4a')]);return _0x25d67c[_0x8488('0x90')](_0x12a5c3);}})['then'](function(_0x25b69b){if(_0x25b69b){_0x3d576b=_0x25b69b['length'];if(!_0x5ea4b8['query'][_0x8488('0x40')](_0x8488('0x41'))){_0x12a5c3[_0x8488('0x42')]=qs[_0x8488('0x42')](_0x5ea4b8[_0x8488('0x39')]['limit']);_0x12a5c3[_0x8488('0x24')]=qs[_0x8488('0x24')](_0x5ea4b8[_0x8488('0x39')]['offset']);}return _0x25d67c['getAgents'](_0x12a5c3);}})['then'](function(_0x596804){if(_0x596804){return _0x596804?{'count':_0x3d576b,'rows':_0x596804}:null;}})[_0x8488('0x2c')](respondWithResult(_0x118d5f,null))[_0x8488('0x4f')](handleError(_0x118d5f,null));}; \ No newline at end of file +var _0xcf9e=['key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','WhatsappQueue','include','show','rawAttributes','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','pick','options','UserWhatsappQueue','findAll','User','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','online','flatMap','Agents','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','map','fieldName','type'];(function(_0x1c6958,_0x122b8d){var _0x3c63d1=function(_0x3f55e3){while(--_0x3f55e3){_0x1c6958['push'](_0x1c6958['shift']());}};_0x3c63d1(++_0x122b8d);}(_0xcf9e,0xde));var _0xecf9=function(_0x3b747b,_0x307397){_0x3b747b=_0x3b747b-0x0;var _0x59a442=_0xcf9e[_0x3b747b];return _0x59a442;};'use strict';var emlformat=require(_0xecf9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecf9('0x1'));var jsonpatch=require(_0xecf9('0x2'));var rp=require(_0xecf9('0x3'));var moment=require('moment');var BPromise=require(_0xecf9('0x4'));var Mustache=require(_0xecf9('0x5'));var util=require(_0xecf9('0x6'));var path=require(_0xecf9('0x7'));var sox=require(_0xecf9('0x8'));var csv=require(_0xecf9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecf9('0xa'));var squel=require(_0xecf9('0xb'));var crypto=require(_0xecf9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xecf9('0x9'));var querystring=require(_0xecf9('0xd'));var Papa=require(_0xecf9('0xe'));var Redis=require('ioredis');var authService=require(_0xecf9('0xf'));var qs=require(_0xecf9('0x10'));var as=require(_0xecf9('0x11'));var hardwareService=require(_0xecf9('0x12'));var logger=require(_0xecf9('0x13'))('api');var utils=require(_0xecf9('0x14'));var config=require(_0xecf9('0x15'));var licenseUtil=require(_0xecf9('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xecf9('0x17')](config[_0xecf9('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xecf9('0x19'))(new Redis(config[_0xecf9('0x18')]));require(_0xecf9('0x1a'))[_0xecf9('0x1b')](socket);function respondWithStatusCode(_0x3e3f39,_0x3e6a0c){_0x3e6a0c=_0x3e6a0c||0xcc;return function(_0xd55eb6){if(_0xd55eb6){return _0x3e3f39['sendStatus'](_0x3e6a0c);}return _0x3e3f39[_0xecf9('0x1c')](_0x3e6a0c)[_0xecf9('0x1d')]();};}function respondWithResult(_0x41c12a,_0x2452dc){_0x2452dc=_0x2452dc||0xc8;return function(_0x3276bb){if(_0x3276bb){return _0x41c12a['status'](_0x2452dc)[_0xecf9('0x1e')](_0x3276bb);}};}function respondWithFilteredResult(_0x52a7cc,_0x2c7abc){return function(_0x4e9d58){if(_0x4e9d58){var _0x5b653b=typeof _0x2c7abc[_0xecf9('0x1f')]===_0xecf9('0x20')&&typeof _0x2c7abc[_0xecf9('0x21')]===_0xecf9('0x20');var _0x13a7b8=_0x4e9d58[_0xecf9('0x22')];var _0x571c1b=_0x5b653b?0x0:_0x2c7abc[_0xecf9('0x1f')];var _0x131136=_0x5b653b?_0x4e9d58['count']:_0x2c7abc[_0xecf9('0x1f')]+_0x2c7abc[_0xecf9('0x21')];var _0x2bf2e3;if(_0x131136>=_0x13a7b8){_0x131136=_0x13a7b8;_0x2bf2e3=0xc8;}else{_0x2bf2e3=0xce;}_0x52a7cc['status'](_0x2bf2e3);return _0x52a7cc['set'](_0xecf9('0x23'),_0x571c1b+'-'+_0x131136+'/'+_0x13a7b8)['json'](_0x4e9d58);}return null;};}function patchUpdates(_0xd7ce44){return function(_0x5776b9){try{jsonpatch[_0xecf9('0x24')](_0x5776b9,_0xd7ce44,!![]);}catch(_0x2f4067){return BPromise[_0xecf9('0x25')](_0x2f4067);}return _0x5776b9[_0xecf9('0x26')]();};}function saveUpdates(_0x2f62de,_0x3ccce8){return function(_0x162c7a){if(_0x162c7a){return _0x162c7a['update'](_0x2f62de)[_0xecf9('0x27')](function(_0x2e498c){return _0x2e498c;});}return null;};}function removeEntity(_0x33742c,_0x5d601b){return function(_0x26b93b){if(_0x26b93b){return _0x26b93b[_0xecf9('0x28')]()[_0xecf9('0x27')](function(){var _0x475f57=_0x26b93b[_0xecf9('0x29')]({'plain':!![]});var _0x14fffa=_0xecf9('0x2a');return db[_0xecf9('0x2b')][_0xecf9('0x28')]({'where':{'type':_0x14fffa,'resourceId':_0x475f57['id']}})[_0xecf9('0x27')](function(){return _0x26b93b;});})[_0xecf9('0x27')](function(){_0x33742c['status'](0xcc)[_0xecf9('0x1d')]();});}};}function handleEntityNotFound(_0x1e0ccc,_0x291e8d){return function(_0x28da7e){if(!_0x28da7e){_0x1e0ccc['sendStatus'](0x194);}return _0x28da7e;};}function handleError(_0x2bd09c,_0x17827b){_0x17827b=_0x17827b||0x1f4;return function(_0x24ede9){logger[_0xecf9('0x2c')](_0x24ede9['stack']);if(_0x24ede9[_0xecf9('0x2d')]){delete _0x24ede9['name'];}_0x2bd09c[_0xecf9('0x1c')](_0x17827b)[_0xecf9('0x2e')](_0x24ede9);};}exports['index']=function(_0x153da5,_0x3bc983){var _0xc7b1a5={},_0x37f810={},_0x3a2895={'count':0x0,'rows':[]};var _0x1103cd=_[_0xecf9('0x2f')](db['WhatsappQueue']['rawAttributes'],function(_0x3e528f){return{'name':_0x3e528f[_0xecf9('0x30')],'type':_0x3e528f[_0xecf9('0x31')][_0xecf9('0x32')]};});_0x37f810['model']=_[_0xecf9('0x2f')](_0x1103cd,_0xecf9('0x2d'));_0x37f810[_0xecf9('0x33')]=_['keys'](_0x153da5['query']);_0x37f810[_0xecf9('0x34')]=_[_0xecf9('0x35')](_0x37f810[_0xecf9('0x36')],_0x37f810[_0xecf9('0x33')]);_0xc7b1a5[_0xecf9('0x37')]=_['intersection'](_0x37f810['model'],qs[_0xecf9('0x38')](_0x153da5['query']['fields']));_0xc7b1a5[_0xecf9('0x37')]=_0xc7b1a5[_0xecf9('0x37')]['length']?_0xc7b1a5[_0xecf9('0x37')]:_0x37f810[_0xecf9('0x36')];if(!_0x153da5['query'][_0xecf9('0x39')](_0xecf9('0x3a'))){_0xc7b1a5[_0xecf9('0x21')]=qs[_0xecf9('0x21')](_0x153da5[_0xecf9('0x33')][_0xecf9('0x21')]);_0xc7b1a5[_0xecf9('0x1f')]=qs[_0xecf9('0x1f')](_0x153da5[_0xecf9('0x33')][_0xecf9('0x1f')]);}_0xc7b1a5[_0xecf9('0x3b')]=qs[_0xecf9('0x3c')](_0x153da5[_0xecf9('0x33')][_0xecf9('0x3c')]);_0xc7b1a5[_0xecf9('0x3d')]=qs[_0xecf9('0x34')](_['pick'](_0x153da5[_0xecf9('0x33')],_0x37f810[_0xecf9('0x34')]),_0x1103cd);if(_0x153da5['query'][_0xecf9('0x3e')]){_0xc7b1a5[_0xecf9('0x3d')]=_[_0xecf9('0x3f')](_0xc7b1a5[_0xecf9('0x3d')],{'$or':_[_0xecf9('0x2f')](_0x1103cd,function(_0xb421c8){if(_0xb421c8['type']!==_0xecf9('0x40')){var _0x4eff1e={};_0x4eff1e[_0xb421c8[_0xecf9('0x2d')]]={'$like':'%'+_0x153da5[_0xecf9('0x33')][_0xecf9('0x3e')]+'%'};return _0x4eff1e;}})});}_0xc7b1a5=_[_0xecf9('0x3f')]({},_0xc7b1a5,_0x153da5['options']);var _0x425c29={'where':_0xc7b1a5[_0xecf9('0x3d')]};return db[_0xecf9('0x41')][_0xecf9('0x22')](_0x425c29)[_0xecf9('0x27')](function(_0x535424){_0x3a2895[_0xecf9('0x22')]=_0x535424;if(_0x153da5[_0xecf9('0x33')]['includeAll']){_0xc7b1a5[_0xecf9('0x42')]=[{'all':!![]}];}return db[_0xecf9('0x41')]['findAll'](_0xc7b1a5);})['then'](function(_0x2e42e9){_0x3a2895['rows']=_0x2e42e9;return _0x3a2895;})[_0xecf9('0x27')](respondWithFilteredResult(_0x3bc983,_0xc7b1a5))['catch'](handleError(_0x3bc983,null));};exports[_0xecf9('0x43')]=function(_0x242183,_0x1844d3){var _0x48512e={'raw':!![],'where':{'id':_0x242183['params']['id']}},_0x2cf9e7={};_0x2cf9e7['model']=_['keys'](db[_0xecf9('0x41')][_0xecf9('0x44')]);_0x2cf9e7[_0xecf9('0x33')]=_[_0xecf9('0x45')](_0x242183[_0xecf9('0x33')]);_0x2cf9e7[_0xecf9('0x34')]=_[_0xecf9('0x35')](_0x2cf9e7[_0xecf9('0x36')],_0x2cf9e7[_0xecf9('0x33')]);_0x48512e[_0xecf9('0x37')]=_[_0xecf9('0x35')](_0x2cf9e7['model'],qs['fields'](_0x242183[_0xecf9('0x33')][_0xecf9('0x38')]));_0x48512e[_0xecf9('0x37')]=_0x48512e[_0xecf9('0x37')][_0xecf9('0x46')]?_0x48512e[_0xecf9('0x37')]:_0x2cf9e7[_0xecf9('0x36')];if(_0x242183['query']['includeAll']){_0x48512e[_0xecf9('0x42')]=[{'all':!![]}];}_0x48512e=_[_0xecf9('0x3f')]({},_0x48512e,_0x242183['options']);return db[_0xecf9('0x41')][_0xecf9('0x47')](_0x48512e)['then'](handleEntityNotFound(_0x1844d3,null))['then'](respondWithResult(_0x1844d3,null))['catch'](handleError(_0x1844d3,null));};exports['create']=function(_0x365c19,_0x40f50d){return db[_0xecf9('0x41')][_0xecf9('0x48')](_0x365c19[_0xecf9('0x49')],{})[_0xecf9('0x27')](function(_0x2a6325){var _0x38f0c6=_0x365c19['user']['get']({'plain':!![]});if(!_0x38f0c6)throw new Error(_0xecf9('0x4a'));if(_0x38f0c6['role']===_0xecf9('0x4b')){var _0x41986c=_0x2a6325[_0xecf9('0x29')]({'plain':!![]});var _0x24a67a=_0xecf9('0x2a');return db[_0xecf9('0x4c')]['find']({'where':{'name':_0x24a67a,'userProfileId':_0x38f0c6[_0xecf9('0x4d')]},'raw':!![]})[_0xecf9('0x27')](function(_0x5c2d71){if(_0x5c2d71&&_0x5c2d71[_0xecf9('0x4e')]===0x0){return db[_0xecf9('0x2b')]['create']({'name':_0x41986c[_0xecf9('0x2d')],'resourceId':_0x41986c['id'],'type':_0x5c2d71[_0xecf9('0x2d')],'sectionId':_0x5c2d71['id']},{})[_0xecf9('0x27')](function(){return _0x2a6325;});}else{return _0x2a6325;}})[_0xecf9('0x4f')](function(_0x438430){logger[_0xecf9('0x2c')](_0xecf9('0x50'),_0x438430);throw _0x438430;});}return _0x2a6325;})[_0xecf9('0x27')](respondWithResult(_0x40f50d,0xc9))[_0xecf9('0x4f')](handleError(_0x40f50d,null));};exports[_0xecf9('0x51')]=function(_0x52809c,_0x1955ae){if(_0x52809c[_0xecf9('0x49')]['id']){delete _0x52809c[_0xecf9('0x49')]['id'];}return db[_0xecf9('0x41')][_0xecf9('0x47')]({'where':{'id':_0x52809c[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x1955ae,null))[_0xecf9('0x27')](saveUpdates(_0x52809c[_0xecf9('0x49')],null))[_0xecf9('0x27')](respondWithResult(_0x1955ae,null))[_0xecf9('0x4f')](handleError(_0x1955ae,null));};exports[_0xecf9('0x28')]=function(_0xa24541,_0x2915f6){return db[_0xecf9('0x41')][_0xecf9('0x47')]({'where':{'id':_0xa24541[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x2915f6,null))[_0xecf9('0x27')](removeEntity(_0x2915f6,null))[_0xecf9('0x4f')](handleError(_0x2915f6,null));};exports[_0xecf9('0x53')]=function(_0x263055,_0x10c5a5){return db['WhatsappQueue'][_0xecf9('0x53')]()['then'](respondWithResult(_0x10c5a5,null))['catch'](handleError(_0x10c5a5,null));};exports[_0xecf9('0x54')]=function(_0x143d53,_0x436795,_0x43f8c1){var _0x57275c={'raw':!![],'where':{}},_0x4bbc6d={},_0x279bf1;return db['WhatsappQueue'][_0xecf9('0x55')]({'where':{'id':_0x143d53[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x436795,null))[_0xecf9('0x27')](function(_0x2aa4d2){if(_0x2aa4d2){_0x279bf1=_0x2aa4d2[_0xecf9('0x29')]({'plain':!![]});_0x4bbc6d[_0xecf9('0x36')]=_[_0xecf9('0x45')](db['UserWhatsappQueue'][_0xecf9('0x44')]);_0x4bbc6d[_0xecf9('0x33')]=_[_0xecf9('0x45')](_0x143d53[_0xecf9('0x33')]);_0x4bbc6d['filters']=_['intersection'](_0x4bbc6d['model'],_0x4bbc6d[_0xecf9('0x33')]);_0x57275c[_0xecf9('0x37')]=_['intersection'](_0x4bbc6d[_0xecf9('0x36')],qs[_0xecf9('0x38')](_0x143d53[_0xecf9('0x33')][_0xecf9('0x38')]));_0x57275c[_0xecf9('0x37')]=_0x57275c[_0xecf9('0x37')][_0xecf9('0x46')]?_0x57275c[_0xecf9('0x37')]:_0x4bbc6d[_0xecf9('0x36')];if(!_0x143d53[_0xecf9('0x33')]['hasOwnProperty']('nolimit')){_0x57275c[_0xecf9('0x21')]=qs[_0xecf9('0x21')](_0x143d53[_0xecf9('0x33')][_0xecf9('0x21')]);_0x57275c[_0xecf9('0x1f')]=qs[_0xecf9('0x1f')](_0x143d53[_0xecf9('0x33')][_0xecf9('0x1f')]);}_0x57275c[_0xecf9('0x3b')]=qs[_0xecf9('0x3c')](_0x143d53['query'][_0xecf9('0x3c')]);_0x57275c[_0xecf9('0x3d')]=qs[_0xecf9('0x34')](_[_0xecf9('0x56')](_0x143d53['query'],_0x4bbc6d[_0xecf9('0x34')]));_0x57275c[_0xecf9('0x3d')]['WhatsappQueueId']=_0x2aa4d2['id'];if(_0x143d53[_0xecf9('0x33')][_0xecf9('0x3e')]){_0x57275c['where']=_[_0xecf9('0x3f')](_0x57275c['where'],{'$or':_[_0xecf9('0x2f')](_0x57275c['attributes'],function(_0xca2732){var _0x10fdbf={};_0x10fdbf[_0xca2732]={'$like':'%'+_0x143d53[_0xecf9('0x33')][_0xecf9('0x3e')]+'%'};return _0x10fdbf;})});}_0x57275c=_[_0xecf9('0x3f')]({},_0x57275c,_0x143d53[_0xecf9('0x57')]);return db[_0xecf9('0x58')][_0xecf9('0x59')](_0x57275c);}})[_0xecf9('0x27')](function(_0x13b7d8){if(_0x13b7d8){return db[_0xecf9('0x5a')]['findAndCountAll']({'where':{'id':_['map'](_0x13b7d8,'UserId'),'role':'agent'},'attributes':['id',_0xecf9('0x2d'),_0xecf9('0x5b'),'updatedAt',_0xecf9('0x5c')]});}})[_0xecf9('0x27')](function(_0x114a17){if(_0x114a17){return{'count':_0x114a17[_0xecf9('0x22')],'rows':_[_0xecf9('0x2f')](_0x114a17['rows'],function(_0xd7a5b2){return{'membername':_0xd7a5b2['name'],'UserId':_0xd7a5b2['id'],'queue_name':_0x279bf1[_0xecf9('0x2d')],'WhatsappQueueId':_0x279bf1['id'],'interface':util[_0xecf9('0x5d')](_0xecf9('0x5e'),_0xecf9('0x5f'),_0xd7a5b2['name']),'penalty':0x0,'paused':_0xd7a5b2[_0xecf9('0x5b')],'createdAt':_0xd7a5b2[_0xecf9('0x5c')],'updatedAt':_0xd7a5b2[_0xecf9('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xecf9('0x27')](respondWithFilteredResult(_0x436795,_0x57275c))[_0xecf9('0x4f')](handleError(_0x436795,null));};exports[_0xecf9('0x61')]=function(_0x388a80,_0x197e82,_0x11b905){var _0x591803={};var _0x1c6cf0={};var _0x20e4ce;var _0x269237;return db[_0xecf9('0x41')][_0xecf9('0x55')]({'where':{'id':_0x388a80[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x197e82,null))[_0xecf9('0x27')](function(_0x5ad0e2){if(_0x5ad0e2){_0x20e4ce=_0x5ad0e2;_0x1c6cf0['model']=_['keys'](db[_0xecf9('0x62')][_0xecf9('0x44')]);_0x1c6cf0[_0xecf9('0x33')]=_[_0xecf9('0x45')](_0x388a80[_0xecf9('0x33')]);_0x1c6cf0[_0xecf9('0x34')]=_[_0xecf9('0x35')](_0x1c6cf0[_0xecf9('0x36')],_0x1c6cf0[_0xecf9('0x33')]);_0x591803[_0xecf9('0x37')]=_[_0xecf9('0x35')](_0x1c6cf0[_0xecf9('0x36')],qs[_0xecf9('0x38')](_0x388a80[_0xecf9('0x33')][_0xecf9('0x38')]));_0x591803['attributes']=_0x591803[_0xecf9('0x37')][_0xecf9('0x46')]?_0x591803['attributes']:_0x1c6cf0[_0xecf9('0x36')];_0x591803[_0xecf9('0x3b')]=qs[_0xecf9('0x3c')](_0x388a80[_0xecf9('0x33')][_0xecf9('0x3c')]);_0x591803[_0xecf9('0x3d')]=qs[_0xecf9('0x34')](_[_0xecf9('0x56')](_0x388a80['query'],_0x1c6cf0[_0xecf9('0x34')]));if(_0x388a80[_0xecf9('0x33')][_0xecf9('0x3e')]){_0x591803[_0xecf9('0x3d')]=_[_0xecf9('0x3f')](_0x591803['where'],{'$or':_[_0xecf9('0x2f')](_0x591803[_0xecf9('0x37')],function(_0x248ba9){var _0x467fda={};_0x467fda[_0x248ba9]={'$like':'%'+_0x388a80[_0xecf9('0x33')][_0xecf9('0x3e')]+'%'};return _0x467fda;})});}_0x591803=_[_0xecf9('0x3f')]({},_0x591803,_0x388a80[_0xecf9('0x57')]);return _0x20e4ce['getTeams'](_0x591803);}})[_0xecf9('0x27')](function(_0x4af1cd){if(_0x4af1cd){_0x269237=_0x4af1cd[_0xecf9('0x46')];if(!_0x388a80[_0xecf9('0x33')][_0xecf9('0x39')]('nolimit')){_0x591803[_0xecf9('0x21')]=qs[_0xecf9('0x21')](_0x388a80[_0xecf9('0x33')][_0xecf9('0x21')]);_0x591803[_0xecf9('0x1f')]=qs[_0xecf9('0x1f')](_0x388a80[_0xecf9('0x33')][_0xecf9('0x1f')]);}return _0x20e4ce['getTeams'](_0x591803);}})['then'](function(_0x2c7d3a){if(_0x2c7d3a){return _0x2c7d3a?{'count':_0x269237,'rows':_0x2c7d3a}:null;}})[_0xecf9('0x27')](respondWithResult(_0x197e82,null))[_0xecf9('0x4f')](handleError(_0x197e82,null));};exports[_0xecf9('0x63')]=function(_0x241650,_0x1fffbf,_0x37a835){var _0x4dfd1c=_0x241650['body'][_0xecf9('0x64')];return db[_0xecf9('0x62')][_0xecf9('0x59')]({'where':{'id':_0x4dfd1c},'attributes':['id'],'include':[{'model':db[_0xecf9('0x5a')],'as':'Agents','attributes':['id',_0xecf9('0x2d'),_0xecf9('0x65'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x4371d1){if(_0x4371d1){var _0x267ecd=_[_0xecf9('0x66')](_0x4371d1,function(_0x3cc8de){var _0x1eb60a=_0x3cc8de[_0xecf9('0x29')]({'plain':!![]});return _0x1eb60a[_0xecf9('0x67')];});return db['WhatsappQueue']['find']({'where':{'id':_0x241650[_0xecf9('0x52')]['id']}})['then'](function(_0xfa3f30){return db['sequelize'][_0xecf9('0x68')](function(_0x3daa3b){return _0xfa3f30[_0xecf9('0x63')](_0x4dfd1c,{'transaction':_0x3daa3b})[_0xecf9('0x27')](function(){return BPromise[_0xecf9('0x69')](_0x267ecd,function(_0x180b1a){return db['UserWhatsappQueue'][_0xecf9('0x6a')]({'where':{'UserId':_0x180b1a['id'],'WhatsappQueueId':_0x241650[_0xecf9('0x52')]['id']},'transaction':_0x3daa3b});});})[_0xecf9('0x27')](function(){_0x267ecd['forEach'](function(_0x6a1eca){socket[_0xecf9('0x6b')](_0xecf9('0x6c'),{'UserId':_0x6a1eca['id'],'WhatsappQueueId':_0xfa3f30['id']});});});});});}})[_0xecf9('0x27')](respondWithStatusCode(_0x1fffbf,null))['catch'](handleError(_0x1fffbf,null));};exports[_0xecf9('0x6d')]=function(_0x1689d0,_0x164b2f,_0x3ab4cd){return db['Team'][_0xecf9('0x59')]({'where':{'id':_0x1689d0[_0xecf9('0x33')][_0xecf9('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xecf9('0x67'),'attributes':['id'],'raw':!![]}]})[_0xecf9('0x27')](handleEntityNotFound(_0x164b2f,null))[_0xecf9('0x27')](function(_0x2bdd5b){var _0x325340=_[_0xecf9('0x2f')](_0x2bdd5b,'id');var _0x44b480=[];var _0x531ae6=[];var _0x1c13e8=squel[_0xecf9('0x6e')]();_0x1c13e8['field'](_0xecf9('0x6f'))['from']('team_has_whatsapp_queues','tq')[_0xecf9('0x70')](_0xecf9('0x71'),'ut',_0xecf9('0x72'))[_0xecf9('0x3d')](_0xecf9('0x73'),_0x1689d0[_0xecf9('0x52')]['id']);for(var _0x3a86ae=0x0;_0x3a86ae<_0x2bdd5b[_0xecf9('0x46')];_0x3a86ae+=0x1){let _0x479490=_0x2bdd5b[_0x3a86ae];for(var _0x1c8e9d=0x0;_0x1c8e9d<_0x479490[_0xecf9('0x67')][_0xecf9('0x46')];_0x1c8e9d+=0x1){let _0x3023ab=_0x479490[_0xecf9('0x67')][_0x1c8e9d];var _0x57f572=_0x1c13e8['clone']();_0x57f572[_0xecf9('0x3d')](_0xecf9('0x74'),_0x3023ab['id']);_0x531ae6[_0xecf9('0x75')](db[_0xecf9('0x76')][_0xecf9('0x33')](_0x57f572[_0xecf9('0x77')](),{'type':db[_0xecf9('0x76')]['QueryTypes'][_0xecf9('0x78')]})[_0xecf9('0x27')](function(_0xdc3b3f){if(_0xdc3b3f['length']===0x1){return _0x3023ab['id'];}else{var _0x12249c=_[_0xecf9('0x79')](_[_0xecf9('0x2f')](_0xdc3b3f,_0xecf9('0x7a')),function(_0x222ba0){return _[_0xecf9('0x7b')](_0x325340,_0x222ba0);});if(_0x12249c){return _0x3023ab['id'];}}}));}}return BPromise['all'](_0x531ae6)[_0xecf9('0x27')](function(_0x2ef8ea){_0x44b480=_(_0x44b480)[_0xecf9('0x7c')](_0x2ef8ea)[_0xecf9('0x7d')]()[_0xecf9('0x7e')]();return db[_0xecf9('0x41')][_0xecf9('0x47')]({'where':{'id':_0x1689d0[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](function(_0x17eb69){return db[_0xecf9('0x76')][_0xecf9('0x68')](function(_0x1df839){return _0x17eb69['removeTeams'](_0x1689d0[_0xecf9('0x33')][_0xecf9('0x64')],{'transaction':_0x1df839})[_0xecf9('0x27')](function(){if(!_[_0xecf9('0x7f')](_0x44b480)){return _0x17eb69[_0xecf9('0x80')](_0x44b480,{'transaction':_0x1df839});}})['then'](function(){_0x44b480[_0xecf9('0x81')](function(_0x1b5601){socket[_0xecf9('0x6b')](_0xecf9('0x82'),{'UserId':_0x1b5601,'WhatsappQueueId':_0x17eb69['id']});});});});});});})[_0xecf9('0x27')](respondWithStatusCode(_0x164b2f,null))[_0xecf9('0x4f')](handleError(_0x164b2f,null));};exports[_0xecf9('0x83')]=function(_0x1909c7,_0x48197b,_0xf33e2f){return db['WhatsappQueue'][_0xecf9('0x47')]({'where':{'id':_0x1909c7[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x48197b,null))['then'](function(_0x5a8203){if(_0x5a8203){return _0x5a8203[_0xecf9('0x83')](_0x1909c7[_0xecf9('0x49')][_0xecf9('0x64')],_[_0xecf9('0x84')](_0x1909c7[_0xecf9('0x49')],[_0xecf9('0x64'),'id'])||{})[_0xecf9('0x85')](function(_0xa088aa){for(var _0x4ef391=0x0;_0x4ef391<_0x1909c7['body'][_0xecf9('0x64')][_0xecf9('0x46')];_0x4ef391+=0x1){socket[_0xecf9('0x6b')]('userWhatsappQueue:save',{'UserId':Number(_0x1909c7[_0xecf9('0x49')]['ids'][_0x4ef391]),'WhatsappQueueId':Number(_0x1909c7[_0xecf9('0x52')]['id'])});}return _0xa088aa;});}})[_0xecf9('0x27')](respondWithResult(_0x48197b,null))['catch'](handleError(_0x48197b,null));};exports[_0xecf9('0x80')]=function(_0x4fafbc,_0x5618a1,_0x80a650){return db[_0xecf9('0x41')][_0xecf9('0x47')]({'where':{'id':_0x4fafbc[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x5618a1,null))[_0xecf9('0x27')](function(_0x554d6a){if(_0x554d6a){return _0x554d6a[_0xecf9('0x80')](_0x4fafbc[_0xecf9('0x33')][_0xecf9('0x64')])[_0xecf9('0x27')](function(){if(_[_0xecf9('0x86')](_0x4fafbc['query'][_0xecf9('0x64')])){for(var _0xa71325=0x0;_0xa71325<_0x4fafbc[_0xecf9('0x33')][_0xecf9('0x64')][_0xecf9('0x46')];_0xa71325+=0x1){socket[_0xecf9('0x6b')]('userWhatsappQueue:remove',{'UserId':Number(_0x4fafbc[_0xecf9('0x33')][_0xecf9('0x64')][_0xa71325]),'WhatsappQueueId':Number(_0x4fafbc['params']['id'])});}}else{socket[_0xecf9('0x6b')](_0xecf9('0x82'),{'UserId':Number(_0x4fafbc[_0xecf9('0x33')]['ids']),'WhatsappQueueId':Number(_0x4fafbc[_0xecf9('0x52')]['id'])});}});}})[_0xecf9('0x27')](respondWithStatusCode(_0x5618a1,null))[_0xecf9('0x4f')](handleError(_0x5618a1,null));};exports[_0xecf9('0x87')]=function(_0x5c1f57,_0x49484e,_0x1750ab){var _0x48520d={};var _0x232363={};var _0x1615db;var _0x2b2da2;return db[_0xecf9('0x41')][_0xecf9('0x55')]({'where':{'id':_0x5c1f57[_0xecf9('0x52')]['id']}})[_0xecf9('0x27')](handleEntityNotFound(_0x49484e,null))[_0xecf9('0x27')](function(_0x408ca4){if(_0x408ca4){_0x1615db=_0x408ca4;_0x232363[_0xecf9('0x36')]=_[_0xecf9('0x45')](db[_0xecf9('0x5a')][_0xecf9('0x44')]);_0x232363[_0xecf9('0x33')]=_['keys'](_0x5c1f57[_0xecf9('0x33')]);_0x232363[_0xecf9('0x34')]=_[_0xecf9('0x35')](_0x232363[_0xecf9('0x36')],_0x232363[_0xecf9('0x33')]);_0x48520d[_0xecf9('0x37')]=_[_0xecf9('0x35')](_0x232363[_0xecf9('0x36')],qs[_0xecf9('0x38')](_0x5c1f57[_0xecf9('0x33')][_0xecf9('0x38')]));_0x48520d[_0xecf9('0x37')]=_0x48520d[_0xecf9('0x37')][_0xecf9('0x46')]?_0x48520d[_0xecf9('0x37')]:_0x232363[_0xecf9('0x36')];_0x48520d[_0xecf9('0x3b')]=qs['sort'](_0x5c1f57['query'][_0xecf9('0x3c')]);_0x48520d['where']=qs[_0xecf9('0x34')](_['pick'](_0x5c1f57[_0xecf9('0x33')],_0x232363[_0xecf9('0x34')]));if(_0x5c1f57[_0xecf9('0x33')][_0xecf9('0x3e')]){_0x48520d[_0xecf9('0x3d')]=_[_0xecf9('0x3f')](_0x48520d['where'],{'$or':_[_0xecf9('0x2f')](_0x48520d[_0xecf9('0x37')],function(_0x25b520){var _0x27dec5={};_0x27dec5[_0x25b520]={'$like':'%'+_0x5c1f57[_0xecf9('0x33')][_0xecf9('0x3e')]+'%'};return _0x27dec5;})});}_0x48520d=_['merge']({},_0x48520d,_0x5c1f57[_0xecf9('0x57')]);return _0x1615db['getAgents'](_0x48520d);}})[_0xecf9('0x27')](function(_0x39e669){if(_0x39e669){_0x2b2da2=_0x39e669[_0xecf9('0x46')];if(!_0x5c1f57['query']['hasOwnProperty']('nolimit')){_0x48520d[_0xecf9('0x21')]=qs['limit'](_0x5c1f57[_0xecf9('0x33')][_0xecf9('0x21')]);_0x48520d[_0xecf9('0x1f')]=qs['offset'](_0x5c1f57['query']['offset']);}return _0x1615db[_0xecf9('0x87')](_0x48520d);}})[_0xecf9('0x27')](function(_0x3113e7){if(_0x3113e7){return _0x3113e7?{'count':_0x2b2da2,'rows':_0x3113e7}:null;}})['then'](respondWithResult(_0x49484e,null))[_0xecf9('0x4f')](handleError(_0x49484e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6283dfe..bc2d02b 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 _0x57af=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x51048e,_0x5f33d4){var _0x14cbab=function(_0xdda216){while(--_0xdda216){_0x51048e['push'](_0x51048e['shift']());}};_0x14cbab(++_0x5f33d4);}(_0x57af,0x180));var _0xf57a=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x57af[_0x164eca];return _0x2ce562;};'use strict';var EventEmitter=require(_0xf57a('0x0'));var WhatsappQueue=require(_0xf57a('0x1'))['db'][_0xf57a('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf57a('0x3')](0x0);var events={'afterCreate':_0xf57a('0x4'),'afterUpdate':_0xf57a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x343f6f){return function(_0x52c393,_0x35c001,_0x3ad33a){WhatsappQueueEvents[_0xf57a('0x6')](_0x343f6f+':'+_0x52c393['id'],_0x52c393);WhatsappQueueEvents[_0xf57a('0x6')](_0x343f6f,_0x52c393);_0x3ad33a(null);};}for(var e in events){if(events[_0xf57a('0x7')](e)){var event=events[e];WhatsappQueue[_0xf57a('0x8')](e,emitEvent(event));}}module[_0xf57a('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x2c7c=['hasOwnProperty','hook','exports','setMaxListeners','save','update','remove','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2c7c,0x193));var _0xc2c7=function(_0x2e41c7,_0xd5fae7){_0x2e41c7=_0x2e41c7-0x0;var _0x3d4308=_0x2c7c[_0x2e41c7];return _0x3d4308;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc2c7('0x0')](0x0);var events={'afterCreate':_0xc2c7('0x1'),'afterUpdate':_0xc2c7('0x2'),'afterDestroy':_0xc2c7('0x3')};function emitEvent(_0x562274){return function(_0x19271e,_0x1b1633,_0x15df9e){WhatsappQueueEvents['emit'](_0x562274+':'+_0x19271e['id'],_0x19271e);WhatsappQueueEvents[_0xc2c7('0x4')](_0x562274,_0x19271e);_0x15df9e(null);};}for(var e in events){if(events[_0xc2c7('0x5')](e)){var event=events[e];WhatsappQueue[_0xc2c7('0x6')](e,emitEvent(event));}}module[_0xc2c7('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 99b9227..290f347 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 _0x7072=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x58b5ce,_0x175830){var _0x52204b=function(_0x193553){while(--_0x193553){_0x58b5ce['push'](_0x58b5ce['shift']());}};_0x52204b(++_0x175830);}(_0x7072,0x1e7));var _0x2707=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x7072[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0x2707('0x0'));var util=require(_0x2707('0x1'));var logger=require(_0x2707('0x2'))('api');var moment=require(_0x2707('0x3'));var BPromise=require(_0x2707('0x4'));var rp=require(_0x2707('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2707('0x6'));var config=require(_0x2707('0x7'));var attributes=require(_0x2707('0x8'));module[_0x2707('0x9')]=function(_0x511b28,_0x441dd9){return _0x511b28[_0x2707('0xa')](_0x2707('0xb'),attributes,{'tableName':_0x2707('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4589=['define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4e7e3f,_0x2adb53){var _0x537ef0=function(_0x3c8843){while(--_0x3c8843){_0x4e7e3f['push'](_0x4e7e3f['shift']());}};_0x537ef0(++_0x2adb53);}(_0x4589,0x145));var _0x9458=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4589[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x9458('0x0'));var util=require(_0x9458('0x1'));var logger=require(_0x9458('0x2'))(_0x9458('0x3'));var moment=require(_0x9458('0x4'));var BPromise=require(_0x9458('0x5'));var rp=require(_0x9458('0x6'));var fs=require('fs');var path=require(_0x9458('0x7'));var rimraf=require(_0x9458('0x8'));var config=require(_0x9458('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0x9458('0xa')]=function(_0x27fa6f,_0x294a25){return _0x27fa6f[_0x9458('0xb')](_0x9458('0xc'),attributes,{'tableName':_0x9458('0xd'),'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 201326b..9cae03e 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 _0xb5ff=['debug','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','request','then','info','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include','map','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5ff,0x16b));var _0xfb5f=function(_0x1dab5f,_0x10cd21){_0x1dab5f=_0x1dab5f-0x0;var _0x40c2f3=_0xb5ff[_0x1dab5f];return _0x40c2f3;};'use strict';var _=require(_0xfb5f('0x0'));var util=require(_0xfb5f('0x1'));var moment=require(_0xfb5f('0x2'));var BPromise=require(_0xfb5f('0x3'));var rs=require(_0xfb5f('0x4'));var fs=require('fs');var Redis=require(_0xfb5f('0x5'));var db=require(_0xfb5f('0x6'))['db'];var utils=require(_0xfb5f('0x7'));var logger=require(_0xfb5f('0x8'))(_0xfb5f('0x9'));var config=require(_0xfb5f('0xa'));var jayson=require(_0xfb5f('0xb'));var client=jayson[_0xfb5f('0xc')][_0xfb5f('0xd')]({'port':0x232a});config[_0xfb5f('0xe')]=_[_0xfb5f('0xf')](config['redis'],{'host':_0xfb5f('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb5f('0xe')]));require(_0xfb5f('0x11'))['register'](socket);function respondWithRpcPromise(_0x5ac509,_0x1c62c5,_0x136be3){return new BPromise(function(_0xf27873,_0x1fcfee){return client[_0xfb5f('0x12')](_0x5ac509,_0x136be3)[_0xfb5f('0x13')](function(_0xfd52aa){logger[_0xfb5f('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x1c62c5,_0xfb5f('0x15'));logger['debug'](_0xfb5f('0x16'),_0x1c62c5,_0xfb5f('0x15'),JSON['stringify'](_0xfd52aa));if(_0xfd52aa[_0xfb5f('0x17')]){if(_0xfd52aa[_0xfb5f('0x17')][_0xfb5f('0x18')]===0x1f4){logger['error'](_0xfb5f('0x19'),_0x1c62c5,_0xfd52aa['error'][_0xfb5f('0x1a')]);return _0x1fcfee(_0xfd52aa[_0xfb5f('0x17')]['message']);}logger[_0xfb5f('0x17')](_0xfb5f('0x19'),_0x1c62c5,_0xfd52aa[_0xfb5f('0x17')][_0xfb5f('0x1a')]);return _0xf27873(_0xfd52aa['error']['message']);}else{logger['info'](_0xfb5f('0x19'),_0x1c62c5,_0xfb5f('0x15'));_0xf27873(_0xfd52aa['result'][_0xfb5f('0x1a')]);}})[_0xfb5f('0x1b')](function(_0x413643){logger[_0xfb5f('0x17')](_0xfb5f('0x19'),_0x1c62c5,_0x413643);_0x1fcfee(_0x413643);});});}exports[_0xfb5f('0x1c')]=function(_0xfaf4eb){var _0x396db3=this;return new Promise(function(_0xe5565d,_0x195bf3){return db[_0xfb5f('0x1d')][_0xfb5f('0x1e')]({'raw':_0xfaf4eb[_0xfb5f('0x1f')]?_0xfaf4eb[_0xfb5f('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xfaf4eb[_0xfb5f('0x1f')]?_0xfaf4eb[_0xfb5f('0x1f')]['where']||null:null,'attributes':_0xfaf4eb[_0xfb5f('0x1f')]?_0xfaf4eb['options'][_0xfb5f('0x20')]||null:null,'limit':_0xfaf4eb[_0xfb5f('0x1f')]?_0xfaf4eb[_0xfb5f('0x1f')][_0xfb5f('0x21')]||null:null,'include':_0xfaf4eb['options']?_0xfaf4eb[_0xfb5f('0x1f')][_0xfb5f('0x22')]?_[_0xfb5f('0x23')](_0xfaf4eb[_0xfb5f('0x1f')][_0xfb5f('0x22')],function(_0x95ce10){return{'model':db[_0x95ce10['model']],'as':_0x95ce10['as'],'attributes':_0x95ce10[_0xfb5f('0x20')],'include':_0x95ce10['include']?_[_0xfb5f('0x23')](_0x95ce10['include'],function(_0x40b574){return{'model':db[_0x40b574[_0xfb5f('0x24')]],'as':_0x40b574['as'],'attributes':_0x40b574[_0xfb5f('0x20')],'include':_0x40b574[_0xfb5f('0x22')]?_[_0xfb5f('0x23')](_0x40b574['include'],function(_0x287020){return{'model':db[_0x287020[_0xfb5f('0x24')]],'as':_0x287020['as'],'attributes':_0x287020[_0xfb5f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d9628){logger[_0xfb5f('0x14')](_0xfb5f('0x1c'),_0xfaf4eb);logger[_0xfb5f('0x25')](_0xfb5f('0x1c'),_0xfaf4eb,JSON['stringify'](_0x1d9628));_0xe5565d(_0x1d9628);})['catch'](function(_0x162aec){logger['error'](_0xfb5f('0x1c'),_0x162aec[_0xfb5f('0x1a')],_0xfaf4eb);_0x195bf3(_0x396db3[_0xfb5f('0x17')](0x1f4,_0x162aec[_0xfb5f('0x1a')]));});});};exports[_0xfb5f('0x26')]=function(_0x506e83){var _0x2f142f=this;return new Promise(function(_0x3fcbc5,_0x745e1b){return db['WhatsappQueue'][_0xfb5f('0x27')]({'raw':_0x506e83[_0xfb5f('0x1f')]?_0x506e83[_0xfb5f('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x506e83[_0xfb5f('0x1f')]?_0x506e83[_0xfb5f('0x1f')]['where']||null:null,'attributes':_0x506e83[_0xfb5f('0x1f')]?_0x506e83[_0xfb5f('0x1f')][_0xfb5f('0x20')]||null:null,'include':_0x506e83[_0xfb5f('0x1f')]?_0x506e83[_0xfb5f('0x1f')][_0xfb5f('0x22')]?_[_0xfb5f('0x23')](_0x506e83['options'][_0xfb5f('0x22')],function(_0x2f587b){return{'model':db[_0x2f587b['model']],'as':_0x2f587b['as'],'attributes':_0x2f587b[_0xfb5f('0x20')],'include':_0x2f587b[_0xfb5f('0x22')]?_[_0xfb5f('0x23')](_0x2f587b[_0xfb5f('0x22')],function(_0x564347){return{'model':db[_0x564347['model']],'as':_0x564347['as'],'attributes':_0x564347[_0xfb5f('0x20')],'include':_0x564347[_0xfb5f('0x22')]?_[_0xfb5f('0x23')](_0x564347[_0xfb5f('0x22')],function(_0x34c5b5){return{'model':db[_0x34c5b5[_0xfb5f('0x24')]],'as':_0x34c5b5['as'],'attributes':_0x34c5b5[_0xfb5f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfb5f('0x13')](function(_0x67d48a){logger['info'](_0xfb5f('0x26'),_0x506e83);logger[_0xfb5f('0x25')](_0xfb5f('0x26'),_0x506e83,JSON['stringify'](_0x67d48a));_0x3fcbc5(_0x67d48a);})[_0xfb5f('0x1b')](function(_0x1ee4bb){logger[_0xfb5f('0x17')]('ShowWhatsappQueue',_0x1ee4bb[_0xfb5f('0x1a')],_0x506e83);_0x745e1b(_0x2f142f['error'](0x1f4,_0x1ee4bb[_0xfb5f('0x1a')]));});});}; \ No newline at end of file +var _0x7a5c=['ShowWhatsappQueue','WhatsappQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','stringify','code','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','options','raw','where','attributes','limit','include','map','model'];(function(_0x5c3023,_0x59be84){var _0x3e3f58=function(_0x52f5da){while(--_0x52f5da){_0x5c3023['push'](_0x5c3023['shift']());}};_0x3e3f58(++_0x59be84);}(_0x7a5c,0x142));var _0xc7a5=function(_0x588084,_0x287050){_0x588084=_0x588084-0x0;var _0x5ee972=_0x7a5c[_0x588084];return _0x5ee972;};'use strict';var _=require(_0xc7a5('0x0'));var util=require(_0xc7a5('0x1'));var moment=require(_0xc7a5('0x2'));var BPromise=require(_0xc7a5('0x3'));var rs=require(_0xc7a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7a5('0x6'))('rpc');var config=require(_0xc7a5('0x7'));var jayson=require(_0xc7a5('0x8'));var client=jayson[_0xc7a5('0x9')][_0xc7a5('0xa')]({'port':0x232a});config[_0xc7a5('0xb')]=_[_0xc7a5('0xc')](config['redis'],{'host':_0xc7a5('0xd'),'port':0x18eb});var socket=require(_0xc7a5('0xe'))(new Redis(config[_0xc7a5('0xb')]));require(_0xc7a5('0xf'))[_0xc7a5('0x10')](socket);function respondWithRpcPromise(_0x549f74,_0xf73814,_0x469200){return new BPromise(function(_0x10c495,_0x123996){return client[_0xc7a5('0x11')](_0x549f74,_0x469200)[_0xc7a5('0x12')](function(_0x19a86a){logger[_0xc7a5('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0xf73814,_0xc7a5('0x14'));logger[_0xc7a5('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0xf73814,_0xc7a5('0x14'),JSON[_0xc7a5('0x16')](_0x19a86a));if(_0x19a86a['error']){if(_0x19a86a['error'][_0xc7a5('0x17')]===0x1f4){logger[_0xc7a5('0x18')](_0xc7a5('0x19'),_0xf73814,_0x19a86a[_0xc7a5('0x18')][_0xc7a5('0x1a')]);return _0x123996(_0x19a86a[_0xc7a5('0x18')][_0xc7a5('0x1a')]);}logger['error'](_0xc7a5('0x19'),_0xf73814,_0x19a86a[_0xc7a5('0x18')][_0xc7a5('0x1a')]);return _0x10c495(_0x19a86a[_0xc7a5('0x18')]['message']);}else{logger[_0xc7a5('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0xf73814,_0xc7a5('0x14'));_0x10c495(_0x19a86a[_0xc7a5('0x1b')][_0xc7a5('0x1a')]);}})[_0xc7a5('0x1c')](function(_0x198f70){logger[_0xc7a5('0x18')](_0xc7a5('0x19'),_0xf73814,_0x198f70);_0x123996(_0x198f70);});});}exports[_0xc7a5('0x1d')]=function(_0x48f548){var _0x2f6574=this;return new Promise(function(_0x442b50,_0x5a51b3){return db['WhatsappQueue']['findAll']({'raw':_0x48f548[_0xc7a5('0x1e')]?_0x48f548[_0xc7a5('0x1e')][_0xc7a5('0x1f')]===undefined?!![]:![]:!![],'where':_0x48f548[_0xc7a5('0x1e')]?_0x48f548[_0xc7a5('0x1e')][_0xc7a5('0x20')]||null:null,'attributes':_0x48f548[_0xc7a5('0x1e')]?_0x48f548['options'][_0xc7a5('0x21')]||null:null,'limit':_0x48f548[_0xc7a5('0x1e')]?_0x48f548['options'][_0xc7a5('0x22')]||null:null,'include':_0x48f548[_0xc7a5('0x1e')]?_0x48f548[_0xc7a5('0x1e')][_0xc7a5('0x23')]?_[_0xc7a5('0x24')](_0x48f548['options']['include'],function(_0x5968da){return{'model':db[_0x5968da['model']],'as':_0x5968da['as'],'attributes':_0x5968da[_0xc7a5('0x21')],'include':_0x5968da[_0xc7a5('0x23')]?_[_0xc7a5('0x24')](_0x5968da[_0xc7a5('0x23')],function(_0x4aacd2){return{'model':db[_0x4aacd2[_0xc7a5('0x25')]],'as':_0x4aacd2['as'],'attributes':_0x4aacd2['attributes'],'include':_0x4aacd2[_0xc7a5('0x23')]?_[_0xc7a5('0x24')](_0x4aacd2[_0xc7a5('0x23')],function(_0x6827f5){return{'model':db[_0x6827f5[_0xc7a5('0x25')]],'as':_0x6827f5['as'],'attributes':_0x6827f5[_0xc7a5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x169bca){logger[_0xc7a5('0x13')]('GetWhatsappQueue',_0x48f548);logger[_0xc7a5('0x15')](_0xc7a5('0x1d'),_0x48f548,JSON['stringify'](_0x169bca));_0x442b50(_0x169bca);})[_0xc7a5('0x1c')](function(_0x4c64ac){logger[_0xc7a5('0x18')](_0xc7a5('0x1d'),_0x4c64ac['message'],_0x48f548);_0x5a51b3(_0x2f6574[_0xc7a5('0x18')](0x1f4,_0x4c64ac[_0xc7a5('0x1a')]));});});};exports[_0xc7a5('0x26')]=function(_0x56419b){var _0x3c9378=this;return new Promise(function(_0x182a76,_0xfe3193){return db[_0xc7a5('0x27')]['find']({'raw':_0x56419b[_0xc7a5('0x1e')]?_0x56419b['options'][_0xc7a5('0x1f')]===undefined?!![]:![]:!![],'where':_0x56419b[_0xc7a5('0x1e')]?_0x56419b[_0xc7a5('0x1e')][_0xc7a5('0x20')]||null:null,'attributes':_0x56419b[_0xc7a5('0x1e')]?_0x56419b[_0xc7a5('0x1e')]['attributes']||null:null,'include':_0x56419b[_0xc7a5('0x1e')]?_0x56419b['options']['include']?_[_0xc7a5('0x24')](_0x56419b['options'][_0xc7a5('0x23')],function(_0x193df7){return{'model':db[_0x193df7[_0xc7a5('0x25')]],'as':_0x193df7['as'],'attributes':_0x193df7[_0xc7a5('0x21')],'include':_0x193df7['include']?_[_0xc7a5('0x24')](_0x193df7[_0xc7a5('0x23')],function(_0x316ae0){return{'model':db[_0x316ae0['model']],'as':_0x316ae0['as'],'attributes':_0x316ae0[_0xc7a5('0x21')],'include':_0x316ae0[_0xc7a5('0x23')]?_['map'](_0x316ae0[_0xc7a5('0x23')],function(_0x2f3bae){return{'model':db[_0x2f3bae['model']],'as':_0x2f3bae['as'],'attributes':_0x2f3bae[_0xc7a5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f422d){logger['info']('ShowWhatsappQueue',_0x56419b);logger[_0xc7a5('0x15')](_0xc7a5('0x26'),_0x56419b,JSON[_0xc7a5('0x16')](_0x1f422d));_0x182a76(_0x1f422d);})[_0xc7a5('0x1c')](function(_0x4b468f){logger[_0xc7a5('0x18')](_0xc7a5('0x26'),_0x4b468f[_0xc7a5('0x1a')],_0x56419b);_0xfe3193(_0x3c9378['error'](0x1f4,_0x4b468f[_0xc7a5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5a5e7c4..859bac2 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 _0x56b1=['remove','removeListener','register','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0x56b1,0xca));var _0x156b=function(_0x11774e,_0x5d1ac9){_0x11774e=_0x11774e-0x0;var _0x4c6561=_0x56b1[_0x11774e];return _0x4c6561;};'use strict';var WhatsappQueueEvents=require(_0x156b('0x0'));var events=[_0x156b('0x1'),_0x156b('0x2'),'update'];function createListener(_0x4f56c4,_0x2b5f9b){return function(_0x1795f0){_0x2b5f9b['emit'](_0x4f56c4,_0x1795f0);};}function removeListener(_0x4a62aa,_0x30cc32){return function(){WhatsappQueueEvents[_0x156b('0x3')](_0x4a62aa,_0x30cc32);};}exports[_0x156b('0x4')]=function(_0x1754ff){for(var _0x5f196b=0x0,_0x31623b=events['length'];_0x5f196b<_0x31623b;_0x5f196b++){var _0x4058f8=events[_0x5f196b];var _0x1b24a3=createListener(_0x156b('0x5')+_0x4058f8,_0x1754ff);WhatsappQueueEvents['on'](_0x4058f8,_0x1b24a3);}}; \ No newline at end of file +var _0x3605=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit'];(function(_0x293a24,_0x2406e6){var _0x23d1cf=function(_0x1130d4){while(--_0x1130d4){_0x293a24['push'](_0x293a24['shift']());}};_0x23d1cf(++_0x2406e6);}(_0x3605,0xdb));var _0x5360=function(_0x3469d9,_0x11b241){_0x3469d9=_0x3469d9-0x0;var _0x5a6fb7=_0x3605[_0x3469d9];return _0x5a6fb7;};'use strict';var WhatsappQueueEvents=require(_0x5360('0x0'));var events=[_0x5360('0x1'),_0x5360('0x2'),_0x5360('0x3')];function createListener(_0xe93bba,_0x5ddb3b){return function(_0x238087){_0x5ddb3b[_0x5360('0x4')](_0xe93bba,_0x238087);};}function removeListener(_0x4a6a62,_0xeb69d0){return function(){WhatsappQueueEvents['removeListener'](_0x4a6a62,_0xeb69d0);};}exports[_0x5360('0x5')]=function(_0xe9fba4){for(var _0xe8f1a5=0x0,_0x50a736=events[_0x5360('0x6')];_0xe8f1a5<_0x50a736;_0xe8f1a5++){var _0x12bd8b=events[_0xe8f1a5];var _0x5c1ac6=createListener(_0x5360('0x7')+_0x12bd8b,_0xe9fba4);WhatsappQueueEvents['on'](_0x12bd8b,_0x5c1ac6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 4744d99..dda88b9 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 _0x8ea0=['../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','index','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1fd3f0,_0x40f055){var _0x1d8e16=function(_0x35d0e5){while(--_0x35d0e5){_0x1fd3f0['push'](_0x1fd3f0['shift']());}};_0x1d8e16(++_0x40f055);}(_0x8ea0,0xc8));var _0x08ea=function(_0x33cee6,_0x35013f){_0x33cee6=_0x33cee6-0x0;var _0xee94b4=_0x8ea0[_0x33cee6];return _0xee94b4;};'use strict';var multer=require(_0x08ea('0x0'));var util=require(_0x08ea('0x1'));var path=require(_0x08ea('0x2'));var timeout=require(_0x08ea('0x3'));var express=require(_0x08ea('0x4'));var router=express[_0x08ea('0x5')]();var fs_extra=require(_0x08ea('0x6'));var auth=require(_0x08ea('0x7'));var interaction=require(_0x08ea('0x8'));var config=require('../../config/environment');var controller=require(_0x08ea('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x08ea('0xa')]);router[_0x08ea('0xb')](_0x08ea('0xc'),auth[_0x08ea('0xd')](),controller['describe']);router[_0x08ea('0xb')](_0x08ea('0xe'),auth[_0x08ea('0xd')](),controller[_0x08ea('0xf')]);router[_0x08ea('0x10')]('/',auth[_0x08ea('0xd')](),controller[_0x08ea('0x11')]);router[_0x08ea('0x12')](_0x08ea('0xe'),auth[_0x08ea('0xd')](),controller[_0x08ea('0x13')]);router[_0x08ea('0x14')](_0x08ea('0xe'),auth[_0x08ea('0xd')](),controller[_0x08ea('0x15')]);module[_0x08ea('0x16')]=router; \ No newline at end of file +var _0xbef1=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','util'];(function(_0x4cefc8,_0x16d44e){var _0xe9ccd5=function(_0x2d5a73){while(--_0x2d5a73){_0x4cefc8['push'](_0x4cefc8['shift']());}};_0xe9ccd5(++_0x16d44e);}(_0xbef1,0xaa));var _0x1bef=function(_0x3aef89,_0x3fdaf5){_0x3aef89=_0x3aef89-0x0;var _0x1f4b10=_0xbef1[_0x3aef89];return _0x1f4b10;};'use strict';var multer=require('multer');var util=require(_0x1bef('0x0'));var path=require(_0x1bef('0x1'));var timeout=require(_0x1bef('0x2'));var express=require(_0x1bef('0x3'));var router=express['Router']();var fs_extra=require(_0x1bef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1bef('0x5'));var config=require(_0x1bef('0x6'));var controller=require(_0x1bef('0x7'));router[_0x1bef('0x8')]('/',auth[_0x1bef('0x9')](),controller[_0x1bef('0xa')]);router[_0x1bef('0x8')](_0x1bef('0xb'),auth[_0x1bef('0x9')](),controller[_0x1bef('0xc')]);router[_0x1bef('0x8')](_0x1bef('0xd'),auth[_0x1bef('0x9')](),controller['show']);router[_0x1bef('0xe')]('/',auth[_0x1bef('0x9')](),controller[_0x1bef('0xf')]);router['put'](_0x1bef('0xd'),auth[_0x1bef('0x9')](),controller['update']);router[_0x1bef('0x10')](_0x1bef('0xd'),auth['isAuthenticated'](),controller[_0x1bef('0x11')]);module[_0x1bef('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index fd17a43..e23a5b4 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1f3b0a,_0x1e6b3c){var _0x4c00a4=function(_0x15f4f6){while(--_0x15f4f6){_0x1f3b0a['push'](_0x1f3b0a['shift']());}};_0x4c00a4(++_0x1e6b3c);}(_0x7a54,0x106));var _0x47a5=function(_0xdea7a1,_0x388677){_0xdea7a1=_0xdea7a1-0x0;var _0x4ab559=_0x7a54[_0xdea7a1];return _0x4ab559;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4b6de3,_0x11213e){var _0x53f452=function(_0x21010d){while(--_0x21010d){_0x4b6de3['push'](_0x4b6de3['shift']());}};_0x53f452(++_0x11213e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index feb7324..fef7ad1 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 _0xfff0=['length','include','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','WhatsappQueueReport','includeAll','findAll','catch','params'];(function(_0x332ef9,_0x387cb2){var _0x64da7d=function(_0x34daa0){while(--_0x34daa0){_0x332ef9['push'](_0x332ef9['shift']());}};_0x64da7d(++_0x387cb2);}(_0xfff0,0x139));var _0x0fff=function(_0xac3cbc,_0x4fd76e){_0xac3cbc=_0xac3cbc-0x0;var _0x5264b4=_0xfff0[_0xac3cbc];return _0x5264b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x23d9f8,_0x482e1e){return function(_0x2c9725){if(!_0x2c9725){_0x23d9f8[_0x0fff('0x28')](0x194);}return _0x2c9725;};}function handleError(_0x2d1610,_0x440f56){_0x440f56=_0x440f56||0x1f4;return function(_0x36d268){logger[_0x0fff('0x29')](_0x36d268[_0x0fff('0x2a')]);if(_0x36d268[_0x0fff('0x2b')]){delete _0x36d268[_0x0fff('0x2b')];}_0x2d1610[_0x0fff('0x19')](_0x440f56)[_0x0fff('0x2c')](_0x36d268);};}exports[_0x0fff('0x2d')]=function(_0x495734,_0x7046a3){var _0x2d1800={},_0x17ab6f={},_0x42441e={'count':0x0,'rows':[]};var _0x1f643d=_[_0x0fff('0x2e')](db['WhatsappQueueReport'][_0x0fff('0x2f')],function(_0xa16c29){return{'name':_0xa16c29[_0x0fff('0x30')],'type':_0xa16c29['type'][_0x0fff('0x31')]};});_0x17ab6f[_0x0fff('0x32')]=_['map'](_0x1f643d,_0x0fff('0x2b'));_0x17ab6f[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0x495734[_0x0fff('0x33')]);_0x17ab6f[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x17ab6f[_0x0fff('0x32')],_0x17ab6f[_0x0fff('0x33')]);_0x2d1800[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x17ab6f['model'],qs[_0x0fff('0x38')](_0x495734[_0x0fff('0x33')][_0x0fff('0x38')]));_0x2d1800[_0x0fff('0x37')]=_0x2d1800[_0x0fff('0x37')]['length']?_0x2d1800['attributes']:_0x17ab6f[_0x0fff('0x32')];if(!_0x495734[_0x0fff('0x33')][_0x0fff('0x39')](_0x0fff('0x3a'))){_0x2d1800['limit']=qs[_0x0fff('0x1d')](_0x495734[_0x0fff('0x33')][_0x0fff('0x1d')]);_0x2d1800[_0x0fff('0x1c')]=qs['offset'](_0x495734[_0x0fff('0x33')][_0x0fff('0x1c')]);}_0x2d1800[_0x0fff('0x3b')]=qs[_0x0fff('0x3c')](_0x495734[_0x0fff('0x33')][_0x0fff('0x3c')]);_0x2d1800[_0x0fff('0x3d')]=qs[_0x0fff('0x35')](_[_0x0fff('0x3e')](_0x495734[_0x0fff('0x33')],_0x17ab6f[_0x0fff('0x35')]),_0x1f643d);if(_0x495734[_0x0fff('0x33')]['filter']){_0x2d1800[_0x0fff('0x3d')]=_[_0x0fff('0x3f')](_0x2d1800[_0x0fff('0x3d')],{'$or':_[_0x0fff('0x2e')](_0x1f643d,function(_0xd65638){if(_0xd65638[_0x0fff('0x40')]!=='VIRTUAL'){var _0x10ff9d={};_0x10ff9d[_0xd65638[_0x0fff('0x2b')]]={'$like':'%'+_0x495734[_0x0fff('0x33')][_0x0fff('0x41')]+'%'};return _0x10ff9d;}})});}_0x2d1800=_[_0x0fff('0x3f')]({},_0x2d1800,_0x495734[_0x0fff('0x42')]);var _0x3dc0b8={'where':_0x2d1800[_0x0fff('0x3d')]};return db[_0x0fff('0x43')]['count'](_0x3dc0b8)[_0x0fff('0x26')](function(_0x4d89c0){_0x42441e[_0x0fff('0x1f')]=_0x4d89c0;if(_0x495734[_0x0fff('0x33')][_0x0fff('0x44')]){_0x2d1800['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x0fff('0x45')](_0x2d1800);})[_0x0fff('0x26')](function(_0x311348){_0x42441e['rows']=_0x311348;return _0x42441e;})['then'](respondWithFilteredResult(_0x7046a3,_0x2d1800))[_0x0fff('0x46')](handleError(_0x7046a3,null));};exports['show']=function(_0xd6ebeb,_0x957265){var _0x8352c1={'raw':!![],'where':{'id':_0xd6ebeb[_0x0fff('0x47')]['id']}},_0x309d75={};_0x309d75[_0x0fff('0x32')]=_['keys'](db[_0x0fff('0x43')][_0x0fff('0x2f')]);_0x309d75[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0xd6ebeb[_0x0fff('0x33')]);_0x309d75[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x309d75['model'],_0x309d75[_0x0fff('0x33')]);_0x8352c1[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x309d75['model'],qs[_0x0fff('0x38')](_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x38')]));_0x8352c1[_0x0fff('0x37')]=_0x8352c1[_0x0fff('0x37')][_0x0fff('0x48')]?_0x8352c1[_0x0fff('0x37')]:_0x309d75[_0x0fff('0x32')];if(_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x44')]){_0x8352c1[_0x0fff('0x49')]=[{'all':!![]}];}_0x8352c1=_['merge']({},_0x8352c1,_0xd6ebeb[_0x0fff('0x42')]);return db[_0x0fff('0x43')]['find'](_0x8352c1)[_0x0fff('0x26')](handleEntityNotFound(_0x957265,null))[_0x0fff('0x26')](respondWithResult(_0x957265,null))[_0x0fff('0x46')](handleError(_0x957265,null));};exports['create']=function(_0x502037,_0x2a0b10){return db['WhatsappQueueReport']['create'](_0x502037[_0x0fff('0x4a')],{})[_0x0fff('0x26')](respondWithResult(_0x2a0b10,0xc9))[_0x0fff('0x46')](handleError(_0x2a0b10,null));};exports[_0x0fff('0x25')]=function(_0x3b4b8e,_0x1a7677){if(_0x3b4b8e['body']['id']){delete _0x3b4b8e[_0x0fff('0x4a')]['id'];}return db[_0x0fff('0x43')][_0x0fff('0x4b')]({'where':{'id':_0x3b4b8e[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x1a7677,null))[_0x0fff('0x26')](saveUpdates(_0x3b4b8e['body'],null))[_0x0fff('0x26')](respondWithResult(_0x1a7677,null))[_0x0fff('0x46')](handleError(_0x1a7677,null));};exports['destroy']=function(_0x1fc872,_0x4bae35){return db['WhatsappQueueReport']['find']({'where':{'id':_0x1fc872[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x4bae35,null))[_0x0fff('0x26')](removeEntity(_0x4bae35,null))[_0x0fff('0x46')](handleError(_0x4bae35,null));};exports[_0x0fff('0x4c')]=function(_0x4bf98d,_0x2524ad){return db[_0x0fff('0x43')][_0x0fff('0x4c')]()[_0x0fff('0x26')](respondWithResult(_0x2524ad,null))[_0x0fff('0x46')](handleError(_0x2524ad,null));}; \ No newline at end of file +var _0xa5fa=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','WhatsappQueueReport','includeAll','rows','catch','show','params','fields','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x4bf0a3,_0x25099e){var _0xe3a581=function(_0x3c4b49){while(--_0x3c4b49){_0x4bf0a3['push'](_0x4bf0a3['shift']());}};_0xe3a581(++_0x25099e);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x3e78f4,_0x5d4c9a){_0x3e78f4=_0x3e78f4-0x0;var _0x5ca5eb=_0xa5fa[_0x3e78f4];return _0x5ca5eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa5f('0x0'));var zipdir=require(_0xaa5f('0x1'));var jsonpatch=require(_0xaa5f('0x2'));var rp=require(_0xaa5f('0x3'));var moment=require('moment');var BPromise=require(_0xaa5f('0x4'));var Mustache=require(_0xaa5f('0x5'));var util=require('util');var path=require(_0xaa5f('0x6'));var sox=require(_0xaa5f('0x7'));var csv=require(_0xaa5f('0x8'));var ejs=require(_0xaa5f('0x9'));var fs=require('fs');var fs_extra=require(_0xaa5f('0xa'));var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x8'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var Redis=require(_0xaa5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa5f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa5f('0x14'));var licenseUtil=require(_0xaa5f('0x15'));var db=require(_0xaa5f('0x16'))['db'];function respondWithStatusCode(_0x9aeae9,_0x252ae0){_0x252ae0=_0x252ae0||0xcc;return function(_0x48d1d3){if(_0x48d1d3){return _0x9aeae9[_0xaa5f('0x17')](_0x252ae0);}return _0x9aeae9['status'](_0x252ae0)[_0xaa5f('0x18')]();};}function respondWithResult(_0x23f872,_0x31eabc){_0x31eabc=_0x31eabc||0xc8;return function(_0x19aa27){if(_0x19aa27){return _0x23f872[_0xaa5f('0x19')](_0x31eabc)['json'](_0x19aa27);}};}function respondWithFilteredResult(_0x4fc828,_0x1f37fb){return function(_0x291042){if(_0x291042){var _0xb0bfb6=typeof _0x1f37fb[_0xaa5f('0x1a')]===_0xaa5f('0x1b')&&typeof _0x1f37fb[_0xaa5f('0x1c')]===_0xaa5f('0x1b');var _0x28407c=_0x291042[_0xaa5f('0x1d')];var _0x3d874f=_0xb0bfb6?0x0:_0x1f37fb[_0xaa5f('0x1a')];var _0x1019e8=_0xb0bfb6?_0x291042['count']:_0x1f37fb[_0xaa5f('0x1a')]+_0x1f37fb[_0xaa5f('0x1c')];var _0x1cbab5;if(_0x1019e8>=_0x28407c){_0x1019e8=_0x28407c;_0x1cbab5=0xc8;}else{_0x1cbab5=0xce;}_0x4fc828[_0xaa5f('0x19')](_0x1cbab5);return _0x4fc828[_0xaa5f('0x1e')](_0xaa5f('0x1f'),_0x3d874f+'-'+_0x1019e8+'/'+_0x28407c)[_0xaa5f('0x20')](_0x291042);}return null;};}function patchUpdates(_0x194691){return function(_0x2d8fc3){try{jsonpatch[_0xaa5f('0x21')](_0x2d8fc3,_0x194691,!![]);}catch(_0x40c223){return BPromise[_0xaa5f('0x22')](_0x40c223);}return _0x2d8fc3[_0xaa5f('0x23')]();};}function saveUpdates(_0x5238a8,_0x1e917d){return function(_0x57082c){if(_0x57082c){return _0x57082c[_0xaa5f('0x24')](_0x5238a8)[_0xaa5f('0x25')](function(_0x561381){return _0x561381;});}return null;};}function removeEntity(_0x1baa2e,_0x1032ce){return function(_0x5b9f0b){if(_0x5b9f0b){return _0x5b9f0b[_0xaa5f('0x26')]()[_0xaa5f('0x25')](function(){_0x1baa2e[_0xaa5f('0x19')](0xcc)[_0xaa5f('0x18')]();});}};}function handleEntityNotFound(_0x1f66c0,_0xacbded){return function(_0x3d7bca){if(!_0x3d7bca){_0x1f66c0[_0xaa5f('0x17')](0x194);}return _0x3d7bca;};}function handleError(_0x51eb55,_0x2445a6){_0x2445a6=_0x2445a6||0x1f4;return function(_0x3a66e8){logger[_0xaa5f('0x27')](_0x3a66e8['stack']);if(_0x3a66e8[_0xaa5f('0x28')]){delete _0x3a66e8[_0xaa5f('0x28')];}_0x51eb55[_0xaa5f('0x19')](_0x2445a6)['send'](_0x3a66e8);};}exports[_0xaa5f('0x29')]=function(_0x479f29,_0x5990d2){var _0x27d1a4={},_0x50998f={},_0x1bffec={'count':0x0,'rows':[]};var _0x4e0ec9=_['map'](db['WhatsappQueueReport'][_0xaa5f('0x2a')],function(_0x4ddebd){return{'name':_0x4ddebd[_0xaa5f('0x2b')],'type':_0x4ddebd[_0xaa5f('0x2c')]['key']};});_0x50998f['model']=_[_0xaa5f('0x2d')](_0x4e0ec9,'name');_0x50998f[_0xaa5f('0x2e')]=_[_0xaa5f('0x2f')](_0x479f29['query']);_0x50998f[_0xaa5f('0x30')]=_[_0xaa5f('0x31')](_0x50998f[_0xaa5f('0x32')],_0x50998f['query']);_0x27d1a4[_0xaa5f('0x33')]=_[_0xaa5f('0x31')](_0x50998f['model'],qs['fields'](_0x479f29['query']['fields']));_0x27d1a4[_0xaa5f('0x33')]=_0x27d1a4[_0xaa5f('0x33')][_0xaa5f('0x34')]?_0x27d1a4[_0xaa5f('0x33')]:_0x50998f[_0xaa5f('0x32')];if(!_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x35')]('nolimit')){_0x27d1a4[_0xaa5f('0x1c')]=qs[_0xaa5f('0x1c')](_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x1c')]);_0x27d1a4[_0xaa5f('0x1a')]=qs[_0xaa5f('0x1a')](_0x479f29['query'][_0xaa5f('0x1a')]);}_0x27d1a4[_0xaa5f('0x36')]=qs[_0xaa5f('0x37')](_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x37')]);_0x27d1a4['where']=qs['filters'](_[_0xaa5f('0x38')](_0x479f29[_0xaa5f('0x2e')],_0x50998f[_0xaa5f('0x30')]),_0x4e0ec9);if(_0x479f29[_0xaa5f('0x2e')]['filter']){_0x27d1a4[_0xaa5f('0x39')]=_[_0xaa5f('0x3a')](_0x27d1a4[_0xaa5f('0x39')],{'$or':_[_0xaa5f('0x2d')](_0x4e0ec9,function(_0x37db88){if(_0x37db88[_0xaa5f('0x2c')]!==_0xaa5f('0x3b')){var _0x2c4d29={};_0x2c4d29[_0x37db88[_0xaa5f('0x28')]]={'$like':'%'+_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x3c')]+'%'};return _0x2c4d29;}})});}_0x27d1a4=_['merge']({},_0x27d1a4,_0x479f29[_0xaa5f('0x3d')]);var _0x2562ce={'where':_0x27d1a4[_0xaa5f('0x39')]};return db[_0xaa5f('0x3e')][_0xaa5f('0x1d')](_0x2562ce)[_0xaa5f('0x25')](function(_0x1fb572){_0x1bffec[_0xaa5f('0x1d')]=_0x1fb572;if(_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x3f')]){_0x27d1a4['include']=[{'all':!![]}];}return db[_0xaa5f('0x3e')]['findAll'](_0x27d1a4);})[_0xaa5f('0x25')](function(_0x21f4bc){_0x1bffec[_0xaa5f('0x40')]=_0x21f4bc;return _0x1bffec;})['then'](respondWithFilteredResult(_0x5990d2,_0x27d1a4))[_0xaa5f('0x41')](handleError(_0x5990d2,null));};exports[_0xaa5f('0x42')]=function(_0xe49f8,_0x528b08){var _0x12a8e4={'raw':!![],'where':{'id':_0xe49f8[_0xaa5f('0x43')]['id']}},_0x179be8={};_0x179be8[_0xaa5f('0x32')]=_['keys'](db[_0xaa5f('0x3e')][_0xaa5f('0x2a')]);_0x179be8[_0xaa5f('0x2e')]=_[_0xaa5f('0x2f')](_0xe49f8[_0xaa5f('0x2e')]);_0x179be8[_0xaa5f('0x30')]=_[_0xaa5f('0x31')](_0x179be8[_0xaa5f('0x32')],_0x179be8['query']);_0x12a8e4[_0xaa5f('0x33')]=_['intersection'](_0x179be8[_0xaa5f('0x32')],qs['fields'](_0xe49f8[_0xaa5f('0x2e')][_0xaa5f('0x44')]));_0x12a8e4['attributes']=_0x12a8e4[_0xaa5f('0x33')][_0xaa5f('0x34')]?_0x12a8e4[_0xaa5f('0x33')]:_0x179be8['model'];if(_0xe49f8['query']['includeAll']){_0x12a8e4[_0xaa5f('0x45')]=[{'all':!![]}];}_0x12a8e4=_['merge']({},_0x12a8e4,_0xe49f8[_0xaa5f('0x3d')]);return db[_0xaa5f('0x3e')][_0xaa5f('0x46')](_0x12a8e4)[_0xaa5f('0x25')](handleEntityNotFound(_0x528b08,null))['then'](respondWithResult(_0x528b08,null))[_0xaa5f('0x41')](handleError(_0x528b08,null));};exports[_0xaa5f('0x47')]=function(_0x3c6a17,_0x231ad1){return db[_0xaa5f('0x3e')][_0xaa5f('0x47')](_0x3c6a17[_0xaa5f('0x48')],{})[_0xaa5f('0x25')](respondWithResult(_0x231ad1,0xc9))[_0xaa5f('0x41')](handleError(_0x231ad1,null));};exports[_0xaa5f('0x24')]=function(_0x3ea553,_0x2de737){if(_0x3ea553[_0xaa5f('0x48')]['id']){delete _0x3ea553[_0xaa5f('0x48')]['id'];}return db[_0xaa5f('0x3e')][_0xaa5f('0x46')]({'where':{'id':_0x3ea553['params']['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x2de737,null))[_0xaa5f('0x25')](saveUpdates(_0x3ea553[_0xaa5f('0x48')],null))[_0xaa5f('0x25')](respondWithResult(_0x2de737,null))[_0xaa5f('0x41')](handleError(_0x2de737,null));};exports[_0xaa5f('0x26')]=function(_0x32bbed,_0x4aa556){return db[_0xaa5f('0x3e')][_0xaa5f('0x46')]({'where':{'id':_0x32bbed[_0xaa5f('0x43')]['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x4aa556,null))['then'](removeEntity(_0x4aa556,null))[_0xaa5f('0x41')](handleError(_0x4aa556,null));};exports[_0xaa5f('0x49')]=function(_0x36c4aa,_0x575803){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x575803,null))['catch'](handleError(_0x575803,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index cbde999..9d92a77 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 _0x6520=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','request-promise','path','./whatsappQueueReport.attributes'];(function(_0x4a464e,_0x250abf){var _0x54d070=function(_0xf56d7){while(--_0xf56d7){_0x4a464e['push'](_0x4a464e['shift']());}};_0x54d070(++_0x250abf);}(_0x6520,0xf5));var _0x0652=function(_0x9c265a,_0x2d037d){_0x9c265a=_0x9c265a-0x0;var _0x1d75b5=_0x6520[_0x9c265a];return _0x1d75b5;};'use strict';var _=require(_0x0652('0x0'));var util=require(_0x0652('0x1'));var logger=require('../../config/logger')(_0x0652('0x2'));var moment=require(_0x0652('0x3'));var BPromise=require('bluebird');var rp=require(_0x0652('0x4'));var fs=require('fs');var path=require(_0x0652('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0652('0x6'));module[_0x0652('0x7')]=function(_0x50e54e,_0x394919){return _0x50e54e[_0x0652('0x8')](_0x0652('0x9'),attributes,{'tableName':_0x0652('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0652('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc817=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x154a79,_0x7a67aa){var _0x52c703=function(_0x43c7ec){while(--_0x43c7ec){_0x154a79['push'](_0x154a79['shift']());}};_0x52c703(++_0x7a67aa);}(_0xc817,0x1a7));var _0x7c81=function(_0x1b69bb,_0xd01deb){_0x1b69bb=_0x1b69bb-0x0;var _0x53d2ec=_0xc817[_0x1b69bb];return _0x53d2ec;};'use strict';var _=require('lodash');var util=require(_0x7c81('0x0'));var logger=require('../../config/logger')(_0x7c81('0x1'));var moment=require(_0x7c81('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c81('0x3'));var fs=require('fs');var path=require(_0x7c81('0x4'));var rimraf=require(_0x7c81('0x5'));var config=require(_0x7c81('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x7c81('0x7')]=function(_0x472e23,_0xbc6e67){return _0x472e23[_0x7c81('0x8')](_0x7c81('0x9'),attributes,{'tableName':_0x7c81('0xa'),'paranoid':![],'indexes':[{'name':_0x7c81('0xb'),'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 cd0c067..e78240c 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 _0xbf85=['client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','WhatsappQueueReport','where','attributes','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xbf85,0x137));var _0x5bf8=function(_0x5aa6cb,_0x34bcae){_0x5aa6cb=_0x5aa6cb-0x0;var _0x680d3=_0xbf85[_0x5aa6cb];return _0x680d3;};'use strict';var _=require(_0x5bf8('0x0'));var util=require(_0x5bf8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5bf8('0x2'));var fs=require('fs');var Redis=require(_0x5bf8('0x3'));var db=require(_0x5bf8('0x4'))['db'];var utils=require(_0x5bf8('0x5'));var logger=require(_0x5bf8('0x6'))(_0x5bf8('0x7'));var config=require(_0x5bf8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5bf8('0x9')][_0x5bf8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x64f5d1,_0x5cc377,_0x56d94c){return new BPromise(function(_0x4edb7e,_0x307527){return client[_0x5bf8('0xb')](_0x64f5d1,_0x56d94c)[_0x5bf8('0xc')](function(_0x5c6b1d){logger[_0x5bf8('0xd')](_0x5bf8('0xe'),_0x5cc377,'request\x20sent');logger[_0x5bf8('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5cc377,_0x5bf8('0x10'),JSON[_0x5bf8('0x11')](_0x5c6b1d));if(_0x5c6b1d[_0x5bf8('0x12')]){if(_0x5c6b1d[_0x5bf8('0x12')][_0x5bf8('0x13')]===0x1f4){logger['error'](_0x5bf8('0xe'),_0x5cc377,_0x5c6b1d[_0x5bf8('0x12')]['message']);return _0x307527(_0x5c6b1d[_0x5bf8('0x12')][_0x5bf8('0x14')]);}logger[_0x5bf8('0x12')](_0x5bf8('0xe'),_0x5cc377,_0x5c6b1d[_0x5bf8('0x12')][_0x5bf8('0x14')]);return _0x4edb7e(_0x5c6b1d[_0x5bf8('0x12')][_0x5bf8('0x14')]);}else{logger[_0x5bf8('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5cc377,_0x5bf8('0x10'));_0x4edb7e(_0x5c6b1d[_0x5bf8('0x15')][_0x5bf8('0x14')]);}})[_0x5bf8('0x16')](function(_0x247369){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x5cc377,_0x247369);_0x307527(_0x247369);});});}exports['CreateWhatsappQueueReport']=function(_0x482c2c){var _0x500a15=this;return new Promise(function(_0x305b23,_0x39b88e){return db['WhatsappQueueReport'][_0x5bf8('0x17')](_0x482c2c[_0x5bf8('0x18')],{'raw':_0x482c2c[_0x5bf8('0x19')]?_0x482c2c[_0x5bf8('0x19')][_0x5bf8('0x1a')]===undefined?!![]:![]:!![]})[_0x5bf8('0xc')](function(_0x2fac18){logger['info'](_0x5bf8('0x1b'),_0x482c2c);logger[_0x5bf8('0xf')](_0x5bf8('0x1b'),_0x482c2c,JSON[_0x5bf8('0x11')](_0x2fac18));_0x305b23(_0x2fac18);})[_0x5bf8('0x16')](function(_0x1d18d6){logger[_0x5bf8('0x12')](_0x5bf8('0x1b'),_0x1d18d6[_0x5bf8('0x14')],_0x482c2c);_0x39b88e(_0x500a15[_0x5bf8('0x12')](0x1f4,_0x1d18d6[_0x5bf8('0x14')]));});});};exports[_0x5bf8('0x1c')]=function(_0x46b727){var _0xe5cdc6=this;return new Promise(function(_0x47ef88,_0x233f5e){return db[_0x5bf8('0x1d')]['update'](_0x46b727['body'],{'raw':_0x46b727[_0x5bf8('0x19')]?_0x46b727[_0x5bf8('0x19')][_0x5bf8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b727[_0x5bf8('0x19')]?_0x46b727['options'][_0x5bf8('0x1e')]||null:null,'attributes':_0x46b727[_0x5bf8('0x19')]?_0x46b727['options'][_0x5bf8('0x1f')]||null:null,'limit':_0x46b727[_0x5bf8('0x19')]?_0x46b727[_0x5bf8('0x19')]['limit']||null:null})[_0x5bf8('0xc')](function(_0xc92afa){logger[_0x5bf8('0xd')](_0x5bf8('0x1c'),_0x46b727);logger[_0x5bf8('0xf')](_0x5bf8('0x1c'),_0x46b727,JSON[_0x5bf8('0x11')](_0xc92afa));_0x47ef88(_0xc92afa);})[_0x5bf8('0x16')](function(_0x12474b){logger[_0x5bf8('0x12')]('UpdateWhatsappQueueReport',_0x12474b[_0x5bf8('0x14')],_0x46b727);_0x233f5e(_0xe5cdc6[_0x5bf8('0x12')](0x1f4,_0x12474b['message']));});});}; \ No newline at end of file +var _0x95fd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateWhatsappQueueReport','body','options','raw','debug','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','limit','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x5279cb,_0x1601be){var _0x55785a=function(_0x33fd36){while(--_0x33fd36){_0x5279cb['push'](_0x5279cb['shift']());}};_0x55785a(++_0x1601be);}(_0x95fd,0x16f));var _0xd95f=function(_0x4fdab7,_0x5b7829){_0x4fdab7=_0x4fdab7-0x0;var _0x474151=_0x95fd[_0x4fdab7];return _0x474151;};'use strict';var _=require(_0xd95f('0x0'));var util=require(_0xd95f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd95f('0x2'));var fs=require('fs');var Redis=require(_0xd95f('0x3'));var db=require(_0xd95f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd95f('0x5'))(_0xd95f('0x6'));var config=require(_0xd95f('0x7'));var jayson=require(_0xd95f('0x8'));var client=jayson[_0xd95f('0x9')][_0xd95f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38627f,_0x4a0f13,_0x57d001){return new BPromise(function(_0x195bd5,_0x5247c6){return client[_0xd95f('0xb')](_0x38627f,_0x57d001)[_0xd95f('0xc')](function(_0x710393){logger[_0xd95f('0xd')](_0xd95f('0xe'),_0x4a0f13,_0xd95f('0xf'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4a0f13,_0xd95f('0xf'),JSON[_0xd95f('0x10')](_0x710393));if(_0x710393[_0xd95f('0x11')]){if(_0x710393[_0xd95f('0x11')][_0xd95f('0x12')]===0x1f4){logger[_0xd95f('0x11')](_0xd95f('0xe'),_0x4a0f13,_0x710393[_0xd95f('0x11')]['message']);return _0x5247c6(_0x710393[_0xd95f('0x11')][_0xd95f('0x13')]);}logger[_0xd95f('0x11')](_0xd95f('0xe'),_0x4a0f13,_0x710393[_0xd95f('0x11')][_0xd95f('0x13')]);return _0x195bd5(_0x710393[_0xd95f('0x11')][_0xd95f('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4a0f13,'request\x20sent');_0x195bd5(_0x710393['result']['message']);}})[_0xd95f('0x14')](function(_0xbcc286){logger[_0xd95f('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4a0f13,_0xbcc286);_0x5247c6(_0xbcc286);});});}exports[_0xd95f('0x15')]=function(_0x17726f){var _0x257c6d=this;return new Promise(function(_0x49f82d,_0x1b4d75){return db['WhatsappQueueReport']['create'](_0x17726f[_0xd95f('0x16')],{'raw':_0x17726f[_0xd95f('0x17')]?_0x17726f[_0xd95f('0x17')][_0xd95f('0x18')]===undefined?!![]:![]:!![]})[_0xd95f('0xc')](function(_0x2d6cfc){logger[_0xd95f('0xd')](_0xd95f('0x15'),_0x17726f);logger[_0xd95f('0x19')]('CreateWhatsappQueueReport',_0x17726f,JSON[_0xd95f('0x10')](_0x2d6cfc));_0x49f82d(_0x2d6cfc);})[_0xd95f('0x14')](function(_0x2f9352){logger[_0xd95f('0x11')](_0xd95f('0x15'),_0x2f9352[_0xd95f('0x13')],_0x17726f);_0x1b4d75(_0x257c6d[_0xd95f('0x11')](0x1f4,_0x2f9352[_0xd95f('0x13')]));});});};exports[_0xd95f('0x1a')]=function(_0x1d75a3){var _0x577fbe=this;return new Promise(function(_0x5e20b2,_0x17f4b2){return db[_0xd95f('0x1b')][_0xd95f('0x1c')](_0x1d75a3['body'],{'raw':_0x1d75a3['options']?_0x1d75a3[_0xd95f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d75a3[_0xd95f('0x17')]?_0x1d75a3[_0xd95f('0x17')][_0xd95f('0x1d')]||null:null,'attributes':_0x1d75a3[_0xd95f('0x17')]?_0x1d75a3[_0xd95f('0x17')]['attributes']||null:null,'limit':_0x1d75a3[_0xd95f('0x17')]?_0x1d75a3[_0xd95f('0x17')][_0xd95f('0x1e')]||null:null})[_0xd95f('0xc')](function(_0x57fed6){logger[_0xd95f('0xd')]('UpdateWhatsappQueueReport',_0x1d75a3);logger[_0xd95f('0x19')](_0xd95f('0x1a'),_0x1d75a3,JSON['stringify'](_0x57fed6));_0x5e20b2(_0x57fed6);})[_0xd95f('0x14')](function(_0x2c2801){logger[_0xd95f('0x11')](_0xd95f('0x1a'),_0x2c2801[_0xd95f('0x13')],_0x1d75a3);_0x17f4b2(_0x577fbe[_0xd95f('0x11')](0x1f4,_0x2c2801[_0xd95f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a2d2bb2..0520646 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 _0x73ea=['../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x364f71,_0x41b69d){var _0x431426=function(_0x8f46af){while(--_0x8f46af){_0x364f71['push'](_0x364f71['shift']());}};_0x431426(++_0x41b69d);}(_0x73ea,0x1ab));var _0xa73e=function(_0x269156,_0x2d130d){_0x269156=_0x269156-0x0;var _0x2f0b63=_0x73ea[_0x269156];return _0x2f0b63;};'use strict';var multer=require(_0xa73e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa73e('0x1'));var express=require('express');var router=express[_0xa73e('0x2')]();var fs_extra=require(_0xa73e('0x3'));var auth=require(_0xa73e('0x4'));var interaction=require(_0xa73e('0x5'));var config=require(_0xa73e('0x6'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa73e('0x7')]);router[_0xa73e('0x8')](_0xa73e('0x9'),auth[_0xa73e('0xa')](),controller[_0xa73e('0xb')]);router[_0xa73e('0x8')](_0xa73e('0xc'),auth[_0xa73e('0xa')](),controller[_0xa73e('0xd')]);router['post']('/',auth[_0xa73e('0xa')](),controller['create']);router['put'](_0xa73e('0xc'),auth[_0xa73e('0xa')](),controller['update']);router['delete']('/:id',auth[_0xa73e('0xa')](),controller[_0xa73e('0xe')]);module[_0xa73e('0xf')]=router; \ No newline at end of file +var _0x9269=['index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9269,0x1ae));var _0x9926=function(_0x2e0afd,_0x1a71f7){_0x2e0afd=_0x2e0afd-0x0;var _0x4cefad=_0x9269[_0x2e0afd];return _0x4cefad;};'use strict';var multer=require(_0x9926('0x0'));var util=require(_0x9926('0x1'));var path=require(_0x9926('0x2'));var timeout=require(_0x9926('0x3'));var express=require(_0x9926('0x4'));var router=express[_0x9926('0x5')]();var fs_extra=require(_0x9926('0x6'));var auth=require(_0x9926('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9926('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x9926('0x9')]('/',auth['isAuthenticated'](),controller[_0x9926('0xa')]);router[_0x9926('0x9')](_0x9926('0xb'),auth[_0x9926('0xc')](),controller[_0x9926('0xd')]);router[_0x9926('0x9')](_0x9926('0xe'),auth[_0x9926('0xc')](),controller['show']);router[_0x9926('0xf')]('/',auth['isAuthenticated'](),controller[_0x9926('0x10')]);router[_0x9926('0x11')](_0x9926('0xe'),auth[_0x9926('0xc')](),controller[_0x9926('0x12')]);router[_0x9926('0x13')](_0x9926('0xe'),auth[_0x9926('0xc')](),controller[_0x9926('0x14')]);module[_0x9926('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 01c38a5..52aebff 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 _0xfff0=['DATE','exports','STRING','ENUM','agent','queue'];(function(_0x4fd994,_0x199a8a){var _0x5034ec=function(_0x43e6e0){while(--_0x43e6e0){_0x4fd994['push'](_0x4fd994['shift']());}};_0x5034ec(++_0x199a8a);}(_0xfff0,0x139));var _0x0fff=function(_0xd5f81b,_0x296ca8){_0xd5f81b=_0xd5f81b-0x0;var _0x15686c=_0xfff0[_0xd5f81b];return _0x15686c;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'uniqueid':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0fff('0x2')]('account',_0x0fff('0x3'),_0x0fff('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0fff('0x5')]}}; \ No newline at end of file +var _0xae87=['account','agent','DATE'];(function(_0x564693,_0x2c46b6){var _0x505617=function(_0x166bc9){while(--_0x166bc9){_0x564693['push'](_0x564693['shift']());}};_0x505617(++_0x2c46b6);}(_0xae87,0x1ce));var _0x7ae8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xae87[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7ae8('0x0'),_0x7ae8('0x1'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7ae8('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 7e62b1e..fcfe617 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 _0x5eef=['findAll','rows','catch','show','params','options','find','create','body','describe','zip-dir','request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','WhatsappTransferReport','then','includeAll','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5eef,0x9c));var _0xf5ee=function(_0x1330d9,_0x187210){_0x1330d9=_0x1330d9-0x0;var _0x4b7c15=_0x5eef[_0x1330d9];return _0x4b7c15;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf5ee('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5ee('0x1'));var moment=require('moment');var BPromise=require(_0xf5ee('0x2'));var Mustache=require(_0xf5ee('0x3'));var util=require(_0xf5ee('0x4'));var path=require(_0xf5ee('0x5'));var sox=require(_0xf5ee('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5ee('0x7'));var squel=require(_0xf5ee('0x8'));var crypto=require('crypto');var jsforce=require(_0xf5ee('0x9'));var deskjs=require(_0xf5ee('0xa'));var toCsv=require(_0xf5ee('0xb'));var querystring=require(_0xf5ee('0xc'));var Papa=require(_0xf5ee('0xd'));var Redis=require(_0xf5ee('0xe'));var authService=require(_0xf5ee('0xf'));var qs=require(_0xf5ee('0x10'));var as=require(_0xf5ee('0x11'));var hardwareService=require(_0xf5ee('0x12'));var logger=require('../../config/logger')(_0xf5ee('0x13'));var utils=require('../../config/utils');var config=require(_0xf5ee('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5ee('0x15'))['db'];function respondWithStatusCode(_0x4513e8,_0x2d6369){_0x2d6369=_0x2d6369||0xcc;return function(_0x45bcb6){if(_0x45bcb6){return _0x4513e8['sendStatus'](_0x2d6369);}return _0x4513e8[_0xf5ee('0x16')](_0x2d6369)[_0xf5ee('0x17')]();};}function respondWithResult(_0x204afe,_0x22d22c){_0x22d22c=_0x22d22c||0xc8;return function(_0x51c2e8){if(_0x51c2e8){return _0x204afe['status'](_0x22d22c)[_0xf5ee('0x18')](_0x51c2e8);}};}function respondWithFilteredResult(_0x1c6a53,_0x9cb81a){return function(_0x43f6ce){if(_0x43f6ce){var _0x23525c=typeof _0x9cb81a['offset']===_0xf5ee('0x19')&&typeof _0x9cb81a[_0xf5ee('0x1a')]==='undefined';var _0xb50dec=_0x43f6ce[_0xf5ee('0x1b')];var _0x26cb76=_0x23525c?0x0:_0x9cb81a[_0xf5ee('0x1c')];var _0x47a0b2=_0x23525c?_0x43f6ce[_0xf5ee('0x1b')]:_0x9cb81a[_0xf5ee('0x1c')]+_0x9cb81a[_0xf5ee('0x1a')];var _0x4d8919;if(_0x47a0b2>=_0xb50dec){_0x47a0b2=_0xb50dec;_0x4d8919=0xc8;}else{_0x4d8919=0xce;}_0x1c6a53[_0xf5ee('0x16')](_0x4d8919);return _0x1c6a53[_0xf5ee('0x1d')](_0xf5ee('0x1e'),_0x26cb76+'-'+_0x47a0b2+'/'+_0xb50dec)[_0xf5ee('0x18')](_0x43f6ce);}return null;};}function patchUpdates(_0x192d0c){return function(_0x41e9d1){try{jsonpatch['apply'](_0x41e9d1,_0x192d0c,!![]);}catch(_0x48dffd){return BPromise[_0xf5ee('0x1f')](_0x48dffd);}return _0x41e9d1[_0xf5ee('0x20')]();};}function saveUpdates(_0x29bf1e,_0x1fea77){return function(_0x4a8f85){if(_0x4a8f85){return _0x4a8f85[_0xf5ee('0x21')](_0x29bf1e)['then'](function(_0x1a7299){return _0x1a7299;});}return null;};}function removeEntity(_0x2a61ac,_0x2e2f35){return function(_0x1c53bd){if(_0x1c53bd){return _0x1c53bd[_0xf5ee('0x22')]()['then'](function(){_0x2a61ac[_0xf5ee('0x16')](0xcc)[_0xf5ee('0x17')]();});}};}function handleEntityNotFound(_0x5b7744,_0x262f9a){return function(_0x196722){if(!_0x196722){_0x5b7744[_0xf5ee('0x23')](0x194);}return _0x196722;};}function handleError(_0x1c629f,_0xe647a5){_0xe647a5=_0xe647a5||0x1f4;return function(_0x3db008){logger[_0xf5ee('0x24')](_0x3db008[_0xf5ee('0x25')]);if(_0x3db008[_0xf5ee('0x26')]){delete _0x3db008['name'];}_0x1c629f['status'](_0xe647a5)[_0xf5ee('0x27')](_0x3db008);};}exports[_0xf5ee('0x28')]=function(_0x1da1b0,_0x54d5d8){var _0x11b67c={},_0x46359c={},_0x2a8d59={'count':0x0,'rows':[]};var _0x4d872=_['map'](db['WhatsappTransferReport'][_0xf5ee('0x29')],function(_0x50c583){return{'name':_0x50c583[_0xf5ee('0x2a')],'type':_0x50c583['type'][_0xf5ee('0x2b')]};});_0x46359c['model']=_[_0xf5ee('0x2c')](_0x4d872,_0xf5ee('0x26'));_0x46359c[_0xf5ee('0x2d')]=_[_0xf5ee('0x2e')](_0x1da1b0[_0xf5ee('0x2d')]);_0x46359c[_0xf5ee('0x2f')]=_[_0xf5ee('0x30')](_0x46359c['model'],_0x46359c['query']);_0x11b67c[_0xf5ee('0x31')]=_[_0xf5ee('0x30')](_0x46359c[_0xf5ee('0x32')],qs[_0xf5ee('0x33')](_0x1da1b0[_0xf5ee('0x2d')][_0xf5ee('0x33')]));_0x11b67c['attributes']=_0x11b67c[_0xf5ee('0x31')][_0xf5ee('0x34')]?_0x11b67c[_0xf5ee('0x31')]:_0x46359c[_0xf5ee('0x32')];if(!_0x1da1b0[_0xf5ee('0x2d')]['hasOwnProperty']('nolimit')){_0x11b67c[_0xf5ee('0x1a')]=qs[_0xf5ee('0x1a')](_0x1da1b0[_0xf5ee('0x2d')][_0xf5ee('0x1a')]);_0x11b67c['offset']=qs[_0xf5ee('0x1c')](_0x1da1b0[_0xf5ee('0x2d')][_0xf5ee('0x1c')]);}_0x11b67c[_0xf5ee('0x35')]=qs[_0xf5ee('0x36')](_0x1da1b0[_0xf5ee('0x2d')][_0xf5ee('0x36')]);_0x11b67c[_0xf5ee('0x37')]=qs[_0xf5ee('0x2f')](_[_0xf5ee('0x38')](_0x1da1b0[_0xf5ee('0x2d')],_0x46359c[_0xf5ee('0x2f')]),_0x4d872);if(_0x1da1b0[_0xf5ee('0x2d')][_0xf5ee('0x39')]){_0x11b67c[_0xf5ee('0x37')]=_[_0xf5ee('0x3a')](_0x11b67c[_0xf5ee('0x37')],{'$or':_[_0xf5ee('0x2c')](_0x4d872,function(_0x1d3da3){if(_0x1d3da3['type']!=='VIRTUAL'){var _0x22d8c4={};_0x22d8c4[_0x1d3da3[_0xf5ee('0x26')]]={'$like':'%'+_0x1da1b0[_0xf5ee('0x2d')][_0xf5ee('0x39')]+'%'};return _0x22d8c4;}})});}_0x11b67c=_[_0xf5ee('0x3a')]({},_0x11b67c,_0x1da1b0['options']);var _0x2a541d={'where':_0x11b67c[_0xf5ee('0x37')]};return db[_0xf5ee('0x3b')][_0xf5ee('0x1b')](_0x2a541d)[_0xf5ee('0x3c')](function(_0x50fef2){_0x2a8d59[_0xf5ee('0x1b')]=_0x50fef2;if(_0x1da1b0[_0xf5ee('0x2d')][_0xf5ee('0x3d')]){_0x11b67c[_0xf5ee('0x3e')]=[{'all':!![]}];}return db[_0xf5ee('0x3b')][_0xf5ee('0x3f')](_0x11b67c);})[_0xf5ee('0x3c')](function(_0x4d2085){_0x2a8d59[_0xf5ee('0x40')]=_0x4d2085;return _0x2a8d59;})[_0xf5ee('0x3c')](respondWithFilteredResult(_0x54d5d8,_0x11b67c))[_0xf5ee('0x41')](handleError(_0x54d5d8,null));};exports[_0xf5ee('0x42')]=function(_0x22d7ab,_0x3109fa){var _0x437cb0={'raw':!![],'where':{'id':_0x22d7ab[_0xf5ee('0x43')]['id']}},_0x32791e={};_0x32791e[_0xf5ee('0x32')]=_['keys'](db[_0xf5ee('0x3b')][_0xf5ee('0x29')]);_0x32791e[_0xf5ee('0x2d')]=_['keys'](_0x22d7ab[_0xf5ee('0x2d')]);_0x32791e[_0xf5ee('0x2f')]=_[_0xf5ee('0x30')](_0x32791e['model'],_0x32791e[_0xf5ee('0x2d')]);_0x437cb0[_0xf5ee('0x31')]=_[_0xf5ee('0x30')](_0x32791e[_0xf5ee('0x32')],qs[_0xf5ee('0x33')](_0x22d7ab[_0xf5ee('0x2d')][_0xf5ee('0x33')]));_0x437cb0['attributes']=_0x437cb0[_0xf5ee('0x31')][_0xf5ee('0x34')]?_0x437cb0['attributes']:_0x32791e['model'];if(_0x22d7ab[_0xf5ee('0x2d')][_0xf5ee('0x3d')]){_0x437cb0[_0xf5ee('0x3e')]=[{'all':!![]}];}_0x437cb0=_[_0xf5ee('0x3a')]({},_0x437cb0,_0x22d7ab[_0xf5ee('0x44')]);return db[_0xf5ee('0x3b')][_0xf5ee('0x45')](_0x437cb0)[_0xf5ee('0x3c')](handleEntityNotFound(_0x3109fa,null))[_0xf5ee('0x3c')](respondWithResult(_0x3109fa,null))[_0xf5ee('0x41')](handleError(_0x3109fa,null));};exports[_0xf5ee('0x46')]=function(_0x698c50,_0x124557){return db[_0xf5ee('0x3b')][_0xf5ee('0x46')](_0x698c50[_0xf5ee('0x47')],{})[_0xf5ee('0x3c')](respondWithResult(_0x124557,0xc9))['catch'](handleError(_0x124557,null));};exports[_0xf5ee('0x21')]=function(_0x15039d,_0x2d7b9f){if(_0x15039d[_0xf5ee('0x47')]['id']){delete _0x15039d[_0xf5ee('0x47')]['id'];}return db[_0xf5ee('0x3b')][_0xf5ee('0x45')]({'where':{'id':_0x15039d[_0xf5ee('0x43')]['id']}})[_0xf5ee('0x3c')](handleEntityNotFound(_0x2d7b9f,null))['then'](saveUpdates(_0x15039d[_0xf5ee('0x47')],null))[_0xf5ee('0x3c')](respondWithResult(_0x2d7b9f,null))[_0xf5ee('0x41')](handleError(_0x2d7b9f,null));};exports[_0xf5ee('0x22')]=function(_0x539de3,_0x3d5d64){return db[_0xf5ee('0x3b')]['find']({'where':{'id':_0x539de3[_0xf5ee('0x43')]['id']}})[_0xf5ee('0x3c')](handleEntityNotFound(_0x3d5d64,null))[_0xf5ee('0x3c')](removeEntity(_0x3d5d64,null))[_0xf5ee('0x41')](handleError(_0x3d5d64,null));};exports[_0xf5ee('0x48')]=function(_0x4a7289,_0x44c227){return db[_0xf5ee('0x3b')][_0xf5ee('0x48')]()[_0xf5ee('0x3c')](respondWithResult(_0x44c227,null))['catch'](handleError(_0x44c227,null));}; \ No newline at end of file +var _0xdd2e=['create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','options','includeAll','include','WhatsappTransferReport','findAll','rows','catch','show','find'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0xdd2e,0x13d));var _0xedd2=function(_0x16005d,_0x277bae){_0x16005d=_0x16005d-0x0;var _0x17878f=_0xdd2e[_0x16005d];return _0x17878f;};'use strict';var emlformat=require(_0xedd2('0x0'));var rimraf=require(_0xedd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedd2('0x2'));var rp=require(_0xedd2('0x3'));var moment=require('moment');var BPromise=require(_0xedd2('0x4'));var Mustache=require(_0xedd2('0x5'));var util=require(_0xedd2('0x6'));var path=require(_0xedd2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xedd2('0x8'));var fs=require('fs');var fs_extra=require(_0xedd2('0x9'));var _=require(_0xedd2('0xa'));var squel=require(_0xedd2('0xb'));var crypto=require(_0xedd2('0xc'));var jsforce=require(_0xedd2('0xd'));var deskjs=require(_0xedd2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xedd2('0xf'));var Papa=require('papaparse');var Redis=require(_0xedd2('0x10'));var authService=require(_0xedd2('0x11'));var qs=require(_0xedd2('0x12'));var as=require(_0xedd2('0x13'));var hardwareService=require(_0xedd2('0x14'));var logger=require(_0xedd2('0x15'))(_0xedd2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedd2('0x17'));var db=require(_0xedd2('0x18'))['db'];function respondWithStatusCode(_0x41cbc5,_0x13a487){_0x13a487=_0x13a487||0xcc;return function(_0x59e4b1){if(_0x59e4b1){return _0x41cbc5['sendStatus'](_0x13a487);}return _0x41cbc5[_0xedd2('0x19')](_0x13a487)['end']();};}function respondWithResult(_0x513c1a,_0x20ee63){_0x20ee63=_0x20ee63||0xc8;return function(_0x503d13){if(_0x503d13){return _0x513c1a[_0xedd2('0x19')](_0x20ee63)['json'](_0x503d13);}};}function respondWithFilteredResult(_0x321537,_0x48d3a7){return function(_0x1bd995){if(_0x1bd995){var _0x1330a7=typeof _0x48d3a7[_0xedd2('0x1a')]===_0xedd2('0x1b')&&typeof _0x48d3a7[_0xedd2('0x1c')]===_0xedd2('0x1b');var _0x198ba3=_0x1bd995[_0xedd2('0x1d')];var _0x2ed67b=_0x1330a7?0x0:_0x48d3a7[_0xedd2('0x1a')];var _0x6e597b=_0x1330a7?_0x1bd995[_0xedd2('0x1d')]:_0x48d3a7['offset']+_0x48d3a7['limit'];var _0x3ba22c;if(_0x6e597b>=_0x198ba3){_0x6e597b=_0x198ba3;_0x3ba22c=0xc8;}else{_0x3ba22c=0xce;}_0x321537[_0xedd2('0x19')](_0x3ba22c);return _0x321537['set'](_0xedd2('0x1e'),_0x2ed67b+'-'+_0x6e597b+'/'+_0x198ba3)[_0xedd2('0x1f')](_0x1bd995);}return null;};}function patchUpdates(_0xd9f8ae){return function(_0x149ea6){try{jsonpatch['apply'](_0x149ea6,_0xd9f8ae,!![]);}catch(_0x10f1ae){return BPromise[_0xedd2('0x20')](_0x10f1ae);}return _0x149ea6[_0xedd2('0x21')]();};}function saveUpdates(_0x11d7e2,_0x5a02a3){return function(_0x445d7a){if(_0x445d7a){return _0x445d7a['update'](_0x11d7e2)[_0xedd2('0x22')](function(_0x46bd61){return _0x46bd61;});}return null;};}function removeEntity(_0x51373a,_0x1afc7d){return function(_0x31f44b){if(_0x31f44b){return _0x31f44b[_0xedd2('0x23')]()[_0xedd2('0x22')](function(){_0x51373a[_0xedd2('0x19')](0xcc)[_0xedd2('0x24')]();});}};}function handleEntityNotFound(_0x5e9a0a,_0x598574){return function(_0x91d7c0){if(!_0x91d7c0){_0x5e9a0a[_0xedd2('0x25')](0x194);}return _0x91d7c0;};}function handleError(_0xff41ed,_0x4127bc){_0x4127bc=_0x4127bc||0x1f4;return function(_0x2f1079){logger[_0xedd2('0x26')](_0x2f1079[_0xedd2('0x27')]);if(_0x2f1079[_0xedd2('0x28')]){delete _0x2f1079[_0xedd2('0x28')];}_0xff41ed['status'](_0x4127bc)[_0xedd2('0x29')](_0x2f1079);};}exports[_0xedd2('0x2a')]=function(_0x5d47ab,_0x1c9c3f){var _0x18a830={},_0x57018a={},_0x3c72a4={'count':0x0,'rows':[]};var _0x214260=_['map'](db['WhatsappTransferReport'][_0xedd2('0x2b')],function(_0x534930){return{'name':_0x534930['fieldName'],'type':_0x534930[_0xedd2('0x2c')][_0xedd2('0x2d')]};});_0x57018a['model']=_['map'](_0x214260,_0xedd2('0x28'));_0x57018a[_0xedd2('0x2e')]=_[_0xedd2('0x2f')](_0x5d47ab['query']);_0x57018a[_0xedd2('0x30')]=_[_0xedd2('0x31')](_0x57018a[_0xedd2('0x32')],_0x57018a[_0xedd2('0x2e')]);_0x18a830[_0xedd2('0x33')]=_[_0xedd2('0x31')](_0x57018a['model'],qs[_0xedd2('0x34')](_0x5d47ab['query'][_0xedd2('0x34')]));_0x18a830['attributes']=_0x18a830[_0xedd2('0x33')][_0xedd2('0x35')]?_0x18a830[_0xedd2('0x33')]:_0x57018a[_0xedd2('0x32')];if(!_0x5d47ab['query'][_0xedd2('0x36')](_0xedd2('0x37'))){_0x18a830[_0xedd2('0x1c')]=qs[_0xedd2('0x1c')](_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x1c')]);_0x18a830[_0xedd2('0x1a')]=qs[_0xedd2('0x1a')](_0x5d47ab[_0xedd2('0x2e')]['offset']);}_0x18a830[_0xedd2('0x38')]=qs[_0xedd2('0x39')](_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x39')]);_0x18a830['where']=qs['filters'](_[_0xedd2('0x3a')](_0x5d47ab[_0xedd2('0x2e')],_0x57018a[_0xedd2('0x30')]),_0x214260);if(_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x3b')]){_0x18a830['where']=_[_0xedd2('0x3c')](_0x18a830[_0xedd2('0x3d')],{'$or':_[_0xedd2('0x3e')](_0x214260,function(_0x27a648){if(_0x27a648[_0xedd2('0x2c')]!==_0xedd2('0x3f')){var _0x315afc={};_0x315afc[_0x27a648['name']]={'$like':'%'+_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x3b')]+'%'};return _0x315afc;}})});}_0x18a830=_[_0xedd2('0x3c')]({},_0x18a830,_0x5d47ab[_0xedd2('0x40')]);var _0x3e6893={'where':_0x18a830['where']};return db['WhatsappTransferReport'][_0xedd2('0x1d')](_0x3e6893)[_0xedd2('0x22')](function(_0x3eed1b){_0x3c72a4[_0xedd2('0x1d')]=_0x3eed1b;if(_0x5d47ab[_0xedd2('0x2e')][_0xedd2('0x41')]){_0x18a830[_0xedd2('0x42')]=[{'all':!![]}];}return db[_0xedd2('0x43')][_0xedd2('0x44')](_0x18a830);})[_0xedd2('0x22')](function(_0x33efca){_0x3c72a4[_0xedd2('0x45')]=_0x33efca;return _0x3c72a4;})[_0xedd2('0x22')](respondWithFilteredResult(_0x1c9c3f,_0x18a830))[_0xedd2('0x46')](handleError(_0x1c9c3f,null));};exports[_0xedd2('0x47')]=function(_0x31a216,_0x1c38da){var _0x4605b9={'raw':!![],'where':{'id':_0x31a216['params']['id']}},_0x102d7e={};_0x102d7e[_0xedd2('0x32')]=_[_0xedd2('0x2f')](db[_0xedd2('0x43')]['rawAttributes']);_0x102d7e['query']=_['keys'](_0x31a216['query']);_0x102d7e[_0xedd2('0x30')]=_[_0xedd2('0x31')](_0x102d7e[_0xedd2('0x32')],_0x102d7e['query']);_0x4605b9[_0xedd2('0x33')]=_[_0xedd2('0x31')](_0x102d7e[_0xedd2('0x32')],qs[_0xedd2('0x34')](_0x31a216[_0xedd2('0x2e')][_0xedd2('0x34')]));_0x4605b9[_0xedd2('0x33')]=_0x4605b9[_0xedd2('0x33')][_0xedd2('0x35')]?_0x4605b9[_0xedd2('0x33')]:_0x102d7e['model'];if(_0x31a216[_0xedd2('0x2e')][_0xedd2('0x41')]){_0x4605b9[_0xedd2('0x42')]=[{'all':!![]}];}_0x4605b9=_[_0xedd2('0x3c')]({},_0x4605b9,_0x31a216[_0xedd2('0x40')]);return db[_0xedd2('0x43')][_0xedd2('0x48')](_0x4605b9)[_0xedd2('0x22')](handleEntityNotFound(_0x1c38da,null))['then'](respondWithResult(_0x1c38da,null))[_0xedd2('0x46')](handleError(_0x1c38da,null));};exports[_0xedd2('0x49')]=function(_0x27d3ca,_0x76d7ab){return db[_0xedd2('0x43')][_0xedd2('0x49')](_0x27d3ca[_0xedd2('0x4a')],{})[_0xedd2('0x22')](respondWithResult(_0x76d7ab,0xc9))[_0xedd2('0x46')](handleError(_0x76d7ab,null));};exports[_0xedd2('0x4b')]=function(_0xe248dc,_0x39c9e5){if(_0xe248dc[_0xedd2('0x4a')]['id']){delete _0xe248dc[_0xedd2('0x4a')]['id'];}return db[_0xedd2('0x43')][_0xedd2('0x48')]({'where':{'id':_0xe248dc[_0xedd2('0x4c')]['id']}})[_0xedd2('0x22')](handleEntityNotFound(_0x39c9e5,null))[_0xedd2('0x22')](saveUpdates(_0xe248dc[_0xedd2('0x4a')],null))[_0xedd2('0x22')](respondWithResult(_0x39c9e5,null))[_0xedd2('0x46')](handleError(_0x39c9e5,null));};exports[_0xedd2('0x23')]=function(_0x10e14f,_0x4bb8a4){return db[_0xedd2('0x43')][_0xedd2('0x48')]({'where':{'id':_0x10e14f[_0xedd2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4bb8a4,null))['then'](removeEntity(_0x4bb8a4,null))[_0xedd2('0x46')](handleError(_0x4bb8a4,null));};exports['describe']=function(_0x4ab8cc,_0x1023b2){return db['WhatsappTransferReport'][_0xedd2('0x4d')]()['then'](respondWithResult(_0x1023b2,null))[_0xedd2('0x46')](handleError(_0x1023b2,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 0b95805..d327706 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 _0x75e4=['request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define','uniqueid','lodash','api','moment','bluebird'];(function(_0x1fba16,_0x4872d4){var _0x20d844=function(_0x10a157){while(--_0x10a157){_0x1fba16['push'](_0x1fba16['shift']());}};_0x20d844(++_0x4872d4);}(_0x75e4,0x10a));var _0x475e=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x75e4[_0x1a7846];return _0x48049;};'use strict';var _=require(_0x475e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x475e('0x1'));var moment=require(_0x475e('0x2'));var BPromise=require(_0x475e('0x3'));var rp=require(_0x475e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x475e('0x5'));var attributes=require(_0x475e('0x6'));module[_0x475e('0x7')]=function(_0x2e01de,_0x33648a){return _0x2e01de[_0x475e('0x8')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x475e('0x9'),'fields':[_0x475e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cbd=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x9cbd,0x18e));var _0xd9cb=function(_0x368167,_0x5a1132){_0x368167=_0x368167-0x0;var _0x3962ba=_0x9cbd[_0x368167];return _0x3962ba;};'use strict';var _=require('lodash');var util=require(_0xd9cb('0x0'));var logger=require(_0xd9cb('0x1'))(_0xd9cb('0x2'));var moment=require(_0xd9cb('0x3'));var BPromise=require(_0xd9cb('0x4'));var rp=require(_0xd9cb('0x5'));var fs=require('fs');var path=require(_0xd9cb('0x6'));var rimraf=require('rimraf');var config=require(_0xd9cb('0x7'));var attributes=require(_0xd9cb('0x8'));module[_0xd9cb('0x9')]=function(_0x1aa02f,_0x3f8fb6){return _0x1aa02f[_0xd9cb('0xa')](_0xd9cb('0xb'),attributes,{'tableName':_0xd9cb('0xc'),'paranoid':![],'indexes':[{'name':_0xd9cb('0xd'),'fields':[_0xd9cb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f9bd05d..6a287a9 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 _0x48fc=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2c933c,_0x747b06){var _0xb359fd=function(_0x333087){while(--_0x333087){_0x2c933c['push'](_0x2c933c['shift']());}};_0xb359fd(++_0x747b06);}(_0x48fc,0xa8));var _0xc48f=function(_0x4bf404,_0x13f0c1){_0x4bf404=_0x4bf404-0x0;var _0x4a662d=_0x48fc[_0x4bf404];return _0x4a662d;};'use strict';var _=require(_0xc48f('0x0'));var util=require(_0xc48f('0x1'));var moment=require('moment');var BPromise=require(_0xc48f('0x2'));var rs=require(_0xc48f('0x3'));var fs=require('fs');var Redis=require(_0xc48f('0x4'));var db=require(_0xc48f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc48f('0x6'))(_0xc48f('0x7'));var config=require(_0xc48f('0x8'));var jayson=require(_0xc48f('0x9'));var client=jayson[_0xc48f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff171,_0x51b97e,_0x1d2e2c){return new BPromise(function(_0x1fb041,_0x5e0b5c){return client[_0xc48f('0xb')](_0x4ff171,_0x1d2e2c)['then'](function(_0x415411){logger[_0xc48f('0xc')](_0xc48f('0xd'),_0x51b97e,_0xc48f('0xe'));logger[_0xc48f('0xf')](_0xc48f('0x10'),_0x51b97e,_0xc48f('0xe'),JSON['stringify'](_0x415411));if(_0x415411[_0xc48f('0x11')]){if(_0x415411[_0xc48f('0x11')]['code']===0x1f4){logger['error'](_0xc48f('0xd'),_0x51b97e,_0x415411[_0xc48f('0x11')][_0xc48f('0x12')]);return _0x5e0b5c(_0x415411[_0xc48f('0x11')][_0xc48f('0x12')]);}logger['error'](_0xc48f('0xd'),_0x51b97e,_0x415411[_0xc48f('0x11')][_0xc48f('0x12')]);return _0x1fb041(_0x415411[_0xc48f('0x11')][_0xc48f('0x12')]);}else{logger[_0xc48f('0xc')](_0xc48f('0xd'),_0x51b97e,'request\x20sent');_0x1fb041(_0x415411['result']['message']);}})[_0xc48f('0x13')](function(_0x571f31){logger[_0xc48f('0x11')](_0xc48f('0xd'),_0x51b97e,_0x571f31);_0x5e0b5c(_0x571f31);});});} \ No newline at end of file +var _0x3e49=['jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xf2a3bc,_0x5671b8){var _0x56708c=function(_0x42e7ac){while(--_0x42e7ac){_0xf2a3bc['push'](_0xf2a3bc['shift']());}};_0x56708c(++_0x5671b8);}(_0x3e49,0x1b1));var _0x93e4=function(_0xd67a3,_0x1abfa4){_0xd67a3=_0xd67a3-0x0;var _0x266de8=_0x3e49[_0xd67a3];return _0x266de8;};'use strict';var _=require(_0x93e4('0x0'));var util=require(_0x93e4('0x1'));var moment=require(_0x93e4('0x2'));var BPromise=require('bluebird');var rs=require(_0x93e4('0x3'));var fs=require('fs');var Redis=require(_0x93e4('0x4'));var db=require(_0x93e4('0x5'))['db'];var utils=require(_0x93e4('0x6'));var logger=require('../../config/logger')(_0x93e4('0x7'));var config=require('../../config/environment');var jayson=require(_0x93e4('0x8'));var client=jayson['client'][_0x93e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4a6,_0x348e98,_0x19dc2f){return new BPromise(function(_0x4737ad,_0x4e6ed9){return client[_0x93e4('0xa')](_0x23e4a6,_0x19dc2f)[_0x93e4('0xb')](function(_0x1c9cf9){logger[_0x93e4('0xc')](_0x93e4('0xd'),_0x348e98,_0x93e4('0xe'));logger[_0x93e4('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x348e98,_0x93e4('0xe'),JSON['stringify'](_0x1c9cf9));if(_0x1c9cf9[_0x93e4('0x10')]){if(_0x1c9cf9[_0x93e4('0x10')][_0x93e4('0x11')]===0x1f4){logger['error'](_0x93e4('0xd'),_0x348e98,_0x1c9cf9[_0x93e4('0x10')][_0x93e4('0x12')]);return _0x4e6ed9(_0x1c9cf9[_0x93e4('0x10')][_0x93e4('0x12')]);}logger[_0x93e4('0x10')](_0x93e4('0xd'),_0x348e98,_0x1c9cf9[_0x93e4('0x10')][_0x93e4('0x12')]);return _0x4737ad(_0x1c9cf9['error']['message']);}else{logger[_0x93e4('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x348e98,'request\x20sent');_0x4737ad(_0x1c9cf9[_0x93e4('0x13')]['message']);}})[_0x93e4('0x14')](function(_0x5f37e8){logger['error'](_0x93e4('0xd'),_0x348e98,_0x5f37e8);_0x4e6ed9(_0x5f37e8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 18b579f..beef57d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ae4=['./config/schedule/whatsapp','sequelize','sync','then','start','info','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','seedDB','./config/seedDB','default','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule'];(function(_0x58d253,_0x130aea){var _0x536b8a=function(_0xdf2efc){while(--_0xdf2efc){_0x58d253['push'](_0x58d253['shift']());}};_0x536b8a(++_0x130aea);}(_0x7ae4,0xfd));var _0x47ae=function(_0x4afd67,_0x1717f6){_0x4afd67=_0x4afd67-0x0;var _0x28a10e=_0x7ae4[_0x4afd67];return _0x28a10e;};'use strict';var _=require('lodash');var mysqldb=require(_0x47ae('0x0'));var rpc=require('./rpc');var config=require(_0x47ae('0x1'));var logger=require(_0x47ae('0x2'))(_0x47ae('0x3'));var pm2=require(_0x47ae('0x4'));var pm2Config=require(_0x47ae('0x5'));var schedule=require(_0x47ae('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x47ae('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x47ae('0x8')][_0x47ae('0x9')]()[_0x47ae('0xa')](function(){return rpc['listen']();})[_0x47ae('0xa')](function(_0x17e730){logger['info'](_0x17e730);return chat[_0x47ae('0xb')]();})[_0x47ae('0xa')](function(){return whatsapp[_0x47ae('0xb')]();})['then'](function(){return schedule[_0x47ae('0xb')]();})[_0x47ae('0xa')](function(){return transcribe[_0x47ae('0xb')]();})['then'](function(_0x34ccda){logger['info'](_0x34ccda);return pm2[_0x47ae('0xb')](pm2Config);})[_0x47ae('0xa')](function(_0x21205a){logger[_0x47ae('0xc')](_0x47ae('0xd'),_[_0x47ae('0xe')](_[_0x47ae('0xf')](_0x21205a,{'status':_0x47ae('0x10')}),_0x47ae('0x11'))[_0x47ae('0x12')]());logger[_0x47ae('0xc')](_0x47ae('0x13'),_[_0x47ae('0xe')](_['filter'](_0x21205a,function(_0x933914){return _0x933914[_0x47ae('0x14')]!==_0x47ae('0x10');}),_0x47ae('0x11'))['join']()||'None');config[_0x47ae('0x15')]&&require(_0x47ae('0x16'))['default']();require('./config/license')[_0x47ae('0x17')]();})['catch'](function(_0x39751b){logger['error'](_0x47ae('0x18'),_0x39751b);process[_0x47ae('0x19')](0x1);});}main(); \ No newline at end of file +var _0x2cea=['map','filter','online','name','join','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/environment','./config/logger','app','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','listen','then','info','start','Online\x20apps:'];(function(_0xd214ef,_0x4b28fe){var _0x656ed7=function(_0x555ef7){while(--_0x555ef7){_0xd214ef['push'](_0xd214ef['shift']());}};_0x656ed7(++_0x4b28fe);}(_0x2cea,0x11c));var _0xa2ce=function(_0xe3cfba,_0x14d39e){_0xe3cfba=_0xe3cfba-0x0;var _0x3feb92=_0x2cea[_0xe3cfba];return _0x3feb92;};'use strict';var _=require('lodash');var mysqldb=require(_0xa2ce('0x0'));var rpc=require('./rpc');var config=require(_0xa2ce('0x1'));var logger=require(_0xa2ce('0x2'))(_0xa2ce('0x3'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0xa2ce('0x4'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xa2ce('0x5'));var transcribe=require(_0xa2ce('0x6'));function main(){return mysqldb['db'][_0xa2ce('0x7')]['sync']()['then'](function(){return rpc[_0xa2ce('0x8')]();})[_0xa2ce('0x9')](function(_0x5ece69){logger[_0xa2ce('0xa')](_0x5ece69);return chat['start']();})[_0xa2ce('0x9')](function(){return whatsapp['start']();})[_0xa2ce('0x9')](function(){return schedule[_0xa2ce('0xb')]();})[_0xa2ce('0x9')](function(){return transcribe[_0xa2ce('0xb')]();})['then'](function(_0x56884d){logger[_0xa2ce('0xa')](_0x56884d);return pm2[_0xa2ce('0xb')](pm2Config);})[_0xa2ce('0x9')](function(_0x8664e8){logger[_0xa2ce('0xa')](_0xa2ce('0xc'),_[_0xa2ce('0xd')](_[_0xa2ce('0xe')](_0x8664e8,{'status':_0xa2ce('0xf')}),_0xa2ce('0x10'))[_0xa2ce('0x11')]());logger['info']('Offline\x20apps:',_[_0xa2ce('0xd')](_['filter'](_0x8664e8,function(_0x252d27){return _0x252d27[_0xa2ce('0x12')]!=='online';}),_0xa2ce('0x10'))[_0xa2ce('0x11')]()||_0xa2ce('0x13'));config[_0xa2ce('0x14')]&&require(_0xa2ce('0x15'))[_0xa2ce('0x16')]();require(_0xa2ce('0x17'))[_0xa2ce('0x16')]();})[_0xa2ce('0x18')](function(_0x8c86b){logger[_0xa2ce('0x19')](_0xa2ce('0x1a'),_0x8c86b);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 44c35f7..c91077f 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 _0xed38=['status','disposition','catch','isAuthenticated','headers','Basic','User','find','name','authenticate','json','Wrong\x20credentials.','startsWith','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','add','blockDuration','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','split','join','promisify','sign','secret','verify','randomBytes','toString','floor','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','internal','email','userpic','md5secret','voicePause','chatPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','closed','then'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0xed38,0xb0));var _0x8ed3=function(_0x463f9b,_0x14c34e){_0x463f9b=_0x463f9b-0x0;var _0x22da86=_0xed38[_0x463f9b];return _0x22da86;};'use strict';var db=require(_0x8ed3('0x0'))['db'];var config=require(_0x8ed3('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x8ed3('0x2'));var encryptor=require(_0x8ed3('0x3'));var _=require('lodash');var jwt=require(_0x8ed3('0x4'));var expressJwt=require(_0x8ed3('0x5'));var compose=require(_0x8ed3('0x6'));var basicAuth=require(_0x8ed3('0x7'));var crypto=require(_0x8ed3('0x8'));var BPromise=require(_0x8ed3('0x9'));var util=require('util');var moment=require(_0x8ed3('0xa'));var validateJwt=expressJwt({'secret':config[_0x8ed3('0xb')][_0x8ed3('0xc')]});var userAttributes=['id',_0x8ed3('0xd'),_0x8ed3('0xe'),'name',_0x8ed3('0xf'),_0x8ed3('0x10'),_0x8ed3('0x11'),'permissions',_0x8ed3('0x12'),_0x8ed3('0x13'),_0x8ed3('0x14'),'mailPause','faxPause',_0x8ed3('0x15'),_0x8ed3('0x16'),_0x8ed3('0x17'),_0x8ed3('0x18'),'lastLoginAt',_0x8ed3('0x19'),_0x8ed3('0x1a'),'allowmessenger',_0x8ed3('0x1b'),_0x8ed3('0x1c'),_0x8ed3('0x1d'),_0x8ed3('0x1e'),'phoneBarDnd',_0x8ed3('0x1f'),_0x8ed3('0x20'),_0x8ed3('0x21'),'phoneBarExpires',_0x8ed3('0x22'),'phoneBarRemoteControl',_0x8ed3('0x23'),'hotdesk',_0x8ed3('0x24'),_0x8ed3('0x25'),_0x8ed3('0x26'),_0x8ed3('0x27'),_0x8ed3('0x28'),'downloadVoiceRecordings',_0x8ed3('0x29'),_0x8ed3('0x2a')];exports[_0x8ed3('0x2b')]=function(){return this['isAuthenticated'](!![])[_0x8ed3('0x2c')](function(_0x27e713,_0x2a9fa4,_0x420dda){if(_0x27e713[_0x8ed3('0x2d')]){_0x420dda();}else{return db[_0x8ed3('0x2e')][_0x8ed3('0x2f')]({'where':{'id':_0x27e713['params']['id']},'attributes':['id',_0x8ed3('0x30'),'disposition'],'raw':!![]})[_0x8ed3('0x31')](function(_0x9129a6){if(_0x9129a6&&_0x9129a6[_0x8ed3('0x30')]){return _0x2a9fa4[_0x8ed3('0x32')](_0x9129a6[_0x8ed3('0x33')]==='unmanaged'?0x195:0x193)['json']({'message':_0x9129a6[_0x8ed3('0x33')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x420dda();}})[_0x8ed3('0x34')](function(_0x4711a1){_0x420dda(_0x4711a1);});}});};exports[_0x8ed3('0x35')]=function isAuthenticated(_0x2ddb14){return compose()[_0x8ed3('0x2c')](function(_0xcb5e2c,_0x47b675,_0x329737){var _0x31d06c;if(_0xcb5e2c[_0x8ed3('0x36')]['authorization']){if(_['startsWith'](_0xcb5e2c[_0x8ed3('0x36')]['authorization'],_0x8ed3('0x37'))){var _0x3a5333=basicAuth(_0xcb5e2c);db[_0x8ed3('0x38')][_0x8ed3('0x39')]({'where':{'name':_0x3a5333[_0x8ed3('0x3a')]}})[_0x8ed3('0x31')](function(_0x2f4842){if(!_0x2f4842||!_0x2f4842[_0x8ed3('0x3b')](_0x3a5333['pass'])){return _0x47b675['status'](0x191)[_0x8ed3('0x3c')]({'message':_0x8ed3('0x3d')});}_0xcb5e2c[_0x8ed3('0x2d')]={'id':_0x2f4842['id']};_0x329737();})[_0x8ed3('0x34')](function(_0x1fc004){_0x329737(_0x1fc004);});}else if(_[_0x8ed3('0x3e')](_0xcb5e2c[_0x8ed3('0x36')]['authorization'],'Bearer')){validateJwt(_0xcb5e2c,_0x47b675,_0x329737);}else{if(_0x2ddb14){_0x329737();}else{return _0x47b675['status'](0x193)[_0x8ed3('0x3c')]({'message':_0x8ed3('0x3f')});}}}else if(_0xcb5e2c[_0x8ed3('0x40')]['apikey']){try{var _0x573532={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x8ed3('0x41')]()};verifyJwt(_0xcb5e2c[_0x8ed3('0x40')][_0x8ed3('0x42')],_0x573532)[_0x8ed3('0x31')](function(_0x2f8f8e){return db[_0x8ed3('0x38')][_0x8ed3('0x39')]({'where':{'id':_0x2f8f8e[_0x8ed3('0x43')]}})[_0x8ed3('0x31')](function(_0xccd170){_0x31d06c=_0xccd170;return db['Setting'][_0x8ed3('0x2f')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x8ed3('0x31')](function(_0x28f749){if(!_0x31d06c||!_['isEqual'](_0x31d06c['apiKeyNonce'],_0x2f8f8e[_0x8ed3('0x44')])){return _0x47b675[_0x8ed3('0x32')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x31d06c[_0x8ed3('0x45')]){return _0x47b675[_0x8ed3('0x32')](0x191)[_0x8ed3('0x3c')]({'message':_0x8ed3('0x46')});}if(_0x31d06c[_0x8ed3('0x47')]){if(_0x28f749['blockDuration']>0x0){if(moment(_0x31d06c['blockedAt'])[_0x8ed3('0x48')](_0x28f749[_0x8ed3('0x49')],'minutes')>moment()){return _0x47b675[_0x8ed3('0x32')](0x191)[_0x8ed3('0x3c')]({'message':_0x8ed3('0x46')});}}else{return _0x47b675[_0x8ed3('0x32')](0x191)[_0x8ed3('0x3c')]({'message':_0x8ed3('0x46')});}}_0xcb5e2c['user']={'id':_0x31d06c['id']};_0x329737();});})[_0x8ed3('0x34')](function(){return _0x47b675[_0x8ed3('0x32')](0x191)['json']({'message':_0x8ed3('0x46')});});}catch(_0x59d918){_0x329737(_0x59d918);}}else if(_0x2ddb14){_0x329737();}else{return _0x47b675[_0x8ed3('0x32')](0x193)[_0x8ed3('0x3c')]({'message':'Unknown\x20authorization\x20format'});}})[_0x8ed3('0x2c')](function(_0xf97913,_0x52495a,_0x2b4e1a){if(_0xf97913[_0x8ed3('0x2d')]){db['User'][_0x8ed3('0x39')]({'where':{'id':_0xf97913[_0x8ed3('0x2d')]['id']},'attributes':userAttributes})[_0x8ed3('0x31')](function(_0x204495){if(!_0x204495){return _0x52495a[_0x8ed3('0x32')](0x194)[_0x8ed3('0x3c')]({'message':_0x8ed3('0x4a')});}_0xf97913[_0x8ed3('0x2d')]=_0x204495;_0x2b4e1a();})[_0x8ed3('0x34')](function(_0x673a8e){_0x2b4e1a(_0x673a8e);});}else if(_0x2ddb14){_0x2b4e1a();}else{return _0x52495a[_0x8ed3('0x32')](0x194)['json']({'message':_0x8ed3('0x4b')});}});};exports[_0x8ed3('0x4c')]=function canUpdate(){return compose()['use'](function(_0x41ef1e,_0x51b7ad,_0x46448e){return licenseUtil['getLicense']()[_0x8ed3('0x31')](function(_0x2752f4){if(_0x2752f4[_0x8ed3('0x4d')]){_0x46448e();}else{return _0x51b7ad['status'](0x193)['json']({'message':_0x8ed3('0x4e')});}})[_0x8ed3('0x34')](function(_0x5b3733){_0x46448e(_0x5b3733);});});};exports[_0x8ed3('0x4f')]=function(_0x459ba3,_0x24eecc,_0x38a6df){_0x459ba3[_0x8ed3('0x4f')]=!![];return _0x38a6df();};exports[_0x8ed3('0x50')]=function signToken(_0x15e489){return signJwt(_0x15e489);};exports['setTokenCookie']=function(_0x211d83,_0x153cc7){if(!_0x211d83[_0x8ed3('0x2d')]){return _0x153cc7['status'](0x194)['json']({'message':_0x8ed3('0x51')});}var _0x14fb91={'payload':{'id':_0x211d83['user']['id'],'role':_0x211d83['user'][_0x8ed3('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x14fb91)[_0x8ed3('0x31')](function(_0x11e8a4){_0x153cc7[_0x8ed3('0x52')]('motion.token',_0x11e8a4);_0x153cc7[_0x8ed3('0x53')](_0x8ed3('0x54'));})['catch'](function(_0xa372fc){return _0x153cc7['status'](0x1f4)[_0x8ed3('0x55')](_0xa372fc);});};exports[_0x8ed3('0x56')]=function(_0x2248bc){if(_[_0x8ed3('0x57')](_0x2248bc['apiKeyNonce'])||_[_0x8ed3('0x57')](_0x2248bc[_0x8ed3('0x58')])){return null;}else{return createJwt(_0x2248bc);}};exports[_0x8ed3('0x59')]=function(_0x310607){_0x310607[_0x8ed3('0x5a')]=generateNonce();_0x310607[_0x8ed3('0x58')]=generateIssuedAt();return createJwt(_0x310607);};exports[_0x8ed3('0x5b')]=function(_0xa86da8,_0x30c863){var _0x29bd07=_0xa86da8['query'][_0x8ed3('0x42')];if(_0x29bd07){var _0x24627f={'nonce':_0x30c863[_0x8ed3('0x5a')],'iat':_0x30c863[_0x8ed3('0x58')],'audience':hardwareConf[_0x8ed3('0x41')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x29bd07,_0x24627f)[_0x8ed3('0x31')](function(){return generateApiKey(_0x30c863);});}else{throw{'message':_0x8ed3('0x5c')};}};exports[_0x8ed3('0x5d')]=function(_0x1ddd92){var _0xaf568e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xaf568e[_0x8ed3('0x5e')](_0x1ddd92))throw new db[(_0x8ed3('0x5f'))]['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[_0x8ed3('0x60')]=function(_0x5f548c,_0x4e87b5,_0x68b2c4){var _0x4691e4=encryptor[_0x8ed3('0x61')](_0x4e87b5)['split'](',');for(var _0x2eb067=0x0;_0x2eb067<_0x68b2c4;_0x2eb067++){if(!_0x4691e4[_0x2eb067])break;if(_0x5f548c['toLowerCase']()===_0x4691e4[_0x2eb067][_0x8ed3('0x62')]()){var _0x36e434=util[_0x8ed3('0x63')](_0x8ed3('0x64'),_0x68b2c4);if(_0x68b2c4===0x1){_0x36e434='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x8ed3('0x65'))](_0x36e434);}}return;};exports[_0x8ed3('0x66')]=function(_0x45288f,_0x348561){var _0x5e002d=_0x348561?encryptor[_0x8ed3('0x61')](_0x348561)[_0x8ed3('0x67')](','):[];if(_0x5e002d['length']===0x5){_0x5e002d['splice'](-0x1,0x1);}_0x5e002d['unshift'](_0x45288f);return encryptor['encryptString'](_0x5e002d[_0x8ed3('0x68')](','));};function signJwt(_0x217b62){var _0x226c77=BPromise[_0x8ed3('0x69')](jwt[_0x8ed3('0x6a')],{'context':jwt});var _0x4f6cec=_0x217b62[_0x8ed3('0x6b')]||config[_0x8ed3('0xb')]['session'];return new BPromise(function(_0x28f6d2,_0x849752){_0x226c77(_0x217b62['payload'],_0x4f6cec,_0x217b62['options'])[_0x8ed3('0x31')](function(_0x5cf57e){_0x28f6d2(_0x5cf57e);})[_0x8ed3('0x34')](function(_0xe2fa63){_0x849752(_0xe2fa63);});});}function verifyJwt(_0x7103da,_0x1bf3d5,_0x3ccee5){var _0x134c9c=BPromise[_0x8ed3('0x69')](jwt[_0x8ed3('0x6c')],{'context':jwt});var _0x2bb463=_0x3ccee5||config[_0x8ed3('0xb')]['session'];return new BPromise(function(_0x584737,_0x21c2ee){_0x134c9c(_0x7103da,_0x2bb463,_0x1bf3d5)['then'](function(_0x26d31a){_0x584737(_0x26d31a);})[_0x8ed3('0x34')](function(_0x4f8e99){_0x21c2ee(_0x4f8e99);});});}function generateNonce(){return crypto[_0x8ed3('0x6d')](0x10)[_0x8ed3('0x6e')]('hex');}function generateIssuedAt(){return Math[_0x8ed3('0x6f')](Date['now']()/0x3e8)[_0x8ed3('0x6e')]();}function createJwt(_0xe88693){var _0x1f1706={'payload':{'iat':_0xe88693['apiKeyIat'],'nonce':_0xe88693[_0x8ed3('0x5a')]},'options':{'algorithm':_0x8ed3('0x70'),'subject':_0xe88693['id'][_0x8ed3('0x6e')](),'issuer':hardwareConf[_0x8ed3('0x41')](),'audience':hardwareConf[_0x8ed3('0x41')]()}};return signJwt(_0x1f1706)[_0x8ed3('0x31')](function(_0x2145dc){return{'iat':_0xe88693[_0x8ed3('0x58')],'nonce':_0xe88693[_0x8ed3('0x5a')],'token':_0x2145dc};});} \ No newline at end of file +var _0x845a=['userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','then','status','unmanaged','json','Forbidden.','catch','headers','startsWith','authorization','User','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','unshift','join','promisify','sign','payload','options','verify','randomBytes','toString','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x845a,0x1d1));var _0xa845=function(_0x36a0bb,_0x367dfd){_0x36a0bb=_0x36a0bb-0x0;var _0x2f59fd=_0x845a[_0x36a0bb];return _0x2f59fd;};'use strict';var db=require(_0xa845('0x0'))['db'];var config=require(_0xa845('0x1'));var hardwareConf=require(_0xa845('0x2'));var licenseUtil=require(_0xa845('0x3'));var encryptor=require('../encryptor');var _=require(_0xa845('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xa845('0x5'));var compose=require(_0xa845('0x6'));var basicAuth=require(_0xa845('0x7'));var crypto=require(_0xa845('0x8'));var BPromise=require(_0xa845('0x9'));var util=require('util');var moment=require(_0xa845('0xa'));var validateJwt=expressJwt({'secret':config[_0xa845('0xb')][_0xa845('0xc')]});var userAttributes=['id',_0xa845('0xd'),_0xa845('0xe'),_0xa845('0xf'),_0xa845('0x10'),_0xa845('0x11'),_0xa845('0x12'),_0xa845('0x13'),_0xa845('0x14'),_0xa845('0x15'),'chatPause','mailPause',_0xa845('0x16'),_0xa845('0x17'),_0xa845('0x18'),_0xa845('0x19'),_0xa845('0x1a'),_0xa845('0x1b'),'lastPauseAt',_0xa845('0x1c'),'allowmessenger','passwordResetAt',_0xa845('0x1d'),_0xa845('0x1e'),_0xa845('0x1f'),_0xa845('0x20'),_0xa845('0x21'),'phoneBarEnableDtmfTone',_0xa845('0x22'),_0xa845('0x23'),'phoneBarPrefixRequired',_0xa845('0x24'),_0xa845('0x25'),_0xa845('0x26'),'interface',_0xa845('0x27'),_0xa845('0x28'),_0xa845('0x29'),'wssPort',_0xa845('0x2a'),_0xa845('0x2b'),_0xa845('0x2c')];exports[_0xa845('0x2d')]=function(){return this[_0xa845('0x2e')](!![])[_0xa845('0x2f')](function(_0x509191,_0x5137c2,_0x4b237d){if(_0x509191[_0xa845('0x30')]){_0x4b237d();}else{return db[_0xa845('0x31')][_0xa845('0x32')]({'where':{'id':_0x509191[_0xa845('0x33')]['id']},'attributes':['id','closed',_0xa845('0x34')],'raw':!![]})[_0xa845('0x35')](function(_0x2661dc){if(_0x2661dc&&_0x2661dc['closed']){return _0x5137c2[_0xa845('0x36')](_0x2661dc[_0xa845('0x34')]===_0xa845('0x37')?0x195:0x193)[_0xa845('0x38')]({'message':_0x2661dc[_0xa845('0x34')]===_0xa845('0x37')?'Unmanaged.':_0xa845('0x39')});}else{_0x4b237d();}})[_0xa845('0x3a')](function(_0x5ee788){_0x4b237d(_0x5ee788);});}});};exports[_0xa845('0x2e')]=function isAuthenticated(_0x28d8d2){return compose()[_0xa845('0x2f')](function(_0x7b3543,_0x505844,_0x953971){var _0x2cee8a;if(_0x7b3543[_0xa845('0x3b')]['authorization']){if(_[_0xa845('0x3c')](_0x7b3543[_0xa845('0x3b')][_0xa845('0x3d')],'Basic')){var _0x3a180d=basicAuth(_0x7b3543);db[_0xa845('0x3e')]['find']({'where':{'name':_0x3a180d[_0xa845('0xf')]}})[_0xa845('0x35')](function(_0x10ad35){if(!_0x10ad35||!_0x10ad35[_0xa845('0x3f')](_0x3a180d[_0xa845('0x40')])){return _0x505844[_0xa845('0x36')](0x191)[_0xa845('0x38')]({'message':_0xa845('0x41')});}_0x7b3543[_0xa845('0x30')]={'id':_0x10ad35['id']};_0x953971();})['catch'](function(_0x1b8e3b){_0x953971(_0x1b8e3b);});}else if(_['startsWith'](_0x7b3543[_0xa845('0x3b')][_0xa845('0x3d')],_0xa845('0x42'))){validateJwt(_0x7b3543,_0x505844,_0x953971);}else{if(_0x28d8d2){_0x953971();}else{return _0x505844[_0xa845('0x36')](0x193)[_0xa845('0x38')]({'message':_0xa845('0x43')});}}}else if(_0x7b3543[_0xa845('0x44')][_0xa845('0x45')]){try{var _0x3ad826={'audience':hardwareConf[_0xa845('0x46')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x7b3543[_0xa845('0x44')]['apikey'],_0x3ad826)[_0xa845('0x35')](function(_0x8ecaba){return db[_0xa845('0x3e')][_0xa845('0x47')]({'where':{'id':_0x8ecaba[_0xa845('0x48')]}})[_0xa845('0x35')](function(_0x3fa540){_0x2cee8a=_0x3fa540;return db[_0xa845('0x49')][_0xa845('0x32')]({'where':{'id':0x1},'attributes':[_0xa845('0x4a'),_0xa845('0x4b')],'raw':!![]});})[_0xa845('0x35')](function(_0x4b62f8){if(!_0x2cee8a||!_[_0xa845('0x4c')](_0x2cee8a['apiKeyNonce'],_0x8ecaba[_0xa845('0x4d')])){return _0x505844[_0xa845('0x36')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x2cee8a[_0xa845('0x4e')]){return _0x505844['status'](0x191)['json']({'message':_0xa845('0x4f')});}if(_0x2cee8a[_0xa845('0x50')]){if(_0x4b62f8[_0xa845('0x4b')]>0x0){if(moment(_0x2cee8a[_0xa845('0x51')])[_0xa845('0x52')](_0x4b62f8['blockDuration'],_0xa845('0x53'))>moment()){return _0x505844[_0xa845('0x36')](0x191)[_0xa845('0x38')]({'message':_0xa845('0x4f')});}}else{return _0x505844[_0xa845('0x36')](0x191)[_0xa845('0x38')]({'message':_0xa845('0x4f')});}}_0x7b3543['user']={'id':_0x2cee8a['id']};_0x953971();});})[_0xa845('0x3a')](function(){return _0x505844['status'](0x191)['json']({'message':_0xa845('0x4f')});});}catch(_0x343164){_0x953971(_0x343164);}}else if(_0x28d8d2){_0x953971();}else{return _0x505844['status'](0x193)[_0xa845('0x38')]({'message':'Unknown\x20authorization\x20format'});}})[_0xa845('0x2f')](function(_0x4ac386,_0x28d728,_0x2a86b5){if(_0x4ac386['user']){db['User'][_0xa845('0x47')]({'where':{'id':_0x4ac386['user']['id']},'attributes':userAttributes})[_0xa845('0x35')](function(_0x5e7fe2){if(!_0x5e7fe2){return _0x28d728[_0xa845('0x36')](0x194)[_0xa845('0x38')]({'message':_0xa845('0x54')});}_0x4ac386[_0xa845('0x30')]=_0x5e7fe2;_0x2a86b5();})[_0xa845('0x3a')](function(_0x383696){_0x2a86b5(_0x383696);});}else if(_0x28d8d2){_0x2a86b5();}else{return _0x28d728[_0xa845('0x36')](0x194)['json']({'message':_0xa845('0x55')});}});};exports[_0xa845('0x56')]=function canUpdate(){return compose()['use'](function(_0x5b32c4,_0x465cea,_0x5c8c8b){return licenseUtil[_0xa845('0x57')]()[_0xa845('0x35')](function(_0x246f95){if(_0x246f95[_0xa845('0x58')]){_0x5c8c8b();}else{return _0x465cea[_0xa845('0x36')](0x193)[_0xa845('0x38')]({'message':_0xa845('0x59')});}})[_0xa845('0x3a')](function(_0x5689b8){_0x5c8c8b(_0x5689b8);});});};exports[_0xa845('0x5a')]=function(_0x391451,_0x2fce98,_0x3e354d){_0x391451[_0xa845('0x5a')]=!![];return _0x3e354d();};exports[_0xa845('0x5b')]=function signToken(_0x3b4162){return signJwt(_0x3b4162);};exports[_0xa845('0x5c')]=function(_0x4247d4,_0x1ba221){if(!_0x4247d4[_0xa845('0x30')]){return _0x1ba221[_0xa845('0x36')](0x194)[_0xa845('0x38')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0xbad1ae={'payload':{'id':_0x4247d4[_0xa845('0x30')]['id'],'role':_0x4247d4[_0xa845('0x30')][_0xa845('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0xbad1ae)['then'](function(_0x2ab8d7){_0x1ba221[_0xa845('0x5d')](_0xa845('0x5e'),_0x2ab8d7);_0x1ba221[_0xa845('0x5f')](_0xa845('0x60'));})[_0xa845('0x3a')](function(_0x70bb13){return _0x1ba221[_0xa845('0x36')](0x1f4)[_0xa845('0x61')](_0x70bb13);});};exports[_0xa845('0x62')]=function(_0x4465f6){if(_[_0xa845('0x63')](_0x4465f6[_0xa845('0x64')])||_[_0xa845('0x63')](_0x4465f6['apiKeyIat'])){return null;}else{return createJwt(_0x4465f6);}};exports['generateApiKey']=function(_0x5e217a){_0x5e217a[_0xa845('0x64')]=generateNonce();_0x5e217a[_0xa845('0x65')]=generateIssuedAt();return createJwt(_0x5e217a);};exports[_0xa845('0x66')]=function(_0x5870e2,_0x49818c){var _0x307c51=_0x5870e2['query'][_0xa845('0x45')];if(_0x307c51){var _0x3563ae={'nonce':_0x49818c['apiKeyNonce'],'iat':_0x49818c[_0xa845('0x65')],'audience':hardwareConf[_0xa845('0x46')](),'issuer':hardwareConf[_0xa845('0x46')]()};return verifyJwt(_0x307c51,_0x3563ae)[_0xa845('0x35')](function(){return generateApiKey(_0x49818c);});}else{throw{'message':_0xa845('0x67')};}};exports['validatePasswordPattern']=function(_0x3291d0){var _0x114f34=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x114f34['test'](_0x3291d0))throw new db['Sequelize'][(_0xa845('0x68'))](_0xa845('0x69'));return;};exports[_0xa845('0x6a')]=function(_0x22ca77,_0x182f1d,_0x43256f){var _0x381da0=encryptor['decryptString'](_0x182f1d)[_0xa845('0x6b')](',');for(var _0x47f13a=0x0;_0x47f13a<_0x43256f;_0x47f13a++){if(!_0x381da0[_0x47f13a])break;if(_0x22ca77[_0xa845('0x6c')]()===_0x381da0[_0x47f13a][_0xa845('0x6c')]()){var _0x3cbb38=util[_0xa845('0x6d')](_0xa845('0x6e'),_0x43256f);if(_0x43256f===0x1){_0x3cbb38=_0xa845('0x6f');}throw new db[(_0xa845('0x70'))][(_0xa845('0x68'))](_0x3cbb38);}}return;};exports[_0xa845('0x71')]=function(_0x41559e,_0x15bfd9){var _0xba6ef=_0x15bfd9?encryptor['decryptString'](_0x15bfd9)[_0xa845('0x6b')](','):[];if(_0xba6ef[_0xa845('0x72')]===0x5){_0xba6ef['splice'](-0x1,0x1);}_0xba6ef[_0xa845('0x73')](_0x41559e);return encryptor['encryptString'](_0xba6ef[_0xa845('0x74')](','));};function signJwt(_0x44203e){var _0x598a68=BPromise[_0xa845('0x75')](jwt[_0xa845('0x76')],{'context':jwt});var _0x484df5=_0x44203e['secret']||config[_0xa845('0xb')][_0xa845('0xc')];return new BPromise(function(_0x7c9e12,_0x1f71ca){_0x598a68(_0x44203e[_0xa845('0x77')],_0x484df5,_0x44203e[_0xa845('0x78')])['then'](function(_0x2b9cf5){_0x7c9e12(_0x2b9cf5);})[_0xa845('0x3a')](function(_0xa23f68){_0x1f71ca(_0xa23f68);});});}function verifyJwt(_0x9243bb,_0x2f6587,_0xb763bf){var _0x5ba72e=BPromise[_0xa845('0x75')](jwt[_0xa845('0x79')],{'context':jwt});var _0x1909c3=_0xb763bf||config[_0xa845('0xb')]['session'];return new BPromise(function(_0x2a0916,_0xcfe9c5){_0x5ba72e(_0x9243bb,_0x1909c3,_0x2f6587)[_0xa845('0x35')](function(_0x24b74a){_0x2a0916(_0x24b74a);})[_0xa845('0x3a')](function(_0x3169e4){_0xcfe9c5(_0x3169e4);});});}function generateNonce(){return crypto[_0xa845('0x7a')](0x10)[_0xa845('0x7b')]('hex');}function generateIssuedAt(){return Math[_0xa845('0x7c')](Date[_0xa845('0x7d')]()/0x3e8)['toString']();}function createJwt(_0x371ce4){var _0x34e157={'payload':{'iat':_0x371ce4[_0xa845('0x65')],'nonce':_0x371ce4['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x371ce4['id'][_0xa845('0x7b')](),'issuer':hardwareConf[_0xa845('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x34e157)[_0xa845('0x35')](function(_0xdf276f){return{'iat':_0x371ce4[_0xa845('0x65')],'nonce':_0x371ce4[_0xa845('0x64')],'token':_0xdf276f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index f1572f2..06e67e9 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 _0xf26c=['secrets','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','end','write','close','unlink','update','final','encryptString','utf8','decryptString','secret','base64','lodash','../../config/environment','app'];(function(_0x3fdcee,_0x17dbfe){var _0x4a5788=function(_0x2030aa){while(--_0x2030aa){_0x3fdcee['push'](_0x3fdcee['shift']());}};_0x4a5788(++_0x17dbfe);}(_0xf26c,0xb1));var _0xcf26=function(_0x10628a,_0x1005f4){_0x10628a=_0x10628a-0x0;var _0x388374=_0xf26c[_0x10628a];return _0x388374;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xcf26('0x0'));var config=require(_0xcf26('0x1'));var logger=require('../../config/logger')(_0xcf26('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xcf26('0x3')]['session'],'algorithm':_0xcf26('0x4')};const fileOptions={'algorithm':'aes192'};if(config[_0xcf26('0x5')]&&config[_0xcf26('0x5')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xcf26('0x5')]['algorithm']);if(isSupported){fileOptions[_0xcf26('0x6')]=config['encrypt'][_0xcf26('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xcf26('0x7')](config['encrypt']['algorithm'],_0xcf26('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x11faf7){return AES_SUPPORTED_RX['test'](_0x11faf7);}function getSupportedCiphers(){return crypto[_0xcf26('0x9')]()[_0xcf26('0xa')](isASupportedCipher);}function isAlgorithmSupported(_0x35c591){return getSupportedCiphers()[_0xcf26('0xb')](_0x35c591)>-0x1;}function combineOptions(_0x1d6b7c){var _0x39ba84={};for(var _0xc48586 in fileOptions){if(fileOptions[_0xcf26('0xc')](_0xc48586)){_0x39ba84[_0xc48586]=fileOptions[_0xc48586];}}if(_0x1d6b7c){for(var _0x4e595a in _0x1d6b7c){if(_0x1d6b7c[_0xcf26('0xc')](_0x4e595a)){_0x39ba84[_0x4e595a]=_0x1d6b7c[_0x4e595a];}}}return _0x39ba84;}exports[_0xcf26('0xd')]=function(_0x24b1a3,_0x424828,_0x38c234,_0x2def77){return new BPromise(function(_0x843251,_0x14a4ca){_0x2def77=combineOptions(_0x2def77);var _0x4496cc=new Buffer(_0x38c234);var _0x20bef9=fs[_0xcf26('0xe')](_0x24b1a3);var _0x38bcac=fs[_0xcf26('0xf')](_0x424828);var _0x35f66b=crypto[_0xcf26('0x10')](_0x2def77[_0xcf26('0x6')],_0x4496cc);_0x20bef9['on'](_0xcf26('0x11'),function(_0x8c08e6){var _0x43bf21=new Buffer(_0x35f66b['update'](_0x8c08e6),_0xcf26('0x12'));_0x38bcac['write'](_0x43bf21);});_0x20bef9['on'](_0xcf26('0x13'),function(){try{var _0x11dcde=new Buffer(_0x35f66b['final'](_0xcf26('0x12')),_0xcf26('0x12'));_0x38bcac[_0xcf26('0x14')](_0x11dcde);_0x38bcac[_0xcf26('0x13')]();_0x38bcac['on'](_0xcf26('0x15'),function(){return _0x843251(_0x424828);});}catch(_0xe87b3c){fs[_0xcf26('0x16')](_0x424828);return _0x14a4ca(_0xe87b3c);}});});};exports['decryptFile']=function(_0x1b8630,_0x1e5f26,_0x4d36e7,_0xa25994){return new BPromise(function(_0x3bd93c,_0x43fda){_0xa25994=combineOptions(_0xa25994);var _0x834809=new Buffer(_0x4d36e7);var _0x367162=fs[_0xcf26('0xe')](_0x1b8630);var _0xcf2e60=fs[_0xcf26('0xf')](_0x1e5f26);var _0x41dc8c=crypto['createDecipher'](_0xa25994[_0xcf26('0x6')],_0x834809);_0x367162['on'](_0xcf26('0x11'),function(_0x1b2905){var _0x37a8aa=new Buffer(_0x41dc8c[_0xcf26('0x17')](_0x1b2905),_0xcf26('0x12'));_0xcf2e60[_0xcf26('0x14')](_0x37a8aa);});_0x367162['on'](_0xcf26('0x13'),function(){try{var _0x3786dd=new Buffer(_0x41dc8c[_0xcf26('0x18')](_0xcf26('0x12')),_0xcf26('0x12'));_0xcf2e60[_0xcf26('0x14')](_0x3786dd);_0xcf2e60[_0xcf26('0x13')]();_0xcf2e60['on'](_0xcf26('0x15'),function(){return _0x3bd93c(_0x1e5f26);});}catch(_0x27c012){fs[_0xcf26('0x16')](_0x1e5f26);return _0x43fda(_0x27c012);}});});};exports[_0xcf26('0x19')]=function(_0x210d79,_0x2d42ef,_0x194b7e){var _0x58bc31=_0x194b7e||stringOptions[_0xcf26('0x6')];var _0x397350=_0x2d42ef||stringOptions['secret'];var _0x15f73d=crypto[_0xcf26('0x10')](_0x58bc31,_0x397350);var _0x23407a=_0x15f73d['update'](_0x210d79,_0xcf26('0x1a'),'base64');_0x23407a+=_0x15f73d[_0xcf26('0x18')]('base64');return _0x23407a;};exports[_0xcf26('0x1b')]=function(_0x50c65f,_0xfc750e,_0x356cca){var _0x2cdb51=_0x356cca||stringOptions[_0xcf26('0x6')];var _0x4a1d25=_0xfc750e||stringOptions[_0xcf26('0x1c')];var _0x6239c6=crypto['createDecipher'](_0x2cdb51,_0x4a1d25);var _0x15a6ec=_0x6239c6[_0xcf26('0x17')](_0x50c65f,_0xcf26('0x1d'),'utf8');_0x15a6ec+=_0x6239c6[_0xcf26('0x18')](_0xcf26('0x1a'));return _0x15a6ec;}; \ No newline at end of file +var _0xc882=['createDecipher','data','unlink','encryptString','secret','createCipher','base64','decryptString','lodash','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','binary','write','end','final','close','decryptFile'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc882,0x1c8));var _0x2c88=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc882[_0x13d07a];return _0x5ee0ee;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x2c88('0x0'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x2c88('0x1'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2c88('0x2')][_0x2c88('0x3')],'algorithm':_0x2c88('0x4')};const fileOptions={'algorithm':_0x2c88('0x5')};if(config[_0x2c88('0x6')]&&config[_0x2c88('0x6')][_0x2c88('0x7')]){var isSupported=isAlgorithmSupported(config[_0x2c88('0x6')][_0x2c88('0x7')]);if(isSupported){fileOptions[_0x2c88('0x7')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x2c88('0x8')](config[_0x2c88('0x6')][_0x2c88('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x28560b){return AES_SUPPORTED_RX[_0x2c88('0x9')](_0x28560b);}function getSupportedCiphers(){return crypto[_0x2c88('0xa')]()[_0x2c88('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x5c2509){return getSupportedCiphers()[_0x2c88('0xc')](_0x5c2509)>-0x1;}function combineOptions(_0x39e5c2){var _0x384212={};for(var _0x29df7e in fileOptions){if(fileOptions[_0x2c88('0xd')](_0x29df7e)){_0x384212[_0x29df7e]=fileOptions[_0x29df7e];}}if(_0x39e5c2){for(var _0x3d15c5 in _0x39e5c2){if(_0x39e5c2[_0x2c88('0xd')](_0x3d15c5)){_0x384212[_0x3d15c5]=_0x39e5c2[_0x3d15c5];}}}return _0x384212;}exports[_0x2c88('0xe')]=function(_0x361392,_0x25c5ea,_0x4a69c3,_0x1d140a){return new BPromise(function(_0x12ec1e,_0x149f80){_0x1d140a=combineOptions(_0x1d140a);var _0x4095d6=new Buffer(_0x4a69c3);var _0x3ab213=fs[_0x2c88('0xf')](_0x361392);var _0x2210d3=fs[_0x2c88('0x10')](_0x25c5ea);var _0x51d235=crypto['createCipher'](_0x1d140a['algorithm'],_0x4095d6);_0x3ab213['on']('data',function(_0x8fd543){var _0x26447d=new Buffer(_0x51d235[_0x2c88('0x11')](_0x8fd543),_0x2c88('0x12'));_0x2210d3[_0x2c88('0x13')](_0x26447d);});_0x3ab213['on'](_0x2c88('0x14'),function(){try{var _0x25fa2e=new Buffer(_0x51d235[_0x2c88('0x15')]('binary'),_0x2c88('0x12'));_0x2210d3[_0x2c88('0x13')](_0x25fa2e);_0x2210d3['end']();_0x2210d3['on'](_0x2c88('0x16'),function(){return _0x12ec1e(_0x25c5ea);});}catch(_0x46a01b){fs['unlink'](_0x25c5ea);return _0x149f80(_0x46a01b);}});});};exports[_0x2c88('0x17')]=function(_0x4caa69,_0x3af919,_0x2b32c1,_0x35e51b){return new BPromise(function(_0x23f8d1,_0x42fc95){_0x35e51b=combineOptions(_0x35e51b);var _0x42eee9=new Buffer(_0x2b32c1);var _0x5eb1da=fs[_0x2c88('0xf')](_0x4caa69);var _0xe4bb65=fs[_0x2c88('0x10')](_0x3af919);var _0x2d0a39=crypto[_0x2c88('0x18')](_0x35e51b[_0x2c88('0x7')],_0x42eee9);_0x5eb1da['on'](_0x2c88('0x19'),function(_0x58f09d){var _0x1b4fbd=new Buffer(_0x2d0a39[_0x2c88('0x11')](_0x58f09d),'binary');_0xe4bb65[_0x2c88('0x13')](_0x1b4fbd);});_0x5eb1da['on']('end',function(){try{var _0x26c53f=new Buffer(_0x2d0a39['final'](_0x2c88('0x12')),_0x2c88('0x12'));_0xe4bb65[_0x2c88('0x13')](_0x26c53f);_0xe4bb65['end']();_0xe4bb65['on'](_0x2c88('0x16'),function(){return _0x23f8d1(_0x3af919);});}catch(_0x66726d){fs[_0x2c88('0x1a')](_0x3af919);return _0x42fc95(_0x66726d);}});});};exports[_0x2c88('0x1b')]=function(_0x1db48b,_0xc39c15,_0x481bd5){var _0xb3d301=_0x481bd5||stringOptions[_0x2c88('0x7')];var _0x416920=_0xc39c15||stringOptions[_0x2c88('0x1c')];var _0x1a4722=crypto[_0x2c88('0x1d')](_0xb3d301,_0x416920);var _0x546182=_0x1a4722[_0x2c88('0x11')](_0x1db48b,'utf8',_0x2c88('0x1e'));_0x546182+=_0x1a4722[_0x2c88('0x15')](_0x2c88('0x1e'));return _0x546182;};exports[_0x2c88('0x1f')]=function(_0x46204e,_0xe0c5b0,_0x4897d2){var _0x46b818=_0x4897d2||stringOptions[_0x2c88('0x7')];var _0x207f7a=_0xe0c5b0||stringOptions[_0x2c88('0x1c')];var _0x343353=crypto[_0x2c88('0x18')](_0x46b818,_0x207f7a);var _0x5746a3=_0x343353[_0x2c88('0x11')](_0x46204e,_0x2c88('0x1e'),'utf8');_0x5746a3+=_0x343353[_0x2c88('0x15')]('utf8');return _0x5746a3;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1ee3aea..37bb8b7 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 _0xd139=['dirname','basename','.csv','existsSync','join','%s%d.%s','%s.%s','csv','writeFileSync','zip','Completed','inspect','Failed','finally','util','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','update','info','format','CSV','Setting','find','then','splitSizeCsv','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','split','push','query'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xd139,0x14e));var _0x9d13=function(_0x4f48bd,_0x4b605e){_0x4f48bd=_0x4f48bd-0x0;var _0x3478ab=_0xd139[_0x4f48bd];return _0x3478ab;};'use strict';var util=require(_0x9d13('0x0'));var path=require(_0x9d13('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x9d13('0x2'));var zipdir=require(_0x9d13('0x3'));var rimraf=require(_0x9d13('0x4'));var db=require(_0x9d13('0x5'))['db'];var dbH=require(_0x9d13('0x5'))[_0x9d13('0x6')];var logger=require(_0x9d13('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9d13('0x8')][0x2]);var QUERY=process[_0x9d13('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x198d7d,_0x4b3db0){var _0x434ef6={'status':_0x198d7d};var _0x524947={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b3db0){_0x434ef6['savename']=_0x4b3db0;}return db['AnalyticExtractedReport'][_0x9d13('0x9')](_0x434ef6,_0x524947);}function main(){var _0xba5caa=0x1388;var _0x41eef2;logger[_0x9d13('0xa')](util[_0x9d13('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9d13('0xc')));return db[_0x9d13('0xd')][_0x9d13('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x9d13('0xf')](function(_0x3933d1){if(_0x3933d1){_0x41eef2=_0x3933d1;_0xba5caa=_0x41eef2[_0x9d13('0x10')]||0x1388;}})[_0x9d13('0xf')](function(){return dbH[_0x9d13('0x11')]['query'](util['format'](_0x9d13('0x12'),QUERY),{'type':dbH[_0x9d13('0x11')][_0x9d13('0x13')][_0x9d13('0x14')]});})[_0x9d13('0xf')](function(_0x1a2b65){if(!_0x1a2b65[0x0][_0x9d13('0x15')]){return analyticExtractedReport('Empty');}var _0x3acfc1=[];var _0x1b473e=0x0;var _0x16a77b=!![];if(_0x1a2b65&&_0x1a2b65[_0x9d13('0x16')]){var _0xbff9ab=_0x1a2b65[0x0][_0x9d13('0x15')]%(_0x1b473e+_0xba5caa);if(_0x41eef2[_0x9d13('0x17')]){for(;_0x16a77b;_0x1b473e+=_0xba5caa,_0xbff9ab=_0x1a2b65[0x0][_0x9d13('0x15')]%(_0x1b473e+_0xba5caa)){if(_0xbff9ab==0x0||_0xbff9ab==_0x1a2b65[0x0][_0x9d13('0x15')]){_0x16a77b=![];}_0x3acfc1[_0x9d13('0x18')](dbH[_0x9d13('0x11')][_0x9d13('0x19')](util[_0x9d13('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xba5caa,_0x1b473e),{'type':dbH[_0x9d13('0x11')][_0x9d13('0x13')][_0x9d13('0x14')]}));}}else{_0x3acfc1[_0x9d13('0x18')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x9d13('0x13')][_0x9d13('0x14')]}));}}var _0x204f8a=path[_0x9d13('0x1a')](PATH);var _0x3971e0=path[_0x9d13('0x1b')](PATH,_0x9d13('0x1c'));var _0x40beca=_0x41eef2['split']&&_0x3acfc1[_0x9d13('0x16')]>0x1;var _0xd5a981=[];if(!fs[_0x9d13('0x1d')](path[_0x9d13('0x1e')](_0x204f8a,_0x3971e0))&&_0x40beca){fs['mkdirSync'](path[_0x9d13('0x1e')](_0x204f8a,_0x3971e0));}return BPromise['each'](_0x3acfc1,function(_0x40c673){_0xd5a981[_0x9d13('0x18')](_0x40c673);})[_0x9d13('0xf')](function(){for(var _0x3a3c97=0x0;_0x3a3c97<_0xd5a981[_0x9d13('0x16')];_0x3a3c97+=0x1){var _0x45a299;var _0x1c36e5=_0xd5a981[_0x3a3c97];if(_0x40beca){_0x45a299=path[_0x9d13('0x1e')](_0x204f8a,_0x3971e0,util['format'](_0x9d13('0x1f'),_0x3971e0,_0x3a3c97,'csv'));}else{_0x45a299=path[_0x9d13('0x1e')](_0x204f8a,util[_0x9d13('0xb')](_0x9d13('0x20'),_0x3971e0,_0x9d13('0x21')));}fs[_0x9d13('0x22')](_0x45a299,csv(_0x1c36e5));}})[_0x9d13('0xf')](function(){if(_0x40beca){zipdir(path[_0x9d13('0x1e')](_0x204f8a,_0x3971e0),{'saveTo':path[_0x9d13('0x1e')](_0x204f8a,util[_0x9d13('0xb')](_0x9d13('0x20'),_0x3971e0,_0x9d13('0x23')))},function(_0x21e35a,_0x523e5e){});rimraf(path[_0x9d13('0x1e')](_0x204f8a,_0x3971e0),function(){});}})['then'](function(){logger[_0x9d13('0xa')](util[_0x9d13('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9d13('0xc')));return analyticExtractedReport(_0x9d13('0x24'),_0x40beca?util['format']('%s.%s',_0x3971e0,_0x40beca?'zip':_0x9d13('0x21')):null);});})['catch'](function(_0xaefb03){logger[_0x9d13('0xa')](util[_0x9d13('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9d13('0xc')),util[_0x9d13('0x25')](_0xaefb03,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9d13('0x26'));})[_0x9d13('0x27')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdb94=['rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','length','existsSync','join','each','then','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','path','lodash','to-csv','bluebird'];(function(_0x397127,_0x31429d){var _0x1d5516=function(_0x5c557f){while(--_0x5c557f){_0x397127['push'](_0x397127['shift']());}};_0x1d5516(++_0x31429d);}(_0xdb94,0xab));var _0x4db9=function(_0x31f53b,_0x21c467){_0x31f53b=_0x31f53b-0x0;var _0x4d7b20=_0xdb94[_0x31f53b];return _0x4d7b20;};'use strict';var util=require(_0x4db9('0x0'));var path=require(_0x4db9('0x1'));var _=require(_0x4db9('0x2'));var csv=require(_0x4db9('0x3'));var fs=require('fs');var BPromise=require(_0x4db9('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x4db9('0x5'));var db=require(_0x4db9('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x4db9('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4db9('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x196ede,_0x50c27a){var _0x14deb9={'status':_0x196ede};var _0x26248b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50c27a){_0x14deb9[_0x4db9('0x9')]=_0x50c27a;}return db[_0x4db9('0xa')][_0x4db9('0xb')](_0x14deb9,_0x26248b);}function main(){var _0x242116=0x1388;var _0x45c0e4;logger[_0x4db9('0xc')](util[_0x4db9('0xd')](_0x4db9('0xe'),EXTRACTED_REPORT_ID,_0x4db9('0xf')));return db['Setting'][_0x4db9('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4db9('0x11'),'splitSizeCsv']})['then'](function(_0x31222b){if(_0x31222b){_0x45c0e4=_0x31222b;_0x242116=_0x45c0e4['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x4db9('0x12')][_0x4db9('0x13')](util['format'](_0x4db9('0x14'),QUERY),{'type':dbH[_0x4db9('0x12')][_0x4db9('0x15')][_0x4db9('0x16')]});})['then'](function(_0x5e04ab){if(!_0x5e04ab[0x0][_0x4db9('0x17')]){return analyticExtractedReport(_0x4db9('0x18'));}var _0x4a037f=[];var _0xadc104=0x0;var _0x4976=!![];if(_0x5e04ab&&_0x5e04ab['length']){var _0x5a85c4=_0x5e04ab[0x0][_0x4db9('0x17')]%(_0xadc104+_0x242116);if(_0x45c0e4[_0x4db9('0x11')]){for(;_0x4976;_0xadc104+=_0x242116,_0x5a85c4=_0x5e04ab[0x0][_0x4db9('0x17')]%(_0xadc104+_0x242116)){if(_0x5a85c4==0x0||_0x5a85c4==_0x5e04ab[0x0][_0x4db9('0x17')]){_0x4976=![];}_0x4a037f[_0x4db9('0x19')](dbH['sequelize'][_0x4db9('0x13')](util[_0x4db9('0xd')](_0x4db9('0x1a'),QUERY,_0x242116,_0xadc104),{'type':dbH['sequelize'][_0x4db9('0x15')][_0x4db9('0x16')]}));}}else{_0x4a037f[_0x4db9('0x19')](dbH['sequelize'][_0x4db9('0x13')](QUERY,{'type':dbH[_0x4db9('0x12')][_0x4db9('0x15')][_0x4db9('0x16')]}));}}var _0xf4f3fe=path[_0x4db9('0x1b')](PATH);var _0x3585d5=path['basename'](PATH,_0x4db9('0x1c'));var _0x3252d0=_0x45c0e4[_0x4db9('0x11')]&&_0x4a037f[_0x4db9('0x1d')]>0x1;var _0x4aaa84=[];if(!fs[_0x4db9('0x1e')](path[_0x4db9('0x1f')](_0xf4f3fe,_0x3585d5))&&_0x3252d0){fs['mkdirSync'](path[_0x4db9('0x1f')](_0xf4f3fe,_0x3585d5));}return BPromise[_0x4db9('0x20')](_0x4a037f,function(_0x2987c6){_0x4aaa84['push'](_0x2987c6);})[_0x4db9('0x21')](function(){for(var _0xd250c5=0x0;_0xd250c5<_0x4aaa84[_0x4db9('0x1d')];_0xd250c5+=0x1){var _0x2d330e;var _0x3f9f7e=_0x4aaa84[_0xd250c5];if(_0x3252d0){_0x2d330e=path[_0x4db9('0x1f')](_0xf4f3fe,_0x3585d5,util[_0x4db9('0xd')](_0x4db9('0x22'),_0x3585d5,_0xd250c5,_0x4db9('0x23')));}else{_0x2d330e=path[_0x4db9('0x1f')](_0xf4f3fe,util[_0x4db9('0xd')](_0x4db9('0x24'),_0x3585d5,_0x4db9('0x23')));}fs[_0x4db9('0x25')](_0x2d330e,csv(_0x3f9f7e));}})['then'](function(){if(_0x3252d0){zipdir(path['join'](_0xf4f3fe,_0x3585d5),{'saveTo':path[_0x4db9('0x1f')](_0xf4f3fe,util[_0x4db9('0xd')](_0x4db9('0x24'),_0x3585d5,_0x4db9('0x26')))},function(_0x2af884,_0x459131){});rimraf(path['join'](_0xf4f3fe,_0x3585d5),function(){});}})[_0x4db9('0x21')](function(){logger['info'](util[_0x4db9('0xd')](_0x4db9('0x27'),EXTRACTED_REPORT_ID,_0x4db9('0xf')));return analyticExtractedReport(_0x4db9('0x28'),_0x3252d0?util[_0x4db9('0xd')]('%s.%s',_0x3585d5,_0x3252d0?'zip':_0x4db9('0x23')):null);});})['catch'](function(_0x337d74){logger[_0x4db9('0xc')](util['format'](_0x4db9('0x29'),EXTRACTED_REPORT_ID,_0x4db9('0xf')),util[_0x4db9('0x2a')](_0x337d74,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4db9('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 3998849..3704b68 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 _0x2331=['pipe','finish','error','end','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','map','tableHeader','pick','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','landscape','toString','\x20/\x20','Arial','black','right','Empty','dirname','basename','join','%s.%s','pdf','Setting','find','splitSizePdf','num','split','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','mkdirSync','all','flatten','then','createPdfKitDocument','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','footer'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x2331,0x107));var _0x1233=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x2331[_0x1ee0a1];return _0x1d2d5b;};'use strict';var _=require(_0x1233('0x0'));var fs=require('fs');var util=require(_0x1233('0x1'));var path=require(_0x1233('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x1233('0x3'));var PdfPrinter=require(_0x1233('0x4'));var zipdir=require(_0x1233('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x1233('0x6'))[_0x1233('0x7')];var window=new JSDOM('')['window'];var db=require(_0x1233('0x8'))['db'];var dbH=require(_0x1233('0x8'))[_0x1233('0x9')];var logger=require('../../config/logger')(_0x1233('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x1233('0xb')][0x2]);var QUERY=process[_0x1233('0xb')][0x3];var PATH=process[_0x1233('0xb')][0x4];var NAME=process[_0x1233('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4beb57,_0x16a2b4){var _0x470cf4={'status':_0x4beb57};var _0x52067b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16a2b4){_0x470cf4['savename']=_0x16a2b4;}return db[_0x1233('0xc')][_0x1233('0xd')](_0x470cf4,_0x52067b);}function getHeaders(_0x192573){return _[_0x1233('0xe')](_0x192573,function(_0x36c2ff){return{'text':_0x36c2ff,'style':_0x1233('0xf')};});}function getRows(_0x5aca2a,_0x31ea70){return _[_0x1233('0xe')](_0x31ea70,function(_0xc1fb84){return _(_0xc1fb84)[_0x1233('0x10')](_0x5aca2a)[_0x1233('0xe')](function(_0x203775){return _0x203775?_['toString'](_0x203775):'';})[_0x1233('0x11')]();});}function createTable(_0x1ae4e4,_0x3d2997){var _0x33303d={'widths':_[_0x1233('0x12')](Array(_0x1ae4e4[_0x1233('0x13')]),0x91),'heights':function(_0x4f2daf){return _0x4f2daf===0x0?_0x1233('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x404793=getHeaders(_0x1ae4e4);_0x33303d[_0x1233('0x15')][_0x1233('0x16')](_0x404793);var _0x48c6a6=getRows(_0x1ae4e4,_0x3d2997);_0x33303d[_0x1233('0x15')]=_0x33303d[_0x1233('0x15')][_0x1233('0x17')](_0x48c6a6);return _0x33303d;}function createTables(_0x2176c8){var _0x4a4996=[];var _0x2a75d5=_[_0x1233('0x18')](Object[_0x1233('0x19')](_0x2176c8[0x0]),0x5);_0x2a75d5[_0x1233('0x1a')](function(_0x3fa189){_0x4a4996[_0x1233('0x16')](createTable(_0x3fa189,_0x2176c8));});return _0x4a4996;}function getPDFDocDefinition(_0x1ba875){var _0x1a9d74=util[_0x1233('0x1b')](_0x1233('0x1c'),NAME,EXTRACTED_REPORT[_0x1233('0x1d')],moment(EXTRACTED_REPORT['startDate'])[_0x1233('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x1233('0x1e')])[_0x1233('0x1b')](FORMAT));var _0x290013=[];for(var _0x330947=0x0;_0x330947<_0x1ba875[_0x1233('0x13')];_0x330947++){var _0x286732=[];if(_0x330947===0x0){_0x286732[_0x1233('0x16')]({'text':_0x1a9d74,'style':_0x1233('0x1f')});}var _0x46c0a5={'table':_0x1ba875[_0x330947]};if(_0x330947>0x0){_0x46c0a5[_0x1233('0x20')]=_0x1233('0x21');_0x46c0a5['margin']=[0x0,0x46,0x0,0x0];}_0x286732[_0x1233('0x16')](_0x46c0a5);_0x290013[_0x1233('0x16')](_0x286732);}return{'pageSize':'A4','pageOrientation':_0x1233('0x22'),'content':_0x290013,'footer':function(_0x1aa0e6,_0x1f0f7a){return{'text':_0x1aa0e6[_0x1233('0x23')]()+_0x1233('0x24')+_0x1f0f7a,'style':'footer'};},'defaultStyle':{'font':_0x1233('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1233('0x26')},'footer':{'alignment':_0x1233('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x173ae1){var _0x468882=0x1388;var _0x5033df;if(!_0x173ae1[0x0]['num']){return analyticExtractedReport(_0x1233('0x28'));}var _0x236e83=[];var _0x291b26=0x0;var _0x1ad7bc=!![];var _0x39313d=path[_0x1233('0x29')](PATH);var _0xeaf39b=path[_0x1233('0x2a')](PATH,'.pdf');var _0x4fde92=path[_0x1233('0x2b')](_0x39313d,util['format'](_0x1233('0x2c'),_0xeaf39b,_0x1233('0x2d')));var _0x34085b=![];return db[_0x1233('0x2e')][_0x1233('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})['then'](function(_0x2f6d63){if(_0x2f6d63){_0x5033df=_0x2f6d63;_0x468882=_0x5033df[_0x1233('0x30')]||0x3e8;}})['then'](function(){if(_0x173ae1&&_0x173ae1['length']){var _0x5a9363=_0x173ae1[0x0][_0x1233('0x31')]%(_0x291b26+_0x468882);if(_0x5033df[_0x1233('0x32')]){for(;_0x1ad7bc;_0x291b26+=_0x468882,_0x5a9363=_0x173ae1[0x0]['num']%(_0x291b26+_0x468882)){if(_0x5a9363==0x0||_0x5a9363==_0x173ae1[0x0][_0x1233('0x31')]){_0x1ad7bc=![];}_0x236e83[_0x1233('0x16')](dbH[_0x1233('0x33')][_0x1233('0x34')](util[_0x1233('0x1b')](_0x1233('0x35'),QUERY,_0x468882,_0x291b26),{'type':dbH[_0x1233('0x33')]['QueryTypes'][_0x1233('0x36')]}));}}else{_0x236e83[_0x1233('0x16')](dbH[_0x1233('0x33')][_0x1233('0x34')](QUERY,{'type':dbH[_0x1233('0x33')][_0x1233('0x37')][_0x1233('0x36')]}));}}_0x34085b=_0x5033df['split']&&_0x236e83['length']>0x1;if(!fs['existsSync'](path[_0x1233('0x2b')](_0x39313d,_0xeaf39b))&&_0x34085b){fs[_0x1233('0x38')](path['join'](_0x39313d,_0xeaf39b));}return Promise[_0x1233('0x39')](_0x236e83);})['then'](function(_0x5e3812){return createTables(_[_0x1233('0x3a')](_0x5e3812));})[_0x1233('0x3b')](function(_0x598a00){var _0x402bc7=getPDFDocDefinition(_0x598a00);var _0x2ac599=getPDFPrinter();var _0x2a713d=_0x2ac599[_0x1233('0x3c')](_0x402bc7);if(_0x34085b)_0x4fde92=path['join'](_0x39313d,_0xeaf39b,util[_0x1233('0x1b')]('%s%d.%s',_0xeaf39b,index,_0x1233('0x2d')));return writePDFDocument(_0x2a713d,_0x4fde92);})['then'](function(){if(!_0x34085b)return;zipdir(path[_0x1233('0x2b')](_0x39313d,_0xeaf39b),{'saveTo':path['join'](_0x39313d,util['format'](_0x1233('0x2c'),_0xeaf39b,_0x1233('0x3d')))},function(_0x41c2f0){if(_0x41c2f0)throw _0x41c2f0;return;});})['then'](function(){if(!_0x34085b)return;rimraf(path[_0x1233('0x2b')](_0x39313d,_0xeaf39b),function(){});})[_0x1233('0x3b')](function(){logger[_0x1233('0x3e')](util[_0x1233('0x1b')](_0x1233('0x3f'),EXTRACTED_REPORT_ID,_0x1233('0x40')));return analyticExtractedReport(_0x1233('0x41'),_0x34085b?util[_0x1233('0x1b')]('%s.%s',_0xeaf39b,_0x34085b?_0x1233('0x3d'):_0x1233('0x2d')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1233('0x3e')](util[_0x1233('0x1b')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1233('0x42')));return db[_0x1233('0xc')][_0x1233('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1233('0x3b')](function(_0x128612){EXTRACTED_REPORT=_0x128612;return dbH[_0x1233('0x33')][_0x1233('0x34')](util['format'](_0x1233('0x44'),QUERY),{'type':dbH[_0x1233('0x33')][_0x1233('0x37')][_0x1233('0x36')]});})['then'](extractReport)['catch'](function(_0x1523b7){logger[_0x1233('0x3e')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1233('0x42')),util[_0x1233('0x45')](_0x1523b7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1233('0x46'));})['finally'](function(){process[_0x1233('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1c6d44=new PdfPrinter({'Arial':{'normal':__dirname+_0x1233('0x48'),'bold':__dirname+_0x1233('0x49'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x1233('0x4a')}});return _0x1c6d44;}function getPDFDocDefinitionFromHTML(_0x271940,_0x51b809){var _0x507d63=util[_0x1233('0x1b')](_0x1233('0x4b'),_0x51b809[_0x1233('0x4c')],_0x51b809[_0x1233('0x4d')]);var _0x2b8792=moment()['format'](_0x1233('0x4e'))[_0x1233('0x23')]();var _0x5537b6=htmlToPdfmake(_0x271940,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5537b6],'defaultStyle':{'font':_0x1233('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1233('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1233('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1233('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x1233('0x1f')}];},'footer':function(_0x4db130,_0x349d5c){return[{'text':util[_0x1233('0x1b')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x507d63,_0x4db130,_0x349d5c,_0x2b8792),'style':_0x1233('0x50')}];}};}function writePDFDocument(_0x30d473,_0x10a42e){return new Promise(function(_0x4b23bd,_0x44446f){var _0x5ad23a=_0x30d473[_0x1233('0x51')](fs['createWriteStream'](_0x10a42e));_0x5ad23a['on'](_0x1233('0x52'),function(){_0x4b23bd('finish');});_0x5ad23a['on'](_0x1233('0x53'),function(_0x5dac88){_0x44446f(_0x5dac88);});_0x30d473[_0x1233('0x54')]();});}exports[_0x1233('0x55')]=function(_0xfb51a9,_0x2f2fb0){var _0x3389ab=getPDFPrinter();var _0x4e46e3=getPDFDocDefinitionFromHTML(_0xfb51a9,_0x2f2fb0);var _0x557c39=_0x3389ab['createPdfKitDocument'](_0x4e46e3);return writePDFDocument(_0x557c39,_0x2f2fb0[_0x1233('0x2')])['catch'](function(_0x33dc62){throw _0x33dc62;});}; \ No newline at end of file +var _0x6dbd=['length','before','margin','push','landscape','\x20/\x20','Arial','right','Empty','dirname','basename','.pdf','join','find','splitSizePdf','then','num','split','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','all','flatten','createPdfKitDocument','%s.%s','info','CSV','zip','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','end','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','body','concat','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x6dbd,0x186));var _0xd6db=function(_0x271b32,_0x2df4b9){_0x271b32=_0x271b32-0x0;var _0x2b4398=_0x6dbd[_0x271b32];return _0x2b4398;};'use strict';var _=require(_0xd6db('0x0'));var fs=require('fs');var util=require(_0xd6db('0x1'));var path=require(_0xd6db('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0xd6db('0x3'));var PdfPrinter=require(_0xd6db('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xd6db('0x5'));var JSDOM=require(_0xd6db('0x6'))['JSDOM'];var window=new JSDOM('')[_0xd6db('0x7')];var db=require(_0xd6db('0x8'))['db'];var dbH=require('../../mysqldb')[_0xd6db('0x9')];var logger=require(_0xd6db('0xa'))(_0xd6db('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xd6db('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd6db('0xc')][0x4];var NAME=process[_0xd6db('0xc')][0x5];var FORMAT=_0xd6db('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x289acf,_0x29f22f){var _0x341891={'status':_0x289acf};var _0x57cc3c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x29f22f){_0x341891['savename']=_0x29f22f;}return db[_0xd6db('0xe')][_0xd6db('0xf')](_0x341891,_0x57cc3c);}function getHeaders(_0x169287){return _[_0xd6db('0x10')](_0x169287,function(_0x29d5dd){return{'text':_0x29d5dd,'style':_0xd6db('0x11')};});}function getRows(_0x182647,_0x14ac1c){return _[_0xd6db('0x10')](_0x14ac1c,function(_0x545425){return _(_0x545425)[_0xd6db('0x12')](_0x182647)[_0xd6db('0x10')](function(_0x2721c0){return _0x2721c0?_[_0xd6db('0x13')](_0x2721c0):'';})[_0xd6db('0x14')]();});}function createTable(_0x12cb7f,_0x39fe8d){var _0x410aab={'widths':_[_0xd6db('0x15')](Array(_0x12cb7f['length']),0x91),'heights':function(_0x768c4){return _0x768c4===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x599996=getHeaders(_0x12cb7f);_0x410aab[_0xd6db('0x16')]['push'](_0x599996);var _0x22adb3=getRows(_0x12cb7f,_0x39fe8d);_0x410aab[_0xd6db('0x16')]=_0x410aab['body'][_0xd6db('0x17')](_0x22adb3);return _0x410aab;}function createTables(_0x25453f){var _0x1ead96=[];var _0x1579d5=_[_0xd6db('0x18')](Object['keys'](_0x25453f[0x0]),0x5);_0x1579d5['forEach'](function(_0xa3fb15){_0x1ead96['push'](createTable(_0xa3fb15,_0x25453f));});return _0x1ead96;}function getPDFDocDefinition(_0x40bce1){var _0x39eaab=util[_0xd6db('0x19')](_0xd6db('0x1a'),NAME,EXTRACTED_REPORT[_0xd6db('0x1b')],moment(EXTRACTED_REPORT[_0xd6db('0x1c')])[_0xd6db('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xd6db('0x1d')])[_0xd6db('0x19')](FORMAT));var _0x33e31e=[];for(var _0x18cc49=0x0;_0x18cc49<_0x40bce1[_0xd6db('0x1e')];_0x18cc49++){var _0x588132=[];if(_0x18cc49===0x0){_0x588132['push']({'text':_0x39eaab,'style':'header'});}var _0x1c82a0={'table':_0x40bce1[_0x18cc49]};if(_0x18cc49>0x0){_0x1c82a0['pageBreak']=_0xd6db('0x1f');_0x1c82a0[_0xd6db('0x20')]=[0x0,0x46,0x0,0x0];}_0x588132[_0xd6db('0x21')](_0x1c82a0);_0x33e31e[_0xd6db('0x21')](_0x588132);}return{'pageSize':'A4','pageOrientation':_0xd6db('0x22'),'content':_0x33e31e,'footer':function(_0x2bed0f,_0x2db377){return{'text':_0x2bed0f['toString']()+_0xd6db('0x23')+_0x2db377,'style':'footer'};},'defaultStyle':{'font':_0xd6db('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xd6db('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x18a88f){var _0x1c6198=0x1388;var _0xfbb1a9;if(!_0x18a88f[0x0]['num']){return analyticExtractedReport(_0xd6db('0x26'));}var _0x4e2ac0=[];var _0x5e5c86=0x0;var _0x1b5844=!![];var _0x3796c8=path[_0xd6db('0x27')](PATH);var _0xf2ba0b=path[_0xd6db('0x28')](PATH,_0xd6db('0x29'));var _0x2f70fe=path[_0xd6db('0x2a')](_0x3796c8,util[_0xd6db('0x19')]('%s.%s',_0xf2ba0b,'pdf'));var _0x69530f=![];return db['Setting'][_0xd6db('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd6db('0x2c')]})[_0xd6db('0x2d')](function(_0x54467e){if(_0x54467e){_0xfbb1a9=_0x54467e;_0x1c6198=_0xfbb1a9['splitSizePdf']||0x3e8;}})[_0xd6db('0x2d')](function(){if(_0x18a88f&&_0x18a88f['length']){var _0x52d2f3=_0x18a88f[0x0][_0xd6db('0x2e')]%(_0x5e5c86+_0x1c6198);if(_0xfbb1a9[_0xd6db('0x2f')]){for(;_0x1b5844;_0x5e5c86+=_0x1c6198,_0x52d2f3=_0x18a88f[0x0][_0xd6db('0x2e')]%(_0x5e5c86+_0x1c6198)){if(_0x52d2f3==0x0||_0x52d2f3==_0x18a88f[0x0][_0xd6db('0x2e')]){_0x1b5844=![];}_0x4e2ac0['push'](dbH[_0xd6db('0x30')][_0xd6db('0x31')](util[_0xd6db('0x19')](_0xd6db('0x32'),QUERY,_0x1c6198,_0x5e5c86),{'type':dbH['sequelize'][_0xd6db('0x33')][_0xd6db('0x34')]}));}}else{_0x4e2ac0['push'](dbH['sequelize'][_0xd6db('0x31')](QUERY,{'type':dbH[_0xd6db('0x30')][_0xd6db('0x33')][_0xd6db('0x34')]}));}}_0x69530f=_0xfbb1a9['split']&&_0x4e2ac0[_0xd6db('0x1e')]>0x1;if(!fs[_0xd6db('0x35')](path['join'](_0x3796c8,_0xf2ba0b))&&_0x69530f){fs['mkdirSync'](path[_0xd6db('0x2a')](_0x3796c8,_0xf2ba0b));}return Promise[_0xd6db('0x36')](_0x4e2ac0);})[_0xd6db('0x2d')](function(_0x1d27b9){return createTables(_[_0xd6db('0x37')](_0x1d27b9));})[_0xd6db('0x2d')](function(_0x23626c){var _0x53de9e=getPDFDocDefinition(_0x23626c);var _0x4c54a8=getPDFPrinter();var _0x1de995=_0x4c54a8[_0xd6db('0x38')](_0x53de9e);if(_0x69530f)_0x2f70fe=path[_0xd6db('0x2a')](_0x3796c8,_0xf2ba0b,util[_0xd6db('0x19')]('%s%d.%s',_0xf2ba0b,index,'pdf'));return writePDFDocument(_0x1de995,_0x2f70fe);})[_0xd6db('0x2d')](function(){if(!_0x69530f)return;zipdir(path[_0xd6db('0x2a')](_0x3796c8,_0xf2ba0b),{'saveTo':path['join'](_0x3796c8,util[_0xd6db('0x19')](_0xd6db('0x39'),_0xf2ba0b,'zip'))},function(_0x3b9114){if(_0x3b9114)throw _0x3b9114;return;});})['then'](function(){if(!_0x69530f)return;rimraf(path['join'](_0x3796c8,_0xf2ba0b),function(){});})[_0xd6db('0x2d')](function(){logger[_0xd6db('0x3a')](util[_0xd6db('0x19')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd6db('0x3b')));return analyticExtractedReport('Completed',_0x69530f?util[_0xd6db('0x19')](_0xd6db('0x39'),_0xf2ba0b,_0x69530f?_0xd6db('0x3c'):_0xd6db('0x3d')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd6db('0x3a')](util[_0xd6db('0x19')](_0xd6db('0x3e'),EXTRACTED_REPORT_ID,_0xd6db('0x3f')));return db[_0xd6db('0xe')][_0xd6db('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd6db('0x2d')](function(_0x316368){EXTRACTED_REPORT=_0x316368;return dbH['sequelize'][_0xd6db('0x31')](util['format'](_0xd6db('0x41'),QUERY),{'type':dbH[_0xd6db('0x30')][_0xd6db('0x33')][_0xd6db('0x34')]});})['then'](extractReport)[_0xd6db('0x42')](function(_0x3731f7){logger[_0xd6db('0x3a')](util[_0xd6db('0x19')](_0xd6db('0x43'),EXTRACTED_REPORT_ID,'PDF'),util[_0xd6db('0x44')](_0x3731f7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd6db('0x45')](function(){process[_0xd6db('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5eff95=new PdfPrinter({'Arial':{'normal':__dirname+_0xd6db('0x47'),'bold':__dirname+_0xd6db('0x48'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xd6db('0x49')}});return _0x5eff95;}function getPDFDocDefinitionFromHTML(_0x1d4cbb,_0x5745ea){var _0x2a8ef8=util[_0xd6db('0x19')](_0xd6db('0x4a'),_0x5745ea['channel'],_0x5745ea['interactionId']);var _0x587acd=moment()[_0xd6db('0x19')](_0xd6db('0x4b'))['toString']();var _0x464184=htmlToPdfmake(_0x1d4cbb,{'window':window,'tableAutoSize':!![]});return{'content':[_0x464184],'defaultStyle':{'font':_0xd6db('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd6db('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd6db('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd6db('0x4c')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xd6db('0x4d')}];},'footer':function(_0x3f2ea1,_0x249ded){return[{'text':util[_0xd6db('0x19')](_0xd6db('0x4e'),_0x2a8ef8,_0x3f2ea1,_0x249ded,_0x587acd),'style':_0xd6db('0x4f')}];}};}function writePDFDocument(_0x369479,_0xb4b886){return new Promise(function(_0x492051,_0x327551){var _0x5b65a0=_0x369479['pipe'](fs[_0xd6db('0x50')](_0xb4b886));_0x5b65a0['on']('finish',function(){_0x492051(_0xd6db('0x51'));});_0x5b65a0['on']('error',function(_0x23ed91){_0x327551(_0x23ed91);});_0x369479[_0xd6db('0x52')]();});}exports[_0xd6db('0x53')]=function(_0x40aa43,_0x589f6e){var _0x395f75=getPDFPrinter();var _0x2a08d3=getPDFDocDefinitionFromHTML(_0x40aa43,_0x589f6e);var _0x9d3ec9=_0x395f75['createPdfKitDocument'](_0x2a08d3);return writePDFDocument(_0x9d3ec9,_0x589f6e[_0xd6db('0x2')])['catch'](function(_0x20f427){throw _0x20f427;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e856bed..f2572d2 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 _0xbbbc=['Failed','exit','util','path','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','split','length','num','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','join','each','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x2af90a,_0x2c5522){var _0x1b47e3=function(_0x149382){while(--_0x149382){_0x2af90a['push'](_0x2af90a['shift']());}};_0x1b47e3(++_0x2c5522);}(_0xbbbc,0xd9));var _0xcbbb=function(_0x3c4154,_0x425d67){_0x3c4154=_0x3c4154-0x0;var _0x2c113b=_0xbbbc[_0x3c4154];return _0x2c113b;};'use strict';var util=require(_0xcbbb('0x0'));var path=require(_0xcbbb('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xcbbb('0x2'));var rimraf=require('rimraf');var db=require(_0xcbbb('0x3'))['db'];var dbH=require(_0xcbbb('0x3'))[_0xcbbb('0x4')];var logger=require('../../config/logger')(_0xcbbb('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0xcbbb('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5cd05d,_0xfd0f43){var _0x3bb6ef={'status':_0x5cd05d};var _0x1bdf2c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xfd0f43){_0x3bb6ef[_0xcbbb('0x7')]=_0xfd0f43;}return db[_0xcbbb('0x8')][_0xcbbb('0x9')](_0x3bb6ef,_0x1bdf2c);}function main(){var _0xcbf8f2=0x1388;var _0x62083a;logger[_0xcbbb('0xa')](util[_0xcbbb('0xb')](_0xcbbb('0xc'),EXTRACTED_REPORT_ID,_0xcbbb('0xd')));return db[_0xcbbb('0xe')][_0xcbbb('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xcbbb('0x10')]})['then'](function(_0x48dcdd){if(_0x48dcdd){_0x62083a=_0x48dcdd;_0xcbf8f2=_0x62083a[_0xcbbb('0x10')]||0x1388;}})[_0xcbbb('0x11')](function(){return dbH[_0xcbbb('0x12')]['query'](util[_0xcbbb('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xcbbb('0x12')]['QueryTypes']['SELECT']});})['then'](function(_0x44ea08){if(!_0x44ea08[0x0]['num']){return analyticExtractedReport('Empty');}var _0x51faaa=[];var _0x51c507=0x0;var _0x592290=!![];if(_0x62083a[_0xcbbb('0x13')]){if(_0x44ea08&&_0x44ea08[_0xcbbb('0x14')]){var _0x3c2507=_0x44ea08[0x0][_0xcbbb('0x15')]%(_0x51c507+_0xcbf8f2);for(;_0x592290;_0x51c507+=_0xcbf8f2,_0x3c2507=_0x44ea08[0x0][_0xcbbb('0x15')]%(_0x51c507+_0xcbf8f2)){if(_0x3c2507==0x0||_0x3c2507==_0x44ea08[0x0][_0xcbbb('0x15')]){_0x592290=![];}_0x51faaa[_0xcbbb('0x16')](dbH[_0xcbbb('0x12')][_0xcbbb('0x17')](util[_0xcbbb('0xb')](_0xcbbb('0x18'),QUERY,_0xcbf8f2,_0x51c507),{'type':dbH[_0xcbbb('0x12')][_0xcbbb('0x19')][_0xcbbb('0x1a')]}));}}}else{_0x51faaa['push'](dbH[_0xcbbb('0x12')]['query'](QUERY,{'type':dbH[_0xcbbb('0x12')]['QueryTypes'][_0xcbbb('0x1a')]}));}var _0x1e8f9f=path[_0xcbbb('0x1b')](PATH);var _0x363d87=path[_0xcbbb('0x1c')](PATH,_0xcbbb('0x1d'));var _0x266f5d=_0x62083a[_0xcbbb('0x13')]&&_0x51faaa[_0xcbbb('0x14')]>0x1;var _0xe6f128=[];if(!fs[_0xcbbb('0x1e')](path[_0xcbbb('0x1f')](_0x1e8f9f,_0x363d87))&&_0x266f5d){fs['mkdirSync'](path[_0xcbbb('0x1f')](_0x1e8f9f,_0x363d87));}return BPromise[_0xcbbb('0x20')](_0x51faaa,function(_0x43afba){_0xe6f128[_0xcbbb('0x16')](_0x43afba);})[_0xcbbb('0x11')](function(){for(var _0x418915=0x0;_0x418915<_0xe6f128[_0xcbbb('0x14')];_0x418915+=0x1){var _0x2a4d2c;var _0xe7f211=_0xe6f128[_0x418915];if(_0x266f5d){_0x2a4d2c=path[_0xcbbb('0x1f')](_0x1e8f9f,_0x363d87,util[_0xcbbb('0xb')]('%s%d.%s',_0x363d87,_0x418915,_0xcbbb('0x21')));}else{_0x2a4d2c=path[_0xcbbb('0x1f')](_0x1e8f9f,util['format']('%s.%s',_0x363d87,_0xcbbb('0x21')));}fs[_0xcbbb('0x22')](_0x2a4d2c,json2xls(_0xe7f211),_0xcbbb('0x23'));}})[_0xcbbb('0x11')](function(){if(_0x266f5d){zipdir(path[_0xcbbb('0x1f')](_0x1e8f9f,_0x363d87),{'saveTo':path[_0xcbbb('0x1f')](_0x1e8f9f,util[_0xcbbb('0xb')](_0xcbbb('0x24'),_0x363d87,_0xcbbb('0x25')))},function(_0xf22b25,_0x48b194){});rimraf(path[_0xcbbb('0x1f')](_0x1e8f9f,_0x363d87),function(){});}})[_0xcbbb('0x11')](function(){logger[_0xcbbb('0xa')](util[_0xcbbb('0xb')](_0xcbbb('0x26'),EXTRACTED_REPORT_ID,_0xcbbb('0xd')));return analyticExtractedReport('Completed',_0x266f5d?util[_0xcbbb('0xb')]('%s.%s',_0x363d87,_0x266f5d?_0xcbbb('0x25'):_0xcbbb('0x21')):null);});})[_0xcbbb('0x27')](function(_0x1af7e0){logger['info'](util[_0xcbbb('0xb')](_0xcbbb('0x28'),EXTRACTED_REPORT_ID,_0xcbbb('0xd')),util['inspect'](_0x1af7e0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcbbb('0x29'));})['finally'](function(){process[_0xcbbb('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdb72=['bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','Empty','split','length','num','push','dirname','basename','.xlsx','join','%s%d.%s','xlsx','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls'];(function(_0x338e5d,_0x1f18a9){var _0x1ba1e2=function(_0x1e5403){while(--_0x1e5403){_0x338e5d['push'](_0x338e5d['shift']());}};_0x1ba1e2(++_0x1f18a9);}(_0xdb72,0x14c));var _0x2db7=function(_0x3a6922,_0xc728be){_0x3a6922=_0x3a6922-0x0;var _0x9c1b44=_0xdb72[_0x3a6922];return _0x9c1b44;};'use strict';var util=require(_0x2db7('0x0'));var path=require(_0x2db7('0x1'));var _=require(_0x2db7('0x2'));var fs=require('fs');var json2xls=require(_0x2db7('0x3'));var BPromise=require(_0x2db7('0x4'));var zipdir=require(_0x2db7('0x5'));var rimraf=require(_0x2db7('0x6'));var db=require(_0x2db7('0x7'))['db'];var dbH=require(_0x2db7('0x7'))[_0x2db7('0x8')];var logger=require(_0x2db7('0x9'))(_0x2db7('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2db7('0xb')][0x3];var PATH=process[_0x2db7('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x312388,_0x4da3e6){var _0x2d5ad8={'status':_0x312388};var _0x543821={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4da3e6){_0x2d5ad8[_0x2db7('0xc')]=_0x4da3e6;}return db[_0x2db7('0xd')][_0x2db7('0xe')](_0x2d5ad8,_0x543821);}function main(){var _0x3e1723=0x1388;var _0x5b3d63;logger[_0x2db7('0xf')](util[_0x2db7('0x10')](_0x2db7('0x11'),EXTRACTED_REPORT_ID,_0x2db7('0x12')));return db['Setting'][_0x2db7('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2db7('0x14')]})[_0x2db7('0x15')](function(_0x1f1e13){if(_0x1f1e13){_0x5b3d63=_0x1f1e13;_0x3e1723=_0x5b3d63[_0x2db7('0x14')]||0x1388;}})['then'](function(){return dbH[_0x2db7('0x16')][_0x2db7('0x17')](util[_0x2db7('0x10')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2db7('0x16')][_0x2db7('0x18')][_0x2db7('0x19')]});})[_0x2db7('0x15')](function(_0x4df45a){if(!_0x4df45a[0x0]['num']){return analyticExtractedReport(_0x2db7('0x1a'));}var _0xf21167=[];var _0x1d4d80=0x0;var _0x35d77e=!![];if(_0x5b3d63[_0x2db7('0x1b')]){if(_0x4df45a&&_0x4df45a[_0x2db7('0x1c')]){var _0x447c36=_0x4df45a[0x0][_0x2db7('0x1d')]%(_0x1d4d80+_0x3e1723);for(;_0x35d77e;_0x1d4d80+=_0x3e1723,_0x447c36=_0x4df45a[0x0][_0x2db7('0x1d')]%(_0x1d4d80+_0x3e1723)){if(_0x447c36==0x0||_0x447c36==_0x4df45a[0x0][_0x2db7('0x1d')]){_0x35d77e=![];}_0xf21167[_0x2db7('0x1e')](dbH[_0x2db7('0x16')][_0x2db7('0x17')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3e1723,_0x1d4d80),{'type':dbH['sequelize'][_0x2db7('0x18')]['SELECT']}));}}}else{_0xf21167[_0x2db7('0x1e')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x2db7('0x16')][_0x2db7('0x18')]['SELECT']}));}var _0x227f82=path[_0x2db7('0x1f')](PATH);var _0x10f9d7=path[_0x2db7('0x20')](PATH,_0x2db7('0x21'));var _0x12686a=_0x5b3d63[_0x2db7('0x1b')]&&_0xf21167[_0x2db7('0x1c')]>0x1;var _0x314f0e=[];if(!fs['existsSync'](path[_0x2db7('0x22')](_0x227f82,_0x10f9d7))&&_0x12686a){fs['mkdirSync'](path[_0x2db7('0x22')](_0x227f82,_0x10f9d7));}return BPromise['each'](_0xf21167,function(_0x24b033){_0x314f0e[_0x2db7('0x1e')](_0x24b033);})[_0x2db7('0x15')](function(){for(var _0x5c70ca=0x0;_0x5c70ca<_0x314f0e[_0x2db7('0x1c')];_0x5c70ca+=0x1){var _0x5a1b3c;var _0x3c0337=_0x314f0e[_0x5c70ca];if(_0x12686a){_0x5a1b3c=path['join'](_0x227f82,_0x10f9d7,util[_0x2db7('0x10')](_0x2db7('0x23'),_0x10f9d7,_0x5c70ca,_0x2db7('0x24')));}else{_0x5a1b3c=path[_0x2db7('0x22')](_0x227f82,util[_0x2db7('0x10')](_0x2db7('0x25'),_0x10f9d7,_0x2db7('0x24')));}fs['writeFileSync'](_0x5a1b3c,json2xls(_0x3c0337),_0x2db7('0x26'));}})[_0x2db7('0x15')](function(){if(_0x12686a){zipdir(path[_0x2db7('0x22')](_0x227f82,_0x10f9d7),{'saveTo':path[_0x2db7('0x22')](_0x227f82,util[_0x2db7('0x10')]('%s.%s',_0x10f9d7,_0x2db7('0x27')))},function(_0x2d9a56,_0x3787c4){});rimraf(path['join'](_0x227f82,_0x10f9d7),function(){});}})[_0x2db7('0x15')](function(){logger[_0x2db7('0xf')](util[_0x2db7('0x10')](_0x2db7('0x28'),EXTRACTED_REPORT_ID,_0x2db7('0x12')));return analyticExtractedReport(_0x2db7('0x29'),_0x12686a?util[_0x2db7('0x10')](_0x2db7('0x25'),_0x10f9d7,_0x12686a?'zip':'xlsx'):null);});})[_0x2db7('0x2a')](function(_0x32dd67){logger[_0x2db7('0xf')](util[_0x2db7('0x10')](_0x2db7('0x2b'),EXTRACTED_REPORT_ID,_0x2db7('0x12')),util[_0x2db7('0x2c')](_0x32dd67,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2db7('0x2d'));})[_0x2db7('0x2e')](function(){process[_0x2db7('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7ae472b..62bcea9 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 _0x6d6c=['${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','none','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:'];(function(_0x20d07f,_0x38a296){var _0x431b55=function(_0x3cd362){while(--_0x3cd362){_0x20d07f['push'](_0x20d07f['shift']());}};_0x431b55(++_0x38a296);}(_0x6d6c,0x68));var _0xc6d6=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0x6d6c[_0x5eca50];return _0x41fb84;};'use strict';var _=require('lodash');var util=require(_0xc6d6('0x0'));function rewrite(_0x38bd16,_0x515688){var _0x5658a0=this;return _0x38bd16[_0xc6d6('0x1')][_0xc6d6('0x2')][_0xc6d6('0x3')]({'raw':!![]})[_0xc6d6('0x4')](function(_0x2a39f5){_0x5658a0[_0xc6d6('0x5')]=_0x2a39f5;return _0x38bd16['models'][_0xc6d6('0x6')]['findAll']({'where':{'IntervalId':_0x515688[_0xc6d6('0x7')]},'raw':!![]});})[_0xc6d6('0x4')](function(_0x58900f){return _0x38bd16[_0xc6d6('0x1')]['VoiceExtension'][_0xc6d6('0x3')]({'where':{'exten':{'$in':_[_0xc6d6('0x8')](_[_0xc6d6('0x9')](_0x58900f,_0xc6d6('0xa')))}},'order':[{'raw':_0xc6d6('0xb')}],'raw':!![]});})['then'](function(_0x5031a0){var _0x51a43a=_['filter'](_0x5031a0,{'priority':'1'});var _0x34da88=_[_0xc6d6('0xc')](_0x5031a0,{'isApp':0x1});var _0x11893d=_['groupBy'](_0x34da88,'exten');var _0x492aba=[_0xc6d6('0xd'),_0xc6d6('0xe')];var _0x1d1355=[];var _0x43c805=[];for(var _0x5453ad in _0x11893d){if(_0x11893d[_0xc6d6('0xf')](_0x5453ad)){_0x5658a0[_0xc6d6('0x10')]=0x2;_0x5658a0[_0xc6d6('0x11')]=[];_0x5658a0[_0xc6d6('0x12')]=_['find'](_0x51a43a,{'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')]});_0x5658a0['extensions'][_0xc6d6('0x13')]({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':_0xc6d6('0x15'),'appdata':util['format'](_0xc6d6('0x16'),_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')]),'context':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x17')],'exten':_0x11893d[_0x5453ad][0x0]['exten'],'priority':_0x5658a0['priority']++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});if(_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')]===_0xc6d6('0x19')){_0x5658a0[_0xc6d6('0x11')]['push']({'type':_0x11893d[_0x5453ad][0x0]['type'],'app':_0xc6d6('0x15'),'appdata':_0xc6d6('0x1a')+_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')],'context':_0x11893d[_0x5453ad][0x0]['context'],'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')],'priority':_0x5658a0[_0xc6d6('0x10')]++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});}else if(_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')]===_0xc6d6('0x1b')){if(_0x5658a0[_0xc6d6('0x12')]){_0x5658a0[_0xc6d6('0x11')][_0xc6d6('0x13')]({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':'Set','appdata':'CDR(destination)='+(_0x5658a0[_0xc6d6('0x12')][_0xc6d6('0x1c')]?_0xc6d6('0x1d')+_0x5658a0[_0xc6d6('0x12')][_0xc6d6('0x1c')]+'}':_0xc6d6('0x1e')),'context':_0x11893d[_0x5453ad][0x0]['context'],'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')],'priority':_0x5658a0[_0xc6d6('0x10')]++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});}_0x5658a0['extensions']['push']({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':_0xc6d6('0x15'),'appdata':_0xc6d6('0x1a')+_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')],'context':_0x11893d[_0x5453ad][0x0]['context'],'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')],'priority':_0x5658a0[_0xc6d6('0x10')]++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});var _0x125b42=_0x5658a0[_0xc6d6('0x10')]++;_0x5658a0['extensions']['push']({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':_0xc6d6('0x1f'),'appdata':_0xc6d6('0x20')+(_0x125b42+0x2)+_0xc6d6('0x21')+(_0x125b42+0x1)+')','context':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x17')],'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')],'priority':_0x125b42,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});if(_0x5658a0[_0xc6d6('0x12')]){_0x5658a0[_0xc6d6('0x11')]['push']({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':_0xc6d6('0x15'),'appdata':_0x5658a0['extension'][_0xc6d6('0x1c')]?_0xc6d6('0x22')+_0x5658a0[_0xc6d6('0x12')][_0xc6d6('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x17')],'exten':_0x11893d[_0x5453ad][0x0]['exten'],'priority':_0x5658a0[_0xc6d6('0x10')]++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});}_0x5658a0[_0xc6d6('0x11')]['push']({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':'Set','appdata':_0xc6d6('0x23')+_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')],'context':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x17')],'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')],'priority':_0x5658a0['priority']++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0]['VoiceExtensionId']});if(_0x5658a0['extension']&&_0x5658a0['extension'][_0xc6d6('0xf')]('recordingFormat')&&_0x5658a0[_0xc6d6('0x12')]['recordingFormat']!==_0xc6d6('0x24')){_0x5658a0['extensions'][_0xc6d6('0x13')]({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':_0xc6d6('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x17')],'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')],'priority':_0x5658a0['priority']++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0]['VoiceExtensionId']});_0x5658a0['extensions']['push']({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':'Set','appdata':_0xc6d6('0x25')+_0x5658a0[_0xc6d6('0x12')][_0xc6d6('0x26')]||_0xc6d6('0x27'),'context':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x17')],'exten':_0x11893d[_0x5453ad][0x0]['exten'],'priority':_0x5658a0[_0xc6d6('0x10')]++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});}}_0x5658a0['extensions'][_0xc6d6('0x13')]({'type':_0x11893d[_0x5453ad][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x11893d[_0x5453ad][0x0]['context'],'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')],'priority':_0x5658a0[_0xc6d6('0x10')]++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});_0x5658a0[_0xc6d6('0x11')][_0xc6d6('0x13')]({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':_0xc6d6('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x17')],'exten':_0x11893d[_0x5453ad][0x0]['exten'],'priority':_0x5658a0[_0xc6d6('0x10')]++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});_0x5658a0[_0xc6d6('0x11')][_0xc6d6('0x13')]({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':_0xc6d6('0x15'),'appdata':_0xc6d6('0x28'),'context':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x17')],'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')],'priority':_0x5658a0[_0xc6d6('0x10')]++,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]});for(var _0x1274a8=0x0,_0x1c68c5=0x0;_0x1274a8<_0x11893d[_0x5453ad][_0xc6d6('0x29')];_0x1274a8+=0x1,_0x1c68c5=0x0){var _0x3d1979=_0x11893d[_0x5453ad][_0x1274a8];if(_0x3d1979[_0xc6d6('0x14')]){_0x3d1979[_0xc6d6('0x14')]=_0x3d1979['type'][_0xc6d6('0x2a')]();}var _0x396a0b=[];var _0x30f8d4=[];delete _0x3d1979['id'];delete _0x3d1979['createdAt'];delete _0x3d1979[_0xc6d6('0x2b')];var _0x4e0b2c=_0x3d1979[_0xc6d6('0x2c')]!==_0xc6d6('0x2d')?[_0x3d1979[_0xc6d6('0x2c')]]:_0x3d1979[_0xc6d6('0x7')]?_[_0xc6d6('0x9')](_[_0xc6d6('0xc')](_0x5658a0[_0xc6d6('0x5')],{'IntervalId':_0x3d1979['IntervalId']}),_0xc6d6('0x2c')):[];if(_0x3d1979['hasOwnProperty'](_0xc6d6('0x2e'))){if(_0x3d1979['tag']&&_0x3d1979[_0xc6d6('0x2e')]!=='--'){_0x396a0b[_0xc6d6('0x13')]({'type':_0x3d1979[_0xc6d6('0x14')],'app':'Set','appdata':_0xc6d6('0x2f')+_0x3d1979[_0xc6d6('0x2e')],'context':_0x3d1979[_0xc6d6('0x17')],'exten':_0x3d1979[_0xc6d6('0xa')],'priority':_0x4e0b2c[_0xc6d6('0x29')]+_0x5658a0[_0xc6d6('0x10')]+_0x1c68c5++,'VoiceExtensionId':_0x3d1979[_0xc6d6('0x18')]});}}if(_0x3d1979[_0xc6d6('0x14')]==='outbound'&&_0x3d1979[_0xc6d6('0xf')]('callerID')){if(_0x3d1979[_0xc6d6('0x30')]){_0x396a0b[_0xc6d6('0x13')]({'type':_0x3d1979[_0xc6d6('0x14')],'app':_0xc6d6('0x1f'),'appdata':_0xc6d6('0x31')+_0x3d1979[_0xc6d6('0x30')]+')','context':_0x3d1979[_0xc6d6('0x17')],'exten':_0x3d1979[_0xc6d6('0xa')],'priority':_0x4e0b2c[_0xc6d6('0x29')]+_0x5658a0[_0xc6d6('0x10')]+_0x1c68c5++,'VoiceExtensionId':_0x3d1979[_0xc6d6('0x18')]});}else{_0x396a0b['push']({'type':_0x3d1979[_0xc6d6('0x14')],'app':_0xc6d6('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3d1979[_0xc6d6('0x17')],'exten':_0x3d1979[_0xc6d6('0xa')],'priority':_0x4e0b2c[_0xc6d6('0x29')]+_0x5658a0[_0xc6d6('0x10')]+_0x1c68c5++,'VoiceExtensionId':_0x3d1979[_0xc6d6('0x18')]});}}if(_0x3d1979[_0xc6d6('0xf')](_0xc6d6('0x32'))){if(_0x492aba[_0xc6d6('0x33')](_0x3d1979[_0xc6d6('0x34')][_0xc6d6('0x2a')]())>=0x0&&_0x3d1979['appType']!==_0xc6d6('0x35')){if(_0x3d1979['answer']){_0x396a0b['push']({'type':_0x3d1979[_0xc6d6('0x14')],'app':_0xc6d6('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3d1979[_0xc6d6('0x17')],'exten':_0x3d1979[_0xc6d6('0xa')],'priority':_0x4e0b2c['length']+_0x5658a0[_0xc6d6('0x10')]+_0x1c68c5++,'VoiceExtensionId':_0x3d1979[_0xc6d6('0x18')]});_0x396a0b[_0xc6d6('0x13')]({'type':_0x3d1979[_0xc6d6('0x14')],'app':_0xc6d6('0x15'),'appdata':_0xc6d6('0x36'),'context':_0x3d1979['context'],'exten':_0x3d1979['exten'],'priority':_0x4e0b2c[_0xc6d6('0x29')]+_0x5658a0[_0xc6d6('0x10')]+_0x1c68c5++,'VoiceExtensionId':_0x3d1979[_0xc6d6('0x18')]});}else{_0x396a0b[_0xc6d6('0x13')]({'type':_0x3d1979['type'],'app':_0xc6d6('0x1f'),'appdata':_0xc6d6('0x37'),'context':_0x3d1979[_0xc6d6('0x17')],'exten':_0x3d1979[_0xc6d6('0xa')],'priority':_0x4e0b2c[_0xc6d6('0x29')]+_0x5658a0[_0xc6d6('0x10')]+_0x1c68c5++,'VoiceExtensionId':_0x3d1979[_0xc6d6('0x18')]});_0x396a0b[_0xc6d6('0x13')]({'type':_0x3d1979[_0xc6d6('0x14')],'app':_0xc6d6('0x15'),'appdata':_0xc6d6('0x38'),'context':_0x3d1979[_0xc6d6('0x17')],'exten':_0x3d1979[_0xc6d6('0xa')],'priority':_0x4e0b2c[_0xc6d6('0x29')]+_0x5658a0[_0xc6d6('0x10')]+_0x1c68c5++,'VoiceExtensionId':_0x3d1979[_0xc6d6('0x18')]});}}}for(var _0x59fe50=0x0;_0x59fe50<_0x4e0b2c[_0xc6d6('0x29')];_0x59fe50+=0x1){var _0x1fd938=_0x5658a0[_0xc6d6('0x10')]+_0x4e0b2c[_0xc6d6('0x29')];var _0x2e4883=_0x59fe50===_0x4e0b2c['length']-0x1?_0x5658a0[_0xc6d6('0x10')]+_0x396a0b[_0xc6d6('0x29')]+_0x30f8d4[_0xc6d6('0x29')]+0x2:_0x5658a0['priority']+_0x59fe50+0x1;_0x396a0b[_0xc6d6('0x39')](_0x59fe50,0x0,{'type':_0x3d1979[_0xc6d6('0x14')],'app':_0xc6d6('0x3a'),'appdata':_0x4e0b2c[_0x59fe50]+'?'+_0x3d1979[_0xc6d6('0x17')]+_0xc6d6('0x3b')+_0x1fd938+':'+_0x3d1979[_0xc6d6('0x17')]+_0xc6d6('0x3b')+_0x2e4883,'exten':_0x3d1979[_0xc6d6('0xa')],'context':_0x3d1979[_0xc6d6('0x17')],'priority':_0x5658a0['priority']+_0x59fe50,'VoiceExtensionId':_0x11893d[_0x5453ad][0x0]['VoiceExtensionId']});}_0x3d1979[_0xc6d6('0x10')]=_0x396a0b['length']?_[_0xc6d6('0x3c')](_0x396a0b)[_0xc6d6('0x10')]+0x1:_0x5658a0[_0xc6d6('0x10')];_0x5658a0['priority']=(_0x30f8d4['length']?_[_0xc6d6('0x3c')](_0x30f8d4)[_0xc6d6('0x10')]:_0x3d1979[_0xc6d6('0x10')])+0x1;_0x5658a0['extensions']=_[_0xc6d6('0x3d')](_0x5658a0[_0xc6d6('0x11')],_0x396a0b,[_0x3d1979],_0x30f8d4);}_0x5658a0['extensions'][_0xc6d6('0x13')]({'type':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x14')],'app':_0xc6d6('0x3e'),'exten':_0x11893d[_0x5453ad][0x0][_0xc6d6('0xa')],'context':_0x11893d[_0x5453ad][0x0][_0xc6d6('0x17')],'priority':_0x5658a0[_0xc6d6('0x10')],'VoiceExtensionId':_0x11893d[_0x5453ad][0x0]['VoiceExtensionId']});_0x1d1355[_0xc6d6('0x13')](_0x11893d[_0x5453ad][0x0][_0xc6d6('0x18')]);_0x43c805=_[_0xc6d6('0x3d')](_0x43c805,_0x5658a0['extensions']);}}return _0x38bd16[_0xc6d6('0x3f')](function(_0x352821){return _0x38bd16['models'][_0xc6d6('0x6')][_0xc6d6('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x1d1355}},'transaction':_0x352821})['then'](function(_0x5d55dd){return _0x38bd16[_0xc6d6('0x1')][_0xc6d6('0x6')][_0xc6d6('0x41')](_['sortBy'](_0x43c805,'priority'),{'transaction':_0x352821});});});})[_0xc6d6('0x42')](function(_0x5d3257){console['error'](_0x5d3257);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x57b8=['VoiceExtension','findAll','IntervalId','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','inbound','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','map','tag','CDR(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','indexOf','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','util','models','Interval','then','intervals'];(function(_0x1d23b8,_0x4d234d){var _0x2693a3=function(_0x5d39eb){while(--_0x5d39eb){_0x1d23b8['push'](_0x1d23b8['shift']());}};_0x2693a3(++_0x4d234d);}(_0x57b8,0x1a5));var _0x857b=function(_0x39adc0,_0x4844a4){_0x39adc0=_0x39adc0-0x0;var _0x2fccf0=_0x57b8[_0x39adc0];return _0x2fccf0;};'use strict';var _=require('lodash');var util=require(_0x857b('0x0'));function rewrite(_0x1da73f,_0x46000a){var _0x287dea=this;return _0x1da73f[_0x857b('0x1')][_0x857b('0x2')]['findAll']({'raw':!![]})[_0x857b('0x3')](function(_0xeff9f9){_0x287dea[_0x857b('0x4')]=_0xeff9f9;return _0x1da73f[_0x857b('0x1')][_0x857b('0x5')][_0x857b('0x6')]({'where':{'IntervalId':_0x46000a[_0x857b('0x7')]},'raw':!![]});})['then'](function(_0x51b18c){return _0x1da73f['models'][_0x857b('0x5')][_0x857b('0x6')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x51b18c,'exten'))}},'order':[{'raw':_0x857b('0x8')}],'raw':!![]});})[_0x857b('0x3')](function(_0x599e9c){var _0x41e138=_[_0x857b('0x9')](_0x599e9c,{'priority':'1'});var _0x1cfcc0=_['filter'](_0x599e9c,{'isApp':0x1});var _0x2d5db7=_[_0x857b('0xa')](_0x1cfcc0,_0x857b('0xb'));var _0x116d0a=['queue',_0x857b('0xc')];var _0x3ad961=[];var _0x7e14d9=[];for(var _0x12eda5 in _0x2d5db7){if(_0x2d5db7[_0x857b('0xd')](_0x12eda5)){_0x287dea[_0x857b('0xe')]=0x2;_0x287dea['extensions']=[];_0x287dea[_0x857b('0xf')]=_[_0x857b('0x10')](_0x41e138,{'exten':_0x2d5db7[_0x12eda5][0x0]['exten']});_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':util[_0x857b('0x15')](_0x857b('0x16'),_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')]),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']});if(_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')]===_0x857b('0x18')){_0x287dea[_0x857b('0x11')]['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':'CDR(routeid)='+_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')],'context':_0x2d5db7[_0x12eda5][0x0]['context'],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea['priority']++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']});}else if(_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')]===_0x857b('0x1a')){if(_0x287dea[_0x857b('0xf')]){_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0]['type'],'app':_0x857b('0x14'),'appdata':'CDR(destination)='+(_0x287dea[_0x857b('0xf')][_0x857b('0x1b')]?_0x857b('0x1c')+_0x287dea[_0x857b('0xf')][_0x857b('0x1b')]+'}':_0x857b('0x1d')),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});}_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':_0x857b('0x1e')+_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')],'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea['priority']++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']});var _0x359ad6=_0x287dea['priority']++;_0x287dea['extensions']['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x1f'),'appdata':_0x857b('0x20')+(_0x359ad6+0x2)+_0x857b('0x21')+(_0x359ad6+0x1)+')','context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x359ad6,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});if(_0x287dea[_0x857b('0xf')]){_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':'Set','appdata':_0x287dea[_0x857b('0xf')]['cutdigits']?_0x857b('0x22')+_0x287dea['extension'][_0x857b('0x1b')]+'}':_0x857b('0x23'),'context':_0x2d5db7[_0x12eda5][0x0]['context'],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});}_0x287dea['extensions']['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':'Set','appdata':_0x857b('0x24')+_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')],'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0]['exten'],'priority':_0x287dea['priority']++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});if(_0x287dea[_0x857b('0xf')]&&_0x287dea[_0x857b('0xf')]['hasOwnProperty'](_0x857b('0x25'))&&_0x287dea['extension'][_0x857b('0x25')]!==_0x857b('0x26')){_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0]['type'],'app':_0x857b('0x14'),'appdata':_0x857b('0x27'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x287dea['extension'][_0x857b('0x25')]||_0x857b('0x28'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});}}_0x287dea[_0x857b('0x11')][_0x857b('0x12')]({'type':_0x2d5db7[_0x12eda5][0x0]['type'],'app':'Set','appdata':_0x857b('0x29'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0]['exten'],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});_0x287dea['extensions']['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':'Set','appdata':_0x857b('0x2a'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea['priority']++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});_0x287dea[_0x857b('0x11')]['push']({'type':_0x2d5db7[_0x12eda5][0x0]['type'],'app':_0x857b('0x14'),'appdata':_0x857b('0x2b'),'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'priority':_0x287dea[_0x857b('0xe')]++,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});for(var _0x3625dd=0x0,_0x9a2f30=0x0;_0x3625dd<_0x2d5db7[_0x12eda5][_0x857b('0x2c')];_0x3625dd+=0x1,_0x9a2f30=0x0){var _0x309cb8=_0x2d5db7[_0x12eda5][_0x3625dd];if(_0x309cb8[_0x857b('0x13')]){_0x309cb8[_0x857b('0x13')]=_0x309cb8[_0x857b('0x13')]['toLowerCase']();}var _0x385147=[];var _0x23ab67=[];delete _0x309cb8['id'];delete _0x309cb8[_0x857b('0x2d')];delete _0x309cb8['updatedAt'];var _0x405842=_0x309cb8[_0x857b('0x2e')]!=='*,*,*,*'?[_0x309cb8[_0x857b('0x2e')]]:_0x309cb8[_0x857b('0x7')]?_[_0x857b('0x2f')](_[_0x857b('0x9')](_0x287dea[_0x857b('0x4')],{'IntervalId':_0x309cb8[_0x857b('0x7')]}),_0x857b('0x2e')):[];if(_0x309cb8[_0x857b('0xd')](_0x857b('0x30'))){if(_0x309cb8[_0x857b('0x30')]&&_0x309cb8['tag']!=='--'){_0x385147[_0x857b('0x12')]({'type':_0x309cb8['type'],'app':_0x857b('0x14'),'appdata':_0x857b('0x31')+_0x309cb8['tag'],'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842['length']+_0x287dea['priority']+_0x9a2f30++,'VoiceExtensionId':_0x309cb8[_0x857b('0x19')]});}}if(_0x309cb8[_0x857b('0x13')]===_0x857b('0x1a')&&_0x309cb8[_0x857b('0xd')](_0x857b('0x32'))){if(_0x309cb8['callerID']){_0x385147[_0x857b('0x12')]({'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x1f'),'appdata':_0x857b('0x33')+_0x309cb8['callerID']+')','context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea['priority']+_0x9a2f30++,'VoiceExtensionId':_0x309cb8[_0x857b('0x19')]});}else{_0x385147[_0x857b('0x12')]({'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x1f'),'appdata':_0x857b('0x34'),'context':_0x309cb8['context'],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea['priority']+_0x9a2f30++,'VoiceExtensionId':_0x309cb8['VoiceExtensionId']});}}if(_0x309cb8[_0x857b('0xd')](_0x857b('0x35'))){if(_0x116d0a[_0x857b('0x36')](_0x309cb8[_0x857b('0x37')]['toLowerCase']())>=0x0&&_0x309cb8['appType']!=='custom'){if(_0x309cb8[_0x857b('0x35')]){_0x385147[_0x857b('0x12')]({'type':_0x309cb8['type'],'app':'ExecIf','appdata':_0x857b('0x38'),'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea[_0x857b('0xe')]+_0x9a2f30++,'VoiceExtensionId':_0x309cb8[_0x857b('0x19')]});_0x385147[_0x857b('0x12')]({'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':_0x857b('0x39'),'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842['length']+_0x287dea[_0x857b('0xe')]+_0x9a2f30++,'VoiceExtensionId':_0x309cb8['VoiceExtensionId']});}else{_0x385147[_0x857b('0x12')]({'type':_0x309cb8['type'],'app':_0x857b('0x1f'),'appdata':_0x857b('0x3a'),'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea[_0x857b('0xe')]+_0x9a2f30++,'VoiceExtensionId':_0x309cb8['VoiceExtensionId']});_0x385147[_0x857b('0x12')]({'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x14'),'appdata':_0x857b('0x3b'),'context':_0x309cb8[_0x857b('0x17')],'exten':_0x309cb8[_0x857b('0xb')],'priority':_0x405842[_0x857b('0x2c')]+_0x287dea[_0x857b('0xe')]+_0x9a2f30++,'VoiceExtensionId':_0x309cb8[_0x857b('0x19')]});}}}for(var _0x6f4ec0=0x0;_0x6f4ec0<_0x405842['length'];_0x6f4ec0+=0x1){var _0x39a7cb=_0x287dea[_0x857b('0xe')]+_0x405842[_0x857b('0x2c')];var _0x1fe165=_0x6f4ec0===_0x405842[_0x857b('0x2c')]-0x1?_0x287dea[_0x857b('0xe')]+_0x385147[_0x857b('0x2c')]+_0x23ab67['length']+0x2:_0x287dea[_0x857b('0xe')]+_0x6f4ec0+0x1;_0x385147['splice'](_0x6f4ec0,0x0,{'type':_0x309cb8[_0x857b('0x13')],'app':_0x857b('0x3c'),'appdata':_0x405842[_0x6f4ec0]+'?'+_0x309cb8[_0x857b('0x17')]+',${EXTEN},'+_0x39a7cb+':'+_0x309cb8[_0x857b('0x17')]+_0x857b('0x3d')+_0x1fe165,'exten':_0x309cb8[_0x857b('0xb')],'context':_0x309cb8[_0x857b('0x17')],'priority':_0x287dea[_0x857b('0xe')]+_0x6f4ec0,'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']});}_0x309cb8[_0x857b('0xe')]=_0x385147[_0x857b('0x2c')]?_[_0x857b('0x3e')](_0x385147)[_0x857b('0xe')]+0x1:_0x287dea[_0x857b('0xe')];_0x287dea[_0x857b('0xe')]=(_0x23ab67['length']?_[_0x857b('0x3e')](_0x23ab67)[_0x857b('0xe')]:_0x309cb8[_0x857b('0xe')])+0x1;_0x287dea[_0x857b('0x11')]=_[_0x857b('0x3f')](_0x287dea['extensions'],_0x385147,[_0x309cb8],_0x23ab67);}_0x287dea[_0x857b('0x11')]['push']({'type':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x13')],'app':_0x857b('0x40'),'exten':_0x2d5db7[_0x12eda5][0x0][_0x857b('0xb')],'context':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x17')],'priority':_0x287dea[_0x857b('0xe')],'VoiceExtensionId':_0x2d5db7[_0x12eda5][0x0][_0x857b('0x19')]});_0x3ad961['push'](_0x2d5db7[_0x12eda5][0x0]['VoiceExtensionId']);_0x7e14d9=_['concat'](_0x7e14d9,_0x287dea[_0x857b('0x11')]);}}return _0x1da73f[_0x857b('0x41')](function(_0xa36c5a){return _0x1da73f[_0x857b('0x1')][_0x857b('0x5')][_0x857b('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x3ad961}},'transaction':_0xa36c5a})[_0x857b('0x3')](function(_0x4b5761){return _0x1da73f['models'][_0x857b('0x5')][_0x857b('0x43')](_[_0x857b('0x44')](_0x7e14d9,_0x857b('0xe')),{'transaction':_0xa36c5a});});});})[_0x857b('0x45')](function(_0x224bdc){console[_0x857b('0x46')](_0x224bdc);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 5d0ff59..8be2712 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 _0x6416=['undefined','null','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','find','duplicate','Duplicate\x20Contact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','into','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','get','push','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','Lists','always','CampaignId','onlyIfOpen','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','resume','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','info','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','socket.io-emitter','register','argv','Missing\x20filepath\x20parameter!'];(function(_0x1a92a6,_0x13d34e){var _0x9b4c52=function(_0x22d13b){while(--_0x22d13b){_0x1a92a6['push'](_0x1a92a6['shift']());}};_0x9b4c52(++_0x13d34e);}(_0x6416,0x1a6));var _0x6641=function(_0x505915,_0x1e2f7a){_0x505915=_0x505915-0x0;var _0x2aba51=_0x6416[_0x505915];return _0x2aba51;};'use strict';var BPromise=require(_0x6641('0x0'));var util=require('util');var _=require(_0x6641('0x1'));var fs=require('fs');var squel=require(_0x6641('0x2'));var Papa=require(_0x6641('0x3'));var Redis=require(_0x6641('0x4'));var db=require(_0x6641('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x6641('0x6'))(_0x6641('0x7'));config[_0x6641('0x8')]=_[_0x6641('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6641('0xa'))(new Redis(config[_0x6641('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0x6641('0xb')](socket);try{if(!process[_0x6641('0xc')][0x2]||process[_0x6641('0xc')][0x2]==='undefined'||process[_0x6641('0xc')][0x2]==='null'){throw new Error(_0x6641('0xd'));}var FILEPATH=process[_0x6641('0xc')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x6641('0xe')||process[_0x6641('0xc')][0x3]===_0x6641('0xf')||!process[_0x6641('0xc')][0x4]||process[_0x6641('0xc')][0x4]===_0x6641('0xe')||process[_0x6641('0xc')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x6641('0x10')](process[_0x6641('0xc')][0x3][_0x6641('0x11')](','),process[_0x6641('0xc')][0x4][_0x6641('0x11')](','));if(!process['argv'][0x5]||process[_0x6641('0xc')][0x5]===_0x6641('0xe')||process[_0x6641('0xc')][0x5]==='null'){throw new Error(_0x6641('0x12'));}var LISTID=process[_0x6641('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x6641('0xe')&&process['argv'][0x6]!==_0x6641('0xf')?process[_0x6641('0xc')][0x6]:null;var DUPLICATES=process[_0x6641('0xc')][0x7]&&process[_0x6641('0xc')][0x7]!==_0x6641('0xe')&&process['argv'][0x7]!==_0x6641('0xf')?process[_0x6641('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0x6641('0xc')][0x8]==='undefined'||process[_0x6641('0xc')][0x8]===_0x6641('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x6641('0xc')][0x8];}catch(_0xa29b43){logger[_0x6641('0x13')](_0xa29b43);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(_0x1ece47,_0x4c8abd,_0xf2d0c4,_0x20d76e){var _0x4f7beb={'message':_0x4c8abd};_0x4f7beb[_0x1ece47]=!![];if(_0xf2d0c4){_0x4f7beb[_0x6641('0x14')]=_0xf2d0c4;}if(_0x20d76e){_0x4f7beb[_0x6641('0x15')]=_0x20d76e;}return _0x4f7beb;}function isEmail(_0x37b0c2){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))*$/[_0x6641('0x16')](_0x37b0c2);}function checkRow(_0x43a7bb,_0x32e6cb,_0x21b508){return new BPromise(function(_0xe6a45d,_0x26d7df){if(_[_0x6641('0x17')](_0x43a7bb)){return _0x26d7df(handleCheckRowError(_0x6641('0x13'),_0x6641('0x18'),null,_0x21b508));}if(_0x43a7bb[_0x6641('0x19')]&&_0x43a7bb['errors'][_0x6641('0x1a')]){var _0x3231ad=_[_0x6641('0x1b')](_0x43a7bb['errors'],_0x6641('0x1c'))['join'](';');return _0x26d7df(handleCheckRowError(_0x6641('0x13'),_0x3231ad,null,_0x21b508));}var _0x2547b1={};for(var _0x35af9e in FIELDS){if(FIELDS['hasOwnProperty'](_0x35af9e)&&FIELDS[_0x35af9e]){_0x2547b1[_0x35af9e]=_0x43a7bb['data'][0x0][FIELDS[_0x35af9e]]||_0x43a7bb['data'][0x0]['\ufeff'+FIELDS[_0x35af9e]];}}if(!_0x2547b1['firstName']){return _0x26d7df(handleCheckRowError(_0x6641('0x13'),_0x6641('0x1d'),null,_0x21b508));}if(!_0x2547b1[_0x6641('0x1e')]){return _0x26d7df(handleCheckRowError(_0x6641('0x13'),_0x6641('0x1f'),null,_0x21b508));}if(_0x2547b1[_0x6641('0x20')]){var _0x47439b=moment(_0x2547b1[_0x6641('0x20')],_0x6641('0x21'));if(!_0x47439b[_0x6641('0x22')]()){return _0x26d7df(handleCheckRowError(_0x6641('0x13'),_0x6641('0x23'),null,_0x21b508));}}if(_0x2547b1[_0x6641('0x24')]){if(!isEmail(_0x2547b1[_0x6641('0x24')])){return _0x26d7df(handleCheckRowError(_0x6641('0x13'),'email\x20format\x20is\x20not\x20valid!',null,_0x21b508));}}_0x2547b1[_0x6641('0x25')]=LISTID;_0x2547b1['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6641('0x1a')]&&_0x32e6cb){var _0x9df3d7={};for(var _0x2c98e3=0x0,_0x19f516=DUPLICATES['length'];_0x2c98e3<_0x19f516;_0x2c98e3+=0x1){_0x9df3d7[DUPLICATES[_0x2c98e3]]=_0x2547b1[DUPLICATES[_0x2c98e3]];}var _0x2e602f=_[_0x6641('0x26')](_0x32e6cb,_0x9df3d7);if(_0x2e602f){return _0x26d7df(handleCheckRowError(_0x6641('0x27'),_0x6641('0x28'),_0x2e602f,_0x21b508));}}return db['CmContact']['create'](_0x2547b1,{'raw':!![],'hooks':![],'fields':_[_0x6641('0x29')](_0x2547b1)})[_0x6641('0x2a')](function(_0x2cccf0){if(DUPLICATES&&DUPLICATES['length']&&_0x32e6cb){_0x32e6cb['push'](_[_0x6641('0x2b')](_0x2547b1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2cccf0['id'];return _0xe6a45d();})[_0x6641('0x2c')](function(_0x297cb0){return _0x26d7df(handleCheckRowError(_0x6641('0x13'),_0x6641('0x2d')+(_0x297cb0[_0x6641('0x1c')]||JSON['stringify'](_0x297cb0)),null,_0x21b508));});});}function checkHopper(){function _0x151d23(){return function(_0x1ffa06){logger[_0x6641('0x13')](_0x6641('0x2e'),_0x6641('0x2f'),util[_0x6641('0x30')](_0x1ffa06,{'showHidden':![],'depth':null}));};}var _0x4edee9=function(_0x53b08a,_0xb219d6){var _0x14f878=squel[_0x6641('0x31')]()['into'](_0x6641('0x32'))[_0x6641('0x33')]([_0x6641('0x1e'),_0x6641('0x34'),_0x6641('0x35'),'ListId',_0xb219d6,_0x6641('0x36'),_0x6641('0x37')],squel['select']()[_0x6641('0x38')]('phone','phone')[_0x6641('0x38')](_0x6641('0x39'),_0x6641('0x34'))['field']('id',_0x6641('0x35'))[_0x6641('0x38')](LISTID[_0x6641('0x3a')](),'ListId')[_0x6641('0x38')](_0x53b08a['id'][_0x6641('0x3a')](),_0xb219d6)[_0x6641('0x38')](_0x6641('0x39'),_0x6641('0x36'))['field']('NOW()',_0x6641('0x37'))[_0x6641('0x3b')](_0x6641('0x3c'))[_0x6641('0x3d')](_0x6641('0x3e'))[_0x6641('0x3d')](_0x6641('0x3f'),LISTID[_0x6641('0x3a')]())[_0x6641('0x3d')](_0x6641('0x40'))['where'](_0x6641('0x41'),squel[_0x6641('0x42')]()[_0x6641('0x38')](_0x6641('0x1e'))['from'](_0x6641('0x32'))[_0x6641('0x3d')](_0xb219d6+_0x6641('0x43'),_0x53b08a['id'][_0x6641('0x3a')]())))[_0x6641('0x3a')]();return _0x14f878;};var _0x525769=function(_0x46036d,_0x5138a7){var _0x3a9b62=squel[_0x6641('0x31')]()[_0x6641('0x44')](_0x6641('0x32'))[_0x6641('0x33')]([_0x6641('0x1e'),_0x6641('0x34'),_0x6641('0x35'),_0x6641('0x25'),_0x5138a7,_0x6641('0x36'),'updatedAt'],squel[_0x6641('0x42')]()[_0x6641('0x38')](_0x6641('0x1e'),_0x6641('0x1e'))[_0x6641('0x38')](_0x6641('0x39'),_0x6641('0x34'))[_0x6641('0x38')]('id',_0x6641('0x35'))[_0x6641('0x38')](LISTID['toString'](),'ListId')[_0x6641('0x38')](_0x46036d['id'][_0x6641('0x3a')](),_0x5138a7)[_0x6641('0x38')](_0x6641('0x39'),_0x6641('0x36'))[_0x6641('0x38')](_0x6641('0x39'),'updatedAt')['from'](_0x6641('0x3c'))[_0x6641('0x3d')](_0x6641('0x3e'))[_0x6641('0x3d')](_0x6641('0x3f'),LISTID[_0x6641('0x3a')]())[_0x6641('0x3d')](_0x6641('0x45'),squel[_0x6641('0x46')](hopperContacts))[_0x6641('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x6641('0x3d')](_0x6641('0x41'),squel[_0x6641('0x42')]()[_0x6641('0x38')]('calleridnum')[_0x6641('0x3b')](_0x6641('0x47'))[_0x6641('0x3d')](_0x5138a7+'\x20=\x20?',_0x46036d['id'][_0x6641('0x3a')]()))[_0x6641('0x3d')](_0x6641('0x41'),squel[_0x6641('0x42')]()[_0x6641('0x38')](_0x6641('0x1e'))[_0x6641('0x3b')](_0x6641('0x32'))[_0x6641('0x3d')](_0x5138a7+_0x6641('0x43'),_0x46036d['id'][_0x6641('0x3a')]())))[_0x6641('0x3a')]();return _0x3a9b62;};function _0x2c6332(_0x487404,_0x5af7f4){var _0x20ba5d=squel[_0x6641('0x31')]()['into'](_0x6641('0x32'))[_0x6641('0x33')]([_0x6641('0x1e'),_0x6641('0x34'),_0x6641('0x35'),'ListId',_0x5af7f4,_0x6641('0x36'),_0x6641('0x37')],squel['select']()[_0x6641('0x38')]('phone',_0x6641('0x1e'))[_0x6641('0x38')]('NOW()','scheduledAt')[_0x6641('0x38')]('id',_0x6641('0x35'))[_0x6641('0x38')](LISTID[_0x6641('0x3a')](),'ListId')[_0x6641('0x38')](_0x487404['id'][_0x6641('0x3a')](),_0x5af7f4)[_0x6641('0x38')](_0x6641('0x39'),'createdAt')[_0x6641('0x38')]('NOW()',_0x6641('0x37'))[_0x6641('0x3b')](_0x6641('0x3c'))['where'](_0x6641('0x3e'))[_0x6641('0x3d')](_0x6641('0x3f'),LISTID[_0x6641('0x3a')]())[_0x6641('0x3d')](_0x6641('0x45'),squel[_0x6641('0x46')](hopperContacts))['where'](_0x6641('0x40')))[_0x6641('0x3a')]();return _0x20ba5d;}function _0x552ec8(_0x4a6a2c,_0x20b268){var _0x136377=squel[_0x6641('0x31')]()[_0x6641('0x44')](_0x6641('0x48'))['fromQuery']([_0x6641('0x1e'),'ContactId','ListId',_0x20b268,_0x6641('0x36'),_0x6641('0x37')],squel['select']()[_0x6641('0x38')](_0x6641('0x1e'),_0x6641('0x1e'))[_0x6641('0x38')]('id',_0x6641('0x35'))[_0x6641('0x38')](LISTID[_0x6641('0x3a')](),_0x6641('0x25'))['field'](_0x4a6a2c['id'][_0x6641('0x3a')](),_0x20b268)[_0x6641('0x38')](_0x6641('0x39'),'createdAt')[_0x6641('0x38')]('NOW()',_0x6641('0x37'))[_0x6641('0x3b')](_0x6641('0x3c'))['where'](_0x6641('0x3e'))[_0x6641('0x3d')](_0x6641('0x3f'),LISTID['toString']())[_0x6641('0x3d')](_0x6641('0x45'),squel[_0x6641('0x46')](hopperContacts))[_0x6641('0x3d')](_0x6641('0x40')))[_0x6641('0x3a')]();return _0x136377;}return db['VoiceQueue'][_0x6641('0x49')]({'where':{'type':_0x6641('0x4a')},'attributes':['id',_0x6641('0x4b')],'include':[{'model':db[_0x6641('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0x6641('0x2a')](function(_0x186b29){var _0x512c93=[];if(_0x186b29){var _0x48821e;for(var _0x406e5a=0x0,_0x2a0944;_0x406e5a<_0x186b29[_0x6641('0x1a')];_0x406e5a+=0x1){_0x2a0944=_0x186b29[_0x406e5a][_0x6641('0x4d')]({'plain':!![]});switch(_0x2a0944[_0x6641('0x4b')]){case'always':_0x512c93[_0x6641('0x4e')](db[_0x6641('0x4f')]['query'](_0x525769(_0x2a0944,'VoiceQueueId'))[_0x6641('0x2a')](function(){})[_0x6641('0x2c')](_0x151d23()));break;case'onlyIfOpen':_0x512c93[_0x6641('0x4e')](db[_0x6641('0x4f')][_0x6641('0x50')](_0x4edee9(_0x2a0944,_0x6641('0x51')))[_0x6641('0x2a')](function(){})[_0x6641('0x2c')](_0x151d23()));break;default:_0x512c93['push'](db['sequelize']['query'](_0x2c6332(_0x2a0944,_0x6641('0x51')))[_0x6641('0x2a')](function(){})['catch'](_0x151d23()));}}}return _0x512c93;})[_0x6641('0x52')]()[_0x6641('0x2a')](function(){return db[_0x6641('0x53')]['findAll']({'where':{'type':_0x6641('0x4a')},'attributes':['id'],'include':[{'model':db[_0x6641('0x4c')],'as':_0x6641('0x54'),'where':{'id':LISTID}}]})[_0x6641('0x2a')](function(_0x4d2a0e){var _0x10822c=[];if(_0x4d2a0e){var _0x4bebbd;for(var _0xddf0df=0x0,_0x3111e;_0xddf0df<_0x4d2a0e['length'];_0xddf0df+=0x1){_0x3111e=_0x4d2a0e[_0xddf0df][_0x6641('0x4d')]({'plain':!![]});_0x10822c[_0x6641('0x4e')](db[_0x6641('0x4f')][_0x6641('0x50')](_0x552ec8(_0x3111e,_0x6641('0x51')))['then'](function(){})[_0x6641('0x2c')](_0x151d23()));}}return _0x10822c;})['all']();})['then'](function(){return db['Campaign'][_0x6641('0x49')]({'attributes':['id',_0x6641('0x4b')],'include':[{'model':db[_0x6641('0x4c')],'as':_0x6641('0x55'),'where':{'id':LISTID}}]})[_0x6641('0x2a')](function(_0x52183a){var _0x256d8d=[];if(_0x52183a){for(var _0x32da45=0x0,_0x1dc41d;_0x32da45<_0x52183a[_0x6641('0x1a')];_0x32da45+=0x1){_0x1dc41d=_0x52183a[_0x32da45][_0x6641('0x4d')]({'plain':!![]});switch(_0x1dc41d[_0x6641('0x4b')]){case _0x6641('0x56'):_0x256d8d[_0x6641('0x4e')](db[_0x6641('0x4f')][_0x6641('0x50')](_0x525769(_0x1dc41d,_0x6641('0x57')))[_0x6641('0x2a')](function(){})[_0x6641('0x2c')](_0x151d23()));break;case _0x6641('0x58'):_0x256d8d[_0x6641('0x4e')](db['sequelize'][_0x6641('0x50')](_0x4edee9(_0x1dc41d,_0x6641('0x57')))['then'](function(){})[_0x6641('0x2c')](_0x151d23()));break;default:_0x256d8d[_0x6641('0x4e')](db[_0x6641('0x4f')]['query'](_0x2c6332(_0x1dc41d,_0x6641('0x57')))['then'](function(){})['catch'](_0x151d23()));}}}return _0x256d8d;})['all']();})[_0x6641('0x2a')](function(){return db[_0x6641('0x59')][_0x6641('0x49')]({'attributes':['id'],'include':[{'model':db[_0x6641('0x4c')],'as':_0x6641('0x54'),'where':{'id':LISTID}}]})[_0x6641('0x2a')](function(_0x11f2c4){var _0x2988ac=[];if(_0x11f2c4){for(var _0xafa13a=0x0,_0x3250dc;_0xafa13a<_0x11f2c4[_0x6641('0x1a')];_0xafa13a+=0x1){_0x3250dc=_0x11f2c4[_0xafa13a][_0x6641('0x4d')]({'plain':!![]});_0x2988ac[_0x6641('0x4e')](db['sequelize'][_0x6641('0x50')](_0x552ec8(_0x3250dc,'CampaignId'))[_0x6641('0x2a')](function(){})[_0x6641('0x2c')](_0x151d23()));}}return _0x2988ac;})[_0x6641('0x52')]();})[_0x6641('0x2c')](function(_0x5c3d99){logger[_0x6641('0x13')](_0x6641('0x5a'),_0x6641('0x5b'),_0x5c3d99[_0x6641('0x1c')]);});}var processPromises=function(_0x255aa7){return BPromise[_0x6641('0x52')](promises)[_0x6641('0x2a')](function(_0x2dde47){})[_0x6641('0x2c')](function(_0x54f51e){logger[_0x6641('0x13')](_0x6641('0x5c'),JSON[_0x6641('0x5d')](_0x54f51e));})[_0x6641('0x5e')](function(){socket[_0x6641('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x255aa7){return _0x255aa7[_0x6641('0x60')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x6641('0x2a')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x6641('0x5f')](_0x6641('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6641('0x62')](FILEPATH);}catch(_0x1326d1){logger[_0x6641('0x13')](_0x6641('0x63'),JSON[_0x6641('0x5d')](_0x1326d1));}finally{process[_0x6641('0x64')](0x0);}});};process['on'](_0x6641('0x65'),function(){logger['info'](_0x6641('0x66'));endCsv();});function main(){return BPromise[_0x6641('0x67')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6641('0x11')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6641('0x2a')](function(_0x555bda){var _0x1a88d4=fs[_0x6641('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6641('0x69')](_0x1a88d4,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d77d5,_0x510726){total+=0x1;var _0x992a2d=total;promises[_0x6641('0x4e')](checkRow(_0x3d77d5,_0x555bda,_0x992a2d)[_0x6641('0x2a')](function(){success+=0x1;})['catch'](function(_0x43a4b6){if(_0x43a4b6['error']){errors+=0x1;delete _0x43a4b6[_0x6641('0x13')];}else if(_0x43a4b6[_0x6641('0x27')]){duplicates+=0x1;delete _0x43a4b6['duplicate'];}rows[_0x6641('0x4e')](_0x43a4b6);}));if(total%0xc8===0x0){_0x510726[_0x6641('0x6a')]();return processPromises(_0x510726);}},'complete':function(){return processPromises()[_0x6641('0x2a')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xf34612,_0x5eef26){logger[_0x6641('0x6b')]('CSV\x20parse\x20error',JSON['stringify'](_0xf34612));endCsv();}});})[_0x6641('0x2c')](function(_0x54dbb2){logger[_0x6641('0x13')](_0x6641('0x6c'),JSON['stringify'](_0x54dbb2));});}main(); \ No newline at end of file +var _0x2f2e=['cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','phone\x20IS\x20NOT\x20NULL','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CmContact','createReadStream','parse','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','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','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f2e,0x176));var _0xe2f2=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x2f2e[_0x4ca333];return _0x13b2e1;};'use strict';var BPromise=require(_0xe2f2('0x0'));var util=require(_0xe2f2('0x1'));var _=require(_0xe2f2('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xe2f2('0x3'));var Redis=require(_0xe2f2('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xe2f2('0x5'));var logger=require(_0xe2f2('0x6'))(_0xe2f2('0x7'));config[_0xe2f2('0x8')]=_[_0xe2f2('0x9')](config[_0xe2f2('0x8')],{'host':_0xe2f2('0xa'),'port':0x18eb});var socket=require(_0xe2f2('0xb'))(new Redis(config[_0xe2f2('0x8')]));require(_0xe2f2('0xc'))[_0xe2f2('0xd')](socket);try{if(!process[_0xe2f2('0xe')][0x2]||process[_0xe2f2('0xe')][0x2]==='undefined'||process[_0xe2f2('0xe')][0x2]==='null'){throw new Error(_0xe2f2('0xf'));}var FILEPATH=process[_0xe2f2('0xe')][0x2];if(!process[_0xe2f2('0xe')][0x3]||process[_0xe2f2('0xe')][0x3]===_0xe2f2('0x10')||process[_0xe2f2('0xe')][0x3]===_0xe2f2('0x11')||!process[_0xe2f2('0xe')][0x4]||process[_0xe2f2('0xe')][0x4]===_0xe2f2('0x10')||process['argv'][0x4]===_0xe2f2('0x11')){throw new Error(_0xe2f2('0x12'));}var FIELDS=_[_0xe2f2('0x13')](process[_0xe2f2('0xe')][0x3][_0xe2f2('0x14')](','),process[_0xe2f2('0xe')][0x4][_0xe2f2('0x14')](','));if(!process[_0xe2f2('0xe')][0x5]||process[_0xe2f2('0xe')][0x5]===_0xe2f2('0x10')||process[_0xe2f2('0xe')][0x5]===_0xe2f2('0x11')){throw new Error(_0xe2f2('0x15'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xe2f2('0xe')][0x6]!=='undefined'&&process[_0xe2f2('0xe')][0x6]!==_0xe2f2('0x11')?process[_0xe2f2('0xe')][0x6]:null;var DUPLICATES=process[_0xe2f2('0xe')][0x7]&&process['argv'][0x7]!==_0xe2f2('0x10')&&process[_0xe2f2('0xe')][0x7]!==_0xe2f2('0x11')?process[_0xe2f2('0xe')][0x7]:null;if(!process[_0xe2f2('0xe')][0x8]||process[_0xe2f2('0xe')][0x8]==='undefined'||process[_0xe2f2('0xe')][0x8]===_0xe2f2('0x11')){throw new Error(_0xe2f2('0x16'));}var SOCKET_TIMESTAMP=process[_0xe2f2('0xe')][0x8];}catch(_0x11ea18){logger[_0xe2f2('0x17')](_0x11ea18);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(_0x128e76,_0x427b7c,_0x189142,_0x44b8c4){var _0x2ff55e={'message':_0x427b7c};_0x2ff55e[_0x128e76]=!![];if(_0x189142){_0x2ff55e['contact']=_0x189142;}if(_0x44b8c4){_0x2ff55e[_0xe2f2('0x18')]=_0x44b8c4;}return _0x2ff55e;}function isEmail(_0x33bea6){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))*$/[_0xe2f2('0x19')](_0x33bea6);}function checkRow(_0x2054f4,_0x2b291a,_0x238905){return new BPromise(function(_0x443344,_0xda63de){if(_[_0xe2f2('0x1a')](_0x2054f4)){return _0xda63de(handleCheckRowError(_0xe2f2('0x17'),_0xe2f2('0x1b'),null,_0x238905));}if(_0x2054f4[_0xe2f2('0x1c')]&&_0x2054f4[_0xe2f2('0x1c')][_0xe2f2('0x1d')]){var _0x3ecd37=_[_0xe2f2('0x1e')](_0x2054f4[_0xe2f2('0x1c')],_0xe2f2('0x1f'))[_0xe2f2('0x20')](';');return _0xda63de(handleCheckRowError('error',_0x3ecd37,null,_0x238905));}var _0x517fe1={};for(var _0x282e33 in FIELDS){if(FIELDS[_0xe2f2('0x21')](_0x282e33)&&FIELDS[_0x282e33]){_0x517fe1[_0x282e33]=_0x2054f4[_0xe2f2('0x22')][0x0][FIELDS[_0x282e33]]||_0x2054f4[_0xe2f2('0x22')][0x0]['\ufeff'+FIELDS[_0x282e33]];}}if(!_0x517fe1[_0xe2f2('0x23')]){return _0xda63de(handleCheckRowError('error',_0xe2f2('0x24'),null,_0x238905));}if(!_0x517fe1[_0xe2f2('0x25')]){return _0xda63de(handleCheckRowError(_0xe2f2('0x17'),_0xe2f2('0x26'),null,_0x238905));}if(_0x517fe1[_0xe2f2('0x27')]){var _0x49f72c=moment(_0x517fe1[_0xe2f2('0x27')],_0xe2f2('0x28'));if(!_0x49f72c['isValid']()){return _0xda63de(handleCheckRowError('error',_0xe2f2('0x29'),null,_0x238905));}}if(_0x517fe1[_0xe2f2('0x2a')]){if(!isEmail(_0x517fe1[_0xe2f2('0x2a')])){return _0xda63de(handleCheckRowError(_0xe2f2('0x17'),_0xe2f2('0x2b'),null,_0x238905));}}_0x517fe1[_0xe2f2('0x2c')]=LISTID;_0x517fe1['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe2f2('0x1d')]&&_0x2b291a){var _0x2dd4c={};for(var _0x529543=0x0,_0x79705e=DUPLICATES[_0xe2f2('0x1d')];_0x529543<_0x79705e;_0x529543+=0x1){_0x2dd4c[DUPLICATES[_0x529543]]=_0x517fe1[DUPLICATES[_0x529543]];}var _0x544dba=_[_0xe2f2('0x2d')](_0x2b291a,_0x2dd4c);if(_0x544dba){return _0xda63de(handleCheckRowError(_0xe2f2('0x2e'),_0xe2f2('0x2f'),_0x544dba,_0x238905));}}return db['CmContact'][_0xe2f2('0x30')](_0x517fe1,{'raw':!![],'hooks':![],'fields':_[_0xe2f2('0x31')](_0x517fe1)})[_0xe2f2('0x32')](function(_0x1d2973){if(DUPLICATES&&DUPLICATES['length']&&_0x2b291a){_0x2b291a[_0xe2f2('0x33')](_[_0xe2f2('0x34')](_0x517fe1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1d2973['id'];return _0x443344();})[_0xe2f2('0x35')](function(_0xd20c69){return _0xda63de(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0xd20c69[_0xe2f2('0x1f')]||JSON[_0xe2f2('0x36')](_0xd20c69)),null,_0x238905));});});}function checkHopper(){function _0x59fbff(){return function(_0x468770){logger[_0xe2f2('0x17')]('cmContact',_0xe2f2('0x37'),util[_0xe2f2('0x38')](_0x468770,{'showHidden':![],'depth':null}));};}var _0x3b3850=function(_0x153f68,_0x54e11b){var _0x5a546b=squel[_0xe2f2('0x39')]()[_0xe2f2('0x3a')](_0xe2f2('0x3b'))[_0xe2f2('0x3c')]([_0xe2f2('0x25'),_0xe2f2('0x3d'),_0xe2f2('0x3e'),_0xe2f2('0x2c'),_0x54e11b,_0xe2f2('0x3f'),_0xe2f2('0x40')],squel[_0xe2f2('0x41')]()[_0xe2f2('0x42')](_0xe2f2('0x25'),_0xe2f2('0x25'))[_0xe2f2('0x42')](_0xe2f2('0x43'),'scheduledAt')[_0xe2f2('0x42')]('id',_0xe2f2('0x3e'))[_0xe2f2('0x42')](LISTID[_0xe2f2('0x44')](),_0xe2f2('0x2c'))[_0xe2f2('0x42')](_0x153f68['id']['toString'](),_0x54e11b)[_0xe2f2('0x42')](_0xe2f2('0x43'),'createdAt')[_0xe2f2('0x42')](_0xe2f2('0x43'),_0xe2f2('0x40'))[_0xe2f2('0x45')](_0xe2f2('0x46'))[_0xe2f2('0x47')](_0xe2f2('0x48'))['where'](_0xe2f2('0x49'),LISTID[_0xe2f2('0x44')]())[_0xe2f2('0x47')]('phone\x20IS\x20NOT\x20NULL')[_0xe2f2('0x47')](_0xe2f2('0x4a'),squel['select']()['field'](_0xe2f2('0x25'))[_0xe2f2('0x45')]('cm_hopper')[_0xe2f2('0x47')](_0x54e11b+_0xe2f2('0x4b'),_0x153f68['id']['toString']())))[_0xe2f2('0x44')]();return _0x5a546b;};var _0x1c02da=function(_0x2aa55d,_0x2c2e6){var _0x3b15f3=squel[_0xe2f2('0x39')]()[_0xe2f2('0x3a')](_0xe2f2('0x3b'))[_0xe2f2('0x3c')]([_0xe2f2('0x25'),'scheduledAt',_0xe2f2('0x3e'),'ListId',_0x2c2e6,'createdAt','updatedAt'],squel['select']()[_0xe2f2('0x42')]('phone',_0xe2f2('0x25'))[_0xe2f2('0x42')]('NOW()',_0xe2f2('0x3d'))[_0xe2f2('0x42')]('id',_0xe2f2('0x3e'))[_0xe2f2('0x42')](LISTID[_0xe2f2('0x44')](),_0xe2f2('0x2c'))[_0xe2f2('0x42')](_0x2aa55d['id'][_0xe2f2('0x44')](),_0x2c2e6)[_0xe2f2('0x42')]('NOW()',_0xe2f2('0x3f'))[_0xe2f2('0x42')](_0xe2f2('0x43'),_0xe2f2('0x40'))[_0xe2f2('0x45')](_0xe2f2('0x46'))[_0xe2f2('0x47')](_0xe2f2('0x48'))[_0xe2f2('0x47')](_0xe2f2('0x49'),LISTID[_0xe2f2('0x44')]())['where'](_0xe2f2('0x4c'),squel[_0xe2f2('0x4d')](hopperContacts))[_0xe2f2('0x47')]('phone\x20IS\x20NOT\x20NULL')[_0xe2f2('0x47')](_0xe2f2('0x4a'),squel[_0xe2f2('0x41')]()[_0xe2f2('0x42')]('calleridnum')[_0xe2f2('0x45')](_0xe2f2('0x4e'))[_0xe2f2('0x47')](_0x2c2e6+_0xe2f2('0x4b'),_0x2aa55d['id'][_0xe2f2('0x44')]()))[_0xe2f2('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe2f2('0x41')]()[_0xe2f2('0x42')](_0xe2f2('0x25'))[_0xe2f2('0x45')](_0xe2f2('0x3b'))[_0xe2f2('0x47')](_0x2c2e6+_0xe2f2('0x4b'),_0x2aa55d['id'][_0xe2f2('0x44')]())))[_0xe2f2('0x44')]();return _0x3b15f3;};function _0x41efc0(_0x4e66d2,_0x4441f4){var _0x309ddd=squel[_0xe2f2('0x39')]()[_0xe2f2('0x3a')](_0xe2f2('0x3b'))[_0xe2f2('0x3c')]([_0xe2f2('0x25'),_0xe2f2('0x3d'),'ContactId',_0xe2f2('0x2c'),_0x4441f4,'createdAt',_0xe2f2('0x40')],squel[_0xe2f2('0x41')]()['field']('phone','phone')[_0xe2f2('0x42')](_0xe2f2('0x43'),_0xe2f2('0x3d'))['field']('id',_0xe2f2('0x3e'))[_0xe2f2('0x42')](LISTID[_0xe2f2('0x44')](),'ListId')['field'](_0x4e66d2['id'][_0xe2f2('0x44')](),_0x4441f4)[_0xe2f2('0x42')](_0xe2f2('0x43'),_0xe2f2('0x3f'))['field'](_0xe2f2('0x43'),_0xe2f2('0x40'))[_0xe2f2('0x45')](_0xe2f2('0x46'))['where'](_0xe2f2('0x48'))[_0xe2f2('0x47')](_0xe2f2('0x49'),LISTID[_0xe2f2('0x44')]())[_0xe2f2('0x47')](_0xe2f2('0x4c'),squel[_0xe2f2('0x4d')](hopperContacts))[_0xe2f2('0x47')](_0xe2f2('0x4f')))[_0xe2f2('0x44')]();return _0x309ddd;}function _0x211e7e(_0x461eb7,_0x33af37){var _0x401193=squel[_0xe2f2('0x39')]()[_0xe2f2('0x3a')]('cm_hopper_black')['fromQuery']([_0xe2f2('0x25'),_0xe2f2('0x3e'),'ListId',_0x33af37,'createdAt','updatedAt'],squel['select']()['field'](_0xe2f2('0x25'),_0xe2f2('0x25'))[_0xe2f2('0x42')]('id','ContactId')['field'](LISTID[_0xe2f2('0x44')](),_0xe2f2('0x2c'))[_0xe2f2('0x42')](_0x461eb7['id'][_0xe2f2('0x44')](),_0x33af37)[_0xe2f2('0x42')]('NOW()',_0xe2f2('0x3f'))[_0xe2f2('0x42')]('NOW()','updatedAt')[_0xe2f2('0x45')]('cm_contacts')[_0xe2f2('0x47')](_0xe2f2('0x48'))[_0xe2f2('0x47')]('ListId\x20=\x20?',LISTID[_0xe2f2('0x44')]())[_0xe2f2('0x47')](_0xe2f2('0x4c'),squel[_0xe2f2('0x4d')](hopperContacts))[_0xe2f2('0x47')](_0xe2f2('0x4f')))[_0xe2f2('0x44')]();return _0x401193;}return db[_0xe2f2('0x50')][_0xe2f2('0x51')]({'where':{'type':_0xe2f2('0x52')},'attributes':['id',_0xe2f2('0x53')],'include':[{'model':db[_0xe2f2('0x54')],'as':_0xe2f2('0x55'),'where':{'id':LISTID}}]})[_0xe2f2('0x32')](function(_0x1e4356){var _0x1f7305=[];if(_0x1e4356){var _0x5d8812;for(var _0x466bfb=0x0,_0x403506;_0x466bfb<_0x1e4356['length'];_0x466bfb+=0x1){_0x403506=_0x1e4356[_0x466bfb][_0xe2f2('0x56')]({'plain':!![]});switch(_0x403506['dialCheckDuplicateType']){case _0xe2f2('0x57'):_0x1f7305['push'](db[_0xe2f2('0x58')][_0xe2f2('0x59')](_0x1c02da(_0x403506,_0xe2f2('0x5a')))[_0xe2f2('0x32')](function(){})['catch'](_0x59fbff()));break;case _0xe2f2('0x5b'):_0x1f7305[_0xe2f2('0x33')](db['sequelize'][_0xe2f2('0x59')](_0x3b3850(_0x403506,_0xe2f2('0x5a')))['then'](function(){})[_0xe2f2('0x35')](_0x59fbff()));break;default:_0x1f7305[_0xe2f2('0x33')](db[_0xe2f2('0x58')][_0xe2f2('0x59')](_0x41efc0(_0x403506,_0xe2f2('0x5a')))[_0xe2f2('0x32')](function(){})[_0xe2f2('0x35')](_0x59fbff()));}}}return _0x1f7305;})['all']()[_0xe2f2('0x32')](function(){return db[_0xe2f2('0x50')][_0xe2f2('0x51')]({'where':{'type':_0xe2f2('0x52')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xe2f2('0x5c'),'where':{'id':LISTID}}]})[_0xe2f2('0x32')](function(_0x12e658){var _0x53e71c=[];if(_0x12e658){var _0x215cd9;for(var _0x42141d=0x0,_0x1b176b;_0x42141d<_0x12e658[_0xe2f2('0x1d')];_0x42141d+=0x1){_0x1b176b=_0x12e658[_0x42141d][_0xe2f2('0x56')]({'plain':!![]});_0x53e71c[_0xe2f2('0x33')](db['sequelize'][_0xe2f2('0x59')](_0x211e7e(_0x1b176b,_0xe2f2('0x5a')))[_0xe2f2('0x32')](function(){})[_0xe2f2('0x35')](_0x59fbff()));}}return _0x53e71c;})[_0xe2f2('0x5d')]();})['then'](function(){return db['Campaign'][_0xe2f2('0x51')]({'attributes':['id',_0xe2f2('0x53')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xe2f2('0x32')](function(_0x2b0ddc){var _0xf202c0=[];if(_0x2b0ddc){for(var _0x2dbd14=0x0,_0x4ca318;_0x2dbd14<_0x2b0ddc[_0xe2f2('0x1d')];_0x2dbd14+=0x1){_0x4ca318=_0x2b0ddc[_0x2dbd14][_0xe2f2('0x56')]({'plain':!![]});switch(_0x4ca318[_0xe2f2('0x53')]){case _0xe2f2('0x57'):_0xf202c0[_0xe2f2('0x33')](db[_0xe2f2('0x58')]['query'](_0x1c02da(_0x4ca318,_0xe2f2('0x5e')))[_0xe2f2('0x32')](function(){})[_0xe2f2('0x35')](_0x59fbff()));break;case _0xe2f2('0x5b'):_0xf202c0[_0xe2f2('0x33')](db[_0xe2f2('0x58')][_0xe2f2('0x59')](_0x3b3850(_0x4ca318,_0xe2f2('0x5e')))['then'](function(){})[_0xe2f2('0x35')](_0x59fbff()));break;default:_0xf202c0[_0xe2f2('0x33')](db[_0xe2f2('0x58')]['query'](_0x41efc0(_0x4ca318,'CampaignId'))[_0xe2f2('0x32')](function(){})[_0xe2f2('0x35')](_0x59fbff()));}}}return _0xf202c0;})[_0xe2f2('0x5d')]();})[_0xe2f2('0x32')](function(){return db['Campaign'][_0xe2f2('0x51')]({'attributes':['id'],'include':[{'model':db[_0xe2f2('0x54')],'as':_0xe2f2('0x5c'),'where':{'id':LISTID}}]})[_0xe2f2('0x32')](function(_0x840d92){var _0x30d571=[];if(_0x840d92){for(var _0x607257=0x0,_0x30919a;_0x607257<_0x840d92[_0xe2f2('0x1d')];_0x607257+=0x1){_0x30919a=_0x840d92[_0x607257][_0xe2f2('0x56')]({'plain':!![]});_0x30d571[_0xe2f2('0x33')](db[_0xe2f2('0x58')][_0xe2f2('0x59')](_0x211e7e(_0x30919a,_0xe2f2('0x5e')))['then'](function(){})[_0xe2f2('0x35')](_0x59fbff()));}}return _0x30d571;})[_0xe2f2('0x5d')]();})[_0xe2f2('0x35')](function(_0xf081dc){logger[_0xe2f2('0x17')](_0xe2f2('0x5f'),_0xe2f2('0x60'),_0xf081dc[_0xe2f2('0x1f')]);});}var processPromises=function(_0x429dc4){return BPromise['all'](promises)[_0xe2f2('0x32')](function(_0x50194e){})[_0xe2f2('0x35')](function(_0x3210ec){logger[_0xe2f2('0x17')]('Error\x20processing\x20rows\x20block:',JSON[_0xe2f2('0x36')](_0x3210ec));})[_0xe2f2('0x61')](function(){socket[_0xe2f2('0x62')](_0xe2f2('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x429dc4){return _0x429dc4[_0xe2f2('0x64')]();}});};var endCsv=function(){return BPromise[_0xe2f2('0x65')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xe2f2('0x32')](function(){socket[_0xe2f2('0x62')](_0xe2f2('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe2f2('0x66')](FILEPATH);}catch(_0x40faf6){logger['error'](_0xe2f2('0x67'),JSON[_0xe2f2('0x36')](_0x40faf6));}finally{process['exit'](0x0);}});};process['on'](_0xe2f2('0x68'),function(){logger[_0xe2f2('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xe2f2('0x65')]()[_0xe2f2('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe2f2('0x14')](',');return db[_0xe2f2('0x6a')][_0xe2f2('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe2f2('0x32')](function(_0x94bec5){var _0x50129e=fs[_0xe2f2('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe2f2('0x6c')](_0x50129e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e33d1,_0x28558e){total+=0x1;var _0x5911b2=total;promises[_0xe2f2('0x33')](checkRow(_0x2e33d1,_0x94bec5,_0x5911b2)[_0xe2f2('0x32')](function(){success+=0x1;})[_0xe2f2('0x35')](function(_0x118ae0){if(_0x118ae0[_0xe2f2('0x17')]){errors+=0x1;delete _0x118ae0[_0xe2f2('0x17')];}else if(_0x118ae0[_0xe2f2('0x2e')]){duplicates+=0x1;delete _0x118ae0[_0xe2f2('0x2e')];}rows[_0xe2f2('0x33')](_0x118ae0);}));if(total%0xc8===0x0){_0x28558e['pause']();return processPromises(_0x28558e);}},'complete':function(){return processPromises()['then'](function(){logger[_0xe2f2('0x69')](_0xe2f2('0x6d'));endCsv();});},'error':function(_0x17473c,_0xaf7e61){logger[_0xe2f2('0x69')]('CSV\x20parse\x20error',JSON[_0xe2f2('0x36')](_0x17473c));endCsv();}});})[_0xe2f2('0x35')](function(_0x5adc2a){logger[_0xe2f2('0x17')](_0xe2f2('0x6e'),JSON['stringify'](_0x5adc2a));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index cca72f7..cce6533 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 _0x0916=['squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','into','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','insert','fromQuery','.CmListId','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','fields','id\x20IN\x20?','min_id','group','error','message','errors','code','info','sequelize','query','spread','push','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','rows','emit','contact:import:','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','length','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','util','bluebird','moment'];(function(_0x45d1ea,_0x416b55){var _0x3ac8d2=function(_0x3ab471){while(--_0x3ab471){_0x45d1ea['push'](_0x45d1ea['shift']());}};_0x3ac8d2(++_0x416b55);}(_0x0916,0x82));var _0x6091=function(_0x9a8655,_0x1187a0){_0x9a8655=_0x9a8655-0x0;var _0x4e1415=_0x0916[_0x9a8655];return _0x4e1415;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x6091('0x0'));var Papa=require('papaparse');var util=require(_0x6091('0x1'));var BPromise=require(_0x6091('0x2'));var moment=require(_0x6091('0x3'));var squel=require(_0x6091('0x4'));var Redis=require(_0x6091('0x5'));var db=require(_0x6091('0x6'))['db'];var config=require(_0x6091('0x7'));var logger=require(_0x6091('0x8'))(_0x6091('0x9'));config[_0x6091('0xa')]=_['defaults'](config[_0x6091('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6091('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x6091('0xb')](_0x6091('0xc'));function isEmail(_0x4dab46){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))*$/[_0x6091('0xd')](_0x4dab46);}function selectNotIn(_0x12e024,_0x6c83f9,_0x145962,_0x4c08d0,_0x3cae47){return squel[_0x6091('0xe')]()[_0x6091('0xf')](_0x6091('0x10'))[_0x6091('0x11')](_0x4c08d0)[_0x6091('0x12')](_0x6c83f9,null,_0x6c83f9+_0x6091('0x13')+_0x4c08d0+'.'+_0x145962)[_0x6091('0x14')](_0x4c08d0+'.'+_0x145962+_0x6091('0x15')+_0x12e024+'.'+_0x145962)[_0x6091('0x14')](_0x6c83f9+'.dialCheckDuplicateType\x20IN\x20('+_0x3cae47[_0x6091('0x12')]()+')');}function insertCmHopper(_0x1ed2bf,_0x59a347,_0x107ac4,_0x3a13d2,_0x411250){var _0x1edaf=['cm_contacts.phone',_0x6091('0x16'),_0x6091('0x17'),_0x6091('0x18'),_0x59a347+'.'+_0x3a13d2,_0x6091('0x19'),_0x6091('0x1a'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x411250+'\x22'];return squel['insert']()[_0x6091('0x1b')]('cm_hopper')['fromQuery'](['phone',_0x6091('0x1c'),_0x6091('0x1d'),_0x6091('0x1e'),_0x3a13d2,_0x6091('0x1f'),_0x6091('0x20'),_0x6091('0x21'),_0x6091('0x22'),_0x6091('0x23')],squel[_0x6091('0xe')]()['fields'](_0x1edaf)['from'](_0x59a347)['join'](_0x6091('0x24'),null,_0x6091('0x25')+_0x59a347+'.CmListId')[_0x6091('0x12')](_0x107ac4,null,_0x107ac4+_0x6091('0x13')+_0x59a347+'.'+_0x3a13d2)[_0x6091('0x14')](_0x59a347+_0x6091('0x26'),_0x1ed2bf)[_0x6091('0x14')](_0x6091('0x27'),NOW)[_0x6091('0x14')](_0x6091('0x28'),selectNotIn(_0x59a347,_0x107ac4,_0x3a13d2,_0x6091('0x29'),[_0x6091('0x2a'),_0x6091('0x2b')]))['where'](_0x6091('0x28'),selectNotIn(_0x59a347,_0x107ac4,_0x3a13d2,'cm_hopper',[_0x6091('0x2a')])))[_0x6091('0x2c')]();}function insertCmHopperBlack(_0x2b7a0f,_0x2e22c1,_0x4e0b1c,_0x38a0c2){var _0x91f51d=[_0x6091('0x2d'),_0x6091('0x17'),'cm_contacts.ListId',_0x2e22c1+'.'+_0x38a0c2,_0x6091('0x19'),_0x6091('0x1a')];return squel[_0x6091('0x2e')]()[_0x6091('0x1b')]('cm_hopper_black')[_0x6091('0x2f')]([_0x6091('0x10'),_0x6091('0x1d'),_0x6091('0x1e'),_0x38a0c2,_0x6091('0x1f'),_0x6091('0x20')],squel[_0x6091('0xe')]()['fields'](_0x91f51d)[_0x6091('0x11')](_0x2e22c1)['join'](_0x6091('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x2e22c1+_0x6091('0x30'))[_0x6091('0x12')](_0x4e0b1c,null,_0x4e0b1c+_0x6091('0x13')+_0x2e22c1+'.'+_0x38a0c2)[_0x6091('0x14')](_0x2e22c1+'.CmListId\x20=\x20?',_0x2b7a0f)['where'](_0x6091('0x27'),NOW)[_0x6091('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6091('0xe')]()[_0x6091('0xf')]('phone')[_0x6091('0x11')](_0x6091('0x31'))['where'](_0x6091('0x32'),_0x2b7a0f)[_0x6091('0x14')](_0x38a0c2+_0x6091('0x33'),_0x2e22c1+'.'+_0x38a0c2)))[_0x6091('0x2c')]();}function insertCmContact(_0x4ad14c,_0x4ea555,_0x420904,_0x191bab){var _0x2fac=_[_0x6091('0x34')](_[_0x6091('0x35')](_0x191bab),[_0x6091('0x1e'),_0x6091('0x36'),_0x6091('0x1f'),_0x6091('0x20')]);return squel[_0x6091('0x2e')]()[_0x6091('0x1b')](_0x6091('0x24'))[_0x6091('0x2f')](_0x2fac,squel['select']()[_0x6091('0x37')](_0x2fac)[_0x6091('0x11')](_0x4ea555)['where']('('+_0x420904['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x6091('0xe')]()[_0x6091('0x37')](_0x420904)[_0x6091('0x11')](_0x6091('0x24'))[_0x6091('0x14')](_0x6091('0x32'),_0x4ad14c)['where']('deletedAt\x20IS\x20NULL'))['where'](_0x6091('0x38'),squel[_0x6091('0xe')]()[_0x6091('0xf')]('MIN(id)',_0x6091('0x39'))['from'](_0x4ea555)[_0x6091('0x3a')](_0x420904[_0x6091('0x12')](','))))[_0x6091('0x2c')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1ab044){logger[_0x6091('0x3b')](_0x1ab044[_0x6091('0x3c')]);process['exit'](0x1);}function handleError(_0x1f1421,_0x32a616){stats[_0x6091('0x3d')]['push']({'name':_0x32a616[_0x6091('0x3e')],'message':_0x32a616[_0x6091('0x3c')],'row':_0x1f1421});}function handleQuery(_0x40befb){logger[_0x6091('0x3f')](_0x40befb);return db[_0x6091('0x40')][_0x6091('0x41')](_0x40befb)[_0x6091('0x42')](function(_0xc6600f){results[_0x6091('0x43')](_0xc6600f);})[_0x6091('0x44')](function(_0x26f128){logger[_0x6091('0x3b')](_0x26f128[_0x6091('0x3c')]);});}function main(_0x3b861c,_0x1ddb28,_0x1e3040,_0x2002d8){logger['info'](_0x6091('0x45'),_0x3b861c,JSON[_0x6091('0x46')](_0x1ddb28));process[_0x6091('0x47')](_0x6091('0x48'));var _0x41eb2e=_0x1ddb28[_0x6091('0x49')];var _0x8bfca9=_0x1ddb28[_0x6091('0x4a')];var _0x30c3a3=path[_0x6091('0x12')](config[_0x6091('0x4b')],_0x6091('0x4c'),_0x8bfca9+_0x6091('0x4d'));var _0x29aabf=_['keys'](_0x41eb2e)[_0x6091('0x12')]();logger[_0x6091('0x3f')](_0x6091('0x4e'),_0x29aabf);fs[_0x6091('0x4f')](_0x30c3a3,_0x29aabf+'\x0a');Papa['parse'](fs[_0x6091('0x50')](_0x3b861c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x556633,_0x3b81c2){try{for(var _0xd24649=0x0,_0x4e41db=[];_0xd24649<_0x556633[_0x6091('0x51')]['length'];_0xd24649++){stats['rows']+=0x1;if(_0x556633[_0x6091('0x3d')][_0xd24649]){handleError(_0x556633[_0x6091('0x51')][_0xd24649],_0x556633[_0x6091('0x3d')][_0xd24649]);}else{var _0x348f4e=[];for(var _0x4f47a2 in _0x41eb2e){if(_0x41eb2e['hasOwnProperty'](_0x4f47a2)){if(_0x556633['data'][_0xd24649][_0x41eb2e[_0x4f47a2]]){var _0x511418=_[_0x6091('0x52')](_0x556633[_0x6091('0x51')][_0xd24649][_0x41eb2e[_0x4f47a2]][_0x6091('0x53')](/"/g,'\x27'));switch(_0x4f47a2){case'scheduledat':var _0x5d3468=moment(_0x511418,_0x6091('0xc'),!![]);if(_0x5d3468[_0x6091('0x54')]()){_0x4e41db['push']('\x22'+_0x511418+'\x22');}else{_0x348f4e[_0x6091('0x43')](_0x6091('0x55'));}break;case _0x6091('0x21'):var _0x4a1fd5=parseInt(_0x511418);_0x511418=_[_0x6091('0x56')](_0x4a1fd5)||_0x4a1fd5<0x0||_0x4a1fd5>0x4?_0x2002d8?0x3:0x2:_0x4a1fd5;_0x4e41db[_0x6091('0x43')]('\x22'+_0x511418+'\x22');break;case _0x6091('0x22'):var _0x427fc4=parseInt(_0x511418);if(_[_0x6091('0x57')](_0x427fc4)&&_['includes'](_0x1e3040,_0x427fc4)){_0x4e41db[_0x6091('0x43')]('\x22'+_0x427fc4+'\x22');}else{_0x348f4e[_0x6091('0x43')](_0x6091('0x58'));}break;case _0x6091('0x59'):if(isEmail(_0x511418)){_0x4e41db[_0x6091('0x43')]('\x22'+_0x511418+'\x22');}else{_0x348f4e['push'](_0x6091('0x5a'));}break;case _0x6091('0x5b'):var _0x1a9b1a=moment(_0x511418,_0x6091('0x5c'),!![]);if(_0x1a9b1a['isValid']()){_0x4e41db[_0x6091('0x43')]('\x22'+_0x511418+'\x22');}else{_0x348f4e[_0x6091('0x43')](_0x6091('0x5d'));}break;default:_0x4e41db[_0x6091('0x43')]('\x22'+_0x511418+'\x22');}}else{switch(_0x4f47a2){case'firstName':case _0x6091('0x10'):_0x348f4e['push'](_0x4f47a2+_0x6091('0x5e'));break;default:_0x4e41db[_0x6091('0x43')]('\x22\x22');}}}}if(_0x348f4e['length']){handleError(_0x556633['data'][_0xd24649],{'code':_0x6091('0x5f'),'message':_0x348f4e[_0x6091('0x12')]()});}else{fs[_0x6091('0x60')](_0x30c3a3,_0x4e41db[_0x6091('0x12')]()+'\x0a');}_0x4e41db=[];}if(!(stats[_0x6091('0x61')]%0xc8)){socket[_0x6091('0x62')](_0x6091('0x63')+_0x8bfca9,stats);stats[_0x6091('0x3d')]=[];}}if(stopped){logger[_0x6091('0x3f')]('Abort\x20parser');_0x3b81c2['abort']();}}catch(_0x51d535){handleError(_0x556633['data'][_0xd24649],{'code':'SystemError','message':_0x51d535[_0x6091('0x3c')]});logger[_0x6091('0x3b')](_0x6091('0x64'),_0x51d535['message']);}},'complete':function(){try{var _0x1a5b40=[];var _0x342b9c=_0x6091('0x24');if(_0x1ddb28[_0x6091('0x65')]&&_0x1ddb28[_0x6091('0x65')]['length']){_0x342b9c='cm_contacts_'+_0x8bfca9;_0x1a5b40['push'](_0x6091('0x66')+_0x342b9c+_0x6091('0x67'));}var _0x5f4cec=util['format'](_0x6091('0x68'),_0x30c3a3,_0x342b9c,_0x29aabf,_0x1ddb28['ListId'],_0x1ddb28['CompanyId']||null,NOW,NOW);if(_[_0x6091('0x69')](_0x41eb2e['scheduledat'])){_0x5f4cec+=_0x6091('0x6a');}_0x1a5b40[_0x6091('0x43')](_0x5f4cec);if(_0x1ddb28[_0x6091('0x65')]&&_0x1ddb28[_0x6091('0x65')][_0x6091('0x6b')]){_0x1a5b40[_0x6091('0x43')](insertCmContact(_0x1ddb28['ListId'],_0x342b9c,_0x1ddb28['duplicates'],_0x41eb2e));_0x1a5b40[_0x6091('0x43')](_0x6091('0x6c')+_0x342b9c+';');}_0x1a5b40[_0x6091('0x43')](insertCmHopper(_0x1ddb28['ListId'],_0x6091('0x6d'),_0x6091('0x6e'),'VoiceQueueId',_0x2002d8));_0x1a5b40[_0x6091('0x43')](insertCmHopperBlack(_0x1ddb28[_0x6091('0x1e')],_0x6091('0x6f'),_0x6091('0x6e'),'VoiceQueueId'));_0x1a5b40[_0x6091('0x43')](insertCmHopper(_0x1ddb28['ListId'],_0x6091('0x70'),_0x6091('0x71'),_0x6091('0x72'),_0x2002d8));_0x1a5b40[_0x6091('0x43')](insertCmHopperBlack(_0x1ddb28[_0x6091('0x1e')],_0x6091('0x73'),_0x6091('0x71'),_0x6091('0x72')));BPromise[_0x6091('0x74')](_0x1a5b40,handleQuery)[_0x6091('0x75')](function(_0x37318f){stats[_0x6091('0x76')]=!![];stats[_0x6091('0x77')]=_0x1ddb28[_0x6091('0x65')]&&_0x1ddb28['duplicates']['length']?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0x6091('0x62')]('contact:import:'+_0x8bfca9,stats);fs[_0x6091('0x78')](_0x3b861c);fs[_0x6091('0x78')](_0x30c3a3);process[_0x6091('0x79')](0x0);})[_0x6091('0x44')](function(_0x1be902){logger['error'](_0x1be902[_0x6091('0x3c')]);process[_0x6091('0x79')](0x1);});}catch(_0x357959){logger[_0x6091('0x3b')](_0x6091('0x7a'),_0x357959[_0x6091('0x3c')]);process[_0x6091('0x79')](0x1);}},'error':function(_0x1d645b,_0x13a085,_0x247581,_0x2e3c27){throw new Error(_0x2e3c27);}});}function validate(){if(process[_0x6091('0x7b')]&&process[_0x6091('0x7b')][_0x6091('0x6b')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x4b4915=path[_0x6091('0x12')](config['root'],_0x6091('0x4c'),process[_0x6091('0x7b')][0x2]);if(!fs[_0x6091('0x7c')](_0x4b4915)){throw new Error(_0x6091('0x7d'));}var _0xc7f66b={};try{_0xc7f66b=JSON[_0x6091('0x7e')](process[_0x6091('0x7b')][0x3]);if(!_0xc7f66b[_0x6091('0x49')]){throw new Error(_0x6091('0x7f'));}if(!_0xc7f66b[_0x6091('0x49')][_0x6091('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0xc7f66b[_0x6091('0x49')][_0x6091('0x80')]){throw new Error(_0x6091('0x81'));}var _0x15e008=0x0;if(_0xc7f66b[_0x6091('0x49')][_0x6091('0x22')]){_0x15e008=0x1;}if(!_0xc7f66b[_0x6091('0x1e')]){throw new Error(_0x6091('0x82'));}}catch(_0x16b168){throw new Error('body\x20id\x20mandatory');}var _0x540aa5=[];try{_0x540aa5=_['map'](JSON[_0x6091('0x7e')](process['argv'][0x4]),'id');}catch(_0x1b2282){logger['info'](_0x6091('0x83'));}main(_0x4b4915,_0xc7f66b,_0x540aa5,_0x15e008);}validate();process['on'](_0x6091('0x84'),handleStop);process['on'](_0x6091('0x85'),handleUncaughtException); \ No newline at end of file +var _0x3eab=['ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','SIGINT','uncaughtException','path','lodash','papaparse','squel','../../../mysqldb','../../../config/environment','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','updatedAt','priority','UserId','recallme','fields','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper_black','createdAt','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','\x20=\x20?','toString','keys','ListId','CompanyId','fromQuery',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','error','message','errors','push','spread','catch','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','length','rows','data','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','emit','contact:import:','abort','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns','CampaignId','each','affectedRows','unlink','exit','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName'];(function(_0x5dcef8,_0x287810){var _0x206b84=function(_0x92315a){while(--_0x92315a){_0x5dcef8['push'](_0x5dcef8['shift']());}};_0x206b84(++_0x287810);}(_0x3eab,0x102));var _0xb3ea=function(_0x5a7eb1,_0x2c7a23){_0x5a7eb1=_0x5a7eb1-0x0;var _0x2bce3c=_0x3eab[_0x5a7eb1];return _0x2bce3c;};'use strict';var fs=require('fs');var path=require(_0xb3ea('0x0'));var _=require(_0xb3ea('0x1'));var Papa=require(_0xb3ea('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xb3ea('0x3'));var Redis=require('ioredis');var db=require(_0xb3ea('0x4'))['db'];var config=require(_0xb3ea('0x5'));var logger=require('../../../config/logger')('import');config[_0xb3ea('0x6')]=_[_0xb3ea('0x7')](config[_0xb3ea('0x6')],{'host':_0xb3ea('0x8'),'port':0x18eb});var socket=require(_0xb3ea('0x9'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb3ea('0xa')](_0xb3ea('0xb'));function isEmail(_0x55beaf){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))*$/[_0xb3ea('0xc')](_0x55beaf);}function selectNotIn(_0x260c33,_0x5d50ba,_0x42a140,_0x500980,_0x300f14){return squel[_0xb3ea('0xd')]()['field'](_0xb3ea('0xe'))[_0xb3ea('0xf')](_0x500980)[_0xb3ea('0x10')](_0x5d50ba,null,_0x5d50ba+_0xb3ea('0x11')+_0x500980+'.'+_0x42a140)[_0xb3ea('0x12')](_0x500980+'.'+_0x42a140+_0xb3ea('0x13')+_0x260c33+'.'+_0x42a140)['where'](_0x5d50ba+_0xb3ea('0x14')+_0x300f14['join']()+')');}function insertCmHopper(_0x485493,_0x14e36c,_0x546232,_0x2fed59,_0xd5f286){var _0x5b74d8=[_0xb3ea('0x15'),'cm_contacts.scheduledat',_0xb3ea('0x16'),_0xb3ea('0x17'),_0x14e36c+'.'+_0x2fed59,_0xb3ea('0x18'),_0xb3ea('0x19'),'cm_contacts.priority',_0xb3ea('0x1a'),'\x22'+_0xd5f286+'\x22'];return squel[_0xb3ea('0x1b')]()[_0xb3ea('0x1c')](_0xb3ea('0x1d'))['fromQuery'](['phone',_0xb3ea('0x1e'),_0xb3ea('0x1f'),'ListId',_0x2fed59,'createdAt',_0xb3ea('0x20'),_0xb3ea('0x21'),_0xb3ea('0x22'),_0xb3ea('0x23')],squel[_0xb3ea('0xd')]()[_0xb3ea('0x24')](_0x5b74d8)[_0xb3ea('0xf')](_0x14e36c)[_0xb3ea('0x10')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x14e36c+_0xb3ea('0x25'))[_0xb3ea('0x10')](_0x546232,null,_0x546232+_0xb3ea('0x11')+_0x14e36c+'.'+_0x2fed59)['where'](_0x14e36c+'.CmListId\x20=\x20?',_0x485493)[_0xb3ea('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb3ea('0x12')](_0xb3ea('0x26'),selectNotIn(_0x14e36c,_0x546232,_0x2fed59,_0xb3ea('0x1d'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xb3ea('0x12')](_0xb3ea('0x26'),selectNotIn(_0x14e36c,_0x546232,_0x2fed59,_0xb3ea('0x1d'),[_0xb3ea('0x27')])))['toString']();}function insertCmHopperBlack(_0xc89e43,_0x497a4d,_0x505ab9,_0x1bbdf5){var _0x302e08=[_0xb3ea('0x15'),_0xb3ea('0x16'),_0xb3ea('0x17'),_0x497a4d+'.'+_0x1bbdf5,_0xb3ea('0x18'),_0xb3ea('0x19')];return squel[_0xb3ea('0x1b')]()[_0xb3ea('0x1c')](_0xb3ea('0x28'))['fromQuery']([_0xb3ea('0xe'),_0xb3ea('0x1f'),'ListId',_0x1bbdf5,_0xb3ea('0x29'),'updatedAt'],squel[_0xb3ea('0xd')]()['fields'](_0x302e08)[_0xb3ea('0xf')](_0x497a4d)['join'](_0xb3ea('0x2a'),null,_0xb3ea('0x2b')+_0x497a4d+_0xb3ea('0x25'))[_0xb3ea('0x10')](_0x505ab9,null,_0x505ab9+_0xb3ea('0x11')+_0x497a4d+'.'+_0x1bbdf5)[_0xb3ea('0x12')](_0x497a4d+_0xb3ea('0x2c'),_0xc89e43)['where'](_0xb3ea('0x2d'),NOW)[_0xb3ea('0x12')](_0xb3ea('0x26'),squel[_0xb3ea('0xd')]()[_0xb3ea('0x2e')](_0xb3ea('0xe'))[_0xb3ea('0xf')](_0xb3ea('0x28'))['where'](_0xb3ea('0x2f'),_0xc89e43)[_0xb3ea('0x12')](_0x1bbdf5+_0xb3ea('0x30'),_0x497a4d+'.'+_0x1bbdf5)))[_0xb3ea('0x31')]();}function insertCmContact(_0x2119d4,_0xe2d6ff,_0x3bd14f,_0x4cdd8e){var _0x4aabb5=_['concat'](_[_0xb3ea('0x32')](_0x4cdd8e),[_0xb3ea('0x33'),_0xb3ea('0x34'),_0xb3ea('0x29'),_0xb3ea('0x20')]);return squel['insert']()['into']('cm_contacts')[_0xb3ea('0x35')](_0x4aabb5,squel[_0xb3ea('0xd')]()[_0xb3ea('0x24')](_0x4aabb5)[_0xb3ea('0xf')](_0xe2d6ff)['where']('('+_0x3bd14f[_0xb3ea('0x10')](',')+_0xb3ea('0x36'),squel[_0xb3ea('0xd')]()[_0xb3ea('0x24')](_0x3bd14f)[_0xb3ea('0xf')]('cm_contacts')[_0xb3ea('0x12')]('ListId\x20=\x20?',_0x2119d4)[_0xb3ea('0x12')](_0xb3ea('0x37')))[_0xb3ea('0x12')](_0xb3ea('0x38'),squel[_0xb3ea('0xd')]()['field']('MIN(id)',_0xb3ea('0x39'))['from'](_0xe2d6ff)[_0xb3ea('0x3a')](_0x3bd14f[_0xb3ea('0x10')](','))))[_0xb3ea('0x31')]();}function handleStop(){logger[_0xb3ea('0x3b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3361d8){logger[_0xb3ea('0x3c')](_0x3361d8[_0xb3ea('0x3d')]);process['exit'](0x1);}function handleError(_0x45a3ae,_0x192aca){stats[_0xb3ea('0x3e')][_0xb3ea('0x3f')]({'name':_0x192aca['code'],'message':_0x192aca[_0xb3ea('0x3d')],'row':_0x45a3ae});}function handleQuery(_0x34d7e5){logger[_0xb3ea('0x3b')](_0x34d7e5);return db['sequelize']['query'](_0x34d7e5)[_0xb3ea('0x40')](function(_0xbf96a){results[_0xb3ea('0x3f')](_0xbf96a);})[_0xb3ea('0x41')](function(_0x5557ec){logger[_0xb3ea('0x3c')](_0x5557ec[_0xb3ea('0x3d')]);});}function main(_0x284c51,_0x49151c,_0x18ce86,_0x59dc2d){logger['info']('main',_0x284c51,JSON[_0xb3ea('0x42')](_0x49151c));process[_0xb3ea('0x43')](_0xb3ea('0x44'));var _0x423aed=_0x49151c[_0xb3ea('0x45')];var _0x4e86a5=_0x49151c[_0xb3ea('0x46')];var _0x205d84=path['join'](config[_0xb3ea('0x47')],_0xb3ea('0x48'),_0x4e86a5+_0xb3ea('0x49'));var _0x57d32a=_['keys'](_0x423aed)[_0xb3ea('0x10')]();logger[_0xb3ea('0x3b')](_0xb3ea('0x4a'),_0x57d32a);fs[_0xb3ea('0x4b')](_0x205d84,_0x57d32a+'\x0a');Papa['parse'](fs[_0xb3ea('0x4c')](_0x284c51),{'header':!![],'skipEmptyLines':!![],'step':function(_0x576c1a,_0x278269){try{for(var _0x3b4aec=0x0,_0x17cf2f=[];_0x3b4aec<_0x576c1a['data'][_0xb3ea('0x4d')];_0x3b4aec++){stats[_0xb3ea('0x4e')]+=0x1;if(_0x576c1a['errors'][_0x3b4aec]){handleError(_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec],_0x576c1a['errors'][_0x3b4aec]);}else{var _0x5d0ea5=[];for(var _0x506cc4 in _0x423aed){if(_0x423aed[_0xb3ea('0x50')](_0x506cc4)){if(_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec][_0x423aed[_0x506cc4]]){var _0x10dfc=_['trim'](_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec][_0x423aed[_0x506cc4]][_0xb3ea('0x51')](/"/g,'\x27'));switch(_0x506cc4){case _0xb3ea('0x1e'):var _0x25431e=moment(_0x10dfc,_0xb3ea('0xb'),!![]);if(_0x25431e[_0xb3ea('0x52')]()){_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');}else{_0x5d0ea5[_0xb3ea('0x3f')](_0xb3ea('0x53'));}break;case _0xb3ea('0x21'):var _0x5c2114=parseInt(_0x10dfc);_0x10dfc=_[_0xb3ea('0x54')](_0x5c2114)||_0x5c2114<0x0||_0x5c2114>0x4?_0x59dc2d?0x3:0x2:_0x5c2114;_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');break;case _0xb3ea('0x22'):var _0x1ff5a6=parseInt(_0x10dfc);if(_['isNumber'](_0x1ff5a6)&&_[_0xb3ea('0x55')](_0x18ce86,_0x1ff5a6)){_0x17cf2f['push']('\x22'+_0x1ff5a6+'\x22');}else{_0x5d0ea5[_0xb3ea('0x3f')](_0xb3ea('0x56'));}break;case _0xb3ea('0x57'):if(isEmail(_0x10dfc)){_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');}else{_0x5d0ea5[_0xb3ea('0x3f')](_0xb3ea('0x58'));}break;case _0xb3ea('0x59'):var _0x18cd69=moment(_0x10dfc,_0xb3ea('0x5a'),!![]);if(_0x18cd69[_0xb3ea('0x52')]()){_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');}else{_0x5d0ea5[_0xb3ea('0x3f')](_0xb3ea('0x5b'));}break;default:_0x17cf2f[_0xb3ea('0x3f')]('\x22'+_0x10dfc+'\x22');}}else{switch(_0x506cc4){case'firstName':case _0xb3ea('0xe'):_0x5d0ea5['push'](_0x506cc4+_0xb3ea('0x5c'));break;default:_0x17cf2f['push']('\x22\x22');}}}}if(_0x5d0ea5[_0xb3ea('0x4d')]){handleError(_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec],{'code':'SystemRow','message':_0x5d0ea5['join']()});}else{fs[_0xb3ea('0x5d')](_0x205d84,_0x17cf2f['join']()+'\x0a');}_0x17cf2f=[];}if(!(stats[_0xb3ea('0x4e')]%0xc8)){socket[_0xb3ea('0x5e')](_0xb3ea('0x5f')+_0x4e86a5,stats);stats[_0xb3ea('0x3e')]=[];}}if(stopped){logger[_0xb3ea('0x3b')]('Abort\x20parser');_0x278269[_0xb3ea('0x60')]();}}catch(_0x1106bc){handleError(_0x576c1a[_0xb3ea('0x4f')][_0x3b4aec],{'code':'SystemError','message':_0x1106bc[_0xb3ea('0x3d')]});logger[_0xb3ea('0x3c')](_0xb3ea('0x61'),_0x1106bc[_0xb3ea('0x3d')]);}},'complete':function(){try{var _0x559550=[];var _0x46226a='cm_contacts';if(_0x49151c['duplicates']&&_0x49151c[_0xb3ea('0x62')]['length']){_0x46226a=_0xb3ea('0x63')+_0x4e86a5;_0x559550[_0xb3ea('0x3f')]('CREATE\x20TABLE\x20'+_0x46226a+_0xb3ea('0x64'));}var _0x3e024a=util[_0xb3ea('0xa')](_0xb3ea('0x65'),_0x205d84,_0x46226a,_0x57d32a,_0x49151c[_0xb3ea('0x33')],_0x49151c[_0xb3ea('0x34')]||null,NOW,NOW);if(_[_0xb3ea('0x66')](_0x423aed['scheduledat'])){_0x3e024a+=_0xb3ea('0x67');}_0x559550[_0xb3ea('0x3f')](_0x3e024a);if(_0x49151c[_0xb3ea('0x62')]&&_0x49151c[_0xb3ea('0x62')][_0xb3ea('0x4d')]){_0x559550['push'](insertCmContact(_0x49151c[_0xb3ea('0x33')],_0x46226a,_0x49151c[_0xb3ea('0x62')],_0x423aed));_0x559550[_0xb3ea('0x3f')](_0xb3ea('0x68')+_0x46226a+';');}_0x559550[_0xb3ea('0x3f')](insertCmHopper(_0x49151c[_0xb3ea('0x33')],_0xb3ea('0x69'),_0xb3ea('0x6a'),_0xb3ea('0x6b'),_0x59dc2d));_0x559550[_0xb3ea('0x3f')](insertCmHopperBlack(_0x49151c[_0xb3ea('0x33')],'voice_queues_has_cm_blacklists',_0xb3ea('0x6a'),'VoiceQueueId'));_0x559550['push'](insertCmHopper(_0x49151c[_0xb3ea('0x33')],'campaigns_has_cm_lists',_0xb3ea('0x6c'),_0xb3ea('0x6d'),_0x59dc2d));_0x559550[_0xb3ea('0x3f')](insertCmHopperBlack(_0x49151c[_0xb3ea('0x33')],'campaigns_has_cm_blacklists',_0xb3ea('0x6c'),_0xb3ea('0x6d')));BPromise[_0xb3ea('0x6e')](_0x559550,handleQuery)['then'](function(_0x1e32d6){stats['finish']=!![];stats[_0xb3ea('0x6f')]=_0x49151c[_0xb3ea('0x62')]&&_0x49151c[_0xb3ea('0x62')]['length']?results[0x2][_0xb3ea('0x6f')]:results[0x0][_0xb3ea('0x6f')];socket[_0xb3ea('0x5e')](_0xb3ea('0x5f')+_0x4e86a5,stats);fs[_0xb3ea('0x70')](_0x284c51);fs[_0xb3ea('0x70')](_0x205d84);process[_0xb3ea('0x71')](0x0);})[_0xb3ea('0x41')](function(_0x1d4711){logger[_0xb3ea('0x3c')](_0x1d4711[_0xb3ea('0x3d')]);process[_0xb3ea('0x71')](0x1);});}catch(_0x4f5d7f){logger[_0xb3ea('0x3c')](_0xb3ea('0x72'),_0x4f5d7f[_0xb3ea('0x3d')]);process['exit'](0x1);}},'error':function(_0x104ccb,_0xcba4f0,_0x59e765,_0x217d6d){throw new Error(_0x217d6d);}});}function validate(){if(process[_0xb3ea('0x73')]&&process['argv'][_0xb3ea('0x4d')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x4a9d58=path['join'](config[_0xb3ea('0x47')],_0xb3ea('0x48'),process[_0xb3ea('0x73')][0x2]);if(!fs[_0xb3ea('0x74')](_0x4a9d58)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x17f0c2={};try{_0x17f0c2=JSON['parse'](process[_0xb3ea('0x73')][0x3]);if(!_0x17f0c2['binding']){throw new Error(_0xb3ea('0x75'));}if(!_0x17f0c2['binding'][_0xb3ea('0xe')]){throw new Error(_0xb3ea('0x76'));}if(!_0x17f0c2[_0xb3ea('0x45')][_0xb3ea('0x77')]){throw new Error('firstName\x20is\x20mandatory');}var _0x3a6034=0x0;if(_0x17f0c2[_0xb3ea('0x45')][_0xb3ea('0x22')]){_0x3a6034=0x1;}if(!_0x17f0c2[_0xb3ea('0x33')]){throw new Error(_0xb3ea('0x78'));}}catch(_0x539c5d){throw new Error(_0xb3ea('0x79'));}var _0x39abe3=[];try{_0x39abe3=_[_0xb3ea('0x7a')](JSON[_0xb3ea('0x7b')](process[_0xb3ea('0x73')][0x4]),'id');}catch(_0x4c1e1c){logger[_0xb3ea('0x3b')]('No\x20agent\x20available');}main(_0x4a9d58,_0x17f0c2,_0x39abe3,_0x3a6034);}validate();process['on'](_0xb3ea('0x7c'),handleStop);process['on'](_0xb3ea('0x7d'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 9c8b63a..a280b9f 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 _0x3c84=['endtime','Duration','duration','Billable\x20Time','getSubjects','string','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','calleridname','Call\x20To','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Hold\x20Time','holdtime','talktime','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','answertime','Complete\x20Time'];(function(_0x5bf5fb,_0x3bb2ad){var _0x5a7e1a=function(_0x12acad){while(--_0x12acad){_0x5bf5fb['push'](_0x5bf5fb['shift']());}};_0x5a7e1a(++_0x3bb2ad);}(_0x3c84,0xd1));var _0x43c8=function(_0x120b30,_0x1fe9fb){_0x120b30=_0x120b30-0x0;var _0x11087a=_0x3c84[_0x120b30];return _0x11087a;};'use strict';exports[_0x43c8('0x0')]=function(_0x5ad9c8,_0x198929){var _0xa50be6=[{'type':_0x43c8('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x5ad9c8[_0x43c8('0x2')]()){case _0x43c8('0x3'):switch(_0x198929[_0x43c8('0x2')]()){case _0x43c8('0x4'):_0xa50be6[_0x43c8('0x5')]({'type':_0x43c8('0x6'),'content':'','variableName':_0x43c8('0x7')});_0xa50be6[_0x43c8('0x5')]({'type':'variable','content':'','variableName':_0x43c8('0x8')});break;case _0x43c8('0x9'):_0xa50be6[_0x43c8('0x5')]({'type':'string','content':_0x43c8('0xa'),'variableName':null});_0xa50be6['push']({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0xa50be6;};exports[_0x43c8('0xb')]=function(_0x8bc258,_0x2ab846){var _0x397f64=[];switch(_0x8bc258[_0x43c8('0x2')]()){case _0x43c8('0x3'):switch(_0x2ab846['toLowerCase']()){case _0x43c8('0x4'):_0x397f64=[{'type':'string','content':_0x43c8('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x43c8('0xd'),'content':'','key':'Caller\x20Number','keyType':_0x43c8('0x6'),'variableName':_0x43c8('0x8')},{'type':_0x43c8('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x43c8('0x6'),'variableName':_0x43c8('0xe')},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0xf'),'keyType':_0x43c8('0x6'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0x43c8('0x10'),'keyType':_0x43c8('0x6'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0x43c8('0x11'),'keyType':_0x43c8('0x6'),'variableName':_0x43c8('0x12')},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0x13'),'keyType':_0x43c8('0x6'),'variableName':_0x43c8('0x14')},{'type':_0x43c8('0x1'),'content':_0x43c8('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x43c8('0x16'),'keyType':_0x43c8('0x6'),'variableName':_0x43c8('0x17')},{'type':_0x43c8('0xd'),'content':'','key':'Agent\x20Number','keyType':_0x43c8('0x6'),'variableName':_0x43c8('0x18')},{'type':_0x43c8('0x1'),'content':_0x43c8('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x43c8('0xd'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':'agentcalledAt'},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0x1a'),'keyType':_0x43c8('0x6'),'variableName':_0x43c8('0x1b')},{'type':_0x43c8('0xd'),'content':'','key':'Agent\x20Complete','keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0x1c'),'keyType':'variable','variableName':_0x43c8('0x1d')},{'type':_0x43c8('0xd'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x43c8('0x1e')}];break;case'outbound':_0x397f64=[{'type':_0x43c8('0x1'),'content':_0x43c8('0xc'),'variableName':null},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0x1f'),'keyType':_0x43c8('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x43c8('0x20'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0x43c8('0xd'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0x13'),'keyType':'variable','keyContent':'','variableName':_0x43c8('0x21')},{'type':_0x43c8('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0x22'),'keyType':_0x43c8('0x6'),'keyContent':'','variableName':_0x43c8('0x23')},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0x24'),'keyType':_0x43c8('0x6'),'keyContent':'','variableName':_0x43c8('0x25')},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0x26'),'keyType':'variable','keyContent':'','variableName':_0x43c8('0x27')},{'type':_0x43c8('0xd'),'content':'','key':_0x43c8('0x28'),'keyType':_0x43c8('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x397f64;}; \ No newline at end of file +var _0x4f6a=['duration','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','calleridnum','outbound','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','Hold\x20Time','holdtime','talktime','Answer\x20Time','answertime','Complete\x20Time','endtime'];(function(_0x331227,_0x277f7e){var _0x32d1c1=function(_0xed0476){while(--_0xed0476){_0x331227['push'](_0x331227['shift']());}};_0x32d1c1(++_0x277f7e);}(_0x4f6a,0x131));var _0xa4f6=function(_0xc2c353,_0x41a5a3){_0xc2c353=_0xc2c353-0x0;var _0x806605=_0x4f6a[_0xc2c353];return _0x806605;};'use strict';exports[_0xa4f6('0x0')]=function(_0x5c9144,_0x2fa24f){var _0x3d27fc=[{'type':_0xa4f6('0x1'),'content':_0xa4f6('0x2'),'variableName':null}];switch(_0x5c9144[_0xa4f6('0x3')]()){case _0xa4f6('0x4'):switch(_0x2fa24f[_0xa4f6('0x3')]()){case _0xa4f6('0x5'):_0x3d27fc['push']({'type':_0xa4f6('0x6'),'content':'','variableName':_0xa4f6('0x7')});_0x3d27fc[_0xa4f6('0x8')]({'type':_0xa4f6('0x6'),'content':'','variableName':_0xa4f6('0x9')});break;case _0xa4f6('0xa'):_0x3d27fc[_0xa4f6('0x8')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x3d27fc['push']({'type':_0xa4f6('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x3d27fc;};exports[_0xa4f6('0xb')]=function(_0x3d3349,_0x598bc5){var _0x34d08c=[];switch(_0x3d3349[_0xa4f6('0x3')]()){case _0xa4f6('0x4'):switch(_0x598bc5[_0xa4f6('0x3')]()){case'inbound':_0x34d08c=[{'type':_0xa4f6('0x1'),'content':_0xa4f6('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0xe'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x9')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0xf'),'keyType':_0xa4f6('0x6'),'variableName':'calleridname'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x10'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x11')},{'type':'keyValue','content':'','key':'Queue','keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x7')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x12'),'keyType':_0xa4f6('0x6'),'variableName':'uniqueid'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x13'),'keyType':'variable','variableName':_0xa4f6('0x14')},{'type':_0xa4f6('0x1'),'content':_0xa4f6('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xa4f6('0x16'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x17')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x18'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x19')},{'type':_0xa4f6('0x1'),'content':_0xa4f6('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x1b'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x14')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x1c'),'keyType':'variable','variableName':'agentconnectAt'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x1d'),'keyType':_0xa4f6('0x6'),'variableName':'agentcompleteAt'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x1e'),'keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x1f')},{'type':_0xa4f6('0xd'),'content':'','key':'Talk\x20Time','keyType':_0xa4f6('0x6'),'variableName':_0xa4f6('0x20')}];break;case'outbound':_0x34d08c=[{'type':_0xa4f6('0x1'),'content':_0xa4f6('0xc'),'variableName':null},{'type':_0xa4f6('0xd'),'content':'','key':'Called\x20Number','keyType':_0xa4f6('0x6'),'keyContent':'','variableName':_0xa4f6('0x19')},{'type':_0xa4f6('0xd'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x12'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x13'),'keyType':_0xa4f6('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0xa4f6('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x21'),'keyType':'variable','keyContent':'','variableName':_0xa4f6('0x22')},{'type':_0xa4f6('0xd'),'content':'','key':_0xa4f6('0x23'),'keyType':'variable','keyContent':'','variableName':_0xa4f6('0x24')},{'type':_0xa4f6('0xd'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0xa4f6('0x25')},{'type':_0xa4f6('0xd'),'content':'','key':'Billable\x20Time','keyType':_0xa4f6('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x34d08c;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index b9fcb5f..2228417 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 _0xf300=['../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','then','update','error','user','query','body','omit','html','phone','mobile','lodash'];(function(_0x3f7e8b,_0x7291d1){var _0x4eb892=function(_0x4ed54e){while(--_0x4ed54e){_0x3f7e8b['push'](_0x3f7e8b['shift']());}};_0x4eb892(++_0x7291d1);}(_0xf300,0xbc));var _0x0f30=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0xf300[_0x5447aa];return _0xb21e53;};'use strict';var _=require(_0x0f30('0x0'));var db=require(_0x0f30('0x1'))['db'];var loggers={'openchannel':require(_0x0f30('0x2'))(_0x0f30('0x3')),'mail':require(_0x0f30('0x2'))(_0x0f30('0x4')),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x0f30('0x2'))(_0x0f30('0x5')),'whatsapp':require(_0x0f30('0x2'))(_0x0f30('0x6'))};function getInteractionId(_0x1a807a,_0xd09327,_0x33c939){if(_0x1a807a&&_0x1a807a[_[_0x0f30('0x7')](_0x33c939)+'InteractionId']){return _0x1a807a[_[_0x0f30('0x7')](_0x33c939)+_0x0f30('0x8')];}else if(_0x1a807a&&_0x1a807a['id']){return _0x1a807a['id'];}else if(_0xd09327&&_0xd09327['id']){return _0xd09327['id'];}else{return _0x0f30('0x9');}}function log(_0x289300,_0x52bc54,_0xbef7ef,_0x5f3360,_0x493270,_0x511a5c){loggers[_0x493270[_0x0f30('0xa')]()][_0x289300](_0x0f30('0xb'),_0x511a5c[_0x0f30('0xc')](),_0x52bc54?_0x52bc54['id']:null,_0x52bc54?_0x52bc54[_0x0f30('0xd')]:null,_0x52bc54?_0x52bc54[_0x0f30('0xe')]:null,getInteractionId(_0xbef7ef,_0x5f3360,_0x493270),_0xbef7ef?JSON[_0x0f30('0xf')](_0xbef7ef):'null');}function updateUser(_0x35ad83,_0x55c753,_0x3267a5,_0x27cc73,_0xc09dc5){db[_[_0x0f30('0x7')](_0x27cc73)+_0x0f30('0x10')]['findOne']({'where':{'id':getInteractionId(_0x55c753,_0x3267a5,_0x27cc73)}})[_0x0f30('0x11')](function(_0x307910){if(_0x307910){return _0x307910[_0x0f30('0x12')]({'UserId':_0x35ad83?_0x35ad83['id']:null});}})[_0x0f30('0x11')](function(_0x2a3ed3){if(_0x2a3ed3){log('info',_0x35ad83,_0x55c753,_0x3267a5,_0x27cc73,_0xc09dc5);}})['catch'](function(){log(_0x0f30('0x13'),_0x35ad83,_0x55c753,_0x3267a5,_0x27cc73,_0xc09dc5);});}exports['tracked']=function(_0x4a0ba0,_0x285f2d){return function(_0x1726d7,_0x2366a1,_0x56a7f0){var _0x209648=_0x1726d7[_0x0f30('0x14')];var _0x3751ac={};var _0x26fe7d=_0x1726d7[_0x0f30('0x15')];if(_0x3751ac){_0x3751ac=_['clone'](_0x1726d7[_0x0f30('0x16')]);_0x3751ac=_[_0x0f30('0x17')](_0x3751ac,['body',_0x0f30('0x18'),_0x0f30('0x19'),'fax',_0x0f30('0x1a')]);}updateUser(_0x209648,_0x3751ac,_0x26fe7d,_0x4a0ba0,_0x285f2d);_0x56a7f0(null);};}; \ No newline at end of file +var _0xec62=['../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','Interaction','findOne','then','update','info','catch','error','user','query','clone','omit','body','html','phone','fax','lodash'];(function(_0x4f35eb,_0x26ce78){var _0x3a6459=function(_0x32afef){while(--_0x32afef){_0x4f35eb['push'](_0x4f35eb['shift']());}};_0x3a6459(++_0x26ce78);}(_0xec62,0x1b2));var _0x2ec6=function(_0x527ce8,_0x122695){_0x527ce8=_0x527ce8-0x0;var _0x2a8a56=_0xec62[_0x527ce8];return _0x2a8a56;};'use strict';var _=require(_0x2ec6('0x0'));var db=require(_0x2ec6('0x1'))['db'];var loggers={'openchannel':require(_0x2ec6('0x2'))(_0x2ec6('0x3')),'mail':require('../../config/logger')(_0x2ec6('0x4')),'fax':require(_0x2ec6('0x2'))('fax-interactions'),'sms':require(_0x2ec6('0x2'))('sms-interactions'),'chat':require(_0x2ec6('0x2'))(_0x2ec6('0x5')),'whatsapp':require(_0x2ec6('0x2'))(_0x2ec6('0x6'))};function getInteractionId(_0x4410f8,_0x5c3503,_0x50fd08){if(_0x4410f8&&_0x4410f8[_[_0x2ec6('0x7')](_0x50fd08)+_0x2ec6('0x8')]){return _0x4410f8[_[_0x2ec6('0x7')](_0x50fd08)+_0x2ec6('0x8')];}else if(_0x4410f8&&_0x4410f8['id']){return _0x4410f8['id'];}else if(_0x5c3503&&_0x5c3503['id']){return _0x5c3503['id'];}else{return _0x2ec6('0x9');}}function log(_0x19fdda,_0x8f59d2,_0x4adf12,_0xc09ed6,_0x4eee5f,_0x9dec53){loggers[_0x4eee5f['toLowerCase']()][_0x19fdda](_0x2ec6('0xa'),_0x9dec53[_0x2ec6('0xb')](),_0x8f59d2?_0x8f59d2['id']:null,_0x8f59d2?_0x8f59d2[_0x2ec6('0xc')]:null,_0x8f59d2?_0x8f59d2[_0x2ec6('0xd')]:null,getInteractionId(_0x4adf12,_0xc09ed6,_0x4eee5f),_0x4adf12?JSON['stringify'](_0x4adf12):'null');}function updateUser(_0x398515,_0x485060,_0x31bfc1,_0x2f33bd,_0x25bf61){db[_[_0x2ec6('0x7')](_0x2f33bd)+_0x2ec6('0xe')][_0x2ec6('0xf')]({'where':{'id':getInteractionId(_0x485060,_0x31bfc1,_0x2f33bd)}})[_0x2ec6('0x10')](function(_0x40c619){if(_0x40c619){return _0x40c619[_0x2ec6('0x11')]({'UserId':_0x398515?_0x398515['id']:null});}})[_0x2ec6('0x10')](function(_0x5d4b96){if(_0x5d4b96){log(_0x2ec6('0x12'),_0x398515,_0x485060,_0x31bfc1,_0x2f33bd,_0x25bf61);}})[_0x2ec6('0x13')](function(){log(_0x2ec6('0x14'),_0x398515,_0x485060,_0x31bfc1,_0x2f33bd,_0x25bf61);});}exports['tracked']=function(_0x5067f5,_0x482216){return function(_0x15d896,_0x1a25de,_0xf57655){var _0x11e4d4=_0x15d896[_0x2ec6('0x15')];var _0x4d4a29={};var _0x43805c=_0x15d896[_0x2ec6('0x16')];if(_0x4d4a29){_0x4d4a29=_[_0x2ec6('0x17')](_0x15d896['body']);_0x4d4a29=_[_0x2ec6('0x18')](_0x4d4a29,[_0x2ec6('0x19'),_0x2ec6('0x1a'),_0x2ec6('0x1b'),_0x2ec6('0x1c'),'mobile']);}updateUser(_0x11e4d4,_0x4d4a29,_0x43805c,_0x5067f5,_0x482216);_0xf57655(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 843450e..0e12b45 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 _0x15b1=['data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','License','findOne','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','../../mysqldb'];(function(_0x3304e1,_0x281b74){var _0x1435d9=function(_0x1d532c){while(--_0x1d532c){_0x3304e1['push'](_0x3304e1['shift']());}};_0x1435d9(++_0x281b74);}(_0x15b1,0x132));var _0x115b=function(_0x219627,_0x39c708){_0x219627=_0x219627-0x0;var _0x54f619=_0x15b1[_0x219627];return _0x54f619;};'use strict';var crypto=require('crypto');var util=require(_0x115b('0x0'));var compose=require('composable-middleware');var db=require(_0x115b('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x13a4e5,_0x3e8990){if(_0x13a4e5&&_0x3e8990){if(_0x3e8990[_0x115b('0x2')]&&_0x3e8990[_0x115b('0x3')]){var _0xea32d6=_0x3e8990[_0x115b('0x2')];var _0x1c6a69=_0x3e8990[_0x115b('0x3')];var _0x4fa411=_0xea32d6[_0x115b('0x4')]('-')[0x4];var _0x4aeac1=_0xea32d6[_0x115b('0x4')]('-')[0x0];var _0x4860ab=crypto[_0x115b('0x5')](_0x115b('0x6'),util['format'](_0x115b('0x7'),_0x4fa411,_0xea32d6,_0x4aeac1));var _0x113751=_0x4860ab[_0x115b('0x8')](_0x1c6a69,_0x115b('0x9'),'utf8');_0x113751+=_0x4860ab[_0x115b('0xa')](_0x115b('0xb'));var _0x31fd61=JSON[_0x115b('0xc')](_0x113751);return _0x31fd61[_0x115b('0xd')](_0x13a4e5)?_0x31fd61[_0x13a4e5]:null;}}return null;}function isLimit(_0x38463d,_0x40d822,_0x42a35d,_0x1fd7c0){var _0x52742f=_0x40d822;return compose()[_0x115b('0xe')](function(_0x2a5d46,_0x4a2ca,_0x55b610){return db[_0x115b('0xf')][_0x115b('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x115b('0x11')](function(_0x5b1cb9){var _0x2f5672=getValueFromLicense(_0x38463d,_0x5b1cb9);return _0x2f5672?_0x2f5672:_0x52742f;})[_0x115b('0x11')](function(_0x5e81e8){_0x52742f=_0x5e81e8;return _0x42a35d['count'](_0x1fd7c0);})[_0x115b('0x11')](function(_0x1af8da){if(_0x1af8da>=_0x52742f){return _0x4a2ca[_0x115b('0x12')](0x193)[_0x115b('0x13')]({'message':util[_0x115b('0x14')](_0x115b('0x15'),_0x38463d)});}_0x55b610();})[_0x115b('0x16')](function(_0x562266){_0x55b610(_0x562266);});});}function isUserLimit(){return isLimit(_0x115b('0x17'),0x1,db[_0x115b('0x18')],{'where':{'$or':[{'role':_0x115b('0x19')},{'role':_0x115b('0x1a')}]}});}exports[_0x115b('0x1b')]=isUserLimit; \ No newline at end of file +var _0xd9f2=['update','base64','utf8','final','parse','License','then','count','status','catch','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','license','data1','split','createDecipher','format'];(function(_0x43a93f,_0xe5b6fe){var _0xa74555=function(_0x20fa13){while(--_0x20fa13){_0x43a93f['push'](_0x43a93f['shift']());}};_0xa74555(++_0xe5b6fe);}(_0xd9f2,0xaf));var _0x2d9f=function(_0xe04fc9,_0xec1021){_0xe04fc9=_0xe04fc9-0x0;var _0x53cd1a=_0xd9f2[_0xe04fc9];return _0x53cd1a;};'use strict';var crypto=require(_0x2d9f('0x0'));var util=require(_0x2d9f('0x1'));var compose=require(_0x2d9f('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x2d9f('0x3'));function getValueFromLicense(_0x48fe9e,_0x3f569a){if(_0x48fe9e&&_0x3f569a){if(_0x3f569a['data1']&&_0x3f569a[_0x2d9f('0x4')]){var _0x4cc83d=_0x3f569a[_0x2d9f('0x5')];var _0x14b9a3=_0x3f569a[_0x2d9f('0x4')];var _0x490db3=_0x4cc83d[_0x2d9f('0x6')]('-')[0x4];var _0x5e7c19=_0x4cc83d['split']('-')[0x0];var _0x5a627b=crypto[_0x2d9f('0x7')]('aes-256-ctr',util[_0x2d9f('0x8')]('%s:%s:%s',_0x490db3,_0x4cc83d,_0x5e7c19));var _0x77ad30=_0x5a627b[_0x2d9f('0x9')](_0x14b9a3,_0x2d9f('0xa'),_0x2d9f('0xb'));_0x77ad30+=_0x5a627b[_0x2d9f('0xc')]('utf8');var _0xee3743=JSON[_0x2d9f('0xd')](_0x77ad30);return _0xee3743['hasOwnProperty'](_0x48fe9e)?_0xee3743[_0x48fe9e]:null;}}return null;}function isLimit(_0x4f3c08,_0xafbdc2,_0x92c7cf,_0x27c6e3){var _0x3c9db6=_0xafbdc2;return compose()['use'](function(_0x22e888,_0x233d94,_0x3c5116){return db[_0x2d9f('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x2d9f('0xf')](function(_0x238413){var _0x3eebdb=getValueFromLicense(_0x4f3c08,_0x238413);return _0x3eebdb?_0x3eebdb:_0x3c9db6;})['then'](function(_0x8df73c){_0x3c9db6=_0x8df73c;return _0x92c7cf[_0x2d9f('0x10')](_0x27c6e3);})[_0x2d9f('0xf')](function(_0x431ab2){if(_0x431ab2>=_0x3c9db6){return _0x233d94[_0x2d9f('0x11')](0x193)['json']({'message':util[_0x2d9f('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x4f3c08)});}_0x3c5116();})[_0x2d9f('0x12')](function(_0x1ea83b){_0x3c5116(_0x1ea83b);});});}function isUserLimit(){return isLimit(_0x2d9f('0x13'),0x1,db['User'],{'where':{'$or':[{'role':_0x2d9f('0x14')},{'role':_0x2d9f('0x15')}]}});}exports[_0x2d9f('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d9ad220..209d4b9 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 _0x682f=['$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','DATE','utcOffset','hours','seconds','lodash','parseSearch','sqlOperator','and','replace','[$and]','[$or]','split','length','slice','forEach','shift','filter','indexOf','map','conditions','push','operator','$eq','$between','value','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x682f,0xb3));var _0xf682=function(_0x4c991a,_0x846098){_0x4c991a=_0x4c991a-0x0;var _0x13f838=_0x682f[_0x4c991a];return _0x13f838;};'use strict';var _=require(_0xf682('0x0'));var moment=require('moment');exports[_0xf682('0x1')]=function(_0x1b2644){var _0x13147d={'conditions':[]};_0x13147d[_0xf682('0x2')]=_['startsWith'](_0x1b2644,'[$or]')?'or':_0xf682('0x3');var _0x51c1f5=_0x1b2644[_0xf682('0x4')](_0xf682('0x5'),'')[_0xf682('0x4')](_0xf682('0x6'),'')[_0xf682('0x7')]('||');for(var _0x18a0fb=0x0;_0x18a0fb<_0x51c1f5[_0xf682('0x8')];_0x18a0fb++){var _0x45badb=_0x51c1f5[_0x18a0fb][_0xf682('0x7')](':=');var _0x23b195=_0x45badb[0x0];var _0x4ce8da=_0x45badb[_0xf682('0x9')](0x1);_0x4ce8da[_0xf682('0xa')](function(_0x4023c4){var _0x260169=_0x4023c4[_0xf682('0x7')]('[')[_0xf682('0xb')]();var _0x39d4e6=_0x4023c4['match'](/\[(.*?)\]/g);_0x39d4e6[_0xf682('0xa')](function(_0x2369f0){var _0x3ed311=_0x2369f0[_0xf682('0x7')]('[')[_0xf682('0xc')](function(_0x4eeb33){return _0x4eeb33[_0xf682('0xd')](']')>-0x1;})[_0xf682('0xe')](function(_0xb57c2f){return _0xb57c2f[_0xf682('0x7')](']')[0x0];})[0x0];_0x13147d[_0xf682('0xf')][_0xf682('0x10')]({'field':_0x23b195,'operator':_0x260169,'value':_0x3ed311});});});}return _0x13147d;};exports['buildExpression']=function(_0x4de028,_0x783dd8,_0x36149a){var _0x2489f2={};if(_0x783dd8==='DATE'){if(_0x36149a[_0xf682('0x11')]===_0xf682('0x12')){_0x36149a[_0xf682('0x11')]=_0xf682('0x13');_0x36149a[_0xf682('0x14')]+=','+_0x36149a[_0xf682('0x14')];}else if(_['includes'](['$gt',_0xf682('0x15')],_0x36149a[_0xf682('0x11')])){_0x36149a[_0xf682('0x14')]=moment(_0x36149a[_0xf682('0x14')])[_0xf682('0x16')](0x1,_0xf682('0x17'))[_0xf682('0x18')](_0xf682('0x19'));}}if(_0x36149a[_0xf682('0x1a')]){_0x783dd8=_0x36149a[_0xf682('0x1a')];_0x2489f2[_0xf682('0x1b')]=_0xf682('0x1c')+_0x4de028+'.'+_0x36149a[_0xf682('0x1d')]+_0xf682('0x1e')+_0x36149a[_0xf682('0x1a')]+')\x20'+parseOperator(_0x36149a[_0xf682('0x11')]);}else{_0x2489f2[_0xf682('0x1b')]=_0x4de028+'.'+_0x36149a[_0xf682('0x1d')]+'\x20'+parseOperator(_0x36149a[_0xf682('0x11')]);}if(_['includes'](['$ne',_0xf682('0x1f')],_0x36149a[_0xf682('0x11')]))_0x2489f2['text']='('+_0x2489f2[_0xf682('0x1b')]+_0xf682('0x20')+_0x4de028+'.'+_0x36149a[_0xf682('0x1d')]+_0xf682('0x21');_0x2489f2[_0xf682('0x14')]=parseValue(_0x783dd8,_0x36149a[_0xf682('0x11')],_0x36149a['value']);return _0x2489f2;};function parseOperator(_0x4a8a4a){var _0x23fa90;switch(_0x4a8a4a){case _0xf682('0x22'):_0x23fa90=_0xf682('0x23');break;case _0xf682('0x1f'):_0x23fa90=_0xf682('0x24');break;case _0xf682('0x12'):_0x23fa90='=\x20?';break;case _0xf682('0x25'):_0x23fa90=_0xf682('0x26');break;case _0xf682('0x27'):case _0xf682('0x28'):case'$endsWith':_0x23fa90=_0xf682('0x29');break;case _0xf682('0x2a'):_0x23fa90='<\x20?';break;case'$gt':_0x23fa90=_0xf682('0x2b');break;case _0xf682('0x15'):_0x23fa90=_0xf682('0x2c');break;case _0xf682('0x2d'):_0x23fa90=_0xf682('0x2e');break;case _0xf682('0x13'):_0x23fa90=_0xf682('0x2f');break;}return _0x23fa90;}function parseValue(_0x389dec,_0x325f06,_0x4d36bb){var _0x361bcc={'start':undefined,'end':undefined};switch(_0x325f06){case _0xf682('0x22'):case'$notIn':_0x361bcc['start']=_0x4d36bb['split'](',');break;case _0xf682('0x27'):_0x361bcc[_0xf682('0x30')]='%'+_0x4d36bb+'%';break;case'$startsWith':_0x361bcc['start']=_0x4d36bb+'%';break;case _0xf682('0x31'):_0x361bcc[_0xf682('0x30')]='%'+_0x4d36bb;break;case _0xf682('0x13'):var _0x537bea=_0x4d36bb[_0xf682('0x7')](',');var _0x4d36bb=_0x537bea[_0xf682('0xb')]();var _0xbf8318=_0x537bea['pop']();if(_0x389dec===_0xf682('0x32')){_0x4d36bb=moment(_0x4d36bb)[_0xf682('0x33')](0x0,!![])[_0xf682('0x18')]();_0xbf8318=moment(_0xbf8318)[_0xf682('0x33')](0x0,!![])[_0xf682('0x16')](0x17,_0xf682('0x34'))[_0xf682('0x16')](0x3b,'minutes')[_0xf682('0x16')](0x3b,_0xf682('0x35'))[_0xf682('0x18')]();}_0x361bcc={'start':_0x4d36bb,'end':_0xbf8318};break;default:_0x361bcc[_0xf682('0x30')]=_0x4d36bb;break;}return _0x361bcc;} \ No newline at end of file +var _0xcf95=['DATE','operator','$eq','value','includes','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','split','length','forEach','shift','filter','map'];(function(_0x2a7176,_0x4f2ab7){var _0x246252=function(_0xf3bcd6){while(--_0xf3bcd6){_0x2a7176['push'](_0x2a7176['shift']());}};_0x246252(++_0x4f2ab7);}(_0xcf95,0x193));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5cf9('0x0'));var moment=require(_0x5cf9('0x1'));exports[_0x5cf9('0x2')]=function(_0x14f4b5){var _0x16c62f={'conditions':[]};_0x16c62f[_0x5cf9('0x3')]=_['startsWith'](_0x14f4b5,_0x5cf9('0x4'))?'or':_0x5cf9('0x5');var _0x5e7952=_0x14f4b5['replace']('[$and]','')[_0x5cf9('0x6')]('[$or]','')[_0x5cf9('0x7')]('||');for(var _0x49b99e=0x0;_0x49b99e<_0x5e7952[_0x5cf9('0x8')];_0x49b99e++){var _0x487886=_0x5e7952[_0x49b99e][_0x5cf9('0x7')](':=');var _0x105bec=_0x487886[0x0];var _0x4af8c6=_0x487886['slice'](0x1);_0x4af8c6[_0x5cf9('0x9')](function(_0x56787f){var _0x450817=_0x56787f['split']('[')[_0x5cf9('0xa')]();var _0x44d0fd=_0x56787f['match'](/\[(.*?)\]/g);_0x44d0fd[_0x5cf9('0x9')](function(_0x11c17f){var _0x16d1ed=_0x11c17f[_0x5cf9('0x7')]('[')[_0x5cf9('0xb')](function(_0x3bd4d6){return _0x3bd4d6['indexOf'](']')>-0x1;})[_0x5cf9('0xc')](function(_0x5e580a){return _0x5e580a[_0x5cf9('0x7')](']')[0x0];})[0x0];_0x16c62f['conditions']['push']({'field':_0x105bec,'operator':_0x450817,'value':_0x16d1ed});});});}return _0x16c62f;};exports['buildExpression']=function(_0x380a65,_0x4d5466,_0x5a692e){var _0x31928f={};if(_0x4d5466===_0x5cf9('0xd')){if(_0x5a692e[_0x5cf9('0xe')]===_0x5cf9('0xf')){_0x5a692e[_0x5cf9('0xe')]='$between';_0x5a692e[_0x5cf9('0x10')]+=','+_0x5a692e[_0x5cf9('0x10')];}else if(_[_0x5cf9('0x11')](['$gt',_0x5cf9('0x12')],_0x5a692e[_0x5cf9('0xe')])){_0x5a692e[_0x5cf9('0x10')]=moment(_0x5a692e[_0x5cf9('0x10')])[_0x5cf9('0x13')](0x1,_0x5cf9('0x14'))[_0x5cf9('0x15')]('YYYY-MM-DD');}}if(_0x5a692e[_0x5cf9('0x16')]){_0x4d5466=_0x5a692e[_0x5cf9('0x16')];_0x31928f[_0x5cf9('0x17')]=_0x5cf9('0x18')+_0x380a65+'.'+_0x5a692e[_0x5cf9('0x19')]+_0x5cf9('0x1a')+_0x5a692e[_0x5cf9('0x16')]+')\x20'+parseOperator(_0x5a692e['operator']);}else{_0x31928f[_0x5cf9('0x17')]=_0x380a65+'.'+_0x5a692e[_0x5cf9('0x19')]+'\x20'+parseOperator(_0x5a692e[_0x5cf9('0xe')]);}if(_[_0x5cf9('0x11')]([_0x5cf9('0x1b'),_0x5cf9('0x1c')],_0x5a692e[_0x5cf9('0xe')]))_0x31928f[_0x5cf9('0x17')]='('+_0x31928f['text']+_0x5cf9('0x1d')+_0x380a65+'.'+_0x5a692e[_0x5cf9('0x19')]+_0x5cf9('0x1e');_0x31928f[_0x5cf9('0x10')]=parseValue(_0x4d5466,_0x5a692e['operator'],_0x5a692e[_0x5cf9('0x10')]);return _0x31928f;};function parseOperator(_0x4e00cf){var _0x59fe7e;switch(_0x4e00cf){case _0x5cf9('0x1f'):_0x59fe7e=_0x5cf9('0x20');break;case _0x5cf9('0x1c'):_0x59fe7e='NOT\x20IN\x20?';break;case _0x5cf9('0xf'):_0x59fe7e=_0x5cf9('0x21');break;case _0x5cf9('0x1b'):_0x59fe7e=_0x5cf9('0x22');break;case _0x5cf9('0x23'):case'$startsWith':case _0x5cf9('0x24'):_0x59fe7e=_0x5cf9('0x25');break;case _0x5cf9('0x26'):_0x59fe7e=_0x5cf9('0x27');break;case _0x5cf9('0x28'):_0x59fe7e=_0x5cf9('0x29');break;case'$lte':_0x59fe7e=_0x5cf9('0x2a');break;case _0x5cf9('0x2b'):_0x59fe7e='>=\x20?';break;case _0x5cf9('0x2c'):_0x59fe7e=_0x5cf9('0x2d');break;}return _0x59fe7e;}function parseValue(_0xd7fb96,_0x1d48c8,_0x12075e){var _0x1810df={'start':undefined,'end':undefined};switch(_0x1d48c8){case'$in':case _0x5cf9('0x1c'):_0x1810df[_0x5cf9('0x2e')]=_0x12075e[_0x5cf9('0x7')](',');break;case _0x5cf9('0x23'):_0x1810df[_0x5cf9('0x2e')]='%'+_0x12075e+'%';break;case _0x5cf9('0x2f'):_0x1810df[_0x5cf9('0x2e')]=_0x12075e+'%';break;case _0x5cf9('0x24'):_0x1810df[_0x5cf9('0x2e')]='%'+_0x12075e;break;case _0x5cf9('0x2c'):var _0x45a9c6=_0x12075e['split'](',');var _0x12075e=_0x45a9c6[_0x5cf9('0xa')]();var _0x150561=_0x45a9c6[_0x5cf9('0x30')]();if(_0xd7fb96===_0x5cf9('0xd')){_0x12075e=moment(_0x12075e)['utcOffset'](0x0,!![])[_0x5cf9('0x15')]();_0x150561=moment(_0x150561)['utcOffset'](0x0,!![])[_0x5cf9('0x13')](0x17,_0x5cf9('0x31'))[_0x5cf9('0x13')](0x3b,_0x5cf9('0x32'))[_0x5cf9('0x13')](0x3b,_0x5cf9('0x33'))['format']();}_0x1810df={'start':_0x12075e,'end':_0x150561};break;default:_0x1810df[_0x5cf9('0x2e')]=_0x12075e;break;}return _0x1810df;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e9770e8..e3bf089 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 _0xc891=['type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','subtract','name','isArray','limit','offset','sort','map','col','unsigned','substr','DESC','priority','cast','ASC','omit','isEmpty','isObject','isString','length','unset','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','join','getOptions','query','$id','model','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','split','forOwn','find'];(function(_0x51cf77,_0x1a1fd6){var _0x122145=function(_0xe4020e){while(--_0xe4020e){_0x51cf77['push'](_0x51cf77['shift']());}};_0x122145(++_0x1a1fd6);}(_0xc891,0xe3));var _0x1c89=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xc891[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x1c89('0x0'));var sequelize=require(_0x1c89('0x1'));var moment=require(_0x1c89('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1f17ef){var _0x54b8fe=['ne'];try{var _0x580a67=JSON[_0x1c89('0x3')](_0x1f17ef);var _0x101a6d=Object[_0x1c89('0x4')](_0x580a67)[0x0];return _0x54b8fe[_0x1c89('0x5')](_0x101a6d);}catch(_0x3ee737){return![];}}function getOperatorValue(_0x3412fa){var _0x1d6755=JSON[_0x1c89('0x3')](_0x3412fa);var _0x34a53a=Object[_0x1c89('0x4')](_0x1d6755)[0x0];var _0x5f11cb=_0x1d6755[_0x34a53a];return{['$'+_0x34a53a]:_0x5f11cb};}exports['fields']=function(_0xa38577){var _0x3a6913=null;if(_0xa38577){_0x3a6913=_0xa38577[_0x1c89('0x6')](',');}return _0x3a6913;};exports['filters']=function(_0x25f270,_0x31d85f){var _0x2b5a58={};if(!_['isEmpty'](_0x25f270)){_[_0x1c89('0x7')](_0x25f270,function(_0x480c92,_0x13e637){try{if(_0x31d85f){var _0x57c8fd=_[_0x1c89('0x8')](_0x31d85f,{'name':_0x13e637})||{};if(hasSequelizeOperator(_0x480c92)){_0x2b5a58[_0x13e637]=getOperatorValue(_0x480c92);}else if(_0x57c8fd[_0x1c89('0x9')]===_0x1c89('0xa')&&_[_0x1c89('0xb')](_0x480c92)){var _0xd33258=JSON[_0x1c89('0x3')](_0x480c92);var _0x3aad94={'$gte':moment(moment(_0xd33258[_0x1c89('0xc')])[_0x1c89('0xd')](_0x1c89('0xe')))['utc']()[_0x1c89('0xd')](),'$lte':moment(moment(_0xd33258[_0x1c89('0xf')])[_0x1c89('0xd')]('YYYY-MM-DD'))['utc']()[_0x1c89('0x10')](0x1,'s')['format']()};_0x2b5a58[_0x13e637]=_0x3aad94;}else if(_0x57c8fd[_0x1c89('0x11')]==='uniqueid'){_0x2b5a58[_0x13e637]=_0x480c92;}else{_0x2b5a58[_0x13e637]=_[_0x1c89('0x12')](_0x480c92)?_0x480c92:JSON[_0x1c89('0x3')](_0x480c92);}}else{_0x2b5a58[_0x13e637]=_['isArray'](_0x480c92)?_0x480c92:JSON[_0x1c89('0x3')](_0x480c92);}}catch(_0x58cabd){_0x2b5a58[_0x13e637]=_0x480c92[_0x1c89('0x6')](',');}});}return _0x2b5a58;};exports[_0x1c89('0x13')]=function(_0x4ab72d){_0x4ab72d=parseInt(_0x4ab72d,0xa);if(!_0x4ab72d||_0x4ab72d<0x0){_0x4ab72d=LIMIT_VALUE;}return _0x4ab72d;};exports[_0x1c89('0x14')]=function(_0x15c20e){_0x15c20e=parseInt(_0x15c20e,0xa);if(!_0x15c20e||_0x15c20e<0x0){_0x15c20e=0x0;}return _0x15c20e;};exports[_0x1c89('0x15')]=function(_0x2c8586){var _0x3c447b,_0x584679=null;if(_0x2c8586){_0x3c447b=_0x2c8586[_0x1c89('0x6')](',');_0x584679=_[_0x1c89('0x16')](_0x3c447b,function(_0x705ccd){if(_0x705ccd['indexOf']('-')===0x0){return[_0x705ccd==='priority'?sequelize['cast'](sequelize[_0x1c89('0x17')]('priority'),_0x1c89('0x18')):_0x705ccd[_0x1c89('0x19')](0x1),_0x1c89('0x1a')];}else{return[_0x705ccd===_0x1c89('0x1b')?sequelize[_0x1c89('0x1c')](sequelize[_0x1c89('0x17')](_0x1c89('0x1b')),'unsigned'):_0x705ccd,_0x1c89('0x1d')];}});}return _0x584679;};exports[_0x1c89('0x1e')]=function(_0x4d4186,_0x2a1d24){if(_[_0x1c89('0x1f')](_0x4d4186)){return _0x4d4186;}if(_[_0x1c89('0x12')](_0x4d4186)){for(var _0x4a838e=0x0;_0x4a838e<_0x4d4186['length'];_0x4a838e+=0x1){_0x4d4186[_0x4a838e]=this[_0x1c89('0x1e')](_0x4d4186[_0x4a838e],_0x2a1d24);}return _0x4d4186;}if(!_[_0x1c89('0x20')](_0x4d4186)){return _0x4d4186;}if(_[_0x1c89('0x21')](_0x2a1d24)){_0x2a1d24=[_0x2a1d24];}if(!_['isArray'](_0x2a1d24)){return _0x4d4186;}for(var _0x2ab007=0x0;_0x2ab007<_0x2a1d24[_0x1c89('0x22')];_0x2ab007+=0x1){_[_0x1c89('0x23')](_0x4d4186,_0x2a1d24[_0x2ab007]);}for(var _0x5de3a6 in _0x4d4186){if(_0x4d4186['hasOwnProperty'](_0x5de3a6)){_0x4d4186[_0x5de3a6]=this[_0x1c89('0x1e')](_0x4d4186[_0x5de3a6],_0x2a1d24);}}return _0x4d4186;};exports['isNumeric']=function(_0x21cc0b){return _0x21cc0b[_0x1c89('0x24')](RegExp(_0x1c89('0x25')))?!![]:![];};exports[_0x1c89('0x26')]=function(_0x24c6da){return _0x24c6da[_0x1c89('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x1c89('0x27')]=function(_0x529168){var _0x73ee63=[];_0x529168[_0x1c89('0x6')](/[ ,]+/)[_0x1c89('0x28')](function(_0x465543){_0x465543=_0x465543['replace'](/([^:]")"+/g,'$1');_0x465543='+'+_0x465543+'*';if(_0x465543[_0x1c89('0x5')]('@'))_0x465543='\x22'+_0x465543+'\x22';_0x73ee63['push'](_0x465543);});return _0x73ee63[_0x1c89('0x29')]('\x20');};exports[_0x1c89('0x2a')]=function(_0x42ed3c,_0x38b7b3,_0xc30108){var _0x417403={},_0xeb578e={};if(_0x38b7b3[_0x1c89('0x2b')][_0x1c89('0x2c')]){_0x38b7b3['query']['id']=_0x38b7b3[_0x1c89('0x2b')][_0x1c89('0x2c')];delete _0x38b7b3[_0x1c89('0x2b')][_0x1c89('0x2c')];}_0x417403[_0x1c89('0x2d')]=_['map'](_0x42ed3c,'name');_0x417403['query']=_['keys'](_0x38b7b3[_0x1c89('0x2b')]);_0x417403[_0x1c89('0x2e')]=_[_0x1c89('0x2f')](_0x417403['model'],_0x417403[_0x1c89('0x2b')]);_0xeb578e['attributes']=_[_0x1c89('0x2f')](_0x417403[_0x1c89('0x2d')],this[_0x1c89('0x30')](_0x38b7b3['query'][_0x1c89('0x30')]));_0xeb578e['attributes']=_0xeb578e[_0x1c89('0x31')][_0x1c89('0x22')]?_0xeb578e[_0x1c89('0x31')]:_0x417403[_0x1c89('0x2d')];if(!_0x38b7b3[_0x1c89('0x2b')][_0x1c89('0x32')](_0x1c89('0x33'))){_0xeb578e['limit']=this[_0x1c89('0x13')](_0x38b7b3[_0x1c89('0x2b')][_0x1c89('0x13')]);_0xeb578e[_0x1c89('0x14')]=this[_0x1c89('0x14')](_0x38b7b3['query'][_0x1c89('0x14')]);}_0xeb578e['order']=this[_0x1c89('0x15')](_0x38b7b3[_0x1c89('0x2b')][_0x1c89('0x15')]);_0xeb578e[_0x1c89('0x34')]=this[_0x1c89('0x2e')](_[_0x1c89('0x35')](_0x38b7b3[_0x1c89('0x2b')],_0x417403[_0x1c89('0x2e')]),_0x42ed3c);if(_0x38b7b3['query'][_0x1c89('0x36')]){_0xeb578e[_0x1c89('0x34')]=_[_0x1c89('0x37')](_0xeb578e[_0x1c89('0x34')],{'$or':_['map'](_0x42ed3c,function(_0x8f0311){if(_0x8f0311[_0x1c89('0x9')]!==_0x1c89('0x38')){if(_0xc30108){return sequelize[_0x1c89('0x34')](sequelize['fn'](_0x1c89('0x39'),sequelize[_0x1c89('0x17')](_0x8f0311[_0x1c89('0x11')])),{'$like':sequelize['fn'](_0x1c89('0x39'),'%'+_0x38b7b3['query']['filter']+'%')});}else{var _0x4c1698={};_0x4c1698[_0x8f0311[_0x1c89('0x11')]]={'$like':'%'+_0x38b7b3[_0x1c89('0x2b')]['filter']+'%'};return _0x4c1698;}}})});}_0xeb578e=_[_0x1c89('0x37')]({},_0xeb578e,_0x38b7b3[_0x1c89('0x3a')]);return _0xeb578e;}; \ No newline at end of file +var _0x57a6=['model','attributes','fields','nolimit','order','where','pick','filter','lower','options','lodash','sequelize','moment','parse','includes','split','filters','isEmpty','forOwn','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','unsigned','col','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','replace','push','join','getOptions','query','$id','keys','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x57a6,0x122));var _0x657a=function(_0x3a12fc,_0x22c494){_0x3a12fc=_0x3a12fc-0x0;var _0x5abed1=_0x57a6[_0x3a12fc];return _0x5abed1;};'use strict';var _=require(_0x657a('0x0'));var sequelize=require(_0x657a('0x1'));var moment=require(_0x657a('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5bb917){var _0x54de70=['ne'];try{var _0x4c854c=JSON[_0x657a('0x3')](_0x5bb917);var _0x2eee36=Object['keys'](_0x4c854c)[0x0];return _0x54de70[_0x657a('0x4')](_0x2eee36);}catch(_0x4f39c6){return![];}}function getOperatorValue(_0x26c1ce){var _0x398a87=JSON[_0x657a('0x3')](_0x26c1ce);var _0x5abf37=Object['keys'](_0x398a87)[0x0];var _0x4b04e8=_0x398a87[_0x5abf37];return{['$'+_0x5abf37]:_0x4b04e8};}exports['fields']=function(_0x6798cd){var _0x35c664=null;if(_0x6798cd){_0x35c664=_0x6798cd[_0x657a('0x5')](',');}return _0x35c664;};exports[_0x657a('0x6')]=function(_0x2f873d,_0x4d9817){var _0x5a510c={};if(!_[_0x657a('0x7')](_0x2f873d)){_[_0x657a('0x8')](_0x2f873d,function(_0x1fba2c,_0x48ae30){try{if(_0x4d9817){var _0x3b995a=_['find'](_0x4d9817,{'name':_0x48ae30})||{};if(hasSequelizeOperator(_0x1fba2c)){_0x5a510c[_0x48ae30]=getOperatorValue(_0x1fba2c);}else if(_0x3b995a[_0x657a('0x9')]==='DATE'&&_[_0x657a('0xa')](_0x1fba2c)){var _0x424c7a=JSON[_0x657a('0x3')](_0x1fba2c);var _0x445245={'$gte':moment(moment(_0x424c7a[_0x657a('0xb')])[_0x657a('0xc')](_0x657a('0xd')))[_0x657a('0xe')]()[_0x657a('0xc')](),'$lte':moment(moment(_0x424c7a['$lte'])[_0x657a('0xc')](_0x657a('0xd')))[_0x657a('0xe')]()[_0x657a('0xf')](0x1,'s')[_0x657a('0xc')]()};_0x5a510c[_0x48ae30]=_0x445245;}else if(_0x3b995a[_0x657a('0x10')]===_0x657a('0x11')){_0x5a510c[_0x48ae30]=_0x1fba2c;}else{_0x5a510c[_0x48ae30]=_[_0x657a('0x12')](_0x1fba2c)?_0x1fba2c:JSON[_0x657a('0x3')](_0x1fba2c);}}else{_0x5a510c[_0x48ae30]=_[_0x657a('0x12')](_0x1fba2c)?_0x1fba2c:JSON[_0x657a('0x3')](_0x1fba2c);}}catch(_0x1a6c4e){_0x5a510c[_0x48ae30]=_0x1fba2c[_0x657a('0x5')](',');}});}return _0x5a510c;};exports[_0x657a('0x13')]=function(_0x43b671){_0x43b671=parseInt(_0x43b671,0xa);if(!_0x43b671||_0x43b671<0x0){_0x43b671=LIMIT_VALUE;}return _0x43b671;};exports[_0x657a('0x14')]=function(_0x16e69e){_0x16e69e=parseInt(_0x16e69e,0xa);if(!_0x16e69e||_0x16e69e<0x0){_0x16e69e=0x0;}return _0x16e69e;};exports[_0x657a('0x15')]=function(_0x13fb26){var _0x593495,_0x2dcd1b=null;if(_0x13fb26){_0x593495=_0x13fb26[_0x657a('0x5')](',');_0x2dcd1b=_[_0x657a('0x16')](_0x593495,function(_0x1add12){if(_0x1add12[_0x657a('0x17')]('-')===0x0){return[_0x1add12===_0x657a('0x18')?sequelize[_0x657a('0x19')](sequelize['col'](_0x657a('0x18')),_0x657a('0x1a')):_0x1add12['substr'](0x1),'DESC'];}else{return[_0x1add12==='priority'?sequelize[_0x657a('0x19')](sequelize[_0x657a('0x1b')](_0x657a('0x18')),'unsigned'):_0x1add12,'ASC'];}});}return _0x2dcd1b;};exports[_0x657a('0x1c')]=function(_0xa9678c,_0x487888){if(_[_0x657a('0x7')](_0xa9678c)){return _0xa9678c;}if(_[_0x657a('0x12')](_0xa9678c)){for(var _0x16a34a=0x0;_0x16a34a<_0xa9678c[_0x657a('0x1d')];_0x16a34a+=0x1){_0xa9678c[_0x16a34a]=this[_0x657a('0x1c')](_0xa9678c[_0x16a34a],_0x487888);}return _0xa9678c;}if(!_[_0x657a('0x1e')](_0xa9678c)){return _0xa9678c;}if(_[_0x657a('0x1f')](_0x487888)){_0x487888=[_0x487888];}if(!_[_0x657a('0x12')](_0x487888)){return _0xa9678c;}for(var _0x414aa4=0x0;_0x414aa4<_0x487888[_0x657a('0x1d')];_0x414aa4+=0x1){_[_0x657a('0x20')](_0xa9678c,_0x487888[_0x414aa4]);}for(var _0x53ba9a in _0xa9678c){if(_0xa9678c[_0x657a('0x21')](_0x53ba9a)){_0xa9678c[_0x53ba9a]=this[_0x657a('0x1c')](_0xa9678c[_0x53ba9a],_0x487888);}}return _0xa9678c;};exports[_0x657a('0x22')]=function(_0x2e778b){return _0x2e778b[_0x657a('0x23')](RegExp(_0x657a('0x24')))?!![]:![];};exports[_0x657a('0x25')]=function(_0x38a5c7){return _0x38a5c7[_0x657a('0x23')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x51c078){var _0x3394a8=[];_0x51c078[_0x657a('0x5')](/[ ,]+/)['forEach'](function(_0x33f05d){_0x33f05d=_0x33f05d[_0x657a('0x26')](/([^:]")"+/g,'$1');_0x33f05d='+'+_0x33f05d+'*';if(_0x33f05d['includes']('@'))_0x33f05d='\x22'+_0x33f05d+'\x22';_0x3394a8[_0x657a('0x27')](_0x33f05d);});return _0x3394a8[_0x657a('0x28')]('\x20');};exports[_0x657a('0x29')]=function(_0x3b020e,_0x1d191d,_0x551b67){var _0x35b2ce={},_0x121a28={};if(_0x1d191d[_0x657a('0x2a')][_0x657a('0x2b')]){_0x1d191d['query']['id']=_0x1d191d['query'][_0x657a('0x2b')];delete _0x1d191d[_0x657a('0x2a')]['$id'];}_0x35b2ce['model']=_[_0x657a('0x16')](_0x3b020e,_0x657a('0x10'));_0x35b2ce['query']=_[_0x657a('0x2c')](_0x1d191d['query']);_0x35b2ce[_0x657a('0x6')]=_[_0x657a('0x2d')](_0x35b2ce[_0x657a('0x2e')],_0x35b2ce[_0x657a('0x2a')]);_0x121a28[_0x657a('0x2f')]=_[_0x657a('0x2d')](_0x35b2ce[_0x657a('0x2e')],this['fields'](_0x1d191d['query'][_0x657a('0x30')]));_0x121a28[_0x657a('0x2f')]=_0x121a28[_0x657a('0x2f')][_0x657a('0x1d')]?_0x121a28[_0x657a('0x2f')]:_0x35b2ce[_0x657a('0x2e')];if(!_0x1d191d[_0x657a('0x2a')][_0x657a('0x21')](_0x657a('0x31'))){_0x121a28['limit']=this['limit'](_0x1d191d['query'][_0x657a('0x13')]);_0x121a28[_0x657a('0x14')]=this[_0x657a('0x14')](_0x1d191d[_0x657a('0x2a')][_0x657a('0x14')]);}_0x121a28[_0x657a('0x32')]=this[_0x657a('0x15')](_0x1d191d[_0x657a('0x2a')][_0x657a('0x15')]);_0x121a28[_0x657a('0x33')]=this[_0x657a('0x6')](_[_0x657a('0x34')](_0x1d191d[_0x657a('0x2a')],_0x35b2ce[_0x657a('0x6')]),_0x3b020e);if(_0x1d191d[_0x657a('0x2a')][_0x657a('0x35')]){_0x121a28[_0x657a('0x33')]=_['merge'](_0x121a28['where'],{'$or':_['map'](_0x3b020e,function(_0xcbf991){if(_0xcbf991[_0x657a('0x9')]!=='VIRTUAL'){if(_0x551b67){return sequelize[_0x657a('0x33')](sequelize['fn'](_0x657a('0x36'),sequelize['col'](_0xcbf991[_0x657a('0x10')])),{'$like':sequelize['fn'](_0x657a('0x36'),'%'+_0x1d191d[_0x657a('0x2a')][_0x657a('0x35')]+'%')});}else{var _0x4b540f={};_0x4b540f[_0xcbf991[_0x657a('0x10')]]={'$like':'%'+_0x1d191d[_0x657a('0x2a')][_0x657a('0x35')]+'%'};return _0x4b540f;}}})});}_0x121a28=_['merge']({},_0x121a28,_0x1d191d[_0x657a('0x37')]);return _0x121a28;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index da7c678..c8b8707 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad2a=['env','production','set','appPath','join','root','development','test','client','use','json\x20replacer','split','views','/server/views','engine','html','ejs','renderFile','view\x20engine','50mb','json','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors','moment','./environment','default','get'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xad2a,0x195));var _0xaad2=function(_0x4ad887,_0x9f6baf){_0x4ad887=_0x4ad887-0x0;var _0x1ca7ff=_0xad2a[_0x4ad887];return _0x1ca7ff;};'use strict';var express=require('express');var favicon=require(_0xaad2('0x0'));var bodyParser=require(_0xaad2('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0xaad2('0x2'));var errorHandler=require(_0xaad2('0x3'));var path=require(_0xaad2('0x4'));var passport=require(_0xaad2('0x5'));var cors=require(_0xaad2('0x6'));var moment=require(_0xaad2('0x7'));var config=require(_0xaad2('0x8'));var db=require('../mysqldb')['db'];exports[_0xaad2('0x9')]=function(_0x11d414){var _0x35aec0=_0x11d414[_0xaad2('0xa')](_0xaad2('0xb'));if(_0x35aec0===_0xaad2('0xc')){_0x11d414[_0xaad2('0xd')](_0xaad2('0xe'),path[_0xaad2('0xf')](config[_0xaad2('0x10')],'public'));}if(_0x35aec0===_0xaad2('0x11')||_0x35aec0===_0xaad2('0x12')){_0x11d414[_0xaad2('0xd')](_0xaad2('0xe'),path[_0xaad2('0xf')](config[_0xaad2('0x10')],_0xaad2('0x13')));_0x11d414[_0xaad2('0x14')](errorHandler());}_0x11d414[_0xaad2('0xd')](_0xaad2('0x15'),function(_0x77c71d,_0x17ec14){if(this[_0x77c71d]instanceof Date){_0x17ec14=this[_0x77c71d]['toISOString']()[_0xaad2('0x16')]('.')[0x0]+'Z';}return _0x17ec14;});_0x11d414[_0xaad2('0x14')](express['static'](_0x11d414['get'](_0xaad2('0xe'))));_0x11d414[_0xaad2('0xd')](_0xaad2('0x17'),config[_0xaad2('0x10')]+_0xaad2('0x18'));_0x11d414[_0xaad2('0x19')](_0xaad2('0x1a'),require(_0xaad2('0x1b'))[_0xaad2('0x1c')]);_0x11d414[_0xaad2('0xd')](_0xaad2('0x1d'),_0xaad2('0x1a'));_0x11d414[_0xaad2('0x14')](bodyParser['urlencoded']({'limit':_0xaad2('0x1e'),'extended':!![]}));_0x11d414['use'](bodyParser[_0xaad2('0x1f')]({'limit':_0xaad2('0x1e')}));_0x11d414[_0xaad2('0x14')](cors());_0x11d414[_0xaad2('0x14')](methodOverride());_0x11d414[_0xaad2('0x14')](cookieParser());_0x11d414[_0xaad2('0x14')](passport['initialize']());}; \ No newline at end of file +var _0x85e9=['express','serve-favicon','method-override','cookie-parser','errorhandler','passport','cors','./environment','../mysqldb','get','env','set','appPath','root','public','development','join','client','json\x20replacer','toISOString','use','static','views','/server/views','engine','renderFile','view\x20engine','urlencoded','50mb','json','initialize'];(function(_0xd36ecf,_0xbc090b){var _0x15847a=function(_0x345247){while(--_0x345247){_0xd36ecf['push'](_0xd36ecf['shift']());}};_0x15847a(++_0xbc090b);}(_0x85e9,0x193));var _0x985e=function(_0x72d420,_0x48358f){_0x72d420=_0x72d420-0x0;var _0x3649cc=_0x85e9[_0x72d420];return _0x3649cc;};'use strict';var express=require(_0x985e('0x0'));var favicon=require(_0x985e('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x985e('0x2'));var cookieParser=require(_0x985e('0x3'));var errorHandler=require(_0x985e('0x4'));var path=require('path');var passport=require(_0x985e('0x5'));var cors=require(_0x985e('0x6'));var moment=require('moment');var config=require(_0x985e('0x7'));var db=require(_0x985e('0x8'))['db'];exports['default']=function(_0xdd1cb5){var _0xf512b0=_0xdd1cb5[_0x985e('0x9')](_0x985e('0xa'));if(_0xf512b0==='production'){_0xdd1cb5[_0x985e('0xb')](_0x985e('0xc'),path['join'](config[_0x985e('0xd')],_0x985e('0xe')));}if(_0xf512b0===_0x985e('0xf')||_0xf512b0==='test'){_0xdd1cb5['set']('appPath',path[_0x985e('0x10')](config['root'],_0x985e('0x11')));_0xdd1cb5['use'](errorHandler());}_0xdd1cb5['set'](_0x985e('0x12'),function(_0x309894,_0x4287a1){if(this[_0x309894]instanceof Date){_0x4287a1=this[_0x309894][_0x985e('0x13')]()['split']('.')[0x0]+'Z';}return _0x4287a1;});_0xdd1cb5[_0x985e('0x14')](express[_0x985e('0x15')](_0xdd1cb5[_0x985e('0x9')](_0x985e('0xc'))));_0xdd1cb5[_0x985e('0xb')](_0x985e('0x16'),config[_0x985e('0xd')]+_0x985e('0x17'));_0xdd1cb5[_0x985e('0x18')]('html',require('ejs')[_0x985e('0x19')]);_0xdd1cb5[_0x985e('0xb')](_0x985e('0x1a'),'html');_0xdd1cb5['use'](bodyParser[_0x985e('0x1b')]({'limit':_0x985e('0x1c'),'extended':!![]}));_0xdd1cb5[_0x985e('0x14')](bodyParser[_0x985e('0x1d')]({'limit':'50mb'}));_0xdd1cb5[_0x985e('0x14')](cors());_0xdd1cb5[_0x985e('0x14')](methodOverride());_0xdd1cb5[_0x985e('0x14')](cookieParser());_0xdd1cb5['use'](passport[_0x985e('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 695f20f..3e7af0a 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 _0xd58b=['family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','map','model','join','createHash','md5','digest','hex','getUuid','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','update','substring','crypto','child_process','execSync','../environment','networkInterfaces','keys','filter'];(function(_0x857d89,_0x39fb3f){var _0x19aa40=function(_0x5d0b28){while(--_0x5d0b28){_0x857d89['push'](_0x857d89['shift']());}};_0x19aa40(++_0x39fb3f);}(_0xd58b,0x79));var _0xbd58=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xd58b[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xbd58('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xbd58('0x1'))[_0xbd58('0x2')];var config=require(_0xbd58('0x3'));function getInterfaces(){var _0x5b0339=[];var _0xd0c94a=os[_0xbd58('0x4')]();var _0x495b55=_['orderBy'](_[_0xbd58('0x5')](_0xd0c94a));for(var _0x3d20eb=0x0;_0x3d20eb<_0x495b55['length'];_0x3d20eb++){var _0x4a233e=_0xd0c94a[_0x495b55[_0x3d20eb]][_0xbd58('0x6')](function(_0xe8e5bf){return _0xe8e5bf[_0xbd58('0x7')]===_0xbd58('0x8')&&_0xe8e5bf[_0xbd58('0x9')]===![];});_0x5b0339=_0x5b0339[_0xbd58('0xa')](_0x4a233e);}return _0x5b0339;}function getFirstInterface(){var _0x3bbfa0=_[_0xbd58('0xb')](getInterfaces());return{'macAddress':_0x3bbfa0&&_0x3bbfa0[_0xbd58('0xc')]?_0x3bbfa0[_0xbd58('0xc')]:_0xbd58('0xd'),'ipAddress':_0x3bbfa0&&_0x3bbfa0[_0xbd58('0xe')]?_0x3bbfa0[_0xbd58('0xe')]:_0xbd58('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2716a2=_['orderBy'](os['cpus']()[_0xbd58('0x10')](function(_0x32edb4){return _0x32edb4[_0xbd58('0x11')];}))[_0xbd58('0x12')](':');return crypto[_0xbd58('0x13')](_0xbd58('0x14'))['update'](_0x2716a2)[_0xbd58('0x15')](_0xbd58('0x16'));}exports[_0xbd58('0x17')]=function(){var _0x5d997f=os['platform']();var _0x1de170=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1de170[_0xbd58('0x18')](config[_0xbd58('0x19')])){return config[_0xbd58('0x19')];}else if(_0x5d997f===_0xbd58('0x1a')){return exec(_0xbd58('0x1b'),{'encoding':'utf8'})[_0xbd58('0x1c')]('\x0d\x0a','');}else{var _0x916493=getFirstInterface();var _0x3654f4=getCPUhash();var _0x531189=_0x3654f4+'|'+os['hostname']()+'|'+_0x916493[_0xbd58('0x1d')]+'|'+_0x916493['ipAddress'];var _0x3732d3=crypto['createHash'](_0xbd58('0x14'))[_0xbd58('0x1e')](_0x531189)[_0xbd58('0x15')](_0xbd58('0x16'));return _0x3732d3[_0xbd58('0x1f')](0x0,0x8)+'-'+_0x3732d3[_0xbd58('0x1f')](0x8,0xc)+'-'+_0x3732d3[_0xbd58('0x1f')](0xc,0x10)+'-'+_0x3732d3[_0xbd58('0x1f')](0x10,0x14)+'-'+_0x3732d3[_0xbd58('0x1f')](0x14);}}; \ No newline at end of file +var _0x4bac=['utf8','replace','macAddress','ipAddress','substring','crypto','execSync','orderBy','filter','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','test','licenseToken','win32'];(function(_0x313e64,_0x1e2019){var _0x9d4f24=function(_0x8f18f4){while(--_0x8f18f4){_0x313e64['push'](_0x313e64['shift']());}};_0x9d4f24(++_0x1e2019);}(_0x4bac,0x113));var _0xc4ba=function(_0x522c6c,_0x18f153){_0x522c6c=_0x522c6c-0x0;var _0xc8f69e=_0x4bac[_0x522c6c];return _0xc8f69e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xc4ba('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xc4ba('0x1')];var config=require('../environment');function getInterfaces(){var _0x27a1c6=[];var _0x21e005=os['networkInterfaces']();var _0x294593=_[_0xc4ba('0x2')](_['keys'](_0x21e005));for(var _0x1d3139=0x0;_0x1d3139<_0x294593['length'];_0x1d3139++){var _0x1b7eda=_0x21e005[_0x294593[_0x1d3139]][_0xc4ba('0x3')](function(_0x1852ac){return _0x1852ac['family']==='IPv4'&&_0x1852ac[_0xc4ba('0x4')]===![];});_0x27a1c6=_0x27a1c6[_0xc4ba('0x5')](_0x1b7eda);}return _0x27a1c6;}function getFirstInterface(){var _0x5f3eee=_[_0xc4ba('0x6')](getInterfaces());return{'macAddress':_0x5f3eee&&_0x5f3eee['mac']?_0x5f3eee[_0xc4ba('0x7')]:_0xc4ba('0x8'),'ipAddress':_0x5f3eee&&_0x5f3eee[_0xc4ba('0x9')]?_0x5f3eee[_0xc4ba('0x9')]:_0xc4ba('0xa')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xe8c7d3=_[_0xc4ba('0x2')](os[_0xc4ba('0xb')]()[_0xc4ba('0xc')](function(_0x426f5b){return _0x426f5b[_0xc4ba('0xd')];}))[_0xc4ba('0xe')](':');return crypto[_0xc4ba('0xf')](_0xc4ba('0x10'))[_0xc4ba('0x11')](_0xe8c7d3)[_0xc4ba('0x12')](_0xc4ba('0x13'));}exports[_0xc4ba('0x14')]=function(){var _0x4c38b1=os[_0xc4ba('0x15')]();var _0x5a2dc2=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5a2dc2[_0xc4ba('0x16')](config[_0xc4ba('0x17')])){return config['licenseToken'];}else if(_0x4c38b1===_0xc4ba('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xc4ba('0x19')})[_0xc4ba('0x1a')]('\x0d\x0a','');}else{var _0x7b66de=getFirstInterface();var _0x4432e5=getCPUhash();var _0x12d77e=_0x4432e5+'|'+os['hostname']()+'|'+_0x7b66de[_0xc4ba('0x1b')]+'|'+_0x7b66de[_0xc4ba('0x1c')];var _0x220105=crypto['createHash'](_0xc4ba('0x10'))[_0xc4ba('0x11')](_0x12d77e)[_0xc4ba('0x12')](_0xc4ba('0x13'));return _0x220105[_0xc4ba('0x1d')](0x0,0x8)+'-'+_0x220105['substring'](0x8,0xc)+'-'+_0x220105[_0xc4ba('0x1d')](0xc,0x10)+'-'+_0x220105['substring'](0x10,0x14)+'-'+_0x220105[_0xc4ba('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c0fcec3..cec5ad6 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 _0x1da9=['data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','getUuid','License','findOrCreate','spread','error','util','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1da9,0xb8));var _0x91da=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x1da9[_0x56482c];return _0x5aae7a;};'use strict';var util=require(_0x91da('0x0'));var moment=require('moment');var rp=require(_0x91da('0x1'));var BPromise=require(_0x91da('0x2'));var pkginfo=require(_0x91da('0x3'))(module,_0x91da('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x91da('0x5'));var hardware=require(_0x91da('0x6'));var logger=require('../logger')(_0x91da('0x7'));var HOST=_0x91da('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3a9506){return new BPromise(function(_0x44074d,_0x3b3438){var _0x59ee0f=util['format'](_0x91da('0x9'),HOST,_0x3a9506,module[_0x91da('0xa')][_0x91da('0x4')]);if(oldToken){_0x59ee0f=util[_0x91da('0xb')](_0x91da('0xc'),HOST,_0x3a9506,module[_0x91da('0xa')][_0x91da('0x4')],oldToken);}var _0x1a6c4b={'uri':_0x59ee0f,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x1a6c4b)[_0x91da('0xd')](function(_0x3ffd8c){_0x44074d(_0x3ffd8c);})[_0x91da('0xe')](function(_0x4ac203){_0x3b3438(_0x4ac203);});});}function manageLicense(_0x18d509,_0xd103e9){var _0x4f32ba=_0xd103e9[_0x91da('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x4f32ba[_0x91da('0x10')]!==_0x18d509&&!_0x4f32ba[_0x91da('0x11')]){oldToken=_0x4f32ba[_0x91da('0x10')];}httpRequest(_0x18d509)[_0x91da('0xd')](function(_0x20e8e0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x20e8e0[_0x91da('0x12')]){isOldTokenSent=![];if(!_0x4f32ba[_0x91da('0x7')]&&_0x4f32ba['license']!=_0x20e8e0['license']||_0x4f32ba[_0x91da('0x7')]&&_0x4f32ba[_0x91da('0x11')]){logger[_0x91da('0x13')](_0x91da('0x14'));}if(_0x4f32ba[_0x91da('0x7')]&&!_0x4f32ba[_0x91da('0x11')]&&_0x4f32ba['license']!=_0x20e8e0['license']){logger['info'](_0x91da('0x15'));}if(_0x4f32ba[_0x91da('0x7')]&&!_0x4f32ba['data2']&&_0x4f32ba['license']==_0x20e8e0[_0x91da('0x7')]){return _0xd103e9;}return _0xd103e9[_0x91da('0x16')]({'data1':_0x18d509,'data2':null,'license':_0x20e8e0[_0x91da('0x7')]});}else{if(_0x20e8e0[_0x91da('0x7')]||_0x4f32ba['license']){if(!_0x4f32ba[_0x91da('0x11')]){if(_0x4f32ba[_0x91da('0x10')]==_0x18d509){GRAY_PERIOD_REASON=_0x91da('0x17');logger['info'](_0x91da('0x18'));}else{GRAY_PERIOD_REASON=_0x91da('0x19');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4f32ba[_0x91da('0x10')],_0x18d509);}logger['info'](_0x91da('0x1a'),GRAY_PERIOD_REASON[_0x91da('0x1b')](),moment()[_0x91da('0xb')](_0x91da('0x1c')));return _0xd103e9[_0x91da('0x16')]({'data2':encryptor['encryptString'](moment()['format'](_0x91da('0x1c')))});}else{if(moment()[_0x91da('0x1d')](encryptor[_0x91da('0x1e')](_0x4f32ba['data2']),_0x91da('0x1f'))>DAYS){logger[_0x91da('0x13')](_0x91da('0x20'),moment()[_0x91da('0xb')](_0x91da('0x1c')));isOldTokenSent=![];return _0xd103e9['update']({'data1':_0x18d509,'data2':null,'license':null});}}}else{if(_0x4f32ba[_0x91da('0x10')]!=_0x18d509){logger[_0x91da('0x13')](_0x91da('0x21'),_0x4f32ba[_0x91da('0x10')],_0x18d509);return _0xd103e9[_0x91da('0x16')]({'data1':_0x18d509,'data2':null,'license':null});}}}return _0xd103e9;})[_0x91da('0xd')](function(_0x2b16b0){_0xd103e9=_0x2b16b0;})[_0x91da('0xe')](function(_0xd73b88){logger['error'](_0xd73b88[_0x91da('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x91da('0x23')](),_0xd103e9);},TIME);});}function defaultLicense(){var _0x5f5b3e=hardware[_0x91da('0x23')]();if(_0x5f5b3e){return db[_0x91da('0x24')][_0x91da('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x5f5b3e}})[_0x91da('0x26')](function(_0x52bd0c,_0x5762d2){logger[_0x91da('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x5f5b3e);manageLicense(_0x5f5b3e,_0x52bd0c);})[_0x91da('0xe')](function(_0x2e29bd){logger[_0x91da('0x27')](_0x2e29bd['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xaa5f=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','catch','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','bluebird','pkginfo','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','get','data2','data1','active'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xaa5f,0x1d0));var _0xfaa5=function(_0x377a02,_0x48ac04){_0x377a02=_0x377a02-0x0;var _0x495cf7=_0xaa5f[_0x377a02];return _0x495cf7;};'use strict';var util=require('util');var moment=require(_0xfaa5('0x0'));var rp=require('request-promise');var BPromise=require(_0xfaa5('0x1'));var pkginfo=require(_0xfaa5('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xfaa5('0x3'));var logger=require(_0xfaa5('0x4'))(_0xfaa5('0x5'));var HOST=_0xfaa5('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2ca334){return new BPromise(function(_0x50fe4d,_0x2d2c58){var _0x1d73d4=util[_0xfaa5('0x7')](_0xfaa5('0x8'),HOST,_0x2ca334,module[_0xfaa5('0x9')][_0xfaa5('0xa')]);if(oldToken){_0x1d73d4=util[_0xfaa5('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2ca334,module[_0xfaa5('0x9')][_0xfaa5('0xa')],oldToken);}var _0xef858e={'uri':_0x1d73d4,'method':_0xfaa5('0xb'),'timeout':0xea60,'json':!![]};return rp(_0xef858e)[_0xfaa5('0xc')](function(_0xcf1fe8){_0x50fe4d(_0xcf1fe8);})['catch'](function(_0x588e00){_0x2d2c58(_0x588e00);});});}function manageLicense(_0x47239f,_0x53d271){var _0x5995b8=_0x53d271[_0xfaa5('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x5995b8['data1']!==_0x47239f&&!_0x5995b8[_0xfaa5('0xe')]){oldToken=_0x5995b8[_0xfaa5('0xf')];}httpRequest(_0x47239f)[_0xfaa5('0xc')](function(_0x3666fa){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3666fa[_0xfaa5('0x10')]){isOldTokenSent=![];if(!_0x5995b8[_0xfaa5('0x5')]&&_0x5995b8['license']!=_0x3666fa[_0xfaa5('0x5')]||_0x5995b8[_0xfaa5('0x5')]&&_0x5995b8[_0xfaa5('0xe')]){logger['info'](_0xfaa5('0x11'));}if(_0x5995b8[_0xfaa5('0x5')]&&!_0x5995b8['data2']&&_0x5995b8[_0xfaa5('0x5')]!=_0x3666fa[_0xfaa5('0x5')]){logger[_0xfaa5('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5995b8[_0xfaa5('0x5')]&&!_0x5995b8[_0xfaa5('0xe')]&&_0x5995b8['license']==_0x3666fa['license']){return _0x53d271;}return _0x53d271[_0xfaa5('0x13')]({'data1':_0x47239f,'data2':null,'license':_0x3666fa['license']});}else{if(_0x3666fa[_0xfaa5('0x5')]||_0x5995b8['license']){if(!_0x5995b8[_0xfaa5('0xe')]){if(_0x5995b8[_0xfaa5('0xf')]==_0x47239f){GRAY_PERIOD_REASON='Disabled';logger[_0xfaa5('0x12')](_0xfaa5('0x14'));}else{GRAY_PERIOD_REASON=_0xfaa5('0x15');logger[_0xfaa5('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5995b8[_0xfaa5('0xf')],_0x47239f);}logger[_0xfaa5('0x12')](_0xfaa5('0x16'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x53d271[_0xfaa5('0x13')]({'data2':encryptor[_0xfaa5('0x17')](moment()[_0xfaa5('0x7')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xfaa5('0x18')](_0x5995b8['data2']),_0xfaa5('0x19'))>DAYS){logger[_0xfaa5('0x12')](_0xfaa5('0x1a'),moment()['format'](_0xfaa5('0x1b')));isOldTokenSent=![];return _0x53d271[_0xfaa5('0x13')]({'data1':_0x47239f,'data2':null,'license':null});}}}else{if(_0x5995b8[_0xfaa5('0xf')]!=_0x47239f){logger[_0xfaa5('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5995b8['data1'],_0x47239f);return _0x53d271[_0xfaa5('0x13')]({'data1':_0x47239f,'data2':null,'license':null});}}}return _0x53d271;})[_0xfaa5('0xc')](function(_0x49b869){_0x53d271=_0x49b869;})[_0xfaa5('0x1c')](function(_0x1888ac){logger[_0xfaa5('0x1d')](_0x1888ac[_0xfaa5('0x1e')]);})[_0xfaa5('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xfaa5('0x20')](),_0x53d271);},TIME);});}function defaultLicense(){var _0x18a96f=hardware[_0xfaa5('0x20')]();if(_0x18a96f){return db[_0xfaa5('0x21')][_0xfaa5('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x18a96f}})['spread'](function(_0x3f8227,_0x227fbc){logger[_0xfaa5('0x12')](_0xfaa5('0x23'),_0x18a96f);manageLicense(_0x18a96f,_0x3f8227);})[_0xfaa5('0x1c')](function(_0x5b876b){logger['error'](_0x5b876b['message']);});}}exports[_0xfaa5('0x24')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b46c8f1..202425d 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 _0x999b=['parse','demo','machineUuid','deadline','add','days','format','grayReason','changed','disabled','message','then','User','findAll','role','sequelize','COUNT','col','count','user','telephone','users','forEach','admin','pick','countBy','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','Breaking\x20license','find','defaults','catch','uuid','data1','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s'];(function(_0x18e52b,_0x1fae35){var _0x3d3062=function(_0x133b14){while(--_0x133b14){_0x18e52b['push'](_0x18e52b['shift']());}};_0x3d3062(++_0x1fae35);}(_0x999b,0x77));var _0xb999=function(_0x552baa,_0x1f16e1){_0x552baa=_0x552baa-0x0;var _0x1a4a0d=_0x999b[_0x552baa];return _0x1a4a0d;};'use strict';var util=require(_0xb999('0x0'));var _=require(_0xb999('0x1'));var moment=require(_0xb999('0x2'));var BPromise=require('bluebird');var hardware=require(_0xb999('0x3'));var encryptor=require(_0xb999('0x4'));var db=require(_0xb999('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb999('0x6'),'machineUuid':hardware[_0xb999('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':_0xb999('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3db4d1){return new BPromise(function(_0x5c1079,_0x222c9e){return db['License'][_0xb999('0x9')](_[_0xb999('0xa')](_0x3db4d1,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3f469c){return checkLicense(_0x3f469c,null);})['then'](function(_0x54ec4f){_0x5c1079(_0x54ec4f);return;})[_0xb999('0xb')](function(_0x2f9b15){_0x222c9e(_0x2f9b15);});});}function checkLicense(_0x386e58,_0x5c167a){if(!_0x386e58){demoLicense[_0xb999('0xc')]=_0x386e58[_0xb999('0xd')];return demoLicense;}try{var _0x131545=_0x5c167a||_0x386e58['license'];if(_['isEmpty'](_0x131545)){throw new Error(_0xb999('0xe'));}var _0x408d34=_0x386e58[_0xb999('0xd')];var _0x2ce733=_0x386e58[_0xb999('0xf')];var _0x32df79=_0x408d34[_0xb999('0x10')]('-')[0x4];var _0x1c09ab=_0x408d34['split']('-')[0x0];var _0x191cdc=encryptor[_0xb999('0x11')](_0x131545,util['format'](_0xb999('0x12'),_0x32df79,_0x408d34,_0x1c09ab));var _0x327f70=JSON[_0xb999('0x13')](_0x191cdc);_0x327f70[_0xb999('0x14')]=![];_0x327f70[_0xb999('0xc')]=_0x408d34;_0x327f70[_0xb999('0x15')]=hardware[_0xb999('0x7')]();if(_0x2ce733){var _0x127e84=encryptor['decryptString'](_0x2ce733);_0x327f70['gray']=_0x127e84;_0x327f70[_0xb999('0x16')]=moment(_0x127e84)[_0xb999('0x17')](0x7,_0xb999('0x18'))[_0xb999('0x19')]();_0x327f70[_0xb999('0x1a')]=_0x327f70[_0xb999('0xc')]!=_0x327f70[_0xb999('0x15')]?_0xb999('0x1b'):_0xb999('0x1c');}return _0x327f70;}catch(_0xac5d06){breakingLicense[_0xb999('0xc')]=_0x386e58['data1'];breakingLicense[_0xb999('0x1d')]=_0xac5d06[_0xb999('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2c05e9,_0x29dcb6){getLicense()[_0xb999('0x1e')](function(_0x45598f){return db[_0xb999('0x1f')][_0xb999('0x20')]({'attributes':[_0xb999('0x21'),[db[_0xb999('0x22')]['fn'](_0xb999('0x23'),db['sequelize'][_0xb999('0x24')]('role')),_0xb999('0x25')]],'group':_0xb999('0x21'),'where':{'role':{'$or':['admin',_0xb999('0x26'),_0xb999('0x27')]}},'raw':!![]})[_0xb999('0x1e')](function(_0x36475a){var _0x5b0996={'user':_0x45598f[_0xb999('0x28')]||0x0,'telephone':_0x45598f['telephones']||0x0};_0x36475a[_0xb999('0x29')](function(_0x20e5fc){var _0x111752=_0x20e5fc[_0xb999('0x21')]===_0xb999('0x2a')?_0xb999('0x26'):_0x20e5fc['role'];_0x5b0996[_0x111752]-=_0x20e5fc[_0xb999('0x25')];if(_0x5b0996[_0x111752]<0x0)_0x5b0996[_0x111752]=0x0;});_0x2c05e9(_0x5b0996);return;});})['catch'](function(_0x5e246a){_0x29dcb6(_0x5e246a);});});}function checkUserLimits(_0x50316d){return new BPromise(function(_0x13cfc5,_0x46f0d2){getLimits()[_0xb999('0x1e')](function(_0x54f6ef){var _0xf1460e=_[_0xb999('0x2b')](_[_0xb999('0x2c')](_0x50316d,_0xb999('0x21')),['admin','user','telephone']);var _0x7dc046=(_0xf1460e[_0xb999('0x2a')]||0x0)+(_0xf1460e[_0xb999('0x26')]||0x0);var _0x40554a=_0xf1460e[_0xb999('0x27')]||0x0;if(_0x7dc046>_0x54f6ef[_0xb999('0x26')])return _0x46f0d2('License\x20limit\x20reached\x20for\x20users');if(_0x40554a>_0x54f6ef[_0xb999('0x27')])return _0x46f0d2('License\x20limit\x20reached\x20for\x20telephones');return _0x13cfc5();})[_0xb999('0xb')](function(_0xeb14a0){_0x46f0d2(_0xeb14a0);});});}module[_0xb999('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xef99=['demo','deadline','add','machineUuid','changed','disabled','message','then','User','findAll','sequelize','col','role','count','admin','user','telephone','users','telephones','forEach','pick','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','find','defaults','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse'];(function(_0x2476d5,_0x466ffd){var _0x1587dd=function(_0x3d3e62){while(--_0x3d3e62){_0x2476d5['push'](_0x2476d5['shift']());}};_0x1587dd(++_0x466ffd);}(_0xef99,0x103));var _0x9ef9=function(_0x254e8,_0x3f4a99){_0x254e8=_0x254e8-0x0;var _0x31d829=_0xef99[_0x254e8];return _0x31d829;};'use strict';var util=require(_0x9ef9('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x9ef9('0x1'));var hardware=require(_0x9ef9('0x2'));var encryptor=require(_0x9ef9('0x3'));var db=require(_0x9ef9('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9ef9('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9ef9('0x6'),'machineUuid':hardware[_0x9ef9('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9ef9('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4f2862){return new BPromise(function(_0x7ae55f,_0x4d1d6b){return db[_0x9ef9('0x8')][_0x9ef9('0x9')](_[_0x9ef9('0xa')](_0x4f2862,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x425f84){return checkLicense(_0x425f84,null);})['then'](function(_0x3a9361){_0x7ae55f(_0x3a9361);return;})[_0x9ef9('0xb')](function(_0x2a3bb4){_0x4d1d6b(_0x2a3bb4);});});}function checkLicense(_0x3fb006,_0x460194){if(!_0x3fb006){demoLicense[_0x9ef9('0xc')]=_0x3fb006[_0x9ef9('0xd')];return demoLicense;}try{var _0x34a226=_0x460194||_0x3fb006[_0x9ef9('0xe')];if(_[_0x9ef9('0xf')](_0x34a226)){throw new Error(_0x9ef9('0x10'));}var _0x47b632=_0x3fb006[_0x9ef9('0xd')];var _0x24972d=_0x3fb006[_0x9ef9('0x11')];var _0xd3da74=_0x47b632[_0x9ef9('0x12')]('-')[0x4];var _0x26d612=_0x47b632['split']('-')[0x0];var _0x658839=encryptor[_0x9ef9('0x13')](_0x34a226,util[_0x9ef9('0x14')](_0x9ef9('0x15'),_0xd3da74,_0x47b632,_0x26d612));var _0x40d812=JSON[_0x9ef9('0x16')](_0x658839);_0x40d812[_0x9ef9('0x17')]=![];_0x40d812[_0x9ef9('0xc')]=_0x47b632;_0x40d812['machineUuid']=hardware[_0x9ef9('0x7')]();if(_0x24972d){var _0x1e9442=encryptor['decryptString'](_0x24972d);_0x40d812['gray']=_0x1e9442;_0x40d812[_0x9ef9('0x18')]=moment(_0x1e9442)[_0x9ef9('0x19')](0x7,'days')['format']();_0x40d812['grayReason']=_0x40d812[_0x9ef9('0xc')]!=_0x40d812[_0x9ef9('0x1a')]?_0x9ef9('0x1b'):_0x9ef9('0x1c');}return _0x40d812;}catch(_0x140a00){breakingLicense[_0x9ef9('0xc')]=_0x3fb006[_0x9ef9('0xd')];breakingLicense[_0x9ef9('0x1d')]=_0x140a00[_0x9ef9('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x339015,_0x13ebc0){getLicense()[_0x9ef9('0x1e')](function(_0x234d97){return db[_0x9ef9('0x1f')][_0x9ef9('0x20')]({'attributes':['role',[db[_0x9ef9('0x21')]['fn']('COUNT',db[_0x9ef9('0x21')][_0x9ef9('0x22')](_0x9ef9('0x23'))),_0x9ef9('0x24')]],'group':_0x9ef9('0x23'),'where':{'role':{'$or':[_0x9ef9('0x25'),_0x9ef9('0x26'),_0x9ef9('0x27')]}},'raw':!![]})[_0x9ef9('0x1e')](function(_0x2295e2){var _0xbb32c1={'user':_0x234d97[_0x9ef9('0x28')]||0x0,'telephone':_0x234d97[_0x9ef9('0x29')]||0x0};_0x2295e2[_0x9ef9('0x2a')](function(_0x3d3b47){var _0x2b82fa=_0x3d3b47[_0x9ef9('0x23')]==='admin'?_0x9ef9('0x26'):_0x3d3b47['role'];_0xbb32c1[_0x2b82fa]-=_0x3d3b47[_0x9ef9('0x24')];if(_0xbb32c1[_0x2b82fa]<0x0)_0xbb32c1[_0x2b82fa]=0x0;});_0x339015(_0xbb32c1);return;});})[_0x9ef9('0xb')](function(_0x32c5b8){_0x13ebc0(_0x32c5b8);});});}function checkUserLimits(_0x51544d){return new BPromise(function(_0x590097,_0x53440e){getLimits()[_0x9ef9('0x1e')](function(_0x5c8408){var _0x375a4d=_[_0x9ef9('0x2b')](_['countBy'](_0x51544d,'role'),[_0x9ef9('0x25'),_0x9ef9('0x26'),_0x9ef9('0x27')]);var _0x33a94f=(_0x375a4d[_0x9ef9('0x25')]||0x0)+(_0x375a4d[_0x9ef9('0x26')]||0x0);var _0x3e9ea9=_0x375a4d['telephone']||0x0;if(_0x33a94f>_0x5c8408[_0x9ef9('0x26')])return _0x53440e(_0x9ef9('0x2c'));if(_0x3e9ea9>_0x5c8408[_0x9ef9('0x27')])return _0x53440e(_0x9ef9('0x2d'));return _0x590097();})[_0x9ef9('0xb')](function(_0x41a53a){_0x53440e(_0x41a53a);});});}module[_0x9ef9('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 9470b1e..2a1fa58 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 _0xb016=['exports','http://localhost:9000','secret'];(function(_0x8352c4,_0x34b787){var _0x351c0c=function(_0xd70109){while(--_0xd70109){_0x8352c4['push'](_0x8352c4['shift']());}};_0x351c0c(++_0x34b787);}(_0xb016,0x159));var _0x6b01=function(_0x570536,_0x150914){_0x570536=_0x570536-0x0;var _0x16fb83=_0xb016[_0x570536];return _0x16fb83;};'use strict';module[_0x6b01('0x0')]={'DOMAIN':_0x6b01('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x6b01('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xdd4f=['exports','secret'];(function(_0x5a3062,_0x547536){var _0x365170=function(_0x4a567c){while(--_0x4a567c){_0x5a3062['push'](_0x5a3062['shift']());}};_0x365170(++_0x547536);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x586b9a,_0x2441b6){_0x586b9a=_0x586b9a-0x0;var _0x322996=_0xdd4f[_0x586b9a];return _0x322996;};'use strict';module[_0xfdd4('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xfdd4('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index da6c1e5..7f1543c 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x302d=['format','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','transports','error','File','info','Console','env','debugLevel','winston','path','INFO','join','log','xcally'];(function(_0x3190d0,_0x2d5f29){var _0x7ca7f4=function(_0x2fe249){while(--_0x2fe249){_0x3190d0['push'](_0x3190d0['shift']());}};_0x7ca7f4(++_0x2d5f29);}(_0x302d,0x112));var _0xd302=function(_0x4be42a,_0x114837){_0x4be42a=_0x4be42a-0x0;var _0x1c5877=_0x302d[_0x4be42a];return _0x1c5877;};'use strict';var moment=require('moment');var winston=require(_0xd302('0x0'));var util=require('util');var path=require(_0xd302('0x1'));var debugLevel=_0xd302('0x2');function filename(_0x76a1be,_0x13232a){return path[_0xd302('0x3')]('/var',_0xd302('0x4'),_0xd302('0x5'),util[_0xd302('0x6')]('%s-%s.log',_0x76a1be,_0x13232a));}function formatter(_0x16db2a,_0x30f29c){_0x30f29c[_0xd302('0x7')]=_0x30f29c[_0xd302('0x7')]['replace'](/@@{/g,'{{{')[_0xd302('0x8')](/}@@/g,_0xd302('0x9'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xd302('0x6')](_0xd302('0xa')),_0x30f29c['level'][_0xd302('0xb')](),_0x16db2a,_0x30f29c[_0xd302('0x7')]);}module[_0xd302('0xc')]=function(_0xa99f2e){return new winston['Logger']({'transports':[new winston[(_0xd302('0xd'))]['File']({'name':util['format']('%s-%s',_0xa99f2e,_0xd302('0xe')),'filename':filename(_0xa99f2e,_0xd302('0xe')),'level':_0xd302('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x53792e){return formatter(_0xa99f2e,_0x53792e);}}),new winston[(_0xd302('0xd'))][(_0xd302('0xf'))]({'name':util[_0xd302('0x6')]('%s-%s',_0xa99f2e,_0xd302('0x10')),'filename':filename(_0xa99f2e,_0xd302('0x10')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x40ca1f){return formatter(_0xa99f2e,_0x40ca1f);}}),new winston['transports'][(_0xd302('0x11'))]({'level':process[_0xd302('0x12')][_0xd302('0x13')]||debugLevel,'json':![],'formatter':function(_0x50b407){return formatter(_0xa99f2e,_0x50b407);}})]});}; \ No newline at end of file +var _0x265f=['INFO','join','/var','log','xcally','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x265f,0x168));var _0xf265=function(_0x4b23b0,_0xf3d9b4){_0x4b23b0=_0x4b23b0-0x0;var _0x1440d7=_0x265f[_0x4b23b0];return _0x1440d7;};'use strict';var moment=require(_0xf265('0x0'));var winston=require(_0xf265('0x1'));var util=require(_0xf265('0x2'));var path=require(_0xf265('0x3'));var debugLevel=_0xf265('0x4');function filename(_0x1b149f,_0x2b9765){return path[_0xf265('0x5')](_0xf265('0x6'),_0xf265('0x7'),_0xf265('0x8'),util['format'](_0xf265('0x9'),_0x1b149f,_0x2b9765));}function formatter(_0x1ad66a,_0xf7a711){_0xf7a711[_0xf265('0xa')]=_0xf7a711[_0xf265('0xa')][_0xf265('0xb')](/@@{/g,'{{{')[_0xf265('0xb')](/}@@/g,_0xf265('0xc'))[_0xf265('0xb')](/@{/g,'{{')[_0xf265('0xb')](/}@/g,'}}');return util[_0xf265('0xd')](_0xf265('0xe'),moment()['format'](_0xf265('0xf')),_0xf7a711[_0xf265('0x10')][_0xf265('0x11')](),_0x1ad66a,_0xf7a711[_0xf265('0xa')]);}module[_0xf265('0x12')]=function(_0x10d2d0){return new winston[(_0xf265('0x13'))]({'transports':[new winston[(_0xf265('0x14'))][(_0xf265('0x15'))]({'name':util['format'](_0xf265('0x16'),_0x10d2d0,_0xf265('0x17')),'filename':filename(_0x10d2d0,'error'),'level':_0xf265('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2b1870){return formatter(_0x10d2d0,_0x2b1870);}}),new winston[(_0xf265('0x14'))][(_0xf265('0x15'))]({'name':util[_0xf265('0xd')](_0xf265('0x16'),_0x10d2d0,_0xf265('0x18')),'filename':filename(_0x10d2d0,_0xf265('0x18')),'level':_0xf265('0x18'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x528664){return formatter(_0x10d2d0,_0x528664);}}),new winston[(_0xf265('0x14'))][(_0xf265('0x19'))]({'level':process[_0xf265('0x1a')][_0xf265('0x1b')]||debugLevel,'json':![],'formatter':function(_0x35bece){return formatter(_0x10d2d0,_0x35bece);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 40a21bb..37df8a1 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 _0xcbe5=['../../services/ami/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami'];(function(_0xfc847d,_0x32af67){var _0x5cf95d=function(_0x2a659f){while(--_0x2a659f){_0xfc847d['push'](_0xfc847d['shift']());}};_0x5cf95d(++_0x32af67);}(_0xcbe5,0xbe));var _0x5cbe=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xcbe5[_0x1cc8fe];return _0x230054;};'use strict';var path=require(_0x5cbe('0x0'));var os=require('os');var config={'apps':[{'name':_0x5cbe('0x1'),'script':path[_0x5cbe('0x2')](__dirname,_0x5cbe('0x3'))},{'name':_0x5cbe('0x4'),'script':path['join'](__dirname,_0x5cbe('0x5'))},{'name':'agi','script':path[_0x5cbe('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x5cbe('0x6'),'script':path[_0x5cbe('0x2')](__dirname,_0x5cbe('0x7'))},{'name':_0x5cbe('0x8'),'script':path[_0x5cbe('0x2')](__dirname,_0x5cbe('0x9'))},{'name':_0x5cbe('0xa'),'script':path[_0x5cbe('0x2')](__dirname,_0x5cbe('0xb'))}]};module[_0x5cbe('0xc')]=config; \ No newline at end of file +var _0xa3da=['express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x463e45,_0x1ff35f){var _0x172e49=function(_0x35f7d0){while(--_0x35f7d0){_0x463e45['push'](_0x463e45['shift']());}};_0x172e49(++_0x1ff35f);}(_0xa3da,0x151));var _0xaa3d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa3da[_0x3947c9];return _0x2e7871;};'use strict';var path=require(_0xaa3d('0x0'));var os=require('os');var config={'apps':[{'name':_0xaa3d('0x1'),'script':path[_0xaa3d('0x2')](__dirname,_0xaa3d('0x3'))},{'name':_0xaa3d('0x4'),'script':path[_0xaa3d('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0xaa3d('0x5'),'script':path[_0xaa3d('0x2')](__dirname,_0xaa3d('0x6'))},{'name':_0xaa3d('0x7'),'script':path[_0xaa3d('0x2')](__dirname,'../../services/email/index.js')},{'name':_0xaa3d('0x8'),'script':path[_0xaa3d('0x2')](__dirname,_0xaa3d('0x9'))},{'name':_0xaa3d('0xa'),'script':path[_0xaa3d('0x2')](__dirname,_0xaa3d('0xb'))}]};module[_0xaa3d('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b721cc5..9007055 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 _0xf51c=['dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','restart','list','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf51c,0x84));var _0xcf51=function(_0x107929,_0x1767e5){_0x107929=_0x107929-0x0;var _0x4c0e28=_0xf51c[_0x107929];return _0x4c0e28;};'use strict';var pm2=require(_0xcf51('0x0'));var BPromise=require(_0xcf51('0x1'));var config=require(_0xcf51('0x2'));function connect(){return new BPromise(function(_0x18548c,_0x1fc48e){return pm2[_0xcf51('0x3')](function(_0x59666b){if(_0x59666b){return _0x1fc48e(_0x59666b);}return _0x18548c(_0xcf51('0x4'));});});};exports[_0xcf51('0x5')]=function(_0x2add65){return connect()[_0xcf51('0x6')](function(){return new BPromise(function(_0x3b8c37,_0x538047){return pm2['start'](_0x2add65,function(_0x41338a,_0x1ec6f2){if(_0x41338a){return _0x538047(_0x41338a);}pm2[_0xcf51('0x7')]();return _0x3b8c37(_0x1ec6f2);});});});};exports['stop']=function(_0x354afe){return connect()[_0xcf51('0x6')](function(){return new BPromise(function(_0xf6af35,_0xd6df19){return pm2['stop'](_0x354afe,function(_0x103a87,_0x1ae9a7){if(_0x103a87){return _0xd6df19(_0x103a87);}pm2[_0xcf51('0x7')]();return _0xf6af35(_0x1ae9a7);});});});};exports['restart']=function(_0x3a1918){return connect()[_0xcf51('0x6')](function(){return new BPromise(function(_0x4cf8d6,_0x4fee7f){return pm2[_0xcf51('0x8')](_0x3a1918,function(_0x21d1ee,_0x2e213f){if(_0x21d1ee){return _0x4fee7f(_0x21d1ee);}pm2[_0xcf51('0x7')]();return _0x4cf8d6(_0x2e213f);});});});};exports[_0xcf51('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3c9073,_0x226824){return pm2[_0xcf51('0x9')](function(_0x323307,_0x5411f0){if(_0x323307){return _0x226824(_0x323307);}pm2[_0xcf51('0x7')]();return _0x3c9073(_0x5411f0);});});});};exports['describe']=function(_0x4cd509){return connect()['then'](function(){return new BPromise(function(_0x2c1bbb,_0x54544d){return pm2['describe'](_0x4cd509,function(_0x4176e5,_0x59088f){if(_0x4176e5){return _0x54544d(_0x4176e5);}pm2['disconnect']();return _0x2c1bbb(_0x59088f);});});});};exports[_0xcf51('0xa')]=function(_0x2eb22a){return connect()['then'](function(){return new BPromise(function(_0x903cd9,_0xa58ad6){return pm2['delete'](_0x2eb22a,function(_0x45ee44,_0x5e1a5e){if(_0x45ee44){return _0xa58ad6(_0x45ee44);}pm2[_0xcf51('0x7')]();return _0x903cd9(_0x5e1a5e);});});});};exports[_0xcf51('0xb')]=function(){return connect()[_0xcf51('0x6')](function(){return new BPromise(function(_0x479307,_0xbf5e4f){return pm2[_0xcf51('0xb')](function(_0x69b137){if(_0x69b137){return _0xbf5e4f(_0x69b137);}return _0x479307(_0xcf51('0xc'));});});});}; \ No newline at end of file +var _0x547d=['./config','connected','start','then','stop','disconnect','restart','describe','delete','dump','saved','pm2','bluebird'];(function(_0xda21e8,_0x19d184){var _0x28904b=function(_0x10c833){while(--_0x10c833){_0xda21e8['push'](_0xda21e8['shift']());}};_0x28904b(++_0x19d184);}(_0x547d,0x1c5));var _0xd547=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0x547d[_0x2da357];return _0x138fdd;};'use strict';var pm2=require(_0xd547('0x0'));var BPromise=require(_0xd547('0x1'));var config=require(_0xd547('0x2'));function connect(){return new BPromise(function(_0x86ab3c,_0x2f2fa7){return pm2['connect'](function(_0x439e7f){if(_0x439e7f){return _0x2f2fa7(_0x439e7f);}return _0x86ab3c(_0xd547('0x3'));});});};exports[_0xd547('0x4')]=function(_0x2508b5){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0x20f318,_0x1da6c3){return pm2[_0xd547('0x4')](_0x2508b5,function(_0x2e7698,_0x5c6c3e){if(_0x2e7698){return _0x1da6c3(_0x2e7698);}pm2['disconnect']();return _0x20f318(_0x5c6c3e);});});});};exports[_0xd547('0x6')]=function(_0x1ea4d2){return connect()['then'](function(){return new BPromise(function(_0x695080,_0x5eb9de){return pm2['stop'](_0x1ea4d2,function(_0x93052d,_0x3db835){if(_0x93052d){return _0x5eb9de(_0x93052d);}pm2[_0xd547('0x7')]();return _0x695080(_0x3db835);});});});};exports[_0xd547('0x8')]=function(_0x33e1f0){return connect()['then'](function(){return new BPromise(function(_0x4675e9,_0x5ac832){return pm2['restart'](_0x33e1f0,function(_0x49279d,_0x24e7f4){if(_0x49279d){return _0x5ac832(_0x49279d);}pm2[_0xd547('0x7')]();return _0x4675e9(_0x24e7f4);});});});};exports['list']=function(){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0x1f0d0d,_0x12fedf){return pm2['list'](function(_0x23cad2,_0x59add1){if(_0x23cad2){return _0x12fedf(_0x23cad2);}pm2[_0xd547('0x7')]();return _0x1f0d0d(_0x59add1);});});});};exports[_0xd547('0x9')]=function(_0x449234){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0xba44fb,_0x367290){return pm2[_0xd547('0x9')](_0x449234,function(_0x989c6c,_0x5f0ca7){if(_0x989c6c){return _0x367290(_0x989c6c);}pm2['disconnect']();return _0xba44fb(_0x5f0ca7);});});});};exports[_0xd547('0xa')]=function(_0x27ef74){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0x154f5a,_0x53d396){return pm2[_0xd547('0xa')](_0x27ef74,function(_0x5110d1,_0x1906bd){if(_0x5110d1){return _0x53d396(_0x5110d1);}pm2[_0xd547('0x7')]();return _0x154f5a(_0x1906bd);});});});};exports[_0xd547('0xb')]=function(){return connect()[_0xd547('0x5')](function(){return new BPromise(function(_0x4c6657,_0x2f6654){return pm2[_0xd547('0xb')](function(_0x336644){if(_0x336644){return _0x2f6654(_0x336644);}return _0x4c6657(_0xd547('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 3b7c9ca..d1a1e76 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 _0x491f=['../logger','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb'];(function(_0x1e9e92,_0x1e4333){var _0x575589=function(_0x48cb07){while(--_0x48cb07){_0x1e9e92['push'](_0x1e9e92['shift']());}};_0x575589(++_0x1e4333);}(_0x491f,0x1da));var _0xf491=function(_0x114396,_0x366510){_0x114396=_0x114396-0x0;var _0x4594dc=_0x491f[_0x114396];return _0x4594dc;};'use strict';var _=require(_0xf491('0x0'));var moment=require(_0xf491('0x1'));var Redis=require(_0xf491('0x2'));var util=require(_0xf491('0x3'));var config=require(_0xf491('0x4'));var db=require(_0xf491('0x5'))['db'];var logger=require(_0xf491('0x6'))('schedule');config[_0xf491('0x7')]=_['defaults'](config[_0xf491('0x7')],{'host':_0xf491('0x8'),'port':0x18eb});var io=require(_0xf491('0x9'))(new Redis(config[_0xf491('0x7')]));function closeInteractions(){var _0x29364f=0x0;var _0x53a125=[];return db[_0xf491('0xa')][_0xf491('0xb')]({'raw':!![],'attributes':['id',_0xf491('0xc')],'where':{'id':0x1}})[_0xf491('0xd')](function(_0x12e74a){_0x29364f=_0x12e74a[_0xf491('0xc')];if(_0x29364f){return db[_0xf491('0xe')]['findAll']({'raw':!![],'attributes':['id',_0xf491('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf491('0x10')](_0x12e74a[_0xf491('0xc')],_0xf491('0x11'))}}});}else{return[];}})[_0xf491('0xd')](function(_0x1c7e15){if(_0x1c7e15&&_0x1c7e15[_0xf491('0x12')]){_0x53a125=_[_0xf491('0x13')](_0x1c7e15||[],'id');logger[_0xf491('0x14')](_0xf491('0x15'),_0x53a125[_0xf491('0x16')]());return db[_0xf491('0xe')]['update']({'closeReason':_0xf491('0x17'),'disposition':_0xf491('0x18'),'closed':!![],'closedAt':moment()[_0xf491('0x19')](_0xf491('0x1a'))},{'where':{'id':_0x53a125}});}})['then'](function(){if(_0x53a125&&_0x53a125[_0xf491('0x12')]){logger[_0xf491('0x14')](_0xf491('0x1b'),_0x53a125[_0xf491('0x16')]());for(var _0x31c758=0x0;_0x31c758<_0x53a125[_0xf491('0x12')];_0x31c758++){io[_0xf491('0x1c')]('chatInteraction:update',{'id':_0x53a125[_0x31c758],'closed':!![]});}}})[_0xf491('0x1d')](function(_0x5eef31){logger['error'](_0xf491('0x1e'),_0x5eef31?util['inspect'](_0x5eef31,{'showHidden':![],'depth':null}):'');});}exports[_0xf491('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0def=['ChatInteraction','findAll','lastMsgAt','subtract','chatTimeout','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','then'];(function(_0x372c96,_0x59799b){var _0x4ad389=function(_0x151c80){while(--_0x151c80){_0x372c96['push'](_0x372c96['shift']());}};_0x4ad389(++_0x59799b);}(_0x0def,0x12b));var _0xf0de=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x0def[_0x5d1044];return _0x3cd90e;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0xf0de('0x0'));var config=require(_0xf0de('0x1'));var db=require(_0xf0de('0x2'))['db'];var logger=require(_0xf0de('0x3'))(_0xf0de('0x4'));config[_0xf0de('0x5')]=_['defaults'](config[_0xf0de('0x5')],{'host':_0xf0de('0x6'),'port':0x18eb});var io=require(_0xf0de('0x7'))(new Redis(config[_0xf0de('0x5')]));function closeInteractions(){var _0x361528=0x0;var _0x3d2416=[];return db[_0xf0de('0x8')][_0xf0de('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xf0de('0xa')](function(_0x3b398f){_0x361528=_0x3b398f['chatTimeout'];if(_0x361528){return db[_0xf0de('0xb')][_0xf0de('0xc')]({'raw':!![],'attributes':['id',_0xf0de('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf0de('0xe')](_0x3b398f[_0xf0de('0xf')],'minutes')}}});}else{return[];}})[_0xf0de('0xa')](function(_0xa34c5a){if(_0xa34c5a&&_0xa34c5a[_0xf0de('0x10')]){_0x3d2416=_[_0xf0de('0x11')](_0xa34c5a||[],'id');logger[_0xf0de('0x12')](_0xf0de('0x13'),_0x3d2416[_0xf0de('0x14')]());return db[_0xf0de('0xb')][_0xf0de('0x15')]({'closeReason':_0xf0de('0x16'),'disposition':_0xf0de('0x17'),'closed':!![],'closedAt':moment()[_0xf0de('0x18')](_0xf0de('0x19'))},{'where':{'id':_0x3d2416}});}})[_0xf0de('0xa')](function(){if(_0x3d2416&&_0x3d2416[_0xf0de('0x10')]){logger[_0xf0de('0x12')](_0xf0de('0x1a'),_0x3d2416[_0xf0de('0x14')]());for(var _0xc3d2d3=0x0;_0xc3d2d3<_0x3d2416[_0xf0de('0x10')];_0xc3d2d3++){io['emit']('chatInteraction:update',{'id':_0x3d2416[_0xc3d2d3],'closed':!![]});}}})[_0xf0de('0x1b')](function(_0x16ee38){logger['error'](_0xf0de('0x1c'),_0x16ee38?util[_0xf0de('0x1d')](_0x16ee38,{'showHidden':![],'depth':null}):'');});}exports[_0xf0de('0x1e')]=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 15ad696..8c7ca2d 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 _0xbb52=['MailAccount','port','secure','authentication','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','message','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','stringify','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','CustomReportId','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','index','my\x20id','cron','active','isBetween','endAt','add','start','startAt','update','stop\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','host'];(function(_0x102860,_0xca27a3){var _0x54e391=function(_0xe0fb49){while(--_0xe0fb49){_0x102860['push'](_0x102860['shift']());}};_0x54e391(++_0xca27a3);}(_0xbb52,0xa1));var _0x2bb5=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0xbb52[_0xa9eaa0];return _0x30897a;};'use strict';var fs=require('fs');var util=require(_0x2bb5('0x0'));var path=require(_0x2bb5('0x1'));var _=require(_0x2bb5('0x2'));var moment=require('moment');var CronJobManager=require(_0x2bb5('0x3'));var jayson=require(_0x2bb5('0x4'));var BPromise=require(_0x2bb5('0x5'));var logger=require(_0x2bb5('0x6'))(_0x2bb5('0x7'));var db=require(_0x2bb5('0x8'))['db'];var analyticCustomReportController=require(_0x2bb5('0x9'));var analyticDefaultReportController=require(_0x2bb5('0xa'));var client=jayson[_0x2bb5('0xb')][_0x2bb5('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x43c7d1,_0x268c7a){return function(){logger[_0x2bb5('0xd')](_0x2bb5('0xe'),_0x43c7d1[_0x2bb5('0xf')]);var _0x2406b3=!![];var _0x3203c9={'tls':{'rejectUnauthorized':![]}};if(_0x43c7d1['MailAccount'][_0x2bb5('0x10')][_0x2bb5('0x11')]){_0x3203c9[_0x2bb5('0x11')]=_0x43c7d1['MailAccount'][_0x2bb5('0x10')][_0x2bb5('0x11')];}else{_0x3203c9[_0x2bb5('0x12')]=_0x43c7d1[_0x2bb5('0x13')][_0x2bb5('0x10')][_0x2bb5('0x12')];_0x3203c9[_0x2bb5('0x14')]=_0x43c7d1[_0x2bb5('0x13')]['Smtp'][_0x2bb5('0x14')];_0x3203c9[_0x2bb5('0x15')]=_0x43c7d1[_0x2bb5('0x13')][_0x2bb5('0x10')][_0x2bb5('0x15')];}if(_0x43c7d1[_0x2bb5('0x13')][_0x2bb5('0x10')][_0x2bb5('0x16')]){_0x3203c9['auth']={'user':_0x43c7d1[_0x2bb5('0x13')][_0x2bb5('0x10')]['user'],'pass':_0x43c7d1['MailAccount'][_0x2bb5('0x10')][_0x2bb5('0x17')]};}var _0x1c3db2={'account':_0x3203c9,'message':{'from':util[_0x2bb5('0x18')](_0x2bb5('0x19'),_0x43c7d1['MailAccount'][_0x2bb5('0x1a')],_0x43c7d1[_0x2bb5('0x13')][_0x2bb5('0xf')]||_0x43c7d1[_0x2bb5('0x13')][_0x2bb5('0x10')][_0x2bb5('0x1b')]),'to':_0x43c7d1[_0x2bb5('0xf')],'cc':_0x43c7d1['cc'],'bcc':_0x43c7d1[_0x2bb5('0x1c')],'subject':util[_0x2bb5('0x18')](_0x2bb5('0x1d'),_0x268c7a[_0x2bb5('0x1a')],_0x43c7d1['subtractNumber'],_0x43c7d1[_0x2bb5('0x1e')])}};var _0x19c717=path[_0x2bb5('0x1f')](__dirname,_0x2bb5('0x20'));var _0x5b1382=_0x268c7a[_0x2bb5('0x21')];var _0x5c400e=util[_0x2bb5('0x18')](_0x2bb5('0x22'),path[_0x2bb5('0x23')](_0x268c7a[_0x2bb5('0x21')],path[_0x2bb5('0x24')](_0x268c7a[_0x2bb5('0x21')])),_0x2bb5('0x25'));var _0x23fa64=path[_0x2bb5('0x1f')](_0x19c717,_0x5b1382);var _0x4d58da=path[_0x2bb5('0x1f')](_0x19c717,_0x5c400e);if(fs[_0x2bb5('0x26')](_0x23fa64)){_0x268c7a[_0x2bb5('0x27')]=_0x2bb5('0x28');_0x1c3db2['message'][_0x2bb5('0x29')]=[{'filename':_0x5b1382,'path':_0x23fa64}];_0x1c3db2['message'][_0x2bb5('0x2a')]=util[_0x2bb5('0x18')](_0x2bb5('0x2b'),JSON['stringify'](_0x268c7a,null,0x2));}else if(fs[_0x2bb5('0x26')](_0x4d58da)){_0x268c7a[_0x2bb5('0x27')]=_0x2bb5('0x28');_0x1c3db2[_0x2bb5('0x2c')][_0x2bb5('0x29')]=[{'filename':_0x5c400e,'path':_0x4d58da}];}else{_0x1c3db2[_0x2bb5('0x2c')][_0x2bb5('0x2a')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x43c7d1['sendIfEmpty']){_0x2406b3=![];logger['info'](_0x2bb5('0x2d'));}}if(_0x2406b3){return client[_0x2bb5('0x2e')](_0x2bb5('0x2f'),_0x1c3db2)['then'](function(_0x5d130c){if(_0x5d130c['error']){return logger[_0x2bb5('0x30')](_0x2bb5('0x31'),JSON['stringify'](_0x5d130c));}return logger[_0x2bb5('0xd')](_0x2bb5('0x32'));})[_0x2bb5('0x33')](function(_0x1d79bf){return logger[_0x2bb5('0x30')](_0x2bb5('0x31'),JSON[_0x2bb5('0x34')](_0x1d79bf));});}};}function handleError(){return function(_0x74554b){return logger[_0x2bb5('0x30')](JSON[_0x2bb5('0x34')](_0x74554b));};}function handleResult(_0x5dd037){return function(_0x9d0910){logger[_0x2bb5('0xd')](_0x2bb5('0x35'),JSON[_0x2bb5('0x34')](_0x9d0910));if(_0x5dd037[_0x2bb5('0x13')]&&_0x5dd037[_0x2bb5('0x13')][_0x2bb5('0x10')]&&!_[_0x2bb5('0x36')](_0x5dd037[_0x2bb5('0xf')])){setTimeout(handleSendEmail(_0x5dd037,_0x9d0910),0x3c*0x3e8);}};}function handleJob(_0x55b817){return function(){try{if(_['isNil'](_0x55b817[_0x2bb5('0x37')])){return logger['info'](_0x2bb5('0x38'));}if(_[_0x2bb5('0x36')](_0x55b817[_0x2bb5('0x1e')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x1ff391={'startDate':moment()[_0x2bb5('0x39')](_0x55b817['subtractNumber'],_0x55b817[_0x2bb5('0x1e')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x2bb5('0x18')](_0x2bb5('0x3a')),'type':_0x2bb5('0x3b'),'output':_0x55b817[_0x2bb5('0x3c')],'name':_0x55b817['name']};if(!_[_0x2bb5('0x36')](_0x55b817[_0x2bb5('0x3d')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x55b817['DefaultReportId']);return analyticDefaultReportController[_0x2bb5('0x3e')]({'id':_0x55b817[_0x2bb5('0x3d')]},_0x1ff391)[_0x2bb5('0x3f')](handleResult(_0x55b817))[_0x2bb5('0x33')](handleError());}if(!_['isNil'](_0x55b817[_0x2bb5('0x40')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x55b817[_0x2bb5('0x40')]);return analyticCustomReportController[_0x2bb5('0x3e')]({'id':_0x55b817[_0x2bb5('0x40')]},_0x1ff391)[_0x2bb5('0x3f')](handleResult(_0x55b817))['catch'](handleError());}}catch(_0x3839d7){logger['error'](JSON[_0x2bb5('0x34')](_0x3839d7));}return logger[_0x2bb5('0xd')]('no\x20report\x20id');};}function getJobs(_0xefcce4){var _0x16f400={};if(_0xefcce4){_0x16f400['id']=_0xefcce4;}return db[_0x2bb5('0x41')][_0x2bb5('0x42')]({'where':_0x16f400,'include':[{'model':db[_0x2bb5('0x13')],'attributes':['id',_0x2bb5('0x1a'),_0x2bb5('0xf')],'include':[{'model':db[_0x2bb5('0x43')],'as':_0x2bb5('0x10')}]}]})[_0x2bb5('0x3f')](function(_0x49e2ee){var _0x534a89=_['keys'](manager[_0x2bb5('0x44')]);var _0x1d3314=_[_0x2bb5('0x45')](_0x49e2ee,function(_0x2b8901){return _0x2b8901['id'][_0x2bb5('0x46')]();});var _0xf69f67=_[_0x2bb5('0x47')](_0x49e2ee,function(_0x4d4f65){return _0x4d4f65['id']['toString']();});var _0x1aa283=_0xefcce4?_0x1d3314:_['difference'](_0x1d3314,_0x534a89);var _0xda1051=_[_0x2bb5('0x48')](_0x1d3314,_0x534a89);var _0x3bee5=_[_0x2bb5('0x49')](_0x534a89,_0x1d3314);var _0x549bbd;var _0x47d0a6;for(_0x549bbd=0x0;_0x549bbd<_0x3bee5[_0x2bb5('0x4a')]&&!_0xefcce4;_0x549bbd+=0x1){_0x47d0a6=_0x3bee5[_0x549bbd][_0x2bb5('0x46')]();if(manager[_0x2bb5('0x4b')](_0x47d0a6)){manager[_0x2bb5('0x4c')](_0x47d0a6);manager[_0x2bb5('0x4d')](_0x47d0a6);logger[_0x2bb5('0xd')]('delete\x20cron',_0x47d0a6);}}logger[_0x2bb5('0xd')]('toRun',JSON[_0x2bb5('0x34')](_0x1aa283));for(_0x549bbd=0x0;_0x549bbd<_0x1aa283[_0x2bb5('0x4a')];_0x549bbd+=0x1){_0x47d0a6=_0x1aa283[_0x549bbd]['toString']();logger[_0x2bb5('0xd')](_0x2bb5('0x4e'),_0x47d0a6);if(_0xefcce4){logger[_0x2bb5('0xd')](_0x2bb5('0x4f'),_0xefcce4);logger[_0x2bb5('0xd')](JSON[_0x2bb5('0x34')](_0xf69f67[_0x47d0a6]));BPromise['resolve']()[_0x2bb5('0x3f')](handleJob(_0xf69f67[_0x47d0a6]));logger['info']('run\x20job',_0xf69f67[_0x47d0a6][_0x2bb5('0x1a')],_0xf69f67[_0x47d0a6][_0x2bb5('0x50')]);}else if(_0xf69f67[_0x47d0a6][_0x2bb5('0x50')]&&_0xf69f67[_0x47d0a6][_0x2bb5('0x51')]&&moment()[_0x2bb5('0x52')](_0xf69f67[_0x47d0a6]['startAt'],_0xf69f67[_0x47d0a6][_0x2bb5('0x53')])){manager[_0x2bb5('0x54')](_0x47d0a6,_0xf69f67[_0x47d0a6][_0x2bb5('0x50')],handleJob(_0xf69f67[_0x47d0a6]));manager[_0x2bb5('0x55')](_0x47d0a6);logger[_0x2bb5('0xd')]('add\x20cron',_0xf69f67[_0x47d0a6][_0x2bb5('0x1a')],_0xf69f67[_0x47d0a6][_0x2bb5('0x50')]);}else if(manager[_0x2bb5('0x4b')](_0x47d0a6)){manager['stop'](_0x47d0a6);manager[_0x2bb5('0x4d')](_0x47d0a6);logger[_0x2bb5('0xd')]('stop\x20cron',_0xf69f67[_0x47d0a6][_0x2bb5('0x1a')],_0xf69f67[_0x47d0a6]['cron']);}}for(_0x549bbd=0x0,_0x47d0a6;_0x549bbd<_0xda1051[_0x2bb5('0x4a')]&&!_0xefcce4;_0x549bbd+=0x1){_0x47d0a6=_0xda1051[_0x549bbd][_0x2bb5('0x46')]();if(manager['exists'](_0x47d0a6)){if(_0xf69f67[_0x47d0a6]['cron']&&_0xf69f67[_0x47d0a6][_0x2bb5('0x51')]&&moment()[_0x2bb5('0x52')](_0xf69f67[_0x47d0a6][_0x2bb5('0x56')],_0xf69f67[_0x47d0a6][_0x2bb5('0x53')])){manager[_0x2bb5('0x57')](_0x47d0a6,_0xf69f67[_0x47d0a6][_0x2bb5('0x50')],handleJob(_0xf69f67[_0x47d0a6]));logger[_0x2bb5('0xd')]('update\x20cron',_0xf69f67[_0x47d0a6][_0x2bb5('0x1a')],_0xf69f67[_0x47d0a6][_0x2bb5('0x50')]);}else{manager[_0x2bb5('0x4c')](_0x47d0a6);manager['deleteJob'](_0x47d0a6);logger[_0x2bb5('0xd')](_0x2bb5('0x58'),_0xf69f67[_0x47d0a6]['name'],_0xf69f67[_0x47d0a6]['cron']);}}}})[_0x2bb5('0x33')](function(_0x57b5d7){logger[_0x2bb5('0x30')](JSON[_0x2bb5('0x34')](_0x57b5d7));});}exports[_0x2bb5('0x59')]=function(_0x32ffa2){return getJobs(_0x32ffa2);};exports[_0x2bb5('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xcc01=['\x22%s\x22\x20<%s>','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','Sent','message','attachments','text','stringify','existsSync','status','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','keys','jobs','map','toString','difference','intersection','length','exists','stop','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','add','add\x20cron','stop\x20cron','update','update\x20cron','deleteJob','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format'];(function(_0x3e7bc8,_0x317f27){var _0x1932a9=function(_0xa8a526){while(--_0xa8a526){_0x3e7bc8['push'](_0x3e7bc8['shift']());}};_0x1932a9(++_0x317f27);}(_0xcc01,0x1b7));var _0x1cc0=function(_0x2ed1ae,_0x2b49f1){_0x2ed1ae=_0x2ed1ae-0x0;var _0x57ef10=_0xcc01[_0x2ed1ae];return _0x57ef10;};'use strict';var fs=require('fs');var util=require(_0x1cc0('0x0'));var path=require(_0x1cc0('0x1'));var _=require(_0x1cc0('0x2'));var moment=require(_0x1cc0('0x3'));var CronJobManager=require(_0x1cc0('0x4'));var jayson=require(_0x1cc0('0x5'));var BPromise=require(_0x1cc0('0x6'));var logger=require(_0x1cc0('0x7'))(_0x1cc0('0x8'));var db=require(_0x1cc0('0x9'))['db'];var analyticCustomReportController=require(_0x1cc0('0xa'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1cc0('0xb')][_0x1cc0('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xc0840f,_0x12f6b5){return function(){logger[_0x1cc0('0xd')](_0x1cc0('0xe'),_0xc0840f['email']);var _0x1b1a1=!![];var _0x24ad12={'tls':{'rejectUnauthorized':![]}};if(_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')]['service']){_0x24ad12[_0x1cc0('0x11')]=_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')][_0x1cc0('0x11')];}else{_0x24ad12[_0x1cc0('0x12')]=_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')][_0x1cc0('0x12')];_0x24ad12[_0x1cc0('0x13')]=_0xc0840f[_0x1cc0('0xf')]['Smtp'][_0x1cc0('0x13')];_0x24ad12[_0x1cc0('0x14')]=_0xc0840f['MailAccount'][_0x1cc0('0x10')][_0x1cc0('0x14')];}if(_0xc0840f['MailAccount'][_0x1cc0('0x10')][_0x1cc0('0x15')]){_0x24ad12[_0x1cc0('0x16')]={'user':_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')][_0x1cc0('0x17')],'pass':_0xc0840f[_0x1cc0('0xf')]['Smtp'][_0x1cc0('0x18')]};}var _0x1dea4a={'account':_0x24ad12,'message':{'from':util[_0x1cc0('0x19')](_0x1cc0('0x1a'),_0xc0840f[_0x1cc0('0xf')]['name'],_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x1b')]||_0xc0840f[_0x1cc0('0xf')][_0x1cc0('0x10')][_0x1cc0('0x17')]),'to':_0xc0840f[_0x1cc0('0x1b')],'cc':_0xc0840f['cc'],'bcc':_0xc0840f[_0x1cc0('0x1c')],'subject':util[_0x1cc0('0x19')]('Report\x20%s\x20last\x20%s\x20%s',_0x12f6b5['name'],_0xc0840f[_0x1cc0('0x1d')],_0xc0840f[_0x1cc0('0x1e')])}};var _0x346a79=path[_0x1cc0('0x1f')](__dirname,_0x1cc0('0x20'));var _0x183c8e=_0x12f6b5['savename'];var _0x2d4328=util[_0x1cc0('0x19')](_0x1cc0('0x21'),path[_0x1cc0('0x22')](_0x12f6b5[_0x1cc0('0x23')],path[_0x1cc0('0x24')](_0x12f6b5['savename'])),_0x1cc0('0x25'));var _0x4e413d=path[_0x1cc0('0x1f')](_0x346a79,_0x183c8e);var _0x2a686f=path[_0x1cc0('0x1f')](_0x346a79,_0x2d4328);if(fs['existsSync'](_0x4e413d)){_0x12f6b5['status']=_0x1cc0('0x26');_0x1dea4a[_0x1cc0('0x27')][_0x1cc0('0x28')]=[{'filename':_0x183c8e,'path':_0x4e413d}];_0x1dea4a[_0x1cc0('0x27')][_0x1cc0('0x29')]=util[_0x1cc0('0x19')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x1cc0('0x2a')](_0x12f6b5,null,0x2));}else if(fs[_0x1cc0('0x2b')](_0x2a686f)){_0x12f6b5[_0x1cc0('0x2c')]=_0x1cc0('0x26');_0x1dea4a[_0x1cc0('0x27')]['attachments']=[{'filename':_0x2d4328,'path':_0x2a686f}];}else{_0x1dea4a['message'][_0x1cc0('0x29')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xc0840f[_0x1cc0('0x2d')]){_0x1b1a1=![];logger[_0x1cc0('0xd')](_0x1cc0('0x2e'));}}if(_0x1b1a1){return client['request'](_0x1cc0('0x2f'),_0x1dea4a)[_0x1cc0('0x30')](function(_0x24fccd){if(_0x24fccd['error']){return logger[_0x1cc0('0x31')]('error\x20mail',JSON[_0x1cc0('0x2a')](_0x24fccd));}return logger['info'](_0x1cc0('0x32'));})[_0x1cc0('0x33')](function(_0xb3d4b5){return logger['error'](_0x1cc0('0x34'),JSON['stringify'](_0xb3d4b5));});}};}function handleError(){return function(_0x194521){return logger[_0x1cc0('0x31')](JSON[_0x1cc0('0x2a')](_0x194521));};}function handleResult(_0x46a021){return function(_0x239ea5){logger[_0x1cc0('0xd')](_0x1cc0('0x35'),JSON[_0x1cc0('0x2a')](_0x239ea5));if(_0x46a021[_0x1cc0('0xf')]&&_0x46a021[_0x1cc0('0xf')][_0x1cc0('0x10')]&&!_[_0x1cc0('0x36')](_0x46a021[_0x1cc0('0x1b')])){setTimeout(handleSendEmail(_0x46a021,_0x239ea5),0x3c*0x3e8);}};}function handleJob(_0x5aa7c2){return function(){try{if(_[_0x1cc0('0x36')](_0x5aa7c2[_0x1cc0('0x1d')])){return logger[_0x1cc0('0xd')](_0x1cc0('0x37'));}if(_[_0x1cc0('0x36')](_0x5aa7c2['subtractUnit'])){return logger[_0x1cc0('0xd')](_0x1cc0('0x38'));}var _0x1f0598={'startDate':moment()[_0x1cc0('0x39')](_0x5aa7c2[_0x1cc0('0x1d')],_0x5aa7c2[_0x1cc0('0x1e')])[_0x1cc0('0x19')](_0x1cc0('0x3a')),'endDate':moment()[_0x1cc0('0x19')](_0x1cc0('0x3a')),'type':_0x1cc0('0x3b'),'output':_0x5aa7c2[_0x1cc0('0x3c')],'name':_0x5aa7c2[_0x1cc0('0x3d')]};if(!_[_0x1cc0('0x36')](_0x5aa7c2[_0x1cc0('0x3e')])){logger[_0x1cc0('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x5aa7c2[_0x1cc0('0x3e')]);return analyticDefaultReportController[_0x1cc0('0x3f')]({'id':_0x5aa7c2[_0x1cc0('0x3e')]},_0x1f0598)[_0x1cc0('0x30')](handleResult(_0x5aa7c2))[_0x1cc0('0x33')](handleError());}if(!_[_0x1cc0('0x36')](_0x5aa7c2[_0x1cc0('0x40')])){logger[_0x1cc0('0xd')](_0x1cc0('0x41'),_0x5aa7c2[_0x1cc0('0x40')]);return analyticCustomReportController[_0x1cc0('0x3f')]({'id':_0x5aa7c2[_0x1cc0('0x40')]},_0x1f0598)[_0x1cc0('0x30')](handleResult(_0x5aa7c2))['catch'](handleError());}}catch(_0x124e3c){logger[_0x1cc0('0x31')](JSON[_0x1cc0('0x2a')](_0x124e3c));}return logger[_0x1cc0('0xd')](_0x1cc0('0x42'));};}function getJobs(_0x5a5c77){var _0x296937={};if(_0x5a5c77){_0x296937['id']=_0x5a5c77;}return db['Schedule'][_0x1cc0('0x43')]({'where':_0x296937,'include':[{'model':db[_0x1cc0('0xf')],'attributes':['id',_0x1cc0('0x3d'),_0x1cc0('0x1b')],'include':[{'model':db['MailServerOut'],'as':_0x1cc0('0x10')}]}]})[_0x1cc0('0x30')](function(_0x5ee77b){var _0x425949=_[_0x1cc0('0x44')](manager[_0x1cc0('0x45')]);var _0x1efacb=_[_0x1cc0('0x46')](_0x5ee77b,function(_0x21149a){return _0x21149a['id'][_0x1cc0('0x47')]();});var _0x13f5fe=_['keyBy'](_0x5ee77b,function(_0x2ecbab){return _0x2ecbab['id']['toString']();});var _0x1e9adf=_0x5a5c77?_0x1efacb:_[_0x1cc0('0x48')](_0x1efacb,_0x425949);var _0x545804=_[_0x1cc0('0x49')](_0x1efacb,_0x425949);var _0x365433=_[_0x1cc0('0x48')](_0x425949,_0x1efacb);var _0x4146f0;var _0xb1bd61;for(_0x4146f0=0x0;_0x4146f0<_0x365433[_0x1cc0('0x4a')]&&!_0x5a5c77;_0x4146f0+=0x1){_0xb1bd61=_0x365433[_0x4146f0]['toString']();if(manager[_0x1cc0('0x4b')](_0xb1bd61)){manager[_0x1cc0('0x4c')](_0xb1bd61);manager['deleteJob'](_0xb1bd61);logger[_0x1cc0('0xd')]('delete\x20cron',_0xb1bd61);}}logger[_0x1cc0('0xd')](_0x1cc0('0x4d'),JSON[_0x1cc0('0x2a')](_0x1e9adf));for(_0x4146f0=0x0;_0x4146f0<_0x1e9adf[_0x1cc0('0x4a')];_0x4146f0+=0x1){_0xb1bd61=_0x1e9adf[_0x4146f0][_0x1cc0('0x47')]();logger[_0x1cc0('0xd')](_0x1cc0('0x4e'),_0xb1bd61);if(_0x5a5c77){logger['info'](_0x1cc0('0x4f'),_0x5a5c77);logger['info'](JSON['stringify'](_0x13f5fe[_0xb1bd61]));BPromise['resolve']()[_0x1cc0('0x30')](handleJob(_0x13f5fe[_0xb1bd61]));logger['info'](_0x1cc0('0x50'),_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')]);}else if(_0x13f5fe[_0xb1bd61]['cron']&&_0x13f5fe[_0xb1bd61][_0x1cc0('0x52')]&&moment()[_0x1cc0('0x53')](_0x13f5fe[_0xb1bd61][_0x1cc0('0x54')],_0x13f5fe[_0xb1bd61]['endAt'])){manager[_0x1cc0('0x55')](_0xb1bd61,_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')],handleJob(_0x13f5fe[_0xb1bd61]));manager['start'](_0xb1bd61);logger[_0x1cc0('0xd')](_0x1cc0('0x56'),_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')]);}else if(manager[_0x1cc0('0x4b')](_0xb1bd61)){manager[_0x1cc0('0x4c')](_0xb1bd61);manager['deleteJob'](_0xb1bd61);logger[_0x1cc0('0xd')](_0x1cc0('0x57'),_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')]);}}for(_0x4146f0=0x0,_0xb1bd61;_0x4146f0<_0x545804[_0x1cc0('0x4a')]&&!_0x5a5c77;_0x4146f0+=0x1){_0xb1bd61=_0x545804[_0x4146f0][_0x1cc0('0x47')]();if(manager[_0x1cc0('0x4b')](_0xb1bd61)){if(_0x13f5fe[_0xb1bd61]['cron']&&_0x13f5fe[_0xb1bd61][_0x1cc0('0x52')]&&moment()[_0x1cc0('0x53')](_0x13f5fe[_0xb1bd61][_0x1cc0('0x54')],_0x13f5fe[_0xb1bd61]['endAt'])){manager[_0x1cc0('0x58')](_0xb1bd61,_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')],handleJob(_0x13f5fe[_0xb1bd61]));logger['info'](_0x1cc0('0x59'),_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61]['cron']);}else{manager['stop'](_0xb1bd61);manager[_0x1cc0('0x5a')](_0xb1bd61);logger[_0x1cc0('0xd')]('stop\x20cron',_0x13f5fe[_0xb1bd61][_0x1cc0('0x3d')],_0x13f5fe[_0xb1bd61][_0x1cc0('0x51')]);}}}})[_0x1cc0('0x33')](function(_0x68e3e3){logger[_0x1cc0('0x31')](JSON[_0x1cc0('0x2a')](_0x68e3e3));});}exports[_0x1cc0('0x5b')]=function(_0xffe507){return getJobs(_0xffe507);};exports[_0x1cc0('0x5c')]=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 b3cd7c9..6ea302c 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 _0x8eba=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','lodash','aws-sdk','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x2b7279,_0x4f2eed){var _0x495dad=function(_0x1ccba9){while(--_0x1ccba9){_0x2b7279['push'](_0x2b7279['shift']());}};_0x495dad(++_0x4f2eed);}(_0x8eba,0xc3));var _0xa8eb=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0x8eba[_0x152fe3];return _0xc5bb39;};var _=require(_0xa8eb('0x0'));var AWS=require(_0xa8eb('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0xa8eb('0x2'))['db'];var logger=require(_0xa8eb('0x3'))(_0xa8eb('0x4'));function getTranscriptionJob(_0x2cdf40,_0x52533a,_0x3a665b,_0x187bf0){return new Promise(function(_0x5abab9,_0x321f2f){var _0x5ece80=new AWS[(_0xa8eb('0x5'))]({'accessKeyId':_0x52533a,'secretAccessKey':_0x2cdf40,'region':_0x3a665b});_0x5ece80[_0xa8eb('0x6')]({'TranscriptionJobName':_0x187bf0},function(_0x509b54,_0x8b2ae9){if(_0x509b54){return _0x321f2f(_0x509b54);}else{return _0x5abab9(_0x8b2ae9);}});});}function sentiment(_0x5d6360,_0x21e416,_0x3010d0,_0x5eb605,_0x47032d){return new Promise(function(_0x796060,_0x3e45e7){var _0x4693d6=new AWS['Comprehend']({'accessKeyId':_0x21e416,'secretAccessKey':_0x5d6360,'region':_0x3010d0});_0x4693d6[_0xa8eb('0x7')]({'Text':_0x5eb605,'LanguageCode':_0x47032d['substring'](0x0,0x2)},function(_0x20a4ca,_0x501134){if(_0x20a4ca){return _0x3e45e7(_0x20a4ca);}else{return _0x796060(_0x501134);}});});}function checkTranscribeJob(_0x193a53,_0x47149c,_0x5b21fc){var _0x2c7cff;return new BPromise(function(_0x490c4f,_0x289ed3){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0xa'),_0x193a53['id'],_0x193a53['transcribeName']));return getTranscriptionJob(_0x5b21fc[_0xa8eb('0xb')],_0x5b21fc['data2'],_0x47149c[_0xa8eb('0xc')],_0x193a53[_0xa8eb('0xd')])[_0xa8eb('0xe')](function(_0x102a81){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0xf'),_0x193a53['id'],_0x193a53[_0xa8eb('0xd')],_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]));if(!_0x193a53['fileText']){switch(_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')]){case _0xa8eb('0x12'):var _0x445cc6={'transcribeStatus':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x11')],'fileUri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri']};logger['info'](util['format'](_0xa8eb('0x14'),_0x193a53['id']));return rp({'uri':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x13')]['TranscriptFileUri'],'json':!![]})[_0xa8eb('0xe')](function(_0x1025ef){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x15'),_0x193a53['id']));if(_0x1025ef&&_0x1025ef[_0xa8eb('0x16')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')]&&_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xa8eb('0x18')]){_0x445cc6[_0xa8eb('0x19')]='';for(var _0xee9db2=0x0;_0xee9db2<_0x1025ef['results'][_0xa8eb('0x17')][_0xa8eb('0x18')];_0xee9db2++){_0x445cc6[_0xa8eb('0x19')]+=_0x1025ef[_0xa8eb('0x16')][_0xa8eb('0x17')][_0xee9db2]['transcript']+'';}}return _0x193a53[_0xa8eb('0x1a')](_0x445cc6);})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x1b'),_0x193a53['id']));if(!_0x193a53['tempSentiment']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x1d'));}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x23'));}if(!_0x445cc6[_0xa8eb('0x19')]){throw new Error(_0xa8eb('0x24'));}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db['CloudProvider'][_0xa8eb('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xa8eb('0xe')](function(_0xdd5171){if(!_0xdd5171){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xdd5171[_0xa8eb('0xb')]||!_0xdd5171[_0xa8eb('0x26')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c7cff=_0xdd5171;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x445cc6['fileText'],_0x47149c[_0xa8eb('0x28')]);})['then'](function(_0x4a2a65){logger['info'](util[_0xa8eb('0x9')](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x4a2a65[_0xa8eb('0x2a')],'sPositive':_0x4a2a65[_0xa8eb('0x2b')]['Positive'],'sNegative':_0x4a2a65['SentimentScore'][_0xa8eb('0x2c')],'sMixed':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x4a2a65[_0xa8eb('0x2b')][_0xa8eb('0x2e')]});})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});case'FAILED':return _0x193a53[_0xa8eb('0x1a')]({'transcribeStatus':_0xa8eb('0x2f'),'failureReason':_0x102a81[_0xa8eb('0x10')][_0xa8eb('0x30')]})['then'](function(){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x1b'),_0x193a53['id']));_0x490c4f();});default:logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x31'),_0x193a53['id']));break;}}else{return BPromise['resolve']()[_0xa8eb('0xe')](function(){if(!_0x193a53[_0xa8eb('0x32')]){throw new db['Sequelize'][(_0xa8eb('0x1c'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x47149c[_0xa8eb('0x1e')]||!_0x47149c[_0xa8eb('0x1f')]||!_0x47149c[_0xa8eb('0x20')]||!_0x47149c['language']||!_0x47149c[_0xa8eb('0x21')]){throw new db['Sequelize']['ValidationError'](_0xa8eb('0x23'));}if(!_0x193a53[_0xa8eb('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x47149c[_0xa8eb('0x1f')]===_0x5b21fc['id']){return _0x5b21fc;}else{return db[_0xa8eb('0x33')][_0xa8eb('0x25')]({'where':{'id':_settings[_0xa8eb('0x1f')]}});}})[_0xa8eb('0xe')](function(_0x141986){if(!_0x141986){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x34'));}if(!_0x141986[_0xa8eb('0xb')]||!_0x141986['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x2c7cff=_0x141986;logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')](_0xa8eb('0x27'),_0x193a53['id']));return sentiment(_0x2c7cff[_0xa8eb('0xb')],_0x2c7cff[_0xa8eb('0x26')],_0x47149c[_0xa8eb('0x20')],_0x193a53['fileText'],_0x47149c['language']);})[_0xa8eb('0xe')](function(_0x1548b5){logger[_0xa8eb('0x8')](util['format'](_0xa8eb('0x29'),_0x193a53['id']));return _0x193a53[_0xa8eb('0x1a')]({'sentiment':_0x1548b5[_0xa8eb('0x2a')],'sPositive':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x36')],'sNegative':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2c')],'sMixed':_0x1548b5[_0xa8eb('0x2b')][_0xa8eb('0x2d')],'sNeutral':_0x1548b5['SentimentScore'][_0xa8eb('0x2e')],'transcribeStatus':'COMPLETED'});})[_0xa8eb('0xe')](function(){logger[_0xa8eb('0x8')](util[_0xa8eb('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x193a53['id']));_0x490c4f();});}})[_0xa8eb('0x37')](function(_0x1b3c2b){if(_0x1b3c2b){if(!_0x1b3c2b[_0xa8eb('0x38')]||_0x1b3c2b[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x9')](_0xa8eb('0x3b'),_0x193a53['id']),util[_0xa8eb('0x3c')](_0x1b3c2b,{'showHidden':![],'depth':null}));}}_0x490c4f();});});}function checkTranscribe(){var _0x54ae6b;var _0x481560;var _0x273fd0;return db[_0xa8eb('0x3d')][_0xa8eb('0x3e')]({'where':{'transcribeStatus':_0xa8eb('0x3f')}})['then'](function(_0x53dc8a){if(!_0x53dc8a||!_0x53dc8a['length']){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x40'));}_0x54ae6b=_0x53dc8a;return db[_0xa8eb('0x41')][_0xa8eb('0x25')]({'where':{'id':0x1}});})[_0xa8eb('0xe')](function(_0x31b4f7){if(!_0x31b4f7){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x42'));}_0x481560=_0x31b4f7;if(!_0x481560[_0xa8eb('0x4')]||!_0x481560[_0xa8eb('0x43')]||!_0x481560[_0xa8eb('0xc')]||!_0x481560[_0xa8eb('0x28')]||!_0x481560[_0xa8eb('0x21')]){throw new db[(_0xa8eb('0x22'))][(_0xa8eb('0x1c'))](_0xa8eb('0x44'));}return db[_0xa8eb('0x33')]['findOne']({'where':{'id':_0x481560['transcribeAccountId']}});})[_0xa8eb('0xe')](function(_0x5edfbe){if(!_0x5edfbe){throw new db[(_0xa8eb('0x22'))]['ValidationError'](_0xa8eb('0x34'));}if(!_0x5edfbe[_0xa8eb('0xb')]||!_0x5edfbe['data2']){throw new db['Sequelize'][(_0xa8eb('0x1c'))](_0xa8eb('0x35'));}_0x273fd0=_0x5edfbe;var _0x1251cd=[];_0x54ae6b[_0xa8eb('0x45')](function(_0x3a52d2){_0x1251cd[_0xa8eb('0x46')](checkTranscribeJob(_0x3a52d2,_0x481560,_0x273fd0));});return BPromise[_0xa8eb('0x47')](_0x1251cd);})[_0xa8eb('0x37')](function(_0x18e535){if(_0x18e535){if(!_0x18e535[_0xa8eb('0x38')]||_0x18e535[_0xa8eb('0x38')]!==_0xa8eb('0x39')){logger[_0xa8eb('0x3a')](util[_0xa8eb('0x3c')](_0x18e535,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x67da=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment','Negative','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','catch','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','info','format','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','update'];(function(_0x4d13ba,_0x425bd8){var _0x10e236=function(_0x585057){while(--_0x585057){_0x4d13ba['push'](_0x4d13ba['shift']());}};_0x10e236(++_0x425bd8);}(_0x67da,0x192));var _0xa67d=function(_0x1524a0,_0x1a9489){_0x1524a0=_0x1524a0-0x0;var _0x4ea1ab=_0x67da[_0x1524a0];return _0x4ea1ab;};var _=require('lodash');var AWS=require(_0xa67d('0x0'));var rp=require(_0xa67d('0x1'));var util=require(_0xa67d('0x2'));var BPromise=require(_0xa67d('0x3'));var db=require(_0xa67d('0x4'))['db'];var logger=require(_0xa67d('0x5'))(_0xa67d('0x6'));function getTranscriptionJob(_0x1a8b5e,_0x3dcee7,_0x359c06,_0x4851cb){return new Promise(function(_0x5b8ec7,_0x408786){var _0x4d2734=new AWS[(_0xa67d('0x7'))]({'accessKeyId':_0x3dcee7,'secretAccessKey':_0x1a8b5e,'region':_0x359c06});_0x4d2734[_0xa67d('0x8')]({'TranscriptionJobName':_0x4851cb},function(_0x10f89a,_0x2c37c2){if(_0x10f89a){return _0x408786(_0x10f89a);}else{return _0x5b8ec7(_0x2c37c2);}});});}function sentiment(_0x23cbc5,_0x285e16,_0x330a9f,_0x3e58e0,_0x1e1ef6){return new Promise(function(_0x3d9b30,_0x52a024){var _0x284d90=new AWS[(_0xa67d('0x9'))]({'accessKeyId':_0x285e16,'secretAccessKey':_0x23cbc5,'region':_0x330a9f});_0x284d90[_0xa67d('0xa')]({'Text':_0x3e58e0,'LanguageCode':_0x1e1ef6[_0xa67d('0xb')](0x0,0x2)},function(_0x50561d,_0x3cd18a){if(_0x50561d){return _0x52a024(_0x50561d);}else{return _0x3d9b30(_0x3cd18a);}});});}function checkTranscribeJob(_0x431f21,_0x560485,_0x4e86f6){var _0x304ee2;return new BPromise(function(_0x47ac79,_0x10d5ef){logger['info'](util['format'](_0xa67d('0xc'),_0x431f21['id'],_0x431f21[_0xa67d('0xd')]));return getTranscriptionJob(_0x4e86f6['data1'],_0x4e86f6[_0xa67d('0xe')],_0x560485[_0xa67d('0xf')],_0x431f21[_0xa67d('0xd')])[_0xa67d('0x10')](function(_0x5a47de){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x431f21['id'],_0x431f21[_0xa67d('0xd')],_0x5a47de['TranscriptionJob'][_0xa67d('0x11')]));if(!_0x431f21[_0xa67d('0x12')]){switch(_0x5a47de[_0xa67d('0x13')][_0xa67d('0x11')]){case _0xa67d('0x14'):var _0xb1ea04={'transcribeStatus':_0x5a47de[_0xa67d('0x13')]['TranscriptionJobStatus'],'fileUri':_0x5a47de[_0xa67d('0x13')][_0xa67d('0x15')][_0xa67d('0x16')]};logger[_0xa67d('0x17')](util[_0xa67d('0x18')](_0xa67d('0x19'),_0x431f21['id']));return rp({'uri':_0x5a47de['TranscriptionJob'][_0xa67d('0x15')][_0xa67d('0x16')],'json':!![]})[_0xa67d('0x10')](function(_0xed6c3e){logger[_0xa67d('0x17')](util[_0xa67d('0x18')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x431f21['id']));if(_0xed6c3e&&_0xed6c3e[_0xa67d('0x1a')]&&_0xed6c3e[_0xa67d('0x1a')][_0xa67d('0x1b')]&&_0xed6c3e[_0xa67d('0x1a')][_0xa67d('0x1b')][_0xa67d('0x1c')]){_0xb1ea04[_0xa67d('0x12')]='';for(var _0x5ed92a=0x0;_0x5ed92a<_0xed6c3e[_0xa67d('0x1a')][_0xa67d('0x1b')][_0xa67d('0x1c')];_0x5ed92a++){_0xb1ea04[_0xa67d('0x12')]+=_0xed6c3e[_0xa67d('0x1a')][_0xa67d('0x1b')][_0x5ed92a]['transcript']+'';}}return _0x431f21[_0xa67d('0x1d')](_0xb1ea04);})[_0xa67d('0x10')](function(){logger['info'](util[_0xa67d('0x18')](_0xa67d('0x1e'),_0x431f21['id']));if(!_0x431f21[_0xa67d('0x1f')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x22'));}if(!_0x560485[_0xa67d('0x23')]||!_0x560485[_0xa67d('0x24')]||!_0x560485[_0xa67d('0x25')]||!_0x560485[_0xa67d('0x26')]||!_0x560485[_0xa67d('0x27')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x28'));}if(!_0xb1ea04['fileText']){throw new Error(_0xa67d('0x29'));}if(_0x560485[_0xa67d('0x24')]===_0x4e86f6['id']){return _0x4e86f6;}else{return db[_0xa67d('0x2a')][_0xa67d('0x2b')]({'where':{'id':_settings[_0xa67d('0x24')]}});}})['then'](function(_0x371894){if(!_0x371894){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x2c'));}if(!_0x371894[_0xa67d('0x2d')]||!_0x371894[_0xa67d('0xe')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x2e'));}_0x304ee2=_0x371894;logger[_0xa67d('0x17')](util['format'](_0xa67d('0x2f'),_0x431f21['id']));return sentiment(_0x304ee2['data1'],_0x304ee2[_0xa67d('0xe')],_0x560485[_0xa67d('0x25')],_0xb1ea04[_0xa67d('0x12')],_0x560485['language']);})[_0xa67d('0x10')](function(_0x1fd5b6){logger[_0xa67d('0x17')](util[_0xa67d('0x18')](_0xa67d('0x30'),_0x431f21['id']));return _0x431f21[_0xa67d('0x1d')]({'sentiment':_0x1fd5b6['Sentiment'],'sPositive':_0x1fd5b6[_0xa67d('0x31')][_0xa67d('0x32')],'sNegative':_0x1fd5b6['SentimentScore']['Negative'],'sMixed':_0x1fd5b6['SentimentScore'][_0xa67d('0x33')],'sNeutral':_0x1fd5b6['SentimentScore'][_0xa67d('0x34')]});})[_0xa67d('0x10')](function(){logger[_0xa67d('0x17')](util[_0xa67d('0x18')](_0xa67d('0x1e'),_0x431f21['id']));_0x47ac79();});case _0xa67d('0x35'):return _0x431f21[_0xa67d('0x1d')]({'transcribeStatus':_0xa67d('0x35'),'failureReason':_0x5a47de[_0xa67d('0x13')][_0xa67d('0x36')]})[_0xa67d('0x10')](function(){logger[_0xa67d('0x17')](util[_0xa67d('0x18')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x431f21['id']));_0x47ac79();});default:logger['info'](util['format'](_0xa67d('0x37'),_0x431f21['id']));break;}}else{return BPromise['resolve']()[_0xa67d('0x10')](function(){if(!_0x431f21[_0xa67d('0x1f')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x560485[_0xa67d('0x23')]||!_0x560485[_0xa67d('0x24')]||!_0x560485[_0xa67d('0x25')]||!_0x560485[_0xa67d('0x26')]||!_0x560485[_0xa67d('0x27')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x431f21['fileText']){throw new Error(_0xa67d('0x29'));}if(_0x560485[_0xa67d('0x24')]===_0x4e86f6['id']){return _0x4e86f6;}else{return db[_0xa67d('0x2a')][_0xa67d('0x2b')]({'where':{'id':_settings[_0xa67d('0x24')]}});}})[_0xa67d('0x10')](function(_0x57a27d){if(!_0x57a27d){throw new db[(_0xa67d('0x20'))]['ValidationError'](_0xa67d('0x2c'));}if(!_0x57a27d[_0xa67d('0x2d')]||!_0x57a27d[_0xa67d('0xe')]){throw new db['Sequelize'][(_0xa67d('0x21'))](_0xa67d('0x2e'));}_0x304ee2=_0x57a27d;logger['info'](util['format'](_0xa67d('0x2f'),_0x431f21['id']));return sentiment(_0x304ee2['data1'],_0x304ee2[_0xa67d('0xe')],_0x560485[_0xa67d('0x25')],_0x431f21[_0xa67d('0x12')],_0x560485['language']);})[_0xa67d('0x10')](function(_0x5a2ac5){logger[_0xa67d('0x17')](util[_0xa67d('0x18')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x431f21['id']));return _0x431f21[_0xa67d('0x1d')]({'sentiment':_0x5a2ac5[_0xa67d('0x38')],'sPositive':_0x5a2ac5[_0xa67d('0x31')][_0xa67d('0x32')],'sNegative':_0x5a2ac5[_0xa67d('0x31')][_0xa67d('0x39')],'sMixed':_0x5a2ac5[_0xa67d('0x31')][_0xa67d('0x33')],'sNeutral':_0x5a2ac5['SentimentScore'][_0xa67d('0x34')],'transcribeStatus':_0xa67d('0x14')});})[_0xa67d('0x10')](function(){logger[_0xa67d('0x17')](util[_0xa67d('0x18')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x431f21['id']));_0x47ac79();});}})['catch'](function(_0x3f6711){if(_0x3f6711){if(!_0x3f6711[_0xa67d('0x3a')]||_0x3f6711[_0xa67d('0x3a')]!==_0xa67d('0x3b')){logger[_0xa67d('0x3c')](util['format'](_0xa67d('0x3d'),_0x431f21['id']),util['inspect'](_0x3f6711,{'showHidden':![],'depth':null}));}}_0x47ac79();});});}function checkTranscribe(){var _0x15ee01;var _0x2d926e;var _0x1c451f;return db[_0xa67d('0x3e')][_0xa67d('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xa67d('0x10')](function(_0x3c392f){if(!_0x3c392f||!_0x3c392f[_0xa67d('0x1c')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x40'));}_0x15ee01=_0x3c392f;return db['Setting'][_0xa67d('0x2b')]({'where':{'id':0x1}});})[_0xa67d('0x10')](function(_0x51c887){if(!_0x51c887){throw new db['Sequelize'][(_0xa67d('0x21'))](_0xa67d('0x41'));}_0x2d926e=_0x51c887;if(!_0x2d926e[_0xa67d('0x6')]||!_0x2d926e[_0xa67d('0x42')]||!_0x2d926e[_0xa67d('0xf')]||!_0x2d926e[_0xa67d('0x26')]||!_0x2d926e[_0xa67d('0x27')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))]('Transcribe\x20not\x20configured');}return db[_0xa67d('0x2a')][_0xa67d('0x2b')]({'where':{'id':_0x2d926e['transcribeAccountId']}});})[_0xa67d('0x10')](function(_0x18f99d){if(!_0x18f99d){throw new db['Sequelize'][(_0xa67d('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x18f99d[_0xa67d('0x2d')]||!_0x18f99d[_0xa67d('0xe')]){throw new db[(_0xa67d('0x20'))][(_0xa67d('0x21'))](_0xa67d('0x2e'));}_0x1c451f=_0x18f99d;var _0x17249a=[];_0x15ee01[_0xa67d('0x43')](function(_0xe0e2ed){_0x17249a[_0xa67d('0x44')](checkTranscribeJob(_0xe0e2ed,_0x2d926e,_0x1c451f));});return BPromise[_0xa67d('0x45')](_0x17249a);})[_0xa67d('0x46')](function(_0x4e4af3){if(_0x4e4af3){if(!_0x4e4af3[_0xa67d('0x3a')]||_0x4e4af3[_0xa67d('0x3a')]!==_0xa67d('0x3b')){logger[_0xa67d('0x3c')](util['inspect'](_0x4e4af3,{'showHidden':![],'depth':null}));}}});}exports[_0xa67d('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 a97eeab..ea7a7df 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 _0x879a=['info','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','then','length','map'];(function(_0x2a4ea4,_0x4d9e49){var _0x32d821=function(_0x3a03b3){while(--_0x3a03b3){_0x2a4ea4['push'](_0x2a4ea4['shift']());}};_0x32d821(++_0x4d9e49);}(_0x879a,0x12e));var _0xa879=function(_0xf0f266,_0x439a4a){_0xf0f266=_0xf0f266-0x0;var _0x4d5711=_0x879a[_0xf0f266];return _0x4d5711;};'use strict';var _=require(_0xa879('0x0'));var moment=require('moment');var Redis=require(_0xa879('0x1'));var util=require(_0xa879('0x2'));var config=require(_0xa879('0x3'));var db=require(_0xa879('0x4'))['db'];var logger=require(_0xa879('0x5'))(_0xa879('0x6'));config[_0xa879('0x7')]=_[_0xa879('0x8')](config[_0xa879('0x7')],{'host':_0xa879('0x9'),'port':0x18eb});var io=require(_0xa879('0xa'))(new Redis(config[_0xa879('0x7')]));function closeInteractions(){var _0x35467c=[];return db[_0xa879('0xb')][_0xa879('0xc')]({'raw':!![],'attributes':['id',_0xa879('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xa879('0xe')](function(_0x34d19f){if(_0x34d19f&&_0x34d19f[_0xa879('0xf')]){_0x35467c=_[_0xa879('0x10')](_0x34d19f||[],'id');logger[_0xa879('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x35467c[_0xa879('0x12')]());return db[_0xa879('0xb')][_0xa879('0x13')]({'closeReason':'system','disposition':_0xa879('0x14'),'closed':!![],'closedAt':moment()[_0xa879('0x15')](_0xa879('0x16'))},{'where':{'id':_0x35467c}});}})[_0xa879('0xe')](function(){if(_0x35467c&&_0x35467c[_0xa879('0xf')]){logger[_0xa879('0x11')](_0xa879('0x17'),_0x35467c['join']());for(var _0x4fb5f2=0x0;_0x4fb5f2<_0x35467c[_0xa879('0xf')];_0x4fb5f2++){io['emit'](_0xa879('0x18'),{'id':_0x35467c[_0x4fb5f2],'closed':!![]});}}})[_0xa879('0x19')](function(_0x1b85b4){logger[_0xa879('0x1a')](_0xa879('0x1b'),_0x1b85b4?util[_0xa879('0x1c')](_0x1b85b4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x02d5=['util','../../config/environment','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis'];(function(_0x571dbc,_0x400df9){var _0x55043c=function(_0x47df3b){while(--_0x47df3b){_0x571dbc['push'](_0x571dbc['shift']());}};_0x55043c(++_0x400df9);}(_0x02d5,0x17d));var _0x502d=function(_0x23082a,_0x445d35){_0x23082a=_0x23082a-0x0;var _0x4be541=_0x02d5[_0x23082a];return _0x4be541;};'use strict';var _=require(_0x502d('0x0'));var moment=require(_0x502d('0x1'));var Redis=require(_0x502d('0x2'));var util=require(_0x502d('0x3'));var config=require(_0x502d('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x502d('0x5'))(_0x502d('0x6'));config['redis']=_[_0x502d('0x7')](config[_0x502d('0x8')],{'host':_0x502d('0x9'),'port':0x18eb});var io=require(_0x502d('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x2503b3=[];return db[_0x502d('0xb')][_0x502d('0xc')]({'raw':!![],'attributes':['id',_0x502d('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x502d('0xe')](0x18,_0x502d('0xf'))}}})['then'](function(_0x45c8f6){if(_0x45c8f6&&_0x45c8f6[_0x502d('0x10')]){_0x2503b3=_[_0x502d('0x11')](_0x45c8f6||[],'id');logger[_0x502d('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2503b3['join']());return db[_0x502d('0xb')][_0x502d('0x13')]({'closeReason':_0x502d('0x14'),'disposition':_0x502d('0x15'),'closed':!![],'closedAt':moment()[_0x502d('0x16')](_0x502d('0x17'))},{'where':{'id':_0x2503b3}});}})[_0x502d('0x18')](function(){if(_0x2503b3&&_0x2503b3[_0x502d('0x10')]){logger[_0x502d('0x12')](_0x502d('0x19'),_0x2503b3[_0x502d('0x1a')]());for(var _0x4c0050=0x0;_0x4c0050<_0x2503b3[_0x502d('0x10')];_0x4c0050++){io['emit'](_0x502d('0x1b'),{'id':_0x2503b3[_0x4c0050],'closed':!![]});}}})['catch'](function(_0x674a31){logger[_0x502d('0x1c')](_0x502d('0x1d'),_0x674a31?util[_0x502d('0x1e')](_0x674a31,{'showHidden':![],'depth':null}):'');});}exports[_0x502d('0x1f')]=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 07c3772..1a5008c 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa78b=['now','CmContact','destroy','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','then','contacts2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x18ae4b,_0x3fccea){var _0x409b8b=function(_0x2d611c){while(--_0x2d611c){_0x18ae4b['push'](_0x18ae4b['shift']());}};_0x409b8b(++_0x3fccea);}(_0xa78b,0x8a));var _0xba78=function(_0x340e5f,_0x5b5642){_0x340e5f=_0x340e5f-0x0;var _0x40974c=_0xa78b[_0x340e5f];return _0x40974c;};'use strict';var util=require('util');var db=require(_0xba78('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xba78('0x1')]({'id':i,'firstName':_0xba78('0x2')+i,'lastName':_0xba78('0x3')+i,'phone':0xf879fb460+i,'email':_0xba78('0x4')+i+_0xba78('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xba78('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xba78('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xba78('0x1')]({'id':i,'firstName':_0xba78('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xba78('0x4')+i+_0xba78('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xba78('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xba78('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xba78('0x6')](),'updatedAt':Date[_0xba78('0x6')]()});}db[_0xba78('0x7')][_0xba78('0x8')]({'where':{}})['then'](function(){return db[_0xba78('0x7')]['bulkCreate'](contacts);})['then'](function(){console[_0xba78('0x9')](_0xba78('0xa'),_0xba78('0xb'));return db[_0xba78('0xc')][_0xba78('0x8')]({'where':{}});})['then'](function(){return db[_0xba78('0xc')][_0xba78('0xd')](hopper);})['then'](function(){console[_0xba78('0x9')](_0xba78('0xa'),_0xba78('0xe'));return db[_0xba78('0x7')][_0xba78('0xd')](contacts2);})[_0xba78('0xf')](function(){console[_0xba78('0x9')](_0xba78('0xa'),_0xba78('0x10'));return db[_0xba78('0xc')][_0xba78('0xd')](hopper2);})[_0xba78('0xf')](function(){console[_0xba78('0x9')](_0xba78('0xa'),'hopper2');})[_0xba78('0x11')](function(_0x3c16c6){console[_0xba78('0x9')](_0x3c16c6);}); \ No newline at end of file +var _0x5568=['util','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper2'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5568,0xc0));var _0x8556=function(_0x2e9a71,_0x11b783){_0x2e9a71=_0x2e9a71-0x0;var _0x1a397b=_0x5568[_0x2e9a71];return _0x1a397b;};'use strict';var util=require(_0x8556('0x0'));var db=require(_0x8556('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8556('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x8556('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8556('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8556('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x8556('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8556('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x8556('0x6')+i,'lastName':_0x8556('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8556('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8556('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8556('0x5')](),'updatedAt':Date[_0x8556('0x5')]()});}db[_0x8556('0x7')][_0x8556('0x8')]({'where':{}})[_0x8556('0x9')](function(){return db[_0x8556('0x7')]['bulkCreate'](contacts);})[_0x8556('0x9')](function(){console[_0x8556('0xa')](_0x8556('0xb'),_0x8556('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0x8556('0x9')](function(){return db[_0x8556('0xd')][_0x8556('0xe')](hopper);})['then'](function(){console[_0x8556('0xa')]('finished\x20populating','hopper1');return db[_0x8556('0x7')][_0x8556('0xe')](contacts2);})[_0x8556('0x9')](function(){console[_0x8556('0xa')](_0x8556('0xb'),'contacts2');return db[_0x8556('0xd')][_0x8556('0xe')](hopper2);})['then'](function(){console[_0x8556('0xa')](_0x8556('0xb'),_0x8556('0xf'));})['catch'](function(_0x5bd113){console[_0x8556('0xa')](_0x5bd113);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 77222e6..ce94bce 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe396=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes'];(function(_0x1d68e0,_0x4cc473){var _0x559e88=function(_0x2ec5b8){while(--_0x2ec5b8){_0x1d68e0['push'](_0x1d68e0['shift']());}};_0x559e88(++_0x4cc473);}(_0xe396,0x197));var _0x6e39=function(_0x11cc38,_0x1658ed){_0x11cc38=_0x11cc38-0x0;var _0x53ce51=_0xe396[_0x11cc38];return _0x53ce51;};'use strict';var util=require(_0x6e39('0x0'));var db=require(_0x6e39('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6e39('0x2')]({'name':util[_0x6e39('0x3')](_0x6e39('0x4'),_0x6e39('0x5'),i),'fullname':util['format'](_0x6e39('0x4'),_0x6e39('0x5'),i),'email':util[_0x6e39('0x3')](_0x6e39('0x6'),_0x6e39('0x5'),i),'role':'agent','password':_0x6e39('0x7'),'internal':0xfa0+i,'type':_0x6e39('0x8'),'transport':[_0x6e39('0x9'),'ws','wss'],'disallow':[_0x6e39('0xa')],'allow':[_0x6e39('0xb')],'defaultuser':util[_0x6e39('0x3')](_0x6e39('0x4'),_0x6e39('0x5'),i),'encryption':'yes','avpf':'yes','force_avp':_0x6e39('0xc'),'icesupport':_0x6e39('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x6e39('0xd'),'dtlsprivatekey':_0x6e39('0xe'),'dtlssetup':_0x6e39('0xf'),'callerid':util[_0x6e39('0x3')](_0x6e39('0x10'),util[_0x6e39('0x3')](_0x6e39('0x4'),_0x6e39('0x5'),i),0xfa0+i)});}db['User'][_0x6e39('0x11')](users)[_0x6e39('0x12')](function(){console[_0x6e39('0x13')]('add\x20user');})[_0x6e39('0x14')](function(_0xfd51c7){console[_0x6e39('0x13')](_0xfd51c7);}); \ No newline at end of file +var _0x32ed=['agent','%s%s','%s%s@xcally.com','password','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util','../mysqldb','push','format'];(function(_0x1be492,_0x57fe47){var _0x355ecf=function(_0x3b9eb0){while(--_0x3b9eb0){_0x1be492['push'](_0x1be492['shift']());}};_0x355ecf(++_0x57fe47);}(_0x32ed,0x176));var _0xd32e=function(_0x39a50f,_0x559bd0){_0x39a50f=_0x39a50f-0x0;var _0x3243d1=_0x32ed[_0x39a50f];return _0x3243d1;};'use strict';var util=require(_0xd32e('0x0'));var db=require(_0xd32e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd32e('0x2')]({'name':util[_0xd32e('0x3')]('%s%s',_0xd32e('0x4'),i),'fullname':util[_0xd32e('0x3')](_0xd32e('0x5'),_0xd32e('0x4'),i),'email':util[_0xd32e('0x3')](_0xd32e('0x6'),_0xd32e('0x4'),i),'role':_0xd32e('0x4'),'password':_0xd32e('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0xd32e('0x8'),'ws','wss'],'disallow':[_0xd32e('0x9')],'allow':[_0xd32e('0xa')],'defaultuser':util[_0xd32e('0x3')]('%s%s',_0xd32e('0x4'),i),'encryption':'yes','avpf':_0xd32e('0xb'),'force_avp':_0xd32e('0xb'),'icesupport':_0xd32e('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xd32e('0xc'),'dtlsprivatekey':_0xd32e('0xd'),'dtlssetup':_0xd32e('0xe'),'callerid':util['format'](_0xd32e('0xf'),util['format'](_0xd32e('0x5'),'agent',i),0xfa0+i)});}db[_0xd32e('0x10')][_0xd32e('0x11')](users)[_0xd32e('0x12')](function(){console[_0xd32e('0x13')]('add\x20user');})[_0xd32e('0x14')](function(_0x472d5e){console[_0xd32e('0x13')](_0x472d5e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 1b04a35..feca5ee 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b84=['query','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','VoiceQueue','FaxQueue','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','format','%s:queue:%s','length','user:%s','handshake'];(function(_0x3f6187,_0x210ac8){var _0x2a21b9=function(_0x8055ea){while(--_0x8055ea){_0x3f6187['push'](_0x3f6187['shift']());}};_0x2a21b9(++_0x210ac8);}(_0x7b84,0x17c));var _0x47b8=function(_0x23b547,_0x3cd347){_0x23b547=_0x23b547-0x0;var _0xccd8d6=_0x7b84[_0x23b547];return _0xccd8d6;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var BPromise=require(_0x47b8('0x2'));var db=require(_0x47b8('0x3'))['db'];var config=require(_0x47b8('0x4'));var queryQueues={'attributes':['id',_0x47b8('0x5')],'include':[{'as':_0x47b8('0x6'),'model':db['User'],'attributes':['id',_0x47b8('0x5'),_0x47b8('0x7')],'raw':!![],'where':{'role':_0x47b8('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x47b8('0x5')],'where':{'role':_0x47b8('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x47b8('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x47b8('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x47b8('0x5'),_0x47b8('0xa')],'where':{'type':_0x47b8('0xb')}};function getAssociatedResources(_0x2289d5,_0x1af17f,_0x24d240){return db[_0x47b8('0xc')][_0x47b8('0xd')]({'where':{'name':_0x2289d5,'userProfileId':_0x1af17f},'raw':!![]})[_0x47b8('0xe')](function(_0x289f98){if(_0x289f98){if(_0x289f98[_0x47b8('0xf')]){switch(_0x2289d5){case _0x47b8('0x10'):case _0x47b8('0x11'):case _0x47b8('0x12'):case _0x47b8('0x13'):case _0x47b8('0x14'):case _0x47b8('0x15'):case _0x47b8('0x16'):return db[_0x24d240][_0x47b8('0x17')](queryQueues);case _0x47b8('0x18'):return db[_0x24d240][_0x47b8('0x17')](queryTelephones);case _0x47b8('0x19'):return db[_0x24d240][_0x47b8('0x17')](queryTrunks);case _0x47b8('0x1a'):return db[_0x24d240][_0x47b8('0x17')](queryCampaigns);}}else{return db[_0x47b8('0x1b')]['findAll']({'attributes':[_0x47b8('0x1c')],'where':{'sectionId':_0x289f98['id']},'raw':!![]})[_0x47b8('0xe')](function(_0x3e760a){if(_0x3e760a){var _0x1217a4={'where':{'id':_[_0x47b8('0x1d')](_0x3e760a,_0x47b8('0x1c'))},'raw':!![]};switch(_0x24d240){case _0x47b8('0x1e'):_0x1217a4['where'][_0x47b8('0x7')]='telephone';break;case'Campaign':_0x1217a4['where'][_0x47b8('0xa')]=_0x47b8('0xb');break;}return db[_0x24d240][_0x47b8('0x17')](_0x1217a4);}else{return[];}});}}else{return[];}})['then'](function(_0x502a23){return _0x502a23;});}function joinOrLeaveQueues(_0x4f6716,_0x1c5bfd,_0x5531a2,_0x2a4fa7){_0x4f6716[_0x1c5bfd](util[_0x47b8('0x1f')](_0x47b8('0x20'),_0x5531a2,_0x2a4fa7[_0x47b8('0x5')]));if(_0x2a4fa7['Agents']){for(var _0xc20df1=0x0;_0xc20df1<_0x2a4fa7[_0x47b8('0x6')][_0x47b8('0x21')];_0xc20df1+=0x1){_0x4f6716[_0x1c5bfd](util[_0x47b8('0x1f')](_0x47b8('0x22'),_0x2a4fa7[_0x47b8('0x6')][_0xc20df1]['name']));}}}function joinOrLeave(_0x31555d,_0x2a22e3,_0x5301f8){var _0x22e7dd;if(_0x31555d[_0x47b8('0x23')][_0x47b8('0x24')]['id']){db[_0x47b8('0x1e')]['find']({'attributes':['id',_0x47b8('0x5'),_0x47b8('0x7'),_0x47b8('0x25')],'where':{'id':_0x31555d[_0x47b8('0x23')][_0x47b8('0x24')]['id']},'include':[{'model':db[_0x47b8('0x26')],'as':_0x47b8('0x27'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x47b8('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x47b8('0x29')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x47b8('0x2a')],'as':_0x47b8('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x47b8('0x2c')],'as':_0x47b8('0x2d'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x47b8('0x2e'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2c89fc){if(_0x2c89fc){_0x22e7dd=_0x2c89fc;_0x31555d[_0x2a22e3](util[_0x47b8('0x1f')](_0x47b8('0x22'),_0x2c89fc[_0x47b8('0x5')]));var _0x47e2a1=[];switch(_0x2c89fc[_0x47b8('0x7')]){case _0x47b8('0x2f'):_0x31555d[_0x2a22e3](_0x47b8('0x30'));_0x31555d[_0x2a22e3](_0x47b8('0x31'));if(queryQueues[_0x47b8('0x32')](_0x47b8('0x33'))){delete queryQueues['include'];}_0x47e2a1['push'](db['VoiceQueue'][_0x47b8('0x17')](queryQueues));_0x47e2a1[_0x47b8('0x34')](db[_0x47b8('0x35')]['findAll'](queryQueues));_0x47e2a1['push'](db['FaxQueue']['findAll'](queryQueues));_0x47e2a1[_0x47b8('0x34')](db[_0x47b8('0x36')][_0x47b8('0x17')](queryQueues));_0x47e2a1[_0x47b8('0x34')](db[_0x47b8('0x37')][_0x47b8('0x17')](queryQueues));_0x47e2a1[_0x47b8('0x34')](db[_0x47b8('0x38')][_0x47b8('0x17')](queryQueues));_0x47e2a1['push'](db['WhatsappQueue'][_0x47b8('0x17')](queryQueues));_0x47e2a1[_0x47b8('0x34')](db['User']['findAll'](queryTelephones));_0x47e2a1[_0x47b8('0x34')](db[_0x47b8('0x39')][_0x47b8('0x17')](queryTrunks));_0x47e2a1['push'](db[_0x47b8('0x3a')][_0x47b8('0x17')](queryCampaigns));_0x47e2a1['push'](db['User']['findAll'](queryAgents));break;case'user':_0x31555d[_0x2a22e3](_0x47b8('0x30'));_0x31555d[_0x2a22e3](_0x47b8('0x31'));_0x47e2a1[_0x47b8('0x34')](getAssociatedResources(_0x47b8('0x10'),_0x2c89fc[_0x47b8('0x25')],_0x47b8('0x3b')));_0x47e2a1['push'](getAssociatedResources('ChatQueues',_0x2c89fc[_0x47b8('0x25')],_0x47b8('0x35')));_0x47e2a1[_0x47b8('0x34')](getAssociatedResources('FaxQueues',_0x2c89fc['userProfileId'],_0x47b8('0x3c')));_0x47e2a1[_0x47b8('0x34')](getAssociatedResources('SmsQueues',_0x2c89fc[_0x47b8('0x25')],_0x47b8('0x36')));_0x47e2a1['push'](getAssociatedResources('MailQueues',_0x2c89fc['userProfileId'],'MailQueue'));_0x47e2a1[_0x47b8('0x34')](getAssociatedResources(_0x47b8('0x15'),_0x2c89fc[_0x47b8('0x25')],_0x47b8('0x38')));_0x47e2a1[_0x47b8('0x34')](getAssociatedResources('WhatsappQueues',_0x2c89fc[_0x47b8('0x25')],'WhatsappQueue'));_0x47e2a1[_0x47b8('0x34')](getAssociatedResources(_0x47b8('0x18'),_0x2c89fc[_0x47b8('0x25')],'User'));_0x47e2a1[_0x47b8('0x34')](getAssociatedResources(_0x47b8('0x19'),_0x2c89fc[_0x47b8('0x25')],_0x47b8('0x39')));_0x47e2a1[_0x47b8('0x34')](getAssociatedResources(_0x47b8('0x1a'),_0x2c89fc[_0x47b8('0x25')],'Campaign'));_0x47e2a1[_0x47b8('0x34')](db['User'][_0x47b8('0x17')](queryAgents));break;case _0x47b8('0x8'):_0x31555d[_0x2a22e3](_0x47b8('0x30'));_0x31555d[_0x2a22e3](_0x47b8('0x31'));_0x47e2a1[_0x47b8('0x34')](_0x2c89fc[_0x47b8('0x3d')]({'attributes':['id','name']}));_0x47e2a1['push'](_0x2c89fc[_0x47b8('0x3e')]({'attributes':['id',_0x47b8('0x5')]}));_0x47e2a1[_0x47b8('0x34')](_0x2c89fc['getFaxQueues']({'attributes':['id',_0x47b8('0x5')]}));_0x47e2a1['push'](_0x2c89fc[_0x47b8('0x3f')]({'attributes':['id',_0x47b8('0x5')]}));_0x47e2a1[_0x47b8('0x34')](_0x2c89fc[_0x47b8('0x40')]({'attributes':['id',_0x47b8('0x5')]}));_0x47e2a1['push'](_0x2c89fc[_0x47b8('0x41')]({'attributes':['id',_0x47b8('0x5')]}));_0x47e2a1[_0x47b8('0x34')](_0x2c89fc[_0x47b8('0x42')]({'attributes':['id',_0x47b8('0x5')]}));break;}return BPromise[_0x47b8('0x43')](_0x47e2a1);}})[_0x47b8('0xe')](function(_0x4d09c2){if(_0x4d09c2&&_0x4d09c2[_0x47b8('0x21')]){for(var _0x4bc93d=0x0;_0x4bc93d<_0x4d09c2[_0x47b8('0x21')];_0x4bc93d+=0x1){for(var _0x2b46da=0x0;_0x2b46da<_0x4d09c2[_0x4bc93d]['length'];_0x2b46da+=0x1){switch(_0x4bc93d){case 0x0:joinOrLeaveQueues(_0x31555d,_0x2a22e3,_0x47b8('0x44'),_0x4d09c2[_0x4bc93d][_0x2b46da]);break;case 0x1:joinOrLeaveQueues(_0x31555d,_0x2a22e3,_0x47b8('0x45'),_0x4d09c2[_0x4bc93d][_0x2b46da]);break;case 0x2:joinOrLeaveQueues(_0x31555d,_0x2a22e3,_0x47b8('0x46'),_0x4d09c2[_0x4bc93d][_0x2b46da]);break;case 0x3:joinOrLeaveQueues(_0x31555d,_0x2a22e3,_0x47b8('0x47'),_0x4d09c2[_0x4bc93d][_0x2b46da]);break;case 0x4:joinOrLeaveQueues(_0x31555d,_0x2a22e3,_0x47b8('0x48'),_0x4d09c2[_0x4bc93d][_0x2b46da]);break;case 0x5:joinOrLeaveQueues(_0x31555d,_0x2a22e3,_0x47b8('0x49'),_0x4d09c2[_0x4bc93d][_0x2b46da]);break;case 0x6:joinOrLeaveQueues(_0x31555d,_0x2a22e3,_0x47b8('0x4a'),_0x4d09c2[_0x4bc93d][_0x2b46da]);break;case 0x7:if(_0x22e7dd[_0x47b8('0x7')]!=='agent')_0x31555d[_0x2a22e3](util[_0x47b8('0x1f')](_0x47b8('0x4b'),_0x4d09c2[_0x4bc93d][_0x2b46da][_0x47b8('0x5')]));break;case 0x8:if(_0x22e7dd['role']!==_0x47b8('0x8'))_0x31555d[_0x2a22e3](util[_0x47b8('0x1f')](_0x47b8('0x4c'),_0x4d09c2[_0x4bc93d][_0x2b46da][_0x47b8('0x5')]));break;case 0x9:if(_0x22e7dd['role']!==_0x47b8('0x8'))_0x31555d[_0x2a22e3](util[_0x47b8('0x1f')]('campaign:%s:%s',_0x4d09c2[_0x4bc93d][_0x2b46da][_0x47b8('0xa')],_0x4d09c2[_0x4bc93d][_0x2b46da][_0x47b8('0x5')]));break;case 0xa:_0x31555d[_0x2a22e3](util[_0x47b8('0x1f')]('user:%s',_0x4d09c2[_0x4bc93d][_0x2b46da][_0x47b8('0x5')]));break;}}}}})['then'](function(){if(_0x2a22e3===_0x47b8('0x4d')){var _0x51fbb3=_[_0x47b8('0x1d')](_0x22e7dd['ChatInteractions'],'id');return _0x22e7dd[_0x47b8('0x4e')](_0x51fbb3)[_0x47b8('0xe')](function(){for(var _0x45bbd6=0x0;_0x45bbd6<_0x51fbb3[_0x47b8('0x21')];_0x45bbd6+=0x1){_0x5301f8['emit'](_0x47b8('0x4f'),{'ChatInteractionId':Number(_0x51fbb3[_0x45bbd6]),'UserId':Number(_0x22e7dd['id'])});}});}})[_0x47b8('0xe')](function(){if(_0x2a22e3===_0x47b8('0x4d')){var _0x115da1=_['map'](_0x22e7dd[_0x47b8('0x28')],'id');return _0x22e7dd[_0x47b8('0x50')](_0x115da1)[_0x47b8('0xe')](function(){for(var _0x4b3ef0=0x0;_0x4b3ef0<_0x115da1['length'];_0x4b3ef0+=0x1){_0x5301f8[_0x47b8('0x51')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x115da1[_0x4b3ef0]),'UserId':Number(_0x22e7dd['id'])});}});}})[_0x47b8('0xe')](function(){if(_0x2a22e3===_0x47b8('0x4d')){var _0x398d08=_[_0x47b8('0x1d')](_0x22e7dd['FaxInteractions'],'id');return _0x22e7dd[_0x47b8('0x52')](_0x398d08)[_0x47b8('0xe')](function(){for(var _0x157bf5=0x0;_0x157bf5<_0x398d08['length'];_0x157bf5+=0x1){_0x5301f8['emit'](_0x47b8('0x53'),{'FaxInteractionId':Number(_0x398d08[_0x157bf5]),'UserId':Number(_0x22e7dd['id'])});}});}})[_0x47b8('0xe')](function(){if(_0x2a22e3===_0x47b8('0x4d')){var _0x5693a8=_[_0x47b8('0x1d')](_0x22e7dd[_0x47b8('0x2b')],'id');return _0x22e7dd[_0x47b8('0x54')](_0x5693a8)[_0x47b8('0xe')](function(){for(var _0x5f0c49=0x0;_0x5f0c49<_0x5693a8[_0x47b8('0x21')];_0x5f0c49+=0x1){_0x5301f8[_0x47b8('0x51')](_0x47b8('0x55'),{'SmsInteractionId':Number(_0x5693a8[_0x5f0c49]),'UserId':Number(_0x22e7dd['id'])});}});}})['then'](function(){if(_0x2a22e3===_0x47b8('0x4d')){var _0x480d8c=_[_0x47b8('0x1d')](_0x22e7dd['OpenchannelInteractions'],'id');return _0x22e7dd[_0x47b8('0x56')](_0x480d8c)[_0x47b8('0xe')](function(){for(var _0x2ea5bd=0x0;_0x2ea5bd<_0x480d8c['length'];_0x2ea5bd+=0x1){_0x5301f8[_0x47b8('0x51')](_0x47b8('0x57'),{'OpenchannelInteractionId':Number(_0x480d8c[_0x2ea5bd]),'UserId':Number(_0x22e7dd['id'])});}});}})['then'](function(){if(_0x2a22e3===_0x47b8('0x4d')){var _0x4e1aa7=_['map'](_0x22e7dd['WhatsappInteractions'],'id');return _0x22e7dd[_0x47b8('0x58')](_0x4e1aa7)['then'](function(){for(var _0x27c1a6=0x0;_0x27c1a6<_0x4e1aa7['length'];_0x27c1a6+=0x1){_0x5301f8[_0x47b8('0x51')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4e1aa7[_0x27c1a6]),'UserId':Number(_0x22e7dd['id'])});}});}})[_0x47b8('0x59')](function(_0x28b94c){_0x31555d[_0x47b8('0x5a')](_0x28b94c);});}}function onDisconnect(_0x350805,_0x3e5f23){joinOrLeave(_0x350805,'leave',_0x3e5f23);}function onConnect(_0x3792f0){joinOrLeave(_0x3792f0,_0x47b8('0x5b'));}exports[_0x47b8('0x5c')]=function(_0x372e6f){_0x372e6f['on'](_0x47b8('0x5d'),function(_0x4ada28){_0x4ada28[_0x47b8('0x5e')](0x0);_0x4ada28[_0x47b8('0x5f')]=_0x4ada28['request'][_0x47b8('0x5d')][_0x47b8('0x60')]+':'+_0x4ada28[_0x47b8('0x61')][_0x47b8('0x5d')]['remotePort'];_0x4ada28[_0x47b8('0x62')]=new Date();_0x4ada28[_0x47b8('0x5a')]=function(_0x44b461){console[_0x47b8('0x5a')](_0x47b8('0x63')+_0x4ada28[_0x47b8('0x64')][_0x47b8('0x5')]+'['+_0x4ada28[_0x47b8('0x5f')]+']',_0x44b461);};_0x4ada28['on'](_0x47b8('0x65'),function(){onDisconnect(_0x4ada28,_0x372e6f);_0x4ada28[_0x47b8('0x5a')](_0x47b8('0x66'));});onConnect(_0x4ada28);_0x4ada28[_0x47b8('0x5a')](_0x47b8('0x67'));});}; \ No newline at end of file +var _0xd7c1=['OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','userProfileId','SmsQueues','getVoiceQueues','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','catch','log','join','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','Trunks','findAll','IvrCampaigns','resourceId','where','format','%s:queue:%s','length','handshake','find','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions'];(function(_0x1c1f92,_0x2620cb){var _0x4e930f=function(_0x186dc3){while(--_0x186dc3){_0x1c1f92['push'](_0x1c1f92['shift']());}};_0x4e930f(++_0x2620cb);}(_0xd7c1,0xa5));var _0x1d7c=function(_0x50e520,_0x9f42d3){_0x50e520=_0x50e520-0x0;var _0x46b7a1=_0xd7c1[_0x50e520];return _0x46b7a1;};'use strict';var _=require(_0x1d7c('0x0'));var util=require(_0x1d7c('0x1'));var BPromise=require(_0x1d7c('0x2'));var db=require(_0x1d7c('0x3'))['db'];var config=require(_0x1d7c('0x4'));var queryQueues={'attributes':['id',_0x1d7c('0x5')],'include':[{'as':_0x1d7c('0x6'),'model':db[_0x1d7c('0x7')],'attributes':['id',_0x1d7c('0x5'),_0x1d7c('0x8')],'raw':!![],'where':{'role':_0x1d7c('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1d7c('0x5')],'where':{'role':_0x1d7c('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1d7c('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x1d7c('0x5')],'where':{'role':_0x1d7c('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1d7c('0x5'),_0x1d7c('0xb')],'where':{'type':_0x1d7c('0xc')}};function getAssociatedResources(_0x10fff3,_0x1091e3,_0x4a7eef){return db['UserProfileSection'][_0x1d7c('0xd')]({'where':{'name':_0x10fff3,'userProfileId':_0x1091e3},'raw':!![]})[_0x1d7c('0xe')](function(_0x38fd05){if(_0x38fd05){if(_0x38fd05[_0x1d7c('0xf')]){switch(_0x10fff3){case'VoiceQueues':case _0x1d7c('0x10'):case _0x1d7c('0x11'):case'SmsQueues':case _0x1d7c('0x12'):case _0x1d7c('0x13'):case _0x1d7c('0x14'):return db[_0x4a7eef]['findAll'](queryQueues);case _0x1d7c('0x15'):return db[_0x4a7eef]['findAll'](queryTelephones);case _0x1d7c('0x16'):return db[_0x4a7eef][_0x1d7c('0x17')](queryTrunks);case _0x1d7c('0x18'):return db[_0x4a7eef][_0x1d7c('0x17')](queryCampaigns);}}else{return db['UserProfileResource'][_0x1d7c('0x17')]({'attributes':['resourceId'],'where':{'sectionId':_0x38fd05['id']},'raw':!![]})[_0x1d7c('0xe')](function(_0x49dbb4){if(_0x49dbb4){var _0x41112d={'where':{'id':_['map'](_0x49dbb4,_0x1d7c('0x19'))},'raw':!![]};switch(_0x4a7eef){case _0x1d7c('0x7'):_0x41112d[_0x1d7c('0x1a')][_0x1d7c('0x8')]=_0x1d7c('0xa');break;case'Campaign':_0x41112d[_0x1d7c('0x1a')][_0x1d7c('0xb')]='ivr';break;}return db[_0x4a7eef][_0x1d7c('0x17')](_0x41112d);}else{return[];}});}}else{return[];}})['then'](function(_0x5147d1){return _0x5147d1;});}function joinOrLeaveQueues(_0x29b24c,_0x1f31f2,_0xf378ad,_0x4102a4){_0x29b24c[_0x1f31f2](util[_0x1d7c('0x1b')](_0x1d7c('0x1c'),_0xf378ad,_0x4102a4[_0x1d7c('0x5')]));if(_0x4102a4[_0x1d7c('0x6')]){for(var _0x1dafe8=0x0;_0x1dafe8<_0x4102a4[_0x1d7c('0x6')][_0x1d7c('0x1d')];_0x1dafe8+=0x1){_0x29b24c[_0x1f31f2](util['format']('user:%s',_0x4102a4['Agents'][_0x1dafe8]['name']));}}}function joinOrLeave(_0x218bdd,_0x3037ed,_0x33e74e){var _0x57c6e7;if(_0x218bdd[_0x1d7c('0x1e')]['query']['id']){db[_0x1d7c('0x7')][_0x1d7c('0x1f')]({'attributes':['id',_0x1d7c('0x5'),'role','userProfileId'],'where':{'id':_0x218bdd[_0x1d7c('0x1e')][_0x1d7c('0x20')]['id']},'include':[{'model':db[_0x1d7c('0x21')],'as':_0x1d7c('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d7c('0x23')],'as':_0x1d7c('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d7c('0x25')],'as':_0x1d7c('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d7c('0x27')],'as':_0x1d7c('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x1d7c('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x1d7c('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x1d7c('0xe')](function(_0x3ef33a){if(_0x3ef33a){_0x57c6e7=_0x3ef33a;_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')](_0x1d7c('0x2b'),_0x3ef33a[_0x1d7c('0x5')]));var _0x443a85=[];switch(_0x3ef33a[_0x1d7c('0x8')]){case _0x1d7c('0x2c'):_0x218bdd[_0x3037ed](_0x1d7c('0x2d'));_0x218bdd[_0x3037ed](_0x1d7c('0x2e'));if(queryQueues['hasOwnProperty'](_0x1d7c('0x2f'))){delete queryQueues[_0x1d7c('0x2f')];}_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x31')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x32')]['findAll'](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x33')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x34')][_0x1d7c('0x17')](queryQueues));_0x443a85['push'](db[_0x1d7c('0x35')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x36')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x37')][_0x1d7c('0x17')](queryQueues));_0x443a85[_0x1d7c('0x30')](db['User'][_0x1d7c('0x17')](queryTelephones));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x38')]['findAll'](queryTrunks));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x39')][_0x1d7c('0x17')](queryCampaigns));_0x443a85['push'](db[_0x1d7c('0x7')][_0x1d7c('0x17')](queryAgents));break;case'user':_0x218bdd[_0x3037ed](_0x1d7c('0x2d'));_0x218bdd[_0x3037ed](_0x1d7c('0x2e'));_0x443a85['push'](getAssociatedResources('VoiceQueues',_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x31')));_0x443a85[_0x1d7c('0x30')](getAssociatedResources(_0x1d7c('0x10'),_0x3ef33a[_0x1d7c('0x3a')],'ChatQueue'));_0x443a85[_0x1d7c('0x30')](getAssociatedResources('FaxQueues',_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x33')));_0x443a85['push'](getAssociatedResources(_0x1d7c('0x3b'),_0x3ef33a[_0x1d7c('0x3a')],'SmsQueue'));_0x443a85['push'](getAssociatedResources('MailQueues',_0x3ef33a[_0x1d7c('0x3a')],'MailQueue'));_0x443a85['push'](getAssociatedResources('OpenchannelQueues',_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x36')));_0x443a85[_0x1d7c('0x30')](getAssociatedResources(_0x1d7c('0x14'),_0x3ef33a[_0x1d7c('0x3a')],'WhatsappQueue'));_0x443a85[_0x1d7c('0x30')](getAssociatedResources(_0x1d7c('0x15'),_0x3ef33a[_0x1d7c('0x3a')],'User'));_0x443a85[_0x1d7c('0x30')](getAssociatedResources('Trunks',_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x38')));_0x443a85[_0x1d7c('0x30')](getAssociatedResources(_0x1d7c('0x18'),_0x3ef33a[_0x1d7c('0x3a')],_0x1d7c('0x39')));_0x443a85[_0x1d7c('0x30')](db[_0x1d7c('0x7')][_0x1d7c('0x17')](queryAgents));break;case _0x1d7c('0x9'):_0x218bdd[_0x3037ed](_0x1d7c('0x2d'));_0x218bdd[_0x3037ed](_0x1d7c('0x2e'));_0x443a85[_0x1d7c('0x30')](_0x3ef33a[_0x1d7c('0x3c')]({'attributes':['id','name']}));_0x443a85[_0x1d7c('0x30')](_0x3ef33a[_0x1d7c('0x3d')]({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85['push'](_0x3ef33a[_0x1d7c('0x3e')]({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85[_0x1d7c('0x30')](_0x3ef33a['getSmsQueues']({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85['push'](_0x3ef33a['getMailQueues']({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85[_0x1d7c('0x30')](_0x3ef33a[_0x1d7c('0x3f')]({'attributes':['id',_0x1d7c('0x5')]}));_0x443a85['push'](_0x3ef33a[_0x1d7c('0x40')]({'attributes':['id',_0x1d7c('0x5')]}));break;}return BPromise[_0x1d7c('0x41')](_0x443a85);}})['then'](function(_0xd538d1){if(_0xd538d1&&_0xd538d1[_0x1d7c('0x1d')]){for(var _0x4677e9=0x0;_0x4677e9<_0xd538d1[_0x1d7c('0x1d')];_0x4677e9+=0x1){for(var _0x16c522=0x0;_0x16c522<_0xd538d1[_0x4677e9][_0x1d7c('0x1d')];_0x16c522+=0x1){switch(_0x4677e9){case 0x0:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x42'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x1:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x43'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x2:joinOrLeaveQueues(_0x218bdd,_0x3037ed,'fax',_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x3:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x44'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x4:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x45'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x5:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x46'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x6:joinOrLeaveQueues(_0x218bdd,_0x3037ed,_0x1d7c('0x47'),_0xd538d1[_0x4677e9][_0x16c522]);break;case 0x7:if(_0x57c6e7[_0x1d7c('0x8')]!==_0x1d7c('0x9'))_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')]('telephone:%s',_0xd538d1[_0x4677e9][_0x16c522]['name']));break;case 0x8:if(_0x57c6e7[_0x1d7c('0x8')]!==_0x1d7c('0x9'))_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')](_0x1d7c('0x48'),_0xd538d1[_0x4677e9][_0x16c522][_0x1d7c('0x5')]));break;case 0x9:if(_0x57c6e7[_0x1d7c('0x8')]!==_0x1d7c('0x9'))_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')](_0x1d7c('0x49'),_0xd538d1[_0x4677e9][_0x16c522][_0x1d7c('0xb')],_0xd538d1[_0x4677e9][_0x16c522][_0x1d7c('0x5')]));break;case 0xa:_0x218bdd[_0x3037ed](util[_0x1d7c('0x1b')](_0x1d7c('0x2b'),_0xd538d1[_0x4677e9][_0x16c522]['name']));break;}}}}})[_0x1d7c('0xe')](function(){if(_0x3037ed===_0x1d7c('0x4a')){var _0x373939=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x22')],'id');return _0x57c6e7[_0x1d7c('0x4c')](_0x373939)[_0x1d7c('0xe')](function(){for(var _0x1a768d=0x0;_0x1a768d<_0x373939[_0x1d7c('0x1d')];_0x1a768d+=0x1){_0x33e74e[_0x1d7c('0x4d')](_0x1d7c('0x4e'),{'ChatInteractionId':Number(_0x373939[_0x1a768d]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed==='leave'){var _0x1a2cdb=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x24')],'id');return _0x57c6e7[_0x1d7c('0x4f')](_0x1a2cdb)[_0x1d7c('0xe')](function(){for(var _0x3a3445=0x0;_0x3a3445<_0x1a2cdb[_0x1d7c('0x1d')];_0x3a3445+=0x1){_0x33e74e[_0x1d7c('0x4d')](_0x1d7c('0x50'),{'MailInteractionId':Number(_0x1a2cdb[_0x3a3445]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed===_0x1d7c('0x4a')){var _0x54403e=_[_0x1d7c('0x4b')](_0x57c6e7['FaxInteractions'],'id');return _0x57c6e7[_0x1d7c('0x51')](_0x54403e)[_0x1d7c('0xe')](function(){for(var _0x10d4b4=0x0;_0x10d4b4<_0x54403e[_0x1d7c('0x1d')];_0x10d4b4+=0x1){_0x33e74e['emit'](_0x1d7c('0x52'),{'FaxInteractionId':Number(_0x54403e[_0x10d4b4]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed===_0x1d7c('0x4a')){var _0x23f280=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x28')],'id');return _0x57c6e7[_0x1d7c('0x53')](_0x23f280)['then'](function(){for(var _0x22388d=0x0;_0x22388d<_0x23f280[_0x1d7c('0x1d')];_0x22388d+=0x1){_0x33e74e[_0x1d7c('0x4d')](_0x1d7c('0x54'),{'SmsInteractionId':Number(_0x23f280[_0x22388d]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed==='leave'){var _0x445c89=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x29')],'id');return _0x57c6e7[_0x1d7c('0x55')](_0x445c89)[_0x1d7c('0xe')](function(){for(var _0x3cdd59=0x0;_0x3cdd59<_0x445c89['length'];_0x3cdd59+=0x1){_0x33e74e[_0x1d7c('0x4d')](_0x1d7c('0x56'),{'OpenchannelInteractionId':Number(_0x445c89[_0x3cdd59]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0xe')](function(){if(_0x3037ed===_0x1d7c('0x4a')){var _0x26b5ad=_[_0x1d7c('0x4b')](_0x57c6e7[_0x1d7c('0x57')],'id');return _0x57c6e7[_0x1d7c('0x58')](_0x26b5ad)['then'](function(){for(var _0x558eff=0x0;_0x558eff<_0x26b5ad[_0x1d7c('0x1d')];_0x558eff+=0x1){_0x33e74e[_0x1d7c('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x26b5ad[_0x558eff]),'UserId':Number(_0x57c6e7['id'])});}});}})[_0x1d7c('0x59')](function(_0x41e227){_0x218bdd[_0x1d7c('0x5a')](_0x41e227);});}}function onDisconnect(_0x303ca6,_0x542be3){joinOrLeave(_0x303ca6,'leave',_0x542be3);}function onConnect(_0x534e0c){joinOrLeave(_0x534e0c,_0x1d7c('0x5b'));}exports['default']=function(_0xd5486a){_0xd5486a['on']('connection',function(_0x3d4cd6){_0x3d4cd6[_0x1d7c('0x5c')](0x0);_0x3d4cd6[_0x1d7c('0x5d')]=_0x3d4cd6[_0x1d7c('0x5e')][_0x1d7c('0x5f')][_0x1d7c('0x60')]+':'+_0x3d4cd6['request'][_0x1d7c('0x5f')][_0x1d7c('0x61')];_0x3d4cd6[_0x1d7c('0x62')]=new Date();_0x3d4cd6[_0x1d7c('0x5a')]=function(_0x5411a4){console['log']('SocketIO\x20'+_0x3d4cd6[_0x1d7c('0x63')][_0x1d7c('0x5')]+'['+_0x3d4cd6[_0x1d7c('0x5d')]+']',_0x5411a4);};_0x3d4cd6['on'](_0x1d7c('0x64'),function(){onDisconnect(_0x3d4cd6,_0xd5486a);_0x3d4cd6[_0x1d7c('0x5a')](_0x1d7c('0x65'));});onConnect(_0x3d4cd6);_0x3d4cd6['log'](_0x1d7c('0x66'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3de3b9e..98a6466 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 _0xbb04=['direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','User','name','fullname','email','internal','interface','SIP/%s','incomingmessage','catch','outgoingmessage','opened','ContactId','changed','closed','event','format','agent','default','length','hasOwnProperty','model','callback','toLowerCase','condition','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','afterCreate','ChatInteraction','afterUpdate','ChatMessage','newmessage','Sms','newinteraction','closedinteraction','SmsMessage','WhatsappInteraction','Whatsapp','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','request','then','info','Trigger,\x20%s','EventManager','error','get','channel'];(function(_0x5e8531,_0x74f8c){var _0x2d688d=function(_0x2fc384){while(--_0x2fc384){_0x5e8531['push'](_0x5e8531['shift']());}};_0x2d688d(++_0x74f8c);}(_0xbb04,0x16b));var _0x4bb0=function(_0x32e9e9,_0x3df5aa){_0x32e9e9=_0x32e9e9-0x0;var _0x400b63=_0xbb04[_0x32e9e9];return _0x400b63;};'use strict';var util=require('util');var db=require(_0x4bb0('0x0'))['db'];var jayson=require(_0x4bb0('0x1'));var logger=require(_0x4bb0('0x2'))(_0x4bb0('0x3'));var _=require('lodash');var client=jayson[_0x4bb0('0x4')][_0x4bb0('0x5')]({'port':0x232a});var triggers=[{'channel':_0x4bb0('0x6'),'model':'ChatInteraction','event':_0x4bb0('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0x4bb0('0x8'),'event':_0x4bb0('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0x4bb0('0xa'),'event':_0x4bb0('0x7'),'condition':_0x4bb0('0xb'),'callback':afterCreateMessage},{'channel':_0x4bb0('0xc'),'model':'SmsInteraction','event':'afterCreate','condition':_0x4bb0('0xd'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x4bb0('0x9'),'condition':_0x4bb0('0xe'),'callback':afterUpdate},{'channel':_0x4bb0('0xc'),'model':_0x4bb0('0xf'),'event':_0x4bb0('0x7'),'condition':_0x4bb0('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x4bb0('0x10'),'event':_0x4bb0('0x7'),'condition':_0x4bb0('0xd'),'callback':afterCreate},{'channel':_0x4bb0('0x11'),'model':_0x4bb0('0x10'),'event':_0x4bb0('0x9'),'condition':_0x4bb0('0xe'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x4bb0('0x7'),'condition':_0x4bb0('0xb'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x4bb0('0x12'),'event':_0x4bb0('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4bb0('0x13'),'model':'FaxInteraction','event':_0x4bb0('0x9'),'condition':_0x4bb0('0xe'),'callback':afterUpdate},{'channel':'Fax','model':_0x4bb0('0x14'),'event':_0x4bb0('0x7'),'condition':_0x4bb0('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0x4bb0('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4bb0('0x15'),'model':_0x4bb0('0x16'),'event':_0x4bb0('0x9'),'condition':_0x4bb0('0xe'),'callback':afterUpdate},{'channel':_0x4bb0('0x15'),'model':'MailMessage','event':_0x4bb0('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x4bb0('0x17'),'model':_0x4bb0('0x18'),'event':_0x4bb0('0x7'),'condition':_0x4bb0('0xd'),'callback':afterCreate},{'channel':_0x4bb0('0x17'),'model':_0x4bb0('0x18'),'event':_0x4bb0('0x9'),'condition':_0x4bb0('0xe'),'callback':afterUpdate},{'channel':_0x4bb0('0x17'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0x4bb0('0xb'),'callback':afterCreateMessage}];function request(_0x2a3419){return client[_0x4bb0('0x19')]('EventManager',_0x2a3419)[_0x4bb0('0x1a')](function(_0x45d63f){logger[_0x4bb0('0x1b')](_0x4bb0('0x1c'),_0x4bb0('0x1d'),_0x45d63f);if(_0x45d63f[_0x4bb0('0x1e')]){if(_0x45d63f[_0x4bb0('0x1e')]['code']===0x1f4){logger[_0x4bb0('0x1e')](_0x4bb0('0x1c'),'EventManager',_0x45d63f['error']);}}})['catch'](function(_0x525d22){logger[_0x4bb0('0x1e')](_0x4bb0('0x1c'),_0x4bb0('0x1d'),_0x525d22);});}function afterCreateMessage(_0x5a4185,_0x235915){return function(_0x25f8ab,_0x29c59f){_0x25f8ab=_0x25f8ab[_0x4bb0('0x1f')]({'plain':!![]});_0x25f8ab[_0x4bb0('0x20')]=_0x5a4185;_0x25f8ab['event']=_0x25f8ab[_0x4bb0('0x21')];var _0x3ed000=_0x4bb0('0x22')+_0x25f8ab['ContactId'];return db[_0x4bb0('0x23')][_0x4bb0('0x24')](_0x3ed000,{'type':db[_0x4bb0('0x25')][_0x4bb0('0x26')][_0x4bb0('0x27')],'raw':!![]})[_0x4bb0('0x1a')](function(_0x55db26){return _0x55db26;})[_0x4bb0('0x1a')](function(_0x29a5eb){if(_0x29a5eb){_0x25f8ab[_0x4bb0('0x28')]=_0x29a5eb[0x0];}if(_0x25f8ab[_0x4bb0('0x29')]){return db[_0x4bb0('0x2a')]['find']({'where':{'id':_0x25f8ab['UserId']},'attributes':['id',_0x4bb0('0x2b'),_0x4bb0('0x2c'),_0x4bb0('0x2d'),_0x4bb0('0x2e')],'raw':!![]})[_0x4bb0('0x1a')](function(_0x37630f){_0x25f8ab[_0x4bb0('0x2f')]=util['format'](_0x4bb0('0x30'),_0x37630f[_0x4bb0('0x2b')]);_0x25f8ab[_0x4bb0('0x20')]=_0x5a4185;_0x25f8ab['agent']=_0x37630f;return request({'event':_0x4bb0('0x31'),'message':_0x25f8ab});})[_0x4bb0('0x32')](function(_0x77bca0){console[_0x4bb0('0x1e')](_0x77bca0);});}else{return request({'event':_0x4bb0('0x33'),'message':_0x25f8ab});}});};}function afterCreate(_0xe0a867,_0x30d0ca){return function(_0x1e77e6,_0x202fb3){_0x1e77e6=_0x1e77e6[_0x4bb0('0x1f')]({'plain':!![]});_0x1e77e6[_0x4bb0('0x20')]=_0xe0a867;_0x1e77e6['event']=_0x4bb0('0x34');var _0x4ccdf4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1e77e6[_0x4bb0('0x35')];return db[_0x4bb0('0x23')][_0x4bb0('0x24')](_0x4ccdf4,{'type':db[_0x4bb0('0x25')][_0x4bb0('0x26')][_0x4bb0('0x27')],'raw':!![]})[_0x4bb0('0x1a')](function(_0x21ac82){return _0x21ac82;})[_0x4bb0('0x1a')](function(_0x20dfec){if(_0x20dfec){_0x1e77e6['contact']=_0x20dfec[0x0];}return request({'event':_0x30d0ca,'message':_0x1e77e6});});};}function afterUpdate(_0x5efb6d,_0x3b1036){return function(_0x36a5fa,_0x4337ad){if(_0x36a5fa[_0x4bb0('0x36')]('closed')&&_0x36a5fa[_0x4bb0('0x37')]){_0x36a5fa=_0x36a5fa[_0x4bb0('0x1f')]({'plain':!![]});_0x36a5fa[_0x4bb0('0x20')]=_0x5efb6d;_0x36a5fa[_0x4bb0('0x38')]=_0x4bb0('0x37');var _0x204c8e=_0x4bb0('0x22')+_0x36a5fa[_0x4bb0('0x35')];return db['sequelize'][_0x4bb0('0x24')](_0x204c8e,{'type':db[_0x4bb0('0x25')][_0x4bb0('0x26')][_0x4bb0('0x27')],'raw':!![]})[_0x4bb0('0x1a')](function(_0x1f8af1){return _0x1f8af1;})[_0x4bb0('0x1a')](function(_0x565133){if(_0x565133){_0x36a5fa['contact']=_0x565133[0x0];}if(_0x36a5fa['UserId']){return db[_0x4bb0('0x2a')]['find']({'where':{'id':_0x36a5fa[_0x4bb0('0x29')]},'attributes':['id',_0x4bb0('0x2b'),_0x4bb0('0x2c'),_0x4bb0('0x2d'),'internal'],'raw':!![]})[_0x4bb0('0x1a')](function(_0x197e23){_0x36a5fa[_0x4bb0('0x2f')]=util[_0x4bb0('0x39')](_0x4bb0('0x30'),_0x197e23[_0x4bb0('0x2b')]);_0x36a5fa[_0x4bb0('0x3a')]=_0x197e23;return request({'event':_0x3b1036,'message':_0x36a5fa});})[_0x4bb0('0x32')](function(_0x2a841b){console[_0x4bb0('0x1e')](_0x2a841b);});}else{return request({'event':_0x3b1036,'message':_0x36a5fa});}});}};}exports[_0x4bb0('0x3b')]=function(){for(var _0xff6df8=0x0;_0xff6df8=_0x130280[_0xe476('0x13')]){throw Error(_0xe476('0x14'));}_0x114f57(_0x407509);})['catch'](function(_0x1e846e){_0x58a791(_0x1e846e);});});}; \ No newline at end of file +var _0xbaaa=['Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','chat','fax','sms','whatsapp','openchannel','toLowerCase','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','User','then','agents'];(function(_0x55f84c,_0xc74a9c){var _0x13a249=function(_0xedcbb6){while(--_0xedcbb6){_0x55f84c['push'](_0x55f84c['shift']());}};_0x13a249(++_0xc74a9c);}(_0xbaaa,0x9c));var _0xabaa=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xbaaa[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0xabaa('0x0'));var BPromise=require(_0xabaa('0x1'));var db=require(_0xabaa('0x2'))['db'];var util=require(_0xabaa('0x3'));var channels=[_0xabaa('0x4'),'mail',_0xabaa('0x5'),_0xabaa('0x6'),_0xabaa('0x7'),_0xabaa('0x8'),_0xabaa('0x9')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x3e0d86){_0x3e0d86=_0x3e0d86[_0xabaa('0xa')]();return _['includes'](channels,_0x3e0d86);};exports[_0xabaa('0xb')]=function(_0x3da0f2,_0x4f4e61,_0x152bdd,_0x35b346){var _0x1d082d={'loginAttempts':_0x4f4e61,'blocked':_0x152bdd};if(!_[_0xabaa('0xc')](_0x35b346)){_0x1d082d['blockedAt']=_0x35b346;}return _0x3da0f2[_0xabaa('0xd')](_0x1d082d);};exports[_0xabaa('0xe')]=function(_0x2c9271){return new BPromise(function(_0x1b099a,_0x3a2605){var _0x46a0df=0x0;if(_0x2c9271[_0xabaa('0xf')]!==_0xabaa('0x10')){_0x1b099a(_0x2c9271);}db[_0xabaa('0x11')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2c9271['id']}}})[_0xabaa('0x12')](function(_0x4f0df1){_0x46a0df=_0x4f0df1;return util[_0xabaa('0xe')]();})[_0xabaa('0x12')](function(_0xa1cea8){if(_0xa1cea8&&_0xa1cea8[_0xabaa('0x13')]&&_0x46a0df>=_0xa1cea8['agents']){throw Error(_0xabaa('0x14'));}_0x1b099a(_0x2c9271);})[_0xabaa('0x15')](function(_0x58b8fe){_0x3a2605(_0x58b8fe);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 3cdf4fe..dcfe8c1 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757c=['404','status','render','json','send','exports'];(function(_0x8b11f2,_0x3913b6){var _0x56d1ca=function(_0x1a8c9b){while(--_0x1a8c9b){_0x8b11f2['push'](_0x8b11f2['shift']());}};_0x56d1ca(++_0x3913b6);}(_0x757c,0x191));var _0xc757=function(_0x280187,_0x5f3937){_0x280187=_0x280187-0x0;var _0x30e7d3=_0x757c[_0x280187];return _0x30e7d3;};'use strict';module[_0xc757('0x0')][0x194]=function pageNotFound(_0x1eda0b,_0x571747){var _0x2ca426=_0xc757('0x1');var _0x2a2763=0x194;var _0x35203e={'status':_0x2a2763};_0x571747[_0xc757('0x2')](_0x35203e[_0xc757('0x2')]);_0x571747[_0xc757('0x3')](_0x2ca426,{},function(_0x5a68ec,_0x4b5aec){if(_0x5a68ec){return _0x571747[_0xc757('0x2')](_0x35203e['status'])[_0xc757('0x4')](_0x35203e);}_0x571747[_0xc757('0x5')](_0x4b5aec);});}; \ No newline at end of file +var _0x4fc2=['send','exports','status','render'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x4fc2,0x111));var _0x24fc=function(_0x625560,_0x3da411){_0x625560=_0x625560-0x0;var _0x47ffd7=_0x4fc2[_0x625560];return _0x47ffd7;};'use strict';module[_0x24fc('0x0')][0x194]=function pageNotFound(_0x2b05a5,_0x1a4e51){var _0x4390a0='404';var _0x365c56=0x194;var _0x23eaa0={'status':_0x365c56};_0x1a4e51[_0x24fc('0x1')](_0x23eaa0['status']);_0x1a4e51[_0x24fc('0x2')](_0x4390a0,{},function(_0x3772eb,_0x58dafc){if(_0x3772eb){return _0x1a4e51[_0x24fc('0x1')](_0x23eaa0[_0x24fc('0x1')])['json'](_0x23eaa0);}_0x1a4e51[_0x24fc('0x3')](_0x58dafc);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index aad8a54..0ad7a8a 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37a0=['../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/team/team.model','License','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','CmContact','cm_user_has_contacts','cm_user_has_lists','Team','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','CmList','VoicePrefix','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','VoiceExtension','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','JscriptySessionReport','JscriptySessions','Trunk','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Disposition','Dispositions','CannedAnswer','Interactions','MailApplication','ListId','TemplateId','Teams','Account','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','restrict','IntervalId','TagId','MailQueueReport','List','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Tags','Interaction','AttachmentId','SmsAccountId','Answers','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatMessage','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','cm_contact_has_tags','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','AllCondition','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','AccountId','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','Variable','VariableId','SugarcrmAccount','Subjects','DeskField','ZohoAccount','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','ServicenowConfiguration','ServicenowField','Dynamics365Field','FreshsalesAccount','FromId','ToId','SessionId','ProjectId','user_has_square_projects','user_has_teams','team_has_mail_queues','team_has_fax_queues','WhatsappQueues','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','Contacts','HopperHistory','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','sequelize','jstz','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x37a0,0x1cf));var _0x037a=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x37a0[_0x3b87f4];return _0x63d16e;};'use strict';var config=require(_0x037a('0x0'));var Sequelize=require(_0x037a('0x1'));var _=require('lodash');var jstz=require(_0x037a('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0x037a('0x3')](config['sequelize'],{'database':_0x037a('0x4'),'username':_0x037a('0x5'),'password':'xC@LL1234','options':{'host':_0x037a('0x6'),'port':0xcea,'dialect':_0x037a('0x7'),'dialectOptions':{'charset':_0x037a('0x8')},'logging':![],'timezone':timezone[_0x037a('0x9')](),'define':{'charset':_0x037a('0xa'),'collate':_0x037a('0xb')}}});config[_0x037a('0xc')]=_[_0x037a('0x3')](config[_0x037a('0xc')],{'database':'motion2','username':'xcall','password':_0x037a('0xd'),'options':{'host':_0x037a('0x6'),'port':0xcea,'dialect':_0x037a('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x037a('0xa'),'collate':_0x037a('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x037a('0xe')],config[_0x037a('0x1')]['username'],config[_0x037a('0x1')][_0x037a('0xf')],config[_0x037a('0x1')][_0x037a('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x037a('0xc')][_0x037a('0xe')],config[_0x037a('0xc')]['username'],config[_0x037a('0xc')][_0x037a('0xf')],config[_0x037a('0xc')][_0x037a('0x10')])};db[_0x037a('0x11')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x13'));db[_0x037a('0x14')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x037a('0x15')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x16'));db['VoiceExtension']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x17'));db[_0x037a('0x18')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x19'));db[_0x037a('0x1a')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x1b'));db[_0x037a('0x1c')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x1d'));db[_0x037a('0x1e')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x1f'));db[_0x037a('0x20')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x21'));db['VoiceMailMessage']=db[_0x037a('0x1')]['import'](_0x037a('0x22'));db[_0x037a('0x23')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x24'));db['VoiceDialReport']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x25'));db[_0x037a('0x26')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x27'));db['VoiceQueueReport']=db[_0x037a('0x1')][_0x037a('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x037a('0x28')]=db[_0x037a('0x1')]['import'](_0x037a('0x29'));db['Trunk']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x2a'));db['VoiceTransferReport']=db[_0x037a('0x1')][_0x037a('0x12')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x037a('0x2b')]=db[_0x037a('0x1')]['import'](_0x037a('0x2c'));db['UserVoiceQueue']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x2d'));db['UserChatQueue']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x2e'));db[_0x037a('0x2f')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x30'));db[_0x037a('0x31')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x32'));db[_0x037a('0x33')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x34'));db[_0x037a('0x35')]=db[_0x037a('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x36'));db[_0x037a('0x37')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x38'));db[_0x037a('0x39')]=db['sequelize']['import']('../api/mailAccount/mailAccount.model');db[_0x037a('0x3a')]=db['sequelize']['import'](_0x037a('0x3b'));db['MailSubstatus']=db[_0x037a('0x1')][_0x037a('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0x037a('0x3c')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x3d'));db[_0x037a('0x3e')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db['sequelize'][_0x037a('0x12')](_0x037a('0x3f'));db['MailQueueReport']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x40'));db[_0x037a('0x41')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x42'));db[_0x037a('0x43')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0x037a('0x44')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x45'));db[_0x037a('0x46')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x47'));db[_0x037a('0x48')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x49'));db[_0x037a('0x4a')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x4b'));db[_0x037a('0x4c')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x4d'));db[_0x037a('0x4e')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x4f'));db[_0x037a('0x50')]=db['sequelize']['import'](_0x037a('0x51'));db[_0x037a('0x52')]=db[_0x037a('0x1')]['import'](_0x037a('0x53'));db[_0x037a('0x54')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x55'));db[_0x037a('0x56')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x57'));db[_0x037a('0x58')]=db['sequelize']['import'](_0x037a('0x59'));db[_0x037a('0x5a')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x5b'));db['OpenchannelApplication']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x5c'));db[_0x037a('0x5d')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x5e'));db[_0x037a('0x5f')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x60'));db[_0x037a('0x61')]=db['sequelize']['import'](_0x037a('0x62'));db[_0x037a('0x63')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/chatWebsite/chatWebsite.model');db[_0x037a('0x64')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x65'));db[_0x037a('0x66')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x67'));db[_0x037a('0x68')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x69'));db[_0x037a('0x6a')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x6b'));db[_0x037a('0x6c')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x6d'));db['ChatGroup']=db['sequelize'][_0x037a('0x12')](_0x037a('0x6e'));db[_0x037a('0x6f')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x70'));db[_0x037a('0x71')]=db[_0x037a('0x1')]['import'](_0x037a('0x72'));db['CmContact']=db[_0x037a('0x1')]['import'](_0x037a('0x73'));db[_0x037a('0x74')]=db[_0x037a('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x037a('0x75')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x76'));db[_0x037a('0x77')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x78'));db[_0x037a('0x79')]=db[_0x037a('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x7a'));db[_0x037a('0x7b')]=db[_0x037a('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x037a('0x7c')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x7d'));db[_0x037a('0x7e')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x7f'));db['CannedAnswer']=db[_0x037a('0x1')]['import'](_0x037a('0x80'));db['Disposition']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x81'));db[_0x037a('0x82')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/condition/condition.model');db[_0x037a('0x83')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x84'));db[_0x037a('0x85')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x86'));db[_0x037a('0x87')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x88'));db[_0x037a('0x89')]=db[_0x037a('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x037a('0x8a')]=db['sequelize']['import'](_0x037a('0x8b'));db[_0x037a('0x8c')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x8d'));db[_0x037a('0x8e')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x8f'));db[_0x037a('0x90')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x91'));db[_0x037a('0x92')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/trigger/trigger.model');db['Variable']=db[_0x037a('0x1')]['import']('../api/variable/variable.model');db['Integration']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x93'));db[_0x037a('0x94')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x95'));db[_0x037a('0x96')]=db['sequelize']['import'](_0x037a('0x97'));db[_0x037a('0x98')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x99'));db['AnalyticExtractedReport']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x9a'));db[_0x037a('0x9b')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x9c'));db[_0x037a('0x9d')]=db[_0x037a('0x1')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x037a('0x9e')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x9f'));db['SalesforceAccount']=db[_0x037a('0x1')][_0x037a('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xa0'));db[_0x037a('0xa1')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xa2'));db['SugarcrmAccount']=db['sequelize']['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x037a('0xa3')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x037a('0xa4')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x037a('0xa5')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/intDeskAccount/intDeskAccount.model');db[_0x037a('0xa6')]=db[_0x037a('0x1')]['import'](_0x037a('0xa7'));db['DeskField']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xa8'));db['ZohoAccount']=db['sequelize'][_0x037a('0x12')](_0x037a('0xa9'));db[_0x037a('0xaa')]=db[_0x037a('0x1')]['import'](_0x037a('0xab'));db[_0x037a('0xac')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/intZohoField/intZohoField.model');db[_0x037a('0xad')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xae'));db[_0x037a('0xaf')]=db[_0x037a('0x1')]['import'](_0x037a('0xb0'));db['ZendeskField']=db[_0x037a('0x1')][_0x037a('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0x037a('0xb1')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xb2'));db[_0x037a('0xb3')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xb4'));db[_0x037a('0xb5')]=db['sequelize'][_0x037a('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x037a('0x1')]['import'](_0x037a('0xb6'));db['VtigerConfiguration']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xb7'));db[_0x037a('0xb8')]=db['sequelize'][_0x037a('0x12')](_0x037a('0xb9'));db[_0x037a('0xba')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xbb'));db['ServicenowConfiguration']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xbc'));db['ServicenowField']=db['sequelize']['import']('../api/intServicenowField/intServicenowField.model');db[_0x037a('0xbd')]=db['sequelize'][_0x037a('0x12')](_0x037a('0xbe'));db[_0x037a('0xbf')]=db['sequelize'][_0x037a('0x12')](_0x037a('0xc0'));db['Dynamics365Field']=db[_0x037a('0x1')][_0x037a('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xc1'));db[_0x037a('0xc2')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xc3'));db[_0x037a('0xc4')]=db['sequelize'][_0x037a('0x12')](_0x037a('0xc5'));db[_0x037a('0xc6')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x93'));db[_0x037a('0xc7')]=db[_0x037a('0x1')]['import'](_0x037a('0xc8'));db[_0x037a('0xc9')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xca'));db['ChatInternalMessage']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xcb'));db[_0x037a('0xcc')]=db['sequelize'][_0x037a('0x12')](_0x037a('0xcd'));db[_0x037a('0xce')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x037a('0x1')][_0x037a('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x037a('0xcf')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xd0'));db['SquareReport']=db['sequelize']['import'](_0x037a('0xd1'));db['SquareDetailsReport']=db['sequelize'][_0x037a('0x12')]('../api/squareReportDetail/squareReportDetail.model');db[_0x037a('0xd2')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xd3'));db[_0x037a('0xd4')]=db['sequelize'][_0x037a('0x12')](_0x037a('0xd5'));db[_0x037a('0xd6')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xd7'));db[_0x037a('0xd8')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xd9'));db[_0x037a('0xda')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xdb'));db[_0x037a('0xdc')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xdd'));db[_0x037a('0xde')]=db[_0x037a('0x1')][_0x037a('0x12')]('../api/license/license.model');db['Campaign']=db[_0x037a('0x1')][_0x037a('0x12')]('../api/campaign/campaign.model');db[_0x037a('0xdf')]=db[_0x037a('0x1')]['import']('../api/migration/migration.model');db[_0x037a('0xe0')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xe1'));db[_0x037a('0xe2')]=db[_0x037a('0x1')]['import'](_0x037a('0xe3'));db[_0x037a('0xe4')]=db['sequelize']['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db['sequelize'][_0x037a('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x037a('0xe5')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xe6'));db[_0x037a('0xe7')]=db['sequelize'][_0x037a('0x12')](_0x037a('0xe8'));db[_0x037a('0xe9')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xea'));db['CmList']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xeb'));db['VoicePrefix']=db[_0x037a('0x1')]['import'](_0x037a('0xec'));db[_0x037a('0xed')]=db['sequelize'][_0x037a('0x12')](_0x037a('0xee'));db[_0x037a('0xef')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xf0'));db['UserProfileResource']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xf1'));db[_0x037a('0xf2')]=db[_0x037a('0x1')]['import'](_0x037a('0xf3'));db[_0x037a('0xf4')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xf5'));db[_0x037a('0xf6')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xf7'));db['WhatsappInteraction']=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xf8'));db[_0x037a('0xf9')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xfa'));db[_0x037a('0xfb')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0xfc'));db[_0x037a('0xfd')]=db[_0x037a('0x1')]['import'](_0x037a('0xfe'));db[_0x037a('0xff')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x100'));db[_0x037a('0x101')]=db['sequelize'][_0x037a('0x12')](_0x037a('0x102'));db[_0x037a('0x103')]=db[_0x037a('0x1')][_0x037a('0x12')](_0x037a('0x104'));db[_0x037a('0x11')][_0x037a('0x105')](db[_0x037a('0x20')],{'as':_0x037a('0x20'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x11')][_0x037a('0x108')](db[_0x037a('0x1c')],{'as':_0x037a('0x109'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x11')][_0x037a('0x108')](db[_0x037a('0x2b')],{'as':_0x037a('0x10a'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x11')][_0x037a('0x108')](db['VoiceExtension'],{'as':_0x037a('0x10b'),'onDelete':'cascade','hooks':!![]});db['User'][_0x037a('0x108')](db[_0x037a('0x77')],{'as':_0x037a('0x10c'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x11')][_0x037a('0x108')](db[_0x037a('0x79')],{'as':'HopperHistory','foreignKey':_0x037a('0x107')});db[_0x037a('0x11')][_0x037a('0x108')](db[_0x037a('0x10d')],{'as':_0x037a('0x10d'),'foreignKey':'UserId'});db[_0x037a('0x11')][_0x037a('0x108')](db[_0x037a('0x5d')],{'as':_0x037a('0x10e'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x11')][_0x037a('0x108')](db[_0x037a('0x68')],{'as':_0x037a('0x10f'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x11')]['hasMany'](db[_0x037a('0x54')],{'as':_0x037a('0x110'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x11')][_0x037a('0x108')](db['FaxInteraction'],{'as':_0x037a('0x111'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x11')][_0x037a('0x108')](db[_0x037a('0x3c')],{'as':_0x037a('0x112'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x11')][_0x037a('0x108')](db[_0x037a('0x113')],{'as':_0x037a('0x114'),'foreignKey':_0x037a('0x107')});db['User'][_0x037a('0x108')](db[_0x037a('0xf2')],{'as':_0x037a('0x115'),'foreignKey':_0x037a('0x116')});db[_0x037a('0x11')][_0x037a('0x117')](db[_0x037a('0xed')],{'as':_0x037a('0xed'),'foreignKey':_0x037a('0x118')});db[_0x037a('0x11')][_0x037a('0x119')](db[_0x037a('0x11a')],{'as':'Groups','through':'chat_group_has_users'});db[_0x037a('0x11')][_0x037a('0x119')](db[_0x037a('0x11b')],{'as':'Contacts','through':_0x037a('0x11c')});db[_0x037a('0x11')][_0x037a('0x119')](db['CmList'],{'as':'Lists','through':_0x037a('0x11d')});db[_0x037a('0x11')]['belongsToMany'](db[_0x037a('0x11e')],{'through':'user_has_teams'});db[_0x037a('0x11')][_0x037a('0x119')](db['MailInteraction'],{'as':_0x037a('0x112'),'through':_0x037a('0x11f')});db[_0x037a('0x11')]['belongsToMany'](db[_0x037a('0x68')],{'as':_0x037a('0x10f'),'through':_0x037a('0x120')});db['User'][_0x037a('0x119')](db[_0x037a('0x48')],{'as':'FaxInteractions','through':_0x037a('0x121')});db[_0x037a('0x11')][_0x037a('0x119')](db[_0x037a('0x54')],{'as':_0x037a('0x110'),'through':'user_has_sms_interactions'});db['User'][_0x037a('0x119')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x037a('0x122')});db['User'][_0x037a('0x119')](db[_0x037a('0x113')],{'as':_0x037a('0x114'),'through':_0x037a('0x123')});db[_0x037a('0x11')][_0x037a('0x119')](db[_0x037a('0x1a')],{'as':_0x037a('0x124'),'through':_0x037a('0x125'),'required':![]});db[_0x037a('0x11')]['belongsToMany'](db[_0x037a('0x3a')],{'as':_0x037a('0x126'),'through':'UserMailQueue','required':![]});db['User'][_0x037a('0x119')](db[_0x037a('0x6c')],{'as':_0x037a('0x127'),'through':_0x037a('0x128'),'required':![],'hooks':!![]});db[_0x037a('0x11')][_0x037a('0x119')](db['FaxQueue'],{'as':_0x037a('0x129'),'through':_0x037a('0x31'),'required':![]});db[_0x037a('0x11')][_0x037a('0x119')](db[_0x037a('0x58')],{'as':_0x037a('0x12a'),'through':_0x037a('0x33'),'required':![]});db['User']['belongsToMany'](db[_0x037a('0x61')],{'as':_0x037a('0x12b'),'through':_0x037a('0x35'),'required':![]});db[_0x037a('0x11')][_0x037a('0x119')](db[_0x037a('0xff')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x037a('0x11')][_0x037a('0x119')](db[_0x037a('0x12c')],{'through':_0x037a('0x11d')});db[_0x037a('0x11')]['belongsToMany'](db[_0x037a('0x12d')],{'as':'VoicePrefixes','through':_0x037a('0x12e'),'required':![]});db['User']['belongsToMany'](db[_0x037a('0x63')],{'as':_0x037a('0x12f'),'through':_0x037a('0x130')});db[_0x037a('0x11')]['belongsToMany'](db[_0x037a('0x44')],{'as':_0x037a('0x131'),'through':_0x037a('0x132')});db[_0x037a('0x11')][_0x037a('0x119')](db[_0x037a('0x39')],{'as':'MailAccounts','through':_0x037a('0x133')});db['User'][_0x037a('0x119')](db['OpenchannelAccount'],{'as':_0x037a('0x134'),'through':_0x037a('0x135')});db[_0x037a('0x11')]['belongsToMany'](db[_0x037a('0x50')],{'as':_0x037a('0x136'),'through':_0x037a('0x137')});db[_0x037a('0x11')]['belongsToMany'](db[_0x037a('0xf4')],{'as':_0x037a('0x138'),'through':_0x037a('0x139')});db[_0x037a('0x11')][_0x037a('0x119')](db['SquareProject'],{'as':_0x037a('0x13a'),'through':'user_has_square_projects'});db[_0x037a('0x14')][_0x037a('0x108')](db[_0x037a('0x13b')],{'as':_0x037a('0x13c'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x13d')});db['VoiceContext'][_0x037a('0x108')](db[_0x037a('0x13b')],{'onDelete':_0x037a('0x106')});db[_0x037a('0x13b')][_0x037a('0x108')](db[_0x037a('0x13b')],{'as':_0x037a('0x13e'),'onDelete':_0x037a('0x106')});db[_0x037a('0x18')][_0x037a('0x119')](db[_0x037a('0x8c')],{'as':_0x037a('0x13f'),'through':_0x037a('0x140')});db['VoiceQueue'][_0x037a('0x108')](db[_0x037a('0x2b')],{'as':_0x037a('0x141'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x037a('0x108')](db[_0x037a('0x74')],{'as':'Hoppers','foreignKey':_0x037a('0x142')});db[_0x037a('0x1a')]['hasMany'](db[_0x037a('0x77')],{'as':_0x037a('0x10c'),'foreignKey':_0x037a('0x142')});db[_0x037a('0x1a')][_0x037a('0x108')](db[_0x037a('0x79')],{'as':_0x037a('0x143'),'foreignKey':_0x037a('0x142')});db[_0x037a('0x1a')][_0x037a('0x108')](db[_0x037a('0x10d')],{'as':_0x037a('0x10d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x037a('0x108')](db[_0x037a('0x75')],{'as':'HopperBlacks','foreignKey':_0x037a('0x142')});db['VoiceQueue'][_0x037a('0x108')](db[_0x037a('0x144')],{'as':_0x037a('0x145'),'foreignKey':_0x037a('0x142')});db[_0x037a('0x1a')][_0x037a('0x117')](db[_0x037a('0x146')],{'as':_0x037a('0x146'),'foreignKey':'TrunkId'});db[_0x037a('0x1a')][_0x037a('0x117')](db[_0x037a('0x146')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x037a('0x1a')][_0x037a('0x117')](db[_0x037a('0x83')],{'as':_0x037a('0x83'),'foreignKey':'IntervalId'});db[_0x037a('0x1a')][_0x037a('0x117')](db['Pause'],{'as':_0x037a('0x147'),'foreignKey':_0x037a('0x148')});db[_0x037a('0x1a')]['belongsToMany'](db[_0x037a('0x12c')],{'as':_0x037a('0x149'),'through':_0x037a('0x14a')});db[_0x037a('0x1a')][_0x037a('0x119')](db['User'],{'as':_0x037a('0x14b'),'through':'UserVoiceQueue'});db[_0x037a('0x1a')][_0x037a('0x119')](db[_0x037a('0x11e')],{'as':'Teams','through':_0x037a('0x103')});db[_0x037a('0x1a')][_0x037a('0x119')](db['CmList'],{'as':_0x037a('0x14c'),'through':_0x037a('0x14d')});db['VoiceRecording'][_0x037a('0x117')](db[_0x037a('0x11')],{'as':'User','foreignKey':_0x037a('0x107')});db['ScreenRecording'][_0x037a('0x117')](db[_0x037a('0x11')],{'as':_0x037a('0x11'),'foreignKey':_0x037a('0x107')});db['VoiceMail'][_0x037a('0x108')](db[_0x037a('0x14e')],{'as':_0x037a('0x14f'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x150'),'sourceKey':_0x037a('0x151')});db[_0x037a('0x14e')]['belongsTo'](db[_0x037a('0x20')],{'foreignKey':_0x037a('0x150'),'targetKey':_0x037a('0x151')});db[_0x037a('0x23')][_0x037a('0x108')](db['VoiceQueueReport'],{'as':_0x037a('0x152'),'foreignKey':'uniqueid','constraints':![]});db[_0x037a('0x23')][_0x037a('0x108')](db[_0x037a('0x26')],{'as':'AgentReports','foreignKey':_0x037a('0x153'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db['User'],{'as':_0x037a('0x11'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x23')]['belongsTo'](db['CmContact'],{'as':_0x037a('0x154'),'foreignKey':_0x037a('0x155')});db[_0x037a('0x37')][_0x037a('0x117')](db[_0x037a('0x39')],{'as':'MailAccount','foreignKey':_0x037a('0x156')});db[_0x037a('0x157')][_0x037a('0x117')](db['MailAccount'],{'as':_0x037a('0x39'),'foreignKey':'MailAccountId'});db[_0x037a('0x39')]['hasOne'](db['MailServerIn'],{'as':_0x037a('0x158'),'onDelete':_0x037a('0x106')});db[_0x037a('0x39')][_0x037a('0x105')](db[_0x037a('0x157')],{'as':_0x037a('0x159'),'onDelete':'cascade'});db[_0x037a('0x39')][_0x037a('0x108')](db[_0x037a('0x15a')],{'as':_0x037a('0x15b'),'foreignKey':_0x037a('0x156'),'onDelete':_0x037a('0x106')});db[_0x037a('0x39')][_0x037a('0x108')](db[_0x037a('0x15c')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x037a('0x39')][_0x037a('0x108')](db[_0x037a('0x3e')],{'as':_0x037a('0x14f'),'foreignKey':_0x037a('0x156')});db[_0x037a('0x39')]['hasMany'](db['MailInteraction'],{'as':_0x037a('0x15d')});db[_0x037a('0x39')][_0x037a('0x108')](db[_0x037a('0x15e')],{'as':_0x037a('0x13e')});db['MailAccount'][_0x037a('0x117')](db[_0x037a('0x12c')],{'as':'List','foreignKey':_0x037a('0x15f')});db[_0x037a('0x39')]['belongsTo'](db[_0x037a('0x90')],{'as':'Template','foreignKey':_0x037a('0x160')});db[_0x037a('0x39')][_0x037a('0x117')](db[_0x037a('0x85')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x037a('0x39')]['belongsToMany'](db[_0x037a('0x11')],{'as':_0x037a('0x14b'),'through':'user_has_mail_accounts'});db[_0x037a('0x3a')][_0x037a('0x119')](db[_0x037a('0x11')],{'as':_0x037a('0x14b'),'through':'UserMailQueue'});db[_0x037a('0x3a')]['belongsToMany'](db[_0x037a('0x11e')],{'through':'team_has_mail_queues','as':_0x037a('0x161')});db[_0x037a('0x3c')][_0x037a('0x108')](db[_0x037a('0x3e')],{'as':_0x037a('0x14f'),'onDelete':_0x037a('0x106'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x037a('0x117')](db['MailAccount'],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x156')});db[_0x037a('0x3c')][_0x037a('0x117')](db[_0x037a('0x11b')],{'as':_0x037a('0x154'),'foreignKey':_0x037a('0x155')});db['MailInteraction'][_0x037a('0x117')](db[_0x037a('0x11')],{'as':_0x037a('0x163'),'foreignKey':'UserId'});db[_0x037a('0x3c')][_0x037a('0x119')](db[_0x037a('0x8e')],{'through':_0x037a('0x164'),'as':'Tags'});db[_0x037a('0x3c')][_0x037a('0x119')](db[_0x037a('0x8e')],{'through':_0x037a('0x164'),'as':_0x037a('0x165')});db[_0x037a('0x3c')]['belongsToMany'](db['User'],{'as':_0x037a('0x166'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x037a('0x3e')][_0x037a('0x108')](db[_0x037a('0xe0')],{'as':_0x037a('0x167'),'onDelete':_0x037a('0x106')});db[_0x037a('0x3e')][_0x037a('0x117')](db[_0x037a('0x11')],{'as':_0x037a('0x11')});db[_0x037a('0x3e')][_0x037a('0x117')](db[_0x037a('0x11b')],{'onDelete':'cascade','as':_0x037a('0x154')});db[_0x037a('0x3e')][_0x037a('0x117')](db['MailInteraction'],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x037a('0x3e')]['belongsTo'](db['MailAccount'],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x156')});db[_0x037a('0x3e')][_0x037a('0x117')](db[_0x037a('0x63')],{'as':_0x037a('0x63'),'foreignKey':_0x037a('0x168')});db['MailMessage'][_0x037a('0x117')](db[_0x037a('0x6a')],{'as':_0x037a('0x6a'),'foreignKey':_0x037a('0x169')});db[_0x037a('0x15e')][_0x037a('0x117')](db[_0x037a('0x11')],{'onDelete':'restrict'});db['MailApplication'][_0x037a('0x117')](db[_0x037a('0x3a')],{'onDelete':'restrict'});db[_0x037a('0x15e')][_0x037a('0x117')](db['MailAccount'],{'onDelete':_0x037a('0x16a')});db['MailApplication'][_0x037a('0x117')](db['Interval'],{'onDelete':_0x037a('0x16a'),'foreignKey':_0x037a('0x16b')});db[_0x037a('0x15e')][_0x037a('0x117')](db[_0x037a('0x8e')],{'onDelete':'restrict','foreignKey':_0x037a('0x16c')});db[_0x037a('0x16d')][_0x037a('0x117')](db[_0x037a('0x39')],{});db[_0x037a('0x16d')]['belongsTo'](db['CmList'],{'as':_0x037a('0x16e'),'foreignKey':_0x037a('0x15f')});db[_0x037a('0x16d')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x037a('0x155')});db[_0x037a('0x16d')][_0x037a('0x117')](db[_0x037a('0x3c')],{});db['MailQueueReport'][_0x037a('0x117')](db[_0x037a('0x3e')],{});db[_0x037a('0x16d')][_0x037a('0x117')](db['User'],{});db[_0x037a('0x16d')][_0x037a('0x117')](db[_0x037a('0x3a')],{});db[_0x037a('0x41')]['hasMany'](db[_0x037a('0x43')],{'as':_0x037a('0x16f'),'onDelete':_0x037a('0x106')});db[_0x037a('0x44')][_0x037a('0x108')](db[_0x037a('0x15a')],{'as':'Dispositions','foreignKey':_0x037a('0x170'),'onDelete':_0x037a('0x106')});db[_0x037a('0x44')][_0x037a('0x108')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x037a('0x170')});db[_0x037a('0x44')]['hasMany'](db[_0x037a('0x48')],{'as':_0x037a('0x15d')});db['FaxAccount'][_0x037a('0x108')](db['FaxApplication'],{'as':_0x037a('0x13e')});db[_0x037a('0x44')][_0x037a('0x108')](db[_0x037a('0x13b')],{'as':_0x037a('0x171'),'onDelete':_0x037a('0x106')});db[_0x037a('0x44')][_0x037a('0x108')](db[_0x037a('0x4a')],{'as':'Messages'});db['FaxAccount']['belongsTo'](db[_0x037a('0x146')],{'as':_0x037a('0x146')});db[_0x037a('0x44')][_0x037a('0x117')](db[_0x037a('0x12c')],{'as':'List','foreignKey':_0x037a('0x15f')});db[_0x037a('0x44')][_0x037a('0x117')](db[_0x037a('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x037a('0x148')});db[_0x037a('0x44')][_0x037a('0x119')](db['User'],{'as':_0x037a('0x14b'),'through':_0x037a('0x132')});db['FaxApplication'][_0x037a('0x117')](db[_0x037a('0x11')],{'onDelete':_0x037a('0x16a')});db[_0x037a('0x46')]['belongsTo'](db[_0x037a('0x4c')],{'onDelete':_0x037a('0x16a')});db[_0x037a('0x46')][_0x037a('0x117')](db[_0x037a('0x44')],{'onDelete':_0x037a('0x16a')});db[_0x037a('0x46')][_0x037a('0x117')](db['Tag'],{'onDelete':_0x037a('0x16a'),'foreignKey':_0x037a('0x16c')});db[_0x037a('0x48')][_0x037a('0x108')](db[_0x037a('0x4a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x037a('0x172')});db[_0x037a('0x48')]['belongsTo'](db[_0x037a('0x44')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x037a('0x48')]['belongsTo'](db[_0x037a('0x11b')],{'as':'Contact','foreignKey':_0x037a('0x155')});db[_0x037a('0x48')][_0x037a('0x117')](db[_0x037a('0x11')],{'as':_0x037a('0x163'),'foreignKey':_0x037a('0x107')});db['FaxInteraction']['belongsToMany'](db[_0x037a('0x8e')],{'through':_0x037a('0x173'),'as':_0x037a('0x174')});db[_0x037a('0x48')][_0x037a('0x119')](db[_0x037a('0x8e')],{'through':_0x037a('0x173'),'as':_0x037a('0x165')});db['FaxInteraction']['belongsToMany'](db['User'],{'as':_0x037a('0x166'),'through':_0x037a('0x121'),'foreignKey':_0x037a('0x172')});db[_0x037a('0x4a')][_0x037a('0x117')](db[_0x037a('0x11')],{'onDelete':_0x037a('0x106'),'as':_0x037a('0x11')});db['FaxMessage']['belongsTo'](db[_0x037a('0x48')],{'as':_0x037a('0x175'),'foreignKey':_0x037a('0x172')});db[_0x037a('0x4a')]['belongsTo'](db[_0x037a('0x11b')],{'onDelete':_0x037a('0x106'),'as':_0x037a('0x154')});db['FaxMessage'][_0x037a('0x117')](db[_0x037a('0xe0')],{'as':'Attachment','foreignKey':_0x037a('0x176')});db[_0x037a('0x4a')]['belongsTo'](db[_0x037a('0x44')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x170')});db[_0x037a('0x4c')][_0x037a('0x119')](db[_0x037a('0x11')],{'as':'Agents','through':_0x037a('0x31')});db[_0x037a('0x4c')][_0x037a('0x119')](db['Team'],{'through':'team_has_fax_queues','as':_0x037a('0x161')});db[_0x037a('0x4e')]['belongsTo'](db[_0x037a('0x44')],{});db[_0x037a('0x4e')][_0x037a('0x117')](db[_0x037a('0x12c')],{'as':'List','foreignKey':'ListId'});db['FaxQueueReport'][_0x037a('0x117')](db['CmContact'],{'as':'Contact','foreignKey':_0x037a('0x155')});db['FaxQueueReport'][_0x037a('0x117')](db[_0x037a('0x48')],{});db[_0x037a('0x4e')][_0x037a('0x117')](db[_0x037a('0x4a')],{});db[_0x037a('0x4e')][_0x037a('0x117')](db[_0x037a('0x11')],{});db[_0x037a('0x4e')][_0x037a('0x117')](db[_0x037a('0x4c')],{});db[_0x037a('0x50')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x037a('0x177'),'onDelete':'cascade'});db[_0x037a('0x50')][_0x037a('0x108')](db[_0x037a('0x15c')],{'as':_0x037a('0x178'),'foreignKey':_0x037a('0x177')});db['SmsAccount'][_0x037a('0x108')](db[_0x037a('0x56')],{'as':_0x037a('0x14f'),'foreignKey':_0x037a('0x177')});db[_0x037a('0x50')][_0x037a('0x108')](db[_0x037a('0x54')],{'as':_0x037a('0x15d')});db[_0x037a('0x50')][_0x037a('0x108')](db[_0x037a('0x52')],{'as':_0x037a('0x13e')});db[_0x037a('0x50')][_0x037a('0x117')](db[_0x037a('0x12c')],{'as':'List','foreignKey':'ListId'});db[_0x037a('0x50')]['belongsTo'](db[_0x037a('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x037a('0x148')});db[_0x037a('0x50')][_0x037a('0x119')](db['User'],{'as':_0x037a('0x14b'),'through':_0x037a('0x137')});db['SmsApplication'][_0x037a('0x117')](db[_0x037a('0x11')],{'onDelete':_0x037a('0x16a')});db[_0x037a('0x52')]['belongsTo'](db[_0x037a('0x58')],{'onDelete':_0x037a('0x16a')});db['SmsApplication'][_0x037a('0x117')](db[_0x037a('0x50')],{'onDelete':'restrict'});db[_0x037a('0x52')][_0x037a('0x117')](db[_0x037a('0x83')],{'onDelete':_0x037a('0x16a'),'foreignKey':_0x037a('0x16b')});db['SmsApplication'][_0x037a('0x117')](db[_0x037a('0x8e')],{'onDelete':_0x037a('0x16a'),'foreignKey':_0x037a('0x16c')});db[_0x037a('0x54')][_0x037a('0x108')](db[_0x037a('0x56')],{'as':_0x037a('0x14f'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x179')});db[_0x037a('0x54')][_0x037a('0x117')](db[_0x037a('0x50')],{'as':_0x037a('0x162'),'foreignKey':'SmsAccountId'});db[_0x037a('0x54')][_0x037a('0x117')](db[_0x037a('0x11b')],{'as':_0x037a('0x154'),'foreignKey':'ContactId'});db[_0x037a('0x54')][_0x037a('0x117')](db[_0x037a('0x11')],{'as':_0x037a('0x163'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x54')]['belongsToMany'](db['Tag'],{'through':_0x037a('0x17a'),'as':'Tags'});db[_0x037a('0x54')]['belongsToMany'](db[_0x037a('0x8e')],{'through':_0x037a('0x17a'),'as':_0x037a('0x165')});db['SmsInteraction']['belongsToMany'](db[_0x037a('0x11')],{'as':_0x037a('0x166'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0x037a('0x56')][_0x037a('0x117')](db[_0x037a('0x11')],{'as':_0x037a('0x11')});db['SmsMessage'][_0x037a('0x117')](db[_0x037a('0x11b')],{'onDelete':'cascade','as':'Contact'});db['SmsMessage'][_0x037a('0x117')](db[_0x037a('0x54')],{'onDelete':_0x037a('0x106'),'as':_0x037a('0x175'),'foreignKey':'SmsInteractionId'});db[_0x037a('0x56')][_0x037a('0x117')](db['SmsAccount'],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x177')});db[_0x037a('0x58')][_0x037a('0x119')](db[_0x037a('0x11')],{'as':_0x037a('0x14b'),'through':_0x037a('0x33'),'foreignKey':_0x037a('0x17b')});db['SmsQueue'][_0x037a('0x119')](db['Team'],{'through':_0x037a('0x17c'),'as':'Teams'});db[_0x037a('0x5a')][_0x037a('0x108')](db[_0x037a('0x15a')],{'as':_0x037a('0x15b'),'foreignKey':_0x037a('0x17d'),'onDelete':_0x037a('0x106')});db['OpenchannelAccount'][_0x037a('0x108')](db[_0x037a('0x15c')],{'as':_0x037a('0x178'),'foreignKey':_0x037a('0x17d')});db[_0x037a('0x5a')][_0x037a('0x108')](db[_0x037a('0x5d')],{'as':_0x037a('0x15d'),'foreignKey':_0x037a('0x17d')});db[_0x037a('0x5a')]['hasMany'](db[_0x037a('0x5f')],{'as':_0x037a('0x14f'),'foreignKey':_0x037a('0x17d')});db['OpenchannelAccount'][_0x037a('0x108')](db[_0x037a('0x17e')],{'as':_0x037a('0x13e'),'foreignKey':_0x037a('0x17d')});db[_0x037a('0x5a')][_0x037a('0x117')](db['CmList'],{'as':_0x037a('0x16e'),'foreignKey':_0x037a('0x15f')});db[_0x037a('0x5a')]['belongsTo'](db[_0x037a('0x85')],{'as':_0x037a('0x147'),'foreignKey':_0x037a('0x148')});db[_0x037a('0x5a')]['belongsToMany'](db[_0x037a('0x11')],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x037a('0x117')](db[_0x037a('0x11')],{'onDelete':_0x037a('0x16a')});db[_0x037a('0x17e')][_0x037a('0x117')](db[_0x037a('0x61')],{'onDelete':_0x037a('0x16a'),'foreignKey':_0x037a('0x17f')});db[_0x037a('0x17e')][_0x037a('0x117')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x037a('0x17d')});db[_0x037a('0x17e')][_0x037a('0x117')](db[_0x037a('0x83')],{'onDelete':'restrict','foreignKey':_0x037a('0x16b')});db[_0x037a('0x17e')][_0x037a('0x117')](db[_0x037a('0x8e')],{'onDelete':_0x037a('0x16a'),'foreignKey':_0x037a('0x16c')});db[_0x037a('0x5d')]['hasMany'](db[_0x037a('0x5f')],{'as':_0x037a('0x14f'),'onDelete':_0x037a('0x106'),'foreignKey':'OpenchannelInteractionId'});db[_0x037a('0x5d')][_0x037a('0x117')](db[_0x037a('0x5a')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x17d')});db[_0x037a('0x5d')][_0x037a('0x117')](db[_0x037a('0x11b')],{'as':_0x037a('0x154'),'foreignKey':_0x037a('0x155')});db[_0x037a('0x5d')][_0x037a('0x117')](db[_0x037a('0x11')],{'as':_0x037a('0x163'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x5d')][_0x037a('0x119')](db[_0x037a('0x8e')],{'through':_0x037a('0x180'),'as':'Tags'});db[_0x037a('0x5d')][_0x037a('0x119')](db[_0x037a('0x8e')],{'through':_0x037a('0x180'),'as':_0x037a('0x165')});db['OpenchannelInteraction'][_0x037a('0x119')](db['User'],{'as':_0x037a('0x166'),'through':_0x037a('0x122'),'foreignKey':_0x037a('0x181')});db[_0x037a('0x5f')][_0x037a('0x117')](db['User'],{'onDelete':_0x037a('0x106'),'as':_0x037a('0x11')});db['OpenchannelMessage'][_0x037a('0x117')](db[_0x037a('0x11b')],{'onDelete':_0x037a('0x106'),'as':_0x037a('0x154')});db[_0x037a('0x5f')][_0x037a('0x117')](db[_0x037a('0x5d')],{'onDelete':'cascade','as':_0x037a('0x175'),'foreignKey':_0x037a('0x181')});db[_0x037a('0x5f')]['belongsTo'](db[_0x037a('0xe0')],{'as':_0x037a('0xe0'),'foreignKey':_0x037a('0x176')});db[_0x037a('0x5f')][_0x037a('0x117')](db['OpenchannelAccount'],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x17d')});db[_0x037a('0x61')][_0x037a('0x119')](db[_0x037a('0x11')],{'as':_0x037a('0x14b'),'through':_0x037a('0x35'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x037a('0x119')](db['Team'],{'through':_0x037a('0x182'),'as':'Teams'});db[_0x037a('0x63')][_0x037a('0x108')](db[_0x037a('0x15a')],{'as':_0x037a('0x15b'),'foreignKey':_0x037a('0x168'),'onDelete':'cascade'});db['ChatWebsite']['hasMany'](db[_0x037a('0x15c')],{'as':'Answers','foreignKey':_0x037a('0x168')});db[_0x037a('0x63')][_0x037a('0x108')](db[_0x037a('0x6f')],{'as':'ProactiveActions'});db[_0x037a('0x63')][_0x037a('0x108')](db[_0x037a('0x68')],{'as':_0x037a('0x15d')});db[_0x037a('0x63')]['hasMany'](db['ChatApplication'],{'as':_0x037a('0x13e')});db[_0x037a('0x63')][_0x037a('0x108')](db[_0x037a('0x183')],{'as':_0x037a('0x14f')});db[_0x037a('0x63')][_0x037a('0x117')](db[_0x037a('0x12c')],{'as':_0x037a('0x16e'),'foreignKey':_0x037a('0x15f')});db[_0x037a('0x63')][_0x037a('0x117')](db[_0x037a('0x83')],{'as':_0x037a('0x83'),'foreignKey':_0x037a('0x16b')});db[_0x037a('0x63')]['belongsTo'](db[_0x037a('0x39')],{'as':_0x037a('0x39'),'foreignKey':_0x037a('0x156')});db['ChatWebsite'][_0x037a('0x117')](db[_0x037a('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x037a('0x148')});db['ChatWebsite'][_0x037a('0x119')](db['User'],{'as':_0x037a('0x14b'),'through':_0x037a('0x130')});db['OpenchannelQueueReport'][_0x037a('0x117')](db[_0x037a('0x5a')],{});db[_0x037a('0x64')]['belongsTo'](db[_0x037a('0x12c')],{'as':_0x037a('0x16e'),'foreignKey':_0x037a('0x15f')});db['OpenchannelQueueReport'][_0x037a('0x117')](db[_0x037a('0x11b')],{'as':_0x037a('0x154'),'foreignKey':'ContactId'});db[_0x037a('0x64')][_0x037a('0x117')](db['OpenchannelInteraction'],{});db[_0x037a('0x64')][_0x037a('0x117')](db[_0x037a('0x5f')],{});db[_0x037a('0x64')][_0x037a('0x117')](db[_0x037a('0x11')],{});db['OpenchannelQueueReport'][_0x037a('0x117')](db[_0x037a('0x61')],{});db[_0x037a('0x66')][_0x037a('0x117')](db[_0x037a('0x11')],{'as':_0x037a('0x184'),'foreignKey':'UserId','onDelete':_0x037a('0x16a')});db[_0x037a('0x66')][_0x037a('0x117')](db[_0x037a('0x6c')],{'as':_0x037a('0x185'),'foreignKey':'ChatQueueId','onDelete':_0x037a('0x16a')});db[_0x037a('0x66')]['belongsTo'](db[_0x037a('0x63')],{'as':_0x037a('0x186'),'foreignKey':'ChatWebsiteId','onDelete':_0x037a('0x16a')});db[_0x037a('0x66')][_0x037a('0x117')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x037a('0x16c')});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':_0x037a('0x14f'),'onDelete':'cascade','foreignKey':_0x037a('0x187')});db['ChatInteraction']['belongsTo'](db[_0x037a('0x63')],{'as':_0x037a('0x162'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x037a('0x117')](db[_0x037a('0x11b')],{'as':_0x037a('0x154'),'foreignKey':_0x037a('0x155')});db[_0x037a('0x68')][_0x037a('0x117')](db[_0x037a('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0x037a('0x68')][_0x037a('0x119')](db[_0x037a('0x8e')],{'through':_0x037a('0x188'),'as':_0x037a('0x174')});db[_0x037a('0x68')]['belongsToMany'](db[_0x037a('0x8e')],{'through':_0x037a('0x188'),'as':_0x037a('0x165')});db['ChatInteraction'][_0x037a('0x119')](db[_0x037a('0x11')],{'as':_0x037a('0x166'),'through':_0x037a('0x120'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x037a('0x117')](db[_0x037a('0x11')],{'onDelete':_0x037a('0x106'),'as':'User'});db[_0x037a('0x183')][_0x037a('0x117')](db[_0x037a('0x11b')],{'onDelete':'cascade','as':_0x037a('0x154'),'foreignKey':_0x037a('0x155')});db[_0x037a('0x183')]['belongsTo'](db[_0x037a('0x68')],{'onDelete':_0x037a('0x106'),'as':_0x037a('0x175'),'foreignKey':_0x037a('0x187')});db['ChatMessage'][_0x037a('0x117')](db[_0x037a('0xe0')],{'as':_0x037a('0xe0'),'foreignKey':'AttachmentId'});db[_0x037a('0x183')][_0x037a('0x117')](db[_0x037a('0x63')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x168')});db[_0x037a('0x6a')][_0x037a('0x108')](db[_0x037a('0xe0')],{'as':_0x037a('0x167'),'foreignKey':_0x037a('0x169'),'onDelete':_0x037a('0x106'),'hooks':!![]});db[_0x037a('0x6a')][_0x037a('0x117')](db[_0x037a('0x11b')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x037a('0x155')});db['ChatOfflineMessage'][_0x037a('0x117')](db[_0x037a('0x63')],{'as':'Account','foreignKey':_0x037a('0x168')});db[_0x037a('0x6c')]['belongsToMany'](db[_0x037a('0x11')],{'as':_0x037a('0x14b'),'through':_0x037a('0x128'),'hooks':!![]});db[_0x037a('0x6c')][_0x037a('0x119')](db[_0x037a('0x11e')],{'through':_0x037a('0x189'),'as':_0x037a('0x161')});db['ChatGroup'][_0x037a('0x108')](db[_0x037a('0x18a')],{'as':_0x037a('0x14f'),'foreignKey':_0x037a('0x18b'),'onDelete':_0x037a('0x106')});db['ChatGroup'][_0x037a('0x119')](db[_0x037a('0x11')],{'as':_0x037a('0x141'),'through':'chat_group_has_users'});db[_0x037a('0x6f')][_0x037a('0x117')](db[_0x037a('0x63')],{'as':_0x037a('0x186'),'foreignKey':_0x037a('0x168')});db[_0x037a('0x71')][_0x037a('0x108')](db[_0x037a('0x11b')],{'as':'Contacts','foreignKey':_0x037a('0x18c')});db[_0x037a('0x11b')]['hasMany'](db[_0x037a('0x74')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x037a('0x11b')][_0x037a('0x108')](db[_0x037a('0x77')],{'as':_0x037a('0x10c'),'foreignKey':'ContactId'});db[_0x037a('0x11b')][_0x037a('0x108')](db[_0x037a('0x79')],{'as':_0x037a('0x143'),'foreignKey':'ContactId'});db[_0x037a('0x11b')][_0x037a('0x108')](db[_0x037a('0x10d')],{'as':_0x037a('0x10d'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x037a('0x144')],{'as':_0x037a('0x145'),'foreignKey':'ContactId'});db[_0x037a('0x11b')][_0x037a('0x108')](db['OpenchannelInteraction'],{'as':_0x037a('0x10e'),'foreignKey':_0x037a('0x155'),'onDelete':_0x037a('0x16a')});db[_0x037a('0x11b')]['hasMany'](db[_0x037a('0x68')],{'as':_0x037a('0x10f'),'foreignKey':_0x037a('0x155'),'onDelete':_0x037a('0x16a')});db['CmContact']['hasMany'](db[_0x037a('0x54')],{'as':'SmsInteractions','foreignKey':_0x037a('0x155'),'onDelete':_0x037a('0x16a')});db[_0x037a('0x11b')][_0x037a('0x108')](db['FaxInteraction'],{'as':_0x037a('0x111'),'foreignKey':'ContactId','onDelete':_0x037a('0x16a')});db['CmContact'][_0x037a('0x108')](db['MailInteraction'],{'as':_0x037a('0x112'),'foreignKey':_0x037a('0x155'),'onDelete':'restrict'});db[_0x037a('0x11b')][_0x037a('0x117')](db[_0x037a('0x71')],{'as':'Company','foreignKey':_0x037a('0x18c')});db[_0x037a('0x11b')]['belongsTo'](db[_0x037a('0x12c')],{'as':_0x037a('0x16e'),'foreignKey':_0x037a('0x15f'),'onDelete':_0x037a('0x106')});db[_0x037a('0x11b')][_0x037a('0x119')](db[_0x037a('0x11')],{'as':_0x037a('0x166'),'through':_0x037a('0x11c')});db[_0x037a('0x11b')][_0x037a('0x119')](db[_0x037a('0x8e')],{'as':'Tags','through':_0x037a('0x18d')});db['CmContact'][_0x037a('0x119')](db[_0x037a('0x8e')],{'through':_0x037a('0x18d'),'as':_0x037a('0x165')});db[_0x037a('0x74')]['belongsTo'](db['CmContact'],{'as':_0x037a('0x154'),'foreignKey':'ContactId','onDelete':_0x037a('0x106')});db[_0x037a('0x74')][_0x037a('0x117')](db[_0x037a('0x12c')],{'as':_0x037a('0x16e'),'foreignKey':_0x037a('0x15f'),'onDelete':'cascade'});db[_0x037a('0x74')][_0x037a('0x117')](db[_0x037a('0x11')],{'as':_0x037a('0x184'),'foreignKey':_0x037a('0x107')});db[_0x037a('0x74')][_0x037a('0x117')](db['VoiceQueue'],{'as':_0x037a('0x185'),'foreignKey':'VoiceQueueId','onDelete':_0x037a('0x106')});db[_0x037a('0x74')]['belongsTo'](db[_0x037a('0x18e')],{'as':_0x037a('0x18e'),'foreignKey':_0x037a('0x18f'),'onDelete':_0x037a('0x106')});db[_0x037a('0x74')][_0x037a('0x117')](db[_0x037a('0x11')],{'as':'Owner','foreignKey':_0x037a('0x190')});db[_0x037a('0x75')][_0x037a('0x117')](db[_0x037a('0x11b')],{'as':_0x037a('0x154'),'foreignKey':'ContactId','onDelete':_0x037a('0x106')});db[_0x037a('0x75')][_0x037a('0x117')](db[_0x037a('0x12c')],{'as':_0x037a('0x16e'),'foreignKey':_0x037a('0x15f'),'onDelete':_0x037a('0x106')});db[_0x037a('0x75')]['belongsTo'](db[_0x037a('0x1a')],{'as':_0x037a('0x185'),'foreignKey':_0x037a('0x142'),'onDelete':_0x037a('0x106')});db[_0x037a('0x75')][_0x037a('0x117')](db[_0x037a('0x18e')],{'as':'Campaign','foreignKey':_0x037a('0x18f'),'onDelete':_0x037a('0x106')});db[_0x037a('0x7e')][_0x037a('0x108')](db[_0x037a('0x82')],{'as':{'plural':'All','singular':_0x037a('0x191')},'foreignKey':_0x037a('0x192'),'onDelete':_0x037a('0x106'),'hooks':!![]});db[_0x037a('0x7e')][_0x037a('0x108')](db[_0x037a('0x82')],{'as':{'plural':_0x037a('0x193'),'singular':_0x037a('0x194')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x037a('0x7e')][_0x037a('0x108')](db['Action'],{'as':_0x037a('0x195'),'foreignKey':'AutomationId','onDelete':_0x037a('0x106'),'hooks':!![]});db[_0x037a('0x15a')][_0x037a('0x108')](db['Disposition'],{'as':_0x037a('0x15b'),'foreignKey':_0x037a('0x196'),'onDelete':_0x037a('0x106')});db[_0x037a('0x83')][_0x037a('0x108')](db[_0x037a('0x83')],{'as':_0x037a('0x197'),'foreignKey':_0x037a('0x16b'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x037a('0x83')][_0x037a('0x108')](db[_0x037a('0x13b')],{'as':_0x037a('0x10b'),'foreignKey':_0x037a('0x16b'),'onDelete':'restrict'});db[_0x037a('0x83')][_0x037a('0x108')](db[_0x037a('0x15e')],{'as':_0x037a('0x198'),'foreignKey':_0x037a('0x16b')});db[_0x037a('0x83')][_0x037a('0x108')](db['ChatApplication'],{'as':_0x037a('0x199'),'foreignKey':_0x037a('0x16b')});db['Interval'][_0x037a('0x108')](db[_0x037a('0x46')],{'as':_0x037a('0x19a'),'foreignKey':_0x037a('0x16b')});db[_0x037a('0x83')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x037a('0x16b')});db['Schedule'][_0x037a('0x117')](db[_0x037a('0x39')],{});db['Schedule'][_0x037a('0x117')](db[_0x037a('0x98')],{'foreignKey':_0x037a('0x19b')});db['Schedule']['belongsTo'](db[_0x037a('0x96')],{'foreignKey':_0x037a('0x19c')});db[_0x037a('0x8c')][_0x037a('0x119')](db[_0x037a('0x18')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x037a('0x16a')});db[_0x037a('0x8e')][_0x037a('0x119')](db[_0x037a('0x11b')],{'through':_0x037a('0x18d')});db[_0x037a('0x8e')][_0x037a('0x119')](db[_0x037a('0x68')],{'through':_0x037a('0x188')});db['Tag']['belongsToMany'](db[_0x037a('0x3c')],{'through':_0x037a('0x164')});db[_0x037a('0x8e')][_0x037a('0x119')](db[_0x037a('0x54')],{'through':'sms_interaction_has_tags'});db[_0x037a('0x8e')]['belongsToMany'](db['FaxInteraction'],{'through':_0x037a('0x173')});db[_0x037a('0x8e')][_0x037a('0x119')](db[_0x037a('0x5d')],{'through':_0x037a('0x180')});db[_0x037a('0x8e')][_0x037a('0x119')](db[_0x037a('0x113')],{'through':_0x037a('0x19d')});db[_0x037a('0x92')][_0x037a('0x108')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x037a('0x19e')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0x037a('0x19f')},'foreignKey':_0x037a('0x1a0'),'onDelete':_0x037a('0x106'),'hooks':!![]});db['Trigger'][_0x037a('0x108')](db['Action'],{'as':_0x037a('0x195'),'foreignKey':_0x037a('0x1a1'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0x037a('0x108')](db[_0x037a('0x9d')],{'as':_0x037a('0x1a2'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x19c'),'hooks':!![]});db[_0x037a('0x98')][_0x037a('0x108')](db[_0x037a('0x9d')],{'as':_0x037a('0x1a2'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x19b')});db[_0x037a('0x9b')][_0x037a('0x108')](db[_0x037a('0x9d')],{'as':_0x037a('0x1a2'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a3')});db[_0x037a('0x9d')][_0x037a('0x117')](db[_0x037a('0x9b')],{'foreignKey':_0x037a('0x1a3')});db[_0x037a('0x1a4')][_0x037a('0x108')](db[_0x037a('0x1a5')],{'as':_0x037a('0x1a6'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a7')});db[_0x037a('0x1a5')][_0x037a('0x108')](db[_0x037a('0xa1')],{'as':'Subjects','onDelete':_0x037a('0x106'),'foreignKey':'SubjectId'});db[_0x037a('0x1a5')][_0x037a('0x108')](db['SalesforceField'],{'as':_0x037a('0x1a8'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a9')});db[_0x037a('0x1a5')][_0x037a('0x108')](db[_0x037a('0xa1')],{'as':_0x037a('0x1a2'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1aa')});db['SalesforceConfiguration'][_0x037a('0x117')](db[_0x037a('0x1a4')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x1a7')});db[_0x037a('0xa1')][_0x037a('0x108')](db[_0x037a('0xa1')],{'as':_0x037a('0x1ab'),'foreignKey':_0x037a('0x1ac')});db[_0x037a('0xa1')][_0x037a('0x108')](db[_0x037a('0xa1')],{'as':_0x037a('0x1ad'),'foreignKey':_0x037a('0x1a9')});db[_0x037a('0xa1')][_0x037a('0x108')](db[_0x037a('0xa1')],{'as':_0x037a('0x1ae'),'foreignKey':'FieldId'});db['SalesforceField'][_0x037a('0x117')](db[_0x037a('0x1af')],{'as':_0x037a('0x1af'),'foreignKey':_0x037a('0x1b0')});db[_0x037a('0x1b1')][_0x037a('0x108')](db[_0x037a('0xa3')],{'as':_0x037a('0x1a6'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a7')});db[_0x037a('0xa3')][_0x037a('0x108')](db[_0x037a('0xa4')],{'as':_0x037a('0x1b2'),'onDelete':'cascade','foreignKey':_0x037a('0x1ac')});db[_0x037a('0xa3')][_0x037a('0x108')](db['SugarcrmField'],{'as':_0x037a('0x1a8'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a9')});db[_0x037a('0xa3')][_0x037a('0x108')](db[_0x037a('0xa4')],{'as':_0x037a('0x1a2'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1aa')});db[_0x037a('0xa3')][_0x037a('0x117')](db[_0x037a('0x1b1')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x1a7')});db['SugarcrmField'][_0x037a('0x108')](db[_0x037a('0xa4')],{'as':'Subject','foreignKey':_0x037a('0x1ac')});db[_0x037a('0xa4')][_0x037a('0x108')](db[_0x037a('0xa4')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x037a('0x108')](db[_0x037a('0xa4')],{'as':_0x037a('0x1ae'),'foreignKey':'FieldId'});db[_0x037a('0xa4')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x037a('0x1b0')});db[_0x037a('0xa5')][_0x037a('0x108')](db[_0x037a('0xa6')],{'as':_0x037a('0x1a6'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a7')});db['DeskConfiguration'][_0x037a('0x108')](db[_0x037a('0x1b3')],{'as':_0x037a('0x1b2'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1ac')});db[_0x037a('0xa6')][_0x037a('0x108')](db[_0x037a('0x1b3')],{'as':_0x037a('0x1a8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x037a('0xa6')][_0x037a('0x108')](db[_0x037a('0x1b3')],{'as':'Fields','onDelete':_0x037a('0x106'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x037a('0x117')](db[_0x037a('0xa5')],{'as':'Account','foreignKey':_0x037a('0x1a7')});db['DeskConfiguration'][_0x037a('0x119')](db[_0x037a('0x8e')],{'through':'int_desk_configuration_has_tags'});db[_0x037a('0x1b3')][_0x037a('0x108')](db[_0x037a('0x1b3')],{'as':'Subject','foreignKey':_0x037a('0x1ac')});db['DeskField'][_0x037a('0x108')](db[_0x037a('0x1b3')],{'as':_0x037a('0x1ad'),'foreignKey':_0x037a('0x1a9')});db[_0x037a('0x1b3')][_0x037a('0x108')](db[_0x037a('0x1b3')],{'as':'Field','foreignKey':_0x037a('0x1aa')});db['DeskField'][_0x037a('0x117')](db['Variable'],{'as':_0x037a('0x1af'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x037a('0x108')](db[_0x037a('0xaa')],{'as':_0x037a('0x1a6'),'onDelete':_0x037a('0x106'),'foreignKey':'AccountId'});db[_0x037a('0xaa')][_0x037a('0x108')](db[_0x037a('0xac')],{'as':_0x037a('0x1b2'),'onDelete':_0x037a('0x106'),'foreignKey':'SubjectId'});db[_0x037a('0xaa')][_0x037a('0x108')](db[_0x037a('0xac')],{'as':_0x037a('0x1a8'),'onDelete':_0x037a('0x106'),'foreignKey':'DescriptionId'});db[_0x037a('0xaa')]['hasMany'](db['ZohoField'],{'as':_0x037a('0x1a2'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1aa')});db[_0x037a('0xaa')][_0x037a('0x117')](db[_0x037a('0x1b4')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x1a7')});db[_0x037a('0xac')][_0x037a('0x108')](db[_0x037a('0xac')],{'as':_0x037a('0x1ab'),'foreignKey':_0x037a('0x1ac')});db['ZohoField'][_0x037a('0x108')](db[_0x037a('0xac')],{'as':_0x037a('0x1ad'),'foreignKey':_0x037a('0x1a9')});db[_0x037a('0xac')]['hasMany'](db[_0x037a('0xac')],{'as':_0x037a('0x1ae'),'foreignKey':_0x037a('0x1aa')});db['ZohoField'][_0x037a('0x117')](db[_0x037a('0x1af')],{'as':_0x037a('0x1af'),'foreignKey':_0x037a('0x1b0')});db[_0x037a('0xad')][_0x037a('0x108')](db[_0x037a('0xaf')],{'as':'Configurations','onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a7')});db['ZendeskConfiguration'][_0x037a('0x108')](db[_0x037a('0x1b5')],{'as':_0x037a('0x1b2'),'foreignKey':_0x037a('0x1ac')});db['ZendeskConfiguration'][_0x037a('0x108')](db[_0x037a('0x1b5')],{'as':_0x037a('0x1a8'),'foreignKey':_0x037a('0x1a9')});db[_0x037a('0xaf')]['hasMany'](db[_0x037a('0x1b5')],{'as':_0x037a('0x1a2'),'foreignKey':_0x037a('0x1aa')});db[_0x037a('0xaf')]['belongsTo'](db[_0x037a('0xad')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x1a7')});db['ZendeskConfiguration'][_0x037a('0x119')](db['Tag'],{'through':_0x037a('0x1b6')});db[_0x037a('0x1b5')]['hasMany'](db[_0x037a('0x1b5')],{'as':'Subject','foreignKey':_0x037a('0x1ac')});db['ZendeskField'][_0x037a('0x108')](db[_0x037a('0x1b5')],{'as':_0x037a('0x1ad'),'foreignKey':_0x037a('0x1a9')});db['ZendeskField'][_0x037a('0x108')](db['ZendeskField'],{'as':_0x037a('0x1ae'),'foreignKey':_0x037a('0x1aa')});db['ZendeskField'][_0x037a('0x117')](db[_0x037a('0x1af')],{'as':'Variable','foreignKey':_0x037a('0x1b0')});db['FreshdeskAccount'][_0x037a('0x108')](db[_0x037a('0xb3')],{'as':_0x037a('0x1a6'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x037a('0x108')](db[_0x037a('0xb5')],{'as':_0x037a('0x1b2'),'onDelete':'cascade','foreignKey':_0x037a('0x1ac')});db[_0x037a('0xb3')][_0x037a('0x108')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a9')});db[_0x037a('0xb3')][_0x037a('0x108')](db['FreshdeskField'],{'as':_0x037a('0x1a2'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1aa')});db['FreshdeskConfiguration'][_0x037a('0x117')](db[_0x037a('0xb1')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x1a7')});db[_0x037a('0xb3')][_0x037a('0x119')](db[_0x037a('0x8e')],{'through':_0x037a('0x1b7')});db[_0x037a('0xb5')][_0x037a('0x108')](db[_0x037a('0xb5')],{'as':_0x037a('0x1ab'),'foreignKey':'SubjectId'});db[_0x037a('0xb5')][_0x037a('0x108')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x037a('0x1a9')});db[_0x037a('0xb5')][_0x037a('0x108')](db[_0x037a('0xb5')],{'as':_0x037a('0x1ae'),'foreignKey':_0x037a('0x1aa')});db[_0x037a('0xb5')][_0x037a('0x117')](db['Variable'],{'as':_0x037a('0x1af'),'foreignKey':_0x037a('0x1b0')});db[_0x037a('0x1b8')][_0x037a('0x108')](db['VtigerConfiguration'],{'as':_0x037a('0x1a6'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a7')});db['VtigerConfiguration'][_0x037a('0x108')](db['VtigerField'],{'as':'Subjects','foreignKey':_0x037a('0x1ac')});db[_0x037a('0x1b9')][_0x037a('0x108')](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x037a('0x108')](db['VtigerField'],{'as':_0x037a('0x1a2'),'foreignKey':_0x037a('0x1aa')});db['VtigerConfiguration'][_0x037a('0x117')](db[_0x037a('0x1b8')],{'as':'Account','foreignKey':'AccountId'});db[_0x037a('0xb8')][_0x037a('0x108')](db[_0x037a('0xb8')],{'as':_0x037a('0x1ab'),'foreignKey':_0x037a('0x1ac')});db[_0x037a('0xb8')]['hasMany'](db[_0x037a('0xb8')],{'as':'Description','foreignKey':_0x037a('0x1a9')});db[_0x037a('0xb8')]['hasMany'](db[_0x037a('0xb8')],{'as':_0x037a('0x1ae'),'foreignKey':_0x037a('0x1aa')});db[_0x037a('0xb8')][_0x037a('0x117')](db[_0x037a('0x1af')],{'as':_0x037a('0x1af'),'foreignKey':_0x037a('0x1b0')});db['ServicenowAccount'][_0x037a('0x108')](db[_0x037a('0x1ba')],{'as':'Configurations','onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a7')});db['ServicenowConfiguration'][_0x037a('0x108')](db[_0x037a('0x1bb')],{'as':'Subjects','foreignKey':_0x037a('0x1ac')});db['ServicenowConfiguration']['hasMany'](db[_0x037a('0x1bb')],{'as':_0x037a('0x1a8'),'foreignKey':_0x037a('0x1a9')});db[_0x037a('0x1ba')][_0x037a('0x108')](db[_0x037a('0x1bb')],{'as':_0x037a('0x1a2'),'foreignKey':_0x037a('0x1aa')});db[_0x037a('0x1ba')][_0x037a('0x117')](db['ServicenowAccount'],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x1a7')});db[_0x037a('0x1bb')][_0x037a('0x108')](db[_0x037a('0x1bb')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x037a('0x1bb')][_0x037a('0x108')](db['ServicenowField'],{'as':_0x037a('0x1ad'),'foreignKey':'DescriptionId'});db[_0x037a('0x1bb')][_0x037a('0x108')](db[_0x037a('0x1bb')],{'as':_0x037a('0x1ae'),'foreignKey':'FieldId'});db[_0x037a('0x1bb')][_0x037a('0x117')](db['Variable'],{'as':_0x037a('0x1af'),'foreignKey':_0x037a('0x1b0')});db[_0x037a('0xbd')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x037a('0x1a6'),'onDelete':_0x037a('0x106'),'foreignKey':'AccountId'});db[_0x037a('0xbf')][_0x037a('0x108')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1ac')});db[_0x037a('0xbf')][_0x037a('0x108')](db[_0x037a('0x1bc')],{'as':_0x037a('0x1a8'),'onDelete':_0x037a('0x106'),'foreignKey':'DescriptionId'});db[_0x037a('0xbf')][_0x037a('0x108')](db[_0x037a('0x1bc')],{'as':_0x037a('0x1a2'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x037a('0xbf')][_0x037a('0x117')](db[_0x037a('0xbd')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x1a7')});db[_0x037a('0x1bc')][_0x037a('0x108')](db[_0x037a('0x1bc')],{'as':_0x037a('0x1ab'),'foreignKey':_0x037a('0x1ac')});db[_0x037a('0x1bc')][_0x037a('0x108')](db[_0x037a('0x1bc')],{'as':_0x037a('0x1ad'),'foreignKey':'DescriptionId'});db[_0x037a('0x1bc')][_0x037a('0x108')](db[_0x037a('0x1bc')],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field'][_0x037a('0x117')](db[_0x037a('0x1af')],{'as':_0x037a('0x1af'),'foreignKey':_0x037a('0x1b0')});db[_0x037a('0x1bd')]['hasMany'](db[_0x037a('0xc2')],{'as':_0x037a('0x1a6'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1a7')});db[_0x037a('0xc2')][_0x037a('0x108')](db[_0x037a('0xc4')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x037a('0xc2')][_0x037a('0x108')](db[_0x037a('0xc4')],{'as':'Descriptions','foreignKey':_0x037a('0x1a9')});db[_0x037a('0xc2')]['hasMany'](db[_0x037a('0xc4')],{'as':'Fields','foreignKey':'FieldId'});db[_0x037a('0xc2')][_0x037a('0x117')](db[_0x037a('0x1bd')],{'as':_0x037a('0x162'),'foreignKey':_0x037a('0x1a7')});db[_0x037a('0xc4')][_0x037a('0x108')](db[_0x037a('0xc4')],{'as':_0x037a('0x1ab'),'foreignKey':_0x037a('0x1ac')});db[_0x037a('0xc4')][_0x037a('0x108')](db[_0x037a('0xc4')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x037a('0xc4')][_0x037a('0x108')](db['FreshsalesField'],{'as':_0x037a('0x1ae'),'foreignKey':_0x037a('0x1aa')});db['FreshsalesField'][_0x037a('0x117')](db[_0x037a('0x1af')],{'as':_0x037a('0x1af'),'foreignKey':_0x037a('0x1b0')});db[_0x037a('0xc9')][_0x037a('0x117')](db[_0x037a('0x63')],{});db[_0x037a('0xc9')][_0x037a('0x117')](db[_0x037a('0x12c')],{'as':'List','foreignKey':_0x037a('0x15f')});db[_0x037a('0xc9')][_0x037a('0x117')](db[_0x037a('0x11b')],{'as':_0x037a('0x154'),'foreignKey':_0x037a('0x155')});db['ChatQueueReport'][_0x037a('0x117')](db['ChatInteraction'],{});db[_0x037a('0xc9')]['belongsTo'](db[_0x037a('0x183')],{});db['ChatQueueReport'][_0x037a('0x117')](db[_0x037a('0x11')],{});db['ChatQueueReport'][_0x037a('0x117')](db[_0x037a('0x6c')],{});db[_0x037a('0x18a')][_0x037a('0x117')](db['User'],{'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1be')});db[_0x037a('0x18a')]['belongsTo'](db['User'],{'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1bf')});db[_0x037a('0x144')][_0x037a('0x108')](db['JscriptyQuestionReport'],{'foreignKey':_0x037a('0x1c0'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x037a('0x108')](db['JscriptyAnswerReport'],{'foreignKey':_0x037a('0x1c0'),'onDelete':'cascade'});db['SmsQueueReport']['belongsTo'](db['SmsAccount'],{});db[_0x037a('0xcf')]['belongsTo'](db[_0x037a('0x12c')],{'as':'List','foreignKey':_0x037a('0x15f')});db['SmsQueueReport']['belongsTo'](db[_0x037a('0x11b')],{'as':_0x037a('0x154'),'foreignKey':_0x037a('0x155')});db['SmsQueueReport'][_0x037a('0x117')](db[_0x037a('0x54')],{});db['SmsQueueReport'][_0x037a('0x117')](db[_0x037a('0x56')],{});db[_0x037a('0xcf')][_0x037a('0x117')](db[_0x037a('0x11')],{});db[_0x037a('0xcf')][_0x037a('0x117')](db[_0x037a('0x58')],{});db[_0x037a('0xd2')]['hasMany'](db[_0x037a('0x144')],{'foreignKey':_0x037a('0x1c1')});db['JscriptyProject'][_0x037a('0x108')](db[_0x037a('0xce')],{'foreignKey':_0x037a('0x1c1')});db[_0x037a('0xd2')][_0x037a('0x108')](db[_0x037a('0xcc')],{'foreignKey':'ProjectId'});db['SquareProject'][_0x037a('0x119')](db[_0x037a('0x11')],{'as':'Users','through':_0x037a('0x1c2')});db['Team']['belongsToMany'](db[_0x037a('0x11')],{'as':_0x037a('0x14b'),'through':_0x037a('0x1c3')});db[_0x037a('0x11e')][_0x037a('0x119')](db[_0x037a('0x1a')],{'through':_0x037a('0x103'),'as':_0x037a('0x124')});db['Team'][_0x037a('0x119')](db['MailQueue'],{'through':_0x037a('0x1c4'),'as':'MailQueues'});db['Team'][_0x037a('0x119')](db[_0x037a('0x6c')],{'through':'team_has_chat_queues','as':_0x037a('0x127')});db[_0x037a('0x11e')][_0x037a('0x119')](db[_0x037a('0x4c')],{'through':_0x037a('0x1c5'),'as':'FaxQueues'});db['Team'][_0x037a('0x119')](db[_0x037a('0x58')],{'through':'team_has_sms_queues','as':_0x037a('0x12a')});db[_0x037a('0x11e')]['belongsToMany'](db[_0x037a('0x61')],{'through':_0x037a('0x182'),'as':_0x037a('0x12b')});db[_0x037a('0x11e')]['belongsToMany'](db[_0x037a('0xff')],{'through':'team_has_whatsapp_queues','as':_0x037a('0x1c6')});db[_0x037a('0x18e')][_0x037a('0x108')](db[_0x037a('0x74')],{'as':'Hoppers','foreignKey':_0x037a('0x18f')});db[_0x037a('0x18e')][_0x037a('0x108')](db[_0x037a('0x77')],{'as':_0x037a('0x10c'),'foreignKey':_0x037a('0x18f')});db['Campaign'][_0x037a('0x108')](db[_0x037a('0x79')],{'as':'HopperHistories','foreignKey':_0x037a('0x18f')});db['Campaign'][_0x037a('0x108')](db[_0x037a('0x75')],{'as':_0x037a('0x1c7'),'foreignKey':_0x037a('0x18f')});db[_0x037a('0x18e')][_0x037a('0x117')](db['Trunk'],{'as':_0x037a('0x146'),'foreignKey':_0x037a('0x1c8')});db['Campaign'][_0x037a('0x117')](db['Trunk'],{'as':_0x037a('0x1c9'),'foreignKey':_0x037a('0x1ca')});db[_0x037a('0x18e')][_0x037a('0x117')](db[_0x037a('0x83')],{'as':_0x037a('0x83'),'foreignKey':_0x037a('0x16b')});db['Campaign'][_0x037a('0x117')](db[_0x037a('0xd8')],{'as':_0x037a('0xd8'),'foreignKey':_0x037a('0x1cb')});db[_0x037a('0x18e')][_0x037a('0x119')](db['CmList'],{'as':_0x037a('0x149'),'through':_0x037a('0x1cc')});db['Campaign'][_0x037a('0x119')](db[_0x037a('0x12c')],{'as':_0x037a('0x14c'),'through':_0x037a('0x1cd')});db[_0x037a('0xe0')][_0x037a('0x117')](db[_0x037a('0x6a')],{'as':_0x037a('0x6a'),'foreignKey':_0x037a('0x169')});db[_0x037a('0xe4')][_0x037a('0x117')](db[_0x037a('0x3e')],{});db[_0x037a('0xe4')][_0x037a('0x117')](db[_0x037a('0x3c')],{});db[_0x037a('0xe4')][_0x037a('0x117')](db['MailAccount'],{'foreignKey':_0x037a('0x1ce'),'as':_0x037a('0x1cf')});db[_0x037a('0xe4')]['belongsTo'](db[_0x037a('0x11')],{'foreignKey':_0x037a('0x1d0'),'as':_0x037a('0x1d1')});db['MailTransferReport'][_0x037a('0x117')](db[_0x037a('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db['MailTransferReport']['belongsTo'](db[_0x037a('0x3a')],{'foreignKey':_0x037a('0x1d2'),'as':_0x037a('0x1d3')});db['MailTransferReport'][_0x037a('0x117')](db[_0x037a('0x39')],{'foreignKey':'ToMailAccountId','as':_0x037a('0x1d4')});db[_0x037a('0x1d5')]['belongsTo'](db[_0x037a('0x183')],{});db[_0x037a('0x1d5')][_0x037a('0x117')](db[_0x037a('0x68')],{});db['ChatTransferReport'][_0x037a('0x117')](db[_0x037a('0x63')],{'foreignKey':_0x037a('0x1d6'),'as':'FromAccount'});db[_0x037a('0x1d5')][_0x037a('0x117')](db['User'],{'foreignKey':_0x037a('0x1d0'),'as':_0x037a('0x1d1')});db['ChatTransferReport'][_0x037a('0x117')](db[_0x037a('0x11')],{'foreignKey':_0x037a('0x1d7'),'as':_0x037a('0x1d8')});db[_0x037a('0x1d5')][_0x037a('0x117')](db['ChatQueue'],{'foreignKey':_0x037a('0x1d9'),'as':'ToQueue'});db[_0x037a('0x1d5')][_0x037a('0x117')](db[_0x037a('0x63')],{'foreignKey':'ToChatWebsiteId','as':_0x037a('0x1d4')});db[_0x037a('0xe5')][_0x037a('0x117')](db['FaxMessage'],{});db[_0x037a('0xe5')]['belongsTo'](db[_0x037a('0x48')],{});db[_0x037a('0xe5')][_0x037a('0x117')](db['FaxAccount'],{'foreignKey':_0x037a('0x1da'),'as':_0x037a('0x1cf')});db[_0x037a('0xe5')][_0x037a('0x117')](db[_0x037a('0x11')],{'foreignKey':_0x037a('0x1d0'),'as':'FromAgent'});db['FaxTransferReport'][_0x037a('0x117')](db[_0x037a('0x11')],{'foreignKey':_0x037a('0x1d7'),'as':'ToAgent'});db[_0x037a('0xe5')][_0x037a('0x117')](db['FaxQueue'],{'foreignKey':_0x037a('0x1db'),'as':_0x037a('0x1d3')});db['FaxTransferReport'][_0x037a('0x117')](db['FaxAccount'],{'foreignKey':_0x037a('0x1dc'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0x037a('0x117')](db[_0x037a('0x5f')],{});db[_0x037a('0xe7')]['belongsTo'](db[_0x037a('0x5d')],{});db[_0x037a('0xe7')][_0x037a('0x117')](db[_0x037a('0x5a')],{'foreignKey':_0x037a('0x1dd'),'as':'FromAccount'});db[_0x037a('0xe7')][_0x037a('0x117')](db['User'],{'foreignKey':_0x037a('0x1d0'),'as':_0x037a('0x1d1')});db['OpenchannelTransferReport'][_0x037a('0x117')](db[_0x037a('0x11')],{'foreignKey':'ToUserId','as':_0x037a('0x1d8')});db[_0x037a('0xe7')][_0x037a('0x117')](db['OpenchannelQueue'],{'foreignKey':_0x037a('0x1de'),'as':'ToQueue'});db[_0x037a('0xe7')][_0x037a('0x117')](db[_0x037a('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0x037a('0x1d4')});db[_0x037a('0xe9')][_0x037a('0x117')](db['SmsMessage'],{});db[_0x037a('0xe9')]['belongsTo'](db['SmsInteraction'],{});db[_0x037a('0xe9')][_0x037a('0x117')](db[_0x037a('0x50')],{'foreignKey':_0x037a('0x1df'),'as':'FromAccount'});db[_0x037a('0xe9')]['belongsTo'](db[_0x037a('0x11')],{'foreignKey':'FromUserId','as':_0x037a('0x1d1')});db[_0x037a('0xe9')][_0x037a('0x117')](db[_0x037a('0x11')],{'foreignKey':'ToUserId','as':_0x037a('0x1d8')});db[_0x037a('0xe9')][_0x037a('0x117')](db[_0x037a('0x58')],{'foreignKey':_0x037a('0x1e0'),'as':'ToQueue'});db[_0x037a('0xe9')]['belongsTo'](db[_0x037a('0x50')],{'foreignKey':'ToSmsAccountId','as':_0x037a('0x1d4')});db[_0x037a('0x12c')][_0x037a('0x108')](db['Disposition'],{'as':_0x037a('0x15b'),'foreignKey':_0x037a('0x15f'),'onDelete':_0x037a('0x106')});db[_0x037a('0x12c')][_0x037a('0x108')](db[_0x037a('0x7b')],{'as':_0x037a('0x1e1'),'foreignKey':'ListId'});db[_0x037a('0x12c')][_0x037a('0x108')](db[_0x037a('0x11b')],{'as':_0x037a('0x1e2'),'onDelete':'cascade','foreignKey':'ListId'});db['CmList'][_0x037a('0x108')](db[_0x037a('0x77')],{'as':_0x037a('0x10c'),'foreignKey':_0x037a('0x15f')});db[_0x037a('0x12c')][_0x037a('0x108')](db['CmHopperHistory'],{'as':_0x037a('0x1e3'),'foreignKey':_0x037a('0x15f')});db[_0x037a('0x12c')][_0x037a('0x108')](db['ReportAgentPreview'],{'as':_0x037a('0x10d'),'foreignKey':_0x037a('0x15f')});db[_0x037a('0x12c')][_0x037a('0x119')](db[_0x037a('0x1a')],{'as':_0x037a('0x1e4'),'through':_0x037a('0x14a')});db[_0x037a('0x12c')]['belongsToMany'](db[_0x037a('0x11')],{'as':_0x037a('0x14b'),'through':_0x037a('0x11d')});db['VoicePrefix']['hasMany'](db[_0x037a('0x13b')],{'as':_0x037a('0x10b'),'onDelete':_0x037a('0x106')});db[_0x037a('0x12d')][_0x037a('0x119')](db['User'],{'as':'Agents','through':_0x037a('0x12e')});db[_0x037a('0xed')][_0x037a('0x108')](db['User'],{'as':_0x037a('0x166'),'foreignKey':_0x037a('0x118')});db[_0x037a('0xed')][_0x037a('0x108')](db['UserProfileSection'],{'as':_0x037a('0x1e5'),'foreignKey':_0x037a('0x118'),'onDelete':_0x037a('0x106')});db[_0x037a('0xef')][_0x037a('0x108')](db['UserProfileResource'],{'as':_0x037a('0x1e6'),'foreignKey':_0x037a('0x1e7'),'onDelete':_0x037a('0x106')});db[_0x037a('0xf4')]['hasMany'](db[_0x037a('0x15a')],{'as':'Dispositions','foreignKey':_0x037a('0x1e8'),'onDelete':_0x037a('0x106')});db[_0x037a('0xf4')][_0x037a('0x108')](db[_0x037a('0x15c')],{'as':_0x037a('0x178'),'foreignKey':_0x037a('0x1e8')});db[_0x037a('0xf4')]['hasMany'](db[_0x037a('0xf9')],{'as':_0x037a('0x14f'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db[_0x037a('0x113')],{'as':_0x037a('0x15d')});db['WhatsappAccount'][_0x037a('0x108')](db[_0x037a('0xf6')],{'as':_0x037a('0x13e')});db[_0x037a('0xf4')]['belongsTo'](db['CmList'],{'as':_0x037a('0x16e'),'foreignKey':'ListId'});db[_0x037a('0xf4')][_0x037a('0x117')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x037a('0x148')});db[_0x037a('0xf4')]['belongsToMany'](db[_0x037a('0x11')],{'as':_0x037a('0x14b'),'through':_0x037a('0x139')});db[_0x037a('0xf6')]['belongsTo'](db[_0x037a('0x11')],{'onDelete':_0x037a('0x16a')});db[_0x037a('0xf6')]['belongsTo'](db[_0x037a('0xff')],{'onDelete':'restrict'});db[_0x037a('0xf6')][_0x037a('0x117')](db[_0x037a('0xf4')],{'onDelete':_0x037a('0x16a')});db[_0x037a('0xf6')][_0x037a('0x117')](db[_0x037a('0x83')],{'onDelete':'restrict','foreignKey':_0x037a('0x16b')});db[_0x037a('0xf6')][_0x037a('0x117')](db[_0x037a('0x8e')],{'onDelete':_0x037a('0x16a'),'foreignKey':'TagId'});db[_0x037a('0x113')][_0x037a('0x108')](db[_0x037a('0xf9')],{'as':_0x037a('0x14f'),'onDelete':_0x037a('0x106'),'foreignKey':_0x037a('0x1e9')});db[_0x037a('0x113')][_0x037a('0x117')](db[_0x037a('0xf4')],{'as':_0x037a('0x162'),'foreignKey':'WhatsappAccountId'});db[_0x037a('0x113')]['belongsTo'](db[_0x037a('0x11b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x037a('0x113')]['belongsTo'](db[_0x037a('0x11')],{'as':'Owner','foreignKey':_0x037a('0x107')});db[_0x037a('0x113')][_0x037a('0x119')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x037a('0x113')][_0x037a('0x119')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x037a('0x165')});db[_0x037a('0x113')][_0x037a('0x119')](db[_0x037a('0x11')],{'as':_0x037a('0x166'),'through':_0x037a('0x123'),'foreignKey':_0x037a('0x1e9')});db[_0x037a('0xf9')][_0x037a('0x117')](db['User'],{'as':_0x037a('0x11')});db[_0x037a('0xf9')][_0x037a('0x117')](db[_0x037a('0x11b')],{'onDelete':_0x037a('0x106'),'as':_0x037a('0x154')});db[_0x037a('0xf9')][_0x037a('0x117')](db[_0x037a('0x113')],{'onDelete':_0x037a('0x106'),'as':_0x037a('0x175'),'foreignKey':'WhatsappInteractionId'});db[_0x037a('0xf9')][_0x037a('0x117')](db[_0x037a('0xf4')],{'as':_0x037a('0x162'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0x037a('0x117')](db[_0x037a('0xf4')],{});db[_0x037a('0xfb')][_0x037a('0x117')](db['CmList'],{'as':_0x037a('0x16e'),'foreignKey':'ListId'});db[_0x037a('0xfb')][_0x037a('0x117')](db['CmContact'],{'as':_0x037a('0x154'),'foreignKey':'ContactId'});db[_0x037a('0xfb')][_0x037a('0x117')](db[_0x037a('0x113')],{});db[_0x037a('0xfb')][_0x037a('0x117')](db[_0x037a('0xff')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x037a('0xf9')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x037a('0x11')],{});db[_0x037a('0xfd')][_0x037a('0x117')](db['WhatsappMessage'],{});db[_0x037a('0xfd')][_0x037a('0x117')](db[_0x037a('0x113')],{});db[_0x037a('0xfd')][_0x037a('0x117')](db['WhatsappAccount'],{'foreignKey':_0x037a('0x1ea'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x037a('0x117')](db[_0x037a('0xf4')],{'foreignKey':_0x037a('0x1eb'),'as':_0x037a('0x1d4')});db[_0x037a('0xfd')]['belongsTo'](db[_0x037a('0xff')],{'foreignKey':_0x037a('0x1ec'),'as':'ToQueue'});db[_0x037a('0xfd')][_0x037a('0x117')](db[_0x037a('0x11')],{'foreignKey':_0x037a('0x1d0'),'as':_0x037a('0x1d1')});db['WhatsappTransferReport'][_0x037a('0x117')](db[_0x037a('0x11')],{'foreignKey':_0x037a('0x1d7'),'as':_0x037a('0x1d8')});db[_0x037a('0xff')]['belongsToMany'](db[_0x037a('0x11')],{'as':_0x037a('0x14b'),'through':_0x037a('0x1ed'),'foreignKey':_0x037a('0x1ee')});db[_0x037a('0xff')][_0x037a('0x119')](db[_0x037a('0x11e')],{'through':_0x037a('0x1ef'),'as':_0x037a('0x161')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x8743=['HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','belongsToMany','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueues','UserMailQueue','ChatQueue','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','VoiceCallReport','uniqueid','VoiceAgentReport','AgentReports','CmContact','Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','MailMessage','Interactions','MailApplication','ListId','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','restrict','MailQueueReport','List','Items','FaxAccountId','Exntensions','mandatoryDispositionPause','TagId','FaxInteractionId','Owner','Tags','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','Agent','ChatApplication','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','ChatGroupId','Website','Contacts','CompanyId','Company','cm_contact_has_tags','Queue','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','MailApplications','ChatApplications','FaxApplications','CustomReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','AnalyticCustomReport','Fields','AnalyticDefaultReport','DefaultReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskAccount','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','ChatQueueReport','FromId','ToId','SessionId','ProjectId','team_has_chat_queues','team_has_whatsapp_queues','HopperHistories','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromUserId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','Resources','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','sequelize','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','CmHopperFinal'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8743,0xdd));var _0x3874=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8743[_0x1facfa];return _0x9ec701;};'use strict';var config=require(_0x3874('0x0'));var Sequelize=require(_0x3874('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x3874('0x2')]();config[_0x3874('0x1')]=_['defaultsDeep'](config[_0x3874('0x1')],{'database':_0x3874('0x3'),'username':_0x3874('0x4'),'password':_0x3874('0x5'),'options':{'host':_0x3874('0x6'),'port':0xcea,'dialect':_0x3874('0x7'),'dialectOptions':{'charset':_0x3874('0x8')},'logging':![],'timezone':timezone[_0x3874('0x9')](),'define':{'charset':_0x3874('0xa'),'collate':_0x3874('0xb')}}});config[_0x3874('0xc')]=_[_0x3874('0xd')](config['sequelizeHistory'],{'database':_0x3874('0x3'),'username':'xcall','password':_0x3874('0x5'),'options':{'host':_0x3874('0x6'),'port':0xcea,'dialect':_0x3874('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x3874('0xa'),'collate':_0x3874('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3874('0x1')][_0x3874('0xe')],config[_0x3874('0x1')][_0x3874('0xf')],config[_0x3874('0x1')][_0x3874('0x10')],config[_0x3874('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x3874('0xe')],config[_0x3874('0xc')][_0x3874('0xf')],config[_0x3874('0xc')][_0x3874('0x10')],config[_0x3874('0xc')][_0x3874('0x11')])};db[_0x3874('0x12')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x14'));db[_0x3874('0x15')]=db[_0x3874('0x1')]['import'](_0x3874('0x16'));db['VoiceContext']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x17'));db[_0x3874('0x18')]=db[_0x3874('0x1')]['import'](_0x3874('0x19'));db[_0x3874('0x1a')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0x3874('0x1b')]=db[_0x3874('0x1')]['import'](_0x3874('0x1c'));db[_0x3874('0x1d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x1e'));db[_0x3874('0x1f')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x20'));db[_0x3874('0x21')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x22'));db['VoiceCallReport']=db[_0x3874('0x1')]['import'](_0x3874('0x23'));db['VoiceDialReport']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x24'));db[_0x3874('0x25')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x26'));db[_0x3874('0x27')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x28'));db[_0x3874('0x29')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x2a'));db[_0x3874('0x2b')]=db['sequelize']['import'](_0x3874('0x2c'));db['UserVoiceQueueRt']=db['sequelize'][_0x3874('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x3874('0x2d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x2e'));db['UserChatQueue']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x2f'));db['UserMailQueue']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x30'));db['UserFaxQueue']=db['sequelize'][_0x3874('0x13')](_0x3874('0x31'));db[_0x3874('0x32')]=db['sequelize']['import'](_0x3874('0x33'));db['UserOpenchannelQueue']=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x3874('0x34')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x3874('0x35')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x36'));db['MailServerOut']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x37'));db[_0x3874('0x38')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x39'));db[_0x3874('0x3a')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x3b'));db[_0x3874('0x3c')]=db['sequelize'][_0x3874('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x3874('0x3d')]=db[_0x3874('0x1')]['import']('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db['sequelize'][_0x3874('0x13')](_0x3874('0x3e'));db['MailApplication']=db[_0x3874('0x1')]['import'](_0x3874('0x3f'));db['MailQueueReport']=db['sequelize'][_0x3874('0x13')](_0x3874('0x40'));db[_0x3874('0x41')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/dashboard/dashboard.model');db[_0x3874('0x42')]=db[_0x3874('0x1')]['import'](_0x3874('0x43'));db['FaxAccount']=db[_0x3874('0x1')]['import'](_0x3874('0x44'));db[_0x3874('0x45')]=db[_0x3874('0x1')]['import'](_0x3874('0x46'));db[_0x3874('0x47')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x48'));db[_0x3874('0x49')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x4a'));db[_0x3874('0x4b')]=db[_0x3874('0x1')]['import'](_0x3874('0x4c'));db[_0x3874('0x4d')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x4e'));db[_0x3874('0x4f')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/smsAccount/smsAccount.model');db[_0x3874('0x50')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x51'));db[_0x3874('0x52')]=db[_0x3874('0x1')]['import'](_0x3874('0x53'));db[_0x3874('0x54')]=db[_0x3874('0x1')]['import'](_0x3874('0x55'));db[_0x3874('0x56')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x57'));db['OpenchannelAccount']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x58'));db['OpenchannelApplication']=db['sequelize']['import'](_0x3874('0x59'));db[_0x3874('0x5a')]=db['sequelize']['import'](_0x3874('0x5b'));db['OpenchannelMessage']=db[_0x3874('0x1')]['import'](_0x3874('0x5c'));db['OpenchannelQueue']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x3874('0x5d')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x3874('0x5e')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x3874('0x1')]['import'](_0x3874('0x5f'));db[_0x3874('0x60')]=db['sequelize'][_0x3874('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x3874('0x61')]=db[_0x3874('0x1')]['import'](_0x3874('0x62'));db[_0x3874('0x63')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x64'));db['ChatQueue']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x65'));db[_0x3874('0x66')]=db[_0x3874('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0x3874('0x67')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x68'));db[_0x3874('0x69')]=db[_0x3874('0x1')]['import'](_0x3874('0x6a'));db['CmContact']=db['sequelize']['import']('../api/cmContact/cmContact.model');db[_0x3874('0x6b')]=db[_0x3874('0x1')]['import'](_0x3874('0x6c'));db[_0x3874('0x6d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x6e'));db['CmHopperFinal']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x6f'));db['CmHopperHistory']=db[_0x3874('0x1')]['import'](_0x3874('0x70'));db['ReportAgentPreview']=db['sequelize'][_0x3874('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x3874('0x71')]=db['sequelize'][_0x3874('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x3874('0x72')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x73'));db[_0x3874('0x74')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x75'));db[_0x3874('0x76')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0x3874('0x13')]('../api/disposition/disposition.model');db[_0x3874('0x77')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x78'));db[_0x3874('0x79')]=db['sequelize']['import'](_0x3874('0x7a'));db[_0x3874('0x7b')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x7c'));db['Cdr']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x7d'));db[_0x3874('0x7e')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x7f'));db[_0x3874('0x80')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x81'));db[_0x3874('0x82')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/sound/sound.model');db[_0x3874('0x83')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x84'));db[_0x3874('0x85')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x86'));db[_0x3874('0x87')]=db['sequelize']['import'](_0x3874('0x88'));db[_0x3874('0x89')]=db[_0x3874('0x1')]['import'](_0x3874('0x8a'));db[_0x3874('0x8b')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x8c'));db[_0x3874('0x8d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x8e'));db['AnalyticCustomReport']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x8f'));db['AnalyticDefaultReport']=db['sequelize'][_0x3874('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x90'));db[_0x3874('0x91')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x3874('0x92')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x93'));db[_0x3874('0x94')]=db['sequelize'][_0x3874('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x3874('0x95')]=db[_0x3874('0x1')]['import'](_0x3874('0x96'));db[_0x3874('0x97')]=db[_0x3874('0x1')]['import'](_0x3874('0x98'));db[_0x3874('0x99')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x9a'));db[_0x3874('0x9b')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x9c'));db[_0x3874('0x9d')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x9e'));db[_0x3874('0x9f')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xa0'));db['DeskAccount']=db['sequelize'][_0x3874('0x13')](_0x3874('0xa1'));db[_0x3874('0xa2')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xa3'));db[_0x3874('0xa4')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intDeskField/intDeskField.model');db[_0x3874('0xa5')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xa6'));db[_0x3874('0xa7')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xa8'));db[_0x3874('0xa9')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xaa'));db[_0x3874('0xab')]=db['sequelize']['import'](_0x3874('0xac'));db[_0x3874('0xad')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x3874('0xae')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db['sequelize'][_0x3874('0x13')](_0x3874('0xaf'));db[_0x3874('0xb0')]=db[_0x3874('0x1')]['import'](_0x3874('0xb1'));db[_0x3874('0xb2')]=db[_0x3874('0x1')]['import'](_0x3874('0xb3'));db['VtigerAccount']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xb4'));db[_0x3874('0xb5')]=db[_0x3874('0x1')]['import'](_0x3874('0xb6'));db[_0x3874('0xb7')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xb8'));db['ServicenowAccount']=db[_0x3874('0x1')]['import'](_0x3874('0xb9'));db[_0x3874('0xba')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xbb'));db[_0x3874('0xbc')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xbd'));db[_0x3874('0xbe')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x3874('0xbf')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xc0'));db[_0x3874('0xc1')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x3874('0xc2')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xc3'));db[_0x3874('0xc4')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xc5'));db[_0x3874('0xc6')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xc7'));db['Integration']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/integration/integration.model');db[_0x3874('0xc8')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/network/network.model');db['ChatQueueReport']=db[_0x3874('0x1')]['import'](_0x3874('0xc9'));db[_0x3874('0xca')]=db[_0x3874('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x3874('0xcb')]=db['sequelize'][_0x3874('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x3874('0xcc')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xcd'));db[_0x3874('0xce')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xcf'));db[_0x3874('0xd0')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db['sequelize'][_0x3874('0x13')](_0x3874('0xd1'));db[_0x3874('0xd2')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xd3'));db[_0x3874('0xd4')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xd5'));db[_0x3874('0xd6')]=db['sequelize'][_0x3874('0x13')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x3874('0xd7')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xd8'));db[_0x3874('0xd9')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xda'));db['SquareMessage']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xdb'));db[_0x3874('0xdc')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xdd'));db[_0x3874('0xde')]=db[_0x3874('0x1')]['import'](_0x3874('0xdf'));db['Campaign']=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xe0'));db[_0x3874('0xe1')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/migration/migration.model');db[_0x3874('0xe2')]=db['sequelize']['import']('../api/attachment/attachment.model');db[_0x3874('0xe3')]=db[_0x3874('0x1')]['import'](_0x3874('0xe4'));db[_0x3874('0xe5')]=db[_0x3874('0x1')]['import'](_0x3874('0xe6'));db[_0x3874('0xe7')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x3874('0xe8')]=db[_0x3874('0x1')]['import'](_0x3874('0xe9'));db[_0x3874('0xea')]=db['sequelize']['import'](_0x3874('0xeb'));db[_0x3874('0xec')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xed'));db[_0x3874('0xee')]=db[_0x3874('0x1')][_0x3874('0x13')]('../api/cmList/cmList.model');db[_0x3874('0xef')]=db['sequelize'][_0x3874('0x13')](_0x3874('0xf0'));db[_0x3874('0xf1')]=db['sequelize']['import'](_0x3874('0xf2'));db[_0x3874('0xf3')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xf4'));db[_0x3874('0xf5')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xf6'));db[_0x3874('0xf7')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xf8'));db['WhatsappAccount']=db['sequelize'][_0x3874('0x13')](_0x3874('0xf9'));db[_0x3874('0xfa')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0xfb'));db[_0x3874('0xfc')]=db[_0x3874('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x3874('0xfd')]=db['sequelize']['import'](_0x3874('0xfe'));db[_0x3874('0xff')]=db[_0x3874('0x1')]['import'](_0x3874('0x100'));db[_0x3874('0x101')]=db['sequelize'][_0x3874('0x13')](_0x3874('0x102'));db[_0x3874('0x103')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x104'));db[_0x3874('0x105')]=db[_0x3874('0x1')][_0x3874('0x13')](_0x3874('0x106'));db['TeamVoiceQueue']=db[_0x3874('0x1')][_0x3874('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['User'][_0x3874('0x107')](db[_0x3874('0x1f')],{'as':_0x3874('0x1f'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x12')]['hasMany'](db['VoiceRecording'],{'as':_0x3874('0x10a'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db['UserVoiceQueueRt'],{'as':_0x3874('0x10c'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db[_0x3874('0x18')],{'as':_0x3874('0x10d'),'onDelete':_0x3874('0x108'),'hooks':!![]});db['User'][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db[_0x3874('0x110')],{'as':_0x3874('0x111'),'foreignKey':'UserId'});db[_0x3874('0x12')]['hasMany'](db[_0x3874('0x112')],{'as':_0x3874('0x112'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db[_0x3874('0x5a')],{'as':_0x3874('0x113'),'foreignKey':_0x3874('0x109')});db['User'][_0x3874('0x10b')](db[_0x3874('0x60')],{'as':_0x3874('0x114'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x12')][_0x3874('0x10b')](db['SmsInteraction'],{'as':_0x3874('0x115'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x12')]['hasMany'](db[_0x3874('0x47')],{'as':_0x3874('0x116'),'foreignKey':_0x3874('0x109')});db['User'][_0x3874('0x10b')](db[_0x3874('0x3d')],{'as':_0x3874('0x117'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x12')]['hasMany'](db[_0x3874('0xfc')],{'as':_0x3874('0x118'),'foreignKey':'UserId'});db[_0x3874('0x12')][_0x3874('0x10b')](db[_0x3874('0xf7')],{'as':'UserNotifications','foreignKey':_0x3874('0x119')});db[_0x3874('0x12')][_0x3874('0x11a')](db[_0x3874('0xf1')],{'as':_0x3874('0xf1'),'foreignKey':'userProfileId'});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x66')],{'as':'Groups','through':'chat_group_has_users'});db[_0x3874('0x12')][_0x3874('0x11b')](db['CmContact'],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0xee')],{'as':_0x3874('0x11c'),'through':_0x3874('0x11d')});db[_0x3874('0x12')]['belongsToMany'](db['Team'],{'through':_0x3874('0x11e')});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x3d')],{'as':_0x3874('0x117'),'through':_0x3874('0x11f')});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0x60')],{'as':'ChatInteractions','through':_0x3874('0x120')});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0x47')],{'as':'FaxInteractions','through':_0x3874('0x121')});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x52')],{'as':_0x3874('0x115'),'through':_0x3874('0x122')});db['User']['belongsToMany'](db[_0x3874('0x5a')],{'as':_0x3874('0x113'),'through':_0x3874('0x123')});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0xfc')],{'as':'WhatsappInteractions','through':_0x3874('0x124')});db['User'][_0x3874('0x11b')](db[_0x3874('0x125')],{'as':_0x3874('0x126'),'through':_0x3874('0x2d'),'required':![]});db[_0x3874('0x12')]['belongsToMany'](db['MailQueue'],{'as':_0x3874('0x127'),'through':_0x3874('0x128'),'required':![]});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0x129')],{'as':_0x3874('0x12a'),'through':_0x3874('0x12b'),'required':![],'hooks':!![]});db[_0x3874('0x12')]['belongsToMany'](db['FaxQueue'],{'as':_0x3874('0x12c'),'through':'UserFaxQueue','required':![]});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x56')],{'as':_0x3874('0x12d'),'through':_0x3874('0x32'),'required':![]});db['User'][_0x3874('0x11b')](db[_0x3874('0x12e')],{'as':_0x3874('0x12f'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x3874('0x11b')](db['WhatsappQueue'],{'as':_0x3874('0x130'),'through':_0x3874('0x34'),'required':![]});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0xee')],{'through':_0x3874('0x11d')});db['User']['belongsToMany'](db['VoicePrefix'],{'as':_0x3874('0x131'),'through':_0x3874('0x132'),'required':![]});db[_0x3874('0x12')][_0x3874('0x11b')](db[_0x3874('0x5d')],{'as':_0x3874('0x133'),'through':_0x3874('0x134')});db['User'][_0x3874('0x11b')](db[_0x3874('0x135')],{'as':_0x3874('0x136'),'through':_0x3874('0x137')});db[_0x3874('0x12')]['belongsToMany'](db[_0x3874('0x38')],{'as':'MailAccounts','through':_0x3874('0x138')});db['User'][_0x3874('0x11b')](db[_0x3874('0x139')],{'as':_0x3874('0x13a'),'through':_0x3874('0x13b')});db['User'][_0x3874('0x11b')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x3874('0x13c')});db[_0x3874('0x12')][_0x3874('0x11b')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x3874('0x13d')});db[_0x3874('0x12')][_0x3874('0x11b')](db['SquareProject'],{'as':_0x3874('0x13e'),'through':_0x3874('0x13f')});db[_0x3874('0x15')]['hasMany'](db[_0x3874('0x18')],{'as':_0x3874('0x140'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x141')});db[_0x3874('0x142')][_0x3874('0x10b')](db[_0x3874('0x18')],{'onDelete':_0x3874('0x108')});db['VoiceExtension']['hasMany'](db['VoiceExtension'],{'as':_0x3874('0x143'),'onDelete':'cascade'});db[_0x3874('0x1a')][_0x3874('0x11b')](db[_0x3874('0x82')],{'as':_0x3874('0x144'),'through':_0x3874('0x145')});db[_0x3874('0x125')]['hasMany'](db[_0x3874('0x146')],{'as':_0x3874('0x147'),'foreignKey':_0x3874('0x148')});db[_0x3874('0x125')][_0x3874('0x10b')](db[_0x3874('0x6b')],{'as':_0x3874('0x149'),'foreignKey':_0x3874('0x148')});db['VoiceQueue'][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':'VoiceQueueId'});db[_0x3874('0x125')][_0x3874('0x10b')](db[_0x3874('0x110')],{'as':'HopperHistories','foreignKey':_0x3874('0x148')});db[_0x3874('0x125')][_0x3874('0x10b')](db['ReportAgentPreview'],{'as':_0x3874('0x112'),'foreignKey':_0x3874('0x148')});db[_0x3874('0x125')]['hasMany'](db[_0x3874('0x6d')],{'as':_0x3874('0x14a'),'foreignKey':_0x3874('0x148')});db['VoiceQueue'][_0x3874('0x10b')](db[_0x3874('0xce')],{'as':_0x3874('0x14b'),'foreignKey':_0x3874('0x148')});db[_0x3874('0x125')]['belongsTo'](db[_0x3874('0x29')],{'as':_0x3874('0x29'),'foreignKey':_0x3874('0x14c')});db[_0x3874('0x125')]['belongsTo'](db[_0x3874('0x29')],{'as':_0x3874('0x14d'),'foreignKey':_0x3874('0x14e')});db[_0x3874('0x125')][_0x3874('0x11a')](db[_0x3874('0x79')],{'as':_0x3874('0x79'),'foreignKey':_0x3874('0x14f')});db[_0x3874('0x125')][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x3874('0x150')});db[_0x3874('0x125')][_0x3874('0x11b')](db[_0x3874('0xee')],{'as':_0x3874('0x11c'),'through':_0x3874('0x151')});db[_0x3874('0x125')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x2d')});db[_0x3874('0x125')][_0x3874('0x11b')](db['Team'],{'as':_0x3874('0x153'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0x3874('0x11b')](db[_0x3874('0xee')],{'as':'BlackLists','through':_0x3874('0x154')});db[_0x3874('0x1b')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x12'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x1d')]['belongsTo'](db[_0x3874('0x12')],{'as':_0x3874('0x12'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x1f')][_0x3874('0x10b')](db[_0x3874('0x21')],{'as':_0x3874('0x155'),'onDelete':_0x3874('0x108'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x3874('0x21')][_0x3874('0x11a')](db[_0x3874('0x1f')],{'foreignKey':_0x3874('0x156'),'targetKey':'mailbox'});db[_0x3874('0x157')][_0x3874('0x10b')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x3874('0x158'),'constraints':![]});db[_0x3874('0x157')][_0x3874('0x10b')](db[_0x3874('0x159')],{'as':_0x3874('0x15a'),'foreignKey':'uniqueid','constraints':![]});db[_0x3874('0x157')]['belongsTo'](db[_0x3874('0x12')],{'as':'User','foreignKey':_0x3874('0x109')});db['VoiceCallReport'][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db[_0x3874('0x35')][_0x3874('0x11a')](db[_0x3874('0x38')],{'as':_0x3874('0x38'),'foreignKey':_0x3874('0x15e')});db['MailServerOut'][_0x3874('0x11a')](db[_0x3874('0x38')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x3874('0x38')][_0x3874('0x107')](db[_0x3874('0x35')],{'as':_0x3874('0x15f'),'onDelete':_0x3874('0x108')});db[_0x3874('0x38')]['hasOne'](db['MailServerOut'],{'as':_0x3874('0x160'),'onDelete':'cascade'});db[_0x3874('0x38')][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':_0x3874('0x162'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x3874('0x38')][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x15e')});db['MailAccount'][_0x3874('0x10b')](db[_0x3874('0x164')],{'as':'Messages','foreignKey':_0x3874('0x15e')});db[_0x3874('0x38')][_0x3874('0x10b')](db['MailInteraction'],{'as':_0x3874('0x165')});db[_0x3874('0x38')][_0x3874('0x10b')](db[_0x3874('0x166')],{'as':'Applications'});db[_0x3874('0x38')][_0x3874('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x3874('0x167')});db[_0x3874('0x38')][_0x3874('0x11a')](db['Template'],{'as':'Template','foreignKey':'TemplateId'});db[_0x3874('0x38')][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x3874('0x150')});db['MailAccount'][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x152'),'through':_0x3874('0x138')});db[_0x3874('0x3a')][_0x3874('0x11b')](db['User'],{'as':'Agents','through':'UserMailQueue'});db[_0x3874('0x3a')][_0x3874('0x11b')](db[_0x3874('0xdc')],{'through':_0x3874('0x168'),'as':_0x3874('0x153')});db['MailInteraction'][_0x3874('0x10b')](db[_0x3874('0x164')],{'as':_0x3874('0x155'),'onDelete':'cascade','foreignKey':_0x3874('0x169')});db['MailInteraction'][_0x3874('0x11a')](db[_0x3874('0x38')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x15e')});db['MailInteraction'][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db['MailInteraction'][_0x3874('0x11a')](db['User'],{'as':'Owner','foreignKey':_0x3874('0x109')});db['MailInteraction'][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x3874('0x3d')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x16b'),'as':_0x3874('0x16c')});db[_0x3874('0x3d')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x16d'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x3874('0x164')][_0x3874('0x10b')](db[_0x3874('0xe2')],{'as':_0x3874('0x16e'),'onDelete':_0x3874('0x108')});db[_0x3874('0x164')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':'User'});db[_0x3874('0x164')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x15c')});db[_0x3874('0x164')][_0x3874('0x11a')](db[_0x3874('0x3d')],{'as':_0x3874('0x16f'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x3874('0x11a')](db['MailAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x15e')});db[_0x3874('0x164')]['belongsTo'](db[_0x3874('0x5d')],{'as':_0x3874('0x5d'),'foreignKey':_0x3874('0x170')});db[_0x3874('0x164')][_0x3874('0x11a')](db[_0x3874('0x63')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x3874('0x166')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x171')});db[_0x3874('0x166')][_0x3874('0x11a')](db['MailQueue'],{'onDelete':_0x3874('0x171')});db[_0x3874('0x166')][_0x3874('0x11a')](db[_0x3874('0x38')],{'onDelete':_0x3874('0x171')});db[_0x3874('0x166')][_0x3874('0x11a')](db[_0x3874('0x79')],{'onDelete':'restrict','foreignKey':_0x3874('0x14f')});db[_0x3874('0x166')][_0x3874('0x11a')](db[_0x3874('0x83')],{'onDelete':_0x3874('0x171'),'foreignKey':'TagId'});db[_0x3874('0x172')][_0x3874('0x11a')](db[_0x3874('0x38')],{});db[_0x3874('0x172')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['MailQueueReport'][_0x3874('0x11a')](db['CmContact'],{'as':_0x3874('0x15c'),'foreignKey':'ContactId'});db[_0x3874('0x172')][_0x3874('0x11a')](db[_0x3874('0x3d')],{});db[_0x3874('0x172')]['belongsTo'](db[_0x3874('0x164')],{});db['MailQueueReport']['belongsTo'](db[_0x3874('0x12')],{});db[_0x3874('0x172')][_0x3874('0x11a')](db[_0x3874('0x3a')],{});db['Dashboard'][_0x3874('0x10b')](db[_0x3874('0x42')],{'as':_0x3874('0x174'),'onDelete':_0x3874('0x108')});db[_0x3874('0x135')][_0x3874('0x10b')](db['Disposition'],{'as':_0x3874('0x162'),'foreignKey':_0x3874('0x175'),'onDelete':_0x3874('0x108')});db['FaxAccount'][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x175')});db[_0x3874('0x135')]['hasMany'](db[_0x3874('0x47')],{'as':_0x3874('0x165')});db[_0x3874('0x135')][_0x3874('0x10b')](db[_0x3874('0x45')],{'as':_0x3874('0x143')});db[_0x3874('0x135')][_0x3874('0x10b')](db['VoiceExtension'],{'as':_0x3874('0x176'),'onDelete':_0x3874('0x108')});db[_0x3874('0x135')][_0x3874('0x10b')](db['FaxMessage'],{'as':_0x3874('0x155')});db['FaxAccount']['belongsTo'](db['Trunk'],{'as':_0x3874('0x29')});db['FaxAccount'][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['FaxAccount'][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':_0x3874('0x177'),'foreignKey':_0x3874('0x150')});db[_0x3874('0x135')]['belongsToMany'](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x137')});db['FaxApplication'][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x171')});db[_0x3874('0x45')][_0x3874('0x11a')](db[_0x3874('0x4b')],{'onDelete':_0x3874('0x171')});db['FaxApplication']['belongsTo'](db[_0x3874('0x135')],{'onDelete':'restrict'});db[_0x3874('0x45')][_0x3874('0x11a')](db[_0x3874('0x83')],{'onDelete':'restrict','foreignKey':_0x3874('0x178')});db[_0x3874('0x47')]['hasMany'](db[_0x3874('0x49')],{'as':'Messages','onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x179')});db[_0x3874('0x47')]['belongsTo'](db[_0x3874('0x135')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x175')});db[_0x3874('0x47')]['belongsTo'](db['CmContact'],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db['FaxInteraction'][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x47')]['belongsToMany'](db[_0x3874('0x83')],{'through':'fax_interaction_has_tags','as':_0x3874('0x17b')});db[_0x3874('0x47')]['belongsToMany'](db[_0x3874('0x83')],{'through':_0x3874('0x17c'),'as':_0x3874('0x16c')});db[_0x3874('0x47')][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x16d'),'through':_0x3874('0x121'),'foreignKey':_0x3874('0x179')});db[_0x3874('0x49')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x12')});db[_0x3874('0x49')][_0x3874('0x11a')](db[_0x3874('0x47')],{'as':_0x3874('0x16f'),'foreignKey':_0x3874('0x179')});db['FaxMessage'][_0x3874('0x11a')](db['CmContact'],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x15c')});db[_0x3874('0x49')][_0x3874('0x11a')](db['Attachment'],{'as':'Attachment','foreignKey':_0x3874('0x17d')});db[_0x3874('0x49')]['belongsTo'](db['FaxAccount'],{'as':_0x3874('0x16a'),'foreignKey':'FaxAccountId'});db[_0x3874('0x4b')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':'UserFaxQueue'});db[_0x3874('0x4b')][_0x3874('0x11b')](db[_0x3874('0xdc')],{'through':_0x3874('0x17e'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x3874('0x135')],{});db[_0x3874('0x4d')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':'ListId'});db['FaxQueueReport']['belongsTo'](db[_0x3874('0x15b')],{'as':_0x3874('0x15c'),'foreignKey':'ContactId'});db[_0x3874('0x4d')][_0x3874('0x11a')](db['FaxInteraction'],{});db[_0x3874('0x4d')]['belongsTo'](db[_0x3874('0x49')],{});db[_0x3874('0x4d')][_0x3874('0x11a')](db['User'],{});db[_0x3874('0x4d')][_0x3874('0x11a')](db[_0x3874('0x4b')],{});db[_0x3874('0x4f')][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':_0x3874('0x162'),'foreignKey':'SmsAccountId','onDelete':_0x3874('0x108')});db['SmsAccount'][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x17f')});db[_0x3874('0x4f')][_0x3874('0x10b')](db[_0x3874('0x54')],{'as':_0x3874('0x155'),'foreignKey':_0x3874('0x17f')});db[_0x3874('0x4f')][_0x3874('0x10b')](db[_0x3874('0x52')],{'as':'Interactions'});db[_0x3874('0x4f')][_0x3874('0x10b')](db['SmsApplication'],{'as':_0x3874('0x143')});db[_0x3874('0x4f')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['SmsAccount'][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x3874('0x150')});db[_0x3874('0x4f')]['belongsToMany'](db[_0x3874('0x12')],{'as':'Agents','through':_0x3874('0x13c')});db[_0x3874('0x50')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':'restrict'});db[_0x3874('0x50')][_0x3874('0x11a')](db[_0x3874('0x56')],{'onDelete':'restrict'});db[_0x3874('0x50')]['belongsTo'](db['SmsAccount'],{'onDelete':'restrict'});db[_0x3874('0x50')][_0x3874('0x11a')](db[_0x3874('0x79')],{'onDelete':_0x3874('0x171'),'foreignKey':'IntervalId'});db[_0x3874('0x50')]['belongsTo'](db[_0x3874('0x83')],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x178')});db[_0x3874('0x52')][_0x3874('0x10b')](db[_0x3874('0x54')],{'as':_0x3874('0x155'),'onDelete':_0x3874('0x108'),'foreignKey':'SmsInteractionId'});db[_0x3874('0x52')][_0x3874('0x11a')](db[_0x3874('0x4f')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x17f')});db[_0x3874('0x52')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':'ContactId'});db['SmsInteraction'][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x52')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':'sms_interaction_has_tags','as':_0x3874('0x17b')});db[_0x3874('0x52')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x180'),'as':_0x3874('0x16c')});db[_0x3874('0x52')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x16d'),'through':_0x3874('0x122'),'foreignKey':'SmsInteractionId'});db[_0x3874('0x54')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x12')});db[_0x3874('0x54')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':'cascade','as':_0x3874('0x15c')});db[_0x3874('0x54')]['belongsTo'](db[_0x3874('0x52')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x16f'),'foreignKey':_0x3874('0x181')});db['SmsMessage']['belongsTo'](db[_0x3874('0x4f')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x17f')});db[_0x3874('0x56')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x32'),'foreignKey':'SmsQueueId'});db[_0x3874('0x56')][_0x3874('0x11b')](db[_0x3874('0xdc')],{'through':_0x3874('0x182'),'as':_0x3874('0x153')});db['OpenchannelAccount'][_0x3874('0x10b')](db['Disposition'],{'as':_0x3874('0x162'),'foreignKey':'OpenchannelAccountId','onDelete':_0x3874('0x108')});db[_0x3874('0x139')][_0x3874('0x10b')](db['CannedAnswer'],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x183')});db['OpenchannelAccount'][_0x3874('0x10b')](db[_0x3874('0x5a')],{'as':_0x3874('0x165'),'foreignKey':_0x3874('0x183')});db['OpenchannelAccount'][_0x3874('0x10b')](db[_0x3874('0x184')],{'as':_0x3874('0x155'),'foreignKey':_0x3874('0x183')});db[_0x3874('0x139')][_0x3874('0x10b')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x3874('0x183')});db[_0x3874('0x139')]['belongsTo'](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['OpenchannelAccount'][_0x3874('0x11a')](db['Pause'],{'as':_0x3874('0x177'),'foreignKey':_0x3874('0x150')});db[_0x3874('0x139')]['belongsToMany'](db[_0x3874('0x12')],{'as':'Agents','through':_0x3874('0x13b')});db[_0x3874('0x185')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x171')});db[_0x3874('0x185')][_0x3874('0x11a')](db[_0x3874('0x12e')],{'onDelete':_0x3874('0x171'),'foreignKey':'OpenchannelQueueId'});db[_0x3874('0x185')][_0x3874('0x11a')](db['OpenchannelAccount'],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x183')});db[_0x3874('0x185')][_0x3874('0x11a')](db[_0x3874('0x79')],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x14f')});db['OpenchannelApplication'][_0x3874('0x11a')](db[_0x3874('0x83')],{'onDelete':'restrict','foreignKey':_0x3874('0x178')});db[_0x3874('0x5a')][_0x3874('0x10b')](db['OpenchannelMessage'],{'as':_0x3874('0x155'),'onDelete':'cascade','foreignKey':_0x3874('0x186')});db['OpenchannelInteraction'][_0x3874('0x11a')](db[_0x3874('0x139')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x183')});db[_0x3874('0x5a')][_0x3874('0x11a')](db['CmContact'],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db['OpenchannelInteraction'][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db[_0x3874('0x5a')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x187'),'as':_0x3874('0x17b')});db[_0x3874('0x5a')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x187'),'as':'ThroughTags'});db[_0x3874('0x5a')]['belongsToMany'](db['User'],{'as':_0x3874('0x16d'),'through':_0x3874('0x123'),'foreignKey':_0x3874('0x186')});db[_0x3874('0x184')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':'cascade','as':_0x3874('0x12')});db[_0x3874('0x184')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x15c')});db['OpenchannelMessage']['belongsTo'](db[_0x3874('0x5a')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x16f'),'foreignKey':'OpenchannelInteractionId'});db[_0x3874('0x184')]['belongsTo'](db[_0x3874('0xe2')],{'as':_0x3874('0xe2'),'foreignKey':_0x3874('0x17d')});db[_0x3874('0x184')]['belongsTo'](db[_0x3874('0x139')],{'as':_0x3874('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0x3874('0x12e')][_0x3874('0x11b')](db['User'],{'as':'Agents','through':_0x3874('0x188'),'foreignKey':_0x3874('0x189')});db[_0x3874('0x12e')]['belongsToMany'](db['Team'],{'through':_0x3874('0x18a'),'as':_0x3874('0x153')});db['ChatWebsite'][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0x3874('0x108')});db['ChatWebsite'][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x3874('0x10b')](db[_0x3874('0x67')],{'as':_0x3874('0x18b')});db['ChatWebsite']['hasMany'](db['ChatInteraction'],{'as':_0x3874('0x165')});db[_0x3874('0x5d')][_0x3874('0x10b')](db['ChatApplication'],{'as':_0x3874('0x143')});db[_0x3874('0x5d')][_0x3874('0x10b')](db[_0x3874('0x61')],{'as':_0x3874('0x155')});db[_0x3874('0x5d')]['belongsTo'](db['CmList'],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db[_0x3874('0x5d')][_0x3874('0x11a')](db['Interval'],{'as':_0x3874('0x79'),'foreignKey':_0x3874('0x14f')});db[_0x3874('0x5d')]['belongsTo'](db['MailAccount'],{'as':_0x3874('0x38'),'foreignKey':_0x3874('0x15e')});db[_0x3874('0x5d')][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':_0x3874('0x177'),'foreignKey':_0x3874('0x150')});db[_0x3874('0x5d')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x134')});db['OpenchannelQueueReport'][_0x3874('0x11a')](db[_0x3874('0x139')],{});db['OpenchannelQueueReport'][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':'ListId'});db[_0x3874('0x5e')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':_0x3874('0x15d')});db['OpenchannelQueueReport'][_0x3874('0x11a')](db[_0x3874('0x5a')],{});db['OpenchannelQueueReport'][_0x3874('0x11a')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{});db[_0x3874('0x5e')][_0x3874('0x11a')](db[_0x3874('0x12e')],{});db['ChatApplication'][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x18c'),'foreignKey':_0x3874('0x109'),'onDelete':_0x3874('0x171')});db[_0x3874('0x18d')]['belongsTo'](db[_0x3874('0x129')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x3874('0x171')});db['ChatApplication'][_0x3874('0x11a')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x3874('0x170'),'onDelete':_0x3874('0x171')});db['ChatApplication'][_0x3874('0x11a')](db[_0x3874('0x83')],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x178')});db[_0x3874('0x60')][_0x3874('0x10b')](db[_0x3874('0x61')],{'as':_0x3874('0x155'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x18e')});db[_0x3874('0x60')][_0x3874('0x11a')](db[_0x3874('0x5d')],{'as':'Account','foreignKey':_0x3874('0x170')});db[_0x3874('0x60')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':_0x3874('0x15d')});db[_0x3874('0x60')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db['ChatInteraction'][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x18f'),'as':_0x3874('0x17b')});db[_0x3874('0x60')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x18f'),'as':_0x3874('0x16c')});db[_0x3874('0x60')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x16d'),'through':_0x3874('0x120'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x12')});db[_0x3874('0x61')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':'cascade','as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db[_0x3874('0x61')][_0x3874('0x11a')](db[_0x3874('0x60')],{'onDelete':_0x3874('0x108'),'as':'Interaction','foreignKey':_0x3874('0x18e')});db[_0x3874('0x61')][_0x3874('0x11a')](db[_0x3874('0xe2')],{'as':_0x3874('0xe2'),'foreignKey':_0x3874('0x17d')});db[_0x3874('0x61')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x3874('0x170')});db[_0x3874('0x63')][_0x3874('0x10b')](db['Attachment'],{'as':_0x3874('0x16e'),'foreignKey':_0x3874('0x190'),'onDelete':'cascade','hooks':!![]});db[_0x3874('0x63')][_0x3874('0x11a')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0x3874('0x15d')});db[_0x3874('0x63')]['belongsTo'](db[_0x3874('0x5d')],{'as':_0x3874('0x16a'),'foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x12b'),'hooks':!![]});db[_0x3874('0x129')]['belongsToMany'](db[_0x3874('0xdc')],{'through':'team_has_chat_queues','as':_0x3874('0x153')});db[_0x3874('0x66')][_0x3874('0x10b')](db['ChatInternalMessage'],{'as':_0x3874('0x155'),'foreignKey':_0x3874('0x191'),'onDelete':_0x3874('0x108')});db[_0x3874('0x66')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x147'),'through':'chat_group_has_users'});db[_0x3874('0x67')][_0x3874('0x11a')](db[_0x3874('0x5d')],{'as':_0x3874('0x192'),'foreignKey':'ChatWebsiteId'});db[_0x3874('0x69')][_0x3874('0x10b')](db[_0x3874('0x15b')],{'as':_0x3874('0x193'),'foreignKey':_0x3874('0x194')});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x6b')],{'as':_0x3874('0x149'),'foreignKey':'ContactId'});db['CmContact'][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':_0x3874('0x15d')});db['CmContact']['hasMany'](db[_0x3874('0x110')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x112')],{'as':_0x3874('0x112'),'foreignKey':_0x3874('0x15d')});db['CmContact'][_0x3874('0x10b')](db['JscriptySessionReport'],{'as':_0x3874('0x14b'),'foreignKey':_0x3874('0x15d')});db['CmContact'][_0x3874('0x10b')](db[_0x3874('0x5a')],{'as':_0x3874('0x113'),'foreignKey':_0x3874('0x15d'),'onDelete':_0x3874('0x171')});db['CmContact'][_0x3874('0x10b')](db[_0x3874('0x60')],{'as':'ChatInteractions','foreignKey':_0x3874('0x15d'),'onDelete':_0x3874('0x171')});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x52')],{'as':_0x3874('0x115'),'foreignKey':_0x3874('0x15d'),'onDelete':'restrict'});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x47')],{'as':'FaxInteractions','foreignKey':_0x3874('0x15d'),'onDelete':_0x3874('0x171')});db[_0x3874('0x15b')][_0x3874('0x10b')](db[_0x3874('0x3d')],{'as':'MailInteractions','foreignKey':_0x3874('0x15d'),'onDelete':_0x3874('0x171')});db[_0x3874('0x15b')][_0x3874('0x11a')](db['CmCompany'],{'as':_0x3874('0x195'),'foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db[_0x3874('0xee')],{'as':'List','foreignKey':'ListId','onDelete':_0x3874('0x108')});db[_0x3874('0x15b')]['belongsToMany'](db['User'],{'as':_0x3874('0x16d'),'through':'cm_user_has_contacts'});db[_0x3874('0x15b')][_0x3874('0x11b')](db[_0x3874('0x83')],{'as':'Tags','through':_0x3874('0x196')});db[_0x3874('0x15b')][_0x3874('0x11b')](db['Tag'],{'through':_0x3874('0x196'),'as':'ThroughTags'});db[_0x3874('0x6b')]['belongsTo'](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x3874('0x108')});db[_0x3874('0x6b')]['belongsTo'](db['CmList'],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167'),'onDelete':_0x3874('0x108')});db[_0x3874('0x6b')][_0x3874('0x11a')](db[_0x3874('0x12')],{'as':'Agent','foreignKey':'UserId'});db[_0x3874('0x6b')][_0x3874('0x11a')](db[_0x3874('0x125')],{'as':_0x3874('0x197'),'foreignKey':_0x3874('0x148'),'onDelete':_0x3874('0x108')});db[_0x3874('0x6b')][_0x3874('0x11a')](db['Campaign'],{'as':_0x3874('0x198'),'foreignKey':_0x3874('0x199'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x3874('0x19a')});db[_0x3874('0x6d')][_0x3874('0x11a')](db['CmContact'],{'as':_0x3874('0x15c'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack'][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167'),'onDelete':_0x3874('0x108')});db[_0x3874('0x6d')]['belongsTo'](db[_0x3874('0x125')],{'as':_0x3874('0x197'),'foreignKey':_0x3874('0x148'),'onDelete':_0x3874('0x108')});db['CmHopperBlack']['belongsTo'](db[_0x3874('0x198')],{'as':_0x3874('0x198'),'foreignKey':'CampaignId','onDelete':_0x3874('0x108')});db[_0x3874('0x74')][_0x3874('0x10b')](db['Condition'],{'as':{'plural':'All','singular':_0x3874('0x19b')},'foreignKey':_0x3874('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0x3874('0x74')][_0x3874('0x10b')](db['Condition'],{'as':{'plural':'Any','singular':_0x3874('0x19d')},'foreignKey':_0x3874('0x19e'),'onDelete':_0x3874('0x108'),'hooks':!![]});db[_0x3874('0x74')][_0x3874('0x10b')](db[_0x3874('0x72')],{'as':_0x3874('0x19f'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x3874('0x161')][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':'cascade'});db['Interval'][_0x3874('0x10b')](db[_0x3874('0x79')],{'as':'Intervals','foreignKey':_0x3874('0x14f'),'onDelete':_0x3874('0x108'),'hooks':!![],'required':![]});db['Interval'][_0x3874('0x10b')](db[_0x3874('0x18')],{'as':_0x3874('0x10d'),'foreignKey':_0x3874('0x14f'),'onDelete':_0x3874('0x171')});db[_0x3874('0x79')][_0x3874('0x10b')](db['MailApplication'],{'as':_0x3874('0x1a0'),'foreignKey':'IntervalId'});db[_0x3874('0x79')][_0x3874('0x10b')](db[_0x3874('0x18d')],{'as':_0x3874('0x1a1'),'foreignKey':_0x3874('0x14f')});db[_0x3874('0x79')][_0x3874('0x10b')](db['FaxApplication'],{'as':_0x3874('0x1a2'),'foreignKey':_0x3874('0x14f')});db[_0x3874('0x79')][_0x3874('0x10b')](db[_0x3874('0x50')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule'][_0x3874('0x11a')](db[_0x3874('0x38')],{});db['Schedule'][_0x3874('0x11a')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x3874('0x80')][_0x3874('0x11a')](db['AnalyticCustomReport'],{'foreignKey':_0x3874('0x1a3')});db[_0x3874('0x82')][_0x3874('0x11b')](db[_0x3874('0x1a')],{'as':_0x3874('0x1a4'),'through':_0x3874('0x145'),'onDelete':_0x3874('0x171')});db[_0x3874('0x83')][_0x3874('0x11b')](db[_0x3874('0x15b')],{'through':'cm_contact_has_tags'});db[_0x3874('0x83')][_0x3874('0x11b')](db[_0x3874('0x60')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x3874('0x11b')](db[_0x3874('0x3d')],{'through':'mail_interaction_has_tags'});db[_0x3874('0x83')][_0x3874('0x11b')](db[_0x3874('0x52')],{'through':_0x3874('0x180')});db[_0x3874('0x83')]['belongsToMany'](db[_0x3874('0x47')],{'through':_0x3874('0x17c')});db[_0x3874('0x83')][_0x3874('0x11b')](db[_0x3874('0x5a')],{'through':'openchannel_interaction_has_tags'});db[_0x3874('0x83')]['belongsToMany'](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x3874('0x87')][_0x3874('0x10b')](db[_0x3874('0x77')],{'as':{'plural':_0x3874('0x1a5'),'singular':_0x3874('0x1a6')},'foreignKey':_0x3874('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x3874('0x87')][_0x3874('0x10b')](db[_0x3874('0x77')],{'as':{'plural':_0x3874('0x1a8'),'singular':_0x3874('0x1a9')},'foreignKey':'TriggerAnyId','onDelete':_0x3874('0x108'),'hooks':!![]});db['Trigger'][_0x3874('0x10b')](db[_0x3874('0x72')],{'as':_0x3874('0x19f'),'foreignKey':_0x3874('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0x3874('0x1ab')]['hasMany'](db[_0x3874('0x92')],{'as':_0x3874('0x1ac'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x3874('0x1ad')][_0x3874('0x10b')](db[_0x3874('0x92')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1ae')});db['AnalyticMetric'][_0x3874('0x10b')](db['AnalyticFieldReport'],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1af')});db[_0x3874('0x92')][_0x3874('0x11a')](db[_0x3874('0x91')],{'foreignKey':_0x3874('0x1af')});db[_0x3874('0x95')]['hasMany'](db[_0x3874('0x97')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db['SalesforceConfiguration'][_0x3874('0x10b')](db[_0x3874('0x99')],{'as':_0x3874('0x1b2'),'onDelete':'cascade','foreignKey':_0x3874('0x1b3')});db[_0x3874('0x97')][_0x3874('0x10b')](db['SalesforceField'],{'as':_0x3874('0x1b4'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0x97')]['hasMany'](db[_0x3874('0x99')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db['SalesforceConfiguration'][_0x3874('0x11a')](db['SalesforceAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0x99')]['hasMany'](db[_0x3874('0x99')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db[_0x3874('0x99')]['hasMany'](db[_0x3874('0x99')],{'as':_0x3874('0x1b8'),'foreignKey':'DescriptionId'});db[_0x3874('0x99')][_0x3874('0x10b')](db['SalesforceField'],{'as':'Field','foreignKey':_0x3874('0x1b6')});db[_0x3874('0x99')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x3874('0x10b')](db[_0x3874('0x9d')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0x9d')][_0x3874('0x10b')](db['SugarcrmField'],{'as':_0x3874('0x1b2'),'onDelete':'cascade','foreignKey':_0x3874('0x1b3')});db[_0x3874('0x9d')][_0x3874('0x10b')](db[_0x3874('0x9f')],{'as':_0x3874('0x1b4'),'onDelete':'cascade','foreignKey':_0x3874('0x1b5')});db[_0x3874('0x9d')][_0x3874('0x10b')](db[_0x3874('0x9f')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':'FieldId'});db[_0x3874('0x9d')][_0x3874('0x11a')](db[_0x3874('0x9b')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0x9f')]['hasMany'](db[_0x3874('0x9f')],{'as':'Subject','foreignKey':_0x3874('0x1b3')});db['SugarcrmField']['hasMany'](db[_0x3874('0x9f')],{'as':'Description','foreignKey':_0x3874('0x1b5')});db['SugarcrmField']['hasMany'](db[_0x3874('0x9f')],{'as':_0x3874('0x1b9'),'foreignKey':'FieldId'});db[_0x3874('0x9f')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db['DeskAccount'][_0x3874('0x10b')](db[_0x3874('0xa2')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db['DeskConfiguration'][_0x3874('0x10b')](db[_0x3874('0xa4')],{'as':_0x3874('0x1b2'),'onDelete':'cascade','foreignKey':_0x3874('0x1b3')});db['DeskConfiguration'][_0x3874('0x10b')](db['DeskField'],{'as':_0x3874('0x1b4'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xa2')][_0x3874('0x10b')](db[_0x3874('0xa4')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xa2')][_0x3874('0x11a')](db[_0x3874('0x1bb')],{'as':'Account','foreignKey':_0x3874('0x1b1')});db[_0x3874('0xa2')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x1bc')});db[_0x3874('0xa4')][_0x3874('0x10b')](db[_0x3874('0xa4')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db[_0x3874('0xa4')][_0x3874('0x10b')](db[_0x3874('0xa4')],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xa4')][_0x3874('0x10b')](db['DeskField'],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xa4')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':'VariableId'});db[_0x3874('0xa5')]['hasMany'](db[_0x3874('0xa7')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xa7')][_0x3874('0x10b')](db['ZohoField'],{'as':_0x3874('0x1b2'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x3874('0xa7')][_0x3874('0x10b')](db['ZohoField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x3874('0x1b5')});db[_0x3874('0xa7')][_0x3874('0x10b')](db[_0x3874('0xa9')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xa7')][_0x3874('0x11a')](db[_0x3874('0xa5')],{'as':_0x3874('0x16a'),'foreignKey':'AccountId'});db[_0x3874('0xa9')][_0x3874('0x10b')](db[_0x3874('0xa9')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db['ZohoField'][_0x3874('0x10b')](db[_0x3874('0xa9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3874('0xa9')]['hasMany'](db[_0x3874('0xa9')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db['ZohoField']['belongsTo'](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db[_0x3874('0xab')][_0x3874('0x10b')](db[_0x3874('0xad')],{'as':_0x3874('0x1b0'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x3874('0x10b')](db['ZendeskField'],{'as':_0x3874('0x1b2'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x3874('0x10b')](db[_0x3874('0xae')],{'as':_0x3874('0x1b4'),'foreignKey':'DescriptionId'});db[_0x3874('0xad')]['hasMany'](db['ZendeskField'],{'as':_0x3874('0x1ac'),'foreignKey':_0x3874('0x1b6')});db['ZendeskConfiguration'][_0x3874('0x11a')](db['ZendeskAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xad')][_0x3874('0x11b')](db[_0x3874('0x83')],{'through':_0x3874('0x1bd')});db['ZendeskField'][_0x3874('0x10b')](db[_0x3874('0xae')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db['ZendeskField'][_0x3874('0x10b')](db['ZendeskField'],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db['ZendeskField']['hasMany'](db[_0x3874('0xae')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xae')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':'Variable','foreignKey':'VariableId'});db[_0x3874('0x1be')][_0x3874('0x10b')](db[_0x3874('0xb0')],{'as':_0x3874('0x1b0'),'onDelete':'cascade','foreignKey':_0x3874('0x1b1')});db[_0x3874('0xb0')][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':'Subjects','onDelete':_0x3874('0x108'),'foreignKey':'SubjectId'});db[_0x3874('0xb0')][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':_0x3874('0x1b4'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xb0')][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xb0')][_0x3874('0x11a')](db[_0x3874('0x1be')],{'as':'Account','foreignKey':_0x3874('0x1b1')});db[_0x3874('0xb0')]['belongsToMany'](db[_0x3874('0x83')],{'through':_0x3874('0x1bf')});db['FreshdeskField'][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x3874('0xb2')][_0x3874('0x10b')](db['FreshdeskField'],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db['FreshdeskField'][_0x3874('0x10b')](db[_0x3874('0xb2')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xb2')][_0x3874('0x11a')](db['Variable'],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db[_0x3874('0x1c0')]['hasMany'](db[_0x3874('0xb5')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xb5')][_0x3874('0x10b')](db[_0x3874('0xb7')],{'as':_0x3874('0x1b2'),'foreignKey':_0x3874('0x1b3')});db[_0x3874('0xb5')][_0x3874('0x10b')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x3874('0x1b5')});db[_0x3874('0xb5')][_0x3874('0x10b')](db['VtigerField'],{'as':_0x3874('0x1ac'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xb5')]['belongsTo'](db[_0x3874('0x1c0')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xb7')]['hasMany'](db[_0x3874('0xb7')],{'as':_0x3874('0x1b7'),'foreignKey':'SubjectId'});db[_0x3874('0xb7')][_0x3874('0x10b')](db[_0x3874('0xb7')],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xb7')][_0x3874('0x10b')](db[_0x3874('0xb7')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xb7')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db[_0x3874('0x1c1')][_0x3874('0x10b')](db[_0x3874('0xba')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':'AccountId'});db[_0x3874('0xba')][_0x3874('0x10b')](db[_0x3874('0xbc')],{'as':_0x3874('0x1b2'),'foreignKey':'SubjectId'});db[_0x3874('0xba')][_0x3874('0x10b')](db[_0x3874('0xbc')],{'as':_0x3874('0x1b4'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xba')][_0x3874('0x10b')](db[_0x3874('0xbc')],{'as':_0x3874('0x1ac'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xba')][_0x3874('0x11a')](db['ServicenowAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xbc')]['hasMany'](db[_0x3874('0xbc')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db['ServicenowField'][_0x3874('0x10b')](db[_0x3874('0xbc')],{'as':'Description','foreignKey':'DescriptionId'});db['ServicenowField'][_0x3874('0x10b')](db['ServicenowField'],{'as':_0x3874('0x1b9'),'foreignKey':'FieldId'});db[_0x3874('0xbc')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':'VariableId'});db['Dynamics365Account']['hasMany'](db[_0x3874('0xbf')],{'as':'Configurations','onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xbf')][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':_0x3874('0x1b2'),'onDelete':_0x3874('0x108'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x3874('0x1b5')});db[_0x3874('0xbf')]['hasMany'](db[_0x3874('0xc1')],{'as':_0x3874('0x1ac'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xbf')]['belongsTo'](db[_0x3874('0xbe')],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1b1')});db['Dynamics365Field'][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':'Subject','foreignKey':_0x3874('0x1b3')});db['Dynamics365Field'][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xc1')][_0x3874('0x10b')](db[_0x3874('0xc1')],{'as':_0x3874('0x1b9'),'foreignKey':_0x3874('0x1b6')});db[_0x3874('0xc1')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db[_0x3874('0xc2')][_0x3874('0x10b')](db[_0x3874('0xc4')],{'as':_0x3874('0x1b0'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1b1')});db[_0x3874('0xc4')]['hasMany'](db[_0x3874('0xc6')],{'as':'Subjects','foreignKey':_0x3874('0x1b3')});db[_0x3874('0xc4')][_0x3874('0x10b')](db[_0x3874('0xc6')],{'as':_0x3874('0x1b4'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xc4')][_0x3874('0x10b')](db[_0x3874('0xc6')],{'as':'Fields','foreignKey':_0x3874('0x1b6')});db[_0x3874('0xc4')]['belongsTo'](db[_0x3874('0xc2')],{'as':_0x3874('0x16a'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x3874('0x10b')](db[_0x3874('0xc6')],{'as':_0x3874('0x1b7'),'foreignKey':_0x3874('0x1b3')});db[_0x3874('0xc6')]['hasMany'](db['FreshsalesField'],{'as':_0x3874('0x1b8'),'foreignKey':_0x3874('0x1b5')});db[_0x3874('0xc6')][_0x3874('0x10b')](db[_0x3874('0xc6')],{'as':'Field','foreignKey':_0x3874('0x1b6')});db[_0x3874('0xc6')][_0x3874('0x11a')](db[_0x3874('0x89')],{'as':_0x3874('0x89'),'foreignKey':_0x3874('0x1ba')});db['ChatQueueReport']['belongsTo'](db[_0x3874('0x5d')],{});db[_0x3874('0x1c2')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':'ListId'});db[_0x3874('0x1c2')]['belongsTo'](db[_0x3874('0x15b')],{'as':_0x3874('0x15c'),'foreignKey':_0x3874('0x15d')});db[_0x3874('0x1c2')][_0x3874('0x11a')](db[_0x3874('0x60')],{});db[_0x3874('0x1c2')][_0x3874('0x11a')](db[_0x3874('0x61')],{});db[_0x3874('0x1c2')][_0x3874('0x11a')](db[_0x3874('0x12')],{});db[_0x3874('0x1c2')]['belongsTo'](db['ChatQueue'],{});db['ChatInternalMessage'][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1c3')});db['ChatInternalMessage'][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1c4')});db[_0x3874('0xce')]['hasMany'](db[_0x3874('0xcc')],{'foreignKey':_0x3874('0x1c5'),'onDelete':_0x3874('0x108')});db[_0x3874('0xce')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x3874('0x1c5'),'onDelete':_0x3874('0x108')});db[_0x3874('0xd0')][_0x3874('0x11a')](db['SmsAccount'],{});db[_0x3874('0xd0')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':'List','foreignKey':_0x3874('0x167')});db[_0x3874('0xd0')][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':_0x3874('0x15d')});db['SmsQueueReport'][_0x3874('0x11a')](db[_0x3874('0x52')],{});db[_0x3874('0xd0')]['belongsTo'](db[_0x3874('0x54')],{});db['SmsQueueReport']['belongsTo'](db[_0x3874('0x12')],{});db[_0x3874('0xd0')][_0x3874('0x11a')](db[_0x3874('0x56')],{});db[_0x3874('0xd4')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x3874('0x1c6')});db[_0x3874('0xd4')]['hasMany'](db[_0x3874('0xcc')],{'foreignKey':'ProjectId'});db[_0x3874('0xd4')][_0x3874('0x10b')](db[_0x3874('0xcb')],{'foreignKey':_0x3874('0x1c6')});db[_0x3874('0xd7')][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x16d'),'through':_0x3874('0x13f')});db['Team']['belongsToMany'](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x11e')});db[_0x3874('0xdc')]['belongsToMany'](db[_0x3874('0x125')],{'through':'TeamVoiceQueue','as':_0x3874('0x126')});db['Team']['belongsToMany'](db[_0x3874('0x3a')],{'through':_0x3874('0x168'),'as':_0x3874('0x127')});db[_0x3874('0xdc')][_0x3874('0x11b')](db['ChatQueue'],{'through':_0x3874('0x1c7'),'as':_0x3874('0x12a')});db[_0x3874('0xdc')][_0x3874('0x11b')](db[_0x3874('0x4b')],{'through':'team_has_fax_queues','as':_0x3874('0x12c')});db[_0x3874('0xdc')][_0x3874('0x11b')](db[_0x3874('0x56')],{'through':_0x3874('0x182'),'as':'SmsQueues'});db[_0x3874('0xdc')]['belongsToMany'](db[_0x3874('0x12e')],{'through':_0x3874('0x18a'),'as':'OpenchannelQueues'});db[_0x3874('0xdc')][_0x3874('0x11b')](db[_0x3874('0x103')],{'through':_0x3874('0x1c8'),'as':_0x3874('0x130')});db[_0x3874('0x198')]['hasMany'](db['CmHopper'],{'as':_0x3874('0x149'),'foreignKey':_0x3874('0x199')});db['Campaign'][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':_0x3874('0x199')});db[_0x3874('0x198')][_0x3874('0x10b')](db[_0x3874('0x110')],{'as':_0x3874('0x1c9'),'foreignKey':_0x3874('0x199')});db[_0x3874('0x198')]['hasMany'](db[_0x3874('0x6d')],{'as':_0x3874('0x14a'),'foreignKey':_0x3874('0x199')});db[_0x3874('0x198')]['belongsTo'](db['Trunk'],{'as':_0x3874('0x29'),'foreignKey':_0x3874('0x14c')});db[_0x3874('0x198')][_0x3874('0x11a')](db[_0x3874('0x29')],{'as':'TrunkBackup','foreignKey':_0x3874('0x14e')});db[_0x3874('0x198')][_0x3874('0x11a')](db[_0x3874('0x79')],{'as':'Interval','foreignKey':_0x3874('0x14f')});db[_0x3874('0x198')][_0x3874('0x11a')](db[_0x3874('0xd7')],{'as':'SquareProject','foreignKey':_0x3874('0x1ca')});db[_0x3874('0x198')][_0x3874('0x11b')](db[_0x3874('0xee')],{'as':_0x3874('0x11c'),'through':_0x3874('0x1cb')});db['Campaign']['belongsToMany'](db[_0x3874('0xee')],{'as':'BlackLists','through':_0x3874('0x1cc')});db[_0x3874('0xe2')][_0x3874('0x11a')](db['ChatOfflineMessage'],{'as':_0x3874('0x63'),'foreignKey':'ChatOfflineMessageId'});db[_0x3874('0xe5')][_0x3874('0x11a')](db['MailMessage'],{});db[_0x3874('0xe5')][_0x3874('0x11a')](db[_0x3874('0x3d')],{});db[_0x3874('0xe5')][_0x3874('0x11a')](db[_0x3874('0x38')],{'foreignKey':_0x3874('0x1cd'),'as':_0x3874('0x1ce')});db[_0x3874('0xe5')][_0x3874('0x11a')](db['User'],{'foreignKey':'FromUserId','as':_0x3874('0x1cf')});db['MailTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1d0'),'as':'ToAgent'});db['MailTransferReport'][_0x3874('0x11a')](db[_0x3874('0x3a')],{'foreignKey':_0x3874('0x1d1'),'as':_0x3874('0x1d2')});db['MailTransferReport']['belongsTo'](db[_0x3874('0x38')],{'foreignKey':'ToMailAccountId','as':_0x3874('0x1d3')});db['ChatTransferReport'][_0x3874('0x11a')](db[_0x3874('0x61')],{});db[_0x3874('0xe7')][_0x3874('0x11a')](db[_0x3874('0x60')],{});db[_0x3874('0xe7')]['belongsTo'](db[_0x3874('0x5d')],{'foreignKey':_0x3874('0x1d4'),'as':'FromAccount'});db[_0x3874('0xe7')][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db['ChatTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1d0'),'as':_0x3874('0x1d5')});db[_0x3874('0xe7')][_0x3874('0x11a')](db[_0x3874('0x129')],{'foreignKey':_0x3874('0x1d6'),'as':'ToQueue'});db[_0x3874('0xe7')][_0x3874('0x11a')](db[_0x3874('0x5d')],{'foreignKey':_0x3874('0x1d7'),'as':_0x3874('0x1d3')});db['FaxTransferReport'][_0x3874('0x11a')](db['FaxMessage'],{});db[_0x3874('0xe8')]['belongsTo'](db[_0x3874('0x47')],{});db[_0x3874('0xe8')]['belongsTo'](db[_0x3874('0x135')],{'foreignKey':_0x3874('0x1d8'),'as':_0x3874('0x1ce')});db['FaxTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':'FromUserId','as':_0x3874('0x1cf')});db[_0x3874('0xe8')][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1d0'),'as':_0x3874('0x1d5')});db[_0x3874('0xe8')][_0x3874('0x11a')](db['FaxQueue'],{'foreignKey':_0x3874('0x1d9'),'as':'ToQueue'});db[_0x3874('0xe8')][_0x3874('0x11a')](db[_0x3874('0x135')],{'foreignKey':_0x3874('0x1da'),'as':_0x3874('0x1d3')});db['OpenchannelTransferReport'][_0x3874('0x11a')](db['OpenchannelMessage'],{});db[_0x3874('0xea')][_0x3874('0x11a')](db[_0x3874('0x5a')],{});db[_0x3874('0xea')][_0x3874('0x11a')](db[_0x3874('0x139')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1db'),'as':_0x3874('0x1cf')});db['OpenchannelTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':'ToUserId','as':_0x3874('0x1d5')});db[_0x3874('0xea')]['belongsTo'](db[_0x3874('0x12e')],{'foreignKey':'ToOpenchannelQueueId','as':_0x3874('0x1d2')});db[_0x3874('0xea')][_0x3874('0x11a')](db[_0x3874('0x139')],{'foreignKey':_0x3874('0x1dc'),'as':_0x3874('0x1d3')});db[_0x3874('0xec')][_0x3874('0x11a')](db[_0x3874('0x54')],{});db[_0x3874('0xec')][_0x3874('0x11a')](db[_0x3874('0x52')],{});db[_0x3874('0xec')]['belongsTo'](db[_0x3874('0x4f')],{'foreignKey':_0x3874('0x1dd'),'as':_0x3874('0x1ce')});db[_0x3874('0xec')][_0x3874('0x11a')](db['User'],{'foreignKey':_0x3874('0x1db'),'as':'FromAgent'});db['SmsTransferReport'][_0x3874('0x11a')](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1d0'),'as':'ToAgent'});db[_0x3874('0xec')]['belongsTo'](db[_0x3874('0x56')],{'foreignKey':_0x3874('0x1de'),'as':_0x3874('0x1d2')});db[_0x3874('0xec')][_0x3874('0x11a')](db[_0x3874('0x4f')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x3874('0xee')][_0x3874('0x10b')](db['Disposition'],{'as':_0x3874('0x162'),'foreignKey':_0x3874('0x167'),'onDelete':_0x3874('0x108')});db[_0x3874('0xee')][_0x3874('0x10b')](db['CmCustomField'],{'as':_0x3874('0x1df'),'foreignKey':_0x3874('0x167')});db[_0x3874('0xee')][_0x3874('0x10b')](db[_0x3874('0x15b')],{'as':_0x3874('0x193'),'onDelete':'cascade','foreignKey':_0x3874('0x167')});db[_0x3874('0xee')][_0x3874('0x10b')](db[_0x3874('0x10e')],{'as':_0x3874('0x10f'),'foreignKey':'ListId'});db[_0x3874('0xee')][_0x3874('0x10b')](db[_0x3874('0x110')],{'as':'HopperHistory','foreignKey':_0x3874('0x167')});db['CmList'][_0x3874('0x10b')](db[_0x3874('0x112')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x3874('0xee')][_0x3874('0x11b')](db[_0x3874('0x125')],{'as':_0x3874('0x1e0'),'through':'voice_queues_has_cm_lists'});db[_0x3874('0xee')][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x152'),'through':'cm_user_has_lists'});db['VoicePrefix']['hasMany'](db[_0x3874('0x18')],{'as':_0x3874('0x10d'),'onDelete':_0x3874('0x108')});db['VoicePrefix'][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':'Agents','through':_0x3874('0x132')});db[_0x3874('0xf1')][_0x3874('0x10b')](db[_0x3874('0x12')],{'as':_0x3874('0x16d'),'foreignKey':_0x3874('0x1e1')});db['UserProfile']['hasMany'](db[_0x3874('0xf3')],{'as':'UserProfileSections','foreignKey':_0x3874('0x1e1'),'onDelete':_0x3874('0x108')});db[_0x3874('0xf3')][_0x3874('0x10b')](db['UserProfileResource'],{'as':_0x3874('0x1e2'),'foreignKey':_0x3874('0x1e3'),'onDelete':'cascade'});db[_0x3874('0x1e4')][_0x3874('0x10b')](db[_0x3874('0x161')],{'as':'Dispositions','foreignKey':_0x3874('0x1e5'),'onDelete':'cascade'});db[_0x3874('0x1e4')][_0x3874('0x10b')](db[_0x3874('0x76')],{'as':_0x3874('0x163'),'foreignKey':_0x3874('0x1e5')});db[_0x3874('0x1e4')][_0x3874('0x10b')](db[_0x3874('0xfd')],{'as':'Messages','foreignKey':_0x3874('0x1e5')});db[_0x3874('0x1e4')][_0x3874('0x10b')](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x3874('0x1e4')]['hasMany'](db[_0x3874('0xfa')],{'as':'Applications'});db[_0x3874('0x1e4')][_0x3874('0x11a')](db[_0x3874('0xee')],{'as':_0x3874('0x173'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x3874('0x11a')](db[_0x3874('0x7b')],{'as':_0x3874('0x177'),'foreignKey':_0x3874('0x150')});db[_0x3874('0x1e4')][_0x3874('0x11b')](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x13d')});db[_0x3874('0xfa')][_0x3874('0x11a')](db[_0x3874('0x12')],{'onDelete':_0x3874('0x171')});db['WhatsappApplication'][_0x3874('0x11a')](db[_0x3874('0x103')],{'onDelete':_0x3874('0x171')});db[_0x3874('0xfa')][_0x3874('0x11a')](db[_0x3874('0x1e4')],{'onDelete':'restrict'});db[_0x3874('0xfa')]['belongsTo'](db[_0x3874('0x79')],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x14f')});db['WhatsappApplication'][_0x3874('0x11a')](db['Tag'],{'onDelete':_0x3874('0x171'),'foreignKey':_0x3874('0x178')});db[_0x3874('0xfc')][_0x3874('0x10b')](db[_0x3874('0xfd')],{'as':_0x3874('0x155'),'onDelete':_0x3874('0x108'),'foreignKey':_0x3874('0x1e6')});db['WhatsappInteraction'][_0x3874('0x11a')](db['WhatsappAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1e5')});db['WhatsappInteraction'][_0x3874('0x11a')](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':_0x3874('0x15d')});db[_0x3874('0xfc')]['belongsTo'](db[_0x3874('0x12')],{'as':_0x3874('0x17a'),'foreignKey':_0x3874('0x109')});db[_0x3874('0xfc')]['belongsToMany'](db[_0x3874('0x83')],{'through':_0x3874('0x1e7'),'as':_0x3874('0x17b')});db[_0x3874('0xfc')]['belongsToMany'](db[_0x3874('0x83')],{'through':'whatsapp_interaction_has_tags','as':_0x3874('0x16c')});db[_0x3874('0xfc')][_0x3874('0x11b')](db['User'],{'as':_0x3874('0x16d'),'through':_0x3874('0x124'),'foreignKey':_0x3874('0x1e6')});db[_0x3874('0xfd')]['belongsTo'](db[_0x3874('0x12')],{'as':_0x3874('0x12')});db['WhatsappMessage'][_0x3874('0x11a')](db[_0x3874('0x15b')],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x15c')});db[_0x3874('0xfd')][_0x3874('0x11a')](db['WhatsappInteraction'],{'onDelete':_0x3874('0x108'),'as':_0x3874('0x16f'),'foreignKey':'WhatsappInteractionId'});db[_0x3874('0xfd')][_0x3874('0x11a')](db['WhatsappAccount'],{'as':_0x3874('0x16a'),'foreignKey':_0x3874('0x1e5')});db[_0x3874('0xff')]['belongsTo'](db[_0x3874('0x1e4')],{});db['WhatsappQueueReport']['belongsTo'](db['CmList'],{'as':_0x3874('0x173'),'foreignKey':_0x3874('0x167')});db['WhatsappQueueReport']['belongsTo'](db[_0x3874('0x15b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x3874('0xff')][_0x3874('0x11a')](db[_0x3874('0xfc')],{});db[_0x3874('0xff')][_0x3874('0x11a')](db[_0x3874('0x103')],{});db[_0x3874('0xff')][_0x3874('0x11a')](db['WhatsappMessage'],{});db[_0x3874('0xff')][_0x3874('0x11a')](db[_0x3874('0x12')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x3874('0xfd')],{});db[_0x3874('0x101')][_0x3874('0x11a')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x3874('0x11a')](db[_0x3874('0x1e4')],{'foreignKey':_0x3874('0x1e8'),'as':_0x3874('0x1ce')});db[_0x3874('0x101')][_0x3874('0x11a')](db[_0x3874('0x1e4')],{'foreignKey':_0x3874('0x1e9'),'as':_0x3874('0x1d3')});db[_0x3874('0x101')][_0x3874('0x11a')](db[_0x3874('0x103')],{'foreignKey':_0x3874('0x1ea'),'as':_0x3874('0x1d2')});db[_0x3874('0x101')]['belongsTo'](db[_0x3874('0x12')],{'foreignKey':_0x3874('0x1db'),'as':'FromAgent'});db[_0x3874('0x101')]['belongsTo'](db[_0x3874('0x12')],{'foreignKey':'ToUserId','as':_0x3874('0x1d5')});db[_0x3874('0x103')]['belongsToMany'](db[_0x3874('0x12')],{'as':_0x3874('0x152'),'through':_0x3874('0x34'),'foreignKey':_0x3874('0x1eb')});db[_0x3874('0x103')]['belongsToMany'](db[_0x3874('0xdc')],{'through':_0x3874('0x1c8'),'as':_0x3874('0x153')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f4adb16..3c9b303 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6f2=['/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./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/chatApplication','/api/chat/interactions','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','/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/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/triggers','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/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/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','./api/version','/api/pm2','./api/webbar','/apidoc','join','/www','static','root','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','password','newPassword','apiKey','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','calleridname','exten','vidaooApiKey','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','oldPassword','isArray','length','isPlainObject','isString','replace','}@@','includes','lodash','express','express-winston','./errors','./config/environment','./config/logger','api','auth','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','connection','url','statusCode','responseTime','user','name','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','x-forwarded-for','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xc6f2,0x11d));var _0x2c6f=function(_0x320f57,_0x2a34db){_0x320f57=_0x320f57-0x0;var _0x5ea095=_0xc6f2[_0x320f57];return _0x5ea095;};'use strict';var _=require(_0x2c6f('0x0'));var path=require('path');var express=require(_0x2c6f('0x1'));var ewinston=require(_0x2c6f('0x2'));var util=require('util');var errors=require(_0x2c6f('0x3'));var config=require(_0x2c6f('0x4'));var logger=require(_0x2c6f('0x5'))(_0x2c6f('0x6'));var authLogger=require(_0x2c6f('0x5'))(_0x2c6f('0x7'));exports['default']=function(_0xe9a86){_0xe9a86['use'](ewinston[_0x2c6f('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xa4252,_0x15d06c){var _0x4352d3=_0x2c6f('0x9');if(!_['isEmpty'](_0xa4252[_0x2c6f('0xa')])){_0x4352d3+='\x20body=%s';var _0x389312=_0xa4252['body'];maskSensitiveData(_0x389312);}return util[_0x2c6f('0xb')](_0x4352d3,_0xa4252[_0x2c6f('0xc')],_0xa4252[_0x2c6f('0xd')]['x-forwarded-for']?_0xa4252['headers']['x-forwarded-for']:_0xa4252[_0x2c6f('0xe')]['remoteAddress']||_0xa4252['ip'],_0xa4252[_0x2c6f('0xf')],_0x15d06c[_0x2c6f('0x10')],_0x15d06c[_0x2c6f('0x11')],_0xa4252['user']?_0xa4252[_0x2c6f('0x12')]['id']:null,_0xa4252[_0x2c6f('0x12')]?_0xa4252[_0x2c6f('0x12')][_0x2c6f('0x13')]:null,_0xa4252[_0x2c6f('0x12')]?_0xa4252['user'][_0x2c6f('0x14')]:null,_0x389312?util['inspect'](_0x389312,![],null):'');}}));_0xe9a86[_0x2c6f('0x15')](ewinston[_0x2c6f('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xe0f91c,_0xfd37b4){var _0x18e2c5=_0x2c6f('0x16');if(_0xe0f91c['body']&&_0xe0f91c[_0x2c6f('0xa')][_0x2c6f('0x17')]&&_0xe0f91c[_0x2c6f('0xa')][_0x2c6f('0x18')]){_0x18e2c5=_0x2c6f('0x19');}return util[_0x2c6f('0xb')](_0x18e2c5,_0xe0f91c[_0x2c6f('0xc')],_0xe0f91c[_0x2c6f('0xd')]['x-forwarded-for']?_0xe0f91c['headers'][_0x2c6f('0x1a')]:_0xe0f91c['connection']['remoteAddress']||_0xe0f91c['ip'],_0xe0f91c[_0x2c6f('0xf')],_0xfd37b4[_0x2c6f('0x10')],_0xfd37b4[_0x2c6f('0x11')],_0xe0f91c['user']?_0xe0f91c[_0x2c6f('0x12')]['id']:null,_0xe0f91c[_0x2c6f('0x12')]?_0xe0f91c[_0x2c6f('0x12')][_0x2c6f('0x13')]:null,_0xe0f91c['user']?_0xe0f91c[_0x2c6f('0x12')][_0x2c6f('0x14')]:null,_0xe0f91c[_0x2c6f('0xa')]&&_0xe0f91c[_0x2c6f('0xa')][_0x2c6f('0x17')]?_0xe0f91c['body']['device']:_0x2c6f('0x1b'),_0xe0f91c[_0x2c6f('0xa')]&&_0xe0f91c['body'][_0x2c6f('0x18')]?_0xe0f91c[_0x2c6f('0xa')][_0x2c6f('0x18')]:'',_0xe0f91c['body']&&_0xe0f91c[_0x2c6f('0xa')][_0x2c6f('0x1c')]?_0xe0f91c[_0x2c6f('0xa')][_0x2c6f('0x1c')]:'');},'ignoreRoute':function(_0x3795f7){var _0x4eaf9a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4eaf9a[_0x2c6f('0x1d')](_0x3795f7[_0x2c6f('0xf')]);}}));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x1e'),require(_0x2c6f('0x1f')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x20'),require(_0x2c6f('0x21')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x22'),require(_0x2c6f('0x23')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x24'),require(_0x2c6f('0x25')));_0xe9a86['use'](_0x2c6f('0x26'),require(_0x2c6f('0x27')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x28'),require('./api/voiceQueue'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x29'),require('./api/voiceRecording'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x2a'),require(_0x2c6f('0x2b')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x2c'),require('./api/voiceMail'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x2d'),require(_0x2c6f('0x2e')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x2f'),require(_0x2c6f('0x30')));_0xe9a86['use'](_0x2c6f('0x31'),require(_0x2c6f('0x32')));_0xe9a86['use']('/api/voice/agents/reports',require(_0x2c6f('0x33')));_0xe9a86[_0x2c6f('0x15')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0xe9a86[_0x2c6f('0x15')]('/api/members/reports',require(_0x2c6f('0x34')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x35'),require(_0x2c6f('0x36')));_0xe9a86[_0x2c6f('0x15')]('/api/voice/transfers/reports',require(_0x2c6f('0x37')));_0xe9a86['use'](_0x2c6f('0x38'),require(_0x2c6f('0x39')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x3a'),require(_0x2c6f('0x3b')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x3c'),require('./api/mailQueue'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x3d'),require(_0x2c6f('0x3e')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x3f'),require(_0x2c6f('0x40')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x41'),require(_0x2c6f('0x42')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x43'),require(_0x2c6f('0x44')));_0xe9a86[_0x2c6f('0x15')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0xe9a86['use']('/api/dashboards',require('./api/dashboard'));_0xe9a86['use'](_0x2c6f('0x45'),require(_0x2c6f('0x46')));_0xe9a86['use'](_0x2c6f('0x47'),require(_0x2c6f('0x48')));_0xe9a86[_0x2c6f('0x15')]('/api/fax/applications',require(_0x2c6f('0x49')));_0xe9a86[_0x2c6f('0x15')]('/api/fax/interactions',require('./api/faxInteraction'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x4a'),require(_0x2c6f('0x4b')));_0xe9a86[_0x2c6f('0x15')]('/api/fax/queues',require(_0x2c6f('0x4c')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x4d'),require('./api/faxQueueReport'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x4e'),require(_0x2c6f('0x4f')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x50'),require(_0x2c6f('0x51')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x52'),require(_0x2c6f('0x53')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x54'),require(_0x2c6f('0x55')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x56'),require('./api/smsQueue'));_0xe9a86['use']('/api/openchannel/accounts',require(_0x2c6f('0x57')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x58'),require('./api/openchannelApplication'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x59'),require(_0x2c6f('0x5a')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x5b'),require('./api/openchannelMessage'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x5c'),require(_0x2c6f('0x5d')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x5e'),require(_0x2c6f('0x5f')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x60'),require(_0x2c6f('0x61')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x62'),require(_0x2c6f('0x63')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x64'),require('./api/chatInteraction'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x65'),require('./api/chatMessage'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x66'),require(_0x2c6f('0x67')));_0xe9a86[_0x2c6f('0x15')]('/api/chat/queues',require(_0x2c6f('0x68')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x69'),require(_0x2c6f('0x6a')));_0xe9a86['use'](_0x2c6f('0x6b'),require(_0x2c6f('0x6c')));_0xe9a86['use']('/api/cm/companies',require(_0x2c6f('0x6d')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x6e'),require('./api/cmContact'));_0xe9a86[_0x2c6f('0x15')]('/api/cm/hopper',require(_0x2c6f('0x6f')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x70'),require('./api/cmHopperBlack'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x71'),require(_0x2c6f('0x72')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x73'),require(_0x2c6f('0x74')));_0xe9a86['use'](_0x2c6f('0x75'),require(_0x2c6f('0x76')));_0xe9a86[_0x2c6f('0x15')]('/api/actions',require(_0x2c6f('0x77')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x78'),require(_0x2c6f('0x79')));_0xe9a86['use'](_0x2c6f('0x7a'),require(_0x2c6f('0x7b')));_0xe9a86[_0x2c6f('0x15')]('/api/dispositions',require(_0x2c6f('0x7c')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x7d'),require(_0x2c6f('0x7e')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x7f'),require(_0x2c6f('0x80')));_0xe9a86[_0x2c6f('0x15')]('/api/pauses',require(_0x2c6f('0x81')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x82'),require(_0x2c6f('0x83')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x84'),require(_0x2c6f('0x85')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x86'),require(_0x2c6f('0x87')));_0xe9a86[_0x2c6f('0x15')]('/api/sounds',require(_0x2c6f('0x88')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x89'),require('./api/tag'));_0xe9a86[_0x2c6f('0x15')]('/api/templates',require('./api/template'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x8a'),require(_0x2c6f('0x8b')));_0xe9a86[_0x2c6f('0x15')]('/api/variables',require(_0x2c6f('0x8c')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x8d'),require('./api/integration'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x8e'),require(_0x2c6f('0x8f')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x90'),require(_0x2c6f('0x91')));_0xe9a86['use'](_0x2c6f('0x92'),require('./api/analyticDefaultReport'));_0xe9a86[_0x2c6f('0x15')]('/api/analytics/extracted_reports',require(_0x2c6f('0x93')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x94'),require('./api/analyticMetric'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x95'),require(_0x2c6f('0x96')));_0xe9a86[_0x2c6f('0x15')]('/api/analytics/tree_reports',require(_0x2c6f('0x97')));_0xe9a86[_0x2c6f('0x15')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0xe9a86[_0x2c6f('0x15')]('/api/integrations/salesforce/configurations',require(_0x2c6f('0x98')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x99'),require(_0x2c6f('0x9a')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x9b'),require(_0x2c6f('0x9c')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x9d'),require('./api/intSugarcrmConfiguration'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x9e'),require('./api/intSugarcrmField'));_0xe9a86[_0x2c6f('0x15')]('/api/integrations/desk/accounts',require(_0x2c6f('0x9f')));_0xe9a86['use'](_0x2c6f('0xa0'),require(_0x2c6f('0xa1')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xa2'),require(_0x2c6f('0xa3')));_0xe9a86[_0x2c6f('0x15')]('/api/integrations/zoho/accounts',require(_0x2c6f('0xa4')));_0xe9a86[_0x2c6f('0x15')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xa5'),require(_0x2c6f('0xa6')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xa7'),require(_0x2c6f('0xa8')));_0xe9a86['use']('/api/integrations/zendesk/configurations',require(_0x2c6f('0xa9')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xaa'),require(_0x2c6f('0xab')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xac'),require('./api/intFreshdeskAccount'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xad'),require(_0x2c6f('0xae')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xaf'),require(_0x2c6f('0xb0')));_0xe9a86['use'](_0x2c6f('0xb1'),require('./api/intVtigerAccount'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xb2'),require(_0x2c6f('0xb3')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xb4'),require(_0x2c6f('0xb5')));_0xe9a86[_0x2c6f('0x15')]('/api/integrations/servicenow/accounts',require(_0x2c6f('0xb6')));_0xe9a86['use'](_0x2c6f('0xb7'),require(_0x2c6f('0xb8')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xb9'),require(_0x2c6f('0xba')));_0xe9a86['use'](_0x2c6f('0xbb'),require(_0x2c6f('0xbc')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xbd'),require(_0x2c6f('0xbe')));_0xe9a86[_0x2c6f('0x15')]('/api/integrations/dynamics365/fields',require(_0x2c6f('0xbf')));_0xe9a86['use'](_0x2c6f('0xc0'),require(_0x2c6f('0xc1')));_0xe9a86[_0x2c6f('0x15')]('/api/integrations/freshsales/configurations',require(_0x2c6f('0xc2')));_0xe9a86['use'](_0x2c6f('0xc3'),require(_0x2c6f('0xc4')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xc5'),require(_0x2c6f('0xc6')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xc7'),require(_0x2c6f('0xc8')));_0xe9a86[_0x2c6f('0x15')]('/api/chat/internal/messages',require(_0x2c6f('0xc9')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xca'),require(_0x2c6f('0xcb')));_0xe9a86['use'](_0x2c6f('0xcc'),require(_0x2c6f('0xcd')));_0xe9a86['use'](_0x2c6f('0xce'),require(_0x2c6f('0xcf')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xd0'),require(_0x2c6f('0xd1')));_0xe9a86['use'](_0x2c6f('0xd2'),require('./api/squareReport'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xd3'),require(_0x2c6f('0xd4')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xd5'),require(_0x2c6f('0xd6')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xd7'),require('./api/setting'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xd8'),require(_0x2c6f('0xd9')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xda'),require(_0x2c6f('0xdb')));_0xe9a86['use'](_0x2c6f('0xdc'),require(_0x2c6f('0xdd')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xde'),require('./api/squareMessage'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xdf'),require(_0x2c6f('0xe0')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xe1'),require(_0x2c6f('0xe2')));_0xe9a86['use'](_0x2c6f('0xe3'),require(_0x2c6f('0xe4')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xe5'),require(_0x2c6f('0xe6')));_0xe9a86['use'](_0x2c6f('0xe7'),require(_0x2c6f('0xe8')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xe9'),require('./api/plugin'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xea'),require(_0x2c6f('0xeb')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xec'),require('./api/chatTransferReport'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xed'),require(_0x2c6f('0xee')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xef'),require('./api/openchannelTransferReport'));_0xe9a86['use'](_0x2c6f('0xf0'),require(_0x2c6f('0xf1')));_0xe9a86[_0x2c6f('0x15')]('/api/cm/lists',require(_0x2c6f('0xf2')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xf3'),require('./api/voicePrefix'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xf4'),require('./api/userProfile'));_0xe9a86['use'](_0x2c6f('0xf5'),require('./api/userProfileSection'));_0xe9a86['use'](_0x2c6f('0xf6'),require(_0x2c6f('0xf7')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xf8'),require(_0x2c6f('0xf9')));_0xe9a86['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0xe9a86['use'](_0x2c6f('0xfa'),require(_0x2c6f('0xfb')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0xfc'),require(_0x2c6f('0xfd')));_0xe9a86['use'](_0x2c6f('0xfe'),require(_0x2c6f('0xff')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x100'),require(_0x2c6f('0x101')));_0xe9a86[_0x2c6f('0x15')]('/api/whatsapp/reports/transfer',require(_0x2c6f('0x102')));_0xe9a86['use'](_0x2c6f('0x103'),require(_0x2c6f('0x104')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x105'),require(_0x2c6f('0x106')));_0xe9a86[_0x2c6f('0x15')]('/api/realtime',require(_0x2c6f('0x107')));_0xe9a86[_0x2c6f('0x15')]('/api/auth/local',require(_0x2c6f('0x108')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x109'),require(_0x2c6f('0x10a')));_0xe9a86['use'](_0x2c6f('0x10b'),require('./api/jira'));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x10c'),require(_0x2c6f('0x10d')));_0xe9a86[_0x2c6f('0x15')]('/api/version',require(_0x2c6f('0x10e')));_0xe9a86[_0x2c6f('0x15')]('/api/system',require('./api/system'));_0xe9a86['use'](_0x2c6f('0x10f'),require('./api/pm2'));_0xe9a86['use']('/api/webbar',require(_0x2c6f('0x110')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x111'),express['static'](path[_0x2c6f('0x112')](config['root'],_0x2c6f('0x111'))));_0xe9a86['use'](_0x2c6f('0x113'),express[_0x2c6f('0x114')](path[_0x2c6f('0x112')](config[_0x2c6f('0x115')],'/www')));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x116'),express[_0x2c6f('0x114')](path['join'](config['root'],_0x2c6f('0x116'))));_0xe9a86[_0x2c6f('0x15')](_0x2c6f('0x117'),express[_0x2c6f('0x114')](path[_0x2c6f('0x112')](config[_0x2c6f('0x115')],_0x2c6f('0x118'),_0x2c6f('0x119'))));_0xe9a86['use']('/plugins',express[_0x2c6f('0x114')](path['join'](config[_0x2c6f('0x115')],_0x2c6f('0x11a'))));_0xe9a86[_0x2c6f('0x11b')](_0x2c6f('0x11c'))[_0x2c6f('0x11d')](errors[0x194]);_0xe9a86[_0x2c6f('0x11b')]('/*')[_0x2c6f('0x11d')](function(_0x441291,_0x273a75){_0x273a75[_0x2c6f('0x11e')](path['resolve'](_0xe9a86[_0x2c6f('0x11d')](_0x2c6f('0x11f'))+_0x2c6f('0x120')));});};var sensitiveFields=['username',_0x2c6f('0x121'),_0x2c6f('0x122'),_0x2c6f('0x123'),'firstName',_0x2c6f('0x124'),_0x2c6f('0x125'),_0x2c6f('0x126'),_0x2c6f('0x127'),_0x2c6f('0x128'),'email',_0x2c6f('0x129'),_0x2c6f('0x12a'),_0x2c6f('0x12b'),_0x2c6f('0x12c'),_0x2c6f('0x12d'),_0x2c6f('0x12e'),_0x2c6f('0x12f'),_0x2c6f('0x130'),_0x2c6f('0x131'),_0x2c6f('0x132'),_0x2c6f('0x133'),'consumerKey','consumerSecret','membername',_0x2c6f('0x134'),'calleridnum',_0x2c6f('0x135'),_0x2c6f('0x136'),'clientEmail','privateKey','accesskeyid',_0x2c6f('0x137'),_0x2c6f('0x138'),_0x2c6f('0x12'),_0x2c6f('0x139'),_0x2c6f('0x13a'),_0x2c6f('0x13b'),_0x2c6f('0x13c'),'secret',_0x2c6f('0x13d'),_0x2c6f('0x13e')];function maskSensitiveData(_0x2d4fb7){var _0x297c48=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x2d4fb7))return;for(var _0x9af584 in _0x2d4fb7){if(_[_0x2c6f('0x13f')](_0x2d4fb7[_0x9af584])){for(var _0x1c47e8=0x0;_0x1c47e8<_0x2d4fb7[_0x9af584][_0x2c6f('0x140')];_0x1c47e8++){maskSensitiveData(_0x2d4fb7[_0x9af584][_0x1c47e8]);}}else if(_[_0x2c6f('0x141')](_0x2d4fb7[_0x9af584])){maskSensitiveData(_0x2d4fb7[_0x9af584]);}else if(_[_0x2c6f('0x142')](_0x2d4fb7[_0x9af584])){_0x2d4fb7[_0x9af584]=_0x2d4fb7[_0x9af584][_0x2c6f('0x143')](/{{{/g,'@@{')['replace'](/}}}/g,_0x2c6f('0x144'))[_0x2c6f('0x143')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x2c6f('0x145')](sensitiveFields,_0x9af584)){_0x2d4fb7[_0x9af584]=_0x2d4fb7[_0x9af584][_0x2c6f('0x143')](_0x297c48,'*');}}}} \ No newline at end of file +var _0x5b8a=['./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/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/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','password','newPassword','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','accessKey','tenantId','channelSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','isString','replace','@@{','}@@','includes','lodash','express-winston','util','./errors','./config/logger','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','device','agent_name','test','/api/users','/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/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./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/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./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/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields'];(function(_0x5f2098,_0x47308b){var _0x18af32=function(_0xa53c8e){while(--_0xa53c8e){_0x5f2098['push'](_0x5f2098['shift']());}};_0x18af32(++_0x47308b);}(_0x5b8a,0x9f));var _0xa5b8=function(_0x3525fe,_0x42dae5){_0x3525fe=_0x3525fe-0x0;var _0x4efe6c=_0x5b8a[_0x3525fe];return _0x4efe6c;};'use strict';var _=require(_0xa5b8('0x0'));var path=require('path');var express=require('express');var ewinston=require(_0xa5b8('0x1'));var util=require(_0xa5b8('0x2'));var errors=require(_0xa5b8('0x3'));var config=require('./config/environment');var logger=require(_0xa5b8('0x4'))('api');var authLogger=require(_0xa5b8('0x4'))(_0xa5b8('0x5'));exports[_0xa5b8('0x6')]=function(_0x310699){_0x310699[_0xa5b8('0x7')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x241c7b,_0x2a3b45){var _0x35df88=_0xa5b8('0x8');if(!_[_0xa5b8('0x9')](_0x241c7b[_0xa5b8('0xa')])){_0x35df88+=_0xa5b8('0xb');var _0x2eea99=_0x241c7b['body'];maskSensitiveData(_0x2eea99);}return util[_0xa5b8('0xc')](_0x35df88,_0x241c7b['method'],_0x241c7b[_0xa5b8('0xd')][_0xa5b8('0xe')]?_0x241c7b['headers'][_0xa5b8('0xe')]:_0x241c7b[_0xa5b8('0xf')][_0xa5b8('0x10')]||_0x241c7b['ip'],_0x241c7b[_0xa5b8('0x11')],_0x2a3b45[_0xa5b8('0x12')],_0x2a3b45[_0xa5b8('0x13')],_0x241c7b[_0xa5b8('0x14')]?_0x241c7b[_0xa5b8('0x14')]['id']:null,_0x241c7b[_0xa5b8('0x14')]?_0x241c7b[_0xa5b8('0x14')][_0xa5b8('0x15')]:null,_0x241c7b['user']?_0x241c7b[_0xa5b8('0x14')][_0xa5b8('0x16')]:null,_0x2eea99?util[_0xa5b8('0x17')](_0x2eea99,![],null):'');}}));_0x310699[_0xa5b8('0x7')](ewinston[_0xa5b8('0x18')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x19930,_0x3c2545){var _0x162d3e=_0xa5b8('0x19');if(_0x19930['body']&&_0x19930['body']['device']&&_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1a')]){_0x162d3e=_0xa5b8('0x1b');}return util[_0xa5b8('0xc')](_0x162d3e,_0x19930[_0xa5b8('0x1c')],_0x19930['headers'][_0xa5b8('0xe')]?_0x19930[_0xa5b8('0xd')]['x-forwarded-for']:_0x19930[_0xa5b8('0xf')][_0xa5b8('0x10')]||_0x19930['ip'],_0x19930[_0xa5b8('0x11')],_0x3c2545['statusCode'],_0x3c2545['responseTime'],_0x19930[_0xa5b8('0x14')]?_0x19930[_0xa5b8('0x14')]['id']:null,_0x19930[_0xa5b8('0x14')]?_0x19930[_0xa5b8('0x14')]['name']:null,_0x19930['user']?_0x19930['user'][_0xa5b8('0x16')]:null,_0x19930['body']&&_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1d')]?_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1d')]:'other',_0x19930[_0xa5b8('0xa')]&&_0x19930[_0xa5b8('0xa')]['agent_id']?_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1a')]:'',_0x19930[_0xa5b8('0xa')]&&_0x19930['body']['agent_name']?_0x19930[_0xa5b8('0xa')][_0xa5b8('0x1e')]:'');},'ignoreRoute':function(_0x2cd2d5){var _0x17eaa2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x17eaa2[_0xa5b8('0x1f')](_0x2cd2d5[_0xa5b8('0x11')]);}}));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x20'),require('./api/user'));_0x310699['use'](_0xa5b8('0x21'),require('./api/voiceChanSpy'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x22'),require(_0xa5b8('0x23')));_0x310699[_0xa5b8('0x7')]('/api/voice/extensions',require(_0xa5b8('0x24')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x25'),require(_0xa5b8('0x26')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x27'),require(_0xa5b8('0x28')));_0x310699[_0xa5b8('0x7')]('/api/voice/recordings',require(_0xa5b8('0x29')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x2a'),require(_0xa5b8('0x2b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x2c'),require('./api/voiceMail'));_0x310699['use'](_0xa5b8('0x2d'),require(_0xa5b8('0x2e')));_0x310699['use']('/api/voice/calls/reports',require(_0xa5b8('0x2f')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x30'),require(_0xa5b8('0x31')));_0x310699['use'](_0xa5b8('0x32'),require(_0xa5b8('0x33')));_0x310699['use'](_0xa5b8('0x34'),require(_0xa5b8('0x35')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x36'),require(_0xa5b8('0x37')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x38'),require('./api/trunk'));_0x310699['use'](_0xa5b8('0x39'),require(_0xa5b8('0x3a')));_0x310699[_0xa5b8('0x7')]('/api/mail/out_servers',require(_0xa5b8('0x3b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x3c'),require('./api/mailAccount'));_0x310699['use'](_0xa5b8('0x3d'),require(_0xa5b8('0x3e')));_0x310699[_0xa5b8('0x7')]('/api/mail/substatuses',require(_0xa5b8('0x3f')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x40'),require('./api/mailInteraction'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x41'),require('./api/mailMessage'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x42'),require(_0xa5b8('0x43')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x44'),require('./api/mailQueueReport'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x45'),require('./api/dashboard'));_0x310699[_0xa5b8('0x7')]('/api/dashboards/items',require(_0xa5b8('0x46')));_0x310699[_0xa5b8('0x7')]('/api/fax/accounts',require(_0xa5b8('0x47')));_0x310699[_0xa5b8('0x7')]('/api/fax/applications',require(_0xa5b8('0x48')));_0x310699['use'](_0xa5b8('0x49'),require(_0xa5b8('0x4a')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x4b'),require('./api/faxMessage'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x4c'),require('./api/faxQueue'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x4d'),require(_0xa5b8('0x4e')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x4f'),require(_0xa5b8('0x50')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x51'),require(_0xa5b8('0x52')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x53'),require('./api/smsInteraction'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x54'),require(_0xa5b8('0x55')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x56'),require(_0xa5b8('0x57')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x58'),require(_0xa5b8('0x59')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x5a'),require(_0xa5b8('0x5b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x5c'),require(_0xa5b8('0x5d')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x5e'),require('./api/openchannelMessage'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x5f'),require(_0xa5b8('0x60')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x61'),require('./api/chatWebsite'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x62'),require(_0xa5b8('0x63')));_0x310699[_0xa5b8('0x7')]('/api/chat/applications',require(_0xa5b8('0x64')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x65'),require(_0xa5b8('0x66')));_0x310699['use']('/api/chat/messages',require(_0xa5b8('0x67')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x68'),require(_0xa5b8('0x69')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x6a'),require(_0xa5b8('0x6b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x6c'),require(_0xa5b8('0x6d')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x6e'),require(_0xa5b8('0x6f')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x70'),require(_0xa5b8('0x71')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x72'),require(_0xa5b8('0x73')));_0x310699[_0xa5b8('0x7')]('/api/cm/hopper',require(_0xa5b8('0x74')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x75'),require('./api/cmHopperBlack'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x76'),require(_0xa5b8('0x77')));_0x310699['use'](_0xa5b8('0x78'),require(_0xa5b8('0x79')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x7a'),require(_0xa5b8('0x7b')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x7c'),require(_0xa5b8('0x7d')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x7e'),require('./api/automation'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x7f'),require(_0xa5b8('0x80')));_0x310699[_0xa5b8('0x7')]('/api/dispositions',require(_0xa5b8('0x81')));_0x310699[_0xa5b8('0x7')]('/api/conditions',require('./api/condition'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x82'),require(_0xa5b8('0x83')));_0x310699[_0xa5b8('0x7')]('/api/pauses',require(_0xa5b8('0x84')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x85'),require('./api/cdr'));_0x310699['use'](_0xa5b8('0x86'),require(_0xa5b8('0x87')));_0x310699['use'](_0xa5b8('0x88'),require(_0xa5b8('0x89')));_0x310699[_0xa5b8('0x7')]('/api/sounds',require(_0xa5b8('0x8a')));_0x310699[_0xa5b8('0x7')]('/api/tags',require('./api/tag'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x8b'),require(_0xa5b8('0x8c')));_0x310699['use'](_0xa5b8('0x8d'),require(_0xa5b8('0x8e')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x8f'),require(_0xa5b8('0x90')));_0x310699['use']('/api/integrations',require(_0xa5b8('0x91')));_0x310699['use'](_0xa5b8('0x92'),require(_0xa5b8('0x93')));_0x310699['use'](_0xa5b8('0x94'),require(_0xa5b8('0x95')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x96'),require(_0xa5b8('0x97')));_0x310699[_0xa5b8('0x7')]('/api/analytics/extracted_reports',require(_0xa5b8('0x98')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x99'),require(_0xa5b8('0x9a')));_0x310699['use'](_0xa5b8('0x9b'),require(_0xa5b8('0x9c')));_0x310699['use']('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x310699['use'](_0xa5b8('0x9d'),require('./api/intSalesforceAccount'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x9e'),require(_0xa5b8('0x9f')));_0x310699[_0xa5b8('0x7')]('/api/integrations/salesforce/fields',require(_0xa5b8('0xa0')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xa1'),require(_0xa5b8('0xa2')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xa3'),require(_0xa5b8('0xa4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xa5'),require(_0xa5b8('0xa6')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xa7'),require(_0xa5b8('0xa8')));_0x310699[_0xa5b8('0x7')]('/api/integrations/desk/configurations',require(_0xa5b8('0xa9')));_0x310699[_0xa5b8('0x7')]('/api/integrations/desk/fields',require(_0xa5b8('0xaa')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xab'),require('./api/intZohoAccount'));_0x310699['use'](_0xa5b8('0xac'),require('./api/intZohoConfiguration'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xad'),require(_0xa5b8('0xae')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xaf'),require('./api/intZendeskAccount'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb0'),require('./api/intZendeskConfiguration'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb1'),require(_0xa5b8('0xb2')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb3'),require(_0xa5b8('0xb4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb5'),require(_0xa5b8('0xb6')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb7'),require('./api/intFreshdeskField'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xb8'),require(_0xa5b8('0xb9')));_0x310699[_0xa5b8('0x7')]('/api/integrations/vtiger/configurations',require(_0xa5b8('0xba')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xbb'),require(_0xa5b8('0xbc')));_0x310699['use'](_0xa5b8('0xbd'),require('./api/intServicenowAccount'));_0x310699['use']('/api/integrations/servicenow/configurations',require(_0xa5b8('0xbe')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xbf'),require(_0xa5b8('0xc0')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xc1'),require(_0xa5b8('0xc2')));_0x310699[_0xa5b8('0x7')]('/api/integrations/dynamics365/configurations',require(_0xa5b8('0xc3')));_0x310699['use'](_0xa5b8('0xc4'),require(_0xa5b8('0xc5')));_0x310699[_0xa5b8('0x7')]('/api/integrations/freshsales/accounts',require(_0xa5b8('0xc6')));_0x310699['use'](_0xa5b8('0xc7'),require(_0xa5b8('0xc8')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xc9'),require(_0xa5b8('0xca')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xcb'),require(_0xa5b8('0xcc')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xcd'),require(_0xa5b8('0xce')));_0x310699[_0xa5b8('0x7')]('/api/chat/internal/messages',require(_0xa5b8('0xcf')));_0x310699['use']('/api/jscripty/answers/reports',require(_0xa5b8('0xd0')));_0x310699['use'](_0xa5b8('0xd1'),require(_0xa5b8('0xd2')));_0x310699['use'](_0xa5b8('0xd3'),require(_0xa5b8('0xd4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xd5'),require('./api/smsQueueReport'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xd6'),require('./api/squareReport'));_0x310699[_0xa5b8('0x7')]('/api/square/details/reports',require(_0xa5b8('0xd7')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xd8'),require('./api/jscriptyProject'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xd9'),require(_0xa5b8('0xda')));_0x310699['use'](_0xa5b8('0xdb'),require(_0xa5b8('0xdc')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xdd'),require('./api/squareProject'));_0x310699['use'](_0xa5b8('0xde'),require('./api/squareRecording'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xdf'),require(_0xa5b8('0xe0')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xe1'),require(_0xa5b8('0xe2')));_0x310699['use'](_0xa5b8('0xe3'),require(_0xa5b8('0xe4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xe5'),require(_0xa5b8('0xe6')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xe7'),require(_0xa5b8('0xe8')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xe9'),require(_0xa5b8('0xea')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xeb'),require(_0xa5b8('0xec')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xed'),require('./api/mailTransferReport'));_0x310699['use'](_0xa5b8('0xee'),require(_0xa5b8('0xef')));_0x310699[_0xa5b8('0x7')]('/api/fax/reports/transfer',require(_0xa5b8('0xf0')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xf1'),require(_0xa5b8('0xf2')));_0x310699['use']('/api/sms/reports/transfer',require(_0xa5b8('0xf3')));_0x310699[_0xa5b8('0x7')]('/api/cm/lists',require(_0xa5b8('0xf4')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xf5'),require(_0xa5b8('0xf6')));_0x310699[_0xa5b8('0x7')]('/api/userProfiles',require(_0xa5b8('0xf7')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xf8'),require('./api/userProfileSection'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xf9'),require(_0xa5b8('0xfa')));_0x310699[_0xa5b8('0x7')]('/api/userNotifications',require(_0xa5b8('0xfb')));_0x310699[_0xa5b8('0x7')]('/api/whatsapp/accounts',require(_0xa5b8('0xfc')));_0x310699[_0xa5b8('0x7')]('/api/whatsapp/applications',require(_0xa5b8('0xfd')));_0x310699[_0xa5b8('0x7')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x310699['use']('/api/whatsapp/messages',require(_0xa5b8('0xfe')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0xff'),require(_0xa5b8('0x100')));_0x310699['use']('/api/whatsapp/reports/transfer',require(_0xa5b8('0x101')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x102'),require(_0xa5b8('0x103')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x104'),require(_0xa5b8('0x105')));_0x310699['use'](_0xa5b8('0x106'),require('./api/realtime'));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x107'),require(_0xa5b8('0x108')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x109'),require(_0xa5b8('0x10a')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x10b'),require(_0xa5b8('0x10c')));_0x310699[_0xa5b8('0x7')]('/api/rpc',require(_0xa5b8('0x10d')));_0x310699['use']('/api/version',require(_0xa5b8('0x10e')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x10f'),require(_0xa5b8('0x110')));_0x310699['use'](_0xa5b8('0x111'),require(_0xa5b8('0x112')));_0x310699['use'](_0xa5b8('0x113'),require(_0xa5b8('0x114')));_0x310699['use'](_0xa5b8('0x115'),express[_0xa5b8('0x116')](path[_0xa5b8('0x117')](config[_0xa5b8('0x118')],'/apidoc')));_0x310699[_0xa5b8('0x7')]('/www',express[_0xa5b8('0x116')](path['join'](config[_0xa5b8('0x118')],_0xa5b8('0x119'))));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x11a'),express[_0xa5b8('0x116')](path[_0xa5b8('0x117')](config['root'],'/demo')));_0x310699[_0xa5b8('0x7')](_0xa5b8('0x11b'),express['static'](path['join'](config[_0xa5b8('0x118')],_0xa5b8('0x11c'),_0xa5b8('0x11d'))));_0x310699['use']('/plugins',express[_0xa5b8('0x116')](path[_0xa5b8('0x117')](config[_0xa5b8('0x118')],_0xa5b8('0x11e'))));_0x310699[_0xa5b8('0x11f')](_0xa5b8('0x120'))['get'](errors[0x194]);_0x310699['route']('/*')[_0xa5b8('0x121')](function(_0x52c432,_0x525590){_0x525590['sendFile'](path[_0xa5b8('0x122')](_0x310699[_0xa5b8('0x121')](_0xa5b8('0x123'))+_0xa5b8('0x124')));});};var sensitiveFields=['username',_0xa5b8('0x125'),_0xa5b8('0x126'),_0xa5b8('0x127'),_0xa5b8('0x128'),_0xa5b8('0x129'),_0xa5b8('0x12a'),_0xa5b8('0x12b'),'mobile',_0xa5b8('0x12c'),_0xa5b8('0x12d'),_0xa5b8('0x12e'),_0xa5b8('0x12f'),_0xa5b8('0x130'),'code',_0xa5b8('0x131'),_0xa5b8('0x132'),'token',_0xa5b8('0x133'),'accessToken','accessTokenSecret',_0xa5b8('0x134'),_0xa5b8('0x135'),_0xa5b8('0x136'),_0xa5b8('0x137'),_0xa5b8('0x138'),_0xa5b8('0x139'),_0xa5b8('0x13a'),_0xa5b8('0x13b'),_0xa5b8('0x13c'),'privateKey',_0xa5b8('0x13d'),'secretaccesskey',_0xa5b8('0x13e'),'user',_0xa5b8('0x13f'),_0xa5b8('0x140'),_0xa5b8('0x141'),_0xa5b8('0x142'),_0xa5b8('0x143'),_0xa5b8('0x144'),_0xa5b8('0x145')];function maskSensitiveData(_0x36a659){var _0x1bc592=/(?!^)[\s\S](?!$)/g;if(!_[_0xa5b8('0x146')](_0x36a659))return;for(var _0x48b998 in _0x36a659){if(_[_0xa5b8('0x147')](_0x36a659[_0x48b998])){for(var _0x5387ca=0x0;_0x5387ca<_0x36a659[_0x48b998]['length'];_0x5387ca++){maskSensitiveData(_0x36a659[_0x48b998][_0x5387ca]);}}else if(_[_0xa5b8('0x146')](_0x36a659[_0x48b998])){maskSensitiveData(_0x36a659[_0x48b998]);}else if(_[_0xa5b8('0x148')](_0x36a659[_0x48b998])){_0x36a659[_0x48b998]=_0x36a659[_0x48b998][_0xa5b8('0x149')](/{{{/g,_0xa5b8('0x14a'))[_0xa5b8('0x149')](/}}}/g,_0xa5b8('0x14b'))[_0xa5b8('0x149')](/{{/g,'@{')[_0xa5b8('0x149')](/}}/g,'}@');if(_[_0xa5b8('0x14c')](sensitiveFields,_0x48b998)){_0x36a659[_0x48b998]=_0x36a659[_0x48b998]['replace'](_0x1bc592,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 7857dbb..82e4e0a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa28c=['../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','server','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc'];(function(_0x21d057,_0x353894){var _0x4f62d2=function(_0x34159f){while(--_0x34159f){_0x21d057['push'](_0x21d057['shift']());}};_0x4f62d2(++_0x353894);}(_0xa28c,0x134));var _0xca28=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xa28c[_0x1d9aa0];return _0x226868;};'use strict';var jayson=require(_0xca28('0x0'));var BPromise=require(_0xca28('0x1'));var _=require(_0xca28('0x2'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x2b411b,_0x688bb2){var _0x9f2dba={};_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x4')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x5')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/voiceQueue/voiceQueue.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x6')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x7')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x8')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x9')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0xa')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0xb')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0xc')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0xd')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0xe')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0xf')));_0x9f2dba=_['merge'](_0x9f2dba,require('../api/mailAccount/mailAccount.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/mailQueue/mailQueue.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x10')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x11')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x12')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x13')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x14')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x15')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x16')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x17')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x18')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x19')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x1a')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x1b')));_0x9f2dba=_['merge'](_0x9f2dba,require('../api/smsMessage/smsMessage.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/smsQueue/smsQueue.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x1c')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x1d')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x1e')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x1f')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x20')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x21')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/chatMessage/chatMessage.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x22')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/cmContact/cmContact.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x23')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x24')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x25')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x26')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x27')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x28')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x29')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x2a')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x2b')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x2c')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x2d')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x2e')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x2f')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x30')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x31')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x32')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x33')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x34')));_0x9f2dba=_['merge'](_0x9f2dba,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x35')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x36')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x37')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x38')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x39')));_0x9f2dba=_['merge'](_0x9f2dba,require('../api/squareProject/squareProject.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x3a')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/squareMessage/squareMessage.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x3b')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x3c')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require(_0xca28('0x3d')));_0x9f2dba=_['merge'](_0x9f2dba,require(_0xca28('0x3e')));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x9f2dba=_['merge'](_0x9f2dba,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x9f2dba=_[_0xca28('0x3')](_0x9f2dba,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x179b19=jayson[_0xca28('0x3f')](_0x9f2dba)['http']();var _0x3669ed=config[_0xca28('0x40')][_0xca28('0x41')]||config[_0xca28('0x41')]+0x1;var _0x4680f5=config[_0xca28('0x40')]['ip']||_0xca28('0x42');_0x179b19['on'](_0xca28('0x43'),function(_0x18d8a6){return _0x688bb2(_0x18d8a6);});_0x179b19['listen'](_0x3669ed,_0x4680f5,function(){console['log'](_0xca28('0x44'),_0x4680f5,_0x3669ed);require(_0xca28('0x45'))[_0xca28('0x46')]();return _0x2b411b('RPC\x20listening\x20on\x20'+_0x4680f5+':'+_0x3669ed);});});}; \ No newline at end of file +var _0x54f4=['../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc'];(function(_0x4c3f4f,_0x17a3e6){var _0x33237d=function(_0x413aa7){while(--_0x413aa7){_0x4c3f4f['push'](_0x4c3f4f['shift']());}};_0x33237d(++_0x17a3e6);}(_0x54f4,0x113));var _0x454f=function(_0x2b3102,_0x28ec26){_0x2b3102=_0x2b3102-0x0;var _0x301cda=_0x54f4[_0x2b3102];return _0x301cda;};'use strict';var jayson=require(_0x454f('0x0'));var BPromise=require(_0x454f('0x1'));var _=require(_0x454f('0x2'));var config=require(_0x454f('0x3'));exports[_0x454f('0x4')]=function(){return new BPromise(function(_0xf5114b,_0x28da91){var _0x219245={};_0x219245=_['merge'](_0x219245,require('../api/user/user.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x6')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x7')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x8')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x9')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0xa')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0xb')));_0x219245=_['merge'](_0x219245,require(_0x454f('0xc')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/trunk/trunk.rpc'));_0x219245=_['merge'](_0x219245,require(_0x454f('0xd')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0xe')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0xf')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/mailAccount/mailAccount.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/mailQueue/mailQueue.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x10')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/mailMessage/mailMessage.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x11')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x12')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/faxApplication/faxApplication.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x13')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x14')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x15')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x16')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x17')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x18')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x19')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/smsQueue/smsQueue.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x1a')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x1b')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x1c')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x1d')));_0x219245=_['merge'](_0x219245,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/chatInteraction/chatInteraction.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/chatMessage/chatMessage.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x1e')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x1f')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x20')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x21')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x22')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x23')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x24')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/interval/interval.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x25')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x26')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x27')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x28')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x29')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2a')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2b')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2c')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2d')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2e')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x2f')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x30')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x31')));_0x219245=_['merge'](_0x219245,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x32')));_0x219245=_['merge'](_0x219245,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x33')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x34')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x35')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x36')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x37')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x38')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x39')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/campaign/campaign.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/attachment/attachment.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x3a')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x3b')));_0x219245=_['merge'](_0x219245,require(_0x454f('0x3c')));_0x219245=_[_0x454f('0x5')](_0x219245,require(_0x454f('0x3d')));_0x219245=_[_0x454f('0x5')](_0x219245,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0xa5ff62=jayson[_0x454f('0x3e')](_0x219245)[_0x454f('0x3f')]();var _0x297587=config[_0x454f('0x40')][_0x454f('0x41')]||config[_0x454f('0x41')]+0x1;var _0x21bd4d=config['rpc']['ip']||_0x454f('0x42');_0xa5ff62['on'](_0x454f('0x43'),function(_0x5750c6){return _0x28da91(_0x5750c6);});_0xa5ff62['listen'](_0x297587,_0x21bd4d,function(){console[_0x454f('0x44')](_0x454f('0x45'),_0x21bd4d,_0x297587);require(_0x454f('0x46'))['default']();return _0xf5114b('RPC\x20listening\x20on\x20'+_0x21bd4d+':'+_0x297587);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 215377d..8057715 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 _0xdcd8=['result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','sendRequest','command','prototype','ANSWER','getData','beep','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setPriority','SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile','agi','exec','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function'];(function(_0x1da80f,_0x59f7c8){var _0x382ff6=function(_0x469595){while(--_0x469595){_0x1da80f['push'](_0x1da80f['shift']());}};_0x382ff6(++_0x59f7c8);}(_0xdcd8,0x122));var _0x8dcd=function(_0x25446b,_0x5d05aa){_0x25446b=_0x25446b-0x0;var _0x11409e=_0xdcd8[_0x25446b];return _0x11409e;};'use strict';var util=require(_0x8dcd('0x0'));var _=require(_0x8dcd('0x1'));var EventEmitter=require(_0x8dcd('0x2'))[_0x8dcd('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x8dcd('0x4'));function AGIChannel(_0xc816d5){var _0x1f1b5d=this,_0x56a15b=new AGIReply(),_0x3f95d9=![],_0x1c225a={};EventEmitter[_0x8dcd('0x5')](_0x1f1b5d);_0xc816d5[_0x8dcd('0x6')](_0x8dcd('0x7'));_0xc816d5[_0x8dcd('0x8')](0x8*0x3c*0x3c*0x3e8);_0x56a15b[_0x8dcd('0x6')](_0x8dcd('0x7'));_0x56a15b['on'](_0x8dcd('0x9'),function(_0x4ed1d3){for(var _0x302851 in _0x4ed1d3){_0x1f1b5d[_0x302851]=_0x4ed1d3[_0x302851];}_0x1f1b5d[_0x8dcd('0xa')](_0x8dcd('0xb'));});_0x56a15b['on']('line',function(_0x392535){if(_0x392535[_0x8dcd('0xc')]()=='hangup'){_0x1f1b5d[_0x8dcd('0xa')]('hangup');return;}if(_0x392535[_0x8dcd('0xd')](0x0,0xb)==_0x8dcd('0xe')){_0x3f95d9=!![];}if(_0x3f95d9){_0x1c225a['rx']+=_0x392535+'\x0a';if(_0x392535[_0x8dcd('0xf')](_0x8dcd('0x10'))!=-0x1){_0x3f95d9=![];}}else{_0x1c225a['rx']=_0x392535;}if(_0x3f95d9){return;}if(typeof _0x1c225a['cb']==_0x8dcd('0x11')){var _0x20a74a=_0x1c225a['rx'][_0x8dcd('0xd')](0x0,0x3),_0x57d594=null,_0x3cde12=null;_0x20a74a=parseInt(_0x20a74a);if(isNaN(_0x20a74a)){_0x1c225a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x20a74a!=0xc8){_0x1c225a['cb'](null,{'code':_0x20a74a,'result':-0x1,'extra':'KO'});return;}_0x57d594=_0x1c225a['rx'][_0x8dcd('0xd')](0x4)['replace'](_0x8dcd('0x12'),'');if(_0x57d594[_0x8dcd('0x13')]('\x20')!=-0x1){_0x57d594=_0x57d594['substr'](0x0,_0x57d594[_0x8dcd('0x13')]('\x20'));}if(_[_0x8dcd('0x14')](_0x57d594,'-1')){_0x57d594=parseInt(_0x57d594);}_0x3cde12=_0x1c225a['rx'][_0x8dcd('0x15')]('\x20');if(_0x3cde12[_0x8dcd('0x16')]==0x3){_0x3cde12=_0x3cde12[0x2]['substring'](0x1,_0x3cde12[0x2][_0x8dcd('0x16')]-0x1);}else if(_0x3cde12[_0x8dcd('0x16')]>0x3){var _0x4ab5ac=/\((.+)\)/;var _0x48b90f=_0x1c225a['rx'][_0x8dcd('0x17')](_0x4ab5ac);if(_0x48b90f){_0x3cde12=_0x48b90f[0x1];}else{_0x3cde12=null;}}else{_0x3cde12=null;}_0x1c225a['cb'](null,{'code':_0x20a74a,'result':_0x57d594,'extra':_0x3cde12});}});_0xc816d5['on'](_0x8dcd('0x18'),function(_0x57c767){_0x1f1b5d[_0x8dcd('0xa')](_0x8dcd('0x18'),new AGIError(_0x8dcd('0x19'),_0x57c767[_0x8dcd('0x1a')]));});_0xc816d5['on']('close',function(){_0x1f1b5d['emit'](_0x8dcd('0x1b'),new AGIError(_0x8dcd('0x1c')));});_0xc816d5['on'](_0x8dcd('0x1d'),function(){_0x1f1b5d['emit'](_0x8dcd('0x1d'),new AGIError(_0x8dcd('0x1e')));_0xc816d5[_0x8dcd('0x1f')]();});_0xc816d5[_0x8dcd('0x20')](_0x56a15b);this['command']=function(_0x10c664,_0x3d6b07){var _0x10c664=_0x10c664||'',_0x3d6b07=typeof _0x3d6b07==_0x8dcd('0x11')?_0x3d6b07:new Function();_0x1c225a={'tx':_0x10c664,'rx':'','cb':_0x3d6b07};_0xc816d5[_0x8dcd('0x21')](_0x10c664+'\x0a');},this[_0x8dcd('0x1b')]=function(){_0xc816d5[_0x8dcd('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x8dcd('0x22')]=function(_0x1baa36){return this[_0x8dcd('0x23')]['sync'](this,_0x1baa36);};AGIChannel[_0x8dcd('0x24')]['answer']=function(){return this[_0x8dcd('0x22')](_0x8dcd('0x25'));};AGIChannel['prototype'][_0x8dcd('0x26')]=function(_0x2f7a75,_0x291f06,_0x1de72f){_0x2f7a75=_0x2f7a75===undefined?_0x8dcd('0x27'):_0x2f7a75;_0x291f06=_0x291f06===undefined?'5':_0x291f06;_0x1de72f=_0x1de72f===undefined?'1':_0x1de72f;return this[_0x8dcd('0x22')](util[_0x8dcd('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2f7a75,_0x291f06*0x3e8,_0x1de72f));};AGIChannel['prototype']['noop']=function(_0x36e89b){_0x36e89b=_0x36e89b||_0x8dcd('0x29');return this[_0x8dcd('0x22')](util[_0x8dcd('0x28')](_0x8dcd('0x2a'),_0x36e89b));};AGIChannel[_0x8dcd('0x24')]['exec']=function(_0x1266a7,_0x3e2bb7){if(_[_0x8dcd('0x2b')](_0x3e2bb7)){return this['sendRequest'](util['format'](_0x8dcd('0x2c'),_0x1266a7,_0x3e2bb7[_0x8dcd('0x2d')](',')));}return this[_0x8dcd('0x22')](util[_0x8dcd('0x28')](_0x8dcd('0x2c'),_0x1266a7,_0x3e2bb7));};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x2e')]=function(_0x1c3991){return this[_0x8dcd('0x22')](util['format'](_0x8dcd('0x2f'),_0x1c3991));};AGIChannel[_0x8dcd('0x24')]['setExtension']=function(_0x18402a){return this[_0x8dcd('0x22')](util['format']('SET\x20EXTENSION\x20%s',_0x18402a));};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x30')]=function(_0x38eef8){return this[_0x8dcd('0x22')](util[_0x8dcd('0x28')](_0x8dcd('0x31'),_0x38eef8));};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x32')]=function(){return this[_0x8dcd('0x22')](_0x8dcd('0x33'));};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x34')]=function(_0x5d3a41,_0x531add){var _0x5af0ed=_['isBoolean'](_0x531add)||_[_0x8dcd('0x35')](_0x531add)?_0x531add[_0x8dcd('0x36')]():_0x531add;return this[_0x8dcd('0x22')](util[_0x8dcd('0x28')](_0x8dcd('0x37'),_0x5d3a41,_0x5af0ed?_0x5af0ed['toString']()[_0x8dcd('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x8dcd('0x24')]['sayNumber']=function(_0x31868a,_0x3485e0){return this[_0x8dcd('0x22')](util['format'](_0x8dcd('0x39'),_0x31868a,_0x3485e0));};AGIChannel['prototype'][_0x8dcd('0x3a')]=function(_0x2a1232,_0x289f99){return this[_0x8dcd('0x22')](util['format'](_0x8dcd('0x3b'),_0x2a1232,_0x289f99));};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x3c')]=function(_0x56e5a1,_0x4f194b){return this[_0x8dcd('0x22')](util[_0x8dcd('0x28')](_0x8dcd('0x3d'),_0x56e5a1,_0x4f194b));};AGIChannel[_0x8dcd('0x24')]['continueAt']=function(_0x45feea,_0x1ccc3b,_0x53de45){_0x1ccc3b=_0x1ccc3b||this[_0x8dcd('0x3e')];_0x53de45=_0x53de45||0x1;this[_0x8dcd('0x2e')](_0x45feea);this[_0x8dcd('0x3f')](_0x1ccc3b);this[_0x8dcd('0x30')](_0x53de45);return this[_0x8dcd('0x40')](util[_0x8dcd('0x28')](_0x8dcd('0x41'),_0x45feea,_0x1ccc3b,_0x53de45));};AGIChannel['prototype'][_0x8dcd('0x42')]=function(_0x372a8a){return this[_0x8dcd('0x22')](util[_0x8dcd('0x28')](_0x8dcd('0x43'),_0x372a8a));};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x44')]=function(_0x55f95e,_0x16f7cb,_0x58f541,_0x30cdc7,_0x4f2f41,_0x48341b){_0x16f7cb=_0x16f7cb||_0x8dcd('0x45');_0x58f541=_0x58f541||'';_0x30cdc7=_0x30cdc7===undefined?-0x1:_0x30cdc7==='-1'?-0x1:_0x30cdc7*0x3e8;_0x4f2f41=_0x4f2f41===undefined?'':'s='+_0x4f2f41;_0x48341b=_0x48341b?'BEEP':'';return this[_0x8dcd('0x22')](util[_0x8dcd('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x55f95e,_0x16f7cb,_0x58f541,_0x30cdc7,_0x48341b,_0x4f2f41));};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x46')]=function(_0x218f82,_0x1e6093){_0x1e6093=_0x1e6093||'';return this[_0x8dcd('0x22')](util[_0x8dcd('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x218f82,_0x1e6093));};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x47')]=function(_0x7d57a6){return this[_0x8dcd('0x48')]('AGI',_0x7d57a6);};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x49')]=function(_0x22c8bd){return this[_0x8dcd('0x48')]('WAIT',_0x22c8bd);};AGIChannel[_0x8dcd('0x24')][_0x8dcd('0x18')]=function(_0x3151d6,_0x2cbce7){this[_0x8dcd('0x40')](util[_0x8dcd('0x28')](_0x8dcd('0x4a'),_0x3151d6['id'],_0x3151d6[_0x8dcd('0x4b')],_0x2cbce7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x8dcd('0x4c')]=AGIChannel; \ No newline at end of file +var _0xa24d=['utf8','setTimeout','emit','ready','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','function','substring','no\x20code','result=','substr','indexOf','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','answer','ANSWER','getData','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','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','exec','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call'];(function(_0x50e7b2,_0x436c0b){var _0x24a67b=function(_0x493580){while(--_0x493580){_0x50e7b2['push'](_0x50e7b2['shift']());}};_0x24a67b(++_0x436c0b);}(_0xa24d,0x1c1));var _0xda24=function(_0x25f9dc,_0x36c8e1){_0x25f9dc=_0x25f9dc-0x0;var _0x4213ec=_0xa24d[_0x25f9dc];return _0x4213ec;};'use strict';var util=require(_0xda24('0x0'));var _=require(_0xda24('0x1'));var EventEmitter=require(_0xda24('0x2'))[_0xda24('0x3')];var AGIReply=require(_0xda24('0x4'));var AGIError=require(_0xda24('0x5'));function AGIChannel(_0x2da518){var _0x501b16=this,_0xcc2450=new AGIReply(),_0x2e6e4f=![],_0x24a908={};EventEmitter[_0xda24('0x6')](_0x501b16);_0x2da518['setEncoding'](_0xda24('0x7'));_0x2da518[_0xda24('0x8')](0x8*0x3c*0x3c*0x3e8);_0xcc2450['setEncoding'](_0xda24('0x7'));_0xcc2450['on']('headers',function(_0x446e2e){for(var _0x4f5d7e in _0x446e2e){_0x501b16[_0x4f5d7e]=_0x446e2e[_0x4f5d7e];}_0x501b16[_0xda24('0x9')](_0xda24('0xa'));});_0xcc2450['on']('line',function(_0x243fc8){if(_0x243fc8[_0xda24('0xb')]()==_0xda24('0xc')){_0x501b16[_0xda24('0x9')](_0xda24('0xc'));return;}if(_0x243fc8['substring'](0x0,0xb)==_0xda24('0xd')){_0x2e6e4f=!![];}if(_0x2e6e4f){_0x24a908['rx']+=_0x243fc8+'\x0a';if(_0x243fc8['search'](_0xda24('0xe'))!=-0x1){_0x2e6e4f=![];}}else{_0x24a908['rx']=_0x243fc8;}if(_0x2e6e4f){return;}if(typeof _0x24a908['cb']==_0xda24('0xf')){var _0x519fb9=_0x24a908['rx'][_0xda24('0x10')](0x0,0x3),_0x54b23d=null,_0x2e3505=null;_0x519fb9=parseInt(_0x519fb9);if(isNaN(_0x519fb9)){_0x24a908['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xda24('0x11')});return;}if(_0x519fb9!=0xc8){_0x24a908['cb'](null,{'code':_0x519fb9,'result':-0x1,'extra':'KO'});return;}_0x54b23d=_0x24a908['rx'][_0xda24('0x10')](0x4)['replace'](_0xda24('0x12'),'');if(_0x54b23d['indexOf']('\x20')!=-0x1){_0x54b23d=_0x54b23d[_0xda24('0x13')](0x0,_0x54b23d[_0xda24('0x14')]('\x20'));}if(_['startsWith'](_0x54b23d,'-1')){_0x54b23d=parseInt(_0x54b23d);}_0x2e3505=_0x24a908['rx']['split']('\x20');if(_0x2e3505[_0xda24('0x15')]==0x3){_0x2e3505=_0x2e3505[0x2][_0xda24('0x10')](0x1,_0x2e3505[0x2][_0xda24('0x15')]-0x1);}else if(_0x2e3505[_0xda24('0x15')]>0x3){var _0x3348e0=/\((.+)\)/;var _0x2754f2=_0x24a908['rx'][_0xda24('0x16')](_0x3348e0);if(_0x2754f2){_0x2e3505=_0x2754f2[0x1];}else{_0x2e3505=null;}}else{_0x2e3505=null;}_0x24a908['cb'](null,{'code':_0x519fb9,'result':_0x54b23d,'extra':_0x2e3505});}});_0x2da518['on'](_0xda24('0x17'),function(_0x847878){_0x501b16['emit'](_0xda24('0x17'),new AGIError(_0xda24('0x18'),_0x847878['code']));});_0x2da518['on'](_0xda24('0x19'),function(){_0x501b16['emit']('close',new AGIError(_0xda24('0x1a')));});_0x2da518['on'](_0xda24('0x1b'),function(){_0x501b16[_0xda24('0x9')](_0xda24('0x1b'),new AGIError(_0xda24('0x1c')));_0x2da518[_0xda24('0x1d')]();});_0x2da518[_0xda24('0x1e')](_0xcc2450);this['command']=function(_0xf36f2a,_0x5f53a3){var _0xf36f2a=_0xf36f2a||'',_0x5f53a3=typeof _0x5f53a3==_0xda24('0xf')?_0x5f53a3:new Function();_0x24a908={'tx':_0xf36f2a,'rx':'','cb':_0x5f53a3};_0x2da518[_0xda24('0x1f')](_0xf36f2a+'\x0a');},this[_0xda24('0x19')]=function(){_0x2da518[_0xda24('0x1d')]();};}util[_0xda24('0x20')](AGIChannel,EventEmitter);AGIChannel[_0xda24('0x21')][_0xda24('0x22')]=function(_0x134753){return this[_0xda24('0x23')][_0xda24('0x24')](this,_0x134753);};AGIChannel['prototype'][_0xda24('0x25')]=function(){return this[_0xda24('0x22')](_0xda24('0x26'));};AGIChannel[_0xda24('0x21')][_0xda24('0x27')]=function(_0x3f666b,_0x5bf414,_0x207c5d){_0x3f666b=_0x3f666b===undefined?'beep':_0x3f666b;_0x5bf414=_0x5bf414===undefined?'5':_0x5bf414;_0x207c5d=_0x207c5d===undefined?'1':_0x207c5d;return this[_0xda24('0x22')](util[_0xda24('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3f666b,_0x5bf414*0x3e8,_0x207c5d));};AGIChannel[_0xda24('0x21')][_0xda24('0x29')]=function(_0x49a311){_0x49a311=_0x49a311||_0xda24('0x2a');return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x2b'),_0x49a311));};AGIChannel[_0xda24('0x21')]['exec']=function(_0x5e6fe6,_0x20f60d){if(_['isArray'](_0x20f60d)){return this['sendRequest'](util[_0xda24('0x28')](_0xda24('0x2c'),_0x5e6fe6,_0x20f60d['join'](',')));}return this['sendRequest'](util[_0xda24('0x28')](_0xda24('0x2c'),_0x5e6fe6,_0x20f60d));};AGIChannel['prototype']['setContext']=function(_0x3bc177){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x2d'),_0x3bc177));};AGIChannel[_0xda24('0x21')]['setExtension']=function(_0x136e27){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x2e'),_0x136e27));};AGIChannel['prototype'][_0xda24('0x2f')]=function(_0x567568){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x30'),_0x567568));};AGIChannel[_0xda24('0x21')][_0xda24('0xc')]=function(){return this['sendRequest'](_0xda24('0x31'));};AGIChannel[_0xda24('0x21')][_0xda24('0x32')]=function(_0x226be6,_0x3e3e81){var _0x50523a=_[_0xda24('0x33')](_0x3e3e81)||_[_0xda24('0x34')](_0x3e3e81)?_0x3e3e81['toString']():_0x3e3e81;return this['sendRequest'](util['format'](_0xda24('0x35'),_0x226be6,_0x50523a?_0x50523a[_0xda24('0x36')]()[_0xda24('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xda24('0x21')][_0xda24('0x38')]=function(_0xb4f489,_0x568e39){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x39'),_0xb4f489,_0x568e39));};AGIChannel['prototype'][_0xda24('0x3a')]=function(_0x4b4d84,_0x25d0cd){return this['sendRequest'](util[_0xda24('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x4b4d84,_0x25d0cd));};AGIChannel[_0xda24('0x21')]['sayPhonetic']=function(_0x5e81e8,_0x10320b){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x3b'),_0x5e81e8,_0x10320b));};AGIChannel[_0xda24('0x21')][_0xda24('0x3c')]=function(_0x4269a9,_0x4a8610,_0x1dd63){_0x4a8610=_0x4a8610||this[_0xda24('0x3d')];_0x1dd63=_0x1dd63||0x1;this[_0xda24('0x3e')](_0x4269a9);this[_0xda24('0x3f')](_0x4a8610);this[_0xda24('0x2f')](_0x1dd63);return this[_0xda24('0x29')](util[_0xda24('0x28')](_0xda24('0x40'),_0x4269a9,_0x4a8610,_0x1dd63));};AGIChannel[_0xda24('0x21')][_0xda24('0x41')]=function(_0x4aea76){return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x42'),_0x4aea76));};AGIChannel[_0xda24('0x21')]['recordFile']=function(_0x2b462b,_0x46756c,_0x5ceb8c,_0x57a1a9,_0x48dd5e,_0x5470e8){_0x46756c=_0x46756c||'wav';_0x5ceb8c=_0x5ceb8c||'';_0x57a1a9=_0x57a1a9===undefined?-0x1:_0x57a1a9==='-1'?-0x1:_0x57a1a9*0x3e8;_0x48dd5e=_0x48dd5e===undefined?'':'s='+_0x48dd5e;_0x5470e8=_0x5470e8?'BEEP':'';return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x43'),_0x2b462b,_0x46756c,_0x5ceb8c,_0x57a1a9,_0x5470e8,_0x48dd5e));};AGIChannel[_0xda24('0x21')][_0xda24('0x44')]=function(_0x4962d4,_0xf7b3b3){_0xf7b3b3=_0xf7b3b3||'';return this[_0xda24('0x22')](util[_0xda24('0x28')](_0xda24('0x45'),_0x4962d4,_0xf7b3b3));};AGIChannel['prototype'][_0xda24('0x46')]=function(_0x2dd5c5){return this[_0xda24('0x47')](_0xda24('0x48'),_0x2dd5c5);};AGIChannel[_0xda24('0x21')]['wait']=function(_0x4c12bc){return this[_0xda24('0x47')](_0xda24('0x49'),_0x4c12bc);};AGIChannel[_0xda24('0x21')][_0xda24('0x17')]=function(_0x14a399,_0x37a834){this[_0xda24('0x29')](util['format'](_0xda24('0x4a'),_0x14a399['id'],_0x14a399[_0xda24('0x4b')],_0x37a834));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4eaf3cb..bea84ea 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 _0xfbff=['Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','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.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x3b58c9,_0x1f46c3){var _0x5b653a=function(_0xecac3b){while(--_0xecac3b){_0x3b58c9['push'](_0x3b58c9['shift']());}};_0x5b653a(++_0x1f46c3);}(_0xfbff,0x12b));var _0xffbf=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xfbff[_0x58dc25];return _0x21b0a7;};'use strict';var util=require(_0xffbf('0x0'));var error={'E_AGI_UNDEFINED':_0xffbf('0x1'),'E_AGI_ARGUMENT_PORT':_0xffbf('0x2'),'E_AGI_SERVER_ERROR':_0xffbf('0x3'),'E_AGI_SERVER_CLOSE':_0xffbf('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xffbf('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xffbf('0x6'),'E_AGI_SOCKET_ERROR':_0xffbf('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xffbf('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xffbf('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x30f26e){var _0x30f26e=_0x30f26e||null,_0x527f04=_0x527f04||[],_0x3da1d5=0x1,_0x4b9ed9='';if(!error[_0x30f26e]){_0x30f26e=_0xffbf('0xa');}_0x527f04[_0xffbf('0xb')](error[_0x30f26e]);while(arguments[_0x3da1d5]){_0x527f04[_0xffbf('0xb')](arguments[_0x3da1d5]);_0x3da1d5++;}_0x4b9ed9=util[_0xffbf('0xc')][_0xffbf('0xd')](util,_0x527f04);this[_0xffbf('0xe')]=_0x4b9ed9;this[_0xffbf('0xf')]=_0x30f26e;}module[_0xffbf('0x10')]=AGIError; \ No newline at end of file +var _0xd185=['exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x25fa9e,_0x3d1094){var _0x1a2e2c=function(_0x3d103a){while(--_0x3d103a){_0x25fa9e['push'](_0x25fa9e['shift']());}};_0x1a2e2c(++_0x3d1094);}(_0xd185,0x10b));var _0x5d18=function(_0x1cb9b0,_0x2a09c2){_0x1cb9b0=_0x1cb9b0-0x0;var _0x5e2c4c=_0xd185[_0x1cb9b0];return _0x5e2c4c;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x5d18('0x0'),'E_AGI_SERVER_ERROR':_0x5d18('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x5d18('0x2'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x5d18('0x3'),'E_AGI_SOCKET_CLOSE':_0x5d18('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x5d18('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5d18('0x6'),'E_AGI_IVR_ENTRY':_0x5d18('0x7')};function AGIError(_0xde95d5){var _0xde95d5=_0xde95d5||null,_0x3c3231=_0x3c3231||[],_0x5a3cdd=0x1,_0x4e6ae1='';if(!error[_0xde95d5]){_0xde95d5=_0x5d18('0x8');}_0x3c3231[_0x5d18('0x9')](error[_0xde95d5]);while(arguments[_0x5a3cdd]){_0x3c3231['push'](arguments[_0x5a3cdd]);_0x5a3cdd++;}_0x4e6ae1=util[_0x5d18('0xa')][_0x5d18('0xb')](util,_0x3c3231);this[_0x5d18('0xc')]=_0x4e6ae1;this['name']=_0xde95d5;}module[_0x5d18('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 77278bc..5406614 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 _0xbd4b=['agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','push','size','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger'];(function(_0x45006c,_0x25fca6){var _0x4494ce=function(_0x2fc844){while(--_0x2fc844){_0x45006c['push'](_0x45006c['shift']());}};_0x4494ce(++_0x25fca6);}(_0xbd4b,0x153));var _0xbbd4=function(_0x3e5e25,_0x1c47d3){_0x3e5e25=_0x3e5e25-0x0;var _0x20b5fe=_0xbd4b[_0x3e5e25];return _0x20b5fe;};'use strict';var _=require(_0xbbd4('0x0'));var logger=require(_0xbbd4('0x1'))(_0xbbd4('0x2'));var verticesWithRetry=[_0xbbd4('0x3'),_0xbbd4('0x4'),_0xbbd4('0x5')];var Graph=function(){this['vertices']={};this[_0xbbd4('0x6')]={};this[_0xbbd4('0x7')]=0x0;};Graph[_0xbbd4('0x8')][_0xbbd4('0x9')]=function(_0x3ed4a1){this[_0xbbd4('0xa')][_0x3ed4a1['id']]=_0x3ed4a1;this[_0xbbd4('0x6')][_0x3ed4a1['id']]=[];};Graph[_0xbbd4('0x8')][_0xbbd4('0xb')]=function(_0xe5d656,_0x3908c2,_0xbae5ce){this[_0xbbd4('0x6')][_0xe5d656][_0xbbd4('0xc')]({'target':_0x3908c2,'condition':_0xbae5ce});this[_0xbbd4('0x7')]+=0x1;};Graph[_0xbbd4('0x8')][_0xbbd4('0xd')]=function(){return _[_0xbbd4('0xd')](this[_0xbbd4('0xa')]);};Graph[_0xbbd4('0x8')]['relations']=function(){return this[_0xbbd4('0x7')];};Graph[_0xbbd4('0x8')]['getVertex']=function(_0x204df1){return this[_0xbbd4('0xa')][_0x204df1];};Graph[_0xbbd4('0x8')][_0xbbd4('0xe')]=function(_0x387ae7,_0x552791){if(!this[_0xbbd4('0xa')][_0x387ae7]){return logger[_0xbbd4('0xf')](_0xbbd4('0x10'));}var _0x29c64f=_0x552791(this[_0xbbd4('0xa')][_0x387ae7]);if(!_0x29c64f){return logger[_0xbbd4('0xf')](_0xbbd4('0x11'));}if(this['edges'][_0x387ae7][_0xbbd4('0x12')]===0x0){return logger['info'](_0xbbd4('0x13'));}for(var _0x2d847e=0x0,_0x5accf2=[],_0x49741b=![];_0x2d847e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','connection','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','defaults','127.0.0.1','nextTick','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','name','message','error','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','info','arg_1','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','createSquareReport','catch','agi_','inspect','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x303cd3,_0x40a651){var _0x34bbf5=function(_0x230118){while(--_0x230118){_0x303cd3['push'](_0x303cd3['shift']());}};_0x34bbf5(++_0x40a651);}(_0x667d,0x1cc));var _0xd667=function(_0x389ee2,_0xd5d037){_0x389ee2=_0x389ee2-0x0;var _0x5b42a3=_0x667d[_0x389ee2];return _0x5b42a3;};'use strict';var parser=require('xml2json');var _=require(_0xd667('0x0'));var syncho=require(_0xd667('0x1'));var util=require(_0xd667('0x2'));var moment=require('moment');var config=require('../../config/environment');var logger=require(_0xd667('0x3'))(_0xd667('0x4'));var utilLicense=require(_0xd667('0x5'));var rpc=require(_0xd667('0x6'));var mailRpc=require(_0xd667('0x7'));var Graph=require(_0xd667('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xd667('0x4')]=_[_0xd667('0x9')](config[_0xd667('0x4')],{'ip':_0xd667('0xa'),'port':0x11dd});function connectionHandler(_0x7ef554){process[_0xd667('0xb')](function(){syncho(function(){try{setChannelVariables(_0x7ef554);agiHandler(_0x7ef554);}catch(_0x1dcc3d){logger['error'](_0x1dcc3d['stack']);}});});}function listeningHandler(){console['log'](_0xd667('0xc'),config[_0xd667('0x4')][_0xd667('0xd')]);logger['info'](util[_0xd667('0xe')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config['agi'][_0xd667('0xd')]));}function errorHandler(_0xc4b8bc){if(_0xc4b8bc&&_0xc4b8bc[_0xd667('0xf')]&&_0xc4b8bc[_0xd667('0x10')]){logger[_0xd667('0x11')](util[_0xd667('0xe')]('[%s]\x20%s',_0xc4b8bc[_0xd667('0xf')],_0xc4b8bc[_0xd667('0x10')]));}else{logger[_0xd667('0x11')](util[_0xd667('0xe')](_0xd667('0x12'),_0xc4b8bc[_0xd667('0x13')]));}}function closeHandler(){logger['info'](util[_0xd667('0xe')](_0xd667('0x14'),this['arg_1'],this['calleridname'],this['callerid'],this[_0xd667('0x15')],this[_0xd667('0x16')]));try{createSquareReport(this);}catch(_0x3b5517){logger['error'](_0x3b5517[_0xd667('0x13')]);}}function timeoutHandler(){logger[_0xd667('0x17')](util[_0xd667('0xe')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd667('0x18')],this[_0xd667('0x19')],this['callerid'],this['dnid'],this[_0xd667('0x16')]));}function hangupHandler(){logger['info'](util[_0xd667('0xe')](_0xd667('0x1a'),this[_0xd667('0x18')],this['calleridname'],this[_0xd667('0x1b')],this['dnid'],this[_0xd667('0x16')]));this[_0xd667('0x1c')]=!![];}function getRoot(_0x46293b){return parser[_0xd667('0x1d')](_0x46293b,{'object':!![]})[_0xd667('0x1e')][_0xd667('0x1f')];}function addVertex(_0x5b4fa8,_0x5b9d45,_0x360f55){_0x5b9d45[_0xd667('0x20')]=_0x360f55;if(_0x5b9d45[_0xd667('0x21')]('retry')){_0x5b9d45[_0xd667('0x22')]=parseInt(_0x5b9d45[_0xd667('0x23')],0xa);}_0x5b4fa8[_0xd667('0x24')](_[_0xd667('0x25')](_0x5b9d45,_0xd667('0x26')));}function initGraph(_0x4c3e89,_0x245c0e){var _0x280ab6=new Graph();for(var _0x8baa07 in _0x4c3e89){if(_0x4c3e89[_0xd667('0x21')](_0x8baa07)){if(_[_0xd667('0x27')](_0x4c3e89[_0x8baa07])){for(var _0x510285=0x0;_0x510285<_0x4c3e89[_0x8baa07][_0xd667('0x28')];_0x510285+=0x1){addVertex(_0x280ab6,_0x4c3e89[_0x8baa07][_0x510285],_0x8baa07);}}else{addVertex(_0x280ab6,_0x4c3e89[_0x8baa07],_0x8baa07);}}}for(var _0x5d7f5b=0x0;_0x5d7f5b<_0x245c0e['length'];_0x5d7f5b+=0x1){if(_0x245c0e[_0x5d7f5b][_0xd667('0x29')]&&_0x245c0e[_0x5d7f5b][_0xd667('0x2a')]){_0x280ab6[_0xd667('0x2b')](_0x245c0e[_0x5d7f5b][_0xd667('0x29')],_0x245c0e[_0x5d7f5b][_0xd667('0x2a')],_0x245c0e[_0x5d7f5b][_0xd667('0x2c')]);}}return _0x280ab6;}function getSquareProject(_0x8f5def,_0x56297c){rpc[_0xd667('0x2d')](_0x8f5def)[_0xd667('0x2e')](function(_0x543baf){_0x56297c(null,_0x543baf);})['catch'](function(_0x144dd6){_0x56297c(null,_0x144dd6);});}function createSquareReport(_0x2b8933,_0x1a7604){rpc[_0xd667('0x2f')](_0x2b8933)[_0xd667('0x2e')](function(_0x30afd6){if(_0x1a7604){_0x1a7604(null,_0x30afd6);}})[_0xd667('0x30')](function(_0x5ec09b){if(_0x1a7604){_0x1a7604(null,_0x5ec09b);}});}function setChannelVariables(_0x11ca04){for(var _0x94ebe2 in _0x11ca04){if(_0x11ca04[_0xd667('0x21')](_0x94ebe2)){if(_0x94ebe2['indexOf'](_0xd667('0x31'))===0x0){_0x11ca04[_0x94ebe2['substring'](0x4)]=_0x11ca04[_0x94ebe2];delete _0x11ca04[_0x94ebe2];}}}}function getLogFromObject(_0xf00fd3){return util[_0xd667('0x32')](_0xf00fd3,{'showHidden':![],'depth':null});}function agiHandler(_0x920b10){var _0x11a4d4,_0xeb782a,_0x4c5d3f,_0x4640d2,_0x3074b5;logger[_0xd667('0x33')](_0xd667('0x34'),JSON['stringify'](_0x920b10,null,0x2));logger['info'](util[_0xd667('0xe')](_0xd667('0x35'),_0x920b10[_0xd667('0x18')],_0x920b10['calleridname'],_0x920b10['callerid'],_0x920b10[_0xd667('0x15')],_0x920b10[_0xd667('0x16')]));_0x920b10['on'](_0xd667('0x11'),errorHandler);_0x920b10['on'](_0xd667('0x36'),closeHandler);_0x920b10['on'](_0xd667('0x37'),timeoutHandler);_0x920b10[_0xd667('0x1c')]=![];_0x920b10['on'](_0xd667('0x38'),hangupHandler);var _0x5a190b=getSquareProject['sync'](null,_0x920b10[_0xd667('0x18')]);if(_0x5a190b){if(_0x5a190b[_0xd667('0x39')]){_0x11a4d4=getRoot(_0x5a190b[_0xd667('0x39')]);if(_0x11a4d4&&_0x11a4d4[_0xd667('0x3a')]){logger['debug'](_0xd667('0x1f'),JSON[_0xd667('0x3b')](_0x11a4d4,null,0x2));_0x920b10[_0xd667('0x3c')]=moment()[_0xd667('0xe')](_0xd667('0x3d'));_0xeb782a=initGraph(_[_0xd667('0x25')](_0x11a4d4,_0xd667('0x26')),_0x11a4d4[_0xd667('0x26')]);_0x4c5d3f=new Vertices(_0x920b10,rpc,mailRpc);logger[_0xd667('0x17')](util[_0xd667('0xe')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x920b10['arg_1'],_0x920b10['calleridname'],_0x920b10['callerid'],_0x920b10[_0xd667('0x15')],_0x920b10['uniqueid']));_0xeb782a[_0xd667('0x3e')](_0x11a4d4[_0xd667('0x3a')]['id'],function(_0x362866){try{_0x362866=_0x4c5d3f[_0xd667('0x3f')](_0x362866);logger[_0xd667('0x33')]('vertex',JSON[_0xd667('0x3b')](_0x362866,null,0x2));if(_0x362866[_0xd667('0x20')]===_0xd667('0x40')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x920b10[_0xd667('0x41')]=_0x362866[_0xd667('0x41')]||_0x920b10[_0xd667('0x41')];_0x920b10[_0xd667('0x42')]=_0x362866[_0xd667('0x42')];_0x920b10['priority']=_0x362866[_0xd667('0x43')]?_0x362866[_0xd667('0x43')]-0x1:0x1;return null;}else if(_0x362866&&_0x4c5d3f[_0x362866[_0xd667('0x20')]]){_0x3074b5=_0x4c5d3f[_0x362866[_0xd667('0x20')]](_0x362866);logger['info']('response',JSON[_0xd667('0x3b')](_0x3074b5,null,0x2));if(_0x3074b5&&_0x3074b5[_0xd667('0x44')]===AGI_CODE_SUCCESS&&_0x3074b5['result']!==AGI_RESULT_ERROR&&!_0x920b10[_0xd667('0x1c')]){logger[_0xd667('0x33')](_0xd667('0x45'),getLogFromObject(_0x3074b5));return _[_0xd667('0x46')](_0x3074b5[_0xd667('0x47')])?null:_0x3074b5[_0xd667('0x47')][_0xd667('0x48')]();}else{logger[_0xd667('0x11')](_0xd667('0x45'),getLogFromObject(_0x3074b5));return null;}}else{logger[_0xd667('0x11')]('agicommand\x20not\x20found');return null;}}catch(_0xe06573){logger['error'](_0xe06573[_0xd667('0x13')]);return null;}});if(_0x11a4d4[_0xd667('0x49')]){logger['info'](util[_0xd667('0xe')](_0xd667('0x4a'),_0x920b10['arg_1'],_0x920b10[_0xd667('0x19')],_0x920b10[_0xd667('0x1b')],_0x920b10[_0xd667('0x15')],_0x920b10[_0xd667('0x16')]));_0xeb782a['traverseBFS'](_0x11a4d4['finally']['id'],function(_0x33c6c8){try{_0x33c6c8=_0x4c5d3f[_0xd667('0x3f')](_0x33c6c8);logger[_0xd667('0x33')](_0xd667('0x4b'),JSON['stringify'](_0x33c6c8,null,0x2));if(_0x33c6c8&&_0x4c5d3f[_0x33c6c8[_0xd667('0x20')]]){_0x3074b5=_0x4c5d3f[_0x33c6c8['agicommand']](_0x33c6c8);if(_0x3074b5){logger[_0xd667('0x33')](_0xd667('0x45'),getLogFromObject(_0x3074b5));return _[_0xd667('0x46')](_0x3074b5[_0xd667('0x47')])?null:_0x3074b5[_0xd667('0x47')][_0xd667('0x48')]();}else{logger['error'](_0xd667('0x45'),getLogFromObject(_0x3074b5));return null;}}else{logger['error'](_0xd667('0x4c'));return null;}}catch(_0x32a0fd){logger[_0xd667('0x11')](_0x32a0fd['stack']);return null;}});}logger[_0xd667('0x17')](util[_0xd667('0xe')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x920b10['arg_1'],_0x920b10[_0xd667('0x19')],_0x920b10[_0xd667('0x1b')],_0x920b10[_0xd667('0x15')],_0x920b10[_0xd667('0x16')]));logger[_0xd667('0x17')](util[_0xd667('0xe')](_0xd667('0x4d'),_0x920b10['context'],_0x920b10[_0xd667('0x42')],parseInt(_0x920b10['priority'],0xa)+0x1));_0x920b10['continueAt'](_0x920b10[_0xd667('0x41')],_0x920b10[_0xd667('0x42')],parseInt(_0x920b10['priority'],0xa)+0x1);_0x920b10[_0xd667('0x36')]();}}else{logger[_0xd667('0x11')](util[_0xd667('0xe')](_0xd667('0x4e'),_0x920b10[_0xd667('0x18')]));_0x920b10[_0xd667('0x4f')](_0x920b10[_0xd667('0x41')],_0x920b10[_0xd667('0x42')],parseInt(_0x920b10[_0xd667('0x43')],0xa)+0x1);_0x920b10[_0xd667('0x36')]();}}else{logger[_0xd667('0x11')](util['format']('Project\x20%s\x20not\x20found',_0x920b10[_0xd667('0x18')]));_0x920b10[_0xd667('0x4f')](_0x920b10['context'],_0x920b10[_0xd667('0x42')],parseInt(_0x920b10['priority'],0xa)+0x1);_0x920b10[_0xd667('0x36')]();}}function main(){var _0x4a4b6e;return utilLicense[_0xd667('0x50')]()['then'](function(_0x7114b3){if(_0x7114b3){if(_0x7114b3[_0xd667('0x51')]){if(_0x7114b3[_0xd667('0x52')]&&_0x7114b3[_0xd667('0x52')]>0x0){logger[_0xd667('0x17')](util['format'](_0xd667('0x53'),_0x7114b3[_0xd667('0x52')]));_0x4a4b6e=_0x7114b3[_0xd667('0x52')];}else{logger[_0xd667('0x17')](_0xd667('0x54'));}}else{logger[_0xd667('0x17')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4a4b6e=-0x1;}}})[_0xd667('0x30')](function(_0x46e27f){logger['error'](_0xd667('0x55'),_0x46e27f[_0xd667('0x13')]);})[_0xd667('0x49')](function(){var _0x5635fa=require('./server')(config[_0xd667('0x4')]['port'],config['agi']['ip'],_0x4a4b6e);_0x5635fa['on'](_0xd667('0x11'),errorHandler);_0x5635fa['on']('listening',listeningHandler);_0x5635fa['on'](_0xd667('0x56'),connectionHandler);_0x5635fa['on'](_0xd667('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x767d=['mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','mxCell','length','target','source','value','getSquareProject','then','catch','agi_','substring','inspect','debug','stringify','close','timeout','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','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','127.0.0.1','nextTick','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','error','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson'];(function(_0x3566c0,_0x264311){var _0x55edbb=function(_0xf50e1d){while(--_0xf50e1d){_0x3566c0['push'](_0x3566c0['shift']());}};_0x55edbb(++_0x264311);}(_0x767d,0x1f2));var _0xd767=function(_0x4cf482,_0x4417f0){_0x4cf482=_0x4cf482-0x0;var _0x394326=_0x767d[_0x4cf482];return _0x394326;};'use strict';var parser=require(_0xd767('0x0'));var _=require('lodash');var syncho=require(_0xd767('0x1'));var util=require(_0xd767('0x2'));var moment=require(_0xd767('0x3'));var config=require(_0xd767('0x4'));var logger=require(_0xd767('0x5'))(_0xd767('0x6'));var utilLicense=require(_0xd767('0x7'));var rpc=require(_0xd767('0x8'));var mailRpc=require(_0xd767('0x9'));var Graph=require(_0xd767('0xa'));var Vertices=require(_0xd767('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xd767('0x6')]=_['defaults'](config['agi'],{'ip':_0xd767('0xc'),'port':0x11dd});function connectionHandler(_0x9cc1ee){process[_0xd767('0xd')](function(){syncho(function(){try{setChannelVariables(_0x9cc1ee);agiHandler(_0x9cc1ee);}catch(_0x2d980d){logger['error'](_0x2d980d['stack']);}});});}function listeningHandler(){console[_0xd767('0xe')](_0xd767('0xf'),config[_0xd767('0x6')][_0xd767('0x10')]);logger[_0xd767('0x11')](util[_0xd767('0x12')](_0xd767('0x13'),config['agi']['ip'],config['agi'][_0xd767('0x10')]));}function errorHandler(_0x261f8d){if(_0x261f8d&&_0x261f8d[_0xd767('0x14')]&&_0x261f8d[_0xd767('0x15')]){logger['error'](util[_0xd767('0x12')](_0xd767('0x16'),_0x261f8d['name'],_0x261f8d[_0xd767('0x15')]));}else{logger[_0xd767('0x17')](util['format'](_0xd767('0x18'),_0x261f8d[_0xd767('0x19')]));}}function closeHandler(){logger['info'](util[_0xd767('0x12')](_0xd767('0x1a'),this['arg_1'],this[_0xd767('0x1b')],this[_0xd767('0x1c')],this[_0xd767('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x237972){logger[_0xd767('0x17')](_0x237972[_0xd767('0x19')]);}}function timeoutHandler(){logger[_0xd767('0x11')](util[_0xd767('0x12')](_0xd767('0x1e'),this[_0xd767('0x1f')],this[_0xd767('0x1b')],this[_0xd767('0x1c')],this[_0xd767('0x1d')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xd767('0x12')](_0xd767('0x20'),this[_0xd767('0x1f')],this['calleridname'],this[_0xd767('0x1c')],this[_0xd767('0x1d')],this[_0xd767('0x21')]));this[_0xd767('0x22')]=!![];}function getRoot(_0x34f0b0){return parser[_0xd767('0x23')](_0x34f0b0,{'object':!![]})[_0xd767('0x24')][_0xd767('0x25')];}function addVertex(_0x202cd1,_0xc24a9a,_0x47c0e3){_0xc24a9a[_0xd767('0x26')]=_0x47c0e3;if(_0xc24a9a[_0xd767('0x27')](_0xd767('0x28'))){_0xc24a9a['maxRetry']=parseInt(_0xc24a9a[_0xd767('0x28')],0xa);}_0x202cd1[_0xd767('0x29')](_['omit'](_0xc24a9a,_0xd767('0x2a')));}function initGraph(_0x2b2e7b,_0x14234e){var _0x5ce092=new Graph();for(var _0x52e14e in _0x2b2e7b){if(_0x2b2e7b[_0xd767('0x27')](_0x52e14e)){if(_['isArray'](_0x2b2e7b[_0x52e14e])){for(var _0x17a611=0x0;_0x17a611<_0x2b2e7b[_0x52e14e][_0xd767('0x2b')];_0x17a611+=0x1){addVertex(_0x5ce092,_0x2b2e7b[_0x52e14e][_0x17a611],_0x52e14e);}}else{addVertex(_0x5ce092,_0x2b2e7b[_0x52e14e],_0x52e14e);}}}for(var _0x3218b0=0x0;_0x3218b0<_0x14234e['length'];_0x3218b0+=0x1){if(_0x14234e[_0x3218b0]['source']&&_0x14234e[_0x3218b0][_0xd767('0x2c')]){_0x5ce092['addEdge'](_0x14234e[_0x3218b0][_0xd767('0x2d')],_0x14234e[_0x3218b0][_0xd767('0x2c')],_0x14234e[_0x3218b0][_0xd767('0x2e')]);}}return _0x5ce092;}function getSquareProject(_0x145064,_0x33da0c){rpc[_0xd767('0x2f')](_0x145064)[_0xd767('0x30')](function(_0x2f52b1){_0x33da0c(null,_0x2f52b1);})[_0xd767('0x31')](function(_0x38633f){_0x33da0c(null,_0x38633f);});}function createSquareReport(_0x449e0f,_0x48f796){rpc['createSquareReport'](_0x449e0f)[_0xd767('0x30')](function(_0x85933a){if(_0x48f796){_0x48f796(null,_0x85933a);}})['catch'](function(_0x1a4c4e){if(_0x48f796){_0x48f796(null,_0x1a4c4e);}});}function setChannelVariables(_0x1b1c5d){for(var _0x4546d9 in _0x1b1c5d){if(_0x1b1c5d['hasOwnProperty'](_0x4546d9)){if(_0x4546d9['indexOf'](_0xd767('0x32'))===0x0){_0x1b1c5d[_0x4546d9[_0xd767('0x33')](0x4)]=_0x1b1c5d[_0x4546d9];delete _0x1b1c5d[_0x4546d9];}}}}function getLogFromObject(_0x1b1f93){return util[_0xd767('0x34')](_0x1b1f93,{'showHidden':![],'depth':null});}function agiHandler(_0x5bcee2){var _0x490f13,_0x280e23,_0x35bfc4,_0x23cfbd,_0x5b82ca;logger[_0xd767('0x35')]('variables',JSON[_0xd767('0x36')](_0x5bcee2,null,0x2));logger[_0xd767('0x11')](util[_0xd767('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5bcee2[_0xd767('0x1f')],_0x5bcee2['calleridname'],_0x5bcee2['callerid'],_0x5bcee2[_0xd767('0x1d')],_0x5bcee2['uniqueid']));_0x5bcee2['on'](_0xd767('0x17'),errorHandler);_0x5bcee2['on'](_0xd767('0x37'),closeHandler);_0x5bcee2['on'](_0xd767('0x38'),timeoutHandler);_0x5bcee2[_0xd767('0x22')]=![];_0x5bcee2['on'](_0xd767('0x39'),hangupHandler);var _0x5c7bff=getSquareProject['sync'](null,_0x5bcee2[_0xd767('0x1f')]);if(_0x5c7bff){if(_0x5c7bff[_0xd767('0x3a')]){_0x490f13=getRoot(_0x5c7bff[_0xd767('0x3a')]);if(_0x490f13&&_0x490f13[_0xd767('0x3b')]){logger['debug'](_0xd767('0x25'),JSON[_0xd767('0x36')](_0x490f13,null,0x2));_0x5bcee2['joinAt']=moment()[_0xd767('0x12')](_0xd767('0x3c'));_0x280e23=initGraph(_[_0xd767('0x3d')](_0x490f13,_0xd767('0x2a')),_0x490f13[_0xd767('0x2a')]);_0x35bfc4=new Vertices(_0x5bcee2,rpc,mailRpc);logger[_0xd767('0x11')](util['format'](_0xd767('0x3e'),_0x5bcee2['arg_1'],_0x5bcee2[_0xd767('0x1b')],_0x5bcee2[_0xd767('0x1c')],_0x5bcee2[_0xd767('0x1d')],_0x5bcee2[_0xd767('0x21')]));_0x280e23[_0xd767('0x3f')](_0x490f13[_0xd767('0x3b')]['id'],function(_0x24422b){try{_0x24422b=_0x35bfc4[_0xd767('0x40')](_0x24422b);logger[_0xd767('0x35')](_0xd767('0x41'),JSON[_0xd767('0x36')](_0x24422b,null,0x2));if(_0x24422b['agicommand']===_0xd767('0x42')){logger['info'](_0xd767('0x43'));_0x5bcee2[_0xd767('0x44')]=_0x24422b[_0xd767('0x44')]||_0x5bcee2[_0xd767('0x44')];_0x5bcee2[_0xd767('0x45')]=_0x24422b[_0xd767('0x45')];_0x5bcee2['priority']=_0x24422b[_0xd767('0x46')]?_0x24422b['priority']-0x1:0x1;return null;}else if(_0x24422b&&_0x35bfc4[_0x24422b[_0xd767('0x26')]]){_0x5b82ca=_0x35bfc4[_0x24422b[_0xd767('0x26')]](_0x24422b);logger[_0xd767('0x11')](_0xd767('0x47'),JSON['stringify'](_0x5b82ca,null,0x2));if(_0x5b82ca&&_0x5b82ca[_0xd767('0x48')]===AGI_CODE_SUCCESS&&_0x5b82ca[_0xd767('0x49')]!==AGI_RESULT_ERROR&&!_0x5bcee2[_0xd767('0x22')]){logger[_0xd767('0x35')]('response',getLogFromObject(_0x5b82ca));return _[_0xd767('0x4a')](_0x5b82ca['result'])?null:_0x5b82ca['result'][_0xd767('0x4b')]();}else{logger[_0xd767('0x17')](_0xd767('0x47'),getLogFromObject(_0x5b82ca));return null;}}else{logger[_0xd767('0x17')](_0xd767('0x4c'));return null;}}catch(_0x21dc55){logger[_0xd767('0x17')](_0x21dc55[_0xd767('0x19')]);return null;}});if(_0x490f13[_0xd767('0x4d')]){logger[_0xd767('0x11')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5bcee2[_0xd767('0x1f')],_0x5bcee2[_0xd767('0x1b')],_0x5bcee2['callerid'],_0x5bcee2[_0xd767('0x1d')],_0x5bcee2[_0xd767('0x21')]));_0x280e23[_0xd767('0x3f')](_0x490f13['finally']['id'],function(_0x282e11){try{_0x282e11=_0x35bfc4['clear'](_0x282e11);logger[_0xd767('0x35')](_0xd767('0x41'),JSON[_0xd767('0x36')](_0x282e11,null,0x2));if(_0x282e11&&_0x35bfc4[_0x282e11[_0xd767('0x26')]]){_0x5b82ca=_0x35bfc4[_0x282e11[_0xd767('0x26')]](_0x282e11);if(_0x5b82ca){logger['debug'](_0xd767('0x47'),getLogFromObject(_0x5b82ca));return _[_0xd767('0x4a')](_0x5b82ca[_0xd767('0x49')])?null:_0x5b82ca['result']['toString']();}else{logger[_0xd767('0x17')](_0xd767('0x47'),getLogFromObject(_0x5b82ca));return null;}}else{logger['error'](_0xd767('0x4c'));return null;}}catch(_0x311a08){logger['error'](_0x311a08[_0xd767('0x19')]);return null;}});}logger[_0xd767('0x11')](util['format'](_0xd767('0x4e'),_0x5bcee2[_0xd767('0x1f')],_0x5bcee2[_0xd767('0x1b')],_0x5bcee2['callerid'],_0x5bcee2[_0xd767('0x1d')],_0x5bcee2[_0xd767('0x21')]));logger[_0xd767('0x11')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5bcee2[_0xd767('0x44')],_0x5bcee2[_0xd767('0x45')],parseInt(_0x5bcee2[_0xd767('0x46')],0xa)+0x1));_0x5bcee2['continueAt'](_0x5bcee2[_0xd767('0x44')],_0x5bcee2[_0xd767('0x45')],parseInt(_0x5bcee2['priority'],0xa)+0x1);_0x5bcee2['close']();}}else{logger[_0xd767('0x17')](util[_0xd767('0x12')]('Project\x20%s\x20not\x20published',_0x5bcee2['arg_1']));_0x5bcee2[_0xd767('0x4f')](_0x5bcee2['context'],_0x5bcee2[_0xd767('0x45')],parseInt(_0x5bcee2[_0xd767('0x46')],0xa)+0x1);_0x5bcee2[_0xd767('0x37')]();}}else{logger[_0xd767('0x17')](util[_0xd767('0x12')](_0xd767('0x50'),_0x5bcee2['arg_1']));_0x5bcee2[_0xd767('0x4f')](_0x5bcee2[_0xd767('0x44')],_0x5bcee2[_0xd767('0x45')],parseInt(_0x5bcee2[_0xd767('0x46')],0xa)+0x1);_0x5bcee2[_0xd767('0x37')]();}}function main(){var _0xf29f5d;return utilLicense['getLicense']()[_0xd767('0x30')](function(_0x38882d){if(_0x38882d){if(_0x38882d[_0xd767('0x51')]){if(_0x38882d[_0xd767('0x52')]&&_0x38882d[_0xd767('0x52')]>0x0){logger[_0xd767('0x11')](util[_0xd767('0x12')](_0xd767('0x53'),_0x38882d[_0xd767('0x52')]));_0xf29f5d=_0x38882d[_0xd767('0x52')];}else{logger[_0xd767('0x11')](_0xd767('0x54'));}}else{logger['info'](_0xd767('0x55'));_0xf29f5d=-0x1;}}})[_0xd767('0x31')](function(_0x2dd688){logger['error']('[LICENSE]',_0x2dd688['stack']);})['finally'](function(){var _0x491dd0=require(_0xd767('0x56'))(config[_0xd767('0x6')][_0xd767('0x10')],config[_0xd767('0x6')]['ip'],_0xf29f5d);_0x491dd0['on'](_0xd767('0x17'),errorHandler);_0x491dd0['on'](_0xd767('0x57'),listeningHandler);_0x491dd0['on'](_0xd767('0x58'),connectionHandler);_0x491dd0['on'](_0xd767('0x37'),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 bbe0753..7fa0696 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 _0x7fa8=['error','message','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x100622,_0xff8c57){var _0x38bf93=function(_0x4dc823){while(--_0x4dc823){_0x100622['push'](_0x100622['shift']());}};_0x38bf93(++_0xff8c57);}(_0x7fa8,0x1a1));var _0x87fa=function(_0x41cd93,_0x382eb8){_0x41cd93=_0x41cd93-0x0;var _0x58a7f8=_0x7fa8[_0x41cd93];return _0x58a7f8;};'use strict';var BPromise=require(_0x87fa('0x0'));var jayson=require(_0x87fa('0x1'));var client=jayson[_0x87fa('0x2')][_0x87fa('0x3')]({'port':0x232b});function request(_0x106d48,_0x42ac24){return new BPromise(function(_0x57629a,_0x467747){return client[_0x87fa('0x4')](_0x106d48,_0x42ac24)[_0x87fa('0x5')](function(_0x2b562f){if(_0x2b562f[_0x87fa('0x6')]){return _0x467747(_0x2b562f[_0x87fa('0x6')][_0x87fa('0x7')]);}else{return _0x57629a(_0x2b562f['result']);}})['catch'](function(_0x511cf8){return _0x467747(_0x511cf8);});});}exports['sendMailMessage']=function(_0x57b9f3,_0x10d815){return request(_0x87fa('0x8'),{'account':_0x57b9f3,'message':_0x10d815});}; \ No newline at end of file +var _0x4fff=['sendMailMessage','SendMail','bluebird','jayson/promise','client','error','message','result','catch'];(function(_0x32ced2,_0x52cd38){var _0x1e2a65=function(_0x58c8a6){while(--_0x58c8a6){_0x32ced2['push'](_0x32ced2['shift']());}};_0x1e2a65(++_0x52cd38);}(_0x4fff,0xe3));var _0xf4ff=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4fff[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0xf4ff('0x0'));var jayson=require(_0xf4ff('0x1'));var client=jayson[_0xf4ff('0x2')]['http']({'port':0x232b});function request(_0x1d71d5,_0x2b2c0f){return new BPromise(function(_0x20a261,_0xbd18d2){return client['request'](_0x1d71d5,_0x2b2c0f)['then'](function(_0x4ed8f5){if(_0x4ed8f5[_0xf4ff('0x3')]){return _0xbd18d2(_0x4ed8f5['error'][_0xf4ff('0x4')]);}else{return _0x20a261(_0x4ed8f5[_0xf4ff('0x5')]);}})[_0xf4ff('0x6')](function(_0x5aac46){return _0xbd18d2(_0x5aac46);});});}exports[_0xf4ff('0x7')]=function(_0x554d41,_0x1717ac){return request(_0xf4ff('0x8'),{'account':_0x554d41,'message':_0x1717ac});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 5befde3..88d1b07 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 _0x61a3=['inherits','prototype','_transform','toString','indexOf','substring','length','split','slice','trim','emit','headers','_inBody','line','exports','util','stream','Transform','call','_localBuffer'];(function(_0x4e7852,_0x1f9638){var _0xcd8f74=function(_0x165d61){while(--_0x165d61){_0x4e7852['push'](_0x4e7852['shift']());}};_0xcd8f74(++_0x1f9638);}(_0x61a3,0x1ef));var _0x361a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x61a3[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x361a('0x0'));var Transform=require(_0x361a('0x1'))[_0x361a('0x2')];function AGIReply(_0x4bfaf2){Transform[_0x361a('0x3')](this,_0x4bfaf2);this[_0x361a('0x4')]='';this['_inBody']=![];}util[_0x361a('0x5')](AGIReply,Transform);AGIReply[_0x361a('0x6')][_0x361a('0x7')]=function(_0x4938b6,_0x505f25,_0x2ed314){var _0x9d6979='\x0a',_0x5cc8a2=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x13f43d=-0x1,_0x408335=-0x1,_0xbb1f1a='',_0x463ee2=0x0,_0x5c3143='',_0x159fe3='';this['_localBuffer']+=_0x4938b6[_0x361a('0x8')]();_0x5c3143=this['_localBuffer'];if(!this['_inBody']){_0x463ee2=0x0;while(_0x5cc8a2[_0x463ee2]){while((_0x408335=_0x5c3143[_0x361a('0x9')](_0x5cc8a2[_0x463ee2]))!=-0x1){_0xbb1f1a=_0x5cc8a2[_0x463ee2];_0x159fe3=_0x5c3143[_0x361a('0xa')](0x0,_0x408335);_0x5c3143=_0x5c3143[_0x361a('0xa')](_0x408335+_0xbb1f1a[_0x361a('0xb')]);var _0x154388=_0x159fe3[_0x361a('0xc')](_0x9d6979),_0x44d2a9=0x0,_0x5b995d={},_0x33166f='',_0x6f51cc='',_0x127c7e=-0x1;while(_0x154388[_0x44d2a9]){_0x127c7e=_0x154388[_0x44d2a9][_0x361a('0x9')](':');if(_0x127c7e!=-0x1){_0x33166f=_0x154388[_0x44d2a9][_0x361a('0xd')](0x0,_0x127c7e)['trim']();_0x6f51cc=_0x154388[_0x44d2a9][_0x361a('0xd')](_0x127c7e+0x1)[_0x361a('0xe')]();if(_0x33166f['length']>0x0){_0x5b995d[_0x33166f]=_0x6f51cc;}}else{}_0x44d2a9++;}this[_0x361a('0xf')](_0x361a('0x10'),_0x5b995d);this[_0x361a('0x11')]=!![];}_0x463ee2++;}this[_0x361a('0x4')]=_0x5c3143;}else{while((_0x13f43d=_0x5c3143['indexOf'](_0x9d6979))!=-0x1){_0x159fe3=_0x5c3143[_0x361a('0xa')](0x0,_0x13f43d);this['emit'](_0x361a('0x12'),_0x159fe3);_0x5c3143=_0x5c3143['substring'](_0x13f43d+_0x9d6979[_0x361a('0xb')]);}this[_0x361a('0x4')]=_0x5c3143;}_0x2ed314();};module[_0x361a('0x13')]=AGIReply; \ No newline at end of file +var _0x4343=['indexOf','substring','length','trim','slice','emit','line','exports','util','Transform','call','_localBuffer','_inBody','inherits','prototype','toString'];(function(_0x5949ba,_0xd1a7fa){var _0x3402a4=function(_0x59df1c){while(--_0x59df1c){_0x5949ba['push'](_0x5949ba['shift']());}};_0x3402a4(++_0xd1a7fa);}(_0x4343,0x158));var _0x3434=function(_0x324882,_0x45e867){_0x324882=_0x324882-0x0;var _0x489525=_0x4343[_0x324882];return _0x489525;};'use strict';var util=require(_0x3434('0x0'));var Transform=require('stream')[_0x3434('0x1')];function AGIReply(_0x2ad8f1){Transform[_0x3434('0x2')](this,_0x2ad8f1);this[_0x3434('0x3')]='';this[_0x3434('0x4')]=![];}util[_0x3434('0x5')](AGIReply,Transform);AGIReply[_0x3434('0x6')]['_transform']=function(_0x357056,_0x41778e,_0x438e70){var _0x367ffb='\x0a',_0x56145b=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5b1528=-0x1,_0x17525d=-0x1,_0xb886da='',_0x1ea9f1=0x0,_0x5c4831='',_0x22cbae='';this[_0x3434('0x3')]+=_0x357056[_0x3434('0x7')]();_0x5c4831=this[_0x3434('0x3')];if(!this[_0x3434('0x4')]){_0x1ea9f1=0x0;while(_0x56145b[_0x1ea9f1]){while((_0x17525d=_0x5c4831[_0x3434('0x8')](_0x56145b[_0x1ea9f1]))!=-0x1){_0xb886da=_0x56145b[_0x1ea9f1];_0x22cbae=_0x5c4831[_0x3434('0x9')](0x0,_0x17525d);_0x5c4831=_0x5c4831[_0x3434('0x9')](_0x17525d+_0xb886da[_0x3434('0xa')]);var _0x77a12a=_0x22cbae['split'](_0x367ffb),_0x19e394=0x0,_0x485776={},_0x55ac79='',_0x4e73b1='',_0x51be0c=-0x1;while(_0x77a12a[_0x19e394]){_0x51be0c=_0x77a12a[_0x19e394][_0x3434('0x8')](':');if(_0x51be0c!=-0x1){_0x55ac79=_0x77a12a[_0x19e394]['slice'](0x0,_0x51be0c)[_0x3434('0xb')]();_0x4e73b1=_0x77a12a[_0x19e394][_0x3434('0xc')](_0x51be0c+0x1)[_0x3434('0xb')]();if(_0x55ac79[_0x3434('0xa')]>0x0){_0x485776[_0x55ac79]=_0x4e73b1;}}else{}_0x19e394++;}this[_0x3434('0xd')]('headers',_0x485776);this['_inBody']=!![];}_0x1ea9f1++;}this[_0x3434('0x3')]=_0x5c4831;}else{while((_0x5b1528=_0x5c4831[_0x3434('0x8')](_0x367ffb))!=-0x1){_0x22cbae=_0x5c4831[_0x3434('0x9')](0x0,_0x5b1528);this[_0x3434('0xd')](_0x3434('0xe'),_0x22cbae);_0x5c4831=_0x5c4831[_0x3434('0x9')](_0x5b1528+_0x367ffb['length']);}this[_0x3434('0x3')]=_0x5c4831;}_0x438e70();};module[_0x3434('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 13dd389..bdd69e2 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 _0x25d0=['request','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','phone','then','CreateCmContact','getPauseById','ShowPause','agentLogin','PauseUser','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http'];(function(_0x493370,_0x4c7fac){var _0xac15d=function(_0x415cd6){while(--_0x415cd6){_0x493370['push'](_0x493370['shift']());}};_0xac15d(++_0x4c7fac);}(_0x25d0,0xa4));var _0x025d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d0[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x025d('0x0'));var moment=require(_0x025d('0x1'));var _=require(_0x025d('0x2'));var util=require(_0x025d('0x3'));var jayson=require(_0x025d('0x4'));var client=jayson[_0x025d('0x5')][_0x025d('0x6')]({'port':0x2329});function request(_0x44f7a8,_0x4e52bf){return new BPromise(function(_0x1537e7,_0x1bc768){return client[_0x025d('0x7')](_0x44f7a8,_0x4e52bf)['then'](function(_0x146e73){if(_0x146e73[_0x025d('0x8')]){return _0x1bc768(_0x146e73[_0x025d('0x8')][_0x025d('0x9')]);}else{return _0x1537e7(_0x146e73[_0x025d('0xa')]);}})[_0x025d('0xb')](function(_0x1ff880){return _0x1bc768(_0x1ff880);});});}exports[_0x025d('0xc')]=function(_0x14d974){return request(_0x025d('0xd'),{'options':{'raw':![],'where':{'name':_0x14d974},'attributes':[_0x025d('0xe')]}});};exports[_0x025d('0xf')]=function(_0x120df1){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x120df1},'include':[{'model':_0x025d('0x10'),'as':_0x025d('0x11')}],'attributes':['id',_0x025d('0x12'),_0x025d('0x13')]}});};exports[_0x025d('0x14')]=function(_0x217799){return request(_0x025d('0xd'),{'options':{'where':{'id':_0x217799},'attributes':['name']}});};exports[_0x025d('0x15')]=function(_0x58534b){return request(_0x025d('0x16'),{'options':{'where':{'id':_0x58534b},'attributes':[_0x025d('0x12')]}});};exports[_0x025d('0x17')]=function(_0x4da69d){return request(_0x025d('0x18'),{'options':{'where':{'id':_0x4da69d},'attributes':[_0x025d('0x12')]}});};exports[_0x025d('0x19')]=function(_0x35710d){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x35710d},'attributes':[_0x025d('0x1a')]}});};exports['getUserById']=function(_0x2baf7a){return request('ShowUser',{'options':{'where':{'id':_0x2baf7a},'attributes':[_0x025d('0x12')]}});};exports[_0x025d('0x1b')]=function(_0x2bfb83){return request(_0x025d('0x1c'),{'options':{'where':{'id':_0x2bfb83},'attributes':[_0x025d('0x12')]}});};exports[_0x025d('0x1d')]=function(_0x3cf30e){return request(_0x025d('0x1e'),{'options':{'where':{'id':_0x3cf30e},'attributes':[_0x025d('0x1f')]}});};exports['getIntervalById']=function(_0x3eb622){return request(_0x025d('0x20'),{'options':{'raw':![],'where':{'id':_0x3eb622},'include':[{'model':'Interval','as':_0x025d('0x21')}]}});};exports[_0x025d('0x22')]=function(_0x4eb5fc){return request(_0x025d('0x23'),{'options':{'where':{'id':_0x4eb5fc},'attributes':['id',_0x025d('0x12')]}});};exports['createSmsMessage']=function(_0x3bde0d){return request(_0x025d('0x24'),{'body':_0x3bde0d});};exports[_0x025d('0x25')]=function(_0x15ba39){return request(_0x025d('0x26'),{'body':_0x15ba39});};exports[_0x025d('0x27')]=function(_0xd49653){return request(_0x025d('0x28'),{'body':_[_0x025d('0x29')](_0xd49653,{'project_name':_0xd49653['arg_1'],'prev_project_name':_0xd49653[_0x025d('0x2a')]||'','is_subproject':_0xd49653[_0x025d('0x2a')]?!![]:![],'leaveAt':moment()[_0x025d('0x2b')](_0x025d('0x2c'))})});};exports['createSquareRecording']=function(_0x502064){return request(_0x025d('0x2d'),{'body':_0x502064});};exports[_0x025d('0x2e')]=function(_0x56495a){return request('CreateSquareMessage',{'body':_0x56495a});};exports[_0x025d('0x2f')]=function(_0x319f21){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x319f21[_0x025d('0x30')],'ListId':_0x319f21['ListId']}}})[_0x025d('0x31')](function(_0x45ff82){if(_0x45ff82){return _0x45ff82;}return request(_0x025d('0x32'),{'body':_0x319f21});});};exports[_0x025d('0x33')]=function(_0x5e7678){return request(_0x025d('0x34'),{'options':{'where':{'id':_0x5e7678},'attributes':[_0x025d('0x12')]}});};exports[_0x025d('0x35')]=function(_0x5d15ab,_0x3cc228){return request('LoginUser',{'body':{'interface':_0x3cc228},'options':{'where':_0x5d15ab}});};exports['agentPause']=function(_0x2b76a4,_0x1186ec,_0x20fdca){return request(_0x025d('0x36'),{'body':{'type':_0x1186ec,'uniqueid':_0x20fdca},'options':{'where':_0x2b76a4}});};exports['agentUnpause']=function(_0x39826a){return request(_0x025d('0x37'),{'body':{},'options':{'where':_0x39826a}});};exports['agentLogout']=function(_0x149f15){return request(_0x025d('0x38'),{'body':{},'options':{'where':_0x149f15}});}; \ No newline at end of file +var _0x6941=['CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport'];(function(_0x35677d,_0x3e5aa2){var _0x298966=function(_0x438cf7){while(--_0x438cf7){_0x35677d['push'](_0x35677d['shift']());}};_0x298966(++_0x3e5aa2);}(_0x6941,0xc0));var _0x1694=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6941[_0x5bd426];return _0x23a7eb;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x1694('0x0'));var util=require('util');var jayson=require(_0x1694('0x1'));var client=jayson[_0x1694('0x2')][_0x1694('0x3')]({'port':0x2329});function request(_0x11d3db,_0x4d41a1){return new BPromise(function(_0x190671,_0x13aa21){return client['request'](_0x11d3db,_0x4d41a1)[_0x1694('0x4')](function(_0xd263bf){if(_0xd263bf[_0x1694('0x5')]){return _0x13aa21(_0xd263bf['error'][_0x1694('0x6')]);}else{return _0x190671(_0xd263bf[_0x1694('0x7')]);}})[_0x1694('0x8')](function(_0x3249fb){return _0x13aa21(_0x3249fb);});});}exports[_0x1694('0x9')]=function(_0x7e65e3){return request(_0x1694('0xa'),{'options':{'raw':![],'where':{'name':_0x7e65e3},'attributes':[_0x1694('0xb')]}});};exports[_0x1694('0xc')]=function(_0x568a78){return request(_0x1694('0xd'),{'options':{'raw':![],'where':{'id':_0x568a78},'include':[{'model':_0x1694('0xe'),'as':'Smtp'}],'attributes':['id',_0x1694('0xf'),'email']}});};exports[_0x1694('0x10')]=function(_0x26cbb3){return request(_0x1694('0xa'),{'options':{'where':{'id':_0x26cbb3},'attributes':[_0x1694('0xf')]}});};exports[_0x1694('0x11')]=function(_0xd87120){return request(_0x1694('0x12'),{'options':{'where':{'id':_0xd87120},'attributes':[_0x1694('0xf')]}});};exports[_0x1694('0x13')]=function(_0x3948f7){return request(_0x1694('0x14'),{'options':{'where':{'id':_0x3948f7},'attributes':[_0x1694('0xf')]}});};exports[_0x1694('0x15')]=function(_0x3e9870){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3e9870},'attributes':['dsn']}});};exports[_0x1694('0x16')]=function(_0x5e6b3f){return request(_0x1694('0x17'),{'options':{'where':{'id':_0x5e6b3f},'attributes':['name']}});};exports[_0x1694('0x18')]=function(_0x1a1a93){return request('ShowTrunk',{'options':{'where':{'id':_0x1a1a93},'attributes':['name']}});};exports[_0x1694('0x19')]=function(_0x431b4e){return request(_0x1694('0x1a'),{'options':{'where':{'id':_0x431b4e},'attributes':['save_name']}});};exports[_0x1694('0x1b')]=function(_0x4a4d56){return request(_0x1694('0x1c'),{'options':{'raw':![],'where':{'id':_0x4a4d56},'include':[{'model':'Interval','as':_0x1694('0x1d')}]}});};exports[_0x1694('0x1e')]=function(_0x571514){return request(_0x1694('0x1f'),{'options':{'where':{'id':_0x571514},'attributes':['id',_0x1694('0xf')]}});};exports[_0x1694('0x20')]=function(_0x29e961){return request('CreateSmsMessage',{'body':_0x29e961});};exports[_0x1694('0x21')]=function(_0x1e3f06){return request(_0x1694('0x22'),{'body':_0x1e3f06});};exports[_0x1694('0x23')]=function(_0xc4c902){return request(_0x1694('0x24'),{'body':_[_0x1694('0x25')](_0xc4c902,{'project_name':_0xc4c902[_0x1694('0x26')],'prev_project_name':_0xc4c902[_0x1694('0x27')]||'','is_subproject':_0xc4c902[_0x1694('0x27')]?!![]:![],'leaveAt':moment()[_0x1694('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x1694('0x29')]=function(_0x32065a){return request(_0x1694('0x2a'),{'body':_0x32065a});};exports[_0x1694('0x2b')]=function(_0x3b9c63){return request(_0x1694('0x2c'),{'body':_0x3b9c63});};exports['createCmContact']=function(_0x30474a){return request(_0x1694('0x2d'),{'options':{'raw':![],'where':{'phone':_0x30474a['phone'],'ListId':_0x30474a[_0x1694('0x2e')]}}})['then'](function(_0x1ceeab){if(_0x1ceeab){return _0x1ceeab;}return request(_0x1694('0x2f'),{'body':_0x30474a});});};exports[_0x1694('0x30')]=function(_0x46b910){return request(_0x1694('0x31'),{'options':{'where':{'id':_0x46b910},'attributes':['name']}});};exports['agentLogin']=function(_0x53b31a,_0x57d4e1){return request(_0x1694('0x32'),{'body':{'interface':_0x57d4e1},'options':{'where':_0x53b31a}});};exports[_0x1694('0x33')]=function(_0x3e6125,_0x4002f6,_0x3599de){return request(_0x1694('0x34'),{'body':{'type':_0x4002f6,'uniqueid':_0x3599de},'options':{'where':_0x3e6125}});};exports[_0x1694('0x35')]=function(_0x1f014d){return request(_0x1694('0x36'),{'body':{},'options':{'where':_0x1f014d}});};exports[_0x1694('0x37')]=function(_0x9b1358){return request(_0x1694('0x38'),{'body':{},'options':{'where':_0x9b1358}});}; \ 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 1ea316a..427f09e 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 _0xd307=['./lex','exports','./polly'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xd307,0x110));var _0x7d30=function(_0x263d4d,_0x5aeac5){_0x263d4d=_0x263d4d-0x0;var _0x131e66=_0xd307[_0x263d4d];return _0x131e66;};var polly=require(_0x7d30('0x0'));var lex=require(_0x7d30('0x1'));module[_0x7d30('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb931=['exports'];(function(_0x17410f,_0x3cec7c){var _0x18e5a0=function(_0x368c8b){while(--_0x368c8b){_0x17410f['push'](_0x17410f['shift']());}};_0x18e5a0(++_0x3cec7c);}(_0xb931,0x155));var _0x1b93=function(_0x276a53,_0x28fcfb){_0x276a53=_0x276a53-0x0;var _0x28314d=_0xb931[_0x276a53];return _0x28314d;};var polly=require('./polly');var lex=require('./lex');module[_0x1b93('0x0')]={'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 b508b06..1a8a92f 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa75b=['./lib/api'];(function(_0x5eb72d,_0x4e38bd){var _0x1b54b1=function(_0x33c70d){while(--_0x33c70d){_0x5eb72d['push'](_0x5eb72d['shift']());}};_0x1b54b1(++_0x4e38bd);}(_0xa75b,0x170));var _0xba75=function(_0x4cf791,_0x22bd0e){_0x4cf791=_0x4cf791-0x0;var _0x5630cb=_0xa75b[_0x4cf791];return _0x5630cb;};'use strict';var lex=require(_0xba75('0x0'));module['exports']=function(_0x546e14,_0x10c0dd,_0x39dc19,_0x17b666,_0x3cde96,_0x1760c0){return lex(_0x546e14,_0x10c0dd,_0x39dc19,_0x17b666,_0x3cde96,_0x1760c0);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b){return lex(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b);}; \ 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 04dba49..0b7629f 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x464522,_0x3eed75){var _0x5f3c7b=function(_0x361f07){while(--_0x361f07){_0x464522['push'](_0x464522['shift']());}};_0x5f3c7b(++_0x3eed75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0xdaea51,_0x5db859){var _0x176510=function(_0x3f6788){while(--_0x3f6788){_0xdaea51['push'](_0xdaea51['shift']());}};_0x176510(++_0x5db859);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 3db2f3f..0361352 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 _0x63e3=['./lib/api','exports'];(function(_0x5cf368,_0x4c814a){var _0x5420da=function(_0x4e478){while(--_0x4e478){_0x5cf368['push'](_0x5cf368['shift']());}};_0x5420da(++_0x4c814a);}(_0x63e3,0x1c8));var _0x363e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x63e3[_0x1a36a5];return _0x746243;};'use strict';var polly=require(_0x363e('0x0'));module[_0x363e('0x1')]=function(_0x513cfc,_0x2dbdf5,_0x348b9f,_0x48fa27,_0x5b7cfc,_0x3c907e,_0x253ac0){return polly(_0x513cfc,_0x2dbdf5,_0x348b9f,_0x48fa27,_0x5b7cfc,_0x3c907e,_0x253ac0);}; \ No newline at end of file +var _0xa805=['./lib/api','exports'];(function(_0x5b4c44,_0x2e495e){var _0x58485a=function(_0x13299b){while(--_0x13299b){_0x5b4c44['push'](_0x5b4c44['shift']());}};_0x58485a(++_0x2e495e);}(_0xa805,0x1c2));var _0x5a80=function(_0x44d9e2,_0x434718){_0x44d9e2=_0x44d9e2-0x0;var _0x1aa711=_0xa805[_0x44d9e2];return _0x1aa711;};'use strict';var polly=require(_0x5a80('0x0'));module[_0x5a80('0x1')]=function(_0x2feefa,_0xba5888,_0x4abf73,_0x120946,_0x14041e,_0x1d5e1d,_0x1cb6b9){return polly(_0x2feefa,_0xba5888,_0x4abf73,_0x120946,_0x14041e,_0x1d5e1d,_0x1cb6b9);}; \ 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 f2ed02f..3968885 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 _0x90e2=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','bluebird','randomstring','synthesizeSpeech','writeFile'];(function(_0x4ac2d1,_0x145e04){var _0x362eaf=function(_0x28bf5f){while(--_0x28bf5f){_0x4ac2d1['push'](_0x4ac2d1['shift']());}};_0x362eaf(++_0x145e04);}(_0x90e2,0xe2));var _0x290e=function(_0x5a461e,_0xe83e49){_0x5a461e=_0x5a461e-0x0;var _0x1fac23=_0x90e2[_0x5a461e];return _0x1fac23;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x290e('0x0'));var rs=require(_0x290e('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x4751b1,_0x17b90a,_0x338f1d){return new BPromise(function(_0x11a2ef,_0x1245cb){_0x4751b1[_0x290e('0x2')](_0x17b90a,function(_0x1800a5,_0x47229f){if(_0x1800a5){_0x1245cb(_0x1800a5);}else if(_0x47229f){if(_0x47229f['AudioStream']instanceof Buffer){fs[_0x290e('0x3')](_0x338f1d,_0x47229f[_0x290e('0x4')],function(_0x101bd9){if(_0x101bd9){_0x1245cb(_0x101bd9);}else{_0x11a2ef();}});}else{_0x1245cb(new Error(_0x290e('0x5')));}}else{_0x1245cb(new Error(_0x290e('0x6')));}});});}module[_0x290e('0x7')]=function(_0x4a1f4a,_0x182f93,_0x5bc8bc,_0x49b5d5,_0x3f902f,_0x21d74f,_0xbd7afe){var _0x1bbaaf=new AWS['Polly']({'accessKeyId':_0x4a1f4a,'secretAccessKey':_0x182f93,'region':_0x5bc8bc});var _0x3d0db4={'Text':_0x3f902f,'TextType':_0x21d74f||_0x290e('0x8'),'OutputFormat':_0x290e('0x9'),'VoiceId':_0x49b5d5};return pollyResult(_0x1bbaaf,_0x3d0db4,_0xbd7afe);}; \ No newline at end of file +var _0xa18c=['text','path','bluebird','randomstring','aws-sdk','writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x55e131,_0x52d237){var _0xe4bb67=function(_0x3d225c){while(--_0x3d225c){_0x55e131['push'](_0x55e131['shift']());}};_0xe4bb67(++_0x52d237);}(_0xa18c,0x160));var _0xca18=function(_0x1605a9,_0x377412){_0x1605a9=_0x1605a9-0x0;var _0x3efff2=_0xa18c[_0x1605a9];return _0x3efff2;};'use strict';var fs=require('fs');var path=require(_0xca18('0x0'));var BPromise=require(_0xca18('0x1'));var rs=require(_0xca18('0x2'));var AWS=require(_0xca18('0x3'));function pollyResult(_0x3f64d3,_0x5bdd15,_0x5b4bb5){return new BPromise(function(_0x34ad3f,_0x49c73f){_0x3f64d3['synthesizeSpeech'](_0x5bdd15,function(_0x5c0bba,_0x86a873){if(_0x5c0bba){_0x49c73f(_0x5c0bba);}else if(_0x86a873){if(_0x86a873['AudioStream']instanceof Buffer){fs[_0xca18('0x4')](_0x5b4bb5,_0x86a873[_0xca18('0x5')],function(_0x18250d){if(_0x18250d){_0x49c73f(_0x18250d);}else{_0x34ad3f();}});}else{_0x49c73f(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x49c73f(new Error(_0xca18('0x6')));}});});}module[_0xca18('0x7')]=function(_0x134fb2,_0x15c03b,_0x10d812,_0x4c93ba,_0x292dfb,_0x1dac1c,_0x2f322d){var _0x2998f1=new AWS['Polly']({'accessKeyId':_0x134fb2,'secretAccessKey':_0x15c03b,'region':_0x10d812});var _0x171e20={'Text':_0x292dfb,'TextType':_0x1dac1c||_0xca18('0x8'),'OutputFormat':'mp3','VoiceId':_0x4c93ba};return pollyResult(_0x2998f1,_0x171e20,_0x2f322d);}; \ 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 970f543..b28e708 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 _0xb396=['exports','./lib/api'];(function(_0x166241,_0x227ee2){var _0x51fd00=function(_0x556fd9){while(--_0x556fd9){_0x166241['push'](_0x166241['shift']());}};_0x51fd00(++_0x227ee2);}(_0xb396,0x131));var _0x6b39=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb396[_0xa464c9];return _0x3d73c4;};'use strict';var asr=require(_0x6b39('0x0'));module[_0x6b39('0x1')]=function(_0x1a6581,_0x1b3bdc,_0x3a68cb,_0x105fe8){return asr(_0x1a6581,_0x1b3bdc,_0x3a68cb);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x2e7560,_0x447d1e,_0x2a827e,_0x1646a0){return asr(_0x2e7560,_0x447d1e,_0x2a827e);}; \ 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 20a46bb..6fde6a5 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 _0xcf14=['8000','url','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x38918c,_0x246fd1){var _0x5a5831=function(_0x1dfa83){while(--_0x1dfa83){_0x38918c['push'](_0x38918c['shift']());}};_0x5a5831(++_0x246fd1);}(_0xcf14,0xa1));var _0x4cf1=function(_0x4a66b2,_0x28042e){_0x4a66b2=_0x4a66b2-0x0;var _0x6b419=_0xcf14[_0x4a66b2];return _0x6b419;};'use strict';var url=require(_0x4cf1('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x4cf1('0x1');module[_0x4cf1('0x2')]=function(_0x55e5b6,_0x3401df,_0x15f9b9){return new BPromise(function(_0x46add7,_0xc34979){var _0x5de7f1;if(typeof _0x55e5b6!==_0x4cf1('0x3')||_0x55e5b6[_0x4cf1('0x4')]===0x0){return _0xc34979(_0x4cf1('0x5'));}if(typeof _0x3401df!==_0x4cf1('0x3')||_0x3401df[_0x4cf1('0x4')]===0x0){return _0xc34979(_0x4cf1('0x6'));}if(typeof _0x15f9b9!==_0x4cf1('0x7')&&(typeof _0x15f9b9!=='string'||_0x15f9b9[_0x4cf1('0x4')]===0x0)){return _0xc34979(_0x4cf1('0x8'));}try{_0x5de7f1=fs[_0x4cf1('0x9')](_0x55e5b6)[_0x4cf1('0xa')](_0x4cf1('0xb'));}catch(_0x3722fa){return _0xc34979(_0x3722fa);}return _0x46add7({'method':_0x4cf1('0xc'),'uri':host+_0x4cf1('0xd')+_0x3401df,'body':{'config':{'encoding':_0x4cf1('0xe'),'sampleRateHertz':_0x4cf1('0xf'),'languageCode':_0x15f9b9},'audio':{'content':_0x5de7f1}},'json':!![]});});}; \ No newline at end of file +var _0xf323=['length','filepath\x20should\x20be\x20a\x20string','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','https://speech.googleapis.com','exports'];(function(_0x4d29a8,_0x374965){var _0x3201ae=function(_0xef6c96){while(--_0xef6c96){_0x4d29a8['push'](_0x4d29a8['shift']());}};_0x3201ae(++_0x374965);}(_0xf323,0x1c6));var _0x3f32=function(_0x57e58a,_0x118716){_0x57e58a=_0x57e58a-0x0;var _0x439d56=_0xf323[_0x57e58a];return _0x439d56;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x3f32('0x0');module[_0x3f32('0x1')]=function(_0x5420ab,_0x455911,_0x1081c3){return new BPromise(function(_0x3d0d9f,_0x6b7a8d){var _0x319ba4;if(typeof _0x5420ab!=='string'||_0x5420ab[_0x3f32('0x2')]===0x0){return _0x6b7a8d(_0x3f32('0x3'));}if(typeof _0x455911!==_0x3f32('0x4')||_0x455911[_0x3f32('0x2')]===0x0){return _0x6b7a8d('key\x20should\x20be\x20a\x20string');}if(typeof _0x1081c3!=='undefined'&&(typeof _0x1081c3!==_0x3f32('0x4')||_0x1081c3[_0x3f32('0x2')]===0x0)){return _0x6b7a8d(_0x3f32('0x5'));}try{_0x319ba4=fs[_0x3f32('0x6')](_0x5420ab)[_0x3f32('0x7')](_0x3f32('0x8'));}catch(_0x228ac0){return _0x6b7a8d(_0x228ac0);}return _0x3d0d9f({'method':_0x3f32('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x455911,'body':{'config':{'encoding':_0x3f32('0xa'),'sampleRateHertz':_0x3f32('0xb'),'languageCode':_0x1081c3},'audio':{'content':_0x319ba4}},'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 1e006bf..e5cdad8 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 _0x7ee6=['./asr','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7ee6,0x10c));var _0x67ee=function(_0x97a1ae,_0x2ec357){_0x97a1ae=_0x97a1ae-0x0;var _0xafab06=_0x7ee6[_0x97a1ae];return _0xafab06;};var asr=require(_0x67ee('0x0'));module[_0x67ee('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4e36=['./asr','exports'];(function(_0x51c14c,_0x53cb9c){var _0x11a098=function(_0x38be6b){while(--_0x38be6b){_0x51c14c['push'](_0x51c14c['shift']());}};_0x11a098(++_0x53cb9c);}(_0x4e36,0x8a));var _0x64e3=function(_0x1358a7,_0x242de6){_0x1358a7=_0x1358a7-0x0;var _0x1f2295=_0x4e36[_0x1358a7];return _0x1f2295;};var asr=require(_0x64e3('0x0'));module[_0x64e3('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 111abc4..6f5e18e 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 _0x3634=['parse\x20response\x20failed:\x0a','length','lang\x20\x22','writeFileSync','tmp','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','result','resolvedQuery','actionIncomplete','fulfillment','score','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','name','displayName','isFallback','languageCode','queryText','responseId','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','info','unlink','pipe','end','data','transcode','wav','start','resolve','generate','base64','chmodSync','777','split','toString','?key=','input','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','then','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','slice'];(function(_0x296e70,_0x339856){var _0xde35b5=function(_0x542fff){while(--_0x542fff){_0x296e70['push'](_0x296e70['shift']());}};_0xde35b5(++_0x339856);}(_0x3634,0x13d));var _0x4363=function(_0x3d7622,_0x295604){_0x3d7622=_0x3d7622-0x0;var _0x381e42=_0x3634[_0x3d7622];return _0x381e42;};'use strict';var apiai=require(_0x4363('0x0'));var BPromise=require(_0x4363('0x1'));var dialogflow=require(_0x4363('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x4363('0x3'));var md5=require(_0x4363('0x4'));var path=require(_0x4363('0x5'));var querystring=require('querystring');var rp=require(_0x4363('0x6'));var rs=require(_0x4363('0x7'));var sox=require(_0x4363('0x8'));var tts=require(_0x4363('0x9'));var urlParse=require(_0x4363('0xa'))[_0x4363('0xb')];var util=require(_0x4363('0xc'));var aws=require(_0x4363('0xd'));var google=require(_0x4363('0xe'));var sestek=require(_0x4363('0xf'));var tilde=require(_0x4363('0x10'));var logger=require(_0x4363('0x11'))(_0x4363('0x12'));var ISPEECH_API=_0x4363('0x13');function downloadFile(_0x4cfbdf,_0xd4e383){return new BPromise(function(_0x445f9a,_0x2b34ec){var _0x3faa48=urlParse(_0x4cfbdf);var _0x255b00=_0x3faa48[_0x4363('0x14')]===_0x4363('0x15')?https:http;var _0x539e36={'host':_0x3faa48[_0x4363('0x16')],'path':_0x3faa48[_0x4363('0x5')],'headers':{'user-agent':_0x4363('0x17')}};_0x255b00[_0x4363('0x18')](_0x539e36,function(_0x38d0fd){if(_0x38d0fd['statusCode']!==0xc8){logger[_0x4363('0x19')](_0x4363('0x1a')+_0x4cfbdf+'\x20failed,\x20status\x20code\x20=\x20'+_0x38d0fd[_0x4363('0x1b')]+'\x20('+_0x38d0fd[_0x4363('0x1c')]+')');_0x2b34ec(new Error(_0x4363('0x1a')+_0x4cfbdf+_0x4363('0x1d')+_0x38d0fd[_0x4363('0x1b')]+'\x20('+_0x38d0fd[_0x4363('0x1c')]+')'));return;}var _0xace743=fs['createWriteStream'](_0xd4e383);_0xace743['on']('finish',function(){logger[_0x4363('0x1e')]('finish\x20download\x20file');_0xace743['close'](_0x445f9a);});_0xace743['on'](_0x4363('0x19'),function(_0x1ac581){fs[_0x4363('0x1f')](_0xd4e383);logger[_0x4363('0x19')]('download\x20error',_0x1ac581);_0x2b34ec(_0x1ac581);});_0x38d0fd[_0x4363('0x20')](_0xace743);})['on'](_0x4363('0x19'),function(_0x1b2d2b){logger[_0x4363('0x19')](_0x1b2d2b);_0x2b34ec(_0x1b2d2b);})[_0x4363('0x21')]();});}function uploadFile(_0x59ec9a){return new BPromise(function(_0x4d7d41,_0x5de04a){var _0x517ce6=urlParse(_0x59ec9a);var _0x4f823c=_0x517ce6[_0x4363('0x14')]===_0x4363('0x15')?https:http;var _0x532dc2={'host':_0x517ce6['host'],'path':_0x517ce6[_0x4363('0x5')],'headers':{'user-agent':_0x4363('0x17')}};_0x4f823c[_0x4363('0x18')](_0x532dc2,function(_0x484956){if(_0x484956[_0x4363('0x1b')]!==0xc8){_0x5de04a(new Error(_0x4363('0x1a')+_0x59ec9a+_0x4363('0x1d')+_0x484956[_0x4363('0x1b')]+'\x20('+_0x484956[_0x4363('0x1c')]+')'));return;}var _0x181d26='';_0x484956['on'](_0x4363('0x22'),function(_0x46474c){_0x181d26+=_0x46474c;});_0x484956['on']('end',function(){_0x4d7d41(_0x181d26);});})['on'](_0x4363('0x19'),function(_0x57fa02){_0x5de04a(_0x57fa02);})['end']();});}function convertFile(_0x2e039e,_0x22e14a){return new BPromise(function(_0x467779,_0x43f73b){var _0x3e9207=sox[_0x4363('0x23')](_0x2e039e,_0x22e14a,{'sampleRate':0x1f40,'format':_0x4363('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3e9207['on'](_0x4363('0x19'),function(_0x1a092f){logger[_0x4363('0x19')]('error\x20convert',_0x1a092f);_0x43f73b(_0x1a092f);});_0x3e9207['on'](_0x4363('0x21'),function(){logger[_0x4363('0x1e')]('finish\x20to\x20convert');_0x467779();});_0x3e9207[_0x4363('0x25')]();});}function base64Decode(_0x351d45,_0x26d955){var _0xb504b6=path[_0x4363('0x26')](__dirname,'tmp',rs[_0x4363('0x27')](0x4)+'.wav');fs['writeFileSync'](_0xb504b6,_0x351d45,_0x4363('0x28'));return convertFile(_0xb504b6,_0x26d955)['then'](function(){try{fs[_0x4363('0x1f')](_0xb504b6);fs[_0x4363('0x29')](_0x26d955,_0x4363('0x2a'));}catch(_0x555222){logger[_0x4363('0x19')](_0x555222);}return _0x26d955[_0x4363('0x2b')]('.')[0x0];});}function base64Encode(_0x24f213){var _0x334b01=fs['readFileSync'](_0x24f213);return new Buffer(_0x334b01)[_0x4363('0x2c')](_0x4363('0x28'));}exports['googleCloudTTS']=function(_0x45fcbf,_0x2e275e,_0x5d0125,_0x4c1e65,_0x30b5f5,_0x417deb){var _0x25d1de,_0x245016;var _0x1fd393='https://texttospeech.googleapis.com/v1/';var _0x5455c9=_0x4363('0x2d')+_0x45fcbf;var _0x4773d5={};if(_0x2e275e==='ssml'){_0x4773d5[_0x4363('0x2e')]={'ssml':_0x5d0125};}else{_0x4773d5[_0x4363('0x2e')]={'text':_0x5d0125};};_0x4773d5['voice']={'languageCode':_0x4c1e65,'ssmlGender':_0x30b5f5};_0x4773d5[_0x4363('0x2f')]={'audioEncoding':_0x4363('0x30'),'sampleRateHertz':0x1f40};var _0x5a33a8={'url':_0x1fd393+_0x4363('0x31')+_0x5455c9,'method':_0x4363('0x32'),'json':!![],'body':_0x4773d5};return rp(_0x5a33a8)['then'](function(_0x17dcfe){return new BPromise(function(_0x40e58c,_0x3ff856){_0x25d1de=path[_0x4363('0x26')](__dirname,'tmp',rs[_0x4363('0x27')](0x4)+_0x4363('0x33'));var _0x490552=Buffer[_0x4363('0x34')](_0x17dcfe[_0x4363('0x35')],_0x4363('0x28'));return fs[_0x4363('0x36')](_0x25d1de,_0x490552,function(_0x1df160){_0x3ff856(_0x1df160);},function(_0x3e4bd2){fs[_0x4363('0x29')](_0x25d1de,'777');_0x40e58c(_0x3e4bd2);});});})[_0x4363('0x37')](function(_0x28d03c){_0x245016=path[_0x4363('0x26')](__dirname,'tmp',rs[_0x4363('0x27')](0x4)+_0x4363('0x38'));return convertFile(_0x25d1de,_0x245016);})['then'](function(){try{fs[_0x4363('0x1f')](_0x25d1de);fs[_0x4363('0x29')](_0x245016,'777');}catch(_0x25be16){logger[_0x4363('0x19')](_0x25be16);}logger[_0x4363('0x1e')](_0x4363('0x39'),_0x245016[_0x4363('0x2b')]('.')[0x0]);return _0x245016[_0x4363('0x2b')]('.')[0x0];});};exports[_0x4363('0x3a')]=function(_0x2acc64,_0x269d8e){var _0x450f02=_0x4363('0x3b');var _0x43b243,_0x3fd6c3;var _0x2dad34;var _0x5c5ed4={'encoding':_0x4363('0x3c'),'method':_0x4363('0x32'),'timeout':0x2710,'url':_0x450f02,'headers':{'Content-Type':_0x4363('0x3d')},'body':'f.req='+encodeURIComponent(JSON[_0x4363('0x3e')]([[['jQ1olc',JSON[_0x4363('0x3e')]([_0x2acc64,_0x269d8e||'en',![],'null']),null,'generic']]]))};return rp(_0x5c5ed4)[_0x4363('0x37')](function(_0x198bf5){try{_0x2dad34=eval(_0x198bf5[_0x4363('0x3f')](0x5))[0x0][0x2];}catch(_0xd3a842){throw new Error(_0x4363('0x40')+_0x198bf5[_0x4363('0x22')]);}if(!_0x2dad34){if(_0x2acc64[_0x4363('0x41')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x4363('0x42')+_0x269d8e+'\x22\x20might\x20not\x20exist');}}try{_0x2dad34=eval(_0x2dad34)[0x0];}catch(_0x2fb921){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x4363('0x22')]);}const _0x2e9171=_0x2dad34;_0x43b243=path[_0x4363('0x26')](__dirname,'tmp',rs[_0x4363('0x27')](0x4)+'.mp3');fs[_0x4363('0x43')](_0x43b243,_0x2dad34,{'encoding':'base64'});_0x3fd6c3=path[_0x4363('0x26')](__dirname,_0x4363('0x44'),rs[_0x4363('0x27')](0x4)+'.wav');return convertFile(_0x43b243,_0x3fd6c3);})[_0x4363('0x37')](function(){try{fs['unlink'](_0x43b243);fs[_0x4363('0x29')](_0x3fd6c3,_0x4363('0x2a'));}catch(_0x5060dd){logger[_0x4363('0x19')](_0x5060dd);}logger[_0x4363('0x1e')](_0x4363('0x45'),_0x3fd6c3['split']('.')[0x0]);return _0x3fd6c3[_0x4363('0x2b')]('.')[0x0];});};exports['googleASR']=function(_0x50daf5,_0x2324a3,_0x5c56d8){return google[_0x4363('0x46')](_0x50daf5,_0x2324a3,_0x5c56d8)[_0x4363('0x37')](function(_0x296ef0){logger[_0x4363('0x1e')](_0x296ef0[_0x4363('0x47')]);return rp(_0x296ef0);})['then'](function(_0x27f2a1){var _0x506992='';var _0x18e0d5=0x0;try{fs['unlink'](_0x50daf5);}catch(_0x148800){logger[_0x4363('0x19')](_0x148800);}if(_0x27f2a1&&_0x27f2a1['results']){_0x506992=_0x27f2a1[_0x4363('0x48')][_0x4363('0x49')](function(_0x82357e){return _0x82357e&&_0x82357e[_0x4363('0x4a')][0x0]&&_0x82357e[_0x4363('0x4a')][0x0]['transcript']?_0x82357e['alternatives'][0x0][_0x4363('0x4b')]:'';})[_0x4363('0x4c')]('\x0a');_0x18e0d5=_0x27f2a1[_0x4363('0x48')][_0x4363('0x49')](function(_0x199a6c){return _0x199a6c&&_0x199a6c[_0x4363('0x4a')][0x0]&&_0x199a6c[_0x4363('0x4a')][0x0][_0x4363('0x4d')]?_0x199a6c['alternatives'][0x0][_0x4363('0x4d')]:0x0;})[_0x4363('0x4c')]('\x0a');}logger[_0x4363('0x1e')](_0x4363('0x4e'),_0x506992);logger['info'](_0x4363('0x4f'),_0x18e0d5);return{'transcript':_0x506992,'confidence':_0x18e0d5};})[_0x4363('0x50')](function(_0x7d1455){logger[_0x4363('0x19')](_0x4363('0x51'),_0x7d1455[_0x4363('0x1b')],_0x7d1455['name'],_0x7d1455['message']);});};exports['googleDialogflow']=function(_0xd51dd0,_0x43176b,_0x89c94f,_0x29406b){var _0x14d353=apiai(_0x43176b,{'language':_0x29406b||'en'});return _0x14d353['textRequest'](_0x89c94f,{'sessionId':md5(_0xd51dd0)})[_0x4363('0x37')](function(_0x3cd06a){logger[_0x4363('0x1e')](JSON['stringify'](_0x3cd06a));return{'source':_0x3cd06a[_0x4363('0x52')]['source'],'resolvedQuery':_0x3cd06a[_0x4363('0x52')][_0x4363('0x53')],'action':_0x3cd06a[_0x4363('0x52')]['action'],'actionIncomplete':_0x3cd06a[_0x4363('0x52')][_0x4363('0x54')],'speech':_0x3cd06a[_0x4363('0x52')][_0x4363('0x55')]['speech'],'score':_0x3cd06a[_0x4363('0x52')][_0x4363('0x56')],'statusCode':_0x3cd06a['status']['code'],'endConversation':_0x3cd06a[_0x4363('0x52')][_0x4363('0x57')][_0x4363('0x58')]||![],'isFallbackIntent':_0x3cd06a[_0x4363('0x52')][_0x4363('0x57')][_0x4363('0x59')]};});};exports[_0x4363('0x5a')]=function(_0x1850e8,_0x1f1b53,_0x4e3b0c,_0x3178aa,_0x4d4cbc,_0x40a030){var _0xfed821=_0x3178aa[_0x4363('0x5b')](/\\n/g,'\x0a');var _0x1dc9bc={'credentials':{'private_key':_0xfed821,'client_email':_0x4e3b0c}};var _0x4cd0a3=new dialogflow['SessionsClient'](_0x1dc9bc);var _0x122f9a=_0x4cd0a3['sessionPath'](_0x1f1b53,md5(_0x1850e8));var _0x3e48ab={'session':_0x122f9a,'queryInput':{'text':{'text':_0x4d4cbc,'languageCode':_0x40a030}}};return _0x4cd0a3['detectIntent'](_0x3e48ab)[_0x4363('0x37')](function(_0xafd4f0){if(_0xafd4f0&&_0xafd4f0[_0x4363('0x41')]){logger[_0x4363('0x1e')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0xafd4f0));var _0x38ccab=_0xafd4f0[0x0];if(_0x38ccab){var _0x1671d9={'action':_0x38ccab[_0x4363('0x5c')]['action'],'allRequiredParamsPresent':_0x38ccab[_0x4363('0x5c')][_0x4363('0x5d')],'endConversation':_0x38ccab[_0x4363('0x5c')][_0x4363('0x5e')]&&_0x38ccab['queryResult'][_0x4363('0x5e')][_0x4363('0x5f')]?_0x38ccab[_0x4363('0x5c')][_0x4363('0x5e')][_0x4363('0x5f')][_0x4363('0x60')][_0x4363('0x61')]:![],'fulfillmentText':_0x38ccab[_0x4363('0x5c')]['fulfillmentText'],'intentName':_0x38ccab[_0x4363('0x5c')][_0x4363('0x62')][_0x4363('0x63')],'intentDisplayName':_0x38ccab[_0x4363('0x5c')][_0x4363('0x62')][_0x4363('0x64')],'isFallbackIntent':_0x38ccab['queryResult'][_0x4363('0x62')][_0x4363('0x65')],'languageCode':_0x38ccab[_0x4363('0x5c')][_0x4363('0x66')],'queryText':_0x38ccab[_0x4363('0x5c')][_0x4363('0x67')],'responseId':_0x38ccab[_0x4363('0x68')],'score':_0x38ccab[_0x4363('0x5c')]['intentDetectionConfidence'],'speech':_0x38ccab[_0x4363('0x5c')][_0x4363('0x69')],'providerResponse':JSON[_0x4363('0x3e')](_0xafd4f0)};return _0x1671d9;}}});};exports[_0x4363('0x6a')]=function(_0x2d7e11,_0x5da76a,_0x25c569,_0x582734){return tilde[_0x4363('0x46')](_0x2d7e11,_0x5da76a,_0x25c569,_0x582734)[_0x4363('0x37')](function(_0x37c266){try{fs[_0x4363('0x1f')](_0x2d7e11);}catch(_0x47a213){logger[_0x4363('0x19')](_0x47a213);}logger[_0x4363('0x1e')](_0x4363('0x6b'),_0x37c266[_0x4363('0x4b')]);logger[_0x4363('0x1e')](_0x4363('0x6c'),_0x37c266[_0x4363('0x4d')]);return _0x37c266;});};exports[_0x4363('0x6d')]=function(_0x552b6f,_0x16c842,_0x5ae49f,_0x3b46fa,_0x180365,_0x232ab9){var _0x1fd3bf=path[_0x4363('0x26')](__dirname,_0x4363('0x44'),rs[_0x4363('0x27')](0x4)+_0x4363('0x33'));var _0x4e72b2;return aws[_0x4363('0x6e')](_0x552b6f,_0x16c842,_0x5ae49f,_0x3b46fa,_0x180365,_0x232ab9,_0x1fd3bf)[_0x4363('0x37')](function(){_0x4e72b2=path['resolve'](__dirname,_0x4363('0x44'),rs[_0x4363('0x27')](0x4)+_0x4363('0x38'));return convertFile(_0x1fd3bf,_0x4e72b2);})[_0x4363('0x37')](function(){try{fs[_0x4363('0x1f')](_0x1fd3bf);fs[_0x4363('0x29')](_0x4e72b2,_0x4363('0x2a'));}catch(_0x497021){logger[_0x4363('0x19')](_0x497021);}return _0x4e72b2[_0x4363('0x2b')]('.')[0x0];});};exports[_0x4363('0x6f')]=function(_0x988904,_0x3b208a,_0x3057eb,_0x17c162,_0x2fe87a,_0x36e6c6){return aws[_0x4363('0x70')](_0x988904,_0x3b208a,_0x3057eb,_0x17c162,_0x2fe87a,_0x36e6c6)[_0x4363('0x37')](function(_0x3afa29){logger[_0x4363('0x1e')](JSON['stringify'](_0x3afa29));return _0x3afa29;});};exports['ispeechTTS']=function(_0x2bcc1f,_0x52fa31,_0x108c5a,_0x51aedd){var _0x31228d=util['format'](_0x4363('0x71'),ISPEECH_API,_0x2bcc1f,encodeURIComponent(_0x52fa31),_0x108c5a,_0x51aedd);var _0x2c52b8=path['resolve'](__dirname,_0x4363('0x44'),rs[_0x4363('0x27')](0x4)+_0x4363('0x33'));var _0x85c64b;return downloadFile(_0x31228d,_0x2c52b8)[_0x4363('0x37')](function(){_0x85c64b=path[_0x4363('0x26')](__dirname,_0x4363('0x44'),rs[_0x4363('0x27')](0x4)+_0x4363('0x38'));return convertFile(_0x2c52b8,_0x85c64b);})['then'](function(){try{fs[_0x4363('0x1f')](_0x2c52b8);fs['chmodSync'](_0x85c64b,_0x4363('0x2a'));}catch(_0x52dc78){logger['error'](_0x52dc78);}return _0x85c64b['split']('.')[0x0];});};exports[_0x4363('0x72')]=function(_0x50b6de,_0x5bc0e2,_0x19bbc0,_0x29496e){var _0x7ad874=util[_0x4363('0x73')](_0x4363('0x74'),ISPEECH_API,_0x5bc0e2,_0x19bbc0,base64Encode(_0x50b6de),_0x29496e?util[_0x4363('0x73')]('model=%s',encodeURIComponent(_0x29496e)):_0x4363('0x75'));return uploadFile(_0x7ad874)[_0x4363('0x37')](function(_0x1e2b69){return querystring[_0x4363('0xb')](_0x1e2b69);});};exports[_0x4363('0x76')]=function(_0x288f1d,_0xa272f0){return sestek[_0x4363('0x77')](_0x288f1d,_0xa272f0)[_0x4363('0x37')](function(_0x3de15e){logger['info'](JSON[_0x4363('0x3e')](_0x3de15e));var _0x1445ab={'speech':_0x3de15e[_0x4363('0x78')],'action':_0x3de15e[_0x4363('0x79')]?_0x3de15e['channelData'][_0x4363('0x7a')]:undefined,'actiondata':_0x3de15e[_0x4363('0x79')]?_0x3de15e['channelData'][_0x4363('0x7b')]:undefined};if(_0x3de15e[_0x4363('0x79')]&&_0x3de15e[_0x4363('0x79')][_0x4363('0x7c')]){return base64Decode(_0x3de15e[_0x4363('0x79')][_0x4363('0x7c')]['Data'],path[_0x4363('0x26')](__dirname,'tmp',rs[_0x4363('0x27')](0x4)+_0x4363('0x38')))[_0x4363('0x37')](function(_0x30f06a){_0x1445ab[_0x4363('0x7d')]=_0x30f06a;return _0x1445ab;});}return _0x1445ab;});};exports[_0x4363('0x7e')]=function(){return __dirname;}; \ No newline at end of file +var _0x6718=['intent','isFallback','languageCode','queryText','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','host','\x20failed,\x20status\x20code\x20=\x20','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','writeFileSync','then','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','POST','audioContent','writeFile','chmodSync','resolve','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','speech','score','status','endConversation','metadata','isFallbackIntent','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue'];(function(_0x4562ed,_0x4d4b3f){var _0x3af219=function(_0x4138f8){while(--_0x4138f8){_0x4562ed['push'](_0x4562ed['shift']());}};_0x3af219(++_0x4d4b3f);}(_0x6718,0x1bc));var _0x8671=function(_0x11de83,_0x49e1c1){_0x11de83=_0x11de83-0x0;var _0x45bdb0=_0x6718[_0x11de83];return _0x45bdb0;};'use strict';var apiai=require(_0x8671('0x0'));var BPromise=require(_0x8671('0x1'));var dialogflow=require(_0x8671('0x2'));var fs=require('fs');var http=require(_0x8671('0x3'));var https=require(_0x8671('0x4'));var md5=require(_0x8671('0x5'));var path=require(_0x8671('0x6'));var querystring=require(_0x8671('0x7'));var rp=require('request-promise');var rs=require(_0x8671('0x8'));var sox=require(_0x8671('0x9'));var tts=require(_0x8671('0xa'));var urlParse=require('url')['parse'];var util=require('util');var aws=require(_0x8671('0xb'));var google=require(_0x8671('0xc'));var sestek=require(_0x8671('0xd'));var tilde=require(_0x8671('0xe'));var logger=require(_0x8671('0xf'))(_0x8671('0x10'));var ISPEECH_API=_0x8671('0x11');function downloadFile(_0x41aa1f,_0x5c5388){return new BPromise(function(_0x5d4e74,_0x30a8e7){var _0x81256=urlParse(_0x41aa1f);var _0x300cd1=_0x81256[_0x8671('0x12')]===_0x8671('0x13')?https:http;var _0x12fd46={'host':_0x81256['host'],'path':_0x81256['path'],'headers':{'user-agent':_0x8671('0x14')}};_0x300cd1[_0x8671('0x15')](_0x12fd46,function(_0x19c743){if(_0x19c743[_0x8671('0x16')]!==0xc8){logger[_0x8671('0x17')](_0x8671('0x18')+_0x41aa1f+'\x20failed,\x20status\x20code\x20=\x20'+_0x19c743[_0x8671('0x16')]+'\x20('+_0x19c743['statusMessage']+')');_0x30a8e7(new Error('request\x20to\x20'+_0x41aa1f+'\x20failed,\x20status\x20code\x20=\x20'+_0x19c743[_0x8671('0x16')]+'\x20('+_0x19c743[_0x8671('0x19')]+')'));return;}var _0x5ed398=fs[_0x8671('0x1a')](_0x5c5388);_0x5ed398['on'](_0x8671('0x1b'),function(){logger[_0x8671('0x1c')](_0x8671('0x1d'));_0x5ed398['close'](_0x5d4e74);});_0x5ed398['on']('error',function(_0x37463e){fs[_0x8671('0x1e')](_0x5c5388);logger[_0x8671('0x17')](_0x8671('0x1f'),_0x37463e);_0x30a8e7(_0x37463e);});_0x19c743[_0x8671('0x20')](_0x5ed398);})['on']('error',function(_0x54d5f8){logger[_0x8671('0x17')](_0x54d5f8);_0x30a8e7(_0x54d5f8);})[_0x8671('0x21')]();});}function uploadFile(_0x174981){return new BPromise(function(_0x1f25a7,_0x11e5bb){var _0x55e9ca=urlParse(_0x174981);var _0x3bae55=_0x55e9ca[_0x8671('0x12')]===_0x8671('0x13')?https:http;var _0xaaa8bd={'host':_0x55e9ca[_0x8671('0x22')],'path':_0x55e9ca[_0x8671('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x3bae55[_0x8671('0x15')](_0xaaa8bd,function(_0x5b6159){if(_0x5b6159[_0x8671('0x16')]!==0xc8){_0x11e5bb(new Error(_0x8671('0x18')+_0x174981+_0x8671('0x23')+_0x5b6159[_0x8671('0x16')]+'\x20('+_0x5b6159[_0x8671('0x19')]+')'));return;}var _0x57a6ed='';_0x5b6159['on']('data',function(_0x59829f){_0x57a6ed+=_0x59829f;});_0x5b6159['on'](_0x8671('0x21'),function(){_0x1f25a7(_0x57a6ed);});})['on']('error',function(_0x3b89ea){_0x11e5bb(_0x3b89ea);})[_0x8671('0x21')]();});}function convertFile(_0x4f74dd,_0x3b9f39){return new BPromise(function(_0x5ab348,_0x52ba32){var _0x1dba4d=sox['transcode'](_0x4f74dd,_0x3b9f39,{'sampleRate':0x1f40,'format':_0x8671('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1dba4d['on'](_0x8671('0x17'),function(_0x12212a){logger[_0x8671('0x17')](_0x8671('0x25'),_0x12212a);_0x52ba32(_0x12212a);});_0x1dba4d['on'](_0x8671('0x21'),function(){logger[_0x8671('0x1c')](_0x8671('0x26'));_0x5ab348();});_0x1dba4d[_0x8671('0x27')]();});}function base64Decode(_0x4d44cf,_0x6809a6){var _0x18ec0a=path['resolve'](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+'.wav');fs[_0x8671('0x2a')](_0x18ec0a,_0x4d44cf,'base64');return convertFile(_0x18ec0a,_0x6809a6)[_0x8671('0x2b')](function(){try{fs[_0x8671('0x1e')](_0x18ec0a);fs['chmodSync'](_0x6809a6,_0x8671('0x2c'));}catch(_0x2a286f){logger['error'](_0x2a286f);}return _0x6809a6[_0x8671('0x2d')]('.')[0x0];});}function base64Encode(_0x460f51){var _0x44c729=fs[_0x8671('0x2e')](_0x460f51);return new Buffer(_0x44c729)[_0x8671('0x2f')](_0x8671('0x30'));}exports[_0x8671('0x31')]=function(_0x2ab96c,_0x318834,_0x240309,_0x2371f1,_0x58c39b,_0x385ad3){var _0x145a8e,_0x4d463f;var _0x2410fc=_0x8671('0x32');var _0x7c1015=_0x8671('0x33')+_0x2ab96c;var _0x10a290={};if(_0x318834==='ssml'){_0x10a290[_0x8671('0x34')]={'ssml':_0x240309};}else{_0x10a290[_0x8671('0x34')]={'text':_0x240309};};_0x10a290[_0x8671('0x35')]={'languageCode':_0x2371f1,'ssmlGender':_0x58c39b};_0x10a290['audioConfig']={'audioEncoding':_0x8671('0x36'),'sampleRateHertz':0x1f40};var _0x4deb09={'url':_0x2410fc+_0x8671('0x37')+_0x7c1015,'method':_0x8671('0x38'),'json':!![],'body':_0x10a290};return rp(_0x4deb09)[_0x8671('0x2b')](function(_0x1b740c){return new BPromise(function(_0x4bf728,_0x340c31){_0x145a8e=path['resolve'](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+'.mp3');var _0x57d1f2=Buffer['from'](_0x1b740c[_0x8671('0x39')],_0x8671('0x30'));return fs[_0x8671('0x3a')](_0x145a8e,_0x57d1f2,function(_0x2abd98){_0x340c31(_0x2abd98);},function(_0x43cf53){fs[_0x8671('0x3b')](_0x145a8e,'777');_0x4bf728(_0x43cf53);});});})[_0x8671('0x2b')](function(_0x210a2f){_0x4d463f=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x3d'));return convertFile(_0x145a8e,_0x4d463f);})['then'](function(){try{fs[_0x8671('0x1e')](_0x145a8e);fs[_0x8671('0x3b')](_0x4d463f,_0x8671('0x2c'));}catch(_0xeab047){logger[_0x8671('0x17')](_0xeab047);}logger[_0x8671('0x1c')](_0x8671('0x3e'),_0x4d463f[_0x8671('0x2d')]('.')[0x0]);return _0x4d463f[_0x8671('0x2d')]('.')[0x0];});};exports[_0x8671('0x3f')]=function(_0x379d0d,_0x5343ca){var _0x290574=_0x8671('0x40');var _0x1d9591,_0x9e1b86;var _0x2e2173;var _0x178f1c={'encoding':_0x8671('0x41'),'method':_0x8671('0x38'),'timeout':0x2710,'url':_0x290574,'headers':{'Content-Type':_0x8671('0x42')},'body':_0x8671('0x43')+encodeURIComponent(JSON[_0x8671('0x44')]([[[_0x8671('0x45'),JSON[_0x8671('0x44')]([_0x379d0d,_0x5343ca||'en',![],'null']),null,'generic']]]))};return rp(_0x178f1c)[_0x8671('0x2b')](function(_0x1b620f){try{_0x2e2173=eval(_0x1b620f['slice'](0x5))[0x0][0x2];}catch(_0x5771cb){throw new Error('parse\x20response\x20failed:\x0a'+_0x1b620f[_0x8671('0x46')]);}if(!_0x2e2173){if(_0x379d0d[_0x8671('0x47')]>0xc8){throw new Error(_0x8671('0x48'));}else{throw new Error(_0x8671('0x49')+_0x5343ca+_0x8671('0x4a'));}}try{_0x2e2173=eval(_0x2e2173)[0x0];}catch(_0x444af5){throw new Error(_0x8671('0x4b')+res[_0x8671('0x46')]);}const _0x3c1fa0=_0x2e2173;_0x1d9591=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x4c'));fs[_0x8671('0x2a')](_0x1d9591,_0x2e2173,{'encoding':_0x8671('0x30')});_0x9e1b86=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs['generate'](0x4)+_0x8671('0x3d'));return convertFile(_0x1d9591,_0x9e1b86);})[_0x8671('0x2b')](function(){try{fs[_0x8671('0x1e')](_0x1d9591);fs['chmodSync'](_0x9e1b86,_0x8671('0x2c'));}catch(_0x25d23f){logger[_0x8671('0x17')](_0x25d23f);}logger[_0x8671('0x1c')](_0x8671('0x4d'),_0x9e1b86[_0x8671('0x2d')]('.')[0x0]);return _0x9e1b86[_0x8671('0x2d')]('.')[0x0];});};exports[_0x8671('0x4e')]=function(_0xf67933,_0x1ced0d,_0x3ae971){return google[_0x8671('0x4f')](_0xf67933,_0x1ced0d,_0x3ae971)['then'](function(_0x3fe015){logger[_0x8671('0x1c')](_0x3fe015[_0x8671('0x50')]);return rp(_0x3fe015);})['then'](function(_0x2dbc44){var _0x418954='';var _0x5a02a6=0x0;try{fs[_0x8671('0x1e')](_0xf67933);}catch(_0xf0f830){logger[_0x8671('0x17')](_0xf0f830);}if(_0x2dbc44&&_0x2dbc44[_0x8671('0x51')]){_0x418954=_0x2dbc44[_0x8671('0x51')][_0x8671('0x52')](function(_0x28b2ab){return _0x28b2ab&&_0x28b2ab['alternatives'][0x0]&&_0x28b2ab[_0x8671('0x53')][0x0][_0x8671('0x54')]?_0x28b2ab[_0x8671('0x53')][0x0][_0x8671('0x54')]:'';})[_0x8671('0x55')]('\x0a');_0x5a02a6=_0x2dbc44[_0x8671('0x51')][_0x8671('0x52')](function(_0x57acf8){return _0x57acf8&&_0x57acf8[_0x8671('0x53')][0x0]&&_0x57acf8['alternatives'][0x0][_0x8671('0x56')]?_0x57acf8[_0x8671('0x53')][0x0][_0x8671('0x56')]:0x0;})['join']('\x0a');}logger[_0x8671('0x1c')](_0x8671('0x57'),_0x418954);logger[_0x8671('0x1c')](_0x8671('0x58'),_0x5a02a6);return{'transcript':_0x418954,'confidence':_0x5a02a6};})[_0x8671('0x59')](function(_0x5b851b){logger[_0x8671('0x17')](_0x8671('0x5a'),_0x5b851b[_0x8671('0x16')],_0x5b851b[_0x8671('0x5b')],_0x5b851b['message']);});};exports[_0x8671('0x5c')]=function(_0x3a9021,_0x49aa31,_0x4b627e,_0x2c3fad){var _0x228093=apiai(_0x49aa31,{'language':_0x2c3fad||'en'});return _0x228093[_0x8671('0x5d')](_0x4b627e,{'sessionId':md5(_0x3a9021)})[_0x8671('0x2b')](function(_0x17fce5){logger[_0x8671('0x1c')](JSON[_0x8671('0x44')](_0x17fce5));return{'source':_0x17fce5[_0x8671('0x5e')]['source'],'resolvedQuery':_0x17fce5['result'][_0x8671('0x5f')],'action':_0x17fce5['result'][_0x8671('0x60')],'actionIncomplete':_0x17fce5[_0x8671('0x5e')][_0x8671('0x61')],'speech':_0x17fce5[_0x8671('0x5e')]['fulfillment'][_0x8671('0x62')],'score':_0x17fce5[_0x8671('0x5e')][_0x8671('0x63')],'statusCode':_0x17fce5[_0x8671('0x64')]['code'],'endConversation':_0x17fce5[_0x8671('0x5e')]['metadata'][_0x8671('0x65')]||![],'isFallbackIntent':_0x17fce5[_0x8671('0x5e')][_0x8671('0x66')][_0x8671('0x67')]};});};exports['googleDialogflowV2']=function(_0xcddfe7,_0x2656b4,_0x4dbd62,_0x36f9c3,_0x533a9d,_0x434fbe){var _0x3fc179=_0x36f9c3['replace'](/\\n/g,'\x0a');var _0x428554={'credentials':{'private_key':_0x3fc179,'client_email':_0x4dbd62}};var _0x1f88ec=new dialogflow[(_0x8671('0x68'))](_0x428554);var _0x667de1=_0x1f88ec[_0x8671('0x69')](_0x2656b4,md5(_0xcddfe7));var _0x51ba66={'session':_0x667de1,'queryInput':{'text':{'text':_0x533a9d,'languageCode':_0x434fbe}}};return _0x1f88ec['detectIntent'](_0x51ba66)[_0x8671('0x2b')](function(_0x5369d6){if(_0x5369d6&&_0x5369d6['length']){logger['info'](_0x8671('0x6a'),JSON['stringify'](_0x5369d6));var _0x54e7d7=_0x5369d6[0x0];if(_0x54e7d7){var _0x618ac={'action':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x60')],'allRequiredParamsPresent':_0x54e7d7[_0x8671('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x6c')]&&_0x54e7d7[_0x8671('0x6b')]['diagnosticInfo']['fields']?_0x54e7d7[_0x8671('0x6b')][_0x8671('0x6c')][_0x8671('0x6d')][_0x8671('0x6e')][_0x8671('0x6f')]:![],'fulfillmentText':_0x54e7d7[_0x8671('0x6b')]['fulfillmentText'],'intentName':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x70')]['name'],'intentDisplayName':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x70')]['displayName'],'isFallbackIntent':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x70')][_0x8671('0x71')],'languageCode':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x72')],'queryText':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x73')],'responseId':_0x54e7d7['responseId'],'score':_0x54e7d7['queryResult'][_0x8671('0x74')],'speech':_0x54e7d7[_0x8671('0x6b')][_0x8671('0x75')],'providerResponse':JSON[_0x8671('0x44')](_0x5369d6)};return _0x618ac;}}});};exports[_0x8671('0x76')]=function(_0x4c4a52,_0xe6fef8,_0x4ba649,_0x2df97e){return tilde[_0x8671('0x4f')](_0x4c4a52,_0xe6fef8,_0x4ba649,_0x2df97e)['then'](function(_0x436819){try{fs[_0x8671('0x1e')](_0x4c4a52);}catch(_0x3c12fe){logger['error'](_0x3c12fe);}logger[_0x8671('0x1c')](_0x8671('0x77'),_0x436819[_0x8671('0x54')]);logger[_0x8671('0x1c')](_0x8671('0x78'),_0x436819[_0x8671('0x56')]);return _0x436819;});};exports['awsPolly']=function(_0x3f641d,_0x36466d,_0x43da38,_0x6faa2d,_0x341599,_0x2e5c1b){var _0x486973=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x4c'));var _0x275dec;return aws['polly'](_0x3f641d,_0x36466d,_0x43da38,_0x6faa2d,_0x341599,_0x2e5c1b,_0x486973)[_0x8671('0x2b')](function(){_0x275dec=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x3d'));return convertFile(_0x486973,_0x275dec);})[_0x8671('0x2b')](function(){try{fs[_0x8671('0x1e')](_0x486973);fs[_0x8671('0x3b')](_0x275dec,'777');}catch(_0x34f9fb){logger['error'](_0x34f9fb);}return _0x275dec[_0x8671('0x2d')]('.')[0x0];});};exports[_0x8671('0x79')]=function(_0x2981a1,_0x2ba3ec,_0x318624,_0xa4ff17,_0x44df42,_0x56247c){return aws[_0x8671('0x7a')](_0x2981a1,_0x2ba3ec,_0x318624,_0xa4ff17,_0x44df42,_0x56247c)[_0x8671('0x2b')](function(_0x108c93){logger[_0x8671('0x1c')](JSON[_0x8671('0x44')](_0x108c93));return _0x108c93;});};exports['ispeechTTS']=function(_0x5edee2,_0x11785c,_0xbc2fe,_0x11fc53){var _0x2526a9=util[_0x8671('0x7b')](_0x8671('0x7c'),ISPEECH_API,_0x5edee2,encodeURIComponent(_0x11785c),_0xbc2fe,_0x11fc53);var _0x4d4ce4=path[_0x8671('0x3c')](__dirname,'tmp',rs[_0x8671('0x29')](0x4)+_0x8671('0x4c'));var _0x3a438b;return downloadFile(_0x2526a9,_0x4d4ce4)['then'](function(){_0x3a438b=path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs[_0x8671('0x29')](0x4)+_0x8671('0x3d'));return convertFile(_0x4d4ce4,_0x3a438b);})[_0x8671('0x2b')](function(){try{fs[_0x8671('0x1e')](_0x4d4ce4);fs[_0x8671('0x3b')](_0x3a438b,_0x8671('0x2c'));}catch(_0x5620de){logger[_0x8671('0x17')](_0x5620de);}return _0x3a438b[_0x8671('0x2d')]('.')[0x0];});};exports[_0x8671('0x7d')]=function(_0x27880c,_0xd0187a,_0x971f01,_0x318c9f){var _0x2f17a6=util['format'](_0x8671('0x7e'),ISPEECH_API,_0xd0187a,_0x971f01,base64Encode(_0x27880c),_0x318c9f?util[_0x8671('0x7b')](_0x8671('0x7f'),encodeURIComponent(_0x318c9f)):_0x8671('0x80'));return uploadFile(_0x2f17a6)[_0x8671('0x2b')](function(_0xd6ab9e){return querystring[_0x8671('0x81')](_0xd6ab9e);});};exports[_0x8671('0x82')]=function(_0x1faae7,_0x3619f5){return sestek[_0x8671('0x83')](_0x1faae7,_0x3619f5)[_0x8671('0x2b')](function(_0x2a1edb){logger['info'](JSON[_0x8671('0x44')](_0x2a1edb));var _0x4eb722={'speech':_0x2a1edb['text'],'action':_0x2a1edb['channelData']?_0x2a1edb[_0x8671('0x84')][_0x8671('0x85')]:undefined,'actiondata':_0x2a1edb['channelData']?_0x2a1edb['channelData'][_0x8671('0x86')]:undefined};if(_0x2a1edb[_0x8671('0x84')]&&_0x2a1edb[_0x8671('0x84')][_0x8671('0x87')]){return base64Decode(_0x2a1edb[_0x8671('0x84')][_0x8671('0x87')][_0x8671('0x88')],path[_0x8671('0x3c')](__dirname,_0x8671('0x28'),rs['generate'](0x4)+'.wav'))[_0x8671('0x2b')](function(_0x1d0a30){_0x4eb722[_0x8671('0x89')]=_0x1d0a30;return _0x4eb722;});}return _0x4eb722;});};exports[_0x8671('0x8a')]=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 d069cd0..03fa0f6 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 _0x87a5=['./nda'];(function(_0x47d408,_0x581ad4){var _0x700cd2=function(_0x17c587){while(--_0x17c587){_0x47d408['push'](_0x47d408['shift']());}};_0x700cd2(++_0x581ad4);}(_0x87a5,0x1cd));var _0x587a=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x87a5[_0x30cc1a];return _0xb3f18f;};var nda=require(_0x587a('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x49c0=['exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x49c0,0xb5));var _0x049c=function(_0x410e0d,_0x520e45){_0x410e0d=_0x410e0d-0x0;var _0x4d0663=_0x49c0[_0x410e0d];return _0x4d0663;};var nda=require('./nda');module[_0x049c('0x0')]={'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 22b9fcb..931a2d7 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 _0x9090=['Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','ndaactivity_type'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9090,0x17f));var _0x0909=function(_0x29c4b3,_0x37746e){_0x29c4b3=_0x29c4b3-0x0;var _0xc3a251=_0x9090[_0x29c4b3];return _0xc3a251;};'use strict';var rp=require(_0x0909('0x0'));var url=require(_0x0909('0x1'));var logger=require(_0x0909('0x2'))(_0x0909('0x3'));module[_0x0909('0x4')]=function(_0x5466c8,_0x51923f){var _0x2c02f0={'method':_0x0909('0x5'),'uri':url[_0x0909('0x6')](_0x51923f['ndauth_url'],_0x0909('0x7')),'form':{'grant_type':_0x0909('0x8'),'username':_0x51923f[_0x0909('0x9')],'password':_0x51923f[_0x0909('0x8')]},'json':!![]};return rp(_0x2c02f0)[_0x0909('0xa')](function(_0x32bf48){var _0x1755ee={'method':'POST','uri':url[_0x0909('0x6')](_0x51923f[_0x0909('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x51923f[_0x0909('0xc')]||'message','channelId':_0x0909('0xd'),'conversation':{'id':_0x5466c8[_0x0909('0xe')]},'from':{'id':_0x5466c8[_0x0909('0xf')],'name':_0x5466c8[_0x0909('0x10')]},'recipient':{'id':_0x5466c8['dnid'],'name':_0x5466c8[_0x0909('0x11')]},'text':_0x51923f[_0x0909('0x12')],'channelData':{}},'headers':{'Authorization':_0x0909('0x13')+_0x32bf48[_0x0909('0x14')]},'json':!![]};if(_0x51923f['project']){_0x1755ee[_0x0909('0x15')][_0x0909('0x16')][_0x0909('0x17')]=_0x51923f[_0x0909('0x18')];}if(_0x51923f[_0x0909('0x19')]=='1'){_0x1755ee[_0x0909('0x15')][_0x0909('0x16')][_0x0909('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0909('0x1b')};}if(_0x51923f[_0x0909('0x1c')]){_0x1755ee['body'][_0x0909('0x16')][_0x0909('0x1d')]=_0x51923f[_0x0909('0x1c')];if(_0x51923f[_0x0909('0x1e')]){_0x1755ee[_0x0909('0x15')][_0x0909('0x16')][_0x0909('0x1f')]=_0x51923f[_0x0909('0x1e')];}}logger['info'](JSON[_0x0909('0x20')](_0x1755ee));return rp(_0x1755ee);});}; \ No newline at end of file +var _0x4ea3=['dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','ndauth_url','/token','password','username','then','POST','resolve','ndassistant_url','ndaactivity_type','message','callerid','calleridname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ea3,0x70));var _0x34ea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4ea3[_0x5b644e];return _0x49c6bf;};'use strict';var rp=require(_0x34ea('0x0'));var url=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));module['exports']=function(_0x374ec1,_0x494b56){var _0x269d4c={'method':'POST','uri':url['resolve'](_0x494b56[_0x34ea('0x4')],_0x34ea('0x5')),'form':{'grant_type':_0x34ea('0x6'),'username':_0x494b56[_0x34ea('0x7')],'password':_0x494b56[_0x34ea('0x6')]},'json':!![]};return rp(_0x269d4c)[_0x34ea('0x8')](function(_0x22b09e){var _0x5bec7c={'method':_0x34ea('0x9'),'uri':url[_0x34ea('0xa')](_0x494b56[_0x34ea('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x494b56[_0x34ea('0xc')]||_0x34ea('0xd'),'channelId':'Nda','conversation':{'id':_0x374ec1['uniqueid']},'from':{'id':_0x374ec1[_0x34ea('0xe')],'name':_0x374ec1[_0x34ea('0xf')]},'recipient':{'id':_0x374ec1[_0x34ea('0x10')],'name':_0x374ec1['extension']},'text':_0x494b56[_0x34ea('0x11')],'channelData':{}},'headers':{'Authorization':_0x34ea('0x12')+_0x22b09e[_0x34ea('0x13')]},'json':!![]};if(_0x494b56[_0x34ea('0x14')]){_0x5bec7c[_0x34ea('0x15')][_0x34ea('0x16')][_0x34ea('0x17')]=_0x494b56[_0x34ea('0x14')];}if(_0x494b56[_0x34ea('0x18')]=='1'){_0x5bec7c[_0x34ea('0x15')][_0x34ea('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x34ea('0x19')};}if(_0x494b56[_0x34ea('0x1a')]){_0x5bec7c[_0x34ea('0x15')][_0x34ea('0x16')][_0x34ea('0x1b')]=_0x494b56['custom_action'];if(_0x494b56[_0x34ea('0x1c')]){_0x5bec7c[_0x34ea('0x15')][_0x34ea('0x16')][_0x34ea('0x1d')]=_0x494b56['custom_action_data'];}}logger[_0x34ea('0x1e')](JSON[_0x34ea('0x1f')](_0x5bec7c));return rp(_0x5bec7c);});}; \ 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 b4a6ae6..5d257c3 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 _0x5cdd=['./lib/api','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5cdd,0xae));var _0xd5cd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5cdd[_0x42cae2];return _0x5f256f;};'use strict';var asr=require(_0xd5cd('0x0'));module[_0xd5cd('0x1')]=function(_0x107119,_0x120bfd,_0x4ce2c8,_0xc287d1){return asr(_0x107119,_0x120bfd,_0x4ce2c8,_0xc287d1);}; \ No newline at end of file +var _0x84fe=['exports'];(function(_0x47492a,_0x42bc87){var _0x195f98=function(_0x550bcb){while(--_0x550bcb){_0x47492a['push'](_0x47492a['shift']());}};_0x195f98(++_0x42bc87);}(_0x84fe,0xb8));var _0xe84f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x84fe[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require('./lib/api');module[_0xe84f('0x0')]=function(_0x31fb32,_0x50b7b5,_0x100425,_0x4a5fe8){return asr(_0x31fb32,_0x50b7b5,_0x100425,_0x4a5fe8);}; \ 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 c5e9bdf..4dc5a06 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 _0x0852=['Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','message','bluebird','moment','crypto','agi','exports','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','sha1','update','digest','hex','unix','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','info','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.'];(function(_0x48be4e,_0x348220){var _0x26684b=function(_0x4b9179){while(--_0x4b9179){_0x48be4e['push'](_0x48be4e['shift']());}};_0x26684b(++_0x348220);}(_0x0852,0xc2));var _0x2085=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x0852[_0x5f3f88];return _0xd08119;};'use strict';var BPromise=require(_0x2085('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2085('0x1'));var crypto=require(_0x2085('0x2'));var logger=require('../../../../../../config/logger')(_0x2085('0x3'));module[_0x2085('0x4')]=function(_0x47d01b,_0x53d5e2,_0x2fe312,_0x127e1e){return new BPromise(function(_0x5ba2ce,_0xaf15c6){logger['info']('Tilde\x20URI',_0x127e1e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x130cde=new WebSocket(_0x127e1e||_0x2085('0x5'),{'perMessageDeflate':![]});var _0x1cec89='';var _0x242836='0';var _0x52f070='1';var _0x50afae=_0x2085('0x6');function _0x44b919(_0x100033){var _0x1100b8=crypto['createHash'](_0x2085('0x7'));_0x1100b8[_0x2085('0x8')](_0x100033);return _0x1100b8[_0x2085('0x9')](_0x2085('0xa'));}function _0x67e047(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x42b7bc=moment()[_0x2085('0xb')]();var _0x279b2c=_0x44b919(_0x42b7bc+_0x53d5e2+_0x2fe312);_0x130cde['send'](JSON[_0x2085('0xc')]({'appID':_0x53d5e2,'timestamp':_0x42b7bc,'appKey':_0x279b2c}));var _0x410721=fs[_0x2085('0xd')](_0x47d01b);_0x410721['on'](_0x2085('0xe'),function(_0x27499b){_0x130cde[_0x2085('0xf')](_0x27499b);});_0x410721['on'](_0x2085('0x10'),function(){_0x130cde[_0x2085('0xf')](_0x2085('0x11'));});}catch(_0x16551c){logger[_0x2085('0x12')](_0x2085('0x13'),JSON[_0x2085('0xc')](_0x16551c));_0x130cde[_0x2085('0x14')]();}}function _0x54fe8f(_0x3f09f0){try{if(_0x3f09f0){var _0x33911e=JSON[_0x2085('0x15')](_0x3f09f0);switch(_0x33911e[_0x2085('0x16')]){case 0x0:if(_0x33911e['result']){if(_0x33911e[_0x2085('0x17')][_0x2085('0x18')]){logger['info'](_0x2085('0x19'),JSON[_0x2085('0xc')](_0x33911e[_0x2085('0x17')]['hypotheses']));_0x1cec89=_0x33911e[_0x2085('0x17')][_0x2085('0x1a')][0x0][_0x2085('0x1b')];_0x242836=_0x33911e['result'][_0x2085('0x1a')][0x0][_0x2085('0x1c')];_0x52f070='0';_0x50afae=_0x2085('0x1d');_0x130cde[_0x2085('0x14')]();}}break;case 0x1:logger[_0x2085('0x1e')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x52f070='1';_0x50afae=_0x2085('0x6');break;case 0x2:logger[_0x2085('0x1e')](_0x2085('0x1f'));_0x52f070='2';_0x50afae=_0x2085('0x1f');break;case 0x9:logger[_0x2085('0x1e')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x52f070='9';_0x50afae='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x2085('0x20'));_0x52f070='10';_0x50afae=_0x2085('0x20');break;case 0xb:logger[_0x2085('0x1e')](_0x2085('0x21'));_0x52f070='11';_0x50afae=_0x2085('0x21');}}}catch(_0x2700b4){logger[_0x2085('0x12')](_0x2085('0x22'),JSON['stringify'](_0x2700b4));_0x130cde[_0x2085('0x14')]();}}function _0x4dfc24(){logger[_0x2085('0x1e')]('Close\x20Tilde\x20ASR\x20socket');_0x5ba2ce({'transcript':_0x1cec89,'confidence':_0x242836,'status':_0x52f070,'status_message':_0x50afae});}function _0x5aba16(_0x142c77){logger[_0x2085('0x12')](_0x2085('0x23'));if(!_['isNil'](_0x142c77)){logger[_0x2085('0x12')](_[_0x2085('0x24')](_0x142c77)?JSON['stringify'](_0x142c77):_0x142c77);}}_0x130cde['on']('open',_0x67e047);_0x130cde['on'](_0x2085('0x25'),_0x54fe8f);_0x130cde['on'](_0x2085('0x10'),_0x4dfc24);_0x130cde['on'](_0x2085('0x12'),_0x5aba16);});}; \ No newline at end of file +var _0xdb97=['status','result','final','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse'];(function(_0x83aa1a,_0x54c5cb){var _0x162dcb=function(_0x4c8809){while(--_0x4c8809){_0x83aa1a['push'](_0x83aa1a['shift']());}};_0x162dcb(++_0x54c5cb);}(_0xdb97,0x1c8));var _0x7db9=function(_0x15fbd9,_0x735c9c){_0x15fbd9=_0x15fbd9-0x0;var _0x56179f=_0xdb97[_0x15fbd9];return _0x56179f;};'use strict';var BPromise=require(_0x7db9('0x0'));var _=require(_0x7db9('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7db9('0x2'));var crypto=require(_0x7db9('0x3'));var logger=require(_0x7db9('0x4'))('agi');module[_0x7db9('0x5')]=function(_0x3d6fa8,_0x5dab77,_0x27ecfb,_0x5cf2ce){return new BPromise(function(_0x507fa8,_0x56c6d1){logger[_0x7db9('0x6')](_0x7db9('0x7'),_0x5cf2ce||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4fdc56=new WebSocket(_0x5cf2ce||_0x7db9('0x8'),{'perMessageDeflate':![]});var _0x432769='';var _0x284a95='0';var _0x2df8d2='1';var _0x8ea67f=_0x7db9('0x9');function _0x1a310b(_0xe985c){var _0x551958=crypto['createHash'](_0x7db9('0xa'));_0x551958[_0x7db9('0xb')](_0xe985c);return _0x551958[_0x7db9('0xc')]('hex');}function _0x345f12(){try{logger[_0x7db9('0x6')](_0x7db9('0xd'));var _0x5736fb=moment()[_0x7db9('0xe')]();var _0x3ac45e=_0x1a310b(_0x5736fb+_0x5dab77+_0x27ecfb);_0x4fdc56[_0x7db9('0xf')](JSON[_0x7db9('0x10')]({'appID':_0x5dab77,'timestamp':_0x5736fb,'appKey':_0x3ac45e}));var _0x23e870=fs[_0x7db9('0x11')](_0x3d6fa8);_0x23e870['on'](_0x7db9('0x12'),function(_0x36d7bc){_0x4fdc56[_0x7db9('0xf')](_0x36d7bc);});_0x23e870['on'](_0x7db9('0x13'),function(){_0x4fdc56['send']('EOS');});}catch(_0x2df7ae){logger[_0x7db9('0x14')](_0x7db9('0x15'),JSON[_0x7db9('0x10')](_0x2df7ae));_0x4fdc56[_0x7db9('0x16')]();}}function _0x11864a(_0x325ebf){try{if(_0x325ebf){var _0x3b87e3=JSON[_0x7db9('0x17')](_0x325ebf);switch(_0x3b87e3[_0x7db9('0x18')]){case 0x0:if(_0x3b87e3['result']){if(_0x3b87e3[_0x7db9('0x19')][_0x7db9('0x1a')]){logger[_0x7db9('0x6')](_0x7db9('0x1b'),JSON['stringify'](_0x3b87e3[_0x7db9('0x19')]['hypotheses']));_0x432769=_0x3b87e3[_0x7db9('0x19')]['hypotheses'][0x0][_0x7db9('0x1c')];_0x284a95=_0x3b87e3[_0x7db9('0x19')][_0x7db9('0x1d')][0x0][_0x7db9('0x1e')];_0x2df8d2='0';_0x8ea67f=_0x7db9('0x1f');_0x4fdc56[_0x7db9('0x16')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2df8d2='1';_0x8ea67f=_0x7db9('0x9');break;case 0x2:logger[_0x7db9('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2df8d2='2';_0x8ea67f=_0x7db9('0x20');break;case 0x9:logger[_0x7db9('0x6')](_0x7db9('0x21'));_0x2df8d2='9';_0x8ea67f=_0x7db9('0x21');break;case 0xa:logger['info'](_0x7db9('0x22'));_0x2df8d2='10';_0x8ea67f='Authentication\x20failed.';break;case 0xb:logger['info'](_0x7db9('0x23'));_0x2df8d2='11';_0x8ea67f=_0x7db9('0x23');}}}catch(_0x4106f4){logger[_0x7db9('0x14')](_0x7db9('0x24'),JSON[_0x7db9('0x10')](_0x4106f4));_0x4fdc56[_0x7db9('0x16')]();}}function _0x91d612(){logger[_0x7db9('0x6')](_0x7db9('0x25'));_0x507fa8({'transcript':_0x432769,'confidence':_0x284a95,'status':_0x2df8d2,'status_message':_0x8ea67f});}function _0xd12a14(_0x2faec3){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x7db9('0x26')](_0x2faec3)){logger[_0x7db9('0x14')](_['isObject'](_0x2faec3)?JSON[_0x7db9('0x10')](_0x2faec3):_0x2faec3);}}_0x4fdc56['on']('open',_0x345f12);_0x4fdc56['on'](_0x7db9('0x27'),_0x11864a);_0x4fdc56['on'](_0x7db9('0x13'),_0x91d612);_0x4fdc56['on'](_0x7db9('0x14'),_0xd12a14);});}; \ 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 e2c5553..24eda10 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 _0xfedc=['exports','./asr'];(function(_0x1a316b,_0x453dd1){var _0x4b4202=function(_0x423a48){while(--_0x423a48){_0x1a316b['push'](_0x1a316b['shift']());}};_0x4b4202(++_0x453dd1);}(_0xfedc,0x109));var _0xcfed=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xfedc[_0x585133];return _0x18254a;};var asr=require(_0xcfed('0x0'));module[_0xcfed('0x1')]={'asr':asr}; \ No newline at end of file +var _0xee39=['./asr'];(function(_0x1f153d,_0x20935f){var _0x1883d4=function(_0x227075){while(--_0x227075){_0x1f153d['push'](_0x1f153d['shift']());}};_0x1883d4(++_0x20935f);}(_0xee39,0x107));var _0x9ee3=function(_0x50d9f2,_0x305115){_0x50d9f2=_0x50d9f2-0x0;var _0xcd6a7a=_0xee39[_0x50d9f2];return _0xcd6a7a;};var asr=require(_0x9ee3('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 04d4c1c..cfdf267 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 _0xf27b=['./channel','127.0.0.1','error','E_AGI_ARGUMENT_PORT','createServer','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','events','./error'];(function(_0x1a7cc1,_0x19ac20){var _0x224bb0=function(_0x542a2a){while(--_0x542a2a){_0x1a7cc1['push'](_0x1a7cc1['shift']());}};_0x224bb0(++_0x19ac20);}(_0xf27b,0x19a));var _0xbf27=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0xf27b[_0x2a3c4d];return _0x55c390;};'use strict';var util=require(_0xbf27('0x0'));var net=require(_0xbf27('0x1'));var EventEmitter=require(_0xbf27('0x2'))['EventEmitter'];var AGIError=require(_0xbf27('0x3'));var AGIChannel=require(_0xbf27('0x4'));var AGIServer=function(_0x2d8ace,_0x5d16d0,_0x8f4f){var _0x41a230=this,_0x2d8ace=_0x2d8ace||0x11dd,_0x5d16d0=_0x5d16d0||_0xbf27('0x5'),_0x15895e=null,_0xbed03c=0x0;EventEmitter['call'](_0x41a230);function _0x1f27b3(){if(!_0x2d8ace){_0x41a230['emit'](_0xbf27('0x6'),new AGIError(_0xbf27('0x7')));return![];}_0x15895e=net[_0xbf27('0x8')]();_0x15895e['listen'](_0x2d8ace,_0x5d16d0);_0x15895e['on'](_0xbf27('0x9'),function(){_0x41a230[_0xbf27('0xa')](_0xbf27('0x9'));});_0x15895e['on'](_0xbf27('0xb'),function(_0x4babe0){_0x15895e[_0xbf27('0xc')](function(_0x2699af,_0x1fb5a8){if(_0x2699af){_0x41a230[_0xbf27('0xa')](_0xbf27('0x6'),new AGIError(_0xbf27('0xd'),_0x2699af));}else if(_0x8f4f&&_0x8f4f<0x0){_0x41a230[_0xbf27('0xa')]('error',new AGIError(_0xbf27('0xe')));_0x4babe0[_0xbf27('0xf')]();}else if(_0x8f4f&&_0x8f4f>0x0&&_0x8f4f<_0x1fb5a8){_0xbed03c+=0x1;_0x41a230['emit'](_0xbf27('0x6'),new AGIError(_0xbf27('0x10'),_0xbed03c));_0x4babe0['destroy']();}else{var _0x24afdd=new AGIChannel(_0x4babe0);_0x24afdd['on'](_0xbf27('0x11'),function(){_0x41a230[_0xbf27('0xa')](_0xbf27('0xb'),_0x24afdd);});}});});_0x15895e['on']('error',function(_0x20ad34){_0x41a230[_0xbf27('0xa')]('error',new AGIError(_0xbf27('0xd'),_0x20ad34[_0xbf27('0x12')]));});_0x15895e['on'](_0xbf27('0x13'),function(){_0x41a230[_0xbf27('0xa')]('close',new AGIError(_0xbf27('0x14')));});}process[_0xbf27('0x15')](function(){_0x1f27b3();});};util['inherits'](AGIServer,EventEmitter);module[_0xbf27('0x16')]=function(_0x404a9b,_0x29a637,_0xa11620){return new AGIServer(_0x404a9b,_0x29a637,_0xa11620);}; \ No newline at end of file +var _0x295b=['createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','EventEmitter','./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT'];(function(_0xb41283,_0x42775f){var _0x524ef0=function(_0x21f45c){while(--_0x21f45c){_0xb41283['push'](_0xb41283['shift']());}};_0x524ef0(++_0x42775f);}(_0x295b,0x10c));var _0xb295=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x295b[_0x49b207];return _0x2dc8fa;};'use strict';var util=require(_0xb295('0x0'));var net=require('net');var EventEmitter=require('events')[_0xb295('0x1')];var AGIError=require(_0xb295('0x2'));var AGIChannel=require(_0xb295('0x3'));var AGIServer=function(_0x354581,_0x500b19,_0x32202c){var _0x5f29b0=this,_0x354581=_0x354581||0x11dd,_0x500b19=_0x500b19||'127.0.0.1',_0x5226e3=null,_0x14d0c0=0x0;EventEmitter[_0xb295('0x4')](_0x5f29b0);function _0x5bbb25(){if(!_0x354581){_0x5f29b0[_0xb295('0x5')](_0xb295('0x6'),new AGIError(_0xb295('0x7')));return![];}_0x5226e3=net[_0xb295('0x8')]();_0x5226e3[_0xb295('0x9')](_0x354581,_0x500b19);_0x5226e3['on'](_0xb295('0xa'),function(){_0x5f29b0[_0xb295('0x5')](_0xb295('0xa'));});_0x5226e3['on'](_0xb295('0xb'),function(_0x2bdf42){_0x5226e3[_0xb295('0xc')](function(_0x56bc28,_0x22b953){if(_0x56bc28){_0x5f29b0['emit'](_0xb295('0x6'),new AGIError(_0xb295('0xd'),_0x56bc28));}else if(_0x32202c&&_0x32202c<0x0){_0x5f29b0[_0xb295('0x5')](_0xb295('0x6'),new AGIError(_0xb295('0xe')));_0x2bdf42[_0xb295('0xf')]();}else if(_0x32202c&&_0x32202c>0x0&&_0x32202c<_0x22b953){_0x14d0c0+=0x1;_0x5f29b0[_0xb295('0x5')](_0xb295('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x14d0c0));_0x2bdf42[_0xb295('0xf')]();}else{var _0x5cd9b1=new AGIChannel(_0x2bdf42);_0x5cd9b1['on'](_0xb295('0x10'),function(){_0x5f29b0[_0xb295('0x5')](_0xb295('0xb'),_0x5cd9b1);});}});});_0x5226e3['on']('error',function(_0x21da5b){_0x5f29b0['emit'](_0xb295('0x6'),new AGIError(_0xb295('0xd'),_0x21da5b[_0xb295('0x11')]));});_0x5226e3['on'](_0xb295('0x12'),function(){_0x5f29b0[_0xb295('0x5')](_0xb295('0x12'),new AGIError(_0xb295('0x13')));});}process[_0xb295('0x14')](function(){_0x5bbb25();});};util[_0xb295('0x15')](AGIServer,EventEmitter);module[_0xb295('0x16')]=function(_0x19defe,_0x57fa9a,_0xe4586f){return new AGIServer(_0x19defe,_0x57fa9a,_0xe4586f);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index af48f12..5617097 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 _0x6b39=['moment','mustache','request-promise','./scripts','/var/opt/motion2/server/files','getdigits','channel','rpc','prototype','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','random','lastName','phone','list_id','scheduledAt','callback','toString','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','POST','PUT','method','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','uri','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','google_asr_language','tildeASR','appid','appsecret','clear','includes','replaceObjectAllVariables','recursiveNodeIndex','isArray','length','replaceAllVariables','saveRestApiResult','hasOwnProperty','isPlainObject','isEmpty','%s.%s','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','options','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','replace','query:\x20%s','variable_id','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','speech','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','isString','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','googleASR','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','wav','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ispeechASR','ISPEECH_ASR_%s','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','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20operation\x20configured','math\x20%s','operation','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','QUEUE','agi','macro','gosub','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','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','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','command','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','replaceAll','join','exports','shelljs','randomstring'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x6b39,0x1cf));var _0x96b3=function(_0x2b2d33,_0x364135){_0x2b2d33=_0x2b2d33-0x0;var _0x29d035=_0x6b39[_0x2b2d33];return _0x29d035;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require('lodash');var sh=require(_0x96b3('0x0'));var odbc=require('odbc')();var rs=require(_0x96b3('0x1'));var moment=require(_0x96b3('0x2'));var Mustache=require(_0x96b3('0x3'));var rp=require(_0x96b3('0x4'));var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var scripts=require(_0x96b3('0x5'));var FILES_PATH=_0x96b3('0x6');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=['menu',_0x96b3('0x7'),'getsecretdigits'];var AGIVertices=function(_0x22e851,_0x2fa824,_0x1ae3a8){this[_0x96b3('0x8')]=_0x22e851;this[_0x96b3('0x9')]=_0x2fa824;this['mailRpc']=_0x1ae3a8;};AGIVertices[_0x96b3('0xa')]['getVariable']=function(_0x299ced,_0x1a2edd){this[_0x96b3('0x9')][_0x96b3('0xb')](_0x299ced)['then'](function(_0x56903d){_0x1a2edd(null,_0x56903d?_0x56903d[_0x96b3('0xc')]:![]);})[_0x96b3('0xd')](function(_0x309215){_0x1a2edd(_0x309215);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0xe')]=function(_0x3137f8,_0x30f59d){this[_0x96b3('0x9')][_0x96b3('0xf')](_0x3137f8)[_0x96b3('0x10')](function(_0x577f70){_0x30f59d(null,_0x577f70?_0x577f70[_0x96b3('0xc')]:![]);})[_0x96b3('0xd')](function(_0x444329){_0x30f59d(_0x444329);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x11')]=function(_0x2a8af7,_0x384c35){this['rpc'][_0x96b3('0x12')](_0x2a8af7)[_0x96b3('0x10')](function(_0x4bb23c){_0x384c35(null,_0x4bb23c?_0x4bb23c[_0x96b3('0xc')]:![]);})[_0x96b3('0xd')](function(_0x48f412){_0x384c35(_0x48f412);});};AGIVertices['prototype'][_0x96b3('0x13')]=function(_0xde5ea,_0x4c3da7){this[_0x96b3('0x9')][_0x96b3('0x14')](_0xde5ea)[_0x96b3('0x10')](function(_0x363dd4){_0x4c3da7(null,_0x363dd4?_0x363dd4[_0x96b3('0x15')]:![]);})[_0x96b3('0xd')](function(_0x29f22f){_0x4c3da7(_0x29f22f);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x16')]=function(_0x1da2b8,_0x4ccb38){this['rpc'][_0x96b3('0x17')](_0x1da2b8)[_0x96b3('0x10')](function(_0x5b8184){_0x4ccb38(null,_0x5b8184?_0x5b8184[_0x96b3('0xc')]:![]);})[_0x96b3('0xd')](function(_0x3f2390){_0x4ccb38(_0x3f2390);});};AGIVertices['prototype']['getTrunk']=function(_0x54d8fb,_0x19aa18){this[_0x96b3('0x9')][_0x96b3('0x18')](_0x54d8fb)[_0x96b3('0x10')](function(_0x164bae){_0x19aa18(null,_0x164bae?_0x164bae['name']:![]);})[_0x96b3('0xd')](function(_0x380622){_0x19aa18(_0x380622);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x19')]=function(_0x4ec5d1,_0x598fd5){var _0x52ca28=this;this[_0x96b3('0x9')][_0x96b3('0x1a')](_0x4ec5d1)[_0x96b3('0x10')](function(_0x52af64){_0x598fd5(null,_0x52af64?_0x52ca28[_0x96b3('0x1b')](_0x52af64['save_name']):![]);})[_0x96b3('0xd')](function(_0xd36f75){_0x598fd5(_0xd36f75);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x1c')]=function(_0x752bfb,_0x2d5cb8){this[_0x96b3('0x9')][_0x96b3('0x1d')](_0x752bfb)[_0x96b3('0x10')](function(_0x1fb937){_0x2d5cb8(null,_0x1fb937?_0x1fb937:![]);})[_0x96b3('0xd')](function(_0x1cb414){_0x2d5cb8(_0x1cb414);});};AGIVertices['prototype'][_0x96b3('0x1e')]=function(_0x3478f4,_0x4da34,_0x5d67d0){this[_0x96b3('0x1f')][_0x96b3('0x1e')](_0x3478f4,_0x4da34)[_0x96b3('0x10')](function(){_0x5d67d0(null);})[_0x96b3('0xd')](function(_0x11ce34){_0x5d67d0(_0x11ce34);});};AGIVertices[_0x96b3('0xa')]['getIntervals']=function(_0x1a384c,_0x31b29c){this[_0x96b3('0x9')]['getIntervalById'](_0x1a384c)[_0x96b3('0x10')](function(_0x59ba6e){if(_0x59ba6e){if(_0x59ba6e[_0x96b3('0x20')]){_0x31b29c(null,[_0x59ba6e[_0x96b3('0x21')]]);}else{_0x31b29c(null,_[_0x96b3('0x22')](_0x59ba6e[_0x96b3('0x23')],_0x96b3('0x21')));}}else{_0x31b29c(null,![]);}})[_0x96b3('0xd')](function(_0x1f1573){_0x31b29c(_0x1f1573);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x1b')]=function(_0x40fd2f){return util[_0x96b3('0x24')](_0x96b3('0x25'),FILES_PATH,_0x40fd2f);};AGIVertices[_0x96b3('0xa')][_0x96b3('0x26')]=function(_0x2f59b1,_0x4ea40e,_0x152de6){odbc['open'](_0x2f59b1,function(_0x5c0f25){if(_0x5c0f25){logger['error'](_0x96b3('0x27'),_0x5c0f25);_0x152de6(_0x5c0f25);}else{logger[_0x96b3('0x28')](_0x96b3('0x29'));odbc['query'](_0x4ea40e,function(_0x8812ae,_0x120a0d){if(_0x8812ae){logger['info']('Error\x20executing\x20query\x20%s',_0x4ea40e);_0x152de6(_0x8812ae);}else{logger[_0x96b3('0x28')]('Query\x20executed\x20correctly\x20%s',_0x4ea40e);odbc[_0x96b3('0x2a')](function(_0xfd92dd){if(_0xfd92dd){logger[_0x96b3('0x2b')](_0x96b3('0x2c'),_0xfd92dd);}_0x152de6(null,_0x120a0d);});}});}});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x2d')]=function(_0x1a4521,_0x576081){this[_0x96b3('0x9')][_0x96b3('0x2e')](_0x1a4521)[_0x96b3('0x10')](function(_0x2552cc){_0x576081(null,_0x2552cc?_0x2552cc:![]);})['catch'](function(_0x482e7a){_0x576081(_0x482e7a);});};AGIVertices['prototype']['createSmsMessage']=function(_0x5e7a1d,_0x4825d2){this[_0x96b3('0x9')][_0x96b3('0x2f')](_0x5e7a1d)[_0x96b3('0x10')](function(_0x3dfbe7){_0x4825d2(null,_0x3dfbe7);})[_0x96b3('0xd')](function(_0x244020){_0x4825d2(_0x244020);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x30')]=function(_0x12e00d,_0x24db3a,_0x1397f9){this[_0x96b3('0x9')][_0x96b3('0x30')]({'uniqueid':this['channel'][_0x96b3('0x31')],'node':_0x12e00d[_0x96b3('0x32')],'application':_0x12e00d[_0x96b3('0x33')],'data':_0x24db3a||null,'project_name':this['channel'][_0x96b3('0x34')],'callerid':this[_0x96b3('0x8')][_0x96b3('0x35')]})[_0x96b3('0x10')](function(_0xa960af){if(_0x1397f9){_0x1397f9(null,_0xa960af);}})[_0x96b3('0xd')](function(_0x3cd871){if(_0x1397f9){_0x1397f9(_0x3cd871);}});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x36')]=function(_0x2ef8e5,_0x527dd5,_0x40e205,_0x591350){this[_0x96b3('0x9')][_0x96b3('0x36')]({'uniqueid':this[_0x96b3('0x8')][_0x96b3('0x31')],'callerid':this[_0x96b3('0x8')][_0x96b3('0x35')],'calleridname':this[_0x96b3('0x8')][_0x96b3('0x37')],'context':this['channel'][_0x96b3('0x38')],'extension':this[_0x96b3('0x8')][_0x96b3('0x39')],'priority':this[_0x96b3('0x8')][_0x96b3('0x3a')],'accountcode':this[_0x96b3('0x8')][_0x96b3('0x3b')],'dnid':this[_0x96b3('0x8')][_0x96b3('0x3c')],'projectName':this[_0x96b3('0x8')][_0x96b3('0x34')],'saveName':_0x527dd5,'filename':_0x2ef8e5[_0x96b3('0x3d')]||_0x527dd5,'savePath':_0x40e205})[_0x96b3('0x10')](function(_0x3d9e52){_0x591350(null,_0x3d9e52);})['catch'](function(_0x1fb1c7){_0x591350(_0x1fb1c7);});};AGIVertices['prototype'][_0x96b3('0x3e')]=function(_0x5ee555,_0x551fac,_0x3576cc,_0x1e67bd,_0x477ea7){this[_0x96b3('0x9')]['createSquareMessage']({'uniqueid':this[_0x96b3('0x8')][_0x96b3('0x31')],'body':_0x5ee555,'direction':_0x551fac,'providerName':_0x3576cc,'providerResponse':_0x1e67bd})['then'](function(_0x14e813){if(_0x477ea7){_0x477ea7(null,_0x14e813);}})['catch'](function(_0x50c721){if(_0x477ea7){_0x477ea7(_0x50c721);}});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x3f')]=function(_0x3c63ac,_0xacbafe){this[_0x96b3('0x9')][_0x96b3('0x3f')]({'firstName':_['isEmpty'](_0x3c63ac[_0x96b3('0xc')])||_[_0x96b3('0x40')](_0x3c63ac['name'])?'callback_'+Math[_0x96b3('0x41')]():_0x3c63ac['name'],'lastName':_['isEmpty'](_0x3c63ac[_0x96b3('0x42')])||_[_0x96b3('0x40')](_0x3c63ac[_0x96b3('0x42')])?null:_0x3c63ac[_0x96b3('0x42')],'phone':_0x3c63ac[_0x96b3('0x43')],'ListId':_0x3c63ac[_0x96b3('0x44')],'scheduledat':_0x3c63ac[_0x96b3('0x45')],'callbackUniqueid':this[_0x96b3('0x8')][_0x96b3('0x31')],'tags':_0x96b3('0x46'),'description':'Callback\x20scheduled\x20at\x20'+_0x3c63ac[_0x96b3('0x45')][_0x96b3('0x47')](),'priority':_0x3c63ac['callback_priority']})[_0x96b3('0x10')](function(_0x104789){_0xacbafe(null,_0x104789);})[_0x96b3('0xd')](function(_0x314ece){_0xacbafe(_0x314ece);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x48')]=function(_0x39d44a,_0x286acd){this[_0x96b3('0x9')][_0x96b3('0x49')](_0x39d44a)[_0x96b3('0x10')](function(_0x39e701){_0x286acd(null,_0x39e701?_0x39e701[_0x96b3('0xc')]:![]);})[_0x96b3('0xd')](function(_0x5dff7e){_0x286acd(_0x5dff7e);});};AGIVertices[_0x96b3('0xa')]['agentPause']=function(_0x23c17f,_0x47846d,_0x281227){var _0x16c9dc={'role':_0x96b3('0x4a')};_0x16c9dc[_0x23c17f]=this[_0x96b3('0x8')]['callerid'];this[_0x96b3('0x9')][_0x96b3('0x4b')](_0x16c9dc,_0x47846d,this[_0x96b3('0x8')][_0x96b3('0x31')])['then'](function(_0x1a48ad){_0x281227(null,_[_0x96b3('0x40')](_0x1a48ad)?![]:!![]);})['catch'](function(_0x34ca64){logger[_0x96b3('0x2b')](_0x34ca64);_0x281227(null,![]);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x4c')]=function(_0x7c13d9,_0x13c6e1){var _0x4cdb60={'role':_0x96b3('0x4a')};_0x4cdb60[_0x7c13d9]=this[_0x96b3('0x8')][_0x96b3('0x35')];this['rpc'][_0x96b3('0x4c')](_0x4cdb60)[_0x96b3('0x10')](function(_0x38111c){_0x13c6e1(null,_[_0x96b3('0x40')](_0x38111c)?![]:!![]);})[_0x96b3('0xd')](function(_0x5eb608){logger[_0x96b3('0x2b')](_0x5eb608);_0x13c6e1(null,![]);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x4d')]=function(_0x496661,_0x332f40){var _0x14e50c={'role':_0x96b3('0x4a')};_0x14e50c[_0x496661]=this[_0x96b3('0x8')][_0x96b3('0x35')];this[_0x96b3('0x9')]['agentLogout'](_0x14e50c)[_0x96b3('0x10')](function(_0x3b05a9){_0x332f40(null,_['isNil'](_0x3b05a9)?![]:!![]);})[_0x96b3('0xd')](function(_0x80668e){logger[_0x96b3('0x2b')](_0x80668e);_0x332f40(null,![]);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x4e')]=function(_0x187235,_0x5669d8){var _0x1352d4={'role':_0x96b3('0x4a')};_0x1352d4[_0x187235]=this[_0x96b3('0x8')]['callerid'];var _0x422e10=_0x187235!='internal'?util[_0x96b3('0x24')](_0x96b3('0x4f'),_0x96b3('0x50'),this[_0x96b3('0x8')][_0x96b3('0x35')]):undefined;this[_0x96b3('0x9')]['agentLogin'](_0x1352d4,_0x422e10)[_0x96b3('0x10')](function(_0x5a4c5e){_0x5669d8(null,_[_0x96b3('0x40')](_0x5a4c5e)?![]:!![]);})[_0x96b3('0xd')](function(_0x40f005){logger['error'](_0x40f005);_0x5669d8(null,![]);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x51')]=function(_0x249369,_0x701063){sh[_0x96b3('0x52')](_[_0x96b3('0x53')](_0x249369),function(_0x40730d,_0x547690){var _0x4f533d=_0x547690['replace'](/(\r\n|\n|\r)/gm,'');_0x701063(null,_0x4f533d);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x54')]=function(_0x2ff244,_0xa7b3c){scripts['googleCloudTTS'](_0x2ff244[_0x96b3('0x55')],_0x2ff244[_0x96b3('0x56')]||_0x96b3('0x57'),_0x2ff244[_0x96b3('0x57')],_0x2ff244[_0x96b3('0x58')]||_0x96b3('0x59'),_0x2ff244[_0x96b3('0x5a')]||_0x96b3('0x5b'),_0x2ff244[_0x96b3('0x5c')]||_0x96b3('0x5d'))[_0x96b3('0x10')](function(_0x4371e1){_0xa7b3c(null,_0x4371e1);})[_0x96b3('0xd')](function(_0x474afe){_0xa7b3c(_0x474afe);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x5e')]=function(_0x10cff5,_0x1d788b){scripts[_0x96b3('0x5e')](_0x10cff5[_0x96b3('0x57')],_0x10cff5[_0x96b3('0x5f')]||'en',0x1)[_0x96b3('0x10')](function(_0x4f83cc){_0x1d788b(null,_0x4f83cc);})[_0x96b3('0xd')](function(_0x1e4b33){_0x1d788b(_0x1e4b33);});};AGIVertices['prototype']['restAPI']=function(_0x4bc7c5,_0x2d2a6f){var _0x256c01={'uri':_0x4bc7c5[_0x96b3('0x60')],'method':_0x4bc7c5['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4bc7c5['timeout'])==='number'&&parseInt(_0x4bc7c5[_0x96b3('0x61')])>=0x1?parseInt(_0x4bc7c5['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x96b3('0x62'),_0x96b3('0x63')],_0x256c01[_0x96b3('0x64')][_0x96b3('0x65')]())){try{_0x256c01['body']=_0x4bc7c5[_0x96b3('0x66')]?JSON[_0x96b3('0x67')](_0x4bc7c5['rawBody']):{};}catch(_0x4d5b89){logger[_0x96b3('0x2b')](_0x96b3('0x68'),_0x4d5b89);}}try{_0x256c01[_0x96b3('0x69')]=_0x4bc7c5[_0x96b3('0x6a')]?JSON[_0x96b3('0x67')](_0x4bc7c5[_0x96b3('0x6a')]):{};}catch(_0x513101){logger[_0x96b3('0x2b')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x513101);}if(_0x4bc7c5['computedVariables']){try{var _0x4339d6=require(_0x4bc7c5[_0x96b3('0x6b')])[_0x96b3('0x6c')](this,_0x256c01);_0x256c01[_0x96b3('0x6d')]=Mustache['render'](_0x4bc7c5[_0x96b3('0x60')],_0x4339d6,{},['$$','$$']);if(_0x256c01[_0x96b3('0x69')]){_0x256c01[_0x96b3('0x69')]=JSON[_0x96b3('0x67')](Mustache['render'](JSON[_0x96b3('0x6e')](_0x256c01['headers']),_0x4339d6,{},['$$','$$']));}if(_0x256c01[_0x96b3('0x6f')]){_0x256c01[_0x96b3('0x6f')]=JSON[_0x96b3('0x67')](Mustache['render'](JSON['stringify'](_0x256c01[_0x96b3('0x6f')]),_0x4339d6,{},['$$','$$']));}}catch(_0x1d5174){logger['error'](_0x96b3('0x70'),_0x1d5174);}}rp(_0x256c01)[_0x96b3('0x10')](function(_0x232c6a){var _0x1c9c10={'statusCode':_0x232c6a['statusCode']||0xc8,'statusMessage':_0x232c6a[_0x96b3('0x71')]||'OK','headers':_0x232c6a['headers']||{},'body':_0x232c6a[_0x96b3('0x6f')]||{}};_0x2d2a6f(null,_0x1c9c10);})[_0x96b3('0xd')](function(_0x87f06a){var _0x30e5eb={'statusCode':_0x87f06a['statusCode']||0x1f4,'statusMessage':_0x87f06a[_0x96b3('0x72')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x87f06a['options'][_0x96b3('0x69')]||{},'body':_0x87f06a['options']['body']||{}};_0x2d2a6f(null,_0x30e5eb);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x73')]=function(_0x895c55,_0x5495db){scripts['googleDialogflow'](this[_0x96b3('0x8')][_0x96b3('0x31')],_0x895c55[_0x96b3('0x74')],_0x895c55[_0x96b3('0x57')],_0x895c55[_0x96b3('0x75')]||'en')[_0x96b3('0x10')](function(_0xc23cdf){_0x5495db(null,_0xc23cdf);})[_0x96b3('0xd')](function(_0x2cf26a){_0x5495db(_0x2cf26a);});};AGIVertices[_0x96b3('0xa')]['googleDialogflowV2']=function(_0x59cece,_0x2047de){scripts[_0x96b3('0x76')](this[_0x96b3('0x8')]['uniqueid'],_0x59cece['dialogflowV2_project_id'],_0x59cece[_0x96b3('0x77')],_0x59cece[_0x96b3('0x78')],_0x59cece[_0x96b3('0x57')],_0x59cece[_0x96b3('0x79')]||'en')[_0x96b3('0x10')](function(_0x2d083b){_0x2047de(null,_0x2d083b);})[_0x96b3('0xd')](function(_0x18b505){_0x2047de(_0x18b505);});};AGIVertices['prototype'][_0x96b3('0x7a')]=function(_0x89c283,_0x465f52){scripts['sestekNDA'](this['channel'],_0x89c283)['then'](function(_0x3d6425){_0x465f52(null,_0x3d6425);})[_0x96b3('0xd')](function(_0x260dc2){_0x465f52(_0x260dc2);});};AGIVertices['prototype'][_0x96b3('0x7b')]=function(_0x4911da,_0x348180){scripts[_0x96b3('0x7b')](_0x4911da[_0x96b3('0x74')],_0x4911da[_0x96b3('0x57')],_0x4911da[_0x96b3('0x7c')]||_0x96b3('0x59'),_0x4911da[_0x96b3('0x7d')])[_0x96b3('0x10')](function(_0x55bc7b){_0x348180(null,_0x55bc7b);})[_0x96b3('0xd')](function(_0x36346c){_0x348180(_0x36346c);});};AGIVertices[_0x96b3('0xa')]['ispeechASR']=function(_0x274158,_0x3b5e27,_0x448039){scripts['ispeechASR'](_0x3b5e27,_0x274158[_0x96b3('0x74')],_0x274158['ispeech_asr_language']||'en-US',this[_0x96b3('0x7e')](_0x274158[_0x96b3('0x7f')])?_0x274158[_0x96b3('0x7f')]:undefined)['then'](function(_0x14b20c){_0x448039(null,_0x14b20c);})[_0x96b3('0xd')](function(_0x19537f){_0x448039(_0x19537f);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x80')]=function(_0x10528e,_0x5bb1a9){scripts[_0x96b3('0x80')](_0x10528e[_0x96b3('0x81')],_0x10528e['aws_secret_access_key'],_0x10528e[_0x96b3('0x82')],_0x10528e[_0x96b3('0x83')]||_0x96b3('0x84'),_0x10528e['text'],_0x10528e[_0x96b3('0x85')]||'text')[_0x96b3('0x10')](function(_0x4169ae){_0x5bb1a9(null,_0x4169ae);})[_0x96b3('0xd')](function(_0x1a51eb){_0x5bb1a9(_0x1a51eb);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x86')]=function(_0x51f08e,_0x306edb){scripts[_0x96b3('0x86')](this[_0x96b3('0x8')][_0x96b3('0x31')],_0x51f08e[_0x96b3('0x81')],_0x51f08e['aws_secret_access_key'],_0x51f08e[_0x96b3('0x87')],_0x51f08e[_0x96b3('0x57')],_0x51f08e[_0x96b3('0x88')])[_0x96b3('0x10')](function(_0x456b7c){_0x306edb(null,_0x456b7c);})[_0x96b3('0xd')](function(_0x370c0e){_0x306edb(_0x370c0e);});};AGIVertices[_0x96b3('0xa')]['googleASR']=function(_0x5ee8b0,_0x48daab,_0x56b760){scripts['googleASR'](_0x48daab,_0x5ee8b0[_0x96b3('0x74')],_0x5ee8b0[_0x96b3('0x89')]||'en-US')[_0x96b3('0x10')](function(_0x10bdc6){_0x56b760(null,_0x10bdc6);})[_0x96b3('0xd')](function(_0x1f8a91){_0x56b760(_0x1f8a91);});};AGIVertices[_0x96b3('0xa')][_0x96b3('0x8a')]=function(_0x336f47,_0x24abd9,_0x38c334){scripts[_0x96b3('0x8a')](_0x24abd9,_0x336f47[_0x96b3('0x8b')],_0x336f47[_0x96b3('0x8c')],_0x336f47[_0x96b3('0x6d')])[_0x96b3('0x10')](function(_0x533d18){_0x38c334(null,_0x533d18);})[_0x96b3('0xd')](function(_0x5242b2){_0x38c334(_0x5242b2);});};AGIVertices['prototype'][_0x96b3('0x8d')]=function(_0x286eba){var _0x82d7c4=_[_0x96b3('0x8e')](verticesWithRetry,_0x286eba[_0x96b3('0x33')])?_0x286eba:_['clone'](_0x286eba);for(var _0x4e624f in _0x82d7c4){if(_0x82d7c4['hasOwnProperty'](_0x4e624f)){if(_0x82d7c4[_0x4e624f]&&_['isString'](_0x82d7c4[_0x4e624f])){if(_[_0x96b3('0x8e')](recursiveMapAttributes,_0x4e624f)){_0x82d7c4[_0x4e624f]=this[_0x96b3('0x8f')](_0x82d7c4[_0x4e624f]);}else{_0x82d7c4[_0x4e624f]=this['replaceAllVariables'](_0x82d7c4[_0x4e624f]);}}}}return _0x82d7c4;};AGIVertices[_0x96b3('0xa')]['recursiveNodeIndex']=function(_0x28dafa){for(var _0x1cf005 in _0x28dafa){if(_0x28dafa['hasOwnProperty'](_0x1cf005)){if(_['isPlainObject'](_0x28dafa[_0x1cf005])){this[_0x96b3('0x90')](_0x28dafa[_0x1cf005]);}else if(_[_0x96b3('0x91')](_0x28dafa[_0x1cf005])){for(var _0x5661c9=0x0;_0x5661c9<_0x28dafa[_0x1cf005][_0x96b3('0x92')];_0x5661c9++){this[_0x96b3('0x90')](_0x28dafa[_0x1cf005][_0x5661c9]);}}else if(_['isString'](_0x28dafa[_0x1cf005])){_0x28dafa[_0x1cf005]=this[_0x96b3('0x93')](_0x28dafa[_0x1cf005]);}}}};AGIVertices[_0x96b3('0xa')][_0x96b3('0x94')]=function(_0x409cb7,_0x33f498){for(var _0x23736d in _0x409cb7){if(_0x409cb7[_0x96b3('0x95')](_0x23736d)){if(_[_0x96b3('0x96')](_0x409cb7[_0x23736d])){if(!_[_0x96b3('0x97')](_0x409cb7[_0x23736d])){this[_0x96b3('0x94')](_0x409cb7[_0x23736d],util[_0x96b3('0x24')](_0x96b3('0x98'),_0x33f498,_0x23736d));}}else if(_[_0x96b3('0x91')](_0x409cb7[_0x23736d])){for(var _0x45c7d2=0x0;_0x45c7d2<_0x409cb7[_0x23736d][_0x96b3('0x92')];_0x45c7d2++){this[_0x96b3('0x94')](_0x409cb7[_0x23736d][_0x45c7d2],util['format'](_0x96b3('0x98'),_0x33f498,_0x23736d+'['+_0x45c7d2+']'));}}else{if(!_[_0x96b3('0x40')](_0x409cb7[_0x23736d])){this[_0x96b3('0x8')]['setVariable'](util[_0x96b3('0x24')]('%s.%s',_0x33f498,_0x23736d),_0x409cb7[_0x23736d]);}}}}};AGIVertices[_0x96b3('0xa')][_0x96b3('0x8f')]=function(_0x58414d){try{var _0x26ab86=JSON[_0x96b3('0x67')](_0x58414d);this[_0x96b3('0x90')](_0x26ab86);return JSON['stringify'](_0x26ab86);}catch(_0x264291){return this[_0x96b3('0x93')](_0x58414d);}};AGIVertices['prototype'][_0x96b3('0x93')]=function(_0xa66dc5){var _0x4a5ace=_0xa66dc5['split']('{');for(var _0x1798fa=0x1;_0x1798fa<_0x4a5ace[_0x96b3('0x92')];_0x1798fa+=0x1){var _0x1c9df2=_0x4a5ace[_0x1798fa]['split']('}');if(_0x1c9df2['length']>0x1){_0xa66dc5=_0xa66dc5['replaceAll']('{'+_0x1c9df2[0x0]+'}',this[_0x96b3('0x8')][_0x96b3('0x99')](_0x1c9df2[0x0])[_0x96b3('0x9a')]||_0x1c9df2[0x0]);}}if(_0x4a5ace[_0x96b3('0x92')]===0x1){return _0xa66dc5[_0x96b3('0x47')]();}return this[_0x96b3('0x93')](_0xa66dc5);};AGIVertices['prototype'][_0x96b3('0x9b')]=function(_0xa8d01f,_0x147cad){var _0x263a06=this[_0x96b3('0x8')][_0x96b3('0x99')](_0xa8d01f);if(_0x263a06['result']===-0x1){return _0x263a06;}logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x9c'),_0x147cad,_0x263a06['extra']));return this[_0x96b3('0x8')]['setVariable'](_0x147cad,_0x263a06[_0x96b3('0x9a')]);};AGIVertices[_0x96b3('0xa')]['isConfigured']=function(_0x261bd9){return _0x261bd9&&_0x261bd9!=='0'&&_0x261bd9!=='-1'&&_0x261bd9!=='';};AGIVertices[_0x96b3('0xa')][_0x96b3('0x9d')]=function(_0x683bc1){this[_0x96b3('0x30')][_0x96b3('0x6c')](this,_0x683bc1,'-');_0x683bc1[_0x96b3('0x9e')]=_0x683bc1[_0x96b3('0x9d')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x96b3('0xa')][_0x96b3('0x9f')]=function(_0x2ee8ae){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0xa0'),_0x2ee8ae[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x2ee8ae[_0x96b3('0x57')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')]('no\x20text\x20configured');}var _0x133d4e='\x22'+_0x2ee8ae[_0x96b3('0x57')]+'\x22';if(this[_0x96b3('0x7e')](_0x2ee8ae[_0x96b3('0xa2')])){_0x133d4e+=','+_0x2ee8ae[_0x96b3('0xa2')];}var _0x155154=this['channel'][_0x96b3('0x52')](_0x96b3('0xa3'),_0x133d4e);if(_0x155154[_0x96b3('0xa4')]===-0x1){return _0x155154;}return this[_0x96b3('0x8')]['noop'](util[_0x96b3('0x24')](_0x96b3('0xa5'),_0x133d4e));};AGIVertices[_0x96b3('0xa')][_0x96b3('0xa6')]=function(_0x1cd69e){logger['info'](util[_0x96b3('0x24')](_0x96b3('0xa7'),_0x1cd69e['label']));if(!this[_0x96b3('0x7e')](_0x1cd69e['grammar'])){return this[_0x96b3('0x8')][_0x96b3('0xa1')]('no\x20grammar\x20configured');}var _0x4b0bf7=_0x1cd69e[_0x96b3('0xa8')];if(this[_0x96b3('0x7e')](_0x1cd69e[_0x96b3('0xa2')])){_0x4b0bf7+=','+_0x1cd69e[_0x96b3('0xa2')];}var _0x1d52fa=this[_0x96b3('0x8')]['exec'](_0x96b3('0xa9'),_0x4b0bf7);if(_0x1d52fa[_0x96b3('0xa4')]===-0x1){return _0x1d52fa;}var _0xb3779d=this['getAndSetVariable'](_0x96b3('0xaa'),_0x96b3('0xab'));if(_0xb3779d['result']===-0x1){return _0xb3779d;}var _0x23f261=this[_0x96b3('0x9b')](_0x96b3('0xac'),'MRCP_RECOG_TRANSCRIPT');if(_0x23f261[_0x96b3('0xa4')]===-0x1){return _0x23f261;}var _0x546001=this['getAndSetVariable'](_0x96b3('0xad'),'MRCP_RECOG_INSTANCE');if(_0x546001[_0x96b3('0xa4')]===-0x1){return _0x546001;}return this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4b0bf7));};AGIVertices[_0x96b3('0xa')]['agi']=function(_0x15d039){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0xae'),_0x15d039[_0x96b3('0x32')]));return this[_0x96b3('0x8')]['agi']([_0x15d039['command'],_0x15d039['args']]);};AGIVertices[_0x96b3('0xa')][_0x96b3('0xaf')]=function(_0x577d63){logger[_0x96b3('0x28')](util['format'](_0x96b3('0xb0'),_0x577d63[_0x96b3('0x32')]));if(this['isConfigured'](_0x577d63[_0x96b3('0x61')])){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0xb1'),_0x577d63[_0x96b3('0x61')]));var _0x4f0d89=this[_0x96b3('0x8')][_0x96b3('0xb2')](_0x577d63[_0x96b3('0x61')]);if(_0x4f0d89[_0x96b3('0xa4')]===-0x1){return _0x4f0d89;}}return this['channel']['answer']();};AGIVertices['prototype']['callback']=function(_0x3a0ee4){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0xb3'),_0x3a0ee4[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x3a0ee4[_0x96b3('0x44')])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x3a0ee4,_0x96b3('0xb4'));}_0x3a0ee4[_0x96b3('0x45')]=moment();if(this['isConfigured'](_0x3a0ee4[_0x96b3('0xb5')])){_0x3a0ee4['scheduledAt']=moment()[_0x96b3('0xb6')](_0x3a0ee4[_0x96b3('0xb5')],'minutes');}if(!this[_0x96b3('0x7e')](_0x3a0ee4[_0x96b3('0xb7')])){_0x3a0ee4[_0x96b3('0xb7')]=0x2;}this[_0x96b3('0x3f')][_0x96b3('0x6c')](this,_0x3a0ee4);return this[_0x96b3('0x8')]['noop'](util[_0x96b3('0x24')](_0x96b3('0xb8'),_0x3a0ee4[_0x96b3('0x43')],_0x3a0ee4['list_id'],_0x3a0ee4[_0x96b3('0x45')]));};AGIVertices[_0x96b3('0xa')][_0x96b3('0xb9')]=function(_0x22fecd){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0xba'),_0x22fecd[_0x96b3('0x32')]));var _0x1cdd63=this['channel']['exec'](_0x22fecd['application'],_0x22fecd[_0x96b3('0xa2')]);if(_0x1cdd63['result']===-0x1){return _0x1cdd63;}return this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xbb'),_0x22fecd[_0x96b3('0xbc')],_0x22fecd[_0x96b3('0xa2')]));};AGIVertices[_0x96b3('0xa')][_0x96b3('0xbd')]=function(_0x19a705){logger['info'](util[_0x96b3('0x24')](_0x96b3('0xbe'),_0x19a705[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x19a705[_0x96b3('0x57')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xbf'));}var _0x50d0d4='\x22'+_0x19a705[_0x96b3('0x57')]+'\x22';if(this[_0x96b3('0x7e')](_0x19a705[_0x96b3('0xa2')])){_0x50d0d4+=','+_0x19a705[_0x96b3('0xa2')];}var _0x2aa55d=this[_0x96b3('0x8')][_0x96b3('0x52')](_0x96b3('0xa3'),_0x50d0d4);if(_0x2aa55d[_0x96b3('0xa4')]===-0x1){return _0x2aa55d;}return this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xa5'),_0x50d0d4));};AGIVertices[_0x96b3('0xa')][_0x96b3('0xc0')]=function(_0x327cd3){logger[_0x96b3('0x28')](util['format'](_0x96b3('0xc1'),_0x327cd3[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x327cd3[_0x96b3('0x57')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xbf'));}var _0x2bcde7='\x22'+_0x327cd3[_0x96b3('0x57')]+'\x22';if(this[_0x96b3('0x7e')](_0x327cd3['options'])){_0x2bcde7+=','+_0x327cd3[_0x96b3('0xa2')];}var _0x525cc7=this['channel']['exec'](_0x96b3('0xa3'),_0x2bcde7);if(_0x525cc7[_0x96b3('0xa4')]===-0x1){return _0x525cc7;}return this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xa5'),_0x2bcde7));};AGIVertices[_0x96b3('0xa')]['lumenvoxasr']=function(_0x4c0a91){logger['info'](util['format'](_0x96b3('0xc2'),_0x4c0a91[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x4c0a91[_0x96b3('0xa8')])){return this['channel'][_0x96b3('0xa1')](_0x96b3('0xc3'));}var _0x4136fe=_0x4c0a91[_0x96b3('0xa8')];if(this['isConfigured'](_0x4c0a91[_0x96b3('0xa2')])){_0x4136fe+=','+_0x4c0a91[_0x96b3('0xa2')];}var _0x11fa37=this[_0x96b3('0x8')][_0x96b3('0x52')]('MRCPRecog',_0x4136fe);if(_0x11fa37[_0x96b3('0xa4')]===-0x1){return _0x11fa37;}var _0x5e7916=this[_0x96b3('0x9b')](_0x96b3('0xaa'),_0x96b3('0xc4'));if(_0x5e7916[_0x96b3('0xa4')]===-0x1){return _0x5e7916;}var _0x1b7d3f=this[_0x96b3('0x9b')](_0x96b3('0xac'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x1b7d3f[_0x96b3('0xa4')]===-0x1){return _0x1b7d3f;}var _0x523c87=this[_0x96b3('0x9b')](_0x96b3('0xad'),_0x96b3('0xc5'));if(_0x523c87[_0x96b3('0xa4')]===-0x1){return _0x523c87;}return this[_0x96b3('0x8')]['noop'](util[_0x96b3('0x24')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4136fe));};AGIVertices[_0x96b3('0xa')]['sestekasr']=function(_0x34a65c){logger['info'](util[_0x96b3('0x24')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x34a65c[_0x96b3('0x32')]));if(!this['isConfigured'](_0x34a65c['grammar'])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xc3'));}var _0x7a71c=_0x34a65c[_0x96b3('0xa8')];if(this[_0x96b3('0x7e')](_0x34a65c[_0x96b3('0xa2')])){_0x7a71c+=','+_0x34a65c[_0x96b3('0xa2')];}var _0x476685=this[_0x96b3('0x8')]['exec'](_0x96b3('0xa9'),_0x7a71c);if(_0x476685['result']===-0x1){return _0x476685;}var _0x4325b9=this[_0x96b3('0x9b')](_0x96b3('0xaa'),_0x96b3('0xc6'));if(_0x4325b9[_0x96b3('0xa4')]===-0x1){return _0x4325b9;}var _0x53243f=this[_0x96b3('0x9b')](_0x96b3('0xac'),_0x96b3('0xc7'));if(_0x53243f[_0x96b3('0xa4')]===-0x1){return _0x53243f;}var _0x2dbee2=this[_0x96b3('0x9b')]('RECOG_INSTANCE()',_0x96b3('0xc8'));if(_0x2dbee2[_0x96b3('0xa4')]===-0x1){return _0x2dbee2;}return this['channel']['noop'](util[_0x96b3('0x24')](_0x96b3('0xc9'),_0x7a71c));};AGIVertices[_0x96b3('0xa')][_0x96b3('0xca')]=function(_0x44fef8){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0xcb'),_0x44fef8[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x44fef8[_0x96b3('0xcc')])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x44fef8,'no\x20database\x20selected');}var _0x1ca6dc=this[_0x96b3('0x13')]['sync'](this,_0x44fef8['odbc_id']);if(!_0x1ca6dc){return this['channel'][_0x96b3('0x2b')](_0x44fef8,_0x96b3('0xcd'));}if(!this[_0x96b3('0x7e')](_0x44fef8[_0x96b3('0xce')])){return this[_0x96b3('0x8')]['error'](_0x44fef8,_0x96b3('0xcf'));}var _0xdc794a=_0x44fef8['query'][_0x96b3('0xd0')](/(\r\n|\n|\r)/gm,'\x20');this[_0x96b3('0x8')]['noop'](util[_0x96b3('0x24')](_0x96b3('0xd1'),_0xdc794a));var _0x4b66ea=this['getQueryOdbc'][_0x96b3('0x6c')](this,_0x1ca6dc,_0xdc794a);this[_0x96b3('0x30')]['sync'](this,_0x44fef8,_0xdc794a);if(!this['isConfigured'](_0x44fef8['variable_id'])){return this[_0x96b3('0x8')][_0x96b3('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2ed170=this[_0x96b3('0x99')][_0x96b3('0x6c')](this,_0x44fef8[_0x96b3('0xd2')]);if(!_0x2ed170){return this[_0x96b3('0x8')]['error'](_0x44fef8,'no\x20variable\x20found');}var _0x587c91=this;_0x4b66ea[_0x96b3('0xd3')](function(_0x39cdec,_0x58f5a2){Object[_0x96b3('0xd4')](_0x39cdec)[_0x96b3('0xd3')](function(_0x14f236){_0x587c91[_0x96b3('0x8')][_0x96b3('0xd5')](util[_0x96b3('0x24')](_0x96b3('0xd6'),_0x2ed170,_0x58f5a2,_0x14f236),_0x39cdec[_0x14f236]);});});this['channel'][_0x96b3('0xd5')](util[_0x96b3('0x24')](_0x96b3('0xd7'),_0x2ed170),_0x4b66ea[_0x96b3('0x92')]);return this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format'](_0x96b3('0xd8'),_0x2ed170));};AGIVertices[_0x96b3('0xa')][_0x96b3('0xd9')]=function(_0x1a282e){logger[_0x96b3('0xda')](util[_0x96b3('0x24')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1a282e['label']));if(!this[_0x96b3('0x7e')](_0x1a282e[_0x96b3('0xdb')])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x1a282e,'no\x20user\x20selected');}var _0x413d55=this['getUser'][_0x96b3('0x6c')](this,_0x1a282e[_0x96b3('0xdb')]);if(!_0x413d55){return this[_0x96b3('0x8')]['error'](_0x1a282e,'no\x20user\x20found');}var _0x336216=this['channel'][_0x96b3('0x52')](_0x96b3('0xdc'),[util[_0x96b3('0x24')](_0x96b3('0xdd'),_0x413d55),_0x1a282e[_0x96b3('0x61')],_0x1a282e[_0x96b3('0xde')],_0x1a282e[_0x96b3('0x60')]]);if(_0x336216[_0x96b3('0xa4')]===-0x1){return _0x336216;}return this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xdf'),'DIAL'));};AGIVertices[_0x96b3('0xa')]['dialogflow']=function(_0x314b20){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0xe0'),_0x314b20[_0x96b3('0x32')]));if(!this['isConfigured'](_0x314b20[_0x96b3('0x74')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xe1'));}if(!this[_0x96b3('0x7e')](_0x314b20[_0x96b3('0x57')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xbf'));}this[_0x96b3('0x8')]['bot']=!![];this['createSquareDetailsReport'](_0x314b20);this['createSquareMessage'](_0x314b20[_0x96b3('0x57')],'in','','');this['channel']['noop'](util[_0x96b3('0x24')](_0x96b3('0xe2'),_0x314b20[_0x96b3('0x57')]));var _0x2aa2d2=this[_0x96b3('0x73')][_0x96b3('0x6c')](this,_0x314b20);if(_0x2aa2d2){for(var _0x500c76 in _0x2aa2d2){if(_0x2aa2d2[_0x96b3('0x95')](_0x500c76)){this['channel'][_0x96b3('0xd5')](util[_0x96b3('0x24')]('DIALOGFLOW_%s',_0x500c76[_0x96b3('0x65')]()),_0x2aa2d2[_0x500c76]);}}this[_0x96b3('0x3e')](_0x2aa2d2[_0x96b3('0xe3')],'out',_0x96b3('0xe4'),'');return this[_0x96b3('0x8')]['noop'](util[_0x96b3('0x24')](_0x96b3('0xe5'),_0x2aa2d2['speech']));}return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x314b20,_0x96b3('0xe6'));};AGIVertices[_0x96b3('0xa')][_0x96b3('0xe7')]=function(_0x17f46d){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0xe8'),_0x17f46d[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x17f46d[_0x96b3('0xe9')])){return this[_0x96b3('0x8')]['noop'](_0x96b3('0xea'));}if(!this['isConfigured'](_0x17f46d[_0x96b3('0x77')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xeb'));}if(!this[_0x96b3('0x7e')](_0x17f46d[_0x96b3('0x78')])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this[_0x96b3('0x7e')](_0x17f46d[_0x96b3('0x79')])){return this['channel'][_0x96b3('0xa1')](_0x96b3('0xec'));}if(!this[_0x96b3('0x7e')](_0x17f46d[_0x96b3('0x57')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xbf'));}this[_0x96b3('0x8')][_0x96b3('0xed')]=!![];this[_0x96b3('0x30')](_0x17f46d);this[_0x96b3('0x3e')](_0x17f46d['text'],'in','','');this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xee'),_0x17f46d[_0x96b3('0x57')]));var _0x36f788=this[_0x96b3('0x76')]['sync'](this,_0x17f46d);if(_0x36f788){for(var _0xd01b88 in _0x36f788){if(_0x36f788[_0x96b3('0x95')](_0xd01b88)){if(_0xd01b88!==_0x96b3('0xef')){this[_0x96b3('0x8')][_0x96b3('0xd5')](util['format']('DIALOGFLOW_%s',_0xd01b88[_0x96b3('0x65')]()),_0x36f788[_0xd01b88]);}}}this[_0x96b3('0x3e')](_0x36f788[_0x96b3('0xe3')],_0x96b3('0xf0'),_0x96b3('0xe7'),_0x36f788[_0x96b3('0xef')]);return this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xf1'),_0x36f788[_0x96b3('0xe3')]));}return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x17f46d,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x670bbf){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0xf2'),_0x670bbf['label']));if(!this['isConfigured'](_0x670bbf[_0x96b3('0xf3')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xf4'));}if(!this['isConfigured'](_0x670bbf[_0x96b3('0xf5')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xf6'));}if(!this[_0x96b3('0x7e')](_0x670bbf[_0x96b3('0xf7')])){return this[_0x96b3('0x8')]['noop'](_0x96b3('0xf8'));}if(!this[_0x96b3('0x7e')](_0x670bbf[_0x96b3('0xf9')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xbf'));}this[_0x96b3('0x8')][_0x96b3('0xed')]=!![];this[_0x96b3('0x30')](_0x670bbf);this[_0x96b3('0x3e')](_0x670bbf['text'],'in','','');this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xfa'),_0x670bbf[_0x96b3('0x57')]));var _0x49032b=this[_0x96b3('0x7a')][_0x96b3('0x6c')](this,_0x670bbf);if(_0x49032b){for(var _0x1c4459 in _0x49032b){if(_0x49032b[_0x96b3('0x95')](_0x1c4459)){this[_0x96b3('0x8')][_0x96b3('0xd5')](util[_0x96b3('0x24')](_0x96b3('0xfb'),_0x1c4459[_0x96b3('0x65')]()),_0x49032b[_0x1c4459]);}}this[_0x96b3('0x3e')](_0x49032b[_0x96b3('0xe3')],_0x96b3('0xf0'),_0x96b3('0xfc'),'');if(_0x49032b['audiofile']){this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xfd'),_0x49032b[_0x96b3('0xfe')]));var _0x27fade=this[_0x96b3('0x8')]['streamFile'](_0x49032b[_0x96b3('0xfe')]);try{fs[_0x96b3('0xff')](_0x49032b[_0x96b3('0xfe')]+_0x96b3('0x100'));}catch(_0x2eb1bf){logger[_0x96b3('0x2b')](_0x2eb1bf);}return _0x27fade;}else{return this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x101'),_0x49032b[_0x96b3('0xe3')]));}}return this[_0x96b3('0x8')]['error'](_0x670bbf,_0x96b3('0x102'));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x103')]=function(_0x31d9c0){logger[_0x96b3('0x28')](util['format'](_0x96b3('0x104'),_0x31d9c0[_0x96b3('0x32')]));return this[_0x96b3('0x8')]['noop'](_0x96b3('0x103'));};AGIVertices[_0x96b3('0xa')]['ext_dial']=function(_0x1bb8ad){logger[_0x96b3('0x28')](util['format'](_0x96b3('0x105'),_0x1bb8ad[_0x96b3('0x32')]));var _0x454ca4='';if(_0x1bb8ad[_0x96b3('0x106')]){if(!this[_0x96b3('0x7e')](_0x1bb8ad[_0x96b3('0x106')])){return this['channel'][_0x96b3('0x2b')](_0x1bb8ad,_0x96b3('0x107'));}else{var _0x59f3a6=parseInt(_0x1bb8ad[_0x96b3('0x106')],0xa);if(isNaN(_0x59f3a6)){_0x454ca4=_0x1bb8ad[_0x96b3('0x106')];}else{_0x454ca4=this[_0x96b3('0x108')][_0x96b3('0x6c')](this,_0x1bb8ad['trunk_id']);if(!_0x454ca4){return this['channel'][_0x96b3('0x2b')](_0x1bb8ad,_0x96b3('0x109'));}}}}else if(_0x1bb8ad[_0x96b3('0x10a')]){_0x454ca4=_0x1bb8ad[_0x96b3('0x10a')];}else{return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x1bb8ad,'no\x20trunk\x20selected');}var _0x51b5a2=this[_0x96b3('0x8')][_0x96b3('0x52')](_0x96b3('0xdc'),[util[_0x96b3('0x24')](_0x96b3('0x10b'),_0x454ca4,_0x1bb8ad['phone']),_0x1bb8ad[_0x96b3('0x61')],_0x1bb8ad['opts'],_0x1bb8ad['url']]);if(_0x51b5a2[_0x96b3('0xa4')]===-0x1){return _0x51b5a2;}return this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xdf'),_0x96b3('0xdc')));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x10c')]=function(_0x9733f9){logger['info'](util[_0x96b3('0x24')](_0x96b3('0x10d'),_0x9733f9['label']));return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x10c'));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x7')]=function(_0x4042a2){logger['info'](util[_0x96b3('0x24')](_0x96b3('0x10e'),_0x4042a2['label']));if(_0x4042a2[_0x96b3('0x9e')]===0x0){return this[_0x96b3('0x9d')](_0x4042a2);}_0x4042a2[_0x96b3('0x9e')]-=0x1;if(!this[_0x96b3('0x7e')](_0x4042a2[_0x96b3('0x10f')])){return this['channel'][_0x96b3('0x2b')](_0x4042a2,_0x96b3('0x110'));}var _0x21bf0d=this[_0x96b3('0x19')][_0x96b3('0x6c')](this,_0x4042a2['file_id']);if(!_0x21bf0d){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x4042a2,'no\x20file\x20audio\x20found');}if(!this[_0x96b3('0x7e')](_0x4042a2[_0x96b3('0xd2')])){return this['channel'][_0x96b3('0x2b')](_0x96b3('0x111'));}var _0x37dfe4=this[_0x96b3('0x8')]['getData'](_0x21bf0d,_0x4042a2[_0x96b3('0x112')],_0x4042a2[_0x96b3('0x113')]);var _0x567ccf=_0x37dfe4['result']?_0x37dfe4['result'][_0x96b3('0x47')]():'';logger[_0x96b3('0x28')](_0x96b3('0x114'),JSON[_0x96b3('0x6e')](_0x37dfe4));if(_0x37dfe4['result']===-0x1){this['createSquareDetailsReport'][_0x96b3('0x6c')](this,_0x4042a2,_0x567ccf);return _0x37dfe4;}else if(_0x37dfe4[_0x96b3('0x9a')]===_0x96b3('0x61')){_0x37dfe4[_0x96b3('0xa4')]=_0x567ccf['length']>=parseInt(_0x4042a2[_0x96b3('0x115')])?'x':'i';}else{_0x37dfe4[_0x96b3('0xa4')]=_0x567ccf['length']>=parseInt(_0x4042a2['mindigit'])&&_0x567ccf[_0x96b3('0x92')]<=parseInt(_0x4042a2[_0x96b3('0x113')])?'x':'i';}var _0x2734ed=this[_0x96b3('0x99')][_0x96b3('0x6c')](this,_0x4042a2[_0x96b3('0xd2')]);if(!_0x2734ed){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x4042a2,_0x96b3('0x116'));}this['channel'][_0x96b3('0xd5')](_0x2734ed,_0x567ccf);if(this[_0x96b3('0x7e')](_0x4042a2['hiddendigitsnum'])){var _0x3b8ff6=parseInt(_0x4042a2[_0x96b3('0x117')],0xa);var _0x3fdd90=rs[_0x96b3('0x118')]({'charset':'*','length':_0x3b8ff6});var _0x2766fc=_0x567ccf['length'];if(_0x2766fc>0x0){if(_0x2766fc>_0x3b8ff6){this[_0x96b3('0x30')]['sync'](this,_0x4042a2,_0x4042a2[_0x96b3('0x119')]==='first'?_0x3fdd90+_0x567ccf[_0x96b3('0x11a')](_0x3b8ff6):_0x567ccf[_0x96b3('0x11a')](0x0,_0x2766fc-_0x3b8ff6)+_0x3fdd90);}else{this['createSquareDetailsReport'][_0x96b3('0x6c')](this,_0x4042a2,rs[_0x96b3('0x118')]({'charset':'*','length':_0x2766fc}));}}else{this[_0x96b3('0x30')][_0x96b3('0x6c')](this,_0x4042a2,'');}}else{this[_0x96b3('0x30')][_0x96b3('0x6c')](this,_0x4042a2,_0x567ccf);}return _0x37dfe4;};AGIVertices['prototype'][_0x96b3('0x11b')]=function(_0x3e01bc){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x11c'),_0x3e01bc[_0x96b3('0x32')]));return this[_0x96b3('0x7')](_0x3e01bc);};AGIVertices[_0x96b3('0xa')][_0x96b3('0x11d')]=function(_0x45b7a4){logger['info'](util['format'](_0x96b3('0x11e'),_0x45b7a4[_0x96b3('0x32')]));this[_0x96b3('0x30')][_0x96b3('0x6c')](this,_0x45b7a4,_0x45b7a4[_0x96b3('0x11f')]);return this['channel'][_0x96b3('0xa1')](util['format'](_0x96b3('0x120'),_0x45b7a4[_0x96b3('0x11f')]));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x121')]=function(_0x381261){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x122'),_0x381261['label']));if(!this[_0x96b3('0x7e')](_0x381261['aws_access_key_id'])||!this[_0x96b3('0x7e')](_0x381261[_0x96b3('0x123')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x124'));}if(!this[_0x96b3('0x7e')](_0x381261[_0x96b3('0x57')])){return this['channel'][_0x96b3('0xa1')](_0x96b3('0xbf'));}this['channel']['noop'](util[_0x96b3('0x24')](_0x96b3('0x125'),_0x381261[_0x96b3('0x57')]));var _0x1fb717=this[_0x96b3('0x80')]['sync'](this,_0x381261);if(_0x1fb717){this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x126'),_0x1fb717));var _0xbe5235=this[_0x96b3('0x8')][_0x96b3('0x127')](_0x1fb717);try{fs['unlink'](_0x1fb717+'.wav');}catch(_0x58c5b3){logger[_0x96b3('0x2b')](_0x58c5b3);}return _0xbe5235;}return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x381261,_0x96b3('0x128'));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x129')]=function(_0x438703){logger[_0x96b3('0x28')](util[_0x96b3('0x24')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x438703[_0x96b3('0x32')]));if(!this['isConfigured'](_0x438703['aws_access_key_id'])||!this['isConfigured'](_0x438703[_0x96b3('0x123')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x124'));}if(!this[_0x96b3('0x7e')](_0x438703[_0x96b3('0x88')])){return this['channel'][_0x96b3('0xa1')](_0x96b3('0x12a'));}if(!this[_0x96b3('0x7e')](_0x438703[_0x96b3('0x57')])){return this['channel']['noop'](_0x96b3('0xbf'));}this[_0x96b3('0x8')][_0x96b3('0xed')]=!![];this[_0x96b3('0x30')](_0x438703);this[_0x96b3('0x3e')](_0x438703[_0x96b3('0x57')],'in','','');this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x12b'),_0x438703[_0x96b3('0x57')]));var _0x42c907=this[_0x96b3('0x86')][_0x96b3('0x6c')](this,_0x438703);if(_0x42c907){for(var _0x4fbb78 in _0x42c907){if(_0x42c907[_0x96b3('0x95')](_0x4fbb78)&&_[_0x96b3('0x12c')](_0x42c907[_0x4fbb78])){this[_0x96b3('0x8')][_0x96b3('0xd5')](util[_0x96b3('0x24')](_0x96b3('0x12d'),_0x4fbb78['toUpperCase']()),_0x42c907[_0x4fbb78]);}}if(_['isNil'](_0x42c907[_0x96b3('0x72')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x12e'));}else{this['createSquareMessage'](_0x42c907[_0x96b3('0x72')],'out',_0x96b3('0x12f'),'');return this[_0x96b3('0x8')]['noop'](util[_0x96b3('0x24')](_0x96b3('0x130'),_0x42c907[_0x96b3('0x72')]));}}return this[_0x96b3('0x8')]['error'](_0x438703,_0x96b3('0x131'));};AGIVertices['prototype'][_0x96b3('0x132')]=function(_0x28a1b1){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x133'),_0x28a1b1[_0x96b3('0x32')],_0x28a1b1[_0x96b3('0x61')]));if(!this[_0x96b3('0x7e')](_0x28a1b1['key'])){return this[_0x96b3('0x8')][_0x96b3('0xa1')]('no\x20key\x20configured');}var _0x4210c6='wav';var _0xf57992=util[_0x96b3('0x24')](_0x96b3('0x134'),FILES_PATH,rs[_0x96b3('0x118')](0x4));var _0xadf19b=util['format'](_0x96b3('0x98'),_0xf57992,_0x4210c6);var _0x5df6f3=!![];if(_0x28a1b1[_0x96b3('0x135')]===_0x96b3('0x136')){_0x5df6f3=![];}var _0x2e9976=this['channel']['recordFile'](_0xf57992,_0x4210c6,_0x28a1b1[_0x96b3('0x137')],_0x28a1b1['timeout'],undefined,_0x5df6f3);if(_0x2e9976[_0x96b3('0xa4')]!==-0x1){this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x138'),_0xadf19b));var _0x2a55be=this[_0x96b3('0x139')][_0x96b3('0x6c')](this,_0x28a1b1,_0xadf19b);if(_0x2a55be){for(var _0x43c887 in _0x2a55be){if(_0x2a55be[_0x96b3('0x95')](_0x43c887)){this[_0x96b3('0x8')]['setVariable'](util[_0x96b3('0x24')](_0x96b3('0x13a'),_0x43c887[_0x96b3('0x65')]()),_0x2a55be[_0x43c887]);}}return this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')]('GoogleASR\x20Result\x20%s',JSON[_0x96b3('0x6e')](_0x2a55be)));}}return _0x2e9976;};AGIVertices['prototype'][_0x96b3('0x13b')]=function(_0x3efc93){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x13c'),_0x3efc93['label']));if(!this[_0x96b3('0x7e')](_0x3efc93['appid'])){return this['channel'][_0x96b3('0xa1')]('no\x20appid\x20configured');}if(!this[_0x96b3('0x7e')](_0x3efc93['appsecret'])){return this['channel'][_0x96b3('0xa1')](_0x96b3('0x13d'));}var _0x243432=_0x96b3('0x13e');var _0x253a46=util[_0x96b3('0x24')](_0x96b3('0x134'),FILES_PATH,rs['generate'](0x4));var _0x15b046=util[_0x96b3('0x24')](_0x96b3('0x98'),_0x253a46,_0x243432);var _0x9b8a2d=!![];if(_0x3efc93[_0x96b3('0x135')]===_0x96b3('0x136')){_0x9b8a2d=![];}var _0x277411=this['channel'][_0x96b3('0x13f')](_0x253a46,_0x243432,_0x3efc93[_0x96b3('0x137')],_0x3efc93[_0x96b3('0x61')],undefined,_0x9b8a2d);if(_0x277411[_0x96b3('0xa4')]!==-0x1){this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x140'),_0x15b046));var _0x5d3893=this['tildeASR'][_0x96b3('0x6c')](this,_0x3efc93,_0x15b046);if(_0x5d3893){for(var _0x4caf23 in _0x5d3893){if(_0x5d3893[_0x96b3('0x95')](_0x4caf23)){this['channel'][_0x96b3('0xd5')](util['format']('TILDE_ASR_%s',_0x4caf23[_0x96b3('0x65')]()),_0x5d3893[_0x4caf23]);}}return this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format'](_0x96b3('0x141'),JSON['stringify'](_0x5d3893)));}}return _0x277411;};AGIVertices[_0x96b3('0xa')]['gotoc']=function(_0x2c76e0){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x142'),_0x2c76e0['label']));return this['channel']['continueAt'](_0x2c76e0[_0x96b3('0x38')],_0x2c76e0[_0x96b3('0x39')],_0x2c76e0[_0x96b3('0x3a')]);};AGIVertices[_0x96b3('0xa')][_0x96b3('0x143')]=function(_0x493bd6){logger[_0x96b3('0x28')](util[_0x96b3('0x24')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x493bd6[_0x96b3('0x32')]));if(!this['isConfigured'](_0x493bd6[_0x96b3('0x144')])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x493bd6,_0x96b3('0x145'));}try{var _0x54e152=eval(_0x493bd6['condition'])?_0x96b3('0x146'):_0x96b3('0x147');this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format'](_0x96b3('0x148'),_0x493bd6[_0x96b3('0x144')],_0x54e152));return{'code':0xc8,'result':_0x54e152};}catch(_0x3477de){return{'code':0xc8,'result':_0x96b3('0x147')};}};AGIVertices['prototype'][_0x96b3('0x149')]=function(_0x3638d8){logger['info'](util['format'](_0x96b3('0x14a'),_0x3638d8['label']));if(!this[_0x96b3('0x7e')](_0x3638d8['interval_id'])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x3638d8,_0x96b3('0x14b'));}var _0x1b7fac=this[_0x96b3('0x14c')][_0x96b3('0x6c')](this,_0x3638d8[_0x96b3('0x14d')]);if(!_0x1b7fac){return this[_0x96b3('0x8')]['error'](_0x3638d8,_0x96b3('0x14e'));}for(var _0x569db6=0x0;_0x569db6<_0x1b7fac[_0x96b3('0x92')];_0x569db6+=0x1){var _0x4e2df5=this[_0x96b3('0x8')][_0x96b3('0x99')](util['format'](_0x96b3('0x14f'),_0x1b7fac[_0x569db6]));if(_0x4e2df5[_0x96b3('0xa4')]===-0x1){return _0x4e2df5;}logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x150'),_0x1b7fac[_0x569db6],_0x4e2df5[_0x96b3('0x9a')]));if(_0x4e2df5[_0x96b3('0x9a')]==='true'){logger[_0x96b3('0x28')](util[_0x96b3('0x24')]('IFTIME\x20%s\x20%s',_0x1b7fac[_0x569db6],_0x96b3('0x146')));this[_0x96b3('0x8')]['noop'](util[_0x96b3('0x24')](_0x96b3('0x150'),_0x1b7fac[_0x569db6],_0x96b3('0x146')));return{'code':0xc8,'result':_0x96b3('0x146')};}else{logger[_0x96b3('0x28')](util['format'](_0x96b3('0x150'),_0x1b7fac[_0x569db6],'false'));this['channel'][_0x96b3('0xa1')](util['format'](_0x96b3('0x150'),_0x1b7fac[_0x569db6],_0x96b3('0x147')));}}return{'code':0xc8,'result':_0x96b3('0x147')};};AGIVertices[_0x96b3('0xa')]['hangup']=function(_0x5172be){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x151'),_0x5172be[_0x96b3('0x32')]));return this[_0x96b3('0x8')][_0x96b3('0x152')]();};AGIVertices[_0x96b3('0xa')][_0x96b3('0x153')]=function(_0x3063f9){logger[_0x96b3('0x28')](util[_0x96b3('0x24')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x3063f9['label']));if(!this[_0x96b3('0x7e')](_0x3063f9[_0x96b3('0x74')])){return this[_0x96b3('0x8')]['noop'](_0x96b3('0xe1'));}var _0x15c8de=_0x96b3('0x13e');var _0x7e8e90=util[_0x96b3('0x24')]('%s/recordings/%s',FILES_PATH,rs[_0x96b3('0x118')](0x4));var _0x26a714=util[_0x96b3('0x24')]('%s.%s',_0x7e8e90,_0x15c8de);var _0x4ec347=!![];if(_0x3063f9[_0x96b3('0x135')]===_0x96b3('0x136')){_0x4ec347=![];}var _0x259ed2=this[_0x96b3('0x8')]['recordFile'](_0x7e8e90,_0x15c8de,_0x3063f9['intKey'],_0x3063f9[_0x96b3('0x61')],undefined,_0x4ec347);if(_0x259ed2[_0x96b3('0xa4')]!==-0x1){this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x154'),_0x26a714));var _0x5c9982=this[_0x96b3('0x155')][_0x96b3('0x6c')](this,_0x3063f9,_0x26a714);if(_0x5c9982){for(var _0x2b8620 in _0x5c9982){if(_0x5c9982[_0x96b3('0x95')](_0x2b8620)){this[_0x96b3('0x8')][_0x96b3('0xd5')](util[_0x96b3('0x24')](_0x96b3('0x156'),_0x2b8620[_0x96b3('0x65')]()),_0x5c9982[_0x2b8620]);}}return this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x157'),JSON[_0x96b3('0x6e')](_0x5c9982)));}}return _0x259ed2;};AGIVertices['prototype'][_0x96b3('0x158')]=function(_0x42ddf6){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x159'),_0x42ddf6['label']));if(!this['isConfigured'](_0x42ddf6[_0x96b3('0x74')])){return this['channel'][_0x96b3('0xa1')](_0x96b3('0xe1'));}if(!this[_0x96b3('0x7e')](_0x42ddf6[_0x96b3('0x57')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')]('no\x20text\x20configured');}this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x15a'),_0x42ddf6[_0x96b3('0x57')]));var _0x417bba=this['ispeechTTS'][_0x96b3('0x6c')](this,_0x42ddf6);if(_0x417bba){this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')]('ispeech\x20%s\x20file\x20created',_0x417bba));var _0x26f588=this[_0x96b3('0x8')][_0x96b3('0x127')](_0x417bba,_0x42ddf6[_0x96b3('0x137')]);try{fs[_0x96b3('0xff')](_0x417bba+_0x96b3('0x100'));}catch(_0x4f8d88){logger[_0x96b3('0x2b')](_0x4f8d88);}return _0x26f588;}return this['channel'][_0x96b3('0x2b')](_0x42ddf6,_0x96b3('0x15b'));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x15c')]=function(_0x4018c5){logger[_0x96b3('0x28')](util['format'](_0x96b3('0x15d'),_0x4018c5['label']));if(!this['isConfigured'](_0x4018c5[_0x96b3('0x15e')])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x4018c5,_0x96b3('0x15f'));}logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x160'),this[_0x96b3('0x8')][_0x96b3('0x35')],_0x4018c5['findBy']));var _0x941b9c=this[_0x96b3('0x4e')][_0x96b3('0x6c')](this,_0x4018c5[_0x96b3('0x15e')]);if(_0x941b9c){logger['info'](util[_0x96b3('0x24')](_0x96b3('0x161'),this[_0x96b3('0x8')][_0x96b3('0x35')],_0x4018c5['findBy']));this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x161'),this['channel'][_0x96b3('0x35')],_0x4018c5[_0x96b3('0x15e')]));return{'code':0xc8,'result':_0x96b3('0x162')};}else{logger['info'](util[_0x96b3('0x24')](_0x96b3('0x163'),this[_0x96b3('0x8')][_0x96b3('0x35')],_0x4018c5[_0x96b3('0x15e')]));this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x163'),this[_0x96b3('0x8')]['callerid'],_0x4018c5[_0x96b3('0x15e')]));return{'code':0xc8,'result':_0x96b3('0x164')};}};AGIVertices[_0x96b3('0xa')][_0x96b3('0x165')]=function(_0xf182cc){logger[_0x96b3('0x28')](util[_0x96b3('0x24')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xf182cc[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0xf182cc[_0x96b3('0x15e')])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0xf182cc,_0x96b3('0x15f'));}logger['info'](util[_0x96b3('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x96b3('0x8')][_0x96b3('0x35')],_0xf182cc[_0x96b3('0x15e')]));var _0x1b961a=this[_0x96b3('0x4d')]['sync'](this,_0xf182cc[_0x96b3('0x15e')]);if(_0x1b961a){logger[_0x96b3('0x28')](util['format'](_0x96b3('0x161'),this[_0x96b3('0x8')]['callerid'],_0xf182cc['findBy']));this['channel'][_0x96b3('0xa1')](util['format'](_0x96b3('0x161'),this[_0x96b3('0x8')][_0x96b3('0x35')],_0xf182cc[_0x96b3('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x96b3('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x96b3('0x8')][_0x96b3('0x35')],_0xf182cc[_0x96b3('0x15e')]));this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x163'),this[_0x96b3('0x8')][_0x96b3('0x35')],_0xf182cc['findBy']));return{'code':0xc8,'result':_0x96b3('0x164')};}};AGIVertices[_0x96b3('0xa')]['math']=function(_0x148dd1){logger['info'](util[_0x96b3('0x24')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x148dd1['label']));if(!this['isConfigured'](_0x148dd1['operation'])){return this[_0x96b3('0x8')]['error'](_0x148dd1,_0x96b3('0x166'));}this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x167'),_0x148dd1[_0x96b3('0x168')]));var _0x155018=eval(_0x148dd1[_0x96b3('0x168')]);if(!this[_0x96b3('0x7e')](_0x148dd1[_0x96b3('0xd2')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xeb188e=this['getVariable'][_0x96b3('0x6c')](this,_0x148dd1[_0x96b3('0xd2')]);if(!_0xeb188e){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x148dd1,'no\x20variable\x20found');}if(_['isArray'](_0x155018)){var _0x5d5cf8=this;_0x155018[_0x96b3('0xd3')](function(_0x22d85,_0x56abf5){_0x5d5cf8[_0x96b3('0x8')][_0x96b3('0xd5')](util[_0x96b3('0x24')]('%s[%s]',_0xeb188e,_0x56abf5),_0x22d85);});return this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format']('variable\x20%s[key]\x20set',_0xeb188e));}else{return this[_0x96b3('0x8')]['setVariable'](_0xeb188e,_0x155018);}};AGIVertices[_0x96b3('0xa')][_0x96b3('0x169')]=function(_0x44f31f){logger[_0x96b3('0x28')](util['format'](_0x96b3('0x16a'),_0x44f31f['label']));if(_0x44f31f[_0x96b3('0x9e')]===0x0){return this['maxRetry'](_0x44f31f);}_0x44f31f[_0x96b3('0x9e')]-=0x1;if(!this[_0x96b3('0x7e')](_0x44f31f['file_id'])){return this[_0x96b3('0x8')]['error'](_0x44f31f,_0x96b3('0x110'));}var _0x3e3fbe=this['getSound']['sync'](this,_0x44f31f['file_id']);if(!_0x3e3fbe){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x44f31f,_0x96b3('0x16b'));}var _0x244b6e=this['channel'][_0x96b3('0x16c')](_0x3e3fbe,_0x44f31f[_0x96b3('0x112')],_0x44f31f[_0x96b3('0x16d')]);var _0x588932=_0x244b6e[_0x96b3('0xa4')];if(_0x244b6e['result']===-0x1){this[_0x96b3('0x30')][_0x96b3('0x6c')](this,_0x44f31f,'-1');return _0x244b6e;}else if(_0x244b6e['extra']===_0x96b3('0x61')){_0x244b6e[_0x96b3('0xa4')]=_0x244b6e[_0x96b3('0xa4')][_0x96b3('0x92')]>0x0?_0x244b6e[_0x96b3('0xa4')]:'t';}else if(_[_0x96b3('0x97')](_0x244b6e[_0x96b3('0xa4')])){_0x244b6e[_0x96b3('0xa4')]='#';_0x588932='#';}if(!this[_0x96b3('0x7e')](_0x44f31f[_0x96b3('0xd2')])){this[_0x96b3('0x8')]['noop'](_0x96b3('0x111'));}else{var _0x337f12=this[_0x96b3('0x99')][_0x96b3('0x6c')](this,_0x44f31f[_0x96b3('0xd2')]);if(!_0x337f12){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x44f31f,_0x96b3('0x116'));}this[_0x96b3('0x8')][_0x96b3('0xd5')](_0x337f12,_0x588932);}this['createSquareDetailsReport'][_0x96b3('0x6c')](this,_0x44f31f,_0x588932);return _0x244b6e;};AGIVertices[_0x96b3('0xa')][_0x96b3('0xa1')]=function(_0x478bca){logger[_0x96b3('0x28')](util['format'](_0x96b3('0x16e'),_0x478bca[_0x96b3('0x32')]));return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x478bca[_0x96b3('0x16f')]||_0x478bca['label']);};AGIVertices['prototype']['pause']=function(_0x2e7f84){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x170'),_0x2e7f84['label']));if(!this[_0x96b3('0x7e')](_0x2e7f84[_0x96b3('0x15e')])){return this[_0x96b3('0x8')]['error'](_0x2e7f84,_0x96b3('0x15f'));}logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x160'),this[_0x96b3('0x8')]['callerid'],_0x2e7f84[_0x96b3('0x15e')]));var _0x106e7a=this[_0x96b3('0x48')][_0x96b3('0x6c')](this,_0x2e7f84[_0x96b3('0x171')]);var _0x527572=this[_0x96b3('0x4b')]['sync'](this,_0x2e7f84[_0x96b3('0x15e')],_0x106e7a);if(_0x527572){logger['info'](util['format'](_0x96b3('0x161'),this[_0x96b3('0x8')][_0x96b3('0x35')],_0x2e7f84[_0x96b3('0x15e')]));this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x96b3('0x8')][_0x96b3('0x35')],_0x2e7f84[_0x96b3('0x15e')]));return{'code':0xc8,'result':_0x96b3('0x162')};}else{logger[_0x96b3('0x28')](util[_0x96b3('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x96b3('0x8')][_0x96b3('0x35')],_0x2e7f84[_0x96b3('0x15e')]));this[_0x96b3('0x8')][_0x96b3('0xa1')](util[_0x96b3('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x96b3('0x8')][_0x96b3('0x35')],_0x2e7f84['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x96b3('0xa')][_0x96b3('0x172')]=function(_0x3bcc58){logger['info'](util[_0x96b3('0x24')](_0x96b3('0x173'),_0x3bcc58[_0x96b3('0x32')]));if(!this['isConfigured'](_0x3bcc58['file_id'])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x3bcc58,'no\x20file\x20audio\x20selected');}var _0x14cb5c=this[_0x96b3('0x19')]['sync'](this,_0x3bcc58['file_id']);if(!_0x14cb5c){return this['channel']['error'](_0x3bcc58,_0x96b3('0x16b'));}var _0x5205cc=this[_0x96b3('0x8')]['exec']('PLAYBACK',[_0x14cb5c,_0x3bcc58['opts']]);if(_0x5205cc[_0x96b3('0xa4')]===-0x1){return _0x5205cc;}return this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0xbb'),'PLAYBACK',_0x14cb5c));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x174')]=function(_0x4cd395){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x175'),_0x4cd395[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x4cd395[_0x96b3('0x176')])){return this[_0x96b3('0x8')]['error'](_0x4cd395,_0x96b3('0x177'));}var _0x19cfba='';var _0x5e24bb=parseInt(_0x4cd395['queue_id'],0xa);if(isNaN(_0x5e24bb)){_0x19cfba=_0x4cd395['queue_id'];}else{_0x19cfba=this[_0x96b3('0xe')]['sync'](this,_0x4cd395['queue_id']);if(!_0x19cfba){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x4cd395,_0x96b3('0x178'));}}var _0x17be62='';if(this[_0x96b3('0x7e')](_0x4cd395[_0x96b3('0x10f')])){var _0x34542d=this['getSound'][_0x96b3('0x6c')](this,_0x4cd395['file_id']);if(_0x34542d){_0x17be62=_0x34542d;}}this[_0x96b3('0x30')][_0x96b3('0x6c')](this,_0x4cd395,_0x19cfba);if(_0x4cd395['opts']['indexOf']('x')<0x0){_0x4cd395[_0x96b3('0xde')]+='x';}if(_0x4cd395['opts'][_0x96b3('0x179')]('X')<0x0){_0x4cd395[_0x96b3('0xde')]+='X';}this['channel'][_0x96b3('0xd5')]('XMCS-QUEUE',_0x19cfba?_0x19cfba['toLowerCase']():'');var _0x2d92f0=this['channel'][_0x96b3('0x52')](_0x96b3('0x17a'),[_0x19cfba,_0x4cd395['opts'],_0x4cd395[_0x96b3('0x60')],_0x17be62,_0x4cd395[_0x96b3('0x61')],_0x4cd395[_0x96b3('0x17b')],_0x4cd395[_0x96b3('0x17c')],_0x4cd395[_0x96b3('0x17d')],'',_0x4cd395['position']]);if(_0x2d92f0[_0x96b3('0xa4')]===-0x1){return _0x2d92f0;}return this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format'](_0x96b3('0xbb'),'QUEUE',_0x19cfba));};AGIVertices[_0x96b3('0xa')]['record']=function(_0x511887){logger[_0x96b3('0x28')](util[_0x96b3('0x24')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x511887[_0x96b3('0x32')]));var _0x160bf5=_0x511887[_0x96b3('0x17e')]||_0x96b3('0x13e');var _0x4dbde9=util[_0x96b3('0x24')](_0x96b3('0x17f'),this[_0x96b3('0x8')][_0x96b3('0x31')],rs['generate'](0x5));var _0x477924=util['format'](_0x96b3('0x180'),FILES_PATH,_0x4dbde9,_0x160bf5);var _0x30c18f=util['format']('%s/recordings/%s',FILES_PATH,_0x4dbde9);this['createSquareRecording'][_0x96b3('0x6c')](this,_0x511887,_0x4dbde9,_0x477924);this[_0x96b3('0x8')][_0x96b3('0xd5')](_0x96b3('0x181'),_0x4dbde9);logger[_0x96b3('0x28')](_0x96b3('0x182'),_0x30c18f,_0x160bf5,_0x511887[_0x96b3('0x183')],_0x511887['timeout']);return this['channel'][_0x96b3('0x13f')](_0x30c18f,_0x160bf5,_0x511887['escape_digits'],_0x511887[_0x96b3('0x61')],undefined,!![]);};AGIVertices[_0x96b3('0xa')]['restapi']=function(_0x122c93){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x184'),_0x122c93[_0x96b3('0x32')]));if(!this['isConfigured'](_0x122c93[_0x96b3('0x60')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')]('no\x20url\x20configured');}var _0x17e3ea=this['restAPI'][_0x96b3('0x6c')](this,_0x122c93);logger[_0x96b3('0x28')](util['format'](_0x96b3('0x185'),util['inspect'](_0x17e3ea,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x122c93[_0x96b3('0xd2')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x186'));}var _0x4331fc=this[_0x96b3('0x99')][_0x96b3('0x6c')](this,_0x122c93[_0x96b3('0xd2')]);if(!_0x4331fc){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x122c93,_0x96b3('0x116'));}this[_0x96b3('0x8')][_0x96b3('0xd5')](util[_0x96b3('0x24')](_0x96b3('0x187'),_0x4331fc),_0x17e3ea[_0x96b3('0x188')]?_0x17e3ea[_0x96b3('0x188')]:_0x96b3('0x189'));this['channel'][_0x96b3('0xd5')](util['format']('%s_STATUS_MESSAGE',_0x4331fc),_0x17e3ea['statusMessage']?_0x17e3ea['statusMessage']:'OK');if(_0x17e3ea[_0x96b3('0x6f')]){try{this[_0x96b3('0x94')](_0x17e3ea[_0x96b3('0x6f')],_0x4331fc);}catch(_0x47aa8f){logger['error'](util[_0x96b3('0x24')](_0x96b3('0x18a'),_0x4331fc));}}return this[_0x96b3('0x8')]['noop'](util['format'](_0x96b3('0xd8'),_0x4331fc));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x18b')]=function(_0x50ad67){logger[_0x96b3('0x28')](util['format'](_0x96b3('0x18c'),_0x50ad67['label']));return this[_0x96b3('0x8')][_0x96b3('0x18d')](_0x50ad67['digits']['replace'](/\s+/g,''),_0x50ad67['escape_digits']);};AGIVertices[_0x96b3('0xa')][_0x96b3('0x18e')]=function(_0x2cb7f5){logger[_0x96b3('0x28')](util[_0x96b3('0x24')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2cb7f5[_0x96b3('0x32')]));return this[_0x96b3('0x8')][_0x96b3('0x18f')](_0x2cb7f5[_0x96b3('0x190')][_0x96b3('0xd0')](/\s+/g,''),_0x2cb7f5[_0x96b3('0x183')]);};AGIVertices[_0x96b3('0xa')][_0x96b3('0x191')]=function(_0xe37169){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x192'),_0xe37169[_0x96b3('0x32')]));return this['channel'][_0x96b3('0x193')](_0xe37169['text'],_0xe37169['escape_digits']);};AGIVertices[_0x96b3('0xa')]['sendMail']=function(_0x5a59d6){logger[_0x96b3('0x28')](util['format'](_0x96b3('0x194'),_0x5a59d6[_0x96b3('0x32')]));if(!this['isConfigured'](_0x5a59d6[_0x96b3('0x195')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x196'));}var _0x4d56e2=this[_0x96b3('0x1c')][_0x96b3('0x6c')](this,_0x5a59d6['account_id']);if(!_0x4d56e2||!_0x4d56e2['Smtp']){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x5a59d6,_0x96b3('0x197'));}var _0x3afe5f={'from':util['format'](_0x96b3('0x198'),_0x4d56e2['name'],_0x4d56e2[_0x96b3('0x199')]||_0x4d56e2[_0x96b3('0x19a')][_0x96b3('0x19b')]),'to':_0x5a59d6['to']||'','cc':_0x5a59d6['cc']||'','bcc':_0x5a59d6[_0x96b3('0x19c')]||'','subject':_0x5a59d6[_0x96b3('0x19d')],'html':_0x5a59d6['text'],'text':_0x5a59d6['text']};var _0x1147b7={'tls':{'rejectUnauthorized':![]}};if(_0x4d56e2[_0x96b3('0x19a')][_0x96b3('0x19e')]){_0x1147b7[_0x96b3('0x19e')]=_0x4d56e2[_0x96b3('0x19a')][_0x96b3('0x19e')];}else{_0x1147b7[_0x96b3('0x19f')]=_0x4d56e2[_0x96b3('0x19a')][_0x96b3('0x19f')];_0x1147b7[_0x96b3('0x1a0')]=_0x4d56e2[_0x96b3('0x19a')][_0x96b3('0x1a0')];_0x1147b7[_0x96b3('0x1a1')]=_0x4d56e2['Smtp']['secure'];}if(_0x4d56e2[_0x96b3('0x19a')][_0x96b3('0x1a2')]){_0x1147b7[_0x96b3('0x1a3')]={'user':_0x4d56e2[_0x96b3('0x19a')][_0x96b3('0x19b')],'pass':_0x4d56e2[_0x96b3('0x19a')]['pass']};}if(this[_0x96b3('0x7e')](_0x5a59d6[_0x96b3('0x1a4')])){}logger[_0x96b3('0xda')](_0x96b3('0x1a5'),JSON['stringify'](_0x3afe5f));this[_0x96b3('0x30')][_0x96b3('0x6c')](this,_0x5a59d6,_0x5a59d6[_0x96b3('0x195')]);this[_0x96b3('0x8')]['noop'](util[_0x96b3('0x24')](_0x96b3('0x1a6'),_0x4d56e2[_0x96b3('0xc')]));this['sendMailMessage'][_0x96b3('0x6c')](this,_0x1147b7,_0x3afe5f);return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x1a7'));};AGIVertices['prototype']['sendFax']=function(_0x48e729){logger['info'](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x48e729[_0x96b3('0x32')]));return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x1a8'));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x1a9')]=function(_0x2f59be){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x1aa'),_0x2f59be[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x2f59be['sms_account_id'])){return this['channel'][_0x96b3('0xa1')](_0x96b3('0x1ab'));}var _0x498556=this[_0x96b3('0x2d')][_0x96b3('0x6c')](this,_0x2f59be[_0x96b3('0x1ac')]);if(!_0x498556){return this[_0x96b3('0x8')]['error'](_0x2f59be,_0x96b3('0x1ad'));}var _0x32fbcf={'body':_0x2f59be[_0x96b3('0x1ae')],'phone':_0x2f59be['to']||'','SmsAccountId':_0x498556['id']};logger[_0x96b3('0xda')](_0x96b3('0x1af'),JSON['stringify'](_0x32fbcf));this[_0x96b3('0x30')]['sync'](this,_0x2f59be,_0x2f59be[_0x96b3('0x1ac')]);this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format'](_0x96b3('0x1b0'),_0x498556[_0x96b3('0xc')]));this[_0x96b3('0x2f')][_0x96b3('0x6c')](this,_0x32fbcf);return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x1b1'));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x1b2')]=function(_0x27c728){logger['info'](util['format'](_0x96b3('0x1b3'),_0x27c728[_0x96b3('0x32')]));if(!this['isConfigured'](_0x27c728[_0x96b3('0xd2')])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x27c728,_0x96b3('0x1b4'));}var _0x143734=this['getVariable'][_0x96b3('0x6c')](this,_0x27c728['variable_id']);if(!_0x143734){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x27c728,_0x96b3('0x116'));}return this[_0x96b3('0x8')][_0x96b3('0xd5')](_0x143734,_0x27c728[_0x96b3('0x1b5')]);};AGIVertices['prototype']['start']=function(_0x1ae1e0){logger[_0x96b3('0x28')](util['format'](_0x96b3('0x1b6'),_0x1ae1e0['label']));this['channel'][_0x96b3('0xa1')]('START\x20CALLY\x20SQUARE');if(_0x1ae1e0[_0x96b3('0xaf')]===_0x96b3('0x1b7')){this[_0x96b3('0x8')]['noop'](_0x96b3('0x1b8'));return this[_0x96b3('0x8')][_0x96b3('0xaf')]();}return this[_0x96b3('0x8')]['noop'](_0x96b3('0x1b9'));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x1ba')]=function(_0x2a6dbe){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x1bb'),_0x2a6dbe[_0x96b3('0x32')]));if(!this['isConfigured'](_0x2a6dbe[_0x96b3('0x1bc')])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x2a6dbe,_0x96b3('0x1bd'));}var _0x11b703=this[_0x96b3('0x11')][_0x96b3('0x6c')](this,_0x2a6dbe['project_id']);if(!this[_0x96b3('0x7e')](_0x11b703)){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x2a6dbe,util[_0x96b3('0x24')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2a6dbe[_0x96b3('0x1bc')]));}if(_0x11b703===this[_0x96b3('0x8')][_0x96b3('0x34')]){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x2a6dbe,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x96b3('0x6c')](this,_0x2a6dbe,_0x11b703);var _0xfb14e9=this[_0x96b3('0x8')][_0x96b3('0x52')](_0x96b3('0x1be'),util[_0x96b3('0x24')](_0x96b3('0x1bf'),config['agi'][_0x96b3('0x19f')]||'127.0.0.1',_0x11b703,this[_0x96b3('0x8')][_0x96b3('0x34')]));if(_0xfb14e9[_0x96b3('0xa4')]===-0x1){return _0xfb14e9;}return this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format'](_0x96b3('0xbb'),_0x96b3('0x1be'),_0x11b703));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x1c0')]=function(_0x240a25){logger[_0x96b3('0x28')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x240a25[_0x96b3('0x32')]));var _0x1960d0=this[_0x96b3('0x51')][_0x96b3('0x6c')](this,_0x240a25[_0x96b3('0x1c1')]);this[_0x96b3('0x30')][_0x96b3('0x6c')](this,_0x240a25,_0x240a25['command']);if(this['isConfigured'](_0x240a25[_0x96b3('0xd2')])){var _0x19f391=this[_0x96b3('0x99')][_0x96b3('0x6c')](this,_0x240a25['variable_id']);if(_0x19f391){this[_0x96b3('0x8')][_0x96b3('0xd5')](_0x19f391,_0x1960d0);return this[_0x96b3('0x8')]['noop'](util[_0x96b3('0x24')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x240a25[_0x96b3('0x1c1')],_0x19f391));}}return this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x1c2'),_0x240a25[_0x96b3('0x1c1')]));};AGIVertices[_0x96b3('0xa')]['google_cloud_tts']=function(_0x5afa44){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x1c3'),_0x5afa44[_0x96b3('0x32')]));_0x5afa44[_0x96b3('0x57')]=_0x5afa44[_0x96b3('0x57')][_0x96b3('0xd0')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x96b3('0x7e')](_0x5afa44[_0x96b3('0x55')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0x1c4'));}if(!this['isConfigured'](_0x5afa44[_0x96b3('0x57')])){return this[_0x96b3('0x8')][_0x96b3('0xa1')](_0x96b3('0xbf'));}this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format'](_0x96b3('0x1c5'),_0x5afa44['text']));var _0xd6a366=this[_0x96b3('0x54')][_0x96b3('0x6c')](this,_0x5afa44);if(_0xd6a366){this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format'](_0x96b3('0x1c6'),_0xd6a366));var _0x2f91d7=this[_0x96b3('0x8')][_0x96b3('0x127')](_0xd6a366);try{fs['unlink'](_0xd6a366+'.wav');}catch(_0x373325){logger[_0x96b3('0x2b')](_0x373325);}return _0x2f91d7;}return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x5afa44,_0x96b3('0x1c7'));};AGIVertices[_0x96b3('0xa')][_0x96b3('0x1c8')]=function(_0x139bf3){logger['info'](util[_0x96b3('0x24')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x139bf3[_0x96b3('0x32')]));_0x139bf3[_0x96b3('0x57')]=_0x139bf3[_0x96b3('0x57')][_0x96b3('0xd0')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x96b3('0x7e')](_0x139bf3[_0x96b3('0x57')])){return this['channel'][_0x96b3('0xa1')](_0x96b3('0xbf'));}this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format'](_0x96b3('0x1c9'),_0x139bf3['text']));var _0x3607d7=this[_0x96b3('0x5e')][_0x96b3('0x6c')](this,_0x139bf3);if(_0x3607d7){this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')]('Google\x20TTS\x20%s\x20file\x20created',_0x3607d7));var _0x4b7081=this[_0x96b3('0x8')][_0x96b3('0x127')](_0x3607d7);try{fs['unlink'](_0x3607d7+'.wav');}catch(_0x2baefb){logger[_0x96b3('0x2b')](_0x2baefb);}return _0x4b7081;}return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x139bf3,_0x96b3('0x1ca'));};AGIVertices[_0x96b3('0xa')]['unpause']=function(_0x45fbcb){logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x1cb'),_0x45fbcb[_0x96b3('0x32')]));if(!this[_0x96b3('0x7e')](_0x45fbcb['findBy'])){return this[_0x96b3('0x8')]['error'](_0x45fbcb,_0x96b3('0x15f'));}logger[_0x96b3('0x28')](util[_0x96b3('0x24')](_0x96b3('0x160'),this['channel'][_0x96b3('0x35')],_0x45fbcb[_0x96b3('0x15e')]));var _0x17490a=this[_0x96b3('0x4c')][_0x96b3('0x6c')](this,_0x45fbcb[_0x96b3('0x15e')]);if(_0x17490a){logger[_0x96b3('0x28')](util[_0x96b3('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x96b3('0x35')],_0x45fbcb[_0x96b3('0x15e')]));this['channel'][_0x96b3('0xa1')](util[_0x96b3('0x24')](_0x96b3('0x161'),this[_0x96b3('0x8')]['callerid'],_0x45fbcb[_0x96b3('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x96b3('0x163'),this[_0x96b3('0x8')]['callerid'],_0x45fbcb[_0x96b3('0x15e')]));this[_0x96b3('0x8')][_0x96b3('0xa1')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x96b3('0x8')][_0x96b3('0x35')],_0x45fbcb[_0x96b3('0x15e')]));return{'code':0xc8,'result':_0x96b3('0x164')};}};AGIVertices[_0x96b3('0xa')]['voicemail']=function(_0x5479cd){logger[_0x96b3('0x28')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5479cd[_0x96b3('0x32')]));var _0x30928a=this[_0x96b3('0x8')]['exec'](_0x96b3('0x1cc'),[_0x5479cd[_0x96b3('0x1cd')],_0x5479cd[_0x96b3('0xa2')]]);if(_0x30928a[_0x96b3('0xa4')]===-0x1){return _0x30928a;}return this['channel'][_0x96b3('0xa1')](util['format'](_0x96b3('0xbb'),'VOICEMAIL',_0x5479cd['mailbox']));};AGIVertices[_0x96b3('0xa')]['vswitch']=function(_0x32b68c){logger['info'](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x32b68c['label']));if(!this['isConfigured'](_0x32b68c['variable_id'])){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x32b68c,_0x96b3('0x1b4'));}var _0x5ec5e7=this['getVariable'][_0x96b3('0x6c')](this,_0x32b68c[_0x96b3('0xd2')]);if(!_0x5ec5e7){return this[_0x96b3('0x8')][_0x96b3('0x2b')](_0x32b68c,_0x96b3('0x116'));}var _0x4a9669=this[_0x96b3('0x8')][_0x96b3('0x99')](_0x5ec5e7);return{'code':0xc8,'result':_0x4a9669['extra']?_0x4a9669[_0x96b3('0x9a')]:'-'};};String['prototype'][_0x96b3('0x1ce')]=function(_0x28ed99,_0x46df46){return this['split'](_0x28ed99)[_0x96b3('0x1cf')](_0x46df46);};module[_0x96b3('0x1d0')]=AGIVertices; \ No newline at end of file +var _0x1677=['scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','sestekNDA','key','ispeech_tts_language','speed','ispeechASR','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','tildeASR','appid','clone','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','query:\x20%s','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','no\x20variable\x20found','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','unlink','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%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','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeechTTS','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','menu','no\x20file\x20audio\x20selected','getSound','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','debug','sendMail\x20message','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','util','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','getdigits','getsecretdigits','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','callerid','createSquareRecording','extension','priority','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id'];(function(_0x287575,_0xbb9c74){var _0x598ba8=function(_0x5b4668){while(--_0x5b4668){_0x287575['push'](_0x287575['shift']());}};_0x598ba8(++_0xbb9c74);}(_0x1677,0x18f));var _0x7167=function(_0x434ac8,_0x5ce9d1){_0x434ac8=_0x434ac8-0x0;var _0x5729d7=_0x1677[_0x434ac8];return _0x5729d7;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x7167('0x0'));var _=require('lodash');var sh=require(_0x7167('0x1'));var odbc=require('odbc')();var rs=require(_0x7167('0x2'));var moment=require(_0x7167('0x3'));var Mustache=require(_0x7167('0x4'));var rp=require(_0x7167('0x5'));var logger=require(_0x7167('0x6'))('agi');var config=require(_0x7167('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x7167('0x8');var recursiveMapAttributes=[_0x7167('0x9'),'rawBody'];var verticesWithRetry=['menu',_0x7167('0xa'),_0x7167('0xb')];var AGIVertices=function(_0x49381c,_0xaaf5cc,_0x104f1a){this['channel']=_0x49381c;this['rpc']=_0xaaf5cc;this[_0x7167('0xc')]=_0x104f1a;};AGIVertices[_0x7167('0xd')][_0x7167('0xe')]=function(_0x179124,_0x1ee922){this[_0x7167('0xf')][_0x7167('0x10')](_0x179124)[_0x7167('0x11')](function(_0x17c6e2){_0x1ee922(null,_0x17c6e2?_0x17c6e2[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x96688a){_0x1ee922(_0x96688a);});};AGIVertices[_0x7167('0xd')]['getVoiceQueue']=function(_0x3d3715,_0xfdc20f){this['rpc'][_0x7167('0x14')](_0x3d3715)[_0x7167('0x11')](function(_0x3621c8){_0xfdc20f(null,_0x3621c8?_0x3621c8[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x20bc59){_0xfdc20f(_0x20bc59);});};AGIVertices[_0x7167('0xd')][_0x7167('0x15')]=function(_0x3b9d02,_0x39eab1){this[_0x7167('0xf')][_0x7167('0x16')](_0x3b9d02)[_0x7167('0x11')](function(_0x31f2a6){_0x39eab1(null,_0x31f2a6?_0x31f2a6[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x47ac15){_0x39eab1(_0x47ac15);});};AGIVertices[_0x7167('0xd')][_0x7167('0x17')]=function(_0x3b8d68,_0x47257a){this[_0x7167('0xf')][_0x7167('0x18')](_0x3b8d68)[_0x7167('0x11')](function(_0x3c9e6d){_0x47257a(null,_0x3c9e6d?_0x3c9e6d['dsn']:![]);})[_0x7167('0x13')](function(_0x14bebe){_0x47257a(_0x14bebe);});};AGIVertices[_0x7167('0xd')]['getUser']=function(_0x3abe6e,_0x423077){this[_0x7167('0xf')]['getUserById'](_0x3abe6e)[_0x7167('0x11')](function(_0x58175a){_0x423077(null,_0x58175a?_0x58175a[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x1dd57f){_0x423077(_0x1dd57f);});};AGIVertices[_0x7167('0xd')][_0x7167('0x19')]=function(_0x3b5014,_0x3a5aee){this[_0x7167('0xf')]['getTrunkById'](_0x3b5014)[_0x7167('0x11')](function(_0x176f73){_0x3a5aee(null,_0x176f73?_0x176f73[_0x7167('0x12')]:![]);})[_0x7167('0x13')](function(_0x348f88){_0x3a5aee(_0x348f88);});};AGIVertices[_0x7167('0xd')]['getSound']=function(_0x3c6882,_0x2397e1){var _0x38dd7e=this;this[_0x7167('0xf')][_0x7167('0x1a')](_0x3c6882)[_0x7167('0x11')](function(_0x4ed601){_0x2397e1(null,_0x4ed601?_0x38dd7e[_0x7167('0x1b')](_0x4ed601[_0x7167('0x1c')]):![]);})['catch'](function(_0x175d89){_0x2397e1(_0x175d89);});};AGIVertices[_0x7167('0xd')][_0x7167('0x1d')]=function(_0x40cd7f,_0x16742f){this[_0x7167('0xf')][_0x7167('0x1e')](_0x40cd7f)[_0x7167('0x11')](function(_0x2e4770){_0x16742f(null,_0x2e4770?_0x2e4770:![]);})[_0x7167('0x13')](function(_0x250dce){_0x16742f(_0x250dce);});};AGIVertices['prototype'][_0x7167('0x1f')]=function(_0x14405f,_0xe85f5e,_0x224377){this[_0x7167('0xc')]['sendMailMessage'](_0x14405f,_0xe85f5e)[_0x7167('0x11')](function(){_0x224377(null);})[_0x7167('0x13')](function(_0x3f4bcc){_0x224377(_0x3f4bcc);});};AGIVertices[_0x7167('0xd')]['getIntervals']=function(_0x184fd6,_0x3a408d){this[_0x7167('0xf')]['getIntervalById'](_0x184fd6)['then'](function(_0x54e620){if(_0x54e620){if(_0x54e620[_0x7167('0x20')]){_0x3a408d(null,[_0x54e620[_0x7167('0x21')]]);}else{_0x3a408d(null,_[_0x7167('0x22')](_0x54e620[_0x7167('0x23')],_0x7167('0x21')));}}else{_0x3a408d(null,![]);}})[_0x7167('0x13')](function(_0x3e8122){_0x3a408d(_0x3e8122);});};AGIVertices[_0x7167('0xd')][_0x7167('0x1b')]=function(_0x245ec4){return util[_0x7167('0x24')]('%s/sounds/converted/%s',FILES_PATH,_0x245ec4);};AGIVertices[_0x7167('0xd')][_0x7167('0x25')]=function(_0x59b265,_0x5d753f,_0x3d487a){odbc[_0x7167('0x26')](_0x59b265,function(_0x1fc341){if(_0x1fc341){logger[_0x7167('0x27')](_0x7167('0x28'),_0x1fc341);_0x3d487a(_0x1fc341);}else{logger[_0x7167('0x29')](_0x7167('0x2a'));odbc['query'](_0x5d753f,function(_0x406a09,_0x3512d9){if(_0x406a09){logger[_0x7167('0x29')](_0x7167('0x2b'),_0x5d753f);_0x3d487a(_0x406a09);}else{logger[_0x7167('0x29')](_0x7167('0x2c'),_0x5d753f);odbc[_0x7167('0x2d')](function(_0x2ac760){if(_0x2ac760){logger[_0x7167('0x27')](_0x7167('0x2e'),_0x2ac760);}_0x3d487a(null,_0x3512d9);});}});}});};AGIVertices[_0x7167('0xd')][_0x7167('0x2f')]=function(_0x548464,_0x3897de){this[_0x7167('0xf')][_0x7167('0x30')](_0x548464)[_0x7167('0x11')](function(_0x58cbfc){_0x3897de(null,_0x58cbfc?_0x58cbfc:![]);})[_0x7167('0x13')](function(_0x431873){_0x3897de(_0x431873);});};AGIVertices[_0x7167('0xd')][_0x7167('0x31')]=function(_0x314e73,_0x5e36aa){this[_0x7167('0xf')][_0x7167('0x31')](_0x314e73)[_0x7167('0x11')](function(_0xd63db0){_0x5e36aa(null,_0xd63db0);})[_0x7167('0x13')](function(_0x3f6bac){_0x5e36aa(_0x3f6bac);});};AGIVertices[_0x7167('0xd')][_0x7167('0x32')]=function(_0x3c5178,_0x548b86,_0x471f26){this[_0x7167('0xf')][_0x7167('0x32')]({'uniqueid':this['channel'][_0x7167('0x33')],'node':_0x3c5178[_0x7167('0x34')],'application':_0x3c5178[_0x7167('0x35')],'data':_0x548b86||null,'project_name':this[_0x7167('0x36')]['arg_1'],'callerid':this[_0x7167('0x36')][_0x7167('0x37')]})[_0x7167('0x11')](function(_0x5d07a8){if(_0x471f26){_0x471f26(null,_0x5d07a8);}})[_0x7167('0x13')](function(_0x253915){if(_0x471f26){_0x471f26(_0x253915);}});};AGIVertices[_0x7167('0xd')][_0x7167('0x38')]=function(_0x482b70,_0x4e3376,_0x5b94cc,_0x437e83){this[_0x7167('0xf')][_0x7167('0x38')]({'uniqueid':this[_0x7167('0x36')][_0x7167('0x33')],'callerid':this['channel'][_0x7167('0x37')],'calleridname':this[_0x7167('0x36')]['calleridname'],'context':this['channel']['context'],'extension':this[_0x7167('0x36')][_0x7167('0x39')],'priority':this[_0x7167('0x36')][_0x7167('0x3a')],'accountcode':this[_0x7167('0x36')]['accountcode'],'dnid':this[_0x7167('0x36')]['dnid'],'projectName':this['channel']['arg_1'],'saveName':_0x4e3376,'filename':_0x482b70[_0x7167('0x3b')]||_0x4e3376,'savePath':_0x5b94cc})[_0x7167('0x11')](function(_0x1dc81a){_0x437e83(null,_0x1dc81a);})[_0x7167('0x13')](function(_0x58d13b){_0x437e83(_0x58d13b);});};AGIVertices[_0x7167('0xd')][_0x7167('0x3c')]=function(_0x22a05c,_0x49c09b,_0x384707,_0x154c06,_0x5e3ef7){this[_0x7167('0xf')][_0x7167('0x3c')]({'uniqueid':this[_0x7167('0x36')][_0x7167('0x33')],'body':_0x22a05c,'direction':_0x49c09b,'providerName':_0x384707,'providerResponse':_0x154c06})[_0x7167('0x11')](function(_0x4ea134){if(_0x5e3ef7){_0x5e3ef7(null,_0x4ea134);}})['catch'](function(_0x3d8d9c){if(_0x5e3ef7){_0x5e3ef7(_0x3d8d9c);}});};AGIVertices[_0x7167('0xd')][_0x7167('0x3d')]=function(_0x2b0f5d,_0x7ac906){this['rpc'][_0x7167('0x3d')]({'firstName':_[_0x7167('0x3e')](_0x2b0f5d['name'])||_[_0x7167('0x3f')](_0x2b0f5d[_0x7167('0x12')])?_0x7167('0x40')+Math[_0x7167('0x41')]():_0x2b0f5d['name'],'lastName':_[_0x7167('0x3e')](_0x2b0f5d[_0x7167('0x42')])||_['isNil'](_0x2b0f5d['lastName'])?null:_0x2b0f5d[_0x7167('0x42')],'phone':_0x2b0f5d[_0x7167('0x43')],'ListId':_0x2b0f5d[_0x7167('0x44')],'scheduledat':_0x2b0f5d[_0x7167('0x45')],'callbackUniqueid':this[_0x7167('0x36')]['uniqueid'],'tags':_0x7167('0x46'),'description':_0x7167('0x47')+_0x2b0f5d[_0x7167('0x45')][_0x7167('0x48')](),'priority':_0x2b0f5d[_0x7167('0x49')]})[_0x7167('0x11')](function(_0xe51f77){_0x7ac906(null,_0xe51f77);})[_0x7167('0x13')](function(_0x2695e9){_0x7ac906(_0x2695e9);});};AGIVertices['prototype']['getPause']=function(_0x1e4948,_0x25073f){this[_0x7167('0xf')][_0x7167('0x4a')](_0x1e4948)['then'](function(_0x3ad623){_0x25073f(null,_0x3ad623?_0x3ad623[_0x7167('0x12')]:![]);})['catch'](function(_0x21fd3e){_0x25073f(_0x21fd3e);});};AGIVertices[_0x7167('0xd')][_0x7167('0x4b')]=function(_0x11637f,_0x3b79b4,_0x4a63ba){var _0x588ff9={'role':_0x7167('0x4c')};_0x588ff9[_0x11637f]=this[_0x7167('0x36')]['callerid'];this[_0x7167('0xf')][_0x7167('0x4b')](_0x588ff9,_0x3b79b4,this['channel']['uniqueid'])[_0x7167('0x11')](function(_0x535bf5){_0x4a63ba(null,_[_0x7167('0x3f')](_0x535bf5)?![]:!![]);})[_0x7167('0x13')](function(_0x59995a){logger[_0x7167('0x27')](_0x59995a);_0x4a63ba(null,![]);});};AGIVertices[_0x7167('0xd')]['agentUnpause']=function(_0x2ff3e0,_0x247f8b){var _0x39b8f4={'role':_0x7167('0x4c')};_0x39b8f4[_0x2ff3e0]=this[_0x7167('0x36')]['callerid'];this[_0x7167('0xf')][_0x7167('0x4d')](_0x39b8f4)[_0x7167('0x11')](function(_0xaf6cb9){_0x247f8b(null,_[_0x7167('0x3f')](_0xaf6cb9)?![]:!![]);})[_0x7167('0x13')](function(_0x49710b){logger[_0x7167('0x27')](_0x49710b);_0x247f8b(null,![]);});};AGIVertices[_0x7167('0xd')][_0x7167('0x4e')]=function(_0x1288c7,_0x4dd858){var _0xa8a505={'role':_0x7167('0x4c')};_0xa8a505[_0x1288c7]=this[_0x7167('0x36')][_0x7167('0x37')];this[_0x7167('0xf')][_0x7167('0x4e')](_0xa8a505)[_0x7167('0x11')](function(_0x429e1b){_0x4dd858(null,_[_0x7167('0x3f')](_0x429e1b)?![]:!![]);})[_0x7167('0x13')](function(_0x20b3f3){logger[_0x7167('0x27')](_0x20b3f3);_0x4dd858(null,![]);});};AGIVertices[_0x7167('0xd')]['agentLogin']=function(_0x4a847e,_0x2070af){var _0x4b714f={'role':_0x7167('0x4c')};_0x4b714f[_0x4a847e]=this[_0x7167('0x36')]['callerid'];var _0x110649=_0x4a847e!=_0x7167('0x4f')?util[_0x7167('0x24')](_0x7167('0x50'),_0x7167('0x51'),this['channel']['callerid']):undefined;this['rpc'][_0x7167('0x52')](_0x4b714f,_0x110649)['then'](function(_0x5d7567){_0x2070af(null,_['isNil'](_0x5d7567)?![]:!![]);})[_0x7167('0x13')](function(_0xceb41f){logger[_0x7167('0x27')](_0xceb41f);_0x2070af(null,![]);});};AGIVertices[_0x7167('0xd')][_0x7167('0x53')]=function(_0x460e6f,_0x5f25e2){sh[_0x7167('0x54')](_['trim'](_0x460e6f),function(_0x4b030a,_0x51f8bd){var _0x3123c8=_0x51f8bd[_0x7167('0x55')](/(\r\n|\n|\r)/gm,'');_0x5f25e2(null,_0x3123c8);});};AGIVertices[_0x7167('0xd')][_0x7167('0x56')]=function(_0x17356f,_0x5390ae){scripts[_0x7167('0x56')](_0x17356f[_0x7167('0x57')],_0x17356f[_0x7167('0x58')]||_0x7167('0x59'),_0x17356f[_0x7167('0x59')],_0x17356f[_0x7167('0x5a')]||_0x7167('0x5b'),_0x17356f[_0x7167('0x5c')]||_0x7167('0x5d'),_0x17356f[_0x7167('0x5e')]||_0x7167('0x5f'))[_0x7167('0x11')](function(_0x5da7b5){_0x5390ae(null,_0x5da7b5);})[_0x7167('0x13')](function(_0xd18b2e){_0x5390ae(_0xd18b2e);});};AGIVertices['prototype'][_0x7167('0x60')]=function(_0x403a79,_0x2dbaec){scripts[_0x7167('0x60')](_0x403a79['text'],_0x403a79[_0x7167('0x61')]||'en',0x1)[_0x7167('0x11')](function(_0x509200){_0x2dbaec(null,_0x509200);})['catch'](function(_0x280d44){_0x2dbaec(_0x280d44);});};AGIVertices['prototype'][_0x7167('0x62')]=function(_0x429de9,_0x203d33){var _0x54b0aa={'uri':_0x429de9[_0x7167('0x63')],'method':_0x429de9[_0x7167('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x429de9[_0x7167('0x65')])===_0x7167('0x66')&&parseInt(_0x429de9[_0x7167('0x65')])>=0x1?parseInt(_0x429de9[_0x7167('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x7167('0x67')]([_0x7167('0x68'),_0x7167('0x69')],_0x54b0aa[_0x7167('0x64')][_0x7167('0x6a')]())){try{_0x54b0aa[_0x7167('0x6b')]=_0x429de9[_0x7167('0x6c')]?JSON['parse'](_0x429de9[_0x7167('0x6c')]):{};}catch(_0x2bd3cc){logger[_0x7167('0x27')](_0x7167('0x6d'),_0x2bd3cc);}}try{_0x54b0aa['headers']=_0x429de9[_0x7167('0x9')]?JSON['parse'](_0x429de9[_0x7167('0x9')]):{};}catch(_0x20c639){logger[_0x7167('0x27')](_0x7167('0x6e'),_0x20c639);}if(_0x429de9[_0x7167('0x6f')]){try{var _0x323269=require(_0x429de9[_0x7167('0x6f')])[_0x7167('0x70')](this,_0x54b0aa);_0x54b0aa[_0x7167('0x71')]=Mustache['render'](_0x429de9['url'],_0x323269,{},['$$','$$']);if(_0x54b0aa[_0x7167('0x72')]){_0x54b0aa[_0x7167('0x72')]=JSON[_0x7167('0x73')](Mustache['render'](JSON[_0x7167('0x74')](_0x54b0aa[_0x7167('0x72')]),_0x323269,{},['$$','$$']));}if(_0x54b0aa[_0x7167('0x6b')]){_0x54b0aa['body']=JSON['parse'](Mustache['render'](JSON['stringify'](_0x54b0aa[_0x7167('0x6b')]),_0x323269,{},['$$','$$']));}}catch(_0x206b1d){logger['error'](_0x7167('0x75'),_0x206b1d);}}rp(_0x54b0aa)[_0x7167('0x11')](function(_0x779d05){var _0xdef550={'statusCode':_0x779d05[_0x7167('0x76')]||0xc8,'statusMessage':_0x779d05[_0x7167('0x77')]||'OK','headers':_0x779d05[_0x7167('0x72')]||{},'body':_0x779d05[_0x7167('0x6b')]||{}};_0x203d33(null,_0xdef550);})[_0x7167('0x13')](function(_0x3d6a67){var _0x4f012d={'statusCode':_0x3d6a67[_0x7167('0x76')]||0x1f4,'statusMessage':_0x3d6a67[_0x7167('0x78')]||_0x7167('0x79'),'headers':_0x3d6a67[_0x7167('0x7a')][_0x7167('0x72')]||{},'body':_0x3d6a67[_0x7167('0x7a')]['body']||{}};_0x203d33(null,_0x4f012d);});};AGIVertices['prototype'][_0x7167('0x7b')]=function(_0x5441f7,_0x361701){scripts[_0x7167('0x7b')](this[_0x7167('0x36')]['uniqueid'],_0x5441f7['key'],_0x5441f7[_0x7167('0x59')],_0x5441f7[_0x7167('0x7c')]||'en')[_0x7167('0x11')](function(_0x2d01e1){_0x361701(null,_0x2d01e1);})[_0x7167('0x13')](function(_0x4476ae){_0x361701(_0x4476ae);});};AGIVertices[_0x7167('0xd')][_0x7167('0x7d')]=function(_0x23a39e,_0x3df345){scripts[_0x7167('0x7d')](this[_0x7167('0x36')][_0x7167('0x33')],_0x23a39e['dialogflowV2_project_id'],_0x23a39e[_0x7167('0x7e')],_0x23a39e['private_key'],_0x23a39e[_0x7167('0x59')],_0x23a39e['dialogflowV2_language']||'en')[_0x7167('0x11')](function(_0x36a25d){_0x3df345(null,_0x36a25d);})[_0x7167('0x13')](function(_0x10c61b){_0x3df345(_0x10c61b);});};AGIVertices['prototype']['sestekNDA']=function(_0x24f794,_0x1cbcd0){scripts[_0x7167('0x7f')](this[_0x7167('0x36')],_0x24f794)[_0x7167('0x11')](function(_0x54b114){_0x1cbcd0(null,_0x54b114);})[_0x7167('0x13')](function(_0x5be4eb){_0x1cbcd0(_0x5be4eb);});};AGIVertices[_0x7167('0xd')]['ispeechTTS']=function(_0x1e4c5d,_0x19ad14){scripts['ispeechTTS'](_0x1e4c5d[_0x7167('0x80')],_0x1e4c5d[_0x7167('0x59')],_0x1e4c5d[_0x7167('0x81')]||_0x7167('0x5b'),_0x1e4c5d[_0x7167('0x82')])[_0x7167('0x11')](function(_0x524e40){_0x19ad14(null,_0x524e40);})[_0x7167('0x13')](function(_0x42674b){_0x19ad14(_0x42674b);});};AGIVertices[_0x7167('0xd')][_0x7167('0x83')]=function(_0x49c114,_0x4ca87f,_0x33189b){scripts['ispeechASR'](_0x4ca87f,_0x49c114[_0x7167('0x80')],_0x49c114['ispeech_asr_language']||'en-US',this['isConfigured'](_0x49c114[_0x7167('0x84')])?_0x49c114[_0x7167('0x84')]:undefined)[_0x7167('0x11')](function(_0x5831e2){_0x33189b(null,_0x5831e2);})[_0x7167('0x13')](function(_0x29283b){_0x33189b(_0x29283b);});};AGIVertices[_0x7167('0xd')]['awsPolly']=function(_0x302ab2,_0x291b01){scripts[_0x7167('0x85')](_0x302ab2[_0x7167('0x86')],_0x302ab2[_0x7167('0x87')],_0x302ab2['aws_polly_region'],_0x302ab2[_0x7167('0x88')]||_0x7167('0x89'),_0x302ab2[_0x7167('0x59')],_0x302ab2[_0x7167('0x8a')]||_0x7167('0x59'))['then'](function(_0x275cfd){_0x291b01(null,_0x275cfd);})[_0x7167('0x13')](function(_0x4a5e99){_0x291b01(_0x4a5e99);});};AGIVertices[_0x7167('0xd')][_0x7167('0x8b')]=function(_0x238fc5,_0x336478){scripts['awsLex'](this[_0x7167('0x36')][_0x7167('0x33')],_0x238fc5[_0x7167('0x86')],_0x238fc5[_0x7167('0x87')],_0x238fc5[_0x7167('0x8c')],_0x238fc5[_0x7167('0x59')],_0x238fc5[_0x7167('0x8d')])['then'](function(_0x3ea1f2){_0x336478(null,_0x3ea1f2);})[_0x7167('0x13')](function(_0x972330){_0x336478(_0x972330);});};AGIVertices['prototype'][_0x7167('0x8e')]=function(_0xead982,_0x592daa,_0x421eee){scripts[_0x7167('0x8e')](_0x592daa,_0xead982[_0x7167('0x80')],_0xead982['google_asr_language']||_0x7167('0x5b'))[_0x7167('0x11')](function(_0x418c45){_0x421eee(null,_0x418c45);})['catch'](function(_0x3089d0){_0x421eee(_0x3089d0);});};AGIVertices[_0x7167('0xd')][_0x7167('0x8f')]=function(_0x5c08eb,_0x833ea5,_0x14475a){scripts['tildeASR'](_0x833ea5,_0x5c08eb[_0x7167('0x90')],_0x5c08eb['appsecret'],_0x5c08eb[_0x7167('0x71')])[_0x7167('0x11')](function(_0x483e83){_0x14475a(null,_0x483e83);})[_0x7167('0x13')](function(_0x512801){_0x14475a(_0x512801);});};AGIVertices[_0x7167('0xd')]['clear']=function(_0x97f72d){var _0x465ef2=_['includes'](verticesWithRetry,_0x97f72d[_0x7167('0x35')])?_0x97f72d:_[_0x7167('0x91')](_0x97f72d);for(var _0x1a21ec in _0x465ef2){if(_0x465ef2[_0x7167('0x92')](_0x1a21ec)){if(_0x465ef2[_0x1a21ec]&&_[_0x7167('0x93')](_0x465ef2[_0x1a21ec])){if(_[_0x7167('0x67')](recursiveMapAttributes,_0x1a21ec)){_0x465ef2[_0x1a21ec]=this['replaceObjectAllVariables'](_0x465ef2[_0x1a21ec]);}else{_0x465ef2[_0x1a21ec]=this['replaceAllVariables'](_0x465ef2[_0x1a21ec]);}}}}return _0x465ef2;};AGIVertices[_0x7167('0xd')][_0x7167('0x94')]=function(_0x471dcc){for(var _0x5da88c in _0x471dcc){if(_0x471dcc[_0x7167('0x92')](_0x5da88c)){if(_[_0x7167('0x95')](_0x471dcc[_0x5da88c])){this[_0x7167('0x94')](_0x471dcc[_0x5da88c]);}else if(_[_0x7167('0x96')](_0x471dcc[_0x5da88c])){for(var _0x442508=0x0;_0x442508<_0x471dcc[_0x5da88c][_0x7167('0x97')];_0x442508++){this['recursiveNodeIndex'](_0x471dcc[_0x5da88c][_0x442508]);}}else if(_[_0x7167('0x93')](_0x471dcc[_0x5da88c])){_0x471dcc[_0x5da88c]=this[_0x7167('0x98')](_0x471dcc[_0x5da88c]);}}}};AGIVertices[_0x7167('0xd')][_0x7167('0x99')]=function(_0x56940c,_0x1895c6){for(var _0x489468 in _0x56940c){if(_0x56940c[_0x7167('0x92')](_0x489468)){if(_[_0x7167('0x95')](_0x56940c[_0x489468])){if(!_['isEmpty'](_0x56940c[_0x489468])){this[_0x7167('0x99')](_0x56940c[_0x489468],util[_0x7167('0x24')](_0x7167('0x9a'),_0x1895c6,_0x489468));}}else if(_[_0x7167('0x96')](_0x56940c[_0x489468])){for(var _0x33ef46=0x0;_0x33ef46<_0x56940c[_0x489468][_0x7167('0x97')];_0x33ef46++){this[_0x7167('0x99')](_0x56940c[_0x489468][_0x33ef46],util[_0x7167('0x24')](_0x7167('0x9a'),_0x1895c6,_0x489468+'['+_0x33ef46+']'));}}else{if(!_[_0x7167('0x3f')](_0x56940c[_0x489468])){this[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x9a'),_0x1895c6,_0x489468),_0x56940c[_0x489468]);}}}}};AGIVertices['prototype'][_0x7167('0x9c')]=function(_0x5d21e1){try{var _0x136a31=JSON[_0x7167('0x73')](_0x5d21e1);this[_0x7167('0x94')](_0x136a31);return JSON['stringify'](_0x136a31);}catch(_0x335601){return this[_0x7167('0x98')](_0x5d21e1);}};AGIVertices[_0x7167('0xd')][_0x7167('0x98')]=function(_0xb807bc){var _0x306808=_0xb807bc['split']('{');for(var _0x38a53f=0x1;_0x38a53f<_0x306808[_0x7167('0x97')];_0x38a53f+=0x1){var _0x408699=_0x306808[_0x38a53f][_0x7167('0x9d')]('}');if(_0x408699['length']>0x1){_0xb807bc=_0xb807bc[_0x7167('0x9e')]('{'+_0x408699[0x0]+'}',this[_0x7167('0x36')][_0x7167('0xe')](_0x408699[0x0])[_0x7167('0x9f')]||_0x408699[0x0]);}}if(_0x306808[_0x7167('0x97')]===0x1){return _0xb807bc[_0x7167('0x48')]();}return this['replaceAllVariables'](_0xb807bc);};AGIVertices[_0x7167('0xd')][_0x7167('0xa0')]=function(_0x7b3778,_0xb7b2e3){var _0x2ec67f=this['channel'][_0x7167('0xe')](_0x7b3778);if(_0x2ec67f[_0x7167('0xa1')]===-0x1){return _0x2ec67f;}logger['info'](util[_0x7167('0x24')](_0x7167('0xa2'),_0xb7b2e3,_0x2ec67f[_0x7167('0x9f')]));return this[_0x7167('0x36')][_0x7167('0x9b')](_0xb7b2e3,_0x2ec67f['extra']);};AGIVertices[_0x7167('0xd')][_0x7167('0xa3')]=function(_0xc1ebc0){return _0xc1ebc0&&_0xc1ebc0!=='0'&&_0xc1ebc0!=='-1'&&_0xc1ebc0!=='';};AGIVertices[_0x7167('0xd')][_0x7167('0xa4')]=function(_0x1a9333){this[_0x7167('0x32')][_0x7167('0x70')](this,_0x1a9333,'-');_0x1a9333[_0x7167('0xa5')]=_0x1a9333[_0x7167('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7167('0xd')]['mrcpsynth']=function(_0x30ce76){logger[_0x7167('0x29')](util['format'](_0x7167('0xa6'),_0x30ce76[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x30ce76['text'])){return this[_0x7167('0x36')]['noop'](_0x7167('0xa7'));}var _0x4c8575='\x22'+_0x30ce76[_0x7167('0x59')]+'\x22';if(this[_0x7167('0xa3')](_0x30ce76['options'])){_0x4c8575+=','+_0x30ce76[_0x7167('0x7a')];}var _0x4f8951=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0xa8'),_0x4c8575);if(_0x4f8951['result']===-0x1){return _0x4f8951;}return this['channel']['noop'](util[_0x7167('0x24')](_0x7167('0xa9'),_0x4c8575));};AGIVertices['prototype']['mrcprecog']=function(_0x28e78a){logger['info'](util['format'](_0x7167('0xaa'),_0x28e78a[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x28e78a[_0x7167('0xab')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20grammar\x20configured');}var _0x15c7aa=_0x28e78a['grammar'];if(this['isConfigured'](_0x28e78a[_0x7167('0x7a')])){_0x15c7aa+=','+_0x28e78a[_0x7167('0x7a')];}var _0x47bf40=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0xad'),_0x15c7aa);if(_0x47bf40[_0x7167('0xa1')]===-0x1){return _0x47bf40;}var _0x3eb00a=this[_0x7167('0xa0')](_0x7167('0xae'),_0x7167('0xaf'));if(_0x3eb00a[_0x7167('0xa1')]===-0x1){return _0x3eb00a;}var _0x5f1f42=this['getAndSetVariable'](_0x7167('0xb0'),_0x7167('0xb1'));if(_0x5f1f42[_0x7167('0xa1')]===-0x1){return _0x5f1f42;}var _0x24183a=this[_0x7167('0xa0')]('RECOG_INSTANCE()',_0x7167('0xb2'));if(_0x24183a[_0x7167('0xa1')]===-0x1){return _0x24183a;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xb3'),_0x15c7aa));};AGIVertices[_0x7167('0xd')][_0x7167('0xb4')]=function(_0x2cfd17){logger['info'](util['format'](_0x7167('0xb5'),_0x2cfd17[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0xb4')]([_0x2cfd17[_0x7167('0xb6')],_0x2cfd17[_0x7167('0xb7')]]);};AGIVertices[_0x7167('0xd')][_0x7167('0xb8')]=function(_0x3f719e){logger[_0x7167('0x29')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3f719e['label']));if(this[_0x7167('0xa3')](_0x3f719e[_0x7167('0x65')])){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0xb9'),_0x3f719e['timeout']));var _0x322bfb=this[_0x7167('0x36')][_0x7167('0xba')](_0x3f719e[_0x7167('0x65')]);if(_0x322bfb['result']===-0x1){return _0x322bfb;}}return this[_0x7167('0x36')][_0x7167('0xb8')]();};AGIVertices[_0x7167('0xd')][_0x7167('0x46')]=function(_0x47a89c){logger['info'](util['format'](_0x7167('0xbb'),_0x47a89c[_0x7167('0x34')]));if(!this['isConfigured'](_0x47a89c[_0x7167('0x44')])){return this[_0x7167('0x36')]['error'](_0x47a89c,_0x7167('0xbc'));}_0x47a89c[_0x7167('0x45')]=moment();if(this[_0x7167('0xa3')](_0x47a89c['delay'])){_0x47a89c[_0x7167('0x45')]=moment()[_0x7167('0xbd')](_0x47a89c[_0x7167('0xbe')],_0x7167('0xbf'));}if(!this[_0x7167('0xa3')](_0x47a89c[_0x7167('0x49')])){_0x47a89c[_0x7167('0x49')]=0x2;}this[_0x7167('0x3d')][_0x7167('0x70')](this,_0x47a89c);return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xc0'),_0x47a89c[_0x7167('0x43')],_0x47a89c['list_id'],_0x47a89c[_0x7167('0x45')]));};AGIVertices['prototype'][_0x7167('0xc1')]=function(_0x527e48){logger['info'](util[_0x7167('0x24')](_0x7167('0xc2'),_0x527e48[_0x7167('0x34')]));var _0x19f0de=this[_0x7167('0x36')]['exec'](_0x527e48[_0x7167('0xc3')],_0x527e48[_0x7167('0x7a')]);if(_0x19f0de[_0x7167('0xa1')]===-0x1){return _0x19f0de;}return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xc4'),_0x527e48[_0x7167('0xc3')],_0x527e48[_0x7167('0x7a')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x3cb7c2){logger['info'](util['format'](_0x7167('0xc5'),_0x3cb7c2['label']));if(!this['isConfigured'](_0x3cb7c2['text'])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20text\x20configured');}var _0x343089='\x22'+_0x3cb7c2['text']+'\x22';if(this[_0x7167('0xa3')](_0x3cb7c2['options'])){_0x343089+=','+_0x3cb7c2[_0x7167('0x7a')];}var _0x4f2bd6=this['channel'][_0x7167('0x54')]('MRCPSynth',_0x343089);if(_0x4f2bd6[_0x7167('0xa1')]===-0x1){return _0x4f2bd6;}return this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0xa9'),_0x343089));};AGIVertices[_0x7167('0xd')][_0x7167('0xc6')]=function(_0x31036e){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0xc7'),_0x31036e[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x31036e[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}var _0xed0961='\x22'+_0x31036e[_0x7167('0x59')]+'\x22';if(this[_0x7167('0xa3')](_0x31036e[_0x7167('0x7a')])){_0xed0961+=','+_0x31036e[_0x7167('0x7a')];}var _0x47e25c=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0xa8'),_0xed0961);if(_0x47e25c['result']===-0x1){return _0x47e25c;}return this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0xa9'),_0xed0961));};AGIVertices[_0x7167('0xd')]['lumenvoxasr']=function(_0x16c95b){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x16c95b['label']));if(!this[_0x7167('0xa3')](_0x16c95b['grammar'])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xc8'));}var _0x3912f3=_0x16c95b[_0x7167('0xab')];if(this[_0x7167('0xa3')](_0x16c95b[_0x7167('0x7a')])){_0x3912f3+=','+_0x16c95b[_0x7167('0x7a')];}var _0x32735c=this['channel'][_0x7167('0x54')](_0x7167('0xad'),_0x3912f3);if(_0x32735c['result']===-0x1){return _0x32735c;}var _0x319dff=this[_0x7167('0xa0')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x319dff[_0x7167('0xa1')]===-0x1){return _0x319dff;}var _0x2834b7=this[_0x7167('0xa0')](_0x7167('0xb0'),_0x7167('0xc9'));if(_0x2834b7[_0x7167('0xa1')]===-0x1){return _0x2834b7;}var _0x2372a5=this['getAndSetVariable'](_0x7167('0xca'),_0x7167('0xcb'));if(_0x2372a5[_0x7167('0xa1')]===-0x1){return _0x2372a5;}return this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0xb3'),_0x3912f3));};AGIVertices[_0x7167('0xd')][_0x7167('0xcc')]=function(_0x5bf8f8){logger['info'](util[_0x7167('0x24')](_0x7167('0xcd'),_0x5bf8f8[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x5bf8f8[_0x7167('0xab')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xc8'));}var _0x4d585d=_0x5bf8f8['grammar'];if(this['isConfigured'](_0x5bf8f8['options'])){_0x4d585d+=','+_0x5bf8f8['options'];}var _0x25cd23=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0xad'),_0x4d585d);if(_0x25cd23[_0x7167('0xa1')]===-0x1){return _0x25cd23;}var _0x4e868b=this[_0x7167('0xa0')](_0x7167('0xae'),_0x7167('0xce'));if(_0x4e868b['result']===-0x1){return _0x4e868b;}var _0x1f819f=this['getAndSetVariable'](_0x7167('0xb0'),_0x7167('0xcf'));if(_0x1f819f['result']===-0x1){return _0x1f819f;}var _0x41fd1b=this[_0x7167('0xa0')](_0x7167('0xca'),_0x7167('0xd0'));if(_0x41fd1b['result']===-0x1){return _0x41fd1b;}return this[_0x7167('0x36')][_0x7167('0xac')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x4d585d));};AGIVertices[_0x7167('0xd')][_0x7167('0xd1')]=function(_0x1e0fdc){logger['info'](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x1e0fdc[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x1e0fdc[_0x7167('0xd2')])){return this[_0x7167('0x36')]['error'](_0x1e0fdc,_0x7167('0xd3'));}var _0x55af82=this['getSquareOdbc'][_0x7167('0x70')](this,_0x1e0fdc[_0x7167('0xd2')]);if(!_0x55af82){return this['channel'][_0x7167('0x27')](_0x1e0fdc,'no\x20odbc\x20database\x20found');}if(!this[_0x7167('0xa3')](_0x1e0fdc[_0x7167('0xd4')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1e0fdc,_0x7167('0xd5'));}var _0xe5005e=_0x1e0fdc[_0x7167('0xd4')][_0x7167('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xd6'),_0xe5005e));var _0x32e7c7=this[_0x7167('0x25')][_0x7167('0x70')](this,_0x55af82,_0xe5005e);this['createSquareDetailsReport'][_0x7167('0x70')](this,_0x1e0fdc,_0xe5005e);if(!this[_0x7167('0xa3')](_0x1e0fdc['variable_id'])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2cce35=this[_0x7167('0xe')]['sync'](this,_0x1e0fdc['variable_id']);if(!_0x2cce35){return this[_0x7167('0x36')]['error'](_0x1e0fdc,'no\x20variable\x20found');}var _0x105559=this;_0x32e7c7['forEach'](function(_0x7f23d9,_0x115363){Object['keys'](_0x7f23d9)['forEach'](function(_0x497412){_0x105559[_0x7167('0x36')]['setVariable'](util[_0x7167('0x24')](_0x7167('0xd7'),_0x2cce35,_0x115363,_0x497412),_0x7f23d9[_0x497412]);});});this[_0x7167('0x36')][_0x7167('0x9b')](util['format'](_0x7167('0xd8'),_0x2cce35),_0x32e7c7[_0x7167('0x97')]);return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xd9'),_0x2cce35));};AGIVertices['prototype'][_0x7167('0xda')]=function(_0xb760c5){logger['debug'](util[_0x7167('0x24')](_0x7167('0xdb'),_0xb760c5[_0x7167('0x34')]));if(!this['isConfigured'](_0xb760c5['sip_id'])){return this[_0x7167('0x36')][_0x7167('0x27')](_0xb760c5,_0x7167('0xdc'));}var _0x91914c=this[_0x7167('0xdd')][_0x7167('0x70')](this,_0xb760c5[_0x7167('0xde')]);if(!_0x91914c){return this[_0x7167('0x36')][_0x7167('0x27')](_0xb760c5,_0x7167('0xdf'));}var _0x260203=this['channel'][_0x7167('0x54')](_0x7167('0xe0'),[util[_0x7167('0x24')](_0x7167('0xe1'),_0x91914c),_0xb760c5[_0x7167('0x65')],_0xb760c5[_0x7167('0xe2')],_0xb760c5[_0x7167('0x63')]]);if(_0x260203[_0x7167('0xa1')]===-0x1){return _0x260203;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xe3'),_0x7167('0xe0')));};AGIVertices[_0x7167('0xd')][_0x7167('0xe4')]=function(_0x5890f4){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0xe5'),_0x5890f4['label']));if(!this[_0x7167('0xa3')](_0x5890f4[_0x7167('0x80')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xe6'));}if(!this[_0x7167('0xa3')](_0x5890f4[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xe7')]=!![];this[_0x7167('0x32')](_0x5890f4);this[_0x7167('0x3c')](_0x5890f4['text'],'in','','');this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xe8'),_0x5890f4['text']));var _0x11a9d3=this['googleDialogflow']['sync'](this,_0x5890f4);if(_0x11a9d3){for(var _0x4848a5 in _0x11a9d3){if(_0x11a9d3[_0x7167('0x92')](_0x4848a5)){this['channel'][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0xe9'),_0x4848a5[_0x7167('0x6a')]()),_0x11a9d3[_0x4848a5]);}}this[_0x7167('0x3c')](_0x11a9d3[_0x7167('0xea')],_0x7167('0xeb'),'dialogflow','');return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xec'),_0x11a9d3[_0x7167('0xea')]));}return this['channel'][_0x7167('0x27')](_0x5890f4,_0x7167('0xed'));};AGIVertices[_0x7167('0xd')][_0x7167('0xee')]=function(_0x3f5b36){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0xef'),_0x3f5b36[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x3f5b36[_0x7167('0xf0')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xf1'));}if(!this[_0x7167('0xa3')](_0x3f5b36[_0x7167('0x7e')])){return this['channel']['noop'](_0x7167('0xf2'));}if(!this['isConfigured'](_0x3f5b36[_0x7167('0xf3')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xf4'));}if(!this[_0x7167('0xa3')](_0x3f5b36[_0x7167('0xf5')])){return this['channel']['noop'](_0x7167('0xf6'));}if(!this['isConfigured'](_0x3f5b36[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xe7')]=!![];this['createSquareDetailsReport'](_0x3f5b36);this[_0x7167('0x3c')](_0x3f5b36[_0x7167('0x59')],'in','','');this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xf7'),_0x3f5b36[_0x7167('0x59')]));var _0x326b8f=this[_0x7167('0x7d')]['sync'](this,_0x3f5b36);if(_0x326b8f){for(var _0x21f608 in _0x326b8f){if(_0x326b8f[_0x7167('0x92')](_0x21f608)){if(_0x21f608!==_0x7167('0xf8')){this[_0x7167('0x36')][_0x7167('0x9b')](util['format'](_0x7167('0xe9'),_0x21f608['toUpperCase']()),_0x326b8f[_0x21f608]);}}}this[_0x7167('0x3c')](_0x326b8f[_0x7167('0xea')],'out',_0x7167('0xee'),_0x326b8f[_0x7167('0xf8')]);return this['channel'][_0x7167('0xac')](util['format']('DialogflowV2\x20Result\x20%s',_0x326b8f[_0x7167('0xea')]));}return this[_0x7167('0x36')][_0x7167('0x27')](_0x3f5b36,_0x7167('0xf9'));};AGIVertices[_0x7167('0xd')]['sesteknda']=function(_0x3007d7){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x3007d7[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x3007d7[_0x7167('0xfa')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x7167('0xa3')](_0x3007d7[_0x7167('0xfb')])){return this[_0x7167('0x36')]['noop'](_0x7167('0xfc'));}if(!this[_0x7167('0xa3')](_0x3007d7[_0x7167('0xfd')])){return this['channel'][_0x7167('0xac')](_0x7167('0xfe'));}if(!this['isConfigured'](_0x3007d7['ndassistant_url'])){return this['channel'][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xe7')]=!![];this[_0x7167('0x32')](_0x3007d7);this[_0x7167('0x3c')](_0x3007d7[_0x7167('0x59')],'in','','');this['channel'][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xff'),_0x3007d7['text']));var _0x3abf22=this['sestekNDA'][_0x7167('0x70')](this,_0x3007d7);if(_0x3abf22){for(var _0x3f6c4c in _0x3abf22){if(_0x3abf22[_0x7167('0x92')](_0x3f6c4c)){this[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x100'),_0x3f6c4c[_0x7167('0x6a')]()),_0x3abf22[_0x3f6c4c]);}}this['createSquareMessage'](_0x3abf22[_0x7167('0xea')],'out',_0x7167('0x101'),'');if(_0x3abf22['audiofile']){this['channel'][_0x7167('0xac')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x3abf22[_0x7167('0x102')]));var _0x31938d=this[_0x7167('0x36')][_0x7167('0x103')](_0x3abf22[_0x7167('0x102')]);try{fs['unlink'](_0x3abf22[_0x7167('0x102')]+_0x7167('0x104'));}catch(_0x5e9abb){logger['error'](_0x5e9abb);}return _0x31938d;}else{return this['channel'][_0x7167('0xac')](util['format'](_0x7167('0x105'),_0x3abf22[_0x7167('0xea')]));}}return this[_0x7167('0x36')][_0x7167('0x27')](_0x3007d7,_0x7167('0x106'));};AGIVertices[_0x7167('0xd')][_0x7167('0x107')]=function(_0x562a22){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x108'),_0x562a22[_0x7167('0x34')]));return this['channel'][_0x7167('0xac')](_0x7167('0x107'));};AGIVertices[_0x7167('0xd')]['ext_dial']=function(_0xbf9f1b){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x109'),_0xbf9f1b[_0x7167('0x34')]));var _0x2c7174='';if(_0xbf9f1b[_0x7167('0x10a')]){if(!this['isConfigured'](_0xbf9f1b[_0x7167('0x10a')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0xbf9f1b,_0x7167('0x10b'));}else{var _0x160f8d=parseInt(_0xbf9f1b[_0x7167('0x10a')],0xa);if(isNaN(_0x160f8d)){_0x2c7174=_0xbf9f1b['trunk_id'];}else{_0x2c7174=this[_0x7167('0x19')][_0x7167('0x70')](this,_0xbf9f1b['trunk_id']);if(!_0x2c7174){return this['channel']['error'](_0xbf9f1b,_0x7167('0x10c'));}}}}else if(_0xbf9f1b[_0x7167('0x10d')]){_0x2c7174=_0xbf9f1b['trunk_name'];}else{return this['channel'][_0x7167('0x27')](_0xbf9f1b,_0x7167('0x10b'));}var _0x40a9c9=this[_0x7167('0x36')][_0x7167('0x54')]('DIAL',[util['format'](_0x7167('0x10e'),_0x2c7174,_0xbf9f1b[_0x7167('0x43')]),_0xbf9f1b[_0x7167('0x65')],_0xbf9f1b[_0x7167('0xe2')],_0xbf9f1b[_0x7167('0x63')]]);if(_0x40a9c9[_0x7167('0xa1')]===-0x1){return _0x40a9c9;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xe3'),_0x7167('0xe0')));};AGIVertices['prototype']['finally']=function(_0x388b05){logger['info'](util[_0x7167('0x24')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x388b05[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x10f'));};AGIVertices[_0x7167('0xd')][_0x7167('0xa')]=function(_0x299c13){logger['info'](util[_0x7167('0x24')](_0x7167('0x110'),_0x299c13[_0x7167('0x34')]));if(_0x299c13['retry']===0x0){return this[_0x7167('0xa4')](_0x299c13);}_0x299c13[_0x7167('0xa5')]-=0x1;if(!this[_0x7167('0xa3')](_0x299c13['file_id'])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x299c13,'no\x20file\x20audio\x20selected');}var _0x238cbd=this['getSound'][_0x7167('0x70')](this,_0x299c13[_0x7167('0x111')]);if(!_0x238cbd){return this['channel'][_0x7167('0x27')](_0x299c13,_0x7167('0x112'));}if(!this[_0x7167('0xa3')](_0x299c13[_0x7167('0x113')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x7167('0x114'));}var _0x140598=this[_0x7167('0x36')]['getData'](_0x238cbd,_0x299c13[_0x7167('0x115')],_0x299c13[_0x7167('0x116')]);var _0x45574d=_0x140598[_0x7167('0xa1')]?_0x140598['result'][_0x7167('0x48')]():'';logger['info'](_0x7167('0x117'),JSON['stringify'](_0x140598));if(_0x140598[_0x7167('0xa1')]===-0x1){this[_0x7167('0x32')][_0x7167('0x70')](this,_0x299c13,_0x45574d);return _0x140598;}else if(_0x140598[_0x7167('0x9f')]===_0x7167('0x65')){_0x140598[_0x7167('0xa1')]=_0x45574d[_0x7167('0x97')]>=parseInt(_0x299c13[_0x7167('0x118')])?'x':'i';}else{_0x140598[_0x7167('0xa1')]=_0x45574d['length']>=parseInt(_0x299c13[_0x7167('0x118')])&&_0x45574d[_0x7167('0x97')]<=parseInt(_0x299c13[_0x7167('0x116')])?'x':'i';}var _0xc9f141=this[_0x7167('0xe')]['sync'](this,_0x299c13[_0x7167('0x113')]);if(!_0xc9f141){return this[_0x7167('0x36')][_0x7167('0x27')](_0x299c13,_0x7167('0x119'));}this['channel'][_0x7167('0x9b')](_0xc9f141,_0x45574d);if(this[_0x7167('0xa3')](_0x299c13['hiddendigitsnum'])){var _0x2bd95b=parseInt(_0x299c13['hiddendigitsnum'],0xa);var _0x2baf75=rs[_0x7167('0x11a')]({'charset':'*','length':_0x2bd95b});var _0x3252bd=_0x45574d[_0x7167('0x97')];if(_0x3252bd>0x0){if(_0x3252bd>_0x2bd95b){this[_0x7167('0x32')][_0x7167('0x70')](this,_0x299c13,_0x299c13[_0x7167('0x11b')]===_0x7167('0x11c')?_0x2baf75+_0x45574d[_0x7167('0x11d')](_0x2bd95b):_0x45574d[_0x7167('0x11d')](0x0,_0x3252bd-_0x2bd95b)+_0x2baf75);}else{this[_0x7167('0x32')]['sync'](this,_0x299c13,rs[_0x7167('0x11a')]({'charset':'*','length':_0x3252bd}));}}else{this[_0x7167('0x32')][_0x7167('0x70')](this,_0x299c13,'');}}else{this['createSquareDetailsReport'][_0x7167('0x70')](this,_0x299c13,_0x45574d);}return _0x140598;};AGIVertices[_0x7167('0xd')][_0x7167('0xb')]=function(_0x2c76bd){logger['info'](util[_0x7167('0x24')](_0x7167('0x11e'),_0x2c76bd[_0x7167('0x34')]));return this['getdigits'](_0x2c76bd);};AGIVertices[_0x7167('0xd')][_0x7167('0x11f')]=function(_0x4e2bc0){logger['info'](util[_0x7167('0x24')](_0x7167('0x120'),_0x4e2bc0[_0x7167('0x34')]));this['createSquareDetailsReport'][_0x7167('0x70')](this,_0x4e2bc0,_0x4e2bc0['goalname']);return this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0x121'),_0x4e2bc0[_0x7167('0x122')]));};AGIVertices[_0x7167('0xd')]['awspolly']=function(_0x230499){logger[_0x7167('0x29')](util['format'](_0x7167('0x123'),_0x230499['label']));if(!this[_0x7167('0xa3')](_0x230499[_0x7167('0x86')])||!this['isConfigured'](_0x230499[_0x7167('0x87')])){return this['channel'][_0x7167('0xac')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7167('0xa3')](_0x230499[_0x7167('0x59')])){return this['channel'][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x124'),_0x230499['text']));var _0x42bb23=this[_0x7167('0x85')][_0x7167('0x70')](this,_0x230499);if(_0x42bb23){this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('aws\x20Polly\x20%s\x20file\x20created',_0x42bb23));var _0x5be432=this[_0x7167('0x36')][_0x7167('0x103')](_0x42bb23);try{fs[_0x7167('0x125')](_0x42bb23+_0x7167('0x104'));}catch(_0x106097){logger[_0x7167('0x27')](_0x106097);}return _0x5be432;}return this['channel'][_0x7167('0x27')](_0x230499,_0x7167('0x126'));};AGIVertices[_0x7167('0xd')][_0x7167('0x127')]=function(_0x288ee3){logger['info'](util[_0x7167('0x24')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x288ee3['label']));if(!this[_0x7167('0xa3')](_0x288ee3[_0x7167('0x86')])||!this[_0x7167('0xa3')](_0x288ee3[_0x7167('0x87')])){return this['channel'][_0x7167('0xac')](_0x7167('0x128'));}if(!this[_0x7167('0xa3')](_0x288ee3[_0x7167('0x8d')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x129'));}if(!this[_0x7167('0xa3')](_0x288ee3[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')]['bot']=!![];this[_0x7167('0x32')](_0x288ee3);this['createSquareMessage'](_0x288ee3['text'],'in','','');this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x12a'),_0x288ee3[_0x7167('0x59')]));var _0x9261fd=this[_0x7167('0x8b')]['sync'](this,_0x288ee3);if(_0x9261fd){for(var _0x257d36 in _0x9261fd){if(_0x9261fd[_0x7167('0x92')](_0x257d36)&&_['isString'](_0x9261fd[_0x257d36])){this[_0x7167('0x36')]['setVariable'](util[_0x7167('0x24')](_0x7167('0x12b'),_0x257d36[_0x7167('0x6a')]()),_0x9261fd[_0x257d36]);}}if(_[_0x7167('0x3f')](_0x9261fd[_0x7167('0x78')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x12c'));}else{this['createSquareMessage'](_0x9261fd['message'],_0x7167('0xeb'),'amazonlex','');return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x12d'),_0x9261fd[_0x7167('0x78')]));}}return this[_0x7167('0x36')]['error'](_0x288ee3,_0x7167('0x12e'));};AGIVertices[_0x7167('0xd')][_0x7167('0x12f')]=function(_0x4c718e){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x130'),_0x4c718e[_0x7167('0x34')],_0x4c718e[_0x7167('0x65')]));if(!this[_0x7167('0xa3')](_0x4c718e[_0x7167('0x80')])){return this[_0x7167('0x36')]['noop'](_0x7167('0xe6'));}var _0x530f1d=_0x7167('0x131');var _0xf06a54=util[_0x7167('0x24')](_0x7167('0x132'),FILES_PATH,rs['generate'](0x4));var _0x138d3c=util['format'](_0x7167('0x9a'),_0xf06a54,_0x530f1d);var _0x3267ce=!![];if(_0x4c718e[_0x7167('0x133')]===_0x7167('0x134')){_0x3267ce=![];}var _0x1fa4c8=this[_0x7167('0x36')][_0x7167('0x135')](_0xf06a54,_0x530f1d,_0x4c718e[_0x7167('0x136')],_0x4c718e['timeout'],undefined,_0x3267ce);if(_0x1fa4c8[_0x7167('0xa1')]!==-0x1){this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('google\x20%s\x20file\x20created',_0x138d3c));var _0x3e0825=this[_0x7167('0x8e')]['sync'](this,_0x4c718e,_0x138d3c);if(_0x3e0825){for(var _0x31af84 in _0x3e0825){if(_0x3e0825[_0x7167('0x92')](_0x31af84)){this[_0x7167('0x36')][_0x7167('0x9b')](util['format'](_0x7167('0x137'),_0x31af84[_0x7167('0x6a')]()),_0x3e0825[_0x31af84]);}}return this['channel'][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x138'),JSON['stringify'](_0x3e0825)));}}return _0x1fa4c8;};AGIVertices['prototype'][_0x7167('0x139')]=function(_0x128f4b){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x13a'),_0x128f4b[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x128f4b[_0x7167('0x90')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x13b'));}if(!this[_0x7167('0xa3')](_0x128f4b[_0x7167('0x13c')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x13d'));}var _0x17833e='wav';var _0x1ed908=util[_0x7167('0x24')](_0x7167('0x132'),FILES_PATH,rs[_0x7167('0x11a')](0x4));var _0x5c79b9=util[_0x7167('0x24')](_0x7167('0x9a'),_0x1ed908,_0x17833e);var _0x3f0227=!![];if(_0x128f4b[_0x7167('0x133')]===_0x7167('0x134')){_0x3f0227=![];}var _0xc02a23=this[_0x7167('0x36')][_0x7167('0x135')](_0x1ed908,_0x17833e,_0x128f4b[_0x7167('0x136')],_0x128f4b[_0x7167('0x65')],undefined,_0x3f0227);if(_0xc02a23[_0x7167('0xa1')]!==-0x1){this[_0x7167('0x36')]['noop'](util['format'](_0x7167('0x13e'),_0x5c79b9));var _0x5b8040=this[_0x7167('0x8f')][_0x7167('0x70')](this,_0x128f4b,_0x5c79b9);if(_0x5b8040){for(var _0x451edf in _0x5b8040){if(_0x5b8040['hasOwnProperty'](_0x451edf)){this[_0x7167('0x36')]['setVariable'](util[_0x7167('0x24')](_0x7167('0x13f'),_0x451edf['toUpperCase']()),_0x5b8040[_0x451edf]);}}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x140'),JSON[_0x7167('0x74')](_0x5b8040)));}}return _0xc02a23;};AGIVertices[_0x7167('0xd')][_0x7167('0x141')]=function(_0x5ad110){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x142'),_0x5ad110[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0x143')](_0x5ad110[_0x7167('0x144')],_0x5ad110[_0x7167('0x39')],_0x5ad110[_0x7167('0x3a')]);};AGIVertices['prototype']['gotoif']=function(_0x28ea96){logger['info'](util[_0x7167('0x24')](_0x7167('0x145'),_0x28ea96['label']));if(!this[_0x7167('0xa3')](_0x28ea96['condition'])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x28ea96,_0x7167('0x146'));}try{var _0x47e0db=eval(_0x28ea96[_0x7167('0x147')])?_0x7167('0x148'):_0x7167('0x149');this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x14a'),_0x28ea96['condition'],_0x47e0db));return{'code':0xc8,'result':_0x47e0db};}catch(_0x5de74f){return{'code':0xc8,'result':_0x7167('0x149')};}};AGIVertices[_0x7167('0xd')][_0x7167('0x14b')]=function(_0x1ccdbc){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1ccdbc[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x1ccdbc[_0x7167('0x14c')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1ccdbc,'no\x20interval\x20configured');}var _0x3cab6c=this['getIntervals'][_0x7167('0x70')](this,_0x1ccdbc[_0x7167('0x14c')]);if(!_0x3cab6c){return this[_0x7167('0x36')]['error'](_0x1ccdbc,_0x7167('0x14d'));}for(var _0x4bbc4b=0x0;_0x4bbc4b<_0x3cab6c[_0x7167('0x97')];_0x4bbc4b+=0x1){var _0x5b206f=this[_0x7167('0x36')]['getVariable'](util[_0x7167('0x24')](_0x7167('0x14e'),_0x3cab6c[_0x4bbc4b]));if(_0x5b206f[_0x7167('0xa1')]===-0x1){return _0x5b206f;}logger['info'](util[_0x7167('0x24')]('IFTIME\x20%s\x20%s',_0x3cab6c[_0x4bbc4b],_0x5b206f['extra']));if(_0x5b206f[_0x7167('0x9f')]==='true'){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x14f'),_0x3cab6c[_0x4bbc4b],_0x7167('0x148')));this['channel'][_0x7167('0xac')](util[_0x7167('0x24')]('IFTIME\x20%s\x20%s',_0x3cab6c[_0x4bbc4b],_0x7167('0x148')));return{'code':0xc8,'result':_0x7167('0x148')};}else{logger[_0x7167('0x29')](util[_0x7167('0x24')]('IFTIME\x20%s\x20%s',_0x3cab6c[_0x4bbc4b],_0x7167('0x149')));this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')]('IFTIME\x20%s\x20%s',_0x3cab6c[_0x4bbc4b],_0x7167('0x149')));}}return{'code':0xc8,'result':_0x7167('0x149')};};AGIVertices[_0x7167('0xd')][_0x7167('0x150')]=function(_0x28950d){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x151'),_0x28950d[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0x150')]();};AGIVertices[_0x7167('0xd')][_0x7167('0x152')]=function(_0x5944b7){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x5944b7[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x5944b7[_0x7167('0x80')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xe6'));}var _0x1c2cdb='wav';var _0x3894c9=util[_0x7167('0x24')](_0x7167('0x132'),FILES_PATH,rs[_0x7167('0x11a')](0x4));var _0x104ce1=util['format'](_0x7167('0x9a'),_0x3894c9,_0x1c2cdb);var _0x2ccb6a=!![];if(_0x5944b7[_0x7167('0x133')]===_0x7167('0x134')){_0x2ccb6a=![];}var _0x2cb5ea=this[_0x7167('0x36')][_0x7167('0x135')](_0x3894c9,_0x1c2cdb,_0x5944b7['intKey'],_0x5944b7['timeout'],undefined,_0x2ccb6a);if(_0x2cb5ea[_0x7167('0xa1')]!==-0x1){this['channel'][_0x7167('0xac')](util[_0x7167('0x24')]('ispeech\x20%s\x20file\x20created',_0x104ce1));var _0x1c4065=this['ispeechASR'][_0x7167('0x70')](this,_0x5944b7,_0x104ce1);if(_0x1c4065){for(var _0x4e56d3 in _0x1c4065){if(_0x1c4065[_0x7167('0x92')](_0x4e56d3)){this[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x153'),_0x4e56d3[_0x7167('0x6a')]()),_0x1c4065[_0x4e56d3]);}}return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0x154'),JSON['stringify'](_0x1c4065)));}}return _0x2cb5ea;};AGIVertices['prototype'][_0x7167('0x155')]=function(_0x2a7d08){logger['info'](util[_0x7167('0x24')](_0x7167('0x156'),_0x2a7d08[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x2a7d08[_0x7167('0x80')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20key\x20configured');}if(!this[_0x7167('0xa3')](_0x2a7d08[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('Trying\x20ispeech\x20TTS\x20%s',_0x2a7d08[_0x7167('0x59')]));var _0x505790=this[_0x7167('0x157')]['sync'](this,_0x2a7d08);if(_0x505790){this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x158'),_0x505790));var _0xf6c61a=this[_0x7167('0x36')][_0x7167('0x103')](_0x505790,_0x2a7d08[_0x7167('0x136')]);try{fs[_0x7167('0x125')](_0x505790+_0x7167('0x104'));}catch(_0xe56e43){logger['error'](_0xe56e43);}return _0xf6c61a;}return this['channel'][_0x7167('0x27')](_0x2a7d08,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x7167('0x159')]=function(_0x428c7f){logger[_0x7167('0x29')](util['format'](_0x7167('0x15a'),_0x428c7f['label']));if(!this[_0x7167('0xa3')](_0x428c7f['findBy'])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x428c7f,_0x7167('0x15b'));}logger['info'](util[_0x7167('0x24')](_0x7167('0x15c'),this[_0x7167('0x36')][_0x7167('0x37')],_0x428c7f[_0x7167('0x15d')]));var _0x31f43a=this[_0x7167('0x52')][_0x7167('0x70')](this,_0x428c7f[_0x7167('0x15d')]);if(_0x31f43a){logger['info'](util['format'](_0x7167('0x15e'),this['channel']['callerid'],_0x428c7f[_0x7167('0x15d')]));this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7167('0x37')],_0x428c7f['findBy']));return{'code':0xc8,'result':_0x7167('0x15f')};}else{logger[_0x7167('0x29')](util[_0x7167('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7167('0x36')][_0x7167('0x37')],_0x428c7f[_0x7167('0x15d')]));this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0x160'),this[_0x7167('0x36')][_0x7167('0x37')],_0x428c7f[_0x7167('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x7167('0x161')]=function(_0x30ac48){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x30ac48['label']));if(!this[_0x7167('0xa3')](_0x30ac48[_0x7167('0x15d')])){return this['channel'][_0x7167('0x27')](_0x30ac48,_0x7167('0x15b'));}logger['info'](util[_0x7167('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7167('0x36')]['callerid'],_0x30ac48[_0x7167('0x15d')]));var _0x3f3078=this[_0x7167('0x4e')]['sync'](this,_0x30ac48[_0x7167('0x15d')]);if(_0x3f3078){logger['info'](util[_0x7167('0x24')](_0x7167('0x15e'),this[_0x7167('0x36')][_0x7167('0x37')],_0x30ac48['findBy']));this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x15e'),this[_0x7167('0x36')][_0x7167('0x37')],_0x30ac48[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x15f')};}else{logger[_0x7167('0x29')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7167('0x36')][_0x7167('0x37')],_0x30ac48[_0x7167('0x15d')]));this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x160'),this[_0x7167('0x36')][_0x7167('0x37')],_0x30ac48['findBy']));return{'code':0xc8,'result':_0x7167('0x162')};}};AGIVertices[_0x7167('0xd')][_0x7167('0x163')]=function(_0x6a4d25){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x164'),_0x6a4d25[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x6a4d25[_0x7167('0x165')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x6a4d25,_0x7167('0x166'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x167'),_0x6a4d25[_0x7167('0x165')]));var _0x580456=eval(_0x6a4d25[_0x7167('0x165')]);if(!this[_0x7167('0xa3')](_0x6a4d25[_0x7167('0x113')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x463490=this['getVariable'][_0x7167('0x70')](this,_0x6a4d25[_0x7167('0x113')]);if(!_0x463490){return this[_0x7167('0x36')][_0x7167('0x27')](_0x6a4d25,_0x7167('0x119'));}if(_[_0x7167('0x96')](_0x580456)){var _0x13d3ce=this;_0x580456[_0x7167('0x168')](function(_0x1ffe8c,_0x5babc7){_0x13d3ce[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x169'),_0x463490,_0x5babc7),_0x1ffe8c);});return this[_0x7167('0x36')]['noop'](util['format'](_0x7167('0x16a'),_0x463490));}else{return this[_0x7167('0x36')]['setVariable'](_0x463490,_0x580456);}};AGIVertices[_0x7167('0xd')][_0x7167('0x16b')]=function(_0x1ce1c4){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1ce1c4['label']));if(_0x1ce1c4['retry']===0x0){return this['maxRetry'](_0x1ce1c4);}_0x1ce1c4[_0x7167('0xa5')]-=0x1;if(!this[_0x7167('0xa3')](_0x1ce1c4['file_id'])){return this['channel'][_0x7167('0x27')](_0x1ce1c4,_0x7167('0x16c'));}var _0x3d65a1=this[_0x7167('0x16d')]['sync'](this,_0x1ce1c4['file_id']);if(!_0x3d65a1){return this[_0x7167('0x36')]['error'](_0x1ce1c4,_0x7167('0x112'));}var _0x183f88=this['channel'][_0x7167('0x16e')](_0x3d65a1,_0x1ce1c4[_0x7167('0x115')],_0x1ce1c4[_0x7167('0x16f')]);var _0x9df17d=_0x183f88[_0x7167('0xa1')];if(_0x183f88['result']===-0x1){this[_0x7167('0x32')][_0x7167('0x70')](this,_0x1ce1c4,'-1');return _0x183f88;}else if(_0x183f88[_0x7167('0x9f')]===_0x7167('0x65')){_0x183f88[_0x7167('0xa1')]=_0x183f88[_0x7167('0xa1')][_0x7167('0x97')]>0x0?_0x183f88[_0x7167('0xa1')]:'t';}else if(_[_0x7167('0x3e')](_0x183f88['result'])){_0x183f88[_0x7167('0xa1')]='#';_0x9df17d='#';}if(!this[_0x7167('0xa3')](_0x1ce1c4['variable_id'])){this[_0x7167('0x36')][_0x7167('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x1e4f57=this[_0x7167('0xe')][_0x7167('0x70')](this,_0x1ce1c4[_0x7167('0x113')]);if(!_0x1e4f57){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1ce1c4,_0x7167('0x119'));}this[_0x7167('0x36')][_0x7167('0x9b')](_0x1e4f57,_0x9df17d);}this['createSquareDetailsReport'][_0x7167('0x70')](this,_0x1ce1c4,_0x9df17d);return _0x183f88;};AGIVertices[_0x7167('0xd')][_0x7167('0xac')]=function(_0x5dc35c){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x170'),_0x5dc35c[_0x7167('0x34')]));return this['channel'][_0x7167('0xac')](_0x5dc35c['output']||_0x5dc35c[_0x7167('0x34')]);};AGIVertices[_0x7167('0xd')][_0x7167('0x171')]=function(_0x10c618){logger['info'](util[_0x7167('0x24')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x10c618['label']));if(!this[_0x7167('0xa3')](_0x10c618[_0x7167('0x15d')])){return this['channel'][_0x7167('0x27')](_0x10c618,_0x7167('0x15b'));}logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x15c'),this[_0x7167('0x36')][_0x7167('0x37')],_0x10c618[_0x7167('0x15d')]));var _0x15d55b=this[_0x7167('0x172')][_0x7167('0x70')](this,_0x10c618[_0x7167('0x173')]);var _0x4a3215=this['agentPause']['sync'](this,_0x10c618[_0x7167('0x15d')],_0x15d55b);if(_0x4a3215){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x15e'),this[_0x7167('0x36')][_0x7167('0x37')],_0x10c618['findBy']));this['channel']['noop'](util[_0x7167('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7167('0x37')],_0x10c618[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x15f')};}else{logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x160'),this['channel']['callerid'],_0x10c618[_0x7167('0x15d')]));this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7167('0x36')][_0x7167('0x37')],_0x10c618[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x162')};}};AGIVertices[_0x7167('0xd')][_0x7167('0x174')]=function(_0x161e61){logger['info'](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x161e61[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x161e61[_0x7167('0x111')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x161e61,_0x7167('0x16c'));}var _0xebe1bf=this[_0x7167('0x16d')][_0x7167('0x70')](this,_0x161e61[_0x7167('0x111')]);if(!_0xebe1bf){return this[_0x7167('0x36')][_0x7167('0x27')](_0x161e61,_0x7167('0x112'));}var _0x6f4717=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0x175'),[_0xebe1bf,_0x161e61[_0x7167('0xe2')]]);if(_0x6f4717[_0x7167('0xa1')]===-0x1){return _0x6f4717;}return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xc4'),_0x7167('0x175'),_0xebe1bf));};AGIVertices[_0x7167('0xd')][_0x7167('0x176')]=function(_0x2c3804){logger[_0x7167('0x29')](util['format'](_0x7167('0x177'),_0x2c3804['label']));if(!this['isConfigured'](_0x2c3804[_0x7167('0x178')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x2c3804,_0x7167('0x179'));}var _0x61dae3='';var _0xefa2af=parseInt(_0x2c3804[_0x7167('0x178')],0xa);if(isNaN(_0xefa2af)){_0x61dae3=_0x2c3804[_0x7167('0x178')];}else{_0x61dae3=this['getVoiceQueue']['sync'](this,_0x2c3804['queue_id']);if(!_0x61dae3){return this[_0x7167('0x36')][_0x7167('0x27')](_0x2c3804,_0x7167('0x17a'));}}var _0x32ce64='';if(this['isConfigured'](_0x2c3804[_0x7167('0x111')])){var _0x390a2e=this[_0x7167('0x16d')]['sync'](this,_0x2c3804[_0x7167('0x111')]);if(_0x390a2e){_0x32ce64=_0x390a2e;}}this[_0x7167('0x32')][_0x7167('0x70')](this,_0x2c3804,_0x61dae3);if(_0x2c3804[_0x7167('0xe2')][_0x7167('0x17b')]('x')<0x0){_0x2c3804[_0x7167('0xe2')]+='x';}if(_0x2c3804['opts']['indexOf']('X')<0x0){_0x2c3804[_0x7167('0xe2')]+='X';}this[_0x7167('0x36')]['setVariable'](_0x7167('0x17c'),_0x61dae3?_0x61dae3['toLowerCase']():'');var _0x475a2b=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0x17d'),[_0x61dae3,_0x2c3804[_0x7167('0xe2')],_0x2c3804[_0x7167('0x63')],_0x32ce64,_0x2c3804[_0x7167('0x65')],_0x2c3804[_0x7167('0xb4')],_0x2c3804[_0x7167('0x17e')],_0x2c3804[_0x7167('0x17f')],'',_0x2c3804[_0x7167('0x180')]]);if(_0x475a2b['result']===-0x1){return _0x475a2b;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xc4'),_0x7167('0x17d'),_0x61dae3));};AGIVertices['prototype']['record']=function(_0x54e6e1){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x54e6e1[_0x7167('0x34')]));var _0xf9af5d=_0x54e6e1[_0x7167('0x181')]||_0x7167('0x131');var _0x1d32af=util[_0x7167('0x24')](_0x7167('0x182'),this[_0x7167('0x36')][_0x7167('0x33')],rs[_0x7167('0x11a')](0x5));var _0x474fa2=util[_0x7167('0x24')](_0x7167('0x183'),FILES_PATH,_0x1d32af,_0xf9af5d);var _0xe3d4d0=util[_0x7167('0x24')](_0x7167('0x132'),FILES_PATH,_0x1d32af);this[_0x7167('0x38')][_0x7167('0x70')](this,_0x54e6e1,_0x1d32af,_0x474fa2);this[_0x7167('0x36')][_0x7167('0x9b')](_0x7167('0x184'),_0x1d32af);logger[_0x7167('0x29')](_0x7167('0x185'),_0xe3d4d0,_0xf9af5d,_0x54e6e1[_0x7167('0x186')],_0x54e6e1[_0x7167('0x65')]);return this[_0x7167('0x36')][_0x7167('0x135')](_0xe3d4d0,_0xf9af5d,_0x54e6e1[_0x7167('0x186')],_0x54e6e1[_0x7167('0x65')],undefined,!![]);};AGIVertices[_0x7167('0xd')]['restapi']=function(_0x269b05){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x187'),_0x269b05['label']));if(!this['isConfigured'](_0x269b05[_0x7167('0x63')])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20url\x20configured');}var _0x4ef179=this[_0x7167('0x62')][_0x7167('0x70')](this,_0x269b05);logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x188'),util['inspect'](_0x4ef179,{'showHidden':![],'depth':null})));if(!this[_0x7167('0xa3')](_0x269b05[_0x7167('0x113')])){return this['channel'][_0x7167('0xac')](_0x7167('0x189'));}var _0x200705=this[_0x7167('0xe')]['sync'](this,_0x269b05[_0x7167('0x113')]);if(!_0x200705){return this[_0x7167('0x36')][_0x7167('0x27')](_0x269b05,_0x7167('0x119'));}this[_0x7167('0x36')][_0x7167('0x9b')](util[_0x7167('0x24')](_0x7167('0x18a'),_0x200705),_0x4ef179['statusCode']?_0x4ef179[_0x7167('0x76')]:_0x7167('0x18b'));this[_0x7167('0x36')][_0x7167('0x9b')](util['format'](_0x7167('0x18c'),_0x200705),_0x4ef179['statusMessage']?_0x4ef179[_0x7167('0x77')]:'OK');if(_0x4ef179[_0x7167('0x6b')]){try{this[_0x7167('0x99')](_0x4ef179[_0x7167('0x6b')],_0x200705);}catch(_0x5df87c){logger['error'](util[_0x7167('0x24')](_0x7167('0x18d'),_0x200705));}}return this[_0x7167('0x36')]['noop'](util[_0x7167('0x24')](_0x7167('0xd9'),_0x200705));};AGIVertices[_0x7167('0xd')][_0x7167('0x18e')]=function(_0x4d3930){logger['info'](util['format'](_0x7167('0x18f'),_0x4d3930[_0x7167('0x34')]));return this['channel'][_0x7167('0x190')](_0x4d3930[_0x7167('0x191')]['replace'](/\s+/g,''),_0x4d3930[_0x7167('0x186')]);};AGIVertices[_0x7167('0xd')][_0x7167('0x192')]=function(_0x51b1db){logger['info'](util[_0x7167('0x24')](_0x7167('0x193'),_0x51b1db['label']));return this[_0x7167('0x36')][_0x7167('0x194')](_0x51b1db[_0x7167('0x66')][_0x7167('0x55')](/\s+/g,''),_0x51b1db[_0x7167('0x186')]);};AGIVertices[_0x7167('0xd')]['sayphonetic']=function(_0x508ae3){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x508ae3[_0x7167('0x34')]));return this[_0x7167('0x36')][_0x7167('0x195')](_0x508ae3[_0x7167('0x59')],_0x508ae3[_0x7167('0x186')]);};AGIVertices['prototype'][_0x7167('0x196')]=function(_0x5b6282){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5b6282[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x5b6282[_0x7167('0x197')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x198'));}var _0x3674f6=this[_0x7167('0x1d')]['sync'](this,_0x5b6282['account_id']);if(!_0x3674f6||!_0x3674f6[_0x7167('0x199')]){return this[_0x7167('0x36')]['error'](_0x5b6282,_0x7167('0x19a'));}var _0x44750d={'from':util[_0x7167('0x24')](_0x7167('0x19b'),_0x3674f6[_0x7167('0x12')],_0x3674f6[_0x7167('0x19c')]||_0x3674f6[_0x7167('0x199')][_0x7167('0x19d')]),'to':_0x5b6282['to']||'','cc':_0x5b6282['cc']||'','bcc':_0x5b6282[_0x7167('0x19e')]||'','subject':_0x5b6282[_0x7167('0x19f')],'html':_0x5b6282['text'],'text':_0x5b6282['text']};var _0x1cddc0={'tls':{'rejectUnauthorized':![]}};if(_0x3674f6[_0x7167('0x199')][_0x7167('0x1a0')]){_0x1cddc0[_0x7167('0x1a0')]=_0x3674f6[_0x7167('0x199')][_0x7167('0x1a0')];}else{_0x1cddc0[_0x7167('0x1a1')]=_0x3674f6[_0x7167('0x199')][_0x7167('0x1a1')];_0x1cddc0[_0x7167('0x1a2')]=_0x3674f6[_0x7167('0x199')]['port'];_0x1cddc0[_0x7167('0x1a3')]=_0x3674f6[_0x7167('0x199')][_0x7167('0x1a3')];}if(_0x3674f6[_0x7167('0x199')][_0x7167('0x1a4')]){_0x1cddc0[_0x7167('0x1a5')]={'user':_0x3674f6[_0x7167('0x199')]['user'],'pass':_0x3674f6[_0x7167('0x199')][_0x7167('0x1a6')]};}if(this[_0x7167('0xa3')](_0x5b6282[_0x7167('0x1a7')])){}logger[_0x7167('0x1a8')](_0x7167('0x1a9'),JSON[_0x7167('0x74')](_0x44750d));this[_0x7167('0x32')]['sync'](this,_0x5b6282,_0x5b6282[_0x7167('0x197')]);this[_0x7167('0x36')][_0x7167('0xac')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x3674f6['name']));this['sendMailMessage'][_0x7167('0x70')](this,_0x1cddc0,_0x44750d);return this[_0x7167('0x36')][_0x7167('0xac')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x7167('0xd')][_0x7167('0x1aa')]=function(_0x4be15f){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4be15f[_0x7167('0x34')]));return this['channel']['noop'](_0x7167('0x1ab'));};AGIVertices[_0x7167('0xd')][_0x7167('0x1ac')]=function(_0x4e746c){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4e746c[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x4e746c['sms_account_id'])){return this[_0x7167('0x36')][_0x7167('0xac')]('no\x20sms\x20account\x20configured');}var _0x545c7c=this['getSmsAccount'][_0x7167('0x70')](this,_0x4e746c[_0x7167('0x1ad')]);if(!_0x545c7c){return this['channel'][_0x7167('0x27')](_0x4e746c,_0x7167('0x1ae'));}var _0x41529e={'body':_0x4e746c[_0x7167('0x1af')],'phone':_0x4e746c['to']||'','SmsAccountId':_0x545c7c['id']};logger['debug'](_0x7167('0x1b0'),JSON[_0x7167('0x74')](_0x41529e));this[_0x7167('0x32')]['sync'](this,_0x4e746c,_0x4e746c[_0x7167('0x1ad')]);this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x545c7c[_0x7167('0x12')]));this[_0x7167('0x31')][_0x7167('0x70')](this,_0x41529e);return this[_0x7167('0x36')]['noop'](_0x7167('0x1b1'));};AGIVertices['prototype'][_0x7167('0x1b2')]=function(_0x1cf198){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1b3'),_0x1cf198[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x1cf198[_0x7167('0x113')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1cf198,'no\x20variable\x20selected');}var _0x57db54=this[_0x7167('0xe')]['sync'](this,_0x1cf198[_0x7167('0x113')]);if(!_0x57db54){return this[_0x7167('0x36')][_0x7167('0x27')](_0x1cf198,_0x7167('0x119'));}return this[_0x7167('0x36')]['setVariable'](_0x57db54,_0x1cf198[_0x7167('0x1b4')]);};AGIVertices['prototype'][_0x7167('0x1b5')]=function(_0x4544d8){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1b6'),_0x4544d8[_0x7167('0x34')]));this[_0x7167('0x36')][_0x7167('0xac')]('START\x20CALLY\x20SQUARE');if(_0x4544d8[_0x7167('0xb8')]===_0x7167('0x1b7')){this['channel']['noop'](_0x7167('0x1b8'));return this[_0x7167('0x36')][_0x7167('0xb8')]();}return this[_0x7167('0x36')]['noop'](_0x7167('0x1b9'));};AGIVertices['prototype']['subproject']=function(_0x5cebea){logger['info'](util[_0x7167('0x24')](_0x7167('0x1ba'),_0x5cebea[_0x7167('0x34')]));if(!this[_0x7167('0xa3')](_0x5cebea[_0x7167('0x1bb')])){return this['channel'][_0x7167('0x27')](_0x5cebea,_0x7167('0x1bc'));}var _0x5d6b54=this[_0x7167('0x15')][_0x7167('0x70')](this,_0x5cebea[_0x7167('0x1bb')]);if(!this['isConfigured'](_0x5d6b54)){return this[_0x7167('0x36')][_0x7167('0x27')](_0x5cebea,util[_0x7167('0x24')](_0x7167('0x1bd'),_0x5cebea[_0x7167('0x1bb')]));}if(_0x5d6b54===this[_0x7167('0x36')][_0x7167('0x1be')]){return this[_0x7167('0x36')][_0x7167('0x27')](_0x5cebea,_0x7167('0x1bf'));}this[_0x7167('0x32')][_0x7167('0x70')](this,_0x5cebea,_0x5d6b54);var _0x1e999f=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0x1c0'),util[_0x7167('0x24')](_0x7167('0x1c1'),config['agi'][_0x7167('0x1a1')]||'127.0.0.1',_0x5d6b54,this['channel']['arg_1']));if(_0x1e999f[_0x7167('0xa1')]===-0x1){return _0x1e999f;}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0xc4'),_0x7167('0x1c0'),_0x5d6b54));};AGIVertices[_0x7167('0xd')]['system']=function(_0x3a0a3e){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1c2'),_0x3a0a3e[_0x7167('0x34')]));var _0x4fcc0e=this[_0x7167('0x53')][_0x7167('0x70')](this,_0x3a0a3e[_0x7167('0xb6')]);this[_0x7167('0x32')][_0x7167('0x70')](this,_0x3a0a3e,_0x3a0a3e[_0x7167('0xb6')]);if(this[_0x7167('0xa3')](_0x3a0a3e['variable_id'])){var _0x98278c=this[_0x7167('0xe')][_0x7167('0x70')](this,_0x3a0a3e['variable_id']);if(_0x98278c){this[_0x7167('0x36')][_0x7167('0x9b')](_0x98278c,_0x4fcc0e);return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3a0a3e[_0x7167('0xb6')],_0x98278c));}}return this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x1c3'),_0x3a0a3e['command']));};AGIVertices[_0x7167('0xd')][_0x7167('0x1c4')]=function(_0x397777){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1c5'),_0x397777[_0x7167('0x34')]));_0x397777[_0x7167('0x59')]=_0x397777[_0x7167('0x59')][_0x7167('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7167('0xa3')](_0x397777[_0x7167('0x57')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0x1c6'));}if(!this[_0x7167('0xa3')](_0x397777[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x1c7'),_0x397777[_0x7167('0x59')]));var _0x187bac=this[_0x7167('0x56')]['sync'](this,_0x397777);if(_0x187bac){this['channel'][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x1c8'),_0x187bac));var _0x110cff=this['channel'][_0x7167('0x103')](_0x187bac);try{fs[_0x7167('0x125')](_0x187bac+_0x7167('0x104'));}catch(_0x4c1c8b){logger[_0x7167('0x27')](_0x4c1c8b);}return _0x110cff;}return this['channel'][_0x7167('0x27')](_0x397777,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7167('0xd')]['tts']=function(_0x5b23ef){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1c9'),_0x5b23ef[_0x7167('0x34')]));_0x5b23ef['text']=_0x5b23ef[_0x7167('0x59')][_0x7167('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7167('0xa3')](_0x5b23ef[_0x7167('0x59')])){return this[_0x7167('0x36')][_0x7167('0xac')](_0x7167('0xa7'));}this[_0x7167('0x36')][_0x7167('0xac')](util[_0x7167('0x24')]('Trying\x20Google\x20TTS\x20%s',_0x5b23ef['text']));var _0x1a6db7=this[_0x7167('0x60')][_0x7167('0x70')](this,_0x5b23ef);if(_0x1a6db7){this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0x1ca'),_0x1a6db7));var _0x94f5df=this[_0x7167('0x36')][_0x7167('0x103')](_0x1a6db7);try{fs[_0x7167('0x125')](_0x1a6db7+'.wav');}catch(_0x224e46){logger[_0x7167('0x27')](_0x224e46);}return _0x94f5df;}return this[_0x7167('0x36')][_0x7167('0x27')](_0x5b23ef,_0x7167('0x1cb'));};AGIVertices[_0x7167('0xd')][_0x7167('0x1cc')]=function(_0x3d680b){logger[_0x7167('0x29')](util['format'](_0x7167('0x1cd'),_0x3d680b['label']));if(!this[_0x7167('0xa3')](_0x3d680b[_0x7167('0x15d')])){return this[_0x7167('0x36')]['error'](_0x3d680b,_0x7167('0x15b'));}logger[_0x7167('0x29')](util[_0x7167('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7167('0x36')][_0x7167('0x37')],_0x3d680b[_0x7167('0x15d')]));var _0x1f0021=this['agentUnpause'][_0x7167('0x70')](this,_0x3d680b[_0x7167('0x15d')]);if(_0x1f0021){logger[_0x7167('0x29')](util[_0x7167('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7167('0x36')]['callerid'],_0x3d680b[_0x7167('0x15d')]));this[_0x7167('0x36')][_0x7167('0xac')](util['format'](_0x7167('0x15e'),this['channel']['callerid'],_0x3d680b[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x15f')};}else{logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x160'),this[_0x7167('0x36')]['callerid'],_0x3d680b['findBy']));this['channel'][_0x7167('0xac')](util[_0x7167('0x24')](_0x7167('0x160'),this[_0x7167('0x36')][_0x7167('0x37')],_0x3d680b[_0x7167('0x15d')]));return{'code':0xc8,'result':_0x7167('0x162')};}};AGIVertices[_0x7167('0xd')]['voicemail']=function(_0x41e644){logger[_0x7167('0x29')](util[_0x7167('0x24')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x41e644[_0x7167('0x34')]));var _0x575a11=this[_0x7167('0x36')][_0x7167('0x54')](_0x7167('0x1ce'),[_0x41e644[_0x7167('0x1cf')],_0x41e644[_0x7167('0x7a')]]);if(_0x575a11[_0x7167('0xa1')]===-0x1){return _0x575a11;}return this['channel']['noop'](util[_0x7167('0x24')]('Executed\x20command\x20%s\x20%s',_0x7167('0x1ce'),_0x41e644[_0x7167('0x1cf')]));};AGIVertices['prototype'][_0x7167('0x1d0')]=function(_0xa10f2b){logger[_0x7167('0x29')](util[_0x7167('0x24')](_0x7167('0x1d1'),_0xa10f2b['label']));if(!this[_0x7167('0xa3')](_0xa10f2b[_0x7167('0x113')])){return this[_0x7167('0x36')][_0x7167('0x27')](_0xa10f2b,_0x7167('0x1d2'));}var _0x59af68=this[_0x7167('0xe')]['sync'](this,_0xa10f2b['variable_id']);if(!_0x59af68){return this['channel'][_0x7167('0x27')](_0xa10f2b,'no\x20variable\x20found');}var _0x23285b=this[_0x7167('0x36')][_0x7167('0xe')](_0x59af68);return{'code':0xc8,'result':_0x23285b[_0x7167('0x9f')]?_0x23285b[_0x7167('0x9f')]:'-'};};String['prototype']['replaceAll']=function(_0x298419,_0x19a517){return this[_0x7167('0x9d')](_0x298419)[_0x7167('0x1d3')](_0x19a517);};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 a28af7a..09641c2 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 _0x96c6=['stopAcw','lastPauseAt','format','uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','startAcw','channels','interface','queue','ACW','name','mandatoryDispositionPause','Action','QueuePause','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer'];(function(_0x278024,_0x195b16){var _0xe793a7=function(_0x144be6){while(--_0x144be6){_0x278024['push'](_0x278024['shift']());}};_0xe793a7(++_0x195b16);}(_0x96c6,0xe6));var _0x696c=function(_0x420f36,_0x4119cb){_0x420f36=_0x420f36-0x0;var _0x468393=_0x96c6[_0x420f36];return _0x468393;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x696c('0x0'));var ami=require(_0x696c('0x1'));var logger=require(_0x696c('0x2'))(_0x696c('0x3'));var RpcUser=require(_0x696c('0x4'));var RpcVoiceAgentReport=require(_0x696c('0x5'));function Acw(_0xfbdcbd){this[_0x696c('0x6')]=_0xfbdcbd[_0x696c('0x6')];this[_0x696c('0x7')]=_0xfbdcbd[_0x696c('0x7')];this['timers']=_0xfbdcbd[_0x696c('0x8')];this['channels']={};ami['on'](_0x696c('0x9'),this['syncAgentConnect']['bind'](this));ami['on'](_0x696c('0xa'),this[_0x696c('0xb')][_0x696c('0xc')](this));ami['on'](_0x696c('0xd'),this[_0x696c('0xe')][_0x696c('0xc')](this));ami['on'](_0x696c('0xf'),this[_0x696c('0x10')][_0x696c('0xc')](this));ami['on']('attendedtransfer',this[_0x696c('0x11')][_0x696c('0xc')](this));ami['on'](_0x696c('0x12'),this[_0x696c('0x13')]['bind'](this));ami['on'](_0x696c('0x14'),this[_0x696c('0x15')][_0x696c('0xc')](this));}function getDiff(_0x522f8a){var _0x177e7b=moment()[_0x696c('0x16')](0x0);var _0x2cd8af=moment(_0x522f8a)[_0x696c('0x16')](0x0);return _0x177e7b['diff'](_0x2cd8af,_0x696c('0x17'));}Acw['prototype'][_0x696c('0x18')]=function(_0xdfef67){try{var _0xd1e36d=this;var _0x39deee=this[_0x696c('0x19')][_0xdfef67][_0x696c('0x1a')];var _0x2887d8=this[_0x696c('0x19')][_0xdfef67][_0x696c('0x1b')];var _0x42e0a1=this[_0x696c('0x6')][_0x2887d8];var _0x19d205=![];var _0x39fd57=_0x696c('0x1c');if(_0x42e0a1['mandatoryDisposition']){if(_0x42e0a1['mandatoryDispositionPause'][_0x696c('0x1d')]){_0x19d205=!![];_0x39fd57=_0x42e0a1[_0x696c('0x1e')]['name'];}}ami[_0x696c('0x1f')]({'action':_0x696c('0x20'),'interface':_0x39deee,'paused':!![],'reason':_0x39fd57})[_0x696c('0x21')](function(_0x59c63a){if(_0xd1e36d[_0x696c('0x7')][_0x39deee]){return RpcUser['getAgent'](_0xd1e36d[_0x696c('0x7')][_0x39deee]['id'])[_0x696c('0x21')](function(_0x5ec553){if(_0x5ec553&&!_0x5ec553[_0x696c('0x22')]){logger['info'](_0x696c('0x23'),_0xdfef67,_0x39deee,_0x2887d8);var _0x47ef3d=_0xd1e36d['channels'][_0xdfef67][_0x696c('0x24')]&&_0xd1e36d[_0x696c('0x19')][_0xdfef67]['destlinkedid']?_0xd1e36d[_0x696c('0x19')][_0xdfef67][_0x696c('0x25')]:_0xdfef67;return RpcUser[_0x696c('0x26')](_0xd1e36d['agents'][_0x39deee],_0x39fd57,_0x47ef3d)[_0x696c('0x21')](function(_0x2c4b67){if(!_0x19d205){_0xd1e36d['timers'][_0x39deee]={};logger[_0x696c('0x27')](_0x696c('0x28'),_0xdfef67,_0xd1e36d[_0x696c('0x6')][_0x2887d8][_0x696c('0x29')],_0x39deee,_0x2887d8);_0xd1e36d['timers'][_0x39deee][_0x696c('0x2a')]=setTimeout(_0xd1e36d[_0x696c('0x2b')][_0x696c('0xc')](_0xd1e36d,_0x39deee),_0xd1e36d[_0x696c('0x6')][_0x2887d8][_0x696c('0x29')]*0x3e8);_0xd1e36d['timers'][_0x39deee][_0x696c('0x2c')]=moment()[_0x696c('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');_0xd1e36d[_0x696c('0x8')][_0x39deee][_0x696c('0x2e')]=_0xdfef67;_0xd1e36d['timers'][_0x39deee][_0x696c('0x1b')]=_0x2887d8;_0xd1e36d[_0x696c('0x8')][_0x39deee][_0x696c('0x2f')]=function(){var _0x362727=getDiff(_0xd1e36d['timers'][_0x39deee]['lastPauseAt']);clearTimeout(_0xd1e36d[_0x696c('0x8')][_0x39deee][_0x696c('0x2a')]);_0xd1e36d[_0x696c('0x8')][_0x39deee][_0x696c('0x2a')]=![];RpcVoiceAgentReport[_0x696c('0x30')]({'acwtime':_0x362727},_0xd1e36d[_0x696c('0x8')][_0x39deee][_0x696c('0x2e')],_0x39deee)['then'](function(_0x354144){logger[_0x696c('0x27')]('[%s][UPDATE][ACWTIME:%s]',_0xdfef67,_0x362727,_0x354144);})[_0x696c('0x31')](function(_0x3c7352){logger[_0x696c('0x32')](_0x696c('0x33'),_0xdfef67,_0x3c7352);});delete _0xd1e36d['timers'][_0x39deee];};}});}else{logger['info'](_0x696c('0x34'),_0xdfef67,_0x39deee,_0x2887d8);}});}})[_0x696c('0x31')](function(_0x3c5083){logger['error'](_0x696c('0x28'),_0xdfef67,_0xd1e36d[_0x696c('0x6')][_0x2887d8][_0x696c('0x29')],_0x39deee,_0x2887d8);})[_0x696c('0x35')](function(){delete _0xd1e36d['channels'][_0xdfef67];});}catch(_0x5ca9c6){logger[_0x696c('0x32')](_0x696c('0x36'),_0x5ca9c6[_0x696c('0x37')]);}};Acw[_0x696c('0x38')]['stopAcw']=function(_0x508a83){try{var _0x1280e1=this;if(_0x1280e1[_0x696c('0x8')][_0x508a83]){_0x1280e1[_0x696c('0x8')][_0x508a83]['timer']=![];var _0x31e147=_0x1280e1[_0x696c('0x8')][_0x508a83][_0x696c('0x2e')];var _0x7148f9=_0x1280e1[_0x696c('0x8')][_0x508a83][_0x696c('0x1b')];var _0x107698=_0x1280e1[_0x696c('0x6')][_0x7148f9][_0x696c('0x29')];logger[_0x696c('0x27')](_0x696c('0x39'),_0x31e147,_0x508a83);RpcUser[_0x696c('0x3a')](this[_0x696c('0x7')][_0x508a83]);RpcVoiceAgentReport[_0x696c('0x30')]({'acwtime':_0x107698,'agentacw':!![]},_0x31e147,_0x508a83)[_0x696c('0x21')](function(_0x46ccc6){logger[_0x696c('0x27')](_0x696c('0x3b'),_0x31e147,_0x107698,_0x46ccc6);})[_0x696c('0x31')](function(_0x2d16c0){logger[_0x696c('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x31e147,_0x2d16c0);});}else{logger[_0x696c('0x32')](_0x696c('0x3c'),_0x508a83);if(_0x1280e1[_0x696c('0x8')]){logger['info'](_0x696c('0x3d'),JSON['stringify'](_0x1280e1[_0x696c('0x8')]));}}}catch(_0x54f46b){logger[_0x696c('0x32')](_0x696c('0x3e'),_0x54f46b[_0x696c('0x37')]);}};Acw[_0x696c('0x38')][_0x696c('0x3f')]=function(_0x384309){try{if(this[_0x696c('0x6')][_0x384309[_0x696c('0x1b')]]&&(this[_0x696c('0x6')][_0x384309[_0x696c('0x1b')]][_0x696c('0x3')]||this['voiceQueues'][_0x384309[_0x696c('0x1b')]]['mandatoryDisposition'])){if(this[_0x696c('0x7')][_0x384309['interface']]){this[_0x696c('0x19')][_0x384309[_0x696c('0x2e')]]={'queue':_0x384309[_0x696c('0x1b')],'interface':_0x384309[_0x696c('0x1a')],'destlinkedid':_0x384309['destlinkedid']};}}}catch(_0xb3d35f){logger[_0x696c('0x32')](_0x696c('0x40'),_0xb3d35f['message']);}};Acw[_0x696c('0x38')][_0x696c('0x15')]=function(_0x160ad2){try{if(this['voiceQueues'][_0x160ad2['queue']]&&(this[_0x696c('0x6')][_0x160ad2[_0x696c('0x1b')]][_0x696c('0x3')]||this[_0x696c('0x6')][_0x160ad2[_0x696c('0x1b')]][_0x696c('0x41')])){if(this['agents'][_0x160ad2[_0x696c('0x1a')]]){this[_0x696c('0x19')][_0x160ad2[_0x696c('0x2e')]]={'queue':_0x160ad2[_0x696c('0x1b')],'interface':_0x160ad2[_0x696c('0x1a')]};}}}catch(_0x36088e){logger[_0x696c('0x32')](_0x696c('0x42'),_0x36088e[_0x696c('0x37')]);}};Acw[_0x696c('0x38')][_0x696c('0xb')]=function(_0x585af6){try{if(this[_0x696c('0x19')][_0x585af6['uniqueid']]&&_[_0x696c('0x43')](this[_0x696c('0x19')][_0x585af6['uniqueid']][_0x696c('0x24')])){logger[_0x696c('0x27')](_0x696c('0x44'),_0x585af6[_0x696c('0x2e')]);this['startAcw'](_0x585af6[_0x696c('0x2e')]);}else if(this['channels'][_0x585af6[_0x696c('0x45')]]&&_[_0x696c('0x43')](this[_0x696c('0x19')][_0x585af6['linkedid']][_0x696c('0x24')])){logger[_0x696c('0x27')](_0x696c('0x46'),_0x585af6[_0x696c('0x45')]);this[_0x696c('0x18')](_0x585af6['linkedid']);}}catch(_0x3e8a15){logger['error'](_0x696c('0x47'),_0x3e8a15[_0x696c('0x37')]);}};Acw[_0x696c('0x38')][_0x696c('0xe')]=function(_0x9166f9){try{if(this[_0x696c('0x19')][_0x9166f9[_0x696c('0x2e')]]&&this[_0x696c('0x19')][_0x9166f9[_0x696c('0x2e')]][_0x696c('0x24')]){logger[_0x696c('0x27')](_0x696c('0x48'),_0x9166f9[_0x696c('0x2e')]);this[_0x696c('0x18')](_0x9166f9[_0x696c('0x2e')]);}else if(this[_0x696c('0x19')][_0x9166f9[_0x696c('0x45')]]&&this['channels'][_0x9166f9[_0x696c('0x45')]]['attended']){logger[_0x696c('0x27')](_0x696c('0x49'),_0x9166f9[_0x696c('0x45')]);this[_0x696c('0x18')](_0x9166f9['linkedid']);}}catch(_0x521575){logger['error'](_0x696c('0x4a'),_0x521575[_0x696c('0x37')]);}};Acw[_0x696c('0x38')][_0x696c('0x11')]=function(_0x2996ed){try{if(!_[_0x696c('0x4b')](this[_0x696c('0x19')][_0x2996ed[_0x696c('0x4c')]])){this[_0x696c('0x18')](_0x2996ed[_0x696c('0x4c')]);if(this['channels'][_0x2996ed[_0x696c('0x4d')]]){this['channels'][_0x2996ed[_0x696c('0x4d')]][_0x696c('0x24')]=!![];this[_0x696c('0x19')][_0x2996ed[_0x696c('0x4e')]]=this['channels'][_0x2996ed[_0x696c('0x4d')]];delete this[_0x696c('0x19')][_0x2996ed['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x696c('0x19')][_0x2996ed[_0x696c('0x4e')]])){this[_0x696c('0x18')](_0x2996ed[_0x696c('0x4e')]);if(this[_0x696c('0x19')][_0x2996ed['origtransfereruniqueid']]){this['channels'][_0x2996ed[_0x696c('0x4f')]][_0x696c('0x24')]=!![];this[_0x696c('0x19')][_0x2996ed[_0x696c('0x4c')]]=this['channels'][_0x2996ed['origtransfereruniqueid']];delete this[_0x696c('0x19')][_0x2996ed[_0x696c('0x4f')]];}}}catch(_0x5b5541){logger[_0x696c('0x32')]('[ACW][syncAttendedTransfer]\x20%s',_0x5b5541[_0x696c('0x37')]);}};Acw[_0x696c('0x38')][_0x696c('0x13')]=function(_0x323f02){try{if(this[_0x696c('0x19')][_0x323f02[_0x696c('0x50')]]){logger[_0x696c('0x27')](_0x696c('0x51'),JSON[_0x696c('0x52')](_0x323f02['transfereruniqueid']));this[_0x696c('0x18')](_0x323f02[_0x696c('0x50')]);}else if(this['channels'][_0x323f02[_0x696c('0x53')]]){logger['info'](_0x696c('0x54'),JSON[_0x696c('0x52')](_0x323f02[_0x696c('0x53')]));this[_0x696c('0x18')](_0x323f02[_0x696c('0x53')]);}}catch(_0x8a05a7){logger[_0x696c('0x32')](_0x696c('0x55'),_0x8a05a7[_0x696c('0x37')]);}};Acw[_0x696c('0x38')]['syncAgentRingNoAnswer']=function(_0x54c5c6){try{if(this[_0x696c('0x6')][_0x54c5c6['queue']]&&this['voiceQueues'][_0x54c5c6[_0x696c('0x1b')]][_0x696c('0x56')]===_0x696c('0x57')){if(this[_0x696c('0x7')][_0x54c5c6[_0x696c('0x1a')]]){logger[_0x696c('0x27')](_0x696c('0x58'),_0x54c5c6[_0x696c('0x2e')],_0x54c5c6[_0x696c('0x1a')],_0x54c5c6['queue']);return RpcUser[_0x696c('0x26')](this['agents'][_0x54c5c6[_0x696c('0x1a')]],'Auto-Pause',_0x54c5c6[_0x696c('0x2e')]);}}}catch(_0x6c5ef3){logger['error'](_0x696c('0x59'),_0x6c5ef3[_0x696c('0x37')]);}};module[_0x696c('0x5a')]=Acw; \ No newline at end of file +var _0x5717=['isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','milliseconds','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','prototype','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest'];(function(_0x111947,_0x43ea55){var _0x2d00f2=function(_0x56f3b9){while(--_0x56f3b9){_0x111947['push'](_0x111947['shift']());}};_0x2d00f2(++_0x43ea55);}(_0x5717,0x1a9));var _0x7571=function(_0x3c452f,_0x13b81a){_0x3c452f=_0x3c452f-0x0;var _0x5425dd=_0x5717[_0x3c452f];return _0x5425dd;};'use strict';var util=require(_0x7571('0x0'));var _=require('lodash');var moment=require(_0x7571('0x1'));var ami=require(_0x7571('0x2'));var logger=require(_0x7571('0x3'))(_0x7571('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x7571('0x5'));function Acw(_0x1ac2c4){this[_0x7571('0x6')]=_0x1ac2c4[_0x7571('0x6')];this[_0x7571('0x7')]=_0x1ac2c4[_0x7571('0x7')];this[_0x7571('0x8')]=_0x1ac2c4[_0x7571('0x8')];this[_0x7571('0x9')]={};ami['on']('agentconnect',this[_0x7571('0xa')][_0x7571('0xb')](this));ami['on'](_0x7571('0xc'),this['syncHangupRequest'][_0x7571('0xb')](this));ami['on'](_0x7571('0xd'),this[_0x7571('0xe')]['bind'](this));ami['on']('agentringnoanswer',this[_0x7571('0xf')][_0x7571('0xb')](this));ami['on']('attendedtransfer',this[_0x7571('0x10')]['bind'](this));ami['on']('blindtransfer',this[_0x7571('0x11')][_0x7571('0xb')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x7571('0xb')](this));}function getDiff(_0x102795){var _0x3393ad=moment()[_0x7571('0x12')](0x0);var _0x5522de=moment(_0x102795)[_0x7571('0x12')](0x0);return _0x3393ad['diff'](_0x5522de,_0x7571('0x13'));}Acw['prototype'][_0x7571('0x14')]=function(_0xef0057){try{var _0x2ec498=this;var _0x483c3b=this[_0x7571('0x9')][_0xef0057][_0x7571('0x15')];var _0x5a6f3a=this[_0x7571('0x9')][_0xef0057][_0x7571('0x16')];var _0x10fc37=this['voiceQueues'][_0x5a6f3a];var _0x405c96=![];var _0x378831=_0x7571('0x17');if(_0x10fc37[_0x7571('0x18')]){if(_0x10fc37['mandatoryDispositionPause'][_0x7571('0x19')]){_0x405c96=!![];_0x378831=_0x10fc37[_0x7571('0x1a')][_0x7571('0x19')];}}ami['Action']({'action':_0x7571('0x1b'),'interface':_0x483c3b,'paused':!![],'reason':_0x378831})[_0x7571('0x1c')](function(_0x5ba9d4){if(_0x2ec498[_0x7571('0x7')][_0x483c3b]){return RpcUser[_0x7571('0x1d')](_0x2ec498[_0x7571('0x7')][_0x483c3b]['id'])[_0x7571('0x1c')](function(_0x545cf8){if(_0x545cf8&&!_0x545cf8[_0x7571('0x1e')]){logger[_0x7571('0x1f')](_0x7571('0x20'),_0xef0057,_0x483c3b,_0x5a6f3a);var _0x1f3b5d=_0x2ec498[_0x7571('0x9')][_0xef0057][_0x7571('0x21')]&&_0x2ec498['channels'][_0xef0057]['destlinkedid']?_0x2ec498['channels'][_0xef0057]['destlinkedid']:_0xef0057;return RpcUser[_0x7571('0x22')](_0x2ec498[_0x7571('0x7')][_0x483c3b],_0x378831,_0x1f3b5d)[_0x7571('0x1c')](function(_0x353973){if(!_0x405c96){_0x2ec498[_0x7571('0x8')][_0x483c3b]={};logger['info'](_0x7571('0x23'),_0xef0057,_0x2ec498[_0x7571('0x6')][_0x5a6f3a][_0x7571('0x24')],_0x483c3b,_0x5a6f3a);_0x2ec498['timers'][_0x483c3b][_0x7571('0x25')]=setTimeout(_0x2ec498[_0x7571('0x26')][_0x7571('0xb')](_0x2ec498,_0x483c3b),_0x2ec498['voiceQueues'][_0x5a6f3a][_0x7571('0x24')]*0x3e8);_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x27')]=moment()[_0x7571('0x28')](_0x7571('0x29'));_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x2a')]=_0xef0057;_0x2ec498[_0x7571('0x8')][_0x483c3b]['queue']=_0x5a6f3a;_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x2b')]=function(){var _0x42991e=getDiff(_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x27')]);clearTimeout(_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x25')]);_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x25')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x42991e},_0x2ec498[_0x7571('0x8')][_0x483c3b][_0x7571('0x2a')],_0x483c3b)[_0x7571('0x1c')](function(_0x5ece2b){logger['info'](_0x7571('0x2c'),_0xef0057,_0x42991e,_0x5ece2b);})[_0x7571('0x2d')](function(_0xcbc944){logger[_0x7571('0x2e')](_0x7571('0x2f'),_0xef0057,_0xcbc944);});delete _0x2ec498[_0x7571('0x8')][_0x483c3b];};}});}else{logger[_0x7571('0x1f')](_0x7571('0x30'),_0xef0057,_0x483c3b,_0x5a6f3a);}});}})[_0x7571('0x2d')](function(_0x2d8269){logger['error'](_0x7571('0x23'),_0xef0057,_0x2ec498[_0x7571('0x6')][_0x5a6f3a][_0x7571('0x24')],_0x483c3b,_0x5a6f3a);})[_0x7571('0x31')](function(){delete _0x2ec498[_0x7571('0x9')][_0xef0057];});}catch(_0x4ee684){logger[_0x7571('0x2e')](_0x7571('0x32'),_0x4ee684['message']);}};Acw['prototype']['stopAcw']=function(_0x175eef){try{var _0xc2f68d=this;if(_0xc2f68d[_0x7571('0x8')][_0x175eef]){_0xc2f68d[_0x7571('0x8')][_0x175eef][_0x7571('0x25')]=![];var _0x4d67e0=_0xc2f68d['timers'][_0x175eef][_0x7571('0x2a')];var _0x13906b=_0xc2f68d[_0x7571('0x8')][_0x175eef][_0x7571('0x16')];var _0x1a1f1a=_0xc2f68d['voiceQueues'][_0x13906b][_0x7571('0x24')];logger[_0x7571('0x1f')](_0x7571('0x33'),_0x4d67e0,_0x175eef);RpcUser[_0x7571('0x34')](this[_0x7571('0x7')][_0x175eef]);RpcVoiceAgentReport[_0x7571('0x35')]({'acwtime':_0x1a1f1a,'agentacw':!![]},_0x4d67e0,_0x175eef)[_0x7571('0x1c')](function(_0x59aca2){logger[_0x7571('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x4d67e0,_0x1a1f1a,_0x59aca2);})['catch'](function(_0x3e4709){logger['error'](_0x7571('0x2f'),_0x4d67e0,_0x3e4709);});}else{logger[_0x7571('0x2e')](_0x7571('0x36'),_0x175eef);if(_0xc2f68d[_0x7571('0x8')]){logger[_0x7571('0x1f')](_0x7571('0x37'),JSON[_0x7571('0x38')](_0xc2f68d['timers']));}}}catch(_0x5b8262){logger[_0x7571('0x2e')]('[ACW][STOP]\x20%s',_0x5b8262[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')][_0x7571('0xa')]=function(_0x4411fd){try{if(this[_0x7571('0x6')][_0x4411fd[_0x7571('0x16')]]&&(this[_0x7571('0x6')][_0x4411fd[_0x7571('0x16')]][_0x7571('0x4')]||this['voiceQueues'][_0x4411fd[_0x7571('0x16')]]['mandatoryDisposition'])){if(this[_0x7571('0x7')][_0x4411fd[_0x7571('0x15')]]){this[_0x7571('0x9')][_0x4411fd['uniqueid']]={'queue':_0x4411fd['queue'],'interface':_0x4411fd[_0x7571('0x15')],'destlinkedid':_0x4411fd['destlinkedid']};}}}catch(_0x1cea8e){logger[_0x7571('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x1cea8e[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')]['syncAgentConnectPreview']=function(_0x10a045){try{if(this[_0x7571('0x6')][_0x10a045[_0x7571('0x16')]]&&(this[_0x7571('0x6')][_0x10a045[_0x7571('0x16')]][_0x7571('0x4')]||this[_0x7571('0x6')][_0x10a045[_0x7571('0x16')]][_0x7571('0x18')])){if(this[_0x7571('0x7')][_0x10a045[_0x7571('0x15')]]){this[_0x7571('0x9')][_0x10a045[_0x7571('0x2a')]]={'queue':_0x10a045[_0x7571('0x16')],'interface':_0x10a045['interface']};}}}catch(_0x2bafef){logger[_0x7571('0x2e')](_0x7571('0x3b'),_0x2bafef[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')][_0x7571('0x3c')]=function(_0x2581ac){try{if(this[_0x7571('0x9')][_0x2581ac[_0x7571('0x2a')]]&&_[_0x7571('0x3d')](this[_0x7571('0x9')][_0x2581ac[_0x7571('0x2a')]]['attended'])){logger[_0x7571('0x1f')](_0x7571('0x3e'),_0x2581ac[_0x7571('0x2a')]);this['startAcw'](_0x2581ac[_0x7571('0x2a')]);}else if(this[_0x7571('0x9')][_0x2581ac[_0x7571('0x3f')]]&&_[_0x7571('0x3d')](this[_0x7571('0x9')][_0x2581ac[_0x7571('0x3f')]][_0x7571('0x21')])){logger[_0x7571('0x1f')](_0x7571('0x40'),_0x2581ac[_0x7571('0x3f')]);this[_0x7571('0x14')](_0x2581ac[_0x7571('0x3f')]);}}catch(_0xeb8ee1){logger[_0x7571('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0xeb8ee1[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')]['syncHangup']=function(_0x4a3bce){try{if(this['channels'][_0x4a3bce[_0x7571('0x2a')]]&&this[_0x7571('0x9')][_0x4a3bce['uniqueid']][_0x7571('0x21')]){logger['info'](_0x7571('0x41'),_0x4a3bce[_0x7571('0x2a')]);this[_0x7571('0x14')](_0x4a3bce['uniqueid']);}else if(this[_0x7571('0x9')][_0x4a3bce[_0x7571('0x3f')]]&&this[_0x7571('0x9')][_0x4a3bce[_0x7571('0x3f')]][_0x7571('0x21')]){logger[_0x7571('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x4a3bce[_0x7571('0x3f')]);this[_0x7571('0x14')](_0x4a3bce[_0x7571('0x3f')]);}}catch(_0x391c9f){logger['error'](_0x7571('0x42'),_0x391c9f['message']);}};Acw['prototype'][_0x7571('0x10')]=function(_0x144b25){try{if(!_['isNil'](this['channels'][_0x144b25[_0x7571('0x43')]])){this[_0x7571('0x14')](_0x144b25['transfereeuniqueid']);if(this[_0x7571('0x9')][_0x144b25['secondtransfereruniqueid']]){this[_0x7571('0x9')][_0x144b25['secondtransfereruniqueid']][_0x7571('0x21')]=!![];this[_0x7571('0x9')][_0x144b25[_0x7571('0x44')]]=this[_0x7571('0x9')][_0x144b25[_0x7571('0x45')]];delete this[_0x7571('0x9')][_0x144b25[_0x7571('0x45')]];}}else if(!_['isNil'](this['channels'][_0x144b25[_0x7571('0x44')]])){this[_0x7571('0x14')](_0x144b25[_0x7571('0x44')]);if(this[_0x7571('0x9')][_0x144b25[_0x7571('0x46')]]){this[_0x7571('0x9')][_0x144b25[_0x7571('0x46')]]['attended']=!![];this['channels'][_0x144b25['transfereeuniqueid']]=this[_0x7571('0x9')][_0x144b25[_0x7571('0x46')]];delete this[_0x7571('0x9')][_0x144b25['origtransfereruniqueid']];}}}catch(_0x3d635e){logger[_0x7571('0x2e')](_0x7571('0x47'),_0x3d635e[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')][_0x7571('0x11')]=function(_0x17df6f){try{if(this[_0x7571('0x9')][_0x17df6f[_0x7571('0x48')]]){logger[_0x7571('0x1f')](_0x7571('0x49'),JSON[_0x7571('0x38')](_0x17df6f[_0x7571('0x48')]));this[_0x7571('0x14')](_0x17df6f[_0x7571('0x48')]);}else if(this[_0x7571('0x9')][_0x17df6f['transfererlinkedid']]){logger[_0x7571('0x1f')](_0x7571('0x4a'),JSON['stringify'](_0x17df6f[_0x7571('0x4b')]));this[_0x7571('0x14')](_0x17df6f['transfererlinkedid']);}}catch(_0x764946){logger[_0x7571('0x2e')](_0x7571('0x4c'),_0x764946[_0x7571('0x39')]);}};Acw[_0x7571('0x3a')][_0x7571('0xf')]=function(_0x32a5ca){try{if(this[_0x7571('0x6')][_0x32a5ca[_0x7571('0x16')]]&&this[_0x7571('0x6')][_0x32a5ca[_0x7571('0x16')]][_0x7571('0x4d')]==='all'){if(this[_0x7571('0x7')][_0x32a5ca['interface']]){logger['info'](_0x7571('0x4e'),_0x32a5ca[_0x7571('0x2a')],_0x32a5ca[_0x7571('0x15')],_0x32a5ca[_0x7571('0x16')]);return RpcUser[_0x7571('0x22')](this[_0x7571('0x7')][_0x32a5ca[_0x7571('0x15')]],'Auto-Pause',_0x32a5ca[_0x7571('0x2a')]);}}}catch(_0xb5d2d6){logger[_0x7571('0x2e')](_0x7571('0x4f'),_0xb5d2d6[_0x7571('0x39')]);}};module[_0x7571('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 726422b..61c488d 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 _0xf776=['util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','connect','shutdown','info','fullybooted','resolve','then','log','close','exports','asterisk-manager','bluebird','moment'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xf776,0x19f));var _0x6f77=function(_0x1b4e76,_0x78114a){_0x1b4e76=_0x1b4e76-0x0;var _0x4dd648=_0xf776[_0x1b4e76];return _0x4dd648;};'use strict';var Manager=require(_0x6f77('0x0'));var BPromise=require(_0x6f77('0x1'));var moment=require(_0x6f77('0x2'));var util=require(_0x6f77('0x3'));var _=require(_0x6f77('0x4'));var logger=require(_0x6f77('0x5'))(_0x6f77('0x6'));var config=require(_0x6f77('0x7'));var ami=new Manager(config[_0x6f77('0x8')][_0x6f77('0x9')],config[_0x6f77('0x8')]['ip'],config['asterisk'][_0x6f77('0xa')],config[_0x6f77('0x8')]['password'],!![]);ami[_0x6f77('0xb')]();ami[_0x6f77('0xc')]=BPromise[_0x6f77('0xd')](ami['action']);function error(_0xbcb66b){logger[_0x6f77('0xe')](util[_0x6f77('0xf')](_0x6f77('0x10'),config[_0x6f77('0x8')][_0x6f77('0xa')],config['asterisk']['ip'],config[_0x6f77('0x8')][_0x6f77('0x9')],util[_0x6f77('0x11')](_0xbcb66b,![],null)));}function close(){logger[_0x6f77('0xe')](util[_0x6f77('0xf')](_0x6f77('0x12'),config[_0x6f77('0x8')][_0x6f77('0xa')],config[_0x6f77('0x8')]['ip'],config[_0x6f77('0x8')][_0x6f77('0x9')]));}ami[_0x6f77('0x13')]=function(){return function(){return ami['Action']({'action':_0x6f77('0x14')});};};ami[_0x6f77('0x15')]=function(){return function(){return ami[_0x6f77('0xc')]({'action':_0x6f77('0x16')});};};ami[_0x6f77('0x17')]=function(){return function(){return ami[_0x6f77('0xc')]({'action':'sippeerstatus'});};};ami[_0x6f77('0x18')]=function(){return function(){return ami[_0x6f77('0xc')]({'action':_0x6f77('0x19')});};};ami[_0x6f77('0x1a')]=function(){return function(){return ami[_0x6f77('0xc')]({'action':_0x6f77('0x1b')});};};function connect(_0x584bbe){logger['info'](util[_0x6f77('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x6f77('0x8')][_0x6f77('0xa')],config[_0x6f77('0x8')]['ip'],config['asterisk'][_0x6f77('0x9')]));ami[_0x6f77('0x1c')](_0x6f77('0xe'),error);ami['once']('close',close);}ami['on'](_0x6f77('0x1d'),connect);ami['on'](_0x6f77('0x1e'),function(_0x39441c){logger[_0x6f77('0x1f')](util[_0x6f77('0xf')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x6f77('0x8')]['username'],config[_0x6f77('0x8')]['ip'],config[_0x6f77('0x8')][_0x6f77('0x9')],util[_0x6f77('0x11')](_0x39441c,![],null)));});ami['on'](_0x6f77('0x20'),function(_0x49bee7){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x6f77('0x8')]['username'],config['asterisk']['ip'],config[_0x6f77('0x8')][_0x6f77('0x9')]));return BPromise[_0x6f77('0x21')]()[_0x6f77('0x22')](ami[_0x6f77('0x13')]())[_0x6f77('0x22')](ami[_0x6f77('0x15')]())[_0x6f77('0x22')](ami[_0x6f77('0x17')]())[_0x6f77('0x22')](ami[_0x6f77('0x18')]())[_0x6f77('0x22')](ami['actionCoreShowChannels']())['catch'](function(_0x2b7beb){console[_0x6f77('0x23')](_0x2b7beb);});});ami[_0x6f77('0x1c')]('error',error);ami[_0x6f77('0x1c')](_0x6f77('0x24'),close);module[_0x6f77('0x25')]=ami; \ No newline at end of file +var _0xb1eb=['shutdown','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','log','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','error','close','connect'];(function(_0x29ee22,_0x4d7559){var _0x2e7a29=function(_0x561137){while(--_0x561137){_0x29ee22['push'](_0x29ee22['shift']());}};_0x2e7a29(++_0x4d7559);}(_0xb1eb,0x172));var _0xbb1e=function(_0x362f68,_0x396471){_0x362f68=_0x362f68-0x0;var _0x15dde4=_0xb1eb[_0x362f68];return _0x15dde4;};'use strict';var Manager=require(_0xbb1e('0x0'));var BPromise=require(_0xbb1e('0x1'));var moment=require('moment');var util=require(_0xbb1e('0x2'));var _=require(_0xbb1e('0x3'));var logger=require(_0xbb1e('0x4'))(_0xbb1e('0x5'));var config=require(_0xbb1e('0x6'));var ami=new Manager(config[_0xbb1e('0x7')]['port'],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')]['username'],config[_0xbb1e('0x7')][_0xbb1e('0x8')],!![]);ami[_0xbb1e('0x9')]();ami[_0xbb1e('0xa')]=BPromise[_0xbb1e('0xb')](ami[_0xbb1e('0xc')]);function error(_0x2cde43){logger['error'](util[_0xbb1e('0xd')](_0xbb1e('0xe'),config['asterisk'][_0xbb1e('0xf')],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')][_0xbb1e('0x10')],util['inspect'](_0x2cde43,![],null)));}function close(){logger['error'](util[_0xbb1e('0xd')](_0xbb1e('0x11'),config[_0xbb1e('0x7')][_0xbb1e('0xf')],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')][_0xbb1e('0x10')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xbb1e('0xa')]({'action':_0xbb1e('0x12')});};};ami[_0xbb1e('0x13')]=function(){return function(){return ami[_0xbb1e('0xa')]({'action':_0xbb1e('0x14')});};};ami[_0xbb1e('0x15')]=function(){return function(){return ami[_0xbb1e('0xa')]({'action':'sippeerstatus'});};};ami[_0xbb1e('0x16')]=function(){return function(){return ami[_0xbb1e('0xa')]({'action':'queuesummary'});};};ami[_0xbb1e('0x17')]=function(){return function(){return ami[_0xbb1e('0xa')]({'action':'coreshowchannels'});};};function connect(_0x42fd11){logger[_0xbb1e('0x18')](util[_0xbb1e('0xd')](_0xbb1e('0x19'),config['asterisk']['username'],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')]['port']));ami[_0xbb1e('0x1a')](_0xbb1e('0x1b'),error);ami[_0xbb1e('0x1a')](_0xbb1e('0x1c'),close);}ami['on'](_0xbb1e('0x1d'),connect);ami['on'](_0xbb1e('0x1e'),function(_0x3b45aa){logger[_0xbb1e('0x18')](util[_0xbb1e('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xbb1e('0x7')]['username'],config['asterisk']['ip'],config['asterisk'][_0xbb1e('0x10')],util[_0xbb1e('0x1f')](_0x3b45aa,![],null)));});ami['on'](_0xbb1e('0x20'),function(_0x3db5f0){logger['info'](util['format'](_0xbb1e('0x21'),config[_0xbb1e('0x7')][_0xbb1e('0xf')],config[_0xbb1e('0x7')]['ip'],config[_0xbb1e('0x7')]['port']));return BPromise[_0xbb1e('0x22')]()[_0xbb1e('0x23')](ami[_0xbb1e('0x24')]())[_0xbb1e('0x23')](ami['actionDeviceStateList']())[_0xbb1e('0x23')](ami[_0xbb1e('0x15')]())[_0xbb1e('0x23')](ami[_0xbb1e('0x16')]())['then'](ami[_0xbb1e('0x17')]())[_0xbb1e('0x25')](function(_0x40aafa){console[_0xbb1e('0x26')](_0x40aafa);});});ami[_0xbb1e('0x1a')](_0xbb1e('0x1b'),error);ami[_0xbb1e('0x1a')](_0xbb1e('0x1c'),close);module[_0xbb1e('0x27')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 1847507..71bf3ac 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x1b44b5,_0x4bfc7b){var _0x2a08b1=function(_0x30a347){while(--_0x30a347){_0x1b44b5['push'](_0x1b44b5['shift']());}};_0x2a08b1(++_0x4bfc7b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x159f8e,_0x258d08){var _0x458e17=function(_0xafee19){while(--_0xafee19){_0x159f8e['push'](_0x159f8e['shift']());}};_0x458e17(++_0x258d08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 98c2180..810fd44 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 _0xabdd=['VoiceQueueId','CampaignId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','number','dialCutDigit','prototype','getQueue','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','name','active','type','dialQueueTimeout','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xabdd,0x195));var _0xdabd=function(_0x1f1f6d,_0x3d5c31){_0x1f1f6d=_0x1f1f6d-0x0;var _0x18bb7b=_0xabdd[_0x1f1f6d];return _0x18bb7b;};'use strict';var util=require(_0xdabd('0x0'));var _=require(_0xdabd('0x1'));var moment=require(_0xdabd('0x2'));function checkNameSurname(_0x4d685c,_0xd440e9,_0x3891c8){var _0x4dc3ce='';if(!_[_0xdabd('0x3')](_0xd440e9)&&_0xdabd('0x4')===typeof _0xd440e9){_0x4dc3ce+=_0xd440e9;}if(!_[_0xdabd('0x3')](_0x3891c8)&&'string'===typeof _0x3891c8){_0x4dc3ce+='\x20'+_0x3891c8;}if(_0x4dc3ce!==''){return _0x4dc3ce;}return _0x4d685c;}function Action(_0x4f4609,_0x4aee1c,_0x145f06){this[_0xdabd('0x5')]=_0x4f4609;this[_0xdabd('0x6')]=_0x145f06||undefined;this['name']=checkNameSurname(_0x4aee1c[_0xdabd('0x7')][_0xdabd('0x8')],_0x4aee1c['Contact'][_0xdabd('0x9')],_0x4aee1c[_0xdabd('0x7')][_0xdabd('0xa')]);this['number']=_0x4aee1c[_0xdabd('0x7')][_0xdabd('0x8')];this['queue']=_0x4f4609[_0xdabd('0xb')];this['active']=_0x4aee1c[_0xdabd('0xc')]||![];this[_0xdabd('0xd')]=_0x4f4609[_0xdabd('0xd')];this[_0xdabd('0xe')]=_0x4f4609[_0xdabd('0xe')]||0x3;this['scheduledat']=_0x4aee1c['scheduledat'];this[_0xdabd('0xf')]=_0x4aee1c[_0xdabd('0xf')];this['countcongestionretry']=_0x4aee1c['countcongestionretry'];this[_0xdabd('0x10')]=_0x4aee1c[_0xdabd('0x10')];this[_0xdabd('0x11')]=_0x4aee1c[_0xdabd('0x11')];this['countdropretry']=_0x4aee1c[_0xdabd('0x12')];this['countabandonedretry']=_0x4aee1c[_0xdabd('0x13')];this[_0xdabd('0x14')]=_0x4aee1c[_0xdabd('0x14')];this[_0xdabd('0x15')]=_0x4aee1c[_0xdabd('0x15')];this[_0xdabd('0x16')]=_0x4aee1c[_0xdabd('0x16')];this[_0xdabd('0x17')]=_0x4aee1c[_0xdabd('0x17')];this[_0xdabd('0x18')]=_0x4aee1c[_0xdabd('0x18')];this[_0xdabd('0x19')]=_0x4aee1c[_0xdabd('0x19')];this['CampaignId']=_0x4aee1c[_0xdabd('0x1a')];this[_0xdabd('0x1b')]=_0x4aee1c['id'];this['ContactFirstName']=_0x4aee1c[_0xdabd('0x7')][_0xdabd('0x9')]||'';this['starttime']=moment()[_0xdabd('0x1c')](_0xdabd('0x1d'));this[_0xdabd('0x1e')]=_0x4aee1c[_0xdabd('0x1e')];this[_0xdabd('0x1f')]=_0x4aee1c[_0xdabd('0x1f')];this[_0xdabd('0x20')]=_0x4aee1c['callbackat'];this[_0xdabd('0x21')]=_0x4aee1c[_0xdabd('0x21')];this[_0xdabd('0x22')]='';this['originatecalleridname']='';}Action['prototype'][_0xdabd('0x23')]=function(){return util[_0xdabd('0x1c')](_0xdabd('0x24'),this[_0xdabd('0xb')],this[_0xdabd('0x5')]['dialCutDigit']>0x0?this[_0xdabd('0x25')]['substring'](this['voiceQueue'][_0xdabd('0x26')]):this['number']);};Action[_0xdabd('0x27')][_0xdabd('0x28')]=function(){return this[_0xdabd('0x29')];};module[_0xdabd('0x2a')]=Action; \ No newline at end of file +var _0x9bf6=['name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','voiceQueue','dialCutDigit','prototype','exports','lodash','isNil','string','uniqueid','Contact','firstName','lastName','number','phone','queue'];(function(_0x11140a,_0x311fb7){var _0x562bd7=function(_0x32d317){while(--_0x32d317){_0x11140a['push'](_0x11140a['shift']());}};_0x562bd7(++_0x311fb7);}(_0x9bf6,0x146));var _0x69bf=function(_0x33f26c,_0x6a39d4){_0x33f26c=_0x33f26c-0x0;var _0xac0fec=_0x9bf6[_0x33f26c];return _0xac0fec;};'use strict';var util=require('util');var _=require(_0x69bf('0x0'));var moment=require('moment');function checkNameSurname(_0x143525,_0x16c0bb,_0x15e117){var _0x19e274='';if(!_[_0x69bf('0x1')](_0x16c0bb)&&_0x69bf('0x2')===typeof _0x16c0bb){_0x19e274+=_0x16c0bb;}if(!_['isNil'](_0x15e117)&&_0x69bf('0x2')===typeof _0x15e117){_0x19e274+='\x20'+_0x15e117;}if(_0x19e274!==''){return _0x19e274;}return _0x143525;}function Action(_0x2dd730,_0x300f46,_0x28e859){this['voiceQueue']=_0x2dd730;this[_0x69bf('0x3')]=_0x28e859||undefined;this['name']=checkNameSurname(_0x300f46[_0x69bf('0x4')]['phone'],_0x300f46[_0x69bf('0x4')][_0x69bf('0x5')],_0x300f46[_0x69bf('0x4')][_0x69bf('0x6')]);this[_0x69bf('0x7')]=_0x300f46[_0x69bf('0x4')][_0x69bf('0x8')];this[_0x69bf('0x9')]=_0x2dd730[_0x69bf('0xa')];this[_0x69bf('0xb')]=_0x300f46['active']||![];this[_0x69bf('0xc')]=_0x2dd730[_0x69bf('0xc')];this[_0x69bf('0xd')]=_0x2dd730[_0x69bf('0xd')]||0x3;this['scheduledat']=_0x300f46[_0x69bf('0xe')];this[_0x69bf('0xf')]=_0x300f46['countbusyretry'];this[_0x69bf('0x10')]=_0x300f46[_0x69bf('0x10')];this[_0x69bf('0x11')]=_0x300f46[_0x69bf('0x11')];this[_0x69bf('0x12')]=_0x300f46[_0x69bf('0x12')];this[_0x69bf('0x13')]=_0x300f46[_0x69bf('0x13')];this[_0x69bf('0x14')]=_0x300f46['countabandonedretry'];this['countmachineretry']=_0x300f46['countmachineretry'];this[_0x69bf('0x15')]=_0x300f46['countagentrejectretry'];this[_0x69bf('0x16')]=_0x300f46[_0x69bf('0x16')];this[_0x69bf('0x17')]=_0x300f46[_0x69bf('0x17')];this['UserId']=_0x300f46[_0x69bf('0x18')];this['VoiceQueueId']=_0x300f46[_0x69bf('0x19')];this[_0x69bf('0x1a')]=_0x300f46[_0x69bf('0x1a')];this[_0x69bf('0x1b')]=_0x300f46['id'];this[_0x69bf('0x1c')]=_0x300f46[_0x69bf('0x4')][_0x69bf('0x5')]||'';this[_0x69bf('0x1d')]=moment()[_0x69bf('0x1e')](_0x69bf('0x1f'));this['callback']=_0x300f46['callback'];this['callbackuniqueid']=_0x300f46[_0x69bf('0x20')];this[_0x69bf('0x21')]=_0x300f46[_0x69bf('0x21')];this[_0x69bf('0x22')]=_0x300f46[_0x69bf('0x22')];this[_0x69bf('0x23')]='';this[_0x69bf('0x24')]='';}Action['prototype'][_0x69bf('0x25')]=function(){return util[_0x69bf('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this[_0x69bf('0x26')]['dialCutDigit']>0x0?this['number']['substring'](this[_0x69bf('0x26')][_0x69bf('0x27')]):this[_0x69bf('0x7')]);};Action[_0x69bf('0x28')]['getQueue']=function(){return this[_0x69bf('0x9')];};module[_0x69bf('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index aac1e95..a12d0d1 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 _0xe26f=['statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state'];(function(_0xb36b19,_0x4cc4f7){var _0xf99f11=function(_0x2c8ec6){while(--_0x2c8ec6){_0xb36b19['push'](_0xb36b19['shift']());}};_0xf99f11(++_0x4cc4f7);}(_0xe26f,0x13c));var _0xfe26=function(_0x31c52d,_0x131ef4){_0x31c52d=_0x31c52d-0x0;var _0x19143f=_0xe26f[_0x31c52d];return _0x19143f;};'use strict';var util=require(_0xfe26('0x0'));var _=require(_0xfe26('0x1'));var moment=require(_0xfe26('0x2'));function getSeconds(_0x20ac94,_0x56390c){var _0xd9c94e=moment(_0x20ac94)[_0xfe26('0x3')](0x0);var _0x2183cf=moment(_0x56390c)[_0xfe26('0x3')](0x0);return _0xd9c94e['diff'](_0x2183cf,_0xfe26('0x4'));}function AgentComplete(_0x13db28,_0x37e5a8){this[_0xfe26('0x5')]=0x4;this[_0xfe26('0x6')]='Answer';this[_0xfe26('0x7')]=_0x13db28[_0xfe26('0x7')];this[_0xfe26('0x8')]=_0x13db28[_0xfe26('0x8')];this['campaigntype']=_0x13db28[_0xfe26('0x8')]===_0xfe26('0x9')?_0xfe26('0xa'):_0x13db28[_0xfe26('0x8')];this[_0xfe26('0xb')]=_0x13db28[_0xfe26('0xb')];this['countcongestionretry']=_0x13db28[_0xfe26('0xc')];this[_0xfe26('0xd')]=_0x13db28['countnoanswerretry'];this[_0xfe26('0xe')]=_0x13db28[_0xfe26('0xb')]+_0x13db28['countcongestionretry']+_0x13db28[_0xfe26('0xd')]+_0x13db28[_0xfe26('0xf')]+_0x13db28[_0xfe26('0x10')]+_0x13db28[_0xfe26('0x11')]+_0x13db28[_0xfe26('0x12')]+_0x13db28[_0xfe26('0x13')];this[_0xfe26('0xf')]=_0x13db28[_0xfe26('0xf')];this[_0xfe26('0x10')]=_0x13db28['countdropretry'];this[_0xfe26('0x11')]=_0x13db28[_0xfe26('0x11')];this[_0xfe26('0x12')]=_0x13db28['countmachineretry'];this[_0xfe26('0x13')]=_0x13db28['countagentrejectretry'];this['uniqueid']=_0x37e5a8[_0xfe26('0x14')];this['calleridname']=_0x13db28[_0xfe26('0x15')];this[_0xfe26('0x16')]=_0x13db28[_0xfe26('0x17')];this[_0xfe26('0x18')]=_0x13db28[_0xfe26('0x18')];this['responsetime']=_0x13db28['responsetime'];this['answertime']=_0x13db28[_0xfe26('0x19')];this[_0xfe26('0x1a')]=moment()['format'](_0xfe26('0x1b'));this[_0xfe26('0x1c')]=getSeconds(_0x13db28[_0xfe26('0x1d')],_0x13db28[_0xfe26('0x18')]);this[_0xfe26('0x1e')]=getSeconds(_0x13db28[_0xfe26('0x19')],_0x13db28[_0xfe26('0x1d')]);this[_0xfe26('0x1f')]=getSeconds(this[_0xfe26('0x1a')],_0x13db28[_0xfe26('0x19')]);this['queue']=_0x37e5a8[_0xfe26('0xa')];this[_0xfe26('0x20')]=_0x37e5a8['membername'];this[_0xfe26('0x21')]=_0x37e5a8[_0xfe26('0x21')];this[_0xfe26('0x22')]=_0x13db28[_0xfe26('0x22')];this['callbackuniqueid']=_0x13db28[_0xfe26('0x23')];this[_0xfe26('0x24')]=_0x13db28['callbackat'];this['recallme']=_0x13db28[_0xfe26('0x25')];this[_0xfe26('0x26')]=_0x13db28[_0xfe26('0x26')];this[_0xfe26('0x27')]=_0x13db28['ListId'];this[_0xfe26('0x28')]=_0x13db28[_0xfe26('0x28')];this['VoiceQueueId']=_0x13db28[_0xfe26('0x29')];this['CampaignId']=_0x13db28[_0xfe26('0x2a')];this[_0xfe26('0x2b')]=_0x13db28[_0xfe26('0x2b')]||'';this[_0xfe26('0x2c')]=_0x13db28['originatecalleridname']||'';}module[_0xfe26('0x2d')]=AgentComplete; \ No newline at end of file +var _0x2a77=['exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x41d3fe,_0x12a1f8){var _0x125976=function(_0x1d5252){while(--_0x1d5252){_0x41d3fe['push'](_0x41d3fe['shift']());}};_0x125976(++_0x12a1f8);}(_0x2a77,0x1ba));var _0x72a7=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0x2a77[_0x4cce65];return _0x4d1b45;};'use strict';var util=require(_0x72a7('0x0'));var _=require(_0x72a7('0x1'));var moment=require(_0x72a7('0x2'));function getSeconds(_0x59cac5,_0x4786c0){var _0x12cbda=moment(_0x59cac5)[_0x72a7('0x3')](0x0);var _0x339683=moment(_0x4786c0)[_0x72a7('0x3')](0x0);return _0x12cbda[_0x72a7('0x4')](_0x339683,_0x72a7('0x5'));}function AgentComplete(_0x199dae,_0x8cfd76){this[_0x72a7('0x6')]=0x4;this[_0x72a7('0x7')]=_0x72a7('0x8');this[_0x72a7('0x9')]=_0x199dae['scheduledat'];this[_0x72a7('0xa')]=_0x199dae[_0x72a7('0xa')];this[_0x72a7('0xb')]=_0x199dae[_0x72a7('0xa')]===_0x72a7('0xc')?_0x72a7('0xd'):_0x199dae[_0x72a7('0xa')];this[_0x72a7('0xe')]=_0x199dae[_0x72a7('0xe')];this[_0x72a7('0xf')]=_0x199dae[_0x72a7('0xf')];this[_0x72a7('0x10')]=_0x199dae[_0x72a7('0x10')];this[_0x72a7('0x11')]=_0x199dae[_0x72a7('0xe')]+_0x199dae[_0x72a7('0xf')]+_0x199dae['countnoanswerretry']+_0x199dae[_0x72a7('0x12')]+_0x199dae[_0x72a7('0x13')]+_0x199dae[_0x72a7('0x14')]+_0x199dae[_0x72a7('0x15')]+_0x199dae[_0x72a7('0x16')];this[_0x72a7('0x12')]=_0x199dae[_0x72a7('0x12')];this[_0x72a7('0x13')]=_0x199dae[_0x72a7('0x13')];this[_0x72a7('0x14')]=_0x199dae[_0x72a7('0x14')];this[_0x72a7('0x15')]=_0x199dae['countmachineretry'];this[_0x72a7('0x16')]=_0x199dae['countagentrejectretry'];this['uniqueid']=_0x8cfd76[_0x72a7('0x17')];this[_0x72a7('0x18')]=_0x199dae[_0x72a7('0x19')];this['calleridnum']=_0x199dae[_0x72a7('0x1a')];this[_0x72a7('0x1b')]=_0x199dae[_0x72a7('0x1b')];this[_0x72a7('0x1c')]=_0x199dae[_0x72a7('0x1c')];this[_0x72a7('0x1d')]=_0x199dae[_0x72a7('0x1d')];this[_0x72a7('0x1e')]=moment()[_0x72a7('0x1f')](_0x72a7('0x20'));this[_0x72a7('0x21')]=getSeconds(_0x199dae['responsetime'],_0x199dae[_0x72a7('0x1b')]);this['holdtime']=getSeconds(_0x199dae[_0x72a7('0x1d')],_0x199dae[_0x72a7('0x1c')]);this[_0x72a7('0x22')]=getSeconds(this[_0x72a7('0x1e')],_0x199dae['answertime']);this['queue']=_0x8cfd76[_0x72a7('0xd')];this[_0x72a7('0x23')]=_0x8cfd76[_0x72a7('0x23')];this[_0x72a7('0x24')]=_0x8cfd76[_0x72a7('0x24')];this[_0x72a7('0x25')]=_0x199dae[_0x72a7('0x25')];this['callbackuniqueid']=_0x199dae[_0x72a7('0x26')];this['callbackat']=_0x199dae[_0x72a7('0x27')];this[_0x72a7('0x28')]=_0x199dae[_0x72a7('0x28')];this[_0x72a7('0x29')]=_0x199dae[_0x72a7('0x29')];this[_0x72a7('0x2a')]=_0x199dae[_0x72a7('0x2a')];this[_0x72a7('0x2b')]=_0x199dae[_0x72a7('0x2b')];this[_0x72a7('0x2c')]=_0x199dae['VoiceQueueId'];this['CampaignId']=_0x199dae[_0x72a7('0x2d')];this[_0x72a7('0x2e')]=_0x199dae[_0x72a7('0x2e')]||'';this[_0x72a7('0x2f')]=_0x199dae[_0x72a7('0x2f')]||'';}module[_0x72a7('0x30')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 7f6b440..27c5605 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 _0xfd20=['lodash','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname'];(function(_0x3ddff4,_0x41b06c){var _0x1deb3b=function(_0x504b40){while(--_0x504b40){_0x3ddff4['push'](_0x3ddff4['shift']());}};_0x1deb3b(++_0x41b06c);}(_0xfd20,0x66));var _0x0fd2=function(_0x33fb76,_0x450ed3){_0x33fb76=_0x33fb76-0x0;var _0x41033e=_0xfd20[_0x33fb76];return _0x41033e;};'use strict';var util=require('util');var _=require(_0x0fd2('0x0'));var moment=require('moment');function getSeconds(_0x54f464,_0x429df4){var _0x28eb77=moment(_0x54f464)['milliseconds'](0x0);var _0x27bee6=moment(_0x429df4)['milliseconds'](0x0);return _0x28eb77[_0x0fd2('0x1')](_0x27bee6,_0x0fd2('0x2'));}function Final(_0x2ef0c3){this[_0x0fd2('0x3')]=_0x2ef0c3[_0x0fd2('0x3')];this['scheduledat']=_0x2ef0c3['scheduledat'];this[_0x0fd2('0x4')]=_0x2ef0c3[_0x0fd2('0x4')];this[_0x0fd2('0x5')]=_0x2ef0c3[_0x0fd2('0x4')]===_0x0fd2('0x6')?_0x0fd2('0x7'):_0x2ef0c3[_0x0fd2('0x4')];this['countbusyretry']=_0x2ef0c3[_0x0fd2('0x8')];this[_0x0fd2('0x9')]=_0x2ef0c3['countcongestionretry'];this[_0x0fd2('0xa')]=_0x2ef0c3['countnoanswerretry'];this[_0x0fd2('0xb')]=_0x2ef0c3[_0x0fd2('0x8')]+_0x2ef0c3[_0x0fd2('0x9')]+_0x2ef0c3[_0x0fd2('0xa')]+_0x2ef0c3[_0x0fd2('0xc')]+_0x2ef0c3[_0x0fd2('0xd')]+_0x2ef0c3[_0x0fd2('0xe')]+_0x2ef0c3[_0x0fd2('0xf')]+_0x2ef0c3['countagentrejectretry'];this['countnosuchnumberretry']=_0x2ef0c3[_0x0fd2('0xc')];this[_0x0fd2('0xd')]=_0x2ef0c3[_0x0fd2('0xd')];this[_0x0fd2('0xe')]=_0x2ef0c3['countabandonedretry'];this[_0x0fd2('0xf')]=_0x2ef0c3['countmachineretry'];this['countagentrejectretry']=_0x2ef0c3[_0x0fd2('0x10')];this['queue']=_0x2ef0c3[_0x0fd2('0x7')];this['calleridname']=_0x2ef0c3[_0x0fd2('0x11')];this['calleridnum']=_0x2ef0c3[_0x0fd2('0x12')];this[_0x0fd2('0x13')]=_0x2ef0c3['starttime'];this[_0x0fd2('0x14')]=_0x2ef0c3['responsetime'];this[_0x0fd2('0x15')]=_0x2ef0c3[_0x0fd2('0x14')];this[_0x0fd2('0x16')]=_0x2ef0c3[_0x0fd2('0x16')]||0x0;this[_0x0fd2('0x17')]=_0x2ef0c3[_0x0fd2('0x17')]||0x0;this[_0x0fd2('0x18')]=_0x2ef0c3[_0x0fd2('0x18')]||0x0;this[_0x0fd2('0x19')]=_0x2ef0c3[_0x0fd2('0x19')];this['callbackuniqueid']=_0x2ef0c3['callbackuniqueid'];this['callbackat']=_0x2ef0c3[_0x0fd2('0x1a')];this[_0x0fd2('0x1b')]=_0x2ef0c3['recallme'];this['ContactId']=_0x2ef0c3[_0x0fd2('0x1c')];this[_0x0fd2('0x1d')]=_0x2ef0c3[_0x0fd2('0x1d')];this[_0x0fd2('0x1e')]=_0x2ef0c3[_0x0fd2('0x1e')];this['VoiceQueueId']=_0x2ef0c3[_0x0fd2('0x1f')];this[_0x0fd2('0x20')]=_0x2ef0c3[_0x0fd2('0x20')];this['originatecalleridnum']=_0x2ef0c3['originatecalleridnum']||'';this[_0x0fd2('0x21')]=_0x2ef0c3[_0x0fd2('0x21')]||'';}module['exports']=Final; \ No newline at end of file +var _0x85d0=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','diff','uniqueid','scheduledat'];(function(_0x3137f0,_0x509d52){var _0x4c12c4=function(_0x4b9be3){while(--_0x4b9be3){_0x3137f0['push'](_0x3137f0['shift']());}};_0x4c12c4(++_0x509d52);}(_0x85d0,0x164));var _0x085d=function(_0x4dbdbe,_0x276811){_0x4dbdbe=_0x4dbdbe-0x0;var _0x5ec384=_0x85d0[_0x4dbdbe];return _0x5ec384;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x51c417,_0x297001){var _0x1716e5=moment(_0x51c417)[_0x085d('0x0')](0x0);var _0x313db8=moment(_0x297001)[_0x085d('0x0')](0x0);return _0x1716e5[_0x085d('0x1')](_0x313db8,'seconds');}function Final(_0x2f37ca){this['uniqueid']=_0x2f37ca[_0x085d('0x2')];this[_0x085d('0x3')]=_0x2f37ca[_0x085d('0x3')];this['type']=_0x2f37ca[_0x085d('0x4')];this[_0x085d('0x5')]=_0x2f37ca[_0x085d('0x4')]===_0x085d('0x6')?_0x085d('0x7'):_0x2f37ca[_0x085d('0x4')];this[_0x085d('0x8')]=_0x2f37ca[_0x085d('0x8')];this[_0x085d('0x9')]=_0x2f37ca['countcongestionretry'];this[_0x085d('0xa')]=_0x2f37ca[_0x085d('0xa')];this[_0x085d('0xb')]=_0x2f37ca[_0x085d('0x8')]+_0x2f37ca['countcongestionretry']+_0x2f37ca[_0x085d('0xa')]+_0x2f37ca[_0x085d('0xc')]+_0x2f37ca['countdropretry']+_0x2f37ca[_0x085d('0xd')]+_0x2f37ca[_0x085d('0xe')]+_0x2f37ca[_0x085d('0xf')];this[_0x085d('0xc')]=_0x2f37ca['countnosuchnumberretry'];this[_0x085d('0x10')]=_0x2f37ca[_0x085d('0x10')];this['countabandonedretry']=_0x2f37ca['countabandonedretry'];this[_0x085d('0xe')]=_0x2f37ca[_0x085d('0xe')];this[_0x085d('0xf')]=_0x2f37ca[_0x085d('0xf')];this[_0x085d('0x7')]=_0x2f37ca['queue'];this[_0x085d('0x11')]=_0x2f37ca[_0x085d('0x11')];this[_0x085d('0x12')]=_0x2f37ca[_0x085d('0x12')];this[_0x085d('0x13')]=_0x2f37ca[_0x085d('0x13')];this[_0x085d('0x14')]=_0x2f37ca[_0x085d('0x14')];this[_0x085d('0x15')]=_0x2f37ca['responsetime'];this[_0x085d('0x16')]=_0x2f37ca[_0x085d('0x16')]||0x0;this[_0x085d('0x17')]=_0x2f37ca[_0x085d('0x17')]||0x0;this[_0x085d('0x18')]=_0x2f37ca['talktime']||0x0;this[_0x085d('0x19')]=_0x2f37ca[_0x085d('0x19')];this[_0x085d('0x1a')]=_0x2f37ca[_0x085d('0x1a')];this['callbackat']=_0x2f37ca['callbackat'];this['recallme']=_0x2f37ca[_0x085d('0x1b')];this[_0x085d('0x1c')]=_0x2f37ca[_0x085d('0x1c')];this[_0x085d('0x1d')]=_0x2f37ca[_0x085d('0x1d')];this[_0x085d('0x1e')]=_0x2f37ca['UserId'];this[_0x085d('0x1f')]=_0x2f37ca[_0x085d('0x1f')];this[_0x085d('0x20')]=_0x2f37ca['CampaignId'];this[_0x085d('0x21')]=_0x2f37ca[_0x085d('0x21')]||'';this[_0x085d('0x22')]=_0x2f37ca[_0x085d('0x22')]||'';}module[_0x085d('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 495606c..16e44fb 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 _0xe2aa=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','diff','seconds','state','statedesc','Answer','scheduledat','type'];(function(_0xb8400d,_0x975dbb){var _0x2f4050=function(_0x5c012c){while(--_0x5c012c){_0xb8400d['push'](_0xb8400d['shift']());}};_0x2f4050(++_0x975dbb);}(_0xe2aa,0x124));var _0xae2a=function(_0x52a72f,_0x15b029){_0x52a72f=_0x52a72f-0x0;var _0x3c620a=_0xe2aa[_0x52a72f];return _0x3c620a;};'use strict';var util=require('util');var _=require(_0xae2a('0x0'));var moment=require(_0xae2a('0x1'));function getSeconds(_0x3db805,_0x861a7c){var _0x6d937d=moment(_0x3db805)['milliseconds'](0x0);var _0x54508b=moment(_0x861a7c)['milliseconds'](0x0);return _0x6d937d[_0xae2a('0x2')](_0x54508b,_0xae2a('0x3'));}function Hangup(_0x5a24c0,_0x488379){this[_0xae2a('0x4')]=0x4;this[_0xae2a('0x5')]=_0xae2a('0x6');this[_0xae2a('0x7')]=_0x5a24c0[_0xae2a('0x7')];this[_0xae2a('0x8')]=_0x5a24c0[_0xae2a('0x8')];this['campaigntype']=_0x5a24c0[_0xae2a('0x8')]===_0xae2a('0x9')?_0xae2a('0xa'):_0x5a24c0['type'];this[_0xae2a('0xb')]=_0x5a24c0[_0xae2a('0xb')];this[_0xae2a('0xc')]=_0x5a24c0[_0xae2a('0xc')];this[_0xae2a('0xd')]=_0x5a24c0['countnoanswerretry'];this['countglobal']=_0x5a24c0[_0xae2a('0xb')]+_0x5a24c0[_0xae2a('0xc')]+_0x5a24c0[_0xae2a('0xd')]+_0x5a24c0[_0xae2a('0xe')]+_0x5a24c0[_0xae2a('0xf')]+_0x5a24c0['countabandonedretry']+_0x5a24c0[_0xae2a('0x10')]+_0x5a24c0[_0xae2a('0x11')];this[_0xae2a('0xe')]=_0x5a24c0[_0xae2a('0xe')];this[_0xae2a('0xf')]=_0x5a24c0['countdropretry'];this['countabandonedretry']=_0x5a24c0[_0xae2a('0x12')];this[_0xae2a('0x10')]=_0x5a24c0[_0xae2a('0x10')];this['countagentrejectretry']=_0x5a24c0[_0xae2a('0x11')];this[_0xae2a('0x13')]=_0x488379[_0xae2a('0x13')];this[_0xae2a('0x14')]=_0x5a24c0[_0xae2a('0x15')];this[_0xae2a('0x16')]=_0x5a24c0[_0xae2a('0x17')];this[_0xae2a('0x18')]=_0x5a24c0[_0xae2a('0x18')];this[_0xae2a('0x19')]=_0x5a24c0[_0xae2a('0x19')];this[_0xae2a('0x1a')]=moment()[_0xae2a('0x1b')](_0xae2a('0x1c'));this[_0xae2a('0x1d')]=getSeconds(_0x5a24c0[_0xae2a('0x19')],_0x5a24c0[_0xae2a('0x18')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0xae2a('0x1a')],_0x5a24c0[_0xae2a('0x19')]);this['queue']=_0x5a24c0[_0xae2a('0xa')];this['membername']=_0xae2a('0x1e');this[_0xae2a('0x1f')]=_0x488379[_0xae2a('0x20')];this['callback']=_0x5a24c0[_0xae2a('0x21')];this['callbackuniqueid']=_0x5a24c0[_0xae2a('0x22')];this[_0xae2a('0x23')]=_0x5a24c0[_0xae2a('0x23')];this[_0xae2a('0x24')]=_0x5a24c0[_0xae2a('0x24')];this[_0xae2a('0x25')]=_0x5a24c0[_0xae2a('0x25')];this[_0xae2a('0x26')]=_0x5a24c0[_0xae2a('0x26')];this[_0xae2a('0x27')]=_0x5a24c0[_0xae2a('0x27')];this[_0xae2a('0x28')]=_0x5a24c0[_0xae2a('0x28')];this['CampaignId']=_0x5a24c0[_0xae2a('0x29')];}module[_0xae2a('0x2a')]=Hangup; \ No newline at end of file +var _0x8fb0=['reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','IVR'];(function(_0x575934,_0x4a6760){var _0x109a3d=function(_0x1c20a1){while(--_0x1c20a1){_0x575934['push'](_0x575934['shift']());}};_0x109a3d(++_0x4a6760);}(_0x8fb0,0x146));var _0x08fb=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8fb0[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x08fb('0x0'));var _=require(_0x08fb('0x1'));var moment=require(_0x08fb('0x2'));function getSeconds(_0xa3488a,_0x248d33){var _0x2d598e=moment(_0xa3488a)[_0x08fb('0x3')](0x0);var _0xbd9401=moment(_0x248d33)[_0x08fb('0x3')](0x0);return _0x2d598e[_0x08fb('0x4')](_0xbd9401,_0x08fb('0x5'));}function Hangup(_0x86d446,_0x3918a8){this['state']=0x4;this[_0x08fb('0x6')]=_0x08fb('0x7');this[_0x08fb('0x8')]=_0x86d446['scheduledat'];this['type']=_0x86d446[_0x08fb('0x9')];this[_0x08fb('0xa')]=_0x86d446[_0x08fb('0x9')]===_0x08fb('0xb')?'queue':_0x86d446[_0x08fb('0x9')];this[_0x08fb('0xc')]=_0x86d446[_0x08fb('0xc')];this['countcongestionretry']=_0x86d446['countcongestionretry'];this[_0x08fb('0xd')]=_0x86d446[_0x08fb('0xd')];this[_0x08fb('0xe')]=_0x86d446[_0x08fb('0xc')]+_0x86d446[_0x08fb('0xf')]+_0x86d446[_0x08fb('0xd')]+_0x86d446[_0x08fb('0x10')]+_0x86d446['countdropretry']+_0x86d446[_0x08fb('0x11')]+_0x86d446[_0x08fb('0x12')]+_0x86d446[_0x08fb('0x13')];this['countnosuchnumberretry']=_0x86d446[_0x08fb('0x10')];this[_0x08fb('0x14')]=_0x86d446[_0x08fb('0x14')];this[_0x08fb('0x11')]=_0x86d446[_0x08fb('0x11')];this['countmachineretry']=_0x86d446['countmachineretry'];this[_0x08fb('0x13')]=_0x86d446[_0x08fb('0x13')];this[_0x08fb('0x15')]=_0x3918a8[_0x08fb('0x15')];this[_0x08fb('0x16')]=_0x86d446[_0x08fb('0x17')];this[_0x08fb('0x18')]=_0x86d446['number'];this['starttime']=_0x86d446[_0x08fb('0x19')];this[_0x08fb('0x1a')]=_0x86d446['responsetime'];this[_0x08fb('0x1b')]=moment()['format'](_0x08fb('0x1c'));this[_0x08fb('0x1d')]=getSeconds(_0x86d446[_0x08fb('0x1a')],_0x86d446[_0x08fb('0x19')]);this[_0x08fb('0x1e')]=0x0;this[_0x08fb('0x1f')]=getSeconds(this[_0x08fb('0x1b')],_0x86d446[_0x08fb('0x1a')]);this[_0x08fb('0x20')]=_0x86d446[_0x08fb('0x20')];this['membername']=_0x08fb('0x21');this[_0x08fb('0x22')]=_0x3918a8[_0x08fb('0x23')];this['callback']=_0x86d446[_0x08fb('0x24')];this[_0x08fb('0x25')]=_0x86d446[_0x08fb('0x25')];this['callbackat']=_0x86d446['callbackat'];this['recallme']=_0x86d446[_0x08fb('0x26')];this[_0x08fb('0x27')]=_0x86d446[_0x08fb('0x27')];this[_0x08fb('0x28')]=_0x86d446[_0x08fb('0x28')];this['UserId']=_0x86d446[_0x08fb('0x29')];this[_0x08fb('0x2a')]=_0x86d446[_0x08fb('0x2a')];this[_0x08fb('0x2b')]=_0x86d446[_0x08fb('0x2b')];}module[_0x08fb('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index e77bd01..b82dbb4 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 _0xd5e6=['seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds'];(function(_0x4e6642,_0x42eb67){var _0x41dd75=function(_0x5c2fa6){while(--_0x5c2fa6){_0x4e6642['push'](_0x4e6642['shift']());}};_0x41dd75(++_0x42eb67);}(_0xd5e6,0x100));var _0x6d5e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xd5e6[_0x2c7618];return _0x5ce3f0;};'use strict';var util=require('util');var _=require(_0x6d5e('0x0'));var moment=require(_0x6d5e('0x1'));function getSeconds(_0x336a1e,_0x4d4575){var _0x46270f=moment(_0x336a1e)[_0x6d5e('0x2')](0x0);var _0x20904f=moment(_0x4d4575)[_0x6d5e('0x2')](0x0);return _0x46270f['diff'](_0x20904f,_0x6d5e('0x3'));}function History(_0x5990bc){this['uniqueid']=_0x5990bc['uniqueid'];this[_0x6d5e('0x4')]=_0x5990bc[_0x6d5e('0x4')]||undefined;this[_0x6d5e('0x5')]=_0x5990bc[_0x6d5e('0x5')];this[_0x6d5e('0x6')]=_0x5990bc[_0x6d5e('0x5')]===_0x6d5e('0x7')?_0x6d5e('0x8'):_0x5990bc['type'];this['countbusyretry']=_0x5990bc[_0x6d5e('0x9')];this[_0x6d5e('0xa')]=_0x5990bc[_0x6d5e('0xa')];this['countnoanswerretry']=_0x5990bc[_0x6d5e('0xb')];this[_0x6d5e('0xc')]=_0x5990bc['countbusyretry']+_0x5990bc[_0x6d5e('0xa')]+_0x5990bc['countnoanswerretry']+_0x5990bc['countnosuchnumberretry']+_0x5990bc[_0x6d5e('0xd')]+_0x5990bc[_0x6d5e('0xe')]+_0x5990bc[_0x6d5e('0xf')]+_0x5990bc[_0x6d5e('0x10')];this[_0x6d5e('0x11')]=_0x5990bc[_0x6d5e('0x11')];this[_0x6d5e('0xd')]=_0x5990bc[_0x6d5e('0xd')];this[_0x6d5e('0xe')]=_0x5990bc[_0x6d5e('0xe')];this[_0x6d5e('0xf')]=_0x5990bc['countmachineretry'];this[_0x6d5e('0x10')]=_0x5990bc[_0x6d5e('0x10')];this[_0x6d5e('0x8')]=_0x5990bc[_0x6d5e('0x8')];this[_0x6d5e('0x12')]=_0x5990bc[_0x6d5e('0x13')];this[_0x6d5e('0x14')]=_0x5990bc[_0x6d5e('0x15')];this[_0x6d5e('0x16')]=_0x5990bc[_0x6d5e('0x16')];this['responsetime']=_0x5990bc[_0x6d5e('0x17')];this['endtime']=_0x5990bc[_0x6d5e('0x17')];this['ringtime']=getSeconds(_0x5990bc[_0x6d5e('0x17')],_0x5990bc[_0x6d5e('0x16')]);this[_0x6d5e('0x18')]=0x0;this[_0x6d5e('0x19')]=0x0;this[_0x6d5e('0x1a')]=_0x5990bc[_0x6d5e('0x1a')];this['callbackuniqueid']=_0x5990bc[_0x6d5e('0x1b')];this[_0x6d5e('0x1c')]=_0x5990bc[_0x6d5e('0x1c')];this[_0x6d5e('0x1d')]=_0x5990bc[_0x6d5e('0x1d')];this[_0x6d5e('0x1e')]=_0x5990bc[_0x6d5e('0x1e')];this['ListId']=_0x5990bc[_0x6d5e('0x1f')];this[_0x6d5e('0x20')]=_0x5990bc['UserId'];this['VoiceQueueId']=_0x5990bc[_0x6d5e('0x21')];this[_0x6d5e('0x22')]=_0x5990bc[_0x6d5e('0x22')];this[_0x6d5e('0x23')]=_0x5990bc['originatecalleridnum']||'';this[_0x6d5e('0x24')]=_0x5990bc['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0x296d=['starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','uniqueid','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x296d,0xc9));var _0xd296=function(_0x336df4,_0x52c1dc){_0x336df4=_0x336df4-0x0;var _0x580d8c=_0x296d[_0x336df4];return _0x580d8c;};'use strict';var util=require(_0xd296('0x0'));var _=require('lodash');var moment=require(_0xd296('0x1'));function getSeconds(_0x36e0c6,_0x102ec2){var _0x2dbb75=moment(_0x36e0c6)[_0xd296('0x2')](0x0);var _0x3c47d3=moment(_0x102ec2)[_0xd296('0x2')](0x0);return _0x2dbb75['diff'](_0x3c47d3,'seconds');}function History(_0x10cb43){this[_0xd296('0x3')]=_0x10cb43[_0xd296('0x3')];this['scheduledat']=_0x10cb43[_0xd296('0x4')]||undefined;this['type']=_0x10cb43['type'];this[_0xd296('0x5')]=_0x10cb43[_0xd296('0x6')]===_0xd296('0x7')?_0xd296('0x8'):_0x10cb43[_0xd296('0x6')];this['countbusyretry']=_0x10cb43[_0xd296('0x9')];this['countcongestionretry']=_0x10cb43['countcongestionretry'];this[_0xd296('0xa')]=_0x10cb43[_0xd296('0xa')];this[_0xd296('0xb')]=_0x10cb43[_0xd296('0x9')]+_0x10cb43['countcongestionretry']+_0x10cb43[_0xd296('0xa')]+_0x10cb43['countnosuchnumberretry']+_0x10cb43[_0xd296('0xc')]+_0x10cb43[_0xd296('0xd')]+_0x10cb43[_0xd296('0xe')]+_0x10cb43[_0xd296('0xf')];this[_0xd296('0x10')]=_0x10cb43[_0xd296('0x10')];this[_0xd296('0xc')]=_0x10cb43[_0xd296('0xc')];this[_0xd296('0xd')]=_0x10cb43[_0xd296('0xd')];this[_0xd296('0xe')]=_0x10cb43[_0xd296('0xe')];this['countagentrejectretry']=_0x10cb43[_0xd296('0xf')];this[_0xd296('0x8')]=_0x10cb43[_0xd296('0x8')];this[_0xd296('0x11')]=_0x10cb43[_0xd296('0x12')];this[_0xd296('0x13')]=_0x10cb43[_0xd296('0x14')];this[_0xd296('0x15')]=_0x10cb43[_0xd296('0x15')];this[_0xd296('0x16')]=_0x10cb43[_0xd296('0x16')];this[_0xd296('0x17')]=_0x10cb43['responsetime'];this[_0xd296('0x18')]=getSeconds(_0x10cb43[_0xd296('0x16')],_0x10cb43[_0xd296('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x10cb43[_0xd296('0x19')];this[_0xd296('0x1a')]=_0x10cb43['callbackuniqueid'];this[_0xd296('0x1b')]=_0x10cb43['callbackat'];this[_0xd296('0x1c')]=_0x10cb43['recallme'];this[_0xd296('0x1d')]=_0x10cb43[_0xd296('0x1d')];this[_0xd296('0x1e')]=_0x10cb43[_0xd296('0x1e')];this[_0xd296('0x1f')]=_0x10cb43[_0xd296('0x1f')];this[_0xd296('0x20')]=_0x10cb43[_0xd296('0x20')];this[_0xd296('0x21')]=_0x10cb43[_0xd296('0x21')];this[_0xd296('0x22')]=_0x10cb43['originatecalleridnum']||'';this['originatecalleridname']=_0x10cb43[_0xd296('0x23')]||'';}module[_0xd296('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index a7bdbd8..9f06bb1 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 _0x31c2=['updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','xcally-motion-dialer','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','RUNNING','Contact.phone','[getContactDialer2]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[busyFactor]','interval\x20=\x20','util','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','agentconnect','bind','syncQueueCallerAbandon','originateresponse','syncAgentComplete','custom:queuesummary','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','\x20INTERVAL_IS_NULL','Interval','Intervals','INTERVAL_IS_NULL','isEmpty','Error','stringify','milliseconds','seconds','emit','type','outbound','strategy','answered','loggedIn','sumBillable','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','md5','voice:queue:%s','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\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---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','ivr','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','variable','amdstatus','exten','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','uniqueid','Machine','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','countmachineretry','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr]','MACHINE','[syncAgentComplete][createHistory][0]','countdropretry','dialGlobalMaxRetry','dialMachineMaxRetry','add','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','endtime','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','calleridname','[syncAgentComplete][createHistory][11]','channel','actionid','locked','stateinterface','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][unlock2]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','interval','content','indexOf','true','iftime\x20%s,%s','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','Queue','dialActive','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','createdAt'];(function(_0xab8573,_0xaec731){var _0x4e2498=function(_0x3e83fb){while(--_0x3e83fb){_0xab8573['push'](_0xab8573['shift']());}};_0x4e2498(++_0xaec731);}(_0x31c2,0x98));var _0x231c=function(_0x32805e,_0x6aed4b){_0x32805e=_0x32805e-0x0;var _0x3fd9cd=_0x31c2[_0x32805e];return _0x3fd9cd;};'use strict';var util=require(_0x231c('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x231c('0x1'));var moment=require(_0x231c('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x231c('0x3'));var ut=require(_0x231c('0x4'));var config=require(_0x231c('0x5'));var logger=require(_0x231c('0x6'))(_0x231c('0x7'));var loggerBooked=require(_0x231c('0x6'))(_0x231c('0x8'));var loggerPredictive=require(_0x231c('0x6'))('predictive');var loggerPredictiveCalls=require(_0x231c('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x231c('0x6'))(_0x231c('0x9'));var ami=require(_0x231c('0xa'));config[_0x231c('0xb')]=_['defaults'](config[_0x231c('0xb')],{'host':_0x231c('0xc'),'port':0x18eb});var io=require(_0x231c('0xd'))(new Redis(config[_0x231c('0xb')]));var cmHopper=require(_0x231c('0xe'));var cmHopperHistory=require(_0x231c('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x231c('0x10'));var Final=require(_0x231c('0x11'));var AgentComplete=require(_0x231c('0x12'));var QueueCallerAbandon=require(_0x231c('0x13'));var Hangup=require(_0x231c('0x14'));var ipAgi=process[_0x231c('0x15')][_0x231c('0x16')]||_0x231c('0x17');var strategy={'rrmemory':_0x231c('0x18'),'roundrobin':_0x231c('0x19')};var Sequence=function(){};Sequence[_0x231c('0x1a')][_0x231c('0x1b')]=function(_0x279884){this[_0x231c('0x1c')]=this['tail']?this[_0x231c('0x1c')][_0x231c('0x1d')](_0x279884):_0x279884();};function Dialer(_0x174f96,_0x4eae58){this[_0x231c('0x1e')]=new Sequence();this['preview']=_0x4eae58;this[_0x231c('0x1f')]=_0x174f96['voiceQueues'];this[_0x231c('0x20')]=_0x174f96['campaigns'];this[_0x231c('0x21')]=_0x174f96[_0x231c('0x21')];this[_0x231c('0x22')]=_0x174f96[_0x231c('0x22')];this[_0x231c('0x23')]=config[_0x231c('0x23')]||0x2;this[_0x231c('0x24')]={};this[_0x231c('0x25')]={};this['contactsId']={};this[_0x231c('0x26')]={};this[_0x231c('0x27')]={};this[_0x231c('0x28')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x231c('0x29')]={};this[_0x231c('0x2a')]={};ami['on'](_0x231c('0x2b'),this['syncAgentConnect'][_0x231c('0x2c')](this));ami['on']('queuecallerabandon',this[_0x231c('0x2d')][_0x231c('0x2c')](this));ami['on'](_0x231c('0x2e'),this['syncOriginateResponse'][_0x231c('0x2c')](this));ami['on']('agentcomplete',this[_0x231c('0x2f')][_0x231c('0x2c')](this));ami['on'](_0x231c('0x30'),this[_0x231c('0x9')][_0x231c('0x2c')](this));ami['on'](_0x231c('0x31'),this[_0x231c('0x32')][_0x231c('0x2c')](this));ami['on'](_0x231c('0x33'),this[_0x231c('0x34')][_0x231c('0x2c')](this));ami['on'](_0x231c('0x35'),this[_0x231c('0x36')][_0x231c('0x2c')](this));ami['on'](_0x231c('0x37'),this[_0x231c('0x38')][_0x231c('0x2c')](this));ami['on'](_0x231c('0x39'),this[_0x231c('0x3a')][_0x231c('0x2c')](this));this[_0x231c('0x3b')]();this[_0x231c('0x3c')]();}function isNotNull(_0x4d5755){return _0x4d5755!==null&&!_[_0x231c('0x3d')](_0x4d5755);}function checkIsLoggedIn(_0x2a4d4d,_0x4585f4){return function(){if(_0x4585f4<=0x0){_0x2a4d4d[_0x231c('0x3e')]=_0x231c('0x3f');throw _0x2a4d4d[_0x231c('0x40')]+_0x231c('0x41');}};}function isActive(_0x114ad2){return _0x114ad2;}function checkIsActive(_0x2063dd,_0x2a6eb1){return function(){if(!isActive(_0x2a6eb1)){_0x2063dd[_0x231c('0x3e')]=_0x231c('0x42');throw _0x2063dd[_0x231c('0x40')]+_0x231c('0x43');}};}function checkInterval(_0x9e02d5){return function(){if(!isNotNull(_0x9e02d5['Interval'])){_0x9e02d5[_0x231c('0x3e')]='INTERVAL_IS_NULL';throw _0x9e02d5[_0x231c('0x40')]+_0x231c('0x44');}if(!isNotNull(_0x9e02d5[_0x231c('0x45')][_0x231c('0x46')])){_0x9e02d5[_0x231c('0x3e')]=_0x231c('0x47');throw _0x9e02d5['name']+_0x231c('0x44');}if(!isNotNull(_[_0x231c('0x48')](_0x9e02d5[_0x231c('0x45')][_0x231c('0x46')]))){_0x9e02d5[_0x231c('0x3e')]=_0x231c('0x47');throw _0x9e02d5[_0x231c('0x40')]+_0x231c('0x44');}};}function msgResponse(_0x515eb8,_0x39d32f,_0x4dc083){return{'action':_0x515eb8,'response':_0x39d32f,'message':_0x4dc083,'stack':_0x4dc083};}function myreject(_0x2d02eb){return function(_0x130f64){return _0x2d02eb(msgResponse('[ifTime][Action]',_0x231c('0x49'),JSON[_0x231c('0x4a')](_0x130f64)));};}function getSeconds(_0x1a8cf4,_0x514fb3){var _0x29dd63=moment(_0x1a8cf4)[_0x231c('0x4b')](0x0);var _0x561104=moment(_0x514fb3)['milliseconds'](0x0);return _0x29dd63['diff'](_0x561104,_0x231c('0x4c'));}function emit(_0x1149fa,_0x569650,_0xb2b8ad){io['to'](_0x1149fa)[_0x231c('0x4d')](_0x569650,_0xb2b8ad);}function emitVoiceQueueSummary(_0x25c828){if(_0x25c828[_0x231c('0x4e')]===_0x231c('0x4f')){var _0x1d40b8={'id':_0x25c828['id'],'name':_0x25c828['name'],'strategy':_0x25c828[_0x231c('0x50')],'answered':_0x25c828[_0x231c('0x51')],'available':_0x25c828['available'],'loggedIn':_0x25c828[_0x231c('0x52')],'pTalking':_0x25c828['pTalking'],'sumBillable':_0x25c828[_0x231c('0x53')],'sumDuration':_0x25c828['sumDuration'],'sumHoldTime':_0x25c828[_0x231c('0x54')]||0x0,'talking':_0x25c828['talking'],'total':_0x25c828[_0x231c('0x55')],'type':_0x25c828['type'],'unmanaged':_0x25c828[_0x231c('0x56')],'abandoned':_0x25c828['abandoned'],'waiting':_0x25c828[_0x231c('0x57')],'loggedInDb':_0x25c828[_0x231c('0x58')],'dialActive':_0x25c828['dialActive'],'dialMethod':_0x25c828[_0x231c('0x59')],'dialOriginateCallerIdName':_0x25c828[_0x231c('0x5a')],'dialOriginateCallerIdNumber':_0x25c828[_0x231c('0x5b')],'dialOriginateTimeout':_0x25c828[_0x231c('0x5c')],'dialPrefix':_0x25c828[_0x231c('0x5d')],'outboundAnswerAgiCallsDay':_0x25c828[_0x231c('0x5e')],'outboundAnswerCallsDay':_0x25c828[_0x231c('0x5f')],'outboundBlacklistCallsDay':_0x25c828['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x25c828[_0x231c('0x60')],'outboundCongestionCallsDay':_0x25c828[_0x231c('0x61')],'outboundDropCallsDayACS':_0x25c828[_0x231c('0x62')],'outboundDropCallsDayCallersExit':_0x25c828['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x25c828[_0x231c('0x63')],'outboundNoAnswerCallsDay':_0x25c828[_0x231c('0x64')],'outboundNoSuchCallsDay':_0x25c828[_0x231c('0x65')],'outboundOriginateFailureCallsDay':_0x25c828[_0x231c('0x66')],'outboundReCallsDay':_0x25c828[_0x231c('0x67')],'outboundRejectCallsDay':_0x25c828[_0x231c('0x68')],'outboundUnknownCallsDay':_0x25c828[_0x231c('0x69')],'predictiveIntervalAnsweredCalls':_0x25c828[_0x231c('0x6a')],'predictiveIntervalAvgHoldtime':_0x25c828[_0x231c('0x6b')],'predictiveIntervalAvgTalktime':_0x25c828[_0x231c('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x25c828[_0x231c('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x25c828[_0x231c('0x6e')],'predictiveIntervalErlangCalls':_0x25c828[_0x231c('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x25c828['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x25c828[_0x231c('0x70')],'predictiveIntervalMultiplicativeFactor':_0x25c828[_0x231c('0x71')],'predictiveIntervalPauses':_0x25c828['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x25c828['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x25c828[_0x231c('0x72')],'message':_0x25c828[_0x231c('0x3e')],'originated':_0x25c828[_0x231c('0x73')],'erlangCalls':_0x25c828['erlangCalls'],'erlangCallToSecond':_0x25c828[_0x231c('0x74')],'erlangAbandonmentRate':_0x25c828[_0x231c('0x75')],'erlangBusyFactor':_0x25c828[_0x231c('0x76')],'startPredictive':_0x25c828[_0x231c('0x28')],'startProgressive':_0x25c828[_0x231c('0x77')]};if(_0x25c828[_0x231c('0x78')]){_0x1d40b8[_0x231c('0x78')]={'id':_0x25c828[_0x231c('0x78')]['id'],'name':_0x25c828[_0x231c('0x78')][_0x231c('0x40')],'active':_0x25c828[_0x231c('0x78')][_0x231c('0x79')],'callerid':_0x25c828[_0x231c('0x78')][_0x231c('0x7a')]};}if(_0x25c828[_0x231c('0x45')]){_0x1d40b8[_0x231c('0x45')]={'id':_0x25c828['Interval']['id'],'name':_0x25c828[_0x231c('0x45')][_0x231c('0x40')]};}var _0xbb4772=md5(JSON[_0x231c('0x4a')](_0x1d40b8));if(_0x25c828[_0x231c('0x7b')]!==_0xbb4772){_0x25c828[_0x231c('0x7b')]=_0xbb4772;emit(util['format'](_0x231c('0x7c'),_0x1d40b8[_0x231c('0x40')]),'voice_queue:save',_0x1d40b8);}}}function emitCampaignSummary(_0x35ae00){if(_0x35ae00[_0x231c('0x4e')]==='ivr'){emit(util['format'](_0x231c('0x7d'),_0x35ae00['name']),_0x231c('0x7e'),_0x35ae00);}}function checkGetDataPredictive(_0x1bc680){if(isNotNull(_0x1bc680)&&!_[_0x231c('0x48')](_0x1bc680)){loggerPredictive[_0x231c('0x7f')](_0x231c('0x80'));loggerPredictive[_0x231c('0x7f')](_0x231c('0x81'),_0x1bc680[_0x231c('0x72')]);loggerPredictive[_0x231c('0x7f')](_0x231c('0x82'),_0x1bc680[_0x231c('0x6a')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bc680['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x231c('0x83'),_0x1bc680[_0x231c('0x6d')]);loggerPredictive[_0x231c('0x7f')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bc680[_0x231c('0x6b')]);loggerPredictive[_0x231c('0x7f')](_0x231c('0x84'),_0x1bc680[_0x231c('0x6c')]);loggerPredictive['info'](_0x231c('0x85'));if(_0x1bc680[_0x231c('0x72')]>0x0){if(!_[_0x231c('0x3d')](_0x1bc680[_0x231c('0x6c')])&&_0x1bc680[_0x231c('0x6c')]>0x0){return!![];}loggerPredictive[_0x231c('0x7f')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x231c('0x3d')](_0x1bc680[_0x231c('0x6b')])&&_0x1bc680[_0x231c('0x6b')]>0x0){return!![];}loggerPredictive['info'](_0x231c('0x86'));}else{loggerPredictive[_0x231c('0x7f')](_0x231c('0x87'));}}else{loggerPredictive[_0x231c('0x7f')](_0x231c('0x88'));}return![];}function mergeDataErlangB(_0x45a2dd){return function(_0x59739a){loggerPredictive[_0x231c('0x7f')](_0x231c('0x89'));loggerPredictive[_0x231c('0x7f')](_0x231c('0x8a'),_0x59739a[_0x231c('0x8b')]);loggerPredictive[_0x231c('0x7f')](_0x231c('0x8c'),_0x59739a[_0x231c('0x74')]);loggerPredictive[_0x231c('0x7f')](_0x231c('0x8d'),_0x59739a['erlangAbandonmentRate']);loggerPredictive[_0x231c('0x7f')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59739a[_0x231c('0x76')]);loggerPredictive['info'](_0x231c('0x8d'),_0x59739a[_0x231c('0x75')]);loggerPredictive[_0x231c('0x7f')]('---------------------------');_[_0x231c('0x8e')](_0x45a2dd,_0x59739a);};}function getDiff(_0x115800){var _0x27efd2=moment()['milliseconds'](0x0);var _0x59997a=moment(_0x115800)[_0x231c('0x4b')](0x0);return _0x27efd2['diff'](_0x59997a,'seconds');}function ifInterval(_0x2bd2c1,_0x275f6e){if(_[_0x231c('0x3d')](_0x275f6e)){return![];}return getDiff(_0x275f6e)<_0x2bd2c1*0x3c;}function freeVariablesPredictive(_0x1f1d4d){if(isNotNull(_0x1f1d4d)){if(!_[_0x231c('0x3d')](_0x1f1d4d[_0x231c('0x77')])){_0x1f1d4d[_0x231c('0x77')]=undefined;loggerPredictive[_0x231c('0x7f')](_0x1f1d4d[_0x231c('0x40')],_0x231c('0x8f'));}if(!_[_0x231c('0x3d')](_0x1f1d4d[_0x231c('0x28')])){_0x1f1d4d[_0x231c('0x28')]=undefined;loggerPredictive[_0x231c('0x7f')](_0x1f1d4d[_0x231c('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x231c('0x3d')](_0x1f1d4d[_0x231c('0x90')])){clearInterval(_0x1f1d4d[_0x231c('0x90')]);_0x1f1d4d[_0x231c('0x90')]=undefined;loggerPredictive[_0x231c('0x7f')](_0x1f1d4d[_0x231c('0x40')],_0x231c('0x91'));}}}function erlangb(_0x314b81,_0x41dd88){if(_0x41dd88===0x0){return 0x0;}var _0x1cfce8=0x1;for(var _0xc5924a=0x1;_0xc5924a<=_0x41dd88;_0xc5924a+=0x1){_0x1cfce8=0x1+_0x1cfce8*_0xc5924a/_0x314b81;}return 0x1/_0x1cfce8;}function isVoiceQueueOutbound(_0x47f107){return _0x47f107===_0x231c('0x4f');}function isNotPreview(_0x12bd8b){return _0x12bd8b!==_0x231c('0x92');}function isCampaignIvr(_0x30b3b2){return _0x30b3b2===_0x231c('0x93');}function getCallerId(_0x422df5,_0x41ec07,_0x2a523c){if(!_[_0x231c('0x3d')](_0x2a523c)&&typeof _0x2a523c===_0x231c('0x94')&&!_[_0x231c('0x48')](_0x2a523c)){if(!_[_0x231c('0x3d')](_0x41ec07)&&typeof _0x41ec07===_0x231c('0x94')&&!_['isEmpty'](_0x41ec07)){return util[_0x231c('0x95')](_0x231c('0x96'),_0x41ec07,_0x2a523c);}return util[_0x231c('0x95')](_0x231c('0x96'),_0x2a523c,_0x2a523c);}if(!_[_0x231c('0x3d')](_0x422df5)&&typeof _0x422df5===_0x231c('0x94')&&!_[_0x231c('0x48')](_0x422df5)){return _0x422df5;}return _0x231c('0x97');}function loggerCatchQueueSummary(_0x491a4f,_0x13154f){return function(_0xda6920){freeVariablesPredictive(_0x13154f);emitVoiceQueueSummary(_0x13154f);emitCampaignSummary(_0x13154f);loggerSyncQueueSummary['error'](_0x491a4f,util[_0x231c('0x98')](_0xda6920,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x6386ed,_0x47a79f){return function(_0x29cbe8){loggerPredictive['error'](_0x47a79f[_0x231c('0x40')],_0x6386ed);loggerPredictive['error'](_0x29cbe8['stack']);freeVariablesPredictive(_0x47a79f);};}function loggerCatch(_0x33e158){return function(_0x2b6d64){logger[_0x231c('0x99')](_0x33e158,util[_0x231c('0x98')](_0x2b6d64,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x20728a){return _0x20728a&&!_[_0x231c('0x3d')](_0x20728a)&&_0x20728a[_0x231c('0x9a')]>0x0;}function decremetOriginate(_0x99184e){if(!_[_0x231c('0x3d')](_0x99184e)&&_0x99184e!==null){if(typeof _0x99184e['originated']!==_0x231c('0x9b')){if(_0x99184e['originated']>0x0){_0x99184e[_0x231c('0x73')]-=0x1;}else{logger[_0x231c('0x99')](_0x231c('0x9c'));}}}else{logger[_0x231c('0x99')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x28d382,_0x37d71b,_0x413ff8){if(_0x37d71b>_0x413ff8){for(var _0x37af80=0x0;_0x37af80<_0x37d71b-_0x413ff8;_0x37af80+=0x1){decremetOriginate(_0x28d382);}}}function loggerGetContactDialer(_0x4a3d91,_0x5c6f40,_0x2aa2b6){return function(_0x16c918){checkContactLowerLimitOriginate(_0x5c6f40,_0x2aa2b6,0x0);logger[_0x231c('0x99')](_0x4a3d91,util[_0x231c('0x98')](_0x16c918,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x368a80){return function(_0x461058){if(isNotNull(_0x461058)&&isNotNull(_0x461058[0x0])){if(_0x461058[0x0]['contactsRescheduled']>0x0){_0x368a80[_0x231c('0x3e')]='RESCHEDULED_CONTACTS';logger['info'](_0x231c('0x9d')+_0x368a80[_0x231c('0x40')],_0x461058[0x0][_0x231c('0x9e')],_0x231c('0x9f'));}else{_0x368a80[_0x231c('0x3e')]=_0x231c('0xa0');logger['info'](_0x231c('0xa1')+_0x368a80[_0x231c('0x40')]);}}};}function notSendMessagesQueue(_0x67efe6){if(_0x67efe6[_0x231c('0xa2')]){freeVariablesPredictive(_0x67efe6);if(_0x67efe6[_0x231c('0x73')]===0x0&&_0x67efe6[_0x231c('0xa3')]===0x0&&_0x67efe6[_0x231c('0x57')]===0x0&&(_0x67efe6[_0x231c('0xa4')]||0x0)===0x0){_0x67efe6['sendMessageOneNotActive']=![];_0x67efe6['available']=0x0;_0x67efe6['message']=_0x231c('0x42');loggerSyncQueueSummary[_0x231c('0x99')](_0x231c('0xa5'),_0x67efe6['name'],_0x231c('0xa6'));}else{_0x67efe6[_0x231c('0x3e')]=_0x231c('0xa7');loggerSyncQueueSummary[_0x231c('0x99')](_0x231c('0xa5'),_0x67efe6[_0x231c('0x40')],'is\x20disactive');}emitVoiceQueueSummary(_0x67efe6);}}function notSendMessagesCampaign(_0x1b7402){if(_0x1b7402['sendMessageOneNotActive']){if(_0x1b7402[_0x231c('0x73')]===0x0){_0x1b7402[_0x231c('0xa2')]=![];_0x1b7402[_0x231c('0x3e')]=_0x231c('0x42');loggerSyncQueueSummary[_0x231c('0x99')](_0x231c('0xa8'),_0x1b7402[_0x231c('0x40')],'is\x20not\x20active');}else{_0x1b7402[_0x231c('0x3e')]=_0x231c('0xa7');loggerSyncQueueSummary[_0x231c('0x99')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1b7402[_0x231c('0x40')],'is\x20disactive');}emitCampaignSummary(_0x1b7402);}}function createObjHistory(_0x449e17,_0x156343,_0x357d20,_0x249956,_0x21831b){_0x449e17['message']=_0x357d20;var _0x40d4bf=new Action(_0x449e17,_0x156343);var _0x4f6485=new History(_0x40d4bf);_0x4f6485[_0x231c('0xa9')]=_0x249956;_0x4f6485[_0x231c('0xaa')]=_0x21831b;_0x4f6485['endtime']=_0x40d4bf['starttime'];return _0x4f6485;}Dialer[_0x231c('0x1a')][_0x231c('0x3c')]=function(){var _0x2d686d=this;setInterval(function(){_0x2d686d[_0x231c('0xab')](_0x2d686d[_0x231c('0x26')],_0x231c('0xac'));_0x2d686d[_0x231c('0xab')](_0x2d686d['actions'],_0x231c('0xad'));},0x32c8);};Dialer[_0x231c('0x1a')][_0x231c('0xab')]=function(_0x535644,_0x29298c){var _0xf033ed=this;for(var _0x1a82ca in _0x535644){if(typeof _0x535644[_0x1a82ca]!==_0x231c('0x9b')){this[_0x231c('0x1e')][_0x231c('0x1b')](function(){if(!_[_0x231c('0xae')](_0x535644[_0x1a82ca])){return ami[_0x231c('0xaf')]({'action':_0x231c('0xb0'),'channel':_0x535644[_0x1a82ca]['channel']})[_0x231c('0xb1')](function(_0x4acabf){if(_0x4acabf[_0x231c('0x3e')]===_0x231c('0xb2')){setTimeout(function(){if(_0x535644[_0x1a82ca]&&_0x535644[_0x1a82ca][_0x231c('0x4e')]!==_0x231c('0x93')){_0xf033ed[_0x231c('0xb3')](_0xf033ed[_0x231c('0x1f')][_0x535644[_0x1a82ca][_0x231c('0xb4')]]);logger[_0x231c('0x99')](_0x231c('0xb5'),_0x29298c,_0x1a82ca,_0x535644[_0x1a82ca][_0x231c('0xb4')]);delete _0x535644[_0x1a82ca];}if(_0x535644[_0x1a82ca]&&_0x535644[_0x1a82ca]['type']===_0x231c('0x93')){_0xf033ed[_0x231c('0xb3')](_0xf033ed[_0x231c('0x20')][_0x535644[_0x1a82ca][_0x231c('0xb4')]]);logger[_0x231c('0x99')](_0x231c('0xb6'),_0x29298c,_0x1a82ca,_0x535644[_0x1a82ca][_0x231c('0xb4')]);delete _0x535644[_0x1a82ca];}},0x2328);}});}});}}};Dialer[_0x231c('0x1a')]['countReScheduled']=function(_0x4eb52d){return BPromise['resolve']()[_0x231c('0xb7')](cmHopper[_0x231c('0xb8')](_0x4eb52d))[_0x231c('0xb1')](loggerCatch(_0x231c('0xb9')));};Dialer[_0x231c('0x1a')][_0x231c('0xba')]=function(_0x5a6a35){return BPromise[_0x231c('0xbb')]()['then'](cmHopperBlack[_0x231c('0xba')](_0x5a6a35))[_0x231c('0xb1')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x231c('0x1a')][_0x231c('0xbc')]=function(_0x38208f){return BPromise[_0x231c('0xbb')]()[_0x231c('0xb7')](cmHopperBlack['checkIsBlackListIvr'](_0x38208f))[_0x231c('0xb1')](loggerCatch(_0x231c('0xbd')));};Dialer[_0x231c('0x1a')][_0x231c('0xbe')]=function(_0x2ca1cd){return BPromise['resolve']()[_0x231c('0xb7')](cmHopperHistory[_0x231c('0xbf')](_0x2ca1cd))[_0x231c('0xb1')](loggerCatch(_0x231c('0xc0')));};Dialer[_0x231c('0x1a')][_0x231c('0xc1')]=function(_0xd9c035){return BPromise[_0x231c('0xbb')]()[_0x231c('0xb7')](cmHopper[_0x231c('0xc1')](_0xd9c035))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x231c('0x1a')][_0x231c('0xc2')]=function(_0x59c7f2,_0x25bcfb,_0x3a8b17){return BPromise[_0x231c('0xbb')]()[_0x231c('0xb7')](cmHopper[_0x231c('0xc2')](_0x59c7f2,_0x25bcfb,_0x3a8b17))[_0x231c('0xb1')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x231c('0x1a')][_0x231c('0xc3')]=function(_0x3cf61f,_0x40a68c,_0x9043a6,_0x1269d5,_0x172b77){return BPromise[_0x231c('0xbb')]()[_0x231c('0xb7')](cmHopper[_0x231c('0xc3')](_0x3cf61f,_0x40a68c,_0x9043a6,_0x1269d5))[_0x231c('0xb1')](function(_0x3fce48){_0x172b77[_0x231c('0xc4')]-=_0x9043a6;_0x172b77[_0x231c('0xc4')]=_0x172b77[_0x231c('0xc4')]>0x0?_0x172b77[_0x231c('0xc4')]:0x0;loggerCatch(_0x231c('0xc5'))(_0x3fce48);});};Dialer[_0x231c('0x1a')][_0x231c('0xc6')]=function(_0x491060,_0x548aa4,_0x44270c,_0x17614d){return BPromise[_0x231c('0xbb')]()[_0x231c('0xb7')](cmHopper['getContactDialerIvr'](_0x491060,_0x548aa4,_0x44270c))[_0x231c('0xb1')](function(_0xf15b38){_0x17614d['temp']-=_0x548aa4;_0x17614d[_0x231c('0xc4')]=_0x17614d[_0x231c('0xc4')]>0x0?_0x17614d['temp']:0x0;loggerCatch(_0x231c('0xc7'))(_0xf15b38);});};Dialer[_0x231c('0x1a')][_0x231c('0xc8')]=function(_0x25dfb9){return BPromise[_0x231c('0xbb')]()[_0x231c('0xb7')](voiceQueueRt[_0x231c('0xc8')](_0x25dfb9))[_0x231c('0xb1')](loggerCatch(_0x231c('0xc9')));};Dialer[_0x231c('0x1a')]['moveContactManagedDialer']=function(_0x46f1a0){return BPromise[_0x231c('0xbb')]()[_0x231c('0xb7')](cmHopper[_0x231c('0xca')](_0x46f1a0))[_0x231c('0xb1')](loggerCatch(_0x231c('0xcb')));};Dialer['prototype'][_0x231c('0xcc')]=function(_0x4f78f0){return BPromise[_0x231c('0xbb')]()['then'](cmHopperHistory[_0x231c('0xcc')](_0x4f78f0))[_0x231c('0xb1')](loggerCatch('[createHistory]\x20'));};Dialer[_0x231c('0x1a')]['updateOriginated']=function(_0x27950f){if(!_[_0x231c('0x3d')](_0x27950f)&&_0x27950f!==null){if(typeof _0x27950f[_0x231c('0x73')]!=='undefined'){if(_0x27950f[_0x231c('0x73')]>0x0){_0x27950f[_0x231c('0x73')]-=0x1;}else{logger[_0x231c('0x99')](_0x231c('0xcd'));}}}else{logger[_0x231c('0x99')](_0x231c('0xce'));}};Dialer[_0x231c('0x1a')][_0x231c('0xcf')]=function(_0x18960c,_0x46b078){var _0x5e8453=this;return function(_0x522e30){_0x5e8453[_0x231c('0xb3')](_0x46b078);logger[_0x231c('0x99')](_0x18960c,util[_0x231c('0x98')](_0x522e30,{'showHidden':![],'depth':null}));};};Dialer[_0x231c('0x1a')][_0x231c('0xd0')]=function(_0x275483,_0x48e7be,_0x299af8){var _0x3983ef={'state':0x19,'statedesc':_0x231c('0xd1')};this[_0x231c('0xb3')](_0x48e7be);this[_0x231c('0xd2')](_[_0x231c('0x8e')](_0x3983ef,_[_0x231c('0xd3')](_0x299af8,[_0x231c('0xd4'),_0x231c('0xd5'),_0x231c('0xd6'),_0x231c('0xd7'),'CampaignId'])),'[emptyContact][createHistory]',_0x231c('0xd8'));logger[_0x231c('0x99')](_0x275483);};Dialer[_0x231c('0x1a')][_0x231c('0xd9')]=function(_0x400807){return _0x400807===_0x231c('0xda');};Dialer[_0x231c('0x1a')][_0x231c('0xdb')]=function(_0x388292){return!_[_0x231c('0x3d')](_0x388292)&&_0x388292&&!_[_0x231c('0x3d')](_0x388292[_0x231c('0x40')])&&!_[_0x231c('0x3d')](_0x388292['active'])&&_0x388292[_0x231c('0x79')]&&(this[_0x231c('0x22')][util['format'](_0x231c('0xdc'),_0x388292[_0x231c('0x40')])]['status']===_0x231c('0xdd')||this[_0x231c('0x22')][util['format'](_0x231c('0xdc'),_0x388292[_0x231c('0x40')])]['status']===_0x231c('0xde'));};Dialer[_0x231c('0x1a')][_0x231c('0xd2')]=function(_0x1d32e4,_0x1cba5f,_0x885443){this[_0x231c('0xcc')](_0x1d32e4)[_0x231c('0xb1')](loggerCatch(_0x1cba5f));this[_0x231c('0xca')](_0x1d32e4)[_0x231c('0xb1')](loggerCatch(_0x885443));};Dialer['prototype'][_0x231c('0x36')]=function(_0x233575){var _0x47aa90=this['uniqueId'][_0x233575['uniqueid']];var _0x4a07b8;if(!_['isNil'](_0x233575)&&!_[_0x231c('0xae')](_0x233575['variable'])&&!_[_0x231c('0xae')](_0x233575[_0x231c('0xdf')][_0x231c('0xe0')])&&_0x233575[_0x231c('0xe1')]==='xcally-motion-dialer'&&_0x47aa90){if(_0x47aa90['type']!==_0x231c('0x93')&&this[_0x231c('0x1f')][_0x47aa90[_0x231c('0xb4')]][_0x231c('0xe2')]&&_0x233575[_0x231c('0xe3')]===_0x231c('0xe4')){delete this[_0x231c('0x26')][_0x233575['uniqueid']];this[_0x231c('0xb3')](this[_0x231c('0x1f')][_0x47aa90[_0x231c('0xb4')]]);this[_0x231c('0x1f')][_0x47aa90[_0x231c('0xb4')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x47aa90[_0x231c('0xb4')]][_0x231c('0x5e')]+=0x1;_0x4a07b8=new Hangup(_0x47aa90,_0x233575);_0x4a07b8[_0x231c('0xa9')]=0x12;_0x4a07b8[_0x231c('0xaa')]=_0x231c('0xe5');_0x4a07b8[_0x231c('0xe6')]=_0x231c('0xe7');ami[_0x231c('0x4d')]('custom:amd',ut[_0x231c('0xe8')](_0x4a07b8,_0x231c('0xe9')));this['saveInDb'](_0x4a07b8,_0x231c('0xea'),'[syncHangupInAMD]');}if(_0x47aa90[_0x231c('0x4e')]!==_0x231c('0x93')&&this[_0x231c('0x1f')][_0x47aa90[_0x231c('0xb4')]][_0x231c('0xe2')]&&_0x233575['value']==='MACHINE'){var _0x50d92b=this;return new BPromise(function(_0x3aa10b,_0xe7be5d){delete _0x50d92b[_0x231c('0x26')][_0x233575[_0x231c('0xeb')]];_0x50d92b['updateOriginated'](_0x50d92b['voiceQueues'][_0x47aa90[_0x231c('0xb4')]]);_0x50d92b[_0x231c('0x1f')][_0x47aa90[_0x231c('0xb4')]][_0x231c('0x5f')]+=0x1;_0x50d92b[_0x231c('0x1f')][_0x47aa90['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x29429a=_0x50d92b[_0x231c('0x1f')][_0x47aa90[_0x231c('0xb4')]];var _0x363c55=new Hangup(_0x47aa90,_0x233575);_0x363c55[_0x231c('0xa9')]=0x13;_0x363c55[_0x231c('0xaa')]=_0x231c('0xec');_0x363c55[_0x231c('0xe6')]=_0x231c('0xe7');_0x363c55['countmachineretry']+=0x1;_0x363c55[_0x231c('0xed')]+=0x1;_0x363c55[_0x231c('0xe9')]=!![];ami[_0x231c('0x4d')]('custom:amd',ut[_0x231c('0xe8')](_0x363c55,'amd'));_0x50d92b[_0x231c('0xcc')](_0x363c55)[_0x231c('0xb1')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x363c55[_0x231c('0xee')]+_0x363c55[_0x231c('0xef')]+_0x363c55[_0x231c('0xf0')]+_0x363c55[_0x231c('0xf1')]+_0x363c55['countdropretry']+_0x363c55[_0x231c('0xf2')]+_0x363c55['countmachineretry']+_0x363c55[_0x231c('0xf3')]>=_0x29429a['dialGlobalMaxRetry']){_0x50d92b[_0x231c('0xf4')](_0x363c55,_0x3aa10b,_0xe7be5d,_0x231c('0xf5'));}else{if(_0x363c55['countmachineretry']>=_0x29429a['dialMachineMaxRetry']){_0x50d92b[_0x231c('0xf6')](_0x363c55,_0x3aa10b,_0xe7be5d,_0x231c('0xf7'));}else{_0x50d92b['rescheduleContact']({'active':![],'countmachineretry':_0x363c55[_0x231c('0xf8')],'scheduledat':moment()['add'](_0x29429a[_0x231c('0xf9')],_0x231c('0xfa'))[_0x231c('0x95')](_0x231c('0xfb')),'ContactId':_0x363c55[_0x231c('0xd4')],'ListId':_0x363c55[_0x231c('0xd5')],'VoiceQueueId':_0x363c55[_0x231c('0xd7')]||undefined,'CampaignId':_0x363c55[_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0xfd')));_0x3aa10b({'reschedule':0x1});}}});}if(_0x47aa90[_0x231c('0x4e')]===_0x231c('0x93')&&this[_0x231c('0x20')][_0x47aa90[_0x231c('0xb4')]][_0x231c('0xe2')]&&_0x233575[_0x231c('0xe3')]==='HANGUP'){delete this[_0x231c('0x26')][_0x233575[_0x231c('0xeb')]];this[_0x231c('0xb3')](this[_0x231c('0x20')][_0x47aa90[_0x231c('0xb4')]]);_0x4a07b8=new Hangup(_0x47aa90,_0x233575);_0x4a07b8['state']=0x12;_0x4a07b8['statedesc']=_0x231c('0xe5');_0x4a07b8[_0x231c('0xe6')]='AMD';ami['emit'](_0x231c('0xfe'),ut[_0x231c('0xe8')](_0x4a07b8,_0x231c('0xe9')));this[_0x231c('0xd2')](_0x4a07b8,'[syncHangupInAMDIvr][createHistory]',_0x231c('0xff'));}if(_0x47aa90['type']===_0x231c('0x93')&&this[_0x231c('0x20')][_0x47aa90['queue']][_0x231c('0xe2')]&&_0x233575[_0x231c('0xe3')]===_0x231c('0x100')){var _0x50d92b=this;return new BPromise(function(_0x4ef975,_0x45bb64){delete _0x50d92b['uniqueId'][_0x233575['uniqueid']];_0x50d92b['updateOriginated'](_0x50d92b[_0x231c('0x20')][_0x47aa90[_0x231c('0xb4')]]);_0x50d92b[_0x231c('0x20')][_0x47aa90[_0x231c('0xb4')]][_0x231c('0x5f')]+=0x1;_0x50d92b['campaigns'][_0x47aa90[_0x231c('0xb4')]][_0x231c('0x5e')]+=0x1;var _0x36de86=_0x50d92b[_0x231c('0x20')][_0x47aa90[_0x231c('0xb4')]];var _0x30bec5=new Hangup(_0x47aa90,_0x233575);_0x30bec5[_0x231c('0xa9')]=0x13;_0x30bec5[_0x231c('0xaa')]=_0x231c('0xec');_0x30bec5[_0x231c('0xe6')]=_0x231c('0xe7');_0x30bec5[_0x231c('0xf8')]+=0x1;_0x30bec5[_0x231c('0xed')]+=0x1;_0x30bec5['amd']=!![];ami[_0x231c('0x4d')](_0x231c('0xfe'),ut[_0x231c('0xe8')](_0x30bec5,_0x231c('0xe9')));_0x50d92b[_0x231c('0xcc')](_0x30bec5)[_0x231c('0xb1')](loggerCatch(_0x231c('0x101')));if(_0x30bec5[_0x231c('0xee')]+_0x30bec5[_0x231c('0xef')]+_0x30bec5[_0x231c('0xf0')]+_0x30bec5[_0x231c('0xf1')]+_0x30bec5[_0x231c('0x102')]+_0x30bec5[_0x231c('0xf2')]+_0x30bec5['countmachineretry']+_0x30bec5[_0x231c('0xf3')]>=_0x36de86[_0x231c('0x103')]){_0x50d92b[_0x231c('0xf4')](_0x30bec5,_0x4ef975,_0x45bb64,_0x231c('0xf5'));}else{if(_0x30bec5[_0x231c('0xf8')]>=_0x36de86[_0x231c('0x104')]){_0x50d92b[_0x231c('0xf6')](_0x30bec5,_0x4ef975,_0x45bb64,_0x231c('0xf7'));}else{_0x50d92b[_0x231c('0xc1')]({'active':![],'countmachineretry':_0x30bec5[_0x231c('0xf8')],'scheduledat':moment()[_0x231c('0x105')](_0x36de86[_0x231c('0xf9')],_0x231c('0xfa'))[_0x231c('0x95')](_0x231c('0xfb')),'ContactId':_0x30bec5['ContactId'],'ListId':_0x30bec5[_0x231c('0xd5')],'VoiceQueueId':_0x30bec5[_0x231c('0xd7')]||undefined,'CampaignId':_0x30bec5[_0x231c('0xfc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x4ef975({'reschedule':0x1});}}});}}};Dialer[_0x231c('0x1a')][_0x231c('0x32')]=function(_0x41c153){var _0x570a46=this['uniqueId'][_0x41c153[_0x231c('0xeb')]];var _0x39dc75=this;var _0xa97ae2;if(_0x570a46&&_0x570a46[_0x231c('0x4e')]===_0x231c('0x93')){delete this[_0x231c('0x26')][_0x41c153['uniqueid']];this[_0x231c('0xb3')](this['campaigns'][_0x570a46['queue']]);this[_0x231c('0x20')][_0x570a46[_0x231c('0xb4')]][_0x231c('0x106')]+=0x1;_0xa97ae2=new Hangup(_0x570a46,_0x41c153);this[_0x231c('0xcc')](_0xa97ae2)[_0x231c('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x231c('0xca')](_0xa97ae2)[_0x231c('0xb1')](loggerCatch(_0x231c('0x107')));}if(_0x570a46&&_0x570a46[_0x231c('0x4e')]!==_0x231c('0x93')&&isNotNull(this[_0x231c('0x1f')][_0x570a46['queue']][_0x231c('0x108')])){delete this[_0x231c('0x26')][_0x41c153[_0x231c('0xeb')]];this[_0x231c('0xb3')](this[_0x231c('0x1f')][_0x570a46[_0x231c('0xb4')]]);this[_0x231c('0x1f')][_0x570a46[_0x231c('0xb4')]][_0x231c('0x5f')]+=0x1;this['voiceQueues'][_0x570a46[_0x231c('0xb4')]][_0x231c('0x5e')]+=0x1;_0xa97ae2=new Hangup(_0x570a46,_0x41c153);_0xa97ae2[_0x231c('0xa9')]=0x10;_0xa97ae2[_0x231c('0xaa')]=_0x231c('0x109');_0xa97ae2[_0x231c('0xe6')]=_0x231c('0x10a');this[_0x231c('0xcc')](_0xa97ae2)[_0x231c('0xb1')](loggerCatch(_0x231c('0x10b')));this[_0x231c('0xca')](_0xa97ae2)[_0x231c('0xb1')](loggerCatch(_0x231c('0x107')));}if(_0x570a46&&_0x570a46['type']!==_0x231c('0x93')&&!isNotNull(this['voiceQueues'][_0x570a46['queue']][_0x231c('0x108')])){delete this[_0x231c('0x26')][_0x41c153[_0x231c('0xeb')]];this[_0x231c('0xb3')](this[_0x231c('0x1f')][_0x570a46[_0x231c('0xb4')]]);this[_0x231c('0x1f')][_0x570a46[_0x231c('0xb4')]][_0x231c('0x69')]+=0x1;_0xa97ae2=new Hangup(_0x570a46,_0x41c153);_0xa97ae2[_0x231c('0xa9')]=0xc;_0xa97ae2['statedesc']=_0x41c153[_0x231c('0x10c')];_0xa97ae2['membername']=_0x231c('0x10d');this[_0x231c('0xcc')](_0xa97ae2)[_0x231c('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x231c('0xca')](_0xa97ae2)[_0x231c('0xb1')](loggerCatch(_0x231c('0x107')));}};Dialer[_0x231c('0x1a')][_0x231c('0x2f')]=function(_0x215a4a){var _0x3eaf50=this['uniqueId'][_0x215a4a[_0x231c('0xeb')]];var _0x2c4fea=this;if(this[_0x231c('0x1f')][_0x215a4a[_0x231c('0xb4')]]){if(_0x3eaf50&&_0x3eaf50[_0x231c('0x4e')]!=='ivr'){delete this['uniqueId'][_0x215a4a[_0x231c('0xeb')]];this[_0x231c('0x1f')][_0x215a4a['queue']][_0x231c('0x5f')]+=0x1;var _0x386c09=new AgentComplete(_0x3eaf50,_0x215a4a);if(_0x215a4a[_0x231c('0x10e')]===_0x231c('0x10f')){_0x386c09[_0x231c('0x110')]=this['voiceQueues'][_0x215a4a[_0x231c('0xb4')]]['dialQueueProject2']&&this[_0x231c('0x1f')][_0x215a4a[_0x231c('0xb4')]][_0x231c('0x111')]?moment()[_0x231c('0x95')](_0x231c('0xfb')):undefined;}this['createHistory'](_0x386c09)['catch'](loggerCatch(_0x231c('0x112')));this[_0x231c('0xca')](_0x386c09)[_0x231c('0xb1')](loggerCatch(_0x231c('0x113')));}}};Dialer[_0x231c('0x1a')][_0x231c('0x114')]=function(_0x1b89c0){if(this[_0x231c('0x1f')][_0x1b89c0[_0x231c('0xb4')]]){if(this['uniqueId'][_0x1b89c0[_0x231c('0xeb')]]&&this['uniqueId'][_0x1b89c0[_0x231c('0xeb')]][_0x231c('0x4e')]!==_0x231c('0x93')){this[_0x231c('0xb3')](this[_0x231c('0x1f')][_0x1b89c0['queue']]);this['uniqueId'][_0x1b89c0[_0x231c('0xeb')]][_0x231c('0x115')]=moment()[_0x231c('0x95')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x231c('0x1a')][_0x231c('0x116')]=function(_0x4a1574){this[_0x231c('0xcc')](_0x4a1574)[_0x231c('0xb1')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x231c('0xca')](_0x4a1574)['catch'](loggerCatch(_0x231c('0x117')));};Dialer['prototype'][_0x231c('0x2d')]=function(_0x1e6ea1){var _0x4aeb21=this[_0x231c('0x26')][_0x1e6ea1['uniqueid']];var _0x555ffd=this;if(this[_0x231c('0x1f')][_0x1e6ea1[_0x231c('0xb4')]]){if(_0x4aeb21&&_0x4aeb21[_0x231c('0x4e')]!==_0x231c('0x93')){delete this[_0x231c('0x26')][_0x1e6ea1[_0x231c('0xeb')]];this[_0x231c('0xb3')](this[_0x231c('0x1f')][_0x1e6ea1['queue']]);_0x4aeb21[_0x231c('0x118')]=moment()[_0x231c('0x95')](_0x231c('0xfb'));var _0x337e45=new QueueCallerAbandon(_0x4aeb21,_0x1e6ea1);if(getSeconds(_0x4aeb21[_0x231c('0x118')],_0x4aeb21['responsetime'])>=_0x4aeb21[_0x231c('0x119')]){this[_0x231c('0x1f')][_0x1e6ea1[_0x231c('0xb4')]][_0x231c('0x6e')]+=0x1;this[_0x231c('0x1f')][_0x1e6ea1['queue']][_0x231c('0x63')]+=0x1;this[_0x231c('0x1f')][_0x1e6ea1[_0x231c('0xb4')]][_0x231c('0x11a')]+=0x1;_0x337e45[_0x231c('0xa9')]=0xa;_0x337e45['statedesc']=_0x231c('0x11b');_0x337e45[_0x231c('0x11c')]=_0x231c('0x11d');_0x337e45[_0x231c('0x110')]=this[_0x231c('0x1f')][_0x1e6ea1[_0x231c('0xb4')]]['dialQueueProject2']?moment()[_0x231c('0x95')](_0x231c('0xfb')):undefined;_0x337e45[_0x231c('0x102')]+=0x1;_0x337e45[_0x231c('0xed')]+=0x1;if(_0x337e45[_0x231c('0x102')]>=this[_0x231c('0x1f')][_0x1e6ea1[_0x231c('0xb4')]]['dialDropMaxRetry']){this[_0x231c('0x116')](_0x337e45);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x337e45[_0x231c('0x102')],'scheduledat':moment()[_0x231c('0x105')](this[_0x231c('0x1f')][_0x1e6ea1[_0x231c('0xb4')]][_0x231c('0x11e')],'minutes')[_0x231c('0x95')](_0x231c('0xfb')),'ContactId':_0x4aeb21[_0x231c('0xd4')],'ListId':_0x4aeb21[_0x231c('0xd5')],'VoiceQueueId':_0x4aeb21[_0x231c('0xd7')]||undefined,'CampaignId':_0x4aeb21[_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x11f')));var _0x4765cb=new History(_0x337e45);_0x4765cb['state']=0xa;_0x4765cb[_0x231c('0xaa')]=_0x231c('0x11b');_0x4765cb[_0x231c('0x120')]=moment()[_0x231c('0x95')](_0x231c('0xfb'));_0x4765cb[_0x231c('0x121')]=_0x4765cb[_0x231c('0x120')];_0x4765cb['calleridname']=_0x337e45['calleridname'];_0x4765cb[_0x231c('0x122')]=_0x337e45[_0x231c('0x122')];this[_0x231c('0xcc')](_0x4765cb)['catch'](loggerCatch(_0x231c('0x123')));}}else{this[_0x231c('0x1f')][_0x1e6ea1[_0x231c('0xb4')]][_0x231c('0x6d')]+=0x1;this[_0x231c('0x1f')][_0x1e6ea1[_0x231c('0xb4')]][_0x231c('0x124')]+=0x1;_0x337e45['state']=0xb;_0x337e45[_0x231c('0xaa')]='Abandoned';_0x337e45[_0x231c('0x11c')]=_0x231c('0x125');_0x337e45[_0x231c('0xf2')]+=0x1;_0x337e45[_0x231c('0xed')]+=0x1;if(_0x337e45[_0x231c('0xf2')]>=this[_0x231c('0x1f')][_0x1e6ea1['queue']]['dialAbandonedMaxRetry']){this[_0x231c('0x116')](_0x337e45);}else{this[_0x231c('0xc1')]({'active':![],'countabandonedretry':_0x337e45[_0x231c('0xf2')],'scheduledat':moment()[_0x231c('0x105')](this[_0x231c('0x1f')][_0x1e6ea1['queue']][_0x231c('0x126')],_0x231c('0xfa'))[_0x231c('0x95')](_0x231c('0xfb')),'ContactId':_0x4aeb21[_0x231c('0xd4')],'ListId':_0x4aeb21[_0x231c('0xd5')],'VoiceQueueId':_0x4aeb21[_0x231c('0xd7')]||undefined,'CampaignId':_0x4aeb21[_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x127')));var _0x4765cb=new History(_0x337e45);_0x4765cb[_0x231c('0xa9')]=0xb;_0x4765cb[_0x231c('0xaa')]=_0x231c('0x128');_0x4765cb[_0x231c('0x120')]=moment()[_0x231c('0x95')]('YYYY-MM-DD\x20HH:mm:ss');_0x4765cb['endtime']=_0x4765cb[_0x231c('0x120')];_0x4765cb[_0x231c('0x129')]=_0x337e45['calleridname'];_0x4765cb[_0x231c('0x122')]=_0x337e45[_0x231c('0x122')];this['createHistory'](_0x4765cb)[_0x231c('0xb1')](loggerCatch(_0x231c('0x12a')));}}}}};Dialer[_0x231c('0x1a')][_0x231c('0x34')]=function(_0x5013dd){if(this[_0x231c('0x25')][_0x5013dd['uniqueid']]){this[_0x231c('0x25')][_0x5013dd[_0x231c('0xeb')]][_0x231c('0x12b')]=_0x5013dd[_0x231c('0x12b')];}if(this[_0x231c('0x26')][_0x5013dd[_0x231c('0xeb')]]){this[_0x231c('0x26')][_0x5013dd[_0x231c('0xeb')]]['channel']=_0x5013dd['channel'];}};Dialer[_0x231c('0x1a')][_0x231c('0x38')]=function(_0x24f33e){if(strategy[this[_0x231c('0x1f')][this[_0x231c('0x25')][_0x24f33e[_0x231c('0x12c')]][_0x231c('0xb4')]][_0x231c('0x50')]]==='roundrobin'){if(this['actions'][_0x24f33e[_0x231c('0x12c')]]&&_[_0x231c('0xae')](this[_0x231c('0x25')][_0x24f33e[_0x231c('0x12c')]][_0x231c('0x12d')])&&_0x24f33e['status']==='1'&&_0x24f33e['paused']==='0'){if(this['agents'][_0x24f33e[_0x231c('0x12e')]]){if(!this['agents'][_0x24f33e[_0x231c('0x12e')]][_0x231c('0x12d')]){this[_0x231c('0x21')][_0x24f33e[_0x231c('0x12e')]][_0x231c('0x12d')]=!![];this[_0x231c('0x25')][_0x24f33e[_0x231c('0x12c')]][_0x231c('0x12d')]=!![];this[_0x231c('0x25')][_0x24f33e[_0x231c('0x12c')]][_0x231c('0x12e')]=_0x24f33e['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x231c('0x25')][_0x24f33e[_0x231c('0x12c')]]['queue']][_0x231c('0x50')]]||_0x231c('0x18'))===_0x231c('0x18')){if(this[_0x231c('0x25')][_0x24f33e[_0x231c('0x12c')]]){if(this[_0x231c('0x21')][_0x24f33e[_0x231c('0x12e')]]){this[_0x231c('0x25')][_0x24f33e[_0x231c('0x12c')]][_0x231c('0x12e')]=_0x24f33e[_0x231c('0x12e')];if(_[_0x231c('0xae')](this[_0x231c('0x29')][this[_0x231c('0x25')][_0x24f33e[_0x231c('0x12c')]][_0x231c('0xb4')]])){this[_0x231c('0x29')][this[_0x231c('0x25')][_0x24f33e['actionid']][_0x231c('0xb4')]]=[];}this[_0x231c('0x29')][this[_0x231c('0x25')][_0x24f33e[_0x231c('0x12c')]][_0x231c('0xb4')]]['push'](_[_0x231c('0x8e')](_['pick'](this[_0x231c('0x25')][_0x24f33e['actionid']],[_0x231c('0x12f'),'stateinterface']),{'status':_0x24f33e[_0x231c('0xb0')],'paused':_0x24f33e[_0x231c('0x130')]}));}}}};function unlockQueueStatus(_0x4b40d2,_0x159a86){setTimeout(function(){if(_['isUndefined'](_0x4b40d2[_0x231c('0x131')])){loggerBooked[_0x231c('0x99')](_0x231c('0x132'),_0x159a86);}_0x4b40d2[_0x231c('0x131')]=!![];loggerBooked[_0x231c('0x7f')](_0x231c('0x133'),_0x159a86,JSON[_0x231c('0x4a')](_[_0x231c('0xd3')](_0x4b40d2,[_0x231c('0x40'),_0x231c('0x131')])));},0x1f3);}Dialer['prototype'][_0x231c('0x3a')]=function(_0x45897c){var _0x2b735c=this;var _0x414d72=_0x2b735c[_0x231c('0x1f')][_0x2b735c['actions'][_0x45897c[_0x231c('0x12c')]][_0x231c('0xb4')]];if(strategy[this[_0x231c('0x1f')][this[_0x231c('0x25')][_0x45897c['actionid']][_0x231c('0xb4')]][_0x231c('0x50')]]===_0x231c('0x19')){if(this[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]]&&this['actions'][_0x45897c[_0x231c('0x12c')]][_0x231c('0x12e')]){this[_0x231c('0x92')][_0x231c('0x134')](this[_0x231c('0x25')][_0x45897c['actionid']][_0x231c('0x12f')],this['actions'][_0x45897c[_0x231c('0x12c')]]['stateinterface'])['catch'](function(_0x610590){logger[_0x231c('0x99')](_0x231c('0x135'),util[_0x231c('0x98')](_0x610590,{'showHidden':![],'depth':null}));})[_0x231c('0x1d')](function(){_0x2b735c[_0x231c('0xb3')](_0x2b735c[_0x231c('0x1f')][_0x2b735c['actions'][_0x45897c[_0x231c('0x12c')]][_0x231c('0xb4')]]);_0x2b735c[_0x231c('0x21')][_0x2b735c[_0x231c('0x25')][_0x45897c['actionid']]['stateinterface']][_0x231c('0x12d')]=![];delete _0x2b735c[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]];unlockQueueStatus(_0x414d72);});}else{this[_0x231c('0xb3')](this['voiceQueues'][this[_0x231c('0x25')][_0x45897c['actionid']][_0x231c('0xb4')]]);this[_0x231c('0xc1')]({'active':![],'ContactId':this[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]][_0x231c('0xd4')],'ListId':this[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]][_0x231c('0xd5')],'VoiceQueueId':this[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]][_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x136')));delete this[_0x231c('0x25')][_0x45897c['actionid']];unlockQueueStatus(_0x414d72);}}else if((strategy[this[_0x231c('0x1f')][this[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]][_0x231c('0xb4')]]['strategy']]||_0x231c('0x18'))===_0x231c('0x18')){var _0x1105d1;if(this[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]]&&!_[_0x231c('0x48')](this[_0x231c('0x29')][this[_0x231c('0x25')][_0x45897c['actionid']][_0x231c('0xb4')]])){if(this['queueBookedRR'][_0x2b735c[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]]['queue']]){this['queueBookedRR'][_0x2b735c[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]][_0x231c('0xb4')]]=this[_0x231c('0x2a')][this['actions'][_0x45897c[_0x231c('0x12c')]][_0x231c('0xb4')]]?this[_0x231c('0x2a')][this[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]][_0x231c('0xb4')]]:this[_0x231c('0x29')][this['actions'][_0x45897c['actionid']][_0x231c('0xb4')]]?this[_0x231c('0x29')][this[_0x231c('0x25')][_0x45897c[_0x231c('0x12c')]][_0x231c('0xb4')]][_0x231c('0x137')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x45897c[_0x231c('0x12c')]][_0x231c('0xb4')]][_0x231c('0x137')]=this[_0x231c('0x2a')][this[_0x231c('0x25')][_0x45897c['actionid']][_0x231c('0xb4')]];for(var _0x56b663=0x0;_0x56b663=0x0;})['catch'](myreject(_0x1db8e9)));}}else{_0x2cd808[_0x231c('0x14a')](ami[_0x231c('0xaf')]({'action':_0x231c('0x14b'),'command':util[_0x231c('0x95')](_0x231c('0x150'),_0x525e25,!_[_0x231c('0x3d')](config[_0x231c('0x146')][_0x4cb171])?_0x4cb171:'')})[_0x231c('0xb7')](function(_0x12696c){return _0x12696c[_0x231c('0x14d')][_0x231c('0x14e')](_0x231c('0x14f'))>=0x0;})[_0x231c('0xb1')](myreject(_0x1db8e9)));}BPromise[_0x231c('0x151')](_0x2cd808)[_0x231c('0xb7')](function(_0x1a1d73){var _0x41a899=_['some'](_0x1a1d73);if(_0x41a899){return _0x399a49(_0x41a899);}else{_0x7bbe9b[_0x231c('0x3e')]=_0x2b4484?_0x231c('0x152'):_0x231c('0x153');return _0x1db8e9(msgResponse(_0x231c('0x154'),_0x231c('0x142'),'Global:\x20'+_0x2b4484+'\x20'+_0x34e48f+'\x20Interval\x20is\x20overtime:\x20'+util[_0x231c('0x98')](_0x525e25,{'showHidden':![],'depth':null})+_0x231c('0x155')+_0x4cb171));}})[_0x231c('0xb1')](function(_0x10bf8b){return _0x1db8e9(msgResponse(_0x231c('0x140'),_0x231c('0x142'),JSON['stringify'](_0x10bf8b)));});});};Dialer[_0x231c('0x1a')][_0x231c('0x156')]=function(_0x4ca963){var _0x440909=this;return function(){switch(_0x4ca963[_0x231c('0x59')]){case _0x231c('0x157'):freeVariablesPredictive(_0x4ca963);_0x440909[_0x231c('0x158')](_0x4ca963,0x1);break;case _0x231c('0x159'):freeVariablesPredictive(_0x4ca963);_0x440909[_0x231c('0x158')](_0x4ca963,_0x4ca963[_0x231c('0x15a')]);break;case _0x231c('0x15b'):_0x440909[_0x231c('0x15b')](_0x4ca963);break;case _0x231c('0x8'):freeVariablesPredictive(_0x4ca963);_0x440909['handlePower'](_0x4ca963,0x1);break;default:freeVariablesPredictive(_0x4ca963);logger[_0x231c('0x99')](_0x231c('0x15c'),_0x4ca963[_0x231c('0x40')],'method\x20not\x20recognized');}};};Dialer[_0x231c('0x1a')]['launchHandleIvr']=function(_0xcff0b6){var _0x16a787=this;return function(){_0x16a787['handleIvr'](_0xcff0b6);};};Dialer[_0x231c('0x1a')]['syncQueueSummary']=function(_0x50694e){var _0x2eef3c=this;if(isNotPreview(_0x50694e[_0x231c('0x59')])){if(isVoiceQueueOutbound(_0x50694e['type'])&&isActive(_0x50694e[_0x231c('0x15d')])){_0x50694e[_0x231c('0xa2')]=!![];BPromise[_0x231c('0xbb')]()[_0x231c('0xb7')](checkIsLoggedIn(_0x50694e,_0x50694e['loggedIn']))['then'](checkIsActive(_0x50694e,_0x50694e[_0x231c('0x15d')]))['then'](checkInterval(_0x50694e))['then'](_0x2eef3c[_0x231c('0x13d')](_0x50694e))[_0x231c('0xb7')](_0x2eef3c[_0x231c('0x15e')](_0x50694e[_0x231c('0x15f')],_0x50694e[_0x231c('0x160')],_0x50694e[_0x231c('0x40')],_0x50694e))[_0x231c('0xb7')](_0x2eef3c[_0x231c('0x141')](_0x50694e[_0x231c('0x45')],_0x50694e[_0x231c('0x160')],_0x50694e[_0x231c('0x40')],_0x50694e))['then'](_0x2eef3c[_0x231c('0x156')](_0x50694e))['catch'](loggerCatchQueueSummary(_0x231c('0x161'),_0x50694e));}else{notSendMessagesQueue(_0x50694e);}}else{freeVariablesPredictive(_0x50694e);}};Dialer[_0x231c('0x1a')][_0x231c('0x13c')]=function(){var _0x20cdec=this;var _0x1e9455;for(var _0x49ebf0 in this['campaigns']){if(typeof this[_0x231c('0x20')][_0x49ebf0]!==_0x231c('0x9b')){_0x1e9455=this['campaigns'][_0x49ebf0];if(isCampaignIvr(_0x1e9455[_0x231c('0x4e')])&&isActive(_0x1e9455['active'])){_0x1e9455[_0x231c('0xa2')]=!![];BPromise[_0x231c('0xbb')]()['then'](checkIsActive(_0x1e9455,_0x1e9455['active']))[_0x231c('0xb7')](checkInterval(_0x1e9455))[_0x231c('0xb7')](_0x20cdec[_0x231c('0x13d')](_0x1e9455))[_0x231c('0xb7')](_0x20cdec['checkIfTime'](_0x1e9455[_0x231c('0x15f')],_0x1e9455[_0x231c('0x160')],_0x1e9455[_0x231c('0x40')],_0x1e9455))[_0x231c('0xb7')](_0x20cdec[_0x231c('0x141')](_0x1e9455[_0x231c('0x45')],_0x1e9455['dialTimezone'],_0x1e9455[_0x231c('0x40')],_0x1e9455))[_0x231c('0xb7')](_0x20cdec[_0x231c('0x162')](_0x1e9455))['catch'](loggerCatchQueueSummary(_0x231c('0x163'),_0x1e9455));}else{notSendMessagesCampaign(_0x1e9455);}}}};function getCallerIdRandom(_0x4808e2,_0x4b65ed){var _0x56afec;var _0x5ddf64;var _0x7ddaad;if(_0x4b65ed<=0x0){_0x4b65ed=0x1;}_0x56afec=new RegExp(_0x231c('0x164')+_0x4b65ed+'}$');_0x5ddf64=Math['pow'](0xa,_0x4b65ed-0x1);_0x7ddaad=Math[_0x231c('0x165')](0xa,_0x4b65ed)-0x1;return util['format']('%s',_[_0x231c('0x166')](_0x4808e2,_0x56afec,_[_0x231c('0x167')](_0x5ddf64,_0x7ddaad)));}function extractCalleridName(_0x627897){var _0x4bfb19=_0x627897['match'](/"(.*?)"/);return _0x4bfb19?_0x4bfb19[0x1]:_0x627897;}function extractCalleridNumber(_0x1fa871){var _0xa5b698=_0x1fa871['match'](/<(.*?)>/);return _0xa5b698?_0xa5b698[0x1]:_0x1fa871;}Dialer[_0x231c('0x1a')][_0x231c('0x168')]=function(_0x940092,_0x26d8c1){var _0x4ec777=this;var _0x1159c8=uuid['v4']();this[_0x231c('0x25')][_0x1159c8]=new Action(_0x940092,_0x26d8c1,_0x1159c8);return new BPromise(function(_0x357ce5,_0x57048b){if(_[_0x231c('0x3d')](_0x940092)&&typeof _0x940092!==_0x231c('0x169')){return _0x57048b(msgResponse('originate','Failure',_0x231c('0x16a')));}if(_[_0x231c('0x3d')](_0x26d8c1[_0x231c('0x16b')][_0x231c('0x16c')])||_0x26d8c1['Contact'][_0x231c('0x16c')]===null){return _0x57048b(msgResponse(_0x231c('0x16d'),_0x231c('0x142'),_0x231c('0x16e')));}var _0x4b206a={'XMD-CALLERID':_0x4ec777['actions'][_0x1159c8]['getCaller'](),'XMD-AGI':_0x940092[_0x231c('0x108')]?util[_0x231c('0x95')](_0x231c('0x16f'),ipAgi,_0x940092['dialQueueProject']):_0x231c('0x170'),'XMD-AGIAFTER':_0x940092[_0x231c('0x171')]?util[_0x231c('0x95')]('\x22agi://%s/square,%s\x22',ipAgi,_0x940092['dialQueueProject2']):_0x231c('0x170'),'XMD-QUEUE':_0x940092[_0x231c('0x4e')]===_0x231c('0x4f')?util[_0x231c('0x95')]('\x22%s,%s%s,,,%s\x22',_0x940092[_0x231c('0x40')],_0x940092[_0x231c('0x172')]||'',_0x940092[_0x231c('0x111')]?'c':'',_0x940092[_0x231c('0x119')]||0x3):_0x231c('0x170'),'XMD-CONTACTID':_0x26d8c1[_0x231c('0xd4')],'XMD-CDRTYPE':_0x231c('0x7'),'CALLERID(all)':_0x4ec777['actions'][_0x1159c8][_0x231c('0x173')](),'XMD-AMD':_0x940092[_0x231c('0xe2')]?_0x231c('0x174'):_0x231c('0x170'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x940092['dialAMDActive']){_0x4b206a[_0x231c('0x175')]=_0x940092['dialAMDInitialSilence']||0x9c4;_0x4b206a['XMD-AMDGREETING']=_0x940092['dialAMDGreeting']||0x5dc;_0x4b206a[_0x231c('0x176')]=_0x940092[_0x231c('0x177')]||0x320;_0x4b206a[_0x231c('0x178')]=_0x940092['dialAMDTotalAnalysisTime']||0x1388;_0x4b206a['XMD-AMDMINWORDLENGTH']=_0x940092[_0x231c('0x179')]||0x64;_0x4b206a[_0x231c('0x17a')]=_0x940092[_0x231c('0x17b')]||0x32;_0x4b206a[_0x231c('0x17c')]=_0x940092[_0x231c('0x17d')]||0x3;_0x4b206a['XMD-AMDSILENCETHRESHOLD']=_0x940092[_0x231c('0x17e')]||0x100;_0x4b206a['XMD-AMDMAXIMUMWORDLENGTH']=_0x940092['dialAMDMaximumWordLength']||0x1388;}if(_0x940092[_0x231c('0x4e')]===_0x231c('0x4f')){_0x4b206a[_0x231c('0x17f')]=_0x26d8c1[_0x231c('0xd7')];}else{_0x4b206a['XMD-CAMPAIGNID']=_0x26d8c1[_0x231c('0xfc')];}for(var _0x21de29 in _0x26d8c1[_0x231c('0x16b')]){if(typeof _0x26d8c1[_0x231c('0x16b')][_0x21de29]!==_0x231c('0x9b')){if(isNotNull(_0x26d8c1[_0x231c('0x16b')][_0x21de29])&&_0x21de29!=='id'&&_0x21de29!=='tags'&&_0x21de29!==_0x231c('0x180')&&_0x21de29!==_0x231c('0x181')){_0x4b206a[util[_0x231c('0x95')]('%s%s',_0x231c('0x182'),_[_0x231c('0x183')](_0x21de29))]=_0x26d8c1[_0x231c('0x16b')][_0x21de29];}}}var _0x50e020=_0x4ec777[_0x231c('0xdb')](_0x940092[_0x231c('0x78')])?getCallerId(_0x940092['Trunk']['callerid'],_0x940092[_0x231c('0x5a')],_0x940092[_0x231c('0x184')]>0x0?getCallerIdRandom(_0x940092[_0x231c('0x5b')],_0x940092[_0x231c('0x184')]):_0x940092[_0x231c('0x5b')]):getCallerId(_[_0x231c('0xae')](_0x940092[_0x231c('0x185')])?_0x940092['Trunk'][_0x231c('0x7a')]:_0x940092['TrunkBackup'][_0x231c('0x7a')],_0x940092[_0x231c('0x5a')],_0x940092[_0x231c('0x184')]>0x0?getCallerIdRandom(_0x940092[_0x231c('0x5b')],_0x940092[_0x231c('0x184')]):_0x940092[_0x231c('0x5b')]);if(_0x50e020){_0x4b206a['XMD-ORIGINATECALLERIDNAME']=_0x4ec777[_0x231c('0x25')][_0x1159c8][_0x231c('0x186')]=extractCalleridName(_0x50e020);_0x4b206a[_0x231c('0x187')]=_0x4ec777['actions'][_0x1159c8][_0x231c('0x188')]=extractCalleridNumber(_0x50e020);}return ami[_0x231c('0xaf')]({'actionid':_0x1159c8,'action':_0x231c('0x16d'),'channel':_0x4ec777[_0x231c('0xdb')](_0x940092[_0x231c('0x78')])?util['format'](_0x231c('0x189'),_0x940092[_0x231c('0x78')]['name'],isNotNull(_0x940092[_0x231c('0x5d')])?_0x940092[_0x231c('0x5d')][_0x231c('0x18a')]()||'':'',_0x940092[_0x231c('0x18b')]>0x0?_0x26d8c1[_0x231c('0x16b')][_0x231c('0x16c')][_0x231c('0x18c')](_0x940092[_0x231c('0x18b')]):_0x26d8c1[_0x231c('0x16b')][_0x231c('0x16c')]):util['format'](_0x231c('0x189'),_[_0x231c('0xae')](_0x940092[_0x231c('0x185')])?_0x940092['Trunk'][_0x231c('0x40')]:_0x940092['TrunkBackup'][_0x231c('0x40')],isNotNull(_0x940092[_0x231c('0x5d')])?_0x940092[_0x231c('0x5d')][_0x231c('0x18a')]()||'':'',_0x940092[_0x231c('0x18b')]>0x0?_0x26d8c1[_0x231c('0x16b')][_0x231c('0x16c')]['substring'](_0x940092['dialCutDigit']):_0x26d8c1['Contact'][_0x231c('0x16c')]),'callerid':_0x50e020,'Exten':_0x231c('0x18d'),'Context':_0x231c('0x18e'),'Priority':'1','variable':_0x4b206a,'timeout':(_0x940092[_0x231c('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1159c8})['then'](function(_0x599d9b){return _0x357ce5(_0x599d9b);})[_0x231c('0xb1')](function(_0x4c6475){_0x940092[_0x231c('0x66')]+=0x1;var _0x12a868=new History(_0x4ec777['actions'][_0x1159c8]);logger[_0x231c('0x99')](util[_0x231c('0x95')]('[originateError]:\x20%s',JSON[_0x231c('0x4a')](_0x4c6475)));_0x12a868[_0x231c('0xa9')]=0xe;_0x12a868[_0x231c('0xaa')]=_0x231c('0x18f');_0x12a868[_0x231c('0x120')]=moment()[_0x231c('0x95')](_0x231c('0xfb'));_0x12a868[_0x231c('0x121')]=_0x12a868[_0x231c('0x120')];_0x4ec777[_0x231c('0xcc')](_0x12a868)[_0x231c('0xb1')](loggerCatch(_0x231c('0x190')));_0x4ec777['moveContactManagedDialer'](_0x12a868)[_0x231c('0xb1')](loggerCatch(_0x231c('0x190')))[_0x231c('0x1d')](function(){delete _0x4ec777[_0x231c('0x25')][_0x1159c8];return _0x57048b(msgResponse(_0x231c('0x16d'),_0x231c('0x49'),_0x231c('0x191')));});});});};Dialer[_0x231c('0x1a')][_0x231c('0x192')]=function(_0x176e84){var _0x1a572e=this[_0x231c('0x25')][_0x176e84[_0x231c('0x12c')]];if(_0x1a572e){delete this[_0x231c('0x25')][_0x176e84['actionid']];_0x1a572e[_0x231c('0x193')]=moment()[_0x231c('0x95')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5a8e35=_0x1a572e[_0x231c('0x4e')]===_0x231c('0x93')?this[_0x231c('0x20')][_0x1a572e[_0x231c('0xb4')]]:this[_0x231c('0x1f')][_0x1a572e[_0x231c('0x194')]()];if(!this[_0x231c('0xd9')](_0x176e84[_0x231c('0x195')])){this[_0x231c('0xb3')](_0x5a8e35);return this[_0x231c('0x196')](_0x1a572e,_0x5a8e35,_0x176e84)[_0x231c('0xb1')](loggerCatch(_0x231c('0x197')));}this['uniqueId'][_0x176e84[_0x231c('0xeb')]]=_0x1a572e;}};Dialer[_0x231c('0x1a')][_0x231c('0x198')]=function(_0x54051d,_0x117a1c,_0x3b170d){var _0x6aa6aa=new History(_0x117a1c);if(_0x6aa6aa[_0x231c('0xee')]+_0x6aa6aa[_0x231c('0xef')]+_0x6aa6aa[_0x231c('0xf0')]+_0x6aa6aa[_0x231c('0xf1')]+_0x6aa6aa[_0x231c('0x102')]+_0x6aa6aa[_0x231c('0xf2')]+_0x6aa6aa[_0x231c('0xf8')]+_0x6aa6aa[_0x231c('0xf3')]>=_0x3b170d[_0x231c('0x103')]-0x1){return!![];}switch(_0x54051d){case 0x3:if(_0x6aa6aa[_0x231c('0xf0')]>=_0x3b170d['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x231c('0xc1')]({'active':![],'countnoanswerretry':_0x6aa6aa[_0x231c('0xf0')]+=0x1,'scheduledat':moment()[_0x231c('0x105')](_0x3b170d[_0x231c('0x199')],'minutes')[_0x231c('0x95')](_0x231c('0xfb')),'ContactId':_0x6aa6aa[_0x231c('0xd4')],'ListId':_0x6aa6aa[_0x231c('0xd5')],'VoiceQueueId':_0x6aa6aa[_0x231c('0xd7')]||undefined,'CampaignId':_0x6aa6aa['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x6aa6aa[_0x231c('0xee')]>=_0x3b170d[_0x231c('0x19a')]-0x1){return!![];}this[_0x231c('0xc1')]({'active':![],'countbusyretry':_0x6aa6aa[_0x231c('0xee')]+=0x1,'scheduledat':moment()['add'](_0x3b170d[_0x231c('0x19b')],'minutes')[_0x231c('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6aa6aa[_0x231c('0xd4')],'ListId':_0x6aa6aa[_0x231c('0xd5')],'VoiceQueueId':_0x6aa6aa['VoiceQueueId']||undefined,'CampaignId':_0x6aa6aa['CampaignId']||undefined})[_0x231c('0xb1')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x6aa6aa['countcongestionretry']>=_0x3b170d['dialCongestionMaxRetry']-0x1){return!![];}this[_0x231c('0xc1')]({'active':![],'countcongestionretry':_0x6aa6aa['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x3b170d[_0x231c('0x19c')],_0x231c('0xfa'))[_0x231c('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6aa6aa[_0x231c('0xd4')],'ListId':_0x6aa6aa[_0x231c('0xd5')],'VoiceQueueId':_0x6aa6aa[_0x231c('0xd7')]||undefined,'CampaignId':_0x6aa6aa[_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x19d')));break;case 0x0:if(_0x6aa6aa[_0x231c('0xf1')]>=_0x3b170d[_0x231c('0x19e')]-0x1){return!![];}else{this[_0x231c('0xc1')]({'active':![],'countnosuchnumberretry':_0x6aa6aa[_0x231c('0xf1')]+=0x1,'scheduledat':moment()[_0x231c('0x105')](_0x3b170d['dialNoSuchNumberRetryFrequency'],_0x231c('0xfa'))[_0x231c('0x95')](_0x231c('0xfb')),'ContactId':_0x6aa6aa['ContactId'],'ListId':_0x6aa6aa[_0x231c('0xd5')],'VoiceQueueId':_0x6aa6aa[_0x231c('0xd7')]||undefined,'CampaignId':_0x6aa6aa[_0x231c('0xfc')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x6aa6aa['countdropretry']>=_0x3b170d['dialDropMaxRetry']-0x1){return!![];}this[_0x231c('0xc1')]({'active':![],'countdropretry':_0x6aa6aa['countdropretry']+=0x1,'scheduledat':moment()[_0x231c('0x105')](_0x3b170d[_0x231c('0x11e')],_0x231c('0xfa'))['format'](_0x231c('0xfb')),'ContactId':_0x6aa6aa['ContactId'],'ListId':_0x6aa6aa[_0x231c('0xd5')],'VoiceQueueId':_0x6aa6aa[_0x231c('0xd7')]||undefined,'CampaignId':_0x6aa6aa[_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x11f')));break;case 0xb:if(_0x6aa6aa[_0x231c('0xf2')]>=_0x3b170d[_0x231c('0x19f')]-0x1){return!![];}this[_0x231c('0xc1')]({'active':![],'countabandonedretry':_0x6aa6aa[_0x231c('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x3b170d[_0x231c('0x126')],'minutes')[_0x231c('0x95')](_0x231c('0xfb')),'ContactId':_0x6aa6aa['ContactId'],'ListId':_0x6aa6aa[_0x231c('0xd5')],'VoiceQueueId':_0x6aa6aa[_0x231c('0xd7')]||undefined,'CampaignId':_0x6aa6aa[_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x127')));break;case 0x13:if(_0x6aa6aa[_0x231c('0xf8')]>=_0x3b170d[_0x231c('0x104')]-0x1){return!![];}this[_0x231c('0xc1')]({'active':![],'countmachineretry':_0x6aa6aa['countmachineretry']+=0x1,'scheduledat':moment()[_0x231c('0x105')](_0x3b170d['dialMachineRetryFrequency'],_0x231c('0xfa'))[_0x231c('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6aa6aa[_0x231c('0xd4')],'ListId':_0x6aa6aa['ListId'],'VoiceQueueId':_0x6aa6aa[_0x231c('0xd7')]||undefined,'CampaignId':_0x6aa6aa[_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0xfd')));break;case 0x14:if(_0x6aa6aa['countagentrejectretry']>=_0x3b170d[_0x231c('0x1a0')]-0x1){return!![];}this[_0x231c('0xc1')]({'active':![],'countagentrejectretry':_0x6aa6aa[_0x231c('0xf3')]+=0x1,'scheduledat':moment()[_0x231c('0x105')](_0x3b170d[_0x231c('0x1a1')],_0x231c('0xfa'))['format'](_0x231c('0xfb')),'ContactId':_0x6aa6aa[_0x231c('0xd4')],'ListId':_0x6aa6aa['ListId'],'VoiceQueueId':_0x6aa6aa['VoiceQueueId']||undefined,'CampaignId':_0x6aa6aa[_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x1a2')));break;default:return!![];}};Dialer[_0x231c('0x1a')][_0x231c('0x196')]=function(_0x3f313,_0x50d78a,_0x3e5622){var _0x3221dc=this;var _0x11dcf5=new History(_0x3f313);return new BPromise(function(_0x438fe9,_0x13a6e2){if(_[_0x231c('0x3d')](_0x50d78a)&&typeof _0x50d78a!=='object'){return _0x13a6e2(msgResponse(_0x231c('0x1a3'),_0x231c('0x142'),_0x231c('0x1a4')));}if(_[_0x231c('0x3d')](_0x3e5622)&&typeof _0x3e5622!==_0x231c('0x169')){return _0x13a6e2(msgResponse('[callProgressDetecting]',_0x231c('0x142'),_0x231c('0x1a5')));}switch(_0x3e5622[_0x231c('0x10e')]){case'0':_0x50d78a['outboundNoSuchCallsDay']+=0x1;_0x11dcf5[_0x231c('0xa9')]=0x0;_0x11dcf5[_0x231c('0xaa')]=_0x231c('0x1a6');_0x11dcf5['countnosuchnumberretry']+=0x1;_0x11dcf5[_0x231c('0xed')]+=0x1;ami[_0x231c('0x4d')]('custom:agentnosuchnumber',ut[_0x231c('0xe8')](_0x3f313,_0x231c('0x1a7')));_0x3221dc['createHistory'](_0x11dcf5)[_0x231c('0xb1')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3221dc[_0x231c('0x198')](0x0,_0x3f313,_0x50d78a)){if(_0x11dcf5[_0x231c('0xf1')]>=_0x50d78a['dialNoSuchNumberMaxRetry']){_0x3221dc['createStateFinal'](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1a8'));}else{_0x3221dc[_0x231c('0xf4')](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1a8'));}}break;case'3':_0x50d78a[_0x231c('0x64')]+=0x1;_0x11dcf5[_0x231c('0xa9')]=0x3;_0x11dcf5[_0x231c('0xaa')]=_0x231c('0x1a9');_0x11dcf5['countnoanswerretry']+=0x1;_0x11dcf5[_0x231c('0xed')]+=0x1;ami[_0x231c('0x4d')](_0x231c('0x1aa'),ut['buildObj'](_0x3f313,_0x231c('0x1ab')));_0x3221dc[_0x231c('0xcc')](_0x11dcf5)[_0x231c('0xb1')](loggerCatch(_0x231c('0x1ac')));if(_0x3221dc[_0x231c('0x198')](0x3,_0x3f313,_0x50d78a)){if(_0x11dcf5[_0x231c('0xf0')]>=_0x50d78a['dialNoAnswerMaxRetry']){_0x3221dc[_0x231c('0xf6')](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1ad'));}else{_0x3221dc['stateGlobal'](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1ad'));}}break;case'5':_0x50d78a[_0x231c('0x60')]+=0x1;_0x11dcf5[_0x231c('0xa9')]=0x5;_0x11dcf5[_0x231c('0xaa')]=_0x231c('0x1ae');_0x11dcf5[_0x231c('0xee')]+=0x1;_0x11dcf5[_0x231c('0xed')]+=0x1;ami[_0x231c('0x4d')](_0x231c('0x1af'),ut[_0x231c('0xe8')](_0x3f313,_0x231c('0x1b0')));_0x3221dc['createHistory'](_0x11dcf5)[_0x231c('0xb1')](loggerCatch(_0x231c('0x1b1')));if(_0x3221dc[_0x231c('0x198')](0x5,_0x3f313,_0x50d78a)){if(_0x11dcf5[_0x231c('0xee')]>=_0x50d78a[_0x231c('0x19a')]){_0x3221dc[_0x231c('0xf6')](_0x11dcf5,_0x438fe9,_0x13a6e2,'reason\x205\x20busy');}else{_0x3221dc['stateGlobal'](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1b2'));}}break;case'8':_0x50d78a[_0x231c('0x61')]+=0x1;_0x11dcf5[_0x231c('0xa9')]=0x8;_0x11dcf5[_0x231c('0xaa')]=_0x231c('0x1b3');_0x11dcf5[_0x231c('0xef')]+=0x1;_0x11dcf5[_0x231c('0xed')]+=0x1;ami['emit'](_0x231c('0x1b4'),ut['buildObj'](_0x3f313,_0x231c('0x1b5')));_0x3221dc['createHistory'](_0x11dcf5)[_0x231c('0xb1')](loggerCatch(_0x231c('0x1b6')));if(_0x3221dc[_0x231c('0x198')](0x8,_0x3f313,_0x50d78a)){if(_0x11dcf5[_0x231c('0xef')]>=_0x50d78a[_0x231c('0x1b7')]){_0x3221dc[_0x231c('0xf6')](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1b8'));}else{_0x3221dc[_0x231c('0xf4')](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1b8'));}}break;case'11':_0x50d78a[_0x231c('0x1b9')]+=0x1;_0x11dcf5['state']=0xb;_0x11dcf5[_0x231c('0xaa')]=_0x231c('0x128');_0x11dcf5[_0x231c('0xf2')]+=0x1;_0x11dcf5[_0x231c('0xed')]+=0x1;_0x3221dc['createHistory'](_0x11dcf5)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x3221dc['checkRetriveMax'](0xb,_0x3f313,_0x50d78a)){if(_0x11dcf5[_0x231c('0xf2')]>=_0x50d78a[_0x231c('0x19f')]){_0x3221dc[_0x231c('0xf6')](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1ba'));}else{_0x3221dc[_0x231c('0xf4')](_0x11dcf5,_0x438fe9,_0x13a6e2,'reason\x2011\x20abandoned');}}break;case'20':_0x50d78a['outboundRejectCallsDay']+=0x1;_0x11dcf5[_0x231c('0xa9')]=0x14;_0x11dcf5[_0x231c('0xaa')]=_0x231c('0x1bb');_0x11dcf5['countagentrejectretry']+=0x1;_0x11dcf5[_0x231c('0xed')]+=0x1;ami[_0x231c('0x4d')](_0x231c('0x1bc'),ut[_0x231c('0xe8')](_0x3f313,'agentreject'));_0x3221dc['createHistory'](_0x11dcf5)['catch'](loggerCatch(_0x231c('0x1bd')));if(_0x3221dc[_0x231c('0x198')](0x14,_0x3f313,_0x50d78a)){if(_0x11dcf5[_0x231c('0xf3')]>=_0x50d78a[_0x231c('0x1a0')]){_0x3221dc['createStateFinal'](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1be'));}else{_0x3221dc['stateGlobal'](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x231c('0x1be'));}}break;default:_0x50d78a[_0x231c('0x69')]+=0x1;_0x11dcf5['state']=0xc;_0x11dcf5[_0x231c('0xaa')]=_0x3e5622[_0x231c('0x10e')];_0x3221dc[_0x231c('0xcc')](_0x11dcf5)[_0x231c('0xb1')](loggerCatch(_0x231c('0x1bf')));if(_0x3221dc[_0x231c('0x198')](_0x3e5622[_0x231c('0x10e')],_0x3f313,_0x50d78a)){if(_0x11dcf5[_0x231c('0xee')]+_0x11dcf5['countcongestionretry']+_0x11dcf5[_0x231c('0xf0')]+_0x11dcf5['countnosuchnumberretry']+_0x11dcf5[_0x231c('0x102')]+_0x11dcf5[_0x231c('0xf2')]+_0x11dcf5[_0x231c('0xf8')]+_0x11dcf5['countagentrejectretry']>=_0x50d78a[_0x231c('0x103')]){_0x3221dc[_0x231c('0xf4')](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x3e5622[_0x231c('0x10e')]);}else{_0x3221dc[_0x231c('0xf6')](_0x11dcf5,_0x438fe9,_0x13a6e2,_0x3e5622[_0x231c('0x10e')]);}}}});};Dialer[_0x231c('0x1a')][_0x231c('0xf4')]=function(_0x793659,_0x4e17e2,_0x13d906,_0x3a3568){var _0x3aca02=new Final(_0x793659);_0x3aca02[_0x231c('0xa9')]=0xf;_0x3aca02['statedesc']=_0x231c('0x1c0');this[_0x231c('0xf6')](_0x3aca02,_0x4e17e2,_0x13d906,_0x3a3568);};Dialer[_0x231c('0x1a')][_0x231c('0xf6')]=function(_0x268afc,_0x4a4f89,_0x561858,_0x54fe3b){this[_0x231c('0xca')](_0x268afc)[_0x231c('0xb7')](function(){return _0x4a4f89(msgResponse(_0x231c('0x1a3'),_0x231c('0xda'),_0x54fe3b));})[_0x231c('0xb1')](function(){return _0x561858(msgResponse(_0x231c('0x1c1'),_0x231c('0x142'),_0x231c('0x1c2')));});};Dialer[_0x231c('0x1a')][_0x231c('0x15b')]=function(_0x268277){var _0x3c9f45=_0x268277[_0x231c('0x1c3')]/0x64;var _0x34ff05=_0x268277[_0x231c('0x63')]/(_0x268277['outboundDropCallsDayTimeout']+_0x268277[_0x231c('0x5f')]);var _0x1eb6af=Math[_0x231c('0x1c4')](_0x268277[_0x231c('0x1c5')]*(_0x268277['predictiveIntervalMaxThreshold']/0x64));var _0x2c28a2=Math['round'](_0x268277['predictiveIntervalAvailable']*(_0x268277[_0x231c('0x1c6')]/0x64));var _0x4a9e46=_0x268277[_0x231c('0x1c7')]+_0x268277['talking'];var _0x4ad57b=Math[_0x231c('0x1c8')](_0x268277[_0x231c('0x8b')]*_0x268277[_0x231c('0x75')]*_0x268277[_0x231c('0x70')]*_0x268277['predictiveIntervalMultiplicativeFactor']);if(_[_0x231c('0x3d')](_0x268277[_0x231c('0x77')])){if(!_[_0x231c('0x3d')](_0x268277[_0x231c('0x28')])){_0x268277[_0x231c('0x28')]=undefined;loggerPredictive[_0x231c('0x99')](_0x231c('0x1c9'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x231c('0x3d')](_0x268277[_0x231c('0x90')])){loggerPredictive[_0x231c('0x99')]('[startMethodPredictive][StartProgressive]',_0x231c('0x1ca'));clearInterval(_0x268277[_0x231c('0x90')]);_0x268277[_0x231c('0x90')]=undefined;}_0x268277[_0x231c('0x77')]=moment()[_0x231c('0x95')](_0x231c('0xfb'));loggerPredictive['info'](_0x268277[_0x231c('0x40')],_0x231c('0x1cb'),_0x268277['startProgressive']);this[_0x231c('0x158')](_0x268277,0x1);}else if(ifInterval(_0x268277[_0x231c('0x1cc')],_0x268277[_0x231c('0x77')])){this[_0x231c('0x158')](_0x268277,0x1);loggerPredictiveCalls[_0x231c('0x7f')](_0x231c('0x1cd'),_0x268277[_0x231c('0x77')],_0x268277[_0x231c('0x40')]);_0x268277['erlangCalls']=0x0;_0x268277['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3c9f45<_0x34ff05&&_0x268277[_0x231c('0x1ce')]===_0x231c('0x1cf')){freeVariablesPredictive(_0x268277);loggerPredictive[_0x231c('0x7f')](_0x231c('0x1d0'),'Dropped\x20calls\x20day',_0x34ff05,_0x231c('0x77'),_0x268277[_0x231c('0x40')]);}else if(_0x4ad57b<_0x268277[_0x231c('0x11a')]&&_0x268277[_0x231c('0x1ce')]===_0x231c('0x1cf')){freeVariablesPredictive(_0x268277);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x231c('0x1d1'),_0x4ad57b,_0x231c('0x1d2'),_0x268277[_0x231c('0x11a')],_0x231c('0x77'),_0x268277[_0x231c('0x40')]);}else if(!ifInterval(_0x268277[_0x231c('0x1cc')],_0x268277[_0x231c('0x77')])&&_[_0x231c('0x3d')](_0x268277[_0x231c('0x28')])&&!_['isUndefined'](_0x268277[_0x231c('0x77')])){_0x268277['startPredictive']=moment()[_0x231c('0x95')](_0x231c('0xfb'));loggerPredictive[_0x231c('0x7f')](_0x268277[_0x231c('0x40')],'started\x20in\x20predictive\x20at',_0x268277[_0x231c('0x28')]);this[_0x231c('0xbe')](_0x268277[_0x231c('0x1cc')])[_0x231c('0xb7')](this['getDataPredictive'](_0x268277))['then'](mergeDataErlangB(_0x268277))[_0x231c('0xb7')](this[_0x231c('0x1d3')](_0x268277))[_0x231c('0xb1')](loggerCatchPredictive(_0x231c('0x1d4'),_0x268277));}else if(!ifInterval(_0x268277[_0x231c('0x1cc')],_0x268277[_0x231c('0x28')])){_0x268277[_0x231c('0x11a')]=0x0;_0x268277[_0x231c('0x28')]=moment()[_0x231c('0x95')](_0x231c('0xfb'));loggerPredictive[_0x231c('0x7f')](_0x268277[_0x231c('0x40')],_0x231c('0x1d5'),_0x268277['startPredictive']);clearInterval(_0x268277['handlePredictive']);_0x268277[_0x231c('0x90')]=undefined;this[_0x231c('0xbe')](_0x268277[_0x231c('0x1cc')])[_0x231c('0xb7')](this[_0x231c('0x1d6')](_0x268277))[_0x231c('0xb7')](mergeDataErlangB(_0x268277))[_0x231c('0xb7')](this[_0x231c('0x1d3')](_0x268277))['catch'](loggerCatchPredictive(_0x231c('0x1d7'),_0x268277));}else if(_0x268277[_0x231c('0x1c5')]&&_0x4a9e46<_0x268277[_0x231c('0x1c5')]-_0x2c28a2){freeVariablesPredictive(_0x268277);loggerPredictive['info'](_0x268277[_0x231c('0x40')],_0x231c('0x1d8'),_0x4a9e46,_0x231c('0x1d9'),_0x268277[_0x231c('0x1c5')],'-',_0x2c28a2,'=',_0x268277[_0x231c('0x1c5')]-_0x2c28a2,')');}else if(_0x268277[_0x231c('0x1c5')]&&_0x4a9e46>_0x268277[_0x231c('0x1c5')]+_0x1eb6af){freeVariablesPredictive(_0x268277);loggerPredictive['info'](_0x268277['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4a9e46,')\x20are\x20more\x20than\x20threshold\x20(',_0x268277[_0x231c('0x1c5')],'+',_0x1eb6af,'=',_0x268277[_0x231c('0x1c5')]+_0x1eb6af,')');}};Dialer[_0x231c('0x1a')][_0x231c('0x1d6')]=function(_0x29696e){var _0x8c107f=this;return function(_0x1660e7){return new BPromise(function(_0x42df67,_0x4c7dfa){_[_0x231c('0x8e')](_0x29696e,_0x1660e7[0x0]);if(checkGetDataPredictive(_0x1660e7[0x0])){var _0x58b718=_0x29696e['predictiveIntervalAvailable']=_0x29696e[_0x231c('0xa3')]+_0x29696e['available'];var _0x4f7045=_0x29696e[_0x231c('0x1cc')]*0x3c;var _0x2ced6c=_0x1660e7[0x0][_0x231c('0x6c')]+_0x1660e7[0x0][_0x231c('0x6b')];var _0x140e88=(_0x1660e7[0x0][_0x231c('0x6a')]+_0x1660e7[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1660e7[0x0][_0x231c('0x6d')])/_0x1660e7[0x0][_0x231c('0x72')];_0x29696e['predictiveIntervalHitRate']=_0x140e88>0x0?_0x140e88:0x1;switch(_0x29696e[_0x231c('0x1ce')]){case _0x231c('0x1cf'):var _0xdb04ce=_0x29696e[_0x231c('0x1c3')]/0x64;return _0x8c107f[_0x231c('0x1da')](_0x58b718,_0x4f7045,_0x2ced6c,_0x140e88,_0xdb04ce)[_0x231c('0xb7')](function(_0x45a893){return _0x42df67(_0x45a893);});case _0x231c('0x1db'):var _0x47576e=_0x29696e[_0x231c('0x1c3')]/0x64;return _0x8c107f[_0x231c('0x1dc')](_0x58b718,_0x4f7045,_0x2ced6c,_0x140e88,_0x47576e)['then'](function(_0x5c1ed5){return _0x42df67(_0x5c1ed5);});default:return _0x4c7dfa(msgResponse(_0x231c('0x1dd'),_0x231c('0x142'),_0x231c('0x1de')));}}else{return _0x4c7dfa(msgResponse('[getDataPredictive]',_0x231c('0x142'),_0x231c('0x1df')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x5e86ee){var _0x4645c2=this;return function(_0x23b827){return new BPromise(function(_0x3c6ba0,_0x889817){_[_0x231c('0x8e')](_0x5e86ee,_0x23b827[0x0]);if(checkGetDataPredictive(_0x23b827[0x0])){loggerPredictive[_0x231c('0x7f')](JSON[_0x231c('0x4a')](_0x23b827[0x0]));if(_0x5e86ee['dialPredictiveOptimization']===_0x231c('0x1cf')){return _0x4645c2[_0x231c('0xc8')](_0x5e86ee['id'])[_0x231c('0xb7')](function(_0x41a93f){var _0x3bc232=_0x5e86ee[_0x231c('0x52')]-_0x41a93f[0x0][_0x231c('0x1e0')];var _0x53bc4b=_0x5e86ee[_0x231c('0x1cc')]*0x3c;var _0x521b6a=_0x23b827[0x0][_0x231c('0x6c')]+_0x23b827[0x0][_0x231c('0x6b')];var _0x347d3f=(_0x23b827[0x0][_0x231c('0x6a')]+_0x23b827[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x23b827[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x23b827[0x0][_0x231c('0x72')];var _0x43f67d=_0x5e86ee[_0x231c('0x1c3')]/0x64;_0x5e86ee[_0x231c('0x1e1')]=_0x41a93f[0x0]['outboundQueuePauses']||0x0;_0x5e86ee[_0x231c('0x70')]=_0x347d3f>0x0?_0x347d3f:0x1;return _0x4645c2[_0x231c('0x1da')](_0x3bc232,_0x53bc4b,_0x521b6a,_0x347d3f,_0x43f67d);})[_0x231c('0xb7')](function(_0x1586d8){return _0x3c6ba0(_0x1586d8);})[_0x231c('0xb1')](function(_0x2baf91){return _0x889817(msgResponse(_0x231c('0x1e2'),_0x231c('0x142'),JSON['stringify'](_0x2baf91)));});}if(_0x5e86ee[_0x231c('0x1ce')]===_0x231c('0x1db')){return _0x4645c2['getVoiceQueueRtPauses'](_0x5e86ee['id'])[_0x231c('0xb7')](function(_0x503dc5){var _0x2a9e8c=_0x5e86ee['loggedIn']-_0x503dc5[0x0][_0x231c('0x1e0')];var _0x4cf6be=_0x5e86ee[_0x231c('0x1cc')]*0x3c;var _0x1454bb=_0x23b827[0x0][_0x231c('0x6c')]+_0x23b827[0x0]['predictiveIntervalAvgHoldtime'];var _0x159fd3=(_0x23b827[0x0][_0x231c('0x6a')]+_0x23b827[0x0][_0x231c('0x6e')]+_0x23b827[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x23b827[0x0]['predictiveIntervalTotalCalls'];var _0xbefa81=_0x5e86ee[_0x231c('0x1c3')]/0x64;_0x5e86ee[_0x231c('0x1e1')]=_0x503dc5[0x0][_0x231c('0x1e0')]||0x0;_0x5e86ee[_0x231c('0x70')]=_0x159fd3>0x0?_0x159fd3:0x1;return _0x4645c2[_0x231c('0x1dc')](_0x2a9e8c,_0x4cf6be,_0x1454bb,_0x159fd3,_0xbefa81);})[_0x231c('0xb7')](function(_0x30775b){return _0x3c6ba0(_0x30775b);})[_0x231c('0xb1')](function(_0x248432){return _0x889817(msgResponse(_0x231c('0x1e2'),_0x231c('0x142'),JSON[_0x231c('0x4a')](_0x248432)));});}}else{return _0x889817(msgResponse('[getDataPredictive]',_0x231c('0x142'),'check\x20failure'));}});};};Dialer[_0x231c('0x1a')][_0x231c('0x1d3')]=function(_0x5d4137){var _0x40d3b5=this;return function(){var _0x335b40=0x0;var _0xd0d31e=Math[_0x231c('0x1c8')](_0x5d4137[_0x231c('0x74')]*0x3e8);if(_0xd0d31e>0x0){_0xd0d31e=_0xd0d31e<0x64?0x64:_0xd0d31e;loggerPredictive[_0x231c('0x7f')](_0x5d4137['name'],_0x231c('0x1e3'),_0xd0d31e,_0x231c('0x4b'));_0x5d4137[_0x231c('0x90')]=setInterval(function(){_0x40d3b5[_0x231c('0x90')](_0x5d4137);loggerPredictiveCalls[_0x231c('0x7f')](_0x231c('0x1e4'),_0x335b40+=0x1);},_0xd0d31e);}else{loggerPredictive['info'](_0x5d4137['name'],_0x231c('0x1e5'));}};};Dialer[_0x231c('0x1a')][_0x231c('0x1e6')]=function(_0x14fec3,_0x1ebf60){var _0x30486f=this;return function(_0x32b4a3){if(_[_0x231c('0x48')](_0x32b4a3)){if(_[_0x231c('0xae')](_0x1ebf60['UserId'])||!_0x1ebf60[_0x231c('0x1e7')]){if(_0x14fec3['dialMethod']===_0x231c('0x8')){_0x14fec3['queueStatusComplete']=_[_0x231c('0x3d')](_0x14fec3[_0x231c('0x131')])?!![]:_0x14fec3[_0x231c('0x131')];var _0x114e46=uuid['v4']();_0x30486f[_0x231c('0x25')][_0x114e46]=new Action(_0x14fec3,_0x1ebf60,_0x114e46);loggerBooked[_0x231c('0x7f')](_0x231c('0x1e8'),_0x114e46,_0x231c('0x1e9'),JSON[_0x231c('0x4a')](_0x14fec3['queueStatusComplete']),_0x231c('0x1ea'),_0x14fec3[_0x231c('0x40')]);if(_0x14fec3['queueStatusComplete']){_0x14fec3[_0x231c('0x131')]=![];_0x30486f[_0x231c('0x29')][_0x30486f['actions'][_0x114e46][_0x231c('0xb4')]]=[];ami[_0x231c('0xaf')]({'actionid':_0x114e46,'action':_0x231c('0x1eb'),'queue':_0x14fec3[_0x231c('0x40')]})[_0x231c('0xb1')](function(){_0x30486f[_0x231c('0xb3')](_0x14fec3);_0x30486f[_0x231c('0xc1')]({'active':![],'ContactId':_0x30486f[_0x231c('0x25')][_0x114e46]['ContactId'],'ListId':_0x30486f[_0x231c('0x25')][_0x114e46][_0x231c('0xd5')],'VoiceQueueId':_0x30486f[_0x231c('0x25')][_0x114e46][_0x231c('0xd7')]||undefined,'CampaignId':_0x30486f[_0x231c('0x25')][_0x114e46]['CampaignId']||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x1ec')));delete _0x30486f[_0x231c('0x25')][_0x114e46];});}else{loggerBooked[_0x231c('0x7f')]('[booked][checkContactBlack][else]',JSON[_0x231c('0x4a')](_0x14fec3['queueStatusComplete']),'Queue:\x20',_0x14fec3[_0x231c('0x40')]);_0x30486f[_0x231c('0xb3')](_0x14fec3);_0x30486f['rescheduleContact']({'active':![],'ContactId':_0x30486f[_0x231c('0x25')][_0x114e46][_0x231c('0xd4')],'ListId':_0x30486f[_0x231c('0x25')][_0x114e46][_0x231c('0xd5')],'VoiceQueueId':_0x30486f[_0x231c('0x25')][_0x114e46][_0x231c('0xd7')]||undefined,'CampaignId':_0x30486f[_0x231c('0x25')][_0x114e46][_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x1ec')));delete _0x30486f[_0x231c('0x25')][_0x114e46];}}else{return _0x30486f['actionOriginate'](_0x14fec3,_0x1ebf60);}}else{if(getDiff(_0x1ebf60[_0x231c('0x1ed')])<_0x14fec3[_0x231c('0x1ee')]*0x3c){if(_0x1ebf60[_0x231c('0x1ef')]&&!_0x1ebf60[_0x231c('0x1ef')]['voicePause']){_0x30486f[_0x231c('0x92')][_0x231c('0x134')](_0x1ebf60['id'])[_0x231c('0x1d')](function(){_0x30486f[_0x231c('0xb3')](_0x14fec3);});}else{_0x30486f[_0x231c('0xc2')]({'active':![]},_0x1ebf60['id'],0x1)[_0x231c('0x1d')](function(){_0x30486f['updateOriginated'](_0x14fec3);});}}else{_0x14fec3[_0x231c('0x67')]+=0x1;_0x30486f[_0x231c('0xb3')](_0x14fec3);if(_0x14fec3[_0x231c('0x1f0')]){_0x30486f[_0x231c('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1ebf60[_0x231c('0xd4')],'ListId':_0x1ebf60[_0x231c('0xd5')],'VoiceQueueId':_0x1ebf60[_0x231c('0xd7')]||undefined,'CampaignId':_0x1ebf60[_0x231c('0xfc')]||undefined})[_0x231c('0xb1')](loggerCatch(_0x231c('0x1f1')));_0x30486f[_0x231c('0xcc')](createObjHistory(_0x14fec3,_0x1ebf60,_0x231c('0x1f2'),0x17,_0x231c('0x1f3')))[_0x231c('0xb1')](loggerCatch(_0x231c('0x1f4')));}else{_0x30486f['saveInDb'](createObjHistory(_0x14fec3,_0x1ebf60,_0x231c('0x1f5'),0x16,'RecallFailedTimeout'),_0x231c('0x1f6'),_0x231c('0x1f7'));}}}}else{_0x14fec3[_0x231c('0x1f8')]+=0x1;_0x30486f[_0x231c('0xd2')](createObjHistory(_0x14fec3,_0x1ebf60,_0x231c('0x1f9'),0xd,_0x231c('0x1fa')),_0x231c('0x1fb'),'[Originate][MoveBlacklist]');throw _0x231c('0x1fc');}};};Dialer[_0x231c('0x1a')]['handleIvr']=function(_0x86ab8){var _0x2744ff=this;var _0x364e6d=_0x86ab8[_0x231c('0x1fd')]-_0x86ab8[_0x231c('0x73')]-_0x86ab8[_0x231c('0xc4')];emitCampaignSummary(_0x86ab8);if(_0x364e6d>0x0){if(_0x364e6d>this[_0x231c('0x23')]){_0x364e6d=this['maxNumberOriginate'];}_0x86ab8['temp']+=_0x364e6d;this['getContactDialerIvr'](_0x86ab8['id'],_0x364e6d,_0x86ab8[_0x231c('0x1fe')],_0x86ab8)[_0x231c('0xb7')](function(_0x54da4c){_0x86ab8[_0x231c('0xc4')]-=_0x364e6d;_0x86ab8[_0x231c('0xc4')]=_0x86ab8[_0x231c('0xc4')]>0x0?_0x86ab8[_0x231c('0xc4')]:0x0;if(!checkContactEmpty(_0x54da4c)){_0x86ab8[_0x231c('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger['info']('[getContactCampaign2][Empty]'+_0x86ab8[_0x231c('0x40')]);}else{_0x86ab8[_0x231c('0x73')]+=_0x54da4c[_0x231c('0x9a')];_0x86ab8[_0x231c('0x3e')]='RUNNING';for(var _0x324b3c=0x0;_0x324b3c<_0x54da4c[_0x231c('0x9a')];_0x324b3c+=0x1){_0x86ab8[_0x231c('0x1ff')]+=0x1;if(_[_0x231c('0xae')](_0x54da4c[_0x324b3c])||_[_0x231c('0xae')](_0x54da4c[_0x324b3c][_0x231c('0x16b')])||_[_0x231c('0xae')](_0x54da4c[_0x324b3c][_0x231c('0x16b')][_0x231c('0x16c')])){_0x2744ff['emptyContact'](_0x231c('0x200'),_0x86ab8,_0x54da4c[_0x324b3c]);}else{_0x2744ff['checkIsBlackListIvr'](_[_0x231c('0xd3')](_0x54da4c[_0x324b3c],[_0x231c('0xfc'),'Contact.phone']))[_0x231c('0xb7')](_0x2744ff[_0x231c('0x1e6')](_0x86ab8,_0x54da4c[_0x324b3c]))[_0x231c('0xb1')](_0x2744ff[_0x231c('0xcf')](_0x231c('0x201'),_0x86ab8));}}}})[_0x231c('0xb1')](loggerGetContactDialer(_0x231c('0x202'),_0x86ab8,_0x364e6d));}};Dialer['prototype']['handlePower']=function(_0x4917b3,_0x1996bf){var _0x143786=this;var _0x5f03a9=[];var _0x434f5c=_0x1996bf>=0x1?_0x1996bf:0x1;if(_0x4917b3['dialMethod']===_0x231c('0x8')){_0x434f5c=0x1;}var _0x18886d=Math[_0x231c('0x1c8')](_0x4917b3[_0x231c('0x1c7')]*_0x434f5c)-_0x4917b3[_0x231c('0x73')]-_0x4917b3[_0x231c('0xc4')];emitVoiceQueueSummary(_0x4917b3);if(_0x4917b3[_0x231c('0x203')]>0x0){var _0x31dd09=_0x4917b3['dialLimitQueue']-_0x4917b3[_0x231c('0x73')]-_0x4917b3[_0x231c('0xa3')]-_0x4917b3[_0x231c('0xc4')]-_0x4917b3[_0x231c('0xa4')];if(_0x18886d>_0x31dd09){_0x18886d=_0x31dd09;}}if(_0x18886d>0x0){if(_0x4917b3[_0x231c('0x59')]===_0x231c('0x8')){_0x18886d=0x1;}if(_0x18886d>this[_0x231c('0x23')]){_0x18886d=this[_0x231c('0x23')];}_0x4917b3[_0x231c('0xc4')]+=_0x18886d;for(var _0x543143 in this[_0x231c('0x21')]){if(typeof this[_0x231c('0x21')][_0x543143]!=='undefined'){if(this[_0x231c('0x21')][_0x543143][_0x231c('0xa9')]==='not_inuse'&&this[_0x231c('0x21')][_0x543143][_0x231c('0xb0')]===_0x231c('0xdd')){_0x5f03a9[_0x231c('0x14a')](this[_0x231c('0x21')][_0x543143]['id']);}}}this[_0x231c('0xc3')](_0x4917b3['id'],_0x5f03a9,_0x18886d,_0x4917b3['dialOrderByScheduledAt'],_0x4917b3)['then'](function(_0x244d3b){_0x4917b3['temp']-=_0x18886d;_0x4917b3[_0x231c('0xc4')]=_0x4917b3[_0x231c('0xc4')]>0x0?_0x4917b3[_0x231c('0xc4')]:0x0;if(!checkContactEmpty(_0x244d3b)){_0x143786[_0x231c('0xb8')](_0x4917b3)[_0x231c('0xb7')](sendMessageReschedule(_0x4917b3))['catch'](loggerCatch(_0x231c('0xb9')));}else{_0x4917b3[_0x231c('0x73')]+=_0x244d3b[_0x231c('0x9a')];_0x4917b3['message']=_0x4917b3[_0x231c('0x59')]===_0x231c('0x8')?_0x231c('0x174'):_0x231c('0x204');for(var _0x1cc9a2=0x0;_0x1cc9a2<_0x244d3b[_0x231c('0x9a')];_0x1cc9a2+=0x1){if(_[_0x231c('0xae')](_0x244d3b[_0x1cc9a2])||_['isNil'](_0x244d3b[_0x1cc9a2][_0x231c('0x16b')])||_[_0x231c('0xae')](_0x244d3b[_0x1cc9a2][_0x231c('0x16b')][_0x231c('0x16c')])){_0x143786[_0x231c('0xd0')](_0x231c('0x200'),_0x4917b3,_0x244d3b[_0x1cc9a2]);}else{_0x143786[_0x231c('0xba')](_[_0x231c('0xd3')](_0x244d3b[_0x1cc9a2],['VoiceQueueId',_0x231c('0x205')]))[_0x231c('0xb7')](_0x143786['checkContactBlack'](_0x4917b3,_0x244d3b[_0x1cc9a2]))[_0x231c('0xb1')](_0x143786[_0x231c('0xcf')]('[actionOriginate]\x20',_0x4917b3));}}}})[_0x231c('0xb1')](loggerGetContactDialer(_0x231c('0x206'),_0x4917b3,_0x18886d));}};Dialer[_0x231c('0x1a')][_0x231c('0x90')]=function(_0x239cee){if(_0x239cee['dialLimitQueue']>0x0){var _0x1d7da8=_0x239cee[_0x231c('0x203')]-_0x239cee[_0x231c('0x73')]-_0x239cee[_0x231c('0xa3')];if(_0x1d7da8>0x0){this[_0x231c('0x207')](_0x239cee);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x231c('0x207')](_0x239cee);}};Dialer[_0x231c('0x1a')]['tryOriginatePredictive']=function(_0x99bbb0){var _0x50f5be=this;var _0x32f81e=[];_0x99bbb0[_0x231c('0x73')]+=0x1;for(var _0x563609 in this['agents']){if(typeof this[_0x231c('0x21')][_0x563609]!==_0x231c('0x9b')){if(this['agents'][_0x563609][_0x231c('0xa9')]===_0x231c('0x208')&&this[_0x231c('0x21')][_0x563609][_0x231c('0xb0')]===_0x231c('0xdd')){_0x32f81e['push'](this[_0x231c('0x21')][_0x563609]['id']);}}}this[_0x231c('0xc3')](_0x99bbb0['id'],_0x32f81e,0x1,_0x99bbb0[_0x231c('0x1fe')],_0x99bbb0)[_0x231c('0xb7')](function(_0x22b7c2){if(!checkContactEmpty(_0x22b7c2)){checkContactLowerLimitOriginate(_0x99bbb0,0x1,0x0);_0x50f5be[_0x231c('0xb8')](_0x99bbb0)[_0x231c('0xb7')](sendMessageReschedule(_0x99bbb0))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x99bbb0[_0x231c('0x3e')]=_0x231c('0x204');if(_[_0x231c('0xae')](_0x22b7c2[0x0])||_[_0x231c('0xae')](_0x22b7c2[0x0][_0x231c('0x16b')])||_['isNil'](_0x22b7c2[0x0]['Contact'][_0x231c('0x16c')])){_0x50f5be['emptyContact']('[actionOriginate]\x20',_0x99bbb0,_0x22b7c2[0x0]);}else{_0x50f5be[_0x231c('0xba')](_['pick'](_0x22b7c2[0x0],['VoiceQueueId',_0x231c('0x205')]))[_0x231c('0xb7')](_0x50f5be[_0x231c('0x1e6')](_0x99bbb0,_0x22b7c2[0x0]))[_0x231c('0xb1')](_0x50f5be[_0x231c('0xcf')](_0x231c('0x209'),_0x99bbb0));}}})['catch'](loggerGetContactDialer(_0x231c('0x20a'),_0x99bbb0,0x1));emitVoiceQueueSummary(_0x99bbb0);};Dialer[_0x231c('0x1a')][_0x231c('0x1da')]=function(_0x10460f,_0x2e6d4e,_0x40cf9b,_0x18b5af,_0x328219,_0x116b92){loggerPredictive[_0x231c('0x7f')](_0x231c('0x20b'));loggerPredictive[_0x231c('0x7f')]('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',_0x10460f);loggerPredictive[_0x231c('0x7f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e6d4e);loggerPredictive[_0x231c('0x7f')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x40cf9b);loggerPredictive[_0x231c('0x7f')](_0x231c('0x20c'),_0x18b5af);loggerPredictive[_0x231c('0x7f')](_0x231c('0x20d'),_0x328219);loggerPredictive[_0x231c('0x7f')](_0x231c('0x85'));return new BPromise(function(_0x2394e9,_0x18d126){if(_0x10460f<=0x0||isNaN(_0x10460f)){return _0x18d126(msgResponse(_0x231c('0x20e'),_0x231c('0x49'),_0x231c('0x20f')+_0x10460f));}if(_0x40cf9b<=0x0||isNaN(_0x40cf9b)){return _0x18d126(msgResponse(_0x231c('0x20e'),'Error',_0x231c('0x210')+_0x40cf9b));}if(_0x18b5af<=0x0||isNaN(_0x18b5af)){return _0x18d126(msgResponse(_0x231c('0x20e'),_0x231c('0x49'),_0x231c('0x211')+_0x18b5af));}if(_0x2e6d4e<=0x0||isNaN(_0x2e6d4e)){return _0x18d126(msgResponse('[abandonmentRate]','Error','interval\x20=\x20'+_0x2e6d4e));}if(_0x328219<=0x0||isNaN(_0x328219)){return _0x18d126(msgResponse('[abandonmentRate]',_0x231c('0x49'),_0x231c('0x212')+_0x328219));}_0x116b92=_0x116b92||0x0;var _0x4c71db=0x1/_0x40cf9b;var _0x3f3226=0x0;var _0x5f3771=0x0;var _0x417b73=0x0;var _0x46c1c3=0x0;for(var _0x495d9e=0x0;_0x417b73<_0x328219;_0x495d9e+=0x1){_0x5f3771=_0x495d9e/_0x2e6d4e;_0x3f3226=(_0x18b5af*_0x5f3771+_0x116b92)/_0x4c71db;_0x417b73=erlangb(_0x3f3226,_0x10460f);_0x46c1c3=_0x3f3226/_0x10460f*(0x1-erlangb(_0x3f3226,_0x10460f));}return _0x2394e9({'erlangCalls':_0x495d9e,'erlangCallToSecond':_0x2e6d4e/_0x495d9e,'erlangAbandonmentRate':_0x417b73,'erlangBusyFactor':_0x46c1c3});});};Dialer['prototype'][_0x231c('0x1dc')]=function(_0x22937d,_0x408de1,_0x3d34be,_0x39a9c9,_0x2e62c2,_0x19afc1){loggerPredictive[_0x231c('0x7f')](_0x231c('0x213'));loggerPredictive[_0x231c('0x7f')](_0x231c('0x214'),_0x22937d);loggerPredictive[_0x231c('0x7f')](_0x231c('0x215'),_0x408de1);loggerPredictive[_0x231c('0x7f')](_0x231c('0x216'),_0x3d34be);loggerPredictive[_0x231c('0x7f')](_0x231c('0x20c'),_0x39a9c9);loggerPredictive[_0x231c('0x7f')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e62c2);loggerPredictive[_0x231c('0x7f')](_0x231c('0x85'));return new BPromise(function(_0x8c4192,_0x4872d8){if(_0x22937d<=0x0||isNaN(_0x22937d)){return _0x4872d8(msgResponse('[busyFactor]',_0x231c('0x49'),'m\x20=\x20'+_0x22937d));}if(_0x3d34be<=0x0||isNaN(_0x3d34be)){return _0x4872d8(msgResponse(_0x231c('0x217'),_0x231c('0x49'),'Ts\x20=\x20'+_0x3d34be));}if(_0x39a9c9<=0x0||isNaN(_0x39a9c9)){return _0x4872d8(msgResponse(_0x231c('0x217'),'Error',_0x231c('0x211')+_0x39a9c9));}if(_0x408de1<=0x0||isNaN(_0x408de1)){return _0x4872d8(msgResponse('[busyFactor]',_0x231c('0x49'),_0x231c('0x218')+_0x408de1));}if(_0x2e62c2<=0x0||isNaN(_0x2e62c2)){return _0x4872d8(msgResponse(_0x231c('0x217'),_0x231c('0x49'),'Umin\x20=\x20'+_0x2e62c2));}_0x19afc1=_0x19afc1||0x0;var _0x2dfcd7=0x1/_0x3d34be;var _0x31d76c=0x0;var _0x4065db=0x0;var _0x5e5b8d=0x0;var _0x4b9d28=0x0;for(var _0x3f01f0=0x0;_0x4b9d28<_0x2e62c2;_0x3f01f0+=0x1){_0x4065db=_0x3f01f0/_0x408de1;_0x31d76c=(_0x39a9c9*_0x4065db+_0x19afc1)/_0x2dfcd7;_0x5e5b8d=erlangb(_0x31d76c,_0x22937d);_0x4b9d28=_0x31d76c/_0x22937d*(0x1-erlangb(_0x31d76c,_0x22937d));}return _0x8c4192({'erlangCalls':_0x3f01f0,'erlangCallToSecond':_0x408de1/_0x3f01f0,'erlangAbandonmentRate':_0x5e5b8d,'erlangBusyFactor':_0x4b9d28});});};module['exports']=Dialer; \ No newline at end of file +var _0x7070=['name','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','md5','format','ivr','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','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\x20Hold\x20Time\x20is\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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','stack','inspect','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','state','statedesc','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','dialAMDActive','value','MACHINE','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countcongestionretry','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','pick','idHopper','queueStatusComplete','run','_rr','length','unlockRR','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','command','indexOf','true','iftime\x20%s,%s','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','progressive','power','predictive','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','updatedAt','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialCutDigit','substring','trim','[originateError]:\x20%s','OriginateError','endtime','[originate][error]','Error','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','reachable','ACTIVE','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','p\x20=\x20','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','exports','lodash','uuid','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','queueBooked','queueBookedRR','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0x7070,0x1d7));var _0x0707=function(_0x1c26cd,_0x5a5f43){_0x1c26cd=_0x1c26cd-0x0;var _0x5ec84e=_0x7070[_0x1c26cd];return _0x5ec84e;};'use strict';var util=require('util');var _=require(_0x0707('0x0'));var BPromise=require('bluebird');var uuid=require(_0x0707('0x1'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x0707('0x2'));var ut=require(_0x0707('0x3'));var config=require(_0x0707('0x4'));var logger=require(_0x0707('0x5'))('dialer');var loggerBooked=require(_0x0707('0x5'))(_0x0707('0x6'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x0707('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x0707('0x7'));var ami=require(_0x0707('0x8'));config[_0x0707('0x9')]=_[_0x0707('0xa')](config[_0x0707('0x9')],{'host':_0x0707('0xb'),'port':0x18eb});var io=require(_0x0707('0xc'))(new Redis(config[_0x0707('0x9')]));var cmHopper=require(_0x0707('0xd'));var cmHopperHistory=require(_0x0707('0xe'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x0707('0xf'));var Action=require('./action');var History=require(_0x0707('0x10'));var Final=require('./final');var AgentComplete=require(_0x0707('0x11'));var QueueCallerAbandon=require(_0x0707('0x12'));var Hangup=require(_0x0707('0x13'));var ipAgi=process[_0x0707('0x14')][_0x0707('0x15')]||_0x0707('0x16');var strategy={'rrmemory':_0x0707('0x17'),'roundrobin':_0x0707('0x18')};var Sequence=function(){};Sequence[_0x0707('0x19')][_0x0707('0x1a')]=function(_0x47b154){this['tail']=this[_0x0707('0x1b')]?this[_0x0707('0x1b')][_0x0707('0x1c')](_0x47b154):_0x47b154();};function Dialer(_0x46f6de,_0x5e989a){this[_0x0707('0x1d')]=new Sequence();this[_0x0707('0x1e')]=_0x5e989a;this[_0x0707('0x1f')]=_0x46f6de['voiceQueues'];this[_0x0707('0x20')]=_0x46f6de['campaigns'];this[_0x0707('0x21')]=_0x46f6de['agents'];this[_0x0707('0x22')]=_0x46f6de[_0x0707('0x22')];this[_0x0707('0x23')]=config[_0x0707('0x23')]||0x2;this[_0x0707('0x24')]={};this['actions']={};this[_0x0707('0x25')]={};this[_0x0707('0x26')]={};this[_0x0707('0x27')]={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this[_0x0707('0x28')]={};this[_0x0707('0x29')]={};ami['on'](_0x0707('0x2a'),this['syncAgentConnect']['bind'](this));ami['on'](_0x0707('0x2b'),this[_0x0707('0x2c')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x2e'),this[_0x0707('0x2f')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x30'),this[_0x0707('0x31')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x32'),this[_0x0707('0x7')][_0x0707('0x2d')](this));ami['on']('hangup',this[_0x0707('0x33')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x34'),this[_0x0707('0x35')]['bind'](this));ami['on'](_0x0707('0x36'),this[_0x0707('0x37')][_0x0707('0x2d')](this));ami['on'](_0x0707('0x38'),this[_0x0707('0x39')]['bind'](this));ami['on'](_0x0707('0x3a'),this[_0x0707('0x3b')][_0x0707('0x2d')](this));this[_0x0707('0x3c')]();this['loopClearZombieChannels']();}function isNotNull(_0x11b444){return _0x11b444!==null&&!_[_0x0707('0x3d')](_0x11b444);}function checkIsLoggedIn(_0x160485,_0x451c3f){return function(){if(_0x451c3f<=0x0){_0x160485[_0x0707('0x3e')]=_0x0707('0x3f');throw _0x160485[_0x0707('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x511abb){return _0x511abb;}function checkIsActive(_0x1ed31b,_0x300216){return function(){if(!isActive(_0x300216)){_0x1ed31b[_0x0707('0x3e')]=_0x0707('0x41');throw _0x1ed31b['name']+_0x0707('0x42');}};}function checkInterval(_0x2e219c){return function(){if(!isNotNull(_0x2e219c['Interval'])){_0x2e219c[_0x0707('0x3e')]=_0x0707('0x43');throw _0x2e219c['name']+_0x0707('0x44');}if(!isNotNull(_0x2e219c[_0x0707('0x45')]['Intervals'])){_0x2e219c[_0x0707('0x3e')]=_0x0707('0x43');throw _0x2e219c['name']+_0x0707('0x44');}if(!isNotNull(_[_0x0707('0x46')](_0x2e219c[_0x0707('0x45')][_0x0707('0x47')]))){_0x2e219c[_0x0707('0x3e')]=_0x0707('0x43');throw _0x2e219c[_0x0707('0x40')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x19f114,_0x10b0a1,_0x2c5048){return{'action':_0x19f114,'response':_0x10b0a1,'message':_0x2c5048,'stack':_0x2c5048};}function myreject(_0x52232c){return function(_0x1348e3){return _0x52232c(msgResponse(_0x0707('0x48'),'Error',JSON[_0x0707('0x49')](_0x1348e3)));};}function getSeconds(_0x406dee,_0xd39a8c){var _0x587c2b=moment(_0x406dee)[_0x0707('0x4a')](0x0);var _0x4d093c=moment(_0xd39a8c)[_0x0707('0x4a')](0x0);return _0x587c2b[_0x0707('0x4b')](_0x4d093c,_0x0707('0x4c'));}function emit(_0x2d3bd6,_0x40cf83,_0x4318dc){io['to'](_0x2d3bd6)[_0x0707('0x4d')](_0x40cf83,_0x4318dc);}function emitVoiceQueueSummary(_0x23c13f){if(_0x23c13f[_0x0707('0x4e')]===_0x0707('0x4f')){var _0x4da7c={'id':_0x23c13f['id'],'name':_0x23c13f[_0x0707('0x40')],'strategy':_0x23c13f[_0x0707('0x50')],'answered':_0x23c13f[_0x0707('0x51')],'available':_0x23c13f[_0x0707('0x52')],'loggedIn':_0x23c13f[_0x0707('0x53')],'pTalking':_0x23c13f[_0x0707('0x54')],'sumBillable':_0x23c13f[_0x0707('0x55')],'sumDuration':_0x23c13f[_0x0707('0x56')],'sumHoldTime':_0x23c13f['sumHoldTime']||0x0,'talking':_0x23c13f[_0x0707('0x57')],'total':_0x23c13f[_0x0707('0x58')],'type':_0x23c13f[_0x0707('0x4e')],'unmanaged':_0x23c13f['unmanaged'],'abandoned':_0x23c13f['abandoned'],'waiting':_0x23c13f[_0x0707('0x59')],'loggedInDb':_0x23c13f[_0x0707('0x5a')],'dialActive':_0x23c13f['dialActive'],'dialMethod':_0x23c13f[_0x0707('0x5b')],'dialOriginateCallerIdName':_0x23c13f[_0x0707('0x5c')],'dialOriginateCallerIdNumber':_0x23c13f[_0x0707('0x5d')],'dialOriginateTimeout':_0x23c13f[_0x0707('0x5e')],'dialPrefix':_0x23c13f[_0x0707('0x5f')],'outboundAnswerAgiCallsDay':_0x23c13f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x23c13f[_0x0707('0x60')],'outboundBlacklistCallsDay':_0x23c13f[_0x0707('0x61')],'outboundBusyCallsDay':_0x23c13f[_0x0707('0x62')],'outboundCongestionCallsDay':_0x23c13f['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x23c13f[_0x0707('0x63')],'outboundDropCallsDayCallersExit':_0x23c13f[_0x0707('0x64')],'outboundDropCallsDayTimeout':_0x23c13f[_0x0707('0x65')],'outboundNoAnswerCallsDay':_0x23c13f[_0x0707('0x66')],'outboundNoSuchCallsDay':_0x23c13f[_0x0707('0x67')],'outboundOriginateFailureCallsDay':_0x23c13f[_0x0707('0x68')],'outboundReCallsDay':_0x23c13f['outboundReCallsDay'],'outboundRejectCallsDay':_0x23c13f[_0x0707('0x69')],'outboundUnknownCallsDay':_0x23c13f[_0x0707('0x6a')],'predictiveIntervalAnsweredCalls':_0x23c13f[_0x0707('0x6b')],'predictiveIntervalAvgHoldtime':_0x23c13f[_0x0707('0x6c')],'predictiveIntervalAvgTalktime':_0x23c13f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x23c13f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x23c13f[_0x0707('0x6d')],'predictiveIntervalErlangCalls':_0x23c13f[_0x0707('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x23c13f[_0x0707('0x6f')],'predictiveIntervalHitRate':_0x23c13f[_0x0707('0x70')],'predictiveIntervalMultiplicativeFactor':_0x23c13f[_0x0707('0x71')],'predictiveIntervalPauses':_0x23c13f[_0x0707('0x72')],'predictiveIntervalAvailable':_0x23c13f[_0x0707('0x73')],'predictiveIntervalTotalCalls':_0x23c13f[_0x0707('0x74')],'message':_0x23c13f[_0x0707('0x3e')],'originated':_0x23c13f[_0x0707('0x75')],'erlangCalls':_0x23c13f[_0x0707('0x76')],'erlangCallToSecond':_0x23c13f['erlangCallToSecond'],'erlangAbandonmentRate':_0x23c13f[_0x0707('0x77')],'erlangBusyFactor':_0x23c13f[_0x0707('0x78')],'startPredictive':_0x23c13f[_0x0707('0x79')],'startProgressive':_0x23c13f['startProgressive']};if(_0x23c13f[_0x0707('0x7a')]){_0x4da7c[_0x0707('0x7a')]={'id':_0x23c13f[_0x0707('0x7a')]['id'],'name':_0x23c13f[_0x0707('0x7a')][_0x0707('0x40')],'active':_0x23c13f[_0x0707('0x7a')][_0x0707('0x7b')],'callerid':_0x23c13f[_0x0707('0x7a')]['callerid']};}if(_0x23c13f[_0x0707('0x45')]){_0x4da7c[_0x0707('0x45')]={'id':_0x23c13f[_0x0707('0x45')]['id'],'name':_0x23c13f[_0x0707('0x45')][_0x0707('0x40')]};}var _0x5e5d53=md5(JSON[_0x0707('0x49')](_0x4da7c));if(_0x23c13f[_0x0707('0x7c')]!==_0x5e5d53){_0x23c13f[_0x0707('0x7c')]=_0x5e5d53;emit(util[_0x0707('0x7d')]('voice:queue:%s',_0x4da7c[_0x0707('0x40')]),'voice_queue:save',_0x4da7c);}}}function emitCampaignSummary(_0x1f8118){if(_0x1f8118[_0x0707('0x4e')]===_0x0707('0x7e')){emit(util[_0x0707('0x7d')]('campaign:ivr:%s',_0x1f8118[_0x0707('0x40')]),_0x0707('0x7f'),_0x1f8118);}}function checkGetDataPredictive(_0x38d3e1){if(isNotNull(_0x38d3e1)&&!_[_0x0707('0x46')](_0x38d3e1)){loggerPredictive[_0x0707('0x80')](_0x0707('0x81'));loggerPredictive['info'](_0x0707('0x82'),_0x38d3e1[_0x0707('0x74')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x83'),_0x38d3e1[_0x0707('0x6b')]);loggerPredictive[_0x0707('0x80')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38d3e1[_0x0707('0x6d')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x84'),_0x38d3e1[_0x0707('0x85')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x86'),_0x38d3e1['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x0707('0x80')](_0x0707('0x87'),_0x38d3e1[_0x0707('0x88')]);loggerPredictive['info'](_0x0707('0x89'));if(_0x38d3e1[_0x0707('0x74')]>0x0){if(!_['isUndefined'](_0x38d3e1['predictiveIntervalAvgTalktime'])&&_0x38d3e1[_0x0707('0x88')]>0x0){return!![];}loggerPredictive[_0x0707('0x80')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0707('0x3d')](_0x38d3e1[_0x0707('0x6c')])&&_0x38d3e1[_0x0707('0x6c')]>0x0){return!![];}loggerPredictive[_0x0707('0x80')](_0x0707('0x8a'));}else{loggerPredictive[_0x0707('0x80')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0707('0x80')](_0x0707('0x8b'));}return![];}function mergeDataErlangB(_0x130543){return function(_0x1d0147){loggerPredictive[_0x0707('0x80')](_0x0707('0x8c'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d0147[_0x0707('0x76')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x8d'),_0x1d0147[_0x0707('0x8e')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x8f'),_0x1d0147[_0x0707('0x77')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x90'),_0x1d0147[_0x0707('0x78')]);loggerPredictive[_0x0707('0x80')](_0x0707('0x8f'),_0x1d0147[_0x0707('0x77')]);loggerPredictive[_0x0707('0x80')]('---------------------------');_[_0x0707('0x91')](_0x130543,_0x1d0147);};}function getDiff(_0x424a8){var _0x474a52=moment()['milliseconds'](0x0);var _0x579128=moment(_0x424a8)['milliseconds'](0x0);return _0x474a52['diff'](_0x579128,_0x0707('0x4c'));}function ifInterval(_0x5e41b8,_0x50081c){if(_[_0x0707('0x3d')](_0x50081c)){return![];}return getDiff(_0x50081c)<_0x5e41b8*0x3c;}function freeVariablesPredictive(_0x4f895a){if(isNotNull(_0x4f895a)){if(!_[_0x0707('0x3d')](_0x4f895a[_0x0707('0x92')])){_0x4f895a[_0x0707('0x92')]=undefined;loggerPredictive[_0x0707('0x80')](_0x4f895a[_0x0707('0x40')],_0x0707('0x93'));}if(!_[_0x0707('0x3d')](_0x4f895a[_0x0707('0x79')])){_0x4f895a['startPredictive']=undefined;loggerPredictive[_0x0707('0x80')](_0x4f895a[_0x0707('0x40')],_0x0707('0x94'));}if(!_[_0x0707('0x3d')](_0x4f895a[_0x0707('0x95')])){clearInterval(_0x4f895a[_0x0707('0x95')]);_0x4f895a['handlePredictive']=undefined;loggerPredictive[_0x0707('0x80')](_0x4f895a[_0x0707('0x40')],_0x0707('0x96'));}}}function erlangb(_0x1c5ba2,_0x3b8679){if(_0x3b8679===0x0){return 0x0;}var _0x16c00c=0x1;for(var _0x444b0e=0x1;_0x444b0e<=_0x3b8679;_0x444b0e+=0x1){_0x16c00c=0x1+_0x16c00c*_0x444b0e/_0x1c5ba2;}return 0x1/_0x16c00c;}function isVoiceQueueOutbound(_0x5cb706){return _0x5cb706===_0x0707('0x4f');}function isNotPreview(_0xaa1f6e){return _0xaa1f6e!=='preview';}function isCampaignIvr(_0x36263b){return _0x36263b===_0x0707('0x7e');}function getCallerId(_0x22eaf1,_0x159d44,_0x144ec7){if(!_[_0x0707('0x3d')](_0x144ec7)&&typeof _0x144ec7===_0x0707('0x97')&&!_[_0x0707('0x46')](_0x144ec7)){if(!_[_0x0707('0x3d')](_0x159d44)&&typeof _0x159d44==='string'&&!_['isEmpty'](_0x159d44)){return util[_0x0707('0x7d')]('\x22%s\x22\x20<%s>',_0x159d44,_0x144ec7);}return util[_0x0707('0x7d')](_0x0707('0x98'),_0x144ec7,_0x144ec7);}if(!_['isUndefined'](_0x22eaf1)&&typeof _0x22eaf1===_0x0707('0x97')&&!_[_0x0707('0x46')](_0x22eaf1)){return _0x22eaf1;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1fc1f9,_0x324629){return function(_0xdee468){freeVariablesPredictive(_0x324629);emitVoiceQueueSummary(_0x324629);emitCampaignSummary(_0x324629);loggerSyncQueueSummary[_0x0707('0x99')](_0x1fc1f9,util['inspect'](_0xdee468,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1a8600,_0x5c183e){return function(_0x8848d7){loggerPredictive[_0x0707('0x99')](_0x5c183e[_0x0707('0x40')],_0x1a8600);loggerPredictive['error'](_0x8848d7[_0x0707('0x9a')]);freeVariablesPredictive(_0x5c183e);};}function loggerCatch(_0x311b12){return function(_0x1dd7f6){logger[_0x0707('0x99')](_0x311b12,util[_0x0707('0x9b')](_0x1dd7f6,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x50ee65){return _0x50ee65&&!_[_0x0707('0x3d')](_0x50ee65)&&_0x50ee65['length']>0x0;}function decremetOriginate(_0x4f5806){if(!_[_0x0707('0x3d')](_0x4f5806)&&_0x4f5806!==null){if(typeof _0x4f5806[_0x0707('0x75')]!==_0x0707('0x9c')){if(_0x4f5806[_0x0707('0x75')]>0x0){_0x4f5806[_0x0707('0x75')]-=0x1;}else{logger['error'](_0x0707('0x9d'));}}}else{logger[_0x0707('0x99')](_0x0707('0x9e'));}}function checkContactLowerLimitOriginate(_0x3f66d7,_0x51f54c,_0x31d556){if(_0x51f54c>_0x31d556){for(var _0x3e7851=0x0;_0x3e7851<_0x51f54c-_0x31d556;_0x3e7851+=0x1){decremetOriginate(_0x3f66d7);}}}function loggerGetContactDialer(_0xab635a,_0x3ad27f,_0x2597a9){return function(_0x447af4){checkContactLowerLimitOriginate(_0x3ad27f,_0x2597a9,0x0);logger['error'](_0xab635a,util['inspect'](_0x447af4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2f8dba){return function(_0x388469){if(isNotNull(_0x388469)&&isNotNull(_0x388469[0x0])){if(_0x388469[0x0][_0x0707('0x9f')]>0x0){_0x2f8dba[_0x0707('0x3e')]='RESCHEDULED_CONTACTS';logger[_0x0707('0x80')]('[getContactDialer2][ReScheduled]'+_0x2f8dba[_0x0707('0x40')],_0x388469[0x0][_0x0707('0x9f')],_0x0707('0xa0'));}else{_0x2f8dba[_0x0707('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x0707('0x80')]('[getContactDialer2][Empty]'+_0x2f8dba[_0x0707('0x40')]);}}};}function notSendMessagesQueue(_0x246ea7){if(_0x246ea7[_0x0707('0xa1')]){freeVariablesPredictive(_0x246ea7);if(_0x246ea7[_0x0707('0x75')]===0x0&&_0x246ea7[_0x0707('0x57')]===0x0&&_0x246ea7[_0x0707('0x59')]===0x0&&(_0x246ea7['pTalking']||0x0)===0x0){_0x246ea7['sendMessageOneNotActive']=![];_0x246ea7[_0x0707('0x52')]=0x0;_0x246ea7[_0x0707('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x0707('0x99')](_0x0707('0xa2'),_0x246ea7['name'],_0x0707('0xa3'));}else{_0x246ea7['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x0707('0x99')](_0x0707('0xa2'),_0x246ea7['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x246ea7);}}function notSendMessagesCampaign(_0xb49a75){if(_0xb49a75[_0x0707('0xa1')]){if(_0xb49a75[_0x0707('0x75')]===0x0){_0xb49a75[_0x0707('0xa1')]=![];_0xb49a75[_0x0707('0x3e')]=_0x0707('0x41');loggerSyncQueueSummary['error'](_0x0707('0xa4'),_0xb49a75[_0x0707('0x40')],_0x0707('0xa3'));}else{_0xb49a75[_0x0707('0x3e')]=_0x0707('0xa5');loggerSyncQueueSummary[_0x0707('0x99')](_0x0707('0xa4'),_0xb49a75[_0x0707('0x40')],_0x0707('0xa6'));}emitCampaignSummary(_0xb49a75);}}function createObjHistory(_0x378c41,_0x1c0dd0,_0x14b6d8,_0x4b9e69,_0x29468c){_0x378c41[_0x0707('0x3e')]=_0x14b6d8;var _0x587b56=new Action(_0x378c41,_0x1c0dd0);var _0x295104=new History(_0x587b56);_0x295104['state']=_0x4b9e69;_0x295104['statedesc']=_0x29468c;_0x295104['endtime']=_0x587b56[_0x0707('0xa7')];return _0x295104;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x5196c5=this;setInterval(function(){_0x5196c5[_0x0707('0xa8')](_0x5196c5[_0x0707('0x26')],_0x0707('0xa9'));_0x5196c5[_0x0707('0xa8')](_0x5196c5[_0x0707('0xaa')],_0x0707('0xab'));},0x32c8);};Dialer[_0x0707('0x19')][_0x0707('0xa8')]=function(_0x4b37ea,_0x785f68){var _0xc9f94f=this;for(var _0x424f3f in _0x4b37ea){if(typeof _0x4b37ea[_0x424f3f]!=='undefined'){this[_0x0707('0x1d')][_0x0707('0x1a')](function(){if(!_[_0x0707('0xac')](_0x4b37ea[_0x424f3f])){return ami[_0x0707('0xad')]({'action':_0x0707('0xae'),'channel':_0x4b37ea[_0x424f3f][_0x0707('0xaf')]})[_0x0707('0xb0')](function(_0x547311){if(_0x547311[_0x0707('0x3e')]===_0x0707('0xb1')){setTimeout(function(){if(_0x4b37ea[_0x424f3f]&&_0x4b37ea[_0x424f3f][_0x0707('0x4e')]!=='ivr'){_0xc9f94f['updateOriginated'](_0xc9f94f[_0x0707('0x1f')][_0x4b37ea[_0x424f3f][_0x0707('0xb2')]]);logger[_0x0707('0x99')](_0x0707('0xb3'),_0x785f68,_0x424f3f,_0x4b37ea[_0x424f3f][_0x0707('0xb2')]);delete _0x4b37ea[_0x424f3f];}if(_0x4b37ea[_0x424f3f]&&_0x4b37ea[_0x424f3f][_0x0707('0x4e')]===_0x0707('0x7e')){_0xc9f94f[_0x0707('0xb4')](_0xc9f94f[_0x0707('0x20')][_0x4b37ea[_0x424f3f][_0x0707('0xb2')]]);logger['error'](_0x0707('0xb5'),_0x785f68,_0x424f3f,_0x4b37ea[_0x424f3f][_0x0707('0xb2')]);delete _0x4b37ea[_0x424f3f];}},0x2328);}});}});}}};Dialer[_0x0707('0x19')][_0x0707('0xb6')]=function(_0x1ed1b8){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopper[_0x0707('0xb6')](_0x1ed1b8))[_0x0707('0xb0')](loggerCatch(_0x0707('0xb9')));};Dialer['prototype'][_0x0707('0xba')]=function(_0x5cbe8a){return BPromise['resolve']()['then'](cmHopperBlack[_0x0707('0xba')](_0x5cbe8a))[_0x0707('0xb0')](loggerCatch(_0x0707('0xbb')));};Dialer['prototype'][_0x0707('0xbc')]=function(_0x2a6325){return BPromise[_0x0707('0xb7')]()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x2a6325))[_0x0707('0xb0')](loggerCatch(_0x0707('0xbd')));};Dialer[_0x0707('0x19')][_0x0707('0xbe')]=function(_0x3868be){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopperHistory[_0x0707('0xbf')](_0x3868be))[_0x0707('0xb0')](loggerCatch(_0x0707('0xc0')));};Dialer[_0x0707('0x19')][_0x0707('0xc1')]=function(_0x39979a){return BPromise['resolve']()[_0x0707('0xb8')](cmHopper[_0x0707('0xc1')](_0x39979a))[_0x0707('0xb0')](loggerCatch(_0x0707('0xc2')));};Dialer[_0x0707('0x19')][_0x0707('0xc3')]=function(_0x577472,_0x39e244,_0x552507){return BPromise['resolve']()[_0x0707('0xb8')](cmHopper['unlockContact'](_0x577472,_0x39e244,_0x552507))[_0x0707('0xb0')](loggerCatch(_0x0707('0xc4')));};Dialer[_0x0707('0x19')][_0x0707('0xc5')]=function(_0x235062,_0x527307,_0x34a5cf,_0x4b85a1,_0x3fd41a){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopper[_0x0707('0xc5')](_0x235062,_0x527307,_0x34a5cf,_0x4b85a1))[_0x0707('0xb0')](function(_0x52be42){_0x3fd41a[_0x0707('0xc6')]-=_0x34a5cf;_0x3fd41a['temp']=_0x3fd41a[_0x0707('0xc6')]>0x0?_0x3fd41a[_0x0707('0xc6')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x52be42);});};Dialer['prototype']['getContactDialerIvr']=function(_0x14198b,_0x47f997,_0x14faa5,_0x4e1254){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopper[_0x0707('0xc7')](_0x14198b,_0x47f997,_0x14faa5))[_0x0707('0xb0')](function(_0x39d7e5){_0x4e1254[_0x0707('0xc6')]-=_0x47f997;_0x4e1254[_0x0707('0xc6')]=_0x4e1254[_0x0707('0xc6')]>0x0?_0x4e1254[_0x0707('0xc6')]:0x0;loggerCatch(_0x0707('0xc8'))(_0x39d7e5);});};Dialer[_0x0707('0x19')][_0x0707('0xc9')]=function(_0x2c1970){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](voiceQueueRt[_0x0707('0xc9')](_0x2c1970))[_0x0707('0xb0')](loggerCatch(_0x0707('0xca')));};Dialer[_0x0707('0x19')][_0x0707('0xcb')]=function(_0x52fa81){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopper['moveContactManagedDialer'](_0x52fa81))[_0x0707('0xb0')](loggerCatch(_0x0707('0xcc')));};Dialer[_0x0707('0x19')][_0x0707('0xcd')]=function(_0x3aa5d1){return BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](cmHopperHistory[_0x0707('0xcd')](_0x3aa5d1))[_0x0707('0xb0')](loggerCatch(_0x0707('0xce')));};Dialer[_0x0707('0x19')][_0x0707('0xb4')]=function(_0x1f977f){if(!_[_0x0707('0x3d')](_0x1f977f)&&_0x1f977f!==null){if(typeof _0x1f977f[_0x0707('0x75')]!=='undefined'){if(_0x1f977f[_0x0707('0x75')]>0x0){_0x1f977f[_0x0707('0x75')]-=0x1;}else{logger[_0x0707('0x99')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x0707('0xcf'));}};Dialer[_0x0707('0x19')]['loggerHandler']=function(_0x1ac7a7,_0x4c142d){var _0x499d0a=this;return function(_0x1888ee){_0x499d0a[_0x0707('0xb4')](_0x4c142d);logger['error'](_0x1ac7a7,util[_0x0707('0x9b')](_0x1888ee,{'showHidden':![],'depth':null}));};};Dialer[_0x0707('0x19')][_0x0707('0xd0')]=function(_0x9d285f,_0x5a0f15,_0x5ca408){var _0x4490b8={'state':0x19,'statedesc':_0x0707('0xd1')};this[_0x0707('0xb4')](_0x5a0f15);this[_0x0707('0xd2')](_[_0x0707('0x91')](_0x4490b8,_['pick'](_0x5ca408,[_0x0707('0xd3'),_0x0707('0xd4'),'UserId',_0x0707('0xd5'),_0x0707('0xd6')])),_0x0707('0xd7'),_0x0707('0xd8'));logger[_0x0707('0x99')](_0x9d285f);};Dialer[_0x0707('0x19')][_0x0707('0xd9')]=function(_0x1279ad){return _0x1279ad===_0x0707('0xda');};Dialer[_0x0707('0x19')]['isTrunkReachable']=function(_0x39625a){return!_[_0x0707('0x3d')](_0x39625a)&&_0x39625a&&!_['isUndefined'](_0x39625a[_0x0707('0x40')])&&!_[_0x0707('0x3d')](_0x39625a['active'])&&_0x39625a[_0x0707('0x7b')]&&(this[_0x0707('0x22')][util['format']('SIP/%s',_0x39625a[_0x0707('0x40')])][_0x0707('0xae')]==='reachable'||this[_0x0707('0x22')][util[_0x0707('0x7d')](_0x0707('0xdb'),_0x39625a[_0x0707('0x40')])][_0x0707('0xae')]===_0x0707('0xdc'));};Dialer[_0x0707('0x19')][_0x0707('0xd2')]=function(_0x47e4bf,_0x1ab23f,_0x4a48b0){this[_0x0707('0xcd')](_0x47e4bf)['catch'](loggerCatch(_0x1ab23f));this[_0x0707('0xcb')](_0x47e4bf)[_0x0707('0xb0')](loggerCatch(_0x4a48b0));};Dialer[_0x0707('0x19')][_0x0707('0x37')]=function(_0x5d95fa){var _0x511d8a=this[_0x0707('0x26')][_0x5d95fa[_0x0707('0xdd')]];var _0x4743d5;if(!_[_0x0707('0xac')](_0x5d95fa)&&!_[_0x0707('0xac')](_0x5d95fa[_0x0707('0xde')])&&!_[_0x0707('0xac')](_0x5d95fa[_0x0707('0xde')][_0x0707('0xdf')])&&_0x5d95fa[_0x0707('0xe0')]===_0x0707('0xe1')&&_0x511d8a){if(_0x511d8a[_0x0707('0x4e')]!=='ivr'&&this[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]]['dialAMDActive']&&_0x5d95fa['value']===_0x0707('0xe2')){delete this['uniqueId'][_0x5d95fa[_0x0707('0xdd')]];this[_0x0707('0xb4')](this['voiceQueues'][_0x511d8a[_0x0707('0xb2')]]);this[_0x0707('0x1f')][_0x511d8a['queue']][_0x0707('0x60')]+=0x1;this[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xe3')]+=0x1;_0x4743d5=new Hangup(_0x511d8a,_0x5d95fa);_0x4743d5[_0x0707('0xe4')]=0x12;_0x4743d5[_0x0707('0xe5')]='HangupInAMD';_0x4743d5[_0x0707('0xe6')]=_0x0707('0xe7');ami['emit'](_0x0707('0xe8'),ut[_0x0707('0xe9')](_0x4743d5,_0x0707('0xea')));this[_0x0707('0xd2')](_0x4743d5,_0x0707('0xeb'),'[syncHangupInAMD]');}if(_0x511d8a[_0x0707('0x4e')]!=='ivr'&&this[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xec')]&&_0x5d95fa[_0x0707('0xed')]===_0x0707('0xee')){var _0x2337d8=this;return new BPromise(function(_0x588fa9,_0x3bd555){delete _0x2337d8[_0x0707('0x26')][_0x5d95fa[_0x0707('0xdd')]];_0x2337d8['updateOriginated'](_0x2337d8[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]]);_0x2337d8[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0x60')]+=0x1;_0x2337d8[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xe3')]+=0x1;var _0x45373a=_0x2337d8[_0x0707('0x1f')][_0x511d8a[_0x0707('0xb2')]];var _0x17a3ea=new Hangup(_0x511d8a,_0x5d95fa);_0x17a3ea[_0x0707('0xe4')]=0x13;_0x17a3ea[_0x0707('0xe5')]=_0x0707('0xef');_0x17a3ea['membername']=_0x0707('0xe7');_0x17a3ea['countmachineretry']+=0x1;_0x17a3ea[_0x0707('0xf0')]+=0x1;_0x17a3ea[_0x0707('0xea')]=!![];ami['emit'](_0x0707('0xe8'),ut[_0x0707('0xe9')](_0x17a3ea,_0x0707('0xea')));_0x2337d8[_0x0707('0xcd')](_0x17a3ea)[_0x0707('0xb0')](loggerCatch(_0x0707('0xf1')));if(_0x17a3ea[_0x0707('0xf2')]+_0x17a3ea['countcongestionretry']+_0x17a3ea[_0x0707('0xf3')]+_0x17a3ea[_0x0707('0xf4')]+_0x17a3ea[_0x0707('0xf5')]+_0x17a3ea[_0x0707('0xf6')]+_0x17a3ea[_0x0707('0xf7')]+_0x17a3ea[_0x0707('0xf8')]>=_0x45373a[_0x0707('0xf9')]){_0x2337d8[_0x0707('0xfa')](_0x17a3ea,_0x588fa9,_0x3bd555,_0x0707('0xfb'));}else{if(_0x17a3ea[_0x0707('0xf7')]>=_0x45373a[_0x0707('0xfc')]){_0x2337d8[_0x0707('0xfd')](_0x17a3ea,_0x588fa9,_0x3bd555,'reason\x2019\x20machine....');}else{_0x2337d8[_0x0707('0xc1')]({'active':![],'countmachineretry':_0x17a3ea['countmachineretry'],'scheduledat':moment()[_0x0707('0xfe')](_0x45373a[_0x0707('0xff')],_0x0707('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17a3ea[_0x0707('0xd3')],'ListId':_0x17a3ea['ListId'],'VoiceQueueId':_0x17a3ea['VoiceQueueId']||undefined,'CampaignId':_0x17a3ea[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x101')));_0x588fa9({'reschedule':0x1});}}});}if(_0x511d8a[_0x0707('0x4e')]==='ivr'&&this[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xec')]&&_0x5d95fa[_0x0707('0xed')]===_0x0707('0xe2')){delete this[_0x0707('0x26')][_0x5d95fa['uniqueid']];this[_0x0707('0xb4')](this[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]]);_0x4743d5=new Hangup(_0x511d8a,_0x5d95fa);_0x4743d5[_0x0707('0xe4')]=0x12;_0x4743d5[_0x0707('0xe5')]='HangupInAMD';_0x4743d5[_0x0707('0xe6')]='AMD';ami[_0x0707('0x4d')]('custom:amd',ut[_0x0707('0xe9')](_0x4743d5,_0x0707('0xea')));this[_0x0707('0xd2')](_0x4743d5,_0x0707('0x102'),'[syncHangupInAMDIvr]');}if(_0x511d8a[_0x0707('0x4e')]===_0x0707('0x7e')&&this[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xec')]&&_0x5d95fa[_0x0707('0xed')]===_0x0707('0xee')){var _0x2337d8=this;return new BPromise(function(_0x374e5c,_0x59a619){delete _0x2337d8[_0x0707('0x26')][_0x5d95fa['uniqueid']];_0x2337d8[_0x0707('0xb4')](_0x2337d8[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]]);_0x2337d8[_0x0707('0x20')][_0x511d8a['queue']][_0x0707('0x60')]+=0x1;_0x2337d8[_0x0707('0x20')][_0x511d8a[_0x0707('0xb2')]][_0x0707('0xe3')]+=0x1;var _0x4e37b1=_0x2337d8[_0x0707('0x20')][_0x511d8a['queue']];var _0x553304=new Hangup(_0x511d8a,_0x5d95fa);_0x553304[_0x0707('0xe4')]=0x13;_0x553304[_0x0707('0xe5')]='Machine';_0x553304['membername']=_0x0707('0xe7');_0x553304[_0x0707('0xf7')]+=0x1;_0x553304[_0x0707('0xf0')]+=0x1;_0x553304[_0x0707('0xea')]=!![];ami[_0x0707('0x4d')](_0x0707('0xe8'),ut[_0x0707('0xe9')](_0x553304,'amd'));_0x2337d8[_0x0707('0xcd')](_0x553304)[_0x0707('0xb0')](loggerCatch(_0x0707('0xf1')));if(_0x553304[_0x0707('0xf2')]+_0x553304[_0x0707('0x103')]+_0x553304['countnoanswerretry']+_0x553304[_0x0707('0xf4')]+_0x553304[_0x0707('0xf5')]+_0x553304[_0x0707('0xf6')]+_0x553304['countmachineretry']+_0x553304['countagentrejectretry']>=_0x4e37b1['dialGlobalMaxRetry']){_0x2337d8[_0x0707('0xfa')](_0x553304,_0x374e5c,_0x59a619,_0x0707('0xfb'));}else{if(_0x553304[_0x0707('0xf7')]>=_0x4e37b1[_0x0707('0xfc')]){_0x2337d8[_0x0707('0xfd')](_0x553304,_0x374e5c,_0x59a619,_0x0707('0x104'));}else{_0x2337d8[_0x0707('0xc1')]({'active':![],'countmachineretry':_0x553304[_0x0707('0xf7')],'scheduledat':moment()[_0x0707('0xfe')](_0x4e37b1[_0x0707('0xff')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x553304[_0x0707('0xd3')],'ListId':_0x553304[_0x0707('0xd4')],'VoiceQueueId':_0x553304['VoiceQueueId']||undefined,'CampaignId':_0x553304[_0x0707('0xd6')]||undefined})['catch'](loggerCatch(_0x0707('0x101')));_0x374e5c({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x0707('0x33')]=function(_0x57bacc){var _0x5660b1=this[_0x0707('0x26')][_0x57bacc[_0x0707('0xdd')]];var _0x1a63df=this;var _0x8a0102;if(_0x5660b1&&_0x5660b1[_0x0707('0x4e')]===_0x0707('0x7e')){delete this[_0x0707('0x26')][_0x57bacc['uniqueid']];this[_0x0707('0xb4')](this[_0x0707('0x20')][_0x5660b1[_0x0707('0xb2')]]);this['campaigns'][_0x5660b1['queue']][_0x0707('0x106')]+=0x1;_0x8a0102=new Hangup(_0x5660b1,_0x57bacc);this[_0x0707('0xcd')](_0x8a0102)[_0x0707('0xb0')](loggerCatch(_0x0707('0x107')));this[_0x0707('0xcb')](_0x8a0102)[_0x0707('0xb0')](loggerCatch(_0x0707('0x108')));}if(_0x5660b1&&_0x5660b1[_0x0707('0x4e')]!==_0x0707('0x7e')&&isNotNull(this['voiceQueues'][_0x5660b1['queue']]['dialQueueProject'])){delete this[_0x0707('0x26')][_0x57bacc['uniqueid']];this[_0x0707('0xb4')](this[_0x0707('0x1f')][_0x5660b1[_0x0707('0xb2')]]);this['voiceQueues'][_0x5660b1['queue']][_0x0707('0x60')]+=0x1;this[_0x0707('0x1f')][_0x5660b1['queue']][_0x0707('0xe3')]+=0x1;_0x8a0102=new Hangup(_0x5660b1,_0x57bacc);_0x8a0102[_0x0707('0xe4')]=0x10;_0x8a0102[_0x0707('0xe5')]=_0x0707('0x109');_0x8a0102[_0x0707('0xe6')]=_0x0707('0x10a');this['createHistory'](_0x8a0102)['catch'](loggerCatch(_0x0707('0x107')));this[_0x0707('0xcb')](_0x8a0102)[_0x0707('0xb0')](loggerCatch('[syncHangupIvr]'));}if(_0x5660b1&&_0x5660b1[_0x0707('0x4e')]!=='ivr'&&!isNotNull(this[_0x0707('0x1f')][_0x5660b1['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x57bacc[_0x0707('0xdd')]];this[_0x0707('0xb4')](this[_0x0707('0x1f')][_0x5660b1[_0x0707('0xb2')]]);this['voiceQueues'][_0x5660b1[_0x0707('0xb2')]][_0x0707('0x6a')]+=0x1;_0x8a0102=new Hangup(_0x5660b1,_0x57bacc);_0x8a0102[_0x0707('0xe4')]=0xc;_0x8a0102[_0x0707('0xe5')]=_0x57bacc[_0x0707('0x10b')];_0x8a0102[_0x0707('0xe6')]=_0x0707('0x10c');this[_0x0707('0xcd')](_0x8a0102)[_0x0707('0xb0')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0707('0xcb')](_0x8a0102)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x0707('0x19')][_0x0707('0x31')]=function(_0xa5befd){var _0x1b7640=this[_0x0707('0x26')][_0xa5befd[_0x0707('0xdd')]];var _0x20f2d4=this;if(this[_0x0707('0x1f')][_0xa5befd[_0x0707('0xb2')]]){if(_0x1b7640&&_0x1b7640['type']!==_0x0707('0x7e')){delete this[_0x0707('0x26')][_0xa5befd['uniqueid']];this[_0x0707('0x1f')][_0xa5befd['queue']][_0x0707('0x60')]+=0x1;var _0x459fe3=new AgentComplete(_0x1b7640,_0xa5befd);if(_0xa5befd['reason']===_0x0707('0x10d')){_0x459fe3[_0x0707('0x10e')]=this[_0x0707('0x1f')][_0xa5befd['queue']][_0x0707('0x10f')]&&this[_0x0707('0x1f')][_0xa5befd[_0x0707('0xb2')]][_0x0707('0x110')]?moment()[_0x0707('0x7d')](_0x0707('0x105')):undefined;}this[_0x0707('0xcd')](_0x459fe3)[_0x0707('0xb0')](loggerCatch(_0x0707('0x111')));this[_0x0707('0xcb')](_0x459fe3)[_0x0707('0xb0')](loggerCatch(_0x0707('0x112')));}}};Dialer[_0x0707('0x19')]['syncAgentConnect']=function(_0x302fa6){if(this[_0x0707('0x1f')][_0x302fa6[_0x0707('0xb2')]]){if(this[_0x0707('0x26')][_0x302fa6[_0x0707('0xdd')]]&&this[_0x0707('0x26')][_0x302fa6['uniqueid']]['type']!=='ivr'){this[_0x0707('0xb4')](this[_0x0707('0x1f')][_0x302fa6[_0x0707('0xb2')]]);this[_0x0707('0x26')][_0x302fa6[_0x0707('0xdd')]]['answertime']=moment()['format'](_0x0707('0x105'));}}};Dialer[_0x0707('0x19')][_0x0707('0x113')]=function(_0x368c4d){this[_0x0707('0xcd')](_0x368c4d)[_0x0707('0xb0')](loggerCatch(_0x0707('0x111')));this['moveContactManagedDialer'](_0x368c4d)[_0x0707('0xb0')](loggerCatch(_0x0707('0x114')));};Dialer['prototype'][_0x0707('0x2c')]=function(_0x145da6){var _0x271c40=this['uniqueId'][_0x145da6['uniqueid']];var _0x445399=this;if(this[_0x0707('0x1f')][_0x145da6['queue']]){if(_0x271c40&&_0x271c40[_0x0707('0x4e')]!=='ivr'){delete this['uniqueId'][_0x145da6['uniqueid']];this[_0x0707('0xb4')](this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]]);_0x271c40['droptime']=moment()[_0x0707('0x7d')](_0x0707('0x105'));var _0x5de5cc=new QueueCallerAbandon(_0x271c40,_0x145da6);if(getSeconds(_0x271c40[_0x0707('0x115')],_0x271c40[_0x0707('0x116')])>=_0x271c40[_0x0707('0x117')]){this[_0x0707('0x1f')][_0x145da6['queue']][_0x0707('0x6d')]+=0x1;this[_0x0707('0x1f')][_0x145da6['queue']][_0x0707('0x65')]+=0x1;this[_0x0707('0x1f')][_0x145da6['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5de5cc[_0x0707('0xe4')]=0xa;_0x5de5cc['statedesc']='Drop';_0x5de5cc[_0x0707('0x118')]=_0x0707('0x119');_0x5de5cc[_0x0707('0x10e')]=this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x10f')]?moment()[_0x0707('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5de5cc['countdropretry']+=0x1;_0x5de5cc['countglobal']+=0x1;if(_0x5de5cc['countdropretry']>=this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x11a')]){this[_0x0707('0x113')](_0x5de5cc);}else{this[_0x0707('0xc1')]({'active':![],'countdropretry':_0x5de5cc[_0x0707('0xf5')],'scheduledat':moment()[_0x0707('0xfe')](this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x11b')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x271c40[_0x0707('0xd3')],'ListId':_0x271c40[_0x0707('0xd4')],'VoiceQueueId':_0x271c40['VoiceQueueId']||undefined,'CampaignId':_0x271c40[_0x0707('0xd6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x1a093a=new History(_0x5de5cc);_0x1a093a['state']=0xa;_0x1a093a[_0x0707('0xe5')]='Drop';_0x1a093a[_0x0707('0xa7')]=moment()['format'](_0x0707('0x105'));_0x1a093a['endtime']=_0x1a093a[_0x0707('0xa7')];_0x1a093a[_0x0707('0x11c')]=_0x5de5cc['calleridname'];_0x1a093a['calleridnum']=_0x5de5cc[_0x0707('0x11d')];this[_0x0707('0xcd')](_0x1a093a)[_0x0707('0xb0')](loggerCatch(_0x0707('0x11e')));}}else{this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x85')]+=0x1;this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5de5cc[_0x0707('0xe4')]=0xb;_0x5de5cc[_0x0707('0xe5')]=_0x0707('0x11f');_0x5de5cc[_0x0707('0x118')]='CALLEREXIT';_0x5de5cc[_0x0707('0xf6')]+=0x1;_0x5de5cc[_0x0707('0xf0')]+=0x1;if(_0x5de5cc[_0x0707('0xf6')]>=this['voiceQueues'][_0x145da6[_0x0707('0xb2')]][_0x0707('0x120')]){this[_0x0707('0x113')](_0x5de5cc);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x5de5cc[_0x0707('0xf6')],'scheduledat':moment()[_0x0707('0xfe')](this[_0x0707('0x1f')][_0x145da6[_0x0707('0xb2')]][_0x0707('0x121')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x271c40[_0x0707('0xd3')],'ListId':_0x271c40[_0x0707('0xd4')],'VoiceQueueId':_0x271c40[_0x0707('0xd5')]||undefined,'CampaignId':_0x271c40['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x122')));var _0x1a093a=new History(_0x5de5cc);_0x1a093a['state']=0xb;_0x1a093a[_0x0707('0xe5')]=_0x0707('0x11f');_0x1a093a['starttime']=moment()[_0x0707('0x7d')](_0x0707('0x105'));_0x1a093a['endtime']=_0x1a093a[_0x0707('0xa7')];_0x1a093a[_0x0707('0x11c')]=_0x5de5cc[_0x0707('0x11c')];_0x1a093a[_0x0707('0x11d')]=_0x5de5cc[_0x0707('0x11d')];this[_0x0707('0xcd')](_0x1a093a)[_0x0707('0xb0')](loggerCatch(_0x0707('0x123')));}}}}};Dialer[_0x0707('0x19')]['syncNewExten']=function(_0x50467d){if(this[_0x0707('0xaa')][_0x50467d[_0x0707('0xdd')]]){this['actions'][_0x50467d[_0x0707('0xdd')]][_0x0707('0xaf')]=_0x50467d[_0x0707('0xaf')];}if(this[_0x0707('0x26')][_0x50467d[_0x0707('0xdd')]]){this[_0x0707('0x26')][_0x50467d[_0x0707('0xdd')]][_0x0707('0xaf')]=_0x50467d[_0x0707('0xaf')];}};Dialer[_0x0707('0x19')][_0x0707('0x39')]=function(_0x12bb89){if(strategy[this[_0x0707('0x1f')][this['actions'][_0x12bb89[_0x0707('0x124')]]['queue']][_0x0707('0x50')]]===_0x0707('0x18')){if(this[_0x0707('0xaa')][_0x12bb89['actionid']]&&_[_0x0707('0xac')](this[_0x0707('0xaa')][_0x12bb89['actionid']][_0x0707('0x125')])&&_0x12bb89[_0x0707('0xae')]==='1'&&_0x12bb89[_0x0707('0x126')]==='0'){if(this[_0x0707('0x21')][_0x12bb89[_0x0707('0x127')]]){if(!this['agents'][_0x12bb89[_0x0707('0x127')]][_0x0707('0x125')]){this[_0x0707('0x21')][_0x12bb89[_0x0707('0x127')]]['locked']=!![];this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0x125')]=!![];this[_0x0707('0xaa')][_0x12bb89['actionid']][_0x0707('0x127')]=_0x12bb89[_0x0707('0x127')];}}}}else if((strategy[this[_0x0707('0x1f')][this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0xb2')]][_0x0707('0x50')]]||'rrmemory')==='rrmemory'){if(this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]]){if(this[_0x0707('0x21')][_0x12bb89[_0x0707('0x127')]]){this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0x127')]=_0x12bb89[_0x0707('0x127')];if(_[_0x0707('0xac')](this[_0x0707('0x28')][this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0xb2')]])){this[_0x0707('0x28')][this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]][_0x0707('0xb2')]]=[];}this['queueBooked'][this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]]['queue']][_0x0707('0x128')](_[_0x0707('0x91')](_[_0x0707('0x129')](this[_0x0707('0xaa')][_0x12bb89[_0x0707('0x124')]],[_0x0707('0x12a'),_0x0707('0x127')]),{'status':_0x12bb89['status'],'paused':_0x12bb89['paused']}));}}}};function unlockQueueStatus(_0x10f46a,_0xe8f959){setTimeout(function(){if(_[_0x0707('0x3d')](_0x10f46a[_0x0707('0x12b')])){loggerBooked[_0x0707('0x99')]('[unlockQueueStatus][undefined]',_0xe8f959);}_0x10f46a['queueStatusComplete']=!![];loggerBooked[_0x0707('0x80')]('[booked][unlockQueueStatus]',_0xe8f959,JSON[_0x0707('0x49')](_[_0x0707('0x129')](_0x10f46a,[_0x0707('0x40'),_0x0707('0x12b')])));},0x1f3);}Dialer[_0x0707('0x19')][_0x0707('0x3b')]=function(_0x5dc02f){var _0x4609d8=this;var _0x48e586=_0x4609d8[_0x0707('0x1f')][_0x4609d8[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]];if(strategy[this[_0x0707('0x1f')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]][_0x0707('0x50')]]===_0x0707('0x18')){if(this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]]&&this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0x127')]){this['preview'][_0x0707('0x12c')](this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0x12a')],this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0x127')])['catch'](function(_0x32d744){logger[_0x0707('0x99')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x0707('0x9b')](_0x32d744,{'showHidden':![],'depth':null}));})[_0x0707('0x1c')](function(){_0x4609d8[_0x0707('0xb4')](_0x4609d8[_0x0707('0x1f')][_0x4609d8[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]]);_0x4609d8[_0x0707('0x21')][_0x4609d8[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0x127')]][_0x0707('0x125')]=![];delete _0x4609d8['actions'][_0x5dc02f['actionid']];unlockQueueStatus(_0x48e586);});}else{this['updateOriginated'](this[_0x0707('0x1f')][this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]]);this[_0x0707('0xc1')]({'active':![],'ContactId':this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xd3')],'ListId':this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xd4')],'VoiceQueueId':this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xd5')]||undefined,'CampaignId':this['actions'][_0x5dc02f['actionid']]['CampaignId']||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x5dc02f[_0x0707('0x124')]];unlockQueueStatus(_0x48e586);}}else if((strategy[this[_0x0707('0x1f')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]]['queue']][_0x0707('0x50')]]||'rrmemory')===_0x0707('0x17')){var _0x356452;if(this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]]&&!_[_0x0707('0x46')](this['queueBooked'][this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]])){if(this[_0x0707('0x29')][_0x4609d8[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]]){this['queueBookedRR'][_0x4609d8['actions'][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]]=this[_0x0707('0x29')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]]?this[_0x0707('0x29')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]]:this['queueBooked'][this['actions'][_0x5dc02f[_0x0707('0x124')]]['queue']]?this['queueBooked'][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]][_0x0707('0x12d')]||0x0:0x0;}this[_0x0707('0x28')][this[_0x0707('0xaa')][_0x5dc02f[_0x0707('0x124')]][_0x0707('0xb2')]][_0x0707('0x12d')]=this[_0x0707('0x29')][this[_0x0707('0xaa')][_0x5dc02f['actionid']][_0x0707('0xb2')]];for(var _0x3ce3f5=0x0;_0x3ce3f5=0x0;})[_0x0707('0xb0')](myreject(_0x5f34c9)));}}else{_0x39059c[_0x0707('0x128')](ami['Action']({'action':_0x0707('0x148'),'command':util[_0x0707('0x7d')](_0x0707('0x14b'),_0x34376e,!_['isUndefined'](config['timezones'][_0x32735d])?_0x32735d:'')})['then'](function(_0x5510a5){return _0x5510a5[_0x0707('0x14c')][_0x0707('0x149')](_0x0707('0x14a'))>=0x0;})[_0x0707('0xb0')](myreject(_0x5f34c9)));}BPromise[_0x0707('0x14d')](_0x39059c)[_0x0707('0xb8')](function(_0x5b6677){var _0xe9deb3=_[_0x0707('0x14e')](_0x5b6677);if(_0xe9deb3){return _0x3f03d0(_0xe9deb3);}else{_0x561891[_0x0707('0x3e')]=_0x3df920?_0x0707('0x14f'):_0x0707('0x150');return _0x5f34c9(msgResponse(_0x0707('0x151'),'Failure',_0x0707('0x152')+_0x3df920+'\x20'+_0xab2bba+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0707('0x9b')](_0x34376e,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x32735d));}})[_0x0707('0xb0')](function(_0x5b22b5){return _0x5f34c9(msgResponse(_0x0707('0x140'),_0x0707('0x142'),JSON[_0x0707('0x49')](_0x5b22b5)));});});};Dialer[_0x0707('0x19')][_0x0707('0x153')]=function(_0x495c9f){var _0x4a4d97=this;return function(){switch(_0x495c9f[_0x0707('0x5b')]){case _0x0707('0x154'):freeVariablesPredictive(_0x495c9f);_0x4a4d97['handlePower'](_0x495c9f,0x1);break;case _0x0707('0x155'):freeVariablesPredictive(_0x495c9f);_0x4a4d97['handlePower'](_0x495c9f,_0x495c9f['dialPowerLevel']);break;case _0x0707('0x156'):_0x4a4d97[_0x0707('0x156')](_0x495c9f);break;case _0x0707('0x6'):freeVariablesPredictive(_0x495c9f);_0x4a4d97[_0x0707('0x157')](_0x495c9f,0x1);break;default:freeVariablesPredictive(_0x495c9f);logger['error'](_0x0707('0x158'),_0x495c9f[_0x0707('0x40')],_0x0707('0x159'));}};};Dialer['prototype'][_0x0707('0x15a')]=function(_0x1097cc){var _0x5c98a5=this;return function(){_0x5c98a5[_0x0707('0x15b')](_0x1097cc);};};Dialer['prototype']['syncQueueSummary']=function(_0x427eb1){var _0x35682d=this;if(isNotPreview(_0x427eb1[_0x0707('0x5b')])){if(isVoiceQueueOutbound(_0x427eb1[_0x0707('0x4e')])&&isActive(_0x427eb1[_0x0707('0x15c')])){_0x427eb1['sendMessageOneNotActive']=!![];BPromise[_0x0707('0xb7')]()[_0x0707('0xb8')](checkIsLoggedIn(_0x427eb1,_0x427eb1['loggedIn']))[_0x0707('0xb8')](checkIsActive(_0x427eb1,_0x427eb1[_0x0707('0x15c')]))['then'](checkInterval(_0x427eb1))[_0x0707('0xb8')](_0x35682d[_0x0707('0x13a')](_0x427eb1))[_0x0707('0xb8')](_0x35682d[_0x0707('0x13f')](_0x427eb1[_0x0707('0x15d')],_0x427eb1[_0x0707('0x15e')],_0x427eb1[_0x0707('0x40')],_0x427eb1))['then'](_0x35682d['checkIfTimeIntervals'](_0x427eb1[_0x0707('0x45')],_0x427eb1['dialTimezone'],_0x427eb1[_0x0707('0x40')],_0x427eb1))[_0x0707('0xb8')](_0x35682d[_0x0707('0x153')](_0x427eb1))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x427eb1));}else{notSendMessagesQueue(_0x427eb1);}}else{freeVariablesPredictive(_0x427eb1);}};Dialer['prototype'][_0x0707('0x139')]=function(){var _0x374326=this;var _0x137985;for(var _0x1a996b in this['campaigns']){if(typeof this[_0x0707('0x20')][_0x1a996b]!==_0x0707('0x9c')){_0x137985=this['campaigns'][_0x1a996b];if(isCampaignIvr(_0x137985[_0x0707('0x4e')])&&isActive(_0x137985['active'])){_0x137985[_0x0707('0xa1')]=!![];BPromise[_0x0707('0xb7')]()['then'](checkIsActive(_0x137985,_0x137985['active']))[_0x0707('0xb8')](checkInterval(_0x137985))[_0x0707('0xb8')](_0x374326[_0x0707('0x13a')](_0x137985))[_0x0707('0xb8')](_0x374326[_0x0707('0x13f')](_0x137985['dialGlobalInterval'],_0x137985[_0x0707('0x15e')],_0x137985[_0x0707('0x40')],_0x137985))[_0x0707('0xb8')](_0x374326[_0x0707('0x141')](_0x137985[_0x0707('0x45')],_0x137985[_0x0707('0x15e')],_0x137985[_0x0707('0x40')],_0x137985))[_0x0707('0xb8')](_0x374326[_0x0707('0x15a')](_0x137985))[_0x0707('0xb0')](loggerCatchQueueSummary(_0x0707('0x15f'),_0x137985));}else{notSendMessagesCampaign(_0x137985);}}}};function getCallerIdRandom(_0x5c0522,_0x24e006){var _0x50681a;var _0x13c9ff;var _0x7fa3a4;if(_0x24e006<=0x0){_0x24e006=0x1;}_0x50681a=new RegExp(_0x0707('0x160')+_0x24e006+'}$');_0x13c9ff=Math[_0x0707('0x161')](0xa,_0x24e006-0x1);_0x7fa3a4=Math[_0x0707('0x161')](0xa,_0x24e006)-0x1;return util[_0x0707('0x7d')]('%s',_[_0x0707('0x162')](_0x5c0522,_0x50681a,_['random'](_0x13c9ff,_0x7fa3a4)));}function extractCalleridName(_0x792b1b){var _0x4e4a6f=_0x792b1b[_0x0707('0x163')](/"(.*?)"/);return _0x4e4a6f?_0x4e4a6f[0x1]:_0x792b1b;}function extractCalleridNumber(_0x2d2f0f){var _0x3911d1=_0x2d2f0f[_0x0707('0x163')](/<(.*?)>/);return _0x3911d1?_0x3911d1[0x1]:_0x2d2f0f;}Dialer[_0x0707('0x19')][_0x0707('0x164')]=function(_0x1715d9,_0x4c9f1f){var _0x2e3559=this;var _0x5a38ec=uuid['v4']();this[_0x0707('0xaa')][_0x5a38ec]=new Action(_0x1715d9,_0x4c9f1f,_0x5a38ec);return new BPromise(function(_0x55f2be,_0x1416b3){if(_[_0x0707('0x3d')](_0x1715d9)&&typeof _0x1715d9!==_0x0707('0x165')){return _0x1416b3(msgResponse(_0x0707('0x166'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x0707('0x3d')](_0x4c9f1f[_0x0707('0x167')][_0x0707('0x168')])||_0x4c9f1f['Contact'][_0x0707('0x168')]===null){return _0x1416b3(msgResponse(_0x0707('0x166'),_0x0707('0x142'),_0x0707('0x169')));}var _0x1ceb1d={'XMD-CALLERID':_0x2e3559[_0x0707('0xaa')][_0x5a38ec][_0x0707('0x16a')](),'XMD-AGI':_0x1715d9[_0x0707('0x16b')]?util['format'](_0x0707('0x16c'),ipAgi,_0x1715d9['dialQueueProject']):_0x0707('0x16d'),'XMD-AGIAFTER':_0x1715d9[_0x0707('0x10f')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x1715d9[_0x0707('0x10f')]):_0x0707('0x16d'),'XMD-QUEUE':_0x1715d9[_0x0707('0x4e')]===_0x0707('0x4f')?util[_0x0707('0x7d')](_0x0707('0x16e'),_0x1715d9[_0x0707('0x40')],_0x1715d9[_0x0707('0x16f')]||'',_0x1715d9[_0x0707('0x110')]?'c':'',_0x1715d9['dialQueueTimeout']||0x3):_0x0707('0x16d'),'XMD-CONTACTID':_0x4c9f1f[_0x0707('0xd3')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2e3559[_0x0707('0xaa')][_0x5a38ec][_0x0707('0x16a')](),'XMD-AMD':_0x1715d9[_0x0707('0xec')]?'ACTIVE':_0x0707('0x16d'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x1715d9['dialAMDActive']){_0x1ceb1d['XMD-AMDINITIALSILENCE']=_0x1715d9[_0x0707('0x170')]||0x9c4;_0x1ceb1d['XMD-AMDGREETING']=_0x1715d9['dialAMDGreeting']||0x5dc;_0x1ceb1d[_0x0707('0x171')]=_0x1715d9[_0x0707('0x172')]||0x320;_0x1ceb1d['XMD-AMDTOTALANALYSISTIME']=_0x1715d9[_0x0707('0x173')]||0x1388;_0x1ceb1d[_0x0707('0x174')]=_0x1715d9[_0x0707('0x175')]||0x64;_0x1ceb1d[_0x0707('0x176')]=_0x1715d9[_0x0707('0x177')]||0x32;_0x1ceb1d['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x1715d9['dialAMDMaximumNumberOfWords']||0x3;_0x1ceb1d[_0x0707('0x178')]=_0x1715d9['dialAMDSilenceThreshold']||0x100;_0x1ceb1d['XMD-AMDMAXIMUMWORDLENGTH']=_0x1715d9[_0x0707('0x179')]||0x1388;}if(_0x1715d9[_0x0707('0x4e')]===_0x0707('0x4f')){_0x1ceb1d[_0x0707('0x17a')]=_0x4c9f1f[_0x0707('0xd5')];}else{_0x1ceb1d[_0x0707('0x17b')]=_0x4c9f1f['CampaignId'];}for(var _0x2da294 in _0x4c9f1f[_0x0707('0x167')]){if(typeof _0x4c9f1f[_0x0707('0x167')][_0x2da294]!=='undefined'){if(isNotNull(_0x4c9f1f[_0x0707('0x167')][_0x2da294])&&_0x2da294!=='id'&&_0x2da294!=='tags'&&_0x2da294!=='createdAt'&&_0x2da294!==_0x0707('0x17c')){_0x1ceb1d[util[_0x0707('0x7d')]('%s%s',_0x0707('0x17d'),_[_0x0707('0x17e')](_0x2da294))]=_0x4c9f1f['Contact'][_0x2da294];}}}var _0x5f55f2=_0x2e3559[_0x0707('0x13b')](_0x1715d9[_0x0707('0x7a')])?getCallerId(_0x1715d9[_0x0707('0x7a')][_0x0707('0x17f')],_0x1715d9[_0x0707('0x5c')],_0x1715d9[_0x0707('0x180')]>0x0?getCallerIdRandom(_0x1715d9[_0x0707('0x5d')],_0x1715d9['dialRandomLastDigitCallerIdNumber']):_0x1715d9['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x1715d9[_0x0707('0x13c')])?_0x1715d9['Trunk'][_0x0707('0x17f')]:_0x1715d9['TrunkBackup'][_0x0707('0x17f')],_0x1715d9[_0x0707('0x5c')],_0x1715d9['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1715d9[_0x0707('0x5d')],_0x1715d9['dialRandomLastDigitCallerIdNumber']):_0x1715d9[_0x0707('0x5d')]);if(_0x5f55f2){_0x1ceb1d[_0x0707('0x181')]=_0x2e3559[_0x0707('0xaa')][_0x5a38ec][_0x0707('0x182')]=extractCalleridName(_0x5f55f2);_0x1ceb1d['XMD-ORIGINATECALLERIDNUM']=_0x2e3559['actions'][_0x5a38ec]['originatecalleridnum']=extractCalleridNumber(_0x5f55f2);}return ami['Action']({'actionid':_0x5a38ec,'action':_0x0707('0x166'),'channel':_0x2e3559['isTrunkReachable'](_0x1715d9[_0x0707('0x7a')])?util[_0x0707('0x7d')](_0x0707('0x183'),_0x1715d9[_0x0707('0x7a')][_0x0707('0x40')],isNotNull(_0x1715d9[_0x0707('0x5f')])?_0x1715d9[_0x0707('0x5f')]['trim']()||'':'',_0x1715d9[_0x0707('0x184')]>0x0?_0x4c9f1f[_0x0707('0x167')]['phone'][_0x0707('0x185')](_0x1715d9['dialCutDigit']):_0x4c9f1f[_0x0707('0x167')][_0x0707('0x168')]):util[_0x0707('0x7d')](_0x0707('0x183'),_[_0x0707('0xac')](_0x1715d9[_0x0707('0x13c')])?_0x1715d9[_0x0707('0x7a')][_0x0707('0x40')]:_0x1715d9[_0x0707('0x13c')][_0x0707('0x40')],isNotNull(_0x1715d9[_0x0707('0x5f')])?_0x1715d9[_0x0707('0x5f')][_0x0707('0x186')]()||'':'',_0x1715d9[_0x0707('0x184')]>0x0?_0x4c9f1f[_0x0707('0x167')][_0x0707('0x168')][_0x0707('0x185')](_0x1715d9[_0x0707('0x184')]):_0x4c9f1f['Contact']['phone']),'callerid':_0x5f55f2,'Exten':_0x0707('0xe1'),'Context':'from-sip','Priority':'1','variable':_0x1ceb1d,'timeout':(_0x1715d9[_0x0707('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5a38ec})[_0x0707('0xb8')](function(_0x14b7b8){return _0x55f2be(_0x14b7b8);})[_0x0707('0xb0')](function(_0x58c1f1){_0x1715d9[_0x0707('0x68')]+=0x1;var _0x1c9a7c=new History(_0x2e3559[_0x0707('0xaa')][_0x5a38ec]);logger['error'](util[_0x0707('0x7d')](_0x0707('0x187'),JSON[_0x0707('0x49')](_0x58c1f1)));_0x1c9a7c['state']=0xe;_0x1c9a7c[_0x0707('0xe5')]=_0x0707('0x188');_0x1c9a7c[_0x0707('0xa7')]=moment()[_0x0707('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c9a7c[_0x0707('0x189')]=_0x1c9a7c['starttime'];_0x2e3559[_0x0707('0xcd')](_0x1c9a7c)[_0x0707('0xb0')](loggerCatch(_0x0707('0x18a')));_0x2e3559['moveContactManagedDialer'](_0x1c9a7c)[_0x0707('0xb0')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x2e3559[_0x0707('0xaa')][_0x5a38ec];return _0x1416b3(msgResponse(_0x0707('0x166'),_0x0707('0x18b'),_0x0707('0x18c')));});});});};Dialer['prototype'][_0x0707('0x2f')]=function(_0x77d8ea){var _0x12044f=this[_0x0707('0xaa')][_0x77d8ea[_0x0707('0x124')]];if(_0x12044f){delete this['actions'][_0x77d8ea[_0x0707('0x124')]];_0x12044f[_0x0707('0x116')]=moment()[_0x0707('0x7d')](_0x0707('0x105'));var _0x455576=_0x12044f[_0x0707('0x4e')]==='ivr'?this[_0x0707('0x20')][_0x12044f[_0x0707('0xb2')]]:this[_0x0707('0x1f')][_0x12044f['getQueue']()];if(!this[_0x0707('0xd9')](_0x77d8ea[_0x0707('0x18d')])){this[_0x0707('0xb4')](_0x455576);return this[_0x0707('0x18e')](_0x12044f,_0x455576,_0x77d8ea)[_0x0707('0xb0')](loggerCatch(_0x0707('0x18f')));}this[_0x0707('0x26')][_0x77d8ea[_0x0707('0xdd')]]=_0x12044f;}};Dialer[_0x0707('0x19')][_0x0707('0x190')]=function(_0x24190f,_0x234c76,_0x17f0c9){var _0x68c6a2=new History(_0x234c76);if(_0x68c6a2[_0x0707('0xf2')]+_0x68c6a2[_0x0707('0x103')]+_0x68c6a2[_0x0707('0xf3')]+_0x68c6a2[_0x0707('0xf4')]+_0x68c6a2[_0x0707('0xf5')]+_0x68c6a2[_0x0707('0xf6')]+_0x68c6a2[_0x0707('0xf7')]+_0x68c6a2[_0x0707('0xf8')]>=_0x17f0c9[_0x0707('0xf9')]-0x1){return!![];}switch(_0x24190f){case 0x3:if(_0x68c6a2[_0x0707('0xf3')]>=_0x17f0c9[_0x0707('0x191')]-0x1){return!![];}this[_0x0707('0xc1')]({'active':![],'countnoanswerretry':_0x68c6a2['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x192')],'minutes')[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2[_0x0707('0xd5')]||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x193')));break;case 0x5:if(_0x68c6a2[_0x0707('0xf2')]>=_0x17f0c9['dialBusyMaxRetry']-0x1){return!![];}this[_0x0707('0xc1')]({'active':![],'countbusyretry':_0x68c6a2[_0x0707('0xf2')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x194')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2[_0x0707('0xd5')]||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})['catch'](loggerCatch(_0x0707('0x195')));break;case 0x8:if(_0x68c6a2['countcongestionretry']>=_0x17f0c9[_0x0707('0x196')]-0x1){return!![];}this[_0x0707('0xc1')]({'active':![],'countcongestionretry':_0x68c6a2[_0x0707('0x103')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x197')],_0x0707('0x100'))[_0x0707('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2['VoiceQueueId']||undefined,'CampaignId':_0x68c6a2['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x198')));break;case 0x0:if(_0x68c6a2[_0x0707('0xf4')]>=_0x17f0c9[_0x0707('0x199')]-0x1){return!![];}else{this[_0x0707('0xc1')]({'active':![],'countnosuchnumberretry':_0x68c6a2[_0x0707('0xf4')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x19a')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2['ContactId'],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2['VoiceQueueId']||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x19b')));}break;case 0xa:if(_0x68c6a2[_0x0707('0xf5')]>=_0x17f0c9[_0x0707('0x11a')]-0x1){return!![];}this[_0x0707('0xc1')]({'active':![],'countdropretry':_0x68c6a2[_0x0707('0xf5')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x11b')],_0x0707('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2['ListId'],'VoiceQueueId':_0x68c6a2[_0x0707('0xd5')]||undefined,'CampaignId':_0x68c6a2['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x68c6a2[_0x0707('0xf6')]>=_0x17f0c9[_0x0707('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x68c6a2[_0x0707('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x17f0c9[_0x0707('0x121')],_0x0707('0x100'))[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2['ListId'],'VoiceQueueId':_0x68c6a2['VoiceQueueId']||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x122')));break;case 0x13:if(_0x68c6a2[_0x0707('0xf7')]>=_0x17f0c9[_0x0707('0xfc')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x68c6a2[_0x0707('0xf7')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0xff')],_0x0707('0x100'))[_0x0707('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x68c6a2['ContactId'],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2[_0x0707('0xd5')]||undefined,'CampaignId':_0x68c6a2['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x101')));break;case 0x14:if(_0x68c6a2[_0x0707('0xf8')]>=_0x17f0c9[_0x0707('0x19c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x68c6a2[_0x0707('0xf8')]+=0x1,'scheduledat':moment()[_0x0707('0xfe')](_0x17f0c9[_0x0707('0x19d')],'minutes')[_0x0707('0x7d')](_0x0707('0x105')),'ContactId':_0x68c6a2[_0x0707('0xd3')],'ListId':_0x68c6a2[_0x0707('0xd4')],'VoiceQueueId':_0x68c6a2['VoiceQueueId']||undefined,'CampaignId':_0x68c6a2[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x19e')));break;default:return!![];}};Dialer[_0x0707('0x19')][_0x0707('0x18e')]=function(_0x1e7233,_0x5576b9,_0xfe36a4){var _0x28fc23=this;var _0x385b28=new History(_0x1e7233);return new BPromise(function(_0x3b43c9,_0x4d41f8){if(_[_0x0707('0x3d')](_0x5576b9)&&typeof _0x5576b9!==_0x0707('0x165')){return _0x4d41f8(msgResponse(_0x0707('0x19f'),_0x0707('0x142'),_0x0707('0x1a0')));}if(_['isUndefined'](_0xfe36a4)&&typeof _0xfe36a4!==_0x0707('0x165')){return _0x4d41f8(msgResponse(_0x0707('0x19f'),_0x0707('0x142'),_0x0707('0x1a1')));}switch(_0xfe36a4[_0x0707('0x1a2')]){case'0':_0x5576b9[_0x0707('0x67')]+=0x1;_0x385b28[_0x0707('0xe4')]=0x0;_0x385b28[_0x0707('0xe5')]='NoSuchNumber';_0x385b28[_0x0707('0xf4')]+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')](_0x0707('0x1a3'),ut['buildObj'](_0x1e7233,_0x0707('0x1a4')));_0x28fc23['createHistory'](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0xf1')));if(_0x28fc23[_0x0707('0x190')](0x0,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf4')]>=_0x5576b9['dialNoSuchNumberMaxRetry']){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1a5'));}else{_0x28fc23['stateGlobal'](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1a5'));}}break;case'3':_0x5576b9['outboundNoAnswerCallsDay']+=0x1;_0x385b28[_0x0707('0xe4')]=0x3;_0x385b28[_0x0707('0xe5')]=_0x0707('0x1a6');_0x385b28[_0x0707('0xf3')]+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')]('custom:agentnoanswer',ut['buildObj'](_0x1e7233,_0x0707('0x1a7')));_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x1a8')));if(_0x28fc23[_0x0707('0x190')](0x3,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf3')]>=_0x5576b9[_0x0707('0x191')]){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1a9'));}else{_0x28fc23['stateGlobal'](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1a9'));}}break;case'5':_0x5576b9['outboundBusyCallsDay']+=0x1;_0x385b28[_0x0707('0xe4')]=0x5;_0x385b28[_0x0707('0xe5')]=_0x0707('0x1aa');_0x385b28['countbusyretry']+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')](_0x0707('0x1ab'),ut[_0x0707('0xe9')](_0x1e7233,_0x0707('0x1ac')));_0x28fc23[_0x0707('0xcd')](_0x385b28)['catch'](loggerCatch(_0x0707('0x1ad')));if(_0x28fc23[_0x0707('0x190')](0x5,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf2')]>=_0x5576b9[_0x0707('0x1ae')]){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,'reason\x205\x20busy');}else{_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,'reason\x205\x20busy');}}break;case'8':_0x5576b9[_0x0707('0x1af')]+=0x1;_0x385b28[_0x0707('0xe4')]=0x8;_0x385b28['statedesc']=_0x0707('0x1b0');_0x385b28['countcongestionretry']+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')](_0x0707('0x1b1'),ut[_0x0707('0xe9')](_0x1e7233,_0x0707('0x1b2')));_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x1b3')));if(_0x28fc23[_0x0707('0x190')](0x8,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0x103')]>=_0x5576b9[_0x0707('0x196')]){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1b4'));}else{_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1b4'));}}break;case'11':_0x5576b9[_0x0707('0x1b5')]+=0x1;_0x385b28['state']=0xb;_0x385b28['statedesc']='Abandoned';_0x385b28[_0x0707('0xf6')]+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x123')));if(_0x28fc23[_0x0707('0x190')](0xb,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf6')]>=_0x5576b9[_0x0707('0x120')]){_0x28fc23[_0x0707('0xfd')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1b6'));}else{_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1b6'));}}break;case'20':_0x5576b9['outboundRejectCallsDay']+=0x1;_0x385b28[_0x0707('0xe4')]=0x14;_0x385b28[_0x0707('0xe5')]='AgentReject';_0x385b28['countagentrejectretry']+=0x1;_0x385b28[_0x0707('0xf0')]+=0x1;ami[_0x0707('0x4d')](_0x0707('0x1b7'),ut[_0x0707('0xe9')](_0x1e7233,_0x0707('0x1b8')));_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x1b9')));if(_0x28fc23[_0x0707('0x190')](0x14,_0x1e7233,_0x5576b9)){if(_0x385b28[_0x0707('0xf8')]>=_0x5576b9[_0x0707('0x19c')]){_0x28fc23['createStateFinal'](_0x385b28,_0x3b43c9,_0x4d41f8,'reason\x2020\x20agentreject');}else{_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,_0x0707('0x1ba'));}}break;default:_0x5576b9['outboundUnknownCallsDay']+=0x1;_0x385b28[_0x0707('0xe4')]=0xc;_0x385b28[_0x0707('0xe5')]=_0xfe36a4[_0x0707('0x1a2')];_0x28fc23[_0x0707('0xcd')](_0x385b28)[_0x0707('0xb0')](loggerCatch(_0x0707('0x1bb')));if(_0x28fc23[_0x0707('0x190')](_0xfe36a4[_0x0707('0x1a2')],_0x1e7233,_0x5576b9)){if(_0x385b28['countbusyretry']+_0x385b28['countcongestionretry']+_0x385b28[_0x0707('0xf3')]+_0x385b28['countnosuchnumberretry']+_0x385b28[_0x0707('0xf5')]+_0x385b28[_0x0707('0xf6')]+_0x385b28[_0x0707('0xf7')]+_0x385b28['countagentrejectretry']>=_0x5576b9[_0x0707('0xf9')]){_0x28fc23[_0x0707('0xfa')](_0x385b28,_0x3b43c9,_0x4d41f8,_0xfe36a4[_0x0707('0x1a2')]);}else{_0x28fc23['createStateFinal'](_0x385b28,_0x3b43c9,_0x4d41f8,_0xfe36a4[_0x0707('0x1a2')]);}}}});};Dialer[_0x0707('0x19')][_0x0707('0xfa')]=function(_0x2d2049,_0x4c7e97,_0x1f87ad,_0x50ed0f){var _0x3f4020=new Final(_0x2d2049);_0x3f4020['state']=0xf;_0x3f4020[_0x0707('0xe5')]=_0x0707('0x1bc');this[_0x0707('0xfd')](_0x3f4020,_0x4c7e97,_0x1f87ad,_0x50ed0f);};Dialer[_0x0707('0x19')][_0x0707('0xfd')]=function(_0x40cd09,_0x520c91,_0xcf0f97,_0x2b6f9d){this['moveContactManagedDialer'](_0x40cd09)['then'](function(){return _0x520c91(msgResponse(_0x0707('0x19f'),'Success',_0x2b6f9d));})[_0x0707('0xb0')](function(){return _0xcf0f97(msgResponse(_0x0707('0x1bd'),'Failure',_0x0707('0x1be')));});};Dialer['prototype'][_0x0707('0x156')]=function(_0x2cddc7){var _0x3c51d5=_0x2cddc7[_0x0707('0x1bf')]/0x64;var _0x30c31e=_0x2cddc7['outboundDropCallsDayTimeout']/(_0x2cddc7[_0x0707('0x65')]+_0x2cddc7['outboundAnswerCallsDay']);var _0x1055cb=Math[_0x0707('0x1c0')](_0x2cddc7[_0x0707('0x73')]*(_0x2cddc7[_0x0707('0x1c1')]/0x64));var _0x2d3957=Math['round'](_0x2cddc7['predictiveIntervalAvailable']*(_0x2cddc7[_0x0707('0x1c2')]/0x64));var _0x1eb299=_0x2cddc7[_0x0707('0x52')]+_0x2cddc7[_0x0707('0x57')];var _0x27da31=Math[_0x0707('0x1c3')](_0x2cddc7['erlangCalls']*_0x2cddc7[_0x0707('0x77')]*_0x2cddc7[_0x0707('0x70')]*_0x2cddc7[_0x0707('0x71')]);if(_[_0x0707('0x3d')](_0x2cddc7[_0x0707('0x92')])){if(!_['isUndefined'](_0x2cddc7[_0x0707('0x79')])){_0x2cddc7[_0x0707('0x79')]=undefined;loggerPredictive[_0x0707('0x99')]('[startMethodPredictive][StartProgressive]',_0x0707('0x1c4'));}if(!_['isUndefined'](_0x2cddc7[_0x0707('0x95')])){loggerPredictive[_0x0707('0x99')](_0x0707('0x1c5'),_0x0707('0x1c6'));clearInterval(_0x2cddc7[_0x0707('0x95')]);_0x2cddc7['handlePredictive']=undefined;}_0x2cddc7[_0x0707('0x92')]=moment()[_0x0707('0x7d')](_0x0707('0x105'));loggerPredictive[_0x0707('0x80')](_0x2cddc7[_0x0707('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x2cddc7[_0x0707('0x92')]);this[_0x0707('0x157')](_0x2cddc7,0x1);}else if(ifInterval(_0x2cddc7[_0x0707('0x1c7')],_0x2cddc7[_0x0707('0x92')])){this[_0x0707('0x157')](_0x2cddc7,0x1);loggerPredictiveCalls[_0x0707('0x80')]('[startMethodPredictive][StartProgressive][Loop]',_0x2cddc7[_0x0707('0x92')],_0x2cddc7[_0x0707('0x40')]);_0x2cddc7[_0x0707('0x76')]=0x0;_0x2cddc7[_0x0707('0x6f')]=0x0;}else if(_0x3c51d5<_0x30c31e&&_0x2cddc7[_0x0707('0x1c8')]===_0x0707('0x1c9')){freeVariablesPredictive(_0x2cddc7);loggerPredictive[_0x0707('0x80')](_0x0707('0x1ca'),_0x0707('0x1cb'),_0x30c31e,_0x0707('0x92'),_0x2cddc7[_0x0707('0x40')]);}else if(_0x27da31<_0x2cddc7[_0x0707('0x6f')]&&_0x2cddc7[_0x0707('0x1c8')]==='dropRate'){freeVariablesPredictive(_0x2cddc7);loggerPredictive[_0x0707('0x80')](_0x0707('0x1cc'),_0x0707('0x1cd'),_0x27da31,_0x0707('0x1ce'),_0x2cddc7[_0x0707('0x6f')],_0x0707('0x92'),_0x2cddc7[_0x0707('0x40')]);}else if(!ifInterval(_0x2cddc7[_0x0707('0x1c7')],_0x2cddc7[_0x0707('0x92')])&&_[_0x0707('0x3d')](_0x2cddc7['startPredictive'])&&!_[_0x0707('0x3d')](_0x2cddc7[_0x0707('0x92')])){_0x2cddc7[_0x0707('0x79')]=moment()[_0x0707('0x7d')](_0x0707('0x105'));loggerPredictive['info'](_0x2cddc7[_0x0707('0x40')],_0x0707('0x1cf'),_0x2cddc7[_0x0707('0x79')]);this['averageHandleTime'](_0x2cddc7[_0x0707('0x1c7')])[_0x0707('0xb8')](this[_0x0707('0x1d0')](_0x2cddc7))[_0x0707('0xb8')](mergeDataErlangB(_0x2cddc7))[_0x0707('0xb8')](this['startMethodPredictive'](_0x2cddc7))[_0x0707('0xb0')](loggerCatchPredictive(_0x0707('0x1d1'),_0x2cddc7));}else if(!ifInterval(_0x2cddc7[_0x0707('0x1c7')],_0x2cddc7[_0x0707('0x79')])){_0x2cddc7[_0x0707('0x6f')]=0x0;_0x2cddc7[_0x0707('0x79')]=moment()[_0x0707('0x7d')](_0x0707('0x105'));loggerPredictive[_0x0707('0x80')](_0x2cddc7[_0x0707('0x40')],_0x0707('0x1d2'),_0x2cddc7[_0x0707('0x79')]);clearInterval(_0x2cddc7[_0x0707('0x95')]);_0x2cddc7[_0x0707('0x95')]=undefined;this[_0x0707('0xbe')](_0x2cddc7['dialPredictiveInterval'])['then'](this[_0x0707('0x1d0')](_0x2cddc7))[_0x0707('0xb8')](mergeDataErlangB(_0x2cddc7))[_0x0707('0xb8')](this[_0x0707('0x1d3')](_0x2cddc7))[_0x0707('0xb0')](loggerCatchPredictive(_0x0707('0x1d4'),_0x2cddc7));}else if(_0x2cddc7[_0x0707('0x73')]&&_0x1eb299<_0x2cddc7[_0x0707('0x73')]-_0x2d3957){freeVariablesPredictive(_0x2cddc7);loggerPredictive[_0x0707('0x80')](_0x2cddc7[_0x0707('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1eb299,_0x0707('0x1d5'),_0x2cddc7['predictiveIntervalAvailable'],'-',_0x2d3957,'=',_0x2cddc7['predictiveIntervalAvailable']-_0x2d3957,')');}else if(_0x2cddc7[_0x0707('0x73')]&&_0x1eb299>_0x2cddc7[_0x0707('0x73')]+_0x1055cb){freeVariablesPredictive(_0x2cddc7);loggerPredictive[_0x0707('0x80')](_0x2cddc7[_0x0707('0x40')],_0x0707('0x1d6'),_0x1eb299,_0x0707('0x1d7'),_0x2cddc7[_0x0707('0x73')],'+',_0x1055cb,'=',_0x2cddc7['predictiveIntervalAvailable']+_0x1055cb,')');}};Dialer[_0x0707('0x19')]['getDataPredictive']=function(_0xfea010){var _0x35ddee=this;return function(_0x3774ea){return new BPromise(function(_0x2a698b,_0x1f2835){_['merge'](_0xfea010,_0x3774ea[0x0]);if(checkGetDataPredictive(_0x3774ea[0x0])){var _0x1ae16a=_0xfea010[_0x0707('0x73')]=_0xfea010['talking']+_0xfea010[_0x0707('0x52')];var _0x1a90ad=_0xfea010['dialPredictiveInterval']*0x3c;var _0x55ad0d=_0x3774ea[0x0]['predictiveIntervalAvgTalktime']+_0x3774ea[0x0][_0x0707('0x6c')];var _0x91adec=(_0x3774ea[0x0][_0x0707('0x6b')]+_0x3774ea[0x0][_0x0707('0x6d')]+_0x3774ea[0x0][_0x0707('0x85')])/_0x3774ea[0x0][_0x0707('0x74')];_0xfea010['predictiveIntervalHitRate']=_0x91adec>0x0?_0x91adec:0x1;switch(_0xfea010[_0x0707('0x1c8')]){case'dropRate':var _0x2bbe3f=_0xfea010[_0x0707('0x1bf')]/0x64;return _0x35ddee[_0x0707('0x1d8')](_0x1ae16a,_0x1a90ad,_0x55ad0d,_0x91adec,_0x2bbe3f)[_0x0707('0xb8')](function(_0x1185d0){return _0x2a698b(_0x1185d0);});case'agentBusyFactor':var _0x23e2cf=_0xfea010[_0x0707('0x1bf')]/0x64;return _0x35ddee['busyFactor'](_0x1ae16a,_0x1a90ad,_0x55ad0d,_0x91adec,_0x23e2cf)[_0x0707('0xb8')](function(_0x135c8a){return _0x2a698b(_0x135c8a);});default:return _0x1f2835(msgResponse(_0x0707('0x1d9'),_0x0707('0x142'),_0x0707('0x1da')));}}else{return _0x1f2835(msgResponse(_0x0707('0x1d9'),_0x0707('0x142'),_0x0707('0x1db')));}});};};Dialer[_0x0707('0x19')][_0x0707('0x1dc')]=function(_0x3bd4ce){var _0x4874b1=this;return function(_0x5e1605){return new BPromise(function(_0x32746d,_0x2cb313){_[_0x0707('0x91')](_0x3bd4ce,_0x5e1605[0x0]);if(checkGetDataPredictive(_0x5e1605[0x0])){loggerPredictive['info'](JSON[_0x0707('0x49')](_0x5e1605[0x0]));if(_0x3bd4ce['dialPredictiveOptimization']===_0x0707('0x1c9')){return _0x4874b1[_0x0707('0xc9')](_0x3bd4ce['id'])[_0x0707('0xb8')](function(_0x40a8b9){var _0x17859f=_0x3bd4ce[_0x0707('0x53')]-_0x40a8b9[0x0][_0x0707('0x1dd')];var _0x44f6f8=_0x3bd4ce[_0x0707('0x1c7')]*0x3c;var _0x5b479c=_0x5e1605[0x0][_0x0707('0x88')]+_0x5e1605[0x0][_0x0707('0x6c')];var _0x47692c=(_0x5e1605[0x0]['predictiveIntervalAnsweredCalls']+_0x5e1605[0x0][_0x0707('0x6d')]+_0x5e1605[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5e1605[0x0]['predictiveIntervalTotalCalls'];var _0x199092=_0x3bd4ce[_0x0707('0x1bf')]/0x64;_0x3bd4ce[_0x0707('0x72')]=_0x40a8b9[0x0][_0x0707('0x1dd')]||0x0;_0x3bd4ce[_0x0707('0x70')]=_0x47692c>0x0?_0x47692c:0x1;return _0x4874b1[_0x0707('0x1d8')](_0x17859f,_0x44f6f8,_0x5b479c,_0x47692c,_0x199092);})[_0x0707('0xb8')](function(_0x49da61){return _0x32746d(_0x49da61);})['catch'](function(_0x3932f6){return _0x2cb313(msgResponse('[CatchErlangB]',_0x0707('0x142'),JSON[_0x0707('0x49')](_0x3932f6)));});}if(_0x3bd4ce[_0x0707('0x1c8')]==='agentBusyFactor'){return _0x4874b1[_0x0707('0xc9')](_0x3bd4ce['id'])[_0x0707('0xb8')](function(_0x1a65b3){var _0x42326a=_0x3bd4ce[_0x0707('0x53')]-_0x1a65b3[0x0][_0x0707('0x1dd')];var _0x29d8c8=_0x3bd4ce['dialPredictiveInterval']*0x3c;var _0x4d4538=_0x5e1605[0x0][_0x0707('0x88')]+_0x5e1605[0x0][_0x0707('0x6c')];var _0x3ea59a=(_0x5e1605[0x0]['predictiveIntervalAnsweredCalls']+_0x5e1605[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5e1605[0x0][_0x0707('0x85')])/_0x5e1605[0x0][_0x0707('0x74')];var _0x109560=_0x3bd4ce['dialPredictiveOptimizationPercentage']/0x64;_0x3bd4ce[_0x0707('0x72')]=_0x1a65b3[0x0]['outboundQueuePauses']||0x0;_0x3bd4ce[_0x0707('0x70')]=_0x3ea59a>0x0?_0x3ea59a:0x1;return _0x4874b1['busyFactor'](_0x42326a,_0x29d8c8,_0x4d4538,_0x3ea59a,_0x109560);})['then'](function(_0x4c62b5){return _0x32746d(_0x4c62b5);})['catch'](function(_0x5a60f2){return _0x2cb313(msgResponse(_0x0707('0x1de'),'Failure',JSON[_0x0707('0x49')](_0x5a60f2)));});}}else{return _0x2cb313(msgResponse(_0x0707('0x1d9'),_0x0707('0x142'),_0x0707('0x1db')));}});};};Dialer[_0x0707('0x19')]['startMethodPredictive']=function(_0x24f451){var _0x10e5fe=this;return function(){var _0x10bb1c=0x0;var _0x48d98a=Math[_0x0707('0x1c3')](_0x24f451['erlangCallToSecond']*0x3e8);if(_0x48d98a>0x0){_0x48d98a=_0x48d98a<0x64?0x64:_0x48d98a;loggerPredictive['info'](_0x24f451[_0x0707('0x40')],_0x0707('0x1df'),_0x48d98a,_0x0707('0x4a'));_0x24f451[_0x0707('0x95')]=setInterval(function(){_0x10e5fe['handlePredictive'](_0x24f451);loggerPredictiveCalls[_0x0707('0x80')](_0x0707('0x1e0'),_0x10bb1c+=0x1);},_0x48d98a);}else{loggerPredictive['info'](_0x24f451[_0x0707('0x40')],_0x0707('0x1e1'));}};};Dialer[_0x0707('0x19')][_0x0707('0x1e2')]=function(_0x2ce81f,_0x41433e){var _0x48d19c=this;return function(_0x3b7e06){if(_['isEmpty'](_0x3b7e06)){if(_[_0x0707('0xac')](_0x41433e[_0x0707('0x1e3')])||!_0x41433e[_0x0707('0x1e4')]){if(_0x2ce81f[_0x0707('0x5b')]===_0x0707('0x6')){_0x2ce81f[_0x0707('0x12b')]=_[_0x0707('0x3d')](_0x2ce81f[_0x0707('0x12b')])?!![]:_0x2ce81f[_0x0707('0x12b')];var _0x584bee=uuid['v4']();_0x48d19c[_0x0707('0xaa')][_0x584bee]=new Action(_0x2ce81f,_0x41433e,_0x584bee);loggerBooked[_0x0707('0x80')](_0x0707('0x1e5'),_0x584bee,_0x0707('0x1e6'),JSON[_0x0707('0x49')](_0x2ce81f['queueStatusComplete']),_0x0707('0x1e7'),_0x2ce81f[_0x0707('0x40')]);if(_0x2ce81f[_0x0707('0x12b')]){_0x2ce81f[_0x0707('0x12b')]=![];_0x48d19c[_0x0707('0x28')][_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xb2')]]=[];ami[_0x0707('0xad')]({'actionid':_0x584bee,'action':_0x0707('0x1e8'),'queue':_0x2ce81f[_0x0707('0x40')]})['catch'](function(){_0x48d19c['updateOriginated'](_0x2ce81f);_0x48d19c['rescheduleContact']({'active':![],'ContactId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd3')],'ListId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd4')],'VoiceQueueId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd5')]||undefined,'CampaignId':_0x48d19c[_0x0707('0xaa')][_0x584bee]['CampaignId']||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x1e9')));delete _0x48d19c['actions'][_0x584bee];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x0707('0x49')](_0x2ce81f[_0x0707('0x12b')]),_0x0707('0x1e7'),_0x2ce81f[_0x0707('0x40')]);_0x48d19c[_0x0707('0xb4')](_0x2ce81f);_0x48d19c[_0x0707('0xc1')]({'active':![],'ContactId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd3')],'ListId':_0x48d19c['actions'][_0x584bee][_0x0707('0xd4')],'VoiceQueueId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd5')]||undefined,'CampaignId':_0x48d19c[_0x0707('0xaa')][_0x584bee][_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x48d19c[_0x0707('0xaa')][_0x584bee];}}else{return _0x48d19c[_0x0707('0x164')](_0x2ce81f,_0x41433e);}}else{if(getDiff(_0x41433e[_0x0707('0x1ea')])<_0x2ce81f[_0x0707('0x1eb')]*0x3c){if(_0x41433e['Agent']&&!_0x41433e[_0x0707('0x1ec')][_0x0707('0x1ed')]){_0x48d19c['preview'][_0x0707('0x12c')](_0x41433e['id'])[_0x0707('0x1c')](function(){_0x48d19c[_0x0707('0xb4')](_0x2ce81f);});}else{_0x48d19c['unlockContact']({'active':![]},_0x41433e['id'],0x1)['finally'](function(){_0x48d19c['updateOriginated'](_0x2ce81f);});}}else{_0x2ce81f['outboundReCallsDay']+=0x1;_0x48d19c['updateOriginated'](_0x2ce81f);if(_0x2ce81f[_0x0707('0x1ee')]){_0x48d19c[_0x0707('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x41433e['ContactId'],'ListId':_0x41433e[_0x0707('0xd4')],'VoiceQueueId':_0x41433e[_0x0707('0xd5')]||undefined,'CampaignId':_0x41433e[_0x0707('0xd6')]||undefined})[_0x0707('0xb0')](loggerCatch(_0x0707('0x1ef')));_0x48d19c[_0x0707('0xcd')](createObjHistory(_0x2ce81f,_0x41433e,_0x0707('0x1f0'),0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x48d19c[_0x0707('0xd2')](createObjHistory(_0x2ce81f,_0x41433e,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),_0x0707('0x1f1'),_0x0707('0x1f2'));}}}}else{_0x2ce81f[_0x0707('0x61')]+=0x1;_0x48d19c[_0x0707('0xd2')](createObjHistory(_0x2ce81f,_0x41433e,'BLACKLIST',0xd,_0x0707('0x1f3')),_0x0707('0x1f4'),'[Originate][MoveBlacklist]');throw _0x0707('0x1f5');}};};Dialer[_0x0707('0x19')][_0x0707('0x15b')]=function(_0x1d2282){var _0x243982=this;var _0x525599=_0x1d2282[_0x0707('0x1f6')]-_0x1d2282[_0x0707('0x75')]-_0x1d2282[_0x0707('0xc6')];emitCampaignSummary(_0x1d2282);if(_0x525599>0x0){if(_0x525599>this[_0x0707('0x23')]){_0x525599=this['maxNumberOriginate'];}_0x1d2282[_0x0707('0xc6')]+=_0x525599;this[_0x0707('0xc7')](_0x1d2282['id'],_0x525599,_0x1d2282[_0x0707('0x1f7')],_0x1d2282)[_0x0707('0xb8')](function(_0x39ffc1){_0x1d2282[_0x0707('0xc6')]-=_0x525599;_0x1d2282['temp']=_0x1d2282[_0x0707('0xc6')]>0x0?_0x1d2282['temp']:0x0;if(!checkContactEmpty(_0x39ffc1)){_0x1d2282[_0x0707('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x0707('0x80')](_0x0707('0x1f8')+_0x1d2282[_0x0707('0x40')]);}else{_0x1d2282['originated']+=_0x39ffc1[_0x0707('0x12e')];_0x1d2282[_0x0707('0x3e')]=_0x0707('0x1f9');for(var _0x3612df=0x0;_0x3612df<_0x39ffc1['length'];_0x3612df+=0x1){_0x1d2282[_0x0707('0x1fa')]+=0x1;if(_['isNil'](_0x39ffc1[_0x3612df])||_[_0x0707('0xac')](_0x39ffc1[_0x3612df][_0x0707('0x167')])||_[_0x0707('0xac')](_0x39ffc1[_0x3612df]['Contact'][_0x0707('0x168')])){_0x243982['emptyContact'](_0x0707('0x1fb'),_0x1d2282,_0x39ffc1[_0x3612df]);}else{_0x243982[_0x0707('0xbc')](_[_0x0707('0x129')](_0x39ffc1[_0x3612df],['CampaignId','Contact.phone']))['then'](_0x243982['checkContactBlack'](_0x1d2282,_0x39ffc1[_0x3612df]))[_0x0707('0xb0')](_0x243982[_0x0707('0x1fc')](_0x0707('0x1fd'),_0x1d2282));}}}})[_0x0707('0xb0')](loggerGetContactDialer(_0x0707('0x1fe'),_0x1d2282,_0x525599));}};Dialer[_0x0707('0x19')][_0x0707('0x157')]=function(_0x29289e,_0x23da4d){var _0x480e3d=this;var _0x22a3fe=[];var _0x2a2e29=_0x23da4d>=0x1?_0x23da4d:0x1;if(_0x29289e['dialMethod']==='booked'){_0x2a2e29=0x1;}var _0x1b6cec=Math['floor'](_0x29289e['available']*_0x2a2e29)-_0x29289e[_0x0707('0x75')]-_0x29289e[_0x0707('0xc6')];emitVoiceQueueSummary(_0x29289e);if(_0x29289e[_0x0707('0x1ff')]>0x0){var _0x4b9229=_0x29289e[_0x0707('0x1ff')]-_0x29289e[_0x0707('0x75')]-_0x29289e[_0x0707('0x57')]-_0x29289e[_0x0707('0xc6')]-_0x29289e[_0x0707('0x54')];if(_0x1b6cec>_0x4b9229){_0x1b6cec=_0x4b9229;}}if(_0x1b6cec>0x0){if(_0x29289e[_0x0707('0x5b')]==='booked'){_0x1b6cec=0x1;}if(_0x1b6cec>this['maxNumberOriginate']){_0x1b6cec=this['maxNumberOriginate'];}_0x29289e[_0x0707('0xc6')]+=_0x1b6cec;for(var _0x52bfb9 in this[_0x0707('0x21')]){if(typeof this[_0x0707('0x21')][_0x52bfb9]!==_0x0707('0x9c')){if(this['agents'][_0x52bfb9][_0x0707('0xe4')]==='not_inuse'&&this[_0x0707('0x21')][_0x52bfb9][_0x0707('0xae')]===_0x0707('0x200')){_0x22a3fe[_0x0707('0x128')](this[_0x0707('0x21')][_0x52bfb9]['id']);}}}this[_0x0707('0xc5')](_0x29289e['id'],_0x22a3fe,_0x1b6cec,_0x29289e[_0x0707('0x1f7')],_0x29289e)[_0x0707('0xb8')](function(_0x255b1b){_0x29289e[_0x0707('0xc6')]-=_0x1b6cec;_0x29289e['temp']=_0x29289e[_0x0707('0xc6')]>0x0?_0x29289e['temp']:0x0;if(!checkContactEmpty(_0x255b1b)){_0x480e3d['countReScheduled'](_0x29289e)[_0x0707('0xb8')](sendMessageReschedule(_0x29289e))[_0x0707('0xb0')](loggerCatch(_0x0707('0xb9')));}else{_0x29289e['originated']+=_0x255b1b[_0x0707('0x12e')];_0x29289e[_0x0707('0x3e')]=_0x29289e[_0x0707('0x5b')]==='booked'?_0x0707('0x201'):_0x0707('0x1f9');for(var _0x22a685=0x0;_0x22a685<_0x255b1b[_0x0707('0x12e')];_0x22a685+=0x1){if(_[_0x0707('0xac')](_0x255b1b[_0x22a685])||_[_0x0707('0xac')](_0x255b1b[_0x22a685][_0x0707('0x167')])||_['isNil'](_0x255b1b[_0x22a685][_0x0707('0x167')][_0x0707('0x168')])){_0x480e3d['emptyContact'](_0x0707('0x1fb'),_0x29289e,_0x255b1b[_0x22a685]);}else{_0x480e3d[_0x0707('0xba')](_[_0x0707('0x129')](_0x255b1b[_0x22a685],[_0x0707('0xd5'),_0x0707('0x202')]))[_0x0707('0xb8')](_0x480e3d[_0x0707('0x1e2')](_0x29289e,_0x255b1b[_0x22a685]))['catch'](_0x480e3d['loggerHandler'](_0x0707('0x1fb'),_0x29289e));}}}})[_0x0707('0xb0')](loggerGetContactDialer(_0x0707('0x203'),_0x29289e,_0x1b6cec));}};Dialer[_0x0707('0x19')]['handlePredictive']=function(_0x27a20d){if(_0x27a20d['dialLimitQueue']>0x0){var _0x5c0490=_0x27a20d[_0x0707('0x1ff')]-_0x27a20d[_0x0707('0x75')]-_0x27a20d['talking'];if(_0x5c0490>0x0){this[_0x0707('0x204')](_0x27a20d);}else{loggerPredictiveCalls[_0x0707('0x80')](_0x0707('0x205'));}}else{this['tryOriginatePredictive'](_0x27a20d);}};Dialer[_0x0707('0x19')]['tryOriginatePredictive']=function(_0x45e780){var _0x14c9fc=this;var _0x13b479=[];_0x45e780[_0x0707('0x75')]+=0x1;for(var _0x45ed9e in this[_0x0707('0x21')]){if(typeof this['agents'][_0x45ed9e]!=='undefined'){if(this[_0x0707('0x21')][_0x45ed9e][_0x0707('0xe4')]===_0x0707('0x206')&&this[_0x0707('0x21')][_0x45ed9e][_0x0707('0xae')]===_0x0707('0x200')){_0x13b479[_0x0707('0x128')](this['agents'][_0x45ed9e]['id']);}}}this['getContactDialer'](_0x45e780['id'],_0x13b479,0x1,_0x45e780[_0x0707('0x1f7')],_0x45e780)[_0x0707('0xb8')](function(_0x3a0601){if(!checkContactEmpty(_0x3a0601)){checkContactLowerLimitOriginate(_0x45e780,0x1,0x0);_0x14c9fc['countReScheduled'](_0x45e780)[_0x0707('0xb8')](sendMessageReschedule(_0x45e780))[_0x0707('0xb0')](loggerCatch(_0x0707('0xb9')));}else{_0x45e780[_0x0707('0x3e')]=_0x0707('0x1f9');if(_['isNil'](_0x3a0601[0x0])||_['isNil'](_0x3a0601[0x0][_0x0707('0x167')])||_['isNil'](_0x3a0601[0x0][_0x0707('0x167')][_0x0707('0x168')])){_0x14c9fc['emptyContact'](_0x0707('0x1fb'),_0x45e780,_0x3a0601[0x0]);}else{_0x14c9fc[_0x0707('0xba')](_[_0x0707('0x129')](_0x3a0601[0x0],[_0x0707('0xd5'),_0x0707('0x202')]))[_0x0707('0xb8')](_0x14c9fc['checkContactBlack'](_0x45e780,_0x3a0601[0x0]))[_0x0707('0xb0')](_0x14c9fc[_0x0707('0x1fc')](_0x0707('0x207'),_0x45e780));}}})['catch'](loggerGetContactDialer(_0x0707('0x208'),_0x45e780,0x1));emitVoiceQueueSummary(_0x45e780);};Dialer[_0x0707('0x19')]['abandonmentRate']=function(_0x1b40ce,_0x15f490,_0x535daa,_0x11dd35,_0x216e66,_0x236a6d){loggerPredictive[_0x0707('0x80')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info']('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',_0x1b40ce);loggerPredictive[_0x0707('0x80')](_0x0707('0x209'),_0x15f490);loggerPredictive[_0x0707('0x80')](_0x0707('0x20a'),_0x535daa);loggerPredictive[_0x0707('0x80')]('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',_0x11dd35);loggerPredictive['info'](_0x0707('0x20b'),_0x216e66);loggerPredictive[_0x0707('0x80')](_0x0707('0x89'));return new BPromise(function(_0xcfa88a,_0x6ea945){if(_0x1b40ce<=0x0||isNaN(_0x1b40ce)){return _0x6ea945(msgResponse('[abandonmentRate]',_0x0707('0x18b'),_0x0707('0x20c')+_0x1b40ce));}if(_0x535daa<=0x0||isNaN(_0x535daa)){return _0x6ea945(msgResponse('[abandonmentRate]',_0x0707('0x18b'),'Ts\x20=\x20'+_0x535daa));}if(_0x11dd35<=0x0||isNaN(_0x11dd35)){return _0x6ea945(msgResponse('[abandonmentRate]',_0x0707('0x18b'),_0x0707('0x20d')+_0x11dd35));}if(_0x15f490<=0x0||isNaN(_0x15f490)){return _0x6ea945(msgResponse(_0x0707('0x20e'),'Error',_0x0707('0x20f')+_0x15f490));}if(_0x216e66<=0x0||isNaN(_0x216e66)){return _0x6ea945(msgResponse(_0x0707('0x20e'),_0x0707('0x18b'),_0x0707('0x210')+_0x216e66));}_0x236a6d=_0x236a6d||0x0;var _0x9c67be=0x1/_0x535daa;var _0x25fcf8=0x0;var _0x24b4b5=0x0;var _0x2a34ce=0x0;var _0x349039=0x0;for(var _0x27fe00=0x0;_0x2a34ce<_0x216e66;_0x27fe00+=0x1){_0x24b4b5=_0x27fe00/_0x15f490;_0x25fcf8=(_0x11dd35*_0x24b4b5+_0x236a6d)/_0x9c67be;_0x2a34ce=erlangb(_0x25fcf8,_0x1b40ce);_0x349039=_0x25fcf8/_0x1b40ce*(0x1-erlangb(_0x25fcf8,_0x1b40ce));}return _0xcfa88a({'erlangCalls':_0x27fe00,'erlangCallToSecond':_0x15f490/_0x27fe00,'erlangAbandonmentRate':_0x2a34ce,'erlangBusyFactor':_0x349039});});};Dialer[_0x0707('0x19')]['busyFactor']=function(_0x2f8d00,_0xb88df4,_0x5cab9c,_0x58021e,_0x599e43,_0x52cb1a){loggerPredictive[_0x0707('0x80')](_0x0707('0x211'));loggerPredictive['info'](_0x0707('0x212'),_0x2f8d00);loggerPredictive[_0x0707('0x80')](_0x0707('0x209'),_0xb88df4);loggerPredictive[_0x0707('0x80')](_0x0707('0x20a'),_0x5cab9c);loggerPredictive[_0x0707('0x80')](_0x0707('0x213'),_0x58021e);loggerPredictive[_0x0707('0x80')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x599e43);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x4007d9,_0x14c26f){if(_0x2f8d00<=0x0||isNaN(_0x2f8d00)){return _0x14c26f(msgResponse(_0x0707('0x214'),_0x0707('0x18b'),_0x0707('0x20c')+_0x2f8d00));}if(_0x5cab9c<=0x0||isNaN(_0x5cab9c)){return _0x14c26f(msgResponse(_0x0707('0x214'),_0x0707('0x18b'),_0x0707('0x215')+_0x5cab9c));}if(_0x58021e<=0x0||isNaN(_0x58021e)){return _0x14c26f(msgResponse(_0x0707('0x214'),'Error',_0x0707('0x20d')+_0x58021e));}if(_0xb88df4<=0x0||isNaN(_0xb88df4)){return _0x14c26f(msgResponse(_0x0707('0x214'),_0x0707('0x18b'),'interval\x20=\x20'+_0xb88df4));}if(_0x599e43<=0x0||isNaN(_0x599e43)){return _0x14c26f(msgResponse('[busyFactor]',_0x0707('0x18b'),'Umin\x20=\x20'+_0x599e43));}_0x52cb1a=_0x52cb1a||0x0;var _0x365bed=0x1/_0x5cab9c;var _0x4f18b7=0x0;var _0x50dfdc=0x0;var _0x4faeca=0x0;var _0x44bbe5=0x0;for(var _0x35aa65=0x0;_0x44bbe5<_0x599e43;_0x35aa65+=0x1){_0x50dfdc=_0x35aa65/_0xb88df4;_0x4f18b7=(_0x58021e*_0x50dfdc+_0x52cb1a)/_0x365bed;_0x4faeca=erlangb(_0x4f18b7,_0x2f8d00);_0x44bbe5=_0x4f18b7/_0x2f8d00*(0x1-erlangb(_0x4f18b7,_0x2f8d00));}return _0x4007d9({'erlangCalls':_0x35aa65,'erlangCallToSecond':_0xb88df4/_0x35aa65,'erlangAbandonmentRate':_0x4faeca,'erlangBusyFactor':_0x44bbe5});});};module[_0x0707('0x216')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 774afe5..bd93835 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 _0xc9a5=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','droptime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','lodash','moment','milliseconds','diff','seconds'];(function(_0xbc9e5a,_0x22d6c8){var _0x139c60=function(_0x5e8b2e){while(--_0x5e8b2e){_0xbc9e5a['push'](_0xbc9e5a['shift']());}};_0x139c60(++_0x22d6c8);}(_0xc9a5,0x1cf));var _0x5c9a=function(_0xb8a04,_0x5d534f){_0xb8a04=_0xb8a04-0x0;var _0x31608f=_0xc9a5[_0xb8a04];return _0x31608f;};'use strict';var util=require('util');var _=require(_0x5c9a('0x0'));var moment=require(_0x5c9a('0x1'));function getSeconds(_0xd09ce4,_0x125b3a){var _0x5a01c6=moment(_0xd09ce4)[_0x5c9a('0x2')](0x0);var _0x5444f2=moment(_0x125b3a)[_0x5c9a('0x2')](0x0);return _0x5a01c6[_0x5c9a('0x3')](_0x5444f2,_0x5c9a('0x4'));}function QueueCallerAbandon(_0x30db3c,_0x4d8ee7){this[_0x5c9a('0x5')]=_0x30db3c[_0x5c9a('0x5')];this[_0x5c9a('0x6')]=_0x30db3c[_0x5c9a('0x6')];this[_0x5c9a('0x7')]=_0x30db3c[_0x5c9a('0x6')]===_0x5c9a('0x8')?_0x5c9a('0x9'):_0x30db3c['type'];this['countbusyretry']=_0x30db3c[_0x5c9a('0xa')];this['countcongestionretry']=_0x30db3c[_0x5c9a('0xb')];this[_0x5c9a('0xc')]=_0x30db3c['countnoanswerretry'];this['countglobal']=_0x30db3c[_0x5c9a('0xa')]+_0x30db3c[_0x5c9a('0xb')]+_0x30db3c['countnoanswerretry']+_0x30db3c[_0x5c9a('0xd')]+_0x30db3c[_0x5c9a('0xe')]+_0x30db3c[_0x5c9a('0xf')]+_0x30db3c['countmachineretry']+_0x30db3c[_0x5c9a('0x10')];this['countnosuchnumberretry']=_0x30db3c[_0x5c9a('0xd')];this[_0x5c9a('0xe')]=_0x30db3c['countdropretry'];this['countabandonedretry']=_0x30db3c[_0x5c9a('0xf')];this[_0x5c9a('0x11')]=_0x30db3c[_0x5c9a('0x11')];this[_0x5c9a('0x10')]=_0x30db3c[_0x5c9a('0x10')];this[_0x5c9a('0x12')]=_0x4d8ee7['uniqueid'];this[_0x5c9a('0x13')]=_0x30db3c['name'];this[_0x5c9a('0x14')]=_0x30db3c['number'];this[_0x5c9a('0x15')]=_0x30db3c[_0x5c9a('0x15')];this['responsetime']=_0x30db3c[_0x5c9a('0x16')];this['droptime']=_0x30db3c['droptime'];this[_0x5c9a('0x17')]=this['droptime'];this[_0x5c9a('0x18')]=getSeconds(_0x30db3c['responsetime'],_0x30db3c['starttime']);this[_0x5c9a('0x19')]=getSeconds(this[_0x5c9a('0x1a')],_0x30db3c[_0x5c9a('0x16')]);this['talktime']=0x0;this[_0x5c9a('0x9')]=_0x4d8ee7[_0x5c9a('0x9')];this[_0x5c9a('0x1b')]=_0x4d8ee7['connectedlinename'];this[_0x5c9a('0x1c')]=_0x4d8ee7[_0x5c9a('0x1c')];this[_0x5c9a('0x1d')]=_0x30db3c[_0x5c9a('0x1d')];this[_0x5c9a('0x1e')]=_0x30db3c[_0x5c9a('0x1e')];this['callbackat']=_0x30db3c[_0x5c9a('0x1f')];this[_0x5c9a('0x20')]=_0x30db3c[_0x5c9a('0x20')];this[_0x5c9a('0x21')]=_0x30db3c['ContactId'];this['ListId']=_0x30db3c['ListId'];this[_0x5c9a('0x22')]=_0x30db3c[_0x5c9a('0x22')];this[_0x5c9a('0x23')]=_0x30db3c[_0x5c9a('0x23')];this[_0x5c9a('0x24')]=_0x30db3c[_0x5c9a('0x24')];this[_0x5c9a('0x25')]=_0x30db3c[_0x5c9a('0x25')]||'';this['originatecalleridname']=_0x30db3c['originatecalleridname']||'';}module[_0x5c9a('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x3987=['holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x3987,0x12f));var _0x7398=function(_0x5a9055,_0x48668d){_0x5a9055=_0x5a9055-0x0;var _0x24a9ae=_0x3987[_0x5a9055];return _0x24a9ae;};'use strict';var util=require(_0x7398('0x0'));var _=require(_0x7398('0x1'));var moment=require('moment');function getSeconds(_0x40b772,_0x2727f6){var _0x1d7eb9=moment(_0x40b772)[_0x7398('0x2')](0x0);var _0x34c971=moment(_0x2727f6)[_0x7398('0x2')](0x0);return _0x1d7eb9[_0x7398('0x3')](_0x34c971,_0x7398('0x4'));}function QueueCallerAbandon(_0xda5f45,_0x203e5f){this[_0x7398('0x5')]=_0xda5f45[_0x7398('0x5')];this[_0x7398('0x6')]=_0xda5f45[_0x7398('0x6')];this['campaigntype']=_0xda5f45[_0x7398('0x6')]===_0x7398('0x7')?_0x7398('0x8'):_0xda5f45[_0x7398('0x6')];this[_0x7398('0x9')]=_0xda5f45['countbusyretry'];this['countcongestionretry']=_0xda5f45['countcongestionretry'];this[_0x7398('0xa')]=_0xda5f45['countnoanswerretry'];this['countglobal']=_0xda5f45[_0x7398('0x9')]+_0xda5f45['countcongestionretry']+_0xda5f45[_0x7398('0xa')]+_0xda5f45[_0x7398('0xb')]+_0xda5f45[_0x7398('0xc')]+_0xda5f45['countabandonedretry']+_0xda5f45[_0x7398('0xd')]+_0xda5f45[_0x7398('0xe')];this['countnosuchnumberretry']=_0xda5f45[_0x7398('0xb')];this[_0x7398('0xc')]=_0xda5f45[_0x7398('0xc')];this[_0x7398('0xf')]=_0xda5f45[_0x7398('0xf')];this[_0x7398('0xd')]=_0xda5f45['countmachineretry'];this[_0x7398('0xe')]=_0xda5f45[_0x7398('0xe')];this[_0x7398('0x10')]=_0x203e5f[_0x7398('0x10')];this[_0x7398('0x11')]=_0xda5f45[_0x7398('0x12')];this['calleridnum']=_0xda5f45[_0x7398('0x13')];this[_0x7398('0x14')]=_0xda5f45[_0x7398('0x14')];this['responsetime']=_0xda5f45[_0x7398('0x15')];this['droptime']=_0xda5f45[_0x7398('0x16')];this[_0x7398('0x17')]=this['droptime'];this[_0x7398('0x18')]=getSeconds(_0xda5f45[_0x7398('0x15')],_0xda5f45['starttime']);this[_0x7398('0x19')]=getSeconds(this[_0x7398('0x16')],_0xda5f45['responsetime']);this[_0x7398('0x1a')]=0x0;this['queue']=_0x203e5f[_0x7398('0x8')];this[_0x7398('0x1b')]=_0x203e5f['connectedlinename'];this[_0x7398('0x1c')]=_0x203e5f['reason'];this[_0x7398('0x1d')]=_0xda5f45[_0x7398('0x1d')];this[_0x7398('0x1e')]=_0xda5f45[_0x7398('0x1e')];this[_0x7398('0x1f')]=_0xda5f45[_0x7398('0x1f')];this[_0x7398('0x20')]=_0xda5f45[_0x7398('0x20')];this[_0x7398('0x21')]=_0xda5f45[_0x7398('0x21')];this[_0x7398('0x22')]=_0xda5f45[_0x7398('0x22')];this[_0x7398('0x23')]=_0xda5f45[_0x7398('0x23')];this[_0x7398('0x24')]=_0xda5f45['VoiceQueueId'];this[_0x7398('0x25')]=_0xda5f45['CampaignId'];this[_0x7398('0x26')]=_0xda5f45[_0x7398('0x26')]||'';this[_0x7398('0x27')]=_0xda5f45[_0x7398('0x27')]||'';}module[_0x7398('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 61206ae..5d27d9a 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x4c50ad,_0x3404d4){var _0x22eb46=function(_0x52460a){while(--_0x52460a){_0x4c50ad['push'](_0x4c50ad['shift']());}};_0x22eb46(++_0x3404d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x282574,_0x31c407){var _0x203f66=function(_0x766032){while(--_0x766032){_0x282574['push'](_0x282574['shift']());}};_0x203f66(++_0x31c407);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 78f0c83..a448acb 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 _0xbfc4=['\x20syncNewchannel\x20','syncVarSet','variable','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','then','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','fax','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','name','info','channel'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0xbfc4,0x1ab));var _0x4bfc=function(_0x2a09e5,_0x1fb843){_0x2a09e5=_0x2a09e5-0x0;var _0x461b7e=_0xbfc4[_0x2a09e5];return _0x461b7e;};'use strict';var util=require(_0x4bfc('0x0'));var _=require(_0x4bfc('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4bfc('0x2'));var moment=require(_0x4bfc('0x3'));var path=require('path');var tiff2pdf=require(_0x4bfc('0x4'));var gs=require(_0x4bfc('0x5'));var logger=require(_0x4bfc('0x6'))('fax');var ami=require(_0x4bfc('0x7'));var rpcDb=require(_0x4bfc('0x8'));var Channel=require(_0x4bfc('0x9'));var ut=require(_0x4bfc('0xa'));var Action=require(_0x4bfc('0xb'));var faxAccount=require(_0x4bfc('0xc'));var attachment=require(_0x4bfc('0xd'));var faxMessage=require(_0x4bfc('0xe'));function Fax(_0xa4b964){this[_0x4bfc('0xf')]={};this[_0x4bfc('0x10')]=_0xa4b964['faxAccounts'];this[_0x4bfc('0x11')]=_0xa4b964[_0x4bfc('0x11')];this[_0x4bfc('0x12')]={};ami['on'](_0x4bfc('0x13'),this['syncNewchannel'][_0x4bfc('0x14')](this));ami['on'](_0x4bfc('0x15'),this['syncVarSet'][_0x4bfc('0x14')](this));ami['on'](_0x4bfc('0x16'),this[_0x4bfc('0x17')][_0x4bfc('0x14')](this));ami['on'](_0x4bfc('0x18'),this[_0x4bfc('0x19')][_0x4bfc('0x14')](this));ami['on'](_0x4bfc('0x1a'),this[_0x4bfc('0x1b')]['bind'](this));ami['on'](_0x4bfc('0x1c'),this[_0x4bfc('0x1d')][_0x4bfc('0x14')](this));ami['on']('hangup',this[_0x4bfc('0x1e')][_0x4bfc('0x14')](this));ami['on'](_0x4bfc('0x1f'),this['syncOriginateResponse']['bind'](this));}Fax[_0x4bfc('0x20')]['syncNewchannel']=function(_0x429e63){if(_0x429e63[_0x4bfc('0x21')]==='from-voip-provider'){for(var _0x40f344 in this[_0x4bfc('0x10')]){if(this[_0x4bfc('0x10')][_0x4bfc('0x22')](_0x40f344)){if(_0x429e63[_0x4bfc('0x23')]===this[_0x4bfc('0x10')][_0x40f344][_0x4bfc('0x24')]){this[_0x4bfc('0xf')][_0x429e63['uniqueid']]={};this[_0x4bfc('0xf')][_0x429e63[_0x4bfc('0x25')]]['channel']=_0x429e63['channel'];this[_0x4bfc('0xf')][_0x429e63[_0x4bfc('0x25')]]['id']=this[_0x4bfc('0x10')][_0x40f344]['id'];this['channels'][_0x429e63[_0x4bfc('0x25')]]['name']=this['faxAccounts'][_0x40f344][_0x4bfc('0x26')];logger[_0x4bfc('0x27')](_0x429e63['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x4bfc('0x12')][_0x429e63[_0x4bfc('0x25')]]){this[_0x4bfc('0xf')][_0x429e63[_0x4bfc('0x25')]]={};this[_0x4bfc('0xf')][_0x429e63[_0x4bfc('0x25')]][_0x4bfc('0x28')]=_0x429e63[_0x4bfc('0x28')];logger[_0x4bfc('0x27')](_0x429e63[_0x4bfc('0x25')],_0x4bfc('0x29'));}};Fax['prototype'][_0x4bfc('0x2a')]=function(_0x54e69a){if(this[_0x4bfc('0xf')][_0x54e69a[_0x4bfc('0x25')]]){for(var _0x15d11d in _0x54e69a[_0x4bfc('0x2b')]){if(_0x54e69a[_0x4bfc('0x2b')][_0x4bfc('0x22')](_0x15d11d)){this['channels'][_0x54e69a['uniqueid']][_0x15d11d]=_0x54e69a['value'];}}}};Fax[_0x4bfc('0x20')][_0x4bfc('0x17')]=function(_0x1bdc56){if(this[_0x4bfc('0xf')][_0x1bdc56[_0x4bfc('0x25')]]){this['channels'][_0x1bdc56[_0x4bfc('0x25')]][_0x4bfc('0x2c')]=_0x1bdc56['channelstate'];this['channels'][_0x1bdc56[_0x4bfc('0x25')]][_0x4bfc('0x2d')]=_0x1bdc56[_0x4bfc('0x2d')];}};Fax[_0x4bfc('0x20')]['syncNewExten']=function(_0x3df365){if(this['channels'][_0x3df365['uniqueid']]){for(var _0x27e238 in _0x3df365[_0x4bfc('0x2b')]){if(_0x3df365[_0x4bfc('0x2b')][_0x4bfc('0x22')](_0x27e238)){this[_0x4bfc('0xf')][_0x3df365[_0x4bfc('0x25')]][_0x27e238]=_0x3df365['value'];}}}};Fax[_0x4bfc('0x20')][_0x4bfc('0x1b')]=function(_0x4559a2){if(this[_0x4bfc('0xf')][_0x4559a2['uniqueid']]){this[_0x4bfc('0xf')][_0x4559a2[_0x4bfc('0x25')]][_0x4bfc('0x2e')]=_0x4559a2['operation'];this['channels'][_0x4559a2[_0x4bfc('0x25')]][_0x4bfc('0x2f')]=_0x4559a2['status'];this[_0x4bfc('0xf')][_0x4559a2['uniqueid']][_0x4bfc('0x24')]=_0x4559a2[_0x4bfc('0x24')];this['channels'][_0x4559a2[_0x4bfc('0x25')]][_0x4bfc('0x30')]=_0x4559a2['filename'];logger[_0x4bfc('0x27')](_0x4559a2[_0x4bfc('0x25')],_0x4bfc('0x31'));}};Fax[_0x4bfc('0x20')][_0x4bfc('0x1d')]=function(_0x119790){var _0x397ffe=this;if(this[_0x4bfc('0xf')][_0x119790['uniqueid']]){var _0x38953d=this[_0x4bfc('0xf')][_0x119790[_0x4bfc('0x25')]]['id'];this[_0x4bfc('0xf')][_0x119790[_0x4bfc('0x25')]][_0x4bfc('0x32')]=_0x119790[_0x4bfc('0x32')];this[_0x4bfc('0xf')][_0x119790['uniqueid']][_0x4bfc('0x33')]=_0x119790[_0x4bfc('0x33')];this[_0x4bfc('0xf')][_0x119790[_0x4bfc('0x25')]][_0x4bfc('0x24')]=_0x119790[_0x4bfc('0x24')];this['channels'][_0x119790['uniqueid']]['resolution']=_0x119790[_0x4bfc('0x34')];this[_0x4bfc('0xf')][_0x119790[_0x4bfc('0x25')]]['transferrate']=_0x119790[_0x4bfc('0x35')];this[_0x4bfc('0xf')][_0x119790[_0x4bfc('0x25')]][_0x4bfc('0x30')]=_0x119790[_0x4bfc('0x30')];this[_0x4bfc('0xf')][_0x119790['uniqueid']][_0x4bfc('0x36')]=_0x119790[_0x4bfc('0x36')];if(this[_0x4bfc('0xf')][_0x119790['uniqueid']][_0x4bfc('0x33')]>0x0){tiff2pdf(_0x119790['filename'],_0x4bfc('0x37'),function(_0x499f89){logger['info'](_0x119790[_0x4bfc('0x25')],'\x20result\x20conversion\x20file\x20',_0x499f89[_0x4bfc('0x38')]);attachment[_0x4bfc('0x39')]({'name':path[_0x4bfc('0x3a')](_0x119790[_0x4bfc('0x30')])[_0x4bfc('0x26')],'basename':path[_0x4bfc('0x3a')](_0x119790[_0x4bfc('0x30')])[_0x4bfc('0x26')]+'.pdf','type':_0x4bfc('0x3b')})[_0x4bfc('0x3c')](function(_0x4a0e44){faxAccount['notify'](_0x38953d,{'from':_0x119790['calleridnum'],'mapKey':'fax','body':path['parse'](_0x119790[_0x4bfc('0x30')])[_0x4bfc('0x26')]+_0x4bfc('0x3d'),'AttachmentId':_0x4a0e44['id']})[_0x4bfc('0x3e')](function(_0x3fc5a5){logger[_0x4bfc('0x3f')](_0x119790['uniqueid'],_0x4bfc('0x40'),JSON[_0x4bfc('0x41')](_0x3fc5a5));});})['catch'](function(_0x3608c6){logger[_0x4bfc('0x3f')](_0x119790['uniqueid'],_0x4bfc('0x42'),JSON[_0x4bfc('0x41')](_0x3608c6));});});}logger['info'](_0x119790[_0x4bfc('0x25')],_0x4bfc('0x42'));}};Fax[_0x4bfc('0x20')][_0x4bfc('0x43')]=function(_0x196fce){if(this[_0x4bfc('0x12')][_0x196fce[_0x4bfc('0x25')]]){_[_0x4bfc('0x44')](this[_0x4bfc('0xf')][_0x196fce['uniqueid']],_[_0x4bfc('0x45')](_0x196fce,['response',_0x4bfc('0x46')]));}};function updateStatus(_0x5f39b0){if(_0x5f39b0[_0x4bfc('0x47')]){faxMessage['update'](_0x5f39b0[_0x4bfc('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x4bfc('0x3c')](function(_0x572479){ut[_0x4bfc('0x48')]('[Fax][Message][Error][Updated]',_0x572479);})[_0x4bfc('0x3e')](function(_0x512cbf){ut[_0x4bfc('0x48')](_0x4bfc('0x49'),_0x512cbf);});}else{ut[_0x4bfc('0x48')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x4bfc('0x20')][_0x4bfc('0x4a')]=function(_0xaaaba9,_0x119ea3,_0x2c8479){var _0x3fc4e0=this;var _0x473614={};if(_0x119ea3){_0x473614={'read':_0x119ea3};}else{_0x473614={'failMessage':_0x2c8479};}if(this[_0x4bfc('0x12')][_0xaaaba9][_0x4bfc('0x47')]){faxMessage[_0x4bfc('0x4b')](this[_0x4bfc('0x12')][_0xaaaba9][_0x4bfc('0x47')],_0x473614)['then'](function(_0x57ca11){ut[_0x4bfc('0x48')](_0x4bfc('0x4c'),_0x57ca11);})[_0x4bfc('0x3e')](function(_0x320c54){ut[_0x4bfc('0x48')](_0x4bfc('0x4d'),_0x320c54);})[_0x4bfc('0x4e')](function(){delete _0x3fc4e0[_0x4bfc('0xf')][_0xaaaba9];delete _0x3fc4e0[_0x4bfc('0x12')][_0xaaaba9];});}else{ut[_0x4bfc('0x48')](_0x4bfc('0x4f'));delete this['channels'][_0xaaaba9];delete this[_0x4bfc('0x12')][_0xaaaba9];}};Fax[_0x4bfc('0x20')][_0x4bfc('0x1e')]=function(_0x25ec53){var _0x2a03be=this;if(this[_0x4bfc('0xf')][_0x25ec53[_0x4bfc('0x25')]]){if(this[_0x4bfc('0x12')][_0x25ec53[_0x4bfc('0x25')]]){this[_0x4bfc('0xf')][_0x25ec53[_0x4bfc('0x25')]]['id']=this[_0x4bfc('0x12')][_0x25ec53[_0x4bfc('0x25')]]['id'];this[_0x4bfc('0xf')][_0x25ec53[_0x4bfc('0x25')]][_0x4bfc('0x26')]=this[_0x4bfc('0x12')][_0x25ec53['uniqueid']][_0x4bfc('0x26')];}logger[_0x4bfc('0x27')](_0x25ec53['uniqueid'],this['actions'][_0x25ec53['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x4bfc('0x50'),JSON[_0x4bfc('0x41')](this[_0x4bfc('0xf')][_0x25ec53['uniqueid']]));if(this[_0x4bfc('0x12')][_0x25ec53['uniqueid']]){if(this[_0x4bfc('0xf')][_0x25ec53[_0x4bfc('0x25')]][_0x4bfc('0x51')]>0x0&&this[_0x4bfc('0xf')][_0x25ec53[_0x4bfc('0x25')]]['faxstatus']===_0x4bfc('0x52')){this['updateStatus'](_0x25ec53[_0x4bfc('0x25')],!![]);}else{this['updateStatus'](_0x25ec53[_0x4bfc('0x25')],![],this['channels'][_0x25ec53[_0x4bfc('0x25')]][_0x4bfc('0x53')]?_0x4bfc('0x54')+this['channels'][_0x25ec53['uniqueid']][_0x4bfc('0x53')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x15751c){var _0x2e543a=this;return new BPromise(function(_0x255cd3,_0x48007e){_0x2e543a[_0x4bfc('0x55')](_0x15751c,_0x2e543a['faxAccounts'][_0x15751c[_0x4bfc('0x56')]])[_0x4bfc('0x3c')](function(_0x58b06){ut[_0x4bfc('0x48')]('[Fax][execOriginate][success]',_0x58b06);_0x255cd3(ut[_0x4bfc('0x38')](_0x4bfc('0x57')));})[_0x4bfc('0x3e')](function(_0x3d88dc){ut['logger'](_0x4bfc('0x58'),_0x3d88dc);updateStatus(_0x15751c);_0x48007e(ut[_0x4bfc('0x38')](_0x4bfc('0x59')));});});};Fax[_0x4bfc('0x20')][_0x4bfc('0x5a')]=function(_0x46d60e){var _0x1e115f=this;return new BPromise(function(_0x11c975,_0x44f764){var _0xf276a6=_0x1e115f['checkTrunk'](_0x1e115f[_0x4bfc('0x10')][_0x46d60e[_0x4bfc('0x56')]][_0x4bfc('0x5b')],_0x46d60e);if(_0xf276a6['isValid']){_0x11c975(ut[_0x4bfc('0x38')](_0x4bfc('0x5c')));}else{_0x44f764(ut[_0x4bfc('0x38')](_0xf276a6[_0x4bfc('0x38')]));}});};function originate(_0x1de7de,_0x5a2926,_0x112aeb){return new BPromise(function(_0x2be95e,_0x5de4ba){if(_0x112aeb){var _0x1976e6=util[_0x4bfc('0x5d')](_0x4bfc('0x5e'),path[_0x4bfc('0x3a')](_0x1de7de[_0x4bfc('0x5f')])[_0x4bfc('0x26')],_0x1de7de[_0x4bfc('0x5f')]);gs[_0x4bfc('0x60')](_0x1976e6)['then'](function(){_0x1de7de[_0x4bfc('0x5f')]=util['format'](_0x4bfc('0x61'),path[_0x4bfc('0x3a')](_0x1de7de[_0x4bfc('0x5f')])['dir'],path[_0x4bfc('0x3a')](_0x1de7de[_0x4bfc('0x5f')])[_0x4bfc('0x26')]);_0x5a2926[_0x4bfc('0x62')]=_0x1de7de[_0x4bfc('0x5f')];ut[_0x4bfc('0x48')](_0x4bfc('0x63'),'');ami[_0x4bfc('0x64')](ut[_0x4bfc('0x65')](_0x1de7de,_0x5a2926))[_0x4bfc('0x3c')](function(_0x5da62e){_0x2be95e(_0x5da62e);})['catch'](function(_0x50cfe4){_0x5de4ba(_0x50cfe4);});})[_0x4bfc('0x3e')](function(_0x4fc2a9){_0x5de4ba(_0x4fc2a9);});}else{ami[_0x4bfc('0x64')](ut[_0x4bfc('0x65')](_0x1de7de,_0x5a2926))[_0x4bfc('0x3c')](function(_0x486aff){_0x2be95e(_0x486aff);})[_0x4bfc('0x3e')](function(_0x2da159){_0x5de4ba(_0x2da159);});}});}Fax['prototype'][_0x4bfc('0x55')]=function(_0x2e58b3,_0x528e03){var _0x1d7686=this;return new BPromise(function(_0x59499a,_0x3a467d){var _0x207c08=uuid['v4']();var _0x14fd84=ut['addVariables'](_0x2e58b3,_0x528e03);_0x1d7686[_0x4bfc('0x12')][_0x207c08]=new Action(_0x207c08,_0x528e03,_0x2e58b3);var _0xae85cf=_0x1d7686[_0x4bfc('0x12')][_0x207c08];if(path[_0x4bfc('0x3a')](_0x2e58b3['path'])['ext']===_0x4bfc('0x3d')){originate(_0xae85cf,_0x14fd84,!![])[_0x4bfc('0x3c')](function(_0x4827d8){_0x59499a(_0x4827d8);})[_0x4bfc('0x3e')](function(_0x3c7b99){_0x3a467d(_0x3c7b99);});}else{originate(_0xae85cf,_0x14fd84,![])[_0x4bfc('0x3c')](function(_0xa68996){_0x59499a(_0xa68996);})[_0x4bfc('0x3e')](function(_0x38760f){_0x3a467d(_0x38760f);});}});};Fax[_0x4bfc('0x20')][_0x4bfc('0x66')]=function(_0x1d7296){return!_[_0x4bfc('0x67')](_0x1d7296)&&!_[_0x4bfc('0x67')](_0x1d7296[_0x4bfc('0x26')])&&!_[_0x4bfc('0x67')](_0x1d7296[_0x4bfc('0x68')])&&_0x1d7296[_0x4bfc('0x68')]&&!_['isNil'](this['trunks'][util[_0x4bfc('0x5d')](_0x4bfc('0x69'),_0x1d7296[_0x4bfc('0x26')])])&&!_[_0x4bfc('0x67')](this[_0x4bfc('0x11')][util[_0x4bfc('0x5d')](_0x4bfc('0x69'),_0x1d7296['name'])][_0x4bfc('0x2f')])&&(this[_0x4bfc('0x11')][util[_0x4bfc('0x5d')](_0x4bfc('0x69'),_0x1d7296['name'])][_0x4bfc('0x2f')]===_0x4bfc('0x6a')||this[_0x4bfc('0x11')][util[_0x4bfc('0x5d')](_0x4bfc('0x69'),_0x1d7296[_0x4bfc('0x26')])][_0x4bfc('0x2f')]===_0x4bfc('0x6b'));};Fax[_0x4bfc('0x20')][_0x4bfc('0x6c')]=function(_0x58f5e2,_0x1c5f80){if(!this[_0x4bfc('0x66')](_0x58f5e2)){ut[_0x4bfc('0x48')](_0x4bfc('0x6d'),_[_0x4bfc('0x67')](_0x58f5e2)?'':_0x58f5e2[_0x4bfc('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4bfc('0x6e')};}if(_['isNil'](_0x1c5f80[_0x4bfc('0x6f')])){ut[_0x4bfc('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x1c5f80));return{'isValid':![],'message':_0x4bfc('0x70')};}if(_['isNil'](_0x1c5f80['path'])){ut[_0x4bfc('0x48')](_0x4bfc('0x71'),JSON[_0x4bfc('0x41')](_0x1c5f80));return{'isValid':![],'message':_0x4bfc('0x72')};}return{'isValid':!![],'message':_0x4bfc('0x73')};};module[_0x4bfc('0x74')]=Fax; \ No newline at end of file +var _0xa92c=['uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','hasOwnProperty','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','calleridnum','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','newchannel','syncNewchannel','syncVarSet','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context'];(function(_0xd8d5df,_0x59182a){var _0x37f5c9=function(_0x666485){while(--_0x666485){_0xd8d5df['push'](_0xd8d5df['shift']());}};_0x37f5c9(++_0x59182a);}(_0xa92c,0x143));var _0xca92=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xa92c[_0xdd2bfa];return _0x55397e;};'use strict';var util=require(_0xca92('0x0'));var _=require(_0xca92('0x1'));var BPromise=require(_0xca92('0x2'));var uuid=require(_0xca92('0x3'));var moment=require(_0xca92('0x4'));var path=require(_0xca92('0x5'));var tiff2pdf=require(_0xca92('0x6'));var gs=require('./util/gs');var logger=require('../../../config/logger')('fax');var ami=require(_0xca92('0x7'));var rpcDb=require(_0xca92('0x8'));var Channel=require(_0xca92('0x9'));var ut=require(_0xca92('0xa'));var Action=require(_0xca92('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xca92('0xc'));var faxMessage=require(_0xca92('0xd'));function Fax(_0x21f2d9){this[_0xca92('0xe')]={};this[_0xca92('0xf')]=_0x21f2d9['faxAccounts'];this['trunks']=_0x21f2d9['trunks'];this['actions']={};ami['on'](_0xca92('0x10'),this[_0xca92('0x11')]['bind'](this));ami['on']('varset',this[_0xca92('0x12')][_0xca92('0x13')](this));ami['on']('newstate',this[_0xca92('0x14')]['bind'](this));ami['on'](_0xca92('0x15'),this[_0xca92('0x16')][_0xca92('0x13')](this));ami['on'](_0xca92('0x17'),this[_0xca92('0x18')][_0xca92('0x13')](this));ami['on']('receivefax',this[_0xca92('0x19')]['bind'](this));ami['on']('hangup',this[_0xca92('0x1a')]['bind'](this));ami['on'](_0xca92('0x1b'),this[_0xca92('0x1c')][_0xca92('0x13')](this));}Fax[_0xca92('0x1d')][_0xca92('0x11')]=function(_0x3ee393){if(_0x3ee393[_0xca92('0x1e')]==='from-voip-provider'){for(var _0xa3f2d in this[_0xca92('0xf')]){if(this[_0xca92('0xf')]['hasOwnProperty'](_0xa3f2d)){if(_0x3ee393['exten']===this['faxAccounts'][_0xa3f2d]['localstationid']){this[_0xca92('0xe')][_0x3ee393[_0xca92('0x1f')]]={};this[_0xca92('0xe')][_0x3ee393[_0xca92('0x1f')]]['channel']=_0x3ee393[_0xca92('0x20')];this['channels'][_0x3ee393[_0xca92('0x1f')]]['id']=this[_0xca92('0xf')][_0xa3f2d]['id'];this[_0xca92('0xe')][_0x3ee393['uniqueid']][_0xca92('0x21')]=this[_0xca92('0xf')][_0xa3f2d][_0xca92('0x21')];logger[_0xca92('0x22')](_0x3ee393[_0xca92('0x1f')],_0xca92('0x23'));}}}}if(this[_0xca92('0x24')][_0x3ee393['uniqueid']]){this['channels'][_0x3ee393[_0xca92('0x1f')]]={};this[_0xca92('0xe')][_0x3ee393['uniqueid']]['channel']=_0x3ee393['channel'];logger[_0xca92('0x22')](_0x3ee393['uniqueid'],_0xca92('0x23'));}};Fax[_0xca92('0x1d')]['syncVarSet']=function(_0x74fd5b){if(this[_0xca92('0xe')][_0x74fd5b[_0xca92('0x1f')]]){for(var _0x3ea311 in _0x74fd5b[_0xca92('0x25')]){if(_0x74fd5b[_0xca92('0x25')][_0xca92('0x26')](_0x3ea311)){this[_0xca92('0xe')][_0x74fd5b[_0xca92('0x1f')]][_0x3ea311]=_0x74fd5b['value'];}}}};Fax[_0xca92('0x1d')][_0xca92('0x14')]=function(_0x1cfc5d){if(this[_0xca92('0xe')][_0x1cfc5d[_0xca92('0x1f')]]){this[_0xca92('0xe')][_0x1cfc5d[_0xca92('0x1f')]][_0xca92('0x27')]=_0x1cfc5d[_0xca92('0x27')];this[_0xca92('0xe')][_0x1cfc5d[_0xca92('0x1f')]][_0xca92('0x28')]=_0x1cfc5d[_0xca92('0x28')];}};Fax[_0xca92('0x1d')][_0xca92('0x16')]=function(_0xfc0f95){if(this['channels'][_0xfc0f95[_0xca92('0x1f')]]){for(var _0x5dc44c in _0xfc0f95[_0xca92('0x25')]){if(_0xfc0f95[_0xca92('0x25')]['hasOwnProperty'](_0x5dc44c)){this[_0xca92('0xe')][_0xfc0f95[_0xca92('0x1f')]][_0x5dc44c]=_0xfc0f95[_0xca92('0x29')];}}}};Fax[_0xca92('0x1d')][_0xca92('0x18')]=function(_0xd77160){if(this[_0xca92('0xe')][_0xd77160[_0xca92('0x1f')]]){this[_0xca92('0xe')][_0xd77160[_0xca92('0x1f')]]['operation']=_0xd77160[_0xca92('0x2a')];this[_0xca92('0xe')][_0xd77160[_0xca92('0x1f')]][_0xca92('0x2b')]=_0xd77160[_0xca92('0x2b')];this[_0xca92('0xe')][_0xd77160['uniqueid']][_0xca92('0x2c')]=_0xd77160[_0xca92('0x2c')];this[_0xca92('0xe')][_0xd77160['uniqueid']]['filename']=_0xd77160[_0xca92('0x2d')];logger[_0xca92('0x22')](_0xd77160[_0xca92('0x1f')],_0xca92('0x2e'));}};Fax[_0xca92('0x1d')][_0xca92('0x19')]=function(_0x441a90){var _0x2eb75a=this;if(this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]]){var _0x1b291a=this['channels'][_0x441a90[_0xca92('0x1f')]]['id'];this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]][_0xca92('0x2f')]=_0x441a90[_0xca92('0x2f')];this['channels'][_0x441a90[_0xca92('0x1f')]][_0xca92('0x30')]=_0x441a90['pagestransferred'];this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]][_0xca92('0x2c')]=_0x441a90['localstationid'];this['channels'][_0x441a90[_0xca92('0x1f')]]['resolution']=_0x441a90[_0xca92('0x31')];this['channels'][_0x441a90[_0xca92('0x1f')]][_0xca92('0x32')]=_0x441a90[_0xca92('0x32')];this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]][_0xca92('0x2d')]=_0x441a90[_0xca92('0x2d')];this['channels'][_0x441a90[_0xca92('0x1f')]]['calleridnum']=_0x441a90['calleridnum'];if(this[_0xca92('0xe')][_0x441a90[_0xca92('0x1f')]][_0xca92('0x30')]>0x0){tiff2pdf(_0x441a90['filename'],_0xca92('0x33'),function(_0x408b86){logger['info'](_0x441a90[_0xca92('0x1f')],_0xca92('0x34'),_0x408b86[_0xca92('0x35')]);attachment[_0xca92('0x36')]({'name':path[_0xca92('0x37')](_0x441a90[_0xca92('0x2d')])[_0xca92('0x21')],'basename':path['parse'](_0x441a90['filename'])[_0xca92('0x21')]+_0xca92('0x38'),'type':_0xca92('0x39')})['then'](function(_0x205d24){faxAccount[_0xca92('0x3a')](_0x1b291a,{'from':_0x441a90[_0xca92('0x3b')],'mapKey':'fax','body':path[_0xca92('0x37')](_0x441a90[_0xca92('0x2d')])[_0xca92('0x21')]+'.pdf','AttachmentId':_0x205d24['id']})[_0xca92('0x3c')](function(_0x257cd8){logger[_0xca92('0x3d')](_0x441a90['uniqueid'],_0xca92('0x3e'),JSON[_0xca92('0x3f')](_0x257cd8));});})[_0xca92('0x3c')](function(_0x183180){logger[_0xca92('0x3d')](_0x441a90[_0xca92('0x1f')],_0xca92('0x40'),JSON[_0xca92('0x3f')](_0x183180));});});}logger['info'](_0x441a90[_0xca92('0x1f')],_0xca92('0x40'));}};Fax[_0xca92('0x1d')][_0xca92('0x1c')]=function(_0x47c4b3){if(this[_0xca92('0x24')][_0x47c4b3[_0xca92('0x1f')]]){_[_0xca92('0x41')](this['channels'][_0x47c4b3[_0xca92('0x1f')]],_[_0xca92('0x42')](_0x47c4b3,[_0xca92('0x43'),_0xca92('0x44')]));}};function updateStatus(_0x49e5c1){if(_0x49e5c1['AttachmentId']){faxMessage[_0xca92('0x45')](_0x49e5c1[_0xca92('0x46')],{'failMessage':_0xca92('0x47')})[_0xca92('0x48')](function(_0x49261f){ut[_0xca92('0x49')]('[Fax][Message][Error][Updated]',_0x49261f);})[_0xca92('0x3c')](function(_0x2715f0){ut[_0xca92('0x49')](_0xca92('0x4a'),_0x2715f0);});}else{ut[_0xca92('0x49')](_0xca92('0x4b'));}}Fax['prototype'][_0xca92('0x4c')]=function(_0x4e1739,_0x389080,_0x581b66){var _0x2f8073=this;var _0x5f08b3={};if(_0x389080){_0x5f08b3={'read':_0x389080};}else{_0x5f08b3={'failMessage':_0x581b66};}if(this[_0xca92('0x24')][_0x4e1739][_0xca92('0x46')]){faxMessage['update'](this[_0xca92('0x24')][_0x4e1739]['AttachmentId'],_0x5f08b3)['then'](function(_0xbd580){ut[_0xca92('0x49')](_0xca92('0x4d'),_0xbd580);})[_0xca92('0x3c')](function(_0x38d716){ut[_0xca92('0x49')](_0xca92('0x4e'),_0x38d716);})[_0xca92('0x4f')](function(){delete _0x2f8073[_0xca92('0xe')][_0x4e1739];delete _0x2f8073['actions'][_0x4e1739];});}else{ut[_0xca92('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0xca92('0xe')][_0x4e1739];delete this['actions'][_0x4e1739];}};Fax[_0xca92('0x1d')][_0xca92('0x1a')]=function(_0x52af86){var _0x598b49=this;if(this[_0xca92('0xe')][_0x52af86['uniqueid']]){if(this[_0xca92('0x24')][_0x52af86['uniqueid']]){this[_0xca92('0xe')][_0x52af86['uniqueid']]['id']=this[_0xca92('0x24')][_0x52af86[_0xca92('0x1f')]]['id'];this[_0xca92('0xe')][_0x52af86[_0xca92('0x1f')]][_0xca92('0x21')]=this[_0xca92('0x24')][_0x52af86[_0xca92('0x1f')]][_0xca92('0x21')];}logger[_0xca92('0x22')](_0x52af86[_0xca92('0x1f')],this[_0xca92('0x24')][_0x52af86['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xca92('0x50'),JSON['stringify'](this[_0xca92('0xe')][_0x52af86['uniqueid']]));if(this[_0xca92('0x24')][_0x52af86['uniqueid']]){if(this[_0xca92('0xe')][_0x52af86[_0xca92('0x1f')]][_0xca92('0x51')]>0x0&&this[_0xca92('0xe')][_0x52af86[_0xca92('0x1f')]][_0xca92('0x17')]===_0xca92('0x52')){this['updateStatus'](_0x52af86[_0xca92('0x1f')],!![]);}else{this['updateStatus'](_0x52af86[_0xca92('0x1f')],![],this[_0xca92('0xe')][_0x52af86['uniqueid']]['faxstatusstring']?_0xca92('0x53')+this[_0xca92('0xe')][_0x52af86['uniqueid']][_0xca92('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xca92('0x1d')]['send']=function(_0x3fa1f4){var _0x741ae1=this;return new BPromise(function(_0x3d72cc,_0x42ec22){_0x741ae1['execOriginate'](_0x3fa1f4,_0x741ae1[_0xca92('0xf')][_0x3fa1f4[_0xca92('0x55')]])[_0xca92('0x48')](function(_0x37f46c){ut[_0xca92('0x49')](_0xca92('0x56'),_0x37f46c);_0x3d72cc(ut[_0xca92('0x35')]('Fax\x20received'));})[_0xca92('0x3c')](function(_0x115646){ut[_0xca92('0x49')](_0xca92('0x57'),_0x115646);updateStatus(_0x3fa1f4);_0x42ec22(ut[_0xca92('0x35')](_0xca92('0x58')));});});};Fax[_0xca92('0x1d')][_0xca92('0x59')]=function(_0x258560){var _0x5673fa=this;return new BPromise(function(_0x27e83b,_0x5fe4db){var _0x134972=_0x5673fa[_0xca92('0x5a')](_0x5673fa[_0xca92('0xf')][_0x258560['FaxAccountId']][_0xca92('0x5b')],_0x258560);if(_0x134972[_0xca92('0x5c')]){_0x27e83b(ut[_0xca92('0x35')](_0xca92('0x5d')));}else{_0x5fe4db(ut[_0xca92('0x35')](_0x134972[_0xca92('0x35')]));}});};function originate(_0x792968,_0x366571,_0x414d3a){return new BPromise(function(_0x2af65a,_0x59225f){if(_0x414d3a){var _0x4dd089=util[_0xca92('0x5e')](_0xca92('0x5f'),path[_0xca92('0x37')](_0x792968[_0xca92('0x5')])[_0xca92('0x21')],_0x792968[_0xca92('0x5')]);gs[_0xca92('0x60')](_0x4dd089)['then'](function(){_0x792968[_0xca92('0x5')]=util['format']('%s/%s.tif',path[_0xca92('0x37')](_0x792968[_0xca92('0x5')])[_0xca92('0x61')],path['parse'](_0x792968[_0xca92('0x5')])[_0xca92('0x21')]);_0x366571[_0xca92('0x62')]=_0x792968[_0xca92('0x5')];ut[_0xca92('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xca92('0x63')](ut[_0xca92('0x64')](_0x792968,_0x366571))[_0xca92('0x48')](function(_0x26f776){_0x2af65a(_0x26f776);})[_0xca92('0x3c')](function(_0x55170b){_0x59225f(_0x55170b);});})['catch'](function(_0x372f36){_0x59225f(_0x372f36);});}else{ami['Action'](ut[_0xca92('0x64')](_0x792968,_0x366571))[_0xca92('0x48')](function(_0x19000e){_0x2af65a(_0x19000e);})[_0xca92('0x3c')](function(_0x50cedd){_0x59225f(_0x50cedd);});}});}Fax[_0xca92('0x1d')][_0xca92('0x65')]=function(_0x646f30,_0x4a5ae1){var _0x44f3ae=this;return new BPromise(function(_0x4d834c,_0x5c2527){var _0x470f53=uuid['v4']();var _0x34b6a1=ut[_0xca92('0x66')](_0x646f30,_0x4a5ae1);_0x44f3ae[_0xca92('0x24')][_0x470f53]=new Action(_0x470f53,_0x4a5ae1,_0x646f30);var _0x619cd4=_0x44f3ae[_0xca92('0x24')][_0x470f53];if(path['parse'](_0x646f30[_0xca92('0x5')])[_0xca92('0x67')]===_0xca92('0x38')){originate(_0x619cd4,_0x34b6a1,!![])[_0xca92('0x48')](function(_0x23ce87){_0x4d834c(_0x23ce87);})[_0xca92('0x3c')](function(_0x524a4a){_0x5c2527(_0x524a4a);});}else{originate(_0x619cd4,_0x34b6a1,![])[_0xca92('0x48')](function(_0x372129){_0x4d834c(_0x372129);})[_0xca92('0x3c')](function(_0x2ecbcc){_0x5c2527(_0x2ecbcc);});}});};Fax[_0xca92('0x1d')][_0xca92('0x68')]=function(_0xbacc31){return!_[_0xca92('0x69')](_0xbacc31)&&!_[_0xca92('0x69')](_0xbacc31[_0xca92('0x21')])&&!_[_0xca92('0x69')](_0xbacc31[_0xca92('0x6a')])&&_0xbacc31[_0xca92('0x6a')]&&!_['isNil'](this[_0xca92('0x6b')][util['format'](_0xca92('0x6c'),_0xbacc31[_0xca92('0x21')])])&&!_[_0xca92('0x69')](this['trunks'][util[_0xca92('0x5e')]('SIP/%s',_0xbacc31[_0xca92('0x21')])]['status'])&&(this[_0xca92('0x6b')][util[_0xca92('0x5e')](_0xca92('0x6c'),_0xbacc31[_0xca92('0x21')])][_0xca92('0x2b')]===_0xca92('0x6d')||this[_0xca92('0x6b')][util['format']('SIP/%s',_0xbacc31[_0xca92('0x21')])][_0xca92('0x2b')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x4cfa7b,_0x27efe1){if(!this[_0xca92('0x68')](_0x4cfa7b)){ut[_0xca92('0x49')](_0xca92('0x6e'),_[_0xca92('0x69')](_0x4cfa7b)?'':_0x4cfa7b['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xca92('0x6f')};}if(_['isNil'](_0x27efe1[_0xca92('0x70')])){ut[_0xca92('0x49')](_0xca92('0x71'),JSON[_0xca92('0x3f')](_0x27efe1));return{'isValid':![],'message':_0xca92('0x72')};}if(_[_0xca92('0x69')](_0x27efe1['path'])){ut[_0xca92('0x49')](_0xca92('0x73'),JSON[_0xca92('0x3f')](_0x27efe1));return{'isValid':![],'message':_0xca92('0x74')};}return{'isValid':!![],'message':_0xca92('0x75')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 436ee8d..a0326a1 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 _0x360c=['error','notify','catch','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x360c,0xe5));var _0xc360=function(_0x114169,_0x271e97){_0x114169=_0x114169-0x0;var _0x291812=_0x360c[_0x114169];return _0x291812;};'use strict';var util=require(_0xc360('0x0'));var BPromise=require('bluebird');var logger=require(_0xc360('0x1'))(_0xc360('0x2'));var _=require(_0xc360('0x3'));var faxAccount=require(_0xc360('0x4'));function loggerCatch(_0x2d20d9){return function(_0xc22e84){logger[_0xc360('0x5')](_0x2d20d9,util['inspect'](_0xc22e84,{'showHidden':![],'depth':null}));};}exports[_0xc360('0x6')]=function(_0x285c70,_0x109e54){return BPromise['resolve']()['then'](faxAccount[_0xc360('0x6')](_0x285c70,_0x109e54))[_0xc360('0x7')](loggerCatch(_0xc360('0x8')));}; \ No newline at end of file +var _0x97e8=['preview','lodash','error','inspect','resolve','then','notify','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x2f9138,_0x493638){var _0x21e94e=function(_0x384e6d){while(--_0x384e6d){_0x2f9138['push'](_0x2f9138['shift']());}};_0x21e94e(++_0x493638);}(_0x97e8,0x110));var _0x897e=function(_0x360af7,_0x359dd9){_0x360af7=_0x360af7-0x0;var _0x313cf1=_0x97e8[_0x360af7];return _0x313cf1;};'use strict';var util=require(_0x897e('0x0'));var BPromise=require(_0x897e('0x1'));var logger=require(_0x897e('0x2'))(_0x897e('0x3'));var _=require(_0x897e('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x486b81){return function(_0x9a6736){logger[_0x897e('0x5')](_0x486b81,util[_0x897e('0x6')](_0x9a6736,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x5256e3,_0x31c771){return BPromise[_0x897e('0x7')]()[_0x897e('0x8')](faxAccount[_0x897e('0x9')](_0x5256e3,_0x31c771))['catch'](loggerCatch(_0x897e('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 bedf0fb..c1fe9a8 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 _0x81a3=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process','exec'];(function(_0x269208,_0x14fbc5){var _0x3170e6=function(_0x32dd0e){while(--_0x32dd0e){_0x269208['push'](_0x269208['shift']());}};_0x3170e6(++_0x14fbc5);}(_0x81a3,0xeb));var _0x381a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x81a3[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x381a('0x0'));var logger=require(_0x381a('0x1'))(_0x381a('0x2'));var BPromise=require('bluebird');var exec=require(_0x381a('0x3'))[_0x381a('0x4')];exports[_0x381a('0x5')]=function(_0x370184){return new BPromise(function(_0x32b6d2,_0x56de36){exec(_0x370184,function(_0x1a6e89,_0x4561f7,_0xc2a4fe){logger[_0x381a('0x6')]('Exec\x20gs',_0x4561f7);if(_0x1a6e89){logger[_0x381a('0x6')](_0x381a('0x7'),_0x381a('0x8'),util[_0x381a('0x9')](_0x1a6e89,{'showHidden':![],'depth':null}),_0x4561f7,_0xc2a4fe);_0x56de36(_0x1a6e89);}_0x32b6d2(_0x4561f7);});});}; \ No newline at end of file +var _0x54eb=['exec','execute','info','Exec\x20gs','inspect','util','../../../../config/logger','bluebird','child_process'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x54eb,0x101));var _0xb54e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x54eb[_0x422905];return _0x33dc6c;};'use strict';var util=require(_0xb54e('0x0'));var logger=require(_0xb54e('0x1'))('fax');var BPromise=require(_0xb54e('0x2'));var exec=require(_0xb54e('0x3'))[_0xb54e('0x4')];exports[_0xb54e('0x5')]=function(_0x4a8328){return new BPromise(function(_0x1c143e,_0x1e5e41){exec(_0x4a8328,function(_0x5b6429,_0xc0cf4c,_0x20045c){logger[_0xb54e('0x6')](_0xb54e('0x7'),_0xc0cf4c);if(_0x5b6429){logger[_0xb54e('0x6')]('Exec\x20gs','\x20Error\x20:',util[_0xb54e('0x8')](_0x5b6429,{'showHidden':![],'depth':null}),_0xc0cf4c,_0x20045c);_0x1e5e41(_0x5b6429);}_0x1c143e(_0xc0cf4c);});});}; \ 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 9d95c43..5469b61 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 _0x5a30=['channel','xcally-motion-fax','format','localstationid','uniqueid','util','lodash','moment','../../../../config/logger','fax','logger','info','addVariables','ecm','headerinfo','minrate','maxrate','modem','faxdetect','path','variablesAction'];(function(_0x1002c2,_0xab4f68){var _0x38acec=function(_0x2d56ff){while(--_0x2d56ff){_0x1002c2['push'](_0x1002c2['shift']());}};_0x38acec(++_0xab4f68);}(_0x5a30,0xd7));var _0x05a3=function(_0x416468,_0x2e7a72){_0x416468=_0x416468-0x0;var _0x2ee9b7=_0x5a30[_0x416468];return _0x2ee9b7;};'use strict';var util=require(_0x05a3('0x0'));var _=require(_0x05a3('0x1'));var moment=require(_0x05a3('0x2'));var logger=require(_0x05a3('0x3'))(_0x05a3('0x4'));exports['message']=function(_0x5f0cba){return{'message':_0x5f0cba};};exports[_0x05a3('0x5')]=function(_0x3f117d,_0x84ce7d){logger[_0x05a3('0x6')](_0x3f117d,util['inspect'](_0x84ce7d,{'showHidden':![],'depth':null}));};exports[_0x05a3('0x7')]=function(_0x216933,_0xc3eae2){var _0x230bda={'XMF-ECM':_0xc3eae2[_0x05a3('0x8')],'XMF-HEADERINFO':_0xc3eae2[_0x05a3('0x9')],'XMF-MINRATE':_0xc3eae2[_0x05a3('0xa')],'XMF-MAXRATE':_0xc3eae2[_0x05a3('0xb')],'XMF-MODEM':util['format']('\x22%s\x22',_0xc3eae2[_0x05a3('0xc')]),'XMF-GATEWAY':_0xc3eae2['gateway'],'XMF-FAXDETECT':_0xc3eae2[_0x05a3('0xd')],'XMF-T38TIMEOUT':_0xc3eae2['t38timeout'],'XMF-LOCALSTATIONID':_0xc3eae2['localstationid'],'XMF-PATH':_0x216933[_0x05a3('0xe')]};return _0x230bda;};exports[_0x05a3('0xf')]=function(_0x421f03,_0x28e9f6){return{'actionid':_0x421f03['uniqueid'],'action':'originate','channel':_0x421f03[_0x05a3('0x10')],'Exten':_0x05a3('0x11'),'Context':'from-sip','Priority':'1','callerid':util[_0x05a3('0x12')]('\x22%s\x22\x20<%s>',_0x421f03['headerinfo']?_0x421f03[_0x05a3('0x9')]:'',_0x421f03[_0x05a3('0x13')]),'variable':_0x28e9f6,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x421f03[_0x05a3('0x14')]};}; \ No newline at end of file +var _0xbb67=['message','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','util','lodash','moment','../../../../config/logger','fax'];(function(_0x5babd5,_0x5b0051){var _0x51cb0b=function(_0x9f26ba){while(--_0x9f26ba){_0x5babd5['push'](_0x5babd5['shift']());}};_0x51cb0b(++_0x5b0051);}(_0xbb67,0x8b));var _0x7bb6=function(_0x122aa6,_0x2feef8){_0x122aa6=_0x122aa6-0x0;var _0x4ab107=_0xbb67[_0x122aa6];return _0x4ab107;};'use strict';var util=require(_0x7bb6('0x0'));var _=require(_0x7bb6('0x1'));var moment=require(_0x7bb6('0x2'));var logger=require(_0x7bb6('0x3'))(_0x7bb6('0x4'));exports[_0x7bb6('0x5')]=function(_0x2daf16){return{'message':_0x2daf16};};exports['logger']=function(_0x5777bb,_0xaafcfb){logger['info'](_0x5777bb,util[_0x7bb6('0x6')](_0xaafcfb,{'showHidden':![],'depth':null}));};exports[_0x7bb6('0x7')]=function(_0x55b4f6,_0x5780e2){var _0xc2211c={'XMF-ECM':_0x5780e2[_0x7bb6('0x8')],'XMF-HEADERINFO':_0x5780e2[_0x7bb6('0x9')],'XMF-MINRATE':_0x5780e2[_0x7bb6('0xa')],'XMF-MAXRATE':_0x5780e2[_0x7bb6('0xb')],'XMF-MODEM':util[_0x7bb6('0xc')](_0x7bb6('0xd'),_0x5780e2[_0x7bb6('0xe')]),'XMF-GATEWAY':_0x5780e2[_0x7bb6('0xf')],'XMF-FAXDETECT':_0x5780e2[_0x7bb6('0x10')],'XMF-T38TIMEOUT':_0x5780e2[_0x7bb6('0x11')],'XMF-LOCALSTATIONID':_0x5780e2[_0x7bb6('0x12')],'XMF-PATH':_0x55b4f6[_0x7bb6('0x13')]};return _0xc2211c;};exports[_0x7bb6('0x14')]=function(_0x475c36,_0x11958f){return{'actionid':_0x475c36[_0x7bb6('0x15')],'action':'originate','channel':_0x475c36[_0x7bb6('0x16')],'Exten':_0x7bb6('0x17'),'Context':'from-sip','Priority':'1','callerid':util[_0x7bb6('0xc')]('\x22%s\x22\x20<%s>',_0x475c36[_0x7bb6('0x9')]?_0x475c36['headerinfo']:'',_0x475c36['localstationid']),'variable':_0x11958f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x475c36['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3c062ff..a2081c4 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 _0x8b91=['initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','catch','log','listen','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','resolve','then','getAgents','initAgents','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts'];(function(_0x5654bc,_0x17d482){var _0x45d8a7=function(_0x430360){while(--_0x430360){_0x5654bc['push'](_0x5654bc['shift']());}};_0x45d8a7(++_0x17d482);}(_0x8b91,0x91));var _0x18b9=function(_0x80d1cd,_0x4b77eb){_0x80d1cd=_0x80d1cd-0x0;var _0x55fde6=_0x8b91[_0x80d1cd];return _0x55fde6;};'use strict';var BPromise=require('bluebird');var util=require(_0x18b9('0x0'));var moment=require(_0x18b9('0x1'));var server=require('./server');var Realtime=require(_0x18b9('0x2'));var Report=require(_0x18b9('0x3'));var Acw=require(_0x18b9('0x4'));var Trigger=require(_0x18b9('0x5'));var Dialer=require(_0x18b9('0x6'));var Preview=require(_0x18b9('0x7'));var Fax=require(_0x18b9('0x8'));var user=require(_0x18b9('0x9'));var voiceQueue=require(_0x18b9('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x18b9('0xb'));var trigger=require(_0x18b9('0xc'));var template=require(_0x18b9('0xd'));var cmHopperHistory=require(_0x18b9('0xe'));var campaign=require(_0x18b9('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x18b9('0x10'));var zendesk=require(_0x18b9('0x11'));var salesforce=require(_0x18b9('0x12'));var sugarcrm=require(_0x18b9('0x13'));var freshdesk=require(_0x18b9('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x18b9('0x15'));var freshsales=require(_0x18b9('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x18b9('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x18b9('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x18b9('0x19')]()[_0x18b9('0x1a')](user[_0x18b9('0x1b')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x1c')]())[_0x18b9('0x1a')](user['getTelephones']())[_0x18b9('0x1a')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x18b9('0x1a')](realtime[_0x18b9('0x1d')]())['then'](voiceQueue[_0x18b9('0x1e')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x1f')]())[_0x18b9('0x1a')](trigger[_0x18b9('0x20')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x21')]())['then'](template[_0x18b9('0x22')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x23')]())[_0x18b9('0x1a')](zendesk[_0x18b9('0x24')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x25')]())[_0x18b9('0x1a')](salesforce[_0x18b9('0x26')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x27')]())[_0x18b9('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x18b9('0x1a')](realtime[_0x18b9('0x28')]())[_0x18b9('0x1a')](freshdesk[_0x18b9('0x29')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x2a')]())[_0x18b9('0x1a')](desk[_0x18b9('0x2b')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x2c')]())[_0x18b9('0x1a')](zoho['getZohoAccounts']())[_0x18b9('0x1a')](realtime[_0x18b9('0x2d')]())[_0x18b9('0x1a')](vtiger[_0x18b9('0x2e')]())[_0x18b9('0x1a')](realtime['initVtigerAccounts']())[_0x18b9('0x1a')](freshsales[_0x18b9('0x2f')]())['then'](realtime[_0x18b9('0x30')]())[_0x18b9('0x1a')](servicenow['getServicenowAccounts']())[_0x18b9('0x1a')](realtime[_0x18b9('0x31')]())[_0x18b9('0x1a')](dynamics365['getDynamics365Accounts']())[_0x18b9('0x1a')](realtime[_0x18b9('0x32')]())[_0x18b9('0x1a')](campaign[_0x18b9('0x33')]())['then'](realtime[_0x18b9('0x34')]())['then'](voiceExtension[_0x18b9('0x35')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x36')]())[_0x18b9('0x1a')](faxAccount[_0x18b9('0x37')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x38')]())[_0x18b9('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0x18b9('0x19')]()[_0x18b9('0x1a')](voiceQueueReport[_0x18b9('0x39')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x3a')]())['then'](cmHopperHistory[_0x18b9('0x3b')]())[_0x18b9('0x1a')](realtime[_0x18b9('0x3c')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x18b9('0x1a')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x18b9('0x3d')]())[_0x18b9('0x1a')](realtime['initVoiceCallReports']())[_0x18b9('0x1a')](function(_0x1b1eb8){})[_0x18b9('0x3e')](function(_0x408581){console[_0x18b9('0x3f')](_0x408581);});}function main(){return server[_0x18b9('0x40')](realtime,preview,fax)[_0x18b9('0x1a')](function(_0x45d14){return initRealtime();})[_0x18b9('0x1a')](function(){return initParams();})[_0x18b9('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x18b9('0x3e')](function(_0x3f0da1){console['log'](_0x3f0da1);});}main(); \ No newline at end of file +var _0xf840=['./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','listen','sync','log','bluebird','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce'];(function(_0x150ee3,_0x2354d6){var _0x485085=function(_0x38963d){while(--_0x38963d){_0x150ee3['push'](_0x150ee3['shift']());}};_0x485085(++_0x2354d6);}(_0xf840,0x1bb));var _0x0f84=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xf840[_0x2a6809];return _0x11c371;};'use strict';var BPromise=require(_0x0f84('0x0'));var util=require('util');var moment=require(_0x0f84('0x1'));var server=require(_0x0f84('0x2'));var Realtime=require(_0x0f84('0x3'));var Report=require(_0x0f84('0x4'));var Acw=require('./acw');var Trigger=require(_0x0f84('0x5'));var Dialer=require(_0x0f84('0x6'));var Preview=require(_0x0f84('0x7'));var Fax=require(_0x0f84('0x8'));var user=require(_0x0f84('0x9'));var voiceQueue=require(_0x0f84('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0f84('0xb'));var trunk=require(_0x0f84('0xc'));var trigger=require(_0x0f84('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x0f84('0xe'));var campaign=require(_0x0f84('0xf'));var voiceExtension=require(_0x0f84('0x10'));var faxAccount=require(_0x0f84('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x0f84('0x12'));var sugarcrm=require(_0x0f84('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x0f84('0x14'));var zoho=require(_0x0f84('0x15'));var vtiger=require(_0x0f84('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0f84('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x0f84('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0f84('0x19')](_0x0f84('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0f84('0x1a')]()[_0x0f84('0x1b')](user[_0x0f84('0x1c')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x1d')]())[_0x0f84('0x1b')](user[_0x0f84('0x1e')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x1f')]())[_0x0f84('0x1b')](trunk[_0x0f84('0x20')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x21')]())[_0x0f84('0x1b')](voiceQueue['getVoiceQueues']())['then'](realtime['initVoiceQueues']())['then'](trigger[_0x0f84('0x22')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x23')]())[_0x0f84('0x1b')](template[_0x0f84('0x24')]())[_0x0f84('0x1b')](realtime['initTemplates']())[_0x0f84('0x1b')](zendesk['getZendeskAccounts']())[_0x0f84('0x1b')](realtime[_0x0f84('0x25')]())[_0x0f84('0x1b')](salesforce[_0x0f84('0x26')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x27')]())['then'](sugarcrm[_0x0f84('0x28')]())['then'](realtime['initSugarcrmAccounts']())[_0x0f84('0x1b')](freshdesk[_0x0f84('0x29')]())['then'](realtime[_0x0f84('0x2a')]())[_0x0f84('0x1b')](desk[_0x0f84('0x2b')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x2c')]())[_0x0f84('0x1b')](zoho[_0x0f84('0x2d')]())[_0x0f84('0x1b')](realtime['initZohoAccounts']())[_0x0f84('0x1b')](vtiger['getVtigerAccounts']())[_0x0f84('0x1b')](realtime[_0x0f84('0x2e')]())[_0x0f84('0x1b')](freshsales[_0x0f84('0x2f')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x30')]())[_0x0f84('0x1b')](servicenow[_0x0f84('0x31')]())['then'](realtime['initServicenowAccounts']())[_0x0f84('0x1b')](dynamics365[_0x0f84('0x32')]())['then'](realtime[_0x0f84('0x33')]())[_0x0f84('0x1b')](campaign['getCampaigns']())[_0x0f84('0x1b')](realtime['initCampaigns']())[_0x0f84('0x1b')](voiceExtension[_0x0f84('0x34')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x35')]())[_0x0f84('0x1b')](faxAccount[_0x0f84('0x36')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x37')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x0f84('0x1a')]()['then'](voiceQueueReport[_0x0f84('0x38')]())['then'](realtime[_0x0f84('0x39')]())[_0x0f84('0x1b')](cmHopperHistory[_0x0f84('0x3a')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x3b')]())[_0x0f84('0x1b')](cmHopperHistory['getCampaignHopperHistory']())[_0x0f84('0x1b')](realtime[_0x0f84('0x3c')]())['then'](voiceCallReport[_0x0f84('0x3d')]())[_0x0f84('0x1b')](realtime[_0x0f84('0x3e')]())['then'](function(_0x3d7f50){})['catch'](function(_0x183c4e){console['log'](_0x183c4e);});}function main(){return server[_0x0f84('0x3f')](realtime,preview,fax)[_0x0f84('0x1b')](function(_0x1d5d26){return initRealtime();})[_0x0f84('0x1b')](function(){return initParams();})[_0x0f84('0x1b')](function(){report[_0x0f84('0x40')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1f77ca){console[_0x0f84('0x41')](_0x1f77ca);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 88aa31a..acf9d5d 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x337d97,_0x19c381){var _0x53aa89=function(_0x1ee5eb){while(--_0x1ee5eb){_0x337d97['push'](_0x337d97['shift']());}};_0x53aa89(++_0x19c381);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x95b616,_0x296372){var _0x596532=function(_0x384b06){while(--_0x384b06){_0x95b616['push'](_0x95b616['shift']());}};_0x596532(++_0x296372);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 771c5a3..95e2289 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 _0xadd4=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x1163c2,_0x4bc391){var _0xa7ef4c=function(_0xdc4768){while(--_0xdc4768){_0x1163c2['push'](_0x1163c2['shift']());}};_0xa7ef4c(++_0x4bc391);}(_0xadd4,0x197));var _0x4add=function(_0x1cee4e,_0x2c30bb){_0x1cee4e=_0x1cee4e-0x0;var _0x22fdda=_0xadd4[_0x1cee4e];return _0x22fdda;};'use strict';function Campaign(_0x247524){this['id']=_0x247524['id']||0x0;this[_0x4add('0x0')]=_0x247524[_0x4add('0x0')]||'';this[_0x4add('0x1')]=_0x247524[_0x4add('0x1')]||'campaign';this[_0x4add('0x2')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x4add('0x3')]=0x0;this['message']='';this[_0x4add('0x4')]=!![];this[_0x4add('0x5')]=_0x247524[_0x4add('0x5')];this[_0x4add('0x6')]=_0x247524[_0x4add('0x6')];this[_0x4add('0x7')]=_0x247524['dialTimezone']||null;this[_0x4add('0x8')]=_0x247524['dialGlobalInterval']?_0x247524[_0x4add('0x8')]:null;this[_0x4add('0x9')]=_0x247524['dialOriginateCallerIdName'];this[_0x4add('0xa')]=_0x247524[_0x4add('0xa')];this[_0x4add('0xb')]=_0x247524[_0x4add('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x247524[_0x4add('0xc')];this['dialCongestionRetryFrequency']=_0x247524[_0x4add('0xd')];this[_0x4add('0xe')]=_0x247524[_0x4add('0xe')];this['dialBusyRetryFrequency']=_0x247524[_0x4add('0xf')];this[_0x4add('0x10')]=_0x247524[_0x4add('0x10')];this['dialNoAnswerRetryFrequency']=_0x247524[_0x4add('0x11')];this[_0x4add('0x12')]=_0x247524[_0x4add('0x12')];this[_0x4add('0x13')]=_0x247524[_0x4add('0x13')]||0x3;this[_0x4add('0x14')]=_0x247524[_0x4add('0x14')]||0x96;this[_0x4add('0x15')]=_0x247524[_0x4add('0x15')]||0x3;this[_0x4add('0x16')]=_0x247524[_0x4add('0x16')]||0x96;this[_0x4add('0x17')]=_0x247524[_0x4add('0x17')]||0x3;this[_0x4add('0x18')]=_0x247524[_0x4add('0x18')]||0x96;this[_0x4add('0x19')]=_0x247524[_0x4add('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x247524[_0x4add('0x1a')]||0x96;this[_0x4add('0x1b')]=_0x247524[_0x4add('0x1b')]||0x3;this[_0x4add('0x1c')]=_0x247524[_0x4add('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x247524['dialOrderByScheduledAt']||'DESC';this[_0x4add('0x1d')]=_0x247524[_0x4add('0x1d')]||undefined;this[_0x4add('0x1e')]=_0x247524[_0x4add('0x1e')]||undefined;this[_0x4add('0x1f')]=_0x247524[_0x4add('0x1f')]||undefined;this[_0x4add('0x20')]=_0x247524[_0x4add('0x20')]?_0x247524[_0x4add('0x20')]:undefined;this[_0x4add('0x21')]=_0x247524[_0x4add('0x21')]?_0x247524[_0x4add('0x21')]:undefined;this['Interval']=_0x247524[_0x4add('0x22')]?_0x247524[_0x4add('0x22')]:undefined;this[_0x4add('0x23')]=_0x247524[_0x4add('0x23')]?_0x247524[_0x4add('0x23')]:undefined;this[_0x4add('0x24')]=_0x247524[_0x4add('0x23')]?_0x247524['SquareProject'][_0x4add('0x0')]:undefined;this[_0x4add('0x25')]=_0x247524[_0x4add('0x25')]||![];this['dialAMDInitialSilence']=_0x247524[_0x4add('0x26')];this[_0x4add('0x27')]=_0x247524[_0x4add('0x27')];this['dialAMDAfterGreetingSilence']=_0x247524['dialAMDAfterGreetingSilence'];this[_0x4add('0x28')]=_0x247524['dialAMDTotalAnalysisTime'];this[_0x4add('0x29')]=_0x247524[_0x4add('0x29')];this[_0x4add('0x2a')]=_0x247524[_0x4add('0x2a')];this[_0x4add('0x2b')]=_0x247524[_0x4add('0x2b')];this['dialAMDSilenceThreshold']=_0x247524[_0x4add('0x2c')];this[_0x4add('0x2d')]=_0x247524[_0x4add('0x2d')];}module[_0x4add('0x2e')]=Campaign; \ No newline at end of file +var _0xb48b=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb48b,0xe4));var _0xbb48=function(_0x56ef51,_0x381d1e){_0x56ef51=_0x56ef51-0x0;var _0x46f6d8=_0xb48b[_0x56ef51];return _0x46f6d8;};'use strict';function Campaign(_0x43addd){this['id']=_0x43addd['id']||0x0;this[_0xbb48('0x0')]=_0x43addd['name']||'';this[_0xbb48('0x1')]=_0x43addd['type']||'campaign';this[_0xbb48('0x2')]=0x0;this['temp']=0x0;this[_0xbb48('0x3')]=0x0;this[_0xbb48('0x4')]=0x0;this[_0xbb48('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0xbb48('0x6')]=_0x43addd[_0xbb48('0x6')];this[_0xbb48('0x7')]=_0x43addd[_0xbb48('0x7')];this[_0xbb48('0x8')]=_0x43addd[_0xbb48('0x8')]||null;this[_0xbb48('0x9')]=_0x43addd['dialGlobalInterval']?_0x43addd[_0xbb48('0x9')]:null;this[_0xbb48('0xa')]=_0x43addd[_0xbb48('0xa')];this[_0xbb48('0xb')]=_0x43addd[_0xbb48('0xb')];this['dialOriginateTimeout']=_0x43addd[_0xbb48('0xc')]||0x1e;this[_0xbb48('0xd')]=_0x43addd[_0xbb48('0xd')];this['dialCongestionRetryFrequency']=_0x43addd[_0xbb48('0xe')];this[_0xbb48('0xf')]=_0x43addd[_0xbb48('0xf')];this['dialBusyRetryFrequency']=_0x43addd[_0xbb48('0x10')];this['dialNoAnswerMaxRetry']=_0x43addd[_0xbb48('0x11')];this[_0xbb48('0x12')]=_0x43addd[_0xbb48('0x12')];this['dialGlobalMaxRetry']=_0x43addd['dialGlobalMaxRetry'];this[_0xbb48('0x13')]=_0x43addd['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x43addd[_0xbb48('0x14')]||0x96;this[_0xbb48('0x15')]=_0x43addd['dialDropMaxRetry']||0x3;this[_0xbb48('0x16')]=_0x43addd[_0xbb48('0x16')]||0x96;this[_0xbb48('0x17')]=_0x43addd[_0xbb48('0x17')]||0x3;this[_0xbb48('0x18')]=_0x43addd[_0xbb48('0x18')]||0x96;this['dialMachineMaxRetry']=_0x43addd[_0xbb48('0x19')]||0x3;this[_0xbb48('0x1a')]=_0x43addd[_0xbb48('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x43addd['dialAgentRejectMaxRetry']||0x3;this[_0xbb48('0x1b')]=_0x43addd[_0xbb48('0x1b')]||0x96;this[_0xbb48('0x1c')]=_0x43addd[_0xbb48('0x1c')]||_0xbb48('0x1d');this[_0xbb48('0x1e')]=_0x43addd[_0xbb48('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x43addd[_0xbb48('0x1f')]||undefined;this[_0xbb48('0x20')]=_0x43addd[_0xbb48('0x20')]||undefined;this[_0xbb48('0x21')]=_0x43addd['TrunkBackup']?_0x43addd[_0xbb48('0x21')]:undefined;this[_0xbb48('0x22')]=_0x43addd[_0xbb48('0x22')]?_0x43addd[_0xbb48('0x22')]:undefined;this[_0xbb48('0x23')]=_0x43addd[_0xbb48('0x23')]?_0x43addd[_0xbb48('0x23')]:undefined;this[_0xbb48('0x24')]=_0x43addd[_0xbb48('0x24')]?_0x43addd['SquareProject']:undefined;this[_0xbb48('0x25')]=_0x43addd[_0xbb48('0x24')]?_0x43addd[_0xbb48('0x24')][_0xbb48('0x0')]:undefined;this[_0xbb48('0x26')]=_0x43addd[_0xbb48('0x26')]||![];this['dialAMDInitialSilence']=_0x43addd[_0xbb48('0x27')];this['dialAMDGreeting']=_0x43addd[_0xbb48('0x28')];this[_0xbb48('0x29')]=_0x43addd[_0xbb48('0x29')];this[_0xbb48('0x2a')]=_0x43addd[_0xbb48('0x2a')];this[_0xbb48('0x2b')]=_0x43addd[_0xbb48('0x2b')];this[_0xbb48('0x2c')]=_0x43addd['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x43addd['dialAMDMaximumNumberOfWords'];this[_0xbb48('0x2d')]=_0x43addd['dialAMDSilenceThreshold'];this[_0xbb48('0x2e')]=_0x43addd[_0xbb48('0x2e')];}module[_0xbb48('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 4730e16..caf6a25 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 _0x3c85=['destinationchannel','calleridnum','connectedlinename','accountcode','context','linkedid','exten','answered','lastapplication','billableseconds','holdtime','monitor','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel'];(function(_0x1fc6f7,_0x34e9d7){var _0x50ab6b=function(_0x17328a){while(--_0x17328a){_0x1fc6f7['push'](_0x1fc6f7['shift']());}};_0x50ab6b(++_0x34e9d7);}(_0x3c85,0x1a0));var _0x53c8=function(_0x31a1a4,_0x3651c9){_0x31a1a4=_0x31a1a4-0x0;var _0x465549=_0x3c85[_0x31a1a4];return _0x465549;};'use strict';function Channel(){this[_0x53c8('0x0')]=null;this[_0x53c8('0x1')]='';this[_0x53c8('0x2')]='';this[_0x53c8('0x3')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x53c8('0x4')]=undefined;this[_0x53c8('0x5')]=0x0;this[_0x53c8('0x6')]='';this['uniqueid']=0x0;this[_0x53c8('0x7')]=0x0;this[_0x53c8('0x8')]=0x0;this[_0x53c8('0x9')]=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this['abandoned']=![];this[_0x53c8('0xa')]='';this['lastdata']='';this['duration']=0x0;this[_0x53c8('0xb')]=0x0;this[_0x53c8('0xc')]=0x0;this['type']=null;this['tag']=null;this['disposition']=null;this[_0x53c8('0xd')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x53c8('0xe')]=[];this[_0x53c8('0xf')]=undefined;this[_0x53c8('0x10')]=undefined;this[_0x53c8('0x11')]=undefined;this[_0x53c8('0x12')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xef4d=['calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','channel','destinationchannel'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xef4d,0x165));var _0xdef4=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xef4d[_0xc4001c];return _0x49f7bc;};'use strict';function Channel(){this[_0xdef4('0x0')]=null;this[_0xdef4('0x1')]='';this[_0xdef4('0x2')]='';this[_0xdef4('0x3')]=0x0;this[_0xdef4('0x4')]='';this[_0xdef4('0x5')]=undefined;this[_0xdef4('0x6')]=undefined;this[_0xdef4('0x7')]=0x0;this[_0xdef4('0x8')]='';this[_0xdef4('0x9')]=0x0;this[_0xdef4('0xa')]=0x0;this[_0xdef4('0xb')]=0x0;this[_0xdef4('0xc')]=![];this['answertime']=null;this[_0xdef4('0xd')]=null;this[_0xdef4('0xe')]=![];this[_0xdef4('0xf')]=![];this[_0xdef4('0x10')]='';this[_0xdef4('0x11')]='';this[_0xdef4('0x12')]=0x0;this[_0xdef4('0x13')]=0x0;this[_0xdef4('0x14')]=0x0;this[_0xdef4('0x15')]=null;this['tag']=null;this[_0xdef4('0x16')]=null;this[_0xdef4('0x17')]=![];this[_0xdef4('0x18')]=null;this[_0xdef4('0x19')]=null;this[_0xdef4('0x1a')]=[];this[_0xdef4('0x1b')]=undefined;this[_0xdef4('0x1c')]=undefined;this['transferType']=undefined;this[_0xdef4('0x1d')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 536d5bd..d86fd1a 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 _0x2230=['serverUrl','Configurations','name','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x2230,0x1a6));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x2c6e79){this['id']=_0x2c6e79['id']||0x0;this[_0x0223('0x0')]=_0x2c6e79[_0x0223('0x0')]||'';this['username']=_0x2c6e79['username']||'';this['remoteUri']=_0x2c6e79['remoteUri']||'';this['authType']=_0x2c6e79[_0x0223('0x1')]||'';this[_0x0223('0x2')]=_0x2c6e79['password']||'';this[_0x0223('0x3')]=_0x2c6e79['consumerKey']||'';this['consumerSecret']=_0x2c6e79[_0x0223('0x4')]||'';this[_0x0223('0x5')]=_0x2c6e79[_0x0223('0x5')]||'';this[_0x0223('0x6')]=_0x2c6e79[_0x0223('0x6')]||'';this[_0x0223('0x7')]=_0x2c6e79[_0x0223('0x7')]||'';this[_0x0223('0x8')]=_0x2c6e79[_0x0223('0x8')]||'';this[_0x0223('0x9')]=_0x2c6e79[_0x0223('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x3844=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x282db3,_0x321df1){var _0x5cdad5=function(_0x5b6644){while(--_0x5b6644){_0x282db3['push'](_0x282db3['shift']());}};_0x5cdad5(++_0x321df1);}(_0x3844,0x11b));var _0x4384=function(_0x11eb9d,_0x3622c1){_0x11eb9d=_0x11eb9d-0x0;var _0x31eed6=_0x3844[_0x11eb9d];return _0x31eed6;};'use strict';function DeskAccount(_0x23b794){this['id']=_0x23b794['id']||0x0;this[_0x4384('0x0')]=_0x23b794[_0x4384('0x0')]||'';this[_0x4384('0x1')]=_0x23b794[_0x4384('0x1')]||'';this[_0x4384('0x2')]=_0x23b794[_0x4384('0x2')]||'';this[_0x4384('0x3')]=_0x23b794[_0x4384('0x3')]||'';this[_0x4384('0x4')]=_0x23b794[_0x4384('0x4')]||'';this[_0x4384('0x5')]=_0x23b794['consumerKey']||'';this[_0x4384('0x6')]=_0x23b794['consumerSecret']||'';this['token']=_0x23b794[_0x4384('0x7')]||'';this[_0x4384('0x8')]=_0x23b794[_0x4384('0x8')]||'';this['type']=_0x23b794[_0x4384('0x9')]||'';this[_0x4384('0xa')]=_0x23b794[_0x4384('0xa')]||'';this[_0x4384('0xb')]=_0x23b794[_0x4384('0xb')]||{};}module[_0x4384('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 74cf01e..cb19c48 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 _0x13f6=['clientId','clientSecret','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x4f0ee9,_0xd23ea1){var _0x478042=function(_0x24d35b){while(--_0x24d35b){_0x4f0ee9['push'](_0x4f0ee9['shift']());}};_0x478042(++_0xd23ea1);}(_0x13f6,0x124));var _0x613f=function(_0x30cea2,_0xd9a4a9){_0x30cea2=_0x30cea2-0x0;var _0x299227=_0x13f6[_0x30cea2];return _0x299227;};'use strict';function Dynamics365Account(_0xf31e04){this['id']=_0xf31e04['id']||0x0;this[_0x613f('0x0')]=_0xf31e04['name']||'';this['username']=_0xf31e04[_0x613f('0x1')]||'';this[_0x613f('0x2')]=_0xf31e04[_0x613f('0x2')]||'';this['remoteUri']=_0xf31e04[_0x613f('0x3')]||'';this[_0x613f('0x4')]=_0xf31e04[_0x613f('0x4')]||'';this['clientId']=_0xf31e04[_0x613f('0x5')]||'';this[_0x613f('0x6')]=_0xf31e04['clientSecret']||{};this['serverUrl']=_0xf31e04['serverUrl']||'';this['Configurations']=_0xf31e04[_0x613f('0x7')]||{};}module[_0x613f('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xa571=['Configurations','exports','name','username','password','tenantId','clientId','clientSecret','serverUrl'];(function(_0x3dc135,_0x546abc){var _0x517300=function(_0x12dbe7){while(--_0x12dbe7){_0x3dc135['push'](_0x3dc135['shift']());}};_0x517300(++_0x546abc);}(_0xa571,0x107));var _0x1a57=function(_0x51a783,_0x1a4250){_0x51a783=_0x51a783-0x0;var _0x16606d=_0xa571[_0x51a783];return _0x16606d;};'use strict';function Dynamics365Account(_0x2046d8){this['id']=_0x2046d8['id']||0x0;this[_0x1a57('0x0')]=_0x2046d8[_0x1a57('0x0')]||'';this[_0x1a57('0x1')]=_0x2046d8['username']||'';this[_0x1a57('0x2')]=_0x2046d8[_0x1a57('0x2')]||'';this['remoteUri']=_0x2046d8['remoteUri']||'';this[_0x1a57('0x3')]=_0x2046d8['tenantId']||'';this[_0x1a57('0x4')]=_0x2046d8[_0x1a57('0x4')]||'';this[_0x1a57('0x5')]=_0x2046d8[_0x1a57('0x5')]||{};this[_0x1a57('0x6')]=_0x2046d8[_0x1a57('0x6')]||'';this['Configurations']=_0x2046d8[_0x1a57('0x7')]||{};}module[_0x1a57('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 2f9b41b..531272c 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 _0x2fc4=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0x4ad893,_0x53fcd9){var _0x5d9831=function(_0x41b070){while(--_0x41b070){_0x4ad893['push'](_0x4ad893['shift']());}};_0x5d9831(++_0x53fcd9);}(_0x2fc4,0x153));var _0x42fc=function(_0x2a0f3f,_0x4dce14){_0x2a0f3f=_0x2a0f3f-0x0;var _0x43daa7=_0x2fc4[_0x2a0f3f];return _0x43daa7;};'use strict';function FaxAccount(_0x4c6e8f){this['id']=_0x4c6e8f['id']||0x0;this[_0x42fc('0x0')]=_0x4c6e8f[_0x42fc('0x0')]||'';this['description']=_0x4c6e8f[_0x42fc('0x1')];this[_0x42fc('0x2')]=_0x4c6e8f['ecm'];this['headerinfo']=_0x4c6e8f[_0x42fc('0x3')];this[_0x42fc('0x4')]=_0x4c6e8f[_0x42fc('0x4')];this[_0x42fc('0x5')]=_0x4c6e8f[_0x42fc('0x5')]||0x960;this[_0x42fc('0x6')]=_0x4c6e8f['maxrate']||0x3840;this['modem']=_0x4c6e8f[_0x42fc('0x7')]||_0x42fc('0x8');this[_0x42fc('0x9')]=_0x4c6e8f[_0x42fc('0x9')]||'no';this[_0x42fc('0xa')]=_0x4c6e8f[_0x42fc('0xa')]||'no';this[_0x42fc('0xb')]=_0x4c6e8f[_0x42fc('0xb')]||0x1388;this[_0x42fc('0xc')]=_0x4c6e8f[_0x42fc('0xc')]||_0x42fc('0xd');this[_0x42fc('0xe')]=_0x4c6e8f[_0x42fc('0xe')]?_0x4c6e8f[_0x42fc('0xe')]:undefined;this[_0x42fc('0xf')]=_0x4c6e8f['ListId'];this[_0x42fc('0x10')]=_0x4c6e8f['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x4141=['key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4141,0x121));var _0x1414=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4141[_0x19950b];return _0x3c6b41;};'use strict';function FaxAccount(_0x12b812){this['id']=_0x12b812['id']||0x0;this[_0x1414('0x0')]=_0x12b812[_0x1414('0x0')]||'';this[_0x1414('0x1')]=_0x12b812[_0x1414('0x1')];this[_0x1414('0x2')]=_0x12b812[_0x1414('0x2')];this[_0x1414('0x3')]=_0x12b812[_0x1414('0x3')];this[_0x1414('0x4')]=_0x12b812['localstationid'];this['minrate']=_0x12b812[_0x1414('0x5')]||0x960;this[_0x1414('0x6')]=_0x12b812[_0x1414('0x6')]||0x3840;this['modem']=_0x12b812['modem']||_0x1414('0x7');this[_0x1414('0x8')]=_0x12b812[_0x1414('0x8')]||'no';this['faxdetect']=_0x12b812[_0x1414('0x9')]||'no';this[_0x1414('0xa')]=_0x12b812[_0x1414('0xa')]||0x1388;this[_0x1414('0xb')]=_0x12b812['tech']||_0x1414('0xc');this[_0x1414('0xd')]=_0x12b812['Trunk']?_0x12b812[_0x1414('0xd')]:undefined;this[_0x1414('0xe')]=_0x12b812[_0x1414('0xe')];this[_0x1414('0xf')]=_0x12b812['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index e0c69e3..356594c 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 _0x67a7=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x423e4b,_0x1bb75b){var _0x626fd4=function(_0x1e731e){while(--_0x1e731e){_0x423e4b['push'](_0x423e4b['shift']());}};_0x626fd4(++_0x1bb75b);}(_0x67a7,0x74));var _0x767a=function(_0x2b2ee7,_0x4f8e58){_0x2b2ee7=_0x2b2ee7-0x0;var _0x20297d=_0x67a7[_0x2b2ee7];return _0x20297d;};'use strict';function FreshdeskAccount(_0xcd6ce0){this['id']=_0xcd6ce0['id']||0x0;this[_0x767a('0x0')]=_0xcd6ce0[_0x767a('0x0')]||'';this[_0x767a('0x1')]=_0xcd6ce0['username']||'';this[_0x767a('0x2')]=_0xcd6ce0[_0x767a('0x3')]||'';this['remoteUri']=_0xcd6ce0[_0x767a('0x4')]||'';this['serverUrl']=_0xcd6ce0[_0x767a('0x5')]||'';this[_0x767a('0x6')]=_0xcd6ce0[_0x767a('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x9f50=['Configurations','exports','name','username','token','remoteUri'];(function(_0x38e134,_0x48a372){var _0x19415b=function(_0x95b636){while(--_0x95b636){_0x38e134['push'](_0x38e134['shift']());}};_0x19415b(++_0x48a372);}(_0x9f50,0xb6));var _0x09f5=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x9f50[_0x5027b1];return _0x4a46cf;};'use strict';function FreshdeskAccount(_0x4e6f3b){this['id']=_0x4e6f3b['id']||0x0;this['name']=_0x4e6f3b[_0x09f5('0x0')]||'';this[_0x09f5('0x1')]=_0x4e6f3b[_0x09f5('0x1')]||'';this['apiKey']=_0x4e6f3b[_0x09f5('0x2')]||'';this[_0x09f5('0x3')]=_0x4e6f3b[_0x09f5('0x3')]||'';this['serverUrl']=_0x4e6f3b['serverUrl']||'';this[_0x09f5('0x4')]=_0x4e6f3b[_0x09f5('0x4')]||{};}module[_0x09f5('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index ae1ee18..f6eb3f1 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 _0x647c=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x231473,_0x33b93e){var _0x16d666=function(_0x35ed3a){while(--_0x35ed3a){_0x231473['push'](_0x231473['shift']());}};_0x16d666(++_0x33b93e);}(_0x647c,0x1d3));var _0xc647=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0x647c[_0xb7cb72];return _0x4b7570;};'use strict';function FreshsalesAccount(_0x473a5d){this['id']=_0x473a5d['id']||0x0;this['name']=_0x473a5d[_0xc647('0x0')]||'';this[_0xc647('0x1')]=_0x473a5d['username']||'';this[_0xc647('0x2')]=_0x473a5d[_0xc647('0x3')]||'';this[_0xc647('0x4')]=_0x473a5d[_0xc647('0x4')]||'';this[_0xc647('0x5')]=_0x473a5d['serverUrl']||'';this[_0xc647('0x6')]=_0x473a5d[_0xc647('0x6')]||{};}module[_0xc647('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xe260=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x32e779,_0x1c2596){var _0x47d7b3=function(_0x37c2d8){while(--_0x37c2d8){_0x32e779['push'](_0x32e779['shift']());}};_0x47d7b3(++_0x1c2596);}(_0xe260,0x94));var _0x0e26=function(_0x16f261,_0x5d1206){_0x16f261=_0x16f261-0x0;var _0x346d72=_0xe260[_0x16f261];return _0x346d72;};'use strict';function FreshsalesAccount(_0x544271){this['id']=_0x544271['id']||0x0;this['name']=_0x544271[_0x0e26('0x0')]||'';this[_0x0e26('0x1')]=_0x544271[_0x0e26('0x1')]||'';this[_0x0e26('0x2')]=_0x544271[_0x0e26('0x3')]||'';this[_0x0e26('0x4')]=_0x544271[_0x0e26('0x4')]||'';this[_0x0e26('0x5')]=_0x544271[_0x0e26('0x5')]||'';this[_0x0e26('0x6')]=_0x544271['Configurations']||{};}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 8ee0609..354cac6 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 _0x34cf=['exten','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','channel','connectedlinename','accountcode'];(function(_0x20da84,_0x58d7bc){var _0x5b8c10=function(_0x45839f){while(--_0x45839f){_0x20da84['push'](_0x20da84['shift']());}};_0x5b8c10(++_0x58d7bc);}(_0x34cf,0xd9));var _0xf34c=function(_0x57a956,_0x4420a3){_0x57a956=_0x57a956-0x0;var _0x4cc17b=_0x34cf[_0x57a956];return _0x4cc17b;};'use strict';function QueueReport(){this['type']=_0xf34c('0x0');this[_0xf34c('0x1')]='';this[_0xf34c('0x2')]='';this[_0xf34c('0x3')]='';this[_0xf34c('0x4')]='';this[_0xf34c('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xf34c('0x6')]=0x1;this[_0xf34c('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xf34c('0x8')]=null;this[_0xf34c('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xf34c('0xa')]=null;this['originalposition']=0x1;this[_0xf34c('0xb')]='';this['connectedlinenum']='';this[_0xf34c('0xc')]='';this[_0xf34c('0xd')]='';this['context']='';this[_0xf34c('0xe')]='';this[_0xf34c('0xf')]='';this[_0xf34c('0x10')]=0x0;this[_0xf34c('0x11')]=![];this[_0xf34c('0x12')]='';this[_0xf34c('0x13')]=0x0;this['variables']={};}module[_0xf34c('0x14')]=QueueReport; \ No newline at end of file +var _0x1c81=['connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel'];(function(_0x148ec5,_0x4a7ca2){var _0x223a9=function(_0x28419d){while(--_0x28419d){_0x148ec5['push'](_0x148ec5['shift']());}};_0x223a9(++_0x4a7ca2);}(_0x1c81,0x171));var _0x11c8=function(_0x3cc594,_0x2580f2){_0x3cc594=_0x3cc594-0x0;var _0xd86aa5=_0x1c81[_0x3cc594];return _0xd86aa5;};'use strict';function QueueReport(){this[_0x11c8('0x0')]='inbound';this[_0x11c8('0x1')]='';this[_0x11c8('0x2')]='';this[_0x11c8('0x3')]='';this[_0x11c8('0x4')]='';this[_0x11c8('0x5')]=null;this[_0x11c8('0x6')]=null;this[_0x11c8('0x7')]=0x1;this[_0x11c8('0x8')]=0x1;this[_0x11c8('0x9')]=![];this[_0x11c8('0xa')]=null;this[_0x11c8('0xb')]=![];this[_0x11c8('0xc')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x11c8('0xd')]=0x1;this[_0x11c8('0xe')]='';this['connectedlinenum']='';this[_0x11c8('0xf')]='';this[_0x11c8('0x10')]='';this[_0x11c8('0x11')]='';this[_0x11c8('0x12')]='';this[_0x11c8('0x13')]='';this['holdtime']=0x0;this[_0x11c8('0x14')]=![];this[_0x11c8('0x15')]='';this[_0x11c8('0x16')]=0x0;this[_0x11c8('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 e939804..05bf3ed 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 _0x7af9=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x2c0413,_0x4a0cc2){var _0x2994df=function(_0x310352){while(--_0x310352){_0x2c0413['push'](_0x2c0413['shift']());}};_0x2994df(++_0x4a0cc2);}(_0x7af9,0x7c));var _0x97af=function(_0x10157e,_0x1bc5bc){_0x10157e=_0x10157e-0x0;var _0x5364c0=_0x7af9[_0x10157e];return _0x5364c0;};'use strict';function SalesforceAccount(_0x4ca503){this['id']=_0x4ca503['id']||0x0;this[_0x97af('0x0')]=_0x4ca503[_0x97af('0x0')]||'';this[_0x97af('0x1')]=_0x4ca503['username']||'';this['remoteUri']=_0x4ca503[_0x97af('0x2')]||'';this['password']=_0x4ca503[_0x97af('0x3')]||'';this['clientId']=_0x4ca503[_0x97af('0x4')]||'';this['clientSecret']=_0x4ca503[_0x97af('0x5')]||'';this[_0x97af('0x6')]=_0x4ca503['securityToken']||'';this[_0x97af('0x7')]=_0x4ca503[_0x97af('0x7')]||_0x97af('0x8');this[_0x97af('0x9')]=_0x4ca503[_0x97af('0x9')]||'';this['Configurations']=_0x4ca503[_0x97af('0xa')]||{};}module[_0x97af('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xbded=['type','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x365652,_0x3da46d){var _0x42c5cc=function(_0x2dcfc7){while(--_0x2dcfc7){_0x365652['push'](_0x365652['shift']());}};_0x42c5cc(++_0x3da46d);}(_0xbded,0x1c5));var _0xdbde=function(_0x5db0ea,_0x3edc74){_0x5db0ea=_0x5db0ea-0x0;var _0x59c7fa=_0xbded[_0x5db0ea];return _0x59c7fa;};'use strict';function SalesforceAccount(_0x1bf21f){this['id']=_0x1bf21f['id']||0x0;this['name']=_0x1bf21f[_0xdbde('0x0')]||'';this[_0xdbde('0x1')]=_0x1bf21f[_0xdbde('0x1')]||'';this[_0xdbde('0x2')]=_0x1bf21f[_0xdbde('0x2')]||'';this[_0xdbde('0x3')]=_0x1bf21f['password']||'';this[_0xdbde('0x4')]=_0x1bf21f['clientId']||'';this[_0xdbde('0x5')]=_0x1bf21f[_0xdbde('0x5')]||'';this[_0xdbde('0x6')]=_0x1bf21f[_0xdbde('0x6')]||'';this[_0xdbde('0x7')]=_0x1bf21f['type']||'integrationTab';this[_0xdbde('0x8')]=_0x1bf21f[_0xdbde('0x8')]||'';this[_0xdbde('0x9')]=_0x1bf21f['Configurations']||{};}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 a6c1ac6..e347517 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 _0xb3d3=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x3ab29e,_0x101a52){var _0xbc6bc3=function(_0x1f124c){while(--_0x1f124c){_0x3ab29e['push'](_0x3ab29e['shift']());}};_0xbc6bc3(++_0x101a52);}(_0xb3d3,0xfe));var _0x3b3d=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0xb3d3[_0x24392f];return _0x591e33;};'use strict';function ServicenowAccount(_0x2ffc2f){this['id']=_0x2ffc2f['id']||0x0;this[_0x3b3d('0x0')]=_0x2ffc2f[_0x3b3d('0x0')]||'';this[_0x3b3d('0x1')]=_0x2ffc2f[_0x3b3d('0x1')]||'';this[_0x3b3d('0x2')]=_0x2ffc2f[_0x3b3d('0x2')]||'';this[_0x3b3d('0x3')]=_0x2ffc2f['remoteUri']||'';this[_0x3b3d('0x4')]=_0x2ffc2f[_0x3b3d('0x4')]||'';this[_0x3b3d('0x5')]=_0x2ffc2f[_0x3b3d('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x92ee=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x322d80,_0x4d124a){var _0x1f7e35=function(_0xec9841){while(--_0xec9841){_0x322d80['push'](_0x322d80['shift']());}};_0x1f7e35(++_0x4d124a);}(_0x92ee,0x1c9));var _0xe92e=function(_0x31ce94,_0x246777){_0x31ce94=_0x31ce94-0x0;var _0x16ca31=_0x92ee[_0x31ce94];return _0x16ca31;};'use strict';function ServicenowAccount(_0x14790d){this['id']=_0x14790d['id']||0x0;this[_0xe92e('0x0')]=_0x14790d['name']||'';this[_0xe92e('0x1')]=_0x14790d[_0xe92e('0x1')]||'';this[_0xe92e('0x2')]=_0x14790d[_0xe92e('0x2')]||'';this['remoteUri']=_0x14790d[_0xe92e('0x3')]||'';this[_0xe92e('0x4')]=_0x14790d[_0xe92e('0x4')]||'';this[_0xe92e('0x5')]=_0x14790d[_0xe92e('0x5')]||{};}module[_0xe92e('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 49606ad..085ecbf 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 _0x335d=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x7a4e9d,_0x4a2326){var _0x17e54c=function(_0x39c53e){while(--_0x39c53e){_0x7a4e9d['push'](_0x7a4e9d['shift']());}};_0x17e54c(++_0x4a2326);}(_0x335d,0x1e0));var _0xd335=function(_0x45505a,_0x59368a){_0x45505a=_0x45505a-0x0;var _0x36a1f6=_0x335d[_0x45505a];return _0x36a1f6;};'use strict';function SugarcrmAccount(_0x1c9acd){this['id']=_0x1c9acd['id']||0x0;this[_0xd335('0x0')]=_0x1c9acd[_0xd335('0x0')]||'';this['username']=_0x1c9acd[_0xd335('0x1')]||'';this[_0xd335('0x2')]=_0x1c9acd[_0xd335('0x2')]||'';this[_0xd335('0x3')]=_0x1c9acd[_0xd335('0x3')]||'';this[_0xd335('0x4')]=_0x1c9acd[_0xd335('0x4')]||'';this[_0xd335('0x5')]=_0x1c9acd[_0xd335('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x9f24=['serverUrl','Configurations','name','username','remoteUri'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9f24,0x13d));var _0x49f2=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x9f24[_0xf0bcac];return _0x4e4c65;};'use strict';function SugarcrmAccount(_0x4a1f2b){this['id']=_0x4a1f2b['id']||0x0;this[_0x49f2('0x0')]=_0x4a1f2b[_0x49f2('0x0')]||'';this[_0x49f2('0x1')]=_0x4a1f2b['username']||'';this['password']=_0x4a1f2b['password']||'';this[_0x49f2('0x2')]=_0x4a1f2b[_0x49f2('0x2')]||'';this[_0x49f2('0x3')]=_0x4a1f2b['serverUrl']||'';this[_0x49f2('0x4')]=_0x4a1f2b[_0x49f2('0x4')]||{};}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 6aa76d0..ee6415e 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 _0x82df=['stateTime','status','address','exports','name','accountcode','state','unknown'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0x82df,0x164));var _0xf82d=function(_0x15e983,_0x5824c8){_0x15e983=_0x15e983-0x0;var _0x3a1ec0=_0x82df[_0x15e983];return _0x3a1ec0;};'use strict';function Telephone(_0x3a9771){this['id']=_0x3a9771['id']||0x0;this[_0xf82d('0x0')]=_0x3a9771['name']||'';this['accountcode']=_0x3a9771[_0xf82d('0x1')]||'';this[_0xf82d('0x2')]=_0xf82d('0x3');this[_0xf82d('0x4')]=0x0;this[_0xf82d('0x5')]='unknown';this[_0xf82d('0x6')]='';}module[_0xf82d('0x7')]=Telephone; \ No newline at end of file +var _0xd0ae=['state','stateTime','status','unknown','address','exports','name','accountcode'];(function(_0x3d2ac2,_0x332aec){var _0x504d56=function(_0x2f9862){while(--_0x2f9862){_0x3d2ac2['push'](_0x3d2ac2['shift']());}};_0x504d56(++_0x332aec);}(_0xd0ae,0x1ae));var _0xed0a=function(_0x26f77b,_0x3e6f01){_0x26f77b=_0x26f77b-0x0;var _0x29d21e=_0xd0ae[_0x26f77b];return _0x29d21e;};'use strict';function Telephone(_0x2bf9d1){this['id']=_0x2bf9d1['id']||0x0;this[_0xed0a('0x0')]=_0x2bf9d1[_0xed0a('0x0')]||'';this[_0xed0a('0x1')]=_0x2bf9d1['accountcode']||'';this[_0xed0a('0x2')]='unknown';this[_0xed0a('0x3')]=0x0;this[_0xed0a('0x4')]=_0xed0a('0x5');this[_0xed0a('0x6')]='';}module[_0xed0a('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a48be3d..026576f 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x178268,_0x5efa89){var _0x1ca850=function(_0x99bce4){while(--_0x99bce4){_0x178268['push'](_0x178268['shift']());}};_0x1ca850(++_0x5efa89);}(_0xb10b,0x12a));var _0xbb10=function(_0x31f9c7,_0x1d5f54){_0x31f9c7=_0x31f9c7-0x0;var _0x46c5b3=_0xb10b[_0x31f9c7];return _0x46c5b3;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x5f1e4e,_0xfd9fb6){var _0x35642b=function(_0x9235b2){while(--_0x9235b2){_0x5f1e4e['push'](_0x5f1e4e['shift']());}};_0x35642b(++_0xfd9fb6);}(_0xb10b,0x12a));var _0xbb10=function(_0x54b677,_0x21ee34){_0x54b677=_0x54b677-0x0;var _0x27eb0e=_0xb10b[_0x54b677];return _0x27eb0e;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 82bd8df..9887320 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 _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x22a35d,_0x154e92){var _0x32924f=function(_0x2fa1ca){while(--_0x2fa1ca){_0x22a35d['push'](_0x22a35d['shift']());}};_0x32924f(++_0x154e92);}(_0xda2d,0x102));var _0xdda2=function(_0x36076a,_0x1a0254){_0x36076a=_0x36076a-0x0;var _0x15eb1b=_0xda2d[_0x36076a];return _0x15eb1b;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 64ea10f..10abdb4 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 _0x203e=['address','active','name','stateTime','status','registry','indexOf','host','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x2d14ca,_0xb8ceed){var _0x5eec69=function(_0x331a09){while(--_0x331a09){_0x2d14ca['push'](_0x2d14ca['shift']());}};_0x5eec69(++_0xb8ceed);}(_0x203e,0xde));var _0xe203=function(_0x44709e,_0x1a3b47){_0x44709e=_0x44709e-0x0;var _0x2f42e8=_0x203e[_0x44709e];return _0x2f42e8;};'use strict';function Trunk(_0x3a7f77){this['id']=_0x3a7f77['id']||0x0;this[_0xe203('0x0')]=_0x3a7f77[_0xe203('0x0')]||![];this[_0xe203('0x1')]=_0x3a7f77['name']||'';this['state']='unknown';this[_0xe203('0x2')]=0x0;this[_0xe203('0x3')]='unknown';this[_0xe203('0x4')]=_0x3a7f77[_0xe203('0x4')]&&_0x3a7f77[_0xe203('0x4')][_0xe203('0x5')](':')?_0x3a7f77[_0xe203('0x4')]['split'](':')[0x0]:'';this[_0xe203('0x6')]='';this['port']='';this[_0xe203('0x7')]='';this[_0xe203('0x8')]='';this[_0xe203('0x9')]='';this[_0xe203('0xa')]='unknown';this[_0xe203('0xb')]='';this[_0xe203('0xc')]='';this['defaultuser']=_0x3a7f77['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0xdc21=['active','name','state','unknown','stateTime','status','registry','indexOf','host','domainport','refresh','stateRegistry','address','defaultuser','exports'];(function(_0x3f07e1,_0x2e04c8){var _0x14c34e=function(_0x5a03eb){while(--_0x5a03eb){_0x3f07e1['push'](_0x3f07e1['shift']());}};_0x14c34e(++_0x2e04c8);}(_0xdc21,0x1ef));var _0x1dc2=function(_0x5d358a,_0x42560d){_0x5d358a=_0x5d358a-0x0;var _0x49cd00=_0xdc21[_0x5d358a];return _0x49cd00;};'use strict';function Trunk(_0xa82b0d){this['id']=_0xa82b0d['id']||0x0;this[_0x1dc2('0x0')]=_0xa82b0d['active']||![];this[_0x1dc2('0x1')]=_0xa82b0d[_0x1dc2('0x1')]||'';this[_0x1dc2('0x2')]=_0x1dc2('0x3');this[_0x1dc2('0x4')]=0x0;this[_0x1dc2('0x5')]=_0x1dc2('0x3');this[_0x1dc2('0x6')]=_0xa82b0d[_0x1dc2('0x6')]&&_0xa82b0d['registry'][_0x1dc2('0x7')](':')?_0xa82b0d[_0x1dc2('0x6')]['split'](':')[0x0]:'';this[_0x1dc2('0x8')]='';this['port']='';this['domain']='';this[_0x1dc2('0x9')]='';this[_0x1dc2('0xa')]='';this[_0x1dc2('0xb')]='unknown';this['registrationtime']='';this[_0x1dc2('0xc')]='';this[_0x1dc2('0xd')]=_0xa82b0d[_0x1dc2('0xd')]||'';}module[_0x1dc2('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 3b2ddb5..0ae49fa 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 _0x336d=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x5e9755,_0x2eee2f){var _0x496202=function(_0x5ea35a){while(--_0x5ea35a){_0x5e9755['push'](_0x5e9755['shift']());}};_0x496202(++_0x2eee2f);}(_0x336d,0x116));var _0xd336=function(_0x1548f0,_0x246f27){_0x1548f0=_0x1548f0-0x0;var _0x1eef90=_0x336d[_0x1548f0];return _0x1eef90;};'use strict';function voiceExtension(_0x2f27c6){this['id']=_0x2f27c6['id']||0x0;this[_0xd336('0x0')]=_0x2f27c6[_0xd336('0x0')]||'';this['recordingFormat']=_0x2f27c6[_0xd336('0x1')]||_0xd336('0x2');this['mandatoryDisposition']=_0x2f27c6[_0xd336('0x3')]||![];}module[_0xd336('0x4')]=voiceExtension; \ No newline at end of file +var _0x1eba=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x323419,_0x2a0d02){var _0x5c1dac=function(_0x1c5a62){while(--_0x1c5a62){_0x323419['push'](_0x323419['shift']());}};_0x5c1dac(++_0x2a0d02);}(_0x1eba,0x19c));var _0xa1eb=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x1eba[_0x602ca8];return _0x26e8ab;};'use strict';function voiceExtension(_0x4ccba5){this['id']=_0x4ccba5['id']||0x0;this[_0xa1eb('0x0')]=_0x4ccba5[_0xa1eb('0x0')]||'';this[_0xa1eb('0x1')]=_0x4ccba5[_0xa1eb('0x1')]||'none';this[_0xa1eb('0x2')]=_0x4ccba5[_0xa1eb('0x2')]||![];}module[_0xa1eb('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index c0d7a8f..dab5dce 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 _0x6ac3=['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','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','unavailable','ringing','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','temp'];(function(_0x13187a,_0x566e45){var _0x4c4c9f=function(_0x237e61){while(--_0x237e61){_0x13187a['push'](_0x13187a['shift']());}};_0x4c4c9f(++_0x566e45);}(_0x6ac3,0x14a));var _0x36ac=function(_0x2d8a6f,_0x30f0ed){_0x2d8a6f=_0x2d8a6f-0x0;var _0x2eaa62=_0x6ac3[_0x2d8a6f];return _0x2eaa62;};'use strict';var statusDesc=[_0x36ac('0x0'),_0x36ac('0x1'),'inuse',_0x36ac('0x2'),'invalid',_0x36ac('0x3'),_0x36ac('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':_0x36ac('0x5'),'wav49':'wav49','gsm':_0x36ac('0x6')};var strategy={'rrmemory':_0x36ac('0x7'),'roundrobin':_0x36ac('0x8')};function VoiceQueue(_0x2ffbe5){this['id']=_0x2ffbe5['id']||0x0;this[_0x36ac('0x9')]=_0x2ffbe5[_0x36ac('0x9')]||'';this[_0x36ac('0xa')]=_0x2ffbe5[_0x36ac('0xa')]||'';this['type']=_0x2ffbe5[_0x36ac('0xb')]||_0x36ac('0xc');this[_0x36ac('0xd')]=0x0;this[_0x36ac('0xe')]=0x0;this[_0x36ac('0xf')]=0x0;this[_0x36ac('0x10')]=0x0;this[_0x36ac('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x36ac('0x12')]=0x0;this[_0x36ac('0x13')]=0x0;this[_0x36ac('0x14')]=0x0;this[_0x36ac('0x15')]=0x0;this[_0x36ac('0x16')]=0x0;this[_0x36ac('0x17')]=_0x2ffbe5[_0x36ac('0x17')]||![];this['acwTimeout']=_0x2ffbe5[_0x36ac('0x18')]||0xa;this[_0x36ac('0x19')]=_0x2ffbe5[_0x36ac('0x19')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this['originated']=0x0;this[_0x36ac('0x1a')]=0x0;this['dialTimezone']=_0x2ffbe5[_0x36ac('0x1b')]||null;this[_0x36ac('0x1c')]=_0x2ffbe5[_0x36ac('0x1c')]?_0x2ffbe5[_0x36ac('0x1c')]:null;this['dialActive']=_0x2ffbe5[_0x36ac('0x1d')];this[_0x36ac('0x1e')]=_0x2ffbe5[_0x36ac('0x1e')]||_0x36ac('0x1f');this[_0x36ac('0x20')]=_0x2ffbe5[_0x36ac('0x20')]||0x0;this[_0x36ac('0x21')]=_0x2ffbe5[_0x36ac('0x21')]||0x0;this['dialPowerLevel']=_0x2ffbe5[_0x36ac('0x22')]||0x1;this[_0x36ac('0x23')]=_0x2ffbe5[_0x36ac('0x23')]||'dropRate';this[_0x36ac('0x24')]=_0x2ffbe5['dialPredictiveOptimizationPercentage']||0.03;this[_0x36ac('0x25')]=_0x2ffbe5[_0x36ac('0x25')]||0x258;this[_0x36ac('0x26')]=_0x2ffbe5[_0x36ac('0x26')]||_0x36ac('0x27');this[_0x36ac('0x28')]=_0x2ffbe5['dialOriginateCallerIdNumber']||_0x36ac('0x27');this[_0x36ac('0x29')]=_0x2ffbe5[_0x36ac('0x29')]||0x1e;this[_0x36ac('0x2a')]=_0x2ffbe5[_0x36ac('0x2a')]||_0x36ac('0x2b');this[_0x36ac('0x2c')]=_0x2ffbe5[_0x36ac('0x2c')]||0x3;this['dialQueueProject']=_0x2ffbe5[_0x36ac('0x2d')]||undefined;this[_0x36ac('0x2e')]=_0x2ffbe5[_0x36ac('0x2e')]||0x3;this[_0x36ac('0x2f')]=_0x2ffbe5['dialCongestionRetryFrequency']||0x96;this[_0x36ac('0x30')]=_0x2ffbe5[_0x36ac('0x30')]||0x3;this[_0x36ac('0x31')]=_0x2ffbe5['dialBusyRetryFrequency']||0x96;this[_0x36ac('0x32')]=_0x2ffbe5[_0x36ac('0x32')]||0x3;this[_0x36ac('0x33')]=_0x2ffbe5['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x2ffbe5[_0x36ac('0x34')]||0x3;this[_0x36ac('0x35')]=_0x2ffbe5[_0x36ac('0x35')]||0x96;this[_0x36ac('0x36')]=_0x2ffbe5[_0x36ac('0x36')]||0x3;this[_0x36ac('0x37')]=_0x2ffbe5['dialDropRetryFrequency']||0x96;this[_0x36ac('0x38')]=_0x2ffbe5['dialAbandonedMaxRetry']||0x3;this[_0x36ac('0x39')]=_0x2ffbe5[_0x36ac('0x39')]||0x96;this[_0x36ac('0x3a')]=_0x2ffbe5['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x2ffbe5[_0x36ac('0x3b')]||0x96;this[_0x36ac('0x3c')]=_0x2ffbe5[_0x36ac('0x3c')]||0x3;this[_0x36ac('0x3d')]=_0x2ffbe5[_0x36ac('0x3d')]||0x96;this[_0x36ac('0x3e')]=_0x2ffbe5[_0x36ac('0x3e')]||0x4;this[_0x36ac('0x3f')]=_0x2ffbe5[_0x36ac('0x3f')]?_0x2ffbe5['Trunk']:undefined;this[_0x36ac('0x40')]=_0x2ffbe5[_0x36ac('0x40')]?_0x2ffbe5[_0x36ac('0x40')]:undefined;this['dialPrefix']=_0x2ffbe5[_0x36ac('0x41')]||undefined;this[_0x36ac('0x42')]=_0x2ffbe5[_0x36ac('0x42')]?_0x2ffbe5[_0x36ac('0x42')]:undefined;this[_0x36ac('0x43')]=_0x2ffbe5[_0x36ac('0x43')]||'DESC';this[_0x36ac('0x44')]=_0x2ffbe5[_0x36ac('0x44')]||undefined;this['dialCutDigit']=_0x2ffbe5[_0x36ac('0x45')]||undefined;this[_0x36ac('0x46')]=strategy[_0x2ffbe5['strategy']]||_0x36ac('0x7');this[_0x36ac('0x47')]=!![];this[_0x36ac('0x48')]=_0x2ffbe5[_0x36ac('0x48')]||![];this[_0x36ac('0x49')]=_0x2ffbe5[_0x36ac('0x49')];this[_0x36ac('0x4a')]=_0x2ffbe5[_0x36ac('0x4a')];this[_0x36ac('0x4b')]=_0x2ffbe5[_0x36ac('0x4b')];this[_0x36ac('0x4c')]=_0x2ffbe5[_0x36ac('0x4c')];this[_0x36ac('0x4d')]=_0x2ffbe5['dialAMDMinWordLength'];this[_0x36ac('0x4e')]=_0x2ffbe5[_0x36ac('0x4e')];this[_0x36ac('0x4f')]=_0x2ffbe5[_0x36ac('0x4f')];this[_0x36ac('0x50')]=_0x2ffbe5[_0x36ac('0x50')];this[_0x36ac('0x51')]=_0x2ffbe5[_0x36ac('0x51')];this[_0x36ac('0x52')]=0x0;this['pTalking']=0x0;this[_0x36ac('0x53')]=_0x2ffbe5['timeout'];this[_0x36ac('0x54')]=0x0;this[_0x36ac('0x55')]=0x0;this[_0x36ac('0x56')]=0x0;this[_0x36ac('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x36ac('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x36ac('0x59')]=0x0;this[_0x36ac('0x5a')]=0x0;this[_0x36ac('0x5b')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x36ac('0x5c')]=undefined;this[_0x36ac('0x5d')]=undefined;this[_0x36ac('0x5e')]=undefined;this[_0x36ac('0x5f')]=1.05;this[_0x36ac('0x60')]=0x0;this[_0x36ac('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x36ac('0x62')]=0x0;this[_0x36ac('0x63')]=0x0;this[_0x36ac('0x64')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x36ac('0x65')]=0x0;this[_0x36ac('0x66')]=_0x2ffbe5[_0x36ac('0x67')]||0x14;this[_0x36ac('0x68')]=_0x2ffbe5[_0x36ac('0x67')]||0xa;this[_0x36ac('0x69')]=0x0;this[_0x36ac('0x6a')]=0x0;this[_0x36ac('0x6b')]=0x1;this[_0x36ac('0x6c')]=0x0;this[_0x36ac('0x6d')]=0x0;this[_0x36ac('0x6e')]=0x0;this[_0x36ac('0x6f')]=0x0;this[_0x36ac('0x70')]=_0x2ffbe5[_0x36ac('0x70')]||0x1e;this['dialRecallInQueue']=_0x2ffbe5['dialRecallInQueue']||![];this['dialQueueProject2']=_0x2ffbe5[_0x36ac('0x71')]||undefined;this[_0x36ac('0x72')]=_0x2ffbe5[_0x36ac('0x72')]||![];this['dialAgiAfterHangupAgent']=_0x2ffbe5[_0x36ac('0x73')]||![];this[_0x36ac('0xa')]=monitorFormat[_0x2ffbe5[_0x36ac('0xa')]]?monitorFormat[_0x2ffbe5[_0x36ac('0xa')]]:undefined;this[_0x36ac('0x74')]=_0x2ffbe5[_0x36ac('0x74')]||![];this[_0x36ac('0x75')]=_0x2ffbe5[_0x36ac('0x75')]?_0x2ffbe5['mandatoryDispositionPause']:undefined;}module[_0x36ac('0x76')]=VoiceQueue; \ No newline at end of file +var _0x1c90=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime'];(function(_0x4b7d87,_0x238711){var _0x3b9f82=function(_0x2c5173){while(--_0x2c5173){_0x4b7d87['push'](_0x4b7d87['shift']());}};_0x3b9f82(++_0x238711);}(_0x1c90,0x188));var _0x01c9=function(_0xdb33fc,_0x1744f1){_0xdb33fc=_0xdb33fc-0x0;var _0x47b1bc=_0x1c90[_0xdb33fc];return _0x47b1bc;};'use strict';var statusDesc=['unknown','not_inuse',_0x01c9('0x0'),'busy',_0x01c9('0x1'),_0x01c9('0x2'),_0x01c9('0x3'),_0x01c9('0x4'),_0x01c9('0x5')];var monitorFormat={'wav':_0x01c9('0x6'),'wav49':_0x01c9('0x7'),'gsm':_0x01c9('0x8')};var strategy={'rrmemory':_0x01c9('0x9'),'roundrobin':_0x01c9('0xa')};function VoiceQueue(_0x2acd24){this['id']=_0x2acd24['id']||0x0;this['name']=_0x2acd24[_0x01c9('0xb')]||'';this[_0x01c9('0xc')]=_0x2acd24[_0x01c9('0xc')]||'';this[_0x01c9('0xd')]=_0x2acd24[_0x01c9('0xd')]||'inbound';this[_0x01c9('0xe')]=0x0;this[_0x01c9('0xf')]=0x0;this[_0x01c9('0x10')]=0x0;this[_0x01c9('0x11')]=0x0;this[_0x01c9('0x12')]=0x0;this[_0x01c9('0x13')]=0x0;this['sumBillable']=0x0;this[_0x01c9('0x14')]=0x0;this[_0x01c9('0x15')]=0x0;this[_0x01c9('0x16')]=0x0;this['available']=0x0;this['acw']=_0x2acd24[_0x01c9('0x17')]||![];this[_0x01c9('0x18')]=_0x2acd24[_0x01c9('0x18')]||0xa;this[_0x01c9('0x19')]=_0x2acd24[_0x01c9('0x19')]||'no';this[_0x01c9('0x1a')]=!![];this[_0x01c9('0x1b')]='';this[_0x01c9('0x1c')]=0x0;this['temp']=0x0;this[_0x01c9('0x1d')]=_0x2acd24[_0x01c9('0x1d')]||null;this[_0x01c9('0x1e')]=_0x2acd24['dialGlobalInterval']?_0x2acd24[_0x01c9('0x1e')]:null;this[_0x01c9('0x1f')]=_0x2acd24['dialActive'];this[_0x01c9('0x20')]=_0x2acd24[_0x01c9('0x20')]||_0x01c9('0x21');this['dialLimitChannel']=_0x2acd24[_0x01c9('0x22')]||0x0;this[_0x01c9('0x23')]=_0x2acd24['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x2acd24['dialPowerLevel']||0x1;this[_0x01c9('0x24')]=_0x2acd24['dialPredictiveOptimization']||'dropRate';this[_0x01c9('0x25')]=_0x2acd24['dialPredictiveOptimizationPercentage']||0.03;this[_0x01c9('0x26')]=_0x2acd24[_0x01c9('0x26')]||0x258;this[_0x01c9('0x27')]=_0x2acd24[_0x01c9('0x27')]||_0x01c9('0x28');this[_0x01c9('0x29')]=_0x2acd24[_0x01c9('0x29')]||'anonymous';this[_0x01c9('0x2a')]=_0x2acd24[_0x01c9('0x2a')]||0x1e;this[_0x01c9('0x2b')]=_0x2acd24[_0x01c9('0x2b')]||_0x01c9('0x2c');this[_0x01c9('0x2d')]=_0x2acd24[_0x01c9('0x2d')]||0x3;this[_0x01c9('0x2e')]=_0x2acd24['dialQueueProject']||undefined;this[_0x01c9('0x2f')]=_0x2acd24['dialCongestionMaxRetry']||0x3;this[_0x01c9('0x30')]=_0x2acd24[_0x01c9('0x30')]||0x96;this[_0x01c9('0x31')]=_0x2acd24[_0x01c9('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x2acd24[_0x01c9('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x2acd24[_0x01c9('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2acd24[_0x01c9('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2acd24[_0x01c9('0x35')]||0x3;this[_0x01c9('0x36')]=_0x2acd24[_0x01c9('0x36')]||0x96;this[_0x01c9('0x37')]=_0x2acd24[_0x01c9('0x37')]||0x3;this[_0x01c9('0x38')]=_0x2acd24[_0x01c9('0x38')]||0x96;this[_0x01c9('0x39')]=_0x2acd24['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x2acd24['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x2acd24['dialMachineMaxRetry']||0x3;this[_0x01c9('0x3a')]=_0x2acd24['dialMachineRetryFrequency']||0x96;this[_0x01c9('0x3b')]=_0x2acd24['dialAgentRejectMaxRetry']||0x3;this[_0x01c9('0x3c')]=_0x2acd24[_0x01c9('0x3c')]||0x96;this[_0x01c9('0x3d')]=_0x2acd24['dialGlobalMaxRetry']||0x4;this[_0x01c9('0x3e')]=_0x2acd24[_0x01c9('0x3e')]?_0x2acd24[_0x01c9('0x3e')]:undefined;this[_0x01c9('0x3f')]=_0x2acd24[_0x01c9('0x3f')]?_0x2acd24[_0x01c9('0x3f')]:undefined;this[_0x01c9('0x40')]=_0x2acd24[_0x01c9('0x40')]||undefined;this['Interval']=_0x2acd24['Interval']?_0x2acd24[_0x01c9('0x41')]:undefined;this[_0x01c9('0x42')]=_0x2acd24[_0x01c9('0x42')]||_0x01c9('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x2acd24[_0x01c9('0x44')]||undefined;this[_0x01c9('0x45')]=_0x2acd24[_0x01c9('0x45')]||undefined;this['strategy']=strategy[_0x2acd24[_0x01c9('0x46')]]||'rrmemory';this[_0x01c9('0x47')]=!![];this['dialAMDActive']=_0x2acd24[_0x01c9('0x48')]||![];this[_0x01c9('0x49')]=_0x2acd24['dialAMDInitialSilence'];this[_0x01c9('0x4a')]=_0x2acd24['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2acd24['dialAMDAfterGreetingSilence'];this[_0x01c9('0x4b')]=_0x2acd24[_0x01c9('0x4b')];this['dialAMDMinWordLength']=_0x2acd24[_0x01c9('0x4c')];this[_0x01c9('0x4d')]=_0x2acd24[_0x01c9('0x4d')];this[_0x01c9('0x4e')]=_0x2acd24[_0x01c9('0x4e')];this['dialAMDSilenceThreshold']=_0x2acd24['dialAMDSilenceThreshold'];this[_0x01c9('0x4f')]=_0x2acd24[_0x01c9('0x4f')];this[_0x01c9('0x50')]=0x0;this[_0x01c9('0x51')]=0x0;this[_0x01c9('0x52')]=_0x2acd24[_0x01c9('0x52')];this['outboundAnswerCallsDay']=0x0;this[_0x01c9('0x53')]=0x0;this[_0x01c9('0x54')]=0x0;this[_0x01c9('0x55')]=0x0;this[_0x01c9('0x56')]=0x0;this[_0x01c9('0x57')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x01c9('0x58')]=0x0;this[_0x01c9('0x59')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x01c9('0x5a')]=0x0;this[_0x01c9('0x5b')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x01c9('0x5c')]=undefined;this[_0x01c9('0x5d')]=undefined;this[_0x01c9('0x5e')]=undefined;this[_0x01c9('0x5f')]=1.05;this[_0x01c9('0x60')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x01c9('0x61')]=0x0;this[_0x01c9('0x62')]=0x0;this[_0x01c9('0x63')]=0x0;this[_0x01c9('0x64')]=0x0;this[_0x01c9('0x65')]=0x0;this[_0x01c9('0x66')]=0x0;this[_0x01c9('0x67')]=_0x2acd24[_0x01c9('0x68')]||0x14;this[_0x01c9('0x69')]=_0x2acd24['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x01c9('0x6a')]=0x1;this[_0x01c9('0x6b')]=0x0;this[_0x01c9('0x6c')]=0x0;this[_0x01c9('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0x01c9('0x6e')]=_0x2acd24[_0x01c9('0x6e')]||0x1e;this[_0x01c9('0x6f')]=_0x2acd24[_0x01c9('0x6f')]||![];this['dialQueueProject2']=_0x2acd24[_0x01c9('0x70')]||undefined;this[_0x01c9('0x71')]=_0x2acd24[_0x01c9('0x71')]||![];this[_0x01c9('0x72')]=_0x2acd24[_0x01c9('0x72')]||![];this['monitor_format']=monitorFormat[_0x2acd24['monitor_format']]?monitorFormat[_0x2acd24['monitor_format']]:undefined;this[_0x01c9('0x73')]=_0x2acd24[_0x01c9('0x73')]||![];this[_0x01c9('0x74')]=_0x2acd24[_0x01c9('0x74')]?_0x2acd24[_0x01c9('0x74')]: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 c5278b1..04a9e82 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 _0x9ef8=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9ef8,0x90));var _0x89ef=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x9ef8[_0x1ff2ec];return _0x405683;};'use strict';function VtigerAccount(_0x6a246){this['id']=_0x6a246['id']||0x0;this[_0x89ef('0x0')]=_0x6a246[_0x89ef('0x0')]||'';this[_0x89ef('0x1')]=_0x6a246[_0x89ef('0x1')]||'';this[_0x89ef('0x2')]=_0x6a246[_0x89ef('0x2')]||'';this[_0x89ef('0x3')]=_0x6a246['remoteUri']||'';this[_0x89ef('0x4')]=_0x6a246[_0x89ef('0x4')]||'';this[_0x89ef('0x5')]=_0x6a246['Configurations']||{};}module[_0x89ef('0x6')]=VtigerAccount; \ No newline at end of file +var _0xcd9a=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x2c1d94,_0x15b966){var _0x4c9dbb=function(_0x438b86){while(--_0x438b86){_0x2c1d94['push'](_0x2c1d94['shift']());}};_0x4c9dbb(++_0x15b966);}(_0xcd9a,0x1b3));var _0xacd9=function(_0x4605e5,_0x2e8567){_0x4605e5=_0x4605e5-0x0;var _0x34a0c6=_0xcd9a[_0x4605e5];return _0x34a0c6;};'use strict';function VtigerAccount(_0x111dcc){this['id']=_0x111dcc['id']||0x0;this[_0xacd9('0x0')]=_0x111dcc[_0xacd9('0x0')]||'';this[_0xacd9('0x1')]=_0x111dcc[_0xacd9('0x1')]||'';this[_0xacd9('0x2')]=_0x111dcc[_0xacd9('0x2')]||'';this[_0xacd9('0x3')]=_0x111dcc[_0xacd9('0x3')]||'';this[_0xacd9('0x4')]=_0x111dcc[_0xacd9('0x4')]||'';this[_0xacd9('0x5')]=_0x111dcc[_0xacd9('0x5')]||{};}module[_0xacd9('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 b0afefd..221a8c9 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 _0xcb9d=['exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x4229a3,_0x285d47){var _0x4421b5=function(_0x250645){while(--_0x250645){_0x4229a3['push'](_0x4229a3['shift']());}};_0x4421b5(++_0x285d47);}(_0xcb9d,0x11f));var _0xdcb9=function(_0x30253c,_0x32a34a){_0x30253c=_0x30253c-0x0;var _0x84a3cd=_0xcb9d[_0x30253c];return _0x84a3cd;};'use strict';function ZendeskAccount(_0x6aae4c){this['id']=_0x6aae4c['id']||0x0;this[_0xdcb9('0x0')]=_0x6aae4c[_0xdcb9('0x0')]||'';this[_0xdcb9('0x1')]=_0x6aae4c[_0xdcb9('0x1')]||'';this[_0xdcb9('0x2')]=_0x6aae4c[_0xdcb9('0x2')]||'';this[_0xdcb9('0x3')]=_0x6aae4c[_0xdcb9('0x3')]||'';this[_0xdcb9('0x4')]=_0x6aae4c[_0xdcb9('0x4')]||'';this[_0xdcb9('0x5')]=_0x6aae4c[_0xdcb9('0x5')]||'';this[_0xdcb9('0x6')]=_0x6aae4c[_0xdcb9('0x6')]||_0xdcb9('0x7');this['serverUrl']=_0x6aae4c[_0xdcb9('0x8')]||'';this['Configurations']=_0x6aae4c[_0xdcb9('0x9')]||{};}module[_0xdcb9('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x0453=['type','integrationTab','serverUrl','Configurations','username','password','token','remoteUri','authType'];(function(_0x30fba1,_0x17c5bb){var _0x23fb77=function(_0x3d6375){while(--_0x3d6375){_0x30fba1['push'](_0x30fba1['shift']());}};_0x23fb77(++_0x17c5bb);}(_0x0453,0x94));var _0x3045=function(_0x466098,_0x39934d){_0x466098=_0x466098-0x0;var _0x53f727=_0x0453[_0x466098];return _0x53f727;};'use strict';function ZendeskAccount(_0xaea09b){this['id']=_0xaea09b['id']||0x0;this['name']=_0xaea09b['name']||'';this[_0x3045('0x0')]=_0xaea09b[_0x3045('0x0')]||'';this[_0x3045('0x1')]=_0xaea09b['password']||'';this[_0x3045('0x2')]=_0xaea09b[_0x3045('0x2')]||'';this['remoteUri']=_0xaea09b[_0x3045('0x3')]||'';this[_0x3045('0x4')]=_0xaea09b['authType']||'';this['type']=_0xaea09b[_0x3045('0x5')]||_0x3045('0x6');this['serverUrl']=_0xaea09b[_0x3045('0x7')]||'';this[_0x3045('0x8')]=_0xaea09b[_0x3045('0x8')]||{};}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 1f645a6..2f9066e 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 _0xe221=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x1ca085,_0xbdfa92){var _0x291576=function(_0x3096a2){while(--_0x3096a2){_0x1ca085['push'](_0x1ca085['shift']());}};_0x291576(++_0xbdfa92);}(_0xe221,0xad));var _0x1e22=function(_0x11e39d,_0x160f64){_0x11e39d=_0x11e39d-0x0;var _0x3e91f6=_0xe221[_0x11e39d];return _0x3e91f6;};'use strict';function ZohoAccount(_0x27e04e){this['id']=_0x27e04e['id']||0x0;this[_0x1e22('0x0')]=_0x27e04e['name']||'';this[_0x1e22('0x1')]=_0x27e04e[_0x1e22('0x1')]||'';this[_0x1e22('0x2')]=_0x27e04e['host']||'';this[_0x1e22('0x3')]=_0x27e04e[_0x1e22('0x3')]||'';this[_0x1e22('0x4')]=_0x27e04e[_0x1e22('0x4')]||'';this[_0x1e22('0x5')]=_0x27e04e[_0x1e22('0x5')]||'';this[_0x1e22('0x6')]=_0x27e04e['serverUrl']||'';this[_0x1e22('0x7')]=_0x27e04e['code']||'';this['refreshToken']=_0x27e04e[_0x1e22('0x8')]||'';this[_0x1e22('0x9')]=_0x27e04e[_0x1e22('0x9')]||{};}module[_0x1e22('0xa')]=ZohoAccount; \ No newline at end of file +var _0x6eca=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x446178,_0x58baae){var _0xc0fe74=function(_0x72673f){while(--_0x72673f){_0x446178['push'](_0x446178['shift']());}};_0xc0fe74(++_0x58baae);}(_0x6eca,0x1c7));var _0xa6ec=function(_0x2d3fc1,_0x179121){_0x2d3fc1=_0x2d3fc1-0x0;var _0x4931c4=_0x6eca[_0x2d3fc1];return _0x4931c4;};'use strict';function ZohoAccount(_0x4f67db){this['id']=_0x4f67db['id']||0x0;this[_0xa6ec('0x0')]=_0x4f67db[_0xa6ec('0x0')]||'';this['description']=_0x4f67db[_0xa6ec('0x1')]||'';this[_0xa6ec('0x2')]=_0x4f67db[_0xa6ec('0x2')]||'';this[_0xa6ec('0x3')]=_0x4f67db['zone']||'';this[_0xa6ec('0x4')]=_0x4f67db[_0xa6ec('0x4')]||'';this['clientSecret']=_0x4f67db['clientSecret']||'';this['serverUrl']=_0x4f67db[_0xa6ec('0x5')]||'';this[_0xa6ec('0x6')]=_0x4f67db['code']||'';this[_0xa6ec('0x7')]=_0x4f67db[_0xa6ec('0x7')]||'';this[_0xa6ec('0x8')]=_0x4f67db[_0xa6ec('0x8')]||{};}module[_0xa6ec('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 1cea2ac..e7192a5 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 _0x7f87=['callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','queue','name','type','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x33b623,_0x343047){var _0x2b4d98=function(_0x1a914f){while(--_0x1a914f){_0x33b623['push'](_0x33b623['shift']());}};_0x2b4d98(++_0x343047);}(_0x7f87,0xf5));var _0x77f8=function(_0x2b1930,_0x5b9d41){_0x2b1930=_0x2b1930-0x0;var _0x435ca6=_0x7f87[_0x2b1930];return _0x435ca6;};'use strict';var util=require(_0x77f8('0x0'));var _=require(_0x77f8('0x1'));var moment=require(_0x77f8('0x2'));function checkNameSurname(_0x211b14,_0x1f183f,_0xee385c){var _0x1bd6f1='';if(!_[_0x77f8('0x3')](_0x1f183f)&&'string'===typeof _0x1f183f){_0x1bd6f1+=_0x1f183f;}if(!_[_0x77f8('0x3')](_0xee385c)&&_0x77f8('0x4')===typeof _0xee385c){_0x1bd6f1+='\x20'+_0xee385c;}if(_0x1bd6f1!==''){return _0x1bd6f1;}return _0x211b14;}function Action(_0x212533,_0x56742e,_0x238568,_0x411acf,_0x1ae74e){this[_0x77f8('0x5')]=_0x238568||undefined;this['idContact']=_0x212533['id'];this[_0x77f8('0x6')]=_0x56742e[_0x77f8('0x7')];this['type']=_0x56742e[_0x77f8('0x8')];this['campaigntype']=_0x77f8('0x6');this[_0x77f8('0x9')]=![];this[_0x77f8('0xa')]=_[_0x77f8('0x3')](_0x212533[_0x77f8('0xb')])?undefined:_0x212533[_0x77f8('0xb')][_0x77f8('0x7')];this['channelAgent']=this[_0x77f8('0xa')]?util['format'](_0x77f8('0xc'),this[_0x77f8('0xa')]):_0x411acf||undefined;this[_0x77f8('0xd')]=checkNameSurname(_0x212533[_0x77f8('0xe')]['phone'],_0x212533['Contact']['firstName'],_0x212533['Contact'][_0x77f8('0xf')]);this[_0x77f8('0x10')]=_0x212533['active']||![];this[_0x77f8('0x11')]=_0x212533['Contact'][_0x77f8('0x12')];this[_0x77f8('0x13')]=_0x212533['scheduledat'];this[_0x77f8('0x14')]=_0x212533['countbusyretry']||0x0;this[_0x77f8('0x15')]=_0x212533[_0x77f8('0x15')]||0x0;this[_0x77f8('0x16')]=_0x212533[_0x77f8('0x16')]||0x0;this['countglobal']=(_0x212533[_0x77f8('0x14')]||0x0)+(_0x212533[_0x77f8('0x15')]||0x0)+(_0x212533[_0x77f8('0x16')]||0x0)+(_0x212533[_0x77f8('0x17')]||0x0)+(_0x212533[_0x77f8('0x18')]||0x0)+(_0x212533[_0x77f8('0x19')]||0x0)+(_0x212533[_0x77f8('0x1a')]||0x0)+(_0x212533[_0x77f8('0x1b')]||0x0);this[_0x77f8('0x17')]=_0x212533[_0x77f8('0x17')]||0x0;this[_0x77f8('0x18')]=_0x212533['countdropretry']||0x0;this[_0x77f8('0x19')]=_0x212533[_0x77f8('0x19')]||0x0;this[_0x77f8('0x1a')]=_0x212533[_0x77f8('0x1a')]||0x0;this['countagentrejectretry']=_0x212533[_0x77f8('0x1b')]||0x0;this[_0x77f8('0x1c')]=_0x212533[_0x77f8('0x1c')];this[_0x77f8('0x1d')]=_0x212533[_0x77f8('0x1d')];this[_0x77f8('0x1e')]=_0x212533[_0x77f8('0x1e')];this['recallme']=_0x212533['recallme'];this[_0x77f8('0x1f')]=_0x212533[_0x77f8('0x1f')];this[_0x77f8('0x20')]=_0x212533[_0x77f8('0x20')];this[_0x77f8('0x21')]=_[_0x77f8('0x3')](_0x212533[_0x77f8('0xb')])?_0x212533['UserId']:_0x212533[_0x77f8('0xb')]['id'];this[_0x77f8('0x22')]=_0x212533[_0x77f8('0x22')];this['originatecalleridnum']='';this[_0x77f8('0x23')]='';}Action['prototype'][_0x77f8('0x24')]=function(){return util['format'](_0x77f8('0x25'),this[_0x77f8('0xd')],this[_0x77f8('0x26')]);};module['exports']=Action; \ No newline at end of file +var _0x1341=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','moment','string','idContact','queue','name','type','campaigntype','membername','isNil','Agent','channelAgent','format','SIP/%s','calleridname','phone','firstName','lastName','active','calleridnum','Contact','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1341,0xed));var _0x1134=function(_0x5e7211,_0x4e4e02){_0x5e7211=_0x5e7211-0x0;var _0x3a8944=_0x1341[_0x5e7211];return _0x3a8944;};'use strict';var util=require(_0x1134('0x0'));var _=require('lodash');var moment=require(_0x1134('0x1'));function checkNameSurname(_0x30826c,_0x32389f,_0x7982d7){var _0x78cf22='';if(!_['isNil'](_0x32389f)&&'string'===typeof _0x32389f){_0x78cf22+=_0x32389f;}if(!_['isNil'](_0x7982d7)&&_0x1134('0x2')===typeof _0x7982d7){_0x78cf22+='\x20'+_0x7982d7;}if(_0x78cf22!==''){return _0x78cf22;}return _0x30826c;}function Action(_0x1b8407,_0x1022ae,_0x4db8ed,_0x477f42,_0x11c726){this['uniqueid']=_0x4db8ed||undefined;this[_0x1134('0x3')]=_0x1b8407['id'];this[_0x1134('0x4')]=_0x1022ae[_0x1134('0x5')];this['type']=_0x1022ae[_0x1134('0x6')];this[_0x1134('0x7')]=_0x1134('0x4');this['dialAnswer']=![];this[_0x1134('0x8')]=_[_0x1134('0x9')](_0x1b8407[_0x1134('0xa')])?undefined:_0x1b8407['Agent'][_0x1134('0x5')];this[_0x1134('0xb')]=this['membername']?util[_0x1134('0xc')](_0x1134('0xd'),this[_0x1134('0x8')]):_0x477f42||undefined;this[_0x1134('0xe')]=checkNameSurname(_0x1b8407['Contact'][_0x1134('0xf')],_0x1b8407['Contact'][_0x1134('0x10')],_0x1b8407['Contact'][_0x1134('0x11')]);this[_0x1134('0x12')]=_0x1b8407[_0x1134('0x12')]||![];this[_0x1134('0x13')]=_0x1b8407[_0x1134('0x14')][_0x1134('0xf')];this[_0x1134('0x15')]=_0x1b8407[_0x1134('0x15')];this[_0x1134('0x16')]=_0x1b8407[_0x1134('0x16')]||0x0;this[_0x1134('0x17')]=_0x1b8407[_0x1134('0x17')]||0x0;this[_0x1134('0x18')]=_0x1b8407['countnoanswerretry']||0x0;this[_0x1134('0x19')]=(_0x1b8407[_0x1134('0x16')]||0x0)+(_0x1b8407['countcongestionretry']||0x0)+(_0x1b8407[_0x1134('0x18')]||0x0)+(_0x1b8407[_0x1134('0x1a')]||0x0)+(_0x1b8407[_0x1134('0x1b')]||0x0)+(_0x1b8407[_0x1134('0x1c')]||0x0)+(_0x1b8407['countmachineretry']||0x0)+(_0x1b8407[_0x1134('0x1d')]||0x0);this[_0x1134('0x1a')]=_0x1b8407[_0x1134('0x1a')]||0x0;this['countdropretry']=_0x1b8407[_0x1134('0x1b')]||0x0;this['countabandonedretry']=_0x1b8407['countabandonedretry']||0x0;this[_0x1134('0x1e')]=_0x1b8407[_0x1134('0x1e')]||0x0;this[_0x1134('0x1d')]=_0x1b8407['countagentrejectretry']||0x0;this['callback']=_0x1b8407[_0x1134('0x1f')];this[_0x1134('0x20')]=_0x1b8407[_0x1134('0x20')];this['callbackat']=_0x1b8407[_0x1134('0x21')];this[_0x1134('0x22')]=_0x1b8407[_0x1134('0x22')];this[_0x1134('0x23')]=_0x1b8407[_0x1134('0x23')];this['ListId']=_0x1b8407[_0x1134('0x24')];this[_0x1134('0x25')]=_[_0x1134('0x9')](_0x1b8407['Agent'])?_0x1b8407[_0x1134('0x25')]:_0x1b8407[_0x1134('0xa')]['id'];this['VoiceQueueId']=_0x1b8407[_0x1134('0x26')];this[_0x1134('0x27')]='';this[_0x1134('0x28')]='';}Action[_0x1134('0x29')][_0x1134('0x2a')]=function(){return util['format'](_0x1134('0x2b'),this[_0x1134('0xe')],this[_0x1134('0x2c')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0669463..486a190 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 _0x0eaf=['syncHangupRequest','dialend','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','unmanaged','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','info','voice_queue_channel:remove','emit','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','channel','catch','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','then','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','logCustomer','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','Busy','custom:agentbusy','busy','cloneAction','dialBusyMaxRetry','rescheduleContact','countbusyretry','dialBusyRetryFrequency','unlockAgent','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','starttime','Action','channelAgent','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','clone','isFailure','response','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destuniqueid','addVariable','variables','syncVarSet','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest'];(function(_0x461380,_0x3c51d1){var _0x3b9036=function(_0x11e500){while(--_0x11e500){_0x461380['push'](_0x461380['shift']());}};_0x3b9036(++_0x3c51d1);}(_0x0eaf,0x135));var _0xf0ea=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0eaf[_0x19950b];return _0x3c6b41;};'use strict';var util=require('util');var _=require(_0xf0ea('0x0'));var BPromise=require(_0xf0ea('0x1'));var uuid=require(_0xf0ea('0x2'));var moment=require(_0xf0ea('0x3'));var md5=require(_0xf0ea('0x4'));var Redis=require(_0xf0ea('0x5'));var config=require(_0xf0ea('0x6'));var logger=require('../../../config/logger')(_0xf0ea('0x7'));var loggerAction=require(_0xf0ea('0x8'))(_0xf0ea('0x9'));var ami=require(_0xf0ea('0xa'));var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require(_0xf0ea('0xb'));config[_0xf0ea('0xc')]=_[_0xf0ea('0xd')](config[_0xf0ea('0xc')],{'host':_0xf0ea('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf0ea('0xc')]));var Sequence=function(){};Sequence[_0xf0ea('0xf')][_0xf0ea('0x10')]=function(_0x188b66){this[_0xf0ea('0x11')]=this['tail']?this[_0xf0ea('0x11')][_0xf0ea('0x12')](_0x188b66):_0x188b66();};function Preview(_0x3b7bf8){this[_0xf0ea('0x13')]=new Sequence();this['campaignsPreview']=_0x3b7bf8['voiceQueues'];this[_0xf0ea('0x14')]=_0x3b7bf8[_0xf0ea('0x14')];this[_0xf0ea('0x15')]={};this[_0xf0ea('0x16')]=_0x3b7bf8[_0xf0ea('0x16')];this[_0xf0ea('0x17')]=0x0;ami['on'](_0xf0ea('0x18'),this[_0xf0ea('0x19')][_0xf0ea('0x1a')](this));ami['on'](_0xf0ea('0x1b'),this[_0xf0ea('0x1c')][_0xf0ea('0x1a')](this));ami['on'](_0xf0ea('0x1d'),this[_0xf0ea('0x1e')][_0xf0ea('0x1a')](this));ami['on'](_0xf0ea('0x1f'),this['syncDialEnd'][_0xf0ea('0x1a')](this));ami['on'](_0xf0ea('0x20'),this[_0xf0ea('0x21')][_0xf0ea('0x1a')](this));ami['on']('varset',this['syncVarSet'][_0xf0ea('0x1a')](this));ami['on'](_0xf0ea('0x22'),this[_0xf0ea('0x23')][_0xf0ea('0x1a')](this));ami['on'](_0xf0ea('0x24'),this['syncBlindTransfer'][_0xf0ea('0x1a')](this));this[_0xf0ea('0x25')](this[_0xf0ea('0x26')]);}function emit(_0x47fed0,_0x1f8c6a,_0x134215){io['to'](_0x47fed0)['emit'](_0x1f8c6a,_0x134215);}function emitCampaignPreview(_0x5ac57a){if(_0x5ac57a[_0xf0ea('0x27')]==='outbound'){var _0x28059f={'id':_0x5ac57a['id'],'name':_0x5ac57a[_0xf0ea('0x28')],'strategy':_0x5ac57a[_0xf0ea('0x29')],'answered':_0x5ac57a[_0xf0ea('0x2a')],'available':_0x5ac57a[_0xf0ea('0x2b')],'loggedIn':_0x5ac57a[_0xf0ea('0x2c')],'pTalking':_0x5ac57a[_0xf0ea('0x2d')],'sumBillable':_0x5ac57a[_0xf0ea('0x2e')],'sumDuration':_0x5ac57a[_0xf0ea('0x2f')],'sumHoldTime':_0x5ac57a['sumHoldTime']||0x0,'talking':_0x5ac57a['talking'],'total':_0x5ac57a[_0xf0ea('0x30')],'type':_0x5ac57a[_0xf0ea('0x27')],'unmanaged':_0x5ac57a[_0xf0ea('0x31')],'abandoned':_0x5ac57a[_0xf0ea('0x32')],'waiting':_0x5ac57a['waiting'],'loggedInDb':_0x5ac57a[_0xf0ea('0x33')],'dialActive':_0x5ac57a[_0xf0ea('0x34')],'dialMethod':_0x5ac57a['dialMethod'],'dialOriginateCallerIdName':_0x5ac57a[_0xf0ea('0x35')],'dialOriginateCallerIdNumber':_0x5ac57a[_0xf0ea('0x36')],'dialOriginateTimeout':_0x5ac57a[_0xf0ea('0x37')],'dialPrefix':_0x5ac57a[_0xf0ea('0x38')],'outboundAnswerAgiCallsDay':_0x5ac57a[_0xf0ea('0x39')],'outboundAnswerCallsDay':_0x5ac57a[_0xf0ea('0x3a')],'outboundBlacklistCallsDay':_0x5ac57a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5ac57a[_0xf0ea('0x3b')],'outboundCongestionCallsDay':_0x5ac57a[_0xf0ea('0x3c')],'outboundDropCallsDayACS':_0x5ac57a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x5ac57a[_0xf0ea('0x3d')],'outboundDropCallsDayTimeout':_0x5ac57a[_0xf0ea('0x3e')],'outboundNoAnswerCallsDay':_0x5ac57a[_0xf0ea('0x3f')],'outboundNoSuchCallsDay':_0x5ac57a['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5ac57a[_0xf0ea('0x40')],'outboundReCallsDay':_0x5ac57a[_0xf0ea('0x41')],'outboundRejectCallsDay':_0x5ac57a['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5ac57a[_0xf0ea('0x42')],'outboundAbandonedCallsDay':_0x5ac57a['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5ac57a[_0xf0ea('0x43')],'predictiveIntervalAvgHoldtime':_0x5ac57a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5ac57a[_0xf0ea('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x5ac57a[_0xf0ea('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x5ac57a[_0xf0ea('0x46')],'predictiveIntervalErlangCalls':_0x5ac57a[_0xf0ea('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x5ac57a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x5ac57a[_0xf0ea('0x48')],'predictiveIntervalMultiplicativeFactor':_0x5ac57a[_0xf0ea('0x49')],'predictiveIntervalPauses':_0x5ac57a[_0xf0ea('0x4a')],'predictiveIntervalAvailable':_0x5ac57a[_0xf0ea('0x4b')],'predictiveIntervalTotalCalls':_0x5ac57a[_0xf0ea('0x4c')],'message':_0x5ac57a['message'],'originated':_0x5ac57a[_0xf0ea('0x4d')],'erlangCalls':_0x5ac57a[_0xf0ea('0x4e')],'erlangCallToSecond':_0x5ac57a['erlangCallToSecond'],'erlangAbandonmentRate':_0x5ac57a[_0xf0ea('0x4f')],'erlangBusyFactor':_0x5ac57a[_0xf0ea('0x50')],'startPredictive':_0x5ac57a['startPredictive'],'startProgressive':_0x5ac57a[_0xf0ea('0x51')]};if(_0x5ac57a[_0xf0ea('0x52')]){_0x28059f['Trunk']={'id':_0x5ac57a['Trunk']['id'],'name':_0x5ac57a[_0xf0ea('0x52')][_0xf0ea('0x28')],'active':_0x5ac57a[_0xf0ea('0x52')][_0xf0ea('0x53')],'callerid':_0x5ac57a['Trunk']['callerid']};}if(_0x5ac57a[_0xf0ea('0x54')]){_0x28059f[_0xf0ea('0x54')]={'id':_0x5ac57a[_0xf0ea('0x54')]['id'],'name':_0x5ac57a[_0xf0ea('0x54')][_0xf0ea('0x28')]};}var _0x5a554b=md5(JSON[_0xf0ea('0x55')](_0x28059f));if(_0x5ac57a[_0xf0ea('0x4')]!==_0x5a554b){_0x5ac57a[_0xf0ea('0x4')]=_0x5a554b;emit(util[_0xf0ea('0x56')](_0xf0ea('0x57'),_0x28059f[_0xf0ea('0x28')]),'voice_queue:save',_0x28059f);}}}function emitVoiceQueueChannelRemove(_0x3ca48f){logger[_0xf0ea('0x58')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xf0ea('0x55')](_0x3ca48f));emit(util[_0xf0ea('0x56')](_0xf0ea('0x57'),_0x3ca48f[_0xf0ea('0x28')]),_0xf0ea('0x59'),_0x3ca48f);io[_0xf0ea('0x5a')]('voice_queue_presence:remove',_0x3ca48f);}function notSendMessagesQueue(_0x485ef2){if(_0x485ef2['sendMessageOneNotActive']){if(_0x485ef2[_0xf0ea('0x4d')]===0x0&&_0x485ef2[_0xf0ea('0x2d')]===0x0){_0x485ef2['sendMessageOneNotActive']=![];_0x485ef2['available']=0x0;_0x485ef2['paused']=0x0;_0x485ef2[_0xf0ea('0x5b')]=_0xf0ea('0x5c');ut[_0xf0ea('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x485ef2[_0xf0ea('0x28')]+'\x20is\x20not\x20active');}else{_0x485ef2['message']='IS_DISACTIVED';ut['logger'](_0xf0ea('0x5e'),_0x485ef2[_0xf0ea('0x28')]+'\x20is\x20disactive');}emitCampaignPreview(_0x485ef2);}}Preview['prototype'][_0xf0ea('0x25')]=function(){var _0x29b470=this;setInterval(function(){_0x29b470[_0xf0ea('0x5f')]();},0x7cf);};Preview[_0xf0ea('0xf')][_0xf0ea('0x5f')]=function(){var _0x193682=this[_0xf0ea('0x26')];this['clockClearZombieChannels']+=0x1;for(var _0x4809d4 in _0x193682){if(_0x193682[_0xf0ea('0x60')](_0x4809d4)&&(_0x193682[_0x4809d4][_0xf0ea('0x61')]===_0xf0ea('0x7')||_0x193682[_0x4809d4]['dialMethod']==='booked')&&_0x193682[_0x4809d4][_0xf0ea('0x27')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xf0ea('0x17')]=0x0;this[_0xf0ea('0x62')]();}}if(_0x193682[_0xf0ea('0x60')](_0x4809d4)&&_0x193682[_0x4809d4][_0xf0ea('0x61')]==='preview'&&_0x193682[_0x4809d4][_0xf0ea('0x27')]==='outbound'){if(_0x193682[_0x4809d4]['dialActive']){this[_0xf0ea('0x63')](_0x193682[_0x4809d4]);this[_0xf0ea('0x64')](_0x193682[_0x4809d4]);}else{notSendMessagesQueue(_0x193682[_0x4809d4]);}}}};Preview['prototype'][_0xf0ea('0x65')]=function(_0x5dcd5b){var _0x22f8f2=this;this[_0xf0ea('0x13')][_0xf0ea('0x10')](function(){if(!_[_0xf0ea('0x66')](_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b])){loggerAction['info'](_0xf0ea('0x67'),_0x5dcd5b,'Queue',_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b][_0xf0ea('0x68')],_0xf0ea('0x69'),JSON[_0xf0ea('0x55')](_0x22f8f2['campaignsPreview'][_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b]['queue']][_0xf0ea('0x4d')]),_0xf0ea('0x6a'),JSON[_0xf0ea('0x55')](_0x22f8f2[_0xf0ea('0x26')][_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b][_0xf0ea('0x68')]][_0xf0ea('0x2d')]),JSON[_0xf0ea('0x55')](_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b]['dialAnswer']),JSON['stringify'](_[_0xf0ea('0x6b')](_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b],[_0xf0ea('0x6c'),_0xf0ea('0x6d'),_0xf0ea('0x6e'),'ListId'])));return ami['Action']({'action':'status','channel':_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b][_0xf0ea('0x6f')]})[_0xf0ea('0x70')](function(_0x335ddb){if(_0x335ddb[_0xf0ea('0x5b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x22f8f2['actions'][_0x5dcd5b]){ut[_0xf0ea('0x71')](_0x22f8f2[_0xf0ea('0x26')][_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b][_0xf0ea('0x68')]],'[clearZombieChannel]');if(_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b][_0xf0ea('0x72')]===!![]){ut[_0xf0ea('0x73')](_0x22f8f2[_0xf0ea('0x26')][_0x22f8f2['actions'][_0x5dcd5b][_0xf0ea('0x68')]],_0xf0ea('0x74'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x5dcd5b,_0x22f8f2[_0xf0ea('0x15')][_0x5dcd5b][_0xf0ea('0x68')]);}ut[_0xf0ea('0x75')](_0xf0ea('0x76')+_0x5dcd5b,_0x22f8f2['actions'][_0x5dcd5b][_0xf0ea('0x68')]);delete _0x22f8f2['actions'][_0x5dcd5b];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x3755db=this;loggerAction[_0xf0ea('0x58')](_0xf0ea('0x77'),_[_0xf0ea('0x78')](this[_0xf0ea('0x15')]));for(var _0x2af255 in this['actions']){if(_0x3755db[_0xf0ea('0x15')][_0xf0ea('0x60')](_0x2af255)){_0x3755db['clearZombieChannel'](_0x2af255);}}};Preview[_0xf0ea('0xf')][_0xf0ea('0x64')]=function(_0x101ca1){var _0xf2fe03=this;rpcDb[_0xf0ea('0x79')](_0x101ca1['id'],ut[_0xf0ea('0x7a')](this[_0xf0ea('0x16')]))['then'](function(_0x8b3b8f){if(!_[_0xf0ea('0x66')](_0x8b3b8f)){for(var _0x1dd479=0x0;_0x1dd479<_0x8b3b8f[_0xf0ea('0x7b')];_0x1dd479+=0x1){if(ut[_0xf0ea('0x7c')](_0x8b3b8f[_0x1dd479][_0xf0ea('0x7d')])<_0x101ca1[_0xf0ea('0x7e')]*0x3c){if(_0x8b3b8f[_0x1dd479]['Agent']&&!_0x8b3b8f[_0x1dd479][_0xf0ea('0x7f')]['voicePause']){_0xf2fe03['run'](_0x8b3b8f[_0x1dd479]['id'])[_0xf0ea('0x80')](ut[_0xf0ea('0x81')](_0xf0ea('0x82')))['catch'](ut['logger2'](_0xf0ea('0x82')));}else{rpcDb['disableContact'](_0x8b3b8f[_0x1dd479]['id']);}}else{var _0x52614e=new Action(_0x8b3b8f[_0x1dd479],_0x101ca1);_0x52614e['starttime']=moment()[_0xf0ea('0x56')](_0xf0ea('0x83'));_0x101ca1[_0xf0ea('0x41')]+=0x1;ut[_0xf0ea('0x84')](_0x52614e,0x17,'RecallInQueue');if(_0x101ca1['dialRecallInQueue']){rpcDb[_0xf0ea('0x85')](ut[_0xf0ea('0x86')](_0x8b3b8f[_0x1dd479]));rpcDb['createCustomerHistory'](_0x52614e,_0xf0ea('0x87'));}else{ut[_0xf0ea('0x84')](_0x52614e,0x16,_0xf0ea('0x88'));rpcDb[_0xf0ea('0x89')](_0x52614e,_0xf0ea('0x8a'));rpcDb[_0xf0ea('0x8b')](_0x52614e,_0xf0ea('0x8a'));}}}}})['catch'](ut[_0xf0ea('0x81')](_0xf0ea('0x8c')));};Preview[_0xf0ea('0xf')]['setMessage']=function(_0xa65792){_0xa65792['sendMessageOneNotActive']=!![];if(ut[_0xf0ea('0x8d')](_0xa65792[_0xf0ea('0x2c')])){_0xa65792[_0xf0ea('0x5b')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0xa65792[_0xf0ea('0x34')])){_0xa65792['message']=_0xf0ea('0x5c');}else if(!this[_0xf0ea('0x8e')](_0xa65792['Trunk'])){if(!this[_0xf0ea('0x8e')](_0xa65792[_0xf0ea('0x8f')])){_0xa65792[_0xf0ea('0x5b')]='TRUNK_IS_NOT_REACHABLE';}else{_0xa65792[_0xf0ea('0x5b')]=_0xf0ea('0x90');}}else{_0xa65792[_0xf0ea('0x5b')]=_0xf0ea('0x90');}emitCampaignPreview(_0xa65792);};Preview[_0xf0ea('0xf')][_0xf0ea('0x91')]=function(_0x3ba54b,_0x2df457,_0x10794d){var _0xf9499b=this;var _0x20b2e4=this[_0xf0ea('0x15')][_0x2df457];var _0x4c5f0c=this[_0xf0ea('0x26')][_0x20b2e4['queue']];var _0x35fbe1;if(_0x4c5f0c){switch(_0x10794d){case'1':_0x4c5f0c[_0xf0ea('0x92')]+=0x1;_0x20b2e4['countnosuchnumberretry']+=0x1;_0x20b2e4[_0xf0ea('0x93')]=ut[_0xf0ea('0x94')](_0x20b2e4);ut[_0xf0ea('0x84')](_0x20b2e4,0x0,_0xf0ea('0x95'));ami[_0xf0ea('0x5a')](_0xf0ea('0x96'),ut[_0xf0ea('0x97')](_0x20b2e4,_0xf0ea('0x98')));rpcDb[_0xf0ea('0x89')](_0x20b2e4,_0xf0ea('0x99'));if(ut[_0xf0ea('0x94')](_0x20b2e4)>=_0x4c5f0c[_0xf0ea('0x9a')]){_0x35fbe1=ut['cloneAction'](_0x20b2e4,0xf,_0xf0ea('0x9b'));rpcDb[_0xf0ea('0x8b')](_0x35fbe1,_0xf0ea('0x9c'));}else{if(_0x20b2e4[_0xf0ea('0x9d')]>=_0x4c5f0c[_0xf0ea('0x9e')]){rpcDb['createCustomerFinal'](_0x20b2e4,_0xf0ea('0x9c'));}else{rpcDb['rescheduleContact'](ut[_0xf0ea('0x9f')](_0x20b2e4,_0xf0ea('0x9d'),_0x4c5f0c[_0xf0ea('0xa0')]),_0x20b2e4['unlockAgent'],_0x20b2e4[_0xf0ea('0xa1')]);}}delete this['actions'][_0x3ba54b['linkedid']];break;case _0xf0ea('0xa2'):var _0x28d376=moment()[_0xf0ea('0x56')](_0xf0ea('0x83'));_0x20b2e4[_0xf0ea('0xa3')]=_0x28d376;_0x20b2e4[_0xf0ea('0xa4')]=_0x28d376;_0x20b2e4[_0xf0ea('0x72')]=!![];_0x4c5f0c[_0xf0ea('0x2d')]+=0x1;logger[_0xf0ea('0x58')](_0xf0ea('0xa5'),_0x20b2e4[_0xf0ea('0xa6')],_0xf0ea('0xa7'),_0x4c5f0c[_0xf0ea('0x28')],_0xf0ea('0x6a'),_0x4c5f0c[_0xf0ea('0x2d')]);ami[_0xf0ea('0x5a')](_0xf0ea('0xa8'),ut[_0xf0ea('0x97')](_0x20b2e4,_0xf0ea('0xa9'),this['campaignsPreview'][_0x20b2e4[_0xf0ea('0x68')]]));if(_0x4c5f0c['acw']){ami[_0xf0ea('0x5a')](_0xf0ea('0xaa'),ut['buildAcw'](_0x20b2e4));}break;case'16':ami[_0xf0ea('0x5a')](_0xf0ea('0xab'),ut[_0xf0ea('0x97')](_0x20b2e4,_0xf0ea('0xac'),this['campaignsPreview'][_0x20b2e4[_0xf0ea('0x68')]]));emitVoiceQueueChannelRemove(ut[_0xf0ea('0x97')](_0x20b2e4,_0xf0ea('0xac')));_0x4c5f0c[_0xf0ea('0x3a')]+=0x1;_0x4c5f0c['total']+=0x1;_0x4c5f0c['answered']+=0x1;ut[_0xf0ea('0x73')](_0x4c5f0c,_0xf0ea('0xad'));_0x20b2e4[_0xf0ea('0x93')]=ut[_0xf0ea('0x94')](_0x20b2e4);ut[_0xf0ea('0x84')](_0x20b2e4,0x4,_0xf0ea('0xae'));rpcDb[_0xf0ea('0x89')](_0x20b2e4,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xf0ea('0x8b')](_0x20b2e4,_0xf0ea('0xaf'));rpcDb[_0xf0ea('0xb0')](_0x20b2e4);_0x4c5f0c['sumDuration']+=_0x20b2e4[_0xf0ea('0xb1')];_0x4c5f0c[_0xf0ea('0x2e')]+=_0x20b2e4[_0xf0ea('0xb1')];logger[_0xf0ea('0x58')]('[syncHangup][talking][decrement]',_0x20b2e4['uniqueid'],_0xf0ea('0xa7'),_0x4c5f0c['name'],_0xf0ea('0x6a'),_0x4c5f0c[_0xf0ea('0x2d')]);delete this[_0xf0ea('0x15')][_0x3ba54b['linkedid']];break;case'BUSY':_0x4c5f0c['outboundBusyCallsDay']+=0x1;_0x20b2e4['countbusyretry']+=0x1;_0x20b2e4[_0xf0ea('0x93')]=ut[_0xf0ea('0x94')](_0x20b2e4);ut['logCustomer'](_0x20b2e4,0x5,_0xf0ea('0xb2'));ami['emit'](_0xf0ea('0xb3'),ut[_0xf0ea('0x97')](_0x20b2e4,_0xf0ea('0xb4')));rpcDb[_0xf0ea('0x89')](_0x20b2e4,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xf0ea('0x94')](_0x20b2e4)>=_0x4c5f0c['dialGlobalMaxRetry']){_0x35fbe1=ut[_0xf0ea('0xb5')](_0x20b2e4,0xf,'Global');rpcDb[_0xf0ea('0x8b')](_0x35fbe1,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x20b2e4['countbusyretry']>=_0x4c5f0c[_0xf0ea('0xb6')]){rpcDb[_0xf0ea('0x8b')](_0x20b2e4,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xf0ea('0xb7')](ut[_0xf0ea('0x9f')](_0x20b2e4,_0xf0ea('0xb8'),_0x4c5f0c[_0xf0ea('0xb9')]),_0x20b2e4[_0xf0ea('0xba')],_0x20b2e4[_0xf0ea('0xa1')]);}}break;case'NOANSWER':_0x4c5f0c[_0xf0ea('0x3f')]+=0x1;_0x20b2e4[_0xf0ea('0xbb')]+=0x1;_0x20b2e4[_0xf0ea('0x93')]=ut[_0xf0ea('0x94')](_0x20b2e4);ut[_0xf0ea('0x84')](_0x20b2e4,0x3,_0xf0ea('0xbc'));ami[_0xf0ea('0x5a')](_0xf0ea('0xbd'),ut['buildObj'](_0x20b2e4,'noanswer'));rpcDb[_0xf0ea('0x89')](_0x20b2e4,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xf0ea('0x94')](_0x20b2e4)>=_0x4c5f0c[_0xf0ea('0x9a')]){_0x35fbe1=ut[_0xf0ea('0xb5')](_0x20b2e4,0xf,'Global');rpcDb[_0xf0ea('0x8b')](_0x35fbe1,_0xf0ea('0xbe'));}else{if(_0x20b2e4[_0xf0ea('0xbb')]>=_0x4c5f0c[_0xf0ea('0xbf')]){rpcDb[_0xf0ea('0x8b')](_0x20b2e4,_0xf0ea('0xc0'));}else{rpcDb[_0xf0ea('0xb7')](ut[_0xf0ea('0x9f')](_0x20b2e4,'countnoanswerretry',_0x4c5f0c[_0xf0ea('0xc1')]),_0x20b2e4['unlockAgent'],_0x20b2e4['activeContact']);}}break;case _0xf0ea('0xc2'):_0x4c5f0c[_0xf0ea('0x3c')]+=0x1;_0x20b2e4[_0xf0ea('0xc3')]+=0x1;_0x20b2e4['countglobal']=ut['totalGlobal'](_0x20b2e4);ut['logCustomer'](_0x20b2e4,0x8,_0xf0ea('0xc4'));ami[_0xf0ea('0x5a')](_0xf0ea('0xc5'),ut[_0xf0ea('0x97')](_0x20b2e4,_0xf0ea('0xc6')));rpcDb[_0xf0ea('0x89')](_0x20b2e4,'[callProgressDetectingCustomer][logCongestion]');if(ut['totalGlobal'](_0x20b2e4)>=_0x4c5f0c[_0xf0ea('0x9a')]){_0x35fbe1=ut['cloneAction'](_0x20b2e4,0xf,_0xf0ea('0x9b'));rpcDb[_0xf0ea('0x8b')](_0x35fbe1,_0xf0ea('0xc7'));}else{if(_0x20b2e4[_0xf0ea('0xc3')]>=_0x4c5f0c['dialCongestionMaxRetry']){rpcDb[_0xf0ea('0x8b')](_0x20b2e4,_0xf0ea('0xc8'));}else{rpcDb[_0xf0ea('0xb7')](ut[_0xf0ea('0x9f')](_0x20b2e4,'countcongestionretry',_0x4c5f0c['dialBusyRetryFrequency']),_0x20b2e4['unlockAgent'],_0x20b2e4[_0xf0ea('0xa1')]);}}break;case _0xf0ea('0xc9'):_0x4c5f0c[_0xf0ea('0xca')]+=0x1;_0x20b2e4[_0xf0ea('0xcb')]+=0x1;_0x20b2e4[_0xf0ea('0x93')]=ut['totalGlobal'](_0x20b2e4);ut[_0xf0ea('0x84')](_0x20b2e4,0x14,_0xf0ea('0xcc'));ami[_0xf0ea('0x5a')](_0xf0ea('0xcd'),ut[_0xf0ea('0x97')](_0x20b2e4,_0xf0ea('0xce')));rpcDb[_0xf0ea('0x89')](_0x20b2e4,_0xf0ea('0xcf'));if(ut[_0xf0ea('0x94')](_0x20b2e4)>=_0x4c5f0c[_0xf0ea('0x9a')]){_0x35fbe1=ut[_0xf0ea('0xb5')](_0x20b2e4,0x14,_0xf0ea('0xcc'));rpcDb[_0xf0ea('0x8b')](_0x35fbe1,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x20b2e4[_0xf0ea('0xcb')]>=_0x4c5f0c['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x20b2e4,_0xf0ea('0xd0'));}else{rpcDb[_0xf0ea('0xb7')](ut[_0xf0ea('0x9f')](_0x20b2e4,_0xf0ea('0xcb'),_0x4c5f0c[_0xf0ea('0xd1')]),_0x20b2e4[_0xf0ea('0xba')],_0x20b2e4[_0xf0ea('0xa1')]);}}break;case _0xf0ea('0xd2'):_0x4c5f0c[_0xf0ea('0xd3')]+=0x1;_0x20b2e4[_0xf0ea('0xd4')]+=0x1;_0x20b2e4[_0xf0ea('0x93')]=ut[_0xf0ea('0x94')](_0x20b2e4);ut[_0xf0ea('0x84')](_0x20b2e4,0xb,_0xf0ea('0xd5'));rpcDb['createCustomerHistory'](_0x20b2e4,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x20b2e4)>=_0x4c5f0c[_0xf0ea('0x9a')]){_0x35fbe1=ut[_0xf0ea('0xb5')](_0x20b2e4,0xf,_0xf0ea('0x9b'));rpcDb[_0xf0ea('0x8b')](_0x35fbe1,_0xf0ea('0xd6'));}else{if(_0x20b2e4[_0xf0ea('0xd7')]>=_0x4c5f0c[_0xf0ea('0xd8')]){rpcDb[_0xf0ea('0x8b')](_0x20b2e4,_0xf0ea('0xd6'));}else{rpcDb[_0xf0ea('0xb7')](ut[_0xf0ea('0x9f')](_0x20b2e4,_0xf0ea('0xd4'),_0x4c5f0c[_0xf0ea('0xd9')]),_0x20b2e4[_0xf0ea('0xba')],_0x20b2e4[_0xf0ea('0xa1')]);}}break;case'18':_0x4c5f0c[_0xf0ea('0x42')]+=0x1;_0x20b2e4[_0xf0ea('0xda')]+=0x1;_0x20b2e4[_0xf0ea('0x93')]=ut[_0xf0ea('0x94')](_0x20b2e4);ut[_0xf0ea('0x84')](_0x20b2e4,0x12,_0x3ba54b[_0xf0ea('0xdb')]||_0x3ba54b[_0xf0ea('0xdc')]);ami['emit'](_0xf0ea('0xdd'),ut[_0xf0ea('0x97')](_0x20b2e4,_0xf0ea('0xde')));rpcDb['createCustomerHistory'](_0x20b2e4,_0xf0ea('0xdf'));if(ut['totalGlobal'](_0x20b2e4)>=_0x4c5f0c[_0xf0ea('0x9a')]){_0x35fbe1=ut[_0xf0ea('0xb5')](_0x20b2e4,0xf,_0xf0ea('0x9b'));rpcDb['createCustomerFinal'](_0x35fbe1,_0xf0ea('0xdf'));}else{rpcDb['createCustomerFinal'](_0x20b2e4,_0xf0ea('0xdf'));}delete this[_0xf0ea('0x15')][_0x3ba54b[_0xf0ea('0xe0')]];break;case'19':_0x4c5f0c[_0xf0ea('0x42')]+=0x1;_0x20b2e4[_0xf0ea('0x93')]=ut[_0xf0ea('0x94')](_0x20b2e4);ut['logCustomer'](_0x20b2e4,0x13,_0x3ba54b[_0xf0ea('0xdb')]||_0x3ba54b['dialstatus']);ami['emit']('custom:amd',ut[_0xf0ea('0x97')](_0x20b2e4,_0xf0ea('0xde')));rpcDb[_0xf0ea('0x89')](_0x20b2e4,_0xf0ea('0xe1'));if(ut['totalGlobal'](_0x20b2e4)>=_0x4c5f0c[_0xf0ea('0x9a')]){_0x35fbe1=ut[_0xf0ea('0xb5')](_0x20b2e4,0xf,'Global');rpcDb[_0xf0ea('0x8b')](_0x35fbe1,_0xf0ea('0xe1'));}else{rpcDb[_0xf0ea('0x8b')](_0x20b2e4,_0xf0ea('0xe1'));}delete this[_0xf0ea('0x15')][_0x3ba54b[_0xf0ea('0xe0')]];break;default:if(_0x20b2e4['dialAnswer']){ut[_0xf0ea('0x73')](_0x4c5f0c,'[default]');ut['loggerError'](_0xf0ea('0xe2')+_0x4c5f0c[_0xf0ea('0x28')],_0x3ba54b);}_0x4c5f0c[_0xf0ea('0x42')]+=0x1;_0x20b2e4[_0xf0ea('0x93')]=ut[_0xf0ea('0x94')](_0x20b2e4);ut[_0xf0ea('0x84')](_0x20b2e4,0xc,_0x3ba54b[_0xf0ea('0xdb')]||_0x3ba54b[_0xf0ea('0xdc')]);rpcDb[_0xf0ea('0x89')](_0x20b2e4,_0xf0ea('0xe3'));if(ut[_0xf0ea('0x94')](_0x20b2e4)>=_0x4c5f0c[_0xf0ea('0x9a')]){_0x35fbe1=ut[_0xf0ea('0xb5')](_0x20b2e4,0xf,_0xf0ea('0x9b'));rpcDb['createCustomerFinal'](_0x35fbe1,_0xf0ea('0xe4'));}else{rpcDb[_0xf0ea('0x8b')](_0x20b2e4,_0xf0ea('0xe4'));}delete this[_0xf0ea('0x15')][_0x3ba54b[_0xf0ea('0xe0')]];}if(!(_0x20b2e4['dialAnswer']&&_0x10794d==='16')){ut[_0xf0ea('0x71')](_0x4c5f0c,'[callProgressDetectingCustomer]');logger[_0xf0ea('0x58')](_0xf0ea('0xe5'),_0x20b2e4['uniqueid'],_0xf0ea('0xa7'),_0x4c5f0c[_0xf0ea('0x28')],_0xf0ea('0x69'),_0x4c5f0c[_0xf0ea('0x4d')]);}if(_0x10794d!==_0xf0ea('0xa2')){delete this[_0xf0ea('0x15')][_0x3ba54b[_0xf0ea('0xe0')]];delete this[_0xf0ea('0x15')][_0x3ba54b[_0xf0ea('0xe6')]];}}};Preview[_0xf0ea('0xf')][_0xf0ea('0xe7')]=function(_0x2ee317,_0x29a29d,_0xaa43da){if(_['isUndefined'](_0x29a29d)&&'object'!==typeof _0x29a29d){return;}if(_[_0xf0ea('0xe8')](_0xaa43da)&&_0xf0ea('0xe9')!==typeof _0xaa43da){return;}switch(_0xaa43da[_0xf0ea('0xea')]){case'0':ut['logAgent'](_0x2ee317,0x0,_0xf0ea('0x95'));rpcDb[_0xf0ea('0xeb')](_0x2ee317,_0xf0ea('0xec'));break;case'3':ut[_0xf0ea('0xed')](_0x2ee317,0x3,_0xf0ea('0xbc'));rpcDb['createAgentHistory'](_0x2ee317,_0xf0ea('0xee'));break;case'5':ut[_0xf0ea('0xed')](_0x2ee317,0x5,'Busy');rpcDb[_0xf0ea('0xeb')](_0x2ee317,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xf0ea('0xed')](_0x2ee317,0x8,'Congestion');rpcDb[_0xf0ea('0xeb')](_0x2ee317,_0xf0ea('0xef'));break;case'22':ut[_0xf0ea('0xed')](_0x2ee317,0x16,_0xf0ea('0xf0'));rpcDb[_0xf0ea('0xeb')](_0x2ee317,_0xf0ea('0xf1'));break;default:ut[_0xf0ea('0xed')](_0x2ee317,0xc,_0xaa43da[_0xf0ea('0xea')]);rpcDb[_0xf0ea('0xeb')](_0x2ee317,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x29a29d,_0xf0ea('0xf2'));logger['info'](_0xf0ea('0xf3'),_0x2ee317[_0xf0ea('0xa6')],_0xf0ea('0xa7'),_0x29a29d[_0xf0ea('0x28')],_0xf0ea('0x69'),_0x29a29d[_0xf0ea('0x4d')]);delete this[_0xf0ea('0x15')][_0x2ee317[_0xf0ea('0xa6')]];};Preview[_0xf0ea('0xf')][_0xf0ea('0xf4')]=function(_0xac9496,_0x29989f,_0x2cbb9a,_0x188620,_0x3abcab){var _0x382926=this;return new BPromise(function(_0x372801,_0x4da2e3){if(_[_0xf0ea('0x66')](_0x29989f)||_[_0xf0ea('0x66')](_0x29989f[_0xf0ea('0xf5')])||_[_0xf0ea('0x66')](_0x29989f[_0xf0ea('0xf5')]['phone'])||_[_0xf0ea('0x66')](_0x29989f['VoiceQueueId'])){_0x4da2e3(ut[_0xf0ea('0x5b')]('Contact\x20is\x20undefined',_0x188620,_0x3abcab));return;}var _0x56f3d6=uuid['v4']();var _0xc1abda=_0x382926[_0xf0ea('0x26')][_0x29989f['Queue'][_0xf0ea('0x28')]];var _0x38ff0f=_0x2cbb9a?_0x382926[_0xf0ea('0x16')][_0x2cbb9a]['id']:undefined;_0x382926[_0xf0ea('0x15')][_0x56f3d6]=new Action(_0x29989f,_0xc1abda,_0x56f3d6,_0x2cbb9a,_0x38ff0f);var _0x37b391=_0x382926[_0xf0ea('0x15')][_0x56f3d6];_0x37b391[_0xf0ea('0xba')]=_0x188620;_0x37b391['activeContact']=_0x3abcab;_0x37b391[_0xf0ea('0xf6')]=_0x2cbb9a;if(_[_0xf0ea('0xf7')](_0xac9496)){_0x382926[_0xf0ea('0xf8')](_0x37b391,_0xc1abda,_0x29989f,_0x2cbb9a)['then'](function(_0x53028e){logger[_0xf0ea('0x58')]('[Preview][execCall][success]',_0xf0ea('0xf9')+_0x37b391[_0xf0ea('0x68')]+_0xf0ea('0xfa')+_0x37b391['idContact'],JSON[_0xf0ea('0x55')](_0x53028e));ami['emit'](_0xf0ea('0xfb'),ut[_0xf0ea('0x97')](_0x37b391,_0xf0ea('0xfc'),_0x382926[_0xf0ea('0x26')][_0x37b391['queue']]));_0x372801(ut['message'](_0xf0ea('0xfd')));})[_0xf0ea('0x70')](function(_0x133df5){ut[_0xf0ea('0x5d')]('[Preview][execCall][failure]',_0x133df5);_0x4da2e3(ut['message'](_0xf0ea('0xfe'),_0x188620,_0x3abcab));});}else{_0xc1abda[_0xf0ea('0xff')]+=0x1;ut[_0xf0ea('0x100')](_0x37b391);rpcDb[_0xf0ea('0x101')](_0x37b391,_0xf0ea('0x102'));delete _0x382926[_0xf0ea('0x15')][_0x56f3d6];_0x4da2e3(ut['message'](_0xf0ea('0x103'),_0x188620,_0x3abcab));}});};Preview[_0xf0ea('0xf')][_0xf0ea('0x8e')]=function(_0x4bd82e){return!_['isNil'](_0x4bd82e)&&!_['isNil'](_0x4bd82e[_0xf0ea('0x28')])&&!_[_0xf0ea('0x66')](_0x4bd82e[_0xf0ea('0x53')])&&_0x4bd82e[_0xf0ea('0x53')]&&!_[_0xf0ea('0x66')](this[_0xf0ea('0x14')][util['format']('SIP/%s',_0x4bd82e[_0xf0ea('0x28')])])&&!_[_0xf0ea('0x66')](this['trunks'][util[_0xf0ea('0x56')]('SIP/%s',_0x4bd82e[_0xf0ea('0x28')])]['status'])&&(this[_0xf0ea('0x14')][util['format'](_0xf0ea('0x104'),_0x4bd82e['name'])][_0xf0ea('0x105')]===_0xf0ea('0x106')||this[_0xf0ea('0x14')][util[_0xf0ea('0x56')](_0xf0ea('0x104'),_0x4bd82e[_0xf0ea('0x28')])][_0xf0ea('0x105')]===_0xf0ea('0x107'));};Preview['prototype']['run']=function(_0x1ae99a,_0x11579b){var _0x200d47=this;return new BPromise(function(_0x4f8b59,_0x434bba){_0x200d47[_0xf0ea('0x108')](_0x1ae99a,_0x11579b)[_0xf0ea('0x80')](function(_0x5a406d){_0x4f8b59(_[_0xf0ea('0x6b')](_0x5a406d,['message']));})[_0xf0ea('0x70')](function(_0x10b96f){if(_0x10b96f[_0xf0ea('0x109')]){rpcDb[_0xf0ea('0x10a')](_0x1ae99a);}if(_0x10b96f[_0xf0ea('0x53')]){rpcDb[_0xf0ea('0x10b')](_0x1ae99a);}_0x434bba(_[_0xf0ea('0x6b')](_0x10b96f,[_0xf0ea('0x5b')]));});});};Preview[_0xf0ea('0xf')][_0xf0ea('0x108')]=function(_0x27d3d7,_0x5ad8e1){var _0x12bcd9=this;return new BPromise(function(_0x11769b,_0x3c9ec4){var _0xbbc2cb,_0x4e80aa;rpcDb[_0xf0ea('0x10c')](_0x27d3d7)[_0xf0ea('0x80')](function(_0x5dfbfa){if(!_[_0xf0ea('0x66')](_0x5dfbfa[0x0])){_0x4e80aa=_0x5dfbfa[0x0][_0xf0ea('0x10d')]?![]:!![];_0xbbc2cb=_0x5dfbfa[0x0][_0xf0ea('0x10d')]?!![]:![];_0xbbc2cb=_0x5ad8e1?!![]:_0xbbc2cb;}var _0x48f8d7=_0x12bcd9[_0xf0ea('0x10e')](_0x5dfbfa);if(_0x48f8d7[_0xf0ea('0x10f')]){rpcDb[_0xf0ea('0x110')](_[_0xf0ea('0x6b')](_0x5dfbfa[0x0],[_0xf0ea('0x6e'),_0xf0ea('0x111')]))[_0xf0ea('0x80')](function(_0x32666d){_0x12bcd9[_0xf0ea('0xf4')](_0x32666d,_0x5dfbfa[0x0],_0x5ad8e1,_0x4e80aa,_0xbbc2cb)['then'](function(_0x3d07fc){_0x11769b(_0x3d07fc);})[_0xf0ea('0x70')](function(_0x2d832a){_0x3c9ec4(_0x2d832a);});})[_0xf0ea('0x70')](function(_0x35fd30){ut[_0xf0ea('0x5d')]('[Preview][checkIsBlackList]',_0x35fd30);_0x3c9ec4(ut[_0xf0ea('0x5b')](_0xf0ea('0x112'),_0x4e80aa,_0xbbc2cb));});}else{_0x3c9ec4(ut['message'](_0x48f8d7[_0xf0ea('0x5b')],_0x4e80aa,_0xbbc2cb));}})[_0xf0ea('0x70')](function(_0xfe3acd){ut['logger'](_0xf0ea('0x113'),_0xfe3acd);_0x3c9ec4(ut[_0xf0ea('0x5b')](_0xf0ea('0x112'),![],!![]));});});};Preview[_0xf0ea('0xf')]['validateContact']=function(_0x40743a){if(_[_0xf0ea('0x66')](_0x40743a)||_[_0xf0ea('0xf7')](_0x40743a)||!_[_0xf0ea('0x66')](_0x40743a[0x0]['Agent'])&&_[_0xf0ea('0x66')](_0x40743a[0x0][_0xf0ea('0x7f')][_0xf0ea('0x28')])){ut[_0xf0ea('0x5d')](_0xf0ea('0x114'),_0x40743a);return{'isValid':![],'message':_0xf0ea('0x115')};}var _0x556d25=this[_0xf0ea('0x26')][_0x40743a[0x0]['Queue']['name']];_0x556d25[_0xf0ea('0x5b')]=_0xf0ea('0x90');if(_[_0xf0ea('0x66')](_0x556d25)){ut[_0xf0ea('0x5d')](_0xf0ea('0x116'),_0x556d25);return{'isValid':![],'message':_0xf0ea('0x117')};}if(!this[_0xf0ea('0x8e')](_0x556d25['Trunk'])){ut[_0xf0ea('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x556d25[_0xf0ea('0x28')]+_0xf0ea('0x118'));if(!this['isTrunkReachable'](_0x556d25[_0xf0ea('0x8f')])){ut[_0xf0ea('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x556d25[_0xf0ea('0x28')]+_0xf0ea('0x119'));return{'isValid':![],'message':_0xf0ea('0x11a')};}}if(!ut[_0xf0ea('0x11b')](_0x556d25[_0xf0ea('0x34')])){ut[_0xf0ea('0x5d')](_0xf0ea('0x11c'),_0x556d25[_0xf0ea('0x28')]+_0xf0ea('0x11d'));return{'isValid':![],'message':_0xf0ea('0x11e')+_0x556d25['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xf0ea('0x11f')};};Preview['prototype'][_0xf0ea('0xf8')]=function(_0x260704,_0x43ca28,_0x47b24e,_0x1107af){var _0x45b019=this;return new BPromise(function(_0x801894,_0x5d0081){var _0x21b66b=_0x260704[_0xf0ea('0xa6')];var _0x10121f=_0x45b019[_0xf0ea('0x8e')](_0x43ca28['Trunk'])?util[_0xf0ea('0x56')](_0xf0ea('0x120'),_0x43ca28['Trunk'][_0xf0ea('0x28')],_['isNil'](_0x43ca28[_0xf0ea('0x38')])?'':_0x43ca28[_0xf0ea('0x38')][_0xf0ea('0x121')]()||'',_0x43ca28[_0xf0ea('0x122')]>0x0?_0x47b24e[_0xf0ea('0xf5')][_0xf0ea('0x123')]['substring'](_0x43ca28[_0xf0ea('0x122')]):_0x47b24e['Contact'][_0xf0ea('0x123')]):util[_0xf0ea('0x56')](_0xf0ea('0x120'),_[_0xf0ea('0x66')](_0x43ca28[_0xf0ea('0x8f')])?_0x43ca28[_0xf0ea('0x52')]['name']:_0x43ca28[_0xf0ea('0x8f')][_0xf0ea('0x28')],_[_0xf0ea('0x66')](_0x43ca28['dialPrefix'])?'':_0x43ca28[_0xf0ea('0x38')]['trim']()||'',_0x43ca28[_0xf0ea('0x122')]>0x0?_0x47b24e[_0xf0ea('0xf5')]['phone'][_0xf0ea('0x124')](_0x43ca28[_0xf0ea('0x122')]):_0x47b24e[_0xf0ea('0xf5')][_0xf0ea('0x123')]);var _0x569ad3=_0x45b019['isTrunkReachable'](_0x43ca28[_0xf0ea('0x52')])?ut[_0xf0ea('0x125')](_0x43ca28['Trunk'][_0xf0ea('0x126')],_0x43ca28[_0xf0ea('0x35')],_0x43ca28[_0xf0ea('0x127')]>0x0?ut[_0xf0ea('0x128')](_0x43ca28[_0xf0ea('0x36')],_0x43ca28[_0xf0ea('0x127')]):_0x43ca28[_0xf0ea('0x36')]):ut[_0xf0ea('0x125')](_[_0xf0ea('0x66')](_0x43ca28[_0xf0ea('0x8f')])?_0x43ca28['Trunk']['callerid']:_0x43ca28[_0xf0ea('0x8f')][_0xf0ea('0x126')],_0x43ca28[_0xf0ea('0x35')],_0x43ca28[_0xf0ea('0x127')]>0x0?ut[_0xf0ea('0x128')](_0x43ca28['dialOriginateCallerIdNumber'],_0x43ca28[_0xf0ea('0x127')]):_0x43ca28[_0xf0ea('0x36')]);if(_0x569ad3){_0x260704[_0xf0ea('0x129')]=ut[_0xf0ea('0x12a')](_0x569ad3);_0x260704[_0xf0ea('0x12b')]=ut['extractCalleridNumber'](_0x569ad3);}var _0x2bc98c=ut[_0xf0ea('0x12c')](_0x43ca28,_0x47b24e,_0x10121f,_0x569ad3,_0x21b66b,_0x260704);_[_0xf0ea('0x12d')](_0x260704,ut['toLowerVariables'](_0x2bc98c));_0x260704[_0xf0ea('0x12e')]=moment()[_0xf0ea('0x56')](_0xf0ea('0x83'));ami[_0xf0ea('0x12f')](ut['variablesAction'](_0x260704,_0x43ca28,_0x2bc98c,_0x260704['activeContact'],_0x1107af))[_0xf0ea('0x80')](function(_0x51a4f0){var _0xe3cb9b=_0x260704[_0xf0ea('0x130')];if(!_['isNil'](_0xe3cb9b)){if(!_['isNil'](_0x45b019['agents'][_0xe3cb9b])){_0x45b019[_0xf0ea('0x16')][_0xe3cb9b]['destconnectedlinenum']=_0x260704[_0xf0ea('0x131')];emit(util[_0xf0ea('0x56')](_0xf0ea('0x132'),_0x45b019[_0xf0ea('0x16')][_0xe3cb9b][_0xf0ea('0x28')]),_0xf0ea('0x133'),{'destaccountcode':_0x45b019['agents'][_0xe3cb9b][_0xf0ea('0x134')],'destconnectedlinenum':_0x260704[_0xf0ea('0x131')]});}}_0x43ca28['originated']+=0x1;logger[_0xf0ea('0x58')](_0xf0ea('0x135'),_0x21b66b,_0xf0ea('0xa7'),_0x43ca28[_0xf0ea('0x28')],'originated:\x20',_0x43ca28[_0xf0ea('0x4d')]);_0x801894(_0x51a4f0);})[_0xf0ea('0x70')](function(_0x1c781b){ut['logAgent'](_0x260704,0xe,_0xf0ea('0x136'));rpcDb[_0xf0ea('0xeb')](_0x260704,'[originateFailure][logOriginateFailure]');_0x5d0081(_0x1c781b);});});};Preview['prototype'][_0xf0ea('0x21')]=function(_0x544a33){if(this['actions'][_0x544a33[_0xf0ea('0xe0')]]){this[_0xf0ea('0x15')][_0x544a33[_0xf0ea('0xe0')]]['channel']=_0x544a33['channel'];}};Preview['prototype'][_0xf0ea('0x19')]=function(_0x2162e9){var _0x2e7dd4=this;var _0x5d3ab5=this[_0xf0ea('0x15')][_0x2162e9['actionid']];if(_0x5d3ab5){if(_0x5d3ab5['lookAgent']&&this[_0xf0ea('0x16')][_0x5d3ab5['lookAgent']]){ut['logLookAgent'](_0x5d3ab5,this[_0xf0ea('0x16')][_0x5d3ab5['lookAgent']][_0xf0ea('0x28')],this[_0xf0ea('0x16')][_0x5d3ab5[_0xf0ea('0xf6')]]['id']);}var _0x2cb613=_[_0xf0ea('0x137')](_0x5d3ab5);_0x2cb613[_0xf0ea('0xa3')]=moment()['format'](_0xf0ea('0x83'));var _0x4a0508=_0x2e7dd4['campaignsPreview'][_0x5d3ab5['queue']];if(ut[_0xf0ea('0x138')](_0x2162e9[_0xf0ea('0x139')])){if(_0x5d3ab5[_0xf0ea('0xba')]){rpcDb[_0xf0ea('0x10a')](_0x5d3ab5[_0xf0ea('0x13a')]);}if(_0x5d3ab5['activeContact']){rpcDb[_0xf0ea('0x10b')](_0x5d3ab5[_0xf0ea('0x13a')]);}ami[_0xf0ea('0x5a')](_0xf0ea('0x13b'),ut[_0xf0ea('0x97')](_0x5d3ab5,_0xf0ea('0x13c'),this[_0xf0ea('0x26')][_0x5d3ab5[_0xf0ea('0x68')]]));this[_0xf0ea('0xe7')](_0x2cb613,_0x4a0508,_0x2162e9);}else{_0x5d3ab5[_0xf0ea('0x12e')]=moment()[_0xf0ea('0x56')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xf0ea('0xed')](_0x2cb613,0x4,_0xf0ea('0xae'));rpcDb['createAgentHistory'](_0x2cb613,_0xf0ea('0x13d'));}}};Preview[_0xf0ea('0xf')]['syncHangup']=function(_0x3ea433){var _0x151ef4=this;var _0x2e2118=this[_0xf0ea('0x15')][_0x3ea433[_0xf0ea('0xe0')]];var _0x2fde2d;if(_0x2e2118){_0x2fde2d=this[_0xf0ea('0x26')][_0x2e2118[_0xf0ea('0x68')]];logger[_0xf0ea('0x58')](_0xf0ea('0x13e'),_0x3ea433[_0xf0ea('0xe0')],'\x20Queue',_0x2fde2d[_0xf0ea('0x28')],_0xf0ea('0x6a'),_0x2fde2d['pTalking']);}if(this['actions'][_0x3ea433['linkedid']]&&_0x3ea433[_0xf0ea('0xe0')]!==_0x3ea433[_0xf0ea('0xa6')]){if(_0x3ea433[_0xf0ea('0x13f')]==='16'&&this[_0xf0ea('0x15')][_0x3ea433[_0xf0ea('0xe0')]][_0xf0ea('0x72')]){this[_0xf0ea('0x91')](_0x3ea433,_0x3ea433[_0xf0ea('0xe0')],_0x3ea433[_0xf0ea('0x13f')]);}else if(this[_0xf0ea('0x15')][_0x3ea433[_0xf0ea('0xe0')]]['dialAnswer']){logger[_0xf0ea('0x58')]('[syncHangup][talking][cause]',_0x3ea433[_0xf0ea('0xe0')],_0x3ea433[_0xf0ea('0x13f')],_0xf0ea('0xa7'),_0x2fde2d[_0xf0ea('0x28')],_0xf0ea('0x6a'),_0x2fde2d['pTalking']);this[_0xf0ea('0x91')](_0x3ea433,_0x3ea433['linkedid'],_0x3ea433[_0xf0ea('0x13f')]);}}else if(_0x2e2118&&_['isNil'](_0x2e2118[_0xf0ea('0x140')])&&_0x2fde2d[_0xf0ea('0x141')]&&_0x3ea433[_0xf0ea('0xe0')]===_0x3ea433[_0xf0ea('0xa6')]&&_[_0xf0ea('0x66')](_0x3ea433[_0xf0ea('0xea')])&&_0x3ea433['cause']==='16'&&_0x3ea433[_0xf0ea('0x142')]==='6'&&_[_0xf0ea('0xe8')](_0x2e2118[_0xf0ea('0x143')])){if(_0x2e2118['unlockAgent']){rpcDb[_0xf0ea('0x10a')](_0x2e2118[_0xf0ea('0x13a')]);}if(_0x2e2118[_0xf0ea('0xa1')]){rpcDb['disableContact'](_0x2e2118[_0xf0ea('0x13a')]);}_0x3ea433['reason']='22';this['callProgressDetectingAgent'](_0x2e2118,_0x2fde2d,_0x3ea433);}else if(_0x2e2118&&_0x2e2118['transfer']){if(_0x3ea433[_0xf0ea('0x13f')]==='16'&&this[_0xf0ea('0x15')][_0x3ea433[_0xf0ea('0xe0')]][_0xf0ea('0x72')]){logger['info'](_0xf0ea('0x144'),_0x3ea433[_0xf0ea('0xe0')],_0x3ea433[_0xf0ea('0x13f')],_0xf0ea('0xa7'),_0x2fde2d[_0xf0ea('0x28')],'pTalking:\x20',_0x2fde2d[_0xf0ea('0x2d')]);this['callProgressDetectingCustomer'](_0x3ea433,_0x3ea433[_0xf0ea('0xe0')],_0x3ea433[_0xf0ea('0x13f')]);}else if(this['actions'][_0x3ea433[_0xf0ea('0xe0')]][_0xf0ea('0x72')]){logger[_0xf0ea('0x58')](_0xf0ea('0x145'),_0x3ea433[_0xf0ea('0xe0')],_0x3ea433['cause'],_0xf0ea('0xa7'),_0x2fde2d[_0xf0ea('0x28')],_0xf0ea('0x6a'),_0x2fde2d[_0xf0ea('0x2d')]);this[_0xf0ea('0x91')](_0x3ea433,_0x3ea433['linkedid'],_0x3ea433[_0xf0ea('0x13f')]);}}};Preview[_0xf0ea('0xf')][_0xf0ea('0x146')]=function(_0x1e20a3){if(this[_0xf0ea('0x15')][_0x1e20a3[_0xf0ea('0xe6')]]&&_0x1e20a3[_0xf0ea('0xe6')]!==_0x1e20a3[_0xf0ea('0x147')]){this[_0xf0ea('0x91')](_0x1e20a3,_0x1e20a3[_0xf0ea('0xe6')],_0x1e20a3[_0xf0ea('0xdc')]);}};Preview[_0xf0ea('0xf')][_0xf0ea('0x1e')]=function(_0x460d7b){if(this[_0xf0ea('0x15')][_0x460d7b[_0xf0ea('0xe0')]]&&_0x460d7b[_0xf0ea('0xe0')]!==_0x460d7b['uniqueid']&&!this[_0xf0ea('0x15')][_0x460d7b[_0xf0ea('0xe0')]][_0xf0ea('0x72')]){if(_0x460d7b[_0xf0ea('0x13f')]==='1'){this[_0xf0ea('0x91')](_0x460d7b,_0x460d7b[_0xf0ea('0xe0')],_0x460d7b[_0xf0ea('0x13f')]);}}};Preview[_0xf0ea('0xf')][_0xf0ea('0x148')]=function(_0x44d919,_0x592492,_0x5146af){if(this['actions'][_0x44d919]){if(_[_0xf0ea('0x66')](this[_0xf0ea('0x15')][_0x44d919][_0xf0ea('0x149')])){this[_0xf0ea('0x15')][_0x44d919]['variables']={};}this['actions'][_0x44d919][_0xf0ea('0x149')][_0x592492]=_0x5146af;}};Preview[_0xf0ea('0xf')][_0xf0ea('0x14a')]=function(_0x257d89){try{if(!_['isNil'](_0x257d89)){if(ut['filterKey'](_['keys'](_0x257d89['variable'])[0x0])){this['addVariable'](_0x257d89[_0xf0ea('0xa6')],_[_0xf0ea('0x14b')](_0x257d89['variable'])[0x0],_0x257d89[_0xf0ea('0x14c')]);}}}catch(_0x4f5482){logger[_0xf0ea('0x14d')](_0xf0ea('0x14e'),util[_0xf0ea('0x14f')](_0x4f5482,{'showHidden':![],'depth':null}));}};Preview[_0xf0ea('0xf')][_0xf0ea('0x23')]=function(_0x257fac){if(_0x257fac){if(this[_0xf0ea('0x15')][_0x257fac[_0xf0ea('0x150')]]){this['actions'][_0x257fac[_0xf0ea('0x150')]][_0xf0ea('0x143')]=!![];}}};Preview[_0xf0ea('0xf')]['syncBlindTransfer']=function(_0x85737f){if(_0x85737f){if(this[_0xf0ea('0x15')][_0x85737f['transfererlinkedid']]){this[_0xf0ea('0x15')][_0x85737f[_0xf0ea('0x151')]][_0xf0ea('0x143')]=!![];}}};module[_0xf0ea('0x152')]=Preview; \ No newline at end of file +var _0x63db=['[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','updateOriginated','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','pick','unlock','unlockContact','execRun','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Queue','[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','Is\x20Valid','trim','dialCutDigit','Contact','substring','SIP/%s/%s%s','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','type','outbound','name','strategy','available','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','actions','originated:\x20','queue','pTalking','dialAnswer','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','linkedid','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','object','reason','createAgentHistory','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x63db,0x68));var _0xb63d=function(_0x4ef921,_0x31cc9d){_0x4ef921=_0x4ef921-0x0;var _0x4766e1=_0x63db[_0x4ef921];return _0x4766e1;};'use strict';var util=require(_0xb63d('0x0'));var _=require(_0xb63d('0x1'));var BPromise=require(_0xb63d('0x2'));var uuid=require(_0xb63d('0x3'));var moment=require(_0xb63d('0x4'));var md5=require(_0xb63d('0x5'));var Redis=require(_0xb63d('0x6'));var config=require(_0xb63d('0x7'));var logger=require(_0xb63d('0x8'))('preview');var loggerAction=require(_0xb63d('0x8'))(_0xb63d('0x9'));var ami=require('../ami');var rpcDb=require(_0xb63d('0xa'));var Action=require(_0xb63d('0xb'));var ut=require('./util/util');config[_0xb63d('0xc')]=_[_0xb63d('0xd')](config[_0xb63d('0xc')],{'host':_0xb63d('0xe'),'port':0x18eb});var io=require(_0xb63d('0xf'))(new Redis(config[_0xb63d('0xc')]));var Sequence=function(){};Sequence[_0xb63d('0x10')]['enqueue']=function(_0x2c304d){this['tail']=this[_0xb63d('0x11')]?this[_0xb63d('0x11')][_0xb63d('0x12')](_0x2c304d):_0x2c304d();};function Preview(_0x5a5062){this['sequence']=new Sequence();this[_0xb63d('0x13')]=_0x5a5062['voiceQueues'];this['trunks']=_0x5a5062[_0xb63d('0x14')];this['actions']={};this['agents']=_0x5a5062[_0xb63d('0x15')];this[_0xb63d('0x16')]=0x0;ami['on'](_0xb63d('0x17'),this[_0xb63d('0x18')][_0xb63d('0x19')](this));ami['on'](_0xb63d('0x1a'),this[_0xb63d('0x1b')][_0xb63d('0x19')](this));ami['on'](_0xb63d('0x1c'),this[_0xb63d('0x1d')]['bind'](this));ami['on'](_0xb63d('0x1e'),this[_0xb63d('0x1f')][_0xb63d('0x19')](this));ami['on']('newexten',this['syncNewExten'][_0xb63d('0x19')](this));ami['on']('varset',this[_0xb63d('0x20')][_0xb63d('0x19')](this));ami['on'](_0xb63d('0x21'),this[_0xb63d('0x22')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xb63d('0x19')](this));this[_0xb63d('0x23')](this[_0xb63d('0x13')]);}function emit(_0x482fc8,_0x405e46,_0x4a8720){io['to'](_0x482fc8)['emit'](_0x405e46,_0x4a8720);}function emitCampaignPreview(_0x3ef562){if(_0x3ef562[_0xb63d('0x24')]===_0xb63d('0x25')){var _0x664d37={'id':_0x3ef562['id'],'name':_0x3ef562[_0xb63d('0x26')],'strategy':_0x3ef562[_0xb63d('0x27')],'answered':_0x3ef562['answered'],'available':_0x3ef562[_0xb63d('0x28')],'loggedIn':_0x3ef562[_0xb63d('0x29')],'pTalking':_0x3ef562['pTalking'],'sumBillable':_0x3ef562['sumBillable'],'sumDuration':_0x3ef562[_0xb63d('0x2a')],'sumHoldTime':_0x3ef562[_0xb63d('0x2b')]||0x0,'talking':_0x3ef562[_0xb63d('0x2c')],'total':_0x3ef562[_0xb63d('0x2d')],'type':_0x3ef562[_0xb63d('0x24')],'unmanaged':_0x3ef562[_0xb63d('0x2e')],'abandoned':_0x3ef562[_0xb63d('0x2f')],'waiting':_0x3ef562[_0xb63d('0x30')],'loggedInDb':_0x3ef562[_0xb63d('0x31')],'dialActive':_0x3ef562[_0xb63d('0x32')],'dialMethod':_0x3ef562[_0xb63d('0x33')],'dialOriginateCallerIdName':_0x3ef562[_0xb63d('0x34')],'dialOriginateCallerIdNumber':_0x3ef562[_0xb63d('0x35')],'dialOriginateTimeout':_0x3ef562[_0xb63d('0x36')],'dialPrefix':_0x3ef562[_0xb63d('0x37')],'outboundAnswerAgiCallsDay':_0x3ef562[_0xb63d('0x38')],'outboundAnswerCallsDay':_0x3ef562['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3ef562[_0xb63d('0x39')],'outboundBusyCallsDay':_0x3ef562[_0xb63d('0x3a')],'outboundCongestionCallsDay':_0x3ef562[_0xb63d('0x3b')],'outboundDropCallsDayACS':_0x3ef562[_0xb63d('0x3c')],'outboundDropCallsDayCallersExit':_0x3ef562[_0xb63d('0x3d')],'outboundDropCallsDayTimeout':_0x3ef562['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3ef562[_0xb63d('0x3e')],'outboundNoSuchCallsDay':_0x3ef562[_0xb63d('0x3f')],'outboundOriginateFailureCallsDay':_0x3ef562[_0xb63d('0x40')],'outboundReCallsDay':_0x3ef562['outboundReCallsDay'],'outboundRejectCallsDay':_0x3ef562[_0xb63d('0x41')],'outboundUnknownCallsDay':_0x3ef562['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x3ef562[_0xb63d('0x42')],'predictiveIntervalAnsweredCalls':_0x3ef562[_0xb63d('0x43')],'predictiveIntervalAvgHoldtime':_0x3ef562[_0xb63d('0x44')],'predictiveIntervalAvgTalktime':_0x3ef562[_0xb63d('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x3ef562[_0xb63d('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x3ef562[_0xb63d('0x47')],'predictiveIntervalErlangCalls':_0x3ef562['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3ef562[_0xb63d('0x48')],'predictiveIntervalHitRate':_0x3ef562[_0xb63d('0x49')],'predictiveIntervalMultiplicativeFactor':_0x3ef562[_0xb63d('0x4a')],'predictiveIntervalPauses':_0x3ef562['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3ef562['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3ef562['predictiveIntervalTotalCalls'],'message':_0x3ef562['message'],'originated':_0x3ef562['originated'],'erlangCalls':_0x3ef562[_0xb63d('0x4b')],'erlangCallToSecond':_0x3ef562['erlangCallToSecond'],'erlangAbandonmentRate':_0x3ef562[_0xb63d('0x4c')],'erlangBusyFactor':_0x3ef562[_0xb63d('0x4d')],'startPredictive':_0x3ef562[_0xb63d('0x4e')],'startProgressive':_0x3ef562[_0xb63d('0x4f')]};if(_0x3ef562['Trunk']){_0x664d37[_0xb63d('0x50')]={'id':_0x3ef562[_0xb63d('0x50')]['id'],'name':_0x3ef562[_0xb63d('0x50')][_0xb63d('0x26')],'active':_0x3ef562[_0xb63d('0x50')][_0xb63d('0x51')],'callerid':_0x3ef562[_0xb63d('0x50')][_0xb63d('0x52')]};}if(_0x3ef562[_0xb63d('0x53')]){_0x664d37['Interval']={'id':_0x3ef562[_0xb63d('0x53')]['id'],'name':_0x3ef562['Interval'][_0xb63d('0x26')]};}var _0x1508d5=md5(JSON['stringify'](_0x664d37));if(_0x3ef562['md5']!==_0x1508d5){_0x3ef562['md5']=_0x1508d5;emit(util['format'](_0xb63d('0x54'),_0x664d37[_0xb63d('0x26')]),_0xb63d('0x55'),_0x664d37);}}}function emitVoiceQueueChannelRemove(_0x54176e){logger[_0xb63d('0x56')](_0xb63d('0x57'),JSON[_0xb63d('0x58')](_0x54176e));emit(util[_0xb63d('0x59')]('voice:queue:%s',_0x54176e[_0xb63d('0x26')]),_0xb63d('0x5a'),_0x54176e);io[_0xb63d('0x5b')](_0xb63d('0x5c'),_0x54176e);}function notSendMessagesQueue(_0x313172){if(_0x313172[_0xb63d('0x5d')]){if(_0x313172[_0xb63d('0x5e')]===0x0&&_0x313172['pTalking']===0x0){_0x313172[_0xb63d('0x5d')]=![];_0x313172[_0xb63d('0x28')]=0x0;_0x313172[_0xb63d('0x5f')]=0x0;_0x313172[_0xb63d('0x60')]=_0xb63d('0x61');ut[_0xb63d('0x62')](_0xb63d('0x63'),_0x313172[_0xb63d('0x26')]+_0xb63d('0x64'));}else{_0x313172[_0xb63d('0x60')]='IS_DISACTIVED';ut[_0xb63d('0x62')](_0xb63d('0x63'),_0x313172[_0xb63d('0x26')]+_0xb63d('0x65'));}emitCampaignPreview(_0x313172);}}Preview[_0xb63d('0x10')]['loopCampaigns']=function(){var _0x5bd6e5=this;setInterval(function(){_0x5bd6e5['syncCampaigns']();},0x7cf);};Preview['prototype'][_0xb63d('0x66')]=function(){var _0x15f1c5=this[_0xb63d('0x13')];this['clockClearZombieChannels']+=0x1;for(var _0x54af3d in _0x15f1c5){if(_0x15f1c5[_0xb63d('0x67')](_0x54af3d)&&(_0x15f1c5[_0x54af3d][_0xb63d('0x33')]===_0xb63d('0x68')||_0x15f1c5[_0x54af3d]['dialMethod']===_0xb63d('0x69'))&&_0x15f1c5[_0x54af3d][_0xb63d('0x24')]==='outbound'){if(this[_0xb63d('0x16')]>0x7){this[_0xb63d('0x16')]=0x0;this[_0xb63d('0x6a')]();}}if(_0x15f1c5[_0xb63d('0x67')](_0x54af3d)&&_0x15f1c5[_0x54af3d][_0xb63d('0x33')]===_0xb63d('0x68')&&_0x15f1c5[_0x54af3d][_0xb63d('0x24')]===_0xb63d('0x25')){if(_0x15f1c5[_0x54af3d][_0xb63d('0x32')]){this[_0xb63d('0x6b')](_0x15f1c5[_0x54af3d]);this[_0xb63d('0x6c')](_0x15f1c5[_0x54af3d]);}else{notSendMessagesQueue(_0x15f1c5[_0x54af3d]);}}}};Preview['prototype'][_0xb63d('0x6d')]=function(_0x533fcc){var _0x5db583=this;this['sequence'][_0xb63d('0x6e')](function(){if(!_[_0xb63d('0x6f')](_0x5db583['actions'][_0x533fcc])){loggerAction['info'](_0xb63d('0x70'),_0x533fcc,'Queue',_0x5db583[_0xb63d('0x71')][_0x533fcc]['queue'],_0xb63d('0x72'),JSON[_0xb63d('0x58')](_0x5db583[_0xb63d('0x13')][_0x5db583[_0xb63d('0x71')][_0x533fcc]['queue']]['originated']),'pTalking:\x20',JSON[_0xb63d('0x58')](_0x5db583['campaignsPreview'][_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x73')]][_0xb63d('0x74')]),JSON[_0xb63d('0x58')](_0x5db583['actions'][_0x533fcc][_0xb63d('0x75')]),JSON[_0xb63d('0x58')](_['pick'](_0x5db583['actions'][_0x533fcc],[_0xb63d('0x76'),'UserId',_0xb63d('0x77'),_0xb63d('0x78')])));return ami[_0xb63d('0x79')]({'action':_0xb63d('0x7a'),'channel':_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x7b')]})[_0xb63d('0x7c')](function(_0x222be5){if(_0x222be5[_0xb63d('0x60')]===_0xb63d('0x7d')){setTimeout(function(){if(_0x5db583['actions'][_0x533fcc]){ut['updateOriginated'](_0x5db583[_0xb63d('0x13')][_0x5db583['actions'][_0x533fcc][_0xb63d('0x73')]],_0xb63d('0x7e'));if(_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x75')]===!![]){ut[_0xb63d('0x7f')](_0x5db583['campaignsPreview'][_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x73')]],_0xb63d('0x7e'));ut[_0xb63d('0x80')](_0xb63d('0x81')+_0x533fcc,_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x73')]);}ut[_0xb63d('0x80')](_0xb63d('0x82')+_0x533fcc,_0x5db583[_0xb63d('0x71')][_0x533fcc][_0xb63d('0x73')]);delete _0x5db583['actions'][_0x533fcc];}},0x2328);}});}});};Preview[_0xb63d('0x10')][_0xb63d('0x6a')]=function(){var _0x282166=this;loggerAction[_0xb63d('0x56')]('[action]',_[_0xb63d('0x83')](this[_0xb63d('0x71')]));for(var _0x56b94a in this['actions']){if(_0x282166[_0xb63d('0x71')][_0xb63d('0x67')](_0x56b94a)){_0x282166[_0xb63d('0x6d')](_0x56b94a);}}};Preview[_0xb63d('0x10')][_0xb63d('0x6c')]=function(_0x4e221a){var _0x2704b1=this;rpcDb['getContactRecallMe'](_0x4e221a['id'],ut[_0xb63d('0x84')](this['agents']))[_0xb63d('0x85')](function(_0x415aaa){if(!_[_0xb63d('0x6f')](_0x415aaa)){for(var _0x37830c=0x0;_0x37830c<_0x415aaa[_0xb63d('0x86')];_0x37830c+=0x1){if(ut[_0xb63d('0x87')](_0x415aaa[_0x37830c][_0xb63d('0x88')])<_0x4e221a['dialRecallMeTimeout']*0x3c){if(_0x415aaa[_0x37830c][_0xb63d('0x89')]&&!_0x415aaa[_0x37830c][_0xb63d('0x89')]['voicePause']){_0x2704b1[_0xb63d('0x8a')](_0x415aaa[_0x37830c]['id'])[_0xb63d('0x85')](ut[_0xb63d('0x8b')](_0xb63d('0x8c')))[_0xb63d('0x7c')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0xb63d('0x8d')](_0x415aaa[_0x37830c]['id']);}}else{var _0x31c93a=new Action(_0x415aaa[_0x37830c],_0x4e221a);_0x31c93a[_0xb63d('0x8e')]=moment()[_0xb63d('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e221a[_0xb63d('0x8f')]+=0x1;ut[_0xb63d('0x90')](_0x31c93a,0x17,_0xb63d('0x91'));if(_0x4e221a[_0xb63d('0x92')]){rpcDb[_0xb63d('0x93')](ut[_0xb63d('0x94')](_0x415aaa[_0x37830c]));rpcDb[_0xb63d('0x95')](_0x31c93a,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xb63d('0x90')](_0x31c93a,0x16,'RecallFailedTimeout');rpcDb[_0xb63d('0x95')](_0x31c93a,_0xb63d('0x96'));rpcDb['createCustomerFinal'](_0x31c93a,'[HistoryRecallClose]');}}}}})[_0xb63d('0x7c')](ut['logger2'](_0xb63d('0x97')));};Preview['prototype'][_0xb63d('0x6b')]=function(_0xd0574b){_0xd0574b[_0xb63d('0x5d')]=!![];if(ut['IsNotLoggedIn'](_0xd0574b['loggedIn'])){_0xd0574b[_0xb63d('0x60')]=_0xb63d('0x98');}else if(!ut[_0xb63d('0x99')](_0xd0574b[_0xb63d('0x32')])){_0xd0574b['message']=_0xb63d('0x61');}else if(!this[_0xb63d('0x9a')](_0xd0574b[_0xb63d('0x50')])){if(!this[_0xb63d('0x9a')](_0xd0574b['TrunkBackup'])){_0xd0574b[_0xb63d('0x60')]=_0xb63d('0x9b');}else{_0xd0574b[_0xb63d('0x60')]='ACTIVE';}}else{_0xd0574b[_0xb63d('0x60')]=_0xb63d('0x9c');}emitCampaignPreview(_0xd0574b);};Preview[_0xb63d('0x10')]['callProgressDetectingCustomer']=function(_0x5c7c82,_0xfb854b,_0x437ea7){var _0x146f7a=this;var _0x489328=this[_0xb63d('0x71')][_0xfb854b];var _0x15862a=this[_0xb63d('0x13')][_0x489328[_0xb63d('0x73')]];var _0x5f080d;if(_0x15862a){switch(_0x437ea7){case'1':_0x15862a[_0xb63d('0x3f')]+=0x1;_0x489328[_0xb63d('0x9d')]+=0x1;_0x489328['countglobal']=ut['totalGlobal'](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x0,_0xb63d('0x9e'));ami[_0xb63d('0x5b')](_0xb63d('0x9f'),ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xa1')));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xa2'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb[_0xb63d('0xa7')](_0x5f080d,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x489328[_0xb63d('0x9d')]>=_0x15862a[_0xb63d('0xa8')]){rpcDb['createCustomerFinal'](_0x489328,_0xb63d('0xa9'));}else{rpcDb['rescheduleContact'](ut[_0xb63d('0xaa')](_0x489328,'countnosuchnumberretry',_0x15862a['dialNoSuchNumberRetryFrequency']),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}delete this[_0xb63d('0x71')][_0x5c7c82['linkedid']];break;case _0xb63d('0xad'):var _0x53674d=moment()['format'](_0xb63d('0xae'));_0x489328['responsetime']=_0x53674d;_0x489328[_0xb63d('0xaf')]=_0x53674d;_0x489328['dialAnswer']=!![];_0x15862a[_0xb63d('0x74')]+=0x1;logger[_0xb63d('0x56')](_0xb63d('0xb0'),_0x489328[_0xb63d('0xb1')],_0xb63d('0xb2'),_0x15862a[_0xb63d('0x26')],_0xb63d('0xb3'),_0x15862a[_0xb63d('0x74')]);ami[_0xb63d('0x5b')](_0xb63d('0xb4'),ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xb5'),this[_0xb63d('0x13')][_0x489328[_0xb63d('0x73')]]));if(_0x15862a[_0xb63d('0xb6')]){ami[_0xb63d('0x5b')](_0xb63d('0xb7'),ut[_0xb63d('0xb8')](_0x489328));}break;case'16':ami['emit'](_0xb63d('0xb9'),ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xba'),this[_0xb63d('0x13')][_0x489328['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x489328,_0xb63d('0xba')));_0x15862a[_0xb63d('0xbb')]+=0x1;_0x15862a[_0xb63d('0x2d')]+=0x1;_0x15862a[_0xb63d('0xbc')]+=0x1;ut[_0xb63d('0x7f')](_0x15862a,'[16]');_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x4,_0xb63d('0xbe'));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xbf'));rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xc0'));rpcDb['crateCustomerReportQueue'](_0x489328);_0x15862a[_0xb63d('0x2a')]+=_0x489328[_0xb63d('0xc1')];_0x15862a['sumBillable']+=_0x489328[_0xb63d('0xc1')];logger[_0xb63d('0x56')](_0xb63d('0xc2'),_0x489328[_0xb63d('0xb1')],'\x20Queue',_0x15862a[_0xb63d('0x26')],_0xb63d('0xb3'),_0x15862a[_0xb63d('0x74')]);delete this['actions'][_0x5c7c82[_0xb63d('0xc3')]];break;case'BUSY':_0x15862a[_0xb63d('0x3a')]+=0x1;_0x489328['countbusyretry']+=0x1;_0x489328['countglobal']=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x5,_0xb63d('0xc4'));ami[_0xb63d('0x5b')]('custom:agentbusy',ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xc5')));rpcDb['createCustomerHistory'](_0x489328,_0xb63d('0xc6'));if(ut['totalGlobal'](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb[_0xb63d('0xa7')](_0x5f080d,_0xb63d('0xc7'));}else{if(_0x489328[_0xb63d('0xc8')]>=_0x15862a[_0xb63d('0xc9')]){rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xc6'));}else{rpcDb[_0xb63d('0xca')](ut[_0xb63d('0xaa')](_0x489328,_0xb63d('0xc8'),_0x15862a[_0xb63d('0xcb')]),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case _0xb63d('0xcc'):_0x15862a[_0xb63d('0x3e')]+=0x1;_0x489328[_0xb63d('0xcd')]+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x3,'NoAnswer');ami[_0xb63d('0x5b')](_0xb63d('0xce'),ut['buildObj'](_0x489328,_0xb63d('0xcf')));rpcDb[_0xb63d('0x95')](_0x489328,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb['createCustomerFinal'](_0x5f080d,_0xb63d('0xd0'));}else{if(_0x489328[_0xb63d('0xcd')]>=_0x15862a[_0xb63d('0xd1')]){rpcDb['createCustomerFinal'](_0x489328,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xb63d('0xaa')](_0x489328,_0xb63d('0xcd'),_0x15862a[_0xb63d('0xd2')]),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case _0xb63d('0xd3'):_0x15862a[_0xb63d('0x3b')]+=0x1;_0x489328[_0xb63d('0xd4')]+=0x1;_0x489328['countglobal']=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x8,'Congestion');ami[_0xb63d('0x5b')]('custom:agentcongestion',ut['buildObj'](_0x489328,_0xb63d('0xd5')));rpcDb['createCustomerHistory'](_0x489328,_0xb63d('0xd6'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,'Global');rpcDb['createCustomerFinal'](_0x5f080d,_0xb63d('0xd7'));}else{if(_0x489328[_0xb63d('0xd4')]>=_0x15862a['dialCongestionMaxRetry']){rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xd6'));}else{rpcDb[_0xb63d('0xca')](ut[_0xb63d('0xaa')](_0x489328,_0xb63d('0xd4'),_0x15862a[_0xb63d('0xcb')]),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case _0xb63d('0xd8'):_0x15862a[_0xb63d('0x41')]+=0x1;_0x489328[_0xb63d('0xd9')]+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x14,_0xb63d('0xda'));ami[_0xb63d('0x5b')](_0xb63d('0xdb'),ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xdc')));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xdd'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0x14,_0xb63d('0xda'));rpcDb[_0xb63d('0xa7')](_0x5f080d,_0xb63d('0xde'));}else{if(_0x489328[_0xb63d('0xd9')]>=_0x15862a[_0xb63d('0xdf')]){rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xde'));}else{rpcDb['rescheduleContact'](ut[_0xb63d('0xaa')](_0x489328,'countagentrejectretry',_0x15862a['dialAgentRejectRetryFrequency']),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case _0xb63d('0xe0'):_0x15862a[_0xb63d('0x42')]+=0x1;_0x489328[_0xb63d('0xe1')]+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0xb,_0xb63d('0xe2'));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xe3'));if(ut['totalGlobal'](_0x489328)>=_0x15862a['dialGlobalMaxRetry']){_0x5f080d=ut['cloneAction'](_0x489328,0xf,'Global');rpcDb['createCustomerFinal'](_0x5f080d,_0xb63d('0xe3'));}else{if(_0x489328[_0xb63d('0xe4')]>=_0x15862a[_0xb63d('0xe5')]){rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xe3'));}else{rpcDb[_0xb63d('0xca')](ut[_0xb63d('0xaa')](_0x489328,_0xb63d('0xe1'),_0x15862a[_0xb63d('0xe6')]),_0x489328[_0xb63d('0xab')],_0x489328[_0xb63d('0xac')]);}}break;case'18':_0x15862a[_0xb63d('0xe7')]+=0x1;_0x489328['countmachineretry']+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x12,_0x5c7c82[_0xb63d('0xe8')]||_0x5c7c82[_0xb63d('0xe9')]);ami[_0xb63d('0x5b')](_0xb63d('0xea'),ut[_0xb63d('0xa0')](_0x489328,'amd'));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xeb'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb[_0xb63d('0xa7')](_0x5f080d,_0xb63d('0xeb'));}else{rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xeb'));}delete this['actions'][_0x5c7c82[_0xb63d('0xc3')]];break;case'19':_0x15862a['outboundUnknownCallsDay']+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0x13,_0x5c7c82[_0xb63d('0xe8')]||_0x5c7c82[_0xb63d('0xe9')]);ami[_0xb63d('0x5b')]('custom:amd',ut[_0xb63d('0xa0')](_0x489328,_0xb63d('0xec')));rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xed'));if(ut['totalGlobal'](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,_0xb63d('0xa6'));rpcDb[_0xb63d('0xa7')](_0x5f080d,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xb63d('0xa7')](_0x489328,_0xb63d('0xed'));}delete this[_0xb63d('0x71')][_0x5c7c82['linkedid']];break;default:if(_0x489328['dialAnswer']){ut[_0xb63d('0x7f')](_0x15862a,_0xb63d('0xee'));ut[_0xb63d('0x80')](_0xb63d('0xef')+_0x15862a[_0xb63d('0x26')],_0x5c7c82);}_0x15862a['outboundUnknownCallsDay']+=0x1;_0x489328[_0xb63d('0xbd')]=ut[_0xb63d('0xa3')](_0x489328);ut[_0xb63d('0x90')](_0x489328,0xc,_0x5c7c82['cause-txt']||_0x5c7c82[_0xb63d('0xe9')]);rpcDb[_0xb63d('0x95')](_0x489328,_0xb63d('0xf0'));if(ut[_0xb63d('0xa3')](_0x489328)>=_0x15862a[_0xb63d('0xa4')]){_0x5f080d=ut[_0xb63d('0xa5')](_0x489328,0xf,'Global');rpcDb[_0xb63d('0xa7')](_0x5f080d,_0xb63d('0xf1'));}else{rpcDb[_0xb63d('0xa7')](_0x489328,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xb63d('0x71')][_0x5c7c82[_0xb63d('0xc3')]];}if(!(_0x489328[_0xb63d('0x75')]&&_0x437ea7==='16')){ut['updateOriginated'](_0x15862a,_0xb63d('0xf2'));logger[_0xb63d('0x56')](_0xb63d('0xf3'),_0x489328[_0xb63d('0xb1')],_0xb63d('0xb2'),_0x15862a[_0xb63d('0x26')],_0xb63d('0x72'),_0x15862a[_0xb63d('0x5e')]);}if(_0x437ea7!==_0xb63d('0xad')){delete this[_0xb63d('0x71')][_0x5c7c82[_0xb63d('0xc3')]];delete this['actions'][_0x5c7c82[_0xb63d('0xf4')]];}}};Preview[_0xb63d('0x10')]['callProgressDetectingAgent']=function(_0xbe86b3,_0x3c7cb8,_0x587202){if(_['isUndefined'](_0x3c7cb8)&&_0xb63d('0xf5')!==typeof _0x3c7cb8){return;}if(_['isUndefined'](_0x587202)&&'object'!==typeof _0x587202){return;}switch(_0x587202[_0xb63d('0xf6')]){case'0':ut['logAgent'](_0xbe86b3,0x0,'NoSuchNumber');rpcDb[_0xb63d('0xf7')](_0xbe86b3,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xb63d('0xf8')](_0xbe86b3,0x3,_0xb63d('0xf9'));rpcDb[_0xb63d('0xf7')](_0xbe86b3,_0xb63d('0xfa'));break;case'5':ut[_0xb63d('0xf8')](_0xbe86b3,0x5,'Busy');rpcDb['createAgentHistory'](_0xbe86b3,_0xb63d('0xfb'));break;case'8':ut[_0xb63d('0xf8')](_0xbe86b3,0x8,_0xb63d('0xfc'));rpcDb[_0xb63d('0xf7')](_0xbe86b3,_0xb63d('0xfd'));break;case'22':ut[_0xb63d('0xf8')](_0xbe86b3,0x16,_0xb63d('0xfe'));rpcDb[_0xb63d('0xf7')](_0xbe86b3,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xbe86b3,0xc,_0x587202[_0xb63d('0xf6')]);rpcDb['createAgentHistory'](_0xbe86b3,_0xb63d('0xfd'));}ut[_0xb63d('0xff')](_0x3c7cb8,_0xb63d('0x100'));logger[_0xb63d('0x56')]('[originated][decrement][callProgressDetectingAgent]',_0xbe86b3[_0xb63d('0xb1')],_0xb63d('0xb2'),_0x3c7cb8[_0xb63d('0x26')],_0xb63d('0x72'),_0x3c7cb8[_0xb63d('0x5e')]);delete this['actions'][_0xbe86b3[_0xb63d('0xb1')]];};Preview[_0xb63d('0x10')][_0xb63d('0x101')]=function(_0x405e53,_0x4e57c8,_0x560ba3,_0x3d15ac,_0x1a46fb){var _0x18475d=this;return new BPromise(function(_0x5521d9,_0x555562){if(_[_0xb63d('0x6f')](_0x4e57c8)||_[_0xb63d('0x6f')](_0x4e57c8['Contact'])||_[_0xb63d('0x6f')](_0x4e57c8['Contact'][_0xb63d('0x102')])||_[_0xb63d('0x6f')](_0x4e57c8['VoiceQueueId'])){_0x555562(ut[_0xb63d('0x60')](_0xb63d('0x103'),_0x3d15ac,_0x1a46fb));return;}var _0x49bc40=uuid['v4']();var _0x400582=_0x18475d[_0xb63d('0x13')][_0x4e57c8['Queue'][_0xb63d('0x26')]];var _0x22b92d=_0x560ba3?_0x18475d[_0xb63d('0x15')][_0x560ba3]['id']:undefined;_0x18475d[_0xb63d('0x71')][_0x49bc40]=new Action(_0x4e57c8,_0x400582,_0x49bc40,_0x560ba3,_0x22b92d);var _0x3df6fe=_0x18475d[_0xb63d('0x71')][_0x49bc40];_0x3df6fe[_0xb63d('0xab')]=_0x3d15ac;_0x3df6fe[_0xb63d('0xac')]=_0x1a46fb;_0x3df6fe[_0xb63d('0x104')]=_0x560ba3;if(_[_0xb63d('0x105')](_0x405e53)){_0x18475d[_0xb63d('0x106')](_0x3df6fe,_0x400582,_0x4e57c8,_0x560ba3)[_0xb63d('0x85')](function(_0x3f9153){logger[_0xb63d('0x56')](_0xb63d('0x107'),_0xb63d('0x108')+_0x3df6fe[_0xb63d('0x73')]+_0xb63d('0x109')+_0x3df6fe[_0xb63d('0x10a')],JSON[_0xb63d('0x58')](_0x3f9153));ami[_0xb63d('0x5b')](_0xb63d('0x10b'),ut['buildObj'](_0x3df6fe,'called',_0x18475d[_0xb63d('0x13')][_0x3df6fe[_0xb63d('0x73')]]));_0x5521d9(ut[_0xb63d('0x60')]('Calling'));})[_0xb63d('0x7c')](function(_0x5ad701){ut[_0xb63d('0x62')](_0xb63d('0x10c'),_0x5ad701);_0x555562(ut[_0xb63d('0x60')](_0xb63d('0x10d'),_0x3d15ac,_0x1a46fb));});}else{_0x400582[_0xb63d('0x39')]+=0x1;ut[_0xb63d('0x10e')](_0x3df6fe);rpcDb[_0xb63d('0x10f')](_0x3df6fe,_0xb63d('0x110'));delete _0x18475d[_0xb63d('0x71')][_0x49bc40];_0x555562(ut[_0xb63d('0x60')]('Contact\x20in\x20black\x20List',_0x3d15ac,_0x1a46fb));}});};Preview[_0xb63d('0x10')][_0xb63d('0x9a')]=function(_0xbb7e45){return!_[_0xb63d('0x6f')](_0xbb7e45)&&!_[_0xb63d('0x6f')](_0xbb7e45[_0xb63d('0x26')])&&!_[_0xb63d('0x6f')](_0xbb7e45[_0xb63d('0x51')])&&_0xbb7e45[_0xb63d('0x51')]&&!_[_0xb63d('0x6f')](this[_0xb63d('0x14')][util[_0xb63d('0x59')](_0xb63d('0x111'),_0xbb7e45[_0xb63d('0x26')])])&&!_['isNil'](this[_0xb63d('0x14')][util['format']('SIP/%s',_0xbb7e45[_0xb63d('0x26')])][_0xb63d('0x7a')])&&(this[_0xb63d('0x14')][util[_0xb63d('0x59')](_0xb63d('0x111'),_0xbb7e45[_0xb63d('0x26')])][_0xb63d('0x7a')]===_0xb63d('0x112')||this[_0xb63d('0x14')][util[_0xb63d('0x59')](_0xb63d('0x111'),_0xbb7e45[_0xb63d('0x26')])][_0xb63d('0x7a')]===_0xb63d('0x113'));};Preview[_0xb63d('0x10')][_0xb63d('0x8a')]=function(_0x3607cb,_0x45e973){var _0x2959c6=this;return new BPromise(function(_0xabd091,_0x38b583){_0x2959c6['execRun'](_0x3607cb,_0x45e973)[_0xb63d('0x85')](function(_0x158165){_0xabd091(_[_0xb63d('0x114')](_0x158165,[_0xb63d('0x60')]));})[_0xb63d('0x7c')](function(_0x9cf74c){if(_0x9cf74c[_0xb63d('0x115')]){rpcDb[_0xb63d('0x116')](_0x3607cb);}if(_0x9cf74c[_0xb63d('0x51')]){rpcDb['disableContact'](_0x3607cb);}_0x38b583(_[_0xb63d('0x114')](_0x9cf74c,[_0xb63d('0x60')]));});});};Preview[_0xb63d('0x10')][_0xb63d('0x117')]=function(_0x41aaad,_0x498363){var _0x4dea5d=this;return new BPromise(function(_0x1283a5,_0x5c8305){var _0x3c748e,_0x6e7eb;rpcDb[_0xb63d('0x118')](_0x41aaad)['then'](function(_0x288f13){if(!_['isNil'](_0x288f13[0x0])){_0x6e7eb=_0x288f13[0x0][_0xb63d('0x119')]?![]:!![];_0x3c748e=_0x288f13[0x0]['recallme']?!![]:![];_0x3c748e=_0x498363?!![]:_0x3c748e;}var _0x3e9ce4=_0x4dea5d['validateContact'](_0x288f13);if(_0x3e9ce4[_0xb63d('0x11a')]){rpcDb[_0xb63d('0x11b')](_[_0xb63d('0x114')](_0x288f13[0x0],[_0xb63d('0x77'),_0xb63d('0x11c')]))[_0xb63d('0x85')](function(_0x1925b3){_0x4dea5d[_0xb63d('0x101')](_0x1925b3,_0x288f13[0x0],_0x498363,_0x6e7eb,_0x3c748e)[_0xb63d('0x85')](function(_0x171afa){_0x1283a5(_0x171afa);})[_0xb63d('0x7c')](function(_0x5bdf97){_0x5c8305(_0x5bdf97);});})[_0xb63d('0x7c')](function(_0x982099){ut[_0xb63d('0x62')](_0xb63d('0x11d'),_0x982099);_0x5c8305(ut['message'](_0xb63d('0x11e'),_0x6e7eb,_0x3c748e));});}else{_0x5c8305(ut[_0xb63d('0x60')](_0x3e9ce4[_0xb63d('0x60')],_0x6e7eb,_0x3c748e));}})[_0xb63d('0x7c')](function(_0x394275){ut[_0xb63d('0x62')](_0xb63d('0x11f'),_0x394275);_0x5c8305(ut[_0xb63d('0x60')](_0xb63d('0x11e'),![],!![]));});});};Preview[_0xb63d('0x10')]['validateContact']=function(_0xe091e8){if(_['isNil'](_0xe091e8)||_[_0xb63d('0x105')](_0xe091e8)||!_['isNil'](_0xe091e8[0x0]['Agent'])&&_[_0xb63d('0x6f')](_0xe091e8[0x0][_0xb63d('0x89')]['name'])){ut[_0xb63d('0x62')](_0xb63d('0x120'),_0xe091e8);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x24dea7=this[_0xb63d('0x13')][_0xe091e8[0x0][_0xb63d('0x121')][_0xb63d('0x26')]];_0x24dea7[_0xb63d('0x60')]=_0xb63d('0x9c');if(_[_0xb63d('0x6f')](_0x24dea7)){ut['logger'](_0xb63d('0x122'),_0x24dea7);return{'isValid':![],'message':_0xb63d('0x123')};}if(!this[_0xb63d('0x9a')](_0x24dea7[_0xb63d('0x50')])){ut[_0xb63d('0x62')](_0xb63d('0x124'),_0xb63d('0x125')+_0x24dea7[_0xb63d('0x26')]+_0xb63d('0x126'));if(!this[_0xb63d('0x9a')](_0x24dea7[_0xb63d('0x127')])){ut[_0xb63d('0x62')](_0xb63d('0x124'),_0x24dea7[_0xb63d('0x26')]+_0xb63d('0x128'));return{'isValid':![],'message':_0xb63d('0x129')};}}if(!ut[_0xb63d('0x99')](_0x24dea7[_0xb63d('0x32')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x24dea7[_0xb63d('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x24dea7[_0xb63d('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xb63d('0x12a')};};Preview[_0xb63d('0x10')][_0xb63d('0x106')]=function(_0x1a868b,_0x42acb2,_0x8bd53c,_0x4d6e30){var _0x3b56cc=this;return new BPromise(function(_0x1d14c0,_0x180d8e){var _0x2a0645=_0x1a868b[_0xb63d('0xb1')];var _0x34e2d3=_0x3b56cc[_0xb63d('0x9a')](_0x42acb2[_0xb63d('0x50')])?util[_0xb63d('0x59')]('SIP/%s/%s%s',_0x42acb2[_0xb63d('0x50')][_0xb63d('0x26')],_[_0xb63d('0x6f')](_0x42acb2['dialPrefix'])?'':_0x42acb2['dialPrefix'][_0xb63d('0x12b')]()||'',_0x42acb2[_0xb63d('0x12c')]>0x0?_0x8bd53c[_0xb63d('0x12d')][_0xb63d('0x102')][_0xb63d('0x12e')](_0x42acb2[_0xb63d('0x12c')]):_0x8bd53c[_0xb63d('0x12d')][_0xb63d('0x102')]):util['format'](_0xb63d('0x12f'),_[_0xb63d('0x6f')](_0x42acb2['TrunkBackup'])?_0x42acb2[_0xb63d('0x50')]['name']:_0x42acb2[_0xb63d('0x127')]['name'],_[_0xb63d('0x6f')](_0x42acb2[_0xb63d('0x37')])?'':_0x42acb2['dialPrefix'][_0xb63d('0x12b')]()||'',_0x42acb2[_0xb63d('0x12c')]>0x0?_0x8bd53c[_0xb63d('0x12d')][_0xb63d('0x102')][_0xb63d('0x12e')](_0x42acb2[_0xb63d('0x12c')]):_0x8bd53c['Contact']['phone']);var _0x58a2bb=_0x3b56cc['isTrunkReachable'](_0x42acb2['Trunk'])?ut['getCallerId'](_0x42acb2[_0xb63d('0x50')][_0xb63d('0x52')],_0x42acb2[_0xb63d('0x34')],_0x42acb2[_0xb63d('0x130')]>0x0?ut[_0xb63d('0x131')](_0x42acb2[_0xb63d('0x35')],_0x42acb2[_0xb63d('0x130')]):_0x42acb2[_0xb63d('0x35')]):ut[_0xb63d('0x132')](_[_0xb63d('0x6f')](_0x42acb2['TrunkBackup'])?_0x42acb2[_0xb63d('0x50')][_0xb63d('0x52')]:_0x42acb2[_0xb63d('0x127')][_0xb63d('0x52')],_0x42acb2[_0xb63d('0x34')],_0x42acb2['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb63d('0x131')](_0x42acb2[_0xb63d('0x35')],_0x42acb2[_0xb63d('0x130')]):_0x42acb2['dialOriginateCallerIdNumber']);if(_0x58a2bb){_0x1a868b[_0xb63d('0x133')]=ut[_0xb63d('0x134')](_0x58a2bb);_0x1a868b[_0xb63d('0x135')]=ut[_0xb63d('0x136')](_0x58a2bb);}var _0x1f5a3a=ut[_0xb63d('0x137')](_0x42acb2,_0x8bd53c,_0x34e2d3,_0x58a2bb,_0x2a0645,_0x1a868b);_['merge'](_0x1a868b,ut[_0xb63d('0x138')](_0x1f5a3a));_0x1a868b[_0xb63d('0x8e')]=moment()[_0xb63d('0x59')](_0xb63d('0xae'));ami[_0xb63d('0x79')](ut['variablesAction'](_0x1a868b,_0x42acb2,_0x1f5a3a,_0x1a868b[_0xb63d('0xac')],_0x4d6e30))[_0xb63d('0x85')](function(_0x427a16){var _0x40ad76=_0x1a868b[_0xb63d('0x139')];if(!_[_0xb63d('0x6f')](_0x40ad76)){if(!_[_0xb63d('0x6f')](_0x3b56cc[_0xb63d('0x15')][_0x40ad76])){_0x3b56cc[_0xb63d('0x15')][_0x40ad76][_0xb63d('0x13a')]=_0x1a868b[_0xb63d('0x13b')];emit(util['format'](_0xb63d('0x13c'),_0x3b56cc[_0xb63d('0x15')][_0x40ad76][_0xb63d('0x26')]),_0xb63d('0x13d'),{'destaccountcode':_0x3b56cc['agents'][_0x40ad76][_0xb63d('0x13e')],'destconnectedlinenum':_0x1a868b[_0xb63d('0x13b')]});}}_0x42acb2[_0xb63d('0x5e')]+=0x1;logger[_0xb63d('0x56')](_0xb63d('0x13f'),_0x2a0645,_0xb63d('0xb2'),_0x42acb2[_0xb63d('0x26')],_0xb63d('0x72'),_0x42acb2[_0xb63d('0x5e')]);_0x1d14c0(_0x427a16);})[_0xb63d('0x7c')](function(_0x30b717){ut[_0xb63d('0xf8')](_0x1a868b,0xe,_0xb63d('0x140'));rpcDb['createAgentHistory'](_0x1a868b,_0xb63d('0x141'));_0x180d8e(_0x30b717);});});};Preview['prototype'][_0xb63d('0x142')]=function(_0x232d3d){if(this[_0xb63d('0x71')][_0x232d3d[_0xb63d('0xc3')]]){this[_0xb63d('0x71')][_0x232d3d[_0xb63d('0xc3')]][_0xb63d('0x7b')]=_0x232d3d['channel'];}};Preview[_0xb63d('0x10')]['syncOriginateResponse']=function(_0x2d00a4){var _0x4b1cc9=this;var _0x4ea3e2=this['actions'][_0x2d00a4['actionid']];if(_0x4ea3e2){if(_0x4ea3e2[_0xb63d('0x104')]&&this[_0xb63d('0x15')][_0x4ea3e2[_0xb63d('0x104')]]){ut[_0xb63d('0x143')](_0x4ea3e2,this[_0xb63d('0x15')][_0x4ea3e2[_0xb63d('0x104')]][_0xb63d('0x26')],this[_0xb63d('0x15')][_0x4ea3e2[_0xb63d('0x104')]]['id']);}var _0x3fd8cf=_[_0xb63d('0x144')](_0x4ea3e2);_0x3fd8cf['responsetime']=moment()['format'](_0xb63d('0xae'));var _0x1b55f4=_0x4b1cc9[_0xb63d('0x13')][_0x4ea3e2[_0xb63d('0x73')]];if(ut[_0xb63d('0x145')](_0x2d00a4[_0xb63d('0x146')])){if(_0x4ea3e2[_0xb63d('0xab')]){rpcDb['unlockContact'](_0x4ea3e2[_0xb63d('0x10a')]);}if(_0x4ea3e2['activeContact']){rpcDb['disableContact'](_0x4ea3e2[_0xb63d('0x10a')]);}ami[_0xb63d('0x5b')](_0xb63d('0x147'),ut[_0xb63d('0xa0')](_0x4ea3e2,_0xb63d('0x148'),this[_0xb63d('0x13')][_0x4ea3e2['queue']]));this[_0xb63d('0x149')](_0x3fd8cf,_0x1b55f4,_0x2d00a4);}else{_0x4ea3e2['starttime']=moment()[_0xb63d('0x59')](_0xb63d('0xae'));ut[_0xb63d('0xf8')](_0x3fd8cf,0x4,_0xb63d('0xbe'));rpcDb[_0xb63d('0xf7')](_0x3fd8cf,_0xb63d('0x14a'));}}};Preview[_0xb63d('0x10')][_0xb63d('0x1b')]=function(_0x4c9270){var _0x8ab3ec=this;var _0x1a67ee=this[_0xb63d('0x71')][_0x4c9270['linkedid']];var _0x162dee;if(_0x1a67ee){_0x162dee=this[_0xb63d('0x13')][_0x1a67ee[_0xb63d('0x73')]];logger[_0xb63d('0x56')](_0xb63d('0x14b'),_0x4c9270[_0xb63d('0xc3')],_0xb63d('0xb2'),_0x162dee[_0xb63d('0x26')],_0xb63d('0xb3'),_0x162dee[_0xb63d('0x74')]);}if(this[_0xb63d('0x71')][_0x4c9270[_0xb63d('0xc3')]]&&_0x4c9270['linkedid']!==_0x4c9270['uniqueid']){if(_0x4c9270[_0xb63d('0x14c')]==='16'&&this['actions'][_0x4c9270['linkedid']][_0xb63d('0x75')]){this['callProgressDetectingCustomer'](_0x4c9270,_0x4c9270['linkedid'],_0x4c9270['cause']);}else if(this['actions'][_0x4c9270[_0xb63d('0xc3')]][_0xb63d('0x75')]){logger[_0xb63d('0x56')](_0xb63d('0x14d'),_0x4c9270[_0xb63d('0xc3')],_0x4c9270['cause'],_0xb63d('0xb2'),_0x162dee['name'],_0xb63d('0xb3'),_0x162dee[_0xb63d('0x74')]);this[_0xb63d('0x14e')](_0x4c9270,_0x4c9270['linkedid'],_0x4c9270[_0xb63d('0x14c')]);}}else if(_0x1a67ee&&_['isNil'](_0x1a67ee[_0xb63d('0x14f')])&&_0x162dee[_0xb63d('0x150')]&&_0x4c9270[_0xb63d('0xc3')]===_0x4c9270[_0xb63d('0xb1')]&&_[_0xb63d('0x6f')](_0x4c9270['reason'])&&_0x4c9270[_0xb63d('0x14c')]==='16'&&_0x4c9270[_0xb63d('0x151')]==='6'&&_[_0xb63d('0x152')](_0x1a67ee[_0xb63d('0x153')])){if(_0x1a67ee[_0xb63d('0xab')]){rpcDb['unlockContact'](_0x1a67ee[_0xb63d('0x10a')]);}if(_0x1a67ee['activeContact']){rpcDb['disableContact'](_0x1a67ee['idContact']);}_0x4c9270[_0xb63d('0xf6')]='22';this[_0xb63d('0x149')](_0x1a67ee,_0x162dee,_0x4c9270);}else if(_0x1a67ee&&_0x1a67ee['transfer']){if(_0x4c9270['cause']==='16'&&this[_0xb63d('0x71')][_0x4c9270[_0xb63d('0xc3')]][_0xb63d('0x75')]){logger[_0xb63d('0x56')](_0xb63d('0x154'),_0x4c9270[_0xb63d('0xc3')],_0x4c9270[_0xb63d('0x14c')],'\x20Queue',_0x162dee[_0xb63d('0x26')],_0xb63d('0xb3'),_0x162dee[_0xb63d('0x74')]);this['callProgressDetectingCustomer'](_0x4c9270,_0x4c9270['linkedid'],_0x4c9270['cause']);}else if(this[_0xb63d('0x71')][_0x4c9270['linkedid']][_0xb63d('0x75')]){logger[_0xb63d('0x56')]('[syncHangup][talking][cause]',_0x4c9270[_0xb63d('0xc3')],_0x4c9270[_0xb63d('0x14c')],_0xb63d('0xb2'),_0x162dee[_0xb63d('0x26')],_0xb63d('0xb3'),_0x162dee[_0xb63d('0x74')]);this[_0xb63d('0x14e')](_0x4c9270,_0x4c9270['linkedid'],_0x4c9270[_0xb63d('0x14c')]);}}};Preview[_0xb63d('0x10')][_0xb63d('0x1f')]=function(_0x27c995){if(this['actions'][_0x27c995[_0xb63d('0xf4')]]&&_0x27c995[_0xb63d('0xf4')]!==_0x27c995[_0xb63d('0x155')]){this['callProgressDetectingCustomer'](_0x27c995,_0x27c995[_0xb63d('0xf4')],_0x27c995[_0xb63d('0xe9')]);}};Preview['prototype'][_0xb63d('0x1d')]=function(_0x4e5728){if(this[_0xb63d('0x71')][_0x4e5728[_0xb63d('0xc3')]]&&_0x4e5728['linkedid']!==_0x4e5728[_0xb63d('0xb1')]&&!this['actions'][_0x4e5728[_0xb63d('0xc3')]][_0xb63d('0x75')]){if(_0x4e5728[_0xb63d('0x14c')]==='1'){this[_0xb63d('0x14e')](_0x4e5728,_0x4e5728[_0xb63d('0xc3')],_0x4e5728[_0xb63d('0x14c')]);}}};Preview[_0xb63d('0x10')][_0xb63d('0x156')]=function(_0x42bdb5,_0x249119,_0x441c29){if(this[_0xb63d('0x71')][_0x42bdb5]){if(_['isNil'](this[_0xb63d('0x71')][_0x42bdb5][_0xb63d('0x157')])){this[_0xb63d('0x71')][_0x42bdb5]['variables']={};}this[_0xb63d('0x71')][_0x42bdb5][_0xb63d('0x157')][_0x249119]=_0x441c29;}};Preview['prototype'][_0xb63d('0x20')]=function(_0x38475c){try{if(!_[_0xb63d('0x6f')](_0x38475c)){if(ut[_0xb63d('0x158')](_[_0xb63d('0x159')](_0x38475c[_0xb63d('0x15a')])[0x0])){this[_0xb63d('0x156')](_0x38475c[_0xb63d('0xb1')],_[_0xb63d('0x159')](_0x38475c['variable'])[0x0],_0x38475c[_0xb63d('0x15b')]);}}}catch(_0x327312){logger[_0xb63d('0x15c')](_0xb63d('0x15d'),util[_0xb63d('0x15e')](_0x327312,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xb63d('0x22')]=function(_0x2e5ff1){if(_0x2e5ff1){if(this['actions'][_0x2e5ff1[_0xb63d('0x15f')]]){this[_0xb63d('0x71')][_0x2e5ff1[_0xb63d('0x15f')]][_0xb63d('0x153')]=!![];}}};Preview['prototype'][_0xb63d('0x160')]=function(_0x5b7ebb){if(_0x5b7ebb){if(this[_0xb63d('0x71')][_0x5b7ebb[_0xb63d('0x161')]]){this[_0xb63d('0x71')][_0x5b7ebb[_0xb63d('0x161')]][_0xb63d('0x153')]=!![];}}};module[_0xb63d('0x162')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 829b2fc..0ab9546 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 _0xbe6c=['unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0x5432ff,_0x300985){var _0x44217b=function(_0x4a58b5){while(--_0x4a58b5){_0x5432ff['push'](_0x5432ff['shift']());}};_0x44217b(++_0x300985);}(_0xbe6c,0x118));var _0xcbe6=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xbe6c[_0x55f8b4];return _0x2475f9;};'use strict';var util=require(_0xcbe6('0x0'));var BPromise=require(_0xcbe6('0x1'));var logger=require(_0xcbe6('0x2'))('preview');var _=require(_0xcbe6('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xcbe6('0x4'));var cmHopperBlack=require(_0xcbe6('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xcbe6('0x6'));function loggerCatch(_0x5aac22){return function(_0x252370){logger['error'](_0x5aac22,util[_0xcbe6('0x7')](_0x252370,{'showHidden':![],'depth':null}));};}function create(_0x53d5ba){return BPromise[_0xcbe6('0x8')]()[_0xcbe6('0x9')](cmHopperHistory[_0xcbe6('0xa')](_0x53d5ba))[_0xcbe6('0xb')](loggerCatch(_0xcbe6('0xc')));}function createAgent(_0x2ce6c7){return BPromise['resolve']()[_0xcbe6('0x9')](agentReportPreview[_0xcbe6('0xa')](_0x2ce6c7))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x34579b){return BPromise[_0xcbe6('0x8')]()[_0xcbe6('0x9')](cmHopper[_0xcbe6('0xd')](_0x34579b,!![]))['catch'](loggerCatch(_0xcbe6('0xe')));}exports['checkIsBlackList']=function(_0x3129a3){return BPromise[_0xcbe6('0x8')]()[_0xcbe6('0x9')](cmHopperBlack[_0xcbe6('0xf')](_0x3129a3))[_0xcbe6('0xb')](loggerCatch(_0xcbe6('0x10')));};exports['getContactPreview']=function(_0x546513){return BPromise[_0xcbe6('0x8')]()[_0xcbe6('0x9')](cmHopper[_0xcbe6('0x11')](_0x546513))[_0xcbe6('0xb')](loggerCatch('[getContactPreview]\x20'));};exports[_0xcbe6('0xa')]=function(_0x530500,_0x3ec184){create(_0x530500)['catch'](loggerCatch(_0x3ec184));moveContact(_0x530500)[_0xcbe6('0xb')](loggerCatch(_0x3ec184));};exports['createAgentHistory']=function(_0x48ed0e,_0x9dae2f){createAgent(_0x48ed0e)[_0xcbe6('0xb')](loggerCatch(_0x9dae2f));};exports[_0xcbe6('0x12')]=function(_0x1dfad0,_0x44a3ba){create(_0x1dfad0)[_0xcbe6('0xb')](loggerCatch(_0x44a3ba));};exports[_0xcbe6('0x13')]=function(_0x2df184,_0x419d99){moveContact(_0x2df184)['catch'](loggerCatch(_0x419d99));};exports[_0xcbe6('0x14')]=function(_0x2fbdcd,_0xa61624,_0x4b0651){if(_0xa61624){_0x2fbdcd[_0xcbe6('0x15')]=null;}if(_0x4b0651){_0x2fbdcd[_0xcbe6('0x16')]=![];}return BPromise[_0xcbe6('0x8')]()[_0xcbe6('0x9')](cmHopper[_0xcbe6('0x14')](_0x2fbdcd))['catch'](loggerCatch(_0xcbe6('0x17')));};exports[_0xcbe6('0x18')]=function(_0x5eea08){return BPromise['resolve']()[_0xcbe6('0x9')](cmHopper[_0xcbe6('0x18')](_0x5eea08))['catch'](loggerCatch(_0xcbe6('0x19')));};exports[_0xcbe6('0x1a')]=function(_0x42379a){return BPromise[_0xcbe6('0x8')]()['then'](cmHopper[_0xcbe6('0x1a')]({'UserId':null},_0x42379a,0x1))['catch'](loggerCatch(_0xcbe6('0x1b')));};exports[_0xcbe6('0x1c')]=function(_0x3a2d3a){return BPromise['resolve']()[_0xcbe6('0x9')](cmHopper[_0xcbe6('0x1a')]({'active':![]},_0x3a2d3a,0x1))['catch'](loggerCatch(_0xcbe6('0x1d')));};exports[_0xcbe6('0x1e')]=function(_0x2f4891){var _0x150a84={};_0x150a84[_0xcbe6('0x1f')]=_0x2f4891['type'];_0x150a84['uniqueid']=_0x2f4891[_0xcbe6('0x20')];_0x150a84[_0xcbe6('0x21')]=_0x2f4891[_0xcbe6('0x21')];_0x150a84['calleridname']=_0x2f4891['calleridname'];_0x150a84[_0xcbe6('0x22')]=_0x2f4891[_0xcbe6('0x22')];_0x150a84['queuecallerjoinAt']=_0x2f4891[_0xcbe6('0x23')];_0x150a84[_0xcbe6('0x24')]=_0x2f4891[_0xcbe6('0x23')];_0x150a84[_0xcbe6('0x25')]=0x1;_0x150a84[_0xcbe6('0x26')]=_0x2f4891['endtime'];_0x150a84['connectedlinename']=_0x2f4891['membername'];_0x150a84[_0xcbe6('0x27')]=_0xcbe6('0x28');_0x150a84['exten']=_0xcbe6('0x29');_0x150a84['holdtime']=0x0;_0x150a84[_0xcbe6('0x2a')]=0x1;_0x150a84[_0xcbe6('0x2b')]=_0x2f4891[_0xcbe6('0x2c')];_0x150a84['queuecallerexitreason']=_0xcbe6('0x2d');return BPromise[_0xcbe6('0x8')]()['then'](voiceQueueReport[_0xcbe6('0x2e')](_0x150a84))['catch'](loggerCatch(_0xcbe6('0x2f')));};exports[_0xcbe6('0x30')]=function(_0x57a894,_0x36d973){return BPromise[_0xcbe6('0x8')]()[_0xcbe6('0x9')](cmHopper[_0xcbe6('0x30')](_0x57a894,_0x36d973))[_0xcbe6('0xb')](loggerCatch(_0xcbe6('0x31')));};exports['rescheduleContactInQueue']=function(_0x39efaf){return BPromise['resolve']()[_0xcbe6('0x9')](cmHopper[_0xcbe6('0x14')](_0x39efaf,!![],!![]))[_0xcbe6('0xb')](loggerCatch(_0xcbe6('0x32')));}; \ No newline at end of file +var _0x570b=['endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x278dce,_0xc6507e){var _0x3817b6=function(_0x58874c){while(--_0x58874c){_0x278dce['push'](_0x278dce['shift']());}};_0x3817b6(++_0xc6507e);}(_0x570b,0x81));var _0xb570=function(_0x309c24,_0xb0f0b7){_0x309c24=_0x309c24-0x0;var _0x7c7578=_0x570b[_0x309c24];return _0x7c7578;};'use strict';var util=require(_0xb570('0x0'));var BPromise=require('bluebird');var logger=require(_0xb570('0x1'))(_0xb570('0x2'));var _=require('lodash');var cmHopper=require(_0xb570('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xb570('0x4'));var cmHopperBlack=require(_0xb570('0x5'));var voiceQueueRt=require(_0xb570('0x6'));var agentReportPreview=require(_0xb570('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5676e5){return function(_0x90462e){logger[_0xb570('0x8')](_0x5676e5,util['inspect'](_0x90462e,{'showHidden':![],'depth':null}));};}function create(_0x354f34){return BPromise[_0xb570('0x9')]()['then'](cmHopperHistory[_0xb570('0xa')](_0x354f34))[_0xb570('0xb')](loggerCatch(_0xb570('0xc')));}function createAgent(_0x4b8cb6){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](agentReportPreview[_0xb570('0xa')](_0x4b8cb6))['catch'](loggerCatch(_0xb570('0xc')));}function moveContact(_0x17e856){return BPromise['resolve']()[_0xb570('0xd')](cmHopper[_0xb570('0xe')](_0x17e856,!![]))['catch'](loggerCatch(_0xb570('0xf')));}exports[_0xb570('0x10')]=function(_0x4a861e){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopperBlack[_0xb570('0x10')](_0x4a861e))[_0xb570('0xb')](loggerCatch(_0xb570('0x11')));};exports[_0xb570('0x12')]=function(_0x520b6d){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x12')](_0x520b6d))[_0xb570('0xb')](loggerCatch(_0xb570('0x13')));};exports[_0xb570('0xa')]=function(_0x4e1bcd,_0x2de075){create(_0x4e1bcd)[_0xb570('0xb')](loggerCatch(_0x2de075));moveContact(_0x4e1bcd)['catch'](loggerCatch(_0x2de075));};exports[_0xb570('0x14')]=function(_0x1de862,_0x4e21c7){createAgent(_0x1de862)['catch'](loggerCatch(_0x4e21c7));};exports[_0xb570('0x15')]=function(_0x560a77,_0xd6a6a1){create(_0x560a77)[_0xb570('0xb')](loggerCatch(_0xd6a6a1));};exports['createCustomerFinal']=function(_0x1b6ba7,_0x2b3cef){moveContact(_0x1b6ba7)['catch'](loggerCatch(_0x2b3cef));};exports[_0xb570('0x16')]=function(_0xb068d4,_0x4c3884,_0x427bd4){if(_0x4c3884){_0xb068d4['UserId']=null;}if(_0x427bd4){_0xb068d4[_0xb570('0x17')]=![];}return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x16')](_0xb068d4))[_0xb570('0xb')](loggerCatch(_0xb570('0x18')));};exports[_0xb570('0x19')]=function(_0x36900e){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x19')](_0x36900e))[_0xb570('0xb')](loggerCatch(_0xb570('0x1a')));};exports[_0xb570('0x1b')]=function(_0x31480c){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x1b')]({'UserId':null},_0x31480c,0x1))[_0xb570('0xb')](loggerCatch(_0xb570('0x1c')));};exports[_0xb570('0x1d')]=function(_0xf11c6a){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x1b')]({'active':![]},_0xf11c6a,0x1))[_0xb570('0xb')](loggerCatch(_0xb570('0x1e')));};exports[_0xb570('0x1f')]=function(_0x1693b3){var _0x4be9bb={};_0x4be9bb[_0xb570('0x20')]=_0x1693b3['type'];_0x4be9bb[_0xb570('0x21')]=_0x1693b3[_0xb570('0x21')];_0x4be9bb[_0xb570('0x22')]=_0x1693b3[_0xb570('0x22')];_0x4be9bb[_0xb570('0x23')]=_0x1693b3[_0xb570('0x23')];_0x4be9bb['queue']=_0x1693b3[_0xb570('0x24')];_0x4be9bb[_0xb570('0x25')]=_0x1693b3[_0xb570('0x26')];_0x4be9bb[_0xb570('0x27')]=_0x1693b3[_0xb570('0x26')];_0x4be9bb[_0xb570('0x28')]=0x1;_0x4be9bb[_0xb570('0x29')]=_0x1693b3[_0xb570('0x2a')];_0x4be9bb[_0xb570('0x2b')]=_0x1693b3[_0xb570('0x2c')];_0x4be9bb[_0xb570('0x2d')]=_0xb570('0x2e');_0x4be9bb[_0xb570('0x2f')]='xcally-motion-preview';_0x4be9bb[_0xb570('0x30')]=0x0;_0x4be9bb[_0xb570('0x31')]=0x1;_0x4be9bb['lastAssignedTo']=_0x1693b3[_0xb570('0x2c')];_0x4be9bb['queuecallerexitreason']=_0xb570('0x32');return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](voiceQueueReport[_0xb570('0x33')](_0x4be9bb))[_0xb570('0xb')](loggerCatch(_0xb570('0x34')));};exports[_0xb570('0x35')]=function(_0x27b59c,_0x18d999){return BPromise[_0xb570('0x9')]()['then'](cmHopper['getContactRecallMe'](_0x27b59c,_0x18d999))[_0xb570('0xb')](loggerCatch(_0xb570('0x36')));};exports[_0xb570('0x37')]=function(_0x218c79){return BPromise[_0xb570('0x9')]()[_0xb570('0xd')](cmHopper[_0xb570('0x16')](_0x218c79,!![],!![]))[_0xb570('0xb')](loggerCatch(_0xb570('0x38')));}; \ 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 50b11c9..29fc02b 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 _0xea86=['dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','UserId','logCustomer','state','talktime','isFailure','Failure','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','channelAgent','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','filterKey','type','campaigntype','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xea86,0x6f));var _0x6ea8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xea86[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x6ea8('0x0'));var _=require(_0x6ea8('0x1'));var moment=require(_0x6ea8('0x2'));var logger=require(_0x6ea8('0x3'))(_0x6ea8('0x4'));var ipAgi=process['env'][_0x6ea8('0x5')]||'127.0.0.1';function getSeconds(_0x1c9063,_0x216454){var _0x28ce23=moment(_0x1c9063)[_0x6ea8('0x6')](0x0);var _0x4ba401=moment(_0x216454)[_0x6ea8('0x6')](0x0);return _0x28ce23[_0x6ea8('0x7')](_0x4ba401,_0x6ea8('0x8'));}exports[_0x6ea8('0x9')]=function(_0xbf21f){return function(_0x3d8fef){logger[_0x6ea8('0xa')](_0xbf21f,util[_0x6ea8('0xb')](_0x3d8fef,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x58a96b,_0x111877){logger[_0x6ea8('0xc')](_0x58a96b,util[_0x6ea8('0xb')](_0x111877,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2691e2,_0x33d267){logger[_0x6ea8('0xa')](_0x2691e2,util[_0x6ea8('0xb')](_0x33d267,{'showHidden':![],'depth':null}));};exports[_0x6ea8('0xd')]=function(_0x3fdb30){return function(_0xbc4a13){logger['info'](_0x3fdb30,util['inspect'](_0xbc4a13,{'showHidden':![],'depth':null}));};};exports[_0x6ea8('0xe')]=function(_0x1d20bd,_0x3a7675,_0x425848){return{'message':_0x1d20bd,'unlock':_0x3a7675,'active':_0x425848};};exports[_0x6ea8('0xf')]=function(_0x569f7f,_0x1c2cb2,_0xb7a279){if(!_[_0x6ea8('0x10')](_0xb7a279)&&_0x6ea8('0x11')===typeof _0xb7a279&&!_[_0x6ea8('0x12')](_0xb7a279)){if(!_[_0x6ea8('0x10')](_0x1c2cb2)&&_0x6ea8('0x11')===typeof _0x1c2cb2&&!_['isEmpty'](_0x1c2cb2)){return util[_0x6ea8('0x13')]('\x22%s\x22\x20<%s>',_0x1c2cb2,_0xb7a279);}return util[_0x6ea8('0x13')]('\x22%s\x22\x20<%s>',_0xb7a279,_0xb7a279);}if(!_[_0x6ea8('0x10')](_0x569f7f)&&_0x6ea8('0x11')===typeof _0x569f7f&&!_['isEmpty'](_0x569f7f)){return _0x569f7f;}return _0x6ea8('0x14');};exports[_0x6ea8('0x15')]=function(_0x5bb649){if(_['isNil'](_0x5bb649)){return![];}return _0x5bb649;};exports[_0x6ea8('0x16')]=function(_0x1ee71f,_0x44647e,_0x16694c,_0x2bff3e,_0x54be53,_0x21654f){var _0x2cc2a7={'XMD-QUEUE':_0x44647e[_0x6ea8('0x17')]?_0x44647e[_0x6ea8('0x17')][_0x6ea8('0x18')]:'','XMD-CALLERID':_0x2bff3e,'XMD-CALLERID-PREVIEW':_0x21654f?util[_0x6ea8('0x13')](_0x6ea8('0x19'),_0x21654f[_0x6ea8('0x1a')],_0x21654f[_0x6ea8('0x1b')]):_0x2bff3e,'XMD-DIALID':_0x54be53,'XMD-CONTACTID':_0x44647e[_0x6ea8('0x1c')],'XMD-CDRTYPE':_0x6ea8('0x1d'),'CALLERID(all)':_0x2bff3e,'XMD-VOICEQUEUEID':_0x44647e[_0x6ea8('0x1e')],'XMD-DIALCHANNEL':_0x16694c,'XMD-DIALTIMEOUT':_0x1ee71f[_0x6ea8('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x6ea8('0x20'),_0x1ee71f['dialQueueProject2']?'g':'',_[_0x6ea8('0x12')](_0x1ee71f['monitor_format'])?'':_0x6ea8('0x21')),'XMD-DIALURL':_0x1ee71f['dialPreviewUrl']||'','XMD-AGI':_0x1ee71f[_0x6ea8('0x22')]?util['format'](_0x6ea8('0x23'),ipAgi,_0x1ee71f[_0x6ea8('0x22')]):_0x6ea8('0x24'),'XMD-AGIAFTER':_0x1ee71f['dialQueueProject2']?util[_0x6ea8('0x13')](_0x6ea8('0x23'),ipAgi,_0x1ee71f['dialQueueProject2']):_0x6ea8('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x21654f?_0x21654f[_0x6ea8('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x21654f?_0x21654f['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x6ea8('0x12')](_0x1ee71f['monitor_format'])){_0x2cc2a7[util[_0x6ea8('0x13')]('%s',_0x6ea8('0x26'))]=_0x1ee71f[_0x6ea8('0x27')];_0x2cc2a7[util[_0x6ea8('0x13')]('%s',_0x6ea8('0x28'))]=_0x54be53;}if(_0x44647e&&_0x44647e['Contact']){for(var _0x486a8c in _0x44647e[_0x6ea8('0x29')]){if(_0x44647e['Contact'][_0x6ea8('0x2a')](_0x486a8c)){if(!_[_0x6ea8('0x2b')](_0x44647e[_0x6ea8('0x29')][_0x486a8c])&&_0x486a8c!=='id'&&_0x486a8c!==_0x6ea8('0x2c')&&_0x486a8c!==_0x6ea8('0x2d')&&_0x486a8c!==_0x6ea8('0x2e')){_0x2cc2a7[util[_0x6ea8('0x13')](_0x6ea8('0x2f'),'XMD-',_[_0x6ea8('0x30')](_0x486a8c))]=_0x44647e[_0x6ea8('0x29')][_0x486a8c];}}}}return _0x2cc2a7;};exports[_0x6ea8('0x31')]=function(_0x412c98){var _0x4eabe5={};for(var _0x5a78a0 in _0x412c98){if(_0x412c98[_0x6ea8('0x2a')](_0x5a78a0)){_0x4eabe5[util[_0x6ea8('0x13')]('%s',_[_0x6ea8('0x32')](_0x5a78a0))]=_0x412c98[_0x5a78a0];}}return{'variables':_0x4eabe5};};exports[_0x6ea8('0x33')]=function(_0x1a3f2a,_0x29a723){if(!_[_0x6ea8('0x2b')](_0x1a3f2a)){if(_0x1a3f2a['hasOwnProperty'](_0x6ea8('0x34'))){if(_0x1a3f2a[_0x6ea8('0x34')]>0x0){_0x1a3f2a[_0x6ea8('0x34')]-=0x1;}else{logger[_0x6ea8('0xa')](_0x6ea8('0x35'),_0x29a723);}}}else{logger[_0x6ea8('0xa')](_0x6ea8('0x36'),_0x29a723);}};exports[_0x6ea8('0x37')]=function(_0x580aef){var _0x4e3bab=moment()[_0x6ea8('0x13')](_0x6ea8('0x38'));_0x580aef['state']=0xd;_0x580aef[_0x6ea8('0x39')]=_0x6ea8('0x3a');_0x580aef[_0x6ea8('0x3b')]=_0x4e3bab;_0x580aef[_0x6ea8('0x3c')]=_0x4e3bab;_0x580aef[_0x6ea8('0x3d')]=_0x4e3bab;};exports[_0x6ea8('0x3e')]=function(_0x2da341,_0x2d1c83,_0xd8a92f){var _0x135a9b=moment()[_0x6ea8('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x2da341['state']=_0x2d1c83;_0x2da341[_0x6ea8('0x39')]=_0xd8a92f;_0x2da341[_0x6ea8('0x3c')]=_0x135a9b;_0x2da341[_0x6ea8('0x3f')]=getSeconds(_0x2da341['responsetime'],_0x2da341[_0x6ea8('0x3b')]);};exports['logLookAgent']=function(_0x350588,_0x45806c,_0x126f04){_0x350588['membername']=_0x45806c;_0x350588[_0x6ea8('0x40')]=_0x126f04;};exports[_0x6ea8('0x41')]=function(_0xa48ba0,_0x340d9c,_0x42e385){var _0x154b1c=moment()[_0x6ea8('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0xa48ba0[_0x6ea8('0x42')]=_0x340d9c;_0xa48ba0['statedesc']=_0x42e385;_0xa48ba0[_0x6ea8('0x3c')]=_0xa48ba0[_0x6ea8('0x3c')]?_0xa48ba0['responsetime']:_0x154b1c;_0xa48ba0[_0x6ea8('0x3d')]=_0xa48ba0[_0x6ea8('0x3d')]?_0xa48ba0[_0x6ea8('0x3d')]:_0x154b1c;_0xa48ba0[_0x6ea8('0x3f')]=getSeconds(_0xa48ba0['responsetime']||0x0,_0xa48ba0[_0x6ea8('0x3b')]||0x0);_0xa48ba0[_0x6ea8('0x43')]=_0xa48ba0['answertime']?getSeconds(_0xa48ba0[_0x6ea8('0x3d')],_0xa48ba0['answertime']):0x0;};exports[_0x6ea8('0x44')]=function(_0x2ef7e8){return _0x2ef7e8===_0x6ea8('0x45');};exports['variablesAction']=function(_0x2752f1,_0x22124a,_0x1cea54,_0x559387,_0x35d730){var _0x391590=_0x559387?'RECALL':_0x2752f1['calleridname'];_0x391590=_0x35d730?'BOOKED':_0x391590;return{'actionid':_0x2752f1[_0x6ea8('0x46')],'action':_0x6ea8('0x47'),'channel':_0x2752f1['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x391590,_0x2752f1[_0x6ea8('0x1b')]),'Exten':'xcally-motion-preview','Context':_0x6ea8('0x48'),'Priority':'1','variable':_0x1cea54,'timeout':(_0x22124a[_0x6ea8('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2752f1['uniqueid']};};exports[_0x6ea8('0x4a')]=function(_0x137872){return _0x137872[_0x6ea8('0x4b')]+_0x137872[_0x6ea8('0x4c')]+_0x137872[_0x6ea8('0x4d')]+_0x137872[_0x6ea8('0x4e')]+_0x137872[_0x6ea8('0x4f')];};exports[_0x6ea8('0x50')]=function(_0x1e8c3a){var _0x2d26d2=_[_0x6ea8('0x51')](_0x1e8c3a);_0x2d26d2[_0x6ea8('0x42')]=0xf;_0x2d26d2[_0x6ea8('0x39')]=_0x6ea8('0x52');return _0x2d26d2;};exports[_0x6ea8('0x53')]=function(_0x51d6b2,_0x4a3228,_0x99c024){var _0x2622f1={};_0x2622f1[_0x4a3228]=_0x51d6b2[_0x4a3228];_0x2622f1[_0x6ea8('0x54')]=![];_0x2622f1[_0x6ea8('0x55')]=moment()['add'](_0x99c024,_0x6ea8('0x56'))['format'](_0x6ea8('0x38'));_0x2622f1[_0x6ea8('0x1c')]=_0x51d6b2[_0x6ea8('0x1c')];_0x2622f1['ListId']=_0x51d6b2[_0x6ea8('0x57')];_0x2622f1[_0x6ea8('0x1e')]=_0x51d6b2['VoiceQueueId']||undefined;return _0x2622f1;};exports[_0x6ea8('0x58')]=function(_0x18b559,_0x16344e){if(!_['isNil'](_0x18b559)){if(_0x18b559[_0x6ea8('0x59')]>0x0){_0x18b559[_0x6ea8('0x59')]-=0x1;}else{logger[_0x6ea8('0xa')](_0x16344e,_0x6ea8('0x5a'));}}else{logger[_0x6ea8('0xa')](_0x16344e,_0x6ea8('0x5b'));}};exports[_0x6ea8('0x5c')]=function(_0x563bc5){if(_0x563bc5<=0x0){return!![];}return![];};exports[_0x6ea8('0x5d')]=function(_0xb255ba,_0x585662,_0x37a6e0){_0xb255ba['lastevent']=_0x585662;_0xb255ba[_0x6ea8('0x18')]=_0xb255ba[_0x6ea8('0x5e')];_0xb255ba['interface']=_0xb255ba[_0x6ea8('0x5f')];if(_0x37a6e0){_0xb255ba[_0x6ea8('0x60')]=_0x37a6e0['mandatoryDisposition'];}return _0xb255ba;};exports[_0x6ea8('0x61')]=function(_0x45eb09){var _0xbbfc91={};_0xbbfc91[_0x6ea8('0x5e')]=_0x45eb09[_0x6ea8('0x5e')];_0xbbfc91[_0x6ea8('0x62')]=_0x45eb09[_0x6ea8('0x5f')];_0xbbfc91['uniqueid']=_0x45eb09['uniqueid'];return _0xbbfc91;};exports[_0x6ea8('0x63')]=function(_0x1a8cfe){var _0x5ea8ad=[];for(var _0x290d6d in _0x1a8cfe){if(_0x1a8cfe['hasOwnProperty'](_0x290d6d)){if(!_[_0x6ea8('0x2b')](_0x1a8cfe[_0x290d6d])&&_0x1a8cfe[_0x290d6d][_0x6ea8('0x42')]===_0x6ea8('0x64')&&_0x1a8cfe[_0x290d6d][_0x6ea8('0x65')]===_0x6ea8('0x66')){_0x5ea8ad[_0x6ea8('0x67')](_0x1a8cfe[_0x290d6d]['id']);}}}return _0x5ea8ad;};exports['getDiff']=function(_0x1ae535){var _0x139566=moment()[_0x6ea8('0x6')](0x0);var _0x51785c=moment(_0x1ae535)['milliseconds'](0x0);return _0x139566[_0x6ea8('0x7')](_0x51785c,_0x6ea8('0x8'));};exports['createBody']=function(_0x2da244){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2da244[_0x6ea8('0x1c')],'ListId':_0x2da244['ListId'],'VoiceQueueId':_0x2da244[_0x6ea8('0x1e')]||undefined,'CampaignId':_0x2da244['CampaignId']||undefined};};exports[_0x6ea8('0x68')]=function(_0x8416d4){if(_0x8416d4===_0x6ea8('0x46')||_0x8416d4==='idContact'||_0x8416d4===_0x6ea8('0x5e')||_0x8416d4===_0x6ea8('0x69')||_0x8416d4===_0x6ea8('0x6a')||_0x8416d4==='dialAnswer'||_0x8416d4===_0x6ea8('0x6b')||_0x8416d4===_0x6ea8('0x5f')||_0x8416d4===_0x6ea8('0x1a')||_0x8416d4===_0x6ea8('0x54')||_0x8416d4===_0x6ea8('0x1b')||_0x8416d4===_0x6ea8('0x55')||_0x8416d4===_0x6ea8('0x4b')||_0x8416d4===_0x6ea8('0x4c')||_0x8416d4===_0x6ea8('0x4d')||_0x8416d4===_0x6ea8('0x6c')||_0x8416d4===_0x6ea8('0x6d')||_0x8416d4===_0x6ea8('0x6e')||_0x8416d4===_0x6ea8('0x6f')||_0x8416d4===_0x6ea8('0x70')||_0x8416d4===_0x6ea8('0x1c')||_0x8416d4===_0x6ea8('0x57')||_0x8416d4===_0x6ea8('0x40')||_0x8416d4===_0x6ea8('0x1e')||_0x8416d4===_0x6ea8('0x71')||_0x8416d4===_0x6ea8('0x72')||_0x8416d4===_0x6ea8('0x73')||_0x8416d4===_0x6ea8('0x74')||_0x8416d4===_0x6ea8('0x75')||_0x8416d4===_0x6ea8('0x76')||_0x8416d4==='xmd-dialtimeout'||_0x8416d4==='xmd-dialoptions'||_0x8416d4==='xmd-dialid'||_0x8416d4===_0x6ea8('0x77')||_0x8416d4===_0x6ea8('0x78')||_0x8416d4===_0x6ea8('0x79')||_0x8416d4===_0x6ea8('0x7a')||_0x8416d4==='xmd-agiafter'||_0x8416d4===_0x6ea8('0x7b')||_0x8416d4===_0x6ea8('0x7c')||_0x8416d4==='rtpaudioqosbridged'||_0x8416d4==='rtpaudioqosjitter'||_0x8416d4==='rtpaudioqosjitterbridged'||_0x8416d4===_0x6ea8('0x7d')||_0x8416d4===_0x6ea8('0x7e')||_0x8416d4===_0x6ea8('0x7f')||_0x8416d4==='rtpaudioqosrttbridged'||_0x8416d4===_0x6ea8('0x7c')||_0x8416d4===_0x6ea8('0x80')||_0x8416d4===_0x6ea8('0x81')||_0x8416d4===_0x6ea8('0x82')||_0x8416d4==='rtpaudioqosloss'||_0x8416d4==='rtpaudioqoslossbridged'||_0x8416d4===_0x6ea8('0x7f')||_0x8416d4===_0x6ea8('0x83')||_0x8416d4===_0x6ea8('0x84')||_0x8416d4===_0x6ea8('0x85')||_0x8416d4===_0x6ea8('0x42')||_0x8416d4===_0x6ea8('0x39')){return![];}return!![];};exports[_0x6ea8('0x86')]=function(_0x210ed1,_0xd1b62c){var _0x467827,_0x1eac32,_0x185828;if(_0xd1b62c<=0x0){_0xd1b62c=0x1;}_0x467827=new RegExp('\x5cw{0,'+_0xd1b62c+'}$');_0x1eac32=Math['pow'](0xa,_0xd1b62c-0x1);_0x185828=Math['pow'](0xa,_0xd1b62c)-0x1;return util['format']('%s',_[_0x6ea8('0x87')](_0x210ed1,_0x467827,_[_0x6ea8('0x88')](_0x1eac32,_0x185828)));};exports[_0x6ea8('0x89')]=function(_0x16cf76){var _0x1f8f10=_0x16cf76[_0x6ea8('0x8a')](/"(.*?)"/);return _0x1f8f10?_0x1f8f10[0x1]:_0x16cf76;};exports[_0x6ea8('0x8b')]=function(_0x52f022){var _0x4127f5=_0x52f022[_0x6ea8('0x8a')](/<(.*?)>/);return _0x4127f5?_0x4127f5[0x1]:_0x52f022;}; \ No newline at end of file +var _0x8bad=['endtime','logAgent','statedesc','responsetime','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','BOOKED','uniqueid','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','scheduledAt','active','add','minutes','ListId','pTalking','IsNotLoggedIn','lastevent','queue','interface','mandatoryDisposition','buildAcw','status','reachable','getDiff','diff','createBody','CampaignId','filterKey','campaigntype','dialAnswer','scheduledat','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','random','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','loggerError','error','logger2','info','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist'];(function(_0x3e5215,_0x12f605){var _0x11575a=function(_0x5b9bf5){while(--_0x5b9bf5){_0x3e5215['push'](_0x3e5215['shift']());}};_0x11575a(++_0x12f605);}(_0x8bad,0x1e3));var _0xd8ba=function(_0x1b9ef3,_0x413f87){_0x1b9ef3=_0x1b9ef3-0x0;var _0x17ea24=_0x8bad[_0x1b9ef3];return _0x17ea24;};'use strict';var util=require(_0xd8ba('0x0'));var _=require(_0xd8ba('0x1'));var moment=require('moment');var logger=require(_0xd8ba('0x2'))(_0xd8ba('0x3'));var ipAgi=process[_0xd8ba('0x4')]['XCALLY_IP_AGI']||_0xd8ba('0x5');function getSeconds(_0x4f02a2,_0x45cb26){var _0x5c4496=moment(_0x4f02a2)[_0xd8ba('0x6')](0x0);var _0x5eaae1=moment(_0x45cb26)[_0xd8ba('0x6')](0x0);return _0x5c4496['diff'](_0x5eaae1,_0xd8ba('0x7'));}exports[_0xd8ba('0x8')]=function(_0x135338){return function(_0x1bbee1){logger['error'](_0x135338,util[_0xd8ba('0x9')](_0x1bbee1,{'showHidden':![],'depth':null}));};};exports[_0xd8ba('0xa')]=function(_0x27563a,_0x5b0839){logger['info'](_0x27563a,util['inspect'](_0x5b0839,{'showHidden':![],'depth':null}));};exports[_0xd8ba('0xb')]=function(_0x19d502,_0x921e4a){logger[_0xd8ba('0xc')](_0x19d502,util['inspect'](_0x921e4a,{'showHidden':![],'depth':null}));};exports[_0xd8ba('0xd')]=function(_0x169257){return function(_0x32e226){logger[_0xd8ba('0xe')](_0x169257,util[_0xd8ba('0x9')](_0x32e226,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x140434,_0x38d159,_0x365b1f){return{'message':_0x140434,'unlock':_0x38d159,'active':_0x365b1f};};exports[_0xd8ba('0xf')]=function(_0x229bef,_0x4595c1,_0xbdd832){if(!_[_0xd8ba('0x10')](_0xbdd832)&&'string'===typeof _0xbdd832&&!_[_0xd8ba('0x11')](_0xbdd832)){if(!_['isUndefined'](_0x4595c1)&&_0xd8ba('0x12')===typeof _0x4595c1&&!_[_0xd8ba('0x11')](_0x4595c1)){return util[_0xd8ba('0x13')](_0xd8ba('0x14'),_0x4595c1,_0xbdd832);}return util[_0xd8ba('0x13')](_0xd8ba('0x14'),_0xbdd832,_0xbdd832);}if(!_[_0xd8ba('0x10')](_0x229bef)&&'string'===typeof _0x229bef&&!_[_0xd8ba('0x11')](_0x229bef)){return _0x229bef;}return _0xd8ba('0x15');};exports[_0xd8ba('0x16')]=function(_0x390fc1){if(_[_0xd8ba('0x17')](_0x390fc1)){return![];}return _0x390fc1;};exports[_0xd8ba('0x18')]=function(_0x46bb52,_0x399847,_0x270985,_0x5f4571,_0x72a242,_0x1ee7cc){var _0x478169={'XMD-QUEUE':_0x399847[_0xd8ba('0x19')]?_0x399847['Queue'][_0xd8ba('0x1a')]:'','XMD-CALLERID':_0x5f4571,'XMD-CALLERID-PREVIEW':_0x1ee7cc?util[_0xd8ba('0x13')]('\x22%s\x22\x20<%s>',_0x1ee7cc[_0xd8ba('0x1b')],_0x1ee7cc[_0xd8ba('0x1c')]):_0x5f4571,'XMD-DIALID':_0x72a242,'XMD-CONTACTID':_0x399847[_0xd8ba('0x1d')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5f4571,'XMD-VOICEQUEUEID':_0x399847[_0xd8ba('0x1e')],'XMD-DIALCHANNEL':_0x270985,'XMD-DIALTIMEOUT':_0x46bb52[_0xd8ba('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xd8ba('0x20'),_0x46bb52['dialQueueProject2']?'g':'',_[_0xd8ba('0x11')](_0x46bb52[_0xd8ba('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x46bb52[_0xd8ba('0x22')]||'','XMD-AGI':_0x46bb52[_0xd8ba('0x23')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x46bb52[_0xd8ba('0x23')]):'NONE','XMD-AGIAFTER':_0x46bb52[_0xd8ba('0x24')]?util[_0xd8ba('0x13')](_0xd8ba('0x25'),ipAgi,_0x46bb52[_0xd8ba('0x24')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1ee7cc?_0x1ee7cc[_0xd8ba('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x1ee7cc?_0x1ee7cc['originatecalleridname']:'','XMD-DESTINATION':_0xd8ba('0x27')};if(!_[_0xd8ba('0x11')](_0x46bb52['monitor_format'])){_0x478169[util['format']('%s',_0xd8ba('0x28'))]=_0x46bb52[_0xd8ba('0x21')];_0x478169[util[_0xd8ba('0x13')]('%s',_0xd8ba('0x29'))]=_0x72a242;}if(_0x399847&&_0x399847[_0xd8ba('0x2a')]){for(var _0x5df779 in _0x399847['Contact']){if(_0x399847['Contact'][_0xd8ba('0x2b')](_0x5df779)){if(!_[_0xd8ba('0x17')](_0x399847['Contact'][_0x5df779])&&_0x5df779!=='id'&&_0x5df779!=='tags'&&_0x5df779!==_0xd8ba('0x2c')&&_0x5df779!==_0xd8ba('0x2d')){_0x478169[util['format'](_0xd8ba('0x2e'),'XMD-',_[_0xd8ba('0x2f')](_0x5df779))]=_0x399847[_0xd8ba('0x2a')][_0x5df779];}}}}return _0x478169;};exports[_0xd8ba('0x30')]=function(_0x25ad8a){var _0x389405={};for(var _0x5724c5 in _0x25ad8a){if(_0x25ad8a[_0xd8ba('0x2b')](_0x5724c5)){_0x389405[util[_0xd8ba('0x13')]('%s',_[_0xd8ba('0x31')](_0x5724c5))]=_0x25ad8a[_0x5724c5];}}return{'variables':_0x389405};};exports[_0xd8ba('0x32')]=function(_0xa3b6a3,_0x2ba9da){if(!_[_0xd8ba('0x17')](_0xa3b6a3)){if(_0xa3b6a3[_0xd8ba('0x2b')](_0xd8ba('0x33'))){if(_0xa3b6a3[_0xd8ba('0x33')]>0x0){_0xa3b6a3[_0xd8ba('0x33')]-=0x1;}else{logger[_0xd8ba('0xc')](_0xd8ba('0x34'),_0x2ba9da);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2ba9da);}};exports[_0xd8ba('0x35')]=function(_0x29cb08){var _0x5041e0=moment()[_0xd8ba('0x13')](_0xd8ba('0x36'));_0x29cb08[_0xd8ba('0x37')]=0xd;_0x29cb08['statedesc']=_0xd8ba('0x38');_0x29cb08['starttime']=_0x5041e0;_0x29cb08['responsetime']=_0x5041e0;_0x29cb08[_0xd8ba('0x39')]=_0x5041e0;};exports[_0xd8ba('0x3a')]=function(_0x114dde,_0x37f3ab,_0x2139b4){var _0x1c1296=moment()[_0xd8ba('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x114dde[_0xd8ba('0x37')]=_0x37f3ab;_0x114dde[_0xd8ba('0x3b')]=_0x2139b4;_0x114dde[_0xd8ba('0x3c')]=_0x1c1296;_0x114dde[_0xd8ba('0x3d')]=getSeconds(_0x114dde[_0xd8ba('0x3c')],_0x114dde[_0xd8ba('0x3e')]);};exports[_0xd8ba('0x3f')]=function(_0x189b66,_0xb7f16f,_0x452a81){_0x189b66[_0xd8ba('0x40')]=_0xb7f16f;_0x189b66[_0xd8ba('0x41')]=_0x452a81;};exports[_0xd8ba('0x42')]=function(_0x37ff52,_0x4b6a3b,_0x272c08){var _0x5cad78=moment()[_0xd8ba('0x13')](_0xd8ba('0x36'));_0x37ff52['state']=_0x4b6a3b;_0x37ff52[_0xd8ba('0x3b')]=_0x272c08;_0x37ff52[_0xd8ba('0x3c')]=_0x37ff52[_0xd8ba('0x3c')]?_0x37ff52[_0xd8ba('0x3c')]:_0x5cad78;_0x37ff52['endtime']=_0x37ff52[_0xd8ba('0x39')]?_0x37ff52['endtime']:_0x5cad78;_0x37ff52['ringtime']=getSeconds(_0x37ff52['responsetime']||0x0,_0x37ff52[_0xd8ba('0x3e')]||0x0);_0x37ff52[_0xd8ba('0x43')]=_0x37ff52[_0xd8ba('0x44')]?getSeconds(_0x37ff52[_0xd8ba('0x39')],_0x37ff52[_0xd8ba('0x44')]):0x0;};exports[_0xd8ba('0x45')]=function(_0x39d64e){return _0x39d64e===_0xd8ba('0x46');};exports['variablesAction']=function(_0xd99356,_0x3c1a07,_0x4d291a,_0xa65c6e,_0x4a58de){var _0xa2e936=_0xa65c6e?'RECALL':_0xd99356[_0xd8ba('0x1b')];_0xa2e936=_0x4a58de?_0xd8ba('0x47'):_0xa2e936;return{'actionid':_0xd99356[_0xd8ba('0x48')],'action':'originate','channel':_0xd99356[_0xd8ba('0x49')],'callerid':util[_0xd8ba('0x13')](_0xd8ba('0x14'),_0xa2e936,_0xd99356[_0xd8ba('0x1c')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x4d291a,'timeout':(_0x3c1a07[_0xd8ba('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0xd99356[_0xd8ba('0x48')]};};exports[_0xd8ba('0x4b')]=function(_0xbe228c){return _0xbe228c[_0xd8ba('0x4c')]+_0xbe228c[_0xd8ba('0x4d')]+_0xbe228c[_0xd8ba('0x4e')]+_0xbe228c['countagentrejectretry']+_0xbe228c[_0xd8ba('0x4f')];};exports['cloneAction']=function(_0xf2937e){var _0x1d58c=_[_0xd8ba('0x50')](_0xf2937e);_0x1d58c[_0xd8ba('0x37')]=0xf;_0x1d58c['statedesc']=_0xd8ba('0x51');return _0x1d58c;};exports[_0xd8ba('0x52')]=function(_0x413022,_0x18f7ca,_0x158961){var _0x287f89={};_0x287f89[_0x18f7ca]=_0x413022[_0x18f7ca];_0x287f89[_0xd8ba('0x53')]=![];_0x287f89['scheduledat']=moment()[_0xd8ba('0x54')](_0x158961,_0xd8ba('0x55'))[_0xd8ba('0x13')](_0xd8ba('0x36'));_0x287f89[_0xd8ba('0x1d')]=_0x413022[_0xd8ba('0x1d')];_0x287f89[_0xd8ba('0x56')]=_0x413022[_0xd8ba('0x56')];_0x287f89[_0xd8ba('0x1e')]=_0x413022[_0xd8ba('0x1e')]||undefined;return _0x287f89;};exports['decrementTalkink']=function(_0xaa1d03,_0x325b56){if(!_['isNil'](_0xaa1d03)){if(_0xaa1d03[_0xd8ba('0x57')]>0x0){_0xaa1d03[_0xd8ba('0x57')]-=0x1;}else{logger[_0xd8ba('0xc')](_0x325b56,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xd8ba('0xc')](_0x325b56,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xd8ba('0x58')]=function(_0x4b6da9){if(_0x4b6da9<=0x0){return!![];}return![];};exports['buildObj']=function(_0x2442c2,_0x3562ca,_0x2d5de1){_0x2442c2[_0xd8ba('0x59')]=_0x3562ca;_0x2442c2['name']=_0x2442c2[_0xd8ba('0x5a')];_0x2442c2[_0xd8ba('0x5b')]=_0x2442c2[_0xd8ba('0x49')];if(_0x2d5de1){_0x2442c2[_0xd8ba('0x5c')]=_0x2d5de1[_0xd8ba('0x5c')];}return _0x2442c2;};exports[_0xd8ba('0x5d')]=function(_0x2e472e){var _0x44408d={};_0x44408d[_0xd8ba('0x5a')]=_0x2e472e[_0xd8ba('0x5a')];_0x44408d[_0xd8ba('0x5b')]=_0x2e472e[_0xd8ba('0x49')];_0x44408d[_0xd8ba('0x48')]=_0x2e472e[_0xd8ba('0x48')];return _0x44408d;};exports['agentReadyId']=function(_0x302365){var _0x1c88af=[];for(var _0x392c96 in _0x302365){if(_0x302365[_0xd8ba('0x2b')](_0x392c96)){if(!_[_0xd8ba('0x17')](_0x302365[_0x392c96])&&_0x302365[_0x392c96][_0xd8ba('0x37')]==='not_inuse'&&_0x302365[_0x392c96][_0xd8ba('0x5e')]===_0xd8ba('0x5f')){_0x1c88af['push'](_0x302365[_0x392c96]['id']);}}}return _0x1c88af;};exports[_0xd8ba('0x60')]=function(_0x529864){var _0x1fc9b0=moment()[_0xd8ba('0x6')](0x0);var _0x4c6b69=moment(_0x529864)['milliseconds'](0x0);return _0x1fc9b0[_0xd8ba('0x61')](_0x4c6b69,_0xd8ba('0x7'));};exports[_0xd8ba('0x62')]=function(_0x40c03b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x40c03b[_0xd8ba('0x1d')],'ListId':_0x40c03b[_0xd8ba('0x56')],'VoiceQueueId':_0x40c03b[_0xd8ba('0x1e')]||undefined,'CampaignId':_0x40c03b[_0xd8ba('0x63')]||undefined};};exports[_0xd8ba('0x64')]=function(_0x315448){if(_0x315448==='uniqueid'||_0x315448==='idContact'||_0x315448===_0xd8ba('0x5a')||_0x315448==='type'||_0x315448===_0xd8ba('0x65')||_0x315448===_0xd8ba('0x66')||_0x315448==='membername'||_0x315448===_0xd8ba('0x49')||_0x315448===_0xd8ba('0x1b')||_0x315448===_0xd8ba('0x53')||_0x315448===_0xd8ba('0x1c')||_0x315448===_0xd8ba('0x67')||_0x315448==='countbusyretry'||_0x315448===_0xd8ba('0x4d')||_0x315448===_0xd8ba('0x4e')||_0x315448==='countglobal'||_0x315448===_0xd8ba('0x68')||_0x315448===_0xd8ba('0x69')||_0x315448==='callbackat'||_0x315448===_0xd8ba('0x6a')||_0x315448==='ContactId'||_0x315448===_0xd8ba('0x56')||_0x315448==='UserId'||_0x315448==='VoiceQueueId'||_0x315448===_0xd8ba('0x6b')||_0x315448===_0xd8ba('0x6c')||_0x315448===_0xd8ba('0x6d')||_0x315448===_0xd8ba('0x6e')||_0x315448===_0xd8ba('0x6f')||_0x315448===_0xd8ba('0x70')||_0x315448===_0xd8ba('0x71')||_0x315448===_0xd8ba('0x72')||_0x315448===_0xd8ba('0x73')||_0x315448===_0xd8ba('0x74')||_0x315448===_0xd8ba('0x75')||_0x315448==='xmd-cdrtype'||_0x315448===_0xd8ba('0x76')||_0x315448===_0xd8ba('0x77')||_0x315448===_0xd8ba('0x78')||_0x315448===_0xd8ba('0x79')||_0x315448===_0xd8ba('0x7a')||_0x315448===_0xd8ba('0x7b')||_0x315448==='rtpaudioqosjitterbridged'||_0x315448===_0xd8ba('0x7c')||_0x315448==='rtpaudioqoslossbridged'||_0x315448==='rtpaudioqosrtt'||_0x315448==='rtpaudioqosrttbridged'||_0x315448==='rtpaudioqos'||_0x315448===_0xd8ba('0x7a')||_0x315448==='rtpaudioqosjitter'||_0x315448==='rtpaudioqosjitterbridged'||_0x315448===_0xd8ba('0x7c')||_0x315448===_0xd8ba('0x7d')||_0x315448==='rtpaudioqosrtt'||_0x315448===_0xd8ba('0x7e')||_0x315448===_0xd8ba('0x7f')||_0x315448===_0xd8ba('0x80')||_0x315448===_0xd8ba('0x37')||_0x315448==='statedesc'){return![];}return!![];};exports[_0xd8ba('0x81')]=function(_0x154af7,_0x3709cb){var _0xa15c1,_0x26283d,_0x4b8606;if(_0x3709cb<=0x0){_0x3709cb=0x1;}_0xa15c1=new RegExp(_0xd8ba('0x82')+_0x3709cb+'}$');_0x26283d=Math['pow'](0xa,_0x3709cb-0x1);_0x4b8606=Math['pow'](0xa,_0x3709cb)-0x1;return util[_0xd8ba('0x13')]('%s',_[_0xd8ba('0x83')](_0x154af7,_0xa15c1,_[_0xd8ba('0x84')](_0x26283d,_0x4b8606)));};exports['extractCalleridName']=function(_0x4792b8){var _0x169294=_0x4792b8[_0xd8ba('0x85')](/"(.*?)"/);return _0x169294?_0x169294[0x1]:_0x4792b8;};exports[_0xd8ba('0x86')]=function(_0x1f5042){var _0x28fe1a=_0x1f5042[_0xd8ba('0x85')](/<(.*?)>/);return _0x28fe1a?_0x28fe1a[0x1]:_0x1f5042;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4fe5137..c2cf4bc 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 _0x6a57=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0xf5007c,_0x36d2d1){var _0x2c8d56=function(_0x363a4c){while(--_0x363a4c){_0xf5007c['push'](_0xf5007c['shift']());}};_0x2c8d56(++_0x36d2d1);}(_0x6a57,0x75));var _0x76a5=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0x6a57[_0x3b3210];return _0x5b5484;};'use strict';exports[_0x76a5('0x0')]={'queue':{'type':_0x76a5('0x1'),'required':!![]},'interface':{'type':_0x76a5('0x1'),'required':!![]},'membername':{'type':_0x76a5('0x1'),'required':!![]},'penalty':{'type':_0x76a5('0x2'),'required':![]},'paused':{'type':_0x76a5('0x3'),'required':![]}};exports[_0x76a5('0x4')]={'queue':{'type':_0x76a5('0x1'),'required':!![]},'interface':{'type':_0x76a5('0x1'),'required':!![]}};exports[_0x76a5('0x5')]={'interface':{'type':_0x76a5('0x1'),'required':!![]},'paused':{'type':_0x76a5('0x3')},'reason':{'type':_0x76a5('0x1'),'required':![]}};exports[_0x76a5('0x6')]={'module':{'type':_0x76a5('0x1'),'required':![]}};exports[_0x76a5('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x76a5('0x1'),'required':!![]},'filename':{'type':_0x76a5('0x1')},'format':{'type':_0x76a5('0x1')},'mixmonitorid':{'type':_0x76a5('0x1')}};exports[_0x76a5('0x8')]={'uniqueid':{'type':_0x76a5('0x1'),'required':!![]}};exports[_0x76a5('0x9')]={'uniqueid':{'type':_0x76a5('0x1'),'required':!![]},'exten':{'type':_0x76a5('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x9350=['voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','boolean','queuepause','reload'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9350,0x8b));var _0x0935=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0x9350[_0x4cf0b7];return _0x545f10;};'use strict';exports[_0x0935('0x0')]={'queue':{'type':_0x0935('0x1'),'required':!![]},'interface':{'type':_0x0935('0x1'),'required':!![]},'membername':{'type':_0x0935('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x0935('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x0935('0x1'),'required':!![]},'interface':{'type':_0x0935('0x1'),'required':!![]}};exports[_0x0935('0x3')]={'interface':{'type':_0x0935('0x1'),'required':!![]},'paused':{'type':_0x0935('0x2')},'reason':{'type':_0x0935('0x1'),'required':![]}};exports[_0x0935('0x4')]={'module':{'type':'string','required':![]}};exports[_0x0935('0x5')]={'uniqueid':{'type':_0x0935('0x1'),'required':!![]}};exports[_0x0935('0x6')]={'uniqueid':{'type':_0x0935('0x1'),'required':!![]},'filename':{'type':_0x0935('0x1')},'format':{'type':_0x0935('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x0935('0x7')]={'uniqueid':{'type':_0x0935('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x0935('0x1'),'required':!![]},'exten':{'type':_0x0935('0x1'),'required':!![]},'context':{'type':_0x0935('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6aa8cc1..3323571 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 _0x97b5=['initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','unmanaged','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','merge','bluebird','util','lodash','moment','../model/agent','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','initTrunks','trunks','initVoiceQueues','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','freshdeskAccounts','initZohoAccounts'];(function(_0x524a15,_0x25fd5a){var _0x558a4f=function(_0x23fe94){while(--_0x23fe94){_0x524a15['push'](_0x524a15['shift']());}};_0x558a4f(++_0x25fd5a);}(_0x97b5,0xea));var _0x597b=function(_0x5cf90e,_0x5df405){_0x5cf90e=_0x5cf90e-0x0;var _0xae958d=_0x97b5[_0x5cf90e];return _0xae958d;};'use strict';var BPromise=require(_0x597b('0x0'));var util=require(_0x597b('0x1'));var _=require(_0x597b('0x2'));var moment=require(_0x597b('0x3'));var Agent=require(_0x597b('0x4'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0x597b('0x5'));var Trigger=require(_0x597b('0x6'));var Template=require('../model/template');var Campaign=require(_0x597b('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x597b('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x597b('0x9'));var SugarcrmAccount=require(_0x597b('0xa'));var ZohoAccount=require(_0x597b('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x597b('0xc'));var ServicenowAccount=require(_0x597b('0xd'));var Dynamics365Account=require(_0x597b('0xe'));var FreshsalesAccount=require(_0x597b('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x597b('0x10')]={};this[_0x597b('0x11')]={};this['trunks']={};this[_0x597b('0x12')]={};this[_0x597b('0x13')]={};this[_0x597b('0x14')]={};this[_0x597b('0x15')]={};this[_0x597b('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x597b('0x17')]={};this[_0x597b('0x18')]={};this[_0x597b('0x19')]={};this[_0x597b('0x1a')]={};this['timers']={};this[_0x597b('0x1b')]={};this['zendeskAccounts']={};this[_0x597b('0x1c')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0x597b('0x1d')]={};this[_0x597b('0x1e')]={};this[_0x597b('0x1f')]={};this[_0x597b('0x20')]={};this[_0x597b('0x21')]={};this[_0x597b('0x22')]={};this[_0x597b('0x23')]={};};function freeIsNotKey(_0x15832d,_0x6c13ac,_0x43f977){var _0x1aab02=_[_0x597b('0x24')](_0x15832d,function(_0x538102,_0x40509d){return _0x538102[_0x43f977];});for(var _0x1efcc5 in _0x6c13ac){if(_0x6c13ac[_0x597b('0x25')](_0x1efcc5)){if(!_0x1aab02[_0x1efcc5]){delete _0x6c13ac[_0x1efcc5];}}}}function freeIsNotKeySip(_0x2808a7,_0x144344){var _0x2584e1=_['mapKeys'](_0x2808a7,function(_0x2a2eb3,_0x180d43){return util[_0x597b('0x26')]('SIP/%s',_0x2a2eb3[_0x597b('0x27')]);});for(var _0x393fc5 in _0x144344){if(_0x144344['hasOwnProperty'](_0x393fc5)){if(!_0x2584e1[_0x393fc5]){delete _0x144344[_0x393fc5];}}}}function freeIsNotKeyAgent(_0x511390,_0x2aba65){var _0x1cd7f1=_[_0x597b('0x24')](_0x511390,function(_0x3e2bc5,_0x146aee){var _0x5c9330=_[_0x597b('0x28')](_0x3e2bc5[_0x597b('0x29')])?util[_0x597b('0x26')](_0x597b('0x2a'),_0x3e2bc5['name']):_0x3e2bc5[_0x597b('0x29')];return _0x5c9330;});for(var _0x251496 in _0x2aba65){if(_0x2aba65['hasOwnProperty'](_0x251496)){if(!_0x1cd7f1[_0x251496]){delete _0x2aba65[_0x251496];}}}}function clearVoiceCallReports(_0x54327f){_0x54327f[_0x597b('0x2b')]=0x0;_0x54327f[_0x597b('0x2c')]=0x0;_0x54327f[_0x597b('0x2d')]=0x0;_0x54327f[_0x597b('0x2e')]=0x0;_0x54327f['sumBillable']=0x0;}function clearCampaigns(_0x262a52){if(!_['isEmpty'](_0x262a52)){for(var _0x4b9f6d in _0x262a52){if(_0x262a52[_0x597b('0x25')](_0x4b9f6d)){_0x262a52[_0x4b9f6d][_0x597b('0x2f')]=0x0;_0x262a52[_0x4b9f6d][_0x597b('0x30')]=0x0;}}}}function clearVoiceQueues(_0x5aeb19){if(!_[_0x597b('0x31')](_0x5aeb19)){for(var _0x31bc70 in _0x5aeb19){if(_0x5aeb19[_0x597b('0x25')](_0x31bc70)){_0x5aeb19[_0x31bc70]['total']=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x2c')]=0x0;_0x5aeb19[_0x31bc70]['unmanaged']=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x32')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x2d')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x2e')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x33')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x34')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x35')]=0x0;_0x5aeb19[_0x31bc70]['outboundBusyCallsDay']=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x36')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x37')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x38')]=0x0;_0x5aeb19[_0x31bc70]['outboundDropCallsDayTimeout']=0x0;_0x5aeb19[_0x31bc70]['outboundDropCallsDayCallersExit']=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x39')]=0x0;_0x5aeb19[_0x31bc70]['outboundOriginateFailureCallsDay']=0x0;_0x5aeb19[_0x31bc70]['outboundRejectCallsDay']=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x3a')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x34')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x3b')]=0x0;_0x5aeb19[_0x31bc70][_0x597b('0x3c')]=!![];}}}}Realtime[_0x597b('0x3d')][_0x597b('0x3e')]=function(_0x2a4238,_0x413be2){for(var _0x3e2d12 in _0x413be2){if(_0x2a4238['hasOwnProperty'](_0x3e2d12)){_0x2a4238[_0x3e2d12]=_0x413be2[_0x3e2d12];}}};Realtime['prototype']['initAgents']=function(){var _0x5a1fdd=this;return function(_0x52346d){if(_0x52346d){freeIsNotKeyAgent(_0x52346d,_0x5a1fdd['agents']);for(var _0x394f07=0x0,_0x46220b={},_0x2e65c2={};_0x394f07<_0x52346d[_0x597b('0x3f')];_0x394f07+=0x1){_0x46220b=_0x52346d[_0x394f07];var _0x23d569=_[_0x597b('0x28')](_0x46220b[_0x597b('0x29')])?util[_0x597b('0x26')](_0x597b('0x2a'),_0x46220b[_0x597b('0x27')]):_0x46220b[_0x597b('0x29')];if(_[_0x597b('0x40')](_0x5a1fdd['agents'][_0x23d569])){_0x5a1fdd[_0x597b('0x10')][_0x23d569]=new Agent(_0x46220b);}else{_0x5a1fdd[_0x597b('0x3e')](_0x5a1fdd['agents'][_0x23d569],_0x46220b);}}}return _0x5a1fdd[_0x597b('0x10')];};};Realtime[_0x597b('0x3d')][_0x597b('0x41')]=function(){var _0x396010=this;return function(_0x32d4b1){if(_0x32d4b1){freeIsNotKeySip(_0x32d4b1,_0x396010[_0x597b('0x11')]);for(var _0x11152d=0x0,_0x39425c={},_0x2052b0={};_0x11152d<_0x32d4b1[_0x597b('0x3f')];_0x11152d+=0x1){_0x39425c=_0x32d4b1[_0x11152d];if(_[_0x597b('0x40')](_0x396010[_0x597b('0x11')][util['format'](_0x597b('0x2a'),_0x39425c[_0x597b('0x27')])])){_0x396010[_0x597b('0x11')][util[_0x597b('0x26')](_0x597b('0x2a'),_0x39425c[_0x597b('0x27')])]=new Telephone(_0x39425c);}else{_0x396010[_0x597b('0x3e')](_0x396010[_0x597b('0x11')][util[_0x597b('0x26')](_0x597b('0x2a'),_0x39425c[_0x597b('0x27')])],_0x39425c);}}}return _0x396010['telephones'];};};Realtime['prototype'][_0x597b('0x42')]=function(){var _0x35c1d3=this;return function(_0x4acfb4){if(_0x4acfb4){freeIsNotKeySip(_0x4acfb4,_0x35c1d3['trunks']);for(var _0x3fd456=0x0,_0x12655d={},_0x48697f={};_0x3fd456<_0x4acfb4['length'];_0x3fd456+=0x1){_0x12655d=_0x4acfb4[_0x3fd456];if(_['isUndefined'](_0x35c1d3['trunks'][util[_0x597b('0x26')](_0x597b('0x2a'),_0x12655d[_0x597b('0x27')])])){_0x35c1d3[_0x597b('0x43')][util[_0x597b('0x26')](_0x597b('0x2a'),_0x12655d[_0x597b('0x27')])]=new Trunk(_0x12655d);}else{_0x35c1d3[_0x597b('0x3e')](_0x35c1d3[_0x597b('0x43')][util[_0x597b('0x26')](_0x597b('0x2a'),_0x12655d[_0x597b('0x27')])],_0x12655d);}}}return _0x35c1d3[_0x597b('0x43')];};};Realtime[_0x597b('0x3d')][_0x597b('0x44')]=function(){var _0x90dbb=this;return function(_0x10267c){if(_0x10267c){freeIsNotKey(_0x10267c,_0x90dbb['voiceQueues'],_0x597b('0x27'));for(var _0xd85ce7=0x0,_0x69ecdc={},_0x235aae={};_0xd85ce7<_0x10267c['length'];_0xd85ce7+=0x1){_0x69ecdc=_0x10267c[_0xd85ce7];if(_[_0x597b('0x40')](_0x90dbb[_0x597b('0x12')][_0x69ecdc[_0x597b('0x27')]])){_0x90dbb[_0x597b('0x12')][_0x69ecdc[_0x597b('0x27')]]=new VoiceQueue(_0x69ecdc);}else{_0x90dbb['mergeFromDatabase'](_0x90dbb[_0x597b('0x12')][_0x69ecdc['name']],_0x69ecdc);}}}return _0x90dbb['voiceQueues'];};};Realtime[_0x597b('0x3d')]['initTriggers']=function(){var _0x229b4a=this;return function(_0x5374b3){if(_0x5374b3){freeIsNotKey(_0x5374b3,_0x229b4a[_0x597b('0x13')],'id');for(var _0x4552fd=0x0,_0x6db7cd={},_0x31bd5c={};_0x4552fd<_0x5374b3['length'];_0x4552fd+=0x1){_0x6db7cd=_0x5374b3[_0x4552fd];if(_[_0x597b('0x40')](_0x229b4a[_0x597b('0x13')][_0x6db7cd['id']])){_0x229b4a[_0x597b('0x13')][_0x6db7cd['id']]=new Trigger(_0x6db7cd);}else{_0x229b4a[_0x597b('0x3e')](_0x229b4a[_0x597b('0x13')][_0x6db7cd['id']],_0x6db7cd);}}}return _0x229b4a['triggers'];};};Realtime[_0x597b('0x3d')][_0x597b('0x45')]=function(){var _0x304c0e=this;return function(_0x3025df){if(_0x3025df){freeIsNotKey(_0x3025df,_0x304c0e[_0x597b('0x15')],'id');for(var _0x46261c=0x0,_0x43f4f1={},_0x253ad6={};_0x46261c<_0x3025df[_0x597b('0x3f')];_0x46261c+=0x1){_0x43f4f1=_0x3025df[_0x46261c];if(_[_0x597b('0x40')](_0x304c0e[_0x597b('0x15')][_0x43f4f1['id']])){_0x304c0e[_0x597b('0x15')][_0x43f4f1['id']]=new Template(_0x43f4f1);}else{_0x304c0e[_0x597b('0x3e')](_0x304c0e[_0x597b('0x15')][_0x43f4f1['id']],_0x43f4f1);}}}return _0x304c0e[_0x597b('0x15')];};};Realtime['prototype'][_0x597b('0x46')]=function(){var _0x33c2bf=this;return function(_0x425798){if(_0x425798){freeIsNotKey(_0x425798,_0x33c2bf[_0x597b('0x47')],'id');for(var _0x1d9c94=0x0,_0x1855b1={},_0x347a3e={};_0x1d9c94<_0x425798[_0x597b('0x3f')];_0x1d9c94+=0x1){_0x1855b1=_0x425798[_0x1d9c94];if(_[_0x597b('0x40')](_0x33c2bf[_0x597b('0x47')][_0x1855b1['id']])){_0x33c2bf[_0x597b('0x47')][_0x1855b1['id']]=new ZendeskAccount(_0x1855b1);}else{_0x33c2bf['mergeFromDatabase'](_0x33c2bf[_0x597b('0x47')][_0x1855b1['id']],_0x1855b1);}}}return _0x33c2bf[_0x597b('0x47')];};};Realtime[_0x597b('0x3d')][_0x597b('0x48')]=function(){var _0x241826=this;return function(_0x166179){if(_0x166179){freeIsNotKey(_0x166179,_0x241826[_0x597b('0x1c')],'id');for(var _0x4d815b=0x0,_0x5c2a52={},_0x1bca0f={};_0x4d815b<_0x166179[_0x597b('0x3f')];_0x4d815b+=0x1){_0x5c2a52=_0x166179[_0x4d815b];if(_[_0x597b('0x40')](_0x241826[_0x597b('0x1c')][_0x5c2a52['id']])){_0x241826[_0x597b('0x1c')][_0x5c2a52['id']]=new SalesforceAccount(_0x5c2a52);}else{_0x241826[_0x597b('0x3e')](_0x241826[_0x597b('0x1c')][_0x5c2a52['id']],_0x5c2a52);}}}return _0x241826[_0x597b('0x1c')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x3550db=this;return function(_0x3ecd66){if(_0x3ecd66){freeIsNotKey(_0x3ecd66,_0x3550db['freshdeskAccounts'],'id');for(var _0x2a785f=0x0,_0x378012={},_0x484e66={};_0x2a785f<_0x3ecd66['length'];_0x2a785f+=0x1){_0x378012=_0x3ecd66[_0x2a785f];if(_['isUndefined'](_0x3550db[_0x597b('0x49')][_0x378012['id']])){_0x3550db[_0x597b('0x49')][_0x378012['id']]=new FreshdeskAccount(_0x378012);}else{_0x3550db['mergeFromDatabase'](_0x3550db['freshdeskAccounts'][_0x378012['id']],_0x378012);}}}return _0x3550db[_0x597b('0x49')];};};Realtime[_0x597b('0x3d')][_0x597b('0x4a')]=function(){var _0x35cc0f=this;return function(_0x20782a){if(_0x20782a){freeIsNotKey(_0x20782a,_0x35cc0f['zohoAccounts'],'id');for(var _0xceadfb=0x0,_0x576027={},_0x2fa538={};_0xceadfb<_0x20782a['length'];_0xceadfb+=0x1){_0x576027=_0x20782a[_0xceadfb];if(_[_0x597b('0x40')](_0x35cc0f[_0x597b('0x1d')][_0x576027['id']])){_0x35cc0f[_0x597b('0x1d')][_0x576027['id']]=new ZohoAccount(_0x576027);}else{_0x35cc0f[_0x597b('0x3e')](_0x35cc0f[_0x597b('0x1d')][_0x576027['id']],_0x576027);}}}return _0x35cc0f[_0x597b('0x1d')];};};Realtime[_0x597b('0x3d')][_0x597b('0x4b')]=function(){var _0x544d4a=this;return function(_0x49fc5e){if(_0x49fc5e){freeIsNotKey(_0x49fc5e,_0x544d4a[_0x597b('0x1e')],'id');for(var _0x1e17d5=0x0,_0x118c9f={},_0x57915e={};_0x1e17d5<_0x49fc5e[_0x597b('0x3f')];_0x1e17d5+=0x1){_0x118c9f=_0x49fc5e[_0x1e17d5];if(_['isUndefined'](_0x544d4a[_0x597b('0x1e')][_0x118c9f['id']])){_0x544d4a[_0x597b('0x1e')][_0x118c9f['id']]=new DeskAccount(_0x118c9f);}else{_0x544d4a[_0x597b('0x3e')](_0x544d4a[_0x597b('0x1e')][_0x118c9f['id']],_0x118c9f);}}}return _0x544d4a[_0x597b('0x1e')];};};Realtime[_0x597b('0x3d')]['initSugarcrmAccounts']=function(){var _0x260f56=this;return function(_0x51324e){if(_0x51324e){freeIsNotKey(_0x51324e,_0x260f56[_0x597b('0x4c')],'id');for(var _0x1f9c33=0x0,_0x688664={},_0x122a15={};_0x1f9c33<_0x51324e['length'];_0x1f9c33+=0x1){_0x688664=_0x51324e[_0x1f9c33];if(_[_0x597b('0x40')](_0x260f56[_0x597b('0x4c')][_0x688664['id']])){_0x260f56[_0x597b('0x4c')][_0x688664['id']]=new SugarcrmAccount(_0x688664);}else{_0x260f56[_0x597b('0x3e')](_0x260f56[_0x597b('0x4c')][_0x688664['id']],_0x688664);}}}return _0x260f56['sugarcrmAccounts'];};};Realtime['prototype'][_0x597b('0x4d')]=function(){var _0x3f831c=this;return function(_0x422baa){if(_0x422baa){freeIsNotKey(_0x422baa,_0x3f831c[_0x597b('0x1f')],'id');for(var _0x4444cf=0x0,_0x39d014={},_0x21ee7d={};_0x4444cf<_0x422baa[_0x597b('0x3f')];_0x4444cf+=0x1){_0x39d014=_0x422baa[_0x4444cf];if(_[_0x597b('0x40')](_0x3f831c[_0x597b('0x1f')][_0x39d014['id']])){_0x3f831c[_0x597b('0x1f')][_0x39d014['id']]=new VtigerAccount(_0x39d014);}else{_0x3f831c['mergeFromDatabase'](_0x3f831c[_0x597b('0x1f')][_0x39d014['id']],_0x39d014);}}}return _0x3f831c['vtigerAccounts'];};};Realtime[_0x597b('0x3d')][_0x597b('0x4e')]=function(){var _0x405f05=this;return function(_0x3929b2){if(_0x3929b2){freeIsNotKey(_0x3929b2,_0x405f05[_0x597b('0x20')],'id');for(var _0x27fe20=0x0,_0x5daf29={},_0x3dc848={};_0x27fe20<_0x3929b2[_0x597b('0x3f')];_0x27fe20+=0x1){_0x5daf29=_0x3929b2[_0x27fe20];if(_[_0x597b('0x40')](_0x405f05['servicenowAccounts'][_0x5daf29['id']])){_0x405f05[_0x597b('0x20')][_0x5daf29['id']]=new ServicenowAccount(_0x5daf29);}else{_0x405f05[_0x597b('0x3e')](_0x405f05['servicenowAccounts'][_0x5daf29['id']],_0x5daf29);}}}return _0x405f05[_0x597b('0x20')];};};Realtime[_0x597b('0x3d')][_0x597b('0x4f')]=function(){var _0x25ce4a=this;return function(_0x9fab9d){if(_0x9fab9d){freeIsNotKey(_0x9fab9d,_0x25ce4a[_0x597b('0x21')],'id');for(var _0x4861e4=0x0,_0x571a04={},_0x9d6e5e={};_0x4861e4<_0x9fab9d[_0x597b('0x3f')];_0x4861e4+=0x1){_0x571a04=_0x9fab9d[_0x4861e4];if(_[_0x597b('0x40')](_0x25ce4a[_0x597b('0x21')][_0x571a04['id']])){_0x25ce4a[_0x597b('0x21')][_0x571a04['id']]=new Dynamics365Account(_0x571a04);}else{_0x25ce4a['mergeFromDatabase'](_0x25ce4a[_0x597b('0x21')][_0x571a04['id']],_0x571a04);}}}return _0x25ce4a[_0x597b('0x21')];};};Realtime[_0x597b('0x3d')][_0x597b('0x50')]=function(){var _0x2c55f2=this;return function(_0x2b3c51){if(_0x2b3c51){freeIsNotKey(_0x2b3c51,_0x2c55f2[_0x597b('0x22')],'id');for(var _0x31e208=0x0,_0xb63ae6={},_0x39d0a7={};_0x31e208<_0x2b3c51[_0x597b('0x3f')];_0x31e208+=0x1){_0xb63ae6=_0x2b3c51[_0x31e208];if(_[_0x597b('0x40')](_0x2c55f2['freshsalesAccounts'][_0xb63ae6['id']])){_0x2c55f2[_0x597b('0x22')][_0xb63ae6['id']]=new FreshsalesAccount(_0xb63ae6);}else{_0x2c55f2[_0x597b('0x3e')](_0x2c55f2[_0x597b('0x22')][_0xb63ae6['id']],_0xb63ae6);}}}return _0x2c55f2[_0x597b('0x22')];};};Realtime['prototype'][_0x597b('0x51')]=function(){var _0x10fd16=this;return function(_0x4e54f6){for(var _0x16c473=0x0;_0x16c473<_0x4e54f6[_0x597b('0x3f')];_0x16c473+=0x1){_['merge'](_0x10fd16[_0x597b('0x12')][_0x4e54f6[_0x16c473]['name']],_0x4e54f6[_0x16c473]);}return _0x10fd16[_0x597b('0x12')];};};Realtime[_0x597b('0x3d')][_0x597b('0x52')]=function(){var _0x50fb6e=this;return function(_0x405b40){clearVoiceQueues(_0x50fb6e[_0x597b('0x12')]);if(_0x405b40){_0x405b40=_[_0x597b('0x53')](_0x405b40,_0x597b('0x54'));for(var _0xdfbdbd in _0x405b40){if(_0x405b40[_0x597b('0x25')](_0xdfbdbd)){var _0x5a7be1={};for(var _0x127f19=0x0;_0x127f19<_0x405b40[_0xdfbdbd][_0x597b('0x3f')];_0x127f19+=0x1){var _0x2c6a85=_0x405b40[_0xdfbdbd][_0x127f19][_0x597b('0x55')];if(_0x50fb6e[_0x597b('0x12')][_0x2c6a85]){if(_0x405b40[_0xdfbdbd][_0x127f19]['queuecallerexit']){_0x50fb6e[_0x597b('0x12')][_0x2c6a85][_0x597b('0x56')]+=0x1;}if(_0x405b40[_0xdfbdbd][_0x127f19]['queuecallerabandon']){_0x50fb6e[_0x597b('0x12')][_0x2c6a85][_0x597b('0x32')]+=0x1;}_0x50fb6e[_0x597b('0x12')][_0x2c6a85][_0x597b('0x2d')]+=moment(_0x405b40[_0xdfbdbd][_0x127f19]['queuecallerleaveAt'])[_0x597b('0x57')](moment(_0x405b40[_0xdfbdbd][_0x127f19][_0x597b('0x58')]),_0x597b('0x59'))||0x0;if(_0x127f19===_0x405b40[_0xdfbdbd][_0x597b('0x3f')]-0x1){_0x50fb6e[_0x597b('0x12')][_0x2c6a85][_0x597b('0x2e')]+=moment(_0x405b40[_0xdfbdbd][_0x127f19][_0x597b('0x5a')]||_0x405b40[_0xdfbdbd][_0x127f19][_0x597b('0x5b')]||_0x405b40[_0xdfbdbd][_0x127f19]['queuecallerexitAt'])[_0x597b('0x57')](moment(_0x405b40[_0xdfbdbd][_0x127f19][_0x597b('0x58')]),_0x597b('0x59'))||0x0;_0x50fb6e[_0x597b('0x12')][_0x2c6a85]['total']+=0x1;if(_0x405b40[_0xdfbdbd][_0x127f19][_0x597b('0x5c')]){_0x50fb6e[_0x597b('0x12')][_0x2c6a85][_0x597b('0x2c')]+=0x1;_0x50fb6e[_0x597b('0x12')][_0x2c6a85][_0x597b('0x33')]+=moment(_0x405b40[_0xdfbdbd][_0x127f19]['queuecallercompleteAt'])[_0x597b('0x57')](moment(_0x405b40[_0xdfbdbd][_0x127f19][_0x597b('0x5d')]),_0x597b('0x59'))||0x0;}}else{_0x50fb6e['voiceQueues'][_0x2c6a85][_0x597b('0x2e')]+=_0x50fb6e['voiceQueues'][_0x2c6a85][_0x597b('0x2d')]||0x0;}}}}}}return _0x50fb6e[_0x597b('0x12')];};};Realtime['prototype'][_0x597b('0x5e')]=function(){var _0x2bc442=this;return function(_0x331680){clearVoiceCallReports(_0x2bc442[_0x597b('0x16')]);if(_0x331680){for(var _0x19b3f7=0x0;_0x19b3f7<_0x331680[_0x597b('0x3f')];_0x19b3f7+=0x1){_0x2bc442[_0x597b('0x16')][_0x597b('0x2b')]+=0x1;_0x2bc442[_0x597b('0x16')][_0x597b('0x2e')]+=_0x331680[_0x19b3f7]['duration'];if(_0x331680[_0x19b3f7][_0x597b('0x5f')]===_0x597b('0x60')){_0x2bc442[_0x597b('0x16')]['answered']+=0x1;_0x2bc442['outbound'][_0x597b('0x2d')]+=_0x331680[_0x19b3f7]['duration']-_0x331680[_0x19b3f7][_0x597b('0x61')]||0x0;_0x2bc442[_0x597b('0x16')]['sumBillable']+=_0x331680[_0x19b3f7][_0x597b('0x61')];}}}return _0x2bc442['outbound'];};};Realtime[_0x597b('0x3d')][_0x597b('0x62')]=function(){var _0x50bf1d=this;return function(_0x521622){if(_0x521622){freeIsNotKey(_0x521622,_0x50bf1d[_0x597b('0x14')],_0x597b('0x27'));for(var _0x3dd25c=0x0,_0x2fee22={};_0x3dd25c<_0x521622[_0x597b('0x3f')];_0x3dd25c+=0x1){_0x2fee22=_0x521622[_0x3dd25c];if(_[_0x597b('0x40')](_0x50bf1d['campaigns'][_0x2fee22[_0x597b('0x27')]])){_0x50bf1d[_0x597b('0x14')][_0x2fee22['name']]=new Campaign(_0x2fee22);}else{_0x50bf1d[_0x597b('0x3e')](_0x50bf1d[_0x597b('0x14')][_0x2fee22['name']],_0x2fee22);_0x50bf1d[_0x597b('0x14')][_0x2fee22[_0x597b('0x27')]][_0x597b('0x63')]=_0x2fee22[_0x597b('0x64')]?_0x2fee22[_0x597b('0x64')]['name']:undefined;}}}return _0x50bf1d[_0x597b('0x14')];};};Realtime[_0x597b('0x3d')]['initVoiceExtensions']=function(){var _0x22a715=this;return function(_0x5ed840){if(_0x5ed840){freeIsNotKey(_0x5ed840,_0x22a715[_0x597b('0x17')],'id');for(var _0x4c067a=0x0,_0x355f42={};_0x4c067a<_0x5ed840['length'];_0x4c067a+=0x1){_0x355f42=_0x5ed840[_0x4c067a];if(_[_0x597b('0x40')](_0x22a715['voiceExtensions'][_0x355f42['id']])){_0x22a715[_0x597b('0x17')][_0x355f42['id']]=new VoiceExtension(_0x355f42);}else{_0x22a715[_0x597b('0x3e')](_0x22a715[_0x597b('0x17')][_0x355f42['id']],_0x355f42);}}}return _0x22a715['voiceExtensions'];};};Realtime['prototype'][_0x597b('0x65')]=function(){var _0x49f4d6=this;return function(_0x1fbd22){clearCampaigns(_0x49f4d6[_0x597b('0x14')]);for(var _0x5b2267=0x0;_0x5b2267<_0x1fbd22[_0x597b('0x3f')];_0x5b2267+=0x1){_[_0x597b('0x66')](_0x49f4d6[_0x597b('0x14')][_0x1fbd22[_0x5b2267][_0x597b('0x27')]],_0x1fbd22[_0x5b2267]);}return _0x49f4d6[_0x597b('0x14')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x5e3ea0=this;return function(_0x4b4c18){if(_0x4b4c18){freeIsNotKey(_0x4b4c18,_0x5e3ea0[_0x597b('0x23')],'id');for(var _0x3a7056=0x0,_0x225c44={},_0x2bba6a={};_0x3a7056<_0x4b4c18['length'];_0x3a7056+=0x1){_0x225c44=_0x4b4c18[_0x3a7056];if(_[_0x597b('0x40')](_0x5e3ea0[_0x597b('0x23')][_0x225c44['id']])){_0x5e3ea0[_0x597b('0x23')][_0x225c44['id']]=new FaxAccount(_0x225c44);}else{_0x5e3ea0[_0x597b('0x3e')](_0x5e3ea0[_0x597b('0x23')][_0x225c44['id']],_0x225c44);}}}return _0x5e3ea0[_0x597b('0x23')];};};module['exports']=Realtime; \ No newline at end of file +var _0xc57d=['../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','length','isUndefined','telephones','mergeFromDatabase','initTrunks','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','deskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount'];(function(_0x52d166,_0x4fae49){var _0x4cc086=function(_0x22c316){while(--_0x22c316){_0x52d166['push'](_0x52d166['shift']());}};_0x4cc086(++_0x4fae49);}(_0xc57d,0x13c));var _0xdc57=function(_0x6c1c3a,_0x387361){_0x6c1c3a=_0x6c1c3a-0x0;var _0x520259=_0xc57d[_0x6c1c3a];return _0x520259;};'use strict';var BPromise=require(_0xdc57('0x0'));var util=require('util');var _=require(_0xdc57('0x1'));var moment=require(_0xdc57('0x2'));var Agent=require('../model/agent');var Telephone=require(_0xdc57('0x3'));var Trunk=require(_0xdc57('0x4'));var VoiceQueue=require(_0xdc57('0x5'));var Trigger=require(_0xdc57('0x6'));var Template=require(_0xdc57('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xdc57('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xdc57('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xdc57('0xa'));var ZohoAccount=require(_0xdc57('0xb'));var DeskAccount=require(_0xdc57('0xc'));var VtigerAccount=require(_0xdc57('0xd'));var ServicenowAccount=require(_0xdc57('0xe'));var Dynamics365Account=require(_0xdc57('0xf'));var FreshsalesAccount=require(_0xdc57('0x10'));var FaxAccount=require(_0xdc57('0x11'));var Realtime=function(){this[_0xdc57('0x12')]={};this['telephones']={};this[_0xdc57('0x13')]={};this[_0xdc57('0x14')]={};this[_0xdc57('0x15')]={};this[_0xdc57('0x16')]={};this['templates']={};this[_0xdc57('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xdc57('0x18')]={};this[_0xdc57('0x19')]={};this[_0xdc57('0x1a')]={};this[_0xdc57('0x1b')]={};this[_0xdc57('0x1c')]={};this[_0xdc57('0x1d')]={};this['zendeskAccounts']={};this[_0xdc57('0x1e')]={};this[_0xdc57('0x1f')]={};this[_0xdc57('0x20')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xdc57('0x21')]={};this[_0xdc57('0x22')]={};this[_0xdc57('0x23')]={};this['freshsalesAccounts']={};this[_0xdc57('0x24')]={};};function freeIsNotKey(_0x4b7c58,_0x3fcb00,_0x417b19){var _0x3f8f45=_[_0xdc57('0x25')](_0x4b7c58,function(_0x36d52a,_0x15f2b7){return _0x36d52a[_0x417b19];});for(var _0xc9d7b3 in _0x3fcb00){if(_0x3fcb00[_0xdc57('0x26')](_0xc9d7b3)){if(!_0x3f8f45[_0xc9d7b3]){delete _0x3fcb00[_0xc9d7b3];}}}}function freeIsNotKeySip(_0x1176fe,_0x3c8b54){var _0x355e4d=_[_0xdc57('0x25')](_0x1176fe,function(_0x5c2542,_0x45130b){return util[_0xdc57('0x27')](_0xdc57('0x28'),_0x5c2542[_0xdc57('0x29')]);});for(var _0x5cb6c6 in _0x3c8b54){if(_0x3c8b54['hasOwnProperty'](_0x5cb6c6)){if(!_0x355e4d[_0x5cb6c6]){delete _0x3c8b54[_0x5cb6c6];}}}}function freeIsNotKeyAgent(_0x8e019a,_0x5f72f8){var _0x4c029d=_[_0xdc57('0x25')](_0x8e019a,function(_0x113a67,_0x26d50c){var _0x976222=_[_0xdc57('0x2a')](_0x113a67['interface'])?util[_0xdc57('0x27')]('SIP/%s',_0x113a67[_0xdc57('0x29')]):_0x113a67[_0xdc57('0x2b')];return _0x976222;});for(var _0x3da2e5 in _0x5f72f8){if(_0x5f72f8[_0xdc57('0x26')](_0x3da2e5)){if(!_0x4c029d[_0x3da2e5]){delete _0x5f72f8[_0x3da2e5];}}}}function clearVoiceCallReports(_0xa9d36c){_0xa9d36c[_0xdc57('0x2c')]=0x0;_0xa9d36c[_0xdc57('0x2d')]=0x0;_0xa9d36c[_0xdc57('0x2e')]=0x0;_0xa9d36c['sumDuration']=0x0;_0xa9d36c[_0xdc57('0x2f')]=0x0;}function clearCampaigns(_0x302a09){if(!_[_0xdc57('0x30')](_0x302a09)){for(var _0x205545 in _0x302a09){if(_0x302a09[_0xdc57('0x26')](_0x205545)){_0x302a09[_0x205545]['ivrTotalCallsDays']=0x0;_0x302a09[_0x205545][_0xdc57('0x31')]=0x0;}}}}function clearVoiceQueues(_0x4b0b02){if(!_[_0xdc57('0x30')](_0x4b0b02)){for(var _0x27ea30 in _0x4b0b02){if(_0x4b0b02[_0xdc57('0x26')](_0x27ea30)){_0x4b0b02[_0x27ea30][_0xdc57('0x2c')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x2d')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x32')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x33')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x2e')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x34')]=0x0;_0x4b0b02[_0x27ea30]['sumBillable']=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x35')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x36')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x37')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x38')]=0x0;_0x4b0b02[_0x27ea30]['outboundNoSuchCallsDay']=0x0;_0x4b0b02[_0x27ea30]['outboundUnknownCallsDay']=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x39')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3a')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3b')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3c')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3d')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3e')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x35')]=0x0;_0x4b0b02[_0x27ea30][_0xdc57('0x3f')]=0x0;_0x4b0b02[_0x27ea30]['queueStatusComplete']=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x873643,_0x756e2f){for(var _0x37667e in _0x756e2f){if(_0x873643[_0xdc57('0x26')](_0x37667e)){_0x873643[_0x37667e]=_0x756e2f[_0x37667e];}}};Realtime[_0xdc57('0x40')]['initAgents']=function(){var _0x58fffd=this;return function(_0x38cca1){if(_0x38cca1){freeIsNotKeyAgent(_0x38cca1,_0x58fffd[_0xdc57('0x12')]);for(var _0x33ad13=0x0,_0x2dabdb={},_0xa96df7={};_0x33ad13<_0x38cca1[_0xdc57('0x41')];_0x33ad13+=0x1){_0x2dabdb=_0x38cca1[_0x33ad13];var _0xfe63be=_[_0xdc57('0x2a')](_0x2dabdb[_0xdc57('0x2b')])?util[_0xdc57('0x27')](_0xdc57('0x28'),_0x2dabdb['name']):_0x2dabdb[_0xdc57('0x2b')];if(_['isUndefined'](_0x58fffd[_0xdc57('0x12')][_0xfe63be])){_0x58fffd['agents'][_0xfe63be]=new Agent(_0x2dabdb);}else{_0x58fffd['mergeFromDatabase'](_0x58fffd['agents'][_0xfe63be],_0x2dabdb);}}}return _0x58fffd[_0xdc57('0x12')];};};Realtime[_0xdc57('0x40')]['initTelephones']=function(){var _0x56044d=this;return function(_0x26f759){if(_0x26f759){freeIsNotKeySip(_0x26f759,_0x56044d['telephones']);for(var _0x3f57c5=0x0,_0x3c44b9={},_0x52a512={};_0x3f57c5<_0x26f759[_0xdc57('0x41')];_0x3f57c5+=0x1){_0x3c44b9=_0x26f759[_0x3f57c5];if(_[_0xdc57('0x42')](_0x56044d[_0xdc57('0x43')][util[_0xdc57('0x27')](_0xdc57('0x28'),_0x3c44b9[_0xdc57('0x29')])])){_0x56044d[_0xdc57('0x43')][util[_0xdc57('0x27')]('SIP/%s',_0x3c44b9[_0xdc57('0x29')])]=new Telephone(_0x3c44b9);}else{_0x56044d[_0xdc57('0x44')](_0x56044d[_0xdc57('0x43')][util[_0xdc57('0x27')](_0xdc57('0x28'),_0x3c44b9[_0xdc57('0x29')])],_0x3c44b9);}}}return _0x56044d['telephones'];};};Realtime[_0xdc57('0x40')][_0xdc57('0x45')]=function(){var _0x417316=this;return function(_0x9e0edd){if(_0x9e0edd){freeIsNotKeySip(_0x9e0edd,_0x417316['trunks']);for(var _0x52ad7d=0x0,_0x5e68c8={},_0x4ab209={};_0x52ad7d<_0x9e0edd[_0xdc57('0x41')];_0x52ad7d+=0x1){_0x5e68c8=_0x9e0edd[_0x52ad7d];if(_[_0xdc57('0x42')](_0x417316[_0xdc57('0x13')][util[_0xdc57('0x27')](_0xdc57('0x28'),_0x5e68c8['name'])])){_0x417316[_0xdc57('0x13')][util['format'](_0xdc57('0x28'),_0x5e68c8['name'])]=new Trunk(_0x5e68c8);}else{_0x417316['mergeFromDatabase'](_0x417316[_0xdc57('0x13')][util[_0xdc57('0x27')](_0xdc57('0x28'),_0x5e68c8[_0xdc57('0x29')])],_0x5e68c8);}}}return _0x417316['trunks'];};};Realtime['prototype'][_0xdc57('0x46')]=function(){var _0x4a1c8c=this;return function(_0x3528be){if(_0x3528be){freeIsNotKey(_0x3528be,_0x4a1c8c[_0xdc57('0x14')],'name');for(var _0x1a29f8=0x0,_0x209c5b={},_0x4c1883={};_0x1a29f8<_0x3528be[_0xdc57('0x41')];_0x1a29f8+=0x1){_0x209c5b=_0x3528be[_0x1a29f8];if(_[_0xdc57('0x42')](_0x4a1c8c[_0xdc57('0x14')][_0x209c5b[_0xdc57('0x29')]])){_0x4a1c8c['voiceQueues'][_0x209c5b['name']]=new VoiceQueue(_0x209c5b);}else{_0x4a1c8c['mergeFromDatabase'](_0x4a1c8c[_0xdc57('0x14')][_0x209c5b[_0xdc57('0x29')]],_0x209c5b);}}}return _0x4a1c8c[_0xdc57('0x14')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x47')]=function(){var _0x119941=this;return function(_0xd116cb){if(_0xd116cb){freeIsNotKey(_0xd116cb,_0x119941[_0xdc57('0x15')],'id');for(var _0x31bf2b=0x0,_0x1dec86={},_0x3de871={};_0x31bf2b<_0xd116cb[_0xdc57('0x41')];_0x31bf2b+=0x1){_0x1dec86=_0xd116cb[_0x31bf2b];if(_[_0xdc57('0x42')](_0x119941[_0xdc57('0x15')][_0x1dec86['id']])){_0x119941[_0xdc57('0x15')][_0x1dec86['id']]=new Trigger(_0x1dec86);}else{_0x119941[_0xdc57('0x44')](_0x119941[_0xdc57('0x15')][_0x1dec86['id']],_0x1dec86);}}}return _0x119941[_0xdc57('0x15')];};};Realtime['prototype'][_0xdc57('0x48')]=function(){var _0x52aaba=this;return function(_0x26c1a3){if(_0x26c1a3){freeIsNotKey(_0x26c1a3,_0x52aaba[_0xdc57('0x49')],'id');for(var _0x3dcbc1=0x0,_0x5c04a2={},_0x361307={};_0x3dcbc1<_0x26c1a3[_0xdc57('0x41')];_0x3dcbc1+=0x1){_0x5c04a2=_0x26c1a3[_0x3dcbc1];if(_[_0xdc57('0x42')](_0x52aaba[_0xdc57('0x49')][_0x5c04a2['id']])){_0x52aaba[_0xdc57('0x49')][_0x5c04a2['id']]=new Template(_0x5c04a2);}else{_0x52aaba[_0xdc57('0x44')](_0x52aaba[_0xdc57('0x49')][_0x5c04a2['id']],_0x5c04a2);}}}return _0x52aaba[_0xdc57('0x49')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x4a')]=function(){var _0x88371e=this;return function(_0x1250af){if(_0x1250af){freeIsNotKey(_0x1250af,_0x88371e['zendeskAccounts'],'id');for(var _0x5e0dac=0x0,_0x2e59ab={},_0x3fe62e={};_0x5e0dac<_0x1250af['length'];_0x5e0dac+=0x1){_0x2e59ab=_0x1250af[_0x5e0dac];if(_[_0xdc57('0x42')](_0x88371e[_0xdc57('0x4b')][_0x2e59ab['id']])){_0x88371e[_0xdc57('0x4b')][_0x2e59ab['id']]=new ZendeskAccount(_0x2e59ab);}else{_0x88371e['mergeFromDatabase'](_0x88371e[_0xdc57('0x4b')][_0x2e59ab['id']],_0x2e59ab);}}}return _0x88371e['zendeskAccounts'];};};Realtime[_0xdc57('0x40')][_0xdc57('0x4c')]=function(){var _0x12eef3=this;return function(_0x25fbe4){if(_0x25fbe4){freeIsNotKey(_0x25fbe4,_0x12eef3[_0xdc57('0x1e')],'id');for(var _0x4ba7fd=0x0,_0x365646={},_0x1f3835={};_0x4ba7fd<_0x25fbe4[_0xdc57('0x41')];_0x4ba7fd+=0x1){_0x365646=_0x25fbe4[_0x4ba7fd];if(_[_0xdc57('0x42')](_0x12eef3['salesforceAccounts'][_0x365646['id']])){_0x12eef3[_0xdc57('0x1e')][_0x365646['id']]=new SalesforceAccount(_0x365646);}else{_0x12eef3[_0xdc57('0x44')](_0x12eef3[_0xdc57('0x1e')][_0x365646['id']],_0x365646);}}}return _0x12eef3[_0xdc57('0x1e')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x4d')]=function(){var _0x285656=this;return function(_0x1abd15){if(_0x1abd15){freeIsNotKey(_0x1abd15,_0x285656[_0xdc57('0x20')],'id');for(var _0x1effe4=0x0,_0x56dc83={},_0x4095d4={};_0x1effe4<_0x1abd15[_0xdc57('0x41')];_0x1effe4+=0x1){_0x56dc83=_0x1abd15[_0x1effe4];if(_[_0xdc57('0x42')](_0x285656[_0xdc57('0x20')][_0x56dc83['id']])){_0x285656[_0xdc57('0x20')][_0x56dc83['id']]=new FreshdeskAccount(_0x56dc83);}else{_0x285656['mergeFromDatabase'](_0x285656['freshdeskAccounts'][_0x56dc83['id']],_0x56dc83);}}}return _0x285656[_0xdc57('0x20')];};};Realtime['prototype'][_0xdc57('0x4e')]=function(){var _0x27809f=this;return function(_0x33ea78){if(_0x33ea78){freeIsNotKey(_0x33ea78,_0x27809f[_0xdc57('0x4f')],'id');for(var _0x2758cc=0x0,_0xd7a906={},_0x27c731={};_0x2758cc<_0x33ea78[_0xdc57('0x41')];_0x2758cc+=0x1){_0xd7a906=_0x33ea78[_0x2758cc];if(_['isUndefined'](_0x27809f['zohoAccounts'][_0xd7a906['id']])){_0x27809f[_0xdc57('0x4f')][_0xd7a906['id']]=new ZohoAccount(_0xd7a906);}else{_0x27809f[_0xdc57('0x44')](_0x27809f[_0xdc57('0x4f')][_0xd7a906['id']],_0xd7a906);}}}return _0x27809f['zohoAccounts'];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x426f1e=this;return function(_0x48c227){if(_0x48c227){freeIsNotKey(_0x48c227,_0x426f1e[_0xdc57('0x50')],'id');for(var _0x838789=0x0,_0x32c5ab={},_0x38ef83={};_0x838789<_0x48c227[_0xdc57('0x41')];_0x838789+=0x1){_0x32c5ab=_0x48c227[_0x838789];if(_[_0xdc57('0x42')](_0x426f1e[_0xdc57('0x50')][_0x32c5ab['id']])){_0x426f1e[_0xdc57('0x50')][_0x32c5ab['id']]=new DeskAccount(_0x32c5ab);}else{_0x426f1e[_0xdc57('0x44')](_0x426f1e['deskAccounts'][_0x32c5ab['id']],_0x32c5ab);}}}return _0x426f1e['deskAccounts'];};};Realtime[_0xdc57('0x40')][_0xdc57('0x51')]=function(){var _0x28300d=this;return function(_0x147113){if(_0x147113){freeIsNotKey(_0x147113,_0x28300d[_0xdc57('0x1f')],'id');for(var _0x34e5d7=0x0,_0x74b948={},_0x15926e={};_0x34e5d7<_0x147113[_0xdc57('0x41')];_0x34e5d7+=0x1){_0x74b948=_0x147113[_0x34e5d7];if(_[_0xdc57('0x42')](_0x28300d[_0xdc57('0x1f')][_0x74b948['id']])){_0x28300d[_0xdc57('0x1f')][_0x74b948['id']]=new SugarcrmAccount(_0x74b948);}else{_0x28300d[_0xdc57('0x44')](_0x28300d[_0xdc57('0x1f')][_0x74b948['id']],_0x74b948);}}}return _0x28300d[_0xdc57('0x1f')];};};Realtime[_0xdc57('0x40')]['initVtigerAccounts']=function(){var _0x249f17=this;return function(_0x534035){if(_0x534035){freeIsNotKey(_0x534035,_0x249f17[_0xdc57('0x21')],'id');for(var _0x31a4a4=0x0,_0x3d59de={},_0x48e691={};_0x31a4a4<_0x534035['length'];_0x31a4a4+=0x1){_0x3d59de=_0x534035[_0x31a4a4];if(_['isUndefined'](_0x249f17['vtigerAccounts'][_0x3d59de['id']])){_0x249f17[_0xdc57('0x21')][_0x3d59de['id']]=new VtigerAccount(_0x3d59de);}else{_0x249f17[_0xdc57('0x44')](_0x249f17['vtigerAccounts'][_0x3d59de['id']],_0x3d59de);}}}return _0x249f17[_0xdc57('0x21')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x52')]=function(){var _0x53a758=this;return function(_0xacc941){if(_0xacc941){freeIsNotKey(_0xacc941,_0x53a758['servicenowAccounts'],'id');for(var _0x3802d8=0x0,_0x5c1f36={},_0x2ce71a={};_0x3802d8<_0xacc941[_0xdc57('0x41')];_0x3802d8+=0x1){_0x5c1f36=_0xacc941[_0x3802d8];if(_[_0xdc57('0x42')](_0x53a758[_0xdc57('0x22')][_0x5c1f36['id']])){_0x53a758['servicenowAccounts'][_0x5c1f36['id']]=new ServicenowAccount(_0x5c1f36);}else{_0x53a758['mergeFromDatabase'](_0x53a758[_0xdc57('0x22')][_0x5c1f36['id']],_0x5c1f36);}}}return _0x53a758[_0xdc57('0x22')];};};Realtime['prototype'][_0xdc57('0x53')]=function(){var _0x3ea4ec=this;return function(_0x193bf2){if(_0x193bf2){freeIsNotKey(_0x193bf2,_0x3ea4ec[_0xdc57('0x23')],'id');for(var _0x1bf43e=0x0,_0x23b68a={},_0xd3c994={};_0x1bf43e<_0x193bf2['length'];_0x1bf43e+=0x1){_0x23b68a=_0x193bf2[_0x1bf43e];if(_['isUndefined'](_0x3ea4ec[_0xdc57('0x23')][_0x23b68a['id']])){_0x3ea4ec['dynamics365Accounts'][_0x23b68a['id']]=new Dynamics365Account(_0x23b68a);}else{_0x3ea4ec['mergeFromDatabase'](_0x3ea4ec[_0xdc57('0x23')][_0x23b68a['id']],_0x23b68a);}}}return _0x3ea4ec['dynamics365Accounts'];};};Realtime[_0xdc57('0x40')][_0xdc57('0x54')]=function(){var _0x327121=this;return function(_0x2224af){if(_0x2224af){freeIsNotKey(_0x2224af,_0x327121[_0xdc57('0x55')],'id');for(var _0x32a539=0x0,_0x2968f8={},_0x455e94={};_0x32a539<_0x2224af['length'];_0x32a539+=0x1){_0x2968f8=_0x2224af[_0x32a539];if(_['isUndefined'](_0x327121[_0xdc57('0x55')][_0x2968f8['id']])){_0x327121[_0xdc57('0x55')][_0x2968f8['id']]=new FreshsalesAccount(_0x2968f8);}else{_0x327121['mergeFromDatabase'](_0x327121[_0xdc57('0x55')][_0x2968f8['id']],_0x2968f8);}}}return _0x327121[_0xdc57('0x55')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x56')]=function(){var _0x229307=this;return function(_0x53b73b){for(var _0x52d055=0x0;_0x52d055<_0x53b73b['length'];_0x52d055+=0x1){_[_0xdc57('0x57')](_0x229307[_0xdc57('0x14')][_0x53b73b[_0x52d055][_0xdc57('0x29')]],_0x53b73b[_0x52d055]);}return _0x229307['voiceQueues'];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x388fb9=this;return function(_0x2ab914){clearVoiceQueues(_0x388fb9['voiceQueues']);if(_0x2ab914){_0x2ab914=_[_0xdc57('0x58')](_0x2ab914,_0xdc57('0x59'));for(var _0x2494bb in _0x2ab914){if(_0x2ab914[_0xdc57('0x26')](_0x2494bb)){var _0x2a09d0={};for(var _0x16040a=0x0;_0x16040a<_0x2ab914[_0x2494bb][_0xdc57('0x41')];_0x16040a+=0x1){var _0x2a1daf=_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5a')];if(_0x388fb9[_0xdc57('0x14')][_0x2a1daf]){if(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5b')]){_0x388fb9[_0xdc57('0x14')][_0x2a1daf]['unmanaged']+=0x1;}if(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5c')]){_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x33')]+=0x1;}_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x2e')]+=moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5d')])[_0xdc57('0x5e')](moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5f')]),_0xdc57('0x60'))||0x0;if(_0x16040a===_0x2ab914[_0x2494bb][_0xdc57('0x41')]-0x1){_0x388fb9[_0xdc57('0x14')][_0x2a1daf]['sumDuration']+=moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x61')]||_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x62')]||_0x2ab914[_0x2494bb][_0x16040a]['queuecallerexitAt'])['diff'](moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5f')]),_0xdc57('0x60'))||0x0;_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x2c')]+=0x1;if(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x63')]){_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x2d')]+=0x1;_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x2f')]+=moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x61')])[_0xdc57('0x5e')](moment(_0x2ab914[_0x2494bb][_0x16040a][_0xdc57('0x5d')]),_0xdc57('0x60'))||0x0;}}else{_0x388fb9[_0xdc57('0x14')][_0x2a1daf][_0xdc57('0x34')]+=_0x388fb9['voiceQueues'][_0x2a1daf][_0xdc57('0x2e')]||0x0;}}}}}}return _0x388fb9[_0xdc57('0x14')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x64')]=function(){var _0x1d974f=this;return function(_0x410527){clearVoiceCallReports(_0x1d974f[_0xdc57('0x17')]);if(_0x410527){for(var _0x184b1b=0x0;_0x184b1b<_0x410527[_0xdc57('0x41')];_0x184b1b+=0x1){_0x1d974f[_0xdc57('0x17')][_0xdc57('0x2c')]+=0x1;_0x1d974f[_0xdc57('0x17')][_0xdc57('0x34')]+=_0x410527[_0x184b1b][_0xdc57('0x65')];if(_0x410527[_0x184b1b][_0xdc57('0x66')]===_0xdc57('0x67')){_0x1d974f['outbound'][_0xdc57('0x2d')]+=0x1;_0x1d974f[_0xdc57('0x17')][_0xdc57('0x2e')]+=_0x410527[_0x184b1b][_0xdc57('0x65')]-_0x410527[_0x184b1b]['billableseconds']||0x0;_0x1d974f[_0xdc57('0x17')][_0xdc57('0x2f')]+=_0x410527[_0x184b1b]['billableseconds'];}}}return _0x1d974f['outbound'];};};Realtime['prototype'][_0xdc57('0x68')]=function(){var _0x91d22d=this;return function(_0x2e8eed){if(_0x2e8eed){freeIsNotKey(_0x2e8eed,_0x91d22d['campaigns'],'name');for(var _0x2b8754=0x0,_0x24931d={};_0x2b8754<_0x2e8eed[_0xdc57('0x41')];_0x2b8754+=0x1){_0x24931d=_0x2e8eed[_0x2b8754];if(_['isUndefined'](_0x91d22d[_0xdc57('0x16')][_0x24931d['name']])){_0x91d22d[_0xdc57('0x16')][_0x24931d[_0xdc57('0x29')]]=new Campaign(_0x24931d);}else{_0x91d22d[_0xdc57('0x44')](_0x91d22d[_0xdc57('0x16')][_0x24931d[_0xdc57('0x29')]],_0x24931d);_0x91d22d[_0xdc57('0x16')][_0x24931d[_0xdc57('0x29')]][_0xdc57('0x69')]=_0x24931d[_0xdc57('0x6a')]?_0x24931d[_0xdc57('0x6a')][_0xdc57('0x29')]:undefined;}}}return _0x91d22d[_0xdc57('0x16')];};};Realtime[_0xdc57('0x40')]['initVoiceExtensions']=function(){var _0x1e9ad1=this;return function(_0x18ca0b){if(_0x18ca0b){freeIsNotKey(_0x18ca0b,_0x1e9ad1[_0xdc57('0x18')],'id');for(var _0x3e88cb=0x0,_0x8e76cc={};_0x3e88cb<_0x18ca0b[_0xdc57('0x41')];_0x3e88cb+=0x1){_0x8e76cc=_0x18ca0b[_0x3e88cb];if(_[_0xdc57('0x42')](_0x1e9ad1[_0xdc57('0x18')][_0x8e76cc['id']])){_0x1e9ad1[_0xdc57('0x18')][_0x8e76cc['id']]=new VoiceExtension(_0x8e76cc);}else{_0x1e9ad1['mergeFromDatabase'](_0x1e9ad1[_0xdc57('0x18')][_0x8e76cc['id']],_0x8e76cc);}}}return _0x1e9ad1[_0xdc57('0x18')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x6b')]=function(){var _0x56fe8e=this;return function(_0x1e2c34){clearCampaigns(_0x56fe8e[_0xdc57('0x16')]);for(var _0x4428a7=0x0;_0x4428a7<_0x1e2c34['length'];_0x4428a7+=0x1){_[_0xdc57('0x57')](_0x56fe8e[_0xdc57('0x16')][_0x1e2c34[_0x4428a7][_0xdc57('0x29')]],_0x1e2c34[_0x4428a7]);}return _0x56fe8e[_0xdc57('0x16')];};};Realtime[_0xdc57('0x40')][_0xdc57('0x6c')]=function(){var _0x2b2c47=this;return function(_0x5a9bb5){if(_0x5a9bb5){freeIsNotKey(_0x5a9bb5,_0x2b2c47[_0xdc57('0x24')],'id');for(var _0xeaee2b=0x0,_0x383478={},_0x10992d={};_0xeaee2b<_0x5a9bb5[_0xdc57('0x41')];_0xeaee2b+=0x1){_0x383478=_0x5a9bb5[_0xeaee2b];if(_[_0xdc57('0x42')](_0x2b2c47[_0xdc57('0x24')][_0x383478['id']])){_0x2b2c47[_0xdc57('0x24')][_0x383478['id']]=new FaxAccount(_0x383478);}else{_0x2b2c47[_0xdc57('0x44')](_0x2b2c47[_0xdc57('0x24')][_0x383478['id']],_0x383478);}}}return _0x2b2c47['faxAccounts'];};};module[_0xdc57('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index cd74627..7c11c76 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 _0x8b57=['bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','name','isNil','accountcode','interface','format','SIP/%s','length','assigned','queuecallercomplete','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','destinationchannel','channel','calleridpreview','calleridnum','originatecalleridnum','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport'];(function(_0x3ab005,_0x3308e9){var _0x5d92f0=function(_0x5679d4){while(--_0x5679d4){_0x3ab005['push'](_0x3ab005['shift']());}};_0x5d92f0(++_0x3308e9);}(_0x8b57,0x14b));var _0x78b5=function(_0x3c7b4e,_0x5ed116){_0x3c7b4e=_0x3c7b4e-0x0;var _0x31bb95=_0x8b57[_0x3c7b4e];return _0x31bb95;};'use strict';var _=require(_0x78b5('0x0'));var moment=require('moment');var util=require(_0x78b5('0x1'));var config=require(_0x78b5('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x78b5('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x78b5('0x4'));var RpcMemberReport=require(_0x78b5('0x5'));var RpcVoiceQueueReport=require(_0x78b5('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x78b5('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x78b5('0x8'));var VoiceAgentReport=require(_0x78b5('0x9'));var VoiceDialReport=require(_0x78b5('0xa'));var UserReport=require(_0x78b5('0xb'));function Report(_0x3b2004){this[_0x78b5('0xc')]=_0x3b2004;this[_0x78b5('0xd')]=_0x3b2004[_0x78b5('0xd')];this[_0x78b5('0xe')]=_0x3b2004[_0x78b5('0xe')];}Report[_0x78b5('0xf')][_0x78b5('0x10')]=function(_0x2624f7){var _0x494521=new VoiceQueueReport(this[_0x78b5('0xc')]);var _0x5333b3=new VoiceAgentReport(this['realtime']);var _0x2808e6=new VoiceDialReport(this['realtime']);var _0x48b67f=new VoiceCallReport(this[_0x78b5('0xc')]);var _0x26e090=new UserReport(this[_0x78b5('0xc')]);if(config[_0x78b5('0x11')]&&config[_0x78b5('0x11')][_0x78b5('0x12')]){ami['on'](_0x78b5('0x13'),this[_0x78b5('0x14')][_0x78b5('0x15')](this));ami['on'](_0x78b5('0x16'),this['voiceCallReport'][_0x78b5('0x15')](this));ami['on'](_0x78b5('0x17'),this['voiceAgentReport'][_0x78b5('0x15')](this));ami['on'](_0x78b5('0x18'),this[_0x78b5('0x19')][_0x78b5('0x15')](this));ami['on'](_0x78b5('0x1a'),this[_0x78b5('0x1b')]['bind'](this));ami['on'](_0x78b5('0x1c'),this['attendedTransfer']['bind'](this));}};Report[_0x78b5('0xf')][_0x78b5('0x1d')]=function(_0x2692c7){var _0x314866;_0x314866=_[_0x78b5('0x1e')](this[_0x78b5('0xd')],function(_0x3ba828){return _0x3ba828['accountcode']==_0x2692c7||_0x3ba828[_0x78b5('0x1f')]==_0x2692c7;});if(_[_0x78b5('0x20')](_0x314866)){var _0x514640=_[_0x78b5('0x1e')](this[_0x78b5('0xe')],function(_0x3f7f96){return _0x3f7f96[_0x78b5('0x21')]==_0x2692c7||_0x3f7f96['name']==_0x2692c7;});if(_0x514640){_0x314866=_['find'](this[_0x78b5('0xd')],function(_0x4f3ef4){return _0x4f3ef4[_0x78b5('0x22')]==util[_0x78b5('0x23')](_0x78b5('0x24'),_0x514640[_0x78b5('0x1f')]);});}}return _0x314866;};Report[_0x78b5('0xf')][_0x78b5('0x14')]=function(_0x5a5b36){for(var _0x350a8a=0x0;_0x350a8a<_0x5a5b36[_0x78b5('0x25')];_0x350a8a+=0x1){var _0x515d66=this[_0x78b5('0x1d')](_0x5a5b36[_0x350a8a]['connectedlinenum']);if(_0x515d66){_0x5a5b36[_0x350a8a]['accountcode']=_0x515d66[_0x78b5('0x21')];_0x5a5b36[_0x350a8a][_0x78b5('0x26')]=!![];_0x5a5b36[_0x350a8a]['lastAssignedTo']=_0x515d66['name'];_0x5a5b36[_0x350a8a][_0x78b5('0x22')]=_[_0x78b5('0x20')](_0x515d66[_0x78b5('0x22')])?util[_0x78b5('0x23')](_0x78b5('0x24'),_0x515d66['name']):_0x515d66[_0x78b5('0x22')];if(_0x5a5b36[_0x350a8a][_0x78b5('0x27')]){_0x5a5b36[_0x350a8a]['queuecallercompleteAt']=moment()[_0x78b5('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5a5b36[_0x350a8a][_0x78b5('0x28')]){_0x5a5b36[_0x350a8a][_0x78b5('0x29')]=moment()[_0x78b5('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x78b5('0x14')](_0x5a5b36[_0x350a8a]);}RpcVoiceQueueReport[_0x78b5('0x2a')](_0x5a5b36[_0x350a8a]);}};function extractCalleridNumber(_0x258336){var _0x2b8a49=_0x258336[_0x78b5('0x2b')](/<(.*?)>/);return _0x2b8a49?_0x2b8a49[0x1]:_0x258336;}Report[_0x78b5('0xf')][_0x78b5('0x2c')]=function(_0x1818e1){_0x1818e1[_0x78b5('0x2d')]=_0x1818e1[_0x78b5('0x2d')]||_0x1818e1[_0x78b5('0x2e')];if(_0x1818e1[_0x78b5('0x2f')]==_0x78b5('0x30')){_0x1818e1[_0x78b5('0x31')]=_0x78b5('0x32');_0x1818e1[_0x78b5('0x33')]=_0x1818e1[_0x78b5('0x32')];if(_0x1818e1[_0x78b5('0x34')]=='from-voip-provider'){_0x1818e1[_0x78b5('0x21')]='';_0x1818e1['destination']=extractCalleridNumber(_0x1818e1[_0x78b5('0x35')]);}else if(_0x1818e1[_0x78b5('0x34')]==_0x78b5('0x36')){if(_0x1818e1['destination']==_0x78b5('0x37')){_0x1818e1[_0x78b5('0x2d')]=extractCalleridNumber(_0x1818e1['calleridpreview']);_0x1818e1['calleridnum']=_0x1818e1['originatecalleridnum'];_0x1818e1[_0x78b5('0x38')]=[_0x1818e1['channel'],_0x1818e1[_0x78b5('0x39')]=_0x1818e1[_0x78b5('0x38')]][0x0];_0x1818e1[_0x78b5('0x35')]=_0x1818e1[_0x78b5('0x3a')];}else{_0x1818e1['destination']=_0x1818e1[_0x78b5('0x3b')];_0x1818e1['calleridnum']=_0x1818e1[_0x78b5('0x3c')];if(_0x1818e1[_0x78b5('0x3d')]=='ANSWERED'){_0x1818e1[_0x78b5('0x21')]=_0x1818e1[_0x78b5('0x3e')];}else{_0x1818e1[_0x78b5('0x21')]='';}}}}else{_0x1818e1[_0x78b5('0x35')]=util[_0x78b5('0x23')](_0x78b5('0x3f'),_0x1818e1[_0x78b5('0x40')],_0x1818e1['calleridnum']);}if(RpcVoiceTransferReport[_0x78b5('0x41')][_0x1818e1[_0x78b5('0x42')]]){var _0x5cacad=RpcVoiceTransferReport[_0x78b5('0x41')][_0x1818e1[_0x78b5('0x42')]];_0x5cacad[_0x78b5('0x43')]=_0x1818e1[_0x78b5('0x44')];RpcVoiceTransferReport['blindTransfer'](_0x5cacad);delete RpcVoiceTransferReport[_0x78b5('0x41')][_0x1818e1['linkedid']];}RpcVoiceCallReport[_0x78b5('0x2a')](_0x1818e1);if(_0x1818e1[_0x78b5('0x45')]){for(var _0x5a47f3=0x0;_0x5a47f3<_0x1818e1['monitors'][_0x78b5('0x25')];_0x5a47f3+=0x1){_0x1818e1[_0x78b5('0x46')]=_0x1818e1[_0x78b5('0x47')][_0x5a47f3][_0x78b5('0x48')];_0x1818e1['createdAt']=_0x1818e1[_0x78b5('0x47')][_0x5a47f3][_0x78b5('0x49')];if(_0x1818e1[_0x78b5('0x2e')]==_0x78b5('0x37')){_0x1818e1[_0x78b5('0x3b')]=_0x1818e1[_0x78b5('0x3e')];_0x1818e1['calleridname']=_0x1818e1['connectedlinename'];_0x1818e1[_0x78b5('0x3e')]=_0x1818e1['accountcode'];_0x1818e1[_0x78b5('0x4a')]=_0x1818e1[_0x78b5('0x4b')];_0x1818e1['exten']=_0x1818e1[_0x78b5('0x3c')];}else if(_0x1818e1[_0x78b5('0x2e')]==_0x78b5('0x4c')){_0x1818e1[_0x78b5('0x3b')]=_0x1818e1[_0x78b5('0x2d')];_0x1818e1[_0x78b5('0x2e')]=_0x1818e1[_0x78b5('0x3c')];}RpcVoiceRecording['create'](_0x1818e1);}}};Report[_0x78b5('0xf')][_0x78b5('0x4d')]=function(_0x128d4e){if(_[_0x78b5('0x4e')](_0x128d4e)){_0x128d4e['forEach'](function(_0x502f2d){RpcVoiceAgentReport[_0x78b5('0x2a')](_0x502f2d);});}else{RpcVoiceAgentReport[_0x78b5('0x2a')](_0x128d4e);}};Report[_0x78b5('0xf')][_0x78b5('0x19')]=function(_0x436d3d){RpcVoiceDialReport[_0x78b5('0x2a')](_0x436d3d);var _0x21dbbb;var _0x3f8210;var _0x1370ac=_0x436d3d[_0x78b5('0x39')];if(_['startsWith'](_0x1370ac,_0x78b5('0x4f'))){_0x3f8210=_0x1370ac[_0x78b5('0x50')](_0x1370ac[_0x78b5('0x51')]('/')+0x1,_0x1370ac[_0x78b5('0x51')]('@'));_0x21dbbb=_['find'](this[_0x78b5('0xd')],function(_0x29c6d5){return _0x29c6d5[_0x78b5('0x52')]==_0x3f8210||_0x29c6d5[_0x78b5('0x53')]==_0x3f8210||_0x29c6d5[_0x78b5('0x21')]==_0x3f8210;});}else{_0x3f8210=_0x1370ac[_0x78b5('0x50')](_0x1370ac['indexOf']('/')+0x1,_0x1370ac[_0x78b5('0x54')]('-'));_0x21dbbb=this[_0x78b5('0x1d')](_0x3f8210);}if(_0x21dbbb){_0x436d3d[_0x78b5('0x22')]=_[_0x78b5('0x20')](_0x21dbbb[_0x78b5('0x22')])?util[_0x78b5('0x23')](_0x78b5('0x24'),_0x21dbbb[_0x78b5('0x1f')]):_0x21dbbb[_0x78b5('0x22')];_0x436d3d[_0x78b5('0x4b')]=_0x21dbbb['name'];_0x436d3d['accountcode']=_0x21dbbb['accountcode'];RpcMemberReport[_0x78b5('0x19')](_0x436d3d);}};Report[_0x78b5('0xf')][_0x78b5('0x1b')]=function(_0x215581){RpcVoiceTransferReport[_0x78b5('0x41')][_0x215581[_0x78b5('0x55')]]=_0x215581;};Report['prototype'][_0x78b5('0x56')]=function(_0x30c76b){RpcVoiceTransferReport[_0x78b5('0x56')](_0x30c76b);};module[_0x78b5('0x57')]=Report; \ No newline at end of file +var _0x5b04=['accountcode','isNil','find','interface','format','length','assigned','lastAssignedTo','name','SIP/%s','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','destinationchannel','channel','calleridpreview','originatecalleridnum','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridnum','transfers','linkedid','transfereelinkedid','uniqueid','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','phone','substring','lastIndexOf','membername','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5b04,0x1e5));var _0x45b0=function(_0x220649,_0x1c6ad6){_0x220649=_0x220649-0x0;var _0x18ceab=_0x5b04[_0x220649];return _0x18ceab;};'use strict';var _=require(_0x45b0('0x0'));var moment=require(_0x45b0('0x1'));var util=require('util');var config=require(_0x45b0('0x2'));var ami=require(_0x45b0('0x3'));var RpcVoiceAgentReport=require(_0x45b0('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x45b0('0x5'));var RpcVoiceQueueReport=require(_0x45b0('0x6'));var RpcVoiceRecording=require(_0x45b0('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x45b0('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x45b0('0x9'));var VoiceDialReport=require(_0x45b0('0xa'));var UserReport=require(_0x45b0('0xb'));function Report(_0x48af0d){this[_0x45b0('0xc')]=_0x48af0d;this[_0x45b0('0xd')]=_0x48af0d[_0x45b0('0xd')];this[_0x45b0('0xe')]=_0x48af0d[_0x45b0('0xe')];}Report[_0x45b0('0xf')][_0x45b0('0x10')]=function(_0x5a4f6b){var _0x42e8eb=new VoiceQueueReport(this['realtime']);var _0x27b5a2=new VoiceAgentReport(this[_0x45b0('0xc')]);var _0x32866c=new VoiceDialReport(this[_0x45b0('0xc')]);var _0x3ca462=new VoiceCallReport(this['realtime']);var _0x2c8eee=new UserReport(this[_0x45b0('0xc')]);if(config['xdr']&&config[_0x45b0('0x11')][_0x45b0('0x12')]){ami['on'](_0x45b0('0x13'),this[_0x45b0('0x14')]['bind'](this));ami['on'](_0x45b0('0x15'),this[_0x45b0('0x16')][_0x45b0('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0x45b0('0x18')][_0x45b0('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x45b0('0x19')][_0x45b0('0x17')](this));ami['on'](_0x45b0('0x1a'),this[_0x45b0('0x1b')][_0x45b0('0x17')](this));ami['on'](_0x45b0('0x1c'),this[_0x45b0('0x1d')][_0x45b0('0x17')](this));}};Report[_0x45b0('0xf')][_0x45b0('0x1e')]=function(_0x599b27){var _0x30b5d4;_0x30b5d4=_['find'](this['agents'],function(_0x593bc8){return _0x593bc8[_0x45b0('0x1f')]==_0x599b27||_0x593bc8['name']==_0x599b27;});if(_[_0x45b0('0x20')](_0x30b5d4)){var _0x58547f=_[_0x45b0('0x21')](this['telephones'],function(_0x2f72a3){return _0x2f72a3[_0x45b0('0x1f')]==_0x599b27||_0x2f72a3['name']==_0x599b27;});if(_0x58547f){_0x30b5d4=_[_0x45b0('0x21')](this[_0x45b0('0xd')],function(_0x349573){return _0x349573[_0x45b0('0x22')]==util[_0x45b0('0x23')]('SIP/%s',_0x58547f['name']);});}}return _0x30b5d4;};Report[_0x45b0('0xf')][_0x45b0('0x14')]=function(_0x18d5ba){for(var _0x434d8e=0x0;_0x434d8e<_0x18d5ba[_0x45b0('0x24')];_0x434d8e+=0x1){var _0x24676e=this['findAgent'](_0x18d5ba[_0x434d8e]['connectedlinenum']);if(_0x24676e){_0x18d5ba[_0x434d8e][_0x45b0('0x1f')]=_0x24676e['accountcode'];_0x18d5ba[_0x434d8e][_0x45b0('0x25')]=!![];_0x18d5ba[_0x434d8e][_0x45b0('0x26')]=_0x24676e[_0x45b0('0x27')];_0x18d5ba[_0x434d8e][_0x45b0('0x22')]=_[_0x45b0('0x20')](_0x24676e[_0x45b0('0x22')])?util[_0x45b0('0x23')](_0x45b0('0x28'),_0x24676e[_0x45b0('0x27')]):_0x24676e[_0x45b0('0x22')];if(_0x18d5ba[_0x434d8e]['queuecallercomplete']){_0x18d5ba[_0x434d8e][_0x45b0('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x18d5ba[_0x434d8e][_0x45b0('0x2a')]){_0x18d5ba[_0x434d8e][_0x45b0('0x2b')]=moment()[_0x45b0('0x23')](_0x45b0('0x2c'));}RpcMemberReport[_0x45b0('0x14')](_0x18d5ba[_0x434d8e]);}RpcVoiceQueueReport[_0x45b0('0x2d')](_0x18d5ba[_0x434d8e]);}};function extractCalleridNumber(_0x106d1c){var _0xb25a8b=_0x106d1c[_0x45b0('0x2e')](/<(.*?)>/);return _0xb25a8b?_0xb25a8b[0x1]:_0x106d1c;}Report['prototype'][_0x45b0('0x16')]=function(_0x109e13){_0x109e13[_0x45b0('0x2f')]=_0x109e13[_0x45b0('0x2f')]||_0x109e13[_0x45b0('0x30')];if(_0x109e13['type']=='dialer'){_0x109e13[_0x45b0('0x31')]=_0x45b0('0x32');_0x109e13[_0x45b0('0x33')]=_0x109e13[_0x45b0('0x32')];if(_0x109e13[_0x45b0('0x34')]==_0x45b0('0x35')){_0x109e13[_0x45b0('0x1f')]='';_0x109e13[_0x45b0('0x2f')]=extractCalleridNumber(_0x109e13[_0x45b0('0x36')]);}else if(_0x109e13[_0x45b0('0x34')]==_0x45b0('0x37')){if(_0x109e13[_0x45b0('0x2f')]==_0x45b0('0x38')){_0x109e13[_0x45b0('0x2f')]=extractCalleridNumber(_0x109e13['calleridpreview']);_0x109e13['calleridnum']=_0x109e13['originatecalleridnum'];_0x109e13[_0x45b0('0x39')]=[_0x109e13['channel'],_0x109e13[_0x45b0('0x3a')]=_0x109e13[_0x45b0('0x39')]][0x0];_0x109e13[_0x45b0('0x36')]=_0x109e13[_0x45b0('0x3b')];}else{_0x109e13[_0x45b0('0x2f')]=_0x109e13['calleridnum'];_0x109e13['calleridnum']=_0x109e13[_0x45b0('0x3c')];if(_0x109e13['disposition']==_0x45b0('0x3d')){_0x109e13[_0x45b0('0x1f')]=_0x109e13[_0x45b0('0x3e')];}else{_0x109e13[_0x45b0('0x1f')]='';}}}}else{_0x109e13[_0x45b0('0x36')]=util[_0x45b0('0x23')](_0x45b0('0x3f'),_0x109e13['calleridname'],_0x109e13[_0x45b0('0x40')]);}if(RpcVoiceTransferReport[_0x45b0('0x41')][_0x109e13[_0x45b0('0x42')]]){var _0x43f145=RpcVoiceTransferReport['transfers'][_0x109e13[_0x45b0('0x42')]];_0x43f145[_0x45b0('0x43')]=_0x109e13[_0x45b0('0x44')];RpcVoiceTransferReport[_0x45b0('0x1b')](_0x43f145);delete RpcVoiceTransferReport[_0x45b0('0x41')][_0x109e13[_0x45b0('0x42')]];}RpcVoiceCallReport[_0x45b0('0x2d')](_0x109e13);if(_0x109e13['monitor']){for(var _0x311a1d=0x0;_0x311a1d<_0x109e13[_0x45b0('0x45')]['length'];_0x311a1d+=0x1){_0x109e13[_0x45b0('0x46')]=_0x109e13[_0x45b0('0x45')][_0x311a1d][_0x45b0('0x47')];_0x109e13[_0x45b0('0x48')]=_0x109e13['monitors'][_0x311a1d][_0x45b0('0x48')];if(_0x109e13[_0x45b0('0x30')]==_0x45b0('0x38')){_0x109e13[_0x45b0('0x40')]=_0x109e13[_0x45b0('0x3e')];_0x109e13['calleridname']=_0x109e13['connectedlinename'];_0x109e13['connectedlinenum']=_0x109e13[_0x45b0('0x1f')];_0x109e13[_0x45b0('0x49')]=_0x109e13['membername'];_0x109e13[_0x45b0('0x30')]=_0x109e13[_0x45b0('0x3c')];}else if(_0x109e13[_0x45b0('0x30')]==_0x45b0('0x4a')){_0x109e13[_0x45b0('0x40')]=_0x109e13['destination'];_0x109e13[_0x45b0('0x30')]=_0x109e13[_0x45b0('0x3c')];}RpcVoiceRecording['create'](_0x109e13);}}};Report[_0x45b0('0xf')][_0x45b0('0x18')]=function(_0x4f47c0){if(_[_0x45b0('0x4b')](_0x4f47c0)){_0x4f47c0[_0x45b0('0x4c')](function(_0x551e67){RpcVoiceAgentReport[_0x45b0('0x2d')](_0x551e67);});}else{RpcVoiceAgentReport[_0x45b0('0x2d')](_0x4f47c0);}};Report[_0x45b0('0xf')]['voiceDialReport']=function(_0x3e53be){RpcVoiceDialReport[_0x45b0('0x2d')](_0x3e53be);var _0x3bd9d9;var _0x475206;var _0x431ec7=_0x3e53be[_0x45b0('0x3a')];if(_[_0x45b0('0x4d')](_0x431ec7,_0x45b0('0x4e'))){_0x475206=_0x431ec7['substring'](_0x431ec7[_0x45b0('0x4f')]('/')+0x1,_0x431ec7['indexOf']('@'));_0x3bd9d9=_[_0x45b0('0x21')](this[_0x45b0('0xd')],function(_0x1366e2){return _0x1366e2['mobile']==_0x475206||_0x1366e2[_0x45b0('0x50')]==_0x475206||_0x1366e2[_0x45b0('0x1f')]==_0x475206;});}else{_0x475206=_0x431ec7[_0x45b0('0x51')](_0x431ec7['indexOf']('/')+0x1,_0x431ec7[_0x45b0('0x52')]('-'));_0x3bd9d9=this[_0x45b0('0x1e')](_0x475206);}if(_0x3bd9d9){_0x3e53be[_0x45b0('0x22')]=_[_0x45b0('0x20')](_0x3bd9d9[_0x45b0('0x22')])?util[_0x45b0('0x23')]('SIP/%s',_0x3bd9d9[_0x45b0('0x27')]):_0x3bd9d9[_0x45b0('0x22')];_0x3e53be[_0x45b0('0x53')]=_0x3bd9d9['name'];_0x3e53be[_0x45b0('0x1f')]=_0x3bd9d9[_0x45b0('0x1f')];RpcMemberReport[_0x45b0('0x19')](_0x3e53be);}};Report['prototype'][_0x45b0('0x1b')]=function(_0x4b7356){RpcVoiceTransferReport['transfers'][_0x4b7356[_0x45b0('0x54')]]=_0x4b7356;};Report['prototype']['attendedTransfer']=function(_0xb17c72){RpcVoiceTransferReport['attendedTransfer'](_0xb17c72);};module[_0x45b0('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 d8c1e06..275647b 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 _0x45f3=['resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','omit','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','agents','local','toLowerCase','inuse','toNumber','format','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','mobile','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:%s','exports','moment','util','bluebird','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow'];(function(_0x312bab,_0x45dec3){var _0x120059=function(_0x5f0729){while(--_0x5f0729){_0x312bab['push'](_0x312bab['shift']());}};_0x120059(++_0x45dec3);}(_0x45f3,0x1a3));var _0x345f=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x45f3[_0x15d18f];return _0xd12bf7;};'use strict';var _=require('lodash');var moment=require(_0x345f('0x0'));var util=require(_0x345f('0x1'));var Redis=require('ioredis');var BPromise=require(_0x345f('0x2'));var config=require('../../../config/environment');var logger=require(_0x345f('0x3'))(_0x345f('0x4'));var ami=require(_0x345f('0x5'));config[_0x345f('0x6')]=_[_0x345f('0x7')](config[_0x345f('0x6')],{'host':_0x345f('0x8'),'port':0x18eb});var io=require(_0x345f('0x9'))(new Redis(config[_0x345f('0x6')]));function UserReport(_0x51e980){this[_0x345f('0xa')]=_0x51e980[_0x345f('0xa')];this['agents']=_0x51e980['agents'];this[_0x345f('0xb')]=_0x51e980[_0x345f('0xb')];ami['on']('registryentry',this['syncRegistry']['bind'](this));ami['on']('registry',this[_0x345f('0xc')][_0x345f('0xd')](this));ami['on'](_0x345f('0xe'),this[_0x345f('0xf')][_0x345f('0xd')](this));ami['on'](_0x345f('0x10'),this[_0x345f('0x11')]['bind'](this));return this[_0x345f('0x12')]();}function showSipRegistrations(){Promise[_0x345f('0x13')]()[_0x345f('0x14')](ami[_0x345f('0x15')]())[_0x345f('0x16')](function(_0x4cdc2a){logger[_0x345f('0x17')](_0x345f('0x18'),util[_0x345f('0x19')](_0x4cdc2a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x345f('0x13')]()[_0x345f('0x14')](ami[_0x345f('0x1a')]())[_0x345f('0x16')](function(_0x2ab380){logger['error'](_0x345f('0x1b'),util['inspect'](_0x2ab380,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x345f('0x13')]()['then'](ami[_0x345f('0x1c')]())[_0x345f('0x16')](function(_0x2959e4){logger[_0x345f('0x17')](_0x345f('0x1d'),util[_0x345f('0x19')](_0x2959e4,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x345f('0x13')]()[_0x345f('0x14')](showSipRegistrations())[_0x345f('0x14')](listDeviceStates())[_0x345f('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x345f('0x1e')]['isNotNull']=function(_0x8d75f3){return _0x8d75f3!==null&&!_[_0x345f('0x1f')](_0x8d75f3);};UserReport['prototype'][_0x345f('0x20')]=function(_0x1b7585,_0xa5f367,_0x32a7b8){io['to'](_0x1b7585)[_0x345f('0x20')](_0xa5f367,_0x32a7b8);};UserReport[_0x345f('0x1e')]['syncRegistry']=function(_0x462799){try{if(this[_0x345f('0x21')](_0x462799)){logger[_0x345f('0x22')](_0x345f('0x23'),_0x462799[_0x345f('0x24')],_0x462799[_0x345f('0x25')]);logger[_0x345f('0x26')](_0x345f('0x27'),util[_0x345f('0x19')](_0x462799,{'showHidden':![],'depth':null}));var _0x4e966b=_[_0x345f('0x28')](this[_0x345f('0xa')],{'defaultuser':_0x462799[_0x345f('0x24')]});if(_0x4e966b){_0x462799['stateRegistry']=_0x462799['state'];_['merge'](_0x4e966b,_[_0x345f('0x29')](_0x462799,['event','actionid',_0x345f('0x24'),_0x345f('0x25')]));logger[_0x345f('0x26')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x345f('0x19')](_0x4e966b,{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',_0x4e966b[_0x345f('0x2a')]),_0x345f('0x2b'),_0x4e966b);}}}catch(_0x1e7255){logger[_0x345f('0x17')](_0x345f('0x27'),util[_0x345f('0x19')](_0x1e7255,{'showHidden':![],'depth':null}));}};UserReport[_0x345f('0x1e')][_0x345f('0xf')]=function(_0xd7221f){try{if(this['isNotNull'](_0xd7221f)){logger[_0x345f('0x22')](_0x345f('0x2c'),_0xd7221f[_0x345f('0x2d')],_0xd7221f[_0x345f('0x25')]);logger[_0x345f('0x26')](_0x345f('0x2e'),util[_0x345f('0x19')](_0xd7221f,{'showHidden':![],'depth':null}));if(this[_0x345f('0x2f')][_0xd7221f[_0x345f('0x2d')]]){if(!this[_0x345f('0x2f')][_0xd7221f[_0x345f('0x2d')]][_0x345f('0x30')]||_0xd7221f['state'][_0x345f('0x31')]()==_0x345f('0x32')){this[_0x345f('0x2f')][_0xd7221f[_0x345f('0x2d')]][_0x345f('0x30')]=![];if(this['agents'][_0xd7221f[_0x345f('0x2d')]]['state']!==_0xd7221f[_0x345f('0x25')][_0x345f('0x31')]()){this[_0x345f('0x2f')][_0xd7221f[_0x345f('0x2d')]]['stateTime']=_[_0x345f('0x33')](moment()[_0x345f('0x34')]('x'));}this[_0x345f('0x2f')][_0xd7221f['device']][_0x345f('0x25')]=_0xd7221f[_0x345f('0x25')]['toLowerCase']();this[_0x345f('0x2f')][_0xd7221f[_0x345f('0x2d')]][_0x345f('0x35')](_0xd7221f);}}else if(this[_0x345f('0xb')][_0xd7221f[_0x345f('0x2d')]]){if(this['telephones'][_0xd7221f[_0x345f('0x2d')]][_0x345f('0x25')]!==_0xd7221f[_0x345f('0x25')][_0x345f('0x31')]()){this['telephones'][_0xd7221f['device']][_0x345f('0x36')]=_[_0x345f('0x33')](moment()[_0x345f('0x34')]('x'));}this[_0x345f('0xb')][_0xd7221f[_0x345f('0x2d')]][_0x345f('0x25')]=_0xd7221f[_0x345f('0x25')][_0x345f('0x31')]();logger[_0x345f('0x26')](_0x345f('0x37'),util[_0x345f('0x19')](this['telephones'][_0xd7221f[_0x345f('0x2d')]],{'showHidden':![],'depth':null}));this[_0x345f('0x20')](util[_0x345f('0x34')](_0x345f('0x38'),this[_0x345f('0xb')][_0xd7221f[_0x345f('0x2d')]][_0x345f('0x2a')]),'telephone:save',this[_0x345f('0xb')][_0xd7221f[_0x345f('0x2d')]]);}else if(this[_0x345f('0xa')][_0xd7221f[_0x345f('0x2d')]]){if(this[_0x345f('0xa')][_0xd7221f[_0x345f('0x2d')]][_0x345f('0x25')]!==_0xd7221f[_0x345f('0x25')][_0x345f('0x31')]()){this[_0x345f('0xa')][_0xd7221f[_0x345f('0x2d')]][_0x345f('0x36')]=_[_0x345f('0x33')](moment()[_0x345f('0x34')]('x'));}this[_0x345f('0xa')][_0xd7221f['device']][_0x345f('0x25')]=_0xd7221f['state'][_0x345f('0x31')]();logger[_0x345f('0x26')](_0x345f('0x39'),util[_0x345f('0x19')](this[_0x345f('0xa')][_0xd7221f[_0x345f('0x2d')]],{'showHidden':![],'depth':null}));this[_0x345f('0x20')](util[_0x345f('0x34')]('trunk:%s',this[_0x345f('0xa')][_0xd7221f[_0x345f('0x2d')]]['name']),_0x345f('0x2b'),this[_0x345f('0xa')][_0xd7221f['device']]);}else if(_[_0x345f('0x3a')](_0xd7221f['device'],'Local')){var _0x548c07=_0xd7221f[_0x345f('0x2d')];var _0x140e5e=_0x548c07[_0x345f('0x3b')](_0x548c07[_0x345f('0x3c')]('/')+0x1,_0x548c07[_0x345f('0x3c')]('@'));var _0x3dc77b=_[_0x345f('0x28')](this[_0x345f('0x2f')],function(_0x468877){return _0x468877[_0x345f('0x3d')]==_0x140e5e||_0x468877['phone']==_0x140e5e||_0x468877['accountcode']==_0x140e5e;});if(_0x3dc77b){if(_0x3dc77b[_0x345f('0x25')]!==_0xd7221f[_0x345f('0x25')]['toLowerCase']()){_0x3dc77b[_0x345f('0x36')]=_['toNumber'](moment()[_0x345f('0x34')]('x'));}_0x3dc77b[_0x345f('0x25')]=_0xd7221f[_0x345f('0x25')][_0x345f('0x31')]();_0x3dc77b[_0x345f('0x30')]=!![];_0x3dc77b[_0x345f('0x35')](_0xd7221f);}}}}catch(_0x5ef388){logger[_0x345f('0x17')](_0x345f('0x2e'),util['inspect'](_0x5ef388,{'showHidden':![],'depth':null}));}};UserReport[_0x345f('0x1e')]['syncPeerStatus']=function(_0x560dbd){try{if(this[_0x345f('0x21')](_0x560dbd)&&this['isNotNull'](_0x560dbd[_0x345f('0x10')])){logger['info'](_0x345f('0x3e'),_0x560dbd[_0x345f('0x3f')],_0x560dbd[_0x345f('0x40')],_0x560dbd[_0x345f('0x10')]);logger[_0x345f('0x26')](_0x345f('0x41'),util[_0x345f('0x19')](_0x560dbd,{'showHidden':![],'depth':null}));if(this[_0x345f('0x2f')][_0x560dbd[_0x345f('0x3f')]]){if(!this[_0x345f('0x2f')][_0x560dbd[_0x345f('0x3f')]][_0x345f('0x30')]||_0x560dbd[_0x345f('0x10')][_0x345f('0x31')]()==_0x345f('0x42')){this['agents'][_0x560dbd[_0x345f('0x3f')]]['local']=![];this[_0x345f('0x2f')][_0x560dbd[_0x345f('0x3f')]][_0x345f('0x43')]=_0x560dbd[_0x345f('0x10')][_0x345f('0x31')]();this[_0x345f('0x2f')][_0x560dbd[_0x345f('0x3f')]]['address']=_0x560dbd[_0x345f('0x40')];this['agents'][_0x560dbd['peer']][_0x345f('0x35')](_0x560dbd);}}else if(this['telephones'][_0x560dbd[_0x345f('0x3f')]]){this['telephones'][_0x560dbd[_0x345f('0x3f')]][_0x345f('0x43')]=_0x560dbd[_0x345f('0x10')][_0x345f('0x31')]();this['telephones'][_0x560dbd[_0x345f('0x3f')]][_0x345f('0x40')]=_0x560dbd['address'];logger['debug'](_0x345f('0x44'),util['inspect'](this[_0x345f('0xb')][_0x560dbd[_0x345f('0x3f')]],{'showHidden':![],'depth':null}));this[_0x345f('0x20')](util[_0x345f('0x34')]('telephone:%s',this['telephones'][_0x560dbd[_0x345f('0x3f')]][_0x345f('0x2a')]),_0x345f('0x45'),this[_0x345f('0xb')][_0x560dbd[_0x345f('0x3f')]]);}else if(this[_0x345f('0xa')][_0x560dbd[_0x345f('0x3f')]]){this['trunks'][_0x560dbd[_0x345f('0x3f')]]['status']=_0x560dbd[_0x345f('0x10')]['toLowerCase']();this['trunks'][_0x560dbd[_0x345f('0x3f')]][_0x345f('0x40')]=_0x560dbd[_0x345f('0x40')];logger[_0x345f('0x26')](_0x345f('0x46'),util[_0x345f('0x19')](this[_0x345f('0xa')][_0x560dbd[_0x345f('0x3f')]],{'showHidden':![],'depth':null}));this[_0x345f('0x20')](util[_0x345f('0x34')](_0x345f('0x47'),this['trunks'][_0x560dbd['peer']][_0x345f('0x2a')]),_0x345f('0x2b'),this[_0x345f('0xa')][_0x560dbd['peer']]);}}}catch(_0x3b7270){logger['error'](_0x345f('0x41'),util[_0x345f('0x19')](_0x3b7270,{'showHidden':![],'depth':null}));}};module[_0x345f('0x48')]=UserReport; \ No newline at end of file +var _0x78fc=['inuse','toNumber','toLowerCase','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','stateTime','startsWith','substring','mobile','phone','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','name','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','bind','syncRealtimeShow','resolve','then','catch','[userReport][sipshowregistry]','inspect','error','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x78fc,0xfb));var _0xc78f=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x78fc[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0xc78f('0x0'));var moment=require(_0xc78f('0x1'));var util=require(_0xc78f('0x2'));var Redis=require(_0xc78f('0x3'));var BPromise=require(_0xc78f('0x4'));var config=require(_0xc78f('0x5'));var logger=require('../../../config/logger')(_0xc78f('0x6'));var ami=require(_0xc78f('0x7'));config[_0xc78f('0x8')]=_[_0xc78f('0x9')](config['redis'],{'host':_0xc78f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc78f('0x8')]));function UserReport(_0x9ca6af){this[_0xc78f('0xb')]=_0x9ca6af['trunks'];this[_0xc78f('0xc')]=_0x9ca6af[_0xc78f('0xc')];this[_0xc78f('0xd')]=_0x9ca6af[_0xc78f('0xd')];ami['on'](_0xc78f('0xe'),this[_0xc78f('0xf')]['bind'](this));ami['on'](_0xc78f('0x10'),this[_0xc78f('0xf')]['bind'](this));ami['on'](_0xc78f('0x11'),this[_0xc78f('0x12')]['bind'](this));ami['on'](_0xc78f('0x13'),this[_0xc78f('0x14')][_0xc78f('0x15')](this));return this[_0xc78f('0x16')]();}function showSipRegistrations(){Promise[_0xc78f('0x17')]()[_0xc78f('0x18')](ami['actionSipShowRegistry']())[_0xc78f('0x19')](function(_0x37448d){logger['error'](_0xc78f('0x1a'),util[_0xc78f('0x1b')](_0x37448d,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xc78f('0x17')]()[_0xc78f('0x18')](ami['actionDeviceStateList']())['catch'](function(_0x214e54){logger[_0xc78f('0x1c')](_0xc78f('0x1d'),util['inspect'](_0x214e54,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc78f('0x17')]()[_0xc78f('0x18')](ami['actionSipPeerStatus']())[_0xc78f('0x19')](function(_0x5ac015){logger[_0xc78f('0x1c')](_0xc78f('0x1e'),util[_0xc78f('0x1b')](_0x5ac015,{'showHidden':![],'depth':null}));});}UserReport[_0xc78f('0x1f')][_0xc78f('0x16')]=function(){setInterval(function(){BPromise['resolve']()[_0xc78f('0x18')](showSipRegistrations())[_0xc78f('0x18')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x5149f9){return _0x5149f9!==null&&!_[_0xc78f('0x20')](_0x5149f9);};UserReport[_0xc78f('0x1f')][_0xc78f('0x21')]=function(_0x2cd950,_0x580e06,_0x167bd6){io['to'](_0x2cd950)[_0xc78f('0x21')](_0x580e06,_0x167bd6);};UserReport[_0xc78f('0x1f')][_0xc78f('0xf')]=function(_0x23641c){try{if(this[_0xc78f('0x22')](_0x23641c)){logger[_0xc78f('0x23')](_0xc78f('0x24'),_0x23641c[_0xc78f('0x25')],_0x23641c[_0xc78f('0x26')]);logger[_0xc78f('0x27')]('[userReport][registry]',util[_0xc78f('0x1b')](_0x23641c,{'showHidden':![],'depth':null}));var _0x375228=_[_0xc78f('0x28')](this[_0xc78f('0xb')],{'defaultuser':_0x23641c[_0xc78f('0x25')]});if(_0x375228){_0x23641c[_0xc78f('0x29')]=_0x23641c[_0xc78f('0x26')];_[_0xc78f('0x2a')](_0x375228,_[_0xc78f('0x2b')](_0x23641c,[_0xc78f('0x2c'),_0xc78f('0x2d'),_0xc78f('0x25'),_0xc78f('0x26')]));logger[_0xc78f('0x27')](_0xc78f('0x2e'),util['inspect'](_0x375228,{'showHidden':![],'depth':null}));this[_0xc78f('0x21')](util[_0xc78f('0x2f')]('trunk:%s',_0x375228['name']),_0xc78f('0x30'),_0x375228);}}}catch(_0x12e9bd){logger[_0xc78f('0x1c')](_0xc78f('0x31'),util['inspect'](_0x12e9bd,{'showHidden':![],'depth':null}));}};UserReport[_0xc78f('0x1f')][_0xc78f('0x12')]=function(_0x8c84f5){try{if(this[_0xc78f('0x22')](_0x8c84f5)){logger[_0xc78f('0x23')](_0xc78f('0x32'),_0x8c84f5[_0xc78f('0x33')],_0x8c84f5[_0xc78f('0x26')]);logger[_0xc78f('0x27')]('[userReport][devicestatechange]',util[_0xc78f('0x1b')](_0x8c84f5,{'showHidden':![],'depth':null}));if(this[_0xc78f('0xc')][_0x8c84f5['device']]){if(!this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x34')]||_0x8c84f5[_0xc78f('0x26')]['toLowerCase']()==_0xc78f('0x35')){this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x34')]=![];if(this['agents'][_0x8c84f5[_0xc78f('0x33')]]['state']!==_0x8c84f5['state']['toLowerCase']()){this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]]['stateTime']=_[_0xc78f('0x36')](moment()[_0xc78f('0x2f')]('x'));}this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x26')]=_0x8c84f5[_0xc78f('0x26')][_0xc78f('0x37')]();this[_0xc78f('0xc')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x38')](_0x8c84f5);}}else if(this['telephones'][_0x8c84f5[_0xc78f('0x33')]]){if(this[_0xc78f('0xd')][_0x8c84f5['device']]['state']!==_0x8c84f5[_0xc78f('0x26')]['toLowerCase']()){this[_0xc78f('0xd')][_0x8c84f5[_0xc78f('0x33')]]['stateTime']=_[_0xc78f('0x36')](moment()['format']('x'));}this[_0xc78f('0xd')][_0x8c84f5['device']][_0xc78f('0x26')]=_0x8c84f5[_0xc78f('0x26')][_0xc78f('0x37')]();logger['debug'](_0xc78f('0x39'),util['inspect'](this[_0xc78f('0xd')][_0x8c84f5[_0xc78f('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc78f('0x2f')](_0xc78f('0x3a'),this['telephones'][_0x8c84f5[_0xc78f('0x33')]]['name']),'telephone:save',this[_0xc78f('0xd')][_0x8c84f5[_0xc78f('0x33')]]);}else if(this[_0xc78f('0xb')][_0x8c84f5['device']]){if(this[_0xc78f('0xb')][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x26')]!==_0x8c84f5[_0xc78f('0x26')][_0xc78f('0x37')]()){this['trunks'][_0x8c84f5[_0xc78f('0x33')]][_0xc78f('0x3b')]=_[_0xc78f('0x36')](moment()[_0xc78f('0x2f')]('x'));}this[_0xc78f('0xb')][_0x8c84f5[_0xc78f('0x33')]]['state']=_0x8c84f5[_0xc78f('0x26')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xc78f('0x1b')](this[_0xc78f('0xb')][_0x8c84f5['device']],{'showHidden':![],'depth':null}));this[_0xc78f('0x21')](util[_0xc78f('0x2f')]('trunk:%s',this['trunks'][_0x8c84f5[_0xc78f('0x33')]]['name']),_0xc78f('0x30'),this[_0xc78f('0xb')][_0x8c84f5[_0xc78f('0x33')]]);}else if(_[_0xc78f('0x3c')](_0x8c84f5[_0xc78f('0x33')],'Local')){var _0x339fe5=_0x8c84f5[_0xc78f('0x33')];var _0xba297c=_0x339fe5[_0xc78f('0x3d')](_0x339fe5['indexOf']('/')+0x1,_0x339fe5['indexOf']('@'));var _0x1b8603=_[_0xc78f('0x28')](this['agents'],function(_0x46fa33){return _0x46fa33[_0xc78f('0x3e')]==_0xba297c||_0x46fa33[_0xc78f('0x3f')]==_0xba297c||_0x46fa33['accountcode']==_0xba297c;});if(_0x1b8603){if(_0x1b8603[_0xc78f('0x26')]!==_0x8c84f5['state']['toLowerCase']()){_0x1b8603[_0xc78f('0x3b')]=_[_0xc78f('0x36')](moment()[_0xc78f('0x2f')]('x'));}_0x1b8603[_0xc78f('0x26')]=_0x8c84f5[_0xc78f('0x26')][_0xc78f('0x37')]();_0x1b8603[_0xc78f('0x34')]=!![];_0x1b8603[_0xc78f('0x38')](_0x8c84f5);}}}}catch(_0x4bceb5){logger[_0xc78f('0x1c')](_0xc78f('0x40'),util['inspect'](_0x4bceb5,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0xa4402d){try{if(this[_0xc78f('0x22')](_0xa4402d)&&this[_0xc78f('0x22')](_0xa4402d[_0xc78f('0x13')])){logger[_0xc78f('0x23')](_0xc78f('0x41'),_0xa4402d[_0xc78f('0x42')],_0xa4402d[_0xc78f('0x43')],_0xa4402d['peerstatus']);logger[_0xc78f('0x27')](_0xc78f('0x44'),util[_0xc78f('0x1b')](_0xa4402d,{'showHidden':![],'depth':null}));if(this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]]){if(!this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x34')]||_0xa4402d[_0xc78f('0x13')][_0xc78f('0x37')]()==_0xc78f('0x45')){this['agents'][_0xa4402d[_0xc78f('0x42')]]['local']=![];this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x46')]=_0xa4402d[_0xc78f('0x13')][_0xc78f('0x37')]();this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x43')]=_0xa4402d[_0xc78f('0x43')];this[_0xc78f('0xc')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x38')](_0xa4402d);}}else if(this[_0xc78f('0xd')][_0xa4402d[_0xc78f('0x42')]]){this[_0xc78f('0xd')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x46')]=_0xa4402d['peerstatus'][_0xc78f('0x37')]();this['telephones'][_0xa4402d[_0xc78f('0x42')]]['address']=_0xa4402d[_0xc78f('0x43')];logger[_0xc78f('0x27')](_0xc78f('0x47'),util[_0xc78f('0x1b')](this[_0xc78f('0xd')][_0xa4402d[_0xc78f('0x42')]],{'showHidden':![],'depth':null}));this[_0xc78f('0x21')](util[_0xc78f('0x2f')](_0xc78f('0x3a'),this['telephones'][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x48')]),_0xc78f('0x49'),this[_0xc78f('0xd')][_0xa4402d['peer']]);}else if(this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]]){this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]][_0xc78f('0x46')]=_0xa4402d[_0xc78f('0x13')]['toLowerCase']();this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]]['address']=_0xa4402d[_0xc78f('0x43')];logger['debug'](_0xc78f('0x4a'),util[_0xc78f('0x1b')](this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]],{'showHidden':![],'depth':null}));this[_0xc78f('0x21')](util[_0xc78f('0x2f')]('trunk:%s',this['trunks'][_0xa4402d[_0xc78f('0x42')]]['name']),_0xc78f('0x30'),this[_0xc78f('0xb')][_0xa4402d[_0xc78f('0x42')]]);}}}catch(_0x1853d1){logger[_0xc78f('0x1c')](_0xc78f('0x44'),util[_0xc78f('0x1b')](_0x1853d1,{'showHidden':![],'depth':null}));}};module[_0xc78f('0x4b')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 1f57e05..2b2b0f1 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x34f2bd,_0x439091){var _0xe78bc6=function(_0x496d8c){while(--_0x496d8c){_0x34f2bd['push'](_0x34f2bd['shift']());}};_0xe78bc6(++_0x439091);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x2826c5,_0x3081fa){var _0x4c5ea0=function(_0x139347){while(--_0x139347){_0x2826c5['push'](_0x2826c5['shift']());}};_0x4c5ea0(++_0x3081fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'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 1575a39..49453f5 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 _0x932a=['error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','debug','linkedid','merge','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','name','accountcode','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','pick','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','disposition','includes','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','UserId','routealias','user:agentconnect','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','replace','.wav49','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','resolve','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','catch','destinationchannel','webbar:stopmonitors','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','origtransfereruniqueid','transfertargetuniqueid','some','origtransfererlinkedid','transferType','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','milliseconds','mohtime','exports','bluebird','lodash','path','../../../config/logger','ami','../ami','../rpc/setting','unknown','inuse','invalid','ringing','ringinuse','onhold','set','queue','agi','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','localhost','socket.io-emitter','channels','agents','syncNewExten','newexten','bind','newchannel','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels'];(function(_0x2e2c1b,_0x94deaf){var _0x43a4f2=function(_0x421a57){while(--_0x421a57){_0x2e2c1b['push'](_0x2e2c1b['shift']());}};_0x43a4f2(++_0x94deaf);}(_0x932a,0x92));var _0xa932=function(_0x532294,_0x17da1a){_0x532294=_0x532294-0x0;var _0x379a15=_0x932a[_0x532294];return _0x379a15;};'use strict';var BPromise=require(_0xa932('0x0'));var _=require(_0xa932('0x1'));var moment=require('moment');var util=require('util');var path=require(_0xa932('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xa932('0x3'))(_0xa932('0x4'));var ami=require(_0xa932('0x5'));var Channel=require('../model/channel');var RpcSetting=require(_0xa932('0x6'));var statusDesc=[_0xa932('0x7'),'not_inuse',_0xa932('0x8'),'busy',_0xa932('0x9'),'unavailable',_0xa932('0xa'),_0xa932('0xb'),_0xa932('0xc')];var applications=[_0xa932('0xd'),_0xa932('0xe'),_0xa932('0xf'),'dial','playback',_0xa932('0x10')];var dispositions=[_0xa932('0x11'),'FAILED',_0xa932('0x12'),_0xa932('0x11'),_0xa932('0x11'),_0xa932('0x11'),_0xa932('0x13'),'BUSY',_0xa932('0x12'),'FAILED',_0xa932('0x12')];var actions={};config[_0xa932('0x14')]=_['defaults'](config[_0xa932('0x14')],{'host':_0xa932('0x15'),'port':0x18eb});var io=require(_0xa932('0x16'))(new Redis(config[_0xa932('0x14')]));function VoiceCallReport(_0x5a18bd){this[_0xa932('0x17')]=_0x5a18bd['channels'];this['agents']=_0x5a18bd[_0xa932('0x18')];this['blindTransfers']={};ami['on']('coreshowchannel',this[_0xa932('0x19')]['bind'](this));ami['on'](_0xa932('0x1a'),this[_0xa932('0x19')][_0xa932('0x1b')](this));ami['on'](_0xa932('0x1c'),this['syncNewChannel'][_0xa932('0x1b')](this));ami['on']('newstate',this[_0xa932('0x1d')][_0xa932('0x1b')](this));ami['on'](_0xa932('0x1e'),this['syncVarSet'][_0xa932('0x1b')](this));ami['on'](_0xa932('0x1f'),this[_0xa932('0x20')][_0xa932('0x1b')](this));ami['on'](_0xa932('0x21'),this[_0xa932('0x22')][_0xa932('0x1b')](this));ami['on'](_0xa932('0x23'),this[_0xa932('0x24')][_0xa932('0x1b')](this));ami['on'](_0xa932('0x25'),this[_0xa932('0x26')][_0xa932('0x1b')](this));ami['on']('musiconholdstart',this[_0xa932('0x27')][_0xa932('0x1b')](this));ami['on'](_0xa932('0x28'),this[_0xa932('0x29')]['bind'](this));try{logger[_0xa932('0x2a')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xa932('0x2b')]();}catch(_0x40763f){logger[_0xa932('0x2c')](_0xa932('0x2d'),util[_0xa932('0x2e')](_0x40763f,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa932('0x2f')][_0xa932('0x30')]=function(_0x54022c){return _0x54022c!==null&&!_[_0xa932('0x31')](_0x54022c);};VoiceCallReport['prototype'][_0xa932('0x32')]=function(_0x951f43,_0x125885,_0x4f18b4){io['to'](_0x951f43)[_0xa932('0x32')](_0x125885,_0x4f18b4);};VoiceCallReport['prototype'][_0xa932('0x22')]=function(_0x4409c7){try{if(this[_0xa932('0x30')](_0x4409c7)){logger['info'](_0xa932('0x33'),_0x4409c7[_0xa932('0x34')],_0x4409c7['calleridname'],_0x4409c7['calleridnum']);logger[_0xa932('0x35')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x4409c7[_0xa932('0x34')],util['inspect'](_0x4409c7,{'showHidden':![],'depth':null}));if(_0x4409c7['uniqueid']===_0x4409c7[_0xa932('0x36')]){if(!_['isUndefined'](this['channels'][_0x4409c7['uniqueid']])){_[_0xa932('0x37')](this[_0xa932('0x17')][_0x4409c7[_0xa932('0x34')]],_['pick'](_0x4409c7,_[_0xa932('0x38')](this[_0xa932('0x17')][_0x4409c7['uniqueid']])));}}if(_0x4409c7[_0xa932('0x39')]===_0xa932('0x3a')){if(this[_0xa932('0x18')][_0x4409c7[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]){if(_0x4409c7[_0xa932('0x3d')]==_0xa932('0x3e')){this[_0xa932('0x18')][_0x4409c7[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x3f')]=_0x4409c7[_0xa932('0x40')];this[_0xa932('0x32')](util[_0xa932('0x41')]('user:%s',this[_0xa932('0x18')][_0x4409c7[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x42')]),'user:agentconnect',{'destaccountcode':this[_0xa932('0x18')][_0x4409c7['channel'][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x43')],'destconnectedlinenum':_0x4409c7[_0xa932('0x40')]});}}}}}catch(_0x350fbe){logger['error'](_0xa932('0x44'),_0x4409c7[_0xa932('0x34')],util[_0xa932('0x2e')](_0x350fbe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa932('0x2f')][_0xa932('0x45')]=function(_0x5e9817){try{if(this[_0xa932('0x30')](_0x5e9817)){logger['debug'](_0xa932('0x46'),_0x5e9817[_0xa932('0x34')],util['inspect'](_0x5e9817,{'showHidden':![],'depth':null}));if(_0x5e9817['uniqueid']===_0x5e9817[_0xa932('0x36')]&&_0x5e9817[_0xa932('0x3b')]!=_0xa932('0x47')){if(_[_0xa932('0x31')](this[_0xa932('0x17')][_0x5e9817[_0xa932('0x34')]])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x5e9817[_0xa932('0x34')],_0x5e9817['context'],_0x5e9817[_0xa932('0x3d')]);this[_0xa932('0x17')][_0x5e9817[_0xa932('0x34')]]=new Channel();this['channels'][_0x5e9817[_0xa932('0x34')]][_0xa932('0x48')]=moment()[_0xa932('0x41')](_0xa932('0x49'));this[_0xa932('0x17')][_0x5e9817[_0xa932('0x34')]]['disposition']=dispositions[_[_0xa932('0x4a')](_0x5e9817[_0xa932('0x4b')])];_['merge'](this[_0xa932('0x17')][_0x5e9817[_0xa932('0x34')]],_[_0xa932('0x4c')](_0x5e9817,_[_0xa932('0x38')](this[_0xa932('0x17')][_0x5e9817[_0xa932('0x34')]])));if(_0x5e9817['context']===_0xa932('0x3a')){if(this[_0xa932('0x18')][_0x5e9817[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]){if(_['isUndefined'](this[_0xa932('0x18')][_0x5e9817[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]['destconnectedlinenum'])){this[_0xa932('0x18')][_0x5e9817[_0xa932('0x3b')]['split']('-')[0x0]]['destconnectedlinenum']=_0x5e9817[_0xa932('0x3d')];logger['debug'](_0xa932('0x4d'),_0x5e9817[_0xa932('0x34')],util[_0xa932('0x2e')]({'destaccountcode':this[_0xa932('0x18')][_0x5e9817[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x43')],'destconnectedlinenum':_0x5e9817[_0xa932('0x3d')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xa932('0x4e'),this[_0xa932('0x18')][_0x5e9817['channel'][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x42')]),'user:agentconnect',{'destaccountcode':this[_0xa932('0x18')][_0x5e9817[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x43')],'destconnectedlinenum':_0x5e9817[_0xa932('0x3d')]});}}}}}}}catch(_0x2fd92a){logger['error'](_0xa932('0x4f'),_0x5e9817[_0xa932('0x34')],util[_0xa932('0x2e')](_0x2fd92a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa932('0x19')]=function(_0x26cb60){try{if(this[_0xa932('0x30')](_0x26cb60)){logger['debug'](_0xa932('0x50'),_0x26cb60['uniqueid'],util[_0xa932('0x2e')](_0x26cb60,{'showHidden':![],'depth':null}));if(_0x26cb60[_0xa932('0x34')]===_0x26cb60['linkedid']&&_0x26cb60[_0xa932('0x3d')]!='h'&&_0x26cb60[_0xa932('0x3b')]!='OutgoingSpoolFailed'){_0x26cb60[_0xa932('0x51')]=_0x26cb60[_0xa932('0x51')][_0xa932('0x52')]();_0x26cb60[_0xa932('0x53')]=_0x26cb60[_0xa932('0x54')]&&_0x26cb60[_0xa932('0x54')]['startsWith'](_0xa932('0x55'))?_0x26cb60['appdata']:(_0x26cb60[_0xa932('0x54')]||_0x26cb60[_0xa932('0x53')])['toLowerCase']();logger[_0xa932('0x2a')](_0xa932('0x56'),_0x26cb60[_0xa932('0x34')],_0x26cb60['application'],_0x26cb60['applicationdata']);if(_['isUndefined'](this[_0xa932('0x17')][_0x26cb60[_0xa932('0x34')]])){this['channels'][_0x26cb60['uniqueid']]=new Channel();this[_0xa932('0x17')][_0x26cb60[_0xa932('0x34')]][_0xa932('0x48')]=_0x26cb60[_0xa932('0x57')]?moment()['subtract'](moment[_0xa932('0x57')](_0x26cb60[_0xa932('0x57')])[_0xa932('0x58')](),_0xa932('0x58'))['format'](_0xa932('0x49')):moment()[_0xa932('0x41')](_0xa932('0x49'));this[_0xa932('0x17')][_0x26cb60[_0xa932('0x34')]][_0xa932('0x59')]=_0xa932('0x11');}_[_0xa932('0x37')](this['channels'][_0x26cb60['uniqueid']],_[_0xa932('0x4c')](_0x26cb60,_['keys'](this['channels'][_0x26cb60['uniqueid']])));if(_[_0xa932('0x5a')](applications,_0x26cb60[_0xa932('0x51')])){this[_0xa932('0x17')][_0x26cb60['uniqueid']]['lastapplication']=_0x26cb60['application'];this[_0xa932('0x17')][_0x26cb60[_0xa932('0x34')]][_0xa932('0x5b')]=_0x26cb60[_0xa932('0x53')];if(_0x26cb60['application']===_0xa932('0xd')&&_[_0xa932('0x5c')](_0x26cb60['applicationdata'][_0xa932('0x52')](),_0xa932('0x5d'))){var _0x9f3c01=_0x26cb60[_0xa932('0x53')]['split']('=');var _0xe80f8f=_0x9f3c01[0x0][_0xa932('0x52')]()[_0xa932('0x5e')](/cdr\((.*)\)/);if(_0xe80f8f){this[_0xa932('0x17')][_0x26cb60[_0xa932('0x34')]][_0xe80f8f[0x1]]=_0x9f3c01[0x1];}}else if(_0x26cb60[_0xa932('0x51')]===_0xa932('0xe')){this[_0xa932('0x17')][_0x26cb60[_0xa932('0x34')]]['queue']=_0x26cb60[_0xa932('0x53')][_0xa932('0x3c')](',')[0x0];}}}}}catch(_0x447ef9){logger[_0xa932('0x2c')](_0xa932('0x5f'),_0x26cb60['uniqueid'],util['inspect'](_0x447ef9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa932('0x2f')][_0xa932('0x1d')]=function(_0x4265b8){try{if(this['isNotNull'](_0x4265b8)){logger[_0xa932('0x2a')](_0xa932('0x60'),_0x4265b8[_0xa932('0x34')],_0x4265b8['linkedid'],_0x4265b8[_0xa932('0x61')],_0x4265b8[_0xa932('0x62')]);logger[_0xa932('0x35')](_0xa932('0x63'),_0x4265b8[_0xa932('0x34')],util[_0xa932('0x2e')](_0x4265b8,{'showHidden':![],'depth':null}));if(_0x4265b8['uniqueid']!==_0x4265b8[_0xa932('0x36')]){if(this['channels'][_0x4265b8[_0xa932('0x36')]]){if(_0x4265b8[_0xa932('0x4b')]==='6'){if(!this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]][_0xa932('0x64')]){var _0x3a7d5b=moment();this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]][_0xa932('0x64')]=!![];this['channels'][_0x4265b8['linkedid']][_0xa932('0x65')]=_0x3a7d5b['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]][_0xa932('0x48')]){this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]][_0xa932('0x66')]=_0x3a7d5b[_0xa932('0x67')](this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]][_0xa932('0x48')],_0xa932('0x58'));}}this[_0xa932('0x17')][_0x4265b8['linkedid']][_0xa932('0x36')]=_0x4265b8['uniqueid'];if(_0x4265b8[_0xa932('0x62')]!==_0xa932('0x3e')){this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]][_0xa932('0x40')]=_0x4265b8['calleridnum'];}this['channels'][_0x4265b8['linkedid']][_0xa932('0x68')]=_0x4265b8['calleridname'];this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]]['destinationchannel']=_0x4265b8[_0xa932('0x3b')];this[_0xa932('0x17')][_0x4265b8['linkedid']][_0xa932('0x59')]=dispositions[_[_0xa932('0x4a')](_0x4265b8[_0xa932('0x4b')])];if(this['agents'][_0x4265b8[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]){this['channels'][_0x4265b8['linkedid']]['UserId']=this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]['id'];this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]]['membername']=this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x42')];}}}}else{if(this[_0xa932('0x17')][_0x4265b8[_0xa932('0x34')]]){if(_0x4265b8[_0xa932('0x4b')]==='6'){if(this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')]['split']('-')[0x0]]){this['channels'][_0x4265b8['uniqueid']][_0xa932('0x69')]=this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]['id'];this[_0xa932('0x17')][_0x4265b8['uniqueid']]['membername']=this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]['name'];}}}}if(_0x4265b8[_0xa932('0x4b')]==='6'&&_0x4265b8[_0xa932('0x39')]==='from-sip'){if(this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]){this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x3f')]=_0x4265b8['exten'];var _0x55028b;if(this[_0xa932('0x17')][_0x4265b8[_0xa932('0x34')]])_0x55028b=this[_0xa932('0x17')][_0x4265b8[_0xa932('0x34')]][_0xa932('0x6a')];else if(this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]])_0x55028b=this[_0xa932('0x17')][_0x4265b8[_0xa932('0x36')]][_0xa932('0x6a')];logger[_0xa932('0x35')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x4265b8[_0xa932('0x34')],util[_0xa932('0x2e')]({'destaccountcode':this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x43')],'destconnectedlinenum':_0x4265b8[_0xa932('0x3d')],'routealias':_0x55028b},{'showHidden':![],'depth':null}));this['emit'](util[_0xa932('0x41')]('user:%s',this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]['name']),_0xa932('0x6b'),{'destaccountcode':this[_0xa932('0x18')][_0x4265b8[_0xa932('0x3b')]['split']('-')[0x0]][_0xa932('0x43')],'destconnectedlinenum':_0x4265b8[_0xa932('0x3d')],'routealias':_0x55028b});}}}}catch(_0x28a327){logger[_0xa932('0x2c')]('[%s][voiceCallReport][newstate]',_0x4265b8[_0xa932('0x34')],util[_0xa932('0x2e')](_0x28a327,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa932('0x2f')][_0xa932('0x6c')]=function(_0x3764ef,_0x259c19){try{if(this[_0xa932('0x17')][_0x3764ef]){logger[_0xa932('0x2a')](_0xa932('0x6d'),_0x3764ef,_0x259c19);this[_0xa932('0x17')][_0x3764ef][_0xa932('0x6e')]=!![];if(_['endsWith'](_0x259c19,'.wav49')){_0x259c19=_0x259c19[_0xa932('0x6f')](_0xa932('0x70'),_0xa932('0x71'));}this['channels'][_0x3764ef][_0xa932('0x72')]=_0x259c19;var _0x28073a=_['find'](this[_0xa932('0x17')][_0x3764ef]['monitors'],{'filename':_0x259c19});if(_['isNil'](_0x28073a)){this[_0xa932('0x17')][_0x3764ef][_0xa932('0x73')][_0xa932('0x74')]({'filename':_0x259c19,'createdAt':moment()[_0xa932('0x41')](_0xa932('0x49')),'mixmonitorid':'','status':_0xa932('0x75')});}}}catch(_0x2b9544){logger['error'](_0xa932('0x76'),_0x3764ef,util['inspect'](_0x2b9544,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa932('0x2f')][_0xa932('0x77')]=function(_0x240ca6){try{if(this[_0xa932('0x30')](_0x240ca6)){logger[_0xa932('0x35')](_0xa932('0x78'),_0x240ca6['uniqueid'],util[_0xa932('0x2e')](_0x240ca6,{'showHidden':![],'depth':null}));if(this[_0xa932('0x17')][_0x240ca6['uniqueid']]&&_0x240ca6[_0xa932('0x3b')]!='OutgoingSpoolFailed'){if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')])){if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')][_0xa932('0x7a')])){logger[_0xa932('0x2a')](_0xa932('0x7b'),_0x240ca6[_0xa932('0x34')],_0x240ca6[_0xa932('0x7c')]);this[_0xa932('0x6c')](_0x240ca6[_0xa932('0x34')],_0x240ca6[_0xa932('0x7c')]);}else if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')][_0xa932('0x7d')])){logger[_0xa932('0x2a')](_0xa932('0x7e'),_0x240ca6[_0xa932('0x34')],_0x240ca6[_0xa932('0x7c')]);this['channels'][_0x240ca6['uniqueid']][_0xa932('0x62')]=_0x240ca6['value'];}else if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')]['xmd-callerid'])){logger[_0xa932('0x2a')](_0xa932('0x7f'),_0x240ca6[_0xa932('0x34')],_0x240ca6[_0xa932('0x7c')]);this[_0xa932('0x17')][_0x240ca6[_0xa932('0x34')]]['callerid']=_0x240ca6['value'];}else if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')][_0xa932('0x80')])){logger[_0xa932('0x2a')](_0xa932('0x81'),_0x240ca6[_0xa932('0x34')],_0x240ca6['value']);this[_0xa932('0x17')][_0x240ca6[_0xa932('0x34')]][_0xa932('0x82')]=_0x240ca6[_0xa932('0x7c')];}else if(this[_0xa932('0x30')](_0x240ca6['variable'][_0xa932('0x83')])){logger[_0xa932('0x2a')](_0xa932('0x84'),_0x240ca6[_0xa932('0x34')],_0x240ca6[_0xa932('0x7c')]['split'](',')[0x0]);this[_0xa932('0x17')][_0x240ca6[_0xa932('0x34')]]['queue']=_0x240ca6[_0xa932('0x7c')][_0xa932('0x3c')](',')[0x0];}else if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')][_0xa932('0x85')])){logger[_0xa932('0x2a')](_0xa932('0x86'),_0x240ca6[_0xa932('0x34')],_0x240ca6[_0xa932('0x7c')]);this['channels'][_0x240ca6[_0xa932('0x34')]]['originatecalleridnum']=_0x240ca6[_0xa932('0x7c')];}else if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')][_0xa932('0x87')])){logger[_0xa932('0x2a')](_0xa932('0x88'),_0x240ca6[_0xa932('0x34')],_0x240ca6['value']);this[_0xa932('0x17')][_0x240ca6[_0xa932('0x34')]]['destination']=_0x240ca6[_0xa932('0x7c')];}else if(this['isNotNull'](_0x240ca6[_0xa932('0x79')][_0xa932('0x89')])){logger[_0xa932('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x240ca6['uniqueid'],_0x240ca6[_0xa932('0x7c')]);this[_0xa932('0x17')][_0x240ca6[_0xa932('0x34')]]['calleridpreview']=_0x240ca6[_0xa932('0x7c')];}else if(this[_0xa932('0x30')](_0x240ca6['variable'][_0xa932('0x8a')])){logger['info'](_0xa932('0x8b'),_0x240ca6[_0xa932('0x34')],_0x240ca6['value']);this['channels'][_0x240ca6[_0xa932('0x34')]][_0xa932('0xe')]=_0x240ca6[_0xa932('0x7c')];}else if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')]['sipcallid'])){logger[_0xa932('0x2a')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x240ca6['uniqueid'],_0x240ca6[_0xa932('0x7c')]);this[_0xa932('0x17')][_0x240ca6[_0xa932('0x34')]][_0xa932('0x8c')]=_0x240ca6['value'];}}}else if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')][_0xa932('0x7a')])){if(_0x240ca6[_0xa932('0x7c')]){var _0x323f1e=path[_0xa932('0x8d')](_0x240ca6[_0xa932('0x7c')])['name'];logger[_0xa932('0x2a')](_0xa932('0x7b'),_0x323f1e,_0x240ca6['value']);this['syncMixMonitorFilename'](_0x323f1e,_0x240ca6['value']);}}else if(this[_0xa932('0x17')][_0x240ca6[_0xa932('0x36')]]){if(this[_0xa932('0x30')](_0x240ca6['variable'])){if(this[_0xa932('0x30')](_0x240ca6[_0xa932('0x79')]['sipcallid'])){logger['info'](_0xa932('0x8e'),_0x240ca6[_0xa932('0x36')],_0x240ca6[_0xa932('0x7c')]);this[_0xa932('0x17')][_0x240ca6[_0xa932('0x36')]][_0xa932('0x8f')]=_0x240ca6[_0xa932('0x7c')];}}}}}catch(_0x262f46){logger[_0xa932('0x2c')]('[%s][voiceCallReport][varset]',_0x240ca6[_0xa932('0x34')],util['inspect'](_0x262f46,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa932('0x2f')][_0xa932('0x20')]=function(_0x2e4831){try{if(this['isNotNull'](_0x2e4831)){logger[_0xa932('0x35')](_0xa932('0x90'),_0x2e4831[_0xa932('0x34')],util[_0xa932('0x2e')](_0x2e4831,{'showHidden':![],'depth':null}));if(this[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]]){logger[_0xa932('0x2a')](_0xa932('0x91'),_0x2e4831[_0xa932('0x34')],_0x2e4831['cause-txt']);var _0x2810fd=moment();this[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]][_0xa932('0x92')]=_0x2810fd['format'](_0xa932('0x49'));this[_0xa932('0x17')][_0x2e4831['uniqueid']]['duration']=_0x2810fd[_0xa932('0x67')](this['channels'][_0x2e4831[_0xa932('0x34')]][_0xa932('0x48')],_0xa932('0x58'));if(this[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]][_0xa932('0x64')]){this[_0xa932('0x17')][_0x2e4831['uniqueid']][_0xa932('0x93')]=_0x2810fd[_0xa932('0x67')](this[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]][_0xa932('0x65')],_0xa932('0x58'));this[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]][_0xa932('0x66')]=this[_0xa932('0x17')][_0x2e4831['uniqueid']][_0xa932('0x57')]-this[_0xa932('0x17')][_0x2e4831['uniqueid']][_0xa932('0x93')];}if(_0x2e4831['context']===_0xa932('0x3a')){if(this[_0xa932('0x18')][_0x2e4831[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]){this[_0xa932('0x18')][_0x2e4831['channel'][_0xa932('0x3c')]('-')[0x0]]=_[_0xa932('0x94')](this[_0xa932('0x18')][_0x2e4831['channel'][_0xa932('0x3c')]('-')[0x0]],['destconnectedlinenum']);logger[_0xa932('0x35')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x2e4831[_0xa932('0x34')],util[_0xa932('0x2e')]({'id':this['agents'][_0x2e4831[_0xa932('0x3b')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xa932('0x18')][_0x2e4831[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xa932('0x32')](util[_0xa932('0x41')](_0xa932('0x4e'),this[_0xa932('0x18')][_0x2e4831['channel'][_0xa932('0x3c')]('-')[0x0]]['name']),'user:agentcomplete',{'id':this[_0xa932('0x18')][_0x2e4831[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xa932('0x18')][_0x2e4831[_0xa932('0x3b')][_0xa932('0x3c')]('-')[0x0]][_0xa932('0x43')]});}}var _0x357dca=this;Promise[_0xa932('0x95')]()['then'](function(){var _0x1ed881=_0x357dca[_0xa932('0x17')][_0x2e4831['uniqueid']];if(typeof _0x1ed881['transferType']==='undefined')return;if(_[_0xa932('0x96')](_0x1ed881[_0xa932('0x73')]))return;return RpcSetting[_0xa932('0x97')]()[_0xa932('0x98')](function(_0x3591b4){if(!_0x3591b4[_0xa932('0x99')])return;return Promise[_0xa932('0x95')]()['then'](function(){return ami[_0xa932('0x9a')]({'action':'StopMixMonitor','channel':_0x1ed881[_0xa932('0x3b')]})[_0xa932('0x9b')](function(){});})[_0xa932('0x98')](function(){return ami[_0xa932('0x9a')]({'action':'StopMixMonitor','channel':_0x1ed881[_0xa932('0x9c')]})[_0xa932('0x9b')](function(){})['finally'](function(){var _0x4f26e4=_0x357dca[_0xa932('0x18')][_0x1ed881[_0xa932('0x9c')][_0xa932('0x3c')]('-')[0x0]];if(!_0x4f26e4)return;io[_0xa932('0x32')](_0xa932('0x9d'),{'agentId':_0x4f26e4['id'],'uniqueid':_0x1ed881['uniqueid']});});});});})[_0xa932('0x98')](function(){if(_0x2e4831['event']===_0xa932('0x9e')){_0x357dca[_0xa932('0x9f')][_0x2e4831[_0xa932('0x34')]]=_0x357dca[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]];}else{if(_0x357dca[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]][_0xa932('0x82')]===_0xa932('0xa0')&&_0x357dca[_0xa932('0x9f')][_0x2e4831[_0xa932('0x34')]]){_0x357dca[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]][_0xa932('0x34')]=[_0x357dca['channels'][_0x2e4831[_0xa932('0x34')]][_0xa932('0x36')],_0x357dca[_0xa932('0x17')][_0x2e4831['uniqueid']]['linkedid']=_0x357dca[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]][_0xa932('0x34')]][0x0];delete _0x357dca[_0xa932('0x9f')][_0x2e4831[_0xa932('0x34')]];}}logger[_0xa932('0x35')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x2e4831['uniqueid'],util[_0xa932('0x2e')](_0x357dca[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]],{'showHidden':![],'depth':null}));ami[_0xa932('0x32')]('custom:voiceCallReport',_0x357dca[_0xa932('0x17')][_0x2e4831[_0xa932('0x34')]]);delete _0x357dca['channels'][_0x2e4831[_0xa932('0x34')]];});}}}catch(_0x15c6c6){logger[_0xa932('0x2c')](_0xa932('0xa1'),_0x2e4831['uniqueid'],util['inspect'](_0x15c6c6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0x5da045){try{if(this[_0xa932('0x30')](_0x5da045)){logger['info'](_0xa932('0xa2'),_0x5da045[_0xa932('0x34')],_0x5da045[_0xa932('0xa3')],_0x5da045['transfertargetcalleridnum']);logger['debug']('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x5da045['uniqueid'],util[_0xa932('0x2e')](_0x5da045,{'showHidden':![],'depth':null}));if(this[_0xa932('0x17')][_0x5da045[_0xa932('0xa4')]]){this[_0xa932('0x17')][_0x5da045[_0xa932('0xa4')]][_0xa932('0xa5')]=_0x5da045[_0xa932('0xa3')];this[_0xa932('0x17')][_0x5da045[_0xa932('0xa4')]][_0xa932('0xa6')]=_0x5da045[_0xa932('0xa7')];if(this['channels'][_0x5da045[_0xa932('0xa8')]]){var _0x2cfad0=this[_0xa932('0x17')][_0x5da045[_0xa932('0xa8')]];this[_0xa932('0x17')][_0x5da045[_0xa932('0xa8')]]=this['channels'][_0x5da045[_0xa932('0xa4')]];this[_0xa932('0x17')][_0x5da045[_0xa932('0xa4')]]=_0x2cfad0;}}else if(this[_0xa932('0x17')][_0x5da045['transfertargetuniqueid']]){this[_0xa932('0x17')][_0x5da045['transfertargetuniqueid']]['transfercalleridnum']=_0x5da045['origtransferercalleridnum'];this['channels'][_0x5da045['transfertargetuniqueid']][_0xa932('0xa6')]=_0x5da045['transfertargetcalleridnum'];if(this[_0xa932('0x17')][_0x5da045[_0xa932('0xa9')]]){var _0x2cfad0=this[_0xa932('0x17')][_0x5da045[_0xa932('0xa9')]];this[_0xa932('0x17')][_0x5da045['origtransfereruniqueid']]=this[_0xa932('0x17')][_0x5da045[_0xa932('0xaa')]];this[_0xa932('0x17')][_0x5da045['transfertargetuniqueid']]=_0x2cfad0;}}if((this[_0xa932('0x17')][_0x5da045[_0xa932('0xa9')]]||this['channels'][_0x5da045['origtransfererlinkedid']])&&this[_0xa932('0x17')][_0x5da045[_0xa932('0xa8')]]){var _0x534fc0=_[_0xa932('0xab')]([this[_0xa932('0x17')][_0x5da045['origtransfereruniqueid']],this[_0xa932('0x17')][_0x5da045[_0xa932('0xac')]],this['channels'][_0x5da045[_0xa932('0xa8')]]],function(_0x1f681e){return _0x1f681e&&_0x1f681e[_0xa932('0x82')]===_0xa932('0xa0')&&_0x1f681e['routeid'];});if(_0x534fc0){if(this[_0xa932('0x17')][_0x5da045[_0xa932('0xa9')]])this[_0xa932('0x17')][_0x5da045[_0xa932('0xa9')]][_0xa932('0xad')]='ATTENDED';if(this[_0xa932('0x17')][_0x5da045[_0xa932('0xac')]])this['channels'][_0x5da045[_0xa932('0xac')]][_0xa932('0xad')]='ATTENDED';this['channels'][_0x5da045[_0xa932('0xa8')]][_0xa932('0xad')]='ATTENDED';}}}}catch(_0x413d49){logger[_0xa932('0x2c')](_0xa932('0xae'),_0x5da045[_0xa932('0x34')],util['inspect'](_0x413d49,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa932('0x2f')][_0xa932('0x26')]=function(_0x51796f){try{if(this['isNotNull'](_0x51796f)){logger[_0xa932('0x2a')](_0xa932('0xaf'),_0x51796f[_0xa932('0x34')],_0x51796f[_0xa932('0xb0')],_0x51796f[_0xa932('0xb1')]);logger[_0xa932('0x35')](_0xa932('0xb2'),_0x51796f['uniqueid'],util['inspect'](_0x51796f,{'showHidden':![],'depth':null}));if(this['channels'][_0x51796f['transfereeuniqueid']]){this[_0xa932('0x17')][_0x51796f[_0xa932('0xa4')]][_0xa932('0xa5')]=_0x51796f['transfereecalleridnum'];this[_0xa932('0x17')][_0x51796f[_0xa932('0xa4')]]['transferconnectedlinenum']=_0x51796f[_0xa932('0xb1')];this[_0xa932('0x17')][_0x51796f[_0xa932('0xa4')]][_0xa932('0xad')]=_0xa932('0xb3');this[_0xa932('0x20')]({'event':_0xa932('0x9e'),'uniqueid':_0x51796f[_0xa932('0xa4')],'context':_0x51796f[_0xa932('0x39')],'channel':_0x51796f[_0xa932('0xb4')]});}else{this[_0xa932('0x17')][_0x51796f[_0xa932('0xb5')]][_0xa932('0xad')]=_0xa932('0xb3');}}}catch(_0x3755f1){logger['error'](_0xa932('0xb6'),_0x51796f[_0xa932('0x34')],util['inspect'](_0x3755f1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa932('0x2f')][_0xa932('0x27')]=function(_0x361214){try{if(this[_0xa932('0x30')](_0x361214)){logger[_0xa932('0x35')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x361214[_0xa932('0x34')],util[_0xa932('0x2e')](_0x361214,{'showHidden':![],'depth':null}));if(this['channels'][_0x361214[_0xa932('0x34')]]){if(!_[_0xa932('0xb7')](this[_0xa932('0x17')][_0x361214[_0xa932('0x34')]]['answertime'])){this[_0xa932('0x17')][_0x361214['uniqueid']][_0xa932('0xb8')]=moment()[_0xa932('0x41')](_0xa932('0x49'));logger[_0xa932('0x2a')](_0xa932('0xb9'),_0x361214['uniqueid'],this[_0xa932('0x17')][_0x361214[_0xa932('0x34')]]['mohstarttime']);}}}}catch(_0x2f9340){logger[_0xa932('0x2c')](_0xa932('0xba'),_0x361214[_0xa932('0x34')],util[_0xa932('0x2e')](_0x2f9340,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa932('0x2f')][_0xa932('0x29')]=function(_0x182509){try{if(this[_0xa932('0x30')](_0x182509)){logger[_0xa932('0x35')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x182509[_0xa932('0x34')],util[_0xa932('0x2e')](_0x182509,{'showHidden':![],'depth':null}));if(this[_0xa932('0x17')][_0x182509[_0xa932('0x34')]]){if(!_[_0xa932('0xb7')](this['channels'][_0x182509[_0xa932('0x34')]][_0xa932('0xb8')])){this[_0xa932('0x17')][_0x182509[_0xa932('0x34')]]['mohtime']+=moment()[_0xa932('0xbb')](0x0)[_0xa932('0x67')](this['channels'][_0x182509[_0xa932('0x34')]]['mohstarttime'],'seconds');logger['info']('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x182509['uniqueid'],this['channels'][_0x182509['uniqueid']][_0xa932('0xbc')]);delete this['channels'][_0x182509['uniqueid']][_0xa932('0xb8')];}}}}catch(_0x7d3a66){logger[_0xa932('0x2c')]('[%s][voiceCallReport][musiconholdstop]',_0x182509[_0xa932('0x34')],util[_0xa932('0x2e')](_0x7d3a66,{'showHidden':![],'depth':null}));}};module[_0xa932('0xbd')]=VoiceCallReport; \ No newline at end of file +var _0xa315=['newcallerid','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:agentconnect','accountcode','error','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','disposition','toNumber','channelstate','merge','pick','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','connectedlinename','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','find','monitors','isNil','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','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','mixmonitor_filename','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','ATTENDED','transferType','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','set','queue','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','channels','agents','blindTransfers','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup'];(function(_0x1b892b,_0x4efe48){var _0xa99e57=function(_0x3f957a){while(--_0x3f957a){_0x1b892b['push'](_0x1b892b['shift']());}};_0xa99e57(++_0x4efe48);}(_0xa315,0xa4));var _0x5a31=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0xa315[_0x1d211b];return _0x47c88b;};'use strict';var BPromise=require(_0x5a31('0x0'));var _=require('lodash');var moment=require(_0x5a31('0x1'));var util=require(_0x5a31('0x2'));var path=require(_0x5a31('0x3'));var Redis=require(_0x5a31('0x4'));var config=require(_0x5a31('0x5'));var logger=require(_0x5a31('0x6'))(_0x5a31('0x7'));var ami=require(_0x5a31('0x8'));var Channel=require(_0x5a31('0x9'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0x5a31('0xa'),_0x5a31('0xb'),_0x5a31('0xc'),_0x5a31('0xd'),_0x5a31('0xe'),_0x5a31('0xf'),_0x5a31('0x10'),'ringinuse',_0x5a31('0x11')];var applications=[_0x5a31('0x12'),_0x5a31('0x13'),'agi','dial',_0x5a31('0x14'),_0x5a31('0x15')];var dispositions=[_0x5a31('0x16'),_0x5a31('0x17'),_0x5a31('0x17'),_0x5a31('0x16'),'NO\x20ANSWER','NO\x20ANSWER',_0x5a31('0x18'),_0x5a31('0x19'),_0x5a31('0x17'),_0x5a31('0x17'),_0x5a31('0x17')];var actions={};config['redis']=_[_0x5a31('0x1a')](config[_0x5a31('0x1b')],{'host':_0x5a31('0x1c'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x25c63b){this['channels']=_0x25c63b[_0x5a31('0x1d')];this[_0x5a31('0x1e')]=_0x25c63b['agents'];this[_0x5a31('0x1f')]={};ami['on']('coreshowchannel',this[_0x5a31('0x20')]['bind'](this));ami['on'](_0x5a31('0x21'),this['syncNewExten'][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x23'),this[_0x5a31('0x24')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x25'),this[_0x5a31('0x26')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x27'),this[_0x5a31('0x28')][_0x5a31('0x22')](this));ami['on']('hangup',this[_0x5a31('0x29')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x2a'),this[_0x5a31('0x2b')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x2c'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0x5a31('0x2d')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x2e'),this[_0x5a31('0x2f')][_0x5a31('0x22')](this));ami['on'](_0x5a31('0x30'),this[_0x5a31('0x31')][_0x5a31('0x22')](this));try{logger[_0x5a31('0x32')](_0x5a31('0x33'));ami['actionCoreShowChannels']();}catch(_0x1ecb53){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x5a31('0x34')](_0x1ecb53,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x36')]=function(_0x5cf5df){return _0x5cf5df!==null&&!_[_0x5a31('0x37')](_0x5cf5df);};VoiceCallReport['prototype']['emit']=function(_0x4e7975,_0x53ab92,_0x235ca8){io['to'](_0x4e7975)[_0x5a31('0x38')](_0x53ab92,_0x235ca8);};VoiceCallReport['prototype'][_0x5a31('0x2b')]=function(_0x2eeda7){try{if(this[_0x5a31('0x36')](_0x2eeda7)){logger['info'](_0x5a31('0x39'),_0x2eeda7[_0x5a31('0x3a')],_0x2eeda7[_0x5a31('0x3b')],_0x2eeda7[_0x5a31('0x3c')]);logger[_0x5a31('0x3d')](_0x5a31('0x3e'),_0x2eeda7['uniqueid'],util[_0x5a31('0x34')](_0x2eeda7,{'showHidden':![],'depth':null}));if(_0x2eeda7[_0x5a31('0x3a')]===_0x2eeda7[_0x5a31('0x3f')]){if(!_[_0x5a31('0x37')](this[_0x5a31('0x1d')][_0x2eeda7[_0x5a31('0x3a')]])){_['merge'](this[_0x5a31('0x1d')][_0x2eeda7['uniqueid']],_['pick'](_0x2eeda7,_[_0x5a31('0x40')](this[_0x5a31('0x1d')][_0x2eeda7[_0x5a31('0x3a')]])));}}if(_0x2eeda7[_0x5a31('0x41')]===_0x5a31('0x42')){if(this[_0x5a31('0x1e')][_0x2eeda7[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){if(_0x2eeda7[_0x5a31('0x45')]==_0x5a31('0x46')){this[_0x5a31('0x1e')][_0x2eeda7['channel'][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x47')]=_0x2eeda7[_0x5a31('0x48')];this[_0x5a31('0x38')](util[_0x5a31('0x49')]('user:%s',this[_0x5a31('0x1e')][_0x2eeda7[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['name']),_0x5a31('0x4a'),{'destaccountcode':this['agents'][_0x2eeda7[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x2eeda7[_0x5a31('0x48')]});}}}}}catch(_0x392c92){logger[_0x5a31('0x4c')]('[%s][voiceCallReport][newcallerid]',_0x2eeda7[_0x5a31('0x3a')],util['inspect'](_0x392c92,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x24')]=function(_0x4778a2){try{if(this['isNotNull'](_0x4778a2)){logger[_0x5a31('0x3d')](_0x5a31('0x4d'),_0x4778a2[_0x5a31('0x3a')],util['inspect'](_0x4778a2,{'showHidden':![],'depth':null}));if(_0x4778a2[_0x5a31('0x3a')]===_0x4778a2[_0x5a31('0x3f')]&&_0x4778a2[_0x5a31('0x43')]!=_0x5a31('0x4e')){if(_['isUndefined'](this['channels'][_0x4778a2[_0x5a31('0x3a')]])){logger[_0x5a31('0x32')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x4778a2[_0x5a31('0x3a')],_0x4778a2['context'],_0x4778a2[_0x5a31('0x45')]);this[_0x5a31('0x1d')][_0x4778a2[_0x5a31('0x3a')]]=new Channel();this[_0x5a31('0x1d')][_0x4778a2[_0x5a31('0x3a')]]['starttime']=moment()[_0x5a31('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5a31('0x1d')][_0x4778a2[_0x5a31('0x3a')]][_0x5a31('0x4f')]=dispositions[_[_0x5a31('0x50')](_0x4778a2[_0x5a31('0x51')])];_[_0x5a31('0x52')](this[_0x5a31('0x1d')][_0x4778a2[_0x5a31('0x3a')]],_[_0x5a31('0x53')](_0x4778a2,_[_0x5a31('0x40')](this[_0x5a31('0x1d')][_0x4778a2['uniqueid']])));if(_0x4778a2['context']==='from-sip'){if(this[_0x5a31('0x1e')][_0x4778a2['channel']['split']('-')[0x0]]){if(_[_0x5a31('0x37')](this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x47')])){this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x4778a2[_0x5a31('0x45')];logger[_0x5a31('0x3d')](_0x5a31('0x54'),_0x4778a2['uniqueid'],util[_0x5a31('0x34')]({'destaccountcode':this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x4778a2[_0x5a31('0x45')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x5a31('0x49')](_0x5a31('0x55'),this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')]['split']('-')[0x0]][_0x5a31('0x56')]),_0x5a31('0x4a'),{'destaccountcode':this[_0x5a31('0x1e')][_0x4778a2[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x4778a2[_0x5a31('0x45')]});}}}}}}}catch(_0x1d4318){logger[_0x5a31('0x4c')](_0x5a31('0x57'),_0x4778a2[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x1d4318,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x20')]=function(_0xb2a8d9){try{if(this['isNotNull'](_0xb2a8d9)){logger[_0x5a31('0x3d')](_0x5a31('0x58'),_0xb2a8d9[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0xb2a8d9,{'showHidden':![],'depth':null}));if(_0xb2a8d9[_0x5a31('0x3a')]===_0xb2a8d9[_0x5a31('0x3f')]&&_0xb2a8d9[_0x5a31('0x45')]!='h'&&_0xb2a8d9[_0x5a31('0x43')]!='OutgoingSpoolFailed'){_0xb2a8d9[_0x5a31('0x59')]=_0xb2a8d9[_0x5a31('0x59')][_0x5a31('0x5a')]();_0xb2a8d9[_0x5a31('0x5b')]=_0xb2a8d9[_0x5a31('0x5c')]&&_0xb2a8d9[_0x5a31('0x5c')][_0x5a31('0x5d')](_0x5a31('0x5e'))?_0xb2a8d9[_0x5a31('0x5c')]:(_0xb2a8d9['appdata']||_0xb2a8d9[_0x5a31('0x5b')])['toLowerCase']();logger[_0x5a31('0x32')](_0x5a31('0x5f'),_0xb2a8d9[_0x5a31('0x3a')],_0xb2a8d9['application'],_0xb2a8d9[_0x5a31('0x5b')]);if(_['isUndefined'](this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]])){this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]]=new Channel();this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]][_0x5a31('0x60')]=_0xb2a8d9[_0x5a31('0x61')]?moment()[_0x5a31('0x62')](moment['duration'](_0xb2a8d9[_0x5a31('0x61')])[_0x5a31('0x63')](),_0x5a31('0x63'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x5a31('0x49')](_0x5a31('0x64'));this['channels'][_0xb2a8d9[_0x5a31('0x3a')]][_0x5a31('0x4f')]='NO\x20ANSWER';}_[_0x5a31('0x52')](this['channels'][_0xb2a8d9['uniqueid']],_[_0x5a31('0x53')](_0xb2a8d9,_['keys'](this['channels'][_0xb2a8d9[_0x5a31('0x3a')]])));if(_[_0x5a31('0x65')](applications,_0xb2a8d9[_0x5a31('0x59')])){this['channels'][_0xb2a8d9['uniqueid']][_0x5a31('0x66')]=_0xb2a8d9['application'];this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]][_0x5a31('0x67')]=_0xb2a8d9[_0x5a31('0x5b')];if(_0xb2a8d9[_0x5a31('0x59')]===_0x5a31('0x12')&&_[_0x5a31('0x5d')](_0xb2a8d9[_0x5a31('0x5b')][_0x5a31('0x5a')](),_0x5a31('0x68'))){var _0x16e3cd=_0xb2a8d9[_0x5a31('0x5b')][_0x5a31('0x44')]('=');var _0x1f6375=_0x16e3cd[0x0][_0x5a31('0x5a')]()[_0x5a31('0x69')](/cdr\((.*)\)/);if(_0x1f6375){this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]][_0x1f6375[0x1]]=_0x16e3cd[0x1];}}else if(_0xb2a8d9[_0x5a31('0x59')]===_0x5a31('0x13')){this[_0x5a31('0x1d')][_0xb2a8d9[_0x5a31('0x3a')]][_0x5a31('0x13')]=_0xb2a8d9[_0x5a31('0x5b')][_0x5a31('0x44')](',')[0x0];}}}}}catch(_0x22053a){logger[_0x5a31('0x4c')](_0x5a31('0x6a'),_0xb2a8d9[_0x5a31('0x3a')],util['inspect'](_0x22053a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x23bb1b){try{if(this[_0x5a31('0x36')](_0x23bb1b)){logger['info'](_0x5a31('0x6b'),_0x23bb1b['uniqueid'],_0x23bb1b[_0x5a31('0x3f')],_0x23bb1b[_0x5a31('0x3b')],_0x23bb1b[_0x5a31('0x3c')]);logger[_0x5a31('0x3d')](_0x5a31('0x6c'),_0x23bb1b[_0x5a31('0x3a')],util['inspect'](_0x23bb1b,{'showHidden':![],'depth':null}));if(_0x23bb1b[_0x5a31('0x3a')]!==_0x23bb1b['linkedid']){if(this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]]){if(_0x23bb1b[_0x5a31('0x51')]==='6'){if(!this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x6d')]){var _0x3fba50=moment();this[_0x5a31('0x1d')][_0x23bb1b['linkedid']][_0x5a31('0x6d')]=!![];this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]]['answertime']=_0x3fba50[_0x5a31('0x49')](_0x5a31('0x64'));if(this['channels'][_0x23bb1b['linkedid']][_0x5a31('0x60')]){this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x6e')]=_0x3fba50['diff'](this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x60')],_0x5a31('0x63'));}}this['channels'][_0x23bb1b[_0x5a31('0x3f')]]['linkedid']=_0x23bb1b[_0x5a31('0x3a')];if(_0x23bb1b[_0x5a31('0x3c')]!==_0x5a31('0x46')){this[_0x5a31('0x1d')][_0x23bb1b['linkedid']][_0x5a31('0x48')]=_0x23bb1b[_0x5a31('0x3c')];}this[_0x5a31('0x1d')][_0x23bb1b['linkedid']][_0x5a31('0x6f')]=_0x23bb1b[_0x5a31('0x3b')];this['channels'][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x70')]=_0x23bb1b[_0x5a31('0x43')];this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x4f')]=dispositions[_[_0x5a31('0x50')](_0x23bb1b[_0x5a31('0x51')])];if(this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){this['channels'][_0x23bb1b['linkedid']][_0x5a31('0x71')]=this[_0x5a31('0x1e')][_0x23bb1b['channel'][_0x5a31('0x44')]('-')[0x0]]['id'];this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x72')]=this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x56')];}}}}else{if(this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3a')]]){if(_0x23bb1b[_0x5a31('0x51')]==='6'){if(this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3a')]][_0x5a31('0x71')]=this['agents'][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['id'];this[_0x5a31('0x1d')][_0x23bb1b['uniqueid']][_0x5a31('0x72')]=this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')]['split']('-')[0x0]][_0x5a31('0x56')];}}}}if(_0x23bb1b[_0x5a31('0x51')]==='6'&&_0x23bb1b[_0x5a31('0x41')]==='from-sip'){if(this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')]['split']('-')[0x0]][_0x5a31('0x47')]=_0x23bb1b[_0x5a31('0x45')];var _0x1165b2;if(this[_0x5a31('0x1d')][_0x23bb1b[_0x5a31('0x3a')]])_0x1165b2=this[_0x5a31('0x1d')][_0x23bb1b['uniqueid']][_0x5a31('0x73')];else if(this['channels'][_0x23bb1b['linkedid']])_0x1165b2=this['channels'][_0x23bb1b[_0x5a31('0x3f')]][_0x5a31('0x73')];logger[_0x5a31('0x3d')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x23bb1b[_0x5a31('0x3a')],util[_0x5a31('0x34')]({'destaccountcode':this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x23bb1b[_0x5a31('0x45')],'routealias':_0x1165b2},{'showHidden':![],'depth':null}));this[_0x5a31('0x38')](util[_0x5a31('0x49')](_0x5a31('0x55'),this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['name']),_0x5a31('0x4a'),{'destaccountcode':this[_0x5a31('0x1e')][_0x23bb1b[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')],'destconnectedlinenum':_0x23bb1b[_0x5a31('0x45')],'routealias':_0x1165b2});}}}}catch(_0x90f490){logger[_0x5a31('0x4c')](_0x5a31('0x74'),_0x23bb1b['uniqueid'],util[_0x5a31('0x34')](_0x90f490,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x75')]=function(_0x27943c,_0x469131){try{if(this[_0x5a31('0x1d')][_0x27943c]){logger[_0x5a31('0x32')](_0x5a31('0x76'),_0x27943c,_0x469131);this['channels'][_0x27943c][_0x5a31('0x77')]=!![];if(_['endsWith'](_0x469131,_0x5a31('0x78'))){_0x469131=_0x469131[_0x5a31('0x79')](_0x5a31('0x78'),_0x5a31('0x7a'));}this[_0x5a31('0x1d')][_0x27943c]['monitorFilename']=_0x469131;var _0x55280d=_[_0x5a31('0x7b')](this[_0x5a31('0x1d')][_0x27943c][_0x5a31('0x7c')],{'filename':_0x469131});if(_[_0x5a31('0x7d')](_0x55280d)){this[_0x5a31('0x1d')][_0x27943c]['monitors']['push']({'filename':_0x469131,'createdAt':moment()[_0x5a31('0x49')](_0x5a31('0x64')),'mixmonitorid':'','status':'rec'});}}}catch(_0x469a12){logger[_0x5a31('0x4c')](_0x5a31('0x7e'),_0x27943c,util[_0x5a31('0x34')](_0x469a12,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')]['syncVarSet']=function(_0x3ba3a4){try{if(this[_0x5a31('0x36')](_0x3ba3a4)){logger[_0x5a31('0x3d')](_0x5a31('0x7f'),_0x3ba3a4[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x3ba3a4,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]]&&_0x3ba3a4[_0x5a31('0x43')]!=_0x5a31('0x4e')){if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')])){if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')]['mixmonitor_filename'])){logger[_0x5a31('0x32')](_0x5a31('0x81'),_0x3ba3a4['uniqueid'],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x75')](_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x83')])){logger[_0x5a31('0x32')](_0x5a31('0x84'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4['value']);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x3c')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x85')])){logger[_0x5a31('0x32')](_0x5a31('0x86'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x87')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x88')])){logger[_0x5a31('0x32')](_0x5a31('0x89'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4['value']);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x8a')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this['isNotNull'](_0x3ba3a4['variable'][_0x5a31('0x8b')])){logger[_0x5a31('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')][_0x5a31('0x44')](',')[0x0]);this['channels'][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x13')]=_0x3ba3a4[_0x5a31('0x82')][_0x5a31('0x44')](',')[0x0];}else if(this['isNotNull'](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x8c')])){logger[_0x5a31('0x32')](_0x5a31('0x8d'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]]['originatecalleridnum']=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4['variable'][_0x5a31('0x8e')])){logger[_0x5a31('0x32')](_0x5a31('0x8f'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this['channels'][_0x3ba3a4[_0x5a31('0x3a')]]['destination']=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x90')])){logger[_0x5a31('0x32')](_0x5a31('0x91'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x92')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4['variable'][_0x5a31('0x93')])){logger[_0x5a31('0x32')](_0x5a31('0x94'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this['channels'][_0x3ba3a4[_0x5a31('0x3a')]][_0x5a31('0x13')]=_0x3ba3a4[_0x5a31('0x82')];}else if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x95')])){logger['info'](_0x5a31('0x96'),_0x3ba3a4[_0x5a31('0x3a')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3a')]]['sipcalluniqueid']=_0x3ba3a4[_0x5a31('0x82')];}}}else if(this['isNotNull'](_0x3ba3a4[_0x5a31('0x80')][_0x5a31('0x97')])){if(_0x3ba3a4[_0x5a31('0x82')]){var _0x2e02ed=path[_0x5a31('0x98')](_0x3ba3a4[_0x5a31('0x82')])[_0x5a31('0x56')];logger[_0x5a31('0x32')](_0x5a31('0x81'),_0x2e02ed,_0x3ba3a4['value']);this[_0x5a31('0x75')](_0x2e02ed,_0x3ba3a4['value']);}}else if(this[_0x5a31('0x1d')][_0x3ba3a4['linkedid']]){if(this[_0x5a31('0x36')](_0x3ba3a4[_0x5a31('0x80')])){if(this[_0x5a31('0x36')](_0x3ba3a4['variable'][_0x5a31('0x95')])){logger[_0x5a31('0x32')](_0x5a31('0x96'),_0x3ba3a4[_0x5a31('0x3f')],_0x3ba3a4[_0x5a31('0x82')]);this[_0x5a31('0x1d')][_0x3ba3a4[_0x5a31('0x3f')]]['sipcalllinkedid']=_0x3ba3a4[_0x5a31('0x82')];}}}}}catch(_0xcef67f){logger[_0x5a31('0x4c')](_0x5a31('0x99'),_0x3ba3a4[_0x5a31('0x3a')],util['inspect'](_0xcef67f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5a31('0x29')]=function(_0x5d285c){try{if(this[_0x5a31('0x36')](_0x5d285c)){logger[_0x5a31('0x3d')](_0x5a31('0x9a'),_0x5d285c[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x5d285c,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]]){logger[_0x5a31('0x32')](_0x5a31('0x9b'),_0x5d285c[_0x5a31('0x3a')],_0x5d285c[_0x5a31('0x9c')]);var _0x4425ac=moment();this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x9d')]=_0x4425ac[_0x5a31('0x49')](_0x5a31('0x64'));this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]]['duration']=_0x4425ac[_0x5a31('0x9e')](this['channels'][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x60')],'seconds');if(this[_0x5a31('0x1d')][_0x5d285c['uniqueid']][_0x5a31('0x6d')]){this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x9f')]=_0x4425ac['diff'](this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]]['answertime'],'seconds');this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]]['holdtime']=this[_0x5a31('0x1d')][_0x5d285c['uniqueid']][_0x5a31('0x61')]-this[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x9f')];}if(_0x5d285c['context']===_0x5a31('0x42')){if(this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]){this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]=_['omit'](this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x5a31('0x3d')](_0x5a31('0xa0'),_0x5d285c[_0x5a31('0x3a')],util[_0x5a31('0x34')]({'id':this['agents'][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x5a31('0x49')](_0x5a31('0x55'),this['agents'][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x56')]),'user:agentcomplete',{'id':this[_0x5a31('0x1e')][_0x5d285c['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x5a31('0x1e')][_0x5d285c[_0x5a31('0x43')][_0x5a31('0x44')]('-')[0x0]][_0x5a31('0x4b')]});}}var _0x13ad24=this;Promise[_0x5a31('0xa1')]()[_0x5a31('0xa2')](function(){var _0x5b34b3=_0x13ad24['channels'][_0x5d285c['uniqueid']];if(typeof _0x5b34b3['transferType']===_0x5a31('0xa3'))return;if(_[_0x5a31('0xa4')](_0x5b34b3[_0x5a31('0x7c')]))return;return RpcSetting[_0x5a31('0xa5')]()[_0x5a31('0xa2')](function(_0x5b1120){if(!_0x5b1120[_0x5a31('0xa6')])return;return Promise['resolve']()[_0x5a31('0xa2')](function(){return ami[_0x5a31('0xa7')]({'action':_0x5a31('0xa8'),'channel':_0x5b34b3[_0x5a31('0x43')]})[_0x5a31('0xa9')](function(){});})[_0x5a31('0xa2')](function(){return ami[_0x5a31('0xa7')]({'action':_0x5a31('0xa8'),'channel':_0x5b34b3[_0x5a31('0x70')]})['catch'](function(){})[_0x5a31('0xaa')](function(){var _0x12071c=_0x13ad24[_0x5a31('0x1e')][_0x5b34b3[_0x5a31('0x70')][_0x5a31('0x44')]('-')[0x0]];if(!_0x12071c)return;io['emit']('webbar:stopmonitors',{'agentId':_0x12071c['id'],'uniqueid':_0x5b34b3[_0x5a31('0x3a')]});});});});})[_0x5a31('0xa2')](function(){if(_0x5d285c[_0x5a31('0xab')]===_0x5a31('0xac')){_0x13ad24[_0x5a31('0x1f')][_0x5d285c['uniqueid']]=_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]];}else{if(_0x13ad24[_0x5a31('0x1d')][_0x5d285c['uniqueid']][_0x5a31('0x8a')]===_0x5a31('0xad')&&_0x13ad24[_0x5a31('0x1f')][_0x5d285c['uniqueid']]){_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x3a')]=[_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x3f')],_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x3f')]=_0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]][_0x5a31('0x3a')]][0x0];delete _0x13ad24[_0x5a31('0x1f')][_0x5d285c[_0x5a31('0x3a')]];}}logger[_0x5a31('0x3d')](_0x5a31('0xae'),_0x5d285c['uniqueid'],util[_0x5a31('0x34')](_0x13ad24['channels'][_0x5d285c[_0x5a31('0x3a')]],{'showHidden':![],'depth':null}));ami[_0x5a31('0x38')](_0x5a31('0xaf'),_0x13ad24[_0x5a31('0x1d')][_0x5d285c['uniqueid']]);delete _0x13ad24[_0x5a31('0x1d')][_0x5d285c[_0x5a31('0x3a')]];});}}}catch(_0x1be14e){logger['error'](_0x5a31('0xb0'),_0x5d285c['uniqueid'],util[_0x5a31('0x34')](_0x1be14e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')]['syncAttendedTransfer']=function(_0x46e7e6){try{if(this[_0x5a31('0x36')](_0x46e7e6)){logger[_0x5a31('0x32')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x46e7e6[_0x5a31('0x3a')],_0x46e7e6[_0x5a31('0xb1')],_0x46e7e6['transfertargetcalleridnum']);logger['debug'](_0x5a31('0xb2'),_0x46e7e6['uniqueid'],util[_0x5a31('0x34')](_0x46e7e6,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x46e7e6['transfereeuniqueid']]){this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb3')]][_0x5a31('0xb4')]=_0x46e7e6['origtransferercalleridnum'];this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb3')]][_0x5a31('0xb5')]=_0x46e7e6[_0x5a31('0xb6')];if(this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb7')]]){var _0xe73426=this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb7')]];this[_0x5a31('0x1d')][_0x46e7e6['secondtransfereruniqueid']]=this['channels'][_0x46e7e6[_0x5a31('0xb3')]];this['channels'][_0x46e7e6[_0x5a31('0xb3')]]=_0xe73426;}}else if(this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb8')]]){this[_0x5a31('0x1d')][_0x46e7e6['transfertargetuniqueid']]['transfercalleridnum']=_0x46e7e6['origtransferercalleridnum'];this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb8')]]['transferconnectedlinenum']=_0x46e7e6['transfertargetcalleridnum'];if(this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb9')]]){var _0xe73426=this['channels'][_0x46e7e6[_0x5a31('0xb9')]];this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb9')]]=this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb8')]];this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb8')]]=_0xe73426;}}if((this['channels'][_0x46e7e6[_0x5a31('0xb9')]]||this['channels'][_0x46e7e6[_0x5a31('0xba')]])&&this['channels'][_0x46e7e6[_0x5a31('0xb7')]]){var _0x4bba9c=_['some']([this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb9')]],this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xba')]],this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb7')]]],function(_0x464e1e){return _0x464e1e&&_0x464e1e[_0x5a31('0x8a')]==='outbound'&&_0x464e1e['routeid'];});if(_0x4bba9c){if(this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb9')]])this[_0x5a31('0x1d')][_0x46e7e6['origtransfereruniqueid']]['transferType']=_0x5a31('0xbb');if(this[_0x5a31('0x1d')][_0x46e7e6['origtransfererlinkedid']])this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xba')]][_0x5a31('0xbc')]=_0x5a31('0xbb');this[_0x5a31('0x1d')][_0x46e7e6[_0x5a31('0xb7')]][_0x5a31('0xbc')]='ATTENDED';}}}}catch(_0x1d32b8){logger['error'](_0x5a31('0xbd'),_0x46e7e6['uniqueid'],util[_0x5a31('0x34')](_0x1d32b8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x2d')]=function(_0x439420){try{if(this['isNotNull'](_0x439420)){logger[_0x5a31('0x32')](_0x5a31('0xbe'),_0x439420[_0x5a31('0x3a')],_0x439420[_0x5a31('0xbf')],_0x439420[_0x5a31('0xc0')]);logger[_0x5a31('0x3d')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x439420[_0x5a31('0x3a')],util['inspect'](_0x439420,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x439420[_0x5a31('0xb3')]]){this['channels'][_0x439420[_0x5a31('0xb3')]][_0x5a31('0xb4')]=_0x439420[_0x5a31('0xbf')];this[_0x5a31('0x1d')][_0x439420[_0x5a31('0xb3')]][_0x5a31('0xb5')]=_0x439420[_0x5a31('0xc0')];this['channels'][_0x439420[_0x5a31('0xb3')]][_0x5a31('0xbc')]=_0x5a31('0xc1');this['syncHangup']({'event':_0x5a31('0xac'),'uniqueid':_0x439420['transfereeuniqueid'],'context':_0x439420[_0x5a31('0x41')],'channel':_0x439420[_0x5a31('0xc2')]});}else{this[_0x5a31('0x1d')][_0x439420[_0x5a31('0xc3')]][_0x5a31('0xbc')]=_0x5a31('0xc1');}}}catch(_0x4c07bd){logger[_0x5a31('0x4c')](_0x5a31('0xc4'),_0x439420[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x4c07bd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x2f')]=function(_0x1bff2b){try{if(this[_0x5a31('0x36')](_0x1bff2b)){logger[_0x5a31('0x3d')](_0x5a31('0xc5'),_0x1bff2b['uniqueid'],util[_0x5a31('0x34')](_0x1bff2b,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x1bff2b[_0x5a31('0x3a')]]){if(!_[_0x5a31('0x7d')](this['channels'][_0x1bff2b[_0x5a31('0x3a')]]['answertime'])){this[_0x5a31('0x1d')][_0x1bff2b[_0x5a31('0x3a')]][_0x5a31('0xc6')]=moment()[_0x5a31('0x49')](_0x5a31('0x64'));logger['info'](_0x5a31('0xc7'),_0x1bff2b[_0x5a31('0x3a')],this[_0x5a31('0x1d')][_0x1bff2b[_0x5a31('0x3a')]]['mohstarttime']);}}}}catch(_0x423344){logger[_0x5a31('0x4c')](_0x5a31('0xc8'),_0x1bff2b['uniqueid'],util['inspect'](_0x423344,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5a31('0x35')][_0x5a31('0x31')]=function(_0x48ed82){try{if(this['isNotNull'](_0x48ed82)){logger[_0x5a31('0x3d')](_0x5a31('0xc9'),_0x48ed82[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x48ed82,{'showHidden':![],'depth':null}));if(this[_0x5a31('0x1d')][_0x48ed82[_0x5a31('0x3a')]]){if(!_[_0x5a31('0x7d')](this[_0x5a31('0x1d')][_0x48ed82[_0x5a31('0x3a')]][_0x5a31('0xc6')])){this['channels'][_0x48ed82[_0x5a31('0x3a')]]['mohtime']+=moment()[_0x5a31('0xca')](0x0)['diff'](this[_0x5a31('0x1d')][_0x48ed82[_0x5a31('0x3a')]][_0x5a31('0xc6')],_0x5a31('0x63'));logger[_0x5a31('0x32')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x48ed82[_0x5a31('0x3a')],this[_0x5a31('0x1d')][_0x48ed82[_0x5a31('0x3a')]][_0x5a31('0xcb')]);delete this['channels'][_0x48ed82['uniqueid']][_0x5a31('0xc6')];}}}}catch(_0x3a87a1){logger['error'](_0x5a31('0xcc'),_0x48ed82[_0x5a31('0x3a')],util[_0x5a31('0x34')](_0x3a87a1,{'showHidden':![],'depth':null}));}};module[_0x5a31('0xcd')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index a0a0e36..350adeb 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 _0x1e59=['[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','lastevent','total','answertime','answered','holdtime','billableseconds','outbound','sumHoldTime','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','error','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','match','[%s][voiceDialReport][newexten]','lodash','moment','util','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','applications','bind','dialend','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','syncDialBegin','uniqueid','inspect','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','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:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','variables'];(function(_0x5b2aba,_0x132c57){var _0x474b6e=function(_0x53c04d){while(--_0x53c04d){_0x5b2aba['push'](_0x5b2aba['shift']());}};_0x474b6e(++_0x132c57);}(_0x1e59,0x99));var _0x91e5=function(_0x299cce,_0x129a94){_0x299cce=_0x299cce-0x0;var _0x4a6cfd=_0x1e59[_0x299cce];return _0x4a6cfd;};'use strict';var _=require(_0x91e5('0x0'));var moment=require(_0x91e5('0x1'));var util=require(_0x91e5('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x91e5('0x3'))(_0x91e5('0x4'));var ami=require(_0x91e5('0x5'));config[_0x91e5('0x6')]=_[_0x91e5('0x7')](config[_0x91e5('0x6')],{'host':_0x91e5('0x8'),'port':0x18eb});var io=require(_0x91e5('0x9'))(new Redis(config[_0x91e5('0x6')]));function VoiceDialReport(_0xbc7c3c){this['channels']=_0xbc7c3c[_0x91e5('0xa')];this['outbound']=_0xbc7c3c['outbound'];this[_0x91e5('0xb')]={};this['variables']={};ami['on']('dialbegin',this['syncDialBegin'][_0x91e5('0xc')](this));ami['on'](_0x91e5('0xd'),this['syncDialEnd'][_0x91e5('0xc')](this));ami['on'](_0x91e5('0xe'),this[_0x91e5('0xf')][_0x91e5('0xc')](this));ami['on'](_0x91e5('0x10'),this[_0x91e5('0x11')]['bind'](this));ami['on'](_0x91e5('0x12'),this[_0x91e5('0x13')]['bind'](this));}VoiceDialReport[_0x91e5('0x14')][_0x91e5('0x15')]=function(_0x181857){return _0x181857!==null&&!_[_0x91e5('0x16')](_0x181857);};VoiceDialReport[_0x91e5('0x14')][_0x91e5('0x17')]=function(_0x12d2a7,_0x32e3da,_0x245a95){io['to'](_0x12d2a7)['emit'](_0x32e3da,_0x245a95);};VoiceDialReport[_0x91e5('0x14')][_0x91e5('0x18')]=function(_0x5824be){try{if(this['isNotNull'](_0x5824be)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x5824be[_0x91e5('0x19')],util[_0x91e5('0x1a')](_0x5824be,{'showHidden':![],'depth':null}));if(this[_0x91e5('0x1b')][_0x5824be[_0x91e5('0x19')]]){_[_0x91e5('0x1c')](this[_0x91e5('0x1b')][_0x5824be[_0x91e5('0x19')]],{'starttime':moment()[_0x91e5('0x1d')](_0x91e5('0x1e')),'lastevent':_0x91e5('0x1f'),'interface':_0x5824be['channel'][_0x91e5('0x20')](0x0,_0x5824be[_0x91e5('0x21')][_0x91e5('0x22')]('-')),'membername':_0x5824be['channel'][_0x91e5('0x20')](_0x5824be[_0x91e5('0x21')][_0x91e5('0x22')]('/')+0x1,_0x5824be['channel'][_0x91e5('0x22')]('-'))},_[_0x91e5('0x23')](_0x5824be,['event',_0x91e5('0x24')]));logger[_0x91e5('0x25')](_0x91e5('0x26'),_0x5824be[_0x91e5('0x19')],this[_0x91e5('0x1b')][_0x5824be[_0x91e5('0x19')]][_0x91e5('0x27')],this[_0x91e5('0x1b')][_0x5824be[_0x91e5('0x19')]][_0x91e5('0x28')]);logger[_0x91e5('0x29')](_0x91e5('0x2a'),_0x5824be['uniqueid'],util[_0x91e5('0x1a')](this[_0x91e5('0x1b')][_0x5824be[_0x91e5('0x19')]],{'showHidden':![],'depth':null}));if(this[_0x91e5('0xb')][_0x5824be['uniqueid']])_[_0x91e5('0x1c')](this[_0x91e5('0x1b')][_0x5824be['uniqueid']],this[_0x91e5('0xb')][_0x5824be['uniqueid']]);this[_0x91e5('0x17')](_0x91e5('0x2b'),'voice_outbound_channel:save',this[_0x91e5('0x1b')][_0x5824be[_0x91e5('0x19')]]);logger['debug'](_0x91e5('0x2c'),_0x5824be[_0x91e5('0x19')],util[_0x91e5('0x1a')](this['channels'][_0x5824be[_0x91e5('0x19')]],{'showHidden':![],'depth':null}));ami[_0x91e5('0x17')]('custom:dialbegin',this['channels'][_0x5824be[_0x91e5('0x19')]]);}}}catch(_0x4f48c0){logger['error'](_0x91e5('0x2d'),_0x5824be['uniqueid'],util[_0x91e5('0x1a')](_0x4f48c0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x91e5('0x14')][_0x91e5('0x2e')]=function(_0x189631){try{if(this[_0x91e5('0x15')](_0x189631)){logger[_0x91e5('0x29')](_0x91e5('0x2f'),_0x189631['uniqueid'],util[_0x91e5('0x1a')](_0x189631,{'showHidden':![],'depth':null}));if(this['channels'][_0x189631['uniqueid']]){this[_0x91e5('0x1b')][_0x189631[_0x91e5('0x19')]]['dialstatus']=_0x189631[_0x91e5('0x30')];if(_0x189631[_0x91e5('0x30')]===_0x91e5('0x31')){this[_0x91e5('0x1b')][_0x189631[_0x91e5('0x19')]][_0x91e5('0x32')]=_0x189631['connectedlinenum'];this['channels'][_0x189631['uniqueid']]['connectedlinename']=_0x189631[_0x91e5('0x33')];this['channels'][_0x189631[_0x91e5('0x19')]]['answertime']=moment()[_0x91e5('0x1d')](_0x91e5('0x1e'));this[_0x91e5('0x1b')][_0x189631[_0x91e5('0x19')]]['lastevent']=_0x91e5('0x34');logger['info'](_0x91e5('0x35'),_0x189631[_0x91e5('0x19')],_0x189631[_0x91e5('0x21')][_0x91e5('0x20')](_0x189631[_0x91e5('0x21')][_0x91e5('0x22')]('/')+0x1,_0x189631[_0x91e5('0x21')][_0x91e5('0x22')]('-')));logger[_0x91e5('0x29')](_0x91e5('0x36'),_0x189631['uniqueid'],util[_0x91e5('0x1a')](this['channels'][_0x189631['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x91e5('0x17')](_0x91e5('0x37'),this[_0x91e5('0x1b')][_0x189631[_0x91e5('0x19')]]);}logger[_0x91e5('0x29')](_0x91e5('0x38'),_0x189631[_0x91e5('0x19')],util[_0x91e5('0x1a')](this[_0x91e5('0x1b')][_0x189631[_0x91e5('0x19')]],{'showHidden':![],'depth':null}));this[_0x91e5('0x17')](_0x91e5('0x2b'),'voice_outbound_channel:save',this[_0x91e5('0x1b')][_0x189631[_0x91e5('0x19')]]);}}}catch(_0x7fb816){logger['error'](_0x91e5('0x39'),_0x189631[_0x91e5('0x19')],util[_0x91e5('0x1a')](_0x7fb816,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x91e5('0x14')][_0x91e5('0xf')]=function(_0x27ad9c){try{if(this['isNotNull'](_0x27ad9c)){logger[_0x91e5('0x29')](_0x91e5('0x3a'),_0x27ad9c[_0x91e5('0x19')],util[_0x91e5('0x1a')](_0x27ad9c,{'showHidden':![],'depth':null}));this['addVariable'](_0x27ad9c[_0x91e5('0x19')],_[_0x91e5('0x3b')](_0x27ad9c[_0x91e5('0x3c')])[0x0],_0x27ad9c[_0x91e5('0x3d')]);if(this[_0x91e5('0x15')](_0x27ad9c[_0x91e5('0x3c')])&&this[_0x91e5('0x15')](_0x27ad9c['variable'][_0x91e5('0x3e')])){if(_[_0x91e5('0x16')](this['channels'][_0x27ad9c['uniqueid']])){this[_0x91e5('0x1b')][_0x27ad9c[_0x91e5('0x19')]]={'routeId':_0x27ad9c[_0x91e5('0x3d')],'variables':this['variables'][_0x27ad9c['uniqueid']]};logger[_0x91e5('0x25')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x27ad9c[_0x91e5('0x19')],_0x27ad9c[_0x91e5('0x3c')][_0x91e5('0x3e')],_['keys'](_0x27ad9c['variable'])[0x0],_0x27ad9c['value']);logger[_0x91e5('0x29')](_0x91e5('0x3f'),_0x27ad9c[_0x91e5('0x19')],util[_0x91e5('0x1a')](this[_0x91e5('0x1b')][_0x27ad9c[_0x91e5('0x19')]],{'showHidden':![],'depth':null}));this[_0x91e5('0x17')](_0x91e5('0x2b'),_0x91e5('0x40'),this[_0x91e5('0x1b')][_0x27ad9c[_0x91e5('0x19')]]);}}}}catch(_0x576082){logger['error']('[%s][voiceDialReport][varset]',_0x27ad9c[_0x91e5('0x19')],util['inspect'](_0x576082,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x91e5('0x14')][_0x91e5('0x41')]=function(_0x22f104,_0x3783a4,_0x20b7d5){var _0xebd52=[_0x91e5('0x42'),_0x91e5('0x43'),'rtpaudioqosjitter',_0x91e5('0x44'),_0x91e5('0x45'),_0x91e5('0x46'),'rtpaudioqosrtt',_0x91e5('0x47'),_0x91e5('0x48'),'sipuri',_0x91e5('0x49'),_0x91e5('0x4a'),_0x91e5('0x4b'),'memberdynamic',_0x91e5('0x4c'),_0x91e5('0x4d'),_0x91e5('0x27'),_0x91e5('0x4e'),_0x91e5('0x4f')];if(!_[_0x91e5('0x50')](_0x3783a4)&&!_[_0x91e5('0x51')](_0xebd52,_0x3783a4)){if(_['isUndefined'](this[_0x91e5('0x52')][_0x22f104])){this['variables'][_0x22f104]={};}this[_0x91e5('0x52')][_0x22f104][_0x3783a4]=_0x20b7d5;}};VoiceDialReport['prototype'][_0x91e5('0x13')]=function(_0x431c67){try{if(this[_0x91e5('0x15')](_0x431c67)){logger[_0x91e5('0x29')]('[%s][voiceDialReport][hangup]\x20event:',_0x431c67['uniqueid'],util[_0x91e5('0x1a')](_0x431c67,{'showHidden':![],'depth':null}));if(this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]]){logger[_0x91e5('0x25')](_0x91e5('0x53'),_0x431c67[_0x91e5('0x19')],_0x431c67[_0x91e5('0x54')]);this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x55')]=moment()[_0x91e5('0x1d')](_0x91e5('0x1e'));this['channels'][_0x431c67['uniqueid']][_0x91e5('0x56')]=moment(this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x55')])[_0x91e5('0x57')](this['channels'][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x58')],_0x91e5('0x59'));this['channels'][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x5a')]='complete';this['outbound'][_0x91e5('0x5b')]+=0x1;if(this['channels'][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x5c')]){this['outbound'][_0x91e5('0x5d')]+=0x1;this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x5e')]=moment(this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x5c')])[_0x91e5('0x57')](this['channels'][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x58')],_0x91e5('0x59'));this[_0x91e5('0x1b')][_0x431c67['uniqueid']][_0x91e5('0x5f')]=moment(this['channels'][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x55')])[_0x91e5('0x57')](this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x5c')],'seconds');this[_0x91e5('0x60')][_0x91e5('0x61')]+=this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]][_0x91e5('0x5e')]||0x0;this[_0x91e5('0x60')]['sumBillable']+=this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]]['billableseconds'];}this[_0x91e5('0x60')]['sumDuration']+=this['channels'][_0x431c67['uniqueid']][_0x91e5('0x56')];logger[_0x91e5('0x29')](_0x91e5('0x62'),_0x431c67[_0x91e5('0x19')],util[_0x91e5('0x1a')](this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]],{'showHidden':![],'depth':null}));ami[_0x91e5('0x17')]('custom:voiceDialReport',this['channels'][_0x431c67[_0x91e5('0x19')]]);logger[_0x91e5('0x29')](_0x91e5('0x63'),_0x431c67['uniqueid'],util[_0x91e5('0x1a')](this[_0x91e5('0x1b')][_0x431c67['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x91e5('0x17')](_0x91e5('0x64'),this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]]);logger[_0x91e5('0x29')](_0x91e5('0x65'),_0x431c67[_0x91e5('0x19')],util[_0x91e5('0x1a')](this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]],{'showHidden':![],'depth':null}));this[_0x91e5('0x17')](_0x91e5('0x2b'),'voice_outbound:save',this[_0x91e5('0x60')]);logger[_0x91e5('0x25')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x91e5('0x66')](this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]]));logger[_0x91e5('0x29')](_0x91e5('0x67'),_0x431c67[_0x91e5('0x19')],util[_0x91e5('0x1a')](this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x19')]],{'showHidden':![],'depth':null}));this[_0x91e5('0x17')](_0x91e5('0x2b'),'voice_outbound_channel:remove',this[_0x91e5('0x1b')][_0x431c67['uniqueid']]);delete this[_0x91e5('0x1b')][_0x431c67['uniqueid']];}else if(this['channels'][_0x431c67['linkedid']]){this[_0x91e5('0x1b')][_0x431c67['linkedid']][_0x91e5('0x19')]=this[_0x91e5('0x1b')][_0x431c67[_0x91e5('0x68')]][_0x91e5('0x69')];}if(this['variables'][_0x431c67[_0x91e5('0x19')]]){delete this[_0x91e5('0x52')][_0x431c67[_0x91e5('0x19')]];}}}catch(_0x270fdc){logger[_0x91e5('0x6a')](_0x91e5('0x6b'),_0x431c67[_0x91e5('0x19')],util[_0x91e5('0x1a')](_0x270fdc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x91e5('0x14')][_0x91e5('0x11')]=function(_0x24cc20){try{if(this[_0x91e5('0x15')](_0x24cc20)){logger[_0x91e5('0x29')](_0x91e5('0x6c'),_0x24cc20[_0x91e5('0x19')],util['inspect'](_0x24cc20,{'showHidden':![],'depth':null}));if(_0x24cc20['application'][_0x91e5('0x6d')]()==='set'){_0x24cc20[_0x91e5('0x6e')]=(_0x24cc20[_0x91e5('0x6f')]||_0x24cc20[_0x91e5('0x6e')])[_0x91e5('0x6d')]();if(_[_0x91e5('0x70')](_0x24cc20['applicationdata'],_0x91e5('0x71'))){if(_[_0x91e5('0x16')](this[_0x91e5('0xb')][_0x24cc20['uniqueid']]))this[_0x91e5('0xb')][_0x24cc20['uniqueid']]={};logger[_0x91e5('0x25')](_0x91e5('0x72'),_0x24cc20[_0x91e5('0x19')],_0x24cc20[_0x91e5('0x73')],_0x24cc20['applicationdata']);var _0xecf8db=_0x24cc20[_0x91e5('0x6e')]['split']('=');var _0x2538e7=_0xecf8db[0x0][_0x91e5('0x74')](/cdr\((.*)\)/);if(_0x2538e7)this[_0x91e5('0xb')][_0x24cc20[_0x91e5('0x19')]][_0x2538e7[0x1]]=_0xecf8db[0x1];}}}}catch(_0x11a7f2){logger[_0x91e5('0x6a')](_0x91e5('0x75'),_0x24cc20[_0x91e5('0x19')],util[_0x91e5('0x1a')](_0x11a7f2,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xba69=['addVariable','variable','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','lastevent','total','answertime','answered','starttime','billableseconds','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[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]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','lodash','moment','util','../../../config/environment','../../../config/logger','ami','redis','localhost','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:'];(function(_0x596680,_0x4e883a){var _0xc7c907=function(_0x7fa9b8){while(--_0x7fa9b8){_0x596680['push'](_0x596680['shift']());}};_0xc7c907(++_0x4e883a);}(_0xba69,0x1ab));var _0x9ba6=function(_0x29dec9,_0x19b1eb){_0x29dec9=_0x29dec9-0x0;var _0x5e61ba=_0xba69[_0x29dec9];return _0x5e61ba;};'use strict';var _=require(_0x9ba6('0x0'));var moment=require(_0x9ba6('0x1'));var util=require(_0x9ba6('0x2'));var Redis=require('ioredis');var config=require(_0x9ba6('0x3'));var logger=require(_0x9ba6('0x4'))(_0x9ba6('0x5'));var ami=require('../ami');config[_0x9ba6('0x6')]=_['defaults'](config[_0x9ba6('0x6')],{'host':_0x9ba6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ba6('0x6')]));function VoiceDialReport(_0x2aec11){this[_0x9ba6('0x8')]=_0x2aec11[_0x9ba6('0x9')];this[_0x9ba6('0xa')]=_0x2aec11[_0x9ba6('0xa')];this[_0x9ba6('0xb')]={};this['variables']={};ami['on'](_0x9ba6('0xc'),this[_0x9ba6('0xd')][_0x9ba6('0xe')](this));ami['on'](_0x9ba6('0xf'),this[_0x9ba6('0x10')][_0x9ba6('0xe')](this));ami['on'](_0x9ba6('0x11'),this[_0x9ba6('0x12')][_0x9ba6('0xe')](this));ami['on'](_0x9ba6('0x13'),this[_0x9ba6('0x14')][_0x9ba6('0xe')](this));ami['on']('hangup',this[_0x9ba6('0x15')][_0x9ba6('0xe')](this));}VoiceDialReport['prototype'][_0x9ba6('0x16')]=function(_0x2950af){return _0x2950af!==null&&!_[_0x9ba6('0x17')](_0x2950af);};VoiceDialReport[_0x9ba6('0x18')][_0x9ba6('0x19')]=function(_0xa3217e,_0x5e99d4,_0x326d5f){io['to'](_0xa3217e)['emit'](_0x5e99d4,_0x326d5f);};VoiceDialReport['prototype'][_0x9ba6('0xd')]=function(_0x4a0678){try{if(this[_0x9ba6('0x16')](_0x4a0678)){logger[_0x9ba6('0x1a')](_0x9ba6('0x1b'),_0x4a0678[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x4a0678,{'showHidden':![],'depth':null}));if(this[_0x9ba6('0x8')][_0x4a0678[_0x9ba6('0x1c')]]){_[_0x9ba6('0x1e')](this['channels'][_0x4a0678[_0x9ba6('0x1c')]],{'starttime':moment()[_0x9ba6('0x1f')](_0x9ba6('0x20')),'lastevent':_0x9ba6('0x21'),'interface':_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x23')](0x0,_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x24')]('-')),'membername':_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x23')](_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x24')]('/')+0x1,_0x4a0678[_0x9ba6('0x22')][_0x9ba6('0x24')]('-'))},_[_0x9ba6('0x25')](_0x4a0678,[_0x9ba6('0x26'),'privilege']));logger[_0x9ba6('0x27')](_0x9ba6('0x28'),_0x4a0678[_0x9ba6('0x1c')],this[_0x9ba6('0x8')][_0x4a0678[_0x9ba6('0x1c')]][_0x9ba6('0x29')],this[_0x9ba6('0x8')][_0x4a0678[_0x9ba6('0x1c')]][_0x9ba6('0x2a')]);logger[_0x9ba6('0x1a')](_0x9ba6('0x2b'),_0x4a0678['uniqueid'],util['inspect'](this['channels'][_0x4a0678[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x4a0678[_0x9ba6('0x1c')]])_['merge'](this['channels'][_0x4a0678[_0x9ba6('0x1c')]],this[_0x9ba6('0xb')][_0x4a0678['uniqueid']]);this[_0x9ba6('0x19')](_0x9ba6('0x2c'),_0x9ba6('0x2d'),this[_0x9ba6('0x8')][_0x4a0678[_0x9ba6('0x1c')]]);logger['debug'](_0x9ba6('0x2e'),_0x4a0678[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](this['channels'][_0x4a0678[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x9ba6('0x19')]('custom:dialbegin',this['channels'][_0x4a0678['uniqueid']]);}}}catch(_0x2ad1c9){logger[_0x9ba6('0x2f')]('[%s][voiceDialReport][dialbegin]',_0x4a0678[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x2ad1c9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ba6('0x18')][_0x9ba6('0x10')]=function(_0x5a11a3){try{if(this[_0x9ba6('0x16')](_0x5a11a3)){logger[_0x9ba6('0x1a')](_0x9ba6('0x30'),_0x5a11a3[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x5a11a3,{'showHidden':![],'depth':null}));if(this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]]){this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]][_0x9ba6('0x31')]=_0x5a11a3['dialstatus'];if(_0x5a11a3[_0x9ba6('0x31')]===_0x9ba6('0x32')){this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]][_0x9ba6('0x33')]=_0x5a11a3['connectedlinenum'];this['channels'][_0x5a11a3[_0x9ba6('0x1c')]]['connectedlinename']=_0x5a11a3[_0x9ba6('0x34')];this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]]['answertime']=moment()[_0x9ba6('0x1f')](_0x9ba6('0x20'));this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]]['lastevent']=_0x9ba6('0x35');logger[_0x9ba6('0x27')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x5a11a3[_0x9ba6('0x1c')],_0x5a11a3['channel'][_0x9ba6('0x23')](_0x5a11a3[_0x9ba6('0x22')][_0x9ba6('0x24')]('/')+0x1,_0x5a11a3['channel']['lastIndexOf']('-')));logger[_0x9ba6('0x1a')](_0x9ba6('0x36'),_0x5a11a3['uniqueid'],util['inspect'](this[_0x9ba6('0x8')][_0x5a11a3['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x9ba6('0x19')]('custom:dialconnect',this[_0x9ba6('0x8')][_0x5a11a3['uniqueid']]);}logger[_0x9ba6('0x1a')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5a11a3['uniqueid'],util[_0x9ba6('0x1d')](this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x9ba6('0x2d'),this[_0x9ba6('0x8')][_0x5a11a3[_0x9ba6('0x1c')]]);}}}catch(_0x351f22){logger[_0x9ba6('0x2f')](_0x9ba6('0x37'),_0x5a11a3[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x351f22,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ba6('0x18')]['syncVarSet']=function(_0x2413ad){try{if(this['isNotNull'](_0x2413ad)){logger[_0x9ba6('0x1a')](_0x9ba6('0x38'),_0x2413ad['uniqueid'],util[_0x9ba6('0x1d')](_0x2413ad,{'showHidden':![],'depth':null}));this[_0x9ba6('0x39')](_0x2413ad[_0x9ba6('0x1c')],_['keys'](_0x2413ad[_0x9ba6('0x3a')])[0x0],_0x2413ad[_0x9ba6('0x3b')]);if(this[_0x9ba6('0x16')](_0x2413ad[_0x9ba6('0x3a')])&&this[_0x9ba6('0x16')](_0x2413ad[_0x9ba6('0x3a')]['outboundrouteid'])){if(_[_0x9ba6('0x17')](this[_0x9ba6('0x8')][_0x2413ad[_0x9ba6('0x1c')]])){this[_0x9ba6('0x8')][_0x2413ad[_0x9ba6('0x1c')]]={'routeId':_0x2413ad['value'],'variables':this[_0x9ba6('0x3c')][_0x2413ad['uniqueid']]};logger[_0x9ba6('0x27')](_0x9ba6('0x3d'),_0x2413ad[_0x9ba6('0x1c')],_0x2413ad[_0x9ba6('0x3a')][_0x9ba6('0x3e')],_['keys'](_0x2413ad[_0x9ba6('0x3a')])[0x0],_0x2413ad[_0x9ba6('0x3b')]);logger[_0x9ba6('0x1a')](_0x9ba6('0x3f'),_0x2413ad[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](this[_0x9ba6('0x8')][_0x2413ad[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));this[_0x9ba6('0x19')](_0x9ba6('0x2c'),_0x9ba6('0x2d'),this['channels'][_0x2413ad[_0x9ba6('0x1c')]]);}}}}catch(_0x1926ae){logger['error'](_0x9ba6('0x40'),_0x2413ad[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x1926ae,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x9ba6('0x39')]=function(_0x4eb549,_0x254f0d,_0x2c1abc){var _0x52a910=[_0x9ba6('0x41'),_0x9ba6('0x42'),_0x9ba6('0x43'),_0x9ba6('0x44'),_0x9ba6('0x45'),_0x9ba6('0x46'),_0x9ba6('0x47'),_0x9ba6('0x48'),_0x9ba6('0x49'),_0x9ba6('0x4a'),_0x9ba6('0x4b'),_0x9ba6('0x4c'),'membercalls',_0x9ba6('0x4d'),_0x9ba6('0x4e'),_0x9ba6('0x4f'),_0x9ba6('0x29'),_0x9ba6('0x50'),_0x9ba6('0x51')];if(!_[_0x9ba6('0x52')](_0x254f0d)&&!_[_0x9ba6('0x53')](_0x52a910,_0x254f0d)){if(_[_0x9ba6('0x17')](this['variables'][_0x4eb549])){this['variables'][_0x4eb549]={};}this[_0x9ba6('0x3c')][_0x4eb549][_0x254f0d]=_0x2c1abc;}};VoiceDialReport[_0x9ba6('0x18')][_0x9ba6('0x15')]=function(_0x26e2c7){try{if(this[_0x9ba6('0x16')](_0x26e2c7)){logger['debug'](_0x9ba6('0x54'),_0x26e2c7['uniqueid'],util[_0x9ba6('0x1d')](_0x26e2c7,{'showHidden':![],'depth':null}));if(this['channels'][_0x26e2c7[_0x9ba6('0x1c')]]){logger[_0x9ba6('0x27')](_0x9ba6('0x55'),_0x26e2c7[_0x9ba6('0x1c')],_0x26e2c7[_0x9ba6('0x56')]);this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x57')]=moment()[_0x9ba6('0x1f')](_0x9ba6('0x20'));this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x58')]=moment(this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x57')])[_0x9ba6('0x59')](this['channels'][_0x26e2c7[_0x9ba6('0x1c')]]['starttime'],_0x9ba6('0x5a'));this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x5b')]='complete';this[_0x9ba6('0xa')][_0x9ba6('0x5c')]+=0x1;if(this['channels'][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x5d')]){this[_0x9ba6('0xa')][_0x9ba6('0x5e')]+=0x1;this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']]['holdtime']=moment(this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x5d')])[_0x9ba6('0x59')](this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x5f')],_0x9ba6('0x5a'));this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x60')]=moment(this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x57')])[_0x9ba6('0x59')](this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']][_0x9ba6('0x5d')],'seconds');this[_0x9ba6('0xa')]['sumHoldTime']+=this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']][_0x9ba6('0x61')]||0x0;this[_0x9ba6('0xa')][_0x9ba6('0x62')]+=this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]][_0x9ba6('0x60')];}this['outbound'][_0x9ba6('0x63')]+=this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']][_0x9ba6('0x58')];logger[_0x9ba6('0x1a')](_0x9ba6('0x64'),_0x26e2c7[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x9ba6('0x19')]('custom:voiceDialReport',this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']]);logger['debug'](_0x9ba6('0x65'),_0x26e2c7['uniqueid'],util['inspect'](this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x9ba6('0x19')]('custom:dialend',this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]]);logger['debug'](_0x9ba6('0x66'),_0x26e2c7[_0x9ba6('0x1c')],util['inspect'](this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]],{'showHidden':![],'depth':null}));this[_0x9ba6('0x19')](_0x9ba6('0x2c'),_0x9ba6('0x67'),this[_0x9ba6('0xa')]);logger[_0x9ba6('0x27')](_0x9ba6('0x68'),JSON[_0x9ba6('0x69')](this['channels'][_0x26e2c7[_0x9ba6('0x1c')]]));logger[_0x9ba6('0x1a')](_0x9ba6('0x6a'),_0x26e2c7[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](this['channels'][_0x26e2c7['uniqueid']],{'showHidden':![],'depth':null}));this[_0x9ba6('0x19')](_0x9ba6('0x2c'),_0x9ba6('0x6b'),this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x1c')]]);delete this[_0x9ba6('0x8')][_0x26e2c7['uniqueid']];}else if(this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x6c')]]){this[_0x9ba6('0x8')][_0x26e2c7[_0x9ba6('0x6c')]]['uniqueid']=this['channels'][_0x26e2c7['linkedid']][_0x9ba6('0x6d')];}if(this[_0x9ba6('0x3c')][_0x26e2c7[_0x9ba6('0x1c')]]){delete this[_0x9ba6('0x3c')][_0x26e2c7[_0x9ba6('0x1c')]];}}}catch(_0x54849e){logger['error'](_0x9ba6('0x6e'),_0x26e2c7[_0x9ba6('0x1c')],util['inspect'](_0x54849e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ba6('0x18')]['syncNewExten']=function(_0x43c79c){try{if(this[_0x9ba6('0x16')](_0x43c79c)){logger['debug'](_0x9ba6('0x6f'),_0x43c79c['uniqueid'],util[_0x9ba6('0x1d')](_0x43c79c,{'showHidden':![],'depth':null}));if(_0x43c79c[_0x9ba6('0x70')][_0x9ba6('0x71')]()==='set'){_0x43c79c['applicationdata']=(_0x43c79c[_0x9ba6('0x72')]||_0x43c79c[_0x9ba6('0x73')])[_0x9ba6('0x71')]();if(_[_0x9ba6('0x74')](_0x43c79c[_0x9ba6('0x73')],_0x9ba6('0x75'))){if(_[_0x9ba6('0x17')](this[_0x9ba6('0xb')][_0x43c79c[_0x9ba6('0x1c')]]))this[_0x9ba6('0xb')][_0x43c79c[_0x9ba6('0x1c')]]={};logger['info']('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x43c79c[_0x9ba6('0x1c')],_0x43c79c[_0x9ba6('0x70')],_0x43c79c[_0x9ba6('0x73')]);var _0x29b2dc=_0x43c79c['applicationdata'][_0x9ba6('0x76')]('=');var _0x4d5bfc=_0x29b2dc[0x0][_0x9ba6('0x77')](/cdr\((.*)\)/);if(_0x4d5bfc)this[_0x9ba6('0xb')][_0x43c79c[_0x9ba6('0x1c')]][_0x4d5bfc[0x1]]=_0x29b2dc[0x1];}}}}catch(_0x4572e7){logger[_0x9ba6('0x2f')](_0x9ba6('0x78'),_0x43c79c[_0x9ba6('0x1c')],util[_0x9ba6('0x1d')](_0x4572e7,{'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 d3d32c7..16151ea 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 _0x8b29=['isNil','Action','status','channel','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','format','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','loopQueueShow','clearZombieChannels','queues','catch','[voiceQueueReport][queues]','flagQueueSummary','queuesummary','then','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','available','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerleave','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','membername','queuecallerexit','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','reason','toUpperCase','syncVarSet','[%s][voiceQueueReport][varset]','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','diff','milliseconds','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','appdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','split','match','exports','lodash','util','md5','../../../config/logger','ami','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','channels','voiceQueues','campaigns','variables','bind','syncQueueSummaryComplete','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncAgentConnect','varset','hangup','syncHangup','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','switch'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x8b29,0xbe));var _0x98b2=function(_0x5367f6,_0x5dad97){_0x5367f6=_0x5367f6-0x0;var _0x5d47ac=_0x8b29[_0x5367f6];return _0x5d47ac;};'use strict';var _=require(_0x98b2('0x0'));var moment=require('moment');var util=require(_0x98b2('0x1'));var md5=require(_0x98b2('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x98b2('0x3'))(_0x98b2('0x4'));var ami=require('../ami');var QueueReport=require(_0x98b2('0x5'));config['redis']=_[_0x98b2('0x6')](config[_0x98b2('0x7')],{'host':_0x98b2('0x8'),'port':0x18eb});var io=require(_0x98b2('0x9'))(new Redis(config[_0x98b2('0x7')]));var Sequence=function(){};Sequence[_0x98b2('0xa')][_0x98b2('0xb')]=function(_0x388827){this[_0x98b2('0xc')]=this[_0x98b2('0xc')]?this['tail']['finally'](_0x388827):_0x388827();};function VoiceQueueReport(_0x599bf5){this[_0x98b2('0xd')]=new Sequence();this[_0x98b2('0xe')]={};this[_0x98b2('0xf')]=_0x599bf5[_0x98b2('0xf')];this[_0x98b2('0x10')]=_0x599bf5['queueChannels'];this[_0x98b2('0x11')]=_0x599bf5[_0x98b2('0x11')];this['flagQueueSummary']=!![];this[_0x98b2('0x12')]=_0x599bf5[_0x98b2('0x12')];this[_0x98b2('0x13')]={};ami['on']('queuesummary',this['syncQueueSummary'][_0x98b2('0x14')](this));ami['on']('queuesummarycomplete',this[_0x98b2('0x15')]['bind'](this));ami['on']('queuecallerjoin',this['syncQueueCallerJoin'][_0x98b2('0x14')](this));ami['on'](_0x98b2('0x16'),this[_0x98b2('0x17')]['bind'](this));ami['on']('queuecallerleave',this['syncQueueCallerLeave'][_0x98b2('0x14')](this));ami['on'](_0x98b2('0x18'),this[_0x98b2('0x19')][_0x98b2('0x14')](this));ami['on']('agentconnect',this[_0x98b2('0x1a')]['bind'](this));ami['on'](_0x98b2('0x1b'),this['syncVarSet'][_0x98b2('0x14')](this));ami['on'](_0x98b2('0x1c'),this[_0x98b2('0x1d')][_0x98b2('0x14')](this));ami['on']('fullybooted',this[_0x98b2('0x1e')][_0x98b2('0x14')](this));ami['on']('newexten',this['syncNewExten'][_0x98b2('0x14')](this));ami['on'](_0x98b2('0x1f'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x98b2('0x20'),this[_0x98b2('0x21')]['bind'](this));ami['on'](_0x98b2('0x22'),this[_0x98b2('0x23')][_0x98b2('0x14')](this));ami['on']('blindtransfer',this[_0x98b2('0x24')]['bind'](this));this[_0x98b2('0x25')]();this['loopQueueShow']();}function clearChannels(_0x4e60ba){if(!_[_0x98b2('0x26')](_0x4e60ba)){for(var _0xe99d27 in _0x4e60ba){if(_0x4e60ba[_0x98b2('0x27')](_0xe99d27)){delete _0x4e60ba[_0xe99d27];}}}}function clearCampaigns(_0x525b57){if(!_['isEmpty'](_0x525b57)){for(var _0x50c699 in _0x525b57){if(_0x525b57[_0x98b2('0x27')](_0x50c699)){_0x525b57[_0x50c699][_0x98b2('0x28')]=0x0;}}}}function clearVoiceQueues(_0x50aafb){if(!_[_0x98b2('0x26')](_0x50aafb)){for(var _0x28db65 in _0x50aafb){if(_0x50aafb[_0x98b2('0x27')](_0x28db65)){_0x50aafb[_0x28db65]['originated']=0x0;_0x50aafb[_0x28db65][_0x98b2('0x29')]=0x0;_0x50aafb[_0x28db65][_0x98b2('0x2a')]=0x0;_0x50aafb[_0x28db65][_0x98b2('0x2b')]=0x0;_0x50aafb[_0x28db65][_0x98b2('0x2c')]=!![];}}}}function clearAgentBooked(_0x25393d){if(!_['isEmpty'](_0x25393d)){for(var _0x23883f in _0x25393d){if(_0x25393d['hasOwnProperty'](_0x23883f)){_0x25393d[_0x23883f][_0x98b2('0x2d')]=!![];}}}}VoiceQueueReport[_0x98b2('0xa')]['clearZombieChannels']=function(){var _0x2f5156=this;for(var _0x363174 in this['channels']){if(this[_0x98b2('0x10')][_0x98b2('0x27')](_0x363174)&&!this[_0x98b2('0x10')][_0x363174][_0x98b2('0x2e')]){this['sequence']['enqueue'](function(){if(!_[_0x98b2('0x2f')](_0x2f5156[_0x98b2('0x10')][_0x363174])){return ami[_0x98b2('0x30')]({'action':_0x98b2('0x31'),'channel':_0x2f5156[_0x98b2('0x10')][_0x363174][_0x98b2('0x32')]})['catch'](function(_0x448c8b){if(_0x448c8b[_0x98b2('0x33')]===_0x98b2('0x34')){setTimeout(function(){if(_0x2f5156[_0x98b2('0x10')][_0x363174]){delete _0x2f5156[_0x98b2('0x10')][_0x363174];logger[_0x98b2('0x35')](_0x98b2('0x36'),_0x363174,util[_0x98b2('0x37')](_0x448c8b,{'showHidden':![],'depth':null}));}if(_0x2f5156[_0x98b2('0xe')][_0x363174]){delete _0x2f5156[_0x98b2('0xe')][_0x363174];logger[_0x98b2('0x35')](_0x98b2('0x38'),_0x363174,util[_0x98b2('0x37')](_0x448c8b,{'showHidden':![],'depth':null}));}if(_0x2f5156['variables'][_0x363174]){delete _0x2f5156['variables'][_0x363174];logger[_0x98b2('0x35')](_0x98b2('0x39'),_0x363174,util[_0x98b2('0x37')](_0x448c8b,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x1e')]=function(){logger[_0x98b2('0x35')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x98b2('0x10')]);this[_0x98b2('0x3a')](this[_0x98b2('0xe')]);clearAgentBooked(this[_0x98b2('0xf')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x98b2('0x12')]);};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x3a')]=function(_0x178ad1){var _0x2cadb7=this;if(!_[_0x98b2('0x26')](_0x178ad1)){for(var _0x3b2808 in _0x178ad1){if(_0x178ad1['hasOwnProperty'](_0x3b2808)){_0x2cadb7[_0x98b2('0x3b')](_0x178ad1[_0x3b2808],'clearqueuereport');delete _0x178ad1[_0x3b2808];}}}};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x3c')]=function(_0x20a69b,_0x94e4b8,_0x5ba581){io['to'](_0x20a69b)['emit'](_0x94e4b8,_0x5ba581);};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x3d')]=function(_0x42c69c,_0x4ad998){logger[_0x98b2('0x3e')](_0x98b2('0x3f')+_0x4ad998+_0x98b2('0x40'),_0x42c69c[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x42c69c,{'showHidden':![],'depth':null}));this[_0x98b2('0x3c')](util['format'](_0x98b2('0x42'),_0x42c69c[_0x98b2('0x43')]),_0x98b2('0x44'),_0x42c69c);io['emit'](_0x98b2('0x45'),_0x42c69c);};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x3b')]=function(_0x97f0dd,_0xbf3665){logger[_0x98b2('0x3e')]('[%s][voiceQueueReport]['+_0xbf3665+_0x98b2('0x46'),_0x97f0dd['uniqueid'],util[_0x98b2('0x37')](_0x97f0dd,{'showHidden':![],'depth':null}));this[_0x98b2('0x3c')](util[_0x98b2('0x47')](_0x98b2('0x42'),_0x97f0dd[_0x98b2('0x43')]),_0x98b2('0x48'),_0x97f0dd);io[_0x98b2('0x3c')](_0x98b2('0x49'),_0x97f0dd);};VoiceQueueReport[_0x98b2('0xa')]['emitVoiceQueueSummary']=function(_0x352ee0,_0x524b33){if(_0x352ee0[_0x98b2('0x4a')]===_0x98b2('0x4b')){var _0x5aad70={'id':_0x352ee0['id'],'name':_0x352ee0[_0x98b2('0x43')],'strategy':_0x352ee0[_0x98b2('0x4c')],'answered':_0x352ee0[_0x98b2('0x4d')],'available':_0x352ee0['available'],'loggedIn':_0x352ee0[_0x98b2('0x4e')],'pTalking':_0x352ee0[_0x98b2('0x2a')],'sumBillable':_0x352ee0[_0x98b2('0x4f')],'sumDuration':_0x352ee0[_0x98b2('0x50')],'sumHoldTime':_0x352ee0[_0x98b2('0x51')]||0x0,'talking':_0x352ee0['talking'],'total':_0x352ee0['total'],'type':_0x352ee0[_0x98b2('0x4a')],'unmanaged':_0x352ee0[_0x98b2('0x52')],'abandoned':_0x352ee0[_0x98b2('0x53')],'waiting':_0x352ee0[_0x98b2('0x2b')]};if(_0x352ee0['Trunk']){_0x5aad70['Trunk']={'id':_0x352ee0['Trunk']['id'],'name':_0x352ee0[_0x98b2('0x54')][_0x98b2('0x43')],'active':_0x352ee0[_0x98b2('0x54')][_0x98b2('0x55')],'callerid':_0x352ee0[_0x98b2('0x54')][_0x98b2('0x56')]};}if(_0x352ee0[_0x98b2('0x57')]){_0x5aad70[_0x98b2('0x57')]={'id':_0x352ee0[_0x98b2('0x57')]['id'],'name':_0x352ee0['Interval'][_0x98b2('0x43')]};}var _0x4c5cc8=md5(JSON[_0x98b2('0x58')](_0x5aad70));if(_0x352ee0[_0x98b2('0x2')]!==_0x4c5cc8){_0x352ee0[_0x98b2('0x2')]=_0x4c5cc8;logger[_0x98b2('0x3e')]('[voiceQueueReport]['+_0x524b33+_0x98b2('0x59'),util[_0x98b2('0x37')](_0x5aad70,{'showHidden':![],'depth':null}));this[_0x98b2('0x3c')](util[_0x98b2('0x47')](_0x98b2('0x42'),_0x5aad70['name']),_0x98b2('0x5a'),_0x5aad70);}}};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x5b')]=function(_0x2fb91e){return _0x2fb91e!==null&&!_[_0x98b2('0x5c')](_0x2fb91e);};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x5d')]=function(){var _0x144b62=this;setInterval(function(){_0x144b62[_0x98b2('0x5e')]();ami[_0x98b2('0x30')]({'action':_0x98b2('0x5f')})[_0x98b2('0x60')](function(_0x4d77d3){logger[_0x98b2('0x35')](_0x98b2('0x61'),util['inspect'](_0x4d77d3,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x98b2('0x25')]=function(){var _0x4ae70f=this;setInterval(function(){if(_0x4ae70f[_0x98b2('0x62')]){return ami[_0x98b2('0x30')]({'action':_0x98b2('0x63')})[_0x98b2('0x64')](function(_0x3c041f){_0x4ae70f[_0x98b2('0x62')]=![];})['catch'](function(_0x3c79f4){logger['error']('[voiceQueueReport][queuesummary]',util[_0x98b2('0x37')](_0x3c79f4,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x98b2('0xa')]['syncQueueSummary']=function(_0x12a72e){try{if(this[_0x98b2('0x5b')](_0x12a72e)&&this['isNotNull'](_0x12a72e[_0x98b2('0x65')])){logger[_0x98b2('0x3e')](_0x98b2('0x66'),util[_0x98b2('0x37')](_0x12a72e,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x12a72e['queue']]){logger[_0x98b2('0x67')](_0x98b2('0x68'),_0x12a72e[_0x98b2('0x65')]);var _0x18b350=_[_0x98b2('0x69')](this['channels'],'queue')[_0x12a72e[_0x98b2('0x65')]]||0x0;var _0x53d054=_0x18b350-_0x12a72e[_0x98b2('0x6a')];if(this[_0x98b2('0x11')][_0x12a72e[_0x98b2('0x65')]][_0x98b2('0x2b')]!==_[_0x98b2('0x6b')](_0x12a72e[_0x98b2('0x6a')])||this['voiceQueues'][_0x12a72e[_0x98b2('0x65')]][_0x98b2('0x4e')]!==_[_0x98b2('0x6b')](_0x12a72e[_0x98b2('0x6c')])||this[_0x98b2('0x11')][_0x12a72e[_0x98b2('0x65')]]['available']!==_['toNumber'](_0x12a72e[_0x98b2('0x6d')])||this[_0x98b2('0x11')][_0x12a72e[_0x98b2('0x65')]][_0x98b2('0x29')]!==_0x53d054){this[_0x98b2('0x11')][_0x12a72e[_0x98b2('0x65')]][_0x98b2('0x2b')]=_[_0x98b2('0x6b')](_0x12a72e['callers']);this[_0x98b2('0x11')][_0x12a72e[_0x98b2('0x65')]][_0x98b2('0x4e')]=_['toNumber'](_0x12a72e[_0x98b2('0x6c')]);this[_0x98b2('0x11')][_0x12a72e[_0x98b2('0x65')]]['available']=_[_0x98b2('0x6b')](_0x12a72e[_0x98b2('0x6d')]);this['voiceQueues'][_0x12a72e[_0x98b2('0x65')]]['talking']=_0x53d054>0x0?_0x53d054:0x0;this['voiceQueues'][_0x12a72e['queue']]['talking']=this[_0x98b2('0x11')][_0x12a72e[_0x98b2('0x65')]][_0x98b2('0x29')]>_['toNumber'](_0x12a72e[_0x98b2('0x6c')])?_[_0x98b2('0x6b')](_0x12a72e[_0x98b2('0x6c')]):this[_0x98b2('0x11')][_0x12a72e[_0x98b2('0x65')]][_0x98b2('0x29')];this[_0x98b2('0x6e')](this['voiceQueues'][_0x12a72e[_0x98b2('0x65')]],'queuesummary');}logger[_0x98b2('0x3e')](_0x98b2('0x6f'),util[_0x98b2('0x37')](this[_0x98b2('0x11')][_0x12a72e[_0x98b2('0x65')]],{'showHidden':![],'depth':null}));ami[_0x98b2('0x3c')](_0x98b2('0x70'),this['voiceQueues'][_0x12a72e['queue']]);}}}catch(_0xc89b4b){logger[_0x98b2('0x35')](_0x98b2('0x71'),util[_0x98b2('0x37')](_0xc89b4b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x98b2('0x15')]=function(_0x5cbba7){logger[_0x98b2('0x3e')](_0x98b2('0x72'),util['inspect'](_0x5cbba7,{'showHidden':![],'depth':null}));this[_0x98b2('0x62')]=!![];};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x73')]=function(_0x6d224a){try{if(this[_0x98b2('0x5b')](_0x6d224a)){logger[_0x98b2('0x3e')](_0x98b2('0x74'),_0x6d224a[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x6d224a,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x98b2('0xe')][_0x6d224a[_0x98b2('0x41')]]))this[_0x98b2('0xe')][_0x6d224a[_0x98b2('0x41')]]=[];if(_[_0x98b2('0x5c')](this[_0x98b2('0x10')][_0x6d224a[_0x98b2('0x41')]]))this['channels'][_0x6d224a[_0x98b2('0x41')]]={};var _0xdbc224=new QueueReport();_0xdbc224[_0x98b2('0x43')]=_0x6d224a[_0x98b2('0x65')];_0xdbc224[_0x98b2('0x4a')]=this['voiceQueues'][_0xdbc224[_0x98b2('0x43')]]&&this['voiceQueues'][_0xdbc224[_0x98b2('0x43')]][_0x98b2('0x4a')]?this[_0x98b2('0x11')][_0xdbc224['name']][_0x98b2('0x4a')]||_0x98b2('0x4b'):'inbound';_0xdbc224[_0x98b2('0x65')]=_0x6d224a['queue'];_0xdbc224[_0x98b2('0x75')]=moment()['format'](_0x98b2('0x76'));_0xdbc224[_0x98b2('0x77')]=_0x6d224a[_0x98b2('0x77')];_0xdbc224[_0x98b2('0x78')]=_0x6d224a[_0x98b2('0x78')];_0xdbc224[_0x98b2('0x41')]=_0x6d224a['uniqueid'];_0xdbc224[_0x98b2('0x79')]=this['channels'][_0x6d224a[_0x98b2('0x41')]][_0x98b2('0x79')];logger[_0x98b2('0x67')](_0x98b2('0x7a'),_0xdbc224['name'],_0xdbc224[_0x98b2('0x4a')]);_[_0x98b2('0x7b')](_0xdbc224,_[_0x98b2('0x7c')](_0x6d224a,_[_0x98b2('0x7d')](_0xdbc224)));this[_0x98b2('0xe')][_0x6d224a[_0x98b2('0x41')]][_0x98b2('0x7e')](_0xdbc224);this[_0x98b2('0x10')][_0x6d224a['uniqueid']]=_0xdbc224;this[_0x98b2('0x3d')](_0xdbc224,'queuecallerjoin');}}catch(_0x228797){logger[_0x98b2('0x35')](_0x98b2('0x74'),_0x6d224a['uniqueid'],util['inspect'](_0x228797,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x17')]=function(_0x5c9d26){try{if(this['isNotNull'](_0x5c9d26)){logger[_0x98b2('0x3e')](_0x98b2('0x7f'),_0x5c9d26[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x5c9d26,{'showHidden':![],'depth':null}));if(this[_0x98b2('0xe')][_0x5c9d26[_0x98b2('0x41')]]){var _0x4a6562=_[_0x98b2('0x80')](this[_0x98b2('0xe')][_0x5c9d26[_0x98b2('0x41')]]);_0x4a6562[_0x98b2('0x81')]=![];_0x4a6562['queuecallercompleteAt']=null;_0x4a6562['holdtime']=_0x5c9d26[_0x98b2('0x82')];_0x4a6562[_0x98b2('0x83')]=_0x5c9d26[_0x98b2('0x83')];_0x4a6562[_0x98b2('0x16')]=!![];_0x4a6562[_0x98b2('0x84')]=moment()[_0x98b2('0x47')](_0x98b2('0x76'));_0x4a6562[_0x98b2('0x85')]=_0x98b2('0x86');_0x4a6562[_0x98b2('0x87')]=null;logger[_0x98b2('0x67')](_0x98b2('0x88'),_0x4a6562[_0x98b2('0x43')],_0x4a6562[_0x98b2('0x4a')]);this[_0x98b2('0x10')][_0x5c9d26[_0x98b2('0x41')]]=_0x4a6562;this[_0x98b2('0x3b')](_0x4a6562,_0x98b2('0x16'));}}}catch(_0x48015d){logger[_0x98b2('0x35')](_0x98b2('0x7f'),_0x5c9d26[_0x98b2('0x41')],util['inspect'](_0x48015d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x19a1b6){try{if(this[_0x98b2('0x5b')](_0x19a1b6)){logger[_0x98b2('0x3e')](_0x98b2('0x89'),_0x19a1b6[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x19a1b6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x19a1b6[_0x98b2('0x41')]]){var _0x50637c=_[_0x98b2('0x80')](this[_0x98b2('0xe')][_0x19a1b6['uniqueid']]);_0x50637c[_0x98b2('0x8a')]=moment()[_0x98b2('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x50637c[_0x98b2('0x8b')]=_0x19a1b6['connectedlinenum'];_0x50637c[_0x98b2('0x8c')]=_0x19a1b6[_0x98b2('0x8c')];logger[_0x98b2('0x67')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x50637c[_0x98b2('0x43')],_0x50637c[_0x98b2('0x4a')],_0x19a1b6[_0x98b2('0x8b')],_0x19a1b6['connectedlinename']);this[_0x98b2('0x10')][_0x19a1b6[_0x98b2('0x41')]]=_0x50637c;this[_0x98b2('0x3d')](_0x50637c,_0x98b2('0x8d'));}}}catch(_0x337f10){logger[_0x98b2('0x35')](_0x98b2('0x89'),_0x19a1b6['uniqueid'],util[_0x98b2('0x37')](_0x337f10,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x1a')]=function(_0x4e407b){try{if(this[_0x98b2('0x5b')](_0x4e407b)){logger[_0x98b2('0x3e')]('[%s][voiceQueueReport][agentconnect]',_0x4e407b[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x4e407b,{'showHidden':![],'depth':null}));if(this[_0x98b2('0xe')][_0x4e407b[_0x98b2('0x41')]]){var _0x36a137=_['last'](this[_0x98b2('0xe')][_0x4e407b['uniqueid']]);_0x36a137[_0x98b2('0x81')]=!![];_0x36a137[_0x98b2('0x85')]=_0x98b2('0x8e');logger[_0x98b2('0x67')](_0x98b2('0x8f'),_0x36a137[_0x98b2('0x43')],_0x36a137[_0x98b2('0x4a')]);}}}catch(_0x2cf137){logger[_0x98b2('0x35')](_0x98b2('0x90'),_0x4e407b[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x2cf137,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0x19')]=function(_0x3f7582){try{if(this[_0x98b2('0x5b')](_0x3f7582)){logger[_0x98b2('0x3e')](_0x98b2('0x91'),_0x3f7582[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x3f7582,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3f7582['uniqueid']]){var _0x4b70f6=_[_0x98b2('0x80')](this[_0x98b2('0xe')][_0x3f7582['uniqueid']]);_0x4b70f6['queuecallerabandon']=![];_0x4b70f6[_0x98b2('0x84')]=null;_0x4b70f6['assigned']=!![];_0x4b70f6[_0x98b2('0x87')]=_0x3f7582[_0x98b2('0x92')];_0x4b70f6[_0x98b2('0x82')]=_0x3f7582[_0x98b2('0x82')];_0x4b70f6['queuecallercomplete']=!![];_0x4b70f6[_0x98b2('0x93')]=![];_0x4b70f6['queuecallerexitAt']=null;if(!_0x4b70f6[_0x98b2('0x94')]){if(_0x3f7582['reason']==_0x98b2('0x94')){_0x4b70f6[_0x98b2('0x85')]=_0x98b2('0x95');logger[_0x98b2('0x67')](_0x98b2('0x96'),_0x4b70f6[_0x98b2('0x43')],_0x4b70f6[_0x98b2('0x4a')]);}else{if(_[_0x98b2('0x97')](_0x3f7582[_0x98b2('0x32')][_0x98b2('0x98')](),_0x98b2('0x99'))){if(this[_0x98b2('0xe')][_0x3f7582[_0x98b2('0x9a')]]){var _0x5cad04=_[_0x98b2('0x80')](this[_0x98b2('0xe')][_0x3f7582[_0x98b2('0x9a')]]);_0x5cad04[_0x98b2('0x81')]=![];_0x5cad04[_0x98b2('0x93')]=!![];_0x5cad04[_0x98b2('0x9b')]=moment(_0x4b70f6[_0x98b2('0x75')])[_0x98b2('0x9c')](_0x3f7582[_0x98b2('0x82')],_0x98b2('0x9d'))[_0x98b2('0x47')](_0x98b2('0x76'));_0x5cad04[_0x98b2('0x85')]=_0x98b2('0x9e');_0x5cad04['transfer']=!![];_0x5cad04[_0x98b2('0x9f')]=_0x98b2('0xa0');_0x5cad04['transferexten']=_0x3f7582[_0x98b2('0xa1')];_0x5cad04['transferuniqueid']=_0x3f7582[_0x98b2('0x41')];logger[_0x98b2('0x67')](_0x98b2('0xa2'),_0x5cad04['name'],_0x5cad04[_0x98b2('0x4a')]);var _0x1bad92=this[_0x98b2('0xe')][_0x3f7582[_0x98b2('0x9a')]];this[_0x98b2('0xe')][_0x3f7582[_0x98b2('0x9a')]]=this[_0x98b2('0xe')][_0x3f7582[_0x98b2('0x41')]];this[_0x98b2('0xe')][_0x3f7582[_0x98b2('0x41')]]=_0x1bad92;}}else{_0x4b70f6[_0x98b2('0x85')]=_0x98b2('0xa3')+_0x3f7582[_0x98b2('0xa4')][_0x98b2('0xa5')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4b70f6[_0x98b2('0x43')],_0x4b70f6[_0x98b2('0x4a')],_0x4b70f6[_0x98b2('0x85')]);}}}this[_0x98b2('0x10')][_0x3f7582[_0x98b2('0x41')]]=_0x4b70f6;this[_0x98b2('0x3b')](_0x4b70f6,'agentcomplete');}}}catch(_0x16985d){logger[_0x98b2('0x35')](_0x98b2('0x91'),_0x3f7582[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x16985d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0xa6')]=function(_0x379cd6){try{if(this['isNotNull'](_0x379cd6)){logger['debug'](_0x98b2('0xa7'),_0x379cd6['uniqueid'],util[_0x98b2('0x37')](_0x379cd6,{'showHidden':![],'depth':null}));this['addVariable'](_0x379cd6[_0x98b2('0x41')],_[_0x98b2('0x7d')](_0x379cd6[_0x98b2('0xa8')])[0x0],_0x379cd6[_0x98b2('0xa9')]);if(this[_0x98b2('0xe')][_0x379cd6[_0x98b2('0x41')]]){var _0x392a8b=_[_0x98b2('0x80')](this[_0x98b2('0xe')][_0x379cd6['uniqueid']]);if(_0x392a8b){if(this[_0x98b2('0x5b')](_0x379cd6[_0x98b2('0xa8')])&&this[_0x98b2('0x5b')](_0x379cd6[_0x98b2('0xa8')]['queuestatus'])){switch(_0x379cd6[_0x98b2('0xa9')]){case _0x98b2('0xaa'):_0x392a8b['queuecallerexit']=![];_0x392a8b['queuecallerexitAt']=null;break;case _0x98b2('0xab'):_0x392a8b[_0x98b2('0xac')]=_0x98b2('0xad');_0x392a8b[_0x98b2('0x93')]=!![];_0x392a8b[_0x98b2('0x9b')]=moment()[_0x98b2('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x392a8b[_0x98b2('0x8a')]=moment()['format'](_0x98b2('0x76'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x379cd6['uniqueid'],util[_0x98b2('0x37')](_0x392a8b,{'showHidden':![],'depth':null}));ami['emit'](_0x98b2('0xae'),_0x392a8b);break;default:_0x392a8b[_0x98b2('0x93')]=!![];_0x392a8b[_0x98b2('0x9b')]=moment()[_0x98b2('0x47')](_0x98b2('0x76'));_0x392a8b[_0x98b2('0x8a')]=moment()[_0x98b2('0x47')](_0x98b2('0x76'));}_0x392a8b[_0x98b2('0x16')]=![];_0x392a8b['queuecallerabandonAt']=null;_0x392a8b['queuecallerexitreason']=_0x379cd6['value'];this['channels'][_0x379cd6[_0x98b2('0x41')]]=_0x392a8b;this[_0x98b2('0x3b')](_0x392a8b,_0x98b2('0x1b'));}else if(this[_0x98b2('0x5b')](_0x379cd6[_0x98b2('0xa8')])&&this[_0x98b2('0x5b')](_0x379cd6[_0x98b2('0xa8')][_0x98b2('0xaf')])){if(!_0x392a8b['queuecallerabandon']){_0x392a8b[_0x98b2('0x93')]=!![];_0x392a8b[_0x98b2('0x9b')]=moment()['format'](_0x98b2('0x76'));_0x392a8b[_0x98b2('0x85')]='EXITWITHKEY';_0x392a8b[_0x98b2('0x8a')]=moment()[_0x98b2('0x47')](_0x98b2('0x76'));this[_0x98b2('0x10')][_0x379cd6[_0x98b2('0x41')]]=_0x392a8b;}}logger[_0x98b2('0x67')](_0x98b2('0xb0'),_0x379cd6[_0x98b2('0x41')],_0x392a8b[_0x98b2('0x43')],_0x392a8b[_0x98b2('0x4a')],_[_0x98b2('0x7d')](_0x379cd6[_0x98b2('0xa8')])[0x0],_0x379cd6[_0x98b2('0xa9')]);_0x392a8b['variables']=this['variables'][_0x379cd6[_0x98b2('0x41')]];}}}}catch(_0x50b50f){logger[_0x98b2('0x35')](_0x98b2('0xa7'),_0x379cd6[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x50b50f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98b2('0xa')][_0x98b2('0xb1')]=function(_0x2c6165,_0x16ea3f,_0x1ee849){var _0x1431d4=[_0x98b2('0xb2'),_0x98b2('0xb3'),_0x98b2('0xb4'),_0x98b2('0xb5'),_0x98b2('0xb6'),'rtpaudioqoslossbridged',_0x98b2('0xb7'),'rtpaudioqosrttbridged',_0x98b2('0xb8'),'sipuri','bridgepeer',_0x98b2('0xb9'),_0x98b2('0xba'),_0x98b2('0xbb'),_0x98b2('0xbc'),_0x98b2('0xbd'),'membername',_0x98b2('0xbe'),_0x98b2('0xbf')];if(!_[_0x98b2('0x2f')](_0x16ea3f)&&!_[_0x98b2('0xc0')](_0x1431d4,_0x16ea3f)){if(_['isUndefined'](this[_0x98b2('0x13')][_0x2c6165])){this['variables'][_0x2c6165]={};}this[_0x98b2('0x13')][_0x2c6165][_0x16ea3f]=_0x1ee849;}};VoiceQueueReport['prototype'][_0x98b2('0x1d')]=function(_0x30c96c){try{if(this['isNotNull'](_0x30c96c)){logger[_0x98b2('0x3e')]('[%s][voiceQueueReport][hangup]',_0x30c96c[_0x98b2('0x41')],util[_0x98b2('0x37')](_0x30c96c,{'showHidden':![],'depth':null}));if(this[_0x98b2('0xe')][_0x30c96c[_0x98b2('0x41')]]){for(var _0x3ea813=0x0,_0x5b8aeb={};_0x3ea8130x0?_0x432cfc:0x0;this['voiceQueues'][_0x2663e7[_0xe345('0x68')]][_0xe345('0x31')]=this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]]['talking']>_[_0xe345('0x6d')](_0x2663e7[_0xe345('0x6e')])?_[_0xe345('0x6d')](_0x2663e7[_0xe345('0x6e')]):this['voiceQueues'][_0x2663e7['queue']]['talking'];this[_0xe345('0x51')](this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]],_0xe345('0x19'));}logger[_0xe345('0x46')](_0xe345('0x70'),util['inspect'](this[_0xe345('0x16')][_0x2663e7[_0xe345('0x68')]],{'showHidden':![],'depth':null}));ami[_0xe345('0x44')](_0xe345('0x71'),this['voiceQueues'][_0x2663e7[_0xe345('0x68')]]);}}}catch(_0x47e0a5){logger[_0xe345('0x3c')](_0xe345('0x66'),util[_0xe345('0x3e')](_0x47e0a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')]['syncQueueSummaryComplete']=function(_0x85015d){logger[_0xe345('0x46')](_0xe345('0x72'),util['inspect'](_0x85015d,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0xe345('0x1c')]=function(_0x17c44d){try{if(this[_0xe345('0x62')](_0x17c44d)){logger[_0xe345('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x17c44d[_0xe345('0x49')],util[_0xe345('0x3e')](_0x17c44d,{'showHidden':![],'depth':null}));if(_[_0xe345('0x73')](this[_0xe345('0x12')][_0x17c44d[_0xe345('0x49')]]))this[_0xe345('0x12')][_0x17c44d[_0xe345('0x49')]]=[];if(_['isUndefined'](this[_0xe345('0x14')][_0x17c44d[_0xe345('0x49')]]))this[_0xe345('0x14')][_0x17c44d['uniqueid']]={};var _0x3c90f3=new QueueReport();_0x3c90f3[_0xe345('0x4c')]=_0x17c44d['queue'];_0x3c90f3[_0xe345('0x58')]=this[_0xe345('0x16')][_0x3c90f3[_0xe345('0x4c')]]&&this[_0xe345('0x16')][_0x3c90f3[_0xe345('0x4c')]][_0xe345('0x58')]?this[_0xe345('0x16')][_0x3c90f3[_0xe345('0x4c')]][_0xe345('0x58')]||_0xe345('0x52'):'inbound';_0x3c90f3[_0xe345('0x68')]=_0x17c44d['queue'];_0x3c90f3['queuecallerjoinAt']=moment()[_0xe345('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c90f3['position']=_0x17c44d[_0xe345('0x74')];_0x3c90f3['count']=_0x17c44d[_0xe345('0x75')];_0x3c90f3[_0xe345('0x49')]=_0x17c44d[_0xe345('0x49')];_0x3c90f3[_0xe345('0x76')]=this[_0xe345('0x14')][_0x17c44d[_0xe345('0x49')]][_0xe345('0x76')];logger[_0xe345('0x6a')](_0xe345('0x77'),_0x3c90f3['name'],_0x3c90f3[_0xe345('0x58')]);_[_0xe345('0x78')](_0x3c90f3,_[_0xe345('0x79')](_0x17c44d,_[_0xe345('0x7a')](_0x3c90f3)));this['queueReports'][_0x17c44d[_0xe345('0x49')]][_0xe345('0x7b')](_0x3c90f3);this[_0xe345('0x14')][_0x17c44d[_0xe345('0x49')]]=_0x3c90f3;this['emitVoiceQueueChannelSave'](_0x3c90f3,_0xe345('0x1b'));}}catch(_0x16f894){logger[_0xe345('0x3c')](_0xe345('0x7c'),_0x17c44d[_0xe345('0x49')],util[_0xe345('0x3e')](_0x16f894,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')]['syncQueueCallerAbandon']=function(_0x1cb81a){try{if(this[_0xe345('0x62')](_0x1cb81a)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x1cb81a[_0xe345('0x49')],util[_0xe345('0x3e')](_0x1cb81a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1cb81a[_0xe345('0x49')]]){var _0x727ea2=_[_0xe345('0x7d')](this[_0xe345('0x12')][_0x1cb81a[_0xe345('0x49')]]);_0x727ea2['queuecallercomplete']=![];_0x727ea2[_0xe345('0x7e')]=null;_0x727ea2[_0xe345('0x7f')]=_0x1cb81a[_0xe345('0x7f')];_0x727ea2[_0xe345('0x80')]=_0x1cb81a[_0xe345('0x80')];_0x727ea2[_0xe345('0x1d')]=!![];_0x727ea2[_0xe345('0x81')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));_0x727ea2[_0xe345('0x83')]=_0xe345('0x84');_0x727ea2['lastAssignedTo']=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x727ea2['name'],_0x727ea2[_0xe345('0x58')]);this[_0xe345('0x14')][_0x1cb81a[_0xe345('0x49')]]=_0x727ea2;this[_0xe345('0x4d')](_0x727ea2,_0xe345('0x1d'));}}}catch(_0x13a6ed){logger['error'](_0xe345('0x85'),_0x1cb81a[_0xe345('0x49')],util[_0xe345('0x3e')](_0x13a6ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x20')]=function(_0x998dc){try{if(this[_0xe345('0x62')](_0x998dc)){logger['debug'](_0xe345('0x86'),_0x998dc[_0xe345('0x49')],util[_0xe345('0x3e')](_0x998dc,{'showHidden':![],'depth':null}));if(this[_0xe345('0x12')][_0x998dc[_0xe345('0x49')]]){var _0x565965=_[_0xe345('0x7d')](this['queueReports'][_0x998dc[_0xe345('0x49')]]);_0x565965['queuecallerleaveAt']=moment()[_0xe345('0x4a')](_0xe345('0x82'));_0x565965[_0xe345('0x87')]=_0x998dc[_0xe345('0x87')];_0x565965[_0xe345('0x88')]=_0x998dc[_0xe345('0x88')];logger[_0xe345('0x6a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x565965[_0xe345('0x4c')],_0x565965['type'],_0x998dc[_0xe345('0x87')],_0x998dc['connectedlinename']);this[_0xe345('0x14')][_0x998dc[_0xe345('0x49')]]=_0x565965;this[_0xe345('0x45')](_0x565965,_0xe345('0x1f'));}}}catch(_0x1cbafc){logger[_0xe345('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0x998dc['uniqueid'],util[_0xe345('0x3e')](_0x1cbafc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x22')]=function(_0xfcef7d){try{if(this[_0xe345('0x62')](_0xfcef7d)){logger[_0xe345('0x46')](_0xe345('0x89'),_0xfcef7d[_0xe345('0x49')],util[_0xe345('0x3e')](_0xfcef7d,{'showHidden':![],'depth':null}));if(this[_0xe345('0x12')][_0xfcef7d[_0xe345('0x49')]]){var _0x573984=_[_0xe345('0x7d')](this[_0xe345('0x12')][_0xfcef7d[_0xe345('0x49')]]);_0x573984[_0xe345('0x8a')]=!![];_0x573984[_0xe345('0x83')]='COMPLETEDBYAGENT';logger[_0xe345('0x6a')](_0xe345('0x8b'),_0x573984[_0xe345('0x4c')],_0x573984[_0xe345('0x58')]);}}}catch(_0x1dd12b){logger[_0xe345('0x3c')](_0xe345('0x89'),_0xfcef7d[_0xe345('0x49')],util[_0xe345('0x3e')](_0x1dd12b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')][_0xe345('0x8c')]=function(_0x461181){try{if(this['isNotNull'](_0x461181)){logger[_0xe345('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x461181[_0xe345('0x49')],util['inspect'](_0x461181,{'showHidden':![],'depth':null}));if(this[_0xe345('0x12')][_0x461181[_0xe345('0x49')]]){var _0x43b74f=_[_0xe345('0x7d')](this['queueReports'][_0x461181[_0xe345('0x49')]]);_0x43b74f[_0xe345('0x1d')]=![];_0x43b74f['queuecallerabandonAt']=null;_0x43b74f[_0xe345('0x8d')]=!![];_0x43b74f[_0xe345('0x8e')]=_0x461181[_0xe345('0x8f')];_0x43b74f[_0xe345('0x7f')]=_0x461181[_0xe345('0x7f')];_0x43b74f['queuecallercomplete']=!![];_0x43b74f[_0xe345('0x90')]=![];_0x43b74f['queuecallerexitAt']=null;if(!_0x43b74f[_0xe345('0x91')]){if(_0x461181[_0xe345('0x92')]=='transfer'){_0x43b74f[_0xe345('0x83')]=_0xe345('0x93');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x43b74f[_0xe345('0x4c')],_0x43b74f['type']);}else{if(_[_0xe345('0x94')](_0x461181[_0xe345('0x38')]['toLowerCase'](),_0xe345('0x95'))){if(this['queueReports'][_0x461181[_0xe345('0x96')]]){var _0x10dacc=_[_0xe345('0x7d')](this[_0xe345('0x12')][_0x461181['linkedid']]);_0x10dacc[_0xe345('0x8a')]=![];_0x10dacc[_0xe345('0x90')]=!![];_0x10dacc[_0xe345('0x97')]=moment(_0x43b74f[_0xe345('0x98')])[_0xe345('0x99')](_0x461181[_0xe345('0x7f')],'seconds')[_0xe345('0x4a')](_0xe345('0x82'));_0x10dacc['queuecallerexitreason']=_0xe345('0x9a');_0x10dacc[_0xe345('0x91')]=!![];_0x10dacc[_0xe345('0x9b')]=_0xe345('0x9c');_0x10dacc[_0xe345('0x9d')]=_0x461181[_0xe345('0x9e')];_0x10dacc['transferuniqueid']=_0x461181['uniqueid'];logger[_0xe345('0x6a')](_0xe345('0x9f'),_0x10dacc['name'],_0x10dacc['type']);var _0x4dc584=this[_0xe345('0x12')][_0x461181[_0xe345('0x96')]];this[_0xe345('0x12')][_0x461181[_0xe345('0x96')]]=this[_0xe345('0x12')][_0x461181[_0xe345('0x49')]];this[_0xe345('0x12')][_0x461181[_0xe345('0x49')]]=_0x4dc584;}}else{_0x43b74f[_0xe345('0x83')]=_0xe345('0xa0')+_0x461181[_0xe345('0x92')][_0xe345('0xa1')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x43b74f['name'],_0x43b74f[_0xe345('0x58')],_0x43b74f['queuecallerexitreason']);}}}this[_0xe345('0x14')][_0x461181['uniqueid']]=_0x43b74f;this['emitVoiceQueueChannelRemove'](_0x43b74f,_0xe345('0xa2'));}}}catch(_0x54526e){logger[_0xe345('0x3c')](_0xe345('0xa3'),_0x461181['uniqueid'],util['inspect'](_0x54526e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe345('0xd')][_0xe345('0xa4')]=function(_0x335d65){try{if(this[_0xe345('0x62')](_0x335d65)){logger[_0xe345('0x46')](_0xe345('0xa5'),_0x335d65[_0xe345('0x49')],util[_0xe345('0x3e')](_0x335d65,{'showHidden':![],'depth':null}));this[_0xe345('0xa6')](_0x335d65['uniqueid'],_[_0xe345('0x7a')](_0x335d65[_0xe345('0xa7')])[0x0],_0x335d65['value']);if(this['queueReports'][_0x335d65[_0xe345('0x49')]]){var _0x4a6b47=_['last'](this[_0xe345('0x12')][_0x335d65[_0xe345('0x49')]]);if(_0x4a6b47){if(this[_0xe345('0x62')](_0x335d65[_0xe345('0xa7')])&&this['isNotNull'](_0x335d65[_0xe345('0xa7')]['queuestatus'])){switch(_0x335d65[_0xe345('0xa8')]){case _0xe345('0xa9'):_0x4a6b47['queuecallerexit']=![];_0x4a6b47[_0xe345('0x97')]=null;break;case _0xe345('0xaa'):_0x4a6b47[_0xe345('0xab')]=_0xe345('0xac');_0x4a6b47[_0xe345('0x90')]=!![];_0x4a6b47[_0xe345('0x97')]=moment()[_0xe345('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a6b47[_0xe345('0xad')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));logger[_0xe345('0x46')](_0xe345('0xae'),_0x335d65[_0xe345('0x49')],util['inspect'](_0x4a6b47,{'showHidden':![],'depth':null}));ami[_0xe345('0x44')](_0xe345('0xaf'),_0x4a6b47);break;default:_0x4a6b47['queuecallerexit']=!![];_0x4a6b47[_0xe345('0x97')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));_0x4a6b47[_0xe345('0xad')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));}_0x4a6b47['queuecallerabandon']=![];_0x4a6b47['queuecallerabandonAt']=null;_0x4a6b47[_0xe345('0x83')]=_0x335d65[_0xe345('0xa8')];this[_0xe345('0x14')][_0x335d65[_0xe345('0x49')]]=_0x4a6b47;this[_0xe345('0x4d')](_0x4a6b47,'varset');}else if(this[_0xe345('0x62')](_0x335d65[_0xe345('0xa7')])&&this[_0xe345('0x62')](_0x335d65[_0xe345('0xa7')][_0xe345('0xb0')])){if(!_0x4a6b47[_0xe345('0x1d')]){_0x4a6b47[_0xe345('0x90')]=!![];_0x4a6b47[_0xe345('0x97')]=moment()[_0xe345('0x4a')](_0xe345('0x82'));_0x4a6b47['queuecallerexitreason']=_0xe345('0xb1');_0x4a6b47[_0xe345('0xad')]=moment()[_0xe345('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe345('0x14')][_0x335d65[_0xe345('0x49')]]=_0x4a6b47;}}logger['info'](_0xe345('0xb2'),_0x335d65[_0xe345('0x49')],_0x4a6b47[_0xe345('0x4c')],_0x4a6b47[_0xe345('0x58')],_['keys'](_0x335d65[_0xe345('0xa7')])[0x0],_0x335d65['value']);_0x4a6b47['variables']=this[_0xe345('0x40')][_0x335d65[_0xe345('0x49')]];}}}}catch(_0x5b9b97){logger[_0xe345('0x3c')](_0xe345('0xa5'),_0x335d65[_0xe345('0x49')],util[_0xe345('0x3e')](_0x5b9b97,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe345('0xa6')]=function(_0x3c36c6,_0x34098f,_0x3251f8){var _0x23418e=[_0xe345('0xb3'),'rtpaudioqosbridged',_0xe345('0xb4'),_0xe345('0xb5'),_0xe345('0xb6'),_0xe345('0xb7'),_0xe345('0xb8'),_0xe345('0xb9'),_0xe345('0xba'),_0xe345('0xbb'),_0xe345('0xbc'),'bridgepvtcallid','membercalls',_0xe345('0xbd'),_0xe345('0xbe'),_0xe345('0xbf'),_0xe345('0x8f'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x34098f)&&!_[_0xe345('0xc0')](_0x23418e,_0x34098f)){if(_[_0xe345('0x73')](this[_0xe345('0x40')][_0x3c36c6])){this[_0xe345('0x40')][_0x3c36c6]={};}this[_0xe345('0x40')][_0x3c36c6][_0x34098f]=_0x3251f8;}};VoiceQueueReport['prototype'][_0xe345('0xc1')]=function(_0x536270){try{if(this['isNotNull'](_0x536270)){logger[_0xe345('0x46')]('[%s][voiceQueueReport][hangup]',_0x536270[_0xe345('0x49')],util[_0xe345('0x3e')](_0x536270,{'showHidden':![],'depth':null}));if(this[_0xe345('0x12')][_0x536270['uniqueid']]){for(var _0x58024a=0x0,_0x5ce9ae={};_0x58024a=0x0?moment(_0x396294['endtime'])[_0x0d2a('0xd')](_0x396294[_0x0d2a('0x18')],'seconds'):null,'data1':_0x0d2a('0x1a'),'data2':_0x396294[_0x0d2a('0x13')],'data3':_0x396294[_0x0d2a('0x10')],'data4':_0x396294[_0x0d2a('0x1b')]||null,'role':_0x0d2a('0x12'),'internal':_0x396294[_0x0d2a('0x13')]?_[_0x0d2a('0x1c')](_0x396294[_0x0d2a('0x13')]):undefined,'uniqueid':_0x396294[_0x0d2a('0x1d')]},'log':_0x0d2a('0x15')});}; \ No newline at end of file +var _0xc03a=['seconds','calleridnum','exten','queue','agent','accountcode','uniqueid','Request','membername','endtime','starttime','outbound','dialstring','toNumber','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff'];(function(_0x24c3f7,_0x45dd70){var _0x5a7a9c=function(_0x5d24fb){while(--_0x5d24fb){_0x24c3f7['push'](_0x24c3f7['shift']());}};_0x5a7a9c(++_0x45dd70);}(_0xc03a,0x1d0));var _0xac03=function(_0x539849,_0x4030df){_0x539849=_0x539849-0x0;var _0x5f6894=_0xc03a[_0x539849];return _0x5f6894;};'use strict';var moment=require(_0xac03('0x0'));var _=require(_0xac03('0x1'));var util=require(_0xac03('0x2'));var client=require('../client');exports[_0xac03('0x3')]=function(_0x34c4b2){var _0x2565c9=_0x34c4b2[_0xac03('0x4')]||_0x34c4b2[_0xac03('0x5')];return client['Request'](_0xac03('0x6'),{'body':{'channel':_0xac03('0x7'),'membername':_0x34c4b2[_0xac03('0x8')],'interface':_[_0xac03('0x9')](_0x34c4b2[_0xac03('0xa')])?util[_0xac03('0xb')](_0xac03('0xc'),_0x34c4b2[_0xac03('0x8')]):_0x34c4b2[_0xac03('0xa')],'type':_0xac03('0xd'),'enterAt':_0x34c4b2[_0xac03('0xe')],'exitAt':_0x2565c9,'duration':moment(_0x2565c9)[_0xac03('0xf')](_0x34c4b2[_0xac03('0xe')],_0xac03('0x10')),'data1':'inbound','data2':_0x34c4b2[_0xac03('0x11')],'data3':_0x34c4b2[_0xac03('0x12')],'data4':null,'data5':_0x34c4b2[_0xac03('0x13')],'role':_0xac03('0x14'),'internal':_0x34c4b2[_0xac03('0x15')]?_['toNumber'](_0x34c4b2[_0xac03('0x15')]):undefined,'uniqueid':_0x34c4b2[_0xac03('0x16')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x4f1b91){return client[_0xac03('0x17')](_0xac03('0x6'),{'body':{'channel':_0xac03('0x7'),'membername':_0x4f1b91[_0xac03('0x18')],'interface':_0x4f1b91[_0xac03('0xa')],'type':_0xac03('0xd'),'enterAt':_0x4f1b91['starttime'],'exitAt':_0x4f1b91[_0xac03('0x19')],'duration':moment(_0x4f1b91[_0xac03('0x19')])['diff'](_0x4f1b91[_0xac03('0x1a')],'seconds')>=0x0?moment(_0x4f1b91[_0xac03('0x19')])['diff'](_0x4f1b91[_0xac03('0x1a')],'seconds'):null,'data1':_0xac03('0x1b'),'data2':_0x4f1b91[_0xac03('0x15')],'data3':_0x4f1b91[_0xac03('0x12')],'data4':_0x4f1b91[_0xac03('0x1c')]||null,'role':'agent','internal':_0x4f1b91[_0xac03('0x15')]?_[_0xac03('0x1d')](_0x4f1b91[_0xac03('0x15')]):undefined,'uniqueid':_0x4f1b91[_0xac03('0x16')]},'log':_0xac03('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 59d23f9..816b9f3 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 _0x0e24=['stopRecordingOnTransfer','GetSettings','Request','ShowSetting'];(function(_0x254c9e,_0xab8a1b){var _0x2d4cb6=function(_0x15b027){while(--_0x15b027){_0x254c9e['push'](_0x254c9e['shift']());}};_0x2d4cb6(++_0xab8a1b);}(_0x0e24,0x1da));var _0x40e2=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x0e24[_0x2fc012];return _0x2891f9;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x40e2('0x0')](_0x40e2('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x40e2('0x2')]},'log':_0x40e2('0x3')});}; \ No newline at end of file +var _0x4f73=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x153709,_0x46f123){var _0x27189f=function(_0x358457){while(--_0x358457){_0x153709['push'](_0x153709['shift']());}};_0x27189f(++_0x46f123);}(_0x4f73,0x10f));var _0x34f7=function(_0x2df84d,_0x56d874){_0x2df84d=_0x2df84d-0x0;var _0x2634ce=_0x4f73[_0x2df84d];return _0x2634ce;};'use strict';var client=require(_0x34f7('0x0'));exports[_0x34f7('0x1')]=function(){return client[_0x34f7('0x2')](_0x34f7('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x34f7('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 90b1d4f..90dcaaf 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 _0x0797=['Request','GetTemplate','html','../client','getTemplates'];(function(_0x19c1f0,_0x6f0f9){var _0x10c752=function(_0x297db5){while(--_0x297db5){_0x19c1f0['push'](_0x19c1f0['shift']());}};_0x10c752(++_0x6f0f9);}(_0x0797,0x18e));var _0x7079=function(_0xec6471,_0xe67dcd){_0xec6471=_0xec6471-0x0;var _0x52c382=_0x0797[_0xec6471];return _0x52c382;};'use strict';var client=require(_0x7079('0x0'));exports[_0x7079('0x1')]=function(_0x2d54c4){return function(_0x2a0d0c){return client[_0x7079('0x2')](_0x7079('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x7079('0x4')]},'log':_0x7079('0x3')});};}; \ No newline at end of file +var _0xfc04=['Request','GetTemplate','name','html','../client'];(function(_0x4b79fa,_0x1f7e3a){var _0x5e44f9=function(_0x5e5c13){while(--_0x5e5c13){_0x4b79fa['push'](_0x4b79fa['shift']());}};_0x5e44f9(++_0x1f7e3a);}(_0xfc04,0xa4));var _0x4fc0=function(_0x46fcdf,_0x34eb1e){_0x46fcdf=_0x46fcdf-0x0;var _0x59d382=_0xfc04[_0x46fcdf];return _0x59d382;};'use strict';var client=require(_0x4fc0('0x0'));exports['getTemplates']=function(_0x1a0d48){return function(_0x948b07){return client[_0x4fc0('0x1')](_0x4fc0('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4fc0('0x3'),_0x4fc0('0x4')]},'log':_0x4fc0('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 31d0c1e..567e5d3 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 _0x238d=['AllConditions','field','operator','value','AnyConditions','Actions','action','data1','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','status','Condition'];(function(_0x14f795,_0x231e4a){var _0x14ef66=function(_0x3b4f58){while(--_0x3b4f58){_0x14f795['push'](_0x14f795['shift']());}};_0x14ef66(++_0x231e4a);}(_0x238d,0xf1));var _0xd238=function(_0x416b87,_0x3519fc){_0x416b87=_0x416b87-0x0;var _0x141655=_0x238d[_0x416b87];return _0x141655;};'use strict';var client=require(_0xd238('0x0'));exports[_0xd238('0x1')]=function(_0x3c4832){return function(_0xc435f9){return client['Request'](_0xd238('0x2'),{'options':{'raw':![],'attributes':['id',_0xd238('0x3'),'channel',_0xd238('0x4')],'include':[{'model':_0xd238('0x5'),'as':_0xd238('0x6'),'attributes':['id',_0xd238('0x7'),_0xd238('0x8'),_0xd238('0x9')]},{'model':_0xd238('0x5'),'as':_0xd238('0xa'),'attributes':['id',_0xd238('0x7'),'operator','value']},{'model':'Action','as':_0xd238('0xb'),'attributes':['id',_0xd238('0xc'),_0xd238('0xd'),'data2',_0xd238('0xe'),_0xd238('0xf'),_0xd238('0x10'),_0xd238('0x11'),_0xd238('0x12')]}]},'log':_0xd238('0x2')});};}; \ No newline at end of file +var _0x6403=['action','data2','data3','data4','data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','Action'];(function(_0x112cf5,_0x13b967){var _0x35e435=function(_0x1bd84c){while(--_0x1bd84c){_0x112cf5['push'](_0x112cf5['shift']());}};_0x35e435(++_0x13b967);}(_0x6403,0x183));var _0x3640=function(_0x47c14e,_0x1a1d69){_0x47c14e=_0x47c14e-0x0;var _0x402c21=_0x6403[_0x47c14e];return _0x402c21;};'use strict';var client=require('../client');exports[_0x3640('0x0')]=function(_0x42c026){return function(_0x114d04){return client[_0x3640('0x1')](_0x3640('0x2'),{'options':{'raw':![],'attributes':['id',_0x3640('0x3'),_0x3640('0x4'),_0x3640('0x5')],'include':[{'model':_0x3640('0x6'),'as':_0x3640('0x7'),'attributes':['id',_0x3640('0x8'),_0x3640('0x9'),_0x3640('0xa')]},{'model':_0x3640('0x6'),'as':'AnyConditions','attributes':['id',_0x3640('0x8'),'operator',_0x3640('0xa')]},{'model':_0x3640('0xb'),'as':'Actions','attributes':['id',_0x3640('0xc'),'data1',_0x3640('0xd'),_0x3640('0xe'),_0x3640('0xf'),_0x3640('0x10'),_0x3640('0x11'),_0x3640('0x12')]}]},'log':_0x3640('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 711e1eb..04daa00 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 _0x20a9=['Request','GetTrunk','name','registry','defaultuser'];(function(_0x197842,_0x46aa4e){var _0x24c4da=function(_0x3cae57){while(--_0x3cae57){_0x197842['push'](_0x197842['shift']());}};_0x24c4da(++_0x46aa4e);}(_0x20a9,0x113));var _0x920a=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x20a9[_0x484c03];return _0x294127;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x215eba){return function(_0x2cf560){return client[_0x920a('0x0')](_0x920a('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x920a('0x2'),_0x920a('0x3'),_0x920a('0x4')]},'log':_0x920a('0x1')});};}; \ No newline at end of file +var _0x0704=['../client','Request','GetTrunk','name','registry','defaultuser'];(function(_0x440cfa,_0x270522){var _0x549252=function(_0x29d49f){while(--_0x29d49f){_0x440cfa['push'](_0x440cfa['shift']());}};_0x549252(++_0x270522);}(_0x0704,0x1c2));var _0x4070=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x0704[_0x31295c];return _0x2c150e;};'use strict';var client=require(_0x4070('0x0'));exports['getTrunks']=function(_0x3cf340){return function(_0x2bb9df){return client[_0x4070('0x1')](_0x4070('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4070('0x3'),_0x4070('0x4'),_0x4070('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index db798c9..a403000 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe706,0xa3));var _0x6e70=function(_0x3c66e5,_0xab5ea3){_0x3c66e5=_0x3c66e5-0x0;var _0x678a=_0xe706[_0x3c66e5];return _0x678a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 717d7f9..b3ff446 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 _0x44fd=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x33e6b4,_0xb7545d){var _0x5be345=function(_0x2ef9f9){while(--_0x2ef9f9){_0x33e6b4['push'](_0x33e6b4['shift']());}};_0x5be345(++_0xb7545d);}(_0x44fd,0x1a6));var _0xd44f=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x44fd[_0x5216e0];return _0x5b3f40;};'use strict';var client=require(_0xd44f('0x0'));exports[_0xd44f('0x1')]=function(_0x286647){return client[_0xd44f('0x2')]('CreateVoiceAgentReport',{'body':_0x286647,'log':_0xd44f('0x3')});};exports[_0xd44f('0x4')]=function(_0x191cd5,_0x2c914c,_0x151de3){return client[_0xd44f('0x2')](_0xd44f('0x5'),{'body':_0x191cd5,'options':{'where':{'uniqueid':_0x2c914c,'interface':_0x151de3,'agentcomplete':!![]}},'log':_0xd44f('0x5')});}; \ No newline at end of file +var _0x49f9=['../client','create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x7249d0,_0x445380){var _0x1740a4=function(_0x73c328){while(--_0x73c328){_0x7249d0['push'](_0x7249d0['shift']());}};_0x1740a4(++_0x445380);}(_0x49f9,0x90));var _0x949f=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x49f9[_0x2b91c5];return _0xbd5531;};'use strict';var client=require(_0x949f('0x0'));exports[_0x949f('0x1')]=function(_0x6c8157){return client['Request'](_0x949f('0x2'),{'body':_0x6c8157,'log':_0x949f('0x2')});};exports[_0x949f('0x3')]=function(_0x5e3d3e,_0x375bf3,_0x506cf2){return client[_0x949f('0x4')]('UpdateVoiceAgentReport',{'body':_0x5e3d3e,'options':{'where':{'uniqueid':_0x375bf3,'interface':_0x506cf2,'agentcomplete':!![]}},'log':_0x949f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7c8293f..ade7a10 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 _0xb001=['duration','billableseconds','GetVoiceCallReports','util','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition'];(function(_0x3b05b1,_0x16c732){var _0x20615e=function(_0x4daf72){while(--_0x4daf72){_0x3b05b1['push'](_0x3b05b1['shift']());}};_0x20615e(++_0x16c732);}(_0xb001,0x17d));var _0x1b00=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xb001[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require('moment');var util=require(_0x1b00('0x0'));var _=require('lodash');var client=require(_0x1b00('0x1'));exports[_0x1b00('0x2')]=function(_0x1d3cda){return client[_0x1b00('0x3')]('CreateVoiceCallReport',{'body':_[_0x1b00('0x4')](_0x1d3cda,{'source':_0x1d3cda[_0x1b00('0x5')],'destinationcontext':_0x1d3cda[_0x1b00('0x6')],'callerid':_0x1d3cda[_0x1b00('0x7')],'amaflags':_0x1b00('0x8')}),'log':_0x1b00('0x9')});};exports[_0x1b00('0xa')]=function(){return function(){return client['Request'](_0x1b00('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x1b00('0xc'))[_0x1b00('0xd')](_0x1b00('0xe')),moment()[_0x1b00('0xf')](_0x1b00('0xc'))[_0x1b00('0xd')](_0x1b00('0xe'))]}},'attributes':[_0x1b00('0x10'),_0x1b00('0x11'),_0x1b00('0x12'),_0x1b00('0x13')]},'log':_0x1b00('0x14')});};}; \ No newline at end of file +var _0xc5b1=['moment','lodash','Request','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0xc5b1,0x1c0));var _0x1c5b=function(_0x5177de,_0x214996){_0x5177de=_0x5177de-0x0;var _0x3b06e5=_0xc5b1[_0x5177de];return _0x3b06e5;};'use strict';var moment=require(_0x1c5b('0x0'));var util=require('util');var _=require(_0x1c5b('0x1'));var client=require('../client');exports['create']=function(_0x4309a1){return client[_0x1c5b('0x2')](_0x1c5b('0x3'),{'body':_[_0x1c5b('0x4')](_0x4309a1,{'source':_0x4309a1[_0x1c5b('0x5')],'destinationcontext':_0x4309a1['context'],'callerid':_0x4309a1['callerid'],'amaflags':_0x1c5b('0x6')}),'log':_0x1c5b('0x3')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x1c5b('0x2')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x1c5b('0x7')],'createdAt':{'$between':[moment()[_0x1c5b('0x8')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x1c5b('0x9')](_0x1c5b('0xa'))]}},'attributes':[_0x1c5b('0xb'),_0x1c5b('0xc'),_0x1c5b('0xd'),_0x1c5b('0xe')]},'log':_0x1c5b('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 195c3aa..f87434c 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 _0x90a8=['create','Request','CreateVoiceDialReport','../client'];(function(_0x34d81e,_0x320e35){var _0x10950a=function(_0x11e0a4){while(--_0x11e0a4){_0x34d81e['push'](_0x34d81e['shift']());}};_0x10950a(++_0x320e35);}(_0x90a8,0x9b));var _0x890a=function(_0x1cda47,_0x14fd67){_0x1cda47=_0x1cda47-0x0;var _0x7b78e9=_0x90a8[_0x1cda47];return _0x7b78e9;};'use strict';var client=require(_0x890a('0x0'));exports[_0x890a('0x1')]=function(_0x46a672){return client[_0x890a('0x2')]('CreateVoiceDialReport',{'body':_0x46a672,'log':_0x890a('0x3')});}; \ No newline at end of file +var _0x49ce=['create','Request','../client'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x49ce,0xfb));var _0xe49c=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x49ce[_0x8a7e38];return _0x228609;};'use strict';var client=require(_0xe49c('0x0'));exports[_0xe49c('0x1')]=function(_0x35171c){return client[_0xe49c('0x2')]('CreateVoiceDialReport',{'body':_0x35171c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index c4a6182..0b86f5f 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 _0x3667=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x27c499,_0x4a691e){var _0x5a2543=function(_0x10cd1b){while(--_0x10cd1b){_0x27c499['push'](_0x27c499['shift']());}};_0x5a2543(++_0x4a691e);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7366('0x0'));exports[_0x7366('0x1')]=function(){return function(){return client[_0x7366('0x2')](_0x7366('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7366('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x7366('0x1')});};}; \ No newline at end of file +var _0x7dc2=['recordingFormat','Request','GetVoiceExtension','exten'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x27dc('0x0')](_0x27dc('0x1'),{'options':{'raw':!![],'attributes':['id',_0x27dc('0x2'),_0x27dc('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 00b4530..de7caee 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 _0xfb87=['dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x3d00c6,_0x21501e){var _0x1d628f=function(_0x512969){while(--_0x512969){_0x3d00c6['push'](_0x3d00c6['shift']());}};_0x1d628f(++_0x21501e);}(_0xfb87,0x192));var _0x7fb8=function(_0x132a9a,_0x4da489){_0x132a9a=_0x132a9a-0x0;var _0x9dd201=_0xfb87[_0x132a9a];return _0x9dd201;};'use strict';var client=require(_0x7fb8('0x0'));exports[_0x7fb8('0x1')]=function(){return function(){return client[_0x7fb8('0x2')](_0x7fb8('0x3'),{'options':{'raw':![],'attributes':['id',_0x7fb8('0x4'),_0x7fb8('0x5'),_0x7fb8('0x6'),_0x7fb8('0x7'),_0x7fb8('0x8'),_0x7fb8('0x9'),_0x7fb8('0xa'),_0x7fb8('0xb'),_0x7fb8('0xc'),_0x7fb8('0xd'),'dialPowerLevel',_0x7fb8('0xe'),_0x7fb8('0xf'),_0x7fb8('0x10'),_0x7fb8('0x11'),_0x7fb8('0x12'),_0x7fb8('0x13'),_0x7fb8('0x14'),'dialQueueTimeout','dialQueueProject',_0x7fb8('0x15'),_0x7fb8('0x16'),_0x7fb8('0x17'),_0x7fb8('0x18'),_0x7fb8('0x19'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x7fb8('0x1a'),'dialGlobalInterval',_0x7fb8('0x1b'),_0x7fb8('0x1c'),'dialAMDActive',_0x7fb8('0x1d'),_0x7fb8('0x1e'),_0x7fb8('0x1f'),_0x7fb8('0x20'),_0x7fb8('0x21'),'dialAMDBetweenWordsSilence',_0x7fb8('0x22'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x7fb8('0x23'),_0x7fb8('0x24'),_0x7fb8('0x25'),_0x7fb8('0x26'),_0x7fb8('0x27'),_0x7fb8('0x28'),_0x7fb8('0x29'),_0x7fb8('0x8'),_0x7fb8('0x2a'),_0x7fb8('0x2b'),_0x7fb8('0x2c'),_0x7fb8('0x2d'),_0x7fb8('0x2e'),'dialDropMaxRetry',_0x7fb8('0x2f'),_0x7fb8('0x30'),_0x7fb8('0x31'),_0x7fb8('0x32'),_0x7fb8('0x33'),_0x7fb8('0x34'),_0x7fb8('0x35'),'mandatoryDisposition',_0x7fb8('0x36'),_0x7fb8('0x37')],'include':[{'model':_0x7fb8('0x38'),'as':_0x7fb8('0x38'),'attributes':['id','name',_0x7fb8('0x39'),_0x7fb8('0x3a')]},{'model':_0x7fb8('0x3b'),'as':_0x7fb8('0x3c'),'attributes':['id','name']},{'model':'Trunk','as':_0x7fb8('0x3d'),'attributes':['id',_0x7fb8('0x4'),_0x7fb8('0x39'),_0x7fb8('0x3a')]},{'model':_0x7fb8('0x3e'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x7fb8('0x3e'),'as':_0x7fb8('0x3f'),'attributes':['id',_0x7fb8('0x4'),_0x7fb8('0x40')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x930d=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0x930d,0x17b));var _0xd930=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x930d[_0x5a7d5f];return _0x5dcded;};'use strict';var client=require(_0xd930('0x0'));exports[_0xd930('0x1')]=function(){return function(){return client[_0xd930('0x2')](_0xd930('0x3'),{'options':{'raw':![],'attributes':['id',_0xd930('0x4'),_0xd930('0x5'),_0xd930('0x6'),_0xd930('0x7'),'monitor_format',_0xd930('0x8'),_0xd930('0x9'),_0xd930('0xa'),_0xd930('0xb'),_0xd930('0xc'),_0xd930('0xd'),_0xd930('0xe'),_0xd930('0xf'),'dialPredictiveInterval',_0xd930('0x10'),'dialOriginateCallerIdNumber',_0xd930('0x11'),'dialQueueOptions',_0xd930('0x12'),'dialQueueProject',_0xd930('0x13'),_0xd930('0x14'),'dialBusyMaxRetry',_0xd930('0x15'),_0xd930('0x16'),_0xd930('0x17'),_0xd930('0x18'),_0xd930('0x19'),'dialGlobalInterval',_0xd930('0x1a'),_0xd930('0x1b'),_0xd930('0x1c'),_0xd930('0x1d'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0xd930('0x1e'),_0xd930('0x1f'),_0xd930('0x20'),_0xd930('0x21'),'dialAMDSilenceThreshold',_0xd930('0x22'),'timeout',_0xd930('0x23'),'dialRecallInQueue',_0xd930('0x24'),'dialAgiAfterHangupAgent',_0xd930('0x25'),'dialQueueProject2',_0xd930('0x26'),_0xd930('0x27'),_0xd930('0x28'),'dialCutDigit',_0xd930('0x29'),_0xd930('0x2a'),_0xd930('0x2b'),_0xd930('0x2c'),_0xd930('0x2d'),'dialAbandonedRetryFrequency',_0xd930('0x2e'),_0xd930('0x2f'),_0xd930('0x30'),_0xd930('0x31'),_0xd930('0x32'),_0xd930('0x33'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0xd930('0x34'),'attributes':['id',_0xd930('0x4'),_0xd930('0x35'),_0xd930('0x36')]},{'model':_0xd930('0x37'),'as':_0xd930('0x38'),'attributes':['id','name']},{'model':_0xd930('0x34'),'as':_0xd930('0x39'),'attributes':['id',_0xd930('0x4'),_0xd930('0x35'),_0xd930('0x36')]},{'model':_0xd930('0x3a'),'as':_0xd930('0x3a'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xd930('0x3b'),'attributes':['id','name',_0xd930('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 46c1721..d572b4a 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x419f64,_0x254a65){var _0x1efb78=function(_0x582672){while(--_0x582672){_0x419f64['push'](_0x419f64['shift']());}};_0x1efb78(++_0x254a65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x571efe,_0x52f2dc){var _0x30d78a=function(_0x14afb0){while(--_0x14afb0){_0x571efe['push'](_0x571efe['shift']());}};_0x30d78a(++_0x52f2dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index eceddb6..f41a822 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 _0x1bfe=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x2e9bd1,_0x5a2573){var _0x22b053=function(_0x1821cf){while(--_0x1821cf){_0x2e9bd1['push'](_0x2e9bd1['shift']());}};_0x22b053(++_0x5a2573);}(_0x1bfe,0x89));var _0xe1bf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1bfe[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0xe1bf('0x0'));exports['getVoiceQueueRtPauses']=function(_0x7d4e72){return function(){return client['Request'](_0xe1bf('0x1'),{'options':{'where':{'VoiceQueueId':_0x7d4e72,'paused':!![]},'raw':!![]},'log':_0xe1bf('0x2')});};}; \ No newline at end of file +var _0xd20f=['Request','getVoiceQueueRtPauses','../client'];(function(_0x4a6b91,_0xd051af){var _0x4042c1=function(_0x5bcc93){while(--_0x5bcc93){_0x4a6b91['push'](_0x4a6b91['shift']());}};_0x4042c1(++_0xd051af);}(_0xd20f,0x16d));var _0xfd20=function(_0x2b7ee8,_0x3c47ad){_0x2b7ee8=_0x2b7ee8-0x0;var _0x3ee824=_0xd20f[_0x2b7ee8];return _0x3ee824;};'use strict';var client=require(_0xfd20('0x0'));exports['getVoiceQueueRtPauses']=function(_0x527b8a){return function(){return client[_0xfd20('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x527b8a,'paused':!![]},'raw':!![]},'log':_0xfd20('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 8229544..0593510 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3f47ab,_0x2dad20){var _0x17e9ee=function(_0x1613b4){while(--_0x1613b4){_0x3f47ab['push'](_0x3f47ab['shift']());}};_0x17e9ee(++_0x2dad20);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3f1265,_0x2cb6fb){var _0x58b288=function(_0x5add75){while(--_0x5add75){_0x3f1265['push'](_0x3f1265['shift']());}};_0x58b288(++_0x2cb6fb);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 119d823..c23a9ed 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 _0xee1e=['origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereecalleridnum','transfereeconnectedlinenum','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xee1e,0x123));var _0xeee1=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0xee1e[_0x522ae8];return _0x3189b9;};'use strict';var client=require(_0xeee1('0x0'));exports[_0xeee1('0x1')]={};exports[_0xeee1('0x2')]=function(_0x467f32){return client['Request'](_0xeee1('0x3'),{'body':{'result':_0x467f32['result'],'transfererchannel':_0x467f32[_0xeee1('0x4')],'transferercalleridnum':_0x467f32[_0xeee1('0x5')],'transferercalleridname':_0x467f32[_0xeee1('0x6')],'transfererconnectedlinenum':_0x467f32[_0xeee1('0x7')],'transfererconnectedlinename':_0x467f32[_0xeee1('0x8')],'transfereraccountcode':_0x467f32[_0xeee1('0x9')],'transferercontext':_0x467f32['transferercontext'],'transfererexten':_0x467f32[_0xeee1('0xa')],'transfererlinkedid':_0x467f32['transfererlinkedid'],'transfereechannel':_0x467f32['transfereechannel'],'transfereecalleridnum':_0x467f32[_0xeee1('0xb')],'transfereecalleridname':_0x467f32['transfereecalleridname'],'transfereeconnectedlinenum':_0x467f32[_0xeee1('0xc')],'transfereeconnectedlinename':_0x467f32['transfereeconnectedlinename'],'transfereeaccountcode':_0x467f32['transfereeaccountcode'],'transfereecontext':_0x467f32[_0xeee1('0xd')],'transfereeexten':_0x467f32[_0xeee1('0xe')],'transfereelinkedid':_0x467f32['transfereelinkedid'],'isexternal':_0x467f32[_0xeee1('0xf')],'context':_0x467f32[_0xeee1('0x10')],'extension':_0x467f32[_0xeee1('0x11')],'type':_0xeee1('0x12')},'log':_0xeee1('0x3')});};exports[_0xeee1('0x13')]=function(_0x824b3b){return client[_0xeee1('0x14')](_0xeee1('0x3'),{'body':{'result':_0x824b3b[_0xeee1('0x15')],'transfererchannel':_0x824b3b[_0xeee1('0x16')],'transferercalleridnum':_0x824b3b[_0xeee1('0x17')],'transferercalleridname':_0x824b3b[_0xeee1('0x18')],'transfererconnectedlinenum':_0x824b3b[_0xeee1('0x19')],'transfererconnectedlinename':_0x824b3b[_0xeee1('0x1a')],'transfereraccountcode':_0x824b3b[_0xeee1('0x1b')],'transferercontext':_0x824b3b['secondtransferercontext'],'transfererexten':_0x824b3b[_0xeee1('0x1c')],'transfererlinkedid':_0x824b3b[_0xeee1('0x1d')],'transfereechannel':_0x824b3b[_0xeee1('0x1e')],'transfereecalleridnum':_0x824b3b[_0xeee1('0x1f')],'transfereecalleridname':_0x824b3b[_0xeee1('0x20')],'transfereeconnectedlinenum':_0x824b3b[_0xeee1('0x21')],'transfereeconnectedlinename':_0x824b3b['transfertargetconnectedlinename'],'transfereeaccountcode':_0x824b3b[_0xeee1('0x22')],'transfereecontext':_0x824b3b[_0xeee1('0x23')],'transfereeexten':_0x824b3b['transfertargetexten'],'transfereelinkedid':_0x824b3b[_0xeee1('0x24')],'isexternal':_0x824b3b[_0xeee1('0xf')],'context':_0x824b3b[_0xeee1('0x25')],'extension':_0x824b3b[_0xeee1('0x26')],'type':_0xeee1('0x27')},'log':_0xeee1('0x3')});}; \ No newline at end of file +var _0x9456=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','origtransfererchannel','origtransferercalleridname','origtransfererlinkedid'];(function(_0x30d1e8,_0x39d0c8){var _0x486c07=function(_0x3c51dd){while(--_0x3c51dd){_0x30d1e8['push'](_0x30d1e8['shift']());}};_0x486c07(++_0x39d0c8);}(_0x9456,0x71));var _0x6945=function(_0x579065,_0x1b9178){_0x579065=_0x579065-0x0;var _0x1c84bc=_0x9456[_0x579065];return _0x1c84bc;};'use strict';var client=require('../client');exports[_0x6945('0x0')]={};exports[_0x6945('0x1')]=function(_0x34940d){return client[_0x6945('0x2')](_0x6945('0x3'),{'body':{'result':_0x34940d[_0x6945('0x4')],'transfererchannel':_0x34940d[_0x6945('0x5')],'transferercalleridnum':_0x34940d[_0x6945('0x6')],'transferercalleridname':_0x34940d[_0x6945('0x7')],'transfererconnectedlinenum':_0x34940d[_0x6945('0x8')],'transfererconnectedlinename':_0x34940d[_0x6945('0x9')],'transfereraccountcode':_0x34940d[_0x6945('0xa')],'transferercontext':_0x34940d[_0x6945('0xb')],'transfererexten':_0x34940d[_0x6945('0xc')],'transfererlinkedid':_0x34940d[_0x6945('0xd')],'transfereechannel':_0x34940d['transfereechannel'],'transfereecalleridnum':_0x34940d[_0x6945('0xe')],'transfereecalleridname':_0x34940d[_0x6945('0xf')],'transfereeconnectedlinenum':_0x34940d[_0x6945('0x10')],'transfereeconnectedlinename':_0x34940d[_0x6945('0x11')],'transfereeaccountcode':_0x34940d['transfereeaccountcode'],'transfereecontext':_0x34940d[_0x6945('0x12')],'transfereeexten':_0x34940d[_0x6945('0x13')],'transfereelinkedid':_0x34940d[_0x6945('0x14')],'isexternal':_0x34940d[_0x6945('0x15')],'context':_0x34940d[_0x6945('0x16')],'extension':_0x34940d['extension'],'type':_0x6945('0x17')},'log':_0x6945('0x3')});};exports['attendedTransfer']=function(_0x27a095){return client['Request'](_0x6945('0x3'),{'body':{'result':_0x27a095[_0x6945('0x4')],'transfererchannel':_0x27a095[_0x6945('0x18')],'transferercalleridnum':_0x27a095['origtransferercalleridnum'],'transferercalleridname':_0x27a095[_0x6945('0x19')],'transfererconnectedlinenum':_0x27a095['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x27a095['secondtransfererconnectedlinename'],'transfereraccountcode':_0x27a095['origtransfereraccountcode'],'transferercontext':_0x27a095['secondtransferercontext'],'transfererexten':_0x27a095['secondtransfererexten'],'transfererlinkedid':_0x27a095[_0x6945('0x1a')],'transfereechannel':_0x27a095['transfertargetchannel'],'transfereecalleridnum':_0x27a095[_0x6945('0x1b')],'transfereecalleridname':_0x27a095[_0x6945('0x1c')],'transfereeconnectedlinenum':_0x27a095[_0x6945('0x1d')],'transfereeconnectedlinename':_0x27a095[_0x6945('0x1e')],'transfereeaccountcode':_0x27a095['transfertargetaccountcode'],'transfereecontext':_0x27a095[_0x6945('0x1f')],'transfereeexten':_0x27a095[_0x6945('0x20')],'transfereelinkedid':_0x27a095[_0x6945('0x21')],'isexternal':_0x27a095[_0x6945('0x15')],'context':_0x27a095['origtransferercontext'],'extension':_0x27a095['origtransfererexten'],'type':_0x6945('0x22')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 8416d89..61f6319 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 _0x1261=['predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','push','length','omit','undefined','channels','voicechannel','find','channel','filename','uniqueid','wav','MixMonitor','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','catch','map','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','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','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','pick','module','action','Reload','then','error','join','command','Action','content','message','voiceQueues','answered','available','pTalking','sumBillable','sumHoldTime','total','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1261,0x144));var _0x1126=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0x1261[_0x4bb94b];return _0x36dcc6;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var jayson=require(_0x1126('0x1'));var schema=require(_0x1126('0x2'));var BPromise=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var config=require(_0x1126('0x5'));var properties=require(_0x1126('0x6'));var ami=require(_0x1126('0x7'));exports[_0x1126('0x8')]=function(_0x75a851,_0x5a2189,_0x5c68c8){return new BPromise(function(_0x40ba58,_0x907180){var _0x4f239c={'QueuePause':function(_0x17e5f0){return new Promise(function(_0x28772d,_0x245be9){var _0x3abb0b=util[_0x1126('0x9')]('%s/%s',_0x1126('0xa'),_0x17e5f0[_0x1126('0xb')]);if(_0x75a851[_0x1126('0xc')]&&_0x75a851['timers'][_0x3abb0b]&&_0x75a851[_0x1126('0xc')][_0x3abb0b]['timer']){_0x75a851['timers'][_0x3abb0b][_0x1126('0xd')]();}if(_0x75a851['agents'][_0x3abb0b]){_0x75a851[_0x1126('0xe')][_0x3abb0b][_0x1126('0xf')]({'statePause':_0x17e5f0[_0x1126('0x10')]?!![]:![]});}_0x28772d({'code':0xc8,'message':_0x1126('0x11')});});},'Reload':function(_0xca0355){var _0x3f10e9=this;return new Promise(function(_0xd8ca42,_0x2048ad){if(ami[_0x1126('0x12')]()==![]){return _0x2048ad(_0x3f10e9['error'](0x1f4,[config['asterisk']['ip'],config[_0x1126('0x13')][_0x1126('0x14')],_0x1126('0x15')]['join']('\x20')));}_0xca0355=_[_0x1126('0x16')](_0xca0355,_['keys'](properties[_0x1126('0x17')]));_0xca0355[_0x1126('0x18')]=_0x1126('0x19');return ami['Action'](_0xca0355)[_0x1126('0x1a')](function(_0x1695f6){_0xd8ca42({'code':0xc8,'message':_0x1695f6['message']});})['catch'](function(_0x22ae0b){_0x2048ad(_0x3f10e9[_0x1126('0x1b')](0x1f5,_0x22ae0b['message']));});});},'Command':function(_0x548359){var _0x4564c0=this;return new Promise(function(_0x58b109,_0x22ed37){if(ami[_0x1126('0x12')]()==![]){return _0x22ed37(_0x4564c0[_0x1126('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0x1126('0x13')]['username'],'ami\x20disconnected'][_0x1126('0x1c')]('\x20')));}_0x548359=_[_0x1126('0x16')](_0x548359,_0x1126('0x1d'));_0x548359[_0x1126('0x18')]='Command';return ami[_0x1126('0x1e')](_0x548359)[_0x1126('0x1a')](function(_0x48a08d){_0x58b109({'code':0xc8,'message':_0x48a08d[_0x1126('0x1f')]});})['catch'](function(_0x529dd9){_0x22ed37(_0x4564c0['error'](0x1f5,_0x529dd9[_0x1126('0x20')]));});});},'VoiceQueues':function(_0x15bcc3){return new Promise(function(_0x329914,_0x34bcf1){var _0x566c09=[];for(var _0x1b07a7 in _0x75a851[_0x1126('0x21')]){if(_0x75a851[_0x1126('0x21')]['hasOwnProperty'](_0x1b07a7)){var _0x35eec3=_0x75a851[_0x1126('0x21')][_0x1b07a7];var _0xa293f4={'id':_0x35eec3['id'],'name':_0x35eec3['name'],'strategy':_0x35eec3['strategy'],'answered':_0x35eec3[_0x1126('0x22')],'available':_0x35eec3[_0x1126('0x23')],'loggedIn':_0x35eec3['loggedIn'],'pTalking':_0x35eec3[_0x1126('0x24')],'sumBillable':_0x35eec3[_0x1126('0x25')],'sumDuration':_0x35eec3['sumDuration'],'sumHoldTime':_0x35eec3[_0x1126('0x26')]||0x0,'talking':_0x35eec3['talking'],'total':_0x35eec3[_0x1126('0x27')],'type':_0x35eec3['type'],'unmanaged':_0x35eec3[_0x1126('0x28')],'abandoned':_0x35eec3['abandoned'],'waiting':_0x35eec3[_0x1126('0x29')],'loggedInDb':_0x35eec3['loggedInDb']};if(_0x35eec3['type']==='outbound'){_0xa293f4[_0x1126('0x2a')]=_0x35eec3[_0x1126('0x2a')];_0xa293f4[_0x1126('0x2b')]=_0x35eec3['dialMethod'];_0xa293f4[_0x1126('0x2c')]=_0x35eec3[_0x1126('0x2c')];_0xa293f4['dialOriginateCallerIdNumber']=_0x35eec3[_0x1126('0x2d')];_0xa293f4[_0x1126('0x2e')]=_0x35eec3[_0x1126('0x2e')];_0xa293f4[_0x1126('0x2f')]=_0x35eec3['dialPrefix'];_0xa293f4['temp']=_0x35eec3[_0x1126('0x30')];_0xa293f4[_0x1126('0x31')]=_0x35eec3[_0x1126('0x31')];_0xa293f4[_0x1126('0x32')]=_0x35eec3['outboundAnswerCallsDay'];_0xa293f4[_0x1126('0x33')]=_0x35eec3[_0x1126('0x33')];_0xa293f4[_0x1126('0x34')]=_0x35eec3[_0x1126('0x34')];_0xa293f4[_0x1126('0x35')]=_0x35eec3['outboundCongestionCallsDay'];_0xa293f4[_0x1126('0x36')]=_0x35eec3[_0x1126('0x36')];_0xa293f4[_0x1126('0x37')]=_0x35eec3[_0x1126('0x37')];_0xa293f4['outboundDropCallsDayTimeout']=_0x35eec3['outboundDropCallsDayTimeout'];_0xa293f4[_0x1126('0x38')]=_0x35eec3[_0x1126('0x38')];_0xa293f4['outboundNoSuchCallsDay']=_0x35eec3[_0x1126('0x39')];_0xa293f4[_0x1126('0x3a')]=_0x35eec3[_0x1126('0x3a')];_0xa293f4['outboundReCallsDay']=_0x35eec3['outboundReCallsDay'];_0xa293f4[_0x1126('0x3b')]=_0x35eec3[_0x1126('0x3b')];_0xa293f4[_0x1126('0x3c')]=_0x35eec3[_0x1126('0x3c')];_0xa293f4['predictiveIntervalAnsweredCalls']=_0x35eec3[_0x1126('0x3d')];_0xa293f4['predictiveIntervalAvgHoldtime']=_0x35eec3[_0x1126('0x3e')];_0xa293f4[_0x1126('0x3f')]=_0x35eec3[_0x1126('0x3f')];_0xa293f4[_0x1126('0x40')]=_0x35eec3[_0x1126('0x40')];_0xa293f4['predictiveIntervalDroppedCallsTimeout']=_0x35eec3[_0x1126('0x41')];_0xa293f4[_0x1126('0x42')]=_0x35eec3[_0x1126('0x42')];_0xa293f4[_0x1126('0x43')]=_0x35eec3[_0x1126('0x43')];_0xa293f4[_0x1126('0x44')]=_0x35eec3[_0x1126('0x44')];_0xa293f4['predictiveIntervalMultiplicativeFactor']=_0x35eec3[_0x1126('0x45')];_0xa293f4[_0x1126('0x46')]=_0x35eec3[_0x1126('0x46')];_0xa293f4[_0x1126('0x47')]=_0x35eec3[_0x1126('0x47')];_0xa293f4['predictiveIntervalTotalCalls']=_0x35eec3['predictiveIntervalTotalCalls'];_0xa293f4[_0x1126('0x20')]=_0x35eec3[_0x1126('0x20')];_0xa293f4[_0x1126('0x48')]=_0x35eec3[_0x1126('0x48')];_0xa293f4[_0x1126('0x49')]=_0x35eec3[_0x1126('0x49')];_0xa293f4['erlangCallToSecond']=_0x35eec3['erlangCallToSecond'];_0xa293f4['erlangAbandonmentRate']=_0x35eec3[_0x1126('0x4a')];_0xa293f4['erlangBusyFactor']=_0x35eec3[_0x1126('0x4b')];_0xa293f4[_0x1126('0x4c')]=_0x35eec3[_0x1126('0x4c')];_0xa293f4[_0x1126('0x4d')]=_0x35eec3['startProgressive'];}if(_0x35eec3['Trunk']){_0xa293f4[_0x1126('0x4e')]={'id':_0x35eec3[_0x1126('0x4e')]['id'],'name':_0x35eec3[_0x1126('0x4e')]['name'],'active':_0x35eec3[_0x1126('0x4e')]['active'],'callerid':_0x35eec3[_0x1126('0x4e')]['callerid']};}if(_0x35eec3[_0x1126('0x4f')]){_0xa293f4[_0x1126('0x4f')]={'id':_0x35eec3[_0x1126('0x4f')]['id'],'name':_0x35eec3['Interval'][_0x1126('0xb')]};}_0x566c09[_0x1126('0x50')](_0xa293f4);}}_0x329914({'count':_0x566c09[_0x1126('0x51')],'rows':_0x566c09});});},'UpdateVoiceQueue':function(_0x48c694){return new Promise(function(_0x58ff3a,_0x4dd7f5){var _0x6e78cf=_['find'](_0x75a851[_0x1126('0x21')],{'id':parseInt(_0x48c694['id'])});var _0x507568=_[_0x1126('0x52')](_0x48c694,['id']);if(_0x6e78cf){for(var _0x323499 in _0x507568){if(typeof _0x507568[_0x323499]!==_0x1126('0x53')&&typeof _0x6e78cf[_0x323499]!==_0x1126('0x53')){_0x6e78cf[_0x323499]=_0x507568[_0x323499];}}_0x58ff3a(_0x6e78cf);}else{_0x4dd7f5();}});},'VoiceChannels':function(_0xede3d8){return new Promise(function(_0x56732f,_0x198173){var _0x512f60=_['values'](_0x75a851[_0x1126('0x54')]);_0x56732f({'count':_0x512f60[_0x1126('0x51')],'rows':_0x512f60});});},'VoiceChannelMixMonitor':function(_0x575f79){var _0x5f6d73=this;return new Promise(function(_0x1ffa2b,_0x518e0a){if(ami[_0x1126('0x12')]()==![]){return _0x518e0a(_0x5f6d73[_0x1126('0x1b')](0x1f4,[config[_0x1126('0x13')]['ip'],config['asterisk'][_0x1126('0x14')],_0x1126('0x15')][_0x1126('0x1c')]('\x20')));}var _0x5878bb=schema(properties[_0x1126('0x55')])[_0x1126('0x2')](_0x575f79);if(_0x5878bb[_0x1126('0x51')]>0x0){return _0x518e0a(_0x5f6d73[_0x1126('0x1b')](0x1f4,_['map'](_0x5878bb,_0x1126('0x20'))['join'](',\x20')));}var _0x40168e=_[_0x1126('0x56')](_0x75a851['channels'],{'uniqueid':_0x575f79['uniqueid']});if(_0x40168e&&_0x40168e[_0x1126('0x57')]){var _0x3c1d16=util[_0x1126('0x9')]('%s.%s',_0x575f79[_0x1126('0x58')]||_0x575f79[_0x1126('0x59')],_0x575f79[_0x1126('0x9')]||_0x1126('0x5a'));return ami['Action']({'action':_0x1126('0x5b'),'channel':_0x40168e[_0x1126('0x57')],'file':_0x3c1d16,'options':'ai(mixmonitorid)'})['then'](function(_0x4abb4d){var _0x526b07=_[_0x1126('0x56')](_0x40168e[_0x1126('0x5c')],{'filename':'/var/spool/asterisk/monitor/'+_0x3c1d16[_0x1126('0x5d')]()});if(_[_0x1126('0x5e')](_0x526b07)){_0x40168e[_0x1126('0x5c')][_0x1126('0x50')]({'filename':_0x1126('0x5f')+_0x3c1d16['toLowerCase'](),'createdAt':moment()[_0x1126('0x9')](_0x1126('0x60')),'mixmonitorid':_0x4abb4d['mixmonitorid'],'status':_0x1126('0x61')});}else{_0x526b07[_0x1126('0x62')]=_0x4abb4d[_0x1126('0x62')];_0x526b07[_0x1126('0x63')]=_0x1126('0x61');}_0x1ffa2b({'code':0xc8,'message':[_0x575f79['uniqueid'],_0x1126('0x64'),_0x4abb4d['mixmonitorid']][_0x1126('0x1c')]('\x20'),'mixmonitorid':_0x4abb4d[_0x1126('0x62')]});})[_0x1126('0x65')](function(_0x590bc2){_0x518e0a(_0x5f6d73[_0x1126('0x1b')](0x1f5,[_0x575f79[_0x1126('0x59')],_0x590bc2['message'][_0x1126('0x5d')]()][_0x1126('0x1c')]('\x20')));});}else{return _0x518e0a(_0x5f6d73[_0x1126('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2fe6dc){var _0x3377db=this;return new Promise(function(_0x22ab18,_0x308ee4){if(ami[_0x1126('0x12')]()==![]){return _0x308ee4(_0x3377db[_0x1126('0x1b')](0x1f4,[config[_0x1126('0x13')]['ip'],config[_0x1126('0x13')]['username'],_0x1126('0x15')][_0x1126('0x1c')]('\x20')));}var _0xe8f195=schema(properties[_0x1126('0x55')])[_0x1126('0x2')](_0x2fe6dc);if(_0xe8f195['length']>0x0){return _0x308ee4(_0x3377db[_0x1126('0x1b')](0x1f4,_[_0x1126('0x66')](_0xe8f195,'message')[_0x1126('0x1c')](',\x20')));}var _0x5246aa=_[_0x1126('0x56')](_0x75a851[_0x1126('0x54')],{'uniqueid':_0x2fe6dc['uniqueid']});if(_0x5246aa){return BPromise[_0x1126('0x67')]()[_0x1126('0x1a')](function(){if(_0x5246aa[_0x1126('0x57')]){return ami['Action']({'action':_0x1126('0x68'),'channel':_0x5246aa['channel'],'mixmonitorid':_0x2fe6dc['mixmonitorid']})[_0x1126('0x65')](function(_0x40185f){});}})[_0x1126('0x1a')](function(){if(_0x5246aa[_0x1126('0x69')]){return ami[_0x1126('0x1e')]({'action':_0x1126('0x68'),'channel':_0x5246aa[_0x1126('0x69')],'mixmonitorid':_0x2fe6dc['mixmonitorid']})[_0x1126('0x65')](function(_0x43ec00){});}})[_0x1126('0x1a')](function(_0xc39c36){var _0x3f87aa=_[_0x1126('0x56')](_0x5246aa['monitors'],{'mixmonitorid':_0x2fe6dc['mixmonitorid']});if(_0x3f87aa){_0x3f87aa[_0x1126('0x63')]=_0x1126('0x6a');}})['then'](function(){var _0x5ee130=util['format']('%s.%s',_0x2fe6dc[_0x1126('0x58')]||_0x2fe6dc[_0x1126('0x59')],_0x2fe6dc[_0x1126('0x9')]||'wav');var _0x30e32f=_[_0x1126('0x56')](_0x5246aa[_0x1126('0x5c')],{'filename':_0x1126('0x5f')+_0x5ee130[_0x1126('0x5d')]()});if(_0x30e32f){_0x30e32f[_0x1126('0x63')]=_0x1126('0x6a');}})['then'](function(){_0x22ab18({'code':0xc8,'message':[_0x2fe6dc[_0x1126('0x59')],_0x1126('0x6b')][_0x1126('0x1c')]('\x20')});})[_0x1126('0x65')](function(_0x288b9b){_0x308ee4(_0x3377db['error'](0x1f5,[_0x2fe6dc['uniqueid'],_0x288b9b[_0x1126('0x20')][_0x1126('0x5d')]()]['join']('\x20')));});}else{return _0x308ee4(_0x3377db[_0x1126('0x1b')](0x1f5,_0x1126('0x6c')));}});},'VoiceQueuesChannels':function(_0x366675){return new Promise(function(_0x6a41c0,_0x2828d4){var _0x30d240=_[_0x1126('0x6d')](_0x75a851[_0x1126('0x6e')]);_0x6a41c0({'count':_0x30d240[_0x1126('0x51')],'rows':_0x30d240});});},'VoiceQueuesChannel':function(_0x3d5e15){var _0x16e48a=this;return new Promise(function(_0x1228cf,_0x3dad39){var _0x592005=schema(properties[_0x1126('0x6f')])[_0x1126('0x2')](_0x3d5e15);if(_0x592005[_0x1126('0x51')]>0x0){return _0x3dad39(_0x16e48a['error'](0x1f4,_['map'](_0x592005,_0x1126('0x20'))[_0x1126('0x1c')](',\x20')));}var _0x1998f2=_[_0x1126('0x56')](_0x75a851['queueChannels'],{'uniqueid':_0x3d5e15['uniqueid']});if(_0x1998f2){_0x1228cf(_0x1998f2);}else{return _0x3dad39(_0x16e48a['error'](0x1f5,_0x1126('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x1b355f){var _0x3693b9=this;return new Promise(function(_0xdedb8f,_0x54a72e){if(ami[_0x1126('0x12')]()==![]){return _0x54a72e(_0x3693b9['error'](0x1f4,[config[_0x1126('0x13')]['ip'],config[_0x1126('0x13')][_0x1126('0x14')],_0x1126('0x15')][_0x1126('0x1c')]('\x20')));}var _0x1e7c9a=schema(properties[_0x1126('0x70')])['validate'](_0x1b355f);if(_0x1e7c9a[_0x1126('0x51')]>0x0){return _0x54a72e(_0x3693b9['error'](0x1f4,_[_0x1126('0x66')](_0x1e7c9a,_0x1126('0x20'))['join'](',\x20')));}var _0x376175=_[_0x1126('0x56')](_0x75a851['queueChannels'],{'uniqueid':_0x1b355f[_0x1126('0x59')]});if(_0x376175&&_0x376175[_0x1126('0x57')]){return ami['Action']({'action':'Hangup','channel':_0x376175[_0x1126('0x57')]})[_0x1126('0x1a')](function(_0x21ea6e){_0xdedb8f({'code':0xc8,'message':[_0x1b355f['uniqueid'],_0x21ea6e['message']['toLowerCase']()][_0x1126('0x1c')]('\x20')});})['catch'](function(_0x4cfbed){_0x54a72e(_0x3693b9[_0x1126('0x1b')](0x1f5,[_0x1b355f['uniqueid'],_0x4cfbed[_0x1126('0x20')][_0x1126('0x5d')]()]['join']('\x20')));});}else{return _0x54a72e(_0x3693b9[_0x1126('0x1b')](0x1f5,_0x1126('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x161b88){var _0xc3bb7f=this;return new Promise(function(_0x1644fc,_0x5e9872){if(ami[_0x1126('0x12')]()==![]){return _0x5e9872(_0xc3bb7f[_0x1126('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0x1126('0x13')][_0x1126('0x14')],_0x1126('0x15')][_0x1126('0x1c')]('\x20')));}var _0x2598a7=schema(properties[_0x1126('0x71')])[_0x1126('0x2')](_0x161b88);if(_0x2598a7[_0x1126('0x51')]>0x0){return _0x5e9872(_0xc3bb7f[_0x1126('0x1b')](0x1f4,_[_0x1126('0x66')](_0x2598a7,_0x1126('0x20'))[_0x1126('0x1c')](',\x20')));}var _0x2010a9=_[_0x1126('0x56')](_0x75a851[_0x1126('0x6e')],{'uniqueid':_0x161b88[_0x1126('0x59')]});if(_0x2010a9&&_0x2010a9['channel']){return ami[_0x1126('0x1e')]({'action':_0x1126('0x72'),'channel':_0x2010a9[_0x1126('0x57')],'exten':_0x161b88[_0x1126('0x73')],'context':_0x161b88[_0x1126('0x74')]||_0x2010a9['context'],'priority':0x1})[_0x1126('0x1a')](function(_0x4bf54b){_0x1644fc({'code':0xc8,'message':[_0x161b88['uniqueid'],_0x4bf54b[_0x1126('0x20')][_0x1126('0x5d')]()]['join']('\x20')});})['catch'](function(_0xaada05){_0x5e9872(_0xc3bb7f[_0x1126('0x1b')](0x1f5,[_0x161b88[_0x1126('0x59')],_0xaada05[_0x1126('0x20')][_0x1126('0x5d')]()][_0x1126('0x1c')]('\x20')));});}else{return _0x5e9872(_0xc3bb7f[_0x1126('0x1b')](0x1f5,_0x1126('0x6c')));}});},'Agents':function(_0x4a29e1){return new Promise(function(_0x5644ea,_0x13bfe4){var _0x402e9a=_[_0x1126('0x6d')](_0x75a851[_0x1126('0xe')]);_0x5644ea({'count':_0x402e9a[_0x1126('0x51')],'rows':_0x402e9a});});},'Telephones':function(_0x336b4b){return new Promise(function(_0x482199,_0xadea7b){var _0x2cc4c8=_[_0x1126('0x6d')](_0x75a851[_0x1126('0x75')]);_0x482199({'count':_0x2cc4c8[_0x1126('0x51')],'rows':_0x2cc4c8});});},'Trunks':function(_0x1796eb){return new Promise(function(_0x2418ca,_0x2d2dfc){var _0x38eac6=_[_0x1126('0x6d')](_0x75a851['trunks']);_0x2418ca({'count':_0x38eac6['length'],'rows':_0x38eac6});});},'OutboundChannels':function(_0x271d7c){return new Promise(function(_0x55496f,_0x3c5ea3){var _0x4bd50a=_[_0x1126('0x6d')](_0x75a851['outboundChannels']);_0x55496f({'count':_0x4bd50a[_0x1126('0x51')],'rows':_0x4bd50a});});},'Outbound':function(_0x4fbd44){return new Promise(function(_0x5c5044,_0x48c461){_0x5c5044(_0x75a851[_0x1126('0x76')]);});},'Campaigns':function(_0x31769a){return new Promise(function(_0x53f58b,_0x4ce12f){var _0x44325d=_[_0x1126('0x6d')](_0x75a851[_0x1126('0x77')]);_0x53f58b({'count':_0x44325d['length'],'rows':_0x44325d});});},'VoiceQueuesPreview':function(_0x48f914){var _0x25f2e3=this;return new Promise(function(_0x546d32,_0x41679a){_0x5a2189[_0x1126('0x78')](_0x48f914['id'])[_0x1126('0x1a')](function(_0x29922a){_0x546d32({'code':0xc8,'message':_0x29922a[_0x1126('0x20')]});})['catch'](function(_0x591c75){_0x41679a(_0x25f2e3[_0x1126('0x1b')](0x1f4,_0x591c75[_0x1126('0x20')]));});});},'EventManager':function(_0xfc9fb4){var _0x3758fa=this;return new Promise(function(_0x1b8218,_0x23bd79){if(!_0xfc9fb4[_0x1126('0x79')]){return _0x23bd79(_0x3758fa[_0x1126('0x1b')](0x1f4,_0x1126('0x7a')));}ami[_0x1126('0x7b')](_0x1126('0x7c')+_0xfc9fb4['event'],_0xfc9fb4[_0x1126('0x20')]);_0x1b8218({'code':0xc8,'message':_0xfc9fb4});});},'FaxAccounts':function(_0x4e4a05){return new Promise(function(_0x99eb4e,_0x4ec8b9){var _0x4256e6=_[_0x1126('0x6d')](_0x75a851[_0x1126('0x7d')]);_0x99eb4e({'count':_0x4256e6[_0x1126('0x51')],'rows':_0x4256e6});});},'SendFax':function(_0x59c04b){var _0x429183=this;return new Promise(function(_0x834360,_0x4b5d46){_0x5c68c8['send'](_0x59c04b)[_0x1126('0x1a')](function(_0x71b813){_0x834360({'code':0xc8,'message':_0x71b813[_0x1126('0x20')]});})['catch'](function(_0x8e044c){_0x4b5d46(_0x429183['error'](0x1f4,_0x8e044c[_0x1126('0x20')]));});});},'CheckAfterSend':function(_0x3a40c6){var _0x4d6bb2=this;return new Promise(function(_0x58607d,_0x315192){_0x5c68c8[_0x1126('0x7e')](_0x3a40c6)[_0x1126('0x1a')](function(_0x323d0a){_0x58607d({'code':0xc8,'message':_0x323d0a['message']});})[_0x1126('0x65')](function(_0x454a67){_0x315192(_0x4d6bb2[_0x1126('0x1b')](0x1f4,_0x454a67['message']));});});}};var _0x53fd91=jayson['server'](_0x4f239c)[_0x1126('0x7f')]();_0x53fd91['on'](_0x1126('0x1b'),function(_0x1a7c9b){return _0x907180(_0x1a7c9b);});_0x53fd91[_0x1126('0x8')](0x232a,'127.0.0.1',function(){console[_0x1126('0x80')](_0x1126('0x81'),0x232a);return _0x40ba58(_0x1126('0x82')+0x232a);});});}; \ No newline at end of file +var _0x82c4=['message','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','resolve','destinationchannel','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','telephones','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','catch','isConnected','Command','then','content','voiceQueues','hasOwnProperty','strategy','available','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','values','voicechannel','map'];(function(_0x19f26b,_0x428ade){var _0x34c21b=function(_0x2c5020){while(--_0x2c5020){_0x19f26b['push'](_0x19f26b['shift']());}};_0x34c21b(++_0x428ade);}(_0x82c4,0x1ca));var _0x482c=function(_0x56c37d,_0x486618){_0x56c37d=_0x56c37d-0x0;var _0x120476=_0x82c4[_0x56c37d];return _0x120476;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var jayson=require(_0x482c('0x2'));var schema=require(_0x482c('0x3'));var BPromise=require(_0x482c('0x4'));var moment=require(_0x482c('0x5'));var config=require(_0x482c('0x6'));var properties=require('../properties');var ami=require(_0x482c('0x7'));exports['listen']=function(_0x4556c8,_0x47edb6,_0x477cf4){return new BPromise(function(_0x5d7c76,_0xfdb92){var _0x32a503={'QueuePause':function(_0x35cdab){return new Promise(function(_0x1c10f2,_0x3846d8){var _0x478bd2=util[_0x482c('0x8')](_0x482c('0x9'),_0x482c('0xa'),_0x35cdab[_0x482c('0xb')]);if(_0x4556c8[_0x482c('0xc')]&&_0x4556c8[_0x482c('0xc')][_0x478bd2]&&_0x4556c8['timers'][_0x478bd2][_0x482c('0xd')]){_0x4556c8[_0x482c('0xc')][_0x478bd2][_0x482c('0xe')]();}if(_0x4556c8['agents'][_0x478bd2]){_0x4556c8[_0x482c('0xf')][_0x478bd2][_0x482c('0x10')]({'statePause':_0x35cdab[_0x482c('0x11')]?!![]:![]});}_0x1c10f2({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4bfb3a){var _0x7b12cf=this;return new Promise(function(_0x30e02b,_0x59837f){if(ami['isConnected']()==![]){return _0x59837f(_0x7b12cf[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}_0x4bfb3a=_[_0x482c('0x17')](_0x4bfb3a,_[_0x482c('0x18')](properties[_0x482c('0x19')]));_0x4bfb3a[_0x482c('0x1a')]=_0x482c('0x1b');return ami[_0x482c('0x1c')](_0x4bfb3a)['then'](function(_0x244bb9){_0x30e02b({'code':0xc8,'message':_0x244bb9['message']});})[_0x482c('0x1d')](function(_0x258148){_0x59837f(_0x7b12cf['error'](0x1f5,_0x258148['message']));});});},'Command':function(_0x357965){var _0x584656=this;return new Promise(function(_0x16fe9a,_0x4784a2){if(ami[_0x482c('0x1e')]()==![]){return _0x4784a2(_0x584656[_0x482c('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}_0x357965=_[_0x482c('0x17')](_0x357965,'command');_0x357965['action']=_0x482c('0x1f');return ami[_0x482c('0x1c')](_0x357965)[_0x482c('0x20')](function(_0x5c4e9c){_0x16fe9a({'code':0xc8,'message':_0x5c4e9c[_0x482c('0x21')]});})['catch'](function(_0x2f3f96){_0x4784a2(_0x584656[_0x482c('0x12')](0x1f5,_0x2f3f96['message']));});});},'VoiceQueues':function(_0x466583){return new Promise(function(_0x5436e2,_0x589bc6){var _0x2165af=[];for(var _0x27f1b5 in _0x4556c8[_0x482c('0x22')]){if(_0x4556c8[_0x482c('0x22')][_0x482c('0x23')](_0x27f1b5)){var _0x215826=_0x4556c8[_0x482c('0x22')][_0x27f1b5];var _0x5ad788={'id':_0x215826['id'],'name':_0x215826[_0x482c('0xb')],'strategy':_0x215826[_0x482c('0x24')],'answered':_0x215826['answered'],'available':_0x215826[_0x482c('0x25')],'loggedIn':_0x215826['loggedIn'],'pTalking':_0x215826['pTalking'],'sumBillable':_0x215826[_0x482c('0x26')],'sumDuration':_0x215826['sumDuration'],'sumHoldTime':_0x215826[_0x482c('0x27')]||0x0,'talking':_0x215826[_0x482c('0x28')],'total':_0x215826[_0x482c('0x29')],'type':_0x215826[_0x482c('0x2a')],'unmanaged':_0x215826[_0x482c('0x2b')],'abandoned':_0x215826[_0x482c('0x2c')],'waiting':_0x215826[_0x482c('0x2d')],'loggedInDb':_0x215826[_0x482c('0x2e')]};if(_0x215826[_0x482c('0x2a')]===_0x482c('0x2f')){_0x5ad788[_0x482c('0x30')]=_0x215826[_0x482c('0x30')];_0x5ad788[_0x482c('0x31')]=_0x215826[_0x482c('0x31')];_0x5ad788[_0x482c('0x32')]=_0x215826[_0x482c('0x32')];_0x5ad788[_0x482c('0x33')]=_0x215826[_0x482c('0x33')];_0x5ad788['dialOriginateTimeout']=_0x215826['dialOriginateTimeout'];_0x5ad788['dialPrefix']=_0x215826[_0x482c('0x34')];_0x5ad788[_0x482c('0x35')]=_0x215826[_0x482c('0x35')];_0x5ad788[_0x482c('0x36')]=_0x215826['outboundAnswerAgiCallsDay'];_0x5ad788[_0x482c('0x37')]=_0x215826['outboundAnswerCallsDay'];_0x5ad788[_0x482c('0x38')]=_0x215826[_0x482c('0x38')];_0x5ad788[_0x482c('0x39')]=_0x215826[_0x482c('0x39')];_0x5ad788[_0x482c('0x3a')]=_0x215826[_0x482c('0x3a')];_0x5ad788[_0x482c('0x3b')]=_0x215826[_0x482c('0x3b')];_0x5ad788['outboundDropCallsDayCallersExit']=_0x215826['outboundDropCallsDayCallersExit'];_0x5ad788[_0x482c('0x3c')]=_0x215826['outboundDropCallsDayTimeout'];_0x5ad788[_0x482c('0x3d')]=_0x215826[_0x482c('0x3d')];_0x5ad788[_0x482c('0x3e')]=_0x215826['outboundNoSuchCallsDay'];_0x5ad788[_0x482c('0x3f')]=_0x215826[_0x482c('0x3f')];_0x5ad788[_0x482c('0x40')]=_0x215826[_0x482c('0x40')];_0x5ad788['outboundRejectCallsDay']=_0x215826[_0x482c('0x41')];_0x5ad788['outboundUnknownCallsDay']=_0x215826[_0x482c('0x42')];_0x5ad788['predictiveIntervalAnsweredCalls']=_0x215826[_0x482c('0x43')];_0x5ad788['predictiveIntervalAvgHoldtime']=_0x215826[_0x482c('0x44')];_0x5ad788[_0x482c('0x45')]=_0x215826['predictiveIntervalAvgTalktime'];_0x5ad788[_0x482c('0x46')]=_0x215826['predictiveIntervalDroppedCallsCallersExit'];_0x5ad788['predictiveIntervalDroppedCallsTimeout']=_0x215826[_0x482c('0x47')];_0x5ad788['predictiveIntervalErlangCalls']=_0x215826['predictiveIntervalErlangCalls'];_0x5ad788['predictiveIntervalErlangCallsDroppedCalls']=_0x215826['predictiveIntervalErlangCallsDroppedCalls'];_0x5ad788[_0x482c('0x48')]=_0x215826[_0x482c('0x48')];_0x5ad788[_0x482c('0x49')]=_0x215826[_0x482c('0x49')];_0x5ad788[_0x482c('0x4a')]=_0x215826['predictiveIntervalPauses'];_0x5ad788[_0x482c('0x4b')]=_0x215826[_0x482c('0x4b')];_0x5ad788[_0x482c('0x4c')]=_0x215826[_0x482c('0x4c')];_0x5ad788['message']=_0x215826['message'];_0x5ad788[_0x482c('0x4d')]=_0x215826[_0x482c('0x4d')];_0x5ad788[_0x482c('0x4e')]=_0x215826[_0x482c('0x4e')];_0x5ad788[_0x482c('0x4f')]=_0x215826[_0x482c('0x4f')];_0x5ad788[_0x482c('0x50')]=_0x215826[_0x482c('0x50')];_0x5ad788[_0x482c('0x51')]=_0x215826[_0x482c('0x51')];_0x5ad788[_0x482c('0x52')]=_0x215826['startPredictive'];_0x5ad788[_0x482c('0x53')]=_0x215826[_0x482c('0x53')];}if(_0x215826[_0x482c('0x54')]){_0x5ad788[_0x482c('0x54')]={'id':_0x215826[_0x482c('0x54')]['id'],'name':_0x215826[_0x482c('0x54')][_0x482c('0xb')],'active':_0x215826['Trunk']['active'],'callerid':_0x215826[_0x482c('0x54')][_0x482c('0x55')]};}if(_0x215826[_0x482c('0x56')]){_0x5ad788['Interval']={'id':_0x215826[_0x482c('0x56')]['id'],'name':_0x215826['Interval'][_0x482c('0xb')]};}_0x2165af[_0x482c('0x57')](_0x5ad788);}}_0x5436e2({'count':_0x2165af[_0x482c('0x58')],'rows':_0x2165af});});},'UpdateVoiceQueue':function(_0x16b893){return new Promise(function(_0x5f4e0a,_0x1ff623){var _0x2c37f3=_[_0x482c('0x59')](_0x4556c8['voiceQueues'],{'id':parseInt(_0x16b893['id'])});var _0x407471=_[_0x482c('0x5a')](_0x16b893,['id']);if(_0x2c37f3){for(var _0xcf89c4 in _0x407471){if(typeof _0x407471[_0xcf89c4]!=='undefined'&&typeof _0x2c37f3[_0xcf89c4]!=='undefined'){_0x2c37f3[_0xcf89c4]=_0x407471[_0xcf89c4];}}_0x5f4e0a(_0x2c37f3);}else{_0x1ff623();}});},'VoiceChannels':function(_0x4a677d){return new Promise(function(_0x4998a5,_0x596ec2){var _0x56b6c5=_[_0x482c('0x5b')](_0x4556c8['channels']);_0x4998a5({'count':_0x56b6c5[_0x482c('0x58')],'rows':_0x56b6c5});});},'VoiceChannelMixMonitor':function(_0xbdbd1b){var _0x3ecf00=this;return new Promise(function(_0x2fa930,_0x40174a){if(ami[_0x482c('0x1e')]()==![]){return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x1126b7=schema(properties[_0x482c('0x5c')])[_0x482c('0x3')](_0xbdbd1b);if(_0x1126b7[_0x482c('0x58')]>0x0){return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f4,_[_0x482c('0x5d')](_0x1126b7,_0x482c('0x5e'))['join'](',\x20')));}var _0x107b1b=_[_0x482c('0x59')](_0x4556c8['channels'],{'uniqueid':_0xbdbd1b[_0x482c('0x5f')]});if(_0x107b1b&&_0x107b1b[_0x482c('0x60')]){var _0x1f5e5b=util[_0x482c('0x8')](_0x482c('0x61'),_0xbdbd1b['filename']||_0xbdbd1b['uniqueid'],_0xbdbd1b[_0x482c('0x8')]||_0x482c('0x62'));return ami[_0x482c('0x1c')]({'action':_0x482c('0x63'),'channel':_0x107b1b[_0x482c('0x60')],'file':_0x1f5e5b,'options':_0x482c('0x64')})[_0x482c('0x20')](function(_0x55925a){var _0x508a10=_['find'](_0x107b1b[_0x482c('0x65')],{'filename':_0x482c('0x66')+_0x1f5e5b[_0x482c('0x67')]()});if(_[_0x482c('0x68')](_0x508a10)){_0x107b1b[_0x482c('0x65')][_0x482c('0x57')]({'filename':_0x482c('0x66')+_0x1f5e5b[_0x482c('0x67')](),'createdAt':moment()[_0x482c('0x8')](_0x482c('0x69')),'mixmonitorid':_0x55925a[_0x482c('0x6a')],'status':'rec'});}else{_0x508a10[_0x482c('0x6a')]=_0x55925a[_0x482c('0x6a')];_0x508a10[_0x482c('0x6b')]=_0x482c('0x6c');}_0x2fa930({'code':0xc8,'message':[_0xbdbd1b[_0x482c('0x5f')],_0x482c('0x6d'),_0x55925a[_0x482c('0x6a')]][_0x482c('0x16')]('\x20'),'mixmonitorid':_0x55925a[_0x482c('0x6a')]});})[_0x482c('0x1d')](function(_0x3981cf){_0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f5,[_0xbdbd1b['uniqueid'],_0x3981cf['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0xa5ffff){var _0x313155=this;return new Promise(function(_0x5382b0,_0x231353){if(ami[_0x482c('0x1e')]()==![]){return _0x231353(_0x313155[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x1840a9=schema(properties[_0x482c('0x5c')])[_0x482c('0x3')](_0xa5ffff);if(_0x1840a9[_0x482c('0x58')]>0x0){return _0x231353(_0x313155['error'](0x1f4,_[_0x482c('0x5d')](_0x1840a9,'message')[_0x482c('0x16')](',\x20')));}var _0x1bb8d1=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x6f')],{'uniqueid':_0xa5ffff[_0x482c('0x5f')]});if(_0x1bb8d1){return BPromise[_0x482c('0x70')]()['then'](function(){if(_0x1bb8d1[_0x482c('0x60')]){return ami[_0x482c('0x1c')]({'action':'StopMixMonitor','channel':_0x1bb8d1['channel'],'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]})[_0x482c('0x1d')](function(_0x481241){});}})[_0x482c('0x20')](function(){if(_0x1bb8d1[_0x482c('0x71')]){return ami[_0x482c('0x1c')]({'action':_0x482c('0x72'),'channel':_0x1bb8d1['destinationchannel'],'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]})[_0x482c('0x1d')](function(_0x21a0c5){});}})[_0x482c('0x20')](function(_0x3a37f5){var _0x2fc65f=_['find'](_0x1bb8d1['monitors'],{'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]});if(_0x2fc65f){_0x2fc65f[_0x482c('0x6b')]=_0x482c('0x73');}})['then'](function(){var _0x23349f=util[_0x482c('0x8')](_0x482c('0x61'),_0xa5ffff[_0x482c('0x74')]||_0xa5ffff[_0x482c('0x5f')],_0xa5ffff[_0x482c('0x8')]||_0x482c('0x62'));var _0x37e456=_[_0x482c('0x59')](_0x1bb8d1['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x23349f[_0x482c('0x67')]()});if(_0x37e456){_0x37e456[_0x482c('0x6b')]='stop';}})['then'](function(){_0x5382b0({'code':0xc8,'message':[_0xa5ffff[_0x482c('0x5f')],_0x482c('0x75')][_0x482c('0x16')]('\x20')});})['catch'](function(_0x510f07){_0x231353(_0x313155['error'](0x1f5,[_0xa5ffff[_0x482c('0x5f')],_0x510f07[_0x482c('0x5e')][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x231353(_0x313155[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'VoiceQueuesChannels':function(_0x4839f2){return new Promise(function(_0x5e5e76,_0x2ec137){var _0x1d878f=_[_0x482c('0x5b')](_0x4556c8[_0x482c('0x76')]);_0x5e5e76({'count':_0x1d878f[_0x482c('0x58')],'rows':_0x1d878f});});},'VoiceQueuesChannel':function(_0x1c9531){var _0x2444a8=this;return new Promise(function(_0x445edb,_0x1c771f){var _0x142809=schema(properties[_0x482c('0x77')])[_0x482c('0x3')](_0x1c9531);if(_0x142809['length']>0x0){return _0x1c771f(_0x2444a8[_0x482c('0x12')](0x1f4,_[_0x482c('0x5d')](_0x142809,_0x482c('0x5e'))['join'](',\x20')));}var _0x2f781d=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x76')],{'uniqueid':_0x1c9531['uniqueid']});if(_0x2f781d){_0x445edb(_0x2f781d);}else{return _0x1c771f(_0x2444a8[_0x482c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x4bd929){var _0xcf240d=this;return new Promise(function(_0x14c94c,_0x383254){if(ami[_0x482c('0x1e')]()==![]){return _0x383254(_0xcf240d[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')]['username'],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x5eb509=schema(properties[_0x482c('0x78')])['validate'](_0x4bd929);if(_0x5eb509['length']>0x0){return _0x383254(_0xcf240d['error'](0x1f4,_[_0x482c('0x5d')](_0x5eb509,'message')['join'](',\x20')));}var _0xc7bebc=_[_0x482c('0x59')](_0x4556c8['queueChannels'],{'uniqueid':_0x4bd929[_0x482c('0x5f')]});if(_0xc7bebc&&_0xc7bebc['channel']){return ami['Action']({'action':'Hangup','channel':_0xc7bebc[_0x482c('0x60')]})[_0x482c('0x20')](function(_0x4fc3ef){_0x14c94c({'code':0xc8,'message':[_0x4bd929['uniqueid'],_0x4fc3ef['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')});})[_0x482c('0x1d')](function(_0x58eebf){_0x383254(_0xcf240d['error'](0x1f5,[_0x4bd929[_0x482c('0x5f')],_0x58eebf['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x383254(_0xcf240d['error'](0x1f5,_0x482c('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x5b804f){var _0x48b9c2=this;return new Promise(function(_0x2c0056,_0x4d6926){if(ami[_0x482c('0x1e')]()==![]){return _0x4d6926(_0x48b9c2['error'](0x1f4,[config[_0x482c('0x13')]['ip'],config['asterisk'][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x5b9153=schema(properties[_0x482c('0x79')])[_0x482c('0x3')](_0x5b804f);if(_0x5b9153[_0x482c('0x58')]>0x0){return _0x4d6926(_0x48b9c2['error'](0x1f4,_[_0x482c('0x5d')](_0x5b9153,_0x482c('0x5e'))[_0x482c('0x16')](',\x20')));}var _0x38eafd=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x76')],{'uniqueid':_0x5b804f[_0x482c('0x5f')]});if(_0x38eafd&&_0x38eafd['channel']){return ami[_0x482c('0x1c')]({'action':_0x482c('0x7a'),'channel':_0x38eafd[_0x482c('0x60')],'exten':_0x5b804f['exten'],'context':_0x5b804f['context']||_0x38eafd['context'],'priority':0x1})[_0x482c('0x20')](function(_0x5b3629){_0x2c0056({'code':0xc8,'message':[_0x5b804f['uniqueid'],_0x5b3629[_0x482c('0x5e')]['toLowerCase']()][_0x482c('0x16')]('\x20')});})[_0x482c('0x1d')](function(_0x17be77){_0x4d6926(_0x48b9c2[_0x482c('0x12')](0x1f5,[_0x5b804f['uniqueid'],_0x17be77[_0x482c('0x5e')]['toLowerCase']()][_0x482c('0x16')]('\x20')));});}else{return _0x4d6926(_0x48b9c2[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'Agents':function(_0x492ab0){return new Promise(function(_0x590d97,_0x145c5e){var _0x45011c=_['values'](_0x4556c8[_0x482c('0xf')]);_0x590d97({'count':_0x45011c['length'],'rows':_0x45011c});});},'Telephones':function(_0x929a4){return new Promise(function(_0x2c683f,_0x2f5799){var _0x549dec=_[_0x482c('0x5b')](_0x4556c8[_0x482c('0x7b')]);_0x2c683f({'count':_0x549dec[_0x482c('0x58')],'rows':_0x549dec});});},'Trunks':function(_0x573455){return new Promise(function(_0x27b6d2,_0x34f49f){var _0x56a961=_['values'](_0x4556c8['trunks']);_0x27b6d2({'count':_0x56a961[_0x482c('0x58')],'rows':_0x56a961});});},'OutboundChannels':function(_0x88661b){return new Promise(function(_0x3f0561,_0x4903f1){var _0xd5f6df=_[_0x482c('0x5b')](_0x4556c8['outboundChannels']);_0x3f0561({'count':_0xd5f6df[_0x482c('0x58')],'rows':_0xd5f6df});});},'Outbound':function(_0x5516d6){return new Promise(function(_0x106aa1,_0x363735){_0x106aa1(_0x4556c8[_0x482c('0x2f')]);});},'Campaigns':function(_0x1b4c75){return new Promise(function(_0x2db600,_0x255894){var _0x4dbd16=_['values'](_0x4556c8[_0x482c('0x7c')]);_0x2db600({'count':_0x4dbd16[_0x482c('0x58')],'rows':_0x4dbd16});});},'VoiceQueuesPreview':function(_0x2156af){var _0x319fc3=this;return new Promise(function(_0x7d0afa,_0x13df33){_0x47edb6[_0x482c('0x7d')](_0x2156af['id'])['then'](function(_0x3f5eac){_0x7d0afa({'code':0xc8,'message':_0x3f5eac[_0x482c('0x5e')]});})[_0x482c('0x1d')](function(_0x483e29){_0x13df33(_0x319fc3[_0x482c('0x12')](0x1f4,_0x483e29[_0x482c('0x5e')]));});});},'EventManager':function(_0x2eca83){var _0x190ee5=this;return new Promise(function(_0x45fe30,_0x1f4fd0){if(!_0x2eca83[_0x482c('0x7e')]){return _0x1f4fd0(_0x190ee5['error'](0x1f4,_0x482c('0x7f')));}ami[_0x482c('0x80')](_0x482c('0x81')+_0x2eca83['event'],_0x2eca83[_0x482c('0x5e')]);_0x45fe30({'code':0xc8,'message':_0x2eca83});});},'FaxAccounts':function(_0x55a8a6){return new Promise(function(_0x335a76,_0x3b948c){var _0x3e00e2=_[_0x482c('0x5b')](_0x4556c8['faxAccounts']);_0x335a76({'count':_0x3e00e2[_0x482c('0x58')],'rows':_0x3e00e2});});},'SendFax':function(_0xeaee3d){var _0x1120e1=this;return new Promise(function(_0xf8ac35,_0x5e3619){_0x477cf4[_0x482c('0x82')](_0xeaee3d)[_0x482c('0x20')](function(_0x157896){_0xf8ac35({'code':0xc8,'message':_0x157896[_0x482c('0x5e')]});})[_0x482c('0x1d')](function(_0x4aead3){_0x5e3619(_0x1120e1[_0x482c('0x12')](0x1f4,_0x4aead3[_0x482c('0x5e')]));});});},'CheckAfterSend':function(_0x1911f1){var _0x308dc8=this;return new Promise(function(_0x10fb1f,_0x5cd466){_0x477cf4[_0x482c('0x83')](_0x1911f1)[_0x482c('0x20')](function(_0x44da80){_0x10fb1f({'code':0xc8,'message':_0x44da80['message']});})[_0x482c('0x1d')](function(_0x1f2546){_0x5cd466(_0x308dc8[_0x482c('0x12')](0x1f4,_0x1f2546[_0x482c('0x5e')]));});});}};var _0x519225=jayson[_0x482c('0x84')](_0x32a503)[_0x482c('0x85')]();_0x519225['on'](_0x482c('0x12'),function(_0x5cbf1a){return _0xfdb92(_0x5cbf1a);});_0x519225[_0x482c('0x86')](0x232a,_0x482c('0x87'),function(){console[_0x482c('0x88')](_0x482c('0x89'),0x232a);return _0x5d7c76('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 a717cfa..85fe8c4 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 _0xff82=['data3','split','phone','$or','routeId','destcalleridnum','firstName','lastName','mobile','updatedAt','union','resolve','then','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','calleridnum','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','localhost','[CM][%s][%s]','stringify','exec','data2','xmd-contactid','ListId'];(function(_0xf6ee7,_0x1b9bd4){var _0x26ce4d=function(_0x3f6283){while(--_0x3f6283){_0xf6ee7['push'](_0xf6ee7['shift']());}};_0x26ce4d(++_0x1b9bd4);}(_0xff82,0xf5));var _0x2ff8=function(_0x2d2a6c,_0x4e35c4){_0x2d2a6c=_0x2d2a6c-0x0;var _0x1fa25a=_0xff82[_0x2d2a6c];return _0x1fa25a;};'use strict';var _=require(_0x2ff8('0x0'));var BPromise=require(_0x2ff8('0x1'));var Redis=require(_0x2ff8('0x2'));var util=require(_0x2ff8('0x3'));var config=require(_0x2ff8('0x4'));var logger=require(_0x2ff8('0x5'))('trigger');var cmContactRpc=require(_0x2ff8('0x6'));config['redis']=_['defaults'](config[_0x2ff8('0x7')],{'host':_0x2ff8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2ff8('0x7')]));function emit(_0x90924c,_0x4ea56f,_0x1cbf55,_0x324abf,_0x2c8b8d){logger['info'](_0x2ff8('0x9'),_0x90924c,_0x4ea56f['id'],_0x1cbf55,_0x324abf,JSON[_0x2ff8('0xa')](_0x2c8b8d));io['to'](_0x1cbf55)['emit'](_0x324abf,_0x2c8b8d);}exports[_0x2ff8('0xb')]=function(_0x4d9669,_0x354820,_0x375035,_0x328d1c){var _0x342564,_0x510e38;var _0x5718c9={};var _0x36e6de=Number(_0x375035['data1']);var _0xee0619=_0x375035[_0x2ff8('0xc')]?Boolean(Number(_0x375035[_0x2ff8('0xc')])):![];var _0x3b9d8e;if(_0x328d1c['xmd-contactid']){_0x5718c9['id']=_0x328d1c[_0x2ff8('0xd')];}if(!_0x5718c9['id']){_0x5718c9[_0x2ff8('0xe')]=_0x36e6de;_0x3b9d8e=_0x375035[_0x2ff8('0xf')]&&_0x375035[_0x2ff8('0xf')]!=='0'?_0x375035[_0x2ff8('0xf')][_0x2ff8('0x10')](','):[_0x2ff8('0x11')];_0x5718c9[_0x2ff8('0x12')]=_['map'](_0x3b9d8e,function(_0x10fc1a){var _0x518b5b={};_0x518b5b[_0x10fc1a]=_0x328d1c[_0x2ff8('0x13')]?_0x328d1c[_0x2ff8('0x14')]:_0x328d1c['calleridnum'];return _0x518b5b;});}var _0x3e23ba=['id',_0x2ff8('0x15'),_0x2ff8('0x16'),_0x2ff8('0x11'),_0x2ff8('0x17'),'fax','ListId','createdAt','scheduledAt',_0x2ff8('0x18')];var _0x3e51af=_[_0x2ff8('0x19')](_0x3e23ba,_0x3b9d8e);BPromise[_0x2ff8('0x1a')]()[_0x2ff8('0x1b')](cmContactRpc['getContacts']({'attributes':_0x3e51af,'where':_0x5718c9}))[_0x2ff8('0x1b')](function(_0x57e9b3){_0x510e38=_0x57e9b3;if(!_['isEmpty'](_0x510e38)){if(_0x510e38[_0x2ff8('0x1c')]===0x1){_0x342564=_0x510e38[0x0];logger[_0x2ff8('0x1d')](_0x2ff8('0x1e'),_0x328d1c[_0x2ff8('0x1f')],_0x354820['id'],_0x342564['id']);}else{logger[_0x2ff8('0x1d')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x328d1c[_0x2ff8('0x1f')],_0x354820['id'],_[_0x2ff8('0x20')](_0x510e38,'id')[_0x2ff8('0x21')](','));}return;}else{logger[_0x2ff8('0x1d')](_0x2ff8('0x22'),_0x328d1c[_0x2ff8('0x1f')],_0x354820['id']);var _0x52dc3b={'ListId':_0x36e6de};var _0x31a520=_0x375035[_0x2ff8('0x23')]&&_0x375035[_0x2ff8('0x23')]!=='0'?_0x375035[_0x2ff8('0x23')]:_0x2ff8('0x11');if(_0xee0619){logger[_0x2ff8('0x1d')](_0x2ff8('0x24'),_0x328d1c['uniqueid'],_0x354820['id']);_0x52dc3b[_0x31a520]=_['isNil'](_0x328d1c['routeId'])?_0x328d1c['calleridnum']:_0x328d1c['destcalleridnum'];if(_['isNil'](_0x328d1c[_0x2ff8('0x13')])){_0x52dc3b['firstName']=_0x328d1c['calleridname']&&_0x328d1c[_0x2ff8('0x25')]!==_0x2ff8('0x26')?_0x328d1c['calleridname']:_0x2ff8('0x27');}else{_0x52dc3b[_0x2ff8('0x15')]=_0x328d1c[_0x2ff8('0x28')]&&_0x328d1c[_0x2ff8('0x28')]!==_0x2ff8('0x26')?_0x328d1c['destcalleridname']:_0x2ff8('0x27');}return BPromise[_0x2ff8('0x1a')]()['then'](cmContactRpc[_0x2ff8('0x29')](_0x52dc3b))[_0x2ff8('0x1b')](function(_0x4c6e88){_0x342564=_0x4c6e88;_0x510e38[_0x2ff8('0x2a')](_0x4c6e88);if(_0x342564){logger[_0x2ff8('0x1d')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x328d1c[_0x2ff8('0x1f')],_0x354820['id'],_0x342564['id']);}return;});}else{logger[_0x2ff8('0x1d')](_0x2ff8('0x2b'),_0x328d1c['uniqueid'],_0x354820['id']);_0x52dc3b[_0x31a520]=_[_0x2ff8('0x2c')](_0x328d1c[_0x2ff8('0x13')])?_0x328d1c[_0x2ff8('0x2d')]:_0x328d1c[_0x2ff8('0x14')];if(_[_0x2ff8('0x2c')](_0x328d1c[_0x2ff8('0x13')])){_0x52dc3b[_0x2ff8('0x15')]=_0x328d1c[_0x2ff8('0x25')]&&_0x328d1c[_0x2ff8('0x25')]!==_0x2ff8('0x26')?_0x328d1c[_0x2ff8('0x25')]:_0x2ff8('0x27');}else{_0x52dc3b[_0x2ff8('0x15')]=_0x328d1c['destcalleridname']&&_0x328d1c[_0x2ff8('0x28')]!==_0x2ff8('0x26')?_0x328d1c[_0x2ff8('0x28')]:_0x2ff8('0x27');}_0x342564=_0x52dc3b;_0x510e38['push'](_0x52dc3b);return;}}})['then'](function(){if(_0x4d9669){emit(_0x328d1c[_0x2ff8('0x1f')],_0x354820,util[_0x2ff8('0x2e')](_0x2ff8('0x2f'),_0x4d9669[_0x2ff8('0x30')]),util[_0x2ff8('0x2e')](_0x2ff8('0x31'),_0x375035[_0x2ff8('0x32')][_0x2ff8('0x33')]()),{'evt':_['merge'](_0x328d1c,{'autoCreate':_0xee0619}),'contact':_0x342564===undefined?{}:_0x342564,'contacts':_0x510e38[_0x2ff8('0x1c')]===0x0?undefined:_0x510e38});}});}; \ No newline at end of file +var _0x5469=['data4','destcalleridnum','calleridname','','Unknown','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','push','format','user:%s','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','calleridnum','firstName','lastName','mobile','fax','scheduledAt','updatedAt','union','getContacts','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x2e5636,_0x2b9540){var _0x4d7371=function(_0x28e14c){while(--_0x28e14c){_0x2e5636['push'](_0x2e5636['shift']());}};_0x4d7371(++_0x2b9540);}(_0x5469,0x1d1));var _0x9546=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x5469[_0x2118ad];return _0x4b5715;};'use strict';var _=require(_0x9546('0x0'));var BPromise=require(_0x9546('0x1'));var Redis=require(_0x9546('0x2'));var util=require('util');var config=require(_0x9546('0x3'));var logger=require(_0x9546('0x4'))('trigger');var cmContactRpc=require(_0x9546('0x5'));config[_0x9546('0x6')]=_['defaults'](config[_0x9546('0x6')],{'host':_0x9546('0x7'),'port':0x18eb});var io=require(_0x9546('0x8'))(new Redis(config[_0x9546('0x6')]));function emit(_0x148ca5,_0x4ab271,_0x83f66f,_0x3ce48c,_0x5c0a8e){logger[_0x9546('0x9')](_0x9546('0xa'),_0x148ca5,_0x4ab271['id'],_0x83f66f,_0x3ce48c,JSON[_0x9546('0xb')](_0x5c0a8e));io['to'](_0x83f66f)[_0x9546('0xc')](_0x3ce48c,_0x5c0a8e);}exports[_0x9546('0xd')]=function(_0x686a56,_0x68b6f2,_0x963cd4,_0x1f6033){var _0x2383f1,_0x3a1224;var _0x2ffce3={};var _0xee71c8=Number(_0x963cd4[_0x9546('0xe')]);var _0xfb3ce0=_0x963cd4[_0x9546('0xf')]?Boolean(Number(_0x963cd4[_0x9546('0xf')])):![];var _0x3cfeb1;if(_0x1f6033[_0x9546('0x10')]){_0x2ffce3['id']=_0x1f6033['xmd-contactid'];}if(!_0x2ffce3['id']){_0x2ffce3[_0x9546('0x11')]=_0xee71c8;_0x3cfeb1=_0x963cd4[_0x9546('0x12')]&&_0x963cd4[_0x9546('0x12')]!=='0'?_0x963cd4[_0x9546('0x12')][_0x9546('0x13')](','):[_0x9546('0x14')];_0x2ffce3[_0x9546('0x15')]=_[_0x9546('0x16')](_0x3cfeb1,function(_0x384705){var _0x593f3b={};_0x593f3b[_0x384705]=_0x1f6033[_0x9546('0x17')]?_0x1f6033['destcalleridnum']:_0x1f6033[_0x9546('0x18')];return _0x593f3b;});}var _0x4cc6cc=['id',_0x9546('0x19'),_0x9546('0x1a'),_0x9546('0x14'),_0x9546('0x1b'),_0x9546('0x1c'),_0x9546('0x11'),'createdAt',_0x9546('0x1d'),_0x9546('0x1e')];var _0x19c266=_[_0x9546('0x1f')](_0x4cc6cc,_0x3cfeb1);BPromise['resolve']()['then'](cmContactRpc[_0x9546('0x20')]({'attributes':_0x19c266,'where':_0x2ffce3}))[_0x9546('0x21')](function(_0xe64e96){_0x3a1224=_0xe64e96;if(!_['isEmpty'](_0x3a1224)){if(_0x3a1224[_0x9546('0x22')]===0x1){_0x2383f1=_0x3a1224[0x0];logger[_0x9546('0x9')](_0x9546('0x23'),_0x1f6033[_0x9546('0x24')],_0x68b6f2['id'],_0x2383f1['id']);}else{logger[_0x9546('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1f6033[_0x9546('0x24')],_0x68b6f2['id'],_['map'](_0x3a1224,'id')[_0x9546('0x25')](','));}return;}else{logger[_0x9546('0x9')](_0x9546('0x26'),_0x1f6033[_0x9546('0x24')],_0x68b6f2['id']);var _0x53883d={'ListId':_0xee71c8};var _0x57d1b8=_0x963cd4[_0x9546('0x27')]&&_0x963cd4[_0x9546('0x27')]!=='0'?_0x963cd4['data4']:_0x9546('0x14');if(_0xfb3ce0){logger[_0x9546('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1f6033[_0x9546('0x24')],_0x68b6f2['id']);_0x53883d[_0x57d1b8]=_['isNil'](_0x1f6033['routeId'])?_0x1f6033[_0x9546('0x18')]:_0x1f6033[_0x9546('0x28')];if(_['isNil'](_0x1f6033[_0x9546('0x17')])){_0x53883d[_0x9546('0x19')]=_0x1f6033[_0x9546('0x29')]&&_0x1f6033[_0x9546('0x29')]!==_0x9546('0x2a')?_0x1f6033[_0x9546('0x29')]:_0x9546('0x2b');}else{_0x53883d['firstName']=_0x1f6033[_0x9546('0x2c')]&&_0x1f6033[_0x9546('0x2c')]!==_0x9546('0x2a')?_0x1f6033[_0x9546('0x2c')]:_0x9546('0x2b');}return BPromise[_0x9546('0x2d')]()['then'](cmContactRpc[_0x9546('0x2e')](_0x53883d))[_0x9546('0x21')](function(_0xaf502e){_0x2383f1=_0xaf502e;_0x3a1224['push'](_0xaf502e);if(_0x2383f1){logger[_0x9546('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1f6033[_0x9546('0x24')],_0x68b6f2['id'],_0x2383f1['id']);}return;});}else{logger[_0x9546('0x9')](_0x9546('0x2f'),_0x1f6033['uniqueid'],_0x68b6f2['id']);_0x53883d[_0x57d1b8]=_[_0x9546('0x30')](_0x1f6033[_0x9546('0x17')])?_0x1f6033[_0x9546('0x18')]:_0x1f6033[_0x9546('0x28')];if(_[_0x9546('0x30')](_0x1f6033[_0x9546('0x17')])){_0x53883d['firstName']=_0x1f6033[_0x9546('0x29')]&&_0x1f6033[_0x9546('0x29')]!==_0x9546('0x2a')?_0x1f6033[_0x9546('0x29')]:'Unknown';}else{_0x53883d['firstName']=_0x1f6033[_0x9546('0x2c')]&&_0x1f6033[_0x9546('0x2c')]!==''?_0x1f6033['destcalleridname']:_0x9546('0x2b');}_0x2383f1=_0x53883d;_0x3a1224[_0x9546('0x31')](_0x53883d);return;}}})[_0x9546('0x21')](function(){if(_0x686a56){emit(_0x1f6033[_0x9546('0x24')],_0x68b6f2,util[_0x9546('0x32')](_0x9546('0x33'),_0x686a56['name']),util[_0x9546('0x32')](_0x9546('0x34'),_0x963cd4[_0x9546('0x35')][_0x9546('0x36')]()),{'evt':_[_0x9546('0x37')](_0x1f6033,{'autoCreate':_0xfb3ce0}),'contact':_0x2383f1===undefined?{}:_0x2383f1,'contacts':_0x3a1224[_0x9546('0x22')]===0x0?undefined:_0x3a1224});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 26664c4..ef371dc 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 _0x3598=['winapp','triggers','agents','voiceQueues','voiceExtensions','freshdeskAccounts','salesforceAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zendeskAccounts','sugarcrmAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','emit','info','stringify','prototype','clone','interface','checkTriggers','status','checkTrigger','merge','variables','Actions','contactmanager','motionbar','data1','TemplateId','data2','html','render','templates','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winApplication','winArguments','format','user:%s','name','action','toLowerCase','jscripty','trigger:%s','exec','queue','urlforward','script','parse','replace','length','every','AllConditions','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','value','AccountId','operator','upperFirst','interaction','message','event','agent','membername','lastevent','routeId','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup'];(function(_0x51dada,_0x4ddb59){var _0x209d74=function(_0x2e1892){while(--_0x2e1892){_0x51dada['push'](_0x51dada['shift']());}};_0x209d74(++_0x4ddb59);}(_0x3598,0x68));var _0x8359=function(_0x5aa40d,_0x2e0efd){_0x5aa40d=_0x5aa40d-0x0;var _0x91f3cd=_0x3598[_0x5aa40d];return _0x91f3cd;};'use strict';var util=require(_0x8359('0x0'));var _=require(_0x8359('0x1'));var url=require(_0x8359('0x2'));var Mustache=require(_0x8359('0x3'));var Redis=require(_0x8359('0x4'));var urlforward=require(_0x8359('0x5'));var integration=require(_0x8359('0x6'));var cmContact=require('./cmContact');var script=require(_0x8359('0x7'));var config=require(_0x8359('0x8'));var logger=require(_0x8359('0x9'))(_0x8359('0xa'));var ami=require(_0x8359('0xb'));config[_0x8359('0xc')]=_['defaults'](config[_0x8359('0xc')],{'host':_0x8359('0xd'),'port':0x18eb});var io=require(_0x8359('0xe'))(new Redis(config[_0x8359('0xc')]));var operators={'equals':function(_0x49086d,_0x1f571c){return _0x49086d==_0x1f571c;},'not_equals':function(_0x34ca01,_0x5d121a){return _0x34ca01!=_0x5d121a;}};var barAndWebActions=[_0x8359('0xf'),_0x8359('0x2'),_0x8359('0x10')];function Trigger(_0x1fd406){this[_0x8359('0x11')]=_0x1fd406[_0x8359('0x11')];this[_0x8359('0x12')]=_0x1fd406[_0x8359('0x12')];this[_0x8359('0x13')]=_0x1fd406[_0x8359('0x13')];this['templates']=_0x1fd406['templates'];this['voiceExtensions']=_0x1fd406[_0x8359('0x14')];this['zendeskAccounts']=_0x1fd406['zendeskAccounts'];this[_0x8359('0x15')]=_0x1fd406['freshdeskAccounts'];this[_0x8359('0x16')]=_0x1fd406['salesforceAccounts'];this['sugarcrmAccounts']=_0x1fd406['sugarcrmAccounts'];this['zohoAccounts']=_0x1fd406['zohoAccounts'];this[_0x8359('0x17')]=_0x1fd406[_0x8359('0x17')];this[_0x8359('0x18')]=_0x1fd406[_0x8359('0x18')];this[_0x8359('0x19')]=_0x1fd406[_0x8359('0x19')];this[_0x8359('0x1a')]=_0x1fd406['dynamics365Accounts'];this[_0x8359('0x1b')]=_0x1fd406[_0x8359('0x1b')];this[_0x8359('0x1c')]={'zendesk':this[_0x8359('0x1d')],'salesforce':this[_0x8359('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x8359('0x1e')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x8359('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x8359('0x19')]};ami['on'](_0x8359('0x1f'),this[_0x8359('0x20')]['bind'](this));ami['on']('custom:agentconnect',this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on'](_0x8359('0x22'),this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on'](_0x8359('0x23'),this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on'](_0x8359('0x24'),this['syncCustomEvent'][_0x8359('0x21')](this));ami['on'](_0x8359('0x25'),this[_0x8359('0x20')]['bind'](this));ami['on'](_0x8359('0x26'),this['syncCustomEvent']['bind'](this));ami['on'](_0x8359('0x27'),this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on'](_0x8359('0x28'),this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on'](_0x8359('0x29'),this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on']('custom:queuecallerabandon',this[_0x8359('0x20')]['bind'](this));ami['on'](_0x8359('0x2a'),this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on']('custom:dialbegin',this[_0x8359('0x2b')][_0x8359('0x21')](this));ami['on'](_0x8359('0x2c'),this[_0x8359('0x2b')]['bind'](this));ami['on']('custom:dialend',this[_0x8359('0x2b')]['bind'](this));ami['on'](_0x8359('0x2d'),this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on'](_0x8359('0x2e'),this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on'](_0x8359('0x2f'),this['syncCustomEvent'][_0x8359('0x21')](this));ami['on'](_0x8359('0x30'),this['syncCustomEvent']['bind'](this));ami['on']('custom:acceptmessage',this[_0x8359('0x20')][_0x8359('0x21')](this));ami['on'](_0x8359('0x31'),this[_0x8359('0x20')][_0x8359('0x21')](this));}Trigger['prototype'][_0x8359('0x32')]=function(_0x58a060,_0x42faba,_0x447b44){logger[_0x8359('0x33')](_0x58a060,_0x42faba,JSON[_0x8359('0x34')](_0x447b44));io['to'](_0x58a060)[_0x8359('0x32')](_0x42faba,_0x447b44);};Trigger[_0x8359('0x35')][_0x8359('0x20')]=function(_0x2d8991){var _0x37dc1b=_[_0x8359('0x36')](_0x2d8991);this['checkTriggers'](_0x37dc1b);};Trigger[_0x8359('0x35')][_0x8359('0x2b')]=function(_0x55f726){if(this[_0x8359('0x12')][_0x55f726[_0x8359('0x37')]]){this['syncCustomEvent'](_0x55f726);}};Trigger[_0x8359('0x35')][_0x8359('0x38')]=function(_0x38f7b3){var _0x5a30a1;for(var _0x1286ee in this[_0x8359('0x11')]){if(this[_0x8359('0x11')]['hasOwnProperty'](_0x1286ee)){if(this['triggers'][_0x1286ee][_0x8359('0x39')]){_0x5a30a1=this[_0x8359('0x3a')](this['triggers'][_0x1286ee],_0x38f7b3);if(_0x5a30a1){_[_0x8359('0x3b')](_0x38f7b3,_0x38f7b3[_0x8359('0x3c')]);for(var _0x205e55=0x0,_0x3c0a37,_0x29c5f2,_0x5664a5;_0x205e550x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x42cd1e,_0x2aa600){var _0x6780e9=function(_0x53796b){while(--_0x53796b){_0x42cd1e['push'](_0x42cd1e['shift']());}};_0x6780e9(++_0x2aa600);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 7bd095b..4f482e0 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 _0x69ed=['4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','catch','toLowerCase','outbound','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','enduserId',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','string','picklist','type','nameField','customField','idField','indexOf','incidents','assign','getString','Descriptions','/contacts(','ticketType','phonecall','phonecalls','Subjects','callDirection','queue','substring','ticketId','format','user:%s','trigger:browser:url','serverUrl','stripTrailingSlash','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','request-promise','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','remoteUri','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20'];(function(_0x18e9cd,_0x2c4683){var _0x4d59e1=function(_0x22a371){while(--_0x22a371){_0x18e9cd['push'](_0x18e9cd['shift']());}};_0x4d59e1(++_0x2c4683);}(_0x69ed,0xab));var _0xd69e=function(_0x5c7c98,_0x3388a9){_0x5c7c98=_0x5c7c98-0x0;var _0x5a4c8b=_0x69ed[_0x5c7c98];return _0x5a4c8b;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0xd69e('0x0'));var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0xd69e('0x1'));var logger=require(_0xd69e('0x2'))(_0xd69e('0x3'));var config=require(_0xd69e('0x4'));config[_0xd69e('0x5')]=_[_0xd69e('0x6')](config[_0xd69e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xd69e('0x7'))(new Redis(config[_0xd69e('0x5')]));function getAuthToken(_0x26d44f,_0x3bb192,_0x32f3ed){var _0x3db351={'method':_0xd69e('0x8'),'uri':_0x3bb192,'form':{'client_id':_0x26d44f['clientId'],'resource':_0x26d44f[_0xd69e('0x9')],'username':_0x26d44f[_0xd69e('0xa')],'password':_0x26d44f[_0xd69e('0xb')],'grant_type':_0xd69e('0xb'),'client_secret':_0x26d44f['clientSecret']},'json':!![]};return rp(_0x3db351)[_0xd69e('0xc')](function(_0x41c27a){return _0x41c27a[_0xd69e('0xd')];})['catch'](function(_0x282d09){logger[_0xd69e('0xe')]('['+[_0x32f3ed[_0xd69e('0xf')]()]+_0xd69e('0x10'));return _0x282d09[_0xd69e('0x11')];});}function getUser(_0x319e8b,_0x5defcf,_0xa445db,_0x290e41,_0x2fa3b2,_0x3e5a97){return new BPromise(function(_0x1812e9,_0x39cc73){return getAuthToken(_0x5defcf,_0x290e41,_0x3e5a97)[_0xd69e('0xc')](function(_0x2240a3){var _0x2f0514={'method':_0xd69e('0x12'),'uri':_0x2fa3b2+_0xd69e('0x13'),'headers':{'Authorization':_0xd69e('0x14')+_0x2240a3,'OData-Version':_0xd69e('0x15')},'json':!![]};return rp(_0x2f0514);})['then'](function(_0x56c244){var _0x67d8d2=_0x56c244[_0xd69e('0x16')];var _0x44a4b1=![];var _0x55facf=null;if(!_[_0xd69e('0x17')](_0xa445db)){if(intUtil[_0xd69e('0x18')](_0xa445db[_0xd69e('0x19')])){_0x319e8b[_0xd69e('0x1a')]=_0xa445db['email'];for(_0x55facf=0x0;_0x55facf<_0x67d8d2[_0xd69e('0x1b')];_0x55facf++){if(_0x67d8d2[_0x55facf]['internalemailaddress']===_0xa445db['email']&&!_0x67d8d2[_0x55facf][_0xd69e('0x1c')]){_0x44a4b1=!![];logger[_0xd69e('0x1d')]('['+[_0x3e5a97['toUpperCase']()]+_0xd69e('0x1e')+_0x67d8d2[_0x55facf]['systemuserid']+'!');_0x319e8b[_0xd69e('0x1f')]=_0x67d8d2[_0x55facf][_0xd69e('0x20')];}}}}if(!_0x44a4b1){logger[_0xd69e('0x1d')]('['+[_0x3e5a97[_0xd69e('0xf')]()]+_0xd69e('0x21'));_0x319e8b[_0xd69e('0x1a')]=_0x5defcf[_0xd69e('0xa')];for(_0x55facf=0x0;_0x55facf<_0x67d8d2['length'];_0x55facf++){if(_0x67d8d2[_0x55facf][_0xd69e('0x22')]===_0x5defcf[_0xd69e('0xa')]){_0x319e8b[_0xd69e('0x1f')]=_0x67d8d2[_0x55facf][_0xd69e('0x20')];}}}_0x1812e9(_0x319e8b);})[_0xd69e('0x23')](function(_0x5d06f7){_0x39cc73(_0x5d06f7['message']);});});}function createEndUser(_0x14157a,_0x5cbce1,_0x2a3a0b,_0x125957,_0xc62a52,_0x57aca4){return new BPromise(function(_0x6609f0,_0x5ddd63){return getAuthToken(_0x5cbce1,_0x2a3a0b,_0x57aca4)[_0xd69e('0xc')](function(_0x49eb87){var _0x57598f=_0x57aca4[_0xd69e('0x24')]()===_0xd69e('0x25')?_0xc62a52['destcalleridnum']:_0xc62a52[_0xd69e('0x26')];var _0x17d03b={'method':_0xd69e('0x8'),'uri':_0x125957+_0xd69e('0x27'),'body':{'telephone1':_0x57598f,'fullname':_0x57598f,'firstname':_0x57598f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xd69e('0x28')+_0x14157a[_0xd69e('0x1f')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x49eb87,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x17d03b);})[_0xd69e('0xc')](function(_0x7e2180){var _0x195890=_0x7e2180[_0xd69e('0x29')][_0xd69e('0x2a')];var _0xb09c2f=_0x195890['substring'](_0x195890[_0xd69e('0x2b')]('(')+0x1,_0x195890[_0xd69e('0x2b')](')'));_0x14157a['enduserId']=_0xb09c2f;_0x6609f0(_0x14157a);})[_0xd69e('0x23')](function(_0x501ad4){_0x5ddd63(_0x501ad4[_0xd69e('0x11')]);});});}function getEndUser(_0xbe0d42,_0x3cb9fe,_0x3e6918,_0x1dab6b,_0x46037d,_0x55a92d){return new BPromise(function(_0x2bd39f,_0x40bee0){var _0x159eb0=_0x55a92d[_0xd69e('0x24')]()===_0xd69e('0x25')?_0x46037d['destcalleridnum']:_0x46037d['calleridnum'];return getAuthToken(_0x3cb9fe,_0x3e6918,_0x55a92d)[_0xd69e('0xc')](function(_0x3d3cd8){var _0x2ec13d={'method':_0xd69e('0x12'),'uri':_0x1dab6b+_0xd69e('0x2c')+_0x159eb0[_0xd69e('0x2d')]('+',_0xd69e('0x2e'))+'\x27','headers':{'Authorization':_0xd69e('0x14')+_0x3d3cd8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2ec13d);})[_0xd69e('0xc')](function(_0x718d92){var _0x402bf4=null;if(_0x718d92){var _0x41e7ef=_0x718d92[_0xd69e('0x16')];var _0x3c3433=![];for(_0x402bf4=0x0;_0x402bf4<_0x41e7ef[_0xd69e('0x1b')];_0x402bf4++){if(_0x41e7ef[_0x402bf4][_0xd69e('0x2f')]===_0x159eb0){_0x3c3433=!![];_0xbe0d42[_0xd69e('0x30')]=_0x41e7ef[_0x402bf4]['contactid'];}}if(_0x3c3433){_0x2bd39f(_0xbe0d42);}else{return createEndUser(_0xbe0d42,_0x3cb9fe,_0x3e6918,_0x1dab6b,_0x46037d,_0x55a92d)[_0xd69e('0xc')](function(_0x54b96d){logger[_0xd69e('0x1d')]('['+[_0x55a92d[_0xd69e('0xf')]()]+_0xd69e('0x31'),_0x54b96d[_0xd69e('0x30')]);_0x2bd39f(_0x54b96d);});}}else{return createEndUser(_0xbe0d42,_0x3cb9fe,_0x3e6918,_0x1dab6b,_0x46037d,_0x55a92d)[_0xd69e('0xc')](function(_0x57f920){logger[_0xd69e('0x1d')]('['+[_0x55a92d['toUpperCase']()]+_0xd69e('0x32'),_0x57f920[_0xd69e('0x30')]);_0x2bd39f(_0x57f920);});}});});}function getCustomFields(_0x36daf0,_0x290e9c,_0x113654){var _0x542abb={};if(_0x36daf0[_0xd69e('0x1b')]>0x0){_['forEach'](_0x36daf0,function(_0x22fa03){if(_['includes']([_0xd69e('0x33'),_0xd69e('0x34')],_0x22fa03[_0xd69e('0x35')])&&_0x22fa03[_0xd69e('0x36')]&&!_0x22fa03[_0xd69e('0x37')]){var _0x2437ac=_0x22fa03[_0xd69e('0x38')][_0xd69e('0x24')]();var _0x35c57d=_0x2437ac['substring'](0x0,_0x2437ac['indexOf']('_'));var _0x4cd3ae=_0x2437ac['substring'](_0x2437ac[_0xd69e('0x39')]('_')+0x1);if(_0x35c57d===_0x113654){_0x542abb[_0x4cd3ae]=_0x22fa03['content'];}}});}return _0x542abb;}function getTicket(_0x523cc1,_0x302845,_0x2ed7cc,_0x1d43ca,_0x179fc9,_0x2e8f7e,_0x443deb){return new BPromise(function(_0x5d251a,_0x456855){var _0x56e5bd;return getAuthToken(_0x302845,_0x2ed7cc,_0x443deb)[_0xd69e('0xc')](function(_0x2af1e3){if(_0x2e8f7e['ticketType']==='incident'){_0x56e5bd={'method':_0xd69e('0x8'),'uri':_0x1d43ca+_0xd69e('0x3a'),'body':Object[_0xd69e('0x3b')]({},{'title':intUtil['getString'](_0x2e8f7e['Subjects'],_0x179fc9,'\x20'),'description':intUtil[_0xd69e('0x3c')](_0x2e8f7e[_0xd69e('0x3d')],_0x179fc9,'\x0a'),'customerid_contact@odata.bind':_0xd69e('0x3e')+_0x523cc1[_0xd69e('0x30')]+')','ownerid@odata.bind':'/systemusers('+_0x523cc1[_0xd69e('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x2e8f7e['Fields'],_0x179fc9,_0x2e8f7e[_0xd69e('0x3f')])),'headers':{'Authorization':_0xd69e('0x14')+_0x2af1e3,'OData-Version':_0xd69e('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2e8f7e['ticketType']===_0xd69e('0x40')){_0x56e5bd={'method':_0xd69e('0x8'),'uri':_0x1d43ca+_0xd69e('0x41'),'body':Object[_0xd69e('0x3b')]({},{'subject':intUtil[_0xd69e('0x3c')](_0x2e8f7e[_0xd69e('0x42')],_0x179fc9,'\x20'),'phonenumber':String(_0x179fc9[_0xd69e('0x26')]),'description':intUtil[_0xd69e('0x3c')](_0x2e8f7e[_0xd69e('0x3d')],_0x179fc9,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x523cc1[_0xd69e('0x30')]+')','ownerid@odata.bind':_0xd69e('0x28')+_0x523cc1[_0xd69e('0x1f')]+')','directioncode':_0x523cc1[_0xd69e('0x43')]===_0xd69e('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xd69e('0x28')+_0x523cc1['userId']+')','participationtypemask':_0x523cc1[_0xd69e('0x43')]===_0xd69e('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0xd69e('0x3e')+_0x523cc1[_0xd69e('0x30')]+')','participationtypemask':_0x523cc1[_0xd69e('0x43')]==='queue'?0x1:0x2}]},getCustomFields(_0x2e8f7e['Fields'],_0x179fc9,_0x2e8f7e['ticketType'])),'headers':{'Authorization':_0xd69e('0x14')+_0x2af1e3,'OData-Version':_0xd69e('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x56e5bd);})[_0xd69e('0xc')](function(_0x1d2033){var _0x52d740=_0x1d2033[_0xd69e('0x29')]['odata-entityid'];var _0x413818=_0x52d740[_0xd69e('0x45')](_0x52d740[_0xd69e('0x2b')]('(')+0x1,_0x52d740[_0xd69e('0x2b')](')'));_0x523cc1[_0xd69e('0x46')]=_0x413818;_0x5d251a(_0x523cc1);})['catch'](function(_0x9392f8){_0x456855(_0x9392f8[_0xd69e('0x11')]);});});}function emit(_0x217165,_0x4a7d6c,_0x26634a,_0x251620){var _0x5b240a={'uri':util[_0xd69e('0x47')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x217165,_0x26634a,_0x251620)};io['to'](util['format'](_0xd69e('0x48'),_0x4a7d6c))['emit'](_0xd69e('0x49'),_0x5b240a);}exports['cs']=function(_0x19e78d,_0x3a72ee,_0xbd351b,_0x5deb64,_0x2f0a9d,_0x37db5d,_0x2a5622,_0x3ba8f0){var _0x1bec53={};_0x37db5d[_0xd69e('0x9')]=intUtil['stripTrailingSlash'](_0x37db5d['remoteUri']);_0x37db5d[_0xd69e('0x4a')]=intUtil[_0xd69e('0x4b')](_0x37db5d[_0xd69e('0x4a')]);_0x1bec53[_0xd69e('0x43')]=_0x3ba8f0===_0xd69e('0x44')||_0x3ba8f0==='unmanaged'?_0xd69e('0x44'):_0xd69e('0x25');var _0x4a10ca=util[_0xd69e('0x47')](_0xd69e('0x4c'),_0x37db5d[_0xd69e('0x9')]);var _0x14b7e2=util[_0xd69e('0x47')](_0xd69e('0x4d'),_0x37db5d[_0xd69e('0x4e')]);var _0x3ad056=util[_0xd69e('0x47')](_0xd69e('0x4f'),_0x37db5d[_0xd69e('0x4a')],_0x3a72ee[_0xd69e('0x50')],md5(_0x3a72ee[_0xd69e('0x50')]));if(_0x2f0a9d&&_0x2f0a9d[_0xd69e('0x51')]){logger[_0xd69e('0x1d')](_0xd69e('0x52'),_0xd69e('0x53'));_0x3a72ee['recordingURL']=_0x3ad056;}else if(_0x2a5622&&_0x2a5622['recordingFormat']&&_0x2a5622[_0xd69e('0x54')]!==_0xd69e('0x55')){logger['info'](_0xd69e('0x56'),_0xd69e('0x53'));_0x3a72ee[_0xd69e('0x57')]=_0x3ad056;}else{_0x3a72ee[_0xd69e('0x57')]='';}return getUser(_0x1bec53,_0x37db5d,_0x5deb64,_0x14b7e2,_0x4a10ca,_0x3ba8f0)[_0xd69e('0xc')](function(_0x506797){logger['info']('['+_0x3ba8f0[_0xd69e('0xf')]()+_0xd69e('0x58'),_0x506797[_0xd69e('0x1f')]);logger[_0xd69e('0x1d')]('['+_0x3ba8f0[_0xd69e('0xf')]()+']\x20The\x20User\x20email\x20is:',_0x506797[_0xd69e('0x1a')]);return getEndUser(_0x506797,_0x37db5d,_0x14b7e2,_0x4a10ca,_0x3a72ee,_0x3ba8f0);})[_0xd69e('0xc')](function(_0x5a6932){logger[_0xd69e('0x1d')]('['+_0x3ba8f0[_0xd69e('0xf')]()+_0xd69e('0x59'),_0x5a6932[_0xd69e('0x30')]);logger['info']('['+_0x3ba8f0[_0xd69e('0xf')]()+_0xd69e('0x5a'),_0x3a72ee[_0xd69e('0x26')]);return getTicket(_0x5a6932,_0x37db5d,_0x14b7e2,_0x4a10ca,_0x3a72ee,_0xbd351b,_0x3ba8f0);})['then'](function(_0x3ec358){logger[_0xd69e('0x1d')](util['format']('['+_0x3ba8f0['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0xbd351b[_0xd69e('0x3f')],_0x3ec358[_0xd69e('0x46')]));logger['info'](util['format']('['+_0x3ba8f0[_0xd69e('0xf')]()+_0xd69e('0x5b'),_0x3ba8f0));if(_0x3ba8f0!==_0xd69e('0x5c')){logger[_0xd69e('0x1d')]('['+_0x3ba8f0['toUpperCase']()+']',_0xd69e('0x5d'));emit(_0x37db5d['remoteUri'],_0x5deb64['name'],_0xbd351b[_0xd69e('0x3f')],_0x3ec358[_0xd69e('0x46')]);}})[_0xd69e('0x23')](function(_0x5cfe1b){logger[_0xd69e('0xe')]('['+_0x3ba8f0[_0xd69e('0xf')]()+_0xd69e('0x5e'),util[_0xd69e('0x5f')](_0x5cfe1b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1923=['[QUEUE]','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','Bearer\x20','4.0','then','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','outbound','destcalleridnum','calleridnum','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','incidents','getString','Descriptions','/contacts(','Fields','phonecalls','assign','Subjects','callDirection','queue','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format'];(function(_0xd1e471,_0x2c7a2){var _0x15a03c=function(_0x613dd1){while(--_0x613dd1){_0xd1e471['push'](_0xd1e471['shift']());}};_0x15a03c(++_0x2c7a2);}(_0x1923,0x71));var _0x3192=function(_0x5ad59c,_0x482a95){_0x5ad59c=_0x5ad59c-0x0;var _0x5756f6=_0x1923[_0x5ad59c];return _0x5756f6;};'use strict';var _=require('lodash');var BPromise=require(_0x3192('0x0'));var rp=require(_0x3192('0x1'));var util=require(_0x3192('0x2'));var intUtil=require(_0x3192('0x3'));var md5=require(_0x3192('0x4'));var Redis=require(_0x3192('0x5'));var logger=require(_0x3192('0x6'))(_0x3192('0x7'));var config=require('../../../../config/environment');config['redis']=_[_0x3192('0x8')](config[_0x3192('0x9')],{'host':_0x3192('0xa'),'port':0x18eb});var io=require(_0x3192('0xb'))(new Redis(config[_0x3192('0x9')]));function getAuthToken(_0x185da9,_0x22187a,_0x1a0882){var _0x3072a3={'method':_0x3192('0xc'),'uri':_0x22187a,'form':{'client_id':_0x185da9[_0x3192('0xd')],'resource':_0x185da9[_0x3192('0xe')],'username':_0x185da9[_0x3192('0xf')],'password':_0x185da9[_0x3192('0x10')],'grant_type':_0x3192('0x10'),'client_secret':_0x185da9[_0x3192('0x11')]},'json':!![]};return rp(_0x3072a3)['then'](function(_0x5578c0){return _0x5578c0[_0x3192('0x12')];})['catch'](function(_0x451879){logger[_0x3192('0x13')]('['+[_0x1a0882[_0x3192('0x14')]()]+_0x3192('0x15'));return _0x451879[_0x3192('0x16')];});}function getUser(_0x28b5f5,_0x21b859,_0x4ceebe,_0x12c95b,_0x2920bc,_0x1b663d){return new BPromise(function(_0x3b2a47,_0x1b4422){return getAuthToken(_0x21b859,_0x12c95b,_0x1b663d)['then'](function(_0x331160){var _0x21c343={'method':'GET','uri':_0x2920bc+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x3192('0x17')+_0x331160,'OData-Version':_0x3192('0x18')},'json':!![]};return rp(_0x21c343);})[_0x3192('0x19')](function(_0x19087b){var _0x7ae718=_0x19087b[_0x3192('0x1a')];var _0x478e58=![];var _0x52336e=null;if(!_[_0x3192('0x1b')](_0x4ceebe)){if(intUtil[_0x3192('0x1c')](_0x4ceebe[_0x3192('0x1d')])){_0x28b5f5[_0x3192('0x1e')]=_0x4ceebe[_0x3192('0x1d')];for(_0x52336e=0x0;_0x52336e<_0x7ae718[_0x3192('0x1f')];_0x52336e++){if(_0x7ae718[_0x52336e][_0x3192('0x20')]===_0x4ceebe[_0x3192('0x1d')]&&!_0x7ae718[_0x52336e][_0x3192('0x21')]){_0x478e58=!![];logger[_0x3192('0x22')]('['+[_0x1b663d[_0x3192('0x14')]()]+_0x3192('0x23')+_0x7ae718[_0x52336e]['systemuserid']+'!');_0x28b5f5[_0x3192('0x24')]=_0x7ae718[_0x52336e][_0x3192('0x25')];}}}}if(!_0x478e58){logger['info']('['+[_0x1b663d[_0x3192('0x14')]()]+_0x3192('0x26'));_0x28b5f5[_0x3192('0x1e')]=_0x21b859['username'];for(_0x52336e=0x0;_0x52336e<_0x7ae718[_0x3192('0x1f')];_0x52336e++){if(_0x7ae718[_0x52336e]['internalemailaddress']===_0x21b859[_0x3192('0xf')]){_0x28b5f5[_0x3192('0x24')]=_0x7ae718[_0x52336e][_0x3192('0x25')];}}}_0x3b2a47(_0x28b5f5);})[_0x3192('0x27')](function(_0x473a17){_0x1b4422(_0x473a17[_0x3192('0x16')]);});});}function createEndUser(_0x54dc39,_0x7bbab2,_0x86eda4,_0x4838e8,_0x5bc765,_0x52ac0b){return new BPromise(function(_0x5c0ae6,_0x492874){return getAuthToken(_0x7bbab2,_0x86eda4,_0x52ac0b)['then'](function(_0x4ba494){var _0x495fc5=_0x52ac0b['toLowerCase']()===_0x3192('0x28')?_0x5bc765[_0x3192('0x29')]:_0x5bc765[_0x3192('0x2a')];var _0x246643={'method':_0x3192('0xc'),'uri':_0x4838e8+'contacts','body':{'telephone1':_0x495fc5,'fullname':_0x495fc5,'firstname':_0x495fc5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3192('0x2b')+_0x54dc39['userId']+')'},'headers':{'Authorization':_0x3192('0x17')+_0x4ba494,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x246643);})[_0x3192('0x19')](function(_0x21b999){var _0x2d8f9b=_0x21b999['headers'][_0x3192('0x2c')];var _0x1f164b=_0x2d8f9b[_0x3192('0x2d')](_0x2d8f9b[_0x3192('0x2e')]('(')+0x1,_0x2d8f9b[_0x3192('0x2e')](')'));_0x54dc39[_0x3192('0x2f')]=_0x1f164b;_0x5c0ae6(_0x54dc39);})['catch'](function(_0x476bbb){_0x492874(_0x476bbb[_0x3192('0x16')]);});});}function getEndUser(_0x21335a,_0xdccbf,_0x282fbd,_0x5dfc9d,_0x1a6180,_0x4cafa6){return new BPromise(function(_0x57fff2,_0x297e1b){var _0x3ebb22=_0x4cafa6[_0x3192('0x30')]()===_0x3192('0x28')?_0x1a6180[_0x3192('0x29')]:_0x1a6180['calleridnum'];return getAuthToken(_0xdccbf,_0x282fbd,_0x4cafa6)['then'](function(_0x4f6ca2){var _0x2b0add={'method':_0x3192('0x31'),'uri':_0x5dfc9d+_0x3192('0x32')+_0x3ebb22['replace']('+',_0x3192('0x33'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4f6ca2,'If-None-Match':null,'OData-Version':_0x3192('0x18')},'json':!![]};return rp(_0x2b0add);})[_0x3192('0x19')](function(_0x10f79b){var _0x45c1cf=null;if(_0x10f79b){var _0x10598e=_0x10f79b[_0x3192('0x1a')];var _0x51ce23=![];for(_0x45c1cf=0x0;_0x45c1cf<_0x10598e['length'];_0x45c1cf++){if(_0x10598e[_0x45c1cf][_0x3192('0x34')]===_0x3ebb22){_0x51ce23=!![];_0x21335a['enduserId']=_0x10598e[_0x45c1cf]['contactid'];}}if(_0x51ce23){_0x57fff2(_0x21335a);}else{return createEndUser(_0x21335a,_0xdccbf,_0x282fbd,_0x5dfc9d,_0x1a6180,_0x4cafa6)[_0x3192('0x19')](function(_0x2d6c8e){logger[_0x3192('0x22')]('['+[_0x4cafa6[_0x3192('0x14')]()]+_0x3192('0x35'),_0x2d6c8e[_0x3192('0x2f')]);_0x57fff2(_0x2d6c8e);});}}else{return createEndUser(_0x21335a,_0xdccbf,_0x282fbd,_0x5dfc9d,_0x1a6180,_0x4cafa6)[_0x3192('0x19')](function(_0x53372b){logger[_0x3192('0x22')]('['+[_0x4cafa6[_0x3192('0x14')]()]+_0x3192('0x36'),_0x53372b['enduserId']);_0x57fff2(_0x53372b);});}});});}function getCustomFields(_0x3162d7,_0x42dad4,_0x3a53c9){var _0x2a8177={};if(_0x3162d7['length']>0x0){_[_0x3192('0x37')](_0x3162d7,function(_0x281565){if(_[_0x3192('0x38')]([_0x3192('0x39'),_0x3192('0x3a')],_0x281565[_0x3192('0x3b')])&&_0x281565[_0x3192('0x3c')]&&!_0x281565['customField']){var _0x5ae33e=_0x281565[_0x3192('0x3d')][_0x3192('0x30')]();var _0x478210=_0x5ae33e[_0x3192('0x2d')](0x0,_0x5ae33e[_0x3192('0x3e')]('_'));var _0x1f4b88=_0x5ae33e['substring'](_0x5ae33e[_0x3192('0x3e')]('_')+0x1);if(_0x478210===_0x3a53c9){_0x2a8177[_0x1f4b88]=_0x281565[_0x3192('0x3f')];}}});}return _0x2a8177;}function getTicket(_0x152c34,_0x4eebf7,_0x5c2afa,_0x3a6361,_0xf755f9,_0x4f14af,_0x591f5f){return new BPromise(function(_0x2a411e,_0x4c0da5){var _0x5c5e4f;return getAuthToken(_0x4eebf7,_0x5c2afa,_0x591f5f)[_0x3192('0x19')](function(_0x4a423b){if(_0x4f14af[_0x3192('0x40')]===_0x3192('0x41')){_0x5c5e4f={'method':_0x3192('0xc'),'uri':_0x3a6361+_0x3192('0x42'),'body':Object['assign']({},{'title':intUtil[_0x3192('0x43')](_0x4f14af['Subjects'],_0xf755f9,'\x20'),'description':intUtil['getString'](_0x4f14af[_0x3192('0x44')],_0xf755f9,'\x0a'),'customerid_contact@odata.bind':_0x3192('0x45')+_0x152c34[_0x3192('0x2f')]+')','ownerid@odata.bind':_0x3192('0x2b')+_0x152c34['userId']+')','caseorigincode':'1'},getCustomFields(_0x4f14af[_0x3192('0x46')],_0xf755f9,_0x4f14af[_0x3192('0x40')])),'headers':{'Authorization':_0x3192('0x17')+_0x4a423b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4f14af['ticketType']==='phonecall'){_0x5c5e4f={'method':_0x3192('0xc'),'uri':_0x3a6361+_0x3192('0x47'),'body':Object[_0x3192('0x48')]({},{'subject':intUtil[_0x3192('0x43')](_0x4f14af[_0x3192('0x49')],_0xf755f9,'\x20'),'phonenumber':String(_0xf755f9['calleridnum']),'description':intUtil['getString'](_0x4f14af[_0x3192('0x44')],_0xf755f9,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3192('0x45')+_0x152c34[_0x3192('0x2f')]+')','ownerid@odata.bind':_0x3192('0x2b')+_0x152c34[_0x3192('0x24')]+')','directioncode':_0x152c34[_0x3192('0x4a')]===_0x3192('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3192('0x2b')+_0x152c34[_0x3192('0x24')]+')','participationtypemask':_0x152c34[_0x3192('0x4a')]===_0x3192('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x3192('0x45')+_0x152c34[_0x3192('0x2f')]+')','participationtypemask':_0x152c34[_0x3192('0x4a')]==='queue'?0x1:0x2}]},getCustomFields(_0x4f14af[_0x3192('0x46')],_0xf755f9,_0x4f14af[_0x3192('0x40')])),'headers':{'Authorization':_0x3192('0x17')+_0x4a423b,'OData-Version':_0x3192('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5c5e4f);})[_0x3192('0x19')](function(_0xcbfb18){var _0xc9ad85=_0xcbfb18[_0x3192('0x4c')][_0x3192('0x2c')];var _0xeee1ec=_0xc9ad85[_0x3192('0x2d')](_0xc9ad85[_0x3192('0x2e')]('(')+0x1,_0xc9ad85[_0x3192('0x2e')](')'));_0x152c34['ticketId']=_0xeee1ec;_0x2a411e(_0x152c34);})[_0x3192('0x27')](function(_0x100e0b){_0x4c0da5(_0x100e0b[_0x3192('0x16')]);});});}function emit(_0x2e466e,_0x5557f2,_0x5090ac,_0xf4b8c9){var _0x400848={'uri':util[_0x3192('0x4d')](_0x3192('0x4e'),_0x2e466e,_0x5090ac,_0xf4b8c9)};io['to'](util['format'](_0x3192('0x4f'),_0x5557f2))[_0x3192('0x50')](_0x3192('0x51'),_0x400848);}exports['cs']=function(_0x32d4b1,_0x5f4291,_0x1866d9,_0x48ccbc,_0x36fdc5,_0xa2e823,_0x29d0d4,_0x47b3ff){var _0xad2c94={};_0xa2e823[_0x3192('0xe')]=intUtil[_0x3192('0x52')](_0xa2e823[_0x3192('0xe')]);_0xa2e823['serverUrl']=intUtil[_0x3192('0x52')](_0xa2e823['serverUrl']);_0xad2c94['callDirection']=_0x47b3ff===_0x3192('0x4b')||_0x47b3ff===_0x3192('0x53')?_0x3192('0x4b'):_0x3192('0x28');var _0x1fc101=util[_0x3192('0x4d')]('%s/api/data/v9.0/',_0xa2e823[_0x3192('0xe')]);var _0x365a01=util[_0x3192('0x4d')]('https://login.microsoftonline.com/%s/oauth2/token',_0xa2e823[_0x3192('0x54')]);var _0x4336d2=util[_0x3192('0x4d')](_0x3192('0x55'),_0xa2e823[_0x3192('0x56')],_0x5f4291[_0x3192('0x57')],md5(_0x5f4291[_0x3192('0x57')]));if(_0x36fdc5&&_0x36fdc5[_0x3192('0x58')]){logger[_0x3192('0x22')](_0x3192('0x59'),'Recording\x20is\x20enabled!');_0x5f4291['recordingURL']=_0x4336d2;}else if(_0x29d0d4&&_0x29d0d4['recordingFormat']&&_0x29d0d4['recordingFormat']!==_0x3192('0x5a')){logger[_0x3192('0x22')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5f4291['recordingURL']=_0x4336d2;}else{_0x5f4291['recordingURL']='';}return getUser(_0xad2c94,_0xa2e823,_0x48ccbc,_0x365a01,_0x1fc101,_0x47b3ff)[_0x3192('0x19')](function(_0x5dfd66){logger['info']('['+_0x47b3ff[_0x3192('0x14')]()+_0x3192('0x5b'),_0x5dfd66[_0x3192('0x24')]);logger['info']('['+_0x47b3ff[_0x3192('0x14')]()+_0x3192('0x5c'),_0x5dfd66[_0x3192('0x1e')]);return getEndUser(_0x5dfd66,_0xa2e823,_0x365a01,_0x1fc101,_0x5f4291,_0x47b3ff);})[_0x3192('0x19')](function(_0x2d9028){logger[_0x3192('0x22')]('['+_0x47b3ff['toUpperCase']()+_0x3192('0x5d'),_0x2d9028[_0x3192('0x2f')]);logger[_0x3192('0x22')]('['+_0x47b3ff['toUpperCase']()+_0x3192('0x5e'),_0x5f4291[_0x3192('0x2a')]);return getTicket(_0x2d9028,_0xa2e823,_0x365a01,_0x1fc101,_0x5f4291,_0x1866d9,_0x47b3ff);})[_0x3192('0x19')](function(_0x5e73f9){logger['info'](util[_0x3192('0x4d')]('['+_0x47b3ff[_0x3192('0x14')]()+_0x3192('0x5f'),_0x1866d9['ticketType'],_0x5e73f9[_0x3192('0x60')]));logger[_0x3192('0x22')](util['format']('['+_0x47b3ff['toUpperCase']()+_0x3192('0x61'),_0x47b3ff));if(_0x47b3ff!==_0x3192('0x53')){logger[_0x3192('0x22')]('['+_0x47b3ff['toUpperCase']()+']',_0x3192('0x62'));emit(_0xa2e823[_0x3192('0xe')],_0x48ccbc['name'],_0x1866d9[_0x3192('0x40')],_0x5e73f9[_0x3192('0x60')]);}})['catch'](function(_0x48a860){logger[_0x3192('0x13')]('['+_0x47b3ff[_0x3192('0x14')]()+_0x3192('0x63'),util[_0x3192('0x64')](_0x48a860,{'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 7bea50e..61ffcd7 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 _0x2b00=['recordingFormat','none','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','defaults','redis','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname','getString','Subjects','Descriptions','name','Fields','mapValues','keyBy','value','%s/api/v2/tickets','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','Agent\x20found!','find','contact','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','length','forEach','includes','string','nameField','customField','toLowerCase','picklist','type','custom_fields','push','idField','content','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound'];(function(_0x14f4a0,_0x397933){var _0xa5e0d1=function(_0x4ff0a8){while(--_0x4ff0a8){_0x14f4a0['push'](_0x14f4a0['shift']());}};_0xa5e0d1(++_0x397933);}(_0x2b00,0x1de));var _0x02b0=function(_0x4fd75d,_0x167b74){_0x4fd75d=_0x4fd75d-0x0;var _0x575327=_0x2b00[_0x4fd75d];return _0x575327;};'use strict';var _=require(_0x02b0('0x0'));var rp=require(_0x02b0('0x1'));var md5=require('md5');var util=require(_0x02b0('0x2'));var Redis=require(_0x02b0('0x3'));var intUtil=require(_0x02b0('0x4'));var config=require(_0x02b0('0x5'));var logger=require('../../../../config/logger')(_0x02b0('0x6'));config['redis']=_[_0x02b0('0x7')](config[_0x02b0('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x02b0('0x9'))(new Redis(config[_0x02b0('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x02b0('0xa')};function emit(_0x1defcd,_0x4e0957,_0x511e91){io['to'](_0x1defcd)[_0x02b0('0xb')](_0x4e0957,_0x511e91);}function getTicket(_0x285a45,_0x4c3f36,_0xccf157,_0x44eaea,_0x5ea0ff){logger['info'](_0x02b0('0xc'));var _0x2f7f5b=_[_0x02b0('0xd')]({'responder_id':_0x4c3f36['id'],'requester_id':_0xccf157['id'],'name':util[_0x02b0('0xe')]('Caller\x20-\x20%s',_0x5ea0ff[_0x02b0('0xf')]),'phone':_0x5ea0ff['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x02b0('0x10')](_0x44eaea[_0x02b0('0x11')],_0x5ea0ff,'\x20'),'description':intUtil[_0x02b0('0x10')](_0x44eaea[_0x02b0('0x12')],_0x5ea0ff,'
'),'tags':getTags(_0x44eaea['Tags'],_0x02b0('0x13'))},getCustomFields(_0x44eaea[_0x02b0('0x14')],_0x5ea0ff));_0x2f7f5b['custom_fields']=_[_0x02b0('0x15')](_[_0x02b0('0x16')](_0x2f7f5b['custom_fields'],'id'),_0x02b0('0x17'));return request({'uri':util[_0x02b0('0xe')](_0x02b0('0x18'),_0x285a45['remoteUri']),'method':'POST','body':_0x2f7f5b})[_0x02b0('0x19')](function(_0x485e15){logger[_0x02b0('0x1a')](_0x02b0('0x1b'));return _0x485e15;});}function getUser(_0x1f8b99,_0x3e1df3){if(intUtil[_0x02b0('0x1c')](_0x3e1df3)){return request({'uri':util[_0x02b0('0xe')](_0x02b0('0x1d'),_0x1f8b99[_0x02b0('0x1e')]),'qs':{'email':_0x3e1df3}})[_0x02b0('0x19')](function(_0x3d3ddf){if(_0x3d3ddf['length']){logger[_0x02b0('0x1a')](_0x02b0('0x1f'));return _[_0x02b0('0x20')](_0x3d3ddf,function(_0x1c2f61){return _0x1c2f61[_0x02b0('0x21')]['email']===_0x3e1df3;});}else{logger[_0x02b0('0x1a')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x1f8b99[_0x02b0('0x1e')])})['then'](function(_0x4dc4e0){logger[_0x02b0('0x1a')](_0x02b0('0x22'));return _0x4dc4e0;});}});}else{logger[_0x02b0('0x1a')](_0x02b0('0x23'));return request({'uri':util[_0x02b0('0xe')]('%s/api/v2/agents/me',_0x1f8b99['remoteUri'])})[_0x02b0('0x19')](function(_0x5caa28){logger[_0x02b0('0x1a')](_0x02b0('0x22'));return _0x5caa28;});}}function getEndUser(_0xa51bb1,_0x13848d,_0x48c906){logger[_0x02b0('0x1a')](_0x02b0('0x24'),_0x48c906);return request({'uri':util[_0x02b0('0xe')](_0x02b0('0x25'),_0xa51bb1[_0x02b0('0x1e')]),'qs':{'phone':_0x48c906}})['then'](function(_0x452e68){if(_0x452e68['length']){logger[_0x02b0('0x1a')](_0x02b0('0x26'));return _[_0x02b0('0x20')](_0x452e68,{'phone':_0x48c906});}else{logger[_0x02b0('0x1a')](_0x02b0('0x27'));return request({'uri':util[_0x02b0('0xe')](_0x02b0('0x25'),_0xa51bb1[_0x02b0('0x1e')]),'method':_0x02b0('0x28'),'body':{'name':_0x13848d,'phone':_0x48c906}})[_0x02b0('0x19')](function(_0x1ea51){logger[_0x02b0('0x1a')](_0x02b0('0x29'));return _0x1ea51;});}});}function getAuth(_0x2cb935){return util[_0x02b0('0xe')](_0x02b0('0x2a'),new Buffer(_0x2cb935[_0x02b0('0x2b')]+':X')[_0x02b0('0x2c')](_0x02b0('0x2d')));}function request(_0x553871){logger[_0x02b0('0x2e')](_0x02b0('0x2f'),JSON[_0x02b0('0x30')](_0x553871));return rp(_[_0x02b0('0x7')](_0x553871,{'method':_0x02b0('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1b8d8a,_0x365b2c){var _0x3a9493=[];if(_0x1b8d8a&&_0x1b8d8a[_0x02b0('0x32')]>0x0){_0x3a9493=_['map'](_0x1b8d8a,_0x365b2c);}return _0x3a9493;}function getCustomFields(_0x13ad96,_0x3ac59f){var _0x40667e=[];var _0x2c5110={'custom_fields':[]};if(_0x13ad96['length']>0x0){_[_0x02b0('0x33')](_0x13ad96,function(_0xf38640){if(_[_0x02b0('0x34')]([_0x02b0('0x35'),'picklist'],_0xf38640['type'])&&_0xf38640[_0x02b0('0x36')]&&!_0xf38640[_0x02b0('0x37')]){_0x2c5110[_0xf38640['nameField'][_0x02b0('0x38')]()]=_0xf38640['content']['toString']();}else if(_[_0x02b0('0x34')]([_0x02b0('0x35'),_0x02b0('0x39')],_0xf38640[_0x02b0('0x3a')])&&_0xf38640['idField']&&_0xf38640[_0x02b0('0x37')]){_0x2c5110[_0x02b0('0x3b')][_0x02b0('0x3c')]({'id':_0xf38640[_0x02b0('0x3d')],'value':_0xf38640[_0x02b0('0x3e')][_0x02b0('0x2c')]()});}else if(_0xf38640[_0x02b0('0x3a')]===_0x02b0('0x3f')&&_0xf38640[_0x02b0('0x40')]&&_0xf38640[_0x02b0('0x3d')]&&_0xf38640[_0x02b0('0x37')]){_0x3ac59f[_0xf38640[_0x02b0('0x40')]]&&_0x2c5110['custom_fields'][_0x02b0('0x3c')]({'id':_0xf38640[_0x02b0('0x3d')],'value':_0x3ac59f[_0xf38640[_0x02b0('0x40')]]['toString']()});}else if(_0xf38640[_0x02b0('0x3a')]==='customVariable'&&_0xf38640[_0x02b0('0x41')]&&_0xf38640[_0x02b0('0x41')][_0x02b0('0x13')]&&_0xf38640[_0x02b0('0x3d')]&&_0xf38640[_0x02b0('0x37')]){_0x3ac59f[_0xf38640['Variable'][_0x02b0('0x13')][_0x02b0('0x38')]()]&&_0x2c5110[_0x02b0('0x3b')]['push']({'id':_0xf38640[_0x02b0('0x3d')],'value':_0x3ac59f[_0xf38640[_0x02b0('0x41')][_0x02b0('0x13')][_0x02b0('0x38')]()][_0x02b0('0x2c')]()});}});}return _0x2c5110;}exports[_0x02b0('0x42')]=function(_0x433603,_0x875ca7,_0x314fdf,_0x2861d5,_0x5cafb7,_0x3fa075){var _0x2f674e,_0x450b16;_0x3fa075[_0x02b0('0x1e')]=intUtil[_0x02b0('0x43')](_0x3fa075['remoteUri']);_0x3fa075[_0x02b0('0x44')]=intUtil[_0x02b0('0x43')](_0x3fa075[_0x02b0('0x44')]);if(_0x5cafb7&&_0x5cafb7[_0x02b0('0x45')]){logger[_0x02b0('0x1a')](_0x02b0('0x46'),_0x02b0('0x47'));_0x875ca7[_0x02b0('0x48')]=util[_0x02b0('0xe')](_0x02b0('0x49'),_0x3fa075['serverUrl'],_0x875ca7[_0x02b0('0x4a')],md5(_0x875ca7['uniqueid']));}else{_0x875ca7[_0x02b0('0x48')]='';}headers[_0x02b0('0x4b')]=getAuth(_0x3fa075);return getUser(_0x3fa075,_0x2861d5[_0x02b0('0x4c')])[_0x02b0('0x19')](function(_0x97da6d){_0x2f674e=_0x97da6d;logger[_0x02b0('0x1a')](_0x02b0('0x4d'),_0x2f674e['id']);return getEndUser(_0x3fa075,_0x875ca7[_0x02b0('0xf')],_0x875ca7[_0x02b0('0x4e')]);})[_0x02b0('0x19')](function(_0x9e7259){_0x450b16=_0x9e7259;logger[_0x02b0('0x1a')](_0x02b0('0x4f'),_0x450b16['id']);return getTicket(_0x3fa075,_0x2f674e,_0x450b16,_0x314fdf,_0x875ca7);})[_0x02b0('0x19')](function(_0xfd8686){if(_0xfd8686&&_0xfd8686['id']){logger[_0x02b0('0x1a')](_0x02b0('0x1b'));logger[_0x02b0('0x1a')]('The\x20Ticket\x20ID\x20is:',_0xfd8686['id']);logger[_0x02b0('0x1a')](_0x02b0('0x46'),_0x02b0('0x50'));emit(util[_0x02b0('0xe')](_0x02b0('0x51'),_0x2861d5['name']),_0x02b0('0x52'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x3fa075[_0x02b0('0x1e')],_0xfd8686['id'])});}})[_0x02b0('0x53')](function(_0x1cafc9){logger[_0x02b0('0x54')](_0x02b0('0x46'),JSON['stringify'](_0x1cafc9));});};exports[_0x02b0('0x55')]=function(_0x4cfebd,_0x5dc202,_0x25da9f,_0x31592d,_0x25731d,_0x4468d4,_0x21ddf3){var _0x58f688,_0x54ea63;_0x4468d4['remoteUri']=intUtil[_0x02b0('0x43')](_0x4468d4[_0x02b0('0x1e')]);_0x4468d4[_0x02b0('0x44')]=intUtil[_0x02b0('0x43')](_0x4468d4[_0x02b0('0x44')]);if(_0x21ddf3&&_0x21ddf3[_0x02b0('0x56')]&&_0x21ddf3[_0x02b0('0x56')]!==_0x02b0('0x57')){logger[_0x02b0('0x1a')]('[OUTBOUND]',_0x02b0('0x47'));_0x5dc202[_0x02b0('0x48')]=util['format'](_0x02b0('0x49'),_0x4468d4['serverUrl'],_0x5dc202[_0x02b0('0x4a')],md5(_0x5dc202['uniqueid']));}headers[_0x02b0('0x4b')]=getAuth(_0x4468d4);return getUser(_0x4468d4,_0x31592d[_0x02b0('0x4c')])[_0x02b0('0x19')](function(_0x11cf22){_0x58f688=_0x11cf22;logger[_0x02b0('0x1a')](_0x02b0('0x4d'),_0x58f688['id']);return getEndUser(_0x4468d4,_0x5dc202['destcalleridname'],_0x5dc202[_0x02b0('0x58')]);})[_0x02b0('0x19')](function(_0x56e92f){_0x54ea63=_0x56e92f;logger[_0x02b0('0x1a')](_0x02b0('0x4f'),_0x54ea63['id']);return getTicket(_0x4468d4,_0x58f688,_0x54ea63,_0x25da9f,_0x5dc202);})['then'](function(_0x2101bf){if(_0x2101bf&&_0x2101bf['id']){logger['info'](_0x02b0('0x1b'));logger[_0x02b0('0x1a')](_0x02b0('0x59'),_0x2101bf['id']);logger[_0x02b0('0x1a')](_0x02b0('0x5a'),_0x02b0('0x50'));emit(util[_0x02b0('0xe')](_0x02b0('0x51'),_0x31592d[_0x02b0('0x13')]),_0x02b0('0x52'),{'uri':util[_0x02b0('0xe')]('%s/helpdesk/tickets/%d',_0x4468d4['remoteUri'],_0x2101bf['id'])});}})[_0x02b0('0x53')](function(_0x3c4ca1){logger[_0x02b0('0x54')]('[OUTBOUND]',JSON[_0x02b0('0x30')](_0x3c4ca1));});};exports[_0x02b0('0x5b')]=function(_0x7fb140,_0x2daa50,_0x8d1d0e,_0x25b226,_0x26c9be,_0x45c68c){var _0x54d684,_0x54a16f;_0x45c68c[_0x02b0('0x1e')]=intUtil['stripTrailingSlash'](_0x45c68c['remoteUri']);_0x45c68c['serverUrl']=intUtil['stripTrailingSlash'](_0x45c68c[_0x02b0('0x44')]);if(_0x26c9be&&_0x26c9be[_0x02b0('0x45')]){logger[_0x02b0('0x1a')]('['+_0x2daa50[_0x02b0('0x5c')][_0x02b0('0x5d')]()+']',_0x02b0('0x47'));_0x2daa50['recordingURL']=util[_0x02b0('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x45c68c[_0x02b0('0x44')],_0x2daa50[_0x02b0('0x4a')],md5(_0x2daa50[_0x02b0('0x4a')]));}else{_0x2daa50[_0x02b0('0x48')]='';}headers['Authorization']=getAuth(_0x45c68c);return getUser(_0x45c68c,'')[_0x02b0('0x19')](function(_0x1cd1eb){_0x54d684=_0x1cd1eb;logger[_0x02b0('0x1a')](_0x02b0('0x4d'),_0x54d684['id']);return getEndUser(_0x45c68c,_0x2daa50[_0x02b0('0xf')],_0x2daa50[_0x02b0('0x4e')]);})['then'](function(_0xb5ee10){_0x54a16f=_0xb5ee10;logger['info'](_0x02b0('0x4f'),_0x54a16f['id']);return getTicket(_0x45c68c,_0x54d684,_0x54a16f,_0x8d1d0e,_0x2daa50);})['then'](function(_0x369a36){if(_0x369a36){logger[_0x02b0('0x1a')](_0x02b0('0x1b'));logger[_0x02b0('0x1a')]('The\x20Ticket\x20ID\x20is:',_0x369a36['id']);}})[_0x02b0('0x53')](function(_0x3c7132){logger[_0x02b0('0x54')]('['+_0x2daa50[_0x02b0('0x5c')][_0x02b0('0x5d')]()+']',JSON['stringify'](_0x3c7132));});}; \ No newline at end of file +var _0x6413=['[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:','unmanaged','lastevent','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','localhost','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','Subjects','getString','Descriptions','
','name','Fields','custom_fields','mapValues','value','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug'];(function(_0x3ed4d7,_0x3783e0){var _0x2be1a4=function(_0x5d492f){while(--_0x5d492f){_0x3ed4d7['push'](_0x3ed4d7['shift']());}};_0x2be1a4(++_0x3783e0);}(_0x6413,0x155));var _0x3641=function(_0x303c33,_0x3b78fb){_0x303c33=_0x303c33-0x0;var _0x4e2322=_0x6413[_0x303c33];return _0x4e2322;};'use strict';var _=require('lodash');var rp=require(_0x3641('0x0'));var md5=require(_0x3641('0x1'));var util=require('util');var Redis=require(_0x3641('0x2'));var intUtil=require(_0x3641('0x3'));var config=require(_0x3641('0x4'));var logger=require(_0x3641('0x5'))(_0x3641('0x6'));config['redis']=_[_0x3641('0x7')](config['redis'],{'host':_0x3641('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3641('0x9')]));var headers={'Content-Type':_0x3641('0xa'),'Accept':'application/json'};function emit(_0x4e3155,_0xceede7,_0x16ecd1){io['to'](_0x4e3155)[_0x3641('0xb')](_0xceede7,_0x16ecd1);}function getTicket(_0x285c26,_0x18fa4a,_0xe9ccbf,_0x25f8b0,_0x368b48){logger[_0x3641('0xc')](_0x3641('0xd'));var _0x40fe89=_[_0x3641('0xe')]({'responder_id':_0x18fa4a['id'],'requester_id':_0xe9ccbf['id'],'name':util[_0x3641('0xf')](_0x3641('0x10'),_0x368b48['calleridname']),'phone':_0x368b48['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x25f8b0[_0x3641('0x11')],_0x368b48,'\x20'),'description':intUtil[_0x3641('0x12')](_0x25f8b0[_0x3641('0x13')],_0x368b48,_0x3641('0x14')),'tags':getTags(_0x25f8b0['Tags'],_0x3641('0x15'))},getCustomFields(_0x25f8b0[_0x3641('0x16')],_0x368b48));_0x40fe89[_0x3641('0x17')]=_[_0x3641('0x18')](_['keyBy'](_0x40fe89[_0x3641('0x17')],'id'),_0x3641('0x19'));return request({'uri':util[_0x3641('0xf')]('%s/api/v2/tickets',_0x285c26[_0x3641('0x1a')]),'method':_0x3641('0x1b'),'body':_0x40fe89})[_0x3641('0x1c')](function(_0x435a63){logger['info']('Ticket\x20created!');return _0x435a63;});}function getUser(_0x5ad896,_0x3b7e6b){if(intUtil[_0x3641('0x1d')](_0x3b7e6b)){return request({'uri':util[_0x3641('0xf')](_0x3641('0x1e'),_0x5ad896[_0x3641('0x1a')]),'qs':{'email':_0x3b7e6b}})['then'](function(_0x1c82d4){if(_0x1c82d4[_0x3641('0x1f')]){logger[_0x3641('0xc')](_0x3641('0x20'));return _[_0x3641('0x21')](_0x1c82d4,function(_0xd392b){return _0xd392b[_0x3641('0x22')][_0x3641('0x23')]===_0x3b7e6b;});}else{logger[_0x3641('0xc')](_0x3641('0x24'));return request({'uri':util[_0x3641('0xf')]('%s/api/v2/agents/me',_0x5ad896[_0x3641('0x1a')])})[_0x3641('0x1c')](function(_0x1aa228){logger[_0x3641('0xc')](_0x3641('0x25'));return _0x1aa228;});}});}else{logger['info'](_0x3641('0x26'));return request({'uri':util[_0x3641('0xf')](_0x3641('0x27'),_0x5ad896[_0x3641('0x1a')])})[_0x3641('0x1c')](function(_0x592d93){logger[_0x3641('0xc')]('Admin\x20account\x20selected.');return _0x592d93;});}}function getEndUser(_0x5e17bf,_0x173607,_0x51f5d9){logger['info']('Searching\x20enduser\x20with\x20phone',_0x51f5d9);return request({'uri':util[_0x3641('0xf')](_0x3641('0x28'),_0x5e17bf[_0x3641('0x1a')]),'qs':{'phone':_0x51f5d9}})['then'](function(_0x102e32){if(_0x102e32[_0x3641('0x1f')]){logger['info']('Enduser\x20found!');return _[_0x3641('0x21')](_0x102e32,{'phone':_0x51f5d9});}else{logger['info'](_0x3641('0x29'));return request({'uri':util['format'](_0x3641('0x28'),_0x5e17bf[_0x3641('0x1a')]),'method':_0x3641('0x1b'),'body':{'name':_0x173607,'phone':_0x51f5d9}})[_0x3641('0x1c')](function(_0x4c02a5){logger['info'](_0x3641('0x2a'));return _0x4c02a5;});}});}function getAuth(_0x4dcedc){return util[_0x3641('0xf')](_0x3641('0x2b'),new Buffer(_0x4dcedc[_0x3641('0x2c')]+':X')['toString'](_0x3641('0x2d')));}function request(_0x2e1643){logger[_0x3641('0x2e')](_0x3641('0x2f'),JSON[_0x3641('0x30')](_0x2e1643));return rp(_[_0x3641('0x7')](_0x2e1643,{'method':_0x3641('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x4e4294,_0x2157ab){var _0x324af4=[];if(_0x4e4294&&_0x4e4294['length']>0x0){_0x324af4=_[_0x3641('0x32')](_0x4e4294,_0x2157ab);}return _0x324af4;}function getCustomFields(_0x38eb68,_0x57419a){var _0xbf48b0=[];var _0x234f34={'custom_fields':[]};if(_0x38eb68[_0x3641('0x1f')]>0x0){_[_0x3641('0x33')](_0x38eb68,function(_0x42fcff){if(_[_0x3641('0x34')]([_0x3641('0x35'),_0x3641('0x36')],_0x42fcff[_0x3641('0x37')])&&_0x42fcff[_0x3641('0x38')]&&!_0x42fcff[_0x3641('0x39')]){_0x234f34[_0x42fcff[_0x3641('0x38')][_0x3641('0x3a')]()]=_0x42fcff[_0x3641('0x3b')][_0x3641('0x3c')]();}else if(_[_0x3641('0x34')](['string',_0x3641('0x36')],_0x42fcff[_0x3641('0x37')])&&_0x42fcff[_0x3641('0x3d')]&&_0x42fcff[_0x3641('0x39')]){_0x234f34['custom_fields']['push']({'id':_0x42fcff[_0x3641('0x3d')],'value':_0x42fcff['content'][_0x3641('0x3c')]()});}else if(_0x42fcff['type']===_0x3641('0x3e')&&_0x42fcff['variableName']&&_0x42fcff[_0x3641('0x3d')]&&_0x42fcff[_0x3641('0x39')]){_0x57419a[_0x42fcff[_0x3641('0x3f')]]&&_0x234f34['custom_fields'][_0x3641('0x40')]({'id':_0x42fcff[_0x3641('0x3d')],'value':_0x57419a[_0x42fcff['variableName']]['toString']()});}else if(_0x42fcff[_0x3641('0x37')]===_0x3641('0x41')&&_0x42fcff[_0x3641('0x42')]&&_0x42fcff[_0x3641('0x42')][_0x3641('0x15')]&&_0x42fcff[_0x3641('0x3d')]&&_0x42fcff[_0x3641('0x39')]){_0x57419a[_0x42fcff['Variable'][_0x3641('0x15')][_0x3641('0x3a')]()]&&_0x234f34['custom_fields'][_0x3641('0x40')]({'id':_0x42fcff[_0x3641('0x3d')],'value':_0x57419a[_0x42fcff['Variable'][_0x3641('0x15')][_0x3641('0x3a')]()][_0x3641('0x3c')]()});}});}return _0x234f34;}exports[_0x3641('0x43')]=function(_0x1f86be,_0x59b89a,_0x4003d9,_0x4437fc,_0x1b2381,_0x31f89c){var _0x23661e,_0x2f83b6;_0x31f89c[_0x3641('0x1a')]=intUtil[_0x3641('0x44')](_0x31f89c[_0x3641('0x1a')]);_0x31f89c[_0x3641('0x45')]=intUtil[_0x3641('0x44')](_0x31f89c['serverUrl']);if(_0x1b2381&&_0x1b2381[_0x3641('0x46')]){logger[_0x3641('0xc')](_0x3641('0x47'),_0x3641('0x48'));_0x59b89a[_0x3641('0x49')]=util[_0x3641('0xf')](_0x3641('0x4a'),_0x31f89c[_0x3641('0x45')],_0x59b89a[_0x3641('0x4b')],md5(_0x59b89a[_0x3641('0x4b')]));}else{_0x59b89a[_0x3641('0x49')]='';}headers[_0x3641('0x4c')]=getAuth(_0x31f89c);return getUser(_0x31f89c,_0x4437fc[_0x3641('0x23')])['then'](function(_0x4c5d6c){_0x23661e=_0x4c5d6c;logger['info']('The\x20User\x20ID\x20is:',_0x23661e['id']);return getEndUser(_0x31f89c,_0x59b89a[_0x3641('0x4d')],_0x59b89a[_0x3641('0x4e')]);})['then'](function(_0x16ea63){_0x2f83b6=_0x16ea63;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2f83b6['id']);return getTicket(_0x31f89c,_0x23661e,_0x2f83b6,_0x4003d9,_0x59b89a);})[_0x3641('0x1c')](function(_0x115f15){if(_0x115f15&&_0x115f15['id']){logger[_0x3641('0xc')](_0x3641('0x4f'));logger[_0x3641('0xc')](_0x3641('0x50'),_0x115f15['id']);logger[_0x3641('0xc')]('[QUEUE]',_0x3641('0x51'));emit(util[_0x3641('0xf')](_0x3641('0x52'),_0x4437fc['name']),_0x3641('0x53'),{'uri':util['format'](_0x3641('0x54'),_0x31f89c[_0x3641('0x1a')],_0x115f15['id'])});}})[_0x3641('0x55')](function(_0x34171b){logger[_0x3641('0x56')](_0x3641('0x47'),JSON[_0x3641('0x30')](_0x34171b));});};exports[_0x3641('0x57')]=function(_0x593f2f,_0x4e2723,_0x19f456,_0x1ea1a8,_0x2416be,_0x22d45a,_0x30561d){var _0x36e006,_0x46f3b7;_0x22d45a[_0x3641('0x1a')]=intUtil[_0x3641('0x44')](_0x22d45a[_0x3641('0x1a')]);_0x22d45a[_0x3641('0x45')]=intUtil[_0x3641('0x44')](_0x22d45a['serverUrl']);if(_0x30561d&&_0x30561d[_0x3641('0x58')]&&_0x30561d[_0x3641('0x58')]!==_0x3641('0x59')){logger[_0x3641('0xc')](_0x3641('0x5a'),'Recording\x20is\x20enabled!');_0x4e2723[_0x3641('0x49')]=util[_0x3641('0xf')](_0x3641('0x4a'),_0x22d45a[_0x3641('0x45')],_0x4e2723[_0x3641('0x4b')],md5(_0x4e2723[_0x3641('0x4b')]));}headers[_0x3641('0x4c')]=getAuth(_0x22d45a);return getUser(_0x22d45a,_0x1ea1a8[_0x3641('0x23')])[_0x3641('0x1c')](function(_0x26e79){_0x36e006=_0x26e79;logger[_0x3641('0xc')](_0x3641('0x5b'),_0x36e006['id']);return getEndUser(_0x22d45a,_0x4e2723[_0x3641('0x5c')],_0x4e2723['destcalleridnum']);})[_0x3641('0x1c')](function(_0x315e13){_0x46f3b7=_0x315e13;logger[_0x3641('0xc')](_0x3641('0x5d'),_0x46f3b7['id']);return getTicket(_0x22d45a,_0x36e006,_0x46f3b7,_0x19f456,_0x4e2723);})[_0x3641('0x1c')](function(_0x38b84d){if(_0x38b84d&&_0x38b84d['id']){logger['info']('Ticket\x20created!');logger[_0x3641('0xc')](_0x3641('0x50'),_0x38b84d['id']);logger[_0x3641('0xc')](_0x3641('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3641('0x52'),_0x1ea1a8['name']),_0x3641('0x53'),{'uri':util[_0x3641('0xf')](_0x3641('0x54'),_0x22d45a[_0x3641('0x1a')],_0x38b84d['id'])});}})['catch'](function(_0x342eda){logger[_0x3641('0x56')](_0x3641('0x5a'),JSON[_0x3641('0x30')](_0x342eda));});};exports[_0x3641('0x5e')]=function(_0x572c71,_0x32dd1e,_0x34179e,_0x39977c,_0x4689b6,_0x25aa1a){var _0x28698c,_0x55a915;_0x25aa1a['remoteUri']=intUtil['stripTrailingSlash'](_0x25aa1a['remoteUri']);_0x25aa1a[_0x3641('0x45')]=intUtil[_0x3641('0x44')](_0x25aa1a['serverUrl']);if(_0x4689b6&&_0x4689b6['monitor_format']){logger[_0x3641('0xc')]('['+_0x32dd1e[_0x3641('0x5f')]['toUpperCase']()+']',_0x3641('0x48'));_0x32dd1e['recordingURL']=util[_0x3641('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25aa1a[_0x3641('0x45')],_0x32dd1e['uniqueid'],md5(_0x32dd1e[_0x3641('0x4b')]));}else{_0x32dd1e['recordingURL']='';}headers[_0x3641('0x4c')]=getAuth(_0x25aa1a);return getUser(_0x25aa1a,'')['then'](function(_0x3b6d8c){_0x28698c=_0x3b6d8c;logger[_0x3641('0xc')](_0x3641('0x5b'),_0x28698c['id']);return getEndUser(_0x25aa1a,_0x32dd1e[_0x3641('0x4d')],_0x32dd1e['calleridnum']);})[_0x3641('0x1c')](function(_0x53eb4a){_0x55a915=_0x53eb4a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x55a915['id']);return getTicket(_0x25aa1a,_0x28698c,_0x55a915,_0x34179e,_0x32dd1e);})['then'](function(_0x901781){if(_0x901781){logger['info'](_0x3641('0x4f'));logger['info'](_0x3641('0x50'),_0x901781['id']);}})['catch'](function(_0x434c35){logger['error']('['+_0x32dd1e[_0x3641('0x5f')][_0x3641('0x60')]()+']',JSON[_0x3641('0x30')](_0x434c35));});}; \ 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 c18eae9..1f7f525 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 _0x2eba=['callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name','inspect','lodash','md5','moment','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','headers','Getting\x20admin\x20information','then','users','email','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','Getting\x20user\x20list','agentEmail','userEmail','length','userId','adminEmail','message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','Task\x20created:','ticketId','/contacts/','user:%s','emit','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2eba,0x1f3));var _0xa2eb=function(_0x3383d6,_0x58a22c){_0x3383d6=_0x3383d6-0x0;var _0x5ccd7e=_0x2eba[_0x3383d6];return _0x5ccd7e;};'use strict';var _=require(_0xa2eb('0x0'));var rp=require('request-promise');var md5=require(_0xa2eb('0x1'));var util=require('util');var moment=require(_0xa2eb('0x2'));var Promise=require(_0xa2eb('0x3'));var Redis=require(_0xa2eb('0x4'));var intUtil=require(_0xa2eb('0x5'));var config=require(_0xa2eb('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0xa2eb('0x7')]=_[_0xa2eb('0x8')](config[_0xa2eb('0x7')],{'host':_0xa2eb('0x9'),'port':0x18eb});var io=require(_0xa2eb('0xa'))(new Redis(config[_0xa2eb('0x7')]));function getAdminId(_0x2cbec0,_0x34d234,_0x1c5c62,_0x388661){return new Promise(function(_0x48217c,_0x2c3a32){var _0x55ff6e=![];var _0x386a09={'method':_0xa2eb('0xb'),'uri':_0x388661+'/api/selector/owners','json':!![]};_0x386a09[_0xa2eb('0xc')]=_0x1c5c62;logger['info'](_0xa2eb('0xd'));return rp(_0x386a09)[_0xa2eb('0xe')](function(_0x4df951){if(_0x4df951){var _0x328c80=_0x4df951[_0xa2eb('0xf')];var _0x927814=null;for(_0x927814=0x0;_0x927814<_0x328c80['length'];_0x927814++){if(_0x328c80[_0x927814][_0xa2eb('0x10')]===_0x2cbec0['adminEmail']){_0x2cbec0[_0xa2eb('0x11')]=_0x328c80[_0x927814]['id'];_0x55ff6e=!![];}}if(_0x55ff6e){logger[_0xa2eb('0x12')]('Admin\x20found:',_0x2cbec0['adminId']);_0x48217c(_0x2cbec0);}else{_0x2c3a32({'statusCode':0x194,'message':_0xa2eb('0x13')});}}else{_0x2c3a32({'statusCode':0x194,'message':_0xa2eb('0x13')});}})[_0xa2eb('0x14')](function(_0x39ca64){logger[_0xa2eb('0x15')]('['+[_0x34d234[_0xa2eb('0x16')]()]+']',_0x39ca64['message']);_0x2c3a32(_0x39ca64);});});}function getUser(_0x2b9fc4,_0x36087b,_0x242b94){return function(_0x3518c9){return new Promise(function(_0x385bb4,_0x269f0b){var _0xa95200={'method':_0xa2eb('0xb'),'uri':_0x242b94+_0xa2eb('0x17'),'json':!![]};_0xa95200[_0xa2eb('0xc')]=_0x36087b;logger['info'](_0xa2eb('0x18'));return rp(_0xa95200)[_0xa2eb('0xe')](function(_0x386ef7){if(_0x386ef7){var _0x26e7e8=_0x386ef7[_0xa2eb('0xf')];var _0x3de5a4=![];var _0x29a4bb=null;if(_0x3518c9[_0xa2eb('0x19')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x3518c9['agentEmail']);_0x3518c9[_0xa2eb('0x1a')]=_0x3518c9[_0xa2eb('0x19')];for(_0x29a4bb=0x0;_0x29a4bb<_0x26e7e8[_0xa2eb('0x1b')];_0x29a4bb++){if(_0x26e7e8[_0x29a4bb][_0xa2eb('0x10')]===_0x3518c9[_0xa2eb('0x19')]){_0x3de5a4=!![];_0x3518c9[_0xa2eb('0x1c')]=_0x26e7e8[_0x29a4bb]['id'];logger[_0xa2eb('0x12')]('User\x20found:',_0x3518c9[_0xa2eb('0x1c')]);}}}if(!_0x3de5a4){logger[_0xa2eb('0x12')]('Admin\x20selected');_0x3518c9['userEmail']=_0x3518c9[_0xa2eb('0x1d')];_0x3518c9[_0xa2eb('0x1c')]=_0x3518c9[_0xa2eb('0x11')];_0x3de5a4=!![];}if(_0x3de5a4){_0x385bb4(_0x3518c9);}else{_0x269f0b({'statusCode':0x194,'message':_0xa2eb('0x13')});}}else{_0x269f0b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0xe03f89){logger[_0xa2eb('0x15')]('['+[_0x2b9fc4[_0xa2eb('0x16')]()]+']',_0xe03f89[_0xa2eb('0x1e')]);_0x269f0b(_0xe03f89);});});};}function searchContact(_0x573750,_0x22ab63,_0x36de4f,_0x736582){return new Promise(function(_0x9023b8,_0x11435f){var _0x5c2b09={'method':_0xa2eb('0xb'),'headers':_0x22ab63,'uri':_0x573750+_0xa2eb('0x1f')+_0x736582+_0xa2eb('0x20')+_0x36de4f+_0xa2eb('0x21'),'json':!![]};rp(_0x5c2b09)[_0xa2eb('0xe')](function(_0x2da23e){var _0x30327d=_['find'](_0x2da23e['contacts'][_0xa2eb('0x22')],[_0x36de4f,_0x736582]);_0x9023b8(_0x30327d);})['catch'](function(_0x5233cf){_0x11435f(_0x5233cf);});});}function getEndUser(_0x39471f,_0x319a76,_0xae5bf3){return function(_0x4fcfca){return new Promise(function(_0x8ecf25,_0x33f370){logger[_0xa2eb('0x12')](util[_0xa2eb('0x23')](_0xa2eb('0x24'),_0x4fcfca['contactNumber']));searchContact(_0xae5bf3,_0x319a76,_0xa2eb('0x25'),_0x4fcfca[_0xa2eb('0x26')])[_0xa2eb('0xe')](function(_0x4d5864){if(_0x4d5864){_0x4fcfca[_0xa2eb('0x27')]=_0x4d5864['id'];logger[_0xa2eb('0x12')](_0xa2eb('0x28'),_0x4fcfca[_0xa2eb('0x27')]);return _0x8ecf25(_0x4fcfca);}searchContact(_0xae5bf3,_0x319a76,_0xa2eb('0x29'),_0x4fcfca['contactNumber'])['then'](function(_0x56287a){if(_0x56287a){_0x4fcfca[_0xa2eb('0x27')]=_0x56287a['id'];logger[_0xa2eb('0x12')](_0xa2eb('0x2a'),_0x4fcfca[_0xa2eb('0x27')]);return _0x8ecf25(_0x4fcfca);}createEndUser(_0x4fcfca,_0x39471f,_0x319a76,_0xae5bf3)[_0xa2eb('0xe')](function(_0xad1a37){logger[_0xa2eb('0x12')](_0xa2eb('0x2b'),_0xad1a37[_0xa2eb('0x27')]);return _0x8ecf25(_0xad1a37);});});})['catch'](function(_0x564fa3){_0x33f370(_0x564fa3);});});};}function createEndUser(_0x1ee398,_0x58289f,_0x50d7e4,_0x489dde){return new Promise(function(_0x1030da,_0x5f2d8b){var _0x14ca0d=moment();var _0x3797ef={'method':_0xa2eb('0x2c'),'uri':_0x489dde+'/api/contacts','body':{'contact':{'last_name':_0x1ee398[_0xa2eb('0x26')],'work_number':_0x1ee398[_0xa2eb('0x26')],'mobile_number':_0x1ee398[_0xa2eb('0x26')],'owner_id':_0x1ee398[_0xa2eb('0x1c')],'created_at':_0x14ca0d[_0xa2eb('0x23')](_0xa2eb('0x2d'))}},'json':!![]};_0x3797ef[_0xa2eb('0xc')]=_0x50d7e4;logger[_0xa2eb('0x12')](_0xa2eb('0x2e'));return rp(_0x3797ef)[_0xa2eb('0xe')](function(_0x4e2323){_0x1ee398[_0xa2eb('0x27')]=_0x4e2323[_0xa2eb('0x2f')]['id'];_0x1030da(_0x1ee398);})[_0xa2eb('0x14')](function(_0x59d8ea){logger['error']('['+[_0x58289f[_0xa2eb('0x16')]()]+']',_0x59d8ea['message']);_0x5f2d8b(_0x59d8ea[_0xa2eb('0x1e')]);});});}function getTicket(_0x42c751,_0x433348,_0x15c68a,_0x34f896,_0x30f50d){return function(_0x389ccd){logger[_0xa2eb('0x12')](_0xa2eb('0x30'));return new Promise(function(_0x3c3928,_0x5a4c58){var _0x554ee7=moment();var _0x337f2e={'method':'POST','uri':_0x15c68a+_0xa2eb('0x31'),'body':{'title':intUtil['getString'](_0x34f896[_0xa2eb('0x32')],_0x30f50d,'\x20'),'description':intUtil[_0xa2eb('0x33')](_0x34f896[_0xa2eb('0x34')],_0x30f50d,'\x0a'),'owner_id':_0x389ccd[_0xa2eb('0x1c')],'creater_id':_0x389ccd[_0xa2eb('0x11')],'targetable_id':_0x389ccd[_0xa2eb('0x27')],'targetable_type':_0xa2eb('0x35'),'created_at':_0x554ee7[_0xa2eb('0x23')](_0xa2eb('0x2d')),'due_date':_0x554ee7[_0xa2eb('0x36')](0x1e,'m')['format'](_0xa2eb('0x2d'))},'json':!![]};_0x337f2e[_0xa2eb('0xc')]=_0x433348;return rp(_0x337f2e)[_0xa2eb('0xe')](function(_0x564dc1){_0x389ccd['ticketId']=_0x564dc1['task']['id'];logger[_0xa2eb('0x12')](_0xa2eb('0x37'),_0x389ccd[_0xa2eb('0x38')]);_0x3c3928(_0x389ccd);})[_0xa2eb('0x14')](function(_0x4ed971){logger[_0xa2eb('0x15')]('['+[_0x42c751[_0xa2eb('0x16')]()]+']',_0x4ed971[_0xa2eb('0x1e')]);_0x5a4c58(_0x4ed971[_0xa2eb('0x1e')]);});});};}function emit(_0x5dab19,_0x1be1e1,_0x5935fa){var _0x234c8b={'uri':_0x5dab19+_0xa2eb('0x39')+_0x5935fa};io['to'](util['format'](_0xa2eb('0x3a'),_0x1be1e1))[_0xa2eb('0x3b')]('trigger:browser:url',_0x234c8b);}exports['cs']=function(_0x31fca7,_0x7abb4b,_0x47b393,_0x3c303b,_0x13dfbb,_0x359565,_0xd7160,_0xae7b12){var _0x1962d9={};var _0x4156c4={'Authorization':'Token\x20token='+_0x359565[_0xa2eb('0x3c')]};_0x359565[_0xa2eb('0x3d')]=intUtil[_0xa2eb('0x3e')](_0x359565['remoteUri']);_0x359565['serverUrl']=intUtil[_0xa2eb('0x3e')](_0x359565[_0xa2eb('0x3f')]);var _0x12b519=_0x359565[_0xa2eb('0x3d')];_0x1962d9[_0xa2eb('0x1d')]=_0x359565['username'];_0x1962d9[_0xa2eb('0x26')]=_0xae7b12[_0xa2eb('0x40')]()===_0xa2eb('0x41')?_0x7abb4b[_0xa2eb('0x42')]:_0x7abb4b[_0xa2eb('0x43')];_0x1962d9[_0xa2eb('0x44')]=_0xae7b12===_0xa2eb('0x45')||_0xae7b12===_0xa2eb('0x46')?'queue':_0xa2eb('0x41');if(_0x3c303b){_0x1962d9[_0xa2eb('0x19')]=_0x3c303b['email'];}var _0x3295cc=util[_0xa2eb('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x359565['serverUrl'],_0x7abb4b['uniqueid'],md5(_0x7abb4b[_0xa2eb('0x47')]));if(_0x13dfbb&&_0x13dfbb[_0xa2eb('0x48')]){logger[_0xa2eb('0x12')](_0xa2eb('0x49'),_0xa2eb('0x4a'));_0x7abb4b[_0xa2eb('0x4b')]=_0x3295cc;}else if(_0xd7160&&_0xd7160[_0xa2eb('0x4c')]&&_0xd7160[_0xa2eb('0x4c')]!=='none'){logger[_0xa2eb('0x12')](_0xa2eb('0x4d'),_0xa2eb('0x4a'));_0x7abb4b['recordingURL']=_0x3295cc;}else{_0x7abb4b[_0xa2eb('0x4b')]='';}return getAdminId(_0x1962d9,_0xae7b12,_0x4156c4,_0x12b519)[_0xa2eb('0xe')](getUser(_0xae7b12,_0x4156c4,_0x12b519))[_0xa2eb('0xe')](getEndUser(_0xae7b12,_0x4156c4,_0x12b519))[_0xa2eb('0xe')](getTicket(_0xae7b12,_0x4156c4,_0x12b519,_0x47b393,_0x7abb4b))[_0xa2eb('0xe')](function(_0x13e9d8){logger[_0xa2eb('0x12')](util[_0xa2eb('0x23')](_0xa2eb('0x4e'),_0x13e9d8[_0xa2eb('0x38')]));if(_0xae7b12!==_0xa2eb('0x46')){logger[_0xa2eb('0x12')]('['+[_0xae7b12[_0xa2eb('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x12b519,_0x3c303b[_0xa2eb('0x4f')],_0x13e9d8[_0xa2eb('0x27')]);}})[_0xa2eb('0x14')](function(_0x188536){logger['error']('['+[_0xae7b12[_0xa2eb('0x16')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xa2eb('0x50')](_0x188536,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x032e=['Admin\x20selected','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','moment','bluebird','./util','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:'];(function(_0x21a9d1,_0x21d35b){var _0x12cd7f=function(_0x56d542){while(--_0x56d542){_0x21a9d1['push'](_0x21a9d1['shift']());}};_0x12cd7f(++_0x21d35b);}(_0x032e,0xd7));var _0xe032=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x032e[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var rp=require(_0xe032('0x0'));var md5=require('md5');var util=require('util');var moment=require(_0xe032('0x1'));var Promise=require(_0xe032('0x2'));var Redis=require('ioredis');var intUtil=require(_0xe032('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xe032('0x4'));config[_0xe032('0x5')]=_[_0xe032('0x6')](config[_0xe032('0x5')],{'host':_0xe032('0x7'),'port':0x18eb});var io=require(_0xe032('0x8'))(new Redis(config[_0xe032('0x5')]));function getAdminId(_0x3b4a6a,_0x5adcf7,_0x41da34,_0x120810){return new Promise(function(_0x4c0553,_0x2523e1){var _0x112736=![];var _0x487387={'method':_0xe032('0x9'),'uri':_0x120810+_0xe032('0xa'),'json':!![]};_0x487387[_0xe032('0xb')]=_0x41da34;logger[_0xe032('0xc')]('Getting\x20admin\x20information');return rp(_0x487387)['then'](function(_0xfe438){if(_0xfe438){var _0x3bdb11=_0xfe438[_0xe032('0xd')];var _0xd9d5ed=null;for(_0xd9d5ed=0x0;_0xd9d5ed<_0x3bdb11[_0xe032('0xe')];_0xd9d5ed++){if(_0x3bdb11[_0xd9d5ed][_0xe032('0xf')]===_0x3b4a6a[_0xe032('0x10')]){_0x3b4a6a[_0xe032('0x11')]=_0x3bdb11[_0xd9d5ed]['id'];_0x112736=!![];}}if(_0x112736){logger[_0xe032('0xc')]('Admin\x20found:',_0x3b4a6a[_0xe032('0x11')]);_0x4c0553(_0x3b4a6a);}else{_0x2523e1({'statusCode':0x194,'message':_0xe032('0x12')});}}else{_0x2523e1({'statusCode':0x194,'message':_0xe032('0x12')});}})[_0xe032('0x13')](function(_0x4c7f6d){logger[_0xe032('0x14')]('['+[_0x5adcf7['toUpperCase']()]+']',_0x4c7f6d[_0xe032('0x15')]);_0x2523e1(_0x4c7f6d);});});}function getUser(_0x38526c,_0x2993c2,_0x30809c){return function(_0x241a7a){return new Promise(function(_0x4beaf4,_0x218bf0){var _0x14c768={'method':_0xe032('0x9'),'uri':_0x30809c+_0xe032('0xa'),'json':!![]};_0x14c768[_0xe032('0xb')]=_0x2993c2;logger[_0xe032('0xc')]('Getting\x20user\x20list');return rp(_0x14c768)[_0xe032('0x16')](function(_0x424cce){if(_0x424cce){var _0x287eb5=_0x424cce['users'];var _0x5ebc91=![];var _0x392de3=null;if(_0x241a7a[_0xe032('0x17')]!==null){logger[_0xe032('0xc')](_0xe032('0x18'),_0x241a7a[_0xe032('0x17')]);_0x241a7a[_0xe032('0x19')]=_0x241a7a[_0xe032('0x17')];for(_0x392de3=0x0;_0x392de3<_0x287eb5[_0xe032('0xe')];_0x392de3++){if(_0x287eb5[_0x392de3][_0xe032('0xf')]===_0x241a7a['agentEmail']){_0x5ebc91=!![];_0x241a7a[_0xe032('0x1a')]=_0x287eb5[_0x392de3]['id'];logger['info'](_0xe032('0x1b'),_0x241a7a[_0xe032('0x1a')]);}}}if(!_0x5ebc91){logger[_0xe032('0xc')](_0xe032('0x1c'));_0x241a7a[_0xe032('0x19')]=_0x241a7a[_0xe032('0x10')];_0x241a7a[_0xe032('0x1a')]=_0x241a7a[_0xe032('0x11')];_0x5ebc91=!![];}if(_0x5ebc91){_0x4beaf4(_0x241a7a);}else{_0x218bf0({'statusCode':0x194,'message':_0xe032('0x12')});}}else{_0x218bf0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x145f46){logger['error']('['+[_0x38526c[_0xe032('0x1d')]()]+']',_0x145f46['message']);_0x218bf0(_0x145f46);});});};}function searchContact(_0x1b4328,_0x1b6a46,_0x59720a,_0x386576){return new Promise(function(_0x4385e1,_0x5855bc){var _0x123e09={'method':'GET','headers':_0x1b6a46,'uri':_0x1b4328+_0xe032('0x1e')+_0x386576+_0xe032('0x1f')+_0x59720a+_0xe032('0x20'),'json':!![]};rp(_0x123e09)[_0xe032('0x16')](function(_0x455219){var _0x17091f=_['find'](_0x455219[_0xe032('0x21')][_0xe032('0x21')],[_0x59720a,_0x386576]);_0x4385e1(_0x17091f);})[_0xe032('0x13')](function(_0x4ef51b){_0x5855bc(_0x4ef51b);});});}function getEndUser(_0x3f7d39,_0x2ffd63,_0x5b49c7){return function(_0x49ebc4){return new Promise(function(_0x153ea2,_0x568f3b){logger['info'](util[_0xe032('0x22')](_0xe032('0x23'),_0x49ebc4[_0xe032('0x24')]));searchContact(_0x5b49c7,_0x2ffd63,_0xe032('0x25'),_0x49ebc4['contactNumber'])[_0xe032('0x16')](function(_0x16cd35){if(_0x16cd35){_0x49ebc4['endUserId']=_0x16cd35['id'];logger[_0xe032('0xc')](_0xe032('0x26'),_0x49ebc4['endUserId']);return _0x153ea2(_0x49ebc4);}searchContact(_0x5b49c7,_0x2ffd63,_0xe032('0x27'),_0x49ebc4[_0xe032('0x24')])[_0xe032('0x16')](function(_0xbf6f14){if(_0xbf6f14){_0x49ebc4[_0xe032('0x28')]=_0xbf6f14['id'];logger[_0xe032('0xc')](_0xe032('0x29'),_0x49ebc4['endUserId']);return _0x153ea2(_0x49ebc4);}createEndUser(_0x49ebc4,_0x3f7d39,_0x2ffd63,_0x5b49c7)[_0xe032('0x16')](function(_0x34b37d){logger[_0xe032('0xc')]('Contact\x20created:',_0x34b37d[_0xe032('0x28')]);return _0x153ea2(_0x34b37d);});});})[_0xe032('0x13')](function(_0x263a4f){_0x568f3b(_0x263a4f);});});};}function createEndUser(_0x195da5,_0xc7ed71,_0x96accf,_0x311589){return new Promise(function(_0x4ecef7,_0x3872f2){var _0x187ee5=moment();var _0x16b773={'method':_0xe032('0x2a'),'uri':_0x311589+_0xe032('0x2b'),'body':{'contact':{'last_name':_0x195da5[_0xe032('0x24')],'work_number':_0x195da5['contactNumber'],'mobile_number':_0x195da5[_0xe032('0x24')],'owner_id':_0x195da5['userId'],'created_at':_0x187ee5[_0xe032('0x22')](_0xe032('0x2c'))}},'json':!![]};_0x16b773[_0xe032('0xb')]=_0x96accf;logger[_0xe032('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x16b773)[_0xe032('0x16')](function(_0x40cd17){_0x195da5[_0xe032('0x28')]=_0x40cd17['contact']['id'];_0x4ecef7(_0x195da5);})[_0xe032('0x13')](function(_0xe5d252){logger['error']('['+[_0xc7ed71[_0xe032('0x1d')]()]+']',_0xe5d252[_0xe032('0x15')]);_0x3872f2(_0xe5d252[_0xe032('0x15')]);});});}function getTicket(_0x5674a8,_0x1afd95,_0x543f02,_0x2f3e6d,_0x1ac602){return function(_0x3d3a8b){logger[_0xe032('0xc')](_0xe032('0x2d'));return new Promise(function(_0xafdd75,_0x307020){var _0x57fc6c=moment();var _0x357eac={'method':_0xe032('0x2a'),'uri':_0x543f02+_0xe032('0x2e'),'body':{'title':intUtil['getString'](_0x2f3e6d[_0xe032('0x2f')],_0x1ac602,'\x20'),'description':intUtil[_0xe032('0x30')](_0x2f3e6d[_0xe032('0x31')],_0x1ac602,'\x0a'),'owner_id':_0x3d3a8b['userId'],'creater_id':_0x3d3a8b[_0xe032('0x11')],'targetable_id':_0x3d3a8b[_0xe032('0x28')],'targetable_type':_0xe032('0x32'),'created_at':_0x57fc6c[_0xe032('0x22')](_0xe032('0x2c')),'due_date':_0x57fc6c['add'](0x1e,'m')['format'](_0xe032('0x2c'))},'json':!![]};_0x357eac['headers']=_0x1afd95;return rp(_0x357eac)['then'](function(_0x569307){_0x3d3a8b[_0xe032('0x33')]=_0x569307['task']['id'];logger[_0xe032('0xc')](_0xe032('0x34'),_0x3d3a8b['ticketId']);_0xafdd75(_0x3d3a8b);})[_0xe032('0x13')](function(_0xb7b842){logger['error']('['+[_0x5674a8[_0xe032('0x1d')]()]+']',_0xb7b842[_0xe032('0x15')]);_0x307020(_0xb7b842[_0xe032('0x15')]);});});};}function emit(_0x4d2d3d,_0x24708e,_0x4db1a9){var _0x16e678={'uri':_0x4d2d3d+_0xe032('0x35')+_0x4db1a9};io['to'](util[_0xe032('0x22')](_0xe032('0x36'),_0x24708e))['emit'](_0xe032('0x37'),_0x16e678);}exports['cs']=function(_0x59fc34,_0x56a799,_0x361962,_0x1973ea,_0x7abdc5,_0x3d27fe,_0x8f1f3c,_0x3ffa74){var _0xbdb445={};var _0x3836c2={'Authorization':_0xe032('0x38')+_0x3d27fe[_0xe032('0x39')]};_0x3d27fe[_0xe032('0x3a')]=intUtil['stripTrailingSlash'](_0x3d27fe[_0xe032('0x3a')]);_0x3d27fe['serverUrl']=intUtil[_0xe032('0x3b')](_0x3d27fe[_0xe032('0x3c')]);var _0x5b472a=_0x3d27fe['remoteUri'];_0xbdb445[_0xe032('0x10')]=_0x3d27fe[_0xe032('0x3d')];_0xbdb445[_0xe032('0x24')]=_0x3ffa74[_0xe032('0x3e')]()===_0xe032('0x3f')?_0x56a799[_0xe032('0x40')]:_0x56a799[_0xe032('0x41')];_0xbdb445[_0xe032('0x42')]=_0x3ffa74===_0xe032('0x43')||_0x3ffa74===_0xe032('0x44')?_0xe032('0x43'):'outbound';if(_0x1973ea){_0xbdb445[_0xe032('0x17')]=_0x1973ea['email'];}var _0x1c930a=util[_0xe032('0x22')](_0xe032('0x45'),_0x3d27fe[_0xe032('0x3c')],_0x56a799[_0xe032('0x46')],md5(_0x56a799[_0xe032('0x46')]));if(_0x7abdc5&&_0x7abdc5['monitor_format']){logger[_0xe032('0xc')]('[QUEUE]',_0xe032('0x47'));_0x56a799[_0xe032('0x48')]=_0x1c930a;}else if(_0x8f1f3c&&_0x8f1f3c[_0xe032('0x49')]&&_0x8f1f3c['recordingFormat']!==_0xe032('0x4a')){logger[_0xe032('0xc')](_0xe032('0x4b'),_0xe032('0x47'));_0x56a799[_0xe032('0x48')]=_0x1c930a;}else{_0x56a799[_0xe032('0x48')]='';}return getAdminId(_0xbdb445,_0x3ffa74,_0x3836c2,_0x5b472a)['then'](getUser(_0x3ffa74,_0x3836c2,_0x5b472a))[_0xe032('0x16')](getEndUser(_0x3ffa74,_0x3836c2,_0x5b472a))[_0xe032('0x16')](getTicket(_0x3ffa74,_0x3836c2,_0x5b472a,_0x361962,_0x56a799))[_0xe032('0x16')](function(_0x49c712){logger['info'](util['format'](_0xe032('0x4c'),_0x49c712['ticketId']));if(_0x3ffa74!==_0xe032('0x44')){logger[_0xe032('0xc')]('['+[_0x3ffa74[_0xe032('0x1d')]()]+']',_0xe032('0x4d'));emit(_0x5b472a,_0x1973ea[_0xe032('0x4e')],_0x49c712[_0xe032('0x28')]);}})['catch'](function(_0x32ce25){logger[_0xe032('0x14')]('['+[_0x3ffa74['toUpperCase']()]+_0xe032('0x4f'),util[_0xe032('0x50')](_0x32ce25,{'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 c105d7a..fa22537 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 _0x2051=['data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','freshdesk','zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','desk','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','data2','find','Configurations'];(function(_0x4d1986,_0x5120ef){var _0x3e20c0=function(_0x46ebf3){while(--_0x46ebf3){_0x4d1986['push'](_0x4d1986['shift']());}};_0x3e20c0(++_0x5120ef);}(_0x2051,0x7d));var _0x1205=function(_0x54292c,_0x338dab){_0x54292c=_0x54292c-0x0;var _0xb3d0fe=_0x2051[_0x54292c];return _0xb3d0fe;};'use strict';var _=require(_0x1205('0x0'));var util=require(_0x1205('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x1205('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x1205('0x3'));var desk=require(_0x1205('0x4'));var vtiger=require(_0x1205('0x5'));var servicenow=require(_0x1205('0x6'));var dynamics365=require(_0x1205('0x7'));var freshsales=require(_0x1205('0x8'));var integrations=['zendesk','salesforce','sugarcrm','freshdesk','zoho',_0x1205('0x9'),_0x1205('0xa'),_0x1205('0xb'),_0x1205('0xc'),'servicenow'];exports['exec']=function(_0x4a023f,_0x4c881b,_0x904ca3,_0x27656c,_0x4eb87c,_0x262e4c){if(_0x904ca3){if(_[_0x1205('0xd')](integrations,_0x4a023f[_0x1205('0xe')]['toLowerCase']())){try{var _0x163731=null;var _0x355efe='';var _0x1fa3c8=_0x904ca3[_0x4a023f[_0x1205('0xe')][_0x1205('0xf')]()];if(_0x1fa3c8){var _0x3909f3=_0x1fa3c8[_0x4a023f[_0x1205('0x10')]];if(_0x3909f3){var _0xaa0dac=_[_0x1205('0x11')](_0x3909f3[_0x1205('0x12')],{'id':parseInt(_0x4a023f[_0x1205('0x13')],0xa)});if(_0xaa0dac){if(_0x27656c){if(_0x4eb87c&&_0x4c881b[_0x1205('0x14')]){_0x355efe=_0x1205('0x14');}else if(_0x4c881b[_0x1205('0x15')]){_0x355efe=_0x1205('0x16');}else{console[_0x1205('0x17')](_0x1205('0x18'),_0x4c881b);}}else{_0x355efe=_0x1205('0x19');}switch(_0x4a023f[_0x1205('0xe')][_0x1205('0xf')]()){case'zendesk':zendesk[_0x355efe](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c);break;case _0x1205('0x1a'):salesforce[_0x355efe](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c);break;case _0x1205('0x1b'):sugarcrm[_0x355efe](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c);break;case _0x1205('0x1c'):freshdesk[_0x355efe](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c);break;case _0x1205('0x1d'):zoho[_0x355efe](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c);break;case _0x1205('0x9'):desk[_0x355efe](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c);break;case'vtiger':vtiger[_0x355efe](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c);break;case _0x1205('0xc'):freshsales['cs'](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c,_0x355efe);break;case'servicenow':servicenow['cs'](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c,_0x355efe);break;case'dynamics365':dynamics365['cs'](_0x4a023f,_0x4c881b,_0xaa0dac,_0x27656c,_0x4eb87c,_0x3909f3,_0x262e4c,_0x355efe);break;default:console[_0x1205('0x17')](_0x1205('0x1e'));}}else{_0x163731=require(_0x1205('0x1f'))(_0x4a023f[_0x1205('0xe')][_0x1205('0xf')]());_0x163731[_0x1205('0x20')](_0x1205('0x21'),util[_0x1205('0x22')](_0x1205('0x23'),_0x4a023f['data1'][_0x1205('0xf')](),_0x4a023f[_0x1205('0x13')]));}}else{_0x163731=require(_0x1205('0x1f'))(_0x4a023f[_0x1205('0xe')][_0x1205('0xf')]());_0x163731[_0x1205('0x20')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x4a023f['data1'][_0x1205('0xf')](),_0x4a023f[_0x1205('0x10')]));}}else{}}catch(_0x178c57){console[_0x1205('0x20')](_0x178c57);}}}}; \ No newline at end of file +var _0x761e=['../../../../config/logger','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','error','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x761e,0xc9));var _0xe761=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x761e[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0xe761('0x0'));var util=require(_0xe761('0x1'));var zendesk=require(_0xe761('0x2'));var salesforce=require(_0xe761('0x3'));var sugarcrm=require(_0xe761('0x4'));var freshdesk=require(_0xe761('0x5'));var zoho=require('./zoho');var desk=require(_0xe761('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0xe761('0x7'));var dynamics365=require(_0xe761('0x8'));var freshsales=require(_0xe761('0x9'));var integrations=[_0xe761('0xa'),_0xe761('0xb'),_0xe761('0xc'),_0xe761('0xd'),_0xe761('0xe'),'desk','vtiger',_0xe761('0xf'),_0xe761('0x10'),_0xe761('0x11')];exports[_0xe761('0x12')]=function(_0x1b1072,_0x5af1fa,_0x512638,_0x1e5713,_0x4780df,_0x49c49c){if(_0x512638){if(_[_0xe761('0x13')](integrations,_0x1b1072[_0xe761('0x14')][_0xe761('0x15')]())){try{var _0x2ad007=null;var _0x2cce66='';var _0x1618f8=_0x512638[_0x1b1072['data1']['toLowerCase']()];if(_0x1618f8){var _0x3bd154=_0x1618f8[_0x1b1072['data2']];if(_0x3bd154){var _0x19c66a=_[_0xe761('0x16')](_0x3bd154[_0xe761('0x17')],{'id':parseInt(_0x1b1072[_0xe761('0x18')],0xa)});if(_0x19c66a){if(_0x1e5713){if(_0x4780df&&_0x5af1fa[_0xe761('0x19')]){_0x2cce66=_0xe761('0x19');}else if(_0x5af1fa[_0xe761('0x1a')]){_0x2cce66=_0xe761('0x1b');}else{console[_0xe761('0x1c')](_0xe761('0x1d'),_0x5af1fa);}}else{_0x2cce66=_0xe761('0x1e');}switch(_0x1b1072[_0xe761('0x14')]['toLowerCase']()){case _0xe761('0xa'):zendesk[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case _0xe761('0xb'):salesforce[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case _0xe761('0xc'):sugarcrm[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case'freshdesk':freshdesk[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case'zoho':zoho[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case _0xe761('0x1f'):desk[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case'vtiger':vtiger[_0x2cce66](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c);break;case _0xe761('0x10'):freshsales['cs'](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c,_0x2cce66);break;case _0xe761('0x11'):servicenow['cs'](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c,_0x2cce66);break;case _0xe761('0xf'):dynamics365['cs'](_0x1b1072,_0x5af1fa,_0x19c66a,_0x1e5713,_0x4780df,_0x3bd154,_0x49c49c,_0x2cce66);break;default:console[_0xe761('0x1c')](_0xe761('0x20'));}}else{_0x2ad007=require(_0xe761('0x21'))(_0x1b1072['data1'][_0xe761('0x15')]());_0x2ad007['error'](_0xe761('0x22'),util[_0xe761('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1b1072[_0xe761('0x14')]['toLowerCase'](),_0x1b1072[_0xe761('0x18')]));}}else{_0x2ad007=require(_0xe761('0x21'))(_0x1b1072[_0xe761('0x14')][_0xe761('0x15')]());_0x2ad007['error'](_0xe761('0x22'),util['format'](_0xe761('0x24'),_0x1b1072[_0xe761('0x14')]['toLowerCase'](),_0x1b1072[_0xe761('0x25')]));}}else{}}catch(_0x171898){console[_0xe761('0x26')](_0x171898);}}}}; \ 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 7e29b25..f7bd091 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 _0x9ca4=['additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','toString','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','%s/%s/e','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:browser:url','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','ticketType','utc','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','isNil','validateEmail','sobject','User','find','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','execute'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x9ca4,0xcc));var _0x49ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ca4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x49ca('0x0'));var rp=require(_0x49ca('0x1'));var moment=require(_0x49ca('0x2'));var BPromise=require(_0x49ca('0x3'));var md5=require(_0x49ca('0x4'));var jsforce=require(_0x49ca('0x5'));var util=require('util');var Redis=require(_0x49ca('0x6'));var intUtil=require(_0x49ca('0x7'));var config=require(_0x49ca('0x8'));var logger=require(_0x49ca('0x9'))(_0x49ca('0xa'));config[_0x49ca('0xb')]=_[_0x49ca('0xc')](config[_0x49ca('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x49ca('0xd'))(new Redis(config['redis']));function emit(_0x53d01d,_0x4e45e4,_0x3eb908){io['to'](_0x53d01d)[_0x49ca('0xe')](_0x4e45e4,_0x3eb908);}function getTicket(_0x55b269,_0x4b225f,_0x1fdec9,_0x30291a,_0x47864f,_0x133254,_0x774b00,_0x59d215){var _0x1db75b=Object[_0x49ca('0xf')]({},{'OwnerId':_0x4b225f['id'],'Subject':intUtil[_0x49ca('0x10')](_0x30291a[_0x49ca('0x11')],_0x47864f,'\x20'),'Description':intUtil[_0x49ca('0x10')](_0x30291a['Descriptions'],_0x47864f,'\x0a')},getCustomFields(_0x133254,_0x47864f));if(_0x1fdec9){if(_0x30291a[_0x49ca('0x12')]==='Task'){_0x1db75b['ActivityDate']=moment[_0x49ca('0x13')]();_0x1db75b['IsReminderSet']=![];_0x1db75b[_0x49ca('0x14')]=![];if(_0x1fdec9[_0x49ca('0x15')]==='contact'||_0x1fdec9['endUserType']===_0x49ca('0x16')){_0x1db75b[_0x49ca('0x17')]=_0x1fdec9['id'];}else if(_0x1fdec9[_0x49ca('0x15')]===_0x49ca('0x18')){_0x1db75b[_0x49ca('0x19')]=_0x1fdec9['id'];}}else if(_0x30291a[_0x49ca('0x12')]===_0x49ca('0x1a')){if(_0x1fdec9[_0x49ca('0x15')]===_0x49ca('0x1b')){_0x1db75b[_0x49ca('0x1c')]=_0x1fdec9['id'];}else if(_0x1fdec9[_0x49ca('0x15')]===_0x49ca('0x18')){_0x1db75b['AccountId']=_0x1fdec9['id'];}else if(_0x1fdec9[_0x49ca('0x15')]===_0x49ca('0x16')&&_0x30291a[_0x49ca('0x1d')]){_0x1db75b[_0x30291a[_0x49ca('0x1d')]]=_0x1fdec9['id'];}else{logger[_0x49ca('0x1e')](_0x49ca('0x1f'));}}}return _0x774b00['sobject'](_0x30291a[_0x49ca('0x12')])['create'](_0x1db75b);}function getUser(_0x4d1bd5,_0xcf9973,_0x3091f5){if(!_[_0x49ca('0x20')](_0xcf9973)&&intUtil[_0x49ca('0x21')](_0xcf9973)){var _0x6c515c={'Email':_0xcf9973};var _0x32b42d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3091f5[_0x49ca('0x22')](_0x49ca('0x23'))[_0x49ca('0x24')](_0x6c515c,_0x32b42d)['execute']()[_0x49ca('0x25')](function(_0x126cc6){if(_0x126cc6[_0x49ca('0x26')]){var _0x217b40=_['find'](_0x126cc6,function(_0x2b4738){return _0x2b4738[_0x49ca('0x27')]===_0xcf9973;});if(_0x217b40){logger['info']('Agent\x20%s\x20found.',_0xcf9973);return BPromise[_0x49ca('0x28')]({'id':_0x217b40['Id'],'name':_0x217b40[_0x49ca('0x29')]});}}else{logger[_0x49ca('0x1e')](_0x49ca('0x2a'),_0xcf9973);return _0x3091f5[_0x49ca('0x2b')]()['then'](function(_0x5be3a1){return BPromise[_0x49ca('0x28')]({'id':_0x5be3a1[_0x49ca('0x2c')],'name':_0x5be3a1['display_name']});});}});}else{logger[_0x49ca('0x1e')](_0x49ca('0x2a'),_0xcf9973);return _0x3091f5[_0x49ca('0x2b')]()['then'](function(_0x4548cd){return BPromise[_0x49ca('0x28')]({'id':_0x4548cd[_0x49ca('0x2c')],'name':_0x4548cd[_0x49ca('0x2d')]});});}}function getEndUser(_0x541f3d,_0x15ae05,_0x4360a7,_0x38a399,_0x85b303){var _0x3116d2={'$or':{'Phone':_0x38a399}};var _0x9d79ee={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x49ca('0x28')]()[_0x49ca('0x25')](function(){logger['info'](_0x49ca('0x2e'),_0x38a399,_0x15ae05[_0x49ca('0x2f')]);switch(_0x15ae05['moduleSearch']){case _0x49ca('0x30'):var _0x6a1d61=_[_0x49ca('0x31')](_0x3116d2);if(_0x15ae05[_0x49ca('0x32')]){var _0x405fd7={};_0x405fd7[_0x15ae05[_0x49ca('0x32')]]=_0x38a399;_[_0x49ca('0x33')](_0x6a1d61['$or'],_0x405fd7);}return _0x85b303[_0x49ca('0x22')](_0x49ca('0x34'))[_0x49ca('0x24')](_0x6a1d61,_0x9d79ee)[_0x49ca('0x35')]()['then'](function(_0x282b35){if(_0x282b35&&_0x282b35[_0x49ca('0x26')]){return _0x282b35;}else{var _0x2a31a6=_['cloneDeep'](_0x3116d2);if(_0x15ae05[_0x49ca('0x36')]){var _0x4e778b={};_0x4e778b[_0x15ae05['additionalSearchLead']]=_0x38a399;_['merge'](_0x2a31a6[_0x49ca('0x37')],_0x4e778b);}return _0x85b303[_0x49ca('0x22')](_0x49ca('0x38'))[_0x49ca('0x24')](_0x2a31a6,_0x9d79ee);}});case _0x49ca('0x39'):var _0x2fe83c=_[_0x49ca('0x31')](_0x3116d2);if(_0x15ae05[_0x49ca('0x3a')]){var _0x405fd7={};_0x405fd7[_0x15ae05[_0x49ca('0x3a')]]=_0x38a399;_[_0x49ca('0x33')](_0x2fe83c[_0x49ca('0x37')],_0x405fd7);}return _0x85b303[_0x49ca('0x22')](_0x49ca('0x3b'))[_0x49ca('0x24')](_0x2fe83c,_0x9d79ee)[_0x49ca('0x35')]()['then'](function(_0x3ddfa0){if(_0x3ddfa0&&_0x3ddfa0[_0x49ca('0x26')]){return _0x3ddfa0;}else{var _0x280be2=_[_0x49ca('0x31')](_0x3116d2);if(_0x15ae05[_0x49ca('0x32')]){var _0x1bc0ce={};_0x1bc0ce[_0x15ae05['additionalSearchContact']]=_0x38a399;_[_0x49ca('0x33')](_0x280be2[_0x49ca('0x37')],_0x1bc0ce);}return _0x85b303[_0x49ca('0x22')]('Contact')[_0x49ca('0x24')](_0x280be2,_0x9d79ee)[_0x49ca('0x25')](function(_0x669933){if(_0x669933&&_0x669933[_0x49ca('0x26')]){return _0x669933;}else{var _0x2d2f10=_[_0x49ca('0x31')](_0x3116d2);if(_0x15ae05[_0x49ca('0x36')]){var _0x5e219b={};_0x5e219b[_0x15ae05['additionalSearchLead']]=_0x38a399;_[_0x49ca('0x33')](_0x2d2f10['$or'],_0x5e219b);}return _0x85b303[_0x49ca('0x22')](_0x49ca('0x38'))['find'](_0x2d2f10,_0x9d79ee);}});}});case _0x49ca('0x1b'):var _0x6a1d61=_[_0x49ca('0x31')](_0x3116d2);if(_0x15ae05['additionalSearchContact']){var _0x405fd7={};_0x405fd7[_0x15ae05[_0x49ca('0x32')]]=_0x38a399;_[_0x49ca('0x33')](_0x6a1d61['$or'],_0x405fd7);}return _0x85b303['sobject'](_0x49ca('0x34'))['find'](_0x6a1d61,_0x9d79ee)['execute']();case'lead':var _0xd669be=_[_0x49ca('0x31')](_0x3116d2);if(_0x15ae05['additionalSearchLead']){var _0x405fd7={};_0x405fd7[_0x15ae05[_0x49ca('0x36')]]=_0x38a399;_['merge'](_0xd669be[_0x49ca('0x37')],_0x405fd7);}return _0x85b303[_0x49ca('0x22')](_0x49ca('0x38'))[_0x49ca('0x24')](_0xd669be,_0x9d79ee);case _0x49ca('0x18'):var _0x2fe83c=_['cloneDeep'](_0x3116d2);if(_0x15ae05['additionalSearchAccount']){var _0x405fd7={};_0x405fd7[_0x15ae05['additionalSearchAccount']]=_0x38a399;_['merge'](_0x2fe83c[_0x49ca('0x37')],_0x405fd7);}return _0x85b303[_0x49ca('0x22')](_0x49ca('0x3b'))['find'](_0x2fe83c,_0x9d79ee);default:return null;}})[_0x49ca('0x25')](function(_0x1e08a7){if(_0x1e08a7&&_0x1e08a7[_0x49ca('0x26')]){var _0x3b0f04=_['first'](_0x1e08a7);if(_0x3b0f04){return BPromise['resolve']({'id':_0x3b0f04['Id'],'name':_0x3b0f04[_0x49ca('0x29')],'phone':_0x3b0f04[_0x49ca('0x3c')],'endUserType':_0x3b0f04['attributes'][_0x49ca('0x3d')][_0x49ca('0x3e')]()});}}})[_0x49ca('0x25')](function(_0x1c33cd){if(_0x1c33cd){logger[_0x49ca('0x1e')](_0x49ca('0x3f'),_0x1c33cd[_0x49ca('0x15')],_0x38a399);return BPromise['resolve'](_0x1c33cd);}else{logger[_0x49ca('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x38a399);var _0x51c03f={'Phone':_0x38a399};if(_0x15ae05[_0x49ca('0x40')]){if(_0x15ae05['moduleCreate']==='contact'){logger[_0x49ca('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x38a399,_0x15ae05[_0x49ca('0x40')]);_0x51c03f[_0x49ca('0x41')]=_0x4360a7!==_0x49ca('0x42')?_0x4360a7:util['format'](_0x49ca('0x43'),_0x38a399);}else if(_0x15ae05[_0x49ca('0x40')]==='lead'){logger[_0x49ca('0x1e')](_0x49ca('0x44'),_0x38a399,_0x15ae05[_0x49ca('0x40')]);_0x51c03f[_0x49ca('0x41')]=_0x4360a7!==_0x49ca('0x42')?_0x4360a7:util[_0x49ca('0x45')](_0x49ca('0x43'),_0x38a399);_0x51c03f[_0x49ca('0x46')]=_0x49ca('0x47');}else if(_0x15ae05[_0x49ca('0x40')]===_0x49ca('0x18')){logger[_0x49ca('0x1e')](_0x49ca('0x44'),_0x38a399,_0x15ae05[_0x49ca('0x40')]);_0x51c03f['Name']=_0x4360a7!==_0x49ca('0x42')?_0x4360a7:util[_0x49ca('0x45')](_0x49ca('0x43'),_0x38a399);}else{return null;}}return _0x85b303['sobject'](_[_0x49ca('0x48')](_0x15ae05['moduleCreate']))['create'](_0x51c03f)[_0x49ca('0x25')](function(_0x4480e1){return BPromise[_0x49ca('0x28')]({'id':_0x4480e1['id'],'endUserType':_0x15ae05[_0x49ca('0x40')]});});}});}function getCustomFields(_0x36ee89,_0xdc6c67){var _0x3e9acb={};if(_0x36ee89[_0x49ca('0x26')]>0x0){_[_0x49ca('0x49')](_0x36ee89,function(_0x24c4fa){if(_[_0x49ca('0x4a')]([_0x49ca('0x4b'),_0x49ca('0x4c')],_0x24c4fa[_0x49ca('0x3d')])&&_0x24c4fa[_0x49ca('0x4d')]){_0x3e9acb[_0x24c4fa[_0x49ca('0x4d')]]=_0x24c4fa[_0x49ca('0x4e')]['toString']();}else if(_0x24c4fa[_0x49ca('0x3d')]===_0x49ca('0x4f')&&_0x24c4fa[_0x49ca('0x50')]&&_0x24c4fa['idField']){_0xdc6c67[_0x24c4fa[_0x49ca('0x50')]]&&(_0x3e9acb[_0x24c4fa[_0x49ca('0x4d')]]=_0xdc6c67[_0x24c4fa[_0x49ca('0x50')]][_0x49ca('0x51')]());}else if(_0x24c4fa[_0x49ca('0x3d')]==='customVariable'&&_0x24c4fa[_0x49ca('0x52')]&&_0x24c4fa['Variable'][_0x49ca('0x53')]&&_0x24c4fa[_0x49ca('0x4d')]){_0xdc6c67[_0x24c4fa[_0x49ca('0x52')][_0x49ca('0x53')][_0x49ca('0x3e')]()]&&(_0x3e9acb[_0x24c4fa['idField']]=_0xdc6c67[_0x24c4fa[_0x49ca('0x52')][_0x49ca('0x53')][_0x49ca('0x3e')]()][_0x49ca('0x51')]());}});}return _0x3e9acb;}function getConnection(_0x1592b9){var _0x451b3d=_0x1592b9[_0x49ca('0x54')][_0x49ca('0x55')](_0x1592b9[_0x49ca('0x56')]);var _0x1bdaec=new jsforce[(_0x49ca('0x57'))]({'oauth2':{'loginUrl':_0x1592b9['remoteUri']||_0x49ca('0x58'),'clientId':_0x1592b9[_0x49ca('0x59')],'clientSecret':_0x1592b9[_0x49ca('0x5a')]}});return _0x1bdaec['login'](_0x1592b9[_0x49ca('0x5b')],_0x451b3d)[_0x49ca('0x25')](function(){logger[_0x49ca('0x1e')](_0x49ca('0x5c'));return _0x1bdaec;});}exports[_0x49ca('0x5d')]=function(_0x4a1857,_0x5e7fd5,_0x125930,_0x115896,_0x274f0c,_0x4e85aa){var _0x1cff1f,_0x372e17,_0x4f2410,_0x348567;_0x4e85aa[_0x49ca('0x5e')]=intUtil[_0x49ca('0x5f')](_0x4e85aa['serverUrl']);_0x4e85aa['remoteUri']=intUtil[_0x49ca('0x5f')](_0x4e85aa[_0x49ca('0x60')]);if(_0x274f0c&&_0x274f0c[_0x49ca('0x61')]){logger[_0x49ca('0x1e')](_0x49ca('0x62'),_0x49ca('0x63'));_0x5e7fd5[_0x49ca('0x64')]=util[_0x49ca('0x45')](_0x49ca('0x65'),_0x4e85aa['serverUrl'],_0x5e7fd5[_0x49ca('0x66')],md5(_0x5e7fd5[_0x49ca('0x66')]));}else{_0x5e7fd5[_0x49ca('0x64')]='';}return getConnection(_0x4e85aa)['then'](function(_0x590a61){_0x348567=_0x590a61;return getUser(_0x4e85aa,_0x115896[_0x49ca('0x67')],_0x348567);})[_0x49ca('0x25')](function(_0x4cca56){_0x1cff1f=_0x4cca56;return getEndUser(_0x4e85aa,_0x125930,_0x5e7fd5[_0x49ca('0x68')],_0x5e7fd5[_0x49ca('0x69')],_0x348567);})[_0x49ca('0x25')](function(_0x93b90){_0x372e17=_0x93b90;return getTicket(_0x4e85aa,_0x1cff1f,_0x372e17,_0x125930,_0x5e7fd5,_0x125930['Fields'],_0x348567,_0x49ca('0x5d'));})['then'](function(_0x55a332){_0x4f2410=_0x55a332;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x4f2410['id']);logger[_0x49ca('0x1e')](_0x49ca('0x6a'),_0x4f2410['id'],_0x115896[_0x49ca('0x53')],_0x4e85aa[_0x49ca('0x3d')]);switch(_0x4e85aa[_0x49ca('0x3d')]){case'integrationTab':emit(util['format']('user:%s',_0x115896[_0x49ca('0x53')]),_0x49ca('0x6b'),{'recordId':_0x4f2410['id']});break;case _0x49ca('0x6c'):emit(util[_0x49ca('0x45')](_0x49ca('0x6d'),_0x115896['name']),'trigger:browser:url',{'uri':util[_0x49ca('0x45')](_0x49ca('0x6e'),_0x348567['instanceUrl'],_0x4f2410['id'])});break;default:logger[_0x49ca('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x49ca('0x70')](function(_0x3ad5c4){logger[_0x49ca('0x6f')](_0x49ca('0x62'),_0x3ad5c4);});};exports[_0x49ca('0x71')]=function(_0x113113,_0x2959f9,_0xed4ca7,_0x490be7,_0x50af7e,_0x42fc93,_0x31c88d){var _0x279361,_0x450743,_0x1c4e85,_0x2db17f;_0x42fc93[_0x49ca('0x5e')]=intUtil[_0x49ca('0x5f')](_0x42fc93['serverUrl']);_0x42fc93['remoteUri']=intUtil['stripTrailingSlash'](_0x42fc93[_0x49ca('0x60')]);if(_0x31c88d&&_0x31c88d[_0x49ca('0x72')]&&_0x31c88d[_0x49ca('0x72')]!==_0x49ca('0x73')){logger[_0x49ca('0x1e')](_0x49ca('0x74'),'Recording\x20is\x20enabled!');_0x2959f9['recordingURL']=util[_0x49ca('0x45')](_0x49ca('0x65'),_0x42fc93['serverUrl'],_0x2959f9[_0x49ca('0x66')],md5(_0x2959f9['uniqueid']));}return getConnection(_0x42fc93)['then'](function(_0xbcacb3){_0x2db17f=_0xbcacb3;return getUser(_0x42fc93,_0x490be7[_0x49ca('0x67')],_0x2db17f);})['then'](function(_0x56dd61){_0x279361=_0x56dd61;return getEndUser(_0x42fc93,_0xed4ca7,_0x2959f9[_0x49ca('0x75')],_0x2959f9['destcalleridnum'],_0x2db17f);})[_0x49ca('0x25')](function(_0x4bc57d){_0x450743=_0x4bc57d;return getTicket(_0x42fc93,_0x279361,_0x450743,_0xed4ca7,_0x2959f9,_0xed4ca7[_0x49ca('0x76')],_0x2db17f,_0x49ca('0x71'));})[_0x49ca('0x25')](function(_0x94464c){_0x1c4e85=_0x94464c;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x1c4e85['id']);logger['info'](_0x49ca('0x77'),_0x1c4e85['id'],_0x490be7[_0x49ca('0x53')],_0x42fc93[_0x49ca('0x3d')]);switch(_0x42fc93[_0x49ca('0x3d')]){case _0x49ca('0x78'):emit(util[_0x49ca('0x45')](_0x49ca('0x6d'),_0x490be7[_0x49ca('0x53')]),_0x49ca('0x6b'),{'recordId':_0x1c4e85['id']});break;case _0x49ca('0x6c'):emit(util[_0x49ca('0x45')](_0x49ca('0x6d'),_0x490be7[_0x49ca('0x53')]),_0x49ca('0x79'),{'uri':util[_0x49ca('0x45')](_0x49ca('0x6e'),_0x2db17f[_0x49ca('0x7a')],_0x1c4e85['id'])});break;default:logger[_0x49ca('0x6f')](_0x49ca('0x74'),_0x49ca('0x7b'));}})['catch'](function(_0x7a371b){logger['error'](_0x49ca('0x74'),_0x7a371b);});};exports[_0x49ca('0x7c')]=function(_0x170f58,_0x55606e,_0x2ec7c4,_0x293367,_0x1bb02c,_0x21e8cc){var _0x218f33,_0x277bf1,_0x17df1a,_0x3c298a;_0x21e8cc[_0x49ca('0x5e')]=intUtil[_0x49ca('0x5f')](_0x21e8cc[_0x49ca('0x5e')]);_0x21e8cc[_0x49ca('0x60')]=intUtil[_0x49ca('0x5f')](_0x21e8cc[_0x49ca('0x60')]);if(_0x1bb02c&&_0x1bb02c['monitor_format']){logger[_0x49ca('0x1e')]('['+_0x55606e[_0x49ca('0x7d')][_0x49ca('0x7e')]()+']','Recording\x20is\x20enabled!');_0x55606e[_0x49ca('0x64')]=util['format'](_0x49ca('0x65'),_0x21e8cc['serverUrl'],_0x55606e[_0x49ca('0x66')],md5(_0x55606e[_0x49ca('0x66')]));}else{_0x55606e[_0x49ca('0x64')]='';}return getConnection(_0x21e8cc)[_0x49ca('0x25')](function(_0x71cd79){_0x3c298a=_0x71cd79;if(!_[_0x49ca('0x20')](_0x293367)){return getUser(_0x21e8cc,_0x293367['name'],_0x3c298a);}else{return getUser(_0x21e8cc,null,_0x3c298a);}})[_0x49ca('0x25')](function(_0x45b50c){_0x218f33=_0x45b50c;return getEndUser(_0x21e8cc,_0x2ec7c4,_0x55606e[_0x49ca('0x68')],_0x55606e['calleridnum'],_0x3c298a);})['then'](function(_0x4a8a62){_0x277bf1=_0x4a8a62;return getTicket(_0x21e8cc,_0x218f33,_0x277bf1,_0x2ec7c4,_0x55606e,_0x2ec7c4[_0x49ca('0x76')],_0x3c298a);})['then'](function(_0xd37f18){_0x17df1a=_0xd37f18;logger[_0x49ca('0x1e')]('['+_0x55606e[_0x49ca('0x7d')][_0x49ca('0x7e')]()+_0x49ca('0x7f'),_0x17df1a['id']);logger['info']('['+_0x55606e[_0x49ca('0x7d')][_0x49ca('0x7e')]()+_0x49ca('0x80'),_0x21e8cc['type']);})['catch'](function(_0x1c1acd){logger[_0x49ca('0x6f')]('['+_0x55606e[_0x49ca('0x7d')][_0x49ca('0x7e')]()+']',_0x1c1acd);});}; \ No newline at end of file +var _0x1b1a=['contact_lead','additionalSearchContact','merge','$or','Contact','execute','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','forEach','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','emit','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','IsRecurrence','endUserType','contact','account','AccountId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','find','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','info','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch'];(function(_0x415828,_0x4c461c){var _0x474da3=function(_0x448458){while(--_0x448458){_0x415828['push'](_0x415828['shift']());}};_0x474da3(++_0x4c461c);}(_0x1b1a,0xca));var _0xa1b1=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x1b1a[_0x4bf96c];return _0x281d09;};'use strict';var _=require(_0xa1b1('0x0'));var rp=require('request-promise');var moment=require(_0xa1b1('0x1'));var BPromise=require(_0xa1b1('0x2'));var md5=require(_0xa1b1('0x3'));var jsforce=require(_0xa1b1('0x4'));var util=require(_0xa1b1('0x5'));var Redis=require(_0xa1b1('0x6'));var intUtil=require(_0xa1b1('0x7'));var config=require(_0xa1b1('0x8'));var logger=require('../../../../config/logger')(_0xa1b1('0x9'));config['redis']=_['defaults'](config[_0xa1b1('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa1b1('0xa')]));function emit(_0x1b85e0,_0x253344,_0x4d67e6){io['to'](_0x1b85e0)[_0xa1b1('0xb')](_0x253344,_0x4d67e6);}function getTicket(_0x365c85,_0x574e88,_0x1bc91f,_0x3be849,_0x59ded8,_0x29ccec,_0x4da41d,_0x2f7799){var _0x18bebd=Object['assign']({},{'OwnerId':_0x574e88['id'],'Subject':intUtil['getString'](_0x3be849[_0xa1b1('0xc')],_0x59ded8,'\x20'),'Description':intUtil[_0xa1b1('0xd')](_0x3be849[_0xa1b1('0xe')],_0x59ded8,'\x0a')},getCustomFields(_0x29ccec,_0x59ded8));if(_0x1bc91f){if(_0x3be849[_0xa1b1('0xf')]===_0xa1b1('0x10')){_0x18bebd[_0xa1b1('0x11')]=moment['utc']();_0x18bebd['IsReminderSet']=![];_0x18bebd[_0xa1b1('0x12')]=![];if(_0x1bc91f[_0xa1b1('0x13')]===_0xa1b1('0x14')||_0x1bc91f[_0xa1b1('0x13')]==='lead'){_0x18bebd['WhoId']=_0x1bc91f['id'];}else if(_0x1bc91f[_0xa1b1('0x13')]===_0xa1b1('0x15')){_0x18bebd['WhatId']=_0x1bc91f['id'];}}else if(_0x3be849[_0xa1b1('0xf')]==='Case'){if(_0x1bc91f[_0xa1b1('0x13')]===_0xa1b1('0x14')){_0x18bebd['ContactId']=_0x1bc91f['id'];}else if(_0x1bc91f['endUserType']==='account'){_0x18bebd[_0xa1b1('0x16')]=_0x1bc91f['id'];}else if(_0x1bc91f[_0xa1b1('0x13')]===_0xa1b1('0x17')&&_0x3be849[_0xa1b1('0x18')]){_0x18bebd[_0x3be849[_0xa1b1('0x18')]]=_0x1bc91f['id'];}else{logger['info'](_0xa1b1('0x19'));}}}return _0x4da41d[_0xa1b1('0x1a')](_0x3be849['ticketType'])[_0xa1b1('0x1b')](_0x18bebd);}function getUser(_0x3c4c59,_0x186207,_0x250a62){if(!_[_0xa1b1('0x1c')](_0x186207)&&intUtil['validateEmail'](_0x186207)){var _0x17fab9={'Email':_0x186207};var _0x3dca8f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x250a62[_0xa1b1('0x1a')]('User')[_0xa1b1('0x1d')](_0x17fab9,_0x3dca8f)['execute']()[_0xa1b1('0x1e')](function(_0x19e161){if(_0x19e161[_0xa1b1('0x1f')]){var _0x5b5b55=_[_0xa1b1('0x1d')](_0x19e161,function(_0x13f532){return _0x13f532['Email']===_0x186207;});if(_0x5b5b55){logger['info'](_0xa1b1('0x20'),_0x186207);return BPromise[_0xa1b1('0x21')]({'id':_0x5b5b55['Id'],'name':_0x5b5b55[_0xa1b1('0x22')]});}}else{logger['info'](_0xa1b1('0x23'),_0x186207);return _0x250a62[_0xa1b1('0x24')]()[_0xa1b1('0x1e')](function(_0x3396e5){return BPromise[_0xa1b1('0x21')]({'id':_0x3396e5[_0xa1b1('0x25')],'name':_0x3396e5[_0xa1b1('0x26')]});});}});}else{logger[_0xa1b1('0x27')](_0xa1b1('0x23'),_0x186207);return _0x250a62[_0xa1b1('0x24')]()[_0xa1b1('0x1e')](function(_0x1e51ce){return BPromise['resolve']({'id':_0x1e51ce['user_id'],'name':_0x1e51ce[_0xa1b1('0x26')]});});}}function getEndUser(_0x3a0cf8,_0xb38b60,_0x505aab,_0x80a806,_0x1f0960){var _0x10753c={'$or':{'Phone':_0x80a806}};var _0x26d234={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xa1b1('0x1e')](function(){logger['info'](_0xa1b1('0x28'),_0x80a806,_0xb38b60[_0xa1b1('0x29')]);switch(_0xb38b60['moduleSearch']){case _0xa1b1('0x2a'):var _0x5b784d=_['cloneDeep'](_0x10753c);if(_0xb38b60['additionalSearchContact']){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x2b')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x5b784d[_0xa1b1('0x2d')],_0x31bcda);}return _0x1f0960[_0xa1b1('0x1a')](_0xa1b1('0x2e'))[_0xa1b1('0x1d')](_0x5b784d,_0x26d234)[_0xa1b1('0x2f')]()[_0xa1b1('0x1e')](function(_0x19d35a){if(_0x19d35a&&_0x19d35a['length']){return _0x19d35a;}else{var _0x93f36d=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60['additionalSearchLead']){var _0x59dc6f={};_0x59dc6f[_0xb38b60[_0xa1b1('0x31')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x93f36d['$or'],_0x59dc6f);}return _0x1f0960['sobject'](_0xa1b1('0x32'))[_0xa1b1('0x1d')](_0x93f36d,_0x26d234);}});case _0xa1b1('0x33'):var _0x1c9f02=_['cloneDeep'](_0x10753c);if(_0xb38b60[_0xa1b1('0x34')]){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x34')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x1c9f02['$or'],_0x31bcda);}return _0x1f0960[_0xa1b1('0x1a')](_0xa1b1('0x35'))[_0xa1b1('0x1d')](_0x1c9f02,_0x26d234)[_0xa1b1('0x2f')]()['then'](function(_0x37c049){if(_0x37c049&&_0x37c049['length']){return _0x37c049;}else{var _0x2f6fdd=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60[_0xa1b1('0x2b')]){var _0x2c22d4={};_0x2c22d4[_0xb38b60['additionalSearchContact']]=_0x80a806;_[_0xa1b1('0x2c')](_0x2f6fdd[_0xa1b1('0x2d')],_0x2c22d4);}return _0x1f0960['sobject'](_0xa1b1('0x2e'))[_0xa1b1('0x1d')](_0x2f6fdd,_0x26d234)[_0xa1b1('0x1e')](function(_0x54703a){if(_0x54703a&&_0x54703a[_0xa1b1('0x1f')]){return _0x54703a;}else{var _0x1965a3=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60[_0xa1b1('0x31')]){var _0x3d002c={};_0x3d002c[_0xb38b60[_0xa1b1('0x31')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x1965a3['$or'],_0x3d002c);}return _0x1f0960[_0xa1b1('0x1a')](_0xa1b1('0x32'))[_0xa1b1('0x1d')](_0x1965a3,_0x26d234);}});}});case _0xa1b1('0x14'):var _0x5b784d=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60[_0xa1b1('0x2b')]){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x2b')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x5b784d[_0xa1b1('0x2d')],_0x31bcda);}return _0x1f0960['sobject'](_0xa1b1('0x2e'))[_0xa1b1('0x1d')](_0x5b784d,_0x26d234)[_0xa1b1('0x2f')]();case _0xa1b1('0x17'):var _0x159d0c=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60[_0xa1b1('0x31')]){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x31')]]=_0x80a806;_['merge'](_0x159d0c[_0xa1b1('0x2d')],_0x31bcda);}return _0x1f0960['sobject'](_0xa1b1('0x32'))[_0xa1b1('0x1d')](_0x159d0c,_0x26d234);case'account':var _0x1c9f02=_[_0xa1b1('0x30')](_0x10753c);if(_0xb38b60['additionalSearchAccount']){var _0x31bcda={};_0x31bcda[_0xb38b60[_0xa1b1('0x34')]]=_0x80a806;_[_0xa1b1('0x2c')](_0x1c9f02[_0xa1b1('0x2d')],_0x31bcda);}return _0x1f0960[_0xa1b1('0x1a')](_0xa1b1('0x35'))['find'](_0x1c9f02,_0x26d234);default:return null;}})['then'](function(_0x124dcd){if(_0x124dcd&&_0x124dcd[_0xa1b1('0x1f')]){var _0xbf040f=_[_0xa1b1('0x36')](_0x124dcd);if(_0xbf040f){return BPromise['resolve']({'id':_0xbf040f['Id'],'name':_0xbf040f[_0xa1b1('0x22')],'phone':_0xbf040f['Phone'],'endUserType':_0xbf040f[_0xa1b1('0x37')][_0xa1b1('0x38')][_0xa1b1('0x39')]()});}}})[_0xa1b1('0x1e')](function(_0x595db1){if(_0x595db1){logger[_0xa1b1('0x27')](_0xa1b1('0x3a'),_0x595db1['endUserType'],_0x80a806);return BPromise[_0xa1b1('0x21')](_0x595db1);}else{logger[_0xa1b1('0x27')](_0xa1b1('0x3b'),_0x80a806);var _0x570b00={'Phone':_0x80a806};if(_0xb38b60['moduleCreate']){if(_0xb38b60[_0xa1b1('0x3c')]===_0xa1b1('0x14')){logger[_0xa1b1('0x27')](_0xa1b1('0x3d'),_0x80a806,_0xb38b60[_0xa1b1('0x3c')]);_0x570b00[_0xa1b1('0x3e')]=_0x505aab!==_0xa1b1('0x3f')?_0x505aab:util[_0xa1b1('0x40')](_0xa1b1('0x41'),_0x80a806);}else if(_0xb38b60[_0xa1b1('0x3c')]===_0xa1b1('0x17')){logger[_0xa1b1('0x27')](_0xa1b1('0x3d'),_0x80a806,_0xb38b60[_0xa1b1('0x3c')]);_0x570b00[_0xa1b1('0x3e')]=_0x505aab!==''?_0x505aab:util[_0xa1b1('0x40')](_0xa1b1('0x41'),_0x80a806);_0x570b00['Company']=_0xa1b1('0x42');}else if(_0xb38b60[_0xa1b1('0x3c')]==='account'){logger[_0xa1b1('0x27')](_0xa1b1('0x3d'),_0x80a806,_0xb38b60[_0xa1b1('0x3c')]);_0x570b00[_0xa1b1('0x22')]=_0x505aab!==_0xa1b1('0x3f')?_0x505aab:util[_0xa1b1('0x40')](_0xa1b1('0x41'),_0x80a806);}else{return null;}}return _0x1f0960['sobject'](_['upperFirst'](_0xb38b60['moduleCreate']))[_0xa1b1('0x1b')](_0x570b00)['then'](function(_0x3ba3dd){return BPromise[_0xa1b1('0x21')]({'id':_0x3ba3dd['id'],'endUserType':_0xb38b60['moduleCreate']});});}});}function getCustomFields(_0x6411d3,_0x3f9231){var _0x28696c={};if(_0x6411d3[_0xa1b1('0x1f')]>0x0){_[_0xa1b1('0x43')](_0x6411d3,function(_0x4df706){if(_['includes']([_0xa1b1('0x44'),_0xa1b1('0x45')],_0x4df706[_0xa1b1('0x38')])&&_0x4df706[_0xa1b1('0x46')]){_0x28696c[_0x4df706[_0xa1b1('0x46')]]=_0x4df706[_0xa1b1('0x47')]['toString']();}else if(_0x4df706[_0xa1b1('0x38')]===_0xa1b1('0x48')&&_0x4df706[_0xa1b1('0x49')]&&_0x4df706[_0xa1b1('0x46')]){_0x3f9231[_0x4df706['variableName']]&&(_0x28696c[_0x4df706[_0xa1b1('0x46')]]=_0x3f9231[_0x4df706[_0xa1b1('0x49')]][_0xa1b1('0x4a')]());}else if(_0x4df706[_0xa1b1('0x38')]===_0xa1b1('0x4b')&&_0x4df706[_0xa1b1('0x4c')]&&_0x4df706[_0xa1b1('0x4c')]['name']&&_0x4df706['idField']){_0x3f9231[_0x4df706[_0xa1b1('0x4c')][_0xa1b1('0x4d')][_0xa1b1('0x39')]()]&&(_0x28696c[_0x4df706[_0xa1b1('0x46')]]=_0x3f9231[_0x4df706[_0xa1b1('0x4c')][_0xa1b1('0x4d')][_0xa1b1('0x39')]()]['toString']());}});}return _0x28696c;}function getConnection(_0x46e124){var _0xbefe1f=_0x46e124[_0xa1b1('0x4e')][_0xa1b1('0x4f')](_0x46e124['securityToken']);var _0x55dc7a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x46e124[_0xa1b1('0x50')]||_0xa1b1('0x51'),'clientId':_0x46e124['clientId'],'clientSecret':_0x46e124[_0xa1b1('0x52')]}});return _0x55dc7a[_0xa1b1('0x53')](_0x46e124[_0xa1b1('0x54')],_0xbefe1f)[_0xa1b1('0x1e')](function(){logger[_0xa1b1('0x27')](_0xa1b1('0x55'));return _0x55dc7a;});}exports[_0xa1b1('0x56')]=function(_0x14f4da,_0x5cbf2d,_0x3f9623,_0x1860e3,_0x257906,_0x57de3a){var _0x25b5b0,_0x7d00b6,_0x311f92,_0x1a0978;_0x57de3a['serverUrl']=intUtil[_0xa1b1('0x57')](_0x57de3a[_0xa1b1('0x58')]);_0x57de3a[_0xa1b1('0x50')]=intUtil['stripTrailingSlash'](_0x57de3a[_0xa1b1('0x50')]);if(_0x257906&&_0x257906[_0xa1b1('0x59')]){logger[_0xa1b1('0x27')](_0xa1b1('0x5a'),_0xa1b1('0x5b'));_0x5cbf2d[_0xa1b1('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x57de3a['serverUrl'],_0x5cbf2d[_0xa1b1('0x5d')],md5(_0x5cbf2d[_0xa1b1('0x5d')]));}else{_0x5cbf2d[_0xa1b1('0x5c')]='';}return getConnection(_0x57de3a)[_0xa1b1('0x1e')](function(_0x355ebc){_0x1a0978=_0x355ebc;return getUser(_0x57de3a,_0x1860e3[_0xa1b1('0x5e')],_0x1a0978);})['then'](function(_0x241a0a){_0x25b5b0=_0x241a0a;return getEndUser(_0x57de3a,_0x3f9623,_0x5cbf2d[_0xa1b1('0x5f')],_0x5cbf2d[_0xa1b1('0x60')],_0x1a0978);})['then'](function(_0x54df3f){_0x7d00b6=_0x54df3f;return getTicket(_0x57de3a,_0x25b5b0,_0x7d00b6,_0x3f9623,_0x5cbf2d,_0x3f9623['Fields'],_0x1a0978,_0xa1b1('0x56'));})['then'](function(_0x5683c9){_0x311f92=_0x5683c9;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x311f92['id']);logger[_0xa1b1('0x27')](_0xa1b1('0x61'),_0x311f92['id'],_0x1860e3['name'],_0x57de3a['type']);switch(_0x57de3a[_0xa1b1('0x38')]){case _0xa1b1('0x62'):emit(util[_0xa1b1('0x40')](_0xa1b1('0x63'),_0x1860e3[_0xa1b1('0x4d')]),_0xa1b1('0x64'),{'recordId':_0x311f92['id']});break;case _0xa1b1('0x65'):emit(util['format'](_0xa1b1('0x63'),_0x1860e3[_0xa1b1('0x4d')]),_0xa1b1('0x66'),{'uri':util[_0xa1b1('0x40')](_0xa1b1('0x67'),_0x1a0978[_0xa1b1('0x68')],_0x311f92['id'])});break;default:logger['error'](_0xa1b1('0x69'));}})[_0xa1b1('0x6a')](function(_0x5014bf){logger[_0xa1b1('0x6b')]('[QUEUE]',_0x5014bf);});};exports[_0xa1b1('0x6c')]=function(_0x3ee283,_0xd32dd8,_0x7b9f12,_0x343d43,_0x83ef54,_0xd4f936,_0x3fd4e0){var _0x547a56,_0x5c8d73,_0x13b8a6,_0x36a9ee;_0xd4f936[_0xa1b1('0x58')]=intUtil['stripTrailingSlash'](_0xd4f936['serverUrl']);_0xd4f936[_0xa1b1('0x50')]=intUtil[_0xa1b1('0x57')](_0xd4f936[_0xa1b1('0x50')]);if(_0x3fd4e0&&_0x3fd4e0[_0xa1b1('0x6d')]&&_0x3fd4e0['recordingFormat']!==_0xa1b1('0x6e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0xd32dd8[_0xa1b1('0x5c')]=util[_0xa1b1('0x40')](_0xa1b1('0x6f'),_0xd4f936[_0xa1b1('0x58')],_0xd32dd8[_0xa1b1('0x5d')],md5(_0xd32dd8[_0xa1b1('0x5d')]));}return getConnection(_0xd4f936)[_0xa1b1('0x1e')](function(_0x31bc49){_0x36a9ee=_0x31bc49;return getUser(_0xd4f936,_0x343d43[_0xa1b1('0x5e')],_0x36a9ee);})[_0xa1b1('0x1e')](function(_0x20c0d8){_0x547a56=_0x20c0d8;return getEndUser(_0xd4f936,_0x7b9f12,_0xd32dd8['destcalleridname'],_0xd32dd8[_0xa1b1('0x70')],_0x36a9ee);})[_0xa1b1('0x1e')](function(_0x17afb8){_0x5c8d73=_0x17afb8;return getTicket(_0xd4f936,_0x547a56,_0x5c8d73,_0x7b9f12,_0xd32dd8,_0x7b9f12[_0xa1b1('0x71')],_0x36a9ee,'outbound');})[_0xa1b1('0x1e')](function(_0x44ba81){_0x13b8a6=_0x44ba81;logger[_0xa1b1('0x27')](_0xa1b1('0x72'),_0x13b8a6['id']);logger[_0xa1b1('0x27')](_0xa1b1('0x73'),_0x13b8a6['id'],_0x343d43[_0xa1b1('0x4d')],_0xd4f936['type']);switch(_0xd4f936[_0xa1b1('0x38')]){case _0xa1b1('0x62'):emit(util[_0xa1b1('0x40')](_0xa1b1('0x63'),_0x343d43['name']),_0xa1b1('0x64'),{'recordId':_0x13b8a6['id']});break;case _0xa1b1('0x65'):emit(util['format'](_0xa1b1('0x63'),_0x343d43[_0xa1b1('0x4d')]),_0xa1b1('0x66'),{'uri':util['format'](_0xa1b1('0x67'),_0x36a9ee['instanceUrl'],_0x13b8a6['id'])});break;default:logger[_0xa1b1('0x6b')](_0xa1b1('0x74'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xa1b1('0x6a')](function(_0x429d07){logger[_0xa1b1('0x6b')](_0xa1b1('0x74'),_0x429d07);});};exports[_0xa1b1('0x75')]=function(_0x166b98,_0x2bbf88,_0x39f1ef,_0x50edbb,_0x43c9bf,_0x46293c){var _0x42fc37,_0x310b57,_0x4e95b5,_0x5eec0d;_0x46293c['serverUrl']=intUtil[_0xa1b1('0x57')](_0x46293c[_0xa1b1('0x58')]);_0x46293c['remoteUri']=intUtil['stripTrailingSlash'](_0x46293c['remoteUri']);if(_0x43c9bf&&_0x43c9bf[_0xa1b1('0x59')]){logger[_0xa1b1('0x27')]('['+_0x2bbf88[_0xa1b1('0x76')]['toUpperCase']()+']',_0xa1b1('0x5b'));_0x2bbf88['recordingURL']=util[_0xa1b1('0x40')](_0xa1b1('0x6f'),_0x46293c[_0xa1b1('0x58')],_0x2bbf88[_0xa1b1('0x5d')],md5(_0x2bbf88[_0xa1b1('0x5d')]));}else{_0x2bbf88[_0xa1b1('0x5c')]='';}return getConnection(_0x46293c)[_0xa1b1('0x1e')](function(_0x16d150){_0x5eec0d=_0x16d150;if(!_[_0xa1b1('0x1c')](_0x50edbb)){return getUser(_0x46293c,_0x50edbb[_0xa1b1('0x4d')],_0x5eec0d);}else{return getUser(_0x46293c,null,_0x5eec0d);}})[_0xa1b1('0x1e')](function(_0xf6fc96){_0x42fc37=_0xf6fc96;return getEndUser(_0x46293c,_0x39f1ef,_0x2bbf88['calleridname'],_0x2bbf88[_0xa1b1('0x60')],_0x5eec0d);})['then'](function(_0x598ac7){_0x310b57=_0x598ac7;return getTicket(_0x46293c,_0x42fc37,_0x310b57,_0x39f1ef,_0x2bbf88,_0x39f1ef[_0xa1b1('0x71')],_0x5eec0d);})[_0xa1b1('0x1e')](function(_0x39b22d){_0x4e95b5=_0x39b22d;logger[_0xa1b1('0x27')]('['+_0x2bbf88['lastevent'][_0xa1b1('0x77')]()+_0xa1b1('0x78'),_0x4e95b5['id']);logger[_0xa1b1('0x27')]('['+_0x2bbf88[_0xa1b1('0x76')][_0xa1b1('0x77')]()+_0xa1b1('0x79'),_0x46293c[_0xa1b1('0x38')]);})[_0xa1b1('0x6a')](function(_0x38ab0a){logger[_0xa1b1('0x6b')]('['+_0x2bbf88[_0xa1b1('0x76')][_0xa1b1('0x77')]()+']',_0x38ab0a);});}; \ 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 318e890..f65b066 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 _0x19c1=['adminId','toUpperCase','catch','message','info','],\x20getUser\x20input\x20crm','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','userId','adminEmail','error',']\x20using\x20admin\x20profile','sys_user?','user','true','System','endUserNumber','],\x20EndUser\x20schema','endUserId','sys_id','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','incident','Incident','ticketId','forEach','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','socket.io-emitter','redis','sys_user?sysparm_query=user_name%3Dadmin','then','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x19c1,0xc1));var _0x119c=function(_0x49e71a,_0xaa3d4e){_0x49e71a=_0x49e71a-0x0;var _0x2e58b0=_0x19c1[_0x49e71a];return _0x2e58b0;};'use strict';var _=require('lodash');var Promise=require(_0x119c('0x0'));var rp=require(_0x119c('0x1'));var util=require(_0x119c('0x2'));var md5=require(_0x119c('0x3'));var Redis=require(_0x119c('0x4'));var intUtil=require(_0x119c('0x5'));var config=require(_0x119c('0x6'));var logger=require(_0x119c('0x7'))(_0x119c('0x8'));config['redis']=_[_0x119c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x119c('0xa'))(new Redis(config[_0x119c('0xb')]));function getAdminUser(_0x42b129,_0x2cb4ac,_0x53b001,_0x3d2d18,_0x499813,_0x3de646){return new Promise(function(_0x126543,_0x338881){var _0x5a045a={'method':'GET','uri':_0x3d2d18+_0x119c('0xc')+'&'+_0x499813+'&'+_0x3de646,'auth':_0x2cb4ac,'json':!![]};return rp(_0x5a045a)[_0x119c('0xd')](function(_0x3ba653){if(_0x3ba653[_0x119c('0xe')]['length']>0x0){_0x53b001[_0x119c('0xf')]=_0x3ba653[_0x119c('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x42b129[_0x119c('0x10')]()]+'],\x20getAdminUser\x20crm',_0x53b001);_0x126543(_0x53b001);})[_0x119c('0x11')](function(_0xf48ecb){logger['error']('['+[_0x42b129[_0x119c('0x10')]()]+']',_0xf48ecb[_0x119c('0x12')]);_0x338881(_0xf48ecb[_0x119c('0x12')]);});});}function getUser(_0x3c6629,_0x37e1d2,_0x67e95f,_0x579b65,_0x5b9786){return function(_0x2bee49){logger[_0x119c('0x13')]('['+[_0x3c6629['toUpperCase']()]+_0x119c('0x14'),_0x2bee49);return new Promise(function(_0x32c5f7,_0xeca728){if(intUtil['validateEmail'](_0x2bee49[_0x119c('0x15')])){var _0x5a338e={'method':_0x119c('0x16'),'uri':_0x67e95f+_0x119c('0x17')+_0x2bee49[_0x119c('0x15')]+'&'+_0x579b65+'&'+_0x5b9786,'auth':_0x37e1d2,'json':!![]};logger['info']('['+[_0x3c6629[_0x119c('0x10')]()]+_0x119c('0x18'),_0x5a338e);return rp(_0x5a338e)[_0x119c('0xd')](function(_0x55f7f0){logger[_0x119c('0x13')]('['+[_0x3c6629[_0x119c('0x10')]()]+_0x119c('0x19'),_0x55f7f0);if(_0x55f7f0[_0x119c('0xe')][_0x119c('0x1a')]>0x0&&String(_0x55f7f0[_0x119c('0xe')][0x0]['active'])==='true'){_0x2bee49[_0x119c('0x1b')]=_0x55f7f0['result'][0x0]['sys_id'];}else{_0x2bee49[_0x119c('0x1b')]=_0x2bee49[_0x119c('0xf')];_0x2bee49[_0x119c('0x15')]=_0x2bee49[_0x119c('0x1c')];}logger[_0x119c('0x13')]('['+[_0x3c6629[_0x119c('0x10')]()]+'],\x20getUser\x20crm',_0x2bee49);_0x32c5f7(_0x2bee49);})[_0x119c('0x11')](function(_0x1caf48){logger[_0x119c('0x1d')]('['+[_0x3c6629['toUpperCase']()]+']',_0x1caf48[_0x119c('0x12')]);_0xeca728(_0x1caf48['message']);});}else{logger['info']('['+[_0x3c6629[_0x119c('0x10')]()]+_0x119c('0x1e'));_0x2bee49['userId']=_0x2bee49['adminId'];_0x2bee49[_0x119c('0x15')]=_0x2bee49[_0x119c('0x1c')];_0x32c5f7(_0x2bee49);}});};}function createEndUser(_0x15954c,_0x1bf352,_0x5820d4,_0x292d39,_0x1b7569){logger[_0x119c('0x13')]('['+[_0x15954c[_0x119c('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x5820d4);return new Promise(function(_0x1cfcfb,_0x37c964){var _0x5902eb={'method':'POST','uri':_0x292d39+_0x119c('0x1f')+_0x1b7569,'body':{'user_name':_0x5820d4['endUserNumber'],'roles':_0x119c('0x20'),'first_name':_0x5820d4['endUserNumber'],'active':_0x119c('0x21'),'date_format':_0x119c('0x22'),'phone':_0x5820d4[_0x119c('0x23')]},'auth':_0x1bf352,'json':!![]};return rp(_0x5902eb)[_0x119c('0xd')](function(_0x319d9e){logger[_0x119c('0x13')]('['+[_0x15954c[_0x119c('0x10')]()]+_0x119c('0x24'),_0x319d9e[_0x119c('0xe')]);_0x5820d4[_0x119c('0x25')]=_0x319d9e[_0x119c('0xe')][_0x119c('0x26')];_0x1cfcfb(_0x5820d4);})[_0x119c('0x11')](function(_0xbb3558){logger[_0x119c('0x1d')]('['+[_0x15954c['toUpperCase']()]+']',_0xbb3558['message']);_0x37c964(_0xbb3558[_0x119c('0x12')]);});});}function getEndUser(_0x98a87f,_0x51db63,_0x17b3c2,_0x4fc9be,_0x28889b){return function(_0x3dc1cd){logger[_0x119c('0x13')]('['+[_0x98a87f['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x3dc1cd);return new Promise(function(_0x5392e6,_0x536660){var _0x1d978e={'method':_0x119c('0x16'),'uri':_0x17b3c2+'sys_user?sysparm_query=phone%3D'+_0x3dc1cd[_0x119c('0x23')]+'&'+_0x4fc9be+'&'+_0x28889b,'auth':_0x51db63,'json':!![]};return rp(_0x1d978e)[_0x119c('0xd')](function(_0x3cb901){if(_0x3cb901['result'][_0x119c('0x1a')]>0x0){_0x3dc1cd[_0x119c('0x25')]=_0x3cb901['result'][0x0]['sys_id'];logger['info']('['+[_0x98a87f[_0x119c('0x10')]()]+_0x119c('0x27'),_0x3dc1cd);_0x5392e6(_0x3dc1cd);}else{return createEndUser(_0x98a87f,_0x51db63,_0x3dc1cd,_0x17b3c2,_0x4fc9be)[_0x119c('0xd')](function(_0xdd19c7){logger[_0x119c('0x13')]('['+[_0x98a87f[_0x119c('0x10')]()]+_0x119c('0x28'),_0xdd19c7);_0x5392e6(_0xdd19c7);});}})[_0x119c('0x11')](function(_0x3ef41d){logger['error']('['+[_0x98a87f['toUpperCase']()]+']',_0x3ef41d[_0x119c('0x12')]);_0x536660(_0x3ef41d[_0x119c('0x12')]);});});};}function getCustomFields(_0x408cb5,_0x270f02){var _0x57e1e4={};if(_0x408cb5[_0x119c('0x1a')]>0x0){_['forEach'](_0x408cb5,function(_0x184bdb){if(_['includes']([_0x119c('0x29'),_0x119c('0x2a')],_0x184bdb[_0x119c('0x2b')])&&_0x184bdb[_0x119c('0x2c')]&&!_0x184bdb[_0x119c('0x2d')]){_0x57e1e4[_0x184bdb['nameField'][_0x119c('0x2e')]()]=_0x184bdb[_0x119c('0x2f')][_0x119c('0x30')]();}else if(_['includes']([_0x119c('0x29'),'picklist'],_0x184bdb[_0x119c('0x2b')])&&_0x184bdb['idField']&&_0x184bdb[_0x119c('0x2d')]){_0x57e1e4[_0x184bdb[_0x119c('0x31')][_0x119c('0x2e')]()]=_0x184bdb['content']['toString']();}else if(_0x184bdb[_0x119c('0x2b')]===_0x119c('0x32')&&_0x184bdb[_0x119c('0x33')]&&_0x184bdb['idField']&&_0x184bdb[_0x119c('0x2d')]){_0x57e1e4[_0x184bdb[_0x119c('0x31')][_0x119c('0x2e')]()]=_0x270f02[_0x184bdb[_0x119c('0x33')]][_0x119c('0x30')]();}else if(_0x184bdb[_0x119c('0x2b')]==='customVariable'&&_0x184bdb['Variable']&&_0x184bdb[_0x119c('0x34')][_0x119c('0x35')]&&_0x184bdb['idField']&&_0x184bdb['customField']){_0x57e1e4[_0x184bdb[_0x119c('0x31')]['toLowerCase']()]=_0x270f02[_0x184bdb[_0x119c('0x34')][_0x119c('0x35')][_0x119c('0x2e')]()]['toString']();}});}return _0x57e1e4;}function getTicket(_0x3e0342,_0x4d8146,_0x229d81,_0x1c3b25,_0x56d5ff,_0x3e6279){return function(_0x1576af){logger[_0x119c('0x13')]('['+[_0x3e0342[_0x119c('0x10')]()]+_0x119c('0x36'),_0x1576af);return new Promise(function(_0x4db347,_0x21b794){var _0x48b025=_0x3e0342[_0x119c('0x2e')]()===_0x119c('0x37')?_0x1576af[_0x119c('0x1b')]:_0x1576af['endUserId'];var _0x50fcd8={'method':_0x119c('0x38'),'uri':_0x229d81+'incident'+'?'+_0x3e6279,'body':Object['assign']({},{'active':_0x119c('0x21'),'caller_id':_0x48b025,'assigned_to':_0x1576af[_0x119c('0x1b')],'short_description':intUtil[_0x119c('0x39')](_0x1c3b25[_0x119c('0x3a')],_0x56d5ff,'\x20'),'description':intUtil[_0x119c('0x39')](_0x1c3b25['Descriptions'],_0x56d5ff,'\x0a')},getCustomFields(_0x1c3b25[_0x119c('0x3b')],_0x56d5ff)),'auth':_0x4d8146,'json':!![]};return rp(_0x50fcd8)[_0x119c('0xd')](function(_0x5a1661){logger[_0x119c('0x13')]('['+[_0x3e0342[_0x119c('0x10')]()]+_0x119c('0x3c'),_0x5a1661[_0x119c('0xe')]);_0x1576af['ticketId']=_0x5a1661[_0x119c('0xe')]['sys_id'];_0x1576af[_0x119c('0x3d')]=_0x5a1661[_0x119c('0xe')][_0x119c('0x3e')];logger[_0x119c('0x13')]('['+[_0x3e0342[_0x119c('0x10')]()]+_0x119c('0x3f'),_0x1576af);_0x4db347(_0x1576af);})[_0x119c('0x11')](function(_0x3856e7){logger[_0x119c('0x1d')]('['+[_0x3e0342[_0x119c('0x10')]()]+']',_0x3856e7[_0x119c('0x12')]);_0x21b794(_0x3856e7[_0x119c('0x12')]);});});};}function createRemoteTag(_0xcc012f,_0x1ce056,_0x12e635,_0x563844){return new Promise(function(_0x177b3a,_0x295ec4){var _0x3ba822={'method':_0x119c('0x38'),'uri':_0x12e635+_0x119c('0x40')+'?'+_0x563844,'body':{'short_description':_0xcc012f,'global':!![],'active':!![],'name':_0xcc012f},'auth':_0x1ce056,'json':!![]};return rp(_0x3ba822)[_0x119c('0xd')](function(_0x2f54d4){var _0x487fe0=_0x2f54d4[_0x119c('0xe')][_0x119c('0x26')];_0x177b3a(_0x487fe0);});});}function getRemoteTag(_0x531360,_0x38ec0b,_0xc162d2,_0x7029d5,_0x723a2e){return new Promise(function(_0x4fe3db,_0x12f51d){var _0x10807e={'method':_0x119c('0x16'),'uri':_0xc162d2+_0x119c('0x40')+_0x119c('0x41')+_0x531360+'&'+_0x7029d5,'auth':_0x38ec0b,'json':!![]};return rp(_0x10807e)['then'](function(_0x14ada0){if(_0x14ada0[_0x119c('0xe')][_0x119c('0x1a')]>0x0){var _0x1f354e=_0x14ada0['result'][0x0][_0x119c('0x26')];_0x4fe3db(_0x1f354e);}else{return createRemoteTag(_0x531360,_0x38ec0b,_0xc162d2,_0x7029d5)[_0x119c('0xd')](function(_0x54bdfc){_0x4fe3db(_0x54bdfc);});}});});}function assignTagToIncident(_0x40133d,_0x47e469,_0x551ebd,_0x5e0b36,_0x128702){return new Promise(function(_0x389b6c,_0x369d94){var _0x1512cb={'method':'POST','uri':_0x551ebd+'label_entry'+'?'+_0x128702,'body':{'label':_0x40133d,'table':_0x119c('0x42'),'id_type':_0x119c('0x43'),'table_key':_0x5e0b36[_0x119c('0x44')],'title':'Incident\x20-\x20'+_0x5e0b36[_0x119c('0x3d')],'id_display':_0x5e0b36[_0x119c('0x3d')]},'auth':_0x47e469,'json':!![]};return rp(_0x1512cb)['then'](function(_0xde4ab6){_0x389b6c();})[_0x119c('0x11')](function(){_0x389b6c();});});}function manageTags(_0xe87721,_0xb858d6,_0x5d4074,_0x3e81c4,_0x39dce6,_0x112911,_0x8dc36){return new Promise(function(_0x4f2f9a,_0x574647){var _0x334967=[];_0xb858d6[_0x119c('0x45')](function(_0x395924){_0x334967['push'](getRemoteTag(_0x395924,_0x5d4074,_0x3e81c4,_0x112911,_0x8dc36));});return Promise[_0x119c('0x46')](_0x334967)[_0x119c('0xd')](function(_0x1753c0){if(_0x1753c0[_0x119c('0x1a')]){logger['info']('['+[_0xe87721[_0x119c('0x10')]()]+_0x119c('0x47'),_0x1753c0);var _0xd3af3d=[];_0x1753c0[_0x119c('0x45')](function(_0x4049e7){_0xd3af3d[_0x119c('0x48')](assignTagToIncident(_0x4049e7,_0x5d4074,_0x3e81c4,_0x39dce6,_0x112911));});return Promise[_0x119c('0x46')](_0xd3af3d)[_0x119c('0xd')](function(){_0x4f2f9a();})['catch'](function(){_0x4f2f9a();});}else{_0x4f2f9a();}});});}function getTags(_0x40afd4,_0x1867ed,_0x8a9b0,_0xe50c0c,_0x482a5e,_0x3f5b23){return function(_0x33c815){return new Promise(function(_0x5590bb,_0x472e21){var _0x4225b1=[];var _0xd81cc=_0xe50c0c['Tags'];if(_0xd81cc&&_0xd81cc['length']>0x0){_0x4225b1=_[_0x119c('0x49')](_0xd81cc,_0x119c('0x35'));}if(_0x4225b1[_0x119c('0x1a')]>0x0){return manageTags(_0x40afd4,_0x4225b1,_0x1867ed,_0x8a9b0,_0x33c815,_0x482a5e,_0x3f5b23)['then'](function(){_0x5590bb(_0x33c815);});}else{_0x5590bb(_0x33c815);}});};}function emit(_0x423b73,_0x5b4d62,_0x373252){var _0xa7bbf9=_0x119c('0x4a')+_0x119c('0x4b')+_0x119c('0x4c')+_0x119c('0x4d');var _0x4435d8={'uri':_0x423b73+_0x119c('0x4e')+_0x373252+_0xa7bbf9};io['to'](util[_0x119c('0x4f')](_0x119c('0x50'),_0x5b4d62))['emit']('trigger:browser:url',_0x4435d8);}exports['cs']=function(_0x8a1900,_0x447919,_0x1012a8,_0x5f2565,_0x4332e7,_0x2216c5,_0x162d82,_0x33c921){var _0x4ae0a9={};var _0x2ddb34={'user':_0x2216c5['username'],'pass':_0x2216c5['password']};var _0x1fe0df='sysparm_limit=1';var _0x81e9ab=_0x119c('0x51');_0x2216c5['remoteUri']=intUtil['stripTrailingSlash'](_0x2216c5[_0x119c('0x52')]);_0x2216c5[_0x119c('0x53')]=intUtil[_0x119c('0x54')](_0x2216c5[_0x119c('0x53')]);var _0x20ef3b=util[_0x119c('0x4f')](_0x119c('0x55'),_0x2216c5[_0x119c('0x52')]);_0x4ae0a9['userEmail']=!_[_0x119c('0x56')](_0x5f2565)?_0x5f2565[_0x119c('0x57')]:null;_0x4ae0a9[_0x119c('0x1c')]=_0x2216c5['email'];_0x4ae0a9['endUserNumber']=_0x33c921[_0x119c('0x2e')]()===_0x119c('0x37')?_0x447919['destcalleridnum']:_0x447919['calleridnum'];_0x4ae0a9[_0x119c('0x58')]=_0x33c921===_0x119c('0x59')||_0x33c921==='unmanaged'?_0x119c('0x59'):_0x119c('0x37');var _0x2cd78b=util[_0x119c('0x4f')](_0x119c('0x5a'),_0x2216c5[_0x119c('0x53')],_0x447919[_0x119c('0x5b')],md5(_0x447919[_0x119c('0x5b')]));if(_0x4332e7&&_0x4332e7[_0x119c('0x5c')]){logger[_0x119c('0x13')](_0x119c('0x5d'),_0x119c('0x5e'));_0x447919['recordingURL']=_0x2cd78b;}else if(_0x162d82&&_0x162d82[_0x119c('0x5f')]&&_0x162d82[_0x119c('0x5f')]!==_0x119c('0x60')){logger['info'](_0x119c('0x61'),_0x119c('0x5e'));_0x447919['recordingURL']=_0x2cd78b;}else{_0x447919[_0x119c('0x62')]='';}return getAdminUser(_0x33c921,_0x2ddb34,_0x4ae0a9,_0x20ef3b,_0x81e9ab,_0x1fe0df)[_0x119c('0xd')](getUser(_0x33c921,_0x2ddb34,_0x20ef3b,_0x81e9ab,_0x1fe0df))[_0x119c('0xd')](getEndUser(_0x33c921,_0x2ddb34,_0x20ef3b,_0x81e9ab,_0x1fe0df))[_0x119c('0xd')](getTicket(_0x33c921,_0x2ddb34,_0x20ef3b,_0x1012a8,_0x447919,_0x81e9ab))[_0x119c('0xd')](function(_0x145053){logger[_0x119c('0x13')](util['format'](_0x119c('0x63'),_0x145053[_0x119c('0x44')]));logger[_0x119c('0x13')](util[_0x119c('0x4f')](_0x119c('0x64'),_0x33c921));if(_0x33c921!==_0x119c('0x65')){logger[_0x119c('0x13')]('['+[_0x33c921[_0x119c('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2216c5[_0x119c('0x52')],_0x5f2565['name'],_0x145053['ticketId']);}})[_0x119c('0x11')](function(_0x504e9d){logger['error']('['+[_0x33c921[_0x119c('0x10')]()]+_0x119c('0x66'),util[_0x119c('0x67')](_0x504e9d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xabc3=['outbound','assign','getString',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','label','?sysparm_query=name%3D','incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','calleridnum','callDirection','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','lodash','request-promise','util','ioredis','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm'];(function(_0x4a7311,_0x5f16f8){var _0x2f36a3=function(_0x581eeb){while(--_0x581eeb){_0x4a7311['push'](_0x4a7311['shift']());}};_0x2f36a3(++_0x5f16f8);}(_0xabc3,0xe0));var _0x3abc=function(_0x1c5e6b,_0x1de58e){_0x1c5e6b=_0x1c5e6b-0x0;var _0x1da34f=_0xabc3[_0x1c5e6b];return _0x1da34f;};'use strict';var _=require(_0x3abc('0x0'));var Promise=require('bluebird');var rp=require(_0x3abc('0x1'));var util=require(_0x3abc('0x2'));var md5=require('md5');var Redis=require(_0x3abc('0x3'));var intUtil=require('./util');var config=require(_0x3abc('0x4'));var logger=require('../../../../config/logger')(_0x3abc('0x5'));config[_0x3abc('0x6')]=_[_0x3abc('0x7')](config['redis'],{'host':_0x3abc('0x8'),'port':0x18eb});var io=require(_0x3abc('0x9'))(new Redis(config[_0x3abc('0x6')]));function getAdminUser(_0x16a9a4,_0x20ac56,_0x37fee1,_0x2fb0f2,_0x390f76,_0x47ccf7){return new Promise(function(_0xf81f87,_0x4f33a4){var _0x2b02a7={'method':_0x3abc('0xa'),'uri':_0x2fb0f2+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x390f76+'&'+_0x47ccf7,'auth':_0x20ac56,'json':!![]};return rp(_0x2b02a7)[_0x3abc('0xb')](function(_0x2f402b){if(_0x2f402b[_0x3abc('0xc')]['length']>0x0){_0x37fee1[_0x3abc('0xd')]=_0x2f402b[_0x3abc('0xc')][0x0][_0x3abc('0xe')];}logger['info']('['+[_0x16a9a4[_0x3abc('0xf')]()]+_0x3abc('0x10'),_0x37fee1);_0xf81f87(_0x37fee1);})[_0x3abc('0x11')](function(_0x4cc30e){logger[_0x3abc('0x12')]('['+[_0x16a9a4[_0x3abc('0xf')]()]+']',_0x4cc30e[_0x3abc('0x13')]);_0x4f33a4(_0x4cc30e[_0x3abc('0x13')]);});});}function getUser(_0x30dc31,_0x197b42,_0x4fdf21,_0x419647,_0x5da8ea){return function(_0x34f715){logger[_0x3abc('0x14')]('['+[_0x30dc31[_0x3abc('0xf')]()]+_0x3abc('0x15'),_0x34f715);return new Promise(function(_0x3e5237,_0x242427){if(intUtil[_0x3abc('0x16')](_0x34f715['userEmail'])){var _0x1acd2f={'method':'GET','uri':_0x4fdf21+_0x3abc('0x17')+_0x34f715[_0x3abc('0x18')]+'&'+_0x419647+'&'+_0x5da8ea,'auth':_0x197b42,'json':!![]};logger[_0x3abc('0x14')]('['+[_0x30dc31[_0x3abc('0xf')]()]+_0x3abc('0x19'),_0x1acd2f);return rp(_0x1acd2f)['then'](function(_0x340dfd){logger['info']('['+[_0x30dc31[_0x3abc('0xf')]()]+_0x3abc('0x1a'),_0x340dfd);if(_0x340dfd['result'][_0x3abc('0x1b')]>0x0&&String(_0x340dfd[_0x3abc('0xc')][0x0][_0x3abc('0x1c')])===_0x3abc('0x1d')){_0x34f715[_0x3abc('0x1e')]=_0x340dfd[_0x3abc('0xc')][0x0][_0x3abc('0xe')];}else{_0x34f715['userId']=_0x34f715[_0x3abc('0xd')];_0x34f715['userEmail']=_0x34f715[_0x3abc('0x1f')];}logger['info']('['+[_0x30dc31['toUpperCase']()]+'],\x20getUser\x20crm',_0x34f715);_0x3e5237(_0x34f715);})[_0x3abc('0x11')](function(_0x233d13){logger[_0x3abc('0x12')]('['+[_0x30dc31['toUpperCase']()]+']',_0x233d13[_0x3abc('0x13')]);_0x242427(_0x233d13['message']);});}else{logger['info']('['+[_0x30dc31[_0x3abc('0xf')]()]+_0x3abc('0x20'));_0x34f715[_0x3abc('0x1e')]=_0x34f715['adminId'];_0x34f715[_0x3abc('0x18')]=_0x34f715[_0x3abc('0x1f')];_0x3e5237(_0x34f715);}});};}function createEndUser(_0x32a19d,_0x18480c,_0x370eef,_0x2e6e7e,_0x3fc063){logger[_0x3abc('0x14')]('['+[_0x32a19d['toUpperCase']()]+_0x3abc('0x21'),_0x370eef);return new Promise(function(_0x4c5cfa,_0x1474f5){var _0x5c6a62={'method':_0x3abc('0x22'),'uri':_0x2e6e7e+_0x3abc('0x23')+_0x3fc063,'body':{'user_name':_0x370eef[_0x3abc('0x24')],'roles':'user','first_name':_0x370eef[_0x3abc('0x24')],'active':_0x3abc('0x1d'),'date_format':'System','phone':_0x370eef['endUserNumber']},'auth':_0x18480c,'json':!![]};return rp(_0x5c6a62)[_0x3abc('0xb')](function(_0x4d9da9){logger[_0x3abc('0x14')]('['+[_0x32a19d[_0x3abc('0xf')]()]+'],\x20EndUser\x20schema',_0x4d9da9['result']);_0x370eef['endUserId']=_0x4d9da9[_0x3abc('0xc')]['sys_id'];_0x4c5cfa(_0x370eef);})[_0x3abc('0x11')](function(_0x3a597f){logger[_0x3abc('0x12')]('['+[_0x32a19d[_0x3abc('0xf')]()]+']',_0x3a597f[_0x3abc('0x13')]);_0x1474f5(_0x3a597f[_0x3abc('0x13')]);});});}function getEndUser(_0x1cbb3c,_0x2521ae,_0x7957a,_0x2e880b,_0x1c055e){return function(_0x1047e8){logger[_0x3abc('0x14')]('['+[_0x1cbb3c['toUpperCase']()]+_0x3abc('0x25'),_0x1047e8);return new Promise(function(_0x2dc722,_0x317174){var _0x5eb021={'method':'GET','uri':_0x7957a+_0x3abc('0x26')+_0x1047e8[_0x3abc('0x24')]+'&'+_0x2e880b+'&'+_0x1c055e,'auth':_0x2521ae,'json':!![]};return rp(_0x5eb021)[_0x3abc('0xb')](function(_0x87673b){if(_0x87673b[_0x3abc('0xc')][_0x3abc('0x1b')]>0x0){_0x1047e8[_0x3abc('0x27')]=_0x87673b[_0x3abc('0xc')][0x0]['sys_id'];logger[_0x3abc('0x14')]('['+[_0x1cbb3c[_0x3abc('0xf')]()]+'],\x20getEndUser\x20crm',_0x1047e8);_0x2dc722(_0x1047e8);}else{return createEndUser(_0x1cbb3c,_0x2521ae,_0x1047e8,_0x7957a,_0x2e880b)['then'](function(_0x500a14){logger[_0x3abc('0x14')]('['+[_0x1cbb3c[_0x3abc('0xf')]()]+_0x3abc('0x28'),_0x500a14);_0x2dc722(_0x500a14);});}})['catch'](function(_0x44cf7b){logger[_0x3abc('0x12')]('['+[_0x1cbb3c['toUpperCase']()]+']',_0x44cf7b[_0x3abc('0x13')]);_0x317174(_0x44cf7b[_0x3abc('0x13')]);});});};}function getCustomFields(_0x19099d,_0x5e2682){var _0x4e7f33={};if(_0x19099d['length']>0x0){_[_0x3abc('0x29')](_0x19099d,function(_0x338680){if(_[_0x3abc('0x2a')]([_0x3abc('0x2b'),_0x3abc('0x2c')],_0x338680[_0x3abc('0x2d')])&&_0x338680[_0x3abc('0x2e')]&&!_0x338680[_0x3abc('0x2f')]){_0x4e7f33[_0x338680[_0x3abc('0x2e')][_0x3abc('0x30')]()]=_0x338680['content'][_0x3abc('0x31')]();}else if(_[_0x3abc('0x2a')]([_0x3abc('0x2b'),'picklist'],_0x338680[_0x3abc('0x2d')])&&_0x338680[_0x3abc('0x32')]&&_0x338680['customField']){_0x4e7f33[_0x338680[_0x3abc('0x32')][_0x3abc('0x30')]()]=_0x338680['content'][_0x3abc('0x31')]();}else if(_0x338680[_0x3abc('0x2d')]==='variable'&&_0x338680['variableName']&&_0x338680[_0x3abc('0x32')]&&_0x338680[_0x3abc('0x2f')]){_0x4e7f33[_0x338680['idField'][_0x3abc('0x30')]()]=_0x5e2682[_0x338680[_0x3abc('0x33')]][_0x3abc('0x31')]();}else if(_0x338680[_0x3abc('0x2d')]==='customVariable'&&_0x338680[_0x3abc('0x34')]&&_0x338680[_0x3abc('0x34')][_0x3abc('0x35')]&&_0x338680['idField']&&_0x338680['customField']){_0x4e7f33[_0x338680[_0x3abc('0x32')][_0x3abc('0x30')]()]=_0x5e2682[_0x338680[_0x3abc('0x34')][_0x3abc('0x35')][_0x3abc('0x30')]()][_0x3abc('0x31')]();}});}return _0x4e7f33;}function getTicket(_0x2f546e,_0x25db7d,_0x7abd7d,_0x43174b,_0x55b010,_0x21725e){return function(_0x4782c4){logger[_0x3abc('0x14')]('['+[_0x2f546e['toUpperCase']()]+_0x3abc('0x36'),_0x4782c4);return new Promise(function(_0x28f62b,_0x490230){var _0x2c9f48=_0x2f546e[_0x3abc('0x30')]()===_0x3abc('0x37')?_0x4782c4[_0x3abc('0x1e')]:_0x4782c4[_0x3abc('0x27')];var _0xb18a76={'method':_0x3abc('0x22'),'uri':_0x7abd7d+'incident'+'?'+_0x21725e,'body':Object[_0x3abc('0x38')]({},{'active':_0x3abc('0x1d'),'caller_id':_0x2c9f48,'assigned_to':_0x4782c4[_0x3abc('0x1e')],'short_description':intUtil[_0x3abc('0x39')](_0x43174b['Subjects'],_0x55b010,'\x20'),'description':intUtil[_0x3abc('0x39')](_0x43174b['Descriptions'],_0x55b010,'\x0a')},getCustomFields(_0x43174b['Fields'],_0x55b010)),'auth':_0x25db7d,'json':!![]};return rp(_0xb18a76)[_0x3abc('0xb')](function(_0x17c669){logger[_0x3abc('0x14')]('['+[_0x2f546e[_0x3abc('0xf')]()]+_0x3abc('0x3a'),_0x17c669[_0x3abc('0xc')]);_0x4782c4[_0x3abc('0x3b')]=_0x17c669[_0x3abc('0xc')][_0x3abc('0xe')];_0x4782c4[_0x3abc('0x3c')]=_0x17c669[_0x3abc('0xc')]['number'];logger[_0x3abc('0x14')]('['+[_0x2f546e['toUpperCase']()]+']\x20getTicket\x20crm',_0x4782c4);_0x28f62b(_0x4782c4);})[_0x3abc('0x11')](function(_0x7c8588){logger[_0x3abc('0x12')]('['+[_0x2f546e[_0x3abc('0xf')]()]+']',_0x7c8588[_0x3abc('0x13')]);_0x490230(_0x7c8588[_0x3abc('0x13')]);});});};}function createRemoteTag(_0x12953f,_0x298b79,_0x243282,_0x270dc9){return new Promise(function(_0x568ebf,_0x1f2b07){var _0x212b46={'method':_0x3abc('0x22'),'uri':_0x243282+_0x3abc('0x3d')+'?'+_0x270dc9,'body':{'short_description':_0x12953f,'global':!![],'active':!![],'name':_0x12953f},'auth':_0x298b79,'json':!![]};return rp(_0x212b46)['then'](function(_0x10be13){var _0x5bf6a2=_0x10be13['result'][_0x3abc('0xe')];_0x568ebf(_0x5bf6a2);});});}function getRemoteTag(_0x52a925,_0x27127f,_0x42acd3,_0x29fbe,_0x378ea9){return new Promise(function(_0x292902,_0x1268b9){var _0x34e1df={'method':'GET','uri':_0x42acd3+_0x3abc('0x3d')+_0x3abc('0x3e')+_0x52a925+'&'+_0x29fbe,'auth':_0x27127f,'json':!![]};return rp(_0x34e1df)['then'](function(_0x5cb5e0){if(_0x5cb5e0[_0x3abc('0xc')][_0x3abc('0x1b')]>0x0){var _0x44b629=_0x5cb5e0[_0x3abc('0xc')][0x0][_0x3abc('0xe')];_0x292902(_0x44b629);}else{return createRemoteTag(_0x52a925,_0x27127f,_0x42acd3,_0x29fbe)['then'](function(_0x28efb6){_0x292902(_0x28efb6);});}});});}function assignTagToIncident(_0x3d6b40,_0x4c5d55,_0x2c6d58,_0x5b2589,_0x19d457){return new Promise(function(_0x35e9f4,_0x2d69fe){var _0x33cf18={'method':_0x3abc('0x22'),'uri':_0x2c6d58+'label_entry'+'?'+_0x19d457,'body':{'label':_0x3d6b40,'table':_0x3abc('0x3f'),'id_type':'Incident','table_key':_0x5b2589[_0x3abc('0x3b')],'title':_0x3abc('0x40')+_0x5b2589[_0x3abc('0x3c')],'id_display':_0x5b2589['ticketNumber']},'auth':_0x4c5d55,'json':!![]};return rp(_0x33cf18)[_0x3abc('0xb')](function(_0x1fc0be){_0x35e9f4();})[_0x3abc('0x11')](function(){_0x35e9f4();});});}function manageTags(_0x18a6bf,_0x2891ef,_0xb7c574,_0x52a207,_0x143532,_0x359f97,_0x54c306){return new Promise(function(_0x3b7691,_0x322ffe){var _0xfa3b14=[];_0x2891ef[_0x3abc('0x29')](function(_0x42c4e8){_0xfa3b14[_0x3abc('0x41')](getRemoteTag(_0x42c4e8,_0xb7c574,_0x52a207,_0x359f97,_0x54c306));});return Promise['all'](_0xfa3b14)[_0x3abc('0xb')](function(_0x9d1e53){if(_0x9d1e53[_0x3abc('0x1b')]){logger[_0x3abc('0x14')]('['+[_0x18a6bf[_0x3abc('0xf')]()]+_0x3abc('0x42'),_0x9d1e53);var _0x38a882=[];_0x9d1e53[_0x3abc('0x29')](function(_0x15f16a){_0x38a882['push'](assignTagToIncident(_0x15f16a,_0xb7c574,_0x52a207,_0x143532,_0x359f97));});return Promise['all'](_0x38a882)[_0x3abc('0xb')](function(){_0x3b7691();})[_0x3abc('0x11')](function(){_0x3b7691();});}else{_0x3b7691();}});});}function getTags(_0xe72640,_0x41c18e,_0x19374e,_0x598f9a,_0x43169b,_0x3c1f76){return function(_0x3fdd6f){return new Promise(function(_0x46c739,_0x1f5e61){var _0x2c35e5=[];var _0x5a06f7=_0x598f9a['Tags'];if(_0x5a06f7&&_0x5a06f7['length']>0x0){_0x2c35e5=_[_0x3abc('0x43')](_0x5a06f7,'name');}if(_0x2c35e5[_0x3abc('0x1b')]>0x0){return manageTags(_0xe72640,_0x2c35e5,_0x41c18e,_0x19374e,_0x3fdd6f,_0x43169b,_0x3c1f76)['then'](function(){_0x46c739(_0x3fdd6f);});}else{_0x46c739(_0x3fdd6f);}});};}function emit(_0x38d5f7,_0x214c49,_0xb3f46){var _0x459a5b=_0x3abc('0x44')+_0x3abc('0x45')+_0x3abc('0x46')+_0x3abc('0x47');var _0x1dd5c0={'uri':_0x38d5f7+_0x3abc('0x48')+_0xb3f46+_0x459a5b};io['to'](util[_0x3abc('0x49')]('user:%s',_0x214c49))[_0x3abc('0x4a')](_0x3abc('0x4b'),_0x1dd5c0);}exports['cs']=function(_0x2a3c19,_0x4989cf,_0xb78938,_0x4c4c3b,_0x18779d,_0x32a642,_0x157645,_0x3456d4){var _0x388f72={};var _0x247567={'user':_0x32a642[_0x3abc('0x4c')],'pass':_0x32a642[_0x3abc('0x4d')]};var _0x2d9a26='sysparm_limit=1';var _0x22430a='sysparm_display_value=true';_0x32a642[_0x3abc('0x4e')]=intUtil[_0x3abc('0x4f')](_0x32a642[_0x3abc('0x4e')]);_0x32a642[_0x3abc('0x50')]=intUtil[_0x3abc('0x4f')](_0x32a642[_0x3abc('0x50')]);var _0x42dc3a=util[_0x3abc('0x49')](_0x3abc('0x51'),_0x32a642[_0x3abc('0x4e')]);_0x388f72[_0x3abc('0x18')]=!_[_0x3abc('0x52')](_0x4c4c3b)?_0x4c4c3b['email']:null;_0x388f72[_0x3abc('0x1f')]=_0x32a642['email'];_0x388f72[_0x3abc('0x24')]=_0x3456d4['toLowerCase']()==='outbound'?_0x4989cf['destcalleridnum']:_0x4989cf[_0x3abc('0x53')];_0x388f72[_0x3abc('0x54')]=_0x3456d4==='queue'||_0x3456d4===_0x3abc('0x55')?'queue':_0x3abc('0x37');var _0x5dac33=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32a642['serverUrl'],_0x4989cf[_0x3abc('0x56')],md5(_0x4989cf[_0x3abc('0x56')]));if(_0x18779d&&_0x18779d[_0x3abc('0x57')]){logger[_0x3abc('0x14')](_0x3abc('0x58'),_0x3abc('0x59'));_0x4989cf[_0x3abc('0x5a')]=_0x5dac33;}else if(_0x157645&&_0x157645[_0x3abc('0x5b')]&&_0x157645['recordingFormat']!=='none'){logger[_0x3abc('0x14')]('[OUTBOUND]',_0x3abc('0x59'));_0x4989cf[_0x3abc('0x5a')]=_0x5dac33;}else{_0x4989cf[_0x3abc('0x5a')]='';}return getAdminUser(_0x3456d4,_0x247567,_0x388f72,_0x42dc3a,_0x22430a,_0x2d9a26)[_0x3abc('0xb')](getUser(_0x3456d4,_0x247567,_0x42dc3a,_0x22430a,_0x2d9a26))['then'](getEndUser(_0x3456d4,_0x247567,_0x42dc3a,_0x22430a,_0x2d9a26))['then'](getTicket(_0x3456d4,_0x247567,_0x42dc3a,_0xb78938,_0x4989cf,_0x22430a))[_0x3abc('0xb')](function(_0x3f0361){logger[_0x3abc('0x14')](util[_0x3abc('0x49')](_0x3abc('0x5c'),_0x3f0361['ticketId']));logger['info'](util[_0x3abc('0x49')]('call\x20direction:\x20%s',_0x3456d4));if(_0x3456d4!==_0x3abc('0x55')){logger[_0x3abc('0x14')]('['+[_0x3456d4[_0x3abc('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x32a642[_0x3abc('0x4e')],_0x4c4c3b[_0x3abc('0x35')],_0x3f0361[_0x3abc('0x3b')]);}})['catch'](function(_0x1d557e){logger[_0x3abc('0x12')]('['+[_0x3456d4[_0x3abc('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x1d557e,{'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 2328456..fdb22f0 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 _0xf700=['format','debug','merge','type','customField','nameField','toLowerCase','content','toString','string','custom_fields','variable','variableName','customVariable','Variable','login','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','remoteUri','serverUrl','uri','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','monitor_format','lastevent','toUpperCase','Fields','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','name','getString','assigned_user_id','created_by','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','push','idField','JSON','stringify','Calls','Basic\x20%s','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name',''];(function(_0x365a46,_0xe9cee6){var _0x26effe=function(_0x34e2f4){while(--_0x34e2f4){_0x365a46['push'](_0x365a46['shift']());}};_0x26effe(++_0xe9cee6);}(_0xf700,0xad));var _0x0f70=function(_0xc8a79c,_0x429b64){_0xc8a79c=_0xc8a79c-0x0;var _0x4c5126=_0xf700[_0xc8a79c];return _0x4c5126;};'use strict';var _=require(_0x0f70('0x0'));var rp=require(_0x0f70('0x1'));var BPromise=require('bluebird');var md5=require(_0x0f70('0x2'));var util=require('util');var Redis=require(_0x0f70('0x3'));var intUtil=require(_0x0f70('0x4'));var config=require(_0x0f70('0x5'));var logger=require(_0x0f70('0x6'))(_0x0f70('0x7'));config[_0x0f70('0x8')]=_[_0x0f70('0x9')](config[_0x0f70('0x8')],{'host':_0x0f70('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0f70('0x8')]));var def={'method':_0x0f70('0xb'),'json':!![]};function emit(_0x42418b,_0x25fa56,_0xa4eaa8){io['to'](_0x42418b)[_0x0f70('0xc')](_0x25fa56,_0xa4eaa8);}function getTicket(_0x49f2c6,_0x27996c,_0x5512d5,_0x1ec850,_0x41b23e,_0x1a2129,_0x58ec20,_0x1314c1){logger[_0x0f70('0xd')]('Creating\x20new\x20ticket...');var _0xee4511=new Date();var _0x257bf0=[{'name':_0x0f70('0xe'),'value':intUtil[_0x0f70('0xf')](_0x1ec850['Subjects'],_0x41b23e,'\x20')},{'name':_0x0f70('0x10'),'value':_0x27996c['id']},{'name':_0x0f70('0x11'),'value':_0x27996c['id']},{'name':'description','value':intUtil[_0x0f70('0xf')](_0x1ec850[_0x0f70('0x12')],_0x41b23e,'\x0a')},{'name':_0x0f70('0x13'),'value':_0xee4511['toISOString']()[_0x0f70('0x14')](0x0,0x13)[_0x0f70('0x15')]('T','\x20')},{'name':_0x0f70('0x16'),'value':'0'},{'name':_0x0f70('0x17'),'value':'15'},{'name':_0x0f70('0x18'),'value':_0x5512d5['id']},{'name':_0x0f70('0x19'),'value':'Contacts'},{'name':_0x0f70('0x1a'),'value':_0x5512d5[_0x0f70('0xe')]},{'name':_0x0f70('0x1b'),'value':_0x1314c1}];if(_0x1a2129[_0x0f70('0x1c')]){_[_0x0f70('0x1d')](_0x1a2129,function(_0x13f49c){if(_0x41b23e[_0x13f49c['variableName']]){_0x257bf0[_0x0f70('0x1e')]({'name':_0x13f49c[_0x0f70('0x1f')],'value':_0x41b23e[_0x13f49c['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x0f70('0x20'),'response_type':_0x0f70('0x20'),'rest_data':JSON[_0x0f70('0x21')]({'session':_0x58ec20['id'],'module_name':_0x0f70('0x22'),'name_value_list':_0x257bf0})}});}function getAuth(_0x28aefe){return util['format'](_0x0f70('0x23'),new Buffer(_0x28aefe['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0xf66581){return request({'form':{'method':_0x0f70('0x24'),'input_type':_0x0f70('0x20'),'response_type':_0x0f70('0x20'),'rest_data':JSON[_0x0f70('0x21')]({'session':_0xf66581['id']})}});}function getUser(_0x882ec6,_0x506934,_0xe3bdb1){if(!_[_0x0f70('0x25')](_0x506934)){logger[_0x0f70('0xd')](_0x0f70('0x26'),_0x506934);return request({'form':{'method':_0x0f70('0x27'),'input_type':'JSON','response_type':_0x0f70('0x20'),'rest_data':JSON[_0x0f70('0x21')]({'session':_0xe3bdb1['id'],'module_name':_0x0f70('0x28'),'query':util['format'](_0x0f70('0x29'),_0x506934),'order_by':'','offset':'0','select_fields':['id',_0x0f70('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0f70('0x2a')](function(_0x3f3203){if(_0x3f3203[_0x0f70('0x2b')][_0x0f70('0x1c')]){var _0x1dbe75=_[_0x0f70('0x2c')](_0x3f3203[_0x0f70('0x2b')],function(_0x52bd06){return _0x52bd06[_0x0f70('0x2d')][_0x0f70('0x2e')][_0x0f70('0x2f')]===_0x506934;});if(_0x1dbe75){logger[_0x0f70('0xd')](_0x0f70('0x30'));return BPromise[_0x0f70('0x31')]({'id':_0x1dbe75[_0x0f70('0x2d')]['id']['value'],'name':_0x1dbe75[_0x0f70('0x2d')]['name'][_0x0f70('0x2f')]});}}logger[_0x0f70('0xd')](_0x0f70('0x32'));return BPromise[_0x0f70('0x31')]({'id':_0xe3bdb1[_0x0f70('0x2d')][_0x0f70('0x33')]['value'],'name':_0xe3bdb1[_0x0f70('0x2d')][_0x0f70('0x2e')][_0x0f70('0x2f')]});});}else{logger[_0x0f70('0xd')](_0x0f70('0x34'));return BPromise['resolve']({'id':_0xe3bdb1[_0x0f70('0x2d')][_0x0f70('0x33')][_0x0f70('0x2f')],'name':_0xe3bdb1[_0x0f70('0x2d')][_0x0f70('0x2e')][_0x0f70('0x2f')]});}}function getEndUser(_0x2363ce,_0x54f026,_0x24d6bd,_0x254e97){logger['info']('Searching\x20enduser\x20with\x20phone',_0x24d6bd);return request({'form':{'method':_0x0f70('0x27'),'input_type':_0x0f70('0x20'),'response_type':'JSON','rest_data':JSON[_0x0f70('0x21')]({'session':_0x254e97['id'],'module_name':_0x0f70('0x35'),'query':util['format'](_0x0f70('0x36'),_0x24d6bd),'order_by':'','offset':'0','select_fields':['id','name',_0x0f70('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x264ad3){if(_0x264ad3['entry_list'][_0x0f70('0x1c')]){var _0x5692e8=_[_0x0f70('0x2c')](_0x264ad3[_0x0f70('0x2b')],function(_0x52b25e){return _0x52b25e[_0x0f70('0x2d')]['phone_home'][_0x0f70('0x2f')]===_0x24d6bd;});if(_0x5692e8){logger[_0x0f70('0xd')](_0x0f70('0x38'));return BPromise[_0x0f70('0x31')]({'id':_0x5692e8['name_value_list']['id'][_0x0f70('0x2f')],'name':_0x5692e8[_0x0f70('0x2d')][_0x0f70('0xe')][_0x0f70('0x2f')],'phone':_0x5692e8['name_value_list'][_0x0f70('0x37')][_0x0f70('0x2f')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x0f70('0x20'),'response_type':_0x0f70('0x20'),'rest_data':JSON[_0x0f70('0x21')]({'session':_0x254e97['id'],'module_name':_0x0f70('0x35'),'name_value_list':[{'name':_0x0f70('0x39'),'value':_0x54f026!==_0x0f70('0x3a')?_0x54f026:util[_0x0f70('0x3b')]('Caller\x20-\x20%s',_0x24d6bd)},{'name':'phone_home','value':_0x24d6bd}]})}})['then'](function(_0x45c5be){logger['info']('Enduser\x20created.');return BPromise['resolve']({'id':_0x45c5be['id'],'name':_0x45c5be['entry_list'][_0x0f70('0x39')][_0x0f70('0x2f')],'phone':_0x45c5be[_0x0f70('0x2b')][_0x0f70('0x37')][_0x0f70('0x2f')]});});}});}function request(_0x393a7e){logger[_0x0f70('0x3c')]('[HTTP]',JSON[_0x0f70('0x21')](_0x393a7e));return rp(_[_0x0f70('0x3d')](def,_0x393a7e));}function getTags(_0xe04adc,_0x328099){var _0x106d36=[];if(_0xe04adc&&_0xe04adc[_0x0f70('0x1c')]>0x0){_0x106d36=_['map'](_0xe04adc,_0x328099);}return _0x106d36;}function getCustomFields(_0x24009e,_0x7400c1){var _0x31a990=[];var _0xcc54b9={'custom_fields':[]};if(_0x24009e['length']>0x0){_[_0x0f70('0x1d')](_0x24009e,function(_0x278275){if(_0x278275[_0x0f70('0x3e')]==='string'&&_0x278275['nameField']&&!_0x278275[_0x0f70('0x3f')]){_0xcc54b9[_0x278275[_0x0f70('0x40')][_0x0f70('0x41')]()]=_0x278275[_0x0f70('0x42')][_0x0f70('0x43')]();}else if(_0x278275[_0x0f70('0x3e')]===_0x0f70('0x44')&&_0x278275[_0x0f70('0x1f')]&&_0x278275['customField']){_0xcc54b9[_0x0f70('0x45')][_0x0f70('0x1e')]({'id':_0x278275[_0x0f70('0x1f')],'value':_0x278275[_0x0f70('0x42')][_0x0f70('0x43')]()});}else if(_0x278275[_0x0f70('0x3e')]===_0x0f70('0x46')&&_0x278275[_0x0f70('0x47')]&&_0x278275[_0x0f70('0x1f')]&&_0x278275[_0x0f70('0x3f')]){_0x7400c1[_0x278275[_0x0f70('0x47')]]&&_0xcc54b9[_0x0f70('0x45')][_0x0f70('0x1e')]({'id':_0x278275['idField'],'value':_0x7400c1[_0x278275[_0x0f70('0x47')]][_0x0f70('0x43')]()});}else if(_0x278275['type']===_0x0f70('0x48')&&_0x278275[_0x0f70('0x49')]&&_0x278275[_0x0f70('0x49')][_0x0f70('0xe')]&&_0x278275['idField']&&_0x278275[_0x0f70('0x3f')]){_0x7400c1[_0x278275[_0x0f70('0x49')][_0x0f70('0xe')][_0x0f70('0x41')]()]&&_0xcc54b9[_0x0f70('0x45')]['push']({'id':_0x278275['idField'],'value':_0x7400c1[_0x278275[_0x0f70('0x49')]['name'][_0x0f70('0x41')]()]['toString']()});}});}return _0xcc54b9;}function getConnection(_0x27f5e2){return request({'method':_0x0f70('0xb'),'form':{'method':_0x0f70('0x4a'),'input_type':_0x0f70('0x20'),'response_type':'JSON','rest_data':JSON[_0x0f70('0x21')]({'user_auth':{'user_name':_0x27f5e2['username'],'password':_0x27f5e2['password'],'encryption':_0x0f70('0x4b')},'application':_0x0f70('0x4c')})}})['then'](function(_0x4e9261){var _0x49c1df=_0x4e9261;if(_0x49c1df['id']){def['sessionID']=_0x49c1df['id'];return BPromise[_0x0f70('0x31')](_0x49c1df);}else{throw new Error(util[_0x0f70('0x3b')]('Account\x20%d\x20is\x20not\x20valid',_0x27f5e2['id']));}});}function setRelationship(_0x364eb6,_0x4b79fc,_0x26baac,_0x26f59c){return request({'form':{'method':_0x0f70('0x4d'),'input_type':'JSON','response_type':_0x0f70('0x20'),'rest_data':JSON[_0x0f70('0x21')]({'session':_0x364eb6['id'],'module_name':_0x0f70('0x22'),'module_id':_0x26baac['id'],'link_field_name':_0x26f59c,'related_ids':[_0x4b79fc['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x44518a,_0x32e276,_0x42168b,_0x390e98,_0x3904ef,_0x503163){var _0x518835,_0x149c45,_0x4848ee,_0xe59a43;_0x503163[_0x0f70('0x4e')]=intUtil['stripTrailingSlash'](_0x503163[_0x0f70('0x4e')]);_0x503163[_0x0f70('0x4f')]=intUtil['stripTrailingSlash'](_0x503163['serverUrl']);def[_0x0f70('0x50')]=util[_0x0f70('0x3b')]('%s/service/v4_1/rest.php',_0x503163[_0x0f70('0x4e')]);if(_0x3904ef&&_0x3904ef['monitor_format']){logger[_0x0f70('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x32e276['recordingURL']=util[_0x0f70('0x3b')](_0x0f70('0x51'),_0x503163[_0x0f70('0x4f')],_0x32e276[_0x0f70('0x52')],md5(_0x32e276[_0x0f70('0x52')]));}else{_0x32e276[_0x0f70('0x53')]='';}return getConnection(_0x503163)[_0x0f70('0x2a')](function(_0x17202d){_0xe59a43=_0x17202d;return getUser(_0x503163,_0x390e98[_0x0f70('0xe')],_0xe59a43);})[_0x0f70('0x2a')](function(_0x2a8a02){_0x518835=_0x2a8a02;logger[_0x0f70('0xd')]('The\x20User\x20ID\x20is:',_0x518835['id']);return getEndUser(_0x503163,_0x32e276[_0x0f70('0x54')],_0x32e276[_0x0f70('0x55')],_0xe59a43);})['then'](function(_0x397cd3){_0x149c45=_0x397cd3;logger[_0x0f70('0xd')](_0x0f70('0x56'),_0x149c45['id']);return getTicket(_0x503163,_0x518835,_0x149c45,_0x42168b,_0x32e276,_0x42168b['Fields'],_0xe59a43,_0x0f70('0x57'));})[_0x0f70('0x2a')](function(_0xa3e32a){_0x4848ee=_0xa3e32a;logger[_0x0f70('0xd')](_0x0f70('0x58'));logger[_0x0f70('0xd')](_0x0f70('0x59'),_0x4848ee['id']);return setRelationship(_0xe59a43,_0x518835,_0x4848ee,_0x0f70('0x5a'));})[_0x0f70('0x2a')](function(){return setRelationship(_0xe59a43,_0x149c45,_0x4848ee,_0x0f70('0x5b'));})['then'](function(){return getServerInfo(_0xe59a43);})[_0x0f70('0x2a')](function(_0x14b764){var _0x58a279=parseInt(_0x14b764[_0x0f70('0x5c')]['charAt'](0x0));var _0x3231c8=util[_0x0f70('0x3b')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x503163['remoteUri'],_0x4848ee['id']);if(_0x58a279>0x6){_0x3231c8=util['format'](_0x0f70('0x5d'),_0x503163['remoteUri'],_0x4848ee['id']);}logger[_0x0f70('0xd')](_0x0f70('0x5e'),_0x0f70('0x5f'));emit(util['format'](_0x0f70('0x60'),_0x390e98['name']),_0x0f70('0x61'),{'uri':_0x3231c8});})[_0x0f70('0x62')](function(_0x15da08){logger[_0x0f70('0x63')](_0x0f70('0x5e'),JSON[_0x0f70('0x21')](_0x15da08));});};exports[_0x0f70('0x64')]=function(_0x188f2b,_0x5bbde4,_0x4a2775,_0x5d84f7,_0x389134,_0x4b36b8,_0x5e7c90){var _0x21b52d,_0xc2ffcd,_0x90e8fe,_0x5d1935;_0x4b36b8['remoteUri']=intUtil[_0x0f70('0x65')](_0x4b36b8[_0x0f70('0x4e')]);_0x4b36b8[_0x0f70('0x4f')]=intUtil[_0x0f70('0x65')](_0x4b36b8['serverUrl']);def[_0x0f70('0x50')]=util[_0x0f70('0x3b')](_0x0f70('0x66'),_0x4b36b8[_0x0f70('0x4e')]);if(_0x5e7c90&&_0x5e7c90[_0x0f70('0x67')]&&_0x5e7c90[_0x0f70('0x67')]!==_0x0f70('0x68')){logger[_0x0f70('0xd')](_0x0f70('0x69'),_0x0f70('0x6a'));_0x5bbde4[_0x0f70('0x53')]=util[_0x0f70('0x3b')](_0x0f70('0x51'),_0x4b36b8[_0x0f70('0x4f')],_0x5bbde4[_0x0f70('0x52')],md5(_0x5bbde4[_0x0f70('0x52')]));}return getConnection(_0x4b36b8)['then'](function(_0x24bce5){_0x5d1935=_0x24bce5;return getUser(_0x4b36b8,_0x5d84f7['name'],_0x5d1935);})['then'](function(_0x29dd59){_0x21b52d=_0x29dd59;logger[_0x0f70('0xd')](_0x0f70('0x6b'),_0x21b52d['id']);return getEndUser(_0x4b36b8,_0x5bbde4['destcalleridname'],_0x5bbde4[_0x0f70('0x6c')],_0x5d1935);})[_0x0f70('0x2a')](function(_0x2cd278){_0xc2ffcd=_0x2cd278;logger[_0x0f70('0xd')](_0x0f70('0x56'),_0xc2ffcd['id']);return getTicket(_0x4b36b8,_0x21b52d,_0xc2ffcd,_0x4a2775,_0x5bbde4,_0x4a2775['Fields'],_0x5d1935,_0x0f70('0x6d'));})[_0x0f70('0x2a')](function(_0x572cd8){_0x90e8fe=_0x572cd8;logger[_0x0f70('0xd')](_0x0f70('0x58'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x90e8fe['id']);return setRelationship(_0x5d1935,_0x21b52d,_0x90e8fe,'users');})[_0x0f70('0x2a')](function(){return setRelationship(_0x5d1935,_0xc2ffcd,_0x90e8fe,_0x0f70('0x5b'));})['then'](function(){return getServerInfo(_0x5d1935);})['then'](function(_0xffbc8d){var _0x4a32ff=parseInt(_0xffbc8d[_0x0f70('0x5c')]['charAt'](0x0));var _0xe63981=util[_0x0f70('0x3b')](_0x0f70('0x6e'),_0x4b36b8[_0x0f70('0x4e')],_0x90e8fe['id']);if(_0x4a32ff>0x6){_0xe63981=util[_0x0f70('0x3b')](_0x0f70('0x5d'),_0x4b36b8[_0x0f70('0x4e')],_0x90e8fe['id']);}logger[_0x0f70('0xd')](_0x0f70('0x69'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x0f70('0x60'),_0x5d84f7['name']),_0x0f70('0x61'),{'uri':_0xe63981});})[_0x0f70('0x62')](function(_0x13439e){logger[_0x0f70('0x63')](_0x0f70('0x69'),JSON[_0x0f70('0x21')](_0x13439e));});};exports[_0x0f70('0x6f')]=function(_0x3dbfea,_0x5748b5,_0x1e67d9,_0x4df553,_0x228052,_0x5b7378){var _0x18e946,_0x477b77,_0x4d0820,_0x20cade;_0x5b7378[_0x0f70('0x4e')]=intUtil[_0x0f70('0x65')](_0x5b7378[_0x0f70('0x4e')]);_0x5b7378[_0x0f70('0x4f')]=intUtil[_0x0f70('0x65')](_0x5b7378[_0x0f70('0x4f')]);def[_0x0f70('0x50')]=util['format'](_0x0f70('0x66'),_0x5b7378[_0x0f70('0x4e')]);if(_0x228052&&_0x228052[_0x0f70('0x70')]){logger['info']('['+_0x5748b5[_0x0f70('0x71')][_0x0f70('0x72')]()+']',_0x0f70('0x6a'));_0x5748b5['recordingURL']=util['format'](_0x0f70('0x51'),_0x5b7378['serverUrl'],_0x5748b5['uniqueid'],md5(_0x5748b5[_0x0f70('0x52')]));}else{_0x5748b5[_0x0f70('0x53')]='';}return getConnection(_0x5b7378)[_0x0f70('0x2a')](function(_0x2926e5){_0x20cade=_0x2926e5;if(!_[_0x0f70('0x25')](_0x4df553)){return getUser(_0x5b7378,_0x4df553[_0x0f70('0xe')],_0x20cade);}else{return getUser(_0x5b7378,null,_0x20cade);}})[_0x0f70('0x2a')](function(_0x522935){_0x18e946=_0x522935;logger[_0x0f70('0xd')]('The\x20User\x20ID\x20is:',_0x18e946['id']);return getEndUser(_0x5b7378,_0x5748b5[_0x0f70('0x54')],_0x5748b5[_0x0f70('0x55')],_0x20cade);})[_0x0f70('0x2a')](function(_0x353d0a){_0x477b77=_0x353d0a;logger[_0x0f70('0xd')](_0x0f70('0x56'),_0x477b77['id']);return getTicket(_0x5b7378,_0x18e946,_0x477b77,_0x1e67d9,_0x5748b5,_0x1e67d9[_0x0f70('0x73')],_0x20cade,_0x0f70('0x57'));})[_0x0f70('0x2a')](function(_0x3e89e5){_0x4d0820=_0x3e89e5;logger[_0x0f70('0xd')](_0x0f70('0x58'));logger[_0x0f70('0xd')](_0x0f70('0x59'),_0x4d0820['id']);return setRelationship(_0x20cade,_0x18e946,_0x4d0820,_0x0f70('0x5a'));})[_0x0f70('0x2a')](function(){return setRelationship(_0x20cade,_0x477b77,_0x4d0820,'contacts');})[_0x0f70('0x2a')](function(){return getServerInfo(_0x20cade);})[_0x0f70('0x62')](function(_0x1408b7){logger[_0x0f70('0x63')]('['+_0x5748b5[_0x0f70('0x71')][_0x0f70('0x72')]()+']',JSON[_0x0f70('0x21')](_0x1408b7));});}; \ No newline at end of file +var _0xa545=['customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','uniqueid','recordingURL','calleridname','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','Outbound','users','lastevent','calleridnum','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','push','set_entry','JSON','format','Basic\x20%s','base64','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','idField'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xa545,0x112));var _0x5a54=function(_0x168765,_0x534f44){_0x168765=_0x168765-0x0;var _0x3ee3a0=_0xa545[_0x168765];return _0x3ee3a0;};'use strict';var _=require(_0x5a54('0x0'));var rp=require(_0x5a54('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x5a54('0x2'));var Redis=require(_0x5a54('0x3'));var intUtil=require(_0x5a54('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5a54('0x5'))(_0x5a54('0x6'));config[_0x5a54('0x7')]=_[_0x5a54('0x8')](config[_0x5a54('0x7')],{'host':_0x5a54('0x9'),'port':0x18eb});var io=require(_0x5a54('0xa'))(new Redis(config[_0x5a54('0x7')]));var def={'method':_0x5a54('0xb'),'json':!![]};function emit(_0x3912e4,_0x195556,_0x563e59){io['to'](_0x3912e4)[_0x5a54('0xc')](_0x195556,_0x563e59);}function getTicket(_0x3da8d2,_0x4e51e1,_0x15d013,_0x549d67,_0x4a6d94,_0x1e6419,_0x3c1336,_0x2f0033){logger[_0x5a54('0xd')](_0x5a54('0xe'));var _0x36535c=new Date();var _0x373924=[{'name':_0x5a54('0xf'),'value':intUtil[_0x5a54('0x10')](_0x549d67[_0x5a54('0x11')],_0x4a6d94,'\x20')},{'name':_0x5a54('0x12'),'value':_0x4e51e1['id']},{'name':_0x5a54('0x13'),'value':_0x4e51e1['id']},{'name':_0x5a54('0x14'),'value':intUtil[_0x5a54('0x10')](_0x549d67[_0x5a54('0x15')],_0x4a6d94,'\x0a')},{'name':_0x5a54('0x16'),'value':_0x36535c[_0x5a54('0x17')]()[_0x5a54('0x18')](0x0,0x13)['replace']('T','\x20')},{'name':_0x5a54('0x19'),'value':'0'},{'name':_0x5a54('0x1a'),'value':'15'},{'name':_0x5a54('0x1b'),'value':_0x15d013['id']},{'name':_0x5a54('0x1c'),'value':_0x5a54('0x1d')},{'name':_0x5a54('0x1e'),'value':_0x15d013['name']},{'name':'direction','value':_0x2f0033}];if(_0x1e6419[_0x5a54('0x1f')]){_[_0x5a54('0x20')](_0x1e6419,function(_0x205bed){if(_0x4a6d94[_0x205bed[_0x5a54('0x21')]]){_0x373924[_0x5a54('0x22')]({'name':_0x205bed['idField'],'value':_0x4a6d94[_0x205bed['variableName']]});}});}return request({'form':{'method':_0x5a54('0x23'),'input_type':'JSON','response_type':_0x5a54('0x24'),'rest_data':JSON['stringify']({'session':_0x3c1336['id'],'module_name':'Calls','name_value_list':_0x373924})}});}function getAuth(_0x48a9a9){return util[_0x5a54('0x25')](_0x5a54('0x26'),new Buffer(_0x48a9a9['apiKey']+':X')['toString'](_0x5a54('0x27')));}function getServerInfo(_0x1e21ec){return request({'form':{'method':_0x5a54('0x28'),'input_type':'JSON','response_type':_0x5a54('0x24'),'rest_data':JSON[_0x5a54('0x29')]({'session':_0x1e21ec['id']})}});}function getUser(_0x4af561,_0x1ad28a,_0x4a9832){if(!_['isNil'](_0x1ad28a)){logger[_0x5a54('0xd')](_0x5a54('0x2a'),_0x1ad28a);return request({'form':{'method':_0x5a54('0x2b'),'input_type':'JSON','response_type':_0x5a54('0x24'),'rest_data':JSON['stringify']({'session':_0x4a9832['id'],'module_name':_0x5a54('0x2c'),'query':util['format'](_0x5a54('0x2d'),_0x1ad28a),'order_by':'','offset':'0','select_fields':['id',_0x5a54('0xf'),_0x5a54('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5a54('0x2f')](function(_0x419f83){if(_0x419f83[_0x5a54('0x30')][_0x5a54('0x1f')]){var _0x42b0c5=_[_0x5a54('0x31')](_0x419f83[_0x5a54('0x30')],function(_0x4c0972){return _0x4c0972[_0x5a54('0x32')][_0x5a54('0x2e')]['value']===_0x1ad28a;});if(_0x42b0c5){logger['info'](_0x5a54('0x33'));return BPromise[_0x5a54('0x34')]({'id':_0x42b0c5[_0x5a54('0x32')]['id'][_0x5a54('0x35')],'name':_0x42b0c5[_0x5a54('0x32')][_0x5a54('0xf')][_0x5a54('0x35')]});}}logger[_0x5a54('0xd')](_0x5a54('0x36'));return BPromise[_0x5a54('0x34')]({'id':_0x4a9832[_0x5a54('0x32')][_0x5a54('0x37')][_0x5a54('0x35')],'name':_0x4a9832['name_value_list'][_0x5a54('0x2e')][_0x5a54('0x35')]});});}else{logger[_0x5a54('0xd')](_0x5a54('0x38'));return BPromise[_0x5a54('0x34')]({'id':_0x4a9832[_0x5a54('0x32')]['user_id'][_0x5a54('0x35')],'name':_0x4a9832['name_value_list'][_0x5a54('0x2e')][_0x5a54('0x35')]});}}function getEndUser(_0x2ba0bf,_0x13f7fd,_0x3e6495,_0x2ae0c8){logger[_0x5a54('0xd')](_0x5a54('0x39'),_0x3e6495);return request({'form':{'method':'get_entry_list','input_type':_0x5a54('0x24'),'response_type':_0x5a54('0x24'),'rest_data':JSON['stringify']({'session':_0x2ae0c8['id'],'module_name':_0x5a54('0x1d'),'query':util[_0x5a54('0x25')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3e6495),'order_by':'','offset':'0','select_fields':['id',_0x5a54('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5a54('0x2f')](function(_0x3bc516){if(_0x3bc516[_0x5a54('0x30')]['length']){var _0x5f712f=_[_0x5a54('0x31')](_0x3bc516[_0x5a54('0x30')],function(_0x4444c9){return _0x4444c9[_0x5a54('0x32')]['phone_home'][_0x5a54('0x35')]===_0x3e6495;});if(_0x5f712f){logger[_0x5a54('0xd')]('Enduser\x20found!');return BPromise[_0x5a54('0x34')]({'id':_0x5f712f[_0x5a54('0x32')]['id'][_0x5a54('0x35')],'name':_0x5f712f[_0x5a54('0x32')][_0x5a54('0xf')][_0x5a54('0x35')],'phone':_0x5f712f[_0x5a54('0x32')]['phone_home'][_0x5a54('0x35')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x5a54('0x23'),'input_type':_0x5a54('0x24'),'response_type':'JSON','rest_data':JSON[_0x5a54('0x29')]({'session':_0x2ae0c8['id'],'module_name':_0x5a54('0x1d'),'name_value_list':[{'name':'first_name','value':_0x13f7fd!==''?_0x13f7fd:util['format']('Caller\x20-\x20%s',_0x3e6495)},{'name':_0x5a54('0x3a'),'value':_0x3e6495}]})}})[_0x5a54('0x2f')](function(_0x3bd28a){logger[_0x5a54('0xd')]('Enduser\x20created.');return BPromise[_0x5a54('0x34')]({'id':_0x3bd28a['id'],'name':_0x3bd28a[_0x5a54('0x30')]['first_name'][_0x5a54('0x35')],'phone':_0x3bd28a[_0x5a54('0x30')][_0x5a54('0x3a')][_0x5a54('0x35')]});});}});}function request(_0x1ce6ae){logger[_0x5a54('0x3b')](_0x5a54('0x3c'),JSON['stringify'](_0x1ce6ae));return rp(_[_0x5a54('0x3d')](def,_0x1ce6ae));}function getTags(_0x4bf755,_0x1b3f3c){var _0x44ccc9=[];if(_0x4bf755&&_0x4bf755[_0x5a54('0x1f')]>0x0){_0x44ccc9=_['map'](_0x4bf755,_0x1b3f3c);}return _0x44ccc9;}function getCustomFields(_0x2aa058,_0x359d60){var _0x1a3be7=[];var _0x373b5f={'custom_fields':[]};if(_0x2aa058[_0x5a54('0x1f')]>0x0){_[_0x5a54('0x20')](_0x2aa058,function(_0x2ece74){if(_0x2ece74[_0x5a54('0x3e')]===_0x5a54('0x3f')&&_0x2ece74[_0x5a54('0x40')]&&!_0x2ece74[_0x5a54('0x41')]){_0x373b5f[_0x2ece74[_0x5a54('0x40')][_0x5a54('0x42')]()]=_0x2ece74[_0x5a54('0x43')][_0x5a54('0x44')]();}else if(_0x2ece74[_0x5a54('0x3e')]===_0x5a54('0x3f')&&_0x2ece74['idField']&&_0x2ece74[_0x5a54('0x41')]){_0x373b5f[_0x5a54('0x45')][_0x5a54('0x22')]({'id':_0x2ece74['idField'],'value':_0x2ece74['content']['toString']()});}else if(_0x2ece74[_0x5a54('0x3e')]==='variable'&&_0x2ece74['variableName']&&_0x2ece74[_0x5a54('0x46')]&&_0x2ece74[_0x5a54('0x41')]){_0x359d60[_0x2ece74['variableName']]&&_0x373b5f[_0x5a54('0x45')]['push']({'id':_0x2ece74[_0x5a54('0x46')],'value':_0x359d60[_0x2ece74['variableName']][_0x5a54('0x44')]()});}else if(_0x2ece74[_0x5a54('0x3e')]===_0x5a54('0x47')&&_0x2ece74['Variable']&&_0x2ece74[_0x5a54('0x48')][_0x5a54('0xf')]&&_0x2ece74[_0x5a54('0x46')]&&_0x2ece74[_0x5a54('0x41')]){_0x359d60[_0x2ece74['Variable']['name'][_0x5a54('0x42')]()]&&_0x373b5f[_0x5a54('0x45')][_0x5a54('0x22')]({'id':_0x2ece74[_0x5a54('0x46')],'value':_0x359d60[_0x2ece74[_0x5a54('0x48')][_0x5a54('0xf')]['toLowerCase']()]['toString']()});}});}return _0x373b5f;}function getConnection(_0x11d922){return request({'method':_0x5a54('0xb'),'form':{'method':_0x5a54('0x49'),'input_type':_0x5a54('0x24'),'response_type':'JSON','rest_data':JSON[_0x5a54('0x29')]({'user_auth':{'user_name':_0x11d922[_0x5a54('0x4a')],'password':_0x11d922[_0x5a54('0x4b')],'encryption':_0x5a54('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x5a54('0x2f')](function(_0x2461ef){var _0x56dd11=_0x2461ef;if(_0x56dd11['id']){def[_0x5a54('0x4d')]=_0x56dd11['id'];return BPromise[_0x5a54('0x34')](_0x56dd11);}else{throw new Error(util[_0x5a54('0x25')](_0x5a54('0x4e'),_0x11d922['id']));}});}function setRelationship(_0x30a820,_0x40c1d4,_0x1671ab,_0x38071b){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x5a54('0x24'),'rest_data':JSON[_0x5a54('0x29')]({'session':_0x30a820['id'],'module_name':_0x5a54('0x4f'),'module_id':_0x1671ab['id'],'link_field_name':_0x38071b,'related_ids':[_0x40c1d4['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x53a3b2,_0x52d0fc,_0xe24d0e,_0xc82d58,_0x40ed70,_0x38dfee){var _0x59d411,_0x45cb94,_0x49521f,_0x1d61dd;_0x38dfee[_0x5a54('0x50')]=intUtil[_0x5a54('0x51')](_0x38dfee[_0x5a54('0x50')]);_0x38dfee[_0x5a54('0x52')]=intUtil[_0x5a54('0x51')](_0x38dfee[_0x5a54('0x52')]);def[_0x5a54('0x53')]=util[_0x5a54('0x25')](_0x5a54('0x54'),_0x38dfee['remoteUri']);if(_0x40ed70&&_0x40ed70[_0x5a54('0x55')]){logger[_0x5a54('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x52d0fc['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38dfee[_0x5a54('0x52')],_0x52d0fc[_0x5a54('0x56')],md5(_0x52d0fc[_0x5a54('0x56')]));}else{_0x52d0fc[_0x5a54('0x57')]='';}return getConnection(_0x38dfee)[_0x5a54('0x2f')](function(_0x15b26a){_0x1d61dd=_0x15b26a;return getUser(_0x38dfee,_0xc82d58['name'],_0x1d61dd);})[_0x5a54('0x2f')](function(_0x5de1a4){_0x59d411=_0x5de1a4;logger[_0x5a54('0xd')]('The\x20User\x20ID\x20is:',_0x59d411['id']);return getEndUser(_0x38dfee,_0x52d0fc[_0x5a54('0x58')],_0x52d0fc['calleridnum'],_0x1d61dd);})[_0x5a54('0x2f')](function(_0x55d385){_0x45cb94=_0x55d385;logger[_0x5a54('0xd')]('The\x20Enduser\x20ID\x20is:',_0x45cb94['id']);return getTicket(_0x38dfee,_0x59d411,_0x45cb94,_0xe24d0e,_0x52d0fc,_0xe24d0e['Fields'],_0x1d61dd,_0x5a54('0x59'));})[_0x5a54('0x2f')](function(_0x181d88){_0x49521f=_0x181d88;logger[_0x5a54('0xd')](_0x5a54('0x5a'));logger[_0x5a54('0xd')](_0x5a54('0x5b'),_0x49521f['id']);return setRelationship(_0x1d61dd,_0x59d411,_0x49521f,'users');})['then'](function(){return setRelationship(_0x1d61dd,_0x45cb94,_0x49521f,_0x5a54('0x5c'));})[_0x5a54('0x2f')](function(){return getServerInfo(_0x1d61dd);})[_0x5a54('0x2f')](function(_0x2cf985){var _0x5654c6=parseInt(_0x2cf985[_0x5a54('0x5d')][_0x5a54('0x5e')](0x0));var _0x1f3a9c=util[_0x5a54('0x25')](_0x5a54('0x5f'),_0x38dfee['remoteUri'],_0x49521f['id']);if(_0x5654c6>0x6){_0x1f3a9c=util[_0x5a54('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x38dfee[_0x5a54('0x50')],_0x49521f['id']);}logger[_0x5a54('0xd')](_0x5a54('0x60'),_0x5a54('0x61'));emit(util[_0x5a54('0x25')](_0x5a54('0x62'),_0xc82d58['name']),'trigger:browser:url',{'uri':_0x1f3a9c});})[_0x5a54('0x63')](function(_0x3517c4){logger[_0x5a54('0x64')](_0x5a54('0x60'),JSON[_0x5a54('0x29')](_0x3517c4));});};exports[_0x5a54('0x65')]=function(_0x3df666,_0x5864e3,_0x4652c1,_0x59b5a0,_0x42cfe0,_0x1ec7da,_0x4cf26c){var _0x3c1bca,_0x24dfc8,_0x2ec1a5,_0x2a4b5a;_0x1ec7da[_0x5a54('0x50')]=intUtil[_0x5a54('0x51')](_0x1ec7da['remoteUri']);_0x1ec7da[_0x5a54('0x52')]=intUtil[_0x5a54('0x51')](_0x1ec7da[_0x5a54('0x52')]);def['uri']=util['format'](_0x5a54('0x54'),_0x1ec7da['remoteUri']);if(_0x4cf26c&&_0x4cf26c[_0x5a54('0x66')]&&_0x4cf26c[_0x5a54('0x66')]!==_0x5a54('0x67')){logger[_0x5a54('0xd')](_0x5a54('0x68'),'Recording\x20is\x20enabled!');_0x5864e3[_0x5a54('0x57')]=util[_0x5a54('0x25')](_0x5a54('0x69'),_0x1ec7da[_0x5a54('0x52')],_0x5864e3['uniqueid'],md5(_0x5864e3[_0x5a54('0x56')]));}return getConnection(_0x1ec7da)[_0x5a54('0x2f')](function(_0xedb874){_0x2a4b5a=_0xedb874;return getUser(_0x1ec7da,_0x59b5a0[_0x5a54('0xf')],_0x2a4b5a);})['then'](function(_0x5b5127){_0x3c1bca=_0x5b5127;logger[_0x5a54('0xd')](_0x5a54('0x6a'),_0x3c1bca['id']);return getEndUser(_0x1ec7da,_0x5864e3[_0x5a54('0x6b')],_0x5864e3['destcalleridnum'],_0x2a4b5a);})[_0x5a54('0x2f')](function(_0x49e207){_0x24dfc8=_0x49e207;logger[_0x5a54('0xd')](_0x5a54('0x6c'),_0x24dfc8['id']);return getTicket(_0x1ec7da,_0x3c1bca,_0x24dfc8,_0x4652c1,_0x5864e3,_0x4652c1[_0x5a54('0x6d')],_0x2a4b5a,_0x5a54('0x6e'));})[_0x5a54('0x2f')](function(_0x59293e){_0x2ec1a5=_0x59293e;logger['info'](_0x5a54('0x5a'));logger[_0x5a54('0xd')](_0x5a54('0x5b'),_0x2ec1a5['id']);return setRelationship(_0x2a4b5a,_0x3c1bca,_0x2ec1a5,_0x5a54('0x6f'));})[_0x5a54('0x2f')](function(){return setRelationship(_0x2a4b5a,_0x24dfc8,_0x2ec1a5,_0x5a54('0x5c'));})[_0x5a54('0x2f')](function(){return getServerInfo(_0x2a4b5a);})[_0x5a54('0x2f')](function(_0x34499d){var _0x359af3=parseInt(_0x34499d[_0x5a54('0x5d')][_0x5a54('0x5e')](0x0));var _0x3f9dd8=util['format'](_0x5a54('0x5f'),_0x1ec7da[_0x5a54('0x50')],_0x2ec1a5['id']);if(_0x359af3>0x6){_0x3f9dd8=util[_0x5a54('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1ec7da[_0x5a54('0x50')],_0x2ec1a5['id']);}logger['info'](_0x5a54('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5a54('0x25')](_0x5a54('0x62'),_0x59b5a0['name']),'trigger:browser:url',{'uri':_0x3f9dd8});})[_0x5a54('0x63')](function(_0xe460b){logger[_0x5a54('0x64')](_0x5a54('0x68'),JSON[_0x5a54('0x29')](_0xe460b));});};exports['unmanaged']=function(_0x11b2d3,_0xd22802,_0x1f2974,_0x1c27b3,_0x3bc2b5,_0x502ed5){var _0x2d2654,_0x460f92,_0x154ff9,_0x17a5ad;_0x502ed5[_0x5a54('0x50')]=intUtil['stripTrailingSlash'](_0x502ed5[_0x5a54('0x50')]);_0x502ed5[_0x5a54('0x52')]=intUtil[_0x5a54('0x51')](_0x502ed5[_0x5a54('0x52')]);def[_0x5a54('0x53')]=util[_0x5a54('0x25')]('%s/service/v4_1/rest.php',_0x502ed5[_0x5a54('0x50')]);if(_0x3bc2b5&&_0x3bc2b5[_0x5a54('0x55')]){logger[_0x5a54('0xd')]('['+_0xd22802[_0x5a54('0x70')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xd22802[_0x5a54('0x57')]=util[_0x5a54('0x25')](_0x5a54('0x69'),_0x502ed5[_0x5a54('0x52')],_0xd22802[_0x5a54('0x56')],md5(_0xd22802['uniqueid']));}else{_0xd22802[_0x5a54('0x57')]='';}return getConnection(_0x502ed5)[_0x5a54('0x2f')](function(_0x353421){_0x17a5ad=_0x353421;if(!_['isNil'](_0x1c27b3)){return getUser(_0x502ed5,_0x1c27b3[_0x5a54('0xf')],_0x17a5ad);}else{return getUser(_0x502ed5,null,_0x17a5ad);}})[_0x5a54('0x2f')](function(_0x32bb62){_0x2d2654=_0x32bb62;logger[_0x5a54('0xd')](_0x5a54('0x6a'),_0x2d2654['id']);return getEndUser(_0x502ed5,_0xd22802[_0x5a54('0x58')],_0xd22802[_0x5a54('0x71')],_0x17a5ad);})[_0x5a54('0x2f')](function(_0x51c0e4){_0x460f92=_0x51c0e4;logger[_0x5a54('0xd')](_0x5a54('0x6c'),_0x460f92['id']);return getTicket(_0x502ed5,_0x2d2654,_0x460f92,_0x1f2974,_0xd22802,_0x1f2974[_0x5a54('0x6d')],_0x17a5ad,_0x5a54('0x59'));})['then'](function(_0x5cc568){_0x154ff9=_0x5cc568;logger[_0x5a54('0xd')](_0x5a54('0x5a'));logger['info'](_0x5a54('0x5b'),_0x154ff9['id']);return setRelationship(_0x17a5ad,_0x2d2654,_0x154ff9,_0x5a54('0x6f'));})[_0x5a54('0x2f')](function(){return setRelationship(_0x17a5ad,_0x460f92,_0x154ff9,_0x5a54('0x5c'));})[_0x5a54('0x2f')](function(){return getServerInfo(_0x17a5ad);})['catch'](function(_0x573520){logger[_0x5a54('0x64')]('['+_0xd22802[_0x5a54('0x70')][_0x5a54('0x72')]()+']',JSON[_0x5a54('0x29')](_0x573520));});}; \ 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 060d8eb..cc14c45 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 _0xd9ca=['isNil','lodash','util','length','sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','keyContent','format','%s:\x20%s','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x4d281f,_0x55e16f){var _0xd9b390=function(_0x53d5e9){while(--_0x53d5e9){_0x4d281f['push'](_0x4d281f['shift']());}};_0xd9b390(++_0x55e16f);}(_0xd9ca,0x1e7));var _0xad9c=function(_0x42cb3a,_0x547a40){_0x42cb3a=_0x42cb3a-0x0;var _0x6ef12e=_0xd9ca[_0x42cb3a];return _0x6ef12e;};'use strict';var _=require(_0xad9c('0x0'));var util=require(_0xad9c('0x1'));exports['getString']=function(_0x6a9241,_0x59c062,_0x50bcf3){var _0x6f2b=[];if(_0x6a9241[_0xad9c('0x2')]>0x0){var _0x456c95=_[_0xad9c('0x3')](_0x6a9241,['id']);for(var _0x5b07d5=0x0;_0x5b07d5<_0x456c95[_0xad9c('0x2')];_0x5b07d5++){var _0x4a3e62=_0x456c95[_0x5b07d5];if(_0x4a3e62[_0xad9c('0x4')]===_0xad9c('0x5')){_0x6f2b[_0xad9c('0x6')](_0x4a3e62[_0xad9c('0x7')]);}else if(_0x4a3e62['type']===_0xad9c('0x8')&&_0x4a3e62[_0xad9c('0x9')]){_0x59c062[_0x4a3e62['variableName']]&&_0x6f2b[_0xad9c('0x6')](_0x59c062[_0x4a3e62[_0xad9c('0x9')]][_0xad9c('0xa')]());}else if(_0x4a3e62[_0xad9c('0x4')]==='customVariable'&&_0x4a3e62['Variable']&&_0x4a3e62[_0xad9c('0xb')][_0xad9c('0xc')]){_0x59c062[_0x4a3e62[_0xad9c('0xb')]['name'][_0xad9c('0xd')]()]&&_0x6f2b['push'](_0x59c062[_0x4a3e62[_0xad9c('0xb')]['name'][_0xad9c('0xd')]()][_0xad9c('0xa')]());}else if(_0x4a3e62[_0xad9c('0x4')]===_0xad9c('0xe')){if(_0x4a3e62[_0xad9c('0xf')]===_0xad9c('0x5')&&_0x4a3e62[_0xad9c('0x10')]){_0x6f2b[_0xad9c('0x6')](util['format']('%s:\x20%s',_0x4a3e62[_0xad9c('0x10')],_0x4a3e62[_0xad9c('0x11')]));}else if(_0x4a3e62[_0xad9c('0xf')]===_0xad9c('0x8')&&_0x4a3e62[_0xad9c('0x9')]&&_0x4a3e62[_0xad9c('0x10')]){_0x59c062[_0x4a3e62[_0xad9c('0x9')]]&&_0x6f2b[_0xad9c('0x6')](util[_0xad9c('0x12')](_0xad9c('0x13'),_0x4a3e62['key'],_0x59c062[_0x4a3e62[_0xad9c('0x9')]]));}else if(_0x4a3e62[_0xad9c('0xf')]===_0xad9c('0x14')&&_0x4a3e62[_0xad9c('0xb')]&&_0x4a3e62[_0xad9c('0xb')][_0xad9c('0xc')]&&_0x4a3e62[_0xad9c('0x10')]){_0x59c062[_0x4a3e62[_0xad9c('0xb')][_0xad9c('0xc')]['toLowerCase']()]&&_0x6f2b[_0xad9c('0x6')](util[_0xad9c('0x12')](_0xad9c('0x13'),_0x4a3e62[_0xad9c('0x10')],_0x59c062[_0x4a3e62[_0xad9c('0xb')][_0xad9c('0xc')][_0xad9c('0xd')]()]));}}}}return _0x6f2b[_0xad9c('0x15')](_0x50bcf3);};exports[_0xad9c('0x16')]=function(_0x3944e0){var _0x53c8ac=_0x3944e0[_0xad9c('0x17')](-0x1);if(_0x53c8ac==='/'){_0x3944e0=_0x3944e0[_0xad9c('0x18')](0x0,_0x3944e0[_0xad9c('0x19')](_0x53c8ac));}return _0x3944e0;};exports['validateEmail']=function(_0x572e96){if(!_[_0xad9c('0x1a')](_0x572e96)&&_0x572e96!==''){var _0x3e2ae7=/^(([^<>()\[\]\\.,;:\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 _0x3e2ae7['test'](String(_0x572e96)[_0xad9c('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xab1f=['getString','length','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util'];(function(_0x55d9f6,_0x202542){var _0x4df3af=function(_0x40fffa){while(--_0x40fffa){_0x55d9f6['push'](_0x55d9f6['shift']());}};_0x4df3af(++_0x202542);}(_0xab1f,0x1da));var _0xfab1=function(_0x9666ab,_0x4f73f4){_0x9666ab=_0x9666ab-0x0;var _0x47dd47=_0xab1f[_0x9666ab];return _0x47dd47;};'use strict';var _=require(_0xfab1('0x0'));var util=require(_0xfab1('0x1'));exports[_0xfab1('0x2')]=function(_0x3a25aa,_0x2b7190,_0x429a2b){var _0x3c1662=[];if(_0x3a25aa[_0xfab1('0x3')]>0x0){var _0x59ac20=_['sortBy'](_0x3a25aa,['id']);for(var _0x4d56a4=0x0;_0x4d56a4<_0x59ac20[_0xfab1('0x3')];_0x4d56a4++){var _0x5cca15=_0x59ac20[_0x4d56a4];if(_0x5cca15['type']==='string'){_0x3c1662[_0xfab1('0x4')](_0x5cca15['content']);}else if(_0x5cca15[_0xfab1('0x5')]===_0xfab1('0x6')&&_0x5cca15['variableName']){_0x2b7190[_0x5cca15['variableName']]&&_0x3c1662[_0xfab1('0x4')](_0x2b7190[_0x5cca15[_0xfab1('0x7')]][_0xfab1('0x8')]());}else if(_0x5cca15[_0xfab1('0x5')]===_0xfab1('0x9')&&_0x5cca15[_0xfab1('0xa')]&&_0x5cca15[_0xfab1('0xa')][_0xfab1('0xb')]){_0x2b7190[_0x5cca15[_0xfab1('0xa')][_0xfab1('0xb')][_0xfab1('0xc')]()]&&_0x3c1662['push'](_0x2b7190[_0x5cca15[_0xfab1('0xa')][_0xfab1('0xb')][_0xfab1('0xc')]()][_0xfab1('0x8')]());}else if(_0x5cca15[_0xfab1('0x5')]===_0xfab1('0xd')){if(_0x5cca15[_0xfab1('0xe')]===_0xfab1('0xf')&&_0x5cca15[_0xfab1('0x10')]){_0x3c1662[_0xfab1('0x4')](util[_0xfab1('0x11')]('%s:\x20%s',_0x5cca15['key'],_0x5cca15[_0xfab1('0x12')]));}else if(_0x5cca15[_0xfab1('0xe')]===_0xfab1('0x6')&&_0x5cca15[_0xfab1('0x7')]&&_0x5cca15[_0xfab1('0x10')]){_0x2b7190[_0x5cca15[_0xfab1('0x7')]]&&_0x3c1662[_0xfab1('0x4')](util['format'](_0xfab1('0x13'),_0x5cca15[_0xfab1('0x10')],_0x2b7190[_0x5cca15[_0xfab1('0x7')]]));}else if(_0x5cca15[_0xfab1('0xe')]==='customVariable'&&_0x5cca15[_0xfab1('0xa')]&&_0x5cca15['Variable']['name']&&_0x5cca15[_0xfab1('0x10')]){_0x2b7190[_0x5cca15[_0xfab1('0xa')][_0xfab1('0xb')][_0xfab1('0xc')]()]&&_0x3c1662['push'](util[_0xfab1('0x11')](_0xfab1('0x13'),_0x5cca15['key'],_0x2b7190[_0x5cca15['Variable'][_0xfab1('0xb')][_0xfab1('0xc')]()]));}}}}return _0x3c1662[_0xfab1('0x14')](_0x429a2b);};exports[_0xfab1('0x15')]=function(_0x16265e){var _0x26b70d=_0x16265e[_0xfab1('0x16')](-0x1);if(_0x26b70d==='/'){_0x16265e=_0x16265e[_0xfab1('0x17')](0x0,_0x16265e[_0xfab1('0x18')](_0x26b70d));}return _0x16265e;};exports[_0xfab1('0x19')]=function(_0x5f30bb){if(!_[_0xfab1('0x1a')](_0x5f30bb)&&_0x5f30bb!==''){var _0x238d6c=/^(([^<>()\[\]\\.,;:\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 _0x238d6c[_0xfab1('0x1b')](String(_0x5f30bb)[_0xfab1('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 2537ee1..efa40fc 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x49b0ed,_0x16efec){var _0x11e03f=function(_0xcbeac){while(--_0xcbeac){_0x49b0ed['push'](_0x49b0ed['shift']());}};_0x11e03f(++_0x16efec);}(_0xe706,0xa3));var _0x6e70=function(_0x48f2b7,_0x40f214){_0x48f2b7=_0x48f2b7-0x0;var _0x54506f=_0xe706[_0x48f2b7];return _0x54506f;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x252c31,_0x553b4f){var _0x515065=function(_0x33d34e){while(--_0x33d34e){_0x252c31['push'](_0x252c31['shift']());}};_0x515065(++_0x553b4f);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 9b0464d..efd8c1c 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 _0xcc92=['username','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','string','picklist','nameField','customField','toLowerCase','content','includes','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','/api/v2','unmanaged','monitor_format','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Descriptions','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','then','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','password'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xcc92,0x18d));var _0x2cc9=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0xcc92[_0x4a7843];return _0x2c57fe;};'use strict';var _=require(_0x2cc9('0x0'));var rp=require(_0x2cc9('0x1'));var md5=require(_0x2cc9('0x2'));var util=require('util');var Redis=require(_0x2cc9('0x3'));var intUtil=require(_0x2cc9('0x4'));var config=require(_0x2cc9('0x5'));var logger=require(_0x2cc9('0x6'))(_0x2cc9('0x7'));config[_0x2cc9('0x8')]=_[_0x2cc9('0x9')](config[_0x2cc9('0x8')],{'host':_0x2cc9('0xa'),'port':0x18eb});var io=require(_0x2cc9('0xb'))(new Redis(config[_0x2cc9('0x8')]));function emit(_0x51fc53,_0xccf342,_0xfeb949){io['to'](_0x51fc53)[_0x2cc9('0xc')](_0xccf342,_0xfeb949);}var headers={'Content-Type':_0x2cc9('0xd'),'Accept':_0x2cc9('0xd')};function getTicket(_0x13f93d,_0x538620,_0x59ac4b,_0x24605b,_0x295de9){logger[_0x2cc9('0xe')](_0x2cc9('0xf'));return request({'uri':util[_0x2cc9('0x10')]('%s/tickets.json',_0x13f93d[_0x2cc9('0x11')]),'method':_0x2cc9('0x12'),'body':{'ticket':_[_0x2cc9('0x13')]({'requester_id':_0x59ac4b['id'],'submitter_id':_0x538620?_0x538620['id']:undefined,'assignee_id':_0x538620?_0x538620['id']:undefined,'tags':getTags(_0x24605b[_0x2cc9('0x14')],_0x2cc9('0x15')),'subject':intUtil[_0x2cc9('0x16')](_0x24605b['Subjects'],_0x295de9,'\x20'),'description':intUtil[_0x2cc9('0x16')](_0x24605b['Descriptions'],_0x295de9,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x24605b[_0x2cc9('0x17')],_0x295de9,'\x0a')}},getCustomFields(_0x24605b['Fields'],_0x295de9))}})['then'](function(_0x1b5daa){logger[_0x2cc9('0xe')]('Ticket\x20created!');return _0x1b5daa[_0x2cc9('0x18')];});}function getUser(_0x436e12,_0x164af7){if(intUtil[_0x2cc9('0x19')](_0x164af7)){logger['info'](_0x2cc9('0x1a'),_0x164af7);return request({'uri':util[_0x2cc9('0x10')](_0x2cc9('0x1b'),_0x436e12[_0x2cc9('0x11')]),'qs':{'query':util['format'](_0x2cc9('0x1c'),_0x164af7)}})['then'](function(_0x1ba945){if(_0x1ba945['count']){logger['info'](_0x2cc9('0x1d'));return _[_0x2cc9('0x1e')](_0x1ba945[_0x2cc9('0x1f')],{'email':_0x164af7,'role':_0x2cc9('0x20')});}else{logger[_0x2cc9('0xe')](_0x2cc9('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x436e12[_0x2cc9('0x11')])})['then'](function(_0x3b90f8){logger['info'](_0x2cc9('0x22'));return _0x3b90f8[_0x2cc9('0x23')];});}});}else{logger[_0x2cc9('0xe')](_0x2cc9('0x21'));return request({'uri':util[_0x2cc9('0x10')]('%s/users/me.json',_0x436e12[_0x2cc9('0x11')])})[_0x2cc9('0x24')](function(_0x3703da){logger[_0x2cc9('0xe')](_0x2cc9('0x22'));return _0x3703da[_0x2cc9('0x23')];});}}function getEndUser(_0x5c177d,_0x4d9a43,_0x20ea51){logger['info'](_0x2cc9('0x25'),_0x20ea51);return request({'uri':util['format'](_0x2cc9('0x1b'),_0x5c177d[_0x2cc9('0x11')]),'qs':{'query':util[_0x2cc9('0x10')](_0x2cc9('0x26'),_0x20ea51)}})[_0x2cc9('0x24')](function(_0x1c467d){var _0x93c4e2;if(_0x1c467d[_0x2cc9('0x1f')]['length']){_0x1c467d['results']=_['filter'](_0x1c467d[_0x2cc9('0x1f')],{'suspended':![],'role':'end-user'});if(_0x1c467d['results'][_0x2cc9('0x27')]){_0x93c4e2=_[_0x2cc9('0x28')](_0x1c467d[_0x2cc9('0x1f')]);}}if(_0x93c4e2){logger[_0x2cc9('0xe')](_0x2cc9('0x29'));return _0x93c4e2;}else{logger[_0x2cc9('0xe')](_0x2cc9('0x2a'));return request({'uri':util['format'](_0x2cc9('0x2b'),_0x5c177d[_0x2cc9('0x11')]),'method':'POST','body':{'user':{'role':_0x2cc9('0x2c'),'name':util[_0x2cc9('0x10')](_0x2cc9('0x2d'),_0x4d9a43||_0x20ea51),'phone':_0x20ea51}}})[_0x2cc9('0x24')](function(_0x440125){logger[_0x2cc9('0xe')]('Enduser\x20created.');return _0x440125[_0x2cc9('0x23')];});}});}function getAuth(_0x2534bc){var _0x538777;if(_0x2534bc['authType']===_0x2cc9('0x2e')){_0x538777=util[_0x2cc9('0x10')]('%s:%s',_0x2534bc[_0x2cc9('0x2f')],_0x2534bc['password']);}else if(_0x2534bc['authType']==='token'){_0x538777=util[_0x2cc9('0x10')](_0x2cc9('0x30'),_0x2534bc[_0x2cc9('0x2f')],_0x2534bc[_0x2cc9('0x31')]);}return util['format'](_0x2cc9('0x32'),new Buffer(_0x538777)[_0x2cc9('0x33')](_0x2cc9('0x34')));}function request(_0x36ec37){logger[_0x2cc9('0x35')](_0x2cc9('0x36'),JSON['stringify'](_0x36ec37));return rp(_[_0x2cc9('0x9')](_0x36ec37,{'method':_0x2cc9('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x36fcb5,_0x117035){var _0x2ae4e6=[];if(_0x36fcb5&&_0x36fcb5['length']>0x0){_0x2ae4e6=_[_0x2cc9('0x38')](_0x36fcb5,_0x117035);}return _0x2ae4e6;}function getCustomFields(_0x5ca324,_0x220918){var _0x3945ac=[];var _0x188100={'custom_fields':[]};if(_0x5ca324[_0x2cc9('0x27')]>0x0){_['forEach'](_0x5ca324,function(_0xd6ae01){if(_['includes']([_0x2cc9('0x39'),_0x2cc9('0x3a')],_0xd6ae01['type'])&&_0xd6ae01[_0x2cc9('0x3b')]&&!_0xd6ae01[_0x2cc9('0x3c')]){_0x188100[_0xd6ae01[_0x2cc9('0x3b')][_0x2cc9('0x3d')]()]=_0xd6ae01[_0x2cc9('0x3e')][_0x2cc9('0x33')]();}else if(_[_0x2cc9('0x3f')]([_0x2cc9('0x39'),_0x2cc9('0x3a')],_0xd6ae01[_0x2cc9('0x40')])&&_0xd6ae01[_0x2cc9('0x41')]&&_0xd6ae01[_0x2cc9('0x3c')]){_0x188100[_0x2cc9('0x42')][_0x2cc9('0x43')]({'id':_0xd6ae01['idField'],'value':_0xd6ae01['content'][_0x2cc9('0x33')]()});}else if(_0xd6ae01['type']===_0x2cc9('0x44')&&_0xd6ae01[_0x2cc9('0x45')]&&_0xd6ae01['idField']&&_0xd6ae01[_0x2cc9('0x3c')]){_0x220918[_0xd6ae01[_0x2cc9('0x45')]]&&_0x188100[_0x2cc9('0x42')][_0x2cc9('0x43')]({'id':_0xd6ae01[_0x2cc9('0x41')],'value':_0x220918[_0xd6ae01[_0x2cc9('0x45')]][_0x2cc9('0x33')]()});}else if(_0xd6ae01[_0x2cc9('0x40')]===_0x2cc9('0x46')&&_0xd6ae01['Variable']&&_0xd6ae01['Variable'][_0x2cc9('0x15')]&&_0xd6ae01['idField']&&_0xd6ae01[_0x2cc9('0x3c')]){_0x220918[_0xd6ae01[_0x2cc9('0x47')][_0x2cc9('0x15')][_0x2cc9('0x3d')]()]&&_0x188100[_0x2cc9('0x42')][_0x2cc9('0x43')]({'id':_0xd6ae01['idField'],'value':_0x220918[_0xd6ae01[_0x2cc9('0x47')][_0x2cc9('0x15')][_0x2cc9('0x3d')]()][_0x2cc9('0x33')]()});}});}return _0x188100;}exports[_0x2cc9('0x48')]=function(_0x1d70c9,_0x27cf26,_0xe02959,_0x4269c5,_0x4c0eda,_0x39b09b){var _0x444675,_0x325d8d;_0x39b09b[_0x2cc9('0x11')]=intUtil[_0x2cc9('0x49')](_0x39b09b['remoteUri']);_0x39b09b[_0x2cc9('0x4a')]=intUtil[_0x2cc9('0x49')](_0x39b09b[_0x2cc9('0x4a')]);if(_0x4c0eda&&_0x4c0eda['monitor_format']){logger[_0x2cc9('0xe')]('[QUEUE]',_0x2cc9('0x4b'));_0x27cf26['recordingURL']=util[_0x2cc9('0x10')](_0x2cc9('0x4c'),_0x39b09b[_0x2cc9('0x4a')],_0x27cf26[_0x2cc9('0x4d')],md5(_0x27cf26[_0x2cc9('0x4d')]));}else{_0x27cf26[_0x2cc9('0x4e')]='';}headers[_0x2cc9('0x4f')]=getAuth(_0x39b09b);return getUser(_0x39b09b,_0x4269c5[_0x2cc9('0x50')])[_0x2cc9('0x24')](function(_0x237941){_0x444675=_0x237941;logger[_0x2cc9('0xe')](_0x2cc9('0x51'),_0x444675['id']);return getEndUser(_0x39b09b,_0x27cf26[_0x2cc9('0x52')],_0x27cf26[_0x2cc9('0x53')]);})[_0x2cc9('0x24')](function(_0x51168b){_0x325d8d=_0x51168b;logger[_0x2cc9('0xe')]('The\x20Enduser\x20ID\x20is:',_0x325d8d['id']);return getTicket(_0x39b09b,_0x444675,_0x325d8d,_0xe02959,_0x27cf26);})[_0x2cc9('0x24')](function(_0x5bc3e4){if(_0x5bc3e4){logger['info'](_0x2cc9('0x54'),_0x5bc3e4['id']);switch(_0x39b09b[_0x2cc9('0x40')]){case _0x2cc9('0x55'):logger[_0x2cc9('0xe')](_0x2cc9('0x56'),_0x2cc9('0x57'));return request({'uri':util['format'](_0x2cc9('0x58'),_0x39b09b[_0x2cc9('0x11')],_0x444675['id'],_0x5bc3e4['id']),'method':_0x2cc9('0x12')});case _0x2cc9('0x59'):logger['info'](_0x2cc9('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2cc9('0x5a'),_0x4269c5[_0x2cc9('0x15')]),_0x2cc9('0x5b'),{'uri':util['format']('%s/agent/tickets/%s',_0x39b09b[_0x2cc9('0x11')][_0x2cc9('0x5c')]('/api/v2',''),_0x5bc3e4['id'])});break;default:logger[_0x2cc9('0x5d')](_0x2cc9('0x56'),_0x2cc9('0x5e'));}}})[_0x2cc9('0x5f')](function(_0x168ee3){logger[_0x2cc9('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2cc9('0x60')](_0x168ee3,{'showHidden':!![],'depth':null}));});};exports[_0x2cc9('0x61')]=function(_0x1abad2,_0x39595f,_0x1c5572,_0x5fb534,_0x419dc0,_0x1ecb9b,_0x2e4ba2){var _0xa9ded5,_0x53bab0;_0x1ecb9b[_0x2cc9('0x11')]=intUtil[_0x2cc9('0x49')](_0x1ecb9b[_0x2cc9('0x11')]);_0x1ecb9b[_0x2cc9('0x4a')]=intUtil[_0x2cc9('0x49')](_0x1ecb9b[_0x2cc9('0x4a')]);if(_0x2e4ba2&&_0x2e4ba2['recordingFormat']&&_0x2e4ba2[_0x2cc9('0x62')]!==_0x2cc9('0x63')){logger[_0x2cc9('0xe')](_0x2cc9('0x64'),_0x2cc9('0x4b'));_0x39595f[_0x2cc9('0x4e')]=util[_0x2cc9('0x10')](_0x2cc9('0x4c'),_0x1ecb9b[_0x2cc9('0x4a')],_0x39595f[_0x2cc9('0x4d')],md5(_0x39595f[_0x2cc9('0x4d')]));}headers[_0x2cc9('0x4f')]=getAuth(_0x1ecb9b);return getUser(_0x1ecb9b,_0x5fb534[_0x2cc9('0x50')])[_0x2cc9('0x24')](function(_0x44ff22){_0xa9ded5=_0x44ff22;logger['info']('The\x20User\x20ID\x20is:',_0xa9ded5['id']);return getEndUser(_0x1ecb9b,_0x39595f[_0x2cc9('0x65')],_0x39595f[_0x2cc9('0x66')]);})[_0x2cc9('0x24')](function(_0x511feb){_0x53bab0=_0x511feb;logger[_0x2cc9('0xe')](_0x2cc9('0x67'),_0x53bab0['id']);return getTicket(_0x1ecb9b,_0xa9ded5,_0x53bab0,_0x1c5572,_0x39595f);})[_0x2cc9('0x24')](function(_0x4a621c){if(_0x4a621c){logger['info'](_0x2cc9('0x54'),_0x4a621c['id']);switch(_0x1ecb9b['type']){case'integrationTab':logger[_0x2cc9('0xe')](_0x2cc9('0x64'),_0x2cc9('0x57'));return request({'uri':util[_0x2cc9('0x10')](_0x2cc9('0x58'),_0x1ecb9b['remoteUri'],_0xa9ded5['id'],_0x4a621c['id']),'method':_0x2cc9('0x12')});case'newTab':logger['info'](_0x2cc9('0x64'),_0x2cc9('0x68'));emit(util[_0x2cc9('0x10')](_0x2cc9('0x5a'),_0x5fb534[_0x2cc9('0x15')]),_0x2cc9('0x5b'),{'uri':util[_0x2cc9('0x10')](_0x2cc9('0x69'),_0x1ecb9b[_0x2cc9('0x11')]['replace'](_0x2cc9('0x6a'),''),_0x4a621c['id'])});break;default:logger[_0x2cc9('0x5d')](_0x2cc9('0x64'),_0x2cc9('0x5e'));}}})[_0x2cc9('0x5f')](function(_0x19956c){logger[_0x2cc9('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x19956c,{'showHidden':!![],'depth':null}));});};exports[_0x2cc9('0x6b')]=function(_0x5e483f,_0x36ebb8,_0x1aa799,_0x463127,_0x1120f2,_0x5db9aa){var _0x428216,_0x13e018;_0x5db9aa[_0x2cc9('0x11')]=intUtil['stripTrailingSlash'](_0x5db9aa[_0x2cc9('0x11')]);_0x5db9aa[_0x2cc9('0x4a')]=intUtil[_0x2cc9('0x49')](_0x5db9aa[_0x2cc9('0x4a')]);if(_0x1120f2&&_0x1120f2[_0x2cc9('0x6c')]){logger['info']('['+_0x36ebb8['lastevent'][_0x2cc9('0x6d')]()+']',_0x2cc9('0x4b'));_0x36ebb8['recordingURL']=util[_0x2cc9('0x10')](_0x2cc9('0x4c'),_0x5db9aa[_0x2cc9('0x4a')],_0x36ebb8[_0x2cc9('0x4d')],md5(_0x36ebb8[_0x2cc9('0x4d')]));}else{_0x36ebb8[_0x2cc9('0x4e')]='';}headers[_0x2cc9('0x4f')]=getAuth(_0x5db9aa);return getUser(_0x5db9aa)['then'](function(_0x26e7f0){_0x428216=_0x26e7f0;logger[_0x2cc9('0xe')](_0x2cc9('0x51'),_0x428216['id']);return getEndUser(_0x5db9aa,_0x36ebb8[_0x2cc9('0x52')],_0x36ebb8[_0x2cc9('0x53')]);})[_0x2cc9('0x24')](function(_0xa03a0f){_0x13e018=_0xa03a0f;logger[_0x2cc9('0xe')](_0x2cc9('0x67'),_0x13e018['id']);return getTicket(_0x5db9aa,_0x428216,_0x13e018,_0x1aa799,_0x36ebb8);})['then'](function(_0x1501c3){if(_0x1501c3){logger[_0x2cc9('0xe')](_0x2cc9('0x54'),_0x1501c3['id']);}})[_0x2cc9('0x5f')](function(_0x186b6){logger[_0x2cc9('0x5d')]('['+_0x36ebb8['lastevent']['toUpperCase']()+']'+_0x2cc9('0x6e'),util[_0x2cc9('0x60')](_0x186b6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7971=['zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','POST','merge','Tags','name','getString','Subjects','Descriptions','Ticket\x20created!','ticket','format','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','authType','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','forEach','includes','picklist','nameField','toLowerCase','type','idField','customField','custom_fields','content','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger'];(function(_0x1a643a,_0x2f32bc){var _0x4b3765=function(_0x59db8e){while(--_0x59db8e){_0x1a643a['push'](_0x1a643a['shift']());}};_0x4b3765(++_0x2f32bc);}(_0x7971,0x64));var _0x1797=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x7971[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x1797('0x0'));var rp=require(_0x1797('0x1'));var md5=require(_0x1797('0x2'));var util=require(_0x1797('0x3'));var Redis=require('ioredis');var intUtil=require(_0x1797('0x4'));var config=require(_0x1797('0x5'));var logger=require(_0x1797('0x6'))(_0x1797('0x7'));config[_0x1797('0x8')]=_['defaults'](config['redis'],{'host':_0x1797('0x9'),'port':0x18eb});var io=require(_0x1797('0xa'))(new Redis(config['redis']));function emit(_0x2ad087,_0x12bdf5,_0xb2efa3){io['to'](_0x2ad087)[_0x1797('0xb')](_0x12bdf5,_0xb2efa3);}var headers={'Content-Type':'application/json','Accept':_0x1797('0xc')};function getTicket(_0x45866a,_0x20c7dc,_0xa3b71b,_0x4f2be1,_0x3c456c){logger[_0x1797('0xd')](_0x1797('0xe'));return request({'uri':util['format']('%s/tickets.json',_0x45866a['remoteUri']),'method':_0x1797('0xf'),'body':{'ticket':_[_0x1797('0x10')]({'requester_id':_0xa3b71b['id'],'submitter_id':_0x20c7dc?_0x20c7dc['id']:undefined,'assignee_id':_0x20c7dc?_0x20c7dc['id']:undefined,'tags':getTags(_0x4f2be1[_0x1797('0x11')],_0x1797('0x12')),'subject':intUtil[_0x1797('0x13')](_0x4f2be1[_0x1797('0x14')],_0x3c456c,'\x20'),'description':intUtil[_0x1797('0x13')](_0x4f2be1[_0x1797('0x15')],_0x3c456c,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4f2be1[_0x1797('0x15')],_0x3c456c,'\x0a')}},getCustomFields(_0x4f2be1['Fields'],_0x3c456c))}})['then'](function(_0x28ca14){logger[_0x1797('0xd')](_0x1797('0x16'));return _0x28ca14[_0x1797('0x17')];});}function getUser(_0x47ed26,_0x20b3dd){if(intUtil['validateEmail'](_0x20b3dd)){logger[_0x1797('0xd')]('Getting\x20agent\x20with\x20email',_0x20b3dd);return request({'uri':util[_0x1797('0x18')](_0x1797('0x19'),_0x47ed26[_0x1797('0x1a')]),'qs':{'query':util[_0x1797('0x18')](_0x1797('0x1b'),_0x20b3dd)}})[_0x1797('0x1c')](function(_0x57baba){if(_0x57baba[_0x1797('0x1d')]){logger[_0x1797('0xd')](_0x1797('0x1e'));return _[_0x1797('0x1f')](_0x57baba[_0x1797('0x20')],{'email':_0x20b3dd,'role':'agent'});}else{logger[_0x1797('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1797('0x18')]('%s/users/me.json',_0x47ed26[_0x1797('0x1a')])})[_0x1797('0x1c')](function(_0x2b1cdd){logger[_0x1797('0xd')](_0x1797('0x21'));return _0x2b1cdd[_0x1797('0x22')];});}});}else{logger[_0x1797('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1797('0x18')]('%s/users/me.json',_0x47ed26[_0x1797('0x1a')])})[_0x1797('0x1c')](function(_0x2b7806){logger[_0x1797('0xd')](_0x1797('0x21'));return _0x2b7806['user'];});}}function getEndUser(_0x3a77bc,_0x4afd13,_0x40a4b4){logger['info'](_0x1797('0x23'),_0x40a4b4);return request({'uri':util[_0x1797('0x18')](_0x1797('0x19'),_0x3a77bc[_0x1797('0x1a')]),'qs':{'query':util[_0x1797('0x18')](_0x1797('0x24'),_0x40a4b4)}})['then'](function(_0x21ed48){var _0x4fdaa6;if(_0x21ed48['results'][_0x1797('0x25')]){_0x21ed48[_0x1797('0x20')]=_['filter'](_0x21ed48['results'],{'suspended':![],'role':_0x1797('0x26')});if(_0x21ed48[_0x1797('0x20')][_0x1797('0x25')]){_0x4fdaa6=_[_0x1797('0x27')](_0x21ed48['results']);}}if(_0x4fdaa6){logger[_0x1797('0xd')]('Enduser\x20found!');return _0x4fdaa6;}else{logger[_0x1797('0xd')](_0x1797('0x28'));return request({'uri':util[_0x1797('0x18')](_0x1797('0x29'),_0x3a77bc[_0x1797('0x1a')]),'method':_0x1797('0xf'),'body':{'user':{'role':_0x1797('0x26'),'name':util[_0x1797('0x18')]('Caller\x20-\x20%s',_0x4afd13||_0x40a4b4),'phone':_0x40a4b4}}})['then'](function(_0x1fdca5){logger[_0x1797('0xd')](_0x1797('0x2a'));return _0x1fdca5[_0x1797('0x22')];});}});}function getAuth(_0x3ccfb8){var _0x54cd70;if(_0x3ccfb8['authType']===_0x1797('0x2b')){_0x54cd70=util[_0x1797('0x18')]('%s:%s',_0x3ccfb8['username'],_0x3ccfb8['password']);}else if(_0x3ccfb8[_0x1797('0x2c')]===_0x1797('0x2d')){_0x54cd70=util[_0x1797('0x18')](_0x1797('0x2e'),_0x3ccfb8['username'],_0x3ccfb8[_0x1797('0x2d')]);}return util['format'](_0x1797('0x2f'),new Buffer(_0x54cd70)[_0x1797('0x30')](_0x1797('0x31')));}function request(_0x5716a6){logger['debug'](_0x1797('0x32'),JSON[_0x1797('0x33')](_0x5716a6));return rp(_[_0x1797('0x34')](_0x5716a6,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4dfe79,_0x3de1d7){var _0x3787f7=[];if(_0x4dfe79&&_0x4dfe79[_0x1797('0x25')]>0x0){_0x3787f7=_['map'](_0x4dfe79,_0x3de1d7);}return _0x3787f7;}function getCustomFields(_0x1527d9,_0x6806d8){var _0x4f9e18=[];var _0x2fdcb0={'custom_fields':[]};if(_0x1527d9[_0x1797('0x25')]>0x0){_[_0x1797('0x35')](_0x1527d9,function(_0x58db61){if(_[_0x1797('0x36')](['string',_0x1797('0x37')],_0x58db61['type'])&&_0x58db61[_0x1797('0x38')]&&!_0x58db61['customField']){_0x2fdcb0[_0x58db61['nameField'][_0x1797('0x39')]()]=_0x58db61['content'][_0x1797('0x30')]();}else if(_['includes'](['string',_0x1797('0x37')],_0x58db61[_0x1797('0x3a')])&&_0x58db61[_0x1797('0x3b')]&&_0x58db61[_0x1797('0x3c')]){_0x2fdcb0[_0x1797('0x3d')]['push']({'id':_0x58db61['idField'],'value':_0x58db61[_0x1797('0x3e')][_0x1797('0x30')]()});}else if(_0x58db61[_0x1797('0x3a')]==='variable'&&_0x58db61[_0x1797('0x3f')]&&_0x58db61[_0x1797('0x3b')]&&_0x58db61[_0x1797('0x3c')]){_0x6806d8[_0x58db61[_0x1797('0x3f')]]&&_0x2fdcb0['custom_fields'][_0x1797('0x40')]({'id':_0x58db61[_0x1797('0x3b')],'value':_0x6806d8[_0x58db61[_0x1797('0x3f')]][_0x1797('0x30')]()});}else if(_0x58db61[_0x1797('0x3a')]===_0x1797('0x41')&&_0x58db61[_0x1797('0x42')]&&_0x58db61[_0x1797('0x42')][_0x1797('0x12')]&&_0x58db61['idField']&&_0x58db61[_0x1797('0x3c')]){_0x6806d8[_0x58db61['Variable'][_0x1797('0x12')][_0x1797('0x39')]()]&&_0x2fdcb0[_0x1797('0x3d')][_0x1797('0x40')]({'id':_0x58db61[_0x1797('0x3b')],'value':_0x6806d8[_0x58db61['Variable'][_0x1797('0x12')]['toLowerCase']()]['toString']()});}});}return _0x2fdcb0;}exports[_0x1797('0x43')]=function(_0x5aa65b,_0x392ae9,_0x13cc71,_0x406b90,_0x5d0a57,_0x162cae){var _0x3195e5,_0x272eea;_0x162cae['remoteUri']=intUtil[_0x1797('0x44')](_0x162cae[_0x1797('0x1a')]);_0x162cae['serverUrl']=intUtil[_0x1797('0x44')](_0x162cae[_0x1797('0x45')]);if(_0x5d0a57&&_0x5d0a57[_0x1797('0x46')]){logger[_0x1797('0xd')](_0x1797('0x47'),_0x1797('0x48'));_0x392ae9[_0x1797('0x49')]=util[_0x1797('0x18')](_0x1797('0x4a'),_0x162cae[_0x1797('0x45')],_0x392ae9['uniqueid'],md5(_0x392ae9[_0x1797('0x4b')]));}else{_0x392ae9[_0x1797('0x49')]='';}headers[_0x1797('0x4c')]=getAuth(_0x162cae);return getUser(_0x162cae,_0x406b90[_0x1797('0x4d')])[_0x1797('0x1c')](function(_0x11fdb5){_0x3195e5=_0x11fdb5;logger[_0x1797('0xd')](_0x1797('0x4e'),_0x3195e5['id']);return getEndUser(_0x162cae,_0x392ae9[_0x1797('0x4f')],_0x392ae9[_0x1797('0x50')]);})[_0x1797('0x1c')](function(_0x3171cb){_0x272eea=_0x3171cb;logger['info'](_0x1797('0x51'),_0x272eea['id']);return getTicket(_0x162cae,_0x3195e5,_0x272eea,_0x13cc71,_0x392ae9);})[_0x1797('0x1c')](function(_0x29db83){if(_0x29db83){logger['info'](_0x1797('0x52'),_0x29db83['id']);switch(_0x162cae[_0x1797('0x3a')]){case _0x1797('0x53'):logger['info'](_0x1797('0x47'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x1797('0x18')](_0x1797('0x54'),_0x162cae['remoteUri'],_0x3195e5['id'],_0x29db83['id']),'method':'POST'});case _0x1797('0x55'):logger[_0x1797('0xd')](_0x1797('0x47'),_0x1797('0x56'));emit(util['format'](_0x1797('0x57'),_0x406b90[_0x1797('0x12')]),_0x1797('0x58'),{'uri':util[_0x1797('0x18')](_0x1797('0x59'),_0x162cae[_0x1797('0x1a')][_0x1797('0x5a')](_0x1797('0x5b'),''),_0x29db83['id'])});break;default:logger[_0x1797('0x5c')](_0x1797('0x47'),_0x1797('0x5d'));}}})[_0x1797('0x5e')](function(_0x5ac377){logger[_0x1797('0x5c')](_0x1797('0x5f'),util[_0x1797('0x60')](_0x5ac377,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5b27f0,_0x27988b,_0x3a3cc4,_0x480c6a,_0x59b51b,_0x1675cf,_0x2ae271){var _0x1ec7b8,_0x254541;_0x1675cf['remoteUri']=intUtil[_0x1797('0x44')](_0x1675cf[_0x1797('0x1a')]);_0x1675cf['serverUrl']=intUtil[_0x1797('0x44')](_0x1675cf[_0x1797('0x45')]);if(_0x2ae271&&_0x2ae271[_0x1797('0x61')]&&_0x2ae271[_0x1797('0x61')]!==_0x1797('0x62')){logger[_0x1797('0xd')](_0x1797('0x63'),_0x1797('0x48'));_0x27988b[_0x1797('0x49')]=util[_0x1797('0x18')](_0x1797('0x4a'),_0x1675cf[_0x1797('0x45')],_0x27988b[_0x1797('0x4b')],md5(_0x27988b[_0x1797('0x4b')]));}headers['Authorization']=getAuth(_0x1675cf);return getUser(_0x1675cf,_0x480c6a[_0x1797('0x4d')])[_0x1797('0x1c')](function(_0x3d8286){_0x1ec7b8=_0x3d8286;logger[_0x1797('0xd')]('The\x20User\x20ID\x20is:',_0x1ec7b8['id']);return getEndUser(_0x1675cf,_0x27988b[_0x1797('0x64')],_0x27988b[_0x1797('0x65')]);})[_0x1797('0x1c')](function(_0x1f17cd){_0x254541=_0x1f17cd;logger[_0x1797('0xd')](_0x1797('0x51'),_0x254541['id']);return getTicket(_0x1675cf,_0x1ec7b8,_0x254541,_0x3a3cc4,_0x27988b);})[_0x1797('0x1c')](function(_0x23c945){if(_0x23c945){logger[_0x1797('0xd')](_0x1797('0x52'),_0x23c945['id']);switch(_0x1675cf[_0x1797('0x3a')]){case _0x1797('0x53'):logger[_0x1797('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x1797('0x18')](_0x1797('0x54'),_0x1675cf['remoteUri'],_0x1ec7b8['id'],_0x23c945['id']),'method':_0x1797('0xf')});case _0x1797('0x55'):logger[_0x1797('0xd')](_0x1797('0x63'),_0x1797('0x56'));emit(util['format'](_0x1797('0x57'),_0x480c6a[_0x1797('0x12')]),_0x1797('0x58'),{'uri':util['format'](_0x1797('0x59'),_0x1675cf[_0x1797('0x1a')][_0x1797('0x5a')](_0x1797('0x5b'),''),_0x23c945['id'])});break;default:logger[_0x1797('0x5c')](_0x1797('0x63'),_0x1797('0x5d'));}}})[_0x1797('0x5e')](function(_0x3b4fa7){logger[_0x1797('0x5c')](_0x1797('0x66'),util[_0x1797('0x60')](_0x3b4fa7,{'showHidden':!![],'depth':null}));});};exports[_0x1797('0x67')]=function(_0x300944,_0x4dbf52,_0x25532f,_0x101306,_0x527f47,_0x20df30){var _0x432580,_0x590cbe;_0x20df30[_0x1797('0x1a')]=intUtil[_0x1797('0x44')](_0x20df30['remoteUri']);_0x20df30[_0x1797('0x45')]=intUtil[_0x1797('0x44')](_0x20df30[_0x1797('0x45')]);if(_0x527f47&&_0x527f47[_0x1797('0x46')]){logger[_0x1797('0xd')]('['+_0x4dbf52[_0x1797('0x68')][_0x1797('0x69')]()+']',_0x1797('0x48'));_0x4dbf52[_0x1797('0x49')]=util[_0x1797('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20df30[_0x1797('0x45')],_0x4dbf52[_0x1797('0x4b')],md5(_0x4dbf52[_0x1797('0x4b')]));}else{_0x4dbf52[_0x1797('0x49')]='';}headers[_0x1797('0x4c')]=getAuth(_0x20df30);return getUser(_0x20df30)[_0x1797('0x1c')](function(_0x4c31de){_0x432580=_0x4c31de;logger[_0x1797('0xd')](_0x1797('0x4e'),_0x432580['id']);return getEndUser(_0x20df30,_0x4dbf52[_0x1797('0x4f')],_0x4dbf52[_0x1797('0x50')]);})[_0x1797('0x1c')](function(_0x236e85){_0x590cbe=_0x236e85;logger['info'](_0x1797('0x51'),_0x590cbe['id']);return getTicket(_0x20df30,_0x432580,_0x590cbe,_0x25532f,_0x4dbf52);})[_0x1797('0x1c')](function(_0x341ae2){if(_0x341ae2){logger[_0x1797('0xd')](_0x1797('0x52'),_0x341ae2['id']);}})[_0x1797('0x5e')](function(_0x351381){logger[_0x1797('0x5c')]('['+_0x4dbf52[_0x1797('0x68')][_0x1797('0x69')]()+']'+_0x1797('0x6a'),util[_0x1797('0x60')](_0x351381,{'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 863813d..ed73da3 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 _0xe53b=['/oauth/v2/token','clientId','clientSecret','refresh_token','error','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','then','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','Error:\x20','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subjects','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','zoho.eu','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','uniqueid','com','destcalleridnum','Outbound','The\x20User\x20ID\x20is:','calleridname','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe53b,0x1a4));var _0xbe53=function(_0x274ed4,_0x32494d){_0x274ed4=_0x274ed4-0x0;var _0x509cda=_0xe53b[_0x274ed4];return _0x509cda;};'use strict';var _=require(_0xbe53('0x0'));var rp=require(_0xbe53('0x1'));var md5=require(_0xbe53('0x2'));var util=require(_0xbe53('0x3'));var intUtil=require(_0xbe53('0x4'));var moment=require(_0xbe53('0x5'));var Redis=require('ioredis');var BPromise=require(_0xbe53('0x6'));var config=require(_0xbe53('0x7'));var logger=require(_0xbe53('0x8'))(_0xbe53('0x9'));config[_0xbe53('0xa')]=_['defaults'](config[_0xbe53('0xa')],{'host':_0xbe53('0xb'),'port':0x18eb});var io=require(_0xbe53('0xc'))(new Redis(config['redis']));function emit(_0x6c3ed3,_0xd209ba,_0x42cff7){io['to'](_0x6c3ed3)[_0xbe53('0xd')](_0xd209ba,_0x42cff7);}function request(_0x24b17b){logger[_0xbe53('0xe')](_0xbe53('0xf'),JSON[_0xbe53('0x10')](_0x24b17b));return rp(_0x24b17b);}function getCustomFields(_0x3200a0,_0x33b653){var _0x3c8199={};if(_0x3200a0['length']>0x0){_[_0xbe53('0x11')](_0x3200a0,function(_0x1c67f3){if(_[_0xbe53('0x12')]([_0xbe53('0x13'),_0xbe53('0x14')],_0x1c67f3[_0xbe53('0x15')])&&_0x1c67f3[_0xbe53('0x16')]){_0x3c8199[_0x1c67f3[_0xbe53('0x16')]]=_0x1c67f3[_0xbe53('0x17')]['toString']();}else if(_0x1c67f3['type']===_0xbe53('0x18')&&_0x1c67f3[_0xbe53('0x19')]&&_0x1c67f3[_0xbe53('0x16')]&&_0x33b653[_0x1c67f3[_0xbe53('0x19')]]){_0x3c8199[_0x1c67f3[_0xbe53('0x16')]]=_0x33b653[_0x1c67f3[_0xbe53('0x19')]][_0xbe53('0x1a')]();}else if(_0x1c67f3[_0xbe53('0x15')]===_0xbe53('0x1b')&&_0x1c67f3[_0xbe53('0x1c')]&&_0x1c67f3['Variable'][_0xbe53('0x1d')]&&_0x1c67f3[_0xbe53('0x16')]&&_0x33b653[_0x1c67f3['Variable']['name']['toLowerCase']()]){_0x3c8199[_0x1c67f3[_0xbe53('0x16')]]=_0x33b653[_0x1c67f3['Variable'][_0xbe53('0x1d')][_0xbe53('0x1e')]()][_0xbe53('0x1a')]();}});}return _0x3c8199;}function getName(_0x4969df){if(_0x4969df[_0xbe53('0x1f')]('\x20')>0x0){var _0x2b69b8=_0x4969df[_0xbe53('0x20')](/ (.+)/);if(_0x2b69b8[0x1]){return _0x2b69b8;}}return[_0x4969df,_0x4969df];}var accountsTokens={};function getAccessToken(_0x2f1969){return new Promise(function(_0x5e5ead,_0x2c4350){if(!_[_0xbe53('0x21')](accountsTokens[_0x2f1969['id']])&&!_[_0xbe53('0x21')](accountsTokens[_0x2f1969['id']][_0xbe53('0x22')])){if(moment()['isBefore'](accountsTokens[_0x2f1969['id']][_0xbe53('0x23')])){_0x5e5ead(accountsTokens[_0x2f1969['id']][_0xbe53('0x22')]);}}var _0x2c4787;switch(_0x2f1969['zone']){case'US':_0x2c4787=_0xbe53('0x24');break;case'AU':_0x2c4787=_0xbe53('0x25');break;case'EU':_0x2c4787='https://accounts.zoho.eu';break;case'IN':_0x2c4787=_0xbe53('0x26');break;case'CN':_0x2c4787=_0xbe53('0x27');break;default:_0x2c4787=_0xbe53('0x28');break;}var _0x125560={'method':_0xbe53('0x29'),'uri':_0x2c4787+_0xbe53('0x2a'),'qs':{'refresh_token':_0x2f1969['refreshToken'],'client_id':_0x2f1969[_0xbe53('0x2b')],'client_secret':_0x2f1969[_0xbe53('0x2c')],'grant_type':_0xbe53('0x2d')},'json':!![]};return rp(_0x125560)['then'](function(_0x833819){accountsTokens[_0x2f1969['id']]={'access_token':_0x833819[_0xbe53('0x22')],'expires_in':moment()['add'](_0x833819[_0xbe53('0x23')],'seconds')};_0x5e5ead(_0x833819[_0xbe53('0x22')]);})['catch'](function(_0x546258){logger[_0xbe53('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x546258[_0xbe53('0x2f')]);_0x2c4350(_0x546258);});});}function getUser(_0x5b229d,_0x2926ac,_0x58149f,_0x420edd){logger[_0xbe53('0x30')]('Search\x20user');return request({'method':_0xbe53('0x31'),'uri':util[_0xbe53('0x32')](_0xbe53('0x33'),_0x2926ac),'qs':{'type':_0xbe53('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5b229d},'json':!![]})['then'](function(_0x3e6f4e){if(_0x3e6f4e['users']){var _0x185087=-0x1;if(_[_0xbe53('0x35')](_0x3e6f4e[_0xbe53('0x36')])){if(!_[_0xbe53('0x21')](_0x420edd)){_0x185087=_[_0xbe53('0x37')](_0x3e6f4e['users'],function(_0x3df179){return _0x3df179[_0xbe53('0x38')]===_0x420edd;});}if(_0x185087>=0x0){logger[_0xbe53('0x30')]('Agent\x20found!');}else{logger[_0xbe53('0x30')](_0xbe53('0x39'));_0x185087=_[_0xbe53('0x37')](_0x3e6f4e['users'],function(_0x5a0ad7){return _0x5a0ad7[_0xbe53('0x3a')][_0xbe53('0x1d')]==='Administrator';});}return _0x3e6f4e[_0xbe53('0x36')][_0x185087];}else{if(_0x3e6f4e[_0xbe53('0x3b')][_0xbe53('0x3a')]['name']==='Administrator'){logger['info'](_0xbe53('0x39'));user=_0x3e6f4e[_0xbe53('0x3b')];return user;}else{logger[_0xbe53('0x2e')](_0xbe53('0x3c'),JSON[_0xbe53('0x10')](_0x3e6f4e));throw new Error(_0xbe53('0x3d')+JSON[_0xbe53('0x10')](_0x3e6f4e));}}}else{logger[_0xbe53('0x2e')]('The\x20failing\x20result\x20is',JSON[_0xbe53('0x10')](_0x3e6f4e));throw new Error(_0xbe53('0x3d')+JSON[_0xbe53('0x10')](_0x3e6f4e));}})[_0xbe53('0x3e')](function(_0x4fa102){console[_0xbe53('0x2e')](_0x4fa102);});}function getZohoUser(_0x3b9615,_0x5b38d7){return new BPromise(function(_0x4b49f5,_0x398c1f){request(_0x3b9615)[_0xbe53('0x3f')](function(_0x263a40){var _0x47edf0=null;if(_0x263a40){_0x47edf0=_0x263a40[_0xbe53('0x40')][0x0];_0x47edf0[_0xbe53('0x41')]=_0x5b38d7;}_0x4b49f5(_0x47edf0);})[_0xbe53('0x3e')](function(_0x4c7949){_0x398c1f(_0x4c7949);});});}function createEndUser(_0x5339d5,_0x35738c,_0x2f3df7,_0x24197c,_0x47da0b,_0x319320){var _0x2f3df7=getName(_0x2f3df7);return request({'method':_0xbe53('0x29'),'uri':_0xbe53('0x42')+_0x35738c+'/crm/v2/'+_[_0xbe53('0x43')](_0x319320[_0xbe53('0x44')])+'s','body':{'data':[{'Last_Name':_0x2f3df7[0x1],'First_Name':_0x2f3df7[0x0],'Phone':_0x24197c,'Owner':{'name':!_[_0xbe53('0x21')](_0x47da0b[_0xbe53('0x45')][_0xbe53('0x1d')])?_0x47da0b[_0xbe53('0x45')][_0xbe53('0x1d')]:!_[_0xbe53('0x21')](_0x47da0b[_0xbe53('0x46')])?_0x47da0b['first_name']+'\x20'+_0x47da0b['last_name']:_0x47da0b[_0xbe53('0x47')],'id':_0x47da0b['id']}}]},'headers':{'Authorization':_0xbe53('0x48')+_0x5339d5},'json':!![]})[_0xbe53('0x3f')](function(_0x374a79){if(_0x374a79&&_0x374a79[_0xbe53('0x40')][0x0][_0xbe53('0x49')]===_0xbe53('0x4a')){var _0x3d23ba=_0x374a79['data'][0x0]['details'];_0x3d23ba[_0xbe53('0x41')]=_[_0xbe53('0x43')](_0x319320[_0xbe53('0x44')])+'s';return _0x3d23ba;}logger['error'](_0xbe53('0x3c'),JSON[_0xbe53('0x10')](data));throw new Error(_0xbe53('0x4b')+JSON[_0xbe53('0x10')](data));})[_0xbe53('0x3e')](function(_0x2156e2){console[_0xbe53('0x4c')](_0xbe53('0x4d'),_0x2156e2);});}function getEndUser(_0x247773,_0x35fb95,_0x3a8687,_0x359254,_0x4baacc,_0x2316d9,_0xb3f47a){var _0x5247db={'method':'GET','uri':'','headers':{'Authorization':_0xbe53('0x48')+_0x247773},'json':!![]};switch(_0xb3f47a['moduleSearch']){case'contact_lead':_0x5247db[_0xbe53('0x4e')]=_0xbe53('0x42')+_0x35fb95+_0xbe53('0x4f')+_0x4baacc+'))';return getZohoUser(_0x5247db,_0xbe53('0x50'))[_0xbe53('0x3f')](function(_0x589cc3){if(_0x589cc3)return _0x589cc3;_0x5247db['uri']=_0xbe53('0x42')+_0x35fb95+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4baacc+'))';return getZohoUser(_0x5247db,_0xbe53('0x51'))[_0xbe53('0x3f')](function(_0x2ba8dc){if(_0x2ba8dc)return _0x2ba8dc;if(_0xb3f47a[_0xbe53('0x44')]!=_0xbe53('0x52')){return createEndUser(_0x247773,_0x35fb95,_0x359254,_0x4baacc,_0x2316d9,_0xb3f47a);}else{return{};}});});break;case _0xbe53('0x53'):_0x5247db[_0xbe53('0x4e')]=_0xbe53('0x42')+_0x35fb95+_0xbe53('0x4f')+_0x4baacc+'))';return getZohoUser(_0x5247db,_0xbe53('0x50'))[_0xbe53('0x3f')](function(_0x1fc52f){if(_0x1fc52f)return _0x1fc52f;if(_0xb3f47a[_0xbe53('0x44')]!=_0xbe53('0x52')){return createEndUser(_0x247773,_0x35fb95,_0x359254,_0x4baacc,_0x2316d9,_0xb3f47a);}else{return{};}});break;case'lead':_0x5247db[_0xbe53('0x4e')]=_0xbe53('0x42')+_0x35fb95+_0xbe53('0x54')+_0x4baacc+'))';return getZohoUser(_0x5247db,'Leads')['then'](function(_0x5a7836){if(_0x5a7836)return _0x5a7836;if(_0xb3f47a[_0xbe53('0x44')]!='nothing'){return createEndUser(_0x247773,_0x35fb95,_0x359254,_0x4baacc,_0x2316d9,_0xb3f47a);}else{return{};}});break;}}function getCall(_0x37590b,_0x4e4060,_0x30e20f,_0x1c6d65,_0x10935d,_0x24e2c2,_0x1be150,_0x2fa200){logger[_0xbe53('0x30')](_0xbe53('0x55'));var _0x34eee8={};_0x34eee8['Owner']={'name':!_[_0xbe53('0x21')](_0x1c6d65[_0xbe53('0x45')]['name'])&&!_['isNil'](_0x1c6d65['profile']['name'])&&_0x1c6d65['profile'][_0xbe53('0x1d')]===_0xbe53('0x56')?_0x1c6d65['role'][_0xbe53('0x1d')]:!_[_0xbe53('0x21')](_0x1c6d65[_0xbe53('0x46')])?_0x1c6d65[_0xbe53('0x46')]+'\x20'+_0x1c6d65[_0xbe53('0x47')]:_0x1c6d65[_0xbe53('0x47')],'id':_0x1c6d65['id']};_0x34eee8['Subject']=intUtil['getString'](_0x24e2c2[_0xbe53('0x57')],_0x1be150,'\x20');_0x34eee8[_0xbe53('0x58')]=intUtil[_0xbe53('0x59')](_0x24e2c2['Descriptions'],_0x1be150,'\x0a');if(_0x10935d['enduserType']===_0xbe53('0x50')){_0x34eee8[_0xbe53('0x5a')]={'name':!_[_0xbe53('0x21')](_0x10935d[_0xbe53('0x5b')])?_0x10935d[_0xbe53('0x5b')]:!_[_0xbe53('0x21')](_0x10935d['First_Name'])?_0x10935d[_0xbe53('0x5c')]+'\x20'+_0x10935d['Last_Name']:_0x10935d[_0xbe53('0x5d')],'id':_0x10935d['id']};}if(_0x10935d[_0xbe53('0x41')]===_0xbe53('0x51')){_0x34eee8[_0xbe53('0x5e')]={'name':!_[_0xbe53('0x21')](_0x10935d[_0xbe53('0x5b')])?_0x10935d['Full_Name']:!_[_0xbe53('0x21')](_0x10935d[_0xbe53('0x5c')])?_0x10935d[_0xbe53('0x5c')]+'\x20'+_0x10935d[_0xbe53('0x5d')]:_0x10935d[_0xbe53('0x5d')],'id':_0x10935d['id']};_0x34eee8['$se_module']=_['startCase'](_0x10935d[_0xbe53('0x41')]);}if(_0x1be150['talktime']){_0x34eee8[_0xbe53('0x5f')]=moment[_0xbe53('0x60')](parseInt(_0x1be150[_0xbe53('0x61')])*0x3e8)['format'](_0xbe53('0x62'));}else if(_0x1be150[_0xbe53('0x63')]&&_0x1be150[_0xbe53('0x64')]){_0x34eee8[_0xbe53('0x5f')]=moment[_0xbe53('0x60')](moment(_0x1be150[_0xbe53('0x64')],_0xbe53('0x65'))[_0xbe53('0x66')](moment(_0x1be150[_0xbe53('0x67')],_0xbe53('0x65'))))[_0xbe53('0x32')](_0xbe53('0x62'));}switch(_0x1be150[_0xbe53('0x68')]){case _0xbe53('0x69'):_0x34eee8[_0xbe53('0x6a')]=_0xbe53('0x6b');break;case _0xbe53('0x6c'):case _0xbe53('0x6d'):_0x34eee8['Call_Result']=_0xbe53('0x6e');break;case _0xbe53('0x6f'):_0x34eee8[_0xbe53('0x6a')]=_0xbe53('0x70');break;case _0xbe53('0x71'):_0x34eee8[_0xbe53('0x6a')]=_0xbe53('0x72');break;case _0xbe53('0x73'):_0x34eee8[_0xbe53('0x6a')]=_0xbe53('0x74');default:}_0x34eee8[_0xbe53('0x75')]=(_0x2fa200===_0xbe53('0x76')?moment(_0x1be150['starttime'])[_0xbe53('0x32')](_0xbe53('0x65')):moment(_0x1be150['agentcalledAt'])[_0xbe53('0x32')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xbe53('0x32')](_0xbe53('0x65'));_0x34eee8[_0xbe53('0x77')]=_0x2fa200||_0xbe53('0x78');_0x34eee8=_[_0xbe53('0x79')](_0x34eee8,getCustomFields(_0x24e2c2[_0xbe53('0x7a')],_0x1be150));return request({'method':_0xbe53('0x29'),'uri':_0xbe53('0x42')+_0x4e4060+_0xbe53('0x7b'),'headers':{'Authorization':_0xbe53('0x48')+_0x37590b},'body':{'data':[_0x34eee8]},'json':!![]})[_0xbe53('0x3f')](function(_0x3271eb){if(_0x3271eb&&_0x3271eb['data'][0x0]['code']===_0xbe53('0x4a')){logger[_0xbe53('0x30')]('Call\x20created!');return{'id':_0x3271eb['data'][0x0][_0xbe53('0x7c')]['id']};}})['catch'](function(_0x15b2b8){logger[_0xbe53('0x30')](_0xbe53('0x7d'),_0x15b2b8['stack']);console[_0xbe53('0x4c')]('err',_0x15b2b8);});}exports[_0xbe53('0x7e')]=function(_0x253d36,_0x43efcc,_0x2ecd55,_0x3ed66b,_0x13888f,_0x281d50){var _0x49f841,_0x2994b2,_0x4eab77;_0x281d50[_0xbe53('0x7f')]=intUtil[_0xbe53('0x80')](_0x281d50['host']);_0x281d50[_0xbe53('0x81')]=intUtil[_0xbe53('0x80')](_0x281d50[_0xbe53('0x81')]);if(_0x13888f&&_0x13888f[_0xbe53('0x82')]){logger[_0xbe53('0x30')]('[QUEUE]',_0xbe53('0x83'));_0x43efcc[_0xbe53('0x84')]=_0x281d50[_0xbe53('0x81')]+_0xbe53('0x85')+_0x43efcc['uniqueid']+_0xbe53('0x86')+md5(_0x43efcc['uniqueid']);}else{_0x43efcc['recordingURL']='';}var _0x3accdc=_0x281d50[_0xbe53('0x7f')]===_0xbe53('0x87')?'eu':'com';return getAccessToken(_0x281d50)[_0xbe53('0x3f')](function(_0x2c5e52){_0x4eab77=_0x2c5e52;return getUser(_0x4eab77,_0x3accdc,_0x281d50,_0x3ed66b[_0xbe53('0x38')]);})[_0xbe53('0x3f')](function(_0x56d637){_0x49f841=_0x56d637;logger['info']('The\x20User\x20ID\x20is:',_0x49f841['id']);return getEndUser(_0x4eab77,_0x3accdc,_0x281d50,_0x43efcc['calleridname'],_0x43efcc[_0xbe53('0x88')],_0x49f841,_0x2ecd55);})[_0xbe53('0x3f')](function(_0x1aa813){_0x2994b2=_0x1aa813;return getCall(_0x4eab77,_0x3accdc,_0x281d50,_0x49f841,_0x2994b2,_0x2ecd55,_0x43efcc,'Inbound');})[_0xbe53('0x3f')](function(_0x5f1e8d){if(_0x5f1e8d){logger[_0xbe53('0x30')](_0xbe53('0x89'),_0x5f1e8d['id']);logger[_0xbe53('0x30')](_0xbe53('0x8a'),_0xbe53('0x8b'));emit(util[_0xbe53('0x32')](_0xbe53('0x8c'),_0x3ed66b[_0xbe53('0x1d')]),_0xbe53('0x8d'),{'uri':_0xbe53('0x8e')+_0x281d50[_0xbe53('0x7f')]+_0xbe53('0x8f')+_0x5f1e8d['id']});}})[_0xbe53('0x3e')](function(_0x25684a){logger[_0xbe53('0x2e')]('[QUEUE]',JSON[_0xbe53('0x10')](_0x25684a));});};exports['outbound']=function(_0x186a58,_0x4a8f62,_0x2bba24,_0x12f4e6,_0x533cb5,_0x253574,_0x5833ea){var _0x33e231,_0xa5b39a,_0x40cc40;_0x253574[_0xbe53('0x7f')]=intUtil[_0xbe53('0x80')](_0x253574[_0xbe53('0x7f')]);_0x253574['serverUrl']=intUtil['stripTrailingSlash'](_0x253574[_0xbe53('0x81')]);if(_0x5833ea&&_0x5833ea[_0xbe53('0x90')]&&_0x5833ea[_0xbe53('0x90')]!==_0xbe53('0x91')){logger[_0xbe53('0x30')](_0xbe53('0x92'),'Recording\x20is\x20enabled!');_0x4a8f62[_0xbe53('0x84')]=_0x253574[_0xbe53('0x81')]+'/api/voice/recordings/'+_0x4a8f62[_0xbe53('0x93')]+_0xbe53('0x86')+md5(_0x4a8f62[_0xbe53('0x93')]);}var _0x4b1830=_0x253574[_0xbe53('0x7f')]==='zoho.eu'?'eu':_0xbe53('0x94');return getAccessToken(_0x253574)[_0xbe53('0x3f')](function(_0x5997f0){_0x40cc40=_0x5997f0;return getUser(_0x40cc40,_0x4b1830,_0x253574,_0x12f4e6[_0xbe53('0x38')]);})[_0xbe53('0x3f')](function(_0x4cdd23){_0x33e231=_0x4cdd23;logger[_0xbe53('0x30')]('The\x20User\x20ID\x20is:',_0x33e231['id']);return getEndUser(_0x40cc40,_0x4b1830,_0x253574,_0x4a8f62['destcalleridname'],_0x4a8f62[_0xbe53('0x95')],_0x33e231,_0x2bba24);})[_0xbe53('0x3f')](function(_0xa487c3){_0xa5b39a=_0xa487c3;return getCall(_0x40cc40,_0x4b1830,_0x253574,_0x33e231,_0xa5b39a,_0x2bba24,_0x4a8f62,_0xbe53('0x96'));})['then'](function(_0x25d22b){if(_0x25d22b){logger[_0xbe53('0x30')](_0xbe53('0x89'),_0x25d22b['id']);logger[_0xbe53('0x30')](_0xbe53('0x92'),_0xbe53('0x8b'));emit(util[_0xbe53('0x32')](_0xbe53('0x8c'),_0x12f4e6[_0xbe53('0x1d')]),_0xbe53('0x8d'),{'uri':'https://crm.'+_0x253574[_0xbe53('0x7f')]+_0xbe53('0x8f')+_0x25d22b['id']});}})[_0xbe53('0x3e')](function(_0x2ff880){logger[_0xbe53('0x2e')]('[OUTBOUND]',JSON[_0xbe53('0x10')](_0x2ff880));});};exports['unmanaged']=function(_0x1c0c4e,_0x55e215,_0x5780de,_0x4cf0a6,_0x5b1894,_0x1b9ff1){var _0x30e06e,_0x582010,_0x3c2f51;_0x1b9ff1[_0xbe53('0x7f')]=intUtil[_0xbe53('0x80')](_0x1b9ff1['host']);_0x1b9ff1[_0xbe53('0x81')]=intUtil[_0xbe53('0x80')](_0x1b9ff1[_0xbe53('0x81')]);if(_0x5b1894&&_0x5b1894[_0xbe53('0x82')]){logger[_0xbe53('0x30')]('['+_0x55e215[_0xbe53('0x68')]['toUpperCase']()+']',_0xbe53('0x83'));_0x55e215[_0xbe53('0x84')]=_0x1b9ff1[_0xbe53('0x81')]+_0xbe53('0x85')+_0x55e215[_0xbe53('0x93')]+_0xbe53('0x86')+md5(_0x55e215[_0xbe53('0x93')]);}else{_0x55e215[_0xbe53('0x84')]='';}var _0x566c69=_0x1b9ff1[_0xbe53('0x7f')]===_0xbe53('0x87')?'eu':_0xbe53('0x94');return getAccessToken(_0x1b9ff1)[_0xbe53('0x3f')](function(_0x4f005e){_0x3c2f51=_0x4f005e;return getUser(_0x3c2f51,_0x566c69,_0x1b9ff1);})[_0xbe53('0x3f')](function(_0x4b8421){_0x30e06e=_0x4b8421;logger['info'](_0xbe53('0x97'),_0x30e06e['id']);return getEndUser(_0x3c2f51,_0x566c69,_0x1b9ff1,_0x55e215[_0xbe53('0x98')],_0x55e215[_0xbe53('0x88')],_0x30e06e,_0x5780de);})[_0xbe53('0x3f')](function(_0x555acc){_0x582010=_0x555acc;return getCall(_0x3c2f51,_0x566c69,_0x1b9ff1,_0x30e06e,_0x582010,_0x5780de,_0x55e215,_0xbe53('0x78'));})[_0xbe53('0x3f')](function(_0x50388b){if(_0x50388b){logger[_0xbe53('0x30')](_0xbe53('0x89'),_0x50388b['id']);}})['catch'](function(_0x4656d1){logger[_0xbe53('0x2e')]('['+_0x55e215['lastevent'][_0xbe53('0x99')]()+']',JSON[_0xbe53('0x10')](_0x4656d1));});}; \ No newline at end of file +var _0x1dd5=['zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','info','profile','Administrator','Using\x20the\x20admin\x20account!','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','role','first_name','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','moduleCreate','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','com','toUpperCase','lodash','request-promise','md5','./util','ioredis','zoho','redis','defaults','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in'];(function(_0x3083a0,_0x44a49b){var _0x131c67=function(_0x736c02){while(--_0x736c02){_0x3083a0['push'](_0x3083a0['shift']());}};_0x131c67(++_0x44a49b);}(_0x1dd5,0x1bc));var _0x51dd=function(_0x4ed638,_0x3980f6){_0x4ed638=_0x4ed638-0x0;var _0x1cdfec=_0x1dd5[_0x4ed638];return _0x1cdfec;};'use strict';var _=require(_0x51dd('0x0'));var rp=require(_0x51dd('0x1'));var md5=require(_0x51dd('0x2'));var util=require('util');var intUtil=require(_0x51dd('0x3'));var moment=require('moment');var Redis=require(_0x51dd('0x4'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x51dd('0x5'));config[_0x51dd('0x6')]=_[_0x51dd('0x7')](config[_0x51dd('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x51dd('0x8'))(new Redis(config[_0x51dd('0x6')]));function emit(_0x31d23b,_0x4081f5,_0x251d5b){io['to'](_0x31d23b)[_0x51dd('0x9')](_0x4081f5,_0x251d5b);}function request(_0x11c1e8){logger['debug'](_0x51dd('0xa'),JSON[_0x51dd('0xb')](_0x11c1e8));return rp(_0x11c1e8);}function getCustomFields(_0x465fd1,_0xdc2160){var _0x46fd66={};if(_0x465fd1[_0x51dd('0xc')]>0x0){_[_0x51dd('0xd')](_0x465fd1,function(_0xf53608){if(_[_0x51dd('0xe')]([_0x51dd('0xf'),_0x51dd('0x10')],_0xf53608[_0x51dd('0x11')])&&_0xf53608[_0x51dd('0x12')]){_0x46fd66[_0xf53608['idField']]=_0xf53608[_0x51dd('0x13')]['toString']();}else if(_0xf53608['type']===_0x51dd('0x14')&&_0xf53608[_0x51dd('0x15')]&&_0xf53608[_0x51dd('0x12')]&&_0xdc2160[_0xf53608[_0x51dd('0x15')]]){_0x46fd66[_0xf53608[_0x51dd('0x12')]]=_0xdc2160[_0xf53608[_0x51dd('0x15')]][_0x51dd('0x16')]();}else if(_0xf53608[_0x51dd('0x11')]===_0x51dd('0x17')&&_0xf53608[_0x51dd('0x18')]&&_0xf53608[_0x51dd('0x18')][_0x51dd('0x19')]&&_0xf53608[_0x51dd('0x12')]&&_0xdc2160[_0xf53608[_0x51dd('0x18')][_0x51dd('0x19')][_0x51dd('0x1a')]()]){_0x46fd66[_0xf53608[_0x51dd('0x12')]]=_0xdc2160[_0xf53608['Variable']['name'][_0x51dd('0x1a')]()][_0x51dd('0x16')]();}});}return _0x46fd66;}function getName(_0x2f5fd7){if(_0x2f5fd7[_0x51dd('0x1b')]('\x20')>0x0){var _0x2e2795=_0x2f5fd7[_0x51dd('0x1c')](/ (.+)/);if(_0x2e2795[0x1]){return _0x2e2795;}}return[_0x2f5fd7,_0x2f5fd7];}var accountsTokens={};function getAccessToken(_0x17fb0a){return new Promise(function(_0x5a89c8,_0x5010dc){if(!_[_0x51dd('0x1d')](accountsTokens[_0x17fb0a['id']])&&!_[_0x51dd('0x1d')](accountsTokens[_0x17fb0a['id']][_0x51dd('0x1e')])){if(moment()[_0x51dd('0x1f')](accountsTokens[_0x17fb0a['id']][_0x51dd('0x20')])){_0x5a89c8(accountsTokens[_0x17fb0a['id']]['access_token']);}}var _0x49199a;switch(_0x17fb0a[_0x51dd('0x21')]){case'US':_0x49199a=_0x51dd('0x22');break;case'AU':_0x49199a='https://accounts.zoho.com.au';break;case'EU':_0x49199a=_0x51dd('0x23');break;case'IN':_0x49199a='https://accounts.zoho.in';break;case'CN':_0x49199a=_0x51dd('0x24');break;default:_0x49199a=_0x51dd('0x23');break;}var _0x39a783={'method':_0x51dd('0x25'),'uri':_0x49199a+_0x51dd('0x26'),'qs':{'refresh_token':_0x17fb0a['refreshToken'],'client_id':_0x17fb0a[_0x51dd('0x27')],'client_secret':_0x17fb0a[_0x51dd('0x28')],'grant_type':_0x51dd('0x29')},'json':!![]};return rp(_0x39a783)[_0x51dd('0x2a')](function(_0x14ad1e){accountsTokens[_0x17fb0a['id']]={'access_token':_0x14ad1e[_0x51dd('0x1e')],'expires_in':moment()[_0x51dd('0x2b')](_0x14ad1e['expires_in'],_0x51dd('0x2c'))};_0x5a89c8(_0x14ad1e['access_token']);})[_0x51dd('0x2d')](function(_0x4f95ae){logger['error'](_0x51dd('0x2e'),_0x4f95ae[_0x51dd('0x2f')]);_0x5010dc(_0x4f95ae);});});}function getUser(_0x4fc260,_0xc93808,_0x49961e,_0x3b24e2){logger['info']('Search\x20user');return request({'method':_0x51dd('0x30'),'uri':util[_0x51dd('0x31')](_0x51dd('0x32'),_0xc93808),'qs':{'type':_0x51dd('0x33')},'headers':{'Authorization':_0x51dd('0x34')+_0x4fc260},'json':!![]})['then'](function(_0x422b68){if(_0x422b68[_0x51dd('0x35')]){var _0x4e4e4a=-0x1;if(_['isArrayLikeObject'](_0x422b68[_0x51dd('0x35')])){if(!_[_0x51dd('0x1d')](_0x3b24e2)){_0x4e4e4a=_[_0x51dd('0x36')](_0x422b68[_0x51dd('0x35')],function(_0x2b43d5){return _0x2b43d5[_0x51dd('0x37')]===_0x3b24e2;});}if(_0x4e4e4a>=0x0){logger['info'](_0x51dd('0x38'));}else{logger[_0x51dd('0x39')]('Using\x20the\x20admin\x20account!');_0x4e4e4a=_['findIndex'](_0x422b68['users'],function(_0xb54255){return _0xb54255[_0x51dd('0x3a')]['name']===_0x51dd('0x3b');});}return _0x422b68['users'][_0x4e4e4a];}else{if(_0x422b68['user']['profile']['name']==='Administrator'){logger[_0x51dd('0x39')](_0x51dd('0x3c'));user=_0x422b68[_0x51dd('0x3d')];return user;}else{logger[_0x51dd('0x3e')](_0x51dd('0x3f'),JSON[_0x51dd('0xb')](_0x422b68));throw new Error(_0x51dd('0x40')+JSON[_0x51dd('0xb')](_0x422b68));}}}else{logger[_0x51dd('0x3e')](_0x51dd('0x3f'),JSON[_0x51dd('0xb')](_0x422b68));throw new Error(_0x51dd('0x40')+JSON[_0x51dd('0xb')](_0x422b68));}})[_0x51dd('0x2d')](function(_0xcf223a){console['error'](_0xcf223a);});}function getZohoUser(_0x4de81a,_0x26f011){return new BPromise(function(_0x558007,_0x4e73a1){request(_0x4de81a)[_0x51dd('0x2a')](function(_0x1f7f2d){var _0x138cf6=null;if(_0x1f7f2d){_0x138cf6=_0x1f7f2d[_0x51dd('0x41')][0x0];_0x138cf6[_0x51dd('0x42')]=_0x26f011;}_0x558007(_0x138cf6);})[_0x51dd('0x2d')](function(_0xd824f1){_0x4e73a1(_0xd824f1);});});}function createEndUser(_0x588b12,_0x54f5ae,_0x5c077b,_0x4fae73,_0xd05a1b,_0x10e131){var _0x5c077b=getName(_0x5c077b);return request({'method':_0x51dd('0x25'),'uri':_0x51dd('0x43')+_0x54f5ae+'/crm/v2/'+_[_0x51dd('0x44')](_0x10e131['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5c077b[0x1],'First_Name':_0x5c077b[0x0],'Phone':_0x4fae73,'Owner':{'name':!_[_0x51dd('0x1d')](_0xd05a1b['role']['name'])?_0xd05a1b[_0x51dd('0x45')][_0x51dd('0x19')]:!_[_0x51dd('0x1d')](_0xd05a1b[_0x51dd('0x46')])?_0xd05a1b[_0x51dd('0x46')]+'\x20'+_0xd05a1b['last_name']:_0xd05a1b[_0x51dd('0x47')],'id':_0xd05a1b['id']}}]},'headers':{'Authorization':_0x51dd('0x34')+_0x588b12},'json':!![]})[_0x51dd('0x2a')](function(_0x3c030a){if(_0x3c030a&&_0x3c030a[_0x51dd('0x41')][0x0][_0x51dd('0x48')]===_0x51dd('0x49')){var _0x26653b=_0x3c030a['data'][0x0][_0x51dd('0x4a')];_0x26653b[_0x51dd('0x42')]=_[_0x51dd('0x44')](_0x10e131['moduleCreate'])+'s';return _0x26653b;}logger[_0x51dd('0x3e')](_0x51dd('0x3f'),JSON[_0x51dd('0xb')](data));throw new Error(_0x51dd('0x4b')+JSON['stringify'](data));})[_0x51dd('0x2d')](function(_0x316897){console['log'](_0x51dd('0x4c'),_0x316897);});}function getEndUser(_0x3ea34f,_0x2d9e09,_0x5b48bc,_0x35b7d2,_0x199af6,_0x3b2135,_0x5b0c26){var _0x3d85b6={'method':_0x51dd('0x30'),'uri':'','headers':{'Authorization':_0x51dd('0x34')+_0x3ea34f},'json':!![]};switch(_0x5b0c26[_0x51dd('0x4d')]){case'contact_lead':_0x3d85b6[_0x51dd('0x4e')]=_0x51dd('0x43')+_0x2d9e09+_0x51dd('0x4f')+_0x199af6+'))';return getZohoUser(_0x3d85b6,_0x51dd('0x50'))[_0x51dd('0x2a')](function(_0x3e3b29){if(_0x3e3b29)return _0x3e3b29;_0x3d85b6['uri']=_0x51dd('0x43')+_0x2d9e09+_0x51dd('0x51')+_0x199af6+'))';return getZohoUser(_0x3d85b6,_0x51dd('0x52'))[_0x51dd('0x2a')](function(_0x3a4633){if(_0x3a4633)return _0x3a4633;if(_0x5b0c26['moduleCreate']!=_0x51dd('0x53')){return createEndUser(_0x3ea34f,_0x2d9e09,_0x35b7d2,_0x199af6,_0x3b2135,_0x5b0c26);}else{return{};}});});break;case _0x51dd('0x54'):_0x3d85b6[_0x51dd('0x4e')]=_0x51dd('0x43')+_0x2d9e09+_0x51dd('0x4f')+_0x199af6+'))';return getZohoUser(_0x3d85b6,'Contacts')['then'](function(_0x464355){if(_0x464355)return _0x464355;if(_0x5b0c26[_0x51dd('0x55')]!=_0x51dd('0x53')){return createEndUser(_0x3ea34f,_0x2d9e09,_0x35b7d2,_0x199af6,_0x3b2135,_0x5b0c26);}else{return{};}});break;case _0x51dd('0x56'):_0x3d85b6[_0x51dd('0x4e')]='https://www.zohoapis.'+_0x2d9e09+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x199af6+'))';return getZohoUser(_0x3d85b6,_0x51dd('0x52'))[_0x51dd('0x2a')](function(_0x7f72b5){if(_0x7f72b5)return _0x7f72b5;if(_0x5b0c26[_0x51dd('0x55')]!=_0x51dd('0x53')){return createEndUser(_0x3ea34f,_0x2d9e09,_0x35b7d2,_0x199af6,_0x3b2135,_0x5b0c26);}else{return{};}});break;}}function getCall(_0x4eea7b,_0x5c8e6e,_0x12a346,_0x436953,_0x2ebd3b,_0x1681c7,_0xb44f58,_0x288fd5){logger[_0x51dd('0x39')](_0x51dd('0x57'));var _0x53911e={};_0x53911e[_0x51dd('0x58')]={'name':!_['isNil'](_0x436953[_0x51dd('0x45')][_0x51dd('0x19')])&&!_['isNil'](_0x436953[_0x51dd('0x3a')]['name'])&&_0x436953[_0x51dd('0x3a')][_0x51dd('0x19')]===_0x51dd('0x59')?_0x436953['role'][_0x51dd('0x19')]:!_[_0x51dd('0x1d')](_0x436953[_0x51dd('0x46')])?_0x436953[_0x51dd('0x46')]+'\x20'+_0x436953[_0x51dd('0x47')]:_0x436953[_0x51dd('0x47')],'id':_0x436953['id']};_0x53911e[_0x51dd('0x5a')]=intUtil[_0x51dd('0x5b')](_0x1681c7[_0x51dd('0x5c')],_0xb44f58,'\x20');_0x53911e[_0x51dd('0x5d')]=intUtil[_0x51dd('0x5b')](_0x1681c7[_0x51dd('0x5e')],_0xb44f58,'\x0a');if(_0x2ebd3b[_0x51dd('0x42')]==='Contacts'){_0x53911e[_0x51dd('0x5f')]={'name':!_[_0x51dd('0x1d')](_0x2ebd3b[_0x51dd('0x60')])?_0x2ebd3b['Full_Name']:!_[_0x51dd('0x1d')](_0x2ebd3b['First_Name'])?_0x2ebd3b[_0x51dd('0x61')]+'\x20'+_0x2ebd3b['Last_Name']:_0x2ebd3b[_0x51dd('0x62')],'id':_0x2ebd3b['id']};}if(_0x2ebd3b[_0x51dd('0x42')]===_0x51dd('0x52')){_0x53911e[_0x51dd('0x63')]={'name':!_[_0x51dd('0x1d')](_0x2ebd3b[_0x51dd('0x60')])?_0x2ebd3b[_0x51dd('0x60')]:!_[_0x51dd('0x1d')](_0x2ebd3b[_0x51dd('0x61')])?_0x2ebd3b['First_Name']+'\x20'+_0x2ebd3b[_0x51dd('0x62')]:_0x2ebd3b[_0x51dd('0x62')],'id':_0x2ebd3b['id']};_0x53911e[_0x51dd('0x64')]=_[_0x51dd('0x44')](_0x2ebd3b['enduserType']);}if(_0xb44f58[_0x51dd('0x65')]){_0x53911e[_0x51dd('0x66')]=moment[_0x51dd('0x67')](parseInt(_0xb44f58[_0x51dd('0x65')])*0x3e8)[_0x51dd('0x31')]('mm:ss');}else if(_0xb44f58[_0x51dd('0x68')]&&_0xb44f58[_0x51dd('0x69')]){_0x53911e[_0x51dd('0x66')]=moment['utc'](moment(_0xb44f58[_0x51dd('0x69')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0xb44f58['starttime'],_0x51dd('0x6a'))))[_0x51dd('0x31')](_0x51dd('0x6b'));}switch(_0xb44f58[_0x51dd('0x6c')]){case _0x51dd('0x6d'):_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x6f');break;case _0x51dd('0x70'):case _0x51dd('0x71'):_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x72');break;case _0x51dd('0x73'):_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x74');break;case'abandoned':_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x75');break;case'timeout':_0x53911e[_0x51dd('0x6e')]=_0x51dd('0x76');default:}_0x53911e[_0x51dd('0x77')]=(_0x288fd5===_0x51dd('0x78')?moment(_0xb44f58[_0x51dd('0x79')])[_0x51dd('0x31')](_0x51dd('0x6a')):moment(_0xb44f58[_0x51dd('0x7a')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x51dd('0x31')](_0x51dd('0x6a'));_0x53911e[_0x51dd('0x7b')]=_0x288fd5||_0x51dd('0x7c');_0x53911e=_['merge'](_0x53911e,getCustomFields(_0x1681c7[_0x51dd('0x7d')],_0xb44f58));return request({'method':_0x51dd('0x25'),'uri':_0x51dd('0x43')+_0x5c8e6e+_0x51dd('0x7e'),'headers':{'Authorization':_0x51dd('0x34')+_0x4eea7b},'body':{'data':[_0x53911e]},'json':!![]})[_0x51dd('0x2a')](function(_0x14b01e){if(_0x14b01e&&_0x14b01e[_0x51dd('0x41')][0x0][_0x51dd('0x48')]===_0x51dd('0x49')){logger[_0x51dd('0x39')](_0x51dd('0x7f'));return{'id':_0x14b01e['data'][0x0][_0x51dd('0x4a')]['id']};}})[_0x51dd('0x2d')](function(_0x709c6e){logger[_0x51dd('0x39')](_0x51dd('0x80'),_0x709c6e['stack']);console[_0x51dd('0x81')]('err',_0x709c6e);});}exports[_0x51dd('0x82')]=function(_0x1a7aa2,_0x15bbd2,_0x145b2b,_0x458ccd,_0x5786f8,_0x12e761){var _0x4d4b79,_0x67e277,_0x38f21b;_0x12e761[_0x51dd('0x83')]=intUtil['stripTrailingSlash'](_0x12e761[_0x51dd('0x83')]);_0x12e761['serverUrl']=intUtil['stripTrailingSlash'](_0x12e761[_0x51dd('0x84')]);if(_0x5786f8&&_0x5786f8[_0x51dd('0x85')]){logger[_0x51dd('0x39')](_0x51dd('0x86'),_0x51dd('0x87'));_0x15bbd2[_0x51dd('0x88')]=_0x12e761[_0x51dd('0x84')]+_0x51dd('0x89')+_0x15bbd2['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x15bbd2[_0x51dd('0x8a')]);}else{_0x15bbd2[_0x51dd('0x88')]='';}var _0x48ca6c=_0x12e761[_0x51dd('0x83')]===_0x51dd('0x8b')?'eu':'com';return getAccessToken(_0x12e761)['then'](function(_0x33ffcc){_0x38f21b=_0x33ffcc;return getUser(_0x38f21b,_0x48ca6c,_0x12e761,_0x458ccd[_0x51dd('0x37')]);})['then'](function(_0x4e71b7){_0x4d4b79=_0x4e71b7;logger[_0x51dd('0x39')](_0x51dd('0x8c'),_0x4d4b79['id']);return getEndUser(_0x38f21b,_0x48ca6c,_0x12e761,_0x15bbd2[_0x51dd('0x8d')],_0x15bbd2[_0x51dd('0x8e')],_0x4d4b79,_0x145b2b);})['then'](function(_0x3b2172){_0x67e277=_0x3b2172;return getCall(_0x38f21b,_0x48ca6c,_0x12e761,_0x4d4b79,_0x67e277,_0x145b2b,_0x15bbd2,'Inbound');})[_0x51dd('0x2a')](function(_0x443e94){if(_0x443e94){logger[_0x51dd('0x39')]('The\x20Call\x20ID\x20is:',_0x443e94['id']);logger[_0x51dd('0x39')](_0x51dd('0x86'),_0x51dd('0x8f'));emit(util[_0x51dd('0x31')](_0x51dd('0x90'),_0x458ccd['name']),'trigger:browser:url',{'uri':_0x51dd('0x91')+_0x12e761[_0x51dd('0x83')]+_0x51dd('0x92')+_0x443e94['id']});}})['catch'](function(_0x55e080){logger['error'](_0x51dd('0x86'),JSON[_0x51dd('0xb')](_0x55e080));});};exports[_0x51dd('0x78')]=function(_0x515870,_0x459171,_0xb0573f,_0x10bc66,_0x5efeed,_0x4f455a,_0x4ae772){var _0x43b900,_0x32ece9,_0x8e83f9;_0x4f455a['host']=intUtil['stripTrailingSlash'](_0x4f455a[_0x51dd('0x83')]);_0x4f455a['serverUrl']=intUtil[_0x51dd('0x93')](_0x4f455a['serverUrl']);if(_0x4ae772&&_0x4ae772[_0x51dd('0x94')]&&_0x4ae772[_0x51dd('0x94')]!==_0x51dd('0x95')){logger['info'](_0x51dd('0x96'),_0x51dd('0x87'));_0x459171[_0x51dd('0x88')]=_0x4f455a[_0x51dd('0x84')]+_0x51dd('0x89')+_0x459171[_0x51dd('0x8a')]+_0x51dd('0x97')+md5(_0x459171['uniqueid']);}var _0x35bab9=_0x4f455a[_0x51dd('0x83')]===_0x51dd('0x8b')?'eu':'com';return getAccessToken(_0x4f455a)[_0x51dd('0x2a')](function(_0x158b50){_0x8e83f9=_0x158b50;return getUser(_0x8e83f9,_0x35bab9,_0x4f455a,_0x10bc66[_0x51dd('0x37')]);})[_0x51dd('0x2a')](function(_0x1c75d9){_0x43b900=_0x1c75d9;logger[_0x51dd('0x39')](_0x51dd('0x8c'),_0x43b900['id']);return getEndUser(_0x8e83f9,_0x35bab9,_0x4f455a,_0x459171[_0x51dd('0x98')],_0x459171[_0x51dd('0x99')],_0x43b900,_0xb0573f);})[_0x51dd('0x2a')](function(_0x262dbc){_0x32ece9=_0x262dbc;return getCall(_0x8e83f9,_0x35bab9,_0x4f455a,_0x43b900,_0x32ece9,_0xb0573f,_0x459171,_0x51dd('0x9a'));})[_0x51dd('0x2a')](function(_0x2c60fe){if(_0x2c60fe){logger['info'](_0x51dd('0x9b'),_0x2c60fe['id']);logger[_0x51dd('0x39')](_0x51dd('0x96'),_0x51dd('0x8f'));emit(util[_0x51dd('0x31')](_0x51dd('0x90'),_0x10bc66['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x4f455a[_0x51dd('0x83')]+_0x51dd('0x92')+_0x2c60fe['id']});}})[_0x51dd('0x2d')](function(_0x30c01f){logger[_0x51dd('0x3e')](_0x51dd('0x96'),JSON['stringify'](_0x30c01f));});};exports[_0x51dd('0x9c')]=function(_0x19c2b2,_0x35a177,_0x38cd0d,_0xb4da1d,_0x2c90e6,_0x8846bb){var _0x46815b,_0x44b9e8,_0x26d12e;_0x8846bb[_0x51dd('0x83')]=intUtil['stripTrailingSlash'](_0x8846bb[_0x51dd('0x83')]);_0x8846bb[_0x51dd('0x84')]=intUtil[_0x51dd('0x93')](_0x8846bb['serverUrl']);if(_0x2c90e6&&_0x2c90e6[_0x51dd('0x85')]){logger[_0x51dd('0x39')]('['+_0x35a177['lastevent']['toUpperCase']()+']',_0x51dd('0x87'));_0x35a177[_0x51dd('0x88')]=_0x8846bb[_0x51dd('0x84')]+_0x51dd('0x89')+_0x35a177[_0x51dd('0x8a')]+_0x51dd('0x97')+md5(_0x35a177[_0x51dd('0x8a')]);}else{_0x35a177['recordingURL']='';}var _0x4b6834=_0x8846bb['host']===_0x51dd('0x8b')?'eu':_0x51dd('0x9d');return getAccessToken(_0x8846bb)[_0x51dd('0x2a')](function(_0x4c7fef){_0x26d12e=_0x4c7fef;return getUser(_0x26d12e,_0x4b6834,_0x8846bb);})[_0x51dd('0x2a')](function(_0x53eb84){_0x46815b=_0x53eb84;logger[_0x51dd('0x39')]('The\x20User\x20ID\x20is:',_0x46815b['id']);return getEndUser(_0x26d12e,_0x4b6834,_0x8846bb,_0x35a177[_0x51dd('0x8d')],_0x35a177[_0x51dd('0x8e')],_0x46815b,_0x38cd0d);})[_0x51dd('0x2a')](function(_0x1f8a45){_0x44b9e8=_0x1f8a45;return getCall(_0x26d12e,_0x4b6834,_0x8846bb,_0x46815b,_0x44b9e8,_0x38cd0d,_0x35a177,'Inbound');})['then'](function(_0x17e3e0){if(_0x17e3e0){logger[_0x51dd('0x39')](_0x51dd('0x9b'),_0x17e3e0['id']);}})[_0x51dd('0x2d')](function(_0x49950b){logger[_0x51dd('0x3e')]('['+_0x35a177[_0x51dd('0x6c')][_0x51dd('0x9e')]()+']',JSON['stringify'](_0x49950b));});}; \ 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 0362ff4..0b458ea 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 _0xe5d4=['util','shelljs','mustache','../../../../config/logger','trigger','data2','Script','render','data3','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x1b819d,_0x1a3567){var _0x3500aa=function(_0x1a5344){while(--_0x1a5344){_0x1b819d['push'](_0x1b819d['shift']());}};_0x3500aa(++_0x1a3567);}(_0xe5d4,0x12c));var _0x4e5d=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xe5d4[_0x53ccf2];return _0x5a2964;};'use strict';var util=require(_0x4e5d('0x0'));var sh=require(_0x4e5d('0x1'));var Mustache=require(_0x4e5d('0x2'));var logger=require(_0x4e5d('0x3'))(_0x4e5d('0x4'));exports['exec']=function(_0x9d8db9,_0x201c48){var _0x411d3e=_0x9d8db9[_0x4e5d('0x5')]?_0x9d8db9['data2']:_0x4e5d('0x6');var _0x22f424=_0x9d8db9['data3']?Mustache[_0x4e5d('0x7')](_0x9d8db9[_0x4e5d('0x8')],_0x201c48):_0x201c48;sh[_0x4e5d('0x9')](_0x22f424,function(_0x519341,_0x277c6d,_0x4056cc){if(_0x519341!==0x0){logger[_0x4e5d('0xa')](util[_0x4e5d('0xb')](_0x4e5d('0xc'),_0x411d3e,_0x22f424,_0x519341,_0x4056cc));}else{logger[_0x4e5d('0xd')](util['format'](_0x4e5d('0xe'),_0x411d3e,_0x22f424,_0x277c6d));}});}; \ No newline at end of file +var _0x5d9a=['info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','trigger','exec','data2','Script','data3','render'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x5d9a,0x1a7));var _0xa5d9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5d9a[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var sh=require(_0xa5d9('0x0'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xa5d9('0x1'));exports[_0xa5d9('0x2')]=function(_0x16a838,_0x37a78c){var _0x174c5c=_0x16a838[_0xa5d9('0x3')]?_0x16a838[_0xa5d9('0x3')]:_0xa5d9('0x4');var _0x936779=_0x16a838[_0xa5d9('0x5')]?Mustache[_0xa5d9('0x6')](_0x16a838['data3'],_0x37a78c):_0x37a78c;sh['exec'](_0x936779,function(_0x4b1267,_0x2bc554,_0x3b51bd){if(_0x4b1267!==0x0){logger['error'](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x174c5c,_0x936779,_0x4b1267,_0x3b51bd));}else{logger[_0xa5d9('0x7')](util[_0xa5d9('0x8')](_0xa5d9('0x9'),_0x174c5c,_0x936779,_0x2bc554));}});}; \ 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 ef20697..7b156af 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 _0x7971=['statusCode','name','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','data2','data5','number','headers','parse','render','error','stack','toUpperCase','GET','DELETE','PUT','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s'];(function(_0x17de36,_0x5b5061){var _0x3cd3e0=function(_0x4f1236){while(--_0x4f1236){_0x17de36['push'](_0x17de36['shift']());}};_0x3cd3e0(++_0x5b5061);}(_0x7971,0x10a));var _0x1797=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x7971[_0x1928c9];return _0x51b5fb;};'use strict';var rp=require(_0x1797('0x0'));var util=require('util');var _=require(_0x1797('0x1'));var Mustache=require(_0x1797('0x2'));var logger=require(_0x1797('0x3'))(_0x1797('0x4'));exports[_0x1797('0x5')]=function(_0xac1866,_0x328b14){var _0x4b2d8e,_0x210621;var _0x13e665={'method':_0xac1866[_0x1797('0x6')]['toUpperCase'](),'uri':Mustache['render'](_0xac1866[_0x1797('0x7')],_0x328b14),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xac1866[_0x1797('0x8')])===_0x1797('0x9')&&parseInt(_0xac1866[_0x1797('0x8')])>=0x1&&parseInt(_0xac1866[_0x1797('0x8')])<=0xa?parseInt(_0xac1866[_0x1797('0x8')])*0x3e8:0x5*0x3e8};try{_0x13e665[_0x1797('0xa')]=_0xac1866['data6']?JSON[_0x1797('0xb')](Mustache[_0x1797('0xc')](_0xac1866['data6'],_0x328b14)):{};}catch(_0x216091){logger[_0x1797('0xd')](_0x216091[_0x1797('0xe')]);}switch(_0xac1866[_0x1797('0x6')][_0x1797('0xf')]()){case _0x1797('0x10'):case _0x1797('0x11'):_0x4b2d8e=null;_0x13e665['qs']=_0x328b14;break;case'POST':case _0x1797('0x12'):if(_0xac1866[_0x1797('0x13')]){try{_0x4b2d8e=JSON[_0x1797('0xb')](Mustache[_0x1797('0xc')](_0xac1866['data7'],_0x328b14));_0x13e665[_0x1797('0x14')]=_0x4b2d8e;}catch(_0xb69cb1){logger['error'](_0xb69cb1[_0x1797('0xe')]);logger[_0x1797('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x4b2d8e=_0x328b14;_0x13e665[_0x1797('0x14')]=_0x4b2d8e;}break;}logger[_0x1797('0x15')](util['format'](_0x1797('0x16'),_0xac1866[_0x1797('0x6')],_0xac1866['data2'],JSON['stringify'](_0x13e665)));rp(_0x13e665)[_0x1797('0x17')](function(_0x386156){_0x4b2d8e=!_[_0x1797('0x18')](_0x4b2d8e)?_0x1797('0x19')+_0x4b2d8e:'';_0x210621=typeof _0x386156['body']===_0x1797('0x1a')?JSON[_0x1797('0x1b')](_0x386156[_0x1797('0x14')]):_0x386156[_0x1797('0x14')];logger[_0x1797('0x15')](util[_0x1797('0x1c')](_0x1797('0x1d'),_0xac1866[_0x1797('0x6')],_0xac1866[_0x1797('0x7')],_0x386156['statusCode'],_0x210621));})['catch'](function(_0x1e70fa){logger[_0x1797('0xd')](util[_0x1797('0x1c')](_0x1797('0x1e'),_0xac1866[_0x1797('0x6')],_0xac1866[_0x1797('0x7')],_0x1e70fa[_0x1797('0x1f')],_0x1e70fa[_0x1797('0x20')],_0x1e70fa['message']));});}; \ No newline at end of file +var _0x3ec7=['%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise','util','lodash','mustache','trigger','exec','toUpperCase','data2','number','data5','headers','data6','parse','error','data1','GET','DELETE','PUT','data7','stack','body','info','then',',\x20request\x20body:\x20','object','stringify','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch'];(function(_0x3936cc,_0x976f06){var _0x1abf00=function(_0x58df23){while(--_0x58df23){_0x3936cc['push'](_0x3936cc['shift']());}};_0x1abf00(++_0x976f06);}(_0x3ec7,0xe3));var _0x73ec=function(_0x45b1ca,_0x3d7169){_0x45b1ca=_0x45b1ca-0x0;var _0x292344=_0x3ec7[_0x45b1ca];return _0x292344;};'use strict';var rp=require(_0x73ec('0x0'));var util=require(_0x73ec('0x1'));var _=require(_0x73ec('0x2'));var Mustache=require(_0x73ec('0x3'));var logger=require('../../../../config/logger')(_0x73ec('0x4'));exports[_0x73ec('0x5')]=function(_0x347de6,_0x267fb3){var _0x42e94f,_0x570760;var _0x24e0b7={'method':_0x347de6['data1'][_0x73ec('0x6')](),'uri':Mustache['render'](_0x347de6[_0x73ec('0x7')],_0x267fb3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x347de6['data5'])===_0x73ec('0x8')&&parseInt(_0x347de6[_0x73ec('0x9')])>=0x1&&parseInt(_0x347de6[_0x73ec('0x9')])<=0xa?parseInt(_0x347de6['data5'])*0x3e8:0x5*0x3e8};try{_0x24e0b7[_0x73ec('0xa')]=_0x347de6[_0x73ec('0xb')]?JSON[_0x73ec('0xc')](Mustache['render'](_0x347de6[_0x73ec('0xb')],_0x267fb3)):{};}catch(_0x4f643c){logger[_0x73ec('0xd')](_0x4f643c['stack']);}switch(_0x347de6[_0x73ec('0xe')][_0x73ec('0x6')]()){case _0x73ec('0xf'):case _0x73ec('0x10'):_0x42e94f=null;_0x24e0b7['qs']=_0x267fb3;break;case'POST':case _0x73ec('0x11'):if(_0x347de6['data7']){try{_0x42e94f=JSON[_0x73ec('0xc')](Mustache['render'](_0x347de6[_0x73ec('0x12')],_0x267fb3));_0x24e0b7['body']=_0x42e94f;}catch(_0xe356b2){logger[_0x73ec('0xd')](_0xe356b2[_0x73ec('0x13')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x42e94f=_0x267fb3;_0x24e0b7[_0x73ec('0x14')]=_0x42e94f;}break;}logger[_0x73ec('0x15')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x347de6[_0x73ec('0xe')],_0x347de6['data2'],JSON['stringify'](_0x24e0b7)));rp(_0x24e0b7)[_0x73ec('0x16')](function(_0x3d50f0){_0x42e94f=!_['isNil'](_0x42e94f)?_0x73ec('0x17')+_0x42e94f:'';_0x570760=typeof _0x3d50f0[_0x73ec('0x14')]===_0x73ec('0x18')?JSON[_0x73ec('0x19')](_0x3d50f0[_0x73ec('0x14')]):_0x3d50f0[_0x73ec('0x14')];logger[_0x73ec('0x15')](util[_0x73ec('0x1a')](_0x73ec('0x1b'),_0x347de6['data1'],_0x347de6[_0x73ec('0x7')],_0x3d50f0['statusCode'],_0x570760));})[_0x73ec('0x1c')](function(_0xbe78b2){logger[_0x73ec('0xd')](util[_0x73ec('0x1a')](_0x73ec('0x1d'),_0x347de6['data1'],_0x347de6[_0x73ec('0x7')],_0xbe78b2[_0x73ec('0x1e')],_0xbe78b2[_0x73ec('0x1f')],_0xbe78b2['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index d328a25..f744a08 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 _0xb1ef=['then','debug','error','rpc','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','request'];(function(_0x4c4aeb,_0x4c7ed9){var _0x5529fe=function(_0x6b2ba0){while(--_0x6b2ba0){_0x4c4aeb['push'](_0x4c4aeb['shift']());}};_0x5529fe(++_0x4c7ed9);}(_0xb1ef,0x77));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var jayson=require(_0xfb1e('0x0'));var BPromise=require(_0xfb1e('0x1'));var logger=require(_0xfb1e('0x2'))(_0xfb1e('0x3'));var client=jayson[_0xfb1e('0x4')][_0xfb1e('0x5')]({'port':0x2329});client['Request']=function(_0x153de3,_0x296263){return new BPromise(function(_0x4834e4,_0x3981e0){return client[_0xfb1e('0x6')](_0x153de3,_0x296263)[_0xfb1e('0x7')](function(_0x52fd1d){logger[_0xfb1e('0x8')]('rpc','routing',_0x153de3,_0x296263,_0x52fd1d);if(_0x52fd1d[_0xfb1e('0x9')]){logger[_0xfb1e('0x9')](_0xfb1e('0xa'),_0xfb1e('0x3'),_0x153de3,_0x52fd1d[_0xfb1e('0x9')][_0xfb1e('0xb')],_0x296263);return _0x3981e0(_0x52fd1d[_0xfb1e('0x9')][_0xfb1e('0xb')]);}else{return _0x4834e4(_0x52fd1d[_0xfb1e('0xc')]);}})['catch'](function(_0x31f8fb){logger[_0xfb1e('0x9')](_0xfb1e('0xa'),_0xfb1e('0x3'),_0x153de3,_0x31f8fb,_0x296263);return _0x3981e0(_0x31f8fb);});});};module[_0xfb1e('0xd')]=client; \ No newline at end of file +var _0x3f87=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','request','then'];(function(_0x190f3b,_0x89fbf6){var _0x638d58=function(_0x370c14){while(--_0x370c14){_0x190f3b['push'](_0x190f3b['shift']());}};_0x638d58(++_0x89fbf6);}(_0x3f87,0x12d));var _0x73f8=function(_0x2e8490,_0xae989){_0x2e8490=_0x2e8490-0x0;var _0x373e14=_0x3f87[_0x2e8490];return _0x373e14;};'use strict';var jayson=require(_0x73f8('0x0'));var BPromise=require(_0x73f8('0x1'));var logger=require(_0x73f8('0x2'))(_0x73f8('0x3'));var client=jayson['client'][_0x73f8('0x4')]({'port':0x2329});client['Request']=function(_0x11d8c8,_0x1f4c0a){return new BPromise(function(_0x22abcc,_0x402a58){return client[_0x73f8('0x5')](_0x11d8c8,_0x1f4c0a)[_0x73f8('0x6')](function(_0x47de62){logger[_0x73f8('0x7')](_0x73f8('0x8'),_0x73f8('0x3'),_0x11d8c8,_0x1f4c0a,_0x47de62);if(_0x47de62[_0x73f8('0x9')]){logger['error'](_0x73f8('0x8'),_0x73f8('0x3'),_0x11d8c8,_0x47de62[_0x73f8('0x9')]['message'],_0x1f4c0a);return _0x402a58(_0x47de62[_0x73f8('0x9')][_0x73f8('0xa')]);}else{return _0x22abcc(_0x47de62[_0x73f8('0xb')]);}})[_0x73f8('0xc')](function(_0x130afe){logger[_0x73f8('0x9')]('rpc','routing',_0x11d8c8,_0x130afe,_0x1f4c0a);return _0x402a58(_0x130afe);});});};module[_0x73f8('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 1d2982d..d273094 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 _0x6827=['./realtime','./lib/email','./rpc/mailAccount','resolve','then','initMailAccounts','listen','log','bluebird','./server'];(function(_0x1031ab,_0x11a0e6){var _0x15ba29=function(_0x363709){while(--_0x363709){_0x1031ab['push'](_0x1031ab['shift']());}};_0x15ba29(++_0x11a0e6);}(_0x6827,0xda));var _0x7682=function(_0x172d3f,_0x112f0e){_0x172d3f=_0x172d3f-0x0;var _0x9f3ad3=_0x6827[_0x172d3f];return _0x9f3ad3;};'use strict';var BPromise=require(_0x7682('0x0'));var server=require(_0x7682('0x1'));var Realtime=require(_0x7682('0x2'));var EmailChannel=require(_0x7682('0x3'));var mailAccount=require(_0x7682('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x7682('0x5')]()[_0x7682('0x6')](mailAccount['getMailAccounts']())[_0x7682('0x6')](realtime[_0x7682('0x7')]())[_0x7682('0x6')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x7682('0x8')](realtime,email)[_0x7682('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x7682('0x6')](function(_0x131496){return setInterval(initRealtime,_0x131496['loginMailFrequency']*0x3e8);})['catch'](function(_0x223c8a){console[_0x7682('0x9')](_0x223c8a);});}main(); \ No newline at end of file +var _0xbdd4=['catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','listen','getSettings'];(function(_0x424b64,_0x31a4e3){var _0x53a507=function(_0xc6d8a1){while(--_0xc6d8a1){_0x424b64['push'](_0x424b64['shift']());}};_0x53a507(++_0x31a4e3);}(_0xbdd4,0xe6));var _0x4bdd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbdd4[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x4bdd('0x0'));var server=require('./server');var Realtime=require(_0x4bdd('0x1'));var EmailChannel=require(_0x4bdd('0x2'));var mailAccount=require(_0x4bdd('0x3'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x4bdd('0x4')]()[_0x4bdd('0x5')](mailAccount[_0x4bdd('0x6')]())['then'](realtime[_0x4bdd('0x7')]())[_0x4bdd('0x5')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x4bdd('0x8')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x4bdd('0x9')]();})['then'](function(_0x4c1df4){return setInterval(initRealtime,_0x4c1df4['loginMailFrequency']*0x3e8);})[_0x4bdd('0xa')](function(_0x33314b){console[_0x4bdd('0xb')](_0x33314b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c8be1b2..70379a8 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 _0x825b=['verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','active','Imap','status','total','isNil','stringify','emit','mailAccount:update','hasOwnProperty','imapAccounts','box','handleImapBox','handleImapEmail','bind','handleImapEnd','error','handleImapError','disabled','messageStatus','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp'];(function(_0x33fb80,_0x320e36){var _0x313c98=function(_0x95cf8a){while(--_0x95cf8a){_0x33fb80['push'](_0x33fb80['shift']());}};_0x313c98(++_0x320e36);}(_0x825b,0x67));var _0xb825=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x825b[_0xda464c];return _0x19e222;};'use strict';var _=require('lodash');var moment=require(_0xb825('0x0'));var BPromise=require(_0xb825('0x1'));var md5=require(_0xb825('0x2'));var Redis=require(_0xb825('0x3'));var config=require('../../../config/environment');var logger=require(_0xb825('0x4'))(_0xb825('0x5'));config[_0xb825('0x6')]=_[_0xb825('0x7')](config[_0xb825('0x6')],{'host':_0xb825('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb825('0x6')]));var EmailImap=require(_0xb825('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xb825('0xa'));var md5Accounts={};function EmailChannel(_0x1009eb){logger[_0xb825('0xb')](_0xb825('0xc'));this[_0xb825('0xd')]=_0x1009eb[_0xb825('0xd')];this['imapAccounts']={};this[_0xb825('0xe')]=new EmailSmtp();}EmailChannel[_0xb825('0xf')]['emit']=function(_0x43b42a){var _0x59874b=this[_0xb825('0xd')][_0x43b42a];var _0x19747d={'id':_0x59874b['id'],'name':_0x59874b['name'],'key':_0x59874b['key'],'active':_0x59874b[_0xb825('0x10')],'Imap':{'status':_0x59874b[_0xb825('0x11')][_0xb825('0x12')],'messageStatus':_0x59874b['Imap']['messageStatus'],'total':_0x59874b[_0xb825('0x11')][_0xb825('0x13')]}};if(_[_0xb825('0x14')](md5Accounts[_0x43b42a])){md5Accounts[_0x43b42a]={};}var _0x2cfbeb=md5(JSON[_0xb825('0x15')](_0x19747d));if(md5Accounts[_0x43b42a][_0xb825('0x2')]!==_0x2cfbeb){md5Accounts[_0x43b42a]['md5']=_0x2cfbeb;io[_0xb825('0x16')](_0xb825('0x17'),_0x19747d);}};EmailChannel[_0xb825('0xf')]['refresh']=function(_0x32d7c4){for(var _0x4cbdb7 in _0x32d7c4){if(_0x32d7c4[_0xb825('0x18')](_0x4cbdb7)){if(_0x32d7c4[_0x4cbdb7]['Imap']&&_0x32d7c4[_0x4cbdb7][_0xb825('0x10')]){var _0x32e367=_0x32d7c4[_0x4cbdb7][_0xb825('0x11')];if(!this[_0xb825('0x19')][_0xb825('0x18')](_0x32e367['id'])){this[_0xb825('0x19')][_0x32e367['id']]=new EmailImap(_0x32e367,_0x32d7c4[_0x4cbdb7][_0xb825('0x5')]);this[_0xb825('0x19')][_0x32e367['id']]['on'](_0xb825('0x1a'),this[_0xb825('0x1b')]['bind'](this,_0x4cbdb7));this['imapAccounts'][_0x32e367['id']]['on'](_0xb825('0x5'),this[_0xb825('0x1c')][_0xb825('0x1d')](this,_0x4cbdb7));this[_0xb825('0x19')][_0x32e367['id']]['on']('end',this[_0xb825('0x1e')][_0xb825('0x1d')](this,_0x4cbdb7));this['imapAccounts'][_0x32e367['id']]['on'](_0xb825('0x1f'),this[_0xb825('0x20')]['bind'](this,_0x4cbdb7));}}else{if(_[_0xb825('0x14')](this[_0xb825('0xd')][_0x4cbdb7]['Imap'])){this[_0xb825('0xd')][_0x4cbdb7]['Imap']={};}this['mailAccounts'][_0x4cbdb7][_0xb825('0x11')][_0xb825('0x12')]=_0xb825('0x21');this[_0xb825('0xd')][_0x4cbdb7][_0xb825('0x11')][_0xb825('0x22')]='';this[_0xb825('0x16')](_0x4cbdb7);}}}};EmailChannel[_0xb825('0xf')][_0xb825('0x1b')]=function(_0x6e74c9,_0x2bbaf2){if(this[_0xb825('0xd')][_0x6e74c9]){this[_0xb825('0xd')][_0x6e74c9][_0xb825('0x11')][_0xb825('0x12')]='connected';this[_0xb825('0xd')][_0x6e74c9]['Imap'][_0xb825('0x22')]=_0x2bbaf2[_0xb825('0x23')];if(_0x2bbaf2[_0xb825('0x24')]){this[_0xb825('0xd')][_0x6e74c9][_0xb825('0x11')]['total']=_0x2bbaf2['messages']['total'];}return this[_0xb825('0x16')](_0x6e74c9);}};EmailChannel[_0xb825('0xf')][_0xb825('0x1c')]=function(_0x532b34,_0x53fc59){logger[_0xb825('0xb')](_0xb825('0x25'),_0x53fc59['firstName'],_0x53fc59[_0xb825('0x26')],_0x53fc59[_0xb825('0x27')],_0x532b34);if(this[_0xb825('0xd')][_0x532b34]){return mailAccount[_0xb825('0x28')](_0x532b34,_0x53fc59)[_0xb825('0x29')](function(_0x54a0e0){if(_0x54a0e0){logger[_0xb825('0xb')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x1a3f16){logger[_0xb825('0x1f')](_0xb825('0x2a'),JSON[_0xb825('0x15')](_0x1a3f16));});}};EmailChannel[_0xb825('0xf')][_0xb825('0x1e')]=function(_0x11e93d){if(this[_0xb825('0xd')][_0x11e93d]&&this['mailAccounts'][_0x11e93d][_0xb825('0x11')]){if(this['imapAccounts'][this[_0xb825('0xd')][_0x11e93d][_0xb825('0x11')]['id']]){delete this[_0xb825('0x19')][this[_0xb825('0xd')][_0x11e93d]['Imap']['id']];}this['mailAccounts'][_0x11e93d]['Imap'][_0xb825('0x2b')]=moment();this['emit'](_0x11e93d);}};EmailChannel[_0xb825('0xf')]['handleImapError']=function(_0x833647,_0xe90822){if(this[_0xb825('0xd')][_0x833647]){this[_0xb825('0xd')][_0x833647][_0xb825('0x11')][_0xb825('0x12')]=_0xb825('0x1f');this[_0xb825('0xd')][_0x833647][_0xb825('0x11')][_0xb825('0x22')]=_0xe90822;return this['emit'](_0x833647);}};EmailChannel[_0xb825('0xf')][_0xb825('0x2c')]=function(_0x2c5c86,_0x32fb48){return this[_0xb825('0xe')][_0xb825('0x2d')](_0x2c5c86,_0x32fb48);};EmailChannel[_0xb825('0xf')]['verifySmtp']=function(_0x16d1df){var _0x32144a=this;if(this['mailAccounts'][_0x16d1df['id']]){if(_['isNil'](this[_0xb825('0xd')][_0x16d1df['id']][_0xb825('0x2e')])){this[_0xb825('0xd')][_0x16d1df['id']][_0xb825('0x2e')]={};}this['mailAccounts'][_0x16d1df['id']][_0xb825('0x2e')][_0xb825('0x2b')]=moment();return new BPromise(function(_0x144db6,_0x5c6348){return _0x32144a[_0xb825('0xe')][_0xb825('0x2f')](_0x16d1df)[_0xb825('0x29')](function(_0x572a8a){_0x32144a[_0xb825('0xd')][_0x16d1df['id']][_0xb825('0x2e')][_0xb825('0x12')]=_0xb825('0x30');_0x32144a[_0xb825('0xd')][_0x16d1df['id']]['Smtp'][_0xb825('0x22')]='';_0x32144a[_0xb825('0x16')](_0x16d1df['id']);_0x144db6(_0x572a8a);})['catch'](function(_0x4e8e21){_0x32144a['mailAccounts'][_0x16d1df['id']]['Smtp'][_0xb825('0x12')]=_0xb825('0x1f');_0x32144a[_0xb825('0xd')][_0x16d1df['id']][_0xb825('0x2e')][_0xb825('0x22')]=_0x4e8e21;_0x32144a['emit'](_0x16d1df['id']);_0x5c6348(_0x4e8e21);});});}return this[_0xb825('0xe')]['verify'](_0x16d1df);};module[_0xb825('0x31')]=EmailChannel; \ No newline at end of file +var _0xd59f=['imapAccounts','smtp','emit','active','status','messageStatus','Imap','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','error','prototype','connected','name','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verified','catch','verify','exports','lodash','moment','md5','ioredis','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts'];(function(_0x48fab9,_0x43c32a){var _0x410948=function(_0x52bf23){while(--_0x52bf23){_0x48fab9['push'](_0x48fab9['shift']());}};_0x410948(++_0x43c32a);}(_0xd59f,0x1a3));var _0xfd59=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd59f[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xfd59('0x0'));var moment=require(_0xfd59('0x1'));var BPromise=require('bluebird');var md5=require(_0xfd59('0x2'));var Redis=require(_0xfd59('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xfd59('0x4'));config['redis']=_['defaults'](config[_0xfd59('0x5')],{'host':_0xfd59('0x6'),'port':0x18eb});var io=require(_0xfd59('0x7'))(new Redis(config[_0xfd59('0x5')]));var EmailImap=require(_0xfd59('0x8'));var EmailSmtp=require(_0xfd59('0x9'));var mailAccount=require(_0xfd59('0xa'));var md5Accounts={};function EmailChannel(_0x417355){logger['info'](_0xfd59('0xb'));this[_0xfd59('0xc')]=_0x417355[_0xfd59('0xc')];this[_0xfd59('0xd')]={};this[_0xfd59('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0xfd59('0xf')]=function(_0x2020fc){var _0x1805b7=this[_0xfd59('0xc')][_0x2020fc];var _0x4461e1={'id':_0x1805b7['id'],'name':_0x1805b7['name'],'key':_0x1805b7['key'],'active':_0x1805b7[_0xfd59('0x10')],'Imap':{'status':_0x1805b7['Imap'][_0xfd59('0x11')],'messageStatus':_0x1805b7['Imap'][_0xfd59('0x12')],'total':_0x1805b7[_0xfd59('0x13')][_0xfd59('0x14')]}};if(_[_0xfd59('0x15')](md5Accounts[_0x2020fc])){md5Accounts[_0x2020fc]={};}var _0x227acd=md5(JSON[_0xfd59('0x16')](_0x4461e1));if(md5Accounts[_0x2020fc][_0xfd59('0x2')]!==_0x227acd){md5Accounts[_0x2020fc][_0xfd59('0x2')]=_0x227acd;io['emit'](_0xfd59('0x17'),_0x4461e1);}};EmailChannel['prototype'][_0xfd59('0x18')]=function(_0xf8266a){for(var _0x3fcff1 in _0xf8266a){if(_0xf8266a[_0xfd59('0x19')](_0x3fcff1)){if(_0xf8266a[_0x3fcff1][_0xfd59('0x13')]&&_0xf8266a[_0x3fcff1][_0xfd59('0x10')]){var _0x135e74=_0xf8266a[_0x3fcff1][_0xfd59('0x13')];if(!this[_0xfd59('0xd')][_0xfd59('0x19')](_0x135e74['id'])){this[_0xfd59('0xd')][_0x135e74['id']]=new EmailImap(_0x135e74,_0xf8266a[_0x3fcff1]['email']);this[_0xfd59('0xd')][_0x135e74['id']]['on']('box',this[_0xfd59('0x1a')][_0xfd59('0x1b')](this,_0x3fcff1));this['imapAccounts'][_0x135e74['id']]['on'](_0xfd59('0x4'),this[_0xfd59('0x1c')]['bind'](this,_0x3fcff1));this[_0xfd59('0xd')][_0x135e74['id']]['on'](_0xfd59('0x1d'),this['handleImapEnd'][_0xfd59('0x1b')](this,_0x3fcff1));this[_0xfd59('0xd')][_0x135e74['id']]['on'](_0xfd59('0x1e'),this['handleImapError'][_0xfd59('0x1b')](this,_0x3fcff1));}}else{if(_[_0xfd59('0x15')](this[_0xfd59('0xc')][_0x3fcff1][_0xfd59('0x13')])){this['mailAccounts'][_0x3fcff1][_0xfd59('0x13')]={};}this['mailAccounts'][_0x3fcff1][_0xfd59('0x13')]['status']='disabled';this[_0xfd59('0xc')][_0x3fcff1]['Imap']['messageStatus']='';this[_0xfd59('0xf')](_0x3fcff1);}}}};EmailChannel[_0xfd59('0x1f')]['handleImapBox']=function(_0x279120,_0x148be1){if(this[_0xfd59('0xc')][_0x279120]){this[_0xfd59('0xc')][_0x279120][_0xfd59('0x13')][_0xfd59('0x11')]=_0xfd59('0x20');this[_0xfd59('0xc')][_0x279120]['Imap'][_0xfd59('0x12')]=_0x148be1[_0xfd59('0x21')];if(_0x148be1[_0xfd59('0x22')]){this['mailAccounts'][_0x279120]['Imap'][_0xfd59('0x14')]=_0x148be1[_0xfd59('0x22')][_0xfd59('0x14')];}return this[_0xfd59('0xf')](_0x279120);}};EmailChannel['prototype'][_0xfd59('0x1c')]=function(_0x9bfae3,_0xfe8703){logger[_0xfd59('0x23')](_0xfd59('0x24'),_0xfe8703[_0xfd59('0x25')],_0xfe8703[_0xfd59('0x26')],_0xfe8703['from'],_0x9bfae3);if(this[_0xfd59('0xc')][_0x9bfae3]){return mailAccount[_0xfd59('0x27')](_0x9bfae3,_0xfe8703)[_0xfd59('0x28')](function(_0x5b9766){if(_0x5b9766){logger[_0xfd59('0x23')](_0xfd59('0x29'));}})['catch'](function(_0x52f19b){logger['error'](_0xfd59('0x2a'),JSON[_0xfd59('0x16')](_0x52f19b));});}};EmailChannel[_0xfd59('0x1f')][_0xfd59('0x2b')]=function(_0x2d6fe7){if(this[_0xfd59('0xc')][_0x2d6fe7]&&this['mailAccounts'][_0x2d6fe7][_0xfd59('0x13')]){if(this[_0xfd59('0xd')][this[_0xfd59('0xc')][_0x2d6fe7][_0xfd59('0x13')]['id']]){delete this[_0xfd59('0xd')][this[_0xfd59('0xc')][_0x2d6fe7][_0xfd59('0x13')]['id']];}this['mailAccounts'][_0x2d6fe7][_0xfd59('0x13')][_0xfd59('0x2c')]=moment();this['emit'](_0x2d6fe7);}};EmailChannel['prototype'][_0xfd59('0x2d')]=function(_0x192051,_0x25e5e3){if(this[_0xfd59('0xc')][_0x192051]){this[_0xfd59('0xc')][_0x192051][_0xfd59('0x13')][_0xfd59('0x11')]=_0xfd59('0x1e');this[_0xfd59('0xc')][_0x192051][_0xfd59('0x13')][_0xfd59('0x12')]=_0x25e5e3;return this[_0xfd59('0xf')](_0x192051);}};EmailChannel['prototype'][_0xfd59('0x2e')]=function(_0x4ccfca,_0x1d6205){return this['smtp'][_0xfd59('0x2f')](_0x4ccfca,_0x1d6205);};EmailChannel['prototype'][_0xfd59('0x30')]=function(_0x4445e6){var _0x1a33de=this;if(this[_0xfd59('0xc')][_0x4445e6['id']]){if(_[_0xfd59('0x15')](this[_0xfd59('0xc')][_0x4445e6['id']][_0xfd59('0x31')])){this[_0xfd59('0xc')][_0x4445e6['id']]['Smtp']={};}this[_0xfd59('0xc')][_0x4445e6['id']][_0xfd59('0x31')][_0xfd59('0x2c')]=moment();return new BPromise(function(_0x388bd5,_0x4713ef){return _0x1a33de[_0xfd59('0xe')]['verify'](_0x4445e6)[_0xfd59('0x28')](function(_0xeec2ae){_0x1a33de[_0xfd59('0xc')][_0x4445e6['id']]['Smtp'][_0xfd59('0x11')]=_0xfd59('0x32');_0x1a33de['mailAccounts'][_0x4445e6['id']][_0xfd59('0x31')][_0xfd59('0x12')]='';_0x1a33de[_0xfd59('0xf')](_0x4445e6['id']);_0x388bd5(_0xeec2ae);})[_0xfd59('0x33')](function(_0x5479ba){_0x1a33de['mailAccounts'][_0x4445e6['id']][_0xfd59('0x31')]['status']='error';_0x1a33de['mailAccounts'][_0x4445e6['id']][_0xfd59('0x31')][_0xfd59('0x12')]=_0x5479ba;_0x1a33de[_0xfd59('0xf')](_0x4445e6['id']);_0x4713ef(_0x5479ba);});});}return this['smtp'][_0xfd59('0x34')](_0x4445e6);};module[_0xfd59('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 7d0459a..f59d279 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 _0xeffd=['once','end','handleEnd','error','handleError','prototype','getAccount','connTimeout','authTimeout','isNil','service','user','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','textCode','upperFirst','exports','path','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','ready','handleReady','bind'];(function(_0xc42b35,_0x4f749c){var _0xe89d1f=function(_0x55c6f0){while(--_0x55c6f0){_0xc42b35['push'](_0xc42b35['shift']());}};_0xe89d1f(++_0x4f749c);}(_0xeffd,0x6b));var _0xdeff=function(_0x2ff1fb,_0x2d3207){_0x2ff1fb=_0x2ff1fb-0x0;var _0x3b4d99=_0xeffd[_0x2ff1fb];return _0x3b4d99;};'use strict';var fs=require('fs');var path=require(_0xdeff('0x0'));var util=require('util');var Imap=require(_0xdeff('0x1'));var _=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var simpleParser=require(_0xdeff('0x4'))[_0xdeff('0x5')];var Iconv=require(_0xdeff('0x6'))[_0xdeff('0x7')];var EventEmitter=require(_0xdeff('0x8'))[_0xdeff('0x9')];var utils=require(_0xdeff('0xa'));var logger=require(_0xdeff('0xb'))(_0xdeff('0xc'));function EmailImap(_0x281ad7,_0x256323){this[_0xdeff('0xd')]=_0xdeff('0xe');this[_0xdeff('0xf')]=this['getAccount'](_0x281ad7,_0x256323);this[_0xdeff('0x1')]=new Imap(this[_0xdeff('0xf')]);this[_0xdeff('0x1')]['once'](_0xdeff('0x10'),this[_0xdeff('0x11')][_0xdeff('0x12')](this));this[_0xdeff('0x1')][_0xdeff('0x13')](_0xdeff('0x14'),this[_0xdeff('0x15')][_0xdeff('0x12')](this));this['imap']['on'](_0xdeff('0x16'),this[_0xdeff('0x17')]['bind'](this));this[_0xdeff('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xdeff('0x18')][_0xdeff('0x19')]=function(_0x1585e8,_0xb4bc82){var _0x48f0e8={'connTimeout':_0x1585e8[_0xdeff('0x1a')]?_0x1585e8[_0xdeff('0x1a')]*0x3e8:0x2710,'authTimeout':_0x1585e8[_0xdeff('0x1b')]?_0x1585e8[_0xdeff('0x1b')]*0x3e8:0x1388};if(_[_0xdeff('0x1c')](_0x1585e8[_0xdeff('0x1d')])){if(_0x1585e8['authentication']){_0x48f0e8['user']=_0x1585e8[_0xdeff('0x1e')];_0x48f0e8['password']=_0x1585e8['password'];}_0x48f0e8[_0xdeff('0x1f')]=_0x1585e8[_0xdeff('0x1f')];_0x48f0e8['port']=_0x1585e8[_0xdeff('0x20')]||0x3e1;if(_0x1585e8[_0xdeff('0x21')]){_0x48f0e8[_0xdeff('0x21')]=!![];}else{_0x48f0e8[_0xdeff('0x21')]=![];_0x48f0e8[_0xdeff('0x22')]=_0xdeff('0x23');}}else{_0x48f0e8[_0xdeff('0x1e')]=_0x1585e8[_0xdeff('0x1e')];_0x48f0e8['password']=_0x1585e8['password'];_0x48f0e8['host']=utils[_0xdeff('0x24')](_0x1585e8['service']);_0x48f0e8[_0xdeff('0x20')]=0x3e1;_0x48f0e8[_0xdeff('0x21')]=!![];}_0x48f0e8['email']=_0xb4bc82||_0x1585e8[_0xdeff('0x1e')]||_0xdeff('0x25');return _0x48f0e8;};EmailImap['prototype']['handleReady']=function(){this[_0xdeff('0x1')][_0xdeff('0x26')](this[_0xdeff('0xd')],![],this[_0xdeff('0x27')][_0xdeff('0x12')](this));};EmailImap['prototype'][_0xdeff('0x27')]=function(_0x412db3,_0x3741fb){if(_0x412db3){this[_0xdeff('0x17')](_0x412db3,!![]);}else{this[_0xdeff('0x28')](_0xdeff('0x29'),_0x3741fb);this[_0xdeff('0x2a')]();}};EmailImap['prototype'][_0xdeff('0x2b')]=function(_0x1a546c){if(_0x1a546c){this['handleError'](_0x1a546c,!![]);}else{this['imap'][_0xdeff('0x14')]();}};EmailImap[_0xdeff('0x18')][_0xdeff('0x2a')]=function(){this[_0xdeff('0x1')][_0xdeff('0x2c')]([_0xdeff('0x2d')],this[_0xdeff('0x2e')]['bind'](this));};EmailImap[_0xdeff('0x18')][_0xdeff('0x2e')]=function(_0x34e258,_0x5045b8){if(_0x34e258){this['handleError'](_0x34e258,!![]);}else{if(_0x5045b8[_0xdeff('0x2f')]){try{var _0x505e3f=this[_0xdeff('0x1')][_0xdeff('0x30')](_0x5045b8,{'bodies':'','markSeen':!![]});_0x505e3f['on'](_0xdeff('0x31'),this['handleFetchMessage'][_0xdeff('0x12')](this));_0x505e3f['once']('error',this[_0xdeff('0x32')][_0xdeff('0x12')](this));_0x505e3f[_0xdeff('0x13')](_0xdeff('0x14'),this['handleFetchEnd'][_0xdeff('0x12')](this));}catch(_0x1f5ea9){logger[_0xdeff('0x16')](_0x1f5ea9);}}else{this[_0xdeff('0x1')][_0xdeff('0x33')](!![],this[_0xdeff('0x2b')][_0xdeff('0x12')](this));}}};EmailImap['prototype'][_0xdeff('0x34')]=function(_0x5cef77,_0x1923bf){_0x5cef77['on'](_0xdeff('0x35'),this[_0xdeff('0x36')][_0xdeff('0x12')](this));_0x5cef77[_0xdeff('0x13')](_0xdeff('0x37'),this['handleMessageAttributes'][_0xdeff('0x12')](this));_0x5cef77[_0xdeff('0x13')]('end',this[_0xdeff('0x38')][_0xdeff('0x12')](this));};EmailImap[_0xdeff('0x18')][_0xdeff('0x36')]=function(_0x233479,_0xe511b2){simpleParser(_0x233479,{'Iconv':Iconv},this[_0xdeff('0x39')][_0xdeff('0x12')](this));};EmailImap['prototype'][_0xdeff('0x3a')]=function(_0x4ad39d){};EmailImap[_0xdeff('0x18')][_0xdeff('0x38')]=function(){};EmailImap[_0xdeff('0x18')]['handleSimpleParser']=function(_0x443550,_0x280a86){if(_0x443550){logger[_0xdeff('0x16')](_0x443550);}else{var _0x467ce0=this;utils[_0xdeff('0x3b')](this['account'],_0x280a86,function(_0x1c87bd){_0x467ce0['emit'](_0xdeff('0xc'),_0x1c87bd);});}};EmailImap[_0xdeff('0x18')]['handleFetchEnd']=function(){this[_0xdeff('0x1')][_0xdeff('0x33')](!![],this[_0xdeff('0x2b')][_0xdeff('0x12')](this));};EmailImap[_0xdeff('0x18')]['handleFetchError']=function(_0x3d8a33){this[_0xdeff('0x17')](_0x3d8a33);this[_0xdeff('0x1')][_0xdeff('0x33')](!![],this[_0xdeff('0x2b')]['bind'](this));};EmailImap['prototype'][_0xdeff('0x15')]=function(){this[_0xdeff('0x28')](_0xdeff('0x14'));};EmailImap[_0xdeff('0x18')][_0xdeff('0x17')]=function(_0x289f70,_0x2cd68a){logger['error'](_0xdeff('0x17'),this[_0xdeff('0xf')][_0xdeff('0xc')],JSON['stringify'](_0x289f70));var _0x1c3532='';if(_0x289f70){if(_0x289f70[_0xdeff('0x3c')]){_0x1c3532=_0x289f70[_0xdeff('0x3c')];}else{for(var _0x43f457 in _0x289f70){if(_0x289f70['hasOwnProperty'](_0x43f457)){_0x1c3532+=_[_0xdeff('0x3d')](_0x43f457)+':\x20'+_0x289f70[_0x43f457]+'\x0a';}}}}if(_0x2cd68a){this[_0xdeff('0x1')][_0xdeff('0x14')]();}else{this[_0xdeff('0x28')](_0xdeff('0x16'),_0x1c3532);this[_0xdeff('0x28')](_0xdeff('0x14'));}};module[_0xdeff('0x3e')]=EmailImap; \ No newline at end of file +var _0x44c8=['once','ready','end','bind','error','handleError','inherits','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','getHost','prototype','handleReady','openBox','handleOpenBox','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst','util','imap','lodash','mailparser','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account'];(function(_0x575acc,_0x4d87dc){var _0x58602c=function(_0x8271ad){while(--_0x8271ad){_0x575acc['push'](_0x575acc['shift']());}};_0x58602c(++_0x4d87dc);}(_0x44c8,0xaa));var _0x844c=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x44c8[_0x403c20];return _0x2b271a;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x844c('0x0'));var Imap=require(_0x844c('0x1'));var _=require(_0x844c('0x2'));var rs=require('randomstring');var simpleParser=require(_0x844c('0x3'))[_0x844c('0x4')];var Iconv=require('iconv')[_0x844c('0x5')];var EventEmitter=require(_0x844c('0x6'))[_0x844c('0x7')];var utils=require('./utils');var logger=require(_0x844c('0x8'))(_0x844c('0x9'));function EmailImap(_0x449205,_0x1e3bee){this[_0x844c('0xa')]=_0x844c('0xb');this[_0x844c('0xc')]=this['getAccount'](_0x449205,_0x1e3bee);this[_0x844c('0x1')]=new Imap(this[_0x844c('0xc')]);this['imap'][_0x844c('0xd')](_0x844c('0xe'),this['handleReady']['bind'](this));this[_0x844c('0x1')][_0x844c('0xd')](_0x844c('0xf'),this['handleEnd'][_0x844c('0x10')](this));this[_0x844c('0x1')]['on'](_0x844c('0x11'),this[_0x844c('0x12')][_0x844c('0x10')](this));this[_0x844c('0x1')]['connect']();}util[_0x844c('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0x844c('0x14')]=function(_0x15326f,_0x1129d4){var _0x2cb78c={'connTimeout':_0x15326f[_0x844c('0x15')]?_0x15326f[_0x844c('0x15')]*0x3e8:0x2710,'authTimeout':_0x15326f[_0x844c('0x16')]?_0x15326f['authTimeout']*0x3e8:0x1388};if(_[_0x844c('0x17')](_0x15326f[_0x844c('0x18')])){if(_0x15326f[_0x844c('0x19')]){_0x2cb78c[_0x844c('0x1a')]=_0x15326f['user'];_0x2cb78c[_0x844c('0x1b')]=_0x15326f[_0x844c('0x1b')];}_0x2cb78c[_0x844c('0x1c')]=_0x15326f[_0x844c('0x1c')];_0x2cb78c['port']=_0x15326f[_0x844c('0x1d')]||0x3e1;if(_0x15326f[_0x844c('0x1e')]){_0x2cb78c[_0x844c('0x1e')]=!![];}else{_0x2cb78c[_0x844c('0x1e')]=![];_0x2cb78c['autotls']=_0x844c('0x1f');}}else{_0x2cb78c[_0x844c('0x1a')]=_0x15326f[_0x844c('0x1a')];_0x2cb78c['password']=_0x15326f[_0x844c('0x1b')];_0x2cb78c[_0x844c('0x1c')]=utils[_0x844c('0x20')](_0x15326f[_0x844c('0x18')]);_0x2cb78c['port']=0x3e1;_0x2cb78c['tls']=!![];}_0x2cb78c['email']=_0x1129d4||_0x15326f[_0x844c('0x1a')]||'anonymous@xcally.com';return _0x2cb78c;};EmailImap[_0x844c('0x21')][_0x844c('0x22')]=function(){this['imap'][_0x844c('0x23')](this[_0x844c('0xa')],![],this[_0x844c('0x24')]['bind'](this));};EmailImap[_0x844c('0x21')][_0x844c('0x24')]=function(_0x1dea38,_0x12699d){if(_0x1dea38){this['handleError'](_0x1dea38,!![]);}else{this[_0x844c('0x25')](_0x844c('0x26'),_0x12699d);this[_0x844c('0x27')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x289921){if(_0x289921){this[_0x844c('0x12')](_0x289921,!![]);}else{this[_0x844c('0x1')][_0x844c('0xf')]();}};EmailImap[_0x844c('0x21')][_0x844c('0x27')]=function(){this['imap']['search']([_0x844c('0x28')],this[_0x844c('0x29')]['bind'](this));};EmailImap[_0x844c('0x21')][_0x844c('0x29')]=function(_0x16b786,_0x14bda2){if(_0x16b786){this[_0x844c('0x12')](_0x16b786,!![]);}else{if(_0x14bda2[_0x844c('0x2a')]){try{var _0x1b8628=this[_0x844c('0x1')][_0x844c('0x2b')](_0x14bda2,{'bodies':'','markSeen':!![]});_0x1b8628['on'](_0x844c('0x2c'),this[_0x844c('0x2d')][_0x844c('0x10')](this));_0x1b8628[_0x844c('0xd')](_0x844c('0x11'),this[_0x844c('0x2e')][_0x844c('0x10')](this));_0x1b8628['once']('end',this[_0x844c('0x2f')][_0x844c('0x10')](this));}catch(_0x143467){logger[_0x844c('0x11')](_0x143467);}}else{this[_0x844c('0x1')][_0x844c('0x30')](!![],this[_0x844c('0x31')][_0x844c('0x10')](this));}}};EmailImap[_0x844c('0x21')][_0x844c('0x2d')]=function(_0x2dbf29,_0x34eaba){_0x2dbf29['on'](_0x844c('0x32'),this['handleMessageBody']['bind'](this));_0x2dbf29['once'](_0x844c('0x33'),this[_0x844c('0x34')][_0x844c('0x10')](this));_0x2dbf29['once']('end',this['handleMessageEnd'][_0x844c('0x10')](this));};EmailImap[_0x844c('0x21')][_0x844c('0x35')]=function(_0x228a18,_0x216465){simpleParser(_0x228a18,{'Iconv':Iconv},this[_0x844c('0x36')][_0x844c('0x10')](this));};EmailImap[_0x844c('0x21')][_0x844c('0x34')]=function(_0x3ddcee){};EmailImap[_0x844c('0x21')][_0x844c('0x37')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x1ff238,_0x5e1c75){if(_0x1ff238){logger['error'](_0x1ff238);}else{var _0x1841af=this;utils[_0x844c('0x38')](this[_0x844c('0xc')],_0x5e1c75,function(_0x5e5d81){_0x1841af[_0x844c('0x25')](_0x844c('0x9'),_0x5e5d81);});}};EmailImap[_0x844c('0x21')][_0x844c('0x2f')]=function(){this[_0x844c('0x1')][_0x844c('0x30')](!![],this['handleCloseBox'][_0x844c('0x10')](this));};EmailImap[_0x844c('0x21')][_0x844c('0x2e')]=function(_0x2d6d35){this[_0x844c('0x12')](_0x2d6d35);this[_0x844c('0x1')][_0x844c('0x30')](!![],this[_0x844c('0x31')][_0x844c('0x10')](this));};EmailImap[_0x844c('0x21')]['handleEnd']=function(){this[_0x844c('0x25')](_0x844c('0xf'));};EmailImap[_0x844c('0x21')]['handleError']=function(_0x878a0,_0x57a761){logger[_0x844c('0x11')](_0x844c('0x12'),this[_0x844c('0xc')][_0x844c('0x9')],JSON[_0x844c('0x39')](_0x878a0));var _0x781c8b='';if(_0x878a0){if(_0x878a0[_0x844c('0x3a')]){_0x781c8b=_0x878a0[_0x844c('0x3a')];}else{for(var _0x58709a in _0x878a0){if(_0x878a0[_0x844c('0x3b')](_0x58709a)){_0x781c8b+=_[_0x844c('0x3c')](_0x58709a)+':\x20'+_0x878a0[_0x58709a]+'\x0a';}}}}if(_0x57a761){this['imap'][_0x844c('0xf')]();}else{this['emit']('error',_0x781c8b);this[_0x844c('0x25')](_0x844c('0xf'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index f3885ec..ae7ef4c 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 _0x282a=['sendMail','toString','prototype','verify','createTransport','Not\x20verifired','nodemailer','bluebird','compile'];(function(_0x35f9af,_0x48631f){var _0x129ee7=function(_0x5a8d4a){while(--_0x5a8d4a){_0x35f9af['push'](_0x35f9af['shift']());}};_0x129ee7(++_0x48631f);}(_0x282a,0x1c8));var _0xa282=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x282a[_0x411017];return _0x2adeea;};'use strict';var nodemailer=require(_0xa282('0x0'));var BPromise=require(_0xa282('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x5afd22,_0x1afcfa){return new BPromise(function(_0x4e810e,_0x4b5da8){var _0x2b6b2e=nodemailer['createTransport'](_0x5afd22);_0x2b6b2e['use'](_0xa282('0x2'),inlineBase64());_0x2b6b2e[_0xa282('0x3')](_0x1afcfa,function(_0x2d6cb1,_0x41222c){if(_0x2d6cb1){_0x4b5da8(_0x2d6cb1[_0xa282('0x4')]());}else{_0x4e810e(_0x41222c);}});});};EmailSmtp[_0xa282('0x5')][_0xa282('0x6')]=function(_0x24b109){return new BPromise(function(_0x2da4d6,_0x2952ad){var _0x58df89=nodemailer[_0xa282('0x7')](_0x24b109);_0x58df89['verify'](function(_0x2aad01,_0x2d759f){if(_0x2aad01){_0x2952ad(_0x2aad01[_0xa282('0x4')]());}else{if(_0x2d759f){_0x2da4d6(_0x2d759f);}else{_0x2952ad(_0xa282('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xe923=['createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xe923,0xa2));var _0x3e92=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0xe923[_0x576e2b];return _0x46461a;};'use strict';var nodemailer=require(_0x3e92('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x3e92('0x1'));function EmailSmtp(){}EmailSmtp[_0x3e92('0x2')]['send']=function(_0x486186,_0x39f1a9){return new BPromise(function(_0x552083,_0x5498e0){var _0x2614cc=nodemailer[_0x3e92('0x3')](_0x486186);_0x2614cc[_0x3e92('0x4')](_0x3e92('0x5'),inlineBase64());_0x2614cc[_0x3e92('0x6')](_0x39f1a9,function(_0x12bc61,_0x46832a){if(_0x12bc61){_0x5498e0(_0x12bc61[_0x3e92('0x7')]());}else{_0x552083(_0x46832a);}});});};EmailSmtp[_0x3e92('0x2')]['verify']=function(_0x191ef7){return new BPromise(function(_0x283199,_0x273ea9){var _0x17efae=nodemailer[_0x3e92('0x3')](_0x191ef7);_0x17efae[_0x3e92('0x8')](function(_0x239705,_0x40a3fa){if(_0x239705){_0x273ea9(_0x239705[_0x3e92('0x7')]());}else{if(_0x40a3fa){_0x283199(_0x40a3fa);}else{_0x273ea9(_0x3e92('0x9'));}}});});};module[_0x3e92('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 5f3aa61..b2313b4 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 _0xb847=['imap-mail.outlook.com','outlook.office365.com','127.0.0.1','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','value','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','@xcally.com','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0xf27b90[_0x7b84('0x10')](0x0,-0x1)['join']('\x20'):_0x39fc9b['name'];}return _0x7b84('0x11');}function getLastName(_0x17dc5c){var _0x2fa755=_[_0x7b84('0x6')](_0x17dc5c[_0x7b84('0xa')]);if(_0x2fa755&&_0x2fa755[_0x7b84('0xb')]){var _0x59a1b0=_0x2fa755[_0x7b84('0xb')]['split'](/\s+/);return _0x59a1b0[_0x7b84('0xf')]>0x1?_0x59a1b0[_0x7b84('0x12')]():'';}return'';}function getMails(_0x14c46c,_0x2faae8){var _0x56c4f2='';for(var _0x1cd39f=0x0;_0x1cd39f<_0x2faae8[_0x7b84('0xa')][_0x7b84('0xf')];_0x1cd39f+=0x1){if(_0x2faae8['value'][_0x1cd39f][_0x7b84('0x7')]!==_0x14c46c){if(!_[_0x7b84('0x13')](_0x56c4f2)){_0x56c4f2+=',';}_0x56c4f2+=_0x2faae8['value'][_0x1cd39f][_0x7b84('0xb')]||_0x2faae8['value'][_0x1cd39f][_0x7b84('0x7')]||'';_0x56c4f2+='\x20<';_0x56c4f2+=_0x2faae8[_0x7b84('0xa')][_0x1cd39f][_0x7b84('0x7')]?_0x2faae8[_0x7b84('0xa')][_0x1cd39f]['address']:_0x7b84('0x8')+random[_0x7b84('0x9')](0x6)+_0x7b84('0x14');_0x56c4f2+='>';}}return _0x56c4f2;}function parseEmail(_0x39f23b,_0x3c34ad,_0x236bbf){if(_0x3c34ad[_0x7b84('0x15')]){var _0x237a04=/)<[^<]*)*<\/script>/gi;while(_0x237a04[_0x7b84('0x16')](_0x3c34ad[_0x7b84('0x15')])){_0x3c34ad[_0x7b84('0x15')]=_0x3c34ad[_0x7b84('0x15')]['replace'](_0x237a04,'');}if(_0x3c34ad[_0x7b84('0x15')][_0x7b84('0x17')](_0x7b84('0x18'))){var _0xff8ab2=[];_0x3c34ad[_0x7b84('0x19')][_0x7b84('0x1a')](_0x1c3c67=>{_0xff8ab2[_0x7b84('0x1b')](_0x1c3c67[_0x7b84('0x1c')]);});var _0x2101d0=/]+>/g;var _0x1e136b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x32f3fd=_0x3c34ad[_0x7b84('0x15')][_0x7b84('0x1d')](_0x1e136b,'_SRC');var _0x5665c4=_0x32f3fd[_0x7b84('0x1d')](_0x2101d0,'_IMG');for(let _0x526645=0x0;_0x526645<_0xff8ab2[_0x7b84('0xf')];_0x526645++){var _0x29a2c7=_0x5665c4[_0x7b84('0x1d')](_0x7b84('0x1e'),_0x7b84('0x1f')+_0xff8ab2[_0x526645]+_0x7b84('0x20'));_0x5665c4=_0x29a2c7;}_0x3c34ad[_0x7b84('0x15')]=_0x5665c4;}_0x236bbf['body']=_0x3c34ad['html'];}else{_0x236bbf[_0x7b84('0x21')]=_0x3c34ad[_0x7b84('0x22')];}if(_0x236bbf[_0x7b84('0x21')]){_0x236bbf['body']=_0x236bbf[_0x7b84('0x21')][_0x7b84('0x1d')](/0x0){var _0x485979=[_0x7b84('0x33'),_0x7b84('0x34'),'Precedence:\x20auto_reply'];for(var _0x1fae1b=0x0;_0x1fae1b<_0x3c34ad[_0x7b84('0x32')][_0x7b84('0xf')];_0x1fae1b++){var _0x3bb163=_['indexOf'](_0x485979,_0x3c34ad['headerLines'][_0x1fae1b]);if(_0x3bb163>=0x0){_0x3c34ad[_0x7b84('0x35')]=!![];}}}return _0x236bbf;}exports[_0x7b84('0x36')]=function(_0x478a4e,_0x153706,_0x3d656a){var _0x236323={'from':getAddress(_0x153706['from']),'firstName':getFirstName(_0x153706['from']),'lastName':getLastName(_0x153706[_0x7b84('0x37')]),'mapKey':'email','message':{'from':getMails(_0x478a4e['email'],_0x153706[_0x7b84('0x37')]),'to':_0x478a4e['email'],'cc':'','subject':_0x153706[_0x7b84('0x38')]||'','messageId':_0x153706[_0x7b84('0x39')],'inReplyTo':_0x153706['inReplyTo'],'sentAt':moment(_0x153706['date'])[_0x7b84('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x153706[_0x7b84('0x15')]&&!_0x153706[_0x7b84('0x22')]){var _0x439750=_[_0x7b84('0x3a')](_0x153706[_0x7b84('0x19')],{'contentType':_0x7b84('0x3b')});if(_0x439750[_0x7b84('0xf')]){logger[_0x7b84('0x3c')](util[_0x7b84('0x2a')](_0x7b84('0x3d'),_0x153706[_0x7b84('0x39')]));tnef[_0x7b84('0x3e')](_[_0x7b84('0x3f')](_0x439750)[_0x7b84('0x30')],function(_0x3f4af9,_0x4c8f5c){if(_0x4c8f5c){_0x153706[_0x7b84('0x15')]=_0x4c8f5c['BodyHTML']||'

Empty\x20message

';if(_0x4c8f5c[_0x7b84('0x40')]){for(var _0x1db496=0x0;_0x1db496<_0x4c8f5c[_0x7b84('0x40')][_0x7b84('0xf')];_0x1db496++){var _0x52b136=_0x4c8f5c[_0x7b84('0x40')][_0x1db496];_0x236323[_0x7b84('0x24')][_0x7b84('0x19')][_0x7b84('0x1b')]({'filename':_0x52b136['Title'],'content':Buffer[_0x7b84('0x37')](_0x52b136['Data'])});}}}_0x3d656a(parseEmail(_0x478a4e,_0x153706,_0x236323));});}else{_0x153706[_0x7b84('0x15')]='

Empty\x20message

';_0x3d656a(parseEmail(_0x478a4e,_0x153706,_0x236323));}}else{_0x3d656a(parseEmail(_0x478a4e,_0x153706,_0x236323));}};exports['getHost']=function(_0x2ebf48){switch(_0x2ebf48){case'gmail':return _0x7b84('0x41');case _0x7b84('0x42'):return _0x7b84('0x43');case'hotmail':return _0x7b84('0x44');case'outlook365':return _0x7b84('0x45');}return _0x7b84('0x46');}; \ No newline at end of file +var _0xf8ad=['replace','includes','forEach','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','push','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','value','pop','isEmpty','test','html'];(function(_0x219749,_0x3d4cf1){var _0x315ce0=function(_0x4290c1){while(--_0x4290c1){_0x219749['push'](_0x219749['shift']());}};_0x315ce0(++_0x3d4cf1);}(_0xf8ad,0xd8));var _0xdf8a=function(_0x160afe,_0xccd3ed){_0x160afe=_0x160afe-0x0;var _0x45e202=_0xf8ad[_0x160afe];return _0x45e202;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0xdf8a('0x0'));var fs=require('fs');var path=require('path');var util=require(_0xdf8a('0x1'));var tnef=require(_0xdf8a('0x2'));var logger=require(_0xdf8a('0x3'))(_0xdf8a('0x4'));var config=require(_0xdf8a('0x5'));function getAddress(_0x360034){var _0x5e4284=_[_0xdf8a('0x6')](_0x360034['value']);return _0x5e4284&&_0x5e4284['address']?_0x5e4284[_0xdf8a('0x7')]:_0xdf8a('0x8')+random[_0xdf8a('0x9')](0x6)+_0xdf8a('0xa');}function getFirstName(_0x35204d){var _0x1dd819=_[_0xdf8a('0x6')](_0x35204d['value']);if(_0x1dd819&&_0x1dd819[_0xdf8a('0xb')]){if(_0x1dd819['name']==_0x1dd819[_0xdf8a('0x7')]){return _0x1dd819[_0xdf8a('0xb')][_0xdf8a('0xc')](0x0,_0x1dd819[_0xdf8a('0xb')][_0xdf8a('0xd')]('@'));}var _0x3b1a1f=_0x1dd819[_0xdf8a('0xb')][_0xdf8a('0xe')](/\s+/);return _0x3b1a1f[_0xdf8a('0xf')]>0x1?_0x3b1a1f[_0xdf8a('0x10')](0x0,-0x1)[_0xdf8a('0x11')]('\x20'):_0x1dd819[_0xdf8a('0xb')];}return _0xdf8a('0x12');}function getLastName(_0x685d5b){var _0x5ed10c=_[_0xdf8a('0x6')](_0x685d5b[_0xdf8a('0x13')]);if(_0x5ed10c&&_0x5ed10c[_0xdf8a('0xb')]){var _0x14f9da=_0x5ed10c['name'][_0xdf8a('0xe')](/\s+/);return _0x14f9da[_0xdf8a('0xf')]>0x1?_0x14f9da[_0xdf8a('0x14')]():'';}return'';}function getMails(_0x4c9c0e,_0xa69e61){var _0x392220='';for(var _0x4aa870=0x0;_0x4aa870<_0xa69e61[_0xdf8a('0x13')][_0xdf8a('0xf')];_0x4aa870+=0x1){if(_0xa69e61['value'][_0x4aa870][_0xdf8a('0x7')]!==_0x4c9c0e){if(!_[_0xdf8a('0x15')](_0x392220)){_0x392220+=',';}_0x392220+=_0xa69e61[_0xdf8a('0x13')][_0x4aa870]['name']||_0xa69e61[_0xdf8a('0x13')][_0x4aa870][_0xdf8a('0x7')]||'';_0x392220+='\x20<';_0x392220+=_0xa69e61['value'][_0x4aa870]['address']?_0xa69e61[_0xdf8a('0x13')][_0x4aa870][_0xdf8a('0x7')]:_0xdf8a('0x8')+random[_0xdf8a('0x9')](0x6)+_0xdf8a('0xa');_0x392220+='>';}}return _0x392220;}function parseEmail(_0x1385b6,_0x24238b,_0x315414){if(_0x24238b['html']){var _0x24c830=/)<[^<]*)*<\/script>/gi;while(_0x24c830[_0xdf8a('0x16')](_0x24238b[_0xdf8a('0x17')])){_0x24238b['html']=_0x24238b['html'][_0xdf8a('0x18')](_0x24c830,'');}if(_0x24238b[_0xdf8a('0x17')][_0xdf8a('0x19')]('{_0x2aa6b9['push'](_0x553b9e[_0xdf8a('0x1b')]);});var _0x30a5ca=/]+>/g;var _0x26b5c7=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1f0abc=_0x24238b[_0xdf8a('0x17')][_0xdf8a('0x18')](_0x26b5c7,_0xdf8a('0x1c'));var _0x2378f1=_0x1f0abc[_0xdf8a('0x18')](_0x30a5ca,_0xdf8a('0x1d'));for(let _0xf89343=0x0;_0xf89343<_0x2aa6b9[_0xdf8a('0xf')];_0xf89343++){var _0x1ba838=_0x2378f1[_0xdf8a('0x18')]('_IMG',_0xdf8a('0x1e')+_0x2aa6b9[_0xf89343]+_0xdf8a('0x1f'));_0x2378f1=_0x1ba838;}_0x24238b['html']=_0x2378f1;}_0x315414[_0xdf8a('0x20')]=_0x24238b[_0xdf8a('0x17')];}else{_0x315414[_0xdf8a('0x20')]=_0x24238b[_0xdf8a('0x21')];}if(_0x315414[_0xdf8a('0x20')]){_0x315414['body']=_0x315414[_0xdf8a('0x20')][_0xdf8a('0x18')](/0x0){var _0x10b4f9=[_0xdf8a('0x32'),_0xdf8a('0x33'),_0xdf8a('0x34')];for(var _0x246073=0x0;_0x246073<_0x24238b['headerLines'][_0xdf8a('0xf')];_0x246073++){var _0x570e42=_[_0xdf8a('0xd')](_0x10b4f9,_0x24238b[_0xdf8a('0x31')][_0x246073][_0xdf8a('0x35')]);if(_0x570e42>=0x0){_0x315414[_0xdf8a('0x36')]=!![];}}}return _0x315414;}exports[_0xdf8a('0x37')]=function(_0x4967be,_0x4e372b,_0x5cd3a3){var _0x5af6c8={'from':getAddress(_0x4e372b['from']),'firstName':getFirstName(_0x4e372b[_0xdf8a('0x38')]),'lastName':getLastName(_0x4e372b['from']),'mapKey':_0xdf8a('0x4'),'message':{'from':getMails(_0x4967be[_0xdf8a('0x4')],_0x4e372b[_0xdf8a('0x38')]),'to':_0x4967be['email'],'cc':'','subject':_0x4e372b[_0xdf8a('0x39')]||'','messageId':_0x4e372b[_0xdf8a('0x3a')],'inReplyTo':_0x4e372b['inReplyTo'],'sentAt':moment(_0x4e372b[_0xdf8a('0x3b')])[_0xdf8a('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4e372b[_0xdf8a('0x17')]&&!_0x4e372b[_0xdf8a('0x21')]){var _0x15381d=_[_0xdf8a('0x3c')](_0x4e372b[_0xdf8a('0x27')],{'contentType':_0xdf8a('0x3d')});if(_0x15381d[_0xdf8a('0xf')]){logger[_0xdf8a('0x3e')](util['format'](_0xdf8a('0x3f'),_0x4e372b[_0xdf8a('0x3a')]));tnef[_0xdf8a('0x40')](_[_0xdf8a('0x41')](_0x15381d)[_0xdf8a('0x2f')],function(_0x4254e4,_0x3c7ec1){if(_0x3c7ec1){_0x4e372b['html']=_0x3c7ec1[_0xdf8a('0x42')]||_0xdf8a('0x43');if(_0x3c7ec1[_0xdf8a('0x44')]){for(var _0x55e637=0x0;_0x55e637<_0x3c7ec1[_0xdf8a('0x44')][_0xdf8a('0xf')];_0x55e637++){var _0x3166fb=_0x3c7ec1[_0xdf8a('0x44')][_0x55e637];_0x5af6c8[_0xdf8a('0x24')][_0xdf8a('0x27')][_0xdf8a('0x45')]({'filename':_0x3166fb['Title'],'content':Buffer[_0xdf8a('0x38')](_0x3166fb[_0xdf8a('0x46')])});}}}_0x5cd3a3(parseEmail(_0x4967be,_0x4e372b,_0x5af6c8));});}else{_0x4e372b[_0xdf8a('0x17')]=_0xdf8a('0x43');_0x5cd3a3(parseEmail(_0x4967be,_0x4e372b,_0x5af6c8));}}else{_0x5cd3a3(parseEmail(_0x4967be,_0x4e372b,_0x5af6c8));}};exports[_0xdf8a('0x47')]=function(_0x491154){switch(_0x491154){case _0xdf8a('0x48'):return _0xdf8a('0x49');case _0xdf8a('0x4a'):return _0xdf8a('0x4b');case _0xdf8a('0x4c'):return _0xdf8a('0x4d');case _0xdf8a('0x4e'):return _0xdf8a('0x4f');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d81d4f6..d2a783e 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfdc=['active','Imap','Smtp','exports','lodash','name','key'];(function(_0x2af009,_0x5432ee){var _0x46d15f=function(_0x26569f){while(--_0x26569f){_0x2af009['push'](_0x2af009['shift']());}};_0x46d15f(++_0x5432ee);}(_0xbfdc,0xf9));var _0xcbfd=function(_0x44998e,_0x2cba7f){_0x44998e=_0x44998e-0x0;var _0x3f4f96=_0xbfdc[_0x44998e];return _0x3f4f96;};'use strict';var _=require(_0xcbfd('0x0'));function MailAccount(_0x7ba7a7){this['id']=_0x7ba7a7['id']||0x0;this[_0xcbfd('0x1')]=_0x7ba7a7[_0xcbfd('0x1')]||'Service';this[_0xcbfd('0x2')]=_0x7ba7a7[_0xcbfd('0x2')]||'SERV';this[_0xcbfd('0x3')]=_0x7ba7a7[_0xcbfd('0x3')]||![];this[_0xcbfd('0x4')]=_0x7ba7a7[_0xcbfd('0x4')]||[];this[_0xcbfd('0x5')]=_0x7ba7a7['Smtp']||[];}module[_0xcbfd('0x6')]=MailAccount; \ No newline at end of file +var _0xd773=['exports','name','Service','SERV','active','Imap','Smtp'];(function(_0x12546c,_0x4678e2){var _0x49815b=function(_0x5c1493){while(--_0x5c1493){_0x12546c['push'](_0x12546c['shift']());}};_0x49815b(++_0x4678e2);}(_0xd773,0x112));var _0x3d77=function(_0x5424fb,_0x9963b7){_0x5424fb=_0x5424fb-0x0;var _0x17ae59=_0xd773[_0x5424fb];return _0x17ae59;};'use strict';var _=require('lodash');function MailAccount(_0x736671){this['id']=_0x736671['id']||0x0;this[_0x3d77('0x0')]=_0x736671[_0x3d77('0x0')]||_0x3d77('0x1');this['key']=_0x736671['key']||_0x3d77('0x2');this[_0x3d77('0x3')]=_0x736671[_0x3d77('0x3')]||![];this[_0x3d77('0x4')]=_0x736671['Imap']||[];this[_0x3d77('0x5')]=_0x736671[_0x3d77('0x5')]||[];}module[_0x3d77('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index dd1cbe3..6e13078 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08dc=['mapKeys','hasOwnProperty','mergeFromDatabase','prototype','length','merge','exports','../model/mailAccount','mailAccounts'];(function(_0x3904e9,_0x1c0782){var _0x1ba0e0=function(_0x44f87e){while(--_0x44f87e){_0x3904e9['push'](_0x3904e9['shift']());}};_0x1ba0e0(++_0x1c0782);}(_0x08dc,0x15d));var _0xc08d=function(_0x39724d,_0x28cbf2){_0x39724d=_0x39724d-0x0;var _0x14d275=_0x08dc[_0x39724d];return _0x14d275;};'use strict';var _=require('lodash');var MailAccount=require(_0xc08d('0x0'));var Realtime=function(){this[_0xc08d('0x1')]={};};function freeIsNotKey(_0xba8253,_0x1e278d,_0x114b2d){var _0x5a87d2=_[_0xc08d('0x2')](_0xba8253,function(_0x5106ca,_0x830cbf){return _0x5106ca[_0x114b2d];});for(var _0x46ce32 in _0x1e278d){if(_0x1e278d[_0xc08d('0x3')](_0x46ce32)){if(!_0x5a87d2[_0x46ce32]){delete _0x1e278d[_0x46ce32];}}}}Realtime['prototype'][_0xc08d('0x4')]=function(_0x3ce4f4,_0x192c75){for(var _0x38c956 in _0x192c75){if(_0x3ce4f4['hasOwnProperty'](_0x38c956)){_0x3ce4f4[_0x38c956]=_0x192c75[_0x38c956];}}};Realtime[_0xc08d('0x5')]['initMailAccounts']=function(){var _0x487dfa=this;return function(_0x4f6276){if(_0x4f6276){freeIsNotKey(_0x4f6276,_0x487dfa[_0xc08d('0x1')],'id');for(var _0x269ac6=0x0,_0x13b760={},_0x48efe9={};_0x269ac6<_0x4f6276[_0xc08d('0x6')];_0x269ac6+=0x1){_0x13b760=_0x4f6276[_0x269ac6];if(_['isUndefined'](_0x487dfa[_0xc08d('0x1')][_0x13b760['id']])){_0x487dfa['mailAccounts'][_0x13b760['id']]=new MailAccount(_0x13b760);}else{_[_0xc08d('0x7')](_0x487dfa[_0xc08d('0x1')][_0x13b760['id']],_0x13b760);}}}return _0x487dfa[_0xc08d('0x1')];};};module[_0xc08d('0x8')]=Realtime; \ No newline at end of file +var _0xdd11=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','merge','../model/mailAccount','mailAccounts'];(function(_0x437ee0,_0x147459){var _0x54c62c=function(_0x46bd9d){while(--_0x46bd9d){_0x437ee0['push'](_0x437ee0['shift']());}};_0x54c62c(++_0x147459);}(_0xdd11,0x96));var _0x1dd1=function(_0x2324d9,_0x28d702){_0x2324d9=_0x2324d9-0x0;var _0x4365e0=_0xdd11[_0x2324d9];return _0x4365e0;};'use strict';var _=require('lodash');var MailAccount=require(_0x1dd1('0x0'));var Realtime=function(){this[_0x1dd1('0x1')]={};};function freeIsNotKey(_0x1e552e,_0x29bc76,_0x45d9a2){var _0x2ea346=_[_0x1dd1('0x2')](_0x1e552e,function(_0x29fefb,_0x488fac){return _0x29fefb[_0x45d9a2];});for(var _0x4725f2 in _0x29bc76){if(_0x29bc76[_0x1dd1('0x3')](_0x4725f2)){if(!_0x2ea346[_0x4725f2]){delete _0x29bc76[_0x4725f2];}}}}Realtime[_0x1dd1('0x4')][_0x1dd1('0x5')]=function(_0x2be0ef,_0x468f7a){for(var _0xd8266d in _0x468f7a){if(_0x2be0ef['hasOwnProperty'](_0xd8266d)){_0x2be0ef[_0xd8266d]=_0x468f7a[_0xd8266d];}}};Realtime['prototype'][_0x1dd1('0x6')]=function(){var _0x3ac84b=this;return function(_0x42ce5e){if(_0x42ce5e){freeIsNotKey(_0x42ce5e,_0x3ac84b[_0x1dd1('0x1')],'id');for(var _0x12a5ca=0x0,_0x16e0f7={},_0x4f79a7={};_0x12a5ca<_0x42ce5e['length'];_0x12a5ca+=0x1){_0x16e0f7=_0x42ce5e[_0x12a5ca];if(_['isUndefined'](_0x3ac84b[_0x1dd1('0x1')][_0x16e0f7['id']])){_0x3ac84b['mailAccounts'][_0x16e0f7['id']]=new MailAccount(_0x16e0f7);}else{_[_0x1dd1('0x7')](_0x3ac84b[_0x1dd1('0x1')][_0x16e0f7['id']],_0x16e0f7);}}}return _0x3ac84b['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 9e39bcb..ee4da64 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a4f=['getMailAccount','notify','NotifyMailAccount','../client','Request','name','email','active','key','ListId','TemplateId','MailServerIn','Imap','Smtp'];(function(_0x5e1638,_0x33f9a9){var _0x406c6f=function(_0x13c245){while(--_0x13c245){_0x5e1638['push'](_0x5e1638['shift']());}};_0x406c6f(++_0x33f9a9);}(_0x5a4f,0x10d));var _0xf5a4=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x5a4f[_0x710815];return _0x5b3b89;};'use strict';var client=require(_0xf5a4('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xf5a4('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0xf5a4('0x2'),'service',_0xf5a4('0x3'),_0xf5a4('0x4'),_0xf5a4('0x5'),_0xf5a4('0x6'),_0xf5a4('0x7')],'raw':![],'include':[{'model':_0xf5a4('0x8'),'as':_0xf5a4('0x9')},{'model':'MailServerOut','as':_0xf5a4('0xa')}]},'log':_0xf5a4('0xb')});};};exports[_0xf5a4('0xc')]=function(_0x1e7821,_0x363fd2){return client[_0xf5a4('0x1')](_0xf5a4('0xd'),{'account':{'id':_0x1e7821},'body':_0x363fd2,'log':_0xf5a4('0xd')});}; \ No newline at end of file +var _0x42ec=['Request','GetMailAccount','name','email','key','ListId','TemplateId','MailServerIn','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x328993,_0x3fec69){var _0x1fa11e=function(_0x443ef2){while(--_0x443ef2){_0x328993['push'](_0x328993['shift']());}};_0x1fa11e(++_0x3fec69);}(_0x42ec,0x1e8));var _0xc42e=function(_0x34fa88,_0xd2b8bc){_0x34fa88=_0x34fa88-0x0;var _0x28b15f=_0x42ec[_0x34fa88];return _0x28b15f;};'use strict';var client=require(_0xc42e('0x0'));exports[_0xc42e('0x1')]=function(){return function(){return client[_0xc42e('0x2')](_0xc42e('0x3'),{'options':{'attributes':['id',_0xc42e('0x4'),'service',_0xc42e('0x5'),'active',_0xc42e('0x6'),_0xc42e('0x7'),_0xc42e('0x8')],'raw':![],'include':[{'model':_0xc42e('0x9'),'as':'Imap'},{'model':_0xc42e('0xa'),'as':'Smtp'}]},'log':_0xc42e('0xb')});};};exports[_0xc42e('0xc')]=function(_0x526754,_0x3698e7){return client[_0xc42e('0x2')](_0xc42e('0xd'),{'account':{'id':_0x526754},'body':_0x3698e7,'log':_0xc42e('0xd')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 21276fa..757083f 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1e8=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x1e6b81,_0x1eb3ec){var _0x457c87=function(_0x46f35e){while(--_0x46f35e){_0x1e6b81['push'](_0x1e6b81['shift']());}};_0x457c87(++_0x1eb3ec);}(_0xc1e8,0x1ea));var _0x8c1e=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0xc1e8[_0x2f3ecd];return _0xffdc44;};'use strict';var client=require('../client');exports[_0x8c1e('0x0')]=function(){return client[_0x8c1e('0x1')](_0x8c1e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8c1e('0x3')]},'log':_0x8c1e('0x4')});}; \ No newline at end of file +var _0xa435=['getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x260741,_0x462e5d){var _0x31b0eb=function(_0x543a3){while(--_0x543a3){_0x260741['push'](_0x260741['shift']());}};_0x31b0eb(++_0x462e5d);}(_0xa435,0x1e4));var _0x5a43=function(_0x382857,_0x225a21){_0x382857=_0x382857-0x0;var _0x4384c7=_0xa435[_0x382857];return _0x4384c7;};'use strict';var client=require('../client');exports[_0x5a43('0x0')]=function(){return client['Request'](_0x5a43('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5a43('0x2')]},'log':_0x5a43('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7d42ea3..ceb9261 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 51a0787..2951efd 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72e7=['defaults','localhost','adapter','socket.io-redis','../../config/socketio','../../config/express','default','../../routes','listening','log','exports','lodash','http','express','ioredis','createServer','listen','port','socket.io','websocket','polling','redis'];(function(_0x34e2a8,_0x4abfdc){var _0x48af1a=function(_0x3286c9){while(--_0x3286c9){_0x34e2a8['push'](_0x34e2a8['shift']());}};_0x48af1a(++_0x4abfdc);}(_0x72e7,0x79));var _0x772e=function(_0x2006e7,_0x5e564e){_0x2006e7=_0x2006e7-0x0;var _0x5a2174=_0x72e7[_0x2006e7];return _0x5a2174;};'use strict';var _=require(_0x772e('0x0'));var http=require(_0x772e('0x1'));var express=require(_0x772e('0x2'));var sticky=require('sticky-session');var Redis=require(_0x772e('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x772e('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0x772e('0x5')](server,config[_0x772e('0x6')])){var socketio=require(_0x772e('0x7'))(server,{'transports':[_0x772e('0x8'),_0x772e('0x9')]});config[_0x772e('0xa')]=_[_0x772e('0xb')](config[_0x772e('0xa')],{'host':_0x772e('0xc'),'port':0x18eb});socketio[_0x772e('0xd')](require(_0x772e('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x772e('0xa')])}));require('../../config/triggers')['default']();require(_0x772e('0xf'))['default'](socketio);require(_0x772e('0x10'))[_0x772e('0x11')](app);require(_0x772e('0x12'))[_0x772e('0x11')](app);}else{server['once'](_0x772e('0x13'),function(){console[_0x772e('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x772e('0x6')]);});}exports=module[_0x772e('0x15')]=app; \ No newline at end of file +var _0x7def=['polling','defaults','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','../../config/environment','timeout','listen','port','socket.io'];(function(_0x2978e1,_0x26b3f5){var _0xca0ea8=function(_0x289c2e){while(--_0x289c2e){_0x2978e1['push'](_0x2978e1['shift']());}};_0xca0ea8(++_0x26b3f5);}(_0x7def,0x14d));var _0xf7de=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7def[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xf7de('0x0'));var http=require(_0xf7de('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xf7de('0x2'));var app=express();var server=http['createServer'](app);server[_0xf7de('0x3')]=0xdbba0;if(sticky[_0xf7de('0x4')](server,config[_0xf7de('0x5')])){var socketio=require(_0xf7de('0x6'))(server,{'transports':['websocket',_0xf7de('0x7')]});config['redis']=_[_0xf7de('0x8')](config[_0xf7de('0x9')],{'host':'localhost','port':0x18eb});socketio[_0xf7de('0xa')](require(_0xf7de('0xb'))({'pubClient':new Redis(config[_0xf7de('0x9')]),'subClient':new Redis(config[_0xf7de('0x9')])}));require(_0xf7de('0xc'))[_0xf7de('0xd')]();require(_0xf7de('0xe'))['default'](socketio);require(_0xf7de('0xf'))['default'](app);require(_0xf7de('0x10'))['default'](app);}else{server['once'](_0xf7de('0x11'),function(){console['log'](_0xf7de('0x12'),config[_0xf7de('0x5')]);});}exports=module[_0xf7de('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 3d624cb..f0579f0 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce14=['message','result','catch','exports','jayson/promise','bluebird','routing','http','Request','then','debug','rpc','error'];(function(_0x4edfa0,_0x2782e3){var _0x5ad165=function(_0x4f70af){while(--_0x4f70af){_0x4edfa0['push'](_0x4edfa0['shift']());}};_0x5ad165(++_0x2782e3);}(_0xce14,0x156));var _0x4ce1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xce14[_0x1facfa];return _0x9ec701;};'use strict';var jayson=require(_0x4ce1('0x0'));var BPromise=require(_0x4ce1('0x1'));var logger=require('../../config/logger')(_0x4ce1('0x2'));var client=jayson['client'][_0x4ce1('0x3')]({'port':0x2329});client[_0x4ce1('0x4')]=function(_0x126f9a,_0x5283e0){return new BPromise(function(_0x1b8ac7,_0x3f663c){return client['request'](_0x126f9a,_0x5283e0)[_0x4ce1('0x5')](function(_0x507fe4){logger[_0x4ce1('0x6')](_0x4ce1('0x7'),_0x4ce1('0x2'),_0x126f9a,_0x5283e0,_0x507fe4);if(_0x507fe4[_0x4ce1('0x8')]){logger[_0x4ce1('0x8')](_0x4ce1('0x7'),_0x4ce1('0x2'),_0x126f9a,_0x507fe4[_0x4ce1('0x8')][_0x4ce1('0x9')],_0x5283e0);return _0x3f663c(_0x507fe4[_0x4ce1('0x8')][_0x4ce1('0x9')]);}else{return _0x1b8ac7(_0x507fe4[_0x4ce1('0xa')]);}})[_0x4ce1('0xb')](function(_0x4ba37e){logger[_0x4ce1('0x8')](_0x4ce1('0x7'),_0x4ce1('0x2'),_0x126f9a,_0x4ba37e,_0x5283e0);return _0x3f663c(_0x4ba37e);});});};module[_0x4ce1('0xc')]=client; \ No newline at end of file +var _0xa426=['client','http','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa426,0x176));var _0x6a42=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xa426[_0x11005e];return _0x29338f;};'use strict';var jayson=require(_0x6a42('0x0'));var BPromise=require(_0x6a42('0x1'));var logger=require(_0x6a42('0x2'))(_0x6a42('0x3'));var client=jayson[_0x6a42('0x4')][_0x6a42('0x5')]({'port':0x2329});client['Request']=function(_0x1be1d3,_0xb13736){return new BPromise(function(_0xa58ca0,_0x3a8e3d){return client['request'](_0x1be1d3,_0xb13736)[_0x6a42('0x6')](function(_0x1b814c){logger[_0x6a42('0x7')](_0x6a42('0x8'),_0x6a42('0x3'),_0x1be1d3,_0xb13736,_0x1b814c);if(_0x1b814c[_0x6a42('0x9')]){logger[_0x6a42('0x9')](_0x6a42('0x8'),_0x6a42('0x3'),_0x1be1d3,_0x1b814c['error']['message'],_0xb13736);return _0x3a8e3d(_0x1b814c['error'][_0x6a42('0xa')]);}else{return _0xa58ca0(_0x1b814c[_0x6a42('0xb')]);}})[_0x6a42('0xc')](function(_0x6c6726){logger[_0x6a42('0x9')]('rpc',_0x6a42('0x3'),_0x1be1d3,_0x6c6726,_0xb13736);return _0x3a8e3d(_0x6c6726);});});};module[_0x6a42('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index cc1ef50..4d2f79b 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x055f=['initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues'];(function(_0x5e206c,_0x5888a8){var _0x33686b=function(_0x1940a7){while(--_0x1940a7){_0x5e206c['push'](_0x5e206c['shift']());}};_0x33686b(++_0x5888a8);}(_0x055f,0x98));var _0xf055=function(_0x1594e5,_0x275cbc){_0x1594e5=_0x1594e5-0x0;var _0xa91ecb=_0x055f[_0x1594e5];return _0xa91ecb;};'use strict';var BPromise=require('bluebird');var server=require(_0xf055('0x0'));var Realtime=require(_0xf055('0x1'));var user=require(_0xf055('0x2'));var interval=require(_0xf055('0x3'));var openchannelQueue=require(_0xf055('0x4'));var chatQueue=require(_0xf055('0x5'));var smsQueue=require(_0xf055('0x6'));var mailQueue=require(_0xf055('0x7'));var faxQueue=require(_0xf055('0x8'));var whatsappQueue=require(_0xf055('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xf055('0xa')](user[_0xf055('0xb')]())[_0xf055('0xa')](realtime[_0xf055('0xc')]())['then'](interval[_0xf055('0xd')]())['then'](realtime[_0xf055('0xe')]())[_0xf055('0xa')](openchannelQueue['getOpenchannelQueues']())[_0xf055('0xa')](realtime[_0xf055('0xf')]())[_0xf055('0xa')](chatQueue['getChatQueues']())[_0xf055('0xa')](realtime[_0xf055('0x10')]())[_0xf055('0xa')](smsQueue[_0xf055('0x11')]())['then'](realtime[_0xf055('0x12')]())[_0xf055('0xa')](mailQueue['getMailQueues']())[_0xf055('0xa')](realtime['initMailQueues']())['then'](faxQueue[_0xf055('0x13')]())[_0xf055('0xa')](realtime[_0xf055('0x14')]())[_0xf055('0xa')](whatsappQueue[_0xf055('0x15')]())[_0xf055('0xa')](realtime['initWhatsappQueues']())[_0xf055('0xa')](function(){return realtime;});}function main(){return server[_0xf055('0x16')](realtime)[_0xf055('0xa')](function(_0x502978){return initRealtime();})[_0xf055('0xa')](function(_0x58b03e){return setInterval(initRealtime,0x1388);})['catch'](function(_0x47924a){console[_0xf055('0x17')](_0x47924a);});}main(); \ No newline at end of file +var _0xcb1f=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./realtime','./rpc/user'];(function(_0x4ea55b,_0x4e69a2){var _0x43bfef=function(_0x52d69e){while(--_0x52d69e){_0x4ea55b['push'](_0x4ea55b['shift']());}};_0x43bfef(++_0x4e69a2);}(_0xcb1f,0x93));var _0xfcb1=function(_0x23d8f6,_0x32022){_0x23d8f6=_0x23d8f6-0x0;var _0x1125d2=_0xcb1f[_0x23d8f6];return _0x1125d2;};'use strict';var BPromise=require(_0xfcb1('0x0'));var server=require('./server');var Realtime=require(_0xfcb1('0x1'));var user=require(_0xfcb1('0x2'));var interval=require(_0xfcb1('0x3'));var openchannelQueue=require(_0xfcb1('0x4'));var chatQueue=require(_0xfcb1('0x5'));var smsQueue=require(_0xfcb1('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xfcb1('0x7'));var whatsappQueue=require(_0xfcb1('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xfcb1('0x9')]()[_0xfcb1('0xa')](user[_0xfcb1('0xb')]())[_0xfcb1('0xa')](realtime['initAgents']())[_0xfcb1('0xa')](interval[_0xfcb1('0xc')]())['then'](realtime[_0xfcb1('0xd')]())[_0xfcb1('0xa')](openchannelQueue[_0xfcb1('0xe')]())['then'](realtime[_0xfcb1('0xf')]())['then'](chatQueue['getChatQueues']())['then'](realtime[_0xfcb1('0x10')]())[_0xfcb1('0xa')](smsQueue[_0xfcb1('0x11')]())[_0xfcb1('0xa')](realtime[_0xfcb1('0x12')]())[_0xfcb1('0xa')](mailQueue[_0xfcb1('0x13')]())['then'](realtime[_0xfcb1('0x14')]())[_0xfcb1('0xa')](faxQueue['getFaxQueues']())[_0xfcb1('0xa')](realtime[_0xfcb1('0x15')]())[_0xfcb1('0xa')](whatsappQueue['getWhatsappQueues']())[_0xfcb1('0xa')](realtime[_0xfcb1('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0xfcb1('0x17')](realtime)['then'](function(_0x4bfe0e){return initRealtime();})[_0xfcb1('0xa')](function(_0x3cf676){return setInterval(initRealtime,0x1388);})[_0xfcb1('0x18')](function(_0xe05c9){console['log'](_0xe05c9);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index fdd07ca..c000b05 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x2034a8,_0xdf1da){var _0x4c330d=function(_0x408206){while(--_0x408206){_0x2034a8['push'](_0x2034a8['shift']());}};_0x4c330d(++_0xdf1da);}(_0xe14b,0x93));var _0xbe14=function(_0x9c5ebe,_0x19884c){_0x9c5ebe=_0x9c5ebe-0x0;var _0x39a068=_0xe14b[_0x9c5ebe];return _0x39a068;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x4d9442,_0x1e784a){var _0x5b0d83=function(_0x42a07e){while(--_0x42a07e){_0x4d9442['push'](_0x4d9442['shift']());}};_0x5b0d83(++_0x1e784a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0x5fc3[_0x211bc3];return _0x34c9a2;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 73b7f81..2cf7a26 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb67=['http','then','error','message','result','SendMail','bluebird','jayson/promise'];(function(_0x174728,_0x205bb4){var _0x53e467=function(_0x417272){while(--_0x417272){_0x174728['push'](_0x174728['shift']());}};_0x53e467(++_0x205bb4);}(_0xfb67,0x136));var _0x7fb6=function(_0x2c8a08,_0x3795f5){_0x2c8a08=_0x2c8a08-0x0;var _0x2b8170=_0xfb67[_0x2c8a08];return _0x2b8170;};'use strict';var BPromise=require(_0x7fb6('0x0'));var jayson=require(_0x7fb6('0x1'));var client=jayson['client'][_0x7fb6('0x2')]({'port':0x232b});function request(_0x4f1f96,_0x3a0601){return new BPromise(function(_0x13c5e8,_0x2eeb51){return client['request'](_0x4f1f96,_0x3a0601)[_0x7fb6('0x3')](function(_0x4df8c9){if(_0x4df8c9[_0x7fb6('0x4')]){return _0x2eeb51(_0x4df8c9[_0x7fb6('0x4')][_0x7fb6('0x5')]);}else{return _0x13c5e8(_0x4df8c9[_0x7fb6('0x6')]);}})['catch'](function(_0x185d62){return _0x2eeb51(_0x185d62);});});}exports['sendMailMessage']=function(_0x10fd5,_0x3911d9){return request(_0x7fb6('0x7'),{'account':_0x10fd5,'message':_0x3911d9});}; \ No newline at end of file +var _0xf35b=['jayson/promise','client','http','request','then','error','message','result','catch','SendMail','bluebird'];(function(_0x4b765b,_0x575c18){var _0x5c886a=function(_0x4eae8a){while(--_0x4eae8a){_0x4b765b['push'](_0x4b765b['shift']());}};_0x5c886a(++_0x575c18);}(_0xf35b,0x112));var _0xbf35=function(_0x7ee55c,_0x4ee622){_0x7ee55c=_0x7ee55c-0x0;var _0x1cf8b1=_0xf35b[_0x7ee55c];return _0x1cf8b1;};'use strict';var BPromise=require(_0xbf35('0x0'));var jayson=require(_0xbf35('0x1'));var client=jayson[_0xbf35('0x2')][_0xbf35('0x3')]({'port':0x232b});function request(_0x4d8e55,_0x56a4c8){return new BPromise(function(_0x1a33dd,_0x13a43b){return client[_0xbf35('0x4')](_0x4d8e55,_0x56a4c8)[_0xbf35('0x5')](function(_0x24c274){if(_0x24c274[_0xbf35('0x6')]){return _0x13a43b(_0x24c274[_0xbf35('0x6')][_0xbf35('0x7')]);}else{return _0x1a33dd(_0x24c274[_0xbf35('0x8')]);}})[_0xbf35('0x9')](function(_0x559041){return _0x13a43b(_0x559041);});});}exports['sendMailMessage']=function(_0xbf5715,_0x2017e5){return request(_0xbf35('0xa'),{'account':_0xbf5715,'message':_0x2017e5});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index abf796c..48ef68b 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7035=['busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','sms','length','Status','toNumber','whatsappCurrentCapacity','openchannelStatus','openchannelCurrentCapacity','stringify','emit','user:save','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatusTime','openchannelCapacity','busy'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7035,0x15e));var _0x5703=function(_0x1bd6c2,_0x4c3d37){_0x1bd6c2=_0x1bd6c2-0x0;var _0x919b17=_0x7035[_0x1bd6c2];return _0x919b17;};'use strict';var _=require(_0x5703('0x0'));var moment=require('moment');var md5=require(_0x5703('0x1'));var Redis=require(_0x5703('0x2'));var config=require('../../../config/environment');config[_0x5703('0x3')]=_[_0x5703('0x4')](config[_0x5703('0x3')],{'host':_0x5703('0x5'),'port':0x18eb});var io=require(_0x5703('0x6'))(new Redis(config['redis']));function Agent(_0x37b0c8){this['id']=_0x37b0c8['id']||0x0;this[_0x5703('0x7')]=_0x37b0c8['name']||'';this[_0x5703('0x8')]=_0x37b0c8[_0x5703('0x8')]||!![];this[_0x5703('0x9')]=_0x37b0c8[_0x5703('0x9')]||![];this[_0x5703('0xa')]=_0x37b0c8[_0x5703('0xa')]||![];this['mailPause']=_0x37b0c8['mailPause']||![];this[_0x5703('0xb')]=_0x37b0c8['faxPause']||![];this[_0x5703('0xc')]=_0x37b0c8['smsPause']||![];this['openchannelPause']=_0x37b0c8[_0x5703('0xd')]||![];this[_0x5703('0xe')]=_0x5703('0xf');this['chatStatusTime']=0x0;this[_0x5703('0x10')]=_0x37b0c8['chatCapacity']||0x0;this[_0x5703('0x11')]=0x0;this[_0x5703('0x12')]=_0x5703('0xf');this[_0x5703('0x13')]=0x0;this[_0x5703('0x14')]=_0x37b0c8[_0x5703('0x14')]||0x0;this[_0x5703('0x15')]=0x0;this[_0x5703('0x16')]=_0x5703('0xf');this[_0x5703('0x17')]=0x0;this[_0x5703('0x18')]=_0x37b0c8['faxCapacity']||0x0;this[_0x5703('0x19')]=0x0;this[_0x5703('0x1a')]=_0x5703('0xf');this[_0x5703('0x1b')]=0x0;this[_0x5703('0x1c')]=_0x37b0c8[_0x5703('0x1c')]||0x0;this[_0x5703('0x1d')]=0x0;this[_0x5703('0x1e')]=_0x5703('0xf');this['whatsappStatusTime']=0x0;this[_0x5703('0x1f')]=_0x37b0c8[_0x5703('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x5703('0xf');this[_0x5703('0x20')]=0x0;this['openchannelCapacity']=_0x37b0c8[_0x5703('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x5703('0x22')]=![];this[_0x5703('0x23')]=undefined;this[_0x5703('0x1')]='';this[_0x5703('0x24')]();}Agent[_0x5703('0x25')][_0x5703('0x26')]=function(_0x175ed0){if(this[_0x175ed0+'CurrentCapacity']>0x0){if(this[_0x175ed0+'Capacity']>0x0&&this[_0x175ed0+_0x5703('0x27')]>=this[_0x175ed0+_0x5703('0x28')]){return'maxcapacity';}else{return _0x5703('0x29');}}else{return _0x5703('0x2a');}};Agent['prototype'][_0x5703('0x24')]=function(){var _0x25a56e=[_0x5703('0x2b'),'chat','openchannel','fax',_0x5703('0x2c'),'whatsapp'];for(var _0x28460a=0x0;_0x28460a<_0x25a56e[_0x5703('0x2d')];_0x28460a+=0x1){var _0x46ad74=this[_0x5703('0x26')](_0x25a56e[_0x28460a]);if(this[_0x25a56e[_0x28460a]+_0x5703('0x2e')]!==_0x46ad74){this[_0x25a56e[_0x28460a]+'StatusTime']=_[_0x5703('0x2f')](moment()['format']('x'));}this[_0x25a56e[_0x28460a]+_0x5703('0x2e')]=_0x46ad74;}var _0xe4207f={'id':this['id'],'name':this[_0x5703('0x7')],'online':this['online'],'voicePause':this[_0x5703('0x9')],'chatPause':this[_0x5703('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x5703('0xc')],'faxPause':this[_0x5703('0xb')],'openchannelPause':this[_0x5703('0xd')],'chatStatus':this[_0x5703('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x5703('0x11')],'mailStatus':this[_0x5703('0x12')],'mailStatusTime':this[_0x5703('0x13')],'mailCapacity':this[_0x5703('0x14')],'mailCurrentCapacity':this[_0x5703('0x15')],'faxStatus':this[_0x5703('0x16')],'faxStatusTime':this[_0x5703('0x17')],'faxCapacity':this[_0x5703('0x18')],'faxCurrentCapacity':this[_0x5703('0x19')],'smsStatus':this[_0x5703('0x1a')],'smsStatusTime':this[_0x5703('0x1b')],'smsCapacity':this[_0x5703('0x1c')],'smsCurrentCapacity':this[_0x5703('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x5703('0x30')],'openchannelStatus':this[_0x5703('0x31')],'openchannelStatusTime':this[_0x5703('0x20')],'openchannelCapacity':this[_0x5703('0x21')],'openchannelCurrentCapacity':this[_0x5703('0x32')],'busy':this['busy'],'busyQueue':this[_0x5703('0x23')]};var _0x2c2468=md5(JSON[_0x5703('0x33')](_0xe4207f));if(this['md5']!==_0x2c2468){this[_0x5703('0x1')]=_0x2c2468;io[_0x5703('0x34')](_0x5703('0x35'),_0xe4207f);}};module[_0x5703('0x36')]=Agent; \ No newline at end of file +var _0xceb5=['sms','whatsapp','length','Status','StatusTime','format','faxCapacity','user:save','exports','lodash','moment','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax'];(function(_0x17442b,_0x228032){var _0x5cfdba=function(_0x483be4){while(--_0x483be4){_0x17442b['push'](_0x17442b['shift']());}};_0x5cfdba(++_0x228032);}(_0xceb5,0x81));var _0x5ceb=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0xceb5[_0x450689];return _0x46ffb0;};'use strict';var _=require(_0x5ceb('0x0'));var moment=require(_0x5ceb('0x1'));var md5=require('md5');var Redis=require(_0x5ceb('0x2'));var config=require('../../../config/environment');config[_0x5ceb('0x3')]=_[_0x5ceb('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5ceb('0x5'))(new Redis(config['redis']));function Agent(_0x5890a3){this['id']=_0x5890a3['id']||0x0;this[_0x5ceb('0x6')]=_0x5890a3['name']||'';this[_0x5ceb('0x7')]=_0x5890a3[_0x5ceb('0x7')]||!![];this[_0x5ceb('0x8')]=_0x5890a3[_0x5ceb('0x8')]||![];this[_0x5ceb('0x9')]=_0x5890a3['chatPause']||![];this[_0x5ceb('0xa')]=_0x5890a3[_0x5ceb('0xa')]||![];this[_0x5ceb('0xb')]=_0x5890a3['faxPause']||![];this['smsPause']=_0x5890a3[_0x5ceb('0xc')]||![];this[_0x5ceb('0xd')]=_0x5890a3['openchannelPause']||![];this[_0x5ceb('0xe')]=_0x5ceb('0xf');this[_0x5ceb('0x10')]=0x0;this[_0x5ceb('0x11')]=_0x5890a3[_0x5ceb('0x11')]||0x0;this[_0x5ceb('0x12')]=0x0;this[_0x5ceb('0x13')]=_0x5ceb('0xf');this[_0x5ceb('0x14')]=0x0;this[_0x5ceb('0x15')]=_0x5890a3[_0x5ceb('0x15')]||0x0;this[_0x5ceb('0x16')]=0x0;this[_0x5ceb('0x17')]=_0x5ceb('0xf');this[_0x5ceb('0x18')]=0x0;this['faxCapacity']=_0x5890a3['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x5ceb('0x19')]='unknown';this[_0x5ceb('0x1a')]=0x0;this[_0x5ceb('0x1b')]=_0x5890a3['smsCapacity']||0x0;this[_0x5ceb('0x1c')]=0x0;this[_0x5ceb('0x1d')]=_0x5ceb('0xf');this['whatsappStatusTime']=0x0;this[_0x5ceb('0x1e')]=_0x5890a3[_0x5ceb('0x1e')]||0x0;this[_0x5ceb('0x1f')]=0x0;this[_0x5ceb('0x20')]=_0x5ceb('0xf');this[_0x5ceb('0x21')]=0x0;this['openchannelCapacity']=_0x5890a3[_0x5ceb('0x22')]||0x0;this[_0x5ceb('0x23')]=0x0;this[_0x5ceb('0x24')]=![];this[_0x5ceb('0x25')]=undefined;this[_0x5ceb('0x26')]='';this[_0x5ceb('0x27')]();}Agent[_0x5ceb('0x28')][_0x5ceb('0x29')]=function(_0x49672c){if(this[_0x49672c+_0x5ceb('0x2a')]>0x0){if(this[_0x49672c+_0x5ceb('0x2b')]>0x0&&this[_0x49672c+'CurrentCapacity']>=this[_0x49672c+_0x5ceb('0x2b')]){return _0x5ceb('0x2c');}else{return _0x5ceb('0x2d');}}else{return _0x5ceb('0x2e');}};Agent[_0x5ceb('0x28')][_0x5ceb('0x27')]=function(){var _0x422b10=[_0x5ceb('0x2f'),_0x5ceb('0x30'),_0x5ceb('0x31'),_0x5ceb('0x32'),_0x5ceb('0x33'),_0x5ceb('0x34')];for(var _0x46d91e=0x0;_0x46d91e<_0x422b10[_0x5ceb('0x35')];_0x46d91e+=0x1){var _0x33eb34=this['getChannelStatus'](_0x422b10[_0x46d91e]);if(this[_0x422b10[_0x46d91e]+_0x5ceb('0x36')]!==_0x33eb34){this[_0x422b10[_0x46d91e]+_0x5ceb('0x37')]=_['toNumber'](moment()[_0x5ceb('0x38')]('x'));}this[_0x422b10[_0x46d91e]+_0x5ceb('0x36')]=_0x33eb34;}var _0x395e56={'id':this['id'],'name':this[_0x5ceb('0x6')],'online':this[_0x5ceb('0x7')],'voicePause':this[_0x5ceb('0x8')],'chatPause':this[_0x5ceb('0x9')],'mailPause':this[_0x5ceb('0xa')],'smsPause':this[_0x5ceb('0xc')],'faxPause':this[_0x5ceb('0xb')],'openchannelPause':this[_0x5ceb('0xd')],'chatStatus':this[_0x5ceb('0xe')],'chatStatusTime':this[_0x5ceb('0x10')],'chatCapacity':this[_0x5ceb('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x5ceb('0x13')],'mailStatusTime':this[_0x5ceb('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x5ceb('0x17')],'faxStatusTime':this[_0x5ceb('0x18')],'faxCapacity':this[_0x5ceb('0x39')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x5ceb('0x1b')],'smsCurrentCapacity':this[_0x5ceb('0x1c')],'whatsappStatus':this[_0x5ceb('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x5ceb('0x1e')],'whatsappCurrentCapacity':this[_0x5ceb('0x1f')],'openchannelStatus':this[_0x5ceb('0x20')],'openchannelStatusTime':this[_0x5ceb('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x5ceb('0x23')],'busy':this[_0x5ceb('0x24')],'busyQueue':this[_0x5ceb('0x25')]};var _0x9474ff=md5(JSON['stringify'](_0x395e56));if(this[_0x5ceb('0x26')]!==_0x9474ff){this[_0x5ceb('0x26')]=_0x9474ff;io['emit'](_0x5ceb('0x3a'),_0x395e56);}};module[_0x5ceb('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index e7b0bcf..0320fb3 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 _0x3298=['lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','mapAgentsId','updateRealtime','_rr','map','Agents','prototype','paused','length','online','chatPause','available','loggedIn','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports'];(function(_0x300c89,_0x25fcad){var _0x41762e=function(_0x5b852f){while(--_0x5b852f){_0x300c89['push'](_0x300c89['shift']());}};_0x41762e(++_0x25fcad);}(_0x3298,0x1a4));var _0x8329=function(_0x542fb2,_0x5ebf97){_0x542fb2=_0x542fb2-0x0;var _0x258bab=_0x3298[_0x542fb2];return _0x258bab;};'use strict';var _=require(_0x8329('0x0'));var md5=require(_0x8329('0x1'));var util=require(_0x8329('0x2'));var Redis=require(_0x8329('0x3'));var config=require('../../../config/environment');config[_0x8329('0x4')]=_[_0x8329('0x5')](config[_0x8329('0x4')],{'host':_0x8329('0x6'),'port':0x18eb});var io=require(_0x8329('0x7'))(new Redis(config['redis']));function ChatQueue(_0x28d8fc){this['id']=_0x28d8fc['id']||0x0;this['name']=_0x28d8fc[_0x8329('0x8')]||'';this['timeout']=_0x28d8fc['timeout']||0xa;this[_0x8329('0x9')]=_0x28d8fc['strategy']||_0x8329('0xa');this['Agents']=_0x28d8fc['Agents'];this[_0x8329('0xb')]={};this['waiting']=0x0;this[_0x8329('0x1')]='';this['updateRouting']();this[_0x8329('0xc')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x30cccd=this[_0x8329('0xb')][_0x8329('0xd')];this['mapAgentsId']=_[_0x8329('0xe')](this[_0x8329('0xf')],'id');this[_0x8329('0xb')][_0x8329('0xd')]=_0x30cccd;};ChatQueue[_0x8329('0x10')][_0x8329('0xc')]=function(){this['loggedIn']=0x0;this[_0x8329('0x11')]=0x0;for(var _0x275b58=0x0;_0x275b58=0x0?this[_0x8329('0x15')]:0x0;var _0x38e4db={'id':this['id'],'available':this[_0x8329('0x15')],'loggedIn':this[_0x8329('0x16')],'name':this[_0x8329('0x8')],'paused':this[_0x8329('0x11')],'waiting':this[_0x8329('0x17')]};var _0x190605=md5(JSON[_0x8329('0x18')](_0x38e4db));if(this['md5']!==_0x190605){this['md5']=_0x190605;io['to'](util[_0x8329('0x19')](_0x8329('0x1a'),_0x38e4db['name']))[_0x8329('0x1b')](_0x8329('0x1c'),_0x38e4db);}};module[_0x8329('0x1d')]=ChatQueue; \ No newline at end of file +var _0xdceb=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name'];(function(_0x293ba2,_0x4070f8){var _0x5e881e=function(_0x37d131){while(--_0x37d131){_0x293ba2['push'](_0x293ba2['shift']());}};_0x5e881e(++_0x4070f8);}(_0xdceb,0xac));var _0xbdce=function(_0x32dfaa,_0x3938f3){_0x32dfaa=_0x32dfaa-0x0;var _0x330d7e=_0xdceb[_0x32dfaa];return _0x330d7e;};'use strict';var _=require(_0xbdce('0x0'));var md5=require('md5');var util=require(_0xbdce('0x1'));var Redis=require(_0xbdce('0x2'));var config=require(_0xbdce('0x3'));config[_0xbdce('0x4')]=_[_0xbdce('0x5')](config[_0xbdce('0x4')],{'host':_0xbdce('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x4f47fb){this['id']=_0x4f47fb['id']||0x0;this[_0xbdce('0x7')]=_0x4f47fb[_0xbdce('0x7')]||'';this[_0xbdce('0x8')]=_0x4f47fb[_0xbdce('0x8')]||0xa;this[_0xbdce('0x9')]=_0x4f47fb['strategy']||_0xbdce('0xa');this['Agents']=_0x4f47fb[_0xbdce('0xb')];this[_0xbdce('0xc')]={};this[_0xbdce('0xd')]=0x0;this[_0xbdce('0xe')]='';this[_0xbdce('0xf')]();this['updateRealtime']();}ChatQueue[_0xbdce('0x10')]['updateRouting']=function(){var _0x5a29ea=this[_0xbdce('0xc')][_0xbdce('0x11')];this[_0xbdce('0xc')]=_[_0xbdce('0x12')](this['Agents'],'id');this[_0xbdce('0xc')][_0xbdce('0x11')]=_0x5a29ea;};ChatQueue[_0xbdce('0x10')][_0xbdce('0x13')]=function(){this[_0xbdce('0x14')]=0x0;this[_0xbdce('0x15')]=0x0;for(var _0x316def=0x0;_0x316def=0x0?this[_0xbdce('0x19')]:0x0;var _0x1427e6={'id':this['id'],'available':this[_0xbdce('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xbdce('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x3d2179=md5(JSON['stringify'](_0x1427e6));if(this[_0xbdce('0xe')]!==_0x3d2179){this[_0xbdce('0xe')]=_0x3d2179;io['to'](util['format'](_0xbdce('0x1a'),_0x1427e6[_0xbdce('0x7')]))[_0xbdce('0x1b')](_0xbdce('0x1c'),_0x1427e6);}};module[_0xbdce('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 43cd2df..1e5b5e3 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 _0x30cd=['ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','faxPause','paused','available','waiting','stringify','format','emit','fax_queue:save','exports','lodash','md5','util'];(function(_0x2bc3c7,_0x2fe4de){var _0x10c064=function(_0x30cc7f){while(--_0x30cc7f){_0x2bc3c7['push'](_0x2bc3c7['shift']());}};_0x10c064(++_0x2fe4de);}(_0x30cd,0xcf));var _0xd30c=function(_0x244e6e,_0x2909d2){_0x244e6e=_0x244e6e-0x0;var _0x46776c=_0x30cd[_0x244e6e];return _0x46776c;};'use strict';var _=require(_0xd30c('0x0'));var md5=require(_0xd30c('0x1'));var util=require(_0xd30c('0x2'));var Redis=require(_0xd30c('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xd30c('0x4')],{'host':_0xd30c('0x5'),'port':0x18eb});var io=require(_0xd30c('0x6'))(new Redis(config[_0xd30c('0x4')]));function FaxQueue(_0x4d0d66){this['id']=_0x4d0d66['id']||0x0;this['name']=_0x4d0d66[_0xd30c('0x7')]||'';this[_0xd30c('0x8')]=_0x4d0d66[_0xd30c('0x8')]||0xa;this[_0xd30c('0x9')]=_0x4d0d66[_0xd30c('0x9')]||_0xd30c('0xa');this[_0xd30c('0xb')]=_0x4d0d66[_0xd30c('0xb')];this[_0xd30c('0xc')]={};this['waiting']=0x0;this[_0xd30c('0x1')]='';this[_0xd30c('0xd')]();this[_0xd30c('0xe')]();}FaxQueue[_0xd30c('0xf')]['updateRouting']=function(){var _0x7a3fee=this[_0xd30c('0xc')][_0xd30c('0x10')];this[_0xd30c('0xc')]=_[_0xd30c('0x11')](this['Agents'],'id');this[_0xd30c('0xc')][_0xd30c('0x10')]=_0x7a3fee;};FaxQueue['prototype']['updateRealtime']=function(){this[_0xd30c('0x12')]=0x0;this['paused']=0x0;for(var _0x175f02=0x0;_0x175f02=0x0?this['available']:0x0;var _0x142a9b={'id':this['id'],'available':this[_0xd30c('0x17')],'loggedIn':this[_0xd30c('0x12')],'name':this['name'],'paused':this[_0xd30c('0x16')],'waiting':this[_0xd30c('0x18')]};var _0x33adb0=md5(JSON[_0xd30c('0x19')](_0x142a9b));if(this[_0xd30c('0x1')]!==_0x33adb0){this[_0xd30c('0x1')]=_0x33adb0;io['to'](util[_0xd30c('0x1a')]('fax:queue:%s',_0x142a9b[_0xd30c('0x7')]))[_0xd30c('0x1b')](_0xd30c('0x1c'),_0x142a9b);}};module[_0xd30c('0x1d')]=FaxQueue; \ No newline at end of file +var _0xdc77=['prototype','updateRouting','map','loggedIn','paused','online','available','waiting','format','fax:queue:%s','emit','lodash','util','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRealtime'];(function(_0x2dd976,_0x1b5dc4){var _0x2265fd=function(_0x270d24){while(--_0x270d24){_0x2dd976['push'](_0x2dd976['shift']());}};_0x2265fd(++_0x1b5dc4);}(_0xdc77,0xfb));var _0x7dc7=function(_0x4fdd31,_0x827929){_0x4fdd31=_0x4fdd31-0x0;var _0x4a2d79=_0xdc77[_0x4fdd31];return _0x4a2d79;};'use strict';var _=require(_0x7dc7('0x0'));var md5=require('md5');var util=require(_0x7dc7('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x7dc7('0x2')]=_[_0x7dc7('0x3')](config[_0x7dc7('0x2')],{'host':_0x7dc7('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x83e93a){this['id']=_0x83e93a['id']||0x0;this[_0x7dc7('0x5')]=_0x83e93a['name']||'';this[_0x7dc7('0x6')]=_0x83e93a[_0x7dc7('0x6')]||0xa;this[_0x7dc7('0x7')]=_0x83e93a[_0x7dc7('0x7')]||_0x7dc7('0x8');this['Agents']=_0x83e93a[_0x7dc7('0x9')];this[_0x7dc7('0xa')]={};this['waiting']=0x0;this[_0x7dc7('0xb')]='';this['updateRouting']();this[_0x7dc7('0xc')]();}FaxQueue[_0x7dc7('0xd')][_0x7dc7('0xe')]=function(){var _0x3a23f8=this[_0x7dc7('0xa')]['_rr'];this['mapAgentsId']=_[_0x7dc7('0xf')](this[_0x7dc7('0x9')],'id');this[_0x7dc7('0xa')]['_rr']=_0x3a23f8;};FaxQueue[_0x7dc7('0xd')]['updateRealtime']=function(){this[_0x7dc7('0x10')]=0x0;this[_0x7dc7('0x11')]=0x0;for(var _0x44a6f5=0x0;_0x44a6f5=0x0?this[_0x7dc7('0x13')]:0x0;var _0x2e886a={'id':this['id'],'available':this[_0x7dc7('0x13')],'loggedIn':this[_0x7dc7('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x7dc7('0x14')]};var _0x52c205=md5(JSON['stringify'](_0x2e886a));if(this['md5']!==_0x52c205){this[_0x7dc7('0xb')]=_0x52c205;io['to'](util[_0x7dc7('0x15')](_0x7dc7('0x16'),_0x2e886a[_0x7dc7('0x5')]))[_0x7dc7('0x17')]('fax_queue:save',_0x2e886a);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 4790e0d..73f14e0 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 _0xf29b=['exports','name','Intervals'];(function(_0x66146d,_0x2a73b4){var _0x4cd8a9=function(_0x3772cb){while(--_0x3772cb){_0x66146d['push'](_0x66146d['shift']());}};_0x4cd8a9(++_0x2a73b4);}(_0xf29b,0x13f));var _0xbf29=function(_0x185c18,_0x15c1c5){_0x185c18=_0x185c18-0x0;var _0x567361=_0xf29b[_0x185c18];return _0x567361;};'use strict';function Interval(_0x57a1b2){this['id']=_0x57a1b2['id']||0x0;this[_0xbf29('0x0')]=_0x57a1b2[_0xbf29('0x0')]||'';this[_0xbf29('0x1')]=_0x57a1b2['Intervals']||{};}module[_0xbf29('0x2')]=Interval; \ No newline at end of file +var _0x842a=['name','Intervals','exports'];(function(_0x1f1429,_0x190d47){var _0xa65e5=function(_0x37d267){while(--_0x37d267){_0x1f1429['push'](_0x1f1429['shift']());}};_0xa65e5(++_0x190d47);}(_0x842a,0xf6));var _0xa842=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0x842a[_0x427217];return _0x5b28fb;};'use strict';function Interval(_0x2dc68b){this['id']=_0x2dc68b['id']||0x0;this[_0xa842('0x0')]=_0x2dc68b[_0xa842('0x0')]||'';this[_0xa842('0x1')]=_0x2dc68b[_0xa842('0x1')]||{};}module[_0xa842('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 2342f3a..a67e11f 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 _0x9b60=['socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','online','mailPause','paused','available','format','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','localhost'];(function(_0x4d4696,_0x1ab3a2){var _0x455048=function(_0x1548d4){while(--_0x1548d4){_0x4d4696['push'](_0x4d4696['shift']());}};_0x455048(++_0x1ab3a2);}(_0x9b60,0x6a));var _0x09b6=function(_0x2f2f0b,_0x44f5fe){_0x2f2f0b=_0x2f2f0b-0x0;var _0x12ce3a=_0x9b60[_0x2f2f0b];return _0x12ce3a;};'use strict';var _=require('lodash');var md5=require(_0x09b6('0x0'));var util=require(_0x09b6('0x1'));var Redis=require(_0x09b6('0x2'));var config=require(_0x09b6('0x3'));config['redis']=_[_0x09b6('0x4')](config['redis'],{'host':_0x09b6('0x5'),'port':0x18eb});var io=require(_0x09b6('0x6'))(new Redis(config[_0x09b6('0x7')]));function MailQueue(_0x6438d6){this['id']=_0x6438d6['id']||0x0;this[_0x09b6('0x8')]=_0x6438d6['name']||'';this[_0x09b6('0x9')]=_0x6438d6[_0x09b6('0x9')]||0xa;this[_0x09b6('0xa')]=_0x6438d6[_0x09b6('0xa')]||_0x09b6('0xb');this[_0x09b6('0xc')]=_0x6438d6[_0x09b6('0xc')];this[_0x09b6('0xd')]={};this[_0x09b6('0xe')]=0x0;this[_0x09b6('0x0')]='';this[_0x09b6('0xf')]();this[_0x09b6('0x10')]();}MailQueue[_0x09b6('0x11')][_0x09b6('0xf')]=function(){var _0x4d25d3=this[_0x09b6('0xd')]['_rr'];this['mapAgentsId']=_[_0x09b6('0x12')](this[_0x09b6('0xc')],'id');this[_0x09b6('0xd')][_0x09b6('0x13')]=_0x4d25d3;};MailQueue[_0x09b6('0x11')]['updateRealtime']=function(){this[_0x09b6('0x14')]=0x0;this['paused']=0x0;for(var _0x5a4de9=0x0;_0x5a4de9=0x0?this['available']:0x0;var _0x399547={'id':this['id'],'available':this[_0x09b6('0x18')],'loggedIn':this[_0x09b6('0x14')],'name':this[_0x09b6('0x8')],'paused':this['paused'],'waiting':this[_0x09b6('0xe')]};var _0x145446=md5(JSON['stringify'](_0x399547));if(this['md5']!==_0x145446){this[_0x09b6('0x0')]=_0x145446;io['to'](util[_0x09b6('0x19')]('mail:queue:%s',_0x399547['name']))['emit'](_0x09b6('0x1a'),_0x399547);}};module[_0x09b6('0x1b')]=MailQueue; \ No newline at end of file +var _0xb2f4=['mapAgentsId','_rr','map','loggedIn','paused','length','online','available','stringify','format','mail_queue:save','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','beepall','Agents','waiting','updateRouting','updateRealtime','prototype'];(function(_0x18ce04,_0x1f46a9){var _0x5c716e=function(_0x6a8da0){while(--_0x6a8da0){_0x18ce04['push'](_0x18ce04['shift']());}};_0x5c716e(++_0x1f46a9);}(_0xb2f4,0xa1));var _0x4b2f=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xb2f4[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var md5=require(_0x4b2f('0x0'));var util=require(_0x4b2f('0x1'));var Redis=require(_0x4b2f('0x2'));var config=require('../../../config/environment');config[_0x4b2f('0x3')]=_[_0x4b2f('0x4')](config[_0x4b2f('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x4b2f('0x5'))(new Redis(config['redis']));function MailQueue(_0x2b3ea1){this['id']=_0x2b3ea1['id']||0x0;this[_0x4b2f('0x6')]=_0x2b3ea1['name']||'';this[_0x4b2f('0x7')]=_0x2b3ea1[_0x4b2f('0x7')]||0xa;this['strategy']=_0x2b3ea1['strategy']||_0x4b2f('0x8');this[_0x4b2f('0x9')]=_0x2b3ea1[_0x4b2f('0x9')];this['mapAgentsId']={};this[_0x4b2f('0xa')]=0x0;this['md5']='';this[_0x4b2f('0xb')]();this[_0x4b2f('0xc')]();}MailQueue[_0x4b2f('0xd')][_0x4b2f('0xb')]=function(){var _0x517821=this[_0x4b2f('0xe')][_0x4b2f('0xf')];this[_0x4b2f('0xe')]=_[_0x4b2f('0x10')](this[_0x4b2f('0x9')],'id');this[_0x4b2f('0xe')][_0x4b2f('0xf')]=_0x517821;};MailQueue[_0x4b2f('0xd')][_0x4b2f('0xc')]=function(){this[_0x4b2f('0x11')]=0x0;this[_0x4b2f('0x12')]=0x0;for(var _0x128c1b=0x0;_0x128c1b=0x0?this[_0x4b2f('0x15')]:0x0;var _0x1b2a7b={'id':this['id'],'available':this[_0x4b2f('0x15')],'loggedIn':this[_0x4b2f('0x11')],'name':this[_0x4b2f('0x6')],'paused':this[_0x4b2f('0x12')],'waiting':this[_0x4b2f('0xa')]};var _0x50060c=md5(JSON[_0x4b2f('0x16')](_0x1b2a7b));if(this[_0x4b2f('0x0')]!==_0x50060c){this[_0x4b2f('0x0')]=_0x50060c;io['to'](util[_0x4b2f('0x17')]('mail:queue:%s',_0x1b2a7b[_0x4b2f('0x6')]))['emit'](_0x4b2f('0x18'),_0x1b2a7b);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ef7e11c..0aaa23a 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x4cd969,_0x2c2216){var _0x5f4e02=function(_0x4456a1){while(--_0x4456a1){_0x4cd969['push'](_0x4cd969['shift']());}};_0x5f4e02(++_0x2c2216);}(_0x814b,0x1a2));var _0xb814=function(_0x80bea0,_0x4c30f4){_0x80bea0=_0x80bea0-0x0;var _0x50fb90=_0x814b[_0x80bea0];return _0x50fb90;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x7a54,0x106));var _0x47a5=function(_0x104e11,_0x559cbc){_0x104e11=_0x104e11-0x0;var _0x5773ef=_0x7a54[_0x104e11];return _0x5773ef;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 8f83535..ddefe57 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 _0x87f8=['updateRouting','updateRealtime','prototype','map','paused','length','loggedIn','smsPause','available','waiting','stringify','sms:queue:%s','sms_queue:save','exports','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x32fb76,_0x5932ba){var _0x225946=function(_0x38ce40){while(--_0x38ce40){_0x32fb76['push'](_0x32fb76['shift']());}};_0x225946(++_0x5932ba);}(_0x87f8,0x152));var _0x887f=function(_0x41129f,_0x4bb132){_0x41129f=_0x41129f-0x0;var _0x441ae0=_0x87f8[_0x41129f];return _0x441ae0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x887f('0x0'));var config=require(_0x887f('0x1'));config['redis']=_[_0x887f('0x2')](config['redis'],{'host':_0x887f('0x3'),'port':0x18eb});var io=require(_0x887f('0x4'))(new Redis(config[_0x887f('0x5')]));function SmsQueue(_0x2d4cec){this['id']=_0x2d4cec['id']||0x0;this['name']=_0x2d4cec[_0x887f('0x6')]||'';this[_0x887f('0x7')]=_0x2d4cec[_0x887f('0x7')]||0xa;this[_0x887f('0x8')]=_0x2d4cec[_0x887f('0x8')]||_0x887f('0x9');this[_0x887f('0xa')]=_0x2d4cec['Agents'];this[_0x887f('0xb')]={};this['waiting']=0x0;this[_0x887f('0xc')]='';this[_0x887f('0xd')]();this[_0x887f('0xe')]();}SmsQueue[_0x887f('0xf')]['updateRouting']=function(){var _0x12383f=this[_0x887f('0xb')]['_rr'];this['mapAgentsId']=_[_0x887f('0x10')](this[_0x887f('0xa')],'id');this[_0x887f('0xb')]['_rr']=_0x12383f;};SmsQueue[_0x887f('0xf')][_0x887f('0xe')]=function(){this['loggedIn']=0x0;this[_0x887f('0x11')]=0x0;for(var _0x58152e=0x0;_0x58152e=0x0?this[_0x887f('0x15')]:0x0;var _0x3d3b0c={'id':this['id'],'available':this[_0x887f('0x15')],'loggedIn':this[_0x887f('0x13')],'name':this[_0x887f('0x6')],'paused':this[_0x887f('0x11')],'waiting':this[_0x887f('0x16')]};var _0x3964d6=md5(JSON[_0x887f('0x17')](_0x3d3b0c));if(this[_0x887f('0xc')]!==_0x3964d6){this[_0x887f('0xc')]=_0x3964d6;io['to'](util['format'](_0x887f('0x18'),_0x3d3b0c[_0x887f('0x6')]))['emit'](_0x887f('0x19'),_0x3d3b0c);}};module[_0x887f('0x1a')]=SmsQueue; \ No newline at end of file +var _0x684c=['sms:queue:%s','emit','sms_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','available','stringify','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var md5=require(_0xc684('0x1'));var util=require('util');var Redis=require(_0xc684('0x2'));var config=require(_0xc684('0x3'));config[_0xc684('0x4')]=_[_0xc684('0x5')](config[_0xc684('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc684('0x6'))(new Redis(config[_0xc684('0x4')]));function SmsQueue(_0x4219b6){this['id']=_0x4219b6['id']||0x0;this[_0xc684('0x7')]=_0x4219b6[_0xc684('0x7')]||'';this[_0xc684('0x8')]=_0x4219b6[_0xc684('0x8')]||0xa;this[_0xc684('0x9')]=_0x4219b6[_0xc684('0x9')]||_0xc684('0xa');this[_0xc684('0xb')]=_0x4219b6[_0xc684('0xb')];this[_0xc684('0xc')]={};this[_0xc684('0xd')]=0x0;this[_0xc684('0x1')]='';this[_0xc684('0xe')]();this[_0xc684('0xf')]();}SmsQueue['prototype'][_0xc684('0xe')]=function(){var _0x365990=this[_0xc684('0xc')][_0xc684('0x10')];this[_0xc684('0xc')]=_[_0xc684('0x11')](this['Agents'],'id');this[_0xc684('0xc')][_0xc684('0x10')]=_0x365990;};SmsQueue['prototype']['updateRealtime']=function(){this[_0xc684('0x12')]=0x0;this[_0xc684('0x13')]=0x0;for(var _0x32d5da=0x0;_0x32d5da=0x0?this[_0xc684('0x15')]:0x0;var _0x1c1b4a={'id':this['id'],'available':this[_0xc684('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xc684('0x7')],'paused':this[_0xc684('0x13')],'waiting':this['waiting']};var _0x21273b=md5(JSON[_0xc684('0x16')](_0x1c1b4a));if(this[_0xc684('0x1')]!==_0x21273b){this['md5']=_0x21273b;io['to'](util[_0xc684('0x17')](_0xc684('0x18'),_0x1c1b4a[_0xc684('0x7')]))[_0xc684('0x19')](_0xc684('0x1a'),_0x1c1b4a);}};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 7d53146..79e4de9 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 _0x2ff1=['_rr','updateRealtime','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','map'];(function(_0x33067d,_0x2b6737){var _0x55f2f1=function(_0x3caf40){while(--_0x3caf40){_0x33067d['push'](_0x33067d['shift']());}};_0x55f2f1(++_0x2b6737);}(_0x2ff1,0xba));var _0x12ff=function(_0x4d208d,_0x472f73){_0x4d208d=_0x4d208d-0x0;var _0x160815=_0x2ff1[_0x4d208d];return _0x160815;};'use strict';var _=require(_0x12ff('0x0'));var md5=require(_0x12ff('0x1'));var util=require('util');var Redis=require(_0x12ff('0x2'));var config=require(_0x12ff('0x3'));config[_0x12ff('0x4')]=_[_0x12ff('0x5')](config[_0x12ff('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x12ff('0x6'))(new Redis(config[_0x12ff('0x4')]));function WhatsappQueue(_0x2efa38){this['id']=_0x2efa38['id']||0x0;this['name']=_0x2efa38[_0x12ff('0x7')]||'';this[_0x12ff('0x8')]=_0x2efa38[_0x12ff('0x8')]||0xa;this['strategy']=_0x2efa38[_0x12ff('0x9')]||_0x12ff('0xa');this[_0x12ff('0xb')]=_0x2efa38['Agents'];this['mapAgentsId']={};this[_0x12ff('0xc')]=0x0;this[_0x12ff('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x12ff('0xd')][_0x12ff('0xe')]=function(){var _0x4dc8fc=this[_0x12ff('0xf')]['_rr'];this[_0x12ff('0xf')]=_[_0x12ff('0x10')](this[_0x12ff('0xb')],'id');this['mapAgentsId'][_0x12ff('0x11')]=_0x4dc8fc;};WhatsappQueue[_0x12ff('0xd')][_0x12ff('0x12')]=function(){this[_0x12ff('0x13')]=0x0;this[_0x12ff('0x14')]=0x0;for(var _0x105456=0x0;_0x105456=0x0?this[_0x12ff('0x17')]:0x0;var _0x172e57={'id':this['id'],'available':this[_0x12ff('0x17')],'loggedIn':this[_0x12ff('0x13')],'name':this['name'],'paused':this[_0x12ff('0x14')],'waiting':this[_0x12ff('0xc')]};var _0xc1344a=md5(JSON[_0x12ff('0x18')](_0x172e57));if(this['md5']!==_0xc1344a){this['md5']=_0xc1344a;io['to'](util[_0x12ff('0x19')](_0x12ff('0x1a'),_0x172e57[_0x12ff('0x7')]))['emit'](_0x12ff('0x1b'),_0x172e57);}};module[_0x12ff('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x0ee5=['_rr','map','paused','length','online','loggedIn','available','stringify','format','emit','whatsapp_queue:save','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId'];(function(_0x5c070e,_0x1de682){var _0x56aedd=function(_0x1477d4){while(--_0x1477d4){_0x5c070e['push'](_0x5c070e['shift']());}};_0x56aedd(++_0x1de682);}(_0x0ee5,0xcf));var _0x50ee=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0ee5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x50ee('0x0'));var md5=require(_0x50ee('0x1'));var util=require(_0x50ee('0x2'));var Redis=require(_0x50ee('0x3'));var config=require('../../../config/environment');config[_0x50ee('0x4')]=_['defaults'](config['redis'],{'host':_0x50ee('0x5'),'port':0x18eb});var io=require(_0x50ee('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x17b33d){this['id']=_0x17b33d['id']||0x0;this[_0x50ee('0x7')]=_0x17b33d[_0x50ee('0x7')]||'';this['timeout']=_0x17b33d[_0x50ee('0x8')]||0xa;this[_0x50ee('0x9')]=_0x17b33d[_0x50ee('0x9')]||_0x50ee('0xa');this[_0x50ee('0xb')]=_0x17b33d[_0x50ee('0xb')];this['mapAgentsId']={};this[_0x50ee('0xc')]=0x0;this[_0x50ee('0x1')]='';this[_0x50ee('0xd')]();this[_0x50ee('0xe')]();}WhatsappQueue[_0x50ee('0xf')][_0x50ee('0xd')]=function(){var _0x4e9445=this[_0x50ee('0x10')][_0x50ee('0x11')];this[_0x50ee('0x10')]=_[_0x50ee('0x12')](this[_0x50ee('0xb')],'id');this[_0x50ee('0x10')]['_rr']=_0x4e9445;};WhatsappQueue[_0x50ee('0xf')][_0x50ee('0xe')]=function(){this['loggedIn']=0x0;this[_0x50ee('0x13')]=0x0;for(var _0x57231a=0x0;_0x57231a=0x0?this[_0x50ee('0x17')]:0x0;var _0x4db338={'id':this['id'],'available':this[_0x50ee('0x17')],'loggedIn':this[_0x50ee('0x16')],'name':this[_0x50ee('0x7')],'paused':this[_0x50ee('0x13')],'waiting':this[_0x50ee('0xc')]};var _0xebca56=md5(JSON[_0x50ee('0x18')](_0x4db338));if(this[_0x50ee('0x1')]!==_0xebca56){this[_0x50ee('0x1')]=_0xebca56;io['to'](util[_0x50ee('0x19')]('whatsapp:queue:%s',_0x4db338[_0x50ee('0x7')]))[_0x50ee('0x1a')](_0x50ee('0x1b'),_0x4db338);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index c84ac52..6917bc1 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x172caa,_0x15efb2){var _0x1edc62=function(_0x51b93b){while(--_0x51b93b){_0x172caa['push'](_0x172caa['shift']());}};_0x1edc62(++_0x15efb2);}(_0xb10b,0x12a));var _0xbb10=function(_0x171fa7,_0x587eca){_0x171fa7=_0x171fa7-0x0;var _0xc894e1=_0xb10b[_0x171fa7];return _0xc894e1;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2aa717,_0x52771b){var _0x240cc7=function(_0x42c143){while(--_0x42c143){_0x2aa717['push'](_0x2aa717['shift']());}};_0x240cc7(++_0x52771b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e8906,_0x18f1e7){_0x5e8906=_0x5e8906-0x0;var _0x3b6622=_0xb10b[_0x5e8906];return _0x3b6622;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 9d46a5c..102eb5c 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 _0x18a9=['UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x36bad3,_0x3cc324){var _0x3d6f23=function(_0x5d0190){while(--_0x5d0190){_0x36bad3['push'](_0x36bad3['shift']());}};_0x3d6f23(++_0x3cc324);}(_0x18a9,0x1cd));var _0x918a=function(_0x53dc88,_0x96dfa2){_0x53dc88=_0x53dc88-0x0;var _0x5d128d=_0x18a9[_0x53dc88];return _0x5d128d;};'use strict';var client=require('../client');exports[_0x918a('0x0')]=function(_0x19869b,_0x55050b){return client['Request'](_0x918a('0x1'),{'body':_0x55050b,'options':{'where':{'id':_0x19869b}},'log':_0x918a('0x2')});};exports[_0x918a('0x3')]=function(_0x4f8655,_0x1dcb76){return client[_0x918a('0x4')](_0x918a('0x5'),{'body':_0x1dcb76,'options':{'where':{'id':_0x4f8655}},'log':_0x918a('0x6')});}; \ No newline at end of file +var _0xa55b=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','update','UpdateChatInteraction'];(function(_0x54ce67,_0x35ec85){var _0x10f088=function(_0x5b17da){while(--_0x5b17da){_0x54ce67['push'](_0x54ce67['shift']());}};_0x10f088(++_0x35ec85);}(_0xa55b,0x1e4));var _0xba55=function(_0xfc9de,_0x2b6d0e){_0xfc9de=_0xfc9de-0x0;var _0xb00c8e=_0xa55b[_0xfc9de];return _0xb00c8e;};'use strict';var client=require('../client');exports[_0xba55('0x0')]=function(_0x338518,_0x505b54){return client['Request'](_0xba55('0x1'),{'body':_0x505b54,'options':{'where':{'id':_0x338518}},'log':_0xba55('0x2')});};exports[_0xba55('0x3')]=function(_0x337404,_0x473fa6){return client[_0xba55('0x4')](_0xba55('0x5'),{'body':_0x473fa6,'options':{'where':{'id':_0x337404}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3f90188..5a88b69 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 _0x1a3b=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0xac0c55,_0x1b3720){var _0x2aed42=function(_0x5e7d9c){while(--_0x5e7d9c){_0xac0c55['push'](_0xac0c55['shift']());}};_0x2aed42(++_0x1b3720);}(_0x1a3b,0xe2));var _0xb1a3=function(_0x43711b,_0x1bfbd2){_0x43711b=_0x43711b-0x0;var _0x588e05=_0x1a3b[_0x43711b];return _0x588e05;};'use strict';var client=require(_0xb1a3('0x0'));exports[_0xb1a3('0x1')]=function(_0x462fe3){return client[_0xb1a3('0x2')](_0xb1a3('0x3'),{'body':_0x462fe3,'log':_0xb1a3('0x4')});}; \ No newline at end of file +var _0xede3=['createChatMessage','create','Request','CreateChatMessage'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xede3,0x145));var _0x3ede=function(_0x2e734c,_0x44876c){_0x2e734c=_0x2e734c-0x0;var _0x33af73=_0xede3[_0x2e734c];return _0x33af73;};'use strict';var client=require('../client');exports[_0x3ede('0x0')]=function(_0x46e6b7){return client[_0x3ede('0x1')](_0x3ede('0x2'),{'body':_0x46e6b7,'log':_0x3ede('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4866d8b..3722c23 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 _0x6631=['Request','GetChatQueue','name','timeout','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0x49cdce,_0x17e8ec){var _0x560ef1=function(_0x461548){while(--_0x461548){_0x49cdce['push'](_0x49cdce['shift']());}};_0x560ef1(++_0x17e8ec);}(_0x6631,0x134));var _0x1663=function(_0x28faf6,_0x4c12f0){_0x28faf6=_0x28faf6-0x0;var _0x835145=_0x6631[_0x28faf6];return _0x835145;};'use strict';var client=require(_0x1663('0x0'));exports[_0x1663('0x1')]=function(){return function(){return client[_0x1663('0x2')](_0x1663('0x3'),{'options':{'raw':![],'attributes':['id',_0x1663('0x4'),_0x1663('0x5'),'strategy'],'include':[{'model':_0x1663('0x6'),'as':_0x1663('0x7'),'attributes':['id',_0x1663('0x4'),_0x1663('0x8'),_0x1663('0x9')]}]},'log':_0x1663('0x1')});};}; \ No newline at end of file +var _0xe002=['strategy','Agents','online','chatPause','../client','getChatQueues','Request','name','timeout'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe002,0xf7));var _0x2e00=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0xe002[_0x183b97];return _0x629cf7;};'use strict';var client=require(_0x2e00('0x0'));exports[_0x2e00('0x1')]=function(){return function(){return client[_0x2e00('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x2e00('0x3'),_0x2e00('0x4'),_0x2e00('0x5')],'include':[{'model':'User','as':_0x2e00('0x6'),'attributes':['id',_0x2e00('0x3'),_0x2e00('0x7'),_0x2e00('0x8')]}]},'log':_0x2e00('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c039e16..e1bf803 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 _0x1b32=['DESC','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x368178,_0x2d5678){var _0x10a228=function(_0x130364){while(--_0x130364){_0x368178['push'](_0x368178['shift']());}};_0x10a228(++_0x2d5678);}(_0x1b32,0x85));var _0x21b3=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x1b32[_0x87b0ff];return _0x3bc0b2;};'use strict';var client=require('../client');exports[_0x21b3('0x0')]=function(_0xd03c78){return client[_0x21b3('0x1')](_0x21b3('0x2'),{'body':_0xd03c78,'log':_0x21b3('0x2')});};exports[_0x21b3('0x3')]=function(_0x245e2e,_0x2aba68){return client[_0x21b3('0x1')](_0x21b3('0x4'),{'body':_0x2aba68,'options':{'where':{'uniqueid':_0x245e2e},'order':[['id',_0x21b3('0x5')]],'limit':0x1},'log':_0x21b3('0x4')});}; \ No newline at end of file +var _0x7ec2=['../client','create','CreateChatQueueReport','Request','UpdateChatQueueReport','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ec2,0x15c));var _0x27ec=function(_0x64a36c,_0x54bc64){_0x64a36c=_0x64a36c-0x0;var _0x13d1ce=_0x7ec2[_0x64a36c];return _0x13d1ce;};'use strict';var client=require(_0x27ec('0x0'));exports[_0x27ec('0x1')]=function(_0x29b076){return client['Request'](_0x27ec('0x2'),{'body':_0x29b076,'log':_0x27ec('0x2')});};exports['update']=function(_0x45b293,_0x340231){return client[_0x27ec('0x3')](_0x27ec('0x4'),{'body':_0x340231,'options':{'where':{'uniqueid':_0x45b293},'order':[['id',_0x27ec('0x5')]],'limit':0x1},'log':_0x27ec('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 58afa14..94fa981 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x71b3af,_0x4b4807){var _0x54a474=function(_0x5a99c7){while(--_0x5a99c7){_0x71b3af['push'](_0x71b3af['shift']());}};_0x54a474(++_0x4b4807);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1ccc1e,_0x31175f){var _0x587532=function(_0xcb666e){while(--_0xcb666e){_0x1ccc1e['push'](_0x1ccc1e['shift']());}};_0x587532(++_0x31175f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 9eba05d..43ae6a5 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 _0x9ed9=['CreateFaxMessage','createFaxMessage','create','Request'];(function(_0x1f60f2,_0x5171f1){var _0x5adc15=function(_0x179c96){while(--_0x179c96){_0x1f60f2['push'](_0x1f60f2['shift']());}};_0x5adc15(++_0x5171f1);}(_0x9ed9,0x8e));var _0x99ed=function(_0x267144,_0x5cb2cb){_0x267144=_0x267144-0x0;var _0x316bd5=_0x9ed9[_0x267144];return _0x316bd5;};'use strict';var client=require('../client');exports[_0x99ed('0x0')]=function(_0x30caf3){return client[_0x99ed('0x1')](_0x99ed('0x2'),{'body':_0x30caf3,'log':_0x99ed('0x3')});}; \ No newline at end of file +var _0xe091=['Request','../client','create'];(function(_0xe506cf,_0x526c94){var _0x8228c=function(_0x2625a6){while(--_0x2625a6){_0xe506cf['push'](_0xe506cf['shift']());}};_0x8228c(++_0x526c94);}(_0xe091,0x7c));var _0x1e09=function(_0xb95c94,_0x104635){_0xb95c94=_0xb95c94-0x0;var _0x29391e=_0xe091[_0xb95c94];return _0x29391e;};'use strict';var client=require(_0x1e09('0x0'));exports[_0x1e09('0x1')]=function(_0x4d5d1){return client[_0x1e09('0x2')]('CreateFaxMessage',{'body':_0x4d5d1,'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 cc538bb..8bdda76 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 _0xdc59=['timeout','strategy','User','Agents','online','faxPause','getFaxQueues','Request','name'];(function(_0x51847b,_0x1f7b44){var _0x45c3be=function(_0x30432d){while(--_0x30432d){_0x51847b['push'](_0x51847b['shift']());}};_0x45c3be(++_0x1f7b44);}(_0xdc59,0x1b6));var _0x9dc5=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0xdc59[_0xa3463d];return _0x50fd67;};'use strict';var client=require('../client');exports[_0x9dc5('0x0')]=function(){return function(){return client[_0x9dc5('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x9dc5('0x2'),_0x9dc5('0x3'),_0x9dc5('0x4')],'include':[{'model':_0x9dc5('0x5'),'as':_0x9dc5('0x6'),'attributes':['id',_0x9dc5('0x2'),_0x9dc5('0x7'),_0x9dc5('0x8')]}]},'log':_0x9dc5('0x0')});};}; \ No newline at end of file +var _0x8562=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x50d352,_0x12407a){var _0x298457=function(_0x862b0e){while(--_0x862b0e){_0x50d352['push'](_0x50d352['shift']());}};_0x298457(++_0x12407a);}(_0x8562,0x16d));var _0x2856=function(_0x1c8df2,_0x3366bd){_0x1c8df2=_0x1c8df2-0x0;var _0x308a2c=_0x8562[_0x1c8df2];return _0x308a2c;};'use strict';var client=require(_0x2856('0x0'));exports[_0x2856('0x1')]=function(){return function(){return client[_0x2856('0x2')](_0x2856('0x3'),{'options':{'raw':![],'attributes':['id',_0x2856('0x4'),_0x2856('0x5'),_0x2856('0x6')],'include':[{'model':_0x2856('0x7'),'as':_0x2856('0x8'),'attributes':['id',_0x2856('0x4'),_0x2856('0x9'),_0x2856('0xa')]}]},'log':_0x2856('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 273b2bf..b0a7ea8 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 _0x09d8=['create','Request','CreateFaxQueueReport','update','DESC'];(function(_0x53d98d,_0x41264a){var _0x1be94f=function(_0x2cdf7a){while(--_0x2cdf7a){_0x53d98d['push'](_0x53d98d['shift']());}};_0x1be94f(++_0x41264a);}(_0x09d8,0x91));var _0x809d=function(_0x4118ce,_0x897f8c){_0x4118ce=_0x4118ce-0x0;var _0xc5a37=_0x09d8[_0x4118ce];return _0xc5a37;};'use strict';var client=require('../client');exports[_0x809d('0x0')]=function(_0x42c4da){return client[_0x809d('0x1')](_0x809d('0x2'),{'body':_0x42c4da,'log':_0x809d('0x2')});};exports[_0x809d('0x3')]=function(_0x52d084,_0x206d57){return client[_0x809d('0x1')]('UpdateFaxQueueReport',{'body':_0x206d57,'options':{'where':{'uniqueid':_0x52d084},'order':[['id',_0x809d('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xdee8=['DESC','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x1aa801,_0x43a83d){var _0x355adf=function(_0x145d75){while(--_0x145d75){_0x1aa801['push'](_0x1aa801['shift']());}};_0x355adf(++_0x43a83d);}(_0xdee8,0xd3));var _0x8dee=function(_0x14f444,_0x5b0c28){_0x14f444=_0x14f444-0x0;var _0x34fd77=_0xdee8[_0x14f444];return _0x34fd77;};'use strict';var client=require('../client');exports[_0x8dee('0x0')]=function(_0x546ede){return client[_0x8dee('0x1')](_0x8dee('0x2'),{'body':_0x546ede,'log':_0x8dee('0x2')});};exports[_0x8dee('0x3')]=function(_0x20f455,_0x3e8c89){return client[_0x8dee('0x1')](_0x8dee('0x4'),{'body':_0x3e8c89,'options':{'where':{'uniqueid':_0x20f455},'order':[['id',_0x8dee('0x5')]],'limit':0x1},'log':_0x8dee('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 832f36a..e86a618 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 _0xd45c=['Intervals','interval','getIntervals','GetInterval','name'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0xd45c,0x1f1));var _0xcd45=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd45c[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0xcd45('0x0')]=function(){return function(){return client['Request'](_0xcd45('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcd45('0x2')],'include':[{'model':'Interval','as':_0xcd45('0x3'),'attributes':['id',_0xcd45('0x2'),_0xcd45('0x4')]}]},'log':_0xcd45('0x0')});};}; \ No newline at end of file +var _0x5308=['../client','Request','GetInterval','name','Intervals','interval','getIntervals'];(function(_0x2b7ade,_0x2fc47c){var _0x12db42=function(_0x1744d3){while(--_0x1744d3){_0x2b7ade['push'](_0x2b7ade['shift']());}};_0x12db42(++_0x2fc47c);}(_0x5308,0xd9));var _0x8530=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x5308[_0x2abc3d];return _0x252745;};'use strict';var client=require(_0x8530('0x0'));exports['getIntervals']=function(){return function(){return client[_0x8530('0x1')](_0x8530('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8530('0x3')],'include':[{'model':'Interval','as':_0x8530('0x4'),'attributes':['id','name',_0x8530('0x5')]}]},'log':_0x8530('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 074c09c..f9c6b10 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 _0x6d38=['updateMailInteraction','Request','addTagsToChatInteraction','update'];(function(_0x2f8140,_0x37076b){var _0x21bd12=function(_0x179e41){while(--_0x179e41){_0x2f8140['push'](_0x2f8140['shift']());}};_0x21bd12(++_0x37076b);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(_0x4c9c06,_0x3db243){return client['Request']('UpdateMailInteraction',{'body':_0x3db243,'options':{'where':{'id':_0x4c9c06}},'log':_0x86d3('0x1')});};exports['addTags']=function(_0xe9198a,_0x455b9d){return client[_0x86d3('0x2')]('AddTagsToMailInteraction',{'body':_0x455b9d,'options':{'where':{'id':_0xe9198a}},'log':_0x86d3('0x3')});}; \ No newline at end of file +var _0x1eba=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x1eba[_0x4d2993];return _0x427374;};'use strict';var client=require(_0xa1eb('0x0'));exports[_0xa1eb('0x1')]=function(_0x406a58,_0x2158d5){return client[_0xa1eb('0x2')]('UpdateMailInteraction',{'body':_0x2158d5,'options':{'where':{'id':_0x406a58}},'log':'updateMailInteraction'});};exports[_0xa1eb('0x3')]=function(_0x34be5a,_0x16a13a){return client[_0xa1eb('0x2')](_0xa1eb('0x4'),{'body':_0x16a13a,'options':{'where':{'id':_0x34be5a}},'log':_0xa1eb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index c9069ad..d2a7fe6 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 _0xef84=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xef84,0xb7));var _0x4ef8=function(_0x1e8e5b,_0x435423){_0x1e8e5b=_0x1e8e5b-0x0;var _0x19ad33=_0xef84[_0x1e8e5b];return _0x19ad33;};'use strict';var client=require(_0x4ef8('0x0'));exports[_0x4ef8('0x1')]=function(_0x4024e9){return client[_0x4ef8('0x2')](_0x4ef8('0x3'),{'body':_0x4024e9,'log':_0x4ef8('0x4')});}; \ No newline at end of file +var _0x4ee2=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x34dd3c,_0x12616c){var _0x19beab=function(_0x327c96){while(--_0x327c96){_0x34dd3c['push'](_0x34dd3c['shift']());}};_0x19beab(++_0x12616c);}(_0x4ee2,0x1e0));var _0x24ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4ee2[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x24ee('0x0'));exports[_0x24ee('0x1')]=function(_0xa1090c){return client[_0x24ee('0x2')](_0x24ee('0x3'),{'body':_0xa1090c,'log':_0x24ee('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7af77d9..77d5125 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 _0xcb60=['../client','getMailQueues','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x15a4dd,_0x187829){var _0x485988=function(_0x207dbb){while(--_0x207dbb){_0x15a4dd['push'](_0x15a4dd['shift']());}};_0x485988(++_0x187829);}(_0xcb60,0x1ea));var _0x0cb6=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xcb60[_0x22868f];return _0x97bc75;};'use strict';var client=require(_0x0cb6('0x0'));exports[_0x0cb6('0x1')]=function(){return function(){return client['Request'](_0x0cb6('0x2'),{'options':{'raw':![],'attributes':['id',_0x0cb6('0x3'),_0x0cb6('0x4'),_0x0cb6('0x5')],'include':[{'model':_0x0cb6('0x6'),'as':_0x0cb6('0x7'),'attributes':['id',_0x0cb6('0x3'),_0x0cb6('0x8'),_0x0cb6('0x9')]}]},'log':_0x0cb6('0x1')});};}; \ No newline at end of file +var _0xff32=['Request','name','strategy','User','Agents','online','mailPause','../client'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xff32,0xff));var _0x2ff3=function(_0x19f670,_0x36d23f){_0x19f670=_0x19f670-0x0;var _0x3ffd49=_0xff32[_0x19f670];return _0x3ffd49;};'use strict';var client=require(_0x2ff3('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x2ff3('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x2ff3('0x2'),'timeout',_0x2ff3('0x3')],'include':[{'model':_0x2ff3('0x4'),'as':_0x2ff3('0x5'),'attributes':['id',_0x2ff3('0x2'),_0x2ff3('0x6'),_0x2ff3('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a708d0c..9d321c6 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 _0x3553=['Request','create','CreateMailQueueReport','update'];(function(_0x204093,_0x138007){var _0x46880b=function(_0x5b3ac5){while(--_0x5b3ac5){_0x204093['push'](_0x204093['shift']());}};_0x46880b(++_0x138007);}(_0x3553,0x1e1));var _0x3355=function(_0x5a98d4,_0x132046){_0x5a98d4=_0x5a98d4-0x0;var _0x34a36a=_0x3553[_0x5a98d4];return _0x34a36a;};'use strict';var client=require('../client');exports[_0x3355('0x0')]=function(_0x52a8ba){return client['Request']('CreateMailQueueReport',{'body':_0x52a8ba,'log':_0x3355('0x1')});};exports[_0x3355('0x2')]=function(_0x39811c,_0x34d114){return client[_0x3355('0x3')]('UpdateMailQueueReport',{'body':_0x34d114,'options':{'where':{'uniqueid':_0x39811c},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x7a08=['Request','CreateMailQueueReport','UpdateMailQueueReport','DESC','../client'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x7a08,0x77));var _0x87a0=function(_0x31218c,_0x28ae34){_0x31218c=_0x31218c-0x0;var _0x13e4ab=_0x7a08[_0x31218c];return _0x13e4ab;};'use strict';var client=require(_0x87a0('0x0'));exports['create']=function(_0x37105d){return client[_0x87a0('0x1')](_0x87a0('0x2'),{'body':_0x37105d,'log':_0x87a0('0x2')});};exports['update']=function(_0x4dc302,_0x416fc8){return client[_0x87a0('0x1')](_0x87a0('0x3'),{'body':_0x416fc8,'options':{'where':{'uniqueid':_0x4dc302},'order':[['id',_0x87a0('0x4')]],'limit':0x1},'log':_0x87a0('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 726e807..b29d5a2 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 _0xfec0=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','Request','UpdateOpenchannelInteraction'];(function(_0x6b888e,_0x420fed){var _0x17d0f6=function(_0x42675a){while(--_0x42675a){_0x6b888e['push'](_0x6b888e['shift']());}};_0x17d0f6(++_0x420fed);}(_0xfec0,0x1cf));var _0x0fec=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xfec0[_0x3ff085];return _0x2b68c3;};'use strict';var client=require('../client');exports['update']=function(_0xbb5bf1,_0x103f83){return client[_0x0fec('0x0')](_0x0fec('0x1'),{'body':_0x103f83,'options':{'where':{'id':_0xbb5bf1}},'log':_0x0fec('0x2')});};exports[_0x0fec('0x3')]=function(_0x59a41a,_0xe5f499){return client['Request'](_0x0fec('0x4'),{'body':_0xe5f499,'options':{'where':{'id':_0x59a41a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x7a64=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x4109e7,_0x2c8158){var _0x28d807=function(_0x386518){while(--_0x386518){_0x4109e7['push'](_0x4109e7['shift']());}};_0x28d807(++_0x2c8158);}(_0x7a64,0x14b));var _0x47a6=function(_0x87e33d,_0x34347b){_0x87e33d=_0x87e33d-0x0;var _0x393a0c=_0x7a64[_0x87e33d];return _0x393a0c;};'use strict';var client=require('../client');exports[_0x47a6('0x0')]=function(_0x1887d0,_0xac1200){return client[_0x47a6('0x1')](_0x47a6('0x2'),{'body':_0xac1200,'options':{'where':{'id':_0x1887d0}},'log':_0x47a6('0x3')});};exports[_0x47a6('0x4')]=function(_0x3ea419,_0x5f534b){return client['Request'](_0x47a6('0x5'),{'body':_0x5f534b,'options':{'where':{'id':_0x3ea419}},'log':_0x47a6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index eed7327..4ac793d 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 _0xb0cd=['createOpenchannelMessage','../client','create','Request'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xb0cd,0x1e1));var _0xdb0c=function(_0x662de5,_0x545de3){_0x662de5=_0x662de5-0x0;var _0x134301=_0xb0cd[_0x662de5];return _0x134301;};'use strict';var client=require(_0xdb0c('0x0'));exports[_0xdb0c('0x1')]=function(_0x21fb44){return client[_0xdb0c('0x2')]('CreateOpenchannelMessage',{'body':_0x21fb44,'log':_0xdb0c('0x3')});}; \ No newline at end of file +var _0x96f5=['CreateOpenchannelMessage','createOpenchannelMessage','create','Request'];(function(_0x161f03,_0x5d141b){var _0x2f396f=function(_0x2c1b7a){while(--_0x2c1b7a){_0x161f03['push'](_0x161f03['shift']());}};_0x2f396f(++_0x5d141b);}(_0x96f5,0x1da));var _0x596f=function(_0x22407c,_0x407f57){_0x22407c=_0x22407c-0x0;var _0x51b443=_0x96f5[_0x22407c];return _0x51b443;};'use strict';var client=require('../client');exports[_0x596f('0x0')]=function(_0x2ba162){return client[_0x596f('0x1')](_0x596f('0x2'),{'body':_0x2ba162,'log':_0x596f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5e69689..6c29d24 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 _0x045c=['strategy','User','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x8a0ded,_0x2d8141){var _0x5d56bd=function(_0x2ff67a){while(--_0x2ff67a){_0x8a0ded['push'](_0x8a0ded['shift']());}};_0x5d56bd(++_0x2d8141);}(_0x045c,0x8a));var _0xc045=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x045c[_0x47a7d0];return _0xb9bd08;};'use strict';var client=require(_0xc045('0x0'));exports[_0xc045('0x1')]=function(){return function(){return client[_0xc045('0x2')](_0xc045('0x3'),{'options':{'raw':![],'attributes':['id',_0xc045('0x4'),_0xc045('0x5'),_0xc045('0x6')],'include':[{'model':_0xc045('0x7'),'as':'Agents','attributes':['id',_0xc045('0x4'),'online',_0xc045('0x8')]}]},'log':_0xc045('0x1')});};}; \ No newline at end of file +var _0xb377=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0xd21044,_0x8d8840){var _0x5a0d7d=function(_0x1e2b5e){while(--_0x1e2b5e){_0xd21044['push'](_0xd21044['shift']());}};_0x5a0d7d(++_0x8d8840);}(_0xb377,0x1b6));var _0x7b37=function(_0x48cd95,_0x37aaf6){_0x48cd95=_0x48cd95-0x0;var _0x1cb48d=_0xb377[_0x48cd95];return _0x1cb48d;};'use strict';var client=require(_0x7b37('0x0'));exports[_0x7b37('0x1')]=function(){return function(){return client[_0x7b37('0x2')](_0x7b37('0x3'),{'options':{'raw':![],'attributes':['id',_0x7b37('0x4'),_0x7b37('0x5'),_0x7b37('0x6')],'include':[{'model':_0x7b37('0x7'),'as':_0x7b37('0x8'),'attributes':['id',_0x7b37('0x4'),_0x7b37('0x9'),_0x7b37('0xa')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index e74e1dd..8c22580 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 _0x1fe1=['DESC','../client','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x22a8fd,_0x4f72e3){var _0x474188=function(_0x350eb0){while(--_0x350eb0){_0x22a8fd['push'](_0x22a8fd['shift']());}};_0x474188(++_0x4f72e3);}(_0x1fe1,0x128));var _0x11fe=function(_0x5016d0,_0x4e54f8){_0x5016d0=_0x5016d0-0x0;var _0x167444=_0x1fe1[_0x5016d0];return _0x167444;};'use strict';var client=require(_0x11fe('0x0'));exports['create']=function(_0x4a7888){return client[_0x11fe('0x1')](_0x11fe('0x2'),{'body':_0x4a7888,'log':_0x11fe('0x2')});};exports['update']=function(_0x1091d7,_0x5d697a){return client[_0x11fe('0x1')](_0x11fe('0x3'),{'body':_0x5d697a,'options':{'where':{'uniqueid':_0x1091d7},'order':[['id',_0x11fe('0x4')]],'limit':0x1},'log':_0x11fe('0x3')});}; \ No newline at end of file +var _0x675e=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','create'];(function(_0x1cd73c,_0x3fdd03){var _0xc0d36f=function(_0x1d6de0){while(--_0x1d6de0){_0x1cd73c['push'](_0x1cd73c['shift']());}};_0xc0d36f(++_0x3fdd03);}(_0x675e,0x18a));var _0xe675=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x675e[_0x47a349];return _0x18ab75;};'use strict';var client=require('../client');exports[_0xe675('0x0')]=function(_0x39f142){return client[_0xe675('0x1')](_0xe675('0x2'),{'body':_0x39f142,'log':'CreateOpenchannelQueueReport'});};exports[_0xe675('0x3')]=function(_0x2ab603,_0x1a30f8){return client[_0xe675('0x1')](_0xe675('0x4'),{'body':_0x1a30f8,'options':{'where':{'uniqueid':_0x2ab603},'order':[['id','DESC']],'limit':0x1},'log':_0xe675('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index cc5f2ed..4429adf 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 _0xc569=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','addTags'];(function(_0x218a82,_0x55c463){var _0x13fab1=function(_0x1fd048){while(--_0x1fd048){_0x218a82['push'](_0x218a82['shift']());}};_0x13fab1(++_0x55c463);}(_0xc569,0x159));var _0x9c56=function(_0x4e799a,_0x3fc483){_0x4e799a=_0x4e799a-0x0;var _0x4d3444=_0xc569[_0x4e799a];return _0x4d3444;};'use strict';var client=require(_0x9c56('0x0'));exports[_0x9c56('0x1')]=function(_0x78e9ad,_0x5e6b42){return client[_0x9c56('0x2')](_0x9c56('0x3'),{'body':_0x5e6b42,'options':{'where':{'id':_0x78e9ad}},'log':'updateSmsInteraction'});};exports[_0x9c56('0x4')]=function(_0x24527a,_0x23402b){return client['Request'](_0x9c56('0x5'),{'body':_0x23402b,'options':{'where':{'id':_0x24527a}},'log':_0x9c56('0x6')});}; \ No newline at end of file +var _0xcca7=['../client','update','updateSmsInteraction','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x137d29,_0x236205){var _0x5983f9=function(_0x42e55b){while(--_0x42e55b){_0x137d29['push'](_0x137d29['shift']());}};_0x5983f9(++_0x236205);}(_0xcca7,0x1aa));var _0x7cca=function(_0x10107e,_0x22fafe){_0x10107e=_0x10107e-0x0;var _0x9225e8=_0xcca7[_0x10107e];return _0x9225e8;};'use strict';var client=require(_0x7cca('0x0'));exports[_0x7cca('0x1')]=function(_0x2f3574,_0x33db4f){return client['Request']('UpdateSmsInteraction',{'body':_0x33db4f,'options':{'where':{'id':_0x2f3574}},'log':_0x7cca('0x2')});};exports['addTags']=function(_0x3b86a4,_0x9523f7){return client[_0x7cca('0x3')](_0x7cca('0x4'),{'body':_0x9523f7,'options':{'where':{'id':_0x3b86a4}},'log':_0x7cca('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e455d9b..603e2c1 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 _0x3aec=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x3aec,0x1d8));var _0xc3ae=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x3aec[_0x546aaf];return _0x1cbf6d;};'use strict';var client=require(_0xc3ae('0x0'));exports[_0xc3ae('0x1')]=function(_0x4355aa){return client[_0xc3ae('0x2')](_0xc3ae('0x3'),{'body':_0x4355aa,'log':_0xc3ae('0x4')});}; \ No newline at end of file +var _0xc7b3=['Request','createSmsMessage'];(function(_0xfba67,_0x1c6e13){var _0x29649d=function(_0x34d2b2){while(--_0x34d2b2){_0xfba67['push'](_0xfba67['shift']());}};_0x29649d(++_0x1c6e13);}(_0xc7b3,0x1d8));var _0x3c7b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc7b3[_0x199572];return _0x13cfa3;};'use strict';var client=require('../client');exports['create']=function(_0xb76434){return client[_0x3c7b('0x0')]('CreateSmsMessage',{'body':_0xb76434,'log':_0x3c7b('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 74a02da..f40dfae 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x5005f8,_0xfa3fdd){var _0x323b48=function(_0x2a2181){while(--_0x2a2181){_0x5005f8['push'](_0x5005f8['shift']());}};_0x323b48(++_0xfa3fdd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x1cca3f,_0x1f765b){var _0x4bc82c=function(_0x531fbe){while(--_0x531fbe){_0x1cca3f['push'](_0x1cca3f['shift']());}};_0x4bc82c(++_0x1f765b);}(_0xe706,0xa3));var _0x6e70=function(_0x5c0dfb,_0x29fe5e){_0x5c0dfb=_0x5c0dfb-0x0;var _0x49be35=_0xe706[_0x5c0dfb];return _0x49be35;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a0a6419..eedcf92 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0xedd9,0xfc));var _0x9edd=function(_0x191e67,_0x241466){_0x191e67=_0x191e67-0x0;var _0x1440ed=_0xedd9[_0x191e67];return _0x1440ed;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x47d965,_0x3d67b8){var _0x4521c5=function(_0x520ced){while(--_0x520ced){_0x47d965['push'](_0x47d965['shift']());}};_0x4521c5(++_0x3d67b8);}(_0x34e8,0x12c));var _0x834e=function(_0x2c87d6,_0x47d137){_0x2c87d6=_0x2c87d6-0x0;var _0x425bd3=_0x34e8[_0x2c87d6];return _0x425bd3;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 742795a..ad421ca 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x367917,_0x31aa04){var _0x429f08=function(_0x4f182e){while(--_0x4f182e){_0x367917['push'](_0x367917['shift']());}};_0x429f08(++_0x31aa04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x2cda7,_0x53f7bc){var _0x1cfabd=function(_0x6fad3f){while(--_0x6fad3f){_0x2cda7['push'](_0x2cda7['shift']());}};_0x1cfabd(++_0x53f7bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index e4496e0..b408ad8 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 _0x8506=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','UpdateWhatsappInteraction','addTags'];(function(_0x236a3c,_0x1b41c2){var _0x58143e=function(_0x404abd){while(--_0x404abd){_0x236a3c['push'](_0x236a3c['shift']());}};_0x58143e(++_0x1b41c2);}(_0x8506,0xe8));var _0x6850=function(_0xc2545e,_0x3d148a){_0xc2545e=_0xc2545e-0x0;var _0x425f3b=_0x8506[_0xc2545e];return _0x425f3b;};'use strict';var client=require('../client');exports[_0x6850('0x0')]=function(_0x51d1a0,_0x2c8d62){return client['Request'](_0x6850('0x1'),{'body':_0x2c8d62,'options':{'where':{'id':_0x51d1a0}},'log':'updateWhatsappInteraction'});};exports[_0x6850('0x2')]=function(_0x204a8a,_0x321eff){return client['Request'](_0x6850('0x3'),{'body':_0x321eff,'options':{'where':{'id':_0x204a8a}},'log':_0x6850('0x4')});}; \ No newline at end of file +var _0x8375=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x8375,0xa8));var _0x5837=function(_0x352dd4,_0x4ebd50){_0x352dd4=_0x352dd4-0x0;var _0x311855=_0x8375[_0x352dd4];return _0x311855;};'use strict';var client=require(_0x5837('0x0'));exports[_0x5837('0x1')]=function(_0xe2a8d5,_0x50482c){return client[_0x5837('0x2')](_0x5837('0x3'),{'body':_0x50482c,'options':{'where':{'id':_0xe2a8d5}},'log':_0x5837('0x4')});};exports[_0x5837('0x5')]=function(_0x317452,_0x1edfc5){return client['Request'](_0x5837('0x6'),{'body':_0x1edfc5,'options':{'where':{'id':_0x317452}},'log':_0x5837('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 19205d6..d55feb5 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 _0x0a85=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x198dc5,_0x25dc86){var _0x22206f=function(_0x434d92){while(--_0x434d92){_0x198dc5['push'](_0x198dc5['shift']());}};_0x22206f(++_0x25dc86);}(_0x0a85,0x178));var _0x50a8=function(_0x47aa8c,_0x237762){_0x47aa8c=_0x47aa8c-0x0;var _0xfd2b53=_0x0a85[_0x47aa8c];return _0xfd2b53;};'use strict';var client=require(_0x50a8('0x0'));exports[_0x50a8('0x1')]=function(_0x88893b){return client[_0x50a8('0x2')](_0x50a8('0x3'),{'body':_0x88893b,'log':_0x50a8('0x4')});}; \ No newline at end of file +var _0xeecf=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0xeecf,0x101));var _0xfeec=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xeecf[_0x465028];return _0xb783d4;};'use strict';var client=require('../client');exports[_0xfeec('0x0')]=function(_0x579e24){return client['Request'](_0xfeec('0x1'),{'body':_0x579e24,'log':_0xfeec('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8c0b70d..04a903c 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 _0x7c1b=['Request','name','strategy','Agents','whatsappPause','getWhatsappQueues'];(function(_0x505df9,_0x14138e){var _0x1cc025=function(_0x5d2a1f){while(--_0x5d2a1f){_0x505df9['push'](_0x505df9['shift']());}};_0x1cc025(++_0x14138e);}(_0x7c1b,0x65));var _0xb7c1=function(_0x1487e1,_0x373c69){_0x1487e1=_0x1487e1-0x0;var _0x278e9d=_0x7c1b[_0x1487e1];return _0x278e9d;};'use strict';var client=require('../client');exports[_0xb7c1('0x0')]=function(){return function(){return client[_0xb7c1('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xb7c1('0x2'),'timeout',_0xb7c1('0x3')],'include':[{'model':'User','as':_0xb7c1('0x4'),'attributes':['id','name','online',_0xb7c1('0x5')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x061b=['name','timeout','strategy','User','Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x2c60c5,_0x50eba1){var _0x6f7df4=function(_0x36f382){while(--_0x36f382){_0x2c60c5['push'](_0x2c60c5['shift']());}};_0x6f7df4(++_0x50eba1);}(_0x061b,0x7e));var _0xb061=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x061b[_0x1694f5];return _0x5b4321;};'use strict';var client=require(_0xb061('0x0'));exports[_0xb061('0x1')]=function(){return function(){return client[_0xb061('0x2')](_0xb061('0x3'),{'options':{'raw':![],'attributes':['id',_0xb061('0x4'),_0xb061('0x5'),_0xb061('0x6')],'include':[{'model':_0xb061('0x7'),'as':_0xb061('0x8'),'attributes':['id','name','online',_0xb061('0x9')]}]},'log':_0xb061('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5d376be..5095f23 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 _0xc521=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x24f5ad,_0x31ef05){var _0x455039=function(_0x5ae992){while(--_0x5ae992){_0x24f5ad['push'](_0x24f5ad['shift']());}};_0x455039(++_0x31ef05);}(_0xc521,0x109));var _0x1c52=function(_0x42bd68,_0x599bec){_0x42bd68=_0x42bd68-0x0;var _0x44a6f0=_0xc521[_0x42bd68];return _0x44a6f0;};'use strict';var client=require(_0x1c52('0x0'));exports[_0x1c52('0x1')]=function(_0x4dcbaf){return client[_0x1c52('0x2')](_0x1c52('0x3'),{'body':_0x4dcbaf,'log':_0x1c52('0x3')});};exports[_0x1c52('0x4')]=function(_0x1fec73,_0x2d56da){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x2d56da,'options':{'where':{'uniqueid':_0x1fec73},'order':[['id','DESC']],'limit':0x1},'log':_0x1c52('0x5')});}; \ No newline at end of file +var _0x5d0d=['UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport','update','Request'];(function(_0x5019d4,_0x31493b){var _0x59093a=function(_0x34f811){while(--_0x34f811){_0x5019d4['push'](_0x5019d4['shift']());}};_0x59093a(++_0x31493b);}(_0x5d0d,0xc6));var _0xd5d0=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x5d0d[_0x14fad0];return _0x5c665f;};'use strict';var client=require(_0xd5d0('0x0'));exports[_0xd5d0('0x1')]=function(_0x49810e){return client['Request'](_0xd5d0('0x2'),{'body':_0x49810e,'log':'CreateWhatsappQueueReport'});};exports[_0xd5d0('0x3')]=function(_0x5bd4cc,_0x47896a){return client[_0xd5d0('0x4')](_0xd5d0('0x5'),{'body':_0x47896a,'options':{'where':{'uniqueid':_0x5bd4cc},'order':[['id',_0xd5d0('0x6')]],'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 8aaa216..5bfc4cd 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 _0xf408=['routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger'];(function(_0x3167d7,_0x4cf896){var _0x12645a=function(_0xb0c904){while(--_0xb0c904){_0x3167d7['push'](_0x3167d7['shift']());}};_0x12645a(++_0x4cf896);}(_0xf408,0xab));var _0x8f40=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0xf408[_0x1a37e3];return _0x4db78a;};'use strict';var schema=require(_0x8f40('0x0'));var _=require('lodash');var util=require(_0x8f40('0x1'));var seqqueue=require(_0x8f40('0x2'));var logger=require(_0x8f40('0x3'))(_0x8f40('0x4'));var strategy=require(_0x8f40('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x8f40('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5ede21,_0x4916bf,_0x12756a){return logger[_0x8f40('0x7')](util[_0x8f40('0x8')](_0x8f40('0x9'),_0x5ede21,_0x4916bf[_0x8f40('0xa')],_0x12756a));}function handleFindAgent(_0x3a38ad){return function(_0x2364ce){return _0x2364ce[_0x8f40('0xa')][_0x8f40('0xb')]()===_0x3a38ad[_0x8f40('0xb')]();};}exports[_0x8f40('0xc')]=function(_0x5dd00c,_0x751c4a,_0x93f30a,_0x530a5b){return function(_0x45bfe5){try{var _0x282de3={'name':_0x751c4a[0x0],'timeout':_0x751c4a[0x1]};var _0x3ad7b0=queue[_0x8f40('0x0')](_0x282de3,{'typecast':!![]});if(_0x3ad7b0[_0x8f40('0xd')]){logger[_0x8f40('0xe')](_0x8f40('0xf'),_0x5dd00c,_[_0x8f40('0x10')](_0x3ad7b0,_0x8f40('0x11'))[_0x8f40('0x12')](',\x20'));_0x45bfe5[_0x8f40('0x13')]();}else{var _0x1e45be=_[_0x8f40('0x14')](_0x93f30a['agents'],handleFindAgent(_0x282de3[_0x8f40('0xa')]));if(_0x1e45be){var _0x1309b7=(_0x282de3[_0x8f40('0x15')]||0xa)*0x3e8;var _0x2e98f2,_0x46200f;var _0x23ad8e=seqqueue[_0x8f40('0x16')](_0x1309b7);_0x23ad8e['id']=_0x5dd00c;_0x23ad8e[_0x8f40('0x17')]=_0x1309b7;_0x23ad8e[_0x8f40('0x18')]=_0x530a5b[_0x8f40('0x18')];writeLog(_0x5dd00c,_0x1e45be,util['format']('START:%s',_0x1309b7));_0x93f30a[_0x8f40('0x19')][_0x5dd00c]['on'](_0x8f40('0x1a'),function(){logger[_0x8f40('0x7')](_0x8f40('0x1b'),_0x5dd00c);clearTimeout(_0x46200f);_0x46200f=undefined;_0x23ad8e[_0x8f40('0x1c')]();if(_0x93f30a[_0x8f40('0x19')][_0x5dd00c]){delete _0x93f30a[_0x8f40('0x19')][_0x5dd00c];}_0x45bfe5[_0x8f40('0x13')]();});_0x93f30a[_0x8f40('0x19')][_0x5dd00c]['on'](_0x8f40('0x1d'),function(){if(_0x93f30a['rules'][_0x5dd00c]){delete _0x93f30a['rules'][_0x5dd00c];}});_0x46200f=setTimeout(function(){logger['info'](_0x8f40('0x1e'),_0x5dd00c);clearTimeout(_0x46200f);_0x23ad8e['close']();_0x45bfe5['next']();},_0x1309b7);strategy['agent'](_0x23ad8e,_0x1e45be,_0x93f30a,_0x530a5b);}else{logger['error'](_0x8f40('0x1f'),_0x5dd00c,_0x282de3['name']);_0x45bfe5[_0x8f40('0x13')]();}}}catch(_0x273a0a){console[_0x8f40('0x20')](_0x273a0a);logger[_0x8f40('0xe')](_0x8f40('0x21'),_0x5dd00c,_0x273a0a[_0x8f40('0x22')]);_0x45bfe5['stop']();}};}; \ No newline at end of file +var _0x7636=['number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','createQueue','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','lodash','util','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x5ce976,_0x4ad999){var _0x4f1374=function(_0x33db15){while(--_0x33db15){_0x5ce976['push'](_0x5ce976['shift']());}};_0x4f1374(++_0x4ad999);}(_0x7636,0xc1));var _0x6763=function(_0x25402e,_0x1ab8f2){_0x25402e=_0x25402e-0x0;var _0x168dbb=_0x7636[_0x25402e];return _0x168dbb;};'use strict';var schema=require('validate');var _=require(_0x6763('0x0'));var util=require(_0x6763('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x6763('0x2'))('routing');var strategy=require(_0x6763('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x6763('0x4')},'timeout':{'type':_0x6763('0x5'),'message':_0x6763('0x6')}});function writeLog(_0x4de736,_0x522e0d,_0x24965){return logger[_0x6763('0x7')](util[_0x6763('0x8')](_0x6763('0x9'),_0x4de736,_0x522e0d[_0x6763('0xa')],_0x24965));}function handleFindAgent(_0x599723){return function(_0x526b7d){return _0x526b7d['name']['toLowerCase']()===_0x599723[_0x6763('0xb')]();};}exports['consequence']=function(_0x219e83,_0x42be91,_0x122540,_0x440d94){return function(_0x9e0b99){try{var _0x2ebbca={'name':_0x42be91[0x0],'timeout':_0x42be91[0x1]};var _0x7be2db=queue[_0x6763('0xc')](_0x2ebbca,{'typecast':!![]});if(_0x7be2db[_0x6763('0xd')]){logger[_0x6763('0xe')](_0x6763('0xf'),_0x219e83,_[_0x6763('0x10')](_0x7be2db,_0x6763('0x11'))['join'](',\x20'));_0x9e0b99[_0x6763('0x12')]();}else{var _0x2c9733=_[_0x6763('0x13')](_0x122540[_0x6763('0x14')],handleFindAgent(_0x2ebbca['name']));if(_0x2c9733){var _0x137d5e=(_0x2ebbca['timeout']||0xa)*0x3e8;var _0xf53bcb,_0x1a7eda;var _0x3db698=seqqueue[_0x6763('0x15')](_0x137d5e);_0x3db698['id']=_0x219e83;_0x3db698[_0x6763('0x16')]=_0x137d5e;_0x3db698[_0x6763('0x17')]=_0x440d94[_0x6763('0x17')];writeLog(_0x219e83,_0x2c9733,util['format']('START:%s',_0x137d5e));_0x122540[_0x6763('0x18')][_0x219e83]['on']('end',function(){logger['info'](_0x6763('0x19'),_0x219e83);clearTimeout(_0x1a7eda);_0x1a7eda=undefined;_0x3db698[_0x6763('0x1a')]();if(_0x122540['rules'][_0x219e83]){delete _0x122540[_0x6763('0x18')][_0x219e83];}_0x9e0b99[_0x6763('0x12')]();});_0x122540[_0x6763('0x18')][_0x219e83]['on'](_0x6763('0x1b'),function(){if(_0x122540['rules'][_0x219e83]){delete _0x122540[_0x6763('0x18')][_0x219e83];}});_0x1a7eda=setTimeout(function(){logger[_0x6763('0x7')](_0x6763('0x1c'),_0x219e83);clearTimeout(_0x1a7eda);_0x3db698[_0x6763('0x1a')]();_0x9e0b99[_0x6763('0x1d')]();},_0x137d5e);strategy[_0x6763('0x1e')](_0x3db698,_0x2c9733,_0x122540,_0x440d94);}else{logger[_0x6763('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x219e83,_0x2ebbca[_0x6763('0xa')]);_0x9e0b99[_0x6763('0x12')]();}}}catch(_0x3fa57a){console[_0x6763('0x1f')](_0x3fa57a);logger[_0x6763('0xe')](_0x6763('0x20'),_0x219e83,_0x3fa57a['stack']);_0x9e0b99[_0x6763('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 2b7e92b..e0c8aa0 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 _0xd37e=['[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','create','then','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','error','amazonlex','providerName','Message','Failed','catch','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId'];(function(_0x5d326e,_0x452afe){var _0xdecfde=function(_0x5e3de9){while(--_0x5e3de9){_0x5d326e['push'](_0x5d326e['shift']());}};_0xdecfde(++_0x452afe);}(_0xd37e,0x1d2));var _0xed37=function(_0x185832,_0x53aeea){_0x185832=_0x185832-0x0;var _0x253dda=_0xd37e[_0x185832];return _0x253dda;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0xed37('0x0'));var utils=require(_0xed37('0x1'));var logger=require(_0xed37('0x2'))(_0xed37('0x3'));var rpc={'chatMessage':require(_0xed37('0x4')),'openchannelMessage':require(_0xed37('0x5')),'mailMessage':require(_0xed37('0x6')),'smsMessage':require(_0xed37('0x7')),'faxMessage':require(_0xed37('0x8')),'whatsappMessage':require(_0xed37('0x9'))};exports[_0xed37('0xa')]=function(_0x4ce78b,_0x1dd323){return function(_0x4d3c0f){try{if(!_[_0xed37('0xb')](this[_0xed37('0xc')][_0xed37('0xd')])){logger['info'](_0xed37('0xe'),_0x4ce78b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4d3c0f[_0xed37('0xf')]();}var _0x6aa93d={'ContactId':this[_0xed37('0x10')]['id'],'sentAt':moment()['format'](_0xed37('0x11')),'direction':_0xed37('0x12')};if(this[_0xed37('0x13')]===_0xed37('0x14')||this[_0xed37('0x13')]===_0xed37('0x15')){_0x6aa93d[_0xed37('0x16')]=this['interaction'][_0xed37('0x16')];}var _0x2f2fca=this[_0xed37('0x13')];if(_0x2f2fca==='chat'){_0x6aa93d[_0xed37('0x17')]=this[_0xed37('0x18')]['id'];}else{_0x6aa93d[_[_0xed37('0x19')](_0x2f2fca)+_0xed37('0x1a')]=this['account']['id'];}_0x6aa93d[_[_0xed37('0x19')](_0x2f2fca)+_0xed37('0x1b')]=this[_0xed37('0xc')]['id'];if(this[_0xed37('0xc')]['created']){var _0x3c75e5=_0x1dd323[0x4];if(!_[_0xed37('0x1c')](_0x3c75e5)){_0x6aa93d[_0xed37('0x1d')]=utils['getMustacheRender'](_0x3c75e5,this);return rpc[_0x2f2fca+'Message'][_0xed37('0x1e')](_0x6aa93d)[_0xed37('0x1f')](function(_0x508cac){logger['info'](_0xed37('0xe'),_0x4ce78b,_0x6aa93d[_0xed37('0x1d')]);})['catch'](function(_0x43f767){logger['error'](_0xed37('0xe'),_0x4ce78b,JSON[_0xed37('0x20')](_0x43f767));})[_0xed37('0x21')](function(){logger['info'](_0xed37('0x22'),_0x4ce78b);_0x4d3c0f[_0xed37('0x23')]();});}else{logger[_0xed37('0x24')](_0xed37('0x25'),_0x4ce78b);_0x4d3c0f[_0xed37('0x23')]();}}else{var _0x3d09dd=this;var _0x513162=new AWS[(_0xed37('0x26'))]({'accessKeyId':_0x1dd323[0x0],'secretAccessKey':_0x1dd323[0x1],'region':_0x1dd323[0x2]});var _0x67569f={'botAlias':'$LATEST','botName':_0x1dd323[0x3],'inputText':this[_0xed37('0x27')][_0xed37('0x1d')],'userId':this[_0xed37('0x13')]+':'+this['interaction']['id'][_0xed37('0x28')]()};_0x513162[_0xed37('0x29')](_0x67569f,function(_0x4b50b1,_0x303ac7){if(_0x4b50b1){logger[_0xed37('0x2a')](_0xed37('0xe'),_0x4ce78b,_0x4b50b1['message']);_0x4d3c0f[_0xed37('0xf')]();}else if(_0x303ac7&&_0x303ac7[_0xed37('0x27')]){_0x3d09dd['body'][_0xed37('0x2b')]=_0x303ac7;_0x6aa93d[_0xed37('0x1d')]=_0x303ac7[_0xed37('0x27')];_0x6aa93d[_0xed37('0x2c')]=_0xed37('0x2b');_0x6aa93d['providerResponse']=JSON[_0xed37('0x20')](_0x303ac7);return rpc[_0x2f2fca+_0xed37('0x2d')][_0xed37('0x1e')](_0x6aa93d)[_0xed37('0x1f')](function(_0x84eb85){logger[_0xed37('0x24')](_0xed37('0xe'),_0x4ce78b,_0x6aa93d['body']);if(_0x303ac7['dialogState']==_0xed37('0x2e')){_0x4d3c0f[_0xed37('0xf')]();}else{_0x4d3c0f['stop']();}})[_0xed37('0x2f')](function(_0x530368){logger[_0xed37('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x4ce78b,JSON[_0xed37('0x20')](_0x530368));_0x4d3c0f['next']();});}else{_0x4d3c0f[_0xed37('0xf')]();}});}}catch(_0x510062){logger[_0xed37('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x4ce78b,JSON['stringify'](_0x510062));_0x4d3c0f['stop']();}};}; \ No newline at end of file +var _0x7695=['phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','Message','create','body','catch','error','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','toString','amazonlex','providerResponse','then','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','channel'];(function(_0x2d73fe,_0x1dc9e3){var _0x4d812b=function(_0x1e93d7){while(--_0x1e93d7){_0x2d73fe['push'](_0x2d73fe['shift']());}};_0x4d812b(++_0x1dc9e3);}(_0x7695,0x106));var _0x5769=function(_0x3d806e,_0x3da98b){_0x3d806e=_0x3d806e-0x0;var _0xc1b331=_0x7695[_0x3d806e];return _0xc1b331;};'use strict';var _=require(_0x5769('0x0'));var moment=require(_0x5769('0x1'));var AWS=require(_0x5769('0x2'));var utils=require(_0x5769('0x3'));var logger=require(_0x5769('0x4'))(_0x5769('0x5'));var rpc={'chatMessage':require(_0x5769('0x6')),'openchannelMessage':require(_0x5769('0x7')),'mailMessage':require(_0x5769('0x8')),'smsMessage':require(_0x5769('0x9')),'faxMessage':require(_0x5769('0xa')),'whatsappMessage':require(_0x5769('0xb'))};exports[_0x5769('0xc')]=function(_0x42db31,_0x2bc5d8){return function(_0xa97a5){try{if(!_['isNil'](this[_0x5769('0xd')][_0x5769('0xe')])){logger[_0x5769('0xf')](_0x5769('0x10'),_0x42db31,_0x5769('0x11'));return _0xa97a5['next']();}var _0x3bc720={'ContactId':this[_0x5769('0x12')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']==='sms'||this[_0x5769('0x13')]==='whatsapp'){_0x3bc720[_0x5769('0x14')]=this['interaction'][_0x5769('0x14')];}var _0x34524b=this[_0x5769('0x13')];if(_0x34524b===_0x5769('0x15')){_0x3bc720[_0x5769('0x16')]=this[_0x5769('0x17')]['id'];}else{_0x3bc720[_[_0x5769('0x18')](_0x34524b)+_0x5769('0x19')]=this[_0x5769('0x17')]['id'];}_0x3bc720[_[_0x5769('0x18')](_0x34524b)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x5769('0x1a')]){var _0x4e14c0=_0x2bc5d8[0x4];if(!_['isEmpty'](_0x4e14c0)){_0x3bc720['body']=utils['getMustacheRender'](_0x4e14c0,this);return rpc[_0x34524b+_0x5769('0x1b')][_0x5769('0x1c')](_0x3bc720)['then'](function(_0x526878){logger[_0x5769('0xf')](_0x5769('0x10'),_0x42db31,_0x3bc720[_0x5769('0x1d')]);})[_0x5769('0x1e')](function(_0x280a93){logger[_0x5769('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x42db31,JSON[_0x5769('0x20')](_0x280a93));})[_0x5769('0x21')](function(){logger[_0x5769('0xf')](_0x5769('0x22'),_0x42db31);_0xa97a5[_0x5769('0x23')]();});}else{logger[_0x5769('0xf')](_0x5769('0x24'),_0x42db31);_0xa97a5['stop']();}}else{var _0x152167=this;var _0x25c177=new AWS[(_0x5769('0x25'))]({'accessKeyId':_0x2bc5d8[0x0],'secretAccessKey':_0x2bc5d8[0x1],'region':_0x2bc5d8[0x2]});var _0x2c61d4={'botAlias':_0x5769('0x26'),'botName':_0x2bc5d8[0x3],'inputText':this[_0x5769('0x27')][_0x5769('0x1d')],'userId':this[_0x5769('0x13')]+':'+this[_0x5769('0xd')]['id'][_0x5769('0x28')]()};_0x25c177['postText'](_0x2c61d4,function(_0x2dc159,_0x7e97af){if(_0x2dc159){logger[_0x5769('0x1f')](_0x5769('0x10'),_0x42db31,_0x2dc159[_0x5769('0x27')]);_0xa97a5['next']();}else if(_0x7e97af&&_0x7e97af[_0x5769('0x27')]){_0x152167[_0x5769('0x1d')][_0x5769('0x29')]=_0x7e97af;_0x3bc720[_0x5769('0x1d')]=_0x7e97af[_0x5769('0x27')];_0x3bc720['providerName']=_0x5769('0x29');_0x3bc720[_0x5769('0x2a')]=JSON[_0x5769('0x20')](_0x7e97af);return rpc[_0x34524b+_0x5769('0x1b')][_0x5769('0x1c')](_0x3bc720)[_0x5769('0x2b')](function(_0x190388){logger[_0x5769('0xf')]('[%s][AMAZONLEX]\x20%s',_0x42db31,_0x3bc720['body']);if(_0x7e97af[_0x5769('0x2c')]==_0x5769('0x2d')){_0xa97a5[_0x5769('0x2e')]();}else{_0xa97a5[_0x5769('0x23')]();}})[_0x5769('0x1e')](function(_0x181188){logger[_0x5769('0x1f')](_0x5769('0x10'),_0x42db31,JSON[_0x5769('0x20')](_0x181188));_0xa97a5[_0x5769('0x2e')]();});}else{_0xa97a5['next']();}});}}catch(_0xa6cb07){logger[_0x5769('0x1f')](_0x5769('0x10'),_0x42db31,JSON[_0x5769('0x20')](_0xa6cb07));_0xa97a5[_0x5769('0x23')]();}};}; \ 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 16be9d3..185c357 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 _0x1d56=['finally','autoreplyExecuted','Interaction','update','error','resolve','stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','isAutoreply','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','','replace','','headers','auto-replied','All','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify'];(function(_0x4e3faf,_0x1bfebb){var _0x5e45fe=function(_0x4a19ef){while(--_0x4a19ef){_0x4e3faf['push'](_0x4e3faf['shift']());}};_0x5e45fe(++_0x1bfebb);}(_0x1d56,0xe2));var _0x61d5=function(_0x2a67a2,_0x1de37e){_0x2a67a2=_0x2a67a2-0x0;var _0x1709f9=_0x1d56[_0x2a67a2];return _0x1709f9;};'use strict';var _=require(_0x61d5('0x0'));var moment=require('moment');var utils=require(_0x61d5('0x1'));var logger=require(_0x61d5('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x61d5('0x3')),'mailMessage':require(_0x61d5('0x4')),'smsMessage':require(_0x61d5('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x61d5('0x6')),'chatInteraction':require(_0x61d5('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x61d5('0x8')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x61d5('0x9')),'whatsappInteraction':require(_0x61d5('0xa'))};var mailRpc=require(_0x61d5('0xb'));exports['consequence']=function(_0x18f528,_0x51e1c6,_0x134762,_0xcf03a4){return function(_0x4c22be){try{var _0x7766be=this[_0x61d5('0xc')];if(_0x7766be===_0x61d5('0xd')&&_0xcf03a4[_0x61d5('0xe')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x18f528,_0x61d5('0xf'));return _0x4c22be[_0x61d5('0x10')]();}if(_0x51e1c6[0x0]==='1'&&(_['isNil'](this['interaction'][_0x61d5('0x11')])||!this['interaction'][_0x61d5('0x11')])){logger[_0x61d5('0x12')](_0x61d5('0x13'),_0x18f528,_0x61d5('0x14'));return _0x4c22be[_0x61d5('0x10')]();}if(_0x51e1c6[0x0]==='2'&&this[_0x61d5('0x15')]['autoreplyExecuted']){logger['info'](_0x61d5('0x16'),_0x18f528,_0x61d5('0x17'));return _0x4c22be[_0x61d5('0x10')]();}var _0x3d1c4a={'ContactId':this[_0x61d5('0x18')]['id'],'sentAt':moment()[_0x61d5('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x61d5('0x1a')};if(this[_0x61d5('0xc')]===_0x61d5('0xd')){_0x3d1c4a[_0x61d5('0x1b')]=utils[_0x61d5('0x1c')](_0x51e1c6[0x2],this);}else{_0x3d1c4a['body']=utils[_0x61d5('0x1c')](_0x51e1c6[0x1],this);}if(this[_0x61d5('0x1d')]){_0x3d1c4a['to']=this[_0x61d5('0x1d')][_0x61d5('0x1e')]||'';if(this['channel']===_0x61d5('0xd')&&_0x51e1c6[0x1]==='1'){_0x3d1c4a['cc']=this[_0x61d5('0x1d')]['cc']||'';}_0x3d1c4a['from']=this[_0x61d5('0x1d')]['to']||'';_0x3d1c4a[_0x61d5('0x1f')]=this['message'][_0x61d5('0x1f')]||'';_0x3d1c4a[_0x61d5('0x20')]=!![];if(this[_0x61d5('0x1d')][_0x61d5('0x21')]){_0x3d1c4a[_0x61d5('0x21')]='';_0x3d1c4a[_0x61d5('0x21')]+=_[_0x61d5('0x22')](this['message'][_0x61d5('0x21')],'Re:')?'':_0x61d5('0x23');_0x3d1c4a[_0x61d5('0x21')]+=this[_0x61d5('0x1d')][_0x61d5('0x21')];}}if(this['channel']==='chat'){_0x3d1c4a['ChatWebsiteId']=this[_0x61d5('0x24')]['id'];}else{_0x3d1c4a[_[_0x61d5('0x25')](this[_0x61d5('0xc')])+_0x61d5('0x26')]=this[_0x61d5('0x24')]['id'];}_0x3d1c4a[_[_0x61d5('0x25')](this[_0x61d5('0xc')])+_0x61d5('0x27')]=this[_0x61d5('0x15')]['id'];var _0x137329=this[_0x61d5('0x15')];if(rpc[this[_0x61d5('0xc')]+_0x61d5('0x28')]){if(this[_0x61d5('0xc')]==='mail'){var _0x9058a0={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x61d5('0x29')]['service']){_0x9058a0[_0x61d5('0x2a')]=this[_0x61d5('0x24')]['Smtp']['service'];}else{_0x9058a0[_0x61d5('0x2b')]=this[_0x61d5('0x24')][_0x61d5('0x29')]['host'];_0x9058a0[_0x61d5('0x2c')]=this['account']['Smtp'][_0x61d5('0x2c')];_0x9058a0[_0x61d5('0x2d')]=this[_0x61d5('0x24')][_0x61d5('0x29')][_0x61d5('0x2d')];}if(this[_0x61d5('0x24')][_0x61d5('0x29')][_0x61d5('0x2e')]){_0x9058a0[_0x61d5('0x2f')]={'user':this[_0x61d5('0x24')]['Smtp'][_0x61d5('0x30')],'pass':this[_0x61d5('0x24')]['Smtp'][_0x61d5('0x31')]};}_0x3d1c4a[_0x61d5('0x32')]=this[_0x61d5('0x1d')][_0x61d5('0x33')];_0x3d1c4a['html']=_0x61d5('0x34')+_[_0x61d5('0x35')](_0x3d1c4a[_0x61d5('0x1b')],_0x61d5('0x36'),_0x61d5('0x37'))+_0x61d5('0x38');_0x3d1c4a[_0x61d5('0x39')]={'Auto-Submitted':_0x61d5('0x3a'),'X-Auto-Response-Suppress':_0x61d5('0x3b'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x9058a0,_0x3d1c4a)[_0x61d5('0x3c')](function(_0x45daa6){logger[_0x61d5('0x12')](_0x61d5('0x3d'),_0x18f528);_0x3d1c4a[_0x61d5('0x33')]=_0x45daa6['message'][_0x61d5('0x33')];return rpc[_0x7766be+_0x61d5('0x28')][_0x61d5('0x3e')](_0x3d1c4a);})[_0x61d5('0x3c')](function(_0x2c611d){logger[_0x61d5('0x12')](_0x61d5('0x13'),_0x18f528,JSON['stringify'](_0x2c611d));})[_0x61d5('0x3f')](function(_0x503f9e){logger['error'](_0x61d5('0x40'),_0x18f528,JSON[_0x61d5('0x41')](_0x503f9e));})[_0x61d5('0x42')](function(){Promise['resolve']()[_0x61d5('0x3c')](function(){if(_0x51e1c6[0x0]!=='2'||_0x137329[_0x61d5('0x43')])return;return rpc[_0x7766be+_0x61d5('0x44')][_0x61d5('0x45')](_0x137329['id'],{'autoreplyExecuted':!![]})[_0x61d5('0x3c')](function(_0x2e237b){logger[_0x61d5('0x12')](_0x61d5('0x16'),_0x18f528,JSON[_0x61d5('0x41')](_0x2e237b));})[_0x61d5('0x3f')](function(_0x4b9592){logger[_0x61d5('0x46')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x18f528,JSON['stringify'](_0x4b9592));});})['then'](function(){_0x4c22be[_0x61d5('0x10')]();});});}else{return rpc[this['channel']+'Message']['create'](_0x3d1c4a)[_0x61d5('0x3c')](function(_0x3f3801){logger[_0x61d5('0x12')](_0x61d5('0x13'),_0x18f528,_0x3d1c4a[_0x61d5('0x1b')]);})[_0x61d5('0x3f')](function(_0x13d36c){logger[_0x61d5('0x46')](_0x61d5('0x13'),_0x18f528,JSON[_0x61d5('0x41')](_0x13d36c));})['finally'](function(){Promise[_0x61d5('0x47')]()[_0x61d5('0x3c')](function(){if(_0x51e1c6[0x0]!=='2'||_0x137329[_0x61d5('0x43')])return;return rpc[_0x7766be+_0x61d5('0x44')]['update'](_0x137329['id'],{'autoreplyExecuted':!![]})[_0x61d5('0x3c')](function(_0x2e1854){logger[_0x61d5('0x12')](_0x61d5('0x16'),_0x18f528,JSON[_0x61d5('0x41')](_0x2e1854));})[_0x61d5('0x3f')](function(_0x234620){logger[_0x61d5('0x46')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x18f528,JSON[_0x61d5('0x41')](_0x234620));});})[_0x61d5('0x3c')](function(){_0x4c22be[_0x61d5('0x10')]();});});}}}catch(_0x5154cb){logger[_0x61d5('0x46')](_0x61d5('0x13'),_0x18f528,JSON[_0x61d5('0x41')](_0x5154cb));_0x4c22be[_0x61d5('0x48')]();}};}; \ No newline at end of file +var _0xe549=['../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','AccountId','account','InteractionId','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','replace','','auto-replied','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','then','update','finally','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','routing'];(function(_0x2ead06,_0x35be48){var _0x1f43e4=function(_0xc3701){while(--_0xc3701){_0x2ead06['push'](_0x2ead06['shift']());}};_0x1f43e4(++_0x35be48);}(_0xe549,0x137));var _0x9e54=function(_0x3a7103,_0x2774a2){_0x3a7103=_0x3a7103-0x0;var _0x2ac266=_0xe549[_0x3a7103];return _0x2ac266;};'use strict';var _=require(_0x9e54('0x0'));var moment=require(_0x9e54('0x1'));var utils=require(_0x9e54('0x2'));var logger=require(_0x9e54('0x3'))(_0x9e54('0x4'));var rpc={'chatMessage':require(_0x9e54('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9e54('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9e54('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x9e54('0x8')),'openchannelInteraction':require(_0x9e54('0x9')),'mailInteraction':require(_0x9e54('0xa')),'smsInteraction':require(_0x9e54('0xb')),'faxInteraction':require(_0x9e54('0xc')),'whatsappInteraction':require(_0x9e54('0xd'))};var mailRpc=require(_0x9e54('0xe'));exports['consequence']=function(_0x33137e,_0x877ecb,_0x2e7a21,_0x46054a){return function(_0x1df1fd){try{var _0x3b9d20=this[_0x9e54('0xf')];if(_0x3b9d20==='mail'&&_0x46054a[_0x9e54('0x10')][_0x9e54('0x11')]){logger[_0x9e54('0x12')]('[%s][AUTOREPLY]\x20%s',_0x33137e,_0x9e54('0x13'));return _0x1df1fd[_0x9e54('0x14')]();}if(_0x877ecb[0x0]==='1'&&(_[_0x9e54('0x15')](this[_0x9e54('0x16')][_0x9e54('0x17')])||!this[_0x9e54('0x16')]['created'])){logger['info'](_0x9e54('0x18'),_0x33137e,_0x9e54('0x19'));return _0x1df1fd[_0x9e54('0x14')]();}if(_0x877ecb[0x0]==='2'&&this[_0x9e54('0x16')][_0x9e54('0x1a')]){logger[_0x9e54('0x12')](_0x9e54('0x1b'),_0x33137e,_0x9e54('0x1c'));return _0x1df1fd[_0x9e54('0x14')]();}var _0x4ac660={'ContactId':this[_0x9e54('0x1d')]['id'],'sentAt':moment()[_0x9e54('0x1e')](_0x9e54('0x1f')),'direction':_0x9e54('0x20')};if(this[_0x9e54('0xf')]===_0x9e54('0x21')){_0x4ac660[_0x9e54('0x10')]=utils[_0x9e54('0x22')](_0x877ecb[0x2],this);}else{_0x4ac660['body']=utils[_0x9e54('0x22')](_0x877ecb[0x1],this);}if(this[_0x9e54('0x23')]){_0x4ac660['to']=this[_0x9e54('0x23')]['from']||'';if(this[_0x9e54('0xf')]===_0x9e54('0x21')&&_0x877ecb[0x1]==='1'){_0x4ac660['cc']=this[_0x9e54('0x23')]['cc']||'';}_0x4ac660[_0x9e54('0x24')]=this[_0x9e54('0x23')]['to']||'';_0x4ac660[_0x9e54('0x25')]=this[_0x9e54('0x23')][_0x9e54('0x25')]||'';_0x4ac660[_0x9e54('0x26')]=!![];if(this[_0x9e54('0x23')]['subject']){_0x4ac660[_0x9e54('0x27')]='';_0x4ac660[_0x9e54('0x27')]+=_[_0x9e54('0x28')](this['message'][_0x9e54('0x27')],_0x9e54('0x29'))?'':_0x9e54('0x2a');_0x4ac660['subject']+=this[_0x9e54('0x23')]['subject'];}}if(this['channel']==='chat'){_0x4ac660[_0x9e54('0x2b')]=this['account']['id'];}else{_0x4ac660[_['upperFirst'](this[_0x9e54('0xf')])+_0x9e54('0x2c')]=this[_0x9e54('0x2d')]['id'];}_0x4ac660[_['upperFirst'](this[_0x9e54('0xf')])+_0x9e54('0x2e')]=this[_0x9e54('0x16')]['id'];var _0x272799=this[_0x9e54('0x16')];if(rpc[this[_0x9e54('0xf')]+'Message']){if(this['channel']===_0x9e54('0x21')){var _0x18cf4d={'tls':{'rejectUnauthorized':![]}};if(this[_0x9e54('0x2d')]['Smtp']['service']){_0x18cf4d['service']=this[_0x9e54('0x2d')][_0x9e54('0x2f')][_0x9e54('0x30')];}else{_0x18cf4d[_0x9e54('0x31')]=this[_0x9e54('0x2d')][_0x9e54('0x2f')][_0x9e54('0x31')];_0x18cf4d[_0x9e54('0x32')]=this[_0x9e54('0x2d')][_0x9e54('0x2f')][_0x9e54('0x32')];_0x18cf4d[_0x9e54('0x33')]=this['account']['Smtp'][_0x9e54('0x33')];}if(this['account'][_0x9e54('0x2f')][_0x9e54('0x34')]){_0x18cf4d[_0x9e54('0x35')]={'user':this['account'][_0x9e54('0x2f')][_0x9e54('0x36')],'pass':this[_0x9e54('0x2d')][_0x9e54('0x2f')][_0x9e54('0x37')]};}_0x4ac660[_0x9e54('0x38')]=this[_0x9e54('0x23')][_0x9e54('0x39')];_0x4ac660[_0x9e54('0x3a')]=_0x9e54('0x3b')+_[_0x9e54('0x3c')](_0x4ac660[_0x9e54('0x10')],_0x9e54('0x3d'),_0x9e54('0x3e'))+_0x9e54('0x3f');_0x4ac660['headers']={'Auto-Submitted':_0x9e54('0x40'),'X-Auto-Response-Suppress':'All','Precedence':_0x9e54('0x41')};return mailRpc[_0x9e54('0x42')](_0x18cf4d,_0x4ac660)['then'](function(_0x1909f9){logger[_0x9e54('0x12')](_0x9e54('0x43'),_0x33137e);_0x4ac660[_0x9e54('0x39')]=_0x1909f9[_0x9e54('0x23')][_0x9e54('0x39')];return rpc[_0x3b9d20+_0x9e54('0x44')][_0x9e54('0x45')](_0x4ac660);})['then'](function(_0x329ed2){logger[_0x9e54('0x12')](_0x9e54('0x18'),_0x33137e,JSON[_0x9e54('0x46')](_0x329ed2));})[_0x9e54('0x47')](function(_0x113fe6){logger[_0x9e54('0x48')](_0x9e54('0x49'),_0x33137e,JSON['stringify'](_0x113fe6));})['finally'](function(){Promise['resolve']()[_0x9e54('0x4a')](function(){if(_0x877ecb[0x0]!=='2'||_0x272799[_0x9e54('0x1a')])return;return rpc[_0x3b9d20+'Interaction'][_0x9e54('0x4b')](_0x272799['id'],{'autoreplyExecuted':!![]})['then'](function(_0x245dc1){logger[_0x9e54('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x33137e,JSON[_0x9e54('0x46')](_0x245dc1));})['catch'](function(_0x35c863){logger[_0x9e54('0x48')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x33137e,JSON[_0x9e54('0x46')](_0x35c863));});})[_0x9e54('0x4a')](function(){_0x1df1fd['next']();});});}else{return rpc[this[_0x9e54('0xf')]+'Message']['create'](_0x4ac660)['then'](function(_0x2e2714){logger[_0x9e54('0x12')](_0x9e54('0x18'),_0x33137e,_0x4ac660[_0x9e54('0x10')]);})[_0x9e54('0x47')](function(_0x1493ed){logger[_0x9e54('0x48')](_0x9e54('0x18'),_0x33137e,JSON[_0x9e54('0x46')](_0x1493ed));})[_0x9e54('0x4c')](function(){Promise[_0x9e54('0x4d')]()[_0x9e54('0x4a')](function(){if(_0x877ecb[0x0]!=='2'||_0x272799['autoreplyExecuted'])return;return rpc[_0x3b9d20+'Interaction'][_0x9e54('0x4b')](_0x272799['id'],{'autoreplyExecuted':!![]})[_0x9e54('0x4a')](function(_0x3a824f){logger[_0x9e54('0x12')](_0x9e54('0x1b'),_0x33137e,JSON[_0x9e54('0x46')](_0x3a824f));})['catch'](function(_0x23c5ed){logger[_0x9e54('0x48')](_0x9e54('0x4e'),_0x33137e,JSON['stringify'](_0x23c5ed));});})[_0x9e54('0x4a')](function(){_0x1df1fd[_0x9e54('0x14')]();});});}}}catch(_0x295fb6){logger[_0x9e54('0x48')](_0x9e54('0x18'),_0x33137e,JSON[_0x9e54('0x46')](_0x295fb6));_0x1df1fd['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 a60faa9..3f51896 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 _0xd3c2=['stop','error','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','stringify'];(function(_0x7f5ce2,_0x384d94){var _0x4b2ab4=function(_0x34b884){while(--_0x34b884){_0x7f5ce2['push'](_0x7f5ce2['shift']());}};_0x4b2ab4(++_0x384d94);}(_0xd3c2,0x1d0));var _0x2d3c=function(_0xcdb645,_0x138c06){_0xcdb645=_0xcdb645-0x0;var _0x246212=_0xd3c2[_0xcdb645];return _0x246212;};'use strict';var moment=require('moment');var logger=require(_0x2d3c('0x0'))(_0x2d3c('0x1'));var rpc={'chatInteraction':require(_0x2d3c('0x2')),'openchannelInteraction':require(_0x2d3c('0x3')),'smsInteraction':require(_0x2d3c('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x2d3c('0x5')),'whatsappInteraction':require(_0x2d3c('0x6'))};exports[_0x2d3c('0x7')]=function(_0x5491d5,_0x282c69,_0x1bf3a4,_0x1c2708){return function(_0x5aed64){try{logger[_0x2d3c('0x8')](_0x2d3c('0x9'),_0x5491d5,_0x282c69[0x0]);var _0x2eaa92={'closed':0x1,'closedAt':moment()[_0x2d3c('0xa')](_0x2d3c('0xb')),'closeReason':_0x2d3c('0xc'),'disposition':_0x282c69[0x0]};if(rpc[_0x1c2708[_0x2d3c('0xd')]+_0x2d3c('0xe')]){rpc[_0x1c2708['channel']+_0x2d3c('0xe')]['update'](_0x1c2708[_0x2d3c('0xf')]['id'],_0x2eaa92)[_0x2d3c('0x10')](function(_0x35b1d4){logger[_0x2d3c('0x8')](_0x2d3c('0x11'),_0x5491d5,_0x1c2708[_0x2d3c('0xf')]['id']);})['catch'](function(_0x3ee3d9){logger['error'](_0x2d3c('0x12'),_0x5491d5,JSON[_0x2d3c('0x13')](_0x3ee3d9));})['finally'](function(){_0x5aed64[_0x2d3c('0x14')]();});}}catch(_0x298d9b){logger[_0x2d3c('0x15')](_0x2d3c('0x12'),_0x5491d5,JSON['stringify'](_0x298d9b));_0x5aed64[_0x2d3c('0x14')]();}};}; \ No newline at end of file +var _0xc0ab=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','channel','Interaction','update'];(function(_0x50b766,_0x46d9ab){var _0x16535e=function(_0x8fc50c){while(--_0x8fc50c){_0x50b766['push'](_0x50b766['shift']());}};_0x16535e(++_0x46d9ab);}(_0xc0ab,0x11f));var _0xbc0a=function(_0x966478,_0x5b7b09){_0x966478=_0x966478-0x0;var _0x5ec091=_0xc0ab[_0x966478];return _0x5ec091;};'use strict';var moment=require(_0xbc0a('0x0'));var logger=require(_0xbc0a('0x1'))(_0xbc0a('0x2'));var rpc={'chatInteraction':require(_0xbc0a('0x3')),'openchannelInteraction':require(_0xbc0a('0x4')),'smsInteraction':require(_0xbc0a('0x5')),'mailInteraction':require(_0xbc0a('0x6')),'faxInteraction':require(_0xbc0a('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x21379d,_0x4ba4db,_0x3b1739,_0x182fa7){return function(_0x44ad84){try{logger[_0xbc0a('0x8')](_0xbc0a('0x9'),_0x21379d,_0x4ba4db[0x0]);var _0x17b52a={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x4ba4db[0x0]};if(rpc[_0x182fa7[_0xbc0a('0xa')]+_0xbc0a('0xb')]){rpc[_0x182fa7[_0xbc0a('0xa')]+_0xbc0a('0xb')][_0xbc0a('0xc')](_0x182fa7['interaction']['id'],_0x17b52a)['then'](function(_0x10e3a9){logger['info'](_0xbc0a('0xd'),_0x21379d,_0x182fa7[_0xbc0a('0xe')]['id']);})['catch'](function(_0x37d13e){logger['error'](_0xbc0a('0xf'),_0x21379d,JSON[_0xbc0a('0x10')](_0x37d13e));})[_0xbc0a('0x11')](function(){_0x44ad84[_0xbc0a('0x12')]();});}}catch(_0x1b89bd){logger[_0xbc0a('0x13')](_0xbc0a('0xf'),_0x21379d,JSON[_0xbc0a('0x10')](_0x1b89bd));_0x44ad84[_0xbc0a('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 26eaca7..34b0131 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 _0xd206=['contact','format','out','sms','phone','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','Message','create','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','endConversation','next','lodash','moment','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','interaction','info','[%s][DIALOGFLOW]\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd206,0x107));var _0x6d20=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xd206[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x6d20('0x0'));var moment=require(_0x6d20('0x1'));var apiai=require('apiai-promise');var md5=require(_0x6d20('0x2'));var utils=require(_0x6d20('0x3'));var logger=require(_0x6d20('0x4'))('routing');var rpc={'chatMessage':require(_0x6d20('0x5')),'openchannelMessage':require(_0x6d20('0x6')),'mailMessage':require(_0x6d20('0x7')),'smsMessage':require(_0x6d20('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6d20('0x9'))};exports['consequence']=function(_0x4dc981,_0x125a39){return function(_0x3080fb){try{if(!_['isNil'](this[_0x6d20('0xa')]['UserId'])){logger[_0x6d20('0xb')](_0x6d20('0xc'),_0x4dc981,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3080fb['next']();}var _0x5610b6={'ContactId':this[_0x6d20('0xd')]['id'],'sentAt':moment()[_0x6d20('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6d20('0xf')};if(this['channel']===_0x6d20('0x10')||this['channel']==='whatsapp'){_0x5610b6['phone']=this['interaction'][_0x6d20('0x11')];}var _0x19ae24=this[_0x6d20('0x12')];if(_0x19ae24===_0x6d20('0x13')){_0x5610b6[_0x6d20('0x14')]=this[_0x6d20('0x15')]['id'];}else{_0x5610b6[_['upperFirst'](_0x19ae24)+_0x6d20('0x16')]=this['account']['id'];}_0x5610b6[_[_0x6d20('0x17')](_0x19ae24)+_0x6d20('0x18')]=this['interaction']['id'];if(this[_0x6d20('0xa')][_0x6d20('0x19')]){var _0xf93805=_0x125a39[0x2];if(!_[_0x6d20('0x1a')](_0xf93805)){_0x5610b6['body']=utils['getMustacheRender'](_0xf93805,this);return rpc[_0x19ae24+_0x6d20('0x1b')][_0x6d20('0x1c')](_0x5610b6)['then'](function(_0x10b87){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x4dc981,_0x5610b6[_0x6d20('0x1d')]);})[_0x6d20('0x1e')](function(_0x3fc510){logger[_0x6d20('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x4dc981,JSON[_0x6d20('0x20')](_0x3fc510));})[_0x6d20('0x21')](function(){logger[_0x6d20('0xb')](_0x6d20('0x22'),_0x4dc981);_0x3080fb[_0x6d20('0x23')]();});}else{logger[_0x6d20('0xb')](_0x6d20('0x24'),_0x4dc981);_0x3080fb[_0x6d20('0x23')]();}}else{var _0x19802c=this;var _0x1c5580=apiai(_0x125a39[0x0],{'language':_0x125a39[0x1]||'en'});return _0x1c5580['textRequest'](this[_0x6d20('0x25')]['body'],{'sessionId':md5(this[_0x6d20('0xa')]['id'])})['then'](function(_0x3ab2f1){_0x19802c[_0x6d20('0x1d')][_0x6d20('0x26')]=_0x3ab2f1;_0x5610b6[_0x6d20('0x1d')]=_0x3ab2f1[_0x6d20('0x27')][_0x6d20('0x28')][_0x6d20('0x29')];_0x5610b6[_0x6d20('0x2a')]=_0x6d20('0x26');_0x5610b6[_0x6d20('0x2b')]=JSON[_0x6d20('0x20')](_0x3ab2f1);return rpc[_0x19ae24+'Message'][_0x6d20('0x1c')](_0x5610b6)['then'](function(_0x3da5a3){logger[_0x6d20('0xb')](_0x6d20('0xc'),_0x4dc981,_0x5610b6[_0x6d20('0x1d')]);if(_0x3ab2f1[_0x6d20('0x27')]['metadata'][_0x6d20('0x2c')]){_0x3080fb[_0x6d20('0x2d')]();}else{_0x3080fb[_0x6d20('0x23')]();}})[_0x6d20('0x1e')](function(_0x5413ca){logger[_0x6d20('0x1f')](_0x6d20('0xc'),_0x4dc981,JSON[_0x6d20('0x20')](_0x5413ca));_0x3080fb['next']();});})[_0x6d20('0x1e')](function(_0x1bbf05){logger[_0x6d20('0x1f')](_0x6d20('0xc'),_0x4dc981,_0x1bbf05[_0x6d20('0x25')]);_0x3080fb[_0x6d20('0x2d')]();});}}catch(_0xd2431f){logger[_0x6d20('0x1f')](_0x6d20('0xc'),_0x4dc981,JSON[_0x6d20('0x20')](_0xd2431f));_0x3080fb[_0x6d20('0x23')]();}};}; \ No newline at end of file +var _0xafca=['catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','create','metadata','endConversation','lodash','apiai-promise','md5','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xafca,0x1ef));var _0xaafc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xafca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaafc('0x0'));var moment=require('moment');var apiai=require(_0xaafc('0x1'));var md5=require(_0xaafc('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xaafc('0x3'));var rpc={'chatMessage':require(_0xaafc('0x4')),'openchannelMessage':require(_0xaafc('0x5')),'mailMessage':require(_0xaafc('0x6')),'smsMessage':require(_0xaafc('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xaafc('0x8'))};exports[_0xaafc('0x9')]=function(_0x978cf0,_0x29d3ec){return function(_0x83ea82){try{if(!_[_0xaafc('0xa')](this[_0xaafc('0xb')][_0xaafc('0xc')])){logger[_0xaafc('0xd')](_0xaafc('0xe'),_0x978cf0,_0xaafc('0xf'));return _0x83ea82[_0xaafc('0x10')]();}var _0x492f3c={'ContactId':this['contact']['id'],'sentAt':moment()[_0xaafc('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xaafc('0x12')};if(this['channel']===_0xaafc('0x13')||this['channel']===_0xaafc('0x14')){_0x492f3c[_0xaafc('0x15')]=this[_0xaafc('0xb')][_0xaafc('0x15')];}var _0x31b893=this[_0xaafc('0x16')];if(_0x31b893===_0xaafc('0x17')){_0x492f3c[_0xaafc('0x18')]=this[_0xaafc('0x19')]['id'];}else{_0x492f3c[_[_0xaafc('0x1a')](_0x31b893)+_0xaafc('0x1b')]=this['account']['id'];}_0x492f3c[_[_0xaafc('0x1a')](_0x31b893)+_0xaafc('0x1c')]=this[_0xaafc('0xb')]['id'];if(this[_0xaafc('0xb')][_0xaafc('0x1d')]){var _0x1248ac=_0x29d3ec[0x2];if(!_[_0xaafc('0x1e')](_0x1248ac)){_0x492f3c[_0xaafc('0x1f')]=utils[_0xaafc('0x20')](_0x1248ac,this);return rpc[_0x31b893+_0xaafc('0x21')]['create'](_0x492f3c)[_0xaafc('0x22')](function(_0x504fa0){logger[_0xaafc('0xd')](_0xaafc('0xe'),_0x978cf0,_0x492f3c[_0xaafc('0x1f')]);})[_0xaafc('0x23')](function(_0x41033){logger[_0xaafc('0x24')](_0xaafc('0xe'),_0x978cf0,JSON[_0xaafc('0x25')](_0x41033));})[_0xaafc('0x26')](function(){logger['info'](_0xaafc('0x27'),_0x978cf0);_0x83ea82[_0xaafc('0x28')]();});}else{logger['info'](_0xaafc('0x29'),_0x978cf0);_0x83ea82[_0xaafc('0x28')]();}}else{var _0x7bc70a=this;var _0x521f26=apiai(_0x29d3ec[0x0],{'language':_0x29d3ec[0x1]||'en'});return _0x521f26[_0xaafc('0x2a')](this[_0xaafc('0x2b')][_0xaafc('0x1f')],{'sessionId':md5(this['interaction']['id'])})[_0xaafc('0x22')](function(_0xd3b1a2){_0x7bc70a['body'][_0xaafc('0x2c')]=_0xd3b1a2;_0x492f3c[_0xaafc('0x1f')]=_0xd3b1a2[_0xaafc('0x2d')][_0xaafc('0x2e')][_0xaafc('0x2f')];_0x492f3c[_0xaafc('0x30')]='dialogflow';_0x492f3c[_0xaafc('0x31')]=JSON[_0xaafc('0x25')](_0xd3b1a2);return rpc[_0x31b893+_0xaafc('0x21')][_0xaafc('0x32')](_0x492f3c)['then'](function(_0x43e3f1){logger[_0xaafc('0xd')](_0xaafc('0xe'),_0x978cf0,_0x492f3c[_0xaafc('0x1f')]);if(_0xd3b1a2[_0xaafc('0x2d')][_0xaafc('0x33')][_0xaafc('0x34')]){_0x83ea82[_0xaafc('0x10')]();}else{_0x83ea82[_0xaafc('0x28')]();}})[_0xaafc('0x23')](function(_0x731bb4){logger[_0xaafc('0x24')](_0xaafc('0xe'),_0x978cf0,JSON[_0xaafc('0x25')](_0x731bb4));_0x83ea82[_0xaafc('0x10')]();});})[_0xaafc('0x23')](function(_0x35a29f){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x978cf0,_0x35a29f['message']);_0x83ea82[_0xaafc('0x10')]();});}}catch(_0x3d4a5e){logger[_0xaafc('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x978cf0,JSON[_0xaafc('0x25')](_0x3d4a5e));_0x83ea82[_0xaafc('0x28')]();}};}; \ 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 7d62f20..b79455b 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 _0x3487=['bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','body','catch','error','[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','length','dialogflowV2','queryResult','diagnosticInfo','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','fields','end_conversation','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','lodash','dialogflow','md5'];(function(_0xa69733,_0x2aa122){var _0xca5645=function(_0x3a2729){while(--_0x3a2729){_0xa69733['push'](_0xa69733['shift']());}};_0xca5645(++_0x2aa122);}(_0x3487,0xd8));var _0x7348=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x3487[_0x57fa33];return _0x12e724;};'use strict';var _=require(_0x7348('0x0'));var dialogflow=require(_0x7348('0x1'));var md5=require(_0x7348('0x2'));var moment=require('moment');var Promise=require(_0x7348('0x3'));var logger=require(_0x7348('0x4'))('routing');var utils=require(_0x7348('0x5'));var rpc={'chatMessage':require(_0x7348('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7348('0x7')),'smsMessage':require(_0x7348('0x8')),'faxMessage':require(_0x7348('0x9')),'whatsappMessage':require(_0x7348('0xa'))};function createMessage(_0x591fbe,_0x323568,_0x488767,_0x4ddafb){return new Promise(function(_0x40e2d1,_0x21a0b6){var _0x5e6dd8=_[_0x7348('0xb')](_0x488767);_0x5e6dd8['body']=_0x4ddafb;return rpc[_0x323568+_0x7348('0xc')][_0x7348('0xd')](_0x5e6dd8)[_0x7348('0xe')](function(){logger[_0x7348('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x591fbe,_0x5e6dd8[_0x7348('0x10')]);_0x40e2d1();})[_0x7348('0x11')](function(_0x332de1){logger[_0x7348('0x12')](_0x7348('0x13'),_0x591fbe,JSON['stringify'](_0x332de1));_0x21a0b6(_0x332de1);});});}exports[_0x7348('0x14')]=function(_0x3099c3,_0x5f1268){return function(_0x383af6){try{if(!_[_0x7348('0x15')](this['interaction'][_0x7348('0x16')])){logger[_0x7348('0xf')](_0x7348('0x13'),_0x3099c3,_0x7348('0x17'));return _0x383af6[_0x7348('0x18')]();}var _0x571451={'ContactId':this[_0x7348('0x19')]['id'],'sentAt':moment()[_0x7348('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7348('0x1b')};if(this[_0x7348('0x1c')]===_0x7348('0x1d')||this['channel']===_0x7348('0x1e')){_0x571451[_0x7348('0x1f')]=this[_0x7348('0x20')][_0x7348('0x1f')];}var _0xd45a03=this[_0x7348('0x1c')];if(_0xd45a03===_0x7348('0x21')){_0x571451[_0x7348('0x22')]=this[_0x7348('0x23')]['id'];}else{_0x571451[_['upperFirst'](_0xd45a03)+_0x7348('0x24')]=this['account']['id'];}_0x571451[_[_0x7348('0x25')](_0xd45a03)+_0x7348('0x26')]=this['interaction']['id'];if(this[_0x7348('0x20')][_0x7348('0x27')]){var _0x404b6c=_0x5f1268[0x4];if(!_[_0x7348('0x28')](_0x404b6c)){_0x571451['body']=utils[_0x7348('0x29')](_0x404b6c,this);return rpc[_0xd45a03+_0x7348('0xc')]['create'](_0x571451)[_0x7348('0xe')](function(_0x460195){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x3099c3,_0x571451[_0x7348('0x10')]);})[_0x7348('0x11')](function(_0x12e6cf){logger[_0x7348('0x12')](_0x7348('0x13'),_0x3099c3,JSON[_0x7348('0x2a')](_0x12e6cf));})[_0x7348('0x2b')](function(){logger['info'](_0x7348('0x2c'),_0x3099c3);_0x383af6[_0x7348('0x2d')]();});}else{logger[_0x7348('0xf')](_0x7348('0x2e'),_0x3099c3);_0x383af6[_0x7348('0x2d')]();}}else{var _0x47867f=this;var _0x4e90ab=_0x5f1268[0x2][_0x7348('0x2f')](/\\n/g,'\x0a');var _0x133fa7={'credentials':{'private_key':_0x4e90ab,'client_email':_0x5f1268[0x1]}};var _0x553b51=new dialogflow[(_0x7348('0x30'))](_0x133fa7);var _0x36b65b=_0x553b51[_0x7348('0x31')](_0x5f1268[0x0],md5(_0x47867f[_0x7348('0x20')]['id']));var _0x33f614={'session':_0x36b65b,'queryInput':{'text':{'text':_0x47867f[_0x7348('0x32')][_0x7348('0x10')],'languageCode':_0x5f1268[0x3]||'en'}}};return _0x553b51['detectIntent'](_0x33f614)[_0x7348('0xe')](function(_0x896ee7){if(_0x896ee7&&_0x896ee7[_0x7348('0x33')]){_0x47867f[_0x7348('0x10')][_0x7348('0x34')]=_0x896ee7;var _0x3db360=_0x896ee7[0x0];var _0x46ce64=_0x3db360[_0x7348('0x35')]['diagnosticInfo']&&_0x3db360[_0x7348('0x35')][_0x7348('0x36')]['fields']?_0x3db360['queryResult'][_0x7348('0x36')]['fields']['end_conversation'][_0x7348('0x37')]:![];_0x47867f[_0x7348('0x10')][_0x7348('0x38')]=_0x3db360[_0x7348('0x35')]['action'];_0x47867f[_0x7348('0x10')][_0x7348('0x39')]=_0x3db360[_0x7348('0x35')]['allRequiredParamsPresent'];_0x47867f[_0x7348('0x10')][_0x7348('0x3a')]=_0x3db360[_0x7348('0x35')][_0x7348('0x36')]&&_0x3db360[_0x7348('0x35')][_0x7348('0x36')][_0x7348('0x3b')]?_0x3db360[_0x7348('0x35')][_0x7348('0x36')]['fields'][_0x7348('0x3c')][_0x7348('0x37')]:![];_0x47867f[_0x7348('0x10')]['DIALOGFLOWV2_INTENTNAME']=_0x3db360[_0x7348('0x35')][_0x7348('0x3d')][_0x7348('0x3e')];_0x47867f[_0x7348('0x10')][_0x7348('0x3f')]=_0x3db360[_0x7348('0x35')][_0x7348('0x3d')][_0x7348('0x40')];_0x47867f[_0x7348('0x10')][_0x7348('0x41')]=_0x3db360[_0x7348('0x35')][_0x7348('0x3d')]['isFallback'];_0x47867f[_0x7348('0x10')][_0x7348('0x42')]=_0x3db360[_0x7348('0x35')][_0x7348('0x43')];_0x47867f[_0x7348('0x10')]['DIALOGFLOWV2_QUERYTEXT']=_0x3db360[_0x7348('0x35')]['queryText'];_0x47867f[_0x7348('0x10')][_0x7348('0x44')]=_0x3db360[_0x7348('0x35')][_0x7348('0x45')];_0x571451['providerName']=_0x7348('0x34');_0x571451[_0x7348('0x46')]=JSON[_0x7348('0x2a')](_0x896ee7);var _0x168f3b=[];for(var _0x9f446a=0x0;_0x9f446a<_0x896ee7[_0x7348('0x33')];_0x9f446a++){var _0x212b36=_0x896ee7[_0x9f446a];if(_0x212b36&&_0x212b36[_0x7348('0x35')]&&_0x212b36[_0x7348('0x35')][_0x7348('0x47')]){_0x168f3b[_0x7348('0x48')](createMessage(_0x3099c3,_0xd45a03,_0x571451,_0x212b36[_0x7348('0x35')]['fulfillmentText']));}}return Promise['all'](_0x168f3b)[_0x7348('0xe')](function(){if(_0x46ce64){_0x383af6[_0x7348('0x18')]();}else{_0x383af6[_0x7348('0x2d')]();}})['catch'](function(_0x166ace){logger[_0x7348('0x12')](_0x7348('0x13'),_0x3099c3,JSON[_0x7348('0x2a')](_0x166ace));_0x383af6[_0x7348('0x18')]();});}})[_0x7348('0x11')](function(_0x15bfcb){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3099c3,_0x15bfcb['message']);_0x383af6[_0x7348('0x18')]();});}}catch(_0x11d209){logger[_0x7348('0x12')](_0x7348('0x13'),_0x3099c3,JSON[_0x7348('0x2a')](_0x11d209));_0x383af6[_0x7348('0x2d')]();}};}; \ No newline at end of file +var _0x5a04=['contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x58e3ce,_0x58b04e){var _0x95135b=function(_0x59c36a){while(--_0x59c36a){_0x58e3ce['push'](_0x58e3ce['shift']());}};_0x95135b(++_0x58b04e);}(_0x5a04,0xfb));var _0x45a0=function(_0x4eb2e9,_0x386f8b){_0x4eb2e9=_0x4eb2e9-0x0;var _0x4f6e07=_0x5a04[_0x4eb2e9];return _0x4f6e07;};'use strict';var _=require(_0x45a0('0x0'));var dialogflow=require(_0x45a0('0x1'));var md5=require(_0x45a0('0x2'));var moment=require(_0x45a0('0x3'));var Promise=require(_0x45a0('0x4'));var logger=require(_0x45a0('0x5'))(_0x45a0('0x6'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x45a0('0x7')),'mailMessage':require(_0x45a0('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x45a0('0x9')),'whatsappMessage':require(_0x45a0('0xa'))};function createMessage(_0x46c9c0,_0x2f5a0c,_0x3a7c10,_0x5efc48){return new Promise(function(_0x206d08,_0x2a3009){var _0x5753ed=_['clone'](_0x3a7c10);_0x5753ed[_0x45a0('0xb')]=_0x5efc48;return rpc[_0x2f5a0c+_0x45a0('0xc')][_0x45a0('0xd')](_0x5753ed)[_0x45a0('0xe')](function(){logger[_0x45a0('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x46c9c0,_0x5753ed[_0x45a0('0xb')]);_0x206d08();})[_0x45a0('0x10')](function(_0x110fa7){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x46c9c0,JSON[_0x45a0('0x13')](_0x110fa7));_0x2a3009(_0x110fa7);});});}exports['consequence']=function(_0x450cb7,_0x173ea6){return function(_0x53b0bd){try{if(!_[_0x45a0('0x14')](this[_0x45a0('0x15')][_0x45a0('0x16')])){logger[_0x45a0('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x450cb7,_0x45a0('0x17'));return _0x53b0bd[_0x45a0('0x18')]();}var _0x1e9329={'ContactId':this[_0x45a0('0x19')]['id'],'sentAt':moment()[_0x45a0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x45a0('0x1b')};if(this[_0x45a0('0x1c')]===_0x45a0('0x1d')||this[_0x45a0('0x1c')]===_0x45a0('0x1e')){_0x1e9329[_0x45a0('0x1f')]=this['interaction'][_0x45a0('0x1f')];}var _0xc022fd=this['channel'];if(_0xc022fd===_0x45a0('0x20')){_0x1e9329[_0x45a0('0x21')]=this[_0x45a0('0x22')]['id'];}else{_0x1e9329[_[_0x45a0('0x23')](_0xc022fd)+_0x45a0('0x24')]=this[_0x45a0('0x22')]['id'];}_0x1e9329[_['upperFirst'](_0xc022fd)+_0x45a0('0x25')]=this['interaction']['id'];if(this[_0x45a0('0x15')][_0x45a0('0x26')]){var _0x17f13a=_0x173ea6[0x4];if(!_[_0x45a0('0x27')](_0x17f13a)){_0x1e9329[_0x45a0('0xb')]=utils['getMustacheRender'](_0x17f13a,this);return rpc[_0xc022fd+_0x45a0('0xc')][_0x45a0('0xd')](_0x1e9329)['then'](function(_0x1ecf02){logger[_0x45a0('0xf')](_0x45a0('0x12'),_0x450cb7,_0x1e9329['body']);})[_0x45a0('0x10')](function(_0x5c76ee){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x450cb7,JSON[_0x45a0('0x13')](_0x5c76ee));})[_0x45a0('0x28')](function(){logger[_0x45a0('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x450cb7);_0x53b0bd[_0x45a0('0x29')]();});}else{logger[_0x45a0('0xf')](_0x45a0('0x2a'),_0x450cb7);_0x53b0bd['stop']();}}else{var _0xb65b5a=this;var _0x3e76f0=_0x173ea6[0x2][_0x45a0('0x2b')](/\\n/g,'\x0a');var _0x28c56d={'credentials':{'private_key':_0x3e76f0,'client_email':_0x173ea6[0x1]}};var _0x1e7460=new dialogflow[(_0x45a0('0x2c'))](_0x28c56d);var _0x569e3d=_0x1e7460[_0x45a0('0x2d')](_0x173ea6[0x0],md5(_0xb65b5a[_0x45a0('0x15')]['id']));var _0x48c33f={'session':_0x569e3d,'queryInput':{'text':{'text':_0xb65b5a[_0x45a0('0x2e')][_0x45a0('0xb')],'languageCode':_0x173ea6[0x3]||'en'}}};return _0x1e7460[_0x45a0('0x2f')](_0x48c33f)[_0x45a0('0xe')](function(_0x23a8ff){if(_0x23a8ff&&_0x23a8ff[_0x45a0('0x30')]){_0xb65b5a['body'][_0x45a0('0x31')]=_0x23a8ff;var _0x105226=_0x23a8ff[0x0];var _0x1d5de5=_0x105226[_0x45a0('0x32')][_0x45a0('0x33')]&&_0x105226[_0x45a0('0x32')][_0x45a0('0x33')][_0x45a0('0x34')]?_0x105226[_0x45a0('0x32')][_0x45a0('0x33')]['fields'][_0x45a0('0x35')][_0x45a0('0x36')]:![];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x37')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x38')];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x39')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x3a')];_0xb65b5a[_0x45a0('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x105226[_0x45a0('0x32')]['diagnosticInfo']&&_0x105226[_0x45a0('0x32')][_0x45a0('0x33')][_0x45a0('0x34')]?_0x105226[_0x45a0('0x32')][_0x45a0('0x33')][_0x45a0('0x34')][_0x45a0('0x35')]['boolValue']:![];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x3b')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x3c')]['name'];_0xb65b5a[_0x45a0('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x105226['queryResult'][_0x45a0('0x3c')][_0x45a0('0x3d')];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x3e')]=_0x105226[_0x45a0('0x32')]['intent'][_0x45a0('0x3f')];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x40')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x41')];_0xb65b5a['body'][_0x45a0('0x42')]=_0x105226[_0x45a0('0x32')]['queryText'];_0xb65b5a[_0x45a0('0xb')][_0x45a0('0x43')]=_0x105226[_0x45a0('0x32')][_0x45a0('0x44')];_0x1e9329['providerName']=_0x45a0('0x31');_0x1e9329['providerResponse']=JSON[_0x45a0('0x13')](_0x23a8ff);var _0x34fbfb=[];for(var _0x41612a=0x0;_0x41612a<_0x23a8ff['length'];_0x41612a++){var _0x530cbf=_0x23a8ff[_0x41612a];if(_0x530cbf&&_0x530cbf['queryResult']&&_0x530cbf['queryResult']['fulfillmentText']){_0x34fbfb['push'](createMessage(_0x450cb7,_0xc022fd,_0x1e9329,_0x530cbf[_0x45a0('0x32')]['fulfillmentText']));}}return Promise['all'](_0x34fbfb)[_0x45a0('0xe')](function(){if(_0x1d5de5){_0x53b0bd['next']();}else{_0x53b0bd[_0x45a0('0x29')]();}})[_0x45a0('0x10')](function(_0x2d9506){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x450cb7,JSON[_0x45a0('0x13')](_0x2d9506));_0x53b0bd[_0x45a0('0x18')]();});}})[_0x45a0('0x10')](function(_0x19e549){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x450cb7,_0x19e549[_0x45a0('0x2e')]);_0x53b0bd[_0x45a0('0x18')]();});}}catch(_0x5ae3d0){logger[_0x45a0('0x11')](_0x45a0('0x12'),_0x450cb7,JSON[_0x45a0('0x13')](_0x5ae3d0));_0x53b0bd[_0x45a0('0x29')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 838890f..e138a28 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 _0xeffd=['condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop'];(function(_0x54220c,_0x4251e0){var _0x3ae575=function(_0x2345d2){while(--_0x2345d2){_0x54220c['push'](_0x54220c['shift']());}};_0x3ae575(++_0x4251e0);}(_0xeffd,0x190));var _0xdeff=function(_0x2289fa,_0x59bbee){_0x2289fa=_0x2289fa-0x0;var _0x4cdf9f=_0xeffd[_0x2289fa];return _0x4cdf9f;};'use strict';var schema=require(_0xdeff('0x0'));var _=require(_0xdeff('0x1'));var htmlToText=require(_0xdeff('0x2'));var utils=require(_0xdeff('0x3'));var logger=require(_0xdeff('0x4'))('routing');var gotoif=schema({'condition':{'type':_0xdeff('0x5'),'required':!![],'message':_0xdeff('0x6')},'priorityTrue':{'type':_0xdeff('0x7'),'message':_0xdeff('0x8')},'priorityFalse':{'type':_0xdeff('0x7'),'message':_0xdeff('0x9')}});exports[_0xdeff('0xa')]=function(_0x1791bf,_0x2ef4da){return function(_0x39ee0f){try{var _0x22ca72={'condition':htmlToText[_0xdeff('0xb')](utils['getMustacheRender'](_0x2ef4da[0x0],this),{'wordwrap':![]})[_0xdeff('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2ef4da[0x1],'priorityFalse':_0x2ef4da[0x2]};var _0x560561=gotoif[_0xdeff('0x0')](_0x22ca72,{'typecast':!![]});if(_0x560561[_0xdeff('0xd')]){logger[_0xdeff('0xe')](_0xdeff('0xf'),_0x1791bf,_[_0xdeff('0x10')](_0x560561,_0xdeff('0x11'))[_0xdeff('0x12')](',\x20'));_0x39ee0f[_0xdeff('0x13')]();}else{try{var _0x42b986=eval('('+_0x22ca72[_0xdeff('0x14')]+')');var _0x13d1ce=_0x42b986?_0x22ca72['priorityTrue']:_0x22ca72[_0xdeff('0x15')];logger['info'](_0xdeff('0x16'),_0x1791bf,_0x22ca72[_0xdeff('0x14')],_0x42b986,_0x13d1ce||_0xdeff('0x17'));if(_0x13d1ce){var _0xa9ea49=_[_0xdeff('0x18')](_0x39ee0f['rules'](),{'p':_0x13d1ce});if(_0xa9ea49>=0x0){logger[_0xdeff('0x19')](_0xdeff('0x1a'),_0x1791bf,_0x13d1ce||_0xdeff('0x17'),_0xa9ea49);_0x39ee0f[_0xdeff('0x17')](_0xa9ea49);}else{logger['info'](_0xdeff('0x1b'),_0x1791bf,_0x13d1ce||_0xdeff('0x17'));_0x39ee0f[_0xdeff('0x13')]();}}else{_0x39ee0f[_0xdeff('0x17')]();}}catch(_0x4ad79a){logger[_0xdeff('0xe')](_0xdeff('0x1c'),_0x1791bf,_0x4ad79a[_0xdeff('0x11')]);_0x39ee0f[_0xdeff('0x13')]();}}}catch(_0x5970f5){logger[_0xdeff('0xe')](_0xdeff('0xf'),_0x1791bf,JSON[_0xdeff('0x1d')](_0x5970f5));_0x39ee0f[_0xdeff('0x13')]();}};}; \ No newline at end of file +var _0xfc22=['message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','stringify','lodash','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','replace','validate','length','error','[%s][GOTOIF]\x20%s'];(function(_0xeceed2,_0x1167ab){var _0x2ddb79=function(_0x4d5760){while(--_0x4d5760){_0xeceed2['push'](_0xeceed2['shift']());}};_0x2ddb79(++_0x1167ab);}(_0xfc22,0x1ce));var _0x2fc2=function(_0x48cd1c,_0x3d840){_0x48cd1c=_0x48cd1c-0x0;var _0x2b88b6=_0xfc22[_0x48cd1c];return _0x2b88b6;};'use strict';var schema=require('validate');var _=require(_0x2fc2('0x0'));var htmlToText=require('html-to-text');var utils=require(_0x2fc2('0x1'));var logger=require('../../../../config/logger')(_0x2fc2('0x2'));var gotoif=schema({'condition':{'type':_0x2fc2('0x3'),'required':!![],'message':_0x2fc2('0x4')},'priorityTrue':{'type':_0x2fc2('0x5'),'message':_0x2fc2('0x6')},'priorityFalse':{'type':'number','message':_0x2fc2('0x7')}});exports[_0x2fc2('0x8')]=function(_0x13bc30,_0x27f8a8){return function(_0x53643d){try{var _0x3518b0={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x27f8a8[0x0],this),{'wordwrap':![]})[_0x2fc2('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x27f8a8[0x1],'priorityFalse':_0x27f8a8[0x2]};var _0x545f06=gotoif[_0x2fc2('0xa')](_0x3518b0,{'typecast':!![]});if(_0x545f06[_0x2fc2('0xb')]){logger[_0x2fc2('0xc')](_0x2fc2('0xd'),_0x13bc30,_['map'](_0x545f06,_0x2fc2('0xe'))[_0x2fc2('0xf')](',\x20'));_0x53643d['stop']();}else{try{var _0x222628=eval('('+_0x3518b0[_0x2fc2('0x10')]+')');var _0x2f1b7c=_0x222628?_0x3518b0[_0x2fc2('0x11')]:_0x3518b0[_0x2fc2('0x12')];logger[_0x2fc2('0x13')](_0x2fc2('0x14'),_0x13bc30,_0x3518b0[_0x2fc2('0x10')],_0x222628,_0x2f1b7c||_0x2fc2('0x15'));if(_0x2f1b7c){var _0x41fe6a=_[_0x2fc2('0x16')](_0x53643d[_0x2fc2('0x17')](),{'p':_0x2f1b7c});if(_0x41fe6a>=0x0){logger[_0x2fc2('0x13')](_0x2fc2('0x18'),_0x13bc30,_0x2f1b7c||'next',_0x41fe6a);_0x53643d['next'](_0x41fe6a);}else{logger['info'](_0x2fc2('0x19'),_0x13bc30,_0x2f1b7c||_0x2fc2('0x15'));_0x53643d[_0x2fc2('0x1a')]();}}else{_0x53643d[_0x2fc2('0x15')]();}}catch(_0xb739c4){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x13bc30,_0xb739c4[_0x2fc2('0xe')]);_0x53643d[_0x2fc2('0x1a')]();}}}catch(_0x3edc12){logger[_0x2fc2('0xc')](_0x2fc2('0xd'),_0x13bc30,JSON[_0x2fc2('0x1b')](_0x3edc12));_0x53643d[_0x2fc2('0x1a')]();}};}; \ 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 7683ad0..8091403 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 _0xba44=['length','error','[%s][GOTOP]\x20%s','map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x51a445,_0x46e766){var _0x1a3b42=function(_0x3e8a9e){while(--_0x3e8a9e){_0x51a445['push'](_0x51a445['shift']());}};_0x1a3b42(++_0x46e766);}(_0xba44,0xb7));var _0x4ba4=function(_0x188997,_0x319c5b){_0x188997=_0x188997-0x0;var _0x3b6c49=_0xba44[_0x188997];return _0x3b6c49;};'use strict';var schema=require(_0x4ba4('0x0'));var _=require('lodash');var logger=require(_0x4ba4('0x1'))('routing');var gotop=schema({'priority':{'type':_0x4ba4('0x2'),'required':!![],'message':_0x4ba4('0x3')}});exports['consequence']=function(_0x170ef8,_0x339a89){return function(_0x40989c){try{var _0x488400={'priority':_0x339a89[0x0]};var _0x27eb05=gotop[_0x4ba4('0x0')](_0x488400,{'typecast':!![]});if(_0x27eb05[_0x4ba4('0x4')]){logger[_0x4ba4('0x5')](_0x4ba4('0x6'),_0x170ef8,_[_0x4ba4('0x7')](_0x27eb05,'message')['join'](',\x20'));_0x40989c[_0x4ba4('0x8')]();}else{logger[_0x4ba4('0x9')](_0x4ba4('0xa'),_0x170ef8,_0x488400['priority']);if(_0x488400[_0x4ba4('0xb')]){var _0x5ad74b=_[_0x4ba4('0xc')](_0x40989c[_0x4ba4('0xd')](),{'p':_0x488400['priority']});if(_0x5ad74b>=0x0){logger[_0x4ba4('0x9')](_0x4ba4('0xe'),_0x170ef8,_0x488400[_0x4ba4('0xb')]||'next',_0x5ad74b);_0x40989c[_0x4ba4('0xf')](_0x5ad74b);}else{logger[_0x4ba4('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x170ef8,_0x488400['priority']||'next');_0x40989c[_0x4ba4('0x8')]();}}else{_0x40989c[_0x4ba4('0xf')]();}}}catch(_0x3c9fe6){logger['error'](_0x4ba4('0x6'),_0x170ef8,JSON[_0x4ba4('0x10')](_0x3c9fe6));_0x40989c[_0x4ba4('0x8')]();}};}; \ No newline at end of file +var _0x7628=['[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info'];(function(_0xbf87ba,_0x5e4675){var _0x4d48f3=function(_0x53e61d){while(--_0x53e61d){_0xbf87ba['push'](_0xbf87ba['shift']());}};_0x4d48f3(++_0x5e4675);}(_0x7628,0x7e));var _0x8762=function(_0x5cbe77,_0x47d45d){_0x5cbe77=_0x5cbe77-0x0;var _0x546a1e=_0x7628[_0x5cbe77];return _0x546a1e;};'use strict';var schema=require(_0x8762('0x0'));var _=require(_0x8762('0x1'));var logger=require(_0x8762('0x2'))(_0x8762('0x3'));var gotop=schema({'priority':{'type':_0x8762('0x4'),'required':!![],'message':_0x8762('0x5')}});exports[_0x8762('0x6')]=function(_0xfe2ef5,_0x35b52f){return function(_0x1ac713){try{var _0x463a={'priority':_0x35b52f[0x0]};var _0x50fe61=gotop[_0x8762('0x0')](_0x463a,{'typecast':!![]});if(_0x50fe61[_0x8762('0x7')]){logger[_0x8762('0x8')](_0x8762('0x9'),_0xfe2ef5,_['map'](_0x50fe61,_0x8762('0xa'))[_0x8762('0xb')](',\x20'));_0x1ac713[_0x8762('0xc')]();}else{logger[_0x8762('0xd')](_0x8762('0xe'),_0xfe2ef5,_0x463a[_0x8762('0xf')]);if(_0x463a[_0x8762('0xf')]){var _0x5b7483=_['findIndex'](_0x1ac713[_0x8762('0x10')](),{'p':_0x463a[_0x8762('0xf')]});if(_0x5b7483>=0x0){logger[_0x8762('0xd')](_0x8762('0x11'),_0xfe2ef5,_0x463a[_0x8762('0xf')]||_0x8762('0x12'),_0x5b7483);_0x1ac713['next'](_0x5b7483);}else{logger[_0x8762('0xd')](_0x8762('0x13'),_0xfe2ef5,_0x463a[_0x8762('0xf')]||_0x8762('0x12'));_0x1ac713[_0x8762('0xc')]();}}else{_0x1ac713['next']();}}}catch(_0x24bd0e){logger[_0x8762('0x8')]('[%s][GOTOP]\x20%s',_0xfe2ef5,JSON['stringify'](_0x24bd0e));_0x1ac713['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 956af11..f3ee9dc 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 _0x12ae=['upperFirst','AccountId','account','InteractionId','interaction','Message','then','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat'];(function(_0x433ae0,_0x209a59){var _0x7b57dc=function(_0x10ad47){while(--_0x10ad47){_0x433ae0['push'](_0x433ae0['shift']());}};_0x7b57dc(++_0x209a59);}(_0x12ae,0x175));var _0xe12a=function(_0x24c007,_0x5ef526){_0x24c007=_0x24c007-0x0;var _0x229fa8=_0x12ae[_0x24c007];return _0x229fa8;};'use strict';var _=require('lodash');var utils=require(_0xe12a('0x0'));var logger=require(_0xe12a('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xe12a('0x2')),'smsMessage':require(_0xe12a('0x3')),'faxMessage':require(_0xe12a('0x4')),'whatsappMessage':require(_0xe12a('0x5'))};exports[_0xe12a('0x6')]=function(_0x5a2c91,_0x334f17){return function(_0xca8264){try{var _0x296caf={'body':utils[_0xe12a('0x7')](_0x334f17[0x0],this),'ContactId':this[_0xe12a('0x8')]['id']};if(this[_0xe12a('0x9')]===_0xe12a('0xa')){_0x296caf['ChatWebsiteId']=this['account']['id'];}else{_0x296caf[_[_0xe12a('0xb')](this[_0xe12a('0x9')])+_0xe12a('0xc')]=this[_0xe12a('0xd')]['id'];}_0x296caf[_[_0xe12a('0xb')](this[_0xe12a('0x9')])+_0xe12a('0xe')]=this[_0xe12a('0xf')]['id'];if(rpc[this[_0xe12a('0x9')]+'Message']){return rpc[this[_0xe12a('0x9')]+_0xe12a('0x10')]['create'](_0x296caf)[_0xe12a('0x11')](function(_0x2f0205){logger['info'](_0xe12a('0x12'),_0x5a2c91,_0x296caf[_0xe12a('0x13')]);_0xca8264['next']();})[_0xe12a('0x14')](function(_0x26ac01){logger[_0xe12a('0x15')](_0xe12a('0x12'),_0x5a2c91,JSON[_0xe12a('0x16')](_0x26ac01));_0xca8264['stop']();});}}catch(_0x47d3d1){logger['error'](_0xe12a('0x12'),_0x5a2c91,JSON['stringify'](_0x47d3d1));_0xca8264[_0xe12a('0x17')]();}};}; \ No newline at end of file +var _0xffda=['info','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then'];(function(_0x3a79e0,_0x42a8fa){var _0x4a6e80=function(_0x3b1baf){while(--_0x3b1baf){_0x3a79e0['push'](_0x3a79e0['shift']());}};_0x4a6e80(++_0x42a8fa);}(_0xffda,0x73));var _0xaffd=function(_0x54412c,_0x1f2ad6){_0x54412c=_0x54412c-0x0;var _0x3801df=_0xffda[_0x54412c];return _0x3801df;};'use strict';var _=require(_0xaffd('0x0'));var utils=require(_0xaffd('0x1'));var logger=require(_0xaffd('0x2'))(_0xaffd('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaffd('0x4')),'mailMessage':require(_0xaffd('0x5')),'smsMessage':require(_0xaffd('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xaffd('0x7'))};exports['consequence']=function(_0x2e2be7,_0x400bb8){return function(_0x5747e0){try{var _0x4ca99e={'body':utils[_0xaffd('0x8')](_0x400bb8[0x0],this),'ContactId':this[_0xaffd('0x9')]['id']};if(this[_0xaffd('0xa')]==='chat'){_0x4ca99e[_0xaffd('0xb')]=this[_0xaffd('0xc')]['id'];}else{_0x4ca99e[_['upperFirst'](this['channel'])+_0xaffd('0xd')]=this[_0xaffd('0xc')]['id'];}_0x4ca99e[_[_0xaffd('0xe')](this['channel'])+_0xaffd('0xf')]=this[_0xaffd('0x10')]['id'];if(rpc[this['channel']+_0xaffd('0x11')]){return rpc[this[_0xaffd('0xa')]+_0xaffd('0x11')][_0xaffd('0x12')](_0x4ca99e)[_0xaffd('0x13')](function(_0x5e5c2b){logger[_0xaffd('0x14')]('[%s][MESSAGE]\x20%s',_0x2e2be7,_0x4ca99e['body']);_0x5747e0[_0xaffd('0x15')]();})[_0xaffd('0x16')](function(_0x1be095){logger['error'](_0xaffd('0x17'),_0x2e2be7,JSON[_0xaffd('0x18')](_0x1be095));_0x5747e0[_0xaffd('0x19')]();});}}catch(_0x2de573){logger[_0xaffd('0x1a')](_0xaffd('0x17'),_0x2e2be7,JSON[_0xaffd('0x18')](_0x2de573));_0x5747e0[_0xaffd('0x19')]();}};}; \ 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 c4839e3..bd6eb7a 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 _0xc926=['./utils','../../../../config/logger','consequence','next','[%s][NOOP]\x20%s','stringify','stop'];(function(_0x31bcbe,_0x4ce65b){var _0x485320=function(_0x1cb6d7){while(--_0x1cb6d7){_0x31bcbe['push'](_0x31bcbe['shift']());}};_0x485320(++_0x4ce65b);}(_0xc926,0x196));var _0x6c92=function(_0x38fad1,_0x1117ab){_0x38fad1=_0x38fad1-0x0;var _0x2cb748=_0xc926[_0x38fad1];return _0x2cb748;};'use strict';var utils=require(_0x6c92('0x0'));var logger=require(_0x6c92('0x1'))('routing');exports[_0x6c92('0x2')]=function(_0x588862,_0x58d241){return function(_0x3e00c4){try{logger['info']('[%s][NOOP]\x20%s',_0x588862,utils['getMustacheRender'](_0x58d241[0x0],this));_0x3e00c4[_0x6c92('0x3')]();}catch(_0x387735){logger['error'](_0x6c92('0x4'),_0x588862,JSON[_0x6c92('0x5')](_0x387735));_0x3e00c4[_0x6c92('0x6')]();}};}; \ No newline at end of file +var _0xf667=['routing','[%s][NOOP]\x20%s','next','error','stringify','./utils','../../../../config/logger'];(function(_0x3e3e86,_0x12dc19){var _0x4bfbd6=function(_0x38a92f){while(--_0x38a92f){_0x3e3e86['push'](_0x3e3e86['shift']());}};_0x4bfbd6(++_0x12dc19);}(_0xf667,0x18d));var _0x7f66=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xf667[_0x485b5a];return _0xd2b34d;};'use strict';var utils=require(_0x7f66('0x0'));var logger=require(_0x7f66('0x1'))(_0x7f66('0x2'));exports['consequence']=function(_0x4d6f2a,_0x1c9772){return function(_0x4e9c6a){try{logger['info'](_0x7f66('0x3'),_0x4d6f2a,utils['getMustacheRender'](_0x1c9772[0x0],this));_0x4e9c6a[_0x7f66('0x4')]();}catch(_0x55dd4d){logger[_0x7f66('0x5')](_0x7f66('0x3'),_0x4d6f2a,JSON[_0x7f66('0x6')](_0x55dd4d));_0x4e9c6a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 43ee197..9f6a5ea 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 _0x4691=['localhost','queue_id','queue','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis'];(function(_0x29308d,_0x54913b){var _0x482179=function(_0x430317){while(--_0x430317){_0x29308d['push'](_0x29308d['shift']());}};_0x482179(++_0x54913b);}(_0x4691,0xe8));var _0x1469=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x4691[_0x36c5b0];return _0xf19333;};'use strict';var schema=require(_0x1469('0x0'));var _=require(_0x1469('0x1'));var util=require(_0x1469('0x2'));var seqqueue=require(_0x1469('0x3'));var moment=require(_0x1469('0x4'));var Redis=require(_0x1469('0x5'));var config=require(_0x1469('0x6'));var logger=require(_0x1469('0x7'))(_0x1469('0x8'));var strategy=require(_0x1469('0x9'));config['redis']=_['defaults'](config[_0x1469('0xa')],{'host':_0x1469('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x1469('0xc'),'account',_0x1469('0xd'),'from',_0x1469('0xe')];function emit(_0x4e51dc,_0x4badaf,_0xff6a10){io['to'](_0x4e51dc)[_0x1469('0xf')](_0x4badaf,_0xff6a10);}function emitChannelQueueInteraction(_0x36bbc7,_0x347429,_0x3d9845,_0x5a33e2,_0x251601,_0x3e4a66,_0x1aac11,_0xf7823a){var _0x41505e=_[_0x1469('0x10')](_0x3d9845);_0x41505e[_0x1469('0xc')]=_0xf7823a;_0x41505e['queue']=_0x347429;_0x41505e[_0x1469('0x11')]=_0x5a33e2;_0x41505e['id']=_0x251601;if(_0x3e4a66){_0x1aac11[util[_0x1469('0x12')](_0x1469('0x13'),_0x36bbc7)][_0x251601]=_[_0x1469('0x14')](_0x41505e,attributes);}else{delete _0x1aac11[util['format'](_0x1469('0x13'),_0x36bbc7)][_0x251601];}emit(util[_0x1469('0x12')](_0x1469('0x15'),_0x36bbc7,_0x347429),util['format'](_0x1469('0x16'),_0x36bbc7,_0x3e4a66?'save':'remove'),_['pick'](_0x41505e,attributes));}var rpc={'openchannelQueueReport':require(_0x1469('0x17')),'mailQueueReport':require(_0x1469('0x18')),'chatQueueReport':require(_0x1469('0x19')),'smsQueueReport':require(_0x1469('0x1a')),'faxQueueReport':require(_0x1469('0x1b')),'whatsappQueueReport':require(_0x1469('0x1c'))};var queue=schema({'name':{'type':_0x1469('0x1d'),'required':!![],'message':_0x1469('0x1e')},'timeout':{'type':_0x1469('0x1f'),'message':_0x1469('0x20')}});function startRouting(_0x35c9f9,_0x5a93a1,_0xe58208,_0x24fb9f){if(_0x35c9f9&&_0x5a93a1&&_0xe58208){_0x5a93a1[_0x1469('0x21')]+=0x1;var _0xea30f0={'uniqueid':_0x35c9f9,'from':_0xe58208[_0x1469('0x22')]?_0xe58208[_0x1469('0x22')][_0x1469('0x23')]:'','joinAt':moment()[_0x1469('0x12')](_0x1469('0x24')),'ContactId':_0xe58208[_0x1469('0x25')]?_0xe58208['contact']['id']:null,'ListId':_0xe58208[_0x1469('0x26')]?_0xe58208['list']['id']:null};_0xea30f0[_[_0x1469('0x27')](_0xe58208[_0x1469('0x28')])+_0x1469('0x29')]=_0x5a93a1['id']||null;_0xea30f0[_['upperFirst'](_0xe58208['channel'])+'InteractionId']=_0xe58208[_0x1469('0x2a')]?_0xe58208['interaction']['id']:null;_0xea30f0[_[_0x1469('0x27')](_0xe58208[_0x1469('0x28')])+'MessageId']=_0xe58208[_0x1469('0x2b')]?_0xe58208[_0x1469('0x2b')]['id']:null;_0xea30f0[_[_0x1469('0x27')](_0xe58208['channel'])+(_0xe58208['channel']!=='chat'?_0x1469('0x2c'):_0x1469('0x2d'))]=_0xe58208['account']?_0xe58208[_0x1469('0x11')]['id']:null;logger['info'](util[_0x1469('0x12')](_0x1469('0x2e'),_0x35c9f9,_0x5a93a1[_0x1469('0x2f')]));emitChannelQueueInteraction(_0xe58208['channel'],_0x5a93a1[_0x1469('0x2f')],_0xea30f0,_0xe58208[_0x1469('0x11')]['name'],_0xe58208[_0x1469('0x2b')]['id'],!![],_0x24fb9f,_0x5a93a1['id']);if(rpc[_0xe58208[_0x1469('0x28')]+_0x1469('0x30')]){return rpc[_0xe58208[_0x1469('0x28')]+'QueueReport']['create'](_0xea30f0)[_0x1469('0x31')](function(_0x5ba226){logger[_0x1469('0x32')]('create\x20queue\x20report');});}}}function stopRouting(_0x55eaee,_0x251ffe,_0x4343a0,_0x242c5b){if(_0x55eaee&&_0x251ffe){_0x251ffe[_0x1469('0x21')]-=0x1;var _0x3b3d7a={'leaveAt':moment()[_0x1469('0x12')](_0x1469('0x24')),'acceptAt':moment()['format'](_0x1469('0x24')),'reason':_0x1469('0x33')};logger[_0x1469('0x34')](util[_0x1469('0x12')](_0x1469('0x35'),_0x55eaee,_0x251ffe[_0x1469('0x2f')]));emitChannelQueueInteraction(_0x4343a0[_0x1469('0x28')],_0x251ffe['name'],_0x4343a0[_0x1469('0x22')],_0x4343a0['account'][_0x1469('0x2f')],_0x4343a0[_0x1469('0x2b')]['id'],![],_0x242c5b,_0x251ffe['id']);if(rpc[_0x4343a0[_0x1469('0x28')]+_0x1469('0x30')]){return rpc[_0x4343a0[_0x1469('0x28')]+_0x1469('0x30')][_0x1469('0x36')](_0x55eaee,_0x3b3d7a)[_0x1469('0x31')](function(_0x48b22f){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x32edd3,_0x498439,_0x11277c,_0x2455b1){if(_0x32edd3&&_0x498439){_0x498439[_0x1469('0x21')]-=0x1;var _0x228227={'leaveAt':moment()[_0x1469('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x1469('0x12')](_0x1469('0x24')),'reason':'timeout'};logger[_0x1469('0x34')](util[_0x1469('0x12')](_0x1469('0x37'),_0x32edd3,_0x498439[_0x1469('0x2f')]));emitChannelQueueInteraction(_0x11277c[_0x1469('0x28')],_0x498439[_0x1469('0x2f')],_0x11277c[_0x1469('0x22')],_0x11277c[_0x1469('0x11')][_0x1469('0x2f')],_0x11277c['message']['id'],![],_0x2455b1);if(rpc[_0x11277c[_0x1469('0x28')]+_0x1469('0x30')]){return rpc[_0x11277c[_0x1469('0x28')]+_0x1469('0x30')]['update'](_0x32edd3,_0x228227)[_0x1469('0x31')](function(_0x413e18){logger[_0x1469('0x32')](_0x1469('0x38'));});}}}function handleFindQueue(_0x4648e7){return function(_0x2c54f3){return _0x2c54f3[_0x1469('0x2f')]['toLowerCase']()===_0x4648e7['toLowerCase']();};}exports[_0x1469('0x39')]=function(_0x3718f4,_0x1b1a23,_0x1d476d,_0x2c395){return function(_0x1b4cf1){try{var _0x5e9f2c={'name':_0x1b1a23[0x0],'timeout':_0x1b1a23[0x1]};var _0x3c9fb1=queue[_0x1469('0x0')](_0x5e9f2c,{'typecast':!![]});if(_0x3c9fb1[_0x1469('0x3a')]){logger[_0x1469('0x32')](_0x1469('0x3b'),_0x3718f4,_[_0x1469('0x3c')](_0x3c9fb1,_0x1469('0x2b'))[_0x1469('0x3d')](',\x20'));_0x1b4cf1[_0x1469('0x3e')]();}else{var _0x2cdab1=_[_0x1469('0x3f')](_0x1d476d[_0x2c395[_0x1469('0x28')]+_0x1469('0x40')],handleFindQueue(_0x5e9f2c[_0x1469('0x2f')]));if(_0x2cdab1){startRouting(_0x3718f4,_0x2cdab1,_0x2c395,_0x1d476d);var _0x494967=(_0x2cdab1[_0x1469('0x41')]||0xa)*0x3e8;var _0x40a34d=(_0x5e9f2c[_0x1469('0x41')]||0x14)*0x3e8;var _0x577465,_0x4464d3;if(_0x494967>_0x40a34d){_0x40a34d=_0x494967;}var _0x396c39=seqqueue[_0x1469('0x42')](_0x494967);_0x396c39['id']=_0x3718f4;_0x396c39[_0x1469('0x43')]=_0x494967;_0x396c39[_0x1469('0x44')]=_0x40a34d;_0x396c39[_0x1469('0x28')]=_0x2c395[_0x1469('0x28')];_0x1d476d[_0x1469('0x45')][_0x3718f4]['on'](_0x1469('0x46'),function(){logger[_0x1469('0x34')](_0x1469('0x47'),_0x3718f4);stopRouting(_0x3718f4,_0x2cdab1,_0x2c395,_0x1d476d);clearTimeout(_0x577465);_0x577465=undefined;_0x396c39[_0x1469('0x48')](!![]);if(_0x1d476d[_0x1469('0x45')][_0x3718f4]){delete _0x1d476d[_0x1469('0x45')][_0x3718f4];}_0x1b4cf1[_0x1469('0x3e')]();});_0x1d476d['rules'][_0x3718f4]['on'](_0x1469('0x49'),function(){if(_0x1d476d[_0x1469('0x45')][_0x3718f4]){delete _0x1d476d[_0x1469('0x45')][_0x3718f4];}});_0x577465=setTimeout(function(){logger[_0x1469('0x34')](_0x1469('0x4a'),_0x3718f4);endRouting(_0x3718f4,_0x2cdab1,_0x2c395,_0x1d476d);clearTimeout(_0x577465);_0x396c39[_0x1469('0x48')](!![]);_0x1b4cf1[_0x1469('0x4b')]();},_0x40a34d);switch(_0x2cdab1['strategy']){case _0x1469('0x4c'):strategy[_0x1469('0x4c')](_0x396c39,_0x2cdab1,_0x1d476d,_0x2c395);break;default:strategy[_0x1469('0x4d')](_0x396c39,_0x2cdab1,_0x1d476d,_0x2c395);}}else{logger[_0x1469('0x32')](_0x1469('0x4e'),_0x3718f4,_0x5e9f2c[_0x1469('0x2f')]);_0x1b4cf1[_0x1469('0x3e')]();}}}catch(_0x5d8cd7){console[_0x1469('0x4f')](_0x5d8cd7);logger[_0x1469('0x32')](_0x1469('0x3b'),_0x3718f4,_0x5d8cd7[_0x1469('0x50')]);_0x1b4cf1[_0x1469('0x3e')]();}};}; \ No newline at end of file +var _0x1ce2=['./strategy','redis','defaults','socket.io-emitter','queue_id','account','from','joinAt','clone','queue','format','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','createQueue','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing'];(function(_0x34dde2,_0x526007){var _0x14eb46=function(_0x4e5ce3){while(--_0x4e5ce3){_0x34dde2['push'](_0x34dde2['shift']());}};_0x14eb46(++_0x526007);}(_0x1ce2,0x8d));var _0x21ce=function(_0x12d51c,_0x28312b){_0x12d51c=_0x12d51c-0x0;var _0x22542b=_0x1ce2[_0x12d51c];return _0x22542b;};'use strict';var schema=require(_0x21ce('0x0'));var _=require(_0x21ce('0x1'));var util=require(_0x21ce('0x2'));var seqqueue=require(_0x21ce('0x3'));var moment=require(_0x21ce('0x4'));var Redis=require(_0x21ce('0x5'));var config=require(_0x21ce('0x6'));var logger=require(_0x21ce('0x7'))(_0x21ce('0x8'));var strategy=require(_0x21ce('0x9'));config[_0x21ce('0xa')]=_[_0x21ce('0xb')](config[_0x21ce('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x21ce('0xc'))(new Redis(config['redis']));var attributes=['id',_0x21ce('0xd'),_0x21ce('0xe'),'queue',_0x21ce('0xf'),_0x21ce('0x10')];function emit(_0x51384e,_0x2a49fa,_0xdd4ad1){io['to'](_0x51384e)['emit'](_0x2a49fa,_0xdd4ad1);}function emitChannelQueueInteraction(_0xe343c9,_0x547b79,_0x22327c,_0x56c02e,_0x451976,_0x341d3c,_0xfcdbc0,_0x1ab983){var _0x597ff7=_[_0x21ce('0x11')](_0x22327c);_0x597ff7['queue_id']=_0x1ab983;_0x597ff7[_0x21ce('0x12')]=_0x547b79;_0x597ff7['account']=_0x56c02e;_0x597ff7['id']=_0x451976;if(_0x341d3c){_0xfcdbc0[util[_0x21ce('0x13')]('%sQueuesWaitingInteractions',_0xe343c9)][_0x451976]=_[_0x21ce('0x14')](_0x597ff7,attributes);}else{delete _0xfcdbc0[util[_0x21ce('0x13')]('%sQueuesWaitingInteractions',_0xe343c9)][_0x451976];}emit(util[_0x21ce('0x13')](_0x21ce('0x15'),_0xe343c9,_0x547b79),util[_0x21ce('0x13')](_0x21ce('0x16'),_0xe343c9,_0x341d3c?_0x21ce('0x17'):_0x21ce('0x18')),_['pick'](_0x597ff7,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x21ce('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x21ce('0x1a')),'faxQueueReport':require(_0x21ce('0x1b')),'whatsappQueueReport':require(_0x21ce('0x1c'))};var queue=schema({'name':{'type':_0x21ce('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x21ce('0x1e')}});function startRouting(_0x53900b,_0x3f8ef8,_0x320c9a,_0x4d98de){if(_0x53900b&&_0x3f8ef8&&_0x320c9a){_0x3f8ef8[_0x21ce('0x1f')]+=0x1;var _0x2ee141={'uniqueid':_0x53900b,'from':_0x320c9a[_0x21ce('0x20')]?_0x320c9a[_0x21ce('0x20')]['from']:'','joinAt':moment()[_0x21ce('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x320c9a['contact']?_0x320c9a[_0x21ce('0x21')]['id']:null,'ListId':_0x320c9a['list']?_0x320c9a[_0x21ce('0x22')]['id']:null};_0x2ee141[_[_0x21ce('0x23')](_0x320c9a[_0x21ce('0x24')])+'QueueId']=_0x3f8ef8['id']||null;_0x2ee141[_[_0x21ce('0x23')](_0x320c9a[_0x21ce('0x24')])+_0x21ce('0x25')]=_0x320c9a[_0x21ce('0x26')]?_0x320c9a[_0x21ce('0x26')]['id']:null;_0x2ee141[_['upperFirst'](_0x320c9a[_0x21ce('0x24')])+_0x21ce('0x27')]=_0x320c9a[_0x21ce('0x28')]?_0x320c9a['message']['id']:null;_0x2ee141[_[_0x21ce('0x23')](_0x320c9a[_0x21ce('0x24')])+(_0x320c9a['channel']!==_0x21ce('0x29')?_0x21ce('0x2a'):'WebsiteId')]=_0x320c9a[_0x21ce('0xe')]?_0x320c9a[_0x21ce('0xe')]['id']:null;logger['info'](util[_0x21ce('0x13')](_0x21ce('0x2b'),_0x53900b,_0x3f8ef8[_0x21ce('0x2c')]));emitChannelQueueInteraction(_0x320c9a[_0x21ce('0x24')],_0x3f8ef8['name'],_0x2ee141,_0x320c9a['account'][_0x21ce('0x2c')],_0x320c9a[_0x21ce('0x28')]['id'],!![],_0x4d98de,_0x3f8ef8['id']);if(rpc[_0x320c9a['channel']+_0x21ce('0x2d')]){return rpc[_0x320c9a[_0x21ce('0x24')]+_0x21ce('0x2d')]['create'](_0x2ee141)[_0x21ce('0x2e')](function(_0x1cf4c6){logger[_0x21ce('0x2f')](_0x21ce('0x30'));});}}}function stopRouting(_0x50d8ad,_0xd88688,_0x2f598a,_0x3c39ab){if(_0x50d8ad&&_0xd88688){_0xd88688['waiting']-=0x1;var _0x4fce08={'leaveAt':moment()[_0x21ce('0x13')](_0x21ce('0x31')),'acceptAt':moment()[_0x21ce('0x13')](_0x21ce('0x31')),'reason':_0x21ce('0x32')};logger[_0x21ce('0x33')](util['format'](_0x21ce('0x34'),_0x50d8ad,_0xd88688[_0x21ce('0x2c')]));emitChannelQueueInteraction(_0x2f598a[_0x21ce('0x24')],_0xd88688['name'],_0x2f598a[_0x21ce('0x20')],_0x2f598a['account']['name'],_0x2f598a['message']['id'],![],_0x3c39ab,_0xd88688['id']);if(rpc[_0x2f598a[_0x21ce('0x24')]+_0x21ce('0x2d')]){return rpc[_0x2f598a[_0x21ce('0x24')]+_0x21ce('0x2d')][_0x21ce('0x35')](_0x50d8ad,_0x4fce08)[_0x21ce('0x2e')](function(_0x4d97a8){logger['error'](_0x21ce('0x36'));});}}}function endRouting(_0x57750f,_0x3e73d9,_0x37a915,_0xcd27b8){if(_0x57750f&&_0x3e73d9){_0x3e73d9[_0x21ce('0x1f')]-=0x1;var _0x3e4747={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x21ce('0x31')),'reason':'timeout'};logger['info'](util[_0x21ce('0x13')](_0x21ce('0x37'),_0x57750f,_0x3e73d9['name']));emitChannelQueueInteraction(_0x37a915[_0x21ce('0x24')],_0x3e73d9[_0x21ce('0x2c')],_0x37a915[_0x21ce('0x20')],_0x37a915[_0x21ce('0xe')][_0x21ce('0x2c')],_0x37a915[_0x21ce('0x28')]['id'],![],_0xcd27b8);if(rpc[_0x37a915[_0x21ce('0x24')]+_0x21ce('0x2d')]){return rpc[_0x37a915[_0x21ce('0x24')]+_0x21ce('0x2d')][_0x21ce('0x35')](_0x57750f,_0x3e4747)[_0x21ce('0x2e')](function(_0x20d085){logger[_0x21ce('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x524956){return function(_0x2d5920){return _0x2d5920['name'][_0x21ce('0x38')]()===_0x524956[_0x21ce('0x38')]();};}exports[_0x21ce('0x39')]=function(_0x5442ca,_0x123e91,_0x53c512,_0x507816){return function(_0x5e35ba){try{var _0x5a2190={'name':_0x123e91[0x0],'timeout':_0x123e91[0x1]};var _0x496466=queue['validate'](_0x5a2190,{'typecast':!![]});if(_0x496466[_0x21ce('0x3a')]){logger['error'](_0x21ce('0x3b'),_0x5442ca,_['map'](_0x496466,'message')[_0x21ce('0x3c')](',\x20'));_0x5e35ba[_0x21ce('0x3d')]();}else{var _0x553abb=_[_0x21ce('0x3e')](_0x53c512[_0x507816['channel']+_0x21ce('0x3f')],handleFindQueue(_0x5a2190[_0x21ce('0x2c')]));if(_0x553abb){startRouting(_0x5442ca,_0x553abb,_0x507816,_0x53c512);var _0x464659=(_0x553abb[_0x21ce('0x40')]||0xa)*0x3e8;var _0x572a4b=(_0x5a2190['timeout']||0x14)*0x3e8;var _0x3bfaa7,_0x4e1a5e;if(_0x464659>_0x572a4b){_0x572a4b=_0x464659;}var _0x504b10=seqqueue[_0x21ce('0x41')](_0x464659);_0x504b10['id']=_0x5442ca;_0x504b10['atimeout']=_0x464659;_0x504b10['qtimeout']=_0x572a4b;_0x504b10[_0x21ce('0x24')]=_0x507816[_0x21ce('0x24')];_0x53c512[_0x21ce('0x42')][_0x5442ca]['on']('end',function(){logger['info'](_0x21ce('0x43'),_0x5442ca);stopRouting(_0x5442ca,_0x553abb,_0x507816,_0x53c512);clearTimeout(_0x3bfaa7);_0x3bfaa7=undefined;_0x504b10['close'](!![]);if(_0x53c512[_0x21ce('0x42')][_0x5442ca]){delete _0x53c512[_0x21ce('0x42')][_0x5442ca];}_0x5e35ba[_0x21ce('0x3d')]();});_0x53c512[_0x21ce('0x42')][_0x5442ca]['on']('complete',function(){if(_0x53c512[_0x21ce('0x42')][_0x5442ca]){delete _0x53c512[_0x21ce('0x42')][_0x5442ca];}});_0x3bfaa7=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x5442ca);endRouting(_0x5442ca,_0x553abb,_0x507816,_0x53c512);clearTimeout(_0x3bfaa7);_0x504b10[_0x21ce('0x44')](!![]);_0x5e35ba[_0x21ce('0x45')]();},_0x572a4b);switch(_0x553abb[_0x21ce('0x46')]){case _0x21ce('0x47'):strategy['rrmemory'](_0x504b10,_0x553abb,_0x53c512,_0x507816);break;default:strategy[_0x21ce('0x48')](_0x504b10,_0x553abb,_0x53c512,_0x507816);}}else{logger[_0x21ce('0x2f')](_0x21ce('0x49'),_0x5442ca,_0x5a2190[_0x21ce('0x2c')]);_0x5e35ba['stop']();}}}catch(_0x21c9c7){console[_0x21ce('0x4a')](_0x21c9c7);logger[_0x21ce('0x2f')](_0x21ce('0x3b'),_0x5442ca,_0x21c9c7['stack']);_0x5e35ba[_0x21ce('0x3d')]();}};}; \ 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 b1b2e5d..f85427c 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 _0x87b0=['bind','handleTimeout','timeout','handleDrained','handleRun','prototype','info','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','channel','agents','busy','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x87b0,0xf8));var _0x087b=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0x87b0[_0x4e170e];return _0x338291;};'use strict';var _=require('lodash');var uuid=require(_0x087b('0x0'));var util=require(_0x087b('0x1'));var logger=require(_0x087b('0x2'))(_0x087b('0x3'));var Agent=function(_0x1ac06c,_0x53daed,_0x49d407,_0xac681e){this[_0x087b('0x4')]=uuid['v4']();this[_0x087b('0x5')]=_0x1ac06c;this[_0x087b('0x6')]=_0x53daed;this['realtime']=_0x49d407;this['routing']=_0xac681e;this['squeue'][_0x087b('0x7')](this['handleRun'][_0x087b('0x8')](this),this[_0x087b('0x9')]['bind'](this));this[_0x087b('0x5')]['on'](_0x087b('0xa'),this[_0x087b('0x9')][_0x087b('0x8')](this));this[_0x087b('0x5')]['on']('drained',this[_0x087b('0xb')][_0x087b('0x8')](this));};Agent['prototype'][_0x087b('0x7')]=function(){this[_0x087b('0x5')]['push'](this[_0x087b('0xc')][_0x087b('0x8')](this),this[_0x087b('0x9')][_0x087b('0x8')](this));};Agent[_0x087b('0xd')][_0x087b('0xb')]=function(){this[_0x087b('0x9')](!![]);};Agent[_0x087b('0xd')][_0x087b('0xc')]=function(_0x408034){logger[_0x087b('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x087b('0x5')]['id'],this['agent']['id']);if(_[_0x087b('0xf')](this['realtime']['agents'][this[_0x087b('0x6')]['id']])){logger[_0x087b('0xe')](_0x087b('0x10'),this[_0x087b('0x5')]['id'],this[_0x087b('0x6')]['id']);setTimeout(this[_0x087b('0x7')][_0x087b('0x8')](this),0x3e8);}else{if(this['routing'][_0x087b('0x11')]||util[_0x087b('0x12')](this[_0x087b('0x5')]['id'],this[_0x087b('0x13')]['agents'][this[_0x087b('0x6')]['id']],this[_0x087b('0x5')][_0x087b('0x14')],![])){this[_0x087b('0x13')][_0x087b('0x15')][this['agent']['id']][_0x087b('0x16')]=!![];this[_0x087b('0x13')][_0x087b('0x15')][this[_0x087b('0x6')]['id']]['busyQueue']=undefined;util[_0x087b('0x17')](this[_0x087b('0x4')],this[_0x087b('0x5')]['id'],this[_0x087b('0x13')][_0x087b('0x15')][this[_0x087b('0x6')]['id']],null,this[_0x087b('0x3')]);util[_0x087b('0x18')](this[_0x087b('0x5')]['id'],this[_0x087b('0x13')][_0x087b('0x15')][this[_0x087b('0x6')]['id']],_0x087b('0x19')+(this[_0x087b('0x3')][_0x087b('0x11')]?':FORCED':''));}else{logger[_0x087b('0xe')](_0x087b('0x1a'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x087b('0x7')][_0x087b('0x8')](this),0x3e8);}}};Agent[_0x087b('0xd')][_0x087b('0x9')]=function(_0x4ba0b9){if(_[_0x087b('0xf')](this['realtime'][_0x087b('0x15')][this[_0x087b('0x6')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x087b('0x5')]['id'],this[_0x087b('0x6')]['id']);}else{logger[_0x087b('0xe')](_0x087b('0x1b'),this[_0x087b('0x5')]['id'],this[_0x087b('0x6')]['id']);util[_0x087b('0x1c')](this[_0x087b('0x4')],this[_0x087b('0x5')]['id'],this[_0x087b('0x13')]['agents'][this[_0x087b('0x6')]['id']],null,this[_0x087b('0x3')]);this['realtime'][_0x087b('0x15')][this[_0x087b('0x6')]['id']][_0x087b('0x16')]=![];this[_0x087b('0x13')]['agents'][this[_0x087b('0x6')]['id']][_0x087b('0x1d')]=undefined;util[_0x087b('0x18')](this[_0x087b('0x5')]['id'],this[_0x087b('0x13')][_0x087b('0x15')][this['agent']['id']],_0x4ba0b9?'STOP':_0x087b('0x1e'));}if(!_0x4ba0b9){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x5ea27f,_0x2f9ea4,_0x439b30,_0x1001de){return new Agent(_0x5ea27f,_0x2f9ea4,_0x439b30,_0x1001de);}module[_0x087b('0x1f')]=agent; \ No newline at end of file +var _0x65be=['busy','busyQueue','writeLog','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','agent','squeue','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','realtime','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x65be,0xfc));var _0xe65b=function(_0x21a0a8,_0x507228){_0x21a0a8=_0x21a0a8-0x0;var _0x42bd3b=_0x65be[_0x21a0a8];return _0x42bd3b;};'use strict';var _=require(_0xe65b('0x0'));var uuid=require(_0xe65b('0x1'));var util=require(_0xe65b('0x2'));var logger=require(_0xe65b('0x3'))(_0xe65b('0x4'));var Agent=function(_0xbe9c56,_0x346146,_0x39ac89,_0x1cf96d){this[_0xe65b('0x5')]=uuid['v4']();this['squeue']=_0xbe9c56;this[_0xe65b('0x6')]=_0x346146;this['realtime']=_0x39ac89;this[_0xe65b('0x4')]=_0x1cf96d;this[_0xe65b('0x7')][_0xe65b('0x8')](this['handleRun'][_0xe65b('0x9')](this),this[_0xe65b('0xa')]['bind'](this));this[_0xe65b('0x7')]['on']('timeout',this[_0xe65b('0xa')]['bind'](this));this['squeue']['on'](_0xe65b('0xb'),this[_0xe65b('0xc')][_0xe65b('0x9')](this));};Agent[_0xe65b('0xd')]['push']=function(){this[_0xe65b('0x7')][_0xe65b('0x8')](this['handleRun'][_0xe65b('0x9')](this),this[_0xe65b('0xa')][_0xe65b('0x9')](this));};Agent['prototype'][_0xe65b('0xc')]=function(){this[_0xe65b('0xa')](!![]);};Agent[_0xe65b('0xd')][_0xe65b('0xe')]=function(_0x5466f8){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0xe65b('0x7')]['id'],this['agent']['id']);if(_[_0xe65b('0xf')](this['realtime'][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']])){logger[_0xe65b('0x11')](_0xe65b('0x12'),this[_0xe65b('0x7')]['id'],this['agent']['id']);setTimeout(this[_0xe65b('0x8')][_0xe65b('0x9')](this),0x3e8);}else{if(this[_0xe65b('0x4')][_0xe65b('0x13')]||util['isAgentAvailable'](this[_0xe65b('0x7')]['id'],this['realtime'][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],this[_0xe65b('0x7')][_0xe65b('0x14')],![])){this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']]['busy']=!![];this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']]['busyQueue']=undefined;util[_0xe65b('0x16')](this[_0xe65b('0x5')],this[_0xe65b('0x7')]['id'],this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this['realtime'][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],_0xe65b('0x17')+(this['routing'][_0xe65b('0x13')]?':FORCED':''));}else{logger[_0xe65b('0x11')](_0xe65b('0x18'),this[_0xe65b('0x7')]['id'],this[_0xe65b('0x6')]['id']);setTimeout(this[_0xe65b('0x8')][_0xe65b('0x9')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x446152){if(_[_0xe65b('0xf')](this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']])){return logger[_0xe65b('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xe65b('0x7')]['id'],this['agent']['id']);}else{logger[_0xe65b('0x11')](_0xe65b('0x19'),this['squeue']['id'],this[_0xe65b('0x6')]['id']);util[_0xe65b('0x1a')](this['notificationId'],this[_0xe65b('0x7')]['id'],this['realtime'][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],null,this[_0xe65b('0x4')]);this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']][_0xe65b('0x1b')]=![];this[_0xe65b('0x15')][_0xe65b('0x10')][this['agent']['id']][_0xe65b('0x1c')]=undefined;util[_0xe65b('0x1d')](this['squeue']['id'],this[_0xe65b('0x15')][_0xe65b('0x10')][this[_0xe65b('0x6')]['id']],_0x446152?'STOP':'TIMEOUT');}if(!_0x446152){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x47a800,_0x67d87e,_0x38bd6b,_0x33508c){return new Agent(_0x47a800,_0x67d87e,_0x38bd6b,_0x33508c);}module[_0xe65b('0x1e')]=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 da60e26..af412f5 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 _0x1a8f=['name','showNotification','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','exports','lodash','./util','../../../../../config/logger','routing','queue','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','squeue','handleRun','isNil','Agents','length','agents','info','channel','writeLog','RINGING','busy','busyQueue'];(function(_0x5a91b9,_0x9b3d96){var _0x4afc52=function(_0x837fe6){while(--_0x837fe6){_0x5a91b9['push'](_0x5a91b9['shift']());}};_0x4afc52(++_0x9b3d96);}(_0x1a8f,0x87));var _0xf1a8=function(_0x7b6f59,_0x7cc38d){_0x7b6f59=_0x7b6f59-0x0;var _0x278caf=_0x1a8f[_0x7b6f59];return _0x278caf;};'use strict';var _=require(_0xf1a8('0x0'));var uuid=require('uuid');var util=require(_0xf1a8('0x1'));var logger=require(_0xf1a8('0x2'))(_0xf1a8('0x3'));var Beepall=function(_0x1b1220,_0x9ea64,_0x5bc9ff,_0x520d7d){this['notificationId']=uuid['v4']();this['squeue']=_0x1b1220;this[_0xf1a8('0x4')]=_0x9ea64;this[_0xf1a8('0x5')]=_0x5bc9ff;this[_0xf1a8('0x3')]=_0x520d7d;this['squeue'][_0xf1a8('0x6')](this['handleRun'][_0xf1a8('0x7')](this),this[_0xf1a8('0x8')][_0xf1a8('0x7')](this));this['squeue']['on'](_0xf1a8('0x9'),this['handleTimeout'][_0xf1a8('0x7')](this));this['squeue']['on'](_0xf1a8('0xa'),this[_0xf1a8('0xb')][_0xf1a8('0x7')](this));};Beepall[_0xf1a8('0xc')]['push']=function(){this[_0xf1a8('0xd')]['push'](this[_0xf1a8('0xe')]['bind'](this),this[_0xf1a8('0x8')][_0xf1a8('0x7')](this));};Beepall[_0xf1a8('0xc')][_0xf1a8('0xb')]=function(_0x2d0965){this[_0xf1a8('0x8')](!![]);};Beepall[_0xf1a8('0xc')][_0xf1a8('0xe')]=function(_0x7438a7){var _0x5854c5=!![];if(!_[_0xf1a8('0xf')](this[_0xf1a8('0x4')])&&!_[_0xf1a8('0xf')](this[_0xf1a8('0x4')][_0xf1a8('0x10')])&&this[_0xf1a8('0x4')][_0xf1a8('0x10')][_0xf1a8('0x11')]>0x0){for(var _0x1fa067=0x0,_0x1734da;_0x1fa0670x0){for(var _0x2cff0f=0x0,_0x2360da;_0x2cff0f0x0&&_0x50896b[_0x356c9c+_0x6ffd('0x24')]>=_0x50896b[_0x356c9c+_0x6ffd('0x23')]){writeLog(_0x2efeb5,_0x50896b,_0x356c9c['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6ffd('0x25')]=function(_0x2a0391,_0x1934d4,_0x5e24de,_0x534139,_0x32c399){return sendNotification(!![],_0x2a0391,_0x1934d4,_0x5e24de,_0x534139,_0x32c399);};exports['hideNotification']=function(_0x470021,_0x20c007,_0x51fdb6,_0x6b5aba,_0xc790b2){return sendNotification(![],_0x470021,_0x20c007,_0x51fdb6,_0x6b5aba,_0xc790b2);};exports[_0x6ffd('0x26')]=writeLog; \ No newline at end of file +var _0x2d72=['redis','defaults','localhost','socket.io-emitter','format','user:%s','name','emit','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','\x20MAXCAPACITY','showNotification','hideNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing'];(function(_0x4665b8,_0x234a28){var _0x54ba4c=function(_0x38064a){while(--_0x38064a){_0x4665b8['push'](_0x4665b8['shift']());}};_0x54ba4c(++_0x234a28);}(_0x2d72,0xa8));var _0x22d7=function(_0x3751a3,_0x4d0ef9){_0x3751a3=_0x3751a3-0x0;var _0x30b025=_0x2d72[_0x3751a3];return _0x30b025;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var utils=require(_0x22d7('0x2'));var Mustache=require(_0x22d7('0x3'));var Redis=require(_0x22d7('0x4'));var config=require(_0x22d7('0x5'));var logger=require(_0x22d7('0x6'))(_0x22d7('0x7'));config[_0x22d7('0x8')]=_[_0x22d7('0x9')](config[_0x22d7('0x8')],{'host':_0x22d7('0xa'),'port':0x18eb});var io=require(_0x22d7('0xb'))(new Redis(config[_0x22d7('0x8')]));function emit(_0x52a3e3,_0x23a731,_0x3791d6){io['to'](_0x52a3e3)['emit'](_0x23a731,_0x3791d6);}function sendNotification(_0x3b12cd,_0x1abed9,_0x1c6aaf,_0x3c694f,_0x49f7e1,_0x5f56eb){io['to'](util[_0x22d7('0xc')](_0x22d7('0xd'),_0x3c694f[_0x22d7('0xe')]))[_0x22d7('0xf')](_0x22d7('0x10'),_0x3c694f);var _0x4db5dd=_0x5f56eb||{};var _0x47cec1=_0x1c6aaf[_0x22d7('0x11')]('.');var _0x4e1146={'uniqueid':_0x1abed9,'channel':_0x47cec1[0x0],'id':_0x47cec1[0x1],'title':_0x47cec1[0x0]+_0x22d7('0x12'),'interactionId':_0x47cec1[0x2],'queue':_0x49f7e1?_0x49f7e1[_0x22d7('0xe')]:null,'sound':_0x4db5dd['account'][_0x22d7('0x13')],'shake':_0x4db5dd[_0x22d7('0x14')][_0x22d7('0x15')]};try{if(!_0x4db5dd[_0x22d7('0x16')]){_0x4db5dd[_0x22d7('0x16')]={};}if(_0x49f7e1){_0x4db5dd[_0x22d7('0x16')][_0x22d7('0x17')]=_0x49f7e1;}else if(_0x4db5dd[_0x22d7('0x16')]['queue']){delete _0x4db5dd[_0x22d7('0x16')][_0x22d7('0x17')];}_0x4e1146[_0x22d7('0x18')]=utils['getMustacheRender'](_0x4db5dd['account']['notificationTemplate'],_0x4db5dd);}catch(_0x46f63d){_0x4e1146[_0x22d7('0x18')]=_0x22d7('0x19');logger[_0x22d7('0x1a')](util[_0x22d7('0xc')]('[%s][QUEUE]\x20%s',_0x1abed9,_0x46f63d[_0x22d7('0x1b')]));}io['to'](util[_0x22d7('0xc')](_0x22d7('0xd'),_0x3c694f['name']))[_0x22d7('0xf')](util[_0x22d7('0xc')](_0x22d7('0x1c'),_0x3b12cd?_0x22d7('0x1d'):_0x22d7('0x1e')),_0x4e1146);}function writeLog(_0x577400,_0x5e03d5,_0x219f7c){return logger[_0x22d7('0x1f')](util[_0x22d7('0xc')](_0x22d7('0x20'),_0x577400,_0x5e03d5['name'],_0x219f7c));}exports[_0x22d7('0x21')]=function(_0x141220,_0x1b7760,_0x5b6502,_0x459827){if(_0x1b7760['busy']){writeLog(_0x141220,_0x1b7760,_0x22d7('0x22'));return![];}if(!_0x1b7760[_0x22d7('0x23')]){writeLog(_0x141220,_0x1b7760,_0x22d7('0x24'));return![];}if(_0x1b7760[_0x5b6502+'Pause']){writeLog(_0x141220,_0x1b7760,_0x22d7('0x25'));return![];}if(_0x459827&&_0x1b7760['hasOwnProperty'](_0x5b6502+'Capacity')&&_0x1b7760[_0x22d7('0x26')](_0x5b6502+_0x22d7('0x27'))){if(_0x1b7760[_0x5b6502+_0x22d7('0x28')]>0x0&&_0x1b7760[_0x5b6502+_0x22d7('0x27')]>=_0x1b7760[_0x5b6502+_0x22d7('0x28')]){writeLog(_0x141220,_0x1b7760,_0x5b6502['toUpperCase']()+_0x22d7('0x29'));return![];}}return!![];};exports[_0x22d7('0x2a')]=function(_0xfbb9b,_0xce7f15,_0x45dc29,_0x49199a,_0x2606bd){return sendNotification(!![],_0xfbb9b,_0xce7f15,_0x45dc29,_0x49199a,_0x2606bd);};exports[_0x22d7('0x2b')]=function(_0x33c621,_0x2c0b24,_0x539ba0,_0x1195bc,_0x21c334){return sendNotification(![],_0x33c621,_0x2c0b24,_0x539ba0,_0x1195bc,_0x21c334);};exports['writeLog']=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 93a03bc..5f0fd5d 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 _0xd5bf=['lodash','./utils','../../../../config/logger','routing','string','length','error','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs'];(function(_0x332af5,_0x412a9f){var _0x209e99=function(_0x14e61a){while(--_0x14e61a){_0x332af5['push'](_0x332af5['shift']());}};_0x209e99(++_0x412a9f);}(_0xd5bf,0x66));var _0xfd5b=function(_0x437491,_0x3713e3){_0x437491=_0x437491-0x0;var _0x33e23a=_0xd5bf[_0x437491];return _0x33e23a;};'use strict';var schema=require(_0xfd5b('0x0'));var sh=require(_0xfd5b('0x1'));var _=require(_0xfd5b('0x2'));var utils=require(_0xfd5b('0x3'));var logger=require(_0xfd5b('0x4'))(_0xfd5b('0x5'));var system=schema({'command':{'type':_0xfd5b('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x2ba290,_0xe4dc1d){return function(_0x3a4dca){try{var _0x50351f={'command':_0xe4dc1d[0x0]};var _0x5f079a=system[_0xfd5b('0x0')](_0x50351f,{'typecast':!![]});if(_0x5f079a[_0xfd5b('0x7')]){logger[_0xfd5b('0x8')]('[%s][SYSTEM]\x20%s',_0x2ba290,_[_0xfd5b('0x9')](_0x5f079a,_0xfd5b('0xa'))['join'](',\x20'));logger[_0xfd5b('0xb')](_0xfd5b('0xc'),_0x2ba290);_0x3a4dca['next']();}else{var _0x20222a=this;var _0x56e7e7=utils[_0xfd5b('0xd')](_0xe4dc1d[0x0],this);logger['info'](_0xfd5b('0xe'),_0x2ba290,_0x56e7e7);sh['exec'](_[_0xfd5b('0xf')](_0x56e7e7),function(_0x1de484,_0x48a598){logger['info'](_0xfd5b('0x10'),_0x2ba290,_0x1de484);if(_0x1de484==0x0){var _0x2e1ee1=_0x48a598['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xfd5b('0x11')](_0xe4dc1d[0x1])||_[_0xfd5b('0x12')](_0xe4dc1d[0x1])){logger[_0xfd5b('0xb')](_0xfd5b('0x13'),_0x2ba290);_0x20222a[_0xfd5b('0x14')][_0xe4dc1d[0x1]]=_0x2e1ee1;}else{logger[_0xfd5b('0xb')](_0xfd5b('0x15'),_0x2ba290,_0xe4dc1d[0x1],_0x2e1ee1);_0x20222a[_0xfd5b('0x14')][_0xe4dc1d[0x1]]=_0x2e1ee1;}}_0x3a4dca[_0xfd5b('0x16')]();});}}catch(_0x291630){logger['error'](_0xfd5b('0x17'),_0x2ba290,_[_0xfd5b('0x18')](_0x291630)?JSON[_0xfd5b('0x19')](_0x291630):_0x291630);logger[_0xfd5b('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2ba290);_0x3a4dca[_0xfd5b('0x16')]();}};}; \ No newline at end of file +var _0xdcc2=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','lodash','./utils','../../../../config/logger','routing','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdcc2,0x16b));var _0x2dcc=function(_0x29925e,_0x30ca70){_0x29925e=_0x29925e-0x0;var _0x2455da=_0xdcc2[_0x29925e];return _0x2455da;};'use strict';var schema=require(_0x2dcc('0x0'));var sh=require('shelljs');var _=require(_0x2dcc('0x1'));var utils=require(_0x2dcc('0x2'));var logger=require(_0x2dcc('0x3'))(_0x2dcc('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x5ba06e,_0xc5ef23){return function(_0xa97357){try{var _0x16edfc={'command':_0xc5ef23[0x0]};var _0x43bcb5=system[_0x2dcc('0x0')](_0x16edfc,{'typecast':!![]});if(_0x43bcb5['length']){logger[_0x2dcc('0x5')](_0x2dcc('0x6'),_0x5ba06e,_[_0x2dcc('0x7')](_0x43bcb5,_0x2dcc('0x8'))[_0x2dcc('0x9')](',\x20'));logger[_0x2dcc('0xa')](_0x2dcc('0xb'),_0x5ba06e);_0xa97357[_0x2dcc('0xc')]();}else{var _0x325ca4=this;var _0x2a027f=utils[_0x2dcc('0xd')](_0xc5ef23[0x0],this);logger[_0x2dcc('0xa')](_0x2dcc('0xe'),_0x5ba06e,_0x2a027f);sh['exec'](_['trim'](_0x2a027f),function(_0x5c825d,_0x4c115e){logger[_0x2dcc('0xa')](_0x2dcc('0xf'),_0x5ba06e,_0x5c825d);if(_0x5c825d==0x0){var _0x6127f9=_0x4c115e[_0x2dcc('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x2dcc('0x11')](_0xc5ef23[0x1])||_[_0x2dcc('0x12')](_0xc5ef23[0x1])){logger[_0x2dcc('0xa')](_0x2dcc('0x13'),_0x5ba06e);_0x325ca4[_0x2dcc('0x14')][_0xc5ef23[0x1]]=_0x6127f9;}else{logger[_0x2dcc('0xa')](_0x2dcc('0x15'),_0x5ba06e,_0xc5ef23[0x1],_0x6127f9);_0x325ca4['body'][_0xc5ef23[0x1]]=_0x6127f9;}}_0xa97357['next']();});}}catch(_0x6d284a){logger[_0x2dcc('0x5')](_0x2dcc('0x6'),_0x5ba06e,_[_0x2dcc('0x16')](_0x6d284a)?JSON[_0x2dcc('0x17')](_0x6d284a):_0x6d284a);logger[_0x2dcc('0xa')](_0x2dcc('0xb'),_0x5ba06e);_0xa97357[_0x2dcc('0xc')]();}};}; \ 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 d621501..a0ede68 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 _0x0513=['validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','join','next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject'];(function(_0x56fbaa,_0x3bc5a6){var _0x49fbc1=function(_0x19b08b){while(--_0x19b08b){_0x56fbaa['push'](_0x56fbaa['shift']());}};_0x49fbc1(++_0x3bc5a6);}(_0x0513,0x70));var _0x3051=function(_0x51e393,_0x3be714){_0x51e393=_0x51e393-0x0;var _0x24c473=_0x0513[_0x51e393];return _0x24c473;};'use strict';var schema=require(_0x3051('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x3051('0x1')),'openchannelInteraction':require(_0x3051('0x2')),'smsInteraction':require(_0x3051('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x3051('0x4')),'whatsappInteraction':require(_0x3051('0x5'))};var logger=require(_0x3051('0x6'))(_0x3051('0x7'));var tag=schema({'tag':{'type':_0x3051('0x8'),'required':!![],'message':_0x3051('0x9')}});exports[_0x3051('0xa')]=function(_0x71995,_0x21d93e,_0x3ae3ef,_0x29204b){return function(_0x6c86a2){try{var _0x53c467={'tag':_0x21d93e[0x0]};var _0x277554=tag[_0x3051('0x0')](_0x53c467,{'typecast':!![]});if(_0x277554[_0x3051('0xb')]){logger[_0x3051('0xc')]('[%s][TAG]\x20%s',_0x71995,_[_0x3051('0xd')](_0x277554,'message')[_0x3051('0xe')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x71995);_0x6c86a2[_0x3051('0xf')]();}else{var _0x533469={'ids':[_0x21d93e[0x0]]};if(rpc[_0x29204b['channel']+'Interaction']){rpc[_0x29204b[_0x3051('0x10')]+_0x3051('0x11')]['addTags'](_0x29204b[_0x3051('0x12')]['id'],_0x533469)[_0x3051('0x13')](function(_0x159b55){logger['info'](_0x3051('0x14'),_0x71995,_0x21d93e[0x1],_0x29204b[_0x3051('0x10')],_0x29204b['interaction']['id']);})[_0x3051('0x15')](function(_0x3ef274){logger[_0x3051('0xc')](_0x3051('0x16'),_0x71995,JSON[_0x3051('0x17')](_0x3ef274));logger[_0x3051('0x18')](_0x3051('0x19'),_0x71995);})[_0x3051('0x1a')](function(){_0x6c86a2[_0x3051('0xf')]();});}}}catch(_0x489c07){logger['error']('[%s][TAG]\x20%s',_0x71995,_[_0x3051('0x1b')](_0x489c07)?JSON[_0x3051('0x17')](_0x489c07):_0x489c07);logger[_0x3051('0x18')](_0x3051('0x19'),_0x71995);_0x6c86a2['next']();}};}; \ No newline at end of file +var _0xfaf5=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','routing'];(function(_0x28a58c,_0x284400){var _0x57d372=function(_0x12ddc8){while(--_0x12ddc8){_0x28a58c['push'](_0x28a58c['shift']());}};_0x57d372(++_0x284400);}(_0xfaf5,0x18f));var _0x5faf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaf5[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x5faf('0x0'));var _=require(_0x5faf('0x1'));var rpc={'chatInteraction':require(_0x5faf('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x5faf('0x3')),'mailInteraction':require(_0x5faf('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x5faf('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x5faf('0x6')}});exports[_0x5faf('0x7')]=function(_0x194de9,_0x46a8d1,_0x4d8f79,_0x1e221d){return function(_0x4cb8c5){try{var _0x251e47={'tag':_0x46a8d1[0x0]};var _0x281b5f=tag[_0x5faf('0x0')](_0x251e47,{'typecast':!![]});if(_0x281b5f[_0x5faf('0x8')]){logger[_0x5faf('0x9')](_0x5faf('0xa'),_0x194de9,_[_0x5faf('0xb')](_0x281b5f,_0x5faf('0xc'))[_0x5faf('0xd')](',\x20'));logger[_0x5faf('0xe')](_0x5faf('0xf'),_0x194de9);_0x4cb8c5[_0x5faf('0x10')]();}else{var _0x5ea3f2={'ids':[_0x46a8d1[0x0]]};if(rpc[_0x1e221d['channel']+_0x5faf('0x11')]){rpc[_0x1e221d[_0x5faf('0x12')]+_0x5faf('0x11')][_0x5faf('0x13')](_0x1e221d[_0x5faf('0x14')]['id'],_0x5ea3f2)[_0x5faf('0x15')](function(_0x11e53f){logger[_0x5faf('0xe')](_0x5faf('0x16'),_0x194de9,_0x46a8d1[0x1],_0x1e221d[_0x5faf('0x12')],_0x1e221d['interaction']['id']);})[_0x5faf('0x17')](function(_0x162c8b){logger[_0x5faf('0x9')](_0x5faf('0xa'),_0x194de9,JSON['stringify'](_0x162c8b));logger[_0x5faf('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x194de9);})[_0x5faf('0x18')](function(){_0x4cb8c5[_0x5faf('0x10')]();});}}}catch(_0x4a4794){logger[_0x5faf('0x9')](_0x5faf('0xa'),_0x194de9,_[_0x5faf('0x19')](_0x4a4794)?JSON[_0x5faf('0x1a')](_0x4a4794):_0x4a4794);logger['info'](_0x5faf('0xf'),_0x194de9);_0x4cb8c5[_0x5faf('0x10')]();}};}; \ 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 468812c..1429484 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 _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x5f191d,_0x4907af){var _0x110429=function(_0xec712a){while(--_0xec712a){_0x5f191d['push'](_0x5f191d['shift']());}};_0x110429(++_0x4907af);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x6c03ac,_0x5da780){var _0x524fa9=function(_0x4c229d){while(--_0x4c229d){_0x6c03ac['push'](_0x6c03ac['shift']());}};_0x524fa9(++_0x5da780);}(_0xe706,0xa3));var _0x6e70=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0xe706[_0x38af48];return _0x445384;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 4c6f86d..af656ee 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 _0xb82c=['capacity','agent\x20not\x20found','values','chatQueues','name','paused','waiting','mailQueues','available','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','IntervalId','isNil','Intervals','interval','listen','message','interaction','isArray','applications','length','existsSync','app','.js','toLowerCase','split','channel','mail','push','slice','join','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','CurrentCapacity'];(function(_0x103bba,_0x4831ac){var _0x46e4d3=function(_0x23bc11){while(--_0x23bc11){_0x103bba['push'](_0x103bba['shift']());}};_0x46e4d3(++_0x4831ac);}(_0xb82c,0x7a));var _0xcb82=function(_0x466a1e,_0x32729c){_0x466a1e=_0x466a1e-0x0;var _0x3f4654=_0xb82c[_0x466a1e];return _0x3f4654;};'use strict';var _=require(_0xcb82('0x0'));var util=require(_0xcb82('0x1'));var path=require(_0xcb82('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xcb82('0x3'));var uuid=require(_0xcb82('0x4'));var config=require(_0xcb82('0x5'));var logger=require('../../../config/logger')(_0xcb82('0x6'));var rpc={'openchannelQueueReport':require(_0xcb82('0x7')),'mailQueueReport':require(_0xcb82('0x8')),'chatQueueReport':require(_0xcb82('0x9')),'smsQueueReport':require(_0xcb82('0xa')),'faxQueueReport':require(_0xcb82('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x3b52a7,_0x185e54,_0x58aeac){return util[_0xcb82('0xc')]('%s.%s.%s',_0x3b52a7,_0x185e54||0x0,_0x58aeac||0x0);}function getIntervals(_0x329628,_0x32b3c5){var _0x14843c=[];if(!_['isNil'](_0x32b3c5[_0xcb82('0xd')])&&!_[_0xcb82('0xe')](_0x329628[_0x32b3c5[_0xcb82('0xd')]])&&!_[_0xcb82('0xe')](_0x329628[_0x32b3c5[_0xcb82('0xd')]][_0xcb82('0xf')])){_0x14843c=_['map'](_0x329628[_0x32b3c5[_0xcb82('0xd')]][_0xcb82('0xf')],'interval');}else if(!_['isNil'](_0x32b3c5[_0xcb82('0x10')])){_0x14843c=[_0x32b3c5[_0xcb82('0x10')]];}return _0x14843c;}exports[_0xcb82('0x11')]=function(_0xf86ba2){_0xf86ba2['rules']={};return new BPromise(function(_0x528985,_0x186ed0){var _0x57ab68={'Start':function(_0x48cab0){var _0x389dc5=this;return new Promise(function(_0x502dbf,_0x470253){if(_0x48cab0){try{var _0x254f97=[];var _0x11219b=getId(_0x48cab0['channel'],_0x48cab0[_0xcb82('0x12')]?_0x48cab0[_0xcb82('0x12')]['id']:0x0,_0x48cab0[_0xcb82('0x13')]?_0x48cab0[_0xcb82('0x13')]['id']:0x0);if(_0x48cab0['applications']&&_[_0xcb82('0x14')](_0x48cab0[_0xcb82('0x15')])&&_0x48cab0[_0xcb82('0x15')][_0xcb82('0x16')]){for(var _0x3341ee=0x0;_0x3341ee<_0x48cab0['applications'][_0xcb82('0x16')];_0x3341ee+=0x1){var _0xc63a16=_0x48cab0[_0xcb82('0x15')][_0x3341ee];if(fs[_0xcb82('0x17')](path['join'](__dirname,_0xcb82('0x15'),_0xc63a16[_0xcb82('0x18')]+_0xcb82('0x19')))){var _0x84a505=[];switch(_0xc63a16[_0xcb82('0x18')][_0xcb82('0x1a')]()){case'autoreply':var _0x5ec4e7=_0xc63a16['appdata'][_0xcb82('0x1b')](',');if(_0x48cab0[_0xcb82('0x1c')]===_0xcb82('0x1d')){_0x84a505[_0xcb82('0x1e')](_0x5ec4e7[0x0]);_0x84a505[_0xcb82('0x1e')](_0x5ec4e7[0x1]);_0x84a505[_0xcb82('0x1e')](_0x5ec4e7[_0xcb82('0x1f')](0x2,_0x5ec4e7[_0xcb82('0x16')])['join'](','));}else{_0x84a505[_0xcb82('0x1e')](_0x5ec4e7[0x0]);_0x84a505[_0xcb82('0x1e')](_0x5ec4e7['slice'](0x1,_0x5ec4e7[_0xcb82('0x16')])[_0xcb82('0x20')](','));}break;case _0xcb82('0x21'):var _0x25bd4a=_0xc63a16[_0xcb82('0x22')][_0xcb82('0x1b')](',');_0x84a505[_0xcb82('0x1e')](_0x25bd4a[0x0]);_0x84a505['push'](_0x25bd4a[0x1]);_0x84a505[_0xcb82('0x1e')](_0x25bd4a[_0xcb82('0x1f')](0x2,_0x25bd4a[_0xcb82('0x16')])[_0xcb82('0x20')](','));break;case _0xcb82('0x23'):var _0x9609bb=_0xc63a16[_0xcb82('0x22')][_0xcb82('0x1b')](',');_0x84a505[_0xcb82('0x1e')](_0x9609bb[0x0]);_0x84a505['push'](_0x9609bb[0x1]);_0x84a505[_0xcb82('0x1e')](_0x9609bb[0x2]);_0x84a505[_0xcb82('0x1e')](_0x9609bb[0x3]);_0x84a505[_0xcb82('0x1e')](_0x9609bb[_0xcb82('0x1f')](0x4,_0x9609bb[_0xcb82('0x16')])[_0xcb82('0x20')](','));break;case _0xcb82('0x24'):var _0x49c328=_0xc63a16[_0xcb82('0x22')][_0xcb82('0x1b')](',');_0x84a505[_0xcb82('0x1e')](_0x49c328[0x0]);_0x84a505[_0xcb82('0x1e')](_0x49c328[0x1]);_0x84a505[_0xcb82('0x1e')](_0x49c328[0x2]);_0x84a505[_0xcb82('0x1e')](_0x49c328[0x3]);_0x84a505[_0xcb82('0x1e')](_0x49c328[_0xcb82('0x1f')](0x4,_0x49c328[_0xcb82('0x16')])[_0xcb82('0x20')](','));break;case'message':_0x84a505[_0xcb82('0x1e')](_0xc63a16[_0xcb82('0x22')]);break;case _0xcb82('0x25'):_0x84a505[_0xcb82('0x1e')](_0xc63a16[_0xcb82('0x26')]);_0x84a505[_0xcb82('0x1e')](_0xc63a16[_0xcb82('0x22')]);break;default:_0x84a505=_['isNil'](_0xc63a16['appdata'])?[]:_0xc63a16[_0xcb82('0x22')][_0xcb82('0x1b')](',');}var _0x30140a={'id':util[_0xcb82('0xc')](_0xcb82('0x27'),_0x11219b,_0xc63a16['id'],_0xc63a16[_0xcb82('0x18')]),'condition':require(_0xcb82('0x28'))[_0xcb82('0x29')](_0x11219b,getIntervals(_0xf86ba2[_0xcb82('0x2a')],_0xc63a16),_0xf86ba2),'consequence':require(_0xcb82('0x2b')+_0xc63a16[_0xcb82('0x18')])[_0xcb82('0x2c')](_0x11219b,_0x84a505,_0xf86ba2,_0x48cab0),'p':_0xc63a16[_0xcb82('0x2d')]||0x0};logger[_0xcb82('0x2e')](_0xcb82('0x2f'),_0x30140a['id'],_0xcb82('0x30'),getIntervals(_0xf86ba2['intervals'],_0xc63a16)[_0xcb82('0x20')](_0xcb82('0x31')));_0x254f97[_0xcb82('0x1e')](_0x30140a);}else{logger[_0xcb82('0x32')](_0xcb82('0x33'),path[_0xcb82('0x20')](__dirname,_0xcb82('0x15'),_0xc63a16[_0xcb82('0x18')]+'.js'));}}_0xf86ba2[_0xcb82('0x34')][_0x11219b]=new RuleEngine(_0x254f97);_0xf86ba2[_0xcb82('0x34')][_0x11219b][_0xcb82('0x35')](_0x48cab0,function(_0x148c18){logger[_0xcb82('0x2e')](_0xcb82('0x36'),JSON[_0xcb82('0x37')](_0x148c18[_0xcb82('0x38')]));if(_0xf86ba2[_0xcb82('0x34')][_0x11219b]){_0xf86ba2[_0xcb82('0x34')][_0x11219b][_0xcb82('0x39')](_0xcb82('0x3a'));}});return _0x502dbf({'code':0xc8,'message':_0x48cab0});}else{logger['info'](_0xcb82('0x3b'));return _0x502dbf({'code':0xc8,'message':_0x48cab0});}}catch(_0x5d15af){logger[_0xcb82('0x32')](_0x5d15af[_0xcb82('0x3c')]);return _0x470253(_0x389dc5[_0xcb82('0x32')](0x1f4,_0x5d15af));}}return _0x470253(_0xcb82('0x3d'));});},'AcceptMessage':function(_0xc01e1b){var _0xc8f83b=this;return new Promise(function(_0x5e1cef,_0x8cdbbb){if(_0xc01e1b[_0xcb82('0x3e')]&&_0xc01e1b[_0xcb82('0x3e')]['id']){if(_0xf86ba2['agents'][_0xc01e1b[_0xcb82('0x3e')]['id']]){_0xf86ba2[_0xcb82('0x3f')][_0xc01e1b[_0xcb82('0x3e')]['id']][_0xcb82('0x40')]=![];_0xf86ba2[_0xcb82('0x3f')][_0xc01e1b[_0xcb82('0x3e')]['id']]['busyQueue']=undefined;}}if(_0xc01e1b[_0xcb82('0x12')]&&_0xc01e1b[_0xcb82('0x12')]['id']){try{var _0x388386=getId(_0xc01e1b[_0xcb82('0x1c')],_0xc01e1b[_0xcb82('0x12')]?_0xc01e1b['message']['id']:0x0,_0xc01e1b[_0xcb82('0x13')]?_0xc01e1b[_0xcb82('0x13')]['id']:0x0);if(_0xf86ba2[_0xcb82('0x34')][_0x388386]){_0xf86ba2['rules'][_0x388386][_0xcb82('0x39')](_0xcb82('0x41'));if(rpc[_0xc01e1b['channel']+_0xcb82('0x42')]){rpc[_0xc01e1b[_0xcb82('0x1c')]+_0xcb82('0x42')][_0xcb82('0x43')](_0x388386,{'UserId':_0xc01e1b['message']['UserId']})[_0xcb82('0x44')](function(_0x679ec3){logger['error'](_0xcb82('0x45'));});}}return _0x5e1cef({'code':0xc8,'message':_0xc01e1b});}catch(_0x154d3a){logger['error'](_0x154d3a['stack']);return _0x8cdbbb(_0xc8f83b[_0xcb82('0x32')](0x1f4,_0x154d3a));}}logger[_0xcb82('0x32')](_0xcb82('0x46'));return _0x8cdbbb(_0xc8f83b[_0xcb82('0x32')](0x1f4,_0xcb82('0x46')));});},'RejectMessage':function(_0x58c726){var _0x5adc99=this;return new Promise(function(_0x590ddf,_0x259a5a){if(_0x58c726[_0xcb82('0x3e')]&&_0x58c726[_0xcb82('0x3e')]['id']){try{if(_0xf86ba2[_0xcb82('0x3f')][_0x58c726[_0xcb82('0x3e')]['id']]){_0xf86ba2[_0xcb82('0x3f')][_0x58c726[_0xcb82('0x3e')]['id']][_0xcb82('0x40')]=![];_0xf86ba2['agents'][_0x58c726[_0xcb82('0x3e')]['id']][_0xcb82('0x47')]=undefined;}return _0x590ddf({'code':0xc8,'message':_0x58c726});}catch(_0x2c0645){logger['error'](_0x2c0645[_0xcb82('0x3c')]);return _0x259a5a(_0x5adc99[_0xcb82('0x32')](0x1f4,_0x2c0645));}}logger[_0xcb82('0x32')](_0xcb82('0x46'));return _0x259a5a(_0x5adc99[_0xcb82('0x32')](0x1f4,_0xcb82('0x46')));});},'AbandonInteraction':function(_0x2a58b2){var _0x552c0a=this;return new Promise(function(_0x351ad8,_0x57bb59){if(_0x2a58b2['channel']&&_0x2a58b2['interaction']&&_0x2a58b2[_0xcb82('0x13')]['id']){try{var _0x3b5d3e=getId(_0x2a58b2[_0xcb82('0x1c')],_0x2a58b2[_0xcb82('0x12')]?_0x2a58b2[_0xcb82('0x12')]['id']:0x0,_0x2a58b2[_0xcb82('0x13')]?_0x2a58b2[_0xcb82('0x13')]['id']:0x0);if(_0xf86ba2[_0xcb82('0x34')][_0x3b5d3e]){_0xf86ba2[_0xcb82('0x34')][_0x3b5d3e]['emit'](_0xcb82('0x41'));}return _0x351ad8({'code':0xc8,'message':_0x2a58b2});}catch(_0x5f23df){logger['error'](_0x5f23df[_0xcb82('0x3c')]);return _0x57bb59(_0x552c0a['error'](0x1f4,_0x5f23df));}}logger['error'](_0xcb82('0x46'));return _0x57bb59(_0x552c0a[_0xcb82('0x32')](0x1f4,_0xcb82('0x46')));});},'AgentCapacity':function(_0x296cc3){var _0x4e3e7c=this;return new Promise(function(_0x1fae39,_0x376cdd){if(_0xf86ba2['agents'][_0xcb82('0x48')](_0x296cc3['id'])){for(var _0x54e3f4 in _0x296cc3['capacity']){if(_0x296cc3['capacity'][_0xcb82('0x48')](_0x54e3f4)){if(_0xf86ba2['agents'][_0x296cc3['id']][_0xcb82('0x48')](_0x54e3f4+_0xcb82('0x49'))){_0xf86ba2[_0xcb82('0x3f')][_0x296cc3['id']][_0x54e3f4+'CurrentCapacity']=parseInt(_0x296cc3[_0xcb82('0x4a')][_0x54e3f4],0xa);}}}_0xf86ba2['agents'][_0x296cc3['id']]['updateRealtime']();return _0x1fae39({'code':0xc8,'message':_0xf86ba2[_0xcb82('0x3f')][_0x296cc3['id']]});}else{return _0x376cdd(_0x4e3e7c[_0xcb82('0x32')](0x1f4,_0xcb82('0x4b')));}});},'Agents':function(_0x2833b9){return new Promise(function(_0x14d8b3,_0x467df1){var _0x4660a3=_[_0xcb82('0x4c')](_0xf86ba2[_0xcb82('0x3f')]);_0x14d8b3({'count':_0x4660a3[_0xcb82('0x16')],'rows':_0x4660a3});});},'ChatQueues':function(_0x2dd72f){return new Promise(function(_0x459a74,_0x2cea6d){var _0x4558c2=[];for(var _0x4c632f in _0xf86ba2[_0xcb82('0x4d')]){if(_0xf86ba2[_0xcb82('0x4d')]['hasOwnProperty'](_0x4c632f)){var _0x4d5e07=_0xf86ba2[_0xcb82('0x4d')][_0x4c632f];var _0x4e25be={'id':_0x4d5e07['id'],'available':_0x4d5e07['available'],'loggedIn':_0x4d5e07['loggedIn'],'name':_0x4d5e07[_0xcb82('0x4e')],'paused':_0x4d5e07[_0xcb82('0x4f')],'waiting':_0x4d5e07[_0xcb82('0x50')]};_0x4558c2[_0xcb82('0x1e')](_0x4e25be);}}_0x459a74({'count':_0x4558c2['length'],'rows':_0x4558c2});});},'MailQueues':function(_0x35ece8){return new Promise(function(_0x1adc74,_0x586c03){var _0x238c55=[];for(var _0x3601ff in _0xf86ba2['mailQueues']){if(_0xf86ba2[_0xcb82('0x51')][_0xcb82('0x48')](_0x3601ff)){var _0x2d63a8=_0xf86ba2[_0xcb82('0x51')][_0x3601ff];var _0x2d1d30={'id':_0x2d63a8['id'],'available':_0x2d63a8[_0xcb82('0x52')],'loggedIn':_0x2d63a8[_0xcb82('0x53')],'name':_0x2d63a8[_0xcb82('0x4e')],'paused':_0x2d63a8[_0xcb82('0x4f')],'waiting':_0x2d63a8[_0xcb82('0x50')]};_0x238c55['push'](_0x2d1d30);}}_0x1adc74({'count':_0x238c55[_0xcb82('0x16')],'rows':_0x238c55});});},'OpenchannelQueues':function(_0x3be4a6){return new Promise(function(_0x40d46b,_0x525e08){var _0x54290c=[];for(var _0x3e4a1e in _0xf86ba2[_0xcb82('0x54')]){if(_0xf86ba2[_0xcb82('0x54')][_0xcb82('0x48')](_0x3e4a1e)){var _0x45da75=_0xf86ba2[_0xcb82('0x54')][_0x3e4a1e];var _0x3517d8={'id':_0x45da75['id'],'available':_0x45da75['available'],'loggedIn':_0x45da75[_0xcb82('0x53')],'name':_0x45da75[_0xcb82('0x4e')],'paused':_0x45da75[_0xcb82('0x4f')],'waiting':_0x45da75[_0xcb82('0x50')]};_0x54290c[_0xcb82('0x1e')](_0x3517d8);}}_0x40d46b({'count':_0x54290c[_0xcb82('0x16')],'rows':_0x54290c});});},'SmsQueues':function(_0x351896){return new Promise(function(_0x4f8812,_0x4c7c10){var _0x215773=[];for(var _0x421102 in _0xf86ba2[_0xcb82('0x55')]){if(_0xf86ba2[_0xcb82('0x55')][_0xcb82('0x48')](_0x421102)){var _0x12c66a=_0xf86ba2[_0xcb82('0x55')][_0x421102];var _0x33cf2f={'id':_0x12c66a['id'],'available':_0x12c66a[_0xcb82('0x52')],'loggedIn':_0x12c66a[_0xcb82('0x53')],'name':_0x12c66a[_0xcb82('0x4e')],'paused':_0x12c66a['paused'],'waiting':_0x12c66a[_0xcb82('0x50')]};_0x215773['push'](_0x33cf2f);}}_0x4f8812({'count':_0x215773['length'],'rows':_0x215773});});},'FaxQueues':function(_0x3ed16f){return new Promise(function(_0x24c6be,_0x378547){var _0x56578a=[];for(var _0x48f44e in _0xf86ba2[_0xcb82('0x56')]){if(_0xf86ba2[_0xcb82('0x56')][_0xcb82('0x48')](_0x48f44e)){var _0x4dfa36=_0xf86ba2[_0xcb82('0x56')][_0x48f44e];var _0x4d78d9={'id':_0x4dfa36['id'],'available':_0x4dfa36[_0xcb82('0x52')],'loggedIn':_0x4dfa36[_0xcb82('0x53')],'name':_0x4dfa36['name'],'paused':_0x4dfa36[_0xcb82('0x4f')],'waiting':_0x4dfa36[_0xcb82('0x50')]};_0x56578a[_0xcb82('0x1e')](_0x4d78d9);}}_0x24c6be({'count':_0x56578a[_0xcb82('0x16')],'rows':_0x56578a});});},'WhatsappQueues':function(_0x5ca783){return new Promise(function(_0x4e1261,_0xe822de){var _0x3efc79=[];for(var _0x2e16ec in _0xf86ba2[_0xcb82('0x57')]){if(_0xf86ba2['whatsappQueues']['hasOwnProperty'](_0x2e16ec)){var _0x588b3d=_0xf86ba2[_0xcb82('0x57')][_0x2e16ec];var _0x44a258={'id':_0x588b3d['id'],'available':_0x588b3d[_0xcb82('0x52')],'loggedIn':_0x588b3d['loggedIn'],'name':_0x588b3d[_0xcb82('0x4e')],'paused':_0x588b3d[_0xcb82('0x4f')],'waiting':_0x588b3d['waiting']};_0x3efc79[_0xcb82('0x1e')](_0x44a258);}}_0x4e1261({'count':_0x3efc79['length'],'rows':_0x3efc79});});},'ChatQueuesWaitingInteractions':function(_0x4e187f){return new Promise(function(_0x125b5b,_0x10bedf){var _0x1dc246=_[_0xcb82('0x4c')](_0xf86ba2[_0xcb82('0x58')]);_0x125b5b({'count':_0x1dc246[_0xcb82('0x16')],'rows':_0x1dc246});});},'MailQueuesWaitingInteractions':function(_0x2dbfe5){return new Promise(function(_0x53044e,_0x4c83ff){var _0x487a71=_[_0xcb82('0x4c')](_0xf86ba2['mailQueuesWaitingInteractions']);_0x53044e({'count':_0x487a71['length'],'rows':_0x487a71});});},'OpenchannelQueuesWaitingInteractions':function(_0x536157){return new Promise(function(_0x1666b8,_0x1e8c6e){var _0x8965d3=_[_0xcb82('0x4c')](_0xf86ba2[_0xcb82('0x59')]);_0x1666b8({'count':_0x8965d3[_0xcb82('0x16')],'rows':_0x8965d3});});},'SmsQueuesWaitingInteractions':function(_0x2cbf68){return new Promise(function(_0x529fa4,_0x3a1174){var _0x2239b2=_[_0xcb82('0x4c')](_0xf86ba2[_0xcb82('0x5a')]);_0x529fa4({'count':_0x2239b2[_0xcb82('0x16')],'rows':_0x2239b2});});},'FaxQueuesWaitingInteractions':function(_0x554cf7){return new Promise(function(_0x45de5a,_0x5dad2f){var _0xe50701=_[_0xcb82('0x4c')](_0xf86ba2[_0xcb82('0x5b')]);_0x45de5a({'count':_0xe50701[_0xcb82('0x16')],'rows':_0xe50701});});},'WhatsappQueuesWaitingInteractions':function(_0x1063f4){return new Promise(function(_0x4541dc,_0x11d21d){var _0x4c9271=_[_0xcb82('0x4c')](_0xf86ba2['whatsappQueuesWaitingInteractions']);_0x4541dc({'count':_0x4c9271[_0xcb82('0x16')],'rows':_0x4c9271});});}};var _0x29d755=jayson[_0xcb82('0x5c')](_0x57ab68)[_0xcb82('0x5d')]();_0x29d755['on']('error',function(_0x2d1009){logger[_0xcb82('0x32')](JSON['stringify'](_0x2d1009));return _0x186ed0(_0x2d1009);});_0x29d755[_0xcb82('0x11')](0x232c,_0xcb82('0x5e'),function(){console[_0xcb82('0x5f')](_0xcb82('0x60'),0x232c);return _0x528985(_0xcb82('0x61')+0x232c);});});}; \ No newline at end of file +var _0x2777=['RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','rules','channel','message','interaction','isArray','applications','length','existsSync','app','.js','toLowerCase','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','tag','%s:%s:%s','./interval','condition','./applications/','Push\x20new\x20rule','on\x20interval','intervals','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','agent','agents','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!'];(function(_0x5f4395,_0x2764d7){var _0x213856=function(_0x125b74){while(--_0x125b74){_0x5f4395['push'](_0x5f4395['shift']());}};_0x213856(++_0x2764d7);}(_0x2777,0xbf));var _0x7277=function(_0x347b88,_0x45495f){_0x347b88=_0x347b88-0x0;var _0x4c8eb3=_0x2777[_0x347b88];return _0x4c8eb3;};'use strict';var _=require(_0x7277('0x0'));var util=require('util');var path=require(_0x7277('0x1'));var fs=require('fs');var jayson=require(_0x7277('0x2'));var BPromise=require(_0x7277('0x3'));var uuid=require(_0x7277('0x4'));var config=require(_0x7277('0x5'));var logger=require(_0x7277('0x6'))(_0x7277('0x7'));var rpc={'openchannelQueueReport':require(_0x7277('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x7277('0x9')),'smsQueueReport':require(_0x7277('0xa')),'faxQueueReport':require(_0x7277('0xb')),'whatsappQueueReport':require(_0x7277('0xc'))};var RuleEngine=require(_0x7277('0xd'));function getId(_0x2b4e5b,_0x125b71,_0x414522){return util[_0x7277('0xe')]('%s.%s.%s',_0x2b4e5b,_0x125b71||0x0,_0x414522||0x0);}function getIntervals(_0x378670,_0x2eeba1){var _0x4cfb5a=[];if(!_[_0x7277('0xf')](_0x2eeba1[_0x7277('0x10')])&&!_[_0x7277('0xf')](_0x378670[_0x2eeba1[_0x7277('0x10')]])&&!_[_0x7277('0xf')](_0x378670[_0x2eeba1[_0x7277('0x10')]][_0x7277('0x11')])){_0x4cfb5a=_[_0x7277('0x12')](_0x378670[_0x2eeba1[_0x7277('0x10')]][_0x7277('0x11')],'interval');}else if(!_[_0x7277('0xf')](_0x2eeba1['interval'])){_0x4cfb5a=[_0x2eeba1['interval']];}return _0x4cfb5a;}exports['listen']=function(_0x16f065){_0x16f065[_0x7277('0x13')]={};return new BPromise(function(_0x195abf,_0x3e2597){var _0x17beef={'Start':function(_0x53a0f2){var _0x1811dc=this;return new Promise(function(_0x5ca84b,_0x2221a4){if(_0x53a0f2){try{var _0x172f74=[];var _0x32014c=getId(_0x53a0f2[_0x7277('0x14')],_0x53a0f2[_0x7277('0x15')]?_0x53a0f2[_0x7277('0x15')]['id']:0x0,_0x53a0f2['interaction']?_0x53a0f2[_0x7277('0x16')]['id']:0x0);if(_0x53a0f2['applications']&&_[_0x7277('0x17')](_0x53a0f2[_0x7277('0x18')])&&_0x53a0f2[_0x7277('0x18')][_0x7277('0x19')]){for(var _0x4e66f3=0x0;_0x4e66f3<_0x53a0f2[_0x7277('0x18')]['length'];_0x4e66f3+=0x1){var _0x470a71=_0x53a0f2[_0x7277('0x18')][_0x4e66f3];if(fs[_0x7277('0x1a')](path['join'](__dirname,_0x7277('0x18'),_0x470a71[_0x7277('0x1b')]+_0x7277('0x1c')))){var _0x74e131=[];switch(_0x470a71[_0x7277('0x1b')][_0x7277('0x1d')]()){case'autoreply':var _0x3fafd2=_0x470a71[_0x7277('0x1e')][_0x7277('0x1f')](',');if(_0x53a0f2[_0x7277('0x14')]===_0x7277('0x20')){_0x74e131[_0x7277('0x21')](_0x3fafd2[0x0]);_0x74e131['push'](_0x3fafd2[0x1]);_0x74e131['push'](_0x3fafd2[_0x7277('0x22')](0x2,_0x3fafd2[_0x7277('0x19')])['join'](','));}else{_0x74e131['push'](_0x3fafd2[0x0]);_0x74e131[_0x7277('0x21')](_0x3fafd2[_0x7277('0x22')](0x1,_0x3fafd2[_0x7277('0x19')])[_0x7277('0x23')](','));}break;case _0x7277('0x24'):var _0x2513c4=_0x470a71['appdata'][_0x7277('0x1f')](',');_0x74e131[_0x7277('0x21')](_0x2513c4[0x0]);_0x74e131['push'](_0x2513c4[0x1]);_0x74e131[_0x7277('0x21')](_0x2513c4[_0x7277('0x22')](0x2,_0x2513c4[_0x7277('0x19')])[_0x7277('0x23')](','));break;case _0x7277('0x25'):var _0x319f13=_0x470a71['appdata'][_0x7277('0x1f')](',');_0x74e131[_0x7277('0x21')](_0x319f13[0x0]);_0x74e131[_0x7277('0x21')](_0x319f13[0x1]);_0x74e131['push'](_0x319f13[0x2]);_0x74e131['push'](_0x319f13[0x3]);_0x74e131[_0x7277('0x21')](_0x319f13[_0x7277('0x22')](0x4,_0x319f13[_0x7277('0x19')])[_0x7277('0x23')](','));break;case'amazonlex':var _0x27a82e=_0x470a71['appdata'][_0x7277('0x1f')](',');_0x74e131['push'](_0x27a82e[0x0]);_0x74e131[_0x7277('0x21')](_0x27a82e[0x1]);_0x74e131[_0x7277('0x21')](_0x27a82e[0x2]);_0x74e131[_0x7277('0x21')](_0x27a82e[0x3]);_0x74e131[_0x7277('0x21')](_0x27a82e[_0x7277('0x22')](0x4,_0x27a82e['length'])[_0x7277('0x23')](','));break;case _0x7277('0x15'):_0x74e131[_0x7277('0x21')](_0x470a71['appdata']);break;case _0x7277('0x26'):_0x74e131[_0x7277('0x21')](_0x470a71['TagId']);_0x74e131[_0x7277('0x21')](_0x470a71['appdata']);break;default:_0x74e131=_[_0x7277('0xf')](_0x470a71[_0x7277('0x1e')])?[]:_0x470a71[_0x7277('0x1e')][_0x7277('0x1f')](',');}var _0x2dc93d={'id':util[_0x7277('0xe')](_0x7277('0x27'),_0x32014c,_0x470a71['id'],_0x470a71[_0x7277('0x1b')]),'condition':require(_0x7277('0x28'))[_0x7277('0x29')](_0x32014c,getIntervals(_0x16f065['intervals'],_0x470a71),_0x16f065),'consequence':require(_0x7277('0x2a')+_0x470a71['app'])['consequence'](_0x32014c,_0x74e131,_0x16f065,_0x53a0f2),'p':_0x470a71['priority']||0x0};logger['info'](_0x7277('0x2b'),_0x2dc93d['id'],_0x7277('0x2c'),getIntervals(_0x16f065[_0x7277('0x2d')],_0x470a71)['join']('\x20|\x20'));_0x172f74[_0x7277('0x21')](_0x2dc93d);}else{logger['error'](_0x7277('0x2e'),path['join'](__dirname,'applications',_0x470a71['app']+'.js'));}}_0x16f065[_0x7277('0x13')][_0x32014c]=new RuleEngine(_0x172f74);_0x16f065[_0x7277('0x13')][_0x32014c][_0x7277('0x2f')](_0x53a0f2,function(_0x1f523e){logger[_0x7277('0x30')]('Applications\x20executed',JSON[_0x7277('0x31')](_0x1f523e[_0x7277('0x32')]));if(_0x16f065['rules'][_0x32014c]){_0x16f065[_0x7277('0x13')][_0x32014c][_0x7277('0x33')](_0x7277('0x34'));}});return _0x5ca84b({'code':0xc8,'message':_0x53a0f2});}else{logger[_0x7277('0x30')](_0x7277('0x35'));return _0x5ca84b({'code':0xc8,'message':_0x53a0f2});}}catch(_0x1e89ea){logger['error'](_0x1e89ea[_0x7277('0x36')]);return _0x2221a4(_0x1811dc[_0x7277('0x37')](0x1f4,_0x1e89ea));}}return _0x2221a4(_0x7277('0x38'));});},'AcceptMessage':function(_0x5ca841){var _0x2a5d6e=this;return new Promise(function(_0x37e674,_0x41fecb){if(_0x5ca841[_0x7277('0x39')]&&_0x5ca841[_0x7277('0x39')]['id']){if(_0x16f065[_0x7277('0x3a')][_0x5ca841[_0x7277('0x39')]['id']]){_0x16f065[_0x7277('0x3a')][_0x5ca841[_0x7277('0x39')]['id']]['busy']=![];_0x16f065['agents'][_0x5ca841[_0x7277('0x39')]['id']]['busyQueue']=undefined;}}if(_0x5ca841[_0x7277('0x15')]&&_0x5ca841[_0x7277('0x15')]['id']){try{var _0x4c6e14=getId(_0x5ca841[_0x7277('0x14')],_0x5ca841[_0x7277('0x15')]?_0x5ca841['message']['id']:0x0,_0x5ca841[_0x7277('0x16')]?_0x5ca841[_0x7277('0x16')]['id']:0x0);if(_0x16f065[_0x7277('0x13')][_0x4c6e14]){_0x16f065['rules'][_0x4c6e14][_0x7277('0x33')](_0x7277('0x3b'));if(rpc[_0x5ca841[_0x7277('0x14')]+'QueueReport']){rpc[_0x5ca841[_0x7277('0x14')]+_0x7277('0x3c')][_0x7277('0x3d')](_0x4c6e14,{'UserId':_0x5ca841[_0x7277('0x15')][_0x7277('0x3e')]})[_0x7277('0x3f')](function(_0x2635ec){logger['error'](_0x7277('0x40'));});}}return _0x37e674({'code':0xc8,'message':_0x5ca841});}catch(_0x249eeb){logger[_0x7277('0x37')](_0x249eeb[_0x7277('0x36')]);return _0x41fecb(_0x2a5d6e[_0x7277('0x37')](0x1f4,_0x249eeb));}}logger[_0x7277('0x37')](_0x7277('0x41'));return _0x41fecb(_0x2a5d6e[_0x7277('0x37')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3ac517){var _0x5895a1=this;return new Promise(function(_0x6a008,_0x199154){if(_0x3ac517['agent']&&_0x3ac517[_0x7277('0x39')]['id']){try{if(_0x16f065[_0x7277('0x3a')][_0x3ac517['agent']['id']]){_0x16f065['agents'][_0x3ac517[_0x7277('0x39')]['id']]['busy']=![];_0x16f065['agents'][_0x3ac517[_0x7277('0x39')]['id']][_0x7277('0x42')]=undefined;}return _0x6a008({'code':0xc8,'message':_0x3ac517});}catch(_0x41b0e2){logger[_0x7277('0x37')](_0x41b0e2[_0x7277('0x36')]);return _0x199154(_0x5895a1[_0x7277('0x37')](0x1f4,_0x41b0e2));}}logger[_0x7277('0x37')](_0x7277('0x41'));return _0x199154(_0x5895a1['error'](0x1f4,_0x7277('0x41')));});},'AbandonInteraction':function(_0x22934b){var _0x5ade99=this;return new Promise(function(_0x8c5c71,_0x2f120c){if(_0x22934b[_0x7277('0x14')]&&_0x22934b[_0x7277('0x16')]&&_0x22934b[_0x7277('0x16')]['id']){try{var _0xa4a958=getId(_0x22934b[_0x7277('0x14')],_0x22934b[_0x7277('0x15')]?_0x22934b[_0x7277('0x15')]['id']:0x0,_0x22934b['interaction']?_0x22934b[_0x7277('0x16')]['id']:0x0);if(_0x16f065['rules'][_0xa4a958]){_0x16f065[_0x7277('0x13')][_0xa4a958][_0x7277('0x33')]('end');}return _0x8c5c71({'code':0xc8,'message':_0x22934b});}catch(_0x3ed671){logger['error'](_0x3ed671[_0x7277('0x36')]);return _0x2f120c(_0x5ade99[_0x7277('0x37')](0x1f4,_0x3ed671));}}logger[_0x7277('0x37')]('message\x20is\x20empty');return _0x2f120c(_0x5ade99[_0x7277('0x37')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x74ea58){var _0x4941be=this;return new Promise(function(_0x449f36,_0x34f6f5){if(_0x16f065[_0x7277('0x3a')][_0x7277('0x43')](_0x74ea58['id'])){for(var _0x2d79ea in _0x74ea58[_0x7277('0x44')]){if(_0x74ea58[_0x7277('0x44')][_0x7277('0x43')](_0x2d79ea)){if(_0x16f065[_0x7277('0x3a')][_0x74ea58['id']][_0x7277('0x43')](_0x2d79ea+_0x7277('0x45'))){_0x16f065[_0x7277('0x3a')][_0x74ea58['id']][_0x2d79ea+_0x7277('0x45')]=parseInt(_0x74ea58[_0x7277('0x44')][_0x2d79ea],0xa);}}}_0x16f065[_0x7277('0x3a')][_0x74ea58['id']][_0x7277('0x46')]();return _0x449f36({'code':0xc8,'message':_0x16f065[_0x7277('0x3a')][_0x74ea58['id']]});}else{return _0x34f6f5(_0x4941be[_0x7277('0x37')](0x1f4,_0x7277('0x47')));}});},'Agents':function(_0xcf78e0){return new Promise(function(_0x165257,_0xbc54b2){var _0x55ab07=_['values'](_0x16f065['agents']);_0x165257({'count':_0x55ab07[_0x7277('0x19')],'rows':_0x55ab07});});},'ChatQueues':function(_0x302516){return new Promise(function(_0x17aad2,_0x4ba09c){var _0x5046ae=[];for(var _0x1f33ad in _0x16f065[_0x7277('0x48')]){if(_0x16f065[_0x7277('0x48')][_0x7277('0x43')](_0x1f33ad)){var _0x399e98=_0x16f065[_0x7277('0x48')][_0x1f33ad];var _0x456f36={'id':_0x399e98['id'],'available':_0x399e98[_0x7277('0x49')],'loggedIn':_0x399e98[_0x7277('0x4a')],'name':_0x399e98[_0x7277('0x4b')],'paused':_0x399e98['paused'],'waiting':_0x399e98[_0x7277('0x4c')]};_0x5046ae['push'](_0x456f36);}}_0x17aad2({'count':_0x5046ae[_0x7277('0x19')],'rows':_0x5046ae});});},'MailQueues':function(_0x1a7210){return new Promise(function(_0xeb503a,_0x3199b5){var _0x53973d=[];for(var _0x5de477 in _0x16f065['mailQueues']){if(_0x16f065[_0x7277('0x4d')][_0x7277('0x43')](_0x5de477)){var _0x332300=_0x16f065['mailQueues'][_0x5de477];var _0x3ef0e3={'id':_0x332300['id'],'available':_0x332300[_0x7277('0x49')],'loggedIn':_0x332300['loggedIn'],'name':_0x332300['name'],'paused':_0x332300[_0x7277('0x4e')],'waiting':_0x332300[_0x7277('0x4c')]};_0x53973d[_0x7277('0x21')](_0x3ef0e3);}}_0xeb503a({'count':_0x53973d[_0x7277('0x19')],'rows':_0x53973d});});},'OpenchannelQueues':function(_0x4be7d3){return new Promise(function(_0x437cfd,_0x321124){var _0x215d38=[];for(var _0x25bd52 in _0x16f065[_0x7277('0x4f')]){if(_0x16f065[_0x7277('0x4f')][_0x7277('0x43')](_0x25bd52)){var _0x5ed24e=_0x16f065['openchannelQueues'][_0x25bd52];var _0x45faa0={'id':_0x5ed24e['id'],'available':_0x5ed24e['available'],'loggedIn':_0x5ed24e['loggedIn'],'name':_0x5ed24e['name'],'paused':_0x5ed24e[_0x7277('0x4e')],'waiting':_0x5ed24e['waiting']};_0x215d38['push'](_0x45faa0);}}_0x437cfd({'count':_0x215d38['length'],'rows':_0x215d38});});},'SmsQueues':function(_0x2e0115){return new Promise(function(_0x37e4e8,_0x4cebcc){var _0xf0b1f6=[];for(var _0x45a12b in _0x16f065[_0x7277('0x50')]){if(_0x16f065[_0x7277('0x50')][_0x7277('0x43')](_0x45a12b)){var _0x5bd34c=_0x16f065[_0x7277('0x50')][_0x45a12b];var _0x1acb9e={'id':_0x5bd34c['id'],'available':_0x5bd34c[_0x7277('0x49')],'loggedIn':_0x5bd34c[_0x7277('0x4a')],'name':_0x5bd34c[_0x7277('0x4b')],'paused':_0x5bd34c[_0x7277('0x4e')],'waiting':_0x5bd34c[_0x7277('0x4c')]};_0xf0b1f6[_0x7277('0x21')](_0x1acb9e);}}_0x37e4e8({'count':_0xf0b1f6[_0x7277('0x19')],'rows':_0xf0b1f6});});},'FaxQueues':function(_0x1df681){return new Promise(function(_0x49e36c,_0x183770){var _0x3b8de7=[];for(var _0x22c30e in _0x16f065['faxQueues']){if(_0x16f065['faxQueues'][_0x7277('0x43')](_0x22c30e)){var _0x2bf464=_0x16f065['faxQueues'][_0x22c30e];var _0x41148b={'id':_0x2bf464['id'],'available':_0x2bf464[_0x7277('0x49')],'loggedIn':_0x2bf464[_0x7277('0x4a')],'name':_0x2bf464[_0x7277('0x4b')],'paused':_0x2bf464[_0x7277('0x4e')],'waiting':_0x2bf464[_0x7277('0x4c')]};_0x3b8de7[_0x7277('0x21')](_0x41148b);}}_0x49e36c({'count':_0x3b8de7[_0x7277('0x19')],'rows':_0x3b8de7});});},'WhatsappQueues':function(_0xfa55e7){return new Promise(function(_0x16d510,_0x453461){var _0x2e27e8=[];for(var _0x4486d6 in _0x16f065[_0x7277('0x51')]){if(_0x16f065[_0x7277('0x51')]['hasOwnProperty'](_0x4486d6)){var _0x1b6779=_0x16f065[_0x7277('0x51')][_0x4486d6];var _0x3a1108={'id':_0x1b6779['id'],'available':_0x1b6779['available'],'loggedIn':_0x1b6779['loggedIn'],'name':_0x1b6779[_0x7277('0x4b')],'paused':_0x1b6779[_0x7277('0x4e')],'waiting':_0x1b6779[_0x7277('0x4c')]};_0x2e27e8['push'](_0x3a1108);}}_0x16d510({'count':_0x2e27e8[_0x7277('0x19')],'rows':_0x2e27e8});});},'ChatQueuesWaitingInteractions':function(_0x114777){return new Promise(function(_0x3e1d35,_0xcaa2ef){var _0x5b0b8c=_[_0x7277('0x52')](_0x16f065[_0x7277('0x53')]);_0x3e1d35({'count':_0x5b0b8c['length'],'rows':_0x5b0b8c});});},'MailQueuesWaitingInteractions':function(_0x242565){return new Promise(function(_0x3be2b9,_0x1d8cbb){var _0x46a809=_[_0x7277('0x52')](_0x16f065[_0x7277('0x54')]);_0x3be2b9({'count':_0x46a809[_0x7277('0x19')],'rows':_0x46a809});});},'OpenchannelQueuesWaitingInteractions':function(_0x3c1e7b){return new Promise(function(_0x5804d9,_0x26b1dd){var _0x24ca41=_[_0x7277('0x52')](_0x16f065[_0x7277('0x55')]);_0x5804d9({'count':_0x24ca41[_0x7277('0x19')],'rows':_0x24ca41});});},'SmsQueuesWaitingInteractions':function(_0x23ce09){return new Promise(function(_0x31f70e,_0x34cee5){var _0x38443e=_['values'](_0x16f065[_0x7277('0x56')]);_0x31f70e({'count':_0x38443e[_0x7277('0x19')],'rows':_0x38443e});});},'FaxQueuesWaitingInteractions':function(_0x1949a8){return new Promise(function(_0x534d75,_0x290043){var _0x4e3e19=_[_0x7277('0x52')](_0x16f065[_0x7277('0x57')]);_0x534d75({'count':_0x4e3e19['length'],'rows':_0x4e3e19});});},'WhatsappQueuesWaitingInteractions':function(_0x1f27b1){return new Promise(function(_0x199b36,_0x2ac1b1){var _0x4c6d66=_[_0x7277('0x52')](_0x16f065[_0x7277('0x58')]);_0x199b36({'count':_0x4c6d66[_0x7277('0x19')],'rows':_0x4c6d66});});}};var _0x54de05=jayson[_0x7277('0x59')](_0x17beef)[_0x7277('0x5a')]();_0x54de05['on']('error',function(_0x18781a){logger[_0x7277('0x37')](JSON[_0x7277('0x31')](_0x18781a));return _0x3e2597(_0x18781a);});_0x54de05[_0x7277('0x5b')](0x232c,'127.0.0.1',function(){console[_0x7277('0x5c')](_0x7277('0x5d'),0x232c);return _0x195abf(_0x7277('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 d268134..f5dd753 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 _0x3a10=['message','result','catch','condition','rules','info','stop','push','Command','iftime\x20%s','then','indexOf','[%s][INTERVAL]\x20%s\x20%s','when','log','join','\x20|\x20','stack','util','jayson/promise','lodash','client','request','error'];(function(_0x96f54d,_0x5e5d21){var _0xdb885c=function(_0x35225c){while(--_0x35225c){_0x96f54d['push'](_0x96f54d['shift']());}};_0xdb885c(++_0x5e5d21);}(_0x3a10,0x132));var _0x03a1=function(_0x53a694,_0x17acf5){_0x53a694=_0x53a694-0x0;var _0x253a39=_0x3a10[_0x53a694];return _0x253a39;};'use strict';var util=require(_0x03a1('0x0'));var BPromise=require('bluebird');var jayson=require(_0x03a1('0x1'));var _=require(_0x03a1('0x2'));var logger=require('../../../config/logger')('routing');var client=jayson[_0x03a1('0x3')]['http']({'port':0x232a});function request(_0x496944,_0x40a4b0){return new BPromise(function(_0x5af8fa,_0x25bff1){return client[_0x03a1('0x4')](_0x496944,_0x40a4b0)['then'](function(_0x29c59b){if(_0x29c59b[_0x03a1('0x5')]){return _0x25bff1(_0x29c59b['error'][_0x03a1('0x6')]);}else{return _0x5af8fa(_0x29c59b[_0x03a1('0x7')]);}})[_0x03a1('0x8')](function(_0x3018cd){return _0x25bff1(_0x3018cd);});});}exports[_0x03a1('0x9')]=function(_0x1f5b21,_0x2b2b5f,_0x42d91a){return function(_0x451c87){if(_0x42d91a['rules']&&!_0x42d91a[_0x03a1('0xa')][_0x1f5b21]){logger[_0x03a1('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1f5b21);return _0x451c87[_0x03a1('0xc')]();}var _0x1ec720=[];for(var _0x58c93d=0x0;_0x58c93d<_0x2b2b5f['length'];_0x58c93d+=0x1){_0x1ec720[_0x03a1('0xd')](request(_0x03a1('0xe'),{'command':util['format'](_0x03a1('0xf'),_0x2b2b5f[_0x58c93d])})[_0x03a1('0x10')](function(_0x3991d9){return _0x3991d9&&_0x3991d9[_0x03a1('0x6')]&&_0x3991d9[_0x03a1('0x6')][_0x03a1('0x11')]('true')>=0x0?!![]:![];})[_0x03a1('0x8')](function(_0x346e6a){logger[_0x03a1('0x5')]('[%s][INTERVAL]\x20%s',_0x1f5b21,_0x2b2b5f[_0x58c93d]);}));}BPromise['all'](_0x1ec720)[_0x03a1('0x10')](function(_0xef1f84){var _0x52f3d2=_['some'](_0xef1f84);logger['info'](_0x03a1('0x12'),_0x1f5b21,_0x2b2b5f['join']('\x20|\x20'),_0x52f3d2);_0x451c87[_0x03a1('0x13')](_0x52f3d2);})[_0x03a1('0x8')](function(_0x122ba3){console[_0x03a1('0x14')](_0x122ba3);logger[_0x03a1('0x5')](_0x03a1('0x12'),_0x1f5b21,_0x2b2b5f[_0x03a1('0x15')](_0x03a1('0x16')),_0x122ba3[_0x03a1('0x17')]);_0x451c87[_0x03a1('0xc')]();});};}; \ No newline at end of file +var _0x5bc1=['then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','jayson/promise','lodash','routing','http','request'];(function(_0x4e3db4,_0x160040){var _0xc4765d=function(_0x38c2c4){while(--_0x38c2c4){_0x4e3db4['push'](_0x4e3db4['shift']());}};_0xc4765d(++_0x160040);}(_0x5bc1,0x167));var _0x15bc=function(_0xa7c05d,_0x312374){_0xa7c05d=_0xa7c05d-0x0;var _0x47b002=_0x5bc1[_0xa7c05d];return _0x47b002;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x15bc('0x0'));var _=require(_0x15bc('0x1'));var logger=require('../../../config/logger')(_0x15bc('0x2'));var client=jayson['client'][_0x15bc('0x3')]({'port':0x232a});function request(_0x241fb1,_0x1c8df1){return new BPromise(function(_0x40ad5b,_0x192682){return client[_0x15bc('0x4')](_0x241fb1,_0x1c8df1)[_0x15bc('0x5')](function(_0x171456){if(_0x171456[_0x15bc('0x6')]){return _0x192682(_0x171456[_0x15bc('0x6')][_0x15bc('0x7')]);}else{return _0x40ad5b(_0x171456[_0x15bc('0x8')]);}})[_0x15bc('0x9')](function(_0x21a0e7){return _0x192682(_0x21a0e7);});});}exports[_0x15bc('0xa')]=function(_0x2056f7,_0x157122,_0x570490){return function(_0x36cac7){if(_0x570490[_0x15bc('0xb')]&&!_0x570490[_0x15bc('0xb')][_0x2056f7]){logger[_0x15bc('0xc')](_0x15bc('0xd'),_0x2056f7);return _0x36cac7[_0x15bc('0xe')]();}var _0x1a89e4=[];for(var _0x1d01e6=0x0;_0x1d01e6<_0x157122[_0x15bc('0xf')];_0x1d01e6+=0x1){_0x1a89e4[_0x15bc('0x10')](request('Command',{'command':util[_0x15bc('0x11')]('iftime\x20%s',_0x157122[_0x1d01e6])})['then'](function(_0x229d7d){return _0x229d7d&&_0x229d7d[_0x15bc('0x7')]&&_0x229d7d[_0x15bc('0x7')][_0x15bc('0x12')](_0x15bc('0x13'))>=0x0?!![]:![];})[_0x15bc('0x9')](function(_0x4dc79d){logger[_0x15bc('0x6')](_0x15bc('0x14'),_0x2056f7,_0x157122[_0x1d01e6]);}));}BPromise[_0x15bc('0x15')](_0x1a89e4)[_0x15bc('0x5')](function(_0xae5ae4){var _0x5e37d1=_['some'](_0xae5ae4);logger[_0x15bc('0xc')](_0x15bc('0x16'),_0x2056f7,_0x157122[_0x15bc('0x17')]('\x20|\x20'),_0x5e37d1);_0x36cac7[_0x15bc('0x18')](_0x5e37d1);})['catch'](function(_0x58efc5){console[_0x15bc('0x19')](_0x58efc5);logger[_0x15bc('0x6')](_0x15bc('0x16'),_0x2056f7,_0x157122[_0x15bc('0x17')](_0x15bc('0x1a')),_0x58efc5[_0x15bc('0x1b')]);_0x36cac7[_0x15bc('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 4638954..6bc77bb 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 _0xe1e3=['agentcompleteAt','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transferexten','transfereeuniqueid','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transferuniqueid','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','complete','lodash','util','format','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','agentcomplete','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','[%s][agents][agentcalled]','destuniqueid','now','called','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','debug','agentringnoanswer','agentringnoanswerAt','timeout','talktime','error','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime'];(function(_0x7fd2ec,_0x2bd533){var _0x260a30=function(_0x32899b){while(--_0x32899b){_0x7fd2ec['push'](_0x7fd2ec['shift']());}};_0x260a30(++_0x2bd533);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x4d44a0,_0x44d26f){_0x4d44a0=_0x4d44a0-0x0;var _0x37cee5=_0xe1e3[_0x4d44a0];return _0x37cee5;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0xdbdabb,_0x5e9f9a){utils['info'](util[_0x3e1e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xdbdabb[_0x3e1e('0x3')],_0xdbdabb[_0x3e1e('0x4')],_0xdbdabb[_0x3e1e('0x5')],_0xdbdabb[_0x3e1e('0x6')],_0xdbdabb[_0x3e1e('0x7')],_0xdbdabb[_0x3e1e('0x8')],_0xdbdabb['connectedlinenum'],_0xdbdabb[_0x3e1e('0x9')]));if(_0xdbdabb[_0x3e1e('0x5')]){utils[_0x3e1e('0xa')](_0xdbdabb[_0x3e1e('0x5')])[_0x3e1e('0xb')](function(_0x1e5173){if(_0x1e5173){_0xdbdabb['type']=_0x1e5173['type'];_0xdbdabb['agentacw']=_0xdbdabb[_0x3e1e('0xc')]?_0x1e5173['acw']:![];_0xdbdabb[_0x3e1e('0xd')]=_0xdbdabb[_0x3e1e('0xe')]?_0x1e5173[_0x3e1e('0xf')]:0x0;}utils['request'](_0x3e1e('0x10'),_0xdbdabb);});}else{utils['request']('CreateVoiceAgentReport',_0xdbdabb);}if(_0x5e9f9a){delete transfers[_0xdbdabb['uniqueid']];}else{delete agents[_0xdbdabb['destuniqueid']];}}exports['agentcalled']=function(_0x14ad58){try{utils['debug'](util['format'](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x14ad58);agents[_0x14ad58[_0x3e1e('0x12')]]=_0x14ad58;agents[_0x14ad58['destuniqueid']]['agentcalledAt']=utils[_0x3e1e('0x13')]();agents[_0x14ad58[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x14');agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinenum']=null;agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinename']=null;utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x16'),_0x14ad58[_0x3e1e('0x3')],agents[_0x14ad58[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x14ad58['destuniqueid']));}catch(_0x5dccb8){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x5dccb8);}};exports['agentringnoanswer']=function(_0x1c5acd){try{if(!_['isNil'](agents[_0x1c5acd[_0x3e1e('0x12')]])){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x1c5acd);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1c5acd['uniqueid'],agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x1c5acd['destuniqueid']));agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x18')]=!![];agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x9')]=_0x3e1e('0x1a');agents[_0x1c5acd['destuniqueid']]['reason']=_0x3e1e('0x1a');agents[_0x1c5acd[_0x3e1e('0x12')]]['holdtime']=_0x1c5acd['ringtime']?parseInt(_0x1c5acd['ringtime'])/0x3e8:0x0;agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=0x0;unanswered['push'](_0x1c5acd[_0x3e1e('0x12')]);}}catch(_0x5ac814){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x5ac814);}};exports[_0x3e1e('0x1d')]=function(_0x45ed0e){try{_['forIn'](agents,function(_0xdef39,_0x4ec149){if(_0xdef39['uniqueid']==_0x45ed0e['uniqueid']&&!_[_0x3e1e('0x1e')](unanswered,_0xdef39['destuniqueid'])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x45ed0e);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x45ed0e['uniqueid'],_0xdef39['membername'],_0xdef39['destuniqueid']));_0xdef39[_0x3e1e('0x18')]=!![];_0xdef39[_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();_0xdef39[_0x3e1e('0x9')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x21')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x22')]=_0x45ed0e['holdtime'];_0xdef39[_0x3e1e('0x1b')]=0x0;writeDB(_0xdef39);}});}catch(_0x348ef5){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x348ef5);}};exports[_0x3e1e('0x23')]=function(_0x55a082){try{if(agents[_0x55a082['destuniqueid']]){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentconnect]',_0x55a082[_0x3e1e('0x3')]),_0x55a082);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x24'),_0x55a082[_0x3e1e('0x3')],agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x55a082[_0x3e1e('0x12')]));agents[_0x55a082['destuniqueid']][_0x3e1e('0x25')]=utils[_0x3e1e('0x13')]();agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x26')]=_0x55a082['connectedlinenum'];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x27')]=_0x55a082[_0x3e1e('0x27')];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x22')]=_0x55a082[_0x3e1e('0x28')];agents[_0x55a082[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x29');_['forIn'](agents,function(_0x53bdf5,_0x4f598e){if(_0x53bdf5[_0x3e1e('0x12')]!=_0x55a082[_0x3e1e('0x12')]&&_0x53bdf5['uniqueid']==_0x55a082[_0x3e1e('0x3')]){_0x53bdf5[_0x3e1e('0x1b')]=0x0;_0x53bdf5['holdtime']=_0x55a082[_0x3e1e('0x28')];_0x53bdf5[_0x3e1e('0x18')]=!![];_0x53bdf5['agentringnoanswerAt']=utils['now']();_0x53bdf5[_0x3e1e('0x9')]='answered_elsewhere';_0x53bdf5['reason']=_0x3e1e('0x2a');_0x53bdf5[_0x3e1e('0x2b')]=_0x55a082[_0x3e1e('0x12')];_0x53bdf5[_0x3e1e('0x2c')]=_0x55a082[_0x3e1e('0x6')];writeDB(_0x53bdf5);}});}}catch(_0x55ea1d){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x2d'),_0x55a082[_0x3e1e('0x3')]),_0x55ea1d);}};exports['agentcomplete']=function(_0x1124d0){try{if(!_[_0x3e1e('0x2e')](agents[_0x1124d0[_0x3e1e('0x12')]])){utils['debug'](util[_0x3e1e('0x2')]('[%s][agents][agentcomplete]',_0x1124d0['uniqueid']),_0x1124d0);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x2f'),_0x1124d0[_0x3e1e('0x3')],agents[_0x1124d0['destuniqueid']]['membername'],_0x1124d0['destuniqueid']));agents[_0x1124d0['destuniqueid']][_0x3e1e('0xc')]=!![];agents[_0x1124d0[_0x3e1e('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](agents[_0x1124d0['destuniqueid']][_0x3e1e('0x31')],agents[_0x1124d0['destuniqueid']][_0x3e1e('0x25')]);agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x21')]=_0x1124d0[_0x3e1e('0x21')];agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x9')]='complete';writeDB(agents[_0x1124d0[_0x3e1e('0x12')]]);}}catch(_0x1ce1cd){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x32'),_0x1124d0['uniqueid']),_0x1ce1cd);}};exports[_0x3e1e('0x33')]=function(_0x347b3f){try{if(!_[_0x3e1e('0x2e')](agents[_0x347b3f[_0x3e1e('0x34')]])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x35'),_0x347b3f[_0x3e1e('0x3')]),_0x347b3f);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x36'),_0x347b3f[_0x3e1e('0x3')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x6')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x3')]));agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x37')]=!![];agents[_0x347b3f['transfereruniqueid']][_0x3e1e('0x38')]='blind';agents[_0x347b3f['transfereruniqueid']]['transferexten']=_0x347b3f[_0x3e1e('0x39')];agents[_0x347b3f[_0x3e1e('0x34')]]['transferuniqueid']=agents[_0x347b3f[_0x3e1e('0x34')]]['uniqueid'];}}catch(_0x5b2416){utils[_0x3e1e('0x1c')](util['format']('[%s][agents][blindtransfer]',_0x347b3f['uniqueid']),_0x5b2416);}};exports[_0x3e1e('0x3a')]=function(_0xe577b2){try{utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0xe577b2);if(_0xe577b2[_0x3e1e('0x3c')]==_0xe577b2['origtransfererlinkedid']){if(!_[_0x3e1e('0x2e')](agents[_0xe577b2['secondtransfereruniqueid']])){utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2['secondtransfereruniqueid']][_0x3e1e('0x6')]));agents[_0xe577b2[_0x3e1e('0x3e')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3e')]]['transfertype']='ATTENDED';agents[_0xe577b2[_0x3e1e('0x3e')]][_0x3e1e('0x3f')]=_0xe577b2['origtransfererexten'];agents[_0xe577b2[_0x3e1e('0x3e')]]['transferuniqueid']=_0xe577b2['origtransfereruniqueid'];}if(_0xe577b2[_0x3e1e('0x40')]&&agents[_0xe577b2['transfereeuniqueid']]){agents[_0xe577b2[_0x3e1e('0x40')]]['agententerreason']=0x1;transfers[_0xe577b2[_0x3e1e('0x40')]]=_['clone'](agents[_0xe577b2[_0x3e1e('0x40')]]);transfers[_0xe577b2[_0x3e1e('0x40')]]['calleridnum']=agents[_0xe577b2['secondtransfereruniqueid']]['calleridnum'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3e')]]['calleridname'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x43')]=0x2;}}else if(_0xe577b2['secondtransfereruniqueid']==_0xe577b2[_0x3e1e('0x44')]){if(!_['isNil'](agents[_0xe577b2[_0x3e1e('0x3c')]])){utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2[_0x3e1e('0x3c')]]['membername']));agents[_0xe577b2[_0x3e1e('0x3c')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x38')]=_0x3e1e('0x45');agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x3f')]=_0xe577b2[_0x3e1e('0x46')];agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x47')]=_0xe577b2['secondtransfereruniqueid'];}if(_0xe577b2['transfertargetuniqueid']&&agents[_0xe577b2['transfertargetuniqueid']]){agents[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x1;transfers[_0xe577b2[_0x3e1e('0x48')]]=_[_0x3e1e('0x49')](agents[_0xe577b2[_0x3e1e('0x48')]]);transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x8')]=agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x8')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x41')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfertargetuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x2;}}}catch(_0x2e950d){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0x2e950d);}};exports[_0x3e1e('0x4a')]=function(_0x50ba57){try{utils['debug'](util['format'](_0x3e1e('0x4b'),_0x50ba57[_0x3e1e('0x3')]),_0x50ba57);if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]==='timeout'){if(_0x50ba57[_0x3e1e('0x4c')]==='21'){agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]=_0x3e1e('0x4d');agents[_0x50ba57[_0x3e1e('0x3')]]['lastevent']=_0x3e1e('0x4d');}utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57[_0x3e1e('0x3')]]['membername'],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x9')]));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);var _0x372581=unanswered['indexOf'](_0x50ba57[_0x3e1e('0x3')]);if(_0x372581>-0x1){unanswered[_0x3e1e('0x4f')](_0x372581,0x1);}}if(transfers[_0x50ba57[_0x3e1e('0x3')]]){transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0xc')]=!![];transfers[_0x50ba57[_0x3e1e('0x3')]]['agentcompleteAt']=utils[_0x3e1e('0x13')]();transfers[_0x50ba57['uniqueid']][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](transfers[_0x50ba57['uniqueid']][_0x3e1e('0x31')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]);transfers[_0x50ba57[_0x3e1e('0x3')]]['reason']=_0x3e1e('0x50');transfers[_0x50ba57['uniqueid']][_0x3e1e('0x9')]=_0x3e1e('0x51');utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],transfers[_0x50ba57['uniqueid']][_0x3e1e('0x6')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],transfers[_0x50ba57[_0x3e1e('0x3')]]['lastevent']));writeDB(transfers[_0x50ba57[_0x3e1e('0x3')]],!![]);}if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]){agents[_0x50ba57['uniqueid']][_0x3e1e('0xc')]=!![];agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x31')]=utils[_0x3e1e('0x13')]();agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x1b')]=utils['diffTime'](agents[_0x50ba57['uniqueid']]['agentcompleteAt'],agents[_0x50ba57[_0x3e1e('0x3')]]['agentconnectAt']);agents[_0x50ba57[_0x3e1e('0x3')]]['reason']=agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x37')]?_0x3e1e('0x37'):_0x3e1e('0x50');agents[_0x50ba57['uniqueid']][_0x3e1e('0x9')]='complete';utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57['uniqueid']][_0x3e1e('0x6')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57['uniqueid']]['lastevent']));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);}}catch(_0x20bb6d){utils[_0x3e1e('0x1c')](util['format'](_0x3e1e('0x4b'),_0x50ba57['uniqueid']),_0x20bb6d);}}; \ No newline at end of file +var _0x3f8c=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','./utils','info','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','splice','agent'];(function(_0x21be11,_0x335981){var _0x2ddd60=function(_0x5e2db9){while(--_0x5e2db9){_0x21be11['push'](_0x21be11['shift']());}};_0x2ddd60(++_0x335981);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4a8418,_0x2a9428){_0x4a8418=_0x4a8418-0x0;var _0xe271c2=_0x3f8c[_0x4a8418];return _0xe271c2;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xc3f8('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3a1f6a,_0x2e70c4){utils[_0xc3f8('0x1')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3a1f6a['uniqueid'],_0x3a1f6a['channel'],_0x3a1f6a['queue'],_0x3a1f6a[_0xc3f8('0x2')],_0x3a1f6a[_0xc3f8('0x3')],_0x3a1f6a[_0xc3f8('0x4')],_0x3a1f6a[_0xc3f8('0x5')],_0x3a1f6a[_0xc3f8('0x6')]));if(_0x3a1f6a[_0xc3f8('0x7')]){utils['getVoiceQueueByName'](_0x3a1f6a[_0xc3f8('0x7')])[_0xc3f8('0x8')](function(_0x15cb3b){if(_0x15cb3b){_0x3a1f6a[_0xc3f8('0x9')]=_0x15cb3b[_0xc3f8('0x9')];_0x3a1f6a[_0xc3f8('0xa')]=_0x3a1f6a[_0xc3f8('0xb')]?_0x15cb3b['acw']:![];_0x3a1f6a[_0xc3f8('0xc')]=_0x3a1f6a[_0xc3f8('0xa')]?_0x15cb3b[_0xc3f8('0xd')]:0x0;}utils[_0xc3f8('0xe')]('CreateVoiceAgentReport',_0x3a1f6a);});}else{utils[_0xc3f8('0xe')](_0xc3f8('0xf'),_0x3a1f6a);}if(_0x2e70c4){delete transfers[_0x3a1f6a[_0xc3f8('0x10')]];}else{delete agents[_0x3a1f6a[_0xc3f8('0x11')]];}}exports['agentcalled']=function(_0x84f489){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x14'),_0x84f489[_0xc3f8('0x10')]),_0x84f489);agents[_0x84f489[_0xc3f8('0x11')]]=_0x84f489;agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x17');agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinenum']=null;agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinename']=null;utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x18'),_0x84f489[_0xc3f8('0x10')],agents[_0x84f489[_0xc3f8('0x11')]]['membername'],_0x84f489[_0xc3f8('0x11')]));}catch(_0x1db809){utils['error'](util[_0xc3f8('0x13')]('[%s][agents][agentcalled]',_0x84f489[_0xc3f8('0x10')]),_0x1db809);}};exports[_0xc3f8('0x19')]=function(_0x3b2e98){try{if(!_['isNil'](agents[_0x3b2e98['destuniqueid']])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98[_0xc3f8('0x10')]),_0x3b2e98);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x1b'),_0x3b2e98[_0xc3f8('0x10')],agents[_0x3b2e98['destuniqueid']]['membername'],_0x3b2e98['destuniqueid']));agents[_0x3b2e98[_0xc3f8('0x11')]]['agentringnoanswer']=!![];agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1c')]=utils['now']();agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1f')]=_0x3b2e98[_0xc3f8('0x20')]?parseInt(_0x3b2e98[_0xc3f8('0x20')])/0x3e8:0x0;agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x21')]=0x0;unanswered[_0xc3f8('0x22')](_0x3b2e98[_0xc3f8('0x11')]);}}catch(_0x59e4dd){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98['uniqueid']),_0x59e4dd);}};exports[_0xc3f8('0x24')]=function(_0x4d39a0){try{_[_0xc3f8('0x25')](agents,function(_0x32343e,_0x47ab53){if(_0x32343e['uniqueid']==_0x4d39a0[_0xc3f8('0x10')]&&!_[_0xc3f8('0x26')](unanswered,_0x32343e[_0xc3f8('0x11')])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0[_0xc3f8('0x10')]),_0x4d39a0);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x28'),_0x4d39a0['uniqueid'],_0x32343e[_0xc3f8('0x2')],_0x32343e[_0xc3f8('0x11')]));_0x32343e[_0xc3f8('0x19')]=!![];_0x32343e[_0xc3f8('0x1c')]=utils[_0xc3f8('0x16')]();_0x32343e['lastevent']='abandoned';_0x32343e[_0xc3f8('0x1e')]=_0xc3f8('0x29');_0x32343e[_0xc3f8('0x1f')]=_0x4d39a0[_0xc3f8('0x1f')];_0x32343e[_0xc3f8('0x21')]=0x0;writeDB(_0x32343e);}});}catch(_0x4e51ac){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0['uniqueid']),_0x4e51ac);}};exports[_0xc3f8('0x2a')]=function(_0x11ecc2){try{if(agents[_0x11ecc2[_0xc3f8('0x11')]]){utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x11ecc2);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x2c'),_0x11ecc2[_0xc3f8('0x10')],agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x11ecc2['destuniqueid']));agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x5')]=_0x11ecc2['connectedlinenum'];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2e')]=_0x11ecc2[_0xc3f8('0x2e')];agents[_0x11ecc2['destuniqueid']][_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x6')]='connect';_[_0xc3f8('0x25')](agents,function(_0x45d416,_0x2df096){if(_0x45d416[_0xc3f8('0x11')]!=_0x11ecc2['destuniqueid']&&_0x45d416[_0xc3f8('0x10')]==_0x11ecc2['uniqueid']){_0x45d416['talktime']=0x0;_0x45d416[_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];_0x45d416[_0xc3f8('0x19')]=!![];_0x45d416[_0xc3f8('0x1c')]=utils['now']();_0x45d416['lastevent']=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x1e')]=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x30')]=_0x11ecc2[_0xc3f8('0x11')];_0x45d416[_0xc3f8('0x31')]=_0x11ecc2[_0xc3f8('0x2')];writeDB(_0x45d416);}});}}catch(_0x45e6ea){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x45e6ea);}};exports[_0xc3f8('0xb')]=function(_0x22e9b3){try{if(!_['isNil'](agents[_0x22e9b3[_0xc3f8('0x11')]])){utils[_0xc3f8('0x12')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0x22e9b3);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x33'),_0x22e9b3[_0xc3f8('0x10')],agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x22e9b3[_0xc3f8('0x11')]));agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0xb')]=!![];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x34')],agents[_0x22e9b3['destuniqueid']]['agentconnectAt']);agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0x22e9b3[_0xc3f8('0x1e')];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x36');writeDB(agents[_0x22e9b3[_0xc3f8('0x11')]]);}}catch(_0xe3d5c4){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0xe3d5c4);}};exports['blindtransfer']=function(_0x1becae){try{if(!_[_0xc3f8('0x37')](agents[_0x1becae[_0xc3f8('0x38')]])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae[_0xc3f8('0x10')]),_0x1becae);utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x3a'),_0x1becae['uniqueid'],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x2')],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')]));agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3b')]=!![];agents[_0x1becae[_0xc3f8('0x38')]]['transfertype']=_0xc3f8('0x3c');agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3d')]=_0x1becae[_0xc3f8('0x3e')];agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3f')]=agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')];}}catch(_0x4fc02c){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae['uniqueid']),_0x4fc02c);}};exports['attendedtransfer']=function(_0x773d56){try{utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x773d56);if(_0x773d56['origtransfereruniqueid']==_0x773d56[_0xc3f8('0x42')]){if(!_['isNil'](agents[_0x773d56['secondtransfereruniqueid']])){utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x44')]]['membername']));agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56['secondtransfereruniqueid']]['transferexten']=_0x773d56[_0xc3f8('0x47')];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3f')]=_0x773d56[_0xc3f8('0x41')];}if(_0x773d56[_0xc3f8('0x48')]&&agents[_0x773d56['transfereeuniqueid']]){agents[_0x773d56[_0xc3f8('0x48')]]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x48')]]=_[_0xc3f8('0x49')](agents[_0x773d56[_0xc3f8('0x48')]]);transfers[_0x773d56[_0xc3f8('0x48')]]['calleridnum']=agents[_0x773d56[_0xc3f8('0x44')]]['calleridnum'];transfers[_0x773d56['transfereeuniqueid']]['calleridname']=agents[_0x773d56['secondtransfereruniqueid']][_0xc3f8('0x4a')];transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x4b')]=0x2;}}else if(_0x773d56[_0xc3f8('0x44')]==_0x773d56[_0xc3f8('0x4c')]){if(!_[_0xc3f8('0x37')](agents[_0x773d56['origtransfereruniqueid']])){utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x41')]]['membername']));agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56[_0xc3f8('0x41')]]['transferexten']=_0x773d56[_0xc3f8('0x4d')];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3f')]=_0x773d56['secondtransfereruniqueid'];}if(_0x773d56[_0xc3f8('0x4e')]&&agents[_0x773d56[_0xc3f8('0x4e')]]){agents[_0x773d56['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x4e')]]=_[_0xc3f8('0x49')](agents[_0x773d56['transfertargetuniqueid']]);transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4')];transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4a')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4a')];transfers[_0x773d56['transfertargetuniqueid']]['agentcalledAt']=utils[_0xc3f8('0x16')]();transfers[_0x773d56['transfertargetuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x773d56['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4b')]=0x2;}}}catch(_0x188d39){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x188d39);}};exports['hangup']=function(_0x3b9b47){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')]('[%s][agents][hangup]',_0x3b9b47[_0xc3f8('0x10')]),_0x3b9b47);if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47['uniqueid']]['reason']===_0xc3f8('0x1d')){if(_0x3b9b47[_0xc3f8('0x4f')]==='21'){agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')]=_0xc3f8('0x50');agents[_0x3b9b47['uniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x50');}utils['info'](util[_0xc3f8('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47[_0xc3f8('0x10')]]['membername'],agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],agents[_0x3b9b47[_0xc3f8('0x10')]]['lastevent']));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);var _0x5de19e=unanswered[_0xc3f8('0x51')](_0x3b9b47['uniqueid']);if(_0x5de19e>-0x1){unanswered[_0xc3f8('0x52')](_0x5de19e,0x1);}}if(transfers[_0x3b9b47[_0xc3f8('0x10')]]){transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0xb')]=!![];transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x21')]=utils['diffTime'](transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]);transfers[_0x3b9b47[_0xc3f8('0x10')]]['reason']=_0xc3f8('0x53');transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],transfers[_0x3b9b47[_0xc3f8('0x10')]]['membername'],transfers[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(transfers[_0x3b9b47[_0xc3f8('0x10')]],!![]);}if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]){agents[_0x3b9b47[_0xc3f8('0x10')]]['agentcomplete']=!![];agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils['now']();agents[_0x3b9b47['uniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x3b9b47['uniqueid']][_0xc3f8('0x34')],agents[_0x3b9b47[_0xc3f8('0x10')]]['agentconnectAt']);agents[_0x3b9b47[_0xc3f8('0x10')]]['reason']=agents[_0x3b9b47[_0xc3f8('0x10')]]['transfer']?_0xc3f8('0x3b'):_0xc3f8('0x53');agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47['uniqueid']]['membername'],agents[_0x3b9b47[_0xc3f8('0x10')]]['reason'],agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);}}catch(_0xfb05eb){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x55'),_0x3b9b47[_0xc3f8('0x10')]),_0xfb05eb);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 0969555..ff94ee2 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 _0x0b19=['request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','musiconholdstartAt','[%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','value','source','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','cdr','split','lastIndexOf','includes','noop','execif','lastdata','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId'];(function(_0x2cb09d,_0x2d817e){var _0x6f08e=function(_0x110550){while(--_0x110550){_0x2cb09d['push'](_0x2cb09d['shift']());}};_0x6f08e(++_0x2d817e);}(_0x0b19,0x137));var _0x90b1=function(_0x5b2809,_0x48b226){_0x5b2809=_0x5b2809-0x0;var _0x572dee=_0x0b19[_0x5b2809];return _0x572dee;};'use strict';var _=require('lodash');var util=require(_0x90b1('0x0'));var utils=require(_0x90b1('0x1'));var transfers=require('./transfers.controller');var dispositions=[_0x90b1('0x2'),_0x90b1('0x3'),_0x90b1('0x3'),_0x90b1('0x2'),_0x90b1('0x2'),'NO\x20ANSWER',_0x90b1('0x4'),_0x90b1('0x5'),_0x90b1('0x3'),_0x90b1('0x3'),'FAILED'];var channels={};function writeDB(_0x16ef4d){var _0x541562;if(transfers[_0x90b1('0x6')][_0x16ef4d[_0x90b1('0x7')]]){_0x541562=_0x16ef4d[_0x90b1('0x7')];_0x16ef4d[_0x90b1('0x7')]=transfers['blinds'][_0x16ef4d[_0x90b1('0x7')]][_0x90b1('0x8')];}utils[_0x90b1('0x9')](util[_0x90b1('0xa')](_0x90b1('0xb'),_0x16ef4d['uniqueid'],_0x16ef4d[_0x90b1('0xc')],_0x16ef4d[_0x90b1('0xd')],_0x16ef4d[_0x90b1('0xe')],_0x16ef4d[_0x90b1('0xf')],_0x16ef4d[_0x90b1('0x10')],_0x16ef4d[_0x90b1('0x11')],_0x16ef4d['lastevent']));if(_0x16ef4d[_0x90b1('0x12')]){utils[_0x90b1('0x13')](_0x16ef4d[_0x90b1('0x12')])[_0x90b1('0x14')](function(_0x46c270){if(_0x46c270){_0x16ef4d[_0x90b1('0x15')]=_0x46c270['id'];}utils[_0x90b1('0x16')](_0x90b1('0x17'),_0x16ef4d);});}else{utils['request'](_0x90b1('0x17'),_0x16ef4d);}if(channels[_0x16ef4d[_0x90b1('0x7')]]){delete channels[_0x16ef4d[_0x90b1('0x7')]];}else if(_0x541562&&channels[_0x541562]){delete transfers[_0x90b1('0x6')][_0x541562];delete channels[_0x541562];}}exports[_0x90b1('0x18')]=function(_0x3aa12e){try{utils[_0x90b1('0x19')](util['format'](_0x90b1('0x1a'),_0x3aa12e[_0x90b1('0x7')]),_0x3aa12e);if(_0x3aa12e[_0x90b1('0x7')]==_0x3aa12e[_0x90b1('0x1b')]&&_0x3aa12e['channel']!=_0x90b1('0x1c')){utils['info'](util[_0x90b1('0xa')](_0x90b1('0x1d'),_0x3aa12e[_0x90b1('0x7')],_0x3aa12e[_0x90b1('0x1e')],_0x3aa12e[_0x90b1('0x1f')]));channels[_0x3aa12e[_0x90b1('0x7')]]={'uniqueid':_0x3aa12e[_0x90b1('0x7')],'accountcode':_0x3aa12e[_0x90b1('0x12')],'source':_0x3aa12e[_0x90b1('0x10')],'destination':_0x3aa12e['exten'],'destinationcontext':_0x3aa12e[_0x90b1('0x1e')],'channel':_0x3aa12e[_0x90b1('0xc')],'starttime':utils[_0x90b1('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x90b1('0x2'),'amaflags':_0x90b1('0x21')};}}catch(_0x3f3a23){utils[_0x90b1('0x22')](util['format']('[%s][calls][newchannel]',_0x3aa12e[_0x90b1('0x7')]),_0x3f3a23);}};exports[_0x90b1('0x23')]=function(_0x305158){try{utils[_0x90b1('0x19')](util['format'](_0x90b1('0x24'),_0x305158[_0x90b1('0x7')]),_0x305158);if(!_[_0x90b1('0x25')](channels[_0x305158['uniqueid']])&&_0x305158[_0x90b1('0x26')]==0x6){utils[_0x90b1('0x9')](util['format'](_0x90b1('0x27'),_0x305158['uniqueid'],_0x305158[_0x90b1('0x1e')],_0x305158[_0x90b1('0xc')]));if(_[_0x90b1('0x25')](channels[_0x305158[_0x90b1('0x7')]][_0x90b1('0x28')])){channels[_0x305158['uniqueid']]['systemanswertime']=utils[_0x90b1('0x20')]();}}else if(!_[_0x90b1('0x25')](channels[_0x305158['linkedid']])&&_0x305158[_0x90b1('0x26')]==0x6&&_0x305158[_0x90b1('0x1e')]!=_0x90b1('0x29')){utils[_0x90b1('0x9')](util[_0x90b1('0xa')](_0x90b1('0x2a'),_0x305158[_0x90b1('0x7')],_0x305158[_0x90b1('0x1b')],_0x305158[_0x90b1('0x1e')],_0x305158[_0x90b1('0xc')]));channels[_0x305158[_0x90b1('0x1b')]][_0x90b1('0x12')]=_0x305158[_0x90b1('0x12')];channels[_0x305158[_0x90b1('0x1b')]][_0x90b1('0x2b')]=_0x305158[_0x90b1('0xc')];if(_['isNil'](channels[_0x305158[_0x90b1('0x1b')]][_0x90b1('0x2c')])){channels[_0x305158[_0x90b1('0x1b')]][_0x90b1('0x2c')]=utils[_0x90b1('0x20')]();}channels[_0x305158[_0x90b1('0x1b')]][_0x90b1('0x2d')]=dispositions[_[_0x90b1('0x2e')](_0x305158[_0x90b1('0x26')])]||_0x90b1('0x4');}}catch(_0x1bd698){utils[_0x90b1('0x22')](util[_0x90b1('0xa')](_0x90b1('0x24'),_0x305158['uniqueid']),_0x1bd698);}};exports[_0x90b1('0x2f')]=function(_0x14bc0d){try{if(!_[_0x90b1('0x25')](channels[_0x14bc0d[_0x90b1('0x7')]])){utils['debug'](util[_0x90b1('0xa')](_0x90b1('0x30'),_0x14bc0d['uniqueid']),_0x14bc0d);if(_[_0x90b1('0x25')](channels[_0x14bc0d[_0x90b1('0x7')]][_0x90b1('0x31')])){channels[_0x14bc0d[_0x90b1('0x7')]]['callerid']=_0x14bc0d[_0x90b1('0x32')]+'\x20<'+_0x14bc0d[_0x90b1('0x10')]+'>';}utils[_0x90b1('0x9')](util[_0x90b1('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x14bc0d[_0x90b1('0x7')],channels[_0x14bc0d[_0x90b1('0x7')]][_0x90b1('0x31')],_0x14bc0d[_0x90b1('0x33')]));channels[_0x14bc0d[_0x90b1('0x7')]][_0x90b1('0x34')]=utils[_0x90b1('0x20')]();channels[_0x14bc0d[_0x90b1('0x7')]][_0x90b1('0x35')]=utils['diffTime'](channels[_0x14bc0d['uniqueid']][_0x90b1('0x34')],channels[_0x14bc0d['uniqueid']]['starttime']);channels[_0x14bc0d[_0x90b1('0x7')]]['billableseconds']=channels[_0x14bc0d[_0x90b1('0x7')]]['answertime']?utils[_0x90b1('0x36')](channels[_0x14bc0d[_0x90b1('0x7')]]['endtime'],channels[_0x14bc0d['uniqueid']][_0x90b1('0x2c')]):0x0;writeDB(channels[_0x14bc0d[_0x90b1('0x7')]]);}}catch(_0x414f92){utils['error'](util[_0x90b1('0xa')](_0x90b1('0x30'),_0x14bc0d[_0x90b1('0x7')]),_0x414f92);}};exports[_0x90b1('0x37')]=function(_0x11b790){try{if(!_[_0x90b1('0x25')](channels[_0x11b790[_0x90b1('0x38')]])){utils[_0x90b1('0x19')](util[_0x90b1('0xa')](_0x90b1('0x39'),_0x11b790[_0x90b1('0x3a')]),_0x11b790);if(channels[_0x11b790['localtwolinkedid']][_0x90b1('0xc')]==_0x11b790[_0x90b1('0x3b')]){utils[_0x90b1('0x9')](util['format'](_0x90b1('0x3c'),_0x11b790[_0x90b1('0x3a')],_0x11b790[_0x90b1('0x38')],_0x11b790[_0x90b1('0x3d')]));channels[_0x11b790[_0x90b1('0x38')]][_0x90b1('0x2b')]=_0x11b790[_0x90b1('0x3d')];channels[_0x11b790[_0x90b1('0x38')]]['userfield']=_0x90b1('0x3e');}else if(channels[_0x11b790[_0x90b1('0x38')]][_0x90b1('0xc')]=_0x11b790[_0x90b1('0x3f')]){utils[_0x90b1('0x9')](util[_0x90b1('0xa')](_0x90b1('0x3c'),_0x11b790['origtransfereruniqueid'],_0x11b790[_0x90b1('0x38')],_0x11b790[_0x90b1('0x40')]));channels[_0x11b790['localtwolinkedid']][_0x90b1('0x2b')]=_0x11b790['origtransfererchannel'];channels[_0x11b790[_0x90b1('0x38')]][_0x90b1('0x41')]='_attended';}}}catch(_0x453335){utils['error'](util['format']('[%s][calls][attendedtransfer]',_0x11b790[_0x90b1('0x3a')]),_0x453335);}};exports[_0x90b1('0x42')]=function(_0x342b38){try{if(!_[_0x90b1('0x25')](channels[_0x342b38[_0x90b1('0x7')]])){utils[_0x90b1('0x19')](util[_0x90b1('0xa')]('[%s][calls][musiconholdstart]',_0x342b38[_0x90b1('0x7')]),_0x342b38);channels[_0x342b38[_0x90b1('0x7')]]['musiconholdstartAt']=utils[_0x90b1('0x20')]();utils[_0x90b1('0x9')](util[_0x90b1('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x342b38['uniqueid'],channels[_0x342b38['uniqueid']][_0x90b1('0x43')]));}}catch(_0x4eb900){utils[_0x90b1('0x22')](util['format'](_0x90b1('0x44'),_0x342b38[_0x90b1('0x7')]),_0x4eb900);}};exports[_0x90b1('0x45')]=function(_0x123980){try{if(!_[_0x90b1('0x25')](channels[_0x123980['uniqueid']])){utils[_0x90b1('0x19')](util[_0x90b1('0xa')](_0x90b1('0x46'),_0x123980[_0x90b1('0x7')]),_0x123980);if(!_[_0x90b1('0x25')](channels[_0x123980[_0x90b1('0x7')]][_0x90b1('0x43')])){channels[_0x123980['uniqueid']][_0x90b1('0x47')]+=utils[_0x90b1('0x36')](utils[_0x90b1('0x20')](),channels[_0x123980[_0x90b1('0x7')]][_0x90b1('0x43')]);utils[_0x90b1('0x9')](util[_0x90b1('0xa')](_0x90b1('0x48'),_0x123980[_0x90b1('0x7')],channels[_0x123980[_0x90b1('0x7')]][_0x90b1('0x47')]));delete channels[_0x123980[_0x90b1('0x7')]][_0x90b1('0x43')];}}}catch(_0x311714){utils['error'](util[_0x90b1('0xa')](_0x90b1('0x46'),_0x123980[_0x90b1('0x7')]),_0x311714);}};exports[_0x90b1('0x49')]=function(_0x257182){try{if(!_['isNil'](channels[_0x257182[_0x90b1('0x7')]])){utils[_0x90b1('0x19')](util[_0x90b1('0xa')](_0x90b1('0x4a'),_0x257182['uniqueid']),_0x257182);if(!_[_0x90b1('0x25')](_0x257182['variable'][_0x90b1('0x4b')])){utils[_0x90b1('0x9')](util[_0x90b1('0xa')](_0x90b1('0x4c'),_0x257182[_0x90b1('0x7')],_0x257182[_0x90b1('0x4d')]));channels[_0x257182['uniqueid']][_0x90b1('0x4e')]=_0x257182['value'];}if(!_['isNil'](_0x257182['variable']['xmd-phone'])){utils['info'](util[_0x90b1('0xa')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x257182[_0x90b1('0x7')],_0x257182[_0x90b1('0x4d')]));channels[_0x257182[_0x90b1('0x7')]][_0x90b1('0x4f')]=_0x257182[_0x90b1('0x4d')];channels[_0x257182['uniqueid']][_0x90b1('0x31')]='\x22'+_0x257182['value']+_0x90b1('0x50')+_0x257182[_0x90b1('0x4d')]+'>';}if(!_[_0x90b1('0x25')](_0x257182[_0x90b1('0x51')][_0x90b1('0x52')])||!_['isNil'](_0x257182[_0x90b1('0x51')][_0x90b1('0x53')])){utils[_0x90b1('0x9')](util['format'](_0x90b1('0x54'),_0x257182['uniqueid'],!_[_0x90b1('0x25')](_0x257182['variable']['xmd-callerid-preview'])?'xmd-callerid-preview':_0x90b1('0x53'),_0x257182[_0x90b1('0x4d')]));channels[_0x257182['uniqueid']]['callerid']=_0x257182[_0x90b1('0x4d')];}if(!_[_0x90b1('0x25')](_0x257182[_0x90b1('0x51')][_0x90b1('0x55')])||!_[_0x90b1('0x25')](_0x257182['variable']['xmcs-queue'])){utils['info'](util[_0x90b1('0xa')](_0x90b1('0x54'),_0x257182[_0x90b1('0x7')],!_['isNil'](_0x257182[_0x90b1('0x51')]['xmd-queue'])?_0x90b1('0x55'):_0x90b1('0x56'),_0x257182[_0x90b1('0x4d')]));channels[_0x257182[_0x90b1('0x7')]][_0x90b1('0x57')]=_0x90b1('0x58');channels[_0x257182[_0x90b1('0x7')]]['lastdata']=_0x257182['value'];channels[_0x257182[_0x90b1('0x7')]][_0x90b1('0xd')]=!![];}if(!_['isNil'](_0x257182[_0x90b1('0x51')][_0x90b1('0x59')])){utils['info'](util[_0x90b1('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x257182['uniqueid'],_0x257182[_0x90b1('0x4d')]));channels[_0x257182[_0x90b1('0x7')]]['ContactId']=_0x257182['value'];}if(!_[_0x90b1('0x25')](_0x257182[_0x90b1('0x51')][_0x90b1('0x5a')])){utils['info'](util[_0x90b1('0xa')](_0x90b1('0x5b'),_0x257182[_0x90b1('0x7')],_0x257182[_0x90b1('0x4d')]));channels[_0x257182[_0x90b1('0x7')]][_0x90b1('0x5c')]=_0x257182[_0x90b1('0x4d')];}if(!_[_0x90b1('0x25')](_0x257182[_0x90b1('0x51')][_0x90b1('0x5d')])){utils[_0x90b1('0x9')](util[_0x90b1('0xa')](_0x90b1('0x5e'),_0x257182[_0x90b1('0x7')],_0x257182['value']));channels[_0x257182[_0x90b1('0x7')]][_0x90b1('0x5f')]=_0x257182[_0x90b1('0x4d')];}if(!_[_0x90b1('0x25')](_0x257182[_0x90b1('0x51')][_0x90b1('0x60')])){utils[_0x90b1('0x9')](util['format'](_0x90b1('0x61'),_0x257182['uniqueid'],_0x257182[_0x90b1('0x4d')]));channels[_0x257182[_0x90b1('0x7')]][_0x90b1('0x60')]=_0x257182[_0x90b1('0x4d')];}}}catch(_0x491086){utils[_0x90b1('0x22')](util['format']('[%s][calls][varset]',_0x257182[_0x90b1('0x7')]),_0x491086);}};exports[_0x90b1('0x62')]=function(_0xba8798){try{if(!_['isNil'](channels[_0xba8798[_0x90b1('0x7')]])){utils[_0x90b1('0x19')](util[_0x90b1('0xa')](_0x90b1('0x63'),_0xba8798[_0x90b1('0x7')]),_0xba8798);utils[_0x90b1('0x9')](util[_0x90b1('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0xba8798['uniqueid'],_0xba8798[_0x90b1('0x64')],_0xba8798[_0x90b1('0x65')]));if(_0xba8798[_0x90b1('0x64')][_0x90b1('0x66')]()==_0x90b1('0x67')&&_['startsWith'](_0xba8798[_0x90b1('0x65')][_0x90b1('0x66')](),_0x90b1('0x68'))){var _0x43ba21=_0xba8798['appdata'][_0x90b1('0x69')]('=');var _0xfcd061=_0x43ba21[0x0]['substring'](_0x43ba21[0x0][_0x90b1('0x6a')]('(')+0x1,_0x43ba21[0x0]['lastIndexOf'](')'));var _0x21cac4=_0x43ba21[0x1];channels[_0xba8798[_0x90b1('0x7')]][_0xfcd061]=_0x21cac4;}if(!_[_0x90b1('0x6b')](['hangup',_0x90b1('0x6c'),_0x90b1('0x6d'),_0x90b1('0x67'),'gotoif'],_0xba8798[_0x90b1('0x64')][_0x90b1('0x66')]())){channels[_0xba8798[_0x90b1('0x7')]][_0x90b1('0x57')]=_0xba8798['application'];channels[_0xba8798[_0x90b1('0x7')]][_0x90b1('0x6e')]=_0xba8798['appdata'];}}}catch(_0x275f65){utils['error'](util[_0x90b1('0xa')](_0x90b1('0x63'),_0xba8798[_0x90b1('0x7')]),_0x275f65);}}; \ No newline at end of file +var _0xdbd0=['sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','cdr','appdata','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','channelstate','context','isNil','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','starttime','billableseconds','answertime','diffTime','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','origtransfererchannel','_attended','error','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid'];(function(_0x478d8c,_0x3341c1){var _0x3f343a=function(_0x5d2b2a){while(--_0x5d2b2a){_0x478d8c['push'](_0x478d8c['shift']());}};_0x3f343a(++_0x3341c1);}(_0xdbd0,0x7e));var _0x0dbd=function(_0x5eb7af,_0x418420){_0x5eb7af=_0x5eb7af-0x0;var _0x290f17=_0xdbd0[_0x5eb7af];return _0x290f17;};'use strict';var _=require(_0x0dbd('0x0'));var util=require(_0x0dbd('0x1'));var utils=require(_0x0dbd('0x2'));var transfers=require(_0x0dbd('0x3'));var dispositions=[_0x0dbd('0x4'),_0x0dbd('0x5'),_0x0dbd('0x5'),_0x0dbd('0x4'),'NO\x20ANSWER',_0x0dbd('0x4'),_0x0dbd('0x6'),_0x0dbd('0x7'),_0x0dbd('0x5'),'FAILED','FAILED'];var channels={};function writeDB(_0xc73b7d){var _0x2fc70a;if(transfers[_0x0dbd('0x8')][_0xc73b7d['uniqueid']]){_0x2fc70a=_0xc73b7d['uniqueid'];_0xc73b7d[_0x0dbd('0x9')]=transfers['blinds'][_0xc73b7d[_0x0dbd('0x9')]][_0x0dbd('0xa')];}utils[_0x0dbd('0xb')](util['format'](_0x0dbd('0xc'),_0xc73b7d[_0x0dbd('0x9')],_0xc73b7d[_0x0dbd('0xd')],_0xc73b7d[_0x0dbd('0xe')],_0xc73b7d[_0x0dbd('0xf')],_0xc73b7d['interface'],_0xc73b7d[_0x0dbd('0x10')],_0xc73b7d[_0x0dbd('0x11')],_0xc73b7d['lastevent']));if(_0xc73b7d[_0x0dbd('0x12')]){utils[_0x0dbd('0x13')](_0xc73b7d['accountcode'])[_0x0dbd('0x14')](function(_0x54fa13){if(_0x54fa13){_0xc73b7d[_0x0dbd('0x15')]=_0x54fa13['id'];}utils['request']('CreateVoiceCallReport',_0xc73b7d);});}else{utils[_0x0dbd('0x16')]('CreateVoiceCallReport',_0xc73b7d);}if(channels[_0xc73b7d['uniqueid']]){delete channels[_0xc73b7d['uniqueid']];}else if(_0x2fc70a&&channels[_0x2fc70a]){delete transfers[_0x0dbd('0x8')][_0x2fc70a];delete channels[_0x2fc70a];}}exports[_0x0dbd('0x17')]=function(_0x1bf21b){try{utils['debug'](util['format'](_0x0dbd('0x18'),_0x1bf21b[_0x0dbd('0x9')]),_0x1bf21b);if(_0x1bf21b['uniqueid']==_0x1bf21b['linkedid']&&_0x1bf21b[_0x0dbd('0xd')]!=_0x0dbd('0x19')){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')](_0x0dbd('0x1b'),_0x1bf21b[_0x0dbd('0x9')],_0x1bf21b['context'],_0x1bf21b['exten']));channels[_0x1bf21b['uniqueid']]={'uniqueid':_0x1bf21b[_0x0dbd('0x9')],'accountcode':_0x1bf21b[_0x0dbd('0x12')],'source':_0x1bf21b[_0x0dbd('0x10')],'destination':_0x1bf21b[_0x0dbd('0x1c')],'destinationcontext':_0x1bf21b['context'],'channel':_0x1bf21b[_0x0dbd('0xd')],'starttime':utils[_0x0dbd('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0dbd('0x4'),'amaflags':_0x0dbd('0x1e')};}}catch(_0x5e2775){utils['error'](util['format'](_0x0dbd('0x18'),_0x1bf21b['uniqueid']),_0x5e2775);}};exports[_0x0dbd('0x1f')]=function(_0x2ae441){try{utils[_0x0dbd('0x20')](util[_0x0dbd('0x1a')](_0x0dbd('0x21'),_0x2ae441['uniqueid']),_0x2ae441);if(!_['isNil'](channels[_0x2ae441[_0x0dbd('0x9')]])&&_0x2ae441[_0x0dbd('0x22')]==0x6){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2ae441['uniqueid'],_0x2ae441[_0x0dbd('0x23')],_0x2ae441[_0x0dbd('0xd')]));if(_[_0x0dbd('0x24')](channels[_0x2ae441['uniqueid']][_0x0dbd('0x25')])){channels[_0x2ae441['uniqueid']][_0x0dbd('0x25')]=utils[_0x0dbd('0x1d')]();}}else if(!_[_0x0dbd('0x24')](channels[_0x2ae441[_0x0dbd('0x26')]])&&_0x2ae441[_0x0dbd('0x22')]==0x6&&_0x2ae441['context']!=_0x0dbd('0x27')){utils['info'](util['format'](_0x0dbd('0x28'),_0x2ae441['uniqueid'],_0x2ae441[_0x0dbd('0x26')],_0x2ae441[_0x0dbd('0x23')],_0x2ae441[_0x0dbd('0xd')]));channels[_0x2ae441[_0x0dbd('0x26')]][_0x0dbd('0x12')]=_0x2ae441[_0x0dbd('0x12')];channels[_0x2ae441[_0x0dbd('0x26')]][_0x0dbd('0x29')]=_0x2ae441[_0x0dbd('0xd')];if(_['isNil'](channels[_0x2ae441['linkedid']]['answertime'])){channels[_0x2ae441['linkedid']]['answertime']=utils[_0x0dbd('0x1d')]();}channels[_0x2ae441[_0x0dbd('0x26')]][_0x0dbd('0x2a')]=dispositions[_[_0x0dbd('0x2b')](_0x2ae441[_0x0dbd('0x22')])]||'ANSWERED';}}catch(_0x4c4a89){utils['error'](util['format'](_0x0dbd('0x21'),_0x2ae441[_0x0dbd('0x9')]),_0x4c4a89);}};exports[_0x0dbd('0x2c')]=function(_0x122dd5){try{if(!_[_0x0dbd('0x24')](channels[_0x122dd5[_0x0dbd('0x9')]])){utils[_0x0dbd('0x20')](util['format'](_0x0dbd('0x2d'),_0x122dd5[_0x0dbd('0x9')]),_0x122dd5);if(_['isNil'](channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x2e')])){channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x2e')]=_0x122dd5[_0x0dbd('0x2f')]+'\x20<'+_0x122dd5[_0x0dbd('0x10')]+'>';}utils[_0x0dbd('0xb')](util['format'](_0x0dbd('0x30'),_0x122dd5[_0x0dbd('0x9')],channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x2e')],_0x122dd5['cause-txt']));channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x31')]=utils[_0x0dbd('0x1d')]();channels[_0x122dd5['uniqueid']][_0x0dbd('0x32')]=utils['diffTime'](channels[_0x122dd5[_0x0dbd('0x9')]]['endtime'],channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x33')]);channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x34')]=channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x35')]?utils[_0x0dbd('0x36')](channels[_0x122dd5[_0x0dbd('0x9')]]['endtime'],channels[_0x122dd5[_0x0dbd('0x9')]][_0x0dbd('0x35')]):0x0;writeDB(channels[_0x122dd5[_0x0dbd('0x9')]]);}}catch(_0x1a0c28){utils['error'](util[_0x0dbd('0x1a')](_0x0dbd('0x2d'),_0x122dd5[_0x0dbd('0x9')]),_0x1a0c28);}};exports['attendedtransfer']=function(_0x560943){try{if(!_[_0x0dbd('0x24')](channels[_0x560943['localtwolinkedid']])){utils[_0x0dbd('0x20')](util[_0x0dbd('0x1a')]('[%s][calls][attendedtransfer]',_0x560943[_0x0dbd('0x37')]),_0x560943);if(channels[_0x560943[_0x0dbd('0x38')]][_0x0dbd('0xd')]==_0x560943[_0x0dbd('0x39')]){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')](_0x0dbd('0x3a'),_0x560943[_0x0dbd('0x37')],_0x560943['localtwolinkedid'],_0x560943['secondtransfererchannel']));channels[_0x560943[_0x0dbd('0x38')]]['destinationchannel']=_0x560943['secondtransfererchannel'];channels[_0x560943[_0x0dbd('0x38')]][_0x0dbd('0x3b')]='_attended';}else if(channels[_0x560943['localtwolinkedid']][_0x0dbd('0xd')]=_0x560943['transfertargetchannel']){utils['info'](util['format'](_0x0dbd('0x3a'),_0x560943[_0x0dbd('0x37')],_0x560943[_0x0dbd('0x38')],_0x560943[_0x0dbd('0x3c')]));channels[_0x560943[_0x0dbd('0x38')]]['destinationchannel']=_0x560943['origtransfererchannel'];channels[_0x560943[_0x0dbd('0x38')]][_0x0dbd('0x3b')]=_0x0dbd('0x3d');}}}catch(_0x503d34){utils[_0x0dbd('0x3e')](util[_0x0dbd('0x1a')](_0x0dbd('0x3f'),_0x560943[_0x0dbd('0x37')]),_0x503d34);}};exports[_0x0dbd('0x40')]=function(_0x1270e2){try{if(!_[_0x0dbd('0x24')](channels[_0x1270e2['uniqueid']])){utils[_0x0dbd('0x20')](util[_0x0dbd('0x1a')](_0x0dbd('0x41'),_0x1270e2[_0x0dbd('0x9')]),_0x1270e2);channels[_0x1270e2['uniqueid']]['musiconholdstartAt']=utils[_0x0dbd('0x1d')]();utils['info'](util[_0x0dbd('0x1a')](_0x0dbd('0x42'),_0x1270e2[_0x0dbd('0x9')],channels[_0x1270e2[_0x0dbd('0x9')]][_0x0dbd('0x43')]));}}catch(_0x46ba31){utils[_0x0dbd('0x3e')](util[_0x0dbd('0x1a')]('[%s][calls][musiconholdstart]',_0x1270e2['uniqueid']),_0x46ba31);}};exports[_0x0dbd('0x44')]=function(_0x31cef4){try{if(!_['isNil'](channels[_0x31cef4[_0x0dbd('0x9')]])){utils[_0x0dbd('0x20')](util[_0x0dbd('0x1a')](_0x0dbd('0x45'),_0x31cef4[_0x0dbd('0x9')]),_0x31cef4);if(!_['isNil'](channels[_0x31cef4[_0x0dbd('0x9')]][_0x0dbd('0x43')])){channels[_0x31cef4[_0x0dbd('0x9')]][_0x0dbd('0x46')]+=utils[_0x0dbd('0x36')](utils[_0x0dbd('0x1d')](),channels[_0x31cef4[_0x0dbd('0x9')]][_0x0dbd('0x43')]);utils['info'](util[_0x0dbd('0x1a')](_0x0dbd('0x47'),_0x31cef4[_0x0dbd('0x9')],channels[_0x31cef4['uniqueid']]['mohtime']));delete channels[_0x31cef4[_0x0dbd('0x9')]][_0x0dbd('0x43')];}}}catch(_0x1d8ed0){utils[_0x0dbd('0x3e')](util['format']('[%s][calls][musiconholdstop]',_0x31cef4[_0x0dbd('0x9')]),_0x1d8ed0);}};exports[_0x0dbd('0x48')]=function(_0x3af29c){try{if(!_[_0x0dbd('0x24')](channels[_0x3af29c[_0x0dbd('0x9')]])){utils['debug'](util[_0x0dbd('0x1a')](_0x0dbd('0x49'),_0x3af29c[_0x0dbd('0x9')]),_0x3af29c);if(!_['isNil'](_0x3af29c['variable'][_0x0dbd('0x4a')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3af29c[_0x0dbd('0x9')],_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x4c')]=_0x3af29c[_0x0dbd('0x4b')];}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')]['xmd-phone'])){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')](_0x0dbd('0x4e'),_0x3af29c[_0x0dbd('0x9')],_0x3af29c['value']));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x4f')]=_0x3af29c[_0x0dbd('0x4b')];channels[_0x3af29c['uniqueid']][_0x0dbd('0x2e')]='\x22'+_0x3af29c[_0x0dbd('0x4b')]+'\x22\x20<'+_0x3af29c['value']+'>';}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x50')])||!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')]['xmd-callerid'])){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')](_0x0dbd('0x51'),_0x3af29c[_0x0dbd('0x9')],!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x50')])?'xmd-callerid-preview':_0x0dbd('0x52'),_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x2e')]=_0x3af29c[_0x0dbd('0x4b')];}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x53')])||!_['isNil'](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x54')])){utils['info'](util[_0x0dbd('0x1a')](_0x0dbd('0x51'),_0x3af29c[_0x0dbd('0x9')],!_[_0x0dbd('0x24')](_0x3af29c['variable'][_0x0dbd('0x53')])?_0x0dbd('0x53'):_0x0dbd('0x54'),_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x55')]=_0x0dbd('0x56');channels[_0x3af29c['uniqueid']][_0x0dbd('0x57')]=_0x3af29c[_0x0dbd('0x4b')];channels[_0x3af29c[_0x0dbd('0x9')]]['queue']=!![];}if(!_['isNil'](_0x3af29c[_0x0dbd('0x4d')]['xmd-contactid'])){utils[_0x0dbd('0xb')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x3af29c[_0x0dbd('0x9')],_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x58')]=_0x3af29c[_0x0dbd('0x4b')];}if(!_[_0x0dbd('0x24')](_0x3af29c['variable'][_0x0dbd('0x59')])){utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3af29c[_0x0dbd('0x9')],_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x5a')]=_0x3af29c[_0x0dbd('0x4b')];}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x5b')])){utils['info'](util[_0x0dbd('0x1a')](_0x0dbd('0x5c'),_0x3af29c['uniqueid'],_0x3af29c[_0x0dbd('0x4b')]));channels[_0x3af29c[_0x0dbd('0x9')]][_0x0dbd('0x5d')]=_0x3af29c['value'];}if(!_[_0x0dbd('0x24')](_0x3af29c[_0x0dbd('0x4d')][_0x0dbd('0x5e')])){utils[_0x0dbd('0xb')](util['format'](_0x0dbd('0x5f'),_0x3af29c[_0x0dbd('0x9')],_0x3af29c['value']));channels[_0x3af29c['uniqueid']][_0x0dbd('0x5e')]=_0x3af29c[_0x0dbd('0x4b')];}}}catch(_0x34df95){utils['error'](util[_0x0dbd('0x1a')]('[%s][calls][varset]',_0x3af29c['uniqueid']),_0x34df95);}};exports[_0x0dbd('0x60')]=function(_0x1450d4){try{if(!_['isNil'](channels[_0x1450d4[_0x0dbd('0x9')]])){utils['debug'](util[_0x0dbd('0x1a')](_0x0dbd('0x61'),_0x1450d4['uniqueid']),_0x1450d4);utils[_0x0dbd('0xb')](util[_0x0dbd('0x1a')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x1450d4['uniqueid'],_0x1450d4[_0x0dbd('0x62')],_0x1450d4['appdata']));if(_0x1450d4['application'][_0x0dbd('0x63')]()==_0x0dbd('0x64')&&_[_0x0dbd('0x65')](_0x1450d4['appdata']['toLowerCase'](),_0x0dbd('0x66'))){var _0x566042=_0x1450d4[_0x0dbd('0x67')][_0x0dbd('0x68')]('=');var _0x1b5b74=_0x566042[0x0]['substring'](_0x566042[0x0][_0x0dbd('0x69')]('(')+0x1,_0x566042[0x0][_0x0dbd('0x69')](')'));var _0x2f2e49=_0x566042[0x1];channels[_0x1450d4['uniqueid']][_0x1b5b74]=_0x2f2e49;}if(!_[_0x0dbd('0x6a')]([_0x0dbd('0x2c'),_0x0dbd('0x6b'),_0x0dbd('0x6c'),_0x0dbd('0x64'),_0x0dbd('0x6d')],_0x1450d4['application']['toLowerCase']())){channels[_0x1450d4[_0x0dbd('0x9')]][_0x0dbd('0x55')]=_0x1450d4[_0x0dbd('0x62')];channels[_0x1450d4[_0x0dbd('0x9')]]['lastdata']=_0x1450d4[_0x0dbd('0x67')];}}}catch(_0x483b7c){utils[_0x0dbd('0x3e')](util[_0x0dbd('0x1a')](_0x0dbd('0x61'),_0x1450d4['uniqueid']),_0x483b7c);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 0ccab5d..0376fa5 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 _0xbbc7=['./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbbc7,0x7e));var _0x7bbc=function(_0x5561ea,_0x321223){_0x5561ea=_0x5561ea-0x0;var _0x13cc6a=_0xbbc7[_0x5561ea];return _0x13cc6a;};'use strict';var utils=require(_0x7bbc('0x0'));exports[_0x7bbc('0x1')]=function(){utils[_0x7bbc('0x2')](_0x7bbc('0x3'));};exports[_0x7bbc('0x4')]=function(){utils['info'](_0x7bbc('0x5'));};exports[_0x7bbc('0x6')]=function(){utils[_0x7bbc('0x2')](_0x7bbc('0x7'));};exports['error']=function(_0x4f8c39){utils['error'](_0x7bbc('0x8'),_0x4f8c39);};exports['close']=function(){utils[_0x7bbc('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x2b02aa){}; \ No newline at end of file +var _0xb448=['close','[core]\x20close','./utils','connect','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb448,0x18e));var _0x8b44=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xb448[_0x42bdad];return _0x122626;};'use strict';var utils=require(_0x8b44('0x0'));exports[_0x8b44('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x8b44('0x2')]=function(){utils[_0x8b44('0x3')](_0x8b44('0x4'));};exports[_0x8b44('0x5')]=function(){utils[_0x8b44('0x3')](_0x8b44('0x6'));};exports[_0x8b44('0x7')]=function(_0x447507){utils[_0x8b44('0x7')](_0x8b44('0x8'),_0x447507);};exports[_0x8b44('0x9')]=function(){utils[_0x8b44('0x3')](_0x8b44('0xa'));};exports['managerevent']=function(_0xdb1c78){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 709209a..5961026 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 _0x55b6=['complete','duration','diffTime','holdtime','answertime','endtime','billableseconds','[%s][dials][hangup]','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','appdata','cdr(routeid)','split','error','[%s][dials][varset]','variable','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','isNil','[%s][dials][dialend]','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','dialstatus','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt'];(function(_0x283c23,_0x187118){var _0x12c6a2=function(_0x366f94){while(--_0x366f94){_0x283c23['push'](_0x283c23['shift']());}};_0x12c6a2(++_0x187118);}(_0x55b6,0x1de));var _0x655b=function(_0x2ec849,_0x165f70){_0x2ec849=_0x2ec849-0x0;var _0x3f11aa=_0x55b6[_0x2ec849];return _0x3f11aa;};'use strict';var _=require(_0x655b('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x3bd467){utils[_0x655b('0x1')](util[_0x655b('0x2')](_0x655b('0x3'),_0x3bd467[_0x655b('0x4')],_0x3bd467[_0x655b('0x5')],_0x3bd467[_0x655b('0x6')],_0x3bd467[_0x655b('0x7')],_0x3bd467['connectedlinenum'],_0x3bd467['dialstatus']));utils[_0x655b('0x8')](_0x655b('0x9'),_0x3bd467);delete dials[_0x3bd467[_0x655b('0x4')]];}exports[_0x655b('0xa')]=function(_0x2c1612){try{utils[_0x655b('0xb')](util[_0x655b('0x2')](_0x655b('0xc'),_0x2c1612['uniqueid']),_0x2c1612);utils[_0x655b('0x1')](util[_0x655b('0x2')](_0x655b('0xd'),_0x2c1612[_0x655b('0x4')],_0x2c1612[_0x655b('0xe')],_0x2c1612['appdata']));if(_0x2c1612[_0x655b('0xe')][_0x655b('0xf')]()=='set'&&_['startsWith'](_0x2c1612[_0x655b('0x10')][_0x655b('0xf')](),_0x655b('0x11'))){var _0x5dce25=_0x2c1612['appdata'][_0x655b('0x12')]('=');dials[_0x2c1612[_0x655b('0x4')]]={'routeId':_0x5dce25[0x1]};}}catch(_0x4de57a){utils[_0x655b('0x13')](util[_0x655b('0x2')](_0x655b('0xc'),_0x2c1612[_0x655b('0x4')]),_0x4de57a);}};exports['varset']=function(_0x4786bb){try{utils['debug'](util[_0x655b('0x2')](_0x655b('0x14'),_0x4786bb[_0x655b('0x4')]),_0x4786bb);if(!_['isNil'](_0x4786bb[_0x655b('0x15')]['outboundrouteid'])){utils[_0x655b('0x1')](util[_0x655b('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x4786bb[_0x655b('0x4')],_0x4786bb[_0x655b('0x16')]));dials[_0x4786bb[_0x655b('0x4')]]={'routeId':_0x4786bb['value']};}}catch(_0xbd9535){utils[_0x655b('0x13')](util[_0x655b('0x2')]('[%s][dials][varset]',_0x4786bb[_0x655b('0x4')]),_0xbd9535);}};exports[_0x655b('0x17')]=function(_0x3e35e6){try{if(!_['isNil'](dials[_0x3e35e6[_0x655b('0x4')]])){utils[_0x655b('0xb')](util[_0x655b('0x2')](_0x655b('0x18'),_0x3e35e6[_0x655b('0x4')]),_0x3e35e6);dials[_0x3e35e6[_0x655b('0x4')]]=_[_0x655b('0x19')](dials[_0x3e35e6[_0x655b('0x4')]],_0x3e35e6);dials[_0x3e35e6[_0x655b('0x4')]][_0x655b('0x1a')]=utils[_0x655b('0x1b')]();dials[_0x3e35e6[_0x655b('0x4')]][_0x655b('0x1c')]=_0x655b('0x1d');utils['info'](util[_0x655b('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3e35e6[_0x655b('0x4')],dials[_0x3e35e6[_0x655b('0x4')]][_0x655b('0x1a')]));}}catch(_0x5b8fca){utils[_0x655b('0x13')](util[_0x655b('0x2')](_0x655b('0x18'),_0x3e35e6[_0x655b('0x4')]),_0x5b8fca);}};exports[_0x655b('0x1e')]=function(_0x572334){try{if(!_[_0x655b('0x1f')](dials[_0x572334[_0x655b('0x4')]])){utils[_0x655b('0xb')](util[_0x655b('0x2')](_0x655b('0x20'),_0x572334['uniqueid']),_0x572334);dials[_0x572334[_0x655b('0x4')]]['dialstatus']=_0x572334['dialstatus'];if(_0x572334['dialstatus']=='ANSWER'){dials[_0x572334[_0x655b('0x4')]]=_[_0x655b('0x19')](dials[_0x572334[_0x655b('0x4')]],_0x572334);dials[_0x572334[_0x655b('0x4')]]['answertime']=utils[_0x655b('0x1b')]();dials[_0x572334[_0x655b('0x4')]]['lastevent']='connect';utils['info'](util[_0x655b('0x2')](_0x655b('0x21'),_0x572334[_0x655b('0x4')],_0x572334['dialstatus'],dials[_0x572334[_0x655b('0x4')]]['answertime']));}else{utils[_0x655b('0x1')](util[_0x655b('0x2')](_0x655b('0x22'),_0x572334['uniqueid'],_0x572334[_0x655b('0x23')]));}}}catch(_0x414222){utils[_0x655b('0x13')](util[_0x655b('0x2')]('[%s][dials][dialend]',_0x572334[_0x655b('0x4')]),_0x414222);}};exports[_0x655b('0x24')]=function(_0x55ffc6){try{if(!_[_0x655b('0x1f')](dials[_0x55ffc6[_0x655b('0x4')]])){utils['debug'](util[_0x655b('0x2')]('[%s][dials][hangup]',_0x55ffc6[_0x655b('0x4')]),_0x55ffc6);utils['info'](util[_0x655b('0x2')](_0x655b('0x25'),_0x55ffc6['uniqueid'],_0x55ffc6[_0x655b('0x7')],_0x55ffc6['calleridname'],_0x55ffc6[_0x655b('0x26')]));dials[_0x55ffc6[_0x655b('0x4')]]=_[_0x655b('0x19')](dials[_0x55ffc6[_0x655b('0x4')]],{'endtime':utils['now'](),'lastevent':_0x655b('0x27')});dials[_0x55ffc6[_0x655b('0x4')]][_0x655b('0x28')]=utils[_0x655b('0x29')](dials[_0x55ffc6[_0x655b('0x4')]]['endtime'],dials[_0x55ffc6[_0x655b('0x4')]][_0x655b('0x1a')]);dials[_0x55ffc6[_0x655b('0x4')]][_0x655b('0x2a')]=utils[_0x655b('0x29')](dials[_0x55ffc6['uniqueid']][_0x655b('0x2b')]||dials[_0x55ffc6[_0x655b('0x4')]][_0x655b('0x2c')],dials[_0x55ffc6[_0x655b('0x4')]][_0x655b('0x1a')]);dials[_0x55ffc6['uniqueid']][_0x655b('0x2d')]=dials[_0x55ffc6[_0x655b('0x4')]][_0x655b('0x2b')]?utils[_0x655b('0x29')](dials[_0x55ffc6[_0x655b('0x4')]][_0x655b('0x2c')],dials[_0x55ffc6[_0x655b('0x4')]]['answertime']):0x0;writeDB(dials[_0x55ffc6[_0x655b('0x4')]]);}}catch(_0x3ebc0c){utils['error'](util[_0x655b('0x2')](_0x655b('0x2e'),_0x55ffc6[_0x655b('0x4')]),_0x3ebc0c);}}; \ No newline at end of file +var _0xf504=['[%s][dials][newexten]','info','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','called','dialend','[%s][dials][dialend]','ANSWER','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug'];(function(_0x1c1be8,_0x35ea23){var _0x164c13=function(_0x471478){while(--_0x471478){_0x1c1be8['push'](_0x1c1be8['shift']());}};_0x164c13(++_0x35ea23);}(_0xf504,0x8b));var _0x4f50=function(_0x2c3159,_0x433a01){_0x2c3159=_0x2c3159-0x0;var _0x37b935=_0xf504[_0x2c3159];return _0x37b935;};'use strict';var _=require(_0x4f50('0x0'));var util=require(_0x4f50('0x1'));var utils=require(_0x4f50('0x2'));var dials={};function writeDB(_0x17aa78){utils['info'](util['format'](_0x4f50('0x3'),_0x17aa78['uniqueid'],_0x17aa78[_0x4f50('0x4')],_0x17aa78[_0x4f50('0x5')],_0x17aa78[_0x4f50('0x6')],_0x17aa78[_0x4f50('0x7')],_0x17aa78[_0x4f50('0x8')]));utils[_0x4f50('0x9')](_0x4f50('0xa'),_0x17aa78);delete dials[_0x17aa78[_0x4f50('0xb')]];}exports[_0x4f50('0xc')]=function(_0x39c1e7){try{utils[_0x4f50('0xd')](util['format'](_0x4f50('0xe'),_0x39c1e7[_0x4f50('0xb')]),_0x39c1e7);utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x11'),_0x39c1e7[_0x4f50('0xb')],_0x39c1e7[_0x4f50('0x12')],_0x39c1e7['appdata']));if(_0x39c1e7[_0x4f50('0x12')][_0x4f50('0x13')]()==_0x4f50('0x14')&&_[_0x4f50('0x15')](_0x39c1e7[_0x4f50('0x16')][_0x4f50('0x13')](),_0x4f50('0x17'))){var _0x3f314e=_0x39c1e7['appdata']['split']('=');dials[_0x39c1e7['uniqueid']]={'routeId':_0x3f314e[0x1]};}}catch(_0x1e49ca){utils[_0x4f50('0x18')](util[_0x4f50('0x10')]('[%s][dials][newexten]',_0x39c1e7[_0x4f50('0xb')]),_0x1e49ca);}};exports[_0x4f50('0x19')]=function(_0x47ab10){try{utils['debug'](util[_0x4f50('0x10')](_0x4f50('0x1a'),_0x47ab10['uniqueid']),_0x47ab10);if(!_[_0x4f50('0x1b')](_0x47ab10['variable'][_0x4f50('0x1c')])){utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x1d'),_0x47ab10['uniqueid'],_0x47ab10[_0x4f50('0x1e')]));dials[_0x47ab10['uniqueid']]={'routeId':_0x47ab10['value']};}}catch(_0x3c74e8){utils[_0x4f50('0x18')](util['format'](_0x4f50('0x1a'),_0x47ab10['uniqueid']),_0x3c74e8);}};exports[_0x4f50('0x1f')]=function(_0x4ef852){try{if(!_['isNil'](dials[_0x4ef852[_0x4f50('0xb')]])){utils[_0x4f50('0xd')](util[_0x4f50('0x10')](_0x4f50('0x20'),_0x4ef852[_0x4f50('0xb')]),_0x4ef852);dials[_0x4ef852[_0x4f50('0xb')]]=_[_0x4f50('0x21')](dials[_0x4ef852['uniqueid']],_0x4ef852);dials[_0x4ef852[_0x4f50('0xb')]][_0x4f50('0x22')]=utils['now']();dials[_0x4ef852[_0x4f50('0xb')]]['lastevent']=_0x4f50('0x23');utils[_0x4f50('0xf')](util[_0x4f50('0x10')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4ef852[_0x4f50('0xb')],dials[_0x4ef852[_0x4f50('0xb')]]['starttime']));}}catch(_0x51483e){utils['error'](util[_0x4f50('0x10')](_0x4f50('0x20'),_0x4ef852[_0x4f50('0xb')]),_0x51483e);}};exports[_0x4f50('0x24')]=function(_0x5d27b4){try{if(!_[_0x4f50('0x1b')](dials[_0x5d27b4['uniqueid']])){utils[_0x4f50('0xd')](util[_0x4f50('0x10')](_0x4f50('0x25'),_0x5d27b4[_0x4f50('0xb')]),_0x5d27b4);dials[_0x5d27b4[_0x4f50('0xb')]][_0x4f50('0x8')]=_0x5d27b4['dialstatus'];if(_0x5d27b4[_0x4f50('0x8')]==_0x4f50('0x26')){dials[_0x5d27b4[_0x4f50('0xb')]]=_[_0x4f50('0x21')](dials[_0x5d27b4[_0x4f50('0xb')]],_0x5d27b4);dials[_0x5d27b4[_0x4f50('0xb')]]['answertime']=utils['now']();dials[_0x5d27b4['uniqueid']][_0x4f50('0x27')]='connect';utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x28'),_0x5d27b4['uniqueid'],_0x5d27b4[_0x4f50('0x8')],dials[_0x5d27b4['uniqueid']][_0x4f50('0x29')]));}else{utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x2a'),_0x5d27b4['uniqueid'],_0x5d27b4[_0x4f50('0x8')]));}}}catch(_0x56a7a6){utils[_0x4f50('0x18')](util[_0x4f50('0x10')](_0x4f50('0x25'),_0x5d27b4[_0x4f50('0xb')]),_0x56a7a6);}};exports[_0x4f50('0x2b')]=function(_0x1eb011){try{if(!_[_0x4f50('0x1b')](dials[_0x1eb011[_0x4f50('0xb')]])){utils[_0x4f50('0xd')](util['format'](_0x4f50('0x2c'),_0x1eb011[_0x4f50('0xb')]),_0x1eb011);utils[_0x4f50('0xf')](util[_0x4f50('0x10')](_0x4f50('0x2d'),_0x1eb011[_0x4f50('0xb')],_0x1eb011['calleridnum'],_0x1eb011['calleridname'],_0x1eb011['cause-txt']));dials[_0x1eb011[_0x4f50('0xb')]]=_[_0x4f50('0x21')](dials[_0x1eb011[_0x4f50('0xb')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x2e')]=utils[_0x4f50('0x2f')](dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x30')],dials[_0x1eb011['uniqueid']][_0x4f50('0x22')]);dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x31')]=utils[_0x4f50('0x2f')](dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x29')]||dials[_0x1eb011['uniqueid']][_0x4f50('0x30')],dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x22')]);dials[_0x1eb011['uniqueid']][_0x4f50('0x32')]=dials[_0x1eb011['uniqueid']][_0x4f50('0x29')]?utils[_0x4f50('0x2f')](dials[_0x1eb011[_0x4f50('0xb')]][_0x4f50('0x30')],dials[_0x1eb011['uniqueid']][_0x4f50('0x29')]):0x0;writeDB(dials[_0x1eb011[_0x4f50('0xb')]]);}}catch(_0x21811c){utils[_0x4f50('0x18')](util['format'](_0x4f50('0x2c'),_0x1eb011[_0x4f50('0xb')]),_0x21811c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 9949761..c29a636 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 _0x4cdf=['[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]'];(function(_0x32add0,_0xa90dba){var _0x5956bf=function(_0x3c7cf9){while(--_0x3c7cf9){_0x32add0['push'](_0x32add0['shift']());}};_0x5956bf(++_0xa90dba);}(_0x4cdf,0x18b));var _0xf4cd=function(_0x16d488,_0x12e9b8){_0x16d488=_0x16d488-0x0;var _0x953b1=_0x4cdf[_0x16d488];return _0x953b1;};var AsteriskManager=require(_0xf4cd('0x0'));var config=require(_0xf4cd('0x1'));var utils=require(_0xf4cd('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk']['port'],config[_0xf4cd('0x3')]['ip'],config[_0xf4cd('0x3')][_0xf4cd('0x4')],config[_0xf4cd('0x3')][_0xf4cd('0x5')],!![]);ami[_0xf4cd('0x6')]();if(config[_0xf4cd('0x7')]&&config['xdr']['disabled']){utils[_0xf4cd('0x8')](_0xf4cd('0x9'));}else{var agents=require(_0xf4cd('0xa'));var calls=require(_0xf4cd('0xb'));var queues=require(_0xf4cd('0xc'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xf4cd('0xd'));var transfers=require(_0xf4cd('0xe'));var core=require(_0xf4cd('0xf'));ami['on'](_0xf4cd('0x10'),core[_0xf4cd('0x10')]);ami['on'](_0xf4cd('0x11'),core[_0xf4cd('0x11')]);ami['on'](_0xf4cd('0x12'),core[_0xf4cd('0x12')]);ami['on'](_0xf4cd('0x13'),core[_0xf4cd('0x13')]);ami['on']('close',core['close']);ami['on']('managerevent',core[_0xf4cd('0x14')]);ami['on'](_0xf4cd('0x15'),function(_0x28b309){try{utils['debug'](util['format'](_0xf4cd('0x16'),_0x28b309[_0xf4cd('0x17')]),_0x28b309);members[_0xf4cd('0x15')](_0x28b309);}catch(_0x3eec9a){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')]('[%s][index][devicestatechange]',_0x28b309[_0xf4cd('0x17')]),_0x3eec9a);}});ami['on'](_0xf4cd('0x19'),function(_0x1cf51c){try{utils[_0xf4cd('0x1a')](util['format'](_0xf4cd('0x1b'),_0x1cf51c[_0xf4cd('0x1c')]),_0x1cf51c);agents[_0xf4cd('0x19')](_0x1cf51c);}catch(_0x519e69){utils['error'](util[_0xf4cd('0x18')](_0xf4cd('0x1b'),_0x1cf51c[_0xf4cd('0x1c')]),_0x519e69);}});ami['on'](_0xf4cd('0x1d'),function(_0x3000c7){try{utils[_0xf4cd('0x1a')](util['format']('[%s][index][agentringnoanswer]',_0x3000c7[_0xf4cd('0x1c')]),_0x3000c7);agents[_0xf4cd('0x1d')](_0x3000c7);}catch(_0x4a83b6){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')](_0xf4cd('0x1e'),_0x3000c7['uniqueid']),_0x4a83b6);}});ami['on']('agentconnect',function(_0x2af01c){try{utils[_0xf4cd('0x1a')](util['format'](_0xf4cd('0x1f'),_0x2af01c[_0xf4cd('0x1c')]),_0x2af01c);agents[_0xf4cd('0x20')](_0x2af01c);queues[_0xf4cd('0x20')](_0x2af01c);}catch(_0x41938e){utils['error'](util[_0xf4cd('0x18')](_0xf4cd('0x1f'),_0x2af01c[_0xf4cd('0x1c')]),_0x41938e);}});ami['on'](_0xf4cd('0x21'),function(_0xac5f0){try{utils['debug'](util[_0xf4cd('0x18')](_0xf4cd('0x22'),_0xac5f0[_0xf4cd('0x1c')]),_0xac5f0);agents[_0xf4cd('0x21')](_0xac5f0);queues[_0xf4cd('0x21')](_0xac5f0);members[_0xf4cd('0x21')](_0xac5f0);}catch(_0x4a8d0d){utils[_0xf4cd('0x13')](util['format']('[%s][index][agentcomplete]',_0xac5f0['uniqueid']),_0x4a8d0d);}});ami['on']('queuecallerabandon',function(_0x1901ae){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x23'),_0x1901ae[_0xf4cd('0x1c')]),_0x1901ae);agents[_0xf4cd('0x24')](_0x1901ae);queues[_0xf4cd('0x24')](_0x1901ae);}catch(_0xed0c7e){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')](_0xf4cd('0x23'),_0x1901ae[_0xf4cd('0x1c')]),_0xed0c7e);}});ami['on'](_0xf4cd('0x25'),function(_0x40616f){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x26'),_0x40616f['uniqueid']),_0x40616f);queues[_0xf4cd('0x25')](_0x40616f);recordings['queuecallerjoin'](_0x40616f);}catch(_0x6db1f8){utils[_0xf4cd('0x13')](util['format'](_0xf4cd('0x26'),_0x40616f[_0xf4cd('0x1c')]),_0x6db1f8);}});ami['on']('queuecallerleave',function(_0x39a893){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x27'),_0x39a893['uniqueid']),_0x39a893);queues['queuecallerleave'](_0x39a893);}catch(_0x418094){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')](_0xf4cd('0x27'),_0x39a893['uniqueid']),_0x418094);}});ami['on'](_0xf4cd('0x28'),function(_0x30645f){try{utils[_0xf4cd('0x1a')](util['format'](_0xf4cd('0x29'),_0x30645f[_0xf4cd('0x1c')]),_0x30645f);queues['musiconholdstart'](_0x30645f);calls[_0xf4cd('0x28')](_0x30645f);}catch(_0x340191){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')](_0xf4cd('0x29'),_0x30645f[_0xf4cd('0x1c')]),_0x340191);}});ami['on'](_0xf4cd('0x2a'),function(_0x5a8fd2){try{utils[_0xf4cd('0x1a')](util['format']('[%s][index][musiconholdstop]',_0x5a8fd2['uniqueid']),_0x5a8fd2);queues[_0xf4cd('0x2a')](_0x5a8fd2);calls[_0xf4cd('0x2a')](_0x5a8fd2);}catch(_0x1d2dac){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')]('[%s][index][musiconholdstop]',_0x5a8fd2['uniqueid']),_0x1d2dac);}});ami['on'](_0xf4cd('0x2b'),function(_0x2a58cd){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x2c'),_0x2a58cd[_0xf4cd('0x1c')]),_0x2a58cd);calls[_0xf4cd('0x2b')](_0x2a58cd);recordings[_0xf4cd('0x2b')](_0x2a58cd);}catch(_0x386dd4){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')](_0xf4cd('0x2c'),_0x2a58cd[_0xf4cd('0x1c')]),_0x386dd4);}});ami['on'](_0xf4cd('0x2d'),function(_0x543c70){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x2e'),_0x543c70[_0xf4cd('0x1c')]),_0x543c70);calls[_0xf4cd('0x2d')](_0x543c70);recordings[_0xf4cd('0x2d')](_0x543c70);dials['hangup'](_0x543c70);agents[_0xf4cd('0x2d')](_0x543c70);queues['hangup'](_0x543c70);}catch(_0x140390){utils['error'](util[_0xf4cd('0x18')]('[%s][index][hangup]',_0x543c70[_0xf4cd('0x1c')]),_0x140390);}});ami['on']('cdr',function(_0x326176){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x2f'),_0x326176[_0xf4cd('0x1c')]),_0x326176);members['cdr'](_0x326176);}catch(_0x489913){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')](_0xf4cd('0x2f'),_0x326176['uniqueid']),_0x489913);}});ami['on'](_0xf4cd('0x30'),function(_0x41becb){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x31'),_0x41becb[_0xf4cd('0x1c')]),_0x41becb);queues[_0xf4cd('0x30')](_0x41becb);agents[_0xf4cd('0x30')](_0x41becb);transfers[_0xf4cd('0x30')](_0x41becb);}catch(_0x58e4dc){utils[_0xf4cd('0x13')](util['format'](_0xf4cd('0x31'),_0x41becb[_0xf4cd('0x1c')]),_0x58e4dc);}});ami['on'](_0xf4cd('0x32'),function(_0x75d5c5){try{utils['debug'](util[_0xf4cd('0x18')]('[%s][index][attendedtransfer]',_0x75d5c5[_0xf4cd('0x33')]),_0x75d5c5);queues['attendedtransfer'](_0x75d5c5);transfers[_0xf4cd('0x32')](_0x75d5c5);agents[_0xf4cd('0x32')](_0x75d5c5);calls['attendedtransfer'](_0x75d5c5);}catch(_0xda2ecb){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')](_0xf4cd('0x34'),_0x75d5c5[_0xf4cd('0x33')]),_0xda2ecb);}});ami['on']('varset',function(_0x4d8f06){try{utils['debug'](util['format'](_0xf4cd('0x35'),_0x4d8f06['uniqueid']),_0x4d8f06);queues[_0xf4cd('0x36')](_0x4d8f06);recordings[_0xf4cd('0x36')](_0x4d8f06);calls[_0xf4cd('0x36')](_0x4d8f06);dials[_0xf4cd('0x36')](_0x4d8f06);}catch(_0x1b63cd){utils[_0xf4cd('0x13')](util['format'](_0xf4cd('0x35'),_0x4d8f06[_0xf4cd('0x1c')]),_0x1b63cd);}});ami['on']('newexten',function(_0x17b39e){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x37'),_0x17b39e[_0xf4cd('0x1c')]),_0x17b39e);calls[_0xf4cd('0x38')](_0x17b39e);recordings[_0xf4cd('0x38')](_0x17b39e);dials[_0xf4cd('0x38')](_0x17b39e);}catch(_0x249510){utils[_0xf4cd('0x13')](util['format'](_0xf4cd('0x37'),_0x17b39e[_0xf4cd('0x1c')]),_0x249510);}});ami['on'](_0xf4cd('0x39'),function(_0x624c1a){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x3a'),_0x624c1a[_0xf4cd('0x1c')]),_0x624c1a);calls[_0xf4cd('0x39')](_0x624c1a);recordings[_0xf4cd('0x39')](_0x624c1a);}catch(_0xa5c76){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')](_0xf4cd('0x3a'),_0x624c1a[_0xf4cd('0x1c')]),_0xa5c76);}});ami['on'](_0xf4cd('0x3b'),function(_0x5285b5){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x3c'),_0x5285b5[_0xf4cd('0x1c')]),_0x5285b5);dials[_0xf4cd('0x3b')](_0x5285b5);}catch(_0x9e03eb){utils[_0xf4cd('0x13')](util[_0xf4cd('0x18')](_0xf4cd('0x3d'),_0x5285b5['uniqueid']),_0x9e03eb);}});ami['on'](_0xf4cd('0x3e'),function(_0x203dcc){try{utils[_0xf4cd('0x1a')](util[_0xf4cd('0x18')](_0xf4cd('0x3f'),_0x203dcc['uniqueid']),_0x203dcc);dials[_0xf4cd('0x3e')](_0x203dcc);}catch(_0x4c056c){utils[_0xf4cd('0x13')](util['format'](_0xf4cd('0x3f'),_0x203dcc[_0xf4cd('0x1c')]),_0x4c056c);}});} \ No newline at end of file +var _0xc285=['[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','format','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','cdr','[%s][index][cdr]','blindtransfer'];(function(_0x214aa2,_0x37d96b){var _0x5ccd49=function(_0x5540ab){while(--_0x5540ab){_0x214aa2['push'](_0x214aa2['shift']());}};_0x5ccd49(++_0x37d96b);}(_0xc285,0xc7));var _0x5c28=function(_0x33a528,_0x216f14){_0x33a528=_0x33a528-0x0;var _0x168145=_0xc285[_0x33a528];return _0x168145;};var AsteriskManager=require(_0x5c28('0x0'));var config=require(_0x5c28('0x1'));var utils=require(_0x5c28('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk']['port'],config[_0x5c28('0x3')]['ip'],config[_0x5c28('0x3')]['username'],config[_0x5c28('0x3')]['password'],!![]);ami[_0x5c28('0x4')]();if(config[_0x5c28('0x5')]&&config['xdr'][_0x5c28('0x6')]){utils[_0x5c28('0x7')](_0x5c28('0x8'));}else{var agents=require('./agents.controller');var calls=require(_0x5c28('0x9'));var queues=require(_0x5c28('0xa'));var recordings=require(_0x5c28('0xb'));var members=require(_0x5c28('0xc'));var dials=require(_0x5c28('0xd'));var transfers=require(_0x5c28('0xe'));var core=require(_0x5c28('0xf'));ami['on'](_0x5c28('0x10'),core[_0x5c28('0x10')]);ami['on']('shutdown',core[_0x5c28('0x11')]);ami['on'](_0x5c28('0x12'),core[_0x5c28('0x12')]);ami['on'](_0x5c28('0x13'),core[_0x5c28('0x13')]);ami['on']('close',core[_0x5c28('0x14')]);ami['on'](_0x5c28('0x15'),core['managerevent']);ami['on'](_0x5c28('0x16'),function(_0x51162c){try{utils[_0x5c28('0x17')](util['format'](_0x5c28('0x18'),_0x51162c['device']),_0x51162c);members[_0x5c28('0x16')](_0x51162c);}catch(_0x460c56){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x18'),_0x51162c['device']),_0x460c56);}});ami['on'](_0x5c28('0x1a'),function(_0x1bee30){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')]('[%s][index][agentcalled]',_0x1bee30[_0x5c28('0x1b')]),_0x1bee30);agents[_0x5c28('0x1a')](_0x1bee30);}catch(_0x4dcad1){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][agentcalled]',_0x1bee30[_0x5c28('0x1b')]),_0x4dcad1);}});ami['on'](_0x5c28('0x1c'),function(_0x1ed7c9){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')]('[%s][index][agentringnoanswer]',_0x1ed7c9[_0x5c28('0x1b')]),_0x1ed7c9);agents[_0x5c28('0x1c')](_0x1ed7c9);}catch(_0x180627){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x1d'),_0x1ed7c9[_0x5c28('0x1b')]),_0x180627);}});ami['on'](_0x5c28('0x1e'),function(_0x138ae9){try{utils['debug'](util[_0x5c28('0x19')](_0x5c28('0x1f'),_0x138ae9[_0x5c28('0x1b')]),_0x138ae9);agents[_0x5c28('0x1e')](_0x138ae9);queues[_0x5c28('0x1e')](_0x138ae9);}catch(_0x5cdeb0){utils[_0x5c28('0x13')](util['format'](_0x5c28('0x1f'),_0x138ae9[_0x5c28('0x1b')]),_0x5cdeb0);}});ami['on'](_0x5c28('0x20'),function(_0x3176e4){try{utils['debug'](util[_0x5c28('0x19')](_0x5c28('0x21'),_0x3176e4[_0x5c28('0x1b')]),_0x3176e4);agents['agentcomplete'](_0x3176e4);queues[_0x5c28('0x20')](_0x3176e4);members['agentcomplete'](_0x3176e4);}catch(_0x48e36a){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][agentcomplete]',_0x3176e4[_0x5c28('0x1b')]),_0x48e36a);}});ami['on'](_0x5c28('0x22'),function(_0x163ab1){try{utils[_0x5c28('0x17')](util['format'](_0x5c28('0x23'),_0x163ab1[_0x5c28('0x1b')]),_0x163ab1);agents[_0x5c28('0x22')](_0x163ab1);queues[_0x5c28('0x22')](_0x163ab1);}catch(_0xbb00f4){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x23'),_0x163ab1[_0x5c28('0x1b')]),_0xbb00f4);}});ami['on'](_0x5c28('0x24'),function(_0x2a79b0){try{utils[_0x5c28('0x17')](util['format']('[%s][index][queuecallerjoin]',_0x2a79b0[_0x5c28('0x1b')]),_0x2a79b0);queues[_0x5c28('0x24')](_0x2a79b0);recordings[_0x5c28('0x24')](_0x2a79b0);}catch(_0x511c57){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][queuecallerjoin]',_0x2a79b0['uniqueid']),_0x511c57);}});ami['on'](_0x5c28('0x25'),function(_0x5ea951){try{utils['debug'](util['format'](_0x5c28('0x26'),_0x5ea951[_0x5c28('0x1b')]),_0x5ea951);queues['queuecallerleave'](_0x5ea951);}catch(_0x1e4901){utils['error'](util['format'](_0x5c28('0x26'),_0x5ea951['uniqueid']),_0x1e4901);}});ami['on']('musiconholdstart',function(_0x1ba9ac){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x27'),_0x1ba9ac[_0x5c28('0x1b')]),_0x1ba9ac);queues[_0x5c28('0x28')](_0x1ba9ac);calls['musiconholdstart'](_0x1ba9ac);}catch(_0x40fe11){utils[_0x5c28('0x13')](util['format']('[%s][index][musiconholdstart]',_0x1ba9ac[_0x5c28('0x1b')]),_0x40fe11);}});ami['on'](_0x5c28('0x29'),function(_0xf87826){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x2a'),_0xf87826['uniqueid']),_0xf87826);queues[_0x5c28('0x29')](_0xf87826);calls[_0x5c28('0x29')](_0xf87826);}catch(_0x465096){utils[_0x5c28('0x13')](util['format'](_0x5c28('0x2a'),_0xf87826['uniqueid']),_0x465096);}});ami['on']('newstate',function(_0x2c12fb){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x2b'),_0x2c12fb[_0x5c28('0x1b')]),_0x2c12fb);calls['newstate'](_0x2c12fb);recordings[_0x5c28('0x2c')](_0x2c12fb);}catch(_0x239639){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x2b'),_0x2c12fb[_0x5c28('0x1b')]),_0x239639);}});ami['on'](_0x5c28('0x2d'),function(_0x18bd1c){try{utils['debug'](util[_0x5c28('0x19')]('[%s][index][hangup]',_0x18bd1c[_0x5c28('0x1b')]),_0x18bd1c);calls[_0x5c28('0x2d')](_0x18bd1c);recordings[_0x5c28('0x2d')](_0x18bd1c);dials[_0x5c28('0x2d')](_0x18bd1c);agents[_0x5c28('0x2d')](_0x18bd1c);queues[_0x5c28('0x2d')](_0x18bd1c);}catch(_0x37ac35){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][hangup]',_0x18bd1c[_0x5c28('0x1b')]),_0x37ac35);}});ami['on'](_0x5c28('0x2e'),function(_0x559f04){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x2f'),_0x559f04['uniqueid']),_0x559f04);members[_0x5c28('0x2e')](_0x559f04);}catch(_0x283b48){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][cdr]',_0x559f04[_0x5c28('0x1b')]),_0x283b48);}});ami['on'](_0x5c28('0x30'),function(_0x3a6ae5){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')]('[%s][index][blindtransfer]',_0x3a6ae5[_0x5c28('0x1b')]),_0x3a6ae5);queues[_0x5c28('0x30')](_0x3a6ae5);agents[_0x5c28('0x30')](_0x3a6ae5);transfers[_0x5c28('0x30')](_0x3a6ae5);}catch(_0x2180e9){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x31'),_0x3a6ae5[_0x5c28('0x1b')]),_0x2180e9);}});ami['on']('attendedtransfer',function(_0x566251){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x32'),_0x566251[_0x5c28('0x33')]),_0x566251);queues[_0x5c28('0x34')](_0x566251);transfers['attendedtransfer'](_0x566251);agents[_0x5c28('0x34')](_0x566251);calls['attendedtransfer'](_0x566251);}catch(_0xd94678){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x32'),_0x566251[_0x5c28('0x33')]),_0xd94678);}});ami['on'](_0x5c28('0x35'),function(_0xbf50ae){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x36'),_0xbf50ae[_0x5c28('0x1b')]),_0xbf50ae);queues[_0x5c28('0x35')](_0xbf50ae);recordings['varset'](_0xbf50ae);calls['varset'](_0xbf50ae);dials[_0x5c28('0x35')](_0xbf50ae);}catch(_0xc3c860){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][varset]',_0xbf50ae[_0x5c28('0x1b')]),_0xc3c860);}});ami['on'](_0x5c28('0x37'),function(_0x126754){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')](_0x5c28('0x38'),_0x126754[_0x5c28('0x1b')]),_0x126754);calls[_0x5c28('0x37')](_0x126754);recordings[_0x5c28('0x37')](_0x126754);dials[_0x5c28('0x37')](_0x126754);}catch(_0x3d0125){utils['error'](util[_0x5c28('0x19')](_0x5c28('0x38'),_0x126754['uniqueid']),_0x3d0125);}});ami['on']('newchannel',function(_0x26e9d3){try{utils['debug'](util[_0x5c28('0x19')]('[%s][index][newchannel]',_0x26e9d3[_0x5c28('0x1b')]),_0x26e9d3);calls['newchannel'](_0x26e9d3);recordings[_0x5c28('0x39')](_0x26e9d3);}catch(_0x2d5c2d){utils[_0x5c28('0x13')](util[_0x5c28('0x19')]('[%s][index][newchannel]',_0x26e9d3['uniqueid']),_0x2d5c2d);}});ami['on']('dialbegin',function(_0xc135a1){try{utils['debug'](util['format'](_0x5c28('0x3a'),_0xc135a1['uniqueid']),_0xc135a1);dials['dialbegin'](_0xc135a1);}catch(_0x48e51c){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x3b'),_0xc135a1[_0x5c28('0x1b')]),_0x48e51c);}});ami['on'](_0x5c28('0x3c'),function(_0x25a9a3){try{utils[_0x5c28('0x17')](util[_0x5c28('0x19')]('[%s][index][dialend]',_0x25a9a3[_0x5c28('0x1b')]),_0x25a9a3);dials[_0x5c28('0x3c')](_0x25a9a3);}catch(_0x5758bd){utils[_0x5c28('0x13')](util[_0x5c28('0x19')](_0x5c28('0x3d'),_0x25a9a3[_0x5c28('0x1b')]),_0x5758bd);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b2103f0..a9ffed1 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 _0xc86a=['internal','request','CreateMemberReport','split','catch','error','format','[%s][members][writeDB]','some','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','data2','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','name'];(function(_0x2f2fd4,_0x323064){var _0x4f5ffe=function(_0x14382a){while(--_0x14382a){_0x2f2fd4['push'](_0x2f2fd4['shift']());}};_0x4f5ffe(++_0x323064);}(_0xc86a,0x1f0));var _0xac86=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0xc86a[_0x1b8d87];return _0x182b74;};'use strict';var _=require(_0xac86('0x0'));var util=require(_0xac86('0x1'));var utils=require('./utils');var members={};var exclude=[_0xac86('0x2'),_0xac86('0x3')];function writeDB(_0x5f0ac8){utils[_0xac86('0x4')](util['format'](_0xac86('0x5'),_0x5f0ac8[_0xac86('0x6')],_0x5f0ac8[_0xac86('0x7')],_0x5f0ac8[_0xac86('0x8')],_0x5f0ac8['data2'],_0x5f0ac8[_0xac86('0x9')],_0x5f0ac8[_0xac86('0xa')]));if(_0x5f0ac8[_0xac86('0x7')]){utils[_0xac86('0xb')](_0x5f0ac8[_0xac86('0x7')])[_0xac86('0xc')](function(_0x554707){if(_0x554707){_0x5f0ac8[_0xac86('0x9')]=_0x554707[_0xac86('0xd')];_0x5f0ac8[_0xac86('0xe')]=_0x554707[_0xac86('0xe')];utils[_0xac86('0xf')](_0xac86('0x10'),_0x5f0ac8);}else{utils['getUserByName'](_0x5f0ac8['interface'][_0xac86('0x11')]('/')[0x1])[_0xac86('0xc')](function(_0x1f4c99){if(_0x1f4c99){_0x5f0ac8[_0xac86('0x9')]=_0x1f4c99['name'];_0x5f0ac8[_0xac86('0xe')]=_0x1f4c99[_0xac86('0xe')];utils[_0xac86('0xf')]('CreateMemberReport',_0x5f0ac8);}});}})[_0xac86('0x12')](function(_0x5a2925){utils[_0xac86('0x13')](util[_0xac86('0x14')](_0xac86('0x15'),_0x5f0ac8[_0xac86('0x6')]),_0x5a2925);});}delete members[_0x5f0ac8[_0xac86('0x7')]];}function startsWith(_0x58b8c0,_0x58f490){return _[_0xac86('0x16')](_0x58b8c0,function(_0x945f6d){return _[_0xac86('0x17')](_0x58f490,_0x945f6d);});}exports['devicestatechange']=function(_0x1996f2){try{utils['debug'](util[_0xac86('0x14')](_0xac86('0x18'),members[_0x1996f2[_0xac86('0x19')]]?members[_0x1996f2[_0xac86('0x19')]][_0xac86('0x6')]:_0x1996f2['device']),_0x1996f2);utils['info'](util[_0xac86('0x14')](_0xac86('0x1a'),members[_0x1996f2[_0xac86('0x19')]]?members[_0x1996f2[_0xac86('0x19')]][_0xac86('0x6')]:_0x1996f2[_0xac86('0x19')],_0x1996f2[_0xac86('0x1b')],_0x1996f2[_0xac86('0x19')]));switch(_0x1996f2['state']){case _0xac86('0x1c'):case _0xac86('0x1d'):if(!startsWith(exclude,_0x1996f2['device'])){members[_0x1996f2[_0xac86('0x19')]]={'channel':_0xac86('0x1e'),'interface':_0x1996f2[_0xac86('0x19')],'type':_0xac86('0x1f'),'enterAt':utils[_0xac86('0x20')](),'role':_0xac86('0x21')};}break;case _0xac86('0x22'):if(!_['isNil'](members[_0x1996f2['device']])){members[_0x1996f2[_0xac86('0x19')]][_0xac86('0x23')]=utils[_0xac86('0x20')]();members[_0x1996f2[_0xac86('0x19')]][_0xac86('0x24')]=utils['diffTime'](members[_0x1996f2[_0xac86('0x19')]]['exitAt'],members[_0x1996f2[_0xac86('0x19')]]['enterAt']);if(members[_0x1996f2[_0xac86('0x19')]][_0xac86('0x6')]){writeDB(members[_0x1996f2[_0xac86('0x19')]]);}}break;default:break;}}catch(_0xd04ce6){utils[_0xac86('0x13')](util['format'](_0xac86('0x18'),members[_0x1996f2[_0xac86('0x19')]]?members[_0x1996f2[_0xac86('0x19')]]['uniqueid']:_0x1996f2[_0xac86('0x19')]),_0xd04ce6);}};exports[_0xac86('0x25')]=function(_0x5931ea){try{if(!_[_0xac86('0x26')](members[_0x5931ea[_0xac86('0x7')]])){utils['debug'](util['format'](_0xac86('0x27'),_0x5931ea[_0xac86('0x6')]),_0x5931ea);utils['info'](util[_0xac86('0x14')](_0xac86('0x28'),_0x5931ea[_0xac86('0x6')],_0x5931ea[_0xac86('0x7')],_0x5931ea[_0xac86('0x29')]));members[_0x5931ea[_0xac86('0x7')]]=_[_0xac86('0x2a')](members[_0x5931ea[_0xac86('0x7')]],{'data4':_0x5931ea['queue'],'uniqueid':_0x5931ea[_0xac86('0x6')]});}}catch(_0x2ef70c){utils[_0xac86('0x13')](util['format']('[%s][members][agentcomplete]',_0x5931ea[_0xac86('0x6')]),_0x2ef70c);}};exports[_0xac86('0x2b')]=function(_0x34cb67){try{utils['debug'](util[_0xac86('0x14')]('[%s][members][cdr]',_0x34cb67[_0xac86('0x6')]),_0x34cb67);if(_0x34cb67[_0xac86('0x8')]){var _0xb04286=_0x34cb67['channel']['split']('-')[0x0];if(!_['isNil'](members[_0xb04286])){members[_0xb04286]=_[_0xac86('0x2a')](members[_0xb04286],{'data1':members[_0xb04286][_0xac86('0x2c')]||_0x34cb67[_0xac86('0xa')],'data2':members[_0xb04286][_0xac86('0x2d')]||_0x34cb67[_0xac86('0x2e')],'data3':members[_0xb04286]['data3']||_0x34cb67[_0xac86('0x2f')],'uniqueid':members[_0xb04286]['uniqueid']||_0x34cb67['uniqueid']});utils[_0xac86('0x4')](util[_0xac86('0x14')](_0xac86('0x30'),_0x34cb67[_0xac86('0x6')],members[_0xb04286][_0xac86('0x2c')],members[_0xb04286][_0xac86('0x2d')],members[_0xb04286][_0xac86('0x31')]));if(members[_0xb04286][_0xac86('0x23')]){writeDB(members[_0xb04286]);}}}if(_0x34cb67[_0xac86('0x32')]){var _0x235a96=_0x34cb67[_0xac86('0x32')]['split']('-')[0x0];if(!_['isNil'](members[_0x235a96])){members[_0x235a96]=_[_0xac86('0x2a')](members[_0x235a96],{'data1':members[_0x235a96][_0xac86('0x2c')]||_0x34cb67[_0xac86('0xa')],'data2':members[_0x235a96][_0xac86('0x2d')]||_0x34cb67[_0xac86('0x2e')],'data3':members[_0x235a96]['data3']||_0x34cb67['destination'],'uniqueid':members[_0x235a96][_0xac86('0x6')]||_0x34cb67[_0xac86('0x6')]});utils[_0xac86('0x4')](util[_0xac86('0x14')](_0xac86('0x30'),_0x34cb67[_0xac86('0x6')],members[_0x235a96][_0xac86('0x2c')],members[_0x235a96]['data2'],members[_0x235a96][_0xac86('0x31')]));if(members[_0x235a96]['exitAt']){writeDB(members[_0x235a96]);}}}}catch(_0x5f4938){utils[_0xac86('0x13')](util[_0xac86('0x14')]('[%s][members][cdr]',_0x34cb67[_0xac86('0x6')]),_0x5f4938);}}; \ No newline at end of file +var _0x2828=['duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','channel','split','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','assign','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','error','format','[%s][members][writeDB]','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt'];(function(_0x36888d,_0x22988e){var _0x14f524=function(_0x5cdbfe){while(--_0x5cdbfe){_0x36888d['push'](_0x36888d['shift']());}};_0x14f524(++_0x22988e);}(_0x2828,0x1dc));var _0x8282=function(_0x1f930e,_0x24c403){_0x1f930e=_0x1f930e-0x0;var _0x5bfa2b=_0x2828[_0x1f930e];return _0x5bfa2b;};'use strict';var _=require('lodash');var util=require(_0x8282('0x0'));var utils=require(_0x8282('0x1'));var members={};var exclude=[_0x8282('0x2'),_0x8282('0x3')];function writeDB(_0x3a01da){utils[_0x8282('0x4')](util['format'](_0x8282('0x5'),_0x3a01da['uniqueid'],_0x3a01da[_0x8282('0x6')],_0x3a01da['channel'],_0x3a01da[_0x8282('0x7')],_0x3a01da[_0x8282('0x8')],_0x3a01da[_0x8282('0x9')]));if(_0x3a01da[_0x8282('0x6')]){utils[_0x8282('0xa')](_0x3a01da['interface'])[_0x8282('0xb')](function(_0x1fb604){if(_0x1fb604){_0x3a01da[_0x8282('0x8')]=_0x1fb604[_0x8282('0xc')];_0x3a01da[_0x8282('0xd')]=_0x1fb604[_0x8282('0xd')];utils[_0x8282('0xe')]('CreateMemberReport',_0x3a01da);}else{utils[_0x8282('0xf')](_0x3a01da[_0x8282('0x6')]['split']('/')[0x1])[_0x8282('0xb')](function(_0x1aa09a){if(_0x1aa09a){_0x3a01da[_0x8282('0x8')]=_0x1aa09a['name'];_0x3a01da[_0x8282('0xd')]=_0x1aa09a[_0x8282('0xd')];utils[_0x8282('0xe')]('CreateMemberReport',_0x3a01da);}});}})['catch'](function(_0x3a04b7){utils[_0x8282('0x10')](util[_0x8282('0x11')](_0x8282('0x12'),_0x3a01da[_0x8282('0x13')]),_0x3a04b7);});}delete members[_0x3a01da[_0x8282('0x6')]];}function startsWith(_0x4e7e84,_0x271758){return _[_0x8282('0x14')](_0x4e7e84,function(_0x320820){return _['startsWith'](_0x271758,_0x320820);});}exports[_0x8282('0x15')]=function(_0x26c70d){try{utils[_0x8282('0x16')](util[_0x8282('0x11')](_0x8282('0x17'),members[_0x26c70d[_0x8282('0x18')]]?members[_0x26c70d['device']]['uniqueid']:_0x26c70d['device']),_0x26c70d);utils['info'](util[_0x8282('0x11')](_0x8282('0x19'),members[_0x26c70d[_0x8282('0x18')]]?members[_0x26c70d[_0x8282('0x18')]]['uniqueid']:_0x26c70d[_0x8282('0x18')],_0x26c70d['state'],_0x26c70d[_0x8282('0x18')]));switch(_0x26c70d['state']){case'INUSE':case _0x8282('0x1a'):if(!startsWith(exclude,_0x26c70d[_0x8282('0x18')])){members[_0x26c70d['device']]={'channel':_0x8282('0x1b'),'interface':_0x26c70d[_0x8282('0x18')],'type':_0x8282('0x1c'),'enterAt':utils[_0x8282('0x1d')](),'role':_0x8282('0x1e')};}break;case _0x8282('0x1f'):if(!_[_0x8282('0x20')](members[_0x26c70d[_0x8282('0x18')]])){members[_0x26c70d[_0x8282('0x18')]][_0x8282('0x21')]=utils[_0x8282('0x1d')]();members[_0x26c70d[_0x8282('0x18')]][_0x8282('0x22')]=utils[_0x8282('0x23')](members[_0x26c70d[_0x8282('0x18')]]['exitAt'],members[_0x26c70d[_0x8282('0x18')]]['enterAt']);if(members[_0x26c70d[_0x8282('0x18')]][_0x8282('0x13')]){writeDB(members[_0x26c70d[_0x8282('0x18')]]);}}break;default:break;}}catch(_0x592efa){utils[_0x8282('0x10')](util[_0x8282('0x11')](_0x8282('0x17'),members[_0x26c70d['device']]?members[_0x26c70d['device']][_0x8282('0x13')]:_0x26c70d['device']),_0x592efa);}};exports[_0x8282('0x24')]=function(_0x561bc1){try{if(!_['isNil'](members[_0x561bc1[_0x8282('0x6')]])){utils[_0x8282('0x16')](util['format'](_0x8282('0x25'),_0x561bc1[_0x8282('0x13')]),_0x561bc1);utils[_0x8282('0x4')](util[_0x8282('0x11')](_0x8282('0x26'),_0x561bc1[_0x8282('0x13')],_0x561bc1['interface'],_0x561bc1[_0x8282('0x27')]));members[_0x561bc1[_0x8282('0x6')]]=_['assign'](members[_0x561bc1['interface']],{'data4':_0x561bc1[_0x8282('0x27')],'uniqueid':_0x561bc1[_0x8282('0x13')]});}}catch(_0x4eb55d){utils['error'](util[_0x8282('0x11')](_0x8282('0x25'),_0x561bc1[_0x8282('0x13')]),_0x4eb55d);}};exports[_0x8282('0x28')]=function(_0x45dd08){try{utils[_0x8282('0x16')](util[_0x8282('0x11')](_0x8282('0x29'),_0x45dd08[_0x8282('0x13')]),_0x45dd08);if(_0x45dd08[_0x8282('0x2a')]){var _0x230ec4=_0x45dd08[_0x8282('0x2a')][_0x8282('0x2b')]('-')[0x0];if(!_['isNil'](members[_0x230ec4])){members[_0x230ec4]=_['assign'](members[_0x230ec4],{'data1':members[_0x230ec4][_0x8282('0x2c')]||_0x45dd08[_0x8282('0x9')],'data2':members[_0x230ec4][_0x8282('0x7')]||_0x45dd08[_0x8282('0x2d')],'data3':members[_0x230ec4][_0x8282('0x2e')]||_0x45dd08[_0x8282('0x2f')],'uniqueid':members[_0x230ec4][_0x8282('0x13')]||_0x45dd08[_0x8282('0x13')]});utils[_0x8282('0x4')](util[_0x8282('0x11')](_0x8282('0x30'),_0x45dd08[_0x8282('0x13')],members[_0x230ec4][_0x8282('0x2c')],members[_0x230ec4][_0x8282('0x7')],members[_0x230ec4][_0x8282('0x2e')]));if(members[_0x230ec4][_0x8282('0x21')]){writeDB(members[_0x230ec4]);}}}if(_0x45dd08[_0x8282('0x31')]){var _0x4095bf=_0x45dd08[_0x8282('0x31')][_0x8282('0x2b')]('-')[0x0];if(!_[_0x8282('0x20')](members[_0x4095bf])){members[_0x4095bf]=_[_0x8282('0x32')](members[_0x4095bf],{'data1':members[_0x4095bf]['data1']||_0x45dd08[_0x8282('0x9')],'data2':members[_0x4095bf][_0x8282('0x7')]||_0x45dd08['source'],'data3':members[_0x4095bf][_0x8282('0x2e')]||_0x45dd08[_0x8282('0x2f')],'uniqueid':members[_0x4095bf][_0x8282('0x13')]||_0x45dd08[_0x8282('0x13')]});utils[_0x8282('0x4')](util[_0x8282('0x11')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x45dd08['uniqueid'],members[_0x4095bf][_0x8282('0x2c')],members[_0x4095bf][_0x8282('0x7')],members[_0x4095bf][_0x8282('0x2e')]));if(members[_0x4095bf][_0x8282('0x21')]){writeDB(members[_0x4095bf]);}}}}catch(_0x337bb5){utils[_0x8282('0x10')](util[_0x8282('0x11')](_0x8282('0x29'),_0x45dd08['uniqueid']),_0x337bb5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f41c752..8633148 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 _0x6403=['transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','queuecallerjoinAt','position','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension'];(function(_0x157d23,_0x490772){var _0x24c901=function(_0x151ca3){while(--_0x151ca3){_0x157d23['push'](_0x157d23['shift']());}};_0x24c901(++_0x490772);}(_0x6403,0x80));var _0x3640=function(_0x516336,_0x535c34){_0x516336=_0x516336-0x0;var _0x2f1156=_0x6403[_0x516336];return _0x2f1156;};'use strict';var _=require(_0x3640('0x0'));var util=require(_0x3640('0x1'));var utils=require(_0x3640('0x2'));var queues={};function writeDB(_0x1475c7){utils[_0x3640('0x3')](util['format'](_0x3640('0x4'),_0x1475c7['uniqueid'],_0x1475c7[_0x3640('0x5')],_0x1475c7[_0x3640('0x6')],_0x1475c7[_0x3640('0x7')],_0x1475c7['calleridnum'],_0x1475c7[_0x3640('0x8')],_0x1475c7[_0x3640('0x9')]));if(_0x1475c7[_0x3640('0x6')]){utils['getVoiceQueueByName'](_0x1475c7[_0x3640('0x6')])[_0x3640('0xa')](function(_0x5393df){if(_0x5393df){_0x1475c7['type']=_0x5393df[_0x3640('0xb')];}utils[_0x3640('0xc')](_0x3640('0xd'),_0x1475c7);});}else{utils[_0x3640('0xc')](_0x3640('0xd'),_0x1475c7);}if(_0x1475c7[_0x3640('0xe')]){delete queues[_0x1475c7[_0x3640('0xe')]];}else{delete queues[_0x1475c7['uniqueid']];}}exports[_0x3640('0xf')]=function(_0xfaf484){try{utils['debug'](util[_0x3640('0x10')](_0x3640('0x11'),_0xfaf484[_0x3640('0x12')]),_0xfaf484);utils[_0x3640('0x3')](util[_0x3640('0x10')](_0x3640('0x13'),_0xfaf484[_0x3640('0x12')],_0xfaf484[_0x3640('0x6')],_0xfaf484['position']));queues[_0xfaf484['uniqueid']]=_[_0x3640('0x14')](_0xfaf484,{'originalposition':_0xfaf484['position'],'queuecallerjoinAt':utils[_0x3640('0x15')](),'mohtime':0x0});}catch(_0x3eab85){utils[_0x3640('0x16')](util[_0x3640('0x10')](_0x3640('0x11'),_0xfaf484[_0x3640('0x12')]),_0x3eab85);}};exports[_0x3640('0x17')]=function(_0xb2329a){try{if(!_[_0x3640('0x18')](queues[_0xb2329a[_0x3640('0x12')]])){utils[_0x3640('0x19')](util[_0x3640('0x10')](_0x3640('0x1a'),_0xb2329a[_0x3640('0x12')]),_0xb2329a);if(queues[_0xb2329a['uniqueid']]['queuecallerleaveAt']){if(!queues[_0xb2329a[_0x3640('0x12')]][_0x3640('0x1b')]&&!queues[_0xb2329a[_0x3640('0x12')]][_0x3640('0x1c')]){queues[_0xb2329a[_0x3640('0x12')]]['queuecallercomplete']=!![];queues[_0xb2329a['uniqueid']]['queuecallercompleteAt']=utils[_0x3640('0x15')]();queues[_0xb2329a[_0x3640('0x12')]][_0x3640('0x9')]=_0x3640('0x1d');}utils['info'](util[_0x3640('0x10')](_0x3640('0x1e'),_0xb2329a[_0x3640('0x12')],queues[_0xb2329a[_0x3640('0x12')]][_0x3640('0x1f')],queues[_0xb2329a[_0x3640('0x12')]][_0x3640('0x9')]));writeDB(queues[_0xb2329a[_0x3640('0x12')]]);}else if(queues[_0xb2329a[_0x3640('0x12')]][_0x3640('0xe')]){utils[_0x3640('0x3')](util[_0x3640('0x10')](_0x3640('0x20'),_0xb2329a[_0x3640('0x12')],queues[_0xb2329a[_0x3640('0x12')]]['name'],queues[_0xb2329a['uniqueid']][_0x3640('0xe')]));queues[queues[_0xb2329a[_0x3640('0x12')]][_0x3640('0xe')]]=queues[_0xb2329a[_0x3640('0x12')]];queues[queues[_0xb2329a[_0x3640('0x12')]][_0x3640('0xe')]][_0x3640('0x21')]=0x2;delete queues[_0xb2329a[_0x3640('0x12')]];}}}catch(_0x40156d){utils['error'](util[_0x3640('0x10')]('[%s][queues][hangup]',_0xb2329a[_0x3640('0x12')]),_0x40156d);}};exports['varset']=function(_0x31c349){try{utils[_0x3640('0x19')](util['format'](_0x3640('0x22'),_0x31c349[_0x3640('0x12')]),_0x31c349);if(!_[_0x3640('0x18')](_0x31c349[_0x3640('0x23')]['queuestatus'])&&_0x31c349['value']['toUpperCase']()!==_0x3640('0x24')){if(!_[_0x3640('0x18')](queues[_0x31c349[_0x3640('0x12')]])){queues[_0x31c349[_0x3640('0x12')]]['queuecallerabandon']=![];queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x25')]=null;queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x1c')]=!![];queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x26')]=utils[_0x3640('0x15')]();queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x9')]=_0x31c349[_0x3640('0x27')][_0x3640('0x28')]();utils[_0x3640('0x3')](util[_0x3640('0x10')](_0x3640('0x29'),_0x31c349[_0x3640('0x12')],queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x1f')],_0x31c349[_0x3640('0x27')],queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x9')]));writeDB(queues[_0x31c349[_0x3640('0x12')]]);}}else if(!_[_0x3640('0x18')](_0x31c349[_0x3640('0x23')][_0x3640('0x2a')])){if(!_[_0x3640('0x18')](queues[_0x31c349[_0x3640('0x12')]])&&!queues[_0x31c349['uniqueid']]['queuecallerabandon']){queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x1b')]=![];queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x25')]=null;queues[_0x31c349['uniqueid']][_0x3640('0x1c')]=!![];queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x26')]=utils['now']();queues[_0x31c349['uniqueid']][_0x3640('0x9')]=_0x3640('0x2b');utils[_0x3640('0x3')](util['format'](_0x3640('0x2c'),_0x31c349[_0x3640('0x12')],queues[_0x31c349[_0x3640('0x12')]]['name'],_0x31c349[_0x3640('0x27')],queues[_0x31c349[_0x3640('0x12')]][_0x3640('0x9')]));}}}catch(_0x1a4e10){utils[_0x3640('0x16')](util[_0x3640('0x10')]('[%s][queues][varset]',_0x31c349['uniqueid']),_0x1a4e10);}};exports['queuecallerabandon']=function(_0x1db3f5){try{if(!_[_0x3640('0x18')](queues[_0x1db3f5[_0x3640('0x12')]])){utils[_0x3640('0x19')](util[_0x3640('0x10')](_0x3640('0x2d'),_0x1db3f5['uniqueid']),_0x1db3f5);queues[_0x1db3f5[_0x3640('0x12')]][_0x3640('0x1c')]=![];queues[_0x1db3f5['uniqueid']][_0x3640('0x26')]=null;queues[_0x1db3f5['uniqueid']][_0x3640('0x1b')]=!![];queues[_0x1db3f5[_0x3640('0x12')]][_0x3640('0x25')]=utils['now']();queues[_0x1db3f5[_0x3640('0x12')]][_0x3640('0x9')]=_0x3640('0x2e');utils['info'](util[_0x3640('0x10')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1db3f5[_0x3640('0x12')],queues[_0x1db3f5[_0x3640('0x12')]][_0x3640('0x1f')],queues[_0x1db3f5[_0x3640('0x12')]][_0x3640('0x9')]));}}catch(_0x47294d){utils[_0x3640('0x16')](util[_0x3640('0x10')](_0x3640('0x2d'),_0x1db3f5[_0x3640('0x12')]),_0x47294d);}};exports[_0x3640('0x2f')]=function(_0x1c65a3){try{if(!_[_0x3640('0x18')](queues[_0x1c65a3[_0x3640('0x12')]])){utils[_0x3640('0x19')](util['format'](_0x3640('0x30'),_0x1c65a3[_0x3640('0x12')]),_0x1c65a3);utils['info'](util['format'](_0x3640('0x31'),_0x1c65a3[_0x3640('0x12')],queues[_0x1c65a3[_0x3640('0x12')]][_0x3640('0x1f')],_0x1c65a3[_0x3640('0x32')],_0x1c65a3[_0x3640('0x33')]));queues[_0x1c65a3[_0x3640('0x12')]][_0x3640('0x2f')]=!![];queues[_0x1c65a3[_0x3640('0x12')]][_0x3640('0x34')]=utils[_0x3640('0x15')]();queues[_0x1c65a3[_0x3640('0x12')]][_0x3640('0x35')]=utils['diffTime'](queues[_0x1c65a3[_0x3640('0x12')]]['queuecallerleaveAt'],queues[_0x1c65a3[_0x3640('0x12')]][_0x3640('0x36')]);queues[_0x1c65a3[_0x3640('0x12')]][_0x3640('0x37')]=_0x1c65a3[_0x3640('0x37')];queues[_0x1c65a3['uniqueid']][_0x3640('0x38')]=_0x1c65a3[_0x3640('0x38')];queues[_0x1c65a3['uniqueid']][_0x3640('0x32')]=_0x1c65a3[_0x3640('0x32')];queues[_0x1c65a3[_0x3640('0x12')]][_0x3640('0x33')]=_0x1c65a3[_0x3640('0x33')];}}catch(_0x245522){utils[_0x3640('0x16')](util['format'](_0x3640('0x30'),_0x1c65a3[_0x3640('0x12')]),_0x245522);}};exports[_0x3640('0x39')]=function(_0x5c7f34){try{if(!_[_0x3640('0x18')](queues[_0x5c7f34[_0x3640('0x12')]])){utils['debug'](util['format'](_0x3640('0x3a'),_0x5c7f34[_0x3640('0x12')]),_0x5c7f34);utils[_0x3640('0x3')](util[_0x3640('0x10')](_0x3640('0x3b'),_0x5c7f34[_0x3640('0x12')],queues[_0x5c7f34[_0x3640('0x12')]]['name'],_0x5c7f34['membername'],_0x5c7f34[_0x3640('0x3c')]));queues[_0x5c7f34[_0x3640('0x12')]][_0x3640('0x1b')]=![];queues[_0x5c7f34['uniqueid']][_0x3640('0x1b')]=![];queues[_0x5c7f34[_0x3640('0x12')]][_0x3640('0x25')]=null;queues[_0x5c7f34[_0x3640('0x12')]]['queuecallerexit']=![];queues[_0x5c7f34[_0x3640('0x12')]][_0x3640('0x9')]=null;queues[_0x5c7f34['uniqueid']][_0x3640('0x26')]=null;queues[_0x5c7f34[_0x3640('0x12')]]['assigned']=!![];queues[_0x5c7f34[_0x3640('0x12')]][_0x3640('0x8')]=_0x5c7f34[_0x3640('0x3c')];queues[_0x5c7f34[_0x3640('0x12')]][_0x3640('0x7')]=_0x5c7f34[_0x3640('0x3d')];}}catch(_0x45e5b3){utils[_0x3640('0x16')](util[_0x3640('0x10')](_0x3640('0x3a'),_0x5c7f34['uniqueid']),_0x45e5b3);}};exports[_0x3640('0x3e')]=function(_0x49f08f){try{if(!_['isNil'](queues[_0x49f08f[_0x3640('0x12')]])){if(queues[_0x49f08f['uniqueid']][_0x3640('0x34')]){utils[_0x3640('0x19')](util[_0x3640('0x10')](_0x3640('0x3f'),_0x49f08f[_0x3640('0x12')]),_0x49f08f);queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x1b')]=![];queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x1b')]=![];queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x25')]=null;queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x1c')]=![];queues[_0x49f08f['uniqueid']]['queuecallerexitAt']=null;queues[_0x49f08f[_0x3640('0x12')]]['assigned']=!![];queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x7')]=_0x49f08f['membername'];queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x40')]=!![];queues[_0x49f08f['uniqueid']][_0x3640('0x41')]=utils['now']();if(_0x49f08f[_0x3640('0x42')]==_0x3640('0x43')){if(!queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x43')]){queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x9')]='TRANSFER';}}else{queues[_0x49f08f[_0x3640('0x12')]]['queuecallerexitreason']=_0x3640('0x44')+_0x49f08f[_0x3640('0x42')]['toUpperCase']();}utils['info'](util[_0x3640('0x10')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x49f08f[_0x3640('0x12')],queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x1f')],_0x49f08f[_0x3640('0x3d')],queues[_0x49f08f[_0x3640('0x12')]][_0x3640('0x9')]));writeDB(queues[_0x49f08f[_0x3640('0x12')]]);}}}catch(_0x50b72e){utils[_0x3640('0x16')](util[_0x3640('0x10')](_0x3640('0x3f'),_0x49f08f['uniqueid']),_0x50b72e);}};exports[_0x3640('0x45')]=function(_0x100841){try{if(!_[_0x3640('0x18')](queues[_0x100841[_0x3640('0x46')]])){utils[_0x3640('0x19')](util[_0x3640('0x10')](_0x3640('0x47'),_0x100841[_0x3640('0x12')]),_0x100841);queues[_0x100841[_0x3640('0x46')]][_0x3640('0x43')]=!![];queues[_0x100841[_0x3640('0x46')]][_0x3640('0x48')]=_0x3640('0x49');queues[_0x100841[_0x3640('0x46')]][_0x3640('0x4a')]=_0x100841[_0x3640('0x4b')];queues[_0x100841[_0x3640('0x46')]][_0x3640('0x4c')]=_0x100841[_0x3640('0x46')];queues[_0x100841[_0x3640('0x46')]]['queuecallerexitreason']=_0x3640('0x4d');utils[_0x3640('0x3')](util['format'](_0x3640('0x4e'),_0x100841[_0x3640('0x12')],queues[_0x100841['transfereeuniqueid']][_0x3640('0x1f')],_0x100841[_0x3640('0x46')],_0x100841['extension']));}}catch(_0x2e9dc5){utils[_0x3640('0x16')](util[_0x3640('0x10')](_0x3640('0x47'),_0x100841[_0x3640('0x12')]),_0x2e9dc5);}};exports['attendedtransfer']=function(_0x223fea){try{utils[_0x3640('0x19')](util[_0x3640('0x10')](_0x3640('0x4f'),_0x223fea[_0x3640('0x50')]),_0x223fea);if(_0x223fea[_0x3640('0x50')]==_0x223fea[_0x3640('0x51')]){if(!_[_0x3640('0x18')](queues[_0x223fea['secondtransfererlinkedid']])){utils[_0x3640('0x3')](util[_0x3640('0x10')](_0x3640('0x52'),_0x223fea['origtransfereruniqueid'],queues[_0x223fea[_0x3640('0x53')]][_0x3640('0x1f')],_0x223fea['origtransfererexten']));queues[_0x223fea[_0x3640('0x53')]][_0x3640('0x43')]=!![];queues[_0x223fea['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x223fea['secondtransfererlinkedid']][_0x3640('0x4a')]=_0x223fea['origtransfererexten'];queues[_0x223fea[_0x3640('0x53')]][_0x3640('0x4c')]=_0x223fea[_0x3640('0x50')];queues[_0x223fea['secondtransfererlinkedid']][_0x3640('0x9')]=_0x3640('0x54');}if(!_['isNil'](queues[_0x223fea[_0x3640('0x51')]])){if(_0x223fea['transfereelinkedid']&&queues[_0x223fea[_0x3640('0x55')]]){queues[_0x223fea[_0x3640('0x55')]]['queuecallerenterreason']=0x1;queues[_0x223fea[_0x3640('0x46')]]=_[_0x3640('0x56')](queues[_0x223fea['transfereelinkedid']]);queues[_0x223fea[_0x3640('0x46')]][_0x3640('0xe')]=_0x223fea['transfertargetuniqueid'];queues[_0x223fea[_0x3640('0x46')]]['queuecallerenterreason']=0x2;queues[_0x223fea[_0x3640('0x46')]][_0x3640('0x57')]=queues[_0x223fea[_0x3640('0x53')]][_0x3640('0x57')];queues[_0x223fea[_0x3640('0x46')]][_0x3640('0x58')]=queues[_0x223fea[_0x3640('0x53')]]['calleridname'];queues[_0x223fea[_0x3640('0x46')]][_0x3640('0x36')]=utils[_0x3640('0x15')]();queues[_0x223fea[_0x3640('0x46')]][_0x3640('0x34')]=utils[_0x3640('0x15')]();queues[_0x223fea['transfereeuniqueid']][_0x3640('0x35')]=0x0;queues[_0x223fea[_0x3640('0x46')]][_0x3640('0x59')]=0x0;utils[_0x3640('0x3')](util[_0x3640('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x223fea[_0x3640('0x50')],queues[_0x223fea[_0x3640('0x46')]][_0x3640('0x1f')],queues[_0x223fea[_0x3640('0x46')]][_0x3640('0x57')],queues[_0x223fea['transfereeuniqueid']][_0x3640('0x58')]));}else{utils[_0x3640('0x3')](util[_0x3640('0x10')](_0x3640('0x5a'),_0x223fea[_0x3640('0x50')],queues[_0x223fea[_0x3640('0x51')]][_0x3640('0x1f')],_0x223fea['secondtransfererlinkedid']));queues[_0x223fea[_0x3640('0x51')]]['transfereduniqueid']=_0x223fea[_0x3640('0x53')];}}}else if(_0x223fea[_0x3640('0x5b')]==_0x223fea['secondtransfererlinkedid']){if(!_[_0x3640('0x18')](queues[_0x223fea[_0x3640('0x51')]])){utils[_0x3640('0x3')](util[_0x3640('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x223fea['origtransfereruniqueid'],queues[_0x223fea['origtransfererlinkedid']][_0x3640('0x1f')],_0x223fea[_0x3640('0x5b')],_0x223fea[_0x3640('0x5c')]));queues[_0x223fea[_0x3640('0x51')]][_0x3640('0x43')]=!![];queues[_0x223fea[_0x3640('0x51')]][_0x3640('0x48')]=_0x3640('0x5d');queues[_0x223fea[_0x3640('0x51')]][_0x3640('0x4a')]=_0x223fea[_0x3640('0x5c')];queues[_0x223fea[_0x3640('0x51')]][_0x3640('0x4c')]=_0x223fea['secondtransfereruniqueid'];queues[_0x223fea[_0x3640('0x51')]][_0x3640('0x9')]=_0x3640('0x54');}if(!_['isNil'](queues[_0x223fea[_0x3640('0x53')]])){if(_0x223fea[_0x3640('0x5e')]&&queues[_0x223fea[_0x3640('0x5e')]]){queues[_0x223fea[_0x3640('0x5e')]][_0x3640('0x21')]=0x1;queues[_0x223fea['transfertargetuniqueid']]=_[_0x3640('0x56')](queues[_0x223fea[_0x3640('0x5e')]]);queues[_0x223fea[_0x3640('0x5f')]][_0x3640('0xe')]=_0x223fea['transfertargetuniqueid'];queues[_0x223fea['transfertargetuniqueid']][_0x3640('0x21')]=0x2;queues[_0x223fea[_0x3640('0x5f')]][_0x3640('0x57')]=queues[_0x223fea[_0x3640('0x51')]]['calleridnum'];queues[_0x223fea[_0x3640('0x5f')]][_0x3640('0x58')]=queues[_0x223fea[_0x3640('0x51')]][_0x3640('0x58')];queues[_0x223fea['transfertargetuniqueid']][_0x3640('0x36')]=utils['now']();queues[_0x223fea[_0x3640('0x5f')]][_0x3640('0x34')]=utils[_0x3640('0x15')]();queues[_0x223fea['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x223fea[_0x3640('0x5f')]][_0x3640('0x59')]=0x0;utils[_0x3640('0x3')](util[_0x3640('0x10')](_0x3640('0x60'),_0x223fea['origtransfereruniqueid'],queues[_0x223fea[_0x3640('0x5f')]]['name'],queues[_0x223fea[_0x3640('0x5f')]][_0x3640('0xe')],queues[_0x223fea[_0x3640('0x5f')]][_0x3640('0x57')],queues[_0x223fea[_0x3640('0x5f')]]['calleridname']));}else{utils[_0x3640('0x3')](util[_0x3640('0x10')](_0x3640('0x5a'),_0x223fea[_0x3640('0x50')],queues[_0x223fea[_0x3640('0x53')]][_0x3640('0x1f')],_0x223fea[_0x3640('0x51')]));queues[_0x223fea[_0x3640('0x53')]][_0x3640('0xe')]=_0x223fea[_0x3640('0x51')];}}}}catch(_0xa4d0d2){utils['error'](util['format'](_0x3640('0x4f'),_0x223fea[_0x3640('0x50')]),_0xa4d0d2);}};exports['musiconholdstart']=function(_0x304efc){try{if(!_[_0x3640('0x18')](queues[_0x304efc[_0x3640('0x12')]])){utils[_0x3640('0x19')](util[_0x3640('0x10')]('[%s][queues][musiconholdstart]',_0x304efc[_0x3640('0x12')]),_0x304efc);queues[_0x304efc[_0x3640('0x12')]][_0x3640('0x61')]=utils[_0x3640('0x15')]();utils['info'](util[_0x3640('0x10')](_0x3640('0x62'),_0x304efc[_0x3640('0x12')],queues[_0x304efc['uniqueid']][_0x3640('0x1f')],queues[_0x304efc[_0x3640('0x12')]]['musiconholdstartAt']));}}catch(_0x1ec1f3){utils[_0x3640('0x16')](util[_0x3640('0x10')]('[%s][queues][musiconholdstart]',_0x304efc[_0x3640('0x12')]),_0x1ec1f3);}};exports['musiconholdstop']=function(_0x3fd016){try{if(!_[_0x3640('0x18')](queues[_0x3fd016['uniqueid']])){if(!_[_0x3640('0x18')](queues[_0x3fd016[_0x3640('0x12')]][_0x3640('0x61')])){utils['debug'](util[_0x3640('0x10')]('[%s][queues][musiconholdstop]',_0x3fd016[_0x3640('0x12')]),_0x3fd016);queues[_0x3fd016['uniqueid']]['mohtime']+=utils[_0x3640('0x63')](utils['now'](),queues[_0x3fd016[_0x3640('0x12')]][_0x3640('0x61')]);utils[_0x3640('0x3')](util['format'](_0x3640('0x64'),_0x3fd016[_0x3640('0x12')],queues[_0x3fd016[_0x3640('0x12')]]['name'],queues[_0x3fd016['uniqueid']][_0x3640('0x59')]));delete queues[_0x3fd016[_0x3640('0x12')]][_0x3640('0x61')];}}}catch(_0x11a86d){utils[_0x3640('0x16')](util['format'](_0x3640('0x65'),_0x3fd016[_0x3640('0x12')]),_0x11a86d);}}; \ No newline at end of file +var _0xfbe6=['transfereeuniqueid','BLIND','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferuniqueid','transfertargetlinkedid','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0xfbe6,0xf9));var _0x6fbe=function(_0x69e6aa,_0x152421){_0x69e6aa=_0x69e6aa-0x0;var _0x5453c4=_0xfbe6[_0x69e6aa];return _0x5453c4;};'use strict';var _=require(_0x6fbe('0x0'));var util=require('util');var utils=require(_0x6fbe('0x1'));var queues={};function writeDB(_0x241687){utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x4'),_0x241687[_0x6fbe('0x5')],_0x241687[_0x6fbe('0x6')],_0x241687[_0x6fbe('0x7')],_0x241687[_0x6fbe('0x8')],_0x241687['calleridnum'],_0x241687['accountcode'],_0x241687[_0x6fbe('0x9')]));if(_0x241687['queue']){utils[_0x6fbe('0xa')](_0x241687['queue'])[_0x6fbe('0xb')](function(_0x4bce43){if(_0x4bce43){_0x241687['type']=_0x4bce43[_0x6fbe('0xc')];}utils[_0x6fbe('0xd')]('CreateVoiceQueueReport',_0x241687);});}else{utils[_0x6fbe('0xd')](_0x6fbe('0xe'),_0x241687);}if(_0x241687['transfereduniqueid']){delete queues[_0x241687[_0x6fbe('0xf')]];}else{delete queues[_0x241687['uniqueid']];}}exports[_0x6fbe('0x10')]=function(_0x37289e){try{utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')](_0x6fbe('0x12'),_0x37289e[_0x6fbe('0x5')]),_0x37289e);utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x13'),_0x37289e['uniqueid'],_0x37289e['queue'],_0x37289e[_0x6fbe('0x14')]));queues[_0x37289e[_0x6fbe('0x5')]]=_[_0x6fbe('0x15')](_0x37289e,{'originalposition':_0x37289e['position'],'queuecallerjoinAt':utils[_0x6fbe('0x16')](),'mohtime':0x0});}catch(_0x11d54a){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x12'),_0x37289e[_0x6fbe('0x5')]),_0x11d54a);}};exports[_0x6fbe('0x18')]=function(_0x50be51){try{if(!_[_0x6fbe('0x19')](queues[_0x50be51[_0x6fbe('0x5')]])){utils[_0x6fbe('0x11')](util['format']('[%s][queues][hangup]',_0x50be51[_0x6fbe('0x5')]),_0x50be51);if(queues[_0x50be51['uniqueid']][_0x6fbe('0x1a')]){if(!queues[_0x50be51[_0x6fbe('0x5')]][_0x6fbe('0x1b')]&&!queues[_0x50be51[_0x6fbe('0x5')]][_0x6fbe('0x1c')]){queues[_0x50be51[_0x6fbe('0x5')]]['queuecallercomplete']=!![];queues[_0x50be51['uniqueid']][_0x6fbe('0x1d')]=utils[_0x6fbe('0x16')]();queues[_0x50be51['uniqueid']][_0x6fbe('0x9')]='COMPLETEDBYAGENT';}utils[_0x6fbe('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x50be51[_0x6fbe('0x5')],queues[_0x50be51['uniqueid']]['name'],queues[_0x50be51[_0x6fbe('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x50be51[_0x6fbe('0x5')]]);}else if(queues[_0x50be51['uniqueid']][_0x6fbe('0xf')]){utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x1e'),_0x50be51[_0x6fbe('0x5')],queues[_0x50be51[_0x6fbe('0x5')]]['name'],queues[_0x50be51[_0x6fbe('0x5')]]['transfereduniqueid']));queues[queues[_0x50be51[_0x6fbe('0x5')]][_0x6fbe('0xf')]]=queues[_0x50be51[_0x6fbe('0x5')]];queues[queues[_0x50be51[_0x6fbe('0x5')]][_0x6fbe('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x50be51['uniqueid']];}}}catch(_0x471bba){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x1f'),_0x50be51[_0x6fbe('0x5')]),_0x471bba);}};exports[_0x6fbe('0x20')]=function(_0x43e342){try{utils[_0x6fbe('0x11')](util['format'](_0x6fbe('0x21'),_0x43e342[_0x6fbe('0x5')]),_0x43e342);if(!_[_0x6fbe('0x19')](_0x43e342[_0x6fbe('0x22')][_0x6fbe('0x23')])&&_0x43e342[_0x6fbe('0x24')][_0x6fbe('0x25')]()!==_0x6fbe('0x26')){if(!_['isNil'](queues[_0x43e342['uniqueid']])){queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x1b')]=![];queues[_0x43e342['uniqueid']][_0x6fbe('0x27')]=null;queues[_0x43e342[_0x6fbe('0x5')]]['queuecallerexit']=!![];queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x28')]=utils[_0x6fbe('0x16')]();queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x9')]=_0x43e342[_0x6fbe('0x24')][_0x6fbe('0x25')]();utils['info'](util[_0x6fbe('0x3')](_0x6fbe('0x29'),_0x43e342[_0x6fbe('0x5')],queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x2a')],_0x43e342[_0x6fbe('0x24')],queues[_0x43e342['uniqueid']][_0x6fbe('0x9')]));writeDB(queues[_0x43e342['uniqueid']]);}}else if(!_[_0x6fbe('0x19')](_0x43e342[_0x6fbe('0x22')][_0x6fbe('0x2b')])){if(!_[_0x6fbe('0x19')](queues[_0x43e342['uniqueid']])&&!queues[_0x43e342['uniqueid']]['queuecallerabandon']){queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x1b')]=![];queues[_0x43e342['uniqueid']][_0x6fbe('0x27')]=null;queues[_0x43e342['uniqueid']]['queuecallerexit']=!![];queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x28')]=utils[_0x6fbe('0x16')]();queues[_0x43e342[_0x6fbe('0x5')]][_0x6fbe('0x9')]=_0x6fbe('0x2c');utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x43e342[_0x6fbe('0x5')],queues[_0x43e342['uniqueid']][_0x6fbe('0x2a')],_0x43e342[_0x6fbe('0x24')],queues[_0x43e342['uniqueid']][_0x6fbe('0x9')]));}}}catch(_0x263b9e){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x21'),_0x43e342['uniqueid']),_0x263b9e);}};exports[_0x6fbe('0x1b')]=function(_0x2013a6){try{if(!_[_0x6fbe('0x19')](queues[_0x2013a6[_0x6fbe('0x5')]])){utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')]('[%s][queues][queuecallerabandon]',_0x2013a6[_0x6fbe('0x5')]),_0x2013a6);queues[_0x2013a6[_0x6fbe('0x5')]]['queuecallerexit']=![];queues[_0x2013a6[_0x6fbe('0x5')]][_0x6fbe('0x28')]=null;queues[_0x2013a6[_0x6fbe('0x5')]]['queuecallerabandon']=!![];queues[_0x2013a6['uniqueid']][_0x6fbe('0x27')]=utils['now']();queues[_0x2013a6[_0x6fbe('0x5')]][_0x6fbe('0x9')]=_0x6fbe('0x2d');utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x2e'),_0x2013a6['uniqueid'],queues[_0x2013a6[_0x6fbe('0x5')]]['name'],queues[_0x2013a6[_0x6fbe('0x5')]][_0x6fbe('0x9')]));}}catch(_0x3561de){utils[_0x6fbe('0x17')](util['format'](_0x6fbe('0x2f'),_0x2013a6['uniqueid']),_0x3561de);}};exports[_0x6fbe('0x30')]=function(_0x1cbfc8){try{if(!_[_0x6fbe('0x19')](queues[_0x1cbfc8['uniqueid']])){utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')](_0x6fbe('0x31'),_0x1cbfc8[_0x6fbe('0x5')]),_0x1cbfc8);utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x32'),_0x1cbfc8[_0x6fbe('0x5')],queues[_0x1cbfc8['uniqueid']][_0x6fbe('0x2a')],_0x1cbfc8[_0x6fbe('0x33')],_0x1cbfc8[_0x6fbe('0x34')]));queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x30')]=!![];queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x1a')]=utils[_0x6fbe('0x16')]();queues[_0x1cbfc8[_0x6fbe('0x5')]]['holdtime']=utils['diffTime'](queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x1a')],queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x35')]);queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x14')]=_0x1cbfc8[_0x6fbe('0x14')];queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x36')]=_0x1cbfc8[_0x6fbe('0x36')];queues[_0x1cbfc8[_0x6fbe('0x5')]][_0x6fbe('0x33')]=_0x1cbfc8['connectedlinenum'];queues[_0x1cbfc8[_0x6fbe('0x5')]]['connectedlinename']=_0x1cbfc8[_0x6fbe('0x34')];}}catch(_0x39924c){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x31'),_0x1cbfc8[_0x6fbe('0x5')]),_0x39924c);}};exports[_0x6fbe('0x37')]=function(_0x5e0c42){try{if(!_['isNil'](queues[_0x5e0c42[_0x6fbe('0x5')]])){utils[_0x6fbe('0x11')](util['format'](_0x6fbe('0x38'),_0x5e0c42[_0x6fbe('0x5')]),_0x5e0c42);utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x39'),_0x5e0c42[_0x6fbe('0x5')],queues[_0x5e0c42[_0x6fbe('0x5')]][_0x6fbe('0x2a')],_0x5e0c42[_0x6fbe('0x3a')],_0x5e0c42['destaccountcode']));queues[_0x5e0c42['uniqueid']]['queuecallerabandon']=![];queues[_0x5e0c42['uniqueid']][_0x6fbe('0x1b')]=![];queues[_0x5e0c42[_0x6fbe('0x5')]]['queuecallerabandonAt']=null;queues[_0x5e0c42[_0x6fbe('0x5')]][_0x6fbe('0x1c')]=![];queues[_0x5e0c42['uniqueid']][_0x6fbe('0x9')]=null;queues[_0x5e0c42['uniqueid']]['queuecallerexitAt']=null;queues[_0x5e0c42[_0x6fbe('0x5')]][_0x6fbe('0x3b')]=!![];queues[_0x5e0c42[_0x6fbe('0x5')]]['accountcode']=_0x5e0c42[_0x6fbe('0x3c')];queues[_0x5e0c42[_0x6fbe('0x5')]][_0x6fbe('0x8')]=_0x5e0c42[_0x6fbe('0x3a')];}}catch(_0x8be494){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x38'),_0x5e0c42[_0x6fbe('0x5')]),_0x8be494);}};exports[_0x6fbe('0x3d')]=function(_0xd1fe3c){try{if(!_['isNil'](queues[_0xd1fe3c[_0x6fbe('0x5')]])){if(queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1a')]){utils[_0x6fbe('0x11')](util['format'](_0x6fbe('0x3e'),_0xd1fe3c['uniqueid']),_0xd1fe3c);queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1b')]=![];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1b')]=![];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x27')]=null;queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1c')]=![];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x28')]=null;queues[_0xd1fe3c['uniqueid']][_0x6fbe('0x3b')]=!![];queues[_0xd1fe3c[_0x6fbe('0x5')]]['lastAssignedTo']=_0xd1fe3c[_0x6fbe('0x3a')];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x3f')]=!![];queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x1d')]=utils[_0x6fbe('0x16')]();if(_0xd1fe3c[_0x6fbe('0x40')]==_0x6fbe('0x41')){if(!queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x41')]){queues[_0xd1fe3c[_0x6fbe('0x5')]]['queuecallerexitreason']=_0x6fbe('0x42');}}else{queues[_0xd1fe3c['uniqueid']][_0x6fbe('0x9')]=_0x6fbe('0x43')+_0xd1fe3c[_0x6fbe('0x40')][_0x6fbe('0x25')]();}utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xd1fe3c['uniqueid'],queues[_0xd1fe3c['uniqueid']][_0x6fbe('0x2a')],_0xd1fe3c['membername'],queues[_0xd1fe3c[_0x6fbe('0x5')]][_0x6fbe('0x9')]));writeDB(queues[_0xd1fe3c['uniqueid']]);}}}catch(_0x256230){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')]('[%s][queues][agentcomplete]',_0xd1fe3c[_0x6fbe('0x5')]),_0x256230);}};exports[_0x6fbe('0x44')]=function(_0x24353f){try{if(!_[_0x6fbe('0x19')](queues[_0x24353f['transfereeuniqueid']])){utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')]('[%s][queues][blindtransfer]',_0x24353f[_0x6fbe('0x5')]),_0x24353f);queues[_0x24353f['transfereeuniqueid']]['transfer']=!![];queues[_0x24353f[_0x6fbe('0x45')]]['transfertype']=_0x6fbe('0x46');queues[_0x24353f[_0x6fbe('0x45')]]['transferexten']=_0x24353f[_0x6fbe('0x47')];queues[_0x24353f[_0x6fbe('0x45')]]['transferuniqueid']=_0x24353f[_0x6fbe('0x45')];queues[_0x24353f['transfereeuniqueid']][_0x6fbe('0x9')]=_0x6fbe('0x48');utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x49'),_0x24353f['uniqueid'],queues[_0x24353f['transfereeuniqueid']]['name'],_0x24353f[_0x6fbe('0x45')],_0x24353f['extension']));}}catch(_0x50178e){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x4a'),_0x24353f['uniqueid']),_0x50178e);}};exports['attendedtransfer']=function(_0x1ec879){try{utils[_0x6fbe('0x11')](util[_0x6fbe('0x3')](_0x6fbe('0x4b'),_0x1ec879[_0x6fbe('0x4c')]),_0x1ec879);if(_0x1ec879['origtransfereruniqueid']==_0x1ec879[_0x6fbe('0x4d')]){if(!_[_0x6fbe('0x19')](queues[_0x1ec879[_0x6fbe('0x4e')]])){utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x4f'),_0x1ec879['origtransfereruniqueid'],queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0x2a')],_0x1ec879[_0x6fbe('0x50')]));queues[_0x1ec879['secondtransfererlinkedid']][_0x6fbe('0x41')]=!![];queues[_0x1ec879['secondtransfererlinkedid']][_0x6fbe('0x51')]=_0x6fbe('0x52');queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0x53')]=_0x1ec879[_0x6fbe('0x50')];queues[_0x1ec879['secondtransfererlinkedid']]['transferuniqueid']=_0x1ec879[_0x6fbe('0x4c')];queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0x9')]=_0x6fbe('0x54');}if(!_[_0x6fbe('0x19')](queues[_0x1ec879[_0x6fbe('0x4d')]])){if(_0x1ec879[_0x6fbe('0x55')]&&queues[_0x1ec879['transfereelinkedid']]){queues[_0x1ec879[_0x6fbe('0x55')]]['queuecallerenterreason']=0x1;queues[_0x1ec879[_0x6fbe('0x45')]]=_[_0x6fbe('0x56')](queues[_0x1ec879[_0x6fbe('0x55')]]);queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0xf')]=_0x1ec879[_0x6fbe('0x57')];queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x58')]=0x2;queues[_0x1ec879[_0x6fbe('0x45')]]['calleridnum']=queues[_0x1ec879['secondtransfererlinkedid']][_0x6fbe('0x59')];queues[_0x1ec879['transfereeuniqueid']][_0x6fbe('0x5a')]=queues[_0x1ec879[_0x6fbe('0x4e')]]['calleridname'];queues[_0x1ec879[_0x6fbe('0x45')]]['queuecallerjoinAt']=utils[_0x6fbe('0x16')]();queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x1a')]=utils[_0x6fbe('0x16')]();queues[_0x1ec879['transfereeuniqueid']]['holdtime']=0x0;queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x5b')]=0x0;utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x5c'),_0x1ec879[_0x6fbe('0x4c')],queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x2a')],queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x59')],queues[_0x1ec879[_0x6fbe('0x45')]][_0x6fbe('0x5a')]));}else{utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x5d'),_0x1ec879['origtransfereruniqueid'],queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x2a')],_0x1ec879[_0x6fbe('0x4e')]));queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0xf')]=_0x1ec879['secondtransfererlinkedid'];}}}else if(_0x1ec879[_0x6fbe('0x5e')]==_0x1ec879[_0x6fbe('0x4e')]){if(!_[_0x6fbe('0x19')](queues[_0x1ec879[_0x6fbe('0x4d')]])){utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')](_0x6fbe('0x5f'),_0x1ec879[_0x6fbe('0x4c')],queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x2a')],_0x1ec879[_0x6fbe('0x5e')],_0x1ec879[_0x6fbe('0x60')]));queues[_0x1ec879['origtransfererlinkedid']][_0x6fbe('0x41')]=!![];queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x51')]='ATTENDED';queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x53')]=_0x1ec879[_0x6fbe('0x60')];queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x61')]=_0x1ec879[_0x6fbe('0x5e')];queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x6fbe('0x19')](queues[_0x1ec879[_0x6fbe('0x4e')]])){if(_0x1ec879[_0x6fbe('0x62')]&&queues[_0x1ec879[_0x6fbe('0x62')]]){queues[_0x1ec879[_0x6fbe('0x62')]][_0x6fbe('0x58')]=0x1;queues[_0x1ec879[_0x6fbe('0x57')]]=_[_0x6fbe('0x56')](queues[_0x1ec879[_0x6fbe('0x62')]]);queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0xf')]=_0x1ec879[_0x6fbe('0x57')];queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x58')]=0x2;queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x59')]=queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x59')];queues[_0x1ec879['transfertargetuniqueid']][_0x6fbe('0x5a')]=queues[_0x1ec879[_0x6fbe('0x4d')]][_0x6fbe('0x5a')];queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x35')]=utils['now']();queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x1a')]=utils['now']();queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x63')]=0x0;queues[_0x1ec879[_0x6fbe('0x57')]]['mohtime']=0x0;utils[_0x6fbe('0x2')](util['format'](_0x6fbe('0x64'),_0x1ec879['origtransfereruniqueid'],queues[_0x1ec879[_0x6fbe('0x57')]]['name'],queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0xf')],queues[_0x1ec879['transfertargetuniqueid']][_0x6fbe('0x59')],queues[_0x1ec879[_0x6fbe('0x57')]][_0x6fbe('0x5a')]));}else{utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ec879[_0x6fbe('0x4c')],queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0x2a')],_0x1ec879['origtransfererlinkedid']));queues[_0x1ec879[_0x6fbe('0x4e')]][_0x6fbe('0xf')]=_0x1ec879['origtransfererlinkedid'];}}}}catch(_0x25fd7f){utils['error'](util[_0x6fbe('0x3')](_0x6fbe('0x4b'),_0x1ec879[_0x6fbe('0x4c')]),_0x25fd7f);}};exports[_0x6fbe('0x65')]=function(_0x53df36){try{if(!_[_0x6fbe('0x19')](queues[_0x53df36['uniqueid']])){utils['debug'](util[_0x6fbe('0x3')](_0x6fbe('0x66'),_0x53df36[_0x6fbe('0x5')]),_0x53df36);queues[_0x53df36['uniqueid']][_0x6fbe('0x67')]=utils[_0x6fbe('0x16')]();utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x53df36[_0x6fbe('0x5')],queues[_0x53df36[_0x6fbe('0x5')]][_0x6fbe('0x2a')],queues[_0x53df36['uniqueid']]['musiconholdstartAt']));}}catch(_0x3f7266){utils[_0x6fbe('0x17')](util[_0x6fbe('0x3')](_0x6fbe('0x66'),_0x53df36['uniqueid']),_0x3f7266);}};exports[_0x6fbe('0x68')]=function(_0x1ce461){try{if(!_[_0x6fbe('0x19')](queues[_0x1ce461[_0x6fbe('0x5')]])){if(!_[_0x6fbe('0x19')](queues[_0x1ce461[_0x6fbe('0x5')]]['musiconholdstartAt'])){utils['debug'](util[_0x6fbe('0x3')]('[%s][queues][musiconholdstop]',_0x1ce461[_0x6fbe('0x5')]),_0x1ce461);queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x5b')]+=utils['diffTime'](utils[_0x6fbe('0x16')](),queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x67')]);utils[_0x6fbe('0x2')](util[_0x6fbe('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1ce461[_0x6fbe('0x5')],queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x2a')],queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x5b')]));delete queues[_0x1ce461[_0x6fbe('0x5')]][_0x6fbe('0x67')];}}}catch(_0x263d60){utils['error'](util[_0x6fbe('0x3')](_0x6fbe('0x69'),_0x1ce461['uniqueid']),_0x263d60);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5374fd1..be03d2e 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 _0x71d8=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][newexten]','appdata','application','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','mixmonitor_filename'];(function(_0x36c368,_0x502824){var _0xcd7749=function(_0x2fcc81){while(--_0x2fcc81){_0x36c368['push'](_0x36c368['shift']());}};_0xcd7749(++_0x502824);}(_0x71d8,0x121));var _0x871d=function(_0x1ec210,_0x43c21c){_0x1ec210=_0x1ec210-0x0;var _0x1cb18d=_0x71d8[_0x1ec210];return _0x1cb18d;};'use strict';var _=require(_0x871d('0x0'));var util=require(_0x871d('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x271867){utils[_0x871d('0x2')](util[_0x871d('0x3')](_0x871d('0x4'),_0x271867[_0x871d('0x5')]));if(_0x271867[_0x871d('0x6')]){utils[_0x871d('0x7')](_0x271867[_0x871d('0x6')])[_0x871d('0x8')](function(_0x1df863){if(_0x1df863){_0x271867[_0x871d('0x9')]=_0x1df863[_0x871d('0xa')];_0x271867[_0x871d('0xb')]=_0x1df863['id'];}utils['request'](_0x871d('0xc'),_0x271867);});}else{utils[_0x871d('0xd')](_0x871d('0xc'),_0x271867);}}exports[_0x871d('0xe')]=function(_0x58e9b1){try{utils[_0x871d('0xf')](util[_0x871d('0x3')](_0x871d('0x10'),_0x58e9b1[_0x871d('0x5')]),_0x58e9b1);if(_0x58e9b1['uniqueid']==_0x58e9b1[_0x871d('0x11')]){utils[_0x871d('0x2')](util[_0x871d('0x3')](_0x871d('0x12'),_0x58e9b1[_0x871d('0x5')],_0x58e9b1[_0x871d('0x13')],_0x58e9b1[_0x871d('0x14')]));recordings[_0x58e9b1['uniqueid']]={'uniqueid':_0x58e9b1[_0x871d('0x5')],'accountcode':_0x58e9b1['accountcode'],'exten':_0x58e9b1[_0x871d('0x14')],'context':_0x58e9b1[_0x871d('0x13')],'channel':_0x58e9b1[_0x871d('0x15')],'monitors':[]};}}catch(_0x9e08e4){utils[_0x871d('0x16')](util[_0x871d('0x3')](_0x871d('0x10'),_0x58e9b1['uniqueid']),_0x9e08e4);}};exports[_0x871d('0x17')]=function(_0x41b90f){try{utils[_0x871d('0xf')](util[_0x871d('0x3')](_0x871d('0x18'),_0x41b90f[_0x871d('0x5')]),_0x41b90f);if(!_[_0x871d('0x19')](recordings[_0x41b90f[_0x871d('0x5')]])&&_0x41b90f[_0x871d('0x1a')]==0x6){utils[_0x871d('0x2')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x41b90f[_0x871d('0x5')],_0x41b90f[_0x871d('0x13')],_0x41b90f['channel']));}else if(!_[_0x871d('0x19')](recordings[_0x41b90f[_0x871d('0x11')]])&&_0x41b90f[_0x871d('0x1a')]==0x6&&_0x41b90f[_0x871d('0x13')]!=_0x871d('0x1b')){utils['info'](util[_0x871d('0x3')](_0x871d('0x1c'),_0x41b90f['uniqueid'],_0x41b90f[_0x871d('0x11')],_0x41b90f[_0x871d('0x13')],_0x41b90f[_0x871d('0x15')]));recordings[_0x41b90f[_0x871d('0x11')]]['accountcode']=_0x41b90f[_0x871d('0x6')];}}catch(_0x19fe28){utils[_0x871d('0x16')](util['format']('[%s][recordings][newstate]',_0x41b90f[_0x871d('0x5')]),_0x19fe28);}};exports[_0x871d('0x1d')]=function(_0x9a415d){try{if(!_[_0x871d('0x19')](_0x9a415d['variable'])&&!_[_0x871d('0x19')](_0x9a415d['variable'][_0x871d('0x1e')])){utils[_0x871d('0xf')](util[_0x871d('0x3')](_0x871d('0x1f'),_0x9a415d[_0x871d('0x5')]),_0x9a415d);utils[_0x871d('0x2')](util[_0x871d('0x3')](_0x871d('0x20'),_0x9a415d[_0x871d('0x5')],_0x9a415d[_0x871d('0x21')],_0x9a415d[_0x871d('0x22')]));if(_[_0x871d('0x23')](_0x9a415d[_0x871d('0x22')],_0x871d('0x24'))){_0x9a415d[_0x871d('0x22')]=_0x9a415d[_0x871d('0x22')][_0x871d('0x25')]('.wav49',_0x871d('0x26'));}if(recordings[_0x9a415d[_0x871d('0x11')]]){var _0x40d196=_[_0x871d('0x27')](recordings[_0x9a415d[_0x871d('0x11')]][_0x871d('0x28')],{'value':_0x9a415d[_0x871d('0x22')]});if(_['isNil'](_0x40d196)){recordings[_0x9a415d[_0x871d('0x11')]]['monitors'][_0x871d('0x29')]({'value':_0x9a415d[_0x871d('0x22')]});}}}}catch(_0x2b0e53){utils[_0x871d('0x16')](util[_0x871d('0x3')]('[%s][recordings][varset]',_0x9a415d[_0x871d('0x5')]),_0x2b0e53);}};exports[_0x871d('0x2a')]=function(_0x41ebfa){try{if(!_['isNil'](recordings[_0x41ebfa[_0x871d('0x5')]])){utils[_0x871d('0xf')](util[_0x871d('0x3')](_0x871d('0x2b'),_0x41ebfa[_0x871d('0x5')]),_0x41ebfa);utils[_0x871d('0x2')](util[_0x871d('0x3')](_0x871d('0x2c'),_0x41ebfa[_0x871d('0x5')],_0x41ebfa[_0x871d('0x2d')],_0x41ebfa[_0x871d('0x2e')],_0x41ebfa['cause-txt']));recordings[_0x41ebfa[_0x871d('0x5')]][_0x871d('0x2d')]=_0x41ebfa[_0x871d('0x2d')];recordings[_0x41ebfa[_0x871d('0x5')]][_0x871d('0x2e')]=_0x41ebfa[_0x871d('0x2e')];recordings[_0x41ebfa[_0x871d('0x5')]][_0x871d('0x2f')]=_0x41ebfa['connectedlinenum'];recordings[_0x41ebfa['uniqueid']][_0x871d('0x30')]=_0x41ebfa[_0x871d('0x30')];if(recordings[_0x41ebfa[_0x871d('0x5')]][_0x871d('0x31')]==_0x871d('0x32')&&recordings[_0x41ebfa[_0x871d('0x5')]][_0x871d('0x6')]){recordings[_0x41ebfa['uniqueid']]['connectedlinenum']=recordings[_0x41ebfa[_0x871d('0x5')]][_0x871d('0x6')];recordings[_0x41ebfa['uniqueid']][_0x871d('0x30')]='';}recordings[_0x41ebfa['uniqueid']][_0x871d('0x28')]['forEach'](function(_0x471a91){var _0xd79317=_[_0x871d('0x33')](recordings[_0x41ebfa[_0x871d('0x5')]]);_0xd79317[_0x871d('0x22')]=_0x471a91[_0x871d('0x22')];writeDB(_0xd79317);});delete recordings[_0x41ebfa[_0x871d('0x5')]];}}catch(_0x40900a){utils[_0x871d('0x16')](util[_0x871d('0x3')](_0x871d('0x2b'),_0x41ebfa['uniqueid']),_0x40900a);}};exports['newexten']=function(_0x616d33){try{if(!_['isNil'](recordings[_0x616d33[_0x871d('0x5')]])){utils[_0x871d('0xf')](util[_0x871d('0x3')](_0x871d('0x34'),_0x616d33[_0x871d('0x5')]),_0x616d33);utils[_0x871d('0x2')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x616d33[_0x871d('0x5')],_0x616d33['application'],_0x616d33[_0x871d('0x35')]));if(_0x616d33[_0x871d('0x36')][_0x871d('0x37')]()==_0x871d('0x38')&&_[_0x871d('0x39')](_0x616d33['appdata'][_0x871d('0x37')](),_0x871d('0x3a'))){var _0x120c24=_0x616d33['appdata'][_0x871d('0x3b')]('=');var _0x1be29c=_0x120c24[0x0]['substring'](_0x120c24[0x0]['lastIndexOf']('(')+0x1,_0x120c24[0x0][_0x871d('0x3c')](')'));var _0x390a81=_0x120c24[0x1];recordings[_0x616d33[_0x871d('0x5')]][_0x1be29c]=_0x390a81;}}}catch(_0x295837){utils[_0x871d('0x16')](util[_0x871d('0x3')](_0x871d('0x34'),_0x616d33['uniqueid']),_0x295837);}};exports[_0x871d('0x3d')]=function(_0x534a25){try{if(!_['isNil'](recordings[_0x534a25['uniqueid']])){utils[_0x871d('0xf')](util[_0x871d('0x3')](_0x871d('0x3e'),_0x534a25[_0x871d('0x5')]),_0x534a25);utils[_0x871d('0x2')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x534a25['uniqueid'],_0x534a25[_0x871d('0x3f')]));recordings[_0x534a25[_0x871d('0x5')]][_0x871d('0x3f')]=_0x534a25['queue'];}}catch(_0xd07e39){utils[_0x871d('0x16')](util['format'](_0x871d('0x3e'),_0x534a25[_0x871d('0x5')]),_0xd07e39);}}; \ No newline at end of file +var _0x3d52=['[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','appdata','split','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','exten','context','channel','error','newstate','isNil','channelstate'];(function(_0x2ccbd7,_0x5f4691){var _0x39182d=function(_0x37df17){while(--_0x37df17){_0x2ccbd7['push'](_0x2ccbd7['shift']());}};_0x39182d(++_0x5f4691);}(_0x3d52,0x15c));var _0x23d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x23d5('0x0'));var util=require(_0x23d5('0x1'));var utils=require(_0x23d5('0x2'));var recordings={};function writeDB(_0x1f844a){utils[_0x23d5('0x3')](util[_0x23d5('0x4')](_0x23d5('0x5'),_0x1f844a[_0x23d5('0x6')]));if(_0x1f844a[_0x23d5('0x7')]){utils[_0x23d5('0x8')](_0x1f844a[_0x23d5('0x7')])['then'](function(_0x2d5d69){if(_0x2d5d69){_0x1f844a[_0x23d5('0x9')]=_0x2d5d69[_0x23d5('0xa')];_0x1f844a[_0x23d5('0xb')]=_0x2d5d69['id'];}utils['request'](_0x23d5('0xc'),_0x1f844a);});}else{utils[_0x23d5('0xd')](_0x23d5('0xc'),_0x1f844a);}}exports[_0x23d5('0xe')]=function(_0x2639a6){try{utils[_0x23d5('0xf')](util['format'](_0x23d5('0x10'),_0x2639a6[_0x23d5('0x6')]),_0x2639a6);if(_0x2639a6[_0x23d5('0x6')]==_0x2639a6['linkedid']){utils[_0x23d5('0x3')](util[_0x23d5('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2639a6[_0x23d5('0x6')],_0x2639a6['context'],_0x2639a6[_0x23d5('0x11')]));recordings[_0x2639a6[_0x23d5('0x6')]]={'uniqueid':_0x2639a6['uniqueid'],'accountcode':_0x2639a6[_0x23d5('0x7')],'exten':_0x2639a6[_0x23d5('0x11')],'context':_0x2639a6[_0x23d5('0x12')],'channel':_0x2639a6[_0x23d5('0x13')],'monitors':[]};}}catch(_0x3a64c2){utils[_0x23d5('0x14')](util[_0x23d5('0x4')](_0x23d5('0x10'),_0x2639a6[_0x23d5('0x6')]),_0x3a64c2);}};exports[_0x23d5('0x15')]=function(_0x8e202c){try{utils[_0x23d5('0xf')](util['format']('[%s][recordings][newstate]',_0x8e202c[_0x23d5('0x6')]),_0x8e202c);if(!_[_0x23d5('0x16')](recordings[_0x8e202c[_0x23d5('0x6')]])&&_0x8e202c[_0x23d5('0x17')]==0x6){utils[_0x23d5('0x3')](util[_0x23d5('0x4')](_0x23d5('0x18'),_0x8e202c[_0x23d5('0x6')],_0x8e202c[_0x23d5('0x12')],_0x8e202c[_0x23d5('0x13')]));}else if(!_[_0x23d5('0x16')](recordings[_0x8e202c[_0x23d5('0x19')]])&&_0x8e202c[_0x23d5('0x17')]==0x6&&_0x8e202c[_0x23d5('0x12')]!='transfer'){utils[_0x23d5('0x3')](util['format'](_0x23d5('0x1a'),_0x8e202c[_0x23d5('0x6')],_0x8e202c['linkedid'],_0x8e202c[_0x23d5('0x12')],_0x8e202c[_0x23d5('0x13')]));recordings[_0x8e202c[_0x23d5('0x19')]][_0x23d5('0x7')]=_0x8e202c[_0x23d5('0x7')];}}catch(_0x1fa3e0){utils[_0x23d5('0x14')](util[_0x23d5('0x4')](_0x23d5('0x1b'),_0x8e202c[_0x23d5('0x6')]),_0x1fa3e0);}};exports[_0x23d5('0x1c')]=function(_0x54a2a6){try{if(!_[_0x23d5('0x16')](_0x54a2a6[_0x23d5('0x1d')])&&!_[_0x23d5('0x16')](_0x54a2a6[_0x23d5('0x1d')]['mixmonitor_filename'])){utils['debug'](util[_0x23d5('0x4')](_0x23d5('0x1e'),_0x54a2a6['uniqueid']),_0x54a2a6);utils[_0x23d5('0x3')](util[_0x23d5('0x4')](_0x23d5('0x1f'),_0x54a2a6[_0x23d5('0x6')],_0x54a2a6[_0x23d5('0x1d')],_0x54a2a6[_0x23d5('0x20')]));if(_[_0x23d5('0x21')](_0x54a2a6[_0x23d5('0x20')],_0x23d5('0x22'))){_0x54a2a6[_0x23d5('0x20')]=_0x54a2a6[_0x23d5('0x20')][_0x23d5('0x23')](_0x23d5('0x22'),_0x23d5('0x24'));}if(recordings[_0x54a2a6[_0x23d5('0x19')]]){var _0xc160de=_[_0x23d5('0x25')](recordings[_0x54a2a6[_0x23d5('0x19')]]['monitors'],{'value':_0x54a2a6[_0x23d5('0x20')]});if(_[_0x23d5('0x16')](_0xc160de)){recordings[_0x54a2a6['linkedid']][_0x23d5('0x26')][_0x23d5('0x27')]({'value':_0x54a2a6['value']});}}}}catch(_0x444bc5){utils[_0x23d5('0x14')](util[_0x23d5('0x4')](_0x23d5('0x1e'),_0x54a2a6[_0x23d5('0x6')]),_0x444bc5);}};exports['hangup']=function(_0x59cff7){try{if(!_[_0x23d5('0x16')](recordings[_0x59cff7[_0x23d5('0x6')]])){utils[_0x23d5('0xf')](util['format'](_0x23d5('0x28'),_0x59cff7[_0x23d5('0x6')]),_0x59cff7);utils['info'](util['format'](_0x23d5('0x29'),_0x59cff7[_0x23d5('0x6')],_0x59cff7[_0x23d5('0x2a')],_0x59cff7[_0x23d5('0x2b')],_0x59cff7[_0x23d5('0x2c')]));recordings[_0x59cff7[_0x23d5('0x6')]]['calleridnum']=_0x59cff7[_0x23d5('0x2a')];recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2b')]=_0x59cff7['calleridname'];recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2d')]=_0x59cff7['connectedlinenum'];recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2e')]=_0x59cff7[_0x23d5('0x2e')];if(recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2f')]==_0x23d5('0x30')&&recordings[_0x59cff7['uniqueid']]['accountcode']){recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2d')]=recordings[_0x59cff7[_0x23d5('0x6')]]['accountcode'];recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x2e')]='';}recordings[_0x59cff7[_0x23d5('0x6')]][_0x23d5('0x26')][_0x23d5('0x31')](function(_0x2d0928){var _0x577b1a=_[_0x23d5('0x32')](recordings[_0x59cff7[_0x23d5('0x6')]]);_0x577b1a['value']=_0x2d0928['value'];writeDB(_0x577b1a);});delete recordings[_0x59cff7[_0x23d5('0x6')]];}}catch(_0x4602c8){utils['error'](util[_0x23d5('0x4')](_0x23d5('0x28'),_0x59cff7[_0x23d5('0x6')]),_0x4602c8);}};exports[_0x23d5('0x33')]=function(_0x3cc357){try{if(!_[_0x23d5('0x16')](recordings[_0x3cc357[_0x23d5('0x6')]])){utils[_0x23d5('0xf')](util[_0x23d5('0x4')]('[%s][recordings][newexten]',_0x3cc357[_0x23d5('0x6')]),_0x3cc357);utils['info'](util[_0x23d5('0x4')](_0x23d5('0x34'),_0x3cc357['uniqueid'],_0x3cc357['application'],_0x3cc357['appdata']));if(_0x3cc357['application'][_0x23d5('0x35')]()==_0x23d5('0x36')&&_['startsWith'](_0x3cc357[_0x23d5('0x37')][_0x23d5('0x35')](),'cdr')){var _0x4d26b4=_0x3cc357['appdata'][_0x23d5('0x38')]('=');var _0x29df3b=_0x4d26b4[0x0][_0x23d5('0x39')](_0x4d26b4[0x0]['lastIndexOf']('(')+0x1,_0x4d26b4[0x0]['lastIndexOf'](')'));var _0x207ecc=_0x4d26b4[0x1];recordings[_0x3cc357[_0x23d5('0x6')]][_0x29df3b]=_0x207ecc;}}}catch(_0x4a3e0b){utils[_0x23d5('0x14')](util['format']('[%s][recordings][newexten]',_0x3cc357[_0x23d5('0x6')]),_0x4a3e0b);}};exports[_0x23d5('0x3a')]=function(_0x57cb39){try{if(!_[_0x23d5('0x16')](recordings[_0x57cb39[_0x23d5('0x6')]])){utils['debug'](util['format'](_0x23d5('0x3b'),_0x57cb39['uniqueid']),_0x57cb39);utils['info'](util['format'](_0x23d5('0x3c'),_0x57cb39[_0x23d5('0x6')],_0x57cb39[_0x23d5('0x3d')]));recordings[_0x57cb39[_0x23d5('0x6')]][_0x23d5('0x3d')]=_0x57cb39['queue'];}}catch(_0x4c6ceb){utils['error'](util[_0x23d5('0x4')](_0x23d5('0x3b'),_0x57cb39[_0x23d5('0x6')]),_0x4c6ceb);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a4b952e..7e23d1d 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 _0xc24e=['uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x25924b,_0x14bcb8){var _0x285f7b=function(_0x58c8){while(--_0x58c8){_0x25924b['push'](_0x25924b['shift']());}};_0x285f7b(++_0x14bcb8);}(_0xc24e,0x149));var _0xec24=function(_0x5f29eb,_0x43909a){_0x5f29eb=_0x5f29eb-0x0;var _0x3d0abd=_0xc24e[_0x5f29eb];return _0x3d0abd;};'use strict';var _=require(_0xec24('0x0'));var util=require(_0xec24('0x1'));var utils=require(_0xec24('0x2'));function writeDB(_0x28dfce){utils[_0xec24('0x3')](util[_0xec24('0x4')](_0xec24('0x5'),_0x28dfce['type']===_0xec24('0x6')?_0x28dfce[_0xec24('0x7')]:_0x28dfce['uniqueid'],_0x28dfce[_0xec24('0x8')]));utils[_0xec24('0x9')](_0xec24('0xa'),_0x28dfce);}exports[_0xec24('0xb')]={};exports[_0xec24('0xc')]=function(_0x373ee7){try{utils[_0xec24('0xd')](util[_0xec24('0x4')]('[%s][transfers][blindtransfer]',_0x373ee7['uniqueid']),_0x373ee7);utils[_0xec24('0x3')](util[_0xec24('0x4')](_0xec24('0xe'),_0x373ee7[_0xec24('0xf')],_0x373ee7[_0xec24('0x10')],_0x373ee7[_0xec24('0x11')],_0x373ee7[_0xec24('0x12')],_0x373ee7[_0xec24('0x13')]));_0x373ee7[_0xec24('0x8')]=_0xec24('0x14');exports['blinds'][_0x373ee7[_0xec24('0x15')]]=_0x373ee7;writeDB(_0x373ee7);}catch(_0x1f1137){utils['error'](util[_0xec24('0x4')]('[%s][transfers][blindtransfer]',_0x373ee7[_0xec24('0xf')]),_0x1f1137);}};exports[_0xec24('0x16')]=function(_0x1b3536){try{utils['debug'](util['format']('[%s][transfers][attendedtransfer]',_0x1b3536[_0xec24('0x7')]),_0x1b3536);utils[_0xec24('0x3')](util[_0xec24('0x4')](_0xec24('0x17'),_0x1b3536[_0xec24('0x7')],_0x1b3536[_0xec24('0x18')],_0x1b3536[_0xec24('0x19')],_0x1b3536[_0xec24('0x1a')],_0x1b3536[_0xec24('0x1b')]));_0x1b3536=_[_0xec24('0x1c')](_0x1b3536,{'transfererchannel':_0x1b3536[_0xec24('0x1d')],'transferercalleridnum':_0x1b3536['origtransferercalleridnum'],'transferercalleridname':_0x1b3536[_0xec24('0x19')],'transfererconnectedlinenum':_0x1b3536[_0xec24('0x1e')],'transfererconnectedlinename':_0x1b3536[_0xec24('0x1f')],'transfereraccountcode':_0x1b3536['origtransfereraccountcode'],'transferercontext':_0x1b3536[_0xec24('0x20')],'transfererexten':_0x1b3536[_0xec24('0x21')],'transfererlinkedid':_0x1b3536[_0xec24('0x22')],'context':_0x1b3536[_0xec24('0x23')],'extension':_0x1b3536[_0xec24('0x24')],'type':_0xec24('0x6')});if(_['isNil'](_0x1b3536['transfereechannel'])){_0x1b3536=_[_0xec24('0x1c')](_0x1b3536,{'transfereechannel':_0x1b3536[_0xec24('0x25')],'transfereecalleridnum':_0x1b3536[_0xec24('0x1a')],'transfereecalleridname':_0x1b3536['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1b3536[_0xec24('0x26')],'transfereeconnectedlinename':_0x1b3536[_0xec24('0x27')],'transfereeaccountcode':_0x1b3536['transfertargetaccountcode'],'transfereecontext':_0x1b3536[_0xec24('0x28')],'transfereeexten':_0x1b3536[_0xec24('0x29')],'transfereelinkedid':_0x1b3536['transfertargetlinkedid']});}writeDB(_0x1b3536);}catch(_0x21911e){utils[_0xec24('0x2a')](util[_0xec24('0x4')]('[%s][transfers][attendedtransfer]',_0x1b3536['origtransfereruniqueid']),_0x21911e);}}; \ No newline at end of file +var _0xa23f=['error','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid'];(function(_0x4c34f1,_0x2b98be){var _0x55fff2=function(_0x1ed7e8){while(--_0x1ed7e8){_0x4c34f1['push'](_0x4c34f1['shift']());}};_0x55fff2(++_0x2b98be);}(_0xa23f,0xcb));var _0xfa23=function(_0x445597,_0xe0151e){_0x445597=_0x445597-0x0;var _0x576ebe=_0xa23f[_0x445597];return _0x576ebe;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var utils=require(_0xfa23('0x2'));function writeDB(_0x320b0e){utils['info'](util['format'](_0xfa23('0x3'),_0x320b0e[_0xfa23('0x4')]==='attended'?_0x320b0e[_0xfa23('0x5')]:_0x320b0e[_0xfa23('0x6')],_0x320b0e['type']));utils[_0xfa23('0x7')](_0xfa23('0x8'),_0x320b0e);}exports[_0xfa23('0x9')]={};exports[_0xfa23('0xa')]=function(_0x35cc09){try{utils[_0xfa23('0xb')](util[_0xfa23('0xc')](_0xfa23('0xd'),_0x35cc09[_0xfa23('0x6')]),_0x35cc09);utils[_0xfa23('0xe')](util[_0xfa23('0xc')](_0xfa23('0xf'),_0x35cc09[_0xfa23('0x6')],_0x35cc09[_0xfa23('0x10')],_0x35cc09[_0xfa23('0x11')],_0x35cc09[_0xfa23('0x12')],_0x35cc09[_0xfa23('0x13')]));_0x35cc09[_0xfa23('0x4')]=_0xfa23('0x14');exports[_0xfa23('0x9')][_0x35cc09[_0xfa23('0x15')]]=_0x35cc09;writeDB(_0x35cc09);}catch(_0x148b68){utils[_0xfa23('0x16')](util[_0xfa23('0xc')](_0xfa23('0xd'),_0x35cc09[_0xfa23('0x6')]),_0x148b68);}};exports[_0xfa23('0x17')]=function(_0x5e07cf){try{utils[_0xfa23('0xb')](util[_0xfa23('0xc')]('[%s][transfers][attendedtransfer]',_0x5e07cf['origtransfereruniqueid']),_0x5e07cf);utils[_0xfa23('0xe')](util[_0xfa23('0xc')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5e07cf[_0xfa23('0x5')],_0x5e07cf[_0xfa23('0x18')],_0x5e07cf[_0xfa23('0x19')],_0x5e07cf['transfertargetcalleridnum'],_0x5e07cf[_0xfa23('0x1a')]));_0x5e07cf=_[_0xfa23('0x1b')](_0x5e07cf,{'transfererchannel':_0x5e07cf[_0xfa23('0x1c')],'transferercalleridnum':_0x5e07cf[_0xfa23('0x18')],'transferercalleridname':_0x5e07cf['origtransferercalleridname'],'transfererconnectedlinenum':_0x5e07cf[_0xfa23('0x1d')],'transfererconnectedlinename':_0x5e07cf[_0xfa23('0x1e')],'transfereraccountcode':_0x5e07cf[_0xfa23('0x1f')],'transferercontext':_0x5e07cf[_0xfa23('0x20')],'transfererexten':_0x5e07cf[_0xfa23('0x21')],'transfererlinkedid':_0x5e07cf['origtransfererlinkedid'],'context':_0x5e07cf['origtransferercontext'],'extension':_0x5e07cf[_0xfa23('0x22')],'type':_0xfa23('0x23')});if(_[_0xfa23('0x24')](_0x5e07cf[_0xfa23('0x25')])){_0x5e07cf=_[_0xfa23('0x1b')](_0x5e07cf,{'transfereechannel':_0x5e07cf[_0xfa23('0x26')],'transfereecalleridnum':_0x5e07cf['transfertargetcalleridnum'],'transfereecalleridname':_0x5e07cf['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5e07cf['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5e07cf[_0xfa23('0x27')],'transfereeaccountcode':_0x5e07cf[_0xfa23('0x28')],'transfereecontext':_0x5e07cf[_0xfa23('0x29')],'transfereeexten':_0x5e07cf[_0xfa23('0x2a')],'transfereelinkedid':_0x5e07cf[_0xfa23('0x2b')]});}writeDB(_0x5e07cf);}catch(_0x58ec16){utils[_0xfa23('0x16')](util[_0xfa23('0xc')](_0xfa23('0x2c'),_0x5e07cf[_0xfa23('0x5')]),_0x58ec16);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e6b6cd6..def5032 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 _0xe112=['acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','found','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','internal','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','getUserByInterface','notfound','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','name','type'];(function(_0x1c443f,_0x51319d){var _0x4a4a71=function(_0x355b73){while(--_0x355b73){_0x1c443f['push'](_0x1c443f['shift']());}};_0x4a4a71(++_0x51319d);}(_0xe112,0x1f4));var _0x2e11=function(_0x5b9837,_0x119f5f){_0x5b9837=_0x5b9837-0x0;var _0x3dd342=_0xe112[_0x5b9837];return _0x3dd342;};'use strict';var BPromise=require(_0x2e11('0x0'));var jayson=require(_0x2e11('0x1'));var moment=require('moment');var util=require(_0x2e11('0x2'));var client=jayson['client'][_0x2e11('0x3')]({'port':0x2329});var logger=require(_0x2e11('0x4'))(_0x2e11('0x5'));exports['info']=function(_0x51aed4,_0x335487){logger[_0x2e11('0x6')](_0x51aed4,_0x335487?util[_0x2e11('0x7')](_0x335487,{'showHidden':![],'depth':null}):'');};exports[_0x2e11('0x8')]=function(_0x1e5397,_0x43132d){logger[_0x2e11('0x8')](_0x1e5397,_0x43132d?util['inspect'](_0x43132d,{'showHidden':![],'depth':null}):'');};exports[_0x2e11('0x9')]=function(_0x3ba3eb,_0x3b6dcb){logger[_0x2e11('0x9')](_0x3ba3eb,_0x3b6dcb?util[_0x2e11('0x7')](_0x3b6dcb,{'showHidden':![],'depth':null}):'');};exports[_0x2e11('0xa')]=function(_0x596350,_0xa416f9){return client['request'](_0x596350,{'body':_0xa416f9})[_0x2e11('0xb')](function(_0x221a5a){logger[_0x2e11('0x8')]('[utils][request]\x20name:%s',_0x596350,_0x221a5a?util[_0x2e11('0x7')](_0x221a5a,{'showHidden':![],'depth':null}):'');})[_0x2e11('0xc')](function(_0x307a6c){logger[_0x2e11('0x9')](_0x2e11('0xd'),_0x596350,_0x307a6c?util[_0x2e11('0x7')](_0x307a6c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4ccd0c){return client[_0x2e11('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x2e11('0xe'),'name',_0x2e11('0xf')],'where':_0x4ccd0c,'limit':0x1}})['then'](function(_0x26fa83){logger[_0x2e11('0x8')](_0x2e11('0x10'),JSON['stringify'](_0x4ccd0c),_0x26fa83?util['inspect'](_0x26fa83,{'showHidden':![],'depth':null}):'');return _0x26fa83[_0x2e11('0x11')][_0x2e11('0x12')]?_0x26fa83['result'][0x0]:null;});}exports[_0x2e11('0x13')]=function(_0x3069b9){return new BPromise(function(_0x5ac1f4,_0x2c7e3d){if(_0x3069b9){return getUser({'internal':_0x3069b9})[_0x2e11('0xb')](function(_0xaa4f10){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x3069b9,_0xaa4f10?'found':'notfound');return _0x5ac1f4(_0xaa4f10);})[_0x2e11('0xc')](function(_0x34d06b){logger[_0x2e11('0x9')]('[utils][getUserByInternal]',_0x34d06b?util[_0x2e11('0x7')](_0x34d06b,{'showHidden':![],'depth':null}):'');return _0x5ac1f4(null);});}return _0x5ac1f4(null);});};exports[_0x2e11('0x14')]=function(_0x229fe6){return new BPromise(function(_0x4c8c09,_0x4bf868){if(_0x229fe6){return getUser({'interface':_0x229fe6})[_0x2e11('0xb')](function(_0x3adb55){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x229fe6,_0x3adb55?'found':_0x2e11('0x15'));return _0x4c8c09(_0x3adb55);})['catch'](function(_0x4068d8){logger[_0x2e11('0x9')](_0x2e11('0x16'),_0x4068d8?util['inspect'](_0x4068d8,{'showHidden':![],'depth':null}):'');return _0x4c8c09(null);});}return _0x4c8c09(null);});};exports['getUserByName']=function(_0x3c8693){return new BPromise(function(_0x1732cd,_0x19d679){if(_0x3c8693){return getUser({'name':_0x3c8693})[_0x2e11('0xb')](function(_0x55a97b){logger[_0x2e11('0x6')](_0x2e11('0x17'),_0x3c8693,_0x55a97b?'found':'notfound');return _0x1732cd(_0x55a97b);})[_0x2e11('0xc')](function(_0x4be1b2){logger[_0x2e11('0x9')](_0x2e11('0x18'),_0x4be1b2?util[_0x2e11('0x7')](_0x4be1b2,{'showHidden':![],'depth':null}):'');return _0x1732cd(null);});}return _0x1732cd(null);});};exports['getVoiceQueueByName']=function(_0x4cdff8){return new BPromise(function(_0x4791fd,_0x90af85){if(_0x4cdff8){return client['request'](_0x2e11('0x19'),{'options':{'raw':!![],'attributes':['id',_0x2e11('0x1a'),_0x2e11('0x1b'),_0x2e11('0x1c'),'acwTimeout'],'where':{'name':_0x4cdff8},'limit':0x1}})[_0x2e11('0xb')](function(_0x5a1022){logger[_0x2e11('0x8')](_0x2e11('0x1d'),_0x4cdff8,_0x5a1022?util[_0x2e11('0x7')](_0x5a1022,{'showHidden':![],'depth':null}):'');logger[_0x2e11('0x6')](_0x2e11('0x1e'),_0x4cdff8,_0x5a1022?_0x2e11('0x1f'):'notfound');return _0x4791fd(_0x5a1022[_0x2e11('0x11')][_0x2e11('0x12')]?_0x5a1022[_0x2e11('0x11')][0x0]:null);})[_0x2e11('0xc')](function(_0x47a905){logger[_0x2e11('0x9')]('[utils][getVoiceQueueByName]',_0x47a905?util[_0x2e11('0x7')](_0x47a905,{'showHidden':![],'depth':null}):'');return _0x4791fd(null);});}return _0x4791fd(null);});};exports[_0x2e11('0x20')]=function(_0x5b75da,_0x39cafa){return moment(_0x5b75da)[_0x2e11('0x21')](_0x39cafa,_0x2e11('0x22'))[_0x2e11('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2e11('0x24')]=function(_0x2fe828,_0x579ede){return moment(_0x2fe828)[_0x2e11('0x25')](_0x579ede,_0x2e11('0x22'))['format'](_0x2e11('0x26'));};exports['diffTime']=function(_0xaf568a,_0x568f66){return moment(_0xaf568a)[_0x2e11('0x27')](moment(_0x568f66),'seconds');};exports[_0x2e11('0x28')]=function(_0x15481b,_0x4b485f){return parseInt(_0x15481b,0xa)+parseInt(_0x4b485f,0xa);};exports[_0x2e11('0x29')]=function(){return moment()[_0x2e11('0x23')](_0x2e11('0x26'));};exports[_0x2e11('0x2a')]=function(_0x639759,_0x36a669){if(_0x36a669){return moment(_0x639759)[_0x2e11('0x2a')](_0x36a669);}return!![];};exports[_0x2e11('0x2b')]=function(_0x17abdd,_0x316511){if(_0x316511){return moment(_0x17abdd)[_0x2e11('0x2b')](_0x316511);}else if(_0x17abdd){return!![];}return![];}; \ No newline at end of file +var _0xbe25=['catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','format','subtractTime','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','isAfter','isBefore','bluebird','moment','client','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound'];(function(_0x164a40,_0xb704f7){var _0x2a551a=function(_0x8c0588){while(--_0x8c0588){_0x164a40['push'](_0x164a40['shift']());}};_0x2a551a(++_0xb704f7);}(_0xbe25,0x1c9));var _0x5be2=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xbe25[_0x599f41];return _0x2e4d58;};'use strict';var BPromise=require(_0x5be2('0x0'));var jayson=require('jayson/promise');var moment=require(_0x5be2('0x1'));var util=require('util');var client=jayson[_0x5be2('0x2')][_0x5be2('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x5be2('0x4'));exports[_0x5be2('0x5')]=function(_0x2337ce,_0xa50ac8){logger[_0x5be2('0x5')](_0x2337ce,_0xa50ac8?util[_0x5be2('0x6')](_0xa50ac8,{'showHidden':![],'depth':null}):'');};exports[_0x5be2('0x7')]=function(_0x11cc66,_0x4b4590){logger[_0x5be2('0x7')](_0x11cc66,_0x4b4590?util['inspect'](_0x4b4590,{'showHidden':![],'depth':null}):'');};exports[_0x5be2('0x8')]=function(_0x315252,_0x5a215a){logger[_0x5be2('0x8')](_0x315252,_0x5a215a?util['inspect'](_0x5a215a,{'showHidden':![],'depth':null}):'');};exports[_0x5be2('0x9')]=function(_0x5f3dc0,_0x171457){return client[_0x5be2('0x9')](_0x5f3dc0,{'body':_0x171457})[_0x5be2('0xa')](function(_0x1d3678){logger[_0x5be2('0x7')]('[utils][request]\x20name:%s',_0x5f3dc0,_0x1d3678?util['inspect'](_0x1d3678,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2ab389){logger[_0x5be2('0x8')](_0x5be2('0xb'),_0x5f3dc0,_0x2ab389?util[_0x5be2('0x6')](_0x2ab389,{'showHidden':![],'depth':null}):'');});};function getUser(_0x58d4ab){return client[_0x5be2('0x9')](_0x5be2('0xc'),{'options':{'raw':!![],'attributes':['id',_0x5be2('0xd'),_0x5be2('0xe'),_0x5be2('0xf')],'where':_0x58d4ab,'limit':0x1}})[_0x5be2('0xa')](function(_0x21655c){logger[_0x5be2('0x7')](_0x5be2('0x10'),JSON[_0x5be2('0x11')](_0x58d4ab),_0x21655c?util[_0x5be2('0x6')](_0x21655c,{'showHidden':![],'depth':null}):'');return _0x21655c[_0x5be2('0x12')]['length']?_0x21655c[_0x5be2('0x12')][0x0]:null;});}exports[_0x5be2('0x13')]=function(_0x172b8c){return new BPromise(function(_0x5caa4c,_0x3268db){if(_0x172b8c){return getUser({'internal':_0x172b8c})[_0x5be2('0xa')](function(_0x22803a){logger['info'](_0x5be2('0x14'),_0x172b8c,_0x22803a?_0x5be2('0x15'):_0x5be2('0x16'));return _0x5caa4c(_0x22803a);})[_0x5be2('0x17')](function(_0x565bbc){logger[_0x5be2('0x8')](_0x5be2('0x18'),_0x565bbc?util[_0x5be2('0x6')](_0x565bbc,{'showHidden':![],'depth':null}):'');return _0x5caa4c(null);});}return _0x5caa4c(null);});};exports[_0x5be2('0x19')]=function(_0x2197fe){return new BPromise(function(_0x1e87e4,_0x5e75e2){if(_0x2197fe){return getUser({'interface':_0x2197fe})[_0x5be2('0xa')](function(_0x2c5628){logger[_0x5be2('0x5')](_0x5be2('0x1a'),_0x2197fe,_0x2c5628?_0x5be2('0x15'):_0x5be2('0x16'));return _0x1e87e4(_0x2c5628);})[_0x5be2('0x17')](function(_0x209946){logger[_0x5be2('0x8')](_0x5be2('0x1b'),_0x209946?util[_0x5be2('0x6')](_0x209946,{'showHidden':![],'depth':null}):'');return _0x1e87e4(null);});}return _0x1e87e4(null);});};exports[_0x5be2('0x1c')]=function(_0x461524){return new BPromise(function(_0x3c9fd9,_0x4404c8){if(_0x461524){return getUser({'name':_0x461524})[_0x5be2('0xa')](function(_0xf2f283){logger[_0x5be2('0x5')](_0x5be2('0x1d'),_0x461524,_0xf2f283?_0x5be2('0x15'):_0x5be2('0x16'));return _0x3c9fd9(_0xf2f283);})[_0x5be2('0x17')](function(_0x4d92b7){logger['error'](_0x5be2('0x1e'),_0x4d92b7?util[_0x5be2('0x6')](_0x4d92b7,{'showHidden':![],'depth':null}):'');return _0x3c9fd9(null);});}return _0x3c9fd9(null);});};exports[_0x5be2('0x1f')]=function(_0x50c149){return new BPromise(function(_0x39f099,_0x34592b){if(_0x50c149){return client[_0x5be2('0x9')](_0x5be2('0x20'),{'options':{'raw':!![],'attributes':['id',_0x5be2('0xe'),_0x5be2('0x21'),_0x5be2('0x22'),_0x5be2('0x23')],'where':{'name':_0x50c149},'limit':0x1}})[_0x5be2('0xa')](function(_0x4518a3){logger[_0x5be2('0x7')](_0x5be2('0x24'),_0x50c149,_0x4518a3?util[_0x5be2('0x6')](_0x4518a3,{'showHidden':![],'depth':null}):'');logger[_0x5be2('0x5')](_0x5be2('0x25'),_0x50c149,_0x4518a3?_0x5be2('0x15'):'notfound');return _0x39f099(_0x4518a3['result']['length']?_0x4518a3[_0x5be2('0x12')][0x0]:null);})[_0x5be2('0x17')](function(_0x2889d){logger[_0x5be2('0x8')](_0x5be2('0x26'),_0x2889d?util[_0x5be2('0x6')](_0x2889d,{'showHidden':![],'depth':null}):'');return _0x39f099(null);});}return _0x39f099(null);});};exports['addTime']=function(_0x38c7a6,_0x32eb23){return moment(_0x38c7a6)[_0x5be2('0x27')](_0x32eb23,'seconds')[_0x5be2('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5be2('0x29')]=function(_0x2232b4,_0x3e0297){return moment(_0x2232b4)['subtract'](_0x3e0297,_0x5be2('0x2a'))['format'](_0x5be2('0x2b'));};exports[_0x5be2('0x2c')]=function(_0xf837b6,_0x127cea){return moment(_0xf837b6)['diff'](moment(_0x127cea),_0x5be2('0x2a'));};exports[_0x5be2('0x2d')]=function(_0x43b046,_0x1b3d21){return parseInt(_0x43b046,0xa)+parseInt(_0x1b3d21,0xa);};exports['now']=function(){return moment()['format'](_0x5be2('0x2b'));};exports[_0x5be2('0x2e')]=function(_0x4b1aa4,_0xa8ecd){if(_0xa8ecd){return moment(_0x4b1aa4)[_0x5be2('0x2e')](_0xa8ecd);}return!![];};exports[_0x5be2('0x2f')]=function(_0x5cfb8a,_0x28daa5){if(_0x28daa5){return moment(_0x5cfb8a)[_0x5be2('0x2f')](_0x28daa5);}else if(_0x5cfb8a){return!![];}return![];}; \ No newline at end of file